summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml3
-rw-r--r--.gitignore4
-rw-r--r--.travis.yml103
-rw-r--r--AUTHORS.md12
-rw-r--r--CODEOWNERS37
-rw-r--r--COPYRIGHT.txt647
-rw-r--r--DONORS.md138
-rw-r--r--README.md2
-rw-r--r--SConstruct387
-rw-r--r--compat.py4
-rw-r--r--core/SCsub26
-rw-r--r--core/array.cpp8
-rw-r--r--core/array.h2
-rw-r--r--core/bind/core_bind.cpp128
-rw-r--r--core/bind/core_bind.h24
-rw-r--r--core/class_db.cpp37
-rw-r--r--core/class_db.h18
-rw-r--r--core/color.cpp30
-rw-r--r--core/color_names.inc2
-rw-r--r--core/command_queue_mt.cpp1
-rw-r--r--core/command_queue_mt.h24
-rw-r--r--core/dictionary.cpp30
-rw-r--r--core/dictionary.h4
-rw-r--r--core/engine.cpp86
-rw-r--r--core/engine.h9
-rw-r--r--core/error_macros.h10
-rw-r--r--core/hashfuncs.h7
-rw-r--r--core/image.cpp252
-rw-r--r--core/image.h7
-rw-r--r--core/input_map.cpp91
-rw-r--r--core/input_map.h13
-rw-r--r--core/io/file_access_pack.cpp6
-rw-r--r--core/io/http_client.cpp88
-rw-r--r--core/io/http_client.h1
-rw-r--r--core/io/image_loader.cpp2
-rw-r--r--core/io/logger.cpp9
-rw-r--r--core/io/marshalls.cpp6
-rw-r--r--core/io/multiplayer_api.cpp817
-rw-r--r--core/io/multiplayer_api.h134
-rw-r--r--core/io/packet_peer.cpp2
-rw-r--r--core/io/pck_packer.cpp8
-rw-r--r--core/io/resource_format_binary.cpp8
-rw-r--r--core/io/resource_saver.cpp2
-rw-r--r--core/io/stream_peer_ssl.cpp31
-rw-r--r--core/io/stream_peer_ssl.h1
-rw-r--r--core/io/translation_loader_po.cpp2
-rw-r--r--core/make_binders.py10
-rw-r--r--core/math/a_star.cpp24
-rw-r--r--core/math/a_star.h2
-rw-r--r--core/math/aabb.h20
-rw-r--r--core/math/delaunay.cpp1
-rw-r--r--core/math/delaunay.h145
-rw-r--r--core/math/geometry.h28
-rw-r--r--core/math/math_2d.cpp13
-rw-r--r--core/math/math_2d.h14
-rw-r--r--core/math/math_funcs.cpp15
-rw-r--r--core/math/math_funcs.h14
-rw-r--r--core/math/matrix3.cpp100
-rw-r--r--core/math/matrix3.h21
-rw-r--r--core/math/quat.cpp28
-rw-r--r--core/math/quat.h28
-rw-r--r--core/math/quick_hull.cpp2
-rw-r--r--core/math/transform.cpp8
-rw-r--r--core/math/triangle_mesh.cpp236
-rw-r--r--core/math/triangle_mesh.h6
-rw-r--r--core/math/triangulate.cpp42
-rw-r--r--core/math/triangulate.h5
-rw-r--r--core/math/vector3.h16
-rw-r--r--core/method_bind.h28
-rw-r--r--core/method_ptrcall.h45
-rw-r--r--core/node_path.cpp40
-rw-r--r--core/node_path.h15
-rw-r--r--core/oa_hash_map.h617
-rw-r--r--core/object.cpp5
-rw-r--r--core/object.h11
-rw-r--r--core/os/dir_access.cpp7
-rw-r--r--core/os/file_access.h3
-rw-r--r--core/os/input.cpp6
-rw-r--r--core/os/input.h6
-rw-r--r--core/os/input_event.cpp95
-rw-r--r--core/os/input_event.h24
-rw-r--r--core/os/keyboard.cpp121
-rw-r--r--core/os/keyboard.h1
-rw-r--r--core/os/os.cpp32
-rw-r--r--core/os/os.h45
-rw-r--r--core/os/thread_dummy.cpp8
-rw-r--r--core/os/thread_dummy.h17
-rw-r--r--core/pool_allocator.cpp2
-rw-r--r--core/project_settings.cpp49
-rw-r--r--core/project_settings.h2
-rw-r--r--core/reference.h5
-rw-r--r--core/register_core_types.cpp2
-rw-r--r--core/resource.cpp18
-rw-r--r--core/script_debugger_local.cpp207
-rw-r--r--core/script_debugger_local.h6
-rw-r--r--core/script_debugger_remote.cpp67
-rw-r--r--core/script_debugger_remote.h2
-rw-r--r--core/script_language.cpp14
-rw-r--r--core/script_language.h29
-rw-r--r--core/self_list.h41
-rw-r--r--core/string_buffer.h6
-rw-r--r--core/string_builder.h6
-rw-r--r--core/string_db.cpp13
-rw-r--r--core/string_db.h7
-rw-r--r--core/type_info.h1
-rw-r--r--core/undo_redo.cpp16
-rw-r--r--core/undo_redo.h4
-rw-r--r--core/ustring.cpp166
-rw-r--r--core/ustring.h6
-rw-r--r--core/variant.cpp30
-rw-r--r--core/variant.h4
-rw-r--r--core/variant_call.cpp50
-rw-r--r--core/variant_op.cpp51
-rw-r--r--core/version.h29
-rw-r--r--doc/classes/@GDScript.xml24
-rw-r--r--doc/classes/@GlobalScope.xml5
-rw-r--r--doc/classes/@NativeScript.xml2
-rw-r--r--doc/classes/@VisualScript.xml2
-rw-r--r--doc/classes/AABB.xml4
-rw-r--r--doc/classes/ARVRAnchor.xml4
-rw-r--r--doc/classes/ARVRCamera.xml2
-rw-r--r--doc/classes/ARVRController.xml2
-rw-r--r--doc/classes/ARVRInterface.xml2
-rw-r--r--doc/classes/ARVROrigin.xml2
-rw-r--r--doc/classes/ARVRPositionalTracker.xml2
-rw-r--r--doc/classes/ARVRServer.xml38
-rw-r--r--doc/classes/AStar.xml2
-rw-r--r--doc/classes/AcceptDialog.xml4
-rw-r--r--doc/classes/AnimatedSprite.xml4
-rw-r--r--doc/classes/AnimatedSprite3D.xml2
-rw-r--r--doc/classes/Animation.xml230
-rw-r--r--doc/classes/AnimationPlayer.xml16
-rw-r--r--doc/classes/AnimationTrackEditPlugin.xml15
-rw-r--r--doc/classes/AnimationTreePlayer.xml10
-rw-r--r--doc/classes/Area.xml8
-rw-r--r--doc/classes/Area2D.xml2
-rw-r--r--doc/classes/Array.xml21
-rw-r--r--doc/classes/ArrayMesh.xml20
-rw-r--r--doc/classes/AtlasTexture.xml2
-rw-r--r--doc/classes/AudioBusLayout.xml2
-rw-r--r--doc/classes/AudioEffect.xml2
-rw-r--r--doc/classes/AudioEffectAmplify.xml2
-rw-r--r--doc/classes/AudioEffectBandLimitFilter.xml2
-rw-r--r--doc/classes/AudioEffectBandPassFilter.xml2
-rw-r--r--doc/classes/AudioEffectChorus.xml2
-rw-r--r--doc/classes/AudioEffectCompressor.xml2
-rw-r--r--doc/classes/AudioEffectDelay.xml2
-rw-r--r--doc/classes/AudioEffectDistortion.xml2
-rw-r--r--doc/classes/AudioEffectEQ.xml2
-rw-r--r--doc/classes/AudioEffectEQ10.xml3
-rw-r--r--doc/classes/AudioEffectEQ21.xml3
-rw-r--r--doc/classes/AudioEffectEQ6.xml3
-rw-r--r--doc/classes/AudioEffectFilter.xml2
-rw-r--r--doc/classes/AudioEffectHighPassFilter.xml2
-rw-r--r--doc/classes/AudioEffectHighShelfFilter.xml2
-rw-r--r--doc/classes/AudioEffectLimiter.xml2
-rw-r--r--doc/classes/AudioEffectLowPassFilter.xml2
-rw-r--r--doc/classes/AudioEffectLowShelfFilter.xml2
-rw-r--r--doc/classes/AudioEffectNotchFilter.xml2
-rw-r--r--doc/classes/AudioEffectPanner.xml2
-rw-r--r--doc/classes/AudioEffectPhaser.xml2
-rw-r--r--doc/classes/AudioEffectPitchShift.xml2
-rw-r--r--doc/classes/AudioEffectReverb.xml2
-rw-r--r--doc/classes/AudioEffectStereoEnhance.xml2
-rw-r--r--doc/classes/AudioServer.xml24
-rw-r--r--doc/classes/AudioStream.xml4
-rw-r--r--doc/classes/AudioStreamPlayback.xml2
-rw-r--r--doc/classes/AudioStreamPlayer.xml7
-rw-r--r--doc/classes/AudioStreamPlayer2D.xml7
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml9
-rw-r--r--doc/classes/AudioStreamRandomPitch.xml2
-rw-r--r--doc/classes/AudioStreamSample.xml5
-rw-r--r--doc/classes/BackBufferCopy.xml2
-rw-r--r--doc/classes/BakedLightmap.xml4
-rw-r--r--doc/classes/BakedLightmapData.xml2
-rw-r--r--doc/classes/BaseButton.xml12
-rw-r--r--doc/classes/Basis.xml21
-rw-r--r--doc/classes/BitMap.xml6
-rw-r--r--doc/classes/BitmapFont.xml2
-rw-r--r--doc/classes/Bone2D.xml39
-rw-r--r--doc/classes/BoneAttachment.xml2
-rw-r--r--doc/classes/BoxContainer.xml2
-rw-r--r--doc/classes/BoxShape.xml2
-rw-r--r--doc/classes/Button.xml2
-rw-r--r--doc/classes/ButtonGroup.xml2
-rw-r--r--doc/classes/Camera.xml28
-rw-r--r--doc/classes/Camera2D.xml2
-rw-r--r--doc/classes/CanvasItem.xml33
-rw-r--r--doc/classes/CanvasItemMaterial.xml2
-rw-r--r--doc/classes/CanvasLayer.xml12
-rw-r--r--doc/classes/CanvasModulate.xml2
-rw-r--r--doc/classes/CapsuleMesh.xml2
-rw-r--r--doc/classes/CapsuleShape.xml2
-rw-r--r--doc/classes/CapsuleShape2D.xml4
-rw-r--r--doc/classes/CenterContainer.xml2
-rw-r--r--doc/classes/CheckBox.xml4
-rw-r--r--doc/classes/CheckButton.xml2
-rw-r--r--doc/classes/CircleShape2D.xml2
-rw-r--r--doc/classes/ClassDB.xml4
-rw-r--r--doc/classes/CollisionObject.xml2
-rw-r--r--doc/classes/CollisionObject2D.xml2
-rw-r--r--doc/classes/CollisionPolygon.xml2
-rw-r--r--doc/classes/CollisionPolygon2D.xml2
-rw-r--r--doc/classes/CollisionShape.xml6
-rw-r--r--doc/classes/CollisionShape2D.xml6
-rw-r--r--doc/classes/Color.xml20
-rw-r--r--doc/classes/ColorPicker.xml5
-rw-r--r--doc/classes/ColorPickerButton.xml10
-rw-r--r--doc/classes/ColorRect.xml2
-rw-r--r--doc/classes/ConcavePolygonShape.xml2
-rw-r--r--doc/classes/ConcavePolygonShape2D.xml2
-rw-r--r--doc/classes/ConeTwistJoint.xml4
-rw-r--r--doc/classes/ConfigFile.xml4
-rw-r--r--doc/classes/ConfirmationDialog.xml2
-rw-r--r--doc/classes/Container.xml2
-rw-r--r--doc/classes/Control.xml79
-rw-r--r--doc/classes/ConvexPolygonShape.xml2
-rw-r--r--doc/classes/ConvexPolygonShape2D.xml2
-rw-r--r--doc/classes/CubeMap.xml2
-rw-r--r--doc/classes/CubeMesh.xml2
-rw-r--r--doc/classes/Curve.xml2
-rw-r--r--doc/classes/Curve2D.xml22
-rw-r--r--doc/classes/Curve3D.xml48
-rw-r--r--doc/classes/CurveTexture.xml2
-rw-r--r--doc/classes/CylinderMesh.xml2
-rw-r--r--doc/classes/DampedSpringJoint2D.xml2
-rw-r--r--doc/classes/Dictionary.xml5
-rw-r--r--doc/classes/DirectionalLight.xml4
-rw-r--r--doc/classes/Directory.xml4
-rw-r--r--doc/classes/DynamicFont.xml6
-rw-r--r--doc/classes/DynamicFontData.xml14
-rw-r--r--doc/classes/EditorExportPlugin.xml2
-rw-r--r--doc/classes/EditorFileDialog.xml2
-rw-r--r--doc/classes/EditorFileSystem.xml2
-rw-r--r--doc/classes/EditorFileSystemDirectory.xml2
-rw-r--r--doc/classes/EditorImportPlugin.xml5
-rw-r--r--doc/classes/EditorInspector.xml37
-rw-r--r--doc/classes/EditorInspectorPlugin.xml95
-rw-r--r--doc/classes/EditorInterface.xml4
-rw-r--r--doc/classes/EditorPlugin.xml80
-rw-r--r--doc/classes/EditorProperty.xml111
-rw-r--r--doc/classes/EditorResourceConversionPlugin.xml2
-rw-r--r--doc/classes/EditorResourcePreview.xml2
-rw-r--r--doc/classes/EditorResourcePreviewGenerator.xml2
-rw-r--r--doc/classes/EditorSceneImporter.xml2
-rw-r--r--doc/classes/EditorScenePostImport.xml2
-rw-r--r--doc/classes/EditorScript.xml2
-rw-r--r--doc/classes/EditorSelection.xml2
-rw-r--r--doc/classes/EditorSettings.xml26
-rw-r--r--doc/classes/EditorSpatialGizmo.xml4
-rw-r--r--doc/classes/EncodedObjectAsID.xml2
-rw-r--r--doc/classes/Engine.xml53
-rw-r--r--doc/classes/Environment.xml11
-rw-r--r--doc/classes/File.xml22
-rw-r--r--doc/classes/FileDialog.xml8
-rw-r--r--doc/classes/Font.xml12
-rw-r--r--doc/classes/FuncRef.xml2
-rw-r--r--doc/classes/GIProbe.xml4
-rw-r--r--doc/classes/GIProbeData.xml2
-rw-r--r--doc/classes/Generic6DOFJoint.xml73
-rw-r--r--doc/classes/Geometry.xml17
-rw-r--r--doc/classes/GeometryInstance.xml2
-rw-r--r--doc/classes/Gradient.xml2
-rw-r--r--doc/classes/GradientTexture.xml2
-rw-r--r--doc/classes/GraphEdit.xml3
-rw-r--r--doc/classes/GraphNode.xml2
-rw-r--r--doc/classes/GridContainer.xml14
-rw-r--r--doc/classes/GrooveJoint2D.xml2
-rw-r--r--doc/classes/HBoxContainer.xml2
-rw-r--r--doc/classes/HScrollBar.xml2
-rw-r--r--doc/classes/HSeparator.xml2
-rw-r--r--doc/classes/HSlider.xml2
-rw-r--r--doc/classes/HSplitContainer.xml2
-rw-r--r--doc/classes/HTTPClient.xml12
-rw-r--r--doc/classes/HTTPRequest.xml6
-rw-r--r--doc/classes/HingeJoint.xml2
-rw-r--r--doc/classes/IP.xml2
-rw-r--r--doc/classes/IP_Unix.xml2
-rw-r--r--doc/classes/Image.xml73
-rw-r--r--doc/classes/ImageTexture.xml6
-rw-r--r--doc/classes/ImmediateGeometry.xml2
-rw-r--r--doc/classes/Input.xml54
-rw-r--r--doc/classes/InputDefault.xml2
-rw-r--r--doc/classes/InputEvent.xml21
-rw-r--r--doc/classes/InputEventAction.xml4
-rw-r--r--doc/classes/InputEventGesture.xml2
-rw-r--r--doc/classes/InputEventJoypadButton.xml6
-rw-r--r--doc/classes/InputEventJoypadMotion.xml6
-rw-r--r--doc/classes/InputEventKey.xml6
-rw-r--r--doc/classes/InputEventMagnifyGesture.xml2
-rw-r--r--doc/classes/InputEventMouse.xml4
-rw-r--r--doc/classes/InputEventMouseButton.xml6
-rw-r--r--doc/classes/InputEventMouseMotion.xml4
-rw-r--r--doc/classes/InputEventPanGesture.xml2
-rw-r--r--doc/classes/InputEventScreenDrag.xml4
-rw-r--r--doc/classes/InputEventScreenTouch.xml4
-rw-r--r--doc/classes/InputEventWithModifiers.xml4
-rw-r--r--doc/classes/InputMap.xml27
-rw-r--r--doc/classes/InstancePlaceholder.xml14
-rw-r--r--doc/classes/InterpolatedCamera.xml9
-rw-r--r--doc/classes/ItemList.xml47
-rw-r--r--doc/classes/JSON.xml2
-rw-r--r--doc/classes/JSONParseResult.xml2
-rw-r--r--doc/classes/JavaScript.xml4
-rw-r--r--doc/classes/Joint.xml2
-rw-r--r--doc/classes/Joint2D.xml2
-rw-r--r--doc/classes/KinematicBody.xml16
-rw-r--r--doc/classes/KinematicBody2D.xml14
-rw-r--r--doc/classes/KinematicCollision.xml2
-rw-r--r--doc/classes/KinematicCollision2D.xml2
-rw-r--r--doc/classes/Label.xml4
-rw-r--r--doc/classes/LargeTexture.xml2
-rw-r--r--doc/classes/Light.xml4
-rw-r--r--doc/classes/Light2D.xml2
-rw-r--r--doc/classes/LightOccluder2D.xml2
-rw-r--r--doc/classes/Line2D.xml2
-rw-r--r--doc/classes/LineEdit.xml7
-rw-r--r--doc/classes/LineShape2D.xml2
-rw-r--r--doc/classes/LinkButton.xml4
-rw-r--r--doc/classes/Listener.xml2
-rw-r--r--doc/classes/MainLoop.xml2
-rw-r--r--doc/classes/MarginContainer.xml2
-rw-r--r--doc/classes/Marshalls.xml2
-rw-r--r--doc/classes/Material.xml2
-rw-r--r--doc/classes/MenuButton.xml2
-rw-r--r--doc/classes/Mesh.xml2
-rw-r--r--doc/classes/MeshDataTool.xml2
-rw-r--r--doc/classes/MeshInstance.xml2
-rw-r--r--doc/classes/MeshInstance2D.xml23
-rw-r--r--doc/classes/MeshLibrary.xml2
-rw-r--r--doc/classes/MultiMesh.xml2
-rw-r--r--doc/classes/MultiMeshInstance.xml2
-rw-r--r--doc/classes/MultiplayerAPI.xml163
-rw-r--r--doc/classes/Mutex.xml2
-rw-r--r--doc/classes/Navigation.xml24
-rw-r--r--doc/classes/Navigation2D.xml10
-rw-r--r--doc/classes/NavigationMesh.xml2
-rw-r--r--doc/classes/NavigationMeshInstance.xml2
-rw-r--r--doc/classes/NavigationPolygon.xml2
-rw-r--r--doc/classes/NavigationPolygonInstance.xml2
-rw-r--r--doc/classes/NetworkedMultiplayerPeer.xml7
-rw-r--r--doc/classes/Nil.xml2
-rw-r--r--doc/classes/NinePatchRect.xml2
-rw-r--r--doc/classes/Node.xml133
-rw-r--r--doc/classes/Node2D.xml4
-rw-r--r--doc/classes/NodePath.xml2
-rw-r--r--doc/classes/OS.xml143
-rw-r--r--doc/classes/Object.xml5
-rw-r--r--doc/classes/OccluderPolygon2D.xml2
-rw-r--r--doc/classes/OmniLight.xml4
-rw-r--r--doc/classes/OptionButton.xml11
-rw-r--r--doc/classes/OrientedPathFollow.xml40
-rw-r--r--doc/classes/PCKPacker.xml2
-rw-r--r--doc/classes/PHashTranslation.xml2
-rw-r--r--doc/classes/PackedDataContainer.xml2
-rw-r--r--doc/classes/PackedDataContainerRef.xml2
-rw-r--r--doc/classes/PackedScene.xml11
-rw-r--r--doc/classes/PacketPeer.xml2
-rw-r--r--doc/classes/PacketPeerStream.xml2
-rw-r--r--doc/classes/PacketPeerUDP.xml6
-rw-r--r--doc/classes/Panel.xml2
-rw-r--r--doc/classes/PanelContainer.xml2
-rw-r--r--doc/classes/PanoramaSky.xml5
-rw-r--r--doc/classes/ParallaxBackground.xml2
-rw-r--r--doc/classes/ParallaxLayer.xml2
-rw-r--r--doc/classes/Particles.xml11
-rw-r--r--doc/classes/Particles2D.xml2
-rw-r--r--doc/classes/ParticlesMaterial.xml4
-rw-r--r--doc/classes/Path.xml8
-rw-r--r--doc/classes/Path2D.xml2
-rw-r--r--doc/classes/PathFollow.xml2
-rw-r--r--doc/classes/PathFollow2D.xml2
-rw-r--r--doc/classes/Performance.xml2
-rw-r--r--doc/classes/PhysicalBone.xml63
-rw-r--r--doc/classes/Physics2DDirectBodyState.xml2
-rw-r--r--doc/classes/Physics2DDirectBodyStateSW.xml2
-rw-r--r--doc/classes/Physics2DDirectSpaceState.xml4
-rw-r--r--doc/classes/Physics2DServer.xml34
-rw-r--r--doc/classes/Physics2DServerSW.xml2
-rw-r--r--doc/classes/Physics2DShapeQueryParameters.xml2
-rw-r--r--doc/classes/Physics2DShapeQueryResult.xml2
-rw-r--r--doc/classes/Physics2DTestMotionResult.xml2
-rw-r--r--doc/classes/PhysicsBody.xml4
-rw-r--r--doc/classes/PhysicsBody2D.xml4
-rw-r--r--doc/classes/PhysicsDirectBodyState.xml20
-rw-r--r--doc/classes/PhysicsDirectSpaceState.xml4
-rw-r--r--doc/classes/PhysicsServer.xml53
-rw-r--r--doc/classes/PhysicsShapeQueryParameters.xml2
-rw-r--r--doc/classes/PhysicsShapeQueryResult.xml2
-rw-r--r--doc/classes/PinJoint.xml2
-rw-r--r--doc/classes/PinJoint2D.xml4
-rw-r--r--doc/classes/Plane.xml6
-rw-r--r--doc/classes/PlaneMesh.xml2
-rw-r--r--doc/classes/PlaneShape.xml2
-rw-r--r--doc/classes/Polygon2D.xml74
-rw-r--r--doc/classes/PolygonPathFinder.xml2
-rw-r--r--doc/classes/PoolByteArray.xml4
-rw-r--r--doc/classes/PoolColorArray.xml4
-rw-r--r--doc/classes/PoolIntArray.xml4
-rw-r--r--doc/classes/PoolRealArray.xml4
-rw-r--r--doc/classes/PoolStringArray.xml4
-rw-r--r--doc/classes/PoolVector2Array.xml4
-rw-r--r--doc/classes/PoolVector3Array.xml4
-rw-r--r--doc/classes/Popup.xml3
-rw-r--r--doc/classes/PopupDialog.xml2
-rw-r--r--doc/classes/PopupMenu.xml81
-rw-r--r--doc/classes/PopupPanel.xml2
-rw-r--r--doc/classes/Position2D.xml2
-rw-r--r--doc/classes/Position3D.xml4
-rw-r--r--doc/classes/PrimitiveMesh.xml6
-rw-r--r--doc/classes/PrismMesh.xml4
-rw-r--r--doc/classes/ProceduralSky.xml21
-rw-r--r--doc/classes/ProgressBar.xml2
-rw-r--r--doc/classes/ProjectSettings.xml532
-rw-r--r--doc/classes/ProximityGroup.xml2
-rw-r--r--doc/classes/ProxyTexture.xml2
-rw-r--r--doc/classes/QuadMesh.xml2
-rw-r--r--doc/classes/Quat.xml61
-rw-r--r--doc/classes/RID.xml2
-rw-r--r--doc/classes/Range.xml6
-rw-r--r--doc/classes/RayCast.xml2
-rw-r--r--doc/classes/RayCast2D.xml2
-rw-r--r--doc/classes/RayShape.xml5
-rw-r--r--doc/classes/RayShape2D.xml5
-rw-r--r--doc/classes/Rect2.xml5
-rw-r--r--doc/classes/RectangleShape2D.xml2
-rw-r--r--doc/classes/Reference.xml2
-rw-r--r--doc/classes/ReferenceRect.xml2
-rw-r--r--doc/classes/ReflectionProbe.xml4
-rw-r--r--doc/classes/RemoteTransform.xml2
-rw-r--r--doc/classes/RemoteTransform2D.xml2
-rw-r--r--doc/classes/Resource.xml2
-rw-r--r--doc/classes/ResourceImporter.xml2
-rw-r--r--doc/classes/ResourceInteractiveLoader.xml2
-rw-r--r--doc/classes/ResourceLoader.xml2
-rw-r--r--doc/classes/ResourcePreloader.xml2
-rw-r--r--doc/classes/ResourceSaver.xml2
-rw-r--r--doc/classes/RichTextLabel.xml19
-rw-r--r--doc/classes/RigidBody.xml6
-rw-r--r--doc/classes/RigidBody2D.xml8
-rw-r--r--doc/classes/SceneState.xml2
-rw-r--r--doc/classes/SceneTree.xml65
-rw-r--r--doc/classes/SceneTreeTimer.xml2
-rw-r--r--doc/classes/Script.xml5
-rw-r--r--doc/classes/ScriptEditor.xml2
-rw-r--r--doc/classes/ScrollBar.xml3
-rw-r--r--doc/classes/ScrollContainer.xml34
-rw-r--r--doc/classes/SegmentShape2D.xml2
-rw-r--r--doc/classes/Semaphore.xml2
-rw-r--r--doc/classes/Separator.xml2
-rw-r--r--doc/classes/Shader.xml9
-rw-r--r--doc/classes/ShaderMaterial.xml7
-rw-r--r--doc/classes/Shape.xml4
-rw-r--r--doc/classes/Shape2D.xml4
-rw-r--r--doc/classes/ShortCut.xml2
-rw-r--r--doc/classes/Skeleton.xml41
-rw-r--r--doc/classes/Skeleton2D.xml35
-rw-r--r--doc/classes/Sky.xml2
-rw-r--r--doc/classes/Slider.xml2
-rw-r--r--doc/classes/SliderJoint.xml2
-rw-r--r--doc/classes/Spatial.xml12
-rw-r--r--doc/classes/SpatialGizmo.xml2
-rw-r--r--doc/classes/SpatialMaterial.xml10
-rw-r--r--doc/classes/SpatialVelocityTracker.xml2
-rw-r--r--doc/classes/SphereMesh.xml2
-rw-r--r--doc/classes/SphereShape.xml2
-rw-r--r--doc/classes/SpinBox.xml2
-rw-r--r--doc/classes/SplitContainer.xml3
-rw-r--r--doc/classes/SpotLight.xml4
-rw-r--r--doc/classes/Sprite.xml9
-rw-r--r--doc/classes/Sprite3D.xml2
-rw-r--r--doc/classes/SpriteBase3D.xml8
-rw-r--r--doc/classes/SpriteFrames.xml4
-rw-r--r--doc/classes/StaticBody.xml2
-rw-r--r--doc/classes/StaticBody2D.xml2
-rw-r--r--doc/classes/StreamPeer.xml2
-rw-r--r--doc/classes/StreamPeerBuffer.xml2
-rw-r--r--doc/classes/StreamPeerSSL.xml4
-rw-r--r--doc/classes/StreamPeerTCP.xml2
-rw-r--r--doc/classes/StreamTexture.xml2
-rw-r--r--doc/classes/String.xml52
-rw-r--r--doc/classes/StyleBox.xml2
-rw-r--r--doc/classes/StyleBoxEmpty.xml2
-rw-r--r--doc/classes/StyleBoxFlat.xml2
-rw-r--r--doc/classes/StyleBoxLine.xml2
-rw-r--r--doc/classes/StyleBoxTexture.xml6
-rw-r--r--doc/classes/SurfaceTool.xml5
-rw-r--r--doc/classes/TCP_Server.xml2
-rw-r--r--doc/classes/TabContainer.xml18
-rw-r--r--doc/classes/Tabs.xml18
-rw-r--r--doc/classes/TextEdit.xml22
-rw-r--r--doc/classes/Texture.xml2
-rw-r--r--doc/classes/TextureButton.xml2
-rw-r--r--doc/classes/TextureProgress.xml8
-rw-r--r--doc/classes/TextureRect.xml10
-rw-r--r--doc/classes/Theme.xml2
-rw-r--r--doc/classes/Thread.xml2
-rw-r--r--doc/classes/TileMap.xml56
-rw-r--r--doc/classes/TileSet.xml48
-rw-r--r--doc/classes/Timer.xml6
-rw-r--r--doc/classes/ToolButton.xml3
-rw-r--r--doc/classes/TouchScreenButton.xml2
-rw-r--r--doc/classes/Transform.xml9
-rw-r--r--doc/classes/Transform2D.xml2
-rw-r--r--doc/classes/Translation.xml2
-rw-r--r--doc/classes/TranslationServer.xml2
-rw-r--r--doc/classes/Tree.xml2
-rw-r--r--doc/classes/TreeItem.xml4
-rw-r--r--doc/classes/TriangleMesh.xml2
-rw-r--r--doc/classes/Tween.xml119
-rw-r--r--doc/classes/UndoRedo.xml2
-rw-r--r--doc/classes/VBoxContainer.xml2
-rw-r--r--doc/classes/VScrollBar.xml2
-rw-r--r--doc/classes/VSeparator.xml2
-rw-r--r--doc/classes/VSlider.xml2
-rw-r--r--doc/classes/VSplitContainer.xml2
-rw-r--r--doc/classes/Variant.xml2
-rw-r--r--doc/classes/Vector2.xml83
-rw-r--r--doc/classes/Vector3.xml65
-rw-r--r--doc/classes/VehicleBody.xml2
-rw-r--r--doc/classes/VehicleWheel.xml18
-rw-r--r--doc/classes/VideoPlayer.xml33
-rw-r--r--doc/classes/VideoStream.xml2
-rw-r--r--doc/classes/Viewport.xml17
-rw-r--r--doc/classes/ViewportContainer.xml2
-rw-r--r--doc/classes/ViewportTexture.xml6
-rw-r--r--doc/classes/VisibilityEnabler.xml2
-rw-r--r--doc/classes/VisibilityEnabler2D.xml2
-rw-r--r--doc/classes/VisibilityNotifier.xml2
-rw-r--r--doc/classes/VisibilityNotifier2D.xml2
-rw-r--r--doc/classes/VisualInstance.xml2
-rw-r--r--doc/classes/VisualServer.xml49
-rw-r--r--doc/classes/WeakRef.xml2
-rw-r--r--doc/classes/WebSocketClient.xml53
-rw-r--r--doc/classes/WebSocketPeer.xml51
-rw-r--r--doc/classes/WebSocketServer.xml69
-rw-r--r--doc/classes/WindowDialog.xml2
-rw-r--r--doc/classes/World.xml4
-rw-r--r--doc/classes/World2D.xml4
-rw-r--r--doc/classes/WorldEnvironment.xml4
-rw-r--r--doc/classes/XMLParser.xml2
-rw-r--r--doc/classes/YSort.xml2
-rw-r--r--doc/classes/bool.xml2
-rw-r--r--doc/classes/float.xml2
-rw-r--r--doc/classes/int.xml2
-rw-r--r--doc/tools/makemd.py4
-rwxr-xr-x[-rw-r--r--]doc/tools/makerst.py80
-rw-r--r--drivers/SCsub1
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp143
-rw-r--r--drivers/alsa/audio_driver_alsa.h13
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp225
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.h23
-rw-r--r--drivers/dummy/audio_driver_dummy.h6
-rw-r--r--drivers/dummy/rasterizer_dummy.h192
-rw-r--r--drivers/dummy/texture_loader_dummy.cpp87
-rw-r--r--drivers/dummy/texture_loader_dummy.h47
-rw-r--r--drivers/gles2/SCsub7
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp1147
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.h129
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp463
-rw-r--r--drivers/gles2/rasterizer_gles2.h72
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp235
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h258
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp2069
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h840
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp891
-rw-r--r--drivers/gles2/shader_compiler_gles2.h101
-rw-r--r--drivers/gles2/shader_gles2.cpp689
-rw-r--r--drivers/gles2/shader_gles2.h386
-rw-r--r--drivers/gles2/shaders/SCsub22
-rw-r--r--drivers/gles2/shaders/blend_shape.glsl197
-rw-r--r--drivers/gles2/shaders/canvas.glsl141
-rw-r--r--drivers/gles2/shaders/canvas_shadow.glsl49
-rw-r--r--drivers/gles2/shaders/copy.glsl72
-rw-r--r--drivers/gles2/shaders/cube_to_dp.glsl79
-rw-r--r--drivers/gles2/shaders/cubemap_filter.glsl294
-rw-r--r--drivers/gles2/shaders/effect_blur.glsl301
-rw-r--r--drivers/gles2/shaders/exposure.glsl98
-rw-r--r--drivers/gles2/shaders/particles.glsl260
-rw-r--r--drivers/gles2/shaders/resolve.glsl44
-rw-r--r--drivers/gles2/shaders/scene.glsl2113
-rw-r--r--drivers/gles2/shaders/screen_space_reflection.glsl318
-rw-r--r--drivers/gles2/shaders/ssao.glsl293
-rw-r--r--drivers/gles2/shaders/ssao_blur.glsl124
-rw-r--r--drivers/gles2/shaders/ssao_minify.glsl59
-rw-r--r--drivers/gles2/shaders/subsurf_scattering.glsl192
-rw-r--r--drivers/gles2/shaders/tonemap.glsl323
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp118
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h7
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp87
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp38
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h7
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp88
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h4
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp4
-rw-r--r--drivers/gles3/shaders/canvas.glsl117
-rw-r--r--drivers/gles3/shaders/scene.glsl16
-rw-r--r--drivers/gles3/shaders/tonemap.glsl4
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp464
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.h29
-rw-r--r--drivers/rtaudio/audio_driver_rtaudio.cpp2
-rw-r--r--drivers/unix/dir_access_unix.cpp2
-rw-r--r--drivers/unix/file_access_unix.cpp19
-rw-r--r--drivers/unix/file_access_unix.h4
-rw-r--r--drivers/unix/ip_unix.cpp6
-rw-r--r--drivers/unix/os_unix.cpp27
-rw-r--r--drivers/unix/os_unix.h7
-rw-r--r--drivers/unix/socket_helpers.h7
-rw-r--r--drivers/unix/stream_peer_tcp_posix.cpp22
-rw-r--r--drivers/unix/tcp_server_posix.cpp17
-rw-r--r--drivers/unix/thread_posix.cpp2
-rw-r--r--drivers/unix/thread_posix.h2
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp159
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h6
-rw-r--r--drivers/windows/dir_access_windows.cpp27
-rw-r--r--drivers/windows/file_access_windows.cpp60
-rw-r--r--drivers/windows/file_access_windows.h5
-rw-r--r--drivers/windows/stream_peer_tcp_winsock.cpp5
-rw-r--r--drivers/windows/tcp_server_winsock.cpp1
-rw-r--r--editor/SCsub319
-rw-r--r--editor/animation_bezier_editor.cpp1183
-rw-r--r--editor/animation_bezier_editor.h141
-rw-r--r--editor/animation_editor.cpp4112
-rw-r--r--editor/animation_editor.h348
-rw-r--r--editor/animation_track_editor.cpp5032
-rw-r--r--editor/animation_track_editor.h484
-rw-r--r--editor/animation_track_editor_plugins.cpp1317
-rw-r--r--editor/animation_track_editor_plugins.h139
-rw-r--r--editor/audio_stream_preview.cpp211
-rw-r--r--editor/audio_stream_preview.h56
-rw-r--r--editor/code_editor.cpp79
-rw-r--r--editor/code_editor.h2
-rw-r--r--editor/collada/collada.cpp4
-rw-r--r--editor/connections_dialog.cpp678
-rw-r--r--editor/connections_dialog.h85
-rw-r--r--editor/create_dialog.cpp32
-rw-r--r--editor/dependency_editor.cpp55
-rw-r--r--editor/dependency_editor.h3
-rw-r--r--editor/doc/doc_data.cpp37
-rw-r--r--editor/doc/doc_data.h2
-rw-r--r--editor/doc/doc_dump.cpp2
-rw-r--r--editor/editor_about.cpp58
-rw-r--r--editor/editor_about.h2
-rw-r--r--editor/editor_audio_buses.cpp29
-rw-r--r--editor/editor_autoload_settings.cpp223
-rw-r--r--editor/editor_autoload_settings.h12
-rw-r--r--editor/editor_data.cpp78
-rw-r--r--editor/editor_data.h11
-rw-r--r--editor/editor_export.cpp44
-rw-r--r--editor/editor_export.h3
-rw-r--r--editor/editor_file_dialog.cpp3
-rw-r--r--editor/editor_file_system.cpp86
-rw-r--r--editor/editor_fonts.cpp78
-rw-r--r--editor/editor_help.cpp278
-rw-r--r--editor/editor_help.h49
-rw-r--r--editor/editor_inspector.cpp2009
-rw-r--r--editor/editor_inspector.h329
-rw-r--r--editor/editor_log.cpp9
-rw-r--r--editor/editor_log.h2
-rw-r--r--editor/editor_node.cpp1326
-rw-r--r--editor/editor_node.h95
-rw-r--r--editor/editor_plugin.cpp48
-rw-r--r--editor/editor_plugin.h6
-rw-r--r--editor/editor_profiler.cpp23
-rw-r--r--editor/editor_profiler.h2
-rw-r--r--editor/editor_properties.cpp2742
-rw-r--r--editor/editor_properties.h550
-rw-r--r--editor/editor_properties_array_dict.cpp1017
-rw-r--r--editor/editor_properties_array_dict.h117
-rw-r--r--editor/editor_settings.cpp156
-rw-r--r--editor/editor_settings.h4
-rw-r--r--editor/editor_spin_slider.cpp363
-rw-r--r--editor/editor_spin_slider.h92
-rw-r--r--editor/editor_themes.cpp144
-rw-r--r--editor/export_template_manager.cpp30
-rw-r--r--editor/filesystem_dock.cpp148
-rw-r--r--editor/filesystem_dock.h8
-rw-r--r--editor/find_in_files.cpp827
-rw-r--r--editor/find_in_files.h184
-rw-r--r--editor/groups_editor.cpp440
-rw-r--r--editor/groups_editor.h66
-rw-r--r--editor/icons/README.md4
-rw-r--r--editor/icons/SCsub5
-rw-r--r--editor/icons/icon_GUI_slider_grabber.svg85
-rw-r--r--editor/icons/icon_GUI_slider_grabber_hl.svg84
-rw-r--r--editor/icons/icon_add_split.svg8
-rw-r--r--editor/icons/icon_animation_filter.svg63
-rw-r--r--editor/icons/icon_animation_track_group.svg63
-rw-r--r--editor/icons/icon_animation_track_list.svg60
-rw-r--r--editor/icons/icon_animation_tree.svg5
-rw-r--r--editor/icons/icon_asset_lib.svg2
-rw-r--r--editor/icons/icon_audio_bus_layout.svg4
-rw-r--r--editor/icons/icon_audio_stream_player.svg4
-rw-r--r--editor/icons/icon_audio_stream_player_2_d.svg4
-rw-r--r--editor/icons/icon_audio_stream_player_3_d.svg4
-rw-r--r--editor/icons/icon_audio_stream_sample.svg4
-rw-r--r--editor/icons/icon_auto_end.svg68
-rw-r--r--editor/icons/icon_auto_triangle.svg64
-rw-r--r--editor/icons/icon_bezier_handles_balanced.svg98
-rw-r--r--editor/icons/icon_bezier_handles_free.svg98
-rw-r--r--editor/icons/icon_bezier_handles_mirror.svg98
-rw-r--r--editor/icons/icon_bone_2_d.svg61
-rw-r--r--editor/icons/icon_bus_vu_db.svg4
-rw-r--r--editor/icons/icon_bus_vu_empty.svg4
-rw-r--r--editor/icons/icon_bus_vu_full.svg4
-rw-r--r--editor/icons/icon_c_s_g_box.svg6
-rw-r--r--editor/icons/icon_c_s_g_capsule.svg6
-rw-r--r--editor/icons/icon_c_s_g_combiner.svg8
-rw-r--r--editor/icons/icon_c_s_g_cylinder.svg6
-rw-r--r--editor/icons/icon_c_s_g_mesh.svg6
-rw-r--r--editor/icons/icon_c_s_g_polygon.svg6
-rw-r--r--editor/icons/icon_c_s_g_sphere.svg6
-rw-r--r--editor/icons/icon_c_s_g_torus.svg6
-rw-r--r--editor/icons/icon_color_rect.svg5
-rw-r--r--editor/icons/icon_color_track_vu.svg115
-rw-r--r--editor/icons/icon_delete_split.svg95
-rw-r--r--editor/icons/icon_edit_bezier.svg73
-rw-r--r--editor/icons/icon_editor_position.svg4
-rw-r--r--editor/icons/icon_editor_position_previous.svg3
-rw-r--r--editor/icons/icon_editor_position_unselected.svg4
-rw-r--r--editor/icons/icon_insert_after.svg7
-rw-r--r--editor/icons/icon_insert_before.svg7
-rw-r--r--editor/icons/icon_key_animation.svg65
-rw-r--r--editor/icons/icon_key_audio.svg65
-rw-r--r--editor/icons/icon_key_bezier.svg65
-rw-r--r--editor/icons/icon_key_bezier_handle.svg60
-rw-r--r--editor/icons/icon_key_bezier_point.svg64
-rw-r--r--editor/icons/icon_key_bezier_selected.svg64
-rw-r--r--editor/icons/icon_key_call.svg67
-rw-r--r--editor/icons/icon_key_selected.svg79
-rw-r--r--editor/icons/icon_key_valid.svg5
-rw-r--r--editor/icons/icon_key_xform.svg67
-rw-r--r--editor/icons/icon_move_down.svg4
-rw-r--r--editor/icons/icon_move_left.svg3
-rw-r--r--editor/icons/icon_move_right.svg3
-rw-r--r--editor/icons/icon_move_up.svg4
-rw-r--r--editor/icons/icon_oriented_path_follow.svg5
-rw-r--r--editor/icons/icon_paint_vertex.svg58
-rw-r--r--editor/icons/icon_panel.svg4
-rw-r--r--editor/icons/icon_panel_container.svg4
-rw-r--r--editor/icons/icon_physical_bone.svg77
-rw-r--r--editor/icons/icon_play_overlay.svg4
-rw-r--r--editor/icons/icon_play_travel.svg85
-rw-r--r--editor/icons/icon_time.svg74
-rw-r--r--editor/icons/icon_tool_add_node.svg80
-rw-r--r--editor/icons/icon_tool_connect.svg72
-rw-r--r--editor/icons/icon_tool_triangle.svg82
-rw-r--r--editor/icons/icon_track_capture.svg61
-rw-r--r--editor/icons/icon_transition_end.svg72
-rw-r--r--editor/icons/icon_transition_end_auto.svg74
-rw-r--r--editor/icons/icon_transition_end_auto_big.svg74
-rw-r--r--editor/icons/icon_transition_end_big.svg74
-rw-r--r--editor/icons/icon_transition_immediate.svg64
-rw-r--r--editor/icons/icon_transition_immediate_auto.svg64
-rw-r--r--editor/icons/icon_transition_immediate_auto_big.svg66
-rw-r--r--editor/icons/icon_transition_immediate_big.svg66
-rw-r--r--editor/icons/icon_transition_sync.svg72
-rw-r--r--editor/icons/icon_transition_sync_auto.svg74
-rw-r--r--editor/icons/icon_transition_sync_auto_big.svg74
-rw-r--r--editor/icons/icon_transition_sync_big.svg74
-rw-r--r--editor/icons/icon_translation.svg2
-rw-r--r--editor/icons/icon_unpaint_vertex.svg58
-rw-r--r--editor/import/editor_import_collada.cpp12
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp53
-rw-r--r--editor/import/resource_importer_bitmask.cpp30
-rw-r--r--editor/import/resource_importer_bitmask.h30
-rw-r--r--editor/import/resource_importer_obj.cpp11
-rw-r--r--editor/import/resource_importer_scene.cpp58
-rw-r--r--editor/import/resource_importer_texture.cpp6
-rw-r--r--editor/import/resource_importer_wav.cpp28
-rw-r--r--editor/import_dock.cpp3
-rw-r--r--editor/inspector_dock.cpp568
-rw-r--r--editor/inspector_dock.h138
-rw-r--r--editor/multi_node_edit.cpp4
-rw-r--r--editor/output_strings.cpp1
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp741
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h117
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp1023
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.h130
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp848
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.h117
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp290
-rw-r--r--editor/plugins/animation_player_editor_plugin.h32
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp1313
-rw-r--r--editor/plugins/animation_state_machine_editor.h167
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp10
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp149
-rw-r--r--editor/plugins/asset_library_editor_plugin.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp1455
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h61
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp93
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.h25
-rw-r--r--editor/plugins/cube_grid_theme_editor_plugin.cpp2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp96
-rw-r--r--editor/plugins/curve_editor_plugin.h23
-rw-r--r--editor/plugins/editor_preview_plugins.cpp398
-rw-r--r--editor/plugins/editor_preview_plugins.h37
-rw-r--r--editor/plugins/gradient_editor_plugin.cpp99
-rw-r--r--editor/plugins/gradient_editor_plugin.h35
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp32
-rw-r--r--editor/plugins/item_list_editor_plugin.h4
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp1
-rw-r--r--editor/plugins/mesh_instance_editor_plugin.cpp6
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.cpp1
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/particles_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_editor_plugin.cpp11
-rw-r--r--editor/plugins/physical_bone_plugin.cpp123
-rw-r--r--editor/plugins/physical_bone_plugin.h78
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp652
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h38
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp293
-rw-r--r--editor/plugins/root_motion_editor_plugin.h42
-rw-r--r--editor/plugins/script_editor_plugin.cpp354
-rw-r--r--editor/plugins/script_editor_plugin.h44
-rw-r--r--editor/plugins/script_text_editor.cpp133
-rw-r--r--editor/plugins/script_text_editor.h9
-rw-r--r--editor/plugins/shader_graph_editor_plugin.cpp10
-rw-r--r--editor/plugins/skeleton_2d_editor_plugin.cpp35
-rw-r--r--editor/plugins/skeleton_2d_editor_plugin.h30
-rw-r--r--editor/plugins/skeleton_editor_plugin.cpp183
-rw-r--r--editor/plugins/skeleton_editor_plugin.h95
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp172
-rw-r--r--editor/plugins/spatial_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_editor_plugin.cpp35
-rw-r--r--editor/plugins/sprite_editor_plugin.h30
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp28
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp87
-rw-r--r--editor/plugins/style_box_editor_plugin.h26
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp65
-rw-r--r--editor/plugins/texture_region_editor_plugin.h4
-rw-r--r--editor/plugins/theme_editor_plugin.cpp66
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp494
-rw-r--r--editor/plugins/tile_map_editor_plugin.h42
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp88
-rw-r--r--editor/plugins/tile_set_editor_plugin.h4
-rw-r--r--editor/project_export.cpp34
-rw-r--r--editor/project_export.h1
-rw-r--r--editor/project_manager.cpp82
-rw-r--r--editor/project_settings_editor.cpp348
-rw-r--r--editor/project_settings_editor.h6
-rw-r--r--editor/property_editor.cpp88
-rw-r--r--editor/property_editor.h3
-rw-r--r--editor/property_selector.cpp62
-rw-r--r--editor/property_selector.h4
-rw-r--r--editor/rename_dialog.cpp691
-rw-r--r--editor/rename_dialog.h119
-rw-r--r--editor/scene_tree_dock.cpp228
-rw-r--r--editor/scene_tree_dock.h4
-rw-r--r--editor/scene_tree_editor.cpp102
-rw-r--r--editor/scene_tree_editor.h6
-rw-r--r--editor/script_create_dialog.cpp21
-rw-r--r--editor/script_create_dialog.h1
-rw-r--r--editor/script_editor_debugger.cpp107
-rw-r--r--editor/script_editor_debugger.h4
-rw-r--r--editor/settings_config_dialog.cpp33
-rw-r--r--editor/spatial_editor_gizmos.cpp284
-rw-r--r--editor/spatial_editor_gizmos.h32
-rw-r--r--editor/translations/af.po174
-rw-r--r--editor/translations/ar.po356
-rw-r--r--editor/translations/bg.po212
-rw-r--r--editor/translations/bn.po369
-rw-r--r--editor/translations/ca.po264
-rw-r--r--editor/translations/cs.po997
-rw-r--r--editor/translations/da.po355
-rw-r--r--editor/translations/de.po379
-rw-r--r--editor/translations/de_CH.po181
-rw-r--r--editor/translations/editor.pot181
-rw-r--r--editor/translations/el.po309
-rw-r--r--editor/translations/es.po1040
-rw-r--r--editor/translations/es_AR.po362
-rwxr-xr-xeditor/translations/extract.py16
-rw-r--r--editor/translations/fa.po303
-rw-r--r--editor/translations/fi.po2312
-rw-r--r--editor/translations/fr.po646
-rw-r--r--editor/translations/he.po293
-rw-r--r--editor/translations/hi.po176
-rw-r--r--editor/translations/hu.po980
-rw-r--r--editor/translations/id.po1027
-rw-r--r--editor/translations/is.po262
-rw-r--r--editor/translations/it.po453
-rw-r--r--editor/translations/ja.po494
-rw-r--r--editor/translations/ko.po399
-rw-r--r--editor/translations/lt.po192
-rw-r--r--editor/translations/ms.po7956
-rw-r--r--editor/translations/nb.po655
-rw-r--r--editor/translations/nl.po1143
-rw-r--r--editor/translations/pl.po414
-rw-r--r--editor/translations/pr.po174
-rw-r--r--editor/translations/pt_BR.po331
-rw-r--r--editor/translations/pt_PT.po336
-rw-r--r--editor/translations/ro.po2183
-rw-r--r--editor/translations/ru.po398
-rw-r--r--editor/translations/sk.po226
-rw-r--r--editor/translations/sl.po1973
-rw-r--r--editor/translations/sr_Cyrl.po196
-rw-r--r--editor/translations/sr_Latn.po7955
-rw-r--r--editor/translations/sv.po333
-rw-r--r--editor/translations/ta.po173
-rw-r--r--editor/translations/th.po352
-rw-r--r--editor/translations/tr.po362
-rw-r--r--editor/translations/uk.po492
-rw-r--r--editor/translations/ur_PK.po173
-rw-r--r--editor/translations/vi.po231
-rw-r--r--editor/translations/zh_CN.po461
-rw-r--r--editor/translations/zh_HK.po222
-rw-r--r--editor/translations/zh_TW.po421
-rw-r--r--icon.pngbin11155 -> 7569 bytes
-rw-r--r--logo.pngbin19339 -> 13142 bytes
-rw-r--r--main/SCsub148
-rw-r--r--main/app_icon.pngbin5569 -> 3770 bytes
-rw-r--r--main/default_controller_mappings.h (renamed from platform/javascript/power_javascript.h)26
-rw-r--r--main/gamecontrollerdb.txt423
-rw-r--r--main/gamecontrollerdb_204.txt269
-rw-r--r--main/gamecontrollerdb_205.txt337
-rw-r--r--main/godotcontrollerdb.txt38
-rw-r--r--main/input_default.cpp453
-rw-r--r--main/input_default.h23
-rw-r--r--main/main.cpp359
-rw-r--r--main/main.h1
-rw-r--r--main/splash.pngbin21504 -> 15311 bytes
-rw-r--r--main/splash_editor.pngbin39571 -> 32577 bytes
-rw-r--r--main/tests/test_gui.cpp4
-rw-r--r--main/tests/test_main.cpp13
-rw-r--r--main/tests/test_oa_hash_map.cpp6
-rw-r--r--main/timer_sync.cpp223
-rw-r--r--main/timer_sync.h101
-rw-r--r--methods.py1000
-rwxr-xr-xmisc/dist/appimage/AppRun3
-rw-r--r--misc/dist/appimage/godot.desktop9
-rw-r--r--misc/dist/appimage/godot.pngbin12525 -> 0 bytes
-rw-r--r--misc/dist/html/default.html32
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj34
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-568h@2x.pngbin564 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-667h@2x.pngbin817 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.pngbin32836 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.pngbin2582 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.pngbin3131 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.pngbin33309 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.pngbin1676 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.pngbin33309 -> 0 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json102
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.pngbin0 -> 1641 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.pngbin0 -> 1919 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.pngbin0 -> 2392 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.pngbin0 -> 4360 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.pngbin0 -> 4192 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.pngbin0 -> 1722 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.pngbin0 -> 5097 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.pngbin0 -> 5274 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.pngbin0 -> 5513 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.pngbin0 -> 1881 bytes
-rw-r--r--misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.pngbin0 -> 5491 bytes
-rw-r--r--misc/dist/linux/godot.620
-rw-r--r--misc/dist/linux/godot.appdata.xml2
-rw-r--r--misc/dist/linux/godot.desktop2
-rw-r--r--misc/dist/uwp_template/Assets/SplashScreen.scale-100.pngbin14919 -> 10818 bytes
-rw-r--r--misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.pngbin5645 -> 3124 bytes
-rw-r--r--misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.pngbin16169 -> 8939 bytes
-rw-r--r--misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.pngbin1619 -> 848 bytes
-rw-r--r--misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.pngbin2483 -> 1168 bytes
-rw-r--r--misc/dist/uwp_template/Assets/StoreLogo.scale-100.pngbin1792 -> 883 bytes
-rw-r--r--misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.pngbin6772 -> 3471 bytes
-rwxr-xr-xmisc/hooks/pre-commit-clang-format2
-rw-r--r--misc/scripts/fix_headers.py8
-rw-r--r--misc/scripts/make_glwrapper.py9
-rw-r--r--misc/scripts/make_icons.sh29
-rwxr-xr-xmisc/travis/scons-local-osx.sh4
-rw-r--r--modules/bmp/SCsub9
-rw-r--r--modules/bmp/config.py5
-rw-r--r--modules/bmp/image_loader_bmp.cpp194
-rw-r--r--modules/bmp/image_loader_bmp.h84
-rw-r--r--modules/bmp/register_types.cpp44
-rw-r--r--modules/bmp/register_types.h32
-rw-r--r--modules/bullet/area_bullet.cpp24
-rw-r--r--modules/bullet/area_bullet.h4
-rw-r--r--modules/bullet/bullet_physics_server.cpp27
-rw-r--r--modules/bullet/collision_object_bullet.cpp10
-rw-r--r--modules/bullet/config.py2
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml2
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsServer.xml2
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp13
-rw-r--r--modules/bullet/godot_result_callbacks.cpp43
-rw-r--r--modules/bullet/godot_result_callbacks.h12
-rw-r--r--modules/bullet/rigid_body_bullet.cpp8
-rw-r--r--modules/bullet/rigid_body_bullet.h4
-rw-r--r--modules/bullet/shape_bullet.cpp58
-rw-r--r--modules/bullet/shape_bullet.h7
-rw-r--r--modules/bullet/space_bullet.cpp113
-rw-r--r--modules/csg/SCsub9
-rw-r--r--modules/csg/config.py21
-rw-r--r--modules/csg/csg.cpp1518
-rw-r--r--modules/csg/csg.h236
-rw-r--r--modules/csg/csg_gizmos.cpp345
-rw-r--r--modules/csg/csg_gizmos.h60
-rw-r--r--modules/csg/csg_shape.cpp2164
-rw-r--r--modules/csg/csg_shape.h390
-rw-r--r--modules/csg/doc_classes/CSGBox.xml25
-rw-r--r--modules/csg/doc_classes/CSGCombiner.xml15
-rw-r--r--modules/csg/doc_classes/CSGCylinder.xml29
-rw-r--r--modules/csg/doc_classes/CSGMesh.xml19
-rw-r--r--modules/csg/doc_classes/CSGPolygon.xml49
-rw-r--r--modules/csg/doc_classes/CSGPrimitive.xml19
-rw-r--r--modules/csg/doc_classes/CSGShape.xml35
-rw-r--r--modules/csg/doc_classes/CSGSphere.xml27
-rw-r--r--modules/csg/doc_classes/CSGTorus.xml29
-rw-r--r--modules/csg/register_types.cpp57
-rw-r--r--modules/csg/register_types.h32
-rw-r--r--modules/dds/config.py2
-rw-r--r--modules/enet/config.py2
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml76
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp321
-rw-r--r--modules/enet/networked_multiplayer_enet.h22
-rw-r--r--modules/etc/config.py10
-rw-r--r--modules/freetype/SCsub19
-rw-r--r--modules/freetype/config.py2
-rw-r--r--modules/gdnative/SCsub46
-rw-r--r--modules/gdnative/android/android_gdn.cpp73
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.cpp4
-rw-r--r--modules/gdnative/config.py3
-rw-r--r--modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml2
-rw-r--r--modules/gdnative/doc_classes/GDNative.xml2
-rw-r--r--modules/gdnative/doc_classes/GDNativeLibrary.xml10
-rw-r--r--modules/gdnative/doc_classes/NativeScript.xml2
-rw-r--r--modules/gdnative/doc_classes/PluginScript.xml2
-rw-r--r--modules/gdnative/gdnative.cpp235
-rw-r--r--modules/gdnative/gdnative.h6
-rw-r--r--modules/gdnative/gdnative_api.json55
-rw-r--r--modules/gdnative/include/android/godot_android.h54
-rw-r--r--modules/gdnative/include/arvr/godot_arvr.h8
-rw-r--r--modules/gdnative/include/nativescript/godot_nativescript.h12
-rw-r--r--modules/gdnative/include/net/godot_net.h118
-rw-r--r--modules/gdnative/nativescript/godot_nativescript.cpp22
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp128
-rw-r--r--modules/gdnative/nativescript/nativescript.h10
-rw-r--r--modules/gdnative/net/SCsub12
-rw-r--r--modules/gdnative/net/multiplayer_peer_gdnative.cpp124
-rw-r--r--modules/gdnative/net/multiplayer_peer_gdnative.h77
-rw-r--r--modules/gdnative/net/packet_peer_gdnative.cpp73
-rw-r--r--modules/gdnative/net/packet_peer_gdnative.h59
-rw-r--r--modules/gdnative/net/register_types.cpp43
-rw-r--r--modules/gdnative/net/register_types.h32
-rw-r--r--modules/gdnative/net/stream_peer_gdnative.cpp77
-rw-r--r--modules/gdnative/net/stream_peer_gdnative.h61
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.h4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp47
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.h8
-rw-r--r--modules/gdnative/pluginscript/register_types.cpp4
-rw-r--r--modules/gdnative/register_types.cpp3
-rw-r--r--modules/gdscript/SCsub3
-rw-r--r--modules/gdscript/config.py2
-rw-r--r--modules/gdscript/doc_classes/GDScript.xml4
-rw-r--r--modules/gdscript/doc_classes/GDScriptFunctionState.xml2
-rw-r--r--modules/gdscript/doc_classes/GDScriptNativeClass.xml2
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp337
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.h70
-rw-r--r--modules/gdscript/gdscript.cpp22
-rw-r--r--modules/gdscript/gdscript.h12
-rw-r--r--modules/gdscript/gdscript_compiler.cpp27
-rw-r--r--modules/gdscript/gdscript_compiler.h3
-rw-r--r--modules/gdscript/gdscript_editor.cpp109
-rw-r--r--modules/gdscript/gdscript_function.cpp41
-rw-r--r--modules/gdscript/gdscript_function.h23
-rw-r--r--modules/gdscript/gdscript_functions.cpp62
-rw-r--r--modules/gdscript/gdscript_functions.h2
-rw-r--r--modules/gdscript/gdscript_parser.cpp140
-rw-r--r--modules/gdscript/gdscript_parser.h8
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp9
-rw-r--r--modules/gdscript/gdscript_tokenizer.h3
-rw-r--r--modules/gdscript/register_types.cpp2
-rw-r--r--modules/gridmap/config.py2
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml4
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp43
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h1
-rw-r--r--modules/hdr/config.py2
-rw-r--r--modules/hdr/image_loader_hdr.cpp16
-rw-r--r--modules/jpg/config.py2
-rwxr-xr-xmodules/mbedtls/SCsub2
-rwxr-xr-xmodules/mbedtls/config.py2
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.cpp26
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.h2
-rw-r--r--modules/mobile_vr/config.py4
-rw-r--r--modules/mobile_vr/doc_classes/MobileVRInterface.xml2
-rw-r--r--modules/mono/SCsub75
-rw-r--r--modules/mono/config.py105
-rw-r--r--modules/mono/csharp_script.cpp131
-rw-r--r--modules/mono/csharp_script.h13
-rw-r--r--modules/mono/doc_classes/@C#.xml2
-rw-r--r--modules/mono/doc_classes/CSharpScript.xml2
-rw-r--r--modules/mono/doc_classes/GodotSharp.xml2
-rw-r--r--modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs119
-rw-r--r--modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj4
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs6
-rw-r--r--modules/mono/editor/bindings_generator.cpp254
-rw-r--r--modules/mono/editor/bindings_generator.h46
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp204
-rw-r--r--modules/mono/editor/godotsharp_builds.h21
-rw-r--r--modules/mono/editor/godotsharp_editor.cpp10
-rw-r--r--modules/mono/editor/godotsharp_editor.h1
-rw-r--r--modules/mono/editor/godotsharp_export.cpp166
-rw-r--r--modules/mono/editor/godotsharp_export.h57
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp94
-rw-r--r--modules/mono/editor/mono_bottom_panel.h6
-rw-r--r--modules/mono/editor/mono_build_info.cpp62
-rw-r--r--modules/mono/editor/mono_build_info.h24
-rw-r--r--modules/mono/glue/builtin_types_glue.h30
-rw-r--r--modules/mono/glue/cs_files/AABB.cs147
-rw-r--r--modules/mono/glue/cs_files/Basis.cs294
-rw-r--r--modules/mono/glue/cs_files/Color.cs123
-rw-r--r--modules/mono/glue/cs_files/DebuggingUtils.cs4
-rw-r--r--modules/mono/glue/cs_files/GD.cs14
-rw-r--r--modules/mono/glue/cs_files/GodotMethodAttribute.cs2
-rw-r--r--modules/mono/glue/cs_files/GodotSynchronizationContext.cs1
-rw-r--r--modules/mono/glue/cs_files/GodotTaskScheduler.cs4
-rw-r--r--modules/mono/glue/cs_files/IAwaiter.cs1
-rw-r--r--modules/mono/glue/cs_files/MarshalUtils.cs6
-rw-r--r--modules/mono/glue/cs_files/Mathf.cs215
-rw-r--r--modules/mono/glue/cs_files/MathfEx.cs39
-rw-r--r--modules/mono/glue/cs_files/Plane.cs107
-rw-r--r--modules/mono/glue/cs_files/Quat.cs111
-rw-r--r--modules/mono/glue/cs_files/RPCAttributes.cs9
-rw-r--r--modules/mono/glue/cs_files/Rect2.cs79
-rw-r--r--modules/mono/glue/cs_files/SignalAttribute.cs3
-rw-r--r--modules/mono/glue/cs_files/SignalAwaiter.cs12
-rw-r--r--modules/mono/glue/cs_files/StringExtensions.cs110
-rw-r--r--modules/mono/glue/cs_files/Transform.cs34
-rw-r--r--modules/mono/glue/cs_files/Transform2D.cs93
-rwxr-xr-xmodules/mono/glue/cs_files/VERSION.txt1
-rw-r--r--modules/mono/glue/cs_files/Vector2.cs167
-rw-r--r--modules/mono/glue/cs_files/Vector3.cs165
-rw-r--r--modules/mono/godotsharp_defs.h3
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp339
-rw-r--r--modules/mono/mono_gd/gd_mono.h63
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp119
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.h17
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp44
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp73
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h3
-rw-r--r--modules/mono/mono_reg_utils.py6
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp2
-rw-r--r--modules/ogg/config.py2
-rw-r--r--modules/opus/config.py2
-rw-r--r--modules/pvr/config.py2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp4
-rw-r--r--modules/recast/SCsub12
-rw-r--r--modules/recast/config.py4
-rw-r--r--modules/recast/navigation_mesh_editor_plugin.cpp (renamed from editor/plugins/navigation_mesh_editor_plugin.cpp)5
-rw-r--r--modules/recast/navigation_mesh_editor_plugin.h (renamed from editor/plugins/navigation_mesh_editor_plugin.h)3
-rw-r--r--modules/recast/navigation_mesh_generator.cpp (renamed from editor/plugins/navigation_mesh_generator.cpp)38
-rw-r--r--modules/recast/navigation_mesh_generator.h (renamed from editor/plugins/navigation_mesh_generator.h)9
-rw-r--r--modules/recast/register_types.cpp7
-rw-r--r--modules/regex/SCsub3
-rw-r--r--modules/regex/config.py2
-rw-r--r--modules/regex/doc_classes/RegEx.xml2
-rw-r--r--modules/regex/doc_classes/RegExMatch.xml2
-rw-r--r--modules/squish/config.py10
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp6
-rw-r--r--modules/stb_vorbis/config.py2
-rw-r--r--modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml5
-rw-r--r--modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml2
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.cpp1
-rw-r--r--modules/svg/SCsub19
-rw-r--r--modules/svg/config.py2
-rw-r--r--modules/tga/config.py2
-rw-r--r--modules/thekla_unwrap/config.py8
-rw-r--r--modules/theora/config.py2
-rw-r--r--modules/theora/doc_classes/ResourceImporterTheora.xml2
-rw-r--r--modules/theora/doc_classes/VideoStreamTheora.xml2
-rw-r--r--modules/theora/video_stream_theora.cpp20
-rw-r--r--modules/tinyexr/config.py10
-rw-r--r--modules/upnp/SCsub32
-rw-r--r--modules/upnp/config.py14
-rw-r--r--modules/upnp/doc_classes/UPNP.xml227
-rw-r--r--modules/upnp/doc_classes/UPNPDevice.xml109
-rw-r--r--modules/upnp/register_types.cpp (renamed from platform/javascript/power_javascript.cpp)46
-rw-r--r--modules/upnp/register_types.h32
-rw-r--r--modules/upnp/upnp.cpp401
-rw-r--r--modules/upnp/upnp.h124
-rw-r--r--modules/upnp/upnpdevice.cpp197
-rw-r--r--modules/upnp/upnpdevice.h95
-rw-r--r--modules/visual_script/config.py2
-rw-r--r--modules/visual_script/doc_classes/VisualScript.xml4
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml4
-rw-r--r--modules/visual_script/doc_classes/VisualScriptClassConstant.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptComment.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCondition.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstant.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstructor.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptCustomNode.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptDeconstruct.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEditor.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEmitSignal.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptExpression.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunction.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionCall.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionState.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexGet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIndexSet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptInputAction.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptIterator.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVar.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptMathConstant.xml6
-rw-r--r--modules/visual_script/doc_classes/VisualScriptNode.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptOperator.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPreload.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertyGet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertySet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptResourcePath.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptReturn.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneNode.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSceneTree.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelect.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSelf.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSequence.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSubCall.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptSwitch.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptTypeCast.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableGet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptVariableSet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptWhile.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYield.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYieldSignal.xml2
-rw-r--r--modules/visual_script/register_types.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp15
-rw-r--r--modules/visual_script/visual_script.h8
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h2
-rw-r--r--modules/visual_script/visual_script_editor.cpp41
-rw-r--r--modules/visual_script/visual_script_editor.h5
-rw-r--r--modules/visual_script/visual_script_expression.cpp13
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp102
-rw-r--r--modules/visual_script/visual_script_func_nodes.h2
-rw-r--r--modules/visual_script/visual_script_nodes.cpp221
-rw-r--r--modules/visual_script/visual_script_nodes.h25
-rw-r--r--modules/vorbis/config.py2
-rw-r--r--modules/webm/SCsub4
-rw-r--r--modules/webm/config.py4
-rw-r--r--modules/webm/doc_classes/ResourceImporterWebm.xml2
-rw-r--r--modules/webm/doc_classes/VideoStreamWebm.xml2
-rw-r--r--modules/webm/libvpx/SCsub7
-rw-r--r--modules/webp/SCsub2
-rw-r--r--modules/webp/config.py2
-rw-r--r--modules/websocket/SCsub85
-rw-r--r--modules/websocket/config.py15
-rw-r--r--modules/websocket/doc_classes/WebSocketClient.xml70
-rw-r--r--modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml (renamed from doc/classes/WebSocketMultiplayerPeer.xml)6
-rw-r--r--modules/websocket/doc_classes/WebSocketPeer.xml75
-rw-r--r--modules/websocket/doc_classes/WebSocketServer.xml109
-rw-r--r--modules/websocket/emws_client.cpp4
-rw-r--r--modules/websocket/emws_client.h4
-rw-r--r--modules/websocket/emws_peer.cpp10
-rw-r--r--modules/websocket/emws_peer.h4
-rw-r--r--modules/websocket/emws_server.cpp17
-rw-r--r--modules/websocket/emws_server.h7
-rw-r--r--modules/websocket/lws_client.cpp27
-rw-r--r--modules/websocket/lws_client.h4
-rw-r--r--modules/websocket/lws_helper.h14
-rw-r--r--modules/websocket/lws_peer.cpp48
-rw-r--r--modules/websocket/lws_peer.h4
-rw-r--r--modules/websocket/lws_server.cpp22
-rw-r--r--modules/websocket/lws_server.h7
-rw-r--r--modules/websocket/register_types.cpp4
-rw-r--r--modules/websocket/register_types.h4
-rw-r--r--modules/websocket/websocket_client.cpp20
-rw-r--r--modules/websocket/websocket_client.h8
-rw-r--r--modules/websocket/websocket_macros.h4
-rw-r--r--modules/websocket/websocket_multiplayer.cpp4
-rw-r--r--modules/websocket/websocket_multiplayer.h4
-rw-r--r--modules/websocket/websocket_peer.cpp6
-rw-r--r--modules/websocket/websocket_peer.h4
-rw-r--r--modules/websocket/websocket_server.cpp7
-rw-r--r--modules/websocket/websocket_server.h8
-rw-r--r--platform/SCsub9
-rw-r--r--platform/android/AndroidManifest.xml.template7
-rw-r--r--platform/android/SCsub20
-rw-r--r--platform/android/audio_driver_opensl.cpp1
-rw-r--r--platform/android/build.gradle.template1
-rw-r--r--platform/android/export/export.cpp32
-rw-r--r--platform/android/java/res/drawable-hdpi/notify_panel_notification_icon_bg.pngbin715 -> 462 bytes
-rw-r--r--platform/android/java/res/drawable-mdpi/notify_panel_notification_icon_bg.pngbin361 -> 127 bytes
-rw-r--r--platform/android/java/res/drawable/icon.pngbin11155 -> 7569 bytes
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java10
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java8
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java15
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java12
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotView.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java14
-rw-r--r--platform/android/java_glue.cpp43
-rw-r--r--platform/android/logo.pngbin1742 -> 1461 bytes
-rw-r--r--platform/android/os_android.cpp70
-rw-r--r--platform/android/os_android.h5
-rw-r--r--platform/android/run_icon.pngbin636 -> 324 bytes
-rw-r--r--platform/haiku/detect.py2
-rw-r--r--platform/haiku/logo.pngbin1551 -> 1265 bytes
-rw-r--r--platform/iphone/SCsub7
-rw-r--r--platform/iphone/app_delegate.h1
-rw-r--r--platform/iphone/app_delegate.mm201
-rw-r--r--platform/iphone/export/export.cpp67
-rw-r--r--platform/iphone/gl_view.h2
-rw-r--r--platform/iphone/gl_view.mm24
-rw-r--r--platform/iphone/icloud.mm2
-rw-r--r--platform/iphone/in_app_store.h1
-rw-r--r--platform/iphone/in_app_store.mm15
-rw-r--r--platform/iphone/logo.pngbin1905 -> 1489 bytes
-rw-r--r--platform/iphone/os_iphone.cpp54
-rw-r--r--platform/iphone/os_iphone.h7
-rw-r--r--platform/iphone/platform_config.h1
-rw-r--r--platform/iphone/power_iphone.cpp2
-rw-r--r--platform/javascript/SCsub49
-rw-r--r--platform/javascript/audio_driver_javascript.cpp149
-rw-r--r--platform/javascript/audio_driver_javascript.h11
-rw-r--r--platform/javascript/detect.py126
-rw-r--r--platform/javascript/engine.js87
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/javascript/http_client_javascript.cpp2
-rw-r--r--platform/javascript/javascript_main.cpp4
-rw-r--r--platform/javascript/logo.pngbin2316 -> 1236 bytes
-rw-r--r--platform/javascript/os_javascript.cpp99
-rw-r--r--platform/javascript/os_javascript.h3
-rw-r--r--platform/javascript/pre.js2
-rw-r--r--platform/javascript/run_icon.pngbin471 -> 290 bytes
-rw-r--r--platform/osx/detect.py7
-rw-r--r--platform/osx/export/export.cpp34
-rw-r--r--platform/osx/godot_main_osx.mm2
-rw-r--r--platform/osx/logo.pngbin2065 -> 1752 bytes
-rw-r--r--platform/osx/os_osx.h14
-rw-r--r--platform/osx/os_osx.mm356
-rw-r--r--platform/osx/platform_config.h1
-rw-r--r--platform/server/detect.py31
-rw-r--r--platform/server/logo.pngbin2331 -> 2016 bytes
-rw-r--r--platform/server/os_server.cpp6
-rw-r--r--platform/server/os_server.h3
-rw-r--r--platform/server/platform_config.h6
-rw-r--r--platform/uwp/app.cpp83
-rw-r--r--platform/uwp/app.h1
-rw-r--r--platform/uwp/detect.py7
-rw-r--r--platform/uwp/export/export.cpp12
-rw-r--r--platform/windows/context_gl_win.cpp3
-rw-r--r--platform/windows/detect.py407
-rw-r--r--platform/windows/godot_res.rc10
-rw-r--r--platform/windows/logo.pngbin1882 -> 1536 bytes
-rw-r--r--platform/windows/os_windows.cpp356
-rw-r--r--platform/windows/os_windows.h26
-rw-r--r--platform/windows/platform_config.h1
-rw-r--r--platform/x11/context_gl_x11.cpp130
-rw-r--r--platform/x11/context_gl_x11.h13
-rw-r--r--platform/x11/crash_handler_x11.cpp3
-rw-r--r--platform/x11/detect.py44
-rw-r--r--platform/x11/logo.pngbin2061 -> 1679 bytes
-rw-r--r--platform/x11/os_x11.cpp200
-rw-r--r--platform/x11/os_x11.h18
-rw-r--r--platform/x11/platform_config.h1
-rw-r--r--scene/2d/animated_sprite.cpp71
-rw-r--r--scene/2d/animated_sprite.h9
-rw-r--r--scene/2d/area_2d.cpp6
-rw-r--r--scene/2d/audio_stream_player_2d.cpp54
-rw-r--r--scene/2d/audio_stream_player_2d.h5
-rw-r--r--scene/2d/back_buffer_copy.cpp9
-rw-r--r--scene/2d/back_buffer_copy.h2
-rw-r--r--scene/2d/camera_2d.cpp8
-rw-r--r--scene/2d/canvas_item.cpp48
-rw-r--r--scene/2d/canvas_item.h45
-rw-r--r--scene/2d/collision_polygon_2d.cpp7
-rw-r--r--scene/2d/collision_polygon_2d.h1
-rw-r--r--scene/2d/collision_shape_2d.cpp5
-rw-r--r--scene/2d/collision_shape_2d.h1
-rw-r--r--scene/2d/joints_2d.cpp4
-rw-r--r--scene/2d/light_2d.cpp14
-rw-r--r--scene/2d/light_2d.h3
-rw-r--r--scene/2d/light_occluder_2d.cpp6
-rw-r--r--scene/2d/light_occluder_2d.h2
-rw-r--r--scene/2d/line_2d.cpp16
-rw-r--r--scene/2d/line_2d.h1
-rw-r--r--scene/2d/line_builder.cpp12
-rw-r--r--scene/2d/line_builder.h1
-rw-r--r--scene/2d/mesh_instance_2d.cpp30
-rw-r--r--scene/2d/mesh_instance_2d.h30
-rw-r--r--scene/2d/navigation2d.cpp2
-rw-r--r--scene/2d/node_2d.cpp54
-rw-r--r--scene/2d/node_2d.h8
-rw-r--r--scene/2d/parallax_layer.cpp3
-rw-r--r--scene/2d/particles_2d.cpp4
-rw-r--r--scene/2d/path_2d.cpp9
-rw-r--r--scene/2d/path_2d.h1
-rw-r--r--scene/2d/polygon_2d.cpp261
-rw-r--r--scene/2d/polygon_2d.h30
-rw-r--r--scene/2d/position_2d.cpp4
-rw-r--r--scene/2d/position_2d.h1
-rw-r--r--scene/2d/ray_cast_2d.cpp10
-rw-r--r--scene/2d/remote_transform_2d.cpp2
-rw-r--r--scene/2d/screen_button.cpp16
-rw-r--r--scene/2d/screen_button.h4
-rw-r--r--scene/2d/skeleton_2d.cpp114
-rw-r--r--scene/2d/skeleton_2d.h42
-rw-r--r--scene/2d/sprite.cpp129
-rw-r--r--scene/2d/sprite.h8
-rw-r--r--scene/2d/tile_map.cpp165
-rw-r--r--scene/2d/tile_map.h8
-rw-r--r--scene/2d/visibility_notifier_2d.cpp4
-rw-r--r--scene/2d/visibility_notifier_2d.h1
-rw-r--r--scene/3d/area.cpp2
-rw-r--r--scene/3d/arvr_nodes.cpp20
-rw-r--r--scene/3d/audio_stream_player_3d.cpp52
-rw-r--r--scene/3d/audio_stream_player_3d.h5
-rw-r--r--scene/3d/camera.cpp13
-rw-r--r--scene/3d/camera.h6
-rw-r--r--scene/3d/collision_polygon.cpp5
-rw-r--r--scene/3d/collision_polygon.h2
-rw-r--r--scene/3d/interpolated_camera.cpp8
-rw-r--r--scene/3d/light.cpp12
-rw-r--r--scene/3d/mesh_instance.cpp2
-rw-r--r--scene/3d/navigation.cpp1
-rw-r--r--scene/3d/particles.cpp61
-rw-r--r--scene/3d/path.cpp223
-rw-r--r--scene/3d/path.h43
-rw-r--r--scene/3d/physics_body.cpp1119
-rw-r--r--scene/3d/physics_body.h266
-rw-r--r--scene/3d/physics_joint.cpp29
-rw-r--r--scene/3d/physics_joint.h3
-rw-r--r--scene/3d/ray_cast.cpp10
-rw-r--r--scene/3d/reflection_probe.cpp6
-rw-r--r--scene/3d/remote_transform.cpp2
-rw-r--r--scene/3d/scenario_fx.cpp11
-rw-r--r--scene/3d/skeleton.cpp185
-rw-r--r--scene/3d/skeleton.h46
-rw-r--r--scene/3d/spatial.cpp31
-rw-r--r--scene/3d/spatial.h7
-rw-r--r--scene/3d/sprite_3d.cpp86
-rw-r--r--scene/3d/sprite_3d.h4
-rw-r--r--scene/3d/vehicle_body.cpp22
-rw-r--r--scene/3d/vehicle_body.h2
-rw-r--r--scene/3d/voxel_light_baker.cpp9
-rw-r--r--scene/animation/animation_blend_space_1d.cpp294
-rw-r--r--scene/animation/animation_blend_space_1d.h71
-rw-r--r--scene/animation/animation_blend_space_2d.cpp567
-rw-r--r--scene/animation/animation_blend_space_2d.h97
-rw-r--r--scene/animation/animation_blend_tree.cpp1170
-rw-r--r--scene/animation/animation_blend_tree.h352
-rw-r--r--scene/animation/animation_node_state_machine.cpp790
-rw-r--r--scene/animation/animation_node_state_machine.h142
-rw-r--r--scene/animation/animation_player.cpp361
-rw-r--r--scene/animation/animation_player.h39
-rw-r--r--scene/animation/animation_tree.cpp1338
-rw-r--r--scene/animation/animation_tree.h281
-rw-r--r--scene/animation/animation_tree_player.cpp18
-rw-r--r--scene/animation/animation_tree_player.h1
-rw-r--r--scene/animation/root_motion_view.cpp178
-rw-r--r--scene/animation/root_motion_view.h47
-rw-r--r--scene/animation/tween.cpp12
-rw-r--r--scene/animation/tween.h1
-rw-r--r--scene/audio/audio_player.cpp50
-rw-r--r--scene/audio/audio_player.h5
-rw-r--r--scene/gui/base_button.cpp23
-rw-r--r--scene/gui/base_button.h4
-rw-r--r--scene/gui/color_picker.cpp137
-rw-r--r--scene/gui/color_picker.h15
-rw-r--r--scene/gui/container.cpp11
-rw-r--r--scene/gui/control.cpp283
-rw-r--r--scene/gui/control.h38
-rw-r--r--scene/gui/file_dialog.cpp1
-rw-r--r--scene/gui/gradient_edit.cpp8
-rw-r--r--scene/gui/graph_edit.cpp33
-rw-r--r--scene/gui/graph_edit.h8
-rw-r--r--scene/gui/grid_container.cpp68
-rw-r--r--scene/gui/grid_container.h1
-rw-r--r--scene/gui/item_list.cpp68
-rw-r--r--scene/gui/item_list.h6
-rw-r--r--scene/gui/label.cpp25
-rw-r--r--scene/gui/line_edit.cpp112
-rw-r--r--scene/gui/line_edit.h9
-rw-r--r--scene/gui/menu_button.cpp2
-rw-r--r--scene/gui/option_button.cpp13
-rw-r--r--scene/gui/option_button.h1
-rw-r--r--scene/gui/popup.cpp34
-rw-r--r--scene/gui/popup_menu.cpp312
-rw-r--r--scene/gui/popup_menu.h22
-rw-r--r--scene/gui/progress_bar.cpp13
-rw-r--r--scene/gui/range.cpp45
-rw-r--r--scene/gui/range.h8
-rw-r--r--scene/gui/rich_text_label.cpp196
-rw-r--r--scene/gui/rich_text_label.h10
-rw-r--r--scene/gui/scroll_bar.cpp72
-rw-r--r--scene/gui/scroll_container.cpp113
-rw-r--r--scene/gui/scroll_container.h9
-rw-r--r--scene/gui/slider.cpp26
-rw-r--r--scene/gui/split_container.cpp7
-rw-r--r--scene/gui/tab_container.cpp201
-rw-r--r--scene/gui/tab_container.h12
-rw-r--r--scene/gui/tabs.cpp120
-rw-r--r--scene/gui/tabs.h7
-rw-r--r--scene/gui/text_edit.cpp2102
-rw-r--r--scene/gui/text_edit.h227
-rw-r--r--scene/gui/texture_progress.cpp127
-rw-r--r--scene/gui/texture_progress.h12
-rw-r--r--scene/gui/tree.cpp536
-rw-r--r--scene/gui/tree.h4
-rw-r--r--scene/gui/video_player.cpp15
-rw-r--r--scene/main/canvas_layer.cpp40
-rw-r--r--scene/main/canvas_layer.h7
-rw-r--r--scene/main/http_request.cpp2
-rw-r--r--scene/main/instance_placeholder.cpp24
-rw-r--r--scene/main/instance_placeholder.h1
-rw-r--r--scene/main/node.cpp413
-rw-r--r--scene/main/node.h40
-rw-r--r--scene/main/scene_tree.cpp523
-rw-r--r--scene/main/scene_tree.h49
-rwxr-xr-xscene/main/timer.cpp7
-rwxr-xr-xscene/main/timer.h2
-rw-r--r--scene/main/viewport.cpp203
-rw-r--r--scene/main/viewport.h15
-rw-r--r--scene/register_scene_types.cpp33
-rw-r--r--scene/resources/animation.cpp1050
-rw-r--r--scene/resources/animation.h83
-rw-r--r--scene/resources/audio_stream_sample.cpp8
-rw-r--r--scene/resources/curve.cpp291
-rw-r--r--scene/resources/curve.h10
-rw-r--r--scene/resources/default_theme/arrow_down.pngbin184 -> 109 bytes
-rw-r--r--scene/resources/default_theme/arrow_right.pngbin183 -> 103 bytes
-rw-r--r--scene/resources/default_theme/background.pngbin1235 -> 854 bytes
-rw-r--r--scene/resources/default_theme/base_green.pngbin335 -> 86 bytes
-rw-r--r--scene/resources/default_theme/button_disabled.pngbin486 -> 256 bytes
-rw-r--r--scene/resources/default_theme/button_focus.pngbin418 -> 203 bytes
-rw-r--r--scene/resources/default_theme/button_hover.pngbin606 -> 344 bytes
-rw-r--r--scene/resources/default_theme/button_normal.pngbin598 -> 338 bytes
-rw-r--r--scene/resources/default_theme/checked.pngbin627 -> 363 bytes
-rw-r--r--scene/resources/default_theme/checker_bg.pngbin295 -> 77 bytes
-rw-r--r--scene/resources/default_theme/close.pngbin230 -> 155 bytes
-rw-r--r--scene/resources/default_theme/close_hl.pngbin230 -> 155 bytes
-rw-r--r--scene/resources/default_theme/color_picker_sample.pngbin194 -> 117 bytes
-rw-r--r--scene/resources/default_theme/default_theme.cpp17
-rw-r--r--scene/resources/default_theme/dosfont.pngbin963 -> 683 bytes
-rw-r--r--scene/resources/default_theme/dropdown.pngbin369 -> 133 bytes
-rw-r--r--scene/resources/default_theme/error_icon.pngbin362 -> 111 bytes
-rw-r--r--scene/resources/default_theme/focus.pngbin411 -> 200 bytes
-rw-r--r--scene/resources/default_theme/frame_focus.pngbin448 -> 200 bytes
-rw-r--r--scene/resources/default_theme/full_panel_bg.pngbin430 -> 207 bytes
-rw-r--r--scene/resources/default_theme/graph_node_breakpoint.pngbin277 -> 140 bytes
-rw-r--r--scene/resources/default_theme/graph_node_close.pngbin222 -> 152 bytes
-rw-r--r--scene/resources/default_theme/graph_node_comment.pngbin506 -> 382 bytes
-rw-r--r--scene/resources/default_theme/graph_node_comment_focus.pngbin482 -> 373 bytes
-rw-r--r--scene/resources/default_theme/graph_node_default.pngbin420 -> 205 bytes
-rw-r--r--scene/resources/default_theme/graph_node_default_focus.pngbin452 -> 195 bytes
-rw-r--r--scene/resources/default_theme/graph_node_position.pngbin278 -> 140 bytes
-rw-r--r--scene/resources/default_theme/graph_node_selected.pngbin933 -> 836 bytes
-rw-r--r--scene/resources/default_theme/graph_port.pngbin273 -> 171 bytes
-rw-r--r--scene/resources/default_theme/hseparator.pngbin323 -> 112 bytes
-rw-r--r--scene/resources/default_theme/hslider_bg.pngbin526 -> 263 bytes
-rw-r--r--scene/resources/default_theme/hslider_grabber.pngbin591 -> 300 bytes
-rw-r--r--scene/resources/default_theme/hslider_grabber_disabled.pngbin386 -> 288 bytes
-rw-r--r--scene/resources/default_theme/hslider_grabber_hl.pngbin734 -> 450 bytes
-rw-r--r--scene/resources/default_theme/hslider_tick.pngbin364 -> 149 bytes
-rw-r--r--scene/resources/default_theme/hsplit_bg.pngbin334 -> 85 bytes
-rw-r--r--scene/resources/default_theme/hsplitter.pngbin359 -> 97 bytes
-rw-r--r--scene/resources/default_theme/icon_add.pngbin129 -> 86 bytes
-rw-r--r--scene/resources/default_theme/icon_close.pngbin230 -> 155 bytes
-rw-r--r--scene/resources/default_theme/icon_color_pick.pngbin416 -> 227 bytes
-rw-r--r--scene/resources/default_theme/icon_folder.pngbin170 -> 103 bytes
-rw-r--r--scene/resources/default_theme/icon_parent_folder.pngbin329 -> 161 bytes
-rw-r--r--scene/resources/default_theme/icon_play.pngbin237 -> 122 bytes
-rw-r--r--scene/resources/default_theme/icon_reload.pngbin420 -> 234 bytes
-rw-r--r--scene/resources/default_theme/icon_snap_grid.pngbin325 -> 226 bytes
-rw-r--r--scene/resources/default_theme/icon_stop.pngbin312 -> 87 bytes
-rw-r--r--scene/resources/default_theme/icon_zoom_less.pngbin112 -> 76 bytes
-rw-r--r--scene/resources/default_theme/icon_zoom_more.pngbin129 -> 85 bytes
-rw-r--r--scene/resources/default_theme/icon_zoom_reset.pngbin186 -> 108 bytes
-rw-r--r--scene/resources/default_theme/line_edit.pngbin424 -> 176 bytes
-rw-r--r--scene/resources/default_theme/line_edit_disabled.pngbin406 -> 135 bytes
-rw-r--r--scene/resources/default_theme/line_edit_focus.pngbin660 -> 365 bytes
-rw-r--r--scene/resources/default_theme/logo.pngbin8809 -> 6676 bytes
-rw-r--r--scene/resources/default_theme/mini_checkerboard.pngbin166 -> 80 bytes
-rw-r--r--scene/resources/default_theme/option_arrow.pngbin227 -> 119 bytes
-rw-r--r--scene/resources/default_theme/option_button_disabled.pngbin901 -> 656 bytes
-rw-r--r--scene/resources/default_theme/option_button_focus.pngbin679 -> 416 bytes
-rw-r--r--scene/resources/default_theme/option_button_hover.pngbin924 -> 667 bytes
-rw-r--r--scene/resources/default_theme/option_button_normal.pngbin922 -> 669 bytes
-rw-r--r--scene/resources/default_theme/option_button_pressed.pngbin931 -> 677 bytes
-rw-r--r--scene/resources/default_theme/panel_bg.pngbin334 -> 85 bytes
-rw-r--r--scene/resources/default_theme/popup_bg.pngbin672 -> 410 bytes
-rw-r--r--scene/resources/default_theme/popup_bg_disabled.pngbin582 -> 362 bytes
-rw-r--r--scene/resources/default_theme/popup_checked.pngbin238 -> 143 bytes
-rw-r--r--scene/resources/default_theme/popup_hover.pngbin404 -> 145 bytes
-rw-r--r--scene/resources/default_theme/popup_unchecked.pngbin310 -> 98 bytes
-rw-r--r--scene/resources/default_theme/popup_window.pngbin1234 -> 903 bytes
-rw-r--r--scene/resources/default_theme/progress_bar.pngbin460 -> 194 bytes
-rw-r--r--scene/resources/default_theme/progress_fill.pngbin402 -> 112 bytes
-rw-r--r--scene/resources/default_theme/radio_checked.pngbin477 -> 257 bytes
-rw-r--r--scene/resources/default_theme/radio_unchecked.pngbin422 -> 207 bytes
-rw-r--r--scene/resources/default_theme/reference_border.pngbin348 -> 132 bytes
-rw-r--r--scene/resources/default_theme/scroll_bg.pngbin510 -> 252 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_down.pngbin418 -> 170 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_down_hl.pngbin418 -> 170 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_left.pngbin444 -> 196 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_left_hl.pngbin461 -> 200 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_right.pngbin446 -> 198 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_right_hl.pngbin464 -> 210 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_up.pngbin421 -> 173 bytes
-rw-r--r--scene/resources/default_theme/scroll_button_up_hl.pngbin421 -> 173 bytes
-rw-r--r--scene/resources/default_theme/scroll_grabber.pngbin523 -> 264 bytes
-rw-r--r--scene/resources/default_theme/scroll_grabber_hl.pngbin536 -> 278 bytes
-rw-r--r--scene/resources/default_theme/scroll_grabber_pressed.pngbin233 -> 104 bytes
-rw-r--r--scene/resources/default_theme/selection.pngbin406 -> 195 bytes
-rw-r--r--scene/resources/default_theme/selection_oof.pngbin411 -> 196 bytes
-rw-r--r--scene/resources/default_theme/spinbox_updown.pngbin280 -> 146 bytes
-rw-r--r--scene/resources/default_theme/submenu.pngbin175 -> 103 bytes
-rw-r--r--scene/resources/default_theme/tab.pngbin300 -> 82 bytes
-rw-r--r--scene/resources/default_theme/tab_behind.pngbin553 -> 282 bytes
-rw-r--r--scene/resources/default_theme/tab_close.pngbin325 -> 158 bytes
-rw-r--r--scene/resources/default_theme/tab_container_bg.pngbin598 -> 338 bytes
-rw-r--r--scene/resources/default_theme/tab_current.pngbin627 -> 347 bytes
-rw-r--r--scene/resources/default_theme/tab_menu.pngbin186 -> 111 bytes
-rw-r--r--scene/resources/default_theme/tab_menu_hl.pngbin186 -> 111 bytes
-rw-r--r--scene/resources/default_theme/toggle_off.pngbin1355 -> 1077 bytes
-rw-r--r--scene/resources/default_theme/toggle_on.pngbin1318 -> 1034 bytes
-rw-r--r--scene/resources/default_theme/tool_button_pressed.pngbin1230 -> 864 bytes
-rw-r--r--scene/resources/default_theme/tooltip_bg.pngbin424 -> 198 bytes
-rw-r--r--scene/resources/default_theme/tree_bg.pngbin424 -> 176 bytes
-rw-r--r--scene/resources/default_theme/tree_bg_disabled.pngbin406 -> 135 bytes
-rw-r--r--scene/resources/default_theme/tree_bg_focus.pngbin1039 -> 696 bytes
-rw-r--r--scene/resources/default_theme/tree_cursor.pngbin743 -> 434 bytes
-rw-r--r--scene/resources/default_theme/tree_cursor_unfocus.pngbin655 -> 369 bytes
-rw-r--r--scene/resources/default_theme/tree_title.pngbin335 -> 86 bytes
-rw-r--r--scene/resources/default_theme/tree_title_pressed.pngbin335 -> 86 bytes
-rw-r--r--scene/resources/default_theme/unchecked.pngbin477 -> 222 bytes
-rw-r--r--scene/resources/default_theme/updown.pngbin241 -> 144 bytes
-rw-r--r--scene/resources/default_theme/vseparator.pngbin323 -> 108 bytes
-rw-r--r--scene/resources/default_theme/vslider_bg.pngbin532 -> 276 bytes
-rw-r--r--scene/resources/default_theme/vslider_grabber.pngbin394 -> 245 bytes
-rw-r--r--scene/resources/default_theme/vslider_grabber_disabled.pngbin335 -> 237 bytes
-rw-r--r--scene/resources/default_theme/vslider_grabber_hl.pngbin439 -> 261 bytes
-rw-r--r--scene/resources/default_theme/vslider_tick.pngbin360 -> 145 bytes
-rw-r--r--scene/resources/default_theme/vsplit_bg.pngbin334 -> 85 bytes
-rw-r--r--scene/resources/default_theme/vsplitter.pngbin351 -> 95 bytes
-rw-r--r--scene/resources/default_theme/window_resizer.pngbin181 -> 87 bytes
-rw-r--r--scene/resources/dynamic_font.cpp547
-rw-r--r--scene/resources/dynamic_font.h49
-rw-r--r--scene/resources/dynamic_font_stb.cpp22
-rw-r--r--scene/resources/dynamic_font_stb.h4
-rw-r--r--scene/resources/environment.cpp37
-rw-r--r--scene/resources/environment.h4
-rw-r--r--scene/resources/font.cpp43
-rw-r--r--scene/resources/font.h49
-rw-r--r--scene/resources/material.cpp8
-rw-r--r--scene/resources/material.h3
-rw-r--r--scene/resources/mesh.cpp11
-rw-r--r--scene/resources/mesh.h2
-rw-r--r--scene/resources/packed_scene.cpp2
-rw-r--r--scene/resources/primitive_meshes.cpp126
-rw-r--r--scene/resources/primitive_meshes.h8
-rw-r--r--scene/resources/scene_format_text.cpp25
-rw-r--r--scene/resources/shape_2d.h2
-rw-r--r--scene/resources/style_box.cpp25
-rw-r--r--scene/resources/style_box.h8
-rw-r--r--scene/resources/surface_tool.cpp10
-rw-r--r--scene/resources/surface_tool.h2
-rw-r--r--scene/resources/texture.cpp11
-rw-r--r--scene/resources/texture.h2
-rw-r--r--scene/resources/theme.h12
-rw-r--r--scene/resources/tile_set.cpp30
-rw-r--r--scene/resources/tile_set.h9
-rw-r--r--scene/scene_string_names.cpp3
-rw-r--r--scene/scene_string_names.h3
-rw-r--r--servers/arvr_server.cpp52
-rw-r--r--servers/arvr_server.h17
-rw-r--r--servers/audio/audio_stream.cpp1
-rw-r--r--servers/audio/audio_stream.h1
-rw-r--r--servers/audio/effects/audio_effect_compressor.cpp2
-rw-r--r--servers/audio_server.cpp103
-rw-r--r--servers/audio_server.h11
-rw-r--r--servers/physics/body_pair_sw.cpp1
-rw-r--r--servers/physics/collision_object_sw.h3
-rw-r--r--servers/physics/collision_solver_sat.cpp18
-rw-r--r--servers/physics/shape_sw.h2
-rw-r--r--servers/physics_2d/body_pair_2d_sw.cpp1
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp28
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h5
-rw-r--r--servers/physics_2d/joints_2d_sw.cpp9
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp6
-rw-r--r--servers/physics_2d_server.cpp2
-rw-r--r--servers/physics_server.cpp7
-rw-r--r--servers/physics_server.h3
-rw-r--r--servers/register_server_types.cpp5
-rw-r--r--servers/server_wrap_mt_common.h9
-rw-r--r--servers/visual/rasterizer.h9
-rw-r--r--servers/visual/shader_language.cpp150
-rw-r--r--servers/visual/shader_language.h2
-rw-r--r--servers/visual/shader_types.cpp9
-rw-r--r--servers/visual/visual_server_canvas.cpp18
-rw-r--r--servers/visual/visual_server_canvas.h4
-rw-r--r--servers/visual/visual_server_raster.cpp1
-rw-r--r--servers/visual/visual_server_raster.h9
-rw-r--r--servers/visual/visual_server_scene.cpp136
-rw-r--r--servers/visual/visual_server_scene.h5
-rw-r--r--servers/visual/visual_server_viewport.cpp46
-rw-r--r--servers/visual/visual_server_viewport.h3
-rw-r--r--servers/visual/visual_server_wrap_mt.h7
-rw-r--r--servers/visual_server.cpp11
-rw-r--r--servers/visual_server.h9
-rw-r--r--thirdparty/README.md97
-rw-r--r--thirdparty/b2d_convexdecomp/b2Polygon.cpp7
-rw-r--r--thirdparty/etc2comp/EtcFilter.cpp3
-rw-r--r--thirdparty/fonts/Hack_Regular.ttfbin307420 -> 309408 bytes
-rw-r--r--thirdparty/fonts/LICENSE_Hack.md4
-rw-r--r--thirdparty/fonts/NotoSansUI_Bold.ttfbin0 -> 311496 bytes
-rw-r--r--thirdparty/freetype/FTL.TXT2
-rw-r--r--thirdparty/freetype/include/freetype/config/ftconfig.h108
-rw-r--r--thirdparty/freetype/include/freetype/config/ftheader.h128
-rw-r--r--thirdparty/freetype/include/freetype/config/ftoption.h93
-rw-r--r--thirdparty/freetype/include/freetype/config/ftstdlib.h2
-rw-r--r--thirdparty/freetype/include/freetype/freetype.h270
-rw-r--r--thirdparty/freetype/include/freetype/ftadvanc.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftbbox.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftbdf.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftbitmap.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftbzip2.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftcache.h17
-rw-r--r--thirdparty/freetype/include/freetype/ftchapters.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftcid.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftdriver.h1225
-rw-r--r--thirdparty/freetype/include/freetype/fterrdef.h2
-rw-r--r--thirdparty/freetype/include/freetype/fterrors.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftfntfmt.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftgasp.h7
-rw-r--r--thirdparty/freetype/include/freetype/ftglyph.h6
-rw-r--r--thirdparty/freetype/include/freetype/ftgxval.h10
-rw-r--r--thirdparty/freetype/include/freetype/ftgzip.h5
-rw-r--r--thirdparty/freetype/include/freetype/ftimage.h36
-rw-r--r--thirdparty/freetype/include/freetype/ftincrem.h15
-rw-r--r--thirdparty/freetype/include/freetype/ftlcdfil.h23
-rw-r--r--thirdparty/freetype/include/freetype/ftlist.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftlzw.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftmac.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftmm.h110
-rw-r--r--thirdparty/freetype/include/freetype/ftmodapi.h23
-rw-r--r--thirdparty/freetype/include/freetype/ftmoderr.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftotval.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftoutln.h11
-rw-r--r--thirdparty/freetype/include/freetype/ftparams.h205
-rw-r--r--thirdparty/freetype/include/freetype/ftpfr.h8
-rw-r--r--thirdparty/freetype/include/freetype/ftrender.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftsizes.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftsnames.h50
-rw-r--r--thirdparty/freetype/include/freetype/ftstroke.h12
-rw-r--r--thirdparty/freetype/include/freetype/ftsynth.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftsystem.h2
-rw-r--r--thirdparty/freetype/include/freetype/fttrigon.h2
-rw-r--r--thirdparty/freetype/include/freetype/fttypes.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftwinfnt.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/autohint.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/cffotypes.h108
-rw-r--r--thirdparty/freetype/include/freetype/internal/cfftypes.h412
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftcalc.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftdebug.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftdrv.h400
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftgloadr.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftmemory.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftobjs.h85
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftpic.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftpsprop.h48
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftrfork.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftserv.h103
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftstream.h6
-rw-r--r--thirdparty/freetype/include/freetype/internal/fttrace.h9
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftvalid.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/internal.h8
-rw-r--r--thirdparty/freetype/include/freetype/internal/psaux.h501
-rw-r--r--thirdparty/freetype/include/freetype/internal/pshints.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svbdf.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svcfftl.h112
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svcid.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svfntfmt.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svgldict.h6
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svgxval.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svkern.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svmetric.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svmm.h57
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svotval.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpfr.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpostnm.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svprop.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpscmap.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpsinfo.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svsfnt.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svttcmap.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svtteng.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svttglyf.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svwinfnt.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/sfnt.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/t1types.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/tttypes.h12
-rw-r--r--thirdparty/freetype/include/freetype/t1tables.h11
-rw-r--r--thirdparty/freetype/include/freetype/ttnameid.h4
-rw-r--r--thirdparty/freetype/include/freetype/tttables.h2
-rw-r--r--thirdparty/freetype/include/freetype/tttags.h2
-rw-r--r--thirdparty/freetype/include/ft2build.h2
-rw-r--r--thirdparty/freetype/src/autofit/afangles.c2
-rw-r--r--thirdparty/freetype/src/autofit/afblue.c8
-rw-r--r--thirdparty/freetype/src/autofit/afblue.cin2
-rw-r--r--thirdparty/freetype/src/autofit/afblue.dat10
-rw-r--r--thirdparty/freetype/src/autofit/afblue.h300
-rw-r--r--thirdparty/freetype/src/autofit/afblue.hin2
-rw-r--r--thirdparty/freetype/src/autofit/afcjk.c6
-rw-r--r--thirdparty/freetype/src/autofit/afcjk.h2
-rw-r--r--thirdparty/freetype/src/autofit/afcover.h2
-rw-r--r--thirdparty/freetype/src/autofit/afdummy.c2
-rw-r--r--thirdparty/freetype/src/autofit/afdummy.h2
-rw-r--r--thirdparty/freetype/src/autofit/aferrors.h2
-rw-r--r--thirdparty/freetype/src/autofit/afglobal.c2
-rw-r--r--thirdparty/freetype/src/autofit/afglobal.h2
-rw-r--r--thirdparty/freetype/src/autofit/afhints.c15
-rw-r--r--thirdparty/freetype/src/autofit/afhints.h4
-rw-r--r--thirdparty/freetype/src/autofit/afindic.c2
-rw-r--r--thirdparty/freetype/src/autofit/afindic.h2
-rw-r--r--thirdparty/freetype/src/autofit/aflatin.c2
-rw-r--r--thirdparty/freetype/src/autofit/aflatin.h2
-rw-r--r--thirdparty/freetype/src/autofit/aflatin2.c2
-rw-r--r--thirdparty/freetype/src/autofit/aflatin2.h2
-rw-r--r--thirdparty/freetype/src/autofit/afloader.c2
-rw-r--r--thirdparty/freetype/src/autofit/afloader.h2
-rw-r--r--thirdparty/freetype/src/autofit/afmodule.c4
-rw-r--r--thirdparty/freetype/src/autofit/afmodule.h2
-rw-r--r--thirdparty/freetype/src/autofit/afpic.c2
-rw-r--r--thirdparty/freetype/src/autofit/afpic.h2
-rw-r--r--thirdparty/freetype/src/autofit/afranges.c27
-rw-r--r--thirdparty/freetype/src/autofit/afranges.h2
-rw-r--r--thirdparty/freetype/src/autofit/afscript.h4
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.c33
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.h2
-rw-r--r--thirdparty/freetype/src/autofit/afstyles.h2
-rw-r--r--thirdparty/freetype/src/autofit/aftypes.h8
-rw-r--r--thirdparty/freetype/src/autofit/afwarp.c2
-rw-r--r--thirdparty/freetype/src/autofit/afwarp.h2
-rw-r--r--thirdparty/freetype/src/autofit/afwrtsys.h2
-rw-r--r--thirdparty/freetype/src/autofit/autofit.c2
-rw-r--r--thirdparty/freetype/src/autofit/module.mk2
-rw-r--r--thirdparty/freetype/src/autofit/rules.mk2
-rw-r--r--thirdparty/freetype/src/base/basepic.c2
-rw-r--r--thirdparty/freetype/src/base/basepic.h2
-rw-r--r--thirdparty/freetype/src/base/ftadvanc.c16
-rw-r--r--thirdparty/freetype/src/base/ftapi.c2
-rw-r--r--thirdparty/freetype/src/base/ftbase.c5
-rw-r--r--thirdparty/freetype/src/base/ftbase.h8
-rw-r--r--thirdparty/freetype/src/base/ftbbox.c2
-rw-r--r--thirdparty/freetype/src/base/ftbdf.c2
-rw-r--r--thirdparty/freetype/src/base/ftbitmap.c77
-rw-r--r--thirdparty/freetype/src/base/ftcalc.c2
-rw-r--r--thirdparty/freetype/src/base/ftcid.c2
-rw-r--r--thirdparty/freetype/src/base/ftdbgmem.c10
-rw-r--r--thirdparty/freetype/src/base/ftdebug.c4
-rw-r--r--thirdparty/freetype/src/base/ftfntfmt.c2
-rw-r--r--thirdparty/freetype/src/base/ftfstype.c2
-rw-r--r--thirdparty/freetype/src/base/ftgasp.c2
-rw-r--r--thirdparty/freetype/src/base/ftgloadr.c2
-rw-r--r--thirdparty/freetype/src/base/ftglyph.c2
-rw-r--r--thirdparty/freetype/src/base/ftgxval.c2
-rw-r--r--thirdparty/freetype/src/base/ftinit.c2
-rw-r--r--thirdparty/freetype/src/base/ftlcdfil.c59
-rw-r--r--thirdparty/freetype/src/base/ftmac.c2
-rw-r--r--thirdparty/freetype/src/base/ftmm.c81
-rw-r--r--thirdparty/freetype/src/base/ftobjs.c470
-rw-r--r--thirdparty/freetype/src/base/ftotval.c2
-rw-r--r--thirdparty/freetype/src/base/ftoutln.c13
-rw-r--r--thirdparty/freetype/src/base/ftpatent.c2
-rw-r--r--thirdparty/freetype/src/base/ftpfr.c2
-rw-r--r--thirdparty/freetype/src/base/ftpic.c2
-rw-r--r--thirdparty/freetype/src/base/ftpsprop.c285
-rw-r--r--thirdparty/freetype/src/base/ftrfork.c4
-rw-r--r--thirdparty/freetype/src/base/ftsnames.c2
-rw-r--r--thirdparty/freetype/src/base/ftstream.c2
-rw-r--r--thirdparty/freetype/src/base/ftstroke.c2
-rw-r--r--thirdparty/freetype/src/base/ftsynth.c2
-rw-r--r--thirdparty/freetype/src/base/ftsystem.c2
-rw-r--r--thirdparty/freetype/src/base/fttrigon.c2
-rw-r--r--thirdparty/freetype/src/base/fttype1.c2
-rw-r--r--thirdparty/freetype/src/base/ftutil.c2
-rw-r--r--thirdparty/freetype/src/base/ftver.rc61
-rw-r--r--thirdparty/freetype/src/base/ftwinfnt.c2
-rw-r--r--thirdparty/freetype/src/base/rules.mk5
-rw-r--r--thirdparty/freetype/src/bdf/README2
-rw-r--r--thirdparty/freetype/src/bdf/bdfdrivr.c2
-rw-r--r--thirdparty/freetype/src/bdf/bdflib.c12
-rw-r--r--thirdparty/freetype/src/bzip2/ftbzip2.c2
-rw-r--r--thirdparty/freetype/src/bzip2/rules.mk2
-rw-r--r--thirdparty/freetype/src/cache/ftcache.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcbasic.c2
-rw-r--r--thirdparty/freetype/src/cache/ftccache.c2
-rw-r--r--thirdparty/freetype/src/cache/ftccache.h2
-rw-r--r--thirdparty/freetype/src/cache/ftccback.h2
-rw-r--r--thirdparty/freetype/src/cache/ftccmap.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcerror.h2
-rw-r--r--thirdparty/freetype/src/cache/ftcglyph.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcglyph.h2
-rw-r--r--thirdparty/freetype/src/cache/ftcimage.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcimage.h2
-rw-r--r--thirdparty/freetype/src/cache/ftcmanag.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcmanag.h2
-rw-r--r--thirdparty/freetype/src/cache/ftcmru.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcmru.h2
-rw-r--r--thirdparty/freetype/src/cache/ftcsbits.c2
-rw-r--r--thirdparty/freetype/src/cache/ftcsbits.h2
-rw-r--r--thirdparty/freetype/src/cache/rules.mk2
-rw-r--r--thirdparty/freetype/src/cff/cff.c13
-rw-r--r--thirdparty/freetype/src/cff/cffcmap.c2
-rw-r--r--thirdparty/freetype/src/cff/cffcmap.h4
-rw-r--r--thirdparty/freetype/src/cff/cffdrivr.c381
-rw-r--r--thirdparty/freetype/src/cff/cffdrivr.h2
-rw-r--r--thirdparty/freetype/src/cff/cfferrs.h2
-rw-r--r--thirdparty/freetype/src/cff/cffgload.c2623
-rw-r--r--thirdparty/freetype/src/cff/cffgload.h187
-rw-r--r--thirdparty/freetype/src/cff/cffload.c84
-rw-r--r--thirdparty/freetype/src/cff/cffload.h9
-rw-r--r--thirdparty/freetype/src/cff/cffobjs.c120
-rw-r--r--thirdparty/freetype/src/cff/cffobjs.h106
-rw-r--r--thirdparty/freetype/src/cff/cffparse.c27
-rw-r--r--thirdparty/freetype/src/cff/cffparse.h4
-rw-r--r--thirdparty/freetype/src/cff/cffpic.c2
-rw-r--r--thirdparty/freetype/src/cff/cffpic.h7
-rw-r--r--thirdparty/freetype/src/cff/cfftoken.h2
-rw-r--r--thirdparty/freetype/src/cff/module.mk2
-rw-r--r--thirdparty/freetype/src/cff/rules.mk19
-rw-r--r--thirdparty/freetype/src/cid/ciderrs.h2
-rw-r--r--thirdparty/freetype/src/cid/cidgload.c87
-rw-r--r--thirdparty/freetype/src/cid/cidgload.h2
-rw-r--r--thirdparty/freetype/src/cid/cidload.c2
-rw-r--r--thirdparty/freetype/src/cid/cidload.h2
-rw-r--r--thirdparty/freetype/src/cid/cidobjs.c40
-rw-r--r--thirdparty/freetype/src/cid/cidobjs.h2
-rw-r--r--thirdparty/freetype/src/cid/cidparse.c2
-rw-r--r--thirdparty/freetype/src/cid/cidparse.h2
-rw-r--r--thirdparty/freetype/src/cid/cidriver.c22
-rw-r--r--thirdparty/freetype/src/cid/cidriver.h2
-rw-r--r--thirdparty/freetype/src/cid/cidtoken.h2
-rw-r--r--thirdparty/freetype/src/cid/module.mk2
-rw-r--r--thirdparty/freetype/src/cid/rules.mk2
-rw-r--r--thirdparty/freetype/src/cid/type1cid.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/README12
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvalid.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvalid.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvbsln.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvcommn.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvcommn.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxverror.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvfeat.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvfeat.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvfgen.c4
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvjust.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvkern.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvlcar.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmod.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmod.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort0.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort1.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort2.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort4.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort5.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx.h2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx0.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx1.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx2.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx4.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx5.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvopbd.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvprop.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvtrak.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/module.mk2
-rw-r--r--thirdparty/freetype/src/gxvalid/rules.mk2
-rw-r--r--thirdparty/freetype/src/gzip/ftgzip.c2
-rw-r--r--thirdparty/freetype/src/gzip/rules.mk2
-rw-r--r--thirdparty/freetype/src/lzw/ftlzw.c2
-rw-r--r--thirdparty/freetype/src/lzw/ftzopen.c2
-rw-r--r--thirdparty/freetype/src/lzw/ftzopen.h2
-rw-r--r--thirdparty/freetype/src/lzw/rules.mk2
-rw-r--r--thirdparty/freetype/src/otvalid/module.mk2
-rw-r--r--thirdparty/freetype/src/otvalid/otvalid.c2
-rw-r--r--thirdparty/freetype/src/otvalid/otvalid.h2
-rw-r--r--thirdparty/freetype/src/otvalid/otvbase.c35
-rw-r--r--thirdparty/freetype/src/otvalid/otvcommn.c30
-rw-r--r--thirdparty/freetype/src/otvalid/otvcommn.h54
-rw-r--r--thirdparty/freetype/src/otvalid/otverror.h2
-rw-r--r--thirdparty/freetype/src/otvalid/otvgdef.c113
-rw-r--r--thirdparty/freetype/src/otvalid/otvgpos.c56
-rw-r--r--thirdparty/freetype/src/otvalid/otvgpos.h2
-rw-r--r--thirdparty/freetype/src/otvalid/otvgsub.c36
-rw-r--r--thirdparty/freetype/src/otvalid/otvjstf.c2
-rw-r--r--thirdparty/freetype/src/otvalid/otvmath.c2
-rw-r--r--thirdparty/freetype/src/otvalid/otvmod.c2
-rw-r--r--thirdparty/freetype/src/otvalid/otvmod.h2
-rw-r--r--thirdparty/freetype/src/otvalid/rules.mk2
-rw-r--r--thirdparty/freetype/src/pcf/pcfdrivr.c2
-rw-r--r--thirdparty/freetype/src/pcf/pcfread.c6
-rw-r--r--thirdparty/freetype/src/pfr/module.mk2
-rw-r--r--thirdparty/freetype/src/pfr/pfr.c2
-rw-r--r--thirdparty/freetype/src/pfr/pfrcmap.c2
-rw-r--r--thirdparty/freetype/src/pfr/pfrcmap.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrdrivr.c2
-rw-r--r--thirdparty/freetype/src/pfr/pfrdrivr.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrerror.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrgload.c12
-rw-r--r--thirdparty/freetype/src/pfr/pfrgload.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrload.c2
-rw-r--r--thirdparty/freetype/src/pfr/pfrload.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrobjs.c2
-rw-r--r--thirdparty/freetype/src/pfr/pfrobjs.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrsbit.c2
-rw-r--r--thirdparty/freetype/src/pfr/pfrsbit.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrtypes.h2
-rw-r--r--thirdparty/freetype/src/pfr/rules.mk2
-rw-r--r--thirdparty/freetype/src/psaux/afmparse.c2
-rw-r--r--thirdparty/freetype/src/psaux/afmparse.h2
-rw-r--r--thirdparty/freetype/src/psaux/cffdecode.c2370
-rw-r--r--thirdparty/freetype/src/psaux/cffdecode.h64
-rw-r--r--thirdparty/freetype/src/psaux/module.mk2
-rw-r--r--thirdparty/freetype/src/psaux/psarrst.c241
-rw-r--r--thirdparty/freetype/src/psaux/psarrst.h100
-rw-r--r--thirdparty/freetype/src/psaux/psaux.c13
-rw-r--r--thirdparty/freetype/src/psaux/psauxerr.h2
-rw-r--r--thirdparty/freetype/src/psaux/psauxmod.c56
-rw-r--r--thirdparty/freetype/src/psaux/psauxmod.h11
-rw-r--r--thirdparty/freetype/src/psaux/psblues.c582
-rw-r--r--thirdparty/freetype/src/psaux/psblues.h185
-rw-r--r--thirdparty/freetype/src/psaux/psconv.c2
-rw-r--r--thirdparty/freetype/src/psaux/psconv.h2
-rw-r--r--thirdparty/freetype/src/psaux/pserror.c52
-rw-r--r--thirdparty/freetype/src/psaux/pserror.h119
-rw-r--r--thirdparty/freetype/src/psaux/psfixed.h95
-rw-r--r--thirdparty/freetype/src/psaux/psfont.c567
-rw-r--r--thirdparty/freetype/src/psaux/psfont.h134
-rw-r--r--thirdparty/freetype/src/psaux/psft.c890
-rw-r--r--thirdparty/freetype/src/psaux/psft.h167
-rw-r--r--thirdparty/freetype/src/psaux/psglue.h144
-rw-r--r--thirdparty/freetype/src/psaux/pshints.c1939
-rw-r--r--thirdparty/freetype/src/psaux/pshints.h288
-rw-r--r--thirdparty/freetype/src/psaux/psintrp.c3040
-rw-r--r--thirdparty/freetype/src/psaux/psintrp.h83
-rw-r--r--thirdparty/freetype/src/psaux/psobjs.c753
-rw-r--r--thirdparty/freetype/src/psaux/psobjs.h103
-rw-r--r--thirdparty/freetype/src/psaux/psread.c112
-rw-r--r--thirdparty/freetype/src/psaux/psread.h68
-rw-r--r--thirdparty/freetype/src/psaux/psstack.c328
-rw-r--r--thirdparty/freetype/src/psaux/psstack.h121
-rw-r--r--thirdparty/freetype/src/psaux/pstypes.h78
-rw-r--r--thirdparty/freetype/src/psaux/rules.mk19
-rw-r--r--thirdparty/freetype/src/psaux/t1cmap.c2
-rw-r--r--thirdparty/freetype/src/psaux/t1cmap.h2
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.c350
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.h12
-rw-r--r--thirdparty/freetype/src/pshinter/module.mk2
-rw-r--r--thirdparty/freetype/src/pshinter/pshalgo.c4
-rw-r--r--thirdparty/freetype/src/pshinter/pshalgo.h2
-rw-r--r--thirdparty/freetype/src/pshinter/pshglob.c6
-rw-r--r--thirdparty/freetype/src/pshinter/pshglob.h2
-rw-r--r--thirdparty/freetype/src/pshinter/pshinter.c2
-rw-r--r--thirdparty/freetype/src/pshinter/pshmod.c2
-rw-r--r--thirdparty/freetype/src/pshinter/pshmod.h2
-rw-r--r--thirdparty/freetype/src/pshinter/pshnterr.h2
-rw-r--r--thirdparty/freetype/src/pshinter/pshpic.c2
-rw-r--r--thirdparty/freetype/src/pshinter/pshpic.h2
-rw-r--r--thirdparty/freetype/src/pshinter/pshrec.c2
-rw-r--r--thirdparty/freetype/src/pshinter/pshrec.h2
-rw-r--r--thirdparty/freetype/src/pshinter/rules.mk2
-rw-r--r--thirdparty/freetype/src/psnames/module.mk2
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.c2
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.h2
-rw-r--r--thirdparty/freetype/src/psnames/psnamerr.h2
-rw-r--r--thirdparty/freetype/src/psnames/psnames.c2
-rw-r--r--thirdparty/freetype/src/psnames/pspic.c2
-rw-r--r--thirdparty/freetype/src/psnames/pspic.h2
-rw-r--r--thirdparty/freetype/src/psnames/pstables.h2
-rw-r--r--thirdparty/freetype/src/psnames/rules.mk2
-rw-r--r--thirdparty/freetype/src/raster/ftmisc.h2
-rw-r--r--thirdparty/freetype/src/raster/ftraster.c2
-rw-r--r--thirdparty/freetype/src/raster/ftraster.h2
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.c111
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.h2
-rw-r--r--thirdparty/freetype/src/raster/module.mk2
-rw-r--r--thirdparty/freetype/src/raster/raster.c2
-rw-r--r--thirdparty/freetype/src/raster/rasterrs.h2
-rw-r--r--thirdparty/freetype/src/raster/rastpic.c2
-rw-r--r--thirdparty/freetype/src/raster/rastpic.h2
-rw-r--r--thirdparty/freetype/src/raster/rules.mk2
-rw-r--r--thirdparty/freetype/src/sfnt/module.mk2
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.c61
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.h2
-rw-r--r--thirdparty/freetype/src/sfnt/rules.mk2
-rw-r--r--thirdparty/freetype/src/sfnt/sfdriver.c9
-rw-r--r--thirdparty/freetype/src/sfnt/sfdriver.h2
-rw-r--r--thirdparty/freetype/src/sfnt/sferrors.h2
-rw-r--r--thirdparty/freetype/src/sfnt/sfnt.c2
-rw-r--r--thirdparty/freetype/src/sfnt/sfntpic.c2
-rw-r--r--thirdparty/freetype/src/sfnt/sfntpic.h2
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.c19
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttbdf.c2
-rw-r--r--thirdparty/freetype/src/sfnt/ttbdf.h6
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.c47
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmapc.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.c2
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttload.c4
-rw-r--r--thirdparty/freetype/src/sfnt/ttload.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttmtx.c2
-rw-r--r--thirdparty/freetype/src/sfnt/ttmtx.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.c6
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.c9
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.h2
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.c85
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.h2
-rw-r--r--thirdparty/freetype/src/smooth/ftsmerrs.h2
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.c287
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.h2
-rw-r--r--thirdparty/freetype/src/smooth/ftspic.c2
-rw-r--r--thirdparty/freetype/src/smooth/ftspic.h2
-rw-r--r--thirdparty/freetype/src/smooth/module.mk2
-rw-r--r--thirdparty/freetype/src/smooth/rules.mk2
-rw-r--r--thirdparty/freetype/src/smooth/smooth.c2
-rw-r--r--thirdparty/freetype/src/truetype/module.mk2
-rw-r--r--thirdparty/freetype/src/truetype/rules.mk2
-rw-r--r--thirdparty/freetype/src/truetype/truetype.c2
-rw-r--r--thirdparty/freetype/src/truetype/ttdriver.c13
-rw-r--r--thirdparty/freetype/src/truetype/ttdriver.h2
-rw-r--r--thirdparty/freetype/src/truetype/tterrors.h2
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.c139
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.h2
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.c646
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.h10
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.c115
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.h2
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.c101
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.h2
-rw-r--r--thirdparty/freetype/src/truetype/ttpic.c2
-rw-r--r--thirdparty/freetype/src/truetype/ttpic.h2
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.c2
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.h2
-rw-r--r--thirdparty/freetype/src/truetype/ttsubpix.c28
-rw-r--r--thirdparty/freetype/src/truetype/ttsubpix.h2
-rw-r--r--thirdparty/freetype/src/type1/module.mk2
-rw-r--r--thirdparty/freetype/src/type1/rules.mk2
-rw-r--r--thirdparty/freetype/src/type1/t1afm.c2
-rw-r--r--thirdparty/freetype/src/type1/t1afm.h2
-rw-r--r--thirdparty/freetype/src/type1/t1driver.c21
-rw-r--r--thirdparty/freetype/src/type1/t1driver.h2
-rw-r--r--thirdparty/freetype/src/type1/t1errors.h2
-rw-r--r--thirdparty/freetype/src/type1/t1gload.c118
-rw-r--r--thirdparty/freetype/src/type1/t1gload.h2
-rw-r--r--thirdparty/freetype/src/type1/t1load.c113
-rw-r--r--thirdparty/freetype/src/type1/t1load.h6
-rw-r--r--thirdparty/freetype/src/type1/t1objs.c42
-rw-r--r--thirdparty/freetype/src/type1/t1objs.h8
-rw-r--r--thirdparty/freetype/src/type1/t1parse.c2
-rw-r--r--thirdparty/freetype/src/type1/t1parse.h2
-rw-r--r--thirdparty/freetype/src/type1/t1tokens.h2
-rw-r--r--thirdparty/freetype/src/type1/type1.c2
-rw-r--r--thirdparty/freetype/src/type42/module.mk2
-rw-r--r--thirdparty/freetype/src/type42/rules.mk2
-rw-r--r--thirdparty/freetype/src/type42/t42drivr.c2
-rw-r--r--thirdparty/freetype/src/type42/t42drivr.h2
-rw-r--r--thirdparty/freetype/src/type42/t42error.h2
-rw-r--r--thirdparty/freetype/src/type42/t42objs.c2
-rw-r--r--thirdparty/freetype/src/type42/t42objs.h2
-rw-r--r--thirdparty/freetype/src/type42/t42parse.c2
-rw-r--r--thirdparty/freetype/src/type42/t42parse.h2
-rw-r--r--thirdparty/freetype/src/type42/t42types.h2
-rw-r--r--thirdparty/freetype/src/type42/type42.c2
-rw-r--r--thirdparty/freetype/src/winfonts/fnterrs.h2
-rw-r--r--thirdparty/freetype/src/winfonts/module.mk2
-rw-r--r--thirdparty/freetype/src/winfonts/rules.mk2
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.c2
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.h2
-rw-r--r--thirdparty/glad/KHR/khrplatform.h16
-rw-r--r--thirdparty/glad/glad.c105
-rw-r--r--thirdparty/glad/glad/glad.h122
-rw-r--r--thirdparty/libsimplewebm/libwebm/README.libvpx2
-rw-r--r--thirdparty/libsimplewebm/libwebm/common/webmids.h8
-rw-r--r--thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.cc428
-rw-r--r--thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.h36
-rw-r--r--thirdparty/libvorbis/COPYING2
-rw-r--r--thirdparty/libvorbis/analysis.c1
-rw-r--r--thirdparty/libvorbis/backends.h1
-rw-r--r--thirdparty/libvorbis/barkmel.c1
-rw-r--r--thirdparty/libvorbis/bitrate.c1
-rw-r--r--thirdparty/libvorbis/bitrate.h1
-rw-r--r--thirdparty/libvorbis/block.c1
-rw-r--r--thirdparty/libvorbis/books/coupled/res_books_51.h1
-rw-r--r--thirdparty/libvorbis/books/coupled/res_books_stereo.h1
-rw-r--r--thirdparty/libvorbis/books/floor/floor_books.h1
-rw-r--r--thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h1
-rw-r--r--thirdparty/libvorbis/codebook.c49
-rw-r--r--thirdparty/libvorbis/codebook.h1
-rw-r--r--thirdparty/libvorbis/codec_internal.h1
-rw-r--r--thirdparty/libvorbis/envelope.c1
-rw-r--r--thirdparty/libvorbis/envelope.h1
-rw-r--r--thirdparty/libvorbis/floor0.c1
-rw-r--r--thirdparty/libvorbis/floor1.c1
-rw-r--r--thirdparty/libvorbis/highlevel.h1
-rw-r--r--thirdparty/libvorbis/info.c34
-rw-r--r--thirdparty/libvorbis/lookup.c1
-rw-r--r--thirdparty/libvorbis/lookup.h1
-rw-r--r--thirdparty/libvorbis/lookup_data.h1
-rw-r--r--thirdparty/libvorbis/lpc.c1
-rw-r--r--thirdparty/libvorbis/lpc.h1
-rw-r--r--thirdparty/libvorbis/lsp.c1
-rw-r--r--thirdparty/libvorbis/lsp.h1
-rw-r--r--thirdparty/libvorbis/mapping0.c2
-rw-r--r--thirdparty/libvorbis/masking.h1
-rw-r--r--thirdparty/libvorbis/mdct.c1
-rw-r--r--thirdparty/libvorbis/mdct.h1
-rw-r--r--thirdparty/libvorbis/misc.h1
-rw-r--r--thirdparty/libvorbis/modes/floor_all.h1
-rw-r--r--thirdparty/libvorbis/modes/psych_11.h1
-rw-r--r--thirdparty/libvorbis/modes/psych_16.h1
-rw-r--r--thirdparty/libvorbis/modes/psych_44.h1
-rw-r--r--thirdparty/libvorbis/modes/psych_8.h1
-rw-r--r--thirdparty/libvorbis/modes/residue_16.h1
-rw-r--r--thirdparty/libvorbis/modes/residue_44.h1
-rw-r--r--thirdparty/libvorbis/modes/residue_44p51.h1
-rw-r--r--thirdparty/libvorbis/modes/residue_44u.h1
-rw-r--r--thirdparty/libvorbis/modes/residue_8.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_11.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_16.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_22.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_32.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_44.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_44p51.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_44u.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_8.h1
-rw-r--r--thirdparty/libvorbis/modes/setup_X.h1
-rw-r--r--thirdparty/libvorbis/os.h3
-rw-r--r--thirdparty/libvorbis/psy.c1
-rw-r--r--thirdparty/libvorbis/psy.h1
-rw-r--r--thirdparty/libvorbis/psytune.c65
-rw-r--r--thirdparty/libvorbis/registry.c1
-rw-r--r--thirdparty/libvorbis/registry.h1
-rw-r--r--thirdparty/libvorbis/res0.c1
-rw-r--r--thirdparty/libvorbis/scales.h1
-rw-r--r--thirdparty/libvorbis/sharedbook.c19
-rw-r--r--thirdparty/libvorbis/smallft.c1
-rw-r--r--thirdparty/libvorbis/smallft.h1
-rw-r--r--thirdparty/libvorbis/synthesis.c3
-rw-r--r--thirdparty/libvorbis/tone.c4
-rw-r--r--thirdparty/libvorbis/vorbis/codec.h1
-rw-r--r--thirdparty/libvorbis/vorbis/vorbisenc.h1
-rw-r--r--thirdparty/libvorbis/vorbis/vorbisfile.h1
-rw-r--r--thirdparty/libvorbis/vorbisenc.c1
-rw-r--r--thirdparty/libvorbis/vorbisfile.c1
-rw-r--r--thirdparty/libvorbis/window.c1
-rw-r--r--thirdparty/libvorbis/window.h1
-rw-r--r--thirdparty/libwebp/AUTHORS15
-rw-r--r--thirdparty/libwebp/src/dec/frame_dec.c12
-rw-r--r--thirdparty/libwebp/src/dec/vp8_dec.c2
-rw-r--r--thirdparty/libwebp/src/dec/vp8i_dec.h6
-rw-r--r--thirdparty/libwebp/src/dec/vp8l_dec.c10
-rw-r--r--thirdparty/libwebp/src/demux/demux.c6
-rw-r--r--thirdparty/libwebp/src/dsp/alpha_processing.c29
-rw-r--r--thirdparty/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c46
-rw-r--r--thirdparty/libwebp/src/dsp/common_sse2.h14
-rw-r--r--thirdparty/libwebp/src/dsp/common_sse41.h132
-rw-r--r--thirdparty/libwebp/src/dsp/cost.c9
-rw-r--r--thirdparty/libwebp/src/dsp/dec.c9
-rw-r--r--thirdparty/libwebp/src/dsp/dsp.h52
-rw-r--r--thirdparty/libwebp/src/dsp/enc.c9
-rw-r--r--thirdparty/libwebp/src/dsp/filters.c9
-rw-r--r--thirdparty/libwebp/src/dsp/lossless.c9
-rw-r--r--thirdparty/libwebp/src/dsp/lossless.h4
-rw-r--r--thirdparty/libwebp/src/dsp/lossless_enc.c9
-rw-r--r--thirdparty/libwebp/src/dsp/lossless_enc_sse2.c27
-rw-r--r--thirdparty/libwebp/src/dsp/lossless_enc_sse41.c94
-rw-r--r--thirdparty/libwebp/src/dsp/lossless_sse2.c19
-rw-r--r--thirdparty/libwebp/src/dsp/rescaler.c7
-rw-r--r--thirdparty/libwebp/src/dsp/rescaler_sse2.c20
-rw-r--r--thirdparty/libwebp/src/dsp/ssim.c9
-rw-r--r--thirdparty/libwebp/src/dsp/upsampling.c30
-rw-r--r--thirdparty/libwebp/src/dsp/upsampling_msa.c6
-rw-r--r--thirdparty/libwebp/src/dsp/upsampling_sse2.c32
-rw-r--r--thirdparty/libwebp/src/dsp/upsampling_sse41.c239
-rw-r--r--thirdparty/libwebp/src/dsp/yuv.c29
-rw-r--r--thirdparty/libwebp/src/dsp/yuv.h13
-rw-r--r--thirdparty/libwebp/src/dsp/yuv_sse2.c4
-rw-r--r--thirdparty/libwebp/src/dsp/yuv_sse41.c613
-rw-r--r--thirdparty/libwebp/src/enc/alpha_enc.c5
-rw-r--r--thirdparty/libwebp/src/enc/analysis_enc.c6
-rw-r--r--thirdparty/libwebp/src/enc/frame_enc.c26
-rw-r--r--thirdparty/libwebp/src/enc/histogram_enc.c11
-rw-r--r--thirdparty/libwebp/src/enc/histogram_enc.h5
-rw-r--r--thirdparty/libwebp/src/enc/iterator_enc.c8
-rw-r--r--thirdparty/libwebp/src/enc/near_lossless_enc.c2
-rw-r--r--thirdparty/libwebp/src/enc/picture_csp_enc.c148
-rw-r--r--thirdparty/libwebp/src/enc/picture_psnr_enc.c15
-rw-r--r--thirdparty/libwebp/src/enc/quant_enc.c87
-rw-r--r--thirdparty/libwebp/src/enc/vp8i_enc.h16
-rw-r--r--thirdparty/libwebp/src/enc/vp8l_enc.c79
-rw-r--r--thirdparty/libwebp/src/enc/webp_enc.c9
-rw-r--r--thirdparty/libwebp/src/mux/muxi.h6
-rw-r--r--thirdparty/libwebp/src/utils/endian_inl_utils.h7
-rw-r--r--thirdparty/libwebsockets/LICENSE (renamed from thirdparty/lws/LICENSE.txt)33
-rw-r--r--thirdparty/libwebsockets/core/alloc.c (renamed from thirdparty/lws/alloc.c)10
-rw-r--r--thirdparty/libwebsockets/core/context.c (renamed from thirdparty/lws/context.c)1063
-rw-r--r--thirdparty/libwebsockets/core/libwebsockets.c (renamed from thirdparty/lws/libwebsockets.c)1850
-rw-r--r--thirdparty/libwebsockets/core/output.c308
-rw-r--r--thirdparty/libwebsockets/core/pollfd.c (renamed from thirdparty/lws/pollfd.c)409
-rw-r--r--thirdparty/libwebsockets/core/private.h1751
-rw-r--r--thirdparty/libwebsockets/core/service.c987
-rw-r--r--thirdparty/libwebsockets/event-libs/poll/poll.c43
-rw-r--r--thirdparty/libwebsockets/event-libs/poll/private.h23
-rw-r--r--thirdparty/libwebsockets/event-libs/private.h74
-rw-r--r--thirdparty/libwebsockets/libwebsockets.h (renamed from thirdparty/lws/libwebsockets.h)2816
-rw-r--r--thirdparty/libwebsockets/lws_config.h (renamed from thirdparty/lws/lws_config.h)80
-rw-r--r--thirdparty/libwebsockets/lws_config_private.h (renamed from thirdparty/lws/lws_config_private.h)2
-rw-r--r--thirdparty/libwebsockets/misc/base64-decode.c (renamed from thirdparty/lws/misc/base64-decode.c)56
-rw-r--r--thirdparty/libwebsockets/misc/getifaddrs.c (renamed from thirdparty/lws/misc/getifaddrs.c)2
-rw-r--r--thirdparty/libwebsockets/misc/getifaddrs.h (renamed from thirdparty/lws/misc/getifaddrs.h)0
-rw-r--r--thirdparty/libwebsockets/misc/lejp.c (renamed from thirdparty/lws/misc/lejp.c)61
-rw-r--r--thirdparty/libwebsockets/misc/sha-1.c (renamed from thirdparty/lws/misc/sha-1.c)4
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-unix.c (renamed from thirdparty/lws/plat/lws-plat-unix.c)303
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-win.c (renamed from thirdparty/lws/plat/lws-plat-win.c)210
-rw-r--r--thirdparty/libwebsockets/roles/h1/ops-h1.c687
-rw-r--r--thirdparty/libwebsockets/roles/h1/private.h27
-rw-r--r--thirdparty/libwebsockets/roles/http/client/client-handshake.c (renamed from thirdparty/lws/client/client-handshake.c)601
-rw-r--r--thirdparty/libwebsockets/roles/http/client/client.c1231
-rw-r--r--thirdparty/libwebsockets/roles/http/header.c (renamed from thirdparty/lws/header.c)136
-rw-r--r--thirdparty/libwebsockets/roles/http/lextable-strings.h (renamed from thirdparty/lws/lextable-strings.h)4
-rw-r--r--thirdparty/libwebsockets/roles/http/lextable.h838
-rw-r--r--thirdparty/libwebsockets/roles/http/private.h257
-rw-r--r--thirdparty/libwebsockets/roles/http/server/access-log.c182
-rw-r--r--thirdparty/libwebsockets/roles/http/server/fops-zip.c (renamed from thirdparty/lws/server/fops-zip.c)15
-rw-r--r--thirdparty/libwebsockets/roles/http/server/lejp-conf.c (renamed from thirdparty/lws/server/lejp-conf.c)100
-rw-r--r--thirdparty/libwebsockets/roles/http/server/parsers.c1139
-rw-r--r--thirdparty/libwebsockets/roles/http/server/server.c (renamed from thirdparty/lws/server/server.c)1862
-rw-r--r--thirdparty/libwebsockets/roles/listen/ops-listen.c177
-rw-r--r--thirdparty/libwebsockets/roles/pipe/ops-pipe.c81
-rw-r--r--thirdparty/libwebsockets/roles/private.h282
-rw-r--r--thirdparty/libwebsockets/roles/raw/ops-raw.c223
-rw-r--r--thirdparty/libwebsockets/roles/ws/client-parser-ws.c (renamed from thirdparty/lws/client/client-parser.c)362
-rw-r--r--thirdparty/libwebsockets/roles/ws/client-ws.c629
-rw-r--r--thirdparty/libwebsockets/roles/ws/ops-ws.c1992
-rw-r--r--thirdparty/libwebsockets/roles/ws/private.h164
-rw-r--r--thirdparty/libwebsockets/roles/ws/server-ws.c836
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c202
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c329
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c240
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c694
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/ssl.c520
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl3.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl3.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_cert.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_cert.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_code.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_code.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_dbg.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_dbg.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_lib.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_lib.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_methods.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_methods.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_pkey.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_pkey.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_stack.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_stack.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_types.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_types.h)3
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_x509.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/ssl_x509.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/tls1.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/tls1.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/x509_vfy.h (renamed from thirdparty/lws/mbedtls_wrapper/include/internal/x509_vfy.h)0
-rwxr-xr-x[-rw-r--r--]thirdparty/libwebsockets/tls/mbedtls/wrapper/include/openssl/ssl.h (renamed from thirdparty/lws/mbedtls_wrapper/include/openssl/ssl.h)17
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_pm.h (renamed from thirdparty/lws/mbedtls_wrapper/include/platform/ssl_pm.h)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_port.h (renamed from thirdparty/lws/mbedtls_wrapper/include/platform/ssl_port.h)10
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_cert.c (renamed from thirdparty/lws/mbedtls_wrapper/library/ssl_cert.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_lib.c (renamed from thirdparty/lws/mbedtls_wrapper/library/ssl_lib.c)116
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_methods.c (renamed from thirdparty/lws/mbedtls_wrapper/library/ssl_methods.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_pkey.c (renamed from thirdparty/lws/mbedtls_wrapper/library/ssl_pkey.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_stack.c (renamed from thirdparty/lws/mbedtls_wrapper/library/ssl_stack.c)0
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_x509.c (renamed from thirdparty/lws/mbedtls_wrapper/library/ssl_x509.c)26
-rwxr-xr-x[-rw-r--r--]thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_pm.c (renamed from thirdparty/lws/mbedtls_wrapper/platform/ssl_pm.c)251
-rw-r--r--thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_port.c (renamed from thirdparty/lws/mbedtls_wrapper/platform/ssl_port.c)0
-rw-r--r--thirdparty/libwebsockets/tls/private.h281
-rw-r--r--thirdparty/libwebsockets/tls/tls-client.c150
-rw-r--r--thirdparty/libwebsockets/tls/tls-server.c382
-rw-r--r--thirdparty/libwebsockets/tls/tls.c522
-rw-r--r--thirdparty/libwebsockets/win32helpers/getopt.c (renamed from thirdparty/lws/win32helpers/getopt.c)306
-rw-r--r--thirdparty/libwebsockets/win32helpers/getopt.h (renamed from thirdparty/lws/win32helpers/getopt.h)0
-rw-r--r--thirdparty/libwebsockets/win32helpers/getopt_long.c (renamed from thirdparty/lws/win32helpers/getopt_long.c)477
-rw-r--r--thirdparty/libwebsockets/win32helpers/gettimeofday.c (renamed from thirdparty/lws/win32helpers/gettimeofday.c)70
-rw-r--r--thirdparty/libwebsockets/win32helpers/gettimeofday.h (renamed from thirdparty/lws/win32helpers/gettimeofday.h)0
-rw-r--r--thirdparty/lws/client/client.c1296
-rw-r--r--thirdparty/lws/client/ssl-client.c625
-rw-r--r--thirdparty/lws/ext/extension-permessage-deflate.c473
-rw-r--r--thirdparty/lws/ext/extension-permessage-deflate.h41
-rw-r--r--thirdparty/lws/ext/extension.c344
-rw-r--r--thirdparty/lws/handshake.c280
-rw-r--r--thirdparty/lws/lextable.h805
-rw-r--r--thirdparty/lws/minilex.c272
-rw-r--r--thirdparty/lws/misc/lejp.h232
-rw-r--r--thirdparty/lws/output.c877
-rw-r--r--thirdparty/lws/private-libwebsockets.h2618
-rw-r--r--thirdparty/lws/server/parsers.c1783
-rw-r--r--thirdparty/lws/server/ranges.c214
-rw-r--r--thirdparty/lws/server/server-handshake.c360
-rw-r--r--thirdparty/lws/server/ssl-server.c477
-rw-r--r--thirdparty/lws/service.c1699
-rw-r--r--thirdparty/lws/ssl.c976
-rw-r--r--thirdparty/mbedtls/1453.diff120
-rw-r--r--thirdparty/mbedtls/LICENSE2
-rw-r--r--thirdparty/mbedtls/apache-2.0.txt202
-rw-r--r--thirdparty/mbedtls/include/mbedtls/asn1.h15
-rw-r--r--thirdparty/mbedtls/include/mbedtls/ccm.h5
-rw-r--r--thirdparty/mbedtls/include/mbedtls/check_config.h4
-rw-r--r--thirdparty/mbedtls/include/mbedtls/config.h30
-rw-r--r--thirdparty/mbedtls/include/mbedtls/dhm.h2
-rw-r--r--thirdparty/mbedtls/include/mbedtls/md2.h44
-rw-r--r--thirdparty/mbedtls/include/mbedtls/md4.h46
-rw-r--r--thirdparty/mbedtls/include/mbedtls/md5.h46
-rw-r--r--thirdparty/mbedtls/include/mbedtls/oid.h18
-rw-r--r--thirdparty/mbedtls/include/mbedtls/ripemd160.h43
-rw-r--r--thirdparty/mbedtls/include/mbedtls/rsa.h12
-rw-r--r--thirdparty/mbedtls/include/mbedtls/sha1.h46
-rw-r--r--thirdparty/mbedtls/include/mbedtls/sha256.h50
-rw-r--r--thirdparty/mbedtls/include/mbedtls/sha512.h49
-rw-r--r--thirdparty/mbedtls/include/mbedtls/ssl.h18
-rw-r--r--thirdparty/mbedtls/include/mbedtls/ssl_internal.h3
-rw-r--r--thirdparty/mbedtls/include/mbedtls/version.h8
-rw-r--r--thirdparty/mbedtls/library/aes.c4
-rw-r--r--thirdparty/mbedtls/library/bignum.c2
-rw-r--r--thirdparty/mbedtls/library/ctr_drbg.c2
-rw-r--r--thirdparty/mbedtls/library/debug.c2
-rw-r--r--thirdparty/mbedtls/library/entropy_poll.c16
-rw-r--r--thirdparty/mbedtls/library/md2.c40
-rw-r--r--thirdparty/mbedtls/library/md4.c41
-rw-r--r--thirdparty/mbedtls/library/md5.c41
-rw-r--r--thirdparty/mbedtls/library/memory_buffer_alloc.c41
-rw-r--r--thirdparty/mbedtls/library/net_sockets.c9
-rw-r--r--thirdparty/mbedtls/library/oid.c45
-rw-r--r--thirdparty/mbedtls/library/pem.c5
-rw-r--r--thirdparty/mbedtls/library/pkcs5.c4
-rw-r--r--thirdparty/mbedtls/library/pkparse.c73
-rw-r--r--thirdparty/mbedtls/library/platform.c2
-rw-r--r--thirdparty/mbedtls/library/ripemd160.c41
-rw-r--r--thirdparty/mbedtls/library/rsa.c124
-rw-r--r--thirdparty/mbedtls/library/sha1.c41
-rw-r--r--thirdparty/mbedtls/library/sha256.c43
-rw-r--r--thirdparty/mbedtls/library/sha512.c43
-rw-r--r--thirdparty/mbedtls/library/ssl_cli.c23
-rw-r--r--thirdparty/mbedtls/library/ssl_tls.c50
-rw-r--r--thirdparty/mbedtls/library/version.c2
-rw-r--r--thirdparty/mbedtls/library/version_features.c3
-rw-r--r--thirdparty/mbedtls/library/x509_crl.c65
-rw-r--r--thirdparty/mbedtls/library/x509_crt.c27
-rw-r--r--thirdparty/miniupnpc/LICENSE27
-rw-r--r--thirdparty/miniupnpc/codelength.h54
-rw-r--r--thirdparty/miniupnpc/connecthostport.c264
-rw-r--r--thirdparty/miniupnpc/connecthostport.h20
-rw-r--r--thirdparty/miniupnpc/igd_desc_parse.c123
-rw-r--r--thirdparty/miniupnpc/igd_desc_parse.h49
-rw-r--r--thirdparty/miniupnpc/listdevices.c197
-rw-r--r--thirdparty/miniupnpc/minisoap.c124
-rw-r--r--thirdparty/miniupnpc/minisoap.h17
-rw-r--r--thirdparty/miniupnpc/minissdpc.c888
-rw-r--r--thirdparty/miniupnpc/minissdpc.h58
-rw-r--r--thirdparty/miniupnpc/miniupnpc.c727
-rw-r--r--thirdparty/miniupnpc/miniupnpc.def45
-rw-r--r--thirdparty/miniupnpc/miniupnpc.h153
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniupnpc.h153
-rw-r--r--thirdparty/miniupnpc/miniupnpc/miniwget.h27
-rw-r--r--thirdparty/miniupnpc/miniupnpc/upnpcommands.h348
-rw-r--r--thirdparty/miniupnpc/miniupnpc_declspec.h21
-rw-r--r--thirdparty/miniupnpc/miniupnpc_socketdef.h37
-rw-r--r--thirdparty/miniupnpc/miniupnpcmodule.c703
-rw-r--r--thirdparty/miniupnpc/miniupnpcstrings.h17
-rw-r--r--thirdparty/miniupnpc/miniupnpctypes.h19
-rw-r--r--thirdparty/miniupnpc/miniwget.c662
-rw-r--r--thirdparty/miniupnpc/miniwget.h27
-rw-r--r--thirdparty/miniupnpc/miniwget_private.h15
-rw-r--r--thirdparty/miniupnpc/minixml.c231
-rw-r--r--thirdparty/miniupnpc/minixml.h37
-rw-r--r--thirdparty/miniupnpc/minixmlvalid.c163
-rw-r--r--thirdparty/miniupnpc/portlistingparse.c172
-rw-r--r--thirdparty/miniupnpc/portlistingparse.h65
-rw-r--r--thirdparty/miniupnpc/receivedata.c99
-rw-r--r--thirdparty/miniupnpc/receivedata.h21
-rw-r--r--thirdparty/miniupnpc/upnpc.c861
-rw-r--r--thirdparty/miniupnpc/upnpcommands.c1241
-rw-r--r--thirdparty/miniupnpc/upnpcommands.h348
-rw-r--r--thirdparty/miniupnpc/upnpdev.c23
-rw-r--r--thirdparty/miniupnpc/upnpdev.h36
-rw-r--r--thirdparty/miniupnpc/upnperrors.c107
-rw-r--r--thirdparty/miniupnpc/upnperrors.h26
-rw-r--r--thirdparty/miniupnpc/upnpreplyparse.c196
-rw-r--r--thirdparty/miniupnpc/upnpreplyparse.h63
-rw-r--r--thirdparty/minizip/crypt.h8
-rw-r--r--thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch6
-rw-r--r--thirdparty/minizip/ioapi.c22
-rw-r--r--thirdparty/minizip/ioapi.h10
-rw-r--r--thirdparty/minizip/unzip.c26
-rw-r--r--thirdparty/minizip/unzip.h4
-rw-r--r--thirdparty/minizip/zip.c35
-rw-r--r--thirdparty/misc/stb_truetype.h487
-rw-r--r--thirdparty/misc/stb_vorbis.c293
-rw-r--r--thirdparty/pcre2/AUTHORS6
-rw-r--r--thirdparty/pcre2/LICENCE27
-rw-r--r--thirdparty/pcre2/src/config.h57
-rw-r--r--thirdparty/pcre2/src/pcre2.h215
-rw-r--r--thirdparty/pcre2/src/pcre2_auto_possess.c66
-rw-r--r--thirdparty/pcre2/src/pcre2_compile.c794
-rw-r--r--thirdparty/pcre2/src/pcre2_config.c48
-rw-r--r--thirdparty/pcre2/src/pcre2_context.c119
-rw-r--r--thirdparty/pcre2/src/pcre2_convert.c1176
-rw-r--r--thirdparty/pcre2/src/pcre2_dfa_match.c529
-rw-r--r--thirdparty/pcre2/src/pcre2_error.c14
-rw-r--r--thirdparty/pcre2/src/pcre2_extuni.c148
-rw-r--r--thirdparty/pcre2/src/pcre2_internal.h132
-rw-r--r--thirdparty/pcre2/src/pcre2_intmodedep.h165
-rw-r--r--thirdparty/pcre2/src/pcre2_jit_compile.c3846
-rw-r--r--thirdparty/pcre2/src/pcre2_jit_match.c10
-rw-r--r--thirdparty/pcre2/src/pcre2_jit_test.c1735
-rw-r--r--thirdparty/pcre2/src/pcre2_match.c8330
-rw-r--r--thirdparty/pcre2/src/pcre2_match_data.c6
-rw-r--r--thirdparty/pcre2/src/pcre2_pattern_info.c37
-rw-r--r--thirdparty/pcre2/src/pcre2_printint.c832
-rw-r--r--thirdparty/pcre2/src/pcre2_serialize.c5
-rw-r--r--thirdparty/pcre2/src/pcre2_study.c38
-rw-r--r--thirdparty/pcre2/src/pcre2_substring.c9
-rw-r--r--thirdparty/pcre2/src/pcre2_tables.c448
-rw-r--r--thirdparty/pcre2/src/pcre2_ucd.c5447
-rw-r--r--thirdparty/pcre2/src/pcre2_ucp.h38
-rw-r--r--thirdparty/pcre2/src/pcre2_valid_utf.c8
-rw-r--r--thirdparty/pcre2/src/sljit/sljitConfig.h8
-rw-r--r--thirdparty/pcre2/src/sljit/sljitConfigInternal.h98
-rw-r--r--thirdparty/pcre2/src/sljit/sljitExecAllocator.c2
-rw-r--r--thirdparty/pcre2/src/sljit/sljitLir.c1160
-rw-r--r--thirdparty/pcre2/src/sljit/sljitLir.h844
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeARM_32.c1613
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeARM_64.c888
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c1198
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeMIPS_32.c482
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeMIPS_64.c381
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeMIPS_common.c776
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativePPC_32.c101
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativePPC_64.c201
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativePPC_common.c1358
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeSPARC_32.c132
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeSPARC_common.c340
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeTILEGX-encoder.c2
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeTILEGX_64.c30
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeX86_32.c519
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeX86_64.c351
-rw-r--r--thirdparty/pcre2/src/sljit/sljitNativeX86_common.c792
-rw-r--r--thirdparty/pcre2/src/sljit/sljitProtExecAllocator.c421
-rw-r--r--thirdparty/pcre2/src/sljit/sljitUtils.c116
-rw-r--r--thirdparty/thekla_atlas/nvcore/Debug.h8
-rw-r--r--thirdparty/thekla_atlas/poshlib/posh.h5
-rw-r--r--thirdparty/zstd/common/bitstream.h2
-rw-r--r--thirdparty/zstd/common/compiler.h25
-rw-r--r--thirdparty/zstd/common/cpu.h216
-rw-r--r--thirdparty/zstd/common/error_private.c1
-rw-r--r--thirdparty/zstd/common/fse.h2
-rw-r--r--thirdparty/zstd/common/fse_decompress.c4
-rw-r--r--thirdparty/zstd/common/huf.h203
-rw-r--r--thirdparty/zstd/common/pool.c63
-rw-r--r--thirdparty/zstd/common/pool.h27
-rw-r--r--thirdparty/zstd/common/threading.h24
-rw-r--r--thirdparty/zstd/common/zstd_errors.h23
-rw-r--r--thirdparty/zstd/common/zstd_internal.h9
-rw-r--r--thirdparty/zstd/compress/fse_compress.c30
-rw-r--r--thirdparty/zstd/compress/huf_compress.c222
-rw-r--r--thirdparty/zstd/compress/zstd_compress.c1617
-rw-r--r--thirdparty/zstd/compress/zstd_compress_internal.h315
-rw-r--r--thirdparty/zstd/compress/zstd_double_fast.c142
-rw-r--r--thirdparty/zstd/compress/zstd_double_fast.h15
-rw-r--r--thirdparty/zstd/compress/zstd_fast.c158
-rw-r--r--thirdparty/zstd/compress/zstd_fast.h16
-rw-r--r--thirdparty/zstd/compress/zstd_lazy.c607
-rw-r--r--thirdparty/zstd/compress/zstd_lazy.h49
-rw-r--r--thirdparty/zstd/compress/zstd_ldm.c664
-rw-r--r--thirdparty/zstd/compress/zstd_ldm.h85
-rw-r--r--thirdparty/zstd/compress/zstd_opt.c250
-rw-r--r--thirdparty/zstd/compress/zstd_opt.h22
-rw-r--r--thirdparty/zstd/compress/zstdmt_compress.c1580
-rw-r--r--thirdparty/zstd/compress/zstdmt_compress.h48
-rw-r--r--thirdparty/zstd/decompress/huf_decompress.c680
-rw-r--r--thirdparty/zstd/decompress/zstd_decompress.c1216
-rw-r--r--thirdparty/zstd/zstd.h508
2583 files changed, 198762 insertions, 75033 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 708961fd92..7691f65d6a 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -17,7 +17,8 @@ cache:
install:
- SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- - pip install --egg scons # it will fail on AppVeyor without --egg flag
+ - pip install -U wheel # needed for pip install scons to work, otherwise a flag is missing
+ - pip install scons
- if defined VS call "%VS%" %ARCH% # if defined - so we can also use mingw
before_build:
diff --git a/.gitignore b/.gitignore
index f8296ef51e..6db75f2324 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,8 @@ platform/android/java/build.gradle
platform/android/java/AndroidManifest.xml
platform/android/java/libs/*
platform/android/java/assets
+platform/android/java/.idea/*
+platform/android/java/*.iml
# General c++ generated files
*.lib
@@ -44,6 +46,7 @@ gmon.out
# QT project files
*.config
*.creator
+*.creator.*
*.files
*.includes
@@ -288,6 +291,7 @@ logo.h
TAGS
!TAGS/
tags
+*.tags
!tags/
gtags.files
GTAGS
diff --git a/.travis.yml b/.travis.yml
index 4bad241c53..8c24291328 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,15 @@
language: cpp
+# OS config, depends on actual 'os' in build matrix
dist: trusty
-
sudo: false
env:
global:
- SCONS_CACHE=$HOME/.scons_cache
- SCONS_CACHE_LIMIT=1024
- - OPTIONS="verbose=yes progress=no openmp=no gdnative_wrapper=yes"
+ - OPTIONS="verbose=yes progress=no gdnative_wrapper=yes"
+ - secure: "QLFRizqry/Y5pnEZvDlQz5S3YydQ+600u4rHEzFgUTd0heYeQaETXAQeMzp0ymuG1BkdRAl5YJoLVJgAzjwI9hrvugvoUlh2//SfpqZCHN/Q1fYbtGgNTn01R3VFEpcfYQL93I2EjrxVm0WTM4PwCvMO+hU0aWTRDvCt1Lty0kMR+RMDQOO/woqunoXh5wvFNxTJJkAmuLe0v962DJYOIwJAnqMLR0aFYjmeQJ20bc/2X5oLt+WuJDuf/lGj6WSlD6z/o/kL3YxHoUyw4A/HAZ2IX0IfNHKuay60ESWzl/NlobnePiPwHAE2pdDVu//q16fanb9VeYnBYRFse49TpFRb86Lo+Qz8nKDJqpQEIY0YKNCFqekrubqTM++Lj6QvGpykQZNxUhybmELcEsRG4PS0UMvCpebdnJD46nNB+DtO2Lgb4xXDLQwpq19z1wizq/XDQ5hz61TIIx8+i8TsgdSQKCTeWovd4HcD4CVjAD5XTLGgyRmI/zC2d+lTnKo6W9diLq/bX/Goq2QPeaTPABqv817IaJka2JyugQ7Qal/+gNTjYRRsimRCL9B2tVh+Uh8rWhTFhQL4QbP5P65HF+p8qojUzqtAhPMbZ8mxUtNukUI3liVgPgiMss96sG0nTVglFgkkAkEjIMFnqMSKnTfG812K4jIhp2jCO2Q3NeI="
cache:
directories:
@@ -18,56 +19,68 @@ matrix:
include:
- env: STATIC_CHECKS=yes
os: linux
- compiler: clang
- - env: GODOT_TARGET=x11 TOOLS=yes CACHE_NAME=${GODOT_TARGET}-gcc-tools"
+ compiler: gcc
+ addons:
+ apt:
+ sources:
+ - llvm-toolchain-trusty-5.0
+ packages:
+ - clang-format-5.0
+
+ coverity_scan:
+ project:
+ name: "godotengine/godot"
+ description: "Godot Engine Coverity scans"
+ notification_email: coverity@godotengine.org
+ build_command_prepend: ""
+ build_command: "scons p=x11 -j2 $OPTIONS"
+ branch_pattern: coverity_scan
+
+ - env: GODOT_TARGET=x11 TOOLS=yes CACHE_NAME=${GODOT_TARGET}-tools-mono-gcc EXTRA_ARGS="module_mono_enabled=yes mono_glue=no"
os: linux
compiler: gcc
- - env: GODOT_TARGET=x11 TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang"
+ addons:
+ apt:
+ sources:
+ - mono
+ packages:
+ - &linux_deps [libasound2-dev, libfreetype6-dev, libgl1-mesa-dev, libglu1-mesa-dev, libx11-dev, libxcursor-dev, libxi-dev, libxinerama-dev, libxrandr-dev]
+ - &linux_mono_deps [mono-devel, msbuild]
+
+ - env: GODOT_TARGET=x11 TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
os: linux
compiler: clang
- #- env: GODOT_TARGET=windows TOOLS=yes CACHE_NAME=${GODOT_TARGET}-gcc-tools
- # os: linux
- # compiler: gcc
- - env: GODOT_TARGET=android TOOLS=no CACHE_NAME=${GODOT_TARGET}-gcc
+ addons:
+ apt:
+ packages:
+ - *linux_deps
+
+ - env: GODOT_TARGET=android TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
os: linux
- compiler: gcc
- #- env: GODOT_TARGET=osx TOOLS=yes CACHE_NAME=${GODOT_TARGET}-clang-tools
- # os: osx
- # compiler: clang
- #- env: GODOT_TARGET=iphone TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
- # os: osx
- # compiler: clang
+ compiler: clang
+
+ - env: GODOT_TARGET=osx TOOLS=yes CACHE_NAME=${GODOT_TARGET}-tools-clang
+ os: osx
+ osx_image: xcode9.3
+ compiler: clang
-addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- - llvm-toolchain-trusty-5.0
- packages:
- - build-essential
- - scons
- - pkg-config
- - libx11-dev
- - libxcursor-dev
- - libxi-dev
- - libxinerama-dev
- - libxrandr-dev
- - libgl1-mesa-dev
- - libglu1-mesa-dev
- - libasound2-dev
- - libfreetype6-dev
+ - env: GODOT_TARGET=iphone TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
+ os: osx
+ osx_image: xcode9.3
+ compiler: clang
- # For cross-compiling to Windows.
- #- binutils-mingw-w64-i686
- #- binutils-mingw-w64-x86-64
- #- gcc-mingw-w64-i686
- #- gcc-mingw-w64-x86-64
- #- g++-mingw-w64-i686
- #- g++-mingw-w64-x86-64
- #- mingw-w64
+ - env: GODOT_TARGET=server TOOLS=yes CACHE_NAME=${GODOT_TARGET}-tools-gcc
+ os: linux
+ compiler: gcc
+ addons:
+ apt:
+ packages:
+ - *linux_deps
- # For style checks.
- - clang-format-5.0
+before_install:
+ - if [ "$STATIC_CHECKS" = "yes" ]; then
+ unset SCONS_CACHE;
+ fi
install:
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "android" ]; then
@@ -90,5 +103,5 @@ script:
- if [ "$STATIC_CHECKS" = "yes" ]; then
sh ./misc/travis/clang-format.sh;
else
- scons -j2 CC=$CC CXX=$CXX platform=$GODOT_TARGET TOOLS=$TOOLS $OPTIONS;
+ scons -j2 CC=$CC CXX=$CXX platform=$GODOT_TARGET TOOLS=$TOOLS $EXTRA_ARGS $OPTIONS;
fi
diff --git a/AUTHORS.md b/AUTHORS.md
index 752300cb5b..12494a487d 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -38,6 +38,7 @@ name is available.
Ariel Manzur (punto-)
Bastiaan Olij (BastiaanOlij)
Ben Brookshire (sheepandshepherd)
+ Benjamin (Nallebeorn)
Bernard Liebl (poke1024)
Bojidar Marinov (bojidar-bg)
Błażej Szczygieł (zaps166)
@@ -61,6 +62,7 @@ name is available.
Hubert Jarosz (Marqin)
Hugo Locurcio (Calinou)
Ian Bishop (ianb96)
+ Ibrahn Sahir (ibrahn)
Ignacio Etcheverry (neikeq)
Indah Sylvia (ISylvox)
J08nY
@@ -70,12 +72,15 @@ name is available.
Joshua Grams (JoshuaGrams)
Juan Linietsky (reduz)
Julian Murgia (StraToN)
+ Justo Delgado (mrcdk)
+ Kelly Thomas (KellyThomas)
Kostadin Damyanov (Max-Might)
Leon Krause (eska014)
Marc Gilleron (Zylann)
Marcelo Fernandez (marcelofg55)
Mariano Javier Suligoy (MarianoGnu)
Mario Schlack (hurikhan)
+ Martin Sjursen (binbitten)
Masoud BH (masoudbh3)
Matthias Hölzl (hoelzl)
Max Hilbrunner (mhilbrunner)
@@ -83,16 +88,20 @@ name is available.
Nathan Warden (NathanWarden)
Nuno Donato (nunodonato)
Ovnuniarchos
+ Pascal Richter (ShyRed)
Patrick (firefly2442)
Paul Batty (Paulb23)
+ Paul Joannon (paulloz)
Pawel Kowal (pkowal1982)
Pedro J. Estébanez (RandomShaper)
+ Pieter-Jan Briers (PJB3005)
Poommetee Ketson (Noshyaar)
Przemysław Gołąb (n-pigeon)
Ralf Hölzemer (rollenrolm)
Ramesh Ravone (RameshRavone)
Ray Koopa (RayKoopa)
Rémi Verschelde (akien-mga)
+ Roberto F. Arroyo (robfram)
Ruslan Mustakov (endragor)
Saniko (sanikoyes)
SaracenOne
@@ -104,6 +113,7 @@ name is available.
Wilhem Barbier (nounoursheureux)
Will Nations (willnationsdev)
Wilson E. Alvarez (Rubonnek)
+ Xavier Cho (mysticfall)
Yuri Roubinski (Chaosus)
Zher Huei Lee (leezh)
ZuBsPaCe
@@ -113,7 +123,7 @@ name is available.
m4nu3lf
marynate
mrezai
- rraallvv
romulox-x
+ rraallvv
sersoong
yg2f (SuperUserNameMan)
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 0000000000..30d80990a6
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1,37 @@
+# Lines starting with '#' are comments.
+# Each line is a file pattern followed by one or more owners.
+# Owners can be @users, @org/teams or emails
+
+core/* @reduz
+
+doc/* @godotengine/documentation
+
+drivers/gles2/* @karroffel
+drivers/gles3/* @reduz
+
+editor/icons/* @djrm
+
+main/* @reduz
+
+misc/* @akien-mga
+
+modules/bullet/* @AndreaCatania
+modules/enet/* @godotengine/network
+modules/gnative/* @karroffel
+modules/gdscript/* @reduz @vnen @bojidar-bg
+modules/mbedtls/* @godotengine/network
+modules/mobile_vr/* @BastiaanOlij
+modules/mono/* @neikeq
+modules/regex/* @LeeZH
+modules/upnp/* @godotengine/network
+modules/websocket/* @godotengine/network
+
+platform/javascript/* @eska014
+platform/uwp/* @vnen
+
+scene/main/* @reduz
+
+server/physics* @reduz @AndreaCatania
+server/visual* @reduz @karroffel
+
+thirdparty/* @akien-mga
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 0f421741b1..f4340719dc 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -157,7 +157,7 @@ License: OFL-1.1
Files: ./thirdparty/fonts/Hack_Regular.ttf
Comment: Hack font
-Copyright: 2017, Source Foundry Authors
+Copyright: 2018, Source Foundry Authors
2003, Bitstream Inc.
License: Expat and Bitstream Vera Fonts Copyright
@@ -218,11 +218,21 @@ Comment: WebP codec
Copyright: 2010, Google Inc.
License: BSD-3-clause
+Files: ./thirdparty/libwebsockets/
+Comment: libwebsockets
+Copyright: 2010-2017, Andy Green
+License: LGPL-2.1+SLE (libwebsockets)
+
Files: ./thirdparty/mbedtls/
Comment: Mbed TLS
Copyright: 2006-2015, ARM Limited
License: Apache-2.0
+Files: ./thirdparty/miniupnpc/
+Comment: MiniUPnPc
+Copyright: 2005-2016, Thomas Bernard
+License: BSD-3-clause
+
Files: ./thirdparty/minizip/
Comment: MiniZip
Copyright: 1998-2010, Gilles Vollant
@@ -244,6 +254,12 @@ Comment: BASE64 conversion methods
Copyright: Ari Edelkind
License: public-domain
+Files: ./thirdparty/misc/clipper.cpp
+ ./thirdparty/misc/clipper.hpp
+Comment: Clipper
+Copyright: 2010-2017, Angus Johnson
+License: BSL-1.0
+
Files: ./thirdparty/misc/curl_hostcheck.c
./thirdparty/misc/curl_hostcheck.h
Comment: curl
@@ -378,30 +394,6 @@ License: Apache-2.0
See the License for the specific language governing permissions and
limitations under the License.
-License: BSD-2-clause
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- .
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- .
- Redistributions in binary form must reproduce the above copyright notice, this
- list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution. Neither the name of the author
- nor the names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
- .
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
License: Bitstream Vera Fonts Copyright
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
trademark of Bitstream, Inc.
@@ -444,6 +436,28 @@ License: Bitstream Vera Fonts Copyright
authorization from the GNOME Foundation or Bitstream Inc., respectively. For
further information, contact: fonts at gnome dot org.
+License: BSD-2-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ .
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -472,6 +486,31 @@ License: BSD-3-clause
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+License: BSL-1.0
+ Boost Software License - Version 1.0 - August 17th, 2003
+ .
+ Permission is hereby granted, free of charge, to any person or organization
+ obtaining a copy of the software and accompanying documentation covered by
+ this license (the "Software") to use, reproduce, display, distribute,
+ execute, and transmit the Software, and to prepare derivative works of the
+ Software, and to permit third-parties to whom the Software is furnished to
+ do so, all subject to the following:
+ .
+ The copyright notices in the Software and this entire statement, including
+ the above license grant, this restriction and the following disclaimer,
+ must be included in all copies of the Software, in whole or in part, and
+ all derivative works of the Software, unless such copies or derivative
+ works are solely in the form of machine-executable object code generated by
+ a source language processor.
+ .
+ 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
License: CC-BY-3.0
Creative Commons Attribution 3.0 Unported
.
@@ -1022,6 +1061,564 @@ License: ISC
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+License: LGPL-2.1+SLE (libwebsockets)
+ Libwebsockets and included programs are provided under the terms of the GNU
+ Library General Public License (LGPL) 2.1, with the following exceptions:
+ .
+ 1) Any reference, whether in these modifications or in the GNU
+ Library General Public License 2.1, to this License, these terms, the
+ GNU Lesser Public License, GNU Library General Public License, LGPL, or
+ any similar reference shall refer to the GNU Library General Public
+ License 2.1 as modified by these paragraphs 1) through 4).
+ .
+ 2) Static linking of programs with the libwebsockets library does not
+ constitute a derivative work and does not require the author to provide
+ source code for the program, use the shared libwebsockets libraries, or
+ link their program against a user-supplied version of libwebsockets.
+ .
+ If you link the program to a modified version of libwebsockets, then the
+ changes to libwebsockets must be provided under the terms of the LGPL in
+ sections 1, 2, and 4.
+ .
+ 3) You do not have to provide a copy of the libwebsockets license with
+ programs that are linked to the libwebsockets library, nor do you have to
+ identify the libwebsockets license in your program or documentation as
+ required by section 6 of the LGPL.
+ .
+ However, programs must still identify their use of libwebsockets. The
+ following example statement can be included in user documentation to
+ satisfy this requirement:
+ .
+ "[program] is based in part on the work of the libwebsockets project
+ (https://libwebsockets.org)"
+ .
+ 4) Some sources included have their own, more liberal licenses, or options
+ to get original sources with the liberal terms.
+ .
+ Original liberal license retained
+ .
+ - lib/misc/sha-1.c - 3-clause BSD license retained, link to original
+ - win32port/zlib - ZLIB license (see zlib.h)
+ - lib/tls/mbedtls/wrapper - Apache 2.0 (only built if linked against mbedtls)
+ .
+ Relicensed to libwebsocket license
+ .
+ - lib/misc/base64-decode.c - relicensed to LGPL2.1+SLE, link to original
+ - lib/misc/daemonize.c - relicensed from Public Domain to LGPL2.1+SLE,
+ link to original Public Domain version
+ .
+ Public Domain (CC-zero) to simplify reuse
+ .
+ - test-apps/*.c
+ - test-apps/*.h
+ - minimal-examples/*
+ - lwsws/*
+ .
+ ------ end of exceptions
+ .
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+ .
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+ .
+ [This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+ .
+ Preamble
+ .
+ The licenses for most software are designed to take away your
+ freedom to share and change it. By contrast, the GNU General Public
+ Licenses are intended to guarantee your freedom to share and change
+ free software--to make sure the software is free for all its users.
+ .
+ This license, the Lesser General Public License, applies to some
+ specially designated software packages--typically libraries--of the
+ Free Software Foundation and other authors who decide to use it. You
+ can use it too, but we suggest you first think carefully about whether
+ this license or the ordinary General Public License is the better
+ strategy to use in any particular case, based on the explanations below.
+ .
+ When we speak of free software, we are referring to freedom of use,
+ not price. Our General Public Licenses are designed to make sure that
+ you have the freedom to distribute copies of free software (and charge
+ for this service if you wish); that you receive source code or can get
+ it if you want it; that you can change the software and use pieces of
+ it in new free programs; and that you are informed that you can do
+ these things.
+ .
+ To protect your rights, we need to make restrictions that forbid
+ distributors to deny you these rights or to ask you to surrender these
+ rights. These restrictions translate to certain responsibilities for
+ you if you distribute copies of the library or if you modify it.
+ .
+ For example, if you distribute copies of the library, whether gratis
+ or for a fee, you must give the recipients all the rights that we gave
+ you. You must make sure that they, too, receive or can get the source
+ code. If you link other code with the library, you must provide
+ complete object files to the recipients, so that they can relink them
+ with the library after making changes to the library and recompiling
+ it. And you must show them these terms so they know their rights.
+ .
+ We protect your rights with a two-step method: (1) we copyright the
+ library, and (2) we offer you this license, which gives you legal
+ permission to copy, distribute and/or modify the library.
+ .
+ To protect each distributor, we want to make it very clear that
+ there is no warranty for the free library. Also, if the library is
+ modified by someone else and passed on, the recipients should know
+ that what they have is not the original version, so that the original
+ author's reputation will not be affected by problems that might be
+ introduced by others.
+ .
+ Finally, software patents pose a constant threat to the existence of
+ any free program. We wish to make sure that a company cannot
+ effectively restrict the users of a free program by obtaining a
+ restrictive license from a patent holder. Therefore, we insist that
+ any patent license obtained for a version of the library must be
+ consistent with the full freedom of use specified in this license.
+ .
+ Most GNU software, including some libraries, is covered by the
+ ordinary GNU General Public License. This license, the GNU Lesser
+ General Public License, applies to certain designated libraries, and
+ is quite different from the ordinary General Public License. We use
+ this license for certain libraries in order to permit linking those
+ libraries into non-free programs.
+ .
+ When a program is linked with a library, whether statically or using
+ a shared library, the combination of the two is legally speaking a
+ combined work, a derivative of the original library. The ordinary
+ General Public License therefore permits such linking only if the
+ entire combination fits its criteria of freedom. The Lesser General
+ Public License permits more lax criteria for linking other code with
+ the library.
+ .
+ We call this license the "Lesser" General Public License because it
+ does Less to protect the user's freedom than the ordinary General
+ Public License. It also provides other free software developers Less
+ of an advantage over competing non-free programs. These disadvantages
+ are the reason we use the ordinary General Public License for many
+ libraries. However, the Lesser license provides advantages in certain
+ special circumstances.
+ .
+ For example, on rare occasions, there may be a special need to
+ encourage the widest possible use of a certain library, so that it becomes
+ a de-facto standard. To achieve this, non-free programs must be
+ allowed to use the library. A more frequent case is that a free
+ library does the same job as widely used non-free libraries. In this
+ case, there is little to gain by limiting the free library to free
+ software only, so we use the Lesser General Public License.
+ .
+ In other cases, permission to use a particular library in non-free
+ programs enables a greater number of people to use a large body of
+ free software. For example, permission to use the GNU C Library in
+ non-free programs enables many more people to use the whole GNU
+ operating system, as well as its variant, the GNU/Linux operating
+ system.
+ .
+ Although the Lesser General Public License is Less protective of the
+ users' freedom, it does ensure that the user of a program that is
+ linked with the Library has the freedom and the wherewithal to run
+ that program using a modified version of the Library.
+ .
+ The precise terms and conditions for copying, distribution and
+ modification follow. Pay close attention to the difference between a
+ "work based on the library" and a "work that uses the library". The
+ former contains code derived from the library, whereas the latter must
+ be combined with the library in order to run.
+ .
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ .
+ 0. This License Agreement applies to any software library or other
+ program which contains a notice placed by the copyright holder or
+ other authorized party saying it may be distributed under the terms of
+ this Lesser General Public License (also called "this License").
+ Each licensee is addressed as "you".
+ .
+ A "library" means a collection of software functions and/or data
+ prepared so as to be conveniently linked with application programs
+ (which use some of those functions and data) to form executables.
+ .
+ The "Library", below, refers to any such software library or work
+ which has been distributed under these terms. A "work based on the
+ Library" means either the Library or any derivative work under
+ copyright law: that is to say, a work containing the Library or a
+ portion of it, either verbatim or with modifications and/or translated
+ straightforwardly into another language. (Hereinafter, translation is
+ included without limitation in the term "modification".)
+ .
+ "Source code" for a work means the preferred form of the work for
+ making modifications to it. For a library, complete source code means
+ all the source code for all modules it contains, plus any associated
+ interface definition files, plus the scripts used to control compilation
+ and installation of the library.
+ .
+ Activities other than copying, distribution and modification are not
+ covered by this License; they are outside its scope. The act of
+ running a program using the Library is not restricted, and output from
+ such a program is covered only if its contents constitute a work based
+ on the Library (independent of the use of the Library in a tool for
+ writing it). Whether that is true depends on what the Library does
+ and what the program that uses the Library does.
+ .
+ 1. You may copy and distribute verbatim copies of the Library's
+ complete source code as you receive it, in any medium, provided that
+ you conspicuously and appropriately publish on each copy an
+ appropriate copyright notice and disclaimer of warranty; keep intact
+ all the notices that refer to this License and to the absence of any
+ warranty; and distribute a copy of this License along with the
+ Library.
+ .
+ You may charge a fee for the physical act of transferring a copy,
+ and you may at your option offer warranty protection in exchange for a
+ fee.
+ .
+ 2. You may modify your copy or copies of the Library or any portion
+ of it, thus forming a work based on the Library, and copy and
+ distribute such modifications or work under the terms of Section 1
+ above, provided that you also meet all of these conditions:
+ .
+ a) The modified work must itself be a software library.
+ .
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+ .
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+ .
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+ .
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+ .
+ These requirements apply to the modified work as a whole. If
+ identifiable sections of that work are not derived from the Library,
+ and can be reasonably considered independent and separate works in
+ themselves, then this License, and its terms, do not apply to those
+ sections when you distribute them as separate works. But when you
+ distribute the same sections as part of a whole which is a work based
+ on the Library, the distribution of the whole must be on the terms of
+ this License, whose permissions for other licensees extend to the
+ entire whole, and thus to each and every part regardless of who wrote
+ it.
+ .
+ Thus, it is not the intent of this section to claim rights or contest
+ your rights to work written entirely by you; rather, the intent is to
+ exercise the right to control the distribution of derivative or
+ collective works based on the Library.
+ .
+ In addition, mere aggregation of another work not based on the Library
+ with the Library (or with a work based on the Library) on a volume of
+ a storage or distribution medium does not bring the other work under
+ the scope of this License.
+ .
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+ License instead of this License to a given copy of the Library. To do
+ this, you must alter all the notices that refer to this License, so
+ that they refer to the ordinary GNU General Public License, version 2,
+ instead of to this License. (If a newer version than version 2 of the
+ ordinary GNU General Public License has appeared, then you can specify
+ that version instead if you wish.) Do not make any other change in
+ these notices.
+ .
+ Once this change is made in a given copy, it is irreversible for
+ that copy, so the ordinary GNU General Public License applies to all
+ subsequent copies and derivative works made from that copy.
+ .
+ This option is useful when you wish to copy part of the code of
+ the Library into a program that is not a library.
+ .
+ 4. You may copy and distribute the Library (or a portion or
+ derivative of it, under Section 2) in object code or executable form
+ under the terms of Sections 1 and 2 above provided that you accompany
+ it with the complete corresponding machine-readable source code, which
+ must be distributed under the terms of Sections 1 and 2 above on a
+ medium customarily used for software interchange.
+ .
+ If distribution of object code is made by offering access to copy
+ from a designated place, then offering equivalent access to copy the
+ source code from the same place satisfies the requirement to
+ distribute the source code, even though third parties are not
+ compelled to copy the source along with the object code.
+ .
+ 5. A program that contains no derivative of any portion of the
+ Library, but is designed to work with the Library by being compiled or
+ linked with it, is called a "work that uses the Library". Such a
+ work, in isolation, is not a derivative work of the Library, and
+ therefore falls outside the scope of this License.
+ .
+ However, linking a "work that uses the Library" with the Library
+ creates an executable that is a derivative of the Library (because it
+ contains portions of the Library), rather than a "work that uses the
+ library". The executable is therefore covered by this License.
+ Section 6 states terms for distribution of such executables.
+ .
+ When a "work that uses the Library" uses material from a header file
+ that is part of the Library, the object code for the work may be a
+ derivative work of the Library even though the source code is not.
+ Whether this is true is especially significant if the work can be
+ linked without the Library, or if the work is itself a library. The
+ threshold for this to be true is not precisely defined by law.
+ .
+ If such an object file uses only numerical parameters, data
+ structure layouts and accessors, and small macros and small inline
+ functions (ten lines or less in length), then the use of the object
+ file is unrestricted, regardless of whether it is legally a derivative
+ work. (Executables containing this object code plus portions of the
+ Library will still fall under Section 6.)
+ .
+ Otherwise, if the work is a derivative of the Library, you may
+ distribute the object code for the work under the terms of Section 6.
+ Any executables containing that work also fall under Section 6,
+ whether or not they are linked directly with the Library itself.
+ .
+ 6. As an exception to the Sections above, you may also combine or
+ link a "work that uses the Library" with the Library to produce a
+ work containing portions of the Library, and distribute that work
+ under terms of your choice, provided that the terms permit
+ modification of the work for the customer's own use and reverse
+ engineering for debugging such modifications.
+ .
+ You must give prominent notice with each copy of the work that the
+ Library is used in it and that the Library and its use are covered by
+ this License. You must supply a copy of this License. If the work
+ during execution displays copyright notices, you must include the
+ copyright notice for the Library among them, as well as a reference
+ directing the user to the copy of this License. Also, you must do one
+ of these things:
+ .
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+ .
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+ .
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+ .
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+ .
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+ .
+ For an executable, the required form of the "work that uses the
+ Library" must include any data and utility programs needed for
+ reproducing the executable from it. However, as a special exception,
+ the materials to be distributed need not include anything that is
+ normally distributed (in either source or binary form) with the major
+ components (compiler, kernel, and so on) of the operating system on
+ which the executable runs, unless that component itself accompanies
+ the executable.
+ .
+ It may happen that this requirement contradicts the license
+ restrictions of other proprietary libraries that do not normally
+ accompany the operating system. Such a contradiction means you cannot
+ use both them and the Library together in an executable that you
+ distribute.
+ .
+ 7. You may place library facilities that are a work based on the
+ Library side-by-side in a single library together with other library
+ facilities not covered by this License, and distribute such a combined
+ library, provided that the separate distribution of the work based on
+ the Library and of the other library facilities is otherwise
+ permitted, and provided that you do these two things:
+ .
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+ .
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+ .
+ 8. You may not copy, modify, sublicense, link with, or distribute
+ the Library except as expressly provided under this License. Any
+ attempt otherwise to copy, modify, sublicense, link with, or
+ distribute the Library is void, and will automatically terminate your
+ rights under this License. However, parties who have received copies,
+ or rights, from you under this License will not have their licenses
+ terminated so long as such parties remain in full compliance.
+ .
+ 9. You are not required to accept this License, since you have not
+ signed it. However, nothing else grants you permission to modify or
+ distribute the Library or its derivative works. These actions are
+ prohibited by law if you do not accept this License. Therefore, by
+ modifying or distributing the Library (or any work based on the
+ Library), you indicate your acceptance of this License to do so, and
+ all its terms and conditions for copying, distributing or modifying
+ the Library or works based on it.
+ .
+ 10. Each time you redistribute the Library (or any work based on the
+ Library), the recipient automatically receives a license from the
+ original licensor to copy, distribute, link with or modify the Library
+ subject to these terms and conditions. You may not impose any further
+ restrictions on the recipients' exercise of the rights granted herein.
+ You are not responsible for enforcing compliance by third parties with
+ this License.
+ .
+ 11. If, as a consequence of a court judgment or allegation of patent
+ infringement or for any other reason (not limited to patent issues),
+ conditions are imposed on you (whether by court order, agreement or
+ otherwise) that contradict the conditions of this License, they do not
+ excuse you from the conditions of this License. If you cannot
+ distribute so as to satisfy simultaneously your obligations under this
+ License and any other pertinent obligations, then as a consequence you
+ may not distribute the Library at all. For example, if a patent
+ license would not permit royalty-free redistribution of the Library by
+ all those who receive copies directly or indirectly through you, then
+ the only way you could satisfy both it and this License would be to
+ refrain entirely from distribution of the Library.
+ .
+ If any portion of this section is held invalid or unenforceable under any
+ particular circumstance, the balance of the section is intended to apply,
+ and the section as a whole is intended to apply in other circumstances.
+ .
+ It is not the purpose of this section to induce you to infringe any
+ patents or other property right claims or to contest validity of any
+ such claims; this section has the sole purpose of protecting the
+ integrity of the free software distribution system which is
+ implemented by public license practices. Many people have made
+ generous contributions to the wide range of software distributed
+ through that system in reliance on consistent application of that
+ system; it is up to the author/donor to decide if he or she is willing
+ to distribute software through any other system and a licensee cannot
+ impose that choice.
+ .
+ This section is intended to make thoroughly clear what is believed to
+ be a consequence of the rest of this License.
+ .
+ 12. If the distribution and/or use of the Library is restricted in
+ certain countries either by patents or by copyrighted interfaces, the
+ original copyright holder who places the Library under this License may add
+ an explicit geographical distribution limitation excluding those countries,
+ so that distribution is permitted only in or among countries not thus
+ excluded. In such case, this License incorporates the limitation as if
+ written in the body of this License.
+ .
+ 13. The Free Software Foundation may publish revised and/or new
+ versions of the Lesser General Public License from time to time.
+ Such new versions will be similar in spirit to the present version,
+ but may differ in detail to address new problems or concerns.
+ .
+ Each version is given a distinguishing version number. If the Library
+ specifies a version number of this License which applies to it and
+ "any later version", you have the option of following the terms and
+ conditions either of that version or of any later version published by
+ the Free Software Foundation. If the Library does not specify a
+ license version number, you may choose any version ever published by
+ the Free Software Foundation.
+ .
+ 14. If you wish to incorporate parts of the Library into other free
+ programs whose distribution conditions are incompatible with these,
+ write to the author to ask for permission. For software which is
+ copyrighted by the Free Software Foundation, write to the Free
+ Software Foundation; we sometimes make exceptions for this. Our
+ decision will be guided by the two goals of preserving the free status
+ of all derivatives of our free software and of promoting the sharing
+ and reuse of software generally.
+ .
+ NO WARRANTY
+ .
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+ WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+ OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+ LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+ .
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+ AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+ LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+ .
+ END OF TERMS AND CONDITIONS
+ .
+ How to Apply These Terms to Your New Libraries
+ .
+ If you develop a new library, and you want it to be of the greatest
+ possible use to the public, we recommend making it free software that
+ everyone can redistribute and change. You can do so by permitting
+ redistribution under these terms (or, alternatively, under the terms of the
+ ordinary General Public License).
+ .
+ To apply these terms, attach the following notices to the library. It is
+ safest to attach them to the start of each source file to most effectively
+ convey the exclusion of warranty; and each file should have at least the
+ "copyright" line and a pointer to where the full notice is found.
+ .
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+ .
+ 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 library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ .
+ Also add information on how to contact you by electronic and paper mail.
+ .
+ You should also get your employer (if you work as a programmer) or your
+ school, if any, to sign a "copyright disclaimer" for the library, if
+ necessary. Here is a sample; alter the names:
+ .
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+ .
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+ .
+ That's all there is to it!
+
License: MPL-2.0
Mozilla Public License Version 2.0
==================================
diff --git a/DONORS.md b/DONORS.md
index 6756b2c15a..da0f5bca75 100644
--- a/DONORS.md
+++ b/DONORS.md
@@ -18,28 +18,32 @@ generous deed immortalized in the next stable release of Godot Engine.
Gamblify <https://www.gamblify.com>
GameDev.TV <https://www.gamedev.tv>
+ Skirmish <https://skirmish.io>
## Mini sponsors
- Andreas
Brandon Lamb
Christian Uldall Pedersen
Christopher Igoe
Christoph Woinke
+ Claudiu Dumitru
E Hewert
Hein-Pieter van Braam
+ Igors Vaitkus
Jamal Alyafei
Jay Sistar
- Jordan M Lucas
Matthieu Huvé
+ Mike King
Nathan Warden
Neal Gompa (Conan Kudo)
Pascal Julien
Ruslan Mustakov
+ Sébastien Manin
Slobodan Milnovic
Stephan Lanfermann
Stoney Meyerhoeffer
Thomas Mathews
+ VilliHaukka
## Gold donors
@@ -47,164 +51,205 @@ generous deed immortalized in the next stable release of Godot Engine.
Alexander Otto
Asdf
cheese65536
- Jake Bo
+ K9Kraken
+ Kris Michael
Manuele Finocchiaro
+ Nathanael Beisiegel
Officine Pixel S.n.c.
- Rémi Verschelde
Zaven Muradyan
Allen Schade
Andreas Schüle
Austen McRae
- Benjamin Botwin
Bernhard Liebl
+ Catalin Moldovan
+ DeepSquid
+ Fidget Sinner
+ Florian Breisch
+ Gary Oberbrunner
Johannes Wuensch
Josep G. Camarasa
- Kris Michael
+ Joshua Lesperance
Libre-Dépanne
+ Matthew Bennett
+ Olafur Gislason
+ Paul LaMotte
Ranoller
Svenne Krap
Timothy Hagberg
BanjoNode2D
- Brandon
+ Beliar
Chris Serino
Conrad Curry
Craig Smith
+ Daniel Egger
David Churchill
Dean Harmon
Dexter Miguel
- Garrett Dockins
Guilherme Felipe de C. G. da Silva
- Harman Bains
- Karsten Bock
+ John
+ Justo Delgado Baudí
+ KTL
Laurence Bannister
+ Rami
Robert Willes
Robin Arys
+ Ronnie Ashlock
+ Rufus Xavier Sarsaparilla
ScottMakesGames
- Testus Maximus
Thomas Bjarnelöf
+ William Connell
+ Wojciech Chojnacki
Xavier Tan
Zaq Poi
+ Alessandra Pereyra
+ Alexey Dyadchenko
Amanda Haldy
- Andreas Haas
- Arnaud Verstuyf
Chris Brown
+ Chris Petrich
Chris Wilson
Cody Parker
+ Corey Auger
D
Daniel Eliasinski
+ E.G.
Eric Monson
- Ezra Theunissen
flesk
- François Cantin
+ G Barnes
GGGames.org
+ Giovanni Solimeno
+ Hasen Judy
Heath Hayes
+ Jay Horton
Jeppe Zapp
- Jeremi Biernacki
joe513
+ Jordan M Lucas
Juraj Móza
Justin Arnold
- Justo Delgado Baudí
Leandro Voltolino
Lisandro Lorea
Markus Wiesner
+ Marvin
+ Mohammad Taleb
Nick Nikitin
Pablo Cholaky
- Paolo Munoz
Patrick Schnorbus
Pete Goodwin
- Rami
- Ryan Estes
+ Phyronnaz
+ Ruben Soares Luis
+ Sofox
+ Stoned Xander
Ted
- Travis Womack
+ Tim Dalporto
Trent McPheron
+ Vladimir
## Silver donors
1D_Inc
Adam Carr
+ Adam Smeltzer
Alder Stefano
Alessandro Senese
Ãlvaro Domínguez López
- Andrea Badii
- Andrew Thomas
+ Anders Jensen-Urstad
Anthony Bongiovanni
Arda Erol
Arthur S. Muszynski
+ Aubrey Falconer
Avencherus
+ Bailey
Bastian Böhm
Benedikt
Benjamin Beshara
Ben Vercammen
Blair Allen
- Bryanna M
+ Brandon
Bryan Stevenson
Carwyn Edwards
Casey Foote
+ Chris Chapin
Christian Baune
Christian Winter
+ Christopher Schmitt
Collin Shooltz
- Daniel Egger
+ Daniel Delgado Corona
+ Daniel Johnson
Daniel Kaplan
- Daniel Langegger
+ DanielMaximiano
Daniel Mircea
+ David
David Cravens
David May
- Diego Moreira Guimarães
Dominik Wetzel
+ Duy Kevin Nguyen
+ Edward Herbert
Eric Martini
Fabian Becker
fengjiongmax
Francesco Lisi
- Fredy Romero Sam
G3Dev sàrl
- Geequlim
Gerrit Großkopf
+ Gerrit Procee
Gilberto K. Otubo
Guldoman
- HeartBeast
+ Gumichan01
Heribert Hirth
+ hubert jenkins
Hunter Jones
+ ialex32x
+ Ivan Vodopiviz
+ Jahn Johansen
Jaime Ruiz-Borau Vizárraga
- Jed Rose
+ Jed
Jeff Hungerford
+ Joel Fivat
+ Johan Lindberg
+ Jonas Rudlang
Jonas Yamazaki
+ Jonathan Martin
Jonathan Nieto
Jonathon
Josh 'Cheeseness' Bush
Juan Negrier
Judd
- JuDelCo
Julian Murgia
+ Justin Luk
KC Chan
Kevin Boyer
Kevin Kamper Meejach Petersen
Klavdij Voncina
+ Krzysztof Jankowski
Lars pfeffer
Linus Lind Lundgren
+ Luis Moraes
+ Macil
magodev
Martin Eigel
- Martin Novák
+ Martins Odabi
Matthew Fitzpatrick
- Matthias Hölzl
- Maurice Meysel
Max R.R. Collada
- memoryruins
+ Maxwell
mhilbrunner
Michael Dürwald
Michael Gringauz
+ Michael Labbe
+ Mikael Olsson
MoM
- monokrome
Moritz Laass
+ Natrim
nee
Neil Blakey-Milner
+ Nick Pavlica
Niclas Eriksen
- Nik Lee
+ Nicolas SAN AGUSTIN
Niko Leopold
+ nivardus
Noi Sek
Oleg Tyshchenko
+ Oleksandr Yemets
Pablo Seibelt
Pan Ip
Pat LaBine
@@ -215,20 +260,29 @@ generous deed immortalized in the next stable release of Godot Engine.
Pierre-Igor Berthet
Pietro Vertechi
Piotr Kaczmarski
+ Rea
+ Rémi Verschelde
Richman Stewart
- Rodolfo Baeza
Roger Burgess
Roger Smith
Roman Tinkov
+ Ryan Whited
+ Samuel El-Borai
Sasori Olkof
- Scott D. Yelich
Sootstone
- Stephen Traskal
+ Stefan Butucea
Theo Cranmore
+ Thibault Barbaroux
Thomas Bell
- Thomas Herzog & Xananax
+ Thomas Kurz
+ Tomasz Wacławek
Tom Larrow
+ Tyler Stafos
UltyX
+ Victor
+ Victor Gonzalez Fernandez
+ Viktor Ferenczi
+ werner mendizabal
Wout Standaert
Yu He
diff --git a/README.md b/README.md
index 6bb07a8c44..8ad738c23d 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Before being open sourced in February 2014, Godot had been developed by Juan
Linietsky and Ariel Manzur (both still maintaining the project) for several
years as an in-house engine, used to publish several work-for-hire titles.
-![Screenshot of a 3D scene in Godot Engine](http://download.tuxfamily.org/godotengine/media/screenshots/editor_3d_fracteed.jpg)
+![Screenshot of a 3D scene in Godot Engine](https://download.tuxfamily.org/godotengine/media/screenshots/editor_3d_fracteed.jpg)
### Getting the engine
diff --git a/SConstruct b/SConstruct
index c320513786..7ef4d646a7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2,7 +2,6 @@
EnsureSConsVersion(0, 98, 1)
-
import string
import os
import os.path
@@ -10,9 +9,6 @@ import glob
import sys
import methods
-# moved below to compensate with module version string
-# methods.update_version()
-
# scan possible build platforms
platform_list = [] # list of platforms
@@ -53,20 +49,17 @@ for x in glob.glob("platform/*"):
module_list = methods.detect_modules()
-
-# print "Detected Platforms: "+str(platform_list)
-
methods.save_active_platforms(active_platforms, active_platform_ids)
custom_tools = ['default']
platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
-if (os.name == "posix"):
- pass
-elif (os.name == "nt"):
- if (os.getenv("VCINSTALLDIR") == None or platform_arg == "android" or platform_arg == "javascript"):
- custom_tools = ['mingw']
+if os.name == "nt" and (platform_arg == "android" or ARGUMENTS.get("use_mingw", False)):
+ custom_tools = ['mingw']
+elif platform_arg == 'javascript':
+ # Use generic POSIX build toolchain for Emscripten.
+ custom_tools = ['cc', 'c++', 'ar', 'link', 'textfile', 'zip']
env_base = Environment(tools=custom_tools)
if 'TERM' in os.environ:
@@ -92,6 +85,7 @@ env_base.use_ptrcall = False
env_base.split_drivers = False
env_base.split_modules = False
env_base.module_version_string = ""
+env_base.msvc = False
# To decide whether to rebuild a file, use the MD5 sum only if the timestamp has changed.
# http://scons.org/doc/production/HTML/scons-user/ch06.html#idm139837621851792
@@ -100,7 +94,6 @@ env_base.Decider('MD5-timestamp')
# http://scons.org/doc/production/HTML/scons-user/ch06s04.html
env_base.SetOption('implicit_cache', 1)
-
env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository
env_base.__class__.android_add_flat_dir = methods.android_add_flat_dir
env_base.__class__.android_add_dependency = methods.android_add_dependency
@@ -125,6 +118,7 @@ env_base.__class__.split_lib = methods.split_lib
env_base.__class__.add_shared_library = methods.add_shared_library
env_base.__class__.add_library = methods.add_library
env_base.__class__.add_program = methods.add_program
+env_base.__class__.CommandNoCache = methods.CommandNoCache
env_base["x86_libtheora_opt_gcc"] = False
env_base["x86_libtheora_opt_vc"] = False
@@ -144,52 +138,53 @@ if profile:
opts = Variables(customs, ARGUMENTS)
# Target build options
-opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/etc)", '')
+opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", '')
opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32', '64')))
opts.Add('p', "Platform (alias for 'platform')", '')
opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release')))
-opts.Add(BoolVariable('tools', "Build the tools a.k.a. the Godot editor", True))
-opts.Add(BoolVariable('use_lto', 'Use linking time optimization', False))
+opts.Add(BoolVariable('tools', "Build the tools (a.k.a. the Godot editor)", True))
+opts.Add(BoolVariable('use_lto', 'Use link-time optimization', False))
# Components
opts.Add(BoolVariable('deprecated', "Enable deprecated features", True))
-opts.Add(BoolVariable('gdscript', "Build GDSCript support", True))
-opts.Add(BoolVariable('minizip', "Build minizip archive support", True))
-opts.Add(BoolVariable('xaudio2', "XAudio2 audio driver", False))
-opts.Add(BoolVariable('xml', "XML format support for resources", True))
+opts.Add(BoolVariable('gdscript', "Enable GDScript support", True))
+opts.Add(BoolVariable('minizip', "Enable ZIP archive support using minizip", True))
+opts.Add(BoolVariable('xaudio2', "Enable the XAudio2 audio driver", False))
+opts.Add(BoolVariable('xml', "Enable XML format support for resources", True))
# Advanced options
-opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for smaller executable", False))
-opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced 3D gui nodes and behaviors", False))
+opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False))
+opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced 3D GUI nodes and behaviors", False))
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
-opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False))
-opts.Add(BoolVariable('vsproj', "Generate Visual Studio Project", False))
+opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False))
opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no')))
-opts.Add(BoolVariable('progress', "Show a progress indicator during build", True))
+opts.Add(BoolVariable('progress', "Show a progress indicator during compilation", True))
opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
-opts.Add(EnumVariable('macports_clang', "Build using clang from MacPorts", 'no', ('no', '5.0', 'devel')))
+opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel')))
+opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
# Thirdparty libraries
-opts.Add(BoolVariable('builtin_bullet', "Use the builtin bullet library", True))
-opts.Add(BoolVariable('builtin_enet', "Use the builtin enet library", True))
-opts.Add(BoolVariable('builtin_freetype', "Use the builtin freetype library", True))
-opts.Add(BoolVariable('builtin_libogg', "Use the builtin libogg library", True))
-opts.Add(BoolVariable('builtin_libpng', "Use the builtin libpng library", True))
-opts.Add(BoolVariable('builtin_libtheora', "Use the builtin libtheora library", True))
-opts.Add(BoolVariable('builtin_libvorbis', "Use the builtin libvorbis library", True))
-opts.Add(BoolVariable('builtin_libvpx', "Use the builtin libvpx library", True))
-opts.Add(BoolVariable('builtin_libwebp', "Use the builtin libwebp library", True))
-opts.Add(BoolVariable('builtin_mbedtls', "Use the builtin mbedTLS library", True))
-opts.Add(BoolVariable('builtin_opus', "Use the builtin opus library", True))
-opts.Add(BoolVariable('builtin_pcre2', "Use the builtin pcre2 library)", True))
-opts.Add(BoolVariable('builtin_recast', "Use the builtin recast library", True))
-opts.Add(BoolVariable('builtin_squish', "Use the builtin squish library", True))
-opts.Add(BoolVariable('builtin_thekla_atlas', "Use the builtin thekla_altas library", True))
-opts.Add(BoolVariable('builtin_zlib', "Use the builtin zlib library", True))
-opts.Add(BoolVariable('builtin_zstd', "Use the builtin zstd library", True))
-opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
+opts.Add(BoolVariable('builtin_bullet', "Use the built-in Bullet library", True))
+opts.Add(BoolVariable('builtin_enet', "Use the built-in ENet library", True))
+opts.Add(BoolVariable('builtin_freetype', "Use the built-in FreeType library", True))
+opts.Add(BoolVariable('builtin_libogg', "Use the built-in libogg library", True))
+opts.Add(BoolVariable('builtin_libpng', "Use the built-in libpng library", True))
+opts.Add(BoolVariable('builtin_libtheora', "Use the built-in libtheora library", True))
+opts.Add(BoolVariable('builtin_libvorbis', "Use the built-in libvorbis library", True))
+opts.Add(BoolVariable('builtin_libvpx', "Use the built-in libvpx library", True))
+opts.Add(BoolVariable('builtin_libwebp', "Use the built-in libwebp library", True))
+opts.Add(BoolVariable('builtin_libwebsockets', "Use the built-in libwebsockets library", True))
+opts.Add(BoolVariable('builtin_mbedtls', "Use the built-in mbedTLS library", True))
+opts.Add(BoolVariable('builtin_miniupnpc', "Use the built-in miniupnpc library", True))
+opts.Add(BoolVariable('builtin_opus', "Use the built-in Opus library", True))
+opts.Add(BoolVariable('builtin_pcre2', "Use the built-in PCRE2 library)", True))
+opts.Add(BoolVariable('builtin_recast', "Use the built-in Recast library", True))
+opts.Add(BoolVariable('builtin_squish', "Use the built-in squish library", True))
+opts.Add(BoolVariable('builtin_thekla_atlas', "Use the built-in thekla_altas library", True))
+opts.Add(BoolVariable('builtin_zlib', "Use the built-in zlib library", True))
+opts.Add(BoolVariable('builtin_zstd', "Use the built-in Zstd library", True))
# Compilation environment setup
opts.Add("CXX", "C++ compiler")
@@ -200,7 +195,6 @@ opts.Add("CXXFLAGS", "Custom flags for the C++ compiler")
opts.Add("CFLAGS", "Custom flags for the C compiler")
opts.Add("LINKFLAGS", "Custom flags for the linker")
-
# add platform specific options
for k in platform_opts.keys():
@@ -231,27 +225,17 @@ env_base.Append(CPPPATH=['#core', '#core/math', '#editor', '#drivers', '#'])
env_base.platform_exporters = platform_exporters
env_base.platform_apis = platform_apis
-"""
-sys.path.append("./platform/"+env_base["platform"])
-import detect
-detect.configure(env_base)
-sys.path.remove("./platform/"+env_base["platform"])
-sys.modules.pop('detect')
-"""
-
if (env_base['target'] == 'debug'):
- env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
- env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
+ env_base.Append(CPPDEFINES=['DEBUG_MEMORY_ALLOC', 'SCI_NAMESPACE'])
if (env_base['no_editor_splash']):
- env_base.Append(CPPFLAGS=['-DNO_EDITOR_SPLASH'])
+ env_base.Append(CPPDEFINES=['NO_EDITOR_SPLASH'])
if not env_base['deprecated']:
- env_base.Append(CPPFLAGS=['-DDISABLE_DEPRECATED'])
+ env_base.Append(CPPDEFINES=['DISABLE_DEPRECATED'])
env_base.platforms = {}
-
selected_platform = ""
if env_base['platform'] != "":
@@ -260,7 +244,6 @@ elif env_base['p'] != "":
selected_platform = env_base['p']
env_base["platform"] = selected_platform
-
if selected_platform in platform_list:
sys.path.append("./platform/" + selected_platform)
@@ -329,9 +312,7 @@ if selected_platform in platform_list:
if (env["warnings"] == 'yes'):
print("WARNING: warnings=yes is deprecated; assuming warnings=all")
- env.msvc = 0
- if (os.name == "nt" and os.getenv("VCINSTALLDIR") and (platform_arg == "windows" or platform_arg == "uwp")): # MSVC, needs to stand out of course
- env.msvc = 1
+ if env.msvc:
disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions...
if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['/Wall']) # Implies /W4
@@ -355,8 +336,6 @@ if selected_platform in platform_list:
env.Append(CCFLAGS=['-w'])
env.Append(CCFLAGS=['-Werror=return-type'])
- #env['platform_libsuffix'] = env['LIBSUFFIX']
-
suffix = "." + selected_platform
if (env["target"] == "release"):
@@ -364,7 +343,7 @@ if selected_platform in platform_list:
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix += ".opt"
- env.Append(CCFLAGS=['-DNDEBUG'])
+ env.Append(CPPDEFINES=['NDEBUG'])
elif (env["target"] == "release_debug"):
if env["tools"]:
@@ -399,7 +378,17 @@ if selected_platform in platform_list:
sys.path.append(tmppath)
env.current_module = x
import config
- if (config.can_build(selected_platform)):
+ # can_build changed number of arguments between 3.0 (1) and 3.1 (2),
+ # so try both to preserve compatibility for 3.0 modules
+ can_build = False
+ try:
+ can_build = config.can_build(env, selected_platform)
+ except TypeError:
+ print("Warning: module '%s' uses a deprecated `can_build` "
+ "signature in its config.py file, it should be "
+ "`can_build(env, platform)`." % x)
+ can_build = config.can_build(selected_platform)
+ if (can_build):
config.configure(env)
env.module_list.append(x)
try:
@@ -421,31 +410,26 @@ if selected_platform in platform_list:
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
if (env.use_ptrcall):
- env.Append(CPPFLAGS=['-DPTRCALL_ENABLED'])
-
- # to test 64 bits compiltion
- # env.Append(CPPFLAGS=['-m64'])
-
+ env.Append(CPPDEFINES=['PTRCALL_ENABLED'])
if env['tools']:
- env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
+ env.Append(CPPDEFINES=['TOOLS_ENABLED'])
if env['disable_3d']:
- env.Append(CPPFLAGS=['-D_3D_DISABLED'])
+ env.Append(CPPDEFINES=['_3D_DISABLED'])
if env['gdscript']:
- env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
+ env.Append(CPPDEFINES=['GDSCRIPT_ENABLED'])
if env['disable_advanced_gui']:
- env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
-
+ env.Append(CPPDEFINES=['ADVANCED_GUI_DISABLED'])
if env['minizip']:
- env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
-
+ env.Append(CPPDEFINES=['MINIZIP_ENABLED'])
if env['xml']:
- env.Append(CPPFLAGS=['-DXML_ENABLED'])
+ env.Append(CPPDEFINES=['XML_ENABLED'])
if not env['verbose']:
methods.no_verbose(sys, env)
if (not env["platform"] == "server"): # FIXME: detect GLES3
- env.Append( BUILDERS = { 'GLES3_GLSL' : env.Builder(action = methods.build_gles3_headers, suffix = 'glsl.gen.h',src_suffix = '.glsl') } )
+ env.Append( BUILDERS = { 'GLES3_GLSL' : env.Builder(action = methods.build_gles3_headers, suffix = 'glsl.gen.h', src_suffix = '.glsl') } )
+ env.Append( BUILDERS = { 'GLES2_GLSL' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.gen.h', src_suffix = '.glsl') } )
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
@@ -479,141 +463,128 @@ if selected_platform in platform_list:
if ("check_c_headers" in env):
for header in env["check_c_headers"]:
if (conf.CheckCHeader(header[0])):
- if (env.msvc):
- env.Append(CCFLAGS=['/D' + header[1]])
- else:
- env.Append(CCFLAGS=['-D' + header[1]])
+ env.AppendUnique(CPPDEFINES=[header[1]])
else:
print("No valid target platform selected.")
- print("The following were detected:")
+ print("The following platforms were detected:")
for x in platform_list:
print("\t" + x)
- print("\nPlease run scons again with argument: platform=<string>")
+ print("\nPlease run SCons again with the argument: platform=<string>")
+
+# The following only makes sense when the env is defined, and assumes it is
+if 'env' in locals():
+ screen = sys.stdout
+ # Progress reporting is not available in non-TTY environments since it
+ # messes with the output (for example, when writing to a file)
+ show_progress = (env['progress'] and sys.stdout.isatty())
+ node_count = 0
+ node_count_max = 0
+ node_count_interval = 1
+ node_count_fname = str(env.Dir('#')) + '/.scons_node_count'
+ import time, math
-screen = sys.stdout
-node_count = 0
-node_count_max = 0
-node_count_interval = 1
-node_pruning = 8 # Number of nodes to process before prunning the cache
-if ('env' in locals()):
- node_count_fname = str(env.Dir('#')) + '/.scons_node_count'
-# Progress reporting is not available in non-TTY environments since it
-# messes with the output (for example, when writing to a file)
-if sys.stdout.isatty():
- show_progress = env['progress']
-else:
- show_progress = False
-
-import time, math
-
-class cache_progress:
- # The default is 1 GB cache and 12 hours half life
- def __init__(self, path = None, limit = 1073741824, half_life = 43200):
- global node_pruning
- self.path = path
- self.limit = limit
- self.exponent_scale = math.log(2) / half_life
- if env['verbose'] and path != None:
- screen.write('Current cache limit is ' + self.convert_size(limit) + ' (used: ' + self.convert_size(self.get_size(path)) + ')\n')
- self.pruning = node_pruning
- self.delete(self.file_list())
-
- def __call__(self, node, *args, **kw):
- global node_count, node_count_max, node_count_interval, node_count_fname, node_pruning, show_progress
- if show_progress:
- # Print the progress percentage
- node_count += node_count_interval
- if (node_count_max > 0 and node_count <= node_count_max):
- screen.write('\r[%3d%%] ' % (node_count * 100 / node_count_max))
- screen.flush()
- elif (node_count_max > 0 and node_count > node_count_max):
- screen.write('\r[100%] ')
- screen.flush()
- else:
- screen.write('\r[Initial build] ')
- screen.flush()
- # Prune if the number of nodes processed is 'node_pruning' or bigger
- self.pruning -= node_count_interval
- if self.pruning <= 0:
- self.pruning = node_pruning
+ class cache_progress:
+ # The default is 1 GB cache and 12 hours half life
+ def __init__(self, path = None, limit = 1073741824, half_life = 43200):
+ self.path = path
+ self.limit = limit
+ self.exponent_scale = math.log(2) / half_life
+ if env['verbose'] and path != None:
+ screen.write('Current cache limit is ' + self.convert_size(limit) + ' (used: ' + self.convert_size(self.get_size(path)) + ')\n')
self.delete(self.file_list())
- def delete(self, files):
- if len(files) == 0:
- return
- if env['verbose']:
- # Utter something
- screen.write('\rPurging %d %s from cache...\n' % (len(files), len(files) > 1 and 'files' or 'file'))
- map(os.remove, files)
-
- def file_list(self):
- if self.path == None:
- # Nothing to do
- return []
- # Gather a list of (filename, (size, atime)) within the
- # cache directory
- file_stat = [(x, os.stat(x)[6:8]) for x in glob.glob(os.path.join(self.path, '*', '*'))]
- if file_stat == []:
- # Nothing to do
- return []
- # Weight the cache files by size (assumed to be roughly
- # proportional to the recompilation time) times an exponential
- # decay since the ctime, and return a list with the entries
- # (filename, size, weight).
- current_time = time.time()
- file_stat = [(x[0], x[1][0], (current_time - x[1][1])) for x in file_stat]
- # Sort by the most resently accessed files (most sensible to keep) first
- file_stat.sort(key=lambda x: x[2])
- # Search for the first entry where the storage limit is
- # reached
- sum, mark = 0, None
- for i,x in enumerate(file_stat):
- sum += x[1]
- if sum > self.limit:
- mark = i
- break
- if mark == None:
- return []
- else:
- return [x[0] for x in file_stat[mark:]]
-
- def convert_size(self, size_bytes):
- if size_bytes == 0:
- return "0 bytes"
- size_name = ("bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
- i = int(math.floor(math.log(size_bytes, 1024)))
- p = math.pow(1024, i)
- s = round(size_bytes / p, 2)
- return "%s %s" % (int(s) if i == 0 else s, size_name[i])
-
- def get_size(self, start_path = '.'):
- total_size = 0
- for dirpath, dirnames, filenames in os.walk(start_path):
- for f in filenames:
- fp = os.path.join(dirpath, f)
- total_size += os.path.getsize(fp)
- return total_size
-
-def progress_finish(target, source, env):
- global node_count, progressor
- with open(node_count_fname, 'w') as f:
- f.write('%d\n' % node_count)
- progressor.delete(progressor.file_list())
-
-try:
- with open(node_count_fname) as f:
- node_count_max = int(f.readline())
-except:
- pass
-cache_directory = os.environ.get("SCONS_CACHE")
-# Simple cache pruning, attached to SCons' progress callback. Trim the
-# cache directory to a size not larger than cache_limit.
-cache_limit = float(os.getenv("SCONS_CACHE_LIMIT", 1024)) * 1024 * 1024
-progressor = cache_progress(cache_directory, cache_limit)
-Progress(progressor, interval = node_count_interval)
-
-progress_finish_command = Command('progress_finish', [], progress_finish)
-AlwaysBuild(progress_finish_command)
+ def __call__(self, node, *args, **kw):
+ global node_count, node_count_max, node_count_interval, node_count_fname, show_progress
+ if show_progress:
+ # Print the progress percentage
+ node_count += node_count_interval
+ if (node_count_max > 0 and node_count <= node_count_max):
+ screen.write('\r[%3d%%] ' % (node_count * 100 / node_count_max))
+ screen.flush()
+ elif (node_count_max > 0 and node_count > node_count_max):
+ screen.write('\r[100%] ')
+ screen.flush()
+ else:
+ screen.write('\r[Initial build] ')
+ screen.flush()
+
+ def delete(self, files):
+ if len(files) == 0:
+ return
+ if env['verbose']:
+ # Utter something
+ screen.write('\rPurging %d %s from cache...\n' % (len(files), len(files) > 1 and 'files' or 'file'))
+ [os.remove(f) for f in files]
+
+ def file_list(self):
+ if self.path == None:
+ # Nothing to do
+ return []
+ # Gather a list of (filename, (size, atime)) within the
+ # cache directory
+ file_stat = [(x, os.stat(x)[6:8]) for x in glob.glob(os.path.join(self.path, '*', '*'))]
+ if file_stat == []:
+ # Nothing to do
+ return []
+ # Weight the cache files by size (assumed to be roughly
+ # proportional to the recompilation time) times an exponential
+ # decay since the ctime, and return a list with the entries
+ # (filename, size, weight).
+ current_time = time.time()
+ file_stat = [(x[0], x[1][0], (current_time - x[1][1])) for x in file_stat]
+ # Sort by the most resently accessed files (most sensible to keep) first
+ file_stat.sort(key=lambda x: x[2])
+ # Search for the first entry where the storage limit is
+ # reached
+ sum, mark = 0, None
+ for i,x in enumerate(file_stat):
+ sum += x[1]
+ if sum > self.limit:
+ mark = i
+ break
+ if mark == None:
+ return []
+ else:
+ return [x[0] for x in file_stat[mark:]]
+
+ def convert_size(self, size_bytes):
+ if size_bytes == 0:
+ return "0 bytes"
+ size_name = ("bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
+ i = int(math.floor(math.log(size_bytes, 1024)))
+ p = math.pow(1024, i)
+ s = round(size_bytes / p, 2)
+ return "%s %s" % (int(s) if i == 0 else s, size_name[i])
+
+ def get_size(self, start_path = '.'):
+ total_size = 0
+ for dirpath, dirnames, filenames in os.walk(start_path):
+ for f in filenames:
+ fp = os.path.join(dirpath, f)
+ total_size += os.path.getsize(fp)
+ return total_size
+
+ def progress_finish(target, source, env):
+ global node_count, progressor
+ with open(node_count_fname, 'w') as f:
+ f.write('%d\n' % node_count)
+ progressor.delete(progressor.file_list())
+
+ try:
+ with open(node_count_fname) as f:
+ node_count_max = int(f.readline())
+ except:
+ pass
+
+ cache_directory = os.environ.get("SCONS_CACHE")
+ # Simple cache pruning, attached to SCons' progress callback. Trim the
+ # cache directory to a size not larger than cache_limit.
+ cache_limit = float(os.getenv("SCONS_CACHE_LIMIT", 1024)) * 1024 * 1024
+ progressor = cache_progress(cache_directory, cache_limit)
+ Progress(progressor, interval = node_count_interval)
+
+ progress_finish_command = Command('progress_finish', [], progress_finish)
+ AlwaysBuild(progress_finish_command)
diff --git a/compat.py b/compat.py
index 32c685f5b8..de99eef9c2 100644
--- a/compat.py
+++ b/compat.py
@@ -16,6 +16,8 @@ if sys.version_info < (3,):
return x
def iteritems(d):
return d.iteritems()
+ def itervalues(d):
+ return d.itervalues()
def escape_string(s):
if isinstance(s, unicode):
s = s.encode('ascii')
@@ -44,6 +46,8 @@ else:
return codecs.utf_8_decode(x)[0]
def iteritems(d):
return iter(d.items())
+ def itervalues(d):
+ return iter(d.values())
def charcode_to_c_escapes(c):
rev_result = []
while c >= 256:
diff --git a/core/SCsub b/core/SCsub
index af83b49fea..c508ecc37e 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -2,6 +2,8 @@
Import('env')
+import methods
+
env.core_sources = []
@@ -18,9 +20,8 @@ gd_cpp = '#include "project_settings.h"\n'
gd_cpp += gd_inc
gd_cpp += "void ProjectSettings::register_global_defaults() {\n" + gd_call + "\n}\n"
-f = open("global_defaults.gen.cpp", "w")
-f.write(gd_cpp)
-f.close()
+with open("global_defaults.gen.cpp", "w") as f:
+ f.write(gd_cpp)
# Generate AES256 script encryption key
@@ -47,9 +48,8 @@ if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
txt = "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"
print("Invalid AES256 encryption key, not 64 bits hex: " + e)
-f = open("script_encryption_key.gen.cpp", "w")
-f.write("#include \"project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
-f.close()
+with open("script_encryption_key.gen.cpp", "w") as f:
+ f.write("#include \"project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
# Add required thirdparty code. Header paths are hardcoded, we don't need to append
@@ -68,7 +68,6 @@ thirdparty_sources = [
"md5.cpp",
"pcg.cpp",
"triangulator.cpp",
- "clipper.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.core_sources, thirdparty_sources)
@@ -94,8 +93,19 @@ env.add_source_files(env.core_sources, "*.cpp")
# Make binders
import make_binders
-env.Command(['method_bind.gen.inc', 'method_bind_ext.gen.inc'], 'make_binders.py', make_binders.run)
+env.CommandNoCache(['method_bind.gen.inc', 'method_bind_ext.gen.inc'], 'make_binders.py', make_binders.run)
+
+# Authors
+env.Depends('#core/authors.gen.h', "../AUTHORS.md")
+env.CommandNoCache('#core/authors.gen.h', "../AUTHORS.md", methods.make_authors_header)
+
+# Donors
+env.Depends('#core/donors.gen.h', "../DONORS.md")
+env.CommandNoCache('#core/donors.gen.h', "../DONORS.md", methods.make_donors_header)
+# License
+env.Depends('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"])
+env.CommandNoCache('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], methods.make_license_header)
# Chain load SCsubs
SConscript('os/SCsub')
diff --git a/core/array.cpp b/core/array.cpp
index 0ddac1662c..9e3250fd47 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -35,8 +35,8 @@
#include "variant.h"
#include "vector.h"
-struct ArrayPrivate {
-
+class ArrayPrivate {
+public:
SafeRefCount refcount;
Vector<Variant> array;
};
@@ -211,13 +211,13 @@ const Variant &Array::get(int p_idx) const {
return operator[](p_idx);
}
-Array Array::duplicate() const {
+Array Array::duplicate(bool p_deep) const {
Array new_arr;
int element_count = size();
new_arr.resize(element_count);
for (int i = 0; i < element_count; i++) {
- new_arr[i] = get(i);
+ new_arr[i] = p_deep ? get(i).duplicate(p_deep) : get(i);
}
return new_arr;
diff --git a/core/array.h b/core/array.h
index 684a8e265d..e549a886e6 100644
--- a/core/array.h
+++ b/core/array.h
@@ -88,7 +88,7 @@ public:
Variant pop_back();
Variant pop_front();
- Array duplicate() const;
+ Array duplicate(bool p_deep = false) const;
Array(const Array &p_from);
Array();
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index b57b24ee7d..7a14e85f20 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -205,6 +205,22 @@ String _OS::get_clipboard() const {
return OS::get_singleton()->get_clipboard();
}
+int _OS::get_video_driver_count() const {
+ return OS::get_singleton()->get_video_driver_count();
+}
+
+String _OS::get_video_driver_name(int p_driver) const {
+ return OS::get_singleton()->get_video_driver_name(p_driver);
+}
+
+int _OS::get_audio_driver_count() const {
+ return OS::get_singleton()->get_audio_driver_count();
+}
+
+String _OS::get_audio_driver_name(int p_driver) const {
+ return OS::get_singleton()->get_audio_driver_name(p_driver);
+}
+
void _OS::set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen) {
OS::VideoMode vm;
@@ -272,6 +288,10 @@ void _OS::set_window_size(const Size2 &p_size) {
OS::get_singleton()->set_window_size(p_size);
}
+Rect2 _OS::get_window_safe_area() const {
+ return OS::get_singleton()->get_window_safe_area();
+}
+
void _OS::set_window_fullscreen(bool p_enabled) {
OS::get_singleton()->set_window_fullscreen(p_enabled);
}
@@ -316,10 +336,23 @@ void _OS::set_borderless_window(bool p_borderless) {
OS::get_singleton()->set_borderless_window(p_borderless);
}
+bool _OS::get_window_per_pixel_transparency_enabled() const {
+ return OS::get_singleton()->get_window_per_pixel_transparency_enabled();
+}
+
+void _OS::set_window_per_pixel_transparency_enabled(bool p_enabled) {
+ OS::get_singleton()->set_window_per_pixel_transparency_enabled(p_enabled);
+}
+
bool _OS::get_borderless_window() const {
return OS::get_singleton()->get_borderless_window();
}
+void _OS::set_ime_active(const bool p_active) {
+
+ return OS::get_singleton()->set_ime_active(p_active);
+}
+
void _OS::set_ime_position(const Point2 &p_pos) {
return OS::get_singleton()->set_ime_position(p_pos);
@@ -371,7 +404,7 @@ Error _OS::shell_open(String p_uri) {
int _OS::execute(const String &p_path, const Vector<String> &p_arguments, bool p_blocking, Array p_output) {
- OS::ProcessID pid;
+ OS::ProcessID pid = -2;
List<String> args;
for (int i = 0; i < p_arguments.size(); i++)
args.push_back(p_arguments[i]);
@@ -384,6 +417,7 @@ int _OS::execute(const String &p_path, const Vector<String> &p_arguments, bool p
else
return pid;
}
+
Error _OS::kill(int p_pid) {
return OS::get_singleton()->kill(p_pid);
@@ -619,8 +653,8 @@ uint64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
unsigned int second = ((datetime.has(SECOND_KEY)) ? static_cast<unsigned int>(datetime[SECOND_KEY]) : 0);
unsigned int minute = ((datetime.has(MINUTE_KEY)) ? static_cast<unsigned int>(datetime[MINUTE_KEY]) : 0);
unsigned int hour = ((datetime.has(HOUR_KEY)) ? static_cast<unsigned int>(datetime[HOUR_KEY]) : 0);
- unsigned int day = ((datetime.has(DAY_KEY)) ? static_cast<unsigned int>(datetime[DAY_KEY]) : 0);
- unsigned int month = ((datetime.has(MONTH_KEY)) ? static_cast<unsigned int>(datetime[MONTH_KEY]) - 1 : 0);
+ unsigned int day = ((datetime.has(DAY_KEY)) ? static_cast<unsigned int>(datetime[DAY_KEY]) : 1);
+ unsigned int month = ((datetime.has(MONTH_KEY)) ? static_cast<unsigned int>(datetime[MONTH_KEY]) : 1);
unsigned int year = ((datetime.has(YEAR_KEY)) ? static_cast<unsigned int>(datetime[YEAR_KEY]) : 0);
/// How many days come before each month (0-12)
@@ -640,15 +674,15 @@ uint64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
ERR_EXPLAIN("Invalid hour value of: " + itos(hour));
ERR_FAIL_COND_V(hour > 23, 0);
- ERR_EXPLAIN("Invalid month value of: " + itos(month + 1));
- ERR_FAIL_COND_V(month + 1 > 12, 0);
+ ERR_EXPLAIN("Invalid month value of: " + itos(month));
+ ERR_FAIL_COND_V(month > 12 || month == 0, 0);
// Do this check after month is tested as valid
- ERR_EXPLAIN("Invalid day value of: " + itos(day) + " which is larger than " + itos(MONTH_DAYS_TABLE[LEAPYEAR(year)][month]));
- ERR_FAIL_COND_V(day > MONTH_DAYS_TABLE[LEAPYEAR(year)][month], 0);
+ ERR_EXPLAIN("Invalid day value of: " + itos(day) + " which is larger than " + itos(MONTH_DAYS_TABLE[LEAPYEAR(year)][month - 1]) + " or 0");
+ ERR_FAIL_COND_V(day > MONTH_DAYS_TABLE[LEAPYEAR(year)][month - 1] || day == 0, 0);
// Calculate all the seconds from months past in this year
- uint64_t SECONDS_FROM_MONTHS_PAST_THIS_YEAR = DAYS_PAST_THIS_YEAR_TABLE[LEAPYEAR(year)][month] * SECONDS_PER_DAY;
+ uint64_t SECONDS_FROM_MONTHS_PAST_THIS_YEAR = DAYS_PAST_THIS_YEAR_TABLE[LEAPYEAR(year)][month - 1] * SECONDS_PER_DAY;
uint64_t SECONDS_FROM_YEARS_PAST = 0;
for (unsigned int iyear = EPOCH_YR; iyear < year; iyear++) {
@@ -765,6 +799,11 @@ uint32_t _OS::get_ticks_msec() const {
return OS::get_singleton()->get_ticks_msec();
}
+uint64_t _OS::get_ticks_usec() const {
+
+ return OS::get_singleton()->get_ticks_usec();
+}
+
uint32_t _OS::get_splash_tick_msec() const {
return OS::get_singleton()->get_splash_tick_msec();
@@ -1015,6 +1054,11 @@ void _OS::_bind_methods() {
//ClassDB::bind_method(D_METHOD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0));
//ClassDB::bind_method(D_METHOD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("get_video_driver_count"), &_OS::get_video_driver_count);
+ ClassDB::bind_method(D_METHOD("get_video_driver_name", "driver"), &_OS::get_video_driver_name);
+ ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count);
+ ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name);
+
ClassDB::bind_method(D_METHOD("get_screen_count"), &_OS::get_screen_count);
ClassDB::bind_method(D_METHOD("get_current_screen"), &_OS::get_current_screen);
ClassDB::bind_method(D_METHOD("set_current_screen", "screen"), &_OS::set_current_screen);
@@ -1025,6 +1069,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_window_position", "position"), &_OS::set_window_position);
ClassDB::bind_method(D_METHOD("get_window_size"), &_OS::get_window_size);
ClassDB::bind_method(D_METHOD("set_window_size", "size"), &_OS::set_window_size);
+ ClassDB::bind_method(D_METHOD("get_window_safe_area"), &_OS::get_window_safe_area);
ClassDB::bind_method(D_METHOD("set_window_fullscreen", "enabled"), &_OS::set_window_fullscreen);
ClassDB::bind_method(D_METHOD("is_window_fullscreen"), &_OS::is_window_fullscreen);
ClassDB::bind_method(D_METHOD("set_window_resizable", "enabled"), &_OS::set_window_resizable);
@@ -1042,6 +1087,9 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_borderless_window", "borderless"), &_OS::set_borderless_window);
ClassDB::bind_method(D_METHOD("get_borderless_window"), &_OS::get_borderless_window);
+ ClassDB::bind_method(D_METHOD("get_window_per_pixel_transparency_enabled"), &_OS::get_window_per_pixel_transparency_enabled);
+ ClassDB::bind_method(D_METHOD("set_window_per_pixel_transparency_enabled", "enabled"), &_OS::set_window_per_pixel_transparency_enabled);
+
ClassDB::bind_method(D_METHOD("set_ime_position", "position"), &_OS::set_ime_position);
ClassDB::bind_method(D_METHOD("set_screen_orientation", "orientation"), &_OS::set_screen_orientation);
@@ -1088,6 +1136,7 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("delay_usec", "usec"), &_OS::delay_usec);
ClassDB::bind_method(D_METHOD("delay_msec", "msec"), &_OS::delay_msec);
ClassDB::bind_method(D_METHOD("get_ticks_msec"), &_OS::get_ticks_msec);
+ ClassDB::bind_method(D_METHOD("get_ticks_usec"), &_OS::get_ticks_usec);
ClassDB::bind_method(D_METHOD("get_splash_tick_msec"), &_OS::get_splash_tick_msec);
ClassDB::bind_method(D_METHOD("get_locale"), &_OS::get_locale);
ClassDB::bind_method(D_METHOD("get_latin_keyboard_variant"), &_OS::get_latin_keyboard_variant);
@@ -1159,6 +1208,7 @@ void _OS::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"), "set_screen_orientation", "get_screen_orientation");
ADD_GROUP("Window", "window_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_borderless"), "set_borderless_window", "get_borderless_window");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_per_pixel_transparency_enabled"), "set_window_per_pixel_transparency_enabled", "get_window_per_pixel_transparency_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_fullscreen"), "set_window_fullscreen", "is_window_fullscreen");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_maximized"), "set_window_maximized", "is_window_maximized");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "window_minimized"), "set_window_minimized", "is_window_minimized");
@@ -1255,6 +1305,16 @@ Variant _Geometry::segment_intersects_segment_2d(const Vector2 &p_from_a, const
};
};
+Variant _Geometry::line_intersects_line_2d(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b) {
+
+ Vector2 result;
+ if (Geometry::line_intersects_line_2d(p_from_a, p_dir_a, p_from_b, p_dir_b, result)) {
+ return result;
+ } else {
+ return Variant();
+ }
+}
+
PoolVector<Vector2> _Geometry::get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) {
Vector2 r1, r2;
@@ -1410,6 +1470,7 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("build_capsule_planes", "radius", "height", "sides", "lats", "axis"), &_Geometry::build_capsule_planes, DEFVAL(Vector3::AXIS_Z));
ClassDB::bind_method(D_METHOD("segment_intersects_circle", "segment_from", "segment_to", "circle_position", "circle_radius"), &_Geometry::segment_intersects_circle);
ClassDB::bind_method(D_METHOD("segment_intersects_segment_2d", "from_a", "to_a", "from_b", "to_b"), &_Geometry::segment_intersects_segment_2d);
+ ClassDB::bind_method(D_METHOD("line_intersects_line_2d", "from_a", "dir_a", "from_b", "dir_b"), &_Geometry::line_intersects_line_2d);
ClassDB::bind_method(D_METHOD("get_closest_points_between_segments_2d", "p1", "q1", "p2", "q2"), &_Geometry::get_closest_points_between_segments_2d);
ClassDB::bind_method(D_METHOD("get_closest_points_between_segments", "p1", "p2", "q1", "q2"), &_Geometry::get_closest_points_between_segments);
@@ -1514,6 +1575,17 @@ bool _File::is_open() const {
return f != NULL;
}
+String _File::get_path() const {
+
+ ERR_FAIL_COND_V(!f, "");
+ return f->get_path();
+}
+
+String _File::get_path_absolute() const {
+
+ ERR_FAIL_COND_V(!f, "");
+ return f->get_path_absolute();
+}
void _File::seek(int64_t p_position) {
@@ -1803,6 +1875,8 @@ void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("open", "path", "flags"), &_File::open);
ClassDB::bind_method(D_METHOD("close"), &_File::close);
+ ClassDB::bind_method(D_METHOD("get_path"), &_File::get_path);
+ ClassDB::bind_method(D_METHOD("get_path_absolute"), &_File::get_path_absolute);
ClassDB::bind_method(D_METHOD("is_open"), &_File::is_open);
ClassDB::bind_method(D_METHOD("seek", "position"), &_File::seek);
ClassDB::bind_method(D_METHOD("seek_end", "position"), &_File::seek_end, DEFVAL(0));
@@ -2374,7 +2448,7 @@ _Thread::_Thread() {
_Thread::~_Thread() {
if (active) {
- ERR_EXPLAIN("Reference to a Thread object object was lost while the thread is still running..");
+ ERR_EXPLAIN("Reference to a Thread object object was lost while the thread is still running...");
}
ERR_FAIL_COND(active == true);
}
@@ -2602,6 +2676,14 @@ int _Engine::get_iterations_per_second() const {
return Engine::get_singleton()->get_iterations_per_second();
}
+void _Engine::set_physics_jitter_fix(float p_threshold) {
+ Engine::get_singleton()->set_physics_jitter_fix(p_threshold);
+}
+
+float _Engine::get_physics_jitter_fix() const {
+ return Engine::get_singleton()->get_physics_jitter_fix();
+}
+
void _Engine::set_target_fps(int p_fps) {
Engine::get_singleton()->set_target_fps(p_fps);
}
@@ -2640,6 +2722,26 @@ Dictionary _Engine::get_version_info() const {
return Engine::get_singleton()->get_version_info();
}
+Dictionary _Engine::get_author_info() const {
+ return Engine::get_singleton()->get_author_info();
+}
+
+Array _Engine::get_copyright_info() const {
+ return Engine::get_singleton()->get_copyright_info();
+}
+
+Dictionary _Engine::get_donor_info() const {
+ return Engine::get_singleton()->get_donor_info();
+}
+
+Dictionary _Engine::get_license_info() const {
+ return Engine::get_singleton()->get_license_info();
+}
+
+String _Engine::get_license_text() const {
+ return Engine::get_singleton()->get_license_text();
+}
+
bool _Engine::is_in_physics_frame() const {
return Engine::get_singleton()->is_in_physics_frame();
}
@@ -2668,6 +2770,8 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
ClassDB::bind_method(D_METHOD("get_iterations_per_second"), &_Engine::get_iterations_per_second);
+ ClassDB::bind_method(D_METHOD("set_physics_jitter_fix", "physics_jitter_fix"), &_Engine::set_physics_jitter_fix);
+ ClassDB::bind_method(D_METHOD("get_physics_jitter_fix"), &_Engine::get_physics_jitter_fix);
ClassDB::bind_method(D_METHOD("set_target_fps", "target_fps"), &_Engine::set_target_fps);
ClassDB::bind_method(D_METHOD("get_target_fps"), &_Engine::get_target_fps);
@@ -2680,6 +2784,11 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_main_loop"), &_Engine::get_main_loop);
ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info);
+ ClassDB::bind_method(D_METHOD("get_author_info"), &_Engine::get_author_info);
+ ClassDB::bind_method(D_METHOD("get_copyright_info"), &_Engine::get_copyright_info);
+ ClassDB::bind_method(D_METHOD("get_donor_info"), &_Engine::get_donor_info);
+ ClassDB::bind_method(D_METHOD("get_license_info"), &_Engine::get_license_info);
+ ClassDB::bind_method(D_METHOD("get_license_text"), &_Engine::get_license_text);
ClassDB::bind_method(D_METHOD("is_in_physics_frame"), &_Engine::is_in_physics_frame);
@@ -2693,6 +2802,7 @@ void _Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second");
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_scale"), "set_time_scale", "get_time_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
}
_Engine *_Engine::singleton = NULL;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 734b57937a..48b7b74005 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -146,6 +146,12 @@ public:
bool is_video_mode_resizable(int p_screen = 0) const;
Array get_fullscreen_mode_list(int p_screen = 0) const;
+ virtual int get_video_driver_count() const;
+ virtual String get_video_driver_name(int p_driver) const;
+
+ virtual int get_audio_driver_count() const;
+ virtual String get_audio_driver_name(int p_driver) const;
+
virtual int get_screen_count() const;
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
@@ -156,6 +162,7 @@ public:
virtual void set_window_position(const Point2 &p_position);
virtual Size2 get_window_size() const;
virtual Size2 get_real_window_size() const;
+ virtual Rect2 get_window_safe_area() const;
virtual void set_window_size(const Size2 &p_size);
virtual void set_window_fullscreen(bool p_enabled);
virtual bool is_window_fullscreen() const;
@@ -173,6 +180,10 @@ public:
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window() const;
+ virtual bool get_window_per_pixel_transparency_enabled() const;
+ virtual void set_window_per_pixel_transparency_enabled(bool p_enabled);
+
+ virtual void set_ime_active(const bool p_active);
virtual void set_ime_position(const Point2 &p_pos);
Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
@@ -266,6 +277,7 @@ public:
void delay_usec(uint32_t p_usec) const;
void delay_msec(uint32_t p_msec) const;
uint32_t get_ticks_msec() const;
+ uint64_t get_ticks_usec() const;
uint32_t get_splash_tick_msec() const;
bool can_use_threads() const;
@@ -351,6 +363,7 @@ public:
PoolVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z);
PoolVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
Variant segment_intersects_segment_2d(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b);
+ Variant line_intersects_line_2d(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b);
PoolVector<Vector2> get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2);
PoolVector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2);
Vector2 get_closest_point_to_segment_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
@@ -409,6 +422,9 @@ public:
void close(); ///< close a file
bool is_open() const; ///< true when file is open
+ String get_path() const; /// returns the path for the current open file
+ String get_path_absolute() const; /// returns the absolute path for the current open file
+
void seek(int64_t p_position); ///< seek to a given position
void seek_end(int64_t p_position = 0); ///< seek from the end of file
int64_t get_position() const; ///< get position in the file
@@ -659,6 +675,9 @@ public:
void set_iterations_per_second(int p_ips);
int get_iterations_per_second() const;
+ void set_physics_jitter_fix(float p_threshold);
+ float get_physics_jitter_fix() const;
+
void set_target_fps(int p_fps);
int get_target_fps() const;
@@ -672,6 +691,11 @@ public:
MainLoop *get_main_loop() const;
Dictionary get_version_info() const;
+ Dictionary get_author_info() const;
+ Array get_copyright_info() const;
+ Dictionary get_donor_info() const;
+ Dictionary get_license_info() const;
+ String get_license_text() const;
bool is_in_physics_frame() const;
diff --git a/core/class_db.cpp b/core/class_db.cpp
index afcc8de0f2..f97eaf6099 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -33,18 +33,9 @@
#include "os/mutex.h"
#include "version.h"
-#ifdef NO_THREADS
-
-#define OBJTYPE_RLOCK
-#define OBJTYPE_WLOCK
-
-#else
-
#define OBJTYPE_RLOCK RWLockRead _rw_lockr_(lock);
#define OBJTYPE_WLOCK RWLockWrite _rw_lockw_(lock);
-#endif
-
#ifdef DEBUG_METHODS_ENABLED
MethodDefinition D_METHOD(const char *p_name) {
@@ -257,17 +248,19 @@ void ClassDB::set_current_api(APIType p_api) {
current_api = p_api;
}
-HashMap<StringName, ClassDB::ClassInfo, StringNameHasher> ClassDB::classes;
-HashMap<StringName, StringName, StringNameHasher> ClassDB::resource_base_extensions;
-HashMap<StringName, StringName, StringNameHasher> ClassDB::compat_classes;
+HashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
+HashMap<StringName, StringName> ClassDB::resource_base_extensions;
+HashMap<StringName, StringName> ClassDB::compat_classes;
ClassDB::ClassInfo::ClassInfo() {
+ api = API_NONE;
creation_func = NULL;
inherits_ptr = NULL;
disabled = false;
exposed = false;
}
+
ClassDB::ClassInfo::~ClassInfo() {
}
@@ -347,7 +340,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
OBJTYPE_RLOCK;
#ifdef DEBUG_METHODS_ENABLED
- uint64_t hash = hash_djb2_one_64(HashMapHasherDefault::hash(VERSION_FULL_NAME));
+ uint64_t hash = hash_djb2_one_64(HashMapHasherDefault::hash(VERSION_FULL_CONFIG));
List<StringName> names;
@@ -364,7 +357,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
ClassInfo *t = classes.getptr(E->get());
ERR_FAIL_COND_V(!t, 0);
- if (t->api != p_api)
+ if (t->api != p_api || !t->exposed)
continue;
hash = hash_djb2_one_64(t->name.hash(), hash);
hash = hash_djb2_one_64(t->inherits.hash(), hash);
@@ -660,7 +653,6 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
}
type->constant_map[p_name] = p_constant;
-#ifdef DEBUG_METHODS_ENABLED
String enum_name = p_enum;
if (enum_name != String()) {
@@ -679,6 +671,7 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
}
}
+#ifdef DEBUG_METHODS_ENABLED
type->constant_order.push_back(p_name);
#endif
}
@@ -734,7 +727,6 @@ int ClassDB::get_integer_constant(const StringName &p_class, const StringName &p
return 0;
}
-#ifdef DEBUG_METHODS_ENABLED
StringName ClassDB::get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) {
OBJTYPE_RLOCK;
@@ -803,7 +795,6 @@ void ClassDB::get_enum_constants(const StringName &p_class, const StringName &p_
type = type->inherits_ptr;
}
}
-#endif
void ClassDB::add_signal(StringName p_class, const MethodInfo &p_signal) {
@@ -895,15 +886,9 @@ void ClassDB::add_property_group(StringName p_class, const String &p_name, const
void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) {
-#ifndef NO_THREADS
lock->read_lock();
-#endif
-
ClassInfo *type = classes.getptr(p_class);
-
-#ifndef NO_THREADS
lock->read_unlock();
-#endif
ERR_FAIL_COND(!type);
@@ -1380,10 +1365,7 @@ RWLock *ClassDB::lock = NULL;
void ClassDB::init() {
-#ifndef NO_THREADS
-
lock = RWLock::create();
-#endif
}
void ClassDB::cleanup() {
@@ -1406,10 +1388,7 @@ void ClassDB::cleanup() {
resource_base_extensions.clear();
compat_classes.clear();
-#ifndef NO_THREADS
-
memdelete(lock);
-#endif
}
//
diff --git a/core/class_db.h b/core/class_db.h
index d74317239b..f1d1879236 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -114,19 +114,19 @@ public:
APIType api;
ClassInfo *inherits_ptr;
- HashMap<StringName, MethodBind *, StringNameHasher> method_map;
- HashMap<StringName, int, StringNameHasher> constant_map;
- HashMap<StringName, MethodInfo, StringNameHasher> signal_map;
+ HashMap<StringName, MethodBind *> method_map;
+ HashMap<StringName, int> constant_map;
+ HashMap<StringName, List<StringName> > enum_map;
+ HashMap<StringName, MethodInfo> signal_map;
List<PropertyInfo> property_list;
#ifdef DEBUG_METHODS_ENABLED
- HashMap<StringName, List<StringName> > enum_map;
List<StringName> constant_order;
List<StringName> method_order;
Set<StringName> methods_in_properties;
List<MethodInfo> virtual_methods;
StringName category;
#endif
- HashMap<StringName, PropertySetGet, StringNameHasher> property_setget;
+ HashMap<StringName, PropertySetGet> property_setget;
StringName inherits;
StringName name;
@@ -143,9 +143,9 @@ public:
}
static RWLock *lock;
- static HashMap<StringName, ClassInfo, StringNameHasher> classes;
- static HashMap<StringName, StringName, StringNameHasher> resource_base_extensions;
- static HashMap<StringName, StringName, StringNameHasher> compat_classes;
+ static HashMap<StringName, ClassInfo> classes;
+ static HashMap<StringName, StringName> resource_base_extensions;
+ static HashMap<StringName, StringName> compat_classes;
#ifdef DEBUG_METHODS_ENABLED
static MethodBind *bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const MethodDefinition &method_name, const Variant **p_defs, int p_defcount);
@@ -344,11 +344,9 @@ public:
static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false);
static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = NULL);
-#ifdef DEBUG_METHODS_ENABLED
static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false);
static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false);
-#endif
static StringName get_category(const StringName &p_node);
diff --git a/core/color.cpp b/core/color.cpp
index 27d8e9b891..88e57ec6e2 100644
--- a/core/color.cpp
+++ b/core/color.cpp
@@ -37,38 +37,38 @@
uint32_t Color::to_argb32() const {
- uint32_t c = (uint8_t)(a * 255);
+ uint32_t c = (uint8_t)Math::round(a * 255);
c <<= 8;
- c |= (uint8_t)(r * 255);
+ c |= (uint8_t)Math::round(r * 255);
c <<= 8;
- c |= (uint8_t)(g * 255);
+ c |= (uint8_t)Math::round(g * 255);
c <<= 8;
- c |= (uint8_t)(b * 255);
+ c |= (uint8_t)Math::round(b * 255);
return c;
}
uint32_t Color::to_abgr32() const {
- uint32_t c = (uint8_t)(a * 255);
+ uint32_t c = (uint8_t)Math::round(a * 255);
c <<= 8;
- c |= (uint8_t)(b * 255);
+ c |= (uint8_t)Math::round(b * 255);
c <<= 8;
- c |= (uint8_t)(g * 255);
+ c |= (uint8_t)Math::round(g * 255);
c <<= 8;
- c |= (uint8_t)(r * 255);
+ c |= (uint8_t)Math::round(r * 255);
return c;
}
uint32_t Color::to_rgba32() const {
- uint32_t c = (uint8_t)(r * 255);
+ uint32_t c = (uint8_t)Math::round(r * 255);
c <<= 8;
- c |= (uint8_t)(g * 255);
+ c |= (uint8_t)Math::round(g * 255);
c <<= 8;
- c |= (uint8_t)(b * 255);
+ c |= (uint8_t)Math::round(b * 255);
c <<= 8;
- c |= (uint8_t)(a * 255);
+ c |= (uint8_t)Math::round(a * 255);
return c;
}
@@ -368,7 +368,7 @@ Color Color::named(const String &p_name) {
String _to_hex(float p_val) {
- int v = p_val * 255;
+ int v = Math::round(p_val * 255);
v = CLAMP(v, 0, 255);
String ret;
@@ -402,6 +402,10 @@ String Color::to_html(bool p_alpha) const {
Color Color::from_hsv(float p_h, float p_s, float p_v, float p_a) {
+ p_h = Math::fmod(p_h * 360.0f, 360.0f);
+ if (p_h < 0.0)
+ p_h += 360.0f;
+
const float h_ = p_h / 60.0f;
const float c = p_v * p_s;
const float x = c * (1.0f - Math::abs(Math::fmod(h_, 2.0f) - 1.0f));
diff --git a/core/color_names.inc b/core/color_names.inc
index b05684acc6..3ae42648d0 100644
--- a/core/color_names.inc
+++ b/core/color_names.inc
@@ -3,7 +3,7 @@
static Map<String, Color> _named_colors;
static void _populate_named_colors() {
- if(!_named_colors.empty()) return;
+ if (!_named_colors.empty()) return;
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 6bb3135757..a39c920dfa 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -105,6 +105,7 @@ CommandQueueMT::CommandQueueMT(bool p_sync) {
read_ptr = 0;
write_ptr = 0;
+ dealloc_ptr = 0;
mutex = Mutex::create();
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index 3942b961d3..7978eaa7bf 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -54,9 +54,13 @@
#define _COMMA_10 ,
#define _COMMA_11 ,
#define _COMMA_12 ,
+#define _COMMA_13 ,
// 1-based comma separated list of ITEMs
#define COMMA_SEP_LIST(ITEM, LENGTH) _COMMA_SEP_LIST_##LENGTH(ITEM)
+#define _COMMA_SEP_LIST_13(ITEM) \
+ _COMMA_SEP_LIST_12(ITEM) \
+ , ITEM(13)
#define _COMMA_SEP_LIST_12(ITEM) \
_COMMA_SEP_LIST_11(ITEM) \
, ITEM(12)
@@ -97,6 +101,9 @@
// 1-based semicolon separated list of ITEMs
#define SEMIC_SEP_LIST(ITEM, LENGTH) _SEMIC_SEP_LIST_##LENGTH(ITEM)
+#define _SEMIC_SEP_LIST_13(ITEM) \
+ _SEMIC_SEP_LIST_12(ITEM); \
+ ITEM(13)
#define _SEMIC_SEP_LIST_12(ITEM) \
_SEMIC_SEP_LIST_11(ITEM); \
ITEM(12)
@@ -137,6 +144,9 @@
// 1-based space separated list of ITEMs
#define SPACE_SEP_LIST(ITEM, LENGTH) _SPACE_SEP_LIST_##LENGTH(ITEM)
+#define _SPACE_SEP_LIST_13(ITEM) \
+ _SPACE_SEP_LIST_12(ITEM) \
+ ITEM(13)
#define _SPACE_SEP_LIST_12(ITEM) \
_SPACE_SEP_LIST_11(ITEM) \
ITEM(12)
@@ -262,7 +272,7 @@
ss->sem->wait(); \
}
-#define MAX_CMD_PARAMS 12
+#define MAX_CMD_PARAMS 13
class CommandQueueMT {
@@ -290,15 +300,15 @@ class CommandQueueMT {
};
DECL_CMD(0)
- SPACE_SEP_LIST(DECL_CMD, 12)
+ SPACE_SEP_LIST(DECL_CMD, 13)
/* comands that return */
DECL_CMD_RET(0)
- SPACE_SEP_LIST(DECL_CMD_RET, 12)
+ SPACE_SEP_LIST(DECL_CMD_RET, 13)
/* commands that don't return but sync */
DECL_CMD_SYNC(0)
- SPACE_SEP_LIST(DECL_CMD_SYNC, 12)
+ SPACE_SEP_LIST(DECL_CMD_SYNC, 13)
/***** BASE *******/
@@ -432,15 +442,15 @@ class CommandQueueMT {
public:
/* NORMAL PUSH COMMANDS */
DECL_PUSH(0)
- SPACE_SEP_LIST(DECL_PUSH, 12)
+ SPACE_SEP_LIST(DECL_PUSH, 13)
/* PUSH AND RET COMMANDS */
DECL_PUSH_AND_RET(0)
- SPACE_SEP_LIST(DECL_PUSH_AND_RET, 12)
+ SPACE_SEP_LIST(DECL_PUSH_AND_RET, 13)
/* PUSH AND RET SYNC COMMANDS*/
DECL_PUSH_AND_SYNC(0)
- SPACE_SEP_LIST(DECL_PUSH_AND_SYNC, 12)
+ SPACE_SEP_LIST(DECL_PUSH_AND_SYNC, 13)
void wait_and_flush_one() {
ERR_FAIL_COND(!sync);
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index e3f4aa5f28..d68411a572 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -50,6 +50,32 @@ void Dictionary::get_key_list(List<Variant> *p_keys) const {
}
}
+Variant Dictionary::get_key_at_index(int p_index) const {
+
+ int index = 0;
+ for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
+ if (index == p_index) {
+ return E.key();
+ }
+ index++;
+ }
+
+ return Variant();
+}
+
+Variant Dictionary::get_value_at_index(int p_index) const {
+
+ int index = 0;
+ for (OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.front(); E; E = E.next()) {
+ if (index == p_index) {
+ return E.value();
+ }
+ index++;
+ }
+
+ return Variant();
+}
+
Variant &Dictionary::operator[](const Variant &p_key) {
return _p->variant_map[p_key];
@@ -211,7 +237,7 @@ const Variant *Dictionary::next(const Variant *p_key) const {
return NULL;
}
-Dictionary Dictionary::duplicate() const {
+Dictionary Dictionary::duplicate(bool p_deep) const {
Dictionary n;
@@ -219,7 +245,7 @@ Dictionary Dictionary::duplicate() const {
get_key_list(&keys);
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
- n[E->get()] = operator[](E->get());
+ n[E->get()] = p_deep ? operator[](E->get()).duplicate(p_deep) : operator[](E->get());
}
return n;
diff --git a/core/dictionary.h b/core/dictionary.h
index f001f2d5e1..84a5cafe1d 100644
--- a/core/dictionary.h
+++ b/core/dictionary.h
@@ -47,6 +47,8 @@ class Dictionary {
public:
void get_key_list(List<Variant> *p_keys) const;
+ Variant get_key_at_index(int p_index) const;
+ Variant get_value_at_index(int p_index) const;
Variant &operator[](const Variant &p_key);
const Variant &operator[](const Variant &p_key) const;
@@ -75,7 +77,7 @@ public:
Array keys() const;
Array values() const;
- Dictionary duplicate() const;
+ Dictionary duplicate(bool p_deep = false) const;
Dictionary(const Dictionary &p_from);
Dictionary();
diff --git a/core/engine.cpp b/core/engine.cpp
index af9052110f..7c8024b946 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -30,6 +30,9 @@
#include "engine.h"
+#include "authors.gen.h"
+#include "donors.gen.h"
+#include "license.gen.h"
#include "version.h"
#include "version_hash.gen.h"
@@ -42,6 +45,16 @@ int Engine::get_iterations_per_second() const {
return ips;
}
+void Engine::set_physics_jitter_fix(float p_threshold) {
+ if (p_threshold < 0)
+ p_threshold = 0;
+ physics_jitter_fix = p_threshold;
+}
+
+float Engine::get_physics_jitter_fix() const {
+ return physics_jitter_fix;
+}
+
void Engine::set_target_fps(int p_fps) {
_target_fps = p_fps > 0 ? p_fps : 0;
}
@@ -101,6 +114,78 @@ Dictionary Engine::get_version_info() const {
return dict;
}
+static Array array_from_info(const char *const *info_list) {
+ Array arr;
+ for (int i = 0; info_list[i] != NULL; i++) {
+ arr.push_back(info_list[i]);
+ }
+ return arr;
+}
+
+static Array array_from_info_count(const char *const *info_list, int info_count) {
+ Array arr;
+ for (int i = 0; i < info_count; i++) {
+ arr.push_back(info_list[i]);
+ }
+ return arr;
+}
+
+Dictionary Engine::get_author_info() const {
+ Dictionary dict;
+
+ dict["lead_developers"] = array_from_info(AUTHORS_LEAD_DEVELOPERS);
+ dict["project_managers"] = array_from_info(AUTHORS_PROJECT_MANAGERS);
+ dict["founders"] = array_from_info(AUTHORS_FOUNDERS);
+ dict["developers"] = array_from_info(AUTHORS_DEVELOPERS);
+
+ return dict;
+}
+
+Array Engine::get_copyright_info() const {
+ Array components;
+ for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) {
+ const ComponentCopyright &cp_info = COPYRIGHT_INFO[component_index];
+ Dictionary component_dict;
+ component_dict["name"] = cp_info.name;
+ Array parts;
+ for (int i = 0; i < cp_info.part_count; i++) {
+ const ComponentCopyrightPart &cp_part = cp_info.parts[i];
+ Dictionary part_dict;
+ part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count);
+ part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count);
+ part_dict["license"] = cp_part.license;
+ parts.push_back(part_dict);
+ }
+ component_dict["parts"] = parts;
+
+ components.push_back(component_dict);
+ }
+ return components;
+}
+
+Dictionary Engine::get_donor_info() const {
+ Dictionary donors;
+ donors["platinum_sponsors"] = array_from_info(DONORS_SPONSOR_PLAT);
+ donors["gold_sponsors"] = array_from_info(DONORS_SPONSOR_GOLD);
+ donors["mini_sponsors"] = array_from_info(DONORS_SPONSOR_MINI);
+ donors["gold_donors"] = array_from_info(DONORS_GOLD);
+ donors["silver_donors"] = array_from_info(DONORS_SILVER);
+ donors["bronze_donors"] = array_from_info(DONORS_BRONZE);
+ return donors;
+}
+
+Dictionary Engine::get_license_info() const {
+ Dictionary licenses;
+ for (int i = 0; i < LICENSE_COUNT; i++) {
+ licenses[LICENSE_NAMES[i]] = LICENSE_BODIES[i];
+ }
+ return licenses;
+}
+
+String Engine::get_license_text() const {
+ return String(GODOT_LICENSE_TEXT);
+}
+
void Engine::add_singleton(const Singleton &p_singleton) {
singletons.push_back(p_singleton);
@@ -137,6 +222,7 @@ Engine::Engine() {
singleton = this;
frames_drawn = 0;
ips = 60;
+ physics_jitter_fix = 0.5;
_frame_delay = 0;
_fps = 1;
_target_fps = 0;
diff --git a/core/engine.h b/core/engine.h
index 54b30ab81f..031ba29cd6 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -57,6 +57,7 @@ private:
float _frame_step;
int ips;
+ float physics_jitter_fix;
float _fps;
int _target_fps;
float _time_scale;
@@ -79,6 +80,9 @@ public:
virtual void set_iterations_per_second(int p_ips);
virtual int get_iterations_per_second() const;
+ void set_physics_jitter_fix(float p_threshold);
+ float get_physics_jitter_fix() const;
+
virtual void set_target_fps(int p_fps);
virtual float get_target_fps() const;
@@ -114,6 +118,11 @@ public:
#endif
Dictionary get_version_info() const;
+ Dictionary get_author_info() const;
+ Array get_copyright_info() const;
+ Dictionary get_donor_info() const;
+ Dictionary get_license_info() const;
+ String get_license_text() const;
Engine();
};
diff --git a/core/error_macros.h b/core/error_macros.h
index b8d0c7e0c3..3587e01d54 100644
--- a/core/error_macros.h
+++ b/core/error_macros.h
@@ -311,4 +311,14 @@ extern bool _err_error_exists;
_err_error_exists = false; \
}
+#define WARN_DEPRECATED \
+ { \
+ static bool warning_shown = false; \
+ if (!warning_shown) { \
+ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \
+ _err_error_exists = false; \
+ warning_shown = true; \
+ } \
+ }
+
#endif
diff --git a/core/hashfuncs.h b/core/hashfuncs.h
index ae99fa39c8..735e679d1e 100644
--- a/core/hashfuncs.h
+++ b/core/hashfuncs.h
@@ -33,6 +33,8 @@
#include "math_defs.h"
#include "math_funcs.h"
+#include "node_path.h"
+#include "string_db.h"
#include "typedefs.h"
#include "ustring.h"
@@ -131,6 +133,7 @@ static inline uint64_t make_uint64_t(T p_in) {
}
struct HashMapHasherDefault {
+
static _FORCE_INLINE_ uint32_t hash(const String &p_string) { return p_string.hash(); }
static _FORCE_INLINE_ uint32_t hash(const char *p_cstr) { return hash_djb2(p_cstr); }
static _FORCE_INLINE_ uint32_t hash(const uint64_t p_int) { return hash_one_uint64(p_int); }
@@ -145,6 +148,10 @@ struct HashMapHasherDefault {
static _FORCE_INLINE_ uint32_t hash(const uint8_t p_int) { return p_int; }
static _FORCE_INLINE_ uint32_t hash(const int8_t p_int) { return (uint32_t)p_int; }
static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return (uint32_t)p_wchar; }
+
+ static _FORCE_INLINE_ uint32_t hash(const StringName &p_string_name) { return p_string_name.hash(); }
+ static _FORCE_INLINE_ uint32_t hash(const NodePath &p_path) { return p_path.hash(); }
+
//static _FORCE_INLINE_ uint32_t hash(const void* p_ptr) { return uint32_t(uint64_t(p_ptr))*(0x9e3779b1L); }
};
diff --git a/core/image.cpp b/core/image.cpp
index 07e705265d..b0bed80a6f 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -366,6 +366,8 @@ int Image::get_mipmap_count() const {
template <uint32_t read_bytes, bool read_alpha, uint32_t write_bytes, bool write_alpha, bool read_gray, bool write_gray>
static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p_dst) {
+ uint32_t max_bytes = MAX(read_bytes, write_bytes);
+
for (int y = 0; y < p_height; y++) {
for (int x = 0; x < p_width; x++) {
@@ -379,7 +381,8 @@ static void _convert(int p_width, int p_height, const uint8_t *p_src, uint8_t *p
rgba[1] = rofs[0];
rgba[2] = rofs[0];
} else {
- for (uint32_t i = 0; i < MAX(read_bytes, write_bytes); i++) {
+
+ for (uint32_t i = 0; i < max_bytes; i++) {
rgba[i] = (i < read_bytes) ? rofs[i] : 0;
}
@@ -937,7 +940,7 @@ bool Image::_can_modify(Format p_format) const {
return p_format <= FORMAT_RGBE9995;
}
-template <int CC>
+template <int CC, bool renormalize>
static void _generate_po2_mipmap(const uint8_t *p_src, uint8_t *p_dst, uint32_t p_width, uint32_t p_height) {
//fast power of 2 mipmap generation
@@ -963,6 +966,19 @@ static void _generate_po2_mipmap(const uint8_t *p_src, uint8_t *p_dst, uint32_t
dst_ptr[j] = val >> 2;
}
+ if (renormalize) {
+ Vector3 n(dst_ptr[0] / 255.0, dst_ptr[1] / 255.0, dst_ptr[2] / 255.0);
+ n *= 2.0;
+ n -= Vector3(1, 1, 1);
+ n.normalize();
+ n += Vector3(1, 1, 1);
+ n *= 0.5;
+ n *= 255;
+ dst_ptr[0] = CLAMP(int(n.x), 0, 255);
+ dst_ptr[1] = CLAMP(int(n.y), 0, 255);
+ dst_ptr[2] = CLAMP(int(n.z), 0, 255);
+ }
+
dst_ptr += CC;
rup_ptr += CC * 2;
rdown_ptr += CC * 2;
@@ -1045,11 +1061,11 @@ void Image::shrink_x2() {
switch (format) {
case FORMAT_L8:
- case FORMAT_R8: _generate_po2_mipmap<1>(r.ptr(), w.ptr(), width, height); break;
- case FORMAT_LA8: _generate_po2_mipmap<2>(r.ptr(), w.ptr(), width, height); break;
- case FORMAT_RG8: _generate_po2_mipmap<2>(r.ptr(), w.ptr(), width, height); break;
- case FORMAT_RGB8: _generate_po2_mipmap<3>(r.ptr(), w.ptr(), width, height); break;
- case FORMAT_RGBA8: _generate_po2_mipmap<4>(r.ptr(), w.ptr(), width, height); break;
+ case FORMAT_R8: _generate_po2_mipmap<1, false>(r.ptr(), w.ptr(), width, height); break;
+ case FORMAT_LA8: _generate_po2_mipmap<2, false>(r.ptr(), w.ptr(), width, height); break;
+ case FORMAT_RG8: _generate_po2_mipmap<2, false>(r.ptr(), w.ptr(), width, height); break;
+ case FORMAT_RGB8: _generate_po2_mipmap<3, false>(r.ptr(), w.ptr(), width, height); break;
+ case FORMAT_RGBA8: _generate_po2_mipmap<4, false>(r.ptr(), w.ptr(), width, height); break;
default: {}
}
}
@@ -1060,7 +1076,37 @@ void Image::shrink_x2() {
}
}
-Error Image::generate_mipmaps() {
+void Image::normalize() {
+
+ bool used_mipmaps = has_mipmaps();
+ if (used_mipmaps) {
+ clear_mipmaps();
+ }
+
+ lock();
+
+ for (int y = 0; y < height; y++) {
+
+ for (int x = 0; x < width; x++) {
+
+ Color c = get_pixel(x, y);
+ Vector3 v(c.r * 2.0 - 1.0, c.g * 2.0 - 1.0, c.b * 2.0 - 1.0);
+ v.normalize();
+ c.r = v.x * 0.5 + 0.5;
+ c.g = v.y * 0.5 + 0.5;
+ c.b = v.z * 0.5 + 0.5;
+ set_pixel(x, y, c);
+ }
+ }
+
+ unlock();
+
+ if (used_mipmaps) {
+ generate_mipmaps(true);
+ }
+}
+
+Error Image::generate_mipmaps(bool p_renormalize) {
if (!_can_modify(format)) {
ERR_EXPLAIN("Cannot generate mipmaps in indexed, compressed or custom image formats.");
@@ -1077,61 +1123,40 @@ Error Image::generate_mipmaps() {
PoolVector<uint8_t>::Write wp = data.write();
- if (next_power_of_2(width) == uint32_t(width) && next_power_of_2(height) == uint32_t(height)) {
- //use fast code for powers of 2
- int prev_ofs = 0;
- int prev_h = height;
- int prev_w = width;
+ int prev_ofs = 0;
+ int prev_h = height;
+ int prev_w = width;
- for (int i = 1; i < mmcount; i++) {
+ for (int i = 1; i < mmcount; i++) {
- int ofs, w, h;
- _get_mipmap_offset_and_size(i, ofs, w, h);
+ int ofs, w, h;
+ _get_mipmap_offset_and_size(i, ofs, w, h);
- switch (format) {
+ switch (format) {
- case FORMAT_L8:
- case FORMAT_R8: _generate_po2_mipmap<1>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
- case FORMAT_LA8:
- case FORMAT_RG8: _generate_po2_mipmap<2>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
- case FORMAT_RGB8: _generate_po2_mipmap<3>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
- case FORMAT_RGBA8: _generate_po2_mipmap<4>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
- default: {}
- }
+ case FORMAT_L8:
+ case FORMAT_R8: _generate_po2_mipmap<1, false>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
+ case FORMAT_LA8:
+ case FORMAT_RG8: _generate_po2_mipmap<2, false>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h); break;
+ case FORMAT_RGB8:
+ if (p_renormalize)
+ _generate_po2_mipmap<3, true>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
+ else
+ _generate_po2_mipmap<3, false>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
- prev_ofs = ofs;
- prev_w = w;
- prev_h = h;
+ break;
+ case FORMAT_RGBA8:
+ if (p_renormalize)
+ _generate_po2_mipmap<4, true>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
+ else
+ _generate_po2_mipmap<4, false>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h);
+ break;
+ default: {}
}
- } else {
- //use slow code..
-
- //use bilinear filtered code for non powers of 2
- int prev_ofs = 0;
- int prev_h = height;
- int prev_w = width;
-
- for (int i = 1; i < mmcount; i++) {
-
- int ofs, w, h;
- _get_mipmap_offset_and_size(i, ofs, w, h);
-
- switch (format) {
-
- case FORMAT_L8:
- case FORMAT_R8: _scale_bilinear<1>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h, w, h); break;
- case FORMAT_LA8:
- case FORMAT_RG8: _scale_bilinear<2>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h, w, h); break;
- case FORMAT_RGB8: _scale_bilinear<3>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h, w, h); break;
- case FORMAT_RGBA8: _scale_bilinear<4>(&wp[prev_ofs], &wp[ofs], prev_w, prev_h, w, h); break;
- default: {}
- }
-
- prev_ofs = ofs;
- prev_w = w;
- prev_h = h;
- }
+ prev_ofs = ofs;
+ prev_w = w;
+ prev_h = h;
}
mipmaps = true;
@@ -1166,6 +1191,9 @@ PoolVector<uint8_t> Image::get_data() const {
void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format) {
+ ERR_FAIL_INDEX(p_width - 1, MAX_WIDTH);
+ ERR_FAIL_INDEX(p_height - 1, MAX_HEIGHT);
+
int mm = 0;
int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0);
data.resize(size);
@@ -1630,6 +1658,12 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po
ERR_FAIL_COND(format != p_src->format);
Rect2i clipped_src_rect = Rect2i(0, 0, p_src->width, p_src->height).clip(p_src_rect);
+
+ if (p_dest.x < 0)
+ clipped_src_rect.position.x = ABS(p_dest.x);
+ if (p_dest.y < 0)
+ clipped_src_rect.position.y = ABS(p_dest.y);
+
if (clipped_src_rect.size.x <= 0 || clipped_src_rect.size.y <= 0)
return;
@@ -1678,6 +1712,12 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co
ERR_FAIL_COND(format != p_src->format);
Rect2i clipped_src_rect = Rect2i(0, 0, p_src->width, p_src->height).clip(p_src_rect);
+
+ if (p_dest.x < 0)
+ clipped_src_rect.position.x = ABS(p_dest.x);
+ if (p_dest.y < 0)
+ clipped_src_rect.position.y = ABS(p_dest.y);
+
if (clipped_src_rect.size.x <= 0 || clipped_src_rect.size.y <= 0)
return;
@@ -1729,6 +1769,12 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const P
ERR_FAIL_COND(format != p_src->format);
Rect2i clipped_src_rect = Rect2i(0, 0, p_src->width, p_src->height).clip(p_src_rect);
+
+ if (p_dest.x < 0)
+ clipped_src_rect.position.x = ABS(p_dest.x);
+ if (p_dest.y < 0)
+ clipped_src_rect.position.y = ABS(p_dest.y);
+
if (clipped_src_rect.size.x <= 0 || clipped_src_rect.size.y <= 0)
return;
@@ -1777,6 +1823,12 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c
ERR_FAIL_COND(format != p_src->format);
Rect2i clipped_src_rect = Rect2i(0, 0, p_src->width, p_src->height).clip(p_src_rect);
+
+ if (p_dest.x < 0)
+ clipped_src_rect.position.x = ABS(p_dest.x);
+ if (p_dest.y < 0)
+ clipped_src_rect.position.y = ABS(p_dest.y);
+
if (clipped_src_rect.size.x <= 0 || clipped_src_rect.size.y <= 0)
return;
@@ -1912,6 +1964,10 @@ void Image::unlock() {
write_lock = PoolVector<uint8_t>::Write();
}
+Color Image::get_pixelv(const Point2 &p_src) const {
+ return get_pixel(p_src.x, p_src.y);
+}
+
Color Image::get_pixel(int p_x, int p_y) const {
uint8_t *ptr = write_lock.ptr();
@@ -2058,6 +2114,10 @@ Color Image::get_pixel(int p_x, int p_y) const {
return Color();
}
+void Image::set_pixelv(const Point2 &p_dst, const Color &p_color) {
+ return set_pixel(p_dst.x, p_dst.y, p_color);
+}
+
void Image::set_pixel(int p_x, int p_y, const Color &p_color) {
uint8_t *ptr = write_lock.ptr();
@@ -2249,7 +2309,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("crop", "width", "height"), &Image::crop);
ClassDB::bind_method(D_METHOD("flip_x"), &Image::flip_x);
ClassDB::bind_method(D_METHOD("flip_y"), &Image::flip_y);
- ClassDB::bind_method(D_METHOD("generate_mipmaps"), &Image::generate_mipmaps);
+ ClassDB::bind_method(D_METHOD("generate_mipmaps", "renormalize"), &Image::generate_mipmaps, DEFVAL(false));
ClassDB::bind_method(D_METHOD("clear_mipmaps"), &Image::clear_mipmaps);
ClassDB::bind_method(D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::_create_empty);
@@ -2271,6 +2331,8 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("premultiply_alpha"), &Image::premultiply_alpha);
ClassDB::bind_method(D_METHOD("srgb_to_linear"), &Image::srgb_to_linear);
ClassDB::bind_method(D_METHOD("normalmap_to_xy"), &Image::normalmap_to_xy);
+ ClassDB::bind_method(D_METHOD("rgbe_to_srgb"), &Image::rgbe_to_srgb);
+ ClassDB::bind_method(D_METHOD("bumpmap_to_normalmap", "bump_scale"), &Image::bumpmap_to_normalmap, DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("blit_rect", "src", "src_rect", "dst"), &Image::blit_rect);
ClassDB::bind_method(D_METHOD("blit_rect_mask", "src", "mask", "src_rect", "dst"), &Image::blit_rect_mask);
@@ -2288,8 +2350,10 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("lock"), &Image::lock);
ClassDB::bind_method(D_METHOD("unlock"), &Image::unlock);
- ClassDB::bind_method(D_METHOD("set_pixel", "x", "y", "color"), &Image::set_pixel);
+ ClassDB::bind_method(D_METHOD("get_pixelv", "src"), &Image::get_pixelv);
ClassDB::bind_method(D_METHOD("get_pixel", "x", "y"), &Image::get_pixel);
+ ClassDB::bind_method(D_METHOD("set_pixelv", "dst", "color"), &Image::set_pixelv);
+ ClassDB::bind_method(D_METHOD("set_pixel", "x", "y", "color"), &Image::set_pixel);
ClassDB::bind_method(D_METHOD("load_png_from_buffer", "buffer"), &Image::load_png_from_buffer);
ClassDB::bind_method(D_METHOD("load_jpg_from_buffer", "buffer"), &Image::load_jpg_from_buffer);
@@ -2379,6 +2443,78 @@ void Image::normalmap_to_xy() {
convert(Image::FORMAT_LA8);
}
+Ref<Image> Image::rgbe_to_srgb() {
+
+ if (data.size() == 0)
+ return Ref<Image>();
+
+ ERR_FAIL_COND_V(format != FORMAT_RGBE9995, Ref<Image>());
+
+ Ref<Image> new_image;
+ new_image.instance();
+ new_image->create(width, height, 0, Image::FORMAT_RGB8);
+
+ lock();
+
+ new_image->lock();
+
+ for (int row = 0; row < height; row++) {
+ for (int col = 0; col < width; col++) {
+ new_image->set_pixel(col, row, get_pixel(col, row).to_srgb());
+ }
+ }
+
+ unlock();
+ new_image->unlock();
+
+ if (has_mipmaps()) {
+ new_image->generate_mipmaps();
+ }
+
+ return new_image;
+}
+
+void Image::bumpmap_to_normalmap(float bump_scale) {
+ ERR_FAIL_COND(!_can_modify(format));
+ convert(Image::FORMAT_RF);
+
+ PoolVector<uint8_t> result_image; //rgba output
+ result_image.resize(width * height * 4);
+
+ {
+ PoolVector<uint8_t>::Read rp = data.read();
+ PoolVector<uint8_t>::Write wp = result_image.write();
+
+ unsigned char *write_ptr = wp.ptr();
+ float *read_ptr = (float *)rp.ptr();
+
+ for (int ty = 0; ty < height; ty++) {
+ int py = ty + 1;
+ if (py >= height) py -= height;
+
+ for (int tx = 0; tx < width; tx++) {
+ int px = tx + 1;
+ if (px >= width) px -= width;
+ float here = read_ptr[ty * width + tx];
+ float to_right = read_ptr[ty * width + px];
+ float above = read_ptr[py * width + tx];
+ Vector3 up = Vector3(0, 1, (here - above) * bump_scale);
+ Vector3 across = Vector3(1, 0, (to_right - here) * bump_scale);
+
+ Vector3 normal = across.cross(up);
+ normal.normalize();
+
+ write_ptr[((ty * width + tx) << 2) + 0] = (127.5 + normal.x * 127.5);
+ write_ptr[((ty * width + tx) << 2) + 1] = (127.5 + normal.y * 127.5);
+ write_ptr[((ty * width + tx) << 2) + 2] = (127.5 + normal.z * 127.5);
+ write_ptr[((ty * width + tx) << 2) + 3] = 255;
+ }
+ }
+ }
+ format = FORMAT_RGBA8;
+ data = result_image;
+}
+
void Image::srgb_to_linear() {
if (data.size() == 0)
diff --git a/core/image.h b/core/image.h
index e962787ae9..43516e2c0b 100644
--- a/core/image.h
+++ b/core/image.h
@@ -217,9 +217,10 @@ public:
/**
* Generate a mipmap to an image (creates an image 1/4 the size, with averaging of 4->1)
*/
- Error generate_mipmaps();
+ Error generate_mipmaps(bool p_renormalize = false);
void clear_mipmaps();
+ void normalize(); //for normal maps
/**
* Create a new image of a given size and format. Current image will be lost
@@ -284,6 +285,8 @@ public:
void premultiply_alpha();
void srgb_to_linear();
void normalmap_to_xy();
+ Ref<Image> rgbe_to_srgb();
+ void bumpmap_to_normalmap(float bump_scale = 1.0);
void blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Point2 &p_dest);
void blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2 &p_src_rect, const Point2 &p_dest);
@@ -320,7 +323,9 @@ public:
DetectChannels get_detected_channels();
+ Color get_pixelv(const Point2 &p_src) const;
Color get_pixel(int p_x, int p_y) const;
+ void set_pixelv(const Point2 &p_dest, const Color &p_color);
void set_pixel(int p_x, int p_y, const Color &p_color);
void copy_internals_from(const Ref<Image> &p_image) {
diff --git a/core/input_map.cpp b/core/input_map.cpp
index a9ea1d9545..d33f40cbcf 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -35,27 +35,32 @@
InputMap *InputMap::singleton = NULL;
+int InputMap::ALL_DEVICES = -1;
+
void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);
- ClassDB::bind_method(D_METHOD("add_action", "action"), &InputMap::add_action);
+ ClassDB::bind_method(D_METHOD("add_action", "action", "deadzone"), &InputMap::add_action, DEFVAL(0.5f));
ClassDB::bind_method(D_METHOD("erase_action", "action"), &InputMap::erase_action);
+ ClassDB::bind_method(D_METHOD("action_set_deadzone", "deadzone"), &InputMap::action_set_deadzone);
ClassDB::bind_method(D_METHOD("action_add_event", "action", "event"), &InputMap::action_add_event);
ClassDB::bind_method(D_METHOD("action_has_event", "action", "event"), &InputMap::action_has_event);
ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event"), &InputMap::action_erase_event);
+ ClassDB::bind_method(D_METHOD("action_erase_events", "action"), &InputMap::action_erase_events);
ClassDB::bind_method(D_METHOD("get_action_list", "action"), &InputMap::_get_action_list);
ClassDB::bind_method(D_METHOD("event_is_action", "event", "action"), &InputMap::event_is_action);
ClassDB::bind_method(D_METHOD("load_from_globals"), &InputMap::load_from_globals);
}
-void InputMap::add_action(const StringName &p_action) {
+void InputMap::add_action(const StringName &p_action, float p_deadzone) {
ERR_FAIL_COND(input_map.has(p_action));
input_map[p_action] = Action();
static int last_id = 1;
input_map[p_action].id = last_id;
+ input_map[p_action].deadzone = p_deadzone;
last_id++;
}
@@ -94,19 +99,21 @@ List<StringName> InputMap::get_actions() const {
return actions;
}
-List<Ref<InputEvent> >::Element *InputMap::_find_event(List<Ref<InputEvent> > &p_list, const Ref<InputEvent> &p_event, bool p_action_test) const {
+List<Ref<InputEvent> >::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength) const {
- for (List<Ref<InputEvent> >::Element *E = p_list.front(); E; E = E->next()) {
+ for (List<Ref<InputEvent> >::Element *E = p_action.inputs.front(); E; E = E->next()) {
const Ref<InputEvent> e = E->get();
//if (e.type != Ref<InputEvent>::KEY && e.device != p_event.device) -- unsure about the KEY comparison, why is this here?
// continue;
- if (e->get_device() != p_event->get_device())
- continue;
- if (e->action_match(p_event))
- return E;
+ int device = e->get_device();
+ if (device == ALL_DEVICES || device == p_event->get_device()) {
+ if (e->action_match(p_event, p_pressed, p_strength, p_action.deadzone)) {
+ return E;
+ }
+ }
}
return NULL;
@@ -117,11 +124,18 @@ bool InputMap::has_action(const StringName &p_action) const {
return input_map.has(p_action);
}
+void InputMap::action_set_deadzone(const StringName &p_action, float p_deadzone) {
+
+ ERR_FAIL_COND(!input_map.has(p_action));
+
+ input_map[p_action].deadzone = p_deadzone;
+}
+
void InputMap::action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
ERR_FAIL_COND(!input_map.has(p_action));
- if (_find_event(input_map[p_action].inputs, p_event))
+ if (_find_event(input_map[p_action], p_event))
return; //already gots
input_map[p_action].inputs.push_back(p_event);
@@ -130,18 +144,25 @@ void InputMap::action_add_event(const StringName &p_action, const Ref<InputEvent
bool InputMap::action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_V(!input_map.has(p_action), false);
- return (_find_event(input_map[p_action].inputs, p_event) != NULL);
+ return (_find_event(input_map[p_action], p_event) != NULL);
}
void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(!input_map.has(p_action));
- List<Ref<InputEvent> >::Element *E = _find_event(input_map[p_action].inputs, p_event);
+ List<Ref<InputEvent> >::Element *E = _find_event(input_map[p_action], p_event);
if (E)
input_map[p_action].inputs.erase(E);
}
+void InputMap::action_erase_events(const StringName &p_action) {
+
+ ERR_FAIL_COND(!input_map.has(p_action));
+
+ input_map[p_action].inputs.clear();
+}
+
Array InputMap::_get_action_list(const StringName &p_action) {
Array ret;
@@ -166,19 +187,33 @@ const List<Ref<InputEvent> > *InputMap::get_action_list(const StringName &p_acti
}
bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const {
+ return event_get_action_status(p_event, p_action);
+}
+bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed, float *p_strength) const {
Map<StringName, Action>::Element *E = input_map.find(p_action);
if (!E) {
ERR_EXPLAIN("Request for nonexistent InputMap action: " + String(p_action));
ERR_FAIL_COND_V(!E, false);
}
- Ref<InputEventAction> iea = p_event;
- if (iea.is_valid()) {
- return iea->get_action() == p_action;
+ Ref<InputEventAction> input_event_action = p_event;
+ if (input_event_action.is_valid()) {
+ return input_event_action->get_action() == p_action;
}
- return _find_event(E->get().inputs, p_event, true) != NULL;
+ bool pressed;
+ float strength;
+ List<Ref<InputEvent> >::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
+ if (event != NULL) {
+ if (p_pressed != NULL)
+ *p_pressed = pressed;
+ if (p_strength != NULL)
+ *p_strength = strength;
+ return true;
+ } else {
+ return false;
+ }
}
const Map<StringName, InputMap::Action> &InputMap::get_action_map() const {
@@ -200,16 +235,16 @@ void InputMap::load_from_globals() {
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
- add_action(name);
-
- Array va = ProjectSettings::get_singleton()->get(pi.name);
+ Dictionary action = ProjectSettings::get_singleton()->get(pi.name);
+ float deadzone = action.has("deadzone") ? (float)action["deadzone"] : 0.5f;
+ Array events = action["events"];
- for (int i = 0; i < va.size(); i++) {
-
- Ref<InputEvent> ie = va[i];
- if (ie.is_null())
+ add_action(name, deadzone);
+ for (int i = 0; i < events.size(); i++) {
+ Ref<InputEvent> event = events[i];
+ if (event.is_null())
continue;
- action_add_event(name, ie);
+ action_add_event(name, event);
}
}
}
@@ -282,6 +317,16 @@ void InputMap::load_default() {
key->set_scancode(KEY_PAGEDOWN);
action_add_event("ui_page_down", key);
+ add_action("ui_home");
+ key.instance();
+ key->set_scancode(KEY_HOME);
+ action_add_event("ui_home", key);
+
+ add_action("ui_end");
+ key.instance();
+ key->set_scancode(KEY_END);
+ action_add_event("ui_end", key);
+
//set("display/window/handheld/orientation", "landscape");
}
diff --git a/core/input_map.h b/core/input_map.h
index 84d90f6f2a..bdec75c65b 100644
--- a/core/input_map.h
+++ b/core/input_map.h
@@ -39,8 +39,14 @@ class InputMap : public Object {
GDCLASS(InputMap, Object);
public:
+ /**
+ * A special value used to signify that a given Action can be triggered by any device
+ */
+ static int ALL_DEVICES;
+
struct Action {
int id;
+ float deadzone;
List<Ref<InputEvent> > inputs;
};
@@ -49,7 +55,7 @@ private:
mutable Map<StringName, Action> input_map;
- List<Ref<InputEvent> >::Element *_find_event(List<Ref<InputEvent> > &p_list, const Ref<InputEvent> &p_event, bool p_action_test = false) const;
+ List<Ref<InputEvent> >::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = NULL, float *p_strength = NULL) const;
Array _get_action_list(const StringName &p_action);
Array _get_actions();
@@ -62,15 +68,18 @@ public:
bool has_action(const StringName &p_action) const;
List<StringName> get_actions() const;
- void add_action(const StringName &p_action);
+ void add_action(const StringName &p_action, float p_deadzone = 0.5);
void erase_action(const StringName &p_action);
+ void action_set_deadzone(const StringName &p_action, float p_deadzone);
void action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event);
bool action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event);
+ void action_erase_events(const StringName &p_action);
const List<Ref<InputEvent> > *get_action_list(const StringName &p_action);
bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const;
+ bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = NULL, float *p_strength = NULL) const;
const Map<StringName, Action> &get_action_map() const;
void load_from_globals();
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 1a16d0f61c..efb4c7a073 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -88,7 +88,11 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
}
}
}
- cd->files.insert(path.get_file());
+ String filename = path.get_file();
+ // Don't add as a file if the path points to a directoryy
+ if (!filename.empty()) {
+ cd->files.insert(filename);
+ }
}
}
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index a9eb9466b7..8d85e78226 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -248,6 +248,7 @@ void HTTPClient::close() {
body_size = 0;
body_left = 0;
chunk_left = 0;
+ read_until_eof = false;
response_num = 0;
}
@@ -298,7 +299,7 @@ Error HTTPClient::poll() {
case StreamPeerTCP::STATUS_CONNECTED: {
if (ssl) {
Ref<StreamPeerSSL> ssl = StreamPeerSSL::create();
- Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, ssl_verify_host ? conn_host : String());
+ Error err = ssl->connect_to_stream(tcp_connection, ssl_verify_host, conn_host);
if (err != OK) {
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
@@ -352,10 +353,17 @@ Error HTTPClient::poll() {
chunked = false;
body_left = 0;
chunk_left = 0;
+ read_until_eof = false;
response_str.clear();
response_headers.clear();
response_num = RESPONSE_OK;
+ // Per the HTTP 1.1 spec, keep-alive is the default, but in practice
+ // it's safe to assume it only if the explicit header is found, allowing
+ // to handle body-up-to-EOF responses on naive servers; that's what Curl
+ // and browsers do
+ bool keep_alive = false;
+
for (int i = 0; i < responses.size(); i++) {
String header = responses[i].strip_edges();
@@ -365,13 +373,14 @@ Error HTTPClient::poll() {
if (s.begins_with("content-length:")) {
body_size = s.substr(s.find(":") + 1, s.length()).strip_edges().to_int();
body_left = body_size;
- }
- if (s.begins_with("transfer-encoding:")) {
+ } else if (s.begins_with("transfer-encoding:")) {
String encoding = header.substr(header.find(":") + 1, header.length()).strip_edges();
if (encoding == "chunked") {
chunked = true;
}
+ } else if (s.begins_with("connection: keep-alive")) {
+ keep_alive = true;
}
if (i == 0 && responses[i].begins_with("HTTP")) {
@@ -384,11 +393,16 @@ Error HTTPClient::poll() {
}
}
- if (body_size == 0 && !chunked) {
+ if (body_size || chunked) {
- status = STATUS_CONNECTED; // Ready for new requests
- } else {
status = STATUS_BODY;
+ } else if (!keep_alive) {
+
+ read_until_eof = true;
+ status = STATUS_BODY;
+ } else {
+
+ status = STATUS_CONNECTED;
}
return OK;
}
@@ -515,34 +529,53 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
} else {
- int to_read = MIN(body_left, read_chunk_size);
+ int to_read = !read_until_eof ? MIN(body_left, read_chunk_size) : read_chunk_size;
PoolByteArray ret;
ret.resize(to_read);
int _offset = 0;
- while (to_read > 0) {
+ while (read_until_eof || to_read > 0) {
int rec = 0;
{
PoolByteArray::Write w = ret.write();
err = _get_http_data(w.ptr() + _offset, to_read, rec);
}
- if (rec > 0) {
- body_left -= rec;
- to_read -= rec;
- _offset += rec;
- } else {
+ if (rec < 0) {
if (to_read > 0) // Ended up reading less
ret.resize(_offset);
break;
+ } else {
+ _offset += rec;
+ if (!read_until_eof) {
+ body_left -= rec;
+ to_read -= rec;
+ } else {
+ if (rec < to_read) {
+ ret.resize(_offset);
+ err = ERR_FILE_EOF;
+ break;
+ }
+ ret.resize(_offset + to_read);
+ }
}
}
- if (body_left == 0) {
- status = STATUS_CONNECTED;
+ if (!read_until_eof) {
+ if (body_left == 0) {
+ status = STATUS_CONNECTED;
+ }
+ return ret;
+ } else {
+ if (err == ERR_FILE_EOF) {
+ err = OK; // EOF is expected here
+ close();
+ return ret;
+ }
}
- return ret;
}
if (err != OK) {
+
close();
+
if (err == ERR_FILE_EOF) {
status = STATUS_DISCONNECTED; // Server disconnected
@@ -602,6 +635,7 @@ HTTPClient::HTTPClient() {
body_size = 0;
chunked = false;
body_left = 0;
+ read_until_eof = false;
chunk_left = 0;
response_num = 0;
ssl = false;
@@ -618,7 +652,27 @@ String HTTPClient::query_string_from_dict(const Dictionary &p_dict) {
String query = "";
Array keys = p_dict.keys();
for (int i = 0; i < keys.size(); ++i) {
- query += "&" + String(keys[i]).http_escape() + "=" + String(p_dict[keys[i]]).http_escape();
+ String encoded_key = String(keys[i]).http_escape();
+ Variant value = p_dict[keys[i]];
+ switch (value.get_type()) {
+ case Variant::ARRAY: {
+ // Repeat the key with every values
+ Array values = value;
+ for (int j = 0; j < values.size(); ++j) {
+ query += "&" + encoded_key + "=" + String(values[j]).http_escape();
+ }
+ break;
+ }
+ case Variant::NIL: {
+ // Add the key with no value
+ query += "&" + encoded_key;
+ break;
+ }
+ default: {
+ // Add the key-value pair
+ query += "&" + encoded_key + "=" + String(value).http_escape();
+ }
+ }
}
query.erase(0, 1);
return query;
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 839012e701..38ec82ce8c 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -173,6 +173,7 @@ private:
int chunk_left;
int body_size;
int body_left;
+ bool read_until_eof;
Ref<StreamPeerTCP> tcp_connection;
Ref<StreamPeer> connection;
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 999c9a8ca2..8ebd9d6cd9 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -37,7 +37,7 @@ bool ImageFormatLoader::recognize(const String &p_extension) const {
get_recognized_extensions(&extensions);
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- if (E->get().nocasecmp_to(p_extension.get_extension()) == 0)
+ if (E->get().nocasecmp_to(p_extension) == 0)
return true;
}
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 983b829d8d..786bec461b 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -112,7 +112,7 @@ void RotatedFileLogger::clear_old_backups() {
int max_backups = max_files - 1; // -1 for the current file
String basename = base_path.get_file().get_basename();
- String extension = "." + base_path.get_extension();
+ String extension = base_path.get_extension();
DirAccess *da = DirAccess::open(base_path.get_base_dir());
if (!da) {
@@ -123,7 +123,7 @@ void RotatedFileLogger::clear_old_backups() {
String f = da->get_next();
Set<String> backups;
while (f != String()) {
- if (!da->current_is_dir() && f.begins_with(basename) && f.ends_with(extension) && f != base_path.get_file()) {
+ if (!da->current_is_dir() && f.begins_with(basename) && f.get_extension() == extension && f != base_path.get_file()) {
backups.insert(f);
}
f = da->get_next();
@@ -152,7 +152,10 @@ void RotatedFileLogger::rotate_file() {
OS::Time time = OS::get_singleton()->get_time();
sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
- String backup_name = base_path.get_basename() + timestamp + "." + base_path.get_extension();
+ String backup_name = base_path.get_basename() + timestamp;
+ if (base_path.get_extension() != String()) {
+ backup_name += "." + base_path.get_extension();
+ }
DirAccess *da = DirAccess::open(base_path.get_base_dir());
if (da) {
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 9e21287780..0a3a6c1ba1 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -813,7 +813,7 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) {
while (r_len % 4) {
r_len++; //pad
if (buf) {
- buf++;
+ *(buf++) = 0;
}
}
}
@@ -1211,7 +1211,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += len;
if (buf)
buf += len;
- encode_variant(d[E->get()], buf, len, p_object_as_id);
+ Variant *v = d.getptr(E->get());
+ ERR_FAIL_COND_V(!v, ERR_BUG);
+ encode_variant(*v, buf, len, p_object_as_id);
ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len;
if (buf)
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
new file mode 100644
index 0000000000..846c89510e
--- /dev/null
+++ b/core/io/multiplayer_api.cpp
@@ -0,0 +1,817 @@
+/*************************************************************************/
+/* multiplayer_api.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "core/io/multiplayer_api.h"
+#include "core/io/marshalls.h"
+#include "scene/main/node.h"
+
+_FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_master, bool &r_skip_rpc) {
+
+ switch (mode) {
+
+ case MultiplayerAPI::RPC_MODE_DISABLED: {
+ //do nothing
+ } break;
+ case MultiplayerAPI::RPC_MODE_REMOTE: {
+ //do nothing also, no need to call local
+ } break;
+ case MultiplayerAPI::RPC_MODE_REMOTESYNC:
+ case MultiplayerAPI::RPC_MODE_MASTERSYNC:
+ case MultiplayerAPI::RPC_MODE_SLAVESYNC:
+ case MultiplayerAPI::RPC_MODE_SYNC: {
+ //call it, sync always results in call
+ return true;
+ } break;
+ case MultiplayerAPI::RPC_MODE_MASTER: {
+ if (is_master)
+ r_skip_rpc = true; //no other master so..
+ return is_master;
+ } break;
+ case MultiplayerAPI::RPC_MODE_SLAVE: {
+ return !is_master;
+ } break;
+ }
+ return false;
+}
+
+_FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, int p_remote_id) {
+ switch (mode) {
+
+ case MultiplayerAPI::RPC_MODE_DISABLED: {
+ return false;
+ } break;
+ case MultiplayerAPI::RPC_MODE_REMOTE: {
+ return true;
+ } break;
+ case MultiplayerAPI::RPC_MODE_REMOTESYNC:
+ case MultiplayerAPI::RPC_MODE_SYNC: {
+ return true;
+ } break;
+ case MultiplayerAPI::RPC_MODE_MASTERSYNC:
+ case MultiplayerAPI::RPC_MODE_MASTER: {
+ return p_node->is_network_master();
+ } break;
+ case MultiplayerAPI::RPC_MODE_SLAVESYNC:
+ case MultiplayerAPI::RPC_MODE_SLAVE: {
+ return !p_node->is_network_master() && p_remote_id == p_node->get_network_master();
+ } break;
+ }
+
+ return false;
+}
+
+void MultiplayerAPI::poll() {
+
+ if (!network_peer.is_valid() || network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED)
+ return;
+
+ network_peer->poll();
+
+ if (!network_peer.is_valid()) //it's possible that polling might have resulted in a disconnection, so check here
+ return;
+
+ while (network_peer->get_available_packet_count()) {
+
+ int sender = network_peer->get_packet_peer();
+ const uint8_t *packet;
+ int len;
+
+ Error err = network_peer->get_packet(&packet, len);
+ if (err != OK) {
+ ERR_PRINT("Error getting packet!");
+ }
+
+ rpc_sender_id = sender;
+ _process_packet(sender, packet, len);
+ rpc_sender_id = 0;
+
+ if (!network_peer.is_valid()) {
+ break; //it's also possible that a packet or RPC caused a disconnection, so also check here
+ }
+ }
+}
+
+void MultiplayerAPI::clear() {
+ connected_peers.clear();
+ path_get_cache.clear();
+ path_send_cache.clear();
+ last_send_cache_id = 1;
+}
+
+void MultiplayerAPI::set_root_node(Node *p_node) {
+ root_node = p_node;
+}
+
+void MultiplayerAPI::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer) {
+
+ if (network_peer.is_valid()) {
+ network_peer->disconnect("peer_connected", this, "_add_peer");
+ network_peer->disconnect("peer_disconnected", this, "_del_peer");
+ network_peer->disconnect("connection_succeeded", this, "_connected_to_server");
+ network_peer->disconnect("connection_failed", this, "_connection_failed");
+ network_peer->disconnect("server_disconnected", this, "_server_disconnected");
+ clear();
+ }
+
+ network_peer = p_peer;
+
+ ERR_EXPLAIN("Supplied NetworkedNetworkPeer must be connecting or connected.");
+ ERR_FAIL_COND(p_peer.is_valid() && p_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED);
+
+ if (network_peer.is_valid()) {
+ network_peer->connect("peer_connected", this, "_add_peer");
+ network_peer->connect("peer_disconnected", this, "_del_peer");
+ network_peer->connect("connection_succeeded", this, "_connected_to_server");
+ network_peer->connect("connection_failed", this, "_connection_failed");
+ network_peer->connect("server_disconnected", this, "_server_disconnected");
+ }
+}
+
+Ref<NetworkedMultiplayerPeer> MultiplayerAPI::get_network_peer() const {
+ return network_peer;
+}
+
+void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) {
+
+ ERR_FAIL_COND(root_node == NULL);
+ ERR_FAIL_COND(p_packet_len < 1);
+
+ uint8_t packet_type = p_packet[0];
+
+ switch (packet_type) {
+
+ case NETWORK_COMMAND_SIMPLIFY_PATH: {
+
+ _process_simplify_path(p_from, p_packet, p_packet_len);
+ } break;
+
+ case NETWORK_COMMAND_CONFIRM_PATH: {
+
+ _process_confirm_path(p_from, p_packet, p_packet_len);
+ } break;
+
+ case NETWORK_COMMAND_REMOTE_CALL:
+ case NETWORK_COMMAND_REMOTE_SET: {
+
+ ERR_FAIL_COND(p_packet_len < 6);
+
+ Node *node = _process_get_node(p_from, p_packet, p_packet_len);
+
+ ERR_FAIL_COND(node == NULL);
+
+ //detect cstring end
+ int len_end = 5;
+ for (; len_end < p_packet_len; len_end++) {
+ if (p_packet[len_end] == 0) {
+ break;
+ }
+ }
+
+ ERR_FAIL_COND(len_end >= p_packet_len);
+
+ StringName name = String::utf8((const char *)&p_packet[5]);
+
+ if (packet_type == NETWORK_COMMAND_REMOTE_CALL) {
+
+ _process_rpc(node, name, p_from, p_packet, p_packet_len, len_end + 1);
+
+ } else {
+
+ _process_rset(node, name, p_from, p_packet, p_packet_len, len_end + 1);
+ }
+
+ } break;
+
+ case NETWORK_COMMAND_RAW: {
+
+ _process_raw(p_from, p_packet, p_packet_len);
+ } break;
+ }
+}
+
+Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len) {
+
+ uint32_t target = decode_uint32(&p_packet[1]);
+ Node *node = NULL;
+
+ if (target & 0x80000000) {
+ //use full path (not cached yet)
+
+ int ofs = target & 0x7FFFFFFF;
+ ERR_FAIL_COND_V(ofs >= p_packet_len, NULL);
+
+ String paths;
+ paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);
+
+ NodePath np = paths;
+
+ node = root_node->get_node(np);
+
+ if (!node)
+ ERR_PRINTS("Failed to get path from RPC: " + String(np));
+ } else {
+ //use cached path
+ int id = target;
+
+ Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
+ ERR_FAIL_COND_V(!E, NULL);
+
+ Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
+ ERR_FAIL_COND_V(!F, NULL);
+
+ PathGetCache::NodeInfo *ni = &F->get();
+ //do proper caching later
+
+ node = root_node->get_node(ni->path);
+ if (!node)
+ ERR_PRINTS("Failed to get cached path from RPC: " + String(ni->path));
+ }
+ return node;
+}
+
+void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) {
+
+ ERR_FAIL_COND(p_offset >= p_packet_len);
+
+ // Check that remote can call the RPC on this node
+ RPCMode rpc_mode = RPC_MODE_DISABLED;
+ const Map<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_name);
+ if (E) {
+ rpc_mode = E->get();
+ } else if (p_node->get_script_instance()) {
+ rpc_mode = p_node->get_script_instance()->get_rpc_mode(p_name);
+ }
+ ERR_FAIL_COND(!_can_call_mode(p_node, rpc_mode, p_from));
+
+ int argc = p_packet[p_offset];
+ Vector<Variant> args;
+ Vector<const Variant *> argp;
+ args.resize(argc);
+ argp.resize(argc);
+
+ p_offset++;
+
+ for (int i = 0; i < argc; i++) {
+
+ ERR_FAIL_COND(p_offset >= p_packet_len);
+ int vlen;
+ Error err = decode_variant(args[i], &p_packet[p_offset], p_packet_len - p_offset, &vlen);
+ ERR_FAIL_COND(err != OK);
+ //args[i]=p_packet[3+i];
+ argp[i] = &args[i];
+ p_offset += vlen;
+ }
+
+ Variant::CallError ce;
+
+ p_node->call(p_name, (const Variant **)argp.ptr(), argc, ce);
+ if (ce.error != Variant::CallError::CALL_OK) {
+ String error = Variant::get_call_error_text(p_node, p_name, (const Variant **)argp.ptr(), argc, ce);
+ error = "RPC - " + error;
+ ERR_PRINTS(error);
+ }
+}
+
+void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) {
+
+ ERR_FAIL_COND(p_offset >= p_packet_len);
+
+ // Check that remote can call the RSET on this node
+ RPCMode rset_mode = RPC_MODE_DISABLED;
+ const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_name);
+ if (E) {
+ rset_mode = E->get();
+ } else if (p_node->get_script_instance()) {
+ rset_mode = p_node->get_script_instance()->get_rset_mode(p_name);
+ }
+ ERR_FAIL_COND(!_can_call_mode(p_node, rset_mode, p_from));
+
+ Variant value;
+ decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset);
+
+ bool valid;
+
+ p_node->set(p_name, value, &valid);
+ if (!valid) {
+ String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class();
+ ERR_PRINTS(error);
+ }
+}
+
+void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet, int p_packet_len) {
+
+ ERR_FAIL_COND(p_packet_len < 5);
+ int id = decode_uint32(&p_packet[1]);
+
+ String paths;
+ paths.parse_utf8((const char *)&p_packet[5], p_packet_len - 5);
+
+ NodePath path = paths;
+
+ if (!path_get_cache.has(p_from)) {
+ path_get_cache[p_from] = PathGetCache();
+ }
+
+ PathGetCache::NodeInfo ni;
+ ni.path = path;
+ ni.instance = 0;
+
+ path_get_cache[p_from].nodes[id] = ni;
+
+ //send ack
+
+ //encode path
+ CharString pname = String(path).utf8();
+ int len = encode_cstring(pname.get_data(), NULL);
+
+ Vector<uint8_t> packet;
+
+ packet.resize(1 + len);
+ packet[0] = NETWORK_COMMAND_CONFIRM_PATH;
+ encode_cstring(pname.get_data(), &packet[1]);
+
+ network_peer->set_transfer_mode(NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
+ network_peer->set_target_peer(p_from);
+ network_peer->put_packet(packet.ptr(), packet.size());
+}
+
+void MultiplayerAPI::_process_confirm_path(int p_from, const uint8_t *p_packet, int p_packet_len) {
+
+ ERR_FAIL_COND(p_packet_len < 2);
+
+ String paths;
+ paths.parse_utf8((const char *)&p_packet[1], p_packet_len - 1);
+
+ NodePath path = paths;
+
+ PathSentCache *psc = path_send_cache.getptr(path);
+ ERR_FAIL_COND(!psc);
+
+ Map<int, bool>::Element *E = psc->confirmed_peers.find(p_from);
+ ERR_FAIL_COND(!E);
+ E->get() = true;
+}
+
+bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int p_target) {
+ bool has_all_peers = true;
+ List<int> peers_to_add; //if one is missing, take note to add it
+
+ for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
+
+ if (p_target < 0 && E->get() == -p_target)
+ continue; //continue, excluded
+
+ if (p_target > 0 && E->get() != p_target)
+ continue; //continue, not for this peer
+
+ Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
+
+ if (!F || F->get() == false) {
+ //path was not cached, or was cached but is unconfirmed
+ if (!F) {
+ //not cached at all, take note
+ peers_to_add.push_back(E->get());
+ }
+
+ has_all_peers = false;
+ }
+ }
+
+ //those that need to be added, send a message for this
+
+ for (List<int>::Element *E = peers_to_add.front(); E; E = E->next()) {
+
+ //encode function name
+ CharString pname = String(p_path).utf8();
+ int len = encode_cstring(pname.get_data(), NULL);
+
+ Vector<uint8_t> packet;
+
+ packet.resize(1 + 4 + len);
+ packet[0] = NETWORK_COMMAND_SIMPLIFY_PATH;
+ encode_uint32(psc->id, &packet[1]);
+ encode_cstring(pname.get_data(), &packet[5]);
+
+ network_peer->set_target_peer(E->get()); //to all of you
+ network_peer->set_transfer_mode(NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
+ network_peer->put_packet(packet.ptr(), packet.size());
+
+ psc->confirmed_peers.insert(E->get(), false); //insert into confirmed, but as false since it was not confirmed
+ }
+
+ return has_all_peers;
+}
+
+void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount) {
+
+ if (network_peer.is_null()) {
+ ERR_EXPLAIN("Attempt to remote call/set when networking is not active in SceneTree.");
+ ERR_FAIL();
+ }
+
+ if (network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_CONNECTING) {
+ ERR_EXPLAIN("Attempt to remote call/set when networking is not connected yet in SceneTree.");
+ ERR_FAIL();
+ }
+
+ if (network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED) {
+ ERR_EXPLAIN("Attempt to remote call/set when networking is disconnected.");
+ ERR_FAIL();
+ }
+
+ if (p_argcount > 255) {
+ ERR_EXPLAIN("Too many arguments >255.");
+ ERR_FAIL();
+ }
+
+ if (p_to != 0 && !connected_peers.has(ABS(p_to))) {
+ if (p_to == network_peer->get_unique_id()) {
+ ERR_EXPLAIN("Attempt to remote call/set yourself! unique ID: " + itos(network_peer->get_unique_id()));
+ } else {
+ ERR_EXPLAIN("Attempt to remote call unexisting ID: " + itos(p_to));
+ }
+
+ ERR_FAIL();
+ }
+
+ NodePath from_path = (root_node->get_path()).rel_path_to(p_from->get_path());
+ ERR_FAIL_COND(from_path.is_empty());
+
+ //see if the path is cached
+ PathSentCache *psc = path_send_cache.getptr(from_path);
+ if (!psc) {
+ //path is not cached, create
+ path_send_cache[from_path] = PathSentCache();
+ psc = path_send_cache.getptr(from_path);
+ psc->id = last_send_cache_id++;
+ }
+
+ //create base packet, lots of hardcode because it must be tight
+
+ int ofs = 0;
+
+#define MAKE_ROOM(m_amount) \
+ if (packet_cache.size() < m_amount) packet_cache.resize(m_amount);
+
+ //encode type
+ MAKE_ROOM(1);
+ packet_cache[0] = p_set ? NETWORK_COMMAND_REMOTE_SET : NETWORK_COMMAND_REMOTE_CALL;
+ ofs += 1;
+
+ //encode ID
+ MAKE_ROOM(ofs + 4);
+ encode_uint32(psc->id, &(packet_cache[ofs]));
+ ofs += 4;
+
+ //encode function name
+ CharString name = String(p_name).utf8();
+ int len = encode_cstring(name.get_data(), NULL);
+ MAKE_ROOM(ofs + len);
+ encode_cstring(name.get_data(), &(packet_cache[ofs]));
+ ofs += len;
+
+ if (p_set) {
+ //set argument
+ Error err = encode_variant(*p_arg[0], NULL, len);
+ ERR_FAIL_COND(err != OK);
+ MAKE_ROOM(ofs + len);
+ encode_variant(*p_arg[0], &(packet_cache[ofs]), len);
+ ofs += len;
+
+ } else {
+ //call arguments
+ MAKE_ROOM(ofs + 1);
+ packet_cache[ofs] = p_argcount;
+ ofs += 1;
+ for (int i = 0; i < p_argcount; i++) {
+ Error err = encode_variant(*p_arg[i], NULL, len);
+ ERR_FAIL_COND(err != OK);
+ MAKE_ROOM(ofs + len);
+ encode_variant(*p_arg[i], &(packet_cache[ofs]), len);
+ ofs += len;
+ }
+ }
+
+ //see if all peers have cached path (is so, call can be fast)
+ bool has_all_peers = _send_confirm_path(from_path, psc, p_to);
+
+ //take chance and set transfer mode, since all send methods will use it
+ network_peer->set_transfer_mode(p_unreliable ? NetworkedMultiplayerPeer::TRANSFER_MODE_UNRELIABLE : NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
+
+ if (has_all_peers) {
+
+ //they all have verified paths, so send fast
+ network_peer->set_target_peer(p_to); //to all of you
+ network_peer->put_packet(packet_cache.ptr(), ofs); //a message with love
+ } else {
+ //not all verified path, so send one by one
+
+ //apend path at the end, since we will need it for some packets
+ CharString pname = String(from_path).utf8();
+ int path_len = encode_cstring(pname.get_data(), NULL);
+ MAKE_ROOM(ofs + path_len);
+ encode_cstring(pname.get_data(), &(packet_cache[ofs]));
+
+ for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
+
+ if (p_to < 0 && E->get() == -p_to)
+ continue; //continue, excluded
+
+ if (p_to > 0 && E->get() != p_to)
+ continue; //continue, not for this peer
+
+ Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
+ ERR_CONTINUE(!F); //should never happen
+
+ network_peer->set_target_peer(E->get()); //to this one specifically
+
+ if (F->get() == true) {
+ //this one confirmed path, so use id
+ encode_uint32(psc->id, &(packet_cache[1]));
+ network_peer->put_packet(packet_cache.ptr(), ofs);
+ } else {
+ //this one did not confirm path yet, so use entire path (sorry!)
+ encode_uint32(0x80000000 | ofs, &(packet_cache[1])); //offset to path and flag
+ network_peer->put_packet(packet_cache.ptr(), ofs + path_len);
+ }
+ }
+ }
+}
+
+void MultiplayerAPI::_add_peer(int p_id) {
+ connected_peers.insert(p_id);
+ path_get_cache.insert(p_id, PathGetCache());
+ emit_signal("network_peer_connected", p_id);
+}
+
+void MultiplayerAPI::_del_peer(int p_id) {
+ connected_peers.erase(p_id);
+ path_get_cache.erase(p_id); //I no longer need your cache, sorry
+ emit_signal("network_peer_disconnected", p_id);
+}
+
+void MultiplayerAPI::_connected_to_server() {
+
+ emit_signal("connected_to_server");
+}
+
+void MultiplayerAPI::_connection_failed() {
+
+ emit_signal("connection_failed");
+}
+
+void MultiplayerAPI::_server_disconnected() {
+
+ emit_signal("server_disconnected");
+}
+
+void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount) {
+
+ ERR_FAIL_COND(!p_node->is_inside_tree());
+ ERR_FAIL_COND(!network_peer.is_valid());
+
+ int node_id = network_peer->get_unique_id();
+ bool skip_rpc = false;
+ bool call_local_native = false;
+ bool call_local_script = false;
+ bool is_master = p_node->is_network_master();
+
+ if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) {
+ //check that send mode can use local call
+
+ const Map<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_method);
+ if (E) {
+ call_local_native = _should_call_local(E->get(), is_master, skip_rpc);
+ }
+
+ if (call_local_native) {
+ // done below
+ } else if (p_node->get_script_instance()) {
+ //attempt with script
+ RPCMode rpc_mode = p_node->get_script_instance()->get_rpc_mode(p_method);
+ call_local_script = _should_call_local(rpc_mode, is_master, skip_rpc);
+ }
+ }
+
+ if (!skip_rpc) {
+ _send_rpc(p_node, p_peer_id, p_unreliable, false, p_method, p_arg, p_argcount);
+ }
+
+ if (call_local_native) {
+ Variant::CallError ce;
+ p_node->call(p_method, p_arg, p_argcount, ce);
+ if (ce.error != Variant::CallError::CALL_OK) {
+ String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce);
+ error = "rpc() aborted in local call: - " + error;
+ ERR_PRINTS(error);
+ return;
+ }
+ }
+
+ if (call_local_script) {
+ Variant::CallError ce;
+ ce.error = Variant::CallError::CALL_OK;
+ p_node->get_script_instance()->call(p_method, p_arg, p_argcount, ce);
+ if (ce.error != Variant::CallError::CALL_OK) {
+ String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce);
+ error = "rpc() aborted in script local call: - " + error;
+ ERR_PRINTS(error);
+ return;
+ }
+ }
+}
+
+void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) {
+
+ ERR_FAIL_COND(!p_node->is_inside_tree());
+ ERR_FAIL_COND(!network_peer.is_valid());
+
+ int node_id = network_peer->get_unique_id();
+ bool is_master = p_node->is_network_master();
+ bool skip_rset = false;
+
+ if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) {
+ //check that send mode can use local call
+
+ bool set_local = false;
+
+ const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_property);
+ if (E) {
+
+ set_local = _should_call_local(E->get(), is_master, skip_rset);
+ }
+
+ if (set_local) {
+ bool valid;
+ p_node->set(p_property, p_value, &valid);
+
+ if (!valid) {
+ String error = "rset() aborted in local set, property not found: - " + String(p_property);
+ ERR_PRINTS(error);
+ return;
+ }
+ } else if (p_node->get_script_instance()) {
+ //attempt with script
+ RPCMode rpc_mode = p_node->get_script_instance()->get_rset_mode(p_property);
+
+ set_local = _should_call_local(rpc_mode, is_master, skip_rset);
+
+ if (set_local) {
+
+ bool valid = p_node->get_script_instance()->set(p_property, p_value);
+
+ if (!valid) {
+ String error = "rset() aborted in local script set, property not found: - " + String(p_property);
+ ERR_PRINTS(error);
+ return;
+ }
+ }
+ }
+ }
+
+ if (skip_rset)
+ return;
+
+ const Variant *vptr = &p_value;
+
+ _send_rpc(p_node, p_peer_id, p_unreliable, true, p_property, &vptr, 1);
+}
+
+Error MultiplayerAPI::send_bytes(PoolVector<uint8_t> p_data, int p_to) {
+
+ ERR_FAIL_COND_V(p_data.size() < 1, ERR_INVALID_DATA);
+ ERR_FAIL_COND_V(!network_peer.is_valid(), ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED);
+
+ MAKE_ROOM(p_data.size() + 1);
+ PoolVector<uint8_t>::Read r = p_data.read();
+ packet_cache[0] = NETWORK_COMMAND_RAW;
+ memcpy(&packet_cache[1], &r[0], p_data.size());
+ network_peer->set_target_peer(p_to);
+ return network_peer->put_packet(packet_cache.ptr(), p_data.size() + 1);
+}
+
+void MultiplayerAPI::_process_raw(int p_from, const uint8_t *p_packet, int p_packet_len) {
+
+ ERR_FAIL_COND(p_packet_len < 2);
+
+ PoolVector<uint8_t> out;
+ int len = p_packet_len - 1;
+ out.resize(len);
+ {
+ PoolVector<uint8_t>::Write w = out.write();
+ memcpy(&w[0], &p_packet[1], len);
+ }
+ emit_signal("network_peer_packet", p_from, out);
+}
+
+int MultiplayerAPI::get_network_unique_id() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(), 0);
+ return network_peer->get_unique_id();
+}
+
+bool MultiplayerAPI::is_network_server() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(), false);
+ return network_peer->is_server();
+}
+
+void MultiplayerAPI::set_refuse_new_network_connections(bool p_refuse) {
+
+ ERR_FAIL_COND(!network_peer.is_valid());
+ network_peer->set_refuse_new_connections(p_refuse);
+}
+
+bool MultiplayerAPI::is_refusing_new_network_connections() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(), false);
+ return network_peer->is_refusing_new_connections();
+}
+
+Vector<int> MultiplayerAPI::get_network_connected_peers() const {
+
+ ERR_FAIL_COND_V(!network_peer.is_valid(), Vector<int>());
+
+ Vector<int> ret;
+ for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
+ ret.push_back(E->get());
+ }
+
+ return ret;
+}
+
+void MultiplayerAPI::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_root_node", "node"), &MultiplayerAPI::set_root_node);
+ ClassDB::bind_method(D_METHOD("send_bytes", "bytes", "id"), &MultiplayerAPI::send_bytes, DEFVAL(NetworkedMultiplayerPeer::TARGET_PEER_BROADCAST));
+ ClassDB::bind_method(D_METHOD("has_network_peer"), &MultiplayerAPI::has_network_peer);
+ ClassDB::bind_method(D_METHOD("get_network_peer"), &MultiplayerAPI::get_network_peer);
+ ClassDB::bind_method(D_METHOD("get_network_unique_id"), &MultiplayerAPI::get_network_unique_id);
+ ClassDB::bind_method(D_METHOD("is_network_server"), &MultiplayerAPI::is_network_server);
+ ClassDB::bind_method(D_METHOD("get_rpc_sender_id"), &MultiplayerAPI::get_rpc_sender_id);
+ ClassDB::bind_method(D_METHOD("_add_peer", "id"), &MultiplayerAPI::_add_peer);
+ ClassDB::bind_method(D_METHOD("_del_peer", "id"), &MultiplayerAPI::_del_peer);
+ ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &MultiplayerAPI::set_network_peer);
+ ClassDB::bind_method(D_METHOD("poll"), &MultiplayerAPI::poll);
+ ClassDB::bind_method(D_METHOD("clear"), &MultiplayerAPI::clear);
+
+ ClassDB::bind_method(D_METHOD("_connected_to_server"), &MultiplayerAPI::_connected_to_server);
+ ClassDB::bind_method(D_METHOD("_connection_failed"), &MultiplayerAPI::_connection_failed);
+ ClassDB::bind_method(D_METHOD("_server_disconnected"), &MultiplayerAPI::_server_disconnected);
+ ClassDB::bind_method(D_METHOD("get_network_connected_peers"), &MultiplayerAPI::get_network_connected_peers);
+ ClassDB::bind_method(D_METHOD("set_refuse_new_network_connections", "refuse"), &MultiplayerAPI::set_refuse_new_network_connections);
+ ClassDB::bind_method(D_METHOD("is_refusing_new_network_connections"), &MultiplayerAPI::is_refusing_new_network_connections);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer");
+
+ ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("network_peer_disconnected", PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("network_peer_packet", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::POOL_BYTE_ARRAY, "packet")));
+ ADD_SIGNAL(MethodInfo("connected_to_server"));
+ ADD_SIGNAL(MethodInfo("connection_failed"));
+ ADD_SIGNAL(MethodInfo("server_disconnected"));
+
+ BIND_ENUM_CONSTANT(RPC_MODE_DISABLED);
+ BIND_ENUM_CONSTANT(RPC_MODE_REMOTE);
+ BIND_ENUM_CONSTANT(RPC_MODE_SYNC);
+ BIND_ENUM_CONSTANT(RPC_MODE_MASTER);
+ BIND_ENUM_CONSTANT(RPC_MODE_SLAVE);
+ BIND_ENUM_CONSTANT(RPC_MODE_REMOTESYNC);
+ BIND_ENUM_CONSTANT(RPC_MODE_MASTERSYNC);
+ BIND_ENUM_CONSTANT(RPC_MODE_SLAVESYNC);
+}
+
+MultiplayerAPI::MultiplayerAPI() {
+ clear();
+}
+
+MultiplayerAPI::~MultiplayerAPI() {
+ clear();
+}
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
new file mode 100644
index 0000000000..ef56c4c7f2
--- /dev/null
+++ b/core/io/multiplayer_api.h
@@ -0,0 +1,134 @@
+/*************************************************************************/
+/* multiplayer_api.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef MULTIPLAYER_PROTOCOL_H
+#define MULTIPLAYER_PROTOCOL_H
+
+#include "core/io/networked_multiplayer_peer.h"
+#include "core/reference.h"
+
+class MultiplayerAPI : public Reference {
+
+ GDCLASS(MultiplayerAPI, Reference);
+
+private:
+ //path sent caches
+ struct PathSentCache {
+ Map<int, bool> confirmed_peers;
+ int id;
+ };
+
+ //path get caches
+ struct PathGetCache {
+ struct NodeInfo {
+ NodePath path;
+ ObjectID instance;
+ };
+
+ Map<int, NodeInfo> nodes;
+ };
+
+ Ref<NetworkedMultiplayerPeer> network_peer;
+ int rpc_sender_id;
+ Set<int> connected_peers;
+ HashMap<NodePath, PathSentCache> path_send_cache;
+ Map<int, PathGetCache> path_get_cache;
+ int last_send_cache_id;
+ Vector<uint8_t> packet_cache;
+ Node *root_node;
+
+protected:
+ static void _bind_methods();
+
+ void _process_packet(int p_from, const uint8_t *p_packet, int p_packet_len);
+ void _process_simplify_path(int p_from, const uint8_t *p_packet, int p_packet_len);
+ void _process_confirm_path(int p_from, const uint8_t *p_packet, int p_packet_len);
+ Node *_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len);
+ void _process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset);
+ void _process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset);
+ void _process_raw(int p_from, const uint8_t *p_packet, int p_packet_len);
+
+ void _send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount);
+ bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_from);
+
+public:
+ enum NetworkCommands {
+ NETWORK_COMMAND_REMOTE_CALL,
+ NETWORK_COMMAND_REMOTE_SET,
+ NETWORK_COMMAND_SIMPLIFY_PATH,
+ NETWORK_COMMAND_CONFIRM_PATH,
+ NETWORK_COMMAND_RAW,
+ };
+
+ enum RPCMode {
+
+ RPC_MODE_DISABLED, // No rpc for this method, calls to this will be blocked (default)
+ RPC_MODE_REMOTE, // Using rpc() on it will call method / set property in all remote peers
+ RPC_MODE_SYNC, // Using rpc() on it will call method / set property in all remote peers and locally
+ RPC_MODE_MASTER, // Using rpc() on it will call method on wherever the master is, be it local or remote
+ RPC_MODE_SLAVE, // Using rpc() on it will call method for all slaves
+ RPC_MODE_REMOTESYNC, // Same as RPC_MODE_SYNC, compatibility
+ RPC_MODE_MASTERSYNC, // Using rpc() on it will call method / set property in the master peer and locally
+ RPC_MODE_SLAVESYNC, // Using rpc() on it will call method / set property in all slave peers and locally
+ };
+
+ void poll();
+ void clear();
+ void set_root_node(Node *p_node);
+ void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer);
+ Ref<NetworkedMultiplayerPeer> get_network_peer() const;
+ Error send_bytes(PoolVector<uint8_t> p_data, int p_to = NetworkedMultiplayerPeer::TARGET_PEER_BROADCAST);
+
+ // Called by Node.rpc
+ void rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount);
+ // Called by Node.rset
+ void rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value);
+
+ void _add_peer(int p_id);
+ void _del_peer(int p_id);
+ void _connected_to_server();
+ void _connection_failed();
+ void _server_disconnected();
+
+ bool has_network_peer() const { return network_peer.is_valid(); }
+ Vector<int> get_network_connected_peers() const;
+ int get_rpc_sender_id() const { return rpc_sender_id; }
+ int get_network_unique_id() const;
+ bool is_network_server() const;
+ void set_refuse_new_network_connections(bool p_refuse);
+ bool is_refusing_new_network_connections() const;
+
+ MultiplayerAPI();
+ ~MultiplayerAPI();
+};
+
+VARIANT_ENUM_CAST(MultiplayerAPI::RPCMode);
+
+#endif // MULTIPLAYER_PROTOCOL_H
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index bd851ebb6d..b777a9f960 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -172,6 +172,7 @@ Error PacketPeerStream::_poll_buffer() const {
ERR_FAIL_COND_V(peer.is_null(), ERR_UNCONFIGURED);
int read = 0;
+ ERR_FAIL_COND_V(input_buffer.size() < ring_buffer.space_left(), ERR_UNAVAILABLE);
Error err = peer->get_partial_data(&input_buffer[0], ring_buffer.space_left(), read);
if (err)
return err;
@@ -223,6 +224,7 @@ Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size)
uint32_t len = decode_uint32(lbuf);
ERR_FAIL_COND_V(remaining < (int)len, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(input_buffer.size() < len, ERR_UNAVAILABLE);
ring_buffer.read(lbuf, 4); //get rid of first 4 bytes
ring_buffer.read(&input_buffer[0], len); // read packet
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 596060221e..b6377662de 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "pck_packer.h"
-
#include "core/os/file_access.h"
+#include "version.h"
static uint64_t _align(uint64_t p_n, int p_alignment) {
@@ -70,9 +70,9 @@ Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
alignment = p_alignment;
file->store_32(0x43504447); // MAGIC
- file->store_32(0); // # version
- file->store_32(0); // # major
- file->store_32(0); // # minor
+ file->store_32(1); // # version
+ file->store_32(VERSION_MAJOR); // # major
+ file->store_32(VERSION_MINOR); // # minor
file->store_32(0); // # revision
for (int i = 0; i < 16; i++) {
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 5dfe067902..0c626c197b 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1162,9 +1162,11 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
ERR_FAIL_V(ERR_FILE_UNRECOGNIZED);
}
- fw->store_32(VERSION_MAJOR); //current version
- fw->store_32(VERSION_MINOR);
- fw->store_32(FORMAT_VERSION);
+ // Since we're not actually converting the file contents, leave the version
+ // numbers in the file untouched.
+ fw->store_32(ver_major);
+ fw->store_32(ver_minor);
+ fw->store_32(ver_format);
save_ustring(fw, get_ustring(f)); //type
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 609dd7e93c..3dcd94880a 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -56,7 +56,7 @@ Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
- if (E->get().nocasecmp_to(extension.get_extension()) == 0)
+ if (E->get().nocasecmp_to(extension) == 0)
recognized = true;
}
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index 07a01ff99f..012ba78c6d 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "stream_peer_ssl.h"
+#include "os/file_access.h"
+#include "project_settings.h"
StreamPeerSSL *(*StreamPeerSSL::_create)() = NULL;
@@ -50,6 +52,35 @@ bool StreamPeerSSL::is_available() {
return available;
}
+PoolByteArray StreamPeerSSL::get_project_cert_array() {
+
+ PoolByteArray out;
+ String certs_path = GLOBAL_DEF("network/ssl/certificates", "");
+ ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificates", PropertyInfo(Variant::STRING, "network/ssl/certificates", PROPERTY_HINT_FILE, "*.crt"));
+
+ if (certs_path != "") {
+
+ FileAccess *f = FileAccess::open(certs_path, FileAccess::READ);
+ if (f) {
+ int flen = f->get_len();
+ out.resize(flen + 1);
+ {
+ PoolByteArray::Write w = out.write();
+ f->get_buffer(w.ptr(), flen);
+ w[flen] = 0; //end f string
+ }
+
+ memdelete(f);
+
+#ifdef DEBUG_ENABLED
+ print_line("Loaded certs from '" + certs_path);
+#endif
+ }
+ }
+
+ return out;
+}
+
void StreamPeerSSL::_bind_methods() {
ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSSL::poll);
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index f903438c28..77301a7c87 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -66,6 +66,7 @@ public:
static StreamPeerSSL *create();
+ static PoolByteArray get_project_cert_array();
static void load_certs_from_memory(const PoolByteArray &p_memory);
static bool is_available();
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index e01e2a84c5..16d5e3c282 100644
--- a/core/io/translation_loader_po.cpp
+++ b/core/io/translation_loader_po.cpp
@@ -175,7 +175,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S
String prop = c.substr(0, p).strip_edges();
String value = c.substr(p + 1, c.length()).strip_edges();
- if (prop == "X-Language") {
+ if (prop == "X-Language" || prop == "Language") {
translation->set_locale(value);
}
}
diff --git a/core/make_binders.py b/core/make_binders.py
index 1e581f8ce3..6a7602cd5d 100644
--- a/core/make_binders.py
+++ b/core/make_binders.py
@@ -265,10 +265,8 @@ def run(target, source, env):
else:
text += t
- f = open(target[0].path, "w")
- f.write(text)
- f.close()
+ with open(target[0].path, "w") as f:
+ f.write(text)
- f = open(target[1].path, "w")
- f.write(text_ext)
- f.close()
+ with open(target[1].path, "w") as f:
+ f.write(text_ext)
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 6908d7831d..021391da83 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -96,11 +96,11 @@ void AStar::remove_point(int p_id) {
Point *p = points[p_id];
- for (int i = 0; i < p->neighbours.size(); i++) {
+ for (Set<Point *>::Element *E = p->neighbours.front(); E; E = E->next()) {
- Segment s(p_id, p->neighbours[i]->id);
+ Segment s(p_id, E->get()->id);
segments.erase(s);
- p->neighbours[i]->neighbours.erase(p);
+ E->get()->neighbours.erase(p);
}
memdelete(p);
@@ -115,10 +115,10 @@ void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) {
Point *a = points[p_id];
Point *b = points[p_with_id];
- a->neighbours.push_back(b);
+ a->neighbours.insert(b);
if (bidirectional)
- b->neighbours.push_back(a);
+ b->neighbours.insert(a);
Segment s(p_id, p_with_id);
if (s.from == p_id) {
@@ -168,8 +168,8 @@ PoolVector<int> AStar::get_point_connections(int p_id) {
Point *p = points[p_id];
- for (int i = 0; i < p->neighbours.size(); i++) {
- point_list.push_back(p->neighbours[i]->id);
+ for (Set<Point *>::Element *E = p->neighbours.front(); E; E = E->next()) {
+ point_list.push_back(E->get()->id);
}
return point_list;
@@ -242,9 +242,9 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
bool found_route = false;
- for (int i = 0; i < begin_point->neighbours.size(); i++) {
+ for (Set<Point *>::Element *E = begin_point->neighbours.front(); E; E = E->next()) {
- Point *n = begin_point->neighbours[i];
+ Point *n = E->get();
n->prev_point = begin_point;
n->distance = _compute_cost(begin_point->id, n->id) * n->weight_scale;
n->last_pass = pass;
@@ -283,12 +283,10 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
}
Point *p = least_cost_point->self();
- // Open the neighbours for search
- int es = p->neighbours.size();
- for (int i = 0; i < es; i++) {
+ for (Set<Point *>::Element *E = p->neighbours.front(); E; E = E->next()) {
- Point *e = p->neighbours[i];
+ Point *e = E->get();
real_t distance = _compute_cost(p->id, e->id) * e->weight_scale + p->distance;
diff --git a/core/math/a_star.h b/core/math/a_star.h
index f89e17c7bb..8c1b5f64cb 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -54,7 +54,7 @@ class AStar : public Reference {
real_t weight_scale;
uint64_t last_pass;
- Vector<Point *> neighbours;
+ Set<Point *> neighbours;
// Used for pathfinding
Point *prev_point;
diff --git a/core/math/aabb.h b/core/math/aabb.h
index 39b8f403e7..cdb8eb48a3 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -76,6 +76,7 @@ public:
_FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
_FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const;
+ _FORCE_INLINE_ bool inside_convex_shape(const Plane *p_planes, int p_plane_count) const;
bool intersects_plane(const Plane &p_plane) const;
_FORCE_INLINE_ bool has_point(const Vector3 &p_point) const;
@@ -207,6 +208,25 @@ bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) con
return true;
}
+bool AABB::inside_convex_shape(const Plane *p_planes, int p_plane_count) const {
+
+ Vector3 half_extents = size * 0.5;
+ Vector3 ofs = position + half_extents;
+
+ for (int i = 0; i < p_plane_count; i++) {
+ const Plane &p = p_planes[i];
+ Vector3 point(
+ (p.normal.x < 0) ? -half_extents.x : half_extents.x,
+ (p.normal.y < 0) ? -half_extents.y : half_extents.y,
+ (p.normal.z < 0) ? -half_extents.z : half_extents.z);
+ point += ofs;
+ if (p.is_point_over(point))
+ return false;
+ }
+
+ return true;
+}
+
bool AABB::has_point(const Vector3 &p_point) const {
if (p_point.x < position.x)
diff --git a/core/math/delaunay.cpp b/core/math/delaunay.cpp
new file mode 100644
index 0000000000..8cae92b7c0
--- /dev/null
+++ b/core/math/delaunay.cpp
@@ -0,0 +1 @@
+#include "delaunay.h"
diff --git a/core/math/delaunay.h b/core/math/delaunay.h
new file mode 100644
index 0000000000..09aebc773f
--- /dev/null
+++ b/core/math/delaunay.h
@@ -0,0 +1,145 @@
+#ifndef DELAUNAY_H
+#define DELAUNAY_H
+
+#include "math_2d.h"
+
+class Delaunay2D {
+public:
+ struct Triangle {
+
+ int points[3];
+ bool bad;
+ Triangle() { bad = false; }
+ Triangle(int p_a, int p_b, int p_c) {
+ points[0] = p_a;
+ points[1] = p_b;
+ points[2] = p_c;
+ bad = false;
+ }
+ };
+
+ struct Edge {
+ int edge[2];
+ bool bad;
+ Edge() { bad = false; }
+ Edge(int p_a, int p_b) {
+ bad = false;
+ edge[0] = p_a;
+ edge[1] = p_b;
+ }
+ };
+
+ static bool circum_circle_contains(const Vector<Vector2> &p_vertices, const Triangle &p_triangle, int p_vertex) {
+
+ Vector2 p1 = p_vertices[p_triangle.points[0]];
+ Vector2 p2 = p_vertices[p_triangle.points[1]];
+ Vector2 p3 = p_vertices[p_triangle.points[2]];
+
+ real_t ab = p1.x * p1.x + p1.y * p1.y;
+ real_t cd = p2.x * p2.x + p2.y * p2.y;
+ real_t ef = p3.x * p3.x + p3.y * p3.y;
+
+ Vector2 circum(
+ (ab * (p3.y - p2.y) + cd * (p1.y - p3.y) + ef * (p2.y - p1.y)) / (p1.x * (p3.y - p2.y) + p2.x * (p1.y - p3.y) + p3.x * (p2.y - p1.y)),
+ (ab * (p3.x - p2.x) + cd * (p1.x - p3.x) + ef * (p2.x - p1.x)) / (p1.y * (p3.x - p2.x) + p2.y * (p1.x - p3.x) + p3.y * (p2.x - p1.x)));
+
+ circum *= 0.5;
+ float r = p1.distance_squared_to(circum);
+ float d = p_vertices[p_vertex].distance_squared_to(circum);
+ return d <= r;
+ }
+
+ static bool edge_compare(const Vector<Vector2> &p_vertices, const Edge &p_a, const Edge &p_b) {
+ if (p_vertices[p_a.edge[0]].distance_to(p_vertices[p_b.edge[0]]) < CMP_EPSILON && p_vertices[p_a.edge[1]].distance_to(p_vertices[p_b.edge[1]]) < CMP_EPSILON) {
+ return true;
+ }
+
+ if (p_vertices[p_a.edge[0]].distance_to(p_vertices[p_b.edge[1]]) < CMP_EPSILON && p_vertices[p_a.edge[1]].distance_to(p_vertices[p_b.edge[0]]) < CMP_EPSILON) {
+ return true;
+ }
+
+ return false;
+ }
+
+ static Vector<Triangle> triangulate(const Vector<Vector2> &p_points) {
+
+ Vector<Vector2> points = p_points;
+ Vector<Triangle> triangles;
+
+ Rect2 rect;
+ for (int i = 0; i < p_points.size(); i++) {
+ if (i == 0) {
+ rect.position = p_points[i];
+ } else {
+ rect.expand_to(p_points[i]);
+ }
+ }
+
+ float delta_max = MAX(rect.size.width, rect.size.height);
+ Vector2 center = rect.position + rect.size * 0.5;
+
+ points.push_back(Vector2(center.x - 20 * delta_max, center.y - delta_max));
+ points.push_back(Vector2(center.x, center.y + 20 * delta_max));
+ points.push_back(Vector2(center.x + 20 * delta_max, center.y - delta_max));
+
+ triangles.push_back(Triangle(p_points.size() + 0, p_points.size() + 1, p_points.size() + 2));
+
+ for (int i = 0; i < p_points.size(); i++) {
+ //std::cout << "Traitement du point " << *p << std::endl;
+ //std::cout << "_triangles contains " << _triangles.size() << " elements" << std::endl;
+
+ Vector<Edge> polygon;
+
+ for (int j = 0; j < triangles.size(); j++) {
+ if (circum_circle_contains(points, triangles[j], i)) {
+ triangles[j].bad = true;
+ polygon.push_back(Edge(triangles[j].points[0], triangles[j].points[1]));
+ polygon.push_back(Edge(triangles[j].points[1], triangles[j].points[2]));
+ polygon.push_back(Edge(triangles[j].points[2], triangles[j].points[0]));
+ }
+ }
+
+ for (int j = 0; j < triangles.size(); j++) {
+ if (triangles[j].bad) {
+ triangles.remove(j);
+ j--;
+ }
+ }
+
+ for (int j = 0; j < polygon.size(); j++) {
+ for (int k = j + 1; k < polygon.size(); k++) {
+ if (edge_compare(points, polygon[j], polygon[k])) {
+ polygon[j].bad = true;
+ polygon[k].bad = true;
+ }
+ }
+ }
+
+ for (int j = 0; j < polygon.size(); j++) {
+
+ if (polygon[j].bad) {
+ continue;
+ }
+ triangles.push_back(Triangle(polygon[j].edge[0], polygon[j].edge[1], i));
+ }
+ }
+
+ for (int i = 0; i < triangles.size(); i++) {
+ bool invalid = false;
+ for (int j = 0; j < 3; j++) {
+ if (triangles[i].points[j] >= p_points.size()) {
+ invalid = true;
+ break;
+ }
+ }
+ if (invalid) {
+ triangles.remove(i);
+ i--;
+ }
+ }
+
+ return triangles;
+ }
+};
+
+#endif // DELAUNAY_H
diff --git a/core/math/geometry.h b/core/math/geometry.h
index ca4363e129..be998aef0b 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -502,16 +502,15 @@ public:
}
static bool is_point_in_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) {
- int as_x = s.x - a.x;
- int as_y = s.y - a.y;
+ Vector2 an = a - s;
+ Vector2 bn = b - s;
+ Vector2 cn = c - s;
- bool s_ab = (b.x - a.x) * as_y - (b.y - a.y) * as_x > 0;
+ bool orientation = an.cross(bn) > 0;
- if (((c.x - a.x) * as_y - (c.y - a.y) * as_x > 0) == s_ab) return false;
+ if ((bn.cross(cn) > 0) != orientation) return false;
- if (((c.x - b.x) * (s.y - b.y) - (c.y - b.y) * (s.x - b.x) > 0) != s_ab) return false;
-
- return true;
+ return (cn.cross(an) > 0) == orientation;
}
static bool is_point_in_polygon(const Vector2 &p_point, const Vector<Vector2> &p_polygon);
@@ -530,6 +529,21 @@ public:
return p_segment[0] + n * d; // inside
}
+ static bool line_intersects_line_2d(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b, Vector2 &r_result) {
+
+ // see http://paulbourke.net/geometry/pointlineplane/
+
+ const real_t denom = p_dir_b.y * p_dir_a.x - p_dir_b.x * p_dir_a.y;
+ if (Math::abs(denom) < CMP_EPSILON) { // parallel?
+ return false;
+ }
+
+ const Vector2 v = p_from_a - p_from_b;
+ const real_t t = (p_dir_b.x * v.y - p_dir_b.y * v.x) / denom;
+ r_result = p_from_a + t * p_dir_a;
+ return true;
+ }
+
static bool segment_intersects_segment_2d(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b, Vector2 *r_result) {
Vector2 B = p_to_a - p_from_a;
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index d2e4101999..a053ffbd93 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -98,14 +98,19 @@ real_t Vector2::cross(const Vector2 &p_other) const {
return x * p_other.y - y * p_other.x;
}
-Vector2 Vector2::cross(real_t p_other) const {
+Vector2 Vector2::floor() const {
- return Vector2(p_other * y, -p_other * x);
+ return Vector2(Math::floor(x), Math::floor(y));
}
-Vector2 Vector2::floor() const {
+Vector2 Vector2::ceil() const {
- return Vector2(Math::floor(x), Math::floor(y));
+ return Vector2(Math::ceil(x), Math::ceil(y));
+}
+
+Vector2 Vector2::round() const {
+
+ return Vector2(Math::round(x), Math::round(y));
}
Vector2 Vector2::rotated(real_t p_by) const {
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index 8928349a44..25c39e5d7a 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -104,7 +104,6 @@ struct Vector2 {
real_t dot(const Vector2 &p_other) const;
real_t cross(const Vector2 &p_other) const;
- Vector2 cross(real_t p_other) const;
Vector2 project(const Vector2 &p_vec) const;
Vector2 plane_project(real_t p_d, const Vector2 &p_vec) const;
@@ -113,6 +112,7 @@ struct Vector2 {
_FORCE_INLINE_ static Vector2 linear_interpolate(const Vector2 &p_a, const Vector2 &p_b, real_t p_t);
_FORCE_INLINE_ Vector2 linear_interpolate(const Vector2 &p_b, real_t p_t) const;
+ _FORCE_INLINE_ Vector2 slerp(const Vector2 &p_b, real_t p_t) const;
Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 slide(const Vector2 &p_normal) const;
@@ -163,6 +163,8 @@ struct Vector2 {
}
Vector2 floor() const;
+ Vector2 ceil() const;
+ Vector2 round() const;
Vector2 snapped(const Vector2 &p_by) const;
real_t aspect() const { return width / height; }
@@ -262,6 +264,14 @@ Vector2 Vector2::linear_interpolate(const Vector2 &p_b, real_t p_t) const {
return res;
}
+Vector2 Vector2::slerp(const Vector2 &p_b, real_t p_t) const {
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Vector2());
+#endif
+ real_t theta = angle_to(p_b);
+ return rotated(theta * p_t);
+}
+
Vector2 Vector2::linear_interpolate(const Vector2 &p_a, const Vector2 &p_b, real_t p_t) {
Vector2 res = p_a;
@@ -304,7 +314,7 @@ struct Rect2 {
inline real_t distance_to(const Vector2 &p_point) const {
- real_t dist;
+ real_t dist = 0.0;
bool inside = true;
if (p_point.x < position.x) {
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index f060a8e4ab..5c8512d8bd 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -177,18 +177,3 @@ float Math::random(float from, float to) {
float ret = (float)r / (float)RANDOM_MAX;
return (ret) * (to - from) + from;
}
-
-int Math::wrapi(int value, int min, int max) {
- --max;
- int rng = max - min + 1;
- value = ((value - min) % rng);
- if (value < 0)
- return max + 1 + value;
- else
- return min + value;
-}
-
-float Math::wrapf(float value, float min, float max) {
- float rng = max - min;
- return min + (value - min) - (rng * floor((value - min) / rng));
-}
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index e15abc6b50..20001bb9a6 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -209,8 +209,18 @@ public:
static _ALWAYS_INLINE_ double round(double p_val) { return (p_val >= 0) ? Math::floor(p_val + 0.5) : -Math::floor(-p_val + 0.5); }
static _ALWAYS_INLINE_ float round(float p_val) { return (p_val >= 0) ? Math::floor(p_val + 0.5) : -Math::floor(-p_val + 0.5); }
- static int wrapi(int value, int min, int max);
- static float wrapf(float value, float min, float max);
+ static _ALWAYS_INLINE_ int wrapi(int value, int min, int max) {
+ int rng = max - min;
+ return min + ((((value - min) % rng) + rng) % rng);
+ }
+ static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) {
+ double rng = max - min;
+ return value - (rng * Math::floor((value - min) / rng));
+ }
+ static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) {
+ float rng = max - min;
+ return value - (rng * Math::floor((value - min) / rng));
+ }
// double only, as these functions are mainly used by the editor and not performance-critical,
static double ease(double p_x, double p_c);
diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp
index 189b1ef9b3..2371f49561 100644
--- a/core/math/matrix3.cpp
+++ b/core/math/matrix3.cpp
@@ -254,7 +254,7 @@ void Basis::set_scale(const Vector3 &p_scale) {
set_axis(2, get_axis(2).normalized() * p_scale.z);
}
-Vector3 Basis::get_scale() const {
+Vector3 Basis::get_scale_abs() const {
return Vector3(
Vector3(elements[0][0], elements[1][0], elements[2][0]).length(),
@@ -262,7 +262,13 @@ Vector3 Basis::get_scale() const {
Vector3(elements[0][2], elements[1][2], elements[2][2]).length());
}
-Vector3 Basis::get_signed_scale() const {
+Vector3 Basis::get_scale_local() const {
+ real_t det_sign = determinant() > 0 ? 1 : -1;
+ return det_sign * Vector3(elements[0].length(), elements[1].length(), elements[2].length());
+}
+
+// get_scale works with get_rotation, use get_scale_abs if you need to enforce positive signature.
+Vector3 Basis::get_scale() const {
// FIXME: We are assuming M = R.S (R is rotation and S is scaling), and use polar decomposition to extract R and S.
// A polar decomposition is M = O.P, where O is an orthogonal matrix (meaning rotation and reflection) and
// P is a positive semi-definite matrix (meaning it contains absolute values of scaling along its diagonal).
@@ -342,8 +348,15 @@ void Basis::rotate(const Vector3 &p_euler) {
*this = rotated(p_euler);
}
-// TODO: rename this to get_rotation_euler
-Vector3 Basis::get_rotation() const {
+Basis Basis::rotated(const Quat &p_quat) const {
+ return Basis(p_quat) * (*this);
+}
+
+void Basis::rotate(const Quat &p_quat) {
+ *this = rotated(p_quat);
+}
+
+Vector3 Basis::get_rotation_euler() const {
// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S,
// and returns the Euler angles corresponding to the rotation part, complementing get_scale().
// See the comment in get_scale() for further information.
@@ -357,6 +370,20 @@ Vector3 Basis::get_rotation() const {
return m.get_euler();
}
+Quat Basis::get_rotation_quat() const {
+ // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S,
+ // and returns the Euler angles corresponding to the rotation part, complementing get_scale().
+ // See the comment in get_scale() for further information.
+ Basis m = orthonormalized();
+ real_t det = m.determinant();
+ if (det < 0) {
+ // Ensure that the determinant is 1, such that result is a proper rotation matrix which can be represented by Euler angles.
+ m.scale(Vector3(-1, -1, -1));
+ }
+
+ return m.get_quat();
+}
+
void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const {
// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S,
// and returns the Euler angles corresponding to the rotation part, complementing get_scale().
@@ -371,6 +398,22 @@ void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const {
m.get_axis_angle(p_axis, p_angle);
}
+void Basis::get_rotation_axis_angle_local(Vector3 &p_axis, real_t &p_angle) const {
+ // Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S,
+ // and returns the Euler angles corresponding to the rotation part, complementing get_scale().
+ // See the comment in get_scale() for further information.
+ Basis m = transposed();
+ m.orthonormalize();
+ real_t det = m.determinant();
+ if (det < 0) {
+ // Ensure that the determinant is 1, such that result is a proper rotation matrix which can be represented by Euler angles.
+ m.scale(Vector3(-1, -1, -1));
+ }
+
+ m.get_axis_angle(p_axis, p_angle);
+ p_angle = -p_angle;
+}
+
// get_euler_xyz returns a vector containing the Euler angles in the format
// (a1,a2,a3), where a3 is the angle of the first rotation, and a1 is the last
// (following the convention they are commonly defined in the literature).
@@ -561,10 +604,9 @@ Basis::operator String() const {
}
Quat Basis::get_quat() const {
- //commenting this check because precision issues cause it to fail when it shouldn't
- //#ifdef MATH_CHECKS
- //ERR_FAIL_COND_V(is_rotation() == false, Quat());
- //#endif
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_rotation() == false, Quat());
+#endif
real_t trace = elements[0][0] + elements[1][1] + elements[2][2];
real_t temp[4];
@@ -767,3 +809,45 @@ void Basis::set_axis_angle(const Vector3 &p_axis, real_t p_phi) {
elements[2][1] = p_axis.y * p_axis.z * (1.0 - cosine) + p_axis.x * sine;
elements[2][2] = axis_sq.z + cosine * (1.0 - axis_sq.z);
}
+
+void Basis::set_axis_angle_scale(const Vector3 &p_axis, real_t p_phi, const Vector3 &p_scale) {
+ set_diagonal(p_scale);
+ rotate(p_axis, p_phi);
+}
+
+void Basis::set_euler_scale(const Vector3 &p_euler, const Vector3 &p_scale) {
+ set_diagonal(p_scale);
+ rotate(p_euler);
+}
+
+void Basis::set_quat_scale(const Quat &p_quat, const Vector3 &p_scale) {
+ set_diagonal(p_scale);
+ rotate(p_quat);
+}
+
+void Basis::set_diagonal(const Vector3 p_diag) {
+ elements[0][0] = p_diag.x;
+ elements[0][1] = 0;
+ elements[0][2] = 0;
+
+ elements[1][0] = 0;
+ elements[1][1] = p_diag.y;
+ elements[1][2] = 0;
+
+ elements[2][0] = 0;
+ elements[2][1] = 0;
+ elements[2][2] = p_diag.z;
+}
+
+Basis Basis::slerp(const Basis &target, const real_t &t) const {
+// TODO: implement this directly without using quaternions to make it more efficient
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_rotation() == false, Basis());
+ ERR_FAIL_COND_V(target.is_rotation() == false, Basis());
+#endif
+
+ Quat from(*this);
+ Quat to(target);
+
+ return Basis(from.slerp(to, t));
+}
diff --git a/core/math/matrix3.h b/core/math/matrix3.h
index c426435729..cd1b51baa6 100644
--- a/core/math/matrix3.h
+++ b/core/math/matrix3.h
@@ -81,8 +81,14 @@ public:
void rotate(const Vector3 &p_euler);
Basis rotated(const Vector3 &p_euler) const;
- Vector3 get_rotation() const;
+ void rotate(const Quat &p_quat);
+ Basis rotated(const Quat &p_quat) const;
+
+ Vector3 get_rotation_euler() const;
void get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const;
+ void get_rotation_axis_angle_local(Vector3 &p_axis, real_t &p_angle) const;
+ Quat get_rotation_quat() const;
+ Vector3 get_rotation() const { return get_rotation_euler(); };
Vector3 rotref_posscale_decomposition(Basis &rotref) const;
@@ -108,7 +114,12 @@ public:
void set_scale(const Vector3 &p_scale);
Vector3 get_scale() const;
- Vector3 get_signed_scale() const;
+ Vector3 get_scale_abs() const;
+ Vector3 get_scale_local() const;
+
+ void set_axis_angle_scale(const Vector3 &p_axis, real_t p_phi, const Vector3 &p_scale);
+ void set_euler_scale(const Vector3 &p_euler, const Vector3 &p_scale);
+ void set_quat_scale(const Quat &p_quat, const Vector3 &p_scale);
// transposed dot products
_FORCE_INLINE_ real_t tdotx(const Vector3 &v) const {
@@ -140,10 +151,14 @@ public:
int get_orthogonal_index() const;
void set_orthogonal_index(int p_index);
+ void set_diagonal(const Vector3 p_diag);
+
bool is_orthogonal() const;
bool is_diagonal() const;
bool is_rotation() const;
+ Basis slerp(const Basis &target, const real_t &t) const;
+
operator String() const;
/* create / set */
@@ -219,6 +234,8 @@ public:
Basis(const Quat &p_quat) { set_quat(p_quat); };
Basis(const Vector3 &p_euler) { set_euler(p_euler); }
Basis(const Vector3 &p_axis, real_t p_phi) { set_axis_angle(p_axis, p_phi); }
+ Basis(const Vector3 &p_axis, real_t p_phi, const Vector3 &p_scale) { set_axis_angle_scale(p_axis, p_phi, p_scale); }
+ Basis(const Quat &p_quat, const Vector3 &p_scale) { set_quat_scale(p_quat, p_scale); }
_FORCE_INLINE_ Basis(const Vector3 &row0, const Vector3 &row1, const Vector3 &row2) {
elements[0] = row0;
diff --git a/core/math/quat.cpp b/core/math/quat.cpp
index 9aa8b537d2..67c9048a41 100644
--- a/core/math/quat.cpp
+++ b/core/math/quat.cpp
@@ -89,7 +89,7 @@ void Quat::set_euler_yxz(const Vector3 &p_euler) {
set(sin_a1 * cos_a2 * sin_a3 + cos_a1 * sin_a2 * cos_a3,
sin_a1 * cos_a2 * cos_a3 - cos_a1 * sin_a2 * sin_a3,
- -sin_a1 * sin_a2 * cos_a3 + cos_a1 * sin_a2 * sin_a3,
+ -sin_a1 * sin_a2 * cos_a3 + cos_a1 * cos_a2 * sin_a3,
sin_a1 * sin_a2 * sin_a3 + cos_a1 * cos_a2 * cos_a3);
}
@@ -98,6 +98,9 @@ void Quat::set_euler_yxz(const Vector3 &p_euler) {
// and similar for other axes.
// This implementation uses YXZ convention (Z is the first rotation).
Vector3 Quat::get_euler_yxz() const {
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Vector3(0, 0, 0));
+#endif
Basis m(*this);
return m.get_euler_yxz();
}
@@ -135,11 +138,17 @@ bool Quat::is_normalized() const {
}
Quat Quat::inverse() const {
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Quat());
+#endif
return Quat(-x, -y, -z, w);
}
Quat Quat::slerp(const Quat &q, const real_t &t) const {
-
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Quat());
+ ERR_FAIL_COND_V(q.is_normalized() == false, Quat());
+#endif
Quat to1;
real_t omega, cosom, sinom, scale0, scale1;
@@ -183,7 +192,10 @@ Quat Quat::slerp(const Quat &q, const real_t &t) const {
}
Quat Quat::slerpni(const Quat &q, const real_t &t) const {
-
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Quat());
+ ERR_FAIL_COND_V(q.is_normalized() == false, Quat());
+#endif
const Quat &from = *this;
real_t dot = from.dot(q);
@@ -202,7 +214,10 @@ Quat Quat::slerpni(const Quat &q, const real_t &t) const {
}
Quat Quat::cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const real_t &t) const {
-
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Quat());
+ ERR_FAIL_COND_V(q.is_normalized() == false, Quat());
+#endif
//the only way to do slerp :|
real_t t2 = (1.0 - t) * t * 2;
Quat sp = this->slerp(q, t);
@@ -215,7 +230,10 @@ Quat::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
}
-Quat::Quat(const Vector3 &axis, const real_t &angle) {
+void Quat::set_axis_angle(const Vector3 &axis, const real_t &angle) {
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND(axis.is_normalized() == false);
+#endif
real_t d = axis.length();
if (d == 0)
set(0, 0, 0, 0);
diff --git a/core/math/quat.h b/core/math/quat.h
index ebc924504b..6dc8d66f60 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -64,11 +64,13 @@ public:
Quat slerpni(const Quat &q, const real_t &t) const;
Quat cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const real_t &t) const;
+ void set_axis_angle(const Vector3 &axis, const real_t &angle);
_FORCE_INLINE_ void get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
r_angle = 2 * Math::acos(w);
- r_axis.x = x / Math::sqrt(1 - w * w);
- r_axis.y = y / Math::sqrt(1 - w * w);
- r_axis.z = z / Math::sqrt(1 - w * w);
+ real_t r = ((real_t)1) / Math::sqrt(1 - w * w);
+ r_axis.x = x * r;
+ r_axis.y = y * r;
+ r_axis.z = z * r;
}
void operator*=(const Quat &q);
@@ -82,10 +84,12 @@ public:
}
_FORCE_INLINE_ Vector3 xform(const Vector3 &v) const {
-
- Quat q = *this * v;
- q *= this->inverse();
- return Vector3(q.x, q.y, q.z);
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, v);
+#endif
+ Vector3 u(x, y, z);
+ Vector3 uv = u.cross(v);
+ return v + ((uv * w) + u.cross(uv)) * ((real_t)2);
}
_FORCE_INLINE_ void operator+=(const Quat &q);
@@ -115,7 +119,15 @@ public:
z = p_z;
w = p_w;
}
- Quat(const Vector3 &axis, const real_t &angle);
+ Quat(const Vector3 &axis, const real_t &angle) { set_axis_angle(axis, angle); }
+
+ Quat(const Vector3 &euler) { set_euler(euler); }
+ Quat(const Quat &q) {
+ x = q.x;
+ y = q.y;
+ z = q.z;
+ w = q.w;
+ }
Quat(const Vector3 &v0, const Vector3 &v1) // shortest arc
{
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 102e454e02..fc90417413 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -74,7 +74,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
int longest_axis = aabb.get_longest_axis_index();
//first two vertices are the most distant
- int simplex[4];
+ int simplex[4] = { 0 };
{
real_t max = 0, min = 0;
diff --git a/core/math/transform.cpp b/core/math/transform.cpp
index f727d00e30..d1e190f4b9 100644
--- a/core/math/transform.cpp
+++ b/core/math/transform.cpp
@@ -119,12 +119,12 @@ Transform Transform::interpolate_with(const Transform &p_transform, real_t p_c)
/* not sure if very "efficient" but good enough? */
- Vector3 src_scale = basis.get_signed_scale();
- Quat src_rot = basis.orthonormalized();
+ Vector3 src_scale = basis.get_scale();
+ Quat src_rot = basis.get_rotation_quat();
Vector3 src_loc = origin;
- Vector3 dst_scale = p_transform.basis.get_signed_scale();
- Quat dst_rot = p_transform.basis;
+ Vector3 dst_scale = p_transform.basis.get_scale();
+ Quat dst_rot = p_transform.basis.get_rotation_quat();
Vector3 dst_loc = p_transform.origin;
Transform dst; //this could be made faster by using a single function in Basis..
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index edd4ad3441..5475f733c3 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -88,6 +88,26 @@ int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, in
return index;
}
+void TriangleMesh::get_indices(PoolVector<int> *r_triangles_indices) const {
+
+ if (!valid)
+ return;
+
+ const int triangles_num = triangles.size();
+
+ // Parse vertices indices
+ PoolVector<Triangle>::Read triangles_read = triangles.read();
+
+ r_triangles_indices->resize(triangles_num * 3);
+ PoolVector<int>::Write r_indices_write = r_triangles_indices->write();
+
+ for (int i = 0; i < triangles_num; ++i) {
+ r_indices_write[3 * i + 0] = triangles_read[i].indices[0];
+ r_indices_write[3 * i + 1] = triangles_read[i].indices[1];
+ r_indices_write[3 * i + 2] = triangles_read[i].indices[2];
+ }
+}
+
void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
valid = false;
@@ -490,6 +510,222 @@ 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 {
+ 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;
+
+ PoolVector<Triangle>::Read trianglesr = triangles.read();
+ PoolVector<Vector3>::Read verticesr = vertices.read();
+ PoolVector<BVH>::Read bvhr = bvh.read();
+
+ const Triangle *triangleptr = trianglesr.ptr();
+ const Vector3 *vertexptr = verticesr.ptr();
+ int pos = bvh.size() - 1;
+ const BVH *bvhptr = bvhr.ptr();
+
+ 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: {
+
+ bool valid = b.aabb.intersects_convex_shape(p_planes, p_plane_count);
+ if (!valid) {
+
+ 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;
+ stack[level + 1] = b.left | TEST_AABB_BIT;
+ level++;
+ continue;
+ }
+ case VISIT_RIGHT_BIT: {
+
+ stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
+ stack[level + 1] = b.right | TEST_AABB_BIT;
+ level++;
+ 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, Vector3 p_scale) 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 level = 0;
+
+ PoolVector<Triangle>::Read trianglesr = triangles.read();
+ PoolVector<Vector3>::Read verticesr = vertices.read();
+ PoolVector<BVH>::Read bvhr = bvh.read();
+
+ Transform scale(Basis().scaled(p_scale));
+
+ const Triangle *triangleptr = trianglesr.ptr();
+ const Vector3 *vertexptr = verticesr.ptr();
+ int pos = bvh.size() - 1;
+ const BVH *bvhptr = bvhr.ptr();
+
+ 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: {
+
+ bool intersects = scale.xform(b.aabb).intersects_convex_shape(p_planes, p_plane_count);
+ if (!intersects) return false;
+
+ bool inside = scale.xform(b.aabb).inside_convex_shape(p_planes, p_plane_count);
+ if (inside) {
+
+ 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) {
+ Vector3 point = scale.xform(vertexptr[s.indices[j]]);
+ for (int i = 0; i < p_plane_count; i++) {
+ const Plane &p = p_planes[i];
+ if (p.is_point_over(point)) return false;
+ }
+ }
+
+ 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;
+ stack[level + 1] = b.left | TEST_AABB_BIT;
+ level++;
+ continue;
+ }
+ case VISIT_RIGHT_BIT: {
+
+ stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
+ stack[level + 1] = b.right | TEST_AABB_BIT;
+ level++;
+ continue;
+ }
+ case VISIT_DONE_BIT: {
+
+ if (level == 0) {
+ done = true;
+ break;
+ } else
+ level--;
+ continue;
+ }
+ }
+
+ if (done)
+ break;
+ }
+
+ return true;
+}
+
bool TriangleMesh::is_valid() const {
return valid;
diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h
index 9f145f2afb..bf793fc50f 100644
--- a/core/math/triangle_mesh.h
+++ b/core/math/triangle_mesh.h
@@ -89,9 +89,15 @@ public:
bool is_valid() const;
bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const;
bool intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, Vector3 &r_point, Vector3 &r_normal) const;
+ bool intersect_convex_shape(const Plane *p_planes, int p_plane_count) const;
+ bool inside_convex_shape(const Plane *p_planes, int p_plane_count, Vector3 p_scale = Vector3(1, 1, 1)) const;
Vector3 get_area_normal(const AABB &p_aabb) const;
PoolVector<Face3> get_faces() const;
+ PoolVector<Triangle> get_triangles() const { return triangles; }
+ PoolVector<Vector3> get_vertices() const { return vertices; }
+ void get_indices(PoolVector<int> *p_triangles_indices) const;
+
void create(const PoolVector<Vector3> &p_faces);
TriangleMesh();
};
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 5bae74ac7e..563ba7268f 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -51,7 +51,8 @@ real_t Triangulate::get_area(const Vector<Vector2> &contour) {
bool Triangulate::is_inside_triangle(real_t Ax, real_t Ay,
real_t Bx, real_t By,
real_t Cx, real_t Cy,
- real_t Px, real_t Py)
+ real_t Px, real_t Py,
+ bool include_edges)
{
real_t ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
@@ -74,10 +75,14 @@ bool Triangulate::is_inside_triangle(real_t Ax, real_t Ay,
cCROSSap = cx * apy - cy * apx;
bCROSScp = bx * cpy - by * cpx;
- return ((aCROSSbp > 0.0) && (bCROSScp > 0.0) && (cCROSSap > 0.0));
+ if (include_edges) {
+ return ((aCROSSbp > 0.0) && (bCROSScp > 0.0) && (cCROSSap > 0.0));
+ } else {
+ return ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0));
+ }
};
-bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V) {
+bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed) {
int p;
real_t Ax, Ay, Bx, By, Cx, Cy, Px, Py;
const Vector2 *contour = &p_contour[0];
@@ -91,13 +96,20 @@ bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, in
Cx = contour[V[w]].x;
Cy = contour[V[w]].y;
- if (CMP_EPSILON > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) return false;
+ // It can happen that the triangulation ends up with three aligned vertices to deal with.
+ // In this scenario, making the check below strict may reject the possibility of
+ // forming a last triangle with these aligned vertices, preventing the triangulatiom
+ // from completing.
+ // To avoid that we allow zero-area triangles if all else failed.
+ float threshold = relaxed ? -CMP_EPSILON : CMP_EPSILON;
+
+ if (threshold > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) return false;
for (p = 0; p < n; p++) {
if ((p == u) || (p == v) || (p == w)) continue;
Px = contour[V[p]].x;
Py = contour[V[p]].y;
- if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py)) return false;
+ if (is_inside_triangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py, relaxed)) return false;
}
return true;
@@ -121,6 +133,8 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
for (int v = 0; v < n; v++)
V[v] = (n - 1) - v;
+ bool relaxed = false;
+
int nv = n;
/* remove nv-2 Vertices, creating 1 triangle every time */
@@ -129,8 +143,20 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
for (int v = nv - 1; nv > 2;) {
/* if we loop, it is probably a non-simple polygon */
if (0 >= (count--)) {
- //** Triangulate: ERROR - probable bad polygon!
- return false;
+ if (relaxed) {
+ //** Triangulate: ERROR - probable bad polygon!
+ return false;
+ } else {
+ // There may be aligned vertices that the strict
+ // checks prevent from triangulating. In this situation
+ // we are better off adding flat triangles than
+ // failing, so we relax the checks and try one last
+ // round.
+ // Only relaxing the constraints as a last resort avoids
+ // degenerate triangles when they aren't necessary.
+ count = 2 * nv;
+ relaxed = true;
+ }
}
/* three consecutive vertices in current polygon, <u,v,w> */
@@ -141,7 +167,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
int w = v + 1;
if (nv <= w) w = 0; /* next */
- if (snip(contour, u, v, w, nv, V)) {
+ if (snip(contour, u, v, w, nv, V, relaxed)) {
int a, b, c, s, t;
/* true names of the vertices */
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index e336dc5756..b1a583d0c5 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -51,10 +51,11 @@ public:
static bool is_inside_triangle(real_t Ax, real_t Ay,
real_t Bx, real_t By,
real_t Cx, real_t Cy,
- real_t Px, real_t Py);
+ real_t Px, real_t Py,
+ bool include_edges);
private:
- static bool snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V);
+ static bool snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed);
};
#endif
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 10ec4f5641..433adf09ee 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -91,6 +91,7 @@ struct Vector3 {
/* Static Methods between 2 vector3s */
_FORCE_INLINE_ Vector3 linear_interpolate(const Vector3 &p_b, real_t p_t) const;
+ _FORCE_INLINE_ Vector3 slerp(const Vector3 &p_b, real_t p_t) const;
Vector3 cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, const Vector3 &p_post_b, real_t p_t) const;
Vector3 cubic_interpolaten(const Vector3 &p_b, const Vector3 &p_pre_a, const Vector3 &p_post_b, real_t p_t) const;
@@ -103,6 +104,7 @@ struct Vector3 {
_FORCE_INLINE_ Vector3 floor() const;
_FORCE_INLINE_ Vector3 sign() const;
_FORCE_INLINE_ Vector3 ceil() const;
+ _FORCE_INLINE_ Vector3 round() const;
_FORCE_INLINE_ real_t distance_to(const Vector3 &p_b) const;
_FORCE_INLINE_ real_t distance_squared_to(const Vector3 &p_b) const;
@@ -204,6 +206,11 @@ Vector3 Vector3::ceil() const {
return Vector3(Math::ceil(x), Math::ceil(y), Math::ceil(z));
}
+Vector3 Vector3::round() const {
+
+ return Vector3(Math::round(x), Math::round(y), Math::round(z));
+}
+
Vector3 Vector3::linear_interpolate(const Vector3 &p_b, real_t p_t) const {
return Vector3(
@@ -212,6 +219,15 @@ Vector3 Vector3::linear_interpolate(const Vector3 &p_b, real_t p_t) const {
z + (p_t * (p_b.z - z)));
}
+Vector3 Vector3::slerp(const Vector3 &p_b, real_t p_t) const {
+#ifdef MATH_CHECKS
+ ERR_FAIL_COND_V(is_normalized() == false, Vector3());
+#endif
+
+ real_t theta = angle_to(p_b);
+ return rotated(cross(p_b), theta * p_t);
+}
+
real_t Vector3::distance_to(const Vector3 &p_b) const {
return (p_b - *this).length();
diff --git a/core/method_bind.h b/core/method_bind.h
index e02d64c935..41b500c401 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -128,10 +128,36 @@ struct VariantCaster<const T &> {
// Object enum casts must go here
VARIANT_ENUM_CAST(Object::ConnectFlags);
+template <typename T>
+struct VariantObjectClassChecker {
+ static _FORCE_INLINE_ bool check(const Variant &p_variant) {
+ return true;
+ }
+};
+
+template <>
+struct VariantObjectClassChecker<Node *> {
+ static _FORCE_INLINE_ bool check(const Variant &p_variant) {
+ Object *obj = p_variant;
+ Node *node = p_variant;
+ return node || !obj;
+ }
+};
+
+template <>
+struct VariantObjectClassChecker<Control *> {
+ static _FORCE_INLINE_ bool check(const Variant &p_variant) {
+ Object *obj = p_variant;
+ Control *control = p_variant;
+ return control || !obj;
+ }
+};
+
#define CHECK_ARG(m_arg) \
if ((m_arg - 1) < p_arg_count) { \
Variant::Type argtype = get_argument_type(m_arg - 1); \
- if (!Variant::can_convert_strict(p_args[m_arg - 1]->get_type(), argtype)) { \
+ if (!Variant::can_convert_strict(p_args[m_arg - 1]->get_type(), argtype) || \
+ !VariantObjectClassChecker<P##m_arg>::check(*p_args[m_arg - 1])) { \
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; \
r_error.argument = m_arg - 1; \
r_error.expected = argtype; \
diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h
index 2007c3def5..677e8e1fb2 100644
--- a/core/method_ptrcall.h
+++ b/core/method_ptrcall.h
@@ -214,6 +214,50 @@ struct PtrToArg<const T *> {
} \
}
+#define MAKE_VECARG_ALT(m_type, m_type_alt) \
+ template <> \
+ struct PtrToArg<Vector<m_type_alt> > { \
+ _FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \
+ const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \
+ Vector<m_type_alt> ret; \
+ int len = dvs->size(); \
+ ret.resize(len); \
+ { \
+ PoolVector<m_type>::Read r = dvs->read(); \
+ for (int i = 0; i < len; i++) { \
+ ret[i] = r[i]; \
+ } \
+ } \
+ return ret; \
+ } \
+ _FORCE_INLINE_ static void encode(Vector<m_type_alt> p_vec, void *p_ptr) { \
+ PoolVector<m_type> *dv = reinterpret_cast<PoolVector<m_type> *>(p_ptr); \
+ int len = p_vec.size(); \
+ dv->resize(len); \
+ { \
+ PoolVector<m_type>::Write w = dv->write(); \
+ for (int i = 0; i < len; i++) { \
+ w[i] = p_vec[i]; \
+ } \
+ } \
+ } \
+ }; \
+ template <> \
+ struct PtrToArg<const Vector<m_type_alt> &> { \
+ _FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \
+ const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \
+ Vector<m_type_alt> ret; \
+ int len = dvs->size(); \
+ ret.resize(len); \
+ { \
+ PoolVector<m_type>::Read r = dvs->read(); \
+ for (int i = 0; i < len; i++) { \
+ ret[i] = r[i]; \
+ } \
+ } \
+ return ret; \
+ } \
+ }
MAKE_VECARG(String);
MAKE_VECARG(uint8_t);
MAKE_VECARG(int);
@@ -221,6 +265,7 @@ MAKE_VECARG(float);
MAKE_VECARG(Vector2);
MAKE_VECARG(Vector3);
MAKE_VECARG(Color);
+MAKE_VECARG_ALT(String, StringName);
//for stuff that gets converted to Array vectors
#define MAKE_VECARR(m_type) \
diff --git a/core/node_path.cpp b/core/node_path.cpp
index cd7ad77534..487d5ee8c6 100644
--- a/core/node_path.cpp
+++ b/core/node_path.cpp
@@ -32,10 +32,7 @@
#include "print_string.h"
-uint32_t NodePath::hash() const {
-
- if (!data)
- return 0;
+void NodePath::_update_hash_cache() const {
uint32_t h = data->absolute ? 1 : 0;
int pc = data->path.size();
@@ -49,13 +46,15 @@ uint32_t NodePath::hash() const {
h = h ^ ssn[i].hash();
}
- return h;
+ data->hash_cache_valid = true;
+ data->hash_cache = h;
}
void NodePath::prepend_period() {
if (data->path.size() && data->path[0].operator String() != ".") {
data->path.insert(0, ".");
+ data->hash_cache_valid = false;
}
}
@@ -114,21 +113,33 @@ bool NodePath::operator==(const NodePath &p_path) const {
if (data->absolute != p_path.data->absolute)
return false;
- if (data->path.size() != p_path.data->path.size())
+ int path_size = data->path.size();
+
+ if (path_size != p_path.data->path.size()) {
return false;
+ }
+
+ int subpath_size = data->subpath.size();
- if (data->subpath.size() != p_path.data->subpath.size())
+ if (subpath_size != p_path.data->subpath.size()) {
return false;
+ }
- for (int i = 0; i < data->path.size(); i++) {
+ const StringName *l_path_ptr = data->path.ptr();
+ const StringName *r_path_ptr = p_path.data->path.ptr();
+
+ for (int i = 0; i < path_size; i++) {
- if (data->path[i] != p_path.data->path[i])
+ if (l_path_ptr[i] != r_path_ptr[i])
return false;
}
- for (int i = 0; i < data->subpath.size(); i++) {
+ const StringName *l_subpath_ptr = data->subpath.ptr();
+ const StringName *r_subpath_ptr = p_path.data->subpath.ptr();
+
+ for (int i = 0; i < subpath_size; i++) {
- if (data->subpath[i] != p_path.data->subpath[i])
+ if (l_subpath_ptr[i] != r_subpath_ptr[i])
return false;
}
@@ -264,8 +275,9 @@ NodePath NodePath::get_as_property_path() const {
Vector<StringName> new_path = data->subpath;
String initial_subname = data->path[0];
+
for (size_t i = 1; i < data->path.size(); i++) {
- initial_subname += i == 0 ? data->path[i].operator String() : "/" + data->path[i];
+ initial_subname += "/" + data->path[i];
}
new_path.insert(0, initial_subname);
@@ -285,6 +297,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
data->absolute = p_absolute;
data->path = p_path;
data->has_slashes = true;
+ data->hash_cache_valid = false;
}
NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute) {
@@ -300,6 +313,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p
data->path = p_path;
data->subpath = p_subpath;
data->has_slashes = true;
+ data->hash_cache_valid = false;
}
void NodePath::simplify() {
@@ -323,6 +337,7 @@ void NodePath::simplify() {
}
}
}
+ data->hash_cache_valid = false;
}
NodePath NodePath::simplified() const {
@@ -395,6 +410,7 @@ NodePath::NodePath(const String &p_path) {
data->absolute = absolute ? true : false;
data->has_slashes = has_slashes;
data->subpath = subpath;
+ data->hash_cache_valid = false;
if (slices == 0)
return;
diff --git a/core/node_path.h b/core/node_path.h
index 288f39721f..71235029af 100644
--- a/core/node_path.h
+++ b/core/node_path.h
@@ -47,11 +47,15 @@ class NodePath {
StringName concatenated_subpath;
bool absolute;
bool has_slashes;
+ mutable bool hash_cache_valid;
+ mutable uint32_t hash_cache;
};
- Data *data;
+ mutable Data *data;
void unref();
+ void _update_hash_cache() const;
+
public:
_FORCE_INLINE_ StringName get_sname() const {
@@ -78,7 +82,14 @@ public:
NodePath get_parent() const;
- uint32_t hash() const;
+ _FORCE_INLINE_ uint32_t hash() const {
+ if (!data)
+ return 0;
+ if (!data->hash_cache_valid) {
+ _update_hash_cache();
+ }
+ return data->hash_cache;
+ }
operator String() const;
bool is_empty() const;
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index 280aea6a14..0b3b40f30c 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -36,176 +36,181 @@
#include "os/copymem.h"
#include "os/memory.h"
-// uncomment this to disable initial local storage.
-#define OA_HASH_MAP_INITIAL_LOCAL_STORAGE
-
/**
- * This class implements a hash map datastructure that uses open addressing with
- * local probing.
- *
- * It can give huge performance improvements over a chained HashMap because of
- * the increased data locality.
- *
- * Because of that locality property it's important to not use "large" value
- * types as the "TData" type. If TData values are too big it can cause more
- * cache misses then chaining. If larger values are needed then storing those
- * in a separate array and using pointers or indices to reference them is the
- * better solution.
- *
- * This hash map also implements real-time incremental rehashing.
+ * A HashMap implementation that uses open addressing with robinhood hashing.
+ * Robinhood hashing swaps out entries that have a smaller probing distance
+ * than the to-be-inserted entry, that evens out the average probing distance
+ * and enables faster lookups.
*
+ * The entries are stored inplace, so huge keys or values might fill cache lines
+ * a lot faster.
*/
-template <class TKey, class TData,
- uint16_t INITIAL_NUM_ELEMENTS = 64,
+template <class TKey, class TValue,
class Hasher = HashMapHasherDefault,
class Comparator = HashMapComparatorDefault<TKey> >
class OAHashMap {
private:
-#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
- TData local_data[INITIAL_NUM_ELEMENTS];
- TKey local_keys[INITIAL_NUM_ELEMENTS];
- uint32_t local_hashes[INITIAL_NUM_ELEMENTS];
- uint8_t local_flags[INITIAL_NUM_ELEMENTS / 4 + (INITIAL_NUM_ELEMENTS % 4 != 0 ? 1 : 0)];
-#endif
+ TValue *values;
+ TKey *keys;
+ uint32_t *hashes;
- struct {
- TData *data;
- TKey *keys;
- uint32_t *hashes;
+ uint32_t capacity;
- // This is actually an array of bits, 4 bit pairs per octet.
- // | ba ba ba ba | ba ba ba ba | ....
- //
- // if a is set it means that there is an element present.
- // if b is set it means that an element was deleted. This is needed for
- // the local probing to work without relocating any succeeding and
- // colliding entries.
- uint8_t *flags;
+ uint32_t num_elements;
- uint32_t capacity;
- } table, old_table;
+ static const uint32_t EMPTY_HASH = 0;
+ static const uint32_t DELETED_HASH_BIT = 1 << 31;
- bool is_rehashing;
- uint32_t rehash_position;
- uint32_t rehash_amount;
+ _FORCE_INLINE_ uint32_t _hash(const TKey &p_key) {
+ uint32_t hash = Hasher::hash(p_key);
- uint32_t elements;
+ if (hash == EMPTY_HASH) {
+ hash = EMPTY_HASH + 1;
+ } else if (hash & DELETED_HASH_BIT) {
+ hash &= ~DELETED_HASH_BIT;
+ }
- /* Methods */
+ return hash;
+ }
- // returns true if the value already existed, false if it's a new entry
- bool _raw_set_with_hash(uint32_t p_hash, const TKey &p_key, const TData &p_data) {
- for (int i = 0; i < table.capacity; i++) {
+ _FORCE_INLINE_ uint32_t _get_probe_length(uint32_t p_pos, uint32_t p_hash) {
+ p_hash = p_hash & ~DELETED_HASH_BIT; // we don't care if it was deleted or not
- int pos = (p_hash + i) % table.capacity;
+ uint32_t original_pos = p_hash % capacity;
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
+ return p_pos - original_pos;
+ }
- bool is_filled_flag = table.flags[flags_pos] & (1 << (2 * flags_pos_offset));
- bool is_deleted_flag = table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1));
+ _FORCE_INLINE_ void _construct(uint32_t p_pos, uint32_t p_hash, const TKey &p_key, const TValue &p_value) {
+ memnew_placement(&keys[p_pos], TKey(p_key));
+ memnew_placement(&values[p_pos], TValue(p_value));
+ hashes[p_pos] = p_hash;
- if (is_filled_flag) {
- if (table.hashes[pos] == p_hash && Comparator::compare(table.keys[pos], p_key)) {
- table.data[pos] = p_data;
- return true;
- }
- continue;
+ num_elements++;
+ }
+
+ bool _lookup_pos(const TKey &p_key, uint32_t &r_pos) {
+ uint32_t hash = _hash(p_key);
+ uint32_t pos = hash % capacity;
+ uint32_t distance = 0;
+
+ while (42) {
+ if (hashes[pos] == EMPTY_HASH) {
+ return false;
}
- table.keys[pos] = p_key;
- table.data[pos] = p_data;
- table.hashes[pos] = p_hash;
+ if (distance > _get_probe_length(pos, hashes[pos])) {
+ return false;
+ }
- table.flags[flags_pos] |= (1 << (2 * flags_pos_offset));
- table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset + 1));
+ if (hashes[pos] == hash && Comparator::compare(keys[pos], p_key)) {
+ r_pos = pos;
+ return true;
+ }
- return false;
+ pos = (pos + 1) % capacity;
+ distance++;
}
- return false;
}
-public:
- _FORCE_INLINE_ uint32_t get_capacity() const { return table.capacity; }
- _FORCE_INLINE_ uint32_t get_num_elements() const { return elements; }
+ void _insert_with_hash(uint32_t p_hash, const TKey &p_key, const TValue &p_value) {
- void set(const TKey &p_key, const TData &p_data) {
+ uint32_t hash = p_hash;
+ uint32_t distance = 0;
+ uint32_t pos = hash % capacity;
- uint32_t hash = Hasher::hash(p_key);
+ TKey key = p_key;
+ TValue value = p_value;
- // We don't progress the rehashing if the table just got resized
- // to keep the cost of this function low.
- if (is_rehashing) {
+ while (42) {
+ if (hashes[pos] == EMPTY_HASH) {
+ _construct(pos, hash, p_key, p_value);
- // rehash progress
+ return;
+ }
- for (int i = 0; i <= rehash_amount && rehash_position < old_table.capacity; rehash_position++) {
+ // not an empty slot, let's check the probing length of the existing one
+ uint32_t existing_probe_len = _get_probe_length(pos, hashes[pos]);
+ if (existing_probe_len < distance) {
- int flags_pos = rehash_position / 4;
- int flags_pos_offset = rehash_position % 4;
+ if (hashes[pos] & DELETED_HASH_BIT) {
+ // we found a place where we can fit in!
+ _construct(pos, hash, p_key, p_value);
- bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
- bool is_deleted_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
+ return;
+ }
- if (is_filled_flag) {
- _raw_set_with_hash(old_table.hashes[rehash_position], old_table.keys[rehash_position], old_table.data[rehash_position]);
+ SWAP(hash, hashes[pos]);
+ SWAP(key, keys[pos]);
+ SWAP(value, values[pos]);
+ distance = existing_probe_len;
+ }
- old_table.keys[rehash_position].~TKey();
- old_table.data[rehash_position].~TData();
+ pos = (pos + 1) % capacity;
+ distance++;
+ }
+ }
+ void _resize_and_rehash() {
- memnew_placement(&old_table.keys[rehash_position], TKey);
- memnew_placement(&old_table.data[rehash_position], TData);
+ TKey *old_keys = keys;
+ TValue *old_values = values;
+ uint32_t *old_hashes = hashes;
- old_table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset));
- old_table.flags[flags_pos] |= (1 << (2 * flags_pos_offset + 1));
- }
- }
+ uint32_t old_capacity = capacity;
- if (rehash_position >= old_table.capacity) {
+ capacity = old_capacity * 2;
+ num_elements = 0;
- // wohooo, we can get rid of the old table.
- is_rehashing = false;
+ keys = memnew_arr(TKey, capacity);
+ values = memnew_arr(TValue, capacity);
+ hashes = memnew_arr(uint32_t, capacity);
-#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
- if (old_table.data == local_data) {
- // Everything is local, so no cleanup :P
- } else
-#endif
- {
- memdelete_arr(old_table.data);
- memdelete_arr(old_table.keys);
- memdelete_arr(old_table.hashes);
- memdelete_arr(old_table.flags);
- }
- }
+ for (int i = 0; i < capacity; i++) {
+ hashes[i] = 0;
}
- // Table is almost full, resize and start rehashing process.
- if (elements >= table.capacity * 0.7) {
+ for (uint32_t i = 0; i < old_capacity; i++) {
+ if (old_hashes[i] == EMPTY_HASH) {
+ continue;
+ }
+ if (old_hashes[i] & DELETED_HASH_BIT) {
+ continue;
+ }
- old_table.capacity = table.capacity;
- old_table.data = table.data;
- old_table.flags = table.flags;
- old_table.hashes = table.hashes;
- old_table.keys = table.keys;
+ _insert_with_hash(old_hashes[i], old_keys[i], old_values[i]);
+ }
- table.capacity = old_table.capacity * 2;
+ memdelete_arr(old_keys);
+ memdelete_arr(old_values);
+ memdelete_arr(old_hashes);
+ }
- table.data = memnew_arr(TData, table.capacity);
- table.flags = memnew_arr(uint8_t, table.capacity / 4 + (table.capacity % 4 != 0 ? 1 : 0));
- table.hashes = memnew_arr(uint32_t, table.capacity);
- table.keys = memnew_arr(TKey, table.capacity);
+public:
+ _FORCE_INLINE_ uint32_t get_capacity() const { return capacity; }
+ _FORCE_INLINE_ uint32_t get_num_elements() const { return num_elements; }
- zeromem(table.flags, table.capacity / 4 + (table.capacity % 4 != 0 ? 1 : 0));
+ void insert(const TKey &p_key, const TValue &p_value) {
- is_rehashing = true;
- rehash_position = 0;
- rehash_amount = (elements * 2) / (table.capacity * 0.7 - old_table.capacity);
+ if ((float)num_elements / (float)capacity > 0.9) {
+ _resize_and_rehash();
}
- if (!_raw_set_with_hash(hash, p_key, p_data))
- elements++;
+ uint32_t hash = _hash(p_key);
+
+ _insert_with_hash(hash, p_key, p_value);
+ }
+
+ void set(const TKey &p_key, const TValue &p_data) {
+ uint32_t pos = 0;
+ bool exists = _lookup_pos(p_key, pos);
+
+ if (exists) {
+ values[pos].~TValue();
+ memnew_placement(&values[pos], TValue(p_data));
+ } else {
+ insert(p_key, p_data);
+ }
}
/**
@@ -214,380 +219,108 @@ public:
* if r_data is not NULL then the value will be written to the object
* it points to.
*/
- bool lookup(const TKey &p_key, TData *r_data) {
-
- uint32_t hash = Hasher::hash(p_key);
-
- bool check_old_table = is_rehashing;
- bool check_new_table = true;
-
- // search for the key and return the value associated with it
- //
- // if we're rehashing we need to check both the old and the
- // current table. If we find a value in the old table we still
- // need to continue searching in the new table as it might have
- // been added after
-
- TData *value = NULL;
-
- for (int i = 0; i < table.capacity; i++) {
-
- if (!check_new_table && !check_old_table) {
-
- break;
- }
-
- // if we're rehashing check the old table
- if (check_old_table && i < old_table.capacity) {
-
- int pos = (hash + i) % old_table.capacity;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
- bool is_deleted_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
-
- if (is_filled_flag) {
- // found our entry?
- if (old_table.hashes[pos] == hash && Comparator::compare(old_table.keys[pos], p_key)) {
- value = &old_table.data[pos];
- check_old_table = false;
- }
- } else if (!is_deleted_flag) {
-
- // we hit an empty field here, we don't
- // need to further check this old table
- // because we know it's not in here.
+ bool lookup(const TKey &p_key, TValue &r_data) {
+ uint32_t pos = 0;
+ bool exists = _lookup_pos(p_key, pos);
- check_old_table = false;
- }
- }
-
- if (check_new_table) {
-
- int pos = (hash + i) % table.capacity;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
- bool is_deleted_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
-
- if (is_filled_flag) {
- // found our entry?
- if (table.hashes[pos] == hash && Comparator::compare(table.keys[pos], p_key)) {
- if (r_data != NULL)
- *r_data = table.data[pos];
- return true;
- }
- continue;
- } else if (is_deleted_flag) {
- continue;
- } else if (value != NULL) {
-
- // We found a value in the old table
- if (r_data != NULL)
- *r_data = *value;
- return true;
- } else {
- check_new_table = false;
- }
- }
- }
-
- if (value != NULL) {
- if (r_data != NULL)
- *r_data = *value;
+ if (exists) {
+ r_data.~TValue();
+ memnew_placement(&r_data, TValue(values[pos]));
return true;
}
+
return false;
}
_FORCE_INLINE_ bool has(const TKey &p_key) {
- return lookup(p_key, NULL);
+ uint32_t _pos = 0;
+ return _lookup_pos(p_key, _pos);
}
void remove(const TKey &p_key) {
- uint32_t hash = Hasher::hash(p_key);
-
- bool check_old_table = is_rehashing;
- bool check_new_table = true;
-
- for (int i = 0; i < table.capacity; i++) {
-
- if (!check_new_table && !check_old_table) {
- return;
- }
-
- // if we're rehashing check the old table
- if (check_old_table && i < old_table.capacity) {
-
- int pos = (hash + i) % old_table.capacity;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
- bool is_deleted_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
-
- if (is_filled_flag) {
- // found our entry?
- if (old_table.hashes[pos] == hash && Comparator::compare(old_table.keys[pos], p_key)) {
- old_table.keys[pos].~TKey();
- old_table.data[pos].~TData();
+ uint32_t pos = 0;
+ bool exists = _lookup_pos(p_key, pos);
- memnew_placement(&old_table.keys[pos], TKey);
- memnew_placement(&old_table.data[pos], TData);
-
- old_table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset));
- old_table.flags[flags_pos] |= (1 << (2 * flags_pos_offset + 1));
-
- elements--;
- return;
- }
- } else if (!is_deleted_flag) {
-
- // we hit an empty field here, we don't
- // need to further check this old table
- // because we know it's not in here.
-
- check_old_table = false;
- }
- }
-
- if (check_new_table) {
-
- int pos = (hash + i) % table.capacity;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
- bool is_deleted_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset + 1))) > 0;
-
- if (is_filled_flag) {
- // found our entry?
- if (table.hashes[pos] == hash && Comparator::compare(table.keys[pos], p_key)) {
- table.keys[pos].~TKey();
- table.data[pos].~TData();
-
- memnew_placement(&table.keys[pos], TKey);
- memnew_placement(&table.data[pos], TData);
-
- table.flags[flags_pos] &= ~(1 << (2 * flags_pos_offset));
- table.flags[flags_pos] |= (1 << (2 * flags_pos_offset + 1));
-
- // don't return here, this value might still be in the old table
- // if it was already relocated.
-
- elements--;
- return;
- }
- continue;
- } else if (is_deleted_flag) {
- continue;
- } else {
- check_new_table = false;
- }
- }
+ if (!exists) {
+ return;
}
+
+ hashes[pos] |= DELETED_HASH_BIT;
+ values[pos].~TValue();
+ keys[pos].~TKey();
+ num_elements--;
}
struct Iterator {
bool valid;
- uint32_t hash;
-
const TKey *key;
- const TData *data;
+ const TValue *value;
private:
+ uint32_t pos;
friend class OAHashMap;
- bool was_from_old_table;
};
Iterator iter() const {
Iterator it;
- it.valid = false;
- it.was_from_old_table = false;
-
- bool check_old_table = is_rehashing;
-
- for (int i = 0; i < table.capacity; i++) {
-
- // if we're rehashing check the old table first
- if (check_old_table && i < old_table.capacity) {
-
- int pos = i;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
-
- if (is_filled_flag) {
- it.valid = true;
- it.hash = old_table.hashes[pos];
- it.data = &old_table.data[pos];
- it.key = &old_table.keys[pos];
-
- it.was_from_old_table = true;
-
- return it;
- }
- }
-
- {
-
- int pos = i;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
-
- if (is_filled_flag) {
- it.valid = true;
- it.hash = table.hashes[pos];
- it.data = &table.data[pos];
- it.key = &table.keys[pos];
-
- return it;
- }
- }
- }
+ it.valid = true;
+ it.pos = 0;
- return it;
+ return next_iter(it);
}
Iterator next_iter(const Iterator &p_iter) const {
+
if (!p_iter.valid) {
return p_iter;
}
Iterator it;
-
it.valid = false;
- it.was_from_old_table = false;
-
- bool check_old_table = is_rehashing;
-
- // we use this to skip the first check or not
- bool was_from_old_table = p_iter.was_from_old_table;
-
- int prev_index = (p_iter.data - (p_iter.was_from_old_table ? old_table.data : table.data));
-
- if (!was_from_old_table) {
- prev_index++;
- }
+ it.pos = p_iter.pos;
+ it.key = NULL;
+ it.value = NULL;
- for (int i = prev_index; i < table.capacity; i++) {
+ for (uint32_t i = it.pos; i < capacity; i++) {
+ it.pos = i + 1;
- // if we're rehashing check the old table first
- if (check_old_table && i < old_table.capacity && !was_from_old_table) {
-
- int pos = i;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (old_table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
-
- if (is_filled_flag) {
- it.valid = true;
- it.hash = old_table.hashes[pos];
- it.data = &old_table.data[pos];
- it.key = &old_table.keys[pos];
-
- it.was_from_old_table = true;
-
- return it;
- }
+ if (hashes[i] == EMPTY_HASH) {
+ continue;
}
-
- was_from_old_table = false;
-
- {
- int pos = i;
-
- int flags_pos = pos / 4;
- int flags_pos_offset = pos % 4;
-
- bool is_filled_flag = (table.flags[flags_pos] & (1 << (2 * flags_pos_offset))) > 0;
-
- if (is_filled_flag) {
- it.valid = true;
- it.hash = table.hashes[pos];
- it.data = &table.data[pos];
- it.key = &table.keys[pos];
-
- return it;
- }
+ if (hashes[i] & DELETED_HASH_BIT) {
+ continue;
}
+
+ it.valid = true;
+ it.key = &keys[i];
+ it.value = &values[i];
+ return it;
}
return it;
}
- OAHashMap(uint32_t p_initial_capacity = INITIAL_NUM_ELEMENTS) {
+ OAHashMap(uint32_t p_initial_capacity = 64) {
-#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
+ capacity = p_initial_capacity;
+ num_elements = 0;
- if (p_initial_capacity <= INITIAL_NUM_ELEMENTS) {
- table.data = local_data;
- table.keys = local_keys;
- table.hashes = local_hashes;
- table.flags = local_flags;
+ keys = memnew_arr(TKey, p_initial_capacity);
+ values = memnew_arr(TValue, p_initial_capacity);
+ hashes = memnew_arr(uint32_t, p_initial_capacity);
- zeromem(table.flags, INITIAL_NUM_ELEMENTS / 4 + (INITIAL_NUM_ELEMENTS % 4 != 0 ? 1 : 0));
-
- table.capacity = INITIAL_NUM_ELEMENTS;
- elements = 0;
- } else
-#endif
- {
- table.data = memnew_arr(TData, p_initial_capacity);
- table.keys = memnew_arr(TKey, p_initial_capacity);
- table.hashes = memnew_arr(uint32_t, p_initial_capacity);
- table.flags = memnew_arr(uint8_t, p_initial_capacity / 4 + (p_initial_capacity % 4 != 0 ? 1 : 0));
-
- zeromem(table.flags, p_initial_capacity / 4 + (p_initial_capacity % 4 != 0 ? 1 : 0));
-
- table.capacity = p_initial_capacity;
- elements = 0;
+ for (int i = 0; i < p_initial_capacity; i++) {
+ hashes[i] = 0;
}
-
- is_rehashing = false;
- rehash_position = 0;
}
~OAHashMap() {
-#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
- if (table.capacity <= INITIAL_NUM_ELEMENTS) {
- return; // Everything is local, so no cleanup :P
- }
-#endif
- if (is_rehashing) {
-
-#ifdef OA_HASH_MAP_INITIAL_LOCAL_STORAGE
- if (old_table.data == local_data) {
- // Everything is local, so no cleanup :P
- } else
-#endif
- {
- memdelete_arr(old_table.data);
- memdelete_arr(old_table.keys);
- memdelete_arr(old_table.hashes);
- memdelete_arr(old_table.flags);
- }
- }
- memdelete_arr(table.data);
- memdelete_arr(table.keys);
- memdelete_arr(table.hashes);
- memdelete_arr(table.flags);
+ memdelete_arr(keys);
+ memdelete_arr(values);
+ memdelete(hashes);
}
};
diff --git a/core/object.cpp b/core/object.cpp
index aaa37e6cf2..1d2aeb7ba5 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1677,6 +1677,7 @@ void Object::_bind_methods() {
#ifdef TOOLS_ENABLED
MethodInfo miget("_get", PropertyInfo(Variant::STRING, "property"));
miget.return_val.name = "Variant";
+ miget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
BIND_VMETHOD(miget);
MethodInfo plget("_get_property_list");
@@ -1919,9 +1920,7 @@ ObjectID ObjectDB::add_instance(Object *p_object) {
rw_lock->write_lock();
instances[++instance_counter] = p_object;
-#ifdef DEBUG_ENABLED
instance_checks[p_object] = instance_counter;
-#endif
rw_lock->write_unlock();
return instance_counter;
@@ -1932,9 +1931,7 @@ void ObjectDB::remove_instance(Object *p_object) {
rw_lock->write_lock();
instances.erase(p_object->get_instance_id());
-#ifdef DEBUG_ENABLED
instance_checks.erase(p_object);
-#endif
rw_lock->write_unlock();
}
diff --git a/core/object.h b/core/object.h
index 8306b5a356..8dc3426d1d 100644
--- a/core/object.h
+++ b/core/object.h
@@ -31,6 +31,7 @@
#ifndef OBJECT_H
#define OBJECT_H
+#include "hash_map.h"
#include "list.h"
#include "map.h"
#include "os/rw_lock.h"
@@ -55,7 +56,7 @@ enum PropertyHint {
PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional"
PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
- PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease)
+ PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) use "attenuation" hint string to revert (flip h), "full" to also include in/out. (ie: "attenuation,inout")
PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
PROPERTY_HINT_SPRITE_FRAME,
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
@@ -85,6 +86,7 @@ enum PropertyHint {
PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
PROPERTY_HINT_OBJECT_TOO_BIG, ///< object is too big to send
+ PROPERTY_HINT_NODE_PATH_VALID_TYPES,
PROPERTY_HINT_MAX,
// When updating PropertyHint, also sync the hardcoded list in VisualScriptEditorVariableEdit
};
@@ -450,7 +452,7 @@ private:
Signal() { lock = 0; }
};
- HashMap<StringName, Signal, StringNameHasher> signal_map;
+ HashMap<StringName, Signal> signal_map;
List<Connection> connections;
#ifdef DEBUG_ENABLED
SafeRefCount _lock_index;
@@ -762,15 +764,10 @@ public:
static void debug_objects(DebugFunc p_func);
static int get_object_count();
-#ifdef DEBUG_ENABLED
_FORCE_INLINE_ static bool instance_validate(Object *p_ptr) {
return instance_checks.has(p_ptr);
}
-#else
- _FORCE_INLINE_ static bool instance_validate(Object *p_ptr) { return true; }
-
-#endif
};
//needed by macros
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 1941b82602..330a9153ef 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -301,8 +301,8 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
FileAccess *fsrc = FileAccess::open(p_from, FileAccess::READ, &err);
if (err) {
-
- ERR_FAIL_COND_V(err, err);
+ ERR_PRINTS("Failed to open " + p_from);
+ return err;
}
FileAccess *fdst = FileAccess::open(p_to, FileAccess::WRITE, &err);
@@ -310,7 +310,8 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
fsrc->close();
memdelete(fsrc);
- ERR_FAIL_COND_V(err, err);
+ ERR_PRINTS("Failed to open " + p_to);
+ return err;
}
fsrc->seek_end(0);
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 5d10c1a9aa..c4635fdfbb 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -89,6 +89,9 @@ public:
virtual void close() = 0; ///< close a file
virtual bool is_open() const = 0; ///< true when file is open
+ virtual String get_path() const { return ""; } /// returns the path for the current open file
+ virtual String get_path_absolute() const { return ""; } /// returns the absolute path for the current open file
+
virtual void seek(size_t p_position) = 0; ///< seek to a given position
virtual void seek_end(int64_t p_position = 0) = 0; ///< seek from the end of file
virtual size_t get_position() const = 0; ///< get position in the file
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 3089ab2ce3..a5b0f91e63 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -57,6 +57,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &Input::is_action_pressed);
ClassDB::bind_method(D_METHOD("is_action_just_pressed", "action"), &Input::is_action_just_pressed);
ClassDB::bind_method(D_METHOD("is_action_just_released", "action"), &Input::is_action_just_released);
+ ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &Input::get_action_strength);
ClassDB::bind_method(D_METHOD("add_joy_mapping", "mapping", "update_existing"), &Input::add_joy_mapping, DEFVAL(false));
ClassDB::bind_method(D_METHOD("remove_joy_mapping", "guid"), &Input::remove_joy_mapping);
ClassDB::bind_method(D_METHOD("joy_connection_changed", "device", "connected", "name", "guid"), &Input::joy_connection_changed);
@@ -85,6 +86,7 @@ void Input::_bind_methods() {
ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position);
ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press);
ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release);
+ ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW));
ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2()));
ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event);
@@ -111,14 +113,14 @@ void Input::_bind_methods() {
BIND_ENUM_CONSTANT(CURSOR_HSPLIT);
BIND_ENUM_CONSTANT(CURSOR_HELP);
- ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected")));
+ ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "device"), PropertyInfo(Variant::BOOL, "connected")));
}
void Input::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
#ifdef TOOLS_ENABLED
String pf = p_function;
- if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released")) {
+ if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released" || pf == "get_action_strength")) {
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
diff --git a/core/os/input.h b/core/os/input.h
index 9c7595ff7f..001871c5dc 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -85,6 +85,7 @@ public:
virtual bool is_action_pressed(const StringName &p_action) const = 0;
virtual bool is_action_just_pressed(const StringName &p_action) const = 0;
virtual bool is_action_just_released(const StringName &p_action) const = 0;
+ virtual float get_action_strength(const StringName &p_action) const = 0;
virtual float get_joy_axis(int p_device, int p_axis) const = 0;
virtual String get_joy_name(int p_idx) = 0;
@@ -117,8 +118,11 @@ public:
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
- virtual bool is_emulating_touchscreen() const = 0;
+ virtual bool is_emulating_touch_from_mouse() const = 0;
+ virtual bool is_emulating_mouse_from_touch() const = 0;
+ virtual CursorShape get_default_cursor_shape() = 0;
+ virtual void set_default_cursor_shape(CursorShape p_shape) = 0;
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) = 0;
virtual void set_mouse_in_window(bool p_in_window) = 0;
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 12060f31df..4ebb821a2f 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -41,11 +41,6 @@ int InputEvent::get_device() const {
return device;
}
-bool InputEvent::is_pressed() const {
-
- return false;
-}
-
bool InputEvent::is_action(const StringName &p_action) const {
return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action);
@@ -53,11 +48,29 @@ bool InputEvent::is_action(const StringName &p_action) const {
bool InputEvent::is_action_pressed(const StringName &p_action) const {
- return (is_pressed() && !is_echo() && is_action(p_action));
+ bool pressed;
+ bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
+ return valid && pressed && !is_echo();
}
+
bool InputEvent::is_action_released(const StringName &p_action) const {
- return (!is_pressed() && is_action(p_action));
+ bool pressed;
+ bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
+ return valid && !pressed;
+}
+
+float InputEvent::get_action_strength(const StringName &p_action) const {
+
+ bool pressed;
+ float strength;
+ bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed, &strength);
+ return valid ? strength : 0.0f;
+}
+
+bool InputEvent::is_pressed() const {
+
+ return false;
}
bool InputEvent::is_echo() const {
@@ -75,7 +88,7 @@ String InputEvent::as_text() const {
return String();
}
-bool InputEvent::action_match(const Ref<InputEvent> &p_event) const {
+bool InputEvent::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
return false;
}
@@ -95,15 +108,16 @@ void InputEvent::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_device", "device"), &InputEvent::set_device);
ClassDB::bind_method(D_METHOD("get_device"), &InputEvent::get_device);
- ClassDB::bind_method(D_METHOD("is_pressed"), &InputEvent::is_pressed);
ClassDB::bind_method(D_METHOD("is_action", "action"), &InputEvent::is_action);
ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &InputEvent::is_action_pressed);
ClassDB::bind_method(D_METHOD("is_action_released", "action"), &InputEvent::is_action_released);
+ ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &InputEvent::get_action_strength);
+
+ ClassDB::bind_method(D_METHOD("is_pressed"), &InputEvent::is_pressed);
ClassDB::bind_method(D_METHOD("is_echo"), &InputEvent::is_echo);
ClassDB::bind_method(D_METHOD("as_text"), &InputEvent::as_text);
- ClassDB::bind_method(D_METHOD("action_match", "event"), &InputEvent::action_match);
ClassDB::bind_method(D_METHOD("shortcut_match", "event"), &InputEvent::shortcut_match);
ClassDB::bind_method(D_METHOD("is_action_type"), &InputEvent::is_action_type);
@@ -281,7 +295,7 @@ String InputEventKey::as_text() const {
return kc;
}
-bool InputEventKey::action_match(const Ref<InputEvent> &p_event) const {
+bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
Ref<InputEventKey> key = p_event;
if (key.is_null())
@@ -290,7 +304,14 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event) const {
uint32_t code = get_scancode_with_modifiers();
uint32_t event_code = key->get_scancode_with_modifiers();
- return get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
+ bool match = get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
+ if (match) {
+ if (p_pressed != NULL)
+ *p_pressed = key->is_pressed();
+ if (p_strength != NULL)
+ *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ }
+ return match;
}
bool InputEventKey::shortcut_match(const Ref<InputEvent> &p_event) const {
@@ -446,13 +467,21 @@ Ref<InputEvent> InputEventMouseButton::xformed_by(const Transform2D &p_xform, co
return mb;
}
-bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event) const {
+bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_null())
return false;
- return mb->button_index == button_index;
+ bool match = mb->button_index == button_index;
+ if (match) {
+ if (p_pressed != NULL)
+ *p_pressed = mb->is_pressed();
+ if (p_strength != NULL)
+ *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ }
+
+ return match;
}
String InputEventMouseButton::as_text() const {
@@ -610,6 +639,7 @@ void InputEventJoypadMotion::set_axis_value(float p_value) {
axis_value = p_value;
}
+
float InputEventJoypadMotion::get_axis_value() const {
return axis_value;
@@ -617,16 +647,25 @@ float InputEventJoypadMotion::get_axis_value() const {
bool InputEventJoypadMotion::is_pressed() const {
- return Math::abs(axis_value) > 0.5f;
+ return Math::abs(axis_value) >= 0.5f;
}
-bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const {
+bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
Ref<InputEventJoypadMotion> jm = p_event;
if (jm.is_null())
return false;
- return (axis == jm->axis && ((axis_value < 0) == (jm->axis_value < 0) || jm->axis_value == 0));
+ bool match = (axis == jm->axis); // Matches even if not in the same direction, but returns a "not pressed" event.
+ if (match) {
+ bool same_direction = (((axis_value < 0) == (jm->axis_value < 0)) || jm->axis_value == 0);
+ bool pressed = same_direction ? Math::abs(jm->get_axis_value()) >= p_deadzone : false;
+ if (p_pressed != NULL)
+ *p_pressed = pressed;
+ if (p_strength != NULL)
+ *p_strength = pressed ? CLAMP(Math::inverse_lerp(p_deadzone, 1.0f, Math::abs(jm->get_axis_value())), 0.0f, 1.0f) : 0.0f;
+ }
+ return match;
}
String InputEventJoypadMotion::as_text() const {
@@ -681,13 +720,21 @@ float InputEventJoypadButton::get_pressure() const {
return pressure;
}
-bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event) const {
+bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
Ref<InputEventJoypadButton> jb = p_event;
if (jb.is_null())
return false;
- return button_index == jb->button_index;
+ bool match = button_index == jb->button_index;
+ if (match) {
+ if (p_pressed != NULL)
+ *p_pressed = jb->is_pressed();
+ if (p_strength != NULL)
+ *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ }
+
+ return match;
}
String InputEventJoypadButton::as_text() const {
@@ -962,6 +1009,11 @@ Ref<InputEvent> InputEventMagnifyGesture::xformed_by(const Transform2D &p_xform,
return ev;
}
+String InputEventMagnifyGesture::as_text() const {
+
+ return "InputEventMagnifyGesture : factor=" + rtos(get_factor()) + ", position=(" + String(get_position()) + ")";
+}
+
void InputEventMagnifyGesture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_factor", "factor"), &InputEventMagnifyGesture::set_factor);
@@ -999,6 +1051,11 @@ Ref<InputEvent> InputEventPanGesture::xformed_by(const Transform2D &p_xform, con
return ev;
}
+String InputEventPanGesture::as_text() const {
+
+ return "InputEventPanGesture : delta=(" + String(get_delta()) + "), position=(" + String(get_position()) + ")";
+}
+
void InputEventPanGesture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_delta", "delta"), &InputEventPanGesture::set_delta);
diff --git a/core/os/input_event.h b/core/os/input_event.h
index ad754d0d1f..037649ed60 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -154,16 +154,21 @@ public:
void set_device(int p_device);
int get_device() const;
+ bool is_action(const StringName &p_action) const;
+ bool is_action_pressed(const StringName &p_action) const;
+ bool is_action_released(const StringName &p_action) const;
+ float get_action_strength(const StringName &p_action) const;
+
+ // To be removed someday, since they do not make sense for all events
virtual bool is_pressed() const;
- virtual bool is_action(const StringName &p_action) const;
- virtual bool is_action_pressed(const StringName &p_action) const;
- virtual bool is_action_released(const StringName &p_action) const;
virtual bool is_echo() const;
+ // ...-.
+
virtual String as_text() const;
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
- virtual bool action_match(const Ref<InputEvent> &p_event) const;
+ virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const;
virtual bool shortcut_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const;
@@ -244,7 +249,7 @@ public:
uint32_t get_scancode_with_modifiers() const;
- virtual bool action_match(const Ref<InputEvent> &p_event) const;
+ virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const;
virtual bool shortcut_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const { return true; }
@@ -305,7 +310,7 @@ public:
bool is_doubleclick() const;
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
- virtual bool action_match(const Ref<InputEvent> &p_event) const;
+ virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const;
virtual bool is_action_type() const { return true; }
virtual String as_text() const;
@@ -352,7 +357,8 @@ public:
float get_axis_value() const;
virtual bool is_pressed() const;
- virtual bool action_match(const Ref<InputEvent> &p_event) const;
+
+ virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const;
virtual bool is_action_type() const { return true; }
virtual String as_text() const;
@@ -379,7 +385,7 @@ public:
void set_pressure(float p_pressure);
float get_pressure() const;
- virtual bool action_match(const Ref<InputEvent> &p_event) const;
+ virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const;
virtual bool is_action_type() const { return true; }
virtual String as_text() const;
@@ -494,6 +500,7 @@ public:
real_t get_factor() const;
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
+ virtual String as_text() const;
InputEventMagnifyGesture();
};
@@ -511,6 +518,7 @@ public:
Vector2 get_delta() const;
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
+ virtual String as_text() const;
InputEventPanGesture();
};
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index fa53cc85c8..9dfc91e308 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -461,99 +461,6 @@ const char *find_keycode_name(int p_keycode) {
return "";
}
-struct _KeyCodeReplace {
- int from;
- int to;
-};
-
-static const _KeyCodeReplace _keycode_replace_qwertz[] = {
- { KEY_Y, KEY_Z },
- { KEY_Z, KEY_Y },
- { 0, 0 }
-};
-
-static const _KeyCodeReplace _keycode_replace_azerty[] = {
- { KEY_W, KEY_Z },
- { KEY_Z, KEY_W },
- { KEY_A, KEY_Q },
- { KEY_Q, KEY_A },
- { KEY_SEMICOLON, KEY_M },
- { KEY_M, KEY_SEMICOLON },
- { 0, 0 }
-};
-
-static const _KeyCodeReplace _keycode_replace_qzerty[] = {
- { KEY_W, KEY_Z },
- { KEY_Z, KEY_W },
- { KEY_SEMICOLON, KEY_M },
- { KEY_M, KEY_SEMICOLON },
- { 0, 0 }
-};
-
-static const _KeyCodeReplace _keycode_replace_dvorak[] = {
- { KEY_UNDERSCORE, KEY_BRACELEFT },
- { KEY_EQUAL, KEY_BRACERIGHT },
- { KEY_Q, KEY_APOSTROPHE },
- { KEY_W, KEY_COMMA },
- { KEY_E, KEY_PERIOD },
- { KEY_R, KEY_P },
- { KEY_T, KEY_Y },
- { KEY_Y, KEY_F },
- { KEY_U, KEY_G },
- { KEY_I, KEY_C },
- { KEY_O, KEY_R },
- { KEY_P, KEY_L },
- { KEY_BRACELEFT, KEY_SLASH },
- { KEY_BRACERIGHT, KEY_EQUAL },
- { KEY_A, KEY_A },
- { KEY_S, KEY_O },
- { KEY_D, KEY_E },
- { KEY_F, KEY_U },
- { KEY_G, KEY_I },
- { KEY_H, KEY_D },
- { KEY_J, KEY_H },
- { KEY_K, KEY_T },
- { KEY_L, KEY_N },
- { KEY_SEMICOLON, KEY_S },
- { KEY_APOSTROPHE, KEY_UNDERSCORE },
- { KEY_Z, KEY_SEMICOLON },
- { KEY_X, KEY_Q },
- { KEY_C, KEY_J },
- { KEY_V, KEY_K },
- { KEY_B, KEY_X },
- { KEY_N, KEY_B },
- { KEY_M, KEY_M },
- { KEY_COMMA, KEY_W },
- { KEY_PERIOD, KEY_V },
- { KEY_SLASH, KEY_Z },
- { 0, 0 }
-};
-
-static const _KeyCodeReplace _keycode_replace_neo[] = {
- { 0, 0 }
-};
-
-static const _KeyCodeReplace _keycode_replace_colemak[] = {
- { KEY_E, KEY_F },
- { KEY_R, KEY_P },
- { KEY_T, KEY_G },
- { KEY_Y, KEY_J },
- { KEY_U, KEY_L },
- { KEY_I, KEY_U },
- { KEY_O, KEY_Y },
- { KEY_P, KEY_SEMICOLON },
- { KEY_S, KEY_R },
- { KEY_D, KEY_S },
- { KEY_F, KEY_T },
- { KEY_G, KEY_D },
- { KEY_J, KEY_N },
- { KEY_K, KEY_E },
- { KEY_L, KEY_I },
- { KEY_SEMICOLON, KEY_O },
- { KEY_N, KEY_K },
- { 0, 0 }
-};
-
int keycode_get_count() {
const _KeyCodeText *kct = &_keycodes[0];
@@ -574,31 +481,3 @@ int keycode_get_value_by_index(int p_index) {
const char *keycode_get_name_by_index(int p_index) {
return _keycodes[p_index].text;
}
-
-int latin_keyboard_keycode_convert(int p_keycode) {
-
- const _KeyCodeReplace *kcr = NULL;
- switch (OS::get_singleton()->get_latin_keyboard_variant()) {
-
- case OS::LATIN_KEYBOARD_QWERTY: return p_keycode; break;
- case OS::LATIN_KEYBOARD_QWERTZ: kcr = _keycode_replace_qwertz; break;
- case OS::LATIN_KEYBOARD_AZERTY: kcr = _keycode_replace_azerty; break;
- case OS::LATIN_KEYBOARD_QZERTY: kcr = _keycode_replace_qzerty; break;
- case OS::LATIN_KEYBOARD_DVORAK: kcr = _keycode_replace_dvorak; break;
- case OS::LATIN_KEYBOARD_NEO: kcr = _keycode_replace_neo; break;
- case OS::LATIN_KEYBOARD_COLEMAK: kcr = _keycode_replace_colemak; break;
- default: return p_keycode;
- }
-
- if (!kcr) {
- return p_keycode;
- }
-
- while (kcr->from) {
- if (kcr->from == p_keycode)
- return kcr->to;
- kcr++;
- }
-
- return p_keycode;
-}
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index 4c253fa4ce..a0e6f8b2ef 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -331,6 +331,5 @@ const char *find_keycode_name(int p_keycode);
int keycode_get_count();
int keycode_get_value_by_index(int p_index);
const char *keycode_get_name_by_index(int p_index);
-int latin_keyboard_keycode_convert(int p_keycode);
#endif
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 422acf95dc..5eed10e30c 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -34,6 +34,7 @@
#include "input.h"
#include "os/file_access.h"
#include "project_settings.h"
+#include "servers/audio_server.h"
#include "version_generated.gen.h"
#include <stdarg.h>
@@ -410,7 +411,7 @@ Error OS::set_cwd(const String &p_cwd) {
bool OS::has_touchscreen_ui_hint() const {
//return false;
- return Input::get_singleton() && Input::get_singleton()->is_emulating_touchscreen();
+ return Input::get_singleton() && Input::get_singleton()->is_emulating_touch_from_mouse();
}
int OS::get_free_static_memory() const {
@@ -627,6 +628,34 @@ void OS::center_window() {
set_window_position(Vector2(x, y));
}
+int OS::get_video_driver_count() const {
+
+ return 2;
+}
+
+const char *OS::get_video_driver_name(int p_driver) const {
+
+ switch (p_driver) {
+ case VIDEO_DRIVER_GLES2:
+ return "GLES2";
+ case VIDEO_DRIVER_GLES3:
+ default:
+ return "GLES3";
+ }
+}
+
+int OS::get_audio_driver_count() const {
+
+ return AudioDriverManager::get_driver_count();
+}
+
+const char *OS::get_audio_driver_name(int p_driver) const {
+
+ AudioDriver *driver = AudioDriverManager::get_driver(p_driver);
+ ERR_FAIL_COND_V(!driver, "");
+ return AudioDriverManager::get_driver(p_driver)->get_name();
+}
+
OS::OS() {
void *volatile stack_bottom;
@@ -643,6 +672,7 @@ OS::OS() {
_render_thread_mode = RENDER_THREAD_SAFE;
_allow_hidpi = false;
+ _allow_layered = false;
_stack_bottom = (void *)(&stack_bottom);
_logger = NULL;
diff --git a/core/os/os.h b/core/os/os.h
index 38e55fa3b7..adf01a90e7 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -44,6 +44,12 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+enum VideoDriver {
+ VIDEO_DRIVER_GLES3,
+ VIDEO_DRIVER_GLES2,
+ VIDEO_DRIVER_MAX,
+};
+
class OS {
static OS *singleton;
@@ -59,6 +65,7 @@ class OS {
int _exit_code;
int _orientation;
bool _allow_hidpi;
+ bool _allow_layered;
bool _use_vsync;
char *last_error;
@@ -96,6 +103,8 @@ public:
bool maximized;
bool always_on_top;
bool use_vsync;
+ bool layered_splash;
+ bool layered;
float get_aspect() const { return (float)width / (float)height; }
VideoMode(int p_width = 1024, int p_height = 600, bool p_fullscreen = false, bool p_resizable = true, bool p_borderless_window = false, bool p_maximized = false, bool p_always_on_top = false, bool p_use_vsync = false) {
width = p_width;
@@ -106,6 +115,8 @@ public:
maximized = p_maximized;
always_on_top = p_always_on_top;
use_vsync = p_use_vsync;
+ layered = false;
+ layered_splash = false;
}
};
@@ -115,12 +126,6 @@ protected:
RenderThreadMode _render_thread_mode;
// functions used by main to initialize/deintialize the OS
- virtual int get_video_driver_count() const = 0;
- virtual const char *get_video_driver_name(int p_driver) const = 0;
-
- virtual int get_audio_driver_count() const = 0;
- virtual const char *get_audio_driver_name(int p_driver) const = 0;
-
void add_logger(Logger *p_logger);
virtual void initialize_core() = 0;
@@ -175,6 +180,12 @@ public:
virtual VideoMode get_video_mode(int p_screen = 0) const = 0;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const = 0;
+ virtual int get_video_driver_count() const;
+ virtual const char *get_video_driver_name(int p_driver) const;
+
+ virtual int get_audio_driver_count() const;
+ virtual const char *get_audio_driver_name(int p_driver) const;
+
virtual int get_screen_count() const { return 1; }
virtual int get_current_screen() const { return 0; }
virtual void set_current_screen(int p_screen) {}
@@ -199,9 +210,29 @@ public:
virtual void request_attention() {}
virtual void center_window();
+ // Returns window area free of hardware controls and other obstacles.
+ // The application should use this to determine where to place UI elements.
+ //
+ // Keep in mind the area returned is in window coordinates rather than
+ // viewport coordinates - you should perform the conversion on your own.
+ //
+ // The maximum size of the area is Rect2(0, 0, window_size.width, window_size.height).
+ virtual Rect2 get_window_safe_area() const {
+ Size2 window_size = get_window_size();
+ return Rect2(0, 0, window_size.width, window_size.height);
+ }
+
virtual void set_borderless_window(bool p_borderless) {}
virtual bool get_borderless_window() { return 0; }
+ virtual bool get_window_per_pixel_transparency_enabled() const { return false; }
+ virtual void set_window_per_pixel_transparency_enabled(bool p_enabled) {}
+
+ virtual uint8_t *get_layered_buffer_data() { return NULL; }
+ virtual Size2 get_layered_buffer_size() { return Size2(0, 0); }
+ virtual void swap_layered_buffer() {}
+
+ virtual void set_ime_active(const bool p_active) {}
virtual void set_ime_position(const Point2 &p_pos) {}
virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp) {}
@@ -302,6 +333,7 @@ public:
virtual void disable_crash_handler() {}
virtual bool is_disable_crash_handler() const { return false; }
+ virtual void initialize_debugging() {}
enum CursorShape {
CURSOR_ARROW,
@@ -462,6 +494,7 @@ public:
virtual void force_process_input(){};
bool has_feature(const String &p_feature);
+ bool is_layered_allowed() const { return _allow_layered; }
bool is_hidpi_allowed() const { return _allow_hidpi; }
OS();
virtual ~OS();
diff --git a/core/os/thread_dummy.cpp b/core/os/thread_dummy.cpp
index fa0bb3dafd..b6371235c4 100644
--- a/core/os/thread_dummy.cpp
+++ b/core/os/thread_dummy.cpp
@@ -55,3 +55,11 @@ Semaphore *SemaphoreDummy::create() {
void SemaphoreDummy::make_default() {
Semaphore::create_func = &SemaphoreDummy::create;
};
+
+RWLock *RWLockDummy::create() {
+ return memnew(RWLockDummy);
+};
+
+void RWLockDummy::make_default() {
+ RWLock::create_func = &RWLockDummy::create;
+};
diff --git a/core/os/thread_dummy.h b/core/os/thread_dummy.h
index b67b52a726..74957b95fe 100644
--- a/core/os/thread_dummy.h
+++ b/core/os/thread_dummy.h
@@ -32,6 +32,7 @@
#define THREAD_DUMMY_H
#include "mutex.h"
+#include "rw_lock.h"
#include "semaphore.h"
#include "thread.h"
@@ -69,4 +70,20 @@ public:
static void make_default();
};
+class RWLockDummy : public RWLock {
+
+ static RWLock *create();
+
+public:
+ virtual void read_lock() {}
+ virtual void read_unlock() {}
+ virtual Error read_try_lock() { return OK; }
+
+ virtual void write_lock() {}
+ virtual void write_unlock() {}
+ virtual Error write_try_lock() { return OK; }
+
+ static void make_default();
+};
+
#endif
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 017586b92a..8952314212 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -359,7 +359,7 @@ Error PoolAllocator::resize(ID p_mem, int p_new_size) {
//p_new_size = align(p_new_size)
int _free = free_mem; // - static_area_size;
- if ((_free + aligned(e->len)) - alloc_size < 0) {
+ if (uint32_t(_free + aligned(e->len)) < alloc_size) {
mt_unlock();
ERR_FAIL_V(ERR_OUT_OF_MEMORY);
};
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 427fa77e62..a7bfc8895b 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -42,7 +42,7 @@
#include "variant_parser.h"
#include <zlib.h>
-#define FORMAT_VERSION 3
+#define FORMAT_VERSION 4
ProjectSettings *ProjectSettings::singleton = NULL;
@@ -137,7 +137,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
else {
if (p_name == CoreStringNames::get_singleton()->_custom_features) {
- Vector<String> custom_feature_array = p_value;
+ Vector<String> custom_feature_array = String(p_value).split(",");
for (int i = 0; i < custom_feature_array.size(); i++) {
custom_features.insert(custom_feature_array[i]);
@@ -262,6 +262,23 @@ bool ProjectSettings::_load_resource_pack(const String &p_pack) {
return true;
}
+void ProjectSettings::_convert_to_last_version() {
+ if (!has_setting("config_version") || (int)get_setting("config_version") <= 3) {
+
+ // Converts the actions from array to dictionary (array of events to dictionary with deadzone + events)
+ for (Map<StringName, ProjectSettings::VariantContainer>::Element *E = props.front(); E; E = E->next()) {
+ Variant value = E->get().variant;
+ if (String(E->key()).begins_with("input/") && value.get_type() == Variant::ARRAY) {
+ Array array = value;
+ Dictionary action;
+ action["deadzone"] = Variant(0.5f);
+ action["events"] = array;
+ E->get().variant = action;
+ }
+ }
+ }
+}
+
Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards) {
//If looking for files in network, just use network!
@@ -390,6 +407,8 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo
if (resource_path.length() && resource_path[resource_path.length() - 1] == '/')
resource_path = resource_path.substr(0, resource_path.length() - 1); // chop end
+ _convert_to_last_version();
+
return OK;
}
@@ -692,7 +711,10 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
String vstr;
VariantWriter::write_to_string(value, vstr);
- file->store_string(F->get() + "=" + vstr + "\n");
+ if (F->get().find(" ") != -1)
+ file->store_string(F->get().quote() + "=" + vstr + "\n");
+ else
+ file->store_string(F->get() + "=" + vstr + "\n");
}
}
@@ -794,12 +816,11 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
Variant ret;
- if (ProjectSettings::get_singleton()->has_setting(p_var)) {
- ret = ProjectSettings::get_singleton()->get(p_var);
- } else {
+ if (!ProjectSettings::get_singleton()->has_setting(p_var)) {
ProjectSettings::get_singleton()->set(p_var, p_default);
- ret = p_default;
}
+ ret = ProjectSettings::get_singleton()->get(p_var);
+
ProjectSettings::get_singleton()->set_initial_value(p_var, p_default);
ProjectSettings::get_singleton()->set_builtin_order(p_var);
return ret;
@@ -1027,6 +1048,20 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("input/ui_page_down", va);
input_presets.push_back("input/ui_page_down");
+ va = Array();
+ key.instance();
+ key->set_scancode(KEY_HOME);
+ va.push_back(key);
+ GLOBAL_DEF("input/ui_home", va);
+ input_presets.push_back("input/ui_home");
+
+ va = Array();
+ key.instance();
+ key->set_scancode(KEY_END);
+ va.push_back(key);
+ GLOBAL_DEF("input/ui_end", va);
+ input_presets.push_back("input/ui_end");
+
//GLOBAL_DEF("display/window/handheld/orientation", "landscape");
custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::STRING, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor");
diff --git a/core/project_settings.h b/core/project_settings.h
index 9b51bc3ac3..b01e7855aa 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -102,6 +102,8 @@ protected:
Error _save_custom_bnd(const String &p_file);
+ void _convert_to_last_version();
+
bool _load_resource_pack(const String &p_pack);
void _add_property_info_bind(const Dictionary &p_info);
diff --git a/core/reference.h b/core/reference.h
index a0bdb62258..0d6b1ced6e 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -63,7 +63,7 @@ public:
template <class T>
class Ref {
- T *reference = NULL;
+ T *reference;
void ref(const Ref &p_from) {
@@ -213,10 +213,9 @@ public:
Ref(T *p_reference) {
+ reference = NULL;
if (p_reference)
ref_pointer(p_reference);
- else
- reference = NULL;
}
Ref(const Variant &p_variant) {
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 006459c5f6..2a611ccf6a 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -42,6 +42,7 @@
#include "io/config_file.h"
#include "io/http_client.h"
#include "io/marshalls.h"
+#include "io/multiplayer_api.h"
#include "io/networked_multiplayer_peer.h"
#include "io/packet_peer.h"
#include "io/packet_peer_udp.h"
@@ -145,6 +146,7 @@ void register_core_types() {
ClassDB::register_virtual_class<PacketPeer>();
ClassDB::register_class<PacketPeerStream>();
ClassDB::register_virtual_class<NetworkedMultiplayerPeer>();
+ ClassDB::register_class<MultiplayerAPI>();
ClassDB::register_class<MainLoop>();
//ClassDB::register_type<OptimizedSaver>();
ClassDB::register_class<Translation>();
diff --git a/core/resource.cpp b/core/resource.cpp
index 2eeed50d9d..87ff4d3c2a 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -187,7 +187,6 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache) {
- print_line("configure for local: " + get_class());
List<PropertyInfo> plist;
get_property_list(&plist);
@@ -227,14 +226,19 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
Variant p = get(E->get().name);
- if (p.get_type() == Variant::OBJECT && p_subresources) {
+
+ if ((p.get_type() == Variant::DICTIONARY || p.get_type() == Variant::ARRAY)) {
+ p = p.duplicate(p_subresources); //does not make a long of sense but should work?
+ } else if (p.get_type() == Variant::OBJECT && (p_subresources || (E->get().usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE))) {
RES sr = p;
- if (sr.is_valid())
- p = sr->duplicate(true);
- }
+ if (sr.is_valid()) {
+ r->set(E->get().name, sr->duplicate(p_subresources));
+ }
+ } else {
- r->set(E->get().name, p);
+ r->set(E->get().name, p);
+ }
}
return Ref<Resource>(r);
@@ -288,7 +292,7 @@ uint32_t Resource::hash_edited_version() const {
for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
- if (E->get().type == Variant::OBJECT && E->get().hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ if (E->get().usage & PROPERTY_USAGE_STORAGE && E->get().type == Variant::OBJECT && E->get().hint == PROPERTY_HINT_RESOURCE_TYPE) {
RES res = get(E->get().name);
if (res.is_valid()) {
hash = hash_djb2_one_32(res->hash_edited_version(), hash);
diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp
index c0e115e300..55d7270473 100644
--- a/core/script_debugger_local.cpp
+++ b/core/script_debugger_local.cpp
@@ -29,12 +29,23 @@
/*************************************************************************/
#include "script_debugger_local.h"
+#include "scene/main/scene_tree.h"
#include "os/os.h"
void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue) {
- print_line("Debugger Break, Reason: '" + p_script->debug_get_error() + "'");
+ if (!target_function.empty()) {
+ String current_function = p_script->debug_get_stack_level_function(0);
+ if (current_function != target_function) {
+ set_depth(0);
+ set_lines_left(1);
+ return;
+ }
+ target_function = "";
+ }
+
+ print_line("\nDebugger Break, Reason: '" + p_script->debug_get_error() + "'");
print_line("*Frame " + itos(0) + " - " + p_script->debug_get_stack_level_source(0) + ":" + itos(p_script->debug_get_stack_level_line(0)) + " in function '" + p_script->debug_get_stack_level_function(0) + "'");
print_line("Enter \"help\" for assistance.");
int current_frame = 0;
@@ -44,8 +55,11 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue) {
OS::get_singleton()->print("debug> ");
String line = OS::get_singleton()->get_stdin_string().strip_edges();
+ // Cache options
+ String variable_prefix = options["variable_prefix"];
+
if (line == "") {
- print_line("Debugger Break, Reason: '" + p_script->debug_get_error() + "'");
+ print_line("\nDebugger Break, Reason: '" + p_script->debug_get_error() + "'");
print_line("*Frame " + itos(current_frame) + " - " + p_script->debug_get_stack_level_source(current_frame) + ":" + itos(p_script->debug_get_stack_level_line(current_frame)) + " in function '" + p_script->debug_get_stack_level_function(current_frame) + "'");
print_line("Enter \"help\" for assistance.");
} else if (line == "c" || line == "continue")
@@ -72,38 +86,56 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue) {
}
}
+ } else if (line.begins_with("set")) {
+
+ if (line.get_slice_count(" ") == 1) {
+
+ for (Map<String, String>::Element *E = options.front(); E; E = E->next()) {
+ print_line("\t" + E->key() + "=" + E->value());
+ }
+
+ } else {
+ String key_value = line.get_slicec(' ', 1);
+ int value_pos = key_value.find("=");
+
+ if (value_pos < 0) {
+ print_line("Error: Invalid set format. Use: set key=value");
+ } else {
+
+ String key = key_value.left(value_pos);
+
+ if (!options.has(key)) {
+ print_line("Error: Unknown option " + key);
+ } else {
+
+ // Allow explicit tab character
+ String value = key_value.right(value_pos + 1).replace("\\t", "\t");
+
+ options[key] = value;
+ }
+ }
+ }
+
} else if (line == "lv" || line == "locals") {
List<String> locals;
List<Variant> values;
p_script->debug_get_stack_level_locals(current_frame, &locals, &values);
- List<Variant>::Element *V = values.front();
- for (List<String>::Element *E = locals.front(); E; E = E->next()) {
- print_line(E->get() + ": " + String(V->get()));
- V = V->next();
- }
+ print_variables(locals, values, variable_prefix);
} else if (line == "gv" || line == "globals") {
- List<String> locals;
+ List<String> globals;
List<Variant> values;
- p_script->debug_get_globals(&locals, &values);
- List<Variant>::Element *V = values.front();
- for (List<String>::Element *E = locals.front(); E; E = E->next()) {
- print_line(E->get() + ": " + String(V->get()));
- V = V->next();
- }
+ p_script->debug_get_globals(&globals, &values);
+ print_variables(globals, values, variable_prefix);
} else if (line == "mv" || line == "members") {
- List<String> locals;
+ List<String> members;
List<Variant> values;
- p_script->debug_get_stack_level_members(current_frame, &locals, &values);
- List<Variant>::Element *V = values.front();
- for (List<String>::Element *E = locals.front(); E; E = E->next()) {
- print_line(E->get() + ": " + String(V->get()));
- V = V->next();
- }
+ p_script->debug_get_stack_level_members(current_frame, &members, &values);
+ print_variables(members, values, variable_prefix);
} else if (line.begins_with("p") || line.begins_with("print")) {
@@ -121,65 +153,149 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue) {
set_depth(-1);
set_lines_left(1);
break;
- } else if (line.begins_with("n") || line.begins_with("next")) {
+ } else if (line == "n" || line == "next") {
set_depth(0);
set_lines_left(1);
break;
+ } else if (line == "fin" || line == "finish") {
+
+ String current_function = p_script->debug_get_stack_level_function(0);
+
+ for (int i = 0; i < total_frames; i++) {
+ target_function = p_script->debug_get_stack_level_function(i);
+ if (target_function != current_function) {
+ set_depth(0);
+ set_lines_left(1);
+ return;
+ }
+ }
+
+ print_line("Error: Reached last frame.");
+ target_function = "";
+
} else if (line.begins_with("br") || line.begins_with("break")) {
if (line.get_slice_count(" ") <= 1) {
- //show breakpoints
+
+ const Map<int, Set<StringName> > &breakpoints = get_breakpoints();
+ if (breakpoints.size() == 0) {
+ print_line("No Breakpoints.");
+ continue;
+ }
+
+ print_line("Breakpoint(s): " + itos(breakpoints.size()));
+ for (Map<int, Set<StringName> >::Element *E = breakpoints.front(); E; E = E->next()) {
+ print_line("\t" + String(E->value().front()->get()) + ":" + itos(E->key()));
+ }
+
} else {
- String bppos = line.get_slicec(' ', 1);
- String source = bppos.get_slicec(':', 0).strip_edges();
- int line = bppos.get_slicec(':', 1).strip_edges().to_int();
+ Pair<String, int> breakpoint = to_breakpoint(line);
+
+ String source = breakpoint.first;
+ int linenr = breakpoint.second;
- source = breakpoint_find_source(source);
+ if (source.empty())
+ continue;
- insert_breakpoint(line, source);
+ insert_breakpoint(linenr, source);
- print_line("BreakPoint at " + source + ":" + itos(line));
+ print_line("Added breakpoint at " + source + ":" + itos(linenr));
}
+ } else if (line == "q" || line == "quit") {
+
+ // Do not stop again on quit
+ clear_breakpoints();
+ ScriptDebugger::get_singleton()->set_depth(-1);
+ ScriptDebugger::get_singleton()->set_lines_left(-1);
+
+ SceneTree::get_singleton()->quit();
+ break;
} else if (line.begins_with("delete")) {
if (line.get_slice_count(" ") <= 1) {
clear_breakpoints();
} else {
- String bppos = line.get_slicec(' ', 1);
- String source = bppos.get_slicec(':', 0).strip_edges();
- int line = bppos.get_slicec(':', 1).strip_edges().to_int();
+ Pair<String, int> breakpoint = to_breakpoint(line);
+
+ String source = breakpoint.first;
+ int linenr = breakpoint.second;
- source = breakpoint_find_source(source);
+ if (source.empty())
+ continue;
- remove_breakpoint(line, source);
+ remove_breakpoint(linenr, source);
- print_line("Removed BreakPoint at " + source + ":" + itos(line));
+ print_line("Removed breakpoint at " + source + ":" + itos(linenr));
}
} else if (line == "h" || line == "help") {
print_line("Built-In Debugger command list:\n");
- print_line("\tc,continue :\t\t Continue execution.");
- print_line("\tbt,backtrace :\t\t Show stack trace (frames).");
+ print_line("\tc,continue\t\t Continue execution.");
+ print_line("\tbt,backtrace\t\t Show stack trace (frames).");
print_line("\tfr,frame <frame>:\t Change current frame.");
- print_line("\tlv,locals :\t\t Show local variables for current frame.");
- print_line("\tmv,members :\t\t Show member variables for \"this\" in frame.");
- print_line("\tgv,globals :\t\t Show global variables.");
- print_line("\tp,print <expr> :\t Execute and print variable in expression.");
- print_line("\ts,step :\t\t Step to next line.");
- print_line("\tn,next :\t\t Next line.");
- print_line("\tbr,break source:line :\t Place a breakpoint.");
- print_line("\tdelete [source:line]:\t\t Delete one/all breakpoints.");
+ print_line("\tlv,locals\t\t Show local variables for current frame.");
+ print_line("\tmv,members\t\t Show member variables for \"this\" in frame.");
+ print_line("\tgv,globals\t\t Show global variables.");
+ print_line("\tp,print <expr>\t\t Execute and print variable in expression.");
+ print_line("\ts,step\t\t\t Step to next line.");
+ print_line("\tn,next\t\t\t Next line.");
+ print_line("\tfin,finish\t\t Step out of current frame.");
+ print_line("\tbr,break [source:line]\t List all breakpoints or place a breakpoint.");
+ print_line("\tdelete [source:line]:\t Delete one/all breakpoints.");
+ print_line("\tset [key=value]:\t List all options, or set one.");
+ print_line("\tq,quit\t\t\t Quit application.");
} else {
print_line("Error: Invalid command, enter \"help\" for assistance.");
}
}
}
+void ScriptDebuggerLocal::print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix) {
+
+ String value;
+ Vector<String> value_lines;
+ const List<Variant>::Element *V = values.front();
+ for (const List<String>::Element *E = names.front(); E; E = E->next()) {
+
+ value = String(V->get());
+
+ if (variable_prefix.empty()) {
+ print_line(E->get() + ": " + String(V->get()));
+ } else {
+
+ print_line(E->get() + ":");
+ value_lines = value.split("\n");
+ for (int i = 0; i < value_lines.size(); ++i) {
+ print_line(variable_prefix + value_lines[i]);
+ }
+ }
+
+ V = V->next();
+ }
+}
+
+Pair<String, int> ScriptDebuggerLocal::to_breakpoint(const String &p_line) {
+
+ String breakpoint_part = p_line.get_slicec(' ', 1);
+ Pair<String, int> breakpoint;
+
+ int last_colon = breakpoint_part.rfind(":");
+ if (last_colon < 0) {
+ print_line("Error: Invalid breakpoint format. Expected [source:line]");
+ return breakpoint;
+ }
+
+ breakpoint.first = breakpoint_find_source(breakpoint_part.left(last_colon).strip_edges());
+ breakpoint.second = breakpoint_part.right(last_colon).strip_edges().to_int();
+
+ return breakpoint;
+}
+
struct _ScriptDebuggerLocalProfileInfoSort {
bool operator()(const ScriptLanguage::ProfilingInfo &A, const ScriptLanguage::ProfilingInfo &B) const {
@@ -304,4 +420,5 @@ ScriptDebuggerLocal::ScriptDebuggerLocal() {
profiling = false;
idle_accum = OS::get_singleton()->get_ticks_usec();
+ options["variable_prefix"] = "";
}
diff --git a/core/script_debugger_local.h b/core/script_debugger_local.h
index c87bc90bb4..7eea6ef215 100644
--- a/core/script_debugger_local.h
+++ b/core/script_debugger_local.h
@@ -31,6 +31,7 @@
#ifndef SCRIPT_DEBUGGER_LOCAL_H
#define SCRIPT_DEBUGGER_LOCAL_H
+#include "list.h"
#include "script_language.h"
class ScriptDebuggerLocal : public ScriptDebugger {
@@ -38,9 +39,14 @@ class ScriptDebuggerLocal : public ScriptDebugger {
bool profiling;
float frame_time, idle_time, physics_time, physics_frame_time;
uint64_t idle_accum;
+ String target_function;
+ Map<String, String> options;
Vector<ScriptLanguage::ProfilingInfo> pinfo;
+ Pair<String, int> to_breakpoint(const String &p_line);
+ void print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix);
+
public:
void debug(ScriptLanguage *p_script, bool p_can_continue);
virtual void send_message(const String &p_message, const Array &p_args);
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 632285f48d..0473e2cc71 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -37,6 +37,7 @@
#include "os/os.h"
#include "project_settings.h"
#include "scene/main/node.h"
+#include "scene/resources/packed_scene.h"
void ScriptDebuggerRemote::_send_video_memory() {
@@ -148,6 +149,16 @@ void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_
}
}
+void ScriptDebuggerRemote::_save_node(ObjectID id, const String &p_path) {
+
+ Node *node = Object::cast_to<Node>(ObjectDB::get_instance(id));
+ ERR_FAIL_COND(!node);
+
+ Ref<PackedScene> ps = memnew(PackedScene);
+ ps->pack(node);
+ ResourceSaver::save(p_path, ps);
+}
+
void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) {
//this function is called when there is a debugger break (bug on script)
@@ -322,6 +333,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue)
else
remove_breakpoint(cmd[2], cmd[1]);
+ } else if (command == "save_node") {
+ _save_node(cmd[1], cmd[2]);
} else {
_parse_live_edit(cmd);
}
@@ -554,22 +567,46 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
if (ScriptInstance *si = obj->get_script_instance()) {
if (!si->get_script().is_null()) {
- Set<StringName> members;
- si->get_script()->get_members(&members);
- for (Set<StringName>::Element *E = members.front(); E; E = E->next()) {
+ typedef Map<const Script *, Set<StringName> > ScriptMemberMap;
+ typedef Map<const Script *, Map<StringName, Variant> > ScriptConstantsMap;
+
+ ScriptMemberMap members;
+ members[si->get_script().ptr()] = Set<StringName>();
+ si->get_script()->get_members(&(members[si->get_script().ptr()]));
+
+ ScriptConstantsMap constants;
+ constants[si->get_script().ptr()] = Map<StringName, Variant>();
+ si->get_script()->get_constants(&(constants[si->get_script().ptr()]));
+
+ Ref<Script> base = si->get_script()->get_base_script();
+ while (base.is_valid()) {
+
+ members[base.ptr()] = Set<StringName>();
+ base->get_members(&(members[base.ptr()]));
- Variant m;
- if (si->get(E->get(), m)) {
- PropertyInfo pi(m.get_type(), String("Members/") + E->get());
- properties.push_back(PropertyDesc(pi, m));
+ constants[base.ptr()] = Map<StringName, Variant>();
+ base->get_constants(&(constants[base.ptr()]));
+
+ base = base->get_base_script();
+ }
+
+ for (ScriptMemberMap::Element *sm = members.front(); sm; sm = sm->next()) {
+ for (Set<StringName>::Element *E = sm->get().front(); E; E = E->next()) {
+ Variant m;
+ if (si->get(E->get(), m)) {
+ String script_path = sm->key() == si->get_script().ptr() ? "" : sm->key()->get_path().get_file() + "/";
+ PropertyInfo pi(m.get_type(), "Members/" + script_path + E->get());
+ properties.push_back(PropertyDesc(pi, m));
+ }
}
}
- Map<StringName, Variant> constants;
- si->get_script()->get_constants(&constants);
- for (Map<StringName, Variant>::Element *E = constants.front(); E; E = E->next()) {
- PropertyInfo pi(E->value().get_type(), (String("Constants/") + E->key()));
- properties.push_back(PropertyDesc(pi, E->value()));
+ for (ScriptConstantsMap::Element *sc = constants.front(); sc; sc = sc->next()) {
+ for (Map<StringName, Variant>::Element *E = sc->get().front(); E; E = E->next()) {
+ String script_path = sc->key() == si->get_script().ptr() ? "" : sc->key()->get_path().get_file() + "/";
+ PropertyInfo pi(E->value().get_type(), "Constants/" + script_path + E->key());
+ properties.push_back(PropertyDesc(pi, E->value()));
+ }
}
}
}
@@ -645,8 +682,10 @@ void ScriptDebuggerRemote::_set_object_property(ObjectID p_id, const String &p_p
return;
String prop_name = p_property;
- if (p_property.begins_with("Members/"))
- prop_name = p_property.substr(8, p_property.length());
+ if (p_property.begins_with("Members/")) {
+ Vector<String> ss = p_property.split("/");
+ prop_name = ss[ss.size() - 1];
+ }
obj->set(prop_name, p_value);
}
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index 2c4e29f172..cc12d978d6 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -133,6 +133,8 @@ class ScriptDebuggerRemote : public ScriptDebugger {
void _put_variable(const String &p_name, const Variant &p_variable);
+ void _save_node(ObjectID id, const String &p_path);
+
public:
struct ResourceUsage {
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 1dab58e29e..acbe3b34db 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -347,6 +347,20 @@ Variant::Type PlaceHolderScriptInstance::get_property_type(const StringName &p_n
return Variant::NIL;
}
+void PlaceHolderScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
+
+ if (script.is_valid()) {
+ script->get_script_method_list(p_list);
+ }
+}
+bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
+
+ if (script.is_valid()) {
+ return script->has_method(p_method);
+ }
+ return false;
+}
+
void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values) {
Set<StringName> new_values;
diff --git a/core/script_language.h b/core/script_language.h
index d1da0a3b72..e7748f93e2 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -31,6 +31,7 @@
#ifndef SCRIPT_LANGUAGE_H
#define SCRIPT_LANGUAGE_H
+#include "io/multiplayer_api.h"
#include "map.h"
#include "pair.h"
#include "resource.h"
@@ -157,16 +158,8 @@ public:
virtual bool is_placeholder() const { return false; }
- enum RPCMode {
- RPC_MODE_DISABLED,
- RPC_MODE_REMOTE,
- RPC_MODE_SYNC,
- RPC_MODE_MASTER,
- RPC_MODE_SLAVE,
- };
-
- virtual RPCMode get_rpc_mode(const StringName &p_method) const = 0;
- virtual RPCMode get_rset_mode(const StringName &p_variable) const = 0;
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const = 0;
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const = 0;
virtual ScriptLanguage *get_language() = 0;
virtual ~ScriptInstance();
@@ -203,6 +196,7 @@ public:
virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {}
virtual bool is_using_templates() { return false; }
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const = 0;
+ virtual String validate_path(const String &p_path) const { return ""; }
virtual Script *create_script() const = 0;
virtual bool has_named_classes() const = 0;
virtual bool supports_builtin_mode() const = 0;
@@ -220,7 +214,9 @@ public:
RESULT_CLASS,
RESULT_CLASS_CONSTANT,
RESULT_CLASS_PROPERTY,
- RESULT_CLASS_METHOD
+ RESULT_CLASS_METHOD,
+ RESULT_CLASS_ENUM,
+ RESULT_CLASS_TBD_GLOBALSCOPE
};
Type type;
Ref<Script> script;
@@ -233,6 +229,8 @@ public:
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const = 0;
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value) = 0;
+ virtual void add_named_global_constant(const StringName &p_name, const Variant &p_value) {}
+ virtual void remove_named_global_constant(const StringName &p_name) {}
/* MULTITHREAD FUNCTIONS */
@@ -306,8 +304,8 @@ public:
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
- virtual void get_method_list(List<MethodInfo> *p_list) const {}
- virtual bool has_method(const StringName &p_method) const { return false; }
+ virtual void get_method_list(List<MethodInfo> *p_list) const;
+ virtual bool has_method(const StringName &p_method) const;
virtual Variant call(const StringName &p_method, VARIANT_ARG_LIST) { return Variant(); }
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
@@ -327,8 +325,8 @@ public:
virtual bool is_placeholder() const { return true; }
- virtual RPCMode get_rpc_mode(const StringName &p_method) const { return RPC_MODE_DISABLED; }
- virtual RPCMode get_rset_mode(const StringName &p_variable) const { return RPC_MODE_DISABLED; }
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const { return MultiplayerAPI::RPC_MODE_DISABLED; }
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const { return MultiplayerAPI::RPC_MODE_DISABLED; }
PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script, Object *p_owner);
~PlaceHolderScriptInstance();
@@ -383,6 +381,7 @@ public:
bool is_breakpoint(int p_line, const StringName &p_source) const;
bool is_breakpoint_line(int p_line) const;
void clear_breakpoints();
+ const Map<int, Set<StringName> > &get_breakpoints() const { return breakpoints; }
virtual void debug(ScriptLanguage *p_script, bool p_can_continue = true) = 0;
virtual void idle_poll();
diff --git a/core/self_list.h b/core/self_list.h
index e83afb66ef..6e84e1cd5f 100644
--- a/core/self_list.h
+++ b/core/self_list.h
@@ -39,6 +39,7 @@ public:
class List {
SelfList<T> *_first;
+ SelfList<T> *_last;
public:
void add(SelfList<T> *p_elem) {
@@ -48,47 +49,54 @@ public:
p_elem->_root = this;
p_elem->_next = _first;
p_elem->_prev = NULL;
- if (_first)
+
+ if (_first) {
_first->_prev = p_elem;
+
+ } else {
+ _last = p_elem;
+ }
+
_first = p_elem;
}
+
void add_last(SelfList<T> *p_elem) {
ERR_FAIL_COND(p_elem->_root);
- if (!_first) {
- add(p_elem);
- return;
- }
+ p_elem->_root = this;
+ p_elem->_next = NULL;
+ p_elem->_prev = _last;
- SelfList<T> *e = _first;
+ if (_last) {
+ _last->_next = p_elem;
- while (e->next()) {
- e = e->next();
+ } else {
+ _first = p_elem;
}
- e->_next = p_elem;
- p_elem->_prev = e->_next;
- p_elem->_root = this;
+ _last = p_elem;
}
void remove(SelfList<T> *p_elem) {
ERR_FAIL_COND(p_elem->_root != this);
if (p_elem->_next) {
-
p_elem->_next->_prev = p_elem->_prev;
}
- if (p_elem->_prev) {
+ if (p_elem->_prev) {
p_elem->_prev->_next = p_elem->_next;
}
if (_first == p_elem) {
-
_first = p_elem->_next;
}
+ if (_last == p_elem) {
+ _last = p_elem->_prev;
+ }
+
p_elem->_next = NULL;
p_elem->_prev = NULL;
p_elem->_root = NULL;
@@ -96,7 +104,10 @@ public:
_FORCE_INLINE_ SelfList<T> *first() { return _first; }
_FORCE_INLINE_ const SelfList<T> *first() const { return _first; }
- _FORCE_INLINE_ List() { _first = NULL; }
+ _FORCE_INLINE_ List() {
+ _first = NULL;
+ _last = NULL;
+ }
_FORCE_INLINE_ ~List() { ERR_FAIL_COND(_first != NULL); }
};
diff --git a/core/string_buffer.h b/core/string_buffer.h
index b148e45544..7e9b151bea 100644
--- a/core/string_buffer.h
+++ b/core/string_buffer.h
@@ -39,7 +39,7 @@ class StringBuffer {
CharType short_buffer[SHORT_BUFFER_SIZE];
String buffer;
- int string_length = 0;
+ int string_length;
_FORCE_INLINE_ CharType *current_buffer_ptr() {
return static_cast<Vector<CharType> &>(buffer).empty() ? short_buffer : buffer.ptrw();
@@ -79,6 +79,10 @@ public:
_FORCE_INLINE_ operator String() {
return as_string();
}
+
+ StringBuffer() {
+ string_length = 0;
+ }
};
template <int SHORT_BUFFER_SIZE>
diff --git a/core/string_builder.h b/core/string_builder.h
index 9e2599ac32..596b3bf730 100644
--- a/core/string_builder.h
+++ b/core/string_builder.h
@@ -37,7 +37,7 @@
class StringBuilder {
- uint32_t string_length = 0;
+ uint32_t string_length;
Vector<String> strings;
Vector<const char *> c_strings;
@@ -75,6 +75,10 @@ public:
_FORCE_INLINE_ operator String() const {
return as_string();
}
+
+ StringBuilder() {
+ string_length = 0;
+ }
};
#endif // STRING_BUILDER_H
diff --git a/core/string_db.cpp b/core/string_db.cpp
index 6e1f887754..2475cbe3e8 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -164,21 +164,14 @@ void StringName::operator=(const StringName &p_name) {
_data = p_name._data;
}
}
-/* was inlined
-StringName::operator String() const {
- if (_data)
- return _data->get_name();
-
- return "";
-}
-*/
StringName::StringName(const StringName &p_name) {
- ERR_FAIL_COND(!configured);
_data = NULL;
- if (p_name._data && p_name._data->refcount.ref()) {
+ ERR_FAIL_COND(!configured);
+
+ if (p_name._data && p_name._data->refcount.ref()) {
_data = p_name._data;
}
}
diff --git a/core/string_db.h b/core/string_db.h
index 28ca812a45..965385b136 100644
--- a/core/string_db.h
+++ b/core/string_db.h
@@ -31,7 +31,6 @@
#ifndef STRING_DB_H
#define STRING_DB_H
-#include "hash_map.h"
#include "os/mutex.h"
#include "safe_refcount.h"
#include "ustring.h"
@@ -67,6 +66,7 @@ class StringName {
_Data() {
cname = NULL;
next = prev = NULL;
+ idx = 0;
hash = 0;
}
};
@@ -167,11 +167,6 @@ public:
~StringName();
};
-struct StringNameHasher {
-
- static _FORCE_INLINE_ uint32_t hash(const StringName &p_string) { return p_string.hash(); }
-};
-
StringName _scs_create(const char *p_chr);
#endif
diff --git a/core/type_info.h b/core/type_info.h
index c1af4fac69..bf497f1e5f 100644
--- a/core/type_info.h
+++ b/core/type_info.h
@@ -194,6 +194,7 @@ MAKE_TEMPLATE_TYPE_INFO(Vector, Color, Variant::POOL_COLOR_ARRAY)
MAKE_TEMPLATE_TYPE_INFO(Vector, Variant, Variant::ARRAY)
MAKE_TEMPLATE_TYPE_INFO(Vector, RID, Variant::ARRAY)
MAKE_TEMPLATE_TYPE_INFO(Vector, Plane, Variant::ARRAY)
+MAKE_TEMPLATE_TYPE_INFO(Vector, StringName, Variant::POOL_STRING_ARRAY)
MAKE_TEMPLATE_TYPE_INFO(PoolVector, Plane, Variant::ARRAY)
MAKE_TEMPLATE_TYPE_INFO(PoolVector, Face3, Variant::POOL_VECTOR3_ARRAY)
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index b3f9dd818d..b9a2fdd0ac 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -299,26 +299,30 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {
}
}
-void UndoRedo::redo() {
+bool UndoRedo::redo() {
- ERR_FAIL_COND(action_level > 0);
+ ERR_FAIL_COND_V(action_level > 0, false);
if ((current_action + 1) >= actions.size())
- return; //nothing to redo
+ return false; //nothing to redo
current_action++;
_process_operation_list(actions[current_action].do_ops.front());
version++;
+
+ return true;
}
-void UndoRedo::undo() {
+bool UndoRedo::undo() {
- ERR_FAIL_COND(action_level > 0);
+ ERR_FAIL_COND_V(action_level > 0, false);
if (current_action < 0)
- return; //nothing to redo
+ return false; //nothing to redo
_process_operation_list(actions[current_action].undo_ops.front());
current_action--;
version--;
+
+ return true;
}
void UndoRedo::clear_history() {
diff --git a/core/undo_redo.h b/core/undo_redo.h
index a373296b73..3a17c78851 100644
--- a/core/undo_redo.h
+++ b/core/undo_redo.h
@@ -109,8 +109,8 @@ public:
void commit_action();
- void redo();
- void undo();
+ bool redo();
+ bool undo();
String get_current_action_name() const;
void clear_history();
diff --git a/core/ustring.cpp b/core/ustring.cpp
index d445e4ed47..51f05468e2 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -753,6 +753,46 @@ Vector<String> String::split(const String &p_splitter, bool p_allow_empty, int p
return ret;
}
+Vector<String> String::rsplit(const String &p_splitter, bool p_allow_empty, int p_maxsplit) const {
+
+ Vector<String> ret;
+ const int len = length();
+ int from = len;
+
+ while (true) {
+
+ int end = rfind(p_splitter, from);
+ if (end < 0)
+ end = 0;
+
+ if (p_allow_empty || (end < from)) {
+ const String str = substr(end > 0 ? end + p_splitter.length() : end, end > 0 ? from - end : from + 2);
+
+ if (p_maxsplit <= 0) {
+ ret.push_back(str);
+ } else if (p_maxsplit > 0) {
+
+ // Put rest of the string and leave cycle.
+ if (p_maxsplit == ret.size()) {
+ ret.push_back(substr(0, from + 2));
+ break;
+ }
+
+ // Otherwise, push items until positive limit is reached.
+ ret.push_back(str);
+ }
+ }
+
+ if (end == 0)
+ break;
+
+ from = end - p_splitter.length();
+ }
+
+ ret.invert();
+ return ret;
+}
+
Vector<float> String::split_floats(const String &p_splitter, bool p_allow_empty) const {
Vector<float> ret;
@@ -945,8 +985,8 @@ String String::num(double p_num, int p_decimals) {
#ifndef NO_USE_STDLIB
- if (p_decimals > 12)
- p_decimals = 12;
+ if (p_decimals > 16)
+ p_decimals = 16;
char fmt[7];
fmt[0] = '%';
@@ -1135,6 +1175,36 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
return s;
}
+String String::num_uint64(uint64_t p_num, int base, bool capitalize_hex) {
+
+ uint64_t n = p_num;
+
+ int chars = 0;
+ do {
+ n /= base;
+ chars++;
+ } while (n);
+
+ String s;
+ s.resize(chars + 1);
+ CharType *c = s.ptrw();
+ c[chars] = 0;
+ n = p_num;
+ do {
+ int mod = n % base;
+ if (mod >= 10) {
+ char a = (capitalize_hex ? 'A' : 'a');
+ c[--chars] = a + (mod - 10);
+ } else {
+ c[--chars] = '0' + mod;
+ }
+
+ n /= base;
+ } while (n);
+
+ return s;
+}
+
String String::num_real(double p_num) {
String s;
@@ -1520,8 +1590,7 @@ String::String(const StrRange &p_range) {
int String::hex_to_int(bool p_with_prefix) const {
- int l = length();
- if (p_with_prefix && l < 3)
+ if (p_with_prefix && length() < 3)
return 0;
const CharType *s = ptr();
@@ -1530,17 +1599,13 @@ int String::hex_to_int(bool p_with_prefix) const {
if (sign < 0) {
s++;
- l--;
- if (p_with_prefix && l < 2)
- return 0;
}
if (p_with_prefix) {
if (s[0] != '0' || s[1] != 'x')
return 0;
s += 2;
- l -= 2;
- };
+ }
int hex = 0;
@@ -1566,8 +1631,7 @@ int String::hex_to_int(bool p_with_prefix) const {
int64_t String::hex_to_int64(bool p_with_prefix) const {
- int l = length();
- if (p_with_prefix && l < 3)
+ if (p_with_prefix && length() < 3)
return 0;
const CharType *s = ptr();
@@ -1576,17 +1640,13 @@ int64_t String::hex_to_int64(bool p_with_prefix) const {
if (sign < 0) {
s++;
- l--;
- if (p_with_prefix && l < 2)
- return 0;
}
if (p_with_prefix) {
if (s[0] != '0' || s[1] != 'x')
return 0;
s += 2;
- l -= 2;
- };
+ }
int64_t hex = 0;
@@ -2967,6 +3027,40 @@ String String::strip_escapes() const {
return substr(beg, end - beg);
}
+String String::lstrip(const Vector<CharType> &p_chars) const {
+
+ int len = length();
+ int beg;
+
+ for (beg = 0; beg < len; beg++) {
+
+ if (p_chars.find(operator[](beg)) == -1)
+ break;
+ }
+
+ if (beg == 0)
+ return *this;
+
+ return substr(beg, len - beg);
+}
+
+String String::rstrip(const Vector<CharType> &p_chars) const {
+
+ int len = length();
+ int end;
+
+ for (end = len - 1; end >= 0; end--) {
+
+ if (p_chars.find(operator[](end)) == -1)
+ break;
+ }
+
+ if (end == len - 1)
+ return *this;
+
+ return substr(0, end + 1);
+}
+
String String::simplify_path() const {
String s = *this;
@@ -3138,8 +3232,8 @@ String String::word_wrap(int p_chars_per_line) const {
String String::http_escape() const {
const CharString temp = utf8();
String res;
- for (int i = 0; i < length(); ++i) {
- CharType ord = temp[i];
+ for (int i = 0; i < temp.length(); ++i) {
+ char ord = temp[i];
if (ord == '.' || ord == '-' || ord == '_' || ord == '~' ||
(ord >= 'a' && ord <= 'z') ||
(ord >= 'A' && ord <= 'Z') ||
@@ -3148,9 +3242,9 @@ String String::http_escape() const {
} else {
char h_Val[3];
#if defined(__GNUC__) || defined(_MSC_VER)
- snprintf(h_Val, 3, "%.2X", ord);
+ snprintf(h_Val, 3, "%hhX", ord);
#else
- sprintf(h_Val, "%.2X", ord);
+ sprintf(h_Val, "%hhX", ord);
#endif
res += "%";
res += h_Val;
@@ -3418,6 +3512,24 @@ String String::pad_zeros(int p_digits) const {
return s;
}
+String String::trim_prefix(const String &p_prefix) const {
+
+ String s = *this;
+ if (s.begins_with(p_prefix)) {
+ return s.substr(p_prefix.length(), s.length() - p_prefix.length());
+ }
+ return s;
+}
+
+String String::trim_suffix(const String &p_suffix) const {
+
+ String s = *this;
+ if (s.ends_with(p_suffix)) {
+ return s.substr(0, s.length() - p_suffix.length());
+ }
+ return s;
+}
+
bool String::is_valid_integer() const {
int len = length();
@@ -3448,13 +3560,13 @@ bool String::is_valid_hex_number(bool p_with_prefix) const {
if (p_with_prefix) {
- if (len < 2)
+ if (len < 3)
return false;
if (operator[](from) != '0' || operator[](from + 1) != 'x') {
return false;
- };
+ }
from += 2;
- };
+ }
for (int i = from; i < len; i++) {
@@ -3462,7 +3574,7 @@ bool String::is_valid_hex_number(bool p_with_prefix) const {
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
continue;
return false;
- };
+ }
return true;
};
@@ -3683,8 +3795,8 @@ String String::get_file() const {
String String::get_extension() const {
int pos = find_last(".");
- if (pos < 0)
- return *this;
+ if (pos < 0 || pos < MAX(find_last("/"), find_last("\\")))
+ return "";
return substr(pos + 1, length());
}
@@ -3762,7 +3874,7 @@ String String::percent_decode() const {
String String::get_basename() const {
int pos = find_last(".");
- if (pos < 0)
+ if (pos < 0 || pos < MAX(find_last("/"), find_last("\\")))
return *this;
return substr(0, pos);
diff --git a/core/ustring.h b/core/ustring.h
index 90496b71b6..b57e9629d9 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -137,6 +137,8 @@ public:
String insert(int p_at_pos, const String &p_string) const;
String pad_decimals(int p_digits) const;
String pad_zeros(int p_digits) const;
+ String trim_prefix(const String &p_prefix) const;
+ String trim_suffix(const String &p_suffix) const;
String lpad(int min_length, const String &character = " ") const;
String rpad(int min_length, const String &character = " ") const;
String sprintf(const Array &values, bool *error) const;
@@ -146,6 +148,7 @@ public:
static String num_scientific(double p_num);
static String num_real(double p_num);
static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
+ static String num_uint64(uint64_t p_num, int base = 10, bool capitalize_hex = false);
static String chr(CharType p_char);
static String md5(const uint8_t *p_md5);
static String hex_encode_buffer(const uint8_t *p_buffer, int p_len);
@@ -169,6 +172,7 @@ public:
String get_slicec(CharType p_splitter, int p_slice) const;
Vector<String> split(const String &p_splitter, bool p_allow_empty = true, int p_maxsplit = 0) const;
+ Vector<String> rsplit(const String &p_splitter, bool p_allow_empty = true, int p_maxsplit = 0) const;
Vector<String> split_spaces() const;
Vector<float> split_floats(const String &p_splitter, bool p_allow_empty = true) const;
Vector<float> split_floats_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const;
@@ -187,6 +191,8 @@ public:
String dedent() const;
String strip_edges(bool left = true, bool right = true) const;
String strip_escapes() const;
+ String lstrip(const Vector<CharType> &p_chars) const;
+ String rstrip(const Vector<CharType> &p_chars) const;
String get_extension() const;
String get_basename() const;
String plus_file(const String &p_file) const;
diff --git a/core/variant.cpp b/core/variant.cpp
index 5d48c8785e..c48aa57652 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -2012,6 +2012,19 @@ Variant::operator Vector<String>() const {
}
return to;
}
+Variant::operator Vector<StringName>() const {
+
+ PoolVector<String> from = operator PoolVector<String>();
+ Vector<StringName> to;
+ int len = from.size();
+ to.resize(len);
+ for (int i = 0; i < len; i++) {
+
+ to[i] = from[i];
+ }
+ return to;
+}
+
Variant::operator Vector<Vector3>() const {
PoolVector<Vector3> from = operator PoolVector<Vector3>();
@@ -2444,6 +2457,17 @@ Variant::Variant(const Vector<String> &p_array) {
*this = v;
}
+Variant::Variant(const Vector<StringName> &p_array) {
+
+ type = NIL;
+ PoolVector<String> v;
+ int len = p_array.size();
+ v.resize(len);
+ for (int i = 0; i < len; i++)
+ v.set(i, p_array[i]);
+ *this = v;
+}
+
Variant::Variant(const Vector<Vector3> &p_array) {
type = NIL;
@@ -3167,7 +3191,11 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method,
if (ce.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
int errorarg = ce.argument;
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(ce.expected) + ".";
+ if (p_argptrs) {
+ err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(ce.expected) + ".";
+ } else {
+ err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(ce.expected) + ".";
+ }
} else if (ce.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + ".";
} else if (ce.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
diff --git a/core/variant.h b/core/variant.h
index 0a4afada5b..4b245d25e6 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -140,7 +140,6 @@ private:
::AABB *_aabb;
Basis *_basis;
Transform *_transform;
- RefPtr *_resource;
void *_ptr; //generic pointer
uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)];
} _data;
@@ -217,6 +216,7 @@ public:
operator Vector<int>() const;
operator Vector<real_t>() const;
operator Vector<String>() const;
+ operator Vector<StringName>() const;
operator Vector<Vector3>() const;
operator Vector<Color>() const;
operator Vector<RID>() const;
@@ -281,6 +281,7 @@ public:
Variant(const Vector<int> &p_int_array);
Variant(const Vector<real_t> &p_real_array);
Variant(const Vector<String> &p_string_array);
+ Variant(const Vector<StringName> &p_string_array);
Variant(const Vector<Vector3> &p_vector3_array);
Variant(const Vector<Color> &p_color_array);
Variant(const Vector<Plane> &p_array); // helper
@@ -338,6 +339,7 @@ public:
}
void zero();
+ Variant duplicate(bool deep = false) const;
static void blend(const Variant &a, const Variant &b, float c, Variant &r_dst);
static void interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index d1d45f0e7c..e6f36ecbf1 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -153,9 +153,9 @@ struct _VariantCall {
funcdata.func = p_func;
funcdata.default_args = p_defaultarg;
funcdata._const = p_const;
+ funcdata.returns = p_has_return;
#ifdef DEBUG_ENABLED
funcdata.return_type = p_return;
- funcdata.returns = p_has_return;
#endif
if (p_argtype1.name) {
@@ -257,6 +257,7 @@ struct _VariantCall {
VCALL_LOCALMEM2R(String, insert);
VCALL_LOCALMEM0R(String, capitalize);
VCALL_LOCALMEM3R(String, split);
+ VCALL_LOCALMEM3R(String, rsplit);
VCALL_LOCALMEM2R(String, split_floats);
VCALL_LOCALMEM0R(String, to_upper);
VCALL_LOCALMEM0R(String, to_lower);
@@ -264,6 +265,8 @@ struct _VariantCall {
VCALL_LOCALMEM1R(String, right);
VCALL_LOCALMEM0R(String, dedent);
VCALL_LOCALMEM2R(String, strip_edges);
+ VCALL_LOCALMEM1R(String, lstrip);
+ VCALL_LOCALMEM1R(String, rstrip);
VCALL_LOCALMEM0R(String, get_extension);
VCALL_LOCALMEM0R(String, get_basename);
VCALL_LOCALMEM1R(String, plus_file);
@@ -296,6 +299,8 @@ struct _VariantCall {
VCALL_LOCALMEM0R(String, hex_to_int);
VCALL_LOCALMEM1R(String, pad_decimals);
VCALL_LOCALMEM1R(String, pad_zeros);
+ VCALL_LOCALMEM1R(String, trim_prefix);
+ VCALL_LOCALMEM1R(String, trim_suffix);
static void _call_String_to_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) {
@@ -336,10 +341,13 @@ struct _VariantCall {
VCALL_LOCALMEM1R(Vector2, angle_to);
VCALL_LOCALMEM1R(Vector2, angle_to_point);
VCALL_LOCALMEM2R(Vector2, linear_interpolate);
+ VCALL_LOCALMEM2R(Vector2, slerp);
VCALL_LOCALMEM4R(Vector2, cubic_interpolate);
VCALL_LOCALMEM1R(Vector2, rotated);
VCALL_LOCALMEM0R(Vector2, tangent);
VCALL_LOCALMEM0R(Vector2, floor);
+ VCALL_LOCALMEM0R(Vector2, ceil);
+ VCALL_LOCALMEM0R(Vector2, round);
VCALL_LOCALMEM1R(Vector2, snapped);
VCALL_LOCALMEM0R(Vector2, aspect);
VCALL_LOCALMEM1R(Vector2, dot);
@@ -347,7 +355,7 @@ struct _VariantCall {
VCALL_LOCALMEM1R(Vector2, bounce);
VCALL_LOCALMEM1R(Vector2, reflect);
VCALL_LOCALMEM0R(Vector2, angle);
- //VCALL_LOCALMEM1R(Vector2,cross);
+ VCALL_LOCALMEM1R(Vector2, cross);
VCALL_LOCALMEM0R(Vector2, abs);
VCALL_LOCALMEM1R(Vector2, clamped);
@@ -374,6 +382,7 @@ struct _VariantCall {
VCALL_LOCALMEM1R(Vector3, snapped);
VCALL_LOCALMEM2R(Vector3, rotated);
VCALL_LOCALMEM2R(Vector3, linear_interpolate);
+ VCALL_LOCALMEM2R(Vector3, slerp);
VCALL_LOCALMEM4R(Vector3, cubic_interpolate);
VCALL_LOCALMEM1R(Vector3, dot);
VCALL_LOCALMEM1R(Vector3, cross);
@@ -382,6 +391,7 @@ struct _VariantCall {
VCALL_LOCALMEM0R(Vector3, abs);
VCALL_LOCALMEM0R(Vector3, floor);
VCALL_LOCALMEM0R(Vector3, ceil);
+ VCALL_LOCALMEM0R(Vector3, round);
VCALL_LOCALMEM1R(Vector3, distance_to);
VCALL_LOCALMEM1R(Vector3, distance_squared_to);
VCALL_LOCALMEM1R(Vector3, angle_to);
@@ -432,6 +442,9 @@ struct _VariantCall {
VCALL_LOCALMEM2R(Quat, slerp);
VCALL_LOCALMEM2R(Quat, slerpni);
VCALL_LOCALMEM4R(Quat, cubic_slerp);
+ VCALL_LOCALMEM0R(Quat, get_euler);
+ VCALL_LOCALMEM1(Quat, set_euler);
+ VCALL_LOCALMEM2(Quat, set_axis_angle);
VCALL_LOCALMEM0R(Color, to_rgba32);
VCALL_LOCALMEM0R(Color, to_argb32);
@@ -465,7 +478,7 @@ struct _VariantCall {
VCALL_LOCALMEM0R(Dictionary, hash);
VCALL_LOCALMEM0R(Dictionary, keys);
VCALL_LOCALMEM0R(Dictionary, values);
- VCALL_LOCALMEM0R(Dictionary, duplicate);
+ VCALL_LOCALMEM1R(Dictionary, duplicate);
VCALL_LOCALMEM2(Array, set);
VCALL_LOCALMEM1R(Array, get);
@@ -494,7 +507,7 @@ struct _VariantCall {
VCALL_LOCALMEM0(Array, shuffle);
VCALL_LOCALMEM2R(Array, bsearch);
VCALL_LOCALMEM4R(Array, bsearch_custom);
- VCALL_LOCALMEM0R(Array, duplicate);
+ VCALL_LOCALMEM1R(Array, duplicate);
VCALL_LOCALMEM0(Array, invert);
static void _call_PoolByteArray_get_string_from_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) {
@@ -750,6 +763,7 @@ struct _VariantCall {
VCALL_PTR1R(Basis, xform_inv);
VCALL_PTR0R(Basis, get_orthogonal_index);
VCALL_PTR0R(Basis, orthonormalized);
+ VCALL_PTR2R(Basis, slerp);
VCALL_PTR0R(Transform, inverse);
VCALL_PTR0R(Transform, affine_inverse);
@@ -869,6 +883,11 @@ struct _VariantCall {
r_ret = Quat(((Vector3)(*p_args[0])), ((float)(*p_args[1])));
}
+ static void Quat_init3(Variant &r_ret, const Variant **p_args) {
+
+ r_ret = Quat(((Vector3)(*p_args[0])));
+ }
+
static void Color_init1(Variant &r_ret, const Variant **p_args) {
r_ret = Color(*p_args[0], *p_args[1], *p_args[2], *p_args[3]);
@@ -1143,7 +1162,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
case RECT2: return (Rect2(*p_args[0]));
case VECTOR3: return (Vector3(*p_args[0]));
case PLANE: return (Plane(*p_args[0]));
- case QUAT: return (Quat(*p_args[0]));
+ case QUAT: return (p_args[0]->operator Quat());
case AABB:
return (::AABB(*p_args[0])); // 10
case BASIS: return (Basis(p_args[0]->operator Basis()));
@@ -1452,6 +1471,7 @@ void register_variant_methods() {
ADDFUNC2R(STRING, STRING, String, insert, INT, "position", STRING, "what", varray());
ADDFUNC0R(STRING, STRING, String, capitalize, varray());
ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));
+ ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));
ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "divisor", BOOL, "allow_empty", varray(true));
ADDFUNC0R(STRING, STRING, String, to_upper, varray());
@@ -1460,6 +1480,8 @@ void register_variant_methods() {
ADDFUNC1R(STRING, STRING, String, left, INT, "position", varray());
ADDFUNC1R(STRING, STRING, String, right, INT, "position", varray());
ADDFUNC2R(STRING, STRING, String, strip_edges, BOOL, "left", BOOL, "right", varray(true, true));
+ ADDFUNC1R(STRING, STRING, String, lstrip, STRING, "chars", varray());
+ ADDFUNC1R(STRING, STRING, String, rstrip, STRING, "chars", varray());
ADDFUNC0R(STRING, STRING, String, get_extension, varray());
ADDFUNC0R(STRING, STRING, String, get_basename, varray());
ADDFUNC1R(STRING, STRING, String, plus_file, STRING, "file", varray());
@@ -1493,6 +1515,8 @@ void register_variant_methods() {
ADDFUNC0R(STRING, INT, String, hex_to_int, varray());
ADDFUNC1R(STRING, STRING, String, pad_decimals, INT, "digits", varray());
ADDFUNC1R(STRING, STRING, String, pad_zeros, INT, "digits", varray());
+ ADDFUNC1R(STRING, STRING, String, trim_prefix, STRING, "prefix", varray());
+ ADDFUNC1R(STRING, STRING, String, trim_suffix, STRING, "suffix", varray());
ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, to_ascii, varray());
ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, to_utf8, varray());
@@ -1507,17 +1531,20 @@ void register_variant_methods() {
ADDFUNC1R(VECTOR2, REAL, Vector2, angle_to, VECTOR2, "to", varray());
ADDFUNC1R(VECTOR2, REAL, Vector2, angle_to_point, VECTOR2, "to", varray());
ADDFUNC2R(VECTOR2, VECTOR2, Vector2, linear_interpolate, VECTOR2, "b", REAL, "t", varray());
+ ADDFUNC2R(VECTOR2, VECTOR2, Vector2, slerp, VECTOR2, "b", REAL, "t", varray());
ADDFUNC4R(VECTOR2, VECTOR2, Vector2, cubic_interpolate, VECTOR2, "b", VECTOR2, "pre_a", VECTOR2, "post_b", REAL, "t", varray());
ADDFUNC1R(VECTOR2, VECTOR2, Vector2, rotated, REAL, "phi", varray());
ADDFUNC0R(VECTOR2, VECTOR2, Vector2, tangent, varray());
ADDFUNC0R(VECTOR2, VECTOR2, Vector2, floor, varray());
+ ADDFUNC0R(VECTOR2, VECTOR2, Vector2, ceil, varray());
+ ADDFUNC0R(VECTOR2, VECTOR2, Vector2, round, varray());
ADDFUNC1R(VECTOR2, VECTOR2, Vector2, snapped, VECTOR2, "by", varray());
ADDFUNC0R(VECTOR2, REAL, Vector2, aspect, varray());
ADDFUNC1R(VECTOR2, REAL, Vector2, dot, VECTOR2, "with", varray());
ADDFUNC1R(VECTOR2, VECTOR2, Vector2, slide, VECTOR2, "n", varray());
ADDFUNC1R(VECTOR2, VECTOR2, Vector2, bounce, VECTOR2, "n", varray());
ADDFUNC1R(VECTOR2, VECTOR2, Vector2, reflect, VECTOR2, "n", varray());
- //ADDFUNC1R(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
+ ADDFUNC1R(VECTOR2, REAL, Vector2, cross, VECTOR2, "with", varray());
ADDFUNC0R(VECTOR2, VECTOR2, Vector2, abs, varray());
ADDFUNC1R(VECTOR2, VECTOR2, Vector2, clamped, REAL, "length", varray());
@@ -1544,6 +1571,7 @@ void register_variant_methods() {
ADDFUNC1R(VECTOR3, VECTOR3, Vector3, snapped, VECTOR3, "by", varray());
ADDFUNC2R(VECTOR3, VECTOR3, Vector3, rotated, VECTOR3, "axis", REAL, "phi", varray());
ADDFUNC2R(VECTOR3, VECTOR3, Vector3, linear_interpolate, VECTOR3, "b", REAL, "t", varray());
+ ADDFUNC2R(VECTOR3, VECTOR3, Vector3, slerp, VECTOR3, "b", REAL, "t", varray());
ADDFUNC4R(VECTOR3, VECTOR3, Vector3, cubic_interpolate, VECTOR3, "b", VECTOR3, "pre_a", VECTOR3, "post_b", REAL, "t", varray());
ADDFUNC1R(VECTOR3, REAL, Vector3, dot, VECTOR3, "b", varray());
ADDFUNC1R(VECTOR3, VECTOR3, Vector3, cross, VECTOR3, "b", varray());
@@ -1552,6 +1580,7 @@ void register_variant_methods() {
ADDFUNC0R(VECTOR3, VECTOR3, Vector3, abs, varray());
ADDFUNC0R(VECTOR3, VECTOR3, Vector3, floor, varray());
ADDFUNC0R(VECTOR3, VECTOR3, Vector3, ceil, varray());
+ ADDFUNC0R(VECTOR3, VECTOR3, Vector3, round, varray());
ADDFUNC1R(VECTOR3, REAL, Vector3, distance_to, VECTOR3, "b", varray());
ADDFUNC1R(VECTOR3, REAL, Vector3, distance_squared_to, VECTOR3, "b", varray());
ADDFUNC1R(VECTOR3, REAL, Vector3, angle_to, VECTOR3, "to", varray());
@@ -1580,6 +1609,9 @@ void register_variant_methods() {
ADDFUNC2R(QUAT, QUAT, Quat, slerp, QUAT, "b", REAL, "t", varray());
ADDFUNC2R(QUAT, QUAT, Quat, slerpni, QUAT, "b", REAL, "t", varray());
ADDFUNC4R(QUAT, QUAT, Quat, cubic_slerp, QUAT, "b", QUAT, "pre_a", QUAT, "post_b", REAL, "t", varray());
+ ADDFUNC0R(QUAT, VECTOR3, Quat, get_euler, varray());
+ ADDFUNC1(QUAT, NIL, Quat, set_euler, VECTOR3, "euler", varray());
+ ADDFUNC2(QUAT, NIL, Quat, set_axis_angle, VECTOR3, "axis", REAL, "angle", varray());
ADDFUNC0R(COLOR, INT, Color, to_rgba32, varray());
ADDFUNC0R(COLOR, INT, Color, to_argb32, varray());
@@ -1613,7 +1645,7 @@ void register_variant_methods() {
ADDFUNC0R(DICTIONARY, INT, Dictionary, hash, varray());
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, keys, varray());
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, values, varray());
- ADDFUNC0R(DICTIONARY, DICTIONARY, Dictionary, duplicate, varray());
+ ADDFUNC1R(DICTIONARY, DICTIONARY, Dictionary, duplicate, BOOL, "deep", varray(false));
ADDFUNC0R(ARRAY, INT, Array, size, varray());
ADDFUNC0R(ARRAY, BOOL, Array, empty, varray());
@@ -1641,7 +1673,7 @@ void register_variant_methods() {
ADDFUNC2R(ARRAY, INT, Array, bsearch, NIL, "value", BOOL, "before", varray(true));
ADDFUNC4R(ARRAY, INT, Array, bsearch_custom, NIL, "value", OBJECT, "obj", STRING, "func", BOOL, "before", varray(true));
ADDFUNC0NC(ARRAY, NIL, Array, invert, varray());
- ADDFUNC0RNC(ARRAY, ARRAY, Array, duplicate, varray());
+ ADDFUNC1R(ARRAY, ARRAY, Array, duplicate, BOOL, "deep", varray(false));
ADDFUNC0R(POOL_BYTE_ARRAY, INT, PoolByteArray, size, varray());
ADDFUNC2(POOL_BYTE_ARRAY, NIL, PoolByteArray, set, INT, "idx", INT, "byte", varray());
@@ -1772,6 +1804,7 @@ void register_variant_methods() {
ADDFUNC1R(BASIS, VECTOR3, Basis, xform, VECTOR3, "v", varray());
ADDFUNC1R(BASIS, VECTOR3, Basis, xform_inv, VECTOR3, "v", varray());
ADDFUNC0R(BASIS, INT, Basis, get_orthogonal_index, varray());
+ ADDFUNC2R(BASIS, BASIS, Basis, slerp, BASIS, "b", REAL, "t", varray());
ADDFUNC0R(TRANSFORM, TRANSFORM, Transform, inverse, varray());
ADDFUNC0R(TRANSFORM, TRANSFORM, Transform, affine_inverse, varray());
@@ -1802,6 +1835,7 @@ void register_variant_methods() {
_VariantCall::add_constructor(_VariantCall::Quat_init1, Variant::QUAT, "x", Variant::REAL, "y", Variant::REAL, "z", Variant::REAL, "w", Variant::REAL);
_VariantCall::add_constructor(_VariantCall::Quat_init2, Variant::QUAT, "axis", Variant::VECTOR3, "angle", Variant::REAL);
+ _VariantCall::add_constructor(_VariantCall::Quat_init3, Variant::QUAT, "euler", Variant::VECTOR3);
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 97b469861c..bfa69b1fde 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -177,7 +177,7 @@ bool Variant::booleanize() const {
CASE_TYPE(m_prefix, m_op_name, m_name) { \
if (p_b.type == INT) _RETURN(p_a._data.m_type m_op p_b._data._int); \
if (p_b.type == REAL) _RETURN(p_a._data.m_type m_op p_b._data._real); \
- if (p_b.type == NIL) _RETURN(!p_b.type m_op NIL); \
+ if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
\
_RETURN_FAIL \
};
@@ -252,7 +252,7 @@ bool Variant::booleanize() const {
CASE_TYPE(m_prefix, m_op_name, m_name) { \
if (p_b.type == STRING) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const String *>(p_b._data._mem)); \
if (p_b.type == NODE_PATH) _RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const NodePath *>(p_b._data._mem)); \
- if (p_b.type == NIL) _RETURN(!p_b.type m_op NIL); \
+ if (p_b.type == NIL) _RETURN(!(p_b.type m_op NIL)); \
\
_RETURN_FAIL \
};
@@ -278,7 +278,7 @@ bool Variant::booleanize() const {
if (p_b.type == m_name) \
_RETURN(*reinterpret_cast<const m_type *>(p_a._data._mem) m_op *reinterpret_cast<const m_type *>(p_b._data._mem)); \
if (p_b.type == NIL) \
- _RETURN(!p_b.type m_op NIL); \
+ _RETURN(!(p_b.type m_op NIL)); \
\
_RETURN_FAIL \
};
@@ -323,7 +323,7 @@ bool Variant::booleanize() const {
if (p_b.type == m_name) \
_RETURN(*p_a._data.m_sub m_op *p_b._data.m_sub); \
if (p_b.type == NIL) \
- _RETURN(!p_b.type m_op NIL); \
+ _RETURN(!(p_b.type m_op NIL)); \
\
_RETURN_FAIL \
}
@@ -1459,13 +1459,13 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
v->a = p_value._data._int / 255.0;
valid = true;
} else if (p_index == CoreStringNames::singleton->h) {
- v->set_hsv(p_value._data._int, v->get_s(), v->get_v());
+ v->set_hsv(p_value._data._int, v->get_s(), v->get_v(), v->a);
valid = true;
} else if (p_index == CoreStringNames::singleton->s) {
- v->set_hsv(v->get_h(), p_value._data._int, v->get_v());
+ v->set_hsv(v->get_h(), p_value._data._int, v->get_v(), v->a);
valid = true;
} else if (p_index == CoreStringNames::singleton->v) {
- v->set_hsv(v->get_h(), v->get_v(), p_value._data._int);
+ v->set_hsv(v->get_h(), v->get_v(), p_value._data._int, v->a);
valid = true;
}
} else if (p_value.type == Variant::REAL) {
@@ -1495,13 +1495,13 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
v->a = p_value._data._real / 255.0;
valid = true;
} else if (p_index == CoreStringNames::singleton->h) {
- v->set_hsv(p_value._data._real, v->get_s(), v->get_v());
+ v->set_hsv(p_value._data._real, v->get_s(), v->get_v(), v->a);
valid = true;
} else if (p_index == CoreStringNames::singleton->s) {
- v->set_hsv(v->get_h(), p_value._data._real, v->get_v());
+ v->set_hsv(v->get_h(), p_value._data._real, v->get_v(), v->a);
valid = true;
} else if (p_index == CoreStringNames::singleton->v) {
- v->set_hsv(v->get_h(), v->get_s(), p_value._data._real);
+ v->set_hsv(v->get_h(), v->get_s(), p_value._data._real, v->a);
valid = true;
}
}
@@ -2117,15 +2117,15 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
return;
} else if (*str == "h") {
valid = true;
- v->set_hsv(p_value, v->get_s(), v->get_v());
+ v->set_hsv(p_value, v->get_s(), v->get_v(), v->a);
return;
} else if (*str == "s") {
valid = true;
- v->set_hsv(v->get_h(), p_value, v->get_v());
+ v->set_hsv(v->get_h(), p_value, v->get_v(), v->a);
return;
} else if (*str == "v") {
valid = true;
- v->set_hsv(v->get_h(), v->get_s(), p_value);
+ v->set_hsv(v->get_h(), v->get_s(), p_value, v->a);
return;
} else if (*str == "r8") {
valid = true;
@@ -3415,6 +3415,28 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
return Variant();
}
+Variant Variant::duplicate(bool deep) const {
+ switch (type) {
+ case OBJECT: {
+ /* breaks stuff :(
+ if (deep && !_get_obj().ref.is_null()) {
+ Ref<Resource> resource = _get_obj().ref;
+ if (resource.is_valid()) {
+ return resource->duplicate(true);
+ }
+ }
+ */
+ return *this;
+ } break;
+ case DICTIONARY:
+ return operator Dictionary().duplicate(deep);
+ case ARRAY:
+ return operator Array().duplicate(deep);
+ default:
+ return *this;
+ }
+}
+
void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) {
if (a.type != b.type) {
if (a.is_num() && b.is_num()) {
@@ -3715,8 +3737,9 @@ static const char *_op_names[Variant::OP_MAX] = {
"*",
"/",
"- (negation)",
+ "+ (positive)",
"%",
- "..",
+ "+ (concatenation)",
"<<",
">>",
"&",
diff --git a/core/version.h b/core/version.h
index 7a55d69ad7..d39172865a 100644
--- a/core/version.h
+++ b/core/version.h
@@ -30,9 +30,32 @@
#include "version_generated.gen.h"
+// Godot versions are of the form <major>.<minor> for the initial release,
+// and then <major>.<minor>.<patch> for subsequent bugfix releases where <patch> != 0
+// That's arbitrary, but we find it pretty and it's the current policy.
+
+// Defines the main "branch" version. Patch versions in this branch should be
+// forward-compatible.
+// Example: "3.1"
+#define VERSION_BRANCH "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR)
#ifdef VERSION_PATCH
-#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH) "." VERSION_STATUS "." VERSION_BUILD VERSION_MODULE_CONFIG
+// Example: "3.1.4"
+#define VERSION_NUMBER "" VERSION_BRANCH "." _MKSTR(VERSION_PATCH)
#else
-#define VERSION_MKSTRING "" _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." VERSION_STATUS "." VERSION_BUILD VERSION_MODULE_CONFIG
+// Example: "3.1"
+#define VERSION_NUMBER "" VERSION_BRANCH
#endif // VERSION_PATCH
-#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_MKSTRING
+
+// Describes the full configuration of that Godot version, including the version number,
+// the status (beta, stable, etc.) and potential module-specific features (e.g. mono).
+// Example: "3.1.4.stable.mono"
+#define VERSION_FULL_CONFIG "" VERSION_NUMBER "." VERSION_STATUS VERSION_MODULE_CONFIG
+
+// Similar to VERSION_FULL_CONFIG, but also includes the (potentially custom) VERSION_BUILD
+// description (e.g. official, custom_build, etc.).
+// Example: "3.1.4.stable.mono.official"
+#define VERSION_FULL_BUILD "" VERSION_FULL_CONFIG "." VERSION_BUILD
+
+// Same as above, but prepended with Godot's name and a cosmetic "v" for "version".
+// Example: "Godot v3.1.4.stable.official.mono"
+#define VERSION_FULL_NAME "" VERSION_NAME " v" VERSION_FULL_BUILD
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 2444dc4cba..b5f5fed3f9 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@GDScript" category="Core" version="3.1-dev">
+<class name="@GDScript" category="Core" version="3.1">
<brief_description>
Built-in GDScript functions.
</brief_description>
<description>
- This contains the list of built-in gdscript functions. Mostly math functions and other utilities. Everything else is expanded by objects.
+ List of core built-in GDScript functions. Math functions and other utilities. Everything else is provided by objects. (Keywords: builtin, built in, global functions.)
</description>
<tutorials>
</tutorials>
@@ -326,7 +326,8 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Raises the Euler's constant [b]e[/b] to the power of [code]s[/code] and returns it. [b]e[/b] has an approximate value of 2.71828.
+ The natural exponential function. It raises the mathematical constant [b]e[/b] to the power of [code]s[/code] and returns it.
+ [b]e[/b] has an approximate value of 2.71828.
[codeblock]
a = exp(2) # approximately 7.39
[/codeblock]
@@ -484,6 +485,14 @@
Returns True/False whether [code]s[/code] is an infinity value (either positive infinity or negative infinity).
</description>
</method>
+ <method name="is_instance_valid">
+ <return type="bool">
+ </return>
+ <argument index="0" name="instance" type="Object">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="is_nan">
<return type="bool">
</return>
@@ -509,9 +518,9 @@
<method name="lerp">
<return type="float">
</return>
- <argument index="0" name="from" type="float">
+ <argument index="0" name="from" type="Variant">
</argument>
- <argument index="1" name="to" type="float">
+ <argument index="1" name="to" type="Variant">
</argument>
<argument index="2" name="weight" type="float">
</argument>
@@ -1136,8 +1145,9 @@
<argument index="1" name="signal" type="String" default="&quot;&quot;">
</argument>
<description>
- Stops the function execution and returns the current state. Call [method GDScriptFunctionState.resume] on the state to resume execution. This invalidates the state.
- Returns anything that was passed to the resume function call. If passed an object and a signal, the execution is resumed when the object's signal is emitted.
+ Stops the function execution and returns the current suspended state to the calling function.
+ From the caller, call [method GDScriptFunctionState.resume] on the state to resume execution. This invalidates the state. Within the resumed function, [code]yield()[/code] returns whatever was passed to the [code]resume()[/code] function call.
+ If passed an object and a signal, the execution is resumed when the object emits the given signal. In this case, [code]yield()[/code] returns the argument passed to [code]emit_signal()[/code] if the signal takes only one argument, or an array containing all the arguments passed to [code]emit_signal()[/code] if the signal takes multiple arguments.
</description>
</method>
</methods>
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index a434c68a4f..7f94676e93 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@GlobalScope" category="Core" version="3.1-dev">
+<class name="@GlobalScope" category="Core" version="3.1">
<brief_description>
Global scope constants and variables.
</brief_description>
@@ -29,9 +29,6 @@
<member name="Geometry" type="Geometry" setter="" getter="">
[Geometry] singleton
</member>
- <member name="GodotSharp" type="GodotSharp" setter="" getter="">
- [GodotSharp] singleton
- </member>
<member name="IP" type="IP" setter="" getter="">
[IP] singleton
</member>
diff --git a/doc/classes/@NativeScript.xml b/doc/classes/@NativeScript.xml
index cc4e97314e..2bf1dc7a7c 100644
--- a/doc/classes/@NativeScript.xml
+++ b/doc/classes/@NativeScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@NativeScript" category="Core" version="3.1-dev">
+<class name="@NativeScript" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/@VisualScript.xml b/doc/classes/@VisualScript.xml
index f3a951f722..d4a924a259 100644
--- a/doc/classes/@VisualScript.xml
+++ b/doc/classes/@VisualScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@VisualScript" category="Core" version="3.1-dev">
+<class name="@VisualScript" category="Core" version="3.1">
<brief_description>
Built-in visual script functions.
</brief_description>
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml
index c0eb8cb417..b9061e0b87 100644
--- a/doc/classes/AABB.xml
+++ b/doc/classes/AABB.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AABB" category="Built-In Types" version="3.1-dev">
+<class name="AABB" category="Built-In Types" version="3.1">
<brief_description>
Axis-Aligned Bounding Box.
</brief_description>
@@ -7,7 +7,7 @@
AABB consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/math/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/math/index.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml
index 735b1a8e8f..fa93d9668c 100644
--- a/doc/classes/ARVRAnchor.xml
+++ b/doc/classes/ARVRAnchor.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRAnchor" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="ARVRAnchor" inherits="Spatial" category="Core" version="3.1">
<brief_description>
- Anchor point in AR Space
+ Anchor point in AR Space.
</brief_description>
<description>
The ARVR Anchor point is a spatial node that maps a real world location identified by the AR platform to a position within the game world. For example, as long as plane detection in ARKit is on, ARKit will identify and update the position of planes (tables, floors, etc) and create anchors for them.
diff --git a/doc/classes/ARVRCamera.xml b/doc/classes/ARVRCamera.xml
index e8cf433e2b..e74b435e11 100644
--- a/doc/classes/ARVRCamera.xml
+++ b/doc/classes/ARVRCamera.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRCamera" inherits="Camera" category="Core" version="3.1-dev">
+<class name="ARVRCamera" inherits="Camera" category="Core" version="3.1">
<brief_description>
A camera node with a few overrules for AR/VR applied such as location tracking.
</brief_description>
diff --git a/doc/classes/ARVRController.xml b/doc/classes/ARVRController.xml
index e9d8f9d568..9c306c3ea4 100644
--- a/doc/classes/ARVRController.xml
+++ b/doc/classes/ARVRController.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRController" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="ARVRController" inherits="Spatial" category="Core" version="3.1">
<brief_description>
A spatial node representing a spatially tracked controller.
</brief_description>
diff --git a/doc/classes/ARVRInterface.xml b/doc/classes/ARVRInterface.xml
index ed59b4329b..413370ed0b 100644
--- a/doc/classes/ARVRInterface.xml
+++ b/doc/classes/ARVRInterface.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRInterface" inherits="Reference" category="Core" version="3.1-dev">
+<class name="ARVRInterface" inherits="Reference" category="Core" version="3.1">
<brief_description>
Base class for ARVR interface implementation.
</brief_description>
diff --git a/doc/classes/ARVROrigin.xml b/doc/classes/ARVROrigin.xml
index 1b998815aa..80626338f2 100644
--- a/doc/classes/ARVROrigin.xml
+++ b/doc/classes/ARVROrigin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVROrigin" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="ARVROrigin" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Our origin point in AR/VR.
</brief_description>
diff --git a/doc/classes/ARVRPositionalTracker.xml b/doc/classes/ARVRPositionalTracker.xml
index 2d1e85e4c4..e703de36f4 100644
--- a/doc/classes/ARVRPositionalTracker.xml
+++ b/doc/classes/ARVRPositionalTracker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRPositionalTracker" inherits="Object" category="Core" version="3.1-dev">
+<class name="ARVRPositionalTracker" inherits="Object" category="Core" version="3.1">
<brief_description>
A tracked object
</brief_description>
diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml
index 8e5dc146ad..a7d3e46684 100644
--- a/doc/classes/ARVRServer.xml
+++ b/doc/classes/ARVRServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRServer" inherits="Object" category="Core" version="3.1-dev">
+<class name="ARVRServer" inherits="Object" category="Core" version="3.1">
<brief_description>
This is our AR/VR Server.
</brief_description>
@@ -36,6 +36,13 @@
Find an interface by its name. Say that you're making a game that uses specific capabilities of an AR/VR platform you can find the interface for that platform by name and initialize it.
</description>
</method>
+ <method name="get_hmd_transform">
+ <return type="Transform">
+ </return>
+ <description>
+ Returns the primary interface's transformation.
+ </description>
+ </method>
<method name="get_interface" qualifiers="const">
<return type="ARVRInterface">
</return>
@@ -59,6 +66,24 @@
Returns a list of available interfaces with both id and name of the interface.
</description>
</method>
+ <method name="get_last_commit_usec">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_last_frame_usec">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_last_process_usec">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_reference_frame" qualifiers="const">
<return type="Transform">
</return>
@@ -82,17 +107,10 @@
Get the number of trackers currently registered.
</description>
</method>
- <method name="set_primary_interface">
- <return type="void">
- </return>
- <argument index="0" name="interface" type="ARVRInterface">
- </argument>
- <description>
- Changes the primary interface to the specified interface. Again mostly exposed for GDNative interfaces.
- </description>
- </method>
</methods>
<members>
+ <member name="primary_interface" type="ARVRInterface" setter="set_primary_interface" getter="get_primary_interface">
+ </member>
<member name="world_scale" type="float" setter="set_world_scale" getter="get_world_scale">
Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world.
</member>
diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml
index 1a192f861b..482566ee9f 100644
--- a/doc/classes/AStar.xml
+++ b/doc/classes/AStar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AStar" inherits="Reference" category="Core" version="3.1-dev">
+<class name="AStar" inherits="Reference" category="Core" version="3.1">
<brief_description>
AStar class representation that uses vectors as edges.
</brief_description>
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 614e2e9430..20d8bebd6b 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AcceptDialog" inherits="WindowDialog" category="Core" version="3.1-dev">
+<class name="AcceptDialog" inherits="WindowDialog" category="Core" version="3.1">
<brief_description>
Base dialog for user notification.
</brief_description>
@@ -21,7 +21,7 @@
<argument index="2" name="action" type="String" default="&quot;&quot;">
</argument>
<description>
- Adds a button with label [i]text[/i] and a custom [i]action[/i] to the dialog and returns the created button. [i]action[/i] will be passed to the [custom_action] signal when pressed.
+ Adds a button with label [i]text[/i] and a custom [i]action[/i] to the dialog and returns the created button. [i]action[/i] will be passed to the [signal custom_action] signal when pressed.
If [code]true[/code], [i]right[/i] will place the button to the right of any sibling buttons. Default value: [code]false[/code].
</description>
</method>
diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml
index a4892a4c71..a41ed0e689 100644
--- a/doc/classes/AnimatedSprite.xml
+++ b/doc/classes/AnimatedSprite.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AnimatedSprite" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="AnimatedSprite" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Sprite node that can use multiple textures for animation.
</brief_description>
@@ -60,6 +60,8 @@
<member name="playing" type="bool" setter="_set_playing" getter="_is_playing">
If [code]true[/code] the [member animation] is currently playing.
</member>
+ <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale">
+ </member>
</members>
<signals>
<signal name="animation_finished">
diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml
index 358524d761..733d565676 100644
--- a/doc/classes/AnimatedSprite3D.xml
+++ b/doc/classes/AnimatedSprite3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AnimatedSprite3D" inherits="SpriteBase3D" category="Core" version="3.1-dev">
+<class name="AnimatedSprite3D" inherits="SpriteBase3D" category="Core" version="3.1">
<brief_description>
2D sprite node in 3D world, that can use multiple 2D textures for animation.
</brief_description>
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index 96e78bae9d..c6b868c058 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Animation" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Animation" inherits="Resource" category="Core" version="3.1">
<brief_description>
Contains data used to animate everything in the engine.
</brief_description>
@@ -8,7 +8,7 @@
Animations are just data containers, and must be added to odes such as an [AnimationPlayer] or [AnimationTreePlayer] to be played back.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/animation/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/animation/index.html</link>
</tutorials>
<demos>
</demos>
@@ -24,6 +24,214 @@
Add a track to the Animation. The track type must be specified as any of the values in the TYPE_* enumeration.
</description>
</method>
+ <method name="animation_track_get_key_animation" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="animation_track_insert_key">
+ <return type="int">
+ </return>
+ <argument index="0" name="track" type="int">
+ </argument>
+ <argument index="1" name="time" type="float">
+ </argument>
+ <argument index="2" name="animation" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="animation_track_set_key_animation">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="animation" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_get_key_end_offset" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_get_key_start_offset" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_get_key_stream" qualifiers="const">
+ <return type="Resource">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_insert_key">
+ <return type="int">
+ </return>
+ <argument index="0" name="track" type="int">
+ </argument>
+ <argument index="1" name="time" type="float">
+ </argument>
+ <argument index="2" name="stream" type="Resource">
+ </argument>
+ <argument index="3" name="start_offset" type="float" default="0">
+ </argument>
+ <argument index="4" name="end_offset" type="float" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_set_key_end_offset">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="offset" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_set_key_start_offset">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="offset" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="audio_track_set_key_stream">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="stream" type="Resource">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_get_key_in_handle" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_get_key_out_handle" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_get_key_value" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_insert_key">
+ <return type="int">
+ </return>
+ <argument index="0" name="track" type="int">
+ </argument>
+ <argument index="1" name="time" type="float">
+ </argument>
+ <argument index="2" name="value" type="float">
+ </argument>
+ <argument index="3" name="in_handle" type="Vector2" default="Vector2( 0, 0 )">
+ </argument>
+ <argument index="4" name="out_handle" type="Vector2" default="Vector2( 0, 0 )">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_interpolate" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="track" type="int">
+ </argument>
+ <argument index="1" name="time" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_set_key_in_handle">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="in_handle" type="Vector2">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_set_key_out_handle">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="out_handle" type="Vector2">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="bezier_track_set_key_value">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="key_idx" type="int">
+ </argument>
+ <argument index="2" name="value" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="clear">
<return type="void">
</return>
@@ -347,6 +555,16 @@
Set the path of a track. 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. Tracks that control properties or bones must append their name after the path, separated by ":". Example: "character/skeleton:ankle" or "character/mesh:transform/local"
</description>
</method>
+ <method name="track_swap">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="with_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="transform_track_insert_key">
<return type="int">
</return>
@@ -430,6 +648,12 @@
<constant name="TYPE_METHOD" value="2" enum="TrackType">
Method tracks call functions with given arguments per key.
</constant>
+ <constant name="TYPE_BEZIER" value="3" enum="TrackType">
+ </constant>
+ <constant name="TYPE_AUDIO" value="4" enum="TrackType">
+ </constant>
+ <constant name="TYPE_ANIMATION" value="5" enum="TrackType">
+ </constant>
<constant name="INTERPOLATION_NEAREST" value="0" enum="InterpolationType">
No interpolation (nearest value).
</constant>
@@ -448,5 +672,7 @@
<constant name="UPDATE_TRIGGER" value="2" enum="UpdateMode">
Update at the keyframes.
</constant>
+ <constant name="UPDATE_CAPTURE" value="3" enum="UpdateMode">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index d791cd88dd..e1b3c7a9c9 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AnimationPlayer" inherits="Node" category="Core" version="3.1-dev">
+<class name="AnimationPlayer" inherits="Node" category="Core" version="3.1">
<brief_description>
Container and player of [Animation] resources.
</brief_description>
@@ -7,8 +7,8 @@
An animation player is used for general purpose playback of [Animation] resources. It contains a dictionary of animations (referenced by name) and custom blend times between their transitions. Additionally, animations can be played and blended in different channels.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/step_by_step/animations.html
- http://docs.godotengine.org/en/3.0/tutorials/animation/index.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/step_by_step/animations.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/animation/index.html</link>
</tutorials>
<demos>
</demos>
@@ -103,6 +103,13 @@
Get the blend time (in seconds) between two animations, referenced by their names.
</description>
</method>
+ <method name="get_playing_speed" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Get the actual playing speed of current animation or 0 if not playing. This speed is the [code]playback_speed[/code] property multiplied by [code]custom_speed[/code] argument specified when calling the [code]play[/code] method.
+ </description>
+ </method>
<method name="has_animation" qualifiers="const">
<return type="bool">
</return>
@@ -131,8 +138,7 @@
<argument index="3" name="from_end" type="bool" default="false">
</argument>
<description>
- Play the animation with key [code]name[/code]. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the
- animation backwards.
+ Play the animation with key [code]name[/code]. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards.
</description>
</method>
<method name="play_backwards">
diff --git a/doc/classes/AnimationTrackEditPlugin.xml b/doc/classes/AnimationTrackEditPlugin.xml
new file mode 100644
index 0000000000..f322a556b1
--- /dev/null
+++ b/doc/classes/AnimationTrackEditPlugin.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="AnimationTrackEditPlugin" inherits="Reference" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/AnimationTreePlayer.xml b/doc/classes/AnimationTreePlayer.xml
index ca743bfb29..8c32d5f6a3 100644
--- a/doc/classes/AnimationTreePlayer.xml
+++ b/doc/classes/AnimationTreePlayer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AnimationTreePlayer" inherits="Node" category="Core" version="3.1-dev">
+<class name="AnimationTreePlayer" inherits="Node" category="Core" version="3.1">
<brief_description>
Animation Player that uses a node graph for blending Animations.
</brief_description>
@@ -50,6 +50,14 @@
Returns the name of the [member master_player]'s [Animation] bound to this animation node.
</description>
</method>
+ <method name="animation_node_get_position" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="id" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="animation_node_set_animation">
<return type="void">
</return>
diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml
index 3c8a6a9269..5c56b5e21b 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Area" inherits="CollisionObject" category="Core" version="3.1-dev">
+<class name="Area" inherits="CollisionObject" category="Core" version="3.1">
<brief_description>
General purpose area node for detection and 3D physics influence.
</brief_description>
@@ -192,7 +192,7 @@
<argument index="0" name="body" type="Object">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object exits.
+ Emitted when a [PhysicsBody] object exits.
</description>
</signal>
<signal name="body_shape_entered">
@@ -205,7 +205,7 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
+ Emitted when a [PhysicsBody] object enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="body_shape_exited">
@@ -218,7 +218,7 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
+ Emitted when a [PhysicsBody] object exits, reporting which shapes were overlapping.
</description>
</signal>
</signals>
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index 3cfabee27f..c50ccefc4c 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.1-dev">
+<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.1">
<brief_description>
2D area for detection and 2D physics influence.
</brief_description>
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 1e129d70d0..35c120cd6a 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Array" category="Built-In Types" version="3.1-dev">
+<class name="Array" category="Built-In Types" version="3.1">
<brief_description>
Generic array datatype.
</brief_description>
@@ -131,8 +131,11 @@
<method name="duplicate">
<return type="Array">
</return>
+ <argument index="0" name="deep" type="bool" default="False">
+ </argument>
<description>
- Returns a copy of this [code]Array[/code].
+ Returns a copy of the array.
+ If [code]deep[/code] is [code]true[/code], a deep copy is be performed: all nested arrays and dictionaries are duplicated and will not be shared with the original array. If [code]false[/code], 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 array.
</description>
</method>
<method name="empty">
@@ -265,6 +268,11 @@
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="shuffle">
+ <description>
+ Shuffle the array such that the items will have a random order.
+ </description>
+ </method>
<method name="size">
<return type="int">
</return>
@@ -274,7 +282,7 @@
</method>
<method name="sort">
<description>
- Sort the array using natural order and return reference to the array.
+ Sort the array using natural order.
</description>
</method>
<method name="sort_custom">
@@ -283,7 +291,7 @@
<argument index="1" name="func" type="String">
</argument>
<description>
- Sort the array using a custom method and return reference to the array. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
+ Sort 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 arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
[codeblock]
class MyCustomSorter:
static func sort(a, b):
@@ -296,11 +304,6 @@
[/codeblock]
</description>
</method>
- <method name="shuffle">
- <description>
- Shuffle the array such that the items will have a random order.
- </description>
- </method>
</methods>
<constants>
</constants>
diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml
index 9ea76e2702..80d7b7783f 100644
--- a/doc/classes/ArrayMesh.xml
+++ b/doc/classes/ArrayMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ArrayMesh" inherits="Mesh" category="Core" version="3.1-dev">
+<class name="ArrayMesh" inherits="Mesh" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
@@ -29,8 +29,11 @@
<argument index="3" name="compress_flags" type="int" default="97792">
</argument>
<description>
- Create a new surface ([method get_surface_count] that will become surf_idx for this.
- Surfaces are created to be rendered using a "primitive", which may be PRIMITIVE_POINTS, PRIMITIVE_LINES, PRIMITIVE_LINE_STRIP, PRIMITIVE_LINE_LOOP, PRIMITIVE_TRIANGLES, PRIMITIVE_TRIANGLE_STRIP, PRIMITIVE_TRIANGLE_FAN. (As a note, when using indices, it is recommended to only use just points, lines or triangles).
+ Creates a new surface.
+ Surfaces are created to be rendered using a "primitive", which may be PRIMITIVE_POINTS, PRIMITIVE_LINES, PRIMITIVE_LINE_STRIP, PRIMITIVE_LINE_LOOP, PRIMITIVE_TRIANGLES, PRIMITIVE_TRIANGLE_STRIP, PRIMITIVE_TRIANGLE_FAN. See [Mesh] for details. (As a note, when using indices, it is recommended to only use points, lines or triangles). [method get_surface_count] will become the surf_idx for this new surface.
+ The [code]arrays[/code] argument is an array of arrays. See [enum 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 empty, except for [code]ARRAY_INDEX[/code] if it is used.
+ 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 order of the vertices.
+ Godot uses clockwise winding order for front faces of triangle primitive modes.
</description>
</method>
<method name="center_geometry">
@@ -88,7 +91,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the length in indices of the index array in the requested surface (see [method add_surface]).
+ Return the length in indices of the index array in the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_get_array_len" qualifiers="const">
@@ -97,7 +100,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the length in vertices of the vertex array in the requested surface (see [method add_surface]).
+ Return the length in vertices of the vertex array in the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_get_arrays" qualifiers="const">
@@ -122,7 +125,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the format mask of the requested surface (see [method add_surface]).
+ Return the format mask of the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_get_material" qualifiers="const">
@@ -148,7 +151,7 @@
<argument index="0" name="surf_idx" type="int">
</argument>
<description>
- Return the primitive type of the requested surface (see [method add_surface]).
+ Return the primitive type of the requested surface (see [method add_surface_from_arrays]).
</description>
</method>
<method name="surface_remove">
@@ -232,7 +235,8 @@
Array of bone weights, as a float array. Each element in groups of 4 floats.
</constant>
<constant name="ARRAY_INDEX" value="8" enum="ArrayType">
- Array of integers, used as indices referencing vertices. No index can be beyond the vertex array size.
+ [Array] 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.
+ For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line.
</constant>
<constant name="ARRAY_MAX" value="9" enum="ArrayType">
</constant>
diff --git a/doc/classes/AtlasTexture.xml b/doc/classes/AtlasTexture.xml
index 77ddbb3343..409c40e809 100644
--- a/doc/classes/AtlasTexture.xml
+++ b/doc/classes/AtlasTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AtlasTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="AtlasTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
Packs multiple small textures in a single, bigger one. Helps to optimize video memory costs and render calls.
</brief_description>
diff --git a/doc/classes/AudioBusLayout.xml b/doc/classes/AudioBusLayout.xml
index c4e111a792..c43da3e233 100644
--- a/doc/classes/AudioBusLayout.xml
+++ b/doc/classes/AudioBusLayout.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioBusLayout" inherits="Resource" category="Core" version="3.1-dev">
+<class name="AudioBusLayout" inherits="Resource" category="Core" version="3.1">
<brief_description>
Stores information about the audiobusses.
</brief_description>
diff --git a/doc/classes/AudioEffect.xml b/doc/classes/AudioEffect.xml
index 4d33b458a0..acbc96e70e 100644
--- a/doc/classes/AudioEffect.xml
+++ b/doc/classes/AudioEffect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffect" inherits="Resource" category="Core" version="3.1-dev">
+<class name="AudioEffect" inherits="Resource" category="Core" version="3.1">
<brief_description>
Audio Effect For Audio.
</brief_description>
diff --git a/doc/classes/AudioEffectAmplify.xml b/doc/classes/AudioEffectAmplify.xml
index 2c0cbff8b4..3582ddc4f7 100644
--- a/doc/classes/AudioEffectAmplify.xml
+++ b/doc/classes/AudioEffectAmplify.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectAmplify" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectAmplify" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Amplify audio effect to an Audio bus.
Increases or decreases the volume of the selected audio bus.
diff --git a/doc/classes/AudioEffectBandLimitFilter.xml b/doc/classes/AudioEffectBandLimitFilter.xml
index c9e9520dfe..9eba806ad5 100644
--- a/doc/classes/AudioEffectBandLimitFilter.xml
+++ b/doc/classes/AudioEffectBandLimitFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectBandLimitFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectBandLimitFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
Adds a band limit filter to the Audio Bus.
</brief_description>
diff --git a/doc/classes/AudioEffectBandPassFilter.xml b/doc/classes/AudioEffectBandPassFilter.xml
index cc8e351586..11aab3e86d 100644
--- a/doc/classes/AudioEffectBandPassFilter.xml
+++ b/doc/classes/AudioEffectBandPassFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectBandPassFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectBandPassFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
Adds a band pass filter to the Audio Bus.
</brief_description>
diff --git a/doc/classes/AudioEffectChorus.xml b/doc/classes/AudioEffectChorus.xml
index 6890fc92d9..43e14b3964 100644
--- a/doc/classes/AudioEffectChorus.xml
+++ b/doc/classes/AudioEffectChorus.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectChorus" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectChorus" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a chorus audio effect.
</brief_description>
diff --git a/doc/classes/AudioEffectCompressor.xml b/doc/classes/AudioEffectCompressor.xml
index 33225a64ab..fa81bcf030 100644
--- a/doc/classes/AudioEffectCompressor.xml
+++ b/doc/classes/AudioEffectCompressor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectCompressor" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectCompressor" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Compressor audio effect to an Audio bus.
Reduces sounds that exceed a certain threshold level, smooths out the dynamics and increases the overall volume.
diff --git a/doc/classes/AudioEffectDelay.xml b/doc/classes/AudioEffectDelay.xml
index 1c5757eca3..7c9d11111c 100644
--- a/doc/classes/AudioEffectDelay.xml
+++ b/doc/classes/AudioEffectDelay.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectDelay" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectDelay" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Delay audio effect to an Audio bus. Plays input signal back after a period of time.
Two tap delay and feedback options.
diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml
index c33dced31e..74d12df554 100644
--- a/doc/classes/AudioEffectDistortion.xml
+++ b/doc/classes/AudioEffectDistortion.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectDistortion" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectDistortion" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Distortion audio effect to an Audio bus.
Modify the sound to make it dirty.
diff --git a/doc/classes/AudioEffectEQ.xml b/doc/classes/AudioEffectEQ.xml
index f6f44f2cb6..35a6f7557d 100644
--- a/doc/classes/AudioEffectEQ.xml
+++ b/doc/classes/AudioEffectEQ.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectEQ" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectEQ" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Base class for audio equalizers. Gives you control over frequencies.
Use it to create a custom equalizer if [AudioEffectEQ6], [AudioEffectEQ10] or [AudioEffectEQ21] don't fit your needs.
diff --git a/doc/classes/AudioEffectEQ10.xml b/doc/classes/AudioEffectEQ10.xml
index 201a26843c..daca342ace 100644
--- a/doc/classes/AudioEffectEQ10.xml
+++ b/doc/classes/AudioEffectEQ10.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectEQ10" inherits="AudioEffectEQ" category="Core" version="3.1-dev">
+<class name="AudioEffectEQ10" inherits="AudioEffectEQ" category="Core" version="3.1">
<brief_description>
Adds a 10-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 31 Hz to 16000 Hz.
Each frequency can be modulated between -60/+24 dB.
@@ -16,7 +16,6 @@
Band 8 : 4000 Hz
Band 9 : 8000 Hz
Band 10 : 16000 Hz
-
See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ21].
</description>
<tutorials>
diff --git a/doc/classes/AudioEffectEQ21.xml b/doc/classes/AudioEffectEQ21.xml
index df0a536157..99d35604fc 100644
--- a/doc/classes/AudioEffectEQ21.xml
+++ b/doc/classes/AudioEffectEQ21.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectEQ21" inherits="AudioEffectEQ" category="Core" version="3.1-dev">
+<class name="AudioEffectEQ21" inherits="AudioEffectEQ" category="Core" version="3.1">
<brief_description>
Adds a 21-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 22 Hz to 22000 Hz.
Each frequency can be modulated between -60/+24 dB.
@@ -27,7 +27,6 @@
Band 19 : 11000 Hz
Band 20 : 16000 Hz
Band 21 : 22000 Hz
-
See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ10].
</description>
<tutorials>
diff --git a/doc/classes/AudioEffectEQ6.xml b/doc/classes/AudioEffectEQ6.xml
index fe17a35d64..047c4c960f 100644
--- a/doc/classes/AudioEffectEQ6.xml
+++ b/doc/classes/AudioEffectEQ6.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectEQ6" inherits="AudioEffectEQ" category="Core" version="3.1-dev">
+<class name="AudioEffectEQ6" inherits="AudioEffectEQ" category="Core" version="3.1">
<brief_description>
Adds a 6-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 32 Hz to 10000 Hz.
Each frequency can be modulated between -60/+24 dB.
@@ -12,7 +12,6 @@
Band 4 : 1000 Hz
Band 5 : 3200 Hz
Band 6 : 10000 Hz
-
See also [AudioEffectEQ], [AudioEffectEQ10], [AudioEffectEQ21].
</description>
<tutorials>
diff --git a/doc/classes/AudioEffectFilter.xml b/doc/classes/AudioEffectFilter.xml
index 75dc9b292d..5a86c092a0 100644
--- a/doc/classes/AudioEffectFilter.xml
+++ b/doc/classes/AudioEffectFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectFilter" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectFilter" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a filter to the Audio Bus.
</brief_description>
diff --git a/doc/classes/AudioEffectHighPassFilter.xml b/doc/classes/AudioEffectHighPassFilter.xml
index 148ab83cb6..3d487fc783 100644
--- a/doc/classes/AudioEffectHighPassFilter.xml
+++ b/doc/classes/AudioEffectHighPassFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectHighPassFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectHighPassFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
Adds a high pass filter to the Audio Bus.
</brief_description>
diff --git a/doc/classes/AudioEffectHighShelfFilter.xml b/doc/classes/AudioEffectHighShelfFilter.xml
index e52578dc3a..ca2312ba6a 100644
--- a/doc/classes/AudioEffectHighShelfFilter.xml
+++ b/doc/classes/AudioEffectHighShelfFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectHighShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectHighShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/AudioEffectLimiter.xml b/doc/classes/AudioEffectLimiter.xml
index 6c61300e34..9e791f02d7 100644
--- a/doc/classes/AudioEffectLimiter.xml
+++ b/doc/classes/AudioEffectLimiter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectLimiter" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectLimiter" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a soft clip Limiter audio effect to an Audio bus.
</brief_description>
diff --git a/doc/classes/AudioEffectLowPassFilter.xml b/doc/classes/AudioEffectLowPassFilter.xml
index cc357ae9ee..3facd8b665 100644
--- a/doc/classes/AudioEffectLowPassFilter.xml
+++ b/doc/classes/AudioEffectLowPassFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectLowPassFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectLowPassFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
Adds a low pass filter to the Audio Bus.
</brief_description>
diff --git a/doc/classes/AudioEffectLowShelfFilter.xml b/doc/classes/AudioEffectLowShelfFilter.xml
index be9bde1b69..aadbf30eaa 100644
--- a/doc/classes/AudioEffectLowShelfFilter.xml
+++ b/doc/classes/AudioEffectLowShelfFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectLowShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectLowShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/AudioEffectNotchFilter.xml b/doc/classes/AudioEffectNotchFilter.xml
index 7aec435bfa..741931f262 100644
--- a/doc/classes/AudioEffectNotchFilter.xml
+++ b/doc/classes/AudioEffectNotchFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectNotchFilter" inherits="AudioEffectFilter" category="Core" version="3.1-dev">
+<class name="AudioEffectNotchFilter" inherits="AudioEffectFilter" category="Core" version="3.1">
<brief_description>
Adds a notch filter to the Audio Bus.
</brief_description>
diff --git a/doc/classes/AudioEffectPanner.xml b/doc/classes/AudioEffectPanner.xml
index a75918958e..cbd14de905 100644
--- a/doc/classes/AudioEffectPanner.xml
+++ b/doc/classes/AudioEffectPanner.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectPanner" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectPanner" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Panner audio effect to an Audio bus. Pans sound left or right.
</brief_description>
diff --git a/doc/classes/AudioEffectPhaser.xml b/doc/classes/AudioEffectPhaser.xml
index e276ed14b6..10566d089b 100644
--- a/doc/classes/AudioEffectPhaser.xml
+++ b/doc/classes/AudioEffectPhaser.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectPhaser" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectPhaser" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Phaser audio effect to an Audio bus.
Combines the original signal with a copy that is slightly out of phase with the original.
diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml
index 4e4658580a..99095bae44 100644
--- a/doc/classes/AudioEffectPitchShift.xml
+++ b/doc/classes/AudioEffectPitchShift.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectPitchShift" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectPitchShift" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Pitch shift audio effect to an Audio bus.
Raises or lowers the pitch of original sound.
diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml
index 8453e4b11b..fb2009105d 100644
--- a/doc/classes/AudioEffectReverb.xml
+++ b/doc/classes/AudioEffectReverb.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectReverb" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectReverb" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
Adds a Reverb audio effect to an Audio bus.
Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open spaces.
diff --git a/doc/classes/AudioEffectStereoEnhance.xml b/doc/classes/AudioEffectStereoEnhance.xml
index 508dc96fb0..ae296d81a0 100644
--- a/doc/classes/AudioEffectStereoEnhance.xml
+++ b/doc/classes/AudioEffectStereoEnhance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioEffectStereoEnhance" inherits="AudioEffect" category="Core" version="3.1-dev">
+<class name="AudioEffectStereoEnhance" inherits="AudioEffect" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml
index 9618f0b066..51df1e99dd 100644
--- a/doc/classes/AudioServer.xml
+++ b/doc/classes/AudioServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioServer" inherits="Object" category="Core" version="3.1-dev">
+<class name="AudioServer" inherits="Object" category="Core" version="3.1">
<brief_description>
Server interface for low level audio access.
</brief_description>
@@ -7,7 +7,7 @@
AudioServer is a low level server interface for audio access. It is in charge of creating sample data (playable audio) as well as its playback via a voice interface.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/audio/audio_buses.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/audio/audio_buses.html</link>
</tutorials>
<demos>
</demos>
@@ -126,6 +126,18 @@
Returns the volume of the bus at index [code]bus_idx[/code] in dB.
</description>
</method>
+ <method name="get_device">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_device_list">
+ <return type="Array">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_mix_rate" qualifiers="const">
<return type="float">
</return>
@@ -313,6 +325,14 @@
Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code].
</description>
</method>
+ <method name="set_device">
+ <return type="void">
+ </return>
+ <argument index="0" name="arg0" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="swap_bus_effects">
<return type="void">
</return>
diff --git a/doc/classes/AudioStream.xml b/doc/classes/AudioStream.xml
index cbb16c3198..15bbb1625c 100644
--- a/doc/classes/AudioStream.xml
+++ b/doc/classes/AudioStream.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStream" inherits="Resource" category="Core" version="3.1-dev">
+<class name="AudioStream" inherits="Resource" category="Core" version="3.1">
<brief_description>
Base class for audio streams.
</brief_description>
@@ -7,7 +7,7 @@
Base class for audio streams. Audio streams are used for music playback, or other types of streamed sounds that don't fit or require more flexibility than a [Sample].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/AudioStreamPlayback.xml b/doc/classes/AudioStreamPlayback.xml
index a27ab1d3a2..0960935ad9 100644
--- a/doc/classes/AudioStreamPlayback.xml
+++ b/doc/classes/AudioStreamPlayback.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamPlayback" inherits="Reference" category="Core" version="3.1-dev">
+<class name="AudioStreamPlayback" inherits="Reference" category="Core" version="3.1">
<brief_description>
Meta class for playing back audio.
</brief_description>
diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml
index f7c8f76182..00d03d2b20 100644
--- a/doc/classes/AudioStreamPlayer.xml
+++ b/doc/classes/AudioStreamPlayer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamPlayer" inherits="Node" category="Core" version="3.1-dev">
+<class name="AudioStreamPlayer" inherits="Node" category="Core" version="3.1">
<brief_description>
Plays back audio.
</brief_description>
@@ -7,8 +7,8 @@
Plays background audio.
</description>
<tutorials>
- http://docs.godotengine.org/en/latest/learning/features/audio/index.html
- http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html
+ <link>http://docs.godotengine.org/en/latest/learning/features/audio/index.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html</link>
</tutorials>
<demos>
</demos>
@@ -57,6 +57,7 @@
If the audio configuration has more than two speakers, this sets the target channels. See [code]MIX_TARGET_*[/code] constants.
</member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale">
+ Changes the pitch and the tempo of the audio.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="is_playing">
If [code]true[/code] audio is playing.
diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml
index 6594c9c8b9..03b0a3aa81 100644
--- a/doc/classes/AudioStreamPlayer2D.xml
+++ b/doc/classes/AudioStreamPlayer2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamPlayer2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="AudioStreamPlayer2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Plays audio in 2D.
</brief_description>
@@ -7,8 +7,8 @@
Plays audio that dampens with distance from screen center.
</description>
<tutorials>
- http://docs.godotengine.org/en/latest/learning/features/audio/index.html
- http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html
+ <link>http://docs.godotengine.org/en/latest/learning/features/audio/index.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html</link>
</tutorials>
<demos>
</demos>
@@ -63,6 +63,7 @@
Maximum distance from which audio is still hearable.
</member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale">
+ Changes the pitch and the tempo of the audio.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="is_playing">
If [code]true[/code] audio is playing.
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index 7eb1ff2b91..2746938c1d 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamPlayer3D" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="AudioStreamPlayer3D" inherits="Spatial" category="Core" version="3.1">
<brief_description>
- Plays 3D sound in 3D space
+ Plays 3D sound in 3D space.
</brief_description>
<description>
Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space.
</description>
<tutorials>
- http://docs.godotengine.org/en/latest/learning/features/audio/index.html
- http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html
+ <link>http://docs.godotengine.org/en/latest/learning/features/audio/index.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/audio/audio_streams.html</link>
</tutorials>
<demos>
</demos>
@@ -87,6 +87,7 @@
Decides if audio should pause when source is outside of 'max_distance' range.
</member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale">
+ Changes the pitch and the tempo of the audio.
</member>
<member name="playing" type="bool" setter="_set_playing" getter="is_playing">
If [code]true[/code], audio is playing.
diff --git a/doc/classes/AudioStreamRandomPitch.xml b/doc/classes/AudioStreamRandomPitch.xml
index 362504d00d..992c731d47 100644
--- a/doc/classes/AudioStreamRandomPitch.xml
+++ b/doc/classes/AudioStreamRandomPitch.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamRandomPitch" inherits="AudioStream" category="Core" version="3.1-dev">
+<class name="AudioStreamRandomPitch" inherits="AudioStream" category="Core" version="3.1">
<brief_description>
Plays audio with random pitch tweaking.
</brief_description>
diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml
index 224d1802dd..b6abda1a6f 100644
--- a/doc/classes/AudioStreamSample.xml
+++ b/doc/classes/AudioStreamSample.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamSample" inherits="AudioStream" category="Core" version="3.1-dev">
+<class name="AudioStreamSample" inherits="AudioStream" category="Core" version="3.1">
<brief_description>
Plays audio.
</brief_description>
@@ -13,6 +13,9 @@
<methods>
</methods>
<members>
+ <member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
+ Contains the audio data in bytes.
+ </member>
<member name="format" type="int" setter="set_format" getter="get_format" enum="AudioStreamSample.Format">
Audio format. See FORMAT_* constants for values.
</member>
diff --git a/doc/classes/BackBufferCopy.xml b/doc/classes/BackBufferCopy.xml
index 05a10da3ac..7070fdec4c 100644
--- a/doc/classes/BackBufferCopy.xml
+++ b/doc/classes/BackBufferCopy.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BackBufferCopy" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="BackBufferCopy" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with the texscreen() shader instruction.
</brief_description>
diff --git a/doc/classes/BakedLightmap.xml b/doc/classes/BakedLightmap.xml
index 98ba28adeb..77895249e5 100644
--- a/doc/classes/BakedLightmap.xml
+++ b/doc/classes/BakedLightmap.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BakedLightmap" inherits="VisualInstance" category="Core" version="3.1-dev">
+<class name="BakedLightmap" inherits="VisualInstance" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/baked_lightmaps.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/baked_lightmaps.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/BakedLightmapData.xml b/doc/classes/BakedLightmapData.xml
index 49f09dc32b..8ee10b0b8b 100644
--- a/doc/classes/BakedLightmapData.xml
+++ b/doc/classes/BakedLightmapData.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BakedLightmapData" inherits="Resource" category="Core" version="3.1-dev">
+<class name="BakedLightmapData" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml
index 0af7b6993c..3ff8634010 100644
--- a/doc/classes/BaseButton.xml
+++ b/doc/classes/BaseButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BaseButton" inherits="Control" category="Core" version="3.1-dev">
+<class name="BaseButton" inherits="Control" category="Core" version="3.1">
<brief_description>
Base class for different kinds of buttons.
</brief_description>
@@ -15,7 +15,7 @@
<return type="void">
</return>
<description>
- Called when button is pressed.
+ Called when the button is pressed.
</description>
</method>
<method name="_toggled" qualifiers="virtual">
@@ -24,7 +24,7 @@
<argument index="0" name="button_pressed" type="bool">
</argument>
<description>
- Called when button is toggled (only if toggle_mode is active).
+ Called when the button is toggled (only if toggle_mode is active).
</description>
</method>
<method name="get_draw_mode" qualifiers="const">
@@ -38,7 +38,7 @@
<return type="bool">
</return>
<description>
- Return true if mouse entered the button before it exit.
+ Return true if the mouse has entered the button and has not left it yet.
</description>
</method>
</methods>
@@ -46,6 +46,10 @@
<member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="BaseButton.ActionMode">
Determines when the button is considered clicked, one of the ACTION_MODE_* constants.
</member>
+ <member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask">
+ Binary mask to choose which mouse buttons this button will respond to.
+ To allow both left-click and right-click, set this to 3, because it's BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT.
+ </member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
If [code]true[/code] the button is in disabled state and can't be clicked or toggled.
</member>
diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml
index 2bca7d7c1b..fe8debe1a9 100644
--- a/doc/classes/Basis.xml
+++ b/doc/classes/Basis.xml
@@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Basis" category="Built-In Types" version="3.1-dev">
+<class name="Basis" category="Built-In Types" version="3.1">
<brief_description>
3x3 matrix datatype.
</brief_description>
<description>
- 3x3 matrix used for 3D rotation and scale. Contains 3 vector fields x,y and z as its columns, which can be interpreted as the local basis vectors of a transformation. Can also be accessed as array of 3D vectors. These vectors are orthogonal to each other, but are not necessarily normalized. Almost always used as orthogonal basis for a [Transform].
+ 3x3 matrix used for 3D rotation and scale. Contains 3 vector fields x,y and z as its columns, which can be interpreted as the local basis vectors of a transformation. Can also be accessed as array of 3D vectors. These vectors are orthogonal to each other, but are not necessarily normalized (due to scaling). Almost always used as orthogonal basis for a [Transform].
For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S).
</description>
<tutorials>
+ <link>http://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html</link>
+ <link>http://docs.godotengine.org/en/latest/tutorials/math/rotations.html</link>
</tutorials>
<demos>
</demos>
@@ -104,7 +106,7 @@
<argument index="1" name="phi" type="float">
</argument>
<description>
- Introduce an additional rotation around the given axis by phi (radians). Only relevant when the matrix is being used as a part of [Transform]. The axis must be a normalized vector.
+ Introduce an additional rotation around the given axis by phi (radians). The axis must be a normalized vector.
</description>
</method>
<method name="scaled">
@@ -113,7 +115,18 @@
<argument index="0" name="scale" type="Vector3">
</argument>
<description>
- Introduce an additional scaling specified by the given 3D scaling factor. Only relevant when the matrix is being used as a part of [Transform].
+ Introduce an additional scaling specified by the given 3D scaling factor.
+ </description>
+ </method>
+ <method name="slerp">
+ <return type="Basis">
+ </return>
+ <argument index="0" name="b" type="Basis">
+ </argument>
+ <argument index="1" name="t" type="float">
+ </argument>
+ <description>
+ Assuming that the matrix is a proper rotation matrix, slerp performs a spherical-linear interpolation with another rotation matrix.
</description>
</method>
<method name="tdotx">
diff --git a/doc/classes/BitMap.xml b/doc/classes/BitMap.xml
index 1d2fc950f0..98f554ebaa 100644
--- a/doc/classes/BitMap.xml
+++ b/doc/classes/BitMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BitMap" inherits="Resource" category="Core" version="3.1-dev">
+<class name="BitMap" inherits="Resource" category="Core" version="3.1">
<brief_description>
Boolean matrix.
</brief_description>
@@ -25,8 +25,10 @@
</return>
<argument index="0" name="image" type="Image">
</argument>
+ <argument index="1" name="threshold" type="float" default="0.1">
+ </argument>
<description>
- Creates a bitmap that matches the given image dimensions, every element of the bitmap is set to false if the alpha value of the image at that position is 0, and true in other case.
+ Creates a bitmap that matches the given image dimensions, every element of the bitmap is set to false if the alpha value of the image at that position is equal to [code]threshold[/code] or less, and true in other case.
</description>
</method>
<method name="get_bit" qualifiers="const">
diff --git a/doc/classes/BitmapFont.xml b/doc/classes/BitmapFont.xml
index cff8951a4c..c943caf636 100644
--- a/doc/classes/BitmapFont.xml
+++ b/doc/classes/BitmapFont.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BitmapFont" inherits="Font" category="Core" version="3.1-dev">
+<class name="BitmapFont" inherits="Font" category="Core" version="3.1">
<brief_description>
Renders text using [code]*.fnt[/code] fonts.
</brief_description>
diff --git a/doc/classes/Bone2D.xml b/doc/classes/Bone2D.xml
new file mode 100644
index 0000000000..7e714305cd
--- /dev/null
+++ b/doc/classes/Bone2D.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="Bone2D" inherits="Node2D" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="apply_rest">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_index_in_skeleton" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_skeleton_rest" qualifiers="const">
+ <return type="Transform2D">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="default_length" type="float" setter="set_default_length" getter="get_default_length">
+ </member>
+ <member name="rest" type="Transform2D" setter="set_rest" getter="get_rest">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/BoneAttachment.xml b/doc/classes/BoneAttachment.xml
index 3b7cd3fff2..a85453a415 100644
--- a/doc/classes/BoneAttachment.xml
+++ b/doc/classes/BoneAttachment.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BoneAttachment" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="BoneAttachment" inherits="Spatial" category="Core" version="3.1">
<brief_description>
A node that will attach to a bone.
</brief_description>
diff --git a/doc/classes/BoxContainer.xml b/doc/classes/BoxContainer.xml
index 542703bae7..3fbad58a24 100644
--- a/doc/classes/BoxContainer.xml
+++ b/doc/classes/BoxContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BoxContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="BoxContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
Base class for box containers.
</brief_description>
diff --git a/doc/classes/BoxShape.xml b/doc/classes/BoxShape.xml
index 33ba197bec..d98a188870 100644
--- a/doc/classes/BoxShape.xml
+++ b/doc/classes/BoxShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BoxShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="BoxShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
Box shape resource.
</brief_description>
diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml
index 7783951cf9..382a538f2b 100644
--- a/doc/classes/Button.xml
+++ b/doc/classes/Button.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Button" inherits="BaseButton" category="Core" version="3.1-dev">
+<class name="Button" inherits="BaseButton" category="Core" version="3.1">
<brief_description>
Standard themed Button.
</brief_description>
diff --git a/doc/classes/ButtonGroup.xml b/doc/classes/ButtonGroup.xml
index ebeb1e0aa0..e839c3e750 100644
--- a/doc/classes/ButtonGroup.xml
+++ b/doc/classes/ButtonGroup.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ButtonGroup" inherits="Resource" category="Core" version="3.1-dev">
+<class name="ButtonGroup" inherits="Resource" category="Core" version="3.1">
<brief_description>
Group of Buttons.
</brief_description>
diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml
index 226277d178..7f7f152ae9 100644
--- a/doc/classes/Camera.xml
+++ b/doc/classes/Camera.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Camera" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Camera" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Camera node, displays from a point of view.
</brief_description>
@@ -14,15 +14,17 @@
<method name="clear_current">
<return type="void">
</return>
+ <argument index="0" name="enable_next" type="bool" default="true">
+ </argument>
<description>
- If this is the current Camera, remove it from being current. If it is inside the node tree, request to make the next Camera current, if any.
+ If this is the current Camera, remove it from being current. If [code]enable_next[/code] is true, request to make the next Camera current, if any.
</description>
</method>
<method name="get_camera_transform" qualifiers="const">
<return type="Transform">
</return>
<description>
- Get the camera transform. Subclassed cameras (such as CharacterCamera) may provide different transforms than the [Node] transform.
+ Gets the camera transform. Subclassed cameras (such as CharacterCamera) may provide different transforms than the [Node] transform.
</description>
</method>
<method name="is_position_behind" qualifiers="const">
@@ -31,14 +33,14 @@
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
- Returns [code]true[/code] if the given position is behind the Camera.
+ Returns [code]true[/code] if the given position is behind the Camera. Note that a position which returns [code]false[/code] may still be outside the Camera's field of view.
</description>
</method>
<method name="make_current">
<return type="void">
</return>
<description>
- Make this camera the current Camera for the [Viewport] (see class description). If the Camera Node is outside the scene tree, it will attempt to become current once it's added.
+ Makes this camera the current Camera for the [Viewport] (see class description). If the Camera Node is outside the scene tree, it will attempt to become current once it's added.
</description>
</method>
<method name="project_local_ray_normal" qualifiers="const">
@@ -56,7 +58,7 @@
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
- Returns how a 2D coordinate in the Viewport rectangle maps to a 3D point in worldspace.
+ Returns the 3D point in worldspace that maps to the given 2D coordinate in the [Viewport] rectangle.
</description>
</method>
<method name="project_ray_normal" qualifiers="const">
@@ -87,7 +89,7 @@
<argument index="2" name="z_far" type="float">
</argument>
<description>
- Set the camera projection to orthogonal mode, by specifying a width and the [i]near[/i] and [i]far[/i] clip planes in worldspace units. (As a hint, 2D games often use this projection, with values specified in pixels)
+ Sets the camera projection to orthogonal mode, by specifying a width and the [i]near[/i] and [i]far[/i] clip planes in worldspace units. (As a hint, 2D games often use this projection, with values specified in pixels)
</description>
</method>
<method name="set_perspective">
@@ -100,7 +102,7 @@
<argument index="2" name="z_far" type="float">
</argument>
<description>
- Set the camera projection to perspective mode, by specifying a [i]FOV[/i] Y angle in degrees (FOV means Field of View), and the [i]near[/i] and [i]far[/i] clip planes in worldspace units.
+ Sets the camera projection to perspective mode, by specifying a [i]FOV[/i] Y angle in degrees (FOV means Field of View), and the [i]near[/i] and [i]far[/i] clip planes in worldspace units.
</description>
</method>
<method name="unproject_position" qualifiers="const">
@@ -109,7 +111,7 @@
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
- Returns how a 3D point in worldspace maps to a 2D coordinate in the [Viewport] rectangle.
+ Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in worldspace.
</description>
</method>
</methods>
@@ -124,7 +126,7 @@
If not [code]DOPPLER_TRACKING_DISABLED[/code] this Camera will simulate the Doppler effect for objects changed in particular [code]_process[/code] methods. Default value: [code]DOPPLER_TRACKING_DISABLED[/code].
</member>
<member name="environment" type="Environment" setter="set_environment" getter="get_environment">
- Set the [Environment] to use for this Camera.
+ The [Environment] to use for this Camera.
</member>
<member name="far" type="float" setter="set_zfar" getter="get_zfar">
The distance to the far culling boundary for this Camera relative to its local z-axis.
@@ -133,10 +135,10 @@
The camera's field of view angle (in degrees). Only applicable in perspective mode. Since [member keep_aspect] locks one axis, [code]fov[/code] sets the other axis' field of view angle.
</member>
<member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset">
- The horizontal (X) offset of the Camear viewport.
+ The horizontal (X) offset of the Camera viewport.
</member>
<member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera.KeepAspect">
- The axis to lock during [member fov]/[member size] adjustments.
+ The axis to lock during [member fov]/[member size] adjustments. Can be either [code]KEEP_WIDTH[/code] or [code]KEEP_HEIGHT[/code].
</member>
<member name="near" type="float" setter="set_znear" getter="get_znear">
The distance to the near culling boundary for this Camera relative to its local z-axis.
@@ -148,7 +150,7 @@
The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length.
</member>
<member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset">
- The horizontal (Y) offset of the Camear viewport.
+ The vertical (Y) offset of the Camera viewport.
</member>
</members>
<constants>
diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml
index 9ab1c63c1f..39cc1b84b3 100644
--- a/doc/classes/Camera2D.xml
+++ b/doc/classes/Camera2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Camera2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Camera2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Camera node for 2D scenes.
</brief_description>
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index e3bf2b9577..a04e38af5c 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CanvasItem" inherits="Node" category="Core" version="3.1-dev">
+<class name="CanvasItem" inherits="Node" category="Core" version="3.1">
<brief_description>
Base class of anything 2D.
</brief_description>
@@ -11,8 +11,8 @@
Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html
- http://docs.godotengine.org/en/3.0/tutorials/2d/custom_drawing_in_2d.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/custom_drawing_in_2d.html</link>
</tutorials>
<demos>
</demos>
@@ -90,6 +90,18 @@
Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased.
</description>
</method>
+ <method name="draw_mesh">
+ <return type="void">
+ </return>
+ <argument index="0" name="mesh" type="Mesh">
+ </argument>
+ <argument index="1" name="texture" type="Texture">
+ </argument>
+ <argument index="2" name="normal_map" type="Texture" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="draw_multiline">
<return type="void">
</return>
@@ -120,6 +132,18 @@
Draws multiple, parallel lines with a uniform [code]width[/code], segment-by-segment coloring, and optional antialiasing. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code].
</description>
</method>
+ <method name="draw_multimesh">
+ <return type="void">
+ </return>
+ <argument index="0" name="mesh" type="Mesh">
+ </argument>
+ <argument index="1" name="texture" type="Texture">
+ </argument>
+ <argument index="2" name="normal_map" type="Texture" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="draw_polygon">
<return type="void">
</return>
@@ -542,6 +566,9 @@
<constant name="BLEND_MODE_PREMULT_ALPHA" value="4" enum="BlendMode">
Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
</constant>
+ <constant name="BLEND_MODE_DISABLED" value="5" enum="BlendMode">
+ Disable blending mode. Colors including alpha are written as is. Only applicable for render targets with a transparent background. No lighting will be applied.
+ </constant>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="29">
Canvas item transform has changed. Only received if requested.
</constant>
diff --git a/doc/classes/CanvasItemMaterial.xml b/doc/classes/CanvasItemMaterial.xml
index 1a2c61000e..fe7194dcfe 100644
--- a/doc/classes/CanvasItemMaterial.xml
+++ b/doc/classes/CanvasItemMaterial.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CanvasItemMaterial" inherits="Material" category="Core" version="3.1-dev">
+<class name="CanvasItemMaterial" inherits="Material" category="Core" version="3.1">
<brief_description>
A material for [CanvasItem]s.
</brief_description>
diff --git a/doc/classes/CanvasLayer.xml b/doc/classes/CanvasLayer.xml
index d66ea5acdb..d4412e15c9 100644
--- a/doc/classes/CanvasLayer.xml
+++ b/doc/classes/CanvasLayer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CanvasLayer" inherits="Node" category="Core" version="3.1-dev">
+<class name="CanvasLayer" inherits="Node" category="Core" version="3.1">
<brief_description>
Canvas drawing layer.
</brief_description>
@@ -7,17 +7,17 @@
Canvas drawing layer. [CanvasItem] nodes that are direct or indirect children of a [code]CanvasLayer[/code] will be drawn in that layer. The layer is a numeric index that defines the draw order. The default 2D scene renders with index 0, so a [code]CanvasLayer[/code] with index -1 will be drawn below, and one with index 1 will be drawn above. This is very useful for HUDs (in layer 1+ or above), or backgrounds (in layer -1 or below).
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html
- http://docs.godotengine.org/en/3.0/tutorials/2d/canvas_layers.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/canvas_layers.html</link>
</tutorials>
<demos>
</demos>
<methods>
- <method name="get_world_2d" qualifiers="const">
- <return type="World2D">
+ <method name="get_canvas" qualifiers="const">
+ <return type="RID">
</return>
<description>
- Return the [World2D] used by this layer.
+ Returns the RID of the canvas used by this layer.
</description>
</method>
</methods>
diff --git a/doc/classes/CanvasModulate.xml b/doc/classes/CanvasModulate.xml
index 1595b90ca5..7740423cf5 100644
--- a/doc/classes/CanvasModulate.xml
+++ b/doc/classes/CanvasModulate.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CanvasModulate" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="CanvasModulate" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Tint the entire canvas.
</brief_description>
diff --git a/doc/classes/CapsuleMesh.xml b/doc/classes/CapsuleMesh.xml
index 988c500d52..3500701290 100644
--- a/doc/classes/CapsuleMesh.xml
+++ b/doc/classes/CapsuleMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CapsuleMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="CapsuleMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Class representing a capsule-shaped [PrimitiveMesh].
</brief_description>
diff --git a/doc/classes/CapsuleShape.xml b/doc/classes/CapsuleShape.xml
index c0c5e4e1f2..0c00288783 100644
--- a/doc/classes/CapsuleShape.xml
+++ b/doc/classes/CapsuleShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CapsuleShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="CapsuleShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
Capsule shape for collisions.
</brief_description>
diff --git a/doc/classes/CapsuleShape2D.xml b/doc/classes/CapsuleShape2D.xml
index eaa7eef8cc..f05b194601 100644
--- a/doc/classes/CapsuleShape2D.xml
+++ b/doc/classes/CapsuleShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CapsuleShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="CapsuleShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Capsule shape for 2D collisions.
</brief_description>
@@ -17,7 +17,7 @@
The capsule's height.
</member>
<member name="radius" type="float" setter="set_radius" getter="get_radius">
- The capsules's radius.
+ The capsule's radius.
</member>
</members>
<constants>
diff --git a/doc/classes/CenterContainer.xml b/doc/classes/CenterContainer.xml
index fd2d8ee9e7..41c8cf7100 100644
--- a/doc/classes/CenterContainer.xml
+++ b/doc/classes/CenterContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CenterContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="CenterContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
Keeps children controls centered.
</brief_description>
diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml
index f2aae0a674..fb2cf64d98 100644
--- a/doc/classes/CheckBox.xml
+++ b/doc/classes/CheckBox.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CheckBox" inherits="Button" category="Core" version="3.1-dev">
+<class name="CheckBox" inherits="Button" category="Core" version="3.1">
<brief_description>
- Binary choice user interface widget
+ Binary choice user interface widget.
</brief_description>
<description>
A checkbox allows the user to make a binary choice (choosing only one of two possible options), for example Answer 'yes' or 'no'.
diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml
index 1ad7f9cc68..deba9a17b6 100644
--- a/doc/classes/CheckButton.xml
+++ b/doc/classes/CheckButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CheckButton" inherits="Button" category="Core" version="3.1-dev">
+<class name="CheckButton" inherits="Button" category="Core" version="3.1">
<brief_description>
Checkable button.
</brief_description>
diff --git a/doc/classes/CircleShape2D.xml b/doc/classes/CircleShape2D.xml
index 8736cd47e5..db84c82e48 100644
--- a/doc/classes/CircleShape2D.xml
+++ b/doc/classes/CircleShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CircleShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="CircleShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Circular shape for 2D collisions.
</brief_description>
diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml
index 05f2f6472e..e215585b74 100644
--- a/doc/classes/ClassDB.xml
+++ b/doc/classes/ClassDB.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ClassDB" inherits="Object" category="Core" version="3.1-dev">
+<class name="ClassDB" inherits="Object" category="Core" version="3.1">
<brief_description>
Class information repository.
</brief_description>
@@ -112,7 +112,7 @@
<argument index="1" name="no_inheritance" type="bool" default="false">
</argument>
<description>
- Returns an array with all the signals of 'class' or its ancestry if 'no_inheritance' is false. Every element of the array is a [Dictionary] as described in [class_get_signal].
+ Returns an array with all the signals of 'class' or its ancestry if 'no_inheritance' is false. Every element of the array is a [Dictionary] as described in [method class_get_signal].
</description>
</method>
<method name="class_has_integer_constant" qualifiers="const">
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml
index 8529c68b11..22b9725121 100644
--- a/doc/classes/CollisionObject.xml
+++ b/doc/classes/CollisionObject.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionObject" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="CollisionObject" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Base node for collision objects.
</brief_description>
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index 2e361b5ac1..1ef72c0ca2 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Base node for 2D collision objects.
</brief_description>
diff --git a/doc/classes/CollisionPolygon.xml b/doc/classes/CollisionPolygon.xml
index b0f1142ac5..28e9ba4217 100644
--- a/doc/classes/CollisionPolygon.xml
+++ b/doc/classes/CollisionPolygon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionPolygon" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="CollisionPolygon" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Editor-only class for defining a collision polygon in 3D space.
</brief_description>
diff --git a/doc/classes/CollisionPolygon2D.xml b/doc/classes/CollisionPolygon2D.xml
index 8ef50cb4e0..5b940e7ff1 100644
--- a/doc/classes/CollisionPolygon2D.xml
+++ b/doc/classes/CollisionPolygon2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionPolygon2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="CollisionPolygon2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Defines a 2D collision polygon.
</brief_description>
diff --git a/doc/classes/CollisionShape.xml b/doc/classes/CollisionShape.xml
index 7afd455ebd..682c9340df 100644
--- a/doc/classes/CollisionShape.xml
+++ b/doc/classes/CollisionShape.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionShape" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="CollisionShape" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Node that represents collision shape data in 3D space.
</brief_description>
<description>
- Editor facility for creating and editing collision shapes in 3D space. You can use this node to represent all sorts of collision shapes, for example, add this to an [Area] to give it a detection shape, or add it to a [PhysicsBody] to give create solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method get_shape] to get the actual shape.
+ Editor facility for creating and editing collision shapes in 3D space. You can use this node to represent all sorts of collision shapes, for example, add this to an [Area] to give it a detection shape, or add it to a [PhysicsBody] to create a solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method get_shape] to get the actual shape.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/CollisionShape2D.xml b/doc/classes/CollisionShape2D.xml
index 7b3cddf4aa..3312fad99c 100644
--- a/doc/classes/CollisionShape2D.xml
+++ b/doc/classes/CollisionShape2D.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionShape2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="CollisionShape2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Node that represents collision shape data in 2D space.
</brief_description>
<description>
- Editor facility for creating and editing collision shapes in 2D space. You can use this node to represent all sorts of collision shapes, for example, add this to an [Area2D] to give it a detection shape, or add it to a [PhysicsBody2D] to give create solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method get_shape] to get the actual shape.
+ Editor facility for creating and editing collision shapes in 2D space. You can use this node to represent all sorts of collision shapes, for example, add this to an [Area2D] to give it a detection shape, or add it to a [PhysicsBody2D] to create a solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method get_shape] to get the actual shape.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index 8113ee3415..104c9e0a98 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Color" category="Built-In Types" version="3.1-dev">
+<class name="Color" category="Built-In Types" version="3.1">
<brief_description>
Color in RGBA format with some support for ARGB format.
</brief_description>
@@ -117,6 +117,24 @@
[/codeblock]
</description>
</method>
+ <method name="from_hsv">
+ <return type="Color">
+ </return>
+ <argument index="0" name="h" type="float">
+ </argument>
+ <argument index="1" name="s" type="float">
+ </argument>
+ <argument index="2" name="v" type="float">
+ </argument>
+ <argument index="3" name="a" type="float" default="1">
+ </argument>
+ <description>
+ Constructs a color from an HSV profile. [code]h[/code], [code]s[/code], and [code]v[/code] are values between 0 and 1.
+ [codeblock]
+ var c = Color.from_hsv(0.58, 0.5, 0.79, 0.8) # equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8)
+ [/codeblock]
+ </description>
+ </method>
<method name="gray">
<return type="float">
</return>
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index a2b6e1ae04..1bd902c20e 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ColorPicker" inherits="BoxContainer" category="Core" version="3.1-dev">
+<class name="ColorPicker" inherits="BoxContainer" category="Core" version="3.1">
<brief_description>
Color picker control.
</brief_description>
@@ -31,6 +31,9 @@
<member name="raw_mode" type="bool" setter="set_raw_mode" getter="is_raw_mode">
If [code]true[/code], allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR).
</member>
+ <member name="deferred_mode" type="bool" setter="set_deferred_mode" getter="is_deferred_mode">
+ If [code]true[/code], the color will apply only after user releases mouse button, otherwise it will apply immediatly even in mouse motion event (which can cause performance issues).
+ </member>
</members>
<signals>
<signal name="color_changed">
diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml
index 227d979c64..9d7df14014 100644
--- a/doc/classes/ColorPickerButton.xml
+++ b/doc/classes/ColorPickerButton.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ColorPickerButton" inherits="Button" category="Core" version="3.1-dev">
+<class name="ColorPickerButton" inherits="Button" category="Core" version="3.1">
<brief_description>
- Button that pops out a [ColorPicker]
+ Button that pops out a [ColorPicker].
</brief_description>
<description>
Encapsulates a [ColorPicker] making it accesible by pressing a button, pressing the button will toggle the [ColorPicker] visibility
@@ -11,7 +11,7 @@
<demos>
</demos>
<methods>
- <method name="get_picker" qualifiers="const">
+ <method name="get_picker">
<return type="ColorPicker">
</return>
<description>
@@ -42,6 +42,10 @@
Emitted when the color changes.
</description>
</signal>
+ <signal name="popup_closed">
+ <description>
+ </description>
+ </signal>
</signals>
<constants>
</constants>
diff --git a/doc/classes/ColorRect.xml b/doc/classes/ColorRect.xml
index 468d9b0687..69a70cfa39 100644
--- a/doc/classes/ColorRect.xml
+++ b/doc/classes/ColorRect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ColorRect" inherits="Control" category="Core" version="3.1-dev">
+<class name="ColorRect" inherits="Control" category="Core" version="3.1">
<brief_description>
Colored rect for canvas.
</brief_description>
diff --git a/doc/classes/ConcavePolygonShape.xml b/doc/classes/ConcavePolygonShape.xml
index b838e21318..f4958d88d0 100644
--- a/doc/classes/ConcavePolygonShape.xml
+++ b/doc/classes/ConcavePolygonShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConcavePolygonShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="ConcavePolygonShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
Concave polygon shape.
</brief_description>
diff --git a/doc/classes/ConcavePolygonShape2D.xml b/doc/classes/ConcavePolygonShape2D.xml
index 30dc887f3f..a653872353 100644
--- a/doc/classes/ConcavePolygonShape2D.xml
+++ b/doc/classes/ConcavePolygonShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConcavePolygonShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="ConcavePolygonShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Concave polygon 2D shape resource for physics.
</brief_description>
diff --git a/doc/classes/ConeTwistJoint.xml b/doc/classes/ConeTwistJoint.xml
index 93901dc3c4..d6b2f191a4 100644
--- a/doc/classes/ConeTwistJoint.xml
+++ b/doc/classes/ConeTwistJoint.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConeTwistJoint" inherits="Joint" category="Core" version="3.1-dev">
+<class name="ConeTwistJoint" inherits="Joint" category="Core" version="3.1">
<brief_description>
- A twist joint between two 3D bodies
+ A twist joint between two 3D bodies.
</brief_description>
<description>
The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint].
diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml
index b46e96c2a0..ec0381bda5 100644
--- a/doc/classes/ConfigFile.xml
+++ b/doc/classes/ConfigFile.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConfigFile" inherits="Reference" category="Core" version="3.1-dev">
+<class name="ConfigFile" inherits="Reference" category="Core" version="3.1">
<brief_description>
Helper class to handle INI-style files.
</brief_description>
@@ -117,7 +117,7 @@
<argument index="2" name="value" type="Variant">
</argument>
<description>
- Assigns a value to the specified key of the the specified section. If the section and/or the key do not exist, they are created. Passing a [code]null[/code] value deletes the specified key if it exists, and deletes the section if it ends up empty once the key has been removed.
+ Assigns a value to the specified key of the specified section. If the section and/or the key do not exist, they are created. Passing a [code]null[/code] value deletes the specified key if it exists, and deletes the section if it ends up empty once the key has been removed.
</description>
</method>
</methods>
diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml
index 1641b5df6f..461f48420a 100644
--- a/doc/classes/ConfirmationDialog.xml
+++ b/doc/classes/ConfirmationDialog.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConfirmationDialog" inherits="AcceptDialog" category="Core" version="3.1-dev">
+<class name="ConfirmationDialog" inherits="AcceptDialog" category="Core" version="3.1">
<brief_description>
Dialog for confirmation of actions.
</brief_description>
diff --git a/doc/classes/Container.xml b/doc/classes/Container.xml
index b6afaa6bac..db365db233 100644
--- a/doc/classes/Container.xml
+++ b/doc/classes/Container.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Container" inherits="Control" category="Core" version="3.1-dev">
+<class name="Container" inherits="Control" category="Core" version="3.1">
<brief_description>
Base node for containers.
</brief_description>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 46b2642b89..52382337cf 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Control" inherits="CanvasItem" category="Core" version="3.1-dev">
+<class name="Control" inherits="CanvasItem" category="Core" version="3.1">
<brief_description>
All User Interface nodes inherit from Control. Features anchors and margins to adapt its position and size to its parent.
</brief_description>
@@ -13,8 +13,8 @@
[Theme] resources change the Control's appearance. If you change the [Theme] on a [code]Control[/code] node, it affects all of its children. To override some of the theme's parameters, call one of the [code]add_*_override[/code] methods, like [method add_font_override]. You can override the theme with the inspector.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/gui/index.html
- http://docs.godotengine.org/en/3.0/tutorials/2d/custom_drawing_in_2d.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/gui/index.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/custom_drawing_in_2d.html</link>
</tutorials>
<demos>
</demos>
@@ -51,7 +51,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
- Overrides the color in the [theme] resource the node uses.
+ Overrides the color in the [member theme] resource the node uses.
</description>
</method>
<method name="add_constant_override">
@@ -62,7 +62,7 @@
<argument index="1" name="constant" type="int">
</argument>
<description>
- Overrides an integer constant in the [Theme] resource the node uses. If the [code]constant[/code] is invalid, Godot clears the override. See [member Theme.INVALID_CONSTANT] for more information.
+ Overrides an integer constant in the [member theme] resource the node uses. If the [code]constant[/code] is invalid, Godot clears the override. See [member Theme.INVALID_CONSTANT] for more information.
</description>
</method>
<method name="add_font_override">
@@ -73,7 +73,7 @@
<argument index="1" name="font" type="Font">
</argument>
<description>
- Overrides the [code]name[/code] font in the [theme] resource the node uses. If [code]font[/code] is empty, Godot clears the override.
+ Overrides the [code]name[/code] font in the [member theme] resource the node uses. If [code]font[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_icon_override">
@@ -84,7 +84,7 @@
<argument index="1" name="texture" type="Texture">
</argument>
<description>
- Overrides the [code]name[/code] icon in the [theme] resource the node uses. If [code]icon[/code] is empty, Godot clears the override.
+ Overrides the [code]name[/code] icon in the [member theme] resource the node uses. If [code]icon[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_shader_override">
@@ -95,7 +95,7 @@
<argument index="1" name="shader" type="Shader">
</argument>
<description>
- Overrides the [code]name[/code] shader in the [theme] resource the node uses. If [code]shader[/code] is empty, Godot clears the override.
+ Overrides the [code]name[/code] shader in the [member theme] resource the node uses. If [code]shader[/code] is empty, Godot clears the override.
</description>
</method>
<method name="add_stylebox_override">
@@ -106,7 +106,7 @@
<argument index="1" name="stylebox" type="StyleBox">
</argument>
<description>
- Overrides the [code]name[/code] [Stylebox] in the [theme] resource the node uses. If [code]stylebox[/code] is empty, Godot clears the override.
+ Overrides the [code]name[/code] [Stylebox] in the [member theme] resource the node uses. If [code]stylebox[/code] is empty, Godot clears the override.
</description>
</method>
<method name="can_drop_data" qualifiers="virtual">
@@ -117,6 +117,16 @@
<argument index="1" name="data" type="Variant">
</argument>
<description>
+ Godot calls this method to test if [code]data[/code] from a control's [method get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control.
+ This method should only be used to test the data. Process the data in [method drop_data].
+ [codeblock]
+ extends Control
+
+ func can_drop_data(position, data):
+ # check position if it is relevant to you
+ # otherwise just check data
+ return typeof(data) == TYPE_DICTIONARY and data.has('expected')
+ [/codeblock]
</description>
</method>
<method name="drop_data" qualifiers="virtual">
@@ -127,6 +137,16 @@
<argument index="1" name="data" type="Variant">
</argument>
<description>
+ Godot calls this method to pass you the [code]data[/code] from a control's [method get_drag_data] result. Godot first calls [method can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control.
+ [codeblock]
+ extends ColorRect
+
+ func can_drop_data(position, data):
+ return typeof(data) == TYPE_DICTIONARY and data.has('color')
+
+ func drop_data(position, data):
+ color = data['color']
+ [/codeblock]
</description>
</method>
<method name="force_drag">
@@ -137,6 +157,8 @@
<argument index="1" name="preview" type="Control">
</argument>
<description>
+ Forces drag and bypasses [method get_drag_data] and [method set_drag_preview] by passing [code]data[/code] and [code]preview[/code]. Drag will start even if the mouse is neither over nor pressed on this control.
+ The methods [method can_drop_data] and [method drop_data] must be implemented on controls that want to receive drop data.
</description>
</method>
<method name="get_begin" qualifiers="const">
@@ -186,6 +208,16 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
+ Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Return null if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag].
+ A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method.
+ [codeblock]
+ extends Control
+
+ func get_drag_data(position):
+ var mydata = make_data()
+ set_drag_preview(make_preview(mydata))
+ return mydata
+ [/codeblock]
</description>
</method>
<method name="get_end" qualifiers="const">
@@ -485,6 +517,28 @@
<argument index="0" name="target" type="Control">
</argument>
<description>
+ Forwards the handling of this control's drag and drop to [code]target[/code] control.
+ Forwarding can be implemented in the target control similar to the methods [method get_drag_data], [method can_drop_data], and [method drop_data] but with two differences:
+ 1. The function name must be suffixed with [b]_fw[/b]
+ 2. The function must take an extra argument that is the control doing the forwarding
+ [codeblock]
+ # ThisControl.gd
+ extends Control
+ func _ready():
+ set_drag_forwarding(target_control)
+
+ # TargetControl.gd
+ extends Control
+ func can_drop_data_fw(position, data, from_control):
+ return true
+
+ func drop_data_fw(position, data, from_control):
+ my_handle_data(data)
+
+ func get_drag_data_fw(position, from_control):
+ set_drag_preview(my_preview)
+ return my_data()
+ [/codeblock]
</description>
</method>
<method name="set_drag_preview">
@@ -493,6 +547,7 @@
<argument index="0" name="control" type="Control">
</argument>
<description>
+ Shows the given control at the mouse pointer. A good time to call this method is in [method get_drag_data].
</description>
</method>
<method name="set_end">
@@ -718,6 +773,10 @@
<constant name="NOTIFICATION_MODAL_CLOSE" value="46">
Sent when an open modal dialog closes. See [member show_modal].
</constant>
+ <constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
+ </constant>
+ <constant name="NOTIFICATION_SCROLL_END" value="48">
+ </constant>
<constant name="CURSOR_ARROW" value="0" enum="CursorShape">
Show the system's arrow mouse cursor when the user hovers the node. Use with [method set_default_cursor_shape].
</constant>
@@ -853,6 +912,8 @@
</constant>
<constant name="GROW_DIRECTION_END" value="1" enum="GrowDirection">
</constant>
+ <constant name="GROW_DIRECTION_BOTH" value="2" enum="GrowDirection">
+ </constant>
<constant name="ANCHOR_BEGIN" value="0" enum="Anchor">
Snaps one of the 4 anchor's sides to the origin of the node's [code]Rect[/code], in the top left. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset].
</constant>
diff --git a/doc/classes/ConvexPolygonShape.xml b/doc/classes/ConvexPolygonShape.xml
index ac25fb8cb6..757b053ffe 100644
--- a/doc/classes/ConvexPolygonShape.xml
+++ b/doc/classes/ConvexPolygonShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConvexPolygonShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="ConvexPolygonShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
Convex polygon shape for 3D physics.
</brief_description>
diff --git a/doc/classes/ConvexPolygonShape2D.xml b/doc/classes/ConvexPolygonShape2D.xml
index 3da9d28a8f..6b31149c2f 100644
--- a/doc/classes/ConvexPolygonShape2D.xml
+++ b/doc/classes/ConvexPolygonShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConvexPolygonShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="ConvexPolygonShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Convex Polygon Shape for 2D physics.
</brief_description>
diff --git a/doc/classes/CubeMap.xml b/doc/classes/CubeMap.xml
index edc4a165fc..ac5359738e 100644
--- a/doc/classes/CubeMap.xml
+++ b/doc/classes/CubeMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CubeMap" inherits="Resource" category="Core" version="3.1-dev">
+<class name="CubeMap" inherits="Resource" category="Core" version="3.1">
<brief_description>
A CubeMap is a 6 sided 3D texture.
</brief_description>
diff --git a/doc/classes/CubeMesh.xml b/doc/classes/CubeMesh.xml
index e26e73e861..cef412bbde 100644
--- a/doc/classes/CubeMesh.xml
+++ b/doc/classes/CubeMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CubeMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="CubeMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Generate an axis-aligned cuboid [PrimitiveMesh].
</brief_description>
diff --git a/doc/classes/Curve.xml b/doc/classes/Curve.xml
index a430041571..c7f2f7bb8d 100644
--- a/doc/classes/Curve.xml
+++ b/doc/classes/Curve.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Curve" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Curve" inherits="Resource" category="Core" version="3.1">
<brief_description>
A mathematic curve.
</brief_description>
diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml
index c53f07d406..26de8be42c 100644
--- a/doc/classes/Curve2D.xml
+++ b/doc/classes/Curve2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Curve2D" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Curve2D" inherits="Resource" category="Core" version="3.1">
<brief_description>
Describes a Bezier curve in 2D space.
</brief_description>
@@ -49,6 +49,26 @@
Returns the cache of points as a [PoolVector2Array].
</description>
</method>
+ <method name="get_closest_offset" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="to_point" type="Vector2">
+ </argument>
+ <description>
+ Returns the closest offset to [code]to_point[/code]. This offset is meant to be used in [method interpolate_baked].
+ [code]to_point[/code] must be in this curve's local space.
+ </description>
+ </method>
+ <method name="get_closest_point" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="to_point" type="Vector2">
+ </argument>
+ <description>
+ Returns the closest point (in curve's local space) to [code]to_point[/code].
+ [code]to_point[/code] must be in this curve's local space.
+ </description>
+ </method>
<method name="get_point_count" qualifiers="const">
<return type="int">
</return>
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml
index 1afa315465..1355c74faf 100644
--- a/doc/classes/Curve3D.xml
+++ b/doc/classes/Curve3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Curve3D" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Curve3D" inherits="Resource" category="Core" version="3.1">
<brief_description>
Describes a Bezier curve in 3D space.
</brief_description>
@@ -56,6 +56,34 @@
Returns the cache of tilts as a [RealArray].
</description>
</method>
+ <method name="get_baked_up_vectors" qualifiers="const">
+ <return type="PoolVector3Array">
+ </return>
+ <description>
+ Returns the cache of up vectors as a [PoolVector3Array].
+ If [member up_vector_enabled] is [code]false[/code], the cache will be empty.
+ </description>
+ </method>
+ <method name="get_closest_offset" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="to_point" type="Vector3">
+ </argument>
+ <description>
+ Returns the closest offset to [code]to_point[/code]. This offset is meant to be used in one of the interpolate_baked* methods.
+ [code]to_point[/code] must be in this curve's local space.
+ </description>
+ </method>
+ <method name="get_closest_point" qualifiers="const">
+ <return type="Vector3">
+ </return>
+ <argument index="0" name="to_point" type="Vector3">
+ </argument>
+ <description>
+ Returns the closest point (in curve's local space) to [code]to_point[/code].
+ [code]to_point[/code] must be in this curve's local space.
+ </description>
+ </method>
<method name="get_point_count" qualifiers="const">
<return type="int">
</return>
@@ -124,6 +152,19 @@
Cubic interpolation tends to follow the curves better, but linear is faster (and often, precise enough).
</description>
</method>
+ <method name="interpolate_baked_up_vector" qualifiers="const">
+ <return type="Vector3">
+ </return>
+ <argument index="0" name="offset" type="float">
+ </argument>
+ <argument index="1" name="apply_tilt" type="bool" default="false">
+ </argument>
+ <description>
+ Returns an up vector within the curve at position [code]offset[/code], where [code]offset[/code] is measured as a distance in 3D units along the curve.
+ To do that, it finds the two cached up vectors where the [code]offset[/code] lies between, then interpolates the values. If [code]apply_tilt[/code] is [code]true[/code], an interpolated tilt is applied to the interpolated up vector.
+ If the curve has no up vectors, the function sends an error to the console, and returns (0, 1, 0).
+ </description>
+ </method>
<method name="interpolatef" qualifiers="const">
<return type="Vector3">
</return>
@@ -184,7 +225,7 @@
</argument>
<description>
Sets the tilt angle in radians for the point "idx". If the index is out of bounds, the function sends an error to the console.
- The tilt controls the rotation along the look-at axis an object traveling the path would have. In the case of a curve controlling a [PathFollow], this tilt is an offset over the natural tilt the PathFollow calculates.
+ The tilt controls the rotation along the look-at axis an object traveling the path would have. In the case of a curve controlling a [PathFollow] or [OrientedPathFollow], this tilt is an offset over the natural tilt the [PathFollow] or [OrientedPathFollow] calculates.
</description>
</method>
<method name="tessellate" qualifiers="const">
@@ -206,6 +247,9 @@
<member name="bake_interval" type="float" setter="set_bake_interval" getter="get_bake_interval">
The distance in meters between two adjacent cached points. Changing it forces the cache to be recomputed the next time the [method get_baked_points] or [method get_baked_length] function is called. The smaller the distance, the more points in the cache and the more memory it will consume, so use with care.
</member>
+ <member name="up_vector_enabled" type="bool" setter="set_up_vector_enabled" getter="is_up_vector_enabled">
+ If [code]true[/code], the curve will bake up vectors used for orientation. See [OrientedPathFollow]. Changing it forces the cache to be recomputed.
+ </member>
</members>
<constants>
</constants>
diff --git a/doc/classes/CurveTexture.xml b/doc/classes/CurveTexture.xml
index 67a21957ee..10e8a61f99 100644
--- a/doc/classes/CurveTexture.xml
+++ b/doc/classes/CurveTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CurveTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="CurveTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
A texture that shows a curve.
</brief_description>
diff --git a/doc/classes/CylinderMesh.xml b/doc/classes/CylinderMesh.xml
index 997180a17c..623830371a 100644
--- a/doc/classes/CylinderMesh.xml
+++ b/doc/classes/CylinderMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CylinderMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="CylinderMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Class representing a cylindrical [PrimitiveMesh].
</brief_description>
diff --git a/doc/classes/DampedSpringJoint2D.xml b/doc/classes/DampedSpringJoint2D.xml
index 55c6914c01..12e29cec32 100644
--- a/doc/classes/DampedSpringJoint2D.xml
+++ b/doc/classes/DampedSpringJoint2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="DampedSpringJoint2D" inherits="Joint2D" category="Core" version="3.1-dev">
+<class name="DampedSpringJoint2D" inherits="Joint2D" category="Core" version="3.1">
<brief_description>
Damped spring constraint for 2D physics.
</brief_description>
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index c63e440a57..9fa1e3ea6c 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Dictionary" category="Built-In Types" version="3.1-dev">
+<class name="Dictionary" category="Built-In Types" version="3.1">
<brief_description>
Dictionary type.
</brief_description>
@@ -19,7 +19,10 @@
<method name="duplicate">
<return type="Dictionary">
</return>
+ <argument index="0" name="deep" type="bool" default="False">
+ </argument>
<description>
+ Creates a copy of the dictionary, and returns it.
</description>
</method>
<method name="empty">
diff --git a/doc/classes/DirectionalLight.xml b/doc/classes/DirectionalLight.xml
index d777018ec9..ef75182811 100644
--- a/doc/classes/DirectionalLight.xml
+++ b/doc/classes/DirectionalLight.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="DirectionalLight" inherits="Light" category="Core" version="3.1-dev">
+<class name="DirectionalLight" inherits="Light" category="Core" version="3.1">
<brief_description>
Directional Light, such as the Sun or the Moon.
</brief_description>
@@ -7,7 +7,7 @@
A DirectionalLight is a type of [Light] node that emits light constantly in one direction (the negative z axis of the node). It is used lights with strong intensity that are located far away from the scene to model sunlight or moonlight. The worldspace location of the DirectionalLight transform (origin) is ignored, only the basis is used do determine light direction.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml
index 01590344cf..d8ad208fa7 100644
--- a/doc/classes/Directory.xml
+++ b/doc/classes/Directory.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Directory" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Directory" inherits="Reference" category="Core" version="3.1">
<brief_description>
Type used to handle the filesystem.
</brief_description>
@@ -23,7 +23,7 @@
[/codeblock]
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/step_by_step/filesystem.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/step_by_step/filesystem.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml
index a56a08e7f6..2e2904c16c 100644
--- a/doc/classes/DynamicFont.xml
+++ b/doc/classes/DynamicFont.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="DynamicFont" inherits="Font" category="Core" version="3.1-dev">
+<class name="DynamicFont" inherits="Font" category="Core" version="3.1">
<brief_description>
DynamicFont renders vector font files at runtime.
</brief_description>
@@ -73,6 +73,10 @@
<member name="font_data" type="DynamicFontData" setter="set_font_data" getter="get_font_data">
The font data.
</member>
+ <member name="outline_color" type="Color" setter="set_outline_color" getter="get_outline_color">
+ </member>
+ <member name="outline_size" type="int" setter="set_outline_size" getter="get_outline_size">
+ </member>
<member name="size" type="int" setter="set_size" getter="get_size">
The font size.
</member>
diff --git a/doc/classes/DynamicFontData.xml b/doc/classes/DynamicFontData.xml
index 6113b0616b..7b34d02316 100644
--- a/doc/classes/DynamicFontData.xml
+++ b/doc/classes/DynamicFontData.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="DynamicFontData" inherits="Resource" category="Core" version="3.1-dev">
+<class name="DynamicFontData" inherits="Resource" category="Core" version="3.1">
<brief_description>
Used with [DynamicFont] to describe the location of a font file.
</brief_description>
@@ -16,7 +16,19 @@
<member name="font_path" type="String" setter="set_font_path" getter="get_font_path">
The path to the vector font file.
</member>
+ <member name="hinting" type="int" setter="set_hinting" getter="get_hinting" enum="DynamicFontData.Hinting">
+ The font hinting mode used by FreeType.
+ </member>
</members>
<constants>
+ <constant name="HINTING_NONE" value="0" enum="Hinting">
+ Disable font hinting (smoother but less crisp).
+ </constant>
+ <constant name="HINTING_LIGHT" value="1" enum="Hinting">
+ Use the light font hinting mode.
+ </constant>
+ <constant name="HINTING_NORMAL" value="2" enum="Hinting">
+ Use the default font hinting mode (crisper but less smooth).
+ </constant>
</constants>
</class>
diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml
index 68999c2ae4..a6b72d08ff 100644
--- a/doc/classes/EditorExportPlugin.xml
+++ b/doc/classes/EditorExportPlugin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorExportPlugin" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorExportPlugin" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml
index da1dbb9327..fed9e264db 100644
--- a/doc/classes/EditorFileDialog.xml
+++ b/doc/classes/EditorFileDialog.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorFileDialog" inherits="ConfirmationDialog" category="Core" version="3.1-dev">
+<class name="EditorFileDialog" inherits="ConfirmationDialog" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/EditorFileSystem.xml b/doc/classes/EditorFileSystem.xml
index f5a3bf7eca..347acce2dd 100644
--- a/doc/classes/EditorFileSystem.xml
+++ b/doc/classes/EditorFileSystem.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorFileSystem" inherits="Node" category="Core" version="3.1-dev">
+<class name="EditorFileSystem" inherits="Node" category="Core" version="3.1">
<brief_description>
Resource filesystem, as the editor sees it.
</brief_description>
diff --git a/doc/classes/EditorFileSystemDirectory.xml b/doc/classes/EditorFileSystemDirectory.xml
index 295a4d094f..f5d0471037 100644
--- a/doc/classes/EditorFileSystemDirectory.xml
+++ b/doc/classes/EditorFileSystemDirectory.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorFileSystemDirectory" inherits="Object" category="Core" version="3.1-dev">
+<class name="EditorFileSystemDirectory" inherits="Object" category="Core" version="3.1">
<brief_description>
A diretory for the resource filesystem.
</brief_description>
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml
index fa22691a83..e48eb82691 100644
--- a/doc/classes/EditorImportPlugin.xml
+++ b/doc/classes/EditorImportPlugin.xml
@@ -1,14 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorImportPlugin" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorImportPlugin" inherits="Reference" category="Core" version="3.1">
<brief_description>
Registers a custom resource importer in the editor. Use the class to parse any file and import it as a new resource type.
</brief_description>
<description>
EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. Register your [EditorPlugin] with [method EditorPlugin.add_import_plugin].
-
EditorImportPlugins work by associating with specific file extensions and a resource type. See [method get_recognized_extension] and [method get_resource_type]). They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the [code].import[/code] directory.
-
-
Below is an example EditorImportPlugin that imports a [Mesh] from a file with the extension ".special" or ".spec":
[codeblock]
tool
diff --git a/doc/classes/EditorInspector.xml b/doc/classes/EditorInspector.xml
new file mode 100644
index 0000000000..381eef5a40
--- /dev/null
+++ b/doc/classes/EditorInspector.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="EditorInspector" inherits="ScrollContainer" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <signals>
+ <signal name="object_id_selected">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="property_keyed">
+ <argument index="0" name="property" type="String">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="resource_selected">
+ <argument index="0" name="res" type="Object">
+ </argument>
+ <argument index="1" name="prop" type="String">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml
new file mode 100644
index 0000000000..9bda768b14
--- /dev/null
+++ b/doc/classes/EditorInspectorPlugin.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="EditorInspectorPlugin" inherits="Reference" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="add_custom_control">
+ <return type="void">
+ </return>
+ <argument index="0" name="control" type="Control">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="add_property_editor">
+ <return type="void">
+ </return>
+ <argument index="0" name="property" type="String">
+ </argument>
+ <argument index="1" name="editor" type="Control">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="add_property_editor_for_multiple_properties">
+ <return type="void">
+ </return>
+ <argument index="0" name="label" type="String">
+ </argument>
+ <argument index="1" name="properties" type="PoolStringArray">
+ </argument>
+ <argument index="2" name="editor" type="Control">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="can_handle" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="object" type="Object">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="parse_begin" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="object" type="Object">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="parse_category" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <argument index="0" name="object" type="Object">
+ </argument>
+ <argument index="1" name="category" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="parse_end" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="parse_property" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="object" type="Object">
+ </argument>
+ <argument index="1" name="type" type="int">
+ </argument>
+ <argument index="2" name="path" type="String">
+ </argument>
+ <argument index="3" name="hint" type="int">
+ </argument>
+ <argument index="4" name="hint_text" type="String">
+ </argument>
+ <argument index="5" name="usage" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml
index 0731c332ad..19bd7e6d52 100644
--- a/doc/classes/EditorInterface.xml
+++ b/doc/classes/EditorInterface.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorInterface" inherits="Node" category="Core" version="3.1-dev">
+<class name="EditorInterface" inherits="Node" category="Core" version="3.1">
<brief_description>
Editor interface and main components.
</brief_description>
<description>
- Editor interface. Allows saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects and provides access to [EditorSettings], [EditorFileSystem], [EditorResourcePreview]\ er, [ScriptEditor], the editor viewport, as well as information about scenes. Also see [EditorPlugin] and [EditorScript].
+ Editor interface. Allows saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects and provides access to [EditorSettings], [EditorFileSystem], [EditorResourcePreview], [ScriptEditor], the editor viewport, as well as information about scenes. Also see [EditorPlugin] and [EditorScript].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index b7f7d74f54..b9945f3f73 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorPlugin" inherits="Node" category="Core" version="3.1-dev">
+<class name="EditorPlugin" inherits="Node" category="Core" version="3.1">
<brief_description>
Used by the editor to extend its functionality.
</brief_description>
@@ -7,11 +7,22 @@
Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/development/plugins/index.html
+ <link>http://docs.godotengine.org/en/3.0/development/plugins/index.html</link>
</tutorials>
<demos>
</demos>
<methods>
+ <method name="add_autoload_singleton">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="path" type="String">
+ </argument>
+ <description>
+ Add a script at [code]path[/code] to the Autoload list as [code]name[/code].
+ </description>
+ </method>
<method name="add_control_to_bottom_panel">
<return type="ToolButton">
</return>
@@ -70,7 +81,7 @@
<method name="add_export_plugin">
<return type="void">
</return>
- <argument index="0" name="exporter" type="EditorExportPlugin">
+ <argument index="0" name="plugin" type="EditorExportPlugin">
</argument>
<description>
</description>
@@ -83,6 +94,14 @@
<description>
</description>
</method>
+ <method name="add_inspector_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="plugin" type="EditorInspectorPlugin">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="add_scene_import_plugin">
<return type="void">
</return>
@@ -91,6 +110,21 @@
<description>
</description>
</method>
+ <method name="add_tool_menu_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <argument index="1" name="handler" type="Object">
+ </argument>
+ <argument index="2" name="callback" type="String">
+ </argument>
+ <argument index="3" name="ud" type="Variant" default="null">
+ </argument>
+ <description>
+ Adds a custom menu to 'Project &gt; Tools' as [code]name[/code] that calls [code]callback[/code] on an instance of [code]handler[/code] with a parameter [code]ud[/code] when user activates it.
+ </description>
+ </method>
<method name="add_tool_submenu_item">
<return type="void">
</return>
@@ -109,6 +143,12 @@
This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.
</description>
</method>
+ <method name="build" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="clear" qualifiers="virtual">
<return type="void">
</return>
@@ -265,6 +305,15 @@
Queue save the project's editor layout.
</description>
</method>
+ <method name="remove_autoload_singleton">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Remove an Autoload [code]name[/code] from the list.
+ </description>
+ </method>
<method name="remove_control_from_bottom_panel">
<return type="void">
</return>
@@ -306,7 +355,7 @@
<method name="remove_export_plugin">
<return type="void">
</return>
- <argument index="0" name="exporter" type="EditorExportPlugin">
+ <argument index="0" name="plugin" type="EditorExportPlugin">
</argument>
<description>
</description>
@@ -319,6 +368,14 @@
<description>
</description>
</method>
+ <method name="remove_inspector_plugin">
+ <return type="void">
+ </return>
+ <argument index="0" name="plugin" type="EditorInspectorPlugin">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="remove_scene_import_plugin">
<return type="void">
</return>
@@ -327,6 +384,15 @@
<description>
</description>
</method>
+ <method name="remove_tool_menu_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ Removes a menu [code]name[/code] from 'Project &gt; Tools'.
+ </description>
+ </method>
<method name="save_external_data" qualifiers="virtual">
<return type="void">
</return>
@@ -380,6 +446,12 @@
Emitted when user change main screen view (2D, 3D, Script, AssetLib). Works also with screens which are defined by plugins.
</description>
</signal>
+ <signal name="resource_saved">
+ <argument index="0" name="resource" type="Object">
+ </argument>
+ <description>
+ </description>
+ </signal>
<signal name="scene_changed">
<argument index="0" name="scene_root" type="Object">
</argument>
diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml
new file mode 100644
index 0000000000..9b5452ec14
--- /dev/null
+++ b/doc/classes/EditorProperty.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="EditorProperty" inherits="Container" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_edited_object">
+ <return type="Object">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_edited_property">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="update_property" qualifiers="virtual">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="checkable" type="bool" setter="set_checkable" getter="is_checkable">
+ </member>
+ <member name="checked" type="bool" setter="set_checked" getter="is_checked">
+ </member>
+ <member name="draw_red" type="bool" setter="set_draw_red" getter="is_draw_red">
+ </member>
+ <member name="keying" type="bool" setter="set_keying" getter="is_keying">
+ </member>
+ <member name="label" type="String" setter="set_label" getter="get_label">
+ </member>
+ <member name="read_only" type="bool" setter="set_read_only" getter="is_read_only">
+ </member>
+ </members>
+ <signals>
+ <signal name="multiple_properties_changed">
+ <argument index="0" name="properties" type="PoolStringArray">
+ </argument>
+ <argument index="1" name="value" type="Array">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="object_id_selected">
+ <argument index="0" name="property" type="String">
+ </argument>
+ <argument index="1" name="id" type="int">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="property_changed">
+ <argument index="0" name="property" type="String">
+ </argument>
+ <argument index="1" name="value" type="Nil">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="property_checked">
+ <argument index="0" name="property" type="String">
+ </argument>
+ <argument index="1" name="bool" type="String">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="property_keyed">
+ <argument index="0" name="property" type="String">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="property_keyed_with_value">
+ <argument index="0" name="property" type="String">
+ </argument>
+ <argument index="1" name="value" type="Nil">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="resource_selected">
+ <argument index="0" name="path" type="String">
+ </argument>
+ <argument index="1" name="resource" type="Object">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="selected">
+ <argument index="0" name="path" type="String">
+ </argument>
+ <argument index="1" name="focusable_idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/EditorResourceConversionPlugin.xml b/doc/classes/EditorResourceConversionPlugin.xml
index 240d82d5d2..ad0b7b0586 100644
--- a/doc/classes/EditorResourceConversionPlugin.xml
+++ b/doc/classes/EditorResourceConversionPlugin.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorResourceConversionPlugin" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorResourceConversionPlugin" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml
index 6ec7f8a088..3b3e8a8369 100644
--- a/doc/classes/EditorResourcePreview.xml
+++ b/doc/classes/EditorResourcePreview.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorResourcePreview" inherits="Node" category="Core" version="3.1-dev">
+<class name="EditorResourcePreview" inherits="Node" category="Core" version="3.1">
<brief_description>
Helper to generate previews of resources or files.
</brief_description>
diff --git a/doc/classes/EditorResourcePreviewGenerator.xml b/doc/classes/EditorResourcePreviewGenerator.xml
index 80aa185bb6..fb9af47b1f 100644
--- a/doc/classes/EditorResourcePreviewGenerator.xml
+++ b/doc/classes/EditorResourcePreviewGenerator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorResourcePreviewGenerator" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorResourcePreviewGenerator" inherits="Reference" category="Core" version="3.1">
<brief_description>
Custom generator of previews.
</brief_description>
diff --git a/doc/classes/EditorSceneImporter.xml b/doc/classes/EditorSceneImporter.xml
index 340ea30ad0..6394dfdfe9 100644
--- a/doc/classes/EditorSceneImporter.xml
+++ b/doc/classes/EditorSceneImporter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSceneImporter" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorSceneImporter" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml
index 8e7c79db84..664ea33dd6 100644
--- a/doc/classes/EditorScenePostImport.xml
+++ b/doc/classes/EditorScenePostImport.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorScenePostImport" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorScenePostImport" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml
index fa7a74460f..1c22095b37 100644
--- a/doc/classes/EditorScript.xml
+++ b/doc/classes/EditorScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorScript" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EditorScript" inherits="Reference" category="Core" version="3.1">
<brief_description>
Base script that can be used to add extension functions to the editor.
</brief_description>
diff --git a/doc/classes/EditorSelection.xml b/doc/classes/EditorSelection.xml
index 325fae0fe9..4edd8583a0 100644
--- a/doc/classes/EditorSelection.xml
+++ b/doc/classes/EditorSelection.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSelection" inherits="Object" category="Core" version="3.1-dev">
+<class name="EditorSelection" inherits="Object" category="Core" version="3.1">
<brief_description>
Manages the SceneTree selection in the editor.
</brief_description>
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index ef50c34792..bd85075b7e 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSettings" inherits="Resource" category="Core" version="3.1-dev">
+<class name="EditorSettings" inherits="Resource" category="Core" version="3.1">
<brief_description>
Object that holds the project-independent editor settings.
</brief_description>
@@ -55,6 +55,18 @@
Get the list of favorite directories for this project.
</description>
</method>
+ <method name="get_project_metadata" qualifiers="const">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="section" type="String">
+ </argument>
+ <argument index="1" name="key" type="String">
+ </argument>
+ <argument index="2" name="default" type="Variant" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_project_settings_dir" qualifiers="const">
<return type="String">
</return>
@@ -131,6 +143,18 @@
<description>
</description>
</method>
+ <method name="set_project_metadata">
+ <return type="void">
+ </return>
+ <argument index="0" name="section" type="String">
+ </argument>
+ <argument index="1" name="key" type="String">
+ </argument>
+ <argument index="2" name="data" type="Variant">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_recent_dirs">
<return type="void">
</return>
diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml
index 3895f8a2e7..3636442b85 100644
--- a/doc/classes/EditorSpatialGizmo.xml
+++ b/doc/classes/EditorSpatialGizmo.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSpatialGizmo" inherits="SpatialGizmo" category="Core" version="3.1-dev">
+<class name="EditorSpatialGizmo" inherits="SpatialGizmo" category="Core" version="3.1">
<brief_description>
Custom gizmo for editing Spatial objects.
</brief_description>
@@ -24,8 +24,6 @@
</return>
<argument index="0" name="triangles" type="TriangleMesh">
</argument>
- <argument index="1" name="bounds" type="AABB">
- </argument>
<description>
Add collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method redraw].
</description>
diff --git a/doc/classes/EncodedObjectAsID.xml b/doc/classes/EncodedObjectAsID.xml
index 5b1b370fe0..8e6a117ea2 100644
--- a/doc/classes/EncodedObjectAsID.xml
+++ b/doc/classes/EncodedObjectAsID.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EncodedObjectAsID" inherits="Reference" category="Core" version="3.1-dev">
+<class name="EncodedObjectAsID" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index d4fb66540b..f921b76b21 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Engine" inherits="Object" category="Core" version="3.1-dev">
+<class name="Engine" inherits="Object" category="Core" version="3.1">
<brief_description>
Access to basic engine properties.
</brief_description>
@@ -11,6 +11,34 @@
<demos>
</demos>
<methods>
+ <method name="get_author_info" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Returns engine author information in a Dictionary.
+ "lead_developers" - Array of Strings, lead developer names
+ "founders" - Array of Strings, founder names
+ "project_managers" - Array of Strings, project manager names
+ "developers" - Array of Strings, developer names
+ </description>
+ </method>
+ <method name="get_copyright_info" qualifiers="const">
+ <return type="Array">
+ </return>
+ <description>
+ Returns an Array of copyright information Dictionaries.
+ "name" - String, component name
+ "parts" - Array of Dictionaries {"files", "copyright", "license"} describing subsections of the component
+ </description>
+ </method>
+ <method name="get_donor_info" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Returns a Dictionary of Arrays of donor names.
+ {"platinum_sponsors", "gold_sponsors", "mini_sponsors", "gold_donors", "silver_donors", "bronze_donors"}
+ </description>
+ </method>
<method name="get_frames_drawn">
<return type="int">
</return>
@@ -25,6 +53,20 @@
Returns the frames per second of the running game.
</description>
</method>
+ <method name="get_license_info" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ Returns Dictionary of licenses used by Godot and included third party components.
+ </description>
+ </method>
+ <method name="get_license_text" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns Godot license text.
+ </description>
+ </method>
<method name="get_main_loop" qualifiers="const">
<return type="MainLoop">
</return>
@@ -45,10 +87,9 @@
</return>
<description>
Returns the current engine version information in a Dictionary.
-
- "major" - Holds the major version number as a String
- "minor" - Holds the minor version number as a String
- "patch" - Holds the patch version number as a String
+ "major" - Holds the major version number as an int
+ "minor" - Holds the minor version number as an int
+ "patch" - Holds the patch version number as an int
"status" - Holds the status (e.g. "beta", "rc1", "rc2", ... "stable") as a String
"build" - Holds the build name (e.g. "custom-build") as a String
"string" - major + minor + patch + status + build in a single String
@@ -77,6 +118,8 @@
<member name="iterations_per_second" type="int" setter="set_iterations_per_second" getter="get_iterations_per_second">
The number of fixed iterations per second (for fixed process and physics).
</member>
+ <member name="physics_jitter_fix" type="float" setter="set_physics_jitter_fix" getter="get_physics_jitter_fix">
+ </member>
<member name="target_fps" type="int" setter="set_target_fps" getter="get_target_fps">
The desired frames per second. If the hardware cannot keep up, this setting may not be respected. Defaults to 0, which indicates no limit.
</member>
diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml
index db87720e30..cd2584ed43 100644
--- a/doc/classes/Environment.xml
+++ b/doc/classes/Environment.xml
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Environment" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Environment" inherits="Resource" category="Core" version="3.1">
<brief_description>
Resource for environment nodes (like [WorldEnvironment]) that define multiple rendering options.
</brief_description>
<description>
- Resource for environment nodes (like [WorldEnvironment]) that define multiple environment operations (such as background [Sky] or [Color], ambient light, fog, depth-of-field...). These parameters affect the final render of the scene. The order of these operations is:
- - DOF Blur
+ Resource for environment nodes (like [WorldEnvironment]) that define multiple environment operations (such as background [Sky] or [Color], ambient light, fog, depth-of-field...). These parameters affect the final render of the scene. The order of these operations is:
+
+ - DOF Blur
- Motion Blur
- Bloom
- Tonemap (auto exposure)
- Adjustments
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/environment_and_post_processing.html
- http://docs.godotengine.org/en/3.0/tutorials/3d/high_dynamic_range.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/environment_and_post_processing.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/high_dynamic_range.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index 4074c236eb..20054ac9dc 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="File" inherits="Reference" category="Core" version="3.1-dev">
+<class name="File" inherits="Reference" category="Core" version="3.1">
<brief_description>
Type to handle file reading and writing operations.
</brief_description>
@@ -9,20 +9,20 @@
[codeblock]
func save(content):
var file = File.new()
- file.open("user://save_game.dat", file.WRITE)
+ file.open("user://save_game.dat", File.WRITE)
file.store_string(content)
file.close()
func load():
var file = File.new()
- file.open("user://save_game.dat", file.READ)
+ file.open("user://save_game.dat", File.READ)
var content = file.get_as_text()
file.close()
return content
[/codeblock]
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/step_by_step/filesystem.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/step_by_step/filesystem.html</link>
</tutorials>
<demos>
</demos>
@@ -163,6 +163,20 @@
Returns a [String] saved in Pascal format from the file.
</description>
</method>
+ <method name="get_path" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the path as a [String] for the current open file.
+ </description>
+ </method>
+ <method name="get_path_absolute" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the absolute path as a [String] for the current open file.
+ </description>
+ </method>
<method name="get_position" qualifiers="const">
<return type="int">
</return>
diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml
index 50deecee72..247228d265 100644
--- a/doc/classes/FileDialog.xml
+++ b/doc/classes/FileDialog.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="FileDialog" inherits="ConfirmationDialog" category="Core" version="3.1-dev">
+<class name="FileDialog" inherits="ConfirmationDialog" category="Core" version="3.1">
<brief_description>
Dialog for selecting files or directories in the filesystem.
</brief_description>
@@ -33,6 +33,12 @@
<description>
</description>
</method>
+ <method name="get_line_edit">
+ <return type="LineEdit">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_vbox">
<return type="VBoxContainer">
</return>
diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml
index a6ab2e3a77..3e47b167ef 100644
--- a/doc/classes/Font.xml
+++ b/doc/classes/Font.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Font" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Font" inherits="Resource" category="Core" version="3.1">
<brief_description>
Internationalized font and text drawing support.
</brief_description>
@@ -24,6 +24,8 @@
</argument>
<argument index="4" name="clip_w" type="int" default="-1">
</argument>
+ <argument index="5" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 1 )">
+ </argument>
<description>
Draw "string" into a canvas item using the font at a given position, with "modulate" color, and optionally clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
</description>
@@ -41,6 +43,8 @@
</argument>
<argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
+ <argument index="5" name="outline" type="bool" default="false">
+ </argument>
<description>
Draw character "char" into a canvas item using the font at a given position, with "modulate" color, and optionally kerning if "next" is passed. clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character.
</description>
@@ -75,6 +79,12 @@
Return the size of a string, taking kerning and advance into account.
</description>
</method>
+ <method name="has_outline" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="is_distance_field_hint" qualifiers="const">
<return type="bool">
</return>
diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml
index ff37408dcd..02b9dcfd88 100644
--- a/doc/classes/FuncRef.xml
+++ b/doc/classes/FuncRef.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="FuncRef" inherits="Reference" category="Core" version="3.1-dev">
+<class name="FuncRef" inherits="Reference" category="Core" version="3.1">
<brief_description>
Reference to a function in an object.
</brief_description>
diff --git a/doc/classes/GIProbe.xml b/doc/classes/GIProbe.xml
index ffe01c37af..77dea73564 100644
--- a/doc/classes/GIProbe.xml
+++ b/doc/classes/GIProbe.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GIProbe" inherits="VisualInstance" category="Core" version="3.1-dev">
+<class name="GIProbe" inherits="VisualInstance" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/gi_probes.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/gi_probes.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/GIProbeData.xml b/doc/classes/GIProbeData.xml
index 97193600aa..b2186d7647 100644
--- a/doc/classes/GIProbeData.xml
+++ b/doc/classes/GIProbeData.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GIProbeData" inherits="Resource" category="Core" version="3.1-dev">
+<class name="GIProbeData" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Generic6DOFJoint.xml b/doc/classes/Generic6DOFJoint.xml
index ffcc6e2a0c..0863ead4ec 100644
--- a/doc/classes/Generic6DOFJoint.xml
+++ b/doc/classes/Generic6DOFJoint.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Generic6DOFJoint" inherits="Joint" category="Core" version="3.1-dev">
+<class name="Generic6DOFJoint" inherits="Joint" category="Core" version="3.1">
<brief_description>
The generic 6 degrees of freedom joint can implement a variety of joint-types by locking certain axes' rotation or translation.
</brief_description>
<description>
- The first 3 dof axes are linear axes, which represent translation of Bodies, and the latter 3 dof axes represent the angular motion. Each axis can be either locked, or limited.
+ The first 3 DOF axes are linear axes, which represent translation of Bodies, and the latter 3 DOF axes represent the angular motion. Each axis can be either locked, or limited.
</description>
<tutorials>
</tutorials>
@@ -18,7 +18,7 @@
The lower, the longer an impulse from one side takes to travel to the other side.
</member>
<member name="angular_limit_x/enabled" type="bool" setter="set_flag_x" getter="get_flag_x">
- If [code]true[/code] rotation across the x-axis is enabled.
+ If [code]true[/code] rotation across the x-axis is limited.
</member>
<member name="angular_limit_x/erp" type="float" setter="set_param_x" getter="get_param_x">
When rotating across x-axis, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
@@ -42,7 +42,7 @@
The amount of rotational damping across the y-axis. The lower, the more dampening occurs.
</member>
<member name="angular_limit_y/enabled" type="bool" setter="set_flag_y" getter="get_flag_y">
- If [code]true[/code] rotation across the y-axis is enabled.
+ If [code]true[/code] rotation across the y-axis is limited.
</member>
<member name="angular_limit_y/erp" type="float" setter="set_param_y" getter="get_param_y">
When rotating across y-axis, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
@@ -66,7 +66,7 @@
The amount of rotational damping across the z-axis. The lower, the more dampening occurs.
</member>
<member name="angular_limit_z/enabled" type="bool" setter="set_flag_z" getter="get_flag_z">
- If [code]true[/code] rotation across the z-axis is enabled.
+ If [code]true[/code] rotation across the z-axis is limited.
</member>
<member name="angular_limit_z/erp" type="float" setter="set_param_z" getter="get_param_z">
When rotating across z-axis, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
@@ -117,7 +117,7 @@
The amount of damping that happens at the x-motion.
</member>
<member name="linear_limit_x/enabled" type="bool" setter="set_flag_x" getter="get_flag_x">
- If [code]true[/code] the linear motion across the x-axis is enabled.
+ If [code]true[/code] the linear motion across the x-axis is limited.
</member>
<member name="linear_limit_x/lower_distance" type="float" setter="set_param_x" getter="get_param_x">
The minimum difference between the pivot points' x-axis.
@@ -135,7 +135,7 @@
The amount of damping that happens at the y-motion.
</member>
<member name="linear_limit_y/enabled" type="bool" setter="set_flag_y" getter="get_flag_y">
- If [code]true[/code] the linear motion across the y-axis is enabled.
+ If [code]true[/code] the linear motion across the y-axis is limited.
</member>
<member name="linear_limit_y/lower_distance" type="float" setter="set_param_y" getter="get_param_y">
The minimum difference between the pivot points' y-axis.
@@ -153,7 +153,7 @@
The amount of damping that happens at the z-motion.
</member>
<member name="linear_limit_z/enabled" type="bool" setter="set_flag_z" getter="get_flag_z">
- If [code]true[/code] the linear motion across the z-axis is enabled.
+ If [code]true[/code] the linear motion across the z-axis is limited.
</member>
<member name="linear_limit_z/lower_distance" type="float" setter="set_param_z" getter="get_param_z">
The minimum difference between the pivot points' z-axis.
@@ -167,6 +167,33 @@
<member name="linear_limit_z/upper_distance" type="float" setter="set_param_z" getter="get_param_z">
The maximum difference between the pivot points' z-axis.
</member>
+ <member name="linear_motor_x/enabled" type="bool" setter="set_flag_x" getter="get_flag_x">
+ If [code]true[/code] then there is a linear motor on the x-axis. It will attempt to reach the target velocity while staying within the force limits.
+ </member>
+ <member name="linear_motor_x/force_limit" type="float" setter="set_param_x" getter="get_param_x">
+ The maximum force the linear motor can apply on the x-axis while trying to reach the target velocity.
+ </member>
+ <member name="linear_motor_x/target_velocity" type="float" setter="set_param_x" getter="get_param_x">
+ The speed that the linear motor will attempt to reach on the x-axis.
+ </member>
+ <member name="linear_motor_y/enabled" type="bool" setter="set_flag_y" getter="get_flag_y">
+ If [code]true[/code] then there is a linear motor on the y-axis. It will attempt to reach the target velocity while staying within the force limits.
+ </member>
+ <member name="linear_motor_y/force_limit" type="float" setter="set_param_y" getter="get_param_y">
+ The maximum force the linear motor can apply on the y-axis while trying to reach the target velocity.
+ </member>
+ <member name="linear_motor_y/target_velocity" type="float" setter="set_param_y" getter="get_param_y">
+ The speed that the linear motor will attempt to reach on the y-axis.
+ </member>
+ <member name="linear_motor_z/enabled" type="bool" setter="set_flag_z" getter="get_flag_z">
+ If [code]true[/code] then there is a linear motor on the z-axis. It will attempt to reach the target velocity while staying within the force limits.
+ </member>
+ <member name="linear_motor_z/force_limit" type="float" setter="set_param_z" getter="get_param_z">
+ The maximum force the linear motor can apply on the z-axis while trying to reach the target velocity.
+ </member>
+ <member name="linear_motor_z/target_velocity" type="float" setter="set_param_z" getter="get_param_z">
+ The speed that the linear motor will attempt to reach on the z-axis.
+ </member>
</members>
<constants>
<constant name="PARAM_LINEAR_LOWER_LIMIT" value="0" enum="Param">
@@ -184,34 +211,40 @@
<constant name="PARAM_LINEAR_DAMPING" value="4" enum="Param">
The amount of damping that happens at the linear motion across the axes.
</constant>
- <constant name="PARAM_ANGULAR_LOWER_LIMIT" value="5" enum="Param">
+ <constant name="PARAM_LINEAR_MOTOR_TARGET_VELOCITY" value="5" enum="Param">
+ The velocity the linear motor will try to reach.
+ </constant>
+ <constant name="PARAM_LINEAR_MOTOR_FORCE_LIMIT" value="6" enum="Param">
+ The maximum force the linear motor will apply while trying to reach the velocity target.
+ </constant>
+ <constant name="PARAM_ANGULAR_LOWER_LIMIT" value="7" enum="Param">
The minimum rotation in negative direction to break loose and rotate around the axes.
</constant>
- <constant name="PARAM_ANGULAR_UPPER_LIMIT" value="6" enum="Param">
+ <constant name="PARAM_ANGULAR_UPPER_LIMIT" value="8" enum="Param">
The minimum rotation in positive direction to break loose and rotate around the axes.
</constant>
- <constant name="PARAM_ANGULAR_LIMIT_SOFTNESS" value="7" enum="Param">
+ <constant name="PARAM_ANGULAR_LIMIT_SOFTNESS" value="9" enum="Param">
The speed of all rotations across the axes.
</constant>
- <constant name="PARAM_ANGULAR_DAMPING" value="8" enum="Param">
+ <constant name="PARAM_ANGULAR_DAMPING" value="10" enum="Param">
The amount of rotational damping across the axes. The lower, the more dampening occurs.
</constant>
- <constant name="PARAM_ANGULAR_RESTITUTION" value="9" enum="Param">
+ <constant name="PARAM_ANGULAR_RESTITUTION" value="11" enum="Param">
The amount of rotational restitution across the axes. The lower, the more restitution occurs.
</constant>
- <constant name="PARAM_ANGULAR_FORCE_LIMIT" value="10" enum="Param">
+ <constant name="PARAM_ANGULAR_FORCE_LIMIT" value="12" enum="Param">
The maximum amount of force that can occur, when rotating around the axes.
</constant>
- <constant name="PARAM_ANGULAR_ERP" value="11" enum="Param">
+ <constant name="PARAM_ANGULAR_ERP" value="13" enum="Param">
When rotating across the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
</constant>
- <constant name="PARAM_ANGULAR_MOTOR_TARGET_VELOCITY" value="12" enum="Param">
+ <constant name="PARAM_ANGULAR_MOTOR_TARGET_VELOCITY" value="14" enum="Param">
Target speed for the motor at the axes.
</constant>
- <constant name="PARAM_ANGULAR_MOTOR_FORCE_LIMIT" value="13" enum="Param">
+ <constant name="PARAM_ANGULAR_MOTOR_FORCE_LIMIT" value="15" enum="Param">
Maximum acceleration for the motor at the axes.
</constant>
- <constant name="PARAM_MAX" value="14" enum="Param">
+ <constant name="PARAM_MAX" value="16" enum="Param">
End flag of PARAM_* constants, used internally.
</constant>
<constant name="FLAG_ENABLE_LINEAR_LIMIT" value="0" enum="Flag">
@@ -223,7 +256,9 @@
<constant name="FLAG_ENABLE_MOTOR" value="2" enum="Flag">
If [code]set[/code] there is a rotational motor across these axes.
</constant>
- <constant name="FLAG_MAX" value="3" enum="Flag">
+ <constant name="FLAG_ENABLE_LINEAR_MOTOR" value="3" enum="Flag">
+ </constant>
+ <constant name="FLAG_MAX" value="4" enum="Flag">
End flag of FLAG_* constants, used internally.
</constant>
</constants>
diff --git a/doc/classes/Geometry.xml b/doc/classes/Geometry.xml
index ad30829b5d..ea2e2f7595 100644
--- a/doc/classes/Geometry.xml
+++ b/doc/classes/Geometry.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Geometry" inherits="Object" category="Core" version="3.1-dev">
+<class name="Geometry" inherits="Object" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
@@ -160,6 +160,21 @@
<description>
</description>
</method>
+ <method name="line_intersects_line_2d">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="from_a" type="Vector2">
+ </argument>
+ <argument index="1" name="dir_a" type="Vector2">
+ </argument>
+ <argument index="2" name="from_b" type="Vector2">
+ </argument>
+ <argument index="3" name="dir_b" type="Vector2">
+ </argument>
+ <description>
+ Checks if the two lines ([code]from_a[/code], [code]dir_a[/code]) and ([code]from_b[/code], [code]dir_b[/code]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns an empty [Variant]. Note that the lines are specified using direction vectors, not end points.
+ </description>
+ </method>
<method name="make_atlas">
<return type="Dictionary">
</return>
diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance.xml
index 3575754d51..aea1882dae 100644
--- a/doc/classes/GeometryInstance.xml
+++ b/doc/classes/GeometryInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GeometryInstance" inherits="VisualInstance" category="Core" version="3.1-dev">
+<class name="GeometryInstance" inherits="VisualInstance" category="Core" version="3.1">
<brief_description>
Base node for geometry based visual instances.
</brief_description>
diff --git a/doc/classes/Gradient.xml b/doc/classes/Gradient.xml
index 2a7e6e1de2..df4a507b65 100644
--- a/doc/classes/Gradient.xml
+++ b/doc/classes/Gradient.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Gradient" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Gradient" inherits="Resource" category="Core" version="3.1">
<brief_description>
Color interpolator node.
</brief_description>
diff --git a/doc/classes/GradientTexture.xml b/doc/classes/GradientTexture.xml
index 483dee92b6..9d2465e23d 100644
--- a/doc/classes/GradientTexture.xml
+++ b/doc/classes/GradientTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GradientTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="GradientTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
Gradient filled texture.
</brief_description>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index dde00f85da..605efd9114 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GraphEdit" inherits="Control" category="Core" version="3.1-dev">
+<class name="GraphEdit" inherits="Control" category="Core" version="3.1">
<brief_description>
GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them.
</brief_description>
@@ -228,6 +228,7 @@
<argument index="0" name="node" type="Object">
</argument>
<description>
+ Emitted when a GraphNode is selected.
</description>
</signal>
<signal name="popup_request">
diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml
index 6b581771e0..4c39720d69 100644
--- a/doc/classes/GraphNode.xml
+++ b/doc/classes/GraphNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GraphNode" inherits="Container" category="Core" version="3.1-dev">
+<class name="GraphNode" inherits="Container" category="Core" version="3.1">
<brief_description>
A GraphNode is a container with several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
</brief_description>
diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml
index 414b7c27e7..8a8a9a2d24 100644
--- a/doc/classes/GridContainer.xml
+++ b/doc/classes/GridContainer.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GridContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="GridContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
- Grid container used to arrange elements in a grid like layout
+ Grid container used to arrange elements in a grid like layout.
</brief_description>
<description>
Grid container will arrange its children in a grid like structure, the grid columns are specified using the [method set_columns] method and the number of rows will be equal to the number of children in the container divided by the number of columns, for example: if the container has 5 children, and 2 columns, there will be 3 rows in the container. Notice that grid layout will preserve the columns and rows for every size of the container.
@@ -11,6 +11,16 @@
<demos>
</demos>
<methods>
+ <method name="get_child_control_at_cell">
+ <return type="Control">
+ </return>
+ <argument index="0" name="row" type="int">
+ </argument>
+ <argument index="1" name="column" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="columns" type="int" setter="set_columns" getter="get_columns">
diff --git a/doc/classes/GrooveJoint2D.xml b/doc/classes/GrooveJoint2D.xml
index 30497d243e..a15c658f78 100644
--- a/doc/classes/GrooveJoint2D.xml
+++ b/doc/classes/GrooveJoint2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GrooveJoint2D" inherits="Joint2D" category="Core" version="3.1-dev">
+<class name="GrooveJoint2D" inherits="Joint2D" category="Core" version="3.1">
<brief_description>
Groove constraint for 2D physics.
</brief_description>
diff --git a/doc/classes/HBoxContainer.xml b/doc/classes/HBoxContainer.xml
index 7c73583d58..9c86f17ef1 100644
--- a/doc/classes/HBoxContainer.xml
+++ b/doc/classes/HBoxContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HBoxContainer" inherits="BoxContainer" category="Core" version="3.1-dev">
+<class name="HBoxContainer" inherits="BoxContainer" category="Core" version="3.1">
<brief_description>
Horizontal box container.
</brief_description>
diff --git a/doc/classes/HScrollBar.xml b/doc/classes/HScrollBar.xml
index 20edc86747..61759c4f94 100644
--- a/doc/classes/HScrollBar.xml
+++ b/doc/classes/HScrollBar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HScrollBar" inherits="ScrollBar" category="Core" version="3.1-dev">
+<class name="HScrollBar" inherits="ScrollBar" category="Core" version="3.1">
<brief_description>
Horizontal scroll bar.
</brief_description>
diff --git a/doc/classes/HSeparator.xml b/doc/classes/HSeparator.xml
index e410aa4d86..1a9cf25857 100644
--- a/doc/classes/HSeparator.xml
+++ b/doc/classes/HSeparator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HSeparator" inherits="Separator" category="Core" version="3.1-dev">
+<class name="HSeparator" inherits="Separator" category="Core" version="3.1">
<brief_description>
Horizontal separator.
</brief_description>
diff --git a/doc/classes/HSlider.xml b/doc/classes/HSlider.xml
index 70070d612b..6d5acded3c 100644
--- a/doc/classes/HSlider.xml
+++ b/doc/classes/HSlider.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HSlider" inherits="Slider" category="Core" version="3.1-dev">
+<class name="HSlider" inherits="Slider" category="Core" version="3.1">
<brief_description>
Horizontal slider.
</brief_description>
diff --git a/doc/classes/HSplitContainer.xml b/doc/classes/HSplitContainer.xml
index 7adf7d9d19..45b99c85a6 100644
--- a/doc/classes/HSplitContainer.xml
+++ b/doc/classes/HSplitContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HSplitContainer" inherits="SplitContainer" category="Core" version="3.1-dev">
+<class name="HSplitContainer" inherits="SplitContainer" category="Core" version="3.1">
<brief_description>
Horizontal split container.
</brief_description>
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index 2dcfb6c7d9..08e2f649a0 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HTTPClient" inherits="Reference" category="Core" version="3.1-dev">
+<class name="HTTPClient" inherits="Reference" category="Core" version="3.1">
<brief_description>
Hyper-text transfer protocol client.
</brief_description>
@@ -10,8 +10,8 @@
For more information on HTTP, see https://developer.mozilla.org/en-US/docs/Web/HTTP (or read RFC 2616 to get it straight from the source: https://tools.ietf.org/html/rfc2616).
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/networking/http_client_class.html
- http://docs.godotengine.org/en/3.0/tutorials/networking/ssl_certificates.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/networking/http_client_class.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/networking/ssl_certificates.html</link>
</tutorials>
<demos>
</demos>
@@ -111,6 +111,12 @@
String queryString = httpClient.query_string_from_dict(fields)
returns:= "username=user&amp;password=pass"
[/codeblock]
+ Furthermore, if a key has a null value, only the key itself is added, without equal sign and value. If the value is an array, for each value in it a pair with the same key is added.
+ [codeblock]
+ var fields = {"single": 123, "not_valued": null, "multiple": [22, 33, 44]}
+ String queryString = httpClient.query_string_from_dict(fields)
+ returns:= "single=123&amp;not_valued&amp;multiple=22&amp;multiple=33&amp;multiple=44"
+ [/codeblock]
</description>
</method>
<method name="read_response_body_chunk">
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index a6fd229ac9..c5bb10a23a 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HTTPRequest" inherits="Node" category="Core" version="3.1-dev">
+<class name="HTTPRequest" inherits="Node" category="Core" version="3.1">
<brief_description>
A node with the ability to send HTTP requests.
</brief_description>
@@ -8,7 +8,7 @@
Can be used to make HTTP requests, i.e. download or upload files or web content via HTTP.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/networking/ssl_certificates.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/networking/ssl_certificates.html</link>
</tutorials>
<demos>
</demos>
@@ -55,6 +55,8 @@
<argument index="4" name="request_data" type="String" default="&quot;&quot;">
</argument>
<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 [code]OK[/code] if request is successfully created. (Does not imply that the server has responded), [code]ERR_UNCONFIGURED[/code] if not in the tree, [code]ERR_BUSY[/code] if still processing previous request, [code]ERR_INVALID_PARAMETER[/code] if given string is not a valid URL format, or [code]ERR_CANT_CONNECT[/code] if not using thread and the [HTTPClient] cannot connect to host.
</description>
</method>
</methods>
diff --git a/doc/classes/HingeJoint.xml b/doc/classes/HingeJoint.xml
index 01e88f1de6..3c5719056b 100644
--- a/doc/classes/HingeJoint.xml
+++ b/doc/classes/HingeJoint.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HingeJoint" inherits="Joint" category="Core" version="3.1-dev">
+<class name="HingeJoint" inherits="Joint" category="Core" version="3.1">
<brief_description>
A hinge between two 3D bodies.
</brief_description>
diff --git a/doc/classes/IP.xml b/doc/classes/IP.xml
index c8f2d3970b..bcb15e44fc 100644
--- a/doc/classes/IP.xml
+++ b/doc/classes/IP.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="IP" inherits="Object" category="Core" version="3.1-dev">
+<class name="IP" inherits="Object" category="Core" version="3.1">
<brief_description>
Internet protocol (IP) support functions like DNS resolution.
</brief_description>
diff --git a/doc/classes/IP_Unix.xml b/doc/classes/IP_Unix.xml
index 7360067ecf..0dd4455562 100644
--- a/doc/classes/IP_Unix.xml
+++ b/doc/classes/IP_Unix.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="IP_Unix" inherits="IP" category="Core" version="3.1-dev">
+<class name="IP_Unix" inherits="IP" category="Core" version="3.1">
<brief_description>
Unix IP support. See [IP].
</brief_description>
diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml
index c4e0d55010..9fc7672a80 100644
--- a/doc/classes/Image.xml
+++ b/doc/classes/Image.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Image" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Image" inherits="Resource" category="Core" version="3.1">
<brief_description>
Image datatype.
</brief_description>
@@ -67,6 +67,14 @@
Blits [code]src_rect[/code] area from [code]src[/code] image to this image at the coordinates given by [code]dst[/code]. [code]src[/code] pixel is copied onto [code]dst[/code] if the corresponding [code]mask[/code] pixel's alpha value is not 0. [code]src[/code] image and [code]mask[/code] image [b]must[/b] have the same size (width and height) but they can have different formats.
</description>
</method>
+ <method name="bumpmap_to_normalmap">
+ <return type="void">
+ </return>
+ <argument index="0" name="bump_scale" type="float" default="1.0">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="clear_mipmaps">
<return type="void">
</return>
@@ -202,6 +210,8 @@
<method name="generate_mipmaps">
<return type="int" enum="Error">
</return>
+ <argument index="0" name="renormalize" type="bool" default="false">
+ </argument>
<description>
Generates mipmaps for the image. Mipmaps are pre-calculated and lower resolution copies of the image. Mipmaps are automatically used if the image needs to be scaled down when rendered. This improves image quality and the performance of the rendering. Returns an error if the image is compressed, in a custom format or if the image's width/height is 0.
</description>
@@ -247,6 +257,14 @@
Returns the color of the pixel at [code](x, y)[/code] if the image is locked. If the image is unlocked it always returns a [Color] with the value [code](0, 0, 0, 1.0)[/code].
</description>
</method>
+ <method name="get_pixelv" qualifiers="const">
+ <return type="Color">
+ </return>
+ <argument index="0" name="src" type="Vector2">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_rect" qualifiers="const">
<return type="Image">
</return>
@@ -320,6 +338,7 @@
<argument index="0" name="buffer" type="PoolByteArray">
</argument>
<description>
+ Loads an image from the binary contents of a JPEG file.
</description>
</method>
<method name="load_png_from_buffer">
@@ -328,6 +347,7 @@
<argument index="0" name="buffer" type="PoolByteArray">
</argument>
<description>
+ Loads an image from the binary contents of a PNG file.
</description>
</method>
<method name="lock">
@@ -373,6 +393,12 @@
Resizes the image to the nearest power of 2 for the width and height. If [code]square[/code] is [code]true[/code] then set width and height to be the same.
</description>
</method>
+ <method name="rgbe_to_srgb">
+ <return type="Image">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="save_png" qualifiers="const">
<return type="int" enum="Error">
</return>
@@ -403,6 +429,16 @@
[/codeblock]
</description>
</method>
+ <method name="set_pixelv">
+ <return type="void">
+ </return>
+ <argument index="0" name="dst" type="Vector2">
+ </argument>
+ <argument index="1" name="color" type="Color">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="shrink_x2">
<return type="void">
</return>
@@ -436,74 +472,109 @@
<constant name="FORMAT_LA8" value="1" enum="Format">
</constant>
<constant name="FORMAT_R8" value="2" enum="Format">
+ OpenGL texture format RED with a single component and a bitdepth of 8.
</constant>
<constant name="FORMAT_RG8" value="3" enum="Format">
+ OpenGL texture format RG with two components and a bitdepth of 8 for each.
</constant>
<constant name="FORMAT_RGB8" value="4" enum="Format">
+ OpenGL texture format RGB with three components, each with a bitdepth of 8.
</constant>
<constant name="FORMAT_RGBA8" value="5" enum="Format">
+ OpenGL texture format RGBA with four components, each with a bitdepth of 8.
</constant>
<constant name="FORMAT_RGBA4444" value="6" enum="Format">
+ OpenGL texture format RGBA with four components, each with a bitdepth of 4.
</constant>
<constant name="FORMAT_RGBA5551" value="7" enum="Format">
+ OpenGL texture format GL_RGB5_A1 where 5 bits of depth for each component of RGB and one bit for alpha.
</constant>
<constant name="FORMAT_RF" value="8" enum="Format">
+ OpenGL texture format GL_R32F where there's one component, a 32-bit floating-point value.
</constant>
<constant name="FORMAT_RGF" value="9" enum="Format">
+ OpenGL texture format GL_RG32F where there are two components, each a 32-bit floating-point values.
</constant>
<constant name="FORMAT_RGBF" value="10" enum="Format">
+ OpenGL texture format GL_RGB32F where there are three components, each a 32-bit floating-point values.
</constant>
<constant name="FORMAT_RGBAF" value="11" enum="Format">
+ OpenGL texture format GL_RGBA32F where there are four components, each a 32-bit floating-point values.
</constant>
<constant name="FORMAT_RH" value="12" enum="Format">
+ OpenGL texture format GL_R32F where there's one component, a 16-bit "half-precision" floating-point value.
</constant>
<constant name="FORMAT_RGH" value="13" enum="Format">
+ OpenGL texture format GL_RG32F where there's two components, each a 16-bit "half-precision" floating-point value.
</constant>
<constant name="FORMAT_RGBH" value="14" enum="Format">
+ OpenGL texture format GL_RGB32F where there's three components, each a 16-bit "half-precision" floating-point value.
</constant>
<constant name="FORMAT_RGBAH" value="15" enum="Format">
+ OpenGL texture format GL_RGBA32F where there's four components, each a 16-bit "half-precision" floating-point value.
</constant>
<constant name="FORMAT_RGBE9995" value="16" enum="Format">
+ A special OpenGL texture format where the three color components have 9 bits of precision and all three share a single exponent.
</constant>
<constant name="FORMAT_DXT1" value="17" enum="Format">
+ The S3TC texture format that uses Block Compression 1, and is the smallest variation of S3TC, only providing 1 bit of alpha and color data being premultiplied with alpha. More information can be found at https://www.khronos.org/opengl/wiki/S3_Texture_Compression.
</constant>
<constant name="FORMAT_DXT3" value="18" enum="Format">
+ The S3TC texture format that uses Block Compression 2, and color data is interpreted as not having been premultiplied by alpha. Well suited for images with sharp alpha transitions between translucent and opaque areas.
</constant>
<constant name="FORMAT_DXT5" value="19" enum="Format">
+ The S3TC texture format also known as Block Compression 3 or BC3 that contains 64 bits of alpha channel data followed by 64 bits of DXT1-encoded color data. Color data is not premultiplied by alpha, same as DXT3. DXT5 generally produces superior results for transparency gradients than DXT3.
</constant>
<constant name="FORMAT_RGTC_R" value="20" enum="Format">
+ Texture format that uses Red Green Texture Compression, normalizing the red channel data using the same compression algorithm that DXT5 uses for the alpha channel. More information can be found here https://www.khronos.org/opengl/wiki/Red_Green_Texture_Compression.
</constant>
<constant name="FORMAT_RGTC_RG" value="21" enum="Format">
+ Texture format that uses Red Green Texture Compression, normalizing the red and green channel data using the same compression algorithm that DXT5 uses for the alpha channel.
</constant>
<constant name="FORMAT_BPTC_RGBA" value="22" enum="Format">
+ Texture format that uses BPTC compression with unsigned normalized RGBA components. More information can be found at https://www.khronos.org/opengl/wiki/BPTC_Texture_Compression.
</constant>
<constant name="FORMAT_BPTC_RGBF" value="23" enum="Format">
+ Texture format that uses BPTC compression with signed floating-point RGB components.
</constant>
<constant name="FORMAT_BPTC_RGBFU" value="24" enum="Format">
+ Texture format that uses BPTC compression with unsigned floating-point RGB components.
</constant>
<constant name="FORMAT_PVRTC2" value="25" enum="Format">
+ Texture format used on PowerVR-supported mobile platforms, uses 2 bit color depth with no alpha. More information on PVRTC can be found here https://en.wikipedia.org/wiki/PVRTC.
</constant>
<constant name="FORMAT_PVRTC2A" value="26" enum="Format">
+ Same as PVRTC2, but with an alpha component.
</constant>
<constant name="FORMAT_PVRTC4" value="27" enum="Format">
+ Similar to PVRTC2, but with 4 bit color depth and no alpha.
</constant>
<constant name="FORMAT_PVRTC4A" value="28" enum="Format">
+ Same as PVRTC4, but with an alpha component.
</constant>
<constant name="FORMAT_ETC" value="29" enum="Format">
+ Ericsson Texture Compression format, also referred to as 'ETC1', and is part of the OpenGL ES graphics standard. An overview of the format is given at https://en.wikipedia.org/wiki/Ericsson_Texture_Compression#ETC1.
</constant>
<constant name="FORMAT_ETC2_R11" value="30" enum="Format">
+ Ericsson Texture Compression format 2 variant R11_EAC, which provides one channel of unsigned data.
</constant>
<constant name="FORMAT_ETC2_R11S" value="31" enum="Format">
+ Ericsson Texture Compression format 2 variant SIGNED_R11_EAC, which provides one channel of signed data.
</constant>
<constant name="FORMAT_ETC2_RG11" value="32" enum="Format">
+ Ericsson Texture Compression format 2 variant RG11_EAC, which provides two channels of unsigned data.
</constant>
<constant name="FORMAT_ETC2_RG11S" value="33" enum="Format">
+ Ericsson Texture Compression format 2 variant SIGNED_RG11_EAC, which provides two channels of signed data.
</constant>
<constant name="FORMAT_ETC2_RGB8" value="34" enum="Format">
+ Ericsson Texture Compression format 2 variant RGB8, which is a followup of ETC1 and compresses RGB888 data.
</constant>
<constant name="FORMAT_ETC2_RGBA8" value="35" enum="Format">
+ Ericsson Texture Compression format 2 variant RGBA8, which compresses RGBA8888 data with full alpha support.
</constant>
<constant name="FORMAT_ETC2_RGB8A1" value="36" enum="Format">
+ Ericsson Texture Compression format 2 variant RGB8_PUNCHTHROUGH_ALPHA1, which compresses RGBA data to make alpha either fully transparent or fully opaque.
</constant>
<constant name="FORMAT_MAX" value="37" enum="Format">
</constant>
diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml
index f7f211861d..0bff3317db 100644
--- a/doc/classes/ImageTexture.xml
+++ b/doc/classes/ImageTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ImageTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="ImageTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
A [Texture] based on an [Image].
</brief_description>
@@ -47,12 +47,12 @@
</description>
</method>
<method name="load">
- <return type="void">
+ <return type="int" enum="Error">
</return>
<argument index="0" name="path" type="String">
</argument>
<description>
- Load an [code]ImageTexture[/code].
+ Load an [code]ImageTexture[/code] from a file path.
</description>
</method>
<method name="set_data">
diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry.xml
index 1cb86bc07f..29d05bf877 100644
--- a/doc/classes/ImmediateGeometry.xml
+++ b/doc/classes/ImmediateGeometry.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ImmediateGeometry" inherits="GeometryInstance" category="Core" version="3.1-dev">
+<class name="ImmediateGeometry" inherits="GeometryInstance" category="Core" version="3.1">
<brief_description>
Draws simple geometry from code.
</brief_description>
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index 6ec6f08804..a4346c1485 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Input" inherits="Object" category="Core" version="3.1-dev">
+<class name="Input" inherits="Object" category="Core" version="3.1">
<brief_description>
A Singleton that deals with inputs.
</brief_description>
@@ -7,6 +7,7 @@
A Singleton that deals with inputs. This includes key presses, mouse buttons and movement, joypads, and input actions. Actions and their events can be set in the Project Settings / Input Map tab. Or be set with [InputMap].
</description>
<tutorials>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/index.html</link>
</tutorials>
<demos>
</demos>
@@ -44,7 +45,15 @@
<return type="Vector3">
</return>
<description>
- If the device has an accelerometer, this will return the movement.
+ If the device has an accelerometer, this will return the acceleration. Otherwise, it returns an empty [Vector3].
+ </description>
+ </method>
+ <method name="get_action_strength" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="action" type="String">
+ </argument>
+ <description>
</description>
</method>
<method name="get_connected_joypads">
@@ -58,13 +67,14 @@
<return type="Vector3">
</return>
<description>
+ If the device has an accelerometer, this will return the gravity. Otherwise, it returns an empty [Vector3].
</description>
</method>
<method name="get_gyroscope" qualifiers="const">
<return type="Vector3">
</return>
<description>
- If the device has a gyroscope, this will return the rate of rotation in rad/s around a device's x, y, and z axis.
+ If the device has a gyroscope, this will return the rate of rotation in rad/s around a device's x, y, and z axis. Otherwise, it returns an empty [Vector3].
</description>
</method>
<method name="get_joy_axis" qualifiers="const">
@@ -180,7 +190,8 @@
<argument index="0" name="action" type="String">
</argument>
<description>
- Returns [code]true[/code] when you start pressing the action event.
+ Returns [code]true[/code] when the user starts pressing the action event, meaning it's true only on the frame that the user pressed down the button.
+ This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed.
</description>
</method>
<method name="is_action_just_released" qualifiers="const">
@@ -189,7 +200,7 @@
<argument index="0" name="action" type="String">
</argument>
<description>
- Returns [code]true[/code] when you stop pressing the action event.
+ Returns [code]true[/code] when the user stops pressing the action event, meaning it's true only on the frame that the user released the button.
</description>
</method>
<method name="is_action_pressed" qualifiers="const">
@@ -259,6 +270,7 @@
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
+ Feeds an [InputEvent] to the game. Can be used to artificially trigger input events from code.
</description>
</method>
<method name="remove_joy_mapping">
@@ -280,7 +292,15 @@
<argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
- Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. See enum [code]CURSOR_*[/code] for the list of shapes.
+ Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing [code]null[/code] to the image parameter resets to the system cursor. See enum [code]CURSOR_*[/code] for the list of shapes.
+ </description>
+ </method>
+ <method name="set_default_cursor_shape">
+ <return type="void">
+ </return>
+ <argument index="0" name="shape" type="int" enum="Input.CursorShape" default="0">
+ </argument>
+ <description>
</description>
</method>
<method name="set_mouse_mode">
@@ -329,12 +349,12 @@
</methods>
<signals>
<signal name="joy_connection_changed">
- <argument index="0" name="index" type="int">
+ <argument index="0" name="device" type="int">
</argument>
<argument index="1" name="connected" type="bool">
</argument>
<description>
- Emitted when a joypad device has been connected or disconnected
+ Emitted when a joypad device has been connected or disconnected.
</description>
</signal>
</signals>
@@ -349,40 +369,58 @@
Captures the mouse. The mouse will be hidden and unable to leave the game window. But it will still register movement and mouse button presses.
</constant>
<constant name="MOUSE_MODE_CONFINED" value="3" enum="MouseMode">
+ Makes the mouse cursor visible but confines it to the game window.
</constant>
<constant name="CURSOR_ARROW" value="0" enum="CursorShape">
+ Arrow cursor. Standard, default pointing cursor.
</constant>
<constant name="CURSOR_IBEAM" value="1" enum="CursorShape">
+ I-beam cursor. Usually used to show where the text cursor will appear when the mouse is clicked.
</constant>
<constant name="CURSOR_POINTING_HAND" value="2" enum="CursorShape">
+ Pointing hand cursor. Usually used to indicate the pointer is over a link or other interactable item.
</constant>
<constant name="CURSOR_CROSS" value="3" enum="CursorShape">
+ Cross cursor. Typically appears over regions in which a drawing operation can be performance or for selections.
</constant>
<constant name="CURSOR_WAIT" value="4" enum="CursorShape">
+ Wait cursor. Indicates that the application is busy performing an operation.
</constant>
<constant name="CURSOR_BUSY" value="5" enum="CursorShape">
+ Busy cursor. See [code]CURSOR_WAIT[/code].
</constant>
<constant name="CURSOR_DRAG" value="6" enum="CursorShape">
+ Drag cursor. Usually displayed when dragging something.
</constant>
<constant name="CURSOR_CAN_DROP" value="7" enum="CursorShape">
+ Can drop cursor. Usually displayed when dragging something to indicate that it can be dropped at the current position.
</constant>
<constant name="CURSOR_FORBIDDEN" value="8" enum="CursorShape">
+ Forbidden cursor. Indicates that the current action is forbidden (for example, when dragging something) or that the control at a position is disabled.
</constant>
<constant name="CURSOR_VSIZE" value="9" enum="CursorShape">
+ Vertical resize mouse cursor. A double headed vertical arrow. It tells the user they can resize the window or the panel vertically.
</constant>
<constant name="CURSOR_HSIZE" value="10" enum="CursorShape">
+ Horizontal resize mouse cursor. A double headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.
</constant>
<constant name="CURSOR_BDIAGSIZE" value="11" enum="CursorShape">
+ Window resize mouse cursor. The cursor is a double headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.
</constant>
<constant name="CURSOR_FDIAGSIZE" value="12" enum="CursorShape">
+ Window resize mouse cursor. The cursor is a double headed arrow that goes from the top left to the bottom right, the opposite of [code]CURSOR_BDIAGSIZE[/code]. It tells the user they can resize the window or the panel both horizontally and vertically.
</constant>
<constant name="CURSOR_MOVE" value="13" enum="CursorShape">
+ Move cursor. Indicates that something can be moved.
</constant>
<constant name="CURSOR_VSPLIT" value="14" enum="CursorShape">
+ Vertical split mouse cursor. On Windows, it's the same as [code]CURSOR_VSIZE[/code].
</constant>
<constant name="CURSOR_HSPLIT" value="15" enum="CursorShape">
+ Horizontal split mouse cursor. On Windows, it's the same as [code]CURSOR_HSIZE[/code].
</constant>
<constant name="CURSOR_HELP" value="16" enum="CursorShape">
+ Help cursor. Usually a question mark.
</constant>
</constants>
</class>
diff --git a/doc/classes/InputDefault.xml b/doc/classes/InputDefault.xml
index b82904c023..27bfff2e67 100644
--- a/doc/classes/InputDefault.xml
+++ b/doc/classes/InputDefault.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputDefault" inherits="Input" category="Core" version="3.1-dev">
+<class name="InputDefault" inherits="Input" category="Core" version="3.1">
<brief_description>
Default implementation of the [Input] class.
</brief_description>
diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml
index 41defdcb7f..993d62d188 100644
--- a/doc/classes/InputEvent.xml
+++ b/doc/classes/InputEvent.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEvent" inherits="Resource" category="Core" version="3.1-dev">
+<class name="InputEvent" inherits="Resource" category="Core" version="3.1">
<brief_description>
Generic input event
</brief_description>
@@ -7,26 +7,25 @@
Base class of all sort of input event. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
- http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html</link>
</tutorials>
<demos>
</demos>
<methods>
- <method name="action_match" qualifiers="const">
- <return type="bool">
+ <method name="as_text" qualifiers="const">
+ <return type="String">
</return>
- <argument index="0" name="event" type="InputEvent">
- </argument>
<description>
- Returns [code]true[/code] if this event matches [code]event[/code].
+ Returns a [String] representation of the event.
</description>
</method>
- <method name="as_text" qualifiers="const">
- <return type="String">
+ <method name="get_action_strength" qualifiers="const">
+ <return type="float">
</return>
+ <argument index="0" name="action" type="String">
+ </argument>
<description>
- Returns a [String] representation of the event.
</description>
</method>
<method name="is_action" qualifiers="const">
diff --git a/doc/classes/InputEventAction.xml b/doc/classes/InputEventAction.xml
index f0c6cf59be..16000231cb 100644
--- a/doc/classes/InputEventAction.xml
+++ b/doc/classes/InputEventAction.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventAction" inherits="InputEvent" category="Core" version="3.1-dev">
+<class name="InputEventAction" inherits="InputEvent" category="Core" version="3.1">
<brief_description>
Input event type for actions.
</brief_description>
@@ -7,7 +7,7 @@
Contains a generic action which can be targeted from several type of inputs. Actions can be created from the project settings menu [code]Project &gt; Project Settings &gt; Input Map[/code]. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html#actions
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html#actions</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/InputEventGesture.xml b/doc/classes/InputEventGesture.xml
index 20410a8d5e..eb1e613b7c 100644
--- a/doc/classes/InputEventGesture.xml
+++ b/doc/classes/InputEventGesture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventGesture" inherits="InputEventWithModifiers" category="Core" version="3.1-dev">
+<class name="InputEventGesture" inherits="InputEventWithModifiers" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/InputEventJoypadButton.xml b/doc/classes/InputEventJoypadButton.xml
index 2c7c41d9e0..adaeae685e 100644
--- a/doc/classes/InputEventJoypadButton.xml
+++ b/doc/classes/InputEventJoypadButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventJoypadButton" inherits="InputEvent" category="Core" version="3.1-dev">
+<class name="InputEventJoypadButton" inherits="InputEvent" category="Core" version="3.1">
<brief_description>
Input event for gamepad buttons.
</brief_description>
@@ -7,7 +7,7 @@
Input event type for gamepad buttons. For joysticks see [InputEventJoypadMotion].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
@@ -15,7 +15,7 @@
</methods>
<members>
<member name="button_index" type="int" setter="set_button_index" getter="get_button_index">
- Button identifier. One of the [code]JOY_BUTTON_*[/code] constants from [@global Scope].
+ Button identifier. One of the [code]JOY_BUTTON_*[/code] constants from [@GlobalScope].
</member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
If [code]true[/code] the button's state is pressed. If [code]false[/code] the button's state is released.
diff --git a/doc/classes/InputEventJoypadMotion.xml b/doc/classes/InputEventJoypadMotion.xml
index cdcab3fcab..f86aec4ce0 100644
--- a/doc/classes/InputEventJoypadMotion.xml
+++ b/doc/classes/InputEventJoypadMotion.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventJoypadMotion" inherits="InputEvent" category="Core" version="3.1-dev">
+<class name="InputEventJoypadMotion" inherits="InputEvent" category="Core" version="3.1">
<brief_description>
Input event type for gamepad joysticks and other motions. For buttons see [code]InputEventJoypadButton[/code].
</brief_description>
@@ -7,7 +7,7 @@
Stores information about joystick motions. One [code]InputEventJoypadMotion[/code] represents one axis at a time.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
@@ -15,7 +15,7 @@
</methods>
<members>
<member name="axis" type="int" setter="set_axis" getter="get_axis">
- Axis identifier. Use one of the [code]JOY_AXIS_*[/code] constants in [@global Scope].
+ Axis identifier. Use one of the [code]JOY_AXIS_*[/code] constants in [@GlobalScope].
</member>
<member name="axis_value" type="float" setter="set_axis_value" getter="get_axis_value">
Current position of the joystick on the given axis. The value ranges from [code]-1.0[/code] to [code]1.0[/code]. A value of [code]0[/code] means the axis is in its resting position.
diff --git a/doc/classes/InputEventKey.xml b/doc/classes/InputEventKey.xml
index 1cd00e1042..7503e53188 100644
--- a/doc/classes/InputEventKey.xml
+++ b/doc/classes/InputEventKey.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventKey" inherits="InputEventWithModifiers" category="Core" version="3.1-dev">
+<class name="InputEventKey" inherits="InputEventWithModifiers" category="Core" version="3.1">
<brief_description>
Input event type for keyboard events.
</brief_description>
@@ -7,7 +7,7 @@
Stores key presses on the keyboard. Supports key presses, key releases and [member echo] events.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
@@ -27,7 +27,7 @@
If [code]true[/code] the key's state is pressed. If [code]false[/code] the key's state is released.
</member>
<member name="scancode" type="int" setter="set_scancode" getter="get_scancode">
- Key scancode, one of the [code]KEY_*[/code] constants in [@global Scope].
+ Key scancode, one of the [code]KEY_*[/code] constants in [@GlobalScope].
</member>
<member name="unicode" type="int" setter="set_unicode" getter="get_unicode">
Key unicode identifier when relevant.
diff --git a/doc/classes/InputEventMagnifyGesture.xml b/doc/classes/InputEventMagnifyGesture.xml
index 06beaa84f9..e9a0149c56 100644
--- a/doc/classes/InputEventMagnifyGesture.xml
+++ b/doc/classes/InputEventMagnifyGesture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventMagnifyGesture" inherits="InputEventGesture" category="Core" version="3.1-dev">
+<class name="InputEventMagnifyGesture" inherits="InputEventGesture" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/InputEventMouse.xml b/doc/classes/InputEventMouse.xml
index 5d50d32d44..06de96890a 100644
--- a/doc/classes/InputEventMouse.xml
+++ b/doc/classes/InputEventMouse.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventMouse" inherits="InputEventWithModifiers" category="Core" version="3.1-dev">
+<class name="InputEventMouse" inherits="InputEventWithModifiers" category="Core" version="3.1">
<brief_description>
Base input event type for mouse events.
</brief_description>
@@ -7,7 +7,7 @@
Stores general mouse events information.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/InputEventMouseButton.xml b/doc/classes/InputEventMouseButton.xml
index bbdd2aff4e..50641dceed 100644
--- a/doc/classes/InputEventMouseButton.xml
+++ b/doc/classes/InputEventMouseButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventMouseButton" inherits="InputEventMouse" category="Core" version="3.1-dev">
+<class name="InputEventMouseButton" inherits="InputEventMouse" category="Core" version="3.1">
<brief_description>
Input event type for mouse button events.
</brief_description>
@@ -7,7 +7,7 @@
Contains mouse click information. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/mouse_and_input_coordinates.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/mouse_and_input_coordinates.html</link>
</tutorials>
<demos>
</demos>
@@ -21,7 +21,7 @@
If [code]true[/code] the mouse button's state is a double-click. If [code]false[/code] the mouse button's state is released.
</member>
<member name="factor" type="float" setter="set_factor" getter="get_factor">
- TO TALK in PR, reduz said : i think it's used for apple touch but i don't remember what it does
+ Magnitude. Amount (or delta) of the event. Used for scroll events, indicates scroll amount (vertically or horizontally). Only supported on some platforms, sensitivity varies by platform. May be 0 if not supported.
</member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
If [code]true[/code] the mouse button's state is pressed. If [code]false[/code] the mouse button's state is released.
diff --git a/doc/classes/InputEventMouseMotion.xml b/doc/classes/InputEventMouseMotion.xml
index 96160dc699..05e3e79d26 100644
--- a/doc/classes/InputEventMouseMotion.xml
+++ b/doc/classes/InputEventMouseMotion.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventMouseMotion" inherits="InputEventMouse" category="Core" version="3.1-dev">
+<class name="InputEventMouseMotion" inherits="InputEventMouse" category="Core" version="3.1">
<brief_description>
Input event type for mouse motion events.
</brief_description>
@@ -7,7 +7,7 @@
Contains mouse motion information. Supports relative, absolute positions and speed. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/mouse_and_input_coordinates.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/mouse_and_input_coordinates.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/InputEventPanGesture.xml b/doc/classes/InputEventPanGesture.xml
index 06edf36d06..063986ae65 100644
--- a/doc/classes/InputEventPanGesture.xml
+++ b/doc/classes/InputEventPanGesture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventPanGesture" inherits="InputEventGesture" category="Core" version="3.1-dev">
+<class name="InputEventPanGesture" inherits="InputEventGesture" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/InputEventScreenDrag.xml b/doc/classes/InputEventScreenDrag.xml
index fd7ec15acc..f777d90ccb 100644
--- a/doc/classes/InputEventScreenDrag.xml
+++ b/doc/classes/InputEventScreenDrag.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventScreenDrag" inherits="InputEvent" category="Core" version="3.1-dev">
+<class name="InputEventScreenDrag" inherits="InputEvent" category="Core" version="3.1">
<brief_description>
Input event type for screen drag events.
(only available on mobile devices)
@@ -8,7 +8,7 @@
Contains screen drag information. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/InputEventScreenTouch.xml b/doc/classes/InputEventScreenTouch.xml
index 019332ec26..39cd0a9657 100644
--- a/doc/classes/InputEventScreenTouch.xml
+++ b/doc/classes/InputEventScreenTouch.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventScreenTouch" inherits="InputEvent" category="Core" version="3.1-dev">
+<class name="InputEventScreenTouch" inherits="InputEvent" category="Core" version="3.1">
<brief_description>
Input event type for screen touch events.
(only available on mobile devices)
@@ -8,7 +8,7 @@
Stores multi-touch press/release information. Supports touch press, touch release and [member index] for multi-touch count and order.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml
index a31df65ffb..9c1814fedd 100644
--- a/doc/classes/InputEventWithModifiers.xml
+++ b/doc/classes/InputEventWithModifiers.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputEventWithModifiers" inherits="InputEvent" category="Core" version="3.1-dev">
+<class name="InputEventWithModifiers" inherits="InputEvent" category="Core" version="3.1">
<brief_description>
Base class for keys events with modifiers.
</brief_description>
@@ -7,7 +7,7 @@
Contains keys events information with modifiers support like [code]SHIFT[/code] or [code]ALT[/code]. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/InputMap.xml b/doc/classes/InputMap.xml
index c5326c6211..2f5fb49dba 100644
--- a/doc/classes/InputMap.xml
+++ b/doc/classes/InputMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputMap" inherits="Object" category="Core" version="3.1-dev">
+<class name="InputMap" inherits="Object" category="Core" version="3.1">
<brief_description>
Singleton that manages [InputEventAction].
</brief_description>
@@ -7,7 +7,7 @@
Manages all [InputEventAction] which can be created/modified from the project settings menu [code]Project &gt; Project Settings &gt; Input Map[/code] or in code with [method add_action] and [method action_add_event]. See [method Node._input].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html#inputmap
+ <link>http://docs.godotengine.org/en/3.0/tutorials/inputs/inputevent.html#inputmap</link>
</tutorials>
<demos>
</demos>
@@ -34,6 +34,14 @@
Removes an [InputEvent] from an action.
</description>
</method>
+ <method name="action_erase_events">
+ <return type="void">
+ </return>
+ <argument index="0" name="action" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="action_has_event">
<return type="bool">
</return>
@@ -45,13 +53,26 @@
Returns [true] if an action has an [InputEvent] associated with it.
</description>
</method>
+ <method name="action_set_deadzone">
+ <return type="void">
+ </return>
+ <argument index="0" name="deadzone" type="String">
+ </argument>
+ <argument index="1" name="arg1" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="add_action">
<return type="void">
</return>
<argument index="0" name="action" type="String">
</argument>
+ <argument index="1" name="deadzone" type="float" default="0.5">
+ </argument>
<description>
- Adds an (empty) action to the [code]InputMap[/code]. An [InputEvent] can then be added to this action with [method action_add_event].
+ Adds an (empty) action to the [code]InputMap[/code], with a configurable [code]deadzone[/code].
+ An [InputEvent] can then be added to this action with [method action_add_event].
</description>
</method>
<method name="erase_action">
diff --git a/doc/classes/InstancePlaceholder.xml b/doc/classes/InstancePlaceholder.xml
index 834ad7bb11..71c859fd9e 100644
--- a/doc/classes/InstancePlaceholder.xml
+++ b/doc/classes/InstancePlaceholder.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InstancePlaceholder" inherits="Node" category="Core" version="3.1-dev">
+<class name="InstancePlaceholder" inherits="Node" category="Core" version="3.1">
<brief_description>
Placeholder for the root [Node] of a [PackedScene].
</brief_description>
<description>
- Turning on the option [b]Load As Placeholder[/b] for an instanced scene in the editor causes it to be replaced by an InstacePlaceholder when running the game. This makes it possible to delay actually loading the scene until calling [method replace_by_instance]. This is useful to avoid loading large scenes all at once by loading parts of it selectively.
+ Turning on the option [b]Load As Placeholder[/b] for an instanced scene in the editor causes it to be replaced by an InstancePlaceholder when running the game. This makes it possible to delay actually loading the scene until calling [method replace_by_instance]. This is useful to avoid loading large scenes all at once by loading parts of it selectively.
The InstancePlaceholder does not have a transform. This causes any child nodes to be positioned relatively to the Viewport from point (0,0), rather than their parent as displayed in the editor. Replacing the placeholder with a scene with a transform will transform children relatively to their parent again.
</description>
<tutorials>
@@ -12,6 +12,16 @@
<demos>
</demos>
<methods>
+ <method name="create_instance">
+ <return type="Node">
+ </return>
+ <argument index="0" name="replace" type="bool" default="false">
+ </argument>
+ <argument index="1" name="custom_scene" type="PackedScene" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_instance_path" qualifiers="const">
<return type="String">
</return>
diff --git a/doc/classes/InterpolatedCamera.xml b/doc/classes/InterpolatedCamera.xml
index 19252ca5a8..1ac7b5107e 100644
--- a/doc/classes/InterpolatedCamera.xml
+++ b/doc/classes/InterpolatedCamera.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InterpolatedCamera" inherits="Camera" category="Core" version="3.1-dev">
+<class name="InterpolatedCamera" inherits="Camera" category="Core" version="3.1">
<brief_description>
+ Camera which moves toward another node.
</brief_description>
<description>
+ InterpolatedCamera is a [Camera] which smoothly moves to match a target node's position and rotation.
+ If it is not [member enabled] or does not have a valid target set, InterpolatedCamera acts like a normal Camera.
</description>
<tutorials>
</tutorials>
@@ -15,15 +18,19 @@
<argument index="0" name="target" type="Object">
</argument>
<description>
+ Sets the node to move toward and orient with.
</description>
</method>
</methods>
<members>
<member name="enabled" type="bool" setter="set_interpolation_enabled" getter="is_interpolation_enabled">
+ If [code]true[/code] and a target is set, the camera will move automatically.
</member>
<member name="speed" type="float" setter="set_speed" getter="get_speed">
+ How quickly the camera moves toward its target. Higher values will result in tighter camera motion.
</member>
<member name="target" type="NodePath" setter="set_target_path" getter="get_target_path">
+ The target's [NodePath].
</member>
</members>
<constants>
diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml
index 95812ab299..bd1d6be4f5 100644
--- a/doc/classes/ItemList.xml
+++ b/doc/classes/ItemList.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ItemList" inherits="Control" category="Core" version="3.1-dev">
+<class name="ItemList" inherits="Control" category="Core" version="3.1">
<brief_description>
Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns.
</brief_description>
@@ -87,6 +87,15 @@
<description>
</description>
</method>
+ <method name="get_item_icon_modulate" qualifiers="const">
+ <return type="Color">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Returns a [Color] modulating item's icon at the specified index.
+ </description>
+ </method>
<method name="get_item_icon_region" qualifiers="const">
<return type="Rect2">
</return>
@@ -135,6 +144,13 @@
Returns the current vertical scroll bar for the List.
</description>
</method>
+ <method name="is_anything_selected">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if one or more items are selected.
+ </description>
+ </method>
<method name="is_item_disabled" qualifiers="const">
<return type="bool">
</return>
@@ -171,6 +187,17 @@
Returns whether or not item at the specified index is currently selected.
</description>
</method>
+ <method name="move_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="from_idx" type="int">
+ </argument>
+ <argument index="1" name="to_idx" type="int">
+ </argument>
+ <description>
+ Moves item at index [code]from_idx[/code] to [code]to_idx[/code].
+ </description>
+ </method>
<method name="remove_item">
<return type="void">
</return>
@@ -225,6 +252,17 @@
Set (or replace) icon of the item at the specified index.
</description>
</method>
+ <method name="set_item_icon_modulate">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="modulate" type="Color">
+ </argument>
+ <description>
+ Sets a modulating [Color] for item's icon at the specified index.
+ </description>
+ </method>
<method name="set_item_icon_region">
<return type="void">
</return>
@@ -306,6 +344,13 @@
Ensure item at specified index is not selected.
</description>
</method>
+ <method name="unselect_all">
+ <return type="void">
+ </return>
+ <description>
+ Ensure there are no items selected.
+ </description>
+ </method>
</methods>
<members>
<member name="allow_reselect" type="bool" setter="set_allow_reselect" getter="get_allow_reselect">
diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml
index d3c2e7bb2f..fbf9aea7f9 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="Object" category="Core" version="3.1-dev">
+<class name="JSON" inherits="Object" category="Core" version="3.1">
<brief_description>
Helper class for parsing JSON data.
</brief_description>
diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml
index 4f9cdc976d..a9162e2d95 100644
--- a/doc/classes/JSONParseResult.xml
+++ b/doc/classes/JSONParseResult.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JSONParseResult" inherits="Reference" category="Core" version="3.1-dev">
+<class name="JSONParseResult" inherits="Reference" category="Core" version="3.1">
<brief_description>
Data class wrapper for decoded JSON.
</brief_description>
diff --git a/doc/classes/JavaScript.xml b/doc/classes/JavaScript.xml
index 4f37d75038..17588717c2 100644
--- a/doc/classes/JavaScript.xml
+++ b/doc/classes/JavaScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="JavaScript" inherits="Object" category="Core" version="3.1-dev">
+<class name="JavaScript" inherits="Object" category="Core" version="3.1">
<brief_description>
Singleton that connects the engine with the browser's JavaScript context in HTML5 export.
</brief_description>
@@ -7,7 +7,7 @@
The JavaScript singleton is implemented only in HTML5 export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script
+ <link>http://docs.godotengine.org/en/3.0/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Joint.xml b/doc/classes/Joint.xml
index bb7ac74556..8cafdbdbf3 100644
--- a/doc/classes/Joint.xml
+++ b/doc/classes/Joint.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Joint" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Joint" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Base class for all 3D joints
</brief_description>
diff --git a/doc/classes/Joint2D.xml b/doc/classes/Joint2D.xml
index a005e7994a..8247997927 100644
--- a/doc/classes/Joint2D.xml
+++ b/doc/classes/Joint2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Joint2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Joint2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Base node for all joint constraints in 2D physics.
</brief_description>
diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody.xml
index 7ebea43cb9..ae33ed5205 100644
--- a/doc/classes/KinematicBody.xml
+++ b/doc/classes/KinematicBody.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicBody" inherits="PhysicsBody" category="Core" version="3.1-dev">
+<class name="KinematicBody" inherits="PhysicsBody" category="Core" version="3.1">
<brief_description>
Kinematic body 3D node.
</brief_description>
@@ -9,7 +9,7 @@
Kinematic Characters: KinematicBody also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/kinematic_character_2d.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/kinematic_character_2d.html</link>
</tutorials>
<demos>
</demos>
@@ -63,6 +63,8 @@
</return>
<argument index="0" name="rel_vec" type="Vector3">
</argument>
+ <argument index="1" name="infinite_inertia" type="bool" default="true">
+ </argument>
<description>
Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision], which contains information about the collision.
</description>
@@ -74,11 +76,13 @@
</argument>
<argument index="1" name="floor_normal" type="Vector3" default="Vector3( 0, 0, 0 )">
</argument>
- <argument index="2" name="slope_stop_min_velocity" type="float" default="0.05">
+ <argument index="2" name="infinite_inertia" type="bool" default="true">
+ </argument>
+ <argument index="3" name="slope_stop_min_velocity" type="float" default="0.05">
</argument>
- <argument index="3" name="max_slides" type="int" default="4">
+ <argument index="4" name="max_slides" type="int" default="4">
</argument>
- <argument index="4" name="floor_max_angle" type="float" default="0.785398">
+ <argument index="5" name="floor_max_angle" type="float" default="0.785398">
</argument>
<description>
Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [code]KinematicBody[/code] or [RigidBody], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes.
@@ -97,6 +101,8 @@
</argument>
<argument index="1" name="rel_vec" type="Vector3">
</argument>
+ <argument index="2" name="infinite_inertia" type="bool">
+ </argument>
<description>
Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur.
</description>
diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml
index da7b34440e..0448707c2e 100644
--- a/doc/classes/KinematicBody2D.xml
+++ b/doc/classes/KinematicBody2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicBody2D" inherits="PhysicsBody2D" category="Core" version="3.1-dev">
+<class name="KinematicBody2D" inherits="PhysicsBody2D" category="Core" version="3.1">
<brief_description>
Kinematic body 2D node.
</brief_description>
@@ -62,6 +62,8 @@
</return>
<argument index="0" name="rel_vec" type="Vector2">
</argument>
+ <argument index="1" name="infinite_inertia" type="bool" default="true">
+ </argument>
<description>
Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision2D], which contains information about the collision.
</description>
@@ -73,11 +75,13 @@
</argument>
<argument index="1" name="floor_normal" type="Vector2" default="Vector2( 0, 0 )">
</argument>
- <argument index="2" name="slope_stop_min_velocity" type="float" default="5">
+ <argument index="2" name="infinite_inertia" type="bool" default="true">
+ </argument>
+ <argument index="3" name="slope_stop_min_velocity" type="float" default="5">
</argument>
- <argument index="3" name="max_bounces" type="int" default="4">
+ <argument index="4" name="max_bounces" type="int" default="4">
</argument>
- <argument index="4" name="floor_max_angle" type="float" default="0.785398">
+ <argument index="5" name="floor_max_angle" type="float" default="0.785398">
</argument>
<description>
Moves the body along a vector. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [code]KinematicBody2D[/code] or [RigidBody2D], it will also be affected by the motion of the other body. You can use this to make moving or rotating platforms, or to make nodes push other nodes.
@@ -96,6 +100,8 @@
</argument>
<argument index="1" name="rel_vec" type="Vector2">
</argument>
+ <argument index="2" name="infinite_inertia" type="bool">
+ </argument>
<description>
Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform2D], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur.
</description>
diff --git a/doc/classes/KinematicCollision.xml b/doc/classes/KinematicCollision.xml
index 29025910f8..87eb9e77b5 100644
--- a/doc/classes/KinematicCollision.xml
+++ b/doc/classes/KinematicCollision.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicCollision" inherits="Reference" category="Core" version="3.1-dev">
+<class name="KinematicCollision" inherits="Reference" category="Core" version="3.1">
<brief_description>
Collision data for KinematicBody collisions.
</brief_description>
diff --git a/doc/classes/KinematicCollision2D.xml b/doc/classes/KinematicCollision2D.xml
index b133703c65..e403ada0b9 100644
--- a/doc/classes/KinematicCollision2D.xml
+++ b/doc/classes/KinematicCollision2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.1-dev">
+<class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.1">
<brief_description>
Collision data for KinematicBody2D collisions.
</brief_description>
diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml
index 7dd07c0c8e..1e78a196b1 100644
--- a/doc/classes/Label.xml
+++ b/doc/classes/Label.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Label" inherits="Control" category="Core" version="3.1-dev">
+<class name="Label" inherits="Control" category="Core" version="3.1">
<brief_description>
Displays plain text in a line or wrapped inside a rectangle. For formatted text, use [RichTextLabel].
</brief_description>
@@ -106,6 +106,8 @@
</theme_item>
<theme_item name="font_color_shadow" type="Color">
</theme_item>
+ <theme_item name="font_outline_modulate" type="Color">
+ </theme_item>
<theme_item name="line_spacing" type="int">
</theme_item>
<theme_item name="normal" type="StyleBox">
diff --git a/doc/classes/LargeTexture.xml b/doc/classes/LargeTexture.xml
index f09f2aa82c..763b38f49e 100644
--- a/doc/classes/LargeTexture.xml
+++ b/doc/classes/LargeTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="LargeTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="LargeTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
A Texture capable of storing many smaller Textures with offsets.
</brief_description>
diff --git a/doc/classes/Light.xml b/doc/classes/Light.xml
index b99908256c..e9b36c2f9d 100644
--- a/doc/classes/Light.xml
+++ b/doc/classes/Light.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Light" inherits="VisualInstance" category="Core" version="3.1-dev">
+<class name="Light" inherits="VisualInstance" category="Core" version="3.1">
<brief_description>
Provides a base class for different kinds of light nodes.
</brief_description>
@@ -7,7 +7,7 @@
Light is the abstract base class for light nodes, so it shouldn't be used directly (It can't be instanced). Other types of light nodes inherit from it. Light contains the common variables and parameters used for lighting.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml
index b12cecacfc..f3903ffeae 100644
--- a/doc/classes/Light2D.xml
+++ b/doc/classes/Light2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Light2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Light2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Casts light in a 2D environment.
</brief_description>
diff --git a/doc/classes/LightOccluder2D.xml b/doc/classes/LightOccluder2D.xml
index becfdd2ff2..38b9054411 100644
--- a/doc/classes/LightOccluder2D.xml
+++ b/doc/classes/LightOccluder2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="LightOccluder2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="LightOccluder2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Occludes light cast by a Light2D, casting shadows.
</brief_description>
diff --git a/doc/classes/Line2D.xml b/doc/classes/Line2D.xml
index 89f43fc95d..19be34978d 100644
--- a/doc/classes/Line2D.xml
+++ b/doc/classes/Line2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Line2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Line2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
A 2D line.
</brief_description>
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index fa65180d89..d7a0385bb3 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="LineEdit" inherits="Control" category="Core" version="3.1-dev">
+<class name="LineEdit" inherits="Control" category="Core" version="3.1">
<brief_description>
Control that provides single line string editing.
</brief_description>
@@ -110,7 +110,10 @@
Text shown when the [LineEdit] is empty. It is [b]not[/b] the [LineEdit]'s default value (see [member text]).
</member>
<member name="secret" type="bool" setter="set_secret" getter="is_secret">
- If [code]true[/code] every character is shown as "*".
+ If [code]true[/code], every character is replaced with the secret character (see [member secret_character]).
+ </member>
+ <member name="secret_character" type="String" setter="set_secret_character" getter="get_secret_character">
+ The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.
</member>
<member name="text" type="String" setter="set_text" getter="get_text">
String value of the [LineEdit].
diff --git a/doc/classes/LineShape2D.xml b/doc/classes/LineShape2D.xml
index 8ff3c71a9c..4a5486583a 100644
--- a/doc/classes/LineShape2D.xml
+++ b/doc/classes/LineShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="LineShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="LineShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Line shape for 2D collisions.
</brief_description>
diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml
index b3a5f3fd7c..a09edfad89 100644
--- a/doc/classes/LinkButton.xml
+++ b/doc/classes/LinkButton.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="LinkButton" inherits="BaseButton" category="Core" version="3.1-dev">
+<class name="LinkButton" inherits="BaseButton" category="Core" version="3.1">
<brief_description>
- Simple button used to represent a link to some resource
+ Simple button used to represent a link to some resource.
</brief_description>
<description>
This kind of buttons are primarily used when the interaction with the button causes a context change (like linking to a web page).
diff --git a/doc/classes/Listener.xml b/doc/classes/Listener.xml
index 0783c3ddba..720a7eafc5 100644
--- a/doc/classes/Listener.xml
+++ b/doc/classes/Listener.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Listener" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Listener" inherits="Spatial" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml
index 214c2569e9..8c2aa01f81 100644
--- a/doc/classes/MainLoop.xml
+++ b/doc/classes/MainLoop.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MainLoop" inherits="Object" category="Core" version="3.1-dev">
+<class name="MainLoop" inherits="Object" category="Core" version="3.1">
<brief_description>
Main loop is the abstract main loop base class.
</brief_description>
diff --git a/doc/classes/MarginContainer.xml b/doc/classes/MarginContainer.xml
index 80554192a0..15613e4bec 100644
--- a/doc/classes/MarginContainer.xml
+++ b/doc/classes/MarginContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MarginContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="MarginContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
Simple margin container.
</brief_description>
diff --git a/doc/classes/Marshalls.xml b/doc/classes/Marshalls.xml
index 44ff094971..687f81eec7 100644
--- a/doc/classes/Marshalls.xml
+++ b/doc/classes/Marshalls.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Marshalls" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Marshalls" inherits="Reference" category="Core" version="3.1">
<brief_description>
Data transformation (marshalling) and encoding helpers.
</brief_description>
diff --git a/doc/classes/Material.xml b/doc/classes/Material.xml
index fa53ce11da..7420a5deb0 100644
--- a/doc/classes/Material.xml
+++ b/doc/classes/Material.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Material" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Material" inherits="Resource" category="Core" version="3.1">
<brief_description>
Abstract base [Resource] for coloring and shading geometry.
</brief_description>
diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml
index 333326b730..c9a8d3ce7a 100644
--- a/doc/classes/MenuButton.xml
+++ b/doc/classes/MenuButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MenuButton" inherits="Button" category="Core" version="3.1-dev">
+<class name="MenuButton" inherits="Button" category="Core" version="3.1">
<brief_description>
Special button that brings up a [PopupMenu] when clicked.
</brief_description>
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index 6e60809999..83cadf959c 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Mesh" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Mesh" inherits="Resource" category="Core" version="3.1">
<brief_description>
A [Resource] that contains vertex-array based geometry.
</brief_description>
diff --git a/doc/classes/MeshDataTool.xml b/doc/classes/MeshDataTool.xml
index eff6bd2c61..43d94004a8 100644
--- a/doc/classes/MeshDataTool.xml
+++ b/doc/classes/MeshDataTool.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MeshDataTool" inherits="Reference" category="Core" version="3.1-dev">
+<class name="MeshDataTool" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/MeshInstance.xml b/doc/classes/MeshInstance.xml
index d70123239a..ef42726ca9 100644
--- a/doc/classes/MeshInstance.xml
+++ b/doc/classes/MeshInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MeshInstance" inherits="GeometryInstance" category="Core" version="3.1-dev">
+<class name="MeshInstance" inherits="GeometryInstance" category="Core" version="3.1">
<brief_description>
Node that instances meshes into a scenario.
</brief_description>
diff --git a/doc/classes/MeshInstance2D.xml b/doc/classes/MeshInstance2D.xml
new file mode 100644
index 0000000000..7f0136bf77
--- /dev/null
+++ b/doc/classes/MeshInstance2D.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MeshInstance2D" inherits="Node2D" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
+ </member>
+ <member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map">
+ </member>
+ <member name="texture" type="Texture" setter="set_texture" getter="get_texture">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml
index 40776d095a..3726524638 100644
--- a/doc/classes/MeshLibrary.xml
+++ b/doc/classes/MeshLibrary.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MeshLibrary" inherits="Resource" category="Core" version="3.1-dev">
+<class name="MeshLibrary" inherits="Resource" category="Core" version="3.1">
<brief_description>
Library of meshes.
</brief_description>
diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml
index f5bd0885d3..b78d82199c 100644
--- a/doc/classes/MultiMesh.xml
+++ b/doc/classes/MultiMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiMesh" inherits="Resource" category="Core" version="3.1-dev">
+<class name="MultiMesh" inherits="Resource" category="Core" version="3.1">
<brief_description>
Provides high performance mesh instancing.
</brief_description>
diff --git a/doc/classes/MultiMeshInstance.xml b/doc/classes/MultiMeshInstance.xml
index 0ffdb3c928..5e021dfe9b 100644
--- a/doc/classes/MultiMeshInstance.xml
+++ b/doc/classes/MultiMeshInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiMeshInstance" inherits="GeometryInstance" category="Core" version="3.1-dev">
+<class name="MultiMeshInstance" inherits="GeometryInstance" category="Core" version="3.1">
<brief_description>
Node that instances a [MultiMesh].
</brief_description>
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
new file mode 100644
index 0000000000..8c114a55c9
--- /dev/null
+++ b/doc/classes/MultiplayerAPI.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MultiplayerAPI" inherits="Reference" category="Core" version="3.1">
+ <brief_description>
+ High Level Multiplayer API.
+ </brief_description>
+ <description>
+ This class implements most of the logic behind the high level multiplayer API.
+ By default, [SceneTree] has a reference to this class that is used to provide multiplayer capabilities (i.e. RPC/RSET) across the whole scene.
+ It is possible to override the MultiplayerAPI instance used by specific Nodes by setting the [member Node.custom_multiplayer] property, effectively allowing to run both client and server in the same scene.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="clear">
+ <return type="void">
+ </return>
+ <description>
+ Clears the current MultiplayerAPI network state (you shouldn't call this unless you know what you are doing).
+ </description>
+ </method>
+ <method name="get_network_connected_peers" qualifiers="const">
+ <return type="PoolIntArray">
+ </return>
+ <description>
+ Returns the peer IDs of all connected peers of this MultiplayerAPI's [member network_peer].
+ </description>
+ </method>
+ <method name="get_network_unique_id" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the unique peer ID of this MultiplayerAPI's [member network_peer].
+ </description>
+ </method>
+ <method name="get_rpc_sender_id" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the sender's peer ID for the RPC currently being executed.
+ NOTE: If not inside an RPC this method will return 0.
+ </description>
+ </method>
+ <method name="has_network_peer" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if there is a [member network_peer] set.
+ </description>
+ </method>
+ <method name="is_network_server" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if this MultiplayerAPI's [member network_peer] is in server mode (listening for connections).
+ </description>
+ </method>
+ <method name="poll">
+ <return type="void">
+ </return>
+ <description>
+ Method used for polling the MultiplayerAPI. You only need to worry about this if you are using [member Node.custom_multiplayer] override or you set [member SceneTree.multiplayer_poll] to [code]false[/code]. By default [SceneTree] will poll its MultiplayerAPI for you.
+ NOTE: This method results in RPCs and RSETs being called, so they will be executed in the same context of this function (e.g. [code]_process[/code], [code]physics[/code], [Thread]).
+ </description>
+ </method>
+ <method name="send_bytes">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="bytes" type="PoolByteArray">
+ </argument>
+ <argument index="1" name="id" type="int" default="0">
+ </argument>
+ <description>
+ Sends the given raw [code]bytes[/code] to a specific peer identified by [code]id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]). Default ID is [code]0[/code], i.e. broadcast to all peers.
+ </description>
+ </method>
+ <method name="set_root_node">
+ <return type="void">
+ </return>
+ <argument index="0" name="node" type="Node">
+ </argument>
+ <description>
+ Sets the base root node to use for RPCs. Instead of an absolute path, a relative path will be used to find the node upon which the RPC should be executed.
+ This effectively allows to have different branches of the scene tree to be managed by different MultiplayerAPI, allowing for example to run both client and server in the same scene.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer">
+ The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals.
+ </member>
+ <member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections">
+ If [code]true[/code] the MultiplayerAPI's [member network_peer] refuses new incoming connections.
+ </member>
+ </members>
+ <signals>
+ <signal name="connected_to_server">
+ <description>
+ Emitted whenever this MultiplayerAPI's [member network_peer] successfully connected to a server. Only emitted on clients.
+ </description>
+ </signal>
+ <signal name="connection_failed">
+ <description>
+ Emitted whenever this MultiplayerAPI's [member network_peer] fails to establish a connection to a server. Only emitted on clients.
+ </description>
+ </signal>
+ <signal name="network_peer_connected">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Emitted whenever this MultiplayerAPI's [member network_peer] connects with a new peer. ID is the peer ID of the new peer. Clients get notified when other clients connect to the same server. Upon connecting to a server, a client also receives this signal for the server (with ID being 1).
+ </description>
+ </signal>
+ <signal name="network_peer_disconnected">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Emitted whenever this MultiplayerAPI's [member network_peer] disconnects from a peer. Clients get notified when other clients disconnect from the same server.
+ </description>
+ </signal>
+ <signal name="network_peer_packet">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="packet" type="PoolByteArray">
+ </argument>
+ <description>
+ Emitted whenever this MultiplayerAPI's [member network_peer] receive a [code]packet[/code] with custom data (see [method send_bytes]). ID is the peer ID of the peer that sent the packet.
+ </description>
+ </signal>
+ <signal name="server_disconnected">
+ <description>
+ Emitted whenever this MultiplayerAPI's [member network_peer] disconnects from server. Only emitted on clients.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ <constant name="RPC_MODE_DISABLED" value="0" enum="RPCMode">
+ Used with [method Node.rpc_config] or [method Node.rset_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
+ </constant>
+ <constant name="RPC_MODE_REMOTE" value="1" enum="RPCMode">
+ Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the [code]remote[/code] keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or slaves.
+ </constant>
+ <constant name="RPC_MODE_SYNC" value="2" enum="RPCMode">
+ Behave like [code]RPC_MODE_REMOTE[/code] but also make the call or property change locally. Analogous to the [code]sync[/code] keyword.
+ </constant>
+ <constant name="RPC_MODE_MASTER" value="3" enum="RPCMode">
+ Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on the network master for this node. Analogous to the [code]master[/code] keyword. Only accepts calls or property changes from the node's network slaves, see [method Node.set_network_master].
+ </constant>
+ <constant name="RPC_MODE_SLAVE" value="4" enum="RPCMode">
+ Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on slaves for this node. Analogous to the [code]slave[/code] keyword. Only accepts calls or property changes from the node's network master, see [method Node.set_network_master].
+ </constant>
+ <constant name="RPC_MODE_REMOTESYNC" value="5" enum="RPCMode">
+ Behave like [code]RPC_MODE_REMOTE[/code] but also make the call or property change locally. Same as [code]RPC_MODE_SYNC[/code] which is only kept for compatibility. Analogous to the [code]remotesync[/code] keyword.
+ </constant>
+ <constant name="RPC_MODE_MASTERSYNC" value="6" enum="RPCMode">
+ Behave like [code]RPC_MODE_MASTER[/code] but also make the call or property change locally. Analogous to the [code]mastersync[/code] keyword.
+ </constant>
+ <constant name="RPC_MODE_SLAVESYNC" value="7" enum="RPCMode">
+ Behave like [code]RPC_MODE_SLAVE[/code] but also make the call or property change locally. Analogous to the [code]slavesync[/code] keyword.
+ </constant>
+ </constants>
+</class>
diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml
index ce3a4cc45a..8f2751af98 100644
--- a/doc/classes/Mutex.xml
+++ b/doc/classes/Mutex.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Mutex" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Mutex" inherits="Reference" category="Core" version="3.1">
<brief_description>
A synchronization Mutex.
</brief_description>
diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml
index e2be70979d..08f22d49d3 100644
--- a/doc/classes/Navigation.xml
+++ b/doc/classes/Navigation.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Navigation" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Navigation" inherits="Spatial" category="Core" version="3.1">
<brief_description>
- A collection of [code]NavigationMesh[/code] resources and methods used for pathfinding.
+ Mesh-based navigation and pathfinding node.
</brief_description>
<description>
- The Navigation node is used for basic or advanced navigation. By default it will automatically collect all child [code]NavigationMesh[/code] resources, but they can also be added on the fly through scripting. It can be used for generating a simple path between two points or it can be used to ensure that a navigation agent is angled perfectly to the terrain it is navigating.
+ Provides navigation and pathfinding within a collection of [NavigationMesh]es. By default these will be automatically collected from child [NavigationMeshInstance] nodes, but they can also be added on the fly with [method navmesh_add]. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
</description>
<tutorials>
</tutorials>
@@ -17,7 +17,7 @@
<argument index="0" name="to_point" type="Vector3">
</argument>
<description>
- Returns the closest navigation point to the point passed.
+ Returns the navigation point closest to the point given. Points are in local coordinate space.
</description>
</method>
<method name="get_closest_point_normal">
@@ -26,7 +26,7 @@
<argument index="0" name="to_point" type="Vector3">
</argument>
<description>
- Returns the surface normal of the navigation mesh at the point passed. For instance, if the point passed was at a 45 degree slope it would return something like (0.5,0.5,0). This is useful for rotating a navigation agent in accordance with the [code]NavigationMesh[/code].
+ Returns the surface normal at the navigation point closest to the point given. Useful for rotating a navigation agent according to the navigation mesh it moves on.
</description>
</method>
<method name="get_closest_point_owner">
@@ -35,7 +35,7 @@
<argument index="0" name="to_point" type="Vector3">
</argument>
<description>
- Returns the nearest [code]NavigationMeshInstance[/code] to the point passed.
+ Returns the owner of the [NavigationMesh] which contains the navigation point closest to the point given. This is usually a [NavigtionMeshInstance]. For meshes added via [method navmesh_add], returns the owner that was given (or [code]null[/code] if the [code]owner[/code] parameter was omitted).
</description>
</method>
<method name="get_closest_point_to_segment">
@@ -48,7 +48,7 @@
<argument index="2" name="use_collision" type="bool" default="false">
</argument>
<description>
- Returns the nearest point to the line segment passed. The third optional parameter takes collisions into account.
+ Returns the navigation point closest to the given line segment. When enabling [code]use_collision[/code], only considers intersection points between segment and navigation meshes. If multiple intersection points are found, the one closest to the segment start point is returned.
</description>
</method>
<method name="get_simple_path">
@@ -61,7 +61,7 @@
<argument index="2" name="optimize" type="bool" default="true">
</argument>
<description>
- Returns a path of points as a [code]PoolVector3Array[/code]. If [code]optimize[/code] is false the [code]NavigationMesh[/code] agent properties will be taken into account, otherwise it will return the nearest path and ignore agent radius, height, etc.
+ Returns the path between two given points. Points are in local coordinate space. If [code]optimize[/code] is [code]true[/code] (the default), the agent properties associated with each [NavigationMesh] (raidus, height, etc.) are considered in the path calculation, otherwise they are ignored.
</description>
</method>
<method name="navmesh_add">
@@ -74,7 +74,7 @@
<argument index="2" name="owner" type="Object" default="null">
</argument>
<description>
- Adds a [code]NavigationMesh[/code] to the list of NavigationMesh's in this node. Returns an id. Its position, rotation and scale are associated with the [code]Transform[/code] passed. The [code]Node[/code] (or [code]Object[/code]) that owns this node is an optional parameter.
+ Adds a [NavigationMesh]. Returns an ID for use with [method navmesh_remove] or [method navmesh_set_transform]. If given, a [Transform2D] is applied to the polygon. The optional [code]owner[/code] is used as return value for [method get_closest_point_owner].
</description>
</method>
<method name="navmesh_remove">
@@ -83,7 +83,7 @@
<argument index="0" name="id" type="int">
</argument>
<description>
- Removes a [code]NavigationMesh[/code] from the list of NavigationMesh's in this node.
+ Removes the [NavigationMesh] with the given ID.
</description>
</method>
<method name="navmesh_set_transform">
@@ -94,13 +94,13 @@
<argument index="1" name="xform" type="Transform">
</argument>
<description>
- Associates a [code]NavigationMesh[/code]'s id with a [code]Transform[/code]. Its position, rotation and scale are based on the [code]Transform[/code] passed.
+ Sets the transform applied to the [NavigationMesh] with the given ID.
</description>
</method>
</methods>
<members>
<member name="up_vector" type="Vector3" setter="set_up_vector" getter="get_up_vector">
- Defines which direction is up. The default defines 0,1,0 as up which is the world up direction. To make this a ceiling use 0,-1,0 to define down as up.
+ Defines which direction is up. By default this is [code](0, 1, 0)[/code], which is the world up direction.
</member>
</members>
<constants>
diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml
index 4709dab3e8..364da55f99 100644
--- a/doc/classes/Navigation2D.xml
+++ b/doc/classes/Navigation2D.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Navigation2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Navigation2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
+ 2D navigation and pathfinding node.
</brief_description>
<description>
+ Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. By default these are automatically collected from child [NavigationPolygonInstance] nodes, but they can also be added on the fly with [method navpoly_add].
</description>
<tutorials>
</tutorials>
@@ -15,6 +17,7 @@
<argument index="0" name="to_point" type="Vector2">
</argument>
<description>
+ Returns the navigation point closest to the point given. Points are in local coordinate space.
</description>
</method>
<method name="get_closest_point_owner">
@@ -23,6 +26,7 @@
<argument index="0" name="to_point" type="Vector2">
</argument>
<description>
+ Returns the owner of the [NavigationPolygon] which contains the navigation point closest to the point given. This is usually a [NavigtionPolygonInstance]. For polygons added via [method navpoly_add], returns the owner that was given (or [code]null[/code] if the [code]owner[/code] parameter was omitted).
</description>
</method>
<method name="get_simple_path">
@@ -35,6 +39,7 @@
<argument index="2" name="optimize" type="bool" default="true">
</argument>
<description>
+ Returns the path between two given points. Points are in local coordinate space. If [code]optimize[/code] is [code]true[/code] (the default), the path is smoothed by merging path segments where possible.
</description>
</method>
<method name="navpoly_add">
@@ -47,6 +52,7 @@
<argument index="2" name="owner" type="Object" default="null">
</argument>
<description>
+ Adds a [NavigationPolygon]. Returns an ID for use with [method navpoly_remove] or [method navpoly_set_transform]. If given, a [Transform2D] is applied to the polygon. The optional [code]owner[/code] is used as return value for [method get_closest_point_owner].
</description>
</method>
<method name="navpoly_remove">
@@ -55,6 +61,7 @@
<argument index="0" name="id" type="int">
</argument>
<description>
+ Removes the [NavigationPolygon] with the given ID.
</description>
</method>
<method name="navpoly_set_transform">
@@ -65,6 +72,7 @@
<argument index="1" name="xform" type="Transform2D">
</argument>
<description>
+ Sets the transform applied to the [NavigationPolygon] with the given ID.
</description>
</method>
</methods>
diff --git a/doc/classes/NavigationMesh.xml b/doc/classes/NavigationMesh.xml
index 34ca1f852e..f0654e5b12 100644
--- a/doc/classes/NavigationMesh.xml
+++ b/doc/classes/NavigationMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationMesh" inherits="Resource" category="Core" version="3.1-dev">
+<class name="NavigationMesh" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationMeshInstance.xml
index 48b7e3a8ef..643bfc726f 100644
--- a/doc/classes/NavigationMeshInstance.xml
+++ b/doc/classes/NavigationMeshInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationMeshInstance" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="NavigationMeshInstance" inherits="Spatial" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/NavigationPolygon.xml b/doc/classes/NavigationPolygon.xml
index b8865a24b3..b29e19e5d8 100644
--- a/doc/classes/NavigationPolygon.xml
+++ b/doc/classes/NavigationPolygon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationPolygon" inherits="Resource" category="Core" version="3.1-dev">
+<class name="NavigationPolygon" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/NavigationPolygonInstance.xml b/doc/classes/NavigationPolygonInstance.xml
index db9b691ef1..ff95f652f1 100644
--- a/doc/classes/NavigationPolygonInstance.xml
+++ b/doc/classes/NavigationPolygonInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationPolygonInstance" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="NavigationPolygonInstance" inherits="Node2D" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/NetworkedMultiplayerPeer.xml b/doc/classes/NetworkedMultiplayerPeer.xml
index 794886dd64..e878b3a746 100644
--- a/doc/classes/NetworkedMultiplayerPeer.xml
+++ b/doc/classes/NetworkedMultiplayerPeer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NetworkedMultiplayerPeer" inherits="PacketPeer" category="Core" version="3.1-dev">
+<class name="NetworkedMultiplayerPeer" inherits="PacketPeer" category="Core" version="3.1">
<brief_description>
A high-level network interface to simplify multiplayer interactions.
</brief_description>
@@ -7,7 +7,7 @@
Manages the connection to network peers. Assigns unique IDs to each client connected to the server.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/networking/high_level_multiplayer.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/networking/high_level_multiplayer.html</link>
</tutorials>
<demos>
</demos>
@@ -46,7 +46,8 @@
<argument index="0" name="id" type="int">
</argument>
<description>
- The peer to which packets will be sent. Default value: [code]0[/code].
+ Sets the peer to which packets will be sent.
+ The [code]id[/code] can be one of: [code]TARGET_PEER_BROADCAST[/code] to send to all connected peers, [code]TARGET_PEER_SERVER[/code] to send to the peer acting as server, a valid peer ID to send to that specific peer, a negative peer ID to send to all peers except that one. Default: [code]TARGET_PEER_BROADCAST[/code]
</description>
</method>
</methods>
diff --git a/doc/classes/Nil.xml b/doc/classes/Nil.xml
index 46c972d4d5..e09dba6511 100644
--- a/doc/classes/Nil.xml
+++ b/doc/classes/Nil.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Nil" category="Built-In Types" version="3.1-dev">
+<class name="Nil" category="Built-In Types" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/NinePatchRect.xml b/doc/classes/NinePatchRect.xml
index ce6fe26e07..f40b32951f 100644
--- a/doc/classes/NinePatchRect.xml
+++ b/doc/classes/NinePatchRect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NinePatchRect" inherits="Control" category="Core" version="3.1-dev">
+<class name="NinePatchRect" inherits="Control" category="Core" version="3.1">
<brief_description>
Scalable texture-based frame that tiles the texture's centers and sides, but keeps the corners' original size. Perfect for panels and dialog boxes.
</brief_description>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index e272e14d08..8bae412053 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Node" inherits="Object" category="Core" version="3.1-dev">
+<class name="Node" inherits="Object" category="Core" version="3.1">
<brief_description>
Base class for all [i]scene[/i] objects.
</brief_description>
<description>
Nodes are Godot's building blocks. They can be assigned as the child of another node, resulting in a tree arrangement. A given node can contain any number of nodes as children with the requirement that all siblings (direct children of a node) should have unique names.
- A tree of nodes is called a [i]scene[/i]. Scenes can be saved to the disk and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of Godot projects. Nodes can also optionally be added to groups. This makes it possible to access a number of nodes from code (an "enemies" group, for example) to perform grouped actions.
+ A tree of nodes is called a [i]scene[/i]. Scenes can be saved to the disk and then instanced into other scenes. This allows for very high flexibility in the architecture and data model of Godot projects.
[b]Scene tree:[/b] The [SceneTree] contains the active tree of nodes. When a node is added to the scene tree, it receives the NOTIFICATION_ENTER_TREE notification and its [method _enter_tree] callback is triggered. Child nodes are always added [i]after[/i] their parent node, i.e. the [method _enter_tree] callback of a parent node will be triggered before its child's.
Once all nodes have been added in the scene tree, they receive the NOTIFICATION_READY notification and their respective [method _ready] callbacks are triggered. For groups of nodes, the [method _ready] callback is called in reverse order, starting with the children and moving up to the parent nodes.
This means that when adding a node to the scene tree, the following order will be used for the callbacks: [method _enter_tree] of the parent, [method _enter_tree] of the children, [method _ready] of the children and finally [method _ready] of the parent (recursively for the entire scene tree).
@@ -13,10 +13,11 @@
Nodes can also process input events. When present, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it.
To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though.
Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children.
- [b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to communicate over the network. By calling [method rpc] with a method name, it will be called locally and in all connected peers (peers = clients and the server that accepts connections), with behaviour varying depending on the network mode ([method set_network_mode]) of the receiving peer. To identify which node receives the RPC call Godot will use its [NodePath] (make sure node names are the same on all peers).
+ [b]Groups:[/b] Nodes can be added to as many groups as you want to be easy to manage, you could create groups like "enemies" or "collectables" for example, depending on your game. See [method add_to_group], [method is_in_group] and [method remove_from_group]. You can then retrieve all nodes in these groups, iterate them and even call methods on groups via the methods on [SceneTree].
+ [b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to communicate over the network. By calling [method rpc] with a method name, it will be called locally and in all connected peers (peers = clients and the server that accepts connections). To identify which node receives the RPC call Godot will use its [NodePath] (make sure node names are the same on all peers). Also take a look at the high-level networking tutorial and corresponding demos.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scenes_and_nodes.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scenes_and_nodes.html</link>
</tutorials>
<demos>
</demos>
@@ -45,6 +46,8 @@
<description>
Called when there is an input event. The input event propagates through the node tree until a node consumes it.
It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_input].
+ To consume the input event and stop it propagating further to other nodes, [method SceneTree.set_input_as_handled] can be called.
+ For gameplay input, [method _unhandled_input] and [method _unhandled_key_input] are usually a better fit as they allow the GUI to intercept the events first.
</description>
</method>
<method name="_physics_process" qualifiers="virtual">
@@ -74,7 +77,8 @@
</return>
<description>
Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their [method _ready] callbacks get triggered first, and the parent node will receive the ready notification afterwards.
- Corresponds to the NOTIFICATION_READY notification in [method Object._notification].
+ Corresponds to the NOTIFICATION_READY notification in [method Object._notification]. See also the [code]onready[/code] keyword for variables.
+ Usually used for initialization. For even earlier initialization, [method Object._init] may be used. Also see [method _enter_tree].
</description>
</method>
<method name="_unhandled_input" qualifiers="virtual">
@@ -83,8 +87,10 @@
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
- Propagated to all nodes when the previous InputEvent is not consumed by any nodes.
+ Propagated to all nodes when the previous [InputEvent] is not consumed by any nodes.
It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_input].
+ To consume the input event and stop it propagating further to other nodes, [method SceneTree.set_input_as_handled] can be called.
+ For gameplay input, this and [method _unhandled_key_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first.
</description>
</method>
<method name="_unhandled_key_input" qualifiers="virtual">
@@ -93,6 +99,10 @@
<argument index="0" name="event" type="InputEventKey">
</argument>
<description>
+ Propagated to all nodes when the previous [InputEventKey] is not consumed by any nodes.
+ It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input].
+ To consume the input event and stop it propagating further to other nodes, [method SceneTree.set_input_as_handled] can be called.
+ For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first.
</description>
</method>
<method name="add_child">
@@ -129,7 +139,7 @@
<argument index="1" name="persistent" type="bool" default="false">
</argument>
<description>
- Adds the node to a group. Groups are helpers to name and organize a subset of nodes, for example "enemies" or "collectables". A node can be in any number of groups. Nodes can be assigned a group at any time, but will not be added until they are inside the scene tree (see [method is_inside_tree]).
+ Adds the node to a group. Groups are helpers to name and organize a subset of nodes, for example "enemies" or "collectables". A node can be in any number of groups. Nodes can be assigned a group at any time, but will not be added until they are inside the scene tree (see [method is_inside_tree]). See notes in the description, and the group methods in [SceneTree].
</description>
</method>
<method name="can_process" qualifiers="const">
@@ -203,7 +213,7 @@
<return type="int">
</return>
<description>
- Returns the peer ID of the network master for this node.
+ Returns the peer ID of the network master for this node. See [method set_network_master].
</description>
</method>
<method name="get_node" qualifiers="const">
@@ -262,7 +272,7 @@
<argument index="0" name="node" type="Node">
</argument>
<description>
- Returns the relative path from the current node to the specified node in "node" argument. Both nodes must be in the same scene, or the function will fail.
+ Returns the relative [NodePath] from this node to the specified [code]node[/code]. Both nodes must be in the same scene or the function will fail.
</description>
</method>
<method name="get_physics_process_delta_time" qualifiers="const">
@@ -290,6 +300,7 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if this is an instance load placeholder. See [InstancePlaceholder].
</description>
</method>
<method name="get_tree" qualifiers="const">
@@ -354,7 +365,7 @@
<argument index="0" name="group" type="String">
</argument>
<description>
- Returns [code]true[/code] if this node is in the specified group.
+ Returns [code]true[/code] if this node is in the specified group. See notes in the description, and the group methods in [SceneTree].
</description>
</method>
<method name="is_inside_tree" qualifiers="const">
@@ -368,6 +379,7 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the local system is the master of this node.
</description>
</method>
<method name="is_physics_processing" qualifiers="const">
@@ -381,6 +393,7 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if internal physics processing is enabled (see [method set_physics_process_internal]).
</description>
</method>
<method name="is_processing" qualifiers="const">
@@ -401,6 +414,7 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if internal processing is enabled (see [method set_process_internal]).
</description>
</method>
<method name="is_processing_unhandled_input" qualifiers="const">
@@ -432,13 +446,37 @@
<return type="void">
</return>
<description>
+ Prints all stray nodes (nodes outside the [SceneTree]). Used for debugging. Works only in debug builds.
</description>
</method>
<method name="print_tree">
<return type="void">
</return>
<description>
- Prints the scene to stdout. Used mainly for debugging purposes.
+ Prints the tree to stdout. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the [method get_node] function. Example output:
+ [codeblock]
+ TheGame
+ TheGame/Menu
+ TheGame/Menu/Label
+ TheGame/Menu/Camera2D
+ TheGame/SplashScreen
+ TheGame/SplashScreen/Camera2D
+ [/codeblock]
+ </description>
+ </method>
+ <method name="print_tree_pretty">
+ <return type="void">
+ </return>
+ <description>
+ Similar to [method print_tree], this prints the tree to stdout. This version displays a more graphical representation similar to what is displayed in the scene inspector. It is useful for inspecting larger trees. Example output:
+ [codeblock]
+ â”–â•´TheGame
+ â” â•´Menu
+ ┃ ┠╴Label
+ ┃ ┖╴Camera2D
+ â”–-SplashScreen
+ â”–â•´Camera2D
+ [/codeblock]
</description>
</method>
<method name="propagate_call">
@@ -499,7 +537,7 @@
<argument index="0" name="group" type="String">
</argument>
<description>
- Removes a node from a group.
+ Removes a node from a group. See notes in the description, and the group methods in [SceneTree].
</description>
</method>
<method name="replace_by">
@@ -526,7 +564,7 @@
<argument index="0" name="method" type="String">
</argument>
<description>
- Sends a remote procedure call request to all peers on the network (and locally), optionally sending additional data as arguments. Call request will be received by nodes with the same [NodePath].
+ Sends a remote procedure call request for the given [code]method[/code] to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same [NodePath], including the exact same node name. Behaviour depends on the RPC configuration for the given method, see [method rpc_config]. Methods are not exposed to RPCs by default. Also see [method rset] and [method rset_config] for properties. Returns an empty [Variant]. Note that you can only safely use RPCs on clients after you received the [code]connected_to_server[/code] signal from the [SceneTree]. You also need to keep track of the connection state, either by the [SceneTree] signals like [code]server_disconnected[/code] or by checking [code]SceneTree.network_peer.get_connection_status() == CONNECTION_CONNECTED[/code].
</description>
</method>
<method name="rpc_config">
@@ -534,10 +572,10 @@
</return>
<argument index="0" name="method" type="String">
</argument>
- <argument index="1" name="mode" type="int" enum="Node.RPCMode">
+ <argument index="1" name="mode" type="int" enum="MultiplayerAPI.RPCMode">
</argument>
<description>
- Changes the method's RPC mode (one of RPC_MODE_* constants).
+ Changes the RPC mode for the given [code]method[/code] to the given [code]mode[/code]. See [enum MultiplayerAPI.RPCMode]. An alternative is annotating methods and properties with the corresponding keywords ([code]remote[/code], [code]sync[/code], [code]master[/code], [code]slave[/code]). By default, methods are not exposed to networking (and RPCs). Also see [method rset] and [method rset_config] for properties.
</description>
</method>
<method name="rpc_id" qualifiers="vararg">
@@ -548,7 +586,7 @@
<argument index="1" name="method" type="String">
</argument>
<description>
- Sends a [method rpc] to a specific peer identified by [i]peer_id[/i].
+ Sends a [method rpc] to a specific peer identified by [code]peer_id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]). Returns an empty [Variant].
</description>
</method>
<method name="rpc_unreliable" qualifiers="vararg">
@@ -557,7 +595,7 @@
<argument index="0" name="method" type="String">
</argument>
<description>
- Sends a [method rpc] using an unreliable protocol.
+ Sends a [method rpc] using an unreliable protocol. Returns an empty [Variant].
</description>
</method>
<method name="rpc_unreliable_id" qualifiers="vararg">
@@ -568,7 +606,7 @@
<argument index="1" name="method" type="String">
</argument>
<description>
- Sends a [method rpc] to a specific peer identified by [i]peer_id[/i] using an unreliable protocol.
+ Sends a [method rpc] to a specific peer identified by [code]peer_id[/code] using an unreliable protocol (see [method NetworkedMultiplayerPeer.set_target_peer]). Returns an empty [Variant].
</description>
</method>
<method name="rset">
@@ -579,7 +617,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
- Remotely changes property's value on other peers (and locally).
+ Remotely changes a property's value on other peers (and locally). Behaviour depends on the RPC configuration for the given property, see [method rset_config]. Also see [method rpc] for RPCs for methods, most information applies to this method as well.
</description>
</method>
<method name="rset_config">
@@ -587,10 +625,10 @@
</return>
<argument index="0" name="property" type="String">
</argument>
- <argument index="1" name="mode" type="int" enum="Node.RPCMode">
+ <argument index="1" name="mode" type="int" enum="MultiplayerAPI.RPCMode">
</argument>
<description>
- Changes the property's RPC mode (one of RPC_MODE_* constants).
+ Changes the RPC mode for the given [code]property[/code] to the given [code]mode[/code]. See [enum MultiplayerAPI.RPCMode]. An alternative is annotating methods and properties with the corresponding keywords ([code]remote[/code], [code]sync[/code], [code]master[/code], [code]slave[/code]). By default, properties are not exposed to networking (and RPCs). Also see [method rpc] and [method rpc_config] for methods.
</description>
</method>
<method name="rset_id">
@@ -603,7 +641,7 @@
<argument index="2" name="value" type="Variant">
</argument>
<description>
- Remotely changes property's value on a specific peer identified by [i]peer_id[/i].
+ Remotely changes the property's value on a specific peer identified by [code]peer_id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]).
</description>
</method>
<method name="rset_unreliable">
@@ -614,7 +652,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
- Remotely changes property's value on other peers (and locally) using an unreliable protocol.
+ Remotely changes the property's value on other peers (and locally) using an unreliable protocol.
</description>
</method>
<method name="rset_unreliable_id">
@@ -627,7 +665,7 @@
<argument index="2" name="value" type="Variant">
</argument>
<description>
- Remotely changes property's value on a specific peer identified by [i]peer_id[/i] using an unreliable protocol.
+ Remotely changes property's value on a specific peer identified by [code]peer_id[/code] using an unreliable protocol (see [method NetworkedMultiplayerPeer.set_target_peer]).
</description>
</method>
<method name="set_display_folded">
@@ -647,7 +685,7 @@
<argument index="1" name="recursive" type="bool" default="true">
</argument>
<description>
- Sets the node network master to the peer with the given peer ID. The network master is the peer that has authority over it on the network. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server).
+ Sets the node's network master to the peer with the given peer ID. The network master is the peer that has authority over the node on the network. Useful in conjunction with the [code]master[/code] and [code]slave[/code] keywords. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). If [code]recursive[/code], the given peer is recursively set as the master for all children of this node.
</description>
</method>
<method name="set_physics_process">
@@ -665,6 +703,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal [method _physics_process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting ([method set_physics_process]). Only useful for advanced uses to manipulate built-in nodes behaviour.
</description>
</method>
<method name="set_process">
@@ -691,6 +730,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal [method _process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting ([method set_process]). Only useful for advanced uses to manipulate built-in nodes behaviour.
</description>
</method>
<method name="set_process_unhandled_input">
@@ -717,24 +757,36 @@
<argument index="0" name="load_placeholder" type="bool">
</argument>
<description>
+ Sets whether this is an instance load placeholder. See [InstancePlaceholder].
</description>
</method>
</methods>
<members>
+ <member name="custom_multiplayer" type="MultiplayerAPI" setter="set_custom_multiplayer" getter="get_custom_multiplayer">
+ The override to the default [MultiplayerAPI]. Set to null to use the default SceneTree one.
+ </member>
<member name="filename" type="String" setter="set_filename" getter="get_filename">
When a scene is instanced from a file, its topmost node contains the filename from which it was loaded.
</member>
+ <member name="multiplayer" type="MultiplayerAPI" setter="" getter="get_multiplayer">
+ The [MultiplayerAPI] instance associated with this node. Either the [member custom_multiplayer], or the default SceneTree one (if inside tree).
+ </member>
<member name="name" type="String" setter="set_name" getter="get_name">
- The name of the node. This name is unique among the siblings (other child nodes from the same parent).
- When set to an existing name, the node will be automatically renamed
+ The name of the node. This name is unique among the siblings (other child nodes from the same parent). When set to an existing name, the node will be automatically renamed
</member>
<member name="owner" type="Node" setter="set_owner" getter="get_owner">
- The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using SceneSaver) all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing.
+ The node owner. A node can have any other node as owner (as long as it is a valid parent, grandparent, etc. ascending in the tree). When saving a node (using [PackedScene]) all the nodes it owns will be saved with it. This allows for the creation of complex [SceneTree]s, with instancing and subinstancing.
</member>
<member name="pause_mode" type="int" setter="set_pause_mode" getter="get_pause_mode" enum="Node.PauseMode">
+ Pause mode. How the node will behave if the [SceneTree] is paused.
</member>
</members>
<signals>
+ <signal name="ready">
+ <description>
+ Emitted when the node is ready.
+ </description>
+ </signal>
<signal name="renamed">
<description>
Emitted when the node is renamed.
@@ -752,7 +804,7 @@
</signal>
<signal name="tree_exiting">
<description>
- Emitted when the node is still active but about to exit the tree. This is the right place for de-initialization.
+ Emitted when the node is still active but about to exit the tree. This is the right place for de-initialization (or a "destructor", if you will).
</description>
</signal>
</signals>
@@ -800,33 +852,22 @@
Notification received when the node's [NodePath] changed.
</constant>
<constant name="NOTIFICATION_TRANSLATION_CHANGED" value="24">
+ Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr].
</constant>
<constant name="NOTIFICATION_INTERNAL_PROCESS" value="25">
+ Notification received every frame when the internal process flag is set (see [method set_process_internal]).
</constant>
<constant name="NOTIFICATION_INTERNAL_PHYSICS_PROCESS" value="26">
- </constant>
- <constant name="RPC_MODE_DISABLED" value="0" enum="RPCMode">
- </constant>
- <constant name="RPC_MODE_REMOTE" value="1" enum="RPCMode">
- Call a method remotely.
- </constant>
- <constant name="RPC_MODE_SYNC" value="2" enum="RPCMode">
- Call a method both remotely and locally.
- </constant>
- <constant name="RPC_MODE_MASTER" value="3" enum="RPCMode">
- Call a method if the Node is Master.
- </constant>
- <constant name="RPC_MODE_SLAVE" value="4" enum="RPCMode">
- Call a method if the Node is Slave.
+ Notification received every frame when the internal physics process flag is set (see [method set_physics_process_internal]).
</constant>
<constant name="PAUSE_MODE_INHERIT" value="0" enum="PauseMode">
- Inherits pause mode from parent. For root node, it is equivalent to PAUSE_MODE_STOP.
+ Inherits pause mode from the node's parent. For the root node, it is equivalent to PAUSE_MODE_STOP. Default.
</constant>
<constant name="PAUSE_MODE_STOP" value="1" enum="PauseMode">
- Stop processing when SceneTree is paused.
+ Stop processing when the [SceneTree] is paused.
</constant>
<constant name="PAUSE_MODE_PROCESS" value="2" enum="PauseMode">
- Continue to process regardless of SceneTree pause state.
+ Continue to process regardless of the [SceneTree] pause state.
</constant>
<constant name="DUPLICATE_SIGNALS" value="1" enum="DuplicateFlags">
Duplicate the node's signals.
diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml
index 0b462967a1..13eabeca17 100644
--- a/doc/classes/Node2D.xml
+++ b/doc/classes/Node2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Node2D" inherits="CanvasItem" category="Core" version="3.1-dev">
+<class name="Node2D" inherits="CanvasItem" category="Core" version="3.1">
<brief_description>
A 2D game object, parent of all 2D related nodes. Has a position, rotation, scale and Z-index.
</brief_description>
@@ -7,7 +7,7 @@
A 2D game object, with a position, rotation and scale. All 2D physics nodes and sprites inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control on the node's render order.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/2d/custom_drawing_in_2d.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/custom_drawing_in_2d.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml
index 48effa5918..f589fa12b7 100644
--- a/doc/classes/NodePath.xml
+++ b/doc/classes/NodePath.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NodePath" category="Built-In Types" version="3.1-dev">
+<class name="NodePath" category="Built-In Types" version="3.1">
<brief_description>
Pre-parsed scene tree path.
</brief_description>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index f37c80efc9..1526b1be8c 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OS" inherits="Object" category="Core" version="3.1-dev">
+<class name="OS" inherits="Object" category="Core" version="3.1">
<brief_description>
Operating System functions.
</brief_description>
@@ -40,6 +40,7 @@
<return type="void">
</return>
<description>
+ Centers the window on the screen if in windowed mode.
</description>
</method>
<method name="delay_msec" qualifiers="const">
@@ -48,7 +49,7 @@
<argument index="0" name="msec" type="int">
</argument>
<description>
- Delay executing of the current thread by given milliseconds.
+ Delay execution of the current thread by given milliseconds.
</description>
</method>
<method name="delay_usec" qualifiers="const">
@@ -57,7 +58,7 @@
<argument index="0" name="usec" type="int">
</argument>
<description>
- Delay executing of the current thread by given microseconds.
+ Delay execution of the current thread by given microseconds.
</description>
</method>
<method name="dump_memory_to_file">
@@ -67,7 +68,7 @@
</argument>
<description>
Dumps the memory allocation ringlist to a file (only works in debug).
- Entry format per line: "Address - Size - Description"
+ Entry format per line: "Address - Size - Description".
</description>
</method>
<method name="dump_resources_to_file">
@@ -77,7 +78,7 @@
</argument>
<description>
Dumps all used resources to file (only works in debug).
- Entry format per line: "Resource Type : Resource Location"
+ Entry format per line: "Resource Type : Resource Location".
At the end of the file is a statistic of all used Resource Types.
</description>
</method>
@@ -93,17 +94,24 @@
<argument index="3" name="output" type="Array" default="[ ]">
</argument>
<description>
- Execute the file at the given path, optionally blocking until it returns.
- Platform path resolution will take place. The resolved file must exist and be executable.
- Returns a process id.
- For example:
+ Execute the file at the given path with the arguments passed as an array of strings. Platform path resolution will take place. The resolved file must exist and be executable.
+ The arguments are used in the given order and separated by a space, so [code]OS.execute('ping', ['-c', '3', 'godotengine.org'])[/code] will resolve to [code]ping -c 3 godotengine.org[/code] in the system's shell.
+ This method has slightly different behaviour based on whether the [code]blocking[/code] mode is enabled.
+ When [code]blocking[/code] is enabled, the Godot thread will pause its execution while waiting for the process to terminate. The shell output of the process will be written to the [code]output[/code] array as a single string. When the process terminates, the Godot thread will resume execution.
+ When [code]blocking[/code] is disabled, the Godot thread will continue while the new process runs. It is not possible to retrieve the shell output in non-blocking mode, so [code]output[/code] will be empty.
+ The return value also depends on the blocking mode. When blocking, the method will return -2 (no process ID information is available in blocking mode). When non-blocking, the method returns a process ID, which you can use to monitor the process (and potentially terminate it with [method kill]). If the process forking (non-blocking) or opening (blocking) fails, the method will return -1.
+ Example of blocking mode and retrieving the shell output:
[codeblock]
var output = []
- var pid = OS.execute('ls', [], true, output)
+ OS.execute('ls', ['-l', '/tmp'], true, output)
[/codeblock]
- If you wish to access a shell built-in or perform a composite command, a platform specific shell can be invoked. For example:
+ Example of non-blocking mode, running another instance of the project and storing its process ID:
[codeblock]
- var pid = OS.execute('CMD.exe', ['/C', 'cd %TEMP% &amp;&amp; dir'], true, output)
+ var pid = OS.execute(OS.get_executable_path(), [], false)
+ [/codeblock]
+ If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example:
+ [codeblock]
+ OS.execute('CMD.exe', ['/C', 'cd %TEMP% &amp;&amp; dir'], true, output)
[/codeblock]
</description>
</method>
@@ -116,6 +124,22 @@
Returns the scancode of the given string (e.g. "Escape")
</description>
</method>
+ <method name="get_audio_driver_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the total number of available audio drivers.
+ </description>
+ </method>
+ <method name="get_audio_driver_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="driver" type="int">
+ </argument>
+ <description>
+ Returns the audio driver name for the given index.
+ </description>
+ </method>
<method name="get_cmdline_args">
<return type="PoolStringArray">
</return>
@@ -242,6 +266,7 @@
<return type="Vector2">
</return>
<description>
+ Returns the window size including decorations like window borders.
</description>
</method>
<method name="get_scancode_string" qualifiers="const">
@@ -267,7 +292,6 @@
</argument>
<description>
Returns the dots per inch density of the specified screen.
-
On Android Devices, the actual screen densities are grouped into six generalized densities:
ldpi - 120 dpi
mdpi - 160 dpi
@@ -338,6 +362,13 @@
Returns the amount of time passed in milliseconds since the engine started.
</description>
</method>
+ <method name="get_ticks_usec" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the amount of time passed in microseconds since the engine started.
+ </description>
+ </method>
<method name="get_time" qualifiers="const">
<return type="Dictionary">
</return>
@@ -366,7 +397,7 @@
<return type="int">
</return>
<description>
- Return the current unix timestamp.
+ Returns the current unix epoch timestamp.
</description>
</method>
<method name="get_unix_time_from_datetime" qualifiers="const">
@@ -385,12 +416,37 @@
</return>
<description>
Returns the absolute directory path where user data is written ([code]user://[/code]).
+ On Linux, this is [code]~/.local/share/godot/app_userdata/[project_name][/code], or [code]~/.local/share/[custom_name][/code] if [code]use_custom_user_dir[/code] is set.
+ On macOS, this is [code]~/Library/Application Support/Godot/app_userdata/[project_name][/code], or [code]~/Library/Application Support/[custom_name][/code] if [code]use_custom_user_dir[/code] is set.
+ On Windows, this is [code]%APPDATA%/Godot/app_userdata/[project_name][/code], or [code]%APPDATA%/[custom_name][/code] if [code]use_custom_user_dir[/code] is set.
+ If the project name is empty, [code]user://[/code] falls back to [code]res://[/code].
+ </description>
+ </method>
+ <method name="get_video_driver_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_video_driver_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="driver" type="int">
+ </argument>
+ <description>
</description>
</method>
<method name="get_virtual_keyboard_height">
<return type="int">
</return>
<description>
+ Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or it is currently hidden.
+ </description>
+ </method>
+ <method name="get_window_safe_area" qualifiers="const">
+ <return type="Rect2">
+ </return>
+ <description>
</description>
</method>
<method name="has_environment" qualifiers="const">
@@ -408,6 +464,7 @@
<argument index="0" name="tag_name" type="String">
</argument>
<description>
+ Returns [code]true[/code] if the feature for the given feature tag is supported in the currently running instance, depending on platform, build etc. Can be used to check whether you're currently running a debug build, on a certain platform or arch, etc. See feature tags documentation.
</description>
</method>
<method name="has_touchscreen_ui_hint" qualifiers="const">
@@ -474,6 +531,7 @@
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the window should always be on top of other windows.
</description>
</method>
<method name="kill">
@@ -482,7 +540,8 @@
<argument index="0" name="pid" type="int">
</argument>
<description>
- Kill a process ID (this method can be used to kill processes that were not spawned by the game).
+ Kill (terminate) the process identified by the given process ID ([code]pid[/code]), e.g. the one returned by [method execute] in non-blocking mode.
+ Note that this method can also be used to kill processes that were not spawned by the game.
</description>
</method>
<method name="native_video_is_playing">
@@ -610,6 +669,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
+ Sets whether the window should always be on top.
</description>
</method>
<method name="set_window_title">
@@ -650,27 +710,33 @@
The current screen index (starting from 0).
</member>
<member name="exit_code" type="int" setter="set_exit_code" getter="get_exit_code">
+ The exit code passed to the OS when the main loop exits.
</member>
<member name="keep_screen_on" type="bool" setter="set_keep_screen_on" getter="is_keep_screen_on">
+ If [code]true[/code] the engine tries to keep the screen on while the game is running. Useful on mobile.
</member>
<member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode">
+ If [code]true[/code] the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile.
</member>
<member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation">
The current screen orientation.
</member>
<member name="vsync_enabled" type="bool" setter="set_use_vsync" getter="is_vsync_enabled">
+ If [code]true[/code] vertical synchronization (Vsync) is enabled.
</member>
<member name="window_borderless" type="bool" setter="set_borderless_window" getter="get_borderless_window">
- If [code]true[/code], removes the window frame.
+ If [code]true[/code] removes the window frame.
</member>
<member name="window_fullscreen" type="bool" setter="set_window_fullscreen" getter="is_window_fullscreen">
- If [code]true[/code], the window is fullscreen.
+ If [code]true[/code] the window is fullscreen.
</member>
<member name="window_maximized" type="bool" setter="set_window_maximized" getter="is_window_maximized">
- If [code]true[/code], the window is maximized.
+ If [code]true[/code] the window is maximized.
</member>
<member name="window_minimized" type="bool" setter="set_window_minimized" getter="is_window_minimized">
- If [code]true[/code], the window is minimized.
+ If [code]true[/code] the window is minimized.
+ </member>
+ <member name="window_per_pixel_transparency_enabled" type="bool" setter="set_window_per_pixel_transparency_enabled" getter="get_window_per_pixel_transparency_enabled">
</member>
<member name="window_position" type="Vector2" setter="set_window_position" getter="get_window_position">
The window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right.
@@ -684,82 +750,121 @@
</members>
<constants>
<constant name="DAY_SUNDAY" value="0" enum="Weekday">
+ Sunday.
</constant>
<constant name="DAY_MONDAY" value="1" enum="Weekday">
+ Monday.
</constant>
<constant name="DAY_TUESDAY" value="2" enum="Weekday">
+ Tuesday.
</constant>
<constant name="DAY_WEDNESDAY" value="3" enum="Weekday">
+ Wednesday.
</constant>
<constant name="DAY_THURSDAY" value="4" enum="Weekday">
+ Thursday.
</constant>
<constant name="DAY_FRIDAY" value="5" enum="Weekday">
+ Friday.
</constant>
<constant name="DAY_SATURDAY" value="6" enum="Weekday">
+ Saturday.
</constant>
<constant name="MONTH_JANUARY" value="1" enum="Month">
+ January.
</constant>
<constant name="MONTH_FEBRUARY" value="2" enum="Month">
+ February.
</constant>
<constant name="MONTH_MARCH" value="3" enum="Month">
+ March.
</constant>
<constant name="MONTH_APRIL" value="4" enum="Month">
+ April.
</constant>
<constant name="MONTH_MAY" value="5" enum="Month">
+ May.
</constant>
<constant name="MONTH_JUNE" value="6" enum="Month">
+ June.
</constant>
<constant name="MONTH_JULY" value="7" enum="Month">
+ July.
</constant>
<constant name="MONTH_AUGUST" value="8" enum="Month">
+ August.
</constant>
<constant name="MONTH_SEPTEMBER" value="9" enum="Month">
+ September.
</constant>
<constant name="MONTH_OCTOBER" value="10" enum="Month">
+ October.
</constant>
<constant name="MONTH_NOVEMBER" value="11" enum="Month">
+ November.
</constant>
<constant name="MONTH_DECEMBER" value="12" enum="Month">
+ December.
</constant>
<constant name="SCREEN_ORIENTATION_LANDSCAPE" value="0" enum="ScreenOrientation">
+ Landscape screen orientation.
</constant>
<constant name="SCREEN_ORIENTATION_PORTRAIT" value="1" enum="ScreenOrientation">
+ Portrait screen orientation.
</constant>
<constant name="SCREEN_ORIENTATION_REVERSE_LANDSCAPE" value="2" enum="ScreenOrientation">
+ Reverse landscape screen orientation.
</constant>
<constant name="SCREEN_ORIENTATION_REVERSE_PORTRAIT" value="3" enum="ScreenOrientation">
+ Reverse portrait screen orientation.
</constant>
<constant name="SCREEN_ORIENTATION_SENSOR_LANDSCAPE" value="4" enum="ScreenOrientation">
+ Uses landscape or reverse landscape based on the hardware sensor.
</constant>
<constant name="SCREEN_ORIENTATION_SENSOR_PORTRAIT" value="5" enum="ScreenOrientation">
+ Uses portrait or reverse portrait based on the hardware sensor.
</constant>
<constant name="SCREEN_ORIENTATION_SENSOR" value="6" enum="ScreenOrientation">
+ Uses most suitable orientation based on the hardware sensor.
</constant>
<constant name="SYSTEM_DIR_DESKTOP" value="0" enum="SystemDir">
+ Desktop directory path.
</constant>
<constant name="SYSTEM_DIR_DCIM" value="1" enum="SystemDir">
+ DCIM (Digital Camera Images) directory path.
</constant>
<constant name="SYSTEM_DIR_DOCUMENTS" value="2" enum="SystemDir">
+ Documents directory path.
</constant>
<constant name="SYSTEM_DIR_DOWNLOADS" value="3" enum="SystemDir">
+ Downloads directory path.
</constant>
<constant name="SYSTEM_DIR_MOVIES" value="4" enum="SystemDir">
+ Movies directory path.
</constant>
<constant name="SYSTEM_DIR_MUSIC" value="5" enum="SystemDir">
+ Music directory path.
</constant>
<constant name="SYSTEM_DIR_PICTURES" value="6" enum="SystemDir">
+ Pictures directory path.
</constant>
<constant name="SYSTEM_DIR_RINGTONES" value="7" enum="SystemDir">
+ Ringtones directory path.
</constant>
<constant name="POWERSTATE_UNKNOWN" value="0" enum="PowerState">
+ Unknown powerstate.
</constant>
<constant name="POWERSTATE_ON_BATTERY" value="1" enum="PowerState">
+ Unplugged, running on battery.
</constant>
<constant name="POWERSTATE_NO_BATTERY" value="2" enum="PowerState">
+ Plugged in, no battery available.
</constant>
<constant name="POWERSTATE_CHARGING" value="3" enum="PowerState">
+ Plugged in, battery charging.
</constant>
<constant name="POWERSTATE_CHARGED" value="4" enum="PowerState">
+ Plugged in, battery fully charged.
</constant>
</constants>
</class>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 663eb2be56..ab49bc468c 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Object" category="Core" version="3.1-dev">
+<class name="Object" category="Core" version="3.1">
<brief_description>
Base class for all non built-in types.
</brief_description>
@@ -16,7 +16,7 @@
</demos>
<methods>
<method name="_get" qualifiers="virtual">
- <return type="void">
+ <return type="Variant">
</return>
<argument index="0" name="property" type="String">
</argument>
@@ -398,6 +398,7 @@
<signals>
<signal name="script_changed">
<description>
+ Emitted whenever the script of the Object is changed.
</description>
</signal>
</signals>
diff --git a/doc/classes/OccluderPolygon2D.xml b/doc/classes/OccluderPolygon2D.xml
index 9824c7868d..e8d6b54f27 100644
--- a/doc/classes/OccluderPolygon2D.xml
+++ b/doc/classes/OccluderPolygon2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OccluderPolygon2D" inherits="Resource" category="Core" version="3.1-dev">
+<class name="OccluderPolygon2D" inherits="Resource" category="Core" version="3.1">
<brief_description>
Defines a 2D polygon for LightOccluder2D.
</brief_description>
diff --git a/doc/classes/OmniLight.xml b/doc/classes/OmniLight.xml
index 2fdcc86d55..ff2e77ffbe 100644
--- a/doc/classes/OmniLight.xml
+++ b/doc/classes/OmniLight.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OmniLight" inherits="Light" category="Core" version="3.1-dev">
+<class name="OmniLight" inherits="Light" category="Core" version="3.1">
<brief_description>
OmniDirectional Light, such as a light bulb or a candle.
</brief_description>
@@ -7,7 +7,7 @@
An OmniDirectional light is a type of [Light] node that emits lights in all directions. The light is attenuated through the distance and this attenuation can be configured by changing the energy, radius and attenuation parameters of [Light].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml
index cefb02d724..c58c932b61 100644
--- a/doc/classes/OptionButton.xml
+++ b/doc/classes/OptionButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OptionButton" inherits="Button" category="Core" version="3.1-dev">
+<class name="OptionButton" inherits="Button" category="Core" version="3.1">
<brief_description>
Button control that provides selectable options when pressed.
</brief_description>
@@ -18,7 +18,7 @@
</argument>
<argument index="1" name="label" type="String">
</argument>
- <argument index="2" name="id" type="int">
+ <argument index="2" name="id" type="int" default="-1">
</argument>
<description>
Add an item, with a "texture" icon, text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end.
@@ -194,6 +194,13 @@
</member>
</members>
<signals>
+ <signal name="item_focused">
+ <argument index="0" name="ID" type="int">
+ </argument>
+ <description>
+ This signal is emitted when user navigated to an item using [code]ui_up[/code] or [code]ui_down[/code] action. ID of the item selected is passed as argument (if no IDs were added, ID will be just the item index).
+ </description>
+ </signal>
<signal name="item_selected">
<argument index="0" name="ID" type="int">
</argument>
diff --git a/doc/classes/OrientedPathFollow.xml b/doc/classes/OrientedPathFollow.xml
new file mode 100644
index 0000000000..85d60936ad
--- /dev/null
+++ b/doc/classes/OrientedPathFollow.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="OrientedPathFollow" inherits="Spatial" category="Core" version="3.1">
+ <brief_description>
+ Oriented point sampler for a [Path].
+ </brief_description>
+ <description>
+ This node behaves like [PathFollow], except it uses its parent [Path] up vector information to enforce orientation.
+ Make sure to check if the curve of this node's parent [Path] has up vectors enabled. See [PathFollow] and [Curve3D] for further information.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="cubic_interp" type="bool" setter="set_cubic_interpolation" getter="get_cubic_interpolation">
+ If [code]true[/code] the position between two cached points is interpolated cubically, and linearly otherwise.
+ The points along the [Curve3D] of the [Path] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough.
+ There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations.
+ </member>
+ <member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset">
+ The node's offset along the curve.
+ </member>
+ <member name="loop" type="bool" setter="set_loop" getter="has_loop">
+ If [code]true[/code], any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths.
+ </member>
+ <member name="offset" type="float" setter="set_offset" getter="get_offset">
+ The distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path.
+ </member>
+ <member name="unit_offset" type="float" setter="set_unit_offset" getter="get_unit_offset">
+ The distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length.
+ </member>
+ <member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset">
+ The node's offset perpendicular to the curve.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/PCKPacker.xml b/doc/classes/PCKPacker.xml
index ed7a343f03..01985a9bb3 100644
--- a/doc/classes/PCKPacker.xml
+++ b/doc/classes/PCKPacker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PCKPacker" inherits="Reference" category="Core" version="3.1-dev">
+<class name="PCKPacker" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PHashTranslation.xml b/doc/classes/PHashTranslation.xml
index 52eb2748da..18c72a0576 100644
--- a/doc/classes/PHashTranslation.xml
+++ b/doc/classes/PHashTranslation.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PHashTranslation" inherits="Translation" category="Core" version="3.1-dev">
+<class name="PHashTranslation" inherits="Translation" category="Core" version="3.1">
<brief_description>
Optimized translation.
</brief_description>
diff --git a/doc/classes/PackedDataContainer.xml b/doc/classes/PackedDataContainer.xml
index edabaace8f..e6dbe57925 100644
--- a/doc/classes/PackedDataContainer.xml
+++ b/doc/classes/PackedDataContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PackedDataContainer" inherits="Resource" category="Core" version="3.1-dev">
+<class name="PackedDataContainer" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PackedDataContainerRef.xml b/doc/classes/PackedDataContainerRef.xml
index 2f418991de..371fe5a5ac 100644
--- a/doc/classes/PackedDataContainerRef.xml
+++ b/doc/classes/PackedDataContainerRef.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PackedDataContainerRef" inherits="Reference" category="Core" version="3.1-dev">
+<class name="PackedDataContainerRef" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml
index b6ef9db068..8d810bc9c4 100644
--- a/doc/classes/PackedScene.xml
+++ b/doc/classes/PackedScene.xml
@@ -1,11 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PackedScene" inherits="Resource" category="Core" version="3.1-dev">
+<class name="PackedScene" inherits="Resource" category="Core" version="3.1">
<brief_description>
An abstraction of a serialized scene.
</brief_description>
<description>
A simplified interface to a scene file. Provides access to operations and checks that can be performed on the scene resource itself.
- TODO: explain ownership, and that node does not need to own itself
+ Can be used to save a node to a file. When saving, the node as well as all the node it owns get saved (see [code]owner[/code] property on [Node]). Note that the node doesn't need to own itself.
+ Example of saving a node:
+ [codeblock]
+ var scene = PackedScene.new()
+ var result = scene.pack(child)
+ if result == OK:
+ ResourceSaver.save("res://path/name.scn", scene) // or user://...
+ [/codeblock]
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PacketPeer.xml b/doc/classes/PacketPeer.xml
index 6fdbaf27e6..a4cf0c8029 100644
--- a/doc/classes/PacketPeer.xml
+++ b/doc/classes/PacketPeer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PacketPeer" inherits="Reference" category="Core" version="3.1-dev">
+<class name="PacketPeer" inherits="Reference" category="Core" version="3.1">
<brief_description>
Abstraction and base class for packet-based protocols.
</brief_description>
diff --git a/doc/classes/PacketPeerStream.xml b/doc/classes/PacketPeerStream.xml
index 0ad473f644..9e3195bb44 100644
--- a/doc/classes/PacketPeerStream.xml
+++ b/doc/classes/PacketPeerStream.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PacketPeerStream" inherits="PacketPeer" category="Core" version="3.1-dev">
+<class name="PacketPeerStream" inherits="PacketPeer" category="Core" version="3.1">
<brief_description>
Wrapper to use a PacketPeer over a StreamPeer.
</brief_description>
diff --git a/doc/classes/PacketPeerUDP.xml b/doc/classes/PacketPeerUDP.xml
index 29abcda9d9..d4e3d17de6 100644
--- a/doc/classes/PacketPeerUDP.xml
+++ b/doc/classes/PacketPeerUDP.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PacketPeerUDP" inherits="PacketPeer" category="Core" version="3.1-dev">
+<class name="PacketPeerUDP" inherits="PacketPeer" category="Core" version="3.1">
<brief_description>
UDP packet peer.
</brief_description>
@@ -22,14 +22,14 @@
<return type="String">
</return>
<description>
- Return the IP of the remote peer that sent the last packet(that was received with [method get_packet] or [method get_var]).
+ Return the IP of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
</description>
</method>
<method name="get_packet_port" qualifiers="const">
<return type="int">
</return>
<description>
- Return the port of the remote peer that sent the last packet(that was received with [method get_packet] or [method get_var]).
+ Return the port of the remote peer that sent the last packet(that was received with [method PacketPeer.get_packet] or [method PacketPeer.get_var]).
</description>
</method>
<method name="is_listening" qualifiers="const">
diff --git a/doc/classes/Panel.xml b/doc/classes/Panel.xml
index 3afda37355..758925e969 100644
--- a/doc/classes/Panel.xml
+++ b/doc/classes/Panel.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Panel" inherits="Control" category="Core" version="3.1-dev">
+<class name="Panel" inherits="Control" category="Core" version="3.1">
<brief_description>
Provides an opaque background for [Control] children.
</brief_description>
diff --git a/doc/classes/PanelContainer.xml b/doc/classes/PanelContainer.xml
index 5b76f49687..f5c351fa21 100644
--- a/doc/classes/PanelContainer.xml
+++ b/doc/classes/PanelContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PanelContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="PanelContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
Panel container type.
</brief_description>
diff --git a/doc/classes/PanoramaSky.xml b/doc/classes/PanoramaSky.xml
index 0196f7a73e..402e65c573 100644
--- a/doc/classes/PanoramaSky.xml
+++ b/doc/classes/PanoramaSky.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PanoramaSky" inherits="Sky" category="Core" version="3.1-dev">
+<class name="PanoramaSky" inherits="Sky" category="Core" version="3.1">
<brief_description>
+ A type of [Sky] used to draw a background texture.
</brief_description>
<description>
+ A resource referenced in an [Environment] that is used to draw a background. The Panorama sky functions similar to skyboxes in other engines except it uses a equirectangular sky map instead of a cube map.
</description>
<tutorials>
</tutorials>
@@ -12,6 +14,7 @@
</methods>
<members>
<member name="panorama" type="Texture" setter="set_panorama" getter="get_panorama">
+ [Texture] to be applied to the PanoramaSky.
</member>
</members>
<constants>
diff --git a/doc/classes/ParallaxBackground.xml b/doc/classes/ParallaxBackground.xml
index c8b15b3c7d..2409b7a1c1 100644
--- a/doc/classes/ParallaxBackground.xml
+++ b/doc/classes/ParallaxBackground.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ParallaxBackground" inherits="CanvasLayer" category="Core" version="3.1-dev">
+<class name="ParallaxBackground" inherits="CanvasLayer" category="Core" version="3.1">
<brief_description>
A node used to create a parallax scrolling background.
</brief_description>
diff --git a/doc/classes/ParallaxLayer.xml b/doc/classes/ParallaxLayer.xml
index b5d4e10d7e..662a15e043 100644
--- a/doc/classes/ParallaxLayer.xml
+++ b/doc/classes/ParallaxLayer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ParallaxLayer" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="ParallaxLayer" inherits="Node2D" category="Core" version="3.1">
<brief_description>
A parallax scrolling layer to be used with [ParallaxBackground].
</brief_description>
diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml
index b56c15f246..b03cf6cadb 100644
--- a/doc/classes/Particles.xml
+++ b/doc/classes/Particles.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Particles" inherits="GeometryInstance" category="Core" version="3.1-dev">
+<class name="Particles" inherits="GeometryInstance" category="Core" version="3.1">
<brief_description>
3D particle emitter.
</brief_description>
@@ -22,6 +22,7 @@
<return type="void">
</return>
<description>
+ Restarts the particle emmission, clearing existing particles.
</description>
</method>
</methods>
@@ -33,14 +34,19 @@
Particle draw order. Uses [code]DRAW_ORDER_*[/code] values. Default value: [code]DRAW_ORDER_INDEX[/code].
</member>
<member name="draw_pass_1" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh">
+ [Mesh] that is drawn for the first draw pass.
</member>
<member name="draw_pass_2" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh">
+ [Mesh] that is drawn for the second draw pass.
</member>
<member name="draw_pass_3" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh">
+ [Mesh] that is drawn for the third draw pass.
</member>
<member name="draw_pass_4" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh">
+ [Mesh] that is drawn for the fourth draw pass.
</member>
<member name="draw_passes" type="int" setter="set_draw_passes" getter="get_draw_passes">
+ The number of draw passes when rendering particles.
</member>
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting">
If [code]true[/code] particles are being emitted. Default value: [code]true[/code].
@@ -62,6 +68,7 @@
If [code]true[/code] only [code]amount[/code] particles will be emitted. Default value: [code]false[/code].
</member>
<member name="preprocess" type="float" setter="set_pre_process_time" getter="get_pre_process_time">
+ Amount of time to preprocess the particles before animation starts. Lets you start the animation some time after particles have started emitting.
</member>
<member name="process_material" type="Material" setter="set_process_material" getter="get_process_material">
[Material] for processing particles. Can be a [ParticlesMaterial] or a [ShaderMaterial].
@@ -73,6 +80,7 @@
Speed scaling ratio. Default value: [code]1[/code].
</member>
<member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb">
+ The [AABB] that determines the area of the world part of which needs to be visible on screen for the particle system to be active.
</member>
</members>
<constants>
@@ -86,6 +94,7 @@
Particles are drawn in order of depth.
</constant>
<constant name="MAX_DRAW_PASSES" value="4">
+ Maximum number of draw passes supported.
</constant>
</constants>
</class>
diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml
index 88a373b7a9..47265054b0 100644
--- a/doc/classes/Particles2D.xml
+++ b/doc/classes/Particles2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Particles2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Particles2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
2D particle emitter.
</brief_description>
diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml
index a6c463d307..354b98485e 100644
--- a/doc/classes/ParticlesMaterial.xml
+++ b/doc/classes/ParticlesMaterial.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ParticlesMaterial" inherits="Material" category="Core" version="3.1-dev">
+<class name="ParticlesMaterial" inherits="Material" category="Core" version="3.1">
<brief_description>
Particle properties for [Particles] and [Particles2D] nodes.
</brief_description>
@@ -132,7 +132,7 @@
Orbital velocity randomness ratio. Default value: [code]0[/code].
</member>
<member name="radial_accel" type="float" setter="set_param" getter="get_param">
- Linear acceleration applied to each particle.
+ Radial acceleration applied to each particle.
</member>
<member name="radial_accel_curve" type="Texture" setter="set_param_texture" getter="get_param_texture">
Each particle's radial acceleration will vary along this [CurveTexture].
diff --git a/doc/classes/Path.xml b/doc/classes/Path.xml
index 48d41c89c1..5ece747aaf 100644
--- a/doc/classes/Path.xml
+++ b/doc/classes/Path.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Path" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Path" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Container for a [Curve3D].
</brief_description>
@@ -16,6 +16,12 @@
<member name="curve" type="Curve3D" setter="set_curve" getter="get_curve">
</member>
</members>
+ <signals>
+ <signal name="curve_changed">
+ <description>
+ </description>
+ </signal>
+ </signals>
<constants>
</constants>
</class>
diff --git a/doc/classes/Path2D.xml b/doc/classes/Path2D.xml
index dcef22c241..5e40fb6956 100644
--- a/doc/classes/Path2D.xml
+++ b/doc/classes/Path2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Path2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Path2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Contains a [Curve2D] path for [PathFollow2D] nodes to follow.
</brief_description>
diff --git a/doc/classes/PathFollow.xml b/doc/classes/PathFollow.xml
index c248e6f868..650fed7ec6 100644
--- a/doc/classes/PathFollow.xml
+++ b/doc/classes/PathFollow.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PathFollow" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="PathFollow" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Point sampler for a [Path].
</brief_description>
diff --git a/doc/classes/PathFollow2D.xml b/doc/classes/PathFollow2D.xml
index 995c65d4fa..f9940dab2f 100644
--- a/doc/classes/PathFollow2D.xml
+++ b/doc/classes/PathFollow2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PathFollow2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="PathFollow2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Point sampler for a [Path2D].
</brief_description>
diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml
index c67b9e2f07..de3a251a79 100644
--- a/doc/classes/Performance.xml
+++ b/doc/classes/Performance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Performance" inherits="Object" category="Core" version="3.1-dev">
+<class name="Performance" inherits="Object" category="Core" version="3.1">
<brief_description>
Exposes performance related data.
</brief_description>
diff --git a/doc/classes/PhysicalBone.xml b/doc/classes/PhysicalBone.xml
new file mode 100644
index 0000000000..99f551b865
--- /dev/null
+++ b/doc/classes/PhysicalBone.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="PhysicalBone" inherits="PhysicsBody" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_simulate_physics">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_simulating_physics">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_static_body">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="body_offset" type="Transform" setter="set_body_offset" getter="get_body_offset">
+ </member>
+ <member name="bounce" type="float" setter="set_bounce" getter="get_bounce">
+ </member>
+ <member name="friction" type="float" setter="set_friction" getter="get_friction">
+ </member>
+ <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale">
+ </member>
+ <member name="joint_offset" type="Transform" setter="set_joint_offset" getter="get_joint_offset">
+ </member>
+ <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone.JointType">
+ </member>
+ <member name="mass" type="float" setter="set_mass" getter="get_mass">
+ </member>
+ <member name="weight" type="float" setter="set_weight" getter="get_weight">
+ </member>
+ </members>
+ <constants>
+ <constant name="JOINT_TYPE_NONE" value="0" enum="JointType">
+ </constant>
+ <constant name="JOINT_TYPE_PIN" value="1" enum="JointType">
+ </constant>
+ <constant name="JOINT_TYPE_CONE" value="2" enum="JointType">
+ </constant>
+ <constant name="JOINT_TYPE_HINGE" value="3" enum="JointType">
+ </constant>
+ <constant name="JOINT_TYPE_SLIDER" value="4" enum="JointType">
+ </constant>
+ <constant name="JOINT_TYPE_6DOF" value="5" enum="JointType">
+ </constant>
+ </constants>
+</class>
diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/Physics2DDirectBodyState.xml
index d1634974f4..73a2d792ab 100644
--- a/doc/classes/Physics2DDirectBodyState.xml
+++ b/doc/classes/Physics2DDirectBodyState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DDirectBodyState" inherits="Object" category="Core" version="3.1-dev">
+<class name="Physics2DDirectBodyState" inherits="Object" category="Core" version="3.1">
<brief_description>
Direct access object to a physics body in the [Physics2DServer].
</brief_description>
diff --git a/doc/classes/Physics2DDirectBodyStateSW.xml b/doc/classes/Physics2DDirectBodyStateSW.xml
index 7d04e483ff..cb1e9239b3 100644
--- a/doc/classes/Physics2DDirectBodyStateSW.xml
+++ b/doc/classes/Physics2DDirectBodyStateSW.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DDirectBodyStateSW" inherits="Physics2DDirectBodyState" category="Core" version="3.1-dev">
+<class name="Physics2DDirectBodyStateSW" inherits="Physics2DDirectBodyState" category="Core" version="3.1">
<brief_description>
Software implementation of [Physics2DDirectBodyState].
</brief_description>
diff --git a/doc/classes/Physics2DDirectSpaceState.xml b/doc/classes/Physics2DDirectSpaceState.xml
index b3a33e9216..f0fee77a5a 100644
--- a/doc/classes/Physics2DDirectSpaceState.xml
+++ b/doc/classes/Physics2DDirectSpaceState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DDirectSpaceState" inherits="Object" category="Core" version="3.1-dev">
+<class name="Physics2DDirectSpaceState" inherits="Object" category="Core" version="3.1">
<brief_description>
Direct access object to a space in the [Physics2DServer].
</brief_description>
@@ -7,7 +7,7 @@
Direct access object to a space in the [Physics2DServer]. It's used mainly to do queries against objects and areas residing in a given space.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/Physics2DServer.xml
index 644731516f..c302797704 100644
--- a/doc/classes/Physics2DServer.xml
+++ b/doc/classes/Physics2DServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DServer" inherits="Object" category="Core" version="3.1-dev">
+<class name="Physics2DServer" inherits="Object" category="Core" version="3.1">
<brief_description>
Physics 2D Server.
</brief_description>
@@ -140,6 +140,18 @@
Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
</description>
</method>
+ <method name="area_set_area_monitor_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="area" type="RID">
+ </argument>
+ <argument index="1" name="receiver" type="Object">
+ </argument>
+ <argument index="2" name="method" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="area_set_collision_layer">
<return type="void">
</return>
@@ -180,6 +192,16 @@
5: The shape index of the area where the object entered/exited.
</description>
</method>
+ <method name="area_set_monitorable">
+ <return type="void">
+ </return>
+ <argument index="0" name="area" type="RID">
+ </argument>
+ <argument index="1" name="monitorable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="area_set_param">
<return type="void">
</return>
@@ -566,7 +588,7 @@
<argument index="3" name="userdata" type="Variant" default="null">
</argument>
<description>
- Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]).
+ Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force_integration]).
</description>
</method>
<method name="body_set_max_contacts_reported">
@@ -688,7 +710,7 @@
<argument index="1" name="space" type="RID">
</argument>
<description>
- Assigns a space to the body (see [method create_space]).
+ Assigns a space to the body (see [method space_create]).
</description>
</method>
<method name="body_set_state">
@@ -713,9 +735,11 @@
</argument>
<argument index="2" name="motion" type="Vector2">
</argument>
- <argument index="3" name="margin" type="float" default="0.08">
+ <argument index="3" name="infinite_inertia" type="bool">
+ </argument>
+ <argument index="4" name="margin" type="float" default="0.08">
</argument>
- <argument index="4" name="result" type="Physics2DTestMotionResult" default="null">
+ <argument index="5" name="result" type="Physics2DTestMotionResult" default="null">
</argument>
<description>
Returns whether a body can move from a given point in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in.
diff --git a/doc/classes/Physics2DServerSW.xml b/doc/classes/Physics2DServerSW.xml
index 25ca5dd4d2..49157bd94b 100644
--- a/doc/classes/Physics2DServerSW.xml
+++ b/doc/classes/Physics2DServerSW.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DServerSW" inherits="Physics2DServer" category="Core" version="3.1-dev">
+<class name="Physics2DServerSW" inherits="Physics2DServer" category="Core" version="3.1">
<brief_description>
Software implementation of [Physics2DServer].
</brief_description>
diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/Physics2DShapeQueryParameters.xml
index 209623c62a..391ad6276f 100644
--- a/doc/classes/Physics2DShapeQueryParameters.xml
+++ b/doc/classes/Physics2DShapeQueryParameters.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DShapeQueryParameters" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Physics2DShapeQueryParameters" inherits="Reference" category="Core" version="3.1">
<brief_description>
Parameters to be sent to a 2D shape physics query.
</brief_description>
diff --git a/doc/classes/Physics2DShapeQueryResult.xml b/doc/classes/Physics2DShapeQueryResult.xml
index 2e2180ee0f..52e7294e24 100644
--- a/doc/classes/Physics2DShapeQueryResult.xml
+++ b/doc/classes/Physics2DShapeQueryResult.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DShapeQueryResult" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Physics2DShapeQueryResult" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Physics2DTestMotionResult.xml b/doc/classes/Physics2DTestMotionResult.xml
index 943ef72ffb..3b864433f0 100644
--- a/doc/classes/Physics2DTestMotionResult.xml
+++ b/doc/classes/Physics2DTestMotionResult.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DTestMotionResult" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Physics2DTestMotionResult" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody.xml
index b765bb1f1f..14053c6a35 100644
--- a/doc/classes/PhysicsBody.xml
+++ b/doc/classes/PhysicsBody.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsBody" inherits="CollisionObject" category="Core" version="3.1-dev">
+<class name="PhysicsBody" inherits="CollisionObject" category="Core" version="3.1">
<brief_description>
Base class for all objects affected by physics in 3D space.
</brief_description>
@@ -7,7 +7,7 @@
PhysicsBody is an abstract base class for implementing a physics body. All *Body types inherit from it.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/PhysicsBody2D.xml b/doc/classes/PhysicsBody2D.xml
index 80d72512fe..ccc704c7ec 100644
--- a/doc/classes/PhysicsBody2D.xml
+++ b/doc/classes/PhysicsBody2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core" version="3.1-dev">
+<class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core" version="3.1">
<brief_description>
Base class for all objects affected by physics in 2D space.
</brief_description>
@@ -7,7 +7,7 @@
PhysicsBody2D is an abstract base class for implementing a physics body. All *Body2D types inherit from it.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState.xml
index fa0e529a73..74190d0780 100644
--- a/doc/classes/PhysicsDirectBodyState.xml
+++ b/doc/classes/PhysicsDirectBodyState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsDirectBodyState" inherits="Object" category="Core" version="3.1-dev">
+<class name="PhysicsDirectBodyState" inherits="Object" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
@@ -9,6 +9,14 @@
<demos>
</demos>
<methods>
+ <method name="add_central_force">
+ <return type="void">
+ </return>
+ <argument index="0" name="force" type="Vector3">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="add_force">
<return type="void">
</return>
@@ -19,6 +27,14 @@
<description>
</description>
</method>
+ <method name="add_torque">
+ <return type="void">
+ </return>
+ <argument index="0" name="torque" type="Vector3">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="apply_impulse">
<return type="void">
</return>
@@ -29,7 +45,7 @@
<description>
</description>
</method>
- <method name="apply_torqe_impulse">
+ <method name="apply_torque_impulse">
<return type="void">
</return>
<argument index="0" name="j" type="Vector3">
diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState.xml
index e33718edf0..3f0e1a4f70 100644
--- a/doc/classes/PhysicsDirectSpaceState.xml
+++ b/doc/classes/PhysicsDirectSpaceState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsDirectSpaceState" inherits="Object" category="Core" version="3.1-dev">
+<class name="PhysicsDirectSpaceState" inherits="Object" category="Core" version="3.1">
<brief_description>
Direct access object to a space in the [PhysicsServer].
</brief_description>
@@ -7,7 +7,7 @@
Direct access object to a space in the [PhysicsServer]. It's used mainly to do queries against objects and areas residing in a given space.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml
index 02172a310d..6efbfdb519 100644
--- a/doc/classes/PhysicsServer.xml
+++ b/doc/classes/PhysicsServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsServer" inherits="Object" category="Core" version="3.1-dev">
+<class name="PhysicsServer" inherits="Object" category="Core" version="3.1">
<brief_description>
Server interface for low level physics access.
</brief_description>
@@ -149,6 +149,18 @@
Removes a shape from an area. It does not delete the shape, so it can be reassigned later.
</description>
</method>
+ <method name="area_set_area_monitor_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="area" type="RID">
+ </argument>
+ <argument index="1" name="receiver" type="Object">
+ </argument>
+ <argument index="2" name="method" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="area_set_collision_layer">
<return type="void">
</return>
@@ -189,6 +201,16 @@
5: The shape index of the area where the object entered/exited.
</description>
</method>
+ <method name="area_set_monitorable">
+ <return type="void">
+ </return>
+ <argument index="0" name="area" type="RID">
+ </argument>
+ <argument index="1" name="monitorable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="area_set_param">
<return type="void">
</return>
@@ -605,7 +627,7 @@
<argument index="3" name="userdata" type="Variant" default="null">
</argument>
<description>
- Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]).
+ Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force_integration]).
</description>
</method>
<method name="body_set_kinematic_safe_margin">
@@ -1331,31 +1353,37 @@
<constant name="G6DOF_JOINT_LINEAR_DAMPING" value="4" enum="G6DOFJointAxisParam">
The amount of damping that happens at the linear motion across the axes.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_LOWER_LIMIT" value="5" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY" value="5" enum="G6DOFJointAxisParam">
+ The velocity that the joint's linear motor will attempt to reach.
+ </constant>
+ <constant name="G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT" value="6" enum="G6DOFJointAxisParam">
+ The maximum force that the linear motor can apply while trying to reach the target velocity.
+ </constant>
+ <constant name="G6DOF_JOINT_ANGULAR_LOWER_LIMIT" value="7" enum="G6DOFJointAxisParam">
The minimum rotation in negative direction to break loose and rotate around the axes.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_UPPER_LIMIT" value="6" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_UPPER_LIMIT" value="8" enum="G6DOFJointAxisParam">
The minimum rotation in positive direction to break loose and rotate around the axes.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS" value="7" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS" value="9" enum="G6DOFJointAxisParam">
A factor that gets multiplied onto all rotations across the axes.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_DAMPING" value="8" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_DAMPING" value="10" enum="G6DOFJointAxisParam">
The amount of rotational damping across the axes. The lower, the more dampening occurs.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_RESTITUTION" value="9" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_RESTITUTION" value="11" enum="G6DOFJointAxisParam">
The amount of rotational restitution across the axes. The lower, the more restitution occurs.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_FORCE_LIMIT" value="10" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_FORCE_LIMIT" value="12" enum="G6DOFJointAxisParam">
The maximum amount of force that can occur, when rotating around the axes.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_ERP" value="11" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_ERP" value="13" enum="G6DOFJointAxisParam">
When correcting the crossing of limits in rotation across the axes, this error tolerance factor defines how much the correction gets slowed down. The lower, the slower.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY" value="12" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY" value="14" enum="G6DOFJointAxisParam">
Target speed for the motor at the axes.
</constant>
- <constant name="G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT" value="13" enum="G6DOFJointAxisParam">
+ <constant name="G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT" value="15" enum="G6DOFJointAxisParam">
Maximum acceleration for the motor at the axes.
</constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT" value="0" enum="G6DOFJointAxisFlag">
@@ -1367,6 +1395,9 @@
<constant name="G6DOF_JOINT_FLAG_ENABLE_MOTOR" value="2" enum="G6DOFJointAxisFlag">
If [code]set[/code] there is a rotational motor across these axes.
</constant>
+ <constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR" value="3" enum="G6DOFJointAxisFlag">
+ If [code]set[/code] there is a linear motor on this axis that targets a specific velocity.
+ </constant>
<constant name="SHAPE_PLANE" value="0" enum="ShapeType">
The [Shape] is a [PlaneShape].
</constant>
diff --git a/doc/classes/PhysicsShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters.xml
index 6bd37dda32..2f36e81e27 100644
--- a/doc/classes/PhysicsShapeQueryParameters.xml
+++ b/doc/classes/PhysicsShapeQueryParameters.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryParameters" inherits="Reference" category="Core" version="3.1-dev">
+<class name="PhysicsShapeQueryParameters" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PhysicsShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult.xml
index bb78071e85..080d7389b7 100644
--- a/doc/classes/PhysicsShapeQueryResult.xml
+++ b/doc/classes/PhysicsShapeQueryResult.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryResult" inherits="Reference" category="Core" version="3.1-dev">
+<class name="PhysicsShapeQueryResult" inherits="Reference" category="Core" version="3.1">
<brief_description>
Result of a shape query in Physics2DServer.
</brief_description>
diff --git a/doc/classes/PinJoint.xml b/doc/classes/PinJoint.xml
index 7c94347008..470c22cd4c 100644
--- a/doc/classes/PinJoint.xml
+++ b/doc/classes/PinJoint.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PinJoint" inherits="Joint" category="Core" version="3.1-dev">
+<class name="PinJoint" inherits="Joint" category="Core" version="3.1">
<brief_description>
Pin Joint for 3D Shapes.
</brief_description>
diff --git a/doc/classes/PinJoint2D.xml b/doc/classes/PinJoint2D.xml
index 0982ffacae..42708151ec 100644
--- a/doc/classes/PinJoint2D.xml
+++ b/doc/classes/PinJoint2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PinJoint2D" inherits="Joint2D" category="Core" version="3.1-dev">
+<class name="PinJoint2D" inherits="Joint2D" category="Core" version="3.1">
<brief_description>
Pin Joint for 2D Shapes.
</brief_description>
<description>
- Pin Joint for 2D Rigid Bodies. It pins 2 bodies (rigid or static) together, or a single body to a fixed position in space.
+ Pin Joint for 2D Rigid Bodies. It pins two bodies (rigid or static) together.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml
index f478b2d384..6f616401cb 100644
--- a/doc/classes/Plane.xml
+++ b/doc/classes/Plane.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Plane" category="Built-In Types" version="3.1-dev">
+<class name="Plane" category="Built-In Types" version="3.1">
<brief_description>
Plane in hessian form.
</brief_description>
@@ -7,7 +7,7 @@
Plane represents a normalized plane equation. Basically, "normal" is the normal of the plane (a,b,c normalized), and "d" is the distance from the origin to the plane (in the direction of "normal"). "Over" or "Above" the plane is considered the side of the plane towards where the normal is pointing.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/math/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/math/index.html</link>
</tutorials>
<demos>
</demos>
@@ -24,7 +24,7 @@
<argument index="3" name="d" type="float">
</argument>
<description>
- Creates a plane from the three parameters "a", "b", "c" and "d".
+ Creates a plane from the four parameters "a", "b", "c" and "d".
</description>
</method>
<method name="Plane">
diff --git a/doc/classes/PlaneMesh.xml b/doc/classes/PlaneMesh.xml
index 60bc1f6613..fc293ab4df 100644
--- a/doc/classes/PlaneMesh.xml
+++ b/doc/classes/PlaneMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PlaneMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="PlaneMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Class representing a planar [PrimitiveMesh].
</brief_description>
diff --git a/doc/classes/PlaneShape.xml b/doc/classes/PlaneShape.xml
index e0c1fdf25b..bc3faf7c01 100644
--- a/doc/classes/PlaneShape.xml
+++ b/doc/classes/PlaneShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PlaneShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="PlaneShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Polygon2D.xml b/doc/classes/Polygon2D.xml
index a538cd2f05..bf4519fd0a 100644
--- a/doc/classes/Polygon2D.xml
+++ b/doc/classes/Polygon2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Polygon2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Polygon2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
A 2D polygon.
</brief_description>
@@ -11,11 +11,79 @@
<demos>
</demos>
<methods>
+ <method name="add_bone">
+ <return type="void">
+ </return>
+ <argument index="0" name="path" type="NodePath">
+ </argument>
+ <argument index="1" name="weights" type="PoolRealArray">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="clear_bones">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="erase_bone">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_bone_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_bone_path" qualifiers="const">
+ <return type="NodePath">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_bone_weights" qualifiers="const">
+ <return type="PoolRealArray">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_bone_path">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <argument index="1" name="path" type="NodePath">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_bone_weights">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <argument index="1" name="weights" type="PoolRealArray">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased">
If [code]true[/code] polygon edges will be anti-aliased. Default value: [code]false[/code].
</member>
+ <member name="bones" type="Array" setter="_set_bones" getter="_get_bones">
+ </member>
<member name="color" type="Color" setter="set_color" getter="get_color">
The polygon's fill color. If [code]texture[/code] is defined, it will be multiplied by this color. It will also be the default color for vertices not set in [code]vertex_colors[/code].
</member>
@@ -31,6 +99,10 @@
<member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
The polygon's list of vertices. The final point will be connected to the first.
</member>
+ <member name="skeleton" type="NodePath" setter="set_skeleton" getter="get_skeleton">
+ </member>
+ <member name="splits" type="PoolIntArray" setter="set_splits" getter="get_splits">
+ </member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
The polygon's fill texture. Use [code]uv[/code] to set texture coordinates.
</member>
diff --git a/doc/classes/PolygonPathFinder.xml b/doc/classes/PolygonPathFinder.xml
index 3c57b4ca18..e4a4d9b976 100644
--- a/doc/classes/PolygonPathFinder.xml
+++ b/doc/classes/PolygonPathFinder.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PolygonPathFinder" inherits="Resource" category="Core" version="3.1-dev">
+<class name="PolygonPathFinder" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml
index 7982c91ea9..120d80ba39 100644
--- a/doc/classes/PoolByteArray.xml
+++ b/doc/classes/PoolByteArray.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolByteArray" category="Built-In Types" version="3.1-dev">
+<class name="PoolByteArray" category="Built-In Types" version="3.1">
<brief_description>
Raw byte array.
</brief_description>
<description>
- Raw byte array. Contains bytes. Optimized for memory usage, can't fragment the memory.
+ Raw byte array. Contains bytes. Optimized for memory usage, can't fragment the memory. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml
index c61f39b238..0c93a565f5 100644
--- a/doc/classes/PoolColorArray.xml
+++ b/doc/classes/PoolColorArray.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolColorArray" category="Built-In Types" version="3.1-dev">
+<class name="PoolColorArray" category="Built-In Types" version="3.1">
<brief_description>
Array of Colors
</brief_description>
<description>
- Array of Color, Contains colors. Optimized for memory usage, can't fragment the memory.
+ Array of Color, Contains colors. Optimized for memory usage, can't fragment the memory. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml
index 7b9bb96730..43cb5d77de 100644
--- a/doc/classes/PoolIntArray.xml
+++ b/doc/classes/PoolIntArray.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolIntArray" category="Built-In Types" version="3.1-dev">
+<class name="PoolIntArray" category="Built-In Types" version="3.1">
<brief_description>
Integer Array.
</brief_description>
<description>
- Integer Array. Contains integers. Optimized for memory usage, can't fragment the memory.
+ Integer Array. Contains integers. Optimized for memory usage, can't fragment the memory. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml
index b0f971ae3e..0808b44104 100644
--- a/doc/classes/PoolRealArray.xml
+++ b/doc/classes/PoolRealArray.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolRealArray" category="Built-In Types" version="3.1-dev">
+<class name="PoolRealArray" category="Built-In Types" version="3.1">
<brief_description>
Real Array.
</brief_description>
<description>
- Real Array. Array of floating point values. Can only contain floats. Optimized for memory usage, can't fragment the memory.
+ Real Array. Array of floating point values. Can only contain floats. Optimized for memory usage, can't fragment the memory. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml
index 9db0af34be..9f6c4306cb 100644
--- a/doc/classes/PoolStringArray.xml
+++ b/doc/classes/PoolStringArray.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolStringArray" category="Built-In Types" version="3.1-dev">
+<class name="PoolStringArray" category="Built-In Types" version="3.1">
<brief_description>
String Array.
</brief_description>
<description>
- String Array. Array of strings. Can only contain strings. Optimized for memory usage, can't fragment the memory.
+ String Array. Array of strings. Can only contain strings. Optimized for memory usage, can't fragment the memory. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml
index 5c8599f220..072281158c 100644
--- a/doc/classes/PoolVector2Array.xml
+++ b/doc/classes/PoolVector2Array.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolVector2Array" category="Built-In Types" version="3.1-dev">
+<class name="PoolVector2Array" category="Built-In Types" version="3.1">
<brief_description>
An Array of Vector2.
</brief_description>
<description>
- An Array specifically designed to hold Vector2.
+ An Array specifically designed to hold Vector2. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml
index 944bb767e0..7aa5dfc090 100644
--- a/doc/classes/PoolVector3Array.xml
+++ b/doc/classes/PoolVector3Array.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PoolVector3Array" category="Built-In Types" version="3.1-dev">
+<class name="PoolVector3Array" category="Built-In Types" version="3.1">
<brief_description>
An Array of Vector3.
</brief_description>
<description>
- An Array specifically designed to hold Vector3.
+ An Array specifically designed to hold Vector3. Note that this type is passed by value and not by reference.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Popup.xml b/doc/classes/Popup.xml
index b6ee43254e..ae5bce5d7d 100644
--- a/doc/classes/Popup.xml
+++ b/doc/classes/Popup.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Popup" inherits="Control" category="Core" version="3.1-dev">
+<class name="Popup" inherits="Control" category="Core" version="3.1">
<brief_description>
Base container control for popups and dialogs.
</brief_description>
@@ -50,6 +50,7 @@
</methods>
<members>
<member name="popup_exclusive" type="bool" setter="set_exclusive" getter="is_exclusive">
+ If [code]true[/code] the popup will not be hidden when a click event occurs outside of it, or when it receives the [code]ui_cancel[/code] action event.
</member>
</members>
<signals>
diff --git a/doc/classes/PopupDialog.xml b/doc/classes/PopupDialog.xml
index eac361f404..4f15fb4b05 100644
--- a/doc/classes/PopupDialog.xml
+++ b/doc/classes/PopupDialog.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PopupDialog" inherits="Popup" category="Core" version="3.1-dev">
+<class name="PopupDialog" inherits="Popup" category="Core" version="3.1">
<brief_description>
Base class for Popup Dialogs.
</brief_description>
diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml
index 62911c1cf7..89d8c43c00 100644
--- a/doc/classes/PopupMenu.xml
+++ b/doc/classes/PopupMenu.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PopupMenu" inherits="Popup" category="Core" version="3.1-dev">
+<class name="PopupMenu" inherits="Popup" category="Core" version="3.1">
<brief_description>
PopupMenu displays a list of options.
</brief_description>
@@ -108,6 +108,31 @@
Add a new item with text "label". An id can optionally be provided, as well as an accelerator keybinding. If no id is provided, one will be created from the index.
</description>
</method>
+ <method name="add_radio_check_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="label" type="String">
+ </argument>
+ <argument index="1" name="id" type="int" default="-1">
+ </argument>
+ <argument index="2" name="accel" type="int" default="0">
+ </argument>
+ <description>
+ The same as [method add_check_item] but the inserted item will look as a radio button. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
+ </description>
+ </method>
+ <method name="add_radio_check_shortcut">
+ <return type="void">
+ </return>
+ <argument index="0" name="shortcut" type="ShortCut">
+ </argument>
+ <argument index="1" name="id" type="int" default="-1">
+ </argument>
+ <argument index="2" name="global" type="bool" default="false">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="add_separator">
<return type="void">
</return>
@@ -239,7 +264,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return whether the item at index "idx" has a checkbox. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
+ Return whether the item at index "idx" is checkable in some way, i.e., whether has a checkbox or radio button. Note that checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
</description>
</method>
<method name="is_item_checked" qualifiers="const">
@@ -248,7 +273,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Return the checkstate status of the item at index "idx".
+ Return whether the item at index "idx" is checked.
</description>
</method>
<method name="is_item_disabled" qualifiers="const">
@@ -260,6 +285,15 @@
Return whether the item at index "idx" is disabled. When it is disabled it can't be selected, or its action invoked.
</description>
</method>
+ <method name="is_item_radio_checkable" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ Return whether the item at index "idx" has radio-button-style checkability. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
+ </description>
+ </method>
<method name="is_item_separator" qualifiers="const">
<return type="bool">
</return>
@@ -269,6 +303,14 @@
Return whether the item is a separator. If it is, it would be displayed as a line.
</description>
</method>
+ <method name="is_item_shortcut_disabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="remove_item">
<return type="void">
</return>
@@ -300,6 +342,18 @@
Set whether the item at index "idx" has a checkbox. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
</description>
</method>
+ <method name="set_item_as_radio_checkable">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="enable" type="bool">
+ </argument>
+ <description>
+ The same as [method set_item_as_checkable] but placing a radio button in case of enabling. If used for disabling, it's the same.
+ Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
+ </description>
+ </method>
<method name="set_item_as_separator">
<return type="void">
</return>
@@ -387,6 +441,16 @@
<description>
</description>
</method>
+ <method name="set_item_shortcut_disabled">
+ <return type="void">
+ </return>
+ <argument index="0" name="idx" type="int">
+ </argument>
+ <argument index="1" name="disabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_item_submenu">
<return type="void">
</return>
@@ -445,6 +509,13 @@
</member>
</members>
<signals>
+ <signal name="id_focused">
+ <argument index="0" name="ID" type="int">
+ </argument>
+ <description>
+ This event is emitted when user navigated to an item of some id using [code]ui_up[/code] or [code]ui_down[/code] action.
+ </description>
+ </signal>
<signal name="id_pressed">
<argument index="0" name="ID" type="int">
</argument>
@@ -483,6 +554,10 @@
</theme_item>
<theme_item name="panel_disabled" type="StyleBox">
</theme_item>
+ <theme_item name="radio_checked" type="Texture">
+ </theme_item>
+ <theme_item name="radio_unchecked" type="Texture">
+ </theme_item>
<theme_item name="separator" type="StyleBox">
</theme_item>
<theme_item name="submenu" type="Texture">
diff --git a/doc/classes/PopupPanel.xml b/doc/classes/PopupPanel.xml
index 5e8e24d36f..694c29efda 100644
--- a/doc/classes/PopupPanel.xml
+++ b/doc/classes/PopupPanel.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PopupPanel" inherits="Popup" category="Core" version="3.1-dev">
+<class name="PopupPanel" inherits="Popup" category="Core" version="3.1">
<brief_description>
Class for displaying popups with a panel background.
</brief_description>
diff --git a/doc/classes/Position2D.xml b/doc/classes/Position2D.xml
index 3e29000c5b..6c26bf412c 100644
--- a/doc/classes/Position2D.xml
+++ b/doc/classes/Position2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Position2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Position2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Generic 2D Position hint for editing.
</brief_description>
diff --git a/doc/classes/Position3D.xml b/doc/classes/Position3D.xml
index 2719cdb7f3..7c0875cc0c 100644
--- a/doc/classes/Position3D.xml
+++ b/doc/classes/Position3D.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Position3D" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Position3D" inherits="Spatial" category="Core" version="3.1">
<brief_description>
- Generic 3D Position hint for editing
+ Generic 3D Position hint for editing.
</brief_description>
<description>
Generic 3D Position hint for editing. It's just like a plain [Spatial] but displays as a cross in the 3D-Editor at all times.
diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml
index 8fd8e5da1e..0f0511258b 100644
--- a/doc/classes/PrimitiveMesh.xml
+++ b/doc/classes/PrimitiveMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PrimitiveMesh" inherits="Mesh" category="Core" version="3.1-dev">
+<class name="PrimitiveMesh" inherits="Mesh" category="Core" version="3.1">
<brief_description>
Base class for all primitive meshes. Handles applying a [Material] to a primitive mesh.
</brief_description>
@@ -19,6 +19,10 @@
</method>
</methods>
<members>
+ <member name="custom_aabb" type="AABB" setter="set_custom_aabb" getter="get_custom_aabb">
+ </member>
+ <member name="flip_faces" type="bool" setter="set_flip_faces" getter="get_flip_faces">
+ </member>
<member name="material" type="Material" setter="set_material" getter="get_material">
The current [Material] of the primitive mesh.
</member>
diff --git a/doc/classes/PrismMesh.xml b/doc/classes/PrismMesh.xml
index 58f7a0dd09..11815d299b 100644
--- a/doc/classes/PrismMesh.xml
+++ b/doc/classes/PrismMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PrismMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="PrismMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Class representing a prism-shaped [PrimitiveMesh].
</brief_description>
@@ -14,7 +14,7 @@
</methods>
<members>
<member name="left_to_right" type="float" setter="set_left_to_right" getter="get_left_to_right">
- Displacement of of the upper edge along the x-axis. 0.0 positions edge straight above the bottome left edge. Defaults to 0.5 (positioned on the midpoint).
+ Displacement of the upper edge along the x-axis. 0.0 positions edge straight above the bottome left edge. Defaults to 0.5 (positioned on the midpoint).
</member>
<member name="size" type="Vector3" setter="set_size" getter="get_size">
Size of the prism. Defaults to (2.0, 2.0, 2.0).
diff --git a/doc/classes/ProceduralSky.xml b/doc/classes/ProceduralSky.xml
index 75831465ed..df0519b2ad 100644
--- a/doc/classes/ProceduralSky.xml
+++ b/doc/classes/ProceduralSky.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ProceduralSky" inherits="Sky" category="Core" version="3.1-dev">
+<class name="ProceduralSky" inherits="Sky" category="Core" version="3.1">
<brief_description>
+ Type of [Sky] that is generated procedurally based on user input parameters.
</brief_description>
<description>
+ ProceduralSky provides a way to create an effective background quickly by defining procedural parameters for the sun, the sky and the ground. The sky and ground are very similar, they are defined by a color at the horizon, another color, and finally an easing curve to interpolate between these two colors. Similarly the sun is described by a position in the sky, a color, and an easing curve. However, the sun also defines a minimum and maximum angle, these two values define at what distance the easing curve begins and ends from the sun, and thus end up defining the size of the sun in the sky.
+ The ProceduralSky is updated on the CPU after the parameters change and stored in a texture and then displayed as a background in the scene. This makes it relatively unsuitable for realtime updates during gameplay. But with a small texture size it is still feasible to update relatively frequently becuase it is updated on a background thread when multi-threading is available.
</description>
<tutorials>
</tutorials>
@@ -12,36 +15,52 @@
</methods>
<members>
<member name="ground_bottom_color" type="Color" setter="set_ground_bottom_color" getter="get_ground_bottom_color">
+ Color of the ground at the bottom.
</member>
<member name="ground_curve" type="float" setter="set_ground_curve" getter="get_ground_curve">
+ How quickly the [member ground_horizon_color] fades into the [member ground_bottom_color].
</member>
<member name="ground_energy" type="float" setter="set_ground_energy" getter="get_ground_energy">
+ Amount of energy contribution from the ground.
</member>
<member name="ground_horizon_color" type="Color" setter="set_ground_horizon_color" getter="get_ground_horizon_color">
+ Color of the ground at the horizon.
</member>
<member name="sky_curve" type="float" setter="set_sky_curve" getter="get_sky_curve">
+ How quickly the [member sky_horizon_color] fades into the [member sky_top_color].
</member>
<member name="sky_energy" type="float" setter="set_sky_energy" getter="get_sky_energy">
+ Amount of energy contribution from the sky.
</member>
<member name="sky_horizon_color" type="Color" setter="set_sky_horizon_color" getter="get_sky_horizon_color">
+ Color of the sky at the horizon.
</member>
<member name="sky_top_color" type="Color" setter="set_sky_top_color" getter="get_sky_top_color">
+ Color of the sky at the top.
</member>
<member name="sun_angle_max" type="float" setter="set_sun_angle_max" getter="get_sun_angle_max">
+ Distance from center of sun where it fades out completely.
</member>
<member name="sun_angle_min" type="float" setter="set_sun_angle_min" getter="get_sun_angle_min">
+ Distance from sun where it goes from solid to starting to fade.
</member>
<member name="sun_color" type="Color" setter="set_sun_color" getter="get_sun_color">
+ Color of the sun.
</member>
<member name="sun_curve" type="float" setter="set_sun_curve" getter="get_sun_curve">
+ How quickly the sun fades away between [member sun_angle_min] and [member sun_angle_max]
</member>
<member name="sun_energy" type="float" setter="set_sun_energy" getter="get_sun_energy">
+ Amount of energy contribution from the sun.
</member>
<member name="sun_latitude" type="float" setter="set_sun_latitude" getter="get_sun_latitude">
+ The suns height using polar coordinates.
</member>
<member name="sun_longitude" type="float" setter="set_sun_longitude" getter="get_sun_longitude">
+ The direction of the sun using polar coordinates.
</member>
<member name="texture_size" type="int" setter="set_texture_size" getter="get_texture_size" enum="ProceduralSky.TextureSize">
+ Size of [Texture] that the ProceduralSky will generate.
</member>
</members>
<constants>
diff --git a/doc/classes/ProgressBar.xml b/doc/classes/ProgressBar.xml
index 44eb82f2a4..919ecd7c86 100644
--- a/doc/classes/ProgressBar.xml
+++ b/doc/classes/ProgressBar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ProgressBar" inherits="Range" category="Core" version="3.1-dev">
+<class name="ProgressBar" inherits="Range" category="Core" version="3.1">
<brief_description>
General purpose progress bar.
</brief_description>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 83dea5d097..666f6b4710 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ProjectSettings" inherits="Object" category="Core" version="3.1-dev">
+<class name="ProjectSettings" inherits="Object" category="Core" version="3.1">
<brief_description>
Contains global variables accessible from everywhere.
</brief_description>
@@ -156,6 +156,536 @@
</description>
</method>
</methods>
+ <members>
+ <member name="application/boot_splash/fullsize" type="bool" setter="" getter="">
+ Scale the boot splash image to the full window length when engine starts (will leave it as default pixel size otherwise).
+ </member>
+ <member name="application/boot_splash/image" type="String" setter="" getter="">
+ Path to an image used for boot splash.
+ </member>
+ <member name="application/config/custom_user_dir_name" type="String" setter="" getter="">
+ This directory is used for storing persistent data (user:// filesystem). If a custom name is set, then system paths will be used to store this on Desktop (AppData on Windows, user ~/.config on Unixes, etc), else the Godot config folder is used. This name needs to be unique, and it's recommended to set it to something before publishing.
+ the "use_custom_user_dir" setting must be enabled for this to take effect.
+ </member>
+ <member name="application/config/icon" type="String" setter="" getter="">
+ Icon used for the project, set when project loads. Exporters will use this icon when possible to.
+ </member>
+ <member name="application/config/name" type="String" setter="" getter="">
+ Name of the project. It is used from both project manager and by the exporters. Overriding this as name.locale allows setting it in multiple languages.
+ </member>
+ <member name="application/config/use_custom_user_dir" type="bool" setter="" getter="">
+ Allow the project to save to it's own custom user dir (in AppData on windows or ~/.config on unixes). This setting only works for desktop exporters. A name must be set in the "custom_user_dir_name" setting for this to take effect.
+ </member>
+ <member name="application/run/disable_stderr" type="bool" setter="" getter="">
+ Disable printing to stderr on exported build.
+ </member>
+ <member name="application/run/disable_stdout" type="bool" setter="" getter="">
+ Disable printing to stdout on exported build.
+ </member>
+ <member name="application/run/frame_delay_msec" type="int" setter="" getter="">
+ Force a delay between frames in the main loop. This may be useful if you plan to disable vsync.
+ </member>
+ <member name="application/run/low_processor_mode" type="bool" setter="" getter="">
+ Turn on low processor mode. This setting only works on desktops. The screen is not redrawn if nothing changes visually. This is meant for writing applications and editors, but is pretty useless (and can hurt performance) on games.
+ </member>
+ <member name="application/run/low_processor_mode_sleep_usec" type="int" setter="" getter="">
+ Amount of sleeping between frames when the low_processor_mode is enabled. This effectively reduces CPU usage when this mode is enabled.
+ </member>
+ <member name="application/run/main_scene" type="String" setter="" getter="">
+ Path to the main scene file that will be loaded when the project runs.
+ </member>
+ <member name="audio/channel_disable_threshold_db" type="float" setter="" getter="">
+ Audio buses will disable automatically when sound goes below a given DB threshold for a given time. This saves CPU as effects assigned to that bus will no longer do any processing.
+ </member>
+ <member name="audio/channel_disable_time" type="float" setter="" getter="">
+ Audio buses will disable automatically when sound goes below a given DB threshold for a given time. This saves CPU as effects assigned to that bus will no longer do any processing.
+ </member>
+ <member name="audio/driver" type="String" setter="" getter="">
+ </member>
+ <member name="audio/mix_rate" type="int" setter="" getter="">
+ Mix rate used for audio. In general, it's better to not touch this and leave it to the host operating system.
+ </member>
+ <member name="audio/output_latency" type="int" setter="" getter="">
+ </member>
+ <member name="audio/video_delay_compensation_ms" type="int" setter="" getter="">
+ Setting to harcode audio delay when playing video. Best to leave this untouched unless you know what you are doing.
+ </member>
+ <member name="compression/formats/gzip/compression_level" type="int" setter="" getter="">
+ Default compression level for gzip. Affects compressed scenes and resources.
+ </member>
+ <member name="compression/formats/zlib/compression_level" type="int" setter="" getter="">
+ Default compression level for zlib. Affects compressed scenes and resources.
+ </member>
+ <member name="compression/formats/zstd/compression_level" type="int" setter="" getter="">
+ Default compression level for zstd. Affects compressed scenes and resources.
+ </member>
+ <member name="compression/formats/zstd/long_distance_matching" type="bool" setter="" getter="">
+ Enable long distance matching in zstd.
+ </member>
+ <member name="compression/formats/zstd/window_log_size" type="int" setter="" getter="">
+ </member>
+ <member name="debug/settings/crash_handler/message" type="String" setter="" getter="">
+ </member>
+ <member name="debug/settings/fps/force_fps" type="int" setter="" getter="">
+ </member>
+ <member name="debug/settings/gdscript/max_call_stack" type="int" setter="" getter="">
+ Maximum call stack allowed for debugging GDScript.
+ </member>
+ <member name="debug/settings/profiler/max_functions" type="int" setter="" getter="">
+ Maximum amount of functions per frame allowed when profiling.
+ </member>
+ <member name="debug/settings/stdout/print_fps" type="bool" setter="" getter="">
+ Print frames per second to stdout. Not very useful in general.
+ </member>
+ <member name="debug/settings/stdout/verbose_stdout" type="bool" setter="" getter="">
+ Print more information to stdout when running. It shows info such as memory leaks, which scenes and resources are being loaded, etc.
+ </member>
+ <member name="debug/settings/visual_script/max_call_stack" type="int" setter="" getter="">
+ Maximum call stack in visual scripting, to avoid infinite recursion.
+ </member>
+ <member name="display/mouse_cursor/custom_image" type="String" setter="" getter="">
+ Custom image for the mouse cursor.
+ </member>
+ <member name="display/mouse_cursor/custom_image_hotspot" type="Vector2" setter="" getter="">
+ Hotspot for the custom mouse cursor image.
+ </member>
+ <member name="display/window/allow_per_pixel_transparency" type="bool" setter="" getter="">
+ Allow per pixel transparency in a Desktop window. This affects performance if not needed, so leave it off.
+ </member>
+ <member name="display/window/dpi/allow_hidpi" type="bool" setter="" getter="">
+ Allow HiDPI display on Windows and OSX. On Desktop Linux, this can't be enabled or disabled.
+ </member>
+ <member name="display/window/energy_saving/keep_screen_on" type="bool" setter="" getter="">
+ Force keep the screen on, so the screensaver does not take over. Works on Desktop and Mobile.
+ </member>
+ <member name="display/window/handheld/orientation" type="String" setter="" getter="">
+ Default orientation for cell phone or tablet.
+ </member>
+ <member name="display/window/per_pixel_transparency" type="bool" setter="" getter="">
+ </member>
+ <member name="display/window/per_pixel_transparency_splash" type="bool" setter="" getter="">
+ </member>
+ <member name="display/window/size/always_on_top" type="bool" setter="" getter="">
+ Force the window to be always on top.
+ </member>
+ <member name="display/window/size/borderless" type="bool" setter="" getter="">
+ Force the window to be borderless.
+ </member>
+ <member name="display/window/size/fullscreen" type="bool" setter="" getter="">
+ Set the window to full screen when it starts.
+ </member>
+ <member name="display/window/size/height" type="int" setter="" getter="">
+ Set the main window height. On desktop, this is the default window size. Stretch mode settings use this also as a reference when enabled.
+ </member>
+ <member name="display/window/size/resizable" type="bool" setter="" getter="">
+ Allow the window to be resizable by default.
+ </member>
+ <member name="display/window/size/test_height" type="int" setter="" getter="">
+ Test a different height for the window. The main use for this is to test with stretch modes.
+ </member>
+ <member name="display/window/size/test_width" type="int" setter="" getter="">
+ Test a different width for the window. The main use for this is to test with stretch modes.
+ </member>
+ <member name="display/window/size/width" type="int" setter="" getter="">
+ Set the main window width. On desktop, this is the default window size. Stretch mode settings use this also as a reference when enabled.
+ </member>
+ <member name="display/window/vsync/use_vsync" type="bool" setter="" getter="">
+ Use VSync. Don't be stupid, don't turn this off.
+ </member>
+ <member name="editor/active" type="bool" setter="" getter="">
+ Internal editor setting, don't touch.
+ </member>
+ <member name="gui/common/default_scroll_deadzone" type="int" setter="" getter="">
+ </member>
+ <member name="gui/common/swap_ok_cancel" type="bool" setter="" getter="">
+ Enable swap OK and Cancel buttons on dialogs. This is because Windows/MacOS/Desktop Linux may use them in different order, so the GUI swaps them depending on the host OS. Disable this behavior by turning this setting off.
+ </member>
+ <member name="gui/theme/custom" type="String" setter="" getter="">
+ Use a custom theme resource, set a path to it here.
+ </member>
+ <member name="gui/theme/custom_font" type="String" setter="" getter="">
+ USe a custom default font resource, set a path to it here.
+ </member>
+ <member name="gui/theme/use_hidpi" type="bool" setter="" getter="">
+ Make sure the theme used works with hidpi.
+ </member>
+ <member name="gui/timers/incremental_search_max_interval_msec" type="int" setter="" getter="">
+ Timer setting for incremental search in Tree, IntemList, etc. controls.
+ </member>
+ <member name="gui/timers/text_edit_idle_detect_sec" type="int" setter="" getter="">
+ Timer for detecting idle in the editor.
+ </member>
+ <member name="input/ui_accept" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_cancel" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_down" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_end" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_focus_next" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_focus_prev" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_home" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_left" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_page_down" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_page_up" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_right" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_select" type="Array" setter="" getter="">
+ </member>
+ <member name="input/ui_up" type="Array" setter="" getter="">
+ </member>
+ <member name="input_devices/pointing/emulate_mouse_from_touch" type="bool" setter="" getter="">
+ </member>
+ <member name="input_devices/pointing/emulate_touch_from_mouse" type="bool" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_1" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_10" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_11" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_12" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_13" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_14" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_15" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_16" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_17" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_18" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_19" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_2" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_20" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_3" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_4" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_5" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_6" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_7" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_8" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_physics/layer_9" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_1" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_10" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_11" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_12" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_13" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_14" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_15" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_16" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_17" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_18" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_19" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_2" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_20" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_3" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_4" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_5" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_6" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_7" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_8" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/2d_render/layer_9" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_1" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_10" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_11" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_12" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_13" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_14" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_15" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_16" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_17" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_18" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_19" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_2" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_20" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_3" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_4" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_5" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_6" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_7" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_8" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_physics/layer_9" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_1" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_10" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_11" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_12" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_13" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_14" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_15" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_16" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_17" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_18" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_19" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_2" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_20" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_3" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_4" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_5" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_6" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_7" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_8" type="String" setter="" getter="">
+ </member>
+ <member name="layer_names/3d_render/layer_9" type="String" setter="" getter="">
+ </member>
+ <member name="locale/fallback" type="String" setter="" getter="">
+ </member>
+ <member name="locale/test" type="String" setter="" getter="">
+ </member>
+ <member name="logging/file_logging/enable_file_logging" type="bool" setter="" getter="">
+ Log all output to a file.
+ </member>
+ <member name="logging/file_logging/log_path" type="String" setter="" getter="">
+ Path to logs withint he project. Using an user:// based path is recommended.
+ </member>
+ <member name="logging/file_logging/max_log_files" type="int" setter="" getter="">
+ Amount of log files (used for rotation)/
+ </member>
+ <member name="memory/limits/message_queue/max_size_kb" type="int" setter="" getter="">
+ Godot uses a message queue to defer some function calls. If you run out of space on it (you will see an error), you can increase the size here.
+ </member>
+ <member name="memory/limits/multithreaded_server/rid_pool_prealloc" type="int" setter="" getter="">
+ This is used by servers when used in multi threading mode (servers and visual). RIDs are preallocated to avoid stalling the server requesting them on threads. If servers get stalled too often when loading resources in a thread, increase this number.
+ </member>
+ <member name="network/limits/debugger_stdout/max_chars_per_second" type="int" setter="" getter="">
+ Maximum amount of characters allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection.
+ </member>
+ <member name="network/limits/debugger_stdout/max_errors_per_frame" type="int" setter="" getter="">
+ Maximum amount of errors allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection.
+ </member>
+ <member name="network/limits/debugger_stdout/max_messages_per_frame" type="int" setter="" getter="">
+ Maximum amount of messages allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection.
+ </member>
+ <member name="network/limits/packet_peer_stream/max_buffer_po2" type="int" setter="" getter="">
+ Default size of packet peer stream for deserializing godot data. Over this size, data is dropped.
+ </member>
+ <member name="network/remote_fs/max_pages" type="int" setter="" getter="">
+ Maximum amount of pages used for remote filesystem (used by debugging).
+ </member>
+ <member name="network/remote_fs/page_read_ahead" type="int" setter="" getter="">
+ Amount of read ahead used by remote filesystem. Improves latency.
+ </member>
+ <member name="network/remote_fs/page_size" type="int" setter="" getter="">
+ Page size used by remote filesystem.
+ </member>
+ <member name="network/ssl/certificates" type="String" setter="" getter="">
+ If your game or application uses HTTPS, a certificates file is needed. It must be set here.
+ </member>
+ <member name="node/name_casing" type="int" setter="" getter="">
+ When creating nodes names automatically, set the type of casing in this project. This is mostly an editor setting.
+ </member>
+ <member name="node/name_num_separator" type="int" setter="" getter="">
+ What to use to separate node name from number. This is mostly an editor setting.
+ </member>
+ <member name="physics/2d/physics_engine" type="String" setter="" getter="">
+ </member>
+ <member name="physics/2d/thread_model" type="int" setter="" getter="">
+ Set whether physics is run on the main thread or a separate one. Running the server on a thread increases performance, but restricts API Access to only physics process.
+ </member>
+ <member name="physics/3d/physics_engine" type="String" setter="" getter="">
+ </member>
+ <member name="physics/common/physics_fps" type="int" setter="" getter="">
+ Frames per second used in the physics. Physics always needs a fixed amount of frames per second.
+ </member>
+ <member name="physics/common/physics_jitter_fix" type="float" setter="" getter="">
+ Fix to improve physics jitter, specially on monitors where refresh rate is different than physics FPS.
+ </member>
+ <member name="rendering/environment/default_clear_color" type="Color" setter="" getter="">
+ Default background clear color.
+ </member>
+ <member name="rendering/limits/buffers/blend_shape_max_buffer_size_kb" type="int" setter="" getter="">
+ Max buffer size for blend shapes. Any blend shape bigger than this will not work.
+ </member>
+ <member name="rendering/limits/buffers/canvas_polygon_buffer_size_kb" type="int" setter="" getter="">
+ Max buffer size for drawing polygons. Any polygon bigger than this will not work.
+ </member>
+ <member name="rendering/limits/buffers/canvas_polygon_index_buffer_size_kb" type="int" setter="" getter="">
+ Max index buffer size for drawing polygons. Any polygon bigger than this will not work.
+ </member>
+ <member name="rendering/limits/buffers/immediate_buffer_size_kb" type="int" setter="" getter="">
+ Max buffer size for drawing immediate objects (ImmediateGeometry nodes). Nodes using more than this size will not work.
+ </member>
+ <member name="rendering/limits/rendering/max_renderable_elements" type="int" setter="" getter="">
+ Max amount of elements renderable in a frame. If more than this are visible per frame, they will be dropped. Keep in mind elements refer to mesh surfaces and not mesh themselves.
+ </member>
+ <member name="rendering/limits/time/time_rollover_secs" type="int" setter="" getter="">
+ Shaders have a time variable that constantly increases. At some point it needs to be rolled back to zero to avoid numerical errors on shader animations. This setting specifies when.
+ </member>
+ <member name="rendering/quality/2d/use_pixel_snap" type="bool" setter="" getter="">
+ Force snapping of polygons to pixels in 2D rendering. May help in some pixel art styles.
+ </member>
+ <member name="rendering/quality/depth_prepass/disable_for_vendors" type="String" setter="" getter="">
+ Disable depth pre-pass for some GPU vendors (usually mobile), as their architecture already does this.
+ </member>
+ <member name="rendering/quality/depth_prepass/enable" type="bool" setter="" getter="">
+ Do a previous depth pass before rendering materials. This increases performance in scenes with high overdraw, when complex materials and lighting are used.
+ </member>
+ <member name="rendering/quality/directional_shadow/size" type="int" setter="" getter="">
+ Size in pixels of the directional shadow.
+ </member>
+ <member name="rendering/quality/directional_shadow/size.mobile" type="int" setter="" getter="">
+ </member>
+ <member name="rendering/quality/driver/driver_name" type="String" setter="" getter="">
+ </member>
+ <member name="rendering/quality/filters/anisotropic_filter_level" type="int" setter="" getter="">
+ Maximum Anisotropic filter level used for textures when anisotropy enabled.
+ </member>
+ <member name="rendering/quality/filters/use_nearest_mipmap_filter" type="bool" setter="" getter="">
+ Force to use nearest mipmap filtering when using mipmaps. This may increase performance in mobile as less memory bandwidth is used.
+ </member>
+ <member name="rendering/quality/intended_usage/framebuffer_allocation" type="int" setter="" getter="">
+ Strategy used for framebuffer allocation. The simpler it is, the less memory it uses (but the least features it supports).
+ </member>
+ <member name="rendering/quality/intended_usage/framebuffer_allocation.mobile" type="int" setter="" getter="">
+ </member>
+ <member name="rendering/quality/intended_usage/framebuffer_mode" type="int" setter="" getter="">
+ </member>
+ <member name="rendering/quality/reflections/high_quality_ggx" type="bool" setter="" getter="">
+ For reflection probes and panorama backgrounds (sky), use a high amount of samples to create ggx blurred versions (used for roughness).
+ </member>
+ <member name="rendering/quality/reflections/high_quality_ggx.mobile" type="bool" setter="" getter="">
+ </member>
+ <member name="rendering/quality/reflections/texture_array_reflections" type="bool" setter="" getter="">
+ For reflection probes and panorama backgrounds (sky), use a texure array instead of mipmaps. This reduces jitter noise on reflections, but costs more performance and memory.
+ </member>
+ <member name="rendering/quality/reflections/texture_array_reflections.mobile" type="bool" setter="" getter="">
+ </member>
+ <member name="rendering/quality/shading/force_vertex_shading" type="bool" setter="" getter="">
+ Force vertex shading for all rendering. This can increase performance a lot, but also reduces quality inmensely. Can work to optimize on very low end mobile.
+ </member>
+ <member name="rendering/quality/shading/force_vertex_shading.mobile" type="bool" setter="" getter="">
+ </member>
+ <member name="rendering/quality/shadow_atlas/quadrant_0_subdiv" type="int" setter="" getter="">
+ Subdivision quadrant size for shadow mapping. See shadow mapping documentation.
+ </member>
+ <member name="rendering/quality/shadow_atlas/quadrant_1_subdiv" type="int" setter="" getter="">
+ Subdivision quadrant size for shadow mapping. See shadow mapping documentation.
+ </member>
+ <member name="rendering/quality/shadow_atlas/quadrant_2_subdiv" type="int" setter="" getter="">
+ Subdivision quadrant size for shadow mapping. See shadow mapping documentation.
+ </member>
+ <member name="rendering/quality/shadow_atlas/quadrant_3_subdiv" type="int" setter="" getter="">
+ Subdivision quadrant size for shadow mapping. See shadow mapping documentation.
+ </member>
+ <member name="rendering/quality/shadow_atlas/size" type="int" setter="" getter="">
+ Size for shadow atlas (used for point and omni lights). See documentation.
+ </member>
+ <member name="rendering/quality/shadow_atlas/size.mobile" type="int" setter="" getter="">
+ </member>
+ <member name="rendering/quality/shadows/filter_mode" type="int" setter="" getter="">
+ Shadow filter mode. The more complex the filter, the more memory bandwidth required.
+ </member>
+ <member name="rendering/quality/shadows/filter_mode.mobile" type="int" setter="" getter="">
+ </member>
+ <member name="rendering/quality/subsurface_scattering/follow_surface" type="bool" setter="" getter="">
+ Improves quality of subsurface scattering, but cost significantly increases.
+ </member>
+ <member name="rendering/quality/subsurface_scattering/quality" type="int" setter="" getter="">
+ Quality setting for subsurface scaterring (samples taken).
+ </member>
+ <member name="rendering/quality/subsurface_scattering/scale" type="int" setter="" getter="">
+ </member>
+ <member name="rendering/quality/subsurface_scattering/weight_samples" type="bool" setter="" getter="">
+ Weight subsurface scattering samples. Helps to avoid reading samples from unrelated parts of the screen.
+ </member>
+ <member name="rendering/quality/voxel_cone_tracing/high_quality" type="bool" setter="" getter="">
+ Use high quality voxel cone tracing (looks better, but requires a higher end GPU).
+ </member>
+ <member name="rendering/threads/thread_model" type="int" setter="" getter="">
+ Thread model for rendering. Rendering on a thread can vastly improve performance, but syncinc to the main thread can cause a bit more jitter.
+ </member>
+ <member name="rendering/vram_compression/import_etc" type="bool" setter="" getter="">
+ If the project uses this compression (usually low end mobile), texture importer will import these.
+ </member>
+ <member name="rendering/vram_compression/import_etc2" type="bool" setter="" getter="">
+ If the project uses this compression (usually high end mobile), texture importer will import these.
+ </member>
+ <member name="rendering/vram_compression/import_pvrtc" type="bool" setter="" getter="">
+ If the project uses this compression (usually iOS), texture importer will import these.
+ </member>
+ <member name="rendering/vram_compression/import_s3tc" type="bool" setter="" getter="">
+ If the project uses this compression (usually Desktop and Consoles), texture importer will import these.
+ </member>
+ <member name="script" type="Script" setter="" getter="">
+ </member>
+ </members>
<constants>
</constants>
</class>
diff --git a/doc/classes/ProximityGroup.xml b/doc/classes/ProximityGroup.xml
index 697bb8ff7e..1f1c45fbf9 100644
--- a/doc/classes/ProximityGroup.xml
+++ b/doc/classes/ProximityGroup.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ProximityGroup" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="ProximityGroup" inherits="Spatial" category="Core" version="3.1">
<brief_description>
General purpose proximity-detection node.
</brief_description>
diff --git a/doc/classes/ProxyTexture.xml b/doc/classes/ProxyTexture.xml
index 2f50229643..69702ee22e 100644
--- a/doc/classes/ProxyTexture.xml
+++ b/doc/classes/ProxyTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ProxyTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="ProxyTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/QuadMesh.xml b/doc/classes/QuadMesh.xml
index a295ffc929..a45b2ddf4b 100644
--- a/doc/classes/QuadMesh.xml
+++ b/doc/classes/QuadMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="QuadMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="QuadMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Class representing a square mesh.
</brief_description>
diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml
index 90301db01f..c755e6b02a 100644
--- a/doc/classes/Quat.xml
+++ b/doc/classes/Quat.xml
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Quat" category="Built-In Types" version="3.1-dev">
+<class name="Quat" category="Built-In Types" version="3.1">
<brief_description>
Quaternion.
</brief_description>
<description>
- A 4-dimensional vector representing a rotation.
- The vector represents a 4 dimensional complex number where multiplication of the basis elements is not commutative (multiplying i with j gives a different result than multiplying j with i).
- Multiplying quaternions reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues.
- It can be used to perform SLERP (spherical-linear interpolation) between two rotations.
+ A unit quaternion used for representing 3D rotations.
+ It is similar to [Basis], which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. But due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating point errors.
+ Quaternions need to be (re)normalized.
</description>
<tutorials>
+ <link>http://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions</link>
+ <link>http://docs.godotengine.org/en/latest/tutorials/math/rotations.html</link>
</tutorials>
<demos>
</demos>
@@ -17,16 +18,19 @@
<method name="Quat">
<return type="Quat">
</return>
- <argument index="0" name="x" type="float">
- </argument>
- <argument index="1" name="y" type="float">
- </argument>
- <argument index="2" name="z" type="float">
+ <argument index="0" name="from" type="Basis">
</argument>
- <argument index="3" name="w" type="float">
+ <description>
+ Returns the rotation matrix corresponding to the given quaternion.
+ </description>
+ </method>
+ <method name="Quat">
+ <return type="Quat">
+ </return>
+ <argument index="0" name="euler" type="Vector3">
</argument>
<description>
- Returns a quaternion defined by these values.
+ Returns a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X-angle, Y-angle, Z-angle).
</description>
</method>
<method name="Quat">
@@ -43,10 +47,16 @@
<method name="Quat">
<return type="Quat">
</return>
- <argument index="0" name="from" type="Basis">
+ <argument index="0" name="x" type="float">
+ </argument>
+ <argument index="1" name="y" type="float">
+ </argument>
+ <argument index="2" name="z" type="float">
+ </argument>
+ <argument index="3" name="w" type="float">
</argument>
<description>
- Returns the rotation matrix corresponding to the given quaternion.
+ Returns a quaternion defined by these values.
</description>
</method>
<method name="cubic_slerp">
@@ -73,6 +83,13 @@
Returns the dot product of two quaternions.
</description>
</method>
+ <method name="get_euler">
+ <return type="Vector3">
+ </return>
+ <description>
+ Return Euler angles (in the YXZ convention: first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X-angle, Y-angle, Z-angle).
+ </description>
+ </method>
<method name="inverse">
<return type="Quat">
</return>
@@ -108,6 +125,22 @@
Returns a copy of the quaternion, normalized to unit length.
</description>
</method>
+ <method name="set_axis_angle">
+ <argument index="0" name="axis" type="Vector3">
+ </argument>
+ <argument index="1" name="angle" type="float">
+ </argument>
+ <description>
+ Set the quaternion to a rotation which rotates around axis by the specified angle, in radians. The axis must be a normalized vector.
+ </description>
+ </method>
+ <method name="set_euler">
+ <argument index="0" name="euler" type="Vector3">
+ </argument>
+ <description>
+ Set the quaternion to a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X-angle, Y-angle, Z-angle).
+ </description>
+ </method>
<method name="slerp">
<return type="Quat">
</return>
diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml
index 85702727ce..ee34560afd 100644
--- a/doc/classes/RID.xml
+++ b/doc/classes/RID.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RID" category="Built-In Types" version="3.1-dev">
+<class name="RID" category="Built-In Types" version="3.1">
<brief_description>
Handle for a [Resource]'s unique ID.
</brief_description>
diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml
index 7828445dc4..fa7e20eff6 100644
--- a/doc/classes/Range.xml
+++ b/doc/classes/Range.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Range" inherits="Control" category="Core" version="3.1-dev">
+<class name="Range" inherits="Control" category="Core" version="3.1">
<brief_description>
Abstract base class for range-based controls.
</brief_description>
@@ -29,6 +29,10 @@
</method>
</methods>
<members>
+ <member name="allow_greater" type="bool" setter="set_allow_greater" getter="is_greater_allowed">
+ </member>
+ <member name="allow_lesser" type="bool" setter="set_allow_lesser" getter="is_lesser_allowed">
+ </member>
<member name="exp_edit" type="bool" setter="set_exp_ratio" getter="is_ratio_exp">
If [code]true[/code] and [code]min_value[/code] is greater than 0, [code]value[/code] will be represented exponentially rather than linearly.
</member>
diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml
index 76574b305f..dce73d9c29 100644
--- a/doc/classes/RayCast.xml
+++ b/doc/classes/RayCast.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RayCast" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="RayCast" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Query the closest object intersecting a ray.
</brief_description>
diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml
index 7a6ec8ded8..79e733bcdc 100644
--- a/doc/classes/RayCast2D.xml
+++ b/doc/classes/RayCast2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RayCast2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="RayCast2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Query the closest object intersecting a ray.
</brief_description>
diff --git a/doc/classes/RayShape.xml b/doc/classes/RayShape.xml
index 5d488cb3f5..e03541011d 100644
--- a/doc/classes/RayShape.xml
+++ b/doc/classes/RayShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RayShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="RayShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
Ray shape for 3D collisions.
</brief_description>
@@ -16,6 +16,9 @@
<member name="length" type="float" setter="set_length" getter="get_length">
The ray's length.
</member>
+ <member name="slips_on_slope" type="bool" setter="set_slips_on_slope" getter="get_slips_on_slope">
+ If [code]true[/code] allow the shape to return the correct normal. Default value: [code]false[/code].
+ </member>
</members>
<constants>
</constants>
diff --git a/doc/classes/RayShape2D.xml b/doc/classes/RayShape2D.xml
index 3137bbd1ad..37cfe4f2d3 100644
--- a/doc/classes/RayShape2D.xml
+++ b/doc/classes/RayShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RayShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="RayShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Ray shape for 2D collisions.
</brief_description>
@@ -16,6 +16,9 @@
<member name="length" type="float" setter="set_length" getter="get_length">
The ray's length.
</member>
+ <member name="slips_on_slope" type="bool" setter="set_slips_on_slope" getter="get_slips_on_slope">
+ If [code]true[/code] allow the shape to return the correct normal. Default value: [code]false[/code].
+ </member>
</members>
<constants>
</constants>
diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml
index bafa5a3632..1eea940da9 100644
--- a/doc/classes/Rect2.xml
+++ b/doc/classes/Rect2.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Rect2" category="Built-In Types" version="3.1-dev">
+<class name="Rect2" category="Built-In Types" version="3.1">
<brief_description>
2D Axis-aligned bounding box.
</brief_description>
@@ -7,7 +7,7 @@
Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/math/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/math/index.html</link>
</tutorials>
<demos>
</demos>
@@ -42,6 +42,7 @@
<return type="Rect2">
</return>
<description>
+ Returns a [code]Rect2[/code] with equivalent position and area, modified so that the top-left corner is the origin and [code]width[/code] and [code]height[/code] are positive.
</description>
</method>
<method name="clip">
diff --git a/doc/classes/RectangleShape2D.xml b/doc/classes/RectangleShape2D.xml
index 5e2bdf040a..4a312503f4 100644
--- a/doc/classes/RectangleShape2D.xml
+++ b/doc/classes/RectangleShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RectangleShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="RectangleShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Rectangle shape for 2D collisions.
</brief_description>
diff --git a/doc/classes/Reference.xml b/doc/classes/Reference.xml
index 3f4f499b3e..3238501633 100644
--- a/doc/classes/Reference.xml
+++ b/doc/classes/Reference.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Reference" inherits="Object" category="Core" version="3.1-dev">
+<class name="Reference" inherits="Object" category="Core" version="3.1">
<brief_description>
Base class for anything that keeps a reference count.
</brief_description>
diff --git a/doc/classes/ReferenceRect.xml b/doc/classes/ReferenceRect.xml
index 1946ee8b81..4453e8726f 100644
--- a/doc/classes/ReferenceRect.xml
+++ b/doc/classes/ReferenceRect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ReferenceRect" inherits="Control" category="Core" version="3.1-dev">
+<class name="ReferenceRect" inherits="Control" category="Core" version="3.1">
<brief_description>
Reference frame for GUI.
</brief_description>
diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml
index c565fc6a92..a9a897ebaf 100644
--- a/doc/classes/ReflectionProbe.xml
+++ b/doc/classes/ReflectionProbe.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ReflectionProbe" inherits="VisualInstance" category="Core" version="3.1-dev">
+<class name="ReflectionProbe" inherits="VisualInstance" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/reflection_probes.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/reflection_probes.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform.xml
index 16521e27ea..a7deb273b6 100644
--- a/doc/classes/RemoteTransform.xml
+++ b/doc/classes/RemoteTransform.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RemoteTransform" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="RemoteTransform" inherits="Spatial" category="Core" version="3.1">
<brief_description>
RemoteTransform leads the [Transform] of another [Spatial] derived Node in the scene.
</brief_description>
diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml
index a6c61eb2f4..bc562dcdad 100644
--- a/doc/classes/RemoteTransform2D.xml
+++ b/doc/classes/RemoteTransform2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
RemoteTransform2D leads the [Transform2D] of another [CanvasItem] derived Node in the scene.
</brief_description>
diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml
index 9bba251607..fc42635ce2 100644
--- a/doc/classes/Resource.xml
+++ b/doc/classes/Resource.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Resource" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Resource" inherits="Reference" category="Core" version="3.1">
<brief_description>
Base class for all resources.
</brief_description>
diff --git a/doc/classes/ResourceImporter.xml b/doc/classes/ResourceImporter.xml
index 91e72ff595..09fe828bd3 100644
--- a/doc/classes/ResourceImporter.xml
+++ b/doc/classes/ResourceImporter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporter" inherits="Reference" category="Core" version="3.1-dev">
+<class name="ResourceImporter" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/ResourceInteractiveLoader.xml b/doc/classes/ResourceInteractiveLoader.xml
index dba045213e..076121b42d 100644
--- a/doc/classes/ResourceInteractiveLoader.xml
+++ b/doc/classes/ResourceInteractiveLoader.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceInteractiveLoader" inherits="Reference" category="Core" version="3.1-dev">
+<class name="ResourceInteractiveLoader" inherits="Reference" category="Core" version="3.1">
<brief_description>
Interactive Resource Loader.
</brief_description>
diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml
index baeb7a6bb4..ac00c13b2f 100644
--- a/doc/classes/ResourceLoader.xml
+++ b/doc/classes/ResourceLoader.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceLoader" inherits="Object" category="Core" version="3.1-dev">
+<class name="ResourceLoader" inherits="Object" category="Core" version="3.1">
<brief_description>
Resource Loader.
</brief_description>
diff --git a/doc/classes/ResourcePreloader.xml b/doc/classes/ResourcePreloader.xml
index 6c3c4cd5d0..002bcd891a 100644
--- a/doc/classes/ResourcePreloader.xml
+++ b/doc/classes/ResourcePreloader.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourcePreloader" inherits="Node" category="Core" version="3.1-dev">
+<class name="ResourcePreloader" inherits="Node" category="Core" version="3.1">
<brief_description>
Resource Preloader Node.
</brief_description>
diff --git a/doc/classes/ResourceSaver.xml b/doc/classes/ResourceSaver.xml
index e44244aabb..ae0d8e909d 100644
--- a/doc/classes/ResourceSaver.xml
+++ b/doc/classes/ResourceSaver.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceSaver" inherits="Object" category="Core" version="3.1-dev">
+<class name="ResourceSaver" inherits="Object" category="Core" version="3.1">
<brief_description>
Resource Saving Interface.
</brief_description>
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml
index dab8eb1505..618f2f42b2 100644
--- a/doc/classes/RichTextLabel.xml
+++ b/doc/classes/RichTextLabel.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RichTextLabel" inherits="Control" category="Core" version="3.1-dev">
+<class name="RichTextLabel" inherits="Control" category="Core" version="3.1">
<brief_description>
Label that displays rich text.
</brief_description>
@@ -8,7 +8,7 @@
Note that assignments to [member bbcode_text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member bbcode_text] will erase previous edits made from other manual sources such as [method append_bbcode] and the [code]push_*[/code] / [method pop] methods.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/gui/bbcode_in_richtextlabel.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/gui/bbcode_in_richtextlabel.html</link>
</tutorials>
<demos>
</demos>
@@ -47,6 +47,13 @@
Clears the tag stack and sets [member bbcode_text] to an empty string.
</description>
</method>
+ <method name="get_content_height">
+ <return type="int">
+ </return>
+ <description>
+ Returns the height of the content.
+ </description>
+ </method>
<method name="get_line_count" qualifiers="const">
<return type="int">
</return>
@@ -319,6 +326,8 @@
</theme_item>
<theme_item name="font_color_selected" type="Color">
</theme_item>
+ <theme_item name="font_color_shadow" type="Color">
+ </theme_item>
<theme_item name="italics_font" type="Font">
</theme_item>
<theme_item name="line_separation" type="int">
@@ -331,6 +340,12 @@
</theme_item>
<theme_item name="selection_color" type="Color">
</theme_item>
+ <theme_item name="shadow_as_outline" type="int">
+ </theme_item>
+ <theme_item name="shadow_offset_x" type="int">
+ </theme_item>
+ <theme_item name="shadow_offset_y" type="int">
+ </theme_item>
<theme_item name="table_hseparation" type="int">
</theme_item>
<theme_item name="table_vseparation" type="int">
diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml
index a1aa479ea1..4253560f67 100644
--- a/doc/classes/RigidBody.xml
+++ b/doc/classes/RigidBody.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RigidBody" inherits="PhysicsBody" category="Core" version="3.1-dev">
+<class name="RigidBody" inherits="PhysicsBody" category="Core" version="3.1">
<brief_description>
Physics Body whose position is determined through physics simulation in 3D space.
</brief_description>
@@ -10,7 +10,7 @@
If you need to override the default physics behavior, you can write a custom force integration. See [member custom_integrator].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
@@ -38,7 +38,7 @@
<method name="apply_torque_impulse">
<return type="void">
</return>
- <argument index="1" name="impulse" type="Vector3">
+ <argument index="0" name="impulse" type="Vector3">
</argument>
<description>
Apply a torque impulse (which will be affected by the body mass and shape). This will rotate the body around the passed in vector.
diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml
index 719ddfffe4..75fbb48454 100644
--- a/doc/classes/RigidBody2D.xml
+++ b/doc/classes/RigidBody2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RigidBody2D" inherits="PhysicsBody2D" category="Core" version="3.1-dev">
+<class name="RigidBody2D" inherits="PhysicsBody2D" category="Core" version="3.1">
<brief_description>
A body that is controlled by the 2D physics engine.
</brief_description>
@@ -66,9 +66,11 @@
</return>
<argument index="0" name="motion" type="Vector2">
</argument>
- <argument index="1" name="margin" type="float" default="0.08">
+ <argument index="1" name="infinite_inertia" type="bool" default="true">
</argument>
- <argument index="2" name="result" type="Physics2DTestMotionResult" default="null">
+ <argument index="2" name="margin" type="float" default="0.08">
+ </argument>
+ <argument index="3" name="result" type="Physics2DTestMotionResult" default="null">
</argument>
<description>
Returns [code]true[/code] if a collision would result from moving in the given vector. [code]margin[/code] increases the size of the shapes involved in the collision detection, and [code]result[/code] is an object of type [Physics2DTestMotionResult], which contains additional information about the collision (should there be one).
diff --git a/doc/classes/SceneState.xml b/doc/classes/SceneState.xml
index 3ce08c0878..36cddf08df 100644
--- a/doc/classes/SceneState.xml
+++ b/doc/classes/SceneState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SceneState" inherits="Reference" category="Core" version="3.1-dev">
+<class name="SceneState" inherits="Reference" category="Core" version="3.1">
<brief_description>
A script interface to a scene file's data.
</brief_description>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index bd6ffbaf80..f5a19ede0c 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SceneTree" inherits="MainLoop" category="Core" version="3.1-dev">
+<class name="SceneTree" inherits="MainLoop" category="Core" version="3.1">
<brief_description>
+ SceneTree manages a hierarchy of nodes.
</brief_description>
<description>
+ As one of the most important classes, the [code]SceneTree[/code] manages the hierarchy of nodes in a scene as well as scenes themselves. Nodes can be added, retrieved and removed. The whole scene tree (and thus the current scene) can be paused. Scenes can be loaded, switched and reloaded. You can also use the SceneTree to organize your nodes into groups: every node can be assigned as many groups as you want to create, e.g. a "enemy" group. You can then iterate these groups or even call methods and set properties on all the group's members at once.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scene_tree.html
- http://docs.godotengine.org/en/3.0/tutorials/viewports/multiple_resolutions.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scene_tree.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/viewports/multiple_resolutions.html</link>
</tutorials>
<demos>
</demos>
@@ -19,6 +21,7 @@
<argument index="1" name="method" type="String">
</argument>
<description>
+ Calls [code]method[/code] on each member of the given group.
</description>
</method>
<method name="call_group_flags" qualifiers="vararg">
@@ -31,6 +34,7 @@
<argument index="2" name="method" type="String">
</argument>
<description>
+ Calls [code]method[/code] on each member of the given group, respecting the given [enum GroupCallFlags].
</description>
</method>
<method name="change_scene">
@@ -39,6 +43,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
+ Changes to the scene at the given [code]path[/code].
</description>
</method>
<method name="change_scene_to">
@@ -47,6 +52,7 @@
<argument index="0" name="packed_scene" type="PackedScene">
</argument>
<description>
+ Changes to the given [PackedScene].
</description>
</method>
<method name="create_timer">
@@ -57,6 +63,7 @@
<argument index="1" name="pause_mode_process" type="bool" default="true">
</argument>
<description>
+ Returns a [SceneTreeTimer] which will [signal SceneTreeTimer.timeout] after the given time in seconds elapsed in this SceneTree. If [code]pause_mode_process[/code] is set to false, pausing the SceneTree will also pause the timer.
</description>
</method>
<method name="get_frame" qualifiers="const">
@@ -69,18 +76,21 @@
<return type="PoolIntArray">
</return>
<description>
+ Returns the peer IDs of all connected peers of this SceneTree's [member network_peer].
</description>
</method>
<method name="get_network_unique_id" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the unique peer ID of this SceneTree's [member network_peer].
</description>
</method>
<method name="get_node_count" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the number of nodes in this SceneTree.
</description>
</method>
<method name="get_nodes_in_group">
@@ -89,12 +99,14 @@
<argument index="0" name="group" type="String">
</argument>
<description>
+ Returns all nodes assigned to the given group.
</description>
</method>
<method name="get_rpc_sender_id" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the sender's peer ID for the most recently received RPC call.
</description>
</method>
<method name="has_group" qualifiers="const">
@@ -103,26 +115,28 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Returns [code]true[/code] if the given group exists.
</description>
</method>
<method name="has_network_peer" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns true if there is a [NetworkedMultiplayerPeer] set (with [method SceneTree.set_network_peer]).
+ Returns [code]true[/code] if there is a [member network_peer] set.
</description>
</method>
<method name="is_input_handled">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if the most recent InputEvent was marked as handled with [method set_input_as_handled].
</description>
</method>
<method name="is_network_server" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns true if this SceneTree's [NetworkedMultiplayerPeer] is in server mode (listening for connections).
+ Returns [code]true[/code] if this SceneTree's [member network_peer] is in server mode (listening for connections).
</description>
</method>
<method name="notify_group">
@@ -133,6 +147,7 @@
<argument index="1" name="notification" type="int">
</argument>
<description>
+ Sends the given notification to all members of the [code]group[/code].
</description>
</method>
<method name="notify_group_flags">
@@ -145,6 +160,7 @@
<argument index="2" name="notification" type="int">
</argument>
<description>
+ Sends the given notification to all members of the [code]group[/code], respecting the given [enum GroupCallFlags].
</description>
</method>
<method name="queue_delete">
@@ -153,18 +169,21 @@
<argument index="0" name="obj" type="Object">
</argument>
<description>
+ Queues the given object for deletion, delaying the call to [method Object.free] to after the current frame.
</description>
</method>
<method name="quit">
<return type="void">
</return>
<description>
+ Quits the application.
</description>
</method>
<method name="reload_current_scene">
<return type="int" enum="Error">
</return>
<description>
+ Reloads the currently active scene.
</description>
</method>
<method name="set_auto_accept_quit">
@@ -173,6 +192,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
+ If [code]true[/code] the application automatically accepts quitting.
</description>
</method>
<method name="set_group">
@@ -185,6 +205,7 @@
<argument index="2" name="value" type="Variant">
</argument>
<description>
+ Sets the given [code]property[/code] to [code]value[/code] on all members of the given group.
</description>
</method>
<method name="set_group_flags">
@@ -199,12 +220,14 @@
<argument index="3" name="value" type="Variant">
</argument>
<description>
+ Sets the given [code]property[/code] to [code]value[/code] on all members of the given group, respecting the given [enum GroupCallFlags].
</description>
</method>
<method name="set_input_as_handled">
<return type="void">
</return>
<description>
+ Marks the most recent input event as handled.
</description>
</method>
<method name="set_quit_on_go_back">
@@ -213,6 +236,7 @@
<argument index="0" name="enabled" type="bool">
</argument>
<description>
+ If [code]true[/code] the application quits automatically on going back (e.g. on Android).
</description>
</method>
<method name="set_screen_stretch">
@@ -227,37 +251,53 @@
<argument index="3" name="shrink" type="float" default="1">
</argument>
<description>
+ Configures screen stretching to the given [enum StretchMode], [enum StretchAspect], minimum size and [code]shrink[/code].
</description>
</method>
</methods>
<members>
<member name="current_scene" type="Node" setter="set_current_scene" getter="get_current_scene">
+ The current scene.
</member>
<member name="debug_collisions_hint" type="bool" setter="set_debug_collisions_hint" getter="is_debugging_collisions_hint">
</member>
<member name="debug_navigation_hint" type="bool" setter="set_debug_navigation_hint" getter="is_debugging_navigation_hint">
</member>
<member name="edited_scene_root" type="Node" setter="set_edited_scene_root" getter="get_edited_scene_root">
+ The root of the edited scene.
+ </member>
+ <member name="multiplayer" type="MultiplayerAPI" setter="set_multiplayer" getter="get_multiplayer">
+ The default [MultiplayerAPI] instance for this SceneTree.
+ </member>
+ <member name="multiplayer_poll" type="bool" setter="set_multiplayer_poll_enabled" getter="is_multiplayer_poll_enabled">
+ If [code]true[/code] (default) enable the automatic polling of the [MultiplayerAPI] for this SceneTree during [signal idle_frame].
+ When [code]false[/code] you need to manually call [method MultiplayerAPI.poll] for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual [Mutex] protecion when accessing the [MultiplayerAPI] from threads.
</member>
<member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer">
The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
</member>
<member name="paused" type="bool" setter="set_pause" getter="is_paused">
+ If [code]true[/code] the SceneTree is paused.
</member>
<member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections">
+ If [code]true[/code] the SceneTree's [member network_peer] refuses new incoming connections.
</member>
<member name="root" type="Viewport" setter="" getter="get_root">
+ The SceneTree's [Viewport].
</member>
<member name="use_font_oversampling" type="bool" setter="set_use_font_oversampling" getter="is_using_font_oversampling">
+ If [code]true[/code] font oversampling is used.
</member>
</members>
<signals>
<signal name="connected_to_server">
<description>
+ Emitted whenever this SceneTree's [member network_peer] successfully connected to a server. Only emitted on clients.
</description>
</signal>
<signal name="connection_failed">
<description>
+ Emitted whenever this SceneTree's [member network_peer] fails to establish a connection to a server. Only emitted on clients.
</description>
</signal>
<signal name="files_dropped">
@@ -266,67 +306,82 @@
<argument index="1" name="screen" type="int">
</argument>
<description>
+ Emitted whenever files are drag-and-dropped onto the window.
</description>
</signal>
<signal name="idle_frame">
<description>
+ Emitted immediately before [method Node._process] is called on every node in the SceneTree.
</description>
</signal>
<signal name="network_peer_connected">
<argument index="0" name="id" type="int">
</argument>
<description>
+ Emitted whenever this SceneTree's [member network_peer] connects with a new peer. ID is the peer ID of the new peer. Clients get notified when other clients connect to the same server. Upon connecting to a server, a client also receives this signal for the server (with ID being 1).
</description>
</signal>
<signal name="network_peer_disconnected">
<argument index="0" name="id" type="int">
</argument>
<description>
+ Emitted whenever this SceneTree's [member network_peer] disconnects from a peer. Clients get notified when other clients disconnect from the same server.
</description>
</signal>
<signal name="node_added">
<argument index="0" name="node" type="Object">
</argument>
<description>
+ Emitted whenever a node is added to the SceneTree.
</description>
</signal>
<signal name="node_configuration_warning_changed">
<argument index="0" name="node" type="Object">
</argument>
<description>
+ Emitted when a node's configuration changed. Only emitted in tool mode.
</description>
</signal>
<signal name="node_removed">
<argument index="0" name="node" type="Object">
</argument>
<description>
+ Emitted whenever a node is removed from the SceneTree.
</description>
</signal>
<signal name="physics_frame">
<description>
+ Emitted immediately before [method Node._physics_process] is called on every node in the SceneTree.
</description>
</signal>
<signal name="screen_resized">
<description>
+ Emitted whenever the screen resolution (fullscreen) or window size (windowed) changes.
</description>
</signal>
<signal name="server_disconnected">
<description>
+ Emitted whenever this SceneTree's [member network_peer] disconnected from server. Only emitted on clients.
</description>
</signal>
<signal name="tree_changed">
<description>
+ Emitted whenever the SceneTree hierarchy changed (children being moved or renamed, etc.).
</description>
</signal>
</signals>
<constants>
<constant name="GROUP_CALL_DEFAULT" value="0" enum="GroupCallFlags">
+ Call a group with no flags (default).
</constant>
<constant name="GROUP_CALL_REVERSE" value="1" enum="GroupCallFlags">
+ Call a group in reverse scene order.
</constant>
<constant name="GROUP_CALL_REALTIME" value="2" enum="GroupCallFlags">
+ Call a group immediately (calls are normally made on idle).
</constant>
<constant name="GROUP_CALL_UNIQUE" value="4" enum="GroupCallFlags">
+ Call a group only once even if the call is executed many times.
</constant>
<constant name="STRETCH_MODE_DISABLED" value="0" enum="StretchMode">
</constant>
diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml
index a5b199d9d7..e1234ce88a 100644
--- a/doc/classes/SceneTreeTimer.xml
+++ b/doc/classes/SceneTreeTimer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SceneTreeTimer" inherits="Reference" category="Core" version="3.1-dev">
+<class name="SceneTreeTimer" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml
index db85890b2b..09c60afc2f 100644
--- a/doc/classes/Script.xml
+++ b/doc/classes/Script.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Script" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Script" inherits="Resource" category="Core" version="3.1">
<brief_description>
A class stored as a resource.
</brief_description>
@@ -8,7 +8,7 @@
The 'new' method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scripting.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scripting.html</link>
</tutorials>
<demos>
</demos>
@@ -24,6 +24,7 @@
<return type="Script">
</return>
<description>
+ Returns the script directly inherited by this script.
</description>
</method>
<method name="get_instance_base_type" qualifiers="const">
diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml
index 0b5365f583..4bfd07fdad 100644
--- a/doc/classes/ScriptEditor.xml
+++ b/doc/classes/ScriptEditor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ScriptEditor" inherits="PanelContainer" category="Core" version="3.1-dev">
+<class name="ScriptEditor" inherits="PanelContainer" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/ScrollBar.xml b/doc/classes/ScrollBar.xml
index 04b3ccfca0..736b780218 100644
--- a/doc/classes/ScrollBar.xml
+++ b/doc/classes/ScrollBar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ScrollBar" inherits="Range" category="Core" version="3.1-dev">
+<class name="ScrollBar" inherits="Range" category="Core" version="3.1">
<brief_description>
Base class for scroll bars.
</brief_description>
@@ -19,6 +19,7 @@
<signals>
<signal name="scrolling">
<description>
+ Emitted whenever the scrollbar is being scrolled.
</description>
</signal>
</signals>
diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml
index 3a613f8bcd..02f58a88cb 100644
--- a/doc/classes/ScrollContainer.xml
+++ b/doc/classes/ScrollContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ScrollContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="ScrollContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
A helper node for displaying scrollable elements (e.g. lists).
</brief_description>
@@ -11,8 +11,22 @@
<demos>
</demos>
<methods>
+ <method name="get_h_scrollbar">
+ <return type="HScrollBar">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_v_scrollbar">
+ <return type="VScrollBar">
+ </return>
+ <description>
+ </description>
+ </method>
</methods>
<members>
+ <member name="scroll_deadzone" type="int" setter="set_deadzone" getter="get_deadzone">
+ </member>
<member name="scroll_horizontal" type="int" setter="set_h_scroll" getter="get_h_scroll">
The current horizontal scroll value.
</member>
@@ -20,12 +34,28 @@
If [code]true[/code], enables horizontal scrolling.
</member>
<member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll">
- The current horizontal scroll value.
+ The current vertical scroll value.
</member>
<member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled">
If [code]true[/code], enables vertical scrolling.
</member>
</members>
+ <signals>
+ <signal name="scroll_ended">
+ <description>
+ Emitted whenever scrolling stops.
+ </description>
+ </signal>
+ <signal name="scroll_started">
+ <description>
+ Emitted whenever scrolling is started.
+ </description>
+ </signal>
+ </signals>
<constants>
</constants>
+ <theme_items>
+ <theme_item name="bg" type="StyleBox">
+ </theme_item>
+ </theme_items>
</class>
diff --git a/doc/classes/SegmentShape2D.xml b/doc/classes/SegmentShape2D.xml
index 69dd4f7ca2..63afb37a7b 100644
--- a/doc/classes/SegmentShape2D.xml
+++ b/doc/classes/SegmentShape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SegmentShape2D" inherits="Shape2D" category="Core" version="3.1-dev">
+<class name="SegmentShape2D" inherits="Shape2D" category="Core" version="3.1">
<brief_description>
Segment shape for 2D collisions.
</brief_description>
diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml
index 353c621818..f3a37b78e1 100644
--- a/doc/classes/Semaphore.xml
+++ b/doc/classes/Semaphore.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Semaphore" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Semaphore" inherits="Reference" category="Core" version="3.1">
<brief_description>
A synchronization Semaphore.
</brief_description>
diff --git a/doc/classes/Separator.xml b/doc/classes/Separator.xml
index 725ca8d2d0..e5efa4a100 100644
--- a/doc/classes/Separator.xml
+++ b/doc/classes/Separator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Separator" inherits="Control" category="Core" version="3.1-dev">
+<class name="Separator" inherits="Control" category="Core" version="3.1">
<brief_description>
Base class for separators.
</brief_description>
diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml
index f9f26593bf..76049d8947 100644
--- a/doc/classes/Shader.xml
+++ b/doc/classes/Shader.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Shader" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Shader" inherits="Resource" category="Core" version="3.1">
<brief_description>
- To be changed, ignore.
+ A custom shader program.
</brief_description>
<description>
- To be changed, ignore.
+ This class allows you to define a custom shader program that can be used for various materials to render objects.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/shading/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/shading/index.html</link>
</tutorials>
<demos>
</demos>
@@ -24,6 +24,7 @@
<return type="int" enum="Shader.Mode">
</return>
<description>
+ Returns the shader mode for the shader, eiter [code]MODE_CANVAS_ITEM[/code], [code]MODE_SPATIAL[/code] or [code]MODE_PARTICLES[/code]
</description>
</method>
<method name="has_param" qualifiers="const">
diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml
index 57fb3ed1aa..5abba9fba9 100644
--- a/doc/classes/ShaderMaterial.xml
+++ b/doc/classes/ShaderMaterial.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ShaderMaterial" inherits="Material" category="Core" version="3.1-dev">
+<class name="ShaderMaterial" inherits="Material" category="Core" version="3.1">
<brief_description>
+ A material that uses a custom [Shader] program.
</brief_description>
<description>
+ A material that uses a custom [Shader] program to render either items to screen or process particles. You can create multiple materials for the same shader but configure different values for the uniforms defined in the shader.
</description>
<tutorials>
</tutorials>
@@ -15,6 +17,7 @@
<argument index="0" name="param" type="String">
</argument>
<description>
+ Returns the current value set for this material of a uniform in the shader.
</description>
</method>
<method name="set_shader_param">
@@ -25,11 +28,13 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
+ Changes the value set for this material of a uniform in the shader.
</description>
</method>
</methods>
<members>
<member name="shader" type="Shader" setter="set_shader" getter="get_shader">
+ The [Shader] program used to render this material.
</member>
</members>
<constants>
diff --git a/doc/classes/Shape.xml b/doc/classes/Shape.xml
index 240da1a43d..fcd01bc25a 100644
--- a/doc/classes/Shape.xml
+++ b/doc/classes/Shape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Shape" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Shape" inherits="Resource" category="Core" version="3.1">
<brief_description>
Base class for all 3D shape resources.
</brief_description>
@@ -7,7 +7,7 @@
Base class for all 3D shape resources. All 3D shapes that inherit from this can be set into a [PhysicsBody] or [Area].
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Shape2D.xml b/doc/classes/Shape2D.xml
index 0f3fc44ecb..6c13496fc4 100644
--- a/doc/classes/Shape2D.xml
+++ b/doc/classes/Shape2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Shape2D" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Shape2D" inherits="Resource" category="Core" version="3.1">
<brief_description>
Base class for all 2D Shapes.
</brief_description>
@@ -7,7 +7,7 @@
Base class for all 2D Shapes. All 2D shape types inherit from this.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/physics_introduction.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/ShortCut.xml b/doc/classes/ShortCut.xml
index 2cb832c045..6da9d7c59d 100644
--- a/doc/classes/ShortCut.xml
+++ b/doc/classes/ShortCut.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ShortCut" inherits="Resource" category="Core" version="3.1-dev">
+<class name="ShortCut" inherits="Resource" category="Core" version="3.1">
<brief_description>
A shortcut for binding input.
</brief_description>
diff --git a/doc/classes/Skeleton.xml b/doc/classes/Skeleton.xml
index 760b2e92a9..4d826002fe 100644
--- a/doc/classes/Skeleton.xml
+++ b/doc/classes/Skeleton.xml
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Skeleton" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="Skeleton" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Skeleton for characters and animated objects.
</brief_description>
<description>
Skeleton provides a hierarchical interface for managing bones, including pose, rest and animation (see [Animation]). Skeleton will support rag doll dynamics in the future.
+ The overall transform of a bone with respect to the skeleton is determined by the following hierarchical order: rest pose, custom pose and pose.
+ Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it not the actual global/world transform of the bone.
</description>
<tutorials>
</tutorials>
@@ -60,6 +62,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
+ Return the custom pose of the specified bone. Custom pose is applied on top of the rest pose.
</description>
</method>
<method name="get_bone_global_pose" qualifiers="const">
@@ -68,6 +71,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
+ Return the overall transform of the specified bone, with respect to the skeleton. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.
</description>
</method>
<method name="get_bone_name" qualifiers="const">
@@ -76,7 +80,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the name of the bone at index "index"
+ Return the name of the bone at index "index".
</description>
</method>
<method name="get_bone_parent" qualifiers="const">
@@ -94,7 +98,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
- Return the pose transform for bone "bone_idx".
+ Return the pose transform of the specified bone. Pose is applied on top of the custom pose, which is applied on top the rest pose.
</description>
</method>
<method name="get_bone_rest" qualifiers="const">
@@ -112,6 +116,7 @@
<argument index="0" name="bone_idx" type="int">
</argument>
<description>
+ Return the combination of custom pose and pose. The returned transform is in skeleton's reference frame.
</description>
</method>
<method name="get_bound_child_nodes_to_bone" qualifiers="const">
@@ -131,6 +136,36 @@
<description>
</description>
</method>
+ <method name="physical_bones_add_collision_exception">
+ <return type="void">
+ </return>
+ <argument index="0" name="exception" type="RID">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="physical_bones_remove_collision_exception">
+ <return type="void">
+ </return>
+ <argument index="0" name="exception" type="RID">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="physical_bones_start_simulation">
+ <return type="void">
+ </return>
+ <argument index="0" name="bones" type="Array" default="[ ]">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="physical_bones_stop_simulation">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="set_bone_custom_pose">
<return type="void">
</return>
diff --git a/doc/classes/Skeleton2D.xml b/doc/classes/Skeleton2D.xml
new file mode 100644
index 0000000000..654c816ba8
--- /dev/null
+++ b/doc/classes/Skeleton2D.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="Skeleton2D" inherits="Node2D" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_bone">
+ <return type="Bone2D">
+ </return>
+ <argument index="0" name="arg0" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_bone_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_skeleton" qualifiers="const">
+ <return type="RID">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/Sky.xml b/doc/classes/Sky.xml
index 4f3593dfcb..245da99084 100644
--- a/doc/classes/Sky.xml
+++ b/doc/classes/Sky.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Sky" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Sky" inherits="Resource" category="Core" version="3.1">
<brief_description>
The base class for [PanoramaSky] and [ProceduralSky].
</brief_description>
diff --git a/doc/classes/Slider.xml b/doc/classes/Slider.xml
index aa19a27735..554842b50e 100644
--- a/doc/classes/Slider.xml
+++ b/doc/classes/Slider.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Slider" inherits="Range" category="Core" version="3.1-dev">
+<class name="Slider" inherits="Range" category="Core" version="3.1">
<brief_description>
Base class for GUI Sliders.
</brief_description>
diff --git a/doc/classes/SliderJoint.xml b/doc/classes/SliderJoint.xml
index d8e4970363..edb8e6d562 100644
--- a/doc/classes/SliderJoint.xml
+++ b/doc/classes/SliderJoint.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SliderJoint" inherits="Joint" category="Core" version="3.1-dev">
+<class name="SliderJoint" inherits="Joint" category="Core" version="3.1">
<brief_description>
Piston kind of slider between two bodies in 3D.
</brief_description>
diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml
index b142e5c96c..d9242d8c42 100644
--- a/doc/classes/Spatial.xml
+++ b/doc/classes/Spatial.xml
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Spatial" inherits="Node" category="Core" version="3.1-dev">
+<class name="Spatial" inherits="Node" category="Core" version="3.1">
<brief_description>
Most basic 3D game object, parent of all 3D related nodes.
</brief_description>
<description>
Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Spatial. Use Spatial as a parent node to move, scale, rotate and show/hide children in a 3D project.
-
Affine operations (rotate, scale, translate) happen in parent's local coordinate system, unless the Spatial object is set as top level. Affine operations in this coordinate system correspond to direct affine operations on the Spatial's transform. The word local below refers to this coordinate system. The coordinate system that is attached to the Spatial object itself is referred to as object-local coordinate system.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/introduction_to_3d.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/introduction_to_3d.html</link>
</tutorials>
<demos>
</demos>
@@ -99,7 +98,9 @@
<argument index="1" name="up" type="Vector3">
</argument>
<description>
- Rotates itself to point into direction of target position. Operations take place in global space.
+ Rotates itself so that the local -Z axis points towards the [code]target[/code] position.
+ The transform will first be rotated around the given [code]up[/code] vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the [code]target[/code] and [code]up[/code] vectors.
+ Operations take place in global space.
</description>
</method>
<method name="look_at_from_position">
@@ -112,7 +113,7 @@
<argument index="2" name="up" type="Vector3">
</argument>
<description>
- Moves the node to specified position and then rotates itself to point into direction of target position. Operations take place in global space.
+ Moves the node to the specified [code]position[/code], and then rotates itself to point toward the [code]target[/code] as per [method look_at]. Operations take place in global space.
</description>
</method>
<method name="orthonormalize">
@@ -282,7 +283,6 @@
</member>
<member name="rotation" type="Vector3" setter="set_rotation" getter="get_rotation">
Rotation part of the local transformation, specified in terms of YXZ-Euler angles in the format (X-angle, Y-angle, Z-angle), in radians.
-
Note that in the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three indepdent parameters of the Euler-angle parametrization of the rotation matrix, are stored in a [Vector3] data structure not because the rotation is a vector, but only because [Vector3] exists as a convenient data-structure to store 3 floating point numbers. Therefore, applying affine operations on the rotation "vector" is not meaningful.
</member>
<member name="rotation_degrees" type="Vector3" setter="set_rotation_degrees" getter="get_rotation_degrees">
diff --git a/doc/classes/SpatialGizmo.xml b/doc/classes/SpatialGizmo.xml
index fde79e19dd..68d1d03296 100644
--- a/doc/classes/SpatialGizmo.xml
+++ b/doc/classes/SpatialGizmo.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpatialGizmo" inherits="Reference" category="Core" version="3.1-dev">
+<class name="SpatialGizmo" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml
index ce67ddc220..b45f2a13d4 100644
--- a/doc/classes/SpatialMaterial.xml
+++ b/doc/classes/SpatialMaterial.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpatialMaterial" inherits="Material" category="Core" version="3.1-dev">
+<class name="SpatialMaterial" inherits="Material" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/spatial_material.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/spatial_material.html</link>
</tutorials>
<demos>
</demos>
@@ -84,6 +84,8 @@
</member>
<member name="flags_albedo_tex_force_srgb" type="bool" setter="set_flag" getter="get_flag">
</member>
+ <member name="flags_do_not_receive_shadows" type="bool" setter="set_flag" getter="get_flag">
+ </member>
<member name="flags_fixed_size" type="bool" setter="set_flag" getter="get_flag">
</member>
<member name="flags_no_depth_test" type="bool" setter="set_flag" getter="get_flag">
@@ -316,7 +318,9 @@
</constant>
<constant name="FLAG_ALBEDO_TEXTURE_FORCE_SRGB" value="13" enum="Flags">
</constant>
- <constant name="FLAG_MAX" value="14" enum="Flags">
+ <constant name="FLAG_DONT_RECEIVE_SHADOWS" value="14" enum="Flags">
+ </constant>
+ <constant name="FLAG_MAX" value="15" enum="Flags">
</constant>
<constant name="DIFFUSE_BURLEY" value="0" enum="DiffuseMode">
</constant>
diff --git a/doc/classes/SpatialVelocityTracker.xml b/doc/classes/SpatialVelocityTracker.xml
index 8d666c9f84..45cc4232dc 100644
--- a/doc/classes/SpatialVelocityTracker.xml
+++ b/doc/classes/SpatialVelocityTracker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpatialVelocityTracker" inherits="Reference" category="Core" version="3.1-dev">
+<class name="SpatialVelocityTracker" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/SphereMesh.xml b/doc/classes/SphereMesh.xml
index 72af6137d0..e0e2d10408 100644
--- a/doc/classes/SphereMesh.xml
+++ b/doc/classes/SphereMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SphereMesh" inherits="PrimitiveMesh" category="Core" version="3.1-dev">
+<class name="SphereMesh" inherits="PrimitiveMesh" category="Core" version="3.1">
<brief_description>
Class representing a spherical [PrimitiveMesh].
</brief_description>
diff --git a/doc/classes/SphereShape.xml b/doc/classes/SphereShape.xml
index cb2461942d..bc0cd79ddd 100644
--- a/doc/classes/SphereShape.xml
+++ b/doc/classes/SphereShape.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SphereShape" inherits="Shape" category="Core" version="3.1-dev">
+<class name="SphereShape" inherits="Shape" category="Core" version="3.1">
<brief_description>
Sphere shape for 3D collisions.
</brief_description>
diff --git a/doc/classes/SpinBox.xml b/doc/classes/SpinBox.xml
index 76dcfa97f6..0fcd5bbaf5 100644
--- a/doc/classes/SpinBox.xml
+++ b/doc/classes/SpinBox.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpinBox" inherits="Range" category="Core" version="3.1-dev">
+<class name="SpinBox" inherits="Range" category="Core" version="3.1">
<brief_description>
Numerical input text field.
</brief_description>
diff --git a/doc/classes/SplitContainer.xml b/doc/classes/SplitContainer.xml
index 54cfaaff63..d56da68448 100644
--- a/doc/classes/SplitContainer.xml
+++ b/doc/classes/SplitContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SplitContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="SplitContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
Container for splitting and adjusting.
</brief_description>
@@ -16,6 +16,7 @@
<member name="collapsed" type="bool" setter="set_collapsed" getter="is_collapsed">
</member>
<member name="dragger_visibility" type="int" setter="set_dragger_visibility" getter="get_dragger_visibility" enum="SplitContainer.DraggerVisibility">
+ Determines whether the dragger is visible.
</member>
<member name="split_offset" type="int" setter="set_split_offset" getter="get_split_offset">
</member>
diff --git a/doc/classes/SpotLight.xml b/doc/classes/SpotLight.xml
index 88e3240188..1f81e9e5c2 100644
--- a/doc/classes/SpotLight.xml
+++ b/doc/classes/SpotLight.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpotLight" inherits="Light" category="Core" version="3.1-dev">
+<class name="SpotLight" inherits="Light" category="Core" version="3.1">
<brief_description>
Spotlight [Light], such as a reflector spotlight or a lantern.
</brief_description>
@@ -7,7 +7,7 @@
A SpotLight light is a type of [Light] node that emits lights in a specific direction, in the shape of a cone. The light is attenuated through the distance and this attenuation can be configured by changing the energy, radius and attenuation parameters of [Light]. TODO: Image of a spotlight.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/lights_and_shadows.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml
index a3423a0739..dd7fe010ba 100644
--- a/doc/classes/Sprite.xml
+++ b/doc/classes/Sprite.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Sprite" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="Sprite" inherits="Node2D" category="Core" version="3.1">
<brief_description>
General purpose Sprite node.
</brief_description>
@@ -11,6 +11,13 @@
<demos>
</demos>
<methods>
+ <method name="get_rect" qualifiers="const">
+ <return type="Rect2">
+ </return>
+ <description>
+ Returns a Rect2 representing the Sprite's boundary relative to its local coordinates.
+ </description>
+ </method>
</methods>
<members>
<member name="centered" type="bool" setter="set_centered" getter="is_centered">
diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml
index 122f0b85f7..2a65246dde 100644
--- a/doc/classes/Sprite3D.xml
+++ b/doc/classes/Sprite3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Sprite3D" inherits="SpriteBase3D" category="Core" version="3.1-dev">
+<class name="Sprite3D" inherits="SpriteBase3D" category="Core" version="3.1">
<brief_description>
2D Sprite node in 3D world.
</brief_description>
diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml
index 6dba815255..fd4b583928 100644
--- a/doc/classes/SpriteBase3D.xml
+++ b/doc/classes/SpriteBase3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpriteBase3D" inherits="GeometryInstance" category="Core" version="3.1-dev">
+<class name="SpriteBase3D" inherits="GeometryInstance" category="Core" version="3.1">
<brief_description>
2D Sprite node in 3D environment.
</brief_description>
@@ -11,6 +11,12 @@
<demos>
</demos>
<methods>
+ <method name="generate_triangle_mesh" qualifiers="const">
+ <return type="TriangleMesh">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_item_rect" qualifiers="const">
<return type="Rect2">
</return>
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index e7199d7163..91129b5850 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpriteFrames" inherits="Resource" category="Core" version="3.1-dev">
+<class name="SpriteFrames" inherits="Resource" category="Core" version="3.1">
<brief_description>
Sprite frame library for AnimatedSprite.
</brief_description>
@@ -17,7 +17,7 @@
<argument index="0" name="anim" type="String">
</argument>
<description>
- Adds a new animation to the the library.
+ Adds a new animation to the library.
</description>
</method>
<method name="add_frame">
diff --git a/doc/classes/StaticBody.xml b/doc/classes/StaticBody.xml
index df56330c08..26b4857670 100644
--- a/doc/classes/StaticBody.xml
+++ b/doc/classes/StaticBody.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StaticBody" inherits="PhysicsBody" category="Core" version="3.1-dev">
+<class name="StaticBody" inherits="PhysicsBody" category="Core" version="3.1">
<brief_description>
Static body for 3D Physics.
</brief_description>
diff --git a/doc/classes/StaticBody2D.xml b/doc/classes/StaticBody2D.xml
index ca12699061..95acda79df 100644
--- a/doc/classes/StaticBody2D.xml
+++ b/doc/classes/StaticBody2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StaticBody2D" inherits="PhysicsBody2D" category="Core" version="3.1-dev">
+<class name="StaticBody2D" inherits="PhysicsBody2D" category="Core" version="3.1">
<brief_description>
Static body for 2D Physics.
</brief_description>
diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml
index 4ab83f8d8a..ebe29c7e24 100644
--- a/doc/classes/StreamPeer.xml
+++ b/doc/classes/StreamPeer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StreamPeer" inherits="Reference" category="Core" version="3.1-dev">
+<class name="StreamPeer" inherits="Reference" category="Core" version="3.1">
<brief_description>
Abstraction and base class for stream-based protocols.
</brief_description>
diff --git a/doc/classes/StreamPeerBuffer.xml b/doc/classes/StreamPeerBuffer.xml
index a3c118ec60..3d9bdce762 100644
--- a/doc/classes/StreamPeerBuffer.xml
+++ b/doc/classes/StreamPeerBuffer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StreamPeerBuffer" inherits="StreamPeer" category="Core" version="3.1-dev">
+<class name="StreamPeerBuffer" inherits="StreamPeer" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/StreamPeerSSL.xml b/doc/classes/StreamPeerSSL.xml
index 32459efd47..3081abd5c4 100644
--- a/doc/classes/StreamPeerSSL.xml
+++ b/doc/classes/StreamPeerSSL.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StreamPeerSSL" inherits="StreamPeer" category="Core" version="3.1-dev">
+<class name="StreamPeerSSL" inherits="StreamPeer" category="Core" version="3.1">
<brief_description>
SSL Stream peer.
</brief_description>
@@ -7,7 +7,7 @@
SSL Stream peer. This object can be used to connect to SSL servers.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/networking/ssl_certificates.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/networking/ssl_certificates.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/StreamPeerTCP.xml b/doc/classes/StreamPeerTCP.xml
index ef856551bb..5fc8e99ced 100644
--- a/doc/classes/StreamPeerTCP.xml
+++ b/doc/classes/StreamPeerTCP.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StreamPeerTCP" inherits="StreamPeer" category="Core" version="3.1-dev">
+<class name="StreamPeerTCP" inherits="StreamPeer" category="Core" version="3.1">
<brief_description>
TCP Stream peer.
</brief_description>
diff --git a/doc/classes/StreamTexture.xml b/doc/classes/StreamTexture.xml
index 7ed95ef01c..3b44d0f00f 100644
--- a/doc/classes/StreamTexture.xml
+++ b/doc/classes/StreamTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StreamTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="StreamTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
A .stex texture.
</brief_description>
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index 01d8dc32e6..0ba1066dfd 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="String" category="Built-In Types" version="3.1-dev">
+<class name="String" category="Built-In Types" version="3.1">
<brief_description>
Built-in string class.
</brief_description>
@@ -490,6 +490,15 @@
Returns the string's amount of characters.
</description>
</method>
+ <method name="lstrip">
+ <return type="String">
+ </return>
+ <argument index="0" name="chars" type="String">
+ </argument>
+ <description>
+ Returns a copy of the string with characters removed from the left.
+ </description>
+ </method>
<method name="match">
<return type="bool">
</return>
@@ -634,6 +643,29 @@
Returns the right side of the string from a given position.
</description>
</method>
+ <method name="rsplit">
+ <return type="PoolStringArray">
+ </return>
+ <argument index="0" name="divisor" type="String">
+ </argument>
+ <argument index="1" name="allow_empty" type="bool" default="True">
+ </argument>
+ <argument index="2" name="maxsplit" type="int" default="0">
+ </argument>
+ <description>
+ Splits the string by a [code]divisor[/code] string and returns an array of the substrings, starting from right. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".
+ If [code]maxsplit[/code] is specified, then it is number of splits to do, default is 0 which splits all the items.
+ </description>
+ </method>
+ <method name="rstrip">
+ <return type="String">
+ </return>
+ <argument index="0" name="chars" type="String">
+ </argument>
+ <description>
+ Returns a copy of the string with characters removed from the right.
+ </description>
+ </method>
<method name="sha256_buffer">
<return type="PoolByteArray">
</return>
@@ -745,6 +777,24 @@
Converts the String (which is an array of characters) to [PoolByteArray] (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii().
</description>
</method>
+ <method name="trim_prefix">
+ <return type="String">
+ </return>
+ <argument index="0" name="prefix" type="String">
+ </argument>
+ <description>
+ Removes a given string from the start if it starts with it or leaves the string unchanged.
+ </description>
+ </method>
+ <method name="trim_suffix">
+ <return type="String">
+ </return>
+ <argument index="0" name="suffix" type="String">
+ </argument>
+ <description>
+ Removes a given string from the end if it ends with it or leaves the string unchanged.
+ </description>
+ </method>
<method name="xml_escape">
<return type="String">
</return>
diff --git a/doc/classes/StyleBox.xml b/doc/classes/StyleBox.xml
index 1e68d83237..dee3e6db49 100644
--- a/doc/classes/StyleBox.xml
+++ b/doc/classes/StyleBox.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StyleBox" inherits="Resource" category="Core" version="3.1-dev">
+<class name="StyleBox" inherits="Resource" category="Core" version="3.1">
<brief_description>
Base class for drawing stylized boxes for the UI.
</brief_description>
diff --git a/doc/classes/StyleBoxEmpty.xml b/doc/classes/StyleBoxEmpty.xml
index b5000da265..a9eeeddd93 100644
--- a/doc/classes/StyleBoxEmpty.xml
+++ b/doc/classes/StyleBoxEmpty.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StyleBoxEmpty" inherits="StyleBox" category="Core" version="3.1-dev">
+<class name="StyleBoxEmpty" inherits="StyleBox" category="Core" version="3.1">
<brief_description>
Empty stylebox (does not display anything).
</brief_description>
diff --git a/doc/classes/StyleBoxFlat.xml b/doc/classes/StyleBoxFlat.xml
index a64ca31ff0..641d6214a4 100644
--- a/doc/classes/StyleBoxFlat.xml
+++ b/doc/classes/StyleBoxFlat.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StyleBoxFlat" inherits="StyleBox" category="Core" version="3.1-dev">
+<class name="StyleBoxFlat" inherits="StyleBox" category="Core" version="3.1">
<brief_description>
Customizable Stylebox with a given set of parameters. (no texture required)
</brief_description>
diff --git a/doc/classes/StyleBoxLine.xml b/doc/classes/StyleBoxLine.xml
index 9fa2790a4b..c891c8cf83 100644
--- a/doc/classes/StyleBoxLine.xml
+++ b/doc/classes/StyleBoxLine.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StyleBoxLine" inherits="StyleBox" category="Core" version="3.1-dev">
+<class name="StyleBoxLine" inherits="StyleBox" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/StyleBoxTexture.xml b/doc/classes/StyleBoxTexture.xml
index 6245400943..d8c378fde2 100644
--- a/doc/classes/StyleBoxTexture.xml
+++ b/doc/classes/StyleBoxTexture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StyleBoxTexture" inherits="StyleBox" category="Core" version="3.1-dev">
+<class name="StyleBoxTexture" inherits="StyleBox" category="Core" version="3.1">
<brief_description>
Texture Based 3x3 scale style.
</brief_description>
@@ -59,11 +59,11 @@
</member>
<member name="modulate_color" type="Color" setter="set_modulate" getter="get_modulate">
</member>
- <member name="normal_map" type="Resource" setter="set_normal_map" getter="get_normal_map">
+ <member name="normal_map" type="Texture" setter="set_normal_map" getter="get_normal_map">
</member>
<member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect">
</member>
- <member name="texture" type="Resource" setter="set_texture" getter="get_texture">
+ <member name="texture" type="Texture" setter="set_texture" getter="get_texture">
</member>
</members>
<signals>
diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml
index 71cfc9bb9a..7d78d71330 100644
--- a/doc/classes/SurfaceTool.xml
+++ b/doc/classes/SurfaceTool.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SurfaceTool" inherits="Reference" category="Core" version="3.1-dev">
+<class name="SurfaceTool" inherits="Reference" category="Core" version="3.1">
<brief_description>
Helper tool to create geometry.
</brief_description>
@@ -196,8 +196,11 @@
<method name="generate_normals">
<return type="void">
</return>
+ <argument index="0" name="flip" type="bool" default="false">
+ </argument>
<description>
Generates normals from Vertices so you do not have to do it manually.
+ Setting "flip" [code]true[/code] inverts resulting normals.
</description>
</method>
<method name="generate_tangents">
diff --git a/doc/classes/TCP_Server.xml b/doc/classes/TCP_Server.xml
index cac81f8e05..4e3544ce5c 100644
--- a/doc/classes/TCP_Server.xml
+++ b/doc/classes/TCP_Server.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TCP_Server" inherits="Reference" category="Core" version="3.1-dev">
+<class name="TCP_Server" inherits="Reference" category="Core" version="3.1">
<brief_description>
TCP Server.
</brief_description>
diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml
index eb3b270938..11e94abc03 100644
--- a/doc/classes/TabContainer.xml
+++ b/doc/classes/TabContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TabContainer" inherits="Control" category="Core" version="3.1-dev">
+<class name="TabContainer" inherits="Control" category="Core" version="3.1">
<brief_description>
Tabbed Container.
</brief_description>
@@ -78,6 +78,12 @@
Returns the title of the tab at index [code]tab_idx[/code]. Tab titles default to the name of the indexed child node, but this can be overridden with [method set_tab_title].
</description>
</method>
+ <method name="get_tabs_rearrange_group" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="set_popup">
<return type="void">
</return>
@@ -120,11 +126,21 @@
Sets a title for the tab at index [code]tab_idx[/code]. Tab titles default to the name of the indexed child node, but this can be overridden with [method set_tab_title].
</description>
</method>
+ <method name="set_tabs_rearrange_group">
+ <return type="void">
+ </return>
+ <argument index="0" name="group_id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="current_tab" type="int" setter="set_current_tab" getter="get_current_tab">
The current tab index. When set, this index's [Control] node's [code]visible[/code] property is set to [code]true[/code] and all others are set to [code]false[/code].
</member>
+ <member name="drag_to_rearrange_enabled" type="bool" setter="set_drag_to_rearrange_enabled" getter="get_drag_to_rearrange_enabled">
+ </member>
<member name="tab_align" type="int" setter="set_tab_align" getter="get_tab_align" enum="TabContainer.TabAlign">
The alignment of all tabs in the tab container. See the [code]ALIGN_*[/code] constants for details.
</member>
diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml
index 7c3e28ec3c..0d5f1f0ba9 100644
--- a/doc/classes/Tabs.xml
+++ b/doc/classes/Tabs.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Tabs" inherits="Control" category="Core" version="3.1-dev">
+<class name="Tabs" inherits="Control" category="Core" version="3.1">
<brief_description>
Tabs Control.
</brief_description>
@@ -80,6 +80,12 @@
<description>
</description>
</method>
+ <method name="get_tabs_rearrange_group" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="move_tab">
<return type="void">
</return>
@@ -129,10 +135,20 @@
<description>
</description>
</method>
+ <method name="set_tabs_rearrange_group">
+ <return type="void">
+ </return>
+ <argument index="0" name="group_id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="current_tab" type="int" setter="set_current_tab" getter="get_current_tab">
</member>
+ <member name="drag_to_rearrange_enabled" type="bool" setter="set_drag_to_rearrange_enabled" getter="get_drag_to_rearrange_enabled">
+ </member>
<member name="scrolling_enabled" type="bool" setter="set_scrolling_enabled" getter="get_scrolling_enabled">
</member>
<member name="tab_align" type="int" setter="set_tab_align" getter="get_tab_align" enum="Tabs.TabAlign">
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index c39baa8a8c..ee9b7383e5 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TextEdit" inherits="Control" category="Core" version="3.1-dev">
+<class name="TextEdit" inherits="Control" category="Core" version="3.1">
<brief_description>
Multiline text editing control.
</brief_description>
@@ -99,6 +99,8 @@
</argument>
<argument index="2" name="can_be_hidden" type="bool" default="true">
</argument>
+ <argument index="3" name="wrap_index" type="int" default="0">
+ </argument>
<description>
</description>
</method>
@@ -130,6 +132,14 @@
<description>
</description>
</method>
+ <method name="get_keyword_color" qualifiers="const">
+ <return type="Color">
+ </return>
+ <argument index="0" name="keyword" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="get_line" qualifiers="const">
<return type="String">
</return>
@@ -193,6 +203,14 @@
<description>
</description>
</method>
+ <method name="has_keyword_color" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="keyword" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="insert_text_at_cursor">
<return type="void">
</return>
@@ -368,7 +386,7 @@
<member name="v_scroll_speed" type="float" setter="set_v_scroll_speed" getter="get_v_scroll_speed">
If [code]true[/code], enables text wrapping when it goes beyond he edge of what is visible.
</member>
- <member name="wrap_lines" type="bool" setter="set_wrap" getter="is_wrapping">
+ <member name="wrap_enabled" type="bool" setter="set_wrap_enabled" getter="is_wrap_enabled">
</member>
</members>
<signals>
diff --git a/doc/classes/Texture.xml b/doc/classes/Texture.xml
index 997324992a..3d3ceca150 100644
--- a/doc/classes/Texture.xml
+++ b/doc/classes/Texture.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Texture" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Texture" inherits="Resource" category="Core" version="3.1">
<brief_description>
Texture for 2D and 3D.
</brief_description>
diff --git a/doc/classes/TextureButton.xml b/doc/classes/TextureButton.xml
index 1f9c6acb47..7e54ab9fe8 100644
--- a/doc/classes/TextureButton.xml
+++ b/doc/classes/TextureButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TextureButton" inherits="BaseButton" category="Core" version="3.1-dev">
+<class name="TextureButton" inherits="BaseButton" category="Core" version="3.1">
<brief_description>
Texture-based button. Supports Pressed, Hover, Disabled and Focused states.
</brief_description>
diff --git a/doc/classes/TextureProgress.xml b/doc/classes/TextureProgress.xml
index 3c4ed13746..2ae4ef2cf8 100644
--- a/doc/classes/TextureProgress.xml
+++ b/doc/classes/TextureProgress.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TextureProgress" inherits="Range" category="Core" version="3.1-dev">
+<class name="TextureProgress" inherits="Range" category="Core" version="3.1">
<brief_description>
Texture-based progress bar. Useful for loading screens and life or stamina bars.
</brief_description>
@@ -51,6 +51,12 @@
<member name="texture_under" type="Texture" setter="set_under_texture" getter="get_under_texture">
[Texture] that draws under the progress bar. The bar's background.
</member>
+ <member name="tint_over" type="Color" setter="set_tint_over" getter="get_tint_over">
+ </member>
+ <member name="tint_progress" type="Color" setter="set_tint_progress" getter="get_tint_progress">
+ </member>
+ <member name="tint_under" type="Color" setter="set_tint_under" getter="get_tint_under">
+ </member>
</members>
<constants>
<constant name="FILL_LEFT_TO_RIGHT" value="0" enum="FillMode">
diff --git a/doc/classes/TextureRect.xml b/doc/classes/TextureRect.xml
index 8d18adcc36..95afc5d281 100644
--- a/doc/classes/TextureRect.xml
+++ b/doc/classes/TextureRect.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TextureRect" inherits="Control" category="Core" version="3.1-dev">
+<class name="TextureRect" inherits="Control" category="Core" version="3.1">
<brief_description>
- Draws a sprite or a texture inside a User Interface. The texture can tile or not.
+ Control for drawing textures.
</brief_description>
<description>
- Use TextureRect to draw icons and sprites in your User Interfaces. To create panels and menu boxes, take a look at [NinePatchFrame]. Its Stretch Mode property controls the texture's scale and placement. It can scale, tile and stay centered inside its bounding rectangle. TextureRect is one of the 5 most common nodes to create game UI.
+ Used to draw icons and sprites in a user interface. The texture's placement can be controlled with the [member stretch_mode] property. It can scale, tile, or stay centered inside its bounding rectangle.
</description>
<tutorials>
</tutorials>
@@ -14,10 +14,10 @@
</methods>
<members>
<member name="expand" type="bool" setter="set_expand" getter="has_expand">
- If [code]true[/code], the texture scales to fit its bounding rectangle. Default value: [code]false[/code].
+ If [code]true[/code] the texture scales to fit its bounding rectangle. Default value: [code]false[/code].
</member>
<member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureRect.StretchMode">
- Controls the texture's behavior when you resize the node's bounding rectangle. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more.
+ Controls the texture's behavior when resizing the node's bounding rectangle. See [enum StretchMode].
</member>
<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
The node's [Texture] resource.
diff --git a/doc/classes/Theme.xml b/doc/classes/Theme.xml
index 4134936764..fe43b54d5e 100644
--- a/doc/classes/Theme.xml
+++ b/doc/classes/Theme.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Theme" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Theme" inherits="Resource" category="Core" version="3.1">
<brief_description>
Theme for controls.
</brief_description>
diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml
index c5aac8f1ce..48d075c7f5 100644
--- a/doc/classes/Thread.xml
+++ b/doc/classes/Thread.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Thread" inherits="Reference" category="Core" version="3.1-dev">
+<class name="Thread" inherits="Reference" category="Core" version="3.1">
<brief_description>
A unit of execution in a process.
</brief_description>
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml
index 0a5fc1951b..656063771d 100644
--- a/doc/classes/TileMap.xml
+++ b/doc/classes/TileMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TileMap" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="TileMap" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Node for 2D tile-based maps.
</brief_description>
@@ -7,7 +7,7 @@
Node for 2D tile-based maps. Tilemaps use a [TileSet] which contain a list of tiles (textures plus optional collision, navigation, and/or occluder shapes) which are used to create grid-based maps.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/2d/using_tilemaps.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/using_tilemaps.html</link>
</tutorials>
<demos>
</demos>
@@ -16,7 +16,14 @@
<return type="void">
</return>
<description>
- Clear all cells.
+ Clears all cells.
+ </description>
+ </method>
+ <method name="fix_invalid_tiles">
+ <return type="void">
+ </return>
+ <description>
+ Clears cells that do not exist in the tileset.
</description>
</method>
<method name="get_cell" qualifiers="const">
@@ -27,7 +34,7 @@
<argument index="1" name="y" type="int">
</argument>
<description>
- Return the tile index of the referenced cell.
+ Returns the tile index of the given cell.
</description>
</method>
<method name="get_cellv" qualifiers="const">
@@ -36,7 +43,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Return the tile index of the cell referenced by a Vector2.
+ Returns the tile index of the cell given by a Vector2.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
@@ -45,6 +52,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
+ Returns [code]true[/code] if the given collision layer bit is set.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -53,13 +61,14 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
+ Returns [code]true[/code] if the given collision mask bit is set.
</description>
</method>
<method name="get_used_cells" qualifiers="const">
<return type="Array">
</return>
<description>
- Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1).
+ Returns an array of all cells containing a tile from the tileset (i.e. a tile index different from [code]-1[/code]).
</description>
</method>
<method name="get_used_cells_by_id" qualifiers="const">
@@ -68,12 +77,14 @@
<argument index="0" name="id" type="int">
</argument>
<description>
+ Returns an array of all cells with the given tile id.
</description>
</method>
<method name="get_used_rect">
<return type="Rect2">
</return>
<description>
+ Returns a rectangle enclosing the used (non-empty) tiles of the map.
</description>
</method>
<method name="is_cell_transposed" qualifiers="const">
@@ -84,7 +95,7 @@
<argument index="1" name="y" type="int">
</argument>
<description>
- Return whether the referenced cell is transposed, i.e. the X and Y axes are swapped (mirroring with regard to the (1,1) vector).
+ Returns [code]true[/code] if the given cell is transposed, i.e. the x and y axes are swapped.
</description>
</method>
<method name="is_cell_x_flipped" qualifiers="const">
@@ -95,7 +106,7 @@
<argument index="1" name="y" type="int">
</argument>
<description>
- Return whether the referenced cell is flipped over the X axis.
+ Returns [code]true[/code] if the given cell is flipped in the x axis.
</description>
</method>
<method name="is_cell_y_flipped" qualifiers="const">
@@ -106,7 +117,7 @@
<argument index="1" name="y" type="int">
</argument>
<description>
- Return whether the referenced cell is flipped over the Y axis.
+ Returns [code]true[/code] if the given cell is flipped in the y axis.
</description>
</method>
<method name="map_to_world" qualifiers="const">
@@ -117,8 +128,8 @@
<argument index="1" name="ignore_half_ofs" type="bool" default="false">
</argument>
<description>
- Return the absolute world position corresponding to the tilemap (grid-based) coordinates given as an argument.
- Optionally, the tilemap's potential half offset can be ignored.
+ Returns the global position corresponding to the given tilemap (grid-based) coordinates.
+ Optionally, the tilemap's half offset can be ignored.
</description>
</method>
<method name="set_cell">
@@ -139,9 +150,9 @@
<argument index="6" name="autotile_coord" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
- Set the tile index for the cell referenced by its grid-based X and Y coordinates.
- A tile index of -1 clears the cell.
- Optionally, the tile can also be flipped over the X and Y coordinates, transposed, or be given autotile coordinates.
+ Sets the tile index for the cell given by a Vector2.
+ An index of [code]-1[/code] clears the cell.
+ Optionally, the tile can also be flipped, transposed, or given autotile coordinates.
</description>
</method>
<method name="set_cellv">
@@ -158,9 +169,9 @@
<argument index="4" name="transpose" type="bool" default="false">
</argument>
<description>
- Set the tile index for the cell referenced by a Vector2 of grid-based coordinates.
- A tile index of -1 clears the cell.
- Optionally, the tile can also be flipped over the X and Y axes or transposed.
+ Sets the tile index for the given cell.
+ An index of [code]-1[/code] clears the cell.
+ Optionally, the tile can also be flipped or transposed.
</description>
</method>
<method name="set_collision_layer_bit">
@@ -171,6 +182,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
+ Sets the given collision layer bit.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -181,6 +193,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
+ Sets the given collision mask bit.
</description>
</method>
<method name="update_bitmask_area">
@@ -189,7 +202,7 @@
<argument index="0" name="position" type="Vector2">
</argument>
<description>
- Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based X and Y coordinates.
+ Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based x and y coordinates.
</description>
</method>
<method name="update_bitmask_region">
@@ -200,8 +213,8 @@
<argument index="1" name="end" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
- Applies autotiling rules to the cells in the given region (specified by grid-based X and Y coordinates).
- Calling with invalid (or missing) parameters applies autotiling rules for the entire TileMap.
+ Applies autotiling rules to the cells in the given region (specified by grid-based x and y coordinates).
+ Calling with invalid (or missing) parameters applies autotiling rules for the entire tilemap.
</description>
</method>
<method name="world_to_map" qualifiers="const">
@@ -210,7 +223,7 @@
<argument index="0" name="world_position" type="Vector2">
</argument>
<description>
- Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.
+ Returns the tilemap (grid-based) coordinatescorresponding to the given global position.
</description>
</method>
</methods>
@@ -296,6 +309,7 @@
Tile origin at its center.
</constant>
<constant name="TILE_ORIGIN_BOTTOM_LEFT" value="2" enum="TileOrigin">
+ Tile origin at its bottom-left corner.
</constant>
</constants>
</class>
diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml
index 3b9a34abff..bdf8634a6c 100644
--- a/doc/classes/TileSet.xml
+++ b/doc/classes/TileSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TileSet" inherits="Resource" category="Core" version="3.1-dev">
+<class name="TileSet" inherits="Resource" category="Core" version="3.1">
<brief_description>
Tile library for tilemaps.
</brief_description>
@@ -254,6 +254,22 @@
Return the texture offset of the tile.
</description>
</method>
+ <method name="tile_get_tile_mode" qualifiers="const">
+ <return type="int" enum="TileSet.TileMode">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="tile_get_z_index" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="tile_set_light_occluder">
<return type="void">
</return>
@@ -410,11 +426,33 @@
Set the texture offset of the tile.
</description>
</method>
+ <method name="tile_set_tile_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="tilemode" type="int" enum="TileSet.TileMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="tile_set_z_index">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="z_index" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<constants>
<constant name="BITMASK_2X2" value="0" enum="BitmaskMode">
</constant>
- <constant name="BITMASK_3X3" value="1" enum="BitmaskMode">
+ <constant name="BITMASK_3X3_MINIMAL" value="1" enum="BitmaskMode">
+ </constant>
+ <constant name="BITMASK_3X3" value="2" enum="BitmaskMode">
</constant>
<constant name="BIND_TOPLEFT" value="1" enum="AutotileBindings">
</constant>
@@ -432,5 +470,11 @@
</constant>
<constant name="BIND_BOTTOMRIGHT" value="256" enum="AutotileBindings">
</constant>
+ <constant name="SINGLE_TILE" value="0" enum="TileMode">
+ </constant>
+ <constant name="AUTO_TILE" value="1" enum="TileMode">
+ </constant>
+ <constant name="ANIMATED_TILE" value="2" enum="TileMode">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml
index 892b14a933..d1c8722901 100644
--- a/doc/classes/Timer.xml
+++ b/doc/classes/Timer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Timer" inherits="Node" category="Core" version="3.1-dev">
+<class name="Timer" inherits="Node" category="Core" version="3.1">
<brief_description>
A countdown timer.
</brief_description>
@@ -21,8 +21,10 @@
<method name="start">
<return type="void">
</return>
+ <argument index="0" name="time_sec" type="float" default="-1">
+ </argument>
<description>
- Starts the timer. This also resets the remaining time to [code]wait_time[/code].
+ Starts the timer. Sets [code]wait_time[/code] to [code]time_sec[/code] if [code]time_sec[/code] &gt; 0. This also resets the remaining time to [code]wait_time[/code].
Note: this method will not resume a paused timer. See [method set_paused].
</description>
</method>
diff --git a/doc/classes/ToolButton.xml b/doc/classes/ToolButton.xml
index 916585ecf7..d8db95a854 100644
--- a/doc/classes/ToolButton.xml
+++ b/doc/classes/ToolButton.xml
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ToolButton" inherits="Button" category="Core" version="3.1-dev">
+<class name="ToolButton" inherits="Button" category="Core" version="3.1">
<brief_description>
Flat button helper class.
</brief_description>
<description>
This is a helper class to generate a flat [Button] (see [method Button.set_flat]), creating a ToolButton is equivalent to:
-
[codeblock]
var btn = Button.new()
btn.set_flat(true)
diff --git a/doc/classes/TouchScreenButton.xml b/doc/classes/TouchScreenButton.xml
index 50bb23f5d9..1b37ce95ba 100644
--- a/doc/classes/TouchScreenButton.xml
+++ b/doc/classes/TouchScreenButton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TouchScreenButton" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="TouchScreenButton" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Button for touch screen devices.
</brief_description>
diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml
index 2ebdea9d5e..0dd8038b36 100644
--- a/doc/classes/Transform.xml
+++ b/doc/classes/Transform.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Transform" category="Built-In Types" version="3.1-dev">
+<class name="Transform" category="Built-In Types" version="3.1">
<brief_description>
3D Transformation. 3x4 matrix.
</brief_description>
@@ -7,7 +7,8 @@
Represents one or many transformations in 3D space such as translation, rotation, or scaling. It consists of a [Basis] "basis" and an [Vector3] "origin". It is similar to a 3x4 matrix.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/math/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/math/index.html</link>
+ <link>http://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html</link>
</tutorials>
<demos>
</demos>
@@ -98,7 +99,9 @@
<argument index="1" name="up" type="Vector3">
</argument>
<description>
- Rotate the transform around the up vector to face the target.
+ Returns a copy of the transform rotated such that its -Z axis points towards the [code]target[/code] position.
+ The transform will first be rotated around the given [code]up[/code] vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the [code]target[/code] and [code]up[/code] vectors.
+ Operations take place in global space.
</description>
</method>
<method name="orthonormalized">
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index 11b8b37ebd..d5427ad7f8 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Transform2D" category="Built-In Types" version="3.1-dev">
+<class name="Transform2D" category="Built-In Types" version="3.1">
<brief_description>
2D Transformation. 3x2 matrix.
</brief_description>
diff --git a/doc/classes/Translation.xml b/doc/classes/Translation.xml
index d3964b8f02..c4e9dbfb70 100644
--- a/doc/classes/Translation.xml
+++ b/doc/classes/Translation.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Translation" inherits="Resource" category="Core" version="3.1-dev">
+<class name="Translation" inherits="Resource" category="Core" version="3.1">
<brief_description>
Language Translation.
</brief_description>
diff --git a/doc/classes/TranslationServer.xml b/doc/classes/TranslationServer.xml
index a95ae9b2a3..52d2b2cc47 100644
--- a/doc/classes/TranslationServer.xml
+++ b/doc/classes/TranslationServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TranslationServer" inherits="Object" category="Core" version="3.1-dev">
+<class name="TranslationServer" inherits="Object" category="Core" version="3.1">
<brief_description>
Server that manages all translations. Translations can be set to it and removed from it.
</brief_description>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index 7e8cc1179c..25426ee72c 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Tree" inherits="Control" category="Core" version="3.1-dev">
+<class name="Tree" inherits="Control" category="Core" version="3.1">
<brief_description>
Control to show a tree of items.
</brief_description>
diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml
index 21b3223cd3..57e0f2825a 100644
--- a/doc/classes/TreeItem.xml
+++ b/doc/classes/TreeItem.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TreeItem" inherits="Object" category="Core" version="3.1-dev">
+<class name="TreeItem" inherits="Object" category="Core" version="3.1">
<brief_description>
Control for a single item inside a [Tree].
</brief_description>
@@ -308,7 +308,7 @@
<argument index="0" name="child" type="Object">
</argument>
<description>
- Removes the child TreeItem at index [code]index[/code].
+ Removes the given child TreeItem.
</description>
</method>
<method name="select">
diff --git a/doc/classes/TriangleMesh.xml b/doc/classes/TriangleMesh.xml
index a55130744f..2bdc7b61f4 100644
--- a/doc/classes/TriangleMesh.xml
+++ b/doc/classes/TriangleMesh.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TriangleMesh" inherits="Reference" category="Core" version="3.1-dev">
+<class name="TriangleMesh" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index dabf8a59b3..d82694d328 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Tween" inherits="Node" category="Core" version="3.1-dev">
+<class name="Tween" inherits="Node" category="Core" version="3.1">
<brief_description>
- Node useful for animations with unknown start and end points.
+ Smoothly animates a node's properties over time.
</brief_description>
<description>
- Node useful for animations with unknown start and end points, procedural animations, making one node follow another, and other simple behavior.
- Because it is easy to get it wrong, here is a quick usage example:
+ Tweens are useful for animations requiring a numerical property to be interpolated over a range of values. The name *tween* comes from *in-betweening*, an animation technique where you specify *keyframes* and the computer interpolates the frames that appear between them.
+ Here is a brief usage example that causes a 2D node to move smoothly between two positions:
[codeblock]
var tween = get_node("Tween")
- tween.interpolate_property(get_node("Node2D_to_move"), "transform/origin", Vector2(0,0), Vector2(100,100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
+ tween.interpolate_property($Node2D, "position",
+ Vector2(0, 0), Vector2(100, 100), 1,
+ Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
[/codeblock]
- Some of the methods of this class require a property name. You can get the property name by hovering over the property in the inspector of the editor.
- Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an TRANS_* constant, and refers to the way the timing of the animation is handled (you might want to see [code]http://easings.net/[/code] for some examples). The second accepts an EASE_* constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different TRANS_* constants with EASE_IN_OUT, and use the one that looks best.
+ Many methods require a property name, such as "position" above. You can find the correct property name by hovering over the property in the Inspector.
+ Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [code]http://easings.net/[/code] for some examples). The second accepts an [enum EaseType] constant, and controls the where [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different [enum TransitionType] constants with [enum EASE_IN_OUT], and use the one that looks best.
</description>
<tutorials>
</tutorials>
@@ -41,8 +43,8 @@
<argument index="8" name="delay" type="float" default="0">
</argument>
<description>
- Follow [code]method[/code] of [code]object[/code] and apply the returned value on [code]target_method[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] later. Methods are animated by calling them with consequitive values.
- [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
+ Follows [code]method[/code] of [code]object[/code] and applies the returned value on [code]target_method[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] later. Methods are called with consecutive values.
+ Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="follow_property">
@@ -67,15 +69,15 @@
<argument index="8" name="delay" type="float" default="0">
</argument>
<description>
- Follow [code]property[/code] of [code]object[/code] and apply it on [code]target_property[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Note that [code]target:target_property[/code] would equal [code]object:property[/code] at the end of the tween.
- [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
+ Follows [code]property[/code] of [code]object[/code] and applies it on [code]target_property[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
+ Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="get_runtime" qualifiers="const">
<return type="float">
</return>
<description>
- Returns the time needed for all tweens to end in seconds, measured from the start. Thus, if you have two tweens, one ending 10 seconds after the start and the other - 20 seconds, it would return 20 seconds, as by that time all tweens would have finished.
+ Returns the total time needed for all tweens to end. If you have two tweens, one lasting 10 seconds and the other 20 seconds, it would return 20 seconds, as by that time all tweens would have finished.
</description>
</method>
<method name="interpolate_callback">
@@ -98,7 +100,7 @@
<argument index="7" name="arg5" type="Variant" default="null">
</argument>
<description>
- Call [code]callback[/code] of [code]object[/code] after [code]duration[/code]. [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
+ Calls [code]callback[/code] of [code]object[/code] after [code]duration[/code]. [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
</description>
</method>
<method name="interpolate_deferred_callback">
@@ -121,7 +123,7 @@
<argument index="7" name="arg5" type="Variant" default="null">
</argument>
<description>
- Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [method Object.call_deferred]). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
+ Calls [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [method Object.call_deferred]). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
</description>
</method>
<method name="interpolate_method">
@@ -144,8 +146,8 @@
<argument index="7" name="delay" type="float" default="0">
</argument>
<description>
- Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
- [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
+ Animates [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are called with consecutive values.
+ Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="interpolate_property">
@@ -168,15 +170,21 @@
<argument index="7" name="delay" type="float" default="0">
</argument>
<description>
- Animate [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
- [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
+ Animates [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
+ Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="is_active" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns true if any tweens are currently running, and false otherwise. Note that this method doesn't consider tweens that have ended.
+ Returns [code]true[/code] if any tweens are currently running. Note that this method doesn't consider tweens that have ended.
+ </description>
+ </method>
+ <method name="is_stopped" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
</description>
</method>
<method name="remove">
@@ -187,14 +195,14 @@
<argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Stop animating and completely remove a tween, given its object and property/method pair. Passing empty String as key will remove all tweens for given object.
+ Stops animation and removes a tween, given its object and property/method pair. By default, all tweens are removed, unless [code]key[/code] is specified.
</description>
</method>
<method name="remove_all">
<return type="bool">
</return>
<description>
- Stop animating and completely remove all tweens.
+ Stops animation and removes all tweens.
</description>
</method>
<method name="reset">
@@ -205,7 +213,7 @@
<argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair. Passing empty String as key will reset all tweens for given object.
+ Resets a tween to its initial value (the one given, not the one before the tween), given its object and property/method pair. By default, all tweens are removed, unless [code]key[/code] is specified.
</description>
</method>
<method name="reset_all">
@@ -223,14 +231,14 @@
<argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Continue animating a stopped tween, given its object and property/method pair. Passing empty String as key will resume all tweens for given object.
+ Continues animating a stopped tween, given its object and property/method pair. By default, all tweens are resumed, unless [code]key[/code] is specified.
</description>
</method>
<method name="resume_all">
<return type="bool">
</return>
<description>
- Continue animating all stopped tweens.
+ Continues animating all stopped tweens.
</description>
</method>
<method name="seek">
@@ -239,7 +247,7 @@
<argument index="0" name="time" type="float">
</argument>
<description>
- Seek the animation to the given [code]time[/code] in seconds.
+ Sets the interpolation to the given [code]time[/code] in seconds.
</description>
</method>
<method name="set_active">
@@ -248,14 +256,14 @@
<argument index="0" name="active" type="bool">
</argument>
<description>
- Activate/deactivate the tween. You can use this for pausing animations, though [method stop_all] and [method resume_all] might be more fit for this.
+ Activates/deactivates the tween. See also [method stop_all] and [method resume_all].
</description>
</method>
<method name="start">
<return type="bool">
</return>
<description>
- Start the tween node. You can define tweens both before and after this.
+ Starts the tween. You can define animations both before and after this.
</description>
</method>
<method name="stop">
@@ -266,14 +274,14 @@
<argument index="1" name="key" type="String" default="&quot;&quot;">
</argument>
<description>
- Stop animating a tween, given its object and property/method pair. Passing empty String as key will stop all tweens for given object.
+ Stops a tween, given its object and property/method pair. By default, all tweens are stopped, unless [code]key[/code] is specified.
</description>
</method>
<method name="stop_all">
<return type="bool">
</return>
<description>
- Stop animating all tweens.
+ Stops animating all tweens.
</description>
</method>
<method name="targeting_method">
@@ -298,8 +306,8 @@
<argument index="8" name="delay" type="float" default="0">
</argument>
<description>
- Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
- [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
+ Animates [code]method[/code] of [code]object[/code] from the value returned by [code]initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
+ Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="targeting_property">
@@ -324,8 +332,8 @@
<argument index="8" name="delay" type="float" default="0">
</argument>
<description>
- Animate [code]property[/code] of [code]object[/code] from the current value of the [code]initial_val[/code] property of [code]initial[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
- [code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
+ Animates [code]property[/code] of [code]object[/code] from the current value of the [code]initial_val[/code] property of [code]initial[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
+ Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="tell" qualifiers="const">
@@ -338,12 +346,13 @@
</methods>
<members>
<member name="playback_process_mode" type="int" setter="set_tween_process_mode" getter="get_tween_process_mode" enum="Tween.TweenProcessMode">
+ The tween's animation process thread. See [enum TweenProcessMode]. Default value: [enum TWEEN_PROCESS_IDLE].
</member>
<member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale">
- The speed multiplier of the tween. Set it to 1 for normal speed, 2 for two times nromal speed, and 0.5 for half of the normal speed. Setting it to 0 would pause the animation, but you might consider using [method set_active] or [method stop_all] and [method resume_all] for this.
+ The tween's speed multiplier. For example, set it to [code]1.0[/code] for normal speed, [code]2.0[/code] for two times normal speed, or [code]0.5[/code] for half of the normal speed. A value of [code]0[/code] pauses the animation, but see also [method set_active] or [method stop_all] for this.
</member>
<member name="repeat" type="bool" setter="set_repeat" getter="is_repeat">
- If [code]true[/code], the tween will repeat.
+ If [code]true[/code] the tween loops.
</member>
</members>
<signals>
@@ -353,7 +362,7 @@
<argument index="1" name="key" type="NodePath">
</argument>
<description>
- This signal is emitted when a tween ends.
+ Emitted when a tween ends.
</description>
</signal>
<signal name="tween_started">
@@ -362,7 +371,7 @@
<argument index="1" name="key" type="NodePath">
</argument>
<description>
- This signal is emitted when a tween starts.
+ Emitted when a tween starts.
</description>
</signal>
<signal name="tween_step">
@@ -375,61 +384,61 @@
<argument index="3" name="value" type="Object">
</argument>
<description>
- This signal is emitted each step of the tweening.
+ Emitted at each step of the animation.
</description>
</signal>
</signals>
<constants>
<constant name="TWEEN_PROCESS_PHYSICS" value="0" enum="TweenProcessMode">
- The [code]Tween[/code] should use [code]_physics_process[/code] for timekeeping when this is enabled.
+ The tween updates with the [code]_physics_process[/code] callback.
</constant>
<constant name="TWEEN_PROCESS_IDLE" value="1" enum="TweenProcessMode">
- The [code]Tween[/code] should use [code]_process[/code] for timekeeping when this is enabled (default).
+ The tween updates with the [code]_process[/code] callback.
</constant>
<constant name="TRANS_LINEAR" value="0" enum="TransitionType">
- Means that the animation is interpolated linearly.
+ The animation is interpolated linearly.
</constant>
<constant name="TRANS_SINE" value="1" enum="TransitionType">
- Means that the animation is interpolated using a sine wave.
+ The animation is interpolated using a sine function.
</constant>
<constant name="TRANS_QUINT" value="2" enum="TransitionType">
- Means that the animation is interpolated with a quinary (to the power of 5) function.
+ The animation is interpolated with a quintic (to the power of 5) function.
</constant>
<constant name="TRANS_QUART" value="3" enum="TransitionType">
- Means that the animation is interpolated with a quartic (to the power of 4) function.
+ The animation is interpolated with a quartic (to the power of 4) function.
</constant>
<constant name="TRANS_QUAD" value="4" enum="TransitionType">
- Means that the animation is interpolated with a quadratic (to the power of 2) function.
+ The animation is interpolated with a quadratic (to the power of 2) function.
</constant>
<constant name="TRANS_EXPO" value="5" enum="TransitionType">
- Means that the animation is interpolated with an exponential (some number to the power of x) function.
+ The animation is interpolated with an exponential (to the power of x) function.
</constant>
<constant name="TRANS_ELASTIC" value="6" enum="TransitionType">
- Means that the animation is interpolated with elasticity, wiggling around the edges.
+ The animation is interpolated with elasticity, wiggling around the edges.
</constant>
<constant name="TRANS_CUBIC" value="7" enum="TransitionType">
- Means that the animation is interpolated with a cubic (to the power of 3) function.
+ The animation is interpolated with a cubic (to the power of 3) function.
</constant>
<constant name="TRANS_CIRC" value="8" enum="TransitionType">
- Means that the animation is interpolated with a function using square roots.
+ The animation is interpolated with a function using square roots.
</constant>
<constant name="TRANS_BOUNCE" value="9" enum="TransitionType">
- Means that the animation is interpolated by bouncing at, but never surpassing, the end.
+ The animation is interpolated by bouncing at the end.
</constant>
<constant name="TRANS_BACK" value="10" enum="TransitionType">
- Means that the animation is interpolated backing out at edges.
+ The animation is interpolated backing out at ends.
</constant>
<constant name="EASE_IN" value="0" enum="EaseType">
- Signifies that the interpolation should be focused in the beginning.
+ The interpolation starts slowly and speeds up towards the end.
</constant>
<constant name="EASE_OUT" value="1" enum="EaseType">
- Signifies that the interpolation should be focused in the end.
+ The interpolation starts quickly and slows down towards the end.
</constant>
<constant name="EASE_IN_OUT" value="2" enum="EaseType">
- Signifies that the interpolation should be focused in both ends.
+ A combination of EASE_IN and EASE_OUT. The interpolation is slowest at both ends.
</constant>
<constant name="EASE_OUT_IN" value="3" enum="EaseType">
- Signifies that the interpolation should be focused in both ends, but they should be switched (a bit hard to explain, try it for yourself to be sure).
+ A combination of EASE_IN and EASE_OUT. The interpolation is fastest at both ends.
</constant>
</constants>
</class>
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml
index 13f0a506da..a1a6d7f465 100644
--- a/doc/classes/UndoRedo.xml
+++ b/doc/classes/UndoRedo.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="UndoRedo" inherits="Object" category="Core" version="3.1-dev">
+<class name="UndoRedo" inherits="Object" category="Core" version="3.1">
<brief_description>
Helper to manage UndoRedo in the editor or custom tools.
</brief_description>
diff --git a/doc/classes/VBoxContainer.xml b/doc/classes/VBoxContainer.xml
index d1eb013f29..43a7be74c3 100644
--- a/doc/classes/VBoxContainer.xml
+++ b/doc/classes/VBoxContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VBoxContainer" inherits="BoxContainer" category="Core" version="3.1-dev">
+<class name="VBoxContainer" inherits="BoxContainer" category="Core" version="3.1">
<brief_description>
Vertical box container.
</brief_description>
diff --git a/doc/classes/VScrollBar.xml b/doc/classes/VScrollBar.xml
index 9958b40027..5486140870 100644
--- a/doc/classes/VScrollBar.xml
+++ b/doc/classes/VScrollBar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VScrollBar" inherits="ScrollBar" category="Core" version="3.1-dev">
+<class name="VScrollBar" inherits="ScrollBar" category="Core" version="3.1">
<brief_description>
Vertical version of [ScrollBar], which goes from left (min) to right (max).
</brief_description>
diff --git a/doc/classes/VSeparator.xml b/doc/classes/VSeparator.xml
index 2b7027076c..4890b2d930 100644
--- a/doc/classes/VSeparator.xml
+++ b/doc/classes/VSeparator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VSeparator" inherits="Separator" category="Core" version="3.1-dev">
+<class name="VSeparator" inherits="Separator" category="Core" version="3.1">
<brief_description>
Vertical version of [Separator].
</brief_description>
diff --git a/doc/classes/VSlider.xml b/doc/classes/VSlider.xml
index 404626c32d..1dc1b795f7 100644
--- a/doc/classes/VSlider.xml
+++ b/doc/classes/VSlider.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VSlider" inherits="Slider" category="Core" version="3.1-dev">
+<class name="VSlider" inherits="Slider" category="Core" version="3.1">
<brief_description>
Vertical slider.
</brief_description>
diff --git a/doc/classes/VSplitContainer.xml b/doc/classes/VSplitContainer.xml
index 903539fd54..2203035db3 100644
--- a/doc/classes/VSplitContainer.xml
+++ b/doc/classes/VSplitContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VSplitContainer" inherits="SplitContainer" category="Core" version="3.1-dev">
+<class name="VSplitContainer" inherits="SplitContainer" category="Core" version="3.1">
<brief_description>
Vertical split container.
</brief_description>
diff --git a/doc/classes/Variant.xml b/doc/classes/Variant.xml
index 27e6799fd4..b2d21921a1 100644
--- a/doc/classes/Variant.xml
+++ b/doc/classes/Variant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Variant" category="Core" version="3.1-dev">
+<class name="Variant" category="Core" version="3.1">
<brief_description>
The most important data type in Godot.
</brief_description>
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index 7666425e86..6ffeddf5c1 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Vector2" category="Built-In Types" version="3.1-dev">
+<class name="Vector2" category="Built-In Types" version="3.1">
<brief_description>
- Vector used for 2D Math.
+ Vector used for 2D math.
</brief_description>
<description>
- 2-element structure that can be used to represent positions in 2d-space, or any other pair of numeric values.
+ 2-element structure that can be used to represent positions in 2d space or any other pair of numeric values.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/math/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/math/index.html</link>
</tutorials>
<demos>
</demos>
@@ -34,8 +34,8 @@
<return type="float">
</return>
<description>
- Returns the result of atan2 when called with the Vector's x and y as parameters (Math::atan2(x,y)).
- Be aware that it therefore returns an angle oriented clockwise with regard to the (0, 1) unit vector, and not an angle oriented counter-clockwise with regard to the (1, 0) unit vector (which would be the typical trigonometric representation of the angle when calling Math::atan2(y,x)).
+ Returns the vector's angle in radians with respect to the x-axis, or [code](1, 0)[/code] vector.
+ Equivalent to the result of atan2 when called with the vector's x and y as parameters: [code]atan2(x, y)[/code].
</description>
</method>
<method name="angle_to">
@@ -60,7 +60,7 @@
<return type="float">
</return>
<description>
- Returns the ratio of X to Y.
+ Returns the ratio of x to y.
</description>
</method>
<method name="bounce">
@@ -69,7 +69,14 @@
<argument index="0" name="n" type="Vector2">
</argument>
<description>
- Bounce returns the vector "bounced off" from the given plane, specified by its normal vector.
+ Returns the vector "bounced off" from a plane defined by the given normal.
+ </description>
+ </method>
+ <method name="ceil">
+ <return type="Vector2">
+ </return>
+ <description>
+ Returns the vector with all components rounded up.
</description>
</method>
<method name="clamped">
@@ -81,6 +88,15 @@
Returns the vector with a maximum length.
</description>
</method>
+ <method name="cross">
+ <return type="float">
+ </return>
+ <argument index="0" name="with" type="Vector2">
+ </argument>
+ <description>
+ Returns the 2 dimensional analog of the cross product with the given vector.
+ </description>
+ </method>
<method name="cubic_interpolate">
<return type="Vector2">
</return>
@@ -93,7 +109,7 @@
<argument index="3" name="t" type="float">
</argument>
<description>
- Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
+ Cubicly interpolates between this vector and [code]b[/code] using [code]pre_a[/code] and [code]post_b[/code] as handles, and returns the result at position [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], or a percentage of how far along the interpolation is.
</description>
</method>
<method name="distance_squared_to">
@@ -102,7 +118,7 @@
<argument index="0" name="to" type="Vector2">
</argument>
<description>
- Returns the squared distance to vector "b". Prefer this function over "distance_to" if you need to sort vectors or need the squared distance for some formula.
+ Returns the squared distance to vector [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula.
</description>
</method>
<method name="distance_to">
@@ -111,7 +127,7 @@
<argument index="0" name="to" type="Vector2">
</argument>
<description>
- Returns the distance to vector "b".
+ Returns the distance to vector [code]b[/code].
</description>
</method>
<method name="dot">
@@ -120,35 +136,35 @@
<argument index="0" name="with" type="Vector2">
</argument>
<description>
- Returns the dot product with vector "b".
+ Returns the dot product with vector [code]b[/code].
</description>
</method>
<method name="floor">
<return type="Vector2">
</return>
<description>
- Remove the fractional part of x and y.
+ Returns the vector with all components rounded down.
</description>
</method>
<method name="is_normalized">
<return type="bool">
</return>
<description>
- Returns whether the vector is normalized or not.
+ Returns [code]true[/code] if the vector is normalized.
</description>
</method>
<method name="length">
<return type="float">
</return>
<description>
- Returns the length of the vector.
+ Returns the vector's length.
</description>
</method>
<method name="length_squared">
<return type="float">
</return>
<description>
- Returns the squared length of the vector. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula.
+ Returns the vector's length squared. Prefer this function over [member length] if you need to sort vectors or need the squared length for some formula.
</description>
</method>
<method name="linear_interpolate">
@@ -159,14 +175,14 @@
<argument index="1" name="t" type="float">
</argument>
<description>
- Returns the result of the linear interpolation between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
+ Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], a percentage of how far along the interpolation is.
</description>
</method>
<method name="normalized">
<return type="Vector2">
</return>
<description>
- Returns a normalized vector to unit length.
+ Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code].
</description>
</method>
<method name="reflect">
@@ -175,7 +191,7 @@
<argument index="0" name="n" type="Vector2">
</argument>
<description>
- Reflects the vector along the given plane, specified by its normal vector.
+ Returns the vector reflected from a plane defined by the given normal.
</description>
</method>
<method name="rotated">
@@ -184,7 +200,26 @@
<argument index="0" name="phi" type="float">
</argument>
<description>
- Rotates the vector by "phi" radians.
+ Returns the vector rotated by [code]phi[/code] radians.
+ </description>
+ </method>
+ <method name="round">
+ <return type="Vector2">
+ </return>
+ <description>
+ Returns the vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
+ </description>
+ </method>
+ <method name="slerp">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="b" type="Vector2">
+ </argument>
+ <argument index="1" name="t" type="float">
+ </argument>
+ <description>
+ Returns the result of SLERP between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
+ Both vectors need to be normalized.
</description>
</method>
<method name="slide">
@@ -193,7 +228,7 @@
<argument index="0" name="n" type="Vector2">
</argument>
<description>
- Slide returns the component of the vector along the given plane, specified by its normal vector.
+ Returns the component of the vector along a plane defined by the given normal.
</description>
</method>
<method name="snapped">
@@ -202,7 +237,7 @@
<argument index="0" name="by" type="Vector2">
</argument>
<description>
- Snaps the vector to a grid with the given size.
+ Returns the vector snapped to a grid with the given size.
</description>
</method>
<method name="tangent">
@@ -215,10 +250,10 @@
</methods>
<members>
<member name="x" type="float" setter="" getter="">
- X component of the vector.
+ The vector's x component.
</member>
<member name="y" type="float" setter="" getter="">
- Y component of the vector.
+ The vector's y component.
</member>
</members>
<constants>
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 09afa17282..62a480166a 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Vector3" category="Built-In Types" version="3.1-dev">
+<class name="Vector3" category="Built-In Types" version="3.1">
<brief_description>
Vector class, which performs basic 3D vector math operations.
</brief_description>
@@ -7,7 +7,7 @@
Vector3 is one of the core classes of the engine, and includes several built-in helper functions to perform basic vector math operations.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/math/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/math/index.html</link>
</tutorials>
<demos>
</demos>
@@ -38,7 +38,7 @@
<argument index="0" name="to" type="Vector3">
</argument>
<description>
- Returns the vector's minimum angle to the vector [code]to[/code].
+ Returns the minimum angle to the given vector.
</description>
</method>
<method name="bounce">
@@ -47,7 +47,7 @@
<argument index="0" name="n" type="Vector3">
</argument>
<description>
- Bounce returns the vector "bounced off" from the given plane, specified by its normal vector.
+ Returns the vector "bounced off" from a plane defined by the given normal.
</description>
</method>
<method name="ceil">
@@ -87,7 +87,7 @@
<argument index="0" name="b" type="Vector3">
</argument>
<description>
- Returns the squared distance to [code]b[/code]. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula.
+ Returns the squared distance to [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula.
</description>
</method>
<method name="distance_to">
@@ -96,7 +96,7 @@
<argument index="0" name="b" type="Vector3">
</argument>
<description>
- Returns the distance to b.
+ Returns the distance to [code]b[/code].
</description>
</method>
<method name="dot">
@@ -105,7 +105,7 @@
<argument index="0" name="b" type="Vector3">
</argument>
<description>
- Returns the dot product with b.
+ Returns the dot product with [code]b[/code].
</description>
</method>
<method name="floor">
@@ -119,28 +119,28 @@
<return type="Vector3">
</return>
<description>
- Returns the inverse of the vector. This is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )
+ Returns the inverse of the vector. This is the same as [code]Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )[/code].
</description>
</method>
<method name="is_normalized">
<return type="bool">
</return>
<description>
- Returns whether the vector is normalized or not.
+ Returns [code]true[/code] if the vector is normalized.
</description>
</method>
<method name="length">
<return type="float">
</return>
<description>
- Returns the length of the vector.
+ Returns the vector's length.
</description>
</method>
<method name="length_squared">
<return type="float">
</return>
<description>
- Returns the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula.
+ Returns the vector's length squared. Prefer this function over [method length] if you need to sort vectors or need the squared length for some formula.
</description>
</method>
<method name="linear_interpolate">
@@ -151,28 +151,28 @@
<argument index="1" name="t" type="float">
</argument>
<description>
- Linearly interpolates the vector to a given one (b), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
+ Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], a percentage of how far along the interpolation is.
</description>
</method>
<method name="max_axis">
<return type="int">
</return>
<description>
- Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the largest.
+ Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants.
</description>
</method>
<method name="min_axis">
<return type="int">
</return>
<description>
- Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the smallest.
+ Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants.
</description>
</method>
<method name="normalized">
<return type="Vector3">
</return>
<description>
- Returns a copy of the normalized vector to unit length. This is the same as v / v.length().
+ Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code].
</description>
</method>
<method name="outer">
@@ -181,7 +181,7 @@
<argument index="0" name="b" type="Vector3">
</argument>
<description>
- Returns the outer product with b.
+ Returns the outer product with [code]b[/code].
</description>
</method>
<method name="reflect">
@@ -190,7 +190,7 @@
<argument index="0" name="n" type="Vector3">
</argument>
<description>
- Reflects the vector along the given plane, specified by its normal vector.
+ Returns the vector reflected from a plane defined by the given normal.
</description>
</method>
<method name="rotated">
@@ -201,7 +201,26 @@
<argument index="1" name="phi" type="float">
</argument>
<description>
- Rotates the vector around some axis by phi radians. The axis must be a normalized vector.
+ Rotates the vector around a given axis by [code]phi[/code] radians. The axis must be a normalized vector.
+ </description>
+ </method>
+ <method name="round">
+ <return type="Vector3">
+ </return>
+ <description>
+ Returns the vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
+ </description>
+ </method>
+ <method name="slerp">
+ <return type="Vector3">
+ </return>
+ <argument index="0" name="b" type="Vector3">
+ </argument>
+ <argument index="1" name="t" type="float">
+ </argument>
+ <description>
+ Returns the result of SLERP between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
+ Both vectors need to be normalized.
</description>
</method>
<method name="slide">
@@ -210,7 +229,7 @@
<argument index="0" name="n" type="Vector3">
</argument>
<description>
- Slide returns the component of the vector along the given plane, specified by its normal vector.
+ Returns the component of the vector along a plane defined by the given normal.
</description>
</method>
<method name="snapped">
@@ -232,18 +251,18 @@
</methods>
<members>
<member name="x" type="float" setter="" getter="">
- X component of the vector.
+ The vector's x component.
</member>
<member name="y" type="float" setter="" getter="">
- Y component of the vector.
+ The vector's y component.
</member>
<member name="z" type="float" setter="" getter="">
- Z component of the vector.
+ The vector's z component.
</member>
</members>
<constants>
<constant name="AXIS_X" value="0">
- Enumerated value for the X axis. Returned by functions like max_axis or min_axis.
+ Enumerated value for the X axis. Returned by [method max_axis] and [method min_axis].
</constant>
<constant name="AXIS_Y" value="1">
Enumerated value for the Y axis.
diff --git a/doc/classes/VehicleBody.xml b/doc/classes/VehicleBody.xml
index 873490c0c8..3ce0cadde9 100644
--- a/doc/classes/VehicleBody.xml
+++ b/doc/classes/VehicleBody.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VehicleBody" inherits="RigidBody" category="Core" version="3.1-dev">
+<class name="VehicleBody" inherits="RigidBody" category="Core" version="3.1">
<brief_description>
Physics body that simulates the behaviour of a car.
</brief_description>
diff --git a/doc/classes/VehicleWheel.xml b/doc/classes/VehicleWheel.xml
index ccc4b964c1..f2c6f5f287 100644
--- a/doc/classes/VehicleWheel.xml
+++ b/doc/classes/VehicleWheel.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VehicleWheel" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="VehicleWheel" inherits="Spatial" category="Core" version="3.1">
<brief_description>
- Physics object that simulates the behaviour of a wheel.
+ Physics object that simulates the behaviour of a wheel.
</brief_description>
<description>
- This node needs to be used as a child node of [VehicleBody] and simulates the behaviour of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface.
+ This node needs to be used as a child node of [VehicleBody] and simulates the behaviour of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface.
</description>
<tutorials>
</tutorials>
@@ -31,16 +31,16 @@
The damping applied to the spring when the spring is being compressed. This value should be between 0.0 (no damping) and 1.0. A value of 0.0 means the car will keep bouncing as the spring keeps its energy. A good value for this is around 0.3 for a normal car, 0.5 for a race car.
</member>
<member name="damping_relaxation" type="float" setter="set_damping_relaxation" getter="get_damping_relaxation">
- The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slighly higher then the [member damping_compression] property. For a [member damping_compression] value of 0.3, try a relaxation value of 0.5
+ The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slightly higher than the [member damping_compression] property. For a [member damping_compression] value of 0.3, try a relaxation value of 0.5
</member>
<member name="suspension_max_force" type="float" setter="set_suspension_max_force" getter="get_suspension_max_force">
- The maximum force the spring can resist. This value should be higher then a quarter of the [member RigidBody.mass] of the [VehicleBody] or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3x to 4x this number.
+ The maximum force the spring can resist. This value should be higher than a quarter of the [member RigidBody.mass] of the [VehicleBody] or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3x to 4x this number.
</member>
<member name="suspension_stiffness" type="float" setter="set_suspension_stiffness" getter="get_suspension_stiffness">
- This value defines the stiffness of the suspension. Use a value lower then 50 for an offroad car, a value between 50 and 100 for a race car and try something around 200 for something like a Formula 1 car.
+ This value defines the stiffness of the suspension. Use a value lower than 50 for an off-road car, a value between 50 and 100 for a race car and try something around 200 for something like a Formula 1 car.
</member>
<member name="suspension_travel" type="float" setter="set_suspension_travel" getter="get_suspension_travel">
- This is the distance the suspension can travel. As Godots measures are in meters keep this setting relatively low. Try a value between 0.1 and 0.3 depending on the type of car .
+ This is the distance the suspension can travel. As Godot measures are in meters keep this setting relatively low. Try a value between 0.1 and 0.3 depending on the type of car .
</member>
<member name="use_as_steering" type="bool" setter="set_use_as_steering" getter="is_used_as_steering">
If true this wheel will be turned when the car steers.
@@ -49,14 +49,14 @@
If true this wheel transfers engine force to the ground to propel the vehicle forward.
</member>
<member name="wheel_friction_slip" type="float" setter="set_friction_slip" getter="get_friction_slip">
- This determines how much grip this wheel has. It is combined with the friction setting of the surface the wheel is in contact with. 0.0 means no grip, 1.0 is normal grip. For a drift car setup, try setting the grip of the rear wheels slightly lower then the front wheels, or use a lower value to simulate tire wear.
+ This determines how much grip this wheel has. It is combined with the friction setting of the surface the wheel is in contact with. 0.0 means no grip, 1.0 is normal grip. For a drift car setup, try setting the grip of the rear wheels slightly lower than the front wheels, or use a lower value to simulate tire wear.
It's best to set this to 1.0 when starting out.
</member>
<member name="wheel_radius" type="float" setter="set_radius" getter="get_radius">
The radius of the wheel in meters.
</member>
<member name="wheel_rest_length" type="float" setter="set_suspension_rest_length" getter="get_suspension_rest_length">
- This is the distance in meters the wheel is lowered from its origin point. Don't set this to 0.0 and move the wheel into position, instead move the origin point of your wheel (the gizmo in Godot) to the position the wheel will take when bottoming out, then use the rest lenght to move the wheel down to the position it should be in when the car is in rest.
+ This is the distance in meters the wheel is lowered from its origin point. Don't set this to 0.0 and move the wheel into position, instead move the origin point of your wheel (the gizmo in Godot) to the position the wheel will take when bottoming out, then use the rest length to move the wheel down to the position it should be in when the car is in rest.
</member>
<member name="wheel_roll_influence" type="float" setter="set_roll_influence" getter="get_roll_influence">
This value effects the roll of your vehicle. If set to 0.0 for all wheels your vehicle will be prone to rolling over while a value of 1.0 will resist body roll.
diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml
index aa827c6e2c..9ffa3aa52b 100644
--- a/doc/classes/VideoPlayer.xml
+++ b/doc/classes/VideoPlayer.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoPlayer" inherits="Control" category="Core" version="3.1-dev">
+<class name="VideoPlayer" inherits="Control" category="Core" version="3.1">
<brief_description>
- Control to play video files.
+ Control for playing video streams.
</brief_description>
<description>
- This control has the ability to play video streams. The only format accepted is the OGV Theora, so any other format must be converted before using in a project.
+ Control node for playing video streams. Supported formats are WebM and OGV Theora.
</description>
<tutorials>
</tutorials>
@@ -15,51 +15,56 @@
<return type="String">
</return>
<description>
- Get the name of the video stream.
+ Returns the video stream's name.
</description>
</method>
<method name="get_video_texture">
<return type="Texture">
</return>
<description>
- Get the current frame of the video as a [Texture].
+ Returns the current frame as a [Texture].
</description>
</method>
<method name="is_playing" qualifiers="const">
<return type="bool">
</return>
<description>
- Get whether or not the video is playing.
+ Returns [code]true[/code] if the video is playing.
</description>
</method>
<method name="play">
<return type="void">
</return>
<description>
- Start the video playback.
+ Starts the video playback.
</description>
</method>
<method name="stop">
<return type="void">
</return>
<description>
- Stop the video playback.
+ Stops the video playback.
</description>
</method>
</methods>
<members>
<member name="audio_track" type="int" setter="set_audio_track" getter="get_audio_track">
+ The embedded audio track to play.
</member>
<member name="autoplay" type="bool" setter="set_autoplay" getter="has_autoplay">
+ If [code]true[/code] playback starts when the scene loads. Default value: [code]false[/code].
</member>
<member name="buffering_msec" type="int" setter="set_buffering_msec" getter="get_buffering_msec">
- The amount of milliseconds to store in buffer while playing.
+ Amount of time in milliseconds to store in buffer while playing.
</member>
<member name="bus" type="String" setter="set_bus" getter="get_bus">
+ Audio bus to use for sound playback.
</member>
<member name="expand" type="bool" setter="set_expand" getter="has_expand">
+ If [code]true[/code] the video scales to the control size. Default value: [code]true[/code].
</member>
<member name="paused" type="bool" setter="set_paused" getter="is_paused">
+ If [code]true[/code] the video is paused.
</member>
<member name="stream" type="VideoStream" setter="set_stream" getter="get_stream">
</member>
@@ -67,11 +72,19 @@
The current position of the stream, in seconds.
</member>
<member name="volume" type="float" setter="set_volume" getter="get_volume">
- The volume of the audio track as a linear value.
+ Audio volume as a linear value.
</member>
<member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db">
+ Audio volume in dB.
</member>
</members>
+ <signals>
+ <signal name="finished">
+ <description>
+ Emitted when playback is finished.
+ </description>
+ </signal>
+ </signals>
<constants>
</constants>
</class>
diff --git a/doc/classes/VideoStream.xml b/doc/classes/VideoStream.xml
index c777673cf4..6bfa48511b 100644
--- a/doc/classes/VideoStream.xml
+++ b/doc/classes/VideoStream.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoStream" inherits="Resource" category="Core" version="3.1-dev">
+<class name="VideoStream" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 6aac66269d..af0712d357 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Viewport" inherits="Node" category="Core" version="3.1-dev">
+<class name="Viewport" inherits="Node" category="Core" version="3.1">
<brief_description>
Creates a sub-view into the screen.
</brief_description>
<description>
A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera 3D nodes will render on it too.
Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
- If a viewport is a child of a [Control], it will automatically take up its same rect and position, otherwise they must be set manually.
+ If a viewport is a child of a [ViewportContainer], it will automatically take up its size, otherwise it must be set manually.
Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
Also, viewports can be assigned to different screens in case the devices have multiple screens.
Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html
- http://docs.godotengine.org/en/3.0/tutorials/viewports/index.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/2d/2d_transforms.html</link>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/viewports/index.html</link>
</tutorials>
<demos>
</demos>
@@ -212,6 +212,9 @@
<member name="hdr" type="bool" setter="set_hdr" getter="get_hdr">
If [code]true[/code] the viewport rendering will receive benefits from High Dynamic Range algorithm. Default value: [code]true[/code].
</member>
+ <member name="keep_3d_linear" type="bool" setter="set_keep_3d_linear" getter="get_keep_3d_linear">
+ If [code]true[/code] the result after 3D rendering will not have a linear to sRGB color conversion applied. This is important when the viewport is used as a render target where the result is used as a texture on a 3D object rendered in another viewport. It is also important if the viewport is used to create data that is not color based (noise, heightmaps, pickmaps, etc.). Do not enable this when the viewport is used as a texture on a 2D object or if the viewport is your final output.
+ </member>
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA">
The multisample anti-aliasing mode. Default value: [code]MSAA_DISABLED[/code].
</member>
@@ -273,7 +276,7 @@
Do not update the render target.
</constant>
<constant name="UPDATE_ONCE" value="1" enum="UpdateMode">
- Update the render target once, then switch to [code]UPDATE_DISABLED[/code]
+ Update the render target once, then switch to [code]UPDATE_DISABLED[/code].
</constant>
<constant name="UPDATE_WHEN_VISIBLE" value="2" enum="UpdateMode">
Update the render target only when it is visible. This is the default value.
@@ -326,6 +329,7 @@
Objects are displayed without light information.
</constant>
<constant name="DEBUG_DRAW_OVERDRAW" value="2" enum="DebugDraw">
+ Objected are displayed semi-transparent with additive blending so you can see where they intersect.
</constant>
<constant name="DEBUG_DRAW_WIREFRAME" value="3" enum="DebugDraw">
Objects are displayed in wireframe style.
@@ -350,10 +354,13 @@
<constant name="USAGE_3D_NO_EFFECTS" value="3" enum="Usage">
</constant>
<constant name="CLEAR_MODE_ALWAYS" value="0" enum="ClearMode">
+ Always clear the render target before drawing.
</constant>
<constant name="CLEAR_MODE_NEVER" value="1" enum="ClearMode">
+ Never clear the render target.
</constant>
<constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2" enum="ClearMode">
+ Clear the render target next frame, then switch to [code]CLEAR_MODE_NEVER[/code].
</constant>
</constants>
</class>
diff --git a/doc/classes/ViewportContainer.xml b/doc/classes/ViewportContainer.xml
index 8c89a2c1be..8c60fb473d 100644
--- a/doc/classes/ViewportContainer.xml
+++ b/doc/classes/ViewportContainer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ViewportContainer" inherits="Container" category="Core" version="3.1-dev">
+<class name="ViewportContainer" inherits="Container" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/ViewportTexture.xml b/doc/classes/ViewportTexture.xml
index 6900c6563d..67f1e09c75 100644
--- a/doc/classes/ViewportTexture.xml
+++ b/doc/classes/ViewportTexture.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ViewportTexture" inherits="Texture" category="Core" version="3.1-dev">
+<class name="ViewportTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
+ Texture which displays the content of a [Viewport].
</brief_description>
<description>
+ Displays the content of a [Viewport] node as a dynamic [Texture]. This can be used to mix controls, 2D, and 3D elements in the same scene.
+ To create a ViewportTexture in code, use the [method Viewport.get_texture] method on the target viewport.
</description>
<tutorials>
</tutorials>
@@ -12,6 +15,7 @@
</methods>
<members>
<member name="viewport_path" type="NodePath" setter="set_viewport_path_in_scene" getter="get_viewport_path_in_scene">
+ The path to the [Viewport] node to display. This is relative to the scene root, not to the node which uses the texture.
</member>
</members>
<constants>
diff --git a/doc/classes/VisibilityEnabler.xml b/doc/classes/VisibilityEnabler.xml
index 0094a9b3cc..83ba9495e5 100644
--- a/doc/classes/VisibilityEnabler.xml
+++ b/doc/classes/VisibilityEnabler.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisibilityEnabler" inherits="VisibilityNotifier" category="Core" version="3.1-dev">
+<class name="VisibilityEnabler" inherits="VisibilityNotifier" category="Core" version="3.1">
<brief_description>
Enable certain nodes only when visible.
</brief_description>
diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml
index 6b66d76733..8dfbaec6e8 100644
--- a/doc/classes/VisibilityEnabler2D.xml
+++ b/doc/classes/VisibilityEnabler2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisibilityEnabler2D" inherits="VisibilityNotifier2D" category="Core" version="3.1-dev">
+<class name="VisibilityEnabler2D" inherits="VisibilityNotifier2D" category="Core" version="3.1">
<brief_description>
Enable certain nodes only when visible.
</brief_description>
diff --git a/doc/classes/VisibilityNotifier.xml b/doc/classes/VisibilityNotifier.xml
index c430a1336d..2f22dc99bf 100644
--- a/doc/classes/VisibilityNotifier.xml
+++ b/doc/classes/VisibilityNotifier.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisibilityNotifier" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="VisibilityNotifier" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Detects when the node is visible on screen.
</brief_description>
diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml
index 67b3525eb4..b98f2794d2 100644
--- a/doc/classes/VisibilityNotifier2D.xml
+++ b/doc/classes/VisibilityNotifier2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisibilityNotifier2D" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="VisibilityNotifier2D" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Detects when the node is visible on screen.
</brief_description>
diff --git a/doc/classes/VisualInstance.xml b/doc/classes/VisualInstance.xml
index 81e1bcf7f7..502209fac5 100644
--- a/doc/classes/VisualInstance.xml
+++ b/doc/classes/VisualInstance.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualInstance" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="VisualInstance" inherits="Spatial" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml
index 505a3d1474..893db84640 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/VisualServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualServer" inherits="Object" category="Core" version="3.1-dev">
+<class name="VisualServer" inherits="Object" category="Core" version="3.1">
<brief_description>
Server for anything visible.
</brief_description>
@@ -175,7 +175,9 @@
</argument>
<argument index="1" name="mesh" type="RID">
</argument>
- <argument index="2" name="skeleton" type="RID">
+ <argument index="2" name="texture" type="RID">
+ </argument>
+ <argument index="3" name="normal_map" type="RID">
</argument>
<description>
Adds a [Mesh] to the [CanvasItem]'s draw commands. Only affects its aabb at the moment.
@@ -188,7 +190,9 @@
</argument>
<argument index="1" name="mesh" type="RID">
</argument>
- <argument index="2" name="skeleton" type="RID">
+ <argument index="2" name="texture" type="RID">
+ </argument>
+ <argument index="3" name="normal_map" type="RID">
</argument>
<description>
Adds a [MultiMesh] to the [CanvasItem]'s draw commands. Only affects its aabb at the moment.
@@ -324,7 +328,7 @@
</argument>
<description>
Adds a [Transform2D] command to the [CanvasItem]'s draw commands.
- This sets the extra_matrix uniform when executed. This affects the later command's of the canvas item.
+ This sets the extra_matrix uniform when executed. This affects the later commands of the canvas item.
</description>
</method>
<method name="canvas_item_add_texture_rect">
@@ -384,14 +388,17 @@
</argument>
<argument index="4" name="uvs" type="PoolVector2Array" default="PoolVector2Array( )">
</argument>
- <argument index="5" name="texture" type="RID">
+ <argument index="5" name="bones" type="PoolIntArray" default="PoolIntArray( )">
+ </argument>
+ <argument index="6" name="weights" type="PoolRealArray" default="PoolRealArray( )">
</argument>
- <argument index="6" name="count" type="int" default="-1">
+ <argument index="7" name="texture" type="RID">
</argument>
- <argument index="7" name="normal_map" type="RID">
+ <argument index="8" name="count" type="int" default="-1">
+ </argument>
+ <argument index="9" name="normal_map" type="RID">
</argument>
<description>
- Adds a triangle array to the [CanvasItem]'s draw commands.
</description>
</method>
<method name="canvas_item_clear">
@@ -3326,6 +3333,32 @@
Sets the texture's image data. If it's a CubeMap, it sets the image data at a cube side.
</description>
</method>
+ <method name="texture_set_data_partial">
+ <return type="void">
+ </return>
+ <argument index="0" name="texture" type="RID">
+ </argument>
+ <argument index="1" name="image" type="Image">
+ </argument>
+ <argument index="2" name="src_x" type="int">
+ </argument>
+ <argument index="3" name="src_y" type="int">
+ </argument>
+ <argument index="4" name="src_w" type="int">
+ </argument>
+ <argument index="5" name="src_h" type="int">
+ </argument>
+ <argument index="6" name="dst_x" type="int">
+ </argument>
+ <argument index="7" name="dst_y" type="int">
+ </argument>
+ <argument index="8" name="dst_mip" type="int">
+ </argument>
+ <argument index="9" name="cube_side" type="int" enum="VisualServer.CubeMapSide" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="texture_set_flags">
<return type="void">
</return>
diff --git a/doc/classes/WeakRef.xml b/doc/classes/WeakRef.xml
index adaa964630..4a0f3588c2 100644
--- a/doc/classes/WeakRef.xml
+++ b/doc/classes/WeakRef.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WeakRef" inherits="Reference" category="Core" version="3.1-dev">
+<class name="WeakRef" inherits="Reference" category="Core" version="3.1">
<brief_description>
Holds an [Object], but does not contribute to the reference count if the object is a reference.
</brief_description>
diff --git a/doc/classes/WebSocketClient.xml b/doc/classes/WebSocketClient.xml
deleted file mode 100644
index 9c0685031c..0000000000
--- a/doc/classes/WebSocketClient.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebSocketClient" inherits="WebSocketMultiplayerPeer" category="Core" version="3.1-dev">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <demos>
- </demos>
- <methods>
- <method name="connect_to_url">
- <return type="int" enum="Error">
- </return>
- <argument index="0" name="url" type="String">
- </argument>
- <argument index="1" name="protocols" type="PoolStringArray" default="PoolStringArray( )">
- </argument>
- <argument index="2" name="gd_mp_api" type="bool" default="false">
- </argument>
- <description>
- </description>
- </method>
- <method name="disconnect_from_host">
- <return type="void">
- </return>
- <description>
- </description>
- </method>
- </methods>
- <signals>
- <signal name="connection_closed">
- <description>
- </description>
- </signal>
- <signal name="connection_error">
- <description>
- </description>
- </signal>
- <signal name="connection_established">
- <argument index="0" name="protocol" type="String">
- </argument>
- <description>
- </description>
- </signal>
- <signal name="data_received">
- <description>
- </description>
- </signal>
- </signals>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/WebSocketPeer.xml b/doc/classes/WebSocketPeer.xml
deleted file mode 100644
index fba8322889..0000000000
--- a/doc/classes/WebSocketPeer.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebSocketPeer" inherits="PacketPeer" category="Core" version="3.1-dev">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <demos>
- </demos>
- <methods>
- <method name="close">
- <return type="void">
- </return>
- <description>
- </description>
- </method>
- <method name="get_write_mode" qualifiers="const">
- <return type="int" enum="WebSocketPeer.WriteMode">
- </return>
- <description>
- </description>
- </method>
- <method name="is_connected_to_host" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- <method name="set_write_mode">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="WebSocketPeer.WriteMode">
- </argument>
- <description>
- </description>
- </method>
- <method name="was_string_packet" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- </methods>
- <constants>
- <constant name="WRITE_MODE_TEXT" value="0" enum="WriteMode">
- </constant>
- <constant name="WRITE_MODE_BINARY" value="1" enum="WriteMode">
- </constant>
- </constants>
-</class>
diff --git a/doc/classes/WebSocketServer.xml b/doc/classes/WebSocketServer.xml
deleted file mode 100644
index 887df696ff..0000000000
--- a/doc/classes/WebSocketServer.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebSocketServer" inherits="WebSocketMultiplayerPeer" category="Core" version="3.1-dev">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <demos>
- </demos>
- <methods>
- <method name="has_peer" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
- <description>
- </description>
- </method>
- <method name="is_listening" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- </description>
- </method>
- <method name="listen">
- <return type="int" enum="Error">
- </return>
- <argument index="0" name="port" type="int">
- </argument>
- <argument index="1" name="protocols" type="PoolStringArray" default="PoolStringArray( )">
- </argument>
- <argument index="2" name="gd_mp_api" type="bool" default="false">
- </argument>
- <description>
- </description>
- </method>
- <method name="stop">
- <return type="void">
- </return>
- <description>
- </description>
- </method>
- </methods>
- <signals>
- <signal name="client_connected">
- <argument index="0" name="id" type="int">
- </argument>
- <argument index="1" name="protocol" type="String">
- </argument>
- <description>
- </description>
- </signal>
- <signal name="client_disconnected">
- <argument index="0" name="id" type="int">
- </argument>
- <description>
- </description>
- </signal>
- <signal name="data_received">
- <argument index="0" name="id" type="int">
- </argument>
- <description>
- </description>
- </signal>
- </signals>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/WindowDialog.xml b/doc/classes/WindowDialog.xml
index ef4f6196b5..39487f5020 100644
--- a/doc/classes/WindowDialog.xml
+++ b/doc/classes/WindowDialog.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WindowDialog" inherits="Popup" category="Core" version="3.1-dev">
+<class name="WindowDialog" inherits="Popup" category="Core" version="3.1">
<brief_description>
Base class for window dialogs.
</brief_description>
diff --git a/doc/classes/World.xml b/doc/classes/World.xml
index 810e659c74..540848e40a 100644
--- a/doc/classes/World.xml
+++ b/doc/classes/World.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="World" inherits="Resource" category="Core" version="3.1-dev">
+<class name="World" inherits="Resource" category="Core" version="3.1">
<brief_description>
Class that has everything pertaining to a world.
</brief_description>
@@ -7,7 +7,7 @@
Class that has everything pertaining to a world. A physics space, a visual scenario and a sound space. Spatial nodes register their resources into the current world.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/World2D.xml b/doc/classes/World2D.xml
index acde276c1d..780cdd181a 100644
--- a/doc/classes/World2D.xml
+++ b/doc/classes/World2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="World2D" inherits="Resource" category="Core" version="3.1-dev">
+<class name="World2D" inherits="Resource" category="Core" version="3.1">
<brief_description>
Class that has everything pertaining to a 2D world.
</brief_description>
@@ -7,7 +7,7 @@
Class that has everything pertaining to a 2D world. A physics space, a visual scenario and a sound space. 2D nodes register their resources into the current 2D world.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/physics/ray-casting.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/WorldEnvironment.xml b/doc/classes/WorldEnvironment.xml
index 266f94c317..e68ad2800e 100644
--- a/doc/classes/WorldEnvironment.xml
+++ b/doc/classes/WorldEnvironment.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WorldEnvironment" inherits="Node" category="Core" version="3.1-dev">
+<class name="WorldEnvironment" inherits="Node" category="Core" version="3.1">
<brief_description>
Default environment properties for the entire scene (post-processing effects, lightning and background settings).
</brief_description>
@@ -9,7 +9,7 @@
The [code]WorldEnvironment[/code] allows the user to specify default lighting parameters (e.g. ambient lighting), various post-processing effects (e.g. SSAO, DOF, Tonemapping), and how to draw the background (e.g. solid color, skybox). Usually, these are added in order to improve the realism/color balance of the scene.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/environment_and_post_processing.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/environment_and_post_processing.html</link>
</tutorials>
<demos>
</demos>
diff --git a/doc/classes/XMLParser.xml b/doc/classes/XMLParser.xml
index 8855adec22..fb03ab1692 100644
--- a/doc/classes/XMLParser.xml
+++ b/doc/classes/XMLParser.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="XMLParser" inherits="Reference" category="Core" version="3.1-dev">
+<class name="XMLParser" inherits="Reference" category="Core" version="3.1">
<brief_description>
Low-level class for creating parsers for XML files.
</brief_description>
diff --git a/doc/classes/YSort.xml b/doc/classes/YSort.xml
index fdccfaf531..12b9cb623f 100644
--- a/doc/classes/YSort.xml
+++ b/doc/classes/YSort.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="YSort" inherits="Node2D" category="Core" version="3.1-dev">
+<class name="YSort" inherits="Node2D" category="Core" version="3.1">
<brief_description>
Sort all child nodes based on their Y positions.
</brief_description>
diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml
index ed95da869b..0fec8eb530 100644
--- a/doc/classes/bool.xml
+++ b/doc/classes/bool.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="bool" category="Built-In Types" version="3.1-dev">
+<class name="bool" category="Built-In Types" version="3.1">
<brief_description>
Boolean built-in type
</brief_description>
diff --git a/doc/classes/float.xml b/doc/classes/float.xml
index c576c27687..ef3c3d72eb 100644
--- a/doc/classes/float.xml
+++ b/doc/classes/float.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="float" category="Built-In Types" version="3.1-dev">
+<class name="float" category="Built-In Types" version="3.1">
<brief_description>
Float built-in type
</brief_description>
diff --git a/doc/classes/int.xml b/doc/classes/int.xml
index a86353e97e..4855fa2848 100644
--- a/doc/classes/int.xml
+++ b/doc/classes/int.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="int" category="Built-In Types" version="3.1-dev">
+<class name="int" category="Built-In Types" version="3.1">
<brief_description>
Integer built-in type.
</brief_description>
diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py
index a73a4337d0..056f1ca82d 100644
--- a/doc/tools/makemd.py
+++ b/doc/tools/makemd.py
@@ -93,6 +93,8 @@ def make_class_list(class_list, columns):
s += '\n'
f.write(s)
+ f.close()
+
def dokuize_text(txt):
@@ -330,6 +332,8 @@ def make_doku_class(node):
f.write('\n')
f.write(dokuize_text(d.text.strip()))
f.write('\n')
+
+ f.close()
for file in input_list:
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 9e767bf3d6..93ad823d42 100644..100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -4,11 +4,15 @@
import codecs
import sys
import os
+import re
import xml.etree.ElementTree as ET
input_list = []
cur_file = ""
+# http(s)://docs.godotengine.org/<langcode>/<tag>/path/to/page.html(#fragment-tag)
+godot_docs_pattern = re.compile('^http(?:s)?:\/\/docs\.godotengine\.org\/(?:[a-zA-Z0-9\.\-_]*)\/(?:[a-zA-Z0-9\.\-_]*)\/(.*)\.html(#.*)?$')
+
for arg in sys.argv[1:]:
if arg.endswith(os.sep):
arg = arg[:-1]
@@ -104,6 +108,8 @@ def make_class_list(class_list, columns):
f.write("--+-------+")
f.write("\n")
+ f.close()
+
def rstize_text(text, cclass):
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
@@ -153,9 +159,19 @@ def rstize_text(text, cclass):
text = pre_text + "\n\n" + post_text
pos += 2
+ next_brac_pos = text.find('[')
+
+ # Escape \ character, otherwise it ends up as an escape character in rst
+ pos = 0
+ while True:
+ pos = text.find('\\', pos, next_brac_pos)
+ if pos == -1:
+ break
+ text = text[:pos] + "\\\\" + text[pos + 1:]
+ pos += 2
+
# Escape * character to avoid interpreting it as emphasis
pos = 0
- next_brac_pos = text.find('[');
while True:
pos = text.find('*', pos, next_brac_pos)
if pos == -1:
@@ -257,15 +273,17 @@ def rstize_text(text, cclass):
elif cmd == 'code':
tag_text = '``'
inside_code = True
+ elif cmd.startswith('enum '):
+ tag_text = make_enum(cmd[5:])
else:
tag_text = make_type(tag_text)
escape_post = True
# Properly escape things like `[Node]s`
- if escape_post and post_text and post_text[0].isalnum(): # not punctuation, escape
+ if escape_post and post_text and post_text[0].isalnum(): # not punctuation, escape
post_text = '\ ' + post_text
- next_brac_pos = post_text.find('[',0)
+ next_brac_pos = post_text.find('[', 0)
iter_pos = 0
while not inside_code:
iter_pos = post_text.find('*', iter_pos, next_brac_pos)
@@ -285,7 +303,6 @@ def rstize_text(text, cclass):
else:
iter_pos += 1
-
text = pre_text + tag_text + post_text
pos = len(pre_text) + len(tag_text)
@@ -298,16 +315,27 @@ def make_type(t):
return ':ref:`' + t + '<class_' + t.lower() + '>`'
return t
+
def make_enum(t):
global class_names
p = t.find(".")
+ # Global enums such as Error are relative to @GlobalScope.
if p >= 0:
c = t[0:p]
- e = t[p+1:]
- if c in class_names:
- return ':ref:`' + e + '<enum_' + c.lower() + '_' + e.lower() + '>`'
+ e = t[p + 1:]
+ # Variant enums live in GlobalScope but still use periods.
+ if c == "Variant":
+ c = "@GlobalScope"
+ e = "Variant." + e
+ else:
+ # Things in GlobalScope don't have a period.
+ c = "@GlobalScope"
+ e = t
+ if c in class_names:
+ return ':ref:`' + e + '<enum_' + c.lower() + '_' + e.lower() + '>`'
return t
+
def make_method(
f,
name,
@@ -339,7 +367,10 @@ def make_method(
if not event:
if -1 in mdata['argidx']:
- t += make_type(mdata[-1].attrib['type'])
+ if 'enum' in mdata[-1].attrib:
+ t += make_enum(mdata[-1].attrib['enum'])
+ else:
+ t += make_type(mdata[-1].attrib['type'])
else:
t += 'void'
t += ' '
@@ -361,7 +392,10 @@ def make_method(
else:
s += ' '
- s += make_type(arg.attrib['type'])
+ if 'enum' in arg.attrib:
+ s += make_enum(arg.attrib['enum'])
+ else:
+ s += make_type(arg.attrib['type'])
if 'name' in arg.attrib:
s += ' ' + arg.attrib['name']
else:
@@ -558,6 +592,32 @@ def make_rst_class(node):
f.write(make_heading('Description', '-'))
f.write(rstize_text(descr.text.strip(), name) + "\n\n")
+ global godot_docs_pattern
+ tutorials = node.find('tutorials')
+ if tutorials != None and len(tutorials) > 0:
+ f.write(make_heading('Tutorials', '-'))
+ for t in tutorials:
+ link = t.text.strip()
+ match = godot_docs_pattern.search(link);
+ if match:
+ groups = match.groups()
+ if match.lastindex == 2:
+ # Doc reference with fragment identifier: emit direct link to section with reference to page, for example:
+ # `#calling-javascript-from-script in Exporting For Web`
+ f.write("- `" + groups[1] + " <../" + groups[0] + ".html" + groups[1] + ">`_ in :doc:`../" + groups[0] + "`\n")
+ # Commented out alternative: Instead just emit:
+ # `Subsection in Exporting For Web`
+ # f.write("- `Subsection <../" + groups[0] + ".html" + groups[1] + ">`_ in :doc:`../" + groups[0] + "`\n")
+ elif match.lastindex == 1:
+ # Doc reference, for example:
+ # `Math`
+ f.write("- :doc:`../" + groups[0] + "`\n")
+ else:
+ # External link, for example:
+ # `http://enet.bespin.org/usergroup0.html`
+ f.write("- `" + link + " <" + link + ">`_\n")
+ f.write("\n")
+
methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
f.write(make_heading('Member Function Description', '-'))
@@ -572,6 +632,8 @@ def make_rst_class(node):
f.write("\n\n")
f.write('\n')
+ f.close()
+
file_list = []
diff --git a/drivers/SCsub b/drivers/SCsub
index fc017f4891..2c5e9434e8 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -24,6 +24,7 @@ if env['xaudio2']:
# Graphics drivers
if (env["platform"] != "server"):
SConscript('gles3/SCsub')
+ SConscript('gles2/SCsub')
SConscript('gl_context/SCsub')
else:
SConscript('dummy/SCsub')
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 0bb03d23ea..1e17e72532 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -37,19 +37,20 @@
#include <errno.h>
-Error AudioDriverALSA::init() {
-
- active = false;
- thread_exited = false;
- exit_thread = false;
- pcm_open = false;
- samples_in = NULL;
- samples_out = NULL;
-
+Error AudioDriverALSA::init_device() {
mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
+ // If there is a specified device check that it is really present
+ if (device_name != "Default") {
+ Array list = get_device_list();
+ if (list.find(device_name) == -1) {
+ device_name = "Default";
+ new_device = "Default";
+ }
+ }
+
int status;
snd_pcm_hw_params_t *hwparams;
snd_pcm_sw_params_t *swparams;
@@ -65,7 +66,16 @@ Error AudioDriverALSA::init() {
//6 chans - "plug:surround51"
//4 chans - "plug:surround40";
- status = snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+ if (device_name == "Default") {
+ status = snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+ } else {
+ String device = device_name;
+ int pos = device.find(";");
+ if (pos != -1) {
+ device = device.substr(0, pos);
+ }
+ status = snd_pcm_open(&pcm_handle, device.utf8().get_data(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+ }
ERR_FAIL_COND_V(status < 0, ERR_CANT_OPEN);
@@ -129,15 +139,28 @@ Error AudioDriverALSA::init() {
status = snd_pcm_sw_params(pcm_handle, swparams);
CHECK_FAIL(status < 0);
- samples_in = memnew_arr(int32_t, period_size * channels);
- samples_out = memnew_arr(int16_t, period_size * channels);
+ samples_in.resize(period_size * channels);
+ samples_out.resize(period_size * channels);
snd_pcm_nonblock(pcm_handle, 0);
- mutex = Mutex::create();
- thread = Thread::create(AudioDriverALSA::thread_func, this);
-
return OK;
+}
+
+Error AudioDriverALSA::init() {
+
+ active = false;
+ thread_exited = false;
+ exit_thread = false;
+ pcm_open = false;
+
+ Error err = init_device();
+ if (err == OK) {
+ mutex = Mutex::create();
+ thread = Thread::create(AudioDriverALSA::thread_func, this);
+ }
+
+ return err;
};
void AudioDriverALSA::thread_func(void *p_udata) {
@@ -152,7 +175,7 @@ void AudioDriverALSA::thread_func(void *p_udata) {
} else {
ad->lock();
- ad->audio_server_process(ad->period_size, ad->samples_in);
+ ad->audio_server_process(ad->period_size, ad->samples_in.ptrw());
ad->unlock();
@@ -167,7 +190,7 @@ void AudioDriverALSA::thread_func(void *p_udata) {
while (todo) {
if (ad->exit_thread)
break;
- uint8_t *src = (uint8_t *)ad->samples_out;
+ uint8_t *src = (uint8_t *)ad->samples_out.ptr();
int wrote = snd_pcm_writei(ad->pcm_handle, (void *)(src + (total * ad->channels)), todo);
if (wrote < 0) {
@@ -193,6 +216,26 @@ void AudioDriverALSA::thread_func(void *p_udata) {
total += wrote;
todo -= wrote;
};
+
+ // User selected a new device, finish the current one so we'll init the new device
+ if (ad->device_name != ad->new_device) {
+ ad->device_name = ad->new_device;
+ ad->finish_device();
+
+ Error err = ad->init_device();
+ if (err != OK) {
+ ERR_PRINT("ALSA: init_device error");
+ ad->device_name = "Default";
+ ad->new_device = "Default";
+
+ err = ad->init_device();
+ if (err != OK) {
+ ad->active = false;
+ ad->exit_thread = true;
+ break;
+ }
+ }
+ }
};
ad->thread_exited = true;
@@ -213,6 +256,49 @@ AudioDriver::SpeakerMode AudioDriverALSA::get_speaker_mode() const {
return speaker_mode;
};
+Array AudioDriverALSA::get_device_list() {
+
+ Array list;
+
+ list.push_back("Default");
+
+ void **hints;
+
+ if (snd_device_name_hint(-1, "pcm", &hints) < 0)
+ return list;
+
+ for (void **n = hints; *n != NULL; n++) {
+ char *name = snd_device_name_get_hint(*n, "NAME");
+ char *desc = snd_device_name_get_hint(*n, "DESC");
+
+ if (name != NULL && !strncmp(name, "plughw", 6)) {
+ if (desc) {
+ list.push_back(String(name) + ";" + String(desc));
+ } else {
+ list.push_back(String(name));
+ }
+ }
+
+ if (desc != NULL)
+ free(desc);
+ if (name != NULL)
+ free(name);
+ }
+ snd_device_name_free_hint(hints);
+
+ return list;
+}
+
+String AudioDriverALSA::get_device() {
+
+ return device_name;
+}
+
+void AudioDriverALSA::set_device(String device) {
+
+ new_device = device;
+}
+
void AudioDriverALSA::lock() {
if (!thread || !mutex)
@@ -227,6 +313,14 @@ void AudioDriverALSA::unlock() {
mutex->unlock();
};
+void AudioDriverALSA::finish_device() {
+
+ if (pcm_open) {
+ snd_pcm_close(pcm_handle);
+ pcm_open = NULL;
+ }
+}
+
void AudioDriverALSA::finish() {
if (!thread)
@@ -235,17 +329,13 @@ void AudioDriverALSA::finish() {
exit_thread = true;
Thread::wait_to_finish(thread);
- if (pcm_open)
- snd_pcm_close(pcm_handle);
-
- if (samples_in) {
- memdelete_arr(samples_in);
- memdelete_arr(samples_out);
- };
+ finish_device();
memdelete(thread);
- if (mutex)
+ if (mutex) {
memdelete(mutex);
+ mutex = NULL;
+ }
thread = NULL;
};
@@ -254,6 +344,9 @@ AudioDriverALSA::AudioDriverALSA() {
mutex = NULL;
thread = NULL;
pcm_handle = NULL;
+
+ device_name = "Default";
+ new_device = "Default";
};
AudioDriverALSA::~AudioDriverALSA(){
diff --git a/drivers/alsa/audio_driver_alsa.h b/drivers/alsa/audio_driver_alsa.h
index 8ed60dfdc7..2878e100a2 100644
--- a/drivers/alsa/audio_driver_alsa.h
+++ b/drivers/alsa/audio_driver_alsa.h
@@ -44,8 +44,14 @@ class AudioDriverALSA : public AudioDriver {
snd_pcm_t *pcm_handle;
- int32_t *samples_in;
- int16_t *samples_out;
+ String device_name;
+ String new_device;
+
+ Vector<int32_t> samples_in;
+ Vector<int16_t> samples_out;
+
+ Error init_device();
+ void finish_device();
static void thread_func(void *p_udata);
@@ -71,6 +77,9 @@ public:
virtual void start();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
+ virtual Array get_device_list();
+ virtual String get_device();
+ virtual void set_device(String device);
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 0b39f9ebc3..6e451eabcd 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -37,16 +37,22 @@
#define kOutputBus 0
#ifdef OSX_ENABLED
-static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inClientData) {
+OSStatus AudioDriverCoreAudio::output_device_address_cb(AudioObjectID inObjectID,
+ UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses,
+ void *inClientData) {
AudioDriverCoreAudio *driver = (AudioDriverCoreAudio *)inClientData;
- driver->reopen();
+ // If our selected device is the Default call set_device to update the
+ // kAudioOutputUnitProperty_CurrentDevice property
+ if (driver->device_name == "Default") {
+ driver->set_device("Default");
+ }
return noErr;
}
#endif
-Error AudioDriverCoreAudio::initDevice() {
+Error AudioDriverCoreAudio::init_device() {
AudioComponentDescription desc;
zeromem(&desc, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
@@ -129,7 +135,7 @@ Error AudioDriverCoreAudio::initDevice() {
return OK;
}
-Error AudioDriverCoreAudio::finishDevice() {
+Error AudioDriverCoreAudio::finish_device() {
OSStatus result;
if (active) {
@@ -153,49 +159,18 @@ Error AudioDriverCoreAudio::init() {
channels = 2;
#ifdef OSX_ENABLED
- outputDeviceAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
- outputDeviceAddress.mScope = kAudioObjectPropertyScopeGlobal;
- outputDeviceAddress.mElement = kAudioObjectPropertyElementMaster;
+ AudioObjectPropertyAddress prop;
+ prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
+ prop.mScope = kAudioObjectPropertyScopeGlobal;
+ prop.mElement = kAudioObjectPropertyElementMaster;
- result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
+ result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
ERR_FAIL_COND_V(result != noErr, FAILED);
#endif
- return initDevice();
+ return init_device();
};
-Error AudioDriverCoreAudio::reopen() {
- bool restart = false;
-
- lock();
-
- if (active) {
- restart = true;
- }
-
- Error err = finishDevice();
- if (err != OK) {
- ERR_PRINT("finishDevice failed");
- unlock();
- return err;
- }
-
- err = initDevice();
- if (err != OK) {
- ERR_PRINT("initDevice failed");
- unlock();
- return err;
- }
-
- if (restart) {
- start();
- }
-
- unlock();
-
- return OK;
-}
-
OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
@@ -242,13 +217,24 @@ void AudioDriverCoreAudio::start() {
if (!active) {
OSStatus result = AudioOutputUnitStart(audio_unit);
if (result != noErr) {
- ERR_PRINT("AudioOutputUnitStart failed");
+ ERR_PRINT(("AudioOutputUnitStart failed, code: " + itos(result)).utf8().get_data());
} else {
active = true;
}
}
};
+void AudioDriverCoreAudio::stop() {
+ if (active) {
+ OSStatus result = AudioOutputUnitStop(audio_unit);
+ if (result != noErr) {
+ ERR_PRINT(("AudioOutputUnitStop failed, code: " + itos(result)).utf8().get_data());
+ } else {
+ active = false;
+ }
+ }
+}
+
int AudioDriverCoreAudio::get_mix_rate() const {
return mix_rate;
};
@@ -257,6 +243,150 @@ AudioDriver::SpeakerMode AudioDriverCoreAudio::get_speaker_mode() const {
return get_speaker_mode_by_total_channels(channels);
};
+#ifdef OSX_ENABLED
+
+Array AudioDriverCoreAudio::get_device_list() {
+
+ Array list;
+
+ list.push_back("Default");
+
+ AudioObjectPropertyAddress prop;
+
+ prop.mSelector = kAudioHardwarePropertyDevices;
+ prop.mScope = kAudioObjectPropertyScopeGlobal;
+ prop.mElement = kAudioObjectPropertyElementMaster;
+
+ UInt32 size = 0;
+ AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &size);
+ AudioDeviceID *audioDevices = (AudioDeviceID *)malloc(size);
+ AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &size, audioDevices);
+
+ UInt32 deviceCount = size / sizeof(AudioDeviceID);
+ for (UInt32 i = 0; i < deviceCount; i++) {
+ prop.mScope = kAudioDevicePropertyScopeOutput;
+ prop.mSelector = kAudioDevicePropertyStreamConfiguration;
+
+ AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, NULL, &size);
+ AudioBufferList *bufferList = (AudioBufferList *)malloc(size);
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, bufferList);
+
+ UInt32 outputChannelCount = 0;
+ for (UInt32 j = 0; j < bufferList->mNumberBuffers; j++)
+ outputChannelCount += bufferList->mBuffers[j].mNumberChannels;
+
+ free(bufferList);
+
+ if (outputChannelCount >= 1) {
+ CFStringRef cfname;
+
+ size = sizeof(CFStringRef);
+ prop.mSelector = kAudioObjectPropertyName;
+
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, &cfname);
+
+ CFIndex length = CFStringGetLength(cfname);
+ CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
+ char *buffer = (char *)malloc(maxSize);
+ if (CFStringGetCString(cfname, buffer, maxSize, kCFStringEncodingUTF8)) {
+ // Append the ID to the name in case we have devices with duplicate name
+ list.push_back(String(buffer) + " (" + itos(audioDevices[i]) + ")");
+ }
+
+ free(buffer);
+ }
+ }
+
+ free(audioDevices);
+
+ return list;
+}
+
+String AudioDriverCoreAudio::get_device() {
+
+ return device_name;
+}
+
+void AudioDriverCoreAudio::set_device(String device) {
+
+ device_name = device;
+ if (!active) {
+ return;
+ }
+
+ AudioDeviceID deviceId;
+ bool found = false;
+ if (device_name != "Default") {
+ AudioObjectPropertyAddress prop;
+
+ prop.mSelector = kAudioHardwarePropertyDevices;
+ prop.mScope = kAudioObjectPropertyScopeGlobal;
+ prop.mElement = kAudioObjectPropertyElementMaster;
+
+ UInt32 size = 0;
+ AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &size);
+ AudioDeviceID *audioDevices = (AudioDeviceID *)malloc(size);
+ AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &size, audioDevices);
+
+ UInt32 deviceCount = size / sizeof(AudioDeviceID);
+ for (UInt32 i = 0; i < deviceCount && !found; i++) {
+ prop.mScope = kAudioDevicePropertyScopeOutput;
+ prop.mSelector = kAudioDevicePropertyStreamConfiguration;
+
+ AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, NULL, &size);
+ AudioBufferList *bufferList = (AudioBufferList *)malloc(size);
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, bufferList);
+
+ UInt32 outputChannelCount = 0;
+ for (UInt32 j = 0; j < bufferList->mNumberBuffers; j++)
+ outputChannelCount += bufferList->mBuffers[j].mNumberChannels;
+
+ free(bufferList);
+
+ if (outputChannelCount >= 1) {
+ CFStringRef cfname;
+
+ size = sizeof(CFStringRef);
+ prop.mSelector = kAudioObjectPropertyName;
+
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, &cfname);
+
+ CFIndex length = CFStringGetLength(cfname);
+ CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
+ char *buffer = (char *)malloc(maxSize);
+ if (CFStringGetCString(cfname, buffer, maxSize, kCFStringEncodingUTF8)) {
+ String name = String(buffer) + " (" + itos(audioDevices[i]) + ")";
+ if (name == device_name) {
+ deviceId = audioDevices[i];
+ found = true;
+ }
+ }
+
+ free(buffer);
+ }
+ }
+
+ free(audioDevices);
+ }
+
+ if (!found) {
+ UInt32 size = sizeof(AudioDeviceID);
+ AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+
+ OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, NULL, &size, &deviceId);
+ ERR_FAIL_COND(result != noErr);
+
+ found = true;
+ }
+
+ if (found) {
+ OSStatus result = AudioUnitSetProperty(audio_unit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &deviceId, sizeof(AudioDeviceID));
+ ERR_FAIL_COND(result != noErr);
+ }
+}
+
+#endif
+
void AudioDriverCoreAudio::lock() {
if (mutex)
mutex->lock();
@@ -276,10 +406,15 @@ bool AudioDriverCoreAudio::try_lock() {
void AudioDriverCoreAudio::finish() {
OSStatus result;
- finishDevice();
+ finish_device();
#ifdef OSX_ENABLED
- result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this);
+ AudioObjectPropertyAddress prop;
+ prop.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
+ prop.mScope = kAudioObjectPropertyScopeGlobal;
+ prop.mElement = kAudioObjectPropertyElementMaster;
+
+ result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &output_device_address_cb, this);
if (result != noErr) {
ERR_PRINT("AudioObjectRemovePropertyListener failed");
}
@@ -309,6 +444,8 @@ AudioDriverCoreAudio::AudioDriverCoreAudio() {
buffer_frames = 0;
samples_in.clear();
+
+ device_name = "Default";
};
AudioDriverCoreAudio::~AudioDriverCoreAudio(){};
diff --git a/drivers/coreaudio/audio_driver_coreaudio.h b/drivers/coreaudio/audio_driver_coreaudio.h
index 51256085d8..c44e225521 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.h
+++ b/drivers/coreaudio/audio_driver_coreaudio.h
@@ -43,12 +43,12 @@
class AudioDriverCoreAudio : public AudioDriver {
AudioComponentInstance audio_unit;
-#ifdef OSX_ENABLED
- AudioObjectPropertyAddress outputDeviceAddress;
-#endif
+
bool active;
Mutex *mutex;
+ String device_name;
+
int mix_rate;
unsigned int channels;
unsigned int buffer_frames;
@@ -56,14 +56,20 @@ class AudioDriverCoreAudio : public AudioDriver {
Vector<int32_t> samples_in;
+#ifdef OSX_ENABLED
+ static OSStatus output_device_address_cb(AudioObjectID inObjectID,
+ UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses,
+ void *inClientData);
+#endif
+
static OSStatus output_callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList *ioData);
- Error initDevice();
- Error finishDevice();
+ Error init_device();
+ Error finish_device();
public:
const char *get_name() const {
@@ -74,12 +80,17 @@ public:
virtual void start();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
+#ifdef OSX_ENABLED
+ virtual Array get_device_list();
+ virtual String get_device();
+ virtual void set_device(String device);
+#endif
virtual void lock();
virtual void unlock();
virtual void finish();
bool try_lock();
- Error reopen();
+ void stop();
AudioDriverCoreAudio();
~AudioDriverCoreAudio();
diff --git a/drivers/dummy/audio_driver_dummy.h b/drivers/dummy/audio_driver_dummy.h
index c3d8e10767..b3f0fcee07 100644
--- a/drivers/dummy/audio_driver_dummy.h
+++ b/drivers/dummy/audio_driver_dummy.h
@@ -43,13 +43,13 @@ public:
virtual Error init() { return OK; }
virtual void start(){};
- virtual int get_mix_rate() const {};
- virtual SpeakerMode get_speaker_mode() const {};
+ virtual int get_mix_rate() const { return DEFAULT_MIX_RATE; };
+ virtual SpeakerMode get_speaker_mode() const { return SPEAKER_MODE_STEREO; };
virtual void lock(){};
virtual void unlock(){};
virtual void finish(){};
- virtual float get_latency(){};
+ virtual float get_latency() { return 0; };
AudioDriverDummy(){};
~AudioDriverDummy(){};
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index 5836f5a700..98f60b875c 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -67,7 +67,7 @@ public:
void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {}
void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) {}
- void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {}
+ void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {}
void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {}
@@ -127,7 +127,26 @@ public:
String path;
};
+ struct DummySurface {
+ uint32_t format;
+ VS::PrimitiveType primitive;
+ PoolVector<uint8_t> array;
+ int vertex_count;
+ PoolVector<uint8_t> index_array;
+ int index_count;
+ AABB aabb;
+ Vector<PoolVector<uint8_t> > blend_shapes;
+ Vector<AABB> bone_aabbs;
+ };
+
+ struct DummyMesh : public RID_Data {
+ Vector<DummySurface> surfaces;
+ int blend_shape_count;
+ VS::BlendShapeMode blend_shape_mode;
+ };
+
mutable RID_Owner<DummyTexture> texture_owner;
+ mutable RID_Owner<DummyMesh> mesh_owner;
RID texture_create() {
@@ -154,6 +173,19 @@ public:
t->image->create(t->width, t->height, false, t->format, p_image->get_data());
}
+ void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side) {
+ DummyTexture *t = texture_owner.get(p_texture);
+
+ ERR_FAIL_COND(!t);
+ ERR_FAIL_COND(t->format != p_image->get_format());
+ ERR_FAIL_COND(p_image.is_null());
+ ERR_FAIL_COND(src_w <= 0 || src_h <= 0);
+ ERR_FAIL_COND(src_x < 0 || src_y < 0 || src_x + src_w > p_image->get_width() || src_y + src_h > p_image->get_height());
+ ERR_FAIL_COND(dst_x < 0 || dst_y < 0 || dst_x + src_w > t->width || dst_y + src_h > t->height);
+
+ t->image->blit_rect(p_image, Rect2(src_x, src_y, src_w, src_h), Vector2(dst_x, dst_y));
+ }
+
Ref<Image> texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) const {
DummyTexture *t = texture_owner.getornull(p_texture);
ERR_FAIL_COND_V(!t, Ref<Image>());
@@ -243,43 +275,128 @@ public:
/* MESH API */
- RID mesh_create() { return RID(); }
-
- void mesh_add_surface_from_arrays(RID p_mesh, VS::PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_compress_format = Mesh::ARRAY_COMPRESS_DEFAULT) {}
- void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) {}
+ RID mesh_create() {
+ DummyMesh *mesh = memnew(DummyMesh);
+ ERR_FAIL_COND_V(!mesh, RID());
+ mesh->blend_shape_count = 0;
+ mesh->blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED;
+ return mesh_owner.make_rid(mesh);
+ }
- void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) {}
- void mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes) {}
+ void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND(!m);
+
+ m->surfaces.push_back(DummySurface());
+ DummySurface *s = &m->surfaces[m->surfaces.size() - 1];
+ s->format = p_format;
+ s->primitive = p_primitive;
+ s->array = p_array;
+ s->vertex_count = p_vertex_count;
+ s->index_array = p_index_array;
+ s->index_count = p_index_count;
+ s->aabb = p_aabb;
+ s->blend_shapes = p_blend_shapes;
+ s->bone_aabbs = p_bone_aabbs;
+ }
- void mesh_set_blend_shape_count(RID p_mesh, int p_amount) {}
- int mesh_get_blend_shape_count(RID p_mesh) const { return 0; }
+ void mesh_set_blend_shape_count(RID p_mesh, int p_amount) {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND(!m);
+ m->blend_shape_count = p_amount;
+ }
+ int mesh_get_blend_shape_count(RID p_mesh) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, 0);
+ return m->blend_shape_count;
+ }
- void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) {}
- VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const { return VS::BLEND_SHAPE_MODE_NORMALIZED; }
+ void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND(!m);
+ m->blend_shape_mode = p_mode;
+ }
+ VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, VS::BLEND_SHAPE_MODE_NORMALIZED);
+ return m->blend_shape_mode;
+ }
void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {}
void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {}
RID mesh_surface_get_material(RID p_mesh, int p_surface) const { return RID(); }
- int mesh_surface_get_array_len(RID p_mesh, int p_surface) const { return 0; }
- int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const { return 0; }
+ int mesh_surface_get_array_len(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, 0);
+
+ return m->surfaces[p_surface].vertex_count;
+ }
+ int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, 0);
+
+ return m->surfaces[p_surface].index_count;
+ }
PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const {
- PoolVector<uint8_t> p;
- return p;
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, PoolVector<uint8_t>());
+
+ return m->surfaces[p_surface].array;
+ }
+ PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, PoolVector<uint8_t>());
+
+ return m->surfaces[p_surface].index_array;
+ }
+
+ uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, 0);
+
+ return m->surfaces[p_surface].format;
+ }
+ VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, VS::PRIMITIVE_POINTS);
+
+ return m->surfaces[p_surface].primitive;
+ }
+
+ AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, AABB());
+
+ return m->surfaces[p_surface].aabb;
}
- PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const {}
+ Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, Vector<PoolVector<uint8_t> >());
- uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const { return 0; }
- VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const { return VS::PRIMITIVE_POINTS; }
+ return m->surfaces[p_surface].blend_shapes;
+ }
+ Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, Vector<AABB>());
- AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const { return AABB(); }
- Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { return Vector<PoolVector<uint8_t> >(); }
- Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const { return Vector<AABB>(); }
+ return m->surfaces[p_surface].bone_aabbs;
+ }
- void mesh_remove_surface(RID p_mesh, int p_index) {}
- int mesh_get_surface_count(RID p_mesh) const { return 0; }
+ void mesh_remove_surface(RID p_mesh, int p_index) {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND(!m);
+ ERR_FAIL_COND(p_index >= m->surfaces.size());
+
+ m->surfaces.remove(p_index);
+ }
+ int mesh_get_surface_count(RID p_mesh) const {
+ DummyMesh *m = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND_V(!m, 0);
+ return m->surfaces.size();
+ }
void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {}
AABB mesh_get_custom_aabb(RID p_mesh) const { return AABB(); }
@@ -301,9 +418,9 @@ public:
RID multimesh_get_mesh(RID p_multimesh) const { return RID(); }
- Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const {}
- Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const {}
- Color multimesh_instance_get_color(RID p_multimesh, int p_index) const {}
+ Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const { return Transform(); }
+ Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const { return Transform2D(); }
+ Color multimesh_instance_get_color(RID p_multimesh, int p_index) const { return Color(); }
void multimesh_set_visible_instances(RID p_multimesh, int p_visible) {}
int multimesh_get_visible_instances(RID p_multimesh) const { return 0; }
@@ -330,6 +447,7 @@ public:
RID skeleton_create() { return RID(); }
void skeleton_allocate(RID p_skeleton, int p_bones, bool p_2d_skeleton = false) {}
+ void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {}
int skeleton_get_bone_count(RID p_skeleton) const { return 0; }
void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform &p_transform) {}
Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const { return Transform(); }
@@ -370,7 +488,7 @@ public:
VS::LightType light_get_type(RID p_light) const { return VS::LIGHT_OMNI; }
AABB light_get_aabb(RID p_light) const { return AABB(); }
float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; }
- Color light_get_color(RID p_light) {}
+ Color light_get_color(RID p_light) { return Color(); }
uint64_t light_get_version(RID p_light) const { return 0; }
/* PROBE API */
@@ -391,7 +509,7 @@ public:
void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) {}
AABB reflection_probe_get_aabb(RID p_probe) const { return AABB(); }
- VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const {}
+ VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const { return VisualServer::REFLECTION_PROBE_UPDATE_ONCE; }
uint32_t reflection_probe_get_cull_mask(RID p_probe) const { return 0; }
Vector3 reflection_probe_get_extents(RID p_probe) const { return Vector3(); }
Vector3 reflection_probe_get_origin_offset(RID p_probe) const { return Vector3(); }
@@ -581,7 +699,14 @@ public:
RID canvas_light_occluder_create() { return RID(); }
void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {}
- VS::InstanceType get_base_type(RID p_rid) const {}
+ VS::InstanceType get_base_type(RID p_rid) const {
+ if (mesh_owner.owns(p_rid)) {
+ return VS::INSTANCE_MESH;
+ }
+
+ return VS::INSTANCE_NONE;
+ }
+
bool free(RID p_rid) {
if (texture_owner.owns(p_rid)) {
@@ -590,9 +715,10 @@ public:
texture_owner.free(p_rid);
memdelete(texture);
}
+ return true;
}
- bool has_os_feature(const String &p_feature) const {}
+ bool has_os_feature(const String &p_feature) const { return false; }
void update_dirty_resources() {}
@@ -600,9 +726,9 @@ public:
void render_info_begin_capture() {}
void render_info_end_capture() {}
- int get_captured_render_info(VS::RenderInfo p_info) {}
+ int get_captured_render_info(VS::RenderInfo p_info) { return 0; }
- int get_render_info(VS::RenderInfo p_info) {}
+ int get_render_info(VS::RenderInfo p_info) { return 0; }
static RasterizerStorage *base_singleton;
@@ -619,7 +745,7 @@ public:
void canvas_begin(){};
void canvas_end(){};
- void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light,const Transform2D& p_transform){};
+ void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_transform){};
void canvas_debug_viewport_shadows(Light *p_lights_with_shadow){};
void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) {}
diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp
new file mode 100644
index 0000000000..6d3e176bbb
--- /dev/null
+++ b/drivers/dummy/texture_loader_dummy.cpp
@@ -0,0 +1,87 @@
+/*************************************************************************/
+/* texture_loader_dummy.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "texture_loader_dummy.h"
+#include "core/os/file_access.h"
+#include "print_string.h"
+#include <string.h>
+
+RES ResourceFormatDummyTexture::load(const String &p_path, const String &p_original_path, Error *r_error) {
+ unsigned int width = 8;
+ unsigned int height = 8;
+
+ //We just use some format
+ Image::Format fmt = Image::FORMAT_RGB8;
+ int rowsize = 3 * width;
+
+ PoolVector<uint8_t> dstbuff;
+
+ dstbuff.resize(rowsize * height);
+
+ PoolVector<uint8_t>::Write dstbuff_write = dstbuff.write();
+
+ uint8_t *data = dstbuff_write.ptr();
+
+ uint8_t **row_p = memnew_arr(uint8_t *, height);
+
+ for (unsigned int i = 0; i < height; i++) {
+ row_p[i] = 0; //No colors any more, I want them to turn black
+ }
+
+ memdelete_arr(row_p);
+
+ Ref<Image> img = memnew(Image(width, height, 0, fmt, dstbuff));
+
+ Ref<ImageTexture> texture = memnew(ImageTexture);
+ texture->create_from_image(img);
+
+ if (r_error)
+ *r_error = OK;
+
+ return texture;
+}
+
+void ResourceFormatDummyTexture::get_recognized_extensions(List<String> *p_extensions) const {
+ p_extensions->push_back("png");
+ p_extensions->push_back("hdr");
+ p_extensions->push_back("jpg");
+ p_extensions->push_back("tga");
+}
+
+bool ResourceFormatDummyTexture::handles_type(const String &p_type) const {
+ return ClassDB::is_parent_class(p_type, "Texture");
+}
+
+String ResourceFormatDummyTexture::get_resource_type(const String &p_path) const {
+ String extension = p_path.get_extension().to_lower();
+ if (extension == "png" || extension == "hdr" || extension == "jpg" || extension == "tga")
+ return "ImageTexture";
+ return "";
+}
diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h
new file mode 100644
index 0000000000..f0a355ec12
--- /dev/null
+++ b/drivers/dummy/texture_loader_dummy.h
@@ -0,0 +1,47 @@
+/*************************************************************************/
+/* texture_loader_dummy.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef TEXTURE_LOADER_DUMMY_H
+#define TEXTURE_LOADER_DUMMY_H
+
+#include "core/io/resource_loader.h"
+#include "scene/resources/texture.h"
+
+class ResourceFormatDummyTexture : public ResourceFormatLoader {
+public:
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual bool handles_type(const String &p_type) const;
+ virtual String get_resource_type(const String &p_path) const;
+
+ virtual ~ResourceFormatDummyTexture() {}
+};
+
+#endif // TEXTURE_LOADER_DUMMY_H
diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub
new file mode 100644
index 0000000000..2471dd3739
--- /dev/null
+++ b/drivers/gles2/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import('env')
+
+env.add_source_files(env.drivers_sources,"*.cpp")
+
+SConscript("shaders/SCsub")
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
new file mode 100644
index 0000000000..cc8e3277b9
--- /dev/null
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -0,0 +1,1147 @@
+/*************************************************************************/
+/* rasterizer_canvas_gles2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "rasterizer_canvas_gles2.h"
+#include "os/os.h"
+#include "project_settings.h"
+#include "rasterizer_scene_gles2.h"
+#include "servers/visual/visual_server_raster.h"
+#ifndef GLES_OVER_GL
+#define glClearDepth glClearDepthf
+#endif
+
+RID RasterizerCanvasGLES2::light_internal_create() {
+
+ return RID();
+}
+
+void RasterizerCanvasGLES2::light_internal_update(RID p_rid, Light *p_light) {
+}
+
+void RasterizerCanvasGLES2::light_internal_free(RID p_rid) {
+}
+
+void RasterizerCanvasGLES2::_set_uniforms() {
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::PROJECTION_MATRIX, state.uniforms.projection_matrix);
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::MODELVIEW_MATRIX, state.uniforms.modelview_matrix);
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::EXTRA_MATRIX, state.uniforms.extra_matrix);
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::FINAL_MODULATE, state.uniforms.final_modulate);
+}
+
+void RasterizerCanvasGLES2::canvas_begin() {
+
+ if (storage->frame.clear_request) {
+ glClearColor(storage->frame.clear_request_color.r,
+ storage->frame.clear_request_color.g,
+ storage->frame.clear_request_color.b,
+ storage->frame.clear_request_color.a);
+ glClear(GL_COLOR_BUFFER_BIT);
+ storage->frame.clear_request = false;
+ }
+
+ if (storage->frame.current_rt) {
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
+ glColorMask(1, 1, 1, 1);
+ }
+
+ reset_canvas();
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
+
+ glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+
+ // set up default uniforms
+
+ Transform canvas_transform;
+
+ if (storage->frame.current_rt) {
+
+ float csy = 1.0;
+ if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) {
+ csy = -1.0;
+ }
+ canvas_transform.translate(-(storage->frame.current_rt->width / 2.0f), -(storage->frame.current_rt->height / 2.0f), 0.0f);
+ canvas_transform.scale(Vector3(2.0f / storage->frame.current_rt->width, csy * -2.0f / storage->frame.current_rt->height, 1.0f));
+ } else {
+ Vector2 ssize = OS::get_singleton()->get_window_size();
+ canvas_transform.translate(-(ssize.width / 2.0f), -(ssize.height / 2.0f), 0.0f);
+ canvas_transform.scale(Vector3(2.0f / ssize.width, -2.0f / ssize.height, 1.0f));
+ }
+
+ state.uniforms.projection_matrix = canvas_transform;
+
+ state.uniforms.final_modulate = Color(1, 1, 1, 1);
+
+ state.uniforms.modelview_matrix = Transform2D();
+ state.uniforms.extra_matrix = Transform2D();
+
+ _set_uniforms();
+ _bind_quad_buffer();
+}
+
+void RasterizerCanvasGLES2::canvas_end() {
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ glDisableVertexAttribArray(i);
+ }
+
+ state.using_texture_rect = false;
+ state.using_ninepatch = false;
+}
+
+RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) {
+
+ RasterizerStorageGLES2::Texture *tex_return = NULL;
+
+ if (p_texture.is_valid()) {
+
+ RasterizerStorageGLES2::Texture *texture = storage->texture_owner.getornull(p_texture);
+
+ if (!texture) {
+ state.current_tex = RID();
+ state.current_tex_ptr = NULL;
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
+
+ } else {
+
+ texture = texture->get_ptr();
+
+ if (texture->render_target) {
+ texture->render_target->used_in_frame = true;
+ }
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, texture->tex_id);
+
+ state.current_tex = p_texture;
+ state.current_tex_ptr = texture;
+
+ tex_return = texture;
+ }
+ } else {
+ state.current_tex = RID();
+ state.current_tex_ptr = NULL;
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
+ }
+
+ return tex_return;
+}
+
+void RasterizerCanvasGLES2::_set_texture_rect_mode(bool p_enable, bool p_ninepatch) {
+}
+
+void RasterizerCanvasGLES2::_draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor) {
+
+ glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
+
+ uint32_t buffer_ofs = 0;
+
+ glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
+ glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ buffer_ofs += sizeof(Vector2) * p_vertex_count;
+
+ if (p_singlecolor) {
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ Color m = *p_colors;
+ glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
+ } else if (!p_colors) {
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ } else {
+ glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
+ glEnableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), ((uint8_t *)0) + buffer_ofs);
+ buffer_ofs += sizeof(Color) * p_vertex_count;
+ }
+
+ if (p_uvs) {
+ glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
+ glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), ((uint8_t *)0) + buffer_ofs);
+ buffer_ofs += sizeof(Vector2) * p_vertex_count;
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ }
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
+ glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(int) * p_index_count, p_indices);
+
+ glDrawElements(GL_TRIANGLES, p_index_count, GL_UNSIGNED_INT, 0);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+}
+
+void RasterizerCanvasGLES2::_draw_generic(GLuint p_primitive, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor) {
+
+ glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
+
+ uint32_t buffer_ofs = 0;
+
+ glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
+ glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), (uint8_t *)0);
+ buffer_ofs += sizeof(Vector2) * p_vertex_count;
+
+ if (p_singlecolor) {
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ Color m = *p_colors;
+ glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
+ } else if (!p_colors) {
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ } else {
+ glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
+ glEnableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), ((uint8_t *)0) + buffer_ofs);
+ buffer_ofs += sizeof(Color) * p_vertex_count;
+ }
+
+ if (p_uvs) {
+ glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
+ glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), ((uint8_t *)0) + buffer_ofs);
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ }
+
+ glDrawArrays(p_primitive, 0, p_vertex_count);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
+
+void RasterizerCanvasGLES2::_draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs) {
+
+ static const GLenum prim[5] = { GL_POINTS, GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_FAN };
+
+ int color_offset = 0;
+ int uv_offset = 0;
+ int stride = 2;
+
+ if (p_colors) {
+ color_offset = stride;
+ stride += 4;
+ }
+
+ if (p_uvs) {
+ uv_offset = stride;
+ stride += 2;
+ }
+
+ float buffer_data[(2 + 2 + 4) * 4];
+
+ for (int i = 0; i < p_points; i++) {
+ buffer_data[stride * i + 0] = p_vertices[i].x;
+ buffer_data[stride * i + 1] = p_vertices[i].y;
+ }
+
+ if (p_colors) {
+ for (int i = 0; i < p_points; i++) {
+ buffer_data[stride * i + color_offset + 0] = p_colors[i].r;
+ buffer_data[stride * i + color_offset + 1] = p_colors[i].g;
+ buffer_data[stride * i + color_offset + 2] = p_colors[i].b;
+ buffer_data[stride * i + color_offset + 3] = p_colors[i].a;
+ }
+ }
+
+ if (p_uvs) {
+ for (int i = 0; i < p_points; i++) {
+ buffer_data[stride * i + uv_offset + 0] = p_uvs[i].x;
+ buffer_data[stride * i + uv_offset + 1] = p_uvs[i].y;
+ }
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
+ glBufferSubData(GL_ARRAY_BUFFER, 0, p_points * stride * 4 * sizeof(float), buffer_data);
+
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), NULL);
+
+ if (p_colors) {
+ glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, stride * sizeof(float), (uint8_t *)0 + color_offset * sizeof(float));
+ glEnableVertexAttribArray(VS::ARRAY_COLOR);
+ }
+
+ if (p_uvs) {
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), (uint8_t *)0 + uv_offset * sizeof(float));
+ glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ }
+
+ glDrawArrays(prim[p_points], 0, p_points);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+}
+
+void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *current_clip, bool &reclip) {
+
+ int command_count = p_item->commands.size();
+ Item::Command **commands = p_item->commands.ptrw();
+
+ for (int i = 0; i < command_count; i++) {
+
+ Item::Command *command = commands[i];
+
+ switch (command->type) {
+
+ case Item::Command::TYPE_LINE: {
+
+ Item::CommandLine *line = static_cast<Item::CommandLine *>(command);
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, false);
+ state.canvas_shader.bind();
+
+ _set_uniforms();
+
+ _bind_canvas_texture(RID(), RID());
+
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttrib4fv(VS::ARRAY_COLOR, line->color.components);
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::MODELVIEW_MATRIX, state.uniforms.modelview_matrix);
+
+ if (line->width <= 1) {
+ Vector2 verts[2] = {
+ Vector2(line->from.x, line->from.y),
+ Vector2(line->to.x, line->to.y)
+ };
+
+ _draw_gui_primitive(2, verts, NULL, NULL);
+ } else {
+ Vector2 t = (line->from - line->to).normalized().tangent() * line->width * 0.5;
+
+ Vector2 verts[4] = {
+ line->from - t,
+ line->from + t,
+ line->to + t,
+ line->to - t
+ };
+
+ _draw_gui_primitive(4, verts, NULL, NULL);
+ }
+
+ } break;
+
+ case Item::Command::TYPE_RECT: {
+
+ Item::CommandRect *r = static_cast<Item::CommandRect *>(command);
+
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttrib4fv(VS::ARRAY_COLOR, r->modulate.components);
+
+ _bind_quad_buffer();
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, true);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, false);
+ if (state.canvas_shader.bind())
+ _set_uniforms();
+
+ RasterizerStorageGLES2::Texture *tex = _bind_canvas_texture(r->texture, r->normal_map);
+
+ if (!tex) {
+ Rect2 dst_rect = Rect2(r->rect.position, r->rect.size);
+
+ if (dst_rect.size.width < 0) {
+ dst_rect.position.x += dst_rect.size.width;
+ dst_rect.size.width *= -1;
+ }
+ if (dst_rect.size.height < 0) {
+ dst_rect.position.y += dst_rect.size.height;
+ dst_rect.size.height *= -1;
+ }
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::DST_RECT, Color(dst_rect.position.x, dst_rect.position.y, dst_rect.size.x, dst_rect.size.y));
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::SRC_RECT, Color(0, 0, 1, 1));
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ } else {
+
+ bool untile = false;
+
+ if (r->flags & CANVAS_RECT_TILE && !(tex->flags & VS::TEXTURE_FLAG_REPEAT)) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ untile = true;
+ }
+
+ Size2 texpixel_size(1.0 / tex->width, 1.0 / tex->height);
+ Rect2 src_rect = (r->flags & CANVAS_RECT_REGION) ? Rect2(r->source.position * texpixel_size, r->source.size * texpixel_size) : Rect2(0, 0, 1, 1);
+
+ Rect2 dst_rect = Rect2(r->rect.position, r->rect.size);
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::COLOR_TEXPIXEL_SIZE, texpixel_size);
+
+ if (dst_rect.size.width < 0) {
+ dst_rect.position.x += dst_rect.size.width;
+ dst_rect.size.width *= -1;
+ }
+ if (dst_rect.size.height < 0) {
+ dst_rect.position.y += dst_rect.size.height;
+ dst_rect.size.height *= -1;
+ }
+
+ if (r->flags & CANVAS_RECT_FLIP_H) {
+ src_rect.size.x *= -1;
+ }
+
+ if (r->flags & CANVAS_RECT_FLIP_V) {
+ src_rect.size.y *= -1;
+ }
+
+ if (r->flags & CANVAS_RECT_TRANSPOSE) {
+ dst_rect.size.x *= -1; // Encoding in the dst_rect.z uniform
+ }
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::COLOR_TEXPIXEL_SIZE, texpixel_size);
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::DST_RECT, Color(dst_rect.position.x, dst_rect.position.y, dst_rect.size.x, dst_rect.size.y));
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::SRC_RECT, Color(src_rect.position.x, src_rect.position.y, src_rect.size.x, src_rect.size.y));
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ if (untile) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+
+ } break;
+
+ case Item::Command::TYPE_NINEPATCH: {
+
+ Item::CommandNinePatch *np = static_cast<Item::CommandNinePatch *>(command);
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, true);
+ if (state.canvas_shader.bind())
+ _set_uniforms();
+
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ glVertexAttrib4fv(VS::ARRAY_COLOR, np->color.components);
+
+ RasterizerStorageGLES2::Texture *tex = _bind_canvas_texture(np->texture, np->normal_map);
+
+ if (!tex) {
+ print_line("TODO: ninepatch without texture");
+ continue;
+ }
+
+ Size2 texpixel_size(1.0 / tex->width, 1.0 / tex->height);
+
+ // state.canvas_shader.set_uniform(CanvasShaderGLES2::MODELVIEW_MATRIX, state.uniforms.modelview_matrix);
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::COLOR_TEXPIXEL_SIZE, texpixel_size);
+
+ // prepare vertex buffer
+
+ float buffer[16 * 2 + 16 * 2];
+
+ {
+
+ // first row
+
+ buffer[(0 * 4 * 4) + 0] = np->rect.position.x;
+ buffer[(0 * 4 * 4) + 1] = np->rect.position.y;
+
+ buffer[(0 * 4 * 4) + 2] = np->source.position.x * texpixel_size.x;
+ buffer[(0 * 4 * 4) + 3] = np->source.position.y * texpixel_size.y;
+
+ buffer[(0 * 4 * 4) + 4] = np->rect.position.x + np->margin[MARGIN_LEFT];
+ buffer[(0 * 4 * 4) + 5] = np->rect.position.y;
+
+ buffer[(0 * 4 * 4) + 6] = (np->source.position.x + np->margin[MARGIN_LEFT]) * texpixel_size.x;
+ buffer[(0 * 4 * 4) + 7] = np->source.position.y * texpixel_size.y;
+
+ buffer[(0 * 4 * 4) + 8] = np->rect.position.x + np->rect.size.x - np->margin[MARGIN_RIGHT];
+ buffer[(0 * 4 * 4) + 9] = np->rect.position.y;
+
+ buffer[(0 * 4 * 4) + 10] = (np->source.position.x + np->source.size.x - np->margin[MARGIN_RIGHT]) * texpixel_size.x;
+ buffer[(0 * 4 * 4) + 11] = np->source.position.y * texpixel_size.y;
+
+ buffer[(0 * 4 * 4) + 12] = np->rect.position.x + np->rect.size.x;
+ buffer[(0 * 4 * 4) + 13] = np->rect.position.y;
+
+ buffer[(0 * 4 * 4) + 14] = (np->source.position.x + np->source.size.x) * texpixel_size.x;
+ buffer[(0 * 4 * 4) + 15] = np->source.position.y * texpixel_size.y;
+
+ // second row
+
+ buffer[(1 * 4 * 4) + 0] = np->rect.position.x;
+ buffer[(1 * 4 * 4) + 1] = np->rect.position.y + np->margin[MARGIN_TOP];
+
+ buffer[(1 * 4 * 4) + 2] = np->source.position.x * texpixel_size.x;
+ buffer[(1 * 4 * 4) + 3] = (np->source.position.y + np->margin[MARGIN_TOP]) * texpixel_size.y;
+
+ buffer[(1 * 4 * 4) + 4] = np->rect.position.x + np->margin[MARGIN_LEFT];
+ buffer[(1 * 4 * 4) + 5] = np->rect.position.y + np->margin[MARGIN_TOP];
+
+ buffer[(1 * 4 * 4) + 6] = (np->source.position.x + np->margin[MARGIN_LEFT]) * texpixel_size.x;
+ buffer[(1 * 4 * 4) + 7] = (np->source.position.y + np->margin[MARGIN_TOP]) * texpixel_size.y;
+
+ buffer[(1 * 4 * 4) + 8] = np->rect.position.x + np->rect.size.x - np->margin[MARGIN_RIGHT];
+ buffer[(1 * 4 * 4) + 9] = np->rect.position.y + np->margin[MARGIN_TOP];
+
+ buffer[(1 * 4 * 4) + 10] = (np->source.position.x + np->source.size.x - np->margin[MARGIN_RIGHT]) * texpixel_size.x;
+ buffer[(1 * 4 * 4) + 11] = (np->source.position.y + np->margin[MARGIN_TOP]) * texpixel_size.y;
+
+ buffer[(1 * 4 * 4) + 12] = np->rect.position.x + np->rect.size.x;
+ buffer[(1 * 4 * 4) + 13] = np->rect.position.y + np->margin[MARGIN_TOP];
+
+ buffer[(1 * 4 * 4) + 14] = (np->source.position.x + np->source.size.x) * texpixel_size.x;
+ buffer[(1 * 4 * 4) + 15] = (np->source.position.y + np->margin[MARGIN_TOP]) * texpixel_size.y;
+
+ // thrid row
+
+ buffer[(2 * 4 * 4) + 0] = np->rect.position.x;
+ buffer[(2 * 4 * 4) + 1] = np->rect.position.y + np->rect.size.y - np->margin[MARGIN_BOTTOM];
+
+ buffer[(2 * 4 * 4) + 2] = np->source.position.x * texpixel_size.x;
+ buffer[(2 * 4 * 4) + 3] = (np->source.position.y + np->source.size.y - np->margin[MARGIN_BOTTOM]) * texpixel_size.y;
+
+ buffer[(2 * 4 * 4) + 4] = np->rect.position.x + np->margin[MARGIN_LEFT];
+ buffer[(2 * 4 * 4) + 5] = np->rect.position.y + np->rect.size.y - np->margin[MARGIN_BOTTOM];
+
+ buffer[(2 * 4 * 4) + 6] = (np->source.position.x + np->margin[MARGIN_LEFT]) * texpixel_size.x;
+ buffer[(2 * 4 * 4) + 7] = (np->source.position.y + np->source.size.y - np->margin[MARGIN_BOTTOM]) * texpixel_size.y;
+
+ buffer[(2 * 4 * 4) + 8] = np->rect.position.x + np->rect.size.x - np->margin[MARGIN_RIGHT];
+ buffer[(2 * 4 * 4) + 9] = np->rect.position.y + np->rect.size.y - np->margin[MARGIN_BOTTOM];
+
+ buffer[(2 * 4 * 4) + 10] = (np->source.position.x + np->source.size.x - np->margin[MARGIN_RIGHT]) * texpixel_size.x;
+ buffer[(2 * 4 * 4) + 11] = (np->source.position.y + np->source.size.y - np->margin[MARGIN_BOTTOM]) * texpixel_size.y;
+
+ buffer[(2 * 4 * 4) + 12] = np->rect.position.x + np->rect.size.x;
+ buffer[(2 * 4 * 4) + 13] = np->rect.position.y + np->rect.size.y - np->margin[MARGIN_BOTTOM];
+
+ buffer[(2 * 4 * 4) + 14] = (np->source.position.x + np->source.size.x) * texpixel_size.x;
+ buffer[(2 * 4 * 4) + 15] = (np->source.position.y + np->source.size.y - np->margin[MARGIN_BOTTOM]) * texpixel_size.y;
+
+ // fourth row
+
+ buffer[(3 * 4 * 4) + 0] = np->rect.position.x;
+ buffer[(3 * 4 * 4) + 1] = np->rect.position.y + np->rect.size.y;
+
+ buffer[(3 * 4 * 4) + 2] = np->source.position.x * texpixel_size.x;
+ buffer[(3 * 4 * 4) + 3] = (np->source.position.y + np->source.size.y) * texpixel_size.y;
+
+ buffer[(3 * 4 * 4) + 4] = np->rect.position.x + np->margin[MARGIN_LEFT];
+ buffer[(3 * 4 * 4) + 5] = np->rect.position.y + np->rect.size.y;
+
+ buffer[(3 * 4 * 4) + 6] = (np->source.position.x + np->margin[MARGIN_LEFT]) * texpixel_size.x;
+ buffer[(3 * 4 * 4) + 7] = (np->source.position.y + np->source.size.y) * texpixel_size.y;
+
+ buffer[(3 * 4 * 4) + 8] = np->rect.position.x + np->rect.size.x - np->margin[MARGIN_RIGHT];
+ buffer[(3 * 4 * 4) + 9] = np->rect.position.y + np->rect.size.y;
+
+ buffer[(3 * 4 * 4) + 10] = (np->source.position.x + np->source.size.x - np->margin[MARGIN_RIGHT]) * texpixel_size.x;
+ buffer[(3 * 4 * 4) + 11] = (np->source.position.y + np->source.size.y) * texpixel_size.y;
+
+ buffer[(3 * 4 * 4) + 12] = np->rect.position.x + np->rect.size.x;
+ buffer[(3 * 4 * 4) + 13] = np->rect.position.y + np->rect.size.y;
+
+ buffer[(3 * 4 * 4) + 14] = (np->source.position.x + np->source.size.x) * texpixel_size.x;
+ buffer[(3 * 4 * 4) + 15] = (np->source.position.y + np->source.size.y) * texpixel_size.y;
+
+ // print_line(String::num((np->source.position.y + np->source.size.y) * texpixel_size.y));
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, data.ninepatch_vertices);
+ glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(float) * (16 + 16) * 2, buffer);
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.ninepatch_elements);
+
+ glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), NULL);
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (uint8_t *)0 + (sizeof(float) * 2));
+
+ glDrawElements(GL_TRIANGLES, 18 * 3 - (np->draw_center ? 0 : 6), GL_UNSIGNED_BYTE, NULL);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+
+ } break;
+
+ case Item::Command::TYPE_CIRCLE: {
+
+ Item::CommandCircle *circle = static_cast<Item::CommandCircle *>(command);
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, false);
+
+ if (state.canvas_shader.bind())
+ _set_uniforms();
+
+ static const int num_points = 32;
+
+ Vector2 points[num_points + 1];
+ points[num_points] = circle->pos;
+
+ int indices[num_points * 3];
+
+ for (int i = 0; i < num_points; i++) {
+ points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / num_points), Math::cos(i * Math_PI * 2.0 / num_points)) * circle->radius;
+ indices[i * 3 + 0] = i;
+ indices[i * 3 + 1] = (i + 1) % num_points;
+ indices[i * 3 + 2] = num_points;
+ }
+
+ _bind_canvas_texture(RID(), RID());
+
+ _draw_polygon(indices, num_points * 3, num_points + 1, points, NULL, &circle->color, true);
+ } break;
+
+ case Item::Command::TYPE_POLYGON: {
+
+ Item::CommandPolygon *polygon = static_cast<Item::CommandPolygon *>(command);
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, true);
+
+ if (state.canvas_shader.bind())
+ _set_uniforms();
+
+ RasterizerStorageGLES2::Texture *texture = _bind_canvas_texture(polygon->texture, polygon->normal_map);
+
+ if (texture) {
+ Size2 texpixel_size(1.0 / texture->width, 1.0 / texture->height);
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::COLOR_TEXPIXEL_SIZE, texpixel_size);
+ }
+
+ _draw_polygon(polygon->indices.ptr(), polygon->count, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1);
+ } break;
+
+ case Item::Command::TYPE_POLYLINE: {
+ Item::CommandPolyLine *pline = static_cast<Item::CommandPolyLine *>(command);
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, false);
+
+ if (state.canvas_shader.bind())
+ _set_uniforms();
+
+ if (pline->triangles.size()) {
+ _draw_generic(GL_TRIANGLE_STRIP, pline->triangles.size(), pline->triangles.ptr(), NULL, pline->triangle_colors.ptr(), pline->triangle_colors.size() == 1);
+ } else {
+ if (pline->multiline) {
+ int todo = pline->lines.size() / 2;
+ int max_per_call = data.polygon_buffer_size / (sizeof(real_t) * 4);
+ int offset = 0;
+
+ while (todo) {
+ int to_draw = MIN(max_per_call, todo);
+ _draw_generic(GL_LINES, to_draw * 2, &pline->lines.ptr()[offset], NULL, pline->line_colors.size() == 1 ? pline->line_colors.ptr() : &pline->line_colors.ptr()[offset], pline->line_colors.size() == 1);
+ todo -= to_draw;
+ offset += to_draw * 2;
+ }
+ } else {
+ _draw_generic(GL_LINES, pline->lines.size(), pline->lines.ptr(), NULL, pline->line_colors.ptr(), pline->line_colors.size() == 1);
+ }
+ }
+ } break;
+
+ case Item::Command::TYPE_PRIMITIVE: {
+
+ Item::CommandPrimitive *primitive = static_cast<Item::CommandPrimitive *>(command);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, true);
+
+ if (state.canvas_shader.bind())
+ _set_uniforms();
+
+ ERR_CONTINUE(primitive->points.size() < 1);
+
+ RasterizerStorageGLES2::Texture *texture = _bind_canvas_texture(primitive->texture, primitive->normal_map);
+
+ if (texture) {
+ Size2 texpixel_size(1.0 / texture->width, 1.0 / texture->height);
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::COLOR_TEXPIXEL_SIZE, texpixel_size);
+ }
+
+ if (primitive->colors.size() == 1 && primitive->points.size() > 1) {
+ Color c = primitive->colors[0];
+ glVertexAttrib4f(VS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
+ } else if (primitive->colors.empty()) {
+ glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
+ }
+
+ _draw_gui_primitive(primitive->points.size(), primitive->points.ptr(), primitive->colors.ptr(), primitive->uvs.ptr());
+ } break;
+
+ case Item::Command::TYPE_TRANSFORM: {
+ Item::CommandTransform *transform = static_cast<Item::CommandTransform *>(command);
+ state.uniforms.extra_matrix = transform->xform;
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::EXTRA_MATRIX, state.uniforms.extra_matrix);
+ } break;
+
+ case Item::Command::TYPE_PARTICLES: {
+
+ } break;
+
+ case Item::Command::TYPE_CLIP_IGNORE: {
+
+ Item::CommandClipIgnore *ci = static_cast<Item::CommandClipIgnore *>(command);
+ if (current_clip) {
+ if (ci->ignore != reclip) {
+ if (ci->ignore) {
+ glDisable(GL_SCISSOR_TEST);
+ reclip = true;
+ } else {
+ glEnable(GL_SCISSOR_TEST);
+
+ int x = current_clip->final_clip_rect.position.x;
+ int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y);
+ int w = current_clip->final_clip_rect.size.x;
+ int h = current_clip->final_clip_rect.size.y;
+
+ glScissor(x, y, w, h);
+
+ reclip = false;
+ }
+ }
+ }
+
+ } break;
+
+ default: {
+ print_line("other");
+ } break;
+ }
+ }
+}
+
+void RasterizerCanvasGLES2::_copy_texscreen(const Rect2 &p_rect) {
+
+ // This isn't really working yet, so disabling for now.
+
+ /*
+ glDisable(GL_BLEND);
+
+ state.canvas_texscreen_used = true;
+
+ Vector2 wh(storage->frame.current_rt->width, storage->frame.current_rt->height);
+ Color copy_section(p_rect.position.x / wh.x, p_rect.position.y / wh.y, p_rect.size.x / wh.x, p_rect.size.y / wh.y);
+
+ if (p_rect != Rect2()) {
+ // only use section
+
+ storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_COPY_SECTION, true);
+ }
+
+
+ storage->shaders.copy.bind();
+ storage->shaders.copy.set_uniform(CopyShaderGLES2::COPY_SECTION, copy_section);
+
+ _bind_quad_buffer();
+
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->copy_screen_effect.fbo);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glDisableVertexAttribArray(VS::ARRAY_VERTEX);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
+
+ state.canvas_shader.bind();
+ _bind_canvas_texture(state.current_tex, state.current_normal);
+
+ glEnable(GL_BLEND);
+ */
+}
+
+void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform) {
+
+ Item *current_clip = NULL;
+
+ RasterizerStorageGLES2::Shader *shader_cache = NULL;
+
+ bool rebind_shader = true;
+
+ Size2 rt_size = Size2(storage->frame.current_rt->width, storage->frame.current_rt->height);
+
+ state.current_tex = RID();
+ state.current_tex_ptr = NULL;
+ state.current_normal = RID();
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
+
+ int last_blend_mode = -1;
+
+ RID canvas_last_material = RID();
+
+ while (p_item_list) {
+
+ Item *ci = p_item_list;
+
+ if (current_clip != ci->final_clip_owner) {
+
+ current_clip = ci->final_clip_owner;
+
+ if (current_clip) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(current_clip->final_clip_rect.position.x, (rt_size.height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.height)), current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
+ } else {
+ glDisable(GL_SCISSOR_TEST);
+ }
+ }
+
+ // TODO: copy back buffer
+
+ if (ci->copy_back_buffer) {
+ if (ci->copy_back_buffer->full) {
+ _copy_texscreen(Rect2());
+ } else {
+ _copy_texscreen(ci->copy_back_buffer->rect);
+ }
+ }
+
+ Item *material_owner = ci->material_owner ? ci->material_owner : ci;
+
+ RID material = material_owner->material;
+
+ if (material != canvas_last_material || rebind_shader) {
+
+ RasterizerStorageGLES2::Material *material_ptr = storage->material_owner.getornull(material);
+ RasterizerStorageGLES2::Shader *shader_ptr = NULL;
+
+ if (material_ptr) {
+ shader_ptr = material_ptr->shader;
+
+ if (shader_ptr && shader_ptr->mode != VS::SHADER_CANVAS_ITEM) {
+ shader_ptr = NULL; // not a canvas item shader, don't use.
+ }
+ }
+
+ if (shader_ptr) {
+ if (shader_ptr->canvas_item.uses_screen_texture) {
+ _copy_texscreen(Rect2());
+ }
+
+ if (shader_ptr != shader_cache) {
+
+ if (shader_ptr->canvas_item.uses_time) {
+ VisualServerRaster::redraw_request();
+ }
+
+ state.canvas_shader.set_custom_shader(shader_ptr->custom_code_id);
+ state.canvas_shader.bind();
+ }
+
+ int tc = material_ptr->textures.size();
+ RID *textures = material_ptr->textures.ptrw();
+
+ ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = shader_ptr->texture_hints.ptrw();
+
+ for (int i = 0; i < tc; i++) {
+
+ glActiveTexture(GL_TEXTURE2 + i);
+
+ RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(textures[i]);
+
+ if (!t) {
+
+ switch (texture_hints[i]) {
+ case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO:
+ case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: {
+ glBindTexture(GL_TEXTURE_2D, storage->resources.black_tex);
+ } break;
+ case ShaderLanguage::ShaderNode::Uniform::HINT_ANISO: {
+ glBindTexture(GL_TEXTURE_2D, storage->resources.aniso_tex);
+ } break;
+ case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: {
+ glBindTexture(GL_TEXTURE_2D, storage->resources.normal_tex);
+ } break;
+ default: {
+ glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
+ } break;
+ }
+
+ continue;
+ }
+
+ t = t->get_ptr();
+
+ glBindTexture(t->target, t->tex_id);
+ }
+ } else {
+ state.canvas_shader.set_custom_shader(0);
+ state.canvas_shader.bind();
+ }
+
+ shader_cache = shader_ptr;
+
+ canvas_last_material = material;
+
+ rebind_shader = false;
+ }
+
+ int blend_mode = shader_cache ? shader_cache->canvas_item.blend_mode : RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX;
+ bool unshaded = true || (shader_cache && blend_mode != RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX);
+ bool reclip = false;
+
+ if (last_blend_mode != blend_mode) {
+
+ switch (blend_mode) {
+
+ case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX: {
+ glBlendEquation(GL_FUNC_ADD);
+ if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ } else {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ } break;
+ case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_ADD: {
+
+ glBlendEquation(GL_FUNC_ADD);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ } break;
+ case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_SUB: {
+
+ glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ } break;
+ case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MUL: {
+ glBlendEquation(GL_FUNC_ADD);
+ glBlendFunc(GL_DST_COLOR, GL_ZERO);
+ } break;
+ case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_PMALPHA: {
+ glBlendEquation(GL_FUNC_ADD);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ } break;
+ }
+ }
+
+ state.uniforms.final_modulate = unshaded ? ci->final_modulate : Color(ci->final_modulate.r * p_modulate.r, ci->final_modulate.g * p_modulate.g, ci->final_modulate.b * p_modulate.b, ci->final_modulate.a * p_modulate.a);
+
+ state.uniforms.modelview_matrix = ci->final_transform;
+ state.uniforms.extra_matrix = Transform2D();
+
+ _set_uniforms();
+
+ _canvas_item_render_commands(p_item_list, NULL, reclip);
+
+ rebind_shader = true; // hacked in for now.
+
+ if (reclip) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(current_clip->final_clip_rect.position.x, (rt_size.height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.height)), current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height);
+ }
+
+ p_item_list = p_item_list->next;
+ }
+
+ if (current_clip) {
+ glDisable(GL_SCISSOR_TEST);
+ }
+}
+
+void RasterizerCanvasGLES2::canvas_debug_viewport_shadows(Light *p_lights_with_shadow) {
+}
+
+void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) {
+}
+
+void RasterizerCanvasGLES2::reset_canvas() {
+
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_DITHER);
+ glEnable(GL_BLEND);
+
+ if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ } else {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ // bind the back buffer to a texture so shaders can use it.
+ // It should probably use texture unit -3 (as GLES3 does as well) but currently that's buggy.
+ // keeping this for now as there's nothing else that uses texture unit 2
+ // TODO ^
+ if (storage->frame.current_rt) {
+ glActiveTexture(GL_TEXTURE0 + 2);
+ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->copy_screen_effect.color);
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+}
+
+void RasterizerCanvasGLES2::_bind_quad_buffer() {
+ glBindBuffer(GL_ARRAY_BUFFER, data.canvas_quad_vertices);
+ glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, NULL);
+}
+void RasterizerCanvasGLES2::draw_generic_textured_rect(const Rect2 &p_rect, const Rect2 &p_src) {
+
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::DST_RECT, Color(p_rect.position.x, p_rect.position.y, p_rect.size.x, p_rect.size.y));
+ state.canvas_shader.set_uniform(CanvasShaderGLES2::SRC_RECT, Color(p_src.position.x, p_src.position.y, p_src.size.x, p_src.size.y));
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+}
+
+void RasterizerCanvasGLES2::draw_window_margins(int *black_margin, RID *black_image) {
+}
+
+void RasterizerCanvasGLES2::initialize() {
+
+ // quad buffer
+ {
+ glGenBuffers(1, &data.canvas_quad_vertices);
+ glBindBuffer(GL_ARRAY_BUFFER, data.canvas_quad_vertices);
+
+ const float qv[8] = {
+ 0, 0,
+ 0, 1,
+ 1, 1,
+ 1, 0
+ };
+
+ glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 8, qv, GL_STATIC_DRAW);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ }
+
+ // polygon buffer
+ {
+ uint32_t poly_size = GLOBAL_DEF("rendering/limits/buffers/canvas_polygon_buffer_size_kb", 128);
+ poly_size *= 1024;
+ poly_size = MAX(poly_size, (2 + 2 + 4) * 4 * sizeof(float));
+ glGenBuffers(1, &data.polygon_buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
+ glBufferData(GL_ARRAY_BUFFER, poly_size, NULL, GL_DYNAMIC_DRAW);
+
+ data.polygon_buffer_size = poly_size;
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ uint32_t index_size = GLOBAL_DEF("rendering/limits/buffers/canvas_polygon_index_size_kb", 128);
+ index_size *= 1024; // kb
+ glGenBuffers(1, &data.polygon_index_buffer);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, index_size, NULL, GL_DYNAMIC_DRAW);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ }
+
+ // ninepatch buffers
+ {
+ // array buffer
+ glGenBuffers(1, &data.ninepatch_vertices);
+ glBindBuffer(GL_ARRAY_BUFFER, data.ninepatch_vertices);
+
+ glBufferData(GL_ARRAY_BUFFER, sizeof(float) * (16 + 16) * 2, NULL, GL_DYNAMIC_DRAW);
+
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ // element buffer
+ glGenBuffers(1, &data.ninepatch_elements);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.ninepatch_elements);
+
+#define _EIDX(y, x) (y * 4 + x)
+ uint8_t elems[3 * 2 * 9] = {
+
+ // first row
+
+ _EIDX(0, 0), _EIDX(0, 1), _EIDX(1, 1),
+ _EIDX(1, 1), _EIDX(1, 0), _EIDX(0, 0),
+
+ _EIDX(0, 1), _EIDX(0, 2), _EIDX(1, 2),
+ _EIDX(1, 2), _EIDX(1, 1), _EIDX(0, 1),
+
+ _EIDX(0, 2), _EIDX(0, 3), _EIDX(1, 3),
+ _EIDX(1, 3), _EIDX(1, 2), _EIDX(0, 2),
+
+ // second row
+
+ _EIDX(1, 0), _EIDX(1, 1), _EIDX(2, 1),
+ _EIDX(2, 1), _EIDX(2, 0), _EIDX(1, 0),
+
+ // the center one would be here, but we'll put it at the end
+ // so it's easier to disable the center and be able to use
+ // one draw call for both
+
+ _EIDX(1, 2), _EIDX(1, 3), _EIDX(2, 3),
+ _EIDX(2, 3), _EIDX(2, 2), _EIDX(1, 2),
+
+ // third row
+
+ _EIDX(2, 0), _EIDX(2, 1), _EIDX(3, 1),
+ _EIDX(3, 1), _EIDX(3, 0), _EIDX(2, 0),
+
+ _EIDX(2, 1), _EIDX(2, 2), _EIDX(3, 2),
+ _EIDX(3, 2), _EIDX(3, 1), _EIDX(2, 1),
+
+ _EIDX(2, 2), _EIDX(2, 3), _EIDX(3, 3),
+ _EIDX(3, 3), _EIDX(3, 2), _EIDX(2, 2),
+
+ // center field
+
+ _EIDX(1, 1), _EIDX(1, 2), _EIDX(2, 2),
+ _EIDX(2, 2), _EIDX(2, 1), _EIDX(1, 1)
+ };
+ ;
+#undef _EIDX
+
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elems), elems, GL_STATIC_DRAW);
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ }
+
+ state.canvas_shader.init();
+
+ state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, true);
+
+ state.canvas_shader.bind();
+}
+
+void RasterizerCanvasGLES2::finalize() {
+}
+
+RasterizerCanvasGLES2::RasterizerCanvasGLES2() {
+}
diff --git a/drivers/gles2/rasterizer_canvas_gles2.h b/drivers/gles2/rasterizer_canvas_gles2.h
new file mode 100644
index 0000000000..4eab8c6038
--- /dev/null
+++ b/drivers/gles2/rasterizer_canvas_gles2.h
@@ -0,0 +1,129 @@
+/*************************************************************************/
+/* rasterizer_canvas_gles2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef RASTERIZERCANVASGLES2_H
+#define RASTERIZERCANVASGLES2_H
+
+#include "rasterizer_storage_gles2.h"
+#include "servers/visual/rasterizer.h"
+
+#include "shaders/canvas.glsl.gen.h"
+
+// #include "shaders/canvas_shadow.glsl.gen.h"
+
+class RasterizerSceneGLES2;
+
+class RasterizerCanvasGLES2 : public RasterizerCanvas {
+public:
+ struct Uniforms {
+ Transform projection_matrix;
+
+ Transform2D modelview_matrix;
+ Transform2D extra_matrix;
+
+ Color final_modulate;
+
+ float time;
+ };
+
+ struct Data {
+
+ GLuint canvas_quad_vertices;
+ GLuint polygon_buffer;
+ GLuint polygon_index_buffer;
+
+ uint32_t polygon_buffer_size;
+
+ GLuint ninepatch_vertices;
+ GLuint ninepatch_elements;
+
+ } data;
+
+ struct State {
+ Uniforms uniforms;
+ bool canvas_texscreen_used;
+ CanvasShaderGLES2 canvas_shader;
+ // CanvasShadowShaderGLES3 canvas_shadow_shader;
+
+ bool using_texture_rect;
+ bool using_ninepatch;
+
+ RID current_tex;
+ RID current_normal;
+ RasterizerStorageGLES2::Texture *current_tex_ptr;
+
+ Transform vp;
+
+ } state;
+
+ typedef void Texture;
+
+ RasterizerSceneGLES2 *scene_render;
+
+ RasterizerStorageGLES2 *storage;
+
+ virtual RID light_internal_create();
+ virtual void light_internal_update(RID p_rid, Light *p_light);
+ virtual void light_internal_free(RID p_rid);
+
+ void _set_uniforms();
+
+ virtual void canvas_begin();
+ virtual void canvas_end();
+
+ _FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable, bool p_ninepatch = false);
+
+ _FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs);
+ _FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);
+ _FORCE_INLINE_ void _draw_generic(GLuint p_primitive, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);
+
+ _FORCE_INLINE_ void _canvas_item_render_commands(Item *p_item, Item *current_clip, bool &reclip);
+ _FORCE_INLINE_ void _copy_texscreen(const Rect2 &p_rect);
+
+ virtual void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform);
+ virtual void canvas_debug_viewport_shadows(Light *p_lights_with_shadow);
+
+ virtual void canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache);
+
+ virtual void reset_canvas();
+
+ RasterizerStorageGLES2::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map);
+
+ void _bind_quad_buffer();
+ void draw_generic_textured_rect(const Rect2 &p_rect, const Rect2 &p_src);
+
+ void initialize();
+ void finalize();
+
+ virtual void draw_window_margins(int *black_margin, RID *black_image);
+
+ RasterizerCanvasGLES2();
+};
+
+#endif // RASTERIZERCANVASGLES2_H
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
new file mode 100644
index 0000000000..ab48e682d6
--- /dev/null
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -0,0 +1,463 @@
+/*************************************************************************/
+/* rasterizer_gles2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "rasterizer_gles2.h"
+
+#include "gl_context/context_gl.h"
+#include "os/os.h"
+#include "project_settings.h"
+#include <string.h>
+
+#define _EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
+#define _EXT_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
+#define _EXT_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
+#define _EXT_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
+#define _EXT_DEBUG_SOURCE_API_ARB 0x8246
+#define _EXT_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
+#define _EXT_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
+#define _EXT_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
+#define _EXT_DEBUG_SOURCE_APPLICATION_ARB 0x824A
+#define _EXT_DEBUG_SOURCE_OTHER_ARB 0x824B
+#define _EXT_DEBUG_TYPE_ERROR_ARB 0x824C
+#define _EXT_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
+#define _EXT_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
+#define _EXT_DEBUG_TYPE_PORTABILITY_ARB 0x824F
+#define _EXT_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
+#define _EXT_DEBUG_TYPE_OTHER_ARB 0x8251
+#define _EXT_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
+#define _EXT_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
+#define _EXT_DEBUG_LOGGED_MESSAGES_ARB 0x9145
+#define _EXT_DEBUG_SEVERITY_HIGH_ARB 0x9146
+#define _EXT_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
+#define _EXT_DEBUG_SEVERITY_LOW_ARB 0x9148
+#define _EXT_DEBUG_OUTPUT 0x92E0
+
+#if (defined WINDOWS_ENABLED) && !(defined UWP_ENABLED)
+#define GLAPIENTRY APIENTRY
+#else
+#define GLAPIENTRY
+#endif
+
+static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
+
+ if (type == _EXT_DEBUG_TYPE_OTHER_ARB)
+ return;
+
+ if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB)
+ return; //these are ultimately annoying, so removing for now
+
+ char debSource[256], debType[256], debSev[256];
+ if (source == _EXT_DEBUG_SOURCE_API_ARB)
+ strcpy(debSource, "OpenGL");
+ else if (source == _EXT_DEBUG_SOURCE_WINDOW_SYSTEM_ARB)
+ strcpy(debSource, "Windows");
+ else if (source == _EXT_DEBUG_SOURCE_SHADER_COMPILER_ARB)
+ strcpy(debSource, "Shader Compiler");
+ else if (source == _EXT_DEBUG_SOURCE_THIRD_PARTY_ARB)
+ strcpy(debSource, "Third Party");
+ else if (source == _EXT_DEBUG_SOURCE_APPLICATION_ARB)
+ strcpy(debSource, "Application");
+ else if (source == _EXT_DEBUG_SOURCE_OTHER_ARB)
+ strcpy(debSource, "Other");
+
+ if (type == _EXT_DEBUG_TYPE_ERROR_ARB)
+ strcpy(debType, "Error");
+ else if (type == _EXT_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB)
+ strcpy(debType, "Deprecated behavior");
+ else if (type == _EXT_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB)
+ strcpy(debType, "Undefined behavior");
+ else if (type == _EXT_DEBUG_TYPE_PORTABILITY_ARB)
+ strcpy(debType, "Portability");
+ else if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB)
+ strcpy(debType, "Performance");
+ else if (type == _EXT_DEBUG_TYPE_OTHER_ARB)
+ strcpy(debType, "Other");
+
+ if (severity == _EXT_DEBUG_SEVERITY_HIGH_ARB)
+ strcpy(debSev, "High");
+ else if (severity == _EXT_DEBUG_SEVERITY_MEDIUM_ARB)
+ strcpy(debSev, "Medium");
+ else if (severity == _EXT_DEBUG_SEVERITY_LOW_ARB)
+ strcpy(debSev, "Low");
+
+ String output = String() + "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message;
+
+ ERR_PRINTS(output);
+}
+
+typedef void (*DEBUGPROCARB)(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const char *message,
+ const void *userParam);
+
+typedef void (*DebugMessageCallbackARB)(DEBUGPROCARB callback, const void *userParam);
+
+RasterizerStorage *RasterizerGLES2::get_storage() {
+
+ return storage;
+}
+
+RasterizerCanvas *RasterizerGLES2::get_canvas() {
+
+ return canvas;
+}
+
+RasterizerScene *RasterizerGLES2::get_scene() {
+
+ return scene;
+}
+
+void RasterizerGLES2::initialize() {
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line("Using GLES2 video driver");
+ }
+
+#ifdef GLAD_ENABLED
+ if (!gladLoadGL()) {
+ ERR_PRINT("Error initializing GLAD");
+ }
+
+// GLVersion seems to be used for both GL and GL ES, so we need different version checks for them
+#ifdef OPENGL_ENABLED // OpenGL 2.1 Profile required
+ if (GLVersion.major < 2) {
+#else // OpenGL ES 3.0
+ if (GLVersion.major < 2) {
+#endif
+ ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n"
+ "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
+ OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / OpenGL ES 2.0, sorry :(\n"
+ "Godot Engine will self-destruct as soon as you acknowledge this error message.",
+ "Fatal error: Insufficient OpenGL / GLES driver support");
+ }
+
+#ifdef GLES_OVER_GL
+ //Test GL_ARB_framebuffer_object extension
+ if (!GLAD_GL_ARB_framebuffer_object) {
+ //Try older GL_EXT_framebuffer_object extension
+ if (GLAD_GL_EXT_framebuffer_object) {
+ glIsRenderbuffer = glIsRenderbufferEXT;
+ glBindRenderbuffer = glBindRenderbufferEXT;
+ glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
+ glGenRenderbuffers = glGenRenderbuffersEXT;
+ glRenderbufferStorage = glRenderbufferStorageEXT;
+ glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
+ glIsFramebuffer = glIsFramebufferEXT;
+ glBindFramebuffer = glBindFramebufferEXT;
+ glDeleteFramebuffers = glDeleteFramebuffersEXT;
+ glGenFramebuffers = glGenFramebuffersEXT;
+ glCheckFramebufferStatus = glCheckFramebufferStatusEXT;
+ glFramebufferTexture1D = glFramebufferTexture1DEXT;
+ glFramebufferTexture2D = glFramebufferTexture2DEXT;
+ glFramebufferTexture3D = glFramebufferTexture3DEXT;
+ glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
+ glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
+ glGenerateMipmap = glGenerateMipmapEXT;
+ } else {
+ ERR_PRINT("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n"
+ "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.");
+ OS::get_singleton()->alert("Your system's graphic drivers seem not to support GL_ARB(EXT)_framebuffer_object OpenGL extension, sorry :(\n"
+ "Godot Engine will self-destruct as soon as you acknowledge this error message.",
+ "Fatal error: Insufficient OpenGL / GLES driver support");
+ }
+ }
+#endif
+ if (true || OS::get_singleton()->is_stdout_verbose()) {
+ if (GLAD_GL_ARB_debug_output) {
+ glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+ glDebugMessageCallbackARB(_gl_debug_print, NULL);
+ glEnable(_EXT_DEBUG_OUTPUT);
+ } else {
+ print_line("OpenGL debugging not supported!");
+ }
+ }
+
+#endif // GLAD_ENABLED
+
+ // For debugging
+#ifdef GLES_OVER_GL
+ if (GLAD_GL_ARB_debug_output) {
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_ERROR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_PORTABILITY_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_PERFORMANCE_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_OTHER_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, NULL, GL_TRUE);
+ /* glDebugMessageInsertARB(
+ GL_DEBUG_SOURCE_API_ARB,
+ GL_DEBUG_TYPE_OTHER_ARB, 1,
+ GL_DEBUG_SEVERITY_HIGH_ARB, 5, "hello");
+ */
+ }
+#endif
+
+ const GLubyte *renderer = glGetString(GL_RENDERER);
+ print_line("OpenGL ES 2.0 Renderer: " + String((const char *)renderer));
+ storage->initialize();
+ canvas->initialize();
+ scene->initialize();
+}
+
+void RasterizerGLES2::begin_frame() {
+ uint64_t tick = OS::get_singleton()->get_ticks_usec();
+
+ double delta = double(tick - prev_ticks) / 1000000.0;
+ delta *= Engine::get_singleton()->get_time_scale();
+
+ time_total += delta;
+
+ if (delta == 0) {
+ //to avoid hiccups
+ delta = 0.001;
+ }
+
+ prev_ticks = tick;
+
+ // double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs");
+ // if (time_total > time_roll_over)
+ // time_total = 0; //roll over every day (should be customz
+
+ storage->frame.time[0] = time_total;
+ storage->frame.time[1] = Math::fmod(time_total, 3600);
+ storage->frame.time[2] = Math::fmod(time_total, 900);
+ storage->frame.time[3] = Math::fmod(time_total, 60);
+ storage->frame.count++;
+ storage->frame.delta = delta;
+
+ storage->frame.prev_tick = tick;
+
+ storage->update_dirty_resources();
+
+ storage->info.render_final = storage->info.render;
+ storage->info.render.reset();
+
+ scene->iteration();
+}
+
+void RasterizerGLES2::set_current_render_target(RID p_render_target) {
+
+ if (!p_render_target.is_valid() && storage->frame.current_rt && storage->frame.clear_request) {
+ // pending clear request. Do that first.
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
+ glClearColor(storage->frame.clear_request_color.r,
+ storage->frame.clear_request_color.g,
+ storage->frame.clear_request_color.b,
+ storage->frame.clear_request_color.a);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
+ if (p_render_target.is_valid()) {
+ RasterizerStorageGLES2::RenderTarget *rt = storage->render_target_owner.getornull(p_render_target);
+ storage->frame.current_rt = rt;
+ ERR_FAIL_COND(!rt);
+ storage->frame.clear_request = false;
+
+ glViewport(0, 0, rt->width, rt->height);
+ } else {
+ storage->frame.current_rt = NULL;
+ storage->frame.clear_request = false;
+ glViewport(0, 0, OS::get_singleton()->get_window_size().width, OS::get_singleton()->get_window_size().height);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES2::system_fbo);
+ }
+}
+
+void RasterizerGLES2::restore_render_target() {
+ ERR_FAIL_COND(storage->frame.current_rt == NULL);
+ RasterizerStorageGLES2::RenderTarget *rt = storage->frame.current_rt;
+ glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
+ glViewport(0, 0, rt->width, rt->height);
+}
+
+void RasterizerGLES2::clear_render_target(const Color &p_color) {
+ ERR_FAIL_COND(!storage->frame.current_rt);
+
+ storage->frame.clear_request = true;
+ storage->frame.clear_request_color = p_color;
+}
+
+void RasterizerGLES2::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale) {
+
+ if (p_image.is_null() || p_image->empty())
+ return;
+
+ int window_w = OS::get_singleton()->get_video_mode(0).width;
+ int window_h = OS::get_singleton()->get_video_mode(0).height;
+
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glViewport(0, 0, window_w, window_h);
+ glDisable(GL_BLEND);
+ glDepthMask(GL_FALSE);
+ if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ } else {
+ glClearColor(p_color.r, p_color.g, p_color.b, 1.0);
+ }
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ canvas->canvas_begin();
+
+ RID texture = storage->texture_create();
+ storage->texture_allocate(texture, p_image->get_width(), p_image->get_height(), p_image->get_format(), VS::TEXTURE_FLAG_FILTER);
+ storage->texture_set_data(texture, p_image);
+
+ Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
+ Rect2 screenrect;
+
+ screenrect = imgrect;
+ screenrect.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor();
+
+ RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(texture);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, t->tex_id);
+ canvas->draw_generic_textured_rect(screenrect, Rect2(0, 0, 1, 1));
+ glBindTexture(GL_TEXTURE_2D, 0);
+ canvas->canvas_end();
+
+ storage->free(texture);
+
+ if (OS::get_singleton()->is_layered_allowed()) {
+ if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
+#if (defined WINDOWS_ENABLED) && !(defined UWP_ENABLED)
+ Size2 wndsize = OS::get_singleton()->get_layered_buffer_size();
+ uint8_t *data = OS::get_singleton()->get_layered_buffer_data();
+ if (data) {
+ glReadPixels(0, 0, wndsize.x, wndsize.y, GL_BGRA, GL_UNSIGNED_BYTE, data);
+ OS::get_singleton()->swap_layered_buffer();
+
+ return;
+ }
+#endif
+ } else {
+ //clear alpha
+ glColorMask(false, false, false, true);
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glColorMask(true, true, true, true);
+ }
+ }
+
+ OS::get_singleton()->swap_buffers();
+}
+
+void RasterizerGLES2::blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen) {
+
+ ERR_FAIL_COND(storage->frame.current_rt);
+
+ RasterizerStorageGLES2::RenderTarget *rt = storage->render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+
+ canvas->state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, true);
+ canvas->state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_UV_ATTRIBUTE, false);
+
+ canvas->state.canvas_shader.bind();
+
+ canvas->canvas_begin();
+ canvas->state.canvas_shader.set_uniform(CanvasShaderGLES2::BLIT_PASS, true);
+ glDisable(GL_BLEND);
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES2::system_fbo);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, rt->color);
+
+ // TODO normals
+
+ canvas->draw_generic_textured_rect(p_screen_rect, Rect2(0, 0, 1, -1));
+
+ canvas->state.canvas_shader.set_uniform(CanvasShaderGLES2::BLIT_PASS, false);
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ canvas->canvas_end();
+}
+
+void RasterizerGLES2::end_frame(bool p_swap_buffers) {
+
+ if (OS::get_singleton()->is_layered_allowed()) {
+ if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
+#if (defined WINDOWS_ENABLED) && !(defined UWP_ENABLED)
+ Size2 wndsize = OS::get_singleton()->get_layered_buffer_size();
+ uint8_t *data = OS::get_singleton()->get_layered_buffer_data();
+ if (data) {
+ glReadPixels(0, 0, wndsize.x, wndsize.y, GL_BGRA, GL_UNSIGNED_BYTE, data);
+ OS::get_singleton()->swap_layered_buffer();
+
+ return;
+ }
+#endif
+ } else {
+ //clear alpha
+ glColorMask(false, false, false, true);
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glColorMask(true, true, true, true);
+ }
+ }
+
+ if (p_swap_buffers)
+ OS::get_singleton()->swap_buffers();
+ else
+ glFinish();
+}
+
+void RasterizerGLES2::finalize() {
+}
+
+Rasterizer *RasterizerGLES2::_create_current() {
+
+ return memnew(RasterizerGLES2);
+}
+
+void RasterizerGLES2::make_current() {
+ _create_func = _create_current;
+}
+
+void RasterizerGLES2::register_config() {
+}
+
+RasterizerGLES2::RasterizerGLES2() {
+
+ storage = memnew(RasterizerStorageGLES2);
+ canvas = memnew(RasterizerCanvasGLES2);
+ scene = memnew(RasterizerSceneGLES2);
+ canvas->storage = storage;
+ canvas->scene_render = scene;
+ storage->canvas = canvas;
+ scene->storage = storage;
+ storage->scene = scene;
+
+ prev_ticks = 0;
+ time_total = 0;
+}
+
+RasterizerGLES2::~RasterizerGLES2() {
+
+ memdelete(storage);
+ memdelete(canvas);
+}
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
new file mode 100644
index 0000000000..8d57275449
--- /dev/null
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -0,0 +1,72 @@
+/*************************************************************************/
+/* rasterizer_gles2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef RASTERIZERGLES2_H
+#define RASTERIZERGLES2_H
+
+#include "rasterizer_canvas_gles2.h"
+#include "rasterizer_scene_gles2.h"
+#include "rasterizer_storage_gles2.h"
+#include "servers/visual/rasterizer.h"
+
+class RasterizerGLES2 : public Rasterizer {
+
+ static Rasterizer *_create_current();
+
+ RasterizerStorageGLES2 *storage;
+ RasterizerCanvasGLES2 *canvas;
+ RasterizerSceneGLES2 *scene;
+
+ uint64_t prev_ticks;
+ double time_total;
+
+public:
+ virtual RasterizerStorage *get_storage();
+ virtual RasterizerCanvas *get_canvas();
+ virtual RasterizerScene *get_scene();
+
+ virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale);
+
+ virtual void initialize();
+ virtual void begin_frame();
+ virtual void set_current_render_target(RID p_render_target);
+ virtual void restore_render_target();
+ virtual void clear_render_target(const Color &p_color);
+ virtual void blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen = 0);
+ virtual void end_frame(bool p_swap_buffers);
+ virtual void finalize();
+
+ static void make_current();
+
+ static void register_config();
+ RasterizerGLES2();
+ ~RasterizerGLES2();
+};
+
+#endif // RASTERIZERGLES2_H
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
new file mode 100644
index 0000000000..f7712be5d0
--- /dev/null
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -0,0 +1,235 @@
+/*************************************************************************/
+/* rasterizer_scene_gles2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "rasterizer_scene_gles2.h"
+#include "math_funcs.h"
+#include "os/os.h"
+#include "project_settings.h"
+#include "rasterizer_canvas_gles2.h"
+#include "servers/visual/visual_server_raster.h"
+
+#ifndef GLES_OVER_GL
+#define glClearDepth glClearDepthf
+#endif
+
+/* SHADOW ATLAS API */
+
+RID RasterizerSceneGLES2::shadow_atlas_create() {
+
+ return RID();
+}
+
+void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) {
+}
+
+void RasterizerSceneGLES2::shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) {
+}
+
+bool RasterizerSceneGLES2::shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version) {
+ return false;
+}
+
+void RasterizerSceneGLES2::set_directional_shadow_count(int p_count) {
+}
+
+int RasterizerSceneGLES2::get_directional_light_shadow_size(RID p_light_intance) {
+ return 0;
+}
+//////////////////////////////////////////////////////
+
+RID RasterizerSceneGLES2::reflection_atlas_create() {
+ return RID();
+}
+
+void RasterizerSceneGLES2::reflection_atlas_set_size(RID p_ref_atlas, int p_size) {
+}
+
+void RasterizerSceneGLES2::reflection_atlas_set_subdivision(RID p_ref_atlas, int p_subdiv) {
+}
+
+////////////////////////////////////////////////////
+
+RID RasterizerSceneGLES2::reflection_probe_instance_create(RID p_probe) {
+ return RID();
+}
+
+void RasterizerSceneGLES2::reflection_probe_instance_set_transform(RID p_instance, const Transform &p_transform) {
+}
+
+void RasterizerSceneGLES2::reflection_probe_release_atlas_index(RID p_instance) {
+}
+
+bool RasterizerSceneGLES2::reflection_probe_instance_needs_redraw(RID p_instance) {
+ return false;
+}
+
+bool RasterizerSceneGLES2::reflection_probe_instance_has_reflection(RID p_instance) {
+ return false;
+}
+
+bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) {
+ return false;
+}
+
+bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_instance) {
+ return false;
+}
+
+/* ENVIRONMENT API */
+
+RID RasterizerSceneGLES2::environment_create() {
+
+ return RID();
+}
+
+void RasterizerSceneGLES2::environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {
+}
+
+void RasterizerSceneGLES2::environment_set_sky(RID p_env, RID p_sky) {
+}
+
+void RasterizerSceneGLES2::environment_set_sky_custom_fov(RID p_env, float p_scale) {
+}
+
+void RasterizerSceneGLES2::environment_set_bg_color(RID p_env, const Color &p_color) {
+}
+
+void RasterizerSceneGLES2::environment_set_bg_energy(RID p_env, float p_energy) {
+}
+
+void RasterizerSceneGLES2::environment_set_canvas_max_layer(RID p_env, int p_max_layer) {
+}
+
+void RasterizerSceneGLES2::environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy, float p_sky_contribution) {
+}
+
+void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
+}
+
+void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
+}
+
+void RasterizerSceneGLES2::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) {
+}
+
+void RasterizerSceneGLES2::environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {
+}
+
+void RasterizerSceneGLES2::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) {
+}
+
+void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
+}
+
+void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
+}
+
+void RasterizerSceneGLES2::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {
+}
+
+void RasterizerSceneGLES2::environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) {
+}
+
+void RasterizerSceneGLES2::environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve) {
+}
+
+void RasterizerSceneGLES2::environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) {
+}
+
+bool RasterizerSceneGLES2::is_environment(RID p_env) {
+ return false;
+}
+
+VS::EnvironmentBG RasterizerSceneGLES2::environment_get_background(RID p_env) {
+ return VS::ENV_BG_CLEAR_COLOR;
+}
+
+int RasterizerSceneGLES2::environment_get_canvas_max_layer(RID p_env) {
+ return 0;
+}
+
+RID RasterizerSceneGLES2::light_instance_create(RID p_light) {
+ return RID();
+}
+
+void RasterizerSceneGLES2::light_instance_set_transform(RID p_light_instance, const Transform &p_transform) {
+}
+
+void RasterizerSceneGLES2::light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale) {
+}
+
+void RasterizerSceneGLES2::light_instance_mark_visible(RID p_light_instance) {
+}
+
+//////////////////////
+
+RID RasterizerSceneGLES2::gi_probe_instance_create() {
+
+ return RID();
+}
+
+void RasterizerSceneGLES2::gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) {
+}
+void RasterizerSceneGLES2::gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {
+}
+
+void RasterizerSceneGLES2::gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds) {
+}
+
+////////////////////////////
+////////////////////////////
+////////////////////////////
+
+void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {
+}
+
+void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {
+}
+
+void RasterizerSceneGLES2::set_scene_pass(uint64_t p_pass) {
+}
+
+bool RasterizerSceneGLES2::free(RID p_rid) {
+ return true;
+}
+
+void RasterizerSceneGLES2::set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {
+}
+
+void RasterizerSceneGLES2::initialize() {
+}
+
+void RasterizerSceneGLES2::iteration() {
+}
+
+void RasterizerSceneGLES2::finalize() {
+}
+
+RasterizerSceneGLES2::RasterizerSceneGLES2() {
+}
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
new file mode 100644
index 0000000000..110222f709
--- /dev/null
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -0,0 +1,258 @@
+/*************************************************************************/
+/* rasterizer_scene_gles2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef RASTERIZERSCENEGLES2_H
+#define RASTERIZERSCENEGLES2_H
+
+/* Must come before shaders or the Windows build fails... */
+#include "rasterizer_storage_gles2.h"
+
+#include "shaders/scene.glsl.gen.h"
+/*
+
+#include "drivers/gles3/shaders/cube_to_dp.glsl.gen.h"
+#include "drivers/gles3/shaders/effect_blur.glsl.gen.h"
+#include "drivers/gles3/shaders/exposure.glsl.gen.h"
+#include "drivers/gles3/shaders/resolve.glsl.gen.h"
+#include "drivers/gles3/shaders/scene.glsl.gen.h"
+#include "drivers/gles3/shaders/screen_space_reflection.glsl.gen.h"
+#include "drivers/gles3/shaders/ssao.glsl.gen.h"
+#include "drivers/gles3/shaders/ssao_blur.glsl.gen.h"
+#include "drivers/gles3/shaders/ssao_minify.glsl.gen.h"
+#include "drivers/gles3/shaders/subsurf_scattering.glsl.gen.h"
+#include "drivers/gles3/shaders/tonemap.glsl.gen.h"
+
+*/
+
+class RasterizerSceneGLES2 : public RasterizerScene {
+public:
+ RasterizerStorageGLES2 *storage;
+ struct State {
+
+ bool texscreen_copied;
+ int current_blend_mode;
+ float current_line_width;
+ int current_depth_draw;
+ bool current_depth_test;
+ GLuint current_main_tex;
+
+ SceneShaderGLES2 scene_shader;
+ // CubeToDpShaderGLES3 cube_to_dp_shader;
+ // ResolveShaderGLES3 resolve_shader;
+ // ScreenSpaceReflectionShaderGLES3 ssr_shader;
+ // EffectBlurShaderGLES3 effect_blur_shader;
+ // SubsurfScatteringShaderGLES3 sss_shader;
+ // SsaoMinifyShaderGLES3 ssao_minify_shader;
+ // SsaoShaderGLES3 ssao_shader;
+ // SsaoBlurShaderGLES3 ssao_blur_shader;
+ // ExposureShaderGLES3 exposure_shader;
+ // TonemapShaderGLES3 tonemap_shader;
+
+ /*
+ struct SceneDataUBO {
+ //this is a std140 compatible struct. Please read the OpenGL 3.3 Specificaiton spec before doing any changes
+ float projection_matrix[16];
+ float inv_projection_matrix[16];
+ float camera_inverse_matrix[16];
+ float camera_matrix[16];
+ float ambient_light_color[4];
+ float bg_color[4];
+ float fog_color_enabled[4];
+ float fog_sun_color_amount[4];
+
+ float ambient_energy;
+ float bg_energy;
+ float z_offset;
+ float z_slope_scale;
+ float shadow_dual_paraboloid_render_zfar;
+ float shadow_dual_paraboloid_render_side;
+ float viewport_size[2];
+ float screen_pixel_size[2];
+ float shadow_atlas_pixel_size[2];
+ float shadow_directional_pixel_size[2];
+
+ float time;
+ float z_far;
+ float reflection_multiplier;
+ float subsurface_scatter_width;
+ float ambient_occlusion_affect_light;
+
+ uint32_t fog_depth_enabled;
+ float fog_depth_begin;
+ float fog_depth_curve;
+ uint32_t fog_transmit_enabled;
+ float fog_transmit_curve;
+ uint32_t fog_height_enabled;
+ float fog_height_min;
+ float fog_height_max;
+ float fog_height_curve;
+ // make sure this struct is padded to be a multiple of 16 bytes for webgl
+
+ } ubo_data;
+
+ GLuint scene_ubo;
+
+ struct EnvironmentRadianceUBO {
+
+ float transform[16];
+ float ambient_contribution;
+ uint8_t padding[12];
+
+ } env_radiance_data;
+
+ GLuint env_radiance_ubo;
+
+ GLuint sky_verts;
+ GLuint sky_array;
+
+ GLuint directional_ubo;
+
+ GLuint spot_array_ubo;
+ GLuint omni_array_ubo;
+ GLuint reflection_array_ubo;
+
+ GLuint immediate_buffer;
+ GLuint immediate_array;
+
+ uint32_t ubo_light_size;
+ uint8_t *spot_array_tmp;
+ uint8_t *omni_array_tmp;
+ uint8_t *reflection_array_tmp;
+
+ int max_ubo_lights;
+ int max_forward_lights_per_object;
+ int max_ubo_reflections;
+ int max_skeleton_bones;
+
+ bool used_contact_shadows;
+
+ int spot_light_count;
+ int omni_light_count;
+ int directional_light_count;
+ int reflection_probe_count;
+
+ bool cull_front;
+ bool cull_disabled;
+ bool used_sss;
+ bool used_screen_texture;
+ bool using_contact_shadows;
+
+ VS::ViewportDebugDraw debug_draw;
+ */
+ } state;
+
+ /* SHADOW ATLAS API */
+
+ RID shadow_atlas_create();
+ void shadow_atlas_set_size(RID p_atlas, int p_size);
+ void shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision);
+ bool shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version);
+
+ virtual int get_directional_light_shadow_size(RID p_light_intance);
+ virtual void set_directional_shadow_count(int p_count);
+
+ /* REFLECTION PROBE ATLAS API */
+
+ virtual RID reflection_atlas_create();
+ virtual void reflection_atlas_set_size(RID p_ref_atlas, int p_size);
+ virtual void reflection_atlas_set_subdivision(RID p_ref_atlas, int p_subdiv);
+
+ /* REFLECTION CUBEMAPS */
+
+ /* REFLECTION PROBE INSTANCE */
+
+ virtual RID reflection_probe_instance_create(RID p_probe);
+ virtual void reflection_probe_instance_set_transform(RID p_instance, const Transform &p_transform);
+ virtual void reflection_probe_release_atlas_index(RID p_instance);
+ virtual bool reflection_probe_instance_needs_redraw(RID p_instance);
+ virtual bool reflection_probe_instance_has_reflection(RID p_instance);
+ virtual bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas);
+ virtual bool reflection_probe_instance_postprocess_step(RID p_instance);
+
+ /* ENVIRONMENT API */
+ virtual RID environment_create();
+
+ virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
+ virtual void environment_set_sky(RID p_env, RID p_sky);
+ virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
+ virtual void environment_set_bg_color(RID p_env, const Color &p_color);
+ virtual void environment_set_bg_energy(RID p_env, float p_energy);
+ virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
+ virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
+
+ virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
+ virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
+ virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale);
+ virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
+
+ virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
+ virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
+
+ virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
+
+ virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp);
+
+ virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount);
+ virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve);
+ virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve);
+
+ virtual bool is_environment(RID p_env);
+
+ virtual VS::EnvironmentBG environment_get_background(RID p_env);
+ virtual int environment_get_canvas_max_layer(RID p_env);
+
+ /* LIGHT INSTANCE */
+ virtual RID light_instance_create(RID p_light);
+ virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform);
+ virtual void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0);
+ virtual void light_instance_mark_visible(RID p_light_instance);
+
+ /* REFLECTION INSTANCE */
+
+ virtual RID gi_probe_instance_create();
+ virtual void gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data);
+ virtual void gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform);
+ virtual void gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds);
+
+ /* RENDER LIST */
+
+ virtual void render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass);
+ virtual void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count);
+ virtual bool free(RID p_rid);
+
+ virtual void set_scene_pass(uint64_t p_pass);
+ virtual void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw);
+
+ void iteration();
+ void initialize();
+ void finalize();
+ RasterizerSceneGLES2();
+};
+
+#endif // RASTERIZERSCENEGLES2_H
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
new file mode 100644
index 0000000000..de7359a18b
--- /dev/null
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -0,0 +1,2069 @@
+/*************************************************************************/
+/* rasterizer_storage_gles2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "rasterizer_storage_gles2.h"
+#include "project_settings.h"
+#include "rasterizer_canvas_gles2.h"
+#include "rasterizer_scene_gles2.h"
+
+GLuint RasterizerStorageGLES2::system_fbo = 0;
+
+/* TEXTURE API */
+
+Ref<Image> RasterizerStorageGLES2::_get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type) {
+
+ r_gl_format = 0;
+ Ref<Image> image = p_image;
+
+ bool need_decompress = false;
+
+ switch (p_format) {
+
+ case Image::FORMAT_L8: {
+
+ r_gl_internal_format = GL_LUMINANCE;
+ r_gl_format = GL_LUMINANCE;
+ r_gl_type = GL_UNSIGNED_BYTE;
+ } break;
+ case Image::FORMAT_LA8: {
+ r_gl_internal_format = GL_LUMINANCE_ALPHA;
+ r_gl_format = GL_LUMINANCE_ALPHA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+ } break;
+ case Image::FORMAT_R8: {
+
+ r_gl_internal_format = GL_ALPHA;
+ r_gl_format = GL_ALPHA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+
+ } break;
+ case Image::FORMAT_RG8: {
+
+ ERR_EXPLAIN("RG texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGB8: {
+
+ r_gl_internal_format = GL_RGB;
+ r_gl_format = GL_RGB;
+ r_gl_type = GL_UNSIGNED_BYTE;
+
+ } break;
+ case Image::FORMAT_RGBA8: {
+
+ r_gl_format = GL_RGBA;
+ r_gl_internal_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+
+ } break;
+ case Image::FORMAT_RGBA4444: {
+
+ r_gl_internal_format = GL_RGBA;
+ r_gl_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_SHORT_4_4_4_4;
+
+ } break;
+ case Image::FORMAT_RGBA5551: {
+
+ r_gl_internal_format = GL_RGB5_A1;
+ r_gl_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_SHORT_5_5_5_1;
+
+ } break;
+ case Image::FORMAT_RF: {
+ ERR_EXPLAIN("R float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGF: {
+ ERR_EXPLAIN("RG float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGBF: {
+
+ ERR_EXPLAIN("RGB float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGBAF: {
+
+ ERR_EXPLAIN("RGBA float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RH: {
+ ERR_EXPLAIN("R half float texture not supported");
+ ERR_FAIL_V(image);
+ } break;
+ case Image::FORMAT_RGH: {
+ ERR_EXPLAIN("RG half float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGBH: {
+ ERR_EXPLAIN("RGB half float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGBAH: {
+ ERR_EXPLAIN("RGBA half float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_RGBE9995: {
+ ERR_EXPLAIN("RGBA float texture not supported");
+ ERR_FAIL_V(image);
+
+ } break;
+ case Image::FORMAT_DXT1: {
+
+ need_decompress = true;
+
+ } break;
+ case Image::FORMAT_DXT3: {
+
+ need_decompress = true;
+
+ } break;
+ case Image::FORMAT_DXT5: {
+
+ need_decompress = true;
+
+ } break;
+ case Image::FORMAT_RGTC_R: {
+
+ need_decompress = true;
+
+ } break;
+ case Image::FORMAT_RGTC_RG: {
+
+ need_decompress = true;
+
+ } break;
+ case Image::FORMAT_BPTC_RGBA: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_BPTC_RGBF: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_BPTC_RGBFU: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_PVRTC2: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_PVRTC2A: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_PVRTC4: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_PVRTC4A: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_R11: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_R11S: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_RG11: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_RG11S: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_RGB8: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_RGBA8: {
+
+ need_decompress = true;
+ } break;
+ case Image::FORMAT_ETC2_RGB8A1: {
+
+ need_decompress = true;
+ } break;
+ default: {
+
+ ERR_FAIL_V(Ref<Image>());
+ }
+ }
+
+ if (need_decompress) {
+
+ if (!image.is_null()) {
+ image = image->duplicate();
+ image->decompress();
+ ERR_FAIL_COND_V(image->is_compressed(), image);
+ image->convert(Image::FORMAT_RGBA8);
+ }
+
+ r_gl_format = GL_RGBA;
+ r_gl_internal_format = GL_RGBA;
+ r_gl_type = GL_UNSIGNED_BYTE;
+
+ return image;
+ }
+
+ return p_image;
+}
+
+static const GLenum _cube_side_enum[6] = {
+
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+
+};
+
+RID RasterizerStorageGLES2::texture_create() {
+
+ Texture *texture = memnew(Texture);
+ ERR_FAIL_COND_V(!texture, RID());
+ glGenTextures(1, &texture->tex_id);
+ texture->active = false;
+ texture->total_data_size = 0;
+
+ return texture_owner.make_rid(texture);
+}
+
+void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags) {
+ GLenum format;
+ GLenum internal_format;
+ GLenum type;
+
+ if (p_flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ p_flags &= ~VS::TEXTURE_FLAG_MIPMAPS; // no mipies for video
+ }
+
+ Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND(!texture);
+ texture->width = p_width;
+ texture->height = p_height;
+ texture->format = p_format;
+ texture->flags = p_flags;
+ texture->stored_cube_sides = 0;
+ texture->target = (p_flags & VS::TEXTURE_FLAG_CUBEMAP) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
+
+ _get_gl_image_and_format(Ref<Image>(), texture->format, texture->flags, format, internal_format, type);
+
+ texture->alloc_width = texture->width;
+ texture->alloc_height = texture->height;
+
+ texture->gl_format_cache = format;
+ texture->gl_type_cache = type;
+ texture->gl_internal_format_cache = internal_format;
+ texture->data_size = 0;
+ texture->mipmaps = 1;
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(texture->target, texture->tex_id);
+
+ if (p_flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ //prealloc if video
+ glTexImage2D(texture->target, 0, internal_format, p_width, p_height, 0, format, type, NULL);
+ }
+
+ texture->active = true;
+}
+
+void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p_image, VS::CubeMapSide p_cube_side) {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND(!texture);
+ ERR_FAIL_COND(!texture->active);
+ ERR_FAIL_COND(texture->render_target);
+ ERR_FAIL_COND(texture->format != p_image->get_format());
+ ERR_FAIL_COND(p_image.is_null());
+
+ GLenum type;
+ GLenum format;
+ GLenum internal_format;
+ bool compressed = false;
+ bool srgb;
+
+ if (config.keep_original_textures && !(texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
+ texture->images[p_cube_side] = p_image;
+ }
+
+ Ref<Image> img = _get_gl_image_and_format(p_image, p_image->get_format(), texture->flags, format, internal_format, type);
+
+ if (config.shrink_textures_x2 && (p_image->has_mipmaps() || !p_image->is_compressed()) && !(texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
+
+ texture->alloc_height = MAX(1, texture->alloc_height / 2);
+ texture->alloc_width = MAX(1, texture->alloc_width / 2);
+
+ if (texture->alloc_width == img->get_width() / 2 && texture->alloc_height == img->get_height() / 2) {
+
+ img->shrink_x2();
+ } else if (img->get_format() <= Image::FORMAT_RGBA8) {
+
+ img->resize(texture->alloc_width, texture->alloc_height, Image::INTERPOLATE_BILINEAR);
+ }
+ };
+
+ GLenum blit_target = (texture->target == GL_TEXTURE_CUBE_MAP) ? _cube_side_enum[p_cube_side] : GL_TEXTURE_2D;
+
+ texture->data_size = img->get_data().size();
+ PoolVector<uint8_t>::Read read = img->get_data().read();
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(texture->target, texture->tex_id);
+
+ texture->ignore_mipmaps = compressed && !img->has_mipmaps();
+
+ if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps)
+ glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, config.use_fast_texture_filter ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR);
+ else {
+ if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ } else {
+ glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ }
+ }
+
+ if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+
+ glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Filtering
+
+ } else {
+
+ glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // raw Filtering
+ }
+
+ if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
+
+ if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+ } else {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ }
+ } else {
+
+ //glTexParameterf( texture->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
+ glTexParameterf(texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+
+//set swizle for older format compatibility
+#ifdef GLES_OVER_GL
+ switch (texture->format) {
+
+ case Image::FORMAT_L8: {
+
+ } break;
+ case Image::FORMAT_LA8: {
+
+ } break;
+ default: {
+
+ } break;
+ }
+#endif
+
+ int mipmaps = ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && img->has_mipmaps()) ? img->get_mipmap_count() + 1 : 1;
+
+ int w = img->get_width();
+ int h = img->get_height();
+
+ int tsize = 0;
+
+ for (int i = 0; i < mipmaps; i++) {
+
+ int size, ofs;
+ img->get_mipmap_offset_and_size(i, ofs, size);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ if (texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
+ glTexSubImage2D(blit_target, i, 0, 0, w, h, format, type, &read[ofs]);
+ } else {
+ glTexImage2D(blit_target, i, internal_format, w, h, 0, format, type, &read[ofs]);
+ }
+
+ tsize += size;
+
+ w = MAX(1, w >> 1);
+ h = MAX(1, h >> 1);
+ }
+
+ info.texture_mem -= texture->total_data_size;
+ texture->total_data_size = tsize;
+ info.texture_mem += texture->total_data_size;
+
+ // printf("texture: %i x %i - size: %i - total: %i\n", texture->width, texture->height, tsize, info.texture_mem);
+
+ texture->stored_cube_sides |= (1 << p_cube_side);
+
+ if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && mipmaps == 1 && !texture->ignore_mipmaps && (!(texture->flags & VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides == (1 << 6) - 1)) {
+ //generate mipmaps if they were requested and the image does not contain them
+ glGenerateMipmap(texture->target);
+ }
+
+ texture->mipmaps = mipmaps;
+}
+
+void RasterizerStorageGLES2::texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side) {
+ // TODO
+ ERR_PRINT("Not implemented (ask Karroffel to do it :p)");
+}
+
+Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side) const {
+
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND_V(!texture, Ref<Image>());
+ ERR_FAIL_COND_V(!texture->active, Ref<Image>());
+ ERR_FAIL_COND_V(texture->data_size == 0 && !texture->render_target, Ref<Image>());
+
+ if (!texture->images[p_cube_side].is_null()) {
+ return texture->images[p_cube_side];
+ }
+#ifdef GLES_OVER_GL
+
+ PoolVector<uint8_t> data;
+
+ int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, texture->format, texture->mipmaps > 1 ? -1 : 0);
+
+ data.resize(data_size * 2); //add some memory at the end, just in case for buggy drivers
+ PoolVector<uint8_t>::Write wb = data.write();
+
+ glActiveTexture(GL_TEXTURE0);
+
+ glBindTexture(texture->target, texture->tex_id);
+
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+
+ //print_line("GET FORMAT: " + Image::get_format_name(texture->format) + " mipmaps: " + itos(texture->mipmaps));
+
+ for (int i = 0; i < texture->mipmaps; i++) {
+
+ int ofs = 0;
+ if (i > 0) {
+ ofs = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, texture->format, i - 1);
+ }
+
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+
+ glGetTexImage(texture->target, i, texture->gl_format_cache, texture->gl_type_cache, &wb[ofs]);
+ }
+
+ wb = PoolVector<uint8_t>::Write();
+
+ data.resize(data_size);
+
+ Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, texture->format, data));
+
+ return Ref<Image>(img);
+#else
+
+ ERR_EXPLAIN("Sorry, It's not posible to obtain images back in OpenGL ES");
+ return Ref<Image>();
+#endif
+}
+
+void RasterizerStorageGLES2::texture_set_flags(RID p_texture, uint32_t p_flags) {
+
+ Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND(!texture);
+
+ bool had_mipmaps = texture->flags & VS::TEXTURE_FLAG_MIPMAPS;
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(texture->target, texture->tex_id);
+ uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP;
+ texture->flags = p_flags | cube; // can't remove a cube from being a cube
+
+ if (((texture->flags & VS::TEXTURE_FLAG_REPEAT) || (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT)) && texture->target != GL_TEXTURE_CUBE_MAP) {
+
+ if (texture->flags & VS::TEXTURE_FLAG_MIRRORED_REPEAT) {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+ } else {
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ }
+ } else {
+ //glTexParameterf( texture->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
+ glTexParameterf(texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+
+ if ((texture->flags & VS::TEXTURE_FLAG_MIPMAPS) && !texture->ignore_mipmaps) {
+ if (!had_mipmaps && texture->mipmaps == 1) {
+ glGenerateMipmap(texture->target);
+ }
+ glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, config.use_fast_texture_filter ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR_MIPMAP_LINEAR);
+
+ } else {
+ if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+ glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ } else {
+ glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ }
+ }
+
+ if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+
+ glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Filtering
+
+ } else {
+
+ glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // raw Filtering
+ }
+}
+
+uint32_t RasterizerStorageGLES2::texture_get_flags(RID p_texture) const {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND_V(!texture, 0);
+
+ return texture->flags;
+}
+
+Image::Format RasterizerStorageGLES2::texture_get_format(RID p_texture) const {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND_V(!texture, Image::FORMAT_L8);
+
+ return texture->format;
+}
+
+uint32_t RasterizerStorageGLES2::texture_get_texid(RID p_texture) const {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND_V(!texture, 0);
+
+ return texture->tex_id;
+}
+
+uint32_t RasterizerStorageGLES2::texture_get_width(RID p_texture) const {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND_V(!texture, 0);
+
+ return texture->width;
+}
+
+uint32_t RasterizerStorageGLES2::texture_get_height(RID p_texture) const {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND_V(!texture, 0);
+
+ return texture->height;
+}
+
+void RasterizerStorageGLES2::texture_set_size_override(RID p_texture, int p_width, int p_height) {
+ Texture *texture = texture_owner.getornull(p_texture);
+
+ ERR_FAIL_COND(!texture);
+ ERR_FAIL_COND(texture->render_target);
+
+ ERR_FAIL_COND(p_width <= 0 || p_width > 16384);
+ ERR_FAIL_COND(p_height <= 0 || p_height > 16384);
+ //real texture size is in alloc width and height
+ texture->width = p_width;
+ texture->height = p_height;
+}
+
+void RasterizerStorageGLES2::texture_set_path(RID p_texture, const String &p_path) {
+ Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND(!texture);
+
+ texture->path = p_path;
+}
+
+String RasterizerStorageGLES2::texture_get_path(RID p_texture) const {
+ Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND_V(!texture, "");
+
+ return texture->path;
+}
+
+void RasterizerStorageGLES2::texture_debug_usage(List<VS::TextureInfo> *r_info) {
+ List<RID> textures;
+ texture_owner.get_owned_list(&textures);
+
+ for (List<RID>::Element *E = textures.front(); E; E = E->next()) {
+
+ Texture *t = texture_owner.getornull(E->get());
+ if (!t)
+ continue;
+ VS::TextureInfo tinfo;
+ tinfo.path = t->path;
+ tinfo.format = t->format;
+ tinfo.size.x = t->alloc_width;
+ tinfo.size.y = t->alloc_height;
+ tinfo.bytes = t->total_data_size;
+ r_info->push_back(tinfo);
+ }
+}
+
+void RasterizerStorageGLES2::texture_set_shrink_all_x2_on_set_data(bool p_enable) {
+ config.shrink_textures_x2 = p_enable;
+}
+
+void RasterizerStorageGLES2::textures_keep_original(bool p_enable) {
+ config.keep_original_textures = p_enable;
+}
+
+void RasterizerStorageGLES2::texture_set_proxy(RID p_texture, RID p_proxy) {
+ Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND(!texture);
+
+ if (texture->proxy) {
+ texture->proxy->proxy_owners.erase(texture);
+ texture->proxy = NULL;
+ }
+
+ if (p_proxy.is_valid()) {
+ Texture *proxy = texture_owner.get(p_proxy);
+ ERR_FAIL_COND(!proxy);
+ ERR_FAIL_COND(proxy == texture);
+ proxy->proxy_owners.insert(texture);
+ texture->proxy = proxy;
+ }
+}
+
+void RasterizerStorageGLES2::texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+ // TODO
+}
+
+void RasterizerStorageGLES2::texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+ // TODO
+}
+
+void RasterizerStorageGLES2::texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {
+ // TODO
+}
+
+RID RasterizerStorageGLES2::texture_create_radiance_cubemap(RID p_source, int p_resolution) const {
+ // TODO
+ return RID();
+}
+
+RID RasterizerStorageGLES2::sky_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_radiance_size) {
+}
+
+/* SHADER API */
+
+RID RasterizerStorageGLES2::shader_create() {
+
+ Shader *shader = memnew(Shader);
+ shader->mode = VS::SHADER_SPATIAL;
+ shader->shader = &scene->state.scene_shader;
+ RID rid = shader_owner.make_rid(shader);
+ _shader_make_dirty(shader);
+ shader->self = rid;
+
+ return rid;
+}
+
+void RasterizerStorageGLES2::_shader_make_dirty(Shader *p_shader) {
+ if (p_shader->dirty_list.in_list())
+ return;
+
+ _shader_dirty_list.add(&p_shader->dirty_list);
+}
+
+void RasterizerStorageGLES2::shader_set_code(RID p_shader, const String &p_code) {
+
+ Shader *shader = shader_owner.getornull(p_shader);
+ ERR_FAIL_COND(!shader);
+
+ shader->code = p_code;
+
+ String mode_string = ShaderLanguage::get_shader_type(p_code);
+ VS::ShaderMode mode;
+
+ if (mode_string == "canvas_item")
+ mode = VS::SHADER_CANVAS_ITEM;
+ else if (mode_string == "particles")
+ mode = VS::SHADER_PARTICLES;
+ else
+ mode = VS::SHADER_SPATIAL;
+
+ if (shader->custom_code_id && mode != shader->mode) {
+ shader->shader->free_custom_shader(shader->custom_code_id);
+ shader->custom_code_id = 0;
+ }
+
+ shader->mode = mode;
+
+ // TODO handle all shader types
+ if (mode == VS::SHADER_CANVAS_ITEM) {
+ shader->shader = &canvas->state.canvas_shader;
+
+ } else {
+ return;
+ }
+
+ if (shader->custom_code_id == 0) {
+ shader->custom_code_id = shader->shader->create_custom_shader();
+ }
+
+ _shader_make_dirty(shader);
+}
+
+String RasterizerStorageGLES2::shader_get_code(RID p_shader) const {
+
+ const Shader *shader = shader_owner.get(p_shader);
+ ERR_FAIL_COND_V(!shader, "");
+
+ return shader->code;
+}
+
+void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
+
+ _shader_dirty_list.remove(&p_shader->dirty_list);
+
+ p_shader->valid = false;
+
+ p_shader->uniforms.clear();
+
+ ShaderCompilerGLES2::GeneratedCode gen_code;
+ ShaderCompilerGLES2::IdentifierActions *actions = NULL;
+
+ switch (p_shader->mode) {
+
+ // TODO
+
+ case VS::SHADER_CANVAS_ITEM: {
+
+ p_shader->canvas_item.blend_mode = Shader::CanvasItem::BLEND_MODE_MIX;
+
+ p_shader->canvas_item.uses_screen_texture = false;
+ p_shader->canvas_item.uses_screen_uv = false;
+ p_shader->canvas_item.uses_time = false;
+
+ shaders.actions_canvas.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_ADD);
+ shaders.actions_canvas.render_mode_values["blend_mix"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MIX);
+ shaders.actions_canvas.render_mode_values["blend_sub"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_SUB);
+ shaders.actions_canvas.render_mode_values["blend_mul"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MUL);
+ shaders.actions_canvas.render_mode_values["blend_premul_alpha"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_PMALPHA);
+
+ // shaders.actions_canvas.render_mode_values["unshaded"] = Pair<int *, int>(&p_shader->canvas_item.light_mode, Shader::CanvasItem::LIGHT_MODE_UNSHADED);
+ // shaders.actions_canvas.render_mode_values["light_only"] = Pair<int *, int>(&p_shader->canvas_item.light_mode, Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY);
+
+ shaders.actions_canvas.usage_flag_pointers["SCREEN_UV"] = &p_shader->canvas_item.uses_screen_uv;
+ shaders.actions_canvas.usage_flag_pointers["SCREEN_PIXEL_SIZE"] = &p_shader->canvas_item.uses_screen_uv;
+ shaders.actions_canvas.usage_flag_pointers["SCREEN_TEXTURE"] = &p_shader->canvas_item.uses_screen_texture;
+ shaders.actions_canvas.usage_flag_pointers["TIME"] = &p_shader->canvas_item.uses_time;
+
+ actions = &shaders.actions_canvas;
+ actions->uniforms = &p_shader->uniforms;
+ } break;
+
+ default: {
+ return;
+ } break;
+ }
+
+ Error err = shaders.compiler.compile(p_shader->mode, p_shader->code, actions, p_shader->path, gen_code);
+
+ ERR_FAIL_COND(err != OK);
+
+ p_shader->shader->set_custom_shader_code(p_shader->custom_code_id, gen_code.vertex, gen_code.vertex_global, gen_code.fragment, gen_code.light, gen_code.fragment_global, gen_code.uniforms, gen_code.texture_uniforms, gen_code.custom_defines);
+
+ p_shader->texture_count = gen_code.texture_uniforms.size();
+ p_shader->texture_hints = gen_code.texture_hints;
+
+ p_shader->uses_vertex_time = gen_code.uses_vertex_time;
+ p_shader->uses_fragment_time = gen_code.uses_fragment_time;
+
+ for (SelfList<Material> *E = p_shader->materials.first(); E; E = E->next()) {
+ _material_make_dirty(E->self());
+ }
+
+ p_shader->valid = true;
+ p_shader->version++;
+}
+
+void RasterizerStorageGLES2::update_dirty_shaders() {
+ while (_shader_dirty_list.first()) {
+ _update_shader(_shader_dirty_list.first()->self());
+ }
+}
+
+void RasterizerStorageGLES2::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const {
+
+ Shader *shader = shader_owner.get(p_shader);
+ ERR_FAIL_COND(!shader);
+
+ if (shader->dirty_list.in_list()) {
+ _update_shader(shader);
+ }
+
+ Map<int, StringName> order;
+
+ for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) {
+
+ if (E->get().texture_order >= 0) {
+ order[E->get().texture_order + 100000] = E->key();
+ } else {
+ order[E->get().order] = E->key();
+ }
+ }
+
+ for (Map<int, StringName>::Element *E = order.front(); E; E = E->next()) {
+
+ PropertyInfo pi;
+ ShaderLanguage::ShaderNode::Uniform &u = shader->uniforms[E->get()];
+
+ pi.name = E->get();
+
+ switch (u.type) {
+ case ShaderLanguage::TYPE_VOID: {
+ pi.type = Variant::NIL;
+ } break;
+
+ case ShaderLanguage::TYPE_BOOL: {
+ pi.type = Variant::BOOL;
+ } break;
+
+ // bool vectors
+ case ShaderLanguage::TYPE_BVEC2: {
+ pi.type = Variant::INT;
+ pi.hint = PROPERTY_HINT_FLAGS;
+ pi.hint_string = "x,y";
+ } break;
+ case ShaderLanguage::TYPE_BVEC3: {
+ pi.type = Variant::INT;
+ pi.hint = PROPERTY_HINT_FLAGS;
+ pi.hint_string = "x,y,z";
+ } break;
+ case ShaderLanguage::TYPE_BVEC4: {
+ pi.type = Variant::INT;
+ pi.hint = PROPERTY_HINT_FLAGS;
+ pi.hint_string = "x,y,z,w";
+ } break;
+
+ // int stuff
+ case ShaderLanguage::TYPE_UINT:
+ case ShaderLanguage::TYPE_INT: {
+ pi.type = Variant::INT;
+
+ if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_RANGE) {
+ pi.hint = PROPERTY_HINT_RANGE;
+ pi.hint_string = rtos(u.hint_range[0]) + "," + rtos(u.hint_range[1]);
+ }
+ } break;
+
+ case ShaderLanguage::TYPE_IVEC2:
+ case ShaderLanguage::TYPE_UVEC2:
+ case ShaderLanguage::TYPE_IVEC3:
+ case ShaderLanguage::TYPE_UVEC3:
+ case ShaderLanguage::TYPE_IVEC4:
+ case ShaderLanguage::TYPE_UVEC4: {
+ pi.type = Variant::POOL_INT_ARRAY;
+ } break;
+
+ case ShaderLanguage::TYPE_VEC2: {
+ pi.type = Variant::VECTOR2;
+ } break;
+ case ShaderLanguage::TYPE_VEC3: {
+ pi.type = Variant::VECTOR3;
+ } break;
+
+ case ShaderLanguage::TYPE_VEC4: {
+ if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ pi.type = Variant::COLOR;
+ } else {
+ pi.type = Variant::PLANE;
+ }
+ } break;
+
+ case ShaderLanguage::TYPE_MAT2: {
+ pi.type = Variant::TRANSFORM2D;
+ } break;
+
+ case ShaderLanguage::TYPE_MAT3: {
+ pi.type = Variant::BASIS;
+ } break;
+
+ case ShaderLanguage::TYPE_MAT4: {
+ pi.type = Variant::TRANSFORM;
+ } break;
+
+ case ShaderLanguage::TYPE_SAMPLER2D:
+ case ShaderLanguage::TYPE_ISAMPLER2D:
+ case ShaderLanguage::TYPE_USAMPLER2D: {
+ pi.type = Variant::OBJECT;
+ pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pi.hint_string = "Texture";
+ } break;
+
+ case ShaderLanguage::TYPE_SAMPLERCUBE: {
+ pi.type = Variant::OBJECT;
+ pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pi.hint_string = "CubeMap";
+ } break;
+ }
+
+ p_param_list->push_back(pi);
+ }
+}
+
+void RasterizerStorageGLES2::shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture) {
+
+ Shader *shader = shader_owner.get(p_shader);
+ ERR_FAIL_COND(!shader);
+ ERR_FAIL_COND(p_texture.is_valid() && !texture_owner.owns(p_texture));
+
+ if (p_texture.is_valid()) {
+ shader->default_textures[p_name] = p_texture;
+ } else {
+ shader->default_textures.erase(p_name);
+ }
+
+ _shader_make_dirty(shader);
+}
+
+RID RasterizerStorageGLES2::shader_get_default_texture_param(RID p_shader, const StringName &p_name) const {
+
+ const Shader *shader = shader_owner.get(p_shader);
+ ERR_FAIL_COND_V(!shader, RID());
+
+ const Map<StringName, RID>::Element *E = shader->default_textures.find(p_name);
+
+ if (!E) {
+ return RID();
+ }
+
+ return E->get();
+}
+
+/* COMMON MATERIAL API */
+
+void RasterizerStorageGLES2::_material_make_dirty(Material *p_material) const {
+
+ if (p_material->dirty_list.in_list())
+ return;
+
+ _material_dirty_list.add(&p_material->dirty_list);
+}
+
+RID RasterizerStorageGLES2::material_create() {
+
+ Material *material = memnew(Material);
+
+ return material_owner.make_rid(material);
+}
+
+void RasterizerStorageGLES2::material_set_shader(RID p_material, RID p_shader) {
+
+ Material *material = material_owner.get(p_material);
+ ERR_FAIL_COND(!material);
+
+ Shader *shader = shader_owner.getornull(p_shader);
+
+ if (material->shader) {
+ // if a shader is present, remove the old shader
+ material->shader->materials.remove(&material->list);
+ }
+
+ material->shader = shader;
+
+ if (shader) {
+ shader->materials.add(&material->list);
+ }
+
+ _material_make_dirty(material);
+}
+
+RID RasterizerStorageGLES2::material_get_shader(RID p_material) const {
+
+ const Material *material = material_owner.get(p_material);
+ ERR_FAIL_COND_V(!material, RID());
+
+ if (material->shader) {
+ return material->shader->self;
+ }
+
+ return RID();
+}
+
+void RasterizerStorageGLES2::material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {
+
+ Material *material = material_owner.get(p_material);
+ ERR_FAIL_COND(!material);
+
+ if (p_value.get_type() == Variant::NIL) {
+ material->params.erase(p_param);
+ } else {
+ material->params[p_param] = p_value;
+ }
+
+ _material_make_dirty(material);
+}
+
+Variant RasterizerStorageGLES2::material_get_param(RID p_material, const StringName &p_param) const {
+
+ const Material *material = material_owner.get(p_material);
+ ERR_FAIL_COND_V(!material, RID());
+
+ if (material->params.has(p_param)) {
+ return material->params[p_param];
+ }
+
+ return Variant();
+}
+
+void RasterizerStorageGLES2::material_set_line_width(RID p_material, float p_width) {
+}
+
+void RasterizerStorageGLES2::material_set_next_pass(RID p_material, RID p_next_material) {
+}
+
+bool RasterizerStorageGLES2::material_is_animated(RID p_material) {
+ return false;
+}
+
+bool RasterizerStorageGLES2::material_casts_shadows(RID p_material) {
+ return false;
+}
+
+void RasterizerStorageGLES2::material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {
+}
+
+void RasterizerStorageGLES2::material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance) {
+}
+
+void RasterizerStorageGLES2::material_set_render_priority(RID p_material, int priority) {
+}
+
+void RasterizerStorageGLES2::update_dirty_materials() {
+}
+
+/* MESH API */
+
+RID RasterizerStorageGLES2::mesh_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) {
+}
+
+void RasterizerStorageGLES2::mesh_set_blend_shape_count(RID p_mesh, int p_amount) {
+}
+
+int RasterizerStorageGLES2::mesh_get_blend_shape_count(RID p_mesh) const {
+ return 0;
+}
+
+void RasterizerStorageGLES2::mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) {
+}
+
+VS::BlendShapeMode RasterizerStorageGLES2::mesh_get_blend_shape_mode(RID p_mesh) const {
+ return VS::BLEND_SHAPE_MODE_NORMALIZED;
+}
+
+void RasterizerStorageGLES2::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {
+}
+
+void RasterizerStorageGLES2::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {
+}
+
+RID RasterizerStorageGLES2::mesh_surface_get_material(RID p_mesh, int p_surface) const {
+ return RID();
+}
+
+int RasterizerStorageGLES2::mesh_surface_get_array_len(RID p_mesh, int p_surface) const {
+ return 0;
+}
+
+int RasterizerStorageGLES2::mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const {
+ return 0;
+}
+
+PoolVector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_array(RID p_mesh, int p_surface) const {
+ return PoolVector<uint8_t>();
+}
+
+PoolVector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_index_array(RID p_mesh, int p_surface) const {
+ return PoolVector<uint8_t>();
+}
+
+uint32_t RasterizerStorageGLES2::mesh_surface_get_format(RID p_mesh, int p_surface) const {
+ return 0;
+}
+
+VS::PrimitiveType RasterizerStorageGLES2::mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const {
+ return VS::PRIMITIVE_TRIANGLES;
+}
+
+AABB RasterizerStorageGLES2::mesh_surface_get_aabb(RID p_mesh, int p_surface) const {
+ return AABB();
+}
+
+Vector<PoolVector<uint8_t> > RasterizerStorageGLES2::mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const {
+ return Vector<PoolVector<uint8_t> >();
+}
+Vector<AABB> RasterizerStorageGLES2::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const {
+ return Vector<AABB>();
+}
+
+void RasterizerStorageGLES2::mesh_remove_surface(RID p_mesh, int p_surface) {
+}
+
+int RasterizerStorageGLES2::mesh_get_surface_count(RID p_mesh) const {
+ return 0;
+}
+
+void RasterizerStorageGLES2::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {
+}
+
+AABB RasterizerStorageGLES2::mesh_get_custom_aabb(RID p_mesh) const {
+ return AABB();
+}
+
+AABB RasterizerStorageGLES2::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
+ return AABB();
+}
+void RasterizerStorageGLES2::mesh_clear(RID p_mesh) {
+}
+
+/* MULTIMESH API */
+
+RID RasterizerStorageGLES2::multimesh_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format) {
+}
+
+int RasterizerStorageGLES2::multimesh_get_instance_count(RID p_multimesh) const {
+ return 0;
+}
+
+void RasterizerStorageGLES2::multimesh_set_mesh(RID p_multimesh, RID p_mesh) {
+}
+
+void RasterizerStorageGLES2::multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform) {
+}
+
+void RasterizerStorageGLES2::multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) {
+}
+
+void RasterizerStorageGLES2::multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) {
+}
+
+RID RasterizerStorageGLES2::multimesh_get_mesh(RID p_multimesh) const {
+ return RID();
+}
+
+Transform RasterizerStorageGLES2::multimesh_instance_get_transform(RID p_multimesh, int p_index) const {
+ return Transform();
+}
+
+Transform2D RasterizerStorageGLES2::multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const {
+ return Transform2D();
+}
+
+Color RasterizerStorageGLES2::multimesh_instance_get_color(RID p_multimesh, int p_index) const {
+ return Color();
+}
+
+void RasterizerStorageGLES2::multimesh_set_visible_instances(RID p_multimesh, int p_visible) {
+}
+
+int RasterizerStorageGLES2::multimesh_get_visible_instances(RID p_multimesh) const {
+ return 0;
+}
+
+AABB RasterizerStorageGLES2::multimesh_get_aabb(RID p_multimesh) const {
+
+ return AABB();
+}
+
+void RasterizerStorageGLES2::update_dirty_multimeshes() {
+}
+
+/* IMMEDIATE API */
+
+RID RasterizerStorageGLES2::immediate_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture) {
+}
+
+void RasterizerStorageGLES2::immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {
+}
+
+void RasterizerStorageGLES2::immediate_normal(RID p_immediate, const Vector3 &p_normal) {
+}
+
+void RasterizerStorageGLES2::immediate_tangent(RID p_immediate, const Plane &p_tangent) {
+}
+
+void RasterizerStorageGLES2::immediate_color(RID p_immediate, const Color &p_color) {
+}
+
+void RasterizerStorageGLES2::immediate_uv(RID p_immediate, const Vector2 &tex_uv) {
+}
+
+void RasterizerStorageGLES2::immediate_uv2(RID p_immediate, const Vector2 &tex_uv) {
+}
+
+void RasterizerStorageGLES2::immediate_end(RID p_immediate) {
+}
+
+void RasterizerStorageGLES2::immediate_clear(RID p_immediate) {
+}
+
+AABB RasterizerStorageGLES2::immediate_get_aabb(RID p_immediate) const {
+ return AABB();
+}
+
+void RasterizerStorageGLES2::immediate_set_material(RID p_immediate, RID p_material) {
+}
+
+RID RasterizerStorageGLES2::immediate_get_material(RID p_immediate) const {
+ return RID();
+}
+
+/* SKELETON API */
+
+RID RasterizerStorageGLES2::skeleton_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::skeleton_allocate(RID p_skeleton, int p_bones, bool p_2d_skeleton) {
+}
+
+int RasterizerStorageGLES2::skeleton_get_bone_count(RID p_skeleton) const {
+ return 0;
+}
+
+void RasterizerStorageGLES2::skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform &p_transform) {
+}
+
+Transform RasterizerStorageGLES2::skeleton_bone_get_transform(RID p_skeleton, int p_bone) const {
+ return Transform();
+}
+void RasterizerStorageGLES2::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) {
+}
+
+Transform2D RasterizerStorageGLES2::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const {
+ return Transform2D();
+}
+
+void RasterizerStorageGLES2::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {
+}
+
+void RasterizerStorageGLES2::update_dirty_skeletons() {
+}
+
+/* Light API */
+
+RID RasterizerStorageGLES2::light_create(VS::LightType p_type) {
+ return RID();
+}
+
+void RasterizerStorageGLES2::light_set_color(RID p_light, const Color &p_color) {
+}
+
+void RasterizerStorageGLES2::light_set_param(RID p_light, VS::LightParam p_param, float p_value) {
+}
+
+void RasterizerStorageGLES2::light_set_shadow(RID p_light, bool p_enabled) {
+}
+
+void RasterizerStorageGLES2::light_set_shadow_color(RID p_light, const Color &p_color) {
+}
+
+void RasterizerStorageGLES2::light_set_projector(RID p_light, RID p_texture) {
+}
+
+void RasterizerStorageGLES2::light_set_negative(RID p_light, bool p_enable) {
+}
+
+void RasterizerStorageGLES2::light_set_cull_mask(RID p_light, uint32_t p_mask) {
+}
+
+void RasterizerStorageGLES2::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {
+}
+
+void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
+}
+
+VS::LightOmniShadowMode RasterizerStorageGLES2::light_omni_get_shadow_mode(RID p_light) {
+ return VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
+}
+
+void RasterizerStorageGLES2::light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {
+}
+
+void RasterizerStorageGLES2::light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) {
+}
+
+void RasterizerStorageGLES2::light_directional_set_blend_splits(RID p_light, bool p_enable) {
+}
+
+bool RasterizerStorageGLES2::light_directional_get_blend_splits(RID p_light) const {
+ return false;
+}
+
+VS::LightDirectionalShadowMode RasterizerStorageGLES2::light_directional_get_shadow_mode(RID p_light) {
+ return VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
+}
+
+void RasterizerStorageGLES2::light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) {
+}
+
+VS::LightDirectionalShadowDepthRangeMode RasterizerStorageGLES2::light_directional_get_shadow_depth_range_mode(RID p_light) const {
+ return VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
+}
+
+VS::LightType RasterizerStorageGLES2::light_get_type(RID p_light) const {
+ return VS::LIGHT_DIRECTIONAL;
+}
+
+float RasterizerStorageGLES2::light_get_param(RID p_light, VS::LightParam p_param) {
+
+ return VS::LIGHT_DIRECTIONAL;
+}
+
+Color RasterizerStorageGLES2::light_get_color(RID p_light) {
+ return Color();
+}
+
+bool RasterizerStorageGLES2::light_has_shadow(RID p_light) const {
+
+ return VS::LIGHT_DIRECTIONAL;
+}
+
+uint64_t RasterizerStorageGLES2::light_get_version(RID p_light) const {
+ return 0;
+}
+
+AABB RasterizerStorageGLES2::light_get_aabb(RID p_light) const {
+ return AABB();
+}
+
+/* PROBE API */
+
+RID RasterizerStorageGLES2::reflection_probe_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_intensity(RID p_probe, float p_intensity) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_max_distance(RID p_probe, float p_distance) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_as_interior(RID p_probe, bool p_enable) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) {
+}
+
+void RasterizerStorageGLES2::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) {
+}
+
+AABB RasterizerStorageGLES2::reflection_probe_get_aabb(RID p_probe) const {
+ return AABB();
+}
+VS::ReflectionProbeUpdateMode RasterizerStorageGLES2::reflection_probe_get_update_mode(RID p_probe) const {
+ return VS::REFLECTION_PROBE_UPDATE_ALWAYS;
+}
+
+uint32_t RasterizerStorageGLES2::reflection_probe_get_cull_mask(RID p_probe) const {
+ return 0;
+}
+
+Vector3 RasterizerStorageGLES2::reflection_probe_get_extents(RID p_probe) const {
+ return Vector3();
+}
+Vector3 RasterizerStorageGLES2::reflection_probe_get_origin_offset(RID p_probe) const {
+ return Vector3();
+}
+
+bool RasterizerStorageGLES2::reflection_probe_renders_shadows(RID p_probe) const {
+ return false;
+}
+
+float RasterizerStorageGLES2::reflection_probe_get_origin_max_distance(RID p_probe) const {
+ return 0;
+}
+
+RID RasterizerStorageGLES2::gi_probe_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) {
+}
+
+AABB RasterizerStorageGLES2::gi_probe_get_bounds(RID p_probe) const {
+ return AABB();
+}
+
+void RasterizerStorageGLES2::gi_probe_set_cell_size(RID p_probe, float p_size) {
+}
+
+float RasterizerStorageGLES2::gi_probe_get_cell_size(RID p_probe) const {
+ return 0.0;
+}
+
+void RasterizerStorageGLES2::gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {
+}
+
+Transform RasterizerStorageGLES2::gi_probe_get_to_cell_xform(RID p_probe) const {
+ return Transform();
+}
+
+void RasterizerStorageGLES2::gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) {
+}
+
+PoolVector<int> RasterizerStorageGLES2::gi_probe_get_dynamic_data(RID p_probe) const {
+ return PoolVector<int>();
+}
+
+void RasterizerStorageGLES2::gi_probe_set_dynamic_range(RID p_probe, int p_range) {
+}
+
+int RasterizerStorageGLES2::gi_probe_get_dynamic_range(RID p_probe) const {
+ return 0;
+}
+
+void RasterizerStorageGLES2::gi_probe_set_energy(RID p_probe, float p_range) {
+}
+
+void RasterizerStorageGLES2::gi_probe_set_bias(RID p_probe, float p_range) {
+}
+
+void RasterizerStorageGLES2::gi_probe_set_normal_bias(RID p_probe, float p_range) {
+}
+
+void RasterizerStorageGLES2::gi_probe_set_propagation(RID p_probe, float p_range) {
+}
+
+void RasterizerStorageGLES2::gi_probe_set_interior(RID p_probe, bool p_enable) {
+}
+
+bool RasterizerStorageGLES2::gi_probe_is_interior(RID p_probe) const {
+ return false;
+}
+
+void RasterizerStorageGLES2::gi_probe_set_compress(RID p_probe, bool p_enable) {
+}
+
+bool RasterizerStorageGLES2::gi_probe_is_compressed(RID p_probe) const {
+ return false;
+}
+float RasterizerStorageGLES2::gi_probe_get_energy(RID p_probe) const {
+ return 0;
+}
+
+float RasterizerStorageGLES2::gi_probe_get_bias(RID p_probe) const {
+ return 0;
+}
+
+float RasterizerStorageGLES2::gi_probe_get_normal_bias(RID p_probe) const {
+ return 0;
+}
+
+float RasterizerStorageGLES2::gi_probe_get_propagation(RID p_probe) const {
+ return 0;
+}
+
+uint32_t RasterizerStorageGLES2::gi_probe_get_version(RID p_probe) {
+ return 0;
+}
+
+RasterizerStorage::GIProbeCompression RasterizerStorageGLES2::gi_probe_get_dynamic_data_get_preferred_compression() const {
+ return GI_PROBE_UNCOMPRESSED;
+}
+
+RID RasterizerStorageGLES2::gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) {
+ return RID();
+}
+
+void RasterizerStorageGLES2::gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {
+}
+
+///////
+
+RID RasterizerStorageGLES2::lightmap_capture_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {
+}
+
+AABB RasterizerStorageGLES2::lightmap_capture_get_bounds(RID p_capture) const {
+ return AABB();
+}
+
+void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {
+}
+
+PoolVector<uint8_t> RasterizerStorageGLES2::lightmap_capture_get_octree(RID p_capture) const {
+ return PoolVector<uint8_t>();
+}
+
+void RasterizerStorageGLES2::lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {
+}
+
+Transform RasterizerStorageGLES2::lightmap_capture_get_octree_cell_transform(RID p_capture) const {
+ return Transform();
+}
+
+void RasterizerStorageGLES2::lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) {
+}
+
+int RasterizerStorageGLES2::lightmap_capture_get_octree_cell_subdiv(RID p_capture) const {
+ return 0;
+}
+
+void RasterizerStorageGLES2::lightmap_capture_set_energy(RID p_capture, float p_energy) {
+}
+
+float RasterizerStorageGLES2::lightmap_capture_get_energy(RID p_capture) const {
+ return 0.0;
+}
+
+const PoolVector<RasterizerStorage::LightmapCaptureOctree> *RasterizerStorageGLES2::lightmap_capture_get_octree_ptr(RID p_capture) const {
+ return NULL;
+}
+
+///////
+
+RID RasterizerStorageGLES2::particles_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::particles_set_emitting(RID p_particles, bool p_emitting) {
+}
+
+bool RasterizerStorageGLES2::particles_get_emitting(RID p_particles) {
+ return false;
+}
+
+void RasterizerStorageGLES2::particles_set_amount(RID p_particles, int p_amount) {
+}
+
+void RasterizerStorageGLES2::particles_set_lifetime(RID p_particles, float p_lifetime) {
+}
+
+void RasterizerStorageGLES2::particles_set_one_shot(RID p_particles, bool p_one_shot) {
+}
+
+void RasterizerStorageGLES2::particles_set_pre_process_time(RID p_particles, float p_time) {
+}
+
+void RasterizerStorageGLES2::particles_set_explosiveness_ratio(RID p_particles, float p_ratio) {
+}
+
+void RasterizerStorageGLES2::particles_set_randomness_ratio(RID p_particles, float p_ratio) {
+}
+
+void RasterizerStorageGLES2::particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) {
+}
+
+void RasterizerStorageGLES2::particles_set_speed_scale(RID p_particles, float p_scale) {
+}
+
+void RasterizerStorageGLES2::particles_set_use_local_coordinates(RID p_particles, bool p_enable) {
+}
+
+void RasterizerStorageGLES2::particles_set_fixed_fps(RID p_particles, int p_fps) {
+}
+
+void RasterizerStorageGLES2::particles_set_fractional_delta(RID p_particles, bool p_enable) {
+}
+
+void RasterizerStorageGLES2::particles_set_process_material(RID p_particles, RID p_material) {
+}
+
+void RasterizerStorageGLES2::particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) {
+}
+
+void RasterizerStorageGLES2::particles_set_draw_passes(RID p_particles, int p_passes) {
+}
+
+void RasterizerStorageGLES2::particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) {
+}
+
+void RasterizerStorageGLES2::particles_restart(RID p_particles) {
+}
+
+void RasterizerStorageGLES2::particles_request_process(RID p_particles) {
+}
+
+AABB RasterizerStorageGLES2::particles_get_current_aabb(RID p_particles) {
+ return AABB();
+}
+
+AABB RasterizerStorageGLES2::particles_get_aabb(RID p_particles) const {
+ return AABB();
+}
+
+void RasterizerStorageGLES2::particles_set_emission_transform(RID p_particles, const Transform &p_transform) {
+}
+
+int RasterizerStorageGLES2::particles_get_draw_passes(RID p_particles) const {
+ return 0;
+}
+
+RID RasterizerStorageGLES2::particles_get_draw_pass_mesh(RID p_particles, int p_pass) const {
+ return RID();
+}
+
+void RasterizerStorageGLES2::update_particles() {
+}
+
+////////
+
+void RasterizerStorageGLES2::instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {
+}
+
+void RasterizerStorageGLES2::instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance) {
+}
+
+void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
+}
+
+void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
+}
+
+/* RENDER TARGET */
+
+void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
+
+ if (rt->width <= 0 || rt->height <= 0)
+ return;
+
+ Texture *texture = texture_owner.getornull(rt->texture);
+ ERR_FAIL_COND(!texture);
+
+ // create fbo
+
+ glGenFramebuffers(1, &rt->fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
+
+ // color
+
+ glGenTextures(1, &rt->color);
+ glBindTexture(GL_TEXTURE_2D, rt->color);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+ if (texture->flags & VS::TEXTURE_FLAG_FILTER) {
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ } else {
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ }
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
+
+ // depth
+
+ glGenRenderbuffers(1, &rt->depth);
+ glBindRenderbuffer(GL_RENDERBUFFER, rt->depth);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, rt->width, rt->height);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
+
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+
+ glDeleteRenderbuffers(1, &rt->fbo);
+ glDeleteTextures(1, &rt->depth);
+ glDeleteTextures(1, &rt->color);
+ rt->fbo = 0;
+ rt->width = 0;
+ rt->height = 0;
+ rt->color = 0;
+ rt->depth = 0;
+ texture->tex_id = 0;
+ texture->active = false;
+ WARN_PRINT("Could not create framebuffer!!");
+ return;
+ }
+
+ texture->format = Image::FORMAT_RGBA8;
+ texture->gl_format_cache = GL_RGBA;
+ texture->gl_type_cache = GL_UNSIGNED_BYTE;
+ texture->gl_internal_format_cache = GL_RGBA;
+ texture->tex_id = rt->color;
+ texture->width = rt->width;
+ texture->alloc_width = rt->width;
+ texture->height = rt->height;
+ texture->alloc_height = rt->height;
+ texture->active = true;
+
+ texture_set_flags(rt->texture, texture->flags);
+
+ // copy texscreen buffers
+ {
+ int w = rt->width;
+ int h = rt->height;
+
+ glGenTextures(1, &rt->copy_screen_effect.color);
+ glBindTexture(GL_TEXTURE_2D, rt->copy_screen_effect.color);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+ glGenFramebuffers(1, &rt->copy_screen_effect.fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, rt->copy_screen_effect.fbo);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
+
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ _render_target_clear(rt);
+ ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
+ }
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES2::system_fbo);
+}
+
+void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) {
+
+ if (rt->fbo) {
+ glDeleteFramebuffers(1, &rt->fbo);
+ glDeleteTextures(1, &rt->color);
+ rt->fbo = 0;
+ }
+
+ if (rt->depth) {
+ glDeleteRenderbuffers(1, &rt->depth);
+ rt->depth = 0;
+ }
+
+ Texture *tex = texture_owner.get(rt->texture);
+ tex->alloc_height = 0;
+ tex->alloc_width = 0;
+ tex->width = 0;
+ tex->height = 0;
+ tex->active = false;
+
+ // TODO hardcoded texscreen copy effect
+ if (rt->copy_screen_effect.color) {
+ glDeleteFramebuffers(1, &rt->copy_screen_effect.fbo);
+ rt->copy_screen_effect.fbo = 0;
+
+ glDeleteTextures(1, &rt->copy_screen_effect.color);
+ rt->copy_screen_effect.color = 0;
+ }
+}
+
+RID RasterizerStorageGLES2::render_target_create() {
+
+ RenderTarget *rt = memnew(RenderTarget);
+
+ Texture *t = memnew(Texture);
+
+ t->flags = 0;
+ t->width = 0;
+ t->height = 0;
+ t->alloc_height = 0;
+ t->alloc_width = 0;
+ t->format = Image::FORMAT_R8;
+ t->target = GL_TEXTURE_2D;
+ t->gl_format_cache = 0;
+ t->gl_internal_format_cache = 0;
+ t->gl_type_cache = 0;
+ t->data_size = 0;
+ t->total_data_size = 0;
+ t->ignore_mipmaps = false;
+ t->mipmaps = 1;
+ t->active = true;
+ t->tex_id = 0;
+ t->render_target = rt;
+
+ rt->texture = texture_owner.make_rid(t);
+
+ return render_target_owner.make_rid(rt);
+}
+
+void RasterizerStorageGLES2::render_target_set_size(RID p_render_target, int p_width, int p_height) {
+
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+
+ if (p_width == rt->width && p_height == rt->height)
+ return;
+
+ _render_target_clear(rt);
+
+ rt->width = p_width;
+ rt->height = p_height;
+
+ _render_target_allocate(rt);
+}
+
+RID RasterizerStorageGLES2::render_target_get_texture(RID p_render_target) const {
+
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND_V(!rt, RID());
+
+ return rt->texture;
+}
+
+void RasterizerStorageGLES2::render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+
+ rt->flags[p_flag] = p_value;
+
+ switch (p_flag) {
+ case RENDER_TARGET_HDR:
+ case RENDER_TARGET_NO_3D:
+ case RENDER_TARGET_NO_SAMPLING:
+ case RENDER_TARGET_NO_3D_EFFECTS: {
+ //must reset for these formats
+ _render_target_clear(rt);
+ _render_target_allocate(rt);
+
+ } break;
+ default: {}
+ }
+}
+
+bool RasterizerStorageGLES2::render_target_was_used(RID p_render_target) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND_V(!rt, false);
+
+ return rt->used_in_frame;
+}
+
+void RasterizerStorageGLES2::render_target_clear_used(RID p_render_target) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+
+ rt->used_in_frame = false;
+}
+
+void RasterizerStorageGLES2::render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+
+ if (rt->msaa == p_msaa)
+ return;
+
+ _render_target_clear(rt);
+ rt->msaa = p_msaa;
+ _render_target_allocate(rt);
+}
+
+/* CANVAS SHADOW */
+
+RID RasterizerStorageGLES2::canvas_light_shadow_buffer_create(int p_width) {
+ return RID();
+}
+
+/* LIGHT SHADOW MAPPING */
+
+RID RasterizerStorageGLES2::canvas_light_occluder_create() {
+ return RID();
+}
+
+void RasterizerStorageGLES2::canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {
+}
+
+VS::InstanceType RasterizerStorageGLES2::get_base_type(RID p_rid) const {
+ return VS::INSTANCE_NONE;
+}
+
+bool RasterizerStorageGLES2::free(RID p_rid) {
+ return false;
+}
+
+bool RasterizerStorageGLES2::has_os_feature(const String &p_feature) const {
+ return false;
+}
+
+////////////////////////////////////////////
+
+void RasterizerStorageGLES2::set_debug_generate_wireframes(bool p_generate) {
+}
+
+void RasterizerStorageGLES2::render_info_begin_capture() {
+}
+
+void RasterizerStorageGLES2::render_info_end_capture() {
+}
+
+int RasterizerStorageGLES2::get_captured_render_info(VS::RenderInfo p_info) {
+
+ return get_render_info(p_info);
+}
+
+int RasterizerStorageGLES2::get_render_info(VS::RenderInfo p_info) {
+ return 0;
+}
+
+void RasterizerStorageGLES2::initialize() {
+ RasterizerStorageGLES2::system_fbo = 0;
+
+ {
+ const char *gl_extensions = (const char *)glGetString(GL_EXTENSIONS);
+ Vector<String> strings = String(gl_extensions).split(" ", false);
+ for (int i = 0; i < strings.size(); i++) {
+ config.extensions.insert(strings[i]);
+ }
+ }
+
+ frame.count = 0;
+ frame.prev_tick = 0;
+ frame.delta = 0;
+ frame.current_rt = NULL;
+ frame.clear_request = false;
+ // config.keep_original_textures = false;
+
+ glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &config.max_texture_image_units);
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &config.max_texture_size);
+
+ shaders.copy.init();
+
+ {
+ //default textures
+
+ glGenTextures(1, &resources.white_tex);
+ unsigned char whitetexdata[8 * 8 * 3];
+ for (int i = 0; i < 8 * 8 * 3; i++) {
+ whitetexdata[i] = 255;
+ }
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, resources.white_tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, whitetexdata);
+ glGenerateMipmap(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glGenTextures(1, &resources.black_tex);
+ unsigned char blacktexdata[8 * 8 * 3];
+ for (int i = 0; i < 8 * 8 * 3; i++) {
+ blacktexdata[i] = 0;
+ }
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, resources.black_tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, blacktexdata);
+ glGenerateMipmap(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glGenTextures(1, &resources.normal_tex);
+ unsigned char normaltexdata[8 * 8 * 3];
+ for (int i = 0; i < 8 * 8 * 3; i += 3) {
+ normaltexdata[i + 0] = 128;
+ normaltexdata[i + 1] = 128;
+ normaltexdata[i + 2] = 255;
+ }
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, resources.normal_tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, normaltexdata);
+ glGenerateMipmap(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glGenTextures(1, &resources.aniso_tex);
+ unsigned char anisotexdata[8 * 8 * 3];
+ for (int i = 0; i < 8 * 8 * 3; i += 3) {
+ anisotexdata[i + 0] = 255;
+ anisotexdata[i + 1] = 128;
+ anisotexdata[i + 2] = 0;
+ }
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, resources.aniso_tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, anisotexdata);
+ glGenerateMipmap(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ }
+}
+
+void RasterizerStorageGLES2::finalize() {
+}
+
+void RasterizerStorageGLES2::update_dirty_resources() {
+ update_dirty_shaders();
+ update_dirty_materials();
+}
+
+RasterizerStorageGLES2::RasterizerStorageGLES2() {
+ RasterizerStorageGLES2::system_fbo = 0;
+}
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
new file mode 100644
index 0000000000..b735f2e148
--- /dev/null
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -0,0 +1,840 @@
+/*************************************************************************/
+/* rasterizer_storage_gles2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef RASTERIZERSTORAGEGLES2_H
+#define RASTERIZERSTORAGEGLES2_H
+
+#include "self_list.h"
+#include "servers/visual/rasterizer.h"
+#include "servers/visual/shader_language.h"
+#include "shader_compiler_gles2.h"
+#include "shader_gles2.h"
+
+#include "shaders/copy.glsl.gen.h"
+/*
+#include "shaders/blend_shape.glsl.gen.h"
+#include "shaders/canvas.glsl.gen.h"
+#include "shaders/copy.glsl.gen.h"
+#include "shaders/cubemap_filter.glsl.gen.h"
+#include "shaders/particles.glsl.gen.h"
+*/
+
+class RasterizerCanvasGLES2;
+class RasterizerSceneGLES2;
+
+class RasterizerStorageGLES2 : public RasterizerStorage {
+public:
+ RasterizerCanvasGLES2 *canvas;
+ RasterizerSceneGLES2 *scene;
+
+ static GLuint system_fbo;
+
+ struct Config {
+
+ bool shrink_textures_x2;
+ bool use_fast_texture_filter;
+ // bool use_anisotropic_filter;
+
+ bool hdr_supported;
+
+ bool use_rgba_2d_shadows;
+
+ // float anisotropic_level;
+
+ int max_texture_image_units;
+ int max_texture_size;
+
+ bool generate_wireframes;
+
+ bool use_texture_array_environment;
+
+ Set<String> extensions;
+
+ bool keep_original_textures;
+
+ bool no_depth_prepass;
+ bool force_vertex_shading;
+ } config;
+
+ struct Resources {
+
+ GLuint white_tex;
+ GLuint black_tex;
+ GLuint normal_tex;
+ GLuint aniso_tex;
+
+ GLuint quadie;
+ GLuint quadie_array;
+
+ } resources;
+
+ mutable struct Shaders {
+
+ ShaderCompilerGLES2 compiler;
+
+ CopyShaderGLES2 copy;
+
+ ShaderCompilerGLES2::IdentifierActions actions_canvas;
+ ShaderCompilerGLES2::IdentifierActions actions_scene;
+ ShaderCompilerGLES2::IdentifierActions actions_particles;
+
+ } shaders;
+
+ struct Info {
+
+ uint64_t texture_mem;
+ uint64_t vertex_mem;
+
+ struct Render {
+ uint32_t object_count;
+ uint32_t draw_call_count;
+ uint32_t material_switch_count;
+ uint32_t surface_switch_count;
+ uint32_t shader_rebind_count;
+ uint32_t vertices_count;
+
+ void reset() {
+ object_count = 0;
+ draw_call_count = 0;
+ material_switch_count = 0;
+ surface_switch_count = 0;
+ shader_rebind_count = 0;
+ vertices_count = 0;
+ }
+ } render, render_final, snap;
+
+ Info() {
+
+ texture_mem = 0;
+ vertex_mem = 0;
+ render.reset();
+ render_final.reset();
+ }
+
+ } info;
+
+ /////////////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////DATA///////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////API////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////////////////////
+
+ /* TEXTURE API */
+
+ struct RenderTarget;
+
+ struct Texture : RID_Data {
+
+ Texture *proxy;
+ Set<Texture *> proxy_owners;
+
+ String path;
+ uint32_t flags;
+ int width, height;
+ int alloc_width, alloc_height;
+ Image::Format format;
+
+ GLenum target;
+ GLenum gl_format_cache;
+ GLenum gl_internal_format_cache;
+ GLenum gl_type_cache;
+
+ int data_size;
+ int total_data_size;
+ bool ignore_mipmaps;
+
+ int mipmaps;
+
+ bool active;
+ GLenum tex_id;
+
+ uint16_t stored_cube_sides;
+
+ RenderTarget *render_target;
+
+ Ref<Image> images[6];
+
+ Texture() {
+ flags = 0;
+ width = 0;
+ height = 0;
+ alloc_width = 0;
+ alloc_height = 0;
+ format = Image::FORMAT_L8;
+
+ target = 0;
+
+ data_size = 0;
+ total_data_size = 0;
+ ignore_mipmaps = false;
+
+ active = false;
+
+ tex_id = 0;
+
+ stored_cube_sides = 0;
+
+ proxy = NULL;
+
+ render_target = NULL;
+ }
+
+ _ALWAYS_INLINE_ Texture *get_ptr() {
+ if (proxy) {
+ return proxy; //->get_ptr(); only one level of indirection, else not inlining possible.
+ } else {
+ return this;
+ }
+ }
+
+ ~Texture() {
+ if (tex_id != 0) {
+ glDeleteTextures(1, &tex_id);
+ }
+
+ for (Set<Texture *>::Element *E = proxy_owners.front(); E; E = E->next()) {
+ E->get()->proxy = NULL;
+ }
+
+ if (proxy) {
+ proxy->proxy_owners.erase(this);
+ }
+ }
+ };
+
+ mutable RID_Owner<Texture> texture_owner;
+
+ Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type);
+
+ virtual RID texture_create();
+ virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT);
+ virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT);
+ virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT);
+ virtual Ref<Image> texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) const;
+ virtual void texture_set_flags(RID p_texture, uint32_t p_flags);
+ virtual uint32_t texture_get_flags(RID p_texture) const;
+ virtual Image::Format texture_get_format(RID p_texture) const;
+ virtual uint32_t texture_get_texid(RID p_texture) const;
+ virtual uint32_t texture_get_width(RID p_texture) const;
+ virtual uint32_t texture_get_height(RID p_texture) const;
+ virtual void texture_set_size_override(RID p_texture, int p_width, int p_height);
+
+ virtual void texture_set_path(RID p_texture, const String &p_path);
+ virtual String texture_get_path(RID p_texture) const;
+
+ virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable);
+
+ virtual void texture_debug_usage(List<VS::TextureInfo> *r_info);
+
+ virtual RID texture_create_radiance_cubemap(RID p_source, int p_resolution = -1) const;
+
+ virtual void textures_keep_original(bool p_enable);
+
+ virtual void texture_set_proxy(RID p_texture, RID p_proxy);
+
+ virtual void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
+
+ /* SKY API */
+
+ virtual RID sky_create();
+ virtual void sky_set_texture(RID p_sky, RID p_panorama, int p_radiance_size);
+
+ /* SHADER API */
+
+ struct Material;
+
+ struct Shader : public RID_Data {
+
+ RID self;
+
+ VS::ShaderMode mode;
+ ShaderGLES2 *shader;
+ String code;
+ SelfList<Material>::List materials;
+
+ Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
+
+ uint32_t texture_count;
+
+ uint32_t custom_code_id;
+ uint32_t version;
+
+ SelfList<Shader> dirty_list;
+
+ Map<StringName, RID> default_textures;
+
+ Vector<ShaderLanguage::ShaderNode::Uniform::Hint> texture_hints;
+
+ bool valid;
+
+ String path;
+
+ struct CanvasItem {
+
+ enum BlendMode {
+ BLEND_MODE_MIX,
+ BLEND_MODE_ADD,
+ BLEND_MODE_SUB,
+ BLEND_MODE_MUL,
+ BLEND_MODE_PMALPHA,
+ };
+
+ int blend_mode;
+
+ /*
+ enum LightMode {
+ LIGHT_MODE_NORMAL,
+ LIGHT_MODE_UNSHADED,
+ LIGHT_MODE_LIGHT_ONLY
+ };
+
+ int light_mode;
+ */
+ bool uses_screen_texture;
+ bool uses_screen_uv;
+ bool uses_time;
+
+ } canvas_item;
+
+ /*
+ struct Spatial {
+
+ enum BlendMode {
+ BLEND_MODE_MIX,
+ BLEND_MODE_ADD,
+ BLEND_MODE_SUB,
+ BLEND_MODE_MUL,
+ };
+
+ int blend_mode;
+
+ enum DepthDrawMode {
+ DEPTH_DRAW_OPAQUE,
+ DEPTH_DRAW_ALWAYS,
+ DEPTH_DRAW_NEVER,
+ DEPTH_DRAW_ALPHA_PREPASS,
+ };
+
+ int depth_draw_mode;
+
+ enum CullMode {
+ CULL_MODE_FRONT,
+ CULL_MODE_BACK,
+ CULL_MODE_DISABLED,
+ };
+
+ int cull_mode;
+
+ bool uses_alpha;
+ bool uses_alpha_scissor;
+ bool unshaded;
+ bool no_depth_test;
+ bool uses_vertex;
+ bool uses_discard;
+ bool uses_sss;
+ bool uses_screen_texture;
+ bool uses_time;
+ bool writes_modelview_or_projection;
+ bool uses_vertex_lighting;
+ bool uses_world_coordinates;
+
+ } spatial;
+
+ struct Particles {
+
+ } particles;
+ */
+
+ bool uses_vertex_time;
+ bool uses_fragment_time;
+
+ Shader() :
+ dirty_list(this) {
+
+ shader = NULL;
+ valid = false;
+ custom_code_id = 0;
+ version = 1;
+ }
+ };
+
+ mutable RID_Owner<Shader> shader_owner;
+ mutable SelfList<Shader>::List _shader_dirty_list;
+
+ void _shader_make_dirty(Shader *p_shader);
+
+ virtual RID shader_create();
+
+ virtual void shader_set_code(RID p_shader, const String &p_code);
+ virtual String shader_get_code(RID p_shader) const;
+ virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const;
+
+ virtual void shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture);
+ virtual RID shader_get_default_texture_param(RID p_shader, const StringName &p_name) const;
+
+ void _update_shader(Shader *p_shader) const;
+ void update_dirty_shaders();
+
+ /* COMMON MATERIAL API */
+
+ struct Material : public RID_Data {
+
+ Shader *shader;
+ Map<StringName, Variant> params;
+ SelfList<Material> list;
+ SelfList<Material> dirty_list;
+ Vector<RID> textures;
+ float line_width;
+ int render_priority;
+
+ RID next_pass;
+
+ uint32_t index;
+ uint64_t last_pass;
+
+ Map<Geometry *, int> geometry_owners;
+ Map<RasterizerScene::InstanceBase *, int> instance_owners;
+
+ bool can_cast_shadow_cache;
+ bool is_animated_cache;
+
+ Material() :
+ list(this),
+ dirty_list(this) {
+ can_cast_shadow_cache = false;
+ is_animated_cache = false;
+ shader = NULL;
+ line_width = 1.0;
+ last_pass = 0;
+ render_priority = 0;
+ }
+ };
+
+ mutable SelfList<Material>::List _material_dirty_list;
+ void _material_make_dirty(Material *p_material) const;
+
+ mutable RID_Owner<Material> material_owner;
+
+ virtual RID material_create();
+
+ virtual void material_set_shader(RID p_material, RID p_shader);
+ virtual RID material_get_shader(RID p_material) const;
+
+ virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value);
+ virtual Variant material_get_param(RID p_material, const StringName &p_param) const;
+
+ virtual void material_set_line_width(RID p_material, float p_width);
+ virtual void material_set_next_pass(RID p_material, RID p_next_material);
+
+ virtual bool material_is_animated(RID p_material);
+ virtual bool material_casts_shadows(RID p_material);
+
+ virtual void material_add_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance);
+ virtual void material_remove_instance_owner(RID p_material, RasterizerScene::InstanceBase *p_instance);
+
+ virtual void material_set_render_priority(RID p_material, int priority);
+
+ void update_dirty_materials();
+
+ /* MESH API */
+ virtual RID mesh_create();
+
+ virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>());
+
+ virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount);
+ virtual int mesh_get_blend_shape_count(RID p_mesh) const;
+
+ virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode);
+ virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
+
+ virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data);
+
+ virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material);
+ virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const;
+
+ virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const;
+ virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const;
+
+ virtual PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const;
+ virtual PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const;
+
+ virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const;
+ virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
+
+ virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const;
+ virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const;
+ virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const;
+
+ virtual void mesh_remove_surface(RID p_mesh, int p_surface);
+ virtual int mesh_get_surface_count(RID p_mesh) const;
+
+ virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb);
+ virtual AABB mesh_get_custom_aabb(RID p_mesh) const;
+
+ virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const;
+ virtual void mesh_clear(RID p_mesh);
+
+ /* MULTIMESH API */
+
+ virtual RID multimesh_create();
+
+ virtual void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format);
+ virtual int multimesh_get_instance_count(RID p_multimesh) const;
+
+ virtual void multimesh_set_mesh(RID p_multimesh, RID p_mesh);
+ virtual void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform);
+ virtual void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform);
+ virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color);
+
+ virtual RID multimesh_get_mesh(RID p_multimesh) const;
+
+ virtual Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const;
+ virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const;
+ virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const;
+
+ virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible);
+ virtual int multimesh_get_visible_instances(RID p_multimesh) const;
+
+ virtual AABB multimesh_get_aabb(RID p_multimesh) const;
+
+ void update_dirty_multimeshes();
+
+ /* IMMEDIATE API */
+
+ virtual RID immediate_create();
+ virtual void immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture = RID());
+ virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex);
+ virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal);
+ virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent);
+ virtual void immediate_color(RID p_immediate, const Color &p_color);
+ virtual void immediate_uv(RID p_immediate, const Vector2 &tex_uv);
+ virtual void immediate_uv2(RID p_immediate, const Vector2 &tex_uv);
+ virtual void immediate_end(RID p_immediate);
+ virtual void immediate_clear(RID p_immediate);
+ virtual void immediate_set_material(RID p_immediate, RID p_material);
+ virtual RID immediate_get_material(RID p_immediate) const;
+ virtual AABB immediate_get_aabb(RID p_immediate) const;
+
+ /* SKELETON API */
+
+ void update_dirty_skeletons();
+
+ virtual RID skeleton_create();
+ virtual void skeleton_allocate(RID p_skeleton, int p_bones, bool p_2d_skeleton = false);
+ virtual int skeleton_get_bone_count(RID p_skeleton) const;
+ virtual void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform &p_transform);
+ virtual Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const;
+ virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform);
+ virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const;
+ virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform);
+
+ /* Light API */
+
+ virtual RID light_create(VS::LightType p_type);
+
+ virtual void light_set_color(RID p_light, const Color &p_color);
+ virtual void light_set_param(RID p_light, VS::LightParam p_param, float p_value);
+ virtual void light_set_shadow(RID p_light, bool p_enabled);
+ virtual void light_set_shadow_color(RID p_light, const Color &p_color);
+ virtual void light_set_projector(RID p_light, RID p_texture);
+ virtual void light_set_negative(RID p_light, bool p_enable);
+ virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
+ virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
+
+ virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
+ virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
+
+ virtual void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode);
+ virtual void light_directional_set_blend_splits(RID p_light, bool p_enable);
+ virtual bool light_directional_get_blend_splits(RID p_light) const;
+
+ virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
+ virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
+
+ virtual void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode);
+ virtual VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
+
+ virtual bool light_has_shadow(RID p_light) const;
+
+ virtual VS::LightType light_get_type(RID p_light) const;
+ virtual float light_get_param(RID p_light, VS::LightParam p_param);
+ virtual Color light_get_color(RID p_light);
+
+ virtual AABB light_get_aabb(RID p_light) const;
+ virtual uint64_t light_get_version(RID p_light) const;
+
+ /* PROBE API */
+ virtual RID reflection_probe_create();
+
+ virtual void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode);
+ virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity);
+ virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient);
+ virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy);
+ virtual void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib);
+ virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance);
+ virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents);
+ virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset);
+ virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable);
+ virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable);
+ virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable);
+ virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers);
+
+ virtual AABB reflection_probe_get_aabb(RID p_probe) const;
+ virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
+ virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const;
+
+ virtual Vector3 reflection_probe_get_extents(RID p_probe) const;
+ virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const;
+ virtual float reflection_probe_get_origin_max_distance(RID p_probe) const;
+ virtual bool reflection_probe_renders_shadows(RID p_probe) const;
+
+ /* GI PROBE API */
+ virtual RID gi_probe_create();
+
+ virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds);
+ virtual AABB gi_probe_get_bounds(RID p_probe) const;
+
+ virtual void gi_probe_set_cell_size(RID p_probe, float p_size);
+ virtual float gi_probe_get_cell_size(RID p_probe) const;
+
+ virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform);
+ virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const;
+
+ virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data);
+ virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const;
+
+ virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range);
+ virtual int gi_probe_get_dynamic_range(RID p_probe) const;
+
+ virtual void gi_probe_set_energy(RID p_probe, float p_range);
+ virtual float gi_probe_get_energy(RID p_probe) const;
+
+ virtual void gi_probe_set_bias(RID p_probe, float p_range);
+ virtual float gi_probe_get_bias(RID p_probe) const;
+
+ virtual void gi_probe_set_normal_bias(RID p_probe, float p_range);
+ virtual float gi_probe_get_normal_bias(RID p_probe) const;
+
+ virtual void gi_probe_set_propagation(RID p_probe, float p_range);
+ virtual float gi_probe_get_propagation(RID p_probe) const;
+
+ virtual void gi_probe_set_interior(RID p_probe, bool p_enable);
+ virtual bool gi_probe_is_interior(RID p_probe) const;
+
+ virtual void gi_probe_set_compress(RID p_probe, bool p_enable);
+ virtual bool gi_probe_is_compressed(RID p_probe) const;
+
+ virtual uint32_t gi_probe_get_version(RID p_probe);
+
+ virtual GIProbeCompression gi_probe_get_dynamic_data_get_preferred_compression() const;
+ virtual RID gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression);
+ virtual void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data);
+
+ /* LIGHTMAP */
+
+ virtual RID lightmap_capture_create();
+ virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds);
+ virtual AABB lightmap_capture_get_bounds(RID p_capture) const;
+ virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree);
+ virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const;
+ virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform);
+ virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const;
+ virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv);
+ virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const;
+ virtual void lightmap_capture_set_energy(RID p_capture, float p_energy);
+ virtual float lightmap_capture_get_energy(RID p_capture) const;
+ virtual const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const;
+
+ /* PARTICLES */
+ void update_particles();
+
+ virtual RID particles_create();
+
+ virtual void particles_set_emitting(RID p_particles, bool p_emitting);
+ virtual bool particles_get_emitting(RID p_particles);
+
+ virtual void particles_set_amount(RID p_particles, int p_amount);
+ virtual void particles_set_lifetime(RID p_particles, float p_lifetime);
+ virtual void particles_set_one_shot(RID p_particles, bool p_one_shot);
+ virtual void particles_set_pre_process_time(RID p_particles, float p_time);
+ virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio);
+ virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio);
+ virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb);
+ virtual void particles_set_speed_scale(RID p_particles, float p_scale);
+ virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable);
+ virtual void particles_set_process_material(RID p_particles, RID p_material);
+ virtual void particles_set_fixed_fps(RID p_particles, int p_fps);
+ virtual void particles_set_fractional_delta(RID p_particles, bool p_enable);
+ virtual void particles_restart(RID p_particles);
+
+ virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order);
+
+ virtual void particles_set_draw_passes(RID p_particles, int p_passes);
+ virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh);
+
+ virtual void particles_request_process(RID p_particles);
+ virtual AABB particles_get_current_aabb(RID p_particles);
+ virtual AABB particles_get_aabb(RID p_particles) const;
+
+ virtual void particles_set_emission_transform(RID p_particles, const Transform &p_transform);
+
+ virtual int particles_get_draw_passes(RID p_particles) const;
+ virtual RID particles_get_draw_pass_mesh(RID p_particles, int p_pass) const;
+
+ /* INSTANCE */
+
+ virtual void instance_add_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance);
+ virtual void instance_remove_skeleton(RID p_skeleton, RasterizerScene::InstanceBase *p_instance);
+
+ virtual void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance);
+ virtual void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance);
+
+ /* RENDER TARGET */
+
+ struct RenderTarget : public RID_Data {
+ GLuint fbo;
+
+ GLuint color;
+ GLuint depth;
+
+ // TODO post processing effects?
+
+ // TODO HDR?
+
+ // TODO this is hardcoded for texscreen copies for now
+
+ struct Effect {
+ GLuint fbo;
+ int width;
+ int height;
+
+ GLuint color;
+
+ Effect() {
+ fbo = 0;
+ width = 0;
+ height = 0;
+ color = 0;
+ }
+ };
+
+ Effect copy_screen_effect;
+
+ int width, height;
+
+ bool flags[RENDER_TARGET_FLAG_MAX];
+
+ bool used_in_frame;
+ VS::ViewportMSAA msaa;
+
+ RID texture;
+
+ RenderTarget() {
+ fbo = 0;
+
+ color = 0;
+ depth = 0;
+
+ width = 0;
+ height = 0;
+
+ for (int i = 0; i < RENDER_TARGET_FLAG_MAX; i++) {
+ flags[i] = false;
+ }
+
+ used_in_frame = false;
+
+ msaa = VS::VIEWPORT_MSAA_DISABLED;
+ }
+ };
+
+ mutable RID_Owner<RenderTarget> render_target_owner;
+
+ void _render_target_clear(RenderTarget *rt);
+ void _render_target_allocate(RenderTarget *rt);
+
+ virtual RID render_target_create();
+ virtual void render_target_set_size(RID p_render_target, int p_width, int p_height);
+ virtual RID render_target_get_texture(RID p_render_target) const;
+
+ virtual void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value);
+ virtual bool render_target_was_used(RID p_render_target);
+ virtual void render_target_clear_used(RID p_render_target);
+ virtual void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa);
+
+ /* CANVAS SHADOW */
+
+ virtual RID canvas_light_shadow_buffer_create(int p_width);
+
+ /* LIGHT SHADOW MAPPING */
+
+ virtual RID canvas_light_occluder_create();
+ virtual void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines);
+
+ virtual VS::InstanceType get_base_type(RID p_rid) const;
+
+ virtual bool free(RID p_rid);
+
+ struct Frame {
+
+ RenderTarget *current_rt;
+
+ bool clear_request;
+ Color clear_request_color;
+ int canvas_draw_commands;
+ float time[4];
+ float delta;
+ uint64_t prev_tick;
+ uint64_t count;
+
+ } frame;
+
+ void initialize();
+ void finalize();
+
+ virtual bool has_os_feature(const String &p_feature) const;
+
+ virtual void update_dirty_resources();
+
+ virtual void set_debug_generate_wireframes(bool p_generate);
+
+ virtual void render_info_begin_capture();
+ virtual void render_info_end_capture();
+ virtual int get_captured_render_info(VS::RenderInfo p_info);
+
+ virtual int get_render_info(VS::RenderInfo p_info);
+
+ RasterizerStorageGLES2();
+};
+
+#endif // RASTERIZERSTORAGEGLES2_H
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
new file mode 100644
index 0000000000..aa55e72083
--- /dev/null
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -0,0 +1,891 @@
+/*************************************************************************/
+/* shader_compiler_gles3.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "shader_compiler_gles2.h"
+
+#include "os/os.h"
+#include "string_buffer.h"
+#include "string_builder.h"
+
+#define SL ShaderLanguage
+
+static String _mktab(int p_level) {
+
+ String tb;
+ for (int i = 0; i < p_level; i++) {
+ tb += "\t";
+ }
+
+ return tb;
+}
+
+static String _typestr(SL::DataType p_type) {
+
+ return ShaderLanguage::get_datatype_name(p_type);
+}
+
+static String _prestr(SL::DataPrecision p_pres) {
+
+ switch (p_pres) {
+ case SL::PRECISION_LOWP: return "lowp ";
+ case SL::PRECISION_MEDIUMP: return "mediump ";
+ case SL::PRECISION_HIGHP: return "highp ";
+ case SL::PRECISION_DEFAULT: return "";
+ }
+ return "";
+}
+
+static String _qualstr(SL::ArgumentQualifier p_qual) {
+
+ switch (p_qual) {
+ case SL::ARGUMENT_QUALIFIER_IN: return "in ";
+ case SL::ARGUMENT_QUALIFIER_OUT: return "out ";
+ case SL::ARGUMENT_QUALIFIER_INOUT: return "inout ";
+ }
+ return "";
+}
+
+static String _opstr(SL::Operator p_op) {
+
+ return SL::get_operator_text(p_op);
+}
+
+static String _mkid(const String &p_id) {
+
+ StringBuffer<> id;
+ id += "m_";
+ id += p_id;
+
+ return id.as_string();
+}
+
+static String f2sp0(float p_float) {
+
+ if (int(p_float) == p_float)
+ return itos(p_float) + ".0";
+ else
+ return rtoss(p_float);
+}
+
+static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) {
+
+ switch (p_type) {
+ case SL::TYPE_BOOL: return p_values[0].boolean ? "true" : "false";
+ case SL::TYPE_BVEC2:
+ case SL::TYPE_BVEC3:
+ case SL::TYPE_BVEC4: {
+
+ StringBuffer<> text;
+
+ text += "bvec";
+ text += itos(p_type - SL::TYPE_BOOL + 1);
+ text += "(";
+
+ for (int i = 0; i < p_values.size(); i++) {
+ if (i > 0)
+ text += ",";
+
+ text += p_values[i].boolean ? "true" : "false";
+ }
+ text += ")";
+ return text.as_string();
+ }
+
+ // GLSL ES 2 doesn't support uints, so we just use signed ints instead...
+ case SL::TYPE_UINT: return itos(p_values[0].uint);
+ case SL::TYPE_UVEC2:
+ case SL::TYPE_UVEC3:
+ case SL::TYPE_UVEC4: {
+
+ StringBuffer<> text;
+
+ text += "ivec";
+ text += itos(p_type - SL::TYPE_UINT + 1);
+ text += "(";
+
+ for (int i = 0; i < p_values.size(); i++) {
+ if (i > 0)
+ text += ",";
+
+ text += itos(p_values[i].uint);
+ }
+ text += ")";
+ return text.as_string();
+
+ } break;
+
+ case SL::TYPE_INT: return itos(p_values[0].sint);
+ case SL::TYPE_IVEC2:
+ case SL::TYPE_IVEC3:
+ case SL::TYPE_IVEC4: {
+
+ StringBuffer<> text;
+
+ text += "ivec";
+ text += itos(p_type - SL::TYPE_INT + 1);
+ text += "(";
+
+ for (int i = 0; i < p_values.size(); i++) {
+ if (i > 0)
+ text += ",";
+
+ text += itos(p_values[i].sint);
+ }
+ text += ")";
+ return text.as_string();
+
+ } break;
+ case SL::TYPE_FLOAT: return f2sp0(p_values[0].real) + "f";
+ case SL::TYPE_VEC2:
+ case SL::TYPE_VEC3:
+ case SL::TYPE_VEC4: {
+
+ StringBuffer<> text;
+
+ text += "vec";
+ text += itos(p_type - SL::TYPE_FLOAT + 1);
+ text += "(";
+
+ for (int i = 0; i < p_values.size(); i++) {
+ if (i > 0)
+ text += ",";
+
+ text += f2sp0(p_values[i].real);
+ }
+ text += ")";
+ return text.as_string();
+
+ } break;
+ case SL::TYPE_MAT2:
+ case SL::TYPE_MAT3:
+ case SL::TYPE_MAT4: {
+
+ StringBuffer<> text;
+
+ text += "mat";
+ text += itos(p_type - SL::TYPE_MAT2 + 2);
+ text += "(";
+
+ for (int i = 0; i < p_values.size(); i++) {
+ if (i > 0)
+ text += ",";
+
+ text += f2sp0(p_values[i].real);
+ }
+ text += ")";
+ return text.as_string();
+
+ } break;
+ default: ERR_FAIL_V(String());
+ }
+}
+
+void ShaderCompilerGLES2::_dump_function_deps(SL::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added) {
+ int fidx = -1;
+
+ for (int i = 0; i < p_node->functions.size(); i++) {
+ if (p_node->functions[i].name == p_for_func) {
+ fidx = i;
+ break;
+ }
+ }
+
+ ERR_FAIL_COND(fidx == -1);
+
+ for (Set<StringName>::Element *E = p_node->functions[fidx].uses_function.front(); E; E = E->next()) {
+
+ if (r_added.has(E->get())) {
+ continue;
+ }
+
+ _dump_function_deps(p_node, E->get(), p_func_code, r_to_add, r_added);
+
+ SL::FunctionNode *fnode = NULL;
+
+ for (int i = 0; i < p_node->functions.size(); i++) {
+ if (p_node->functions[i].name == E->get()) {
+ fnode = p_node->functions[i].function;
+ break;
+ }
+ }
+
+ ERR_FAIL_COND(!fnode);
+
+ r_to_add += "\n";
+
+ StringBuffer<128> header;
+
+ header += _typestr(fnode->return_type);
+ header += " ";
+ header += _mkid(fnode->name);
+ header += "(";
+
+ for (int i = 0; i < fnode->arguments.size(); i++) {
+ if (i > 0)
+ header += ", ";
+
+ header += _qualstr(fnode->arguments[i].qualifier);
+ header += _prestr(fnode->arguments[i].precision);
+ header += _typestr(fnode->arguments[i].type);
+ header += " ";
+ header += _mkid(fnode->arguments[i].name);
+ }
+
+ header += ")\n";
+ r_to_add += header.as_string();
+ r_to_add += p_func_code[E->get()];
+
+ r_added.insert(E->get());
+ }
+}
+
+String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning) {
+
+ StringBuilder code;
+
+ switch (p_node->type) {
+
+ case SL::Node::TYPE_SHADER: {
+
+ SL::ShaderNode *snode = (SL::ShaderNode *)p_node;
+
+ for (int i = 0; i < snode->render_modes.size(); i++) {
+
+ if (p_default_actions.render_mode_defines.has(snode->render_modes[i]) && !used_rmode_defines.has(snode->render_modes[i])) {
+
+ r_gen_code.custom_defines.push_back(p_default_actions.render_mode_defines[snode->render_modes[i]].utf8());
+ used_rmode_defines.insert(snode->render_modes[i]);
+ }
+
+ if (p_actions.render_mode_flags.has(snode->render_modes[i])) {
+ *p_actions.render_mode_flags[snode->render_modes[i]] = true;
+ }
+
+ if (p_actions.render_mode_values.has(snode->render_modes[i])) {
+ Pair<int *, int> &p = p_actions.render_mode_values[snode->render_modes[i]];
+ *p.first = p.second;
+ }
+ }
+
+ int max_texture_uniforms = 0;
+ int max_uniforms = 0;
+
+ for (Map<StringName, SL::ShaderNode::Uniform>::Element *E = snode->uniforms.front(); E; E = E->next()) {
+ if (SL::is_sampler_type(E->get().type))
+ max_texture_uniforms++;
+ else
+ max_uniforms++;
+ }
+
+ r_gen_code.texture_uniforms.resize(max_texture_uniforms);
+ r_gen_code.texture_hints.resize(max_texture_uniforms);
+
+ r_gen_code.uniforms.resize(max_uniforms + max_texture_uniforms);
+
+ StringBuilder vertex_global;
+ StringBuilder fragment_global;
+
+ // uniforms
+
+ for (Map<StringName, SL::ShaderNode::Uniform>::Element *E = snode->uniforms.front(); E; E = E->next()) {
+ StringBuffer<> uniform_code;
+
+ uniform_code += "uniform ";
+
+ uniform_code += _prestr(E->get().precission);
+ uniform_code += _typestr(E->get().type);
+ uniform_code += " ";
+ uniform_code += _mkid(E->key());
+ uniform_code += ";\n";
+
+ if (SL::is_sampler_type(E->get().type)) {
+ r_gen_code.texture_uniforms[E->get().texture_order] = _mkid(E->key());
+ r_gen_code.texture_hints[E->get().texture_order] = E->get().hint;
+ } else {
+ r_gen_code.uniforms[E->get().order] = E->key();
+ }
+
+ vertex_global += uniform_code.as_string();
+ fragment_global += uniform_code.as_string();
+
+ p_actions.uniforms->insert(E->key(), E->get());
+ }
+
+ // varyings
+
+ for (Map<StringName, SL::ShaderNode::Varying>::Element *E = snode->varyings.front(); E; E = E->next()) {
+
+ StringBuffer<> varying_code;
+
+ varying_code += "varying ";
+ varying_code += _prestr(E->get().precission);
+ varying_code += _typestr(E->get().type);
+ varying_code += " ";
+ varying_code += _mkid(E->key());
+ varying_code += ";\n";
+
+ String final_code = varying_code.as_string();
+
+ vertex_global += final_code;
+ fragment_global += final_code;
+ }
+
+ // functions
+
+ Map<StringName, String> function_code;
+
+ for (int i = 0; i < snode->functions.size(); i++) {
+ SL::FunctionNode *fnode = snode->functions[i].function;
+ function_code[fnode->name] = _dump_node_code(fnode->body, 1, r_gen_code, p_actions, p_default_actions, p_assigning);
+ }
+
+ Set<StringName> added_vertex;
+ Set<StringName> added_fragment;
+
+ for (int i = 0; i < snode->functions.size(); i++) {
+
+ SL::FunctionNode *fnode = snode->functions[i].function;
+
+ current_func_name = fnode->name;
+
+ if (fnode->name == vertex_name) {
+ _dump_function_deps(snode, fnode->name, function_code, vertex_global, added_vertex);
+ r_gen_code.vertex = function_code[vertex_name];
+
+ } else if (fnode->name == fragment_name) {
+ _dump_function_deps(snode, fnode->name, function_code, fragment_global, added_fragment);
+ r_gen_code.fragment = function_code[fragment_name];
+
+ } else if (fnode->name == light_name) {
+ _dump_function_deps(snode, fnode->name, function_code, fragment_global, added_fragment);
+ r_gen_code.light = function_code[light_name];
+ }
+ }
+
+ r_gen_code.vertex_global = vertex_global.as_string();
+ r_gen_code.fragment_global = fragment_global.as_string();
+
+ } break;
+
+ case SL::Node::TYPE_FUNCTION: {
+
+ } break;
+
+ case SL::Node::TYPE_BLOCK: {
+
+ SL::BlockNode *bnode = (SL::BlockNode *)p_node;
+
+ if (!bnode->single_statement) {
+ code += _mktab(p_level - 1);
+ code += "{\n";
+ }
+
+ for (int i = 0; i < bnode->statements.size(); i++) {
+ String statement_code = _dump_node_code(bnode->statements[i], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+
+ if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement) {
+ code += statement_code;
+ } else {
+ code += _mktab(p_level);
+ code += statement_code;
+ code += ";\n";
+ }
+ }
+
+ if (!bnode->single_statement) {
+ code += _mktab(p_level - 1);
+ code += "}\n";
+ }
+ } break;
+
+ case SL::Node::TYPE_VARIABLE_DECLARATION: {
+ SL::VariableDeclarationNode *var_dec_node = (SL::VariableDeclarationNode *)p_node;
+
+ StringBuffer<> declaration;
+
+ declaration += _prestr(var_dec_node->precision);
+ declaration += _typestr(var_dec_node->datatype);
+
+ for (int i = 0; i < var_dec_node->declarations.size(); i++) {
+
+ if (i > 0) {
+ declaration += ",";
+ }
+
+ declaration += " ";
+
+ declaration += _mkid(var_dec_node->declarations[i].name);
+
+ if (var_dec_node->declarations[i].initializer) {
+ declaration += " = ";
+ declaration += _dump_node_code(var_dec_node->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ }
+ }
+
+ code += declaration.as_string();
+ } break;
+
+ case SL::Node::TYPE_VARIABLE: {
+ SL::VariableNode *var_node = (SL::VariableNode *)p_node;
+
+ if (p_assigning && p_actions.write_flag_pointers.has(var_node->name)) {
+ *p_actions.write_flag_pointers[var_node->name] = true;
+ }
+
+ if (p_default_actions.usage_defines.has(var_node->name) && !used_name_defines.has(var_node->name)) {
+ String define = p_default_actions.usage_defines[var_node->name];
+
+ if (define.begins_with("@")) {
+ define = p_default_actions.usage_defines[define.substr(1, define.length())];
+ }
+
+ r_gen_code.custom_defines.push_back(define.utf8());
+ used_name_defines.insert(var_node->name);
+ }
+
+ if (p_actions.usage_flag_pointers.has(var_node->name) && !used_flag_pointers.has(var_node->name)) {
+ *p_actions.usage_flag_pointers[var_node->name] = true;
+ used_flag_pointers.insert(var_node->name);
+ }
+
+ if (p_default_actions.renames.has(var_node->name)) {
+ code += p_default_actions.renames[var_node->name];
+ } else {
+ code += _mkid(var_node->name);
+ }
+
+ if (var_node->name == time_name) {
+ if (current_func_name == vertex_name) {
+ r_gen_code.uses_vertex_time = true;
+ }
+ if (current_func_name == fragment_name || current_func_name == light_name) {
+ r_gen_code.uses_fragment_time = true;
+ }
+ }
+ } break;
+
+ case SL::Node::TYPE_CONSTANT: {
+ SL::ConstantNode *const_node = (SL::ConstantNode *)p_node;
+
+ return get_constant_text(const_node->datatype, const_node->values);
+ } break;
+
+ case SL::Node::TYPE_OPERATOR: {
+ SL::OperatorNode *op_node = (SL::OperatorNode *)p_node;
+
+ switch (op_node->op) {
+ case SL::OP_ASSIGN:
+ case SL::OP_ASSIGN_ADD:
+ case SL::OP_ASSIGN_SUB:
+ case SL::OP_ASSIGN_MUL:
+ case SL::OP_ASSIGN_DIV:
+ case SL::OP_ASSIGN_SHIFT_LEFT:
+ case SL::OP_ASSIGN_SHIFT_RIGHT:
+ case SL::OP_ASSIGN_MOD:
+ case SL::OP_ASSIGN_BIT_AND:
+ case SL::OP_ASSIGN_BIT_OR:
+ case SL::OP_ASSIGN_BIT_XOR: {
+ code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, true);
+ code += " ";
+ code += _opstr(op_node->op);
+ code += " ";
+ code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ } break;
+
+ case SL::OP_BIT_INVERT:
+ case SL::OP_NEGATE:
+ case SL::OP_NOT:
+ case SL::OP_DECREMENT:
+ case SL::OP_INCREMENT: {
+ code += _opstr(op_node->op);
+ code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ } break;
+
+ case SL::OP_POST_DECREMENT:
+ case SL::OP_POST_INCREMENT: {
+ code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += _opstr(op_node->op);
+ } break;
+
+ case SL::OP_CALL:
+ case SL::OP_CONSTRUCT: {
+ ERR_FAIL_COND_V(op_node->arguments[0]->type != SL::Node::TYPE_VARIABLE, String());
+
+ SL::VariableNode *var_node = (SL::VariableNode *)op_node->arguments[0];
+
+ if (op_node->op == SL::OP_CONSTRUCT) {
+ code += var_node->name;
+ } else {
+
+ if (var_node->name == "texture") {
+ // emit texture call
+
+ if (op_node->arguments[1]->get_datatype() == SL::TYPE_SAMPLER2D) {
+ code += "texture2D";
+ } else if (op_node->arguments[1]->get_datatype() == SL::TYPE_SAMPLERCUBE) {
+ code += "textureCube";
+ }
+
+ } else if (p_default_actions.renames.has(var_node->name)) {
+ code += p_default_actions.renames[var_node->name];
+ } else if (internal_functions.has(var_node->name)) {
+ code += var_node->name;
+ } else {
+ code += _mkid(var_node->name);
+ }
+ }
+
+ code += "(";
+
+ for (int i = 1; i < op_node->arguments.size(); i++) {
+ if (i > 1) {
+ code += ", ";
+ }
+
+ code += _dump_node_code(op_node->arguments[i], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ }
+
+ code += ")";
+
+ } break;
+
+ case SL::OP_INDEX: {
+ code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += "[";
+ code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += "]";
+ } break;
+
+ case SL::OP_SELECT_IF: {
+ code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += " ? ";
+ code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += " : ";
+ code += _dump_node_code(op_node->arguments[2], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ } break;
+
+ default: {
+ code += "(";
+ code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += " ";
+ code += _opstr(op_node->op);
+ code += " ";
+ code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += ")";
+ } break;
+ }
+ } break;
+
+ case SL::Node::TYPE_CONTROL_FLOW: {
+ SL::ControlFlowNode *cf_node = (SL::ControlFlowNode *)p_node;
+
+ if (cf_node->flow_op == SL::FLOW_OP_IF) {
+
+ code += _mktab(p_level);
+ code += "if (";
+ code += _dump_node_code(cf_node->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += ")\n";
+ code += _dump_node_code(cf_node->blocks[0], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning);
+
+ if (cf_node->blocks.size() == 2) {
+ code += _mktab(p_level);
+ code += "else\n";
+ code += _dump_node_code(cf_node->blocks[1], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning);
+ }
+ } else if (cf_node->flow_op == SL::FLOW_OP_WHILE) {
+ code += _mktab(p_level);
+ code += "while (";
+ code += _dump_node_code(cf_node->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += ")\n";
+ code += _dump_node_code(cf_node->blocks[0], p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning);
+ } else if (cf_node->flow_op == SL::FLOW_OP_FOR) {
+
+ code += _mktab(p_level);
+ code += "for (";
+ code += _dump_node_code(cf_node->blocks[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += "; ";
+ code += _dump_node_code(cf_node->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += "; ";
+ code += _dump_node_code(cf_node->expressions[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += ")\n";
+
+ code += _dump_node_code(cf_node->blocks[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+
+ } else if (cf_node->flow_op == SL::FLOW_OP_RETURN) {
+ code += _mktab(p_level);
+ code += "return";
+
+ if (cf_node->expressions.size()) {
+ code += " ";
+ code += _dump_node_code(cf_node->expressions[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ }
+ code += ";\n";
+ } else if (cf_node->flow_op == SL::FLOW_OP_DISCARD) {
+ code += "discard;";
+ } else if (cf_node->flow_op == SL::FLOW_OP_CONTINUE) {
+ code += "continue;";
+ } else if (cf_node->flow_op == SL::FLOW_OP_BREAK) {
+ code += "break;";
+ }
+ } break;
+
+ case SL::Node::TYPE_MEMBER: {
+ SL::MemberNode *member_node = (SL::MemberNode *)p_node;
+ code += _dump_node_code(member_node->owner, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
+ code += ".";
+ code += member_node->name;
+ } break;
+ }
+
+ return code.as_string();
+}
+
+Error ShaderCompilerGLES2::compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
+
+ Error err = parser.compile(p_code, ShaderTypes::get_singleton()->get_functions(p_mode), ShaderTypes::get_singleton()->get_modes(p_mode), ShaderTypes::get_singleton()->get_types());
+
+ if (err != OK) {
+
+ Vector<String> shader = p_code.split("\n");
+ for (int i = 0; i < shader.size(); i++) {
+ print_line(itos(i) + " " + shader[i]);
+ }
+
+ _err_print_error(NULL, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
+ return err;
+ }
+
+ r_gen_code.custom_defines.clear();
+ r_gen_code.uniforms.clear();
+ r_gen_code.texture_uniforms.clear();
+ r_gen_code.texture_hints.clear();
+ r_gen_code.vertex = String();
+ r_gen_code.vertex_global = String();
+ r_gen_code.fragment = String();
+ r_gen_code.fragment_global = String();
+ r_gen_code.light = String();
+ r_gen_code.uses_fragment_time = false;
+ r_gen_code.uses_vertex_time = false;
+
+ used_name_defines.clear();
+ used_rmode_defines.clear();
+ used_flag_pointers.clear();
+
+ _dump_node_code(parser.get_shader(), 1, r_gen_code, *p_actions, actions[p_mode], false);
+
+ return OK;
+}
+
+ShaderCompilerGLES2::ShaderCompilerGLES2() {
+
+ /** CANVAS ITEM SHADER **/
+
+ actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
+ actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv_interp";
+ actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "gl_PointSize";
+
+ actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
+ actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
+ actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] = "extra_matrix";
+ actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
+ actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
+ actions[VS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom";
+
+ actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
+ actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
+ actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP"] = "normal_map";
+ actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP_DEPTH"] = "normal_depth";
+ actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv_interp";
+ actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
+ actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture";
+ actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size";
+ actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture";
+ actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv";
+ actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture";
+ actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size";
+ actions[VS::SHADER_CANVAS_ITEM].renames["FRAGCOORD"] = "gl_FragCoord";
+ actions[VS::SHADER_CANVAS_ITEM].renames["POINT_COORD"] = "gl_PointCoord";
+
+ actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"] = "light_vec";
+ actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"] = "light_height";
+ actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"] = "light_color";
+ actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"] = "light_uv";
+ //actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_SHADOW_COLOR"]="light_shadow_color";
+ actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT"] = "light";
+ actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"] = "shadow_color";
+
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["COLOR"] = "#define COLOR_USED\n";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_COLOR"] = "#define SHADOW_COLOR_USED\n";
+ actions[VS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+
+ actions[VS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
+
+ /** SPATIAL SHADER **/
+
+ actions[VS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
+ actions[VS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
+ actions[VS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
+ actions[VS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
+ actions[VS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
+ actions[VS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
+
+ actions[VS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
+ actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
+ actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
+ actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
+ actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
+ actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
+ actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
+ actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize";
+ //actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"]=ShaderLanguage::TYPE_INT;
+
+ //builtins
+
+ actions[VS::SHADER_SPATIAL].renames["TIME"] = "time";
+ actions[VS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
+
+ actions[VS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
+ actions[VS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
+ actions[VS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
+ actions[VS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
+ actions[VS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
+ actions[VS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
+ actions[VS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
+ actions[VS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
+ actions[VS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
+ actions[VS::SHADER_SPATIAL].renames["RIM"] = "rim";
+ actions[VS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
+ actions[VS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
+ actions[VS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
+ actions[VS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
+ actions[VS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
+ //actions[VS::SHADER_SPATIAL].renames["SSS_SPREAD"] = "sss_spread";
+ actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
+ actions[VS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
+ actions[VS::SHADER_SPATIAL].renames["AO"] = "ao";
+ actions[VS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
+ actions[VS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
+ //actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2;
+ actions[VS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
+ actions[VS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
+ actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
+ actions[VS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
+ actions[VS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_buffer";
+ actions[VS::SHADER_SPATIAL].renames["SIDE"] = "side";
+ actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
+
+ //for light
+ actions[VS::SHADER_SPATIAL].renames["VIEW"] = "view";
+ actions[VS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
+ actions[VS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
+ actions[VS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
+ actions[VS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
+
+ actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
+ actions[VS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
+ actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
+ actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
+ actions[VS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
+ actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
+
+ actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
+
+ actions[VS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+
+ actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
+
+ actions[VS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
+
+ actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
+
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
+
+ /* PARTICLES SHADER */
+
+ actions[VS::SHADER_PARTICLES].renames["COLOR"] = "out_color";
+ actions[VS::SHADER_PARTICLES].renames["VELOCITY"] = "out_velocity_active.xyz";
+ actions[VS::SHADER_PARTICLES].renames["MASS"] = "mass";
+ actions[VS::SHADER_PARTICLES].renames["ACTIVE"] = "active";
+ actions[VS::SHADER_PARTICLES].renames["RESTART"] = "restart";
+ actions[VS::SHADER_PARTICLES].renames["CUSTOM"] = "out_custom";
+ actions[VS::SHADER_PARTICLES].renames["TRANSFORM"] = "xform";
+ actions[VS::SHADER_PARTICLES].renames["TIME"] = "time";
+ actions[VS::SHADER_PARTICLES].renames["LIFETIME"] = "lifetime";
+ actions[VS::SHADER_PARTICLES].renames["DELTA"] = "local_delta";
+ actions[VS::SHADER_PARTICLES].renames["NUMBER"] = "particle_number";
+ actions[VS::SHADER_PARTICLES].renames["INDEX"] = "index";
+ actions[VS::SHADER_PARTICLES].renames["GRAVITY"] = "current_gravity";
+ actions[VS::SHADER_PARTICLES].renames["EMISSION_TRANSFORM"] = "emission_transform";
+ actions[VS::SHADER_PARTICLES].renames["RANDOM_SEED"] = "random_seed";
+
+ actions[VS::SHADER_PARTICLES].render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
+ actions[VS::SHADER_PARTICLES].render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
+ actions[VS::SHADER_PARTICLES].render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
+
+ vertex_name = "vertex";
+ fragment_name = "fragment";
+ light_name = "light";
+ time_name = "TIME";
+
+ List<String> func_list;
+
+ ShaderLanguage::get_builtin_funcs(&func_list);
+
+ for (List<String>::Element *E = func_list.front(); E; E = E->next()) {
+ internal_functions.insert(E->get());
+ }
+}
diff --git a/drivers/gles2/shader_compiler_gles2.h b/drivers/gles2/shader_compiler_gles2.h
new file mode 100644
index 0000000000..804ead2172
--- /dev/null
+++ b/drivers/gles2/shader_compiler_gles2.h
@@ -0,0 +1,101 @@
+/*************************************************************************/
+/* shader_compiler_gles2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef SHADERCOMPILERGLES2_H
+#define SHADERCOMPILERGLES2_H
+
+#include "pair.h"
+#include "servers/visual/shader_language.h"
+#include "servers/visual/shader_types.h"
+#include "servers/visual_server.h"
+
+#include "string_builder.h"
+
+class ShaderCompilerGLES2 {
+public:
+ struct IdentifierActions {
+
+ Map<StringName, Pair<int *, int> > render_mode_values;
+ Map<StringName, bool *> render_mode_flags;
+ Map<StringName, bool *> usage_flag_pointers;
+ Map<StringName, bool *> write_flag_pointers;
+
+ Map<StringName, ShaderLanguage::ShaderNode::Uniform> *uniforms;
+ };
+
+ struct GeneratedCode {
+
+ Vector<CharString> custom_defines;
+ Vector<StringName> uniforms;
+ Vector<StringName> texture_uniforms;
+ Vector<ShaderLanguage::ShaderNode::Uniform::Hint> texture_hints;
+
+ String vertex_global;
+ String vertex;
+ String fragment_global;
+ String fragment;
+ String light;
+
+ bool uses_fragment_time;
+ bool uses_vertex_time;
+ };
+
+private:
+ ShaderLanguage parser;
+
+ struct DefaultIdentifierActions {
+
+ Map<StringName, String> renames;
+ Map<StringName, String> render_mode_defines;
+ Map<StringName, String> usage_defines;
+ };
+
+ void _dump_function_deps(ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added);
+ String _dump_node_code(ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning);
+
+ StringName current_func_name;
+ StringName vertex_name;
+ StringName fragment_name;
+ StringName light_name;
+ StringName time_name;
+
+ Set<StringName> used_name_defines;
+ Set<StringName> used_flag_pointers;
+ Set<StringName> used_rmode_defines;
+ Set<StringName> internal_functions;
+
+ DefaultIdentifierActions actions[VS::SHADER_MAX];
+
+public:
+ Error compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
+
+ ShaderCompilerGLES2();
+};
+
+#endif // SHADERCOMPILERGLES3_H
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
new file mode 100644
index 0000000000..fa9562877d
--- /dev/null
+++ b/drivers/gles2/shader_gles2.cpp
@@ -0,0 +1,689 @@
+/*************************************************************************/
+/* shader_gles2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "shader_gles2.h"
+
+#include "memory.h"
+#include "print_string.h"
+#include "string_builder.h"
+
+//#define DEBUG_OPENGL
+
+// #include "shaders/copy.glsl.gen.h"
+
+#ifdef DEBUG_OPENGL
+
+#define DEBUG_TEST_ERROR(m_section) \
+ { \
+ uint32_t err = glGetError(); \
+ if (err) { \
+ print_line("OpenGL Error #" + itos(err) + " at: " + m_section); \
+ } \
+ }
+#else
+
+#define DEBUG_TEST_ERROR(m_section)
+
+#endif
+
+ShaderGLES2 *ShaderGLES2::active = NULL;
+
+//#define DEBUG_SHADER
+
+#ifdef DEBUG_SHADER
+
+#define DEBUG_PRINT(m_text) print_line(m_text);
+
+#else
+
+#define DEBUG_PRINT(m_text)
+
+#endif
+
+void ShaderGLES2::bind_uniforms() {
+ if (!uniforms_dirty)
+ return;
+
+ // regular uniforms
+
+ const Map<uint32_t, Variant>::Element *E = uniform_defaults.front();
+
+ while (E) {
+ int idx = E->key();
+ int location = version->uniform_location[idx];
+
+ if (location < 0) {
+ E = E->next();
+ continue;
+ }
+
+ const Variant &v = E->value();
+ _set_uniform_variant(location, v);
+ E = E->next();
+ }
+
+ // camera uniforms
+
+ const Map<uint32_t, CameraMatrix>::Element *C = uniform_cameras.front();
+
+ while (C) {
+ int idx = E->key();
+ int location = version->uniform_location[idx];
+
+ if (location < 0) {
+ C = C->next();
+ continue;
+ }
+
+ glUniformMatrix4fv(location, 1, GL_FALSE, &(C->get().matrix[0][0]));
+ C = C->next();
+ }
+
+ uniforms_dirty = false;
+}
+
+GLint ShaderGLES2::get_uniform_location(int p_index) const {
+
+ ERR_FAIL_COND_V(!version, -1);
+
+ return version->uniform_location[p_index];
+}
+
+bool ShaderGLES2::bind() {
+
+ if (active != this || !version || new_conditional_version.key != conditional_version.key) {
+ conditional_version = new_conditional_version;
+ version = get_current_version();
+ } else {
+ return false;
+ }
+
+ ERR_FAIL_COND_V(!version, false);
+
+ glUseProgram(version->id);
+
+ DEBUG_TEST_ERROR("use program");
+
+ active = this;
+ uniforms_dirty = true;
+
+ return true;
+}
+
+void ShaderGLES2::unbind() {
+ version = NULL;
+ glUseProgram(0);
+ uniforms_dirty = true;
+ active = NULL;
+}
+
+static String _fix_error_code_line(const String &p_error, int p_code_start, int p_offset) {
+
+ int last_find_pos = -1;
+ // NVIDIA
+ String error = p_error;
+ while ((last_find_pos = p_error.find("(", last_find_pos + 1)) != -1) {
+
+ int end_pos = last_find_pos + 1;
+
+ while (true) {
+
+ if (p_error[end_pos] >= '0' && p_error[end_pos] <= '9') {
+
+ end_pos++;
+ continue;
+ } else if (p_error[end_pos] == ')') {
+ break;
+ } else {
+
+ end_pos = -1;
+ break;
+ }
+ }
+
+ if (end_pos == -1)
+ continue;
+
+ String numstr = error.substr(last_find_pos + 1, (end_pos - last_find_pos) - 1);
+ String begin = error.substr(0, last_find_pos + 1);
+ String end = error.substr(end_pos, error.length());
+ int num = numstr.to_int() + p_code_start - p_offset;
+ error = begin + itos(num) + end;
+ }
+
+ // ATI
+ last_find_pos = -1;
+ while ((last_find_pos = p_error.find("ERROR: ", last_find_pos + 1)) != -1) {
+
+ last_find_pos += 6;
+ int end_pos = last_find_pos + 1;
+
+ while (true) {
+
+ if (p_error[end_pos] >= '0' && p_error[end_pos] <= '9') {
+
+ end_pos++;
+ continue;
+ } else if (p_error[end_pos] == ':') {
+ break;
+ } else {
+
+ end_pos = -1;
+ break;
+ }
+ }
+ continue;
+ if (end_pos == -1)
+ continue;
+
+ String numstr = error.substr(last_find_pos + 1, (end_pos - last_find_pos) - 1);
+ print_line("numstr: " + numstr);
+ String begin = error.substr(0, last_find_pos + 1);
+ String end = error.substr(end_pos, error.length());
+ int num = numstr.to_int() + p_code_start - p_offset;
+ error = begin + itos(num) + end;
+ }
+ return error;
+}
+
+ShaderGLES2::Version *ShaderGLES2::get_current_version() {
+
+ Version *_v = version_map.getptr(conditional_version);
+
+ if (_v) {
+ if (conditional_version.code_version != 0) {
+ CustomCode *cc = custom_code_map.getptr(conditional_version.code_version);
+ ERR_FAIL_COND_V(!cc, _v);
+ if (cc->version == _v->code_version)
+ return _v;
+ } else {
+ return _v;
+ }
+ }
+
+ if (!_v)
+ version_map[conditional_version];
+
+ Version &v = version_map[conditional_version];
+
+ if (!_v) {
+ v.uniform_location = memnew_arr(GLint, uniform_count);
+ } else {
+ if (v.ok) {
+ glDeleteShader(v.vert_id);
+ glDeleteShader(v.frag_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+ }
+ }
+
+ v.ok = false;
+
+ Vector<const char *> strings;
+
+#ifdef GLES_OVER_GL
+ strings.push_back("#version 120\n");
+ strings.push_back("#define USE_GLES_OVER_GL\n");
+#else
+ strings.push_back("#version 100\n");
+#endif
+
+ int define_line_ofs = 1;
+
+ for (int j = 0; j < conditional_count; j++) {
+ bool enable = (conditional_version.version & (1 << j)) > 0;
+
+ if (enable) {
+ strings.push_back(conditional_defines[j]);
+ define_line_ofs++;
+ DEBUG_PRINT(conditional_defines[j]);
+ }
+ }
+
+ // keep them around during the functino
+ CharString code_string;
+ CharString code_string2;
+ CharString code_globals;
+
+ CustomCode *cc = NULL;
+
+ if (conditional_version.code_version > 0) {
+ cc = custom_code_map.getptr(conditional_version.code_version);
+
+ ERR_FAIL_COND_V(!cc, NULL);
+ v.code_version = cc->version;
+ define_line_ofs += 2;
+ }
+
+ // program
+
+ v.id = glCreateProgram();
+ ERR_FAIL_COND_V(v.id == 0, NULL);
+
+ if (cc) {
+ for (int i = 0; i < cc->custom_defines.size(); i++) {
+ strings.push_back(cc->custom_defines[i]);
+ DEBUG_PRINT("CD #" + itos(i) + ": " + String(cc->custom_defines[i]));
+ }
+ }
+
+ // vertex shader
+
+ int string_base_size = strings.size();
+
+ strings.push_back(vertex_code0.get_data());
+
+ if (cc) {
+ code_globals = cc->vertex_globals.ascii();
+ strings.push_back(code_globals.get_data());
+ }
+
+ strings.push_back(vertex_code1.get_data());
+
+ if (cc) {
+ code_string = cc->vertex.ascii();
+ strings.push_back(code_string.get_data());
+ }
+
+ strings.push_back(vertex_code2.get_data());
+
+#ifdef DEBUG_SHADER
+
+ DEBUG_PRINT("\nVertex Code:\n\n" + String(code_string.get_data()));
+
+#endif
+
+ v.vert_id = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(v.vert_id, strings.size(), &strings[0], NULL);
+ glCompileShader(v.vert_id);
+
+ GLint status;
+
+ glGetShaderiv(v.vert_id, GL_COMPILE_STATUS, &status);
+ if (status == GL_FALSE) {
+ GLsizei iloglen;
+ glGetShaderiv(v.vert_id, GL_INFO_LOG_LENGTH, &iloglen);
+
+ if (iloglen < 0) {
+ glDeleteShader(v.vert_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+
+ ERR_PRINT("No OpenGL vertex shader compiler log. What the frick?");
+ } else {
+ if (iloglen == 0) {
+ iloglen = 4096; // buggy driver (Adreno 220+)
+ }
+
+ char *ilogmem = (char *)Memory::alloc_static(iloglen + 1);
+ ilogmem[iloglen] = '\0';
+ glGetShaderInfoLog(v.vert_id, iloglen, &iloglen, ilogmem);
+
+ String err_string = get_shader_name() + ": Vertex shader compilation failed:\n";
+
+ err_string += ilogmem;
+ err_string = _fix_error_code_line(err_string, vertex_code_start, define_line_ofs);
+
+ ERR_PRINTS(err_string);
+
+ Memory::free_static(ilogmem);
+ glDeleteShader(v.vert_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+ }
+
+ ERR_FAIL_V(NULL);
+ }
+
+ strings.resize(string_base_size);
+
+ // fragment shader
+
+ strings.push_back(fragment_code0.get_data());
+
+ if (cc) {
+ code_globals = cc->fragment_globals.ascii();
+ strings.push_back(code_globals.get_data());
+ }
+
+ strings.push_back(fragment_code1.get_data());
+
+ if (cc) {
+ code_string = cc->fragment.ascii();
+ strings.push_back(code_string.get_data());
+ }
+
+ strings.push_back(fragment_code2.get_data());
+
+ if (cc) {
+ code_string2 = cc->light.ascii();
+ strings.push_back(code_string2.get_data());
+ }
+
+ strings.push_back(fragment_code3.get_data());
+
+#ifdef DEBUG_SHADER
+ DEBUG_PRINT("\nFragment Code:\n\n" + String(code_string.get_data()));
+#endif
+
+ v.frag_id = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(v.frag_id, strings.size(), &strings[0], NULL);
+ glCompileShader(v.frag_id);
+
+ glGetShaderiv(v.frag_id, GL_COMPILE_STATUS, &status);
+ if (status == GL_FALSE) {
+ GLsizei iloglen;
+ glGetShaderiv(v.frag_id, GL_INFO_LOG_LENGTH, &iloglen);
+
+ if (iloglen < 0) {
+ glDeleteShader(v.frag_id);
+ glDeleteShader(v.vert_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+
+ ERR_PRINT("No OpenGL fragment shader compiler log. What the frick?");
+ } else {
+ if (iloglen == 0) {
+ iloglen = 4096; // buggy driver (Adreno 220+)
+ }
+
+ char *ilogmem = (char *)Memory::alloc_static(iloglen + 1);
+ ilogmem[iloglen] = '\0';
+ glGetShaderInfoLog(v.frag_id, iloglen, &iloglen, ilogmem);
+
+ String err_string = get_shader_name() + ": Fragment shader compilation failed:\n";
+
+ err_string += ilogmem;
+ err_string = _fix_error_code_line(err_string, fragment_code_start, define_line_ofs);
+
+ ERR_PRINTS(err_string);
+
+ Memory::free_static(ilogmem);
+ glDeleteShader(v.frag_id);
+ glDeleteShader(v.vert_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+ }
+
+ ERR_FAIL_V(NULL);
+ }
+
+ glAttachShader(v.id, v.frag_id);
+ glAttachShader(v.id, v.vert_id);
+
+ // bind the attribute locations. This has to be done before linking so that the
+ // linker doesn't assign some random indices
+
+ for (int i = 0; i < attribute_pair_count; i++) {
+ glBindAttribLocation(v.id, attribute_pairs[i].index, attribute_pairs[i].name);
+ }
+
+ glLinkProgram(v.id);
+
+ glGetProgramiv(v.id, GL_LINK_STATUS, &status);
+ if (status == GL_FALSE) {
+ GLsizei iloglen;
+ glGetProgramiv(v.id, GL_INFO_LOG_LENGTH, &iloglen);
+
+ if (iloglen < 0) {
+ glDeleteShader(v.frag_id);
+ glDeleteShader(v.vert_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+
+ ERR_PRINT("No OpenGL program link log. What the frick?");
+ ERR_FAIL_V(NULL);
+ }
+
+ if (iloglen == 0) {
+ iloglen = 4096; // buggy driver (Adreno 220+)
+ }
+
+ char *ilogmem = (char *)Memory::alloc_static(iloglen + 1);
+ ilogmem[iloglen] = '\0';
+ glGetProgramInfoLog(v.id, iloglen, &iloglen, ilogmem);
+
+ String err_string = get_shader_name() + ": Program linking failed:\n";
+
+ err_string += ilogmem;
+ err_string = _fix_error_code_line(err_string, fragment_code_start, define_line_ofs);
+
+ ERR_PRINTS(err_string);
+
+ Memory::free_static(ilogmem);
+ glDeleteShader(v.frag_id);
+ glDeleteShader(v.vert_id);
+ glDeleteProgram(v.id);
+ v.id = 0;
+
+ ERR_FAIL_V(NULL);
+ }
+
+ // get uniform locations
+
+ glUseProgram(v.id);
+
+ for (int i = 0; i < uniform_count; i++) {
+ v.uniform_location[i] = glGetUniformLocation(v.id, uniform_names[i]);
+ }
+
+ for (int i = 0; i < texunit_pair_count; i++) {
+ GLint loc = glGetUniformLocation(v.id, texunit_pairs[i].name);
+ if (loc >= 0)
+ glUniform1i(loc, texunit_pairs[i].index);
+ }
+
+ if (cc) {
+ v.custom_uniform_locations.resize(cc->custom_uniforms.size());
+ for (int i = 0; i < cc->custom_uniforms.size(); i++) {
+ v.custom_uniform_locations[i] = glGetUniformLocation(v.id, String(cc->custom_uniforms[i]).ascii().get_data());
+ }
+ }
+
+ glUseProgram(0);
+ v.ok = true;
+
+ return &v;
+}
+
+GLint ShaderGLES2::get_uniform_location(const String &p_name) const {
+
+ ERR_FAIL_COND_V(!version, -1);
+ return glGetUniformLocation(version->id, p_name.ascii().get_data());
+}
+
+void ShaderGLES2::setup(
+ const char **p_conditional_defines,
+ int p_conditional_count,
+ const char **p_uniform_names,
+ int p_uniform_count,
+ const AttributePair *p_attribute_pairs,
+ int p_attribute_count,
+ const TexUnitPair *p_texunit_pairs,
+ int p_texunit_pair_count,
+ const char *p_vertex_code,
+ const char *p_fragment_code,
+ int p_vertex_code_start,
+ int p_fragment_code_start) {
+
+ ERR_FAIL_COND(version);
+
+ conditional_version.key = 0;
+ new_conditional_version.key = 0;
+ uniform_count = p_uniform_count;
+ conditional_count = p_conditional_count;
+ conditional_defines = p_conditional_defines;
+ uniform_names = p_uniform_names;
+ vertex_code = p_vertex_code;
+ fragment_code = p_fragment_code;
+ texunit_pairs = p_texunit_pairs;
+ texunit_pair_count = p_texunit_pair_count;
+ vertex_code_start = p_vertex_code_start;
+ fragment_code_start = p_fragment_code_start;
+ attribute_pairs = p_attribute_pairs;
+ attribute_pair_count = p_attribute_count;
+
+ {
+ String globals_tag = "\nVERTEX_SHADER_GLOBALS";
+ String code_tag = "\nVERTEX_SHADER_CODE";
+ String code = vertex_code;
+ int cpos = code.find(globals_tag);
+ if (cpos == -1) {
+ vertex_code0 = code.ascii();
+ } else {
+ vertex_code0 = code.substr(0, cpos).ascii();
+ code = code.substr(cpos + globals_tag.length(), code.length());
+
+ cpos = code.find(code_tag);
+
+ if (cpos == -1) {
+ vertex_code1 = code.ascii();
+ } else {
+ vertex_code1 = code.substr(0, cpos).ascii();
+ vertex_code2 = code.substr(cpos + code_tag.length(), code.length()).ascii();
+ }
+ }
+ }
+
+ {
+ String globals_tag = "\nFRAGMENT_SHADER_GLOBALS";
+ String code_tag = "\nFRAGMENT_SHADER_CODE";
+ String light_code_tag = "\nLIGHT_SHADER_CODE";
+ String code = fragment_code;
+ int cpos = code.find(globals_tag);
+ if (cpos == -1) {
+ fragment_code0 = code.ascii();
+ } else {
+ fragment_code0 = code.substr(0, cpos).ascii();
+ code = code.substr(cpos + globals_tag.length(), code.length());
+
+ cpos = code.find(code_tag);
+
+ if (cpos == -1) {
+ fragment_code1 = code.ascii();
+ } else {
+
+ fragment_code1 = code.substr(0, cpos).ascii();
+ String code2 = code.substr(cpos + code_tag.length(), code.length());
+
+ cpos = code2.find(light_code_tag);
+ if (cpos == -1) {
+ fragment_code2 = code2.ascii();
+ } else {
+ fragment_code2 = code2.substr(0, cpos).ascii();
+ fragment_code3 = code2.substr(cpos + light_code_tag.length(), code2.length()).ascii();
+ }
+ }
+ }
+ }
+}
+
+void ShaderGLES2::finish() {
+ const VersionKey *V = NULL;
+
+ while ((V = version_map.next(V))) {
+ Version &v = version_map[*V];
+ glDeleteShader(v.vert_id);
+ glDeleteShader(v.frag_id);
+ glDeleteProgram(v.id);
+ memdelete_arr(v.uniform_location);
+ }
+}
+
+void ShaderGLES2::clear_caches() {
+ const VersionKey *V = NULL;
+
+ while ((V = version_map.next(V))) {
+ Version &v = version_map[*V];
+ glDeleteShader(v.vert_id);
+ glDeleteShader(v.frag_id);
+ glDeleteProgram(v.id);
+ memdelete_arr(v.uniform_location);
+ }
+
+ version_map.clear();
+
+ custom_code_map.clear();
+ version = NULL;
+ last_custom_code = 1;
+ uniforms_dirty = true;
+}
+
+uint32_t ShaderGLES2::create_custom_shader() {
+ custom_code_map[last_custom_code] = CustomCode();
+ custom_code_map[last_custom_code].version = 1;
+ return last_custom_code++;
+}
+
+void ShaderGLES2::set_custom_shader_code(uint32_t p_code_id,
+ const String &p_vertex,
+ const String &p_vertex_globals,
+ const String &p_fragment,
+ const String &p_light,
+ const String &p_fragment_globals,
+ const Vector<StringName> &p_uniforms,
+ const Vector<StringName> &p_texture_uniforms,
+ const Vector<CharString> &p_custom_defines) {
+ CustomCode *cc = custom_code_map.getptr(p_code_id);
+ ERR_FAIL_COND(!cc);
+
+ cc->vertex = p_vertex;
+ cc->vertex_globals = p_vertex_globals;
+ cc->fragment = p_fragment;
+ cc->fragment_globals = p_fragment_globals;
+ cc->light = p_light;
+ cc->custom_uniforms = p_uniforms;
+ cc->custom_defines = p_custom_defines;
+ cc->version++;
+}
+
+void ShaderGLES2::set_custom_shader(uint32_t p_code_id) {
+ new_conditional_version.code_version = p_code_id;
+}
+
+void ShaderGLES2::free_custom_shader(uint32_t p_code_id) {
+ ERR_FAIL_COND(!custom_code_map.has(p_code_id));
+ if (conditional_version.code_version == p_code_id)
+ conditional_version.code_version = 0;
+
+ custom_code_map.erase(p_code_id);
+}
+
+void ShaderGLES2::set_base_material_tex_index(int p_idx) {
+}
+
+ShaderGLES2::ShaderGLES2() {
+ version = NULL;
+ last_custom_code = 1;
+ uniforms_dirty = true;
+}
+
+ShaderGLES2::~ShaderGLES2() {
+ finish();
+}
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
new file mode 100644
index 0000000000..c3635bc201
--- /dev/null
+++ b/drivers/gles2/shader_gles2.h
@@ -0,0 +1,386 @@
+/*************************************************************************/
+/* shader_gles2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef SHADER_GLES2_H
+#define SHADER_GLES2_H
+
+#include <stdio.h>
+
+#include "platform_config.h"
+#ifndef GLES2_INCLUDE_H
+#include <GLES2/gl2.h>
+#else
+#include GLES2_INCLUDE_H
+#endif
+
+#include "camera_matrix.h"
+#include "hash_map.h"
+#include "map.h"
+#include "variant.h"
+
+class ShaderGLES2 {
+protected:
+ struct Enum {
+
+ uint64_t mask;
+ uint64_t shift;
+ const char *defines[16];
+ };
+
+ struct EnumValue {
+
+ uint64_t set_mask;
+ uint64_t clear_mask;
+ };
+
+ struct AttributePair {
+
+ const char *name;
+ int index;
+ };
+
+ struct UniformPair {
+ const char *name;
+ Variant::Type type_hint;
+ };
+
+ struct TexUnitPair {
+
+ const char *name;
+ int index;
+ };
+
+ bool uniforms_dirty;
+
+private:
+ //@TODO Optimize to a fixed set of shader pools and use a LRU
+ int uniform_count;
+ int texunit_pair_count;
+ int conditional_count;
+ int vertex_code_start;
+ int fragment_code_start;
+ int attribute_pair_count;
+
+ struct CustomCode {
+
+ String vertex;
+ String vertex_globals;
+ String fragment;
+ String fragment_globals;
+ String light;
+ uint32_t version;
+ Vector<StringName> texture_uniforms;
+ Vector<StringName> custom_uniforms;
+ Vector<CharString> custom_defines;
+ };
+
+ struct Version {
+
+ GLuint id;
+ GLuint vert_id;
+ GLuint frag_id;
+ GLint *uniform_location;
+ Vector<GLint> texture_uniform_locations;
+ Vector<GLint> custom_uniform_locations;
+ uint32_t code_version;
+ bool ok;
+ Version() {
+ code_version = 0;
+ ok = false;
+ uniform_location = NULL;
+ }
+ };
+
+ Version *version;
+
+ union VersionKey {
+
+ struct {
+ uint32_t version;
+ uint32_t code_version;
+ };
+ uint64_t key;
+ bool operator==(const VersionKey &p_key) const { return key == p_key.key; }
+ bool operator<(const VersionKey &p_key) const { return key < p_key.key; }
+ };
+
+ struct VersionKeyHash {
+
+ static _FORCE_INLINE_ uint32_t hash(const VersionKey &p_key) { return HashMapHasherDefault::hash(p_key.key); }
+ };
+
+ //this should use a way more cachefriendly version..
+ HashMap<VersionKey, Version, VersionKeyHash> version_map;
+
+ HashMap<uint32_t, CustomCode> custom_code_map;
+ uint32_t last_custom_code;
+
+ VersionKey conditional_version;
+ VersionKey new_conditional_version;
+
+ virtual String get_shader_name() const = 0;
+
+ const char **conditional_defines;
+ const char **uniform_names;
+ const AttributePair *attribute_pairs;
+ const TexUnitPair *texunit_pairs;
+ const char *vertex_code;
+ const char *fragment_code;
+ CharString fragment_code0;
+ CharString fragment_code1;
+ CharString fragment_code2;
+ CharString fragment_code3;
+
+ CharString vertex_code0;
+ CharString vertex_code1;
+ CharString vertex_code2;
+
+ Vector<CharString> custom_defines;
+
+ Version *get_current_version();
+
+ static ShaderGLES2 *active;
+
+ int max_image_units;
+
+ _FORCE_INLINE_ void _set_uniform_variant(GLint p_uniform, const Variant &p_value) {
+
+ if (p_uniform < 0)
+ return; // do none
+ switch (p_value.get_type()) {
+
+ case Variant::BOOL:
+ case Variant::INT: {
+
+ int val = p_value;
+ glUniform1i(p_uniform, val);
+ } break;
+ case Variant::REAL: {
+
+ real_t val = p_value;
+ glUniform1f(p_uniform, val);
+ } break;
+ case Variant::COLOR: {
+
+ Color val = p_value;
+ glUniform4f(p_uniform, val.r, val.g, val.b, val.a);
+ } break;
+ case Variant::VECTOR2: {
+
+ Vector2 val = p_value;
+ glUniform2f(p_uniform, val.x, val.y);
+ } break;
+ case Variant::VECTOR3: {
+
+ Vector3 val = p_value;
+ glUniform3f(p_uniform, val.x, val.y, val.z);
+ } break;
+ case Variant::PLANE: {
+
+ Plane val = p_value;
+ glUniform4f(p_uniform, val.normal.x, val.normal.y, val.normal.z, val.d);
+ } break;
+ case Variant::QUAT: {
+
+ Quat val = p_value;
+ glUniform4f(p_uniform, val.x, val.y, val.z, val.w);
+ } break;
+
+ case Variant::TRANSFORM2D: {
+
+ Transform2D tr = p_value;
+ GLfloat matrix[16] = { /* build a 16x16 matrix */
+ tr.elements[0][0],
+ tr.elements[0][1],
+ 0,
+ 0,
+ tr.elements[1][0],
+ tr.elements[1][1],
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ tr.elements[2][0],
+ tr.elements[2][1],
+ 0,
+ 1
+ };
+
+ glUniformMatrix4fv(p_uniform, 1, false, matrix);
+
+ } break;
+ case Variant::BASIS:
+ case Variant::TRANSFORM: {
+
+ Transform tr = p_value;
+ GLfloat matrix[16] = { /* build a 16x16 matrix */
+ tr.basis.elements[0][0],
+ tr.basis.elements[1][0],
+ tr.basis.elements[2][0],
+ 0,
+ tr.basis.elements[0][1],
+ tr.basis.elements[1][1],
+ tr.basis.elements[2][1],
+ 0,
+ tr.basis.elements[0][2],
+ tr.basis.elements[1][2],
+ tr.basis.elements[2][2],
+ 0,
+ tr.origin.x,
+ tr.origin.y,
+ tr.origin.z,
+ 1
+ };
+
+ glUniformMatrix4fv(p_uniform, 1, false, matrix);
+ } break;
+ default: { ERR_FAIL(); } // do nothing
+ }
+ }
+
+ Map<uint32_t, Variant> uniform_defaults;
+ Map<uint32_t, CameraMatrix> uniform_cameras;
+
+protected:
+ _FORCE_INLINE_ int _get_uniform(int p_which) const;
+ _FORCE_INLINE_ void _set_conditional(int p_which, bool p_value);
+
+ void setup(const char **p_conditional_defines,
+ int p_conditional_count,
+ const char **p_uniform_names,
+ int p_uniform_count,
+ const AttributePair *p_attribute_pairs,
+ int p_attribute_count,
+ const TexUnitPair *p_texunit_pairs,
+ int p_texunit_pair_count,
+ const char *p_vertex_code,
+ const char *p_fragment_code,
+ int p_vertex_code_start,
+ int p_fragment_code_start);
+
+ ShaderGLES2();
+
+public:
+ enum {
+ CUSTOM_SHADER_DISABLED = 0
+ };
+
+ GLint get_uniform_location(const String &p_name) const;
+ GLint get_uniform_location(int p_index) const;
+
+ static _FORCE_INLINE_ ShaderGLES2 *get_active() { return active; }
+ bool bind();
+ void unbind();
+ void bind_uniforms();
+
+ inline GLuint get_program() const { return version ? version->id : 0; }
+
+ void clear_caches();
+
+ uint32_t create_custom_shader();
+ void set_custom_shader_code(uint32_t p_code_id,
+ const String &p_vertex,
+ const String &p_vertex_globals,
+ const String &p_fragment,
+ const String &p_light,
+ const String &p_fragment_globals,
+ const Vector<StringName> &p_uniforms,
+ const Vector<StringName> &p_texture_uniforms,
+ const Vector<CharString> &p_custom_defines);
+
+ void set_custom_shader(uint32_t p_code_id);
+ void free_custom_shader(uint32_t p_code_id);
+
+ void set_uniform_default(int p_idx, const Variant &p_value) {
+
+ if (p_value.get_type() == Variant::NIL) {
+
+ uniform_defaults.erase(p_idx);
+ } else {
+
+ uniform_defaults[p_idx] = p_value;
+ }
+ uniforms_dirty = true;
+ }
+
+ uint32_t get_version() const { return new_conditional_version.version; }
+
+ void set_uniform_camera(int p_idx, const CameraMatrix &p_mat) {
+
+ uniform_cameras[p_idx] = p_mat;
+ uniforms_dirty = true;
+ }
+
+ _FORCE_INLINE_ void set_texture_uniform(int p_idx, const Variant &p_value) {
+
+ ERR_FAIL_COND(!version);
+ ERR_FAIL_INDEX(p_idx, version->texture_uniform_locations.size());
+ _set_uniform_variant(version->texture_uniform_locations[p_idx], p_value);
+ }
+
+ _FORCE_INLINE_ GLint get_texture_uniform_location(int p_idx) {
+
+ ERR_FAIL_COND_V(!version, -1);
+ ERR_FAIL_INDEX_V(p_idx, version->texture_uniform_locations.size(), -1);
+ return version->texture_uniform_locations[p_idx];
+ }
+
+ virtual void init() = 0;
+ void finish();
+
+ void set_base_material_tex_index(int p_idx);
+
+ void add_custom_define(const String &p_define) {
+ custom_defines.push_back(p_define.utf8());
+ }
+
+ virtual ~ShaderGLES2();
+};
+
+// called a lot, made inline
+
+int ShaderGLES2::_get_uniform(int p_which) const {
+
+ ERR_FAIL_INDEX_V(p_which, uniform_count, -1);
+ ERR_FAIL_COND_V(!version, -1);
+ return version->uniform_location[p_which];
+}
+
+void ShaderGLES2::_set_conditional(int p_which, bool p_value) {
+
+ ERR_FAIL_INDEX(p_which, conditional_count);
+ if (p_value)
+ new_conditional_version.version |= (1 << p_which);
+ else
+ new_conditional_version.version &= ~(1 << p_which);
+}
+
+#endif
diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub
new file mode 100644
index 0000000000..5de3e1ac90
--- /dev/null
+++ b/drivers/gles2/shaders/SCsub
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+Import('env')
+
+if 'GLES2_GLSL' in env['BUILDERS']:
+ env.GLES2_GLSL('copy.glsl');
+# env.GLES2_GLSL('resolve.glsl');
+ env.GLES2_GLSL('canvas.glsl');
+# env.GLES2_GLSL('canvas_shadow.glsl');
+ env.GLES2_GLSL('scene.glsl');
+# env.GLES2_GLSL('cubemap_filter.glsl');
+# env.GLES2_GLSL('cube_to_dp.glsl');
+# env.GLES2_GLSL('blend_shape.glsl');
+# env.GLES2_GLSL('screen_space_reflection.glsl');
+# env.GLES2_GLSL('effect_blur.glsl');
+# env.GLES2_GLSL('subsurf_scattering.glsl');
+# env.GLES2_GLSL('ssao.glsl');
+# env.GLES2_GLSL('ssao_minify.glsl');
+# env.GLES2_GLSL('ssao_blur.glsl');
+# env.GLES2_GLSL('exposure.glsl');
+# env.GLES2_GLSL('tonemap.glsl');
+# env.GLES2_GLSL('particles.glsl');
diff --git a/drivers/gles2/shaders/blend_shape.glsl b/drivers/gles2/shaders/blend_shape.glsl
new file mode 100644
index 0000000000..4e0d066823
--- /dev/null
+++ b/drivers/gles2/shaders/blend_shape.glsl
@@ -0,0 +1,197 @@
+[vertex]
+
+
+/*
+from VisualServer:
+
+ARRAY_VERTEX=0,
+ARRAY_NORMAL=1,
+ARRAY_TANGENT=2,
+ARRAY_COLOR=3,
+ARRAY_TEX_UV=4,
+ARRAY_TEX_UV2=5,
+ARRAY_BONES=6,
+ARRAY_WEIGHTS=7,
+ARRAY_INDEX=8,
+*/
+
+#ifdef USE_2D_VERTEX
+#define VFORMAT vec2
+#else
+#define VFORMAT vec3
+#endif
+
+/* INPUT ATTRIBS */
+
+layout(location=0) in highp VFORMAT vertex_attrib;
+layout(location=1) in vec3 normal_attrib;
+
+#ifdef ENABLE_TANGENT
+layout(location=2) in vec4 tangent_attrib;
+#endif
+
+#ifdef ENABLE_COLOR
+layout(location=3) in vec4 color_attrib;
+#endif
+
+#ifdef ENABLE_UV
+layout(location=4) in vec2 uv_attrib;
+#endif
+
+#ifdef ENABLE_UV2
+layout(location=5) in vec2 uv2_attrib;
+#endif
+
+#ifdef ENABLE_SKELETON
+layout(location=6) in ivec4 bone_attrib;
+layout(location=7) in vec4 weight_attrib;
+#endif
+
+/* BLEND ATTRIBS */
+
+#ifdef ENABLE_BLEND
+
+layout(location=8) in highp VFORMAT vertex_attrib_blend;
+layout(location=9) in vec3 normal_attrib_blend;
+
+#ifdef ENABLE_TANGENT
+layout(location=10) in vec4 tangent_attrib_blend;
+#endif
+
+#ifdef ENABLE_COLOR
+layout(location=11) in vec4 color_attrib_blend;
+#endif
+
+#ifdef ENABLE_UV
+layout(location=12) in vec2 uv_attrib_blend;
+#endif
+
+#ifdef ENABLE_UV2
+layout(location=13) in vec2 uv2_attrib_blend;
+#endif
+
+#ifdef ENABLE_SKELETON
+layout(location=14) in ivec4 bone_attrib_blend;
+layout(location=15) in vec4 weight_attrib_blend;
+#endif
+
+#endif
+
+/* OUTPUTS */
+
+out VFORMAT vertex_out; //tfb:
+
+#ifdef ENABLE_NORMAL
+out vec3 normal_out; //tfb:ENABLE_NORMAL
+#endif
+
+#ifdef ENABLE_TANGENT
+out vec4 tangent_out; //tfb:ENABLE_TANGENT
+#endif
+
+#ifdef ENABLE_COLOR
+out vec4 color_out; //tfb:ENABLE_COLOR
+#endif
+
+#ifdef ENABLE_UV
+out vec2 uv_out; //tfb:ENABLE_UV
+#endif
+
+#ifdef ENABLE_UV2
+out vec2 uv2_out; //tfb:ENABLE_UV2
+#endif
+
+#ifdef ENABLE_SKELETON
+out ivec4 bone_out; //tfb:ENABLE_SKELETON
+out vec4 weight_out; //tfb:ENABLE_SKELETON
+#endif
+
+uniform float blend_amount;
+
+void main() {
+
+
+#ifdef ENABLE_BLEND
+
+ vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount;
+
+#ifdef ENABLE_NORMAL
+ normal_out = normal_attrib_blend + normal_attrib * blend_amount;
+#endif
+
+#ifdef ENABLE_TANGENT
+
+ tangent_out.xyz = tangent_attrib_blend.xyz + tangent_attrib.xyz * blend_amount;
+ tangent_out.w = tangent_attrib_blend.w; //just copy, no point in blending his
+#endif
+
+#ifdef ENABLE_COLOR
+
+ color_out = color_attrib_blend + color_attrib * blend_amount;
+#endif
+
+#ifdef ENABLE_UV
+
+ uv_out = uv_attrib_blend + uv_attrib * blend_amount;
+#endif
+
+#ifdef ENABLE_UV2
+
+ uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount;
+#endif
+
+
+#ifdef ENABLE_SKELETON
+
+ bone_out = bone_attrib_blend;
+ weight_out = weight_attrib_blend + weight_attrib * blend_amount;
+#endif
+
+#else //ENABLE_BLEND
+
+
+ vertex_out = vertex_attrib * blend_amount;
+
+#ifdef ENABLE_NORMAL
+ normal_out = normal_attrib * blend_amount;
+#endif
+
+#ifdef ENABLE_TANGENT
+
+ tangent_out.xyz = tangent_attrib.xyz * blend_amount;
+ tangent_out.w = tangent_attrib.w; //just copy, no point in blending his
+#endif
+
+#ifdef ENABLE_COLOR
+
+ color_out = color_attrib * blend_amount;
+#endif
+
+#ifdef ENABLE_UV
+
+ uv_out = uv_attrib * blend_amount;
+#endif
+
+#ifdef ENABLE_UV2
+
+ uv2_out = uv2_attrib * blend_amount;
+#endif
+
+
+#ifdef ENABLE_SKELETON
+
+ bone_out = bone_attrib;
+ weight_out = weight_attrib * blend_amount;
+#endif
+
+#endif
+ gl_Position = vec4(0.0);
+}
+
+[fragment]
+
+
+void main() {
+
+}
+
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
new file mode 100644
index 0000000000..11c6ab9b76
--- /dev/null
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -0,0 +1,141 @@
+[vertex]
+
+#ifdef USE_GLES_OVER_GL
+#define mediump
+#define highp
+#else
+precision mediump float;
+precision mediump int;
+#endif
+
+uniform highp mat4 projection_matrix;
+uniform highp mat4 modelview_matrix;
+uniform highp mat4 extra_matrix;
+attribute highp vec2 vertex; // attrib:0
+attribute vec4 color_attrib; // attrib:3
+attribute vec2 uv_attrib; // attrib:4
+
+varying vec2 uv_interp;
+varying vec4 color_interp;
+
+uniform highp vec2 color_texpixel_size;
+
+#ifdef USE_TEXTURE_RECT
+
+uniform vec4 dst_rect;
+uniform vec4 src_rect;
+
+#endif
+
+uniform bool blit_pass;
+
+VERTEX_SHADER_GLOBALS
+
+vec2 select(vec2 a, vec2 b, bvec2 c) {
+ vec2 ret;
+
+ ret.x = c.x ? b.x : a.x;
+ ret.y = c.y ? b.y : a.y;
+
+ return ret;
+}
+
+void main() {
+
+ vec4 color = color_attrib;
+
+#ifdef USE_TEXTURE_RECT
+
+ if (dst_rect.z < 0.0) { // Transpose is encoded as negative dst_rect.z
+ uv_interp = src_rect.xy + abs(src_rect.zw) * vertex.yx;
+ } else {
+ uv_interp = src_rect.xy + abs(src_rect.zw) * vertex;
+ }
+
+ vec4 outvec = vec4(0.0, 0.0, 0.0, 1.0);
+
+ // This is what is done in the GLES 3 bindings and should
+ // take care of flipped rects.
+ //
+ // But it doesn't.
+ // I don't know why, will need to investigate further.
+
+ outvec.xy = dst_rect.xy + abs(dst_rect.zw) * select(vertex, vec2(1.0, 1.0) - vertex, lessThan(src_rect.zw, vec2(0.0, 0.0)));
+
+ // outvec.xy = dst_rect.xy + abs(dst_rect.zw) * vertex;
+#else
+ vec4 outvec = vec4(vertex.xy, 0.0, 1.0);
+
+#ifdef USE_UV_ATTRIBUTE
+ uv_interp = uv_attrib;
+#else
+ uv_interp = vertex.xy;
+#endif
+
+#endif
+
+{
+ vec2 src_vtx=outvec.xy;
+VERTEX_SHADER_CODE
+
+}
+
+ color_interp = color;
+
+ gl_Position = projection_matrix * modelview_matrix * outvec;
+
+}
+
+[fragment]
+
+#ifdef USE_GLES_OVER_GL
+#define mediump
+#define highp
+#else
+precision mediump float;
+precision mediump int;
+#endif
+
+uniform sampler2D color_texture; // texunit:0
+uniform highp vec2 color_texpixel_size;
+uniform mediump sampler2D normal_texture; // texunit:1
+
+varying mediump vec2 uv_interp;
+varying mediump vec4 color_interp;
+
+uniform bool blit_pass;
+
+uniform vec4 final_modulate;
+
+#ifdef SCREEN_TEXTURE_USED
+
+uniform sampler2D screen_texture; // texunit:2
+
+#endif
+
+#ifdef SCREEN_UV_USED
+
+uniform vec2 screen_pixel_size;
+
+#endif
+
+FRAGMENT_SHADER_GLOBALS
+
+
+void main() {
+
+ vec4 color = color_interp;
+
+ color *= texture2D(color_texture, uv_interp);
+{
+
+FRAGMENT_SHADER_CODE
+
+
+}
+
+ color *= final_modulate;
+
+ gl_FragColor = color;
+
+}
diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl
new file mode 100644
index 0000000000..c757990de0
--- /dev/null
+++ b/drivers/gles2/shaders/canvas_shadow.glsl
@@ -0,0 +1,49 @@
+[vertex]
+
+
+
+uniform highp mat4 projection_matrix;
+uniform highp mat4 light_matrix;
+uniform highp mat4 world_matrix;
+uniform highp float distance_norm;
+
+layout(location=0) in highp vec3 vertex;
+
+out highp vec4 position_interp;
+
+void main() {
+
+ gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0)));
+ position_interp=gl_Position;
+}
+
+[fragment]
+
+in highp vec4 position_interp;
+
+#ifdef USE_RGBA_SHADOWS
+
+layout(location=0) out lowp vec4 distance_buf;
+
+#else
+
+layout(location=0) out highp float distance_buf;
+
+#endif
+
+void main() {
+
+ highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias;
+
+#ifdef USE_RGBA_SHADOWS
+
+ highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
+ comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
+ distance_buf=comp;
+#else
+
+ distance_buf=depth;
+
+#endif
+}
+
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
new file mode 100644
index 0000000000..a21da68525
--- /dev/null
+++ b/drivers/gles2/shaders/copy.glsl
@@ -0,0 +1,72 @@
+[vertex]
+
+#ifdef USE_GLES_OVER_GL
+#define mediump
+#define highp
+#else
+precision mediump float;
+precision mediump int;
+#endif
+
+attribute highp vec4 vertex_attrib; // attrib:0
+attribute vec2 uv_in; // attrib:4
+attribute vec2 uv2_in; // attrib:5
+
+varying vec2 uv_interp;
+
+varying vec2 uv2_interp;
+
+#ifdef USE_COPY_SECTION
+uniform vec4 copy_section;
+#endif
+
+void main() {
+
+ uv_interp = uv_in;
+ uv2_interp = uv2_in;
+ gl_Position = vertex_attrib;
+
+#ifdef USE_COPY_SECTION
+ uv_interp = copy_section.xy + uv_interp * copy_section.zw;
+ gl_Position.xy = (copy_section.xy + (gl_Position.xy * 0.5 + 0.5) * copy_section.zw) * 2.0 - 1.0;
+#endif
+}
+
+[fragment]
+
+#ifdef USE_GLES_OVER_GL
+#define mediump
+#define highp
+#else
+precision mediump float;
+precision mediump int;
+#endif
+
+
+varying vec2 uv_interp;
+uniform sampler2D source; // texunit:0
+
+varying vec2 uv2_interp;
+
+#ifdef USE_CUSTOM_ALPHA
+uniform float custom_alpha;
+#endif
+
+
+void main() {
+
+ //vec4 color = color_interp;
+ vec4 color = texture2D( source, uv_interp );
+
+
+#ifdef USE_NO_ALPHA
+ color.a=1.0;
+#endif
+
+#ifdef USE_CUSTOM_ALPHA
+ color.a=custom_alpha;
+#endif
+
+
+ gl_FragColor = color;
+}
diff --git a/drivers/gles2/shaders/cube_to_dp.glsl b/drivers/gles2/shaders/cube_to_dp.glsl
new file mode 100644
index 0000000000..5ffc78c0b9
--- /dev/null
+++ b/drivers/gles2/shaders/cube_to_dp.glsl
@@ -0,0 +1,79 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+}
+
+[fragment]
+
+
+uniform highp samplerCube source_cube; //texunit:0
+in vec2 uv_interp;
+
+uniform bool z_flip;
+uniform highp float z_far;
+uniform highp float z_near;
+uniform highp float bias;
+
+void main() {
+
+ highp vec3 normal = vec3( uv_interp * 2.0 - 1.0, 0.0 );
+/*
+ if(z_flip) {
+ normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ } else {
+ normal.z = -0.5 + 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ }
+*/
+
+ //normal.z = sqrt(1.0-dot(normal.xy,normal.xy));
+ //normal.xy*=1.0+normal.z;
+
+ normal.z = 0.5 - 0.5*((normal.x * normal.x) + (normal.y * normal.y));
+ normal = normalize(normal);
+
+/*
+ normal.z=0.5;
+ normal=normalize(normal);
+*/
+ if (!z_flip) {
+ normal.z=-normal.z;
+ }
+
+ //normal = normalize(vec3( uv_interp * 2.0 - 1.0, 1.0 ));
+ float depth = texture(source_cube,normal).r;
+
+ // absolute values for direction cosines, bigger value equals closer to basis axis
+ vec3 unorm = abs(normal);
+
+ if ( (unorm.x >= unorm.y) && (unorm.x >= unorm.z) ) {
+ // x code
+ unorm = normal.x > 0.0 ? vec3( 1.0, 0.0, 0.0 ) : vec3( -1.0, 0.0, 0.0 ) ;
+ } else if ( (unorm.y > unorm.x) && (unorm.y >= unorm.z) ) {
+ // y code
+ unorm = normal.y > 0.0 ? vec3( 0.0, 1.0, 0.0 ) : vec3( 0.0, -1.0, 0.0 ) ;
+ } else if ( (unorm.z > unorm.x) && (unorm.z > unorm.y) ) {
+ // z code
+ unorm = normal.z > 0.0 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 0.0, 0.0, -1.0 ) ;
+ } else {
+ // oh-no we messed up code
+ // has to be
+ unorm = vec3( 1.0, 0.0, 0.0 );
+ }
+
+ float depth_fix = 1.0 / dot(normal,unorm);
+
+
+ depth = 2.0 * depth - 1.0;
+ float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near));
+ gl_FragDepth = (linear_depth*depth_fix+bias) / z_far;
+}
+
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
new file mode 100644
index 0000000000..485fbb6ee0
--- /dev/null
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -0,0 +1,294 @@
+[vertex]
+
+
+layout(location=0) in highp vec2 vertex;
+
+layout(location=4) in highp vec2 uv;
+
+out highp vec2 uv_interp;
+
+void main() {
+
+ uv_interp=uv;
+ gl_Position=vec4(vertex,0,1);
+}
+
+[fragment]
+
+
+precision highp float;
+precision highp int;
+
+#ifdef USE_SOURCE_PANORAMA
+uniform sampler2D source_panorama; //texunit:0
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+uniform sampler2DArray source_dual_paraboloid_array; //texunit:0
+uniform int source_array_index;
+#endif
+
+#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
+uniform samplerCube source_cube; //texunit:0
+#endif
+
+uniform int face_id;
+uniform float roughness;
+in highp vec2 uv_interp;
+
+
+layout(location = 0) out vec4 frag_color;
+
+
+#define M_PI 3.14159265359
+
+
+vec3 texelCoordToVec(vec2 uv, int faceID)
+{
+ mat3 faceUvVectors[6];
+/*
+ // -x
+ faceUvVectors[1][0] = vec3(0.0, 0.0, 1.0); // u -> +z
+ faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[1][2] = vec3(-1.0, 0.0, 0.0); // -x face
+
+ // +x
+ faceUvVectors[0][0] = vec3(0.0, 0.0, -1.0); // u -> -z
+ faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[0][2] = vec3(1.0, 0.0, 0.0); // +x face
+
+ // -y
+ faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[3][1] = vec3(0.0, 0.0, -1.0); // v -> -z
+ faceUvVectors[3][2] = vec3(0.0, -1.0, 0.0); // -y face
+
+ // +y
+ faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[2][1] = vec3(0.0, 0.0, 1.0); // v -> +z
+ faceUvVectors[2][2] = vec3(0.0, 1.0, 0.0); // +y face
+
+ // -z
+ faceUvVectors[5][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
+ faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[5][2] = vec3(0.0, 0.0, -1.0); // -z face
+
+ // +z
+ faceUvVectors[4][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[4][2] = vec3(0.0, 0.0, 1.0); // +z face
+*/
+
+ // -x
+ faceUvVectors[0][0] = vec3(0.0, 0.0, 1.0); // u -> +z
+ faceUvVectors[0][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[0][2] = vec3(-1.0, 0.0, 0.0); // -x face
+
+ // +x
+ faceUvVectors[1][0] = vec3(0.0, 0.0, -1.0); // u -> -z
+ faceUvVectors[1][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[1][2] = vec3(1.0, 0.0, 0.0); // +x face
+
+ // -y
+ faceUvVectors[2][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[2][1] = vec3(0.0, 0.0, -1.0); // v -> -z
+ faceUvVectors[2][2] = vec3(0.0, -1.0, 0.0); // -y face
+
+ // +y
+ faceUvVectors[3][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[3][1] = vec3(0.0, 0.0, 1.0); // v -> +z
+ faceUvVectors[3][2] = vec3(0.0, 1.0, 0.0); // +y face
+
+ // -z
+ faceUvVectors[4][0] = vec3(-1.0, 0.0, 0.0); // u -> -x
+ faceUvVectors[4][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[4][2] = vec3(0.0, 0.0, -1.0); // -z face
+
+ // +z
+ faceUvVectors[5][0] = vec3(1.0, 0.0, 0.0); // u -> +x
+ faceUvVectors[5][1] = vec3(0.0, -1.0, 0.0); // v -> -y
+ faceUvVectors[5][2] = vec3(0.0, 0.0, 1.0); // +z face
+
+ // out = u * s_faceUv[0] + v * s_faceUv[1] + s_faceUv[2].
+ vec3 result = (faceUvVectors[faceID][0] * uv.x) + (faceUvVectors[faceID][1] * uv.y) + faceUvVectors[faceID][2];
+ return normalize(result);
+}
+
+vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N)
+{
+ float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph]
+
+ // Compute distribution direction
+ float Phi = 2.0 * M_PI * Xi.x;
+ float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));
+ float SinTheta = sqrt(1.0 - CosTheta * CosTheta);
+
+ // Convert to spherical direction
+ vec3 H;
+ H.x = SinTheta * cos(Phi);
+ H.y = SinTheta * sin(Phi);
+ H.z = CosTheta;
+
+ vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
+ vec3 TangentX = normalize(cross(UpVector, N));
+ vec3 TangentY = cross(N, TangentX);
+
+ // Tangent to world space
+ return TangentX * H.x + TangentY * H.y + N * H.z;
+}
+
+// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
+float GGX(float NdotV, float a)
+{
+ float k = a / 2.0;
+ return NdotV / (NdotV * (1.0 - k) + k);
+}
+
+// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
+float G_Smith(float a, float nDotV, float nDotL)
+{
+ return GGX(nDotL, a * a) * GGX(nDotV, a * a);
+}
+
+float radicalInverse_VdC(uint bits) {
+ bits = (bits << 16u) | (bits >> 16u);
+ bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
+ bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
+ bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
+ bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
+ return float(bits) * 2.3283064365386963e-10; // / 0x100000000
+}
+
+vec2 Hammersley(uint i, uint N) {
+ return vec2(float(i)/float(N), radicalInverse_VdC(i));
+}
+
+
+
+#ifdef LOW_QUALITY
+
+#define SAMPLE_COUNT 64u
+
+#else
+
+#define SAMPLE_COUNT 512u
+
+#endif
+
+uniform bool z_flip;
+
+#ifdef USE_SOURCE_PANORAMA
+
+vec4 texturePanorama(vec3 normal,sampler2D pano ) {
+
+ vec2 st = vec2(
+ atan(normal.x, normal.z),
+ acos(normal.y)
+ );
+
+ if(st.x < 0.0)
+ st.x += M_PI*2.0;
+
+ st/=vec2(M_PI*2.0,M_PI);
+
+ return textureLod(pano,st,0.0);
+
+}
+
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+
+
+vec4 textureDualParaboloidArray(vec3 normal) {
+
+ vec3 norm = normalize(normal);
+ norm.xy/=1.0+abs(norm.z);
+ norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
+ if (norm.z<0.0) {
+ norm.y=0.5-norm.y+0.5;
+ }
+ return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index) ), 0.0);
+
+}
+
+#endif
+
+void main() {
+
+#ifdef USE_DUAL_PARABOLOID
+
+ vec3 N = vec3( uv_interp * 2.0 - 1.0, 0.0 );
+ N.z = 0.5 - 0.5*((N.x * N.x) + (N.y * N.y));
+ N = normalize(N);
+
+ if (z_flip) {
+ N.y=-N.y; //y is flipped to improve blending between both sides
+ N.z=-N.z;
+ }
+
+
+#else
+ vec2 uv = (uv_interp * 2.0) - 1.0;
+ vec3 N = texelCoordToVec(uv, face_id);
+#endif
+ //vec4 color = color_interp;
+
+#ifdef USE_DIRECT_WRITE
+
+#ifdef USE_SOURCE_PANORAMA
+
+ frag_color=vec4(texturePanorama(N,source_panorama).rgb,1.0);
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+
+ frag_color=vec4(textureDualParaboloidArray(N).rgb,1.0);
+#endif
+
+#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
+
+ N.y=-N.y;
+ frag_color=vec4(texture(N,source_cube).rgb,1.0);
+#endif
+
+
+
+
+#else
+
+ vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);
+
+ for(uint sampleNum = 0u; sampleNum < SAMPLE_COUNT; sampleNum++) {
+ vec2 xi = Hammersley(sampleNum, SAMPLE_COUNT);
+
+ vec3 H = ImportanceSampleGGX( xi, roughness, N );
+ vec3 V = N;
+ vec3 L = normalize(2.0 * dot( V, H ) * H - V);
+
+ float ndotl = clamp(dot(N, L),0.0,1.0);
+
+ if (ndotl>0.0) {
+#ifdef USE_SOURCE_PANORAMA
+ sum.rgb += texturePanorama(H,source_panorama).rgb *ndotl;
+#endif
+
+#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
+
+ sum.rgb += textureDualParaboloidArray(H).rgb *ndotl;
+#endif
+
+#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
+ H.y=-H.y;
+ sum.rgb += textureLod(source_cube, H, 0.0).rgb *ndotl;
+#endif
+ sum.a += ndotl;
+ }
+ }
+ sum /= sum.a;
+
+ frag_color = vec4(sum.rgb, 1.0);
+
+#endif
+
+}
+
diff --git a/drivers/gles2/shaders/effect_blur.glsl b/drivers/gles2/shaders/effect_blur.glsl
new file mode 100644
index 0000000000..b5f98a1244
--- /dev/null
+++ b/drivers/gles2/shaders/effect_blur.glsl
@@ -0,0 +1,301 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+
+#ifdef USE_BLUR_SECTION
+
+uniform vec4 blur_section;
+
+#endif
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+#ifdef USE_BLUR_SECTION
+
+ uv_interp = blur_section.xy + uv_interp * blur_section.zw;
+ gl_Position.xy = (blur_section.xy + (gl_Position.xy * 0.5 + 0.5) * blur_section.zw) * 2.0 - 1.0;
+#endif
+}
+
+[fragment]
+
+#if !defined(GLES_OVER_GL)
+precision mediump float;
+#endif
+
+in vec2 uv_interp;
+uniform sampler2D source_color; //texunit:0
+
+#ifdef SSAO_MERGE
+uniform sampler2D source_ssao; //texunit:1
+#endif
+
+uniform float lod;
+uniform vec2 pixel_size;
+
+
+layout(location = 0) out vec4 frag_color;
+
+#ifdef SSAO_MERGE
+
+uniform vec4 ssao_color;
+
+#endif
+
+#if defined (GLOW_GAUSSIAN_HORIZONTAL) || defined(GLOW_GAUSSIAN_VERTICAL)
+
+uniform float glow_strength;
+
+#endif
+
+#if defined(DOF_FAR_BLUR) || defined (DOF_NEAR_BLUR)
+
+#ifdef DOF_QUALITY_LOW
+const int dof_kernel_size=5;
+const int dof_kernel_from=2;
+const float dof_kernel[5] = float[] (0.153388,0.221461,0.250301,0.221461,0.153388);
+#endif
+
+#ifdef DOF_QUALITY_MEDIUM
+const int dof_kernel_size=11;
+const int dof_kernel_from=5;
+const float dof_kernel[11] = float[] (0.055037,0.072806,0.090506,0.105726,0.116061,0.119726,0.116061,0.105726,0.090506,0.072806,0.055037);
+
+#endif
+
+#ifdef DOF_QUALITY_HIGH
+const int dof_kernel_size=21;
+const int dof_kernel_from=10;
+const float dof_kernel[21] = float[] (0.028174,0.032676,0.037311,0.041944,0.046421,0.050582,0.054261,0.057307,0.059587,0.060998,0.061476,0.060998,0.059587,0.057307,0.054261,0.050582,0.046421,0.041944,0.037311,0.032676,0.028174);
+#endif
+
+uniform sampler2D dof_source_depth; //texunit:1
+uniform float dof_begin;
+uniform float dof_end;
+uniform vec2 dof_dir;
+uniform float dof_radius;
+
+#ifdef DOF_NEAR_BLUR_MERGE
+
+uniform sampler2D source_dof_original; //texunit:2
+#endif
+
+#endif
+
+
+#ifdef GLOW_FIRST_PASS
+
+uniform float exposure;
+uniform float white;
+
+#ifdef GLOW_USE_AUTO_EXPOSURE
+
+uniform highp sampler2D source_auto_exposure; //texunit:1
+uniform highp float auto_exposure_grey;
+
+#endif
+
+uniform float glow_bloom;
+uniform float glow_hdr_threshold;
+uniform float glow_hdr_scale;
+
+#endif
+
+uniform float camera_z_far;
+uniform float camera_z_near;
+
+void main() {
+
+
+
+#ifdef GAUSSIAN_HORIZONTAL
+ vec2 pix_size = pixel_size;
+ pix_size*=0.5; //reading from larger buffer, so use more samples
+ vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.214607;
+ color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.189879;
+ color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.157305;
+ color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.071303;
+ color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.189879;
+ color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.157305;
+ color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.071303;
+ frag_color = color;
+#endif
+
+#ifdef GAUSSIAN_VERTICAL
+ vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pixel_size,lod )*0.38774;
+ color+=textureLod( source_color, uv_interp+vec2( 0.0, 1.0)*pixel_size,lod )*0.24477;
+ color+=textureLod( source_color, uv_interp+vec2( 0.0, 2.0)*pixel_size,lod )*0.06136;
+ color+=textureLod( source_color, uv_interp+vec2( 0.0,-1.0)*pixel_size,lod )*0.24477;
+ color+=textureLod( source_color, uv_interp+vec2( 0.0,-2.0)*pixel_size,lod )*0.06136;
+ frag_color = color;
+#endif
+
+//glow uses larger sigma for a more rounded blur effect
+
+#ifdef GLOW_GAUSSIAN_HORIZONTAL
+ vec2 pix_size = pixel_size;
+ pix_size*=0.5; //reading from larger buffer, so use more samples
+ vec4 color =textureLod( source_color, uv_interp+vec2( 0.0, 0.0)*pix_size,lod )*0.174938;
+ color+=textureLod( source_color, uv_interp+vec2( 1.0, 0.0)*pix_size,lod )*0.165569;
+ color+=textureLod( source_color, uv_interp+vec2( 2.0, 0.0)*pix_size,lod )*0.140367;
+ color+=textureLod( source_color, uv_interp+vec2( 3.0, 0.0)*pix_size,lod )*0.106595;
+ color+=textureLod( source_color, uv_interp+vec2(-1.0, 0.0)*pix_size,lod )*0.165569;
+ color+=textureLod( source_color, uv_interp+vec2(-2.0, 0.0)*pix_size,lod )*0.140367;
+ color+=textureLod( source_color, uv_interp+vec2(-3.0, 0.0)*pix_size,lod )*0.106595;
+ color*=glow_strength;
+ frag_color = color;
+#endif
+
+#ifdef GLOW_GAUSSIAN_VERTICAL
+ vec4 color =textureLod( source_color, uv_interp+vec2(0.0, 0.0)*pixel_size,lod )*0.288713;
+ color+=textureLod( source_color, uv_interp+vec2(0.0, 1.0)*pixel_size,lod )*0.233062;
+ color+=textureLod( source_color, uv_interp+vec2(0.0, 2.0)*pixel_size,lod )*0.122581;
+ color+=textureLod( source_color, uv_interp+vec2(0.0,-1.0)*pixel_size,lod )*0.233062;
+ color+=textureLod( source_color, uv_interp+vec2(0.0,-2.0)*pixel_size,lod )*0.122581;
+ color*=glow_strength;
+ frag_color = color;
+#endif
+
+#ifdef DOF_FAR_BLUR
+
+ vec4 color_accum = vec4(0.0);
+
+ float depth = textureLod( dof_source_depth, uv_interp, 0.0).r;
+ depth = depth * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
+#endif
+
+ float amount = smoothstep(dof_begin,dof_end,depth);
+ float k_accum=0.0;
+
+ for(int i=0;i<dof_kernel_size;i++) {
+
+ int int_ofs = i-dof_kernel_from;
+ vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * amount * dof_radius;
+
+ float tap_k = dof_kernel[i];
+
+ float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r;
+ tap_depth = tap_depth * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near));
+#endif
+ float tap_amount = mix(smoothstep(dof_begin,dof_end,tap_depth),1.0,int_ofs==0);
+ tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect
+
+ vec4 tap_color = textureLod( source_color, tap_uv, 0.0) * tap_k;
+
+ k_accum+=tap_k*tap_amount;
+ color_accum+=tap_color*tap_amount;
+
+
+ }
+
+ if (k_accum>0.0) {
+ color_accum/=k_accum;
+ }
+
+ frag_color = color_accum;///k_accum;
+
+#endif
+
+#ifdef DOF_NEAR_BLUR
+
+ vec4 color_accum = vec4(0.0);
+
+ float max_accum=0;
+
+ for(int i=0;i<dof_kernel_size;i++) {
+
+ int int_ofs = i-dof_kernel_from;
+ vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * dof_radius;
+ float ofs_influence = max(0.0,1.0-float(abs(int_ofs))/float(dof_kernel_from));
+
+ float tap_k = dof_kernel[i];
+
+ vec4 tap_color = textureLod( source_color, tap_uv, 0.0);
+
+ float tap_depth = texture( dof_source_depth, tap_uv, 0.0).r;
+ tap_depth = tap_depth * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ tap_depth = ((tap_depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ tap_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - tap_depth * (camera_z_far - camera_z_near));
+#endif
+ float tap_amount = 1.0-smoothstep(dof_end,dof_begin,tap_depth);
+ tap_amount*=tap_amount*tap_amount; //prevent undesired glow effect
+
+#ifdef DOF_NEAR_FIRST_TAP
+
+ tap_color.a= 1.0-smoothstep(dof_end,dof_begin,tap_depth);
+
+#endif
+
+ max_accum=max(max_accum,tap_amount*ofs_influence);
+
+ color_accum+=tap_color*tap_k;
+
+ }
+
+ color_accum.a=max(color_accum.a,sqrt(max_accum));
+
+
+#ifdef DOF_NEAR_BLUR_MERGE
+
+ vec4 original = textureLod( source_dof_original, uv_interp, 0.0);
+ color_accum = mix(original,color_accum,color_accum.a);
+
+#endif
+
+#ifndef DOF_NEAR_FIRST_TAP
+ //color_accum=vec4(vec3(color_accum.a),1.0);
+#endif
+ frag_color = color_accum;
+
+#endif
+
+
+
+#ifdef GLOW_FIRST_PASS
+
+#ifdef GLOW_USE_AUTO_EXPOSURE
+
+ frag_color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey;
+#endif
+ frag_color*=exposure;
+
+ float luminance = max(frag_color.r,max(frag_color.g,frag_color.b));
+ float feedback = max( smoothstep(glow_hdr_threshold,glow_hdr_threshold+glow_hdr_scale,luminance), glow_bloom );
+
+ frag_color *= feedback;
+
+#endif
+
+
+#ifdef SIMPLE_COPY
+ vec4 color =textureLod( source_color, uv_interp,0.0);
+ frag_color = color;
+#endif
+
+#ifdef SSAO_MERGE
+
+ vec4 color =textureLod( source_color, uv_interp,0.0);
+ float ssao =textureLod( source_ssao, uv_interp,0.0).r;
+
+ frag_color = vec4( mix(color.rgb,color.rgb*mix(ssao_color.rgb,vec3(1.0),ssao),color.a), 1.0 );
+
+#endif
+
+
+}
diff --git a/drivers/gles2/shaders/exposure.glsl b/drivers/gles2/shaders/exposure.glsl
new file mode 100644
index 0000000000..001b90a0f1
--- /dev/null
+++ b/drivers/gles2/shaders/exposure.glsl
@@ -0,0 +1,98 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+
+
+void main() {
+
+ gl_Position = vertex_attrib;
+
+}
+
+[fragment]
+
+
+uniform highp sampler2D source_exposure; //texunit:0
+
+#ifdef EXPOSURE_BEGIN
+
+uniform highp ivec2 source_render_size;
+uniform highp ivec2 target_size;
+
+#endif
+
+#ifdef EXPOSURE_END
+
+uniform highp sampler2D prev_exposure; //texunit:1
+uniform highp float exposure_adjust;
+uniform highp float min_luminance;
+uniform highp float max_luminance;
+
+#endif
+
+layout(location = 0) out highp float exposure;
+
+
+
+void main() {
+
+
+
+#ifdef EXPOSURE_BEGIN
+
+
+ ivec2 src_pos = ivec2(gl_FragCoord.xy)*source_render_size/target_size;
+
+#if 1
+ //more precise and expensive, but less jittery
+ ivec2 next_pos = ivec2(gl_FragCoord.xy+ivec2(1))*source_render_size/target_size;
+ next_pos = max(next_pos,src_pos+ivec2(1)); //so it at least reads one pixel
+ highp vec3 source_color=vec3(0.0);
+ for(int i=src_pos.x;i<next_pos.x;i++) {
+ for(int j=src_pos.y;j<next_pos.y;j++) {
+ source_color += texelFetch(source_exposure,ivec2(i,j),0).rgb;
+ }
+ }
+
+ source_color/=float( (next_pos.x-src_pos.x)*(next_pos.y-src_pos.y) );
+#else
+ highp vec3 source_color = texelFetch(source_exposure,src_pos,0).rgb;
+
+#endif
+
+ exposure = max(source_color.r,max(source_color.g,source_color.b));
+
+#else
+
+ ivec2 coord = ivec2(gl_FragCoord.xy);
+ exposure = texelFetch(source_exposure,coord*3+ivec2(0,0),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(1,0),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(2,0),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(0,1),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(1,1),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(2,1),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(0,2),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(1,2),0).r;
+ exposure += texelFetch(source_exposure,coord*3+ivec2(2,2),0).r;
+ exposure *= (1.0/9.0);
+
+#ifdef EXPOSURE_END
+
+#ifdef EXPOSURE_FORCE_SET
+ //will stay as is
+#else
+ highp float prev_lum = texelFetch(prev_exposure,ivec2(0,0),0).r; //1 pixel previous exposure
+ exposure = clamp( prev_lum + (exposure-prev_lum)*exposure_adjust,min_luminance,max_luminance);
+
+#endif //EXPOSURE_FORCE_SET
+
+
+#endif //EXPOSURE_END
+
+#endif //EXPOSURE_BEGIN
+
+
+}
+
+
diff --git a/drivers/gles2/shaders/particles.glsl b/drivers/gles2/shaders/particles.glsl
new file mode 100644
index 0000000000..a62c124dfe
--- /dev/null
+++ b/drivers/gles2/shaders/particles.glsl
@@ -0,0 +1,260 @@
+[vertex]
+
+
+
+layout(location=0) in highp vec4 color;
+layout(location=1) in highp vec4 velocity_active;
+layout(location=2) in highp vec4 custom;
+layout(location=3) in highp vec4 xform_1;
+layout(location=4) in highp vec4 xform_2;
+layout(location=5) in highp vec4 xform_3;
+
+
+struct Attractor {
+
+ vec3 pos;
+ vec3 dir;
+ float radius;
+ float eat_radius;
+ float strength;
+ float attenuation;
+};
+
+#define MAX_ATTRACTORS 64
+
+uniform bool emitting;
+uniform float system_phase;
+uniform float prev_system_phase;
+uniform int total_particles;
+uniform float explosiveness;
+uniform float randomness;
+uniform float time;
+uniform float delta;
+
+uniform int attractor_count;
+uniform Attractor attractors[MAX_ATTRACTORS];
+uniform bool clear;
+uniform uint cycle;
+uniform float lifetime;
+uniform mat4 emission_transform;
+uniform uint random_seed;
+
+
+out highp vec4 out_color; //tfb:
+out highp vec4 out_velocity_active; //tfb:
+out highp vec4 out_custom; //tfb:
+out highp vec4 out_xform_1; //tfb:
+out highp vec4 out_xform_2; //tfb:
+out highp vec4 out_xform_3; //tfb:
+
+
+#if defined(USE_MATERIAL)
+
+layout(std140) uniform UniformData { //ubo:0
+
+MATERIAL_UNIFORMS
+
+};
+
+#endif
+
+
+VERTEX_SHADER_GLOBALS
+
+uint hash(uint x) {
+
+ x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
+ x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
+ x = (x >> uint(16)) ^ x;
+ return x;
+}
+
+
+void main() {
+
+#ifdef PARTICLES_COPY
+
+ out_color=color;
+ out_velocity_active=velocity_active;
+ out_custom = custom;
+ out_xform_1 = xform_1;
+ out_xform_2 = xform_2;
+ out_xform_3 = xform_3;
+
+#else
+
+ bool apply_forces=true;
+ bool apply_velocity=true;
+ float local_delta=delta;
+
+ float mass = 1.0;
+
+ float restart_phase = float(gl_VertexID)/float(total_particles);
+
+ if (randomness>0.0) {
+ uint seed = cycle;
+ if (restart_phase >= system_phase) {
+ seed-=uint(1);
+ }
+ seed*=uint(total_particles);
+ seed+=uint(gl_VertexID);
+ float random = float(hash(seed) % uint(65536)) / 65536.0;
+ restart_phase+=randomness * random * 1.0 / float(total_particles);
+ }
+
+ restart_phase*= (1.0-explosiveness);
+ bool restart=false;
+ bool shader_active = velocity_active.a > 0.5;
+
+ if (system_phase > prev_system_phase) {
+ // restart_phase >= prev_system_phase is used so particles emit in the first frame they are processed
+
+ if (restart_phase >= prev_system_phase && restart_phase < system_phase ) {
+ restart=true;
+#ifdef USE_FRACTIONAL_DELTA
+ local_delta = (system_phase - restart_phase) * lifetime;
+#endif
+ }
+
+ } else {
+ if (restart_phase >= prev_system_phase) {
+ restart=true;
+#ifdef USE_FRACTIONAL_DELTA
+ local_delta = (1.0 - restart_phase + system_phase) * lifetime;
+#endif
+ } else if (restart_phase < system_phase ) {
+ restart=true;
+#ifdef USE_FRACTIONAL_DELTA
+ local_delta = (system_phase - restart_phase) * lifetime;
+#endif
+ }
+ }
+
+ uint current_cycle = cycle;
+
+ if (system_phase < restart_phase) {
+ current_cycle-=uint(1);
+ }
+
+ uint particle_number = current_cycle * uint(total_particles) + uint(gl_VertexID);
+ int index = int(gl_VertexID);
+
+ if (restart) {
+ shader_active=emitting;
+ }
+
+ mat4 xform;
+
+#if defined(ENABLE_KEEP_DATA)
+ if (clear) {
+#else
+ if (clear || restart) {
+#endif
+ out_color=vec4(1.0);
+ out_velocity_active=vec4(0.0);
+ out_custom=vec4(0.0);
+ if (!restart)
+ shader_active=false;
+
+ xform = mat4(
+ vec4(1.0,0.0,0.0,0.0),
+ vec4(0.0,1.0,0.0,0.0),
+ vec4(0.0,0.0,1.0,0.0),
+ vec4(0.0,0.0,0.0,1.0)
+ );
+ } else {
+ out_color=color;
+ out_velocity_active=velocity_active;
+ out_custom=custom;
+ xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0)));
+ }
+
+ if (shader_active) {
+ //execute shader
+
+ {
+VERTEX_SHADER_CODE
+ }
+
+#if !defined(DISABLE_FORCE)
+
+ if (false) {
+
+ vec3 force = vec3(0.0);
+ for(int i=0;i<attractor_count;i++) {
+
+ vec3 rel_vec = xform[3].xyz - attractors[i].pos;
+ float dist = length(rel_vec);
+ if (attractors[i].radius < dist)
+ continue;
+ if (attractors[i].eat_radius>0.0 && attractors[i].eat_radius > dist) {
+ out_velocity_active.a=0.0;
+ }
+
+ rel_vec = normalize(rel_vec);
+
+ float attenuation = pow(dist / attractors[i].radius,attractors[i].attenuation);
+
+ if (attractors[i].dir==vec3(0.0)) {
+ //towards center
+ force+=attractors[i].strength * rel_vec * attenuation * mass;
+ } else {
+ force+=attractors[i].strength * attractors[i].dir * attenuation *mass;
+
+ }
+ }
+
+ out_velocity_active.xyz += force * local_delta;
+ }
+#endif
+
+#if !defined(DISABLE_VELOCITY)
+
+ if (true) {
+
+ xform[3].xyz += out_velocity_active.xyz * local_delta;
+ }
+#endif
+ } else {
+ xform=mat4(0.0);
+ }
+
+ xform = transpose(xform);
+
+ out_velocity_active.a = mix(0.0,1.0,shader_active);
+
+ out_xform_1 = xform[0];
+ out_xform_2 = xform[1];
+ out_xform_3 = xform[2];
+
+#endif //PARTICLES_COPY
+
+}
+
+[fragment]
+
+//any code here is never executed, stuff is filled just so it works
+
+
+#if defined(USE_MATERIAL)
+
+layout(std140) uniform UniformData {
+
+MATERIAL_UNIFORMS
+
+};
+
+#endif
+
+FRAGMENT_SHADER_GLOBALS
+
+void main() {
+
+ {
+LIGHT_SHADER_CODE
+ }
+
+ {
+FRAGMENT_SHADER_CODE
+ }
+}
diff --git a/drivers/gles2/shaders/resolve.glsl b/drivers/gles2/shaders/resolve.glsl
new file mode 100644
index 0000000000..0b50a9c57b
--- /dev/null
+++ b/drivers/gles2/shaders/resolve.glsl
@@ -0,0 +1,44 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+}
+
+[fragment]
+
+#if !defined(GLES_OVER_GL)
+precision mediump float;
+#endif
+
+in vec2 uv_interp;
+uniform sampler2D source_specular; //texunit:0
+uniform sampler2D source_ssr; //texunit:1
+
+uniform vec2 pixel_size;
+
+in vec2 uv2_interp;
+
+layout(location = 0) out vec4 frag_color;
+
+void main() {
+
+ vec4 specular = texture( source_specular, uv_interp );
+
+#ifdef USE_SSR
+
+ vec4 ssr = textureLod(source_ssr,uv_interp,0.0);
+ specular.rgb = mix(specular.rgb,ssr.rgb*specular.a,ssr.a);
+#endif
+
+ frag_color = vec4(specular.rgb,1.0);
+}
+
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
new file mode 100644
index 0000000000..79b989be4a
--- /dev/null
+++ b/drivers/gles2/shaders/scene.glsl
@@ -0,0 +1,2113 @@
+[vertex]
+
+#define M_PI 3.14159265359
+
+/*
+from VisualServer:
+
+ARRAY_VERTEX=0,
+ARRAY_NORMAL=1,
+ARRAY_TANGENT=2,
+ARRAY_COLOR=3,
+ARRAY_TEX_UV=4,
+ARRAY_TEX_UV2=5,
+ARRAY_BONES=6,
+ARRAY_WEIGHTS=7,
+ARRAY_INDEX=8,
+*/
+
+//hack to use uv if no uv present so it works with lightmap
+
+
+/* INPUT ATTRIBS */
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=1) in vec3 normal_attrib;
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+layout(location=2) in vec4 tangent_attrib;
+#endif
+
+#if defined(ENABLE_COLOR_INTERP)
+layout(location=3) in vec4 color_attrib;
+#endif
+
+#if defined(ENABLE_UV_INTERP)
+layout(location=4) in vec2 uv_attrib;
+#endif
+
+#if defined(ENABLE_UV2_INTERP)
+layout(location=5) in vec2 uv2_attrib;
+#endif
+
+uniform float normal_mult;
+
+#ifdef USE_SKELETON
+layout(location=6) in ivec4 bone_indices; // attrib:6
+layout(location=7) in vec4 bone_weights; // attrib:7
+#endif
+
+#ifdef USE_INSTANCING
+
+layout(location=8) in highp vec4 instance_xform0;
+layout(location=9) in highp vec4 instance_xform1;
+layout(location=10) in highp vec4 instance_xform2;
+layout(location=11) in lowp vec4 instance_color;
+
+#if defined(ENABLE_INSTANCE_CUSTOM)
+layout(location=12) in highp vec4 instance_custom_data;
+#endif
+
+#endif
+
+layout(std140) uniform SceneData { //ubo:0
+
+ highp mat4 projection_matrix;
+ highp mat4 inv_projection_matrix;
+ highp mat4 camera_inverse_matrix;
+ highp mat4 camera_matrix;
+
+ mediump vec4 ambient_light_color;
+ mediump vec4 bg_color;
+
+ mediump vec4 fog_color_enabled;
+ mediump vec4 fog_sun_color_amount;
+
+ mediump float ambient_energy;
+ mediump float bg_energy;
+
+ mediump float z_offset;
+ mediump float z_slope_scale;
+ highp float shadow_dual_paraboloid_render_zfar;
+ highp float shadow_dual_paraboloid_render_side;
+
+ highp vec2 viewport_size;
+ highp vec2 screen_pixel_size;
+ highp vec2 shadow_atlas_pixel_size;
+ highp vec2 directional_shadow_pixel_size;
+
+ highp float time;
+ highp float z_far;
+ mediump float reflection_multiplier;
+ mediump float subsurface_scatter_width;
+ mediump float ambient_occlusion_affect_light;
+
+ bool fog_depth_enabled;
+ highp float fog_depth_begin;
+ highp float fog_depth_curve;
+ bool fog_transmit_enabled;
+ highp float fog_transmit_curve;
+ bool fog_height_enabled;
+ highp float fog_height_min;
+ highp float fog_height_max;
+ highp float fog_height_curve;
+
+};
+
+uniform highp mat4 world_transform;
+
+
+#ifdef USE_LIGHT_DIRECTIONAL
+
+layout(std140) uniform DirectionalLightData { //ubo:3
+
+ highp vec4 light_pos_inv_radius;
+ mediump vec4 light_direction_attenuation;
+ mediump vec4 light_color_energy;
+ mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled,
+ mediump vec4 light_clamp;
+ mediump vec4 shadow_color_contact;
+ highp mat4 shadow_matrix1;
+ highp mat4 shadow_matrix2;
+ highp mat4 shadow_matrix3;
+ highp mat4 shadow_matrix4;
+ mediump vec4 shadow_split_offsets;
+};
+
+#endif
+
+#ifdef USE_VERTEX_LIGHTING
+//omni and spot
+
+struct LightData {
+
+ highp vec4 light_pos_inv_radius;
+ mediump vec4 light_direction_attenuation;
+ mediump vec4 light_color_energy;
+ mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled,
+ mediump vec4 light_clamp;
+ mediump vec4 shadow_color_contact;
+ highp mat4 shadow_matrix;
+
+};
+
+
+layout(std140) uniform OmniLightData { //ubo:4
+
+ LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
+};
+
+layout(std140) uniform SpotLightData { //ubo:5
+
+ LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
+};
+
+#ifdef USE_FORWARD_LIGHTING
+
+
+uniform int omni_light_indices[MAX_FORWARD_LIGHTS];
+uniform int omni_light_count;
+
+uniform int spot_light_indices[MAX_FORWARD_LIGHTS];
+uniform int spot_light_count;
+
+#endif
+
+out vec4 diffuse_light_interp;
+out vec4 specular_light_interp;
+
+void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color, float roughness, inout vec3 diffuse, inout vec3 specular) {
+
+ float dotNL = max(dot(N,L), 0.0 );
+ diffuse += dotNL * light_color / M_PI;
+
+ if (roughness > 0.0) {
+
+ vec3 H = normalize(V + L);
+ float dotNH = max(dot(N,H), 0.0 );
+ float intensity = pow( dotNH, (1.0-roughness) * 256.0);
+ specular += light_color * intensity;
+
+ }
+}
+
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal, float roughness,inout vec3 diffuse, inout vec3 specular) {
+
+ vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex;
+ float light_length = length( light_rel_vec );
+ float normalized_distance = light_length*omni_lights[idx].light_pos_inv_radius.w;
+ vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w ));
+
+ light_compute(normal,normalize(light_rel_vec),eye_vec,omni_lights[idx].light_color_energy.rgb * light_attenuation,roughness,diffuse,specular);
+
+}
+
+void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) {
+
+ vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex;
+ float light_length = length( light_rel_vec );
+ float normalized_distance = light_length*spot_lights[idx].light_pos_inv_radius.w;
+ vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w ));
+ vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz;
+ float spot_cutoff=spot_lights[idx].light_params.y;
+ float scos = max(dot(-normalize(light_rel_vec), spot_dir),spot_cutoff);
+ float spot_rim = (1.0 - scos) / (1.0 - spot_cutoff);
+ light_attenuation *= 1.0 - pow( max(spot_rim,0.001), spot_lights[idx].light_params.x);
+
+
+ light_compute(normal,normalize(light_rel_vec),eye_vec,spot_lights[idx].light_color_energy.rgb*light_attenuation,roughness,diffuse,specular);
+}
+
+
+#endif
+
+/* Varyings */
+
+out highp vec3 vertex_interp;
+out vec3 normal_interp;
+
+#if defined(ENABLE_COLOR_INTERP)
+out vec4 color_interp;
+#endif
+
+#if defined(ENABLE_UV_INTERP)
+out vec2 uv_interp;
+#endif
+
+#if defined(ENABLE_UV2_INTERP)
+out vec2 uv2_interp;
+#endif
+
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+out vec3 tangent_interp;
+out vec3 binormal_interp;
+#endif
+
+
+
+
+
+#if defined(USE_MATERIAL)
+
+layout(std140) uniform UniformData { //ubo:1
+
+MATERIAL_UNIFORMS
+
+};
+
+#endif
+
+VERTEX_SHADER_GLOBALS
+
+#ifdef RENDER_DEPTH_DUAL_PARABOLOID
+
+out highp float dp_clip;
+
+#endif
+
+#define SKELETON_TEXTURE_WIDTH 256
+
+#ifdef USE_SKELETON
+uniform highp sampler2D skeleton_texture; //texunit:-1
+#endif
+
+out highp vec4 position_interp;
+
+// FIXME: This triggers a Mesa bug that breaks rendering, so disabled for now.
+// See GH-13450 and https://bugs.freedesktop.org/show_bug.cgi?id=100316
+//invariant gl_Position;
+
+void main() {
+
+ highp vec4 vertex = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0);
+
+ mat4 world_matrix = world_transform;
+
+
+#ifdef USE_INSTANCING
+
+ {
+ highp mat4 m=mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0));
+ world_matrix = world_matrix * transpose(m);
+ }
+#endif
+
+ vec3 normal = normal_attrib * normal_mult;
+
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+ vec3 tangent = tangent_attrib.xyz;
+ tangent*=normal_mult;
+ float binormalf = tangent_attrib.a;
+#endif
+
+#if defined(ENABLE_COLOR_INTERP)
+ color_interp = color_attrib;
+#if defined(USE_INSTANCING)
+ color_interp *= instance_color;
+#endif
+
+#endif
+
+#ifdef USE_SKELETON
+ {
+ //skeleton transform
+ ivec2 tex_ofs = ivec2( bone_indices.x%256, (bone_indices.x/256)*3 );
+ highp mat3x4 m = mat3x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
+ ) * bone_weights.x;
+
+ tex_ofs = ivec2( bone_indices.y%256, (bone_indices.y/256)*3 );
+
+ m+= mat3x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
+ ) * bone_weights.y;
+
+ tex_ofs = ivec2( bone_indices.z%256, (bone_indices.z/256)*3 );
+
+ m+= mat3x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
+ ) * bone_weights.z;
+
+
+ tex_ofs = ivec2( bone_indices.w%256, (bone_indices.w/256)*3 );
+
+ m+= mat3x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
+ ) * bone_weights.w;
+
+
+ vertex.xyz = vertex * m;
+
+ normal = vec4(normal,0.0) * m;
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+ tangent.xyz = vec4(tangent.xyz,0.0) * m;
+#endif
+ }
+#endif
+
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+
+ vec3 binormal = normalize( cross(normal,tangent) * binormalf );
+#endif
+
+#if defined(ENABLE_UV_INTERP)
+ uv_interp = uv_attrib;
+#endif
+
+#if defined(ENABLE_UV2_INTERP)
+ uv2_interp = uv2_attrib;
+#endif
+
+#if defined(USE_INSTANCING) && defined(ENABLE_INSTANCE_CUSTOM)
+ vec4 instance_custom = instance_custom_data;
+#else
+ vec4 instance_custom = vec4(0.0);
+#endif
+
+ highp mat4 modelview = camera_inverse_matrix * world_matrix;
+ highp mat4 local_projection = projection_matrix;
+
+//using world coordinates
+#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
+
+ vertex = world_matrix * vertex;
+ normal = normalize((world_matrix * vec4(normal,0.0)).xyz);
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+
+ tangent = normalize((world_matrix * vec4(tangent,0.0)).xyz);
+ binormal = normalize((world_matrix * vec4(binormal,0.0)).xyz);
+#endif
+#endif
+
+ float roughness=0.0;
+
+//defines that make writing custom shaders easier
+#define projection_matrix local_projection
+#define world_transform world_matrix
+{
+
+VERTEX_SHADER_CODE
+
+}
+
+
+
+//using local coordinates (default)
+#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
+
+ vertex = modelview * vertex;
+ normal = normalize((modelview * vec4(normal,0.0)).xyz);
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+
+ tangent = normalize((modelview * vec4(tangent,0.0)).xyz);
+ binormal = normalize((modelview * vec4(binormal,0.0)).xyz);
+#endif
+#endif
+
+//using world coordinates
+#if !defined(SKIP_TRANSFORM_USED) && defined(VERTEX_WORLD_COORDS_USED)
+
+ vertex = camera_inverse_matrix * vertex;
+ normal = normalize((camera_inverse_matrix * vec4(normal,0.0)).xyz);
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+
+ tangent = normalize((camera_inverse_matrix * vec4(tangent,0.0)).xyz);
+ binormal = normalize((camera_inverse_matrix * vec4(binormal,0.0)).xyz);
+#endif
+#endif
+
+ vertex_interp = vertex.xyz;
+ normal_interp = normal;
+
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+ tangent_interp = tangent;
+ binormal_interp = binormal;
+#endif
+
+
+#ifdef RENDER_DEPTH
+
+
+#ifdef RENDER_DEPTH_DUAL_PARABOLOID
+
+ vertex_interp.z*= shadow_dual_paraboloid_render_side;
+ normal_interp.z*= shadow_dual_paraboloid_render_side;
+
+ dp_clip=vertex_interp.z; //this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias
+
+ //for dual paraboloid shadow mapping, this is the fastest but least correct way, as it curves straight edges
+
+ highp vec3 vtx = vertex_interp+normalize(vertex_interp)*z_offset;
+ highp float distance = length(vtx);
+ vtx = normalize(vtx);
+ vtx.xy/=1.0-vtx.z;
+ vtx.z=(distance/shadow_dual_paraboloid_render_zfar);
+ vtx.z=vtx.z * 2.0 - 1.0;
+
+ vertex.xyz=vtx;
+ vertex.w=1.0;
+
+
+#else
+
+ float z_ofs = z_offset;
+ z_ofs += (1.0-abs(normal_interp.z))*z_slope_scale;
+ vertex_interp.z-=z_ofs;
+
+#endif //RENDER_DEPTH_DUAL_PARABOLOID
+
+#endif //RENDER_DEPTH
+
+ gl_Position = projection_matrix * vec4(vertex_interp,1.0);
+
+ position_interp=gl_Position;
+
+#ifdef USE_VERTEX_LIGHTING
+
+ diffuse_light_interp=vec4(0.0);
+ specular_light_interp=vec4(0.0);
+
+#ifdef USE_FORWARD_LIGHTING
+
+ for(int i=0;i<omni_light_count;i++) {
+ light_process_omni(omni_light_indices[i],vertex_interp,-normalize( vertex_interp ),normal_interp,roughness,diffuse_light_interp.rgb,specular_light_interp.rgb);
+ }
+
+ for(int i=0;i<spot_light_count;i++) {
+ light_process_spot(spot_light_indices[i],vertex_interp,-normalize( vertex_interp ),normal_interp,roughness,diffuse_light_interp.rgb,specular_light_interp.rgb);
+ }
+#endif
+
+#ifdef USE_LIGHT_DIRECTIONAL
+
+ vec3 directional_diffuse = vec3(0.0);
+ vec3 directional_specular = vec3(0.0);
+ light_compute(normal_interp,-light_direction_attenuation.xyz,-normalize( vertex_interp ),light_color_energy.rgb,roughness,directional_diffuse,directional_specular);
+
+ float diff_avg = dot(diffuse_light_interp.rgb,vec3(0.33333));
+ float diff_dir_avg = dot(directional_diffuse,vec3(0.33333));
+ if (diff_avg>0.0) {
+ diffuse_light_interp.a=diff_dir_avg/(diff_avg+diff_dir_avg);
+ } else {
+ diffuse_light_interp.a=1.0;
+ }
+
+ diffuse_light_interp.rgb+=directional_diffuse;
+
+ float spec_avg = dot(specular_light_interp.rgb,vec3(0.33333));
+ float spec_dir_avg = dot(directional_specular,vec3(0.33333));
+ if (spec_avg>0.0) {
+ specular_light_interp.a=spec_dir_avg/(spec_avg+spec_dir_avg);
+ } else {
+ specular_light_interp.a=1.0;
+ }
+
+ specular_light_interp.rgb+=directional_specular;
+
+#endif //USE_LIGHT_DIRECTIONAL
+
+
+#endif // USE_VERTEX_LIGHTING
+
+}
+
+
+[fragment]
+
+/* texture unit usage, N is max_texture_unity-N
+
+1-skeleton
+2-radiance
+3-reflection_atlas
+4-directional_shadow
+5-shadow_atlas
+6-decal_atlas
+7-screen
+8-depth
+9-probe1
+10-probe2
+
+*/
+
+uniform highp mat4 world_transform;
+
+#define M_PI 3.14159265359
+
+/* Varyings */
+
+#if defined(ENABLE_COLOR_INTERP)
+in vec4 color_interp;
+#endif
+
+#if defined(ENABLE_UV_INTERP)
+in vec2 uv_interp;
+#endif
+
+#if defined(ENABLE_UV2_INTERP)
+in vec2 uv2_interp;
+#endif
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+in vec3 tangent_interp;
+in vec3 binormal_interp;
+#endif
+
+in highp vec3 vertex_interp;
+in vec3 normal_interp;
+
+
+/* PBR CHANNELS */
+
+//used on forward mainly
+uniform bool no_ambient_light;
+
+
+
+#ifdef USE_RADIANCE_MAP
+
+
+
+layout(std140) uniform Radiance { //ubo:2
+
+ mat4 radiance_inverse_xform;
+ float radiance_ambient_contribution;
+
+};
+
+#define RADIANCE_MAX_LOD 5.0
+
+#ifdef USE_RADIANCE_MAP_ARRAY
+
+uniform sampler2DArray radiance_map; //texunit:-2
+
+vec3 textureDualParaboloid(sampler2DArray p_tex, vec3 p_vec,float p_roughness) {
+
+ vec3 norm = normalize(p_vec);
+ norm.xy/=1.0+abs(norm.z);
+ norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
+
+ // we need to lie the derivatives (normg) and assume that DP side is always the same
+ // to get proper texture filtering
+ vec2 normg=norm.xy;
+ if (norm.z>0.0) {
+ norm.y=0.5-norm.y+0.5;
+ }
+
+ // thanks to OpenGL spec using floor(layer + 0.5) for texture arrays,
+ // it's easy to have precision errors using fract() to interpolate layers
+ // as such, using fixed point to ensure it works.
+
+ float index = p_roughness * RADIANCE_MAX_LOD;
+ int indexi = int(index * 256.0);
+ vec3 base = textureGrad(p_tex, vec3(norm.xy, float(indexi/256)),dFdx(normg),dFdy(normg)).xyz;
+ vec3 next = textureGrad(p_tex, vec3(norm.xy, float(indexi/256+1)),dFdx(normg),dFdy(normg)).xyz;
+ return mix(base,next,float(indexi%256)/256.0);
+}
+
+#else
+
+uniform sampler2D radiance_map; //texunit:-2
+
+vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) {
+
+ vec3 norm = normalize(p_vec);
+ norm.xy/=1.0+abs(norm.z);
+ norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
+ if (norm.z>0.0) {
+ norm.y=0.5-norm.y+0.5;
+ }
+ return textureLod(p_tex, norm.xy, p_roughness * RADIANCE_MAX_LOD).xyz;
+}
+
+#endif
+
+#endif
+
+/* Material Uniforms */
+
+
+
+#if defined(USE_MATERIAL)
+
+layout(std140) uniform UniformData {
+
+MATERIAL_UNIFORMS
+
+};
+
+#endif
+
+FRAGMENT_SHADER_GLOBALS
+
+layout(std140) uniform SceneData {
+
+ highp mat4 projection_matrix;
+ highp mat4 inv_projection_matrix;
+ highp mat4 camera_inverse_matrix;
+ highp mat4 camera_matrix;
+
+ mediump vec4 ambient_light_color;
+ mediump vec4 bg_color;
+
+ mediump vec4 fog_color_enabled;
+ mediump vec4 fog_sun_color_amount;
+
+ mediump float ambient_energy;
+ mediump float bg_energy;
+
+ mediump float z_offset;
+ mediump float z_slope_scale;
+ highp float shadow_dual_paraboloid_render_zfar;
+ highp float shadow_dual_paraboloid_render_side;
+
+ highp vec2 viewport_size;
+ highp vec2 screen_pixel_size;
+ highp vec2 shadow_atlas_pixel_size;
+ highp vec2 directional_shadow_pixel_size;
+
+ highp float time;
+ highp float z_far;
+ mediump float reflection_multiplier;
+ mediump float subsurface_scatter_width;
+ mediump float ambient_occlusion_affect_light;
+
+ bool fog_depth_enabled;
+ highp float fog_depth_begin;
+ highp float fog_depth_curve;
+ bool fog_transmit_enabled;
+ highp float fog_transmit_curve;
+ bool fog_height_enabled;
+ highp float fog_height_min;
+ highp float fog_height_max;
+ highp float fog_height_curve;
+};
+
+//directional light data
+
+#ifdef USE_LIGHT_DIRECTIONAL
+
+layout(std140) uniform DirectionalLightData {
+
+ highp vec4 light_pos_inv_radius;
+ mediump vec4 light_direction_attenuation;
+ mediump vec4 light_color_energy;
+ mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled,
+ mediump vec4 light_clamp;
+ mediump vec4 shadow_color_contact;
+ highp mat4 shadow_matrix1;
+ highp mat4 shadow_matrix2;
+ highp mat4 shadow_matrix3;
+ highp mat4 shadow_matrix4;
+ mediump vec4 shadow_split_offsets;
+};
+
+
+uniform highp sampler2DShadow directional_shadow; //texunit:-4
+
+#endif
+
+#ifdef USE_VERTEX_LIGHTING
+in vec4 diffuse_light_interp;
+in vec4 specular_light_interp;
+#endif
+//omni and spot
+
+struct LightData {
+
+ highp vec4 light_pos_inv_radius;
+ mediump vec4 light_direction_attenuation;
+ mediump vec4 light_color_energy;
+ mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled,
+ mediump vec4 light_clamp;
+ mediump vec4 shadow_color_contact;
+ highp mat4 shadow_matrix;
+
+};
+
+
+layout(std140) uniform OmniLightData { //ubo:4
+
+ LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
+};
+
+layout(std140) uniform SpotLightData { //ubo:5
+
+ LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
+};
+
+
+uniform highp sampler2DShadow shadow_atlas; //texunit:-5
+
+
+struct ReflectionData {
+
+ mediump vec4 box_extents;
+ mediump vec4 box_offset;
+ mediump vec4 params; // intensity, 0, interior , boxproject
+ mediump vec4 ambient; //ambient color, energy
+ mediump vec4 atlas_clamp;
+ highp mat4 local_matrix; //up to here for spot and omni, rest is for directional
+ //notes: for ambientblend, use distance to edge to blend between already existing global environment
+};
+
+layout(std140) uniform ReflectionProbeData { //ubo:6
+
+ ReflectionData reflections[MAX_REFLECTION_DATA_STRUCTS];
+};
+uniform mediump sampler2D reflection_atlas; //texunit:-3
+
+
+#ifdef USE_FORWARD_LIGHTING
+
+uniform int omni_light_indices[MAX_FORWARD_LIGHTS];
+uniform int omni_light_count;
+
+uniform int spot_light_indices[MAX_FORWARD_LIGHTS];
+uniform int spot_light_count;
+
+uniform int reflection_indices[MAX_FORWARD_LIGHTS];
+uniform int reflection_count;
+
+#endif
+
+
+#if defined(SCREEN_TEXTURE_USED)
+
+uniform highp sampler2D screen_texture; //texunit:-7
+
+#endif
+
+#ifdef USE_MULTIPLE_RENDER_TARGETS
+
+layout(location=0) out vec4 diffuse_buffer;
+layout(location=1) out vec4 specular_buffer;
+layout(location=2) out vec4 normal_mr_buffer;
+#if defined(ENABLE_SSS)
+layout(location=3) out float sss_buffer;
+#endif
+
+#else
+
+layout(location=0) out vec4 frag_color;
+
+#endif
+
+in highp vec4 position_interp;
+uniform highp sampler2D depth_buffer; //texunit:-8
+
+#ifdef USE_CONTACT_SHADOWS
+
+float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
+
+ if (abs(dir.z)>0.99)
+ return 1.0;
+
+ vec3 endpoint = pos+dir*max_distance;
+ vec4 source = position_interp;
+ vec4 dest = projection_matrix * vec4(endpoint, 1.0);
+
+ vec2 from_screen = (source.xy / source.w) * 0.5 + 0.5;
+ vec2 to_screen = (dest.xy / dest.w) * 0.5 + 0.5;
+
+ vec2 screen_rel = to_screen - from_screen;
+
+ if (length(screen_rel)<0.00001)
+ return 1.0; //too small, don't do anything
+
+ /*float pixel_size; //approximate pixel size
+
+ if (screen_rel.x > screen_rel.y) {
+
+ pixel_size = abs((pos.x-endpoint.x)/(screen_rel.x/screen_pixel_size.x));
+ } else {
+ pixel_size = abs((pos.y-endpoint.y)/(screen_rel.y/screen_pixel_size.y));
+
+ }*/
+ vec4 bias = projection_matrix * vec4(pos+vec3(0.0,0.0,0.04), 1.0); //todo un-harcode the 0.04
+
+
+
+ vec2 pixel_incr = normalize(screen_rel)*screen_pixel_size;
+
+
+ float steps = length(screen_rel) / length(pixel_incr);
+ steps = min(2000.0,steps); //put a limit to avoid freezing in some strange situation
+ //steps=10.0;
+
+ vec4 incr = (dest - source)/steps;
+ float ratio=0.0;
+ float ratio_incr = 1.0/steps;
+
+ while(steps>0.0) {
+ source += incr*2.0;
+ bias+=incr*2.0;
+
+ vec3 uv_depth = (source.xyz / source.w) * 0.5 + 0.5;
+ float depth = texture(depth_buffer,uv_depth.xy).r;
+
+ if (depth < uv_depth.z) {
+ if (depth > (bias.z/bias.w) * 0.5 + 0.5) {
+ return min(pow(ratio,4.0),1.0);
+ } else {
+ return 1.0;
+ }
+ }
+
+
+ ratio+=ratio_incr;
+ steps-=1.0;
+ }
+
+ return 1.0;
+}
+
+#endif
+
+
+// This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V.
+// We're dividing this factor off because the overall term we'll end up looks like
+// (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012):
+//
+// F(L.V) D(N.H) G(N.L) G(N.V) / (4 N.L N.V)
+//
+// We're basically regouping this as
+//
+// F(L.V) D(N.H) [G(N.L)/(2 N.L)] [G(N.V) / (2 N.V)]
+//
+// and thus, this function implements the [G(N.m)/(2 N.m)] part with m = L or V.
+//
+// The contents of the D and G (G1) functions (GGX) are taken from
+// E. Heitz, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs", J. Comp. Graph. Tech. 3 (2) (2014).
+// Eqns 71-72 and 85-86 (see also Eqns 43 and 80).
+
+float G_GGX_2cos(float cos_theta_m, float alpha) {
+ // Schlick's approximation
+ // C. Schlick, "An Inexpensive BRDF Model for Physically-based Rendering", Computer Graphics Forum. 13 (3): 233 (1994)
+ // Eq. (19), although see Heitz (2014) the about the problems with his derivation.
+ // It nevertheless approximates GGX well with k = alpha/2.
+ float k = 0.5*alpha;
+ return 0.5 / (cos_theta_m * (1.0 - k) + k);
+
+ // float cos2 = cos_theta_m*cos_theta_m;
+ // float sin2 = (1.0-cos2);
+ // return 1.0 /( cos_theta_m + sqrt(cos2 + alpha*alpha*sin2) );
+}
+
+float D_GGX(float cos_theta_m, float alpha) {
+ float alpha2 = alpha*alpha;
+ float d = 1.0 + (alpha2-1.0)*cos_theta_m*cos_theta_m;
+ return alpha2/(M_PI * d * d);
+}
+
+float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
+ float cos2 = cos_theta_m * cos_theta_m;
+ float sin2 = (1.0-cos2);
+ float s_x = alpha_x * cos_phi;
+ float s_y = alpha_y * sin_phi;
+ return 1.0 / (cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ));
+}
+
+float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) {
+ float cos2 = cos_theta_m * cos_theta_m;
+ float sin2 = (1.0-cos2);
+ float r_x = cos_phi/alpha_x;
+ float r_y = sin_phi/alpha_y;
+ float d = cos2 + sin2*(r_x * r_x + r_y * r_y);
+ return 1.0 / (M_PI * alpha_x * alpha_y * d * d );
+}
+
+
+float SchlickFresnel(float u)
+{
+ float m = 1.0-u;
+ float m2 = m*m;
+ return m2*m2*m; // pow(m,5)
+}
+
+float GTR1(float NdotH, float a)
+{
+ if (a >= 1.0) return 1.0/M_PI;
+ float a2 = a*a;
+ float t = 1.0 + (a2-1.0)*NdotH*NdotH;
+ return (a2-1.0) / (M_PI*log(a2)*t);
+}
+
+vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) {
+ float dielectric = (0.034 * 2.0) * specular;
+ // energy conservation
+ return mix(vec3(dielectric), albedo, metallic); // TODO: reference?
+}
+
+void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec3 attenuation, vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) {
+
+#if defined(USE_LIGHT_SHADER_CODE)
+//light is written by the light shader
+
+ vec3 normal = N;
+ vec3 albedo = diffuse_color;
+ vec3 light = L;
+ vec3 view = V;
+
+LIGHT_SHADER_CODE
+
+
+#else
+ float NdotL = dot(N,L);
+ float cNdotL = max(NdotL, 0.0); // clamped NdotL
+ float NdotV = dot(N, V);
+ float cNdotV = max(NdotV, 0.0);
+
+ if (metallic < 1.0) {
+#if defined(DIFFUSE_OREN_NAYAR)
+ vec3 diffuse_brdf_NL;
+#else
+ float diffuse_brdf_NL; // BRDF times N.L for calculating diffuse radiance
+#endif
+
+
+#if defined(DIFFUSE_LAMBERT_WRAP)
+ //energy conserving lambert wrap shader
+ diffuse_brdf_NL = max(0.0,(NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
+
+#elif defined(DIFFUSE_OREN_NAYAR)
+
+ {
+ // see http://mimosa-pudica.net/improved-oren-nayar.html
+ float LdotV = dot(L, V);
+
+
+ float s = LdotV - NdotL * NdotV;
+ float t = mix(1.0, max(NdotL, NdotV), step(0.0, s));
+
+ float sigma2 = roughness * roughness; // TODO: this needs checking
+ vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) );
+ float B = 0.45 * sigma2 / (sigma2 + 0.09);
+
+ diffuse_brdf_NL = cNdotL * (A + vec3(B) * s / t) * (1.0 / M_PI);
+ }
+
+#elif defined(DIFFUSE_TOON)
+
+ diffuse_brdf_NL = smoothstep(-roughness,max(roughness,0.01),NdotL);
+
+#elif defined(DIFFUSE_BURLEY)
+
+ {
+
+
+ vec3 H = normalize(V + L);
+ float cLdotH = max(0.0,dot(L, H));
+
+ float FD90 = 0.5 + 2.0 * cLdotH * cLdotH * roughness;
+ float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotV);
+ float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(cNdotL);
+ diffuse_brdf_NL = (1.0 / M_PI) * FdV * FdL * cNdotL;
+ /*
+ float energyBias = mix(roughness, 0.0, 0.5);
+ float energyFactor = mix(roughness, 1.0, 1.0 / 1.51);
+ float fd90 = energyBias + 2.0 * VoH * VoH * roughness;
+ float f0 = 1.0;
+ float lightScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotL, 5.0);
+ float viewScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotV, 5.0);
+
+ diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;*/
+ }
+#else
+ //lambert
+ diffuse_brdf_NL = cNdotL * (1.0 / M_PI);
+#endif
+
+#if defined(TRANSMISSION_USED)
+ diffuse_light += light_color * diffuse_color * mix(vec3(diffuse_brdf_NL), vec3(M_PI), transmission) * attenuation;
+#else
+ diffuse_light += light_color * diffuse_color * diffuse_brdf_NL * attenuation;
+#endif
+
+
+
+#if defined(LIGHT_USE_RIM)
+ float rim_light = pow(1.0-cNdotV, (1.0-roughness)*16.0);
+ diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
+#endif
+ }
+
+
+ if (roughness > 0.0) { // FIXME: roughness == 0 should not disable specular light entirely
+
+
+ // D
+
+#if defined(SPECULAR_BLINN)
+
+ vec3 H = normalize(V + L);
+ float cNdotH = max(dot(N,H), 0.0 );
+ float intensity = pow( cNdotH, (1.0-roughness) * 256.0);
+ specular_light += light_color * intensity * specular_blob_intensity * attenuation;
+
+#elif defined(SPECULAR_PHONG)
+
+ vec3 R = normalize(-reflect(L,N));
+ float cRdotV = max(0.0,dot(R,V));
+ float intensity = pow( cRdotV, (1.0-roughness) * 256.0);
+ specular_light += light_color * intensity * specular_blob_intensity * attenuation;
+
+#elif defined(SPECULAR_TOON)
+
+ vec3 R = normalize(-reflect(L,N));
+ float RdotV = dot(R,V);
+ float mid = 1.0-roughness;
+ mid*=mid;
+ float intensity = smoothstep(mid-roughness*0.5, mid+roughness*0.5, RdotV) * mid;
+ diffuse_light += light_color * intensity * specular_blob_intensity * attenuation; // write to diffuse_light, as in toon shading you generally want no reflection
+
+#elif defined(SPECULAR_DISABLED)
+ //none..
+
+#elif defined(SPECULAR_SCHLICK_GGX)
+ // shlick+ggx as default
+
+ vec3 H = normalize(V + L);
+
+ float cNdotH = max(dot(N,H), 0.0);
+ float cLdotH = max(dot(L,H), 0.0);
+
+# if defined(LIGHT_USE_ANISOTROPY)
+
+ float aspect = sqrt(1.0-anisotropy*0.9);
+ float rx = roughness/aspect;
+ float ry = roughness*aspect;
+ float ax = rx*rx;
+ float ay = ry*ry;
+ float XdotH = dot( T, H );
+ float YdotH = dot( B, H );
+ float D = D_GGX_anisotropic(cNdotH, ax, ay, XdotH, YdotH);
+ float G = G_GGX_anisotropic_2cos(cNdotL, ax, ay, XdotH, YdotH) * G_GGX_anisotropic_2cos(cNdotV, ax, ay, XdotH, YdotH);
+
+# else
+ float alpha = roughness * roughness;
+ float D = D_GGX(cNdotH, alpha);
+ float G = G_GGX_2cos(cNdotL, alpha) * G_GGX_2cos(cNdotV, alpha);
+# endif
+ // F
+ float F0 = 1.0; // FIXME
+ float cLdotH5 = SchlickFresnel(cLdotH);
+ float F = mix(cLdotH5, 1.0, F0);
+
+ float specular_brdf_NL = cNdotL * D * F * G;
+
+ specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation;
+#endif
+
+#if defined(LIGHT_USE_CLEARCOAT)
+ if (clearcoat_gloss > 0.0) {
+# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN)
+ vec3 H = normalize(V + L);
+# endif
+# if !defined(SPECULAR_SCHLICK_GGX)
+ float cNdotH = max(dot(N,H), 0.0);
+ float cLdotH = max(dot(L,H), 0.0);
+ float cLdotH5 = SchlickFresnel(cLdotH);
+#endif
+ float Dr = GTR1(cNdotH, mix(.1, .001, clearcoat_gloss));
+ float Fr = mix(.04, 1.0, cLdotH5);
+ float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25);
+
+
+ float specular_brdf_NL = 0.25 * clearcoat * Gr * Fr * Dr * cNdotL;
+
+ specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation;
+ }
+#endif
+ }
+
+
+#endif //defined(USE_LIGHT_SHADER_CODE)
+}
+
+
+float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 pos, float depth, vec4 clamp_rect) {
+
+#ifdef SHADOW_MODE_PCF_13
+
+ float avg=textureProj(shadow,vec4(pos,depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,-shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x*2.0,0.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x*2.0,0.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y*2.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y*2.0),depth,1.0));
+ return avg*(1.0/13.0);
+
+#elif defined(SHADOW_MODE_PCF_5)
+
+ float avg=textureProj(shadow,vec4(pos,depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(shadow_pixel_size.x,0.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(-shadow_pixel_size.x,0.0),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(0.0,shadow_pixel_size.y),depth,1.0));
+ avg+=textureProj(shadow,vec4(pos+vec2(0.0,-shadow_pixel_size.y),depth,1.0));
+ return avg*(1.0/5.0);
+
+#else
+
+ return textureProj(shadow,vec4(pos,depth,1.0));
+
+#endif
+
+}
+
+#ifdef RENDER_DEPTH_DUAL_PARABOLOID
+
+in highp float dp_clip;
+
+#endif
+
+
+
+#if 0
+//need to save texture depth for this
+
+vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 pos, float distance) {
+
+ float scale = 8.25 * (1.0 - translucency) / subsurface_scatter_width;
+ float d = scale * distance;
+
+ /**
+ * Armed with the thickness, we can now calculate the color by means of the
+ * precalculated transmittance profile.
+ * (It can be precomputed into a texture, for maximum performance):
+ */
+ float dd = -d * d;
+ vec3 profile = vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
+ vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
+ vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
+ vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
+ vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) +
+ vec3(0.078, 0.0, 0.0) * exp(dd / 7.41);
+
+ /**
+ * Using the profile, we finally approximate the transmitted lighting from
+ * the back of the object:
+ */
+ return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0);
+}
+#endif
+
+void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
+
+ vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex;
+ float light_length = length( light_rel_vec );
+ float normalized_distance = light_length*omni_lights[idx].light_pos_inv_radius.w;
+ vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w ));
+
+ if (omni_lights[idx].light_params.w>0.5) {
+ //there is a shadowmap
+
+ highp vec3 splane=(omni_lights[idx].shadow_matrix * vec4(vertex,1.0)).xyz;
+ float shadow_len=length(splane);
+ splane=normalize(splane);
+ vec4 clamp_rect=omni_lights[idx].light_clamp;
+
+ if (splane.z>=0.0) {
+
+ splane.z+=1.0;
+
+ clamp_rect.y+=clamp_rect.w;
+
+ } else {
+
+ splane.z=1.0 - splane.z;
+
+ /*
+ if (clamp_rect.z<clamp_rect.w) {
+ clamp_rect.x+=clamp_rect.z;
+ } else {
+ clamp_rect.y+=clamp_rect.w;
+ }
+ */
+
+ }
+
+ splane.xy/=splane.z;
+ splane.xy=splane.xy * 0.5 + 0.5;
+ splane.z = shadow_len * omni_lights[idx].light_pos_inv_radius.w;
+
+ splane.xy = clamp_rect.xy+splane.xy*clamp_rect.zw;
+ float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,clamp_rect);
+
+#ifdef USE_CONTACT_SHADOWS
+
+ if (shadow>0.01 && omni_lights[idx].shadow_color_contact.a>0.0) {
+
+ float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,omni_lights[idx].shadow_color_contact.a));
+ shadow=min(shadow,contact_shadow);
+
+ }
+#endif
+ light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
+ }
+
+ light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+
+}
+
+void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent,vec3 albedo, vec3 transmission,float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
+
+ vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex;
+ float light_length = length( light_rel_vec );
+ float normalized_distance = light_length*spot_lights[idx].light_pos_inv_radius.w;
+ vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.001), spot_lights[idx].light_direction_attenuation.w ));
+ vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz;
+ float spot_cutoff=spot_lights[idx].light_params.y;
+ float scos = max(dot(-normalize(light_rel_vec), spot_dir),spot_cutoff);
+ float spot_rim = (1.0 - scos) / (1.0 - spot_cutoff);
+ light_attenuation *= 1.0 - pow( max(spot_rim,0.001), spot_lights[idx].light_params.x);
+
+ if (spot_lights[idx].light_params.w>0.5) {
+ //there is a shadowmap
+ highp vec4 splane=(spot_lights[idx].shadow_matrix * vec4(vertex,1.0));
+ splane.xyz/=splane.w;
+
+ float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp);
+
+#ifdef USE_CONTACT_SHADOWS
+ if (shadow>0.01 && spot_lights[idx].shadow_color_contact.a>0.0) {
+
+ float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,spot_lights[idx].shadow_color_contact.a));
+ shadow=min(shadow,contact_shadow);
+
+ }
+#endif
+ light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
+ }
+
+ light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+
+}
+
+void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 tangent,float roughness,float anisotropy,vec3 ambient,vec3 skybox, inout highp vec4 reflection_accum,inout highp vec4 ambient_accum) {
+
+ vec3 ref_vec = normalize(reflect(vertex,normal));
+ vec3 local_pos = (reflections[idx].local_matrix * vec4(vertex,1.0)).xyz;
+ vec3 box_extents = reflections[idx].box_extents.xyz;
+
+ if (any(greaterThan(abs(local_pos),box_extents))) { //out of the reflection box
+ return;
+ }
+
+ vec3 inner_pos = abs(local_pos / box_extents);
+ float blend = max(inner_pos.x,max(inner_pos.y,inner_pos.z));
+ //make blend more rounded
+ blend=mix(length(inner_pos),blend,blend);
+ blend*=blend;
+ blend=1.001-blend;
+
+ if (reflections[idx].params.x>0.0){// compute reflection
+
+ vec3 local_ref_vec = (reflections[idx].local_matrix * vec4(ref_vec,0.0)).xyz;
+
+ if (reflections[idx].params.w > 0.5) { //box project
+
+ vec3 nrdir = normalize(local_ref_vec);
+ vec3 rbmax = (box_extents - local_pos)/nrdir;
+ vec3 rbmin = (-box_extents - local_pos)/nrdir;
+
+
+ vec3 rbminmax = mix(rbmin,rbmax,greaterThan(nrdir,vec3(0.0,0.0,0.0)));
+
+ float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);
+ vec3 posonbox = local_pos + nrdir * fa;
+ local_ref_vec = posonbox - reflections[idx].box_offset.xyz;
+ }
+
+
+ vec4 clamp_rect=reflections[idx].atlas_clamp;
+ vec3 norm = normalize(local_ref_vec);
+ norm.xy/=1.0+abs(norm.z);
+ norm.xy=norm.xy * vec2(0.5,0.25) + vec2(0.5,0.25);
+ if (norm.z>0.0) {
+ norm.y=0.5-norm.y+0.5;
+ }
+
+ vec2 atlas_uv = norm.xy * clamp_rect.zw + clamp_rect.xy;
+ atlas_uv = clamp(atlas_uv,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw);
+
+ highp vec4 reflection;
+ reflection.rgb = textureLod(reflection_atlas,atlas_uv,roughness*5.0).rgb;
+
+ if (reflections[idx].params.z < 0.5) {
+ reflection.rgb = mix(skybox,reflection.rgb,blend);
+ }
+ reflection.rgb*=reflections[idx].params.x;
+ reflection.a = blend;
+ reflection.rgb*=reflection.a;
+
+ reflection_accum+=reflection;
+ }
+
+ if (reflections[idx].ambient.a>0.0) { //compute ambient using skybox
+
+
+ vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal,0.0)).xyz;
+
+ vec3 splane=normalize(local_amb_vec);
+ vec4 clamp_rect=reflections[idx].atlas_clamp;
+
+ splane.z*=-1.0;
+ if (splane.z>=0.0) {
+ splane.z+=1.0;
+ clamp_rect.y+=clamp_rect.w;
+ } else {
+ splane.z=1.0 - splane.z;
+ splane.y=-splane.y;
+ }
+
+ splane.xy/=splane.z;
+ splane.xy=splane.xy * 0.5 + 0.5;
+
+ splane.xy = splane.xy * clamp_rect.zw + clamp_rect.xy;
+ splane.xy = clamp(splane.xy,clamp_rect.xy,clamp_rect.xy+clamp_rect.zw);
+
+ highp vec4 ambient_out;
+ ambient_out.a=blend;
+ ambient_out.rgb = textureLod(reflection_atlas,splane.xy,5.0).rgb;
+ ambient_out.rgb=mix(reflections[idx].ambient.rgb,ambient_out.rgb,reflections[idx].ambient.a);
+ if (reflections[idx].params.z < 0.5) {
+ ambient_out.rgb = mix(ambient,ambient_out.rgb,blend);
+ }
+
+ ambient_out.rgb *= ambient_out.a;
+ ambient_accum+=ambient_out;
+ } else {
+
+ highp vec4 ambient_out;
+ ambient_out.a=blend;
+ ambient_out.rgb=reflections[idx].ambient.rgb;
+ if (reflections[idx].params.z < 0.5) {
+ ambient_out.rgb = mix(ambient,ambient_out.rgb,blend);
+ }
+ ambient_out.rgb *= ambient_out.a;
+ ambient_accum+=ambient_out;
+
+ }
+}
+
+#ifdef USE_GI_PROBES
+
+uniform mediump sampler3D gi_probe1; //texunit:-9
+uniform highp mat4 gi_probe_xform1;
+uniform highp vec3 gi_probe_bounds1;
+uniform highp vec3 gi_probe_cell_size1;
+uniform highp float gi_probe_multiplier1;
+uniform highp float gi_probe_bias1;
+uniform highp float gi_probe_normal_bias1;
+uniform bool gi_probe_blend_ambient1;
+
+uniform mediump sampler3D gi_probe2; //texunit:-10
+uniform highp mat4 gi_probe_xform2;
+uniform highp vec3 gi_probe_bounds2;
+uniform highp vec3 gi_probe_cell_size2;
+uniform highp float gi_probe_multiplier2;
+uniform highp float gi_probe_bias2;
+uniform highp float gi_probe_normal_bias2;
+uniform bool gi_probe2_enabled;
+uniform bool gi_probe_blend_ambient2;
+
+vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 ambient, bool blend_ambient, vec3 direction, float tan_half_angle, float max_distance, float p_bias) {
+
+ float dist = p_bias;//1.0; //dot(direction,mix(vec3(-1.0),vec3(1.0),greaterThan(direction,vec3(0.0))))*2.0;
+ float alpha=0.0;
+ vec3 color = vec3(0.0);
+
+ while(dist < max_distance && alpha < 0.95) {
+ float diameter = max(1.0, 2.0 * tan_half_angle * dist);
+ vec4 scolor = textureLod(probe, (pos + dist * direction) * cell_size, log2(diameter) );
+ float a = (1.0 - alpha);
+ color += scolor.rgb * a;
+ alpha += a * scolor.a;
+ dist += diameter * 0.5;
+ }
+
+ if (blend_ambient) {
+ color.rgb = mix(ambient,color.rgb,min(1.0,alpha/0.95));
+ }
+
+ return color;
+}
+
+void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec3 cell_size,vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient,float multiplier, mat3 normal_mtx,vec3 ref_vec, float roughness,float p_bias,float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) {
+
+
+
+ vec3 probe_pos = (probe_xform * vec4(pos,1.0)).xyz;
+ vec3 ref_pos = (probe_xform * vec4(pos+ref_vec,1.0)).xyz;
+ ref_vec = normalize(ref_pos - probe_pos);
+
+ probe_pos+=(probe_xform * vec4(normal_mtx[2],0.0)).xyz*p_normal_bias;
+
+/* out_diff.rgb = voxel_cone_trace(probe,cell_size,probe_pos,normalize((probe_xform * vec4(ref_vec,0.0)).xyz),0.0 ,100.0);
+ out_diff.a = 1.0;
+ return;*/
+ //out_diff = vec4(textureLod(probe,probe_pos*cell_size,3.0).rgb,1.0);
+ //return;
+
+ //this causes corrupted pixels, i have no idea why..
+ if (any(bvec2(any(lessThan(probe_pos,vec3(0.0))),any(greaterThan(probe_pos,bounds))))) {
+ return;
+ }
+
+ //vec3 blendv = probe_pos/bounds * 2.0 - 1.0;
+ //float blend = 1.001-max(blendv.x,max(blendv.y,blendv.z));
+ float blend=1.0;
+
+ float max_distance = length(bounds);
+
+ //radiance
+#ifdef VCT_QUALITY_HIGH
+
+#define MAX_CONE_DIRS 6
+ vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] (
+ vec3(0, 0, 1),
+ vec3(0.866025, 0, 0.5),
+ vec3(0.267617, 0.823639, 0.5),
+ vec3(-0.700629, 0.509037, 0.5),
+ vec3(-0.700629, -0.509037, 0.5),
+ vec3(0.267617, -0.823639, 0.5)
+ );
+
+ float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15);
+ float cone_angle_tan = 0.577;
+ float min_ref_tan = 0.0;
+#else
+
+#define MAX_CONE_DIRS 4
+
+ vec3 cone_dirs[MAX_CONE_DIRS] = vec3[] (
+ vec3(0.707107, 0, 0.707107),
+ vec3(0, 0.707107, 0.707107),
+ vec3(-0.707107, 0, 0.707107),
+ vec3(0, -0.707107, 0.707107)
+ );
+
+ float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25);
+ float cone_angle_tan = 0.98269;
+ max_distance*=0.5;
+ float min_ref_tan = 0.2;
+
+#endif
+ vec3 light=vec3(0.0);
+ for(int i=0;i<MAX_CONE_DIRS;i++) {
+
+ vec3 dir = normalize( (probe_xform * vec4(pos + normal_mtx * cone_dirs[i],1.0)).xyz - probe_pos);
+ light+=cone_weights[i] * voxel_cone_trace(probe,cell_size,probe_pos,ambient,blend_ambient,dir,cone_angle_tan,max_distance,p_bias);
+
+ }
+
+ light*=multiplier;
+
+ out_diff += vec4(light*blend,blend);
+
+ //irradiance
+
+ vec3 irr_light = voxel_cone_trace(probe,cell_size,probe_pos,environment,blend_ambient,ref_vec,max(min_ref_tan,tan(roughness * 0.5 * M_PI)) ,max_distance,p_bias);
+
+ irr_light *= multiplier;
+ //irr_light=vec3(0.0);
+
+ out_spec += vec4(irr_light*blend,blend);
+
+}
+
+
+void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_specular, inout vec3 out_ambient) {
+
+ roughness = roughness * roughness;
+
+ vec3 ref_vec = normalize(reflect(normalize(pos),normal));
+
+ //find arbitrary tangent and bitangent, then build a matrix
+ vec3 v0 = abs(normal.z) < 0.999 ? vec3(0, 0, 1) : vec3(0, 1, 0);
+ vec3 tangent = normalize(cross(v0, normal));
+ vec3 bitangent = normalize(cross(tangent, normal));
+ mat3 normal_mat = mat3(tangent,bitangent,normal);
+
+ vec4 diff_accum = vec4(0.0);
+ vec4 spec_accum = vec4(0.0);
+
+ vec3 ambient = out_ambient;
+ out_ambient = vec3(0.0);
+
+ vec3 environment = out_specular;
+
+ out_specular = vec3(0.0);
+
+ gi_probe_compute(gi_probe1,gi_probe_xform1,gi_probe_bounds1,gi_probe_cell_size1,pos,ambient,environment,gi_probe_blend_ambient1,gi_probe_multiplier1,normal_mat,ref_vec,roughness,gi_probe_bias1,gi_probe_normal_bias1,spec_accum,diff_accum);
+
+ if (gi_probe2_enabled) {
+
+ gi_probe_compute(gi_probe2,gi_probe_xform2,gi_probe_bounds2,gi_probe_cell_size2,pos,ambient,environment,gi_probe_blend_ambient2,gi_probe_multiplier2,normal_mat,ref_vec,roughness,gi_probe_bias2,gi_probe_normal_bias2,spec_accum,diff_accum);
+ }
+
+ if (diff_accum.a>0.0) {
+ diff_accum.rgb/=diff_accum.a;
+ }
+
+ if (spec_accum.a>0.0) {
+ spec_accum.rgb/=spec_accum.a;
+ }
+
+ out_specular+=spec_accum.rgb;
+ out_ambient+=diff_accum.rgb;
+
+}
+
+#endif
+
+
+
+void main() {
+
+#ifdef RENDER_DEPTH_DUAL_PARABOLOID
+
+ if (dp_clip>0.0)
+ discard;
+#endif
+
+ //lay out everything, whathever is unused is optimized away anyway
+ highp vec3 vertex = vertex_interp;
+ vec3 albedo = vec3(0.8,0.8,0.8);
+ vec3 transmission = vec3(0.0);
+ float metallic = 0.0;
+ float specular = 0.5;
+ vec3 emission = vec3(0.0,0.0,0.0);
+ float roughness = 1.0;
+ float rim = 0.0;
+ float rim_tint = 0.0;
+ float clearcoat=0.0;
+ float clearcoat_gloss=0.0;
+ float anisotropy = 1.0;
+ vec2 anisotropy_flow = vec2(1.0,0.0);
+
+#if defined(ENABLE_AO)
+ float ao=1.0;
+ float ao_light_affect=0.0;
+#endif
+
+ float alpha = 1.0;
+
+#ifdef METERIAL_DOUBLESIDED
+ float side=float(gl_FrontFacing)*2.0-1.0;
+#else
+ float side=1.0;
+#endif
+
+
+#if defined(ALPHA_SCISSOR_USED)
+ float alpha_scissor = 0.5;
+#endif
+
+#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
+ vec3 binormal = normalize(binormal_interp)*side;
+ vec3 tangent = normalize(tangent_interp)*side;
+#else
+ vec3 binormal = vec3(0.0);
+ vec3 tangent = vec3(0.0);
+#endif
+ vec3 normal = normalize(normal_interp)*side;
+
+#if defined(ENABLE_UV_INTERP)
+ vec2 uv = uv_interp;
+#endif
+
+#if defined(ENABLE_UV2_INTERP)
+ vec2 uv2 = uv2_interp;
+#endif
+
+#if defined(ENABLE_COLOR_INTERP)
+ vec4 color = color_interp;
+#endif
+
+#if defined(ENABLE_NORMALMAP)
+
+ vec3 normalmap = vec3(0.0);
+#endif
+
+ float normaldepth=1.0;
+
+#if defined(SCREEN_UV_USED)
+ vec2 screen_uv = gl_FragCoord.xy*screen_pixel_size;
+#endif
+
+#if defined (ENABLE_SSS)
+ float sss_strength=0.0;
+#endif
+
+{
+
+
+FRAGMENT_SHADER_CODE
+
+}
+
+
+#if defined(ALPHA_SCISSOR_USED)
+ if (alpha<alpha_scissor) {
+ discard;
+ }
+#endif
+
+#ifdef USE_OPAQUE_PREPASS
+
+ if (alpha<0.99) {
+ discard;
+ }
+#endif
+
+#if defined(ENABLE_NORMALMAP)
+
+ normalmap.xy=normalmap.xy*2.0-1.0;
+ normalmap.z=sqrt(1.0-dot(normalmap.xy,normalmap.xy)); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
+
+ normal = normalize( mix(normal_interp,tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z,normaldepth) ) * side;
+
+#endif
+
+#if defined(LIGHT_USE_ANISOTROPY)
+
+ if (anisotropy>0.01) {
+ //rotation matrix
+ mat3 rot = mat3( tangent, binormal, normal );
+ //make local to space
+ tangent = normalize(rot * vec3(anisotropy_flow.x,anisotropy_flow.y,0.0));
+ binormal = normalize(rot * vec3(-anisotropy_flow.y,anisotropy_flow.x,0.0));
+ }
+
+#endif
+
+#ifdef ENABLE_CLIP_ALPHA
+ if (albedo.a<0.99) {
+ //used for doublepass and shadowmapping
+ discard;
+ }
+#endif
+
+/////////////////////// LIGHTING //////////////////////////////
+
+ //apply energy conservation
+
+#ifdef USE_VERTEX_LIGHTING
+
+ vec3 specular_light = specular_light_interp.rgb;
+ vec3 diffuse_light = diffuse_light_interp.rgb;
+#else
+
+ vec3 specular_light = vec3(0.0,0.0,0.0);
+ vec3 diffuse_light = vec3(0.0,0.0,0.0);
+
+#endif
+
+ vec3 ambient_light;
+ vec3 env_reflection_light = vec3(0.0,0.0,0.0);
+
+ vec3 eye_vec = -normalize( vertex_interp );
+
+
+
+#ifdef USE_RADIANCE_MAP
+
+ if (no_ambient_light) {
+ ambient_light=vec3(0.0,0.0,0.0);
+ } else {
+ {
+
+ { //read radiance from dual paraboloid
+
+ vec3 ref_vec = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n);
+ ref_vec=normalize((radiance_inverse_xform * vec4(ref_vec,0.0)).xyz);
+ vec3 radiance = textureDualParaboloid(radiance_map,ref_vec,roughness) * bg_energy;
+ env_reflection_light = radiance;
+
+ }
+ //no longer a cubemap
+ //vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y);
+
+ }
+
+ {
+
+ vec3 ambient_dir=normalize((radiance_inverse_xform * vec4(normal,0.0)).xyz);
+ vec3 env_ambient=textureDualParaboloid(radiance_map,ambient_dir,1.0) * bg_energy;
+
+ ambient_light=mix(ambient_light_color.rgb,env_ambient,radiance_ambient_contribution);
+ //ambient_light=vec3(0.0,0.0,0.0);
+ }
+ }
+
+#else
+
+ if (no_ambient_light){
+ ambient_light=vec3(0.0,0.0,0.0);
+ } else {
+ ambient_light=ambient_light_color.rgb;
+ }
+#endif
+
+ ambient_light*=ambient_energy;
+
+ float specular_blob_intensity=1.0;
+#if defined(SPECULAR_TOON)
+ specular_blob_intensity*=specular * 2.0;
+#endif
+
+#if defined(USE_LIGHT_DIRECTIONAL)
+
+ vec3 light_attenuation=vec3(1.0);
+
+ float depth_z = -vertex.z;
+#ifdef LIGHT_DIRECTIONAL_SHADOW
+
+#ifdef LIGHT_USE_PSSM4
+ if (depth_z < shadow_split_offsets.w) {
+#elif defined(LIGHT_USE_PSSM2)
+ if (depth_z < shadow_split_offsets.y) {
+#else
+ if (depth_z < shadow_split_offsets.x) {
+#endif //LIGHT_USE_PSSM4
+
+ vec3 pssm_coord;
+ float pssm_fade=0.0;
+
+#ifdef LIGHT_USE_PSSM_BLEND
+ float pssm_blend;
+ vec3 pssm_coord2;
+ bool use_blend=true;
+#endif
+
+
+#ifdef LIGHT_USE_PSSM4
+
+
+ if (depth_z < shadow_split_offsets.y) {
+
+ if (depth_z < shadow_split_offsets.x) {
+
+ highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+
+
+#if defined(LIGHT_USE_PSSM_BLEND)
+
+ splane=(shadow_matrix2 * vec4(vertex,1.0));
+ pssm_coord2=splane.xyz/splane.w;
+ pssm_blend=smoothstep(0.0,shadow_split_offsets.x,depth_z);
+#endif
+
+ } else {
+
+ highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+
+#if defined(LIGHT_USE_PSSM_BLEND)
+ splane=(shadow_matrix3 * vec4(vertex,1.0));
+ pssm_coord2=splane.xyz/splane.w;
+ pssm_blend=smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,depth_z);
+#endif
+
+ }
+ } else {
+
+
+ if (depth_z < shadow_split_offsets.z) {
+
+ highp vec4 splane=(shadow_matrix3 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+
+#if defined(LIGHT_USE_PSSM_BLEND)
+ splane=(shadow_matrix4 * vec4(vertex,1.0));
+ pssm_coord2=splane.xyz/splane.w;
+ pssm_blend=smoothstep(shadow_split_offsets.y,shadow_split_offsets.z,depth_z);
+#endif
+
+ } else {
+
+ highp vec4 splane=(shadow_matrix4 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+ pssm_fade = smoothstep(shadow_split_offsets.z,shadow_split_offsets.w,depth_z);
+
+#if defined(LIGHT_USE_PSSM_BLEND)
+ use_blend=false;
+
+#endif
+
+ }
+ }
+
+
+
+#endif //LIGHT_USE_PSSM4
+
+#ifdef LIGHT_USE_PSSM2
+
+ if (depth_z < shadow_split_offsets.x) {
+
+ highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+
+
+#if defined(LIGHT_USE_PSSM_BLEND)
+
+ splane=(shadow_matrix2 * vec4(vertex,1.0));
+ pssm_coord2=splane.xyz/splane.w;
+ pssm_blend=smoothstep(0.0,shadow_split_offsets.x,depth_z);
+#endif
+
+ } else {
+ highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+ pssm_fade = smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,depth_z);
+#if defined(LIGHT_USE_PSSM_BLEND)
+ use_blend=false;
+
+#endif
+
+ }
+
+#endif //LIGHT_USE_PSSM2
+
+#if !defined(LIGHT_USE_PSSM4) && !defined(LIGHT_USE_PSSM2)
+ { //regular orthogonal
+ highp vec4 splane=(shadow_matrix1 * vec4(vertex,1.0));
+ pssm_coord=splane.xyz/splane.w;
+ }
+#endif
+
+
+ //one one sample
+
+ float shadow = sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp);
+
+#if defined(LIGHT_USE_PSSM_BLEND)
+
+ if (use_blend) {
+ shadow=mix(shadow, sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp),pssm_blend);
+ }
+#endif
+
+#ifdef USE_CONTACT_SHADOWS
+ if (shadow>0.01 && shadow_color_contact.a>0.0) {
+
+ float contact_shadow = contact_shadow_compute(vertex,-light_direction_attenuation.xyz,shadow_color_contact.a);
+ shadow=min(shadow,contact_shadow);
+
+ }
+#endif
+ light_attenuation=mix(mix(shadow_color_contact.rgb,vec3(1.0),shadow),vec3(1.0),pssm_fade);
+
+
+ }
+
+
+#endif //LIGHT_DIRECTIONAL_SHADOW
+
+#ifdef USE_VERTEX_LIGHTING
+ diffuse_light*=mix(vec3(1.0),light_attenuation,diffuse_light_interp.a);
+ specular_light*=mix(vec3(1.0),light_attenuation,specular_light_interp.a);
+
+#else
+ light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb,light_attenuation,albedo,transmission,light_params.z*specular_blob_intensity,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
+#endif
+
+
+#endif //#USE_LIGHT_DIRECTIONAL
+
+#ifdef USE_GI_PROBES
+ gi_probes_compute(vertex,normal,roughness,env_reflection_light,ambient_light);
+
+#endif
+
+#ifdef USE_FORWARD_LIGHTING
+
+
+ highp vec4 reflection_accum = vec4(0.0,0.0,0.0,0.0);
+ highp vec4 ambient_accum = vec4(0.0,0.0,0.0,0.0);
+ for(int i=0;i<reflection_count;i++) {
+ reflection_process(reflection_indices[i],vertex,normal,binormal,tangent,roughness,anisotropy,ambient_light,env_reflection_light,reflection_accum,ambient_accum);
+ }
+
+ if (reflection_accum.a>0.0) {
+ specular_light+=reflection_accum.rgb/reflection_accum.a;
+ } else {
+ specular_light+=env_reflection_light;
+ }
+
+ if (ambient_accum.a>0.0) {
+ ambient_light+=ambient_accum.rgb/ambient_accum.a;
+ }
+
+
+
+#ifdef USE_VERTEX_LIGHTING
+
+ diffuse_light*=albedo;
+#else
+
+ for(int i=0;i<omni_light_count;i++) {
+ light_process_omni(omni_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,transmission,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light);
+ }
+
+ for(int i=0;i<spot_light_count;i++) {
+ light_process_spot(spot_light_indices[i],vertex,eye_vec,normal,binormal,tangent,albedo,transmission,roughness,metallic,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,specular_blob_intensity,diffuse_light,specular_light);
+ }
+
+#endif //USE_VERTEX_LIGHTING
+
+#endif
+
+
+
+
+#ifdef RENDER_DEPTH
+//nothing happens, so a tree-ssa optimizer will result in no fragment shader :)
+#else
+
+ specular_light*=reflection_multiplier;
+ ambient_light*=albedo; //ambient must be multiplied by albedo at the end
+
+#if defined(ENABLE_AO)
+ ambient_light*=ao;
+ ao_light_affect = mix(1.0,ao,ao_light_affect);
+ specular_light*=ao_light_affect;
+ diffuse_light*=ao_light_affect;
+#endif
+
+
+
+ //energy conservation
+ diffuse_light *= 1.0-metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
+ ambient_light *= 1.0-metallic;
+
+
+ {
+
+#if defined(DIFFUSE_TOON)
+ //simplify for toon, as
+ specular_light *= specular * metallic * albedo * 2.0;
+#else
+ // Environment brdf approximation (Lazarov 2013)
+ // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile
+ const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
+ const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04);
+ vec4 r = roughness * c0 + c1;
+ float ndotv = clamp(dot(normal,eye_vec),0.0,1.0);
+ float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y;
+ vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;
+
+ vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo);
+ specular_light *= AB.x * specular_color + AB.y;
+#endif
+
+ }
+
+ if (fog_color_enabled.a > 0.5) {
+
+ float fog_amount=0.0;
+
+
+
+#ifdef USE_LIGHT_DIRECTIONAL
+
+ vec3 fog_color = mix( fog_color_enabled.rgb, fog_sun_color_amount.rgb,fog_sun_color_amount.a * pow(max( dot(normalize(vertex),-light_direction_attenuation.xyz), 0.0),8.0) );
+#else
+
+ vec3 fog_color = fog_color_enabled.rgb;
+#endif
+
+ //apply fog
+
+ if (fog_depth_enabled) {
+
+ float fog_z = smoothstep(fog_depth_begin,z_far,length(vertex));
+
+ fog_amount = pow(fog_z,fog_depth_curve);
+ if (fog_transmit_enabled) {
+ vec3 total_light = emission + ambient_light + specular_light + diffuse_light;
+ float transmit = pow(fog_z,fog_transmit_curve);
+ fog_color = mix(max(total_light,fog_color),fog_color,transmit);
+ }
+ }
+
+ if (fog_height_enabled) {
+ float y = (camera_matrix * vec4(vertex,1.0)).y;
+ fog_amount = max(fog_amount,pow(smoothstep(fog_height_min,fog_height_max,y),fog_height_curve));
+ }
+
+ float rev_amount = 1.0 - fog_amount;
+
+
+ emission = emission * rev_amount + fog_color * fog_amount;
+ ambient_light*=rev_amount;
+ specular_light*rev_amount;
+ diffuse_light*=rev_amount;
+
+ }
+
+#ifdef USE_MULTIPLE_RENDER_TARGETS
+
+
+#ifdef SHADELESS
+ diffuse_buffer=vec4(albedo.rgb,0.0);
+ specular_buffer=vec4(0.0);
+
+#else
+
+#if defined(ENABLE_AO)
+
+ float ambient_scale=0.0; // AO is supplied by material
+#else
+ //approximate ambient scale for SSAO, since we will lack full ambient
+ float max_emission=max(emission.r,max(emission.g,emission.b));
+ float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b));
+ float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b));
+ float total_ambient = max_ambient+max_diffuse+max_emission;
+ float ambient_scale = (total_ambient>0.0) ? (max_ambient+ambient_occlusion_affect_light*max_diffuse)/total_ambient : 0.0;
+#endif //ENABLE_AO
+
+ diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale);
+ specular_buffer=vec4(specular_light,metallic);
+
+#endif //SHADELESS
+
+ normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness);
+
+#if defined (ENABLE_SSS)
+ sss_buffer = sss_strength;
+#endif
+
+
+#else //USE_MULTIPLE_RENDER_TARGETS
+
+
+#ifdef SHADELESS
+ frag_color=vec4(albedo,alpha);
+#else
+ frag_color=vec4(emission+ambient_light+diffuse_light+specular_light,alpha);
+#endif //SHADELESS
+
+
+#endif //USE_MULTIPLE_RENDER_TARGETS
+
+
+
+#endif //RENDER_DEPTH
+
+
+}
diff --git a/drivers/gles2/shaders/screen_space_reflection.glsl b/drivers/gles2/shaders/screen_space_reflection.glsl
new file mode 100644
index 0000000000..b2e6f7a736
--- /dev/null
+++ b/drivers/gles2/shaders/screen_space_reflection.glsl
@@ -0,0 +1,318 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+out vec2 pos_interp;
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+ pos_interp.xy=gl_Position.xy;
+}
+
+[fragment]
+
+
+in vec2 uv_interp;
+in vec2 pos_interp;
+
+uniform sampler2D source_diffuse; //texunit:0
+uniform sampler2D source_normal_roughness; //texunit:1
+uniform sampler2D source_depth; //texunit:2
+
+uniform float camera_z_near;
+uniform float camera_z_far;
+
+uniform vec2 viewport_size;
+uniform vec2 pixel_size;
+
+uniform float filter_mipmap_levels;
+
+uniform mat4 inverse_projection;
+uniform mat4 projection;
+
+uniform int num_steps;
+uniform float depth_tolerance;
+uniform float distance_fade;
+uniform float curve_fade_in;
+
+
+layout(location = 0) out vec4 frag_color;
+
+
+vec2 view_to_screen(vec3 view_pos,out float w) {
+ vec4 projected = projection * vec4(view_pos, 1.0);
+ projected.xyz /= projected.w;
+ projected.xy = projected.xy * 0.5 + 0.5;
+ w=projected.w;
+ return projected.xy;
+}
+
+
+
+#define M_PI 3.14159265359
+
+void main() {
+
+
+ ////
+
+ vec4 diffuse = texture( source_diffuse, uv_interp );
+ vec4 normal_roughness = texture( source_normal_roughness, uv_interp);
+
+ vec3 normal;
+
+ normal = normal_roughness.xyz*2.0-1.0;
+
+ float roughness = normal_roughness.w;
+
+ float depth_tex = texture(source_depth,uv_interp).r;
+
+ vec4 world_pos = inverse_projection * vec4( uv_interp*2.0-1.0, depth_tex*2.0-1.0, 1.0 );
+ vec3 vertex = world_pos.xyz/world_pos.w;
+
+ vec3 view_dir = normalize(vertex);
+ vec3 ray_dir = normalize(reflect(view_dir, normal));
+
+ if (dot(ray_dir,normal)<0.001) {
+ frag_color=vec4(0.0);
+ return;
+ }
+ //ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0);
+
+ //ray_dir = normalize(vec3(1,1,-1));
+
+
+ ////////////////
+
+
+ //make ray length and clip it against the near plane (don't want to trace beyond visible)
+ float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far;
+ vec3 ray_end = vertex + ray_dir*ray_len;
+
+ float w_begin;
+ vec2 vp_line_begin = view_to_screen(vertex,w_begin);
+ float w_end;
+ vec2 vp_line_end = view_to_screen( ray_end, w_end);
+ vec2 vp_line_dir = vp_line_end-vp_line_begin;
+
+ //we need to interpolate w along the ray, to generate perspective correct reflections
+
+ w_begin = 1.0/w_begin;
+ w_end = 1.0/w_end;
+
+
+ float z_begin = vertex.z*w_begin;
+ float z_end = ray_end.z*w_end;
+
+ vec2 line_begin = vp_line_begin/pixel_size;
+ vec2 line_dir = vp_line_dir/pixel_size;
+ float z_dir = z_end - z_begin;
+ float w_dir = w_end - w_begin;
+
+
+ // clip the line to the viewport edges
+
+ float scale_max_x = min(1.0, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x));
+ float scale_max_y = min(1.0, 0.99 * (1.0 - vp_line_begin.y) / max(1e-5, vp_line_dir.y));
+ float scale_min_x = min(1.0, 0.99 * vp_line_begin.x / max(1e-5, -vp_line_dir.x));
+ float scale_min_y = min(1.0, 0.99 * vp_line_begin.y / max(1e-5, -vp_line_dir.y));
+ float line_clip = min(scale_max_x, scale_max_y) * min(scale_min_x, scale_min_y);
+ line_dir *= line_clip;
+ z_dir *= line_clip;
+ w_dir *=line_clip;
+
+ //clip z and w advance to line advance
+ vec2 line_advance = normalize(line_dir); //down to pixel
+ float step_size = length(line_advance)/length(line_dir);
+ float z_advance = z_dir*step_size; // adapt z advance to line advance
+ float w_advance = w_dir*step_size; // adapt w advance to line advance
+
+ //make line advance faster if direction is closer to pixel edges (this avoids sampling the same pixel twice)
+ float advance_angle_adj = 1.0/max(abs(line_advance.x),abs(line_advance.y));
+ line_advance*=advance_angle_adj; // adapt z advance to line advance
+ z_advance*=advance_angle_adj;
+ w_advance*=advance_angle_adj;
+
+ vec2 pos = line_begin;
+ float z = z_begin;
+ float w = w_begin;
+ float z_from=z/w;
+ float z_to=z_from;
+ float depth;
+ vec2 prev_pos=pos;
+
+ bool found=false;
+
+ float steps_taken=0.0;
+
+ for(int i=0;i<num_steps;i++) {
+
+ pos+=line_advance;
+ z+=z_advance;
+ w+=w_advance;
+
+ //convert to linear depth
+
+ depth = texture(source_depth, pos*pixel_size).r * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
+#endif
+ depth=-depth;
+
+ z_from = z_to;
+ z_to = z/w;
+
+ if (depth>z_to) {
+ //if depth was surpassed
+ if (depth<=max(z_to,z_from)+depth_tolerance) {
+ //check the depth tolerance
+ found=true;
+ }
+ break;
+ }
+
+ steps_taken+=1.0;
+ prev_pos=pos;
+ }
+
+
+
+
+ if (found) {
+
+ float margin_blend=1.0;
+
+
+ vec2 margin = vec2((viewport_size.x+viewport_size.y)*0.5*0.05); //make a uniform margin
+ if (any(bvec4(lessThan(pos,-margin),greaterThan(pos,viewport_size+margin)))) {
+ //clip outside screen + margin
+ frag_color=vec4(0.0);
+ return;
+ }
+
+ {
+ //blend fading out towards external margin
+ vec2 margin_grad = mix(pos-viewport_size,-pos,lessThan(pos,vec2(0.0)));
+ margin_blend = 1.0-smoothstep(0.0,margin.x,max(margin_grad.x,margin_grad.y));
+ //margin_blend=1.0;
+
+ }
+
+ vec2 final_pos;
+ float grad;
+ grad=steps_taken/float(num_steps);
+ float initial_fade = curve_fade_in==0.0 ? 1.0 : pow(clamp(grad,0.0,1.0),curve_fade_in);
+ float fade = pow(clamp(1.0-grad,0.0,1.0),distance_fade)*initial_fade;
+ final_pos=pos;
+
+
+
+
+
+
+
+#ifdef REFLECT_ROUGHNESS
+
+
+ vec4 final_color;
+ //if roughness is enabled, do screen space cone tracing
+ if (roughness > 0.001) {
+ ///////////////////////////////////////////////////////////////////////////////////////
+ //use a blurred version (in consecutive mipmaps) of the screen to simulate roughness
+
+ float gloss = 1.0-roughness;
+ float cone_angle = roughness * M_PI * 0.5;
+ vec2 cone_dir = final_pos - line_begin;
+ float cone_len = length(cone_dir);
+ cone_dir = normalize(cone_dir); //will be used normalized from now on
+ float max_mipmap = filter_mipmap_levels - 1.0;
+ float gloss_mult=gloss;
+
+ float rem_alpha=1.0;
+ final_color = vec4(0.0);
+
+ for(int i=0;i<7;i++) {
+
+ float op_len = 2.0 * tan(cone_angle) * cone_len; //opposite side of iso triangle
+ float radius;
+ {
+ //fit to sphere inside cone (sphere ends at end of cone), something like this:
+ // ___
+ // \O/
+ // V
+ //
+ // as it avoids bleeding from beyond the reflection as much as possible. As a plus
+ // it also makes the rough reflection more elongated.
+ float a = op_len;
+ float h = cone_len;
+ float a2 = a * a;
+ float fh2 = 4.0f * h * h;
+ radius = (a * (sqrt(a2 + fh2) - a)) / (4.0f * h);
+ }
+
+ //find the place where screen must be sampled
+ vec2 sample_pos = ( line_begin + cone_dir * (cone_len - radius) ) * pixel_size;
+ //radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels
+ float mipmap = clamp( log2( radius ), 0.0, max_mipmap );
+
+ //mipmap = max(mipmap-1.0,0.0);
+ //do sampling
+
+ vec4 sample_color;
+ {
+ sample_color = textureLod(source_diffuse,sample_pos,mipmap);
+ }
+
+ //multiply by gloss
+ sample_color.rgb*=gloss_mult;
+ sample_color.a=gloss_mult;
+
+ rem_alpha -= sample_color.a;
+ if(rem_alpha < 0.0) {
+ sample_color.rgb *= (1.0 - abs(rem_alpha));
+ }
+
+ final_color+=sample_color;
+
+ if (final_color.a>=0.95) {
+ // This code of accumulating gloss and aborting on near one
+ // makes sense when you think of cone tracing.
+ // Think of it as if roughness was 0, then we could abort on the first
+ // iteration. For lesser roughness values, we need more iterations, but
+ // each needs to have less influence given the sphere is smaller
+ break;
+ }
+
+ cone_len-=radius*2.0; //go to next (smaller) circle.
+
+ gloss_mult*=gloss;
+
+
+ }
+ } else {
+ final_color = textureLod(source_diffuse,final_pos*pixel_size,0.0);
+ }
+
+ frag_color = vec4(final_color.rgb,fade*margin_blend);
+
+#else
+ frag_color = vec4(textureLod(source_diffuse,final_pos*pixel_size,0.0).rgb,fade*margin_blend);
+#endif
+
+
+
+ } else {
+ frag_color = vec4(0.0,0.0,0.0,0.0);
+ }
+
+
+
+}
+
diff --git a/drivers/gles2/shaders/ssao.glsl b/drivers/gles2/shaders/ssao.glsl
new file mode 100644
index 0000000000..219f0957e0
--- /dev/null
+++ b/drivers/gles2/shaders/ssao.glsl
@@ -0,0 +1,293 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+
+void main() {
+
+ gl_Position = vertex_attrib;
+ gl_Position.z=1.0;
+}
+
+[fragment]
+
+#define TWO_PI 6.283185307179586476925286766559
+
+#ifdef SSAO_QUALITY_HIGH
+
+#define NUM_SAMPLES (80)
+
+#endif
+
+#ifdef SSAO_QUALITY_LOW
+
+#define NUM_SAMPLES (15)
+
+#endif
+
+#if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH)
+
+#define NUM_SAMPLES (40)
+
+#endif
+
+// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower
+// miplevel to maintain reasonable spatial locality in the cache
+// If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing.
+// If it is too high (> 5), we'll get bad performance because we're not using the MIP levels effectively
+#define LOG_MAX_OFFSET (3)
+
+// This must be less than or equal to the MAX_MIP_LEVEL defined in SSAO.cpp
+#define MAX_MIP_LEVEL (4)
+
+// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent
+// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9
+
+const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2,
+3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
+9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
+11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
+11, 11, 13, 12, 13, 19, 17, 13, 11, 18,
+19, 11, 11, 14, 17, 21, 15, 16, 17, 18,
+13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
+29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
+31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
+19, 27, 21, 25, 39, 29, 17, 21, 27 );
+
+//#define NUM_SPIRAL_TURNS (7)
+const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES-1];
+
+uniform sampler2D source_depth; //texunit:0
+uniform highp usampler2D source_depth_mipmaps; //texunit:1
+uniform sampler2D source_normal; //texunit:2
+
+uniform ivec2 screen_size;
+uniform float camera_z_far;
+uniform float camera_z_near;
+
+uniform float intensity_div_r6;
+uniform float radius;
+
+#ifdef ENABLE_RADIUS2
+uniform float intensity_div_r62;
+uniform float radius2;
+#endif
+
+uniform float bias;
+uniform float proj_scale;
+
+layout(location = 0) out float visibility;
+
+uniform vec4 proj_info;
+
+vec3 reconstructCSPosition(vec2 S, float z) {
+#ifdef USE_ORTHOGONAL_PROJECTION
+ return vec3((S.xy * proj_info.xy + proj_info.zw), z);
+#else
+ return vec3((S.xy * proj_info.xy + proj_info.zw) * z, z);
+
+#endif
+}
+
+vec3 getPosition(ivec2 ssP) {
+ vec3 P;
+ P.z = texelFetch(source_depth, ssP, 0).r;
+
+ P.z = P.z * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
+#endif
+ P.z = -P.z;
+
+ // Offset to pixel center
+ P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
+ return P;
+}
+
+/** Reconstructs screen-space unit normal from screen-space position */
+vec3 reconstructCSFaceNormal(vec3 C) {
+ return normalize(cross(dFdy(C), dFdx(C)));
+}
+
+
+
+/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */
+vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){
+ // Radius relative to ssR
+ float alpha = (float(sampleNumber) + 0.5) * (1.0 / float(NUM_SAMPLES));
+ float angle = alpha * (float(NUM_SPIRAL_TURNS) * 6.28) + spinAngle;
+
+ ssR = alpha;
+ return vec2(cos(angle), sin(angle));
+}
+
+
+/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */
+vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
+ // Derivation:
+ // mipLevel = floor(log(ssR / MAX_OFFSET));
+ int mipLevel = clamp(int(floor(log2(ssR))) - LOG_MAX_OFFSET, 0, MAX_MIP_LEVEL);
+
+ ivec2 ssP = ivec2(ssR * unitOffset) + ssC;
+
+ vec3 P;
+
+ // We need to divide by 2^mipLevel to read the appropriately scaled coordinate from a MIP-map.
+ // Manually clamp to the texture size because texelFetch bypasses the texture unit
+ ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1));
+
+
+ if (mipLevel < 1) {
+ //read from depth buffer
+ P.z = texelFetch(source_depth, mipP, 0).r;
+ P.z = P.z * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ P.z = ((P.z + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
+
+#endif
+ P.z = -P.z;
+
+ } else {
+ //read from mipmaps
+ uint d = texelFetch(source_depth_mipmaps, mipP, mipLevel-1).r;
+ P.z = -(float(d)/65535.0)*camera_z_far;
+ }
+
+
+ // Offset to pixel center
+ P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
+
+ return P;
+}
+
+
+
+/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds
+ to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
+
+ Note that units of H() in the HPG12 paper are meters, not
+ unitless. The whole falloff/sampling function is therefore
+ unitless. In this implementation, we factor out (9 / radius).
+
+ Four versions of the falloff function are implemented below
+*/
+float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in float p_radius, in int tapIndex, in float randomPatternRotationAngle) {
+ // Offset on the unit disk, spun for this pixel
+ float ssR;
+ vec2 unitOffset = tapLocation(tapIndex, randomPatternRotationAngle, ssR);
+ ssR *= ssDiskRadius;
+
+ // The occluding point in camera space
+ vec3 Q = getOffsetPosition(ssC, unitOffset, ssR);
+
+ vec3 v = Q - C;
+
+ float vv = dot(v, v);
+ float vn = dot(v, n_C);
+
+ const float epsilon = 0.01;
+ float radius2 = p_radius*p_radius;
+
+ // A: From the HPG12 paper
+ // Note large epsilon to avoid overdarkening within cracks
+ //return float(vv < radius2) * max((vn - bias) / (epsilon + vv), 0.0) * radius2 * 0.6;
+
+ // B: Smoother transition to zero (lowers contrast, smoothing out corners). [Recommended]
+ float f=max(radius2 - vv, 0.0);
+ return f * f * f * max((vn - bias) / (epsilon + vv), 0.0);
+
+ // C: Medium contrast (which looks better at high radii), no division. Note that the
+ // contribution still falls off with radius^2, but we've adjusted the rate in a way that is
+ // more computationally efficient and happens to be aesthetically pleasing.
+ // return 4.0 * max(1.0 - vv * invRadius2, 0.0) * max(vn - bias, 0.0);
+
+ // D: Low contrast, no division operation
+ // return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);
+}
+
+
+
+void main() {
+
+
+ // Pixel being shaded
+ ivec2 ssC = ivec2(gl_FragCoord.xy);
+
+ // World space point being shaded
+ vec3 C = getPosition(ssC);
+
+/* if (C.z <= -camera_z_far*0.999) {
+ // We're on the skybox
+ visibility=1.0;
+ return;
+ }*/
+
+ //visibility=-C.z/camera_z_far;
+ //return;
+#if 0
+ vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0;
+#else
+ vec3 n_C = reconstructCSFaceNormal(C);
+ n_C = -n_C;
+#endif
+
+ // Hash function used in the HPG12 AlchemyAO paper
+ float randomPatternRotationAngle = mod(float((3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10), TWO_PI);
+
+ // Reconstruct normals from positions. These will lead to 1-pixel black lines
+ // at depth discontinuities, however the blur will wipe those out so they are not visible
+ // in the final image.
+
+ // Choose the screen-space sample radius
+ // proportional to the projected area of the sphere
+#ifdef USE_ORTHOGONAL_PROJECTION
+ float ssDiskRadius = -proj_scale * radius;
+#else
+ float ssDiskRadius = -proj_scale * radius / C.z;
+#endif
+ float sum = 0.0;
+ for (int i = 0; i < NUM_SAMPLES; ++i) {
+ sum += sampleAO(ssC, C, n_C, ssDiskRadius, radius,i, randomPatternRotationAngle);
+ }
+
+ float A = max(0.0, 1.0 - sum * intensity_div_r6 * (5.0 / float(NUM_SAMPLES)));
+
+#ifdef ENABLE_RADIUS2
+
+ //go again for radius2
+ randomPatternRotationAngle = mod(float((5 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 11), TWO_PI);
+
+ // Reconstruct normals from positions. These will lead to 1-pixel black lines
+ // at depth discontinuities, however the blur will wipe those out so they are not visible
+ // in the final image.
+
+ // Choose the screen-space sample radius
+ // proportional to the projected area of the sphere
+ ssDiskRadius = -proj_scale * radius2 / C.z;
+
+ sum = 0.0;
+ for (int i = 0; i < NUM_SAMPLES; ++i) {
+ sum += sampleAO(ssC, C, n_C, ssDiskRadius,radius2, i, randomPatternRotationAngle);
+ }
+
+ A= min(A,max(0.0, 1.0 - sum * intensity_div_r62 * (5.0 / float(NUM_SAMPLES))));
+#endif
+ // Bilateral box-filter over a quad for free, respecting depth edges
+ // (the difference that this makes is subtle)
+ if (abs(dFdx(C.z)) < 0.02) {
+ A -= dFdx(A) * (float(ssC.x & 1) - 0.5);
+ }
+ if (abs(dFdy(C.z)) < 0.02) {
+ A -= dFdy(A) * (float(ssC.y & 1) - 0.5);
+ }
+
+ visibility = A;
+
+}
+
+
+
diff --git a/drivers/gles2/shaders/ssao_blur.glsl b/drivers/gles2/shaders/ssao_blur.glsl
new file mode 100644
index 0000000000..472dc21acf
--- /dev/null
+++ b/drivers/gles2/shaders/ssao_blur.glsl
@@ -0,0 +1,124 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+
+
+void main() {
+
+ gl_Position = vertex_attrib;
+ gl_Position.z=1.0;
+}
+
+[fragment]
+
+
+uniform sampler2D source_ssao; //texunit:0
+uniform sampler2D source_depth; //texunit:1
+uniform sampler2D source_normal; //texunit:3
+
+
+layout(location = 0) out float visibility;
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// Tunable Parameters:
+
+/** Increase to make depth edges crisper. Decrease to reduce flicker. */
+uniform float edge_sharpness;
+
+/** Step in 2-pixel intervals since we already blurred against neighbors in the
+ first AO pass. This constant can be increased while R decreases to improve
+ performance at the expense of some dithering artifacts.
+
+ Morgan found that a scale of 3 left a 1-pixel checkerboard grid that was
+ unobjectionable after shading was applied but eliminated most temporal incoherence
+ from using small numbers of sample taps.
+ */
+
+uniform int filter_scale;
+
+/** Filter radius in pixels. This will be multiplied by SCALE. */
+#define R (4)
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+
+// Gaussian coefficients
+const float gaussian[R + 1] =
+// float[](0.356642, 0.239400, 0.072410, 0.009869);
+// float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
+ float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
+// float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
+
+/** (1, 0) or (0, 1)*/
+uniform ivec2 axis;
+
+uniform float camera_z_far;
+uniform float camera_z_near;
+
+uniform ivec2 screen_size;
+
+void main() {
+
+ ivec2 ssC = ivec2(gl_FragCoord.xy);
+
+ float depth = texelFetch(source_depth, ssC, 0).r;
+ //vec3 normal = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0;
+
+ depth = depth * 2.0 - 1.0;
+ depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
+
+ float depth_divide = 1.0 / camera_z_far;
+
+// depth*=depth_divide;
+
+ /*
+ if (depth > camera_z_far*0.999) {
+ discard;//skybox
+ }
+ */
+
+ float sum = texelFetch(source_ssao, ssC, 0).r;
+
+ // Base weight for depth falloff. Increase this for more blurriness,
+ // decrease it for better edge discrimination
+ float BASE = gaussian[0];
+ float totalWeight = BASE;
+ sum *= totalWeight;
+
+ ivec2 clamp_limit = screen_size - ivec2(1);
+
+ for (int r = -R; r <= R; ++r) {
+ // We already handled the zero case above. This loop should be unrolled and the static branch optimized out,
+ // so the IF statement has no runtime cost
+ if (r != 0) {
+
+ ivec2 ppos = ssC + axis * (r * filter_scale);
+ float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r;
+ ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit);
+ float temp_depth = texelFetch(source_depth, rpos, 0).r;
+ //vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0;
+
+ temp_depth = temp_depth * 2.0 - 1.0;
+ temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near));
+// temp_depth *= depth_divide;
+
+ // spatial domain: offset gaussian tap
+ float weight = 0.3 + gaussian[abs(r)];
+ //weight *= max(0.0,dot(temp_normal,normal));
+
+ // range domain (the "bilateral" weight). As depth difference increases, decrease weight.
+ weight *= max(0.0, 1.0
+ - edge_sharpness * abs(temp_depth - depth)
+ );
+
+ sum += value * weight;
+ totalWeight += weight;
+ }
+ }
+
+ const float epsilon = 0.0001;
+ visibility = sum / (totalWeight + epsilon);
+}
diff --git a/drivers/gles2/shaders/ssao_minify.glsl b/drivers/gles2/shaders/ssao_minify.glsl
new file mode 100644
index 0000000000..647c762438
--- /dev/null
+++ b/drivers/gles2/shaders/ssao_minify.glsl
@@ -0,0 +1,59 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+
+void main() {
+
+ gl_Position = vertex_attrib;
+}
+
+[fragment]
+
+
+#ifdef MINIFY_START
+
+#define SDEPTH_TYPE highp sampler2D
+uniform float camera_z_far;
+uniform float camera_z_near;
+
+#else
+
+#define SDEPTH_TYPE mediump usampler2D
+
+#endif
+
+uniform SDEPTH_TYPE source_depth; //texunit:0
+
+uniform ivec2 from_size;
+uniform int source_mipmap;
+
+layout(location = 0) out mediump uint depth;
+
+void main() {
+
+
+ ivec2 ssP = ivec2(gl_FragCoord.xy);
+
+ // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
+ // On DX9, the bit-and can be implemented with floating-point modulo
+
+#ifdef MINIFY_START
+ float fdepth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
+ fdepth = fdepth * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ fdepth = ((fdepth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ fdepth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - fdepth * (camera_z_far - camera_z_near));
+#endif
+ fdepth /= camera_z_far;
+ depth = uint(clamp(fdepth*65535.0,0.0,65535.0));
+
+#else
+ depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
+#endif
+
+
+}
+
+
diff --git a/drivers/gles2/shaders/subsurf_scattering.glsl b/drivers/gles2/shaders/subsurf_scattering.glsl
new file mode 100644
index 0000000000..fc66d66198
--- /dev/null
+++ b/drivers/gles2/shaders/subsurf_scattering.glsl
@@ -0,0 +1,192 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+
+
+void main() {
+
+ uv_interp = uv_in;
+ gl_Position = vertex_attrib;
+}
+
+[fragment]
+
+//#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
+#define QUALIFIER const
+
+#ifdef USE_25_SAMPLES
+
+const int kernel_size=25;
+QUALIFIER vec2 kernel[25] = vec2[] (
+ vec2(0.530605, 0.0),
+ vec2(0.000973794, -3.0),
+ vec2(0.00333804, -2.52083),
+ vec2(0.00500364, -2.08333),
+ vec2(0.00700976, -1.6875),
+ vec2(0.0094389, -1.33333),
+ vec2(0.0128496, -1.02083),
+ vec2(0.017924, -0.75),
+ vec2(0.0263642, -0.520833),
+ vec2(0.0410172, -0.333333),
+ vec2(0.0493588, -0.1875),
+ vec2(0.0402784, -0.0833333),
+ vec2(0.0211412, -0.0208333),
+ vec2(0.0211412, 0.0208333),
+ vec2(0.0402784, 0.0833333),
+ vec2(0.0493588, 0.1875),
+ vec2(0.0410172, 0.333333),
+ vec2(0.0263642, 0.520833),
+ vec2(0.017924, 0.75),
+ vec2(0.0128496, 1.02083),
+ vec2(0.0094389, 1.33333),
+ vec2(0.00700976, 1.6875),
+ vec2(0.00500364, 2.08333),
+ vec2(0.00333804, 2.52083),
+ vec2(0.000973794, 3.0)
+);
+
+#endif //USE_25_SAMPLES
+
+#ifdef USE_17_SAMPLES
+
+const int kernel_size=17;
+
+QUALIFIER vec2 kernel[17] = vec2[](
+ vec2(0.536343, 0.0),
+ vec2(0.00317394, -2.0),
+ vec2(0.0100386, -1.53125),
+ vec2(0.0144609, -1.125),
+ vec2(0.0216301, -0.78125),
+ vec2(0.0347317, -0.5),
+ vec2(0.0571056, -0.28125),
+ vec2(0.0582416, -0.125),
+ vec2(0.0324462, -0.03125),
+ vec2(0.0324462, 0.03125),
+ vec2(0.0582416, 0.125),
+ vec2(0.0571056, 0.28125),
+ vec2(0.0347317, 0.5),
+ vec2(0.0216301, 0.78125),
+ vec2(0.0144609, 1.125),
+ vec2(0.0100386, 1.53125),
+ vec2(0.00317394,2.0)
+);
+
+#endif //USE_17_SAMPLES
+
+
+#ifdef USE_11_SAMPLES
+
+const int kernel_size=11;
+
+QUALIFIER vec2 kernel[11] = vec2[](
+ vec2(0.560479, 0.0),
+ vec2(0.00471691, -2.0),
+ vec2(0.0192831, -1.28),
+ vec2(0.03639, -0.72),
+ vec2(0.0821904, -0.32),
+ vec2(0.0771802, -0.08),
+ vec2(0.0771802, 0.08),
+ vec2(0.0821904, 0.32),
+ vec2(0.03639, 0.72),
+ vec2(0.0192831, 1.28),
+ vec2(0.00471691,2.0)
+);
+
+#endif //USE_11_SAMPLES
+
+
+
+uniform float max_radius;
+uniform float camera_z_far;
+uniform float camera_z_near;
+uniform float unit_size;
+uniform vec2 dir;
+in vec2 uv_interp;
+
+uniform sampler2D source_diffuse; //texunit:0
+uniform sampler2D source_sss; //texunit:1
+uniform sampler2D source_depth; //texunit:2
+
+layout(location = 0) out vec4 frag_color;
+
+void main() {
+
+ float strength = texture(source_sss,uv_interp).r;
+ strength*=strength; //stored as sqrt
+
+ // Fetch color of current pixel:
+ vec4 base_color = texture(source_diffuse, uv_interp);
+
+
+ if (strength>0.0) {
+
+
+ // Fetch linear depth of current pixel:
+ float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0;
+#ifdef USE_ORTHOGONAL_PROJECTION
+ depth = ((depth + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+ float scale = unit_size; //remember depth is negative by default in OpenGL
+#else
+ depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near));
+ float scale = unit_size / depth; //remember depth is negative by default in OpenGL
+#endif
+
+
+
+ // Calculate the final step to fetch the surrounding pixels:
+ vec2 step = max_radius * scale * dir;
+ step *= strength; // Modulate it using the alpha channel.
+ step *= 1.0 / 3.0; // Divide by 3 as the kernels range from -3 to 3.
+
+ // Accumulate the center sample:
+ vec3 color_accum = base_color.rgb;
+ color_accum *= kernel[0].x;
+#ifdef ENABLE_STRENGTH_WEIGHTING
+ float color_weight = kernel[0].x;
+#endif
+
+ // Accumulate the other samples:
+ for (int i = 1; i < kernel_size; i++) {
+ // Fetch color and depth for current sample:
+ vec2 offset = uv_interp + kernel[i].y * step;
+ vec3 color = texture(source_diffuse, offset).rgb;
+
+#ifdef ENABLE_FOLLOW_SURFACE
+ // If the difference in depth is huge, we lerp color back to "colorM":
+ float depth_cmp = texture(source_depth, offset).r *2.0 - 1.0;
+
+#ifdef USE_ORTHOGONAL_PROJECTION
+ depth_cmp = ((depth_cmp + (camera_z_far + camera_z_near)/(camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near))/2.0;
+#else
+ depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near));
+#endif
+
+ float s = clamp(300.0f * scale *
+ max_radius * abs(depth - depth_cmp),0.0,1.0);
+ color = mix(color, base_color.rgb, s);
+#endif
+
+ // Accumulate:
+ color*=kernel[i].x;
+
+#ifdef ENABLE_STRENGTH_WEIGHTING
+ float color_s = texture(source_sss, offset).r;
+ color_weight+=color_s * kernel[i].x;
+ color*=color_s;
+#endif
+ color_accum += color;
+
+ }
+
+#ifdef ENABLE_STRENGTH_WEIGHTING
+ color_accum/=color_weight;
+#endif
+ frag_color = vec4(color_accum,base_color.a); //keep alpha (used for SSAO)
+ } else {
+ frag_color = base_color;
+ }
+}
diff --git a/drivers/gles2/shaders/tonemap.glsl b/drivers/gles2/shaders/tonemap.glsl
new file mode 100644
index 0000000000..2f671158b2
--- /dev/null
+++ b/drivers/gles2/shaders/tonemap.glsl
@@ -0,0 +1,323 @@
+[vertex]
+
+
+layout(location=0) in highp vec4 vertex_attrib;
+layout(location=4) in vec2 uv_in;
+
+out vec2 uv_interp;
+
+void main() {
+
+ gl_Position = vertex_attrib;
+ uv_interp = uv_in;
+#ifdef V_FLIP
+ uv_interp.y = 1.0-uv_interp.y;
+#endif
+
+}
+
+[fragment]
+
+#if !defined(GLES_OVER_GL)
+precision mediump float;
+#endif
+
+
+in vec2 uv_interp;
+
+uniform highp sampler2D source; //texunit:0
+
+uniform float exposure;
+uniform float white;
+
+#ifdef USE_AUTO_EXPOSURE
+
+uniform highp sampler2D source_auto_exposure; //texunit:1
+uniform highp float auto_exposure_grey;
+
+#endif
+
+#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7)
+
+uniform highp sampler2D source_glow; //texunit:2
+uniform highp float glow_intensity;
+
+#endif
+
+#ifdef USE_BCS
+
+uniform vec3 bcs;
+
+#endif
+
+#ifdef USE_COLOR_CORRECTION
+
+uniform sampler2D color_correction; //texunit:3
+
+#endif
+
+
+layout(location = 0) out vec4 frag_color;
+
+#ifdef USE_GLOW_FILTER_BICUBIC
+
+// w0, w1, w2, and w3 are the four cubic B-spline basis functions
+float w0(float a)
+{
+ return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0);
+}
+
+float w1(float a)
+{
+ return (1.0/6.0)*(a*a*(3.0*a - 6.0) + 4.0);
+}
+
+float w2(float a)
+{
+ return (1.0/6.0)*(a*(a*(-3.0*a + 3.0) + 3.0) + 1.0);
+}
+
+float w3(float a)
+{
+ return (1.0/6.0)*(a*a*a);
+}
+
+// g0 and g1 are the two amplitude functions
+float g0(float a)
+{
+ return w0(a) + w1(a);
+}
+
+float g1(float a)
+{
+ return w2(a) + w3(a);
+}
+
+// h0 and h1 are the two offset functions
+float h0(float a)
+{
+ return -1.0 + w1(a) / (w0(a) + w1(a));
+}
+
+float h1(float a)
+{
+ return 1.0 + w3(a) / (w2(a) + w3(a));
+}
+
+uniform ivec2 glow_texture_size;
+
+vec4 texture2D_bicubic(sampler2D tex, vec2 uv,int p_lod)
+{
+ float lod=float(p_lod);
+ vec2 tex_size = vec2(glow_texture_size >> p_lod);
+ vec2 pixel_size =1.0/tex_size;
+ uv = uv*tex_size + 0.5;
+ vec2 iuv = floor( uv );
+ vec2 fuv = fract( uv );
+
+ float g0x = g0(fuv.x);
+ float g1x = g1(fuv.x);
+ float h0x = h0(fuv.x);
+ float h1x = h1(fuv.x);
+ float h0y = h0(fuv.y);
+ float h1y = h1(fuv.y);
+
+ vec2 p0 = (vec2(iuv.x + h0x, iuv.y + h0y) - 0.5) * pixel_size;
+ vec2 p1 = (vec2(iuv.x + h1x, iuv.y + h0y) - 0.5) * pixel_size;
+ vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - 0.5) * pixel_size;
+ vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * pixel_size;
+
+ return g0(fuv.y) * (g0x * textureLod(tex, p0,lod) +
+ g1x * textureLod(tex, p1,lod)) +
+ g1(fuv.y) * (g0x * textureLod(tex, p2,lod) +
+ g1x * textureLod(tex, p3,lod));
+}
+
+
+
+#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) texture2D_bicubic(m_tex,m_uv,m_lod)
+
+#else
+
+#define GLOW_TEXTURE_SAMPLE(m_tex,m_uv,m_lod) textureLod(m_tex,m_uv,float(m_lod))
+
+#endif
+
+
+vec3 tonemap_filmic(vec3 color,float white) {
+
+ float A = 0.15;
+ float B = 0.50;
+ float C = 0.10;
+ float D = 0.20;
+ float E = 0.02;
+ float F = 0.30;
+ float W = 11.2;
+
+ vec3 coltn = ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;
+ float whitetn = ((white*(A*white+C*B)+D*E)/(white*(A*white+B)+D*F))-E/F;
+
+ return coltn/whitetn;
+
+}
+
+vec3 tonemap_aces(vec3 color) {
+ float a = 2.51f;
+ float b = 0.03f;
+ float c = 2.43f;
+ float d = 0.59f;
+ float e = 0.14f;
+ return color = clamp((color*(a*color+b))/(color*(c*color+d)+e),vec3(0.0),vec3(1.0));
+}
+
+vec3 tonemap_reindhart(vec3 color,float white) {
+
+ return ( color * ( 1.0 + ( color / ( white) ) ) ) / ( 1.0 + color );
+}
+
+void main() {
+
+ vec4 color = textureLod(source, uv_interp, 0.0);
+
+#ifdef USE_AUTO_EXPOSURE
+
+ color/=texelFetch(source_auto_exposure,ivec2(0,0),0).r/auto_exposure_grey;
+#endif
+
+ color*=exposure;
+
+#if defined(USE_GLOW_LEVEL1) || defined(USE_GLOW_LEVEL2) || defined(USE_GLOW_LEVEL3) || defined(USE_GLOW_LEVEL4) || defined(USE_GLOW_LEVEL5) || defined(USE_GLOW_LEVEL6) || defined(USE_GLOW_LEVEL7)
+#define USING_GLOW
+#endif
+
+#if defined(USING_GLOW)
+ vec3 glow = vec3(0.0);
+
+#ifdef USE_GLOW_LEVEL1
+
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,1).rgb;
+#endif
+
+#ifdef USE_GLOW_LEVEL2
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,2).rgb;
+#endif
+
+#ifdef USE_GLOW_LEVEL3
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,3).rgb;
+#endif
+
+#ifdef USE_GLOW_LEVEL4
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,4).rgb;
+#endif
+
+#ifdef USE_GLOW_LEVEL5
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,5).rgb;
+#endif
+
+#ifdef USE_GLOW_LEVEL6
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,6).rgb;
+#endif
+
+#ifdef USE_GLOW_LEVEL7
+ glow+=GLOW_TEXTURE_SAMPLE(source_glow,uv_interp,7).rgb;
+#endif
+
+
+ glow *= glow_intensity;
+
+#endif
+
+
+#ifdef USE_REINDHART_TONEMAPPER
+
+ color.rgb = tonemap_reindhart(color.rgb,white);
+
+# if defined(USING_GLOW)
+ glow = tonemap_reindhart(glow,white);
+# endif
+
+#endif
+
+#ifdef USE_FILMIC_TONEMAPPER
+
+ color.rgb = tonemap_filmic(color.rgb,white);
+
+# if defined(USING_GLOW)
+ glow = tonemap_filmic(glow,white);
+# endif
+
+#endif
+
+#ifdef USE_ACES_TONEMAPPER
+
+ color.rgb = tonemap_aces(color.rgb);
+
+# if defined(USING_GLOW)
+ glow = tonemap_aces(glow);
+# endif
+
+#endif
+
+ //regular Linear -> SRGB conversion
+ vec3 a = vec3(0.055);
+ color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308)));
+
+#if defined(USING_GLOW)
+ glow = mix( (vec3(1.0)+a)*pow(glow,vec3(1.0/2.4))-a , 12.92*glow , lessThan(glow,vec3(0.0031308)));
+#endif
+
+//glow needs to be added in SRGB space (together with image space effects)
+
+ color.rgb = clamp(color.rgb,0.0,1.0);
+
+#if defined(USING_GLOW)
+ glow = clamp(glow,0.0,1.0);
+#endif
+
+#ifdef USE_GLOW_REPLACE
+
+ color.rgb = glow;
+
+#endif
+
+#ifdef USE_GLOW_SCREEN
+
+ color.rgb = max((color.rgb + glow) - (color.rgb * glow), vec3(0.0));
+
+#endif
+
+#ifdef USE_GLOW_SOFTLIGHT
+
+ {
+
+ glow = (glow * 0.5) + 0.5;
+ color.r = (glow.r <= 0.5) ? (color.r - (1.0 - 2.0 * glow.r) * color.r * (1.0 - color.r)) : (((glow.r > 0.5) && (color.r <= 0.25)) ? (color.r + (2.0 * glow.r - 1.0) * (4.0 * color.r * (4.0 * color.r + 1.0) * (color.r - 1.0) + 7.0 * color.r)) : (color.r + (2.0 * glow.r - 1.0) * (sqrt(color.r) - color.r)));
+ color.g = (glow.g <= 0.5) ? (color.g - (1.0 - 2.0 * glow.g) * color.g * (1.0 - color.g)) : (((glow.g > 0.5) && (color.g <= 0.25)) ? (color.g + (2.0 * glow.g - 1.0) * (4.0 * color.g * (4.0 * color.g + 1.0) * (color.g - 1.0) + 7.0 * color.g)) : (color.g + (2.0 * glow.g - 1.0) * (sqrt(color.g) - color.g)));
+ color.b = (glow.b <= 0.5) ? (color.b - (1.0 - 2.0 * glow.b) * color.b * (1.0 - color.b)) : (((glow.b > 0.5) && (color.b <= 0.25)) ? (color.b + (2.0 * glow.b - 1.0) * (4.0 * color.b * (4.0 * color.b + 1.0) * (color.b - 1.0) + 7.0 * color.b)) : (color.b + (2.0 * glow.b - 1.0) * (sqrt(color.b) - color.b)));
+ }
+
+#endif
+
+#if defined(USING_GLOW) && !defined(USE_GLOW_SCREEN) && !defined(USE_GLOW_SOFTLIGHT) && !defined(USE_GLOW_REPLACE)
+ //additive
+ color.rgb+=glow;
+#endif
+
+#ifdef USE_BCS
+
+ color.rgb = mix(vec3(0.0),color.rgb,bcs.x);
+ color.rgb = mix(vec3(0.5),color.rgb,bcs.y);
+ color.rgb = mix(vec3(dot(vec3(1.0),color.rgb)*0.33333),color.rgb,bcs.z);
+
+#endif
+
+#ifdef USE_COLOR_CORRECTION
+
+ color.r = texture(color_correction,vec2(color.r,0.0)).r;
+ color.g = texture(color_correction,vec2(color.g,0.0)).g;
+ color.b = texture(color_correction,vec2(color.b,0.0)).b;
+#endif
+
+
+ frag_color=vec4(color.rgb,1.0);
+}
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 85fd565f5b..c2377e0c3e 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -160,6 +160,7 @@ void RasterizerCanvasGLES3::canvas_begin() {
state.canvas_shader.set_conditional(CanvasShaderGLES3::SHADOW_FILTER_PCF13, false);
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_DISTANCE_FIELD, false);
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_NINEPATCH, false);
+ state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SKELETON, false);
state.canvas_shader.set_custom_shader(0);
state.canvas_shader.bind();
@@ -180,6 +181,7 @@ void RasterizerCanvasGLES3::canvas_begin() {
glBindVertexArray(data.canvas_quad_array);
state.using_texture_rect = true;
state.using_ninepatch = false;
+ state.using_skeleton = false;
}
void RasterizerCanvasGLES3::canvas_end() {
@@ -191,11 +193,11 @@ void RasterizerCanvasGLES3::canvas_end() {
state.using_ninepatch = false;
}
-RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) {
+RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map, bool p_force) {
RasterizerStorageGLES3::Texture *tex_return = NULL;
- if (p_texture == state.current_tex) {
+ if (p_texture == state.current_tex && !p_force) {
tex_return = state.current_tex_ptr;
} else if (p_texture.is_valid()) {
@@ -230,7 +232,7 @@ RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(con
state.current_tex_ptr = NULL;
}
- if (p_normal_map == state.current_normal) {
+ if (p_normal_map == state.current_normal && !p_force) {
//do none
state.canvas_shader.set_uniform(CanvasShaderGLES3::USE_DEFAULT_NORMAL, state.current_normal.is_valid());
@@ -284,6 +286,10 @@ void RasterizerCanvasGLES3::_set_texture_rect_mode(bool p_enable, bool p_ninepat
state.canvas_shader.set_uniform(CanvasShaderGLES3::FINAL_MODULATE, state.canvas_item_modulate);
state.canvas_shader.set_uniform(CanvasShaderGLES3::MODELVIEW_MATRIX, state.final_transform);
state.canvas_shader.set_uniform(CanvasShaderGLES3::EXTRA_MATRIX, state.extra_matrix);
+ if (state.using_skeleton) {
+ state.canvas_shader.set_uniform(CanvasShaderGLES3::SKELETON_TRANSFORM, state.skeleton_transform);
+ state.canvas_shader.set_uniform(CanvasShaderGLES3::SKELETON_TRANSFORM_INVERSE, state.skeleton_transform_inverse);
+ }
if (storage->frame.current_rt) {
state.canvas_shader.set_uniform(CanvasShaderGLES3::SCREEN_PIXEL_SIZE, Vector2(1.0 / storage->frame.current_rt->width, 1.0 / storage->frame.current_rt->height));
} else {
@@ -293,7 +299,7 @@ void RasterizerCanvasGLES3::_set_texture_rect_mode(bool p_enable, bool p_ninepat
state.using_ninepatch = p_ninepatch;
}
-void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor) {
+void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor, const int *p_bones, const float *p_weights) {
glBindVertexArray(data.polygon_buffer_pointer_array);
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
@@ -301,11 +307,17 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
uint32_t buffer_ofs = 0;
//vertex
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size);
+#endif
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_vertices);
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), ((uint8_t *)0) + buffer_ofs);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
//color
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size);
+#endif
if (p_singlecolor) {
glDisableVertexAttribArray(VS::ARRAY_COLOR);
@@ -322,6 +334,10 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
buffer_ofs += sizeof(Color) * p_vertex_count;
}
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size);
+#endif
+
if (p_uvs) {
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
@@ -333,6 +349,32 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
}
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size);
+#endif
+
+ if (p_bones && p_weights) {
+
+ glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(int) * 4 * p_vertex_count, p_bones);
+ glEnableVertexAttribArray(VS::ARRAY_BONES);
+ //glVertexAttribPointer(VS::ARRAY_BONES, 4, GL_UNSIGNED_INT, false, sizeof(int) * 4, ((uint8_t *)0) + buffer_ofs);
+ glVertexAttribIPointer(VS::ARRAY_BONES, 4, GL_UNSIGNED_INT, sizeof(int) * 4, ((uint8_t *)0) + buffer_ofs);
+ buffer_ofs += sizeof(int) * 4 * p_vertex_count;
+
+ glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(float) * 4 * p_vertex_count, p_weights);
+ glEnableVertexAttribArray(VS::ARRAY_WEIGHTS);
+ glVertexAttribPointer(VS::ARRAY_WEIGHTS, 4, GL_FLOAT, false, sizeof(float) * 4, ((uint8_t *)0) + buffer_ofs);
+ buffer_ofs += sizeof(float) * 4 * p_vertex_count;
+
+ } else if (state.using_skeleton) {
+ glVertexAttribI4ui(VS::ARRAY_BONES, 0, 0, 0, 0);
+ glVertexAttrib4f(VS::ARRAY_WEIGHTS, 0, 0, 0, 0);
+ }
+
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size);
+#endif
+
//bind the indices buffer.
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(int) * p_index_count, p_indices);
@@ -342,6 +384,12 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
storage->frame.canvas_draw_commands++;
+ if (p_bones && p_weights) {
+ //not used so often, so disable when used
+ glDisableVertexAttribArray(VS::ARRAY_BONES);
+ glDisableVertexAttribArray(VS::ARRAY_WEIGHTS);
+ }
+
glBindVertexArray(0);
}
@@ -566,7 +614,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
} else {
- _draw_generic(GL_LINES, pline->lines.size(), pline->lines.ptr(), NULL, pline->line_colors.ptr(), pline->line_colors.size() == 1);
+ _draw_generic(GL_LINE_STRIP, pline->lines.size(), pline->lines.ptr(), NULL, pline->line_colors.ptr(), pline->line_colors.size() == 1);
}
#ifdef GLES_OVER_GL
@@ -735,7 +783,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
Size2 texpixel_size(1.0 / texture->width, 1.0 / texture->height);
state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE, texpixel_size);
}
- _draw_polygon(polygon->indices.ptr(), polygon->count, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1);
+
+ _draw_polygon(polygon->indices.ptr(), polygon->count, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1, polygon->bones.ptr(), polygon->weights.ptr());
#ifdef GLES_OVER_GL
if (polygon->antialiased) {
glEnable(GL_LINE_SMOOTH);
@@ -783,6 +832,9 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
if (!particles)
break;
+ if (particles->inactive && !particles->emitting)
+ break;
+
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1); //not used, so keep white
VisualServerRaster::redraw_request();
@@ -921,7 +973,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
}
_bind_canvas_texture(RID(), RID());
- _draw_polygon(indices, numpoints * 3, numpoints + 1, points, NULL, &circle->color, true);
+ _draw_polygon(indices, numpoints * 3, numpoints + 1, points, NULL, &circle->color, true, NULL, NULL);
//_draw_polygon(numpoints*3,indices,points,NULL,&circle->color,RID(),true);
//canvas_draw_circle(circle->indices.size(),circle->indices.ptr(),circle->points.ptr(),circle->uvs.ptr(),circle->colors.ptr(),circle->texture,circle->colors.size()==1);
@@ -1037,7 +1089,7 @@ void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) {
state.using_texture_rect = true;
_set_texture_rect_mode(false);
- _bind_canvas_texture(state.current_tex, state.current_normal);
+ _bind_canvas_texture(state.current_tex, state.current_normal, true);
glEnable(GL_BLEND);
}
@@ -1068,6 +1120,7 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
RID canvas_last_material;
bool prev_distance_field = false;
+ bool prev_use_skeleton = false;
while (p_item_list) {
@@ -1106,6 +1159,36 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
}
}
+ RasterizerStorageGLES3::Skeleton *skeleton = NULL;
+
+ {
+ //skeleton handling
+ if (ci->skeleton.is_valid()) {
+ skeleton = storage->skeleton_owner.getornull(ci->skeleton);
+ if (!skeleton->use_2d) {
+ skeleton = NULL;
+ } else {
+ state.skeleton_transform = p_transform * skeleton->base_transform_2d;
+ state.skeleton_transform_inverse = state.skeleton_transform.affine_inverse();
+ }
+ }
+
+ bool use_skeleton = skeleton != NULL;
+ if (prev_use_skeleton != use_skeleton) {
+ rebind_shader = true;
+ state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_SKELETON, use_skeleton);
+ prev_use_skeleton = use_skeleton;
+ }
+
+ if (skeleton) {
+ glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1);
+ glBindTexture(GL_TEXTURE_2D, skeleton->texture);
+ state.using_skeleton = true;
+ } else {
+ state.using_skeleton = false;
+ }
+ }
+
//begin rect
Item *material_owner = ci->material_owner ? ci->material_owner : ci;
@@ -1130,6 +1213,9 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
if (shader_ptr->canvas_item.uses_screen_texture && !state.canvas_texscreen_used) {
//copy if not copied before
_copy_texscreen(Rect2());
+
+ // blend mode will have been enabled so make sure we disable it again later on
+ last_blend_mode = last_blend_mode != RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED ? last_blend_mode : -1;
}
if (shader_ptr != shader_cache) {
@@ -1201,14 +1287,30 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
}
int blend_mode = shader_cache ? shader_cache->canvas_item.blend_mode : RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX;
+ if (blend_mode == RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
+ blend_mode = RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX;
+ }
bool unshaded = shader_cache && (shader_cache->canvas_item.light_mode == RasterizerStorageGLES3::Shader::CanvasItem::LIGHT_MODE_UNSHADED || blend_mode != RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX);
bool reclip = false;
if (last_blend_mode != blend_mode) {
+ if (last_blend_mode == RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED) {
+ // re-enable it
+ glEnable(GL_BLEND);
+ } else if (blend_mode == RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED) {
+ // disable it
+ glDisable(GL_BLEND);
+ }
switch (blend_mode) {
+ case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_DISABLED: {
+
+ // nothing to do here
+
+ } break;
case RasterizerStorageGLES3::Shader::CanvasItem::BLEND_MODE_MIX: {
+
glBlendEquation(GL_FUNC_ADD);
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index 1dc17f98d5..c7f2e54efb 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -84,6 +84,9 @@ public:
Color canvas_item_modulate;
Transform2D extra_matrix;
Transform2D final_transform;
+ bool using_skeleton;
+ Transform2D skeleton_transform;
+ Transform2D skeleton_transform_inverse;
} state;
@@ -120,10 +123,10 @@ public:
virtual void canvas_end();
_FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable, bool p_ninepatch = false);
- _FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map);
+ _FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map, bool p_force = false);
_FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs);
- _FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);
+ _FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor, const int *p_bones, const float *p_weights);
_FORCE_INLINE_ void _draw_generic(GLuint p_primitive, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);
_FORCE_INLINE_ void _canvas_item_render_commands(Item *p_item, Item *current_clip, bool &reclip);
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index b43deab58f..1abdaa5f80 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -111,8 +111,6 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
strcpy(debType, "Portability");
else if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB)
strcpy(debType, "Performance");
- else if (type == _EXT_DEBUG_TYPE_OTHER_ARB)
- strcpy(debType, "Other");
if (severity == _EXT_DEBUG_SEVERITY_HIGH_ARB)
strcpy(debSev, "High");
@@ -160,29 +158,31 @@ void RasterizerGLES3::initialize() {
"Fatal error: Insufficient OpenGL / GLES driver support");
}
-#ifdef __APPLE__
-// FIXME glDebugMessageCallbackARB does not seem to work on Mac OS X and opengl 3, this may be an issue with our opengl canvas..
-#else
if (OS::get_singleton()->is_stdout_verbose()) {
- glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
- glDebugMessageCallbackARB(_gl_debug_print, NULL);
- glEnable(_EXT_DEBUG_OUTPUT);
+ if (GLAD_GL_ARB_debug_output) {
+ glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+ glDebugMessageCallbackARB(_gl_debug_print, NULL);
+ glEnable(_EXT_DEBUG_OUTPUT);
+ } else {
+ print_line("OpenGL debugging not supported!");
+ }
}
-#endif
#endif // GLAD_ENABLED
/* // For debugging
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PORTABILITY_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PERFORMANCE_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_OTHER_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
- glDebugMessageInsertARB(
- GL_DEBUG_SOURCE_API_ARB,
- GL_DEBUG_TYPE_OTHER_ARB, 1,
- GL_DEBUG_SEVERITY_HIGH_ARB,5, "hello");
+ if (GLAD_GL_ARB_debug_output) {
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PORTABILITY_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PERFORMANCE_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_OTHER_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE);
+ glDebugMessageInsertARB(
+ GL_DEBUG_SOURCE_API_ARB,
+ GL_DEBUG_TYPE_OTHER_ARB, 1,
+ GL_DEBUG_SEVERITY_HIGH_ARB,5, "hello");
+ }
*/
const GLubyte *renderer = glGetString(GL_RENDERER);
@@ -290,7 +290,11 @@ void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_c
glViewport(0, 0, window_w, window_h);
glDisable(GL_BLEND);
glDepthMask(GL_FALSE);
- glClearColor(p_color.r, p_color.g, p_color.b, 1.0);
+ if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ } else {
+ glClearColor(p_color.r, p_color.g, p_color.b, 1.0);
+ }
glClear(GL_COLOR_BUFFER_BIT);
canvas->canvas_begin();
@@ -329,6 +333,27 @@ void RasterizerGLES3::set_boot_image(const Ref<Image> &p_image, const Color &p_c
storage->free(texture); // free since it's only one frame that stays there
+ if (OS::get_singleton()->is_layered_allowed()) {
+ if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
+#if (defined WINDOWS_ENABLED) && !(defined UWP_ENABLED)
+ Size2 wndsize = OS::get_singleton()->get_layered_buffer_size();
+ uint8_t *data = OS::get_singleton()->get_layered_buffer_data();
+ if (data) {
+ glReadPixels(0, 0, wndsize.x, wndsize.y, GL_BGRA, GL_UNSIGNED_BYTE, data);
+ OS::get_singleton()->swap_layered_buffer();
+
+ return;
+ }
+#endif
+ } else {
+ //clear alpha
+ glColorMask(false, false, false, true);
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glColorMask(true, true, true, true);
+ }
+ }
+
OS::get_singleton()->swap_buffers();
}
@@ -365,6 +390,27 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re
void RasterizerGLES3::end_frame(bool p_swap_buffers) {
+ if (OS::get_singleton()->is_layered_allowed()) {
+ if (OS::get_singleton()->get_window_per_pixel_transparency_enabled()) {
+#if (defined WINDOWS_ENABLED) && !(defined UWP_ENABLED)
+ Size2 wndsize = OS::get_singleton()->get_layered_buffer_size();
+ uint8_t *data = OS::get_singleton()->get_layered_buffer_data();
+ if (data) {
+ glReadPixels(0, 0, wndsize.x, wndsize.y, GL_BGRA, GL_UNSIGNED_BYTE, data);
+ OS::get_singleton()->swap_layered_buffer();
+
+ return;
+ }
+#endif
+ } else {
+ //clear alpha
+ glColorMask(false, false, false, true);
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glColorMask(true, true, true, true);
+ }
+ }
+
if (p_swap_buffers)
OS::get_singleton()->swap_buffers();
else
@@ -413,4 +459,5 @@ RasterizerGLES3::~RasterizerGLES3() {
memdelete(storage);
memdelete(canvas);
+ memdelete(scene);
}
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 7c053e8f60..caa3921dc4 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -896,7 +896,7 @@ void RasterizerSceneGLES3::environment_set_ssr(RID p_env, bool p_enable, int p_m
env->ssr_roughness = p_roughness;
}
-void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
+void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
Environment *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -908,6 +908,7 @@ void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float
env->ssao_intensity2 = p_intensity2;
env->ssao_bias = p_bias;
env->ssao_light_affect = p_light_affect;
+ env->ssao_ao_channel_affect = p_ao_channel_affect;
env->ssao_color = p_color;
env->ssao_filter = p_blur;
env->ssao_quality = p_quality;
@@ -2085,9 +2086,9 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: {
glBlendEquation(GL_FUNC_ADD);
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_DST_ALPHA, GL_ZERO);
} else {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_ZERO, GL_ONE);
}
} break;
@@ -2356,13 +2357,15 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy) {
- if (!p_sky)
- return;
+ ERR_FAIL_COND(!p_sky);
RasterizerStorageGLES3::Texture *tex = storage->texture_owner.getornull(p_sky->panorama);
ERR_FAIL_COND(!tex);
glActiveTexture(GL_TEXTURE0);
+
+ tex = tex->get_ptr(); //resolve for proxies
+
glBindTexture(tex->target, tex->tex_id);
if (storage->config.srgb_decode_supported && tex->srgb && !tex->using_srgb) {
@@ -2505,6 +2508,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
state.env_radiance_data.ambient_contribution = env->ambient_sky_contribution;
state.ubo_data.ambient_occlusion_affect_light = env->ssao_light_affect;
+ state.ubo_data.ambient_occlusion_affect_ssao = env->ssao_ao_channel_affect;
//fog
@@ -3907,6 +3911,7 @@ void RasterizerSceneGLES3::_post_process(Environment *env, const CameraMatrix &p
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_FILMIC_TONEMAPPER, env->tone_mapper == VS::ENV_TONE_MAPPER_FILMIC);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_ACES_TONEMAPPER, env->tone_mapper == VS::ENV_TONE_MAPPER_ACES);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_REINDHART_TONEMAPPER, env->tone_mapper == VS::ENV_TONE_MAPPER_REINHARDT);
+ state.tonemap_shader.set_conditional(TonemapShaderGLES3::KEEP_3D_LINEAR, storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_KEEP_3D_LINEAR]);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_AUTO_EXPOSURE, env->auto_exposure);
state.tonemap_shader.set_conditional(TonemapShaderGLES3::USE_GLOW_FILTER_BICUBIC, env->glow_bicubic_upscale);
@@ -4337,7 +4342,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glBindFramebuffer(GL_FRAMEBUFFER,storage->frame.current_rt->buffers.fbo); //switch to alpha fbo for sky, only diffuse/ambient matters
*/
- _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy);
+ if (sky && sky->panorama.is_valid())
+ _draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy);
}
//_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true);
@@ -5118,3 +5124,23 @@ void RasterizerSceneGLES3::finalize() {
RasterizerSceneGLES3::RasterizerSceneGLES3() {
}
+
+RasterizerSceneGLES3::~RasterizerSceneGLES3() {
+
+ memdelete(default_material.get_data());
+ memdelete(default_material_twosided.get_data());
+ memdelete(default_shader.get_data());
+ memdelete(default_shader_twosided.get_data());
+
+ memdelete(default_worldcoord_material.get_data());
+ memdelete(default_worldcoord_material_twosided.get_data());
+ memdelete(default_worldcoord_shader.get_data());
+ memdelete(default_worldcoord_shader_twosided.get_data());
+
+ memdelete(default_overdraw_material.get_data());
+ memdelete(default_overdraw_shader.get_data());
+
+ memfree(state.spot_array_tmp);
+ memfree(state.omni_array_tmp);
+ memfree(state.reflection_array_tmp);
+}
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 1b99e119ce..524212b9c1 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -140,6 +140,7 @@ public:
float reflection_multiplier;
float subsurface_scatter_width;
float ambient_occlusion_affect_light;
+ float ambient_occlusion_affect_ssao;
uint32_t fog_depth_enabled;
float fog_depth_begin;
@@ -151,6 +152,7 @@ public:
float fog_height_max;
float fog_height_curve;
// make sure this struct is padded to be a multiple of 16 bytes for webgl
+ float pad[3];
} ubo_data;
@@ -385,6 +387,7 @@ public:
float ssao_radius2;
float ssao_bias;
float ssao_light_affect;
+ float ssao_ao_channel_affect;
Color ssao_color;
VS::EnvironmentSSAOQuality ssao_quality;
float ssao_bilateral_sharpness;
@@ -465,6 +468,7 @@ public:
ssao_radius2 = 0.0;
ssao_bias = 0.01;
ssao_light_affect = 0;
+ ssao_ao_channel_affect = 0;
ssao_filter = VS::ENV_SSAO_BLUR_3x3;
ssao_quality = VS::ENV_SSAO_QUALITY_LOW;
ssao_bilateral_sharpness = 4;
@@ -543,7 +547,7 @@ public:
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
- virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
+ virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
@@ -852,6 +856,7 @@ public:
void initialize();
void finalize();
RasterizerSceneGLES3();
+ ~RasterizerSceneGLES3();
};
#endif // RASTERIZERSCENEGLES3_H
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index a287dca1ed..11ab957458 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "rasterizer_storage_gles3.h"
+#include "engine.h"
#include "project_settings.h"
#include "rasterizer_canvas_gles3.h"
#include "rasterizer_scene_gles3.h"
@@ -827,6 +828,58 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
//texture_set_flags(p_texture,texture->flags);
}
+// Uploads pixel data to a sub-region of a texture, for the specified mipmap.
+// The texture pixels must have been allocated before, because most features seen in texture_set_data() make no sense in a partial update.
+// TODO If we want this to be usable without pre-filling pixels with a full image, we have to call glTexImage2D() with null data.
+void RasterizerStorageGLES3::texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side) {
+
+ Texture *texture = texture_owner.get(p_texture);
+
+ ERR_FAIL_COND(!texture);
+ ERR_FAIL_COND(!texture->active);
+ ERR_FAIL_COND(texture->render_target);
+ ERR_FAIL_COND(texture->format != p_image->get_format());
+ ERR_FAIL_COND(p_image.is_null());
+ ERR_FAIL_COND(src_w <= 0 || src_h <= 0);
+ ERR_FAIL_COND(src_x < 0 || src_y < 0 || src_x + src_w > p_image->get_width() || src_y + src_h > p_image->get_height());
+ ERR_FAIL_COND(dst_x < 0 || dst_y < 0 || dst_x + src_w > texture->alloc_width || dst_y + src_h > texture->alloc_height);
+ ERR_FAIL_COND(p_dst_mip < 0 || p_dst_mip >= texture->mipmaps);
+
+ GLenum type;
+ GLenum format;
+ GLenum internal_format;
+ bool compressed;
+ bool srgb;
+
+ // Because OpenGL wants data as a dense array, we have to extract the sub-image if the source rect isn't the full image
+ Ref<Image> p_sub_img = p_image;
+ if (src_x > 0 || src_y > 0 || src_w != p_image->get_width() || src_h != p_image->get_height()) {
+ p_sub_img = p_image->get_rect(Rect2(src_x, src_y, src_w, src_h));
+ }
+
+ Ref<Image> img = _get_gl_image_and_format(p_sub_img, p_sub_img->get_format(), texture->flags, format, internal_format, type, compressed, srgb);
+
+ GLenum blit_target = (texture->target == GL_TEXTURE_CUBE_MAP) ? _cube_side_enum[p_cube_side] : GL_TEXTURE_2D;
+
+ PoolVector<uint8_t>::Read read = img->get_data().read();
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(texture->target, texture->tex_id);
+
+ int src_data_size = img->get_data().size();
+ int src_ofs = 0;
+
+ if (texture->compressed) {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ glCompressedTexSubImage2D(blit_target, p_dst_mip, dst_x, dst_y, src_w, src_h, internal_format, src_data_size, &read[src_ofs]);
+
+ } else {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ // `format` has to match the internal_format used when the texture was created
+ glTexSubImage2D(blit_target, p_dst_mip, dst_x, dst_y, src_w, src_h, format, type, &read[src_ofs]);
+ }
+}
+
Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side) const {
Texture *texture = texture_owner.get(p_texture);
@@ -1303,6 +1356,8 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
ERR_FAIL_COND(!texture);
}
+ texture = texture->get_ptr(); //resolve for proxies
+
glBindVertexArray(0);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
@@ -1614,6 +1669,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
shaders.actions_canvas.render_mode_values["blend_sub"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_SUB);
shaders.actions_canvas.render_mode_values["blend_mul"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MUL);
shaders.actions_canvas.render_mode_values["blend_premul_alpha"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_PMALPHA);
+ shaders.actions_canvas.render_mode_values["blend_disabled"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_DISABLED);
shaders.actions_canvas.render_mode_values["unshaded"] = Pair<int *, int>(&p_shader->canvas_item.light_mode, Shader::CanvasItem::LIGHT_MODE_UNSHADED);
shaders.actions_canvas.render_mode_values["light_only"] = Pair<int *, int>(&p_shader->canvas_item.light_mode, Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY);
@@ -1911,7 +1967,7 @@ void RasterizerStorageGLES3::material_set_param(RID p_material, const StringName
Variant RasterizerStorageGLES3::material_get_param(RID p_material, const StringName &p_param) const {
const Material *material = material_owner.get(p_material);
- ERR_FAIL_COND_V(!material, RID());
+ ERR_FAIL_COND_V(!material, Variant());
if (material->params.has(p_param))
return material->params[p_param];
@@ -4495,6 +4551,15 @@ Transform2D RasterizerStorageGLES3::skeleton_bone_get_transform_2d(RID p_skeleto
return ret;
}
+void RasterizerStorageGLES3::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {
+
+ Skeleton *skeleton = skeleton_owner.getornull(p_skeleton);
+
+ ERR_FAIL_COND(!skeleton->use_2d);
+
+ skeleton->base_transform_2d = p_base_transform;
+}
+
void RasterizerStorageGLES3::update_dirty_skeletons() {
glActiveTexture(GL_TEXTURE0);
@@ -5832,9 +5897,9 @@ void RasterizerStorageGLES3::update_particles() {
tex = resources.white_tex;
} break;
}
-
} else {
+ t = t->get_ptr(); //resolve for proxies
target = t->target;
tex = t->tex_id;
}
@@ -5855,6 +5920,8 @@ void RasterizerStorageGLES3::update_particles() {
shaders.particles.set_uniform(ParticlesShaderGLES3::EMITTING, particles->emitting);
shaders.particles.set_uniform(ParticlesShaderGLES3::RANDOMNESS, particles->randomness);
+ bool zero_time_scale = Engine::get_singleton()->get_time_scale() <= 0.0;
+
if (particles->clear && particles->pre_process_time > 0.0) {
float frame_time;
@@ -5872,7 +5939,15 @@ void RasterizerStorageGLES3::update_particles() {
}
if (particles->fixed_fps > 0) {
- float frame_time = 1.0 / particles->fixed_fps;
+ float frame_time;
+ float decr;
+ if (zero_time_scale) {
+ frame_time = 0.0;
+ decr = 1.0 / particles->fixed_fps;
+ } else {
+ frame_time = 1.0 / particles->fixed_fps;
+ decr = frame_time;
+ }
float delta = frame.delta;
if (delta > 0.1) { //avoid recursive stalls if fps goes below 10
delta = 0.1;
@@ -5883,13 +5958,16 @@ void RasterizerStorageGLES3::update_particles() {
while (todo >= frame_time) {
_particles_process(particles, frame_time);
- todo -= frame_time;
+ todo -= decr;
}
particles->frame_remainder = todo;
} else {
- _particles_process(particles, frame.delta);
+ if (zero_time_scale)
+ _particles_process(particles, 0.0);
+ else
+ _particles_process(particles, frame.delta);
}
particle_update_list.remove(particle_update_list.first());
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index ef2b247266..6b626cbd00 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -340,6 +340,7 @@ public:
virtual RID texture_create();
virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT);
virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT);
+ virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT);
virtual Ref<Image> texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) const;
virtual void texture_set_flags(RID p_texture, uint32_t p_flags);
virtual uint32_t texture_get_flags(RID p_texture) const;
@@ -420,6 +421,7 @@ public:
BLEND_MODE_SUB,
BLEND_MODE_MUL,
BLEND_MODE_PMALPHA,
+ BLEND_MODE_DISABLED,
};
int blend_mode;
@@ -868,6 +870,7 @@ public:
GLuint texture;
SelfList<Skeleton> update_list;
Set<RasterizerScene::InstanceBase *> instances; //instances using skeleton
+ Transform2D base_transform_2d;
Skeleton() :
update_list(this) {
@@ -891,6 +894,7 @@ public:
virtual Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const;
virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform);
virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const;
+ virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform);
/* Light API */
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index 070c661c8a..eb8d6c485b 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -795,7 +795,6 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"] = "light_height";
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"] = "light_color";
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"] = "light_uv";
- //actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_SHADOW_COLOR"]="light_shadow_color";
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT"] = "light";
actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"] = "shadow_color";
@@ -805,9 +804,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n";
actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
- actions[VS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_COLOR"] = "#define SHADOW_COLOR_USED\n";
actions[VS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
-
actions[VS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
/** SPATIAL SHADER **/
@@ -914,6 +911,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
+ actions[VS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
/* PARTICLES SHADER */
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index f436ef06f7..326aab4c7c 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -4,6 +4,11 @@
layout(location=0) in highp vec2 vertex;
layout(location=3) in vec4 color_attrib;
+#ifdef USE_SKELETON
+layout(location=6) in uvec4 bone_indices; // attrib:6
+layout(location=7) in vec4 bone_weights; // attrib:7
+#endif
+
#ifdef USE_TEXTURE_RECT
uniform vec4 dst_rect;
@@ -51,6 +56,12 @@ out highp vec2 pixel_size_interp;
#endif
+#ifdef USE_SKELETON
+uniform mediump sampler2D skeleton_texture; // texunit:-1
+uniform highp mat4 skeleton_transform;
+uniform highp mat4 skeleton_transform_inverse;
+#endif
+
#ifdef USE_LIGHTING
layout(std140) uniform LightData { //ubo:1
@@ -75,7 +86,6 @@ out vec4 light_uv_interp;
out vec4 local_rot;
-
#ifdef USE_SHADOWS
out highp vec2 pos;
#endif
@@ -101,6 +111,7 @@ MATERIAL_UNIFORMS
#endif
+
VERTEX_SHADER_GLOBALS
void main() {
@@ -146,6 +157,7 @@ void main() {
#endif
+
#define extra_matrix extra_matrix2
{
@@ -175,6 +187,49 @@ VERTEX_SHADER_CODE
#endif
+#ifdef USE_SKELETON
+
+ if (bone_weights!=vec4(0.0)){ //must be a valid bone
+ //skeleton transform
+
+ ivec4 bone_indicesi = ivec4(bone_indices);
+
+ ivec2 tex_ofs = ivec2( bone_indicesi.x%256, (bone_indicesi.x/256)*2 );
+
+ highp mat2x4 m = mat2x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
+ ) * bone_weights.x;
+
+ tex_ofs = ivec2( bone_indicesi.y%256, (bone_indicesi.y/256)*2 );
+
+ m+= mat2x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
+ ) * bone_weights.y;
+
+ tex_ofs = ivec2( bone_indicesi.z%256, (bone_indicesi.z/256)*2 );
+
+ m+= mat2x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
+ ) * bone_weights.z;
+
+
+ tex_ofs = ivec2( bone_indicesi.w%256, (bone_indicesi.w/256)*2 );
+
+ m+= mat2x4(
+ texelFetch(skeleton_texture,tex_ofs,0),
+ texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
+ ) * bone_weights.w;
+
+ mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0],m[1],vec4(0.0,0.0,1.0,0.0),vec4(0.0,0.0,0.0,1.0))) * skeleton_transform_inverse;
+
+ outvec = bone_matrix * outvec;
+ }
+
+#endif
+
gl_Position = projection_matrix * outvec;
#ifdef USE_LIGHTING
@@ -207,6 +262,7 @@ uniform mediump sampler2D color_texture; // texunit:0
uniform highp vec2 color_texpixel_size;
uniform mediump sampler2D normal_texture; // texunit:1
+
in highp vec2 uv_interp;
in mediump vec4 color_interp;
@@ -285,7 +341,19 @@ MATERIAL_UNIFORMS
FRAGMENT_SHADER_GLOBALS
-void light_compute(inout vec4 light,vec2 light_vec,float light_height,vec4 light_color,vec2 light_uv,vec4 shadow,vec3 normal,vec2 uv,vec2 screen_uv,vec4 color) {
+void light_compute(
+ inout vec4 light,
+ inout vec2 light_vec,
+ inout float light_height,
+ inout vec4 light_color,
+ vec2 light_uv,
+ inout vec4 shadow_color,
+ vec3 normal,
+ vec2 uv,
+#if defined(SCREEN_UV_USED)
+ vec2 screen_uv,
+#endif
+ vec4 color) {
#if defined(USE_LIGHT_SHADER_CODE)
@@ -462,39 +530,41 @@ FRAGMENT_SHADER_CODE
float att=1.0;
vec2 light_uv = light_uv_interp.xy;
- vec4 light = texture(light_texture,light_uv) * light_color;
-#if defined(SHADOW_COLOR_USED)
- vec4 shadow_color=vec4(0.0,0.0,0.0,0.0);
-#endif
+ vec4 light = texture(light_texture,light_uv);
if (any(lessThan(light_uv_interp.xy,vec2(0.0,0.0))) || any(greaterThanEqual(light_uv_interp.xy,vec2(1.0,1.0)))) {
color.a*=light_outside_alpha; //invisible
} else {
+ float real_light_height = light_height;
+ vec4 real_light_color = light_color;
+ vec4 real_light_shadow_color = light_shadow_color;
#if defined(USE_LIGHT_SHADER_CODE)
//light is written by the light shader
- light_compute(light,light_vec,light_height,light_color,light_uv,shadow,normal,uv,screen_uv,color);
+ light_compute(
+ light,
+ light_vec,
+ real_light_height,
+ real_light_color,
+ light_uv,
+ real_light_shadow_color,
+ normal,
+ uv,
+#if defined(SCREEN_UV_USED)
+ screen_uv,
+#endif
+ color);
+#endif
-#else
+ light *= real_light_color;
if (normal_used) {
-
- vec3 light_normal = normalize(vec3(light_vec,-light_height));
+ vec3 light_normal = normalize(vec3(light_vec,-real_light_height));
light*=max(dot(-light_normal,normal),0.0);
}
color*=light;
-/*
-#ifdef USE_NORMAL
- color.xy=local_rot.xy;//normal.xy;
- color.zw=vec2(0.0,1.0);
-#endif
-*/
-
-//light shader code
-#endif
-
#ifdef USE_SHADOWS
@@ -634,13 +704,8 @@ FRAGMENT_SHADER_CODE
#endif
-
-#if defined(SHADOW_COLOR_USED)
- color=mix(shadow_color,color,shadow_attenuation);
-#else
//color*=shadow_attenuation;
- color=mix(light_shadow_color,color,shadow_attenuation);
-#endif
+ color=mix(real_light_shadow_color,color,shadow_attenuation);
//use shadows
#endif
}
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index d3644bffdd..0e111e59a9 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -90,6 +90,7 @@ layout(std140) uniform SceneData { //ubo:0
mediump float reflection_multiplier;
mediump float subsurface_scatter_width;
mediump float ambient_occlusion_affect_light;
+ mediump float ambient_occlusion_affect_ao_channel;
bool fog_depth_enabled;
highp float fog_depth_begin;
@@ -670,6 +671,7 @@ layout(std140) uniform SceneData {
mediump float reflection_multiplier;
mediump float subsurface_scatter_width;
mediump float ambient_occlusion_affect_light;
+ mediump float ambient_occlusion_affect_ao_channel;
bool fog_depth_enabled;
highp float fog_depth_begin;
@@ -1206,6 +1208,7 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino
float omni_attenuation = pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w );
vec3 light_attenuation = vec3(omni_attenuation);
+#if !defined(SHADOWS_DISABLED)
if (omni_lights[idx].light_params.w>0.5) {
//there is a shadowmap
@@ -1252,6 +1255,7 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino
#endif
light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
}
+#endif //SHADOWS_DISABLED
light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim * omni_attenuation,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
@@ -1270,6 +1274,7 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
spot_attenuation*= 1.0 - pow( spot_rim, spot_lights[idx].light_params.x);
vec3 light_attenuation = vec3(spot_attenuation);
+#if !defined(SHADOWS_DISABLED)
if (spot_lights[idx].light_params.w>0.5) {
//there is a shadowmap
highp vec4 splane=(spot_lights[idx].shadow_matrix * vec4(vertex,1.0));
@@ -1287,6 +1292,7 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
#endif
light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow);
}
+#endif //SHADOWS_DISABLED
light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,metallic,rim * spot_attenuation,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light);
@@ -1785,6 +1791,7 @@ FRAGMENT_SHADER_CODE
float depth_z = -vertex.z;
#ifdef LIGHT_DIRECTIONAL_SHADOW
+#if !defined(SHADOWS_DISABLED)
#ifdef LIGHT_USE_PSSM4
if (depth_z < shadow_split_offsets.w) {
@@ -1927,6 +1934,7 @@ FRAGMENT_SHADER_CODE
}
+#endif // !defined(SHADOWS_DISABLED)
#endif //LIGHT_DIRECTIONAL_SHADOW
#ifdef USE_VERTEX_LIGHTING
@@ -2122,18 +2130,16 @@ FRAGMENT_SHADER_CODE
#else
-#if defined(ENABLE_AO)
-
- float ambient_scale=0.0; // AO is supplied by material
-#else
//approximate ambient scale for SSAO, since we will lack full ambient
float max_emission=max(emission.r,max(emission.g,emission.b));
float max_ambient=max(ambient_light.r,max(ambient_light.g,ambient_light.b));
float max_diffuse=max(diffuse_light.r,max(diffuse_light.g,diffuse_light.b));
float total_ambient = max_ambient+max_diffuse+max_emission;
float ambient_scale = (total_ambient>0.0) ? (max_ambient+ambient_occlusion_affect_light*max_diffuse)/total_ambient : 0.0;
-#endif //ENABLE_AO
+#if defined(ENABLE_AO)
+ ambient_scale=mix(0.0,ambient_scale,ambient_occlusion_affect_ao_channel);
+#endif
diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale);
specular_buffer=vec4(specular_light,metallic);
diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl
index 2f671158b2..a75871f08e 100644
--- a/drivers/gles3/shaders/tonemap.glsl
+++ b/drivers/gles3/shaders/tonemap.glsl
@@ -258,9 +258,13 @@ void main() {
#endif
+#ifdef KEEP_3D_LINEAR
+ // leave color as is...
+#else
//regular Linear -> SRGB conversion
vec3 a = vec3(0.055);
color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308)));
+#endif
#if defined(USING_GLOW)
glow = mix( (vec3(1.0)+a)*pow(glow,vec3(1.0/2.4))-a , 12.92*glow , lessThan(glow,vec3(0.0031308)));
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index e90245b300..0f47949b4b 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -37,183 +37,223 @@
#include "os/os.h"
#include "project_settings.h"
-void pa_state_cb(pa_context *c, void *userdata) {
- pa_context_state_t state;
- int *pa_ready = (int *)userdata;
+void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) {
+ AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata;
- state = pa_context_get_state(c);
- switch (state) {
- case PA_CONTEXT_FAILED:
+ switch (pa_context_get_state(c)) {
case PA_CONTEXT_TERMINATED:
- *pa_ready = 2;
+ case PA_CONTEXT_FAILED:
+ ad->pa_ready = -1;
break;
case PA_CONTEXT_READY:
- *pa_ready = 1;
+ ad->pa_ready = 1;
break;
}
}
-void sink_info_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata) {
- unsigned int *channels = (unsigned int *)userdata;
+void AudioDriverPulseAudio::pa_sink_info_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata) {
+ AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata;
// If eol is set to a positive number, you're at the end of the list
if (eol > 0) {
return;
}
- *channels = l->channel_map.channels;
+ ad->pa_map = l->channel_map;
+ ad->pa_status++;
}
-void server_info_cb(pa_context *c, const pa_server_info *i, void *userdata) {
- char *default_output = (char *)userdata;
+void AudioDriverPulseAudio::pa_server_info_cb(pa_context *c, const pa_server_info *i, void *userdata) {
+ AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata;
- strncpy(default_output, i->default_sink_name, 1024);
+ ad->default_device = i->default_sink_name;
+ ad->pa_status++;
}
-static unsigned int detect_channels() {
-
- pa_mainloop *pa_ml;
- pa_mainloop_api *pa_mlapi;
- pa_operation *pa_op;
- pa_context *pa_ctx;
-
- int state = 0;
- int pa_ready = 0;
-
- char default_output[1024];
- unsigned int channels = 2;
-
- pa_ml = pa_mainloop_new();
- pa_mlapi = pa_mainloop_get_api(pa_ml);
- pa_ctx = pa_context_new(pa_mlapi, "Godot");
-
- int ret = pa_context_connect(pa_ctx, NULL, PA_CONTEXT_NOFLAGS, NULL);
- if (ret < 0) {
- pa_context_unref(pa_ctx);
- pa_mainloop_free(pa_ml);
+void AudioDriverPulseAudio::detect_channels() {
- return 2;
- }
+ pa_channel_map_init_stereo(&pa_map);
- pa_context_set_state_callback(pa_ctx, pa_state_cb, &pa_ready);
+ if (device_name == "Default") {
+ // Get the default output device name
+ pa_status = 0;
+ pa_operation *pa_op = pa_context_get_server_info(pa_ctx, &AudioDriverPulseAudio::pa_server_info_cb, (void *)this);
+ if (pa_op) {
+ while (pa_status == 0) {
+ int ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ if (ret < 0) {
+ ERR_PRINT("pa_mainloop_iterate error");
+ }
+ }
- // Wait until the pa server is ready
- while (pa_ready == 0) {
- pa_mainloop_iterate(pa_ml, 1, NULL);
+ pa_operation_unref(pa_op);
+ } else {
+ ERR_PRINT("pa_context_get_server_info error");
+ }
}
- // Check if there was an error connecting to the pa server
- if (pa_ready == 2) {
- pa_context_disconnect(pa_ctx);
- pa_context_unref(pa_ctx);
- pa_mainloop_free(pa_ml);
-
- return 2;
+ char device[1024];
+ if (device_name == "Default") {
+ strcpy(device, default_device.utf8().get_data());
+ } else {
+ strcpy(device, device_name.utf8().get_data());
}
- // Get the default output device name
- pa_op = pa_context_get_server_info(pa_ctx, &server_info_cb, (void *)default_output);
+ // Now using the device name get the amount of channels
+ pa_status = 0;
+ pa_operation *pa_op = pa_context_get_sink_info_by_name(pa_ctx, device, &AudioDriverPulseAudio::pa_sink_info_cb, (void *)this);
if (pa_op) {
- while (pa_operation_get_state(pa_op) == PA_OPERATION_RUNNING) {
- ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ while (pa_status == 0) {
+ int ret = pa_mainloop_iterate(pa_ml, 1, NULL);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
}
pa_operation_unref(pa_op);
-
- // Now using the device name get the amount of channels
- pa_op = pa_context_get_sink_info_by_name(pa_ctx, default_output, &sink_info_cb, (void *)&channels);
- if (pa_op) {
- while (pa_operation_get_state(pa_op) == PA_OPERATION_RUNNING) {
- ret = pa_mainloop_iterate(pa_ml, 1, NULL);
- if (ret < 0) {
- ERR_PRINT("pa_mainloop_iterate error");
- }
- }
-
- pa_operation_unref(pa_op);
- } else {
- ERR_PRINT("pa_context_get_sink_info_by_name error");
- }
} else {
- ERR_PRINT("pa_context_get_server_info error");
+ ERR_PRINT("pa_context_get_sink_info_by_name error");
}
-
- pa_context_disconnect(pa_ctx);
- pa_context_unref(pa_ctx);
- pa_mainloop_free(pa_ml);
-
- return channels;
}
-Error AudioDriverPulseAudio::init() {
+Error AudioDriverPulseAudio::init_device() {
- active = false;
- thread_exited = false;
- exit_thread = false;
+ // If there is a specified device check that it is really present
+ if (device_name != "Default") {
+ Array list = get_device_list();
+ if (list.find(device_name) == -1) {
+ device_name = "Default";
+ new_device = "Default";
+ }
+ }
- mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
- channels = detect_channels();
+ // Detect the amount of channels PulseAudio is using
+ // Note: If using an even amount of channels (2, 4, etc) channels and pa_map.channels will be equal,
+ // if not then pa_map.channels will have the real amount of channels PulseAudio is using and channels
+ // will have the amount of channels Godot is using (in this case it's pa_map.channels + 1)
+ detect_channels();
+ switch (pa_map.channels) {
+ case 1: // Mono
+ case 3: // Surround 2.1
+ case 5: // Surround 5.0
+ case 7: // Surround 7.0
+ channels = pa_map.channels + 1;
+ break;
- switch (channels) {
case 2: // Stereo
- case 4: // Surround 3.1
+ case 4: // Surround 4.0
case 6: // Surround 5.1
case 8: // Surround 7.1
+ channels = pa_map.channels;
break;
default:
- ERR_PRINTS("PulseAudio: Unsupported number of channels: " + itos(channels));
- ERR_FAIL_V(ERR_CANT_OPEN);
+ WARN_PRINTS("PulseAudio: Unsupported number of channels: " + itos(pa_map.channels));
+ pa_channel_map_init_stereo(&pa_map);
+ channels = 2;
break;
}
- pa_sample_spec spec;
- spec.format = PA_SAMPLE_S16LE;
- spec.channels = channels;
- spec.rate = mix_rate;
-
int latency = GLOBAL_DEF("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
- buffer_size = buffer_frames * channels;
+ pa_buffer_size = buffer_frames * pa_map.channels;
if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("PulseAudio: detected " + itos(channels) + " channels");
+ print_line("PulseAudio: detected " + itos(pa_map.channels) + " channels");
print_line("PulseAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
}
+ pa_sample_spec spec;
+ spec.format = PA_SAMPLE_S16LE;
+ spec.channels = pa_map.channels;
+ spec.rate = mix_rate;
+
+ pa_str = pa_stream_new(pa_ctx, "Sound", &spec, &pa_map);
+ if (pa_str == NULL) {
+ ERR_PRINTS("PulseAudio: pa_stream_new error: " + String(pa_strerror(pa_context_errno(pa_ctx))));
+ ERR_FAIL_V(ERR_CANT_OPEN);
+ }
+
pa_buffer_attr attr;
// set to appropriate buffer length (in bytes) from global settings
- attr.tlength = buffer_size * sizeof(int16_t);
+ // Note: PulseAudio defaults to 4 fragments, which means that the actual
+ // latency is tlength / fragments. It seems that the PulseAudio has no way
+ // to get the fragments number so we're hardcoding this to the default of 4
+ const int fragments = 4;
+ attr.tlength = pa_buffer_size * sizeof(int16_t) * fragments;
// set them to be automatically chosen
attr.prebuf = (uint32_t)-1;
attr.maxlength = (uint32_t)-1;
attr.minreq = (uint32_t)-1;
- int error_code;
- pulse = pa_simple_new(NULL, // default server
- "Godot", // application name
- PA_STREAM_PLAYBACK,
- NULL, // default device
- "Sound", // stream description
- &spec,
- NULL, // use default channel map
- &attr, // use buffering attributes from above
- &error_code);
-
- if (pulse == NULL) {
- fprintf(stderr, "PulseAudio ERR: %s\n", pa_strerror(error_code));
- ERR_FAIL_COND_V(pulse == NULL, ERR_CANT_OPEN);
+ const char *dev = device_name == "Default" ? NULL : device_name.utf8().get_data();
+ pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE);
+ int error_code = pa_stream_connect_playback(pa_str, dev, &attr, flags, NULL, NULL);
+ ERR_FAIL_COND_V(error_code < 0, ERR_CANT_OPEN);
+
+ samples_in.resize(buffer_frames * channels);
+ samples_out.resize(pa_buffer_size);
+
+ return OK;
+}
+
+Error AudioDriverPulseAudio::init() {
+
+ active = false;
+ thread_exited = false;
+ exit_thread = false;
+
+ mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
+
+ pa_ml = pa_mainloop_new();
+ ERR_FAIL_COND_V(pa_ml == NULL, ERR_CANT_OPEN);
+
+ pa_ctx = pa_context_new(pa_mainloop_get_api(pa_ml), "Godot");
+ ERR_FAIL_COND_V(pa_ctx == NULL, ERR_CANT_OPEN);
+
+ pa_ready = 0;
+ pa_context_set_state_callback(pa_ctx, pa_state_cb, (void *)this);
+
+ int ret = pa_context_connect(pa_ctx, NULL, PA_CONTEXT_NOFLAGS, NULL);
+ if (ret < 0) {
+ if (pa_ctx) {
+ pa_context_unref(pa_ctx);
+ pa_ctx = NULL;
+ }
+
+ if (pa_ml) {
+ pa_mainloop_free(pa_ml);
+ pa_ml = NULL;
+ }
+
+ return ERR_CANT_OPEN;
+ }
+
+ while (pa_ready == 0) {
+ pa_mainloop_iterate(pa_ml, 1, NULL);
}
- samples_in.resize(buffer_size);
- samples_out.resize(buffer_size);
+ if (pa_ready < 0) {
+ if (pa_ctx) {
+ pa_context_disconnect(pa_ctx);
+ pa_context_unref(pa_ctx);
+ pa_ctx = NULL;
+ }
+
+ if (pa_ml) {
+ pa_mainloop_free(pa_ml);
+ pa_ml = NULL;
+ }
+
+ return ERR_CANT_OPEN;
+ }
- mutex = Mutex::create();
- thread = Thread::create(AudioDriverPulseAudio::thread_func, this);
+ Error err = init_device();
+ if (err == OK) {
+ mutex = Mutex::create();
+ thread = Thread::create(AudioDriverPulseAudio::thread_func, this);
+ }
return OK;
}
@@ -221,9 +261,24 @@ Error AudioDriverPulseAudio::init() {
float AudioDriverPulseAudio::get_latency() {
if (latency == 0) { //only do this once since it's approximate anyway
- int error_code;
- pa_usec_t palat = pa_simple_get_latency(pulse, &error_code);
- latency = double(palat) / 1000000.0;
+ lock();
+
+ pa_usec_t palat = 0;
+ if (pa_stream_get_state(pa_str) == PA_STREAM_READY) {
+ int negative = 0;
+
+ if (pa_stream_get_latency(pa_str, &palat, &negative) >= 0) {
+ if (negative) {
+ palat = 0;
+ }
+ }
+ }
+
+ if (palat > 0) {
+ latency = double(palat) / 1000000.0;
+ }
+
+ unlock();
}
return latency;
@@ -235,7 +290,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
while (!ad->exit_thread) {
if (!ad->active) {
- for (unsigned int i = 0; i < ad->buffer_size; i++) {
+ for (unsigned int i = 0; i < ad->pa_buffer_size; i++) {
ad->samples_out[i] = 0;
}
@@ -246,22 +301,86 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
ad->unlock();
- for (unsigned int i = 0; i < ad->buffer_size; i++) {
- ad->samples_out[i] = ad->samples_in[i] >> 16;
+ if (ad->channels == ad->pa_map.channels) {
+ for (unsigned int i = 0; i < ad->pa_buffer_size; i++) {
+ ad->samples_out[i] = ad->samples_in[i] >> 16;
+ }
+ } else {
+ // Uneven amount of channels
+ unsigned int in_idx = 0;
+ unsigned int out_idx = 0;
+
+ for (unsigned int i = 0; i < ad->buffer_frames; i++) {
+ for (unsigned int j = 0; j < ad->pa_map.channels - 1; j++) {
+ ad->samples_out[out_idx++] = ad->samples_in[in_idx++] >> 16;
+ }
+ uint32_t l = ad->samples_in[in_idx++];
+ uint32_t r = ad->samples_in[in_idx++];
+ ad->samples_out[out_idx++] = (l >> 1 + r >> 1) >> 16;
+ }
}
}
- // pa_simple_write always consumes the entire buffer
-
int error_code;
- int byte_size = ad->buffer_size * sizeof(int16_t);
- if (pa_simple_write(ad->pulse, ad->samples_out.ptr(), byte_size, &error_code) < 0) {
- // can't recover here
- fprintf(stderr, "PulseAudio failed and can't recover: %s\n", pa_strerror(error_code));
- ad->active = false;
- ad->exit_thread = true;
- break;
+ int byte_size = ad->pa_buffer_size * sizeof(int16_t);
+
+ ad->lock();
+
+ int ret;
+ do {
+ ret = pa_mainloop_iterate(ad->pa_ml, 0, NULL);
+ } while (ret > 0);
+
+ if (pa_stream_get_state(ad->pa_str) == PA_STREAM_READY) {
+ const void *ptr = ad->samples_out.ptr();
+ while (byte_size > 0) {
+ size_t bytes = pa_stream_writable_size(ad->pa_str);
+ if (bytes > 0) {
+ if (bytes > byte_size) {
+ bytes = byte_size;
+ }
+
+ ret = pa_stream_write(ad->pa_str, ptr, bytes, NULL, 0LL, PA_SEEK_RELATIVE);
+ if (ret >= 0) {
+ byte_size -= bytes;
+ ptr = (const char *)ptr + bytes;
+ }
+ } else {
+ ret = pa_mainloop_iterate(ad->pa_ml, 0, NULL);
+ if (ret == 0) {
+ // If pa_mainloop_iterate returns 0 sleep for 1 msec to wait
+ // for the stream to be able to process more bytes
+ ad->unlock();
+
+ OS::get_singleton()->delay_usec(1000);
+
+ ad->lock();
+ }
+ }
+ }
+ }
+
+ // User selected a new device, finish the current one so we'll init the new device
+ if (ad->device_name != ad->new_device) {
+ ad->device_name = ad->new_device;
+ ad->finish_device();
+
+ Error err = ad->init_device();
+ if (err != OK) {
+ ERR_PRINT("PulseAudio: init_device error");
+ ad->device_name = "Default";
+ ad->new_device = "Default";
+
+ err = ad->init_device();
+ if (err != OK) {
+ ad->active = false;
+ ad->exit_thread = true;
+ break;
+ }
+ }
}
+
+ ad->unlock();
}
ad->thread_exited = true;
@@ -282,6 +401,61 @@ AudioDriver::SpeakerMode AudioDriverPulseAudio::get_speaker_mode() const {
return get_speaker_mode_by_total_channels(channels);
}
+void AudioDriverPulseAudio::pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata) {
+ AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata;
+ int ctr = 0;
+
+ // If eol is set to a positive number, you're at the end of the list
+ if (eol > 0) {
+ return;
+ }
+
+ ad->pa_devices.push_back(l->name);
+ ad->pa_status++;
+}
+
+Array AudioDriverPulseAudio::get_device_list() {
+
+ pa_devices.clear();
+ pa_devices.push_back("Default");
+
+ if (pa_ctx == NULL) {
+ return pa_devices;
+ }
+
+ lock();
+
+ // Get the device list
+ pa_status = 0;
+ pa_operation *pa_op = pa_context_get_sink_info_list(pa_ctx, pa_sinklist_cb, (void *)this);
+ if (pa_op) {
+ while (pa_status == 0) {
+ int ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ if (ret < 0) {
+ ERR_PRINT("pa_mainloop_iterate error");
+ }
+ }
+
+ pa_operation_unref(pa_op);
+ } else {
+ ERR_PRINT("pa_context_get_server_info error");
+ }
+
+ unlock();
+
+ return pa_devices;
+}
+
+String AudioDriverPulseAudio::get_device() {
+
+ return device_name;
+}
+
+void AudioDriverPulseAudio::set_device(String device) {
+
+ new_device = device;
+}
+
void AudioDriverPulseAudio::lock() {
if (!thread || !mutex)
@@ -296,6 +470,15 @@ void AudioDriverPulseAudio::unlock() {
mutex->unlock();
}
+void AudioDriverPulseAudio::finish_device() {
+
+ if (pa_str) {
+ pa_stream_disconnect(pa_str);
+ pa_stream_unref(pa_str);
+ pa_str = NULL;
+ }
+}
+
void AudioDriverPulseAudio::finish() {
if (!thread)
@@ -304,9 +487,17 @@ void AudioDriverPulseAudio::finish() {
exit_thread = true;
Thread::wait_to_finish(thread);
- if (pulse) {
- pa_simple_free(pulse);
- pulse = NULL;
+ finish_device();
+
+ if (pa_ctx) {
+ pa_context_disconnect(pa_ctx);
+ pa_context_unref(pa_ctx);
+ pa_ctx = NULL;
+ }
+
+ if (pa_ml) {
+ pa_mainloop_free(pa_ml);
+ pa_ml = NULL;
}
memdelete(thread);
@@ -320,25 +511,32 @@ void AudioDriverPulseAudio::finish() {
AudioDriverPulseAudio::AudioDriverPulseAudio() {
+ pa_ml = NULL;
+ pa_ctx = NULL;
+ pa_str = NULL;
+
mutex = NULL;
thread = NULL;
- pulse = NULL;
+
+ device_name = "Default";
+ new_device = "Default";
+ default_device = "";
samples_in.clear();
samples_out.clear();
mix_rate = 0;
- buffer_size = 0;
+ buffer_frames = 0;
+ pa_buffer_size = 0;
channels = 0;
+ pa_ready = 0;
+ pa_status = 0;
active = false;
thread_exited = false;
exit_thread = false;
latency = 0;
- buffer_frames = 0;
- buffer_size = 0;
- channels = 0;
}
AudioDriverPulseAudio::~AudioDriverPulseAudio() {
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h
index 3bd1146f53..b471f5f9d5 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.h
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.h
@@ -37,22 +37,32 @@
#include "core/os/thread.h"
#include "servers/audio_server.h"
-#include <pulse/simple.h>
+#include <pulse/pulseaudio.h>
class AudioDriverPulseAudio : public AudioDriver {
Thread *thread;
Mutex *mutex;
- pa_simple *pulse;
+ pa_mainloop *pa_ml;
+ pa_context *pa_ctx;
+ pa_stream *pa_str;
+ pa_channel_map pa_map;
+
+ String device_name;
+ String new_device;
+ String default_device;
Vector<int32_t> samples_in;
Vector<int16_t> samples_out;
unsigned int mix_rate;
unsigned int buffer_frames;
- unsigned int buffer_size;
+ unsigned int pa_buffer_size;
int channels;
+ int pa_ready;
+ int pa_status;
+ Array pa_devices;
bool active;
bool thread_exited;
@@ -60,6 +70,16 @@ class AudioDriverPulseAudio : public AudioDriver {
float latency;
+ static void pa_state_cb(pa_context *c, void *userdata);
+ static void pa_sink_info_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata);
+ static void pa_server_info_cb(pa_context *c, const pa_server_info *i, void *userdata);
+ static void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata);
+
+ Error init_device();
+ void finish_device();
+
+ void detect_channels();
+
static void thread_func(void *p_udata);
public:
@@ -71,6 +91,9 @@ public:
virtual void start();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
+ virtual Array get_device_list();
+ virtual String get_device();
+ virtual void set_device(String device);
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp
index ed6f2e24ed..457486797f 100644
--- a/drivers/rtaudio/audio_driver_rtaudio.cpp
+++ b/drivers/rtaudio/audio_driver_rtaudio.cpp
@@ -133,7 +133,7 @@ Error AudioDriverRtAudio::init() {
break;
} catch (RtAudioError &e) {
// try with less channels
- ERR_PRINT("Unable to open audio, retrying with fewer channels..");
+ ERR_PRINT("Unable to open audio, retrying with fewer channels...");
switch (speaker_mode) {
case SPEAKER_SURROUND_51: speaker_mode = SPEAKER_MODE_STEREO; break;
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 3944431516..5a4be6df4f 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -244,7 +244,7 @@ static void _get_drives(List<String> *list) {
// Parse only file:// links
if (strncmp(string, "file://", 7) == 0) {
// Strip any unwanted edges on the strings and push_back if it's not a duplicate
- String fpath = String(string + 7).strip_edges();
+ String fpath = String(string + 7).strip_edges().split_spaces()[0].percent_decode();
if (!list->find(fpath)) {
list->push_back(fpath);
}
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 5b093a5885..c25d34125d 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -69,6 +69,7 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
fclose(f);
f = NULL;
+ path_src = p_path;
path = fix_path(p_path);
//printf("opening %ls, %i\n", path.c_str(), Memory::get_static_mem_usage());
@@ -135,7 +136,7 @@ void FileAccessUnix::close() {
if (save_path != "") {
//unlink(save_path.utf8().get_data());
- //print_line("renaming..");
+ //print_line("renaming...");
int rename_error = rename((save_path + ".tmp").utf8().get_data(), save_path.utf8().get_data());
if (rename_error && close_fail_notify) {
@@ -152,6 +153,16 @@ bool FileAccessUnix::is_open() const {
return (f != NULL);
}
+String FileAccessUnix::get_path() const {
+
+ return path_src;
+}
+
+String FileAccessUnix::get_path_absolute() const {
+
+ return path;
+}
+
void FileAccessUnix::seek(size_t p_position) {
ERR_FAIL_COND(!f);
@@ -173,7 +184,7 @@ size_t FileAccessUnix::get_position() const {
ERR_FAIL_COND_V(!f, 0);
- int pos = ftell(f);
+ long pos = ftell(f);
if (pos < 0) {
check_errors();
ERR_FAIL_V(0);
@@ -185,10 +196,10 @@ size_t FileAccessUnix::get_len() const {
ERR_FAIL_COND_V(!f, 0);
- int pos = ftell(f);
+ long pos = ftell(f);
ERR_FAIL_COND_V(pos < 0, 0);
ERR_FAIL_COND_V(fseek(f, 0, SEEK_END), 0);
- int size = ftell(f);
+ long size = ftell(f);
ERR_FAIL_COND_V(size < 0, 0);
ERR_FAIL_COND_V(fseek(f, pos, SEEK_SET), 0);
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index dbb1c9f3b5..88bb39fbd1 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -51,6 +51,7 @@ class FileAccessUnix : public FileAccess {
mutable Error last_error;
String save_path;
String path;
+ String path_src;
static FileAccess *create_libc();
@@ -61,6 +62,9 @@ public:
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
+ virtual String get_path() const; /// returns the path for the current open file
+ virtual String get_path_absolute() const; /// returns the absolute path for the current open file
+
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index 032d91f0dc..949609bb9a 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -101,16 +101,18 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
};
- hints.ai_flags &= !AI_NUMERICHOST;
+ hints.ai_flags &= ~AI_NUMERICHOST;
int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);
if (s != 0) {
- ERR_PRINT("getaddrinfo failed!");
+ ERR_PRINT("getaddrinfo failed! Cannot resolve hostname.");
return IP_Address();
};
if (result == NULL || result->ai_addr == NULL) {
ERR_PRINT("Invalid response from getaddrinfo");
+ if (result)
+ freeaddrinfo(result);
return IP_Address();
};
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index aa01f22673..05dfd69f58 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -73,13 +73,21 @@ void OS_Unix::debug_break() {
assert(false);
};
-int OS_Unix::get_audio_driver_count() const {
+static void handle_interrupt(int sig) {
+ if (ScriptDebugger::get_singleton() == NULL)
+ return;
- return 1;
+ ScriptDebugger::get_singleton()->set_depth(-1);
+ ScriptDebugger::get_singleton()->set_lines_left(1);
}
-const char *OS_Unix::get_audio_driver_name(int p_driver) const {
- return "dummy";
+void OS_Unix::initialize_debugging() {
+
+ if (ScriptDebugger::get_singleton() != NULL) {
+ struct sigaction action;
+ action.sa_handler = handle_interrupt;
+ sigaction(SIGINT, &action, NULL);
+ }
}
int OS_Unix::unix_initialize_audio(int p_audio_driver) {
@@ -98,10 +106,11 @@ void handle_sigchld(int sig) {
void OS_Unix::initialize_core() {
-#ifdef NO_PTHREADS
+#ifdef NO_THREADS
ThreadDummy::make_default();
SemaphoreDummy::make_default();
MutexDummy::make_default();
+ RWLockDummy::make_default();
#else
ThreadPosix::make_default();
SemaphorePosix::make_default();
@@ -235,7 +244,7 @@ OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
void OS_Unix::delay_usec(uint32_t p_usec) const {
- struct timespec rem = { p_usec / 1000000, (p_usec % 1000000) * 1000 };
+ struct timespec rem = { static_cast<time_t>(p_usec / 1000000), static_cast<long>((p_usec % 1000000) * 1000) };
while (nanosleep(&rem, &rem) == EINTR) {
}
}
@@ -357,6 +366,12 @@ Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle
String path = p_path;
+ if (FileAccess::exists(path) && path.is_rel_path()) {
+ // dlopen expects a slash, in this case a leading ./ for it to be interpreted as a relative path,
+ // otherwise it will end up searching various system directories for the lib instead and finally failing.
+ path = "./" + path;
+ }
+
if (!FileAccess::exists(path)) {
//this code exists so gdnative can load .so files from within the executable path
path = get_executable_path().get_base_dir().plus_file(p_path.get_file());
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index a7c9015330..95b74d23ff 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -48,12 +48,6 @@ protected:
// UNIX only handles the core functions.
// inheriting platforms under unix (eg. X11) should handle the rest
- //virtual int get_video_driver_count() const;
- //virtual const char * get_video_driver_name(int p_driver) const;
-
- virtual int get_audio_driver_count() const;
- virtual const char *get_audio_driver_name(int p_driver) const;
-
virtual void initialize_core();
virtual int unix_initialize_audio(int p_audio_driver);
//virtual Error initialize(int p_video_driver,int p_audio_driver);
@@ -107,6 +101,7 @@ public:
virtual int get_processor_count() const;
virtual void debug_break();
+ virtual void initialize_debugging();
virtual String get_executable_path() const;
virtual String get_user_data_dir() const;
diff --git a/drivers/unix/socket_helpers.h b/drivers/unix/socket_helpers.h
index 5ef9ad3088..5b42c13eae 100644
--- a/drivers/unix/socket_helpers.h
+++ b/drivers/unix/socket_helpers.h
@@ -124,6 +124,13 @@ static int _socket_create(IP::Type &p_type, int type, int protocol) {
WARN_PRINT("Unable to set/unset IPv4 address mapping over IPv6");
}
}
+ if (protocol == IPPROTO_UDP && p_type != IP::TYPE_IPV6) {
+ // Enable broadcasting for UDP sockets if it's not IPv6 only (IPv6 has no broadcast option).
+ int broadcast = 1;
+ if (setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast)) != 0) {
+ WARN_PRINT("Error when enabling broadcasting");
+ }
+ }
return sockfd;
}
diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp
index 17112e5ab5..44b9ef1d7c 100644
--- a/drivers/unix/stream_peer_tcp_posix.cpp
+++ b/drivers/unix/stream_peer_tcp_posix.cpp
@@ -124,11 +124,14 @@ void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port,
sock_type = p_sock_type;
sockfd = p_sockfd;
#ifndef NO_FCNTL
- fcntl(sockfd, F_SETFL, O_NONBLOCK);
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#else
int bval = 1;
- ioctl(sockfd, FIONBIO, &bval);
-
+ if (ioctl(sockfd, FIONBIO, &bval) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#endif
status = STATUS_CONNECTING;
@@ -150,10 +153,14 @@ Error StreamPeerTCPPosix::connect_to_host(const IP_Address &p_host, uint16_t p_p
};
#ifndef NO_FCNTL
- fcntl(sockfd, F_SETFL, O_NONBLOCK);
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#else
int bval = 1;
- ioctl(sockfd, FIONBIO, &bval);
+ if (ioctl(sockfd, FIONBIO, &bval) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#endif
struct sockaddr_storage their_addr;
@@ -290,6 +297,7 @@ Error StreamPeerTCPPosix::read(uint8_t *p_buffer, int p_bytes, int &r_received,
status = STATUS_NONE;
peer_port = 0;
peer_host = IP_Address();
+ r_received = total_read;
return ERR_FILE_EOF;
} else {
@@ -308,7 +316,9 @@ void StreamPeerTCPPosix::set_no_delay(bool p_enabled) {
ERR_FAIL_COND(!is_connected_to_host());
int flag = p_enabled ? 1 : 0;
- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
+ if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0) {
+ ERR_PRINT("Unable to set TCP no delay option");
+ }
}
bool StreamPeerTCPPosix::is_connected_to_host() const {
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp
index 07ffe3b00a..67ab981f46 100644
--- a/drivers/unix/tcp_server_posix.cpp
+++ b/drivers/unix/tcp_server_posix.cpp
@@ -91,10 +91,14 @@ Error TCPServerPosix::listen(uint16_t p_port, const IP_Address &p_bind_address)
ERR_FAIL_COND_V(sockfd == -1, FAILED);
#ifndef NO_FCNTL
- fcntl(sockfd, F_SETFL, O_NONBLOCK);
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#else
int bval = 1;
- ioctl(sockfd, FIONBIO, &bval);
+ if (ioctl(sockfd, FIONBIO, &bval) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#endif
int reuse = 1;
@@ -113,6 +117,7 @@ Error TCPServerPosix::listen(uint16_t p_port, const IP_Address &p_bind_address)
ERR_FAIL_V(FAILED);
};
} else {
+ close(sockfd);
return ERR_ALREADY_IN_USE;
};
@@ -157,10 +162,14 @@ Ref<StreamPeerTCP> TCPServerPosix::take_connection() {
int fd = accept(listen_sockfd, (struct sockaddr *)&their_addr, &size);
ERR_FAIL_COND_V(fd == -1, Ref<StreamPeerTCP>());
#ifndef NO_FCNTL
- fcntl(fd, F_SETFL, O_NONBLOCK);
+ if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#else
int bval = 1;
- ioctl(fd, FIONBIO, &bval);
+ if (ioctl(fd, FIONBIO, &bval) < 0) {
+ WARN_PRINT("Error setting socket as non blocking");
+ }
#endif
Ref<StreamPeerTCPPosix> conn = memnew(StreamPeerTCPPosix);
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp
index f079ae2ae2..a73b40a6f2 100644
--- a/drivers/unix/thread_posix.cpp
+++ b/drivers/unix/thread_posix.cpp
@@ -31,7 +31,7 @@
#include "thread_posix.h"
#include "script_language.h"
-#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
+#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS)
#ifdef PTHREAD_BSD_SET_NAME
#include <pthread_np.h>
diff --git a/drivers/unix/thread_posix.h b/drivers/unix/thread_posix.h
index 15c9265e6d..ea2de61bd5 100644
--- a/drivers/unix/thread_posix.h
+++ b/drivers/unix/thread_posix.h
@@ -35,7 +35,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)
+#if (defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED)) && !defined(NO_THREADS)
#include "os/thread.h"
#include <pthread.h>
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 36acfb10d1..e1680601ad 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -35,6 +35,19 @@
#include "os/os.h"
#include "project_settings.h"
+#include <functiondiscoverykeys.h>
+
+#ifndef PKEY_Device_FriendlyName
+
+#undef DEFINE_PROPERTYKEY
+/* clang-format off */
+#define DEFINE_PROPERTYKEY(id, a, b, c, d, e, f, g, h, i, j, k, l) \
+ const PROPERTYKEY id = { { a, b, c, { d, e, f, g, h, i, j, k, } }, l };
+/* clang-format on */
+
+DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
+#endif
+
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
@@ -121,7 +134,61 @@ Error AudioDriverWASAPI::init_device(bool reinit) {
HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void **)&enumerator);
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
- hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &device);
+ if (device_name == "Default") {
+ hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &device);
+ } else {
+ IMMDeviceCollection *devices = NULL;
+
+ hr = enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &devices);
+ ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
+
+ LPWSTR strId = NULL;
+ bool found = false;
+
+ UINT count = 0;
+ hr = devices->GetCount(&count);
+ ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
+
+ for (ULONG i = 0; i < count && !found; i++) {
+ IMMDevice *device = NULL;
+
+ hr = devices->Item(i, &device);
+ ERR_BREAK(hr != S_OK);
+
+ IPropertyStore *props = NULL;
+ hr = device->OpenPropertyStore(STGM_READ, &props);
+ ERR_BREAK(hr != S_OK);
+
+ PROPVARIANT propvar;
+ PropVariantInit(&propvar);
+
+ hr = props->GetValue(PKEY_Device_FriendlyName, &propvar);
+ ERR_BREAK(hr != S_OK);
+
+ if (device_name == String(propvar.pwszVal)) {
+ hr = device->GetId(&strId);
+ ERR_BREAK(hr != S_OK);
+
+ found = true;
+ }
+
+ PropVariantClear(&propvar);
+ props->Release();
+ device->Release();
+ }
+
+ if (found) {
+ hr = enumerator->GetDevice(strId, &device);
+ }
+
+ if (strId) {
+ CoTaskMemFree(strId);
+ }
+
+ if (device == NULL) {
+ hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &device);
+ }
+ }
if (reinit) {
// In case we're trying to re-initialize the device prevent throwing this error on the console,
// otherwise if there is currently no device available this will spam the console.
@@ -151,7 +218,6 @@ Error AudioDriverWASAPI::init_device(bool reinit) {
// Since we're using WASAPI Shared Mode we can't control any of these, we just tag along
wasapi_channels = pwfex->nChannels;
- mix_rate = pwfex->nSamplesPerSec;
format_tag = pwfex->wFormatTag;
bits_per_sample = pwfex->wBitsPerSample;
@@ -187,7 +253,14 @@ Error AudioDriverWASAPI::init_device(bool reinit) {
}
}
- hr = audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 0, 0, pwfex, NULL);
+ DWORD streamflags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
+ if (mix_rate != pwfex->nSamplesPerSec) {
+ streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST;
+ pwfex->nSamplesPerSec = mix_rate;
+ pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nChannels * (pwfex->wBitsPerSample / 8);
+ }
+
+ hr = audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, streamflags, 0, 0, pwfex, NULL);
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
event = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -223,10 +296,11 @@ Error AudioDriverWASAPI::finish_device() {
if (audio_client) {
if (active) {
audio_client->Stop();
- audio_client->Release();
- audio_client = NULL;
active = false;
}
+
+ audio_client->Release();
+ audio_client = NULL;
}
if (render_client) {
@@ -244,6 +318,8 @@ Error AudioDriverWASAPI::finish_device() {
Error AudioDriverWASAPI::init() {
+ mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE);
+
Error err = init_device();
if (err != OK) {
ERR_PRINT("WASAPI: init_device error");
@@ -285,6 +361,64 @@ AudioDriver::SpeakerMode AudioDriverWASAPI::get_speaker_mode() const {
return get_speaker_mode_by_total_channels(channels);
}
+Array AudioDriverWASAPI::get_device_list() {
+
+ Array list;
+ IMMDeviceCollection *devices = NULL;
+ IMMDeviceEnumerator *enumerator = NULL;
+
+ list.push_back(String("Default"));
+
+ CoInitialize(NULL);
+
+ HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void **)&enumerator);
+ ERR_FAIL_COND_V(hr != S_OK, Array());
+
+ hr = enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &devices);
+ ERR_FAIL_COND_V(hr != S_OK, Array());
+
+ UINT count = 0;
+ hr = devices->GetCount(&count);
+ ERR_FAIL_COND_V(hr != S_OK, Array());
+
+ for (ULONG i = 0; i < count; i++) {
+ IMMDevice *device = NULL;
+
+ hr = devices->Item(i, &device);
+ ERR_BREAK(hr != S_OK);
+
+ IPropertyStore *props = NULL;
+ hr = device->OpenPropertyStore(STGM_READ, &props);
+ ERR_BREAK(hr != S_OK);
+
+ PROPVARIANT propvar;
+ PropVariantInit(&propvar);
+
+ hr = props->GetValue(PKEY_Device_FriendlyName, &propvar);
+ ERR_BREAK(hr != S_OK);
+
+ list.push_back(String(propvar.pwszVal));
+
+ PropVariantClear(&propvar);
+ props->Release();
+ device->Release();
+ }
+
+ devices->Release();
+ enumerator->Release();
+ return list;
+}
+
+String AudioDriverWASAPI::get_device() {
+
+ return device_name;
+}
+
+void AudioDriverWASAPI::set_device(String device) {
+
+ new_device = device;
+}
+
void AudioDriverWASAPI::write_sample(AudioDriverWASAPI *ad, BYTE *buffer, int i, int32_t sample) {
if (ad->format_tag == WAVE_FORMAT_PCM) {
switch (ad->bits_per_sample) {
@@ -400,7 +534,8 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
}
}
- if (default_device_changed) {
+ // If we're using the Default device and it changed finish it so we'll re-init the device
+ if (ad->device_name == "Default" && default_device_changed) {
Error err = ad->finish_device();
if (err != OK) {
ERR_PRINT("WASAPI: finish_device error");
@@ -409,6 +544,15 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
default_device_changed = false;
}
+ // User selected a new device, finish the current one so we'll init the new device
+ if (ad->device_name != ad->new_device) {
+ ad->device_name = ad->new_device;
+ Error err = ad->finish_device();
+ if (err != OK) {
+ ERR_PRINT("WASAPI: finish_device error");
+ }
+ }
+
if (!ad->audio_client) {
Error err = ad->init_device(true);
if (err == OK) {
@@ -483,6 +627,9 @@ AudioDriverWASAPI::AudioDriverWASAPI() {
thread_exited = false;
exit_thread = false;
active = false;
+
+ device_name = "Default";
+ new_device = "Default";
}
#endif
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index 2b19f0cca1..c97f4c288c 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -49,6 +49,9 @@ class AudioDriverWASAPI : public AudioDriver {
Mutex *mutex;
Thread *thread;
+ String device_name;
+ String new_device;
+
WORD format_tag;
WORD bits_per_sample;
@@ -80,6 +83,9 @@ public:
virtual void start();
virtual int get_mix_rate() const;
virtual SpeakerMode get_speaker_mode() const;
+ virtual Array get_device_list();
+ virtual String get_device();
+ virtual void set_device(String device);
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 2e64b55430..cf4d82fb07 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -261,13 +261,30 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
p_new_path = fix_path(p_new_path);
- if (file_exists(p_new_path)) {
- if (remove(p_new_path) != OK) {
+ // If we're only changing file name case we need to do a little juggling
+ if (p_path.to_lower() == p_new_path.to_lower()) {
+ WCHAR tmpfile[MAX_PATH];
+
+ if (!GetTempFileNameW(fix_path(get_current_dir()).c_str(), NULL, 0, tmpfile)) {
return FAILED;
- };
- };
+ }
+
+ if (!::ReplaceFileW(tmpfile, p_path.c_str(), NULL, 0, NULL, NULL)) {
+ DeleteFileW(tmpfile);
+ return FAILED;
+ }
- return ::_wrename(p_path.c_str(), p_new_path.c_str()) == 0 ? OK : FAILED;
+ return ::_wrename(tmpfile, p_new_path.c_str()) == 0 ? OK : FAILED;
+
+ } else {
+ if (file_exists(p_new_path)) {
+ if (remove(p_new_path) != OK) {
+ return FAILED;
+ }
+ }
+
+ return ::_wrename(p_path.c_str(), p_new_path.c_str()) == 0 ? OK : FAILED;
+ }
}
Error DirAccessWindows::remove(String p_path) {
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 072790876f..aa0fd34e0a 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -57,7 +57,8 @@ void FileAccessWindows::check_errors() const {
Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
- String filename = fix_path(p_path);
+ path_src = p_path;
+ path = fix_path(p_path);
if (f)
close();
@@ -78,19 +79,40 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
backend supports utf8 encoding */
struct _stat st;
- if (_wstat(filename.c_str(), &st) == 0) {
+ if (_wstat(path.c_str(), &st) == 0) {
if (!S_ISREG(st.st_mode))
return ERR_FILE_CANT_OPEN;
};
+#ifdef TOOLS_ENABLED
+ // Windows is case insensitive, but all other platforms are sensitive to it
+ // To ease cross-platform development, we issue a warning if users try to access
+ // a file using the wrong case (which *works* on Windows, but won't on other
+ // platforms).
+ if (p_mode_flags == READ) {
+ WIN32_FIND_DATAW d = { 0 };
+ HANDLE f = FindFirstFileW(path.c_str(), &d);
+ if (f) {
+ String fname = d.cFileName;
+ if (fname != String()) {
+
+ String base_file = path.get_file();
+ if (base_file != fname && base_file.findn(fname) == 0) {
+ WARN_PRINTS("Case mismatch opening requested file '" + base_file + "', stored as '" + fname + "' in the filesystem. This file will not open when exported to other case-sensitive platforms.");
+ }
+ }
+ FindClose(f);
+ }
+ }
+#endif
+
if (is_backup_save_enabled() && p_mode_flags & WRITE && !(p_mode_flags & READ)) {
- save_path = filename;
- filename = filename + ".tmp";
- //print_line("saving instead to "+path);
+ save_path = path;
+ path = path + ".tmp";
}
- f = _wfopen(filename.c_str(), mode_string);
+ f = _wfopen(path.c_str(), mode_string);
if (f == NULL) {
last_error = ERR_FILE_CANT_OPEN;
@@ -112,7 +134,7 @@ void FileAccessWindows::close() {
if (save_path != "") {
//unlink(save_path.utf8().get_data());
- //print_line("renaming..");
+ //print_line("renaming...");
//_wunlink(save_path.c_str()); //unlink if exists
//int rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str());
@@ -138,22 +160,36 @@ void FileAccessWindows::close() {
//atomic replace for existing file
rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
}
- if (rename_error && close_fail_notify) {
- close_fail_notify(save_path);
- }
if (rename_error) {
attempts--;
- OS::get_singleton()->delay_usec(1000000); //wait 100msec and try again
+ OS::get_singleton()->delay_usec(100000); // wait 100msec and try again
}
}
- save_path = "";
if (rename_error) {
+ if (close_fail_notify) {
+ close_fail_notify(save_path);
+ }
+
ERR_EXPLAIN("Safe save failed. This may be a permissions problem, but also may happen because you are running a paranoid antivirus. If this is the case, please switch to Windows Defender or disable the 'safe save' option in editor settings. This makes it work, but increases the risk of file corruption in a crash.");
}
+
+ save_path = "";
+
ERR_FAIL_COND(rename_error);
}
}
+
+String FileAccessWindows::get_path() const {
+
+ return path_src;
+}
+
+String FileAccessWindows::get_path_absolute() const {
+
+ return path;
+}
+
bool FileAccessWindows::is_open() const {
return (f != NULL);
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 26bd08b7af..0462c1e942 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -46,6 +46,8 @@ class FileAccessWindows : public FileAccess {
int flags;
void check_errors() const;
mutable Error last_error;
+ String path;
+ String path_src;
String save_path;
public:
@@ -53,6 +55,9 @@ public:
virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open
+ virtual String get_path() const; /// returns the path for the current open file
+ virtual String get_path_absolute() const; /// returns the absolute path for the current open file
+
virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position = 0); ///< seek from the end of file
virtual size_t get_position() const; ///< get position in the file
diff --git a/drivers/windows/stream_peer_tcp_winsock.cpp b/drivers/windows/stream_peer_tcp_winsock.cpp
index 55775fc231..19c937170b 100644
--- a/drivers/windows/stream_peer_tcp_winsock.cpp
+++ b/drivers/windows/stream_peer_tcp_winsock.cpp
@@ -212,6 +212,7 @@ Error StreamPeerTCPWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received
_block(sockfd, true, false);
} else if (read == 0) {
disconnect_from_host();
+ r_received = total_read;
return ERR_FILE_EOF;
} else {
@@ -335,7 +336,9 @@ Error StreamPeerTCPWinsock::connect_to_host(const IP_Address &p_host, uint16_t p
void StreamPeerTCPWinsock::set_no_delay(bool p_enabled) {
ERR_FAIL_COND(!is_connected_to_host());
int flag = p_enabled ? 1 : 0;
- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
+ if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) != 0) {
+ ERR_PRINT("Unable to set TCP no delay option");
+ }
}
int StreamPeerTCPWinsock::get_available_bytes() const {
diff --git a/drivers/windows/tcp_server_winsock.cpp b/drivers/windows/tcp_server_winsock.cpp
index 413a0d19b5..ddb955549f 100644
--- a/drivers/windows/tcp_server_winsock.cpp
+++ b/drivers/windows/tcp_server_winsock.cpp
@@ -105,6 +105,7 @@ Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address &p_bind_address
ERR_FAIL_V(FAILED);
};
} else {
+ closesocket(sockfd);
return ERR_ALREADY_IN_USE;
};
diff --git a/editor/SCsub b/editor/SCsub
index 8f87e12cb9..a9343f7f36 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -4,9 +4,9 @@ Import('env')
env.editor_sources = []
import os
+import os.path
from compat import encode_utf8, byte_to_str, open_utf8, escape_string
-
def make_certs_header(target, source, env):
src = source[0].srcnode().abspath
@@ -29,6 +29,9 @@ def make_certs_header(target, source, env):
g.write("};\n")
g.write("#endif")
+ g.close()
+ f.close()
+
def make_doc_header(target, source, env):
@@ -41,8 +44,8 @@ def make_doc_header(target, source, env):
src = s.srcnode().abspath
if not src.endswith(".xml"):
continue
- f = open_utf8(src, "r")
- content = f.read()
+ with open_utf8(src, "r") as f:
+ content = f.read()
buf += content
buf = encode_utf8(docbegin + buf + docend)
@@ -62,6 +65,8 @@ def make_doc_header(target, source, env):
g.write("#endif")
+ g.close()
+
def make_fonts_header(target, source, env):
@@ -76,9 +81,8 @@ def make_fonts_header(target, source, env):
# saving uncompressed, since freetype will reference from memory pointer
xl_names = []
for i in range(len(source)):
- f = open(source[i].srcnode().abspath, "rb")
- buf = f.read()
- import os.path
+ with open(source[i].srcnode().abspath, "rb")as f:
+ buf = f.read()
name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0]
@@ -91,6 +95,8 @@ def make_fonts_header(target, source, env):
g.write("#endif")
+ g.close()
+
def make_translations_header(target, source, env):
@@ -110,8 +116,8 @@ def make_translations_header(target, source, env):
xl_names = []
for i in range(len(sorted_paths)):
- f = open(sorted_paths[i], "rb")
- buf = f.read()
+ with open(sorted_paths[i], "rb") as f:
+ buf = f.read()
decomp_size = len(buf)
buf = zlib.compress(buf)
name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
@@ -138,266 +144,20 @@ def make_translations_header(target, source, env):
g.write("#endif")
-def make_authors_header(target, source, env):
-
- sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"]
- sections_id = ["dev_founders", "dev_lead", "dev_manager", "dev_names"]
-
- src = source[0].srcnode().abspath
- dst = target[0].srcnode().abspath
- f = open_utf8(src, "r")
- g = open_utf8(dst, "w")
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_AUTHORS_H\n")
- g.write("#define _EDITOR_AUTHORS_H\n")
-
- current_section = ""
- reading = False
-
- def close_section():
- g.write("\t0\n")
- g.write("};\n")
-
- for line in f:
- if reading:
- if line.startswith(" "):
- g.write("\t\"" + escape_string(line.strip()) + "\",\n")
- continue
- if line.startswith("## "):
- if reading:
- close_section()
- reading = False
- for i in range(len(sections)):
- if line.strip().endswith(sections[i]):
- current_section = escape_string(sections_id[i])
- reading = True
- g.write("static const char *" + current_section + "[] = {\n")
- break
-
- if reading:
- close_section()
-
- g.write("#endif\n")
-
-def make_donors_header(target, source, env):
-
- sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", "Gold donors", "Silver donors", "Bronze donors"]
- sections_id = ["donor_s_plat", "donor_s_gold", "donor_s_mini", "donor_gold", "donor_silver", "donor_bronze"]
-
- src = source[0].srcnode().abspath
- dst = target[0].srcnode().abspath
- f = open_utf8(src, "r")
- g = open_utf8(dst, "w")
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_DONORS_H\n")
- g.write("#define _EDITOR_DONORS_H\n")
-
- current_section = ""
- reading = False
-
- def close_section():
- g.write("\t0\n")
- g.write("};\n")
-
- for line in f:
- if reading >= 0:
- if line.startswith(" "):
- g.write("\t\"" + escape_string(line.strip()) + "\",\n")
- continue
- if line.startswith("## "):
- if reading:
- close_section()
- reading = False
- for i in range(len(sections)):
- if line.strip().endswith(sections[i]):
- current_section = escape_string(sections_id[i])
- reading = True
- g.write("static const char *" + current_section + "[] = {\n")
- break
-
- if reading:
- close_section()
-
- g.write("#endif\n")
-
-def make_license_header(target, source, env):
-
- src_copyright = source[0].srcnode().abspath
- src_license = source[1].srcnode().abspath
- dst = target[0].srcnode().abspath
- f = open_utf8(src_license, "r")
- fc = open_utf8(src_copyright, "r")
- g = open_utf8(dst, "w")
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef _EDITOR_LICENSE_H\n")
- g.write("#define _EDITOR_LICENSE_H\n")
- g.write("static const char *about_license =")
-
- for line in f:
- escaped_string = escape_string(line.strip())
- g.write("\n\t\"" + escaped_string + "\\n\"")
-
- g.write(";\n")
-
- tp_current = 0
- tp_file = ""
- tp_comment = ""
- tp_copyright = ""
- tp_license = ""
-
- tp_licensename = ""
- tp_licensebody = ""
-
- tp = []
- tp_licensetext = []
- for line in fc:
- if line.startswith("#"):
- continue
-
- if line.startswith("Files:"):
- tp_file = line[6:].strip()
- tp_current = 1
- elif line.startswith("Comment:"):
- tp_comment = line[8:].strip()
- tp_current = 2
- elif line.startswith("Copyright:"):
- tp_copyright = line[10:].strip()
- tp_current = 3
- elif line.startswith("License:"):
- if tp_current != 0:
- tp_license = line[8:].strip()
- tp_current = 4
- else:
- tp_licensename = line[8:].strip()
- tp_current = 5
- elif line.startswith(" "):
- if tp_current == 1:
- tp_file += "\n" + line.strip()
- elif tp_current == 3:
- tp_copyright += "\n" + line.strip()
- elif tp_current == 5:
- if line.strip() == ".":
- tp_licensebody += "\n"
- else:
- tp_licensebody += line[1:]
- else:
- if tp_current != 0:
- if tp_current == 5:
- tp_licensetext.append([tp_licensename, tp_licensebody])
-
- tp_licensename = ""
- tp_licensebody = ""
- else:
- added = False
- for i in tp:
- if i[0] == tp_comment:
- i[1].append([tp_file, tp_copyright, tp_license])
- added = True
- break
- if not added:
- tp.append([tp_comment,[[tp_file, tp_copyright, tp_license]]])
-
- tp_file = []
- tp_comment = ""
- tp_copyright = []
- tp_license = ""
- tp_current = 0
-
- tp_licensetext.append([tp_licensename, tp_licensebody])
-
- about_thirdparty = ""
- about_tp_copyright_count = ""
- about_tp_license = ""
- about_tp_copyright = ""
- about_tp_file = ""
-
- for i in tp:
- about_thirdparty += "\t\"" + i[0] + "\",\n"
- about_tp_copyright_count += str(len(i[1])) + ", "
- for j in i[1]:
- file_body = ""
- copyright_body = ""
- for k in j[0].split("\n"):
- if file_body != "":
- file_body += "\\n\"\n"
- escaped_string = escape_string(k.strip())
- file_body += "\t\"" + escaped_string
- for k in j[1].split("\n"):
- if copyright_body != "":
- copyright_body += "\\n\"\n"
- escaped_string = escape_string(k.strip())
- copyright_body += "\t\"" + escaped_string
-
- about_tp_file += "\t" + file_body + "\",\n"
- about_tp_copyright += "\t" + copyright_body + "\",\n"
- about_tp_license += "\t\"" + j[2] + "\",\n"
-
- about_license_name = ""
- about_license_body = ""
-
- for i in tp_licensetext:
- body = ""
- for j in i[1].split("\n"):
- if body != "":
- body += "\\n\"\n"
- escaped_string = escape_string(j.strip())
- body += "\t\"" + escaped_string
-
- about_license_name += "\t\"" + i[0] + "\",\n"
- about_license_body += "\t" + body + "\",\n"
-
- g.write("static const char *about_thirdparty[] = {\n")
- g.write(about_thirdparty)
- g.write("\t0\n")
- g.write("};\n")
- g.write("#define THIRDPARTY_COUNT " + str(len(tp)) + "\n")
-
- g.write("static const int about_tp_copyright_count[] = {\n\t")
- g.write(about_tp_copyright_count)
- g.write("0\n};\n")
-
- g.write("static const char *about_tp_file[] = {\n")
- g.write(about_tp_file)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("static const char *about_tp_copyright[] = {\n")
- g.write(about_tp_copyright)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("static const char *about_tp_license[] = {\n")
- g.write(about_tp_license)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("static const char *about_license_name[] = {\n")
- g.write(about_license_name)
- g.write("\t0\n")
- g.write("};\n")
- g.write("#define LICENSE_COUNT " + str(len(tp_licensetext)) + "\n")
-
- g.write("static const char *about_license_body[] = {\n")
- g.write(about_license_body)
- g.write("\t0\n")
- g.write("};\n")
-
- g.write("#endif\n")
-
+ g.close()
def _make_doc_data_class_path(to_path):
- g = open_utf8(os.path.join(to_path,"doc_data_class_path.gen.h"), "w")
- g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n")
- g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
+ g = open_utf8(os.path.join(to_path,"doc_data_class_path.gen.h"), "w")
+ g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n")
+ g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
+
+ g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n");
+ for c in sorted(env.doc_class_path):
+ g.write("\t{\"" + c + "\", \"" + env.doc_class_path[c] + "\"},\n")
+ g.write("\t{NULL, NULL}\n")
+ g.write("};\n")
- g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n");
- for c in sorted(env.doc_class_path):
- g.write("\t{\"" + c + "\", \"" + env.doc_class_path[c] + "\"},\n")
- g.write("\t{NULL, NULL}\n")
- g.write("};\n")
+ g.close()
if env['tools']:
@@ -409,10 +169,9 @@ if env['tools']:
reg_exporters += '\tregister_' + e + '_exporter();\n'
reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
reg_exporters += '}\n'
- f = open_utf8("register_exporters.gen.cpp", "w")
- f.write(reg_exporters_inc)
- f.write(reg_exporters)
- f.close()
+ with open_utf8("register_exporters.gen.cpp", "w") as f:
+ f.write(reg_exporters_inc)
+ f.write(reg_exporters)
# API documentation
docs = []
@@ -433,10 +192,10 @@ if env['tools']:
docs = sorted(docs)
env.Depends("#editor/doc_data_compressed.gen.h", docs)
- env.Command("#editor/doc_data_compressed.gen.h", docs, make_doc_header)
+ env.CommandNoCache("#editor/doc_data_compressed.gen.h", docs, make_doc_header)
# Certificates
env.Depends("#editor/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt")
- env.Command("#editor/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", make_certs_header)
+ env.CommandNoCache("#editor/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", make_certs_header)
import glob
path = env.Dir('.').abspath
@@ -444,28 +203,16 @@ if env['tools']:
# Translations
tlist = glob.glob(path + "/translations/*.po")
env.Depends('#editor/translations.gen.h', tlist)
- env.Command('#editor/translations.gen.h', tlist, make_translations_header)
+ env.CommandNoCache('#editor/translations.gen.h', tlist, make_translations_header)
# Fonts
flist = glob.glob(path + "/../thirdparty/fonts/*.ttf")
flist.append(glob.glob(path + "/../thirdparty/fonts/*.otf"))
env.Depends('#editor/builtin_fonts.gen.h', flist)
- env.Command('#editor/builtin_fonts.gen.h', flist, make_fonts_header)
-
- # Authors
- env.Depends('#editor/authors.gen.h', "../AUTHORS.md")
- env.Command('#editor/authors.gen.h', "../AUTHORS.md", make_authors_header)
-
- # Donors
- env.Depends('#editor/donors.gen.h', "../DONORS.md")
- env.Command('#editor/donors.gen.h', "../DONORS.md", make_donors_header)
-
- # License
- env.Depends('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"])
- env.Command('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], make_license_header)
-
+ env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, make_fonts_header)
env.add_source_files(env.editor_sources, "*.cpp")
+ env.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"])
SConscript('collada/SCsub')
SConscript('doc/SCsub')
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
new file mode 100644
index 0000000000..197599442b
--- /dev/null
+++ b/editor/animation_bezier_editor.cpp
@@ -0,0 +1,1183 @@
+#include "animation_bezier_editor.h"
+
+float AnimationBezierTrackEdit::_bezier_h_to_pixel(float p_h) {
+ float h = p_h;
+ h = (h - v_scroll) / v_zoom;
+ h = (get_size().height / 2) - h;
+ return h;
+}
+
+static _FORCE_INLINE_ Vector2 _bezier_interp(real_t t, const Vector2 &start, const Vector2 &control_1, const Vector2 &control_2, const Vector2 &end) {
+ /* Formula from Wikipedia article on Bezier curves. */
+ real_t omt = (1.0 - t);
+ real_t omt2 = omt * omt;
+ real_t omt3 = omt2 * omt;
+ real_t t2 = t * t;
+ real_t t3 = t2 * t;
+
+ return start * omt3 + control_1 * omt2 * t * 3.0 + control_2 * omt * t2 * 3.0 + end * t3;
+}
+
+void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) {
+
+ float scale = timeline->get_zoom_scale();
+ int limit = timeline->get_name_limit();
+ int right_limit = get_size().width - timeline->get_buttons_width();
+
+ //selection may have altered the order of keys
+ Map<float, int> key_order;
+
+ for (int i = 0; i < animation->track_get_key_count(p_track); i++) {
+ float ofs = animation->track_get_key_time(p_track, i);
+ if (moving_selection && track == p_track && selection.has(i)) {
+ ofs += moving_selection_offset.x;
+ }
+
+ key_order[ofs] = i;
+ }
+
+ for (Map<float, int>::Element *E = key_order.front(); E; E = E->next()) {
+
+ int i = E->get();
+
+ if (!E->next())
+ break;
+
+ int i_n = E->next()->get();
+
+ float offset = animation->track_get_key_time(p_track, i);
+ float height = animation->bezier_track_get_key_value(p_track, i);
+ Vector2 out_handle = animation->bezier_track_get_key_out_handle(p_track, i);
+ if (track == p_track && moving_handle != 0 && moving_handle_key == i) {
+ out_handle = moving_handle_right;
+ }
+
+ if (moving_selection && track == p_track && selection.has(i)) {
+ offset += moving_selection_offset.x;
+ height += moving_selection_offset.y;
+ }
+
+ out_handle += Vector2(offset, height);
+
+ float offset_n = animation->track_get_key_time(p_track, i_n);
+ float height_n = animation->bezier_track_get_key_value(p_track, i_n);
+ Vector2 in_handle = animation->bezier_track_get_key_in_handle(p_track, i_n);
+ if (track == p_track && moving_handle != 0 && moving_handle_key == i_n) {
+ in_handle = moving_handle_left;
+ }
+
+ if (moving_selection && track == p_track && selection.has(i_n)) {
+ offset_n += moving_selection_offset.x;
+ height_n += moving_selection_offset.y;
+ }
+
+ in_handle += Vector2(offset_n, height_n);
+
+ Vector2 start(offset, height);
+ Vector2 end(offset_n, height_n);
+
+ int from_x = (offset - timeline->get_value()) * scale + limit;
+ int point_start = from_x;
+ int to_x = (offset_n - timeline->get_value()) * scale + limit;
+ int point_end = to_x;
+
+ if (from_x > right_limit) //not visible
+ continue;
+
+ if (to_x < limit) //not visible
+ continue;
+
+ from_x = MAX(from_x, limit);
+ to_x = MIN(to_x, right_limit);
+
+ Vector<Vector2> lines;
+
+ Vector2 prev_pos;
+
+ for (int j = from_x; j <= to_x; j++) {
+
+ float t = (j - limit) / scale + timeline->get_value();
+
+ float h;
+
+ if (j == point_end) {
+ h = end.y; //make sure it always connects
+ } else if (j == point_start) {
+ h = start.y; //make sure it always connects
+ } else { //custom interpolation, used because it needs to show paths affected by moving the selection or handles
+ int iterations = 10;
+ float low = 0;
+ float high = 1;
+ float middle;
+
+ //narrow high and low as much as possible
+ for (int k = 0; k < iterations; k++) {
+
+ middle = (low + high) / 2;
+
+ Vector2 interp = _bezier_interp(middle, start, out_handle, in_handle, end);
+
+ if (interp.x < t) {
+ low = middle;
+ } else {
+ high = middle;
+ }
+ }
+
+ //interpolate the result:
+ Vector2 low_pos = _bezier_interp(low, start, out_handle, in_handle, end);
+ Vector2 high_pos = _bezier_interp(high, start, out_handle, in_handle, end);
+
+ float c = (t - low_pos.x) / (high_pos.x - low_pos.x);
+
+ h = low_pos.linear_interpolate(high_pos, c).y;
+ }
+
+ h = _bezier_h_to_pixel(h);
+
+ Vector2 pos(j, h);
+
+ if (j > from_x) {
+ lines.push_back(prev_pos);
+ lines.push_back(pos);
+ }
+ prev_pos = pos;
+ }
+
+ if (lines.size() >= 2) {
+ draw_multiline(lines, p_color);
+ }
+ }
+}
+
+void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const Vector2 &p_to, const Color &p_color, int p_clip_left, int p_clip_right) {
+
+ Vector2 from = p_from;
+ Vector2 to = p_to;
+
+ if (from.x == to.x)
+ return;
+ if (to.x < from.x) {
+ SWAP(to, from);
+ }
+
+ if (to.x < p_clip_left)
+ return;
+
+ if (from.x > p_clip_right)
+ return;
+
+ if (to.x > p_clip_right) {
+ float c = (p_clip_right - from.x) / (to.x - from.x);
+ to = from.linear_interpolate(to, c);
+ }
+
+ if (from.x < p_clip_left) {
+ float c = (p_clip_left - from.x) / (to.x - from.x);
+ from = from.linear_interpolate(to, c);
+ }
+
+ draw_line(from, to, p_color);
+}
+
+void AnimationBezierTrackEdit::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
+ bezier_icon = get_icon("KeyBezierPoint", "EditorIcons");
+ bezier_handle_icon = get_icon("KeyBezierHandle", "EditorIcons");
+ selected_icon = get_icon("KeyBezierSelected", "EditorIcons");
+ if (handle_mode_option->get_item_count() == 0) {
+ handle_mode_option->add_icon_item(get_icon("BezierHandlesFree", "EditorIcons"), TTR("Free"), HANDLE_MODE_FREE);
+ handle_mode_option->add_icon_item(get_icon("BezierHandlesBalanced", "EditorIcons"), TTR("Balanced"), HANDLE_MODE_BALANCED);
+ handle_mode_option->add_icon_item(get_icon("BezierHandlesMirror", "EditorIcons"), TTR("Mirror"), HANDLE_MODE_MIRROR);
+ }
+ }
+ if (p_what == NOTIFICATION_RESIZED) {
+
+ int right_limit = get_size().width - timeline->get_buttons_width();
+ int hsep = get_constant("hseparation", "ItemList");
+ int vsep = get_constant("vseparation", "ItemList");
+
+ handle_mode_option->set_position(Vector2(right_limit + hsep, get_size().height - handle_mode_option->get_combined_minimum_size().height - vsep));
+ handle_mode_option->set_size(Vector2(timeline->get_buttons_width() - hsep * 2, handle_mode_option->get_combined_minimum_size().height));
+ }
+ if (p_what == NOTIFICATION_DRAW) {
+ if (animation.is_null())
+ return;
+
+ int limit = timeline->get_name_limit();
+
+ if (has_focus()) {
+ Color accent = get_color("accent_color", "Editor");
+ accent.a *= 0.7;
+ draw_rect(Rect2(Point2(), get_size()), accent, false);
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ Color color = get_color("font_color", "Label");
+ int hsep = get_constant("hseparation", "ItemList");
+ int vsep = get_constant("vseparation", "ItemList");
+ Color linecolor = color;
+ linecolor.a = 0.2;
+
+ draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor);
+
+ int right_limit = get_size().width - timeline->get_buttons_width();
+
+ draw_line(Point2(right_limit, 0), Point2(right_limit, get_size().height), linecolor);
+
+ Ref<Texture> close_icon = get_icon("Close", "EditorIcons");
+
+ close_icon_rect.position = Vector2(get_size().width - close_icon->get_width() - hsep, hsep);
+ close_icon_rect.size = close_icon->get_size();
+ draw_texture(close_icon, close_icon_rect.position);
+
+ String base_path = animation->track_get_path(track);
+ int end = base_path.find(":");
+ if (end != -1) {
+ base_path = base_path.substr(0, end + 1);
+ }
+
+ // NAMES AND ICON
+ int vofs = vsep;
+ int margin = 0;
+
+ {
+ int ofs = 0;
+
+ NodePath path = animation->track_get_path(track);
+
+ Node *node = NULL;
+
+ if (root && root->has_node(path)) {
+ node = root->get_node(path);
+ }
+
+ String text;
+
+ int h = font->get_height();
+
+ if (node) {
+ Ref<Texture> icon;
+ if (has_icon(node->get_class(), "EditorIcons")) {
+ icon = get_icon(node->get_class(), "EditorIcons");
+ } else {
+ icon = get_icon("Node", "EditorIcons");
+ }
+
+ h = MAX(h, icon->get_height());
+
+ draw_texture(icon, Point2(ofs, vofs + int(h - icon->get_height()) / 2));
+
+ margin = icon->get_width();
+
+ text = node->get_name();
+ ofs += hsep;
+ ofs += icon->get_width();
+
+ Vector2 string_pos = Point2(ofs, vofs + (h - font->get_height()) / 2 + font->get_ascent());
+ string_pos = string_pos.floor();
+ draw_string(font, string_pos, text, color, limit - ofs - hsep);
+
+ vofs += h + vsep;
+ }
+ }
+
+ // RELATED TRACKS TITLES
+
+ Map<int, Color> subtrack_colors;
+ subtracks.clear();
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+ if (animation->track_get_type(i) != Animation::TYPE_BEZIER)
+ continue;
+ String path = animation->track_get_path(i);
+ if (!path.begins_with(base_path))
+ continue; //another node
+ path = path.replace_first(base_path, "");
+
+ Color cc = color;
+ Rect2 rect = Rect2(margin, vofs, limit - margin - hsep, font->get_height() + vsep);
+ if (i != track) {
+ cc.a *= 0.7;
+ uint32_t hash = path.hash();
+ hash = ((hash >> 16) ^ hash) * 0x45d9f3b;
+ hash = ((hash >> 16) ^ hash) * 0x45d9f3b;
+ hash = (hash >> 16) ^ hash;
+ float h = (hash % 65535) / 65536.0;
+ Color subcolor;
+ subcolor.set_hsv(h, 0.2, 0.8);
+ subcolor.a = 0.5;
+ draw_rect(Rect2(0, vofs + font->get_height() * 0.1, margin - hsep, font->get_height() * 0.8), subcolor);
+ subtrack_colors[i] = subcolor;
+
+ subtracks[i] = rect;
+ } else {
+ Color ac = get_color("accent_color", "Editor");
+ ac.a = 0.5;
+ draw_rect(rect, ac);
+ }
+ draw_string(font, Point2(margin, vofs + font->get_ascent()), path, cc, limit - margin - hsep);
+
+ vofs += font->get_height() + vsep;
+ }
+
+ Color accent = get_color("accent_color", "Editor");
+
+ { //guides
+ float min_left_scale = font->get_height() + vsep;
+
+ float scale = 1;
+
+ while (scale / v_zoom < min_left_scale * 2) {
+ scale *= 5;
+ }
+
+ bool first = true;
+ int prev_iv = 0;
+ for (int i = font->get_height(); i < get_size().height; i++) {
+
+ float ofs = get_size().height / 2 - i;
+ ofs *= v_zoom;
+ ofs += v_scroll;
+
+ int iv = int(ofs / scale);
+ if (ofs < 0)
+ iv -= 1;
+ if (!first && iv != prev_iv) {
+
+ Color lc = linecolor;
+ lc.a *= 0.5;
+ draw_line(Point2(limit, i), Point2(right_limit, i), lc);
+ Color c = color;
+ c.a *= 0.5;
+ draw_string(font, Point2(limit + 8, i - 2), itos((iv + 1) * scale), c);
+ }
+
+ first = false;
+ prev_iv = iv;
+ }
+ }
+
+ { //draw OTHER curves
+
+ float scale = timeline->get_zoom_scale();
+ Ref<Texture> point = get_icon("KeyValue", "EditorIcons");
+ for (Map<int, Color>::Element *E = subtrack_colors.front(); E; E = E->next()) {
+
+ _draw_track(E->key(), E->get());
+
+ for (int i = 0; i < animation->track_get_key_count(E->key()); i++) {
+
+ float offset = animation->track_get_key_time(E->key(), i);
+ float value = animation->bezier_track_get_key_value(E->key(), i);
+
+ Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
+
+ if (pos.x >= limit && pos.x <= right_limit) {
+ draw_texture(point, pos - point->get_size() / 2, E->get());
+ }
+ }
+ }
+
+ //draw edited curve
+ _draw_track(track, accent);
+ }
+
+ //draw editor handles
+ {
+
+ float scale = timeline->get_zoom_scale();
+ edit_points.clear();
+
+ for (int i = 0; i < animation->track_get_key_count(track); i++) {
+
+ float offset = animation->track_get_key_time(track, i);
+ float value = animation->bezier_track_get_key_value(track, i);
+
+ if (moving_selection && selection.has(i)) {
+ offset += moving_selection_offset.x;
+ value += moving_selection_offset.y;
+ }
+
+ Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
+
+ Vector2 in_vec = animation->bezier_track_get_key_in_handle(track, i);
+ if (moving_handle != 0 && moving_handle_key == i) {
+ in_vec = moving_handle_left;
+ }
+ Vector2 pos_in = Vector2(((offset + in_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + in_vec.y));
+
+ Vector2 out_vec = animation->bezier_track_get_key_out_handle(track, i);
+
+ if (moving_handle != 0 && moving_handle_key == i) {
+ out_vec = moving_handle_right;
+ }
+
+ Vector2 pos_out = Vector2(((offset + out_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + out_vec.y));
+
+ _draw_line_clipped(pos, pos_in, accent, limit, right_limit);
+ _draw_line_clipped(pos, pos_out, accent, limit, right_limit);
+
+ EditPoint ep;
+ if (pos.x >= limit && pos.x <= right_limit) {
+ ep.point_rect.position = (pos - bezier_icon->get_size() / 2).floor();
+ ep.point_rect.size = bezier_icon->get_size();
+ if (selection.has(i)) {
+ draw_texture(selected_icon, ep.point_rect.position);
+ } else {
+ draw_texture(bezier_icon, ep.point_rect.position);
+ }
+ ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5);
+ }
+ if (pos_in.x >= limit && pos_in.x <= right_limit) {
+ ep.in_rect.position = (pos_in - bezier_handle_icon->get_size() / 2).floor();
+ ep.in_rect.size = bezier_handle_icon->get_size();
+ draw_texture(bezier_handle_icon, ep.in_rect.position);
+ ep.in_rect = ep.in_rect.grow(ep.in_rect.size.width * 0.5);
+ }
+ if (pos_out.x >= limit && pos_out.x <= right_limit) {
+ ep.out_rect.position = (pos_out - bezier_handle_icon->get_size() / 2).floor();
+ ep.out_rect.size = bezier_handle_icon->get_size();
+ draw_texture(bezier_handle_icon, ep.out_rect.position);
+ ep.out_rect = ep.out_rect.grow(ep.out_rect.size.width * 0.5);
+ }
+ edit_points.push_back(ep);
+ }
+ }
+
+ if (box_selecting) {
+ Color bs = accent;
+ bs.a *= 0.5;
+ Vector2 bs_from = box_selection_from;
+ Vector2 bs_to = box_selection_to;
+ if (bs_from.x > bs_to.x) {
+ SWAP(bs_from.x, bs_to.x);
+ }
+ if (bs_from.y > bs_to.y) {
+ SWAP(bs_from.y, bs_to.y);
+ }
+ draw_rect(Rect2(bs_from, bs_to - bs_from), bs);
+ }
+
+#if 0
+ // KEYFAMES //
+
+ {
+
+ float scale = timeline->get_zoom_scale();
+ int limit_end = get_size().width - timeline->get_buttons_width();
+
+ for (int i = 0; i < animation->track_get_key_count(track); i++) {
+
+ float offset = animation->track_get_key_time(track, i) - timeline->get_value();
+ if (editor->is_key_selected(track, i) && editor->is_moving_selection()) {
+ offset += editor->get_moving_selection_offset();
+ }
+ offset = offset * scale + limit;
+ draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end);
+ }
+ }
+#endif
+ }
+}
+
+Ref<Animation> AnimationBezierTrackEdit::get_animation() const {
+ return animation;
+}
+
+void AnimationBezierTrackEdit::set_animation_and_track(const Ref<Animation> &p_animation, int p_track) {
+
+ animation = p_animation;
+ track = p_track;
+ update();
+}
+
+Size2 AnimationBezierTrackEdit::get_minimum_size() const {
+
+ return Vector2(1, 1);
+}
+
+void AnimationBezierTrackEdit::set_undo_redo(UndoRedo *p_undo_redo) {
+ undo_redo = p_undo_redo;
+}
+
+void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) {
+ timeline = p_timeline;
+ timeline->connect("zoom_changed", this, "_zoom_changed");
+}
+void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) {
+ editor = p_editor;
+}
+
+void AnimationBezierTrackEdit::_play_position_draw() {
+
+ if (!animation.is_valid() || play_position_pos < 0)
+ return;
+
+ float scale = timeline->get_zoom_scale();
+ int h = get_size().height;
+
+ int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit();
+
+ if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
+ Color color = get_color("accent_color", "Editor");
+ play_position->draw_line(Point2(px, 0), Point2(px, h), color);
+ }
+}
+
+void AnimationBezierTrackEdit::set_play_position(float p_pos) {
+
+ play_position_pos = p_pos;
+ play_position->update();
+}
+
+void AnimationBezierTrackEdit::update_play_position() {
+ play_position->update();
+}
+
+void AnimationBezierTrackEdit::set_root(Node *p_root) {
+ root = p_root;
+}
+void AnimationBezierTrackEdit::_zoom_changed() {
+ update();
+}
+
+String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const {
+
+ return Control::get_tooltip(p_pos);
+}
+
+void AnimationBezierTrackEdit::_clear_selection() {
+ selection.clear();
+ update();
+}
+
+void AnimationBezierTrackEdit::_clear_selection_for_anim(const Ref<Animation> &p_anim) {
+
+ if (!(animation == p_anim))
+ return;
+ //selection.clear();
+ _clear_selection();
+}
+
+void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos) {
+
+ if (!(animation == p_anim))
+ return;
+
+ int idx = animation->track_find_key(p_track, p_pos, true);
+ ERR_FAIL_COND(idx < 0);
+
+ selection.insert(idx);
+ update();
+}
+
+void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
+
+ if (p_event->is_pressed()) {
+ if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) {
+ duplicate_selection();
+ accept_event();
+ }
+
+ if (ED_GET_SHORTCUT("animation_editor/delete_selection")->is_shortcut(p_event)) {
+ delete_selection();
+ accept_event();
+ }
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
+ if (mb->get_command()) {
+ timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
+ } else {
+ if (v_zoom < 1000) {
+ v_zoom *= 1.2;
+ }
+ }
+ update();
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
+ if (mb->get_command()) {
+ timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
+ } else {
+ if (v_zoom > 0.01) {
+ v_zoom /= 1.2;
+ }
+ }
+ update();
+ }
+
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE) {
+
+ if (mb->is_pressed()) {
+ int x = mb->get_position().x - timeline->get_name_limit();
+ panning_timeline_from = x / timeline->get_zoom_scale();
+ panning_timeline = true;
+ panning_timeline_at = timeline->get_value();
+ } else {
+ panning_timeline = false;
+ }
+ }
+
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
+
+ menu_insert_key = mb->get_position();
+ Vector2 popup_pos = get_global_transform().xform(mb->get_position());
+
+ menu->clear();
+ menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT);
+ if (selection.size()) {
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE);
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE);
+ }
+
+ menu->set_as_minsize();
+ menu->set_position(popup_pos);
+ menu->popup();
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ if (close_icon_rect.has_point(mb->get_position())) {
+ emit_signal("close_request");
+ return;
+ }
+ for (Map<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) {
+ if (E->get().has_point(mb->get_position())) {
+ set_animation_and_track(animation, E->key());
+ return;
+ }
+ }
+
+ for (int i = 0; i < edit_points.size(); i++) {
+
+ //first check point
+ //command makes it ignore the main point, so control point editors can be force-edited
+ //path 2D editing in the 3D and 2D editors works the same way
+ if (!mb->get_command()) {
+ if (edit_points[i].point_rect.has_point(mb->get_position())) {
+ if (mb->get_shift()) {
+ //add to selection
+ if (selection.has(i)) {
+ selection.erase(i);
+ } else {
+ selection.insert(i);
+ }
+ update();
+ select_single_attempt = -1;
+ } else if (selection.has(i)) {
+ moving_selection_attempt = true;
+ moving_selection = false;
+ moving_selection_from_key = i;
+ moving_selection_offset = Vector2();
+ select_single_attempt = i;
+ update();
+ } else {
+
+ moving_selection_attempt = true;
+ moving_selection = true;
+ moving_selection_from_key = i;
+ moving_selection_offset = Vector2();
+ selection.clear();
+ selection.insert(i);
+ update();
+ }
+ return;
+ }
+ }
+
+ if (edit_points[i].in_rect.has_point(mb->get_position())) {
+ moving_handle = -1;
+ moving_handle_key = i;
+ moving_handle_left = animation->bezier_track_get_key_in_handle(track, i);
+ moving_handle_right = animation->bezier_track_get_key_out_handle(track, i);
+ update();
+ return;
+ }
+
+ if (edit_points[i].out_rect.has_point(mb->get_position())) {
+ moving_handle = 1;
+ moving_handle_key = i;
+ moving_handle_left = animation->bezier_track_get_key_in_handle(track, i);
+ moving_handle_right = animation->bezier_track_get_key_out_handle(track, i);
+ update();
+ return;
+ ;
+ }
+ }
+
+ //insert new point
+ if (mb->get_command() && mb->get_position().x >= timeline->get_name_limit() && mb->get_position().x < get_size().width - timeline->get_buttons_width()) {
+
+ Array new_point;
+ new_point.resize(5);
+
+ float h = (get_size().height / 2 - mb->get_position().y) * v_zoom + v_scroll;
+
+ new_point[0] = h;
+ new_point[1] = -0.25;
+ new_point[2] = 0;
+ new_point[3] = 0.25;
+ new_point[4] = 0;
+
+ float time = ((mb->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
+ while (animation->track_find_key(track, time, true) != -1) {
+ time += 0.001;
+ }
+
+ undo_redo->create_action("Add Bezier Point");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, time, new_point);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, time);
+ undo_redo->commit_action();
+
+ //then attempt to move
+ int index = animation->track_find_key(track, time, true);
+ ERR_FAIL_COND(index == -1);
+ _clear_selection();
+ selection.insert(index);
+
+ moving_selection_attempt = true;
+ moving_selection = false;
+ moving_selection_from_key = index;
+ moving_selection_offset = Vector2();
+ select_single_attempt = -1;
+ update();
+
+ return;
+ }
+
+ //box select
+ if (mb->get_position().x >= timeline->get_name_limit() && mb->get_position().x < get_size().width - timeline->get_buttons_width()) {
+ box_selecting_attempt = true;
+ box_selecting = false;
+ box_selecting_add = false;
+ box_selection_from = mb->get_position();
+ return;
+ }
+ }
+
+ if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ if (box_selecting) {
+ //do actual select
+ if (!box_selecting_add) {
+ _clear_selection();
+ }
+
+ Vector2 bs_from = box_selection_from;
+ Vector2 bs_to = box_selection_to;
+ if (bs_from.x > bs_to.x) {
+ SWAP(bs_from.x, bs_to.x);
+ }
+ if (bs_from.y > bs_to.y) {
+ SWAP(bs_from.y, bs_to.y);
+ }
+ Rect2 selection_rect(bs_from, bs_to - bs_from);
+
+ for (int i = 0; i < edit_points.size(); i++) {
+
+ if (edit_points[i].point_rect.intersects(selection_rect)) {
+ selection.insert(i);
+ }
+ }
+ } else {
+ _clear_selection(); //clicked and nothing happened, so clear the selection
+ }
+ box_selecting_attempt = false;
+ box_selecting = false;
+ update();
+ }
+
+ if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ undo_redo->create_action("Move Bezier Points");
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, moving_handle_left);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, moving_handle_right);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, animation->bezier_track_get_key_in_handle(track, moving_handle_key));
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, animation->bezier_track_get_key_out_handle(track, moving_handle_key));
+ undo_redo->commit_action();
+
+ moving_handle = 0;
+ update();
+ }
+
+ if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ if (moving_selection) {
+ //combit it
+
+ undo_redo->create_action("Move Bezier Points");
+
+ List<AnimMoveRestore> to_restore;
+ // 1-remove the keys
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", track, E->get());
+ }
+ // 2- remove overlapped keys
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newtime = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+
+ int idx = animation->track_find_key(track, newtime, true);
+ if (idx == -1)
+ continue;
+
+ if (selection.has(idx))
+ continue; //already in selection, don't save
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", track, newtime);
+ AnimMoveRestore amr;
+
+ amr.key = animation->track_get_key_value(track, idx);
+ amr.track = track;
+ amr.time = newtime;
+
+ to_restore.push_back(amr);
+ }
+
+ // 3-move the keys (re insert them)
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ /*
+ if (newpos<0)
+ continue; //no add at the beginning
+ */
+ Array key = animation->track_get_key_value(track, E->get());
+ float h = key[0];
+ h += moving_selection_offset.y;
+ key[0] = h;
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, newpos, key, 1);
+ }
+
+ // 4-(undo) remove inserted keys
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x;
+ /*
+ if (newpos<0)
+ continue; //no remove what no inserted
+ */
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, newpos);
+ }
+
+ // 5-(undo) reinsert keys
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float oldpos = animation->track_get_key_time(track, E->get());
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, oldpos, animation->track_get_key_value(track, E->get()), 1);
+ }
+
+ // 6-(undo) reinsert overlapped keys
+ for (List<AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+
+ AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
+ }
+
+ // 6-(undo) reinsert overlapped keys
+ for (List<AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+
+ AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1);
+ }
+
+ undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
+
+ // 7-reselect
+
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float oldpos = animation->track_get_key_time(track, E->get());
+ float newpos = oldpos + moving_selection_offset.x;
+
+ undo_redo->add_do_method(this, "_select_at_anim", animation, track, newpos);
+ undo_redo->add_undo_method(this, "_select_at_anim", animation, track, oldpos);
+ }
+
+ undo_redo->commit_action();
+
+ moving_selection = false;
+ } else if (select_single_attempt != -1) {
+ selection.clear();
+ selection.insert(select_single_attempt);
+ }
+
+ moving_selection_attempt = false;
+ update();
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
+ v_scroll += mm->get_relative().y * v_zoom;
+ if (v_scroll > 100000)
+ v_scroll = 100000;
+ if (v_scroll < -100000)
+ v_scroll = -100000;
+
+ int x = mm->get_position().x - timeline->get_name_limit();
+ float ofs = x / timeline->get_zoom_scale();
+ float diff = ofs - panning_timeline_from;
+ timeline->set_value(panning_timeline_at - diff);
+
+ update();
+ }
+ if (moving_selection_attempt && mm.is_valid()) {
+
+ if (!moving_selection) {
+ moving_selection = true;
+ select_single_attempt = -1;
+ }
+
+ float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll;
+ float x = ((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
+
+ moving_selection_offset = Vector2(x - animation->track_get_key_time(track, moving_selection_from_key), y - animation->bezier_track_get_key_value(track, moving_selection_from_key));
+ update();
+ }
+
+ if (box_selecting_attempt && mm.is_valid()) {
+
+ if (!box_selecting) {
+ box_selecting = true;
+ box_selecting_add = mm->get_shift();
+ }
+
+ box_selection_to = mm->get_position();
+
+ if (get_local_mouse_position().y < 0) {
+ //avoid cursor from going too above, so it does not lose focus with viewport
+ warp_mouse(Vector2(get_local_mouse_position().x, 0));
+ }
+ update();
+ }
+
+ if (moving_handle != 0 && mm.is_valid()) {
+
+ float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll;
+ float x = ((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
+
+ Vector2 key_pos = Vector2(animation->track_get_key_time(track, moving_handle_key), animation->bezier_track_get_key_value(track, moving_handle_key));
+
+ Vector2 moving_handle_value = Vector2(x, y) - key_pos;
+
+ moving_handle_left = animation->bezier_track_get_key_in_handle(track, moving_handle_key);
+ moving_handle_right = animation->bezier_track_get_key_out_handle(track, moving_handle_key);
+
+ if (moving_handle == -1) {
+ moving_handle_left = moving_handle_value;
+ if (moving_handle_left.x > 0) {
+ moving_handle_left.x = 0;
+ }
+
+ if (handle_mode_option->get_selected() == HANDLE_MODE_BALANCED) {
+ Vector2 scale = Vector2(timeline->get_zoom_scale(), v_zoom);
+ moving_handle_right = (-(moving_handle_left * scale).normalized() * (moving_handle_right * scale).length()) / scale;
+
+ } else if (handle_mode_option->get_selected() == HANDLE_MODE_MIRROR) {
+ moving_handle_right = -moving_handle_left;
+ }
+ }
+
+ if (moving_handle == 1) {
+ moving_handle_right = moving_handle_value;
+ if (moving_handle_right.x < 0) {
+ moving_handle_right.x = 0;
+ }
+
+ if (handle_mode_option->get_selected() == HANDLE_MODE_BALANCED) {
+ Vector2 scale = Vector2(timeline->get_zoom_scale(), v_zoom);
+ moving_handle_left = (-(moving_handle_right * scale).normalized() * (moving_handle_left * scale).length()) / scale;
+ } else if (handle_mode_option->get_selected() == HANDLE_MODE_MIRROR) {
+ moving_handle_left = -moving_handle_right;
+ }
+ }
+
+ update();
+ }
+}
+
+void AnimationBezierTrackEdit::_menu_selected(int p_index) {
+
+ switch (p_index) {
+ case MENU_KEY_INSERT: {
+
+ Array new_point;
+ new_point.resize(5);
+
+ float h = (get_size().height / 2 - menu_insert_key.y) * v_zoom + v_scroll;
+
+ new_point[0] = h;
+ new_point[1] = -0.25;
+ new_point[2] = 0;
+ new_point[3] = 0.25;
+ new_point[4] = 0;
+
+ float time = ((menu_insert_key.x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value();
+ while (animation->track_find_key(track, time, true) != -1) {
+ time += 0.001;
+ }
+
+ undo_redo->create_action("Add Bezier Point");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, time, new_point);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, time);
+ undo_redo->commit_action();
+
+ } break;
+ case MENU_KEY_DUPLICATE: {
+ duplicate_selection();
+ } break;
+ case MENU_KEY_DELETE: {
+ delete_selection();
+ } break;
+ }
+}
+
+void AnimationBezierTrackEdit::duplicate_selection() {
+
+ if (selection.size() == 0)
+ return;
+
+ float top_time = 1e10;
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float t = animation->track_get_key_time(track, E->get());
+ if (t < top_time)
+ top_time = t;
+ }
+
+ undo_redo->create_action(TTR("Anim Duplicate Keys"));
+
+ List<Pair<int, float> > new_selection_values;
+
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float t = animation->track_get_key_time(track, E->get());
+ float dst_time = t + (timeline->get_play_position() - top_time);
+ int existing_idx = animation->track_find_key(track, dst_time, true);
+
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, dst_time, animation->track_get_key_value(track, E->get()), animation->track_get_key_transition(track, E->get()));
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, dst_time);
+
+ Pair<int, float> p;
+ p.first = track;
+ p.second = dst_time;
+ new_selection_values.push_back(p);
+
+ if (existing_idx != -1) {
+
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, dst_time, animation->track_get_key_value(track, existing_idx), animation->track_get_key_transition(track, existing_idx));
+ }
+ }
+
+ undo_redo->commit_action();
+
+ //reselect duplicated
+
+ selection.clear();
+ for (List<Pair<int, float> >::Element *E = new_selection_values.front(); E; E = E->next()) {
+
+ int track = E->get().first;
+ float time = E->get().second;
+
+ int existing_idx = animation->track_find_key(track, time, true);
+
+ if (existing_idx == -1)
+ continue;
+
+ selection.insert(existing_idx);
+ }
+
+ update();
+}
+
+void AnimationBezierTrackEdit::delete_selection() {
+ if (selection.size()) {
+ undo_redo->create_action(TTR("Anim Delete Keys"));
+
+ for (Set<int>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", track, E->get());
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, animation->track_get_key_time(track, E->get()), animation->track_get_key_value(track, E->get()), 1);
+ }
+ undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->commit_action();
+ //selection.clear();
+ }
+}
+
+void AnimationBezierTrackEdit::set_block_animation_update_ptr(bool *p_block_ptr) {
+ block_animation_update_ptr = p_block_ptr;
+}
+
+void AnimationBezierTrackEdit::_bind_methods() {
+
+ ClassDB::bind_method("_zoom_changed", &AnimationBezierTrackEdit::_zoom_changed);
+ ClassDB::bind_method("_menu_selected", &AnimationBezierTrackEdit::_menu_selected);
+ ClassDB::bind_method("_gui_input", &AnimationBezierTrackEdit::_gui_input);
+ ClassDB::bind_method("_play_position_draw", &AnimationBezierTrackEdit::_play_position_draw);
+
+ ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection);
+ ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection);
+ ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_clear_selection);
+
+ ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
+ ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
+ ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::REAL, "ofs")));
+ ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single")));
+ ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index")));
+ ADD_SIGNAL(MethodInfo("clear_selection"));
+ ADD_SIGNAL(MethodInfo("close_request"));
+
+ ADD_SIGNAL(MethodInfo("move_selection_begin"));
+ ADD_SIGNAL(MethodInfo("move_selection", PropertyInfo(Variant::REAL, "ofs")));
+ ADD_SIGNAL(MethodInfo("move_selection_commit"));
+ ADD_SIGNAL(MethodInfo("move_selection_cancel"));
+}
+
+AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
+ undo_redo = NULL;
+ timeline = NULL;
+ root = NULL;
+ menu = NULL;
+ block_animation_update_ptr = NULL;
+
+ moving_selection_attempt = false;
+ moving_selection = false;
+ select_single_attempt = -1;
+ box_selecting = false;
+ box_selecting_attempt = false;
+
+ moving_handle = 0;
+
+ play_position_pos = 0;
+ play_position = memnew(Control);
+ play_position->set_mouse_filter(MOUSE_FILTER_PASS);
+ add_child(play_position);
+ play_position->set_anchors_and_margins_preset(PRESET_WIDE);
+ play_position->connect("draw", this, "_play_position_draw");
+ set_focus_mode(FOCUS_CLICK);
+
+ v_scroll = 0;
+ v_zoom = 1;
+
+ panning_timeline = false;
+ set_clip_contents(true);
+ handle_mode = HANDLE_MODE_FREE;
+ handle_mode_option = memnew(OptionButton);
+ add_child(handle_mode_option);
+
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("id_pressed", this, "_menu_selected");
+
+ //set_mouse_filter(MOUSE_FILTER_PASS); //scroll has to work too for selection
+}
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h
new file mode 100644
index 0000000000..544690844a
--- /dev/null
+++ b/editor/animation_bezier_editor.h
@@ -0,0 +1,141 @@
+#ifndef ANIMATION_BEZIER_EDITOR_H
+#define ANIMATION_BEZIER_EDITOR_H
+
+#include "animation_track_editor.h"
+
+class AnimationBezierTrackEdit : public Control {
+
+ GDCLASS(AnimationBezierTrackEdit, Control)
+
+ enum HandleMode {
+ HANDLE_MODE_FREE,
+ HANDLE_MODE_BALANCED,
+ HANDLE_MODE_MIRROR
+ };
+
+ enum {
+ MENU_KEY_INSERT,
+ MENU_KEY_DUPLICATE,
+ MENU_KEY_DELETE
+ };
+
+ HandleMode handle_mode;
+ OptionButton *handle_mode_option;
+
+ AnimationTimelineEdit *timeline;
+ UndoRedo *undo_redo;
+ Node *root;
+ Control *play_position; //separate control used to draw so updates for only position changed are much faster
+ float play_position_pos;
+
+ Ref<Animation> animation;
+ int track;
+
+ Vector<Rect2> view_rects;
+
+ Ref<Texture> bezier_icon;
+ Ref<Texture> bezier_handle_icon;
+ Ref<Texture> selected_icon;
+
+ Rect2 close_icon_rect;
+
+ Map<int, Rect2> subtracks;
+
+ float v_scroll;
+ float v_zoom;
+
+ PopupMenu *menu;
+
+ void _zoom_changed();
+
+ void _gui_input(const Ref<InputEvent> &p_event);
+ void _menu_selected(int p_index);
+
+ bool *block_animation_update_ptr; //used to block all tracks re-gen (speed up)
+
+ void _play_position_draw();
+
+ Vector2 insert_at_pos;
+
+ bool moving_selection_attempt;
+ int select_single_attempt;
+ bool moving_selection;
+ int moving_selection_from_key;
+
+ Vector2 moving_selection_offset;
+
+ bool box_selecting_attempt;
+ bool box_selecting;
+ bool box_selecting_add;
+ Vector2 box_selection_from;
+ Vector2 box_selection_to;
+
+ int moving_handle; //0 no move -1 or +1 out
+ int moving_handle_key;
+ Vector2 moving_handle_left;
+ Vector2 moving_handle_right;
+
+ void _clear_selection();
+ void _clear_selection_for_anim(const Ref<Animation> &p_anim);
+ void _select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos);
+
+ Vector2 menu_insert_key;
+
+ struct AnimMoveRestore {
+
+ int track;
+ float time;
+ Variant key;
+ float transition;
+ };
+
+ AnimationTrackEditor *editor;
+
+ struct EditPoint {
+ Rect2 point_rect;
+ Rect2 in_rect;
+ Rect2 out_rect;
+ };
+
+ Vector<EditPoint> edit_points;
+
+ Set<int> selection;
+
+ bool panning_timeline;
+ float panning_timeline_from;
+ float panning_timeline_at;
+
+ 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);
+
+ float _bezier_h_to_pixel(float p_h);
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ virtual String get_tooltip(const Point2 &p_pos) const;
+
+ Ref<Animation> get_animation() const;
+
+ void set_animation_and_track(const Ref<Animation> &p_animation, int p_track);
+ virtual Size2 get_minimum_size() const;
+
+ void set_undo_redo(UndoRedo *p_undo_redo);
+ void set_timeline(AnimationTimelineEdit *p_timeline);
+ void set_editor(AnimationTrackEditor *p_editor);
+ void set_root(Node *p_root);
+
+ void set_block_animation_update_ptr(bool *p_block_ptr);
+
+ void set_play_position(float p_pos);
+ void update_play_position();
+
+ void duplicate_selection();
+ void delete_selection();
+
+ AnimationBezierTrackEdit();
+};
+
+#endif // ANIMATION_BEZIER_EDITOR_H
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
deleted file mode 100644
index 1b97a24968..0000000000
--- a/editor/animation_editor.cpp
+++ /dev/null
@@ -1,4112 +0,0 @@
-/*************************************************************************/
-/* animation_editor.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "animation_editor.h"
-
-#include "editor/plugins/animation_player_editor_plugin.h"
-#include "editor_node.h"
-#include "editor_settings.h"
-#include "io/resource_saver.h"
-#include "os/keyboard.h"
-#include "os/os.h"
-#include "pair.h"
-#include "scene/gui/separator.h"
-#include "scene/main/viewport.h"
-
-/* Missing to fix:
-
- *Set
- *Find better source for hint for edited value keys
- * + button on track to add a key
- * when clicked for first time, erase selection of not selected at first
- * automatically create discrete/continuous tracks!!
- *when create track do undo/redo
-*/
-
-class AnimationCurveEdit : public Control {
- GDCLASS(AnimationCurveEdit, Control);
-
-public:
- enum Mode {
- MODE_DISABLED,
- MODE_SINGLE,
- MODE_MULTIPLE
- };
-
-private:
- Set<float> multiples;
- float transition;
- Mode mode;
-
- LineEdit *value_edit;
-
- void _notification(int p_what) {
-
- if (p_what == NOTIFICATION_DRAW) {
-
- RID ci = get_canvas_item();
-
- Size2 s = get_size();
- Rect2 r(Point2(), s);
-
- //r=r.grow(3);
- Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
- sb->draw(ci, r);
- r.size -= sb->get_minimum_size();
- r.position += sb->get_offset();
- //VisualServer::get_singleton()->canvas_item_add
-
- Ref<Font> f = get_font("font", "Label");
- r = r.grow(-2);
- Color color = get_color("font_color", "Label");
-
- int points = 48;
- if (mode == MODE_MULTIPLE) {
-
- Color mcolor = color;
- mcolor.a *= 0.3;
-
- Set<float>::Element *E = multiples.front();
- for (int j = 0; j < 16; j++) {
-
- if (!E)
- break;
-
- float prev = 1.0;
- float exp = E->get();
- bool flip = false; //hint_text=="attenuation";
-
- for (int i = 1; i <= points; i++) {
-
- float ifl = i / float(points);
- float iflp = (i - 1) / float(points);
-
- float h = 1.0 - Math::ease(ifl, exp);
-
- if (flip) {
- ifl = 1.0 - ifl;
- iflp = 1.0 - iflp;
- }
-
- VisualServer::get_singleton()->canvas_item_add_line(ci, r.position + Point2(iflp * r.size.width, prev * r.size.height), r.position + Point2(ifl * r.size.width, h * r.size.height), mcolor);
- prev = h;
- }
-
- E = E->next();
- }
- }
-
- float exp = transition;
- if (mode != MODE_DISABLED) {
-
- float prev = 1.0;
-
- bool flip = false; //hint_text=="attenuation";
-
- for (int i = 1; i <= points; i++) {
-
- float ifl = i / float(points);
- float iflp = (i - 1) / float(points);
-
- float h = 1.0 - Math::ease(ifl, exp);
-
- if (flip) {
- ifl = 1.0 - ifl;
- iflp = 1.0 - iflp;
- }
-
- VisualServer::get_singleton()->canvas_item_add_line(ci, r.position + Point2(iflp * r.size.width, prev * r.size.height), r.position + Point2(ifl * r.size.width, h * r.size.height), color);
- prev = h;
- }
- }
-
- if (mode == MODE_DISABLED) {
- f->draw(ci, Point2(5, 5 + f->get_ascent()), TTR("Disabled"), color);
- } else if (mode == MODE_MULTIPLE) {
- f->draw(ci, Point2(5, 5 + f->get_ascent() + value_edit->get_size().height), TTR("All Selection"), color);
- }
- }
- }
-
- void _gui_input(const Ref<InputEvent> &p_ev) {
-
- Ref<InputEventMouseMotion> mm = p_ev;
- if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
-
- if (mode == MODE_DISABLED)
- return;
-
- value_edit->release_focus();
-
- float rel = mm->get_relative().x;
- if (rel == 0)
- return;
-
- bool flip = false;
-
- if (flip)
- rel = -rel;
-
- float val = transition;
- if (val == 0)
- return;
- bool sg = val < 0;
- val = Math::absf(val);
-
- val = Math::log(val) / Math::log((float)2.0);
- //logspace
- val += rel * 0.05;
- //
-
- val = Math::pow((float)2.0, val);
- if (sg)
- val = -val;
-
- force_transition(val);
- }
- }
-
- void _edit_value_changed(const String &p_value_str) {
-
- force_transition(p_value_str.to_float());
- }
-
-public:
- static void _bind_methods() {
-
- //ClassDB::bind_method("_update_obj",&AnimationKeyEdit::_update_obj);
- ClassDB::bind_method("_gui_input", &AnimationCurveEdit::_gui_input);
- ClassDB::bind_method("_edit_value_changed", &AnimationCurveEdit::_edit_value_changed);
- ADD_SIGNAL(MethodInfo("transition_changed"));
- }
-
- void set_mode(Mode p_mode) {
-
- mode = p_mode;
- value_edit->set_visible(mode != MODE_DISABLED);
- update();
- }
-
- void clear_multiples() {
- multiples.clear();
- update();
- }
- void set_multiple(float p_transition) {
-
- multiples.insert(p_transition);
- }
-
- void set_transition(float p_transition) {
- transition = Math::stepify(p_transition, 0.01);
- value_edit->set_text(String::num(transition));
- update();
- }
-
- float get_transition() const {
- return transition;
- }
-
- void force_transition(float p_value) {
- if (mode == MODE_DISABLED)
- return;
- set_transition(p_value);
- emit_signal("transition_changed", p_value);
- }
-
- AnimationCurveEdit() {
-
- transition = 1.0;
- set_default_cursor_shape(CURSOR_HSPLIT);
- mode = MODE_DISABLED;
-
- value_edit = memnew(LineEdit);
- value_edit->hide();
- value_edit->connect("text_entered", this, "_edit_value_changed");
- add_child(value_edit);
- }
-};
-
-class AnimationKeyEdit : public Object {
-
- GDCLASS(AnimationKeyEdit, Object);
-
-public:
- bool setting;
- bool hidden;
-
- static void _bind_methods() {
-
- ClassDB::bind_method("_update_obj", &AnimationKeyEdit::_update_obj);
- ClassDB::bind_method("_key_ofs_changed", &AnimationKeyEdit::_key_ofs_changed);
- }
-
- //PopupDialog *ke_dialog;
-
- void _fix_node_path(Variant &value) {
-
- NodePath np = value;
-
- if (np == NodePath())
- return;
-
- Node *root = EditorNode::get_singleton()->get_tree()->get_root();
-
- Node *np_node = root->get_node(np);
- ERR_FAIL_COND(!np_node);
-
- Node *edited_node = root->get_node(base);
- ERR_FAIL_COND(!edited_node);
-
- value = edited_node->get_path_to(np_node);
- }
-
- void _update_obj(const Ref<Animation> &p_anim) {
- if (setting)
- return;
- if (hidden)
- return;
- if (!(animation == p_anim))
- return;
- notify_change();
- }
-
- void _key_ofs_changed(const Ref<Animation> &p_anim, float from, float to) {
- if (hidden)
- return;
- if (!(animation == p_anim))
- return;
- if (from != key_ofs)
- return;
- key_ofs = to;
- if (setting)
- return;
- notify_change();
- }
-
- bool _set(const StringName &p_name, const Variant &p_value) {
-
- int key = animation->track_find_key(track, key_ofs, true);
- ERR_FAIL_COND_V(key == -1, false);
-
- String name = p_name;
- if (name == "time") {
-
- float new_time = p_value;
- if (new_time == key_ofs)
- return true;
-
- int existing = animation->track_find_key(track, new_time, true);
-
- setting = true;
- undo_redo->create_action(TTR("Anim Change Keyframe Time"), UndoRedo::MERGE_ENDS);
-
- Variant val = animation->track_get_key_value(track, key);
- float trans = animation->track_get_key_transition(track, key);
-
- undo_redo->add_do_method(animation.ptr(), "track_remove_key", track, key);
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, new_time, val, trans);
- undo_redo->add_do_method(this, "_key_ofs_changed", animation, key_ofs, new_time);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, new_time);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, key_ofs, val, trans);
- undo_redo->add_undo_method(this, "_key_ofs_changed", animation, new_time, key_ofs);
-
- if (existing != -1) {
- Variant v = animation->track_get_key_value(track, existing);
- float trans = animation->track_get_key_transition(track, existing);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, new_time, v, trans);
- }
-
- undo_redo->commit_action();
- setting = false;
-
- return true;
- } else if (name == "easing") {
-
- float val = p_value;
- float prev_val = animation->track_get_key_transition(track, key);
- setting = true;
- undo_redo->create_action(TTR("Anim Change Transition"), UndoRedo::MERGE_ENDS);
- undo_redo->add_do_method(animation.ptr(), "track_set_key_transition", track, key, val);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_transition", track, key, prev_val);
- undo_redo->add_do_method(this, "_update_obj", animation);
- undo_redo->add_undo_method(this, "_update_obj", animation);
- undo_redo->commit_action();
- setting = false;
- return true;
- }
-
- switch (animation->track_get_type(track)) {
-
- case Animation::TYPE_TRANSFORM: {
-
- Dictionary d_old = animation->track_get_key_value(track, key);
- Dictionary d_new = d_old;
- d_new[p_name] = p_value;
- setting = true;
- undo_redo->create_action(TTR("Anim Change Transform"));
- undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, d_new);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, d_old);
- undo_redo->add_do_method(this, "_update_obj", animation);
- undo_redo->add_undo_method(this, "_update_obj", animation);
- undo_redo->commit_action();
- setting = false;
- return true;
-
- } break;
- case Animation::TYPE_VALUE: {
-
- if (name == "value") {
-
- Variant value = p_value;
-
- if (value.get_type() == Variant::NODE_PATH) {
-
- _fix_node_path(value);
- }
-
- setting = true;
- undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
- Variant prev = animation->track_get_key_value(track, key);
- undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, value);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, prev);
- undo_redo->add_do_method(this, "_update_obj", animation);
- undo_redo->add_undo_method(this, "_update_obj", animation);
- undo_redo->commit_action();
- setting = false;
- return true;
- }
-
- } break;
- case Animation::TYPE_METHOD: {
-
- Dictionary d_old = animation->track_get_key_value(track, key);
- Dictionary d_new = d_old;
-
- bool change_notify_deserved = false;
- bool mergeable = false;
-
- if (name == "name") {
-
- d_new["method"] = p_value;
- }
-
- if (name == "arg_count") {
-
- Vector<Variant> args = d_old["args"];
- args.resize(p_value);
- d_new["args"] = args;
- change_notify_deserved = true;
- }
-
- if (name.begins_with("args/")) {
-
- Vector<Variant> args = d_old["args"];
- int idx = name.get_slice("/", 1).to_int();
- ERR_FAIL_INDEX_V(idx, args.size(), false);
-
- String what = name.get_slice("/", 2);
- if (what == "type") {
- Variant::Type t = Variant::Type(int(p_value));
-
- if (t != args[idx].get_type()) {
- Variant::CallError err;
- if (Variant::can_convert(args[idx].get_type(), t)) {
- Variant old = args[idx];
- Variant *ptrs[1] = { &old };
- args[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
- } else {
-
- args[idx] = Variant::construct(t, NULL, 0, err);
- }
- change_notify_deserved = true;
- d_new["args"] = args;
- }
- }
- if (what == "value") {
-
- Variant value = p_value;
- if (value.get_type() == Variant::NODE_PATH) {
-
- _fix_node_path(value);
- }
-
- args[idx] = value;
- d_new["args"] = args;
- mergeable = true;
- }
- }
-
- if (mergeable)
- undo_redo->create_action(TTR("Anim Change Call"), UndoRedo::MERGE_ENDS);
- else
- undo_redo->create_action(TTR("Anim Change Call"));
-
- Variant prev = animation->track_get_key_value(track, key);
- setting = true;
- undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, d_new);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, d_old);
- undo_redo->add_do_method(this, "_update_obj", animation);
- undo_redo->add_undo_method(this, "_update_obj", animation);
- undo_redo->commit_action();
- setting = false;
- if (change_notify_deserved)
- notify_change();
- return true;
- } break;
- }
-
- return false;
- }
-
- bool _get(const StringName &p_name, Variant &r_ret) const {
-
- int key = animation->track_find_key(track, key_ofs, true);
- ERR_FAIL_COND_V(key == -1, false);
-
- String name = p_name;
- if (name == "time") {
- r_ret = key_ofs;
- return true;
- } else if (name == "easing") {
- r_ret = animation->track_get_key_transition(track, key);
- return true;
- }
-
- switch (animation->track_get_type(track)) {
-
- case Animation::TYPE_TRANSFORM: {
-
- Dictionary d = animation->track_get_key_value(track, key);
- ERR_FAIL_COND_V(!d.has(name), false);
- r_ret = d[p_name];
- return true;
-
- } break;
- case Animation::TYPE_VALUE: {
-
- if (name == "value") {
- r_ret = animation->track_get_key_value(track, key);
- return true;
- }
-
- } break;
- case Animation::TYPE_METHOD: {
-
- Dictionary d = animation->track_get_key_value(track, key);
-
- if (name == "name") {
-
- ERR_FAIL_COND_V(!d.has("method"), false);
- r_ret = d["method"];
- return true;
- }
-
- ERR_FAIL_COND_V(!d.has("args"), false);
-
- Vector<Variant> args = d["args"];
-
- if (name == "arg_count") {
-
- r_ret = args.size();
- return true;
- }
-
- if (name.begins_with("args/")) {
-
- int idx = name.get_slice("/", 1).to_int();
- ERR_FAIL_INDEX_V(idx, args.size(), false);
-
- String what = name.get_slice("/", 2);
- if (what == "type") {
- r_ret = args[idx].get_type();
- return true;
- }
- if (what == "value") {
- r_ret = args[idx];
- return true;
- }
- }
-
- } break;
- }
-
- return false;
- }
- void _get_property_list(List<PropertyInfo> *p_list) const {
-
- if (animation.is_null())
- return;
-
- ERR_FAIL_INDEX(track, animation->get_track_count());
- int key = animation->track_find_key(track, key_ofs, true);
- ERR_FAIL_COND(key == -1);
-
- p_list->push_back(PropertyInfo(Variant::REAL, "time", PROPERTY_HINT_RANGE, "0," + rtos(animation->get_length()) + ",0.01"));
-
- switch (animation->track_get_type(track)) {
-
- case Animation::TYPE_TRANSFORM: {
-
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "location"));
- p_list->push_back(PropertyInfo(Variant::QUAT, "rotation"));
- p_list->push_back(PropertyInfo(Variant::VECTOR3, "scale"));
-
- } break;
- case Animation::TYPE_VALUE: {
-
- Variant v = animation->track_get_key_value(track, key);
-
- if (hint.type != Variant::NIL) {
-
- PropertyInfo pi = hint;
- pi.name = "value";
- p_list->push_back(pi);
- } else {
-
- PropertyHint hint = PROPERTY_HINT_NONE;
- String hint_string;
-
- if (v.get_type() == Variant::OBJECT) {
- //could actually check the object property if exists..? yes i will!
- Ref<Resource> res = v;
- if (res.is_valid()) {
-
- hint = PROPERTY_HINT_RESOURCE_TYPE;
- hint_string = res->get_class();
- }
- }
-
- if (v.get_type() != Variant::NIL)
- p_list->push_back(PropertyInfo(v.get_type(), "value", hint, hint_string));
- }
-
- } break;
- case Animation::TYPE_METHOD: {
-
- p_list->push_back(PropertyInfo(Variant::STRING, "name"));
- p_list->push_back(PropertyInfo(Variant::INT, "arg_count", PROPERTY_HINT_RANGE, "0,5,1"));
-
- Dictionary d = animation->track_get_key_value(track, key);
- ERR_FAIL_COND(!d.has("args"));
- Vector<Variant> args = d["args"];
- String vtypes;
- for (int i = 0; i < Variant::VARIANT_MAX; i++) {
-
- if (i > 0)
- vtypes += ",";
- vtypes += Variant::get_type_name(Variant::Type(i));
- }
-
- for (int i = 0; i < args.size(); i++) {
-
- p_list->push_back(PropertyInfo(Variant::INT, "args/" + itos(i) + "/type", PROPERTY_HINT_ENUM, vtypes));
- if (args[i].get_type() != Variant::NIL)
- p_list->push_back(PropertyInfo(args[i].get_type(), "args/" + itos(i) + "/value"));
- }
-
- } break;
- }
-
- /*
- if (animation->track_get_type(track)!=Animation::TYPE_METHOD)
- p_list->push_back( PropertyInfo( Variant::REAL, "easing", PROPERTY_HINT_EXP_EASING));
- */
- }
-
- UndoRedo *undo_redo;
- Ref<Animation> animation;
- int track;
- float key_ofs;
-
- PropertyInfo hint;
- NodePath base;
-
- void notify_change() {
-
- _change_notify();
- }
-
- AnimationKeyEdit() {
- hidden = true;
- key_ofs = 0;
- track = -1;
- setting = false;
- }
-};
-
-void AnimationKeyEditor::_menu_add_track(int p_type) {
-
- ERR_FAIL_COND(!animation.is_valid());
-
- switch (p_type) {
-
- case ADD_TRACK_MENU_ADD_CALL_TRACK: {
- if (root) {
- call_select->popup_centered_ratio();
- break;
- }
- } break;
- case ADD_TRACK_MENU_ADD_VALUE_TRACK:
- case ADD_TRACK_MENU_ADD_TRANSFORM_TRACK: {
-
- undo_redo->create_action(TTR("Anim Add Track"));
- undo_redo->add_do_method(animation.ptr(), "add_track", p_type);
- undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), ".");
- undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
- undo_redo->commit_action();
-
- } break;
- }
-}
-
-void AnimationKeyEditor::_anim_duplicate_keys(bool transpose) {
- //duplicait!
- if (selection.size() && animation.is_valid() && selected_track >= 0 && selected_track < animation->get_track_count()) {
-
- int top_track = 0x7FFFFFFF;
- float top_time = 1e10;
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- const SelectedKey &sk = E->key();
-
- float t = animation->track_get_key_time(sk.track, sk.key);
- if (t < top_time)
- top_time = t;
- if (sk.track < top_track)
- top_track = sk.track;
- }
- ERR_FAIL_COND(top_track == 0x7FFFFFFF || top_time == 1e10);
-
- //
-
- int start_track = transpose ? selected_track : top_track;
-
- undo_redo->create_action(TTR("Anim Duplicate Keys"));
-
- List<Pair<int, float> > new_selection_values;
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- const SelectedKey &sk = E->key();
-
- float t = animation->track_get_key_time(sk.track, sk.key);
-
- float dst_time = t + (timeline_pos - top_time);
- int dst_track = sk.track + (start_track - top_track);
-
- if (dst_track < 0 || dst_track >= animation->get_track_count())
- continue;
-
- if (animation->track_get_type(dst_track) != animation->track_get_type(sk.track))
- continue;
-
- int existing_idx = animation->track_find_key(dst_track, dst_time, true);
-
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", dst_track, dst_time, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", dst_track, dst_time);
-
- Pair<int, float> p;
- p.first = dst_track;
- p.second = dst_time;
- new_selection_values.push_back(p);
-
- if (existing_idx != -1) {
-
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", dst_track, dst_time, animation->track_get_key_value(dst_track, existing_idx), animation->track_get_key_transition(dst_track, existing_idx));
- }
- }
-
- undo_redo->commit_action();
-
- //reselect duplicated
-
- Map<SelectedKey, KeyInfo> new_selection;
- for (List<Pair<int, float> >::Element *E = new_selection_values.front(); E; E = E->next()) {
-
- int track = E->get().first;
- float time = E->get().second;
-
- int existing_idx = animation->track_find_key(track, time, true);
-
- if (existing_idx == -1)
- continue;
- SelectedKey sk2;
- sk2.track = track;
- sk2.key = existing_idx;
-
- KeyInfo ki;
- ki.pos = time;
-
- new_selection[sk2] = ki;
- }
-
- selection = new_selection;
- track_editor->update();
- _edit_if_single_selection();
- }
-}
-
-void AnimationKeyEditor::_menu_track(int p_type) {
-
- ERR_FAIL_COND(!animation.is_valid());
-
- last_menu_track_opt = p_type;
- switch (p_type) {
-
- case TRACK_MENU_SCALE:
- case TRACK_MENU_SCALE_PIVOT: {
-
- scale_dialog->popup_centered(Size2(200, 100));
- } break;
- case TRACK_MENU_MOVE_UP: {
-
- int idx = selected_track;
- if (idx > 0 && idx < animation->get_track_count()) {
- undo_redo->create_action(TTR("Move Anim Track Up"));
- undo_redo->add_do_method(animation.ptr(), "track_move_down", idx);
- undo_redo->add_undo_method(animation.ptr(), "track_move_up", idx - 1);
- undo_redo->commit_action();
- selected_track = idx - 1;
- }
-
- } break;
- case TRACK_MENU_MOVE_DOWN: {
-
- int idx = selected_track;
- if (idx >= 0 && idx < animation->get_track_count() - 1) {
- undo_redo->create_action(TTR("Move Anim Track Down"));
- undo_redo->add_do_method(animation.ptr(), "track_move_up", idx);
- undo_redo->add_undo_method(animation.ptr(), "track_move_down", idx + 1);
- undo_redo->commit_action();
- selected_track = idx + 1;
- }
-
- } break;
- case TRACK_MENU_REMOVE: {
-
- int idx = selected_track;
- if (idx >= 0 && idx < animation->get_track_count()) {
- undo_redo->create_action(TTR("Remove Anim Track"));
- undo_redo->add_do_method(animation.ptr(), "remove_track", idx);
- undo_redo->add_undo_method(animation.ptr(), "add_track", animation->track_get_type(idx), idx);
- undo_redo->add_undo_method(animation.ptr(), "track_set_path", idx, animation->track_get_path(idx));
- //todo interpolation
- for (int i = 0; i < animation->track_get_key_count(idx); i++) {
-
- Variant v = animation->track_get_key_value(idx, i);
- float time = animation->track_get_key_time(idx, i);
- float trans = animation->track_get_key_transition(idx, i);
-
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", idx, time, v);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_transition", idx, i, trans);
- }
-
- undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_type", idx, animation->track_get_interpolation_type(idx));
- if (animation->track_get_type(idx) == Animation::TYPE_VALUE) {
- undo_redo->add_undo_method(animation.ptr(), "value_track_set_update_mode", idx, animation->value_track_get_update_mode(idx));
- }
-
- undo_redo->commit_action();
- }
-
- } break;
- case TRACK_MENU_DUPLICATE:
- case TRACK_MENU_DUPLICATE_TRANSPOSE: {
-
- _anim_duplicate_keys(p_type == TRACK_MENU_DUPLICATE_TRANSPOSE);
- } break;
- case TRACK_MENU_SET_ALL_TRANS_LINEAR:
- case TRACK_MENU_SET_ALL_TRANS_CONSTANT:
- case TRACK_MENU_SET_ALL_TRANS_OUT:
- case TRACK_MENU_SET_ALL_TRANS_IN:
- case TRACK_MENU_SET_ALL_TRANS_INOUT:
- case TRACK_MENU_SET_ALL_TRANS_OUTIN: {
-
- if (!selection.size() || !animation.is_valid())
- break;
-
- float t = 0;
- switch (p_type) {
- case TRACK_MENU_SET_ALL_TRANS_LINEAR: t = 1.0; break;
- case TRACK_MENU_SET_ALL_TRANS_CONSTANT: t = 0.0; break;
- case TRACK_MENU_SET_ALL_TRANS_OUT: t = 0.5; break;
- case TRACK_MENU_SET_ALL_TRANS_IN: t = 2.0; break;
- case TRACK_MENU_SET_ALL_TRANS_INOUT: t = -0.5; break;
- case TRACK_MENU_SET_ALL_TRANS_OUTIN: t = -2.0; break;
- }
-
- undo_redo->create_action(TTR("Set Transitions to:") + " " + rtos(t));
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- const SelectedKey &sk = E->key();
-
- undo_redo->add_do_method(animation.ptr(), "track_set_key_transition", sk.track, sk.key, t);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_transition", sk.track, sk.key, animation->track_get_key_transition(sk.track, sk.key));
- }
-
- undo_redo->commit_action();
-
- } break;
- case TRACK_MENU_NEXT_STEP: {
-
- if (animation.is_null())
- break;
- float step = animation->get_step();
- if (step == 0)
- step = 1;
-
- float pos = timeline_pos;
-
- pos = Math::stepify(pos + step, step);
- if (pos > animation->get_length())
- pos = animation->get_length();
- timeline_pos = pos;
- track_pos->update();
- emit_signal("timeline_changed", pos, true);
-
- } break;
- case TRACK_MENU_PREV_STEP: {
- if (animation.is_null())
- break;
- float step = animation->get_step();
- if (step == 0)
- step = 1;
-
- float pos = timeline_pos;
- pos = Math::stepify(pos - step, step);
- if (pos < 0)
- pos = 0;
- timeline_pos = pos;
- track_pos->update();
- emit_signal("timeline_changed", pos, true);
-
- } break;
-
- case TRACK_MENU_OPTIMIZE: {
-
- optimize_dialog->popup_centered(Size2(250, 180));
- } break;
- case TRACK_MENU_CLEAN_UP: {
-
- cleanup_dialog->popup_centered_minsize(Size2(300, 0));
- } break;
- case TRACK_MENU_CLEAN_UP_CONFIRM: {
-
- if (cleanup_all->is_pressed()) {
- List<StringName> names;
- AnimationPlayerEditor::singleton->get_player()->get_animation_list(&names);
- for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
- _cleanup_animation(AnimationPlayerEditor::singleton->get_player()->get_animation(E->get()));
- }
- } else {
- _cleanup_animation(animation);
- }
- } break;
- case CURVE_SET_LINEAR: {
- curve_edit->force_transition(1.0);
-
- } break;
- case CURVE_SET_IN: {
-
- curve_edit->force_transition(4.0);
-
- } break;
- case CURVE_SET_OUT: {
-
- curve_edit->force_transition(0.25);
- } break;
- case CURVE_SET_INOUT: {
- curve_edit->force_transition(-4);
-
- } break;
- case CURVE_SET_OUTIN: {
-
- curve_edit->force_transition(-0.25);
- } break;
- case CURVE_SET_CONSTANT: {
-
- curve_edit->force_transition(0);
- } break;
- }
-}
-
-void AnimationKeyEditor::_cleanup_animation(Ref<Animation> p_animation) {
-
- for (int i = 0; i < p_animation->get_track_count(); i++) {
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Vector<StringName> leftover_path;
-
- Node *node = root->get_node_and_resource(p_animation->track_get_path(i), res, leftover_path);
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj && p_animation->track_get_type(i) == Animation::TYPE_VALUE) {
- valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
- }
-
- if (!obj && cleanup_tracks->is_pressed()) {
-
- p_animation->remove_track(i);
- i--;
- continue;
- }
-
- if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || cleanup_keys->is_pressed() == false)
- continue;
-
- for (int j = 0; j < p_animation->track_get_key_count(i); j++) {
-
- Variant v = p_animation->track_get_key_value(i, j);
-
- if (!Variant::can_convert(v.get_type(), valid_type)) {
- p_animation->track_remove_key(i, j);
- j--;
- }
- }
-
- if (p_animation->track_get_key_count(i) == 0 && cleanup_tracks->is_pressed()) {
- p_animation->remove_track(i);
- i--;
- }
- }
-
- undo_redo->clear_history();
- _update_paths();
-}
-
-void AnimationKeyEditor::_animation_optimize() {
-
- animation->optimize(optimize_linear_error->get_value(), optimize_angular_error->get_value(), optimize_max_angle->get_value());
- track_editor->update();
- undo_redo->clear_history();
-}
-
-float AnimationKeyEditor::_get_zoom_scale() const {
-
- float zv = zoom->get_value();
- if (zv < 1) {
- zv = 1.0 - zv;
- return Math::pow(1.0f + zv, 8.0f) * 100;
- } else {
- return 1.0 / Math::pow(zv, 8.0f) * 100;
- }
-}
-
-void AnimationKeyEditor::_track_position_draw() {
-
- if (!animation.is_valid()) {
- return;
- }
-
- Ref<StyleBox> style = get_stylebox("normal", "TextEdit");
- Size2 size = track_editor->get_size() - style->get_minimum_size();
- Size2 ofs = style->get_offset();
-
- int settings_limit = size.width - right_data_size_cache;
- int name_limit = settings_limit * name_column_ratio;
-
- float keys_from = h_scroll->get_value();
- float zoom_scale = _get_zoom_scale();
- float keys_to = keys_from + (settings_limit - name_limit) / zoom_scale;
-
- //will move to separate control! (for speedup)
- if (timeline_pos >= keys_from && timeline_pos < keys_to) {
- //draw position
- int pixel = (timeline_pos - h_scroll->get_value()) * zoom_scale;
- pixel += name_limit;
- track_pos->draw_line(ofs + Point2(pixel, 0), ofs + Point2(pixel, size.height), get_color("accent_color", "Editor"));
- }
-}
-
-void AnimationKeyEditor::_track_editor_draw() {
-
- if (animation.is_valid() && animation->get_track_count()) {
- if (selected_track < 0)
- selected_track = 0;
- else if (selected_track >= animation->get_track_count())
- selected_track = animation->get_track_count() - 1;
- }
-
- track_pos->update();
- Control *te = track_editor;
- Ref<StyleBox> style = get_stylebox("normal", "TextEdit");
- te->draw_style_box(style, Rect2(Point2(), track_editor->get_size()));
-
- if (te->has_focus()) {
- te->draw_style_box(get_stylebox("bg_focus", "Tree"), Rect2(Point2(), track_editor->get_size()));
- }
-
- if (!animation.is_valid()) {
- v_scroll->hide();
- h_scroll->hide();
- menu_add_track->set_disabled(true);
- menu_track->set_disabled(true);
- edit_button->set_disabled(true);
- key_editor_tab->hide();
- move_up_button->set_disabled(true);
- move_down_button->set_disabled(true);
- remove_button->set_disabled(true);
-
- return;
- }
-
- menu_add_track->set_disabled(false);
- menu_track->set_disabled(false);
- edit_button->set_disabled(false);
- move_up_button->set_disabled(false);
- move_down_button->set_disabled(false);
- remove_button->set_disabled(false);
- if (edit_button->is_pressed())
- key_editor_tab->show();
-
- te_drawing = true;
-
- Size2 size = te->get_size() - style->get_minimum_size();
- Size2 ofs = style->get_offset();
-
- Ref<Font> font = te->get_font("font", "Tree");
- int sep = get_constant("vseparation", "Tree");
- int hsep = get_constant("hseparation", "Tree");
- Color color = get_color("font_color", "Tree");
- Color sepcolor = color;
- sepcolor.a = 0.2;
- Color timecolor = color;
- timecolor.a = 0.2;
- Color hover_color = color;
- hover_color.a = 0.05;
- Color select_color = color;
- select_color.a = 0.1;
- Color invalid_path_color = get_color("error_color", "Editor");
- Color track_select_color = get_color("highlighted_font_color", "Editor");
-
- Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons");
- Ref<Texture> move_up_icon = get_icon("MoveUp", "EditorIcons");
- Ref<Texture> move_down_icon = get_icon("MoveDown", "EditorIcons");
- Ref<Texture> remove_icon_hl = get_icon("RemoveHl", "EditorIcons");
- Ref<Texture> move_up_icon_hl = get_icon("MoveUpHl", "EditorIcons");
- Ref<Texture> move_down_icon_hl = get_icon("MoveDownHl", "EditorIcons");
- Ref<Texture> add_key_icon = get_icon("TrackAddKey", "EditorIcons");
- Ref<Texture> add_key_icon_hl = get_icon("TrackAddKeyHl", "EditorIcons");
- Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
- Ref<Texture> checked = get_icon("checked", "Tree");
- Ref<Texture> unchecked = get_icon("unchecked", "Tree");
-
- Ref<Texture> wrap_icon[2] = {
- get_icon("InterpWrapClamp", "EditorIcons"),
- get_icon("InterpWrapLoop", "EditorIcons"),
- };
-
- Ref<Texture> interp_icon[3] = {
- get_icon("InterpRaw", "EditorIcons"),
- get_icon("InterpLinear", "EditorIcons"),
- get_icon("InterpCubic", "EditorIcons")
- };
- Ref<Texture> cont_icon[3] = {
- get_icon("TrackContinuous", "EditorIcons"),
- get_icon("TrackDiscrete", "EditorIcons"),
- get_icon("TrackTrigger", "EditorIcons")
- };
- Ref<Texture> type_icon[3] = {
- get_icon("KeyValue", "EditorIcons"),
- get_icon("KeyXform", "EditorIcons"),
- get_icon("KeyCall", "EditorIcons")
- };
-
- Ref<Texture> invalid_icon = get_icon("KeyInvalid", "EditorIcons");
- Ref<Texture> invalid_icon_hover = get_icon("KeyInvalidHover", "EditorIcons");
-
- Ref<Texture> hsize_icon = get_icon("Hsize", "EditorIcons");
-
- Ref<Texture> type_hover = get_icon("KeyHover", "EditorIcons");
- Ref<Texture> type_selected = get_icon("KeySelected", "EditorIcons");
-
- int right_separator_ofs = right_data_size_cache;
-
- int h = font->get_height() + sep;
-
- int fit = (size.height / h) - 1;
- int total = animation->get_track_count();
- if (total < fit) {
- v_scroll->hide();
- v_scroll->set_max(total);
- v_scroll->set_page(fit);
- } else {
- v_scroll->show();
- v_scroll->set_max(total);
- v_scroll->set_page(fit);
- }
-
- int left_check_ofs = checked->get_width();
- int settings_limit = size.width - right_separator_ofs;
- int name_limit = settings_limit * name_column_ratio;
-
- Color linecolor = color;
- linecolor.a = 0.2;
- te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), linecolor);
- te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), linecolor);
- te->draw_texture(hsize_icon, ofs + Point2(name_limit - hsize_icon->get_width() - hsep, (h - hsize_icon->get_height()) / 2));
-
- te->draw_line(ofs + Point2(0, h), ofs + Point2(size.width, h), linecolor);
- // draw time
-
- float keys_from;
- float keys_to;
- float zoom_scale;
-
- {
-
- int zoomw = settings_limit - name_limit;
-
- float scale = _get_zoom_scale();
- zoom_scale = scale;
-
- float l = animation->get_length();
- if (l <= 0)
- l = 0.001; //avoid crashor
-
- int end_px = (l - h_scroll->get_value()) * scale;
- int begin_px = -h_scroll->get_value() * scale;
- Color notimecol = get_color("dark_color_2", "Editor");
-
- {
-
- te->draw_rect(Rect2(ofs + Point2(name_limit, 0), Point2(zoomw - 1, h)), notimecol);
-
- if (begin_px < zoomw && end_px > 0) {
-
- if (begin_px < 0)
- begin_px = 0;
- if (end_px > zoomw)
- end_px = zoomw;
-
- te->draw_rect(Rect2(ofs + Point2(name_limit + begin_px, 0), Point2(end_px - begin_px - 1, h)), timecolor);
- }
- }
-
- keys_from = h_scroll->get_value();
- keys_to = keys_from + zoomw / scale;
-
- {
- float time_min = 0;
- float time_max = animation->get_length();
- for (int i = 0; i < animation->get_track_count(); i++) {
-
- if (animation->track_get_key_count(i) > 0) {
-
- float beg = animation->track_get_key_time(i, 0);
- if (beg < time_min)
- time_min = beg;
- float end = animation->track_get_key_time(i, animation->track_get_key_count(i) - 1);
- if (end > time_max)
- time_max = end;
- }
- }
-
- float extra = (zoomw / scale) * 0.5;
-
- if (time_min < -0.001)
- time_min -= extra;
- time_max += extra;
- h_scroll->set_min(time_min);
- h_scroll->set_max(time_max);
-
- if (zoomw / scale < (time_max - time_min)) {
- h_scroll->show();
-
- } else {
-
- h_scroll->hide();
- }
- }
-
- h_scroll->set_page(zoomw / scale);
-
- Color color_time_sec = color;
- Color color_time_dec = color;
- color_time_dec.a *= 0.5;
-#define SC_ADJ 100
- int min = 30;
- int dec = 1;
- int step = 1;
- int decimals = 2;
- bool step_found = false;
-
- while (!step_found) {
-
- static const int _multp[3] = { 1, 2, 5 };
- for (int i = 0; i < 3; i++) {
-
- step = (_multp[i] * dec);
- if (step * scale / SC_ADJ > min) {
- step_found = true;
- break;
- }
- }
- if (step_found)
- break;
- dec *= 10;
- decimals--;
- if (decimals < 0)
- decimals = 0;
- }
-
- for (int i = 0; i < zoomw; i++) {
-
- float pos = h_scroll->get_value() + double(i) / scale;
- float prev = h_scroll->get_value() + (double(i) - 1.0) / scale;
-
- int sc = int(Math::floor(pos * SC_ADJ));
- int prev_sc = int(Math::floor(prev * SC_ADJ));
- bool sub = (sc % SC_ADJ);
-
- if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) {
-
- int scd = sc < 0 ? prev_sc : sc;
- te->draw_line(ofs + Point2(name_limit + i, 0), ofs + Point2(name_limit + i, h), linecolor);
- te->draw_string(font, ofs + Point2(name_limit + i + 3, (h - font->get_height()) / 2 + font->get_ascent()).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), sub ? color_time_dec : color_time_sec, zoomw - i);
- }
- }
- }
-
- color.a *= 0.5;
-
- for (int i = 0; i < fit; i++) {
-
- //this code sucks, i always forget how it works
-
- int idx = v_scroll->get_value() + i;
- if (idx >= animation->get_track_count())
- break;
- int y = h + i * h + sep;
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Vector<StringName> leftover_path;
-
- Node *node = root ? root->get_node_and_resource(animation->track_get_path(idx), res, leftover_path) : (Node *)NULL;
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj && animation->track_get_type(idx) == Animation::TYPE_VALUE) {
- // While leftover_path might be still empty, we wouldn't be able to get here anyway
- valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
- }
-
- // Draw background color of the whole track
- if (/*mouse_over.over!=MouseOver::OVER_NONE &&*/ idx == mouse_over.track) {
- Color sepc = hover_color;
- te->draw_rect(Rect2(ofs + Point2(0, y), Size2(size.width, h - 1)), sepc);
- }
-
- if (selected_track == idx) {
- Color tc = select_color;
- //tc.a*=0.7;
- te->draw_rect(Rect2(ofs + Point2(0, y), Size2(size.width - 1, h - 1)), tc);
- }
-
- // Draw track enabled state check box
- Ref<Texture> check_box = animation->track_is_enabled(idx) ? checked : unchecked;
- te->draw_texture(check_box, ofs + Point2(0, y + (h - checked->get_height()) / 2).floor());
-
- // Draw track type glyph and node path
- te->draw_texture(type_icon[animation->track_get_type(idx)], ofs + Point2(left_check_ofs + sep, y + (h - type_icon[0]->get_height()) / 2).floor());
- NodePath np = animation->track_get_path(idx);
- Node *n = root ? root->get_node(np) : (Node *)NULL;
- Color ncol = color;
- if (n && editor_selection->is_selected(n))
- ncol = track_select_color;
- te->draw_string(font, Point2(ofs + Point2(left_check_ofs + sep + type_icon[0]->get_width() + sep, y + font->get_ascent() + (sep / 2))).floor(), np, ncol, name_limit - (left_check_ofs + sep) - (type_icon[0]->get_width() + sep) - 5);
-
- // Draw separator line below track area
- if (!obj)
- te->draw_line(ofs + Point2(0, y + h / 2), ofs + Point2(name_limit, y + h / 2), invalid_path_color);
-
- te->draw_line(ofs + Point2(0, y + h), ofs + Point2(size.width, y + h), sepcolor);
-
- Point2 icon_ofs = ofs + Point2(size.width, y + (h - remove_icon->get_height()) / 2).floor();
- icon_ofs.y += 4 * EDSCALE;
-
- /* icon_ofs.x-=remove_icon->get_width();
-
- te->draw_texture((mouse_over.over==MouseOver::OVER_REMOVE && mouse_over.track==idx)?remove_icon_hl:remove_icon,icon_ofs);
- icon_ofs.x-=hsep;
- icon_ofs.x-=move_down_icon->get_width();
- te->draw_texture((mouse_over.over==MouseOver::OVER_DOWN && mouse_over.track==idx)?move_down_icon_hl:move_down_icon,icon_ofs);
- icon_ofs.x-=hsep;
- icon_ofs.x-=move_up_icon->get_width();
- te->draw_texture((mouse_over.over==MouseOver::OVER_UP && mouse_over.track==idx)?move_up_icon_hl:move_up_icon,icon_ofs);
- icon_ofs.x-=hsep;
- te->draw_line(Point2(icon_ofs.x,ofs.y+y),Point2(icon_ofs.x,ofs.y+y+h),sepcolor);
-
- icon_ofs.x-=hsep;
- */
- track_ofs[0] = size.width - icon_ofs.x + ofs.x;
- icon_ofs.x -= down_icon->get_width();
- te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE));
-
- int wrap_type = animation->track_get_interpolation_loop_wrap(idx) ? 1 : 0;
- icon_ofs.x -= hsep;
- icon_ofs.x -= wrap_icon[wrap_type]->get_width();
- te->draw_texture(wrap_icon[wrap_type], icon_ofs);
-
- icon_ofs.x -= hsep;
- te->draw_line(Point2(icon_ofs.x, ofs.y + y), Point2(icon_ofs.x, ofs.y + y + h), sepcolor);
-
- track_ofs[1] = size.width - icon_ofs.x + ofs.x;
-
- icon_ofs.x -= down_icon->get_width();
- te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE));
-
- int interp_type = animation->track_get_interpolation_type(idx);
- ERR_CONTINUE(interp_type < 0 || interp_type >= 3);
- icon_ofs.x -= hsep;
- icon_ofs.x -= interp_icon[interp_type]->get_width();
- te->draw_texture(interp_icon[interp_type], icon_ofs);
-
- icon_ofs.x -= hsep;
- te->draw_line(Point2(icon_ofs.x, ofs.y + y), Point2(icon_ofs.x, ofs.y + y + h), sepcolor);
-
- track_ofs[2] = size.width - icon_ofs.x + ofs.x;
-
- if (animation->track_get_type(idx) == Animation::TYPE_VALUE) {
-
- int umode = animation->value_track_get_update_mode(idx);
-
- icon_ofs.x -= hsep;
- icon_ofs.x -= down_icon->get_width();
- te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE));
-
- icon_ofs.x -= hsep;
- icon_ofs.x -= cont_icon[umode]->get_width();
- te->draw_texture(cont_icon[umode], icon_ofs);
- } else {
-
- icon_ofs.x -= hsep * 2 + cont_icon[0]->get_width() + down_icon->get_width();
- }
-
- icon_ofs.x -= hsep;
- te->draw_line(Point2(icon_ofs.x, ofs.y + y), Point2(icon_ofs.x, ofs.y + y + h), sepcolor);
-
- track_ofs[3] = size.width - icon_ofs.x + ofs.x;
-
- icon_ofs.x -= hsep;
- icon_ofs.x -= add_key_icon->get_width();
- te->draw_texture((mouse_over.over == MouseOver::OVER_ADD_KEY && mouse_over.track == idx) ? add_key_icon_hl : add_key_icon, icon_ofs);
- track_ofs[4] = size.width - icon_ofs.x + ofs.x;
-
- //draw the keys;
- int tt = animation->track_get_type(idx);
- float key_vofs = Math::floor((float)(h - type_icon[tt]->get_height()) / 2);
- float key_hofs = -Math::floor((float)type_icon[tt]->get_height() / 2);
-
- int kc = animation->track_get_key_count(idx);
- bool first = true;
-
- for (int i = 0; i < kc; i++) {
-
- float time = animation->track_get_key_time(idx, i);
- if (time < keys_from)
- continue;
- if (time > keys_to) {
-
- if (first && i > 0 && animation->track_get_key_value(idx, i) == animation->track_get_key_value(idx, i - 1)) {
- //draw whole line
- te->draw_line(ofs + Vector2(name_limit, y + h / 2), ofs + Point2(settings_limit, y + h / 2), color);
- }
-
- break;
- }
-
- float x = key_hofs + name_limit + (time - keys_from) * zoom_scale;
-
- Ref<Texture> tex = type_icon[tt];
-
- SelectedKey sk;
- sk.key = i;
- sk.track = idx;
- if (selection.has(sk)) {
-
- if (click.click == ClickOver::CLICK_MOVE_KEYS)
- continue;
- tex = type_selected;
- }
-
- if (mouse_over.over == MouseOver::OVER_KEY && mouse_over.track == idx && mouse_over.over_key == i)
- tex = type_hover;
-
- Variant value = animation->track_get_key_value(idx, i);
- if (first && i > 0 && value == animation->track_get_key_value(idx, i - 1)) {
-
- te->draw_line(ofs + Vector2(name_limit, y + h / 2), ofs + Point2(x, y + h / 2), color);
- }
-
- if (i < kc - 1 && value == animation->track_get_key_value(idx, i + 1)) {
- float x_n = key_hofs + name_limit + (animation->track_get_key_time(idx, i + 1) - keys_from) * zoom_scale;
-
- x_n = MIN(x_n, settings_limit);
- te->draw_line(ofs + Point2(x_n, y + h / 2), ofs + Point2(x, y + h / 2), color);
- }
-
- if (prop_exists && !Variant::can_convert(value.get_type(), valid_type)) {
- te->draw_texture(invalid_icon, ofs + Point2(x, y + key_vofs).floor());
- }
-
- if (prop_exists && !Variant::can_convert(value.get_type(), valid_type)) {
- if (tex == type_hover)
- te->draw_texture(invalid_icon_hover, ofs + Point2(x, y + key_vofs).floor());
- else
- te->draw_texture(invalid_icon, ofs + Point2(x, y + key_vofs).floor());
- } else {
-
- te->draw_texture(tex, ofs + Point2(x, y + key_vofs).floor());
- }
-
- first = false;
- }
- }
-
- switch (click.click) {
- case ClickOver::CLICK_SELECT_KEYS: {
-
- Color box_color = get_color("accent_color", "Editor");
- box_color.a = 0.35;
- te->draw_rect(Rect2(click.at, click.to - click.at), box_color);
-
- } break;
- case ClickOver::CLICK_MOVE_KEYS: {
-
- float from_t = 1e20;
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
- float t = animation->track_get_key_time(E->key().track, E->key().key);
- if (t < from_t)
- from_t = t;
- }
-
- float motion = from_t + (click.to.x - click.at.x) / zoom_scale;
- if (step->get_value())
- motion = Math::stepify(motion, step->get_value());
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
-
- int idx = E->key().track;
- int i = idx - (int)v_scroll->get_value();
- if (i < 0 || i >= fit)
- continue;
- int y = h + i * h + sep;
-
- float key_vofs = Math::floor((float)(h - type_selected->get_height()) / 2);
- float key_hofs = -Math::floor((float)type_selected->get_height() / 2);
-
- float time = animation->track_get_key_time(idx, E->key().key);
- float diff = time - from_t;
-
- float t = motion + diff;
-
- float x = (t - keys_from) * zoom_scale;
- //x+=click.to.x - click.at.x;
- if (x < 0 || x >= (settings_limit - name_limit))
- continue;
-
- x += name_limit;
-
- te->draw_texture(type_selected, ofs + Point2(x + key_hofs, y + key_vofs).floor());
- }
- } break;
- default: {};
- }
-
- te_drawing = false;
-}
-
-void AnimationKeyEditor::_track_name_changed(const String &p_name) {
-
- ERR_FAIL_COND(!animation.is_valid());
- undo_redo->create_action(TTR("Anim Track Rename"));
- undo_redo->add_do_method(animation.ptr(), "track_set_path", track_name_editing, p_name);
- undo_redo->add_undo_method(animation.ptr(), "track_set_path", track_name_editing, animation->track_get_path(track_name_editing));
- undo_redo->commit_action();
- track_name->hide();
-}
-
-void AnimationKeyEditor::_track_menu_selected(int p_idx) {
-
- ERR_FAIL_COND(!animation.is_valid());
-
- if (interp_editing != -1) {
-
- ERR_FAIL_INDEX(interp_editing, animation->get_track_count());
- undo_redo->create_action(TTR("Anim Track Change Interpolation"));
- undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_type", interp_editing, p_idx);
- undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_type", interp_editing, animation->track_get_interpolation_type(interp_editing));
- undo_redo->commit_action();
- } else if (cont_editing != -1) {
-
- ERR_FAIL_INDEX(cont_editing, animation->get_track_count());
-
- undo_redo->create_action(TTR("Anim Track Change Value Mode"));
- undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", cont_editing, p_idx);
- undo_redo->add_undo_method(animation.ptr(), "value_track_set_update_mode", cont_editing, animation->value_track_get_update_mode(cont_editing));
- undo_redo->commit_action();
- } else if (wrap_editing != -1) {
-
- ERR_FAIL_INDEX(wrap_editing, animation->get_track_count());
-
- undo_redo->create_action(TTR("Anim Track Change Wrap Mode"));
- undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_loop_wrap", wrap_editing, p_idx ? true : false);
- undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_loop_wrap", wrap_editing, animation->track_get_interpolation_loop_wrap(wrap_editing));
- undo_redo->commit_action();
- } else {
- switch (p_idx) {
-
- case RIGHT_MENU_DUPLICATE:
- _anim_duplicate_keys();
- break;
- case RIGHT_MENU_DUPLICATE_TRANSPOSE:
- _anim_duplicate_keys(true);
- break;
- case RIGHT_MENU_REMOVE:
- _anim_delete_keys();
- break;
- }
- }
-}
-
-struct _AnimMoveRestore {
-
- int track;
- float time;
- Variant key;
- float transition;
-};
-
-void AnimationKeyEditor::_clear_selection_for_anim(const Ref<Animation> &p_anim) {
-
- if (!(animation == p_anim))
- return;
- //selection.clear();
- _clear_selection();
-}
-
-void AnimationKeyEditor::_select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos) {
-
- if (!(animation == p_anim))
- return;
-
- int idx = animation->track_find_key(p_track, p_pos, true);
- ERR_FAIL_COND(idx < 0);
-
- SelectedKey sk;
- sk.track = p_track;
- sk.key = idx;
- KeyInfo ki;
- ki.pos = p_pos;
-
- selection.insert(sk, ki);
-}
-
-PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx, NodePath &r_base_path) {
-
- r_base_path = NodePath();
- ERR_FAIL_COND_V(!animation.is_valid(), PropertyInfo());
- ERR_FAIL_INDEX_V(p_idx, animation->get_track_count(), PropertyInfo());
-
- if (!root)
- return PropertyInfo();
-
- NodePath path = animation->track_get_path(p_idx);
-
- if (!root->has_node_and_resource(path))
- return PropertyInfo();
-
- RES res;
- Vector<StringName> leftover_path;
- Node *node = root->get_node_and_resource(path, res, leftover_path, true);
-
- if (node) {
- r_base_path = node->get_path();
- }
-
- if (leftover_path.empty())
- return PropertyInfo();
-
- Variant property_info_base;
- if (res.is_valid())
- property_info_base = res;
- else if (node)
- property_info_base = node;
-
- for (int i = 0; i < leftover_path.size() - 1; i++) {
- property_info_base = property_info_base.get_named(leftover_path[i]);
- }
-
- List<PropertyInfo> pinfo;
- property_info_base.get_property_list(&pinfo);
-
- for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
-
- if (E->get().name == leftover_path[leftover_path.size() - 1]) {
- return E->get();
- }
- }
-
- return PropertyInfo();
-}
-
-void AnimationKeyEditor::_curve_transition_changed(float p_what) {
-
- if (selection.size() == 0)
- return;
- if (selection.size() == 1)
- undo_redo->create_action(TTR("Edit Node Curve"), UndoRedo::MERGE_ENDS);
- else
- undo_redo->create_action(TTR("Edit Selection Curve"), UndoRedo::MERGE_ENDS);
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
-
- int track = E->key().track;
- int key = E->key().key;
- float prev_val = animation->track_get_key_transition(track, key);
- undo_redo->add_do_method(animation.ptr(), "track_set_key_transition", track, key, p_what);
- undo_redo->add_undo_method(animation.ptr(), "track_set_key_transition", track, key, prev_val);
- }
-
- undo_redo->commit_action();
-}
-
-void AnimationKeyEditor::_toggle_edit_curves() {
-
- if (edit_button->is_pressed())
- key_editor_tab->show();
- else
- key_editor_tab->hide();
-}
-
-bool AnimationKeyEditor::_edit_if_single_selection() {
-
- if (selection.size() != 1) {
-
- if (selection.size() == 0) {
- curve_edit->set_mode(AnimationCurveEdit::MODE_DISABLED);
- //print_line("disable");
- } else {
-
- curve_edit->set_mode(AnimationCurveEdit::MODE_MULTIPLE);
- curve_edit->set_transition(1.0);
- curve_edit->clear_multiples();
- //add all
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
-
- curve_edit->set_multiple(animation->track_get_key_transition(E->key().track, E->key().key));
- }
- //print_line("multiple");
- }
- return false;
- }
- curve_edit->set_mode(AnimationCurveEdit::MODE_SINGLE);
- //print_line("regular");
-
- int idx = selection.front()->key().track;
- int key = selection.front()->key().key;
- {
-
- key_edit->animation = animation;
- key_edit->track = idx;
- key_edit->key_ofs = animation->track_get_key_time(idx, key);
- key_edit->hint = _find_hint_for_track(idx, key_edit->base);
- key_edit->notify_change();
-
- curve_edit->set_transition(animation->track_get_key_transition(idx, key));
-
- /*key_edit_dialog->set_size( Size2( 200,200) );
- key_edit_dialog->set_position( track_editor->get_global_position() + ofs + mpos +Point2(-100,20));
- key_edit_dialog->popup();*/
- }
-
- return true;
-}
-
-void AnimationKeyEditor::_anim_delete_keys() {
- if (selection.size()) {
- undo_redo->create_action(TTR("Anim Delete Keys"));
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
- undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->commit_action();
- //selection.clear();
- accept_event();
- _edit_if_single_selection();
- }
-}
-
-void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input) {
-
- Control *te = track_editor;
- Ref<StyleBox> style = get_stylebox("normal", "TextEdit");
-
- if (!animation.is_valid()) {
- return;
- }
-
- Size2 size = te->get_size() - style->get_minimum_size();
- Size2 ofs = style->get_offset();
-
- Ref<Font> font = te->get_font("font", "Tree");
- int sep = get_constant("vseparation", "Tree");
- int hsep = get_constant("hseparation", "Tree");
- Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons");
- Ref<Texture> move_up_icon = get_icon("MoveUp", "EditorIcons");
- Ref<Texture> move_down_icon = get_icon("MoveDown", "EditorIcons");
- Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
- Ref<Texture> hsize_icon = get_icon("Hsize", "EditorIcons");
- Ref<Texture> add_key_icon = get_icon("TrackAddKey", "EditorIcons");
- Ref<Texture> check_icon = get_icon("checked", "Tree");
-
- Ref<Texture> wrap_icon[2] = {
- get_icon("InterpWrapClamp", "EditorIcons"),
- get_icon("InterpWrapLoop", "EditorIcons"),
- };
- Ref<Texture> interp_icon[3] = {
- get_icon("InterpRaw", "EditorIcons"),
- get_icon("InterpLinear", "EditorIcons"),
- get_icon("InterpCubic", "EditorIcons")
- };
- Ref<Texture> cont_icon[3] = {
- get_icon("TrackContinuous", "EditorIcons"),
- get_icon("TrackDiscrete", "EditorIcons"),
- get_icon("TrackTrigger", "EditorIcons")
- };
- Ref<Texture> type_icon[3] = {
- get_icon("KeyValue", "EditorIcons"),
- get_icon("KeyXform", "EditorIcons"),
- get_icon("KeyCall", "EditorIcons")
- };
- int right_separator_ofs = right_data_size_cache;
-
- int h = font->get_height() + sep;
-
- int fit = (size.height / h) - 1;
- int total = animation->get_track_count();
- if (total < fit) {
- v_scroll->hide();
- } else {
- v_scroll->show();
- v_scroll->set_max(total);
- v_scroll->set_page(fit);
- }
-
- int left_check_ofs = check_icon->get_width();
- int settings_limit = size.width - right_separator_ofs;
- int name_limit = settings_limit * name_column_ratio;
-
- Ref<InputEventKey> key = p_input;
- if (key.is_valid()) {
-
- if (key->get_scancode() == KEY_D && key->is_pressed() && key->get_command()) {
-
- if (key->get_shift())
- _menu_track(TRACK_MENU_DUPLICATE_TRANSPOSE);
- else
- _menu_track(TRACK_MENU_DUPLICATE);
-
- accept_event();
-
- } else if (key->get_scancode() == KEY_DELETE && key->is_pressed() && click.click == ClickOver::CLICK_NONE) {
-
- _anim_delete_keys();
- } else if (animation.is_valid() && animation->get_track_count() > 0) {
-
- if (key->is_pressed() && (key->is_action("ui_up") || key->is_action("ui_page_up"))) {
-
- if (key->is_action("ui_up"))
- selected_track--;
- if (v_scroll->is_visible_in_tree() && key->is_action("ui_page_up"))
- selected_track--;
-
- if (selected_track < 0)
- selected_track = 0;
-
- if (v_scroll->is_visible_in_tree()) {
- if (v_scroll->get_value() > selected_track)
- v_scroll->set_value(selected_track);
- }
-
- track_editor->update();
- accept_event();
- }
-
- if (key->is_pressed() && (key->is_action("ui_down") || key->is_action("ui_page_down"))) {
-
- if (key->is_action("ui_down"))
- selected_track++;
- else if (v_scroll->is_visible_in_tree() && key->is_action("ui_page_down"))
- selected_track += v_scroll->get_page();
-
- if (selected_track >= animation->get_track_count())
- selected_track = animation->get_track_count() - 1;
-
- if (v_scroll->is_visible_in_tree() && v_scroll->get_page() + v_scroll->get_value() < selected_track + 1) {
- v_scroll->set_value(selected_track - v_scroll->get_page() + 1);
- }
-
- track_editor->update();
- accept_event();
- }
- }
- }
-
- Ref<InputEventMouseButton> mb = p_input;
-
- if (mb.is_valid()) {
-
- if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
-
- if (mb->get_command()) {
-
- zoom->set_value(zoom->get_value() + zoom->get_step());
- } else {
-
- v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * mb->get_factor() / 8);
- }
- }
-
- if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
-
- if (mb->get_command()) {
-
- zoom->set_value(zoom->get_value() - zoom->get_step());
- } else {
-
- v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb->get_factor() / 8);
- }
- }
-
- if (mb->get_button_index() == BUTTON_WHEEL_RIGHT && mb->is_pressed()) {
-
- h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb->get_factor() / 8);
- }
-
- if (mb->get_button_index() == BUTTON_WHEEL_LEFT && mb->is_pressed()) {
-
- v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb->get_factor() / 8);
- }
-
- if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
-
- Point2 mpos = mb->get_position() - ofs;
-
- if (selection.size() == 0) {
- // Auto-select on right-click if nothing is selected
- // Note: This code is pretty much duplicated from the left click code,
- // both codes could be moved into a function to avoid the duplicated code.
- Point2 mpos = mb->get_position() - ofs;
-
- if (mpos.y < h) {
- return;
- }
-
- mpos.y -= h;
-
- int idx = mpos.y / h;
- idx += v_scroll->get_value();
- if (idx < 0 || idx >= animation->get_track_count())
- return;
-
- if (mpos.x < name_limit) {
- } else if (mpos.x < settings_limit) {
- float pos = mpos.x - name_limit;
- pos /= _get_zoom_scale();
- pos += h_scroll->get_value();
- float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
-
- int kidx = animation->track_find_key(idx, pos);
- int kidx_n = kidx + 1;
- int key = -1;
-
- if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
-
- float kpos = animation->track_get_key_time(idx, kidx);
- if (ABS(pos - kpos) <= w_time) {
-
- key = kidx;
- }
- }
-
- if (key == -1 && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
-
- float kpos = animation->track_get_key_time(idx, kidx_n);
- if (ABS(pos - kpos) <= w_time) {
-
- key = kidx_n;
- }
- }
-
- if (key == -1) {
-
- click.click = ClickOver::CLICK_SELECT_KEYS;
- click.at = mb->get_position();
- click.to = click.at;
- click.shift = mb->get_shift();
- selected_track = idx;
- track_editor->update();
- //drag select region
- return;
- }
-
- SelectedKey sk;
- sk.track = idx;
- sk.key = key;
- KeyInfo ki;
- ki.pos = animation->track_get_key_time(idx, key);
- click.shift = mb->get_shift();
- click.selk = sk;
-
- if (!mb->get_shift() && !selection.has(sk))
- _clear_selection();
-
- selection.insert(sk, ki);
-
- click.click = ClickOver::CLICK_MOVE_KEYS;
- click.at = mb->get_position();
- click.to = click.at;
- update();
- selected_track = idx;
- track_editor->update();
-
- if (_edit_if_single_selection() && mb->get_command()) {
- edit_button->set_pressed(true);
- key_editor_tab->show();
- }
- }
- }
-
- if (selection.size()) {
- // User has right clicked and we have a selection, show a popup menu with options
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- track_menu->add_item(TTR("Duplicate Selection"), RIGHT_MENU_DUPLICATE);
- track_menu->add_item(TTR("Duplicate Transposed"), RIGHT_MENU_DUPLICATE_TRANSPOSE);
- track_menu->add_item(TTR("Remove Selection"), RIGHT_MENU_REMOVE);
-
- track_menu->set_position(te->get_global_position() + mpos);
-
- interp_editing = -1;
- cont_editing = -1;
- wrap_editing = -1;
-
- track_menu->popup();
- }
- }
-
- if (mb->get_button_index() == BUTTON_LEFT && !(mb->get_button_mask() & ~BUTTON_MASK_LEFT)) {
-
- if (mb->is_pressed()) {
-
- Point2 mpos = mb->get_position() - ofs;
-
- if (mpos.y < h) {
-
- if (mpos.x < name_limit && mpos.x > (name_limit - hsep - hsize_icon->get_width())) {
-
- click.click = ClickOver::CLICK_RESIZE_NAMES;
- click.at = mb->get_position();
- click.to = click.at;
- click.at.y = name_limit;
- }
-
- if (mpos.x >= name_limit && mpos.x < settings_limit) {
- //seek
- //int zoomw = settings_limit-name_limit;
- float scale = _get_zoom_scale();
- float pos = h_scroll->get_value() + (mpos.x - name_limit) / scale;
- if (animation->get_step())
- pos = Math::stepify(pos, animation->get_step());
-
- if (pos < 0)
- pos = 0;
- if (pos >= animation->get_length())
- pos = animation->get_length();
- timeline_pos = pos;
- click.click = ClickOver::CLICK_DRAG_TIMELINE;
- click.at = mb->get_position();
- click.to = click.at;
- emit_signal("timeline_changed", pos, false);
- }
-
- return;
- }
-
- mpos.y -= h;
-
- int idx = mpos.y / h;
- idx += v_scroll->get_value();
- if (idx < 0)
- return;
-
- if (idx >= animation->get_track_count()) {
-
- if (mpos.x >= name_limit && mpos.x < settings_limit) {
-
- click.click = ClickOver::CLICK_SELECT_KEYS;
- click.at = mb->get_position();
- click.to = click.at;
- //drag select region
- }
-
- return;
- }
-
- if (mpos.x < left_check_ofs) {
- // Checkbox on the very left to enable/disable tracks.
-
- animation->track_set_enabled(idx, !animation->track_is_enabled(idx));
-
- } else if (mpos.x < name_limit - (type_icon[0]->get_width() / 2.0)) {
- //name column
-
- // area
- if (idx != selected_track) {
-
- selected_track = idx;
- track_editor->update();
- return;
- }
-
- Rect2 area(ofs.x + left_check_ofs + sep, ofs.y + ((int(mpos.y) / h) + 1) * h, name_limit - left_check_ofs - sep, h);
- track_name->set_text(animation->track_get_path(idx));
- track_name->set_position(te->get_global_position() + area.position);
- track_name->set_size(area.size);
- track_name->show_modal();
- track_name->grab_focus();
- track_name->select_all();
- track_name_editing = idx;
-
- } else if (mpos.x < settings_limit) {
-
- float pos = mpos.x - name_limit;
- pos /= _get_zoom_scale();
- pos += h_scroll->get_value();
- float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
-
- int kidx = animation->track_find_key(idx, pos);
- int kidx_n = kidx + 1;
- int key = -1;
-
- if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
-
- float kpos = animation->track_get_key_time(idx, kidx);
- if (ABS(pos - kpos) <= w_time) {
-
- key = kidx;
- }
- }
-
- if (key == -1 && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
-
- float kpos = animation->track_get_key_time(idx, kidx_n);
- if (ABS(pos - kpos) <= w_time) {
-
- key = kidx_n;
- }
- }
-
- if (key == -1) {
-
- click.click = ClickOver::CLICK_SELECT_KEYS;
- click.at = mb->get_position();
- click.to = click.at;
- click.shift = mb->get_shift();
- selected_track = idx;
- track_editor->update();
- //drag select region
- return;
- }
-
- SelectedKey sk;
- sk.track = idx;
- sk.key = key;
- KeyInfo ki;
- ki.pos = animation->track_get_key_time(idx, key);
- click.shift = mb->get_shift();
- click.selk = sk;
-
- if (!mb->get_shift() && !selection.has(sk))
- _clear_selection();
-
- selection.insert(sk, ki);
-
- click.click = ClickOver::CLICK_MOVE_KEYS;
- click.at = mb->get_position();
- click.to = click.at;
- update();
- selected_track = idx;
- track_editor->update();
-
- if (_edit_if_single_selection() && mb->get_command()) {
- edit_button->set_pressed(true);
- key_editor_tab->show();
- }
- } else {
- //button column
- int ofsx = size.width - mpos.x;
- if (ofsx < 0)
- return;
- /*
- if (ofsx < remove_icon->get_width()) {
-
- undo_redo->create_action("Remove Anim Track");
- undo_redo->add_do_method(animation.ptr(),"remove_track",idx);
- undo_redo->add_undo_method(animation.ptr(),"add_track",animation->track_get_type(idx),idx);
- undo_redo->add_undo_method(animation.ptr(),"track_set_path",idx,animation->track_get_path(idx));
- //todo interpolation
- for(int i=0;i<animation->track_get_key_count(idx);i++) {
-
- Variant v = animation->track_get_key_value(idx,i);
- float time = animation->track_get_key_time(idx,i);
- float trans = animation->track_get_key_transition(idx,i);
-
- undo_redo->add_undo_method(animation.ptr(),"track_insert_key",idx,time,v);
- undo_redo->add_undo_method(animation.ptr(),"track_set_key_transition",idx,i,trans);
-
- }
-
- undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_type",idx,animation->track_get_interpolation_type(idx));
- if (animation->track_get_type(idx)==Animation::TYPE_VALUE) {
- undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",idx,animation->value_track_is_continuous(idx));
-
- }
-
- undo_redo->commit_action();
-
-
- return;
- }
-
- ofsx-=hsep+remove_icon->get_width();
-
- if (ofsx < move_down_icon->get_width()) {
-
- if (idx < animation->get_track_count() -1) {
- undo_redo->create_action("Move Anim Track Down");
- undo_redo->add_do_method(animation.ptr(),"track_move_up",idx);
- undo_redo->add_undo_method(animation.ptr(),"track_move_down",idx+1);
- undo_redo->commit_action();
- }
- return;
- }
-
- ofsx-=hsep+move_down_icon->get_width();
-
- if (ofsx < move_up_icon->get_width()) {
-
- if (idx >0) {
- undo_redo->create_action("Move Anim Track Up");
- undo_redo->add_do_method(animation.ptr(),"track_move_down",idx);
- undo_redo->add_undo_method(animation.ptr(),"track_move_up",idx-1);
- undo_redo->commit_action();
- }
- return;
- }
-
-
- ofsx-=hsep*3+move_up_icon->get_width();
- */
-
- if (ofsx < track_ofs[1]) {
-
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- static const char *interp_name[2] = { "Clamp Loop Interp", "Wrap Loop Interp" };
- for (int i = 0; i < 2; i++) {
- track_menu->add_icon_item(wrap_icon[i], interp_name[i]);
- }
-
- int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
- int popup_x = size.width - track_ofs[1];
-
- track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
-
- wrap_editing = idx;
- interp_editing = -1;
- cont_editing = -1;
-
- track_menu->popup();
-
- return;
- }
-
- if (ofsx < track_ofs[2]) {
-
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- static const char *interp_name[3] = { "Nearest", "Linear", "Cubic" };
- for (int i = 0; i < 3; i++) {
- track_menu->add_icon_item(interp_icon[i], interp_name[i]);
- }
-
- int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
- int popup_x = size.width - track_ofs[2];
-
- track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
-
- interp_editing = idx;
- cont_editing = -1;
- wrap_editing = -1;
-
- track_menu->popup();
-
- return;
- }
-
- if (ofsx < track_ofs[3]) {
-
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- String cont_name[3] = { TTR("Continuous"), TTR("Discrete"), TTR("Trigger") };
- for (int i = 0; i < 3; i++) {
- track_menu->add_icon_item(cont_icon[i], cont_name[i]);
- }
-
- int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
- int popup_x = size.width - track_ofs[3];
-
- track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
-
- interp_editing = -1;
- wrap_editing = -1;
- cont_editing = idx;
-
- track_menu->popup();
-
- return;
- }
-
- if (ofsx < track_ofs[4]) {
-
- Animation::TrackType tt = animation->track_get_type(idx);
-
- float pos = timeline_pos;
- int existing = animation->track_find_key(idx, pos, true);
-
- Variant newval;
-
- if (tt == Animation::TYPE_TRANSFORM) {
- Dictionary d;
- d["location"] = Vector3();
- d["rotation"] = Quat();
- d["scale"] = Vector3();
- newval = d;
-
- } else if (tt == Animation::TYPE_METHOD) {
-
- Dictionary d;
- d["method"] = "";
- d["args"] = Vector<Variant>();
-
- newval = d;
- } else if (tt == Animation::TYPE_VALUE) {
-
- NodePath np;
- PropertyInfo inf = _find_hint_for_track(idx, np);
- if (inf.type != Variant::NIL) {
-
- Variant::CallError err;
- newval = Variant::construct(inf.type, NULL, 0, err);
- }
-
- if (newval.get_type() == Variant::NIL) {
- //popup a new type
- cvi_track = idx;
- cvi_pos = pos;
-
- type_menu->set_position(get_global_position() + mpos + ofs);
- type_menu->popup();
- return;
- }
- }
-
- undo_redo->create_action(TTR("Anim Add Key"));
-
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", idx, pos, newval, 1);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", idx, pos);
-
- if (existing != -1) {
- Variant v = animation->track_get_key_value(idx, existing);
- float trans = animation->track_get_key_transition(idx, existing);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", idx, pos, v, trans);
- }
-
- undo_redo->commit_action();
-
- return;
- }
- }
-
- } else {
-
- switch (click.click) {
- case ClickOver::CLICK_SELECT_KEYS: {
-
- float zoom_scale = _get_zoom_scale();
- float keys_from = h_scroll->get_value();
- float keys_to = keys_from + (settings_limit - name_limit) / zoom_scale;
-
- float from_time = keys_from + (click.at.x - (name_limit + ofs.x)) / zoom_scale;
- float to_time = keys_from + (click.to.x - (name_limit + ofs.x)) / zoom_scale;
-
- if (to_time < from_time)
- SWAP(from_time, to_time);
-
- if (from_time > keys_to || to_time < keys_from)
- break;
-
- if (from_time < keys_from)
- from_time = keys_from;
-
- if (to_time >= keys_to)
- to_time = keys_to;
-
- int from_track = int(click.at.y - ofs.y - h - sep) / h + v_scroll->get_value();
- int to_track = int(click.to.y - ofs.y - h - sep) / h + v_scroll->get_value();
- int from_mod = int(click.at.y - ofs.y - sep) % h;
- int to_mod = int(click.to.y - ofs.y - sep) % h;
-
- if (to_track < from_track) {
-
- SWAP(from_track, to_track);
- SWAP(from_mod, to_mod);
- }
-
- if ((from_mod > (h / 2)) && ((click.at.y - ofs.y) >= (h + sep))) {
- from_track++;
- }
-
- if (to_mod < h / 2) {
- to_track--;
- }
-
- if (from_track > to_track) {
- if (!click.shift)
- _clear_selection();
- _edit_if_single_selection();
- break;
- }
-
- int tracks_from = v_scroll->get_value();
- int tracks_to = v_scroll->get_value() + fit - 1;
- if (tracks_to >= animation->get_track_count())
- tracks_to = animation->get_track_count() - 1;
-
- tracks_from = 0;
- tracks_to = animation->get_track_count() - 1;
- if (to_track > tracks_to)
- to_track = tracks_to;
- if (from_track < tracks_from)
- from_track = tracks_from;
-
- if (from_track > tracks_to || to_track < tracks_from) {
- if (!click.shift)
- _clear_selection();
- _edit_if_single_selection();
- break;
- }
-
- if (!click.shift)
- _clear_selection();
-
- int higher_track = 0x7FFFFFFF;
- for (int i = from_track; i <= to_track; i++) {
-
- int kc = animation->track_get_key_count(i);
- for (int j = 0; j < kc; j++) {
-
- float t = animation->track_get_key_time(i, j);
- if (t < from_time)
- continue;
- if (t > to_time)
- break;
-
- if (i < higher_track)
- higher_track = i;
-
- SelectedKey sk;
- sk.track = i;
- sk.key = j;
- KeyInfo ki;
- ki.pos = t;
- selection[sk] = ki;
- }
- }
-
- if (higher_track != 0x7FFFFFFF) {
- selected_track = higher_track;
- track_editor->update();
- }
-
- _edit_if_single_selection();
-
- } break;
- case ClickOver::CLICK_MOVE_KEYS: {
-
- if (selection.empty())
- break;
- if (click.at == click.to) {
-
- if (!click.shift) {
-
- KeyInfo ki = selection[click.selk];
- _clear_selection();
- selection[click.selk] = ki;
- _edit_if_single_selection();
- }
-
- break;
- }
-
- float from_t = 1e20;
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
- float t = animation->track_get_key_time(E->key().track, E->key().key);
- if (t < from_t)
- from_t = t;
- }
-
- float motion = from_t + (click.to.x - click.at.x) / _get_zoom_scale();
- if (step->get_value())
- motion = Math::stepify(motion, step->get_value());
-
- undo_redo->create_action(TTR("Anim Move Keys"));
-
- List<_AnimMoveRestore> to_restore;
-
- // 1-remove the keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
- }
- // 2- remove overlapped keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float newtime = E->get().pos - from_t + motion;
- int idx = animation->track_find_key(E->key().track, newtime, true);
- if (idx == -1)
- continue;
- SelectedKey sk;
- sk.key = idx;
- sk.track = E->key().track;
- if (selection.has(sk))
- continue; //already in selection, don't save
-
- undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newtime);
- _AnimMoveRestore amr;
-
- amr.key = animation->track_get_key_value(E->key().track, idx);
- amr.track = E->key().track;
- amr.time = newtime;
- amr.transition = animation->track_get_key_transition(E->key().track, idx);
-
- to_restore.push_back(amr);
- }
-
- // 3-move the keys (re insert them)
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float newpos = E->get().pos - from_t + motion;
- /*
- if (newpos<0)
- continue; //no add at the beginning
- */
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
-
- // 4-(undo) remove inserted keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float newpos = E->get().pos + -from_t + motion;
- /*
- if (newpos<0)
- continue; //no remove what no inserted
- */
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
- }
-
- // 5-(undo) reinsert keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
-
- // 6-(undo) reinsert overlapped keys
- for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
-
- _AnimMoveRestore &amr = E->get();
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
- }
-
- // 6-(undo) reinsert overlapped keys
- for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
-
- _AnimMoveRestore &amr = E->get();
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
- }
-
- undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
-
- // 7-reselect
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float oldpos = E->get().pos;
- float newpos = oldpos - from_t + motion;
- //if (newpos>=0)
- undo_redo->add_do_method(this, "_select_at_anim", animation, E->key().track, newpos);
- undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, oldpos);
- }
-
- undo_redo->commit_action();
- _edit_if_single_selection();
-
- } break;
- default: {}
- }
-
- //button released
- click.click = ClickOver::CLICK_NONE;
- track_editor->update();
- }
- }
- }
-
- Ref<InputEventMouseMotion> mm = p_input;
-
- if (mm.is_valid()) {
-
- mouse_over.over = MouseOver::OVER_NONE;
- mouse_over.track = -1;
- te->update();
- track_editor->set_tooltip("");
-
- if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
- track_editor->call_deferred("grab_focus");
-
- if (click.click != ClickOver::CLICK_NONE) {
-
- switch (click.click) {
- case ClickOver::CLICK_RESIZE_NAMES: {
-
- float base = click.at.y;
- float clickp = click.at.x - ofs.x;
- float dif = base - clickp;
-
- float target = mm->get_position().x + dif - ofs.x;
-
- float ratio = target / settings_limit;
-
- if (ratio > 0.9)
- ratio = 0.9;
- else if (ratio < 0.2)
- ratio = 0.2;
-
- name_column_ratio = ratio;
-
- } break;
- case ClickOver::CLICK_DRAG_TIMELINE: {
-
- Point2 mpos = mm->get_position() - ofs;
- /*
- if (mpos.x<name_limit)
- mpos.x=name_limit;
- if (mpos.x>settings_limit)
- mpos.x=settings_limit;
- */
-
- //int zoomw = settings_limit-name_limit;
- float scale = _get_zoom_scale();
- float pos = h_scroll->get_value() + (mpos.x - name_limit) / scale;
- if (animation->get_step()) {
- pos = Math::stepify(pos, animation->get_step());
- }
- if (pos < 0)
- pos = 0;
- if (pos >= animation->get_length())
- pos = animation->get_length();
-
- if (pos < h_scroll->get_value()) {
- h_scroll->set_value(pos);
- } else if (pos > h_scroll->get_value() + (settings_limit - name_limit) / scale) {
- h_scroll->set_value(pos - (settings_limit - name_limit) / scale);
- }
-
- timeline_pos = pos;
- emit_signal("timeline_changed", pos, true);
-
- } break;
- case ClickOver::CLICK_SELECT_KEYS: {
-
- click.to = mm->get_position();
- if (click.to.y < h && click.at.y > h && mm->get_relative().y < 0) {
-
- float prev = v_scroll->get_value();
- v_scroll->set_value(v_scroll->get_value() - 1);
- if (prev != v_scroll->get_value())
- click.at.y += h;
- }
- if (click.to.y > size.height && click.at.y < size.height && mm->get_relative().y > 0) {
-
- float prev = v_scroll->get_value();
- v_scroll->set_value(v_scroll->get_value() + 1);
- if (prev != v_scroll->get_value())
- click.at.y -= h;
- }
-
- } break;
- case ClickOver::CLICK_MOVE_KEYS: {
-
- click.to = mm->get_position();
- } break;
- default: {}
- }
-
- return;
- } else if (mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
-
- int rel = mm->get_relative().x;
- float relf = rel / _get_zoom_scale();
- h_scroll->set_value(h_scroll->get_value() - relf);
- }
-
- if (mm->get_button_mask() == 0) {
-
- Point2 mpos = mm->get_position() - ofs;
-
- if (mpos.y < h) {
- return;
- }
-
- mpos.y -= h;
-
- int idx = mpos.y / h;
- idx += v_scroll->get_value();
- if (idx < 0 || idx >= animation->get_track_count())
- return;
-
- mouse_over.track = idx;
-
- if (mpos.x < name_limit) {
- //name column
-
- mouse_over.over = MouseOver::OVER_NAME;
-
- } else if (mpos.x < settings_limit) {
-
- float pos = mpos.x - name_limit;
- pos /= _get_zoom_scale();
- pos += h_scroll->get_value();
- float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
-
- int kidx = animation->track_find_key(idx, pos);
- int kidx_n = kidx + 1;
-
- bool found = false;
-
- if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
-
- float kpos = animation->track_get_key_time(idx, kidx);
- if (ABS(pos - kpos) <= w_time) {
-
- mouse_over.over = MouseOver::OVER_KEY;
- mouse_over.track = idx;
- mouse_over.over_key = kidx;
- found = true;
- }
- }
-
- if (!found && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
-
- float kpos = animation->track_get_key_time(idx, kidx_n);
- if (ABS(pos - kpos) <= w_time) {
-
- mouse_over.over = MouseOver::OVER_KEY;
- mouse_over.track = idx;
- mouse_over.over_key = kidx_n;
- found = true;
- }
- }
-
- if (found) {
-
- String text;
- text = "time: " + rtos(animation->track_get_key_time(idx, mouse_over.over_key)) + "\n";
-
- switch (animation->track_get_type(idx)) {
-
- case Animation::TYPE_TRANSFORM: {
-
- Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
- if (d.has("location"))
- text += "location: " + String(d["location"]) + "\n";
- if (d.has("rotation"))
- text += "rot: " + String(d["rotation"]) + "\n";
- if (d.has("scale"))
- text += "scale: " + String(d["scale"]) + "\n";
- } break;
- case Animation::TYPE_VALUE: {
-
- Variant v = animation->track_get_key_value(idx, mouse_over.over_key);
- //text+="value: "+String(v)+"\n";
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Vector<StringName> leftover_path;
- Node *node = root->get_node_and_resource(animation->track_get_path(idx), res, leftover_path);
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj) {
- valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
- }
-
- text += "type: " + Variant::get_type_name(v.get_type()) + "\n";
- if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
- text += "value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
- } else {
- text += "value: " + String(v) + "\n";
- }
-
- } break;
- case Animation::TYPE_METHOD: {
-
- Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
- if (d.has("method"))
- text += String(d["method"]);
- text += "(";
- Vector<Variant> args;
- if (d.has("args"))
- args = d["args"];
- for (int i = 0; i < args.size(); i++) {
-
- if (i > 0)
- text += ", ";
- text += String(args[i]);
- }
- text += ")\n";
-
- } break;
- }
- text += "easing: " + rtos(animation->track_get_key_transition(idx, mouse_over.over_key));
-
- track_editor->set_tooltip(text);
- return;
- }
-
- } else {
- //button column
- int ofsx = size.width - mpos.x;
- if (ofsx < 0)
- return;
- /*
- if (ofsx < remove_icon->get_width()) {
-
- mouse_over.over=MouseOver::OVER_REMOVE;
-
- return;
- }
-
- ofsx-=hsep+remove_icon->get_width();
-
- if (ofsx < move_down_icon->get_width()) {
-
- mouse_over.over=MouseOver::OVER_DOWN;
- return;
- }
-
- ofsx-=hsep+move_down_icon->get_width();
-
- if (ofsx < move_up_icon->get_width()) {
-
- mouse_over.over=MouseOver::OVER_UP;
- return;
- }
-
- ofsx-=hsep*3+move_up_icon->get_width();
-
-*/
-
- if (ofsx < down_icon->get_width() + wrap_icon[0]->get_width() + hsep * 3) {
-
- mouse_over.over = MouseOver::OVER_WRAP;
- return;
- }
-
- ofsx -= hsep * 3 + wrap_icon[0]->get_width() + down_icon->get_width();
-
- if (ofsx < down_icon->get_width() + interp_icon[0]->get_width() + hsep * 3) {
-
- mouse_over.over = MouseOver::OVER_INTERP;
- return;
- }
-
- ofsx -= hsep * 2 + interp_icon[0]->get_width() + down_icon->get_width();
-
- if (ofsx < down_icon->get_width() + cont_icon[0]->get_width() + hsep * 3) {
-
- mouse_over.over = MouseOver::OVER_VALUE;
- return;
- }
-
- ofsx -= hsep * 3 + cont_icon[0]->get_width() + down_icon->get_width();
-
- if (ofsx < add_key_icon->get_width()) {
-
- mouse_over.over = MouseOver::OVER_ADD_KEY;
- return;
- }
- }
- }
- }
-
- Ref<InputEventMagnifyGesture> magnify_gesture = p_input;
- if (magnify_gesture.is_valid()) {
- zoom->set_value(zoom->get_value() * magnify_gesture->get_factor());
- }
-
- Ref<InputEventPanGesture> pan_gesture = p_input;
- 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 AnimationKeyEditor::_notification(int p_what) {
-
- switch (p_what) {
- case NOTIFICATION_VISIBILITY_CHANGED: {
-
- EditorNode::get_singleton()->update_keying();
- emit_signal("keying_changed");
- } break;
-
- case NOTIFICATION_ENTER_TREE: {
-
- key_editor->edit(key_edit);
-
- zoomicon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
- zoomicon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
-
- menu_track->set_icon(get_icon("Tools", "EditorIcons"));
- menu_track->get_popup()->add_item(TTR("Scale Selection"), TRACK_MENU_SCALE);
- menu_track->get_popup()->add_item(TTR("Scale From Cursor"), TRACK_MENU_SCALE_PIVOT);
- menu_track->get_popup()->add_separator();
- menu_track->get_popup()->add_item(TTR("Duplicate Selection"), TRACK_MENU_DUPLICATE);
- menu_track->get_popup()->add_item(TTR("Duplicate Transposed"), TRACK_MENU_DUPLICATE_TRANSPOSE);
- menu_track->get_popup()->add_separator();
- menu_track->get_popup()->add_item(TTR("Goto Next Step"), TRACK_MENU_NEXT_STEP, KEY_MASK_CMD | KEY_RIGHT);
- menu_track->get_popup()->add_item(TTR("Goto Prev Step"), TRACK_MENU_PREV_STEP, KEY_MASK_CMD | KEY_LEFT);
- menu_track->get_popup()->add_separator();
- PopupMenu *tpp = memnew(PopupMenu);
- tpp->add_item(TTR("Linear"), TRACK_MENU_SET_ALL_TRANS_LINEAR);
- tpp->add_item(TTR("Constant"), TRACK_MENU_SET_ALL_TRANS_CONSTANT);
- tpp->add_item(TTR("In"), TRACK_MENU_SET_ALL_TRANS_IN);
- tpp->add_item(TTR("Out"), TRACK_MENU_SET_ALL_TRANS_OUT);
- tpp->add_item(TTR("In-Out"), TRACK_MENU_SET_ALL_TRANS_INOUT);
- tpp->add_item(TTR("Out-In"), TRACK_MENU_SET_ALL_TRANS_OUTIN);
- tpp->set_name(TTR("Transitions"));
- tpp->connect("id_pressed", this, "_menu_track");
- optimize_dialog->connect("confirmed", this, "_animation_optimize");
-
- menu_track->get_popup()->add_child(tpp);
-
- menu_track->get_popup()->add_item(TTR("Optimize Animation"), TRACK_MENU_OPTIMIZE);
- menu_track->get_popup()->add_item(TTR("Clean-Up Animation"), TRACK_MENU_CLEAN_UP);
-
- curve_linear->connect("pressed", this, "_menu_track", varray(CURVE_SET_LINEAR));
- curve_in->connect("pressed", this, "_menu_track", varray(CURVE_SET_IN));
- curve_out->connect("pressed", this, "_menu_track", varray(CURVE_SET_OUT));
- curve_inout->connect("pressed", this, "_menu_track", varray(CURVE_SET_INOUT));
- curve_outin->connect("pressed", this, "_menu_track", varray(CURVE_SET_OUTIN));
- curve_constant->connect("pressed", this, "_menu_track", varray(CURVE_SET_CONSTANT));
-
- edit_button->connect("pressed", this, "_toggle_edit_curves");
-
- curve_edit->connect("transition_changed", this, "_curve_transition_changed");
- call_select->connect("selected", this, "_add_call_track");
-
- _update_menu();
-
- } break;
-
- case NOTIFICATION_THEME_CHANGED: {
- zoomicon->set_texture(get_icon("Zoom", "EditorIcons"));
-
- menu_add_track->set_icon(get_icon("Add", "EditorIcons"));
-
- menu_track->set_icon(get_icon("Tools", "EditorIcons"));
-
- menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_VALUE_TRACK, get_icon("KeyValue", "EditorIcons"));
- menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_TRANSFORM_TRACK, get_icon("KeyXform", "EditorIcons"));
- menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_CALL_TRACK, get_icon("KeyCall", "EditorIcons"));
-
- curve_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
- curve_in->set_icon(get_icon("CurveIn", "EditorIcons"));
- curve_out->set_icon(get_icon("CurveOut", "EditorIcons"));
- curve_inout->set_icon(get_icon("CurveInOut", "EditorIcons"));
- curve_outin->set_icon(get_icon("CurveOutIn", "EditorIcons"));
- curve_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
-
- move_up_button->set_icon(get_icon("MoveUp", "EditorIcons"));
- move_down_button->set_icon(get_icon("MoveDown", "EditorIcons"));
- remove_button->set_icon(get_icon("Remove", "EditorIcons"));
- edit_button->set_icon(get_icon("EditKey", "EditorIcons"));
-
- loop->set_icon(get_icon("Loop", "EditorIcons"));
-
- {
-
- right_data_size_cache = 0;
- int hsep = get_constant("hseparation", "Tree");
- Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons");
- Ref<Texture> move_up_icon = get_icon("MoveUp", "EditorIcons");
- Ref<Texture> move_down_icon = get_icon("MoveDown", "EditorIcons");
- Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
- Ref<Texture> add_key_icon = get_icon("TrackAddKey", "EditorIcons");
- Ref<Texture> interp_icon[3] = {
- get_icon("InterpRaw", "EditorIcons"),
- get_icon("InterpLinear", "EditorIcons"),
- get_icon("InterpCubic", "EditorIcons")
- };
- Ref<Texture> cont_icon[3] = {
- get_icon("TrackContinuous", "EditorIcons"),
- get_icon("TrackDiscrete", "EditorIcons"),
- get_icon("TrackTrigger", "EditorIcons")
- };
-
- Ref<Texture> wrap_icon[2] = {
- get_icon("InterpWrapClamp", "EditorIcons"),
- get_icon("InterpWrapLoop", "EditorIcons"),
- };
- right_data_size_cache = down_icon->get_width() * 3 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + wrap_icon[0]->get_width() + hsep * 9;
- }
- } break;
- }
-}
-
-void AnimationKeyEditor::_scroll_changed(double) {
-
- if (te_drawing)
- return;
-
- track_editor->update();
-}
-
-void AnimationKeyEditor::_update_paths() {
-
- if (animation.is_valid()) {
- //timeline->set_max(animation->get_length());
- //timeline->set_step(0.01);
- track_editor->update();
- length->set_value(animation->get_length());
- step->set_value(animation->get_step());
- }
-}
-
-void AnimationKeyEditor::_root_removed() {
-
- root = NULL;
-}
-
-void AnimationKeyEditor::_update_menu() {
-
- updating = true;
-
- if (animation.is_valid()) {
-
- length->set_value(animation->get_length());
- loop->set_pressed(animation->has_loop());
- step->set_value(animation->get_step());
- }
-
- track_editor->update();
- updating = false;
-}
-void AnimationKeyEditor::_clear_selection() {
-
- selection.clear();
- key_edit->animation = Ref<Animation>();
- key_edit->track = 0;
- key_edit->key_ofs = 0;
- key_edit->hint = PropertyInfo();
- key_edit->base = NodePath();
- key_edit->notify_change();
-}
-
-void AnimationKeyEditor::set_animation(const Ref<Animation> &p_anim) {
-
- if (animation.is_valid())
- animation->disconnect("changed", this, "_update_paths");
- animation = p_anim;
- if (animation.is_valid())
- animation->connect("changed", this, "_update_paths");
-
- timeline_pos = 0;
- _clear_selection();
- _update_paths();
-
- _update_menu();
- selected_track = -1;
- _edit_if_single_selection();
-
- EditorNode::get_singleton()->update_keying();
-}
-
-void AnimationKeyEditor::set_root(Node *p_root) {
-
- if (root)
- root->disconnect("tree_exiting", this, "_root_removed");
-
- root = p_root;
-
- if (root)
- root->connect("tree_exiting", this, "_root_removed", make_binds(), CONNECT_ONESHOT);
-}
-
-Node *AnimationKeyEditor::get_root() const {
-
- return root;
-}
-
-void AnimationKeyEditor::update_keying() {
-
- bool keying_enabled = is_visible_in_tree() && animation.is_valid();
-
- if (keying_enabled == keying)
- return;
-
- keying = keying_enabled;
- _update_menu();
- emit_signal("keying_changed");
-}
-
-bool AnimationKeyEditor::has_keying() const {
-
- return keying;
-}
-
-void AnimationKeyEditor::_query_insert(const InsertData &p_id) {
-
- if (insert_frame != Engine::get_singleton()->get_frames_drawn()) {
- //clear insert list for the frame if frame changed
- if (insert_confirm->is_visible_in_tree())
- return; //do nothing
- insert_data.clear();
- insert_query = false;
- }
- insert_frame = Engine::get_singleton()->get_frames_drawn();
-
- for (List<InsertData>::Element *E = insert_data.front(); E; E = E->next()) {
- //prevent insertion of multiple tracks
- if (E->get().path == p_id.path)
- return; //already inserted a track for this on this frame
- }
-
- insert_data.push_back(p_id);
-
- if (p_id.track_idx == -1) {
- if (bool(EDITOR_DEF("editors/animation/confirm_insert_track", true))) {
- //potential new key, does not exist
- if (insert_data.size() == 1)
- insert_confirm->set_text(vformat(TTR("Create NEW track for %s and insert key?"), p_id.query));
- else
- insert_confirm->set_text(vformat(TTR("Create %d NEW tracks and insert keys?"), insert_data.size()));
-
- insert_confirm->get_ok()->set_text(TTR("Create"));
- insert_confirm->popup_centered_minsize();
- insert_query = true;
- } else {
- call_deferred("_insert_delay");
- insert_queue = true;
- }
-
- } else {
- if (!insert_query && !insert_queue) {
- call_deferred("_insert_delay");
- insert_queue = true;
- }
- }
-}
-
-void AnimationKeyEditor::insert_transform_key(Spatial *p_node, const String &p_sub, const Transform &p_xform) {
-
- if (!keying)
- return;
- if (!animation.is_valid())
- return;
-
- ERR_FAIL_COND(!root);
- //let's build a node path
- String path = root->get_path_to(p_node);
- if (p_sub != "")
- path += ":" + p_sub;
-
- NodePath np = path;
-
- int track_idx = -1;
-
- for (int i = 0; i < animation->get_track_count(); i++) {
-
- if (animation->track_get_type(i) != Animation::TYPE_TRANSFORM)
- continue;
- if (animation->track_get_path(i) != np)
- continue;
-
- track_idx = i;
- break;
- }
-
- InsertData id;
- Dictionary val;
-
- id.path = np;
- id.track_idx = track_idx;
- id.value = p_xform;
- id.type = Animation::TYPE_TRANSFORM;
- id.query = "node '" + p_node->get_name() + "'";
- id.advance = false;
-
- //dialog insert
-
- _query_insert(id);
-}
-
-void AnimationKeyEditor::insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists) {
-
- ERR_FAIL_COND(!root);
- //let's build a node path
-
- Node *node = p_node;
-
- String path = root->get_path_to(node);
-
- for (int i = 1; i < history->get_path_size(); i++) {
-
- String prop = history->get_path_property(i);
- ERR_FAIL_COND(prop == "");
- path += ":" + prop;
- }
-
- path += ":" + p_property;
-
- NodePath np = path;
-
- //locate track
-
- int track_idx = -1;
-
- for (int i = 0; i < animation->get_track_count(); i++) {
-
- if (animation->track_get_type(i) != Animation::TYPE_VALUE)
- continue;
- if (animation->track_get_path(i) != np)
- continue;
-
- track_idx = i;
- break;
- }
-
- if (p_only_if_exists && track_idx == -1)
- return;
- InsertData id;
- id.path = np;
- id.track_idx = track_idx;
- id.value = p_value;
- id.type = Animation::TYPE_VALUE;
- id.query = "property '" + p_property + "'";
- id.advance = false;
- //dialog insert
- _query_insert(id);
-}
-
-void AnimationKeyEditor::insert_value_key(const String &p_property, const Variant &p_value, bool p_advance) {
-
- ERR_FAIL_COND(!root);
- //let's build a node path
- ERR_FAIL_COND(history->get_path_size() == 0);
- Object *obj = ObjectDB::get_instance(history->get_path_object(0));
- ERR_FAIL_COND(!Object::cast_to<Node>(obj));
-
- Node *node = Object::cast_to<Node>(obj);
-
- String path = root->get_path_to(node);
-
- for (int i = 1; i < history->get_path_size(); i++) {
-
- String prop = history->get_path_property(i);
- ERR_FAIL_COND(prop == "");
- path += ":" + prop;
- }
-
- path += ":" + p_property;
-
- NodePath np = path;
-
- //locate track
-
- int track_idx = -1;
-
- for (int i = 0; i < animation->get_track_count(); i++) {
-
- if (animation->track_get_type(i) != Animation::TYPE_VALUE)
- continue;
- if (animation->track_get_path(i) != np)
- continue;
-
- track_idx = i;
- break;
- }
-
- InsertData id;
- id.path = np;
- id.track_idx = track_idx;
- id.value = p_value;
- id.type = Animation::TYPE_VALUE;
- id.query = "property '" + p_property + "'";
- id.advance = p_advance;
- //dialog insert
- _query_insert(id);
-}
-
-void AnimationKeyEditor::_confirm_insert_list() {
-
- undo_redo->create_action(TTR("Anim Create & Insert"));
-
- int last_track = animation->get_track_count();
- while (insert_data.size()) {
-
- last_track = _confirm_insert(insert_data.front()->get(), last_track);
- insert_data.pop_front();
- }
-
- undo_redo->commit_action();
-}
-
-int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) {
-
- if (p_last_track == -1)
- p_last_track = animation->get_track_count();
-
- bool created = false;
- if (p_id.track_idx < 0) {
-
- created = true;
- undo_redo->create_action(TTR("Anim Insert Track & Key"));
- Animation::UpdateMode update_mode = Animation::UPDATE_DISCRETE;
-
- if (p_id.type == Animation::TYPE_VALUE) {
- //wants a new tack
-
- {
- //hack
- NodePath np;
- animation->add_track(p_id.type);
- animation->track_set_path(animation->get_track_count() - 1, p_id.path);
- PropertyInfo h = _find_hint_for_track(animation->get_track_count() - 1, np);
- animation->remove_track(animation->get_track_count() - 1); //hack
-
- if (h.type == Variant::REAL ||
- h.type == Variant::VECTOR2 ||
- h.type == Variant::RECT2 ||
- h.type == Variant::VECTOR3 ||
- h.type == Variant::AABB ||
- h.type == Variant::QUAT ||
- h.type == Variant::COLOR ||
- h.type == Variant::TRANSFORM) {
-
- update_mode = Animation::UPDATE_CONTINUOUS;
- }
-
- if (h.usage & PROPERTY_USAGE_ANIMATE_AS_TRIGGER) {
- update_mode = Animation::UPDATE_TRIGGER;
- }
- }
- }
-
- p_id.track_idx = p_last_track;
-
- undo_redo->add_do_method(animation.ptr(), "add_track", p_id.type);
- undo_redo->add_do_method(animation.ptr(), "track_set_path", p_id.track_idx, p_id.path);
- if (p_id.type == Animation::TYPE_VALUE)
- undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", p_id.track_idx, update_mode);
-
- } else {
- undo_redo->create_action(TTR("Anim Insert Key"));
- }
-
- float time = timeline_pos;
- Variant value;
-
- switch (p_id.type) {
-
- case Animation::TYPE_VALUE: {
-
- value = p_id.value;
-
- } break;
- case Animation::TYPE_TRANSFORM: {
-
- Transform tr = p_id.value;
- Dictionary d;
- d["location"] = tr.origin;
- d["scale"] = tr.basis.get_scale();
- d["rotation"] = Quat(tr.basis); //.orthonormalized();
- value = d;
- } break;
- default: {}
- }
-
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_id.track_idx, time, value);
-
- if (created) {
-
- //just remove the track
- undo_redo->add_undo_method(animation.ptr(), "remove_track", p_last_track);
- p_last_track++;
- } else {
-
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_id.track_idx, time);
- int existing = animation->track_find_key(p_id.track_idx, time, true);
- if (existing != -1) {
- Variant v = animation->track_get_key_value(p_id.track_idx, existing);
- float trans = animation->track_get_key_transition(p_id.track_idx, existing);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", p_id.track_idx, time, v, trans);
- }
- }
-
- undo_redo->add_do_method(this, "update");
- undo_redo->add_undo_method(this, "update");
- undo_redo->add_do_method(track_editor, "update");
- undo_redo->add_undo_method(track_editor, "update");
- undo_redo->add_do_method(track_pos, "update");
- undo_redo->add_undo_method(track_pos, "update");
-
- undo_redo->commit_action();
-
- return p_last_track;
-}
-
-Ref<Animation> AnimationKeyEditor::get_current_animation() const {
-
- return animation;
-}
-
-void AnimationKeyEditor::_animation_len_changed(float p_len) {
-
- if (updating)
- return;
-
- if (!animation.is_null()) {
-
- undo_redo->create_action(TTR("Change Anim Len"));
- undo_redo->add_do_method(animation.ptr(), "set_length", p_len);
- undo_redo->add_undo_method(animation.ptr(), "set_length", animation->get_length());
- undo_redo->add_do_method(this, "_animation_len_update");
- undo_redo->add_undo_method(this, "_animation_len_update");
- undo_redo->commit_action();
- }
-}
-
-void AnimationKeyEditor::_animation_len_update() {
-
- if (!animation.is_null())
- emit_signal(alc, animation->get_length());
-}
-
-void AnimationKeyEditor::_animation_changed() {
- if (updating)
- return;
- _update_menu();
-}
-
-void AnimationKeyEditor::_animation_loop_changed() {
-
- if (updating)
- return;
-
- if (!animation.is_null()) {
-
- undo_redo->create_action(TTR("Change Anim Loop"));
- undo_redo->add_do_method(animation.ptr(), "set_loop", loop->is_pressed());
- undo_redo->add_undo_method(animation.ptr(), "set_loop", !loop->is_pressed());
- undo_redo->commit_action();
- }
-}
-
-void AnimationKeyEditor::_create_value_item(int p_type) {
-
- undo_redo->create_action(TTR("Anim Create Typed Value Key"));
-
- Variant::CallError ce;
- Variant v = Variant::construct(Variant::Type(p_type), NULL, 0, ce);
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", cvi_track, cvi_pos, v);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", cvi_track, cvi_pos);
-
- int existing = animation->track_find_key(cvi_track, cvi_pos, true);
-
- if (existing != -1) {
- Variant v = animation->track_get_key_value(cvi_track, existing);
- float trans = animation->track_get_key_transition(cvi_track, existing);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", cvi_track, cvi_pos, v, trans);
- }
-
- undo_redo->commit_action();
-}
-
-void AnimationKeyEditor::set_anim_pos(float p_pos) {
-
- if (animation.is_null())
- return;
- timeline_pos = p_pos;
- update();
- track_pos->update();
- track_editor->update();
-}
-
-void AnimationKeyEditor::_pane_drag(const Point2 &p_delta) {
-
- Size2 ecs = ec->get_custom_minimum_size();
- ecs.y -= p_delta.y;
- if (ecs.y < 100)
- ecs.y = 100;
- ec->set_custom_minimum_size(ecs);
-}
-
-void AnimationKeyEditor::_insert_delay() {
-
- if (insert_query) {
- //discard since it's entered into query mode
- insert_queue = false;
- return;
- }
-
- undo_redo->create_action(TTR("Anim Insert"));
-
- int last_track = animation->get_track_count();
- bool advance = false;
- while (insert_data.size()) {
-
- if (insert_data.front()->get().advance)
- advance = true;
- last_track = _confirm_insert(insert_data.front()->get(), last_track);
- insert_data.pop_front();
- }
-
- undo_redo->commit_action();
-
- if (advance) {
- float step = animation->get_step();
- if (step == 0)
- step = 1;
-
- float pos = timeline_pos;
-
- pos = Math::stepify(pos + step, step);
- if (pos > animation->get_length())
- pos = animation->get_length();
- timeline_pos = pos;
- track_pos->update();
- emit_signal("timeline_changed", pos, true);
- }
- insert_queue = false;
-}
-
-void AnimationKeyEditor::_step_changed(float p_len) {
-
- updating = true;
- if (!animation.is_null()) {
- animation->set_step(p_len);
- emit_signal("animation_step_changed", animation->get_step());
- }
- updating = false;
-}
-
-void AnimationKeyEditor::_scale() {
-
- if (selection.empty())
- return;
-
- float from_t = 1e20;
- float to_t = -1e20;
- float len = -1e20;
- float pivot = 0;
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
- float t = animation->track_get_key_time(E->key().track, E->key().key);
- if (t < from_t)
- from_t = t;
- if (t > to_t)
- to_t = t;
- }
-
- len = to_t - from_t;
- if (last_menu_track_opt == TRACK_MENU_SCALE_PIVOT) {
- pivot = timeline_pos;
-
- } else {
-
- pivot = from_t;
- }
-
- float s = scale->get_value();
- if (s == 0) {
- ERR_PRINT("Can't scale to 0");
- }
-
- undo_redo->create_action(TTR("Anim Scale Keys"));
-
- List<_AnimMoveRestore> to_restore;
-
- // 1-remove the keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
- }
- // 2- remove overlapped keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float newtime = (E->get().pos - from_t) * s + from_t;
- int idx = animation->track_find_key(E->key().track, newtime, true);
- if (idx == -1)
- continue;
- SelectedKey sk;
- sk.key = idx;
- sk.track = E->key().track;
- if (selection.has(sk))
- continue; //already in selection, don't save
-
- undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newtime);
- _AnimMoveRestore amr;
-
- amr.key = animation->track_get_key_value(E->key().track, idx);
- amr.track = E->key().track;
- amr.time = newtime;
- amr.transition = animation->track_get_key_transition(E->key().track, idx);
-
- to_restore.push_back(amr);
- }
-
-#define _NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t
- // 3-move the keys (re insert them)
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float newpos = _NEW_POS(E->get().pos);
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
-
- // 4-(undo) remove inserted keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float newpos = _NEW_POS(E->get().pos);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
- }
-
- // 5-(undo) reinsert keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
-
- // 6-(undo) reinsert overlapped keys
- for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
-
- _AnimMoveRestore &amr = E->get();
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
- }
-
- // 6-(undo) reinsert overlapped keys
- for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
-
- _AnimMoveRestore &amr = E->get();
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
- }
-
- undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
-
- // 7-reselect
-
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
-
- float oldpos = E->get().pos;
- float newpos = _NEW_POS(oldpos);
- if (newpos >= 0)
- undo_redo->add_do_method(this, "_select_at_anim", animation, E->key().track, newpos);
- undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, oldpos);
- }
-#undef _NEW_POS
- undo_redo->commit_action();
-}
-
-void AnimationKeyEditor::_add_call_track(const NodePath &p_base) {
-
- Node *base = EditorNode::get_singleton()->get_edited_scene();
- if (!base)
- return;
- Node *from = base->get_node(p_base);
- if (!from || !root)
- return;
-
- NodePath path = root->get_path_to(from);
-
- //print_line("root: "+String(root->get_path()));
- //print_line("path: "+String(path));
-
- undo_redo->create_action(TTR("Anim Add Call Track"));
- undo_redo->add_do_method(animation.ptr(), "add_track", Animation::TYPE_METHOD);
- undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), path);
- undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
- undo_redo->commit_action();
-}
-
-void AnimationKeyEditor::cleanup() {
-
- set_animation(Ref<Animation>());
-}
-
-void AnimationKeyEditor::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("_root_removed"), &AnimationKeyEditor::_root_removed);
- ClassDB::bind_method(D_METHOD("_scale"), &AnimationKeyEditor::_scale);
- ClassDB::bind_method(D_METHOD("set_root"), &AnimationKeyEditor::set_root);
-
- //ClassDB::bind_method(D_METHOD("_confirm_insert"),&AnimationKeyEditor::_confirm_insert);
- ClassDB::bind_method(D_METHOD("_confirm_insert_list"), &AnimationKeyEditor::_confirm_insert_list);
-
- ClassDB::bind_method(D_METHOD("_update_paths"), &AnimationKeyEditor::_update_paths);
- ClassDB::bind_method(D_METHOD("_track_editor_draw"), &AnimationKeyEditor::_track_editor_draw);
-
- ClassDB::bind_method(D_METHOD("_animation_changed"), &AnimationKeyEditor::_animation_changed);
- ClassDB::bind_method(D_METHOD("_scroll_changed"), &AnimationKeyEditor::_scroll_changed);
- ClassDB::bind_method(D_METHOD("_track_editor_gui_input"), &AnimationKeyEditor::_track_editor_gui_input);
- ClassDB::bind_method(D_METHOD("_track_name_changed"), &AnimationKeyEditor::_track_name_changed);
- ClassDB::bind_method(D_METHOD("_track_menu_selected"), &AnimationKeyEditor::_track_menu_selected);
- ClassDB::bind_method(D_METHOD("_menu_add_track"), &AnimationKeyEditor::_menu_add_track);
- ClassDB::bind_method(D_METHOD("_menu_track"), &AnimationKeyEditor::_menu_track);
- ClassDB::bind_method(D_METHOD("_clear_selection_for_anim"), &AnimationKeyEditor::_clear_selection_for_anim);
- ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationKeyEditor::_select_at_anim);
- ClassDB::bind_method(D_METHOD("_track_position_draw"), &AnimationKeyEditor::_track_position_draw);
- ClassDB::bind_method(D_METHOD("_insert_delay"), &AnimationKeyEditor::_insert_delay);
- ClassDB::bind_method(D_METHOD("_step_changed"), &AnimationKeyEditor::_step_changed);
-
- ClassDB::bind_method(D_METHOD("_animation_loop_changed"), &AnimationKeyEditor::_animation_loop_changed);
- ClassDB::bind_method(D_METHOD("_animation_len_changed"), &AnimationKeyEditor::_animation_len_changed);
- ClassDB::bind_method(D_METHOD("_create_value_item"), &AnimationKeyEditor::_create_value_item);
- ClassDB::bind_method(D_METHOD("_pane_drag"), &AnimationKeyEditor::_pane_drag);
-
- ClassDB::bind_method(D_METHOD("_animation_len_update"), &AnimationKeyEditor::_animation_len_update);
-
- ClassDB::bind_method(D_METHOD("set_animation"), &AnimationKeyEditor::set_animation);
- ClassDB::bind_method(D_METHOD("_animation_optimize"), &AnimationKeyEditor::_animation_optimize);
- ClassDB::bind_method(D_METHOD("_curve_transition_changed"), &AnimationKeyEditor::_curve_transition_changed);
- ClassDB::bind_method(D_METHOD("_toggle_edit_curves"), &AnimationKeyEditor::_toggle_edit_curves);
- ClassDB::bind_method(D_METHOD("_add_call_track"), &AnimationKeyEditor::_add_call_track);
-
- ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "res"), PropertyInfo(Variant::STRING, "prop")));
- ADD_SIGNAL(MethodInfo("keying_changed"));
- ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
- ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL, "len")));
- ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL, "step")));
- ADD_SIGNAL(MethodInfo("key_edited", PropertyInfo(Variant::INT, "track"), PropertyInfo(Variant::INT, "key")));
-}
-
-AnimationKeyEditor::AnimationKeyEditor() {
-
- alc = "animation_len_changed";
- editor_selection = EditorNode::get_singleton()->get_editor_selection();
-
- selected_track = -1;
- updating = false;
- te_drawing = false;
- undo_redo = EditorNode::get_singleton()->get_undo_redo();
- history = EditorNode::get_singleton()->get_editor_history();
-
- ec = memnew(Control);
- ec->set_custom_minimum_size(Size2(0, 150) * EDSCALE);
- add_child(ec);
- ec->set_v_size_flags(SIZE_EXPAND_FILL);
-
- h_scroll = memnew(HScrollBar);
- h_scroll->connect("value_changed", this, "_scroll_changed");
- add_child(h_scroll);
- h_scroll->set_value(0);
-
- HBoxContainer *hb = memnew(HBoxContainer);
- add_child(hb);
-
- root = NULL;
- //menu = memnew( MenuButton );
- //menu->set_flat(true);
- //menu->set_position(Point2());
- //add_child(menu);
-
- zoomicon = memnew(TextureRect);
- hb->add_child(zoomicon);
- zoomicon->set_tooltip(TTR("Animation zoom."));
-
- zoom = memnew(HSlider);
- //hb->add_child(zoom);
- zoom->set_step(0.01);
- zoom->set_min(0.0);
- zoom->set_max(2.0);
- zoom->set_value(1.0);
- zoom->set_h_size_flags(SIZE_EXPAND_FILL);
- zoom->set_v_size_flags(SIZE_EXPAND_FILL);
- zoom->set_stretch_ratio(2);
- hb->add_child(zoom);
- zoom->connect("value_changed", this, "_scroll_changed");
- zoom->set_tooltip(TTR("Animation zoom."));
-
- hb->add_child(memnew(VSeparator));
-
- Label *l = memnew(Label);
- l->set_text(TTR("Length (s):"));
- hb->add_child(l);
-
- length = memnew(SpinBox);
- length->set_min(0.01);
- length->set_max(10000);
- length->set_step(0.01);
- length->set_h_size_flags(SIZE_EXPAND_FILL);
- length->set_stretch_ratio(1);
- length->set_tooltip(TTR("Animation length (in seconds)."));
-
- hb->add_child(length);
- length->connect("value_changed", this, "_animation_len_changed");
-
- l = memnew(Label);
- l->set_text(TTR("Step (s):"));
- hb->add_child(l);
-
- step = memnew(SpinBox);
- step->set_min(0.00);
- step->set_max(128);
- step->set_step(0.01);
- step->set_value(0.0);
- step->set_h_size_flags(SIZE_EXPAND_FILL);
- step->set_stretch_ratio(1);
- step->set_tooltip(TTR("Cursor step snap (in seconds)."));
-
- hb->add_child(step);
- step->connect("value_changed", this, "_step_changed");
-
- loop = memnew(ToolButton);
- loop->set_toggle_mode(true);
- loop->connect("pressed", this, "_animation_loop_changed");
- hb->add_child(loop);
- loop->set_tooltip(TTR("Enable/Disable looping in animation."));
-
- hb->add_child(memnew(VSeparator));
-
- menu_add_track = memnew(MenuButton);
- hb->add_child(menu_add_track);
- menu_add_track->get_popup()->connect("id_pressed", this, "_menu_add_track");
- menu_add_track->set_tooltip(TTR("Add new tracks."));
- menu_add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), "Add Normal Track", ADD_TRACK_MENU_ADD_VALUE_TRACK);
- menu_add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), "Add Transform Track", ADD_TRACK_MENU_ADD_TRANSFORM_TRACK);
- menu_add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), "Add Call Func Track", ADD_TRACK_MENU_ADD_CALL_TRACK);
-
- move_up_button = memnew(ToolButton);
- hb->add_child(move_up_button);
- move_up_button->connect("pressed", this, "_menu_track", make_binds(TRACK_MENU_MOVE_UP));
- move_up_button->set_focus_mode(FOCUS_NONE);
- move_up_button->set_disabled(true);
- move_up_button->set_tooltip(TTR("Move current track up."));
-
- move_down_button = memnew(ToolButton);
- hb->add_child(move_down_button);
- move_down_button->connect("pressed", this, "_menu_track", make_binds(TRACK_MENU_MOVE_DOWN));
- move_down_button->set_focus_mode(FOCUS_NONE);
- move_down_button->set_disabled(true);
- move_down_button->set_tooltip(TTR("Move current track down."));
-
- remove_button = memnew(ToolButton);
- hb->add_child(remove_button);
- remove_button->connect("pressed", this, "_menu_track", make_binds(TRACK_MENU_REMOVE));
- remove_button->set_focus_mode(FOCUS_NONE);
- remove_button->set_disabled(true);
- remove_button->set_tooltip(TTR("Remove selected track."));
-
- hb->add_child(memnew(VSeparator));
-
- menu_track = memnew(MenuButton);
- hb->add_child(menu_track);
- menu_track->get_popup()->connect("id_pressed", this, "_menu_track");
- menu_track->set_tooltip(TTR("Track tools"));
-
- edit_button = memnew(ToolButton);
- edit_button->set_toggle_mode(true);
- edit_button->set_focus_mode(FOCUS_NONE);
- edit_button->set_disabled(true);
-
- hb->add_child(edit_button);
- edit_button->set_tooltip(TTR("Enable editing of individual keys by clicking them."));
-
- optimize_dialog = memnew(ConfirmationDialog);
- add_child(optimize_dialog);
- optimize_dialog->set_title(TTR("Anim. Optimizer"));
- VBoxContainer *optimize_vb = memnew(VBoxContainer);
- optimize_dialog->add_child(optimize_vb);
-
- optimize_linear_error = memnew(SpinBox);
- optimize_linear_error->set_max(1.0);
- optimize_linear_error->set_min(0.001);
- optimize_linear_error->set_step(0.001);
- optimize_linear_error->set_value(0.05);
- optimize_vb->add_margin_child(TTR("Max. Linear Error:"), optimize_linear_error);
- optimize_angular_error = memnew(SpinBox);
- optimize_angular_error->set_max(1.0);
- optimize_angular_error->set_min(0.001);
- optimize_angular_error->set_step(0.001);
- optimize_angular_error->set_value(0.01);
-
- optimize_vb->add_margin_child(TTR("Max. Angular Error:"), optimize_angular_error);
- optimize_max_angle = memnew(SpinBox);
- optimize_vb->add_margin_child(TTR("Max Optimizable Angle:"), optimize_max_angle);
- optimize_max_angle->set_max(360.0);
- optimize_max_angle->set_min(0.0);
- optimize_max_angle->set_step(0.1);
- optimize_max_angle->set_value(22);
-
- optimize_dialog->get_ok()->set_text(TTR("Optimize"));
-
- /*keying = memnew( Button );
- keying->set_toggle_mode(true);
- //keying->set_text("Keys");
- keying->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,60);
- keying->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,10);
- keying->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,55);
- keying->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,10);
- //add_child(keying);
- keying->connect("pressed",this,"_keying_toggled");
- */
-
- /* l = memnew( Label );
- l->set_text("Base: ");
- l->set_position(Point2(0,3));
- //dr_panel->add_child(l);*/
-
- //menu->get_popup()->connect("id_pressed",this,"_menu_callback");
-
- hb = memnew(HBoxContainer);
- hb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- ec->add_child(hb);
- hb->set_v_size_flags(SIZE_EXPAND_FILL);
-
- track_editor = memnew(Control);
- track_editor->connect("draw", this, "_track_editor_draw");
- hb->add_child(track_editor);
- track_editor->connect("gui_input", this, "_track_editor_gui_input");
- track_editor->set_focus_mode(Control::FOCUS_ALL);
- track_editor->set_h_size_flags(SIZE_EXPAND_FILL);
-
- track_pos = memnew(Control);
- track_pos->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- track_pos->set_mouse_filter(MOUSE_FILTER_IGNORE);
- track_editor->add_child(track_pos);
- track_pos->connect("draw", this, "_track_position_draw");
-
- select_anim_warning = memnew(Label);
- track_editor->add_child(select_anim_warning);
- select_anim_warning->set_anchors_and_margins_preset(Control::PRESET_WIDE);
- select_anim_warning->set_text(TTR("Select an AnimationPlayer from the Scene Tree to edit animations."));
- select_anim_warning->set_autowrap(true);
- select_anim_warning->set_align(Label::ALIGN_CENTER);
- select_anim_warning->set_valign(Label::VALIGN_CENTER);
-
- v_scroll = memnew(VScrollBar);
- hb->add_child(v_scroll);
- v_scroll->connect("value_changed", this, "_scroll_changed");
- v_scroll->set_value(0);
-
- key_editor_tab = memnew(TabContainer);
- key_editor_tab->set_tab_align(TabContainer::ALIGN_LEFT);
- hb->add_child(key_editor_tab);
- key_editor_tab->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
-
- key_editor = memnew(PropertyEditor);
- key_editor->hide_top_label();
- key_editor->set_name(TTR("Key"));
- key_editor_tab->add_child(key_editor);
-
- key_edit = memnew(AnimationKeyEdit);
- key_edit->undo_redo = undo_redo;
- //key_edit->ke_dialog=key_edit_dialog;
-
- type_menu = memnew(PopupMenu);
- add_child(type_menu);
- for (int i = 0; i < Variant::VARIANT_MAX; i++)
- type_menu->add_item(Variant::get_type_name(Variant::Type(i)), i);
- type_menu->connect("id_pressed", this, "_create_value_item");
-
- VBoxContainer *curve_vb = memnew(VBoxContainer);
- curve_vb->set_name(TTR("Transition"));
- HBoxContainer *curve_hb = memnew(HBoxContainer);
- curve_vb->add_child(curve_hb);
-
- curve_linear = memnew(ToolButton);
- curve_linear->set_focus_mode(FOCUS_NONE);
- curve_hb->add_child(curve_linear);
- curve_in = memnew(ToolButton);
- curve_in->set_focus_mode(FOCUS_NONE);
- curve_hb->add_child(curve_in);
- curve_out = memnew(ToolButton);
- curve_out->set_focus_mode(FOCUS_NONE);
- curve_hb->add_child(curve_out);
- curve_inout = memnew(ToolButton);
- curve_inout->set_focus_mode(FOCUS_NONE);
- curve_hb->add_child(curve_inout);
- curve_outin = memnew(ToolButton);
- curve_outin->set_focus_mode(FOCUS_NONE);
- curve_hb->add_child(curve_outin);
- curve_constant = memnew(ToolButton);
- curve_constant->set_focus_mode(FOCUS_NONE);
- curve_hb->add_child(curve_constant);
-
- curve_edit = memnew(AnimationCurveEdit);
- curve_vb->add_child(curve_edit);
- curve_edit->set_v_size_flags(SIZE_EXPAND_FILL);
- key_editor_tab->add_child(curve_vb);
-
- track_name = memnew(LineEdit);
- track_name->set_as_toplevel(true);
- track_name->hide();
- add_child(track_name);
- track_name->connect("text_entered", this, "_track_name_changed");
- track_menu = memnew(PopupMenu);
- add_child(track_menu);
- track_menu->connect("id_pressed", this, "_track_menu_selected");
-
- key_editor_tab->hide();
-
- last_idx = 1;
-
- _update_menu();
-
- insert_confirm = memnew(ConfirmationDialog);
- add_child(insert_confirm);
- insert_confirm->connect("confirmed", this, "_confirm_insert_list");
-
- click.click = ClickOver::CLICK_NONE;
-
- name_column_ratio = 0.3;
- timeline_pos = 0;
-
- keying = false;
- insert_frame = 0;
- insert_query = false;
- insert_queue = false;
-
- editor_selection->connect("selection_changed", track_editor, "update");
-
- scale_dialog = memnew(ConfirmationDialog);
- VBoxContainer *vbc = memnew(VBoxContainer);
- scale_dialog->add_child(vbc);
-
- scale = memnew(SpinBox);
- scale->set_min(-99999);
- scale->set_max(99999);
- scale->set_step(0.001);
- vbc->add_margin_child(TTR("Scale Ratio:"), scale);
- scale_dialog->connect("confirmed", this, "_scale");
- add_child(scale_dialog);
-
- call_select = memnew(SceneTreeDialog);
- add_child(call_select);
- call_select->set_title(TTR("Call Functions in Which Node?"));
-
- cleanup_dialog = memnew(ConfirmationDialog);
- add_child(cleanup_dialog);
- VBoxContainer *cleanup_vb = memnew(VBoxContainer);
- cleanup_dialog->add_child(cleanup_vb);
-
- cleanup_keys = memnew(CheckButton);
- cleanup_keys->set_text(TTR("Remove invalid keys"));
- cleanup_keys->set_pressed(true);
- cleanup_vb->add_child(cleanup_keys);
-
- cleanup_tracks = memnew(CheckButton);
- cleanup_tracks->set_text(TTR("Remove unresolved and empty tracks"));
- cleanup_tracks->set_pressed(true);
- cleanup_vb->add_child(cleanup_tracks);
-
- cleanup_all = memnew(CheckButton);
- cleanup_all->set_text(TTR("Clean-up all animations"));
- cleanup_vb->add_child(cleanup_all);
-
- cleanup_dialog->set_title(TTR("Clean-Up Animation(s) (NO UNDO!)"));
- cleanup_dialog->get_ok()->set_text(TTR("Clean-Up"));
-
- cleanup_dialog->connect("confirmed", this, "_menu_track", varray(TRACK_MENU_CLEAN_UP_CONFIRM));
-
- track_editor->set_clip_contents(true);
-}
-
-AnimationKeyEditor::~AnimationKeyEditor() {
-
- memdelete(key_edit);
-}
diff --git a/editor/animation_editor.h b/editor/animation_editor.h
deleted file mode 100644
index 1e593f237c..0000000000
--- a/editor/animation_editor.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/*************************************************************************/
-/* animation_editor.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef ANIMATION_EDITOR_H
-#define ANIMATION_EDITOR_H
-
-#include "scene/gui/control.h"
-#include "scene/gui/file_dialog.h"
-#include "scene/gui/menu_button.h"
-#include "scene/gui/scroll_bar.h"
-#include "scene/gui/slider.h"
-#include "scene/gui/spin_box.h"
-#include "scene/gui/tab_container.h"
-#include "scene/gui/texture_rect.h"
-#include "scene/gui/tool_button.h"
-
-#include "editor_data.h"
-#include "property_editor.h"
-#include "scene/animation/animation_cache.h"
-#include "scene/resources/animation.h"
-#include "scene_tree_editor.h"
-
-class AnimationKeyEdit;
-class AnimationCurveEdit;
-
-class AnimationKeyEditor : public VBoxContainer {
-
- GDCLASS(AnimationKeyEditor, VBoxContainer);
-
- /*
- enum {
-
- MENU_NEW_ANIMATION,
- MENU_OPEN_ANIMATION,
- MENU_EDIT_ANIMATION,
- MENU_CLOSE_ANIMATION,
- MENU_KEYING_ACTIVE,
- MENU_SET_ROOT_NODE,
- MENU_SYNC_TO_PLAYER,
- MENU_ANIM_BASE=100,
- };
-
-*/
-
- enum {
-
- ADD_TRACK_MENU_ADD_VALUE_TRACK,
- ADD_TRACK_MENU_ADD_TRANSFORM_TRACK,
- ADD_TRACK_MENU_ADD_CALL_TRACK,
- TRACK_MENU_SCALE,
- TRACK_MENU_SCALE_PIVOT,
- TRACK_MENU_MOVE_UP,
- TRACK_MENU_MOVE_DOWN,
- TRACK_MENU_REMOVE,
- TRACK_MENU_DUPLICATE,
- TRACK_MENU_DUPLICATE_TRANSPOSE,
- TRACK_MENU_SET_ALL_TRANS_LINEAR,
- TRACK_MENU_SET_ALL_TRANS_CONSTANT,
- TRACK_MENU_SET_ALL_TRANS_OUT,
- TRACK_MENU_SET_ALL_TRANS_IN,
- TRACK_MENU_SET_ALL_TRANS_INOUT,
- TRACK_MENU_SET_ALL_TRANS_OUTIN,
- TRACK_MENU_NEXT_STEP,
- TRACK_MENU_PREV_STEP,
- TRACK_MENU_OPTIMIZE,
- TRACK_MENU_CLEAN_UP,
- TRACK_MENU_CLEAN_UP_CONFIRM,
- CURVE_SET_LINEAR,
- CURVE_SET_IN,
- CURVE_SET_OUT,
- CURVE_SET_INOUT,
- CURVE_SET_OUTIN,
- CURVE_SET_CONSTANT
- };
-
- enum {
- RIGHT_MENU_DUPLICATE,
- RIGHT_MENU_DUPLICATE_TRANSPOSE,
- RIGHT_MENU_REMOVE
- };
-
- struct MouseOver {
-
- enum Over {
- OVER_NONE,
- OVER_NAME,
- OVER_KEY,
- OVER_VALUE,
- OVER_INTERP,
- OVER_WRAP,
- OVER_UP,
- OVER_DOWN,
- OVER_REMOVE,
- OVER_ADD_KEY,
- };
-
- Over over;
- int track;
- int over_key;
-
- } mouse_over;
-
- struct SelectedKey {
-
- int track;
- int key;
- bool operator<(const SelectedKey &p_key) const { return track == p_key.track ? key < p_key.key : track < p_key.track; };
- };
-
- struct KeyInfo {
-
- float pos;
- };
-
- Map<SelectedKey, KeyInfo> selection;
-
- struct ClickOver {
-
- enum Click {
-
- CLICK_NONE,
- CLICK_RESIZE_NAMES,
- CLICK_DRAG_TIMELINE,
- CLICK_MOVE_KEYS,
- CLICK_SELECT_KEYS
-
- };
-
- SelectedKey selk;
- bool shift;
- Click click;
- Point2 at;
- Point2 to;
- } click;
-
- float timeline_pos;
-
- float name_column_ratio;
-
- int track_name_editing;
- int interp_editing;
- int cont_editing;
- int wrap_editing;
- int selected_track;
- int track_ofs[5];
-
- int last_menu_track_opt;
- LineEdit *track_name;
- PopupMenu *track_menu;
- PopupMenu *type_menu;
-
- Control *ec;
- TextureRect *zoomicon;
- HSlider *zoom;
- //MenuButton *menu;
- SpinBox *length;
- Button *loop;
- bool keying;
- ToolButton *edit_button;
- ToolButton *move_up_button;
- ToolButton *move_down_button;
- ToolButton *remove_button;
-
- ToolButton *curve_linear;
- ToolButton *curve_in;
- ToolButton *curve_out;
- ToolButton *curve_inout;
- ToolButton *curve_outin;
- ToolButton *curve_constant;
-
- ConfirmationDialog *optimize_dialog;
- SpinBox *optimize_linear_error;
- SpinBox *optimize_angular_error;
- SpinBox *optimize_max_angle;
-
- ConfirmationDialog *cleanup_dialog;
- CheckButton *cleanup_keys;
- CheckButton *cleanup_tracks;
- CheckButton *cleanup_all;
-
- SpinBox *step;
-
- MenuButton *menu_add_track;
- MenuButton *menu_track;
-
- HScrollBar *h_scroll;
- VScrollBar *v_scroll;
-
- Control *track_editor;
- Control *track_pos;
- TabContainer *key_editor_tab;
-
- ConfirmationDialog *scale_dialog;
- SpinBox *scale;
-
- PropertyEditor *key_editor;
-
- SceneTreeDialog *call_select;
-
- Ref<Animation> animation;
- void _update_paths();
-
- int last_idx;
-
- Node *root;
-
- UndoRedo *undo_redo;
- EditorHistory *history;
- ConfirmationDialog *insert_confirm;
-
- AnimationKeyEdit *key_edit;
- AnimationCurveEdit *curve_edit;
-
- bool inserting;
-
- bool updating;
- bool te_drawing;
-
- void _animation_len_changed(float p_len);
- void _animation_loop_changed();
- void _step_changed(float p_len);
-
- struct InsertData {
-
- Animation::TrackType type;
- NodePath path;
- int track_idx;
- Variant value;
- String query;
- bool advance;
- }; /* insert_data;*/
-
- bool insert_query;
- List<InsertData> insert_data;
- uint64_t insert_frame;
-
- int cvi_track;
- float cvi_pos;
-
- int right_data_size_cache;
-
- EditorSelection *editor_selection;
-
- Label *select_anim_warning;
-
- float _get_zoom_scale() const;
-
- void _track_editor_draw();
- void _track_editor_gui_input(const Ref<InputEvent> &p_input);
- void _track_position_draw();
-
- void _track_name_changed(const String &p_name);
- void _track_menu_selected(int p_idx);
- void _confirm_insert_list();
- int _confirm_insert(InsertData p_id, int p_last_track = -1);
- void _query_insert(const InsertData &p_id);
- void _update_menu();
- bool insert_queue;
- void _insert_delay();
- void _scale();
-
- void _clear_selection();
-
- //void _browse_path();
-
- StringName alc;
-
- void _animation_changed();
- void _animation_optimize();
- void _cleanup_animation(Ref<Animation> p_animation);
-
- void _scroll_changed(double);
-
- void _menu_add_track(int p_type);
- void _menu_track(int p_type);
-
- void _clear_selection_for_anim(const Ref<Animation> &p_anim);
- void _select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos);
- void _curve_transition_changed(float p_what);
-
- PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path);
-
- void _create_value_item(int p_type);
- void _pane_drag(const Point2 &p_delta);
- bool _edit_if_single_selection();
-
- void _toggle_edit_curves();
- void _animation_len_update();
-
- void _add_call_track(const NodePath &p_base);
-
- void _anim_duplicate_keys(bool transpose = false);
- void _anim_delete_keys();
-
- void _root_removed();
-
-protected:
- void _notification(int p_what);
- static void _bind_methods();
-
-public:
- void set_animation(const Ref<Animation> &p_anim);
- Ref<Animation> get_current_animation() const;
- void set_root(Node *p_root);
- Node *get_root() const;
- void update_keying();
- bool has_keying() const;
-
- void cleanup();
-
- void set_anim_pos(float p_pos);
- void insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists = false);
- void insert_value_key(const String &p_property, const Variant &p_value, bool p_advance);
- void insert_transform_key(Spatial *p_node, const String &p_sub, const Transform &p_xform);
-
- void show_select_node_warning(bool p_show) { select_anim_warning->set_visible(p_show); }
- AnimationKeyEditor();
- ~AnimationKeyEditor();
-};
-
-#endif // ANIMATION_EDITOR_H
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
new file mode 100644
index 0000000000..02d667031a
--- /dev/null
+++ b/editor/animation_track_editor.cpp
@@ -0,0 +1,5032 @@
+#include "animation_track_editor.h"
+#include "animation_track_editor_plugins.h"
+#include "editor/animation_bezier_editor.h"
+#include "editor/plugins/animation_player_editor_plugin.h"
+#include "editor_node.h"
+#include "editor_scale.h"
+#include "os/keyboard.h"
+#include "scene/main/viewport.h"
+#include "servers/audio/audio_stream.h"
+
+class AnimationTrackKeyEdit : public Object {
+
+ GDCLASS(AnimationTrackKeyEdit, Object);
+
+public:
+ bool setting;
+ bool hidden;
+
+ bool _hide_script_from_inspector() {
+ return true;
+ }
+
+ static void _bind_methods() {
+
+ ClassDB::bind_method("_update_obj", &AnimationTrackKeyEdit::_update_obj);
+ ClassDB::bind_method("_key_ofs_changed", &AnimationTrackKeyEdit::_key_ofs_changed);
+ ClassDB::bind_method("_hide_script_from_inspector", &AnimationTrackKeyEdit::_hide_script_from_inspector);
+ }
+
+ //PopupDialog *ke_dialog;
+
+ void _fix_node_path(Variant &value) {
+
+ NodePath np = value;
+
+ if (np == NodePath())
+ return;
+
+ Node *root = EditorNode::get_singleton()->get_tree()->get_root();
+
+ Node *np_node = root->get_node(np);
+ ERR_FAIL_COND(!np_node);
+
+ Node *edited_node = root->get_node(base);
+ ERR_FAIL_COND(!edited_node);
+
+ value = edited_node->get_path_to(np_node);
+ }
+
+ void _update_obj(const Ref<Animation> &p_anim) {
+ if (setting)
+ return;
+ if (hidden)
+ return;
+ if (!(animation == p_anim))
+ return;
+ notify_change();
+ }
+
+ void _key_ofs_changed(const Ref<Animation> &p_anim, float from, float to) {
+ if (hidden)
+ return;
+ if (!(animation == p_anim))
+ return;
+ if (from != key_ofs)
+ return;
+ key_ofs = to;
+ if (setting)
+ return;
+ notify_change();
+ }
+
+ bool _set(const StringName &p_name, const Variant &p_value) {
+
+ int key = animation->track_find_key(track, key_ofs, true);
+ ERR_FAIL_COND_V(key == -1, false);
+
+ String name = p_name;
+ if (name == "time") {
+
+ float new_time = p_value;
+ if (new_time == key_ofs)
+ return true;
+
+ int existing = animation->track_find_key(track, new_time, true);
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Time"), UndoRedo::MERGE_ENDS);
+
+ Variant val = animation->track_get_key_value(track, key);
+ float trans = animation->track_get_key_transition(track, key);
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", track, key);
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", track, new_time, val, trans);
+ undo_redo->add_do_method(this, "_key_ofs_changed", animation, key_ofs, new_time);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", track, new_time);
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, key_ofs, val, trans);
+ undo_redo->add_undo_method(this, "_key_ofs_changed", animation, new_time, key_ofs);
+
+ if (existing != -1) {
+ Variant v = animation->track_get_key_value(track, existing);
+ float trans = animation->track_get_key_transition(track, existing);
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, new_time, v, trans);
+ }
+
+ undo_redo->commit_action();
+ setting = false;
+
+ return true;
+ } else if (name == "easing") {
+
+ float val = p_value;
+ float prev_val = animation->track_get_key_transition(track, key);
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Transition"), UndoRedo::MERGE_ENDS);
+ undo_redo->add_do_method(animation.ptr(), "track_set_key_transition", track, key, val);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_key_transition", track, key, prev_val);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+
+ switch (animation->track_get_type(track)) {
+
+ case Animation::TYPE_TRANSFORM: {
+
+ Dictionary d_old = animation->track_get_key_value(track, key);
+ Dictionary d_new = d_old;
+ d_new[p_name] = p_value;
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Transform"));
+ undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, d_new);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, d_old);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ if (name == "value") {
+
+ Variant value = p_value;
+
+ if (value.get_type() == Variant::NODE_PATH) {
+
+ _fix_node_path(value);
+ }
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ Variant prev = animation->track_get_key_value(track, key);
+ undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ Dictionary d_old = animation->track_get_key_value(track, key);
+ Dictionary d_new = d_old;
+
+ bool change_notify_deserved = false;
+ bool mergeable = false;
+
+ if (name == "name") {
+
+ d_new["method"] = p_value;
+ }
+
+ if (name == "arg_count") {
+
+ Vector<Variant> args = d_old["args"];
+ args.resize(p_value);
+ d_new["args"] = args;
+ change_notify_deserved = true;
+ }
+
+ if (name.begins_with("args/")) {
+
+ Vector<Variant> args = d_old["args"];
+ int idx = name.get_slice("/", 1).to_int();
+ ERR_FAIL_INDEX_V(idx, args.size(), false);
+
+ String what = name.get_slice("/", 2);
+ if (what == "type") {
+ Variant::Type t = Variant::Type(int(p_value));
+
+ if (t != args[idx].get_type()) {
+ Variant::CallError err;
+ if (Variant::can_convert(args[idx].get_type(), t)) {
+ Variant old = args[idx];
+ Variant *ptrs[1] = { &old };
+ args[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
+ } else {
+
+ args[idx] = Variant::construct(t, NULL, 0, err);
+ }
+ change_notify_deserved = true;
+ d_new["args"] = args;
+ }
+ }
+ if (what == "value") {
+
+ Variant value = p_value;
+ if (value.get_type() == Variant::NODE_PATH) {
+
+ _fix_node_path(value);
+ }
+
+ args[idx] = value;
+ d_new["args"] = args;
+ mergeable = true;
+ }
+ }
+
+ if (mergeable)
+ undo_redo->create_action(TTR("Anim Change Call"), UndoRedo::MERGE_ENDS);
+ else
+ undo_redo->create_action(TTR("Anim Change Call"));
+
+ Variant prev = animation->track_get_key_value(track, key);
+ setting = true;
+ undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, d_new);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, d_old);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ if (change_notify_deserved)
+ notify_change();
+ return true;
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ if (name == "value") {
+
+ Variant value = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ float prev = animation->bezier_track_get_key_value(track, key);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_value", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_value", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+ if (name == "in_handle") {
+
+ Variant value = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ Vector2 prev = animation->bezier_track_get_key_in_handle(track, key);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_in_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_in_handle", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+ if (name == "out_handle") {
+
+ Variant value = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ Vector2 prev = animation->bezier_track_get_key_out_handle(track, key);
+ undo_redo->add_do_method(animation.ptr(), "bezier_track_set_out_handle", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_out_handle", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ if (name == "stream") {
+
+ Ref<AudioStream> stream = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ RES prev = animation->audio_track_get_key_stream(track, key);
+ undo_redo->add_do_method(animation.ptr(), "audio_track_set_key_stream", track, key, stream);
+ undo_redo->add_undo_method(animation.ptr(), "audio_track_set_key_stream", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+ if (name == "start_offset") {
+
+ float value = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ float prev = animation->audio_track_get_key_start_offset(track, key);
+ undo_redo->add_do_method(animation.ptr(), "audio_track_set_key_start_offset", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "audio_track_set_key_start_offset", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+ if (name == "end_offset") {
+
+ float value = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ float prev = animation->audio_track_get_key_end_offset(track, key);
+ undo_redo->add_do_method(animation.ptr(), "audio_track_set_key_end_offset", track, key, value);
+ undo_redo->add_undo_method(animation.ptr(), "audio_track_set_key_end_offset", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ if (name == "animation") {
+
+ StringName name = p_value;
+
+ setting = true;
+ undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
+ StringName prev = animation->animation_track_get_key_animation(track, key);
+ undo_redo->add_do_method(animation.ptr(), "animation_track_set_key_animation", track, key, name);
+ undo_redo->add_undo_method(animation.ptr(), "animation_track_set_key_animation", track, key, prev);
+ undo_redo->add_do_method(this, "_update_obj", animation);
+ undo_redo->add_undo_method(this, "_update_obj", animation);
+ undo_redo->commit_action();
+ setting = false;
+ return true;
+ }
+
+ } break;
+ }
+
+ return false;
+ }
+
+ bool _get(const StringName &p_name, Variant &r_ret) const {
+
+ int key = animation->track_find_key(track, key_ofs, true);
+ ERR_FAIL_COND_V(key == -1, false);
+
+ String name = p_name;
+ if (name == "time") {
+ r_ret = key_ofs;
+ return true;
+ } else if (name == "easing") {
+ r_ret = animation->track_get_key_transition(track, key);
+ return true;
+ }
+
+ switch (animation->track_get_type(track)) {
+
+ case Animation::TYPE_TRANSFORM: {
+
+ Dictionary d = animation->track_get_key_value(track, key);
+ ERR_FAIL_COND_V(!d.has(name), false);
+ r_ret = d[p_name];
+ return true;
+
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ if (name == "value") {
+ r_ret = animation->track_get_key_value(track, key);
+ return true;
+ }
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ Dictionary d = animation->track_get_key_value(track, key);
+
+ if (name == "name") {
+
+ ERR_FAIL_COND_V(!d.has("method"), false);
+ r_ret = d["method"];
+ return true;
+ }
+
+ ERR_FAIL_COND_V(!d.has("args"), false);
+
+ Vector<Variant> args = d["args"];
+
+ if (name == "arg_count") {
+
+ r_ret = args.size();
+ return true;
+ }
+
+ if (name.begins_with("args/")) {
+
+ int idx = name.get_slice("/", 1).to_int();
+ ERR_FAIL_INDEX_V(idx, args.size(), false);
+
+ String what = name.get_slice("/", 2);
+ if (what == "type") {
+ r_ret = args[idx].get_type();
+ return true;
+ }
+ if (what == "value") {
+ r_ret = args[idx];
+ return true;
+ }
+ }
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ if (name == "value") {
+ r_ret = animation->bezier_track_get_key_value(track, key);
+ return true;
+ }
+ if (name == "in_handle") {
+ r_ret = animation->bezier_track_get_key_in_handle(track, key);
+ return true;
+ }
+ if (name == "out_handle") {
+ r_ret = animation->bezier_track_get_key_out_handle(track, key);
+ return true;
+ }
+
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ if (name == "stream") {
+ r_ret = animation->audio_track_get_key_stream(track, key);
+ return true;
+ }
+ if (name == "start_offset") {
+ r_ret = animation->audio_track_get_key_start_offset(track, key);
+ return true;
+ }
+ if (name == "end_offset") {
+ r_ret = animation->audio_track_get_key_end_offset(track, key);
+ return true;
+ }
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ if (name == "animation") {
+ r_ret = animation->animation_track_get_key_animation(track, key);
+ return true;
+ }
+
+ } break;
+ }
+
+ return false;
+ }
+ void _get_property_list(List<PropertyInfo> *p_list) const {
+
+ if (animation.is_null())
+ return;
+
+ ERR_FAIL_INDEX(track, animation->get_track_count());
+ int key = animation->track_find_key(track, key_ofs, true);
+ ERR_FAIL_COND(key == -1);
+
+ p_list->push_back(PropertyInfo(Variant::REAL, "time", PROPERTY_HINT_RANGE, "0," + rtos(animation->get_length()) + ",0.01"));
+
+ switch (animation->track_get_type(track)) {
+
+ case Animation::TYPE_TRANSFORM: {
+
+ p_list->push_back(PropertyInfo(Variant::VECTOR3, "location"));
+ p_list->push_back(PropertyInfo(Variant::QUAT, "rotation"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR3, "scale"));
+
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ Variant v = animation->track_get_key_value(track, key);
+
+ if (hint.type != Variant::NIL) {
+
+ PropertyInfo pi = hint;
+ pi.name = "value";
+ p_list->push_back(pi);
+ } else {
+
+ PropertyHint hint = PROPERTY_HINT_NONE;
+ String hint_string;
+
+ if (v.get_type() == Variant::OBJECT) {
+ //could actually check the object property if exists..? yes i will!
+ Ref<Resource> res = v;
+ if (res.is_valid()) {
+
+ hint = PROPERTY_HINT_RESOURCE_TYPE;
+ hint_string = res->get_class();
+ }
+ }
+
+ if (v.get_type() != Variant::NIL)
+ p_list->push_back(PropertyInfo(v.get_type(), "value", hint, hint_string));
+ }
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ p_list->push_back(PropertyInfo(Variant::STRING, "name"));
+ p_list->push_back(PropertyInfo(Variant::INT, "arg_count", PROPERTY_HINT_RANGE, "0,5,1"));
+
+ Dictionary d = animation->track_get_key_value(track, key);
+ ERR_FAIL_COND(!d.has("args"));
+ Vector<Variant> args = d["args"];
+ String vtypes;
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+
+ if (i > 0)
+ vtypes += ",";
+ vtypes += Variant::get_type_name(Variant::Type(i));
+ }
+
+ for (int i = 0; i < args.size(); i++) {
+
+ p_list->push_back(PropertyInfo(Variant::INT, "args/" + itos(i) + "/type", PROPERTY_HINT_ENUM, vtypes));
+ if (args[i].get_type() != Variant::NIL)
+ p_list->push_back(PropertyInfo(args[i].get_type(), "args/" + itos(i) + "/value"));
+ }
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ p_list->push_back(PropertyInfo(Variant::REAL, "value"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "in_handle"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "out_handle"));
+
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "start_offset", PROPERTY_HINT_RANGE, "0,3600,0.01,or_greater"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "end_offset", PROPERTY_HINT_RANGE, "0,3600,0.01,or_greater"));
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ String animations;
+
+ if (root_path && root_path->has_node(animation->track_get_path(track))) {
+
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(root_path->get_node(animation->track_get_path(track)));
+ if (ap) {
+ List<StringName> anims;
+ ap->get_animation_list(&anims);
+ for (List<StringName>::Element *E = anims.front(); E; E = E->next()) {
+ if (animations != String()) {
+ animations += ",";
+ }
+
+ animations += String(E->get());
+ }
+ }
+ }
+
+ if (animations != String()) {
+ animations += ",";
+ }
+ animations += "[stop]";
+
+ p_list->push_back(PropertyInfo(Variant::STRING, "animation", PROPERTY_HINT_ENUM, animations));
+
+ } break;
+ }
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ p_list->push_back(PropertyInfo(Variant::REAL, "easing", PROPERTY_HINT_EXP_EASING));
+ }
+ }
+
+ UndoRedo *undo_redo;
+ Ref<Animation> animation;
+ int track;
+ float key_ofs;
+ Node *root_path;
+
+ PropertyInfo hint;
+ NodePath base;
+
+ void notify_change() {
+
+ _change_notify();
+ }
+
+ AnimationTrackKeyEdit() {
+ hidden = true;
+ key_ofs = 0;
+ track = -1;
+ setting = false;
+ root_path = NULL;
+ }
+};
+
+void AnimationTimelineEdit::_zoom_changed(double) {
+
+ update();
+ play_position->update();
+ emit_signal("zoom_changed");
+}
+
+float AnimationTimelineEdit::get_zoom_scale() const {
+
+ float zv = zoom->get_value();
+ if (zv < 1) {
+ zv = 1.0 - zv;
+ return Math::pow(1.0f + zv, 8.0f) * 100;
+ } else {
+ return 1.0 / Math::pow(zv, 8.0f) * 100;
+ }
+}
+
+void AnimationTimelineEdit::_anim_length_changed(double p_new_len) {
+
+ if (editing)
+ return;
+
+ p_new_len = MAX(0.001, p_new_len);
+
+ editing = true;
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Change animation length");
+ undo_redo->add_do_method(animation.ptr(), "set_length", p_new_len);
+ undo_redo->add_undo_method(animation.ptr(), "set_length", animation->get_length());
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+ editing = false;
+ update();
+
+ emit_signal("length_changed", p_new_len);
+}
+
+void AnimationTimelineEdit::_anim_loop_pressed() {
+
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Change animation loop");
+ undo_redo->add_do_method(animation.ptr(), "set_loop", loop->is_pressed());
+ undo_redo->add_undo_method(animation.ptr(), "set_loop", animation->has_loop());
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+}
+
+int AnimationTimelineEdit::get_buttons_width() const {
+
+ Ref<Texture> interp_mode = get_icon("TrackContinuous", "EditorIcons");
+ Ref<Texture> interp_type = get_icon("InterpRaw", "EditorIcons");
+ Ref<Texture> loop_type = get_icon("InterpWrapClamp", "EditorIcons");
+ Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons");
+ Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
+
+ int total_w = interp_mode->get_width() + interp_type->get_width() + loop_type->get_width() + remove_icon->get_width();
+ total_w += (down_icon->get_width() + 4 * EDSCALE) * 4;
+
+ return total_w;
+}
+
+int AnimationTimelineEdit::get_name_limit() const {
+
+ Ref<Texture> hsize_icon = get_icon("Hsize", "EditorIcons");
+
+ int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width());
+
+ limit = MIN(limit, get_size().width - get_buttons_width() - 1);
+
+ return limit;
+}
+
+void AnimationTimelineEdit::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+ add_track->set_icon(get_icon("Add", "EditorIcons"));
+ loop->set_icon(get_icon("Loop", "EditorIcons"));
+ time_icon->set_texture(get_icon("Time", "EditorIcons"));
+
+ add_track->get_popup()->clear();
+ add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), TTR("Property Track"));
+ add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), TTR("3D Transform Track"));
+ add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), TTR("Call Method Track"));
+ add_track->get_popup()->add_icon_item(get_icon("KeyBezier", "EditorIcons"), TTR("Bezier Curve Track"));
+ add_track->get_popup()->add_icon_item(get_icon("KeyAudio", "EditorIcons"), TTR("Audio Playback Track"));
+ add_track->get_popup()->add_icon_item(get_icon("KeyAnimation", "EditorIcons"), TTR("Animation Playback Track"));
+ }
+
+ if (p_what == NOTIFICATION_RESIZED) {
+ len_hb->set_position(Vector2(get_size().width - get_buttons_width(), 0));
+ len_hb->set_size(Size2(get_buttons_width(), get_size().height));
+ }
+ if (p_what == NOTIFICATION_DRAW) {
+
+ int key_range = get_size().width - get_buttons_width() - get_name_limit();
+
+ if (!animation.is_valid())
+ return;
+
+ Ref<Font> font = get_font("font", "Label");
+ Color color = get_color("font_color", "Label");
+
+ int zoomw = key_range;
+ float scale = get_zoom_scale();
+ int h = get_size().height;
+
+ float l = animation->get_length();
+ if (l <= 0)
+ l = 0.001; //avoid crashor
+
+ Ref<Texture> hsize_icon = get_icon("Hsize", "EditorIcons");
+ hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
+ draw_texture(hsize_icon, hsize_rect.position);
+
+ float keys_from = get_value();
+ float keys_to = keys_from + zoomw / scale;
+
+ {
+ float time_min = 0;
+ float time_max = animation->get_length();
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ if (animation->track_get_key_count(i) > 0) {
+
+ float beg = animation->track_get_key_time(i, 0);
+ /*if (animation->track_get_type(i) == Animation::TYPE_BEZIER) {
+ beg += animation->bezier_track_get_key_in_handle(i, 0).x;
+ }* not worth it since they have no use */
+
+ if (beg < time_min)
+ time_min = beg;
+
+ float end = animation->track_get_key_time(i, animation->track_get_key_count(i) - 1);
+ /*if (animation->track_get_type(i) == Animation::TYPE_BEZIER) {
+ end += animation->bezier_track_get_key_out_handle(i, animation->track_get_key_count(i) - 1).x;
+ } not worth it since they have no use */
+
+ if (end > time_max)
+ time_max = end;
+ }
+ }
+
+ float extra = (zoomw / scale) * 0.5;
+
+ //if (time_min < -0.001)
+ // time_min -= extra;
+ time_max += extra;
+ set_min(time_min);
+ set_max(time_max);
+
+ if (zoomw / scale < (time_max - time_min)) {
+ hscroll->show();
+
+ } else {
+
+ hscroll->hide();
+ }
+ }
+
+ set_page(zoomw / scale);
+
+ int end_px = (l - get_value()) * scale;
+ int begin_px = -get_value() * scale;
+ Color notimecol = get_color("dark_color_2", "Editor");
+ Color timecolor = color;
+ timecolor.a = 0.2;
+ Color linecolor = color;
+ linecolor.a = 0.2;
+
+ {
+
+ draw_rect(Rect2(Point2(get_name_limit(), 0), Point2(zoomw - 1, h)), notimecol);
+
+ if (begin_px < zoomw && end_px > 0) {
+
+ if (begin_px < 0)
+ begin_px = 0;
+ if (end_px > zoomw)
+ end_px = zoomw;
+
+ draw_rect(Rect2(Point2(get_name_limit() + begin_px, 0), Point2(end_px - begin_px - 1, h)), timecolor);
+ }
+ }
+
+ Color color_time_sec = color;
+ Color color_time_dec = color;
+ color_time_dec.a *= 0.5;
+#define SC_ADJ 100
+ int min = 30;
+ int dec = 1;
+ int step = 1;
+ int decimals = 2;
+ bool step_found = false;
+
+ const int period_width = font->get_char_size('.').width;
+ int max_digit_width = font->get_char_size('0').width;
+ for (int i = 1; i <= 9; i++) {
+ const int digit_width = font->get_char_size('0' + i).width;
+ max_digit_width = MAX(digit_width, max_digit_width);
+ }
+ const int max_sc = int(Math::ceil(zoomw / scale));
+ const int max_sc_width = String::num(max_sc).length() * max_digit_width;
+
+ while (!step_found) {
+
+ min = max_sc_width;
+ if (decimals > 0)
+ min += period_width + max_digit_width * decimals;
+
+ static const int _multp[3] = { 1, 2, 5 };
+ for (int i = 0; i < 3; i++) {
+
+ step = (_multp[i] * dec);
+ if (step * scale / SC_ADJ > min) {
+ step_found = true;
+ break;
+ }
+ }
+ if (step_found)
+ break;
+ dec *= 10;
+ decimals--;
+ if (decimals < 0)
+ decimals = 0;
+ }
+
+ for (int i = 0; i < zoomw; i++) {
+
+ float pos = get_value() + double(i) / scale;
+ float prev = get_value() + (double(i) - 1.0) / scale;
+
+ int sc = int(Math::floor(pos * SC_ADJ));
+ int prev_sc = int(Math::floor(prev * SC_ADJ));
+ bool sub = (sc % SC_ADJ);
+
+ if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) {
+
+ int scd = sc < 0 ? prev_sc : sc;
+ draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor);
+ draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height()) / 2 + font->get_ascent()).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), sub ? color_time_dec : color_time_sec, zoomw - i);
+ }
+ }
+
+ draw_line(Vector2(0, get_size().height), get_size(), linecolor);
+ }
+}
+
+void AnimationTimelineEdit::set_animation(const Ref<Animation> &p_animation) {
+ animation = p_animation;
+ if (animation.is_valid()) {
+ len_hb->show();
+ add_track->show();
+ } else {
+ len_hb->hide();
+ add_track->hide();
+ }
+ update();
+ update_values();
+}
+
+Size2 AnimationTimelineEdit::get_minimum_size() const {
+
+ Size2 ms = add_track->get_minimum_size();
+ Ref<Font> font = get_font("font", "Label");
+ ms.height = MAX(ms.height, font->get_height());
+ ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_icon("Hsize", "EditorIcons")->get_width() + 2;
+ return ms;
+}
+
+void AnimationTimelineEdit::set_block_animation_update_ptr(bool *p_block_ptr) {
+ block_animation_update_ptr = p_block_ptr;
+}
+
+void AnimationTimelineEdit::set_undo_redo(UndoRedo *p_undo_redo) {
+ undo_redo = p_undo_redo;
+}
+
+void AnimationTimelineEdit::set_zoom(Range *p_zoom) {
+ zoom = p_zoom;
+ zoom->connect("value_changed", this, "_zoom_changed");
+}
+
+void AnimationTimelineEdit::set_play_position(float p_pos) {
+
+ play_position_pos = p_pos;
+ play_position->update();
+}
+
+float AnimationTimelineEdit::get_play_position() const {
+ return play_position_pos;
+}
+
+void AnimationTimelineEdit::update_play_position() {
+ play_position->update();
+}
+
+void AnimationTimelineEdit::update_values() {
+
+ if (!animation.is_valid() || editing)
+ return;
+
+ editing = true;
+ length->set_value(animation->get_length());
+ loop->set_pressed(animation->has_loop());
+ editing = false;
+}
+
+void AnimationTimelineEdit::_play_position_draw() {
+
+ if (!animation.is_valid() || play_position_pos < 0)
+ return;
+
+ float scale = get_zoom_scale();
+ int h = play_position->get_size().height;
+
+ int px = (-get_value() + play_position_pos) * scale + get_name_limit();
+
+ if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) {
+ Color color = get_color("accent_color", "Editor");
+ play_position->draw_line(Point2(px, 0), Point2(px, h), color);
+ }
+}
+
+void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
+
+ dragging_hsize = true;
+ dragging_hsize_from = mb->get_position().x;
+ dragging_hsize_at = name_limit;
+ }
+
+ if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && dragging_hsize) {
+ dragging_hsize = false;
+ }
+ if (mb.is_valid() && mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) {
+
+ if (!panning_timeline && mb->get_button_index() == BUTTON_LEFT) {
+ int x = mb->get_position().x - get_name_limit();
+
+ float ofs = x / get_zoom_scale() + get_value();
+ emit_signal("timeline_changed", ofs, false);
+ dragging_timeline = true;
+ }
+ if (!dragging_timeline && mb->get_button_index() == BUTTON_MIDDLE) {
+ int x = mb->get_position().x - get_name_limit();
+ panning_timeline_from = x / get_zoom_scale();
+ panning_timeline = true;
+ panning_timeline_at = get_value();
+ }
+ }
+
+ if (dragging_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
+ dragging_timeline = false;
+ }
+
+ if (panning_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE && !mb->is_pressed()) {
+ panning_timeline = false;
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+
+ if (dragging_hsize) {
+ int ofs = mm->get_position().x - dragging_hsize_from;
+ name_limit = dragging_hsize_at + ofs;
+ update();
+ emit_signal("name_limit_changed");
+ play_position->update();
+ }
+ if (dragging_timeline) {
+ int x = mm->get_position().x - get_name_limit();
+ float ofs = x / get_zoom_scale() + get_value();
+ emit_signal("timeline_changed", ofs, false);
+ }
+ if (panning_timeline) {
+ int x = mm->get_position().x - get_name_limit();
+ float ofs = x / get_zoom_scale();
+ float diff = ofs - panning_timeline_from;
+ set_value(panning_timeline_at - diff);
+ }
+ }
+}
+
+void AnimationTimelineEdit::set_hscroll(HScrollBar *p_hscroll) {
+
+ hscroll = p_hscroll;
+}
+
+void AnimationTimelineEdit::_track_added(int p_track) {
+ emit_signal("track_added", p_track);
+}
+
+void AnimationTimelineEdit::_bind_methods() {
+ ClassDB::bind_method("_zoom_changed", &AnimationTimelineEdit::_zoom_changed);
+ ClassDB::bind_method("_anim_length_changed", &AnimationTimelineEdit::_anim_length_changed);
+ ClassDB::bind_method("_anim_loop_pressed", &AnimationTimelineEdit::_anim_loop_pressed);
+ ClassDB::bind_method("_play_position_draw", &AnimationTimelineEdit::_play_position_draw);
+ ClassDB::bind_method("_gui_input", &AnimationTimelineEdit::_gui_input);
+ ClassDB::bind_method("_track_added", &AnimationTimelineEdit::_track_added);
+
+ ADD_SIGNAL(MethodInfo("zoom_changed"));
+ ADD_SIGNAL(MethodInfo("name_limit_changed"));
+ ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
+ ADD_SIGNAL(MethodInfo("track_added", PropertyInfo(Variant::INT, "track")));
+ ADD_SIGNAL(MethodInfo("length_changed", PropertyInfo(Variant::REAL, "size")));
+}
+
+AnimationTimelineEdit::AnimationTimelineEdit() {
+
+ block_animation_update_ptr = NULL;
+ editing = false;
+ name_limit = 150;
+ zoom = NULL;
+
+ play_position_pos = 0;
+ play_position = memnew(Control);
+ play_position->set_mouse_filter(MOUSE_FILTER_PASS);
+ add_child(play_position);
+ play_position->set_anchors_and_margins_preset(PRESET_WIDE);
+ play_position->connect("draw", this, "_play_position_draw");
+
+ add_track = memnew(MenuButton);
+ add_track->set_position(Vector2(0, 0));
+ add_child(add_track);
+ add_track->set_text(TTR("Add Track"));
+
+ len_hb = memnew(HBoxContainer);
+
+ Control *expander = memnew(Control);
+ expander->set_h_size_flags(SIZE_EXPAND_FILL);
+ len_hb->add_child(expander);
+ time_icon = memnew(TextureRect);
+ time_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
+ time_icon->set_tooltip(TTR("Animation Length Time (seconds)"));
+ len_hb->add_child(time_icon);
+ length = memnew(EditorSpinSlider);
+ length->set_min(0.001);
+ length->set_max(3600);
+ length->set_step(0.01);
+ length->set_allow_greater(true);
+ length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0));
+ length->set_hide_slider(true);
+ length->set_tooltip(TTR("Animation Length Time (seconds)"));
+ length->connect("value_changed", this, "_anim_length_changed");
+ len_hb->add_child(length);
+ loop = memnew(ToolButton);
+ loop->set_tooltip(TTR("Animation Looping"));
+ loop->connect("pressed", this, "_anim_loop_pressed");
+ loop->set_toggle_mode(true);
+ len_hb->add_child(loop);
+ add_child(len_hb);
+
+ add_track->hide();
+ add_track->get_popup()->connect("index_pressed", this, "_track_added");
+ len_hb->hide();
+
+ panning_timeline = false;
+ dragging_timeline = false;
+ dragging_hsize = false;
+}
+
+////////////////////////////////////
+
+void AnimationTrackEdit::_notification(int p_what) {
+ if (p_what == NOTIFICATION_DRAW) {
+ if (animation.is_null())
+ return;
+ ERR_FAIL_INDEX(track, animation->get_track_count());
+
+ int limit = timeline->get_name_limit();
+
+ if (has_focus()) {
+ Color accent = get_color("accent_color", "Editor");
+ accent.a *= 0.7;
+ draw_rect(Rect2(Point2(), get_size()), accent, false);
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ Color color = get_color("font_color", "Label");
+ Ref<Texture> type_icons[6] = {
+ get_icon("KeyValue", "EditorIcons"),
+ get_icon("KeyXform", "EditorIcons"),
+ get_icon("KeyCall", "EditorIcons"),
+ get_icon("KeyBezier", "EditorIcons"),
+ get_icon("KeyAudio", "EditorIcons"),
+ get_icon("KeyAnimation", "EditorIcons")
+ };
+ int hsep = get_constant("hseparation", "ItemList");
+ Color linecolor = color;
+ linecolor.a = 0.2;
+
+ // NAMES AND ICONS //
+
+ {
+
+ Ref<Texture> check = animation->track_is_enabled(track) ? get_icon("checked", "CheckBox") : get_icon("unchecked", "CheckBox");
+
+ int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but..
+
+ check_rect = Rect2(Point2(ofs, int(get_size().height - check->get_height()) / 2), check->get_size());
+
+ draw_texture(check, check_rect.position);
+
+ ofs += check->get_width() + hsep;
+
+ Ref<Texture> type_icon = type_icons[animation->track_get_type(track)];
+
+ draw_texture(type_icon, Point2(ofs, int(get_size().height - type_icon->get_height()) / 2));
+ ofs += type_icon->get_width() + hsep;
+
+ NodePath path = animation->track_get_path(track);
+
+ Node *node = NULL;
+
+ if (root && root->has_node(path)) {
+ node = root->get_node(path);
+ }
+
+ String text;
+ Color text_color = color;
+ if (node && EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
+ text_color = get_color("accent_color", "Editor");
+ }
+
+ if (in_group) {
+
+ if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
+ text = TTR("Functions:");
+ } else if (animation->track_get_type(track) == Animation::TYPE_AUDIO) {
+ text = TTR("Audio Clips:");
+ } else if (animation->track_get_type(track) == Animation::TYPE_ANIMATION) {
+ text = TTR("Anim Clips:");
+ } else {
+ Vector<StringName> sn = path.get_subnames();
+ for (int i = 0; i < sn.size(); i++) {
+ if (i > 0) {
+ text += ".";
+ }
+ text += sn[i];
+ }
+ }
+ text_color.a *= 0.7;
+ } else if (node) {
+ Ref<Texture> icon;
+ if (has_icon(node->get_class(), "EditorIcons")) {
+ icon = get_icon(node->get_class(), "EditorIcons");
+ } else {
+ icon = get_icon("Node", "EditorIcons");
+ }
+
+ draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
+ icon_cache = icon;
+
+ text = node->get_name();
+ ofs += hsep;
+ ofs += icon->get_width();
+ Vector<StringName> sn = path.get_subnames();
+ for (int i = 0; i < sn.size(); i++) {
+ text += ".";
+ text += sn[i];
+ }
+ } else {
+ icon_cache = type_icon;
+
+ text = path;
+ }
+
+ path_cache = text;
+
+ path_rect = Rect2(ofs, 0, limit - ofs - hsep, get_size().height);
+
+ Vector2 string_pos = Point2(ofs, (get_size().height - font->get_height()) / 2 + font->get_ascent());
+ string_pos = string_pos.floor();
+ draw_string(font, string_pos, text, text_color, limit - ofs - hsep);
+
+ draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor);
+ }
+
+ // KEYFAMES //
+
+ draw_bg(limit, get_size().width - timeline->get_buttons_width());
+
+ {
+
+ float scale = timeline->get_zoom_scale();
+ int limit_end = get_size().width - timeline->get_buttons_width();
+
+ for (int i = 0; i < animation->track_get_key_count(track); i++) {
+
+ float offset = animation->track_get_key_time(track, i) - timeline->get_value();
+ if (editor->is_key_selected(track, i) && editor->is_moving_selection()) {
+ offset += editor->get_moving_selection_offset();
+ }
+ offset = offset * scale + limit;
+ if (i < animation->track_get_key_count(track) - 1) {
+
+ float offset_n = animation->track_get_key_time(track, i + 1) - timeline->get_value();
+ if (editor->is_key_selected(track, i + 1) && editor->is_moving_selection()) {
+ offset_n += editor->get_moving_selection_offset();
+ }
+ offset_n = offset_n * scale + limit;
+
+ draw_key_link(i, scale, int(offset), int(offset_n), limit, limit_end);
+ }
+
+ draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end);
+ }
+ }
+
+ draw_fg(limit, get_size().width - timeline->get_buttons_width());
+
+ // BUTTONS //
+ {
+
+ Ref<Texture> wrap_icon[2] = {
+ get_icon("InterpWrapClamp", "EditorIcons"),
+ get_icon("InterpWrapLoop", "EditorIcons"),
+ };
+
+ Ref<Texture> interp_icon[3] = {
+ get_icon("InterpRaw", "EditorIcons"),
+ get_icon("InterpLinear", "EditorIcons"),
+ get_icon("InterpCubic", "EditorIcons")
+ };
+ Ref<Texture> cont_icon[4] = {
+ get_icon("TrackContinuous", "EditorIcons"),
+ get_icon("TrackDiscrete", "EditorIcons"),
+ get_icon("TrackTrigger", "EditorIcons"),
+ get_icon("TrackCapture", "EditorIcons")
+ };
+
+ int ofs = get_size().width - timeline->get_buttons_width();
+
+ Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
+
+ draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor);
+
+ ofs += hsep;
+ {
+ //callmode
+
+ Animation::UpdateMode update_mode;
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ update_mode = animation->value_track_get_update_mode(track);
+ } else {
+ update_mode = Animation::UPDATE_CONTINUOUS;
+ }
+
+ Ref<Texture> update_icon = cont_icon[update_mode];
+
+ update_mode_rect.position.x = ofs;
+ update_mode_rect.position.y = int(get_size().height - update_icon->get_height()) / 2;
+ update_mode_rect.size = update_icon->get_size();
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ draw_texture(update_icon, update_mode_rect.position);
+ }
+ //make it easier to click
+ update_mode_rect.position.y = 0;
+ update_mode_rect.size.y = get_size().height;
+
+ ofs += update_icon->get_width() + hsep;
+ update_mode_rect.size.x += hsep;
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
+ update_mode_rect.size.x += down_icon->get_width();
+ bezier_edit_rect = Rect2();
+ } else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) {
+ Ref<Texture> bezier_icon = get_icon("EditBezier", "EditorIcons");
+ update_mode_rect.size.x += down_icon->get_width();
+ bezier_edit_rect.position = update_mode_rect.position + (update_mode_rect.size - bezier_icon->get_size()) / 2;
+ bezier_edit_rect.size = bezier_icon->get_size();
+ draw_texture(bezier_icon, bezier_edit_rect.position);
+ update_mode_rect = Rect2();
+ } else {
+ update_mode_rect = Rect2();
+ bezier_edit_rect = Rect2();
+ }
+
+ ofs += down_icon->get_width();
+ draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor);
+ ofs += hsep;
+ }
+
+ {
+ //interp
+
+ Animation::InterpolationType interp_mode = animation->track_get_interpolation_type(track);
+
+ Ref<Texture> icon = interp_icon[interp_mode];
+
+ interp_mode_rect.position.x = ofs;
+ interp_mode_rect.position.y = int(get_size().height - icon->get_height()) / 2;
+ interp_mode_rect.size = icon->get_size();
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_TRANSFORM) {
+ draw_texture(icon, interp_mode_rect.position);
+ }
+ //make it easier to click
+ interp_mode_rect.position.y = 0;
+ interp_mode_rect.size.y = get_size().height;
+
+ ofs += icon->get_width() + hsep;
+ interp_mode_rect.size.x += hsep;
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_TRANSFORM) {
+ draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
+ interp_mode_rect.size.x += down_icon->get_width();
+ } else {
+ interp_mode_rect = Rect2();
+ }
+
+ ofs += down_icon->get_width();
+ draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor);
+ ofs += hsep;
+ }
+
+ {
+ //loop
+
+ bool loop_wrap = animation->track_get_interpolation_loop_wrap(track);
+
+ Ref<Texture> icon = wrap_icon[loop_wrap ? 1 : 0];
+
+ loop_mode_rect.position.x = ofs;
+ loop_mode_rect.position.y = int(get_size().height - icon->get_height()) / 2;
+ loop_mode_rect.size = icon->get_size();
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_TRANSFORM) {
+ draw_texture(icon, loop_mode_rect.position);
+ }
+
+ loop_mode_rect.position.y = 0;
+ loop_mode_rect.size.y = get_size().height;
+
+ ofs += icon->get_width() + hsep;
+ loop_mode_rect.size.x += hsep;
+
+ if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_TRANSFORM) {
+ draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2));
+ loop_mode_rect.size.x += down_icon->get_width();
+ } else {
+ loop_mode_rect = Rect2();
+ }
+
+ ofs += down_icon->get_width();
+ draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor);
+ ofs += hsep;
+ }
+
+ {
+ //erase
+
+ Ref<Texture> icon = get_icon("Remove", "EditorIcons");
+
+ remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width()) / 2;
+ remove_rect.position.y = int(get_size().height - icon->get_height()) / 2;
+ remove_rect.size = icon->get_size();
+
+ draw_texture(icon, remove_rect.position);
+ }
+ }
+
+ if (in_group) {
+ draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor);
+ } else {
+ draw_line(Vector2(0, get_size().height), get_size(), linecolor);
+ }
+
+ if (dropping_at != 0) {
+ Color drop_color = get_color("accent_color", "Editor");
+ if (dropping_at < 0) {
+ draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color);
+ } else {
+ draw_line(Vector2(0, get_size().height), get_size(), drop_color);
+ }
+ }
+ }
+
+ if (p_what == NOTIFICATION_MOUSE_EXIT || p_what == NOTIFICATION_DRAG_END) {
+ cancel_drop();
+ }
+}
+
+int AnimationTrackEdit::get_key_height() const {
+ if (!animation.is_valid())
+ return 0;
+
+ return type_icon->get_height();
+}
+Rect2 AnimationTrackEdit::get_key_rect(int p_index, float p_pixels_sec) {
+
+ if (!animation.is_valid())
+ return Rect2();
+ Rect2 rect = Rect2(-type_icon->get_width() / 2, 0, type_icon->get_width(), get_size().height);
+
+ //make it a big easier to click
+ rect.position.x -= rect.size.x * 0.5;
+ rect.size.x *= 2;
+ return rect;
+}
+
+bool AnimationTrackEdit::is_key_selectable_by_distance() const {
+ return true;
+}
+
+void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) {
+ if (p_next_x < p_clip_left)
+ return;
+ if (p_x > p_clip_right)
+ return;
+
+ Variant current = animation->track_get_key_value(get_track(), p_index);
+ Variant next = animation->track_get_key_value(get_track(), p_index + 1);
+ if (current != next)
+ return;
+
+ Color color = get_color("font_color", "Label");
+ color.a = 0.5;
+
+ int from_x = MAX(p_x, p_clip_left);
+ int to_x = MIN(p_next_x, p_clip_right);
+
+ draw_line(Point2(from_x + 1, get_size().height / 2), Point2(to_x, get_size().height / 2), color, 2);
+}
+
+void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ if (!animation.is_valid())
+ return;
+
+ if (p_x < p_clip_left || p_x > p_clip_right)
+ return;
+
+ Vector2 ofs(p_x - type_icon->get_width() / 2, int(get_size().height - type_icon->get_height()) / 2);
+
+ if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
+ Ref<Font> font = get_font("font", "Label");
+ Color color = get_color("font_color", "Label");
+ color.a = 0.5;
+
+ Dictionary d = animation->track_get_key_value(track, p_index);
+ String text;
+
+ if (d.has("method"))
+ text += String(d["method"]);
+ text += "(";
+ Vector<Variant> args;
+ if (d.has("args"))
+ args = d["args"];
+ for (int i = 0; i < args.size(); i++) {
+
+ if (i > 0)
+ text += ", ";
+ text += String(args[i]);
+ }
+ text += ")";
+
+ int limit = MAX(0, p_clip_right - p_x - type_icon->get_width());
+ if (limit > 0) {
+ draw_string(font, Vector2(p_x + type_icon->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
+ }
+ }
+ if (p_selected) {
+ draw_texture(selected_icon, ofs);
+ } else {
+ draw_texture(type_icon, ofs);
+ }
+}
+
+//helper
+void AnimationTrackEdit::draw_rect_clipped(const Rect2 &p_rect, const Color &p_color, bool p_filled) {
+
+ int clip_left = timeline->get_name_limit();
+ int clip_right = get_size().width - timeline->get_buttons_width();
+
+ if (p_rect.position.x > clip_right)
+ return;
+ if (p_rect.position.x + p_rect.size.x < clip_left)
+ return;
+ Rect2 clip = Rect2(clip_left, 0, clip_right - clip_left, get_size().height);
+ draw_rect(clip.clip(p_rect), p_color, p_filled);
+}
+
+void AnimationTrackEdit::draw_bg(int p_clip_left, int p_clip_right) {
+}
+
+void AnimationTrackEdit::draw_fg(int p_clip_left, int p_clip_right) {
+}
+
+void AnimationTrackEdit::draw_texture_clipped(const Ref<Texture> &p_texture, const Vector2 &p_pos) {
+
+ draw_texture_region_clipped(p_texture, Rect2(p_pos, p_texture->get_size()), Rect2(Point2(), p_texture->get_size()));
+}
+
+void AnimationTrackEdit::draw_texture_region_clipped(const Ref<Texture> &p_texture, const Rect2 &p_rect, const Rect2 &p_region) {
+
+ int clip_left = timeline->get_name_limit();
+ int clip_right = get_size().width - timeline->get_buttons_width();
+
+ //clip left and right
+ if (clip_left > p_rect.position.x + p_rect.size.x)
+ return;
+ if (clip_right < p_rect.position.x)
+ return;
+
+ Rect2 rect = p_rect;
+ Rect2 region = p_region;
+
+ if (clip_left > rect.position.x) {
+ int rect_pixels = (clip_left - rect.position.x);
+ int region_pixels = rect_pixels * region.size.x / rect.size.x;
+
+ rect.position.x += rect_pixels;
+ rect.size.x -= rect_pixels;
+
+ region.position.x += region_pixels;
+ region.size.x -= region_pixels;
+ }
+
+ if (clip_right < rect.position.x + rect.size.x) {
+
+ int rect_pixels = rect.position.x + rect.size.x - clip_right;
+ int region_pixels = rect_pixels * region.size.x / rect.size.x;
+
+ rect.size.x -= rect_pixels;
+ region.size.x -= region_pixels;
+ }
+
+ draw_texture_rect_region(p_texture, rect, region);
+}
+
+int AnimationTrackEdit::get_track() const {
+ return track;
+}
+
+Ref<Animation> AnimationTrackEdit::get_animation() const {
+ return animation;
+}
+
+void AnimationTrackEdit::set_animation_and_track(const Ref<Animation> &p_animation, int p_track) {
+
+ animation = p_animation;
+ track = p_track;
+ update();
+
+ Ref<Texture> type_icons[6] = {
+ get_icon("KeyValue", "EditorIcons"),
+ get_icon("KeyXform", "EditorIcons"),
+ get_icon("KeyCall", "EditorIcons"),
+ get_icon("KeyBezier", "EditorIcons"),
+ get_icon("KeyAudio", "EditorIcons"),
+ get_icon("KeyAnimation", "EditorIcons")
+ };
+
+ ERR_FAIL_INDEX(track, animation->get_track_count());
+
+ type_icon = type_icons[animation->track_get_type(track)];
+ selected_icon = get_icon("KeySelected", "EditorIcons");
+}
+
+Size2 AnimationTrackEdit::get_minimum_size() const {
+
+ Ref<Texture> texture = get_icon("Object", "EditorIcons");
+ Ref<Font> font = get_font("font", "Label");
+ int separation = get_constant("vseparation", "ItemList");
+
+ int max_h = MAX(texture->get_height(), font->get_height());
+ max_h = MAX(max_h, get_key_height());
+
+ return Vector2(1, max_h + separation);
+}
+
+void AnimationTrackEdit::set_undo_redo(UndoRedo *p_undo_redo) {
+ undo_redo = p_undo_redo;
+}
+
+void AnimationTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) {
+ timeline = p_timeline;
+ timeline->connect("zoom_changed", this, "_zoom_changed");
+ timeline->connect("name_limit_changed", this, "_zoom_changed");
+}
+void AnimationTrackEdit::set_editor(AnimationTrackEditor *p_editor) {
+ editor = p_editor;
+}
+
+void AnimationTrackEdit::_play_position_draw() {
+
+ if (!animation.is_valid() || play_position_pos < 0)
+ return;
+
+ float scale = timeline->get_zoom_scale();
+ int h = get_size().height;
+
+ int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit();
+
+ if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
+ Color color = get_color("accent_color", "Editor");
+ play_position->draw_line(Point2(px, 0), Point2(px, h), color);
+ }
+}
+
+void AnimationTrackEdit::set_play_position(float p_pos) {
+
+ play_position_pos = p_pos;
+ play_position->update();
+}
+
+void AnimationTrackEdit::update_play_position() {
+ play_position->update();
+}
+
+void AnimationTrackEdit::set_root(Node *p_root) {
+ root = p_root;
+}
+void AnimationTrackEdit::_zoom_changed() {
+ update();
+ play_position->update();
+}
+
+void AnimationTrackEdit::_path_entered(const String &p_text) {
+
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Change Track Path");
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", track, p_text);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_path", track, animation->track_get_path(track));
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+ update();
+ path->hide();
+}
+
+String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
+
+ if (check_rect.has_point(p_pos)) {
+ return TTR("Toggle this track on/off");
+ }
+
+ if (path_rect.has_point(p_pos)) {
+ return animation->track_get_path(track);
+ }
+
+ if (update_mode_rect.has_point(p_pos)) {
+ return TTR("Update Mode (How this property is set).");
+ }
+
+ if (interp_mode_rect.has_point(p_pos)) {
+ return TTR("Interpolation Mode");
+ }
+
+ if (loop_mode_rect.has_point(p_pos)) {
+ return TTR("Loop Wrap Mode (Interpolate end with beginning on loop");
+ }
+
+ if (remove_rect.has_point(p_pos)) {
+ return TTR("Remove this track");
+ }
+
+ if (p_pos.x >= timeline->get_name_limit() && p_pos.x <= (get_size().width - timeline->get_buttons_width())) {
+
+ int key_idx = -1;
+ float key_distance = 1e20;
+
+ for (int i = animation->track_get_key_count(track) - 1; i >= 0; i--) { //select should happen in the opposite order of drawing for more accurate overlap select
+
+ Rect2 rect = const_cast<AnimationTrackEdit *>(this)->get_key_rect(i, timeline->get_zoom_scale());
+ float offset = animation->track_get_key_time(track, i) - timeline->get_value();
+ offset = offset * timeline->get_zoom_scale() + timeline->get_name_limit();
+ rect.position.x += offset;
+
+ if (rect.has_point(p_pos)) {
+
+ if (const_cast<AnimationTrackEdit *>(this)->is_key_selectable_by_distance()) {
+ float distance = ABS(offset - p_pos.x);
+ if (key_idx == -1 || distance < key_distance) {
+ key_idx = i;
+ key_distance = distance;
+ }
+ } else {
+ //first one does it
+ break;
+ }
+ }
+ }
+
+ if (key_idx != -1) {
+
+ String text = TTR("Time (s): ") + rtos(animation->track_get_key_time(track, key_idx)) + "\n";
+ switch (animation->track_get_type(track)) {
+
+ case Animation::TYPE_TRANSFORM: {
+
+ Dictionary d = animation->track_get_key_value(track, key_idx);
+ if (d.has("location"))
+ text += "Pos: " + String(d["location"]) + "\n";
+ if (d.has("rotation"))
+ text += "Rot: " + String(d["rotation"]) + "\n";
+ if (d.has("scale"))
+ text += "Scale: " + String(d["scale"]) + "\n";
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ Variant v = animation->track_get_key_value(track, key_idx);
+ //text+="value: "+String(v)+"\n";
+
+ bool prop_exists = false;
+ Variant::Type valid_type = Variant::NIL;
+ Object *obj = NULL;
+
+ RES res;
+ Vector<StringName> leftover_path;
+ Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
+
+ if (res.is_valid()) {
+ obj = res.ptr();
+ } else if (node) {
+ obj = node;
+ }
+
+ if (obj) {
+ valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
+ }
+
+ text += "Type: " + Variant::get_type_name(v.get_type()) + "\n";
+ if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
+ text += "Value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
+ } else {
+ text += "Value: " + String(v) + "\n";
+ }
+ text += "Easing: " + rtos(animation->track_get_key_transition(track, key_idx));
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ Dictionary d = animation->track_get_key_value(track, key_idx);
+ if (d.has("method"))
+ text += String(d["method"]);
+ text += "(";
+ Vector<Variant> args;
+ if (d.has("args"))
+ args = d["args"];
+ for (int i = 0; i < args.size(); i++) {
+
+ if (i > 0)
+ text += ", ";
+ text += String(args[i]);
+ }
+ text += ")\n";
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ float h = animation->bezier_track_get_key_value(track, key_idx);
+ text += "Value: " + rtos(h) + "\n";
+ Vector2 ih = animation->bezier_track_get_key_in_handle(track, key_idx);
+ text += "In-Handle: " + ih + "\n";
+ Vector2 oh = animation->bezier_track_get_key_out_handle(track, key_idx);
+ text += "Out-Handle: " + oh + "\n";
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ String stream_name = "null";
+ RES stream = animation->audio_track_get_key_stream(track, key_idx);
+ if (stream.is_valid()) {
+ if (stream->get_path().is_resource_file()) {
+ stream_name = stream->get_path().get_file();
+ } else if (stream->get_name() != "") {
+ stream_name = stream->get_name();
+ } else {
+ stream_name = stream->get_class();
+ }
+ }
+
+ text += "Stream: " + stream_name + "\n";
+ float so = animation->audio_track_get_key_start_offset(track, key_idx);
+ text += "Start (s): " + rtos(so) + "\n";
+ float eo = animation->audio_track_get_key_end_offset(track, key_idx);
+ text += "End (s): " + rtos(eo) + "\n";
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ String name = animation->animation_track_get_key_animation(track, key_idx);
+ text += "Animation Clip: " + name + "\n";
+ } break;
+ }
+ return text;
+ }
+ }
+
+ return Control::get_tooltip(p_pos);
+}
+
+void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
+
+ if (p_event->is_pressed()) {
+ if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) {
+ emit_signal("duplicate_request");
+ accept_event();
+ }
+
+ if (ED_GET_SHORTCUT("animation_editor/duplicate_selection_transposed")->is_shortcut(p_event)) {
+ emit_signal("duplicate_transpose_request");
+ accept_event();
+ }
+
+ if (ED_GET_SHORTCUT("animation_editor/delete_selection")->is_shortcut(p_event)) {
+ emit_signal("delete_request");
+ accept_event();
+ }
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ Point2 pos = mb->get_position();
+
+ if (check_rect.has_point(pos)) {
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Toggle track enabled");
+ undo_redo->add_do_method(animation.ptr(), "track_set_enabled", track, !animation->track_is_enabled(track));
+ undo_redo->add_undo_method(animation.ptr(), "track_set_enabled", track, animation->track_is_enabled(track));
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+ update();
+ accept_event();
+ }
+ if (path_rect.has_point(pos)) {
+
+ clicking_on_name = true;
+ accept_event();
+ }
+
+ if (update_mode_rect.has_point(pos)) {
+ if (!menu) {
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("id_pressed", this, "_menu_selected");
+ }
+ menu->clear();
+ menu->add_icon_item(get_icon("TrackContinuous", "EditorIcons"), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
+ menu->add_icon_item(get_icon("TrackDiscrete", "EditorIcons"), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
+ menu->add_icon_item(get_icon("TrackTrigger", "EditorIcons"), TTR("Trigger"), MENU_CALL_MODE_TRIGGER);
+ menu->add_icon_item(get_icon("TrackCapture", "EditorIcons"), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
+ menu->set_as_minsize();
+
+ Vector2 popup_pos = get_global_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height);
+ menu->set_global_position(popup_pos);
+ menu->popup();
+ accept_event();
+ }
+
+ if (interp_mode_rect.has_point(pos)) {
+ if (!menu) {
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("id_pressed", this, "_menu_selected");
+ }
+ menu->clear();
+ menu->add_icon_item(get_icon("InterpRaw", "EditorIcons"), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
+ menu->add_icon_item(get_icon("InterpLinear", "EditorIcons"), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
+ menu->add_icon_item(get_icon("InterpCubic", "EditorIcons"), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
+ menu->set_as_minsize();
+
+ Vector2 popup_pos = get_global_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
+ menu->set_global_position(popup_pos);
+ menu->popup();
+ accept_event();
+ }
+
+ if (loop_mode_rect.has_point(pos)) {
+ if (!menu) {
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("id_pressed", this, "_menu_selected");
+ }
+ menu->clear();
+ menu->add_icon_item(get_icon("InterpWrapClamp", "EditorIcons"), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
+ menu->add_icon_item(get_icon("InterpWrapLoop", "EditorIcons"), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
+ menu->set_as_minsize();
+
+ Vector2 popup_pos = get_global_position() + loop_mode_rect.position + Vector2(0, loop_mode_rect.size.height);
+ menu->set_global_position(popup_pos);
+ menu->popup();
+ accept_event();
+ }
+
+ if (remove_rect.has_point(pos)) {
+ emit_signal("remove_request", track);
+ accept_event();
+ }
+
+ if (bezier_edit_rect.has_point(pos)) {
+ emit_signal("bezier_edit");
+ accept_event();
+ }
+
+ //check keyframes
+
+ float scale = timeline->get_zoom_scale();
+ int limit = timeline->get_name_limit();
+ int limit_end = get_size().width - timeline->get_buttons_width();
+
+ if (pos.x >= limit && pos.x <= limit_end) {
+
+ int key_idx = -1;
+ float key_distance = 1e20;
+
+ for (int i = animation->track_get_key_count(track) - 1; i >= 0; i--) { //select should happen in the opposite order of drawing for more accurate overlap select
+
+ Rect2 rect = get_key_rect(i, scale);
+ float offset = animation->track_get_key_time(track, i) - timeline->get_value();
+ offset = offset * scale + limit;
+ rect.position.x += offset;
+
+ if (rect.has_point(pos)) {
+
+ if (is_key_selectable_by_distance()) {
+ float distance = ABS(offset - pos.x);
+ if (key_idx == -1 || distance < key_distance) {
+ key_idx = i;
+ key_distance = distance;
+ }
+ } else {
+ //first one does it
+ key_idx = i;
+ break;
+ }
+ }
+ }
+
+ if (key_idx != -1) {
+ if (mb->get_command() || mb->get_shift()) {
+ if (editor->is_key_selected(track, key_idx)) {
+ emit_signal("deselect_key", key_idx);
+
+ } else {
+ emit_signal("select_key", key_idx, false);
+ moving_selection_attempt = true;
+ select_single_attempt = -1;
+ moving_selection_from_ofs = (mb->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale();
+ }
+ } else {
+ if (!editor->is_key_selected(track, key_idx)) {
+ emit_signal("select_key", key_idx, true);
+ select_single_attempt = -1;
+ } else {
+ select_single_attempt = key_idx;
+ }
+
+ moving_selection_attempt = true;
+ moving_selection_from_ofs = (mb->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale();
+ }
+ accept_event();
+ } else {
+ emit_signal("clear_selection");
+ }
+ }
+
+ /*using focus instead
+ * if (!selected && pos.x >= timeline->get_name_limit() && pos.x < (get_size().width - timeline->get_buttons_width())) {
+ set_selected(true);
+ emit_signal("selected");
+ }
+ */
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
+ Point2 pos = mb->get_position();
+ if (pos.x >= timeline->get_name_limit() && pos.x <= get_size().width - timeline->get_buttons_width()) {
+ //can do something with menu too! show insert key
+ float offset = (pos.x - timeline->get_name_limit()) / timeline->get_zoom_scale();
+ if (!menu) {
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("id_pressed", this, "_menu_selected");
+ }
+
+ menu->clear();
+ menu->add_icon_item(get_icon("Key", "EditorIcons"), TTR("Insert Key"), MENU_KEY_INSERT);
+ if (editor->is_selection_active()) {
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE);
+ menu->add_separator();
+ menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Key(s)"), MENU_KEY_DELETE);
+ }
+ menu->set_as_minsize();
+
+ Vector2 popup_pos = get_global_transform().xform(get_local_mouse_position());
+ menu->set_global_position(popup_pos);
+ menu->popup();
+
+ insert_at_pos = offset + timeline->get_value();
+ accept_event();
+ }
+ }
+
+ if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && clicking_on_name) {
+
+ if (!path) {
+ path = memnew(LineEdit);
+ add_child(path);
+ path->set_as_toplevel(true);
+ path->connect("text_entered", this, "_path_entered");
+ }
+
+ path->set_text(animation->track_get_path(track));
+ Vector2 theme_ofs = path->get_stylebox("normal", "LineEdit")->get_offset();
+ path->set_position(get_global_position() + path_rect.position - theme_ofs);
+ path->set_size(path_rect.size);
+ path->show_modal();
+ path->grab_focus();
+ path->set_cursor_position(path->get_text().length());
+ clicking_on_name = false;
+ }
+
+ if (mb.is_valid() && moving_selection_attempt) {
+
+ if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ moving_selection_attempt = false;
+ if (moving_selection) {
+ emit_signal("move_selection_commit");
+ } else if (select_single_attempt != -1) {
+ emit_signal("select_key", select_single_attempt, true);
+ }
+ moving_selection = false;
+ select_single_attempt = -1;
+ }
+
+ if (moving_selection && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
+
+ moving_selection_attempt = false;
+ moving_selection = false;
+ emit_signal("move_selection_cancel");
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT && moving_selection_attempt) {
+
+ if (!moving_selection) {
+ moving_selection = true;
+ emit_signal("move_selection_begin");
+ }
+
+ float new_ofs = (mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale();
+ emit_signal("move_selection", new_ofs - moving_selection_from_ofs);
+ }
+}
+
+Variant AnimationTrackEdit::get_drag_data(const Point2 &p_point) {
+
+ if (!clicking_on_name)
+ return Variant();
+
+ Dictionary drag_data;
+ drag_data["type"] = "animation_track";
+ drag_data["index"] = track;
+
+ ToolButton *tb = memnew(ToolButton);
+ tb->set_text(path_cache);
+ tb->set_icon(icon_cache);
+ set_drag_preview(tb);
+
+ clicking_on_name = false;
+
+ return drag_data;
+}
+
+bool AnimationTrackEdit::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
+
+ Dictionary d = p_data;
+ if (!d.has("type")) {
+ return false;
+ }
+
+ String type = d["type"];
+ if (type != "animation_track")
+ return false;
+
+ if (p_point.y < get_size().height / 2) {
+ dropping_at = -1;
+ } else {
+ dropping_at = 1;
+ }
+
+ const_cast<AnimationTrackEdit *>(this)->update();
+ const_cast<AnimationTrackEdit *>(this)->emit_signal("drop_attempted", track);
+
+ return true;
+}
+void AnimationTrackEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
+
+ Dictionary d = p_data;
+ if (!d.has("type")) {
+ return;
+ }
+
+ String type = d["type"];
+ if (type != "animation_track")
+ return;
+
+ int from_track = d["index"];
+
+ if (dropping_at < 0) {
+ emit_signal("dropped", from_track, track);
+ } else {
+ emit_signal("dropped", from_track, track + 1);
+ }
+}
+
+void AnimationTrackEdit::_menu_selected(int p_index) {
+
+ switch (p_index) {
+ case MENU_CALL_MODE_CONTINUOUS:
+ case MENU_CALL_MODE_DISCRETE:
+ case MENU_CALL_MODE_TRIGGER:
+ case MENU_CALL_MODE_CAPTURE: {
+
+ Animation::UpdateMode update_mode = Animation::UpdateMode(p_index);
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Change animation update mode");
+ undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", track, update_mode);
+ undo_redo->add_undo_method(animation.ptr(), "value_track_set_update_mode", track, animation->value_track_get_update_mode(track));
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+ update();
+
+ } break;
+ case MENU_INTERPOLATION_NEAREST:
+ case MENU_INTERPOLATION_LINEAR:
+ case MENU_INTERPOLATION_CUBIC: {
+
+ Animation::InterpolationType interp_mode = Animation::InterpolationType(p_index - MENU_INTERPOLATION_NEAREST);
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Change animation interpolation mode");
+ undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_type", track, interp_mode);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_type", track, animation->track_get_interpolation_type(track));
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+ update();
+ } break;
+ case MENU_LOOP_WRAP:
+ case MENU_LOOP_CLAMP: {
+
+ bool loop_wrap = p_index == MENU_LOOP_WRAP;
+ *block_animation_update_ptr = true;
+ undo_redo->create_action("Change animation loop mode");
+ undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_loop_wrap", track, loop_wrap);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_loop_wrap", track, animation->track_get_interpolation_loop_wrap(track));
+ undo_redo->commit_action();
+ *block_animation_update_ptr = false;
+ update();
+
+ } break;
+ case MENU_KEY_INSERT: {
+ emit_signal("insert_key", insert_at_pos);
+ } break;
+ case MENU_KEY_DUPLICATE: {
+ emit_signal("duplicate_request");
+
+ } break;
+ case MENU_KEY_DELETE: {
+ emit_signal("delete_request");
+
+ } break;
+ }
+}
+
+void AnimationTrackEdit::set_block_animation_update_ptr(bool *p_block_ptr) {
+ block_animation_update_ptr = p_block_ptr;
+}
+
+void AnimationTrackEdit::cancel_drop() {
+ if (dropping_at != 0) {
+ dropping_at = 0;
+ update();
+ }
+}
+void AnimationTrackEdit::set_in_group(bool p_enable) {
+ in_group = p_enable;
+ update();
+}
+
+void AnimationTrackEdit::append_to_selection(const Rect2 &p_box) {
+
+ Rect2 select_rect(timeline->get_name_limit(), 0, get_size().width - timeline->get_name_limit() - timeline->get_buttons_width(), get_size().height);
+ select_rect = select_rect.clip(p_box);
+
+ for (int i = animation->track_get_key_count(track) - 1; i >= 0; i--) { //select should happen in the opposite order of drawing for more accurate overlap select
+
+ Rect2 rect = const_cast<AnimationTrackEdit *>(this)->get_key_rect(i, timeline->get_zoom_scale());
+ float offset = animation->track_get_key_time(track, i) - timeline->get_value();
+ offset = offset * timeline->get_zoom_scale() + timeline->get_name_limit();
+ rect.position.x += offset;
+
+ if (select_rect.intersects(rect)) {
+ emit_signal("select_key", i, false);
+ }
+ }
+}
+
+void AnimationTrackEdit::_bind_methods() {
+
+ ClassDB::bind_method("_zoom_changed", &AnimationTrackEdit::_zoom_changed);
+ ClassDB::bind_method("_menu_selected", &AnimationTrackEdit::_menu_selected);
+ ClassDB::bind_method("_gui_input", &AnimationTrackEdit::_gui_input);
+ ClassDB::bind_method("_path_entered", &AnimationTrackEdit::_path_entered);
+ ClassDB::bind_method("_play_position_draw", &AnimationTrackEdit::_play_position_draw);
+
+ ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
+ ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
+ ADD_SIGNAL(MethodInfo("dropped", PropertyInfo(Variant::INT, "from_track"), PropertyInfo(Variant::INT, "to_track")));
+ ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::REAL, "ofs")));
+ ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single")));
+ ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index")));
+ ADD_SIGNAL(MethodInfo("clear_selection"));
+ ADD_SIGNAL(MethodInfo("bezier_edit"));
+
+ ADD_SIGNAL(MethodInfo("move_selection_begin"));
+ ADD_SIGNAL(MethodInfo("move_selection", PropertyInfo(Variant::REAL, "ofs")));
+ ADD_SIGNAL(MethodInfo("move_selection_commit"));
+ ADD_SIGNAL(MethodInfo("move_selection_cancel"));
+
+ ADD_SIGNAL(MethodInfo("duplicate_request"));
+ ADD_SIGNAL(MethodInfo("duplicate_transpose_request"));
+ ADD_SIGNAL(MethodInfo("delete_request"));
+}
+
+AnimationTrackEdit::AnimationTrackEdit() {
+ undo_redo = NULL;
+ timeline = NULL;
+ root = NULL;
+ path = NULL;
+ menu = NULL;
+ block_animation_update_ptr = NULL;
+ clicking_on_name = false;
+ dropping_at = 0;
+
+ in_group = false;
+
+ moving_selection_attempt = false;
+ moving_selection = false;
+ select_single_attempt = -1;
+
+ play_position_pos = 0;
+ play_position = memnew(Control);
+ play_position->set_mouse_filter(MOUSE_FILTER_PASS);
+ add_child(play_position);
+ play_position->set_anchors_and_margins_preset(PRESET_WIDE);
+ play_position->connect("draw", this, "_play_position_draw");
+ set_focus_mode(FOCUS_CLICK);
+ set_mouse_filter(MOUSE_FILTER_PASS); //scroll has to work too for selection
+}
+
+//////////////////////////////////////
+
+AnimationTrackEdit *AnimationTrackEditPlugin::create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage) {
+ if (get_script_instance()) {
+ Variant args[6] = {
+ p_object,
+ p_type,
+ p_property,
+ p_hint,
+ p_hint_string,
+ p_usage
+ };
+
+ Variant *argptrs[6] = {
+ &args[0],
+ &args[1],
+ &args[2],
+ &args[3],
+ &args[4],
+ &args[5]
+ };
+
+ Variant::CallError ce;
+ return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_value_track_edit", (const Variant **)&argptrs, 6, ce).operator Object *());
+ }
+ return NULL;
+}
+
+AnimationTrackEdit *AnimationTrackEditPlugin::create_audio_track_edit() {
+
+ if (get_script_instance()) {
+ return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_audio_track_edit").operator Object *());
+ }
+ return NULL;
+}
+
+AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object *p_object) {
+ if (get_script_instance()) {
+ return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_animation_track_edit", p_object).operator Object *());
+ }
+ return NULL;
+}
+
+///////////////////////////////////////
+
+void AnimationTrackEditGroup::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_DRAW) {
+ Ref<Font> font = get_font("font", "Label");
+ int separation = get_constant("hseparation", "ItemList");
+ Color color = get_color("font_color", "Label");
+
+ if (root && root->has_node(node)) {
+ Node *n = root->get_node(node);
+ if (n && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
+ color = get_color("accent_color", "Editor");
+ }
+ }
+
+ Color bgcol = get_color("dark_color_2", "Editor");
+ bgcol.a *= 0.6;
+ draw_rect(Rect2(Point2(), get_size()), bgcol);
+ Color linecolor = color;
+ linecolor.a = 0.2;
+
+ draw_line(Point2(), Point2(get_size().width, 0), linecolor);
+ draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), linecolor);
+ draw_line(Point2(get_size().width - timeline->get_buttons_width(), 0), Point2(get_size().width - timeline->get_buttons_width(), get_size().height), linecolor);
+
+ int ofs = 0;
+ draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
+ ofs += separation + icon->get_width();
+ draw_string(font, Point2(ofs, int(get_size().height - font->get_height()) / 2 + font->get_ascent()), node_name, color, timeline->get_name_limit() - ofs);
+
+ int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit();
+
+ if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_line(Point2(px, 0), Point2(px, get_size().height), accent);
+ }
+ }
+}
+
+void AnimationTrackEditGroup::set_type_and_name(const Ref<Texture> &p_type, const String &p_name, const NodePath &p_node) {
+ icon = p_type;
+ node_name = p_name;
+ node = p_node;
+ update();
+ minimum_size_changed();
+}
+
+Size2 AnimationTrackEditGroup::get_minimum_size() const {
+
+ Ref<Font> font = get_font("font", "Label");
+ int separation = get_constant("vseparation", "ItemList");
+
+ return Vector2(0, MAX(font->get_height(), icon->get_height()) + separation);
+}
+
+void AnimationTrackEditGroup::set_timeline(AnimationTimelineEdit *p_timeline) {
+ timeline = p_timeline;
+ timeline->connect("zoom_changed", this, "_zoom_changed");
+ timeline->connect("name_limit_changed", this, "_zoom_changed");
+}
+
+void AnimationTrackEditGroup::set_root(Node *p_root) {
+ root = p_root;
+ update();
+}
+
+void AnimationTrackEditGroup::_zoom_changed() {
+ update();
+}
+
+void AnimationTrackEditGroup::_bind_methods() {
+ ClassDB::bind_method("_zoom_changed", &AnimationTrackEditGroup::_zoom_changed);
+}
+
+AnimationTrackEditGroup::AnimationTrackEditGroup() {
+ set_mouse_filter(MOUSE_FILTER_PASS);
+}
+
+//////////////////////////////////////
+
+void AnimationTrackEditor::add_track_edit_plugin(const Ref<AnimationTrackEditPlugin> &p_plugin) {
+
+ if (track_edit_plugins.find(p_plugin) != -1)
+ return;
+ track_edit_plugins.push_back(p_plugin);
+}
+
+void AnimationTrackEditor::remove_track_edit_plugin(const Ref<AnimationTrackEditPlugin> &p_plugin) {
+
+ track_edit_plugins.erase(p_plugin);
+}
+
+void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim) {
+
+ if (animation != p_anim && _get_track_selected() >= 0) {
+ track_edits[_get_track_selected()]->release_focus();
+ }
+ if (animation.is_valid()) {
+ animation->disconnect("changed", this, "_animation_changed");
+ _clear_selection();
+ }
+ animation = p_anim;
+ timeline->set_animation(p_anim);
+
+ _cancel_bezier_edit();
+ _update_tracks();
+
+ if (animation.is_valid()) {
+ animation->connect("changed", this, "_animation_changed");
+
+ step->set_block_signals(true);
+ step->set_value(animation->get_step());
+ step->set_block_signals(false);
+ step->set_read_only(false);
+ snap->set_disabled(false);
+ } else {
+ step->set_block_signals(true);
+ step->set_value(0);
+ step->set_block_signals(false);
+ step->set_read_only(true);
+ snap->set_disabled(true);
+ }
+}
+
+Ref<Animation> AnimationTrackEditor::get_current_animation() const {
+
+ return animation;
+}
+void AnimationTrackEditor::_root_removed(Node *p_root) {
+ root = NULL;
+}
+
+void AnimationTrackEditor::set_root(Node *p_root) {
+ if (root) {
+ root->disconnect("tree_exiting", this, "_root_removed");
+ }
+
+ root = p_root;
+
+ if (root) {
+ root->connect("tree_exiting", this, "_root_removed", make_binds(), CONNECT_ONESHOT);
+ }
+
+ _update_tracks();
+}
+
+Node *AnimationTrackEditor::get_root() const {
+
+ return root;
+}
+
+void AnimationTrackEditor::update_keying() {
+ bool keying_enabled = is_visible_in_tree() && animation.is_valid();
+
+ if (keying_enabled == keying)
+ return;
+
+ keying = keying_enabled;
+ //_update_menu();
+ emit_signal("keying_changed");
+}
+
+bool AnimationTrackEditor::has_keying() const {
+ return keying;
+}
+
+void AnimationTrackEditor::cleanup() {
+ set_animation(Ref<Animation>());
+}
+
+void AnimationTrackEditor::_name_limit_changed() {
+
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+}
+
+void AnimationTrackEditor::_timeline_changed(float p_new_pos, bool p_drag) {
+
+ emit_signal("timeline_changed", p_new_pos, p_drag);
+}
+
+void AnimationTrackEditor::_track_remove_request(int p_track) {
+
+ int idx = p_track;
+ if (idx >= 0 && idx < animation->get_track_count()) {
+ _clear_selection();
+ undo_redo->create_action(TTR("Remove Anim Track"));
+ undo_redo->add_do_method(animation.ptr(), "remove_track", idx);
+ undo_redo->add_undo_method(animation.ptr(), "add_track", animation->track_get_type(idx), idx);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_path", idx, animation->track_get_path(idx));
+ //todo interpolation
+ for (int i = 0; i < animation->track_get_key_count(idx); i++) {
+
+ Variant v = animation->track_get_key_value(idx, i);
+ float time = animation->track_get_key_time(idx, i);
+ float trans = animation->track_get_key_transition(idx, i);
+
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", idx, time, v);
+ undo_redo->add_undo_method(animation.ptr(), "track_set_key_transition", idx, i, trans);
+ }
+
+ undo_redo->add_undo_method(animation.ptr(), "track_set_interpolation_type", idx, animation->track_get_interpolation_type(idx));
+ if (animation->track_get_type(idx) == Animation::TYPE_VALUE) {
+ undo_redo->add_undo_method(animation.ptr(), "value_track_set_update_mode", idx, animation->value_track_get_update_mode(idx));
+ }
+
+ undo_redo->commit_action();
+ }
+}
+
+void AnimationTrackEditor::set_anim_pos(float p_pos) {
+
+ timeline->set_play_position(p_pos);
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->set_play_position(p_pos);
+ }
+ for (int i = 0; i < groups.size(); i++) {
+ groups[i]->update();
+ }
+ bezier_edit->set_play_position(p_pos);
+}
+
+void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
+
+ if (insert_frame != Engine::get_singleton()->get_frames_drawn()) {
+ //clear insert list for the frame if frame changed
+ if (insert_confirm->is_visible_in_tree())
+ return; //do nothing
+ insert_data.clear();
+ insert_query = false;
+ }
+ insert_frame = Engine::get_singleton()->get_frames_drawn();
+
+ for (List<InsertData>::Element *E = insert_data.front(); E; E = E->next()) {
+ //prevent insertion of multiple tracks
+ if (E->get().path == p_id.path)
+ return; //already inserted a track for this on this frame
+ }
+
+ insert_data.push_back(p_id);
+
+ if (p_id.track_idx == -1) {
+ if (bool(EDITOR_DEF("editors/animation/confirm_insert_track", true))) {
+ //potential new key, does not exist
+ if (insert_data.size() == 1)
+ insert_confirm_text->set_text(vformat(TTR("Create NEW track for %s and insert key?"), p_id.query));
+ else
+ insert_confirm_text->set_text(vformat(TTR("Create %d NEW tracks and insert keys?"), insert_data.size()));
+
+ bool all_bezier = true;
+ for (int i = 0; i < insert_data.size(); i++) {
+ if (insert_data[i].type != Animation::TYPE_VALUE && insert_data[i].type != Animation::TYPE_BEZIER) {
+ all_bezier = false;
+ }
+
+ if (insert_data[i].type != Animation::TYPE_VALUE) {
+ continue;
+ }
+ switch (insert_data[i].value.get_type()) {
+ case Variant::INT:
+ case Variant::REAL:
+ case Variant::VECTOR2:
+ case Variant::VECTOR3:
+ case Variant::QUAT:
+ case Variant::PLANE:
+ case Variant::COLOR: {
+ //good
+ } break;
+ default: {
+ all_bezier = false;
+ }
+ }
+ }
+
+ insert_confirm_bezier->set_visible(all_bezier);
+ insert_confirm->get_ok()->set_text(TTR("Create"));
+ insert_confirm->popup_centered_minsize();
+ insert_query = true;
+ } else {
+ call_deferred("_insert_delay");
+ insert_queue = true;
+ }
+
+ } else {
+ if (!insert_query && !insert_queue) {
+ call_deferred("_insert_delay");
+ insert_queue = true;
+ }
+ }
+}
+
+void AnimationTrackEditor::_insert_delay() {
+
+ if (insert_query) {
+ //discard since it's entered into query mode
+ insert_queue = false;
+ return;
+ }
+
+ undo_redo->create_action(TTR("Anim Insert"));
+
+ int last_track = animation->get_track_count();
+ bool advance = false;
+ while (insert_data.size()) {
+
+ if (insert_data.front()->get().advance)
+ advance = true;
+ last_track = _confirm_insert(insert_data.front()->get(), last_track);
+ insert_data.pop_front();
+ }
+
+ undo_redo->commit_action();
+
+ if (advance) {
+ float step = animation->get_step();
+ if (step == 0)
+ step = 1;
+
+ float pos = timeline->get_play_position();
+
+ pos = Math::stepify(pos + step, step);
+ if (pos > animation->get_length())
+ pos = animation->get_length();
+ set_anim_pos(pos);
+ emit_signal("timeline_changed", pos, true);
+ }
+ insert_queue = false;
+}
+
+void AnimationTrackEditor::insert_transform_key(Spatial *p_node, const String &p_sub, const Transform &p_xform) {
+
+ if (!keying)
+ return;
+ if (!animation.is_valid())
+ return;
+
+ ERR_FAIL_COND(!root);
+ //let's build a node path
+ String path = root->get_path_to(p_node);
+ if (p_sub != "")
+ path += ":" + p_sub;
+
+ NodePath np = path;
+
+ int track_idx = -1;
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ if (animation->track_get_type(i) != Animation::TYPE_TRANSFORM)
+ continue;
+ if (animation->track_get_path(i) != np)
+ continue;
+
+ track_idx = i;
+ break;
+ }
+
+ InsertData id;
+ Dictionary val;
+
+ id.path = np;
+ id.track_idx = track_idx;
+ id.value = p_xform;
+ id.type = Animation::TYPE_TRANSFORM;
+ id.query = "node '" + p_node->get_name() + "'";
+ id.advance = false;
+
+ //dialog insert
+
+ _query_insert(id);
+}
+
+void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant &p_value) {
+
+ String path = p_path;
+
+ //animation property is a special case, always creates an animation track
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ String np = animation->track_get_path(i);
+
+ if (path == np && animation->track_get_type(i) == Animation::TYPE_ANIMATION) {
+ //exists
+ InsertData id;
+ id.path = path;
+ id.track_idx = i;
+ id.value = p_value;
+ id.type = Animation::TYPE_ANIMATION;
+ id.query = "animation";
+ id.advance = false;
+ //dialog insert
+ _query_insert(id);
+ return;
+ }
+ }
+
+ InsertData id;
+ id.path = path;
+ id.track_idx = -1;
+ id.value = p_value;
+ id.type = Animation::TYPE_ANIMATION;
+ id.query = "animation";
+ id.advance = false;
+ //dialog insert
+ _query_insert(id);
+}
+
+void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists) {
+
+ ERR_FAIL_COND(!root);
+ //let's build a node path
+
+ Node *node = p_node;
+
+ String path = root->get_path_to(node);
+
+ if (Object::cast_to<AnimationPlayer>(node) && p_property == "current_animation") {
+ if (node == AnimationPlayerEditor::singleton->get_player()) {
+ EditorNode::get_singleton()->show_warning(TTR("AnimationPlayer can't animate itself, only other players."));
+ return;
+ }
+ _insert_animation_key(path, p_value);
+ return;
+ }
+
+ EditorHistory *history = EditorNode::get_singleton()->get_editor_history();
+ for (int i = 1; i < history->get_path_size(); i++) {
+
+ String prop = history->get_path_property(i);
+ ERR_FAIL_COND(prop == "");
+ path += ":" + prop;
+ }
+
+ path += ":" + p_property;
+
+ NodePath np = path;
+
+ //locate track
+
+ bool inserted = false;
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ if (animation->track_get_type(i) == Animation::TYPE_VALUE) {
+ if (animation->track_get_path(i) != np)
+ continue;
+
+ InsertData id;
+ id.path = np;
+ id.track_idx = i;
+ id.value = p_value;
+ id.type = Animation::TYPE_VALUE;
+ id.query = "property '" + p_property + "'";
+ id.advance = false;
+ //dialog insert
+ _query_insert(id);
+ inserted = true;
+ } else if (animation->track_get_type(i) == Animation::TYPE_BEZIER) {
+
+ Variant value;
+ if (animation->track_get_path(i) == np) {
+ value = p_value; //all good
+ } else {
+ String path = animation->track_get_path(i);
+ if (NodePath(path.get_basename()) == np) {
+ String subindex = path.get_extension();
+ value = p_value.get(subindex);
+ } else {
+ continue;
+ }
+ }
+
+ InsertData id;
+ id.path = animation->track_get_path(i);
+ id.track_idx = i;
+ id.value = value;
+ id.type = Animation::TYPE_BEZIER;
+ id.query = "property '" + p_property + "'";
+ id.advance = false;
+ //dialog insert
+ _query_insert(id);
+ inserted = true;
+ }
+ }
+
+ if (inserted || p_only_if_exists)
+ return;
+ InsertData id;
+ id.path = np;
+ id.track_idx = -1;
+ id.value = p_value;
+ id.type = Animation::TYPE_VALUE;
+ id.query = "property '" + p_property + "'";
+ id.advance = false;
+ //dialog insert
+ _query_insert(id);
+}
+
+void AnimationTrackEditor::insert_value_key(const String &p_property, const Variant &p_value, bool p_advance) {
+
+ EditorHistory *history = EditorNode::get_singleton()->get_editor_history();
+
+ ERR_FAIL_COND(!root);
+ //let's build a node path
+ ERR_FAIL_COND(history->get_path_size() == 0);
+ Object *obj = ObjectDB::get_instance(history->get_path_object(0));
+ ERR_FAIL_COND(!Object::cast_to<Node>(obj));
+
+ Node *node = Object::cast_to<Node>(obj);
+
+ String path = root->get_path_to(node);
+
+ if (Object::cast_to<AnimationPlayer>(node) && p_property == "current_animation") {
+ if (node == AnimationPlayerEditor::singleton->get_player()) {
+ EditorNode::get_singleton()->show_warning(TTR("AnimationPlayer can't animate itself, only other players."));
+ return;
+ }
+ _insert_animation_key(path, p_value);
+ return;
+ }
+
+ for (int i = 1; i < history->get_path_size(); i++) {
+
+ String prop = history->get_path_property(i);
+ ERR_FAIL_COND(prop == "");
+ path += ":" + prop;
+ }
+
+ path += ":" + p_property;
+
+ NodePath np = path;
+
+ //locate track
+
+ bool inserted = false;
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ if (animation->track_get_type(i) == Animation::TYPE_VALUE) {
+ if (animation->track_get_path(i) != np)
+ continue;
+
+ InsertData id;
+ id.path = np;
+ id.track_idx = i;
+ id.value = p_value;
+ id.type = Animation::TYPE_VALUE;
+ id.query = "property '" + p_property + "'";
+ id.advance = p_advance;
+ //dialog insert
+ _query_insert(id);
+ inserted = true;
+ } else if (animation->track_get_type(i) == Animation::TYPE_BEZIER) {
+
+ Variant value;
+ if (animation->track_get_path(i) == np) {
+ value = p_value; //all good
+ } else {
+ String path = animation->track_get_path(i);
+ if (NodePath(path.get_basename()) == np) {
+ String subindex = path.get_extension();
+ value = p_value.get(subindex);
+ } else {
+ continue;
+ }
+ }
+
+ InsertData id;
+ id.path = animation->track_get_path(i);
+ id.track_idx = i;
+ id.value = value;
+ id.type = Animation::TYPE_BEZIER;
+ id.query = "property '" + p_property + "'";
+ id.advance = p_advance;
+ //dialog insert
+ _query_insert(id);
+ inserted = true;
+ }
+ }
+
+ if (!inserted) {
+ InsertData id;
+ id.path = np;
+ id.track_idx = -1;
+ id.value = p_value;
+ id.type = Animation::TYPE_VALUE;
+ id.query = "property '" + p_property + "'";
+ id.advance = p_advance;
+ //dialog insert
+ _query_insert(id);
+ }
+}
+
+void AnimationTrackEditor::_confirm_insert_list() {
+
+ undo_redo->create_action(TTR("Anim Create & Insert"));
+
+ int last_track = animation->get_track_count();
+ while (insert_data.size()) {
+
+ last_track = _confirm_insert(insert_data.front()->get(), last_track, insert_confirm_bezier->is_pressed());
+ insert_data.pop_front();
+ }
+
+ undo_redo->commit_action();
+}
+
+PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val) {
+
+ r_base_path = NodePath();
+ ERR_FAIL_COND_V(!animation.is_valid(), PropertyInfo());
+ ERR_FAIL_INDEX_V(p_idx, animation->get_track_count(), PropertyInfo());
+
+ if (!root) {
+ return PropertyInfo();
+ }
+
+ NodePath path = animation->track_get_path(p_idx);
+
+ if (!root->has_node_and_resource(path)) {
+ return PropertyInfo();
+ }
+
+ RES res;
+ Vector<StringName> leftover_path;
+ Node *node = root->get_node_and_resource(path, res, leftover_path, true);
+
+ if (node) {
+ r_base_path = node->get_path();
+ }
+
+ if (leftover_path.empty()) {
+ if (r_current_val) {
+ if (res.is_valid()) {
+ *r_current_val = res;
+ } else if (node) {
+ *r_current_val = node;
+ }
+ }
+ return PropertyInfo();
+ }
+
+ Variant property_info_base;
+ if (res.is_valid()) {
+ property_info_base = res;
+ if (r_current_val) {
+ *r_current_val = res->get(leftover_path[leftover_path.size() - 1]);
+ }
+ } else if (node) {
+ property_info_base = node;
+ if (r_current_val) {
+ *r_current_val = node->get(leftover_path[leftover_path.size() - 1]);
+ }
+ }
+
+ for (int i = 0; i < leftover_path.size() - 1; i++) {
+ property_info_base = property_info_base.get_named(leftover_path[i]);
+ }
+
+ List<PropertyInfo> pinfo;
+ property_info_base.get_property_list(&pinfo);
+
+ for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
+
+ if (E->get().name == leftover_path[leftover_path.size() - 1]) {
+ return E->get();
+ }
+ }
+
+ return PropertyInfo();
+}
+
+static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool *r_valid = NULL) {
+ Vector<String> subindices;
+ if (r_valid) {
+ *r_valid = true;
+ }
+ switch (p_type) {
+ case Variant::INT: {
+ subindices.push_back("");
+ } break;
+ case Variant::REAL: {
+ subindices.push_back("");
+ } break;
+ case Variant::VECTOR2: {
+ subindices.push_back(".x");
+ subindices.push_back(".y");
+ } break;
+ case Variant::VECTOR3: {
+ subindices.push_back(".x");
+ subindices.push_back(".y");
+ subindices.push_back(".z");
+ } break;
+ case Variant::QUAT: {
+ subindices.push_back(".x");
+ subindices.push_back(".y");
+ subindices.push_back(".z");
+ subindices.push_back(".w");
+ } break;
+ case Variant::COLOR: {
+ subindices.push_back(".r");
+ subindices.push_back(".g");
+ subindices.push_back(".b");
+ subindices.push_back(".a");
+ } break;
+ case Variant::PLANE: {
+ subindices.push_back(".x");
+ subindices.push_back(".y");
+ subindices.push_back(".z");
+ subindices.push_back(".d");
+ } break;
+ default: {
+ if (r_valid) {
+ *r_valid = false;
+ }
+ }
+ }
+
+ return subindices;
+}
+
+int AnimationTrackEditor::_confirm_insert(InsertData p_id, int p_last_track, bool p_create_beziers) {
+
+ if (p_last_track == -1)
+ p_last_track = animation->get_track_count();
+
+ bool created = false;
+ if (p_id.track_idx < 0) {
+
+ if (p_create_beziers && (p_id.value.get_type() == Variant::VECTOR2 ||
+ p_id.value.get_type() == Variant::VECTOR3 ||
+ p_id.value.get_type() == Variant::QUAT ||
+ p_id.value.get_type() == Variant::COLOR ||
+ p_id.value.get_type() == Variant::PLANE)) {
+
+ Vector<String> subindices = _get_bezier_subindices_for_type(p_id.value.get_type());
+
+ for (int i = 0; i < subindices.size(); i++) {
+ InsertData id = p_id;
+ id.type = Animation::TYPE_BEZIER;
+ id.value = p_id.value.get(subindices[i].substr(1, subindices[i].length()));
+ id.path = String(p_id.path) + subindices[i];
+ _confirm_insert(id, p_last_track + i);
+ }
+
+ return p_last_track + subindices.size() - 1;
+ }
+ created = true;
+ undo_redo->create_action(TTR("Anim Insert Track & Key"));
+ Animation::UpdateMode update_mode = Animation::UPDATE_DISCRETE;
+
+ if (p_id.type == Animation::TYPE_VALUE || p_id.type == Animation::TYPE_BEZIER) {
+ //wants a new tack
+
+ {
+ //hack
+ NodePath np;
+ animation->add_track(p_id.type);
+ animation->track_set_path(animation->get_track_count() - 1, p_id.path);
+ PropertyInfo h = _find_hint_for_track(animation->get_track_count() - 1, np);
+ animation->remove_track(animation->get_track_count() - 1); //hack
+
+ if (h.type == Variant::REAL ||
+ h.type == Variant::VECTOR2 ||
+ h.type == Variant::RECT2 ||
+ h.type == Variant::VECTOR3 ||
+ h.type == Variant::AABB ||
+ h.type == Variant::QUAT ||
+ h.type == Variant::COLOR ||
+ h.type == Variant::PLANE ||
+ h.type == Variant::TRANSFORM2D ||
+ h.type == Variant::TRANSFORM) {
+
+ update_mode = Animation::UPDATE_CONTINUOUS;
+ }
+
+ if (h.usage & PROPERTY_USAGE_ANIMATE_AS_TRIGGER) {
+ update_mode = Animation::UPDATE_TRIGGER;
+ }
+ }
+ }
+
+ p_id.track_idx = p_last_track;
+
+ undo_redo->add_do_method(animation.ptr(), "add_track", p_id.type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", p_id.track_idx, p_id.path);
+ if (p_id.type == Animation::TYPE_VALUE)
+ undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", p_id.track_idx, update_mode);
+
+ } else {
+ undo_redo->create_action(TTR("Anim Insert Key"));
+ }
+
+ float time = timeline->get_play_position();
+ Variant value;
+
+ switch (p_id.type) {
+
+ case Animation::TYPE_VALUE: {
+
+ value = p_id.value;
+
+ } break;
+ case Animation::TYPE_TRANSFORM: {
+
+ Transform tr = p_id.value;
+ Dictionary d;
+ d["location"] = tr.origin;
+ d["scale"] = tr.basis.get_scale();
+ d["rotation"] = Quat(tr.basis); //.orthonormalized();
+ value = d;
+ } break;
+ case Animation::TYPE_BEZIER: {
+ Array array;
+ array.resize(5);
+ array[0] = p_id.value;
+ array[1] = -0.25;
+ array[2] = 0;
+ array[3] = 0.25;
+ array[4] = 0;
+ value = array;
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+ value = p_id.value;
+ } break;
+ default: {}
+ }
+
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_id.track_idx, time, value);
+
+ if (created) {
+
+ //just remove the track
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", p_last_track);
+ p_last_track++;
+ } else {
+
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_id.track_idx, time);
+ int existing = animation->track_find_key(p_id.track_idx, time, true);
+ if (existing != -1) {
+ Variant v = animation->track_get_key_value(p_id.track_idx, existing);
+ float trans = animation->track_get_key_transition(p_id.track_idx, existing);
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", p_id.track_idx, time, v, trans);
+ }
+ }
+
+ /*
+ undo_redo->add_do_method(this, "update_tracks");
+ undo_redo->add_undo_method(this, "update");
+ undo_redo->add_do_method(track_editor, "update");
+ undo_redo->add_undo_method(track_editor, "update");
+ undo_redo->add_do_method(track_pos, "update");
+ undo_redo->add_undo_method(track_pos, "update");
+*/
+ undo_redo->commit_action();
+
+ return p_last_track;
+}
+
+void AnimationTrackEditor::show_select_node_warning(bool p_show) {
+}
+
+bool AnimationTrackEditor::is_key_selected(int p_track, int p_key) const {
+
+ SelectedKey sk;
+ sk.key = p_key;
+ sk.track = p_track;
+
+ return selection.has(sk);
+}
+
+bool AnimationTrackEditor::is_selection_active() const {
+ return selection.size();
+}
+
+void AnimationTrackEditor::_update_tracks() {
+
+ int selected = _get_track_selected();
+
+ while (track_vbox->get_child_count()) {
+ memdelete(track_vbox->get_child(0));
+ }
+
+ track_edits.clear();
+ groups.clear();
+
+ if (animation.is_null())
+ return;
+
+ Map<String, VBoxContainer *> group_sort;
+
+ bool use_grouping = !view_group->is_pressed();
+ bool use_filter = selected_filter->is_pressed();
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+ AnimationTrackEdit *track_edit = NULL;
+
+ //find hint and info for plugin
+
+ if (use_filter) {
+ NodePath path = animation->track_get_path(i);
+
+ if (root && root->has_node(path)) {
+ Node *node = root->get_node(path);
+ if (!node) {
+ continue; // no node, no filter
+ }
+ if (!EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
+ continue; //skip track due to not selected
+ }
+ }
+ }
+
+ if (animation->track_get_type(i) == Animation::TYPE_VALUE) {
+
+ NodePath path = animation->track_get_path(i);
+
+ if (root && root->has_node_and_resource(path)) {
+ RES res;
+ Vector<StringName> leftover_path;
+ Node *node = root->get_node_and_resource(path, res, leftover_path, true);
+
+ Object *object = node;
+ if (res.is_valid()) {
+ object = res.ptr();
+ } else {
+ object = node;
+ }
+
+ if (object && !leftover_path.empty()) {
+ //not a property (value track?)
+ PropertyInfo pinfo;
+ pinfo.name = leftover_path[leftover_path.size() - 1];
+ //now let's see if we can get more info about it
+
+ List<PropertyInfo> plist;
+ object->get_property_list(&plist);
+
+ for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
+
+ if (E->get().name == leftover_path[leftover_path.size() - 1]) {
+ pinfo = E->get();
+ break;
+ }
+ }
+
+ for (int j = 0; j < track_edit_plugins.size(); j++) {
+ track_edit = track_edit_plugins[j]->create_value_track_edit(object, pinfo.type, pinfo.name, pinfo.hint, pinfo.hint_string, pinfo.usage);
+ if (track_edit) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (animation->track_get_type(i) == Animation::TYPE_AUDIO) {
+
+ for (int j = 0; j < track_edit_plugins.size(); j++) {
+ track_edit = track_edit_plugins[j]->create_audio_track_edit();
+ if (track_edit) {
+ break;
+ }
+ }
+ }
+
+ if (animation->track_get_type(i) == Animation::TYPE_ANIMATION) {
+ NodePath path = animation->track_get_path(i);
+
+ Node *node = NULL;
+ if (root && root->has_node(path)) {
+ node = root->get_node(path);
+ }
+
+ if (node && Object::cast_to<AnimationPlayer>(node)) {
+ for (int j = 0; j < track_edit_plugins.size(); j++) {
+ track_edit = track_edit_plugins[j]->create_animation_track_edit(node);
+ if (track_edit) {
+ break;
+ }
+ }
+ }
+ }
+
+ if (track_edit == NULL) {
+ //no valid plugin_found
+ track_edit = memnew(AnimationTrackEdit);
+ }
+
+ track_edits.push_back(track_edit);
+
+ if (use_grouping) {
+ String base_path = animation->track_get_path(i);
+ base_path = base_path.get_slice(":", 0); // remove subpath
+
+ if (!group_sort.has(base_path)) {
+ AnimationTrackEditGroup *g = memnew(AnimationTrackEditGroup);
+ Ref<Texture> icon = get_icon("Node", "EditorIcons");
+ String name = base_path;
+ String tooltip;
+ if (root) {
+ Node *n = root->get_node(base_path);
+ if (n) {
+ if (has_icon(n->get_class(), "EditorIcons")) {
+ icon = get_icon(n->get_class(), "EditorIcons");
+ }
+ name = n->get_name();
+ tooltip = root->get_path_to(n);
+ }
+ }
+
+ g->set_type_and_name(icon, name, animation->track_get_path(i));
+ g->set_root(root);
+ g->set_tooltip(tooltip);
+ g->set_timeline(timeline);
+ groups.push_back(g);
+ VBoxContainer *vb = memnew(VBoxContainer);
+ vb->add_constant_override("separation", 0);
+ vb->add_child(g);
+ track_vbox->add_child(vb);
+ group_sort[base_path] = vb;
+ }
+
+ track_edit->set_in_group(true);
+ group_sort[base_path]->add_child(track_edit);
+
+ } else {
+ track_edit->set_in_group(false);
+ track_vbox->add_child(track_edit);
+ }
+
+ track_edit->set_undo_redo(undo_redo);
+ track_edit->set_timeline(timeline);
+ track_edit->set_block_animation_update_ptr(&block_animation_update);
+ track_edit->set_root(root);
+ track_edit->set_animation_and_track(animation, i);
+ track_edit->set_play_position(timeline->get_play_position());
+ track_edit->set_editor(this);
+
+ if (selected == i) {
+ track_edit->grab_focus();
+ }
+
+ track_edit->connect("timeline_changed", this, "_timeline_changed");
+ track_edit->connect("remove_request", this, "_track_remove_request", varray(), CONNECT_DEFERRED);
+ track_edit->connect("dropped", this, "_dropped_track", varray(), CONNECT_DEFERRED);
+ track_edit->connect("insert_key", this, "_insert_key_from_track", varray(i), CONNECT_DEFERRED);
+ track_edit->connect("select_key", this, "_key_selected", varray(i), CONNECT_DEFERRED);
+ track_edit->connect("deselect_key", this, "_key_deselected", varray(i), CONNECT_DEFERRED);
+ track_edit->connect("bezier_edit", this, "_bezier_edit", varray(i), CONNECT_DEFERRED);
+ track_edit->connect("clear_selection", this, "_clear_selection");
+ track_edit->connect("move_selection_begin", this, "_move_selection_begin");
+ track_edit->connect("move_selection", this, "_move_selection");
+ track_edit->connect("move_selection_commit", this, "_move_selection_commit");
+ track_edit->connect("move_selection_cancel", this, "_move_selection_cancel");
+
+ track_edit->connect("duplicate_request", this, "_edit_menu_pressed", varray(EDIT_DUPLICATE_SELECTION), CONNECT_DEFERRED);
+ track_edit->connect("duplicate_transpose_request", this, "_edit_menu_pressed", varray(EDIT_DUPLICATE_TRANSPOSED), CONNECT_DEFERRED);
+ track_edit->connect("delete_request", this, "_edit_menu_pressed", varray(EDIT_DELETE_SELECTION), CONNECT_DEFERRED);
+ }
+}
+
+void AnimationTrackEditor::_animation_changed() {
+
+ timeline->update();
+ timeline->update_values();
+ if (block_animation_update) {
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+ for (int i = 0; i < groups.size(); i++) {
+ groups[i]->update();
+ }
+ } else {
+ _update_tracks();
+ }
+
+ bezier_edit->update();
+
+ step->set_block_signals(true);
+ step->set_value(animation->get_step());
+ step->set_block_signals(false);
+}
+
+MenuButton *AnimationTrackEditor::get_edit_menu() {
+ return edit;
+}
+
+void AnimationTrackEditor::_notification(int p_what) {
+ if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
+
+ zoom_icon->set_texture(get_icon("Zoom", "EditorIcons"));
+ snap->set_icon(get_icon("Snap", "EditorIcons"));
+ view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
+ selected_filter->set_icon(get_icon("AnimationFilter", "EditorIcons"));
+ main_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ }
+
+ if (p_what == NOTIFICATION_READY) {
+ EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", this, "_selection_changed");
+ }
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+
+ update_keying();
+ EditorNode::get_singleton()->update_keying();
+ emit_signal("keying_changed");
+ }
+}
+
+void AnimationTrackEditor::_update_scroll(double) {
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+ for (int i = 0; i < groups.size(); i++) {
+ groups[i]->update();
+ }
+}
+
+void AnimationTrackEditor::_update_step(double p_new_step) {
+
+ undo_redo->create_action("Change animation step");
+ undo_redo->add_do_method(animation.ptr(), "set_step", p_new_step);
+ undo_redo->add_undo_method(animation.ptr(), "set_step", animation->get_step());
+ step->set_block_signals(true);
+ undo_redo->commit_action();
+ step->set_block_signals(false);
+ emit_signal("animation_step_changed", p_new_step);
+}
+
+void AnimationTrackEditor::_update_length(double p_new_len) {
+
+ emit_signal("animation_len_changed", p_new_len);
+}
+
+void AnimationTrackEditor::_dropped_track(int p_from_track, int p_to_track) {
+ if (p_to_track >= track_edits.size()) {
+ p_to_track = track_edits.size() - 1;
+ }
+
+ if (p_from_track == p_to_track)
+ return;
+
+ _clear_selection();
+ undo_redo->create_action("Rearrange tracks");
+ undo_redo->add_do_method(animation.ptr(), "track_swap", p_from_track, p_to_track);
+ undo_redo->add_undo_method(animation.ptr(), "track_swap", p_to_track, p_from_track);
+ undo_redo->commit_action();
+}
+
+void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) {
+
+ ERR_FAIL_COND(!root);
+ Node *node = get_node(p_path);
+ ERR_FAIL_COND(!node);
+ NodePath path_to = root->get_path_to(node);
+
+ if (adding_track_type == Animation::TYPE_TRANSFORM && !node->is_class("Spatial")) {
+ EditorNode::get_singleton()->show_warning(TTR("Transform tracks only apply to Spatial-based nodes."));
+ return;
+ }
+
+ switch (adding_track_type) {
+ case Animation::TYPE_VALUE: {
+ adding_track_path = path_to;
+ prop_selector->set_type_filter(Vector<Variant::Type>());
+ prop_selector->select_property_from_instance(node);
+ } break;
+ case Animation::TYPE_TRANSFORM:
+ case Animation::TYPE_METHOD: {
+
+ undo_redo->create_action("Add Track");
+ undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), path_to);
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
+ undo_redo->commit_action();
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ Vector<Variant::Type> filter;
+ filter.push_back(Variant::INT);
+ filter.push_back(Variant::REAL);
+ filter.push_back(Variant::VECTOR2);
+ filter.push_back(Variant::VECTOR3);
+ filter.push_back(Variant::QUAT);
+ filter.push_back(Variant::PLANE);
+ filter.push_back(Variant::COLOR);
+
+ adding_track_path = path_to;
+ prop_selector->set_type_filter(filter);
+ prop_selector->select_property_from_instance(node);
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ if (!node->is_class("AudioStreamPlayer") && !node->is_class("AudioStreamPlayer2D") && !node->is_class("AudioStreamPlayer3D")) {
+ EditorNode::get_singleton()->show_warning(TTR("Audio tracks can only point to nodes of type:\n-AudioStreamPlayer\n-AudioStreamPlayer2D\n-AudioStreamPlayer3D"));
+ return;
+ }
+
+ undo_redo->create_action("Add Track");
+ undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), path_to);
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
+ undo_redo->commit_action();
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ if (!node->is_class("AnimationPlayer")) {
+ EditorNode::get_singleton()->show_warning(TTR("Animation tracks can only point to AnimationPlayer nodes."));
+ return;
+ }
+
+ if (node == AnimationPlayerEditor::singleton->get_player()) {
+ EditorNode::get_singleton()->show_warning(TTR("An animation player can't animate itself, only other players."));
+ return;
+ }
+
+ undo_redo->create_action("Add Track");
+ undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), path_to);
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
+ undo_redo->commit_action();
+
+ } break;
+ }
+}
+
+void AnimationTrackEditor::_add_track(int p_type) {
+ if (!root) {
+ EditorNode::get_singleton()->show_warning(TTR("Not possible to add a new track without a root"));
+ return;
+ }
+ adding_track_type = p_type;
+ pick_track->popup_centered_ratio();
+}
+
+void AnimationTrackEditor::_new_track_property_selected(String p_name) {
+
+ String full_path = String(adding_track_path) + ":" + p_name;
+
+ if (adding_track_type == Animation::TYPE_VALUE) {
+
+ Animation::UpdateMode update_mode = Animation::UPDATE_DISCRETE;
+ {
+ //hack
+ NodePath np;
+ animation->add_track(Animation::TYPE_VALUE);
+ animation->track_set_path(animation->get_track_count() - 1, full_path);
+ PropertyInfo h = _find_hint_for_track(animation->get_track_count() - 1, np);
+ animation->remove_track(animation->get_track_count() - 1); //hack
+ if (h.type == Variant::REAL ||
+ h.type == Variant::VECTOR2 ||
+ h.type == Variant::RECT2 ||
+ h.type == Variant::VECTOR3 ||
+ h.type == Variant::AABB ||
+ h.type == Variant::QUAT ||
+ h.type == Variant::COLOR ||
+ h.type == Variant::PLANE ||
+ h.type == Variant::TRANSFORM2D ||
+ h.type == Variant::TRANSFORM) {
+
+ update_mode = Animation::UPDATE_CONTINUOUS;
+ }
+
+ if (h.usage & PROPERTY_USAGE_ANIMATE_AS_TRIGGER) {
+ update_mode = Animation::UPDATE_TRIGGER;
+ }
+ }
+
+ undo_redo->create_action("Add Track");
+ undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), full_path);
+ undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", animation->get_track_count(), update_mode);
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
+ undo_redo->commit_action();
+ } else {
+ Vector<String> subindices;
+ {
+ //hack
+ NodePath np;
+ animation->add_track(Animation::TYPE_VALUE);
+ animation->track_set_path(animation->get_track_count() - 1, full_path);
+ PropertyInfo h = _find_hint_for_track(animation->get_track_count() - 1, np);
+ animation->remove_track(animation->get_track_count() - 1); //hack
+ bool valid;
+ subindices = _get_bezier_subindices_for_type(h.type, &valid);
+ if (!valid) {
+ EditorNode::get_singleton()->show_warning("Invalid track for Bezier (no suitable sub-properties)");
+ return;
+ }
+ }
+
+ undo_redo->create_action("Add Bezier Track");
+ int base_track = animation->get_track_count();
+ for (int i = 0; i < subindices.size(); i++) {
+ undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", base_track + i, full_path + subindices[i]);
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", base_track + i);
+ }
+ undo_redo->commit_action();
+ }
+}
+
+void AnimationTrackEditor::_timeline_value_changed(double) {
+
+ timeline->update_play_position();
+
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ track_edits[i]->update_play_position();
+ }
+
+ for (int i = 0; i < groups.size(); i++) {
+ groups[i]->update();
+ }
+
+ bezier_edit->update();
+ bezier_edit->update_play_position();
+}
+
+int AnimationTrackEditor::_get_track_selected() {
+
+ for (int i = 0; i < track_edits.size(); i++) {
+ if (track_edits[i]->has_focus())
+ return i;
+ }
+
+ return -1;
+}
+
+void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
+
+ ERR_FAIL_INDEX(p_track, animation->get_track_count());
+
+ if (snap->is_pressed() && step->get_value() != 0) {
+ p_ofs = Math::stepify(p_ofs, step->get_value());
+ }
+ while (animation->track_find_key(p_track, p_ofs, true) != -1) { //make sure insertion point is valid
+ p_ofs += 0.001;
+ }
+
+ switch (animation->track_get_type(p_track)) {
+ case Animation::TYPE_TRANSFORM: {
+ if (!root->has_node(animation->track_get_path(p_track))) {
+ EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a key."));
+ return;
+ }
+ Spatial *base = Object::cast_to<Spatial>(root->get_node(animation->track_get_path(p_track)));
+
+ if (!base) {
+ EditorNode::get_singleton()->show_warning(TTR("Track is not of type Spatial, can't insert key"));
+ return;
+ }
+
+ Transform xf = base->get_transform();
+
+ Vector3 loc = xf.get_origin();
+ Vector3 scale = xf.basis.get_scale_local();
+ Quat rot = xf.basis;
+
+ undo_redo->create_action("Add Transform Track Key");
+ undo_redo->add_do_method(animation.ptr(), "transform_track_insert_key", p_track, p_ofs, loc, rot, scale);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_track, p_ofs);
+ undo_redo->commit_action();
+
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ NodePath bp;
+ Variant value;
+ _find_hint_for_track(p_track, bp, &value);
+
+ undo_redo->create_action("Add Track Key");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, value);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_track, p_ofs);
+ undo_redo->commit_action();
+
+ } break;
+ case Animation::TYPE_METHOD: {
+ if (!root->has_node(animation->track_get_path(p_track))) {
+ EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a method key."));
+ return;
+ }
+ Node *base = root->get_node(animation->track_get_path(p_track));
+
+ method_selector->select_method_from_instance(base);
+
+ insert_key_from_track_call_ofs = p_ofs;
+ insert_key_from_track_call_track = p_track;
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ NodePath bp;
+ Variant value;
+ _find_hint_for_track(p_track, bp, &value);
+ Array arr;
+ arr.resize(5);
+ arr[0] = value;
+ arr[1] = -0.25;
+ arr[2] = 0;
+ arr[3] = 0.25;
+ arr[4] = 0;
+
+ undo_redo->create_action("Add Track Key");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, arr);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_track, p_ofs);
+ undo_redo->commit_action();
+
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ Dictionary ak;
+ ak["stream"] = RES();
+ ak["start_offset"] = 0;
+ ak["end_offset"] = 0;
+
+ undo_redo->create_action("Add Track Key");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, ak);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_track, p_ofs);
+ undo_redo->commit_action();
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ StringName anim = "[stop]";
+
+ undo_redo->create_action("Add Track Key");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, anim);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", p_track, p_ofs);
+ undo_redo->commit_action();
+ } break;
+ }
+}
+
+void AnimationTrackEditor::_add_method_key(const String &p_method) {
+
+ if (!root->has_node(animation->track_get_path(insert_key_from_track_call_track))) {
+ EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a method key."));
+ return;
+ }
+ Node *base = root->get_node(animation->track_get_path(insert_key_from_track_call_track));
+
+ List<MethodInfo> minfo;
+ base->get_method_list(&minfo);
+
+ for (List<MethodInfo>::Element *E = minfo.front(); E; E = E->next()) {
+ if (E->get().name == p_method) {
+
+ Dictionary d;
+ d["method"] = p_method;
+ Array params;
+ int first_defarg = E->get().arguments.size() - E->get().default_arguments.size();
+
+ for (int i = 0; i < E->get().arguments.size(); i++) {
+
+ if (i >= first_defarg) {
+ Variant arg = E->get().default_arguments[i - first_defarg];
+ params.push_back(arg);
+ } else {
+ Variant::CallError ce;
+ Variant arg = Variant::construct(E->get().arguments[i].type, NULL, 0, ce);
+ params.push_back(arg);
+ }
+ }
+ d["args"] = params;
+
+ undo_redo->create_action("Add Method Track Key");
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", insert_key_from_track_call_track, insert_key_from_track_call_ofs, d);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", insert_key_from_track_call_track, insert_key_from_track_call_ofs);
+ undo_redo->commit_action();
+
+ return;
+ }
+ }
+
+ EditorNode::get_singleton()->show_warning(TTR("Method not found in object: ") + p_method);
+}
+
+void AnimationTrackEditor::_key_selected(int p_key, bool p_single, int p_track) {
+
+ ERR_FAIL_INDEX(p_track, animation->get_track_count());
+ ERR_FAIL_INDEX(p_key, animation->track_get_key_count(p_track));
+
+ SelectedKey sk;
+ sk.key = p_key;
+ sk.track = p_track;
+
+ if (p_single) {
+ _clear_selection();
+ }
+
+ KeyInfo ki;
+ ki.pos = animation->track_get_key_time(p_track, p_key);
+ selection[sk] = ki;
+
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+
+ _update_key_edit();
+}
+
+void AnimationTrackEditor::_key_deselected(int p_key, int p_track) {
+
+ ERR_FAIL_INDEX(p_track, animation->get_track_count());
+ ERR_FAIL_INDEX(p_key, animation->track_get_key_count(p_track));
+
+ SelectedKey sk;
+ sk.key = p_key;
+ sk.track = p_track;
+
+ selection.erase(sk);
+
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+
+ _update_key_edit();
+}
+
+void AnimationTrackEditor::_move_selection_begin() {
+ moving_selection = true;
+ moving_selection_offset = 0;
+}
+
+void AnimationTrackEditor::_move_selection(float p_offset) {
+ moving_selection_offset = p_offset;
+ if (snap->is_pressed() && step->get_value() != 0) {
+ moving_selection_offset = Math::stepify(moving_selection_offset, step->get_value());
+ }
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+}
+
+struct _AnimMoveRestore {
+
+ int track;
+ float time;
+ Variant key;
+ float transition;
+};
+//used for undo/redo
+
+void AnimationTrackEditor::_clear_key_edit() {
+ if (key_edit) {
+
+#if 0
+ // going back seems like the most comfortable thing to do, but it results
+ // in weird behaviors and crashes, because going back to animation editor
+ // triggers the editor setting up again itself
+
+ bool go_back = false;
+ if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit) {
+ EditorNode::get_singleton()->push_item(NULL);
+ go_back = true;
+ }
+
+ memdelete(key_edit);
+ key_edit = NULL;
+
+ if (go_back) {
+ EditorNode::get_singleton()->get_inspector_dock()->go_back();
+ }
+#else
+ //if key edit is the object being inspected, remove it first
+ if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit) {
+ EditorNode::get_singleton()->push_item(NULL);
+ }
+ //then actually delete it
+ memdelete(key_edit);
+ key_edit = NULL;
+#endif
+ }
+}
+
+void AnimationTrackEditor::_clear_selection() {
+ selection.clear();
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+ _clear_key_edit();
+}
+
+void AnimationTrackEditor::_update_key_edit() {
+
+ _clear_key_edit();
+ if (!animation.is_valid())
+ return;
+ if (selection.size() != 1) {
+ return;
+ }
+
+ key_edit = memnew(AnimationTrackKeyEdit);
+ key_edit->animation = animation;
+ key_edit->track = selection.front()->key().track;
+
+ float ofs = animation->track_get_key_time(key_edit->track, selection.front()->key().key);
+ key_edit->key_ofs = ofs;
+ key_edit->root_path = root;
+
+ NodePath np;
+ key_edit->hint = _find_hint_for_track(key_edit->track, np);
+ key_edit->undo_redo = undo_redo;
+ key_edit->base = np;
+
+ EditorNode::get_singleton()->push_item(key_edit);
+}
+
+void AnimationTrackEditor::_clear_selection_for_anim(const Ref<Animation> &p_anim) {
+
+ if (!(animation == p_anim))
+ return;
+ //selection.clear();
+ _clear_selection();
+}
+
+void AnimationTrackEditor::_select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos) {
+
+ if (!(animation == p_anim))
+ return;
+
+ int idx = animation->track_find_key(p_track, p_pos, true);
+ ERR_FAIL_COND(idx < 0);
+
+ SelectedKey sk;
+ sk.track = p_track;
+ sk.key = idx;
+ KeyInfo ki;
+ ki.pos = p_pos;
+
+ selection.insert(sk, ki);
+}
+
+void AnimationTrackEditor::_move_selection_commit() {
+
+ undo_redo->create_action(TTR("Anim Move Keys"));
+
+ List<_AnimMoveRestore> to_restore;
+
+ float motion = moving_selection_offset;
+ // 1-remove the keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
+ }
+ // 2- remove overlapped keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newtime = E->get().pos + motion;
+ int idx = animation->track_find_key(E->key().track, newtime, true);
+ if (idx == -1)
+ continue;
+ SelectedKey sk;
+ sk.key = idx;
+ sk.track = E->key().track;
+ if (selection.has(sk))
+ continue; //already in selection, don't save
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newtime);
+ _AnimMoveRestore amr;
+
+ amr.key = animation->track_get_key_value(E->key().track, idx);
+ amr.track = E->key().track;
+ amr.time = newtime;
+ amr.transition = animation->track_get_key_transition(E->key().track, idx);
+
+ to_restore.push_back(amr);
+ }
+
+ // 3-move the keys (re insert them)
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newpos = E->get().pos + motion;
+ /*
+ if (newpos<0)
+ continue; //no add at the beginning
+ */
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
+
+ // 4-(undo) remove inserted keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newpos = E->get().pos + motion;
+ /*
+ if (newpos<0)
+ continue; //no remove what no inserted
+ */
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
+ }
+
+ // 5-(undo) reinsert keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
+
+ // 6-(undo) reinsert overlapped keys
+ for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+
+ _AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
+ }
+
+ // 6-(undo) reinsert overlapped keys
+ for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+
+ _AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
+ }
+
+ undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
+
+ // 7-reselect
+
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float oldpos = E->get().pos;
+ float newpos = oldpos + motion;
+ //if (newpos>=0)
+ undo_redo->add_do_method(this, "_select_at_anim", animation, E->key().track, newpos);
+ undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, oldpos);
+ }
+
+ undo_redo->commit_action();
+
+ moving_selection = false;
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+}
+void AnimationTrackEditor::_move_selection_cancel() {
+
+ moving_selection = false;
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+}
+
+bool AnimationTrackEditor::is_moving_selection() const {
+ return moving_selection;
+}
+float AnimationTrackEditor::get_moving_selection_offset() const {
+ return moving_selection_offset;
+}
+
+void AnimationTrackEditor::_box_selection_draw() {
+
+ Color color = get_color("accent_color", "Editor");
+ color.a = 0.2;
+ Rect2 rect = Rect2(Point2(), box_selection->get_size());
+ box_selection->draw_rect(rect, color);
+}
+
+void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
+
+ timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
+ scroll->accept_event();
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_UP) {
+
+ timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
+ scroll->accept_event();
+ }
+
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed()) {
+ box_selecting = true;
+ box_selecting_from = scroll->get_global_transform().xform(mb->get_position());
+ box_select_rect = Rect2();
+ } else if (box_selecting) {
+
+ if (box_selection->is_visible_in_tree()) {
+ //only if moved
+ for (int i = 0; i < track_edits.size(); i++) {
+
+ Rect2 local_rect = box_select_rect;
+ local_rect.position -= track_edits[i]->get_global_position();
+ track_edits[i]->append_to_selection(local_rect);
+ }
+
+ if (_get_track_selected() == -1 && track_edits.size() > 0) { //minimal hack to make shortcuts work
+ track_edits[track_edits.size() - 1]->grab_focus();
+ }
+ } else {
+ _clear_selection(); //clear it
+ }
+
+ box_selection->hide();
+ box_selecting = false;
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
+
+ timeline->set_value(timeline->get_value() - mm->get_relative().x / timeline->get_zoom_scale());
+ }
+
+ if (mm.is_valid() && box_selecting) {
+
+ if (!(mm->get_button_mask() & BUTTON_MASK_LEFT)) {
+ //no longer
+ box_selection->hide();
+ box_selecting = false;
+ return;
+ }
+
+ if (!box_selection->is_visible_in_tree()) {
+ if (!mm->get_shift()) {
+ _clear_selection(); //only append if shift is pressed
+ }
+ box_selection->show();
+ }
+
+ Vector2 from = box_selecting_from;
+ Vector2 to = scroll->get_global_transform().xform(mm->get_position());
+
+ if (from.x > to.x) {
+ SWAP(from.x, to.x);
+ }
+
+ if (from.y > to.y) {
+ SWAP(from.y, to.y);
+ }
+
+ Rect2 rect(from, to - from);
+ Rect2 scroll_rect = Rect2(scroll->get_global_position(), scroll->get_size());
+ rect = scroll_rect.clip(rect);
+ box_selection->set_position(rect.position);
+ box_selection->set_size(rect.size);
+
+ box_select_rect = rect;
+
+ if (get_local_mouse_position().y < 0) {
+ //avoid box selection from going up and lose focus to viewport
+ warp_mouse(Vector2(mm->get_position().x, 0));
+ }
+ }
+}
+
+void AnimationTrackEditor::_cancel_bezier_edit() {
+ bezier_edit->hide();
+ scroll->show();
+}
+
+void AnimationTrackEditor::_bezier_edit(int p_for_track) {
+
+ _clear_selection(); //bezier probably wants to use a separate selection mode
+ bezier_edit->set_root(root);
+ bezier_edit->set_animation_and_track(animation, p_for_track);
+ scroll->hide();
+ bezier_edit->show();
+ //search everything within the track and curve- edit it
+}
+
+void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) {
+ //duplicait!
+ if (selection.size() && animation.is_valid() && (!transpose || (_get_track_selected() >= 0 && _get_track_selected() < animation->get_track_count()))) {
+
+ int top_track = 0x7FFFFFFF;
+ float top_time = 1e10;
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ const SelectedKey &sk = E->key();
+
+ float t = animation->track_get_key_time(sk.track, sk.key);
+ if (t < top_time)
+ top_time = t;
+ if (sk.track < top_track)
+ top_track = sk.track;
+ }
+ ERR_FAIL_COND(top_track == 0x7FFFFFFF || top_time == 1e10);
+
+ //
+
+ int start_track = transpose ? _get_track_selected() : top_track;
+
+ undo_redo->create_action(TTR("Anim Duplicate Keys"));
+
+ List<Pair<int, float> > new_selection_values;
+
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ const SelectedKey &sk = E->key();
+
+ float t = animation->track_get_key_time(sk.track, sk.key);
+
+ float dst_time = t + (timeline->get_play_position() - top_time);
+ int dst_track = sk.track + (start_track - top_track);
+
+ if (dst_track < 0 || dst_track >= animation->get_track_count())
+ continue;
+
+ if (animation->track_get_type(dst_track) != animation->track_get_type(sk.track))
+ continue;
+
+ int existing_idx = animation->track_find_key(dst_track, dst_time, true);
+
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", dst_track, dst_time, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", dst_track, dst_time);
+
+ Pair<int, float> p;
+ p.first = dst_track;
+ p.second = dst_time;
+ new_selection_values.push_back(p);
+
+ if (existing_idx != -1) {
+
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", dst_track, dst_time, animation->track_get_key_value(dst_track, existing_idx), animation->track_get_key_transition(dst_track, existing_idx));
+ }
+ }
+
+ undo_redo->commit_action();
+
+ //reselect duplicated
+
+ Map<SelectedKey, KeyInfo> new_selection;
+ for (List<Pair<int, float> >::Element *E = new_selection_values.front(); E; E = E->next()) {
+
+ int track = E->get().first;
+ float time = E->get().second;
+
+ int existing_idx = animation->track_find_key(track, time, true);
+
+ if (existing_idx == -1)
+ continue;
+ SelectedKey sk2;
+ sk2.track = track;
+ sk2.key = existing_idx;
+
+ KeyInfo ki;
+ ki.pos = time;
+
+ new_selection[sk2] = ki;
+ }
+
+ selection = new_selection;
+ _update_tracks();
+ _update_key_edit();
+ }
+}
+void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
+
+ last_menu_track_opt = p_option;
+ switch (p_option) {
+ case EDIT_COPY_TRACKS: {
+ track_copy_select->clear();
+ TreeItem *troot = track_copy_select->create_item();
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ NodePath path = animation->track_get_path(i);
+ Node *node = NULL;
+
+ if (root && root->has_node(path)) {
+ node = root->get_node(path);
+ }
+
+ String text;
+ Ref<Texture> icon = get_icon("Node", "EditorIcons");
+ if (node) {
+ if (has_icon(node->get_class(), "EditorIcons")) {
+ icon = get_icon(node->get_class(), "EditorIcons");
+ }
+
+ text = node->get_name();
+ Vector<StringName> sn = path.get_subnames();
+ for (int i = 0; i < sn.size(); i++) {
+ text += ".";
+ text += sn[i];
+ }
+
+ path = NodePath(node->get_path().get_names(), path.get_subnames(), true); //store full path instead for copying
+ } else {
+ text = path;
+ int sep = text.find(":");
+ if (sep != -1) {
+ text = text.substr(sep + 1, text.length());
+ }
+ }
+
+ switch (animation->track_get_type(i)) {
+ case Animation::TYPE_TRANSFORM: text += " (Transform)"; break;
+ case Animation::TYPE_METHOD: text += " (Methods)"; break;
+ case Animation::TYPE_BEZIER: text += " (Bezier)"; break;
+ case Animation::TYPE_AUDIO: text += " (Audio)"; break;
+ default: {};
+ }
+
+ TreeItem *it = track_copy_select->create_item(troot);
+ it->set_editable(0, true);
+ it->set_selectable(0, true);
+ it->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ it->set_icon(0, icon);
+ it->set_text(0, text);
+ Dictionary md;
+ md["track_idx"] = i;
+ md["path"] = path;
+ it->set_metadata(0, md);
+ }
+
+ track_copy_dialog->popup_centered_minsize(Size2(300, 500) * EDSCALE);
+ } break;
+ case EDIT_COPY_TRACKS_CONFIRM: {
+
+ track_clipboard.clear();
+ TreeItem *root = track_copy_select->get_root();
+ if (root) {
+
+ TreeItem *it = root->get_children();
+ while (it) {
+ Dictionary md = it->get_metadata(0);
+ int idx = md["track_idx"];
+ if (it->is_checked(0) && idx >= 0 && idx < animation->get_track_count()) {
+ TrackClipboard tc;
+ tc.base_path = animation->track_get_path(idx);
+ tc.full_path = md["path"];
+ tc.track_type = animation->track_get_type(idx);
+ tc.interp_type = animation->track_get_interpolation_type(idx);
+ if (tc.track_type == Animation::TYPE_VALUE) {
+ tc.update_mode = animation->value_track_get_update_mode(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++) {
+ TrackClipboard::Key k;
+ k.time = animation->track_get_key_time(idx, i);
+ k.value = animation->track_get_key_value(idx, i);
+ k.transition = animation->track_get_key_transition(idx, i);
+ tc.keys.push_back(k);
+ }
+ track_clipboard.push_back(tc);
+ }
+ it = it->get_next();
+ }
+ }
+ } break;
+ case EDIT_PASTE_TRACKS: {
+
+ if (track_clipboard.size() == 0) {
+ EditorNode::get_singleton()->show_warning(TTR("Clipboard is empty"));
+ break;
+ }
+
+ int base_track = animation->get_track_count();
+ undo_redo->create_action("Paste Tracks");
+ for (int i = 0; i < track_clipboard.size(); i++) {
+ undo_redo->add_do_method(animation.ptr(), "add_track", track_clipboard[i].track_type);
+ Node *exists = NULL;
+ NodePath path = track_clipboard[i].base_path;
+
+ if (root) {
+ NodePath np = track_clipboard[i].full_path;
+ exists = root->get_node(np);
+ if (exists) {
+ path = NodePath(root->get_path_to(exists).get_names(), track_clipboard[i].full_path.get_subnames(), false);
+ }
+ }
+
+ undo_redo->add_do_method(animation.ptr(), "track_set_path", base_track, path);
+ undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_type", base_track, track_clipboard[i].interp_type);
+ undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_loop_wrap", base_track, track_clipboard[i].loop_wrap);
+ undo_redo->add_do_method(animation.ptr(), "track_set_enabled", base_track, track_clipboard[i].enabled);
+ 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);
+ }
+
+ 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);
+ }
+
+ undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count());
+
+ base_track++;
+ }
+
+ undo_redo->commit_action();
+ } break;
+
+ case EDIT_SCALE_SELECTION:
+ case EDIT_SCALE_FROM_CURSOR: {
+ scale_dialog->popup_centered(Size2(200, 100) * EDSCALE);
+ } break;
+ case EDIT_SCALE_CONFIRM: {
+ if (selection.empty())
+ return;
+
+ float from_t = 1e20;
+ float to_t = -1e20;
+ float len = -1e20;
+ float pivot = 0;
+
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
+ float t = animation->track_get_key_time(E->key().track, E->key().key);
+ if (t < from_t)
+ from_t = t;
+ if (t > to_t)
+ to_t = t;
+ }
+
+ len = to_t - from_t;
+ if (last_menu_track_opt == EDIT_SCALE_FROM_CURSOR) {
+ pivot = timeline->get_play_position();
+
+ } else {
+
+ pivot = from_t;
+ }
+
+ float s = scale->get_value();
+ if (s == 0) {
+ ERR_PRINT("Can't scale to 0");
+ }
+
+ undo_redo->create_action(TTR("Anim Scale Keys"));
+
+ List<_AnimMoveRestore> to_restore;
+
+ // 1-remove the keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
+ }
+ // 2- remove overlapped keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newtime = (E->get().pos - from_t) * s + from_t;
+ int idx = animation->track_find_key(E->key().track, newtime, true);
+ if (idx == -1)
+ continue;
+ SelectedKey sk;
+ sk.key = idx;
+ sk.track = E->key().track;
+ if (selection.has(sk))
+ continue; //already in selection, don't save
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newtime);
+ _AnimMoveRestore amr;
+
+ amr.key = animation->track_get_key_value(E->key().track, idx);
+ amr.track = E->key().track;
+ amr.time = newtime;
+ amr.transition = animation->track_get_key_transition(E->key().track, idx);
+
+ to_restore.push_back(amr);
+ }
+
+#define _NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t
+ // 3-move the keys (re insert them)
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newpos = _NEW_POS(E->get().pos);
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
+
+ // 4-(undo) remove inserted keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newpos = _NEW_POS(E->get().pos);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_position", E->key().track, newpos);
+ }
+
+ // 5-(undo) reinsert keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
+
+ // 6-(undo) reinsert overlapped keys
+ for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+
+ _AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
+ }
+
+ // 6-(undo) reinsert overlapped keys
+ for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+
+ _AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
+ }
+
+ undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
+
+ // 7-reselect
+
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float oldpos = E->get().pos;
+ float newpos = _NEW_POS(oldpos);
+ if (newpos >= 0)
+ undo_redo->add_do_method(this, "_select_at_anim", animation, E->key().track, newpos);
+ undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, oldpos);
+ }
+#undef _NEW_POS
+ undo_redo->commit_action();
+ } break;
+ case EDIT_DUPLICATE_SELECTION: {
+
+ if (bezier_edit->is_visible()) {
+ bezier_edit->duplicate_selection();
+ break;
+ }
+ _anim_duplicate_keys(false);
+ } break;
+ case EDIT_DUPLICATE_TRANSPOSED: {
+ if (bezier_edit->is_visible()) {
+ EditorNode::get_singleton()->show_warning(TTR("This option does not work for Bezier editing, as it's only a single track."));
+ break;
+ }
+ _anim_duplicate_keys(true);
+ } break;
+ case EDIT_DELETE_SELECTION: {
+
+ if (bezier_edit->is_visible()) {
+ bezier_edit->delete_selection();
+ break;
+ }
+
+ if (selection.size()) {
+ undo_redo->create_action(TTR("Anim Delete Keys"));
+
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
+ undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->commit_action();
+ //selection.clear();
+ _update_key_edit();
+ }
+ } break;
+ case EDIT_GOTO_NEXT_STEP: {
+
+ if (animation.is_null())
+ break;
+ float step = animation->get_step();
+ if (step == 0)
+ step = 1;
+
+ float pos = timeline->get_play_position();
+
+ pos = Math::stepify(pos + step, step);
+ if (pos > animation->get_length())
+ pos = animation->get_length();
+ set_anim_pos(pos);
+
+ emit_signal("timeline_changed", pos, true);
+
+ } break;
+ case EDIT_GOTO_PREV_STEP: {
+ if (animation.is_null())
+ break;
+ float step = animation->get_step();
+ if (step == 0)
+ step = 1;
+
+ float pos = timeline->get_play_position();
+ pos = Math::stepify(pos - step, step);
+ if (pos < 0)
+ pos = 0;
+ set_anim_pos(pos);
+ emit_signal("timeline_changed", pos, true);
+
+ } break;
+ case EDIT_OPTIMIZE_ANIMATION: {
+ optimize_dialog->popup_centered(Size2(250, 180) * EDSCALE);
+
+ } break;
+ case EDIT_OPTIMIZE_ANIMATION_CONFIRM: {
+ animation->optimize(optimize_linear_error->get_value(), optimize_angular_error->get_value(), optimize_max_angle->get_value());
+ _update_tracks();
+ undo_redo->clear_history();
+
+ } break;
+ case EDIT_CLEAN_UP_ANIMATION: {
+ cleanup_dialog->popup_centered_minsize(Size2(300, 0) * EDSCALE);
+
+ } break;
+ case EDIT_CLEAN_UP_ANIMATION_CONFIRM: {
+ if (cleanup_all->is_pressed()) {
+ List<StringName> names;
+ AnimationPlayerEditor::singleton->get_player()->get_animation_list(&names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ _cleanup_animation(AnimationPlayerEditor::singleton->get_player()->get_animation(E->get()));
+ }
+ } else {
+ _cleanup_animation(animation);
+ }
+
+ } break;
+ }
+}
+
+void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
+
+ for (int i = 0; i < p_animation->get_track_count(); i++) {
+
+ bool prop_exists = false;
+ Variant::Type valid_type = Variant::NIL;
+ Object *obj = NULL;
+
+ RES res;
+ Vector<StringName> leftover_path;
+
+ Node *node = root->get_node_and_resource(p_animation->track_get_path(i), res, leftover_path);
+
+ if (res.is_valid()) {
+ obj = res.ptr();
+ } else if (node) {
+ obj = node;
+ }
+
+ if (obj && p_animation->track_get_type(i) == Animation::TYPE_VALUE) {
+ valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
+ }
+
+ if (!obj && cleanup_tracks->is_pressed()) {
+
+ p_animation->remove_track(i);
+ i--;
+ continue;
+ }
+
+ if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || cleanup_keys->is_pressed() == false)
+ continue;
+
+ for (int j = 0; j < p_animation->track_get_key_count(i); j++) {
+
+ Variant v = p_animation->track_get_key_value(i, j);
+
+ if (!Variant::can_convert(v.get_type(), valid_type)) {
+ p_animation->track_remove_key(i, j);
+ j--;
+ }
+ }
+
+ if (p_animation->track_get_key_count(i) == 0 && cleanup_tracks->is_pressed()) {
+ p_animation->remove_track(i);
+ i--;
+ }
+ }
+
+ undo_redo->clear_history();
+ _update_tracks();
+}
+
+void AnimationTrackEditor::_view_group_toggle() {
+ _update_tracks();
+ view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
+}
+
+void AnimationTrackEditor::_selection_changed() {
+
+ if (selected_filter->is_pressed()) {
+ _update_tracks(); //needs updatin
+ } else {
+ for (int i = 0; i < track_edits.size(); i++) {
+ track_edits[i]->update();
+ }
+
+ for (int i = 0; i < groups.size(); i++) {
+ groups[i]->update();
+ }
+ }
+}
+
+float AnimationTrackEditor::snap_time(float p_value) {
+
+ if (snap->is_pressed()) {
+ p_value = Math::stepify(p_value, step->get_value());
+ }
+
+ return p_value;
+}
+
+void AnimationTrackEditor::_bind_methods() {
+
+ ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed);
+ ClassDB::bind_method("_timeline_changed", &AnimationTrackEditor::_timeline_changed);
+ ClassDB::bind_method("_track_remove_request", &AnimationTrackEditor::_track_remove_request);
+ ClassDB::bind_method("_name_limit_changed", &AnimationTrackEditor::_name_limit_changed);
+ ClassDB::bind_method("_update_scroll", &AnimationTrackEditor::_update_scroll);
+ ClassDB::bind_method("_update_step", &AnimationTrackEditor::_update_step);
+ ClassDB::bind_method("_update_length", &AnimationTrackEditor::_update_length);
+ ClassDB::bind_method("_dropped_track", &AnimationTrackEditor::_dropped_track);
+ ClassDB::bind_method("_add_track", &AnimationTrackEditor::_add_track);
+ ClassDB::bind_method("_new_track_node_selected", &AnimationTrackEditor::_new_track_node_selected);
+ ClassDB::bind_method("_new_track_property_selected", &AnimationTrackEditor::_new_track_property_selected);
+ ClassDB::bind_method("_root_removed", &AnimationTrackEditor::_root_removed);
+ ClassDB::bind_method("_confirm_insert_list", &AnimationTrackEditor::_confirm_insert_list);
+ ClassDB::bind_method("_insert_delay", &AnimationTrackEditor::_insert_delay);
+ ClassDB::bind_method("_timeline_value_changed", &AnimationTrackEditor::_timeline_value_changed);
+ ClassDB::bind_method("_insert_key_from_track", &AnimationTrackEditor::_insert_key_from_track);
+ ClassDB::bind_method("_add_method_key", &AnimationTrackEditor::_add_method_key);
+ ClassDB::bind_method("_key_selected", &AnimationTrackEditor::_key_selected);
+ ClassDB::bind_method("_key_deselected", &AnimationTrackEditor::_key_deselected);
+ ClassDB::bind_method("_clear_selection", &AnimationTrackEditor::_clear_selection);
+ ClassDB::bind_method("_move_selection_begin", &AnimationTrackEditor::_move_selection_begin);
+ ClassDB::bind_method("_move_selection", &AnimationTrackEditor::_move_selection);
+ ClassDB::bind_method("_move_selection_commit", &AnimationTrackEditor::_move_selection_commit);
+ ClassDB::bind_method("_move_selection_cancel", &AnimationTrackEditor::_move_selection_cancel);
+ ClassDB::bind_method("_clear_selection_for_anim", &AnimationTrackEditor::_clear_selection_for_anim);
+ ClassDB::bind_method("_select_at_anim", &AnimationTrackEditor::_select_at_anim);
+ ClassDB::bind_method("_scroll_input", &AnimationTrackEditor::_scroll_input);
+ ClassDB::bind_method("_box_selection_draw", &AnimationTrackEditor::_box_selection_draw);
+ ClassDB::bind_method("_bezier_edit", &AnimationTrackEditor::_bezier_edit);
+ ClassDB::bind_method("_cancel_bezier_edit", &AnimationTrackEditor::_cancel_bezier_edit);
+ ClassDB::bind_method("_edit_menu_pressed", &AnimationTrackEditor::_edit_menu_pressed);
+ ClassDB::bind_method("_view_group_toggle", &AnimationTrackEditor::_view_group_toggle);
+ ClassDB::bind_method("_selection_changed", &AnimationTrackEditor::_selection_changed);
+
+ ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
+ ADD_SIGNAL(MethodInfo("keying_changed"));
+ ADD_SIGNAL(MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL, "len")));
+ ADD_SIGNAL(MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL, "step")));
+}
+
+AnimationTrackEditor::AnimationTrackEditor() {
+ root = NULL;
+ block_animation_update = false;
+
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+
+ main_panel = memnew(PanelContainer);
+ add_child(main_panel);
+ main_panel->set_v_size_flags(SIZE_EXPAND_FILL);
+ HBoxContainer *timeline_scroll = memnew(HBoxContainer);
+ main_panel->add_child(timeline_scroll);
+ timeline_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ VBoxContainer *timeline_vbox = memnew(VBoxContainer);
+ timeline_scroll->add_child(timeline_vbox);
+ timeline_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
+ timeline_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ timeline_vbox->add_constant_override("separation", 0);
+
+ timeline = memnew(AnimationTimelineEdit);
+ timeline->set_block_animation_update_ptr(&block_animation_update);
+ timeline->set_undo_redo(undo_redo);
+ timeline_vbox->add_child(timeline);
+ timeline->connect("timeline_changed", this, "_timeline_changed");
+ timeline->connect("name_limit_changed", this, "_name_limit_changed");
+ timeline->connect("track_added", this, "_add_track");
+ timeline->connect("value_changed", this, "_timeline_value_changed");
+ timeline->connect("length_changed", this, "_update_length");
+
+ scroll = memnew(ScrollContainer);
+ timeline_vbox->add_child(scroll);
+ scroll->set_v_size_flags(SIZE_EXPAND_FILL);
+ VScrollBar *sb = scroll->get_v_scrollbar();
+ scroll->remove_child(sb);
+ timeline_scroll->add_child(sb); //move here so timeline and tracks are always aligned
+ scroll->connect("gui_input", this, "_scroll_input");
+
+ bezier_edit = memnew(AnimationBezierTrackEdit);
+ timeline_vbox->add_child(bezier_edit);
+ bezier_edit->set_block_animation_update_ptr(&block_animation_update);
+ bezier_edit->set_undo_redo(undo_redo);
+ bezier_edit->set_editor(this);
+ bezier_edit->set_timeline(timeline);
+ bezier_edit->hide();
+ bezier_edit->set_v_size_flags(SIZE_EXPAND_FILL);
+ bezier_edit->connect("close_request", this, "_cancel_bezier_edit");
+
+ timeline_vbox->set_custom_minimum_size(Size2(0, 150) * EDSCALE);
+
+ hscroll = memnew(HScrollBar);
+ timeline_vbox->add_child(hscroll);
+ hscroll->share(timeline);
+ hscroll->connect("value_changed", this, "_update_scroll");
+ timeline->set_hscroll(hscroll);
+
+ track_vbox = memnew(VBoxContainer);
+ scroll->add_child(track_vbox);
+ track_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ scroll->set_enable_h_scroll(false);
+ scroll->set_enable_v_scroll(true);
+ track_vbox->add_constant_override("separation", 0);
+
+ //timeline_vbox->add_child(memnew(HSeparator));
+ HBoxContainer *bottom_hb = memnew(HBoxContainer);
+ add_child(bottom_hb);
+ bottom_hb->add_spacer();
+
+ selected_filter = memnew(ToolButton);
+ selected_filter->connect("pressed", this, "_view_group_toggle"); //same function works the same
+ selected_filter->set_toggle_mode(true);
+ selected_filter->set_tooltip(TTR("Only show tracks from nodes selected in tree."));
+
+ bottom_hb->add_child(selected_filter);
+
+ view_group = memnew(ToolButton);
+ view_group->connect("pressed", this, "_view_group_toggle");
+ view_group->set_toggle_mode(true);
+ view_group->set_tooltip(TTR("Group tracks by node or display them as plain list."));
+
+ bottom_hb->add_child(view_group);
+ bottom_hb->add_child(memnew(VSeparator));
+
+ snap = memnew(ToolButton);
+ snap->set_text(TTR("Snap (s): "));
+ bottom_hb->add_child(snap);
+ snap->set_disabled(true);
+ snap->set_toggle_mode(true);
+ snap->set_pressed(true);
+
+ step = memnew(EditorSpinSlider);
+ step->set_min(0);
+ step->set_max(1000);
+ step->set_step(0.01);
+ step->set_hide_slider(true);
+ step->set_custom_minimum_size(Size2(100, 0) * EDSCALE);
+ bottom_hb->add_child(step);
+ step->connect("value_changed", this, "_update_step");
+ step->set_read_only(true);
+
+ bottom_hb->add_child(memnew(VSeparator));
+
+ zoom_icon = memnew(TextureRect);
+ zoom_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
+ bottom_hb->add_child(zoom_icon);
+ zoom = memnew(HSlider);
+ zoom->set_step(0.01);
+ zoom->set_min(0.0);
+ zoom->set_max(2.0);
+ zoom->set_value(1.0);
+ zoom->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
+ zoom->set_v_size_flags(SIZE_SHRINK_CENTER);
+ bottom_hb->add_child(zoom);
+ timeline->set_zoom(zoom);
+
+ edit = memnew(MenuButton);
+ edit->set_text(TTR("Edit"));
+ edit->set_flat(false);
+ edit->get_popup()->add_item(TTR("Copy Tracks"), EDIT_COPY_TRACKS);
+ edit->get_popup()->add_item(TTR("Paste Tracks"), EDIT_PASTE_TRACKS);
+ edit->get_popup()->add_separator();
+ edit->get_popup()->add_item(TTR("Scale Selection"), EDIT_SCALE_SELECTION);
+ edit->get_popup()->add_item(TTR("Scale From Cursor"), EDIT_SCALE_FROM_CURSOR);
+ edit->get_popup()->add_separator();
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_SELECTION);
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection_transposed", TTR("Duplicate Transposed"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_TRANSPOSED);
+ edit->get_popup()->set_item_shortcut_disabled(edit->get_popup()->get_item_index(EDIT_DUPLICATE_SELECTION), true);
+ edit->get_popup()->set_item_shortcut_disabled(edit->get_popup()->get_item_index(EDIT_DUPLICATE_TRANSPOSED), true);
+ edit->get_popup()->add_separator();
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/delete_selection", TTR("Delete Selection"), KEY_DELETE), EDIT_DELETE_SELECTION);
+ edit->get_popup()->set_item_shortcut_disabled(edit->get_popup()->get_item_index(EDIT_DELETE_SELECTION), true);
+ //this shortcut will be checked from the track itself. so no need to enable it here (will conflict with scenetree dock)
+
+ edit->get_popup()->add_separator();
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Goto Next Step"), KEY_MASK_CMD | KEY_RIGHT), EDIT_GOTO_NEXT_STEP);
+ edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_prev_step", TTR("Goto Prev Step"), KEY_MASK_CMD | KEY_LEFT), EDIT_GOTO_PREV_STEP);
+ edit->get_popup()->add_separator();
+ edit->get_popup()->add_item(TTR("Optimize Animation"), EDIT_OPTIMIZE_ANIMATION);
+ edit->get_popup()->add_item(TTR("Clean-Up Animation"), EDIT_CLEAN_UP_ANIMATION);
+
+ edit->get_popup()->connect("id_pressed", this, "_edit_menu_pressed");
+
+ pick_track = memnew(SceneTreeDialog);
+ add_child(pick_track);
+ pick_track->set_title(TTR("Pick the node that will be animated:"));
+ pick_track->connect("selected", this, "_new_track_node_selected");
+ prop_selector = memnew(PropertySelector);
+ add_child(prop_selector);
+ prop_selector->connect("selected", this, "_new_track_property_selected");
+
+ method_selector = memnew(PropertySelector);
+ add_child(method_selector);
+ method_selector->connect("selected", this, "_add_method_key");
+
+ inserting = false;
+ insert_query = false;
+ insert_frame = 0;
+ insert_queue = false;
+
+ insert_confirm = memnew(ConfirmationDialog);
+ add_child(insert_confirm);
+ insert_confirm->connect("confirmed", this, "_confirm_insert_list");
+ VBoxContainer *icvb = memnew(VBoxContainer);
+ insert_confirm->add_child(icvb);
+ insert_confirm_text = memnew(Label);
+ icvb->add_child(insert_confirm_text);
+ insert_confirm_bezier = memnew(CheckBox);
+ insert_confirm_bezier->set_text(TTR("Use Bezier Curves"));
+ icvb->add_child(insert_confirm_bezier);
+ keying = false;
+ moving_selection = 0;
+ key_edit = NULL;
+
+ box_selection = memnew(Control);
+ add_child(box_selection);
+ box_selection->set_as_toplevel(true);
+ box_selection->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ box_selection->hide();
+ box_selection->connect("draw", this, "_box_selection_draw");
+ box_selecting = false;
+
+ //default plugins
+
+ Ref<AnimationTrackEditDefaultPlugin> def_plugin;
+ def_plugin.instance();
+ add_track_edit_plugin(def_plugin);
+
+ //dialogs
+
+ optimize_dialog = memnew(ConfirmationDialog);
+ add_child(optimize_dialog);
+ optimize_dialog->set_title(TTR("Anim. Optimizer"));
+ VBoxContainer *optimize_vb = memnew(VBoxContainer);
+ optimize_dialog->add_child(optimize_vb);
+
+ optimize_linear_error = memnew(SpinBox);
+ optimize_linear_error->set_max(1.0);
+ optimize_linear_error->set_min(0.001);
+ optimize_linear_error->set_step(0.001);
+ optimize_linear_error->set_value(0.05);
+ optimize_vb->add_margin_child(TTR("Max. Linear Error:"), optimize_linear_error);
+ optimize_angular_error = memnew(SpinBox);
+ optimize_angular_error->set_max(1.0);
+ optimize_angular_error->set_min(0.001);
+ optimize_angular_error->set_step(0.001);
+ optimize_angular_error->set_value(0.01);
+
+ optimize_vb->add_margin_child(TTR("Max. Angular Error:"), optimize_angular_error);
+ optimize_max_angle = memnew(SpinBox);
+ optimize_vb->add_margin_child(TTR("Max Optimizable Angle:"), optimize_max_angle);
+ optimize_max_angle->set_max(360.0);
+ optimize_max_angle->set_min(0.0);
+ optimize_max_angle->set_step(0.1);
+ optimize_max_angle->set_value(22);
+
+ optimize_dialog->get_ok()->set_text(TTR("Optimize"));
+ optimize_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM));
+
+ //
+
+ cleanup_dialog = memnew(ConfirmationDialog);
+ add_child(cleanup_dialog);
+ VBoxContainer *cleanup_vb = memnew(VBoxContainer);
+ cleanup_dialog->add_child(cleanup_vb);
+
+ cleanup_keys = memnew(CheckButton);
+ cleanup_keys->set_text(TTR("Remove invalid keys"));
+ cleanup_keys->set_pressed(true);
+ cleanup_vb->add_child(cleanup_keys);
+
+ cleanup_tracks = memnew(CheckButton);
+ cleanup_tracks->set_text(TTR("Remove unresolved and empty tracks"));
+ cleanup_tracks->set_pressed(true);
+ cleanup_vb->add_child(cleanup_tracks);
+
+ cleanup_all = memnew(CheckButton);
+ cleanup_all->set_text(TTR("Clean-up all animations"));
+ cleanup_vb->add_child(cleanup_all);
+
+ cleanup_dialog->set_title(TTR("Clean-Up Animation(s) (NO UNDO!)"));
+ cleanup_dialog->get_ok()->set_text(TTR("Clean-Up"));
+
+ cleanup_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM));
+
+ //
+ scale_dialog = memnew(ConfirmationDialog);
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ scale_dialog->add_child(vbc);
+
+ scale = memnew(SpinBox);
+ scale->set_min(-99999);
+ scale->set_max(99999);
+ scale->set_step(0.001);
+ vbc->add_margin_child(TTR("Scale Ratio:"), scale);
+ scale_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_SCALE_CONFIRM));
+ add_child(scale_dialog);
+
+ track_copy_dialog = memnew(ConfirmationDialog);
+ add_child(track_copy_dialog);
+ track_copy_dialog->set_title(TTR("Select tracks to copy:"));
+ track_copy_dialog->get_ok()->set_text(TTR("Copy"));
+
+ track_copy_select = memnew(Tree);
+ track_copy_select->set_hide_root(true);
+ track_copy_dialog->add_child(track_copy_select);
+ track_copy_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_COPY_TRACKS_CONFIRM));
+}
+
+AnimationTrackEditor::~AnimationTrackEditor() {
+ if (key_edit) {
+ memdelete(key_edit);
+ }
+}
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
new file mode 100644
index 0000000000..0692c88bea
--- /dev/null
+++ b/editor/animation_track_editor.h
@@ -0,0 +1,484 @@
+#ifndef ANIMATION_TRACK_EDITOR_H
+#define ANIMATION_TRACK_EDITOR_H
+
+#include "scene/gui/control.h"
+#include "scene/gui/file_dialog.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/scroll_bar.h"
+#include "scene/gui/slider.h"
+#include "scene/gui/spin_box.h"
+#include "scene/gui/tab_container.h"
+#include "scene/gui/texture_rect.h"
+#include "scene/gui/tool_button.h"
+
+#include "editor/property_selector.h"
+#include "editor_data.h"
+#include "editor_spin_slider.h"
+#include "property_editor.h"
+#include "scene/animation/animation_cache.h"
+#include "scene/resources/animation.h"
+#include "scene_tree_editor.h"
+
+class AnimationTimelineEdit : public Range {
+ GDCLASS(AnimationTimelineEdit, Range)
+
+ Ref<Animation> animation;
+ int name_limit;
+ Range *zoom;
+ Range *h_scroll;
+ float play_position_pos;
+
+ HBoxContainer *len_hb;
+ EditorSpinSlider *length;
+ ToolButton *loop;
+ TextureRect *time_icon;
+
+ MenuButton *add_track;
+ Control *play_position; //separate control used to draw so updates for only position changed are much faster
+ HScrollBar *hscroll;
+
+ void _zoom_changed(double);
+ void _anim_length_changed(double p_new_len);
+ void _anim_loop_pressed();
+
+ void _play_position_draw();
+ UndoRedo *undo_redo;
+ Rect2 hsize_rect;
+
+ bool editing;
+ bool *block_animation_update_ptr; //used to block all tracks re-gen (speed up)
+
+ bool panning_timeline;
+ float panning_timeline_from;
+ float panning_timeline_at;
+ bool dragging_timeline;
+ bool dragging_hsize;
+ float dragging_hsize_from;
+ float dragging_hsize_at;
+
+ void _gui_input(const Ref<InputEvent> &p_event);
+ void _track_added(int p_track);
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ int get_name_limit() const;
+ int get_buttons_width() const;
+
+ float get_zoom_scale() const;
+
+ virtual Size2 get_minimum_size() const;
+ void set_animation(const Ref<Animation> &p_animation);
+ void set_zoom(Range *p_zoom);
+ Range *get_zoom() const { return zoom; }
+ void set_undo_redo(UndoRedo *p_undo_redo);
+ void set_block_animation_update_ptr(bool *p_block_ptr);
+
+ void set_play_position(float p_pos);
+ float get_play_position() const;
+ void update_play_position();
+
+ void update_values();
+
+ void set_hscroll(HScrollBar *p_hscroll);
+
+ AnimationTimelineEdit();
+};
+
+class AnimationTrackEditor;
+
+class AnimationTrackEdit : public Control {
+
+ GDCLASS(AnimationTrackEdit, Control)
+
+ enum {
+ MENU_CALL_MODE_CONTINUOUS,
+ MENU_CALL_MODE_DISCRETE,
+ MENU_CALL_MODE_TRIGGER,
+ MENU_CALL_MODE_CAPTURE,
+ MENU_INTERPOLATION_NEAREST,
+ MENU_INTERPOLATION_LINEAR,
+ MENU_INTERPOLATION_CUBIC,
+ MENU_LOOP_WRAP,
+ MENU_LOOP_CLAMP,
+ MENU_KEY_INSERT,
+ MENU_KEY_DUPLICATE,
+ MENU_KEY_DELETE
+ };
+ AnimationTimelineEdit *timeline;
+ UndoRedo *undo_redo;
+ LineEdit *path;
+ Node *root;
+ Control *play_position; //separate control used to draw so updates for only position changed are much faster
+ float play_position_pos;
+
+ Ref<Animation> animation;
+ int track;
+
+ Rect2 check_rect;
+ Rect2 path_rect;
+
+ Rect2 update_mode_rect;
+ Rect2 interp_mode_rect;
+ Rect2 loop_mode_rect;
+ Rect2 remove_rect;
+ Rect2 bezier_edit_rect;
+
+ Ref<Texture> type_icon;
+ Ref<Texture> selected_icon;
+
+ PopupMenu *menu;
+
+ bool clicking_on_name;
+
+ void _zoom_changed();
+
+ Ref<Texture> icon_cache;
+ String path_cache;
+
+ void _menu_selected(int p_index);
+
+ bool *block_animation_update_ptr; //used to block all tracks re-gen (speed up)
+
+ void _path_entered(const String &p_text);
+ void _play_position_draw();
+ mutable int dropping_at;
+
+ float insert_at_pos;
+ bool moving_selection_attempt;
+ int select_single_attempt;
+ bool moving_selection;
+ float moving_selection_from_ofs;
+
+ bool in_group;
+ AnimationTrackEditor *editor;
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+ virtual void _gui_input(const Ref<InputEvent> &p_event);
+
+public:
+ virtual Variant get_drag_data(const Point2 &p_point);
+ virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
+ virtual void drop_data(const Point2 &p_point, const Variant &p_data);
+
+ virtual String get_tooltip(const Point2 &p_pos) const;
+
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right);
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+ virtual void draw_bg(int p_clip_left, int p_clip_right);
+ virtual void draw_fg(int p_clip_left, int p_clip_right);
+
+ //helper
+ void draw_texture_clipped(const Ref<Texture> &p_texture, const Vector2 &p_pos);
+ void draw_texture_region_clipped(const Ref<Texture> &p_texture, const Rect2 &p_rect, const Rect2 &p_region);
+ void draw_rect_clipped(const Rect2 &p_rect, const Color &p_color, bool p_filled = true);
+
+ int get_track() const;
+ Ref<Animation> get_animation() const;
+ AnimationTimelineEdit *get_timeline() const { return timeline; }
+ AnimationTrackEditor *get_editor() const { return editor; }
+ UndoRedo *get_undo_redo() const { return undo_redo; }
+ bool *get_block_animation_update_ptr() { return block_animation_update_ptr; }
+
+ void set_animation_and_track(const Ref<Animation> &p_animation, int p_track);
+ virtual Size2 get_minimum_size() const;
+
+ void set_undo_redo(UndoRedo *p_undo_redo);
+ void set_timeline(AnimationTimelineEdit *p_timeline);
+ void set_editor(AnimationTrackEditor *p_editor);
+ void set_root(Node *p_root);
+
+ void set_block_animation_update_ptr(bool *p_block_ptr);
+
+ void set_play_position(float p_pos);
+ void update_play_position();
+ void cancel_drop();
+
+ void set_in_group(bool p_enable);
+ void append_to_selection(const Rect2 &p_box);
+
+ AnimationTrackEdit();
+};
+
+class AnimationTrackEditPlugin : public Reference {
+ GDCLASS(AnimationTrackEditPlugin, Reference)
+public:
+ virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
+ virtual AnimationTrackEdit *create_audio_track_edit();
+ virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object);
+};
+
+class AnimationTrackKeyEdit;
+class AnimationBezierTrackEdit;
+
+class AnimationTrackEditGroup : public Control {
+ GDCLASS(AnimationTrackEditGroup, Control)
+ Ref<Texture> icon;
+ String node_name;
+ NodePath node;
+ Node *root;
+ AnimationTimelineEdit *timeline;
+
+ void _zoom_changed();
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ void set_type_and_name(const Ref<Texture> &p_type, const String &p_name, const NodePath &p_node);
+ virtual Size2 get_minimum_size() const;
+ void set_timeline(AnimationTimelineEdit *p_timeline);
+ void set_root(Node *p_root);
+
+ AnimationTrackEditGroup();
+};
+
+class AnimationTrackEditor : public VBoxContainer {
+ GDCLASS(AnimationTrackEditor, VBoxContainer)
+
+ enum {
+ EDIT_COPY_TRACKS,
+ EDIT_COPY_TRACKS_CONFIRM,
+ EDIT_PASTE_TRACKS,
+ EDIT_SCALE_SELECTION,
+ EDIT_SCALE_FROM_CURSOR,
+ EDIT_SCALE_CONFIRM,
+ EDIT_DUPLICATE_SELECTION,
+ EDIT_DUPLICATE_TRANSPOSED,
+ EDIT_DELETE_SELECTION,
+ EDIT_GOTO_NEXT_STEP,
+ EDIT_GOTO_PREV_STEP,
+ EDIT_OPTIMIZE_ANIMATION,
+ EDIT_OPTIMIZE_ANIMATION_CONFIRM,
+ EDIT_CLEAN_UP_ANIMATION,
+ EDIT_CLEAN_UP_ANIMATION_CONFIRM
+ };
+
+ Ref<Animation> animation;
+ Node *root;
+
+ MenuButton *edit;
+
+ PanelContainer *main_panel;
+ HScrollBar *hscroll;
+ ScrollContainer *scroll;
+ VBoxContainer *track_vbox;
+ AnimationBezierTrackEdit *bezier_edit;
+
+ AnimationTimelineEdit *timeline;
+ HSlider *zoom;
+ EditorSpinSlider *step;
+ TextureRect *zoom_icon;
+ ToolButton *snap;
+
+ Vector<AnimationTrackEdit *> track_edits;
+ Vector<AnimationTrackEditGroup *> groups;
+
+ bool block_animation_update;
+
+ int _get_track_selected();
+ void _animation_changed();
+ void _update_tracks();
+
+ void _name_limit_changed();
+ void _timeline_changed(float p_new_pos, bool p_drag);
+ void _track_remove_request(int p_track);
+
+ UndoRedo *undo_redo;
+
+ void _update_scroll(double);
+ void _update_step(double p_new_step);
+ void _update_length(double p_new_step);
+ void _dropped_track(int p_from_track, int p_to_track);
+
+ void _add_track(int p_type);
+ void _new_track_node_selected(NodePath p_path);
+ void _new_track_property_selected(String p_name);
+
+ PropertySelector *prop_selector;
+ PropertySelector *method_selector;
+ SceneTreeDialog *pick_track;
+ int adding_track_type;
+ NodePath adding_track_path;
+
+ bool keying;
+
+ struct InsertData {
+
+ Animation::TrackType type;
+ NodePath path;
+ int track_idx;
+ Variant value;
+ String query;
+ bool advance;
+ }; /* insert_data;*/
+
+ Label *insert_confirm_text;
+ CheckBox *insert_confirm_bezier;
+ ConfirmationDialog *insert_confirm;
+ bool insert_queue;
+ bool inserting;
+ bool insert_query;
+ List<InsertData> insert_data;
+ uint64_t insert_frame;
+
+ void _query_insert(const InsertData &p_id);
+ void _confirm_insert_list();
+ int _confirm_insert(InsertData p_id, int p_last_track, bool p_create_beziers = false);
+ void _insert_delay();
+
+ void _root_removed(Node *p_root);
+
+ PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = NULL);
+
+ void _timeline_value_changed(double);
+
+ float insert_key_from_track_call_ofs;
+ int insert_key_from_track_call_track;
+ void _insert_key_from_track(float p_ofs, int p_track);
+ void _add_method_key(const String &p_method);
+
+ void _clear_selection();
+ void _clear_selection_for_anim(const Ref<Animation> &p_anim);
+ void _select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos);
+
+ //selection
+
+ struct SelectedKey {
+
+ int track;
+ int key;
+ bool operator<(const SelectedKey &p_key) const { return track == p_key.track ? key < p_key.key : track < p_key.track; };
+ };
+
+ struct KeyInfo {
+
+ float pos;
+ };
+
+ Map<SelectedKey, KeyInfo> selection;
+
+ void _key_selected(int p_key, bool p_single, int p_track);
+ void _key_deselected(int p_key, int p_track);
+
+ bool moving_selection;
+ float moving_selection_offset;
+ void _move_selection_begin();
+ void _move_selection(float p_offset);
+ void _move_selection_commit();
+ void _move_selection_cancel();
+
+ AnimationTrackKeyEdit *key_edit;
+ void _update_key_edit();
+
+ void _clear_key_edit();
+
+ Control *box_selection;
+ void _box_selection_draw();
+ bool box_selecting;
+ Vector2 box_selecting_from;
+ Rect2 box_select_rect;
+ void _scroll_input(const Ref<InputEvent> &p_event);
+
+ Vector<Ref<AnimationTrackEditPlugin> > track_edit_plugins;
+
+ void _cancel_bezier_edit();
+ void _bezier_edit(int p_for_track);
+
+ ////////////// edit menu stuff
+
+ ConfirmationDialog *optimize_dialog;
+ SpinBox *optimize_linear_error;
+ SpinBox *optimize_angular_error;
+ SpinBox *optimize_max_angle;
+
+ ConfirmationDialog *cleanup_dialog;
+ CheckButton *cleanup_keys;
+ CheckButton *cleanup_tracks;
+ CheckButton *cleanup_all;
+
+ ConfirmationDialog *scale_dialog;
+ SpinBox *scale;
+
+ void _edit_menu_pressed(int p_option);
+ int last_menu_track_opt;
+
+ void _cleanup_animation(Ref<Animation> p_animation);
+
+ void _anim_duplicate_keys(bool transpose);
+
+ void _view_group_toggle();
+ ToolButton *view_group;
+ ToolButton *selected_filter;
+
+ void _selection_changed();
+
+ ConfirmationDialog *track_copy_dialog;
+ Tree *track_copy_select;
+ struct TrackClipboard {
+ NodePath full_path;
+ NodePath base_path;
+ Animation::TrackType track_type;
+ Animation::InterpolationType interp_type;
+ Animation::UpdateMode update_mode;
+ bool loop_wrap;
+ bool enabled;
+
+ struct Key {
+ float time;
+ float transition;
+ Variant value;
+ };
+ Vector<Key> keys;
+ };
+
+ Vector<TrackClipboard> track_clipboard;
+
+ void _insert_animation_key(NodePath p_path, const Variant &p_value);
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ void add_track_edit_plugin(const Ref<AnimationTrackEditPlugin> &p_plugin);
+ void remove_track_edit_plugin(const Ref<AnimationTrackEditPlugin> &p_plugin);
+
+ void set_animation(const Ref<Animation> &p_anim);
+ Ref<Animation> get_current_animation() const;
+ void set_root(Node *p_root);
+ Node *get_root() const;
+ void update_keying();
+ bool has_keying() const;
+
+ void cleanup();
+
+ void set_anim_pos(float p_pos);
+ void insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists = false);
+ void insert_value_key(const String &p_property, const Variant &p_value, bool p_advance);
+ void insert_transform_key(Spatial *p_node, const String &p_sub, const Transform &p_xform);
+
+ void show_select_node_warning(bool p_show);
+
+ bool is_key_selected(int p_track, int p_key) const;
+ bool is_selection_active() const;
+ bool is_moving_selection() const;
+ float get_moving_selection_offset() const;
+ bool is_snap_enabled();
+ float snap_time(float p_value);
+
+ MenuButton *get_edit_menu();
+ AnimationTrackEditor();
+ ~AnimationTrackEditor();
+};
+
+#endif // ANIMATION_TRACK_EDITOR_H
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
new file mode 100644
index 0000000000..d0c91f10d9
--- /dev/null
+++ b/editor/animation_track_editor_plugins.cpp
@@ -0,0 +1,1317 @@
+#include "animation_track_editor_plugins.h"
+#include "editor/audio_stream_preview.h"
+#include "editor_resource_preview.h"
+#include "editor_scale.h"
+#include "scene/2d/animated_sprite.h"
+#include "scene/2d/sprite.h"
+#include "scene/3d/sprite_3d.h"
+#include "scene/animation/animation_player.h"
+#include "servers/audio/audio_stream.h"
+/// BOOL ///
+int AnimationTrackEditBool::get_key_height() const {
+
+ Ref<Texture> checked = get_icon("checked", "CheckBox");
+ return checked->get_height();
+}
+Rect2 AnimationTrackEditBool::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Ref<Texture> checked = get_icon("checked", "CheckBox");
+ return Rect2(0, 0, checked->get_width(), get_size().height);
+}
+
+bool AnimationTrackEditBool::is_key_selectable_by_distance() const {
+
+ return false;
+}
+void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Ref<Texture> icon;
+ bool checked = get_animation()->track_get_key_value(get_track(), p_index);
+
+ if (checked)
+ icon = get_icon("checked", "CheckBox");
+ else
+ icon = get_icon("unchecked", "CheckBox");
+
+ Vector2 ofs(p_x, int(get_size().height - icon->get_height()) / 2);
+
+ draw_texture_clipped(icon, ofs);
+
+ if (p_selected) {
+ Color color = get_color("accent_color", "Editor");
+ draw_rect_clipped(Rect2(ofs, icon->get_size()), color, false);
+ }
+}
+
+/// COLOR ///
+
+int AnimationTrackEditColor::get_key_height() const {
+
+ Ref<Font> font = get_font("font", "Label");
+ return font->get_height() * 0.8;
+}
+Rect2 AnimationTrackEditColor::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ return Rect2(0, 0, fh, get_size().height);
+}
+
+bool AnimationTrackEditColor::is_key_selectable_by_distance() const {
+
+ return false;
+}
+
+void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) {
+
+ int x_from = p_x;
+ int x_to = p_next_x;
+
+ Ref<Font> font = get_font("font", "Label");
+ int fh = (font->get_height() * 0.8);
+
+ x_from += fh - 1;
+ x_to += 1;
+ fh /= 3;
+
+ if (x_from > p_clip_right)
+ return;
+
+ if (x_to < p_clip_left)
+ return;
+
+ Color color = get_animation()->track_get_key_value(get_track(), p_index);
+ Color color_next = get_animation()->track_get_key_value(get_track(), p_index + 1);
+
+ if (x_from < p_clip_left) {
+ float c = float(p_clip_left - x_from) / (x_to - x_from);
+ color = color.linear_interpolate(color_next, c);
+ x_from = p_clip_left;
+ }
+
+ if (x_to > p_clip_right) {
+ float c = float(p_clip_right - x_from) / (x_to - x_from);
+ color_next = color.linear_interpolate(color_next, c);
+ x_to = p_clip_right;
+ }
+
+ int y_from = (get_size().height - fh) / 2;
+
+ Vector<Vector2> points;
+ Vector<Color> colors;
+
+ points.push_back(Vector2(x_from, y_from));
+ colors.push_back(color);
+
+ points.push_back(Vector2(x_to, y_from));
+ colors.push_back(color_next);
+
+ points.push_back(Vector2(x_to, y_from + fh));
+ colors.push_back(color_next);
+
+ points.push_back(Vector2(x_from, y_from + fh));
+ colors.push_back(color);
+
+ draw_primitive(points, colors, Vector<Vector2>());
+}
+
+void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Color color = get_animation()->track_get_key_value(get_track(), p_index);
+
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+
+ Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
+
+ draw_rect_clipped(Rect2(rect.position, rect.size / 2), Color(0.4, 0.4, 0.4));
+ draw_rect_clipped(Rect2(rect.position + rect.size / 2, rect.size / 2), Color(0.4, 0.4, 0.4));
+ draw_rect_clipped(Rect2(rect.position + Vector2(rect.size.x / 2, 0), rect.size / 2), Color(0.6, 0.6, 0.6));
+ draw_rect_clipped(Rect2(rect.position + Vector2(0, rect.size.y / 2), rect.size / 2), Color(0.6, 0.6, 0.6));
+ draw_rect_clipped(rect, color);
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect_clipped(rect, accent, false);
+ }
+}
+
+/// AUDIO ///
+
+void AnimationTrackEditAudio::_preview_changed(ObjectID p_which) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object)
+ return;
+
+ Ref<AudioStream> stream = object->call("get_stream");
+
+ if (stream.is_valid() && stream->get_instance_id() == p_which) {
+ update();
+ }
+}
+
+int AnimationTrackEditAudio::get_key_height() const {
+
+ if (!ObjectDB::get_instance(id)) {
+ return AnimationTrackEdit::get_key_height();
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ return int(font->get_height() * 1.5);
+}
+Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ Ref<AudioStream> stream = object->call("get_stream");
+
+ if (!stream.is_valid()) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ bool play = get_animation()->track_get_key_value(get_track(), p_index);
+ if (play) {
+ float len = stream->get_length();
+
+ if (len == 0) {
+
+ Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
+ len = preview->get_length();
+ }
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ }
+
+ return Rect2(0, 0, len * p_pixels_sec, get_size().height);
+ } else {
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ return Rect2(0, 0, fh, get_size().height);
+ }
+}
+
+bool AnimationTrackEditAudio::is_key_selectable_by_distance() const {
+
+ return false;
+}
+void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ Ref<AudioStream> stream = object->call("get_stream");
+
+ if (!stream.is_valid()) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ float fh = int(font->get_height() * 1.5);
+
+ bool play = get_animation()->track_get_key_value(get_track(), p_index);
+ if (play) {
+ float len = stream->get_length();
+
+ Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
+
+ float preview_len = preview->get_length();
+
+ if (len == 0) {
+ len = preview_len;
+ }
+
+ int pixel_len = len * p_pixels_sec;
+
+ int pixel_begin = p_x;
+ int pixel_end = p_x + pixel_len;
+
+ if (pixel_end < p_clip_left)
+ return;
+
+ if (pixel_begin > p_clip_right)
+ return;
+
+ int from_x = MAX(pixel_begin, p_clip_left);
+ int to_x = MIN(pixel_end, p_clip_right);
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ float limit = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ int limit_x = pixel_begin + limit * p_pixels_sec;
+ to_x = MIN(limit_x, to_x);
+ }
+
+ if (to_x <= from_x)
+ return;
+
+ int h = get_size().height;
+ Rect2 rect = Rect2(from_x, (h - fh) / 2, to_x - from_x, fh);
+ draw_rect(rect, Color(0.25, 0.25, 0.25));
+
+ Vector<Vector2> lines;
+ lines.resize((to_x - from_x + 1) * 2);
+ preview_len = preview->get_length();
+
+ for (int i = from_x; i < to_x; i++) {
+
+ float ofs = (i - pixel_begin) * preview_len / pixel_len;
+ float ofs_n = ((i + 1) - pixel_begin) * preview_len / pixel_len;
+ float max = preview->get_max(ofs, ofs_n) * 0.5 + 0.5;
+ float min = preview->get_min(ofs, ofs_n) * 0.5 + 0.5;
+
+ int idx = i - from_x;
+ lines[idx * 2 + 0] = Vector2(i, rect.position.y + min * rect.size.y);
+ lines[idx * 2 + 1] = Vector2(i, rect.position.y + max * rect.size.y);
+ }
+
+ Vector<Color> color;
+ color.push_back(Color(0.75, 0.75, 0.75));
+
+ VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+ } else {
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
+
+ Color color = get_color("font_color", "Label");
+ draw_rect(rect, color);
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+ }
+}
+
+void AnimationTrackEditAudio::set_node(Object *p_object) {
+
+ id = p_object->get_instance_id();
+}
+
+void AnimationTrackEditAudio::_bind_methods() {
+ ClassDB::bind_method("_preview_changed", &AnimationTrackEditAudio::_preview_changed);
+}
+
+AnimationTrackEditAudio::AnimationTrackEditAudio() {
+ AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", this, "_preview_changed");
+}
+
+/// SPRITE FRAME ///
+
+int AnimationTrackEditSpriteFrame::get_key_height() const {
+
+ if (!ObjectDB::get_instance(id)) {
+ return AnimationTrackEdit::get_key_height();
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ return int(font->get_height() * 2);
+}
+Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ Size2 size;
+
+ if (Object::cast_to<Sprite>(object) || Object::cast_to<Sprite3D>(object)) {
+
+ Ref<Texture> texture = object->call("get_texture");
+ if (!texture.is_valid()) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ size = texture->get_size();
+
+ if (bool(object->call("is_region"))) {
+ size = Rect2(object->call("get_region_rect")).size;
+ }
+
+ int hframes = object->call("get_hframes");
+ int vframes = object->call("get_vframes");
+
+ if (hframes > 1) {
+ size.x /= hframes;
+ }
+ if (vframes > 1) {
+ size.y /= vframes;
+ }
+ } else if (Object::cast_to<AnimatedSprite>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
+
+ Ref<SpriteFrames> sf = object->call("get_sprite_frames");
+ if (sf.is_null()) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ List<StringName> animations;
+ sf->get_animation_list(&animations);
+
+ int frame = get_animation()->track_get_key_value(get_track(), p_index);
+ String animation;
+ if (animations.size() == 1) {
+ animation = animations.front()->get();
+ } else {
+ // Go through other track to find if animation is set
+ String animation_path = get_animation()->track_get_path(get_track());
+ animation_path = animation_path.replace(":frame", ":animation");
+ int animation_track = get_animation()->find_track(animation_path);
+ float track_time = get_animation()->track_get_key_time(get_track(), p_index);
+ int animaiton_index = get_animation()->track_find_key(animation_track, track_time);
+ animation = get_animation()->track_get_key_value(animation_track, animaiton_index);
+ }
+
+ Ref<Texture> texture = sf->get_frame(animation, frame);
+ if (!texture.is_valid()) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ size = texture->get_size();
+ }
+
+ size = size.floor();
+
+ Ref<Font> font = get_font("font", "Label");
+ int height = int(font->get_height() * 2);
+ int width = height * size.width / size.height;
+
+ return Rect2(0, 0, width, get_size().height);
+}
+
+bool AnimationTrackEditSpriteFrame::is_key_selectable_by_distance() const {
+
+ return false;
+}
+void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ int frame = get_animation()->track_get_key_value(get_track(), p_index);
+
+ Ref<Texture> texture;
+ Rect2 region;
+
+ if (Object::cast_to<Sprite>(object) || Object::cast_to<Sprite3D>(object)) {
+
+ texture = object->call("get_texture");
+ if (!texture.is_valid()) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ region.size = texture->get_size();
+
+ if (bool(object->call("is_region"))) {
+
+ region = Rect2(object->call("get_region_rect"));
+ }
+
+ int hframes = object->call("get_hframes");
+ int vframes = object->call("get_vframes");
+
+ if (hframes > 1) {
+ region.size.x /= hframes;
+ }
+ if (vframes > 1) {
+ region.size.y /= vframes;
+ }
+
+ region.position.x += region.size.x * (frame % hframes);
+ region.position.y += region.size.y * (frame / hframes);
+
+ } else if (Object::cast_to<AnimatedSprite>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
+
+ Ref<SpriteFrames> sf = object->call("get_sprite_frames");
+ if (sf.is_null()) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ List<StringName> animations;
+ sf->get_animation_list(&animations);
+
+ int frame = get_animation()->track_get_key_value(get_track(), p_index);
+ String animation;
+ if (animations.size() == 1) {
+ animation = animations.front()->get();
+ } else {
+ // Go through other track to find if animation is set
+ String animation_path = get_animation()->track_get_path(get_track());
+ animation_path = animation_path.replace(":frame", ":animation");
+ int animation_track = get_animation()->find_track(animation_path);
+ float track_time = get_animation()->track_get_key_time(get_track(), p_index);
+ int animaiton_index = get_animation()->track_find_key(animation_track, track_time);
+ animation = get_animation()->track_get_key_value(animation_track, animaiton_index);
+ }
+
+ texture = sf->get_frame(animation, frame);
+ if (!texture.is_valid()) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ region.size = texture->get_size();
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ int height = int(font->get_height() * 2);
+
+ int width = height * region.size.width / region.size.height;
+
+ Rect2 rect(p_x, int(get_size().height - height) / 2, width, height);
+
+ if (rect.position.x + rect.size.x < p_clip_left)
+ return;
+
+ if (rect.position.x > p_clip_right)
+ return;
+
+ Color accent = get_color("accent_color", "Editor");
+ Color bg = accent;
+ bg.a = 0.15;
+
+ draw_rect_clipped(rect, bg);
+
+ draw_texture_region_clipped(texture, rect, region);
+
+ if (p_selected) {
+ draw_rect_clipped(rect, accent, false);
+ }
+}
+
+void AnimationTrackEditSpriteFrame::set_node(Object *p_object) {
+
+ id = p_object->get_instance_id();
+}
+
+/// SUB ANIMATION ///
+
+int AnimationTrackEditSubAnim::get_key_height() const {
+
+ if (!ObjectDB::get_instance(id)) {
+ return AnimationTrackEdit::get_key_height();
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ return int(font->get_height() * 1.5);
+}
+Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(object);
+
+ if (!ap) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ String anim = get_animation()->track_get_key_value(get_track(), p_index);
+
+ if (anim != "[stop]" && ap->has_animation(anim)) {
+
+ float len = ap->get_animation(anim)->get_length();
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ }
+
+ return Rect2(0, 0, len * p_pixels_sec, get_size().height);
+ } else {
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ return Rect2(0, 0, fh, get_size().height);
+ }
+}
+
+bool AnimationTrackEditSubAnim::is_key_selectable_by_distance() const {
+
+ return false;
+}
+void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(object);
+
+ if (!ap) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ String anim = get_animation()->track_get_key_value(get_track(), p_index);
+
+ if (anim != "[stop]" && ap->has_animation(anim)) {
+
+ float len = ap->get_animation(anim)->get_length();
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ }
+
+ int pixel_len = len * p_pixels_sec;
+
+ int pixel_begin = p_x;
+ int pixel_end = p_x + pixel_len;
+
+ if (pixel_end < p_clip_left)
+ return;
+
+ if (pixel_begin > p_clip_right)
+ return;
+
+ int from_x = MAX(pixel_begin, p_clip_left);
+ int to_x = MIN(pixel_end, p_clip_right);
+
+ if (to_x <= from_x)
+ return;
+
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 1.5;
+
+ Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh);
+
+ Color color = get_color("font_color", "Label");
+ Color bg = color;
+ bg.r = 1 - color.r;
+ bg.g = 1 - color.g;
+ bg.b = 1 - color.b;
+ draw_rect(rect, bg);
+
+ Vector<Vector2> lines;
+ Vector<Color> colorv;
+ {
+ Ref<Animation> animation = ap->get_animation(anim);
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ float h = (rect.size.height - 2) / animation->get_track_count();
+
+ int y = 2 + h * i + h / 2;
+
+ for (int j = 0; j < animation->track_get_key_count(i); j++) {
+
+ float ofs = animation->track_get_key_time(i, j);
+ int x = p_x + ofs * p_pixels_sec + 2;
+
+ if (x < from_x || x >= (to_x - 4))
+ continue;
+
+ lines.push_back(Point2(x, y));
+ lines.push_back(Point2(x + 1, y));
+ }
+ }
+
+ colorv.push_back(color);
+ }
+
+ if (lines.size() > 2) {
+ VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, colorv);
+ }
+
+ int limit = to_x - from_x - 4;
+ if (limit > 0) {
+ draw_string(font, Point2(from_x + 2, int(get_size().height - font->get_height()) / 2 + font->get_ascent()), anim, color);
+ }
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+ } else {
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
+
+ Color color = get_color("font_color", "Label");
+ draw_rect(rect, color);
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+ }
+}
+
+void AnimationTrackEditSubAnim::set_node(Object *p_object) {
+
+ id = p_object->get_instance_id();
+}
+
+//// VOLUME DB ////
+
+int AnimationTrackEditVolumeDB::get_key_height() const {
+
+ Ref<Texture> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
+ return volume_texture->get_height() * 1.2;
+}
+
+void AnimationTrackEditVolumeDB::draw_bg(int p_clip_left, int p_clip_right) {
+
+ Ref<Texture> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
+ int tex_h = volume_texture->get_height();
+
+ int y_from = (get_size().height - tex_h) / 2;
+ int y_size = tex_h;
+
+ Color color(1, 1, 1, 0.3);
+ draw_texture_rect(volume_texture, Rect2(p_clip_left, y_from, p_clip_right - p_clip_left, y_from + y_size), false, color);
+}
+
+void AnimationTrackEditVolumeDB::draw_fg(int p_clip_left, int p_clip_right) {
+
+ Ref<Texture> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
+ int tex_h = volume_texture->get_height();
+ int y_from = (get_size().height - tex_h) / 2;
+ int db0 = y_from + (24 / 80.0) * tex_h;
+
+ draw_line(Vector2(p_clip_left, db0), Vector2(p_clip_right, db0), Color(1, 1, 1, 0.3));
+}
+
+void AnimationTrackEditVolumeDB::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) {
+
+ if (p_x > p_clip_right || p_next_x < p_clip_left)
+ return;
+
+ float db = get_animation()->track_get_key_value(get_track(), p_index);
+ float db_n = get_animation()->track_get_key_value(get_track(), p_index + 1);
+
+ db = CLAMP(db, -60, 24);
+ db_n = CLAMP(db_n, -60, 24);
+
+ float h = 1.0 - ((db + 60) / 84.0);
+ float h_n = 1.0 - ((db_n + 60) / 84.0);
+
+ int from_x = p_x;
+ int to_x = p_next_x;
+
+ if (from_x < p_clip_left) {
+ h = Math::lerp(h, h_n, float(p_clip_left - from_x) / float(to_x - from_x));
+ from_x = p_clip_left;
+ }
+
+ if (to_x > p_clip_right) {
+ h_n = Math::lerp(h, h_n, float(p_clip_right - from_x) / float(to_x - from_x));
+ to_x = p_clip_right;
+ }
+
+ Ref<Texture> volume_texture = get_icon("ColorTrackVu", "EditorIcons");
+ int tex_h = volume_texture->get_height();
+
+ int y_from = (get_size().height - tex_h) / 2;
+
+ Color color = get_color("font_color", "Label");
+ color.a *= 0.7;
+
+ draw_line(Point2(from_x, y_from + h * tex_h), Point2(to_x, y_from + h_n * tex_h), color, 2);
+}
+
+////////////////////////
+
+/// AUDIO ///
+
+void AnimationTrackEditTypeAudio::_preview_changed(ObjectID p_which) {
+
+ for (int i = 0; i < get_animation()->track_get_key_count(get_track()); i++) {
+ Ref<AudioStream> stream = get_animation()->audio_track_get_key_stream(get_track(), i);
+ if (stream.is_valid() && stream->get_instance_id() == p_which) {
+ update();
+ return;
+ }
+ }
+}
+
+int AnimationTrackEditTypeAudio::get_key_height() const {
+
+ Ref<Font> font = get_font("font", "Label");
+ return int(font->get_height() * 1.5);
+}
+Rect2 AnimationTrackEditTypeAudio::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Ref<AudioStream> stream = get_animation()->audio_track_get_key_stream(get_track(), p_index);
+
+ if (!stream.is_valid()) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ float start_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), p_index);
+ float end_ofs = get_animation()->audio_track_get_key_end_offset(get_track(), p_index);
+
+ float len = stream->get_length();
+
+ if (len == 0) {
+
+ Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
+ len = preview->get_length();
+ }
+
+ len -= end_ofs;
+ len -= start_ofs;
+ if (len <= 0.001) {
+ len = 0.001;
+ }
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ }
+
+ return Rect2(0, 0, len * p_pixels_sec, get_size().height);
+}
+
+bool AnimationTrackEditTypeAudio::is_key_selectable_by_distance() const {
+
+ return false;
+}
+void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Ref<AudioStream> stream = get_animation()->audio_track_get_key_stream(get_track(), p_index);
+
+ if (!stream.is_valid()) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ float start_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), p_index);
+ float end_ofs = get_animation()->audio_track_get_key_end_offset(get_track(), p_index);
+
+ if (len_resizing && p_index == len_resizing_index) {
+ float ofs_local = -len_resizing_rel / get_timeline()->get_zoom_scale();
+ if (len_resizing_start) {
+ start_ofs += ofs_local;
+ if (start_ofs < 0)
+ start_ofs = 0;
+ } else {
+ end_ofs += ofs_local;
+ if (end_ofs < 0)
+ end_ofs = 0;
+ }
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ float fh = int(font->get_height() * 1.5);
+
+ float len = stream->get_length();
+
+ Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
+
+ float preview_len = preview->get_length();
+
+ if (len == 0) {
+ len = preview_len;
+ }
+
+ int pixel_total_len = len * p_pixels_sec;
+
+ len -= end_ofs;
+ len -= start_ofs;
+
+ if (len <= 0.001) {
+ len = 0.001;
+ }
+
+ int pixel_len = len * p_pixels_sec;
+
+ int pixel_begin = p_x;
+ int pixel_end = p_x + pixel_len;
+
+ if (pixel_end < p_clip_left)
+ return;
+
+ if (pixel_begin > p_clip_right)
+ return;
+
+ int from_x = MAX(pixel_begin, p_clip_left);
+ int to_x = MIN(pixel_end, p_clip_right);
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ float limit = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ int limit_x = pixel_begin + limit * p_pixels_sec;
+ to_x = MIN(limit_x, to_x);
+ }
+
+ if (to_x <= from_x) {
+ to_x = from_x + 1;
+ }
+
+ int h = get_size().height;
+ Rect2 rect = Rect2(from_x, (h - fh) / 2, to_x - from_x, fh);
+ draw_rect(rect, Color(0.25, 0.25, 0.25));
+
+ Vector<Vector2> lines;
+ lines.resize((to_x - from_x + 1) * 2);
+ preview_len = preview->get_length();
+
+ for (int i = from_x; i < to_x; i++) {
+
+ float ofs = (i - pixel_begin) * preview_len / pixel_total_len;
+ float ofs_n = ((i + 1) - pixel_begin) * preview_len / pixel_total_len;
+ ofs += start_ofs;
+ ofs_n += start_ofs;
+
+ float max = preview->get_max(ofs, ofs_n) * 0.5 + 0.5;
+ float min = preview->get_min(ofs, ofs_n) * 0.5 + 0.5;
+
+ int idx = i - from_x;
+ lines[idx * 2 + 0] = Vector2(i, rect.position.y + min * rect.size.y);
+ lines[idx * 2 + 1] = Vector2(i, rect.position.y + max * rect.size.y);
+ }
+
+ Vector<Color> color;
+ color.push_back(Color(0.75, 0.75, 0.75));
+
+ VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
+
+ Color cut_color = get_color("accent_color", "Editor");
+ cut_color.a = 0.7;
+ if (start_ofs > 0 && pixel_begin > p_clip_left) {
+ draw_rect(Rect2(pixel_begin, rect.position.y, 1, rect.size.y), cut_color);
+ }
+ if (end_ofs > 0 && pixel_end < p_clip_right) {
+ draw_rect(Rect2(pixel_end, rect.position.y, 1, rect.size.y), cut_color);
+ }
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+}
+
+void AnimationTrackEditTypeAudio::_bind_methods() {
+ ClassDB::bind_method("_preview_changed", &AnimationTrackEditTypeAudio::_preview_changed);
+}
+
+AnimationTrackEditTypeAudio::AnimationTrackEditTypeAudio() {
+ AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", this, "_preview_changed");
+ len_resizing = false;
+}
+
+bool AnimationTrackEditTypeAudio::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
+
+ if (p_point.x > get_timeline()->get_name_limit() && p_point.x < get_size().width - get_timeline()->get_buttons_width()) {
+
+ Dictionary drag_data = p_data;
+ if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ Ref<AudioStream> res = drag_data["resource"];
+ if (res.is_valid()) {
+ return true;
+ }
+ }
+
+ if (drag_data.has("type") && String(drag_data["type"]) == "files") {
+
+ Vector<String> files = drag_data["files"];
+
+ if (files.size() == 1) {
+ String file = files[0];
+ Ref<AudioStream> res = ResourceLoader::load(file);
+ if (res.is_valid()) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return AnimationTrackEdit::can_drop_data(p_point, p_data);
+}
+void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant &p_data) {
+
+ if (p_point.x > get_timeline()->get_name_limit() && p_point.x < get_size().width - get_timeline()->get_buttons_width()) {
+
+ Ref<AudioStream> stream;
+ Dictionary drag_data = p_data;
+ if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ stream = drag_data["resource"];
+ } else if (drag_data.has("type") && String(drag_data["type"]) == "files") {
+
+ Vector<String> files = drag_data["files"];
+
+ if (files.size() == 1) {
+ String file = files[0];
+ stream = ResourceLoader::load(file);
+ }
+ }
+
+ if (stream.is_valid()) {
+
+ int x = p_point.x - get_timeline()->get_name_limit();
+ float ofs = x / get_timeline()->get_zoom_scale();
+ ofs += get_timeline()->get_value();
+
+ ofs = get_editor()->snap_time(ofs);
+
+ while (get_animation()->track_find_key(get_track(), ofs, true) != -1) { //make sure insertion point is valid
+ ofs += 0.001;
+ }
+
+ print_line("inserting");
+
+ *get_block_animation_update_ptr() = true;
+ get_undo_redo()->create_action("Add Audio Track Clip");
+ get_undo_redo()->add_do_method(get_animation().ptr(), "audio_track_insert_key", get_track(), ofs, stream);
+ get_undo_redo()->add_undo_method(get_animation().ptr(), "track_remove_key_at_position", get_track(), ofs);
+ get_undo_redo()->commit_action();
+ *get_block_animation_update_ptr() = false;
+
+ update();
+ return;
+ }
+ }
+
+ return AnimationTrackEdit::drop_data(p_point, p_data);
+}
+
+void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (!len_resizing && mm.is_valid()) {
+ bool use_hsize_cursor = false;
+ for (int i = 0; i < get_animation()->track_get_key_count(get_track()); i++) {
+
+ Ref<AudioStream> stream = get_animation()->audio_track_get_key_stream(get_track(), i);
+
+ if (!stream.is_valid()) {
+ continue;
+ }
+
+ float start_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), i);
+ float end_ofs = get_animation()->audio_track_get_key_end_offset(get_track(), i);
+ float len = stream->get_length();
+
+ if (len == 0) {
+ Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
+ float preview_len = preview->get_length();
+ len = preview_len;
+ }
+
+ len -= end_ofs;
+ len -= start_ofs;
+ if (len <= 0.001) {
+ len = 0.001;
+ }
+
+ if (get_animation()->track_get_key_count(get_track()) > i + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), i + 1) - get_animation()->track_get_key_time(get_track(), i));
+ }
+
+ float ofs = get_animation()->track_get_key_time(get_track(), i);
+
+ ofs -= get_timeline()->get_value();
+ ofs *= get_timeline()->get_zoom_scale();
+ ofs += get_timeline()->get_name_limit();
+
+ int end = ofs + len * get_timeline()->get_zoom_scale();
+
+ if (end >= get_timeline()->get_name_limit() && end <= get_size().width - get_timeline()->get_buttons_width() && ABS(mm->get_position().x - end) < 5 * EDSCALE) {
+ use_hsize_cursor = true;
+ len_resizing_index = i;
+ }
+ }
+
+ if (use_hsize_cursor) {
+ set_default_cursor_shape(CURSOR_HSIZE);
+ } else {
+ set_default_cursor_shape(CURSOR_ARROW);
+ }
+ }
+
+ if (len_resizing && mm.is_valid()) {
+ len_resizing_rel += mm->get_relative().x;
+ len_resizing_start = mm->get_shift();
+ update();
+ accept_event();
+ return;
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
+
+ len_resizing = true;
+ len_resizing_start = mb->get_shift();
+ len_resizing_from_px = mb->get_position().x;
+ len_resizing_rel = 0;
+ update();
+ accept_event();
+ return;
+ }
+
+ if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ float ofs_local = -len_resizing_rel / get_timeline()->get_zoom_scale();
+ if (len_resizing_start) {
+ float prev_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), len_resizing_index);
+ *get_block_animation_update_ptr() = true;
+ get_undo_redo()->create_action("Change Audio Track Clip Start Offset");
+ get_undo_redo()->add_do_method(get_animation().ptr(), "audio_track_set_key_start_offset", get_track(), len_resizing_index, prev_ofs + ofs_local);
+ get_undo_redo()->add_undo_method(get_animation().ptr(), "audio_track_set_key_start_offset", get_track(), len_resizing_index, prev_ofs);
+ get_undo_redo()->commit_action();
+ *get_block_animation_update_ptr() = false;
+
+ } else {
+ float prev_ofs = get_animation()->audio_track_get_key_end_offset(get_track(), len_resizing_index);
+ *get_block_animation_update_ptr() = true;
+ get_undo_redo()->create_action("Change Audio Track Clip End Offset");
+ get_undo_redo()->add_do_method(get_animation().ptr(), "audio_track_set_key_end_offset", get_track(), len_resizing_index, prev_ofs + ofs_local);
+ get_undo_redo()->add_undo_method(get_animation().ptr(), "audio_track_set_key_end_offset", get_track(), len_resizing_index, prev_ofs);
+ get_undo_redo()->commit_action();
+ *get_block_animation_update_ptr() = false;
+ }
+
+ len_resizing = false;
+ len_resizing_index = -1;
+ update();
+ accept_event();
+ return;
+ }
+
+ AnimationTrackEdit::_gui_input(p_event);
+}
+
+////////////////////
+/// SUB ANIMATION ///
+
+int AnimationTrackEditTypeAnimation::get_key_height() const {
+
+ if (!ObjectDB::get_instance(id)) {
+ return AnimationTrackEdit::get_key_height();
+ }
+
+ Ref<Font> font = get_font("font", "Label");
+ return int(font->get_height() * 1.5);
+}
+Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_sec) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(object);
+
+ if (!ap) {
+ return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
+ }
+
+ String anim = get_animation()->animation_track_get_key_animation(get_track(), p_index);
+ print_line("anim " + anim + " has " + itos(ap->has_animation(anim)));
+
+ if (anim != "[stop]" && ap->has_animation(anim)) {
+
+ float len = ap->get_animation(anim)->get_length();
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ }
+
+ return Rect2(0, 0, len * p_pixels_sec, get_size().height);
+ } else {
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ return Rect2(0, 0, fh, get_size().height);
+ }
+}
+
+bool AnimationTrackEditTypeAnimation::is_key_selectable_by_distance() const {
+
+ return false;
+}
+void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
+
+ Object *object = ObjectDB::get_instance(id);
+
+ if (!object) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(object);
+
+ if (!ap) {
+ AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
+ return;
+ }
+
+ String anim = get_animation()->animation_track_get_key_animation(get_track(), p_index);
+
+ if (anim != "[stop]" && ap->has_animation(anim)) {
+
+ float len = ap->get_animation(anim)->get_length();
+
+ if (get_animation()->track_get_key_count(get_track()) > p_index + 1) {
+ len = MIN(len, get_animation()->track_get_key_time(get_track(), p_index + 1) - get_animation()->track_get_key_time(get_track(), p_index));
+ }
+
+ int pixel_len = len * p_pixels_sec;
+
+ int pixel_begin = p_x;
+ int pixel_end = p_x + pixel_len;
+
+ if (pixel_end < p_clip_left)
+ return;
+
+ if (pixel_begin > p_clip_right)
+ return;
+
+ int from_x = MAX(pixel_begin, p_clip_left);
+ int to_x = MIN(pixel_end, p_clip_right);
+
+ if (to_x <= from_x)
+ return;
+
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 1.5;
+
+ Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh);
+
+ Color color = get_color("font_color", "Label");
+ Color bg = color;
+ bg.r = 1 - color.r;
+ bg.g = 1 - color.g;
+ bg.b = 1 - color.b;
+ draw_rect(rect, bg);
+
+ Vector<Vector2> lines;
+ Vector<Color> colorv;
+ {
+ Ref<Animation> animation = ap->get_animation(anim);
+
+ for (int i = 0; i < animation->get_track_count(); i++) {
+
+ float h = (rect.size.height - 2) / animation->get_track_count();
+
+ int y = 2 + h * i + h / 2;
+
+ for (int j = 0; j < animation->track_get_key_count(i); j++) {
+
+ float ofs = animation->track_get_key_time(i, j);
+ int x = p_x + ofs * p_pixels_sec + 2;
+
+ if (x < from_x || x >= (to_x - 4))
+ continue;
+
+ lines.push_back(Point2(x, y));
+ lines.push_back(Point2(x + 1, y));
+ }
+ }
+
+ colorv.push_back(color);
+ }
+
+ if (lines.size() > 2) {
+ VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, colorv);
+ }
+
+ int limit = to_x - from_x - 4;
+ if (limit > 0) {
+ draw_string(font, Point2(from_x + 2, int(get_size().height - font->get_height()) / 2 + font->get_ascent()), anim, color);
+ }
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+ } else {
+ Ref<Font> font = get_font("font", "Label");
+ int fh = font->get_height() * 0.8;
+ Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
+
+ Color color = get_color("font_color", "Label");
+ draw_rect(rect, color);
+
+ if (p_selected) {
+ Color accent = get_color("accent_color", "Editor");
+ draw_rect(rect, accent, false);
+ }
+ }
+}
+
+void AnimationTrackEditTypeAnimation::set_node(Object *p_object) {
+
+ id = p_object->get_instance_id();
+}
+
+AnimationTrackEditTypeAnimation::AnimationTrackEditTypeAnimation() {
+}
+
+/////////
+AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage) {
+
+ if (p_property == "playing" && (p_object->is_class("AudioStreamPlayer") || p_object->is_class("AudioStreamPlayer2D") || p_object->is_class("AudioStreamPlayer3D"))) {
+
+ AnimationTrackEditAudio *audio = memnew(AnimationTrackEditAudio);
+ audio->set_node(p_object);
+ return audio;
+ }
+
+ if (p_property == "frame" && (p_object->is_class("Sprite") || p_object->is_class("Sprite3D") || p_object->is_class("AnimatedSprite") || p_object->is_class("AnimatedSprite3D"))) {
+
+ AnimationTrackEditSpriteFrame *sprite = memnew(AnimationTrackEditSpriteFrame);
+ sprite->set_node(p_object);
+ return sprite;
+ }
+
+ if (p_property == "current_animation" && (p_object->is_class("AnimationPlayer"))) {
+
+ AnimationTrackEditSubAnim *player = memnew(AnimationTrackEditSubAnim);
+ player->set_node(p_object);
+ return player;
+ }
+
+ if (p_property == "volume_db") {
+
+ AnimationTrackEditVolumeDB *vu = memnew(AnimationTrackEditVolumeDB);
+ return vu;
+ }
+
+ if (p_type == Variant::BOOL) {
+ return memnew(AnimationTrackEditBool);
+ }
+ if (p_type == Variant::COLOR) {
+ return memnew(AnimationTrackEditColor);
+ }
+
+ return NULL;
+}
+
+AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_audio_track_edit() {
+
+ return memnew(AnimationTrackEditTypeAudio);
+}
+
+AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_animation_track_edit(Object *p_object) {
+
+ AnimationTrackEditTypeAnimation *an = memnew(AnimationTrackEditTypeAnimation);
+ an->set_node(p_object);
+ return an;
+}
diff --git a/editor/animation_track_editor_plugins.h b/editor/animation_track_editor_plugins.h
new file mode 100644
index 0000000000..59604412d9
--- /dev/null
+++ b/editor/animation_track_editor_plugins.h
@@ -0,0 +1,139 @@
+#ifndef ANIMATION_TRACK_EDITOR_PLUGINS_H
+#define ANIMATION_TRACK_EDITOR_PLUGINS_H
+
+#include "editor/animation_track_editor.h"
+
+class AnimationTrackEditBool : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditBool, AnimationTrackEdit)
+ Ref<Texture> icon_checked;
+ Ref<Texture> icon_unchecked;
+
+public:
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+};
+
+class AnimationTrackEditColor : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditColor, AnimationTrackEdit)
+
+public:
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+ virtual void draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right);
+};
+
+class AnimationTrackEditAudio : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit)
+
+ ObjectID id;
+
+ void _preview_changed(ObjectID p_which);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+
+ void set_node(Object *p_object);
+
+ AnimationTrackEditAudio();
+};
+
+class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit)
+
+ ObjectID id;
+
+public:
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+
+ void set_node(Object *p_object);
+};
+
+class AnimationTrackEditSubAnim : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit)
+
+ ObjectID id;
+
+public:
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+
+ void set_node(Object *p_object);
+};
+
+class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit)
+
+ void _preview_changed(ObjectID p_which);
+
+ bool len_resizing;
+ bool len_resizing_start;
+ int len_resizing_index;
+ float len_resizing_from_px;
+ float len_resizing_rel;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void _gui_input(const Ref<InputEvent> &p_event);
+
+ virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
+ virtual void drop_data(const Point2 &p_point, const Variant &p_data);
+
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+
+ AnimationTrackEditTypeAudio();
+};
+
+class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit)
+
+ ObjectID id;
+
+public:
+ virtual int get_key_height() const;
+ virtual Rect2 get_key_rect(int p_index, float p_pixels_sec);
+ virtual bool is_key_selectable_by_distance() const;
+ virtual void draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right);
+
+ void set_node(Object *p_object);
+ AnimationTrackEditTypeAnimation();
+};
+
+class AnimationTrackEditVolumeDB : public AnimationTrackEdit {
+ GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit)
+
+public:
+ virtual void draw_bg(int p_clip_left, int p_clip_right);
+ virtual void draw_fg(int p_clip_left, int p_clip_right);
+ virtual int get_key_height() const;
+ virtual void draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right);
+};
+
+class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {
+ GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin)
+public:
+ virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
+ virtual AnimationTrackEdit *create_audio_track_edit();
+ virtual AnimationTrackEdit *create_animation_track_edit(Object *p_object);
+};
+
+#endif // ANIMATION_TRACK_EDITOR_PLUGINS_H
diff --git a/editor/audio_stream_preview.cpp b/editor/audio_stream_preview.cpp
new file mode 100644
index 0000000000..6ee4d7f4b0
--- /dev/null
+++ b/editor/audio_stream_preview.cpp
@@ -0,0 +1,211 @@
+#include "audio_stream_preview.h"
+
+/////////////////////
+
+float AudioStreamPreview::get_length() const {
+ return length;
+}
+float AudioStreamPreview::get_max(float p_time, float p_time_next) const {
+
+ if (length == 0)
+ return 0;
+
+ int max = preview.size() / 2;
+ int time_from = p_time / length * max;
+ int time_to = p_time_next / length * max;
+ time_from = CLAMP(time_from, 0, max - 1);
+ time_to = CLAMP(time_to, 0, max - 1);
+
+ if (time_to <= time_from) {
+ time_to = time_from + 1;
+ }
+
+ uint8_t vmax;
+
+ for (int i = time_from; i < time_to; i++) {
+
+ uint8_t v = preview[i * 2 + 1];
+ if (i == 0 || v > vmax) {
+ vmax = v;
+ }
+ }
+
+ return (vmax / 255.0) * 2.0 - 1.0;
+}
+float AudioStreamPreview::get_min(float p_time, float p_time_next) const {
+
+ if (length == 0)
+ return 0;
+
+ int max = preview.size() / 2;
+ int time_from = p_time / length * max;
+ int time_to = p_time_next / length * max;
+ time_from = CLAMP(time_from, 0, max - 1);
+ time_to = CLAMP(time_to, 0, max - 1);
+
+ if (time_to <= time_from) {
+ time_to = time_from + 1;
+ }
+
+ uint8_t vmin;
+
+ for (int i = time_from; i < time_to; i++) {
+
+ uint8_t v = preview[i * 2];
+ if (i == 0 || v < vmin) {
+ vmin = v;
+ }
+ }
+
+ return (vmin / 255.0) * 2.0 - 1.0;
+}
+
+AudioStreamPreview::AudioStreamPreview() {
+ length = 0;
+}
+
+////
+
+void AudioStreamPreviewGenerator::_update_emit(ObjectID p_id) {
+ emit_signal("preview_updated", p_id);
+}
+
+void AudioStreamPreviewGenerator::_preview_thread(void *p_preview) {
+
+ Preview *preview = (Preview *)p_preview;
+
+ float muxbuff_chunk_s = 0.25;
+
+ int mixbuff_chunk_frames = AudioServer::get_singleton()->get_mix_rate() * muxbuff_chunk_s;
+
+ Vector<AudioFrame> mix_chunk;
+ mix_chunk.resize(mixbuff_chunk_frames);
+
+ int frames_total = AudioServer::get_singleton()->get_mix_rate() * preview->preview->length;
+ int frames_todo = frames_total;
+
+ preview->playback->start();
+
+ while (frames_todo) {
+
+ int ofs_write = uint64_t(frames_total - frames_todo) * uint64_t(preview->preview->preview.size() / 2) / uint64_t(frames_total);
+ int to_read = MIN(frames_todo, mixbuff_chunk_frames);
+ int to_write = uint64_t(to_read) * uint64_t(preview->preview->preview.size() / 2) / uint64_t(frames_total);
+ to_write = MIN(to_write, (preview->preview->preview.size() / 2) - ofs_write);
+
+ preview->playback->mix(mix_chunk.ptrw(), 1.0, to_read);
+
+ for (int i = 0; i < to_write; i++) {
+ float max = -1000;
+ float min = 1000;
+ int from = uint64_t(i) * to_read / to_write;
+ int to = uint64_t(i + 1) * to_read / to_write;
+ to = MIN(to, to_read);
+ from = MIN(from, to_read - 1);
+ if (to == from) {
+ to = from + 1;
+ }
+
+ for (int j = from; j < to; j++) {
+
+ max = MAX(max, mix_chunk[j].l);
+ max = MAX(max, mix_chunk[j].r);
+
+ min = MIN(min, mix_chunk[j].l);
+ min = MIN(min, mix_chunk[j].r);
+ }
+
+ uint8_t pfrom = CLAMP((min * 0.5 + 0.5) * 255, 0, 255);
+ uint8_t pto = CLAMP((max * 0.5 + 0.5) * 255, 0, 255);
+
+ preview->preview->preview[(ofs_write + i) * 2 + 0] = pfrom;
+ preview->preview->preview[(ofs_write + i) * 2 + 1] = pto;
+ }
+
+ frames_todo -= to_read;
+ singleton->call_deferred("_update_emit", preview->id);
+ }
+
+ preview->playback->stop();
+
+ preview->generating = false;
+}
+
+Ref<AudioStreamPreview> AudioStreamPreviewGenerator::generate_preview(const Ref<AudioStream> &p_stream) {
+ ERR_FAIL_COND_V(p_stream.is_null(), Ref<AudioStreamPreview>());
+
+ if (previews.has(p_stream->get_instance_id())) {
+ return previews[p_stream->get_instance_id()].preview;
+ }
+
+ //no preview exists
+
+ previews[p_stream->get_instance_id()] = Preview();
+
+ Preview *preview = &previews[p_stream->get_instance_id()];
+ preview->base_stream = p_stream;
+ preview->playback = preview->base_stream->instance_playback();
+ preview->generating = true;
+ preview->id = p_stream->get_instance_id();
+
+ float len_s = preview->base_stream->get_length();
+ if (len_s == 0) {
+ len_s = 60 * 5; //five minutes
+ }
+
+ int frames = AudioServer::get_singleton()->get_mix_rate() * len_s;
+
+ Vector<uint8_t> maxmin;
+ int pw = frames / 20;
+ maxmin.resize(pw * 2);
+ {
+ uint8_t *ptr = maxmin.ptrw();
+ for (int i = 0; i < pw * 2; i++) {
+ ptr[i] = 127;
+ }
+ }
+
+ preview->preview.instance();
+ preview->preview->preview = maxmin;
+ preview->preview->length = len_s;
+
+ preview->thread = Thread::create(_preview_thread, preview);
+
+ return preview->preview;
+}
+
+void AudioStreamPreviewGenerator::_bind_methods() {
+ ClassDB::bind_method("_update_emit", &AudioStreamPreviewGenerator::_update_emit);
+ ClassDB::bind_method(D_METHOD("generate_preview", "stream"), &AudioStreamPreviewGenerator::generate_preview);
+
+ ADD_SIGNAL(MethodInfo("preview_updated", PropertyInfo(Variant::INT, "obj_id")));
+}
+
+AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = NULL;
+
+void AudioStreamPreviewGenerator::_notification(int p_what) {
+ if (p_what == NOTIFICATION_PROCESS) {
+ List<ObjectID> to_erase;
+ for (Map<ObjectID, Preview>::Element *E = previews.front(); E; E = E->next()) {
+ if (!E->get().generating) {
+ if (E->get().thread) {
+ Thread::wait_to_finish(E->get().thread);
+ E->get().thread = NULL;
+ }
+ if (!ObjectDB::get_instance(E->key())) { //no longer in use, get rid of preview
+ to_erase.push_back(E->key());
+ }
+ }
+ }
+
+ while (to_erase.front()) {
+ previews.erase(to_erase.front()->get());
+ to_erase.pop_front();
+ }
+ }
+}
+
+AudioStreamPreviewGenerator::AudioStreamPreviewGenerator() {
+ singleton = this;
+ set_process(true);
+}
diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h
new file mode 100644
index 0000000000..cfe1667e9d
--- /dev/null
+++ b/editor/audio_stream_preview.h
@@ -0,0 +1,56 @@
+#ifndef AUDIO_STREAM_PREVIEW_H
+#define AUDIO_STREAM_PREVIEW_H
+
+#include "os/thread.h"
+#include "scene/main/node.h"
+#include "servers/audio/audio_stream.h"
+
+class AudioStreamPreview : public Reference {
+ GDCLASS(AudioStreamPreview, Reference)
+ friend class AudioStream;
+ Vector<uint8_t> preview;
+ float length;
+
+ friend class AudioStreamPreviewGenerator;
+
+public:
+ float get_length() const;
+ float get_max(float p_time, float p_time_next) const;
+ float get_min(float p_time, float p_time_next) const;
+
+ AudioStreamPreview();
+};
+
+class AudioStreamPreviewGenerator : public Node {
+ GDCLASS(AudioStreamPreviewGenerator, Node)
+
+ static AudioStreamPreviewGenerator *singleton;
+
+ struct Preview {
+ Ref<AudioStreamPreview> preview;
+ Ref<AudioStream> base_stream;
+ Ref<AudioStreamPlayback> playback;
+ volatile bool generating;
+ ObjectID id;
+ Thread *thread;
+ };
+
+ Map<ObjectID, Preview> previews;
+
+ static void _preview_thread(void *p_preview);
+
+ void _update_emit(ObjectID p_id);
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ static AudioStreamPreviewGenerator *get_singleton() { return singleton; }
+
+ Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_preview);
+
+ AudioStreamPreviewGenerator();
+};
+
+#endif // AUDIO_STREAM_PREVIEW_H
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 9ae9ab1501..665ce7658f 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -212,35 +212,39 @@ void FindReplaceBar::_replace_all() {
text_edit->begin_complex_operation();
- while (search_next()) {
-
- // replace area
- Point2i match_from(result_line, result_col);
- Point2i match_to(result_line, result_col + search_text_len);
-
- if (match_from < prev_match)
- break; // done
+ if (search_current()) {
+ do {
+ // replace area
+ Point2i match_from(result_line, result_col);
+ Point2i match_to(result_line, result_col + search_text_len);
+
+ if (match_from < prev_match) {
+ break; // done
+ }
- prev_match = Point2i(result_line, result_col + replace_text.length());
+ prev_match = Point2i(result_line, result_col + replace_text.length());
- text_edit->unfold_line(result_line);
- text_edit->select(result_line, result_col, result_line, match_to.y);
+ text_edit->unfold_line(result_line);
+ text_edit->select(result_line, result_col, result_line, match_to.y);
- if (selection_enabled && is_selection_only()) {
+ if (selection_enabled && is_selection_only()) {
+ if (match_from < selection_begin || match_to > selection_end) {
+ continue;
+ }
- if (match_from < selection_begin || match_to > selection_end)
- continue;
+ // replace but adjust selection bounds
+ text_edit->insert_text_at_cursor(replace_text);
+ if (match_to.x == selection_end.x) {
+ selection_end.y += replace_text.length() - search_text_len;
+ }
- // replace but adjust selection bounds
- text_edit->insert_text_at_cursor(replace_text);
- if (match_to.x == selection_end.x)
- selection_end.y += replace_text.length() - search_text_len;
- } else {
- // just replace
- text_edit->insert_text_at_cursor(replace_text);
- }
+ } else {
+ // just replace
+ text_edit->insert_text_at_cursor(replace_text);
+ }
- rc++;
+ rc++;
+ } while (search_next());
}
text_edit->end_complex_operation();
@@ -369,7 +373,6 @@ void FindReplaceBar::_hide_bar() {
void FindReplaceBar::_show_search() {
- hide(); // to update size correctly
show();
search_text->grab_focus();
@@ -477,7 +480,7 @@ void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) {
void FindReplaceBar::_update_size() {
- container->set_custom_minimum_size(Size2(0, hbc->get_size().height));
+ container->set_size(Size2(hbc->get_size().width, 1));
}
void FindReplaceBar::_bind_methods() {
@@ -503,7 +506,8 @@ void FindReplaceBar::_bind_methods() {
FindReplaceBar::FindReplaceBar() {
- container = memnew(Control);
+ container = memnew(MarginContainer);
+ container->add_constant_override("margin_bottom", 5 * EDSCALE);
add_child(container);
container->set_clip_contents(true);
container->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -588,8 +592,7 @@ FindReplaceBar::FindReplaceBar() {
add_child(hide_button);
hide_button->set_focus_mode(FOCUS_NONE);
hide_button->connect("pressed", this, "_hide_pressed");
- hide_button->set_expand(true);
- hide_button->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED);
+ hide_button->set_v_size_flags(SIZE_SHRINK_CENTER);
}
/*** CODE EDITOR ****/
@@ -646,12 +649,12 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
}
void CodeTextEditor::_zoom_in() {
- font_resize_val += EDSCALE;
+ font_resize_val += MAX(EDSCALE, 1.0f);
_zoom_changed();
}
void CodeTextEditor::_zoom_out() {
- font_resize_val -= EDSCALE;
+ font_resize_val -= MAX(EDSCALE, 1.0f);
_zoom_changed();
}
@@ -673,7 +676,20 @@ void CodeTextEditor::_reset_zoom() {
void CodeTextEditor::_line_col_changed() {
line_nb->set_text(itos(text_editor->cursor_get_line() + 1));
- col_nb->set_text(itos(text_editor->cursor_get_column() + 1));
+
+ String line = text_editor->get_line(text_editor->cursor_get_line());
+
+ int positional_column = 0;
+
+ for (int i = 0; i < text_editor->cursor_get_column(); i++) {
+ if (line[i] == '\t') {
+ positional_column += text_editor->get_indent_size(); //tab size
+ } else {
+ positional_column += 1;
+ }
+ }
+
+ col_nb->set_text(itos(positional_column + 1));
}
void CodeTextEditor::_text_changed() {
@@ -762,6 +778,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter"));
text_editor->set_hiding_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding"));
text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding"));
+ text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/word_wrap"));
text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret"));
text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling"));
text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/open_scripts/v_scroll_speed"));
diff --git a/editor/code_editor.h b/editor/code_editor.h
index a860ad24e2..2a3bb1ba76 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -63,7 +63,7 @@ class FindReplaceBar : public HBoxContainer {
GDCLASS(FindReplaceBar, HBoxContainer);
- Control *container;
+ MarginContainer *container;
LineEdit *search_text;
ToolButton *find_prev;
ToolButton *find_next;
diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp
index 4ce57d7f63..734229d014 100644
--- a/editor/collada/collada.cpp
+++ b/editor/collada/collada.cpp
@@ -2266,10 +2266,8 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) {
}
node = node->parent;
}
- ERR_CONTINUE(!sk);
- if (!sk)
- continue; //bleh
+ ERR_CONTINUE(!sk);
if (!skeleton) {
skeleton = sk;
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 3466d17980..7f93917744 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -35,6 +35,7 @@
#include "plugins/script_editor_plugin.h"
#include "print_string.h"
#include "scene/gui/label.h"
+#include "scene/gui/popup_menu.h"
class ConnectDialogBinds : public Object {
@@ -87,51 +88,12 @@ public:
}
};
-void ConnectDialog::_notification(int p_what) {
-
- if (p_what == NOTIFICATION_ENTER_TREE) {
- bind_editor->edit(cdbinds);
- }
-}
-
-void ConnectDialog::_tree_node_selected() {
-
- //dst_method_list->get_popup()->clear();
- Node *current = tree->get_selected();
-
- if (!current) {
- make_callback->hide();
- return;
- }
-
- if (current->get_script().is_null())
- make_callback->hide();
- else
- make_callback->show();
-
- dst_path->set_text(node->get_path_to(current));
-}
-
-void ConnectDialog::edit(Node *p_node) {
-
- node = p_node;
-
- //dst_method_list->get_popup()->clear();
-
- tree->set_selected(NULL);
- tree->set_marked(node, true);
- dst_path->set_text("");
- dst_method->set_text("");
- deferred->set_pressed(false);
- oneshot->set_pressed(false);
- cdbinds->params.clear();
- cdbinds->notify_changed();
-}
-
+/*
+Signal automatically called by parent dialog.
+*/
void ConnectDialog::ok_pressed() {
if (dst_method->get_text() == "") {
-
error->set_text(TTR("Method in target Node must be specified!"));
error->popup_centered_minsize();
return;
@@ -147,39 +109,35 @@ void ConnectDialog::ok_pressed() {
emit_signal("connected");
hide();
}
+
void ConnectDialog::_cancel_pressed() {
hide();
}
-NodePath ConnectDialog::get_dst_path() const {
-
- return dst_path->get_text();
-}
-
-bool ConnectDialog::get_deferred() const {
-
- return deferred->is_pressed();
-}
-
-bool ConnectDialog::get_oneshot() const {
-
- return oneshot->is_pressed();
-}
+/*
+Called each time a target node is selected within the target node tree.
+*/
+void ConnectDialog::_tree_node_selected() {
-StringName ConnectDialog::get_dst_method() const {
+ Node *current = tree->get_selected();
- String txt = dst_method->get_text();
- if (txt.find("(") != -1)
- txt = txt.left(txt.find("(")).strip_edges();
- return txt;
-}
+ if (!current) {
+ make_callback->hide();
+ return;
+ }
-Vector<Variant> ConnectDialog::get_binds() const {
+ if (current->get_script().is_null())
+ make_callback->hide();
+ else
+ make_callback->show();
- return cdbinds->params;
+ dst_path->set_text(source->get_path_to(current));
}
+/*
+Adds a new parameter bind to connection.
+*/
void ConnectDialog::_add_bind() {
if (cdbinds->params.size() >= VARIANT_ARG_MAX)
@@ -189,7 +147,6 @@ void ConnectDialog::_add_bind() {
Variant value;
switch (vt) {
-
case Variant::BOOL: value = false; break;
case Variant::INT: value = 0; break;
case Variant::REAL: value = 0.0; break;
@@ -203,7 +160,6 @@ void ConnectDialog::_add_bind() {
case Variant::BASIS: value = Basis(); break;
case Variant::TRANSFORM: value = Transform(); break;
case Variant::COLOR: value = Color(); break;
-
default: { ERR_FAIL(); } break;
}
@@ -213,6 +169,9 @@ void ConnectDialog::_add_bind() {
cdbinds->notify_changed();
}
+/*
+Remove parameter bind from connection.
+*/
void ConnectDialog::_remove_bind() {
String st = bind_editor->get_selected_path();
@@ -225,25 +184,106 @@ void ConnectDialog::_remove_bind() {
cdbinds->notify_changed();
}
+void ConnectDialog::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+ bind_editor->edit(cdbinds);
+ }
+}
+
+void ConnectDialog::_bind_methods() {
+
+ ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
+ ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected);
+ ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
+ ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind);
+
+ ADD_SIGNAL(MethodInfo("connected"));
+}
+
+Node *ConnectDialog::get_source() const {
+
+ return source;
+}
+
+StringName ConnectDialog::get_signal_name() const {
+
+ return signal;
+}
+
+NodePath ConnectDialog::get_dst_path() const {
+
+ return dst_path->get_text();
+}
+
void ConnectDialog::set_dst_node(Node *p_node) {
tree->set_selected(p_node);
}
+StringName ConnectDialog::get_dst_method_name() const {
+
+ String txt = dst_method->get_text();
+ if (txt.find("(") != -1)
+ txt = txt.left(txt.find("(")).strip_edges();
+ return txt;
+}
+
void ConnectDialog::set_dst_method(const StringName &p_method) {
dst_method->set_text(p_method);
}
-void ConnectDialog::_bind_methods() {
+Vector<Variant> ConnectDialog::get_binds() const {
- ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
- ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected);
+ return cdbinds->params;
+}
- ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
- ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind);
+bool ConnectDialog::get_deferred() const {
- ADD_SIGNAL(MethodInfo("connected"));
+ return deferred->is_pressed();
+}
+
+bool ConnectDialog::get_oneshot() const {
+
+ return oneshot->is_pressed();
+}
+
+/*
+Returns true if ConnectDialog is being used to edit an existing connection.
+*/
+bool ConnectDialog::is_editing() const {
+
+ return bEditMode;
+}
+
+/*
+Initialize ConnectDialog and populate fields with expected data.
+If creating a connection from scratch, sensible defaults are used.
+If editing an existing connection, previous data is retained.
+*/
+void ConnectDialog::init(Connection c, bool bEdit) {
+
+ source = static_cast<Node *>(c.source);
+ signal = c.signal;
+
+ tree->set_selected(NULL);
+ tree->set_marked(source, true);
+
+ set_dst_node(static_cast<Node *>(c.target));
+ set_dst_method(c.method);
+
+ bool bDeferred = (c.flags & CONNECT_DEFERRED) == CONNECT_DEFERRED;
+ bool bOneshot = (c.flags & CONNECT_ONESHOT) == CONNECT_ONESHOT;
+
+ deferred->set_pressed(bDeferred);
+ oneshot->set_pressed(bOneshot);
+
+ cdbinds->params.clear();
+ cdbinds->params = c.binds;
+ cdbinds->notify_changed();
+
+ bEditMode = bEdit;
}
ConnectDialog::ConnectDialog() {
@@ -261,6 +301,8 @@ ConnectDialog::ConnectDialog() {
tree = memnew(SceneTreeEditor(false));
tree->get_scene_tree()->connect("item_activated", this, "_ok");
+ tree->connect("node_selected", this, "_tree_node_selected");
+
vbc_left->add_margin_child(TTR("Connect To Node:"), tree, true);
VBoxContainer *vbc_right = memnew(VBoxContainer);
@@ -272,12 +314,10 @@ ConnectDialog::ConnectDialog() {
type_list = memnew(OptionButton);
type_list->set_h_size_flags(SIZE_EXPAND_FILL);
add_bind_hb->add_child(type_list);
-
type_list->add_item("bool", Variant::BOOL);
type_list->add_item("int", Variant::INT);
type_list->add_item("real", Variant::REAL);
type_list->add_item("string", Variant::STRING);
- //type_list->add_separator();
type_list->add_item("Vector2", Variant::VECTOR2);
type_list->add_item("Rect2", Variant::RECT2);
type_list->add_item("Vector3", Variant::VECTOR3);
@@ -286,12 +326,10 @@ ConnectDialog::ConnectDialog() {
type_list->add_item("AABB", Variant::AABB);
type_list->add_item("Basis", Variant::BASIS);
type_list->add_item("Transform", Variant::TRANSFORM);
- //type_list->add_separator();
type_list->add_item("Color", Variant::COLOR);
type_list->select(0);
Button *add_bind = memnew(Button);
-
add_bind->set_text(TTR("Add"));
add_bind_hb->add_child(add_bind);
add_bind->connect("pressed", this, "_add_bind");
@@ -318,8 +356,9 @@ ConnectDialog::ConnectDialog() {
dst_method->set_h_size_flags(SIZE_EXPAND_FILL);
dstm_hb->add_child(dst_method);
- /*dst_method_list = memnew( MenuButton );
- dst_method_list->set_text("List..");
+ /*
+ dst_method_list = memnew( MenuButton );
+ dst_method_list->set_text("List...");
dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END );
dst_method_list->set_anchor( MARGIN_LEFT, ANCHOR_END );
dst_method_list->set_anchor( MARGIN_TOP, ANCHOR_END );
@@ -327,7 +366,6 @@ ConnectDialog::ConnectDialog() {
dst_method_list->set_begin( Point2( 70,59) );
dst_method_list->set_end( Point2( 15,39 ) );
*/
- //add_child(dst_method_list);
make_callback = memnew(CheckButton);
make_callback->set_toggle_mode(true);
@@ -343,8 +381,6 @@ ConnectDialog::ConnectDialog() {
oneshot->set_text(TTR("Oneshot"));
dstm_hb->add_child(oneshot);
- tree->connect("node_selected", this, "_tree_node_selected");
-
set_as_toplevel(true);
cdbinds = memnew(ConnectDialogBinds);
@@ -356,134 +392,365 @@ ConnectDialog::ConnectDialog() {
}
ConnectDialog::~ConnectDialog() {
+
memdelete(cdbinds);
}
-void ConnectionsDock::_notification(int p_what) {
-
- if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- update_tree();
- }
-}
+//ConnectionsDock ==========================
-void ConnectionsDock::_close() {
+struct _ConnectionsDockMethodInfoSort {
- hide();
-}
+ _FORCE_INLINE_ bool operator()(const MethodInfo &a, const MethodInfo &b) const {
+ return a.name < b.name;
+ }
+};
-void ConnectionsDock::_connect() {
+/*
+Post-ConnectDialog callback for creating/editing connections.
+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);
- String signal = it->get_metadata(0).operator Dictionary()["name"];
NodePath dst_path = connect_dialog->get_dst_path();
- Node *target = node->get_node(dst_path);
+ Node *target = selectedNode->get_node(dst_path);
ERR_FAIL_COND(!target);
- StringName dst_method = connect_dialog->get_dst_method();
+ Connection cToMake;
+ cToMake.source = connect_dialog->get_source();
+ cToMake.target = target;
+ cToMake.signal = connect_dialog->get_signal_name();
+ cToMake.method = connect_dialog->get_dst_method_name();
+ cToMake.binds = connect_dialog->get_binds();
bool defer = connect_dialog->get_deferred();
bool oshot = connect_dialog->get_oneshot();
- Vector<Variant> binds = connect_dialog->get_binds();
- PoolStringArray args = it->get_metadata(0).operator Dictionary()["args"];
- int flags = CONNECT_PERSIST | (defer ? CONNECT_DEFERRED : 0) | (oshot ? CONNECT_ONESHOT : 0);
+ cToMake.flags = CONNECT_PERSIST | (defer ? CONNECT_DEFERRED : 0) | (oshot ? CONNECT_ONESHOT : 0);
+
+ if (connect_dialog->is_editing()) {
+ _disconnect(*it);
+ _connect(cToMake);
+ } else {
+ _connect(cToMake);
+ }
- undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"), signal, String(dst_method)));
- undo_redo->add_do_method(node, "connect", signal, target, dst_method, binds, flags);
- undo_redo->add_undo_method(node, "disconnect", signal, target, dst_method);
+ if (connect_dialog->get_make_callback()) {
+ PoolStringArray args = it->get_metadata(0).operator Dictionary()["args"];
+ editor->emit_signal("script_add_function_request", target, cToMake.method, args);
+ hide();
+ }
+
+ update_tree();
+}
+
+/*
+Creates single connection w/ undo-redo functionality.
+*/
+void ConnectionsDock::_connect(Connection cToMake) {
+
+ Node *source = static_cast<Node *>(cToMake.source);
+ Node *target = static_cast<Node *>(cToMake.target);
+
+ if (!source || !target)
+ return;
+
+ undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"), String(cToMake.signal), String(cToMake.method)));
+
+ undo_redo->add_do_method(source, "connect", cToMake.signal, target, cToMake.method, cToMake.binds, cToMake.flags);
+ undo_redo->add_undo_method(source, "disconnect", cToMake.signal, target, cToMake.method);
undo_redo->add_do_method(this, "update_tree");
undo_redo->add_undo_method(this, "update_tree");
undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); //to force redraw of scene tree
- undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); //to force redraw of scene tree
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
undo_redo->commit_action();
+}
- if (connect_dialog->get_make_callback()) {
+/*
+Break single connection w/ undo-redo functionality.
+*/
+void ConnectionsDock::_disconnect(TreeItem &item) {
- print_line("request connect");
- editor->emit_signal("script_add_function_request", target, dst_method, args);
- hide();
+ Connection c = item.get_metadata(0);
+ ERR_FAIL_COND(c.source != selectedNode); //shouldn't happen but...bugcheck
+
+ undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), c.signal, c.method));
+
+ undo_redo->add_do_method(selectedNode, "disconnect", c.signal, c.target, c.method);
+ undo_redo->add_undo_method(selectedNode, "connect", c.signal, c.target, c.method, c.binds, c.flags);
+ undo_redo->add_do_method(this, "update_tree");
+ undo_redo->add_undo_method(this, "update_tree");
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); //to force redraw of scene tree
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+
+ undo_redo->commit_action();
+}
+
+/*
+Break all conections of currently selected signal.
+Can undo-redo as a single action.
+*/
+void ConnectionsDock::_disconnect_all() {
+
+ TreeItem *item = tree->get_selected();
+
+ if (!_is_item_signal(*item))
+ return;
+
+ TreeItem *child = item->get_children();
+ String signalName = item->get_metadata(0).operator Dictionary()["name"];
+ undo_redo->create_action(vformat(TTR("Disconnect all from signal: '%s'"), signalName));
+
+ while (child) {
+ Connection c = child->get_metadata(0);
+ undo_redo->add_do_method(selectedNode, "disconnect", c.signal, c.target, c.method);
+ undo_redo->add_undo_method(selectedNode, "connect", c.signal, c.target, c.method, c.binds, c.flags);
+ child = child->get_next();
}
- update_tree();
+ undo_redo->add_do_method(this, "update_tree");
+ undo_redo->add_undo_method(this, "update_tree");
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree");
+
+ undo_redo->commit_action();
}
-void ConnectionsDock::_connect_pressed() {
+void ConnectionsDock::_tree_item_selected() {
TreeItem *item = tree->get_selected();
- if (!item) {
- //no idea how this happened, but disable
+ if (!item) { //Unlikely. Disable button just in case.
+ connect_button->set_text(TTR("Connect..."));
connect_button->set_disabled(true);
+ } else if (_is_item_signal(*item)) {
+ connect_button->set_text(TTR("Connect..."));
+ connect_button->set_disabled(false);
+ } else {
+ connect_button->set_text(TTR("Disconnect"));
+ connect_button->set_disabled(false);
+ }
+}
+
+void ConnectionsDock::_tree_item_activated() { //"Activation" on double-click.
+
+ TreeItem *item = tree->get_selected();
+
+ if (!item)
return;
+
+ if (_is_item_signal(*item)) {
+ _open_connection_dialog(*item);
+ } else {
+ _go_to_script(*item);
}
- if (item->get_parent() == tree->get_root() || item->get_parent()->get_parent() == tree->get_root()) {
- //a signal - connect
- String signal = item->get_metadata(0).operator Dictionary()["name"];
- String signalname = signal;
- String midname = node->get_name();
- for (int i = 0; i < midname.length(); i++) {
- CharType c = midname[i];
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_') {
- //all good
- } else if (c == ' ') {
+}
+
+bool ConnectionsDock::_is_item_signal(TreeItem &item) {
+
+ return (item.get_parent() == tree->get_root() || item.get_parent()->get_parent() == tree->get_root());
+}
+
+/*
+Open connection dialog with TreeItem data to CREATE a brand-new connection.
+*/
+void ConnectionsDock::_open_connection_dialog(TreeItem &item) {
+
+ String signal = item.get_metadata(0).operator Dictionary()["name"];
+ String signalname = signal;
+ String midname = selectedNode->get_name();
+ for (int i = 0; i < midname.length(); i++) { //TODO: Regex filter may be cleaner.
+ CharType c = midname[i];
+ if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_')) {
+ if (c == ' ') {
+ //Replace spaces with underlines.
c = '_';
} else {
+ //Remove any other characters.
midname.remove(i);
i--;
continue;
}
-
- midname[i] = c;
}
+ midname[i] = c;
+ }
+
+ Node *dst_node = selectedNode->get_owner() ? selectedNode->get_owner() : selectedNode;
+ StringName dst_method = "_on_" + midname + "_" + signal;
- connect_dialog->edit(node);
+ Connection c;
+ c.source = selectedNode;
+ c.signal = StringName(signalname);
+ c.target = dst_node;
+ c.method = dst_method;
+
+ connect_dialog->init(c);
+ connect_dialog->set_title(TTR("Connect Signal: ") + signalname);
+ connect_dialog->popup_centered_ratio();
+}
+
+/*
+Open connection dialog with Connection data to EDIT an existing connection.
+*/
+void ConnectionsDock::_open_connection_dialog(Connection cToEdit) {
+
+ Node *src = static_cast<Node *>(cToEdit.source);
+ Node *dst = static_cast<Node *>(cToEdit.target);
+
+ if (src && dst) {
+ connect_dialog->init(cToEdit, true);
+ connect_dialog->set_title(TTR("Edit Connection: ") + cToEdit.signal);
connect_dialog->popup_centered_ratio();
- connect_dialog->set_title(TTR("Connecting Signal:") + " " + signalname);
- connect_dialog->set_dst_method("_on_" + midname + "_" + signal);
- connect_dialog->set_dst_node(node->get_owner() ? node->get_owner() : node);
+ }
+}
+
+/*
+Open slot method location in script editor.
+*/
+void ConnectionsDock::_go_to_script(TreeItem &item) {
+
+ if (_is_item_signal(item))
+ return;
+
+ Connection c = item.get_metadata(0);
+ ERR_FAIL_COND(c.source != selectedNode); //shouldn't happen but...bugcheck
+
+ if (!c.target)
+ return;
+ Ref<Script> script = c.target->get_script();
+
+ if (script.is_null())
+ return;
+
+ if (script.is_valid() && ScriptEditor::get_singleton()->script_goto_method(script, c.method)) {
+ editor->call("_editor_select", EditorNode::EDITOR_SCRIPT);
+ }
+}
+
+void ConnectionsDock::_handle_signal_menu_option(int option) {
+
+ TreeItem *item = tree->get_selected();
+
+ if (!item)
+ return;
+
+ switch (option) {
+ case CONNECT: {
+ _open_connection_dialog(*item);
+ } break;
+ case DISCONNECT_ALL: {
+ StringName signalName = item->get_metadata(0).operator Dictionary()["name"];
+ disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from the \"") + signalName + "\" signal?");
+ disconnect_all_dialog->popup_centered();
+ } break;
+ }
+}
+
+void ConnectionsDock::_handle_slot_menu_option(int option) {
+
+ TreeItem *item = tree->get_selected();
+
+ if (!item)
+ return;
+
+ switch (option) {
+ case EDIT: {
+ Connection c = item->get_metadata(0);
+ _open_connection_dialog(c);
+ } break;
+ case GO_TO_SCRIPT: {
+ _go_to_script(*item);
+ } break;
+ case DISCONNECT: {
+ _disconnect(*item);
+ update_tree();
+ } break;
+ }
+}
+
+void ConnectionsDock::_rmb_pressed(Vector2 position) {
+
+ TreeItem *item = tree->get_selected();
+
+ if (!item)
+ return;
+
+ Vector2 global_position = tree->get_global_position() + position;
+
+ if (_is_item_signal(*item)) {
+ signal_menu->set_position(global_position);
+ signal_menu->popup();
} else {
- //a slot- disconnect
- Connection c = item->get_metadata(0);
- ERR_FAIL_COND(c.source != node); //shouldn't happen but...bugcheck
-
- undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), c.signal, c.method));
- undo_redo->add_do_method(node, "disconnect", c.signal, c.target, c.method);
- undo_redo->add_undo_method(node, "connect", c.signal, c.target, c.method, Vector<Variant>(), c.flags);
- undo_redo->add_do_method(this, "update_tree");
- undo_redo->add_undo_method(this, "update_tree");
- undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); //to force redraw of scene tree
- undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(), "update_tree"); //to force redraw of scene tree
- undo_redo->commit_action();
-
- c.source->disconnect(c.signal, c.target, c.method);
+ slot_menu->set_position(global_position);
+ slot_menu->popup();
+ }
+}
+
+void ConnectionsDock::_close() {
+
+ hide();
+}
+
+void ConnectionsDock::_connect_pressed() {
+
+ TreeItem *item = tree->get_selected();
+ if (!item) {
+ connect_button->set_disabled(true);
+ return;
+ }
+
+ if (_is_item_signal(*item)) {
+ _open_connection_dialog(*item);
+ } else {
+ _disconnect(*item);
update_tree();
}
}
-struct _ConnectionsDockMethodInfoSort {
+void ConnectionsDock::_notification(int p_what) {
- _FORCE_INLINE_ bool operator()(const MethodInfo &a, const MethodInfo &b) const {
- return a.name < b.name;
+ if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
+ update_tree();
}
-};
+}
+
+void ConnectionsDock::_bind_methods() {
+
+ ClassDB::bind_method("_make_or_edit_connection", &ConnectionsDock::_make_or_edit_connection);
+ ClassDB::bind_method("_disconnect_all", &ConnectionsDock::_disconnect_all);
+ ClassDB::bind_method("_tree_item_selected", &ConnectionsDock::_tree_item_selected);
+ ClassDB::bind_method("_tree_item_activated", &ConnectionsDock::_tree_item_activated);
+ ClassDB::bind_method("_handle_signal_menu_option", &ConnectionsDock::_handle_signal_menu_option);
+ ClassDB::bind_method("_handle_slot_menu_option", &ConnectionsDock::_handle_slot_menu_option);
+ ClassDB::bind_method("_rmb_pressed", &ConnectionsDock::_rmb_pressed);
+ ClassDB::bind_method("_close", &ConnectionsDock::_close);
+ ClassDB::bind_method("_connect_pressed", &ConnectionsDock::_connect_pressed);
+ ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree);
+}
+
+void ConnectionsDock::set_node(Node *p_node) {
+
+ selectedNode = p_node;
+ update_tree();
+}
void ConnectionsDock::update_tree() {
tree->clear();
- if (!node)
+ if (!selectedNode)
return;
TreeItem *root = tree->create_item();
List<MethodInfo> node_signals;
- node->get_signal_list(&node_signals);
+ selectedNode->get_signal_list(&node_signals);
//node_signals.sort_custom<_ConnectionsDockMethodInfoSort>();
bool did_script = false;
- StringName base = node->get_class();
+ StringName base = selectedNode->get_class();
while (base) {
@@ -493,7 +760,7 @@ void ConnectionsDock::update_tree() {
if (!did_script) {
- Ref<Script> scr = node->get_script();
+ Ref<Script> scr = selectedNode->get_script();
if (scr.is_valid()) {
scr->get_script_signal_list(&node_signals);
if (scr->get_path().is_resource_file())
@@ -563,7 +830,7 @@ void ConnectionsDock::update_tree() {
item->set_icon(0, get_icon("Signal", "EditorIcons"));
List<Object::Connection> connections;
- node->get_signal_connection_list(mi.name, &connections);
+ selectedNode->get_signal_connection_list(mi.name, &connections);
for (List<Object::Connection>::Element *F = connections.front(); F; F = F->next()) {
@@ -575,7 +842,7 @@ void ConnectionsDock::update_tree() {
if (!target)
continue;
- String path = String(node->get_path_to(target)) + " :: " + c.method + "()";
+ String path = String(selectedNode->get_path_to(target)) + " :: " + c.method + "()";
if (c.flags & CONNECT_DEFERRED)
path += " (deferred)";
if (c.flags & CONNECT_ONESHOT)
@@ -610,88 +877,6 @@ void ConnectionsDock::update_tree() {
connect_button->set_disabled(true);
}
-void ConnectionsDock::set_node(Node *p_node) {
-
- node = p_node;
- update_tree();
-}
-
-void ConnectionsDock::_something_selected() {
-
- TreeItem *item = tree->get_selected();
- if (!item) {
- //no idea how this happened, but disable
- connect_button->set_text(TTR("Connect.."));
- connect_button->set_disabled(true);
-
- } else if (item->get_parent() == tree->get_root() || item->get_parent()->get_parent() == tree->get_root()) {
- //a signal - connect
- connect_button->set_text(TTR("Connect.."));
- connect_button->set_disabled(false);
-
- } else {
- //a slot- disconnect
- connect_button->set_text(TTR("Disconnect"));
- connect_button->set_disabled(false);
- }
-}
-
-void ConnectionsDock::_something_activated() {
-
- TreeItem *item = tree->get_selected();
-
- if (!item)
- return;
-
- if (item->get_parent() == tree->get_root() || item->get_parent()->get_parent() == tree->get_root()) {
- // a signal - connect
- String signal = item->get_metadata(0).operator Dictionary()["name"];
- String midname = node->get_name();
- for (int i = 0; i < midname.length(); i++) {
- CharType c = midname[i];
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_') {
- //all good
- } else if (c == ' ') {
- c = '_';
- } else {
- midname.remove(i);
- i--;
- continue;
- }
-
- midname[i] = c;
- }
-
- connect_dialog->edit(node);
- connect_dialog->popup_centered_ratio();
- connect_dialog->set_dst_method("_on_" + midname + "_" + signal);
- connect_dialog->set_dst_node(node->get_owner() ? node->get_owner() : node);
- } else {
- // a slot - go to target method
- Connection c = item->get_metadata(0);
- ERR_FAIL_COND(c.source != node); //shouldn't happen but...bugcheck
-
- if (!c.target)
- return;
-
- Ref<Script> script = c.target->get_script();
-
- if (script.is_valid() && ScriptEditor::get_singleton()->script_goto_method(script, c.method)) {
- editor->call("_editor_select", EditorNode::EDITOR_SCRIPT);
- }
- }
-}
-
-void ConnectionsDock::_bind_methods() {
-
- ClassDB::bind_method("_connect", &ConnectionsDock::_connect);
- ClassDB::bind_method("_something_selected", &ConnectionsDock::_something_selected);
- ClassDB::bind_method("_something_activated", &ConnectionsDock::_something_activated);
- ClassDB::bind_method("_close", &ConnectionsDock::_close);
- ClassDB::bind_method("_connect_pressed", &ConnectionsDock::_connect_pressed);
- ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree);
-}
-
ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
editor = p_editor;
@@ -705,6 +890,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
tree->set_hide_root(true);
vbc->add_child(tree);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
+ tree->set_allow_rmb_select(true);
connect_button = memnew(Button);
connect_button->set_text(TTR("Connect"));
@@ -713,15 +899,29 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
hb->add_spacer();
hb->add_child(connect_button);
connect_button->connect("pressed", this, "_connect_pressed");
- //add_child(tree);
connect_dialog = memnew(ConnectDialog);
connect_dialog->set_as_toplevel(true);
add_child(connect_dialog);
- remove_confirm = memnew(ConfirmationDialog);
- remove_confirm->set_as_toplevel(true);
- add_child(remove_confirm);
+ disconnect_all_dialog = memnew(ConfirmationDialog);
+ disconnect_all_dialog->set_as_toplevel(true);
+ add_child(disconnect_all_dialog);
+ disconnect_all_dialog->connect("confirmed", this, "_disconnect_all");
+ disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?"));
+
+ signal_menu = memnew(PopupMenu);
+ add_child(signal_menu);
+ signal_menu->connect("id_pressed", this, "_handle_signal_menu_option");
+ signal_menu->add_item(TTR("Connect..."), CONNECT);
+ signal_menu->add_item(TTR("Disconnect All"), DISCONNECT_ALL);
+
+ slot_menu = memnew(PopupMenu);
+ add_child(slot_menu);
+ slot_menu->connect("id_pressed", this, "_handle_slot_menu_option");
+ slot_menu->add_item(TTR("Edit..."), EDIT);
+ slot_menu->add_item(TTR("Go To Method"), GO_TO_SCRIPT);
+ slot_menu->add_item(TTR("Disconnect"), DISCONNECT);
/*
node_only->set_anchor( MARGIN_TOP, ANCHOR_END );
@@ -732,10 +932,10 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
node_only->set_end( Point2( 10,44) );
*/
- remove_confirm->connect("confirmed", this, "_remove_confirm");
- connect_dialog->connect("connected", this, "_connect");
- tree->connect("item_selected", this, "_something_selected");
- tree->connect("item_activated", this, "_something_activated");
+ connect_dialog->connect("connected", this, "_make_or_edit_connection");
+ tree->connect("item_selected", this, "_tree_item_selected");
+ tree->connect("item_activated", this, "_tree_item_activated");
+ tree->connect("item_rmb_selected", this, "_rmb_pressed");
add_constant_override("separation", 3 * EDSCALE);
}
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 5e26e00f67..932ff693e4 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -28,6 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+/**
+@author Juan Linietsky <reduzio@gmail.com>
+*/
+
#ifndef CONNECTIONS_DIALOG_H
#define CONNECTIONS_DIALOG_H
@@ -42,27 +46,28 @@
#include "scene/gui/tree.h"
#include "undo_redo.h"
-/**
-@author Juan Linietsky <reduzio@gmail.com>
-*/
-
+class PopupMenu;
class ConnectDialogBinds;
class ConnectDialog : public ConfirmationDialog {
GDCLASS(ConnectDialog, ConfirmationDialog);
- ConfirmationDialog *error;
+ Node *source;
+ StringName signal;
LineEdit *dst_path;
LineEdit *dst_method;
+ ConnectDialogBinds *cdbinds;
+ bool bEditMode;
+
SceneTreeEditor *tree;
+ ConfirmationDialog *error;
+ PropertyEditor *bind_editor;
OptionButton *type_list;
CheckButton *deferred;
CheckButton *oneshot;
CheckButton *make_callback;
- PropertyEditor *bind_editor;
- Node *node;
- ConnectDialogBinds *cdbinds;
+
void ok_pressed();
void _cancel_pressed();
void _tree_node_selected();
@@ -74,37 +79,71 @@ protected:
static void _bind_methods();
public:
- bool get_make_callback() { return make_callback->is_visible() && make_callback->is_pressed(); }
+ Node *get_source() const;
+ StringName get_signal_name() const;
NodePath get_dst_path() const;
- StringName get_dst_method() const;
+ void set_dst_node(Node *p_node);
+ StringName get_dst_method_name() const;
+ void set_dst_method(const StringName &p_method);
+ Vector<Variant> get_binds() const;
+
+ bool get_make_callback() { return make_callback->is_visible() && make_callback->is_pressed(); }
bool get_deferred() const;
bool get_oneshot() const;
- Vector<Variant> get_binds() const;
- void set_dst_method(const StringName &p_method);
- void set_dst_node(Node *p_node);
+ bool is_editing() const;
- void edit(Node *p_node);
+ void init(Connection c, bool bEdit = false);
ConnectDialog();
~ConnectDialog();
};
+//========================================
+
class ConnectionsDock : public VBoxContainer {
GDCLASS(ConnectionsDock, VBoxContainer);
- Button *connect_button;
- EditorNode *editor;
- Node *node;
+ //Right-click Pop-up Menu Options.
+ enum SignalMenuOption {
+ CONNECT,
+ DISCONNECT_ALL
+ };
+
+ enum SlotMenuOption {
+ EDIT,
+ GO_TO_SCRIPT,
+ DISCONNECT
+ };
+
+ Node *selectedNode;
Tree *tree;
- ConfirmationDialog *remove_confirm;
+ EditorNode *editor;
+
+ ConfirmationDialog *disconnect_all_dialog;
ConnectDialog *connect_dialog;
+ Button *connect_button;
+ PopupMenu *signal_menu;
+ PopupMenu *slot_menu;
+ UndoRedo *undo_redo;
+
+ void _make_or_edit_connection();
+ void _connect(Connection cToMake);
+ void _disconnect(TreeItem &item);
+ void _disconnect_all();
+ void _tree_item_selected();
+ void _tree_item_activated();
+ bool _is_item_signal(TreeItem &item);
+
+ void _open_connection_dialog(TreeItem &item);
+ void _open_connection_dialog(Connection cToEdit);
+ void _go_to_script(TreeItem &item);
+
+ void _handle_signal_menu_option(int option);
+ void _handle_slot_menu_option(int option);
+ void _rmb_pressed(Vector2 position);
void _close();
- void _connect();
- void _something_selected();
- void _something_activated();
- UndoRedo *undo_redo;
protected:
void _connect_pressed();
@@ -113,9 +152,7 @@ protected:
public:
void set_undoredo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
-
void set_node(Node *p_node);
- String get_selected_type();
void update_tree();
ConnectionsDock(EditorNode *p_editor = NULL);
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index fdc58e6292..36978e37a5 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -87,7 +87,14 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/create_new_node_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds"));
} else {
- popup_centered_ratio();
+
+ Size2 popup_size = Size2(900, 700) * editor_get_scale();
+ Size2 window_size = get_viewport_rect().size;
+
+ popup_size.x = MIN(window_size.x * 0.8, popup_size.x);
+ popup_size.y = MIN(window_size.y * 0.8, popup_size.y);
+
+ popup_centered(popup_size);
}
if (p_dont_clear) {
@@ -433,26 +440,7 @@ Object *CreateDialog::instance_selected() {
custom = md;
if (custom != String()) {
- if (EditorNode::get_editor_data().get_custom_types().has(custom)) {
-
- for (int i = 0; i < EditorNode::get_editor_data().get_custom_types()[custom].size(); i++) {
- if (EditorNode::get_editor_data().get_custom_types()[custom][i].name == selected->get_text(0)) {
- Ref<Texture> icon = EditorNode::get_editor_data().get_custom_types()[custom][i].icon;
- Ref<Script> script = EditorNode::get_editor_data().get_custom_types()[custom][i].script;
- String name = selected->get_text(0);
-
- Object *ob = ClassDB::instance(custom);
- ERR_FAIL_COND_V(!ob, NULL);
- if (ob->is_class("Node")) {
- ob->call("set_name", name);
- }
- ob->set_script(script.get_ref_ptr());
- if (icon.is_valid())
- ob->set_meta("_editor_icon", icon);
- return ob;
- }
- }
- }
+ return EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom);
} else {
return ClassDB::instance(selected->get_text(0));
}
@@ -476,6 +464,8 @@ void CreateDialog::_item_selected() {
return;
help_bit->set_text(EditorHelp::get_doc_data()->class_list[name].brief_description);
+
+ get_ok()->set_disabled(false);
}
void CreateDialog::_favorite_toggled() {
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 19fd297f69..c4a17d5402 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -472,17 +472,18 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed
void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<String> &p_files) {
all_remove_files.clear();
- to_delete.clear();
+ dirs_to_delete.clear();
+ files_to_delete.clear();
owners->clear();
for (int i = 0; i < p_folders.size(); ++i) {
String folder = p_folders[i].ends_with("/") ? p_folders[i] : (p_folders[i] + "/");
_find_files_in_removed_folder(EditorFileSystem::get_singleton()->get_filesystem_path(folder), folder);
- to_delete.push_back(folder);
+ dirs_to_delete.push_back(folder);
}
for (int i = 0; i < p_files.size(); ++i) {
all_remove_files[p_files[i]] = String();
- to_delete.push_back(p_files[i]);
+ files_to_delete.push_back(p_files[i]);
}
Vector<RemovedDependency> removed_deps;
@@ -502,29 +503,49 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
}
void DependencyRemoveDialog::ok_pressed() {
- bool files_only = true;
- for (int i = 0; i < to_delete.size(); ++i) {
- if (to_delete[i].ends_with("/")) {
- files_only = false;
- } else if (ResourceCache::has(to_delete[i])) {
- Resource *res = ResourceCache::get(to_delete[i]);
- res->set_path(""); //clear reference to path
- }
- String path = OS::get_singleton()->get_resource_dir() + to_delete[i].replace_first("res://", "/");
+ for (int i = 0; i < files_to_delete.size(); ++i) {
+ if (ResourceCache::has(files_to_delete[i])) {
+ Resource *res = ResourceCache::get(files_to_delete[i]);
+ res->set_path("");
+ }
+ String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
print_line("Moving to trash: " + path);
Error err = OS::get_singleton()->move_to_trash(path);
if (err != OK) {
- EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + to_delete[i] + "\n");
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n");
}
}
- if (files_only) {
+ if (dirs_to_delete.size() == 0) {
//If we only deleted files we should only need to tell the file system about the files we touched.
- for (int i = 0; i < to_delete.size(); ++i) {
- EditorFileSystem::get_singleton()->update_file(to_delete[i]);
- }
+ for (int i = 0; i < files_to_delete.size(); ++i)
+ EditorFileSystem::get_singleton()->update_file(files_to_delete[i]);
} else {
+
+ for (int i = 0; i < dirs_to_delete.size(); ++i) {
+ String path = OS::get_singleton()->get_resource_dir() + dirs_to_delete[i].replace_first("res://", "/");
+ print_line("Moving to trash: " + path);
+ Error err = OS::get_singleton()->move_to_trash(path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + dirs_to_delete[i] + "\n");
+ }
+ }
+
+ // if some dirs would be deleted, favorite dirs need to be updated
+ Vector<String> previous_favorite_dirs = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> new_favorite_dirs;
+
+ for (int i = 0; i < previous_favorite_dirs.size(); ++i) {
+ if (dirs_to_delete.find(previous_favorite_dirs[i] + "/") < 0) {
+ new_favorite_dirs.push_back(previous_favorite_dirs[i]);
+ }
+ }
+
+ if (new_favorite_dirs.size() < previous_favorite_dirs.size()) {
+ EditorSettings::get_singleton()->set_favorite_dirs(new_favorite_dirs);
+ }
+
EditorFileSystem::get_singleton()->scan_changes();
}
}
diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h
index 16135c352b..4f268de748 100644
--- a/editor/dependency_editor.h
+++ b/editor/dependency_editor.h
@@ -102,7 +102,8 @@ class DependencyRemoveDialog : public ConfirmationDialog {
Tree *owners;
Map<String, String> all_remove_files;
- Vector<String> to_delete;
+ Vector<String> dirs_to_delete;
+ Vector<String> files_to_delete;
struct RemovedDependency {
String file;
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 3a418e5f33..542dca74e0 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -233,7 +233,12 @@ void DocData::generate(bool p_basic_types) {
c.category = ClassDB::get_category(name);
List<PropertyInfo> properties;
- ClassDB::get_property_list(name, &properties, true);
+ if (name == "ProjectSettings") {
+ //special case for project settings, so settings can be documented
+ ProjectSettings::get_singleton()->get_property_list(&properties);
+ } else {
+ ClassDB::get_property_list(name, &properties, true);
+ }
for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
if (E->get().usage & PROPERTY_USAGE_GROUP || E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_INTERNAL)
@@ -567,6 +572,9 @@ void DocData::generate(bool p_basic_types) {
PropertyDoc pd;
Engine::Singleton &s = E->get();
+ if (!s.ptr) {
+ continue;
+ }
pd.name = s.name;
pd.type = s.ptr->get_class();
while (String(ClassDB::get_parent_class(pd.type)) != "Object")
@@ -807,9 +815,24 @@ Error DocData::_load(Ref<XMLParser> parser) {
if (parser->get_node_type() == XMLParser::NODE_TEXT)
c.description = parser->get_node_data();
} else if (name == "tutorials") {
- parser->read();
- if (parser->get_node_type() == XMLParser::NODE_TEXT)
- c.tutorials = parser->get_node_data();
+ while (parser->read() == OK) {
+
+ if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
+
+ String name = parser->get_node_name();
+
+ if (name == "link") {
+
+ parser->read();
+ if (parser->get_node_type() == XMLParser::NODE_TEXT)
+ c.tutorials.push_back(parser->get_node_data().strip_edges());
+ } else {
+ ERR_EXPLAIN("Invalid tag in doc file: " + name);
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+ } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "tutorials")
+ break; //end of <tutorials>
+ }
} else if (name == "demos") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
@@ -974,7 +997,7 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
if (c.category == "")
category = "Core";
header += " category=\"" + category + "\"";
- header += String(" version=\"") + itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + "\"";
+ header += String(" version=\"") + VERSION_NUMBER + "\"";
header += ">";
_write_string(f, 0, header);
_write_string(f, 1, "<brief_description>");
@@ -984,7 +1007,9 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
_write_string(f, 2, c.description.strip_edges().xml_escape());
_write_string(f, 1, "</description>");
_write_string(f, 1, "<tutorials>");
- _write_string(f, 2, c.tutorials.strip_edges().xml_escape());
+ for (int i = 0; i < c.tutorials.size(); i++) {
+ _write_string(f, 2, "<link>" + c.tutorials.get(i).xml_escape() + "</link>");
+ }
_write_string(f, 1, "</tutorials>");
_write_string(f, 1, "<demos>");
_write_string(f, 2, c.demos.strip_edges().xml_escape());
diff --git a/editor/doc/doc_data.h b/editor/doc/doc_data.h
index 0461133f9f..c7b70b5fb9 100644
--- a/editor/doc/doc_data.h
+++ b/editor/doc/doc_data.h
@@ -85,7 +85,7 @@ public:
String category;
String brief_description;
String description;
- String tutorials;
+ Vector<String> tutorials;
String demos;
Vector<MethodDoc> methods;
Vector<MethodDoc> signals;
diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp
index 905732a43f..adbe23dcd5 100644
--- a/editor/doc/doc_dump.cpp
+++ b/editor/doc/doc_dump.cpp
@@ -83,7 +83,7 @@ void DocDump::dump(const String &p_file) {
FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE);
_write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
- _write_string(f, 0, String("<doc version=\"") + itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + "\" name=\"Engine Types\">");
+ _write_string(f, 0, String("<doc version=\"") + VERSION_NUMBER + "\" name=\"Engine Types\">");
while (class_list.size()) {
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 9ab539da07..4b09db0a9e 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -31,11 +31,11 @@
#include "editor_about.h"
#include "editor_node.h"
-#include "authors.gen.h"
-#include "donors.gen.h"
-#include "license.gen.h"
-#include "version.h"
-#include "version_hash.gen.h"
+#include "core/authors.gen.h"
+#include "core/donors.gen.h"
+#include "core/license.gen.h"
+#include "core/version.h"
+#include "core/version_hash.gen.h"
void EditorAbout::_notification(int p_what) {
@@ -44,9 +44,11 @@ void EditorAbout::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
- Ref<Font> font = EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts");
+ Control *base = EditorNode::get_singleton()->get_gui_base();
+ Ref<Font> font = base->get_font("source", "EditorFonts");
_tpl_text->add_font_override("normal_font", font);
_license_text->add_font_override("normal_font", font);
+ _logo->set_texture(base->get_icon("Logo", "EditorIcons"));
} break;
}
}
@@ -67,7 +69,7 @@ TextureRect *EditorAbout::get_logo() const {
return _logo;
}
-ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[], const int p_flag_single_column) {
+ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<String> &p_sections, const char *const *const p_src[], const int p_flag_single_column) {
ScrollContainer *sc = memnew(ScrollContainer);
sc->set_name(p_name);
@@ -80,7 +82,7 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<St
for (int i = 0; i < p_sections.size(); i++) {
bool single_column = p_flag_single_column & 1 << i;
- const char **names_ptr = p_src[i];
+ const char *const *names_ptr = p_src[i];
if (*names_ptr) {
Label *lbl = memnew(Label);
@@ -149,7 +151,8 @@ EditorAbout::EditorAbout() {
dev_sections.push_back(TTR("Lead Developer"));
dev_sections.push_back(TTR("Project Manager ")); // " " appended to distinguish between 'project supervisor' and 'project list'
dev_sections.push_back(TTR("Developers"));
- const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
+ const char *const *dev_src[] = { AUTHORS_FOUNDERS, AUTHORS_LEAD_DEVELOPERS,
+ AUTHORS_PROJECT_MANAGERS, AUTHORS_DEVELOPERS };
tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src, 1));
// Donors
@@ -161,7 +164,8 @@ EditorAbout::EditorAbout() {
donor_sections.push_back(TTR("Gold Donors"));
donor_sections.push_back(TTR("Silver Donors"));
donor_sections.push_back(TTR("Bronze Donors"));
- const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze };
+ const char *const *donor_src[] = { DONORS_SPONSOR_PLAT, DONORS_SPONSOR_GOLD,
+ DONORS_SPONSOR_MINI, DONORS_GOLD, DONORS_SILVER, DONORS_BRONZE };
tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src, 3));
// License
@@ -170,7 +174,7 @@ EditorAbout::EditorAbout() {
_license_text->set_name(TTR("License"));
_license_text->set_h_size_flags(Control::SIZE_EXPAND_FILL);
_license_text->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- _license_text->set_text(String::utf8(about_license));
+ _license_text->set_text(String::utf8(GODOT_LICENSE_TEXT));
tc->add_child(_license_text);
// Thirdparty License
@@ -184,6 +188,7 @@ EditorAbout::EditorAbout() {
tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tpl_label->set_autowrap(true);
tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms."));
+ tpl_label->set_size(Size2(630, 1) * EDSCALE);
license_thirdparty->add_child(tpl_label);
HSplitContainer *tpl_hbc = memnew(HSplitContainer);
@@ -205,20 +210,27 @@ EditorAbout::EditorAbout() {
tpl_ti_lc->set_selectable(0, false);
int read_idx = 0;
String long_text = "";
- for (int i = 0; i < THIRDPARTY_COUNT; i++) {
+ for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) {
+ const ComponentCopyright &component = COPYRIGHT_INFO[component_index];
TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp);
- String thirdparty = String(about_thirdparty[i]);
- ti->set_text(0, thirdparty);
- String text = thirdparty + "\n";
- long_text += "- " + thirdparty + "\n\n";
- for (int j = 0; j < about_tp_copyright_count[i]; j++) {
-
- text += "\n Files:\n " + String(about_tp_file[read_idx]).replace("\n", "\n ") + "\n";
- String copyright = String::utf8(" \xc2\xa9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n \xc2\xa9 "));
+ String component_name = component.name;
+ ti->set_text(0, component_name);
+ String text = component_name + "\n";
+ long_text += "- " + component_name + "\n";
+ for (int part_index = 0; part_index < component.part_count; part_index++) {
+ const ComponentCopyrightPart &part = component.parts[part_index];
+ text += "\n Files:";
+ for (int file_num = 0; file_num < part.file_count; file_num++) {
+ text += "\n " + String(part.files[file_num]);
+ }
+ String copyright;
+ for (int copyright_index = 0; copyright_index < part.copyright_count; copyright_index++) {
+ copyright += String::utf8("\n \xc2\xa9 ") + String::utf8(part.copyright_statements[copyright_index]);
+ }
text += copyright;
long_text += copyright;
- String license = "\n License: " + String(about_tp_license[read_idx]) + "\n";
+ String license = "\n License: " + String(part.license) + "\n";
text += license;
long_text += license + "\n";
read_idx++;
@@ -228,10 +240,10 @@ EditorAbout::EditorAbout() {
for (int i = 0; i < LICENSE_COUNT; i++) {
TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc);
- String licensename = String(about_license_name[i]);
+ String licensename = String(LICENSE_NAMES[i]);
ti->set_text(0, licensename);
long_text += "- " + licensename + "\n\n";
- String licensebody = String(about_license_body[i]);
+ String licensebody = String(LICENSE_BODIES[i]);
ti->set_metadata(0, licensebody);
long_text += " " + licensebody.replace("\n", "\n ") + "\n\n";
}
diff --git a/editor/editor_about.h b/editor/editor_about.h
index b32fdf6567..71d1c95188 100644
--- a/editor/editor_about.h
+++ b/editor/editor_about.h
@@ -53,7 +53,7 @@ class EditorAbout : public AcceptDialog {
private:
void _license_tree_selected();
- ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[], const int p_flag_single_column = 0);
+ ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char *const *const p_src[], const int p_flag_single_column = 0);
Tree *_tpl_tree;
RichTextLabel *_license_text;
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 9d0de930f2..a084437226 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -121,6 +121,26 @@ void EditorAudioBus::_notification(int p_what) {
set_process(is_visible_in_tree());
}
+
+ if (p_what == NOTIFICATION_THEME_CHANGED) {
+
+ for (int i = 0; i < cc; i++) {
+ channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
+ channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
+ channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
+ channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
+ channel[i].prev_active = true;
+ }
+ scale->set_texture(get_icon("BusVuDb", "EditorIcons"));
+
+ disabled_vu = get_icon("BusVuFrozen", "EditorIcons");
+
+ solo->set_icon(get_icon("AudioBusSolo", "EditorIcons"));
+ mute->set_icon(get_icon("AudioBusMute", "EditorIcons"));
+ bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons"));
+
+ bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons"));
+ }
}
void EditorAudioBus::update_send() {
@@ -707,6 +727,9 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
channel[i].vu_r->set_min(-80);
channel[i].vu_r->set_max(24);
channel[i].vu_r->set_step(0.1);
+
+ channel[i].peak_l = 0.0f;
+ channel[i].peak_r = 0.0f;
}
scale = memnew(TextureRect);
@@ -716,6 +739,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
effects->set_hide_root(true);
effects->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
effects->set_hide_folding(true);
+ effects->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_child(effects);
effects->connect("item_edited", this, "_effect_edited");
effects->connect("cell_selected", this, "_effect_selected");
@@ -997,7 +1021,7 @@ void EditorAudioBuses::_select_layout() {
void EditorAudioBuses::_save_as_layout() {
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- file_dialog->set_title(TTR("Save Audio Bus Layout As.."));
+ file_dialog->set_title(TTR("Save Audio Bus Layout As..."));
file_dialog->set_current_path(edited_path);
file_dialog->popup_centered_ratio();
new_layout = false;
@@ -1006,7 +1030,7 @@ void EditorAudioBuses::_save_as_layout() {
void EditorAudioBuses::_new_layout() {
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- file_dialog->set_title(TTR("Location for New Layout.."));
+ file_dialog->set_title(TTR("Location for New Layout..."));
file_dialog->set_current_path(edited_path);
file_dialog->popup_centered_ratio();
new_layout = true;
@@ -1148,6 +1172,7 @@ EditorAudioBuses::EditorAudioBuses() {
bus_scroll->set_enable_v_scroll(false);
add_child(bus_scroll);
bus_hb = memnew(HBoxContainer);
+ bus_hb->set_v_size_flags(SIZE_EXPAND_FILL);
bus_scroll->add_child(bus_hb);
save_timer = memnew(Timer);
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 0e9b7b74fd..2f0982e5d9 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -33,6 +33,8 @@
#include "editor_node.h"
#include "global_constants.h"
#include "project_settings.h"
+#include "scene/main/viewport.h"
+#include "scene/resources/packed_scene.h"
#define PREVIEW_LIST_MAX_SIZE 10
@@ -50,6 +52,13 @@ void EditorAutoloadSettings::_notification(int p_what) {
file_dialog->add_filter("*." + E->get());
}
+
+ for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
+ AutoLoadInfo &info = E->get();
+ if (info.node && info.in_editor) {
+ get_tree()->get_root()->call_deferred("add_child", info.node);
+ }
+ }
}
}
@@ -155,8 +164,8 @@ void EditorAutoloadSettings::_autoload_edited() {
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", selected_autoload, order);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name);
- undo_redo->add_do_method(this, "update_autoload");
- undo_redo->add_undo_method(this, "update_autoload");
+ undo_redo->add_do_method(this, "call_deferred", "update_autoload");
+ undo_redo->add_undo_method(this, "call_deferred", "update_autoload");
undo_redo->add_do_method(this, "emit_signal", autoload_changed);
undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
@@ -187,8 +196,8 @@ void EditorAutoloadSettings::_autoload_edited() {
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", base, order);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", base, order);
- undo_redo->add_do_method(this, "update_autoload");
- undo_redo->add_undo_method(this, "update_autoload");
+ undo_redo->add_do_method(this, "call_deferred", "update_autoload");
+ undo_redo->add_undo_method(this, "call_deferred", "update_autoload");
undo_redo->add_do_method(this, "emit_signal", autoload_changed);
undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
@@ -289,6 +298,36 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
autoload_add_name->set_text(p_path.get_file().get_basename());
}
+Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {
+ RES res = ResourceLoader::load(p_path);
+ ERR_EXPLAIN("Can't autoload: " + p_path);
+ ERR_FAIL_COND_V(res.is_null(), NULL);
+ Node *n = NULL;
+ if (res->is_class("PackedScene")) {
+ Ref<PackedScene> ps = res;
+ n = ps->instance();
+ } else if (res->is_class("Script")) {
+ Ref<Script> s = res;
+ StringName ibt = s->get_instance_base_type();
+ bool valid_type = ClassDB::is_parent_class(ibt, "Node");
+ ERR_EXPLAIN("Script does not inherit a Node: " + p_path);
+ ERR_FAIL_COND_V(!valid_type, NULL);
+
+ Object *obj = ClassDB::instance(ibt);
+
+ ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
+ ERR_FAIL_COND_V(obj == NULL, NULL);
+
+ n = Object::cast_to<Node>(obj);
+ n->set_script(s.get_ref_ptr());
+ }
+
+ ERR_EXPLAIN("Path in autoload not a node or script: " + p_path);
+ ERR_FAIL_COND_V(!n, NULL);
+
+ return n;
+}
+
void EditorAutoloadSettings::update_autoload() {
if (updating_autoload)
@@ -296,6 +335,14 @@ void EditorAutoloadSettings::update_autoload() {
updating_autoload = true;
+ Map<String, AutoLoadInfo> to_remove;
+ List<AutoLoadInfo *> to_add;
+
+ for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
+ AutoLoadInfo &info = E->get();
+ to_remove.insert(info.name, info);
+ }
+
autoload_cache.clear();
tree->clear();
@@ -318,16 +365,39 @@ void EditorAutoloadSettings::update_autoload() {
continue;
AutoLoadInfo info;
- info.name = pi.name;
+ info.is_singleton = path.begins_with("*");
+
+ if (info.is_singleton) {
+ path = path.substr(1, path.length());
+ }
+
+ info.name = name;
+ info.path = path;
info.order = ProjectSettings::get_singleton()->get_order(pi.name);
- autoload_cache.push_back(info);
+ bool need_to_add = true;
+ if (to_remove.has(name)) {
+ AutoLoadInfo &old_info = to_remove[name];
+ if (old_info.path == info.path) {
+ // Still the same resource, check status
+ info.node = old_info.node;
+ if (info.node) {
+ Ref<Script> scr = info.node->get_script();
+ info.in_editor = scr.is_valid() && scr->is_tool();
+ if (info.is_singleton == old_info.is_singleton && info.in_editor == old_info.in_editor) {
+ to_remove.erase(name);
+ need_to_add = false;
+ } else {
+ info.node = NULL;
+ }
+ }
+ }
+ }
- bool global = false;
+ autoload_cache.push_back(info);
- if (path.begins_with("*")) {
- global = true;
- path = path.substr(1, path.length());
+ if (need_to_add) {
+ to_add.push_back(&(autoload_cache.back()->get()));
}
TreeItem *item = tree->create_item(root);
@@ -340,7 +410,7 @@ void EditorAutoloadSettings::update_autoload() {
item->set_cell_mode(2, TreeItem::CELL_MODE_CHECK);
item->set_editable(2, true);
item->set_text(2, TTR("Enable"));
- item->set_checked(2, global);
+ item->set_checked(2, info.is_singleton);
item->add_button(3, get_icon("FileList", "EditorIcons"), BUTTON_OPEN);
item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
@@ -348,6 +418,60 @@ void EditorAutoloadSettings::update_autoload() {
item->set_selectable(3, false);
}
+ // Remove deleted/changed autoloads
+ for (Map<String, AutoLoadInfo>::Element *E = to_remove.front(); E; E = E->next()) {
+ AutoLoadInfo &info = E->get();
+ if (info.is_singleton) {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptServer::get_language(i)->remove_named_global_constant(info.name);
+ }
+ }
+ if (info.in_editor) {
+ ERR_CONTINUE(!info.node);
+ get_tree()->get_root()->remove_child(info.node);
+ }
+
+ if (info.node) {
+ memdelete(info.node);
+ info.node = NULL;
+ }
+ }
+
+ // Load new/changed autoloads
+ List<Node *> nodes_to_add;
+ for (List<AutoLoadInfo *>::Element *E = to_add.front(); E; E = E->next()) {
+ AutoLoadInfo *info = E->get();
+
+ info->node = _create_autoload(info->path);
+
+ ERR_CONTINUE(!info->node);
+ info->node->set_name(info->name);
+
+ Ref<Script> scr = info->node->get_script();
+ info->in_editor = scr.is_valid() && scr->is_tool();
+
+ if (info->in_editor) {
+ //defer so references are all valid on _ready()
+ nodes_to_add.push_back(info->node);
+ }
+
+ if (info->is_singleton) {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptServer::get_language(i)->add_named_global_constant(info->name, info->node);
+ }
+ }
+
+ if (!info->in_editor && !info->is_singleton) {
+ // No reason to keep this node
+ memdelete(info->node);
+ info->node = NULL;
+ }
+ }
+
+ for (List<Node *>::Element *E = nodes_to_add.front(); E; E = E->next()) {
+ get_tree()->get_root()->add_child(E->get());
+ }
+
updating_autoload = false;
}
@@ -486,8 +610,8 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
i = 0;
for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", E->get().name, orders[i++]);
- undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", E->get().name, E->get().order);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + E->get().name, orders[i++]);
+ undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + E->get().name, E->get().order);
}
orders.clear();
@@ -592,6 +716,66 @@ void EditorAutoloadSettings::_bind_methods() {
EditorAutoloadSettings::EditorAutoloadSettings() {
+ // Make first cache
+ List<PropertyInfo> props;
+ ProjectSettings::get_singleton()->get_property_list(&props);
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ const PropertyInfo &pi = E->get();
+
+ if (!pi.name.begins_with("autoload/"))
+ continue;
+
+ String name = pi.name.get_slice("/", 1);
+ String path = ProjectSettings::get_singleton()->get(pi.name);
+
+ if (name.empty())
+ continue;
+
+ AutoLoadInfo info;
+ info.is_singleton = path.begins_with("*");
+
+ if (info.is_singleton) {
+ path = path.substr(1, path.length());
+ }
+
+ info.name = name;
+ info.path = path;
+ info.order = ProjectSettings::get_singleton()->get_order(pi.name);
+
+ if (info.is_singleton) {
+ // Make sure name references work before parsing scripts
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptServer::get_language(i)->add_named_global_constant(info.name, Variant());
+ }
+ }
+
+ autoload_cache.push_back(info);
+ }
+
+ for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
+ AutoLoadInfo &info = E->get();
+
+ info.node = _create_autoload(info.path);
+
+ if (info.node) {
+ Ref<Script> scr = info.node->get_script();
+ info.in_editor = scr.is_valid() && scr->is_tool();
+ info.node->set_name(info.name);
+ }
+
+ if (info.is_singleton) {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptServer::get_language(i)->add_named_global_constant(info.name, info.node);
+ }
+ }
+
+ if (!info.is_singleton && !info.in_editor) {
+ memdelete(info.node);
+ info.node = NULL;
+ }
+ }
+
autoload_changed = "autoload_changed";
updating_autoload = false;
@@ -643,10 +827,10 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
tree->set_column_title(2, TTR("Singleton"));
tree->set_column_expand(2, false);
- tree->set_column_min_width(2, 80);
+ tree->set_column_min_width(2, 80 * EDSCALE);
tree->set_column_expand(3, false);
- tree->set_column_min_width(3, 120);
+ tree->set_column_min_width(3, 120 * EDSCALE);
tree->connect("cell_selected", this, "_autoload_selected");
tree->connect("item_edited", this, "_autoload_edited");
@@ -656,3 +840,12 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
add_child(tree, true);
}
+
+EditorAutoloadSettings::~EditorAutoloadSettings() {
+ for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
+ AutoLoadInfo &info = E->get();
+ if (info.node && !info.in_editor) {
+ memdelete(info.node);
+ }
+ }
+}
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index 6f622de6d5..0b75faa009 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -50,11 +50,21 @@ class EditorAutoloadSettings : public VBoxContainer {
struct AutoLoadInfo {
String name;
+ String path;
+ bool is_singleton;
+ bool in_editor;
int order;
+ Node *node;
bool operator==(const AutoLoadInfo &p_info) {
return order == p_info.order;
}
+
+ AutoLoadInfo() {
+ is_singleton = false;
+ in_editor = false;
+ node = NULL;
+ }
};
List<AutoLoadInfo> autoload_cache;
@@ -76,6 +86,7 @@ class EditorAutoloadSettings : public VBoxContainer {
void _autoload_activated();
void _autoload_open(const String &fpath);
void _autoload_file_callback(const String &p_path);
+ Node *_create_autoload(const String &p_path);
Variant get_drag_data_fw(const Point2 &p_point, Control *p_control);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const;
@@ -91,6 +102,7 @@ public:
void autoload_remove(const String &p_name);
EditorAutoloadSettings();
+ ~EditorAutoloadSettings();
};
#endif
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 95ed40d889..4dde893c6d 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -78,7 +78,7 @@ void EditorHistory::cleanup_history() {
current = history.size() - 1;
}
-void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int p_level_change) {
+void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int p_level_change, bool p_inspector_only) {
Object *obj = ObjectDB::get_instance(p_object);
ERR_FAIL_COND(!obj);
@@ -88,6 +88,7 @@ void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int
o.ref = REF(r);
o.object = p_object;
o.property = p_property;
+ o.inspector_only = p_inspector_only;
History h;
@@ -120,6 +121,11 @@ void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int
current++;
}
+void EditorHistory::add_object_inspector_only(ObjectID p_object) {
+
+ _add_object(p_object, "", -1, true);
+}
+
void EditorHistory::add_object(ObjectID p_object) {
_add_object(p_object, "", -1);
@@ -142,6 +148,13 @@ int EditorHistory::get_history_pos() {
return current;
}
+bool EditorHistory::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 EditorHistory::get_history_obj(int p_obj) const {
ERR_FAIL_INDEX_V(p_obj, history.size(), 0);
ERR_FAIL_INDEX_V(history[p_obj].level, history[p_obj].path.size(), 0);
@@ -180,6 +193,14 @@ bool EditorHistory::previous() {
return true;
}
+bool EditorHistory::is_current_inspector_only() const {
+
+ if (current < 0 || current >= history.size())
+ return false;
+
+ const History &h = history[current];
+ return h.path[h.level].inspector_only;
+}
ObjectID EditorHistory::get_current() {
if (current < 0 || current >= history.size())
@@ -364,6 +385,14 @@ void EditorData::notify_edited_scene_changed() {
}
}
+void EditorData::notify_resource_saved(const Ref<Resource> &p_resource) {
+
+ for (int i = 0; i < editor_plugins.size(); i++) {
+
+ editor_plugins[i]->notify_resource_saved(p_resource);
+ }
+}
+
void EditorData::clear_editor_states() {
for (int i = 0; i < editor_plugins.size(); i++) {
@@ -412,6 +441,18 @@ void EditorData::paste_object_params(Object *p_object) {
}
}
+bool EditorData::call_build() {
+
+ bool result = true;
+
+ for (int i = 0; i < editor_plugins.size() && result; i++) {
+
+ result &= editor_plugins[i]->build();
+ }
+
+ return result;
+}
+
UndoRedo &EditorData::get_undo_redo() {
return undo_redo;
@@ -452,6 +493,31 @@ void EditorData::add_custom_type(const String &p_type, const String &p_inherits,
custom_types[p_inherits].push_back(ct);
}
+Object *EditorData::instance_custom_type(const String &p_type, const String &p_inherits) {
+
+ if (get_custom_types().has(p_inherits)) {
+
+ for (int i = 0; i < get_custom_types()[p_inherits].size(); i++) {
+ if (get_custom_types()[p_inherits][i].name == p_type) {
+ Ref<Texture> icon = get_custom_types()[p_inherits][i].icon;
+ Ref<Script> script = get_custom_types()[p_inherits][i].script;
+
+ Object *ob = ClassDB::instance(p_inherits);
+ ERR_FAIL_COND_V(!ob, NULL);
+ if (ob->is_class("Node")) {
+ ob->call("set_name", p_type);
+ }
+ ob->set_script(script.get_ref_ptr());
+ if (icon.is_valid())
+ ob->set_meta("_editor_icon", icon);
+ return ob;
+ }
+ }
+ }
+
+ return NULL;
+}
+
void EditorData::remove_custom_type(const String &p_type) {
for (Map<String, Vector<CustomType> >::Element *E = custom_types.front(); E; E = E->next()) {
@@ -563,18 +629,16 @@ bool EditorData::check_and_update_scene(int p_idx) {
bool must_reload = _find_updated_instances(edited_scene[p_idx].root, edited_scene[p_idx].root, checked_scenes);
- print_line("MUST RELOAD? " + itos(must_reload));
-
if (must_reload) {
Ref<PackedScene> pscene;
pscene.instance();
EditorProgress ep("update_scene", TTR("Updating Scene"), 2);
- ep.step(TTR("Storing local changes.."), 0);
+ ep.step(TTR("Storing local changes..."), 0);
//pack first, so it stores diffs to previous version of saved scene
Error err = pscene->pack(edited_scene[p_idx].root);
ERR_FAIL_COND_V(err != OK, false);
- ep.step(TTR("Updating scene.."), 1);
+ ep.step(TTR("Updating scene..."), 1);
Node *new_scene = pscene->instance(PackedScene::GEN_EDIT_STATE_MAIN);
ERR_FAIL_COND_V(!new_scene, false);
@@ -867,7 +931,7 @@ Array EditorSelection::_get_transformable_selected_nodes() {
return ret;
}
-Array EditorSelection::_get_selected_nodes() {
+Array EditorSelection::get_selected_nodes() {
Array ret;
@@ -885,7 +949,7 @@ void EditorSelection::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear"), &EditorSelection::clear);
ClassDB::bind_method(D_METHOD("add_node", "node"), &EditorSelection::add_node);
ClassDB::bind_method(D_METHOD("remove_node", "node"), &EditorSelection::remove_node);
- ClassDB::bind_method(D_METHOD("get_selected_nodes"), &EditorSelection::_get_selected_nodes);
+ ClassDB::bind_method(D_METHOD("get_selected_nodes"), &EditorSelection::get_selected_nodes);
ClassDB::bind_method(D_METHOD("get_transformable_selected_nodes"), &EditorSelection::_get_transformable_selected_nodes);
ClassDB::bind_method(D_METHOD("_emit_change"), &EditorSelection::_emit_change);
ADD_SIGNAL(MethodInfo("selection_changed"));
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 844145853d..0ecef8ae31 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -50,6 +50,7 @@ class EditorHistory {
REF ref;
ObjectID object;
String property;
+ bool inspector_only;
};
struct History {
@@ -70,7 +71,7 @@ class EditorHistory {
Variant value;
};
- void _add_object(ObjectID p_object, const String &p_property, int p_level_change);
+ void _add_object(ObjectID p_object, const String &p_property, int p_level_change, bool p_inspector_only = false);
public:
void cleanup_history();
@@ -78,6 +79,7 @@ public:
bool is_at_beginning() const;
bool is_at_end() const;
+ void add_object_inspector_only(ObjectID p_object);
void add_object(ObjectID p_object);
void add_object(ObjectID p_object, const String &p_subprop);
void add_object(ObjectID p_object, int p_relevel);
@@ -85,10 +87,12 @@ public:
int get_history_len();
int get_history_pos();
ObjectID get_history_obj(int p_obj) const;
+ bool is_history_obj_inspector_only(int p_obj) const;
bool next();
bool previous();
ObjectID get_current();
+ bool is_current_inspector_only() const;
int get_path_size() const;
ObjectID get_path_object(int p_index) const;
@@ -171,6 +175,7 @@ public:
void restore_editor_global_states();
void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture> &p_icon);
+ Object *instance_custom_type(const String &p_type, const String &p_inherits);
void remove_custom_type(const String &p_type);
const Map<String, Vector<CustomType> > &get_custom_types() const { return custom_types; }
@@ -196,6 +201,7 @@ public:
NodePath get_edited_scene_live_edit_root();
bool check_and_update_scene(int p_idx);
void move_edited_scene_to_index(int p_idx);
+ bool call_build();
void set_plugin_window_layout(Ref<ConfigFile> p_layout);
void get_plugin_window_layout(Ref<ConfigFile> p_layout);
@@ -203,6 +209,7 @@ public:
void save_edited_scene_state(EditorSelection *p_selection, EditorHistory *p_history, const Dictionary &p_custom);
Dictionary restore_edited_scene_state(EditorSelection *p_selection, EditorHistory *p_history);
void notify_edited_scene_changed();
+ void notify_resource_saved(const Ref<Resource> &p_resource);
EditorData();
};
@@ -224,7 +231,6 @@ private:
List<Node *> selected_node_list;
void _update_nl();
- Array _get_selected_nodes();
Array _get_transformable_selected_nodes();
void _emit_change();
@@ -232,6 +238,7 @@ protected:
static void _bind_methods();
public:
+ Array get_selected_nodes();
void add_node(Node *p_node);
void remove_node(Node *p_node);
bool is_selected(Node *) const;
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index c9ac62a74d..7739b08eff 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -274,8 +274,6 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
}
Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
- if (p_path.ends_with(".so") || p_path.ends_with(".dylib") || p_path.ends_with(".dll"))
- return OK;
PackData *pd = (PackData *)p_userdata;
@@ -337,7 +335,7 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat
String EditorExportPlatform::find_export_template(String template_file_name, String *err) const {
- String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + VERSION_MODULE_CONFIG;
+ String current_version = VERSION_FULL_CONFIG;
String template_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(current_version).plus_file(template_file_name);
if (FileAccess::exists(template_path)) {
@@ -913,6 +911,16 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
return OK;
}
+Error EditorExportPlatform::export_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+ return save_pack(p_preset, p_path);
+}
+
+Error EditorExportPlatform::export_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+ return save_zip(p_preset, p_path);
+}
+
void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) {
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
@@ -1264,6 +1272,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,
String err;
bool valid = true;
+ bool use64 = p_preset->get("binary_format/64_bits");
if (use64 && (!exists_export_template(debug_file_64, &err) || !exists_export_template(release_file_64, &err))) {
valid = false;
@@ -1354,27 +1363,24 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
Error err = da->copy(template_path, p_path, get_chmod_flags());
- memdelete(da);
-
- if (err != OK) {
- return err;
- }
+ if (err == OK) {
+ String pck_path = p_path.get_basename() + ".pck";
- String pck_path = p_path.get_basename() + ".pck";
+ Vector<SharedObject> so_files;
- Vector<SharedObject> so_files;
+ err = save_pack(p_preset, pck_path, &so_files);
- err = save_pack(p_preset, pck_path, &so_files);
-
- if (err != OK || so_files.empty())
- return err;
- //if shared object files, copy them
- da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- for (int i = 0; i < so_files.size(); i++) {
- da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file()));
+ if (err == OK && !so_files.empty()) {
+ //if shared object files, copy them
+ da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ for (int i = 0; i < so_files.size() && err == OK; i++) {
+ err = da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file()));
+ }
+ }
}
+
memdelete(da);
- return OK;
+ return err;
}
void EditorExportPlatformPC::set_extension(const String &p_extension, const String &p_feature_key) {
diff --git a/editor/editor_export.h b/editor/editor_export.h
index e851769279..1d0b89cf16 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -243,6 +243,8 @@ public:
virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const = 0;
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0;
+ virtual Error export_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
+ virtual Error export_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual void get_platform_features(List<String> *r_features) = 0;
EditorExportPlatform();
@@ -373,7 +375,6 @@ class EditorExportPlatformPC : public EditorExportPlatform {
Set<String> extra_features;
- bool use64;
int chmod_flags;
public:
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index c52f25e66b..8a8a21543b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -578,7 +578,7 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) {
item_menu->set_size(Size2(1, 1));
if (can_create_dir) {
- item_menu->add_icon_item(get_icon("folder", "FileDialog"), TTR("New Folder.."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
+ item_menu->add_icon_item(get_icon("folder", "FileDialog"), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
}
item_menu->add_icon_item(get_icon("Reload", "EditorIcons"), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5);
item_menu->add_separator();
@@ -1027,6 +1027,7 @@ void EditorFileDialog::invalidate() {
if (is_visible_in_tree()) {
update_file_list();
+ _update_favorites();
invalidated = false;
} else {
invalidated = true;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index dca32d7492..d8ae1da72e 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -275,9 +275,13 @@ void EditorFileSystem::_scan_filesystem() {
memdelete(d);
f = FileAccess::open(fscache, FileAccess::WRITE);
- _save_filesystem_cache(new_filesystem, f);
- f->close();
- memdelete(f);
+ if (f == NULL) {
+ ERR_PRINTS("Error writing fscache: " + fscache);
+ } else {
+ _save_filesystem_cache(new_filesystem, f);
+ f->close();
+ memdelete(f);
+ }
scanning = false;
}
@@ -286,9 +290,13 @@ void EditorFileSystem::_save_filesystem_cache() {
String fscache = EditorSettings::get_singleton()->get_project_settings_dir().plus_file("filesystem_cache3");
FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE);
- _save_filesystem_cache(filesystem, f);
- f->close();
- memdelete(f);
+ if (f == NULL) {
+ ERR_PRINTS("Error writing fscache: " + fscache);
+ } else {
+ _save_filesystem_cache(filesystem, f);
+ f->close();
+ memdelete(f);
+ }
}
void EditorFileSystem::_thread_func(void *_userdata) {
@@ -321,10 +329,10 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
List<String> to_check;
- String source_file;
- String source_md5;
+ String source_file = "";
+ String source_md5 = "";
Vector<String> dest_files;
- String dest_md5;
+ String dest_md5 = "";
while (true) {
@@ -334,7 +342,6 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
if (err == ERR_FILE_EOF) {
- memdelete(f);
break;
} else if (err != OK) {
ERR_PRINTS("ResourceFormatImporter::load - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
@@ -351,12 +358,8 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
to_check.push_back(fa[i]);
}
} else if (!p_only_imported_files) {
- if (assign == "source_md5") {
- source_md5 = value;
- } else if (assign == "source_file") {
+ if (assign == "source_file") {
source_file = value;
- } else if (assign == "dest_md5") {
- dest_md5 = value;
} else if (assign == "dest_files") {
dest_files = value;
}
@@ -369,6 +372,42 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
memdelete(f);
+ // Read the md5's from a separate file (so the import parameters aren't dependant on the file version
+ String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_path);
+ FileAccess *md5s = FileAccess::open(base_path + ".md5", FileAccess::READ, &err);
+ if (!md5s) { // No md5's stored for this resource
+ return true;
+ }
+
+ VariantParser::StreamFile md5_stream;
+ md5_stream.f = md5s;
+
+ while (true) {
+ assign = Variant();
+ next_tag.fields.clear();
+ next_tag.name = String();
+
+ err = VariantParser::parse_tag_assign_eof(&md5_stream, lines, error_text, next_tag, assign, value, NULL, true);
+
+ if (err == ERR_FILE_EOF) {
+ break;
+ } else if (err != OK) {
+ ERR_PRINTS("ResourceFormatImporter::load - " + p_path + ".import.md5:" + itos(lines) + " error: " + error_text);
+ memdelete(md5s);
+ return false; // parse error
+ }
+ if (assign != String()) {
+ if (!p_only_imported_files) {
+ if (assign == "source_md5") {
+ source_md5 = value;
+ } else if (assign == "dest_md5") {
+ dest_md5 = value;
+ }
+ }
+ }
+ }
+ memdelete(md5s);
+
//imported files are gone, reimport
for (List<String>::Element *E = to_check.front(); E; E = E->next()) {
if (!FileAccess::exists(E->get())) {
@@ -1316,6 +1355,9 @@ void EditorFileSystem::update_file(const String &p_file) {
fs->files[cpos]->deps = _get_dependencies(p_file);
fs->files[cpos]->import_valid = ResourceLoader::is_import_valid(p_file);
+ // Update preview
+ EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
+
call_deferred("emit_signal", "filesystem_changed"); //update later
}
@@ -1456,15 +1498,13 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
}
f->store_line("source_file=" + Variant(p_file).get_construct_string());
- f->store_line("source_md5=\"" + FileAccess::get_md5(p_file) + "\"\n");
if (dest_paths.size()) {
Array dp;
for (int i = 0; i < dest_paths.size(); i++) {
dp.push_back(dest_paths[i]);
}
- f->store_line("dest_files=" + Variant(dp).get_construct_string());
- f->store_line("dest_md5=\"" + FileAccess::get_multiple_md5(dest_paths) + "\"\n");
+ f->store_line("dest_files=" + Variant(dp).get_construct_string() + "\n");
}
f->store_line("[params]");
@@ -1483,6 +1523,16 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
f->close();
memdelete(f);
+ // Store the md5's of the various files. These are stored separately so that the .import files can be version controlled.
+ FileAccess *md5s = FileAccess::open(base_path + ".md5", FileAccess::WRITE);
+ ERR_FAIL_COND(!md5s);
+ md5s->store_line("source_md5=\"" + FileAccess::get_md5(p_file) + "\"");
+ if (dest_paths.size()) {
+ md5s->store_line("dest_md5=\"" + FileAccess::get_multiple_md5(dest_paths) + "\"\n");
+ }
+ md5s->close();
+ memdelete(md5s);
+
//update modified times, to avoid reimport
fs->files[cpos]->modified_time = FileAccess::get_modified_time(p_file);
fs->files[cpos]->import_modified_time = FileAccess::get_modified_time(p_file + ".import");
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index a58257962a..26f16e282e 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -85,6 +85,20 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \
MAKE_FALLBACKS(m_name);
+#define MAKE_BOLD_FONT(m_name, m_size) \
+ Ref<DynamicFont> m_name; \
+ m_name.instance(); \
+ m_name->set_size(m_size); \
+ if (CustomFont.is_valid()) { \
+ m_name->set_font_data(CustomFontBold); \
+ m_name->add_fallback(DefaultFontBold); \
+ } else { \
+ m_name->set_font_data(DefaultFontBold); \
+ } \
+ m_name->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); \
+ m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \
+ MAKE_FALLBACKS(m_name);
+
#define MAKE_SOURCE_FONT(m_name, m_size) \
Ref<DynamicFont> m_name; \
m_name.instance(); \
@@ -102,86 +116,124 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
void editor_register_fonts(Ref<Theme> p_theme) {
/* Custom font */
- String custom_font = EditorSettings::get_singleton()->get("interface/editor/main_font");
+ DynamicFontData::Hinting font_hinting = (DynamicFontData::Hinting)(int)EditorSettings::get_singleton()->get("interface/editor/main_font_hinting");
+
+ String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
Ref<DynamicFontData> CustomFont;
- if (custom_font.length() > 0) {
+ if (custom_font_path.length() > 0) {
CustomFont.instance();
- CustomFont->set_font_path(custom_font);
+ CustomFont->set_hinting(font_hinting);
+ CustomFont->set_font_path(custom_font_path);
CustomFont->set_force_autohinter(true); //just looks better..i think?
}
+ /* Custom Bold font */
+
+ String custom_font_path_bold = EditorSettings::get_singleton()->get("interface/editor/main_font_bold");
+ Ref<DynamicFontData> CustomFontBold;
+ if (custom_font_path_bold.length() > 0) {
+ CustomFontBold.instance();
+ CustomFontBold->set_hinting(font_hinting);
+ CustomFontBold->set_font_path(custom_font_path_bold);
+ CustomFontBold->set_force_autohinter(true); //just looks better..i think?
+ }
+
/* Custom source code font */
- String custom_font_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
+ String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
+ DynamicFontData::Hinting font_source_hinting = (DynamicFontData::Hinting)(int)EditorSettings::get_singleton()->get("interface/editor/code_font_hinting");
Ref<DynamicFontData> CustomFontSource;
- if (custom_font_source.length() > 0) {
+ if (custom_font_path_source.length() > 0) {
CustomFontSource.instance();
- CustomFontSource->set_font_path(custom_font_source);
+ CustomFontSource->set_hinting(font_source_hinting);
+ CustomFontSource->set_font_path(custom_font_path_source);
}
/* Droid Sans */
Ref<DynamicFontData> DefaultFont;
DefaultFont.instance();
+ DefaultFont->set_hinting(font_hinting);
DefaultFont->set_font_ptr(_font_NotoSansUI_Regular, _font_NotoSansUI_Regular_size);
DefaultFont->set_force_autohinter(true); //just looks better..i think?
+ Ref<DynamicFontData> DefaultFontBold;
+ DefaultFontBold.instance();
+ DefaultFont->set_hinting(font_hinting);
+ DefaultFontBold->set_font_ptr(_font_NotoSansUI_Bold, _font_NotoSansUI_Bold_size);
+ DefaultFontBold->set_force_autohinter(true); // just looks better..i think?
+
Ref<DynamicFontData> FontFallback;
FontFallback.instance();
+ FontFallback->set_hinting(font_hinting);
FontFallback->set_font_ptr(_font_DroidSansFallback, _font_DroidSansFallback_size);
FontFallback->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontJapanese;
FontJapanese.instance();
+ FontJapanese->set_hinting(font_hinting);
FontJapanese->set_font_ptr(_font_DroidSansJapanese, _font_DroidSansJapanese_size);
FontJapanese->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontArabic;
FontArabic.instance();
+ FontArabic->set_hinting(font_hinting);
FontArabic->set_font_ptr(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size);
FontArabic->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontHebrew;
FontHebrew.instance();
+ FontHebrew->set_hinting(font_hinting);
FontHebrew->set_font_ptr(_font_NotoSansHebrew_Regular, _font_NotoSansHebrew_Regular_size);
FontHebrew->set_force_autohinter(true); //just looks better..i think?
Ref<DynamicFontData> FontThai;
FontThai.instance();
+ FontThai->set_hinting(font_hinting);
FontThai->set_font_ptr(_font_NotoSansThaiUI_Regular, _font_NotoSansThaiUI_Regular_size);
FontThai->set_force_autohinter(true); //just looks better..i think?
- /* Source Code Pro */
+ /* Hack */
Ref<DynamicFontData> dfmono;
dfmono.instance();
+ dfmono->set_hinting(font_source_hinting);
dfmono->set_font_ptr(_font_Hack_Regular, _font_Hack_Regular_size);
//dfd->set_force_autohinter(true); //just looks better..i think?
int default_font_size = int(EditorSettings::get_singleton()->get("interface/editor/main_font_size")) * EDSCALE;
- MAKE_DEFAULT_FONT(df, default_font_size);
+ // Default font
+ MAKE_DEFAULT_FONT(df, default_font_size);
p_theme->set_default_theme_font(df);
- MAKE_DEFAULT_FONT(df_title, default_font_size + 2 * EDSCALE);
+ // Bold font
+ MAKE_BOLD_FONT(df_bold, default_font_size);
+ p_theme->set_font("bold", "EditorFonts", df_bold);
+
+ // Title font
+ MAKE_BOLD_FONT(df_title, default_font_size + 2 * EDSCALE);
p_theme->set_font("title", "EditorFonts", df_title);
- MAKE_DEFAULT_FONT(df_doc_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 23)) * EDSCALE);
+ // Doc font
+ MAKE_BOLD_FONT(df_doc_title, int(EDITOR_DEF("text_editor/help/help_title_font_size", 23)) * EDSCALE);
MAKE_DEFAULT_FONT(df_doc, int(EDITOR_DEF("text_editor/help/help_font_size", 15)) * EDSCALE);
p_theme->set_font("doc", "EditorFonts", df_doc);
p_theme->set_font("doc_title", "EditorFonts", df_doc_title);
+ MAKE_SOURCE_FONT(df_doc_code, int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE);
+ p_theme->set_font("doc_source", "EditorFonts", df_doc_code);
+
+ // Ruler font
MAKE_DEFAULT_FONT(df_rulers, 8 * EDSCALE);
p_theme->set_font("rulers", "EditorFonts", df_rulers);
+ // Code font
MAKE_SOURCE_FONT(df_code, int(EditorSettings::get_singleton()->get("interface/editor/code_font_size")) * EDSCALE);
p_theme->set_font("source", "EditorFonts", df_code);
- MAKE_SOURCE_FONT(df_doc_code, int(EDITOR_DEF("text_editor/help/help_source_font_size", 14)) * EDSCALE);
- p_theme->set_font("doc_source", "EditorFonts", df_doc_code);
-
MAKE_SOURCE_FONT(df_output_code, int(EDITOR_DEF("run/output/font_size", 13)) * EDSCALE);
p_theme->set_font("output_source", "EditorFonts", df_output_code);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 7f76cf1af2..65e50560bc 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -526,18 +526,7 @@ void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
void EditorHelp::_search(const String &) {
- if (search->get_text() == "")
- return;
-
- String stext = search->get_text();
- bool keep = prev_search == stext;
-
- bool ret = class_desc->search(stext, keep);
- if (!ret) {
- class_desc->search(stext, false);
- }
-
- prev_search = stext;
+ find_bar->search_next();
}
void EditorHelp::_class_list_select(const String &p_select) {
@@ -598,14 +587,6 @@ void EditorHelp::_class_desc_select(const String &p_select) {
}
void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) {
-
- Ref<InputEventMouseButton> mb = p_input;
-
- if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == 1 && !mb->is_doubleclick()) {
- class_desc->set_selection_enabled(false);
- class_desc->set_selection_enabled(true);
- }
- set_focused();
}
void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
@@ -1172,7 +1153,12 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_indent(1);
Vector<DocData::ConstantDoc> enum_list = E->get();
+ Map<String, int> enumValuesContainer;
+ int enumStartingLine = enum_line[E->key()];
+
for (int i = 0; i < enum_list.size(); i++) {
+ if (cd.name == "@GlobalScope")
+ enumValuesContainer[enum_list[i].name] = enumStartingLine;
class_desc->push_font(doc_code_font);
class_desc->push_color(headline_color);
@@ -1200,6 +1186,9 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->add_newline();
}
+ if (cd.name == "@GlobalScope")
+ enum_values_line[E->key()] = enumValuesContainer;
+
class_desc->pop();
class_desc->add_newline();
@@ -1291,11 +1280,10 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->add_newline();
// class_desc->add_newline();
- Vector<String> tutorials = cd.tutorials.split_spaces();
- if (tutorials.size() != 0) {
+ if (cd.tutorials.size() != 0) {
- for (int i = 0; i < tutorials.size(); i++) {
- String link = tutorials[i];
+ for (int i = 0; i < cd.tutorials.size(); i++) {
+ String link = cd.tutorials[i];
String linktxt = link;
int seppos = linktxt.find("//");
if (seppos != -1) {
@@ -1485,21 +1473,32 @@ void EditorHelp::_help_callback(const String &p_topic) {
if (method_line.has(name))
line = method_line[name];
} else if (what == "class_property") {
-
if (property_line.has(name))
line = property_line[name];
} else if (what == "class_enum") {
-
if (enum_line.has(name))
line = enum_line[name];
} else if (what == "class_theme_item") {
-
if (theme_property_line.has(name))
line = theme_property_line[name];
} else if (what == "class_constant") {
-
if (constant_line.has(name))
line = constant_line[name];
+ } else if (what == "class_global") {
+ if (constant_line.has(name))
+ line = constant_line[name];
+ else {
+ Map<String, Map<String, int> >::Element *iter = enum_values_line.front();
+ while (true) {
+ if (iter->value().has(name)) {
+ line = iter->value()[name];
+ break;
+ } else if (iter == enum_values_line.back())
+ break;
+ else
+ iter = iter->next();
+ }
+ }
}
class_desc->call_deferred("scroll_to_line", line);
@@ -1797,13 +1796,7 @@ void EditorHelp::scroll_to_section(int p_section_index) {
void EditorHelp::popup_search() {
- search_dialog->popup_centered(Size2(250, 80) * EDSCALE);
- search->grab_focus();
-}
-
-void EditorHelp::_search_cbk() {
-
- _search(search->get_text());
+ find_bar->popup_search();
}
String EditorHelp::get_class() {
@@ -1832,7 +1825,6 @@ void EditorHelp::_bind_methods() {
ClassDB::bind_method("_request_help", &EditorHelp::_request_help);
ClassDB::bind_method("_unhandled_key_input", &EditorHelp::_unhandled_key_input);
ClassDB::bind_method("_search", &EditorHelp::_search);
- ClassDB::bind_method("_search_cbk", &EditorHelp::_search_cbk);
ClassDB::bind_method("_help_callback", &EditorHelp::_help_callback);
ADD_SIGNAL(MethodInfo("go_to_help"));
@@ -1844,6 +1836,10 @@ EditorHelp::EditorHelp() {
EDITOR_DEF("text_editor/help/sort_functions_alphabetically", true);
+ find_bar = memnew(FindBar);
+ add_child(find_bar);
+ find_bar->hide();
+
class_desc = memnew(RichTextLabel);
add_child(class_desc);
class_desc->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1851,24 +1847,14 @@ EditorHelp::EditorHelp() {
class_desc->connect("meta_clicked", this, "_class_desc_select");
class_desc->connect("gui_input", this, "_class_desc_input");
+ find_bar->set_rich_text_label(class_desc);
+
class_desc->set_selection_enabled(true);
scroll_locked = false;
select_locked = false;
- set_process_unhandled_key_input(true);
+ //set_process_unhandled_key_input(true);
class_desc->hide();
-
- search_dialog = memnew(ConfirmationDialog);
- add_child(search_dialog);
- VBoxContainer *search_vb = memnew(VBoxContainer);
- search_dialog->add_child(search_vb);
-
- search = memnew(LineEdit);
- search_dialog->register_text_enter(search);
- search_vb->add_margin_child(TTR("Search Text"), search);
- search_dialog->get_ok()->set_text(TTR("Find"));
- search_dialog->connect("confirmed", this, "_search_cbk");
- search_dialog->set_hide_on_ok(false);
}
EditorHelp::~EditorHelp() {
@@ -1945,3 +1931,197 @@ EditorHelpBit::EditorHelpBit() {
rich_text->set_override_selected_font_color(false);
set_custom_minimum_size(Size2(0, 70 * EDSCALE));
}
+
+FindBar::FindBar() {
+
+ container = memnew(Control);
+ add_child(container);
+
+ container->set_clip_contents(true);
+ container->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ hbc = memnew(HBoxContainer);
+ container->add_child(hbc);
+
+ vbc_search_text = memnew(VBoxContainer);
+ hbc->add_child(vbc_search_text);
+ vbc_search_text->set_h_size_flags(SIZE_EXPAND_FILL);
+ hbc->set_anchor_and_margin(MARGIN_RIGHT, 1, 0);
+
+ search_text = memnew(LineEdit);
+ vbc_search_text->add_child(search_text);
+ search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
+ search_text->connect("text_changed", this, "_search_text_changed");
+ search_text->connect("text_entered", this, "_search_text_entered");
+
+ find_prev = memnew(ToolButton);
+ hbc->add_child(find_prev);
+ find_prev->set_focus_mode(FOCUS_NONE);
+ find_prev->connect("pressed", this, "_search_prev");
+
+ find_next = memnew(ToolButton);
+ hbc->add_child(find_next);
+ find_next->set_focus_mode(FOCUS_NONE);
+ find_next->connect("pressed", this, "_search_next");
+
+ error_label = memnew(Label);
+ hbc->add_child(error_label);
+ error_label->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
+
+ hide_button = memnew(TextureButton);
+ add_child(hide_button);
+ hide_button->set_focus_mode(FOCUS_NONE);
+ hide_button->set_expand(true);
+ hide_button->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED);
+ hide_button->connect("pressed", this, "_hide_pressed");
+}
+
+void FindBar::popup_search() {
+
+ show();
+ bool grabbed_focus = false;
+ if (!search_text->has_focus()) {
+ search_text->grab_focus();
+ grabbed_focus = true;
+ }
+
+ if (!search_text->get_text().empty()) {
+ search_text->select_all();
+ search_text->set_cursor_position(search_text->get_text().length());
+ if (grabbed_focus) {
+ _search();
+ }
+ }
+
+ call_deferred("_update_size");
+}
+
+void FindBar::_update_size() {
+
+ container->set_custom_minimum_size(Size2(0, hbc->get_size().height));
+}
+
+void FindBar::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_READY) {
+
+ find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
+ find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
+ hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
+ hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
+ hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
+ hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
+ } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+
+ set_process_unhandled_input(is_visible_in_tree());
+ } else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
+
+ find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
+ find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
+ hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
+ hide_button->set_hover_texture(get_icon("Close", "EditorIcons"));
+ hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
+ hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
+ }
+}
+
+void FindBar::_bind_methods() {
+
+ ClassDB::bind_method("_unhandled_input", &FindBar::_unhandled_input);
+
+ ClassDB::bind_method("_search_text_changed", &FindBar::_search_text_changed);
+ ClassDB::bind_method("_search_text_entered", &FindBar::_search_text_entered);
+ ClassDB::bind_method("_search_next", &FindBar::search_next);
+ ClassDB::bind_method("_search_prev", &FindBar::search_prev);
+ ClassDB::bind_method("_hide_pressed", &FindBar::_hide_bar);
+ ClassDB::bind_method("_update_size", &FindBar::_update_size);
+
+ ADD_SIGNAL(MethodInfo("search"));
+}
+
+void FindBar::set_rich_text_label(RichTextLabel *p_rich_text_label) {
+
+ rich_text_label = p_rich_text_label;
+}
+
+bool FindBar::search_next() {
+
+ return _search();
+}
+
+bool FindBar::search_prev() {
+
+ return _search(true);
+}
+
+bool FindBar::_search(bool p_search_previous) {
+
+ String stext = search_text->get_text();
+ bool keep = prev_search == stext;
+
+ bool ret = rich_text_label->search(stext, keep, p_search_previous);
+ if (!ret) {
+ ret = rich_text_label->search(stext, false, p_search_previous);
+ }
+
+ prev_search = stext;
+
+ if (ret) {
+ set_error("");
+ } else {
+ set_error(stext.empty() ? "" : TTR("No Matches"));
+ }
+
+ return ret;
+}
+
+void FindBar::set_error(const String &p_label) {
+
+ error_label->set_text(p_label);
+}
+
+void FindBar::_hide_bar() {
+
+ if (search_text->has_focus())
+ rich_text_label->grab_focus();
+
+ hide();
+}
+
+void FindBar::_unhandled_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid()) {
+
+ if (k->is_pressed() && (rich_text_label->has_focus() || hbc->is_a_parent_of(get_focus_owner()))) {
+
+ bool accepted = true;
+
+ switch (k->get_scancode()) {
+
+ case KEY_ESCAPE: {
+
+ _hide_bar();
+ } break;
+ default: {
+
+ accepted = false;
+ } break;
+ }
+
+ if (accepted) {
+ accept_event();
+ }
+ }
+ }
+}
+
+void FindBar::_search_text_changed(const String &p_text) {
+
+ search_next();
+}
+
+void FindBar::_search_text_entered(const String &p_text) {
+
+ search_next();
+}
diff --git a/editor/editor_help.h b/editor/editor_help.h
index aa84aa611f..514169dc19 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -125,6 +125,52 @@ public:
EditorHelpIndex();
};
+class FindBar : public HBoxContainer {
+
+ GDCLASS(FindBar, HBoxContainer);
+
+ LineEdit *search_text;
+ ToolButton *find_prev;
+ ToolButton *find_next;
+ Label *error_label;
+ TextureButton *hide_button;
+ String prev_search;
+
+ Control *container;
+ HBoxContainer *hbc;
+ VBoxContainer *vbc_search_text;
+
+ RichTextLabel *rich_text_label;
+
+ void _show_search();
+ void _hide_bar();
+
+ void _search_text_changed(const String &p_text);
+ void _search_text_entered(const String &p_text);
+
+ void _update_size();
+
+protected:
+ void _notification(int p_what);
+ void _unhandled_input(const Ref<InputEvent> &p_event);
+
+ bool _search(bool p_search_previous = false);
+
+ static void _bind_methods();
+
+public:
+ void set_error(const String &p_label);
+
+ void set_rich_text_label(RichTextLabel *p_rich_text_label);
+
+ void popup_search();
+
+ bool search_prev();
+ bool search_next();
+
+ FindBar();
+};
+
class EditorHelp : public VBoxContainer {
GDCLASS(EditorHelp, VBoxContainer);
@@ -152,6 +198,7 @@ class EditorHelp : public VBoxContainer {
Map<String, int> theme_property_line;
Map<String, int> constant_line;
Map<String, int> enum_line;
+ Map<String, Map<String, int> > enum_values_line;
int description_line;
RichTextLabel *class_desc;
@@ -160,6 +207,7 @@ class EditorHelp : public VBoxContainer {
ConfirmationDialog *search_dialog;
LineEdit *search;
+ FindBar *find_bar;
String base_path;
@@ -193,7 +241,6 @@ class EditorHelp : public VBoxContainer {
void _request_help(const String &p_string);
void _search(const String &p_str);
- void _search_cbk();
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
new file mode 100644
index 0000000000..79746dcb5a
--- /dev/null
+++ b/editor/editor_inspector.cpp
@@ -0,0 +1,2009 @@
+/*************************************************************************/
+/* editor_inspector.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "editor_inspector.h"
+#include "array_property_edit.h"
+#include "dictionary_property_edit.h"
+#include "editor_node.h"
+#include "editor_scale.h"
+#include "multi_node_edit.h"
+#include "scene/resources/packed_scene.h"
+
+// TODO:
+// arrays and dictionary
+// replace property editor in sectionedpropertyeditor
+
+Size2 EditorProperty::get_minimum_size() const {
+
+ Size2 ms;
+ for (int i = 0; i < get_child_count(); i++) {
+
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (!c->is_visible())
+ continue;
+ if (c == bottom_editor)
+ continue;
+
+ Size2 minsize = c->get_combined_minimum_size();
+ ms.width = MAX(ms.width, minsize.width);
+ ms.height = MAX(ms.height, minsize.height);
+ }
+
+ if (keying) {
+ Ref<Texture> key = get_icon("Key", "EditorIcons");
+ ms.width += key->get_width() + get_constant("hseparator", "Tree");
+ }
+
+ if (checkable) {
+ Ref<Texture> check = get_icon("checked", "CheckBox");
+ ms.width += check->get_width() + get_constant("hseparator", "Tree");
+ }
+
+ if (bottom_editor != NULL) {
+ Ref<Font> font = get_font("font", "Tree");
+ ms.height += font->get_height();
+ ms.height += get_constant("vseparation", "Tree");
+ Size2 bems = bottom_editor->get_combined_minimum_size();
+ bems.width += get_constant("item_margin", "Tree");
+ ms.height += bems.height;
+ ms.width = MAX(ms.width, bems.width);
+ }
+
+ return ms;
+}
+
+void EditorProperty::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_SORT_CHILDREN) {
+
+ Size2 size = get_size();
+ Rect2 rect;
+ Rect2 bottom_rect;
+
+ {
+ int child_room = size.width / 2;
+ Ref<Font> font = get_font("font", "Tree");
+ int height = font->get_height();
+
+ //compute room needed
+ for (int i = 0; i < get_child_count(); i++) {
+
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (c == bottom_editor)
+ continue;
+
+ Size2 minsize = c->get_combined_minimum_size();
+ child_room = MAX(child_room, minsize.width);
+ height = MAX(height, minsize.height);
+ }
+
+ text_size = MAX(0, size.width - child_room + 4 * EDSCALE);
+
+ rect = Rect2(text_size, 0, size.width - text_size, height);
+
+ if (bottom_editor) {
+
+ int m = get_constant("item_margin", "Tree");
+ bottom_rect = Rect2(m, rect.size.height + get_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height);
+ }
+ }
+
+ if (keying) {
+ Ref<Texture> key;
+
+ if (use_keying_next()) {
+ key = get_icon("KeyNext", "EditorIcons");
+ } else {
+ key = get_icon("Key", "EditorIcons");
+ }
+
+ rect.size.x -= key->get_width() + get_constant("hseparator", "Tree");
+ }
+
+ //set children
+ for (int i = 0; i < get_child_count(); i++) {
+
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (c == bottom_editor)
+ continue;
+
+ fit_child_in_rect(c, rect);
+ }
+
+ if (bottom_editor) {
+ fit_child_in_rect(bottom_editor, bottom_rect);
+ }
+
+ update(); //need to redraw text
+ }
+
+ if (p_what == NOTIFICATION_DRAW) {
+ Ref<Font> font = get_font("font", "Tree");
+
+ Size2 size = get_size();
+ if (bottom_editor) {
+ size.height = bottom_editor->get_margin(MARGIN_TOP);
+ } else if (label_reference) {
+ size.height = label_reference->get_size().height;
+ }
+
+ if (selected) {
+ Ref<StyleBox> sb = get_stylebox("selected", "Tree");
+ draw_style_box(sb, Rect2(Vector2(), size));
+ }
+
+ Color color;
+ if (draw_red) {
+ color = get_color("error_color", "Editor");
+ } else {
+ color = get_color("font_color", "Tree");
+ }
+ if (label.find(".") != -1) {
+ color.a = 0.5; //this should be un-hacked honestly, as it's used for editor overrides
+ }
+
+ int ofs = 0;
+ if (checkable) {
+ Ref<Texture> checkbox;
+ if (checked)
+ checkbox = get_icon("checked", "CheckBox");
+ else
+ checkbox = get_icon("unchecked", "CheckBox");
+
+ Color color(1, 1, 1);
+ if (check_hover) {
+ color.r *= 1.2;
+ color.g *= 1.2;
+ color.b *= 1.2;
+ }
+ check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
+ draw_texture(checkbox, check_rect.position, color);
+ ofs += get_constant("hseparator", "Tree");
+ ofs += checkbox->get_width();
+ } else {
+ check_rect = Rect2();
+ }
+
+ int text_limit = text_size;
+
+ if (can_revert) {
+ Ref<Texture> reload_icon = get_icon("ReloadSmall", "EditorIcons");
+ text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2;
+ revert_rect = Rect2(text_limit + get_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
+
+ Color color(1, 1, 1);
+ if (revert_hover) {
+ color.r *= 1.2;
+ color.g *= 1.2;
+ color.b *= 1.2;
+ }
+
+ draw_texture(reload_icon, revert_rect.position, color);
+ } else {
+ revert_rect = Rect2();
+ }
+
+ int v_ofs = (size.height - font->get_height()) / 2;
+ draw_string(font, Point2(ofs, v_ofs + font->get_ascent()), label, color, text_limit);
+
+ if (keying) {
+ Ref<Texture> key;
+
+ if (use_keying_next()) {
+ key = get_icon("KeyNext", "EditorIcons");
+ } else {
+ key = get_icon("Key", "EditorIcons");
+ }
+
+ ofs = size.width - key->get_width() - get_constant("hseparator", "Tree");
+
+ Color color(1, 1, 1);
+ if (keying_hover) {
+ color.r *= 1.2;
+ color.g *= 1.2;
+ color.b *= 1.2;
+ }
+ keying_rect = Rect2(ofs, ((size.height - key->get_height()) / 2), key->get_width(), key->get_height());
+ draw_texture(key, keying_rect.position, color);
+ } else {
+ keying_rect = Rect2();
+ }
+
+ //int vs = get_constant("vseparation", "Tree");
+ Color guide_color = get_color("guide_color", "Tree");
+ int vs_height = get_size().height; // vs / 2;
+ draw_line(Point2(0, vs_height), Point2(get_size().width, vs_height), guide_color);
+ }
+}
+
+void EditorProperty::set_label(const String &p_label) {
+ label = p_label;
+ update();
+}
+
+String EditorProperty::get_label() const {
+ return label;
+}
+
+Object *EditorProperty::get_edited_object() {
+ return object;
+}
+
+StringName EditorProperty::get_edited_property() {
+ return property;
+}
+
+void EditorProperty::update_property() {
+ if (get_script_instance())
+ get_script_instance()->call("update_property");
+}
+
+void EditorProperty::set_read_only(bool p_read_only) {
+ read_only = p_read_only;
+}
+
+bool EditorProperty::is_read_only() const {
+ return read_only;
+}
+
+bool EditorProperty::_might_be_in_instance() {
+
+ if (!object)
+ return false;
+
+ Node *node = Object::cast_to<Node>(object);
+
+ Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
+
+ bool might_be = false;
+
+ while (node) {
+
+ if (node->get_scene_instance_state().is_valid()) {
+ might_be = true;
+ break;
+ }
+ if (node == edited_scene) {
+ if (node->get_scene_inherited_state().is_valid()) {
+ might_be = true;
+ break;
+ }
+ might_be = false;
+ break;
+ }
+ node = node->get_owner();
+ }
+
+ return might_be; // or might not be
+}
+
+bool EditorProperty::_get_instanced_node_original_property(const StringName &p_prop, Variant &value) {
+
+ Node *node = Object::cast_to<Node>(object);
+
+ if (!node)
+ return false;
+
+ Node *orig = node;
+
+ Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
+
+ bool found = false;
+
+ while (node) {
+
+ Ref<SceneState> ss;
+
+ if (node == edited_scene) {
+ ss = node->get_scene_inherited_state();
+
+ } else {
+ ss = node->get_scene_instance_state();
+ }
+
+ if (ss.is_valid()) {
+
+ NodePath np = node->get_path_to(orig);
+ int node_idx = ss->find_node_by_path(np);
+ if (node_idx >= 0) {
+ bool lfound = false;
+ Variant lvar;
+ lvar = ss->get_property_value(node_idx, p_prop, lfound);
+ if (lfound) {
+
+ found = true;
+ value = lvar;
+ }
+ }
+ }
+ if (node == edited_scene) {
+ //just in case
+ break;
+ }
+ node = node->get_owner();
+ }
+
+ return found;
+}
+
+bool EditorProperty::_is_property_different(const Variant &p_current, const Variant &p_orig, int p_usage) {
+
+ // this is a pretty difficult function, because a property may not be saved but may have
+ // the flag to not save if one or if zero
+
+ {
+ Node *node = Object::cast_to<Node>(object);
+ if (!node)
+ return false;
+
+ Node *edited_scene = EditorNode::get_singleton()->get_edited_scene();
+ bool found_state = false;
+
+ while (node) {
+
+ Ref<SceneState> ss;
+
+ if (node == edited_scene) {
+ ss = node->get_scene_inherited_state();
+
+ } else {
+ ss = node->get_scene_instance_state();
+ }
+
+ if (ss.is_valid()) {
+ found_state = true;
+ }
+ if (node == edited_scene) {
+ //just in case
+ break;
+ }
+ node = node->get_owner();
+ }
+
+ if (!found_state)
+ return false; //pointless to check if we are not comparing against anything.
+ }
+
+ if (p_orig.get_type() == Variant::NIL) {
+ // not found (was not saved)
+ // check if it was not saved due to being zero or one
+ if (p_current.is_zero() && property_usage & PROPERTY_USAGE_STORE_IF_NONZERO)
+ return false;
+ if (p_current.is_one() && property_usage & PROPERTY_USAGE_STORE_IF_NONONE)
+ return false;
+ }
+
+ if (p_current.get_type() == Variant::REAL && p_orig.get_type() == Variant::REAL) {
+ float a = p_current;
+ float b = p_orig;
+
+ return Math::abs(a - b) > CMP_EPSILON; //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error
+ }
+
+ return bool(Variant::evaluate(Variant::OP_NOT_EQUAL, p_current, p_orig));
+}
+
+bool EditorProperty::_is_instanced_node_with_original_property_different() {
+
+ bool mbi = _might_be_in_instance();
+ if (mbi) {
+ Variant vorig;
+ int usage = property_usage & (PROPERTY_USAGE_STORE_IF_NONONE | PROPERTY_USAGE_STORE_IF_NONZERO);
+ if (_get_instanced_node_original_property(property, vorig) || usage) {
+ Variant v = object->get(property);
+
+ if (_is_property_different(v, vorig, usage)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void EditorProperty::update_reload_status() {
+
+ if (property == StringName())
+ return; //no property, so nothing to do
+
+ bool has_reload = false;
+
+ if (_is_instanced_node_with_original_property_different()) {
+ has_reload = true;
+ }
+
+ if (object->call("property_can_revert", property).operator bool()) {
+
+ has_reload = true;
+ }
+
+ if (!has_reload && !object->get_script().is_null()) {
+ Ref<Script> scr = object->get_script();
+ Variant orig_value;
+ if (scr->get_property_default_value(property, orig_value)) {
+ if (orig_value != object->get(property)) {
+ has_reload = true;
+ }
+ }
+ }
+
+ if (has_reload != can_revert) {
+ can_revert = has_reload;
+ update();
+ }
+}
+
+bool EditorProperty::use_keying_next() const {
+ return false;
+}
+void EditorProperty::set_checkable(bool p_checkable) {
+
+ checkable = p_checkable;
+ update();
+ queue_sort();
+}
+
+bool EditorProperty::is_checkable() const {
+
+ return checkable;
+}
+
+void EditorProperty::set_checked(bool p_checked) {
+
+ checked = p_checked;
+ update();
+}
+
+bool EditorProperty::is_checked() const {
+
+ return checked;
+}
+
+void EditorProperty::set_draw_red(bool p_draw_red) {
+
+ draw_red = p_draw_red;
+ update();
+}
+
+void EditorProperty::set_keying(bool p_keying) {
+ keying = p_keying;
+ update();
+ queue_sort();
+}
+
+bool EditorProperty::is_keying() const {
+ return keying;
+}
+
+bool EditorProperty::is_draw_red() const {
+
+ return draw_red;
+}
+
+void EditorProperty::_focusable_focused(int p_index) {
+
+ if (!selectable)
+ return;
+ bool already_selected = selected;
+ selected = true;
+ selected_focusable = p_index;
+ update();
+ if (!already_selected && selected) {
+ emit_signal("selected", property, selected_focusable);
+ }
+}
+
+void EditorProperty::add_focusable(Control *p_control) {
+
+ p_control->connect("focus_entered", this, "_focusable_focused", varray(focusables.size()));
+ focusables.push_back(p_control);
+}
+
+void EditorProperty::select(int p_focusable) {
+
+ bool already_selected = selected;
+
+ if (p_focusable >= 0) {
+ ERR_FAIL_INDEX(p_focusable, focusables.size());
+ focusables[p_focusable]->grab_focus();
+ } else {
+ selected = true;
+ update();
+ }
+
+ if (!already_selected && selected) {
+ emit_signal("selected", property, selected_focusable);
+ }
+}
+
+void EditorProperty::deselect() {
+ selected = false;
+ selected_focusable = -1;
+ update();
+}
+
+bool EditorProperty::is_selected() const {
+ return selected;
+}
+
+void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
+
+ if (property == StringName())
+ return;
+
+ Ref<InputEventMouse> me = p_event;
+
+ if (me.is_valid()) {
+
+ bool button_left = me->get_button_mask() & BUTTON_MASK_LEFT;
+
+ bool new_keying_hover = keying_rect.has_point(me->get_position()) && !button_left;
+ if (new_keying_hover != keying_hover) {
+ keying_hover = new_keying_hover;
+ update();
+ }
+
+ bool new_revert_hover = revert_rect.has_point(me->get_position()) && !button_left;
+ if (new_revert_hover != revert_hover) {
+ revert_hover = new_revert_hover;
+ update();
+ }
+
+ bool new_check_hover = check_rect.has_point(me->get_position()) && !button_left;
+ if (new_check_hover != check_hover) {
+ check_hover = new_check_hover;
+ update();
+ }
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ if (!selected && selectable) {
+ selected = true;
+ emit_signal("selected", property, -1);
+ update();
+ }
+
+ if (keying_rect.has_point(mb->get_position())) {
+ emit_signal("property_keyed", property);
+ }
+
+ if (revert_rect.has_point(mb->get_position())) {
+
+ Variant vorig;
+
+ if (_might_be_in_instance() && _get_instanced_node_original_property(property, vorig)) {
+
+ emit_signal("property_changed", property, vorig.duplicate(true));
+ update_property();
+ return;
+ }
+
+ if (object->call("property_can_revert", property).operator bool()) {
+ Variant rev = object->call("property_get_revert", property);
+ emit_signal("property_changed", property, rev);
+ update_property();
+ }
+
+ if (!object->get_script().is_null()) {
+ Ref<Script> scr = object->get_script();
+ Variant orig_value;
+ if (scr->get_property_default_value(property, orig_value)) {
+ emit_signal("property_changed", property, orig_value);
+ update_property();
+ }
+ }
+ }
+ if (check_rect.has_point(mb->get_position())) {
+ checked = !checked;
+ update();
+ emit_signal("property_checked", property, checked);
+ }
+ }
+}
+
+void EditorProperty::set_label_reference(Control *p_control) {
+
+ label_reference = p_control;
+}
+void EditorProperty::set_bottom_editor(Control *p_control) {
+
+ bottom_editor = p_control;
+}
+Variant EditorProperty::get_drag_data(const Point2 &p_point) {
+
+ if (property == StringName())
+ return Variant();
+
+ Dictionary dp;
+ dp["type"] = "obj_property";
+ dp["object"] = object;
+ dp["property"] = property;
+ dp["value"] = object->get(property);
+
+ Label *label = memnew(Label);
+ label->set_text(property);
+ set_drag_preview(label);
+ return dp;
+}
+
+void EditorProperty::set_use_folding(bool p_use_folding) {
+
+ use_folding = p_use_folding;
+}
+
+bool EditorProperty::is_using_folding() const {
+
+ return use_folding;
+}
+
+void EditorProperty::expand_all_folding() {
+}
+
+void EditorProperty::collapse_all_folding() {
+}
+
+void EditorProperty::set_selectable(bool p_selectable) {
+ selectable = p_selectable;
+}
+
+bool EditorProperty::is_selectable() const {
+ return selectable;
+}
+
+void EditorProperty::set_object_and_property(Object *p_object, const StringName &p_property) {
+ object = p_object;
+ property = p_property;
+}
+
+void EditorProperty::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_label", "text"), &EditorProperty::set_label);
+ ClassDB::bind_method(D_METHOD("get_label"), &EditorProperty::get_label);
+
+ ClassDB::bind_method(D_METHOD("set_read_only", "read_only"), &EditorProperty::set_read_only);
+ ClassDB::bind_method(D_METHOD("is_read_only"), &EditorProperty::is_read_only);
+
+ ClassDB::bind_method(D_METHOD("set_checkable", "checkable"), &EditorProperty::set_checkable);
+ ClassDB::bind_method(D_METHOD("is_checkable"), &EditorProperty::is_checkable);
+
+ ClassDB::bind_method(D_METHOD("set_checked", "checked"), &EditorProperty::set_checked);
+ ClassDB::bind_method(D_METHOD("is_checked"), &EditorProperty::is_checked);
+
+ ClassDB::bind_method(D_METHOD("set_draw_red", "draw_red"), &EditorProperty::set_draw_red);
+ ClassDB::bind_method(D_METHOD("is_draw_red"), &EditorProperty::is_draw_red);
+
+ ClassDB::bind_method(D_METHOD("set_keying", "keying"), &EditorProperty::set_keying);
+ ClassDB::bind_method(D_METHOD("is_keying"), &EditorProperty::is_keying);
+
+ ClassDB::bind_method(D_METHOD("get_edited_property"), &EditorProperty::get_edited_property);
+ ClassDB::bind_method(D_METHOD("get_edited_object"), &EditorProperty::get_edited_object);
+
+ ClassDB::bind_method(D_METHOD("_gui_input"), &EditorProperty::_gui_input);
+ ClassDB::bind_method(D_METHOD("_focusable_focused"), &EditorProperty::_focusable_focused);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checkable"), "set_checkable", "is_checkable");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checked"), "set_checked", "is_checked");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_red"), "set_draw_red", "is_draw_red");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keying"), "set_keying", "is_keying");
+ ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
+ ADD_SIGNAL(MethodInfo("multiple_properties_changed", PropertyInfo(Variant::POOL_STRING_ARRAY, "properties"), PropertyInfo(Variant::ARRAY, "value")));
+ ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
+ ADD_SIGNAL(MethodInfo("property_keyed_with_value", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
+ ADD_SIGNAL(MethodInfo("property_checked", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::STRING, "bool")));
+ ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
+ ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx")));
+
+ MethodInfo vm;
+ vm.name = "update_property";
+ BIND_VMETHOD(vm);
+}
+
+EditorProperty::EditorProperty() {
+
+ selectable = true;
+ text_size = 0;
+ read_only = false;
+ checkable = false;
+ checked = false;
+ draw_red = false;
+ keying = false;
+ keying_hover = false;
+ revert_hover = false;
+ check_hover = false;
+ can_revert = false;
+ use_folding = false;
+ property_usage = 0;
+ selected = false;
+ selected_focusable = -1;
+ label_reference = NULL;
+ bottom_editor = NULL;
+}
+////////////////////////////////////////////////
+////////////////////////////////////////////////
+
+void EditorInspectorPlugin::add_custom_control(Control *control) {
+
+ AddedEditor ae;
+ ae.property_editor = control;
+ added_editors.push_back(ae);
+}
+
+void EditorInspectorPlugin::add_property_editor(const String &p_for_property, Control *p_prop) {
+
+ ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == NULL);
+
+ AddedEditor ae;
+ ae.properties.push_back(p_for_property);
+ ae.property_editor = p_prop;
+ added_editors.push_back(ae);
+}
+
+void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const String &p_label, const Vector<String> &p_properties, Control *p_prop) {
+
+ AddedEditor ae;
+ ae.properties = p_properties;
+ ae.property_editor = p_prop;
+ ae.label = p_label;
+ added_editors.push_back(ae);
+}
+
+bool EditorInspectorPlugin::can_handle(Object *p_object) {
+
+ if (get_script_instance()) {
+ return get_script_instance()->call("can_handle", p_object);
+ }
+ return false;
+}
+void EditorInspectorPlugin::parse_begin(Object *p_object) {
+
+ if (get_script_instance()) {
+ get_script_instance()->call("parse_begin", p_object);
+ }
+}
+
+void EditorInspectorPlugin::parse_category(Object *p_object, const String &p_parse_category) {
+
+ if (get_script_instance()) {
+ get_script_instance()->call("parse_category", p_object, p_parse_category);
+ }
+}
+
+bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) {
+
+ if (get_script_instance()) {
+ Variant arg[6] = {
+ p_object, p_type, p_path, p_hint, p_hint_text, p_usage
+ };
+ const Variant *argptr[6] = {
+ &arg[0], &arg[1], &arg[2], &arg[3], &arg[4], &arg[5]
+ };
+
+ Variant::CallError err;
+ return get_script_instance()->call("parse_property", (const Variant **)&argptr, 6, err);
+ }
+ return false;
+}
+void EditorInspectorPlugin::parse_end() {
+
+ if (get_script_instance()) {
+ get_script_instance()->call("parse_end");
+ }
+}
+
+void EditorInspectorPlugin::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("add_custom_control", "control"), &EditorInspectorPlugin::add_custom_control);
+ ClassDB::bind_method(D_METHOD("add_property_editor", "property", "editor"), &EditorInspectorPlugin::add_property_editor);
+ ClassDB::bind_method(D_METHOD("add_property_editor_for_multiple_properties", "label", "properties", "editor"), &EditorInspectorPlugin::add_property_editor_for_multiple_properties);
+
+ MethodInfo vm;
+ vm.name = "can_handle";
+ vm.return_val.type = Variant::BOOL;
+ vm.arguments.push_back(PropertyInfo(Variant::OBJECT, "object"));
+ BIND_VMETHOD(vm);
+ vm.name = "parse_begin";
+ vm.return_val.type = Variant::NIL;
+ BIND_VMETHOD(vm);
+ vm.name = "parse_category";
+ vm.arguments.push_back(PropertyInfo(Variant::STRING, "category"));
+ BIND_VMETHOD(vm);
+ vm.arguments.pop_back();
+ vm.name = "parse_property";
+ vm.return_val.type = Variant::BOOL;
+ vm.arguments.push_back(PropertyInfo(Variant::INT, "type"));
+ vm.arguments.push_back(PropertyInfo(Variant::STRING, "path"));
+ vm.arguments.push_back(PropertyInfo(Variant::INT, "hint"));
+ vm.arguments.push_back(PropertyInfo(Variant::STRING, "hint_text"));
+ vm.arguments.push_back(PropertyInfo(Variant::INT, "usage"));
+ BIND_VMETHOD(vm);
+ vm.arguments.clear();
+ vm.name = "parse_end";
+ vm.return_val.type = Variant::NIL;
+ BIND_VMETHOD(vm);
+}
+
+////////////////////////////////////////////////
+////////////////////////////////////////////////
+
+void EditorInspectorCategory::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_DRAW) {
+
+ draw_rect(Rect2(Vector2(), get_size()), bg_color);
+ Ref<Font> font = get_font("font", "Tree");
+
+ int hs = get_constant("hseparation", "Tree");
+
+ int w = font->get_string_size(label).width;
+ if (icon.is_valid()) {
+ w += hs + icon->get_width();
+ }
+
+ int ofs = (get_size().width - w) / 2;
+
+ if (icon.is_valid()) {
+ draw_texture(icon, Point2(ofs, (get_size().height - icon->get_height()) / 2).floor());
+ ofs += hs + icon->get_width();
+ }
+
+ Color color = get_color("font_color", "Tree");
+ draw_string(font, Point2(ofs, font->get_ascent() + (get_size().height - font->get_height()) / 2).floor(), label, color, get_size().width);
+ }
+}
+
+Size2 EditorInspectorCategory::get_minimum_size() const {
+
+ Ref<Font> font = get_font("font", "Tree");
+
+ Size2 ms;
+ ms.width = 1;
+ ms.height = font->get_height();
+ if (icon.is_valid()) {
+ ms.height = MAX(icon->get_height(), ms.height);
+ }
+ ms.height += get_constant("vseparation", "Tree");
+
+ return ms;
+}
+
+EditorInspectorCategory::EditorInspectorCategory() {
+}
+
+////////////////////////////////////////////////
+////////////////////////////////////////////////
+
+void EditorInspectorSection::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_SORT_CHILDREN) {
+
+ Ref<Font> font = get_font("font", "Tree");
+ Ref<Texture> arrow;
+
+#ifdef TOOLS_ENABLED
+ if (foldable) {
+ if (object->editor_is_section_unfolded(section)) {
+ arrow = get_icon("arrow", "Tree");
+ } else {
+ arrow = get_icon("arrow_collapsed", "Tree");
+ }
+ }
+#endif
+
+ Size2 size = get_size();
+ Point2 offset;
+ offset.y = font->get_height();
+ if (arrow.is_valid()) {
+ offset.y = MAX(offset.y, arrow->get_height());
+ }
+
+ offset.y += get_constant("vseparation", "Tree");
+ offset.x += get_constant("item_margin", "Tree");
+
+ Rect2 rect(offset, size - offset);
+
+ //set children
+ for (int i = 0; i < get_child_count(); i++) {
+
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (!c->is_visible_in_tree())
+ continue;
+
+ fit_child_in_rect(c, rect);
+ }
+
+ update(); //need to redraw text
+ }
+
+ if (p_what == NOTIFICATION_DRAW) {
+
+ Ref<Texture> arrow;
+
+#ifdef TOOLS_ENABLED
+ if (foldable) {
+ if (object->editor_is_section_unfolded(section)) {
+ arrow = get_icon("arrow", "Tree");
+ } else {
+ arrow = get_icon("arrow_collapsed", "Tree");
+ }
+ }
+#endif
+
+ Ref<Font> font = get_font("font", "Tree");
+
+ int h = font->get_height();
+ if (arrow.is_valid()) {
+ h = MAX(h, arrow->get_height());
+ }
+ h += get_constant("vseparation", "Tree");
+
+ draw_rect(Rect2(Vector2(), Vector2(get_size().width, h)), bg_color);
+
+ int hs = get_constant("hseparation", "Tree");
+
+ int ofs = 0;
+ if (arrow.is_valid()) {
+ draw_texture(arrow, Point2(ofs, (h - arrow->get_height()) / 2).floor());
+ ofs += hs + arrow->get_width();
+ }
+
+ Color color = get_color("font_color", "Tree");
+ draw_string(font, Point2(ofs, font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width);
+ }
+}
+
+Size2 EditorInspectorSection::get_minimum_size() const {
+
+ Size2 ms;
+ for (int i = 0; i < get_child_count(); i++) {
+
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (!c->is_visible())
+ continue;
+ Size2 minsize = c->get_combined_minimum_size();
+ ms.width = MAX(ms.width, minsize.width);
+ ms.height = MAX(ms.height, minsize.height);
+ }
+
+ Ref<Font> font = get_font("font", "Tree");
+ ms.height += font->get_ascent() + get_constant("vseparation", "Tree");
+ ms.width += get_constant("item_margin", "Tree");
+
+ return ms;
+}
+
+void EditorInspectorSection::setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable) {
+
+ section = p_section;
+ label = p_label;
+ object = p_object;
+ bg_color = p_bg_color;
+ foldable = p_foldable;
+
+#ifdef TOOLS_ENABLED
+ if (foldable) {
+ if (object->editor_is_section_unfolded(section)) {
+ vbox->show();
+ } else {
+ vbox->hide();
+ }
+ }
+ // void editor_set_section_unfold(const String &p_section, bool p_unfolded);
+
+#endif
+}
+
+void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
+
+ if (!foldable)
+ return;
+
+#ifdef TOOLS_ENABLED
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ bool unfold = !object->editor_is_section_unfolded(section);
+ object->editor_set_section_unfold(section, unfold);
+ if (unfold) {
+ vbox->show();
+ } else {
+ vbox->hide();
+ }
+ }
+#endif
+}
+
+VBoxContainer *EditorInspectorSection::get_vbox() {
+ return vbox;
+}
+
+void EditorInspectorSection::unfold() {
+
+ if (!foldable)
+ return;
+#ifdef TOOLS_ENABLED
+
+ object->editor_set_section_unfold(section, true);
+ vbox->show();
+ update();
+#endif
+}
+
+void EditorInspectorSection::fold() {
+ if (!foldable)
+ return;
+
+#ifdef TOOLS_ENABLED
+
+ object->editor_set_section_unfold(section, false);
+ vbox->hide();
+ update();
+#endif
+}
+
+void EditorInspectorSection::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("setup", "section", "label", "object", "bg_color", "foldable"), &EditorInspectorSection::setup);
+ ClassDB::bind_method(D_METHOD("get_vbox"), &EditorInspectorSection::get_vbox);
+ ClassDB::bind_method(D_METHOD("unfold"), &EditorInspectorSection::unfold);
+ ClassDB::bind_method(D_METHOD("fold"), &EditorInspectorSection::fold);
+ ClassDB::bind_method(D_METHOD("_gui_input"), &EditorInspectorSection::_gui_input);
+}
+
+EditorInspectorSection::EditorInspectorSection() {
+ object = NULL;
+ foldable = false;
+ vbox = memnew(VBoxContainer);
+ add_child(vbox);
+}
+
+////////////////////////////////////////////////
+////////////////////////////////////////////////
+
+Ref<EditorInspectorPlugin> EditorInspector::inspector_plugins[MAX_PLUGINS];
+int EditorInspector::inspector_plugin_count = 0;
+
+void EditorInspector::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+
+ ERR_FAIL_COND(inspector_plugin_count == MAX_PLUGINS);
+
+ for (int i = 0; i < inspector_plugin_count; i++) {
+ if (inspector_plugins[i] == p_plugin)
+ return; //already exists
+ }
+ inspector_plugins[inspector_plugin_count++] = p_plugin;
+}
+
+void EditorInspector::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+
+ ERR_FAIL_COND(inspector_plugin_count == MAX_PLUGINS);
+
+ int idx = -1;
+ for (int i = 0; i < inspector_plugin_count; i++) {
+ if (inspector_plugins[i] == p_plugin) {
+ idx = i;
+ break;
+ }
+ }
+
+ for (int i = idx; i < inspector_plugin_count - 1; i++) {
+ inspector_plugins[i] = inspector_plugins[i + 1];
+ }
+ inspector_plugin_count--;
+}
+
+void EditorInspector::cleanup_plugins() {
+ for (int i = 0; i < inspector_plugin_count; i++) {
+ inspector_plugins[i].unref();
+ }
+ inspector_plugin_count = 0;
+}
+
+void EditorInspector::set_undo_redo(UndoRedo *p_undo_redo) {
+ undo_redo = p_undo_redo;
+}
+
+String EditorInspector::get_selected_path() const {
+
+ return property_selected;
+}
+
+void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped) {
+
+ for (List<EditorInspectorPlugin::AddedEditor>::Element *F = ped->added_editors.front(); F; F = F->next()) {
+
+ EditorProperty *ep = Object::cast_to<EditorProperty>(F->get().property_editor);
+ current_vbox->add_child(F->get().property_editor);
+
+ if (ep) {
+
+ ep->object = object;
+ ep->connect("property_changed", this, "_property_changed");
+ ep->connect("property_keyed", this, "_property_keyed");
+ ep->connect("property_keyed_with_value", this, "_property_keyed_with_value");
+ ep->connect("property_checked", this, "_property_checked");
+ ep->connect("selected", this, "_property_selected");
+ ep->connect("multiple_properties_changed", this, "_multiple_properties_changed");
+ ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
+ ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
+
+ if (F->get().properties.size()) {
+
+ if (F->get().properties.size() == 1) {
+ //since it's one, associate:
+ ep->property = F->get().properties[0];
+ ep->property_usage = 0;
+ }
+
+ if (F->get().label != String()) {
+ ep->set_label(F->get().label);
+ }
+
+ for (int i = 0; i < F->get().properties.size(); i++) {
+ String prop = F->get().properties[i];
+
+ if (!editor_property_map.has(prop)) {
+ editor_property_map[prop] = List<EditorProperty *>();
+ }
+ editor_property_map[prop].push_back(ep);
+ }
+ }
+
+ ep->set_read_only(read_only);
+ ep->update_property();
+ ep->update_reload_status();
+ }
+ }
+ ped->added_editors.clear();
+}
+
+void EditorInspector::update_tree() {
+
+ //to update properly if all is refreshed
+ StringName current_selected = property_selected;
+ int current_focusable = property_focusable;
+
+ _clear();
+
+ if (!object)
+ return;
+
+ List<Ref<EditorInspectorPlugin> > valid_plugins;
+
+ for (int i = inspector_plugin_count - 1; i >= 0; i--) { //start by last, so lastly added can override newly added
+ if (!inspector_plugins[i]->can_handle(object))
+ continue;
+ valid_plugins.push_back(inspector_plugins[i]);
+ }
+
+ bool draw_red = false;
+
+ {
+ Node *nod = Object::cast_to<Node>(object);
+ Node *es = EditorNode::get_singleton()->get_edited_scene();
+ if (nod && es != nod && nod->get_owner() != es) {
+ draw_red = true;
+ }
+ }
+
+ // TreeItem *current_category = NULL;
+
+ String filter = search_box ? search_box->get_text() : "";
+ String group;
+ String group_base;
+
+ List<PropertyInfo> plist;
+ object->get_property_list(&plist, true);
+
+ HashMap<String, VBoxContainer *> item_path;
+ item_path[""] = main_vbox;
+
+ Color sscolor = get_color("prop_subsection", "Editor");
+
+ for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ Ref<EditorInspectorPlugin> ped = E->get();
+ ped->parse_begin(object);
+ _parse_added_editors(main_vbox, ped);
+ }
+
+ for (List<PropertyInfo>::Element *I = plist.front(); I; I = I->next()) {
+
+ PropertyInfo &p = I->get();
+
+ //make sure the property can be edited
+
+ if (p.usage & PROPERTY_USAGE_GROUP) {
+
+ group = p.name;
+ group_base = p.hint_string;
+
+ continue;
+
+ } else if (p.usage & PROPERTY_USAGE_CATEGORY) {
+
+ group = "";
+ group_base = "";
+
+ if (!show_categories)
+ continue;
+
+ List<PropertyInfo>::Element *N = I->next();
+ bool valid = true;
+ //if no properties in category, skip
+ while (N) {
+ if (N->get().usage & PROPERTY_USAGE_EDITOR)
+ break;
+ if (N->get().usage & PROPERTY_USAGE_CATEGORY) {
+ valid = false;
+ break;
+ }
+ N = N->next();
+ }
+ if (!valid)
+ continue; //empty, ignore
+
+ EditorInspectorCategory *category = memnew(EditorInspectorCategory);
+ main_vbox->add_child(category);
+
+ String type = p.name;
+ if (has_icon(type, "EditorIcons"))
+ category->icon = get_icon(type, "EditorIcons");
+ else
+ category->icon = get_icon("Object", "EditorIcons");
+ category->label = type;
+
+ category->bg_color = get_color("prop_category", "Editor");
+ if (use_doc_hints) {
+ StringName type = p.name;
+ if (!class_descr_cache.has(type)) {
+
+ String descr;
+ DocData *dd = EditorHelp::get_doc_data();
+ Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type);
+ if (E) {
+ descr = E->get().brief_description;
+ }
+ class_descr_cache[type] = descr.word_wrap(80);
+ }
+
+ category->set_tooltip(TTR("Class:") + " " + p.name + (class_descr_cache[type] == "" ? "" : "\n\n" + class_descr_cache[type]));
+ }
+
+ for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ Ref<EditorInspectorPlugin> ped = E->get();
+ ped->parse_category(object, p.name);
+ _parse_added_editors(main_vbox, ped);
+ }
+
+ continue;
+
+ } else if (!(p.usage & PROPERTY_USAGE_EDITOR))
+ continue;
+
+ if (p.name == "script" && (hide_script || bool(object->call("_hide_script_from_inspector")))) {
+ continue;
+ }
+
+ String basename = p.name;
+ if (group != "") {
+ if (group_base != "") {
+ if (basename.begins_with(group_base)) {
+ basename = basename.replace_first(group_base, "");
+ } else if (group_base.begins_with(basename)) {
+ //keep it, this is used pretty often
+ } else {
+ group = ""; //no longer using group base, clear
+ }
+ }
+ }
+
+ if (group != "") {
+ basename = group + "/" + basename;
+ }
+
+ String name = (basename.find("/") != -1) ? basename.right(basename.find_last("/") + 1) : basename;
+
+ if (capitalize_paths) {
+ int dot = name.find(".");
+ if (dot != -1) {
+ String ov = name.right(dot);
+ name = name.substr(0, dot);
+ name = name.camelcase_to_underscore().capitalize();
+ name += ov;
+
+ } else {
+ name = name.camelcase_to_underscore().capitalize();
+ }
+ }
+
+ String path = basename.left(basename.find_last("/"));
+
+ if (use_filter && filter != "") {
+
+ String cat = path;
+
+ if (capitalize_paths)
+ cat = cat.capitalize();
+
+ if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name))
+ continue;
+ }
+
+ VBoxContainer *current_vbox = main_vbox;
+
+ {
+
+ String acc_path = "";
+ int level = 1;
+ for (int i = 0; i < path.get_slice_count("/"); i++) {
+ String path_name = path.get_slice("/", i);
+ if (i > 0)
+ acc_path += "/";
+ acc_path += path_name;
+ if (!item_path.has(acc_path)) {
+ EditorInspectorSection *section = memnew(EditorInspectorSection);
+ current_vbox->add_child(section);
+ sections.push_back(section);
+
+ if (capitalize_paths)
+ path_name = path_name.capitalize();
+ Color c = sscolor;
+ c.a /= level;
+ section->setup(path_name, acc_path, object, c, use_folding);
+
+ item_path[acc_path] = section->get_vbox();
+ }
+ current_vbox = item_path[acc_path];
+ level = (MIN(level + 1, 4));
+ }
+ }
+
+ bool checkable = false;
+ bool checked = false;
+ if (p.usage & PROPERTY_USAGE_CHECKABLE) {
+ checkable = true;
+ checked = p.usage & PROPERTY_USAGE_CHECKED;
+ }
+
+ String doc_hint;
+
+ if (use_doc_hints) {
+
+ StringName classname = object->get_class_name();
+ StringName propname = p.name;
+ String descr;
+ bool found = false;
+
+ Map<StringName, Map<StringName, String> >::Element *E = descr_cache.find(classname);
+ if (E) {
+ Map<StringName, String>::Element *F = E->get().find(propname);
+ if (F) {
+ found = true;
+ descr = F->get();
+ }
+ }
+
+ if (!found) {
+ DocData *dd = EditorHelp::get_doc_data();
+ Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(classname);
+ while (E && descr == String()) {
+ for (int i = 0; i < E->get().properties.size(); i++) {
+ if (E->get().properties[i].name == propname.operator String()) {
+ descr = E->get().properties[i].description.strip_edges().word_wrap(80);
+ break;
+ }
+ }
+ if (!E->get().inherits.empty()) {
+ E = dd->class_list.find(E->get().inherits);
+ } else {
+ break;
+ }
+ }
+ descr_cache[classname][propname] = descr;
+ }
+
+ doc_hint = descr;
+ }
+
+#if 0
+ if (p.name == selected_property) {
+
+ item->select(1);
+ }
+#endif
+ for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ Ref<EditorInspectorPlugin> ped = E->get();
+ bool exclusive = ped->parse_property(object, p.type, p.name, p.hint, p.hint_string, p.usage);
+
+ List<EditorInspectorPlugin::AddedEditor> editors = ped->added_editors; //make a copy, since plugins may be used again in a sub-inspector
+ ped->added_editors.clear();
+
+ for (List<EditorInspectorPlugin::AddedEditor>::Element *F = editors.front(); F; F = F->next()) {
+
+ EditorProperty *ep = Object::cast_to<EditorProperty>(F->get().property_editor);
+ current_vbox->add_child(F->get().property_editor);
+
+ if (ep) {
+
+ ep->object = object;
+ ep->connect("property_changed", this, "_property_changed");
+ if (p.usage & PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED) {
+ ep->connect("property_changed", this, "_property_changed_update_all", varray(), CONNECT_DEFERRED);
+ }
+ ep->connect("property_keyed", this, "_property_keyed");
+ ep->connect("property_keyed_with_value", this, "_property_keyed_with_value");
+ ep->connect("property_checked", this, "_property_checked");
+ ep->connect("selected", this, "_property_selected");
+ ep->connect("multiple_properties_changed", this, "_multiple_properties_changed");
+ ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
+ ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
+ if (doc_hint != String()) {
+ ep->set_tooltip(TTR("Property: ") + p.name + "\n\n" + doc_hint);
+ } else {
+ ep->set_tooltip(TTR("Property: ") + p.name);
+ }
+ ep->set_draw_red(draw_red);
+ ep->set_use_folding(use_folding);
+ ep->set_checkable(checkable);
+ ep->set_checked(checked);
+ ep->set_keying(keying);
+
+ if (F->get().properties.size()) {
+
+ if (F->get().properties.size() == 1) {
+ //since it's one, associate:
+ ep->property = F->get().properties[0];
+ ep->property_usage = p.usage;
+ //and set label?
+ }
+
+ if (F->get().label != String()) {
+ ep->set_label(F->get().label);
+ } else {
+ //use existin one
+ ep->set_label(name);
+ }
+ for (int i = 0; i < F->get().properties.size(); i++) {
+ String prop = F->get().properties[i];
+
+ if (!editor_property_map.has(prop)) {
+ editor_property_map[prop] = List<EditorProperty *>();
+ }
+ editor_property_map[prop].push_back(ep);
+ }
+ }
+
+ ep->set_read_only(read_only);
+ ep->update_property();
+ ep->update_reload_status();
+
+ if (current_selected && ep->property == current_selected) {
+ ep->select(current_focusable);
+ }
+ }
+ }
+
+ if (exclusive) {
+ break;
+ }
+ }
+ }
+
+ for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ Ref<EditorInspectorPlugin> ped = E->get();
+ ped->parse_end();
+ _parse_added_editors(main_vbox, ped);
+ }
+
+ //see if this property exists and should be kept
+}
+void EditorInspector::update_property(const String &p_prop) {
+ if (!editor_property_map.has(p_prop))
+ return;
+
+ for (List<EditorProperty *>::Element *E = editor_property_map[p_prop].front(); E; E = E->next()) {
+ E->get()->update_property();
+ E->get()->update_reload_status();
+ }
+}
+
+void EditorInspector::_clear() {
+
+ while (main_vbox->get_child_count()) {
+ memdelete(main_vbox->get_child(0));
+ }
+ property_selected = StringName();
+ property_focusable = -1;
+ editor_property_map.clear();
+ sections.clear();
+ pending.clear();
+}
+
+void EditorInspector::refresh() {
+
+ if (refresh_countdown > 0)
+ return;
+ refresh_countdown = EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval");
+}
+
+Object *EditorInspector::get_edited_object() {
+ return object;
+}
+
+void EditorInspector::edit(Object *p_object) {
+ if (object == p_object)
+ return;
+ if (object) {
+
+ _clear();
+ object->remove_change_receptor(this);
+ }
+
+ object = p_object;
+
+ if (object) {
+ object->add_change_receptor(this);
+ update_tree();
+ }
+}
+
+void EditorInspector::set_keying(bool p_active) {
+ if (keying == p_active)
+ return;
+ keying = p_active;
+ update_tree();
+}
+void EditorInspector::set_read_only(bool p_read_only) {
+ read_only = p_read_only;
+ update_tree();
+}
+
+bool EditorInspector::is_capitalize_paths_enabled() const {
+
+ return capitalize_paths;
+}
+void EditorInspector::set_enable_capitalize_paths(bool p_capitalize) {
+ capitalize_paths = p_capitalize;
+ update_tree();
+}
+
+void EditorInspector::set_autoclear(bool p_enable) {
+ autoclear = p_enable;
+}
+
+void EditorInspector::set_show_categories(bool p_show) {
+ show_categories = p_show;
+ update_tree();
+}
+
+void EditorInspector::set_use_doc_hints(bool p_enable) {
+ use_doc_hints = p_enable;
+ update_tree();
+}
+void EditorInspector::set_hide_script(bool p_hide) {
+ hide_script = p_hide;
+ update_tree();
+}
+void EditorInspector::set_use_filter(bool p_use) {
+ use_filter = p_use;
+ update_tree();
+}
+void EditorInspector::register_text_enter(Node *p_line_edit) {
+ search_box = Object::cast_to<LineEdit>(p_line_edit);
+ if (search_box)
+ search_box->connect("text_changed", this, "_filter_changed");
+}
+
+void EditorInspector::_filter_changed(const String &p_text) {
+
+ _clear();
+ update_tree();
+}
+
+void EditorInspector::set_subsection_selectable(bool p_selectable) {
+}
+
+void EditorInspector::set_property_selectable(bool p_selectable) {
+}
+
+void EditorInspector::set_use_folding(bool p_enable) {
+ use_folding = p_enable;
+ update_tree();
+}
+
+bool EditorInspector::is_using_folding() {
+ return use_folding;
+}
+
+void EditorInspector::collapse_all_folding() {
+
+ for (List<EditorInspectorSection *>::Element *E = sections.front(); E; E = E->next()) {
+ E->get()->fold();
+ }
+
+ for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
+ E->get()->collapse_all_folding();
+ }
+ }
+}
+
+void EditorInspector::expand_all_folding() {
+ for (List<EditorInspectorSection *>::Element *E = sections.front(); E; E = E->next()) {
+ E->get()->unfold();
+ }
+ for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
+ E->get()->expand_all_folding();
+ }
+ }
+}
+
+void EditorInspector::set_scroll_offset(int p_offset) {
+ set_v_scroll(p_offset);
+}
+
+int EditorInspector::get_scroll_offset() const {
+ return get_v_scroll();
+}
+
+void EditorInspector::_edit_request_change(Object *p_object, const String &p_property) {
+
+ if (object != p_object) //may be undoing/redoing for a non edited object, so ignore
+ return;
+
+ if (changing)
+ return;
+
+ if (p_property == String())
+ update_tree_pending = true;
+ else {
+ pending.insert(p_property);
+ }
+}
+
+void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field) {
+
+ if (autoclear && editor_property_map.has(p_name)) {
+ for (List<EditorProperty *>::Element *E = editor_property_map[p_name].front(); E; E = E->next()) {
+ if (E->get()->is_checkable()) {
+ E->get()->set_checked(true);
+ }
+ }
+ }
+
+ if (!undo_redo || Object::cast_to<ArrayPropertyEdit>(object) || Object::cast_to<DictionaryPropertyEdit>(object)) { //kind of hacky
+
+ object->set(p_name, p_value);
+ if (p_refresh_all)
+ _edit_request_change(object, "");
+ else
+ _edit_request_change(object, p_name);
+
+ emit_signal(_prop_edited, p_name);
+
+ } else if (Object::cast_to<MultiNodeEdit>(object)) {
+
+ Object::cast_to<MultiNodeEdit>(object)->set_property_field(p_name, p_value, p_changed_field);
+ _edit_request_change(object, p_name);
+ emit_signal(_prop_edited, p_name);
+ } else {
+
+ undo_redo->create_action(TTR("Set") + " " + p_name, UndoRedo::MERGE_ENDS);
+ undo_redo->add_do_property(object, p_name, p_value);
+ undo_redo->add_undo_property(object, p_name, object->get(p_name));
+
+ if (p_refresh_all) {
+ undo_redo->add_do_method(this, "_edit_request_change", object, "");
+ undo_redo->add_undo_method(this, "_edit_request_change", object, "");
+ } else {
+
+ undo_redo->add_do_method(this, "_edit_request_change", object, p_name);
+ undo_redo->add_undo_method(this, "_edit_request_change", object, p_name);
+ }
+
+ Resource *r = Object::cast_to<Resource>(object);
+ if (r) {
+ if (!r->is_edited() && String(p_name) != "resource/edited") {
+ undo_redo->add_do_method(r, "set_edited", true);
+ undo_redo->add_undo_method(r, "set_edited", false);
+ }
+
+ if (String(p_name) == "resource_local_to_scene") {
+ bool prev = object->get(p_name);
+ bool next = p_value;
+ if (next) {
+ undo_redo->add_do_method(r, "setup_local_to_scene");
+ }
+ if (prev) {
+ undo_redo->add_undo_method(r, "setup_local_to_scene");
+ }
+ }
+ }
+ undo_redo->add_do_method(this, "emit_signal", _prop_edited, p_name);
+ undo_redo->add_undo_method(this, "emit_signal", _prop_edited, p_name);
+ changing++;
+ undo_redo->commit_action();
+ changing--;
+ }
+
+ if (editor_property_map.has(p_name)) {
+ for (List<EditorProperty *>::Element *E = editor_property_map[p_name].front(); E; E = E->next()) {
+ E->get()->update_reload_status();
+ }
+ }
+}
+
+void EditorInspector::_property_changed(const String &p_path, const Variant &p_value) {
+
+ _edit_set(p_path, p_value, false, "");
+}
+
+void EditorInspector::_property_changed_update_all(const String &p_path, const Variant &p_value) {
+ update_tree();
+}
+
+void EditorInspector::_multiple_properties_changed(Vector<String> p_paths, Array p_values) {
+
+ ERR_FAIL_COND(p_paths.size() == 0 || p_values.size() == 0);
+ ERR_FAIL_COND(p_paths.size() != p_values.size());
+ String names;
+ for (int i = 0; i < p_paths.size(); i++) {
+ if (i > 0)
+ names += ",";
+ names += p_paths[i];
+ }
+ undo_redo->create_action(TTR("Set Multiple:") + " " + names, UndoRedo::MERGE_ENDS);
+ for (int i = 0; i < p_paths.size(); i++) {
+ _edit_set(p_paths[i], p_values[i], false, "");
+ }
+ changing++;
+ undo_redo->commit_action();
+ changing--;
+}
+
+void EditorInspector::_property_keyed(const String &p_path) {
+
+ if (!object)
+ return;
+
+ emit_signal("property_keyed", p_path, object->get(p_path), false); //second param is deprecated
+}
+
+void EditorInspector::_property_keyed_with_value(const String &p_path, const Variant &p_value) {
+
+ if (!object)
+ return;
+
+ emit_signal("property_keyed", p_path, p_value, false); //second param is deprecated
+}
+
+void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
+
+ if (!object)
+ return;
+
+ //property checked
+ if (autoclear) {
+
+ if (!p_checked) {
+ object->set(p_path, Variant());
+ } else {
+
+ Variant to_create;
+ List<PropertyInfo> pinfo;
+ object->get_property_list(&pinfo);
+ for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
+ if (E->get().name == p_path) {
+ Variant::CallError ce;
+ to_create = Variant::construct(E->get().type, NULL, 0, ce);
+ break;
+ }
+ }
+ object->set(p_path, to_create);
+ }
+
+ if (editor_property_map.has(p_path)) {
+ for (List<EditorProperty *>::Element *E = editor_property_map[p_path].front(); E; E = E->next()) {
+ E->get()->update_property();
+ E->get()->update_reload_status();
+ }
+ }
+
+ } else {
+ emit_signal("property_toggled", p_path, p_checked);
+ }
+}
+
+void EditorInspector::_property_selected(const String &p_path, int p_focusable) {
+
+ property_selected = p_path;
+ property_focusable = p_focusable;
+ //deselect the others
+ for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ if (F->key() == property_selected)
+ continue;
+ for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
+ if (E->get()->is_selected())
+ E->get()->deselect();
+ }
+ }
+}
+
+void EditorInspector::_object_id_selected(const String &p_path, ObjectID p_id) {
+
+ emit_signal("object_id_selected", p_id);
+}
+
+void EditorInspector::_resource_selected(const String &p_path, RES p_resource) {
+ emit_signal("resource_selected", p_resource, p_path);
+}
+
+void EditorInspector::_node_removed(Node *p_node) {
+
+ if (p_node == object) {
+ edit(NULL);
+ }
+}
+
+void EditorInspector::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+
+ get_tree()->connect("node_removed", this, "_node_removed");
+ add_style_override("bg", get_stylebox("bg", "Tree"));
+ }
+ if (p_what == NOTIFICATION_EXIT_TREE) {
+
+ get_tree()->disconnect("node_removed", this, "_node_removed");
+ edit(NULL);
+ }
+
+ if (p_what == NOTIFICATION_PROCESS) {
+
+ if (refresh_countdown > 0) {
+ refresh_countdown -= get_process_delta_time();
+ if (refresh_countdown <= 0) {
+ for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
+ E->get()->update_property();
+ E->get()->update_reload_status();
+ }
+ }
+ }
+ }
+
+ changing++;
+
+ if (update_tree_pending) {
+
+ update_tree();
+ update_tree_pending = false;
+ pending.clear();
+
+ } else {
+
+ while (pending.size()) {
+ StringName prop = pending.front()->get();
+ if (editor_property_map.has(prop)) {
+ for (List<EditorProperty *>::Element *E = editor_property_map[prop].front(); E; E = E->next()) {
+ E->get()->update_property();
+ E->get()->update_reload_status();
+ }
+ }
+ pending.erase(pending.front());
+ }
+ }
+
+ changing--;
+ }
+
+ if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
+ update_tree();
+ }
+}
+
+void EditorInspector::_changed_callback(Object *p_changed, const char *p_prop) {
+ //this is called when property change is notified via _change_notify()
+ _edit_request_change(p_changed, p_prop);
+}
+
+void EditorInspector::_bind_methods() {
+
+ ClassDB::bind_method("_multiple_properties_changed", &EditorInspector::_multiple_properties_changed);
+ ClassDB::bind_method("_property_changed", &EditorInspector::_property_changed);
+ ClassDB::bind_method("_property_changed_update_all", &EditorInspector::_property_changed_update_all);
+
+ ClassDB::bind_method("_edit_request_change", &EditorInspector::_edit_request_change);
+ ClassDB::bind_method("_node_removed", &EditorInspector::_node_removed);
+ ClassDB::bind_method("_filter_changed", &EditorInspector::_filter_changed);
+ ClassDB::bind_method("_property_keyed", &EditorInspector::_property_keyed);
+ ClassDB::bind_method("_property_keyed_with_value", &EditorInspector::_property_keyed_with_value);
+ ClassDB::bind_method("_property_checked", &EditorInspector::_property_checked);
+ ClassDB::bind_method("_property_selected", &EditorInspector::_property_selected);
+ ClassDB::bind_method("_resource_selected", &EditorInspector::_resource_selected);
+ ClassDB::bind_method("_object_id_selected", &EditorInspector::_object_id_selected);
+
+ ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
+ ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::OBJECT, "res"), PropertyInfo(Variant::STRING, "prop")));
+ ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::INT, "id")));
+}
+
+EditorInspector::EditorInspector() {
+ object = NULL;
+ undo_redo = NULL;
+ main_vbox = memnew(VBoxContainer);
+ main_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_child(main_vbox);
+ set_enable_h_scroll(false);
+ set_enable_v_scroll(true);
+
+ show_categories = false;
+ hide_script = true;
+ use_doc_hints = false;
+ capitalize_paths = false;
+ use_filter = false;
+ autoclear = false;
+ changing = 0;
+ use_folding = false;
+ update_all_pending = false;
+ update_tree_pending = false;
+ refresh_countdown = 0;
+ read_only = false;
+ search_box = NULL;
+ keying = false;
+ _prop_edited = "property_edited";
+ set_process(true);
+ property_focusable = -1;
+}
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
new file mode 100644
index 0000000000..2a88be656a
--- /dev/null
+++ b/editor/editor_inspector.h
@@ -0,0 +1,329 @@
+/*************************************************************************/
+/* editor_inspector.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef EDITOR_INSPECTOR_H
+#define EDITOR_INSPECTOR_H
+
+#include "scene/gui/box_container.h"
+#include "scene/gui/line_edit.h"
+#include "scene/gui/scroll_container.h"
+
+class UndoRedo;
+
+class EditorProperty : public Container {
+
+ GDCLASS(EditorProperty, Container)
+private:
+ String label;
+ int text_size;
+ friend class EditorInspector;
+ Object *object;
+ StringName property;
+
+ int property_usage;
+
+ bool read_only;
+ bool checkable;
+ bool checked;
+ bool draw_red;
+ bool keying;
+
+ Rect2 keying_rect;
+ bool keying_hover;
+ Rect2 revert_rect;
+ bool revert_hover;
+ Rect2 check_rect;
+ bool check_hover;
+
+ bool can_revert;
+
+ bool use_folding;
+
+ bool _might_be_in_instance();
+ bool _is_property_different(const Variant &p_current, const Variant &p_orig, int p_usage);
+ bool _is_instanced_node_with_original_property_different();
+ bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value);
+ void _focusable_focused(int p_index);
+
+ bool selectable;
+ bool selected;
+ int selected_focusable;
+
+ Vector<Control *> focusables;
+ Control *label_reference;
+ Control *bottom_editor;
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+ void _gui_input(const Ref<InputEvent> &p_event);
+
+public:
+ virtual Size2 get_minimum_size() const;
+
+ void set_label(const String &p_label);
+ String get_label() const;
+
+ void set_read_only(bool p_read_only);
+ bool is_read_only() const;
+
+ Object *get_edited_object();
+ StringName get_edited_property();
+
+ virtual void update_property();
+ void update_reload_status();
+
+ virtual bool use_keying_next() const;
+
+ void set_checkable(bool p_checkable);
+ bool is_checkable() const;
+
+ void set_checked(bool p_checked);
+ bool is_checked() const;
+
+ void set_draw_red(bool p_draw_red);
+ bool is_draw_red() const;
+
+ void set_keying(bool p_keying);
+ bool is_keying() const;
+
+ void add_focusable(Control *p_control);
+ void select(int p_focusable = -1);
+ void deselect();
+ bool is_selected() const;
+
+ void set_label_reference(Control *p_control);
+ void set_bottom_editor(Control *p_editor);
+
+ void set_use_folding(bool p_use_folding);
+ bool is_using_folding() const;
+
+ virtual void expand_all_folding();
+ virtual void collapse_all_folding();
+
+ virtual Variant get_drag_data(const Point2 &p_point);
+
+ void set_selectable(bool p_selectable);
+ bool is_selectable() const;
+
+ void set_object_and_property(Object *p_object, const StringName &p_property);
+ EditorProperty();
+};
+
+class EditorInspectorPlugin : public Reference {
+ GDCLASS(EditorInspectorPlugin, Reference)
+
+ friend class EditorInspector;
+ struct AddedEditor {
+ Control *property_editor;
+ Vector<String> properties;
+ String label;
+ };
+
+ List<AddedEditor> added_editors;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void add_custom_control(Control *control);
+ void add_property_editor(const String &p_for_property, Control *p_prop);
+ void add_property_editor_for_multiple_properties(const String &p_label, const Vector<String> &p_properties, Control *p_prop);
+
+ virtual bool can_handle(Object *p_object);
+ virtual void parse_begin(Object *p_object);
+ virtual void parse_category(Object *p_object, const String &p_parse_category);
+ virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage);
+ virtual void parse_end();
+};
+
+class EditorInspectorCategory : public Control {
+ GDCLASS(EditorInspectorCategory, Control);
+
+ friend class EditorInspector;
+ Ref<Texture> icon;
+ String label;
+ Color bg_color;
+
+protected:
+ void _notification(int p_what);
+
+public:
+ virtual Size2 get_minimum_size() const;
+
+ EditorInspectorCategory();
+};
+
+class EditorInspectorSection : public Container {
+ GDCLASS(EditorInspectorSection, Container);
+
+ String label;
+ String section;
+ Object *object;
+ VBoxContainer *vbox;
+ Color bg_color;
+ bool foldable;
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+ void _gui_input(const Ref<InputEvent> &p_event);
+
+public:
+ virtual Size2 get_minimum_size() const;
+
+ void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable);
+ VBoxContainer *get_vbox();
+ void unfold();
+ void fold();
+
+ Object *get_edited_object();
+
+ EditorInspectorSection();
+};
+
+class EditorInspector : public ScrollContainer {
+ GDCLASS(EditorInspector, ScrollContainer);
+
+ UndoRedo *undo_redo;
+ enum {
+ MAX_PLUGINS = 1024
+ };
+ static Ref<EditorInspectorPlugin> inspector_plugins[MAX_PLUGINS];
+ static int inspector_plugin_count;
+
+ VBoxContainer *main_vbox;
+
+ //map use to cache the instanced editors
+ Map<StringName, List<EditorProperty *> > editor_property_map;
+ List<EditorInspectorSection *> sections;
+ Set<StringName> pending;
+
+ void _clear();
+ Object *object;
+
+ //
+
+ LineEdit *search_box;
+ bool show_categories;
+ bool hide_script;
+ bool use_doc_hints;
+ bool capitalize_paths;
+ bool use_filter;
+ bool autoclear;
+ bool use_folding;
+ int changing;
+ bool update_all_pending;
+ bool read_only;
+ bool keying;
+
+ int refresh_countdown;
+ bool update_tree_pending;
+ StringName _prop_edited;
+ StringName property_selected;
+ int property_focusable;
+
+ Map<StringName, Map<StringName, String> > descr_cache;
+ Map<StringName, String> class_descr_cache;
+
+ void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
+
+ void _property_changed(const String &p_path, const Variant &p_value);
+ void _property_changed_update_all(const String &p_path, const Variant &p_value);
+ void _multiple_properties_changed(Vector<String> p_paths, Array p_values);
+ void _property_keyed(const String &p_path);
+ void _property_keyed_with_value(const String &p_path, const Variant &p_value);
+
+ void _property_checked(const String &p_path, bool p_checked);
+
+ void _resource_selected(const String &p_path, RES p_resource);
+ void _property_selected(const String &p_path, int p_focusable);
+ void _object_id_selected(const String &p_path, ObjectID p_id);
+
+ void _node_removed(Node *p_node);
+
+ void _changed_callback(Object *p_changed, const char *p_prop);
+ void _edit_request_change(Object *p_changed, const String &p_prop);
+
+ void _filter_changed(const String &p_text);
+ void _parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped);
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ static void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
+ static void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
+ static void cleanup_plugins();
+
+ void set_undo_redo(UndoRedo *p_undo_redo);
+
+ String get_selected_path() const;
+
+ void update_tree();
+ void update_property(const String &p_prop);
+
+ void refresh();
+
+ void edit(Object *p_object);
+ Object *get_edited_object();
+
+ void set_keying(bool p_active);
+ void set_read_only(bool p_read_only);
+
+ bool is_capitalize_paths_enabled() const;
+ void set_enable_capitalize_paths(bool p_capitalize);
+ void set_autoclear(bool p_enable);
+
+ void set_show_categories(bool p_show);
+ void set_use_doc_hints(bool p_enable);
+ void set_hide_script(bool p_hide);
+
+ void set_use_filter(bool p_use);
+ void register_text_enter(Node *p_line_edit);
+
+ void set_subsection_selectable(bool p_selectable);
+ void set_property_selectable(bool p_selectable);
+
+ void set_use_folding(bool p_enable);
+ bool is_using_folding();
+
+ void collapse_all_folding();
+ void expand_all_folding();
+
+ void set_scroll_offset(int p_offset);
+ int get_scroll_offset() const;
+
+ EditorInspector();
+};
+
+#endif // INSPECTOR_H
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index e301d12214..158eedfb0f 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -88,6 +88,7 @@ void EditorLog::_notification(int p_what) {
void EditorLog::_clear_request() {
log->clear();
+ tool_button->set_icon(Ref<Texture>());
}
void EditorLog::clear() {
@@ -103,9 +104,7 @@ void EditorLog::add_message(const String &p_msg, bool p_error) {
Ref<Texture> icon = get_icon("Error", "EditorIcons");
log->add_image(icon);
log->add_text(" ");
- //button->set_icon(icon);
- } else {
- //button->set_icon(Ref<Texture>());
+ tool_button->set_icon(icon);
}
log->add_text(p_msg);
@@ -115,6 +114,10 @@ void EditorLog::add_message(const String &p_msg, bool p_error) {
log->pop();
}
+void EditorLog::set_tool_button(ToolButton *p_tool_button) {
+ tool_button = p_tool_button;
+}
+
/*
void EditorLog::_dragged(const Point2& p_ofs) {
diff --git a/editor/editor_log.h b/editor/editor_log.h
index 42137f71cc..f9bc82de7d 100644
--- a/editor/editor_log.h
+++ b/editor/editor_log.h
@@ -51,6 +51,7 @@ class EditorLog : public VBoxContainer {
RichTextLabel *log;
HBoxContainer *title_hb;
//PaneDrag *pd;
+ ToolButton *tool_button;
static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type);
@@ -68,6 +69,7 @@ protected:
public:
void add_message(const String &p_msg, bool p_error = false);
+ void set_tool_button(ToolButton *p_tool_button);
void deinit();
void clear();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 8132575479..6084332dfb 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -51,11 +51,11 @@
#include "scene/resources/packed_scene.h"
#include "servers/physics_2d_server.h"
-#include "editor/animation_editor.h"
#include "editor/editor_audio_buses.h"
#include "editor/editor_file_system.h"
#include "editor/editor_help.h"
#include "editor/editor_initialize_ssl.h"
+#include "editor/editor_properties.h"
#include "editor/editor_settings.h"
#include "editor/editor_themes.h"
#include "editor/import/editor_import_collada.h"
@@ -66,7 +66,11 @@
#include "editor/import/resource_importer_scene.h"
#include "editor/import/resource_importer_texture.h"
#include "editor/import/resource_importer_wav.h"
+#include "editor/plugins/animation_blend_space_1d_editor.h"
+#include "editor/plugins/animation_blend_space_2d_editor.h"
+#include "editor/plugins/animation_blend_tree_editor_plugin.h"
#include "editor/plugins/animation_player_editor_plugin.h"
+#include "editor/plugins/animation_state_machine_editor.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/baked_lightmap_editor_plugin.h"
@@ -87,19 +91,21 @@
#include "editor/plugins/mesh_editor_plugin.h"
#include "editor/plugins/mesh_instance_editor_plugin.h"
#include "editor/plugins/multimesh_editor_plugin.h"
-#include "editor/plugins/navigation_mesh_editor_plugin.h"
#include "editor/plugins/navigation_polygon_editor_plugin.h"
#include "editor/plugins/particles_2d_editor_plugin.h"
#include "editor/plugins/particles_editor_plugin.h"
#include "editor/plugins/path_2d_editor_plugin.h"
#include "editor/plugins/path_editor_plugin.h"
+#include "editor/plugins/physical_bone_plugin.h"
#include "editor/plugins/polygon_2d_editor_plugin.h"
#include "editor/plugins/resource_preloader_editor_plugin.h"
+#include "editor/plugins/root_motion_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/plugins/script_text_editor.h"
#include "editor/plugins/shader_editor_plugin.h"
#include "editor/plugins/shader_graph_editor_plugin.h"
#include "editor/plugins/skeleton_2d_editor_plugin.h"
+#include "editor/plugins/skeleton_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "editor/plugins/sprite_editor_plugin.h"
#include "editor/plugins/sprite_frames_editor_plugin.h"
@@ -190,6 +196,8 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
if (k.is_valid() && k->is_pressed() && !k->is_echo() && !gui_base->get_viewport()->gui_has_modal_stack()) {
+ EditorPlugin *old_editor = editor_plugin_screen;
+
if (ED_IS_SHORTCUT("editor/next_tab", p_event)) {
int next_tab = editor_data.get_edited_scene() + 1;
next_tab %= editor_data.get_edited_scene_count();
@@ -225,6 +233,10 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
_bottom_panel_switch(false, i);
}
}
+
+ if (old_editor != editor_plugin_screen) {
+ get_tree()->set_input_as_handled();
+ }
}
}
@@ -286,7 +298,6 @@ void EditorNode::_notification(int p_what) {
get_tree()->get_root()->set_as_audio_listener_2d(false);
get_tree()->set_auto_accept_quit(false);
get_tree()->connect("files_dropped", this, "_dropped_files");
- property_editable_warning->set_icon(gui_base->get_icon("NodeWarning", "EditorIcons"));
}
if (p_what == NOTIFICATION_EXIT_TREE) {
@@ -315,7 +326,7 @@ void EditorNode::_notification(int p_what) {
}
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ scene_tabs->set_tab_close_display_policy((bool(EDITOR_GET("interface/scene_tabs/always_show_close_button")) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
Ref<Theme> theme = create_editor_theme(theme_base->get_theme());
theme_base->set_theme(theme);
@@ -334,8 +345,8 @@ void EditorNode::_notification(int p_what) {
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
- if (bool(EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true))) {
- scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
+ if (EDITOR_GET("interface/scene_tabs/resize_if_many_tabs")) {
+ scene_tabs->set_min_width(int(EDITOR_GET("interface/scene_tabs/minimum_width")) * EDSCALE);
} else {
scene_tabs->set_min_width(0);
}
@@ -349,14 +360,20 @@ void EditorNode::_notification(int p_what) {
// update_icons
for (int i = 0; i < singleton->main_editor_buttons.size(); i++) {
- Ref<Texture> icon = singleton->main_editor_buttons[i]->get_icon();
+
+ ToolButton *tb = singleton->main_editor_buttons[i];
+ EditorPlugin *p_editor = singleton->editor_table[i];
+ Ref<Texture> icon = p_editor->get_icon();
if (icon.is_valid()) {
- main_editor_buttons[i]->set_icon(icon);
- } else if (singleton->gui_base->has_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons")) {
- main_editor_buttons[i]->set_icon(gui_base->get_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons"));
+ tb->set_icon(icon);
+ } else if (singleton->gui_base->has_icon(p_editor->get_name(), "EditorIcons")) {
+ tb->set_icon(singleton->gui_base->get_icon(p_editor->get_name(), "EditorIcons"));
}
}
+
+ _build_icon_type_cache();
+
play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons"));
play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons"));
play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons"));
@@ -367,21 +384,20 @@ void EditorNode::_notification(int p_what) {
distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
scene_tab_add->set_icon(gui_base->get_icon("Add", "EditorIcons"));
- resource_new_button->set_icon(gui_base->get_icon("New", "EditorIcons"));
- resource_load_button->set_icon(gui_base->get_icon("Load", "EditorIcons"));
- resource_save_button->set_icon(gui_base->get_icon("Save", "EditorIcons"));
-
- property_back->set_icon(gui_base->get_icon("Back", "EditorIcons"));
- property_forward->set_icon(gui_base->get_icon("Forward", "EditorIcons"));
- editor_history_menu->set_icon(gui_base->get_icon("History", "EditorIcons"));
-
- search_button->set_icon(gui_base->get_icon("Search", "EditorIcons"));
- object_menu->set_icon(gui_base->get_icon("Tools", "EditorIcons"));
// clear_button->set_icon(gui_base->get_icon("Close", "EditorIcons")); don't have access to that node. needs to become a class property
update_menu->set_icon(gui_base->get_icon("Collapse", "EditorIcons"));
dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons"));
dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons"));
update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
+
+ PopupMenu *p = help_menu->get_popup();
+ p->set_item_icon(p->get_item_index(HELP_CLASSES), gui_base->get_icon("ClassList", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_icon("HelpSearch", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_icon("Godot", "EditorIcons"));
}
if (p_what == Control::NOTIFICATION_RESIZED) {
@@ -448,25 +464,29 @@ void EditorNode::_fs_changed() {
preset.unref();
}
if (preset.is_null()) {
- String err = "Unknown export preset: " + export_defer.preset;
- ERR_PRINT(err.utf8().get_data());
+ String errstr = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINTS(errstr);
} else {
Ref<EditorExportPlatform> platform = preset->get_platform();
if (platform.is_null()) {
- String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
- ERR_PRINT(err.utf8().get_data());
+ String errstr = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINTS(errstr);
} else {
// ensures export_project does not loop infinitely, because notifications may
// come during the export
export_defer.preset = "";
- if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) {
+ Error err = OK;
+ if (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip")) {
if (export_defer.path.ends_with(".zip")) {
- platform->save_zip(preset, export_defer.path);
+ err = platform->export_zip(preset, export_defer.debug, export_defer.path);
} else if (export_defer.path.ends_with(".pck")) {
- platform->save_pack(preset, export_defer.path);
+ err = platform->export_pack(preset, export_defer.debug, export_defer.path);
}
} else {
- platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
+ err = platform->export_project(preset, export_defer.debug, export_defer.path);
+ }
+ if (err != OK) {
+ ERR_PRINTS(vformat(TTR("Project export failed with error code %d."), (int)err));
}
}
}
@@ -521,8 +541,8 @@ void EditorNode::_vp_resized() {
void EditorNode::_node_renamed() {
- if (property_editor)
- property_editor->update_tree();
+ if (get_inspector())
+ get_inspector()->update_tree();
}
void EditorNode::_editor_select_next() {
@@ -554,38 +574,16 @@ Error EditorNode::load_resource(const String &p_scene) {
RES res = ResourceLoader::load(p_scene);
ERR_FAIL_COND_V(!res.is_valid(), ERR_CANT_OPEN);
- edit_resource(res);
+ inspector_dock->edit_resource(res);
return OK;
}
-void EditorNode::edit_resource(const Ref<Resource> &p_resource) {
-
- _resource_selected(p_resource, "");
-}
-
void EditorNode::edit_node(Node *p_node) {
push_item(p_node);
}
-void EditorNode::open_resource(const String &p_type) {
-
- file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
-
- List<String> extensions;
- ResourceLoader::get_recognized_extensions_for_type(p_type, &extensions);
-
- file->clear_filters();
- for (int i = 0; i < extensions.size(); i++) {
-
- file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
- }
-
- file->popup_centered_ratio();
- current_option = RESOURCE_LOAD;
-}
-
void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path) {
editor_data.apply_changes_in_editors();
@@ -597,13 +595,13 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
if (err != OK) {
- accept->set_text(TTR("Error saving resource!"));
- accept->popup_centered_minsize();
+ show_accept(TTR("Error saving resource!"), TTR("I see..."));
return;
}
((Resource *)p_resource.ptr())->set_path(path);
emit_signal("resource_saved", p_resource);
+ editor_data.notify_resource_saved(p_resource);
}
void EditorNode::save_resource(const Ref<Resource> &p_resource) {
@@ -666,7 +664,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
file->set_current_path(existing);
}
file->popup_centered_ratio();
- file->set_title(TTR("Save Resource As.."));
+ file->set_title(TTR("Save Resource As..."));
}
void EditorNode::_menu_option(int p_option) {
@@ -683,26 +681,21 @@ void EditorNode::_dialog_display_save_error(String p_file, Error p_error) {
if (p_error) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
-
switch (p_error) {
case ERR_FILE_CANT_WRITE: {
- accept->set_text(TTR("Can't open file for writing:") + " " + p_file.get_extension());
+ show_accept(TTR("Can't open file for writing:") + " " + p_file.get_extension(), TTR("I see..."));
} break;
case ERR_FILE_UNRECOGNIZED: {
- accept->set_text(TTR("Requested file format unknown:") + " " + p_file.get_extension());
+ show_accept(TTR("Requested file format unknown:") + " " + p_file.get_extension(), TTR("I see..."));
} break;
default: {
- accept->set_text(TTR("Error while saving."));
+ show_accept(TTR("Error while saving."), TTR("I see..."));
} break;
}
-
- accept->popup_centered_minsize();
}
}
@@ -710,34 +703,29 @@ void EditorNode::_dialog_display_load_error(String p_file, Error p_error) {
if (p_error) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
-
switch (p_error) {
case ERR_CANT_OPEN: {
- accept->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_file.get_file()));
+ show_accept(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_file.get_file()), TTR("I see..."));
} break;
case ERR_PARSE_ERROR: {
- accept->set_text(vformat(TTR("Error while parsing '%s'."), p_file.get_file()));
+ show_accept(vformat(TTR("Error while parsing '%s'."), p_file.get_file()), TTR("I see..."));
} break;
case ERR_FILE_CORRUPT: {
- accept->set_text(vformat(TTR("Unexpected end of file '%s'."), p_file.get_file()));
+ show_accept(vformat(TTR("Unexpected end of file '%s'."), p_file.get_file()), TTR("I see..."));
} break;
case ERR_FILE_NOT_FOUND: {
- accept->set_text(vformat(TTR("Missing '%s' or its dependencies."), p_file.get_file()));
+ show_accept(vformat(TTR("Missing '%s' or its dependencies."), p_file.get_file()), TTR("I see..."));
} break;
default: {
- accept->set_text(vformat(TTR("Error while loading '%s'."), p_file.get_file()));
+ show_accept(vformat(TTR("Error while loading '%s'."), p_file.get_file()), TTR("I see..."));
} break;
}
-
- accept->popup_centered_minsize();
}
}
@@ -983,6 +971,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
String file = cache_base + ".png";
+ post_process_preview(img);
img->save_png(file);
}
@@ -997,10 +986,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
if (!scene) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("This operation can't be done without a tree root."));
- accept->popup_centered_minsize();
+ show_accept(TTR("This operation can't be done without a tree root."), TTR("I see..."));
return;
}
@@ -1028,10 +1014,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
if (err != OK) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."));
- accept->popup_centered_minsize();
+ show_accept(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."), TTR("I see..."));
return;
}
@@ -1039,10 +1022,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
// (hacky but needed for the tree to update properly)
Node *dummy_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
if (!dummy_scene) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."));
- accept->popup_centered_minsize();
+ show_accept(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."), TTR("I see..."));
return;
}
memdelete(dummy_scene);
@@ -1053,8 +1033,23 @@ void EditorNode::_save_scene(String p_file, int idx) {
flg |= ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS;
err = ResourceSaver::save(p_file, sdata, flg);
- Map<RES, bool> processed;
- _save_edited_subresources(scene, processed, flg);
+ //Map<RES, bool> processed;
+ //this method is slow and not always works, deprecating
+ //_save_edited_subresources(scene, processed, flg);
+ { //instead, just find globally unsaved subresources and save them
+
+ List<Ref<Resource> > cached;
+ ResourceCache::get_cached_resources(&cached);
+ for (List<Ref<Resource> >::Element *E = cached.front(); E; E = E->next()) {
+
+ Ref<Resource> res = E->get();
+ if (res->is_edited() && res->get_path().is_resource_file()) {
+ ResourceSaver::save(res->get_path(), res, flg);
+ res->set_edited(false);
+ }
+ }
+ }
+
editor_data.save_editor_external_data();
if (err == OK) {
scene->set_filename(ProjectSettings::get_singleton()->localize_path(p_file));
@@ -1111,20 +1106,6 @@ void EditorNode::_mark_unsaved_scenes() {
void EditorNode::_dialog_action(String p_file) {
switch (current_option) {
-
- case RESOURCE_LOAD: {
-
- RES res = ResourceLoader::load(p_file);
- if (res.is_null()) {
-
- current_option = -1;
- accept->get_ok()->set_text("Ugh");
- accept->set_text(TTR("Failed to load resource."));
- return;
- };
-
- push_item(res.operator->());
- } break;
case FILE_NEW_INHERITED_SCENE: {
load_scene(p_file, false, true);
@@ -1177,10 +1158,7 @@ void EditorNode::_dialog_action(String p_file) {
ml = ResourceLoader::load(p_file, "MeshLibrary");
if (ml.is_null()) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Can't load MeshLibrary for merging!"));
- accept->popup_centered_minsize();
+ show_accept(TTR("Can't load MeshLibrary for merging!"), TTR("I see..."));
return;
}
}
@@ -1193,44 +1171,32 @@ void EditorNode::_dialog_action(String p_file) {
Error err = ResourceSaver::save(p_file, ml);
if (err) {
-
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Error saving MeshLibrary!"));
- accept->popup_centered_minsize();
+ show_accept(TTR("Error saving MeshLibrary!"), TTR("I see..."));
return;
}
} break;
case FILE_EXPORT_TILESET: {
- Ref<TileSet> ml;
- if (FileAccess::exists(p_file)) {
- ml = ResourceLoader::load(p_file, "TileSet");
+ Ref<TileSet> tileset;
+ if (FileAccess::exists(p_file) && file_export_lib_merge->is_pressed()) {
+ tileset = ResourceLoader::load(p_file, "TileSet");
- if (ml.is_null()) {
- if (file_export_lib_merge->is_pressed()) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Can't load TileSet for merging!"));
- accept->popup_centered_minsize();
- return;
- }
- } else if (!file_export_lib_merge->is_pressed()) {
- ml->clear();
+ if (tileset.is_null()) {
+ show_accept(TTR("Can't load TileSet for merging!"), TTR("I see..."));
+ return;
}
} else {
- ml = Ref<TileSet>(memnew(TileSet));
+ tileset = Ref<TileSet>(memnew(TileSet));
}
- TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true);
+ TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), tileset, true);
- Error err = ResourceSaver::save(p_file, ml);
+ Error err = ResourceSaver::save(p_file, tileset);
if (err) {
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Error saving TileSet!"));
- accept->popup_centered_minsize();
+ show_accept("Error saving TileSet!", "I see...");
return;
}
} break;
@@ -1317,10 +1283,34 @@ void EditorNode::_dialog_action(String p_file) {
}
}
-void EditorNode::push_item(Object *p_object, const String &p_property) {
+bool EditorNode::item_has_editor(Object *p_object) {
+
+ return editor_data.get_subeditors(p_object).size() > 0;
+}
+
+void EditorNode::edit_item(Object *p_object) {
+
+ Vector<EditorPlugin *> sub_plugins;
+
+ if (p_object) {
+ sub_plugins = editor_data.get_subeditors(p_object);
+ }
+
+ if (!sub_plugins.empty()) {
+ _display_top_editors(false);
+
+ _set_top_editors(sub_plugins);
+ _set_editing_top_editors(p_object);
+ _display_top_editors(true);
+ } else {
+ _hide_top_editors();
+ }
+}
+
+void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
if (!p_object) {
- property_editor->edit(NULL);
+ get_inspector()->edit(NULL);
node_dock->set_node(NULL);
scene_tree_dock->set_selected(NULL);
return;
@@ -1329,7 +1319,9 @@ void EditorNode::push_item(Object *p_object, const String &p_property) {
uint32_t id = p_object->get_instance_id();
if (id != editor_history.get_current()) {
- if (p_property == "")
+ if (p_inspector_only) {
+ editor_history.add_object_inspector_only(id);
+ } else if (p_property == "")
editor_history.add_object(id);
else
editor_history.add_object(id, p_property);
@@ -1338,89 +1330,6 @@ void EditorNode::push_item(Object *p_object, const String &p_property) {
_edit_current();
}
-void EditorNode::_select_history(int p_idx) {
-
- //push it to the top, it is not correct, but it's more useful
- ObjectID id = editor_history.get_history_obj(p_idx);
- Object *obj = ObjectDB::get_instance(id);
- if (!obj)
- return;
- push_item(obj);
-}
-
-void EditorNode::_prepare_history() {
-
- int history_to = MAX(0, editor_history.get_history_len() - 25);
-
- editor_history_menu->get_popup()->clear();
-
- Ref<Texture> base_icon = gui_base->get_icon("Object", "EditorIcons");
- Set<ObjectID> already;
- for (int i = editor_history.get_history_len() - 1; i >= history_to; i--) {
-
- ObjectID id = editor_history.get_history_obj(i);
- Object *obj = ObjectDB::get_instance(id);
- if (!obj || already.has(id)) {
- if (history_to > 0) {
- history_to--;
- }
- continue;
- }
-
- already.insert(id);
-
- Ref<Texture> icon = gui_base->get_icon("Object", "EditorIcons");
- if (gui_base->has_icon(obj->get_class(), "EditorIcons"))
- icon = gui_base->get_icon(obj->get_class(), "EditorIcons");
- else
- icon = base_icon;
-
- String text;
- if (Object::cast_to<Resource>(obj)) {
- Resource *r = Object::cast_to<Resource>(obj);
- if (r->get_path().is_resource_file())
- text = r->get_path().get_file();
- else if (r->get_name() != String()) {
- text = r->get_name();
- } else {
- text = r->get_class();
- }
- } else if (Object::cast_to<Node>(obj)) {
- text = Object::cast_to<Node>(obj)->get_name();
- } else if (obj->is_class("ScriptEditorDebuggerInspectedObject")) {
- text = obj->call("get_title");
- } else {
- text = obj->get_class();
- }
-
- if (i == editor_history.get_history_pos()) {
- text = "[" + text + "]";
- }
- editor_history_menu->get_popup()->add_icon_item(icon, text, i);
- }
-}
-
-void EditorNode::_property_editor_forward() {
-
- if (editor_history.next())
- _edit_current();
-}
-void EditorNode::_property_editor_back() {
-
- if (editor_history.previous() || editor_history.get_path_size() == 1)
- _edit_current();
-}
-
-void EditorNode::_menu_collapseall() {
-
- property_editor->collapse_all_folding();
-}
-
-void EditorNode::_menu_expandall() {
-
- property_editor->expand_all_folding();
-}
-
void EditorNode::_save_default_environment() {
Ref<Environment> fallback = get_tree()->get_root()->get_world()->get_fallback_environment();
@@ -1461,52 +1370,40 @@ static bool overrides_external_editor(Object *p_object) {
return script->get_language()->overrides_external_editor();
}
-void EditorNode::_property_editable_warning_pressed() {
-
- property_editable_warning_dialog->popup_centered_minsize();
-}
-
void EditorNode::_edit_current() {
uint32_t current = editor_history.get_current();
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- property_back->set_disabled(editor_history.is_at_beginning());
- property_forward->set_disabled(editor_history.is_at_end());
+ bool inspector_only = editor_history.is_current_inspector_only();
this->current = current_obj;
- editor_path->update_path();
-
- String editable_warning; //none by default
- property_editable_warning->hide(); //hide by default
if (!current_obj) {
scene_tree_dock->set_selected(NULL);
- property_editor->edit(NULL);
+ get_inspector()->edit(NULL);
node_dock->set_node(NULL);
- object_menu->set_disabled(true);
+ inspector_dock->update(NULL);
_display_top_editors(false);
return;
}
- object_menu->set_disabled(true);
-
- bool capitalize = bool(EDITOR_DEF("interface/editor/capitalize_properties", true));
+ bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties"));
+ bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding"));
bool is_resource = current_obj->is_class("Resource");
bool is_node = current_obj->is_class("Node");
- resource_save_button->set_disabled(!is_resource);
+
+ String editable_warning; //none by default
if (is_resource) {
Resource *current_res = Object::cast_to<Resource>(current_obj);
ERR_FAIL_COND(!current_res);
scene_tree_dock->set_selected(NULL);
- property_editor->edit(current_res);
+ get_inspector()->edit(current_res);
node_dock->set_node(NULL);
- object_menu->set_disabled(false);
EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path());
int subr_idx = current_res->get_path().find("::");
@@ -1529,7 +1426,7 @@ void EditorNode::_edit_current() {
Node *current_node = Object::cast_to<Node>(current_obj);
ERR_FAIL_COND(!current_node);
- property_editor->edit(current_node);
+ get_inspector()->edit(current_node);
if (current_node->is_inside_tree()) {
node_dock->set_node(current_node);
scene_tree_dock->set_selected(current_node);
@@ -1537,7 +1434,6 @@ void EditorNode::_edit_current() {
node_dock->set_node(NULL);
scene_tree_dock->set_selected(NULL);
}
- object_menu->get_popup()->clear();
if (get_edited_scene() && get_edited_scene()->get_filename() != String()) {
String source_scene = get_edited_scene()->get_filename();
@@ -1551,144 +1447,83 @@ void EditorNode::_edit_current() {
if (current_obj->is_class("ScriptEditorDebuggerInspectedObject")) {
editable_warning = TTR("This is a remote object so changes to it will not be kept.\nPlease read the documentation relevant to debugging to better understand this workflow.");
capitalize = false;
+ disable_folding = true;
}
- property_editor->edit(current_obj);
+ get_inspector()->edit(current_obj);
node_dock->set_node(NULL);
}
- if (editable_warning != String()) {
- property_editable_warning->show(); //hide by default
- property_editable_warning_dialog->set_text(editable_warning);
+ inspector_dock->set_warning(editable_warning);
+
+ if (get_inspector()->is_capitalize_paths_enabled() != capitalize) {
+ get_inspector()->set_enable_capitalize_paths(capitalize);
}
- if (property_editor->is_capitalize_paths_enabled() != capitalize) {
- property_editor->set_enable_capitalize_paths(capitalize);
+ if (get_inspector()->is_using_folding() == disable_folding) {
+ get_inspector()->set_use_folding(!disable_folding);
}
/* Take care of PLUGIN EDITOR */
- EditorPlugin *main_plugin = editor_data.get_editor(current_obj);
-
- if (main_plugin) {
-
- // special case if use of external editor is true
- if (main_plugin->get_name() == "Script" && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
- main_plugin->edit(current_obj);
- }
-
- else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
- // update screen main_plugin
-
- if (!changing_scene) {
-
- if (editor_plugin_screen)
- editor_plugin_screen->make_visible(false);
- editor_plugin_screen = main_plugin;
- editor_plugin_screen->edit(current_obj);
-
- editor_plugin_screen->make_visible(true);
+ if (!inspector_only) {
- int plugin_count = editor_data.get_editor_plugin_count();
- for (int i = 0; i < plugin_count; i++) {
- editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
- }
+ EditorPlugin *main_plugin = editor_data.get_editor(current_obj);
- for (int i = 0; i < editor_table.size(); i++) {
+ if (main_plugin) {
- main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin);
- }
+ // special case if use of external editor is true
+ if (main_plugin->get_name() == "Script" && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
+ if (!changing_scene)
+ main_plugin->edit(current_obj);
}
- } else {
-
- editor_plugin_screen->edit(current_obj);
- }
- }
-
- Vector<EditorPlugin *> sub_plugins = editor_data.get_subeditors(current_obj);
+ else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
+ // update screen main_plugin
- if (!sub_plugins.empty()) {
- _display_top_editors(false);
+ if (!changing_scene) {
- _set_top_editors(sub_plugins);
- _set_editing_top_editors(current_obj);
- _display_top_editors(true);
+ if (editor_plugin_screen)
+ editor_plugin_screen->make_visible(false);
+ editor_plugin_screen = main_plugin;
+ editor_plugin_screen->edit(current_obj);
- } else if (!editor_plugins_over->get_plugins_list().empty()) {
+ editor_plugin_screen->make_visible(true);
- _hide_top_editors();
- }
-
- object_menu->set_disabled(false);
-
- PopupMenu *p = object_menu->get_popup();
-
- p->clear();
- p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand all properties")), EXPAND_ALL);
- p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse all properties")), COLLAPSE_ALL);
- p->add_separator();
- p->add_shortcut(ED_SHORTCUT("property_editor/copy_params", TTR("Copy Params")), OBJECT_COPY_PARAMS);
- p->add_shortcut(ED_SHORTCUT("property_editor/paste_params", TTR("Paste Params")), OBJECT_PASTE_PARAMS);
- p->add_separator();
- p->add_shortcut(ED_SHORTCUT("property_editor/paste_resource", TTR("Paste Resource")), RESOURCE_PASTE);
- if (is_resource) {
- p->add_shortcut(ED_SHORTCUT("property_editor/copy_resource", TTR("Copy Resource")), RESOURCE_COPY);
- p->add_shortcut(ED_SHORTCUT("property_editor/unref_resource", TTR("Make Built-In")), RESOURCE_UNREF);
- }
-
- if (is_resource || is_node) {
- p->add_separator();
- p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
- p->add_separator();
- p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
- }
+ int plugin_count = editor_data.get_editor_plugin_count();
+ for (int i = 0; i < plugin_count; i++) {
+ editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
+ }
- List<MethodInfo> methods;
- current_obj->get_method_list(&methods);
+ for (int i = 0; i < editor_table.size(); i++) {
- if (!methods.empty()) {
+ main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin);
+ }
+ }
- bool found = false;
- List<MethodInfo>::Element *I = methods.front();
- int i = 0;
- while (I) {
+ } else {
- if (I->get().flags & METHOD_FLAG_EDITOR) {
- if (!found) {
- p->add_separator();
- found = true;
- }
- p->add_item(I->get().name.capitalize(), OBJECT_METHOD_BASE + i);
+ editor_plugin_screen->edit(current_obj);
}
- i++;
- I = I->next();
}
- }
- update_keying();
-}
+ Vector<EditorPlugin *> sub_plugins = editor_data.get_subeditors(current_obj);
-void EditorNode::_resource_created() {
+ if (!sub_plugins.empty()) {
+ _display_top_editors(false);
- Object *c = create_dialog->instance_selected();
+ _set_top_editors(sub_plugins);
+ _set_editing_top_editors(current_obj);
+ _display_top_editors(true);
- ERR_FAIL_COND(!c);
- Resource *r = Object::cast_to<Resource>(c);
- ERR_FAIL_COND(!r);
-
- REF res(r);
-
- push_item(c);
-}
+ } else if (!editor_plugins_over->get_plugins_list().empty()) {
-void EditorNode::_resource_selected(const RES &p_res, const String &p_property) {
-
- if (p_res.is_null())
- return;
+ _hide_top_editors();
+ }
+ }
- RES r = p_res;
- push_item(r.operator->(), p_property);
+ inspector_dock->update(current_obj);
+ inspector_dock->update_keying();
}
void EditorNode::_run(bool p_current, const String &p_custom) {
@@ -1715,10 +1550,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
Node *scene = editor_data.get_edited_scene_root();
if (!scene) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("There is no defined scene to run."));
- accept->popup_centered_minsize();
+ show_accept(TTR("There is no defined scene to run."), TTR("I see..."));
return;
}
@@ -1762,7 +1594,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
}
}
- if (bool(EDITOR_DEF("run/auto_save/save_before_running", true))) {
+ if (bool(EDITOR_GET("run/auto_save/save_before_running"))) {
if (unsaved_cache) {
@@ -1772,10 +1604,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (scene->get_filename() == "") {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Current scene was never saved, please save it prior to running."));
- accept->popup_centered_minsize();
+ show_accept(TTR("Current scene was never saved, please save it prior to running."), TTR("I see..."));
return;
}
@@ -1789,11 +1618,11 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (!call_build())
return;
- if (bool(EDITOR_DEF("run/output/always_clear_output_on_play", true))) {
+ if (bool(EDITOR_GET("run/output/always_clear_output_on_play"))) {
log->clear();
}
- if (bool(EDITOR_DEF("run/output/always_open_output_on_play", true))) {
+ if (bool(EDITOR_GET("run/output/always_open_output_on_play"))) {
make_bottom_panel_item_visible(log);
}
@@ -1806,10 +1635,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (error != OK) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Could not start subprocess!"));
- accept->popup_centered_minsize();
+ show_accept(TTR("Could not start subprocess!"), TTR("I see..."));
return;
}
@@ -1867,13 +1693,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case FILE_QUICK_OPEN_SCENE: {
quick_open->popup("PackedScene", true);
- quick_open->set_title(TTR("Quick Open Scene.."));
+ quick_open->set_title(TTR("Quick Open Scene..."));
} break;
case FILE_QUICK_OPEN_SCRIPT: {
quick_open->popup("Script", true);
- quick_open->set_title(TTR("Quick Open Script.."));
+ quick_open->set_title(TTR("Quick Open Script..."));
} break;
case FILE_OPEN_PREV: {
@@ -1927,10 +1753,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!scene) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("This operation can't be done without a tree root."));
- accept->popup_centered_minsize();
+ show_accept(TTR("This operation can't be done without a tree root."), TTR("I see..."));
break;
}
@@ -1963,7 +1786,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->set_current_path(existing);
}
file->popup_centered_ratio();
- file->set_title(TTR("Save Scene As.."));
+ file->set_title(TTR("Save Scene As..."));
} break;
@@ -1993,10 +1816,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!editor_data.get_edited_scene_root()) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("This operation can't be done without a scene."));
- accept->popup_centered_minsize();
+ show_accept(TTR("This operation can't be done without a scene."), TTR("I see..."));
break;
}
@@ -2016,10 +1836,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
//Make sure that the scene has a root before trying to convert to tileset
if (!editor_data.get_edited_scene_root()) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("This operation can't be done without a root node."));
- accept->popup_centered_minsize();
+ show_accept(TTR("This operation can't be done without a root node."), TTR("I see..."));
break;
}
@@ -2044,10 +1861,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (!editor_data.get_edited_scene_root()) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("This operation can't be done without a selected node."));
- accept->popup_centered_minsize();
+ show_accept(TTR("This operation can't be done without a selected node."), TTR("I see..."));
break;
}
@@ -2077,29 +1891,29 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case EDIT_UNDO: {
if (Input::get_singleton()->get_mouse_button_mask() & 0x7) {
- break; // can't undo while mouse buttons are pressed
- }
-
- String action = editor_data.get_undo_redo().get_current_action_name();
- if (action != "")
- log->add_message("UNDO: " + action);
+ log->add_message("Can't UNDO while mouse buttons are pressed.");
+ } else {
+ String action = editor_data.get_undo_redo().get_current_action_name();
- editor_data.get_undo_redo().undo();
+ if (!editor_data.get_undo_redo().undo()) {
+ log->add_message("There is nothing to UNDO.");
+ } else if (action != "") {
+ log->add_message("UNDO: " + action);
+ }
+ }
} break;
case EDIT_REDO: {
- if (Input::get_singleton()->get_mouse_button_mask() & 0x7)
- break; // can't redo while mouse buttons are pressed
-
- editor_data.get_undo_redo().redo();
- String action = editor_data.get_undo_redo().get_current_action_name();
- if (action != "")
- log->add_message("REDO: " + action);
-
- } break;
- case TOOLS_ORPHAN_RESOURCES: {
-
- orphan_resources->show();
+ if (Input::get_singleton()->get_mouse_button_mask() & 0x7) {
+ log->add_message("Can't REDO while mouse buttons are pressed.");
+ } else {
+ if (!editor_data.get_undo_redo().redo()) {
+ log->add_message("There is nothing to REDO.");
+ } else {
+ String action = editor_data.get_undo_redo().get_current_action_name();
+ log->add_message("REDO: " + action);
+ }
+ }
} break;
case EDIT_REVERT: {
@@ -2133,136 +1947,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
scene_tabs->set_current_tab(cur_idx);
} break;
- case RESOURCE_NEW: {
-
- create_dialog->popup_create(true);
- } break;
- case RESOURCE_LOAD: {
-
- open_resource();
- } break;
- case RESOURCE_SAVE: {
-
- uint32_t current = editor_history.get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
-
- RES current_res = RES(Object::cast_to<Resource>(current_obj));
-
- save_resource(current_res);
-
- } break;
- case RESOURCE_SAVE_AS: {
-
- uint32_t current = editor_history.get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
-
- RES current_res = RES(Object::cast_to<Resource>(current_obj));
-
- save_resource_as(current_res);
-
- } break;
- case RESOURCE_UNREF: {
-
- uint32_t current = editor_history.get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
-
- RES current_res = RES(Object::cast_to<Resource>(current_obj));
- current_res->set_path("");
- _edit_current();
- } break;
- case RESOURCE_COPY: {
-
- uint32_t current = editor_history.get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
-
- RES current_res = RES(Object::cast_to<Resource>(current_obj));
-
- EditorSettings::get_singleton()->set_resource_clipboard(current_res);
-
- } break;
- case RESOURCE_PASTE: {
-
- RES r = EditorSettings::get_singleton()->get_resource_clipboard();
- if (r.is_valid()) {
- push_item(EditorSettings::get_singleton()->get_resource_clipboard().ptr(), String());
- }
-
- } break;
- case OBJECT_REQUEST_HELP: {
-
- if (current) {
- _editor_select(EDITOR_SCRIPT);
- emit_signal("request_help", current->get_class());
- }
-
- } break;
- case OBJECT_COPY_PARAMS: {
-
- editor_data.apply_changes_in_editors();
- if (current)
- editor_data.copy_object_params(current);
- } break;
- case OBJECT_PASTE_PARAMS: {
-
- editor_data.apply_changes_in_editors();
- if (current)
- editor_data.paste_object_params(current);
- editor_data.get_undo_redo().clear_history();
- } break;
- case OBJECT_UNIQUE_RESOURCES: {
-
- editor_data.apply_changes_in_editors();
- if (current) {
- List<PropertyInfo> props;
- current->get_property_list(&props);
- Map<RES, RES> duplicates;
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
- if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
- continue;
-
- Variant v = current->get(E->get().name);
- if (v.is_ref()) {
- REF ref = v;
- if (ref.is_valid()) {
-
- RES res = ref;
- if (res.is_valid()) {
-
- if (!duplicates.has(res)) {
- duplicates[res] = res->duplicate();
- }
- res = duplicates[res];
-
- current->set(E->get().name, res);
- }
- }
- }
- }
- }
-
- editor_data.get_undo_redo().clear_history();
-
- _set_editing_top_editors(NULL);
- _set_editing_top_editors(current);
-
- } break;
- case COLLAPSE_ALL: {
- _menu_collapseall();
-
- } break;
- case EXPAND_ALL: {
- _menu_expandall();
-
- } break;
case RUN_PLAY: {
_menu_option_confirm(RUN_STOP, true);
_run(false);
@@ -2272,7 +1956,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (run_custom_filename.empty() || editor_run.get_status() == EditorRun::STATUS_STOP) {
_menu_option_confirm(RUN_STOP, true);
quick_run->popup("PackedScene", true);
- quick_run->set_title(TTR("Quick Run Scene.."));
+ quick_run->set_title(TTR("Quick Run Scene..."));
play_custom_scene_button->set_pressed(false);
} else {
String last_custom_scene = run_custom_filename;
@@ -2296,7 +1980,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons"));
stop_button->set_disabled(true);
- if (bool(EDITOR_DEF("run/output/always_close_output_on_stop", true))) {
+ if (bool(EDITOR_GET("run/output/always_close_output_on_stop"))) {
for (int i = 0; i < bottom_panel_items.size(); i++) {
if (bottom_panel_items[i].control == log) {
_bottom_panel_switch(false, i);
@@ -2316,7 +2000,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_PLAY_NATIVE: {
- bool autosave = EDITOR_DEF("run/auto_save/save_before_running", true);
+ bool autosave = EDITOR_GET("run/auto_save/save_before_running");
if (autosave) {
_menu_option_confirm(FILE_SAVE_ALL_SCENES, false);
}
@@ -2342,10 +2026,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PROJECT_MANAGER: {
if (!p_confirmed) {
- bool save_each = EDITOR_DEF("interface/editor/save_each_scene_on_quit", true);
+ bool save_each = EDITOR_GET("interface/editor/save_each_scene_on_quit");
if (_next_unsaved_scene(!save_each) == -1) {
- bool confirm = EDITOR_DEF("interface/editor/quit_confirmation", true);
+ bool confirm = EDITOR_GET("interface/editor/quit_confirmation");
if (confirm) {
confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
@@ -2450,10 +2134,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
OS::get_singleton()->set_low_processor_usage_mode(false);
EditorSettings::get_singleton()->set_project_metadata("editor_options", "update_always", true);
- current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("This option is deprecated. Situations where refresh must be forced are now considered a bug. Please report."));
- accept->popup_centered_minsize();
+ show_accept(TTR("This option is deprecated. Situations where refresh must be forced are now considered a bug. Please report."), TTR("I see..."));
} break;
case SETTINGS_UPDATE_CHANGES: {
@@ -2478,7 +2159,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
export_template_manager->popup_manager();
} break;
- case SETTINGS_TOGGLE_FULLSCREN: {
+ case SETTINGS_TOGGLE_FULLSCREEN: {
OS::get_singleton()->set_window_fullscreen(!OS::get_singleton()->is_window_fullscreen());
@@ -2525,27 +2206,36 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
default: {
-
- if (p_option >= OBJECT_METHOD_BASE) {
-
- ERR_FAIL_COND(!current);
-
- int idx = p_option - OBJECT_METHOD_BASE;
-
- List<MethodInfo> methods;
- current->get_method_list(&methods);
-
- ERR_FAIL_INDEX(idx, methods.size());
- String name = methods[idx].name;
-
- if (current)
- current->call(name);
- } else if (p_option >= IMPORT_PLUGIN_BASE) {
+ if (p_option >= IMPORT_PLUGIN_BASE) {
}
}
}
}
+void EditorNode::_tool_menu_option(int p_idx) {
+ switch (tool_menu->get_item_id(p_idx)) {
+ case TOOLS_ORPHAN_RESOURCES: {
+ orphan_resources->show();
+ } break;
+ case TOOLS_CUSTOM: {
+ if (tool_menu->get_item_submenu(p_idx) == "") {
+ Array params = tool_menu->get_item_metadata(p_idx);
+
+ Object *handler = ObjectDB::get_instance(params[0]);
+ String callback = params[1];
+ Variant *ud = &params[2];
+ Variant::CallError ce;
+
+ handler->call(callback, (const Variant **)&ud, 1, ce);
+ if (ce.error != Variant::CallError::CALL_OK) {
+ String err = Variant::get_call_error_text(handler, callback, (const Variant **)&ud, 1, ce);
+ ERR_PRINTS("Error calling function from tool menu: " + err);
+ }
+ } // else it's a submenu so don't do anything.
+ } break;
+ }
+}
+
int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
for (int i = p_start; i < editor_data.get_edited_scene_count(); i++) {
@@ -2886,7 +2576,7 @@ Dictionary EditorNode::_get_main_scene_state() {
Dictionary state;
state["main_tab"] = _get_current_main_editor();
state["scene_tree_offset"] = scene_tree_dock->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->get_value();
- state["property_edit_offset"] = get_property_editor()->get_scene_tree()->get_vscroll_bar()->get_value();
+ state["property_edit_offset"] = get_inspector()->get_scroll_offset();
state["saved_version"] = saved_version;
state["node_filter"] = scene_tree_dock->get_filter();
return state;
@@ -2932,7 +2622,7 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
if (p_state.has("scene_tree_offset"))
scene_tree_dock->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->set_value(p_state["scene_tree_offset"]);
if (p_state.has("property_edit_offset"))
- get_property_editor()->get_scene_tree()->get_vscroll_bar()->set_value(p_state["property_edit_offset"]);
+ get_inspector()->set_scroll_offset(p_state["property_edit_offset"]);
if (p_state.has("node_filter"))
scene_tree_dock->set_filter(p_state["node_filter"]);
@@ -3043,10 +2733,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
if (!lpath.begins_with("res://")) {
- current_option = -1;
- accept->get_ok()->set_text(TTR("Ugh"));
- accept->set_text(TTR("Error loading scene, it must be inside the project path. Use 'Import' to open the scene, then save it inside the project path."));
- accept->popup_centered_minsize();
+ show_accept(TTR("Error loading scene, it must be inside the project path. Use 'Import' to open the scene, then save it inside the project path."), TTR("Ugh"));
opening_prev = false;
return ERR_FILE_NOT_FOUND;
}
@@ -3190,44 +2877,14 @@ SceneTreeDock *EditorNode::get_scene_tree_dock() {
return scene_tree_dock;
}
+InspectorDock *EditorNode::get_inspector_dock() {
-void EditorNode::_instance_request(const Vector<String> &p_files) {
-
- request_instance_scenes(p_files);
-}
-
-void EditorNode::_property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance) {
-
- AnimationPlayerEditor::singleton->get_key_editor()->insert_value_key(p_keyed, p_value, p_advance);
-}
-
-void EditorNode::_transform_keyed(Object *sp, const String &p_sub, const Transform &p_key) {
-
- Spatial *s = Object::cast_to<Spatial>(sp);
- if (!s)
- return;
- AnimationPlayerEditor::singleton->get_key_editor()->insert_transform_key(s, p_sub, p_key);
+ return inspector_dock;
}
-void EditorNode::update_keying() {
-
- bool valid = false;
-
- if (AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
-
- if (editor_history.get_path_size() >= 1) {
-
- Object *obj = ObjectDB::get_instance(editor_history.get_path_object(0));
- if (Object::cast_to<Node>(obj)) {
-
- valid = true;
- }
- }
- }
-
- property_editor->set_keying(valid);
+void EditorNode::_instance_request(const Vector<String> &p_files) {
- AnimationPlayerEditor::singleton->get_key_editor()->update_keying();
+ request_instance_scenes(p_files);
}
void EditorNode::_close_messages() {
@@ -3372,6 +3029,10 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorExportPlugin>();
ClassDB::register_class<EditorResourceConversionPlugin>();
ClassDB::register_class<EditorSceneImporter>();
+ ClassDB::register_class<EditorInspector>();
+ ClassDB::register_class<EditorInspectorPlugin>();
+ ClassDB::register_class<EditorProperty>();
+ ClassDB::register_class<AnimationTrackEditPlugin>();
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
ClassDB::register_class<EditorScenePostImport>();
@@ -3441,6 +3102,19 @@ Ref<Texture> EditorNode::_file_dialog_get_icon(const String &p_path) {
return singleton->icon_type_cache["Object"];
}
+void EditorNode::_build_icon_type_cache() {
+
+ List<StringName> tl;
+ StringName ei = "EditorIcons";
+ theme_base->get_theme()->get_icon_list(ei, &tl);
+ for (List<StringName>::Element *E = tl.front(); E; E = E->next()) {
+
+ if (!ClassDB::class_exists(E->get()))
+ continue;
+ icon_type_cache[E->get()] = theme_base->get_theme()->get_icon(E->get(), ei);
+ }
+}
+
void EditorNode::_file_dialog_register(FileDialog *p_dialog) {
singleton->file_dialogs.insert(p_dialog);
@@ -3473,6 +3147,13 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo
return OK;
}
+void EditorNode::show_accept(const String &p_text, const String &p_title) {
+ current_option = -1;
+ accept->get_ok()->set_text(p_title);
+ accept->set_text(p_text);
+ accept->popup_centered_minsize();
+}
+
void EditorNode::show_warning(const String &p_text, const String &p_title) {
warning->set_text(p_text);
@@ -3829,6 +3510,53 @@ void EditorNode::_update_dock_slots_visibility() {
}
}
+void EditorNode::_dock_tab_changed(int p_tab) {
+
+ // update visibility but dont set current tab
+ VSplitContainer *splits[DOCK_SLOT_MAX / 2] = {
+ left_l_vsplit,
+ left_r_vsplit,
+ right_l_vsplit,
+ right_r_vsplit,
+ };
+
+ if (!docks_visible) {
+
+ for (int i = 0; i < DOCK_SLOT_MAX; i++) {
+ dock_slot[i]->hide();
+ }
+
+ for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
+ splits[i]->hide();
+ }
+
+ right_hsplit->hide();
+ bottom_panel->hide();
+ } else {
+ for (int i = 0; i < DOCK_SLOT_MAX; i++) {
+
+ if (dock_slot[i]->get_tab_count())
+ dock_slot[i]->show();
+ else
+ dock_slot[i]->hide();
+ }
+
+ for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
+ bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
+ if (in_use)
+ splits[i]->show();
+ else
+ splits[i]->hide();
+ }
+ bottom_panel->show();
+
+ if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible())
+ right_hsplit->show();
+ else
+ right_hsplit->hide();
+ }
+}
+
void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String &p_section) {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
@@ -3929,7 +3657,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
}
void EditorNode::_load_open_scenes_from_config(Ref<ConfigFile> p_layout, const String &p_section) {
- if (!bool(EDITOR_DEF("interface/scene_tabs/restore_scenes_on_load", false))) {
+ if (!bool(EDITOR_GET("interface/scene_tabs/restore_scenes_on_load"))) {
return;
}
@@ -4023,7 +3751,7 @@ void EditorNode::_scene_tab_script_edited(int p_tab) {
Ref<Script> script = editor_data.get_scene_root_script(p_tab);
if (script.is_valid())
- edit_resource(script);
+ inspector_dock->edit_resource(script);
}
void EditorNode::_scene_tab_closed(int p_tab) {
@@ -4051,7 +3779,7 @@ void EditorNode::_scene_tab_closed(int p_tab) {
}
void EditorNode::_scene_tab_hover(int p_tab) {
- if (bool(EDITOR_DEF("interface/scene_tabs/show_thumbnail_on_hover", true)) == false) {
+ if (bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover")) == false) {
return;
}
int current_tab = scene_tabs->get_current_tab();
@@ -4121,30 +3849,6 @@ void EditorNode::_scene_tab_changed(int p_tab) {
editor_data.get_undo_redo().commit_action();
}
-void EditorNode::_toggle_search_bar(bool p_pressed) {
-
- property_editor->set_use_filter(p_pressed);
-
- if (p_pressed) {
-
- search_bar->show();
- search_box->grab_focus();
- search_box->select_all();
- } else {
-
- search_bar->hide();
- }
-}
-
-void EditorNode::_clear_search_box() {
-
- if (search_box->get_text() == "")
- return;
-
- search_box->clear();
- property_editor->update_tree();
-}
-
ToolButton *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) {
ToolButton *tb = memnew(ToolButton);
@@ -4425,6 +4129,45 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Control *
return drag_data;
}
+void EditorNode::add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud) {
+ ERR_FAIL_NULL(p_handler);
+ int idx = tool_menu->get_item_count();
+ tool_menu->add_item(p_name, TOOLS_CUSTOM);
+
+ Array parameters;
+ parameters.push_back(p_handler->get_instance_id());
+ parameters.push_back(p_callback);
+ parameters.push_back(p_ud);
+
+ tool_menu->set_item_metadata(idx, parameters);
+}
+
+void EditorNode::add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu) {
+ ERR_FAIL_NULL(p_submenu);
+ ERR_FAIL_COND(p_submenu->get_parent() != NULL);
+
+ tool_menu->add_child(p_submenu);
+ tool_menu->add_submenu_item(p_name, p_submenu->get_name(), TOOLS_CUSTOM);
+}
+
+void EditorNode::remove_tool_menu_item(const String &p_name) {
+ for (int i = 0; i < tool_menu->get_item_count(); i++) {
+ if (tool_menu->get_item_id(i) != TOOLS_CUSTOM)
+ continue;
+
+ if (tool_menu->get_item_text(i) == p_name) {
+ if (tool_menu->get_item_submenu(i) != "") {
+ Node *n = tool_menu->get_node(tool_menu->get_item_submenu(i));
+ tool_menu->remove_child(n);
+ memdelete(n);
+ }
+ tool_menu->remove_item(i);
+ tool_menu->set_as_minsize();
+ return;
+ }
+ }
+}
+
void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) {
String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_current_path());
@@ -4529,12 +4272,21 @@ EditorBuildCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS]
bool EditorNode::call_build() {
- for (int i = 0; i < build_callback_count; i++) {
- if (!build_callbacks[i]())
- return false;
+ bool builds_successful = true;
+
+ for (int i = 0; i < build_callback_count && builds_successful; i++) {
+ if (!build_callbacks[i]()) {
+ ERR_PRINT("A Godot Engine build callback failed.");
+ builds_successful = false;
+ }
}
- return true;
+ if (builds_successful && !editor_data.call_build()) {
+ ERR_PRINT("An EditorPlugin build callback failed.");
+ builds_successful = false;
+ }
+
+ return builds_successful;
}
void EditorNode::_inherit_imported(const String &p_action) {
@@ -4621,11 +4373,9 @@ Vector<Ref<EditorResourceConversionPlugin> > EditorNode::find_resource_conversio
void EditorNode::_bind_methods() {
ClassDB::bind_method("_menu_option", &EditorNode::_menu_option);
+ ClassDB::bind_method("_tool_menu_option", &EditorNode::_tool_menu_option);
ClassDB::bind_method("_menu_confirm_current", &EditorNode::_menu_confirm_current);
ClassDB::bind_method("_dialog_action", &EditorNode::_dialog_action);
- ClassDB::bind_method("_resource_selected", &EditorNode::_resource_selected, DEFVAL(""));
- ClassDB::bind_method("_property_editor_forward", &EditorNode::_property_editor_forward);
- ClassDB::bind_method("_property_editor_back", &EditorNode::_property_editor_back);
ClassDB::bind_method("_editor_select", &EditorNode::_editor_select);
ClassDB::bind_method("_node_renamed", &EditorNode::_node_renamed);
ClassDB::bind_method("edit_node", &EditorNode::edit_node);
@@ -4635,16 +4385,12 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("set_edited_scene", &EditorNode::set_edited_scene);
ClassDB::bind_method("open_request", &EditorNode::open_request);
ClassDB::bind_method("_instance_request", &EditorNode::_instance_request);
- ClassDB::bind_method("update_keying", &EditorNode::update_keying);
- ClassDB::bind_method("_property_keyed", &EditorNode::_property_keyed);
- ClassDB::bind_method("_transform_keyed", &EditorNode::_transform_keyed);
ClassDB::bind_method("_close_messages", &EditorNode::_close_messages);
ClassDB::bind_method("_show_messages", &EditorNode::_show_messages);
ClassDB::bind_method("_vp_resized", &EditorNode::_vp_resized);
ClassDB::bind_method("_quick_opened", &EditorNode::_quick_opened);
ClassDB::bind_method("_quick_run", &EditorNode::_quick_run);
- ClassDB::bind_method("_resource_created", &EditorNode::_resource_created);
ClassDB::bind_method("_open_recent_scene", &EditorNode::_open_recent_scene);
ClassDB::bind_method("stop_child_process", &EditorNode::stop_child_process);
@@ -4659,6 +4405,7 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_dock_popup_exit", &EditorNode::_dock_popup_exit);
ClassDB::bind_method("_dock_move_left", &EditorNode::_dock_move_left);
ClassDB::bind_method("_dock_move_right", &EditorNode::_dock_move_right);
+ ClassDB::bind_method("_dock_tab_changed", &EditorNode::_dock_tab_changed);
ClassDB::bind_method("_layout_menu_option", &EditorNode::_layout_menu_option);
@@ -4677,15 +4424,9 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_discard_changes", &EditorNode::_discard_changes);
ClassDB::bind_method("_update_recent_scenes", &EditorNode::_update_recent_scenes);
- ClassDB::bind_method("_prepare_history", &EditorNode::_prepare_history);
- ClassDB::bind_method("_select_history", &EditorNode::_select_history);
-
- ClassDB::bind_method("_toggle_search_bar", &EditorNode::_toggle_search_bar);
- ClassDB::bind_method("_clear_search_box", &EditorNode::_clear_search_box);
ClassDB::bind_method("_clear_undo_history", &EditorNode::_clear_undo_history);
ClassDB::bind_method("_dropped_files", &EditorNode::_dropped_files);
ClassDB::bind_method("_toggle_distraction_free_mode", &EditorNode::_toggle_distraction_free_mode);
- ClassDB::bind_method("_property_editable_warning_pressed", &EditorNode::_property_editable_warning_pressed);
ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base);
ClassDB::bind_method(D_METHOD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch);
@@ -4699,7 +4440,6 @@ void EditorNode::_bind_methods() {
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
- ADD_SIGNAL(MethodInfo("request_help"));
ADD_SIGNAL(MethodInfo("request_help_search"));
ADD_SIGNAL(MethodInfo("request_help_index"));
ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::POOL_STRING_ARRAY, "args")));
@@ -4735,7 +4475,7 @@ EditorNode::EditorNode() {
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) {
//only if no touchscreen ui hint, set emulation
- id->set_emulate_touch(false); //just disable just in case
+ id->set_emulate_touch_from_mouse(false); //just disable just in case
}
id->set_custom_mouse_cursor(RES());
}
@@ -4759,18 +4499,43 @@ EditorNode::EditorNode() {
FileAccess::set_backup_save(EDITOR_GET("filesystem/on_save/safe_save_on_backup_then_rename"));
{
- int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode");
- if (dpi_mode == 0) {
- const int screen = OS::get_singleton()->get_current_screen();
- editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0);
- } else if (dpi_mode == 1) {
- editor_set_scale(0.75);
- } else if (dpi_mode == 2) {
- editor_set_scale(1.0);
- } else if (dpi_mode == 3) {
- editor_set_scale(1.5);
- } else if (dpi_mode == 4) {
- editor_set_scale(2.0);
+ int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale");
+ float custom_display_scale = EditorSettings::get_singleton()->get("interface/editor/custom_display_scale");
+
+ switch (display_scale) {
+ case 0: {
+ // Try applying a suitable display scale automatically
+ const int screen = OS::get_singleton()->get_current_screen();
+ editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0);
+ } break;
+
+ case 1: {
+ editor_set_scale(0.75);
+ } break;
+
+ case 2: {
+ editor_set_scale(1.0);
+ } break;
+
+ case 3: {
+ editor_set_scale(1.25);
+ } break;
+
+ case 4: {
+ editor_set_scale(1.5);
+ } break;
+
+ case 5: {
+ editor_set_scale(1.75);
+ } break;
+
+ case 6: {
+ editor_set_scale(2.0);
+ } break;
+
+ default: {
+ editor_set_scale(custom_display_scale);
+ } break;
}
}
@@ -4828,6 +4593,16 @@ EditorNode::EditorNode() {
ResourceFormatImporter::get_singleton()->add_importer(import_bitmap);
}
+ {
+ Ref<EditorInspectorDefaultPlugin> eidp;
+ eidp.instance();
+ EditorInspector::add_inspector_plugin(eidp);
+
+ Ref<EditorInspectorRootMotionPlugin> rmp;
+ rmp.instance();
+ EditorInspector::add_inspector_plugin(rmp);
+ }
+
_pvrtc_register_compressors();
editor_selection = memnew(EditorSelection);
@@ -4851,9 +4626,24 @@ EditorNode::EditorNode() {
GLOBAL_DEF("editor/main_run_args", "");
- ClassDB::set_class_enabled("CollisionShape", true);
- ClassDB::set_class_enabled("CollisionShape2D", true);
- ClassDB::set_class_enabled("CollisionPolygon2D", true);
+ ClassDB::set_class_enabled("RootMotionView", true);
+
+ //defs here, use EDITOR_GET in logic
+ EDITOR_DEF("interface/scene_tabs/always_show_close_button", false);
+ EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true);
+ EDITOR_DEF("interface/scene_tabs/minimum_width", 50);
+ EDITOR_DEF("run/output/always_clear_output_on_play", true);
+ EDITOR_DEF("run/output/always_open_output_on_play", true);
+ EDITOR_DEF("run/output/always_close_output_on_stop", true);
+ EDITOR_DEF("run/auto_save/save_before_running", true);
+ EDITOR_DEF("interface/editor/save_each_scene_on_quit", true);
+ EDITOR_DEF("interface/editor/quit_confirmation", true);
+ EDITOR_DEF("interface/scene_tabs/restore_scenes_on_load", false);
+ EDITOR_DEF("interface/scene_tabs/show_thumbnail_on_hover", true);
+ EDITOR_DEF("interface/inspector/capitalize_properties", true);
+ EDITOR_DEF("interface/inspector/disable_folding", false);
+ EDITOR_DEF("interface/inspector/open_resources_in_new_inspector", false);
+ EDITOR_DEF("run/auto_save/save_before_running", true);
theme_base = memnew(Control);
add_child(theme_base);
@@ -4993,6 +4783,9 @@ EditorNode::EditorNode() {
dock_slot[i]->set_popup(dock_select_popup);
dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i));
dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
+ dock_slot[i]->set_drag_to_rearrange_enabled(true);
+ dock_slot[i]->set_tabs_rearrange_group(1);
+ dock_slot[i]->connect("tab_changed", this, "_dock_tab_changed");
}
dock_drag_timer = memnew(Timer);
@@ -5030,6 +4823,7 @@ EditorNode::EditorNode() {
scene_tabs->set_tab_align(Tabs::ALIGN_LEFT);
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
+ scene_tabs->set_drag_to_rearrange_enabled(true);
scene_tabs->connect("tab_changed", this, "_scene_tab_changed");
scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited");
scene_tabs->connect("tab_close", this, "_scene_tab_closed");
@@ -5045,7 +4839,11 @@ EditorNode::EditorNode() {
srt->add_child(tabbar_container);
tabbar_container->add_child(scene_tabs);
distraction_free = memnew(ToolButton);
+#ifdef OSX_ENABLED
+ distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D));
+#else
distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
+#endif
distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
@@ -5132,7 +4930,6 @@ EditorNode::EditorNode() {
gui_base->add_child(export_template_manager);
about = memnew(EditorAbout);
- about->get_logo()->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
gui_base->add_child(about);
warning = memnew(AcceptDialog);
@@ -5140,32 +4937,32 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD + KEY_TAB);
ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_TAB);
- ED_SHORTCUT("editor/filter_files", TTR("Filter Files.."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_P);
+ ED_SHORTCUT("editor/filter_files", TTR("Filter Files..."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_P);
PopupMenu *p;
file_menu->set_tooltip(TTR("Operations with scene files."));
p = file_menu->get_popup();
p->add_shortcut(ED_SHORTCUT("editor/new_scene", TTR("New Scene")), FILE_NEW_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/new_inherited_scene", TTR("New Inherited Scene..")), FILE_NEW_INHERITED_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/open_scene", TTR("Open Scene.."), KEY_MASK_CMD + KEY_O), FILE_OPEN_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/new_inherited_scene", TTR("New Inherited Scene...")), FILE_NEW_INHERITED_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/open_scene", TTR("Open Scene..."), KEY_MASK_CMD + KEY_O), FILE_OPEN_SCENE);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/save_scene", TTR("Save Scene"), KEY_MASK_CMD + KEY_S), FILE_SAVE_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/save_scene_as", TTR("Save Scene As.."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_AS_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/save_scene_as", TTR("Save Scene As..."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_AS_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes", TTR("Save all Scenes"), KEY_MASK_ALT + KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_ALL_SCENES);
p->add_separator();
- p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_W), FILE_CLOSE);
+ p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_W), FILE_CLOSE);
p->add_separator();
p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT);
p->add_separator();
- p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene", TTR("Quick Open Scene.."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/quick_open_script", TTR("Quick Open Script.."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCRIPT);
+ p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene", TTR("Quick Open Scene..."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCENE);
+ p->add_shortcut(ED_SHORTCUT("editor/quick_open_script", TTR("Quick Open Script..."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCRIPT);
p->add_separator();
PopupMenu *pm_export = memnew(PopupMenu);
pm_export->set_name("Export");
p->add_child(pm_export);
- p->add_submenu_item(TTR("Convert To.."), "Export");
- pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary..")), FILE_EXPORT_MESH_LIBRARY);
- pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet..")), FILE_EXPORT_TILESET);
+ p->add_submenu_item(TTR("Convert To..."), "Export");
+ pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary...")), FILE_EXPORT_MESH_LIBRARY);
+ pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet...")), FILE_EXPORT_TILESET);
pm_export->connect("id_pressed", this, "_menu_option");
p->add_separator();
@@ -5195,9 +4992,9 @@ EditorNode::EditorNode() {
p->connect("id_pressed", this, "_menu_option");
p->add_item(TTR("Export"), FILE_EXPORT_PROJECT);
- PopupMenu *tool_menu = memnew(PopupMenu);
+ tool_menu = memnew(PopupMenu);
tool_menu->set_name("Tools");
- tool_menu->connect("id_pressed", this, "_menu_option");
+ tool_menu->connect("index_pressed", this, "_tool_menu_option");
p->add_child(tool_menu);
p->add_submenu_item(TTR("Tools"), "Tools");
tool_menu->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
@@ -5206,7 +5003,7 @@ EditorNode::EditorNode() {
#ifdef OSX_ENABLED
p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
#else
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Q);
#endif
PanelContainer *editor_region = memnew(PanelContainer);
@@ -5255,7 +5052,11 @@ EditorNode::EditorNode() {
p->add_child(editor_layouts);
editor_layouts->connect("id_pressed", this, "_layout_menu_option");
p->add_submenu_item(TTR("Editor Layout"), "Layouts");
- p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
+#ifdef OSX_ENABLED
+ p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F), SETTINGS_TOGGLE_FULLSCREEN);
+#else
+ p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN);
+#endif
p->add_separator();
p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
@@ -5295,7 +5096,11 @@ EditorNode::EditorNode() {
play_button->set_focus_mode(Control::FOCUS_NONE);
play_button->connect("pressed", this, "_menu_option", make_binds(RUN_PLAY));
play_button->set_tooltip(TTR("Play the project."));
+#ifdef OSX_ENABLED
+ play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_MASK_CMD | KEY_B));
+#else
play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_F5));
+#endif
pause_button = memnew(ToolButton);
pause_button->set_toggle_mode(true);
@@ -5304,7 +5109,11 @@ EditorNode::EditorNode() {
pause_button->set_tooltip(TTR("Pause the scene"));
pause_button->set_disabled(true);
play_hb->add_child(pause_button);
+#ifdef OSX_ENABLED
+ pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y));
+#else
pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7));
+#endif
stop_button = memnew(ToolButton);
play_hb->add_child(stop_button);
@@ -5313,7 +5122,11 @@ EditorNode::EditorNode() {
stop_button->connect("pressed", this, "_menu_option", make_binds(RUN_STOP));
stop_button->set_tooltip(TTR("Stop the scene."));
stop_button->set_disabled(true);
+#ifdef OSX_ENABLED
+ stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_MASK_CMD | KEY_PERIOD));
+#else
stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8));
+#endif
run_native = memnew(EditorRunNative);
play_hb->add_child(run_native);
@@ -5331,7 +5144,11 @@ EditorNode::EditorNode() {
play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons"));
play_scene_button->connect("pressed", this, "_menu_option", make_binds(RUN_PLAY_SCENE));
play_scene_button->set_tooltip(TTR("Play the edited scene."));
+#ifdef OSX_ENABLED
+ play_scene_button->set_shortcut(ED_SHORTCUT("editor/play_scene", TTR("Play Scene"), KEY_MASK_CMD | KEY_R));
+#else
play_scene_button->set_shortcut(ED_SHORTCUT("editor/play_scene", TTR("Play Scene"), KEY_F6));
+#endif
play_custom_scene_button = memnew(ToolButton);
play_hb->add_child(play_custom_scene_button);
@@ -5340,7 +5157,11 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons"));
play_custom_scene_button->connect("pressed", this, "_menu_option", make_binds(RUN_PLAY_CUSTOM_SCENE));
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
+#ifdef OSX_ENABLED
+ play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R));
+#else
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
+#endif
progress_hb = memnew(BackgroundProgress);
@@ -5375,129 +5196,11 @@ EditorNode::EditorNode() {
dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(scene_tree_dock->get_index(), TTR("Scene"));
dock_slot[DOCK_SLOT_LEFT_BR]->hide();
- VBoxContainer *prop_editor_base = memnew(VBoxContainer);
- prop_editor_base->set_name("Inspector");
- dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(prop_editor_base);
- dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(prop_editor_base->get_index(), TTR("Inspector"));
-
- HBoxContainer *prop_editor_hb = memnew(HBoxContainer);
-
- prop_editor_base->add_child(prop_editor_hb);
- prop_editor_vb = prop_editor_base;
-
- resource_new_button = memnew(ToolButton);
- resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it."));
- resource_new_button->set_icon(gui_base->get_icon("New", "EditorIcons"));
- prop_editor_hb->add_child(resource_new_button);
- resource_new_button->connect("pressed", this, "_menu_option", varray(RESOURCE_NEW));
- resource_new_button->set_focus_mode(Control::FOCUS_NONE);
-
- resource_load_button = memnew(ToolButton);
- resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it."));
- resource_load_button->set_icon(gui_base->get_icon("Load", "EditorIcons"));
- prop_editor_hb->add_child(resource_load_button);
- resource_load_button->connect("pressed", this, "_menu_option", varray(RESOURCE_LOAD));
- resource_load_button->set_focus_mode(Control::FOCUS_NONE);
-
- resource_save_button = memnew(MenuButton);
- resource_save_button->set_tooltip(TTR("Save the currently edited resource."));
- resource_save_button->set_icon(gui_base->get_icon("Save", "EditorIcons"));
- prop_editor_hb->add_child(resource_save_button);
- resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE);
- resource_save_button->get_popup()->add_item(TTR("Save As.."), RESOURCE_SAVE_AS);
- resource_save_button->get_popup()->connect("id_pressed", this, "_menu_option");
- resource_save_button->set_focus_mode(Control::FOCUS_NONE);
- resource_save_button->set_disabled(true);
-
- prop_editor_hb->add_spacer();
-
- property_back = memnew(ToolButton);
- property_back->set_icon(gui_base->get_icon("Back", "EditorIcons"));
- property_back->set_flat(true);
- property_back->set_tooltip(TTR("Go to the previous edited object in history."));
- property_back->set_disabled(true);
-
- prop_editor_hb->add_child(property_back);
-
- property_forward = memnew(ToolButton);
- property_forward->set_icon(gui_base->get_icon("Forward", "EditorIcons"));
- property_forward->set_flat(true);
- property_forward->set_tooltip(TTR("Go to the next edited object in history."));
- property_forward->set_disabled(true);
-
- prop_editor_hb->add_child(property_forward);
-
- editor_history_menu = memnew(MenuButton);
- editor_history_menu->set_tooltip(TTR("History of recently edited objects."));
- editor_history_menu->set_icon(gui_base->get_icon("History", "EditorIcons"));
- prop_editor_hb->add_child(editor_history_menu);
- editor_history_menu->connect("about_to_show", this, "_prepare_history");
- editor_history_menu->get_popup()->connect("id_pressed", this, "_select_history");
-
- prop_editor_hb = memnew(HBoxContainer); //again...
- prop_editor_base->add_child(prop_editor_hb);
-
- editor_path = memnew(EditorPath(&editor_history));
- editor_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- prop_editor_hb->add_child(editor_path);
-
- search_button = memnew(ToolButton);
- search_button->set_toggle_mode(true);
- search_button->set_pressed(false);
- search_button->set_icon(gui_base->get_icon("Search", "EditorIcons"));
- prop_editor_hb->add_child(search_button);
- search_button->connect("toggled", this, "_toggle_search_bar");
-
- object_menu = memnew(MenuButton);
- object_menu->set_icon(gui_base->get_icon("Tools", "EditorIcons"));
- prop_editor_hb->add_child(object_menu);
- object_menu->set_tooltip(TTR("Object properties."));
-
- create_dialog = memnew(CreateDialog);
- gui_base->add_child(create_dialog);
- create_dialog->set_base_type("Resource");
- create_dialog->connect("create", this, "_resource_created");
-
- search_bar = memnew(HBoxContainer);
- search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- prop_editor_base->add_child(search_bar);
- search_bar->hide();
-
- Label *l = memnew(Label(TTR("Search:") + " "));
- search_bar->add_child(l);
-
- search_box = memnew(LineEdit);
- search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- search_bar->add_child(search_box);
-
- ToolButton *clear_button = memnew(ToolButton);
- clear_button->set_icon(gui_base->get_icon("Close", "EditorIcons"));
- search_bar->add_child(clear_button);
- clear_button->connect("pressed", this, "_clear_search_box");
-
- property_editable_warning = memnew(Button);
- property_editable_warning->set_text(TTR("Changes may be lost!"));
- prop_editor_base->add_child(property_editable_warning);
- property_editable_warning_dialog = memnew(AcceptDialog);
- gui_base->add_child(property_editable_warning_dialog);
- property_editable_warning->hide();
- property_editable_warning->connect("pressed", this, "_property_editable_warning_pressed");
-
- property_editor = memnew(PropertyEditor);
- property_editor->set_autoclear(true);
- property_editor->set_show_categories(true);
- property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- property_editor->set_use_doc_hints(true);
- property_editor->set_hide_script(false);
- property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/editor/capitalize_properties", true)));
- property_editor->set_use_folding(!bool(EDITOR_DEF("interface/editor/disable_inspector_folding", false)));
-
- property_editor->hide_top_label();
- property_editor->register_text_enter(search_box);
+ inspector_dock = memnew(InspectorDock(this, editor_data));
+ dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(inspector_dock);
+ dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(inspector_dock->get_index(), TTR("Inspector"));
Button *property_editable_warning;
- prop_editor_base->add_child(property_editor);
- property_editor->set_undo_redo(&editor_data.get_undo_redo());
import_dock = memnew(ImportDock);
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock);
@@ -5557,7 +5260,8 @@ EditorNode::EditorNode() {
bottom_panel_vb->add_child(bottom_panel_hb);
log = memnew(EditorLog);
- add_bottom_panel_item(TTR("Output"), log);
+ ToolButton *output_button = add_bottom_panel_item(TTR("Output"), log);
+ log->set_tool_button(output_button);
old_split_ofs = 0;
@@ -5622,19 +5326,15 @@ EditorNode::EditorNode() {
gui_base->add_child(file_script);
file_script->connect("file_selected", this, "_dialog_action");
- property_forward->connect("pressed", this, "_property_editor_forward");
- property_back->connect("pressed", this, "_property_editor_back");
-
file_menu->get_popup()->connect("id_pressed", this, "_menu_option");
- object_menu->get_popup()->connect("id_pressed", this, "_menu_option");
settings_menu->get_popup()->connect("id_pressed", this, "_menu_option");
file->connect("file_selected", this, "_dialog_action");
file_templates->connect("file_selected", this, "_dialog_action");
- property_editor->connect("resource_selected", this, "_resource_selected");
- property_editor->connect("property_keyed", this, "_property_keyed");
+ preview_gen = memnew(AudioStreamPreviewGenerator);
+ add_child(preview_gen);
//plugin stuff
file_server = memnew(EditorFileServer);
@@ -5665,6 +5365,10 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(ShaderEditorPlugin(this)));
// FIXME: Disabled for Godot 3.0 as made incompatible, it needs to be ported to the new API.
//add_editor_plugin(memnew(ShaderGraphEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeBlendTreeEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeBlendSpace1DEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeBlendSpace2DEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeStateMachineEditorPlugin(this)));
add_editor_plugin(memnew(CameraEditorPlugin(this)));
add_editor_plugin(memnew(ThemeEditorPlugin(this)));
@@ -5678,7 +5382,7 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(ParticlesEditorPlugin(this)));
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
add_editor_plugin(memnew(ItemListEditorPlugin(this)));
- add_editor_plugin(memnew(CollisionPolygonEditorPlugin(this)));
+ add_editor_plugin(memnew(Polygon3DEditorPlugin(this)));
add_editor_plugin(memnew(CollisionPolygon2DEditorPlugin(this)));
add_editor_plugin(memnew(TileSetEditorPlugin(this)));
add_editor_plugin(memnew(TileMapEditorPlugin(this)));
@@ -5699,7 +5403,8 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(TextureEditorPlugin(this)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
- add_editor_plugin(memnew(NavigationMeshEditorPlugin(this)));
+ add_editor_plugin(memnew(SkeletonEditorPlugin(this)));
+ add_editor_plugin(memnew(PhysicalBonePlugin(this)));
// FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
// Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
@@ -5716,10 +5421,10 @@ EditorNode::EditorNode() {
resource_preview->add_preview_generator(Ref<EditorPackedScenePreviewPlugin>(memnew(EditorPackedScenePreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorMaterialPreviewPlugin>(memnew(EditorMaterialPreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorScriptPreviewPlugin>(memnew(EditorScriptPreviewPlugin)));
- // FIXME: Needs to be rewritten for AudioStream in Godot 3.0+
- //resource_preview->add_preview_generator( Ref<EditorSamplePreviewPlugin>( memnew(EditorSamplePreviewPlugin )));
+ resource_preview->add_preview_generator(Ref<EditorAudioStreamPreviewPlugin>(memnew(EditorAudioStreamPreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorMeshPreviewPlugin>(memnew(EditorMeshPreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorBitmapPreviewPlugin>(memnew(EditorBitmapPreviewPlugin)));
+ resource_preview->add_preview_generator(Ref<EditorFontPreviewPlugin>(memnew(EditorFontPreviewPlugin)));
{
Ref<SpatialMaterialConversionPlugin> spatial_mat_convert;
@@ -5797,17 +5502,7 @@ EditorNode::EditorNode() {
EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
EditorFileSystem::get_singleton()->connect("resources_reimported", this, "_resources_reimported");
- {
- List<StringName> tl;
- StringName ei = "EditorIcons";
- theme_base->get_theme()->get_icon_list(ei, &tl);
- for (List<StringName>::Element *E = tl.front(); E; E = E->next()) {
-
- if (!ClassDB::class_exists(E->get()))
- continue;
- icon_type_cache[E->get()] = theme_base->get_theme()->get_icon(E->get(), ei);
- }
- }
+ _build_icon_type_cache();
Node::set_human_readable_collision_renaming(true);
@@ -5853,10 +5548,17 @@ EditorNode::EditorNode() {
print_handler.userdata = this;
add_print_handler(&print_handler);
+#ifdef OSX_ENABLED
+ ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_ALT | KEY_1);
+ ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_ALT | KEY_2);
+ ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_ALT | KEY_3);
+ ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_MASK_ALT | KEY_SPACE);
+#else
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2);
ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack neded for script editor F3 search to work :) Assign like this or don't use F3
ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F4);
+#endif
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"));
ED_SHORTCUT("editor/editor_next", TTR("Open the next Editor"));
ED_SHORTCUT("editor/editor_prev", TTR("Open the previous Editor"));
@@ -5864,6 +5566,8 @@ EditorNode::EditorNode() {
EditorNode::~EditorNode() {
+ EditorInspector::cleanup_plugins();
+
remove_print_handler(&print_handler);
memdelete(EditorHelp::get_doc_data());
memdelete(editor_selection);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 6d96c2dea7..4241520b30 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -32,14 +32,15 @@
#define EDITOR_NODE_H
#include "core/print_string.h"
+#include "editor/audio_stream_preview.h"
#include "editor/connections_dialog.h"
#include "editor/create_dialog.h"
#include "editor/editor_about.h"
#include "editor/editor_data.h"
#include "editor/editor_export.h"
+#include "editor/editor_inspector.h"
#include "editor/editor_log.h"
#include "editor/editor_name_dialog.h"
-#include "editor/editor_path.h"
#include "editor/editor_plugin.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_run.h"
@@ -52,6 +53,7 @@
#include "editor/filesystem_dock.h"
#include "editor/groups_editor.h"
#include "editor/import_dock.h"
+#include "editor/inspector_dock.h"
#include "editor/node_dock.h"
#include "editor/pane_drag.h"
#include "editor/progress_dialog.h"
@@ -141,22 +143,11 @@ private:
EDIT_REDO,
EDIT_REVERT,
TOOLS_ORPHAN_RESOURCES,
- RESOURCE_NEW,
- RESOURCE_LOAD,
+ TOOLS_CUSTOM,
RESOURCE_SAVE,
RESOURCE_SAVE_AS,
- RESOURCE_UNREF,
- RESOURCE_COPY,
- RESOURCE_PASTE,
- OBJECT_COPY_PARAMS,
- OBJECT_PASTE_PARAMS,
- OBJECT_UNIQUE_RESOURCES,
- OBJECT_REQUEST_HELP,
RUN_PLAY,
- COLLAPSE_ALL,
- EXPAND_ALL,
-
RUN_STOP,
RUN_PLAY_SCENE,
RUN_PLAY_NATIVE,
@@ -180,7 +171,7 @@ private:
SETTINGS_LAYOUT_DEFAULT,
SETTINGS_MANAGE_EXPORT_TEMPLATES,
SETTINGS_PICK_MAIN_SCENE,
- SETTINGS_TOGGLE_FULLSCREN,
+ SETTINGS_TOGGLE_FULLSCREEN,
SETTINGS_HELP,
SCENE_TAB_CLOSE,
@@ -194,8 +185,6 @@ private:
IMPORT_PLUGIN_BASE = 100,
- OBJECT_METHOD_BASE = 500,
-
TOOL_MENU_BASE = 1000
};
@@ -246,7 +235,6 @@ private:
PopupMenu *tool_menu;
ToolButton *export_button;
ToolButton *prev_scene;
- MenuButton *object_menu;
ToolButton *play_button;
MenuButton *native_play_button;
ToolButton *pause_button;
@@ -263,24 +251,13 @@ private:
Ref<Theme> theme;
PopupMenu *recent_scenes;
- Button *property_back;
- Button *property_forward;
SceneTreeDock *scene_tree_dock;
- PropertyEditor *property_editor;
- Button *property_editable_warning;
- AcceptDialog *property_editable_warning_dialog;
- void _property_editable_warning_pressed();
+ InspectorDock *inspector_dock;
NodeDock *node_dock;
ImportDock *import_dock;
- VBoxContainer *prop_editor_vb;
FileSystemDock *filesystem_dock;
EditorRunNative *run_native;
- HBoxContainer *search_bar;
- LineEdit *search_box;
-
- CreateDialog *create_dialog;
-
ConfirmationDialog *confirmation;
ConfirmationDialog *save_confirmation;
ConfirmationDialog *import_confirmation;
@@ -313,11 +290,6 @@ private:
String defer_export_platform;
bool defer_export_debug;
Node *_last_instanced_scene;
- EditorPath *editor_path;
- ToolButton *resource_new_button;
- ToolButton *resource_load_button;
- MenuButton *resource_save_button;
- MenuButton *editor_history_menu;
EditorLog *log;
CenterContainer *tabs_center;
@@ -328,6 +300,7 @@ private:
Vector<ToolButton *> main_editor_buttons;
Vector<EditorPlugin *> editor_table;
+ AudioStreamPreviewGenerator *preview_gen;
ProgressDialog *progress_dialog;
BackgroundProgress *progress_hb;
@@ -421,22 +394,12 @@ private:
void _dialog_display_load_error(String p_file, Error p_error);
int current_option;
- void _resource_created();
- void _resource_selected(const RES &p_res, const String &p_property = "");
void _menu_option(int p_option);
void _menu_confirm_current();
void _menu_option_confirm(int p_option, bool p_confirmed);
+ void _tool_menu_option(int p_idx);
void _update_debug_options();
- void _property_editor_forward();
- void _property_editor_back();
-
- void _menu_collapseall();
- void _menu_expandall();
-
- void _select_history(int p_idx);
- void _prepare_history();
-
void _fs_changed();
void _resources_reimported(const Vector<String> &p_resources);
void _sources_changed(bool p_exist);
@@ -460,9 +423,6 @@ private:
void _instance_request(const Vector<String> &p_files);
- void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
- void _transform_keyed(Object *sp, const String &p_sub, const Transform &p_key);
-
void _hide_top_editors();
void _display_top_editors(bool p_display);
void _set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over);
@@ -496,6 +456,7 @@ private:
Set<EditorFileDialog *> editor_file_dialogs;
Map<String, Ref<Texture> > icon_type_cache;
+ void _build_icon_type_cache();
bool _initializing_addons;
Map<String, EditorPlugin *> plugin_addons;
@@ -566,6 +527,7 @@ private:
void _save_docks_to_config(Ref<ConfigFile> p_layout, const String &p_section);
void _load_docks_from_config(Ref<ConfigFile> p_layout, const String &p_section);
void _update_dock_slots_visibility();
+ void _dock_tab_changed(int p_tab);
bool restoring_scenes;
void _save_open_scenes_to_config(Ref<ConfigFile> p_layout, const String &p_section);
@@ -574,8 +536,6 @@ private:
void _update_layouts_menu();
void _layout_menu_option(int p_id);
- void _toggle_search_bar(bool p_pressed);
- void _clear_search_box();
void _clear_undo_history();
void _update_addon_config();
@@ -599,21 +559,6 @@ private:
static int build_callback_count;
static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS];
- bool _initializing_tool_menu;
-
- struct ToolMenuItem {
- String name;
- String submenu;
- Variant ud;
- ObjectID handler;
- String callback;
- };
-
- Vector<ToolMenuItem> tool_menu_items;
-
- void _tool_menu_insert_item(const ToolMenuItem &p_item);
- void _rebuild_tool_menu() const;
-
bool _dimming;
float _dim_time;
Timer *_dim_timer;
@@ -651,8 +596,8 @@ public:
EditorPluginList *get_editor_plugins_over() { return editor_plugins_over; }
EditorPluginList *get_editor_plugins_force_over() { return editor_plugins_force_over; }
EditorPluginList *get_editor_plugins_force_input_forwarding() { return editor_plugins_force_input_forwarding; }
- PropertyEditor *get_property_editor() { return property_editor; }
- VBoxContainer *get_property_editor_vb() { return prop_editor_vb; }
+ EditorInspector *get_inspector() { return inspector_dock->get_inspector(); }
+ Container *get_inspector_dock_addon_area() { return inspector_dock->get_addon_area(); }
ProjectSettingsEditor *get_project_settings() { return project_settings; }
@@ -674,8 +619,8 @@ public:
bool is_addon_plugin_enabled(const String &p_addon) const;
void edit_node(Node *p_node);
- void edit_resource(const Ref<Resource> &p_resource);
- void open_resource(const String &p_type = "");
+ void edit_resource(const Ref<Resource> &p_resource) { inspector_dock->edit_resource(p_resource); };
+ void open_resource(const String &p_type) { inspector_dock->open_resource(p_type); };
void save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path);
void save_resource(const Ref<Resource> &p_resource);
@@ -689,7 +634,9 @@ public:
static HBoxContainer *get_menu_hb() { return singleton->menu_hb; }
- void push_item(Object *p_object, const String &p_property = "");
+ void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
+ void edit_item(Object *p_object);
+ bool item_has_editor(Object *p_object);
void open_request(const String &p_path);
@@ -724,6 +671,7 @@ public:
FileSystemDock *get_filesystem_dock();
ImportDock *get_import_dock();
SceneTreeDock *get_scene_tree_dock();
+ InspectorDock *get_inspector_dock();
static UndoRedo *get_undo_redo() { return &singleton->editor_data.get_undo_redo(); }
EditorSelection *get_editor_selection() { return editor_selection; }
@@ -737,6 +685,7 @@ public:
Ref<Theme> get_editor_theme() const { return theme; }
+ void show_accept(const String &p_text, const String &p_title);
void show_warning(const String &p_text, const String &p_title = "Warning!");
Error export_preset(const String &p_preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
@@ -770,8 +719,6 @@ public:
void save_layout();
- void update_keying();
-
void open_export_template_manager();
void reload_scene(const String &p_path);
@@ -796,6 +743,10 @@ public:
void dim_editor(bool p_dimming);
+ void edit_current() { _edit_current(); };
+
+ void update_keying() const { inspector_dock->update_keying(); };
+
EditorNode();
~EditorNode();
void get_singleton(const char *arg1, bool arg2);
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 31d0bfa8a9..cc44938c25 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -125,7 +125,7 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>
xform.origin.z -= rot_aabb.size.z * 2;
RID inst = VS::get_singleton()->instance_create2(mesh->get_rid(), scenario);
VS::get_singleton()->instance_set_transform(inst, xform);
- ep.step(TTR("Thumbnail.."), i);
+ ep.step(TTR("Thumbnail..."), i);
Main::iteration();
Main::iteration();
Ref<Image> img = VS::get_singleton()->texture_get_data(viewport_texture);
@@ -375,7 +375,7 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location, C
} break;
case CONTAINER_PROPERTY_EDITOR_BOTTOM: {
- EditorNode::get_singleton()->get_property_editor_vb()->add_child(p_control);
+ EditorNode::get_singleton()->get_inspector_dock_addon_area()->add_child(p_control);
} break;
}
@@ -422,28 +422,25 @@ void EditorPlugin::remove_control_from_container(CustomControlContainer p_locati
} break;
case CONTAINER_PROPERTY_EDITOR_BOTTOM: {
- EditorNode::get_singleton()->get_property_editor_vb()->remove_child(p_control);
+ EditorNode::get_singleton()->get_inspector_dock_addon_area()->remove_child(p_control);
} break;
}
}
void EditorPlugin::add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud) {
-
- //EditorNode::get_singleton()->add_tool_menu_item(p_name, p_handler, p_callback, p_ud);
+ EditorNode::get_singleton()->add_tool_menu_item(p_name, p_handler, p_callback, p_ud);
}
void EditorPlugin::add_tool_submenu_item(const String &p_name, Object *p_submenu) {
-
ERR_FAIL_NULL(p_submenu);
PopupMenu *submenu = Object::cast_to<PopupMenu>(p_submenu);
ERR_FAIL_NULL(submenu);
- //EditorNode::get_singleton()->add_tool_submenu_item(p_name, submenu);
+ EditorNode::get_singleton()->add_tool_submenu_item(p_name, submenu);
}
void EditorPlugin::remove_tool_menu_item(const String &p_name) {
-
- //EditorNode::get_singleton()->remove_tool_menu_item(p_name);
+ EditorNode::get_singleton()->remove_tool_menu_item(p_name);
}
void EditorPlugin::set_input_event_forwarding_always_enabled() {
@@ -476,6 +473,10 @@ void EditorPlugin::notify_scene_closed(const String &scene_filepath) {
emit_signal("scene_closed", scene_filepath);
}
+void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) {
+ emit_signal("resource_saved", p_resource);
+}
+
Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
//??
if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) {
@@ -658,6 +659,14 @@ void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin> &p_exporte
EditorExport::get_singleton()->remove_export_plugin(p_exporter);
}
+void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+ EditorInspector::add_inspector_plugin(p_plugin);
+}
+
+void EditorPlugin::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+ EditorInspector::remove_inspector_plugin(p_plugin);
+}
+
void EditorPlugin::add_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer) {
ResourceImporterScene::get_singleton()->add_importer(p_importer);
}
@@ -680,6 +689,15 @@ void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
}
}
+bool EditorPlugin::build() {
+
+ if (get_script_instance() && get_script_instance()->has_method("build")) {
+ return get_script_instance()->call("build");
+ }
+
+ return true;
+}
+
void EditorPlugin::queue_save_layout() const {
EditorNode::get_singleton()->save_layout();
@@ -707,9 +725,9 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks);
ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel);
ClassDB::bind_method(D_METHOD("remove_control_from_container", "container", "control"), &EditorPlugin::remove_control_from_container);
- //ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "handler", "callback", "ud"),&EditorPlugin::add_tool_menu_item,DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "handler", "callback", "ud"), &EditorPlugin::add_tool_menu_item, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu"), &EditorPlugin::add_tool_submenu_item);
- //ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"),&EditorPlugin::remove_tool_menu_item);
+ ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"), &EditorPlugin::remove_tool_menu_item);
ClassDB::bind_method(D_METHOD("add_custom_type", "type", "base", "script", "icon"), &EditorPlugin::add_custom_type);
ClassDB::bind_method(D_METHOD("remove_custom_type", "type"), &EditorPlugin::remove_custom_type);
@@ -727,8 +745,10 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer"), &EditorPlugin::remove_import_plugin);
ClassDB::bind_method(D_METHOD("add_scene_import_plugin", "scene_importer"), &EditorPlugin::add_scene_import_plugin);
ClassDB::bind_method(D_METHOD("remove_scene_import_plugin", "scene_importer"), &EditorPlugin::remove_scene_import_plugin);
- ClassDB::bind_method(D_METHOD("add_export_plugin", "exporter"), &EditorPlugin::add_export_plugin);
- ClassDB::bind_method(D_METHOD("remove_export_plugin", "exporter"), &EditorPlugin::remove_export_plugin);
+ ClassDB::bind_method(D_METHOD("add_export_plugin", "plugin"), &EditorPlugin::add_export_plugin);
+ ClassDB::bind_method(D_METHOD("remove_export_plugin", "plugin"), &EditorPlugin::remove_export_plugin);
+ ClassDB::bind_method(D_METHOD("add_inspector_plugin", "plugin"), &EditorPlugin::add_inspector_plugin);
+ ClassDB::bind_method(D_METHOD("remove_inspector_plugin", "plugin"), &EditorPlugin::remove_inspector_plugin);
ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled);
ClassDB::bind_method(D_METHOD("set_force_draw_over_forwarding_enabled"), &EditorPlugin::set_force_draw_over_forwarding_enabled);
@@ -756,10 +776,12 @@ void EditorPlugin::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::POOL_STRING_ARRAY, "get_breakpoints"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "build"));
ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath")));
ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name")));
+ ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
BIND_ENUM_CONSTANT(CONTAINER_TOOLBAR);
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 05cc6e07e3..fcc74cb1e9 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -31,6 +31,7 @@
#ifndef EDITOR_PLUGIN_H
#define EDITOR_PLUGIN_H
+#include "editor/editor_inspector.h"
#include "editor/import/editor_import_plugin.h"
#include "editor/import/resource_importer_scene.h"
#include "io/config_file.h"
@@ -167,6 +168,7 @@ public:
void notify_main_screen_changed(const String &screen_name);
void notify_scene_changed(const Node *scn_root);
void notify_scene_closed(const String &scene_filepath);
+ void notify_resource_saved(const Ref<Resource> &p_resource);
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
@@ -190,6 +192,7 @@ public:
virtual void set_window_layout(Ref<ConfigFile> p_layout);
virtual void get_window_layout(Ref<ConfigFile> p_layout);
virtual void edited_scene_changed() {} // if changes are pending in editor, apply them
+ virtual bool build(); // builds with external tools. Returns true if safe to continue running scene.
EditorInterface *get_editor_interface();
@@ -209,6 +212,9 @@ public:
void add_export_plugin(const Ref<EditorExportPlugin> &p_exporter);
void remove_export_plugin(const Ref<EditorExportPlugin> &p_exporter);
+ void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
+ void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
+
void add_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer);
void remove_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer);
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 34c9ca6630..d4a97b7095 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -68,13 +68,13 @@ void EditorProfiler::add_frame_metric(const Metric &p_metric, bool p_final) {
}
updating_frame = false;
- if (!frame_delay->is_processing()) {
+ if (frame_delay->is_stopped()) {
frame_delay->set_wait_time(p_final ? 0.1 : 1);
frame_delay->start();
}
- if (!plot_delay->is_processing()) {
+ if (plot_delay->is_stopped()) {
plot_delay->set_wait_time(0.1);
plot_delay->start();
}
@@ -424,20 +424,25 @@ void EditorProfiler::_update_frame() {
void EditorProfiler::_activate_pressed() {
if (activate->is_pressed()) {
- clear();
activate->set_icon(get_icon("Stop", "EditorIcons"));
- activate->set_text(TTR("Stop Profiling"));
+ activate->set_text(TTR("Stop"));
} else {
activate->set_icon(get_icon("Play", "EditorIcons"));
- activate->set_text(TTR("Start Profiling"));
+ activate->set_text(TTR("Start"));
}
emit_signal("enable_profiling", activate->is_pressed());
}
+void EditorProfiler::_clear_pressed() {
+
+ clear();
+}
+
void EditorProfiler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
activate->set_icon(get_icon("Play", "EditorIcons"));
+ clear_button->set_icon(get_icon("Clear", "EditorIcons"));
}
}
@@ -599,6 +604,7 @@ void EditorProfiler::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_frame"), &EditorProfiler::_update_frame);
ClassDB::bind_method(D_METHOD("_update_plot"), &EditorProfiler::_update_plot);
ClassDB::bind_method(D_METHOD("_activate_pressed"), &EditorProfiler::_activate_pressed);
+ ClassDB::bind_method(D_METHOD("_clear_pressed"), &EditorProfiler::_clear_pressed);
ClassDB::bind_method(D_METHOD("_graph_tex_draw"), &EditorProfiler::_graph_tex_draw);
ClassDB::bind_method(D_METHOD("_graph_tex_input"), &EditorProfiler::_graph_tex_input);
ClassDB::bind_method(D_METHOD("_graph_tex_mouse_exit"), &EditorProfiler::_graph_tex_mouse_exit);
@@ -625,10 +631,15 @@ EditorProfiler::EditorProfiler() {
add_child(hb);
activate = memnew(Button);
activate->set_toggle_mode(true);
- activate->set_text(TTR("Start Profiling"));
+ activate->set_text(TTR("Start"));
activate->connect("pressed", this, "_activate_pressed");
hb->add_child(activate);
+ clear_button = memnew(Button);
+ clear_button->set_text(TTR("Clear"));
+ clear_button->connect("pressed", this, "_clear_pressed");
+ hb->add_child(clear_button);
+
hb->add_child(memnew(Label(TTR("Measure:"))));
display_mode = memnew(OptionButton);
diff --git a/editor/editor_profiler.h b/editor/editor_profiler.h
index d902a97c5d..cb451475e7 100644
--- a/editor/editor_profiler.h
+++ b/editor/editor_profiler.h
@@ -100,6 +100,7 @@ public:
private:
Button *activate;
+ Button *clear_button;
TextureRect *graph;
Ref<ImageTexture> graph_texture;
PoolVector<uint8_t> graph_image;
@@ -133,6 +134,7 @@ private:
void _update_frame();
void _activate_pressed();
+ void _clear_pressed();
String _get_time_as_text(Metric &m, float p_time, int p_calls);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
new file mode 100644
index 0000000000..9902d8d3e7
--- /dev/null
+++ b/editor/editor_properties.cpp
@@ -0,0 +1,2742 @@
+/*************************************************************************/
+/* editor_properties.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "editor_properties.h"
+#include "editor/editor_resource_preview.h"
+#include "editor_node.h"
+#include "editor_properties_array_dict.h"
+#include "scene/main/viewport.h"
+
+///////////////////// NULL /////////////////////////
+
+void EditorPropertyNil::update_property() {
+}
+
+EditorPropertyNil::EditorPropertyNil() {
+ Label *label = memnew(Label);
+ label->set_text("[null]");
+ add_child(label);
+}
+
+///////////////////// TEXT /////////////////////////
+void EditorPropertyText::_text_changed(const String &p_string) {
+ if (updating)
+ return;
+
+ emit_signal("property_changed", get_edited_property(), p_string);
+}
+
+void EditorPropertyText::update_property() {
+ String s = get_edited_object()->get(get_edited_property());
+ updating = true;
+ text->set_text(s);
+ text->set_editable(!is_read_only());
+ updating = false;
+}
+
+void EditorPropertyText::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_text_changed", "txt"), &EditorPropertyText::_text_changed);
+}
+
+EditorPropertyText::EditorPropertyText() {
+ text = memnew(LineEdit);
+ add_child(text);
+ add_focusable(text);
+ text->connect("text_changed", this, "_text_changed");
+ updating = false;
+}
+
+///////////////////// MULTILINE TEXT /////////////////////////
+
+void EditorPropertyMultilineText::_big_text_changed() {
+ text->set_text(big_text->get_text());
+ emit_signal("property_changed", get_edited_property(), big_text->get_text());
+}
+
+void EditorPropertyMultilineText::_text_changed() {
+
+ emit_signal("property_changed", get_edited_property(), text->get_text());
+}
+
+void EditorPropertyMultilineText::_open_big_text() {
+
+ if (!big_text_dialog) {
+ big_text = memnew(TextEdit);
+ big_text->connect("text_changed", this, "_big_text_changed");
+ big_text_dialog = memnew(AcceptDialog);
+ big_text_dialog->add_child(big_text);
+ big_text_dialog->set_title("Edit Text:");
+ add_child(big_text_dialog);
+ }
+
+ big_text->set_text(text->get_text());
+ big_text_dialog->popup_centered_ratio();
+}
+
+void EditorPropertyMultilineText::update_property() {
+ String t = get_edited_object()->get(get_edited_property());
+ text->set_text(t);
+ if (big_text && big_text->is_visible_in_tree()) {
+ big_text->set_text(t);
+ }
+}
+
+void EditorPropertyMultilineText::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_THEME_CHANGED:
+ case NOTIFICATION_ENTER_TREE: {
+ Ref<Texture> df = get_icon("DistractionFree", "EditorIcons");
+ open_big_text->set_icon(df);
+ Ref<Font> font = get_font("font", "Label");
+ text->set_custom_minimum_size(Vector2(0, font->get_height() * 6));
+
+ } break;
+ }
+}
+
+void EditorPropertyMultilineText::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_text_changed"), &EditorPropertyMultilineText::_text_changed);
+ ClassDB::bind_method(D_METHOD("_big_text_changed"), &EditorPropertyMultilineText::_big_text_changed);
+ ClassDB::bind_method(D_METHOD("_open_big_text"), &EditorPropertyMultilineText::_open_big_text);
+}
+
+EditorPropertyMultilineText::EditorPropertyMultilineText() {
+ HBoxContainer *hb = memnew(HBoxContainer);
+ add_child(hb);
+ set_bottom_editor(hb);
+ text = memnew(TextEdit);
+ text->connect("text_changed", this, "_text_changed");
+ add_focusable(text);
+ hb->add_child(text);
+ text->set_h_size_flags(SIZE_EXPAND_FILL);
+ open_big_text = memnew(ToolButton);
+ open_big_text->connect("pressed", this, "_open_big_text");
+ hb->add_child(open_big_text);
+ big_text_dialog = NULL;
+ big_text = NULL;
+}
+
+///////////////////// TEXT ENUM /////////////////////////
+
+void EditorPropertyTextEnum::_option_selected(int p_which) {
+
+ emit_signal("property_changed", get_edited_property(), options->get_item_text(p_which));
+}
+
+void EditorPropertyTextEnum::update_property() {
+
+ String which = get_edited_object()->get(get_edited_property());
+ for (int i = 0; i < options->get_item_count(); i++) {
+ String t = options->get_item_text(i);
+ if (t == which) {
+ options->select(i);
+ return;
+ }
+ }
+}
+
+void EditorPropertyTextEnum::setup(const Vector<String> &p_options) {
+ for (int i = 0; i < p_options.size(); i++) {
+ options->add_item(p_options[i], i);
+ }
+}
+
+void EditorPropertyTextEnum::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_option_selected"), &EditorPropertyTextEnum::_option_selected);
+}
+
+EditorPropertyTextEnum::EditorPropertyTextEnum() {
+ options = memnew(OptionButton);
+ options->set_clip_text(true);
+ add_child(options);
+ add_focusable(options);
+ options->connect("item_selected", this, "_option_selected");
+}
+///////////////////// PATH /////////////////////////
+
+void EditorPropertyPath::_path_selected(const String &p_path) {
+
+ emit_signal("property_changed", get_edited_property(), p_path);
+ update_property();
+}
+void EditorPropertyPath::_path_pressed() {
+
+ if (!dialog) {
+ dialog = memnew(EditorFileDialog);
+ dialog->connect("file_selected", this, "_path_selected");
+ dialog->connect("dir_selected", this, "_path_selected");
+ add_child(dialog);
+ }
+
+ String full_path = get_edited_object()->get(get_edited_property());
+
+ dialog->clear_filters();
+
+ if (global) {
+ dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
+ } else {
+ dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
+ }
+
+ if (folder) {
+ dialog->set_mode(EditorFileDialog::MODE_OPEN_DIR);
+ dialog->set_current_dir(full_path);
+ } else {
+ dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+ for (int i = 0; i < extensions.size(); i++) {
+ String e = extensions[i].strip_edges();
+ if (e != String()) {
+ dialog->add_filter(extensions[i].strip_edges());
+ }
+ }
+ dialog->set_current_path(full_path);
+ }
+
+ dialog->popup_centered_ratio();
+}
+
+void EditorPropertyPath::update_property() {
+
+ String full_path = get_edited_object()->get(get_edited_property());
+ path->set_text(full_path);
+ path->set_tooltip(full_path);
+}
+
+void EditorPropertyPath::setup(const Vector<String> &p_extensions, bool p_folder, bool p_global) {
+
+ extensions = p_extensions;
+ folder = p_folder;
+ global = p_global;
+}
+
+void EditorPropertyPath::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_path_pressed"), &EditorPropertyPath::_path_pressed);
+ ClassDB::bind_method(D_METHOD("_path_selected"), &EditorPropertyPath::_path_selected);
+}
+
+EditorPropertyPath::EditorPropertyPath() {
+ path = memnew(Button);
+ path->set_clip_text(true);
+ add_child(path);
+ add_focusable(path);
+ dialog = NULL;
+ path->connect("pressed", this, "_path_pressed");
+ folder = false;
+ global = false;
+}
+
+///////////////////// MEMBER /////////////////////////
+
+void EditorPropertyMember::_property_selected(const String &p_selected) {
+
+ emit_signal("property_changed", get_edited_property(), p_selected);
+ update_property();
+}
+
+void EditorPropertyMember::_property_select() {
+
+ if (!selector) {
+ selector = memnew(PropertySelector);
+ selector->connect("selected", this, "_property_selected");
+ add_child(selector);
+ }
+
+ String current = get_edited_object()->get(get_edited_property());
+
+ if (hint == MEMBER_METHOD_OF_VARIANT_TYPE) {
+
+ Variant::Type type = Variant::NIL;
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ if (hint_text == Variant::get_type_name(Variant::Type(i))) {
+ type = Variant::Type(i);
+ }
+ }
+ if (type)
+ selector->select_method_from_basic_type(type, current);
+
+ } else if (hint == MEMBER_METHOD_OF_BASE_TYPE) {
+
+ selector->select_method_from_base_type(hint_text, current);
+
+ } else if (hint == MEMBER_METHOD_OF_INSTANCE) {
+
+ Object *instance = ObjectDB::get_instance(hint_text.to_int64());
+ if (instance)
+ selector->select_method_from_instance(instance, current);
+
+ } else if (hint == MEMBER_METHOD_OF_SCRIPT) {
+
+ Object *obj = ObjectDB::get_instance(hint_text.to_int64());
+ if (Object::cast_to<Script>(obj)) {
+ selector->select_method_from_script(Object::cast_to<Script>(obj), current);
+ }
+
+ } else if (hint == MEMBER_PROPERTY_OF_VARIANT_TYPE) {
+
+ Variant::Type type = Variant::NIL;
+ String tname = hint_text;
+ if (tname.find(".") != -1)
+ tname = tname.get_slice(".", 0);
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ if (tname == Variant::get_type_name(Variant::Type(i))) {
+ type = Variant::Type(Variant::Type(i));
+ }
+ }
+
+ if (type != Variant::NIL)
+ selector->select_property_from_basic_type(type, current);
+
+ } else if (hint == MEMBER_PROPERTY_OF_BASE_TYPE) {
+
+ selector->select_property_from_base_type(hint_text, current);
+
+ } else if (hint == MEMBER_PROPERTY_OF_INSTANCE) {
+
+ Object *instance = ObjectDB::get_instance(hint_text.to_int64());
+ if (instance)
+ selector->select_property_from_instance(instance, current);
+
+ } else if (hint == MEMBER_PROPERTY_OF_SCRIPT) {
+
+ Object *obj = ObjectDB::get_instance(hint_text.to_int64());
+ if (Object::cast_to<Script>(obj)) {
+ selector->select_property_from_script(Object::cast_to<Script>(obj), current);
+ }
+ }
+}
+
+void EditorPropertyMember::setup(Type p_hint, const String &p_hint_text) {
+ hint = p_hint;
+ hint_text = p_hint_text;
+}
+
+void EditorPropertyMember::update_property() {
+
+ String full_path = get_edited_object()->get(get_edited_property());
+ property->set_text(full_path);
+}
+
+void EditorPropertyMember::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_property_selected"), &EditorPropertyMember::_property_selected);
+ ClassDB::bind_method(D_METHOD("_property_select"), &EditorPropertyMember::_property_select);
+}
+
+EditorPropertyMember::EditorPropertyMember() {
+ selector = NULL;
+ property = memnew(Button);
+ property->set_clip_text(true);
+ add_child(property);
+ add_focusable(property);
+ property->connect("pressed", this, "_property_select");
+}
+
+///////////////////// CHECK /////////////////////////
+void EditorPropertyCheck::_checkbox_pressed() {
+
+ emit_signal("property_changed", get_edited_property(), checkbox->is_pressed());
+}
+
+void EditorPropertyCheck::update_property() {
+ bool c = get_edited_object()->get(get_edited_property());
+ checkbox->set_pressed(c);
+ checkbox->set_disabled(is_read_only());
+}
+
+void EditorPropertyCheck::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_checkbox_pressed"), &EditorPropertyCheck::_checkbox_pressed);
+}
+
+EditorPropertyCheck::EditorPropertyCheck() {
+ checkbox = memnew(CheckBox);
+ checkbox->set_text(TTR("On"));
+ add_child(checkbox);
+ add_focusable(checkbox);
+ checkbox->connect("pressed", this, "_checkbox_pressed");
+}
+
+///////////////////// ENUM /////////////////////////
+
+void EditorPropertyEnum::_option_selected(int p_which) {
+
+ emit_signal("property_changed", get_edited_property(), p_which);
+}
+
+void EditorPropertyEnum::update_property() {
+
+ int which = get_edited_object()->get(get_edited_property());
+ options->select(which);
+}
+
+void EditorPropertyEnum::setup(const Vector<String> &p_options) {
+ for (int i = 0; i < p_options.size(); i++) {
+ options->add_item(p_options[i], i);
+ }
+}
+
+void EditorPropertyEnum::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_option_selected"), &EditorPropertyEnum::_option_selected);
+}
+
+EditorPropertyEnum::EditorPropertyEnum() {
+ options = memnew(OptionButton);
+ options->set_clip_text(true);
+ add_child(options);
+ add_focusable(options);
+ options->connect("item_selected", this, "_option_selected");
+}
+
+///////////////////// FLAGS /////////////////////////
+
+void EditorPropertyFlags::_flag_toggled() {
+
+ uint32_t value = 0;
+ for (int i = 0; i < flags.size(); i++) {
+ if (flags[i]->is_pressed()) {
+ uint32_t val = 1;
+ val <<= flag_indices[i];
+ value |= val;
+ }
+ }
+
+ emit_signal("property_changed", get_edited_property(), value);
+}
+
+void EditorPropertyFlags::update_property() {
+
+ uint32_t value = get_edited_object()->get(get_edited_property());
+
+ for (int i = 0; i < flags.size(); i++) {
+ uint32_t val = 1;
+ val <<= flag_indices[i];
+ if (value & val) {
+
+ flags[i]->set_pressed(true);
+ } else {
+ flags[i]->set_pressed(false);
+ }
+ }
+}
+
+void EditorPropertyFlags::setup(const Vector<String> &p_options) {
+ ERR_FAIL_COND(flags.size());
+
+ bool first = true;
+ for (int i = 0; i < p_options.size(); i++) {
+ String option = p_options[i].strip_edges();
+ if (option != "") {
+ CheckBox *cb = memnew(CheckBox);
+ cb->set_text(option);
+ cb->set_clip_text(true);
+ cb->connect("pressed", this, "_flag_toggled");
+ add_focusable(cb);
+ vbox->add_child(cb);
+ flags.push_back(cb);
+ flag_indices.push_back(i);
+ if (first) {
+ set_label_reference(cb);
+ first = false;
+ }
+ }
+ }
+}
+
+void EditorPropertyFlags::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_flag_toggled"), &EditorPropertyFlags::_flag_toggled);
+}
+
+EditorPropertyFlags::EditorPropertyFlags() {
+
+ vbox = memnew(VBoxContainer);
+ add_child(vbox);
+}
+
+///////////////////// LAYERS /////////////////////////
+
+class EditorPropertyLayersGrid : public Control {
+ GDCLASS(EditorPropertyLayersGrid, Control)
+public:
+ uint32_t value;
+ Vector<Rect2> flag_rects;
+ Vector<String> names;
+
+ virtual Size2 get_minimum_size() const {
+ Ref<Font> font = get_font("font", "Label");
+ return Vector2(0, font->get_height() * 2);
+ }
+
+ virtual String get_tooltip(const Point2 &p_pos) const {
+ for (int i = 0; i < flag_rects.size(); i++) {
+ if (i < names.size() && flag_rects[i].has_point(p_pos)) {
+ return names[i];
+ }
+ }
+ return String();
+ }
+ void _gui_input(const Ref<InputEvent> &p_ev) {
+ Ref<InputEventMouseButton> mb = p_ev;
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
+ for (int i = 0; i < flag_rects.size(); i++) {
+ if (flag_rects[i].has_point(mb->get_position())) {
+ //toggle
+ if (value & (1 << i)) {
+ value &= ~(1 << i);
+ } else {
+ value |= (1 << i);
+ }
+ emit_signal("flag_changed", value);
+ update();
+ }
+ }
+ }
+ }
+
+ void _notification(int p_what) {
+ if (p_what == NOTIFICATION_DRAW) {
+
+ Rect2 rect;
+ rect.size = get_size();
+ flag_rects.clear();
+
+ int bsize = (rect.size.height * 80 / 100) / 2;
+
+ int h = bsize * 2 + 1;
+ int vofs = (rect.size.height - h) / 2;
+
+ for (int i = 0; i < 2; i++) {
+
+ Point2 ofs(4, vofs);
+ if (i == 1)
+ ofs.y += bsize + 1;
+
+ ofs += rect.position;
+ for (int j = 0; j < 10; j++) {
+
+ Point2 o = ofs + Point2(j * (bsize + 1), 0);
+ if (j >= 5)
+ o.x += 1;
+
+ uint32_t idx = i * 10 + j;
+ bool on = value & (1 << idx);
+ Rect2 rect = Rect2(o, Size2(bsize, bsize));
+ draw_rect(rect, Color(0, 0, 0, on ? 0.8 : 0.3));
+ flag_rects.push_back(rect);
+ }
+ }
+ }
+ }
+
+ void set_flag(uint32_t p_flag) {
+ value = p_flag;
+ update();
+ }
+
+ static void _bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_gui_input"), &EditorPropertyLayersGrid::_gui_input);
+ ADD_SIGNAL(MethodInfo("flag_changed", PropertyInfo(Variant::INT, "flag")));
+ }
+
+ EditorPropertyLayersGrid() {
+ value = 0;
+ }
+};
+void EditorPropertyLayers::_grid_changed(uint32_t p_grid) {
+
+ emit_signal("property_changed", get_edited_property(), p_grid);
+}
+
+void EditorPropertyLayers::update_property() {
+
+ uint32_t value = get_edited_object()->get(get_edited_property());
+
+ grid->set_flag(value);
+}
+
+void EditorPropertyLayers::setup(LayerType p_layer_type) {
+
+ String basename;
+ switch (p_layer_type) {
+ case LAYER_RENDER_2D:
+ basename = "layer_names/2d_render";
+ break;
+ case LAYER_PHYSICS_2D:
+ basename = "layer_names/2d_physics";
+ break;
+ case LAYER_RENDER_3D:
+ basename = "layer_names/3d_render";
+ break;
+ case LAYER_PHYSICS_3D:
+ basename = "layer_names/3d_physics";
+ break;
+ }
+
+ Vector<String> names;
+ for (int i = 0; i < 20; i++) {
+ String name;
+
+ if (ProjectSettings::get_singleton()->has_setting(basename + "/layer_" + itos(i + 1))) {
+ name = ProjectSettings::get_singleton()->get(basename + "/layer_" + itos(i + 1));
+ }
+
+ if (name == "") {
+ name = "Layer " + itos(i + 1);
+ }
+
+ names.push_back(name);
+ }
+
+ grid->names = names;
+}
+
+void EditorPropertyLayers::_button_pressed() {
+
+ layers->clear();
+ for (int i = 0; i < 20; i++) {
+ if (i == 5 || i == 10 || i == 15) {
+ layers->add_separator();
+ }
+ layers->add_check_item(grid->names[i], i);
+ int idx = layers->get_item_index(i);
+ layers->set_item_checked(idx, grid->value & (1 << i));
+ }
+
+ Rect2 gp = button->get_global_rect();
+ layers->set_as_minsize();
+ Vector2 popup_pos = gp.position - Vector2(layers->get_combined_minimum_size().x, 0);
+ layers->set_global_position(popup_pos);
+ layers->popup();
+}
+
+void EditorPropertyLayers::_menu_pressed(int p_menu) {
+ if (grid->value & (1 << p_menu)) {
+ grid->value &= ~(1 << p_menu);
+ } else {
+ grid->value |= (1 << p_menu);
+ }
+ grid->update();
+ _grid_changed(grid->value);
+}
+
+void EditorPropertyLayers::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_grid_changed"), &EditorPropertyLayers::_grid_changed);
+ ClassDB::bind_method(D_METHOD("_button_pressed"), &EditorPropertyLayers::_button_pressed);
+ ClassDB::bind_method(D_METHOD("_menu_pressed"), &EditorPropertyLayers::_menu_pressed);
+}
+
+EditorPropertyLayers::EditorPropertyLayers() {
+
+ HBoxContainer *hb = memnew(HBoxContainer);
+ add_child(hb);
+ grid = memnew(EditorPropertyLayersGrid);
+ grid->connect("flag_changed", this, "_grid_changed");
+ grid->set_h_size_flags(SIZE_EXPAND_FILL);
+ hb->add_child(grid);
+ button = memnew(Button);
+ button->set_text("..");
+ button->connect("pressed", this, "_button_pressed");
+ hb->add_child(button);
+ set_bottom_editor(hb);
+ layers = memnew(PopupMenu);
+ add_child(layers);
+ layers->connect("id_pressed", this, "_menu_pressed");
+}
+///////////////////// INT /////////////////////////
+
+void EditorPropertyInteger::_value_changed(double val) {
+ if (setting)
+ return;
+ emit_signal("property_changed", get_edited_property(), int(val));
+}
+
+void EditorPropertyInteger::update_property() {
+ int val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin->set_value(val);
+ setting = false;
+}
+
+void EditorPropertyInteger::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyInteger::_value_changed);
+}
+
+void EditorPropertyInteger::setup(int p_min, int p_max, bool p_allow_greater, bool p_allow_lesser) {
+ spin->set_min(p_min);
+ spin->set_max(p_max);
+ spin->set_step(1);
+ spin->set_allow_greater(p_allow_greater);
+ spin->set_allow_lesser(p_allow_lesser);
+}
+
+EditorPropertyInteger::EditorPropertyInteger() {
+ spin = memnew(EditorSpinSlider);
+ add_child(spin);
+ add_focusable(spin);
+ spin->connect("value_changed", this, "_value_changed");
+ setting = false;
+}
+
+///////////////////// OBJECT ID /////////////////////////
+
+void EditorPropertyObjectID::_edit_pressed() {
+
+ emit_signal("object_id_selected", get_edited_property(), get_edited_object()->get(get_edited_property()));
+}
+
+void EditorPropertyObjectID::update_property() {
+ String type = base_type;
+ if (type == "")
+ type = "Object";
+
+ String icon_type = type;
+ if (has_icon(icon_type, "EditorIcons")) {
+ type = icon_type;
+ } else {
+ type = "Object";
+ }
+
+ ObjectID id = get_edited_object()->get(get_edited_property());
+ if (id != 0) {
+ edit->set_text(type + " ID: " + itos(id));
+ edit->set_disabled(false);
+ edit->set_icon(get_icon(icon_type, "EditorIcons"));
+ } else {
+ edit->set_text(TTR("[Empty]"));
+ edit->set_disabled(true);
+ edit->set_icon(Ref<Texture>());
+ }
+}
+
+void EditorPropertyObjectID::setup(const String &p_base_type) {
+ base_type = p_base_type;
+}
+
+void EditorPropertyObjectID::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_edit_pressed"), &EditorPropertyObjectID::_edit_pressed);
+}
+
+EditorPropertyObjectID::EditorPropertyObjectID() {
+ edit = memnew(Button);
+ add_child(edit);
+ add_focusable(edit);
+ edit->connect("pressed", this, "_edit_pressed");
+}
+
+///////////////////// FLOAT /////////////////////////
+
+void EditorPropertyFloat::_value_changed(double val) {
+ if (setting)
+ return;
+
+ emit_signal("property_changed", get_edited_property(), val);
+}
+
+void EditorPropertyFloat::update_property() {
+ double val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin->set_value(val);
+ setting = false;
+}
+
+void EditorPropertyFloat::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyFloat::_value_changed);
+}
+
+void EditorPropertyFloat::setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_exp_range, bool p_greater, bool p_lesser) {
+
+ spin->set_min(p_min);
+ spin->set_max(p_max);
+ spin->set_step(p_step);
+ spin->set_hide_slider(p_no_slider);
+ spin->set_exp_ratio(p_exp_range);
+ spin->set_allow_greater(p_greater);
+ spin->set_allow_lesser(p_lesser);
+}
+
+EditorPropertyFloat::EditorPropertyFloat() {
+ spin = memnew(EditorSpinSlider);
+ add_child(spin);
+ add_focusable(spin);
+ spin->connect("value_changed", this, "_value_changed");
+ setting = false;
+}
+
+///////////////////// EASING /////////////////////////
+
+void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
+
+ Ref<InputEventMouseMotion> mm = p_ev;
+
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
+
+ float rel = mm->get_relative().x;
+ if (rel == 0)
+ return;
+
+ if (flip)
+ rel = -rel;
+
+ float val = get_edited_object()->get(get_edited_property());
+ if (val == 0)
+ return;
+ bool sg = val < 0;
+ val = Math::absf(val);
+
+ val = Math::log(val) / Math::log((float)2.0);
+ //logspace
+ val += rel * 0.05;
+
+ val = Math::pow(2.0f, val);
+ if (sg)
+ val = -val;
+
+ emit_signal("property_changed", get_edited_property(), val);
+ easing_draw->update();
+ }
+}
+
+void EditorPropertyEasing::_draw_easing() {
+
+ RID ci = easing_draw->get_canvas_item();
+
+ Size2 s = easing_draw->get_size();
+ Rect2 r(Point2(), s);
+ r = r.grow(3);
+ get_stylebox("normal", "LineEdit")->draw(ci, r);
+
+ int points = 48;
+
+ float prev = 1.0;
+ float exp = get_edited_object()->get(get_edited_property());
+
+ Ref<Font> f = get_font("font", "Label");
+ Color color = get_color("font_color", "Label");
+
+ for (int i = 1; i <= points; i++) {
+
+ float ifl = i / float(points);
+ float iflp = (i - 1) / float(points);
+
+ float h = 1.0 - Math::ease(ifl, exp);
+
+ if (flip) {
+ ifl = 1.0 - ifl;
+ iflp = 1.0 - iflp;
+ }
+
+ VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(iflp * s.width, prev * s.height), Point2(ifl * s.width, h * s.height), color);
+ prev = h;
+ }
+
+ f->draw(ci, Point2(10, 10 + f->get_ascent()), String::num(exp, 2), color);
+}
+
+void EditorPropertyEasing::update_property() {
+ easing_draw->update();
+}
+
+void EditorPropertyEasing::_set_preset(float p_val) {
+ emit_signal("property_changed", get_edited_property(), p_val);
+ easing_draw->update();
+}
+
+void EditorPropertyEasing::setup(bool p_full, bool p_flip) {
+
+ flip = p_flip;
+ if (p_full) {
+ HBoxContainer *hb2 = memnew(HBoxContainer);
+ vb->add_child(hb2);
+ button_out_in = memnew(ToolButton);
+ button_out_in->set_tooltip(TTR("Out-In"));
+ button_out_in->set_h_size_flags(SIZE_EXPAND_FILL);
+ button_out_in->connect("pressed", this, "_set_preset", varray(-0.5));
+ hb2->add_child(button_out_in);
+
+ button_in_out = memnew(ToolButton);
+ button_in_out->set_tooltip(TTR("In"));
+ button_in_out->set_h_size_flags(SIZE_EXPAND_FILL);
+ button_in_out->connect("pressed", this, "_set_preset", varray(-2));
+ hb2->add_child(button_in_out);
+ }
+}
+
+void EditorPropertyEasing::_notification(int p_what) {
+
+ switch (p_what) {
+ case NOTIFICATION_THEME_CHANGED:
+ case NOTIFICATION_ENTER_TREE: {
+ easing_draw->set_custom_minimum_size(Size2(0, get_font("font", "Label")->get_height() * 2));
+ button_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
+ button_out->set_icon(get_icon("CurveOut", "EditorIcons"));
+ button_in->set_icon(get_icon("CurveIn", "EditorIcons"));
+ button_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
+ if (button_out_in)
+ button_out_in->set_icon(get_icon("CurveOutIn", "EditorIcons"));
+ if (button_in_out)
+ button_in_out->set_icon(get_icon("CurveInOut", "EditorIcons"));
+ } break;
+ }
+}
+
+void EditorPropertyEasing::_bind_methods() {
+
+ ClassDB::bind_method("_draw_easing", &EditorPropertyEasing::_draw_easing);
+ ClassDB::bind_method("_drag_easing", &EditorPropertyEasing::_drag_easing);
+ ClassDB::bind_method("_set_preset", &EditorPropertyEasing::_set_preset);
+}
+
+EditorPropertyEasing::EditorPropertyEasing() {
+
+ vb = memnew(VBoxContainer);
+ add_child(vb);
+ HBoxContainer *hb = memnew(HBoxContainer);
+ set_label_reference(hb);
+
+ vb->add_child(hb);
+
+ button_linear = memnew(ToolButton);
+ button_linear->set_tooltip(TTR("Linear"));
+ button_linear->set_h_size_flags(SIZE_EXPAND_FILL);
+ button_linear->connect("pressed", this, "_set_preset", varray(1));
+ hb->add_child(button_linear);
+
+ button_constant = memnew(ToolButton);
+ button_constant->set_tooltip(TTR("Linear"));
+ button_constant->set_h_size_flags(SIZE_EXPAND_FILL);
+ button_constant->connect("pressed", this, "_set_preset", varray(0));
+ hb->add_child(button_constant);
+
+ button_out = memnew(ToolButton);
+ button_out->set_tooltip(TTR("Out"));
+ button_out->set_h_size_flags(SIZE_EXPAND_FILL);
+ button_out->connect("pressed", this, "_set_preset", varray(0.5));
+ hb->add_child(button_out);
+
+ button_in = memnew(ToolButton);
+ button_in->set_tooltip(TTR("In"));
+ button_in->set_h_size_flags(SIZE_EXPAND_FILL);
+ button_in->connect("pressed", this, "_set_preset", varray(2));
+ hb->add_child(button_in);
+
+ button_in_out = NULL;
+ button_out_in = NULL;
+
+ easing_draw = memnew(Control);
+ easing_draw->connect("draw", this, "_draw_easing");
+ easing_draw->connect("gui_input", this, "_drag_easing");
+ easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE);
+ vb->add_child(easing_draw);
+
+ flip = false;
+}
+
+///////////////////// VECTOR2 /////////////////////////
+
+void EditorPropertyVector2::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Vector2 v2;
+ v2.x = spin[0]->get_value();
+ v2.y = spin[1]->get_value();
+ emit_signal("property_changed", get_edited_property(), v2);
+}
+
+void EditorPropertyVector2::update_property() {
+ Vector2 val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.x);
+ spin[1]->set_value(val.y);
+ setting = false;
+}
+
+void EditorPropertyVector2::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyVector2::_value_changed);
+}
+
+void EditorPropertyVector2::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 2; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyVector2::EditorPropertyVector2() {
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
+ static const char *desc[2] = { "x", "y" };
+ for (int i = 0; i < 2; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ vb->add_child(spin[i]);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_label_reference(spin[0]); //show text and buttons around this
+ setting = false;
+}
+
+///////////////////// RECT2 /////////////////////////
+
+void EditorPropertyRect2::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Rect2 r2;
+ r2.position.x = spin[0]->get_value();
+ r2.position.y = spin[1]->get_value();
+ r2.size.x = spin[2]->get_value();
+ r2.size.y = spin[3]->get_value();
+ emit_signal("property_changed", get_edited_property(), r2);
+}
+
+void EditorPropertyRect2::update_property() {
+ Rect2 val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.position.x);
+ spin[1]->set_value(val.position.y);
+ spin[2]->set_value(val.size.x);
+ spin[3]->set_value(val.size.y);
+ setting = false;
+}
+
+void EditorPropertyRect2::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyRect2::_value_changed);
+}
+
+void EditorPropertyRect2::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 4; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyRect2::EditorPropertyRect2() {
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
+ static const char *desc[4] = { "x", "y", "w", "h" };
+ for (int i = 0; i < 4; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ vb->add_child(spin[i]);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_label_reference(spin[0]); //show text and buttons around this
+ setting = false;
+}
+///////////////////// VECTOR3 /////////////////////////
+
+void EditorPropertyVector3::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Vector3 v3;
+ v3.x = spin[0]->get_value();
+ v3.y = spin[1]->get_value();
+ v3.z = spin[2]->get_value();
+ emit_signal("property_changed", get_edited_property(), v3);
+}
+
+void EditorPropertyVector3::update_property() {
+ Vector3 val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.x);
+ spin[1]->set_value(val.y);
+ spin[2]->set_value(val.z);
+ setting = false;
+}
+
+void EditorPropertyVector3::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyVector3::_value_changed);
+}
+
+void EditorPropertyVector3::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 3; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyVector3::EditorPropertyVector3() {
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
+ static const char *desc[3] = { "x", "y", "z" };
+ for (int i = 0; i < 3; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ vb->add_child(spin[i]);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_label_reference(spin[0]); //show text and buttons around this
+ setting = false;
+}
+///////////////////// PLANE /////////////////////////
+
+void EditorPropertyPlane::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Plane p;
+ p.normal.x = spin[0]->get_value();
+ p.normal.y = spin[1]->get_value();
+ p.normal.z = spin[2]->get_value();
+ p.d = spin[3]->get_value();
+ emit_signal("property_changed", get_edited_property(), p);
+}
+
+void EditorPropertyPlane::update_property() {
+ Plane val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.normal.x);
+ spin[1]->set_value(val.normal.y);
+ spin[2]->set_value(val.normal.z);
+ spin[3]->set_value(val.d);
+ setting = false;
+}
+
+void EditorPropertyPlane::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyPlane::_value_changed);
+}
+
+void EditorPropertyPlane::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 4; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyPlane::EditorPropertyPlane() {
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
+ static const char *desc[4] = { "x", "y", "z", "d" };
+ for (int i = 0; i < 4; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ vb->add_child(spin[i]);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_label_reference(spin[0]); //show text and buttons around this
+ setting = false;
+}
+
+///////////////////// QUAT /////////////////////////
+
+void EditorPropertyQuat::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Quat p;
+ p.x = spin[0]->get_value();
+ p.y = spin[1]->get_value();
+ p.z = spin[2]->get_value();
+ p.w = spin[3]->get_value();
+ emit_signal("property_changed", get_edited_property(), p);
+}
+
+void EditorPropertyQuat::update_property() {
+ Quat val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.x);
+ spin[1]->set_value(val.y);
+ spin[2]->set_value(val.z);
+ spin[3]->set_value(val.w);
+ setting = false;
+}
+
+void EditorPropertyQuat::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyQuat::_value_changed);
+}
+
+void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 4; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyQuat::EditorPropertyQuat() {
+ VBoxContainer *vb = memnew(VBoxContainer);
+ add_child(vb);
+ static const char *desc[4] = { "x", "y", "z", "w" };
+ for (int i = 0; i < 4; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ vb->add_child(spin[i]);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_label_reference(spin[0]); //show text and buttons around this
+ setting = false;
+}
+
+///////////////////// AABB /////////////////////////
+
+void EditorPropertyAABB::_value_changed(double val) {
+ if (setting)
+ return;
+
+ AABB p;
+ p.position.x = spin[0]->get_value();
+ p.position.y = spin[1]->get_value();
+ p.position.z = spin[2]->get_value();
+ p.size.x = spin[3]->get_value();
+ p.size.y = spin[4]->get_value();
+ p.size.z = spin[5]->get_value();
+
+ emit_signal("property_changed", get_edited_property(), p);
+}
+
+void EditorPropertyAABB::update_property() {
+ AABB val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.position.x);
+ spin[1]->set_value(val.position.y);
+ spin[2]->set_value(val.position.z);
+ spin[3]->set_value(val.size.x);
+ spin[4]->set_value(val.size.y);
+ spin[5]->set_value(val.size.z);
+
+ setting = false;
+}
+
+void EditorPropertyAABB::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyAABB::_value_changed);
+}
+
+void EditorPropertyAABB::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 6; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyAABB::EditorPropertyAABB() {
+ GridContainer *g = memnew(GridContainer);
+ g->set_columns(3);
+ add_child(g);
+
+ static const char *desc[6] = { "x", "y", "z", "w", "h", "d" };
+ for (int i = 0; i < 6; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ g->add_child(spin[i]);
+ spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_bottom_editor(g);
+ setting = false;
+}
+
+///////////////////// TRANSFORM2D /////////////////////////
+
+void EditorPropertyTransform2D::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Transform2D p;
+ p[0][0] = spin[0]->get_value();
+ p[0][1] = spin[1]->get_value();
+ p[1][0] = spin[2]->get_value();
+ p[1][1] = spin[3]->get_value();
+ p[2][0] = spin[4]->get_value();
+ p[2][1] = spin[5]->get_value();
+
+ emit_signal("property_changed", get_edited_property(), p);
+}
+
+void EditorPropertyTransform2D::update_property() {
+ Transform2D val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val[0][0]);
+ spin[1]->set_value(val[0][1]);
+ spin[2]->set_value(val[1][0]);
+ spin[3]->set_value(val[1][1]);
+ spin[4]->set_value(val[2][0]);
+ spin[5]->set_value(val[2][1]);
+
+ setting = false;
+}
+
+void EditorPropertyTransform2D::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyTransform2D::_value_changed);
+}
+
+void EditorPropertyTransform2D::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 6; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyTransform2D::EditorPropertyTransform2D() {
+ GridContainer *g = memnew(GridContainer);
+ g->set_columns(2);
+ add_child(g);
+
+ static const char *desc[6] = { "xx", "xy", "yx", "yy", "ox", "oy" };
+ for (int i = 0; i < 6; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ g->add_child(spin[i]);
+ spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_bottom_editor(g);
+ setting = false;
+}
+
+///////////////////// BASIS /////////////////////////
+
+void EditorPropertyBasis::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Basis p;
+ p[0][0] = spin[0]->get_value();
+ p[1][0] = spin[1]->get_value();
+ p[2][0] = spin[2]->get_value();
+ p[0][1] = spin[3]->get_value();
+ p[1][1] = spin[4]->get_value();
+ p[2][1] = spin[5]->get_value();
+ p[0][2] = spin[6]->get_value();
+ p[1][2] = spin[7]->get_value();
+ p[2][2] = spin[8]->get_value();
+
+ emit_signal("property_changed", get_edited_property(), p);
+}
+
+void EditorPropertyBasis::update_property() {
+ Basis val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val[0][0]);
+ spin[1]->set_value(val[1][0]);
+ spin[2]->set_value(val[2][0]);
+ spin[3]->set_value(val[0][1]);
+ spin[4]->set_value(val[1][1]);
+ spin[5]->set_value(val[2][1]);
+ spin[6]->set_value(val[0][2]);
+ spin[7]->set_value(val[1][2]);
+ spin[8]->set_value(val[2][2]);
+
+ setting = false;
+}
+
+void EditorPropertyBasis::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyBasis::_value_changed);
+}
+
+void EditorPropertyBasis::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 9; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyBasis::EditorPropertyBasis() {
+ GridContainer *g = memnew(GridContainer);
+ g->set_columns(3);
+ add_child(g);
+
+ static const char *desc[9] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" };
+ for (int i = 0; i < 9; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ g->add_child(spin[i]);
+ spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_bottom_editor(g);
+ setting = false;
+}
+
+///////////////////// TRANSFORM /////////////////////////
+
+void EditorPropertyTransform::_value_changed(double val) {
+ if (setting)
+ return;
+
+ Transform p;
+ p.basis[0][0] = spin[0]->get_value();
+ p.basis[1][0] = spin[1]->get_value();
+ p.basis[2][0] = spin[2]->get_value();
+ p.basis[0][1] = spin[3]->get_value();
+ p.basis[1][1] = spin[4]->get_value();
+ p.basis[2][1] = spin[5]->get_value();
+ p.basis[0][2] = spin[6]->get_value();
+ p.basis[1][2] = spin[7]->get_value();
+ p.basis[2][2] = spin[8]->get_value();
+ p.origin[0] = spin[9]->get_value();
+ p.origin[1] = spin[10]->get_value();
+ p.origin[2] = spin[11]->get_value();
+
+ emit_signal("property_changed", get_edited_property(), p);
+}
+
+void EditorPropertyTransform::update_property() {
+ Transform val = get_edited_object()->get(get_edited_property());
+ setting = true;
+ spin[0]->set_value(val.basis[0][0]);
+ spin[1]->set_value(val.basis[1][0]);
+ spin[2]->set_value(val.basis[2][0]);
+ spin[3]->set_value(val.basis[0][1]);
+ spin[4]->set_value(val.basis[1][1]);
+ spin[5]->set_value(val.basis[2][1]);
+ spin[6]->set_value(val.basis[0][2]);
+ spin[7]->set_value(val.basis[1][2]);
+ spin[8]->set_value(val.basis[2][2]);
+ spin[9]->set_value(val.origin[0]);
+ spin[10]->set_value(val.origin[1]);
+ spin[11]->set_value(val.origin[2]);
+
+ setting = false;
+}
+
+void EditorPropertyTransform::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyTransform::_value_changed);
+}
+
+void EditorPropertyTransform::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+ for (int i = 0; i < 12; i++) {
+ spin[i]->set_min(p_min);
+ spin[i]->set_max(p_max);
+ spin[i]->set_step(p_step);
+ spin[i]->set_hide_slider(p_no_slider);
+ }
+}
+
+EditorPropertyTransform::EditorPropertyTransform() {
+ GridContainer *g = memnew(GridContainer);
+ g->set_columns(3);
+ add_child(g);
+
+ static const char *desc[12] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz", "ox", "oy", "oz" };
+ for (int i = 0; i < 12; i++) {
+ spin[i] = memnew(EditorSpinSlider);
+ spin[i]->set_label(desc[i]);
+ g->add_child(spin[i]);
+ spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_focusable(spin[i]);
+ spin[i]->connect("value_changed", this, "_value_changed");
+ }
+ set_bottom_editor(g);
+ setting = false;
+}
+
+////////////// COLOR PICKER //////////////////////
+
+void EditorPropertyColor::_color_changed(const Color &p_color) {
+
+ emit_signal("property_changed", get_edited_property(), p_color);
+}
+
+void EditorPropertyColor::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_color_changed"), &EditorPropertyColor::_color_changed);
+}
+
+void EditorPropertyColor::update_property() {
+
+ picker->set_pick_color(get_edited_object()->get(get_edited_property()));
+}
+
+void EditorPropertyColor::setup(bool p_show_alpha) {
+ picker->set_edit_alpha(p_show_alpha);
+}
+
+EditorPropertyColor::EditorPropertyColor() {
+
+ picker = memnew(ColorPickerButton);
+ add_child(picker);
+ picker->set_flat(true);
+ picker->connect("color_changed", this, "_color_changed");
+}
+
+////////////// NODE PATH //////////////////////
+
+void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
+
+ Node *base_node = Object::cast_to<Node>(get_edited_object());
+ emit_signal("property_changed", get_edited_property(), base_node->get_path().rel_path_to(p_path));
+ update_property();
+}
+
+void EditorPropertyNodePath::_node_assign() {
+ if (!scene_tree) {
+ scene_tree = memnew(SceneTreeDialog);
+ scene_tree->get_scene_tree()->set_show_enabled_subscene(true);
+ scene_tree->get_scene_tree()->set_valid_types(valid_types);
+ add_child(scene_tree);
+ scene_tree->connect("selected", this, "_node_selected");
+ }
+ scene_tree->popup_centered_ratio();
+}
+
+void EditorPropertyNodePath::_node_clear() {
+
+ emit_signal("property_changed", get_edited_property(), NodePath());
+ update_property();
+}
+
+void EditorPropertyNodePath::update_property() {
+
+ NodePath p = get_edited_object()->get(get_edited_property());
+
+ assign->set_tooltip(p);
+ if (p == NodePath()) {
+ assign->set_icon(Ref<Texture>());
+ assign->set_text(TTR("Assign.."));
+ assign->set_flat(false);
+ return;
+ }
+ assign->set_flat(true);
+
+ Node *base_node = NULL;
+ if (base_hint != NodePath()) {
+ if (get_tree()->get_root()->has_node(base_hint)) {
+ base_node = get_tree()->get_root()->get_node(base_hint);
+ }
+ } else {
+ base_node = Object::cast_to<Node>(get_edited_object());
+ }
+
+ if (!base_node || !base_node->has_node(p)) {
+ assign->set_icon(Ref<Texture>());
+ assign->set_text(p);
+ return;
+ }
+
+ Node *target_node = base_node->get_node(p);
+ ERR_FAIL_COND(!target_node);
+
+ assign->set_text(target_node->get_name());
+
+ Ref<Texture> icon;
+ if (has_icon(target_node->get_class(), "EditorIcons"))
+ icon = get_icon(target_node->get_class(), "EditorIcons");
+ else
+ icon = get_icon("Node", "EditorIcons");
+
+ assign->set_icon(icon);
+}
+
+void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types) {
+
+ base_hint = p_base_hint;
+ valid_types = p_valid_types;
+}
+
+void EditorPropertyNodePath::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ Ref<Texture> t = get_icon("Clear", "EditorIcons");
+ clear->set_icon(t);
+ }
+}
+
+void EditorPropertyNodePath::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_node_selected"), &EditorPropertyNodePath::_node_selected);
+ ClassDB::bind_method(D_METHOD("_node_assign"), &EditorPropertyNodePath::_node_assign);
+ ClassDB::bind_method(D_METHOD("_node_clear"), &EditorPropertyNodePath::_node_clear);
+}
+
+EditorPropertyNodePath::EditorPropertyNodePath() {
+
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ add_child(hbc);
+ assign = memnew(Button);
+ assign->set_flat(true);
+ assign->set_h_size_flags(SIZE_EXPAND_FILL);
+ assign->set_clip_text(true);
+ assign->connect("pressed", this, "_node_assign");
+ hbc->add_child(assign);
+
+ clear = memnew(Button);
+ clear->set_flat(true);
+ clear->connect("pressed", this, "_node_clear");
+ hbc->add_child(clear);
+
+ scene_tree = NULL; //do not allocate unnecesarily
+}
+
+////////////// RESOURCE //////////////////////
+
+void EditorPropertyResource::_file_selected(const String &p_path) {
+
+ RES res = ResourceLoader::load(p_path);
+ emit_signal("property_changed", get_edited_property(), res);
+ update_property();
+}
+
+void EditorPropertyResource::_menu_option(int p_which) {
+
+ // scene_tree->popup_centered_ratio();
+ switch (p_which) {
+ case OBJ_MENU_LOAD: {
+
+ if (!file) {
+ file = memnew(EditorFileDialog);
+ file->connect("file_selected", this, "_file_selected");
+ add_child(file);
+ }
+ file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+ String type = base_type;
+
+ List<String> extensions;
+ for (int i = 0; i < type.get_slice_count(","); i++) {
+
+ ResourceLoader::get_recognized_extensions_for_type(type.get_slice(",", i), &extensions);
+ }
+
+ Set<String> valid_extensions;
+ for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
+ valid_extensions.insert(E->get());
+ }
+
+ file->clear_filters();
+ for (Set<String>::Element *E = valid_extensions.front(); E; E = E->next()) {
+
+ file->add_filter("*." + E->get() + " ; " + E->get().to_upper());
+ }
+
+ file->popup_centered_ratio();
+ } break;
+
+ case OBJ_MENU_EDIT: {
+
+ RES res = get_edited_object()->get(get_edited_property());
+
+ if (!res.is_null()) {
+
+ emit_signal("resource_selected", get_edited_property(), res);
+ }
+ } break;
+ case OBJ_MENU_CLEAR: {
+
+ emit_signal("property_changed", get_edited_property(), RES());
+ update_property();
+
+ } break;
+
+ case OBJ_MENU_MAKE_UNIQUE: {
+
+ RES res_orig = get_edited_object()->get(get_edited_property());
+ if (res_orig.is_null())
+ return;
+
+ List<PropertyInfo> property_list;
+ res_orig->get_property_list(&property_list);
+ List<Pair<String, Variant> > propvalues;
+
+ for (List<PropertyInfo>::Element *E = property_list.front(); E; E = E->next()) {
+
+ Pair<String, Variant> p;
+ PropertyInfo &pi = E->get();
+ if (pi.usage & PROPERTY_USAGE_STORAGE) {
+
+ p.first = pi.name;
+ p.second = res_orig->get(pi.name);
+ }
+
+ propvalues.push_back(p);
+ }
+
+ String orig_type = res_orig->get_class();
+
+ Object *inst = ClassDB::instance(orig_type);
+
+ Ref<Resource> res = Ref<Resource>(Object::cast_to<Resource>(inst));
+
+ ERR_FAIL_COND(res.is_null());
+
+ for (List<Pair<String, Variant> >::Element *E = propvalues.front(); E; E = E->next()) {
+
+ Pair<String, Variant> &p = E->get();
+ res->set(p.first, p.second);
+ }
+
+ emit_signal("property_changed", get_edited_property(), res);
+ update_property();
+
+ } break;
+
+ case OBJ_MENU_COPY: {
+ RES res = get_edited_object()->get(get_edited_property());
+
+ EditorSettings::get_singleton()->set_resource_clipboard(res);
+
+ } break;
+ case OBJ_MENU_PASTE: {
+
+ RES res = EditorSettings::get_singleton()->get_resource_clipboard();
+ emit_signal("property_changed", get_edited_property(), res);
+ update_property();
+
+ } break;
+ case OBJ_MENU_NEW_SCRIPT: {
+
+ if (Object::cast_to<Node>(get_edited_object())) {
+ EditorNode::get_singleton()->get_scene_tree_dock()->open_script_dialog(Object::cast_to<Node>(get_edited_object()));
+ }
+
+ } break;
+ case OBJ_MENU_SHOW_IN_FILE_SYSTEM: {
+ RES res = get_edited_object()->get(get_edited_property());
+
+ FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
+ file_system_dock->navigate_to_path(res->get_path());
+ // Ensure that the FileSystem dock is visible.
+ TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
+ tab_container->set_current_tab(file_system_dock->get_position_in_parent());
+ } break;
+ default: {
+
+ RES res = get_edited_object()->get(get_edited_property());
+
+ if (p_which >= CONVERT_BASE_ID) {
+
+ int to_type = p_which - CONVERT_BASE_ID;
+
+ Vector<Ref<EditorResourceConversionPlugin> > conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(res);
+
+ ERR_FAIL_INDEX(to_type, conversions.size());
+
+ Ref<Resource> new_res = conversions[to_type]->convert(res);
+
+ emit_signal("property_changed", get_edited_property(), new_res);
+ update_property();
+ break;
+ }
+ ERR_FAIL_COND(inheritors_array.empty());
+
+ String intype = inheritors_array[p_which - TYPE_BASE_ID];
+
+ if (intype == "ViewportTexture") {
+
+ if (!scene_tree) {
+ scene_tree = memnew(SceneTreeDialog);
+ scene_tree->get_scene_tree()->set_show_enabled_subscene(true);
+ add_child(scene_tree);
+ scene_tree->connect("selected", this, "_viewport_selected");
+ scene_tree->set_title(TTR("Pick a Viewport"));
+ }
+ scene_tree->popup_centered_ratio();
+
+ return;
+ }
+
+ Object *obj = ClassDB::instance(intype);
+
+ if (!obj) {
+ obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
+ }
+
+ ERR_BREAK(!obj);
+ Resource *resp = Object::cast_to<Resource>(obj);
+ ERR_BREAK(!resp);
+ if (get_edited_object() && base_type != String() && base_type == "Script") {
+ //make visual script the right type
+ res->call("set_instance_base_type", get_edited_object()->get_class());
+ }
+
+ res = Ref<Resource>(resp);
+ emit_signal("property_changed", get_edited_property(), res);
+ update_property();
+
+ } break;
+ }
+}
+
+void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture> &p_preview, ObjectID p_obj) {
+
+ RES p = get_edited_object()->get(get_edited_property());
+ if (p.is_valid() && p->get_instance_id() == p_obj) {
+ if (p_preview.is_valid()) {
+ assign->set_icon(p_preview);
+ }
+ }
+}
+
+void EditorPropertyResource::_update_menu() {
+ //////////////////// UPDATE MENU //////////////////////////
+ RES res = get_edited_object()->get(get_edited_property());
+
+ menu->clear();
+
+ if (get_edited_property() == "script" && base_type == "Script" && Object::cast_to<Node>(get_edited_object())) {
+ menu->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT);
+ menu->add_separator();
+ } else if (base_type != "") {
+ int idx = 0;
+
+ Vector<EditorData::CustomType> custom_resources;
+
+ if (EditorNode::get_editor_data().get_custom_types().has("Resource")) {
+ custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"];
+ }
+
+ for (int i = 0; i < base_type.get_slice_count(","); i++) {
+
+ String base = base_type.get_slice(",", i);
+
+ Set<String> valid_inheritors;
+ valid_inheritors.insert(base);
+ List<StringName> inheritors;
+ ClassDB::get_inheriters_from_class(base.strip_edges(), &inheritors);
+
+ for (int i = 0; i < custom_resources.size(); i++) {
+ inheritors.push_back(custom_resources[i].name);
+ }
+
+ List<StringName>::Element *E = inheritors.front();
+ while (E) {
+ valid_inheritors.insert(E->get());
+ E = E->next();
+ }
+
+ for (Set<String>::Element *E = valid_inheritors.front(); E; E = E->next()) {
+ String t = E->get();
+
+ bool is_custom_resource = false;
+ Ref<Texture> icon;
+ if (!custom_resources.empty()) {
+ for (int i = 0; i < custom_resources.size(); i++) {
+ if (custom_resources[i].name == t) {
+ is_custom_resource = true;
+ if (custom_resources[i].icon.is_valid())
+ icon = custom_resources[i].icon;
+ break;
+ }
+ }
+ }
+
+ if (!is_custom_resource && !ClassDB::can_instance(t))
+ continue;
+
+ inheritors_array.push_back(t);
+
+ int id = TYPE_BASE_ID + idx;
+
+ if (!icon.is_valid() && has_icon(t, "EditorIcons")) {
+ icon = get_icon(t, "EditorIcons");
+ }
+
+ if (icon.is_valid()) {
+
+ menu->add_icon_item(icon, vformat(TTR("New %s"), t), id);
+ } else {
+
+ menu->add_item(vformat(TTR("New %s"), t), id);
+ }
+
+ idx++;
+ }
+ }
+
+ if (menu->get_item_count())
+ menu->add_separator();
+ }
+
+ menu->add_icon_item(get_icon("Load", "EditorIcons"), TTR("Load"), OBJ_MENU_LOAD);
+
+ if (!res.is_null()) {
+
+ menu->add_icon_item(get_icon("Edit", "EditorIcons"), TTR("Edit"), OBJ_MENU_EDIT);
+ menu->add_icon_item(get_icon("Clear", "EditorIcons"), TTR("Clear"), OBJ_MENU_CLEAR);
+ menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Make Unique"), OBJ_MENU_MAKE_UNIQUE);
+ RES r = res;
+ if (r.is_valid() && r->get_path().is_resource_file()) {
+ menu->add_separator();
+ menu->add_item(TTR("Show in File System"), OBJ_MENU_SHOW_IN_FILE_SYSTEM);
+ }
+ } else {
+ }
+
+ RES cb = EditorSettings::get_singleton()->get_resource_clipboard();
+ bool paste_valid = false;
+ if (cb.is_valid()) {
+ if (base_type == "")
+ paste_valid = true;
+ else
+ for (int i = 0; i < base_type.get_slice_count(","); i++)
+ if (ClassDB::is_parent_class(cb->get_class(), base_type.get_slice(",", i))) {
+ paste_valid = true;
+ break;
+ }
+ }
+
+ if (!res.is_null() || paste_valid) {
+ menu->add_separator();
+
+ if (!res.is_null()) {
+
+ menu->add_item(TTR("Copy"), OBJ_MENU_COPY);
+ }
+
+ if (paste_valid) {
+
+ menu->add_item(TTR("Paste"), OBJ_MENU_PASTE);
+ }
+ }
+
+ if (!res.is_null()) {
+
+ Vector<Ref<EditorResourceConversionPlugin> > conversions = EditorNode::get_singleton()->find_resource_conversion_plugin(res);
+ if (conversions.size()) {
+ menu->add_separator();
+ }
+ for (int i = 0; i < conversions.size(); i++) {
+ String what = conversions[i]->converts_to();
+ Ref<Texture> icon;
+ if (has_icon(what, "EditorIcons")) {
+
+ icon = get_icon(what, "EditorIcons");
+ } else {
+
+ icon = get_icon(what, "Resource");
+ }
+
+ menu->add_icon_item(icon, vformat(TTR("Convert To %s"), what), CONVERT_BASE_ID + i);
+ }
+ }
+
+ Rect2 gt = edit->get_global_rect();
+ menu->set_as_minsize();
+ int ms = menu->get_combined_minimum_size().width;
+ Vector2 popup_pos = gt.position + gt.size - Vector2(ms, 0);
+ menu->set_global_position(popup_pos);
+ menu->popup();
+}
+
+void EditorPropertyResource::_sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool) {
+
+ emit_signal("property_keyed_with_value", String(get_edited_property()) + ":" + p_property, p_value);
+}
+
+void EditorPropertyResource::_sub_inspector_resource_selected(const RES &p_resource, const String &p_property) {
+
+ emit_signal("resource_selected", String(get_edited_property()) + ":" + p_property, p_resource);
+}
+
+void EditorPropertyResource::_sub_inspector_object_id_selected(int p_id) {
+
+ emit_signal("object_id_selected", get_edited_property(), p_id);
+}
+
+void EditorPropertyResource::_open_editor_pressed() {
+ RES res = get_edited_object()->get(get_edited_property());
+ if (res.is_valid()) {
+ EditorNode::get_singleton()->edit_item(res.ptr());
+ }
+}
+
+void EditorPropertyResource::update_property() {
+
+ RES res = get_edited_object()->get(get_edited_property());
+
+ if (use_sub_inspector) {
+
+ if (res.is_valid() != assign->is_toggle_mode()) {
+ assign->set_toggle_mode(res.is_valid());
+ }
+#ifdef TOOLS_ENABLED
+ if (res.is_valid() && get_edited_object()->editor_is_section_unfolded(get_edited_property())) {
+
+ if (!sub_inspector) {
+ sub_inspector = memnew(EditorInspector);
+ sub_inspector->set_enable_v_scroll(false);
+
+ sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed");
+ sub_inspector->connect("resource_selected", this, "_sub_inspector_resource_selected");
+ sub_inspector->connect("object_id_selected", this, "_sub_inspector_object_id_selected");
+ sub_inspector->set_keying(is_keying());
+ sub_inspector->set_read_only(is_read_only());
+ sub_inspector->set_use_folding(is_using_folding());
+
+ sub_inspector_vbox = memnew(VBoxContainer);
+ add_child(sub_inspector_vbox);
+ set_bottom_editor(sub_inspector_vbox);
+
+ sub_inspector_vbox->add_child(sub_inspector);
+ assign->set_pressed(true);
+
+ bool use_editor = false;
+ for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
+ EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
+ if (ep->handles(res.ptr())) {
+ use_editor = true;
+ }
+ }
+
+ if (use_editor) {
+ Button *open_in_editor = memnew(Button);
+ open_in_editor->set_text(TTR("Open Editor"));
+ open_in_editor->set_icon(get_icon("Edit", "EditorIcons"));
+ sub_inspector_vbox->add_child(open_in_editor);
+ open_in_editor->connect("pressed", this, "_open_editor_pressed");
+ open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
+ }
+ }
+
+ if (res.ptr() != sub_inspector->get_edited_object()) {
+ sub_inspector->edit(res.ptr());
+ }
+
+ } else {
+ if (sub_inspector) {
+ set_bottom_editor(NULL);
+ memdelete(sub_inspector_vbox);
+ sub_inspector = NULL;
+ sub_inspector_vbox = NULL;
+ }
+ }
+#endif
+ }
+
+ if (res == RES()) {
+ assign->set_icon(Ref<Texture>());
+ assign->set_text(TTR("[empty]"));
+ } else {
+
+ Ref<Texture> icon;
+ if (has_icon(res->get_class(), "EditorIcons"))
+ icon = get_icon(res->get_class(), "EditorIcons");
+ else
+ icon = get_icon("Node", "EditorIcons");
+
+ assign->set_icon(icon);
+
+ if (res->get_name() != String()) {
+ assign->set_text(res->get_name());
+ } else if (res->get_path().is_resource_file()) {
+ assign->set_text(res->get_name());
+ assign->set_tooltip(res->get_path());
+ } else {
+ assign->set_text(res->get_class());
+ }
+
+ if (res->get_path().is_resource_file()) {
+ assign->set_tooltip(res->get_path());
+ }
+
+ //preview will override the above, so called at the end
+ EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview", res->get_instance_id());
+ }
+}
+
+void EditorPropertyResource::_resource_selected() {
+ RES res = get_edited_object()->get(get_edited_property());
+
+ if (res.is_null()) {
+ _update_menu();
+ return;
+ }
+
+ if (use_sub_inspector) {
+
+ get_edited_object()->editor_set_section_unfold(get_edited_property(), assign->is_pressed());
+ update_property();
+ } else {
+
+ emit_signal("resource_selected", get_edited_property(), res);
+ }
+}
+
+void EditorPropertyResource::setup(const String &p_base_type) {
+ base_type = p_base_type;
+}
+
+void EditorPropertyResource::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ Ref<Texture> t = get_icon("select_arrow", "Tree");
+ edit->set_icon(t);
+ }
+
+ if (p_what == NOTIFICATION_DRAG_BEGIN) {
+
+ if (is_visible_in_tree()) {
+ if (_is_drop_valid(get_viewport()->gui_get_drag_data())) {
+ dropping = true;
+ assign->update();
+ }
+ }
+ }
+
+ if (p_what == NOTIFICATION_DRAG_END) {
+ if (dropping) {
+ dropping = false;
+ assign->update();
+ }
+ }
+}
+
+void EditorPropertyResource::_viewport_selected(const NodePath &p_path) {
+
+ Node *to_node = get_node(p_path);
+ if (!Object::cast_to<Viewport>(to_node)) {
+ EditorNode::get_singleton()->show_warning(TTR("Selected node is not a Viewport!"));
+ return;
+ }
+
+ Ref<ViewportTexture> vt;
+ vt.instance();
+ vt->set_viewport_path_in_scene(get_tree()->get_edited_scene_root()->get_path_to(to_node));
+ vt->setup_local_to_scene();
+
+ emit_signal("property_changed", get_edited_property(), vt);
+ update_property();
+}
+
+void EditorPropertyResource::collapse_all_folding() {
+ if (sub_inspector) {
+ sub_inspector->collapse_all_folding();
+ }
+}
+
+void EditorPropertyResource::expand_all_folding() {
+
+ if (sub_inspector) {
+ sub_inspector->expand_all_folding();
+ }
+}
+
+void EditorPropertyResource::_button_draw() {
+
+ if (dropping) {
+ Color color = get_color("accent_color", "Editor");
+ assign->draw_rect(Rect2(Point2(), assign->get_size()), color, false);
+ }
+}
+
+Variant EditorPropertyResource::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
+
+ RES res = get_edited_object()->get(get_edited_property());
+ if (res.is_valid()) {
+
+ return EditorNode::get_singleton()->drag_resource(res, p_from);
+ }
+
+ return Variant();
+}
+
+bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const {
+
+ String allowed_type = base_type;
+
+ Dictionary drag_data = p_drag_data;
+ if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ Ref<Resource> res = drag_data["resource"];
+ for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
+ String at = allowed_type.get_slice(",", i).strip_edges();
+ if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) {
+ return true;
+ }
+ }
+ }
+
+ if (drag_data.has("type") && String(drag_data["type"]) == "files") {
+
+ Vector<String> files = drag_data["files"];
+
+ if (files.size() == 1) {
+ String file = files[0];
+ String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
+
+ if (ftype != "") {
+
+ for (int i = 0; i < allowed_type.get_slice_count(","); i++) {
+ String at = allowed_type.get_slice(",", i).strip_edges();
+ if (ClassDB::is_parent_class(ftype, at)) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+bool EditorPropertyResource::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
+
+ return _is_drop_valid(p_data);
+}
+void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
+
+ ERR_FAIL_COND(!_is_drop_valid(p_data));
+
+ Dictionary drag_data = p_data;
+ if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ Ref<Resource> res = drag_data["resource"];
+ if (res.is_valid()) {
+ emit_signal("property_changed", get_edited_property(), res);
+ update_property();
+ return;
+ }
+ }
+
+ if (drag_data.has("type") && String(drag_data["type"]) == "files") {
+
+ Vector<String> files = drag_data["files"];
+
+ if (files.size() == 1) {
+ String file = files[0];
+ RES res = ResourceLoader::load(file);
+ if (res.is_valid()) {
+ emit_signal("property_changed", get_edited_property(), res);
+ update_property();
+ return;
+ }
+ }
+ }
+}
+
+void EditorPropertyResource::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_file_selected"), &EditorPropertyResource::_file_selected);
+ ClassDB::bind_method(D_METHOD("_menu_option"), &EditorPropertyResource::_menu_option);
+ ClassDB::bind_method(D_METHOD("_update_menu"), &EditorPropertyResource::_update_menu);
+ ClassDB::bind_method(D_METHOD("_resource_preview"), &EditorPropertyResource::_resource_preview);
+ ClassDB::bind_method(D_METHOD("_resource_selected"), &EditorPropertyResource::_resource_selected);
+ ClassDB::bind_method(D_METHOD("_viewport_selected"), &EditorPropertyResource::_viewport_selected);
+ ClassDB::bind_method(D_METHOD("_sub_inspector_property_keyed"), &EditorPropertyResource::_sub_inspector_property_keyed);
+ ClassDB::bind_method(D_METHOD("_sub_inspector_resource_selected"), &EditorPropertyResource::_sub_inspector_resource_selected);
+ ClassDB::bind_method(D_METHOD("_sub_inspector_object_id_selected"), &EditorPropertyResource::_sub_inspector_object_id_selected);
+ ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &EditorPropertyResource::get_drag_data_fw);
+ ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &EditorPropertyResource::can_drop_data_fw);
+ ClassDB::bind_method(D_METHOD("drop_data_fw"), &EditorPropertyResource::drop_data_fw);
+ ClassDB::bind_method(D_METHOD("_button_draw"), &EditorPropertyResource::_button_draw);
+ ClassDB::bind_method(D_METHOD("_open_editor_pressed"), &EditorPropertyResource::_open_editor_pressed);
+}
+
+EditorPropertyResource::EditorPropertyResource() {
+
+ sub_inspector = NULL;
+ sub_inspector_vbox = NULL;
+ use_sub_inspector = !bool(EDITOR_GET("interface/inspector/open_resources_in_new_inspector"));
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ add_child(hbc);
+ assign = memnew(Button);
+ assign->set_flat(true);
+ assign->set_h_size_flags(SIZE_EXPAND_FILL);
+ assign->set_clip_text(true);
+ assign->connect("pressed", this, "_resource_selected");
+ assign->set_drag_forwarding(this);
+ assign->connect("draw", this, "_button_draw");
+ hbc->add_child(assign);
+
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ edit = memnew(Button);
+ edit->set_flat(true);
+ menu->connect("id_pressed", this, "_menu_option");
+ edit->connect("pressed", this, "_update_menu");
+ hbc->add_child(edit);
+
+ file = NULL;
+ scene_tree = NULL;
+ dropping = false;
+}
+
+////////////// DEFAULT PLUGIN //////////////////////
+
+bool EditorInspectorDefaultPlugin::can_handle(Object *p_object) {
+ return true; //can handle everything
+}
+
+void EditorInspectorDefaultPlugin::parse_begin(Object *p_object) {
+ //do none
+}
+
+bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) {
+
+ switch (p_type) {
+
+ // atomic types
+ case Variant::NIL: {
+ EditorPropertyNil *editor = memnew(EditorPropertyNil);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::BOOL: {
+ EditorPropertyCheck *editor = memnew(EditorPropertyCheck);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::INT: {
+
+ if (p_hint == PROPERTY_HINT_ENUM) {
+ EditorPropertyEnum *editor = memnew(EditorPropertyEnum);
+ Vector<String> options = p_hint_text.split(",");
+ editor->setup(options);
+ add_property_editor(p_path, editor);
+
+ } else if (p_hint == PROPERTY_HINT_FLAGS) {
+ EditorPropertyFlags *editor = memnew(EditorPropertyFlags);
+ Vector<String> options = p_hint_text.split(",");
+ editor->setup(options);
+ add_property_editor(p_path, editor);
+
+ } else if (p_hint == PROPERTY_HINT_LAYERS_2D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_2D_RENDER || p_hint == PROPERTY_HINT_LAYERS_3D_PHYSICS || p_hint == PROPERTY_HINT_LAYERS_3D_RENDER) {
+
+ EditorPropertyLayers::LayerType lt;
+ switch (p_hint) {
+ case PROPERTY_HINT_LAYERS_2D_RENDER:
+ lt = EditorPropertyLayers::LAYER_RENDER_2D;
+ break;
+ case PROPERTY_HINT_LAYERS_2D_PHYSICS:
+ lt = EditorPropertyLayers::LAYER_PHYSICS_2D;
+ break;
+ case PROPERTY_HINT_LAYERS_3D_RENDER:
+ lt = EditorPropertyLayers::LAYER_RENDER_3D;
+ break;
+ case PROPERTY_HINT_LAYERS_3D_PHYSICS:
+ lt = EditorPropertyLayers::LAYER_PHYSICS_3D;
+ break;
+ default: {} //compiler could be smarter here and realize this cant happen
+ }
+ EditorPropertyLayers *editor = memnew(EditorPropertyLayers);
+ editor->setup(lt);
+ add_property_editor(p_path, editor);
+ } else if (p_hint == PROPERTY_HINT_OBJECT_ID) {
+
+ EditorPropertyObjectID *editor = memnew(EditorPropertyObjectID);
+ editor->setup(p_hint_text);
+ add_property_editor(p_path, editor);
+
+ } else {
+ EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
+ int min = 0, max = 65535;
+ bool greater = true, lesser = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ greater = false; //if using ranged, asume false by default
+ lesser = false;
+ min = p_hint_text.get_slice(",", 0).to_int();
+ max = p_hint_text.get_slice(",", 1).to_int();
+ for (int i = 2; i < p_hint_text.get_slice_count(","); i++) {
+ String slice = p_hint_text.get_slice(",", i).strip_edges();
+ if (slice == "or_greater") {
+ greater = true;
+ }
+ if (slice == "or_lesser") {
+ lesser = true;
+ }
+ }
+ }
+
+ editor->setup(min, max, greater, lesser);
+
+ add_property_editor(p_path, editor);
+ }
+ } break;
+ case Variant::REAL: {
+
+ if (p_hint == PROPERTY_HINT_EXP_EASING) {
+ EditorPropertyEasing *editor = memnew(EditorPropertyEasing);
+ bool full = true;
+ bool flip = false;
+ Vector<String> hints = p_hint_text.split(",");
+ for (int i = 0; i < hints.size(); i++) {
+ String h = hints[i].strip_edges();
+ if (h == "attenuation") {
+ flip = true;
+ }
+ if (h == "inout") {
+ full = true;
+ }
+ }
+
+ editor->setup(full, flip);
+ add_property_editor(p_path, editor);
+
+ } else {
+ EditorPropertyFloat *editor = memnew(EditorPropertyFloat);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+ bool exp_range = false;
+ bool greater = true, lesser = true;
+
+ if ((p_hint == PROPERTY_HINT_RANGE || p_hint == PROPERTY_HINT_EXP_RANGE) && p_hint_text.get_slice_count(",") >= 2) {
+ greater = false; //if using ranged, asume false by default
+ lesser = false;
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ exp_range = p_hint == PROPERTY_HINT_EXP_RANGE;
+ for (int i = 2; i < p_hint_text.get_slice_count(","); i++) {
+ String slice = p_hint_text.get_slice(",", i).strip_edges();
+ if (slice == "or_greater") {
+ greater = true;
+ }
+ if (slice == "or_lesser") {
+ lesser = true;
+ }
+ }
+ }
+
+ editor->setup(min, max, step, hide_slider, exp_range, greater, lesser);
+
+ add_property_editor(p_path, editor);
+ }
+ } break;
+ case Variant::STRING: {
+
+ if (p_hint == PROPERTY_HINT_ENUM) {
+ EditorPropertyTextEnum *editor = memnew(EditorPropertyTextEnum);
+ Vector<String> options = p_hint_text.split(",");
+ editor->setup(options);
+ add_property_editor(p_path, editor);
+ } else if (p_hint == PROPERTY_HINT_MULTILINE_TEXT) {
+ EditorPropertyMultilineText *editor = memnew(EditorPropertyMultilineText);
+ add_property_editor(p_path, editor);
+ } else if (p_hint == PROPERTY_HINT_DIR || p_hint == PROPERTY_HINT_FILE || p_hint == PROPERTY_HINT_GLOBAL_DIR || p_hint == PROPERTY_HINT_GLOBAL_FILE) {
+
+ Vector<String> extensions = p_hint_text.split(",");
+ bool global = p_hint == PROPERTY_HINT_GLOBAL_DIR || p_hint == PROPERTY_HINT_GLOBAL_FILE;
+ bool folder = p_hint == PROPERTY_HINT_DIR || p_hint == PROPERTY_HINT_GLOBAL_DIR;
+ EditorPropertyPath *editor = memnew(EditorPropertyPath);
+ editor->setup(extensions, folder, global);
+ add_property_editor(p_path, editor);
+ } else if (p_hint == PROPERTY_HINT_METHOD_OF_VARIANT_TYPE ||
+ p_hint == PROPERTY_HINT_METHOD_OF_BASE_TYPE ||
+ p_hint == PROPERTY_HINT_METHOD_OF_INSTANCE ||
+ p_hint == PROPERTY_HINT_METHOD_OF_SCRIPT ||
+ p_hint == PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE ||
+ p_hint == PROPERTY_HINT_PROPERTY_OF_BASE_TYPE ||
+ p_hint == PROPERTY_HINT_PROPERTY_OF_INSTANCE ||
+ p_hint == PROPERTY_HINT_PROPERTY_OF_SCRIPT) {
+
+ EditorPropertyMember *editor = memnew(EditorPropertyMember);
+
+ EditorPropertyMember::Type type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE;
+ switch (p_hint) {
+ case PROPERTY_HINT_METHOD_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_METHOD_OF_BASE_TYPE; break;
+ case PROPERTY_HINT_METHOD_OF_INSTANCE: type = EditorPropertyMember::MEMBER_METHOD_OF_INSTANCE; break;
+ case PROPERTY_HINT_METHOD_OF_SCRIPT: type = EditorPropertyMember::MEMBER_METHOD_OF_SCRIPT; break;
+ case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_VARIANT_TYPE; break;
+ case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_BASE_TYPE; break;
+ case PROPERTY_HINT_PROPERTY_OF_INSTANCE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_INSTANCE; break;
+ case PROPERTY_HINT_PROPERTY_OF_SCRIPT: type = EditorPropertyMember::MEMBER_PROPERTY_OF_SCRIPT; break;
+ default: {}
+ }
+ editor->setup(type, p_hint_text);
+ add_property_editor(p_path, editor);
+
+ } else {
+
+ EditorPropertyText *editor = memnew(EditorPropertyText);
+ add_property_editor(p_path, editor);
+ }
+ } break;
+
+ // math types
+
+ case Variant::VECTOR2: {
+ EditorPropertyVector2 *editor = memnew(EditorPropertyVector2);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+
+ } break; // 5
+ case Variant::RECT2: {
+ EditorPropertyRect2 *editor = memnew(EditorPropertyRect2);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::VECTOR3: {
+ EditorPropertyVector3 *editor = memnew(EditorPropertyVector3);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+
+ } break;
+ case Variant::TRANSFORM2D: {
+ EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+
+ } break;
+ case Variant::PLANE: {
+ EditorPropertyPlane *editor = memnew(EditorPropertyPlane);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::QUAT: {
+ EditorPropertyQuat *editor = memnew(EditorPropertyQuat);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+ } break; // 10
+ case Variant::AABB: {
+ EditorPropertyAABB *editor = memnew(EditorPropertyAABB);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::BASIS: {
+ EditorPropertyBasis *editor = memnew(EditorPropertyBasis);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::TRANSFORM: {
+ EditorPropertyTransform *editor = memnew(EditorPropertyTransform);
+ double min = -65535, max = 65535, step = 0.001;
+ bool hide_slider = true;
+
+ if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
+ min = p_hint_text.get_slice(",", 0).to_double();
+ max = p_hint_text.get_slice(",", 1).to_double();
+ if (p_hint_text.get_slice_count(",") >= 3) {
+ step = p_hint_text.get_slice(",", 2).to_double();
+ }
+ hide_slider = false;
+ }
+
+ editor->setup(min, max, step, hide_slider);
+ add_property_editor(p_path, editor);
+
+ } break;
+
+ // misc types
+ case Variant::COLOR: {
+ EditorPropertyColor *editor = memnew(EditorPropertyColor);
+ editor->setup(p_hint != PROPERTY_HINT_COLOR_NO_ALPHA);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::NODE_PATH: {
+
+ EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath);
+ if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {
+ editor->setup(p_hint_text, Vector<StringName>());
+ }
+ if (p_hint == PROPERTY_HINT_NODE_PATH_VALID_TYPES && p_hint_text != String()) {
+ Vector<String> types = p_hint_text.split(",", false);
+ Vector<StringName> sn = Variant(types); //convert via variant
+ editor->setup(NodePath(), sn);
+ }
+ add_property_editor(p_path, editor);
+
+ } break; // 15
+ case Variant::_RID: {
+ } break;
+ case Variant::OBJECT: {
+ EditorPropertyResource *editor = memnew(EditorPropertyResource);
+ editor->setup(p_hint == PROPERTY_HINT_RESOURCE_TYPE ? p_hint_text : "Resource");
+ add_property_editor(p_path, editor);
+
+ } break;
+ case Variant::DICTIONARY: {
+ EditorPropertyDictionary *editor = memnew(EditorPropertyDictionary);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::ARRAY);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::POOL_BYTE_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_BYTE_ARRAY);
+ add_property_editor(p_path, editor);
+ } break; // 20
+ case Variant::POOL_INT_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_INT_ARRAY);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::POOL_REAL_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_REAL_ARRAY);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::POOL_STRING_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_STRING_ARRAY);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::POOL_VECTOR2_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR2_ARRAY);
+ add_property_editor(p_path, editor);
+ } break;
+ case Variant::POOL_VECTOR3_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR3_ARRAY);
+ add_property_editor(p_path, editor);
+ } break; // 25
+ case Variant::POOL_COLOR_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_COLOR_ARRAY);
+ add_property_editor(p_path, editor);
+ } break;
+ default: {}
+ }
+
+ return false; //can be overriden, although it will most likely be last anyway
+}
+
+void EditorInspectorDefaultPlugin::parse_end() {
+ //do none
+}
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
new file mode 100644
index 0000000000..c67eccb60e
--- /dev/null
+++ b/editor/editor_properties.h
@@ -0,0 +1,550 @@
+/*************************************************************************/
+/* editor_properties.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef EDITOR_PROPERTIES_H
+#define EDITOR_PROPERTIES_H
+
+#include "editor/create_dialog.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_inspector.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_selector.h"
+#include "editor/scene_tree_editor.h"
+#include "scene/gui/color_picker.h"
+
+class EditorPropertyNil : public EditorProperty {
+ GDCLASS(EditorPropertyNil, EditorProperty)
+ LineEdit *text;
+
+public:
+ virtual void update_property();
+ EditorPropertyNil();
+};
+
+class EditorPropertyText : public EditorProperty {
+ GDCLASS(EditorPropertyText, EditorProperty)
+ LineEdit *text;
+
+ bool updating;
+ void _text_changed(const String &p_string);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ EditorPropertyText();
+};
+
+class EditorPropertyMultilineText : public EditorProperty {
+ GDCLASS(EditorPropertyMultilineText, EditorProperty)
+ TextEdit *text;
+
+ AcceptDialog *big_text_dialog;
+ TextEdit *big_text;
+ Button *open_big_text;
+
+ void _big_text_changed();
+ void _text_changed();
+ void _open_big_text();
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ EditorPropertyMultilineText();
+};
+
+class EditorPropertyTextEnum : public EditorProperty {
+ GDCLASS(EditorPropertyTextEnum, EditorProperty)
+ OptionButton *options;
+
+ void _option_selected(int p_which);
+
+protected:
+ static void _bind_methods();
+
+public:
+ void setup(const Vector<String> &p_options);
+ virtual void update_property();
+ EditorPropertyTextEnum();
+};
+
+class EditorPropertyPath : public EditorProperty {
+ GDCLASS(EditorPropertyPath, EditorProperty)
+ Vector<String> extensions;
+ bool folder;
+ bool global;
+ EditorFileDialog *dialog;
+ Button *path;
+
+ void _path_selected(const String &p_path);
+ void _path_pressed();
+
+protected:
+ static void _bind_methods();
+
+public:
+ void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global);
+ virtual void update_property();
+ EditorPropertyPath();
+};
+
+class EditorPropertyMember : public EditorProperty {
+ GDCLASS(EditorPropertyMember, EditorProperty)
+public:
+ enum Type {
+ MEMBER_METHOD_OF_VARIANT_TYPE, ///< a method of a type
+ MEMBER_METHOD_OF_BASE_TYPE, ///< a method of a base type
+ MEMBER_METHOD_OF_INSTANCE, ///< a method of an instance
+ MEMBER_METHOD_OF_SCRIPT, ///< a method of a script & base
+ MEMBER_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
+ MEMBER_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
+ MEMBER_PROPERTY_OF_INSTANCE, ///< a property of an instance
+ MEMBER_PROPERTY_OF_SCRIPT, ///< a property of a script & base
+
+ };
+
+private:
+ Type hint;
+ PropertySelector *selector;
+ Button *property;
+ String hint_text;
+
+ void _property_selected(const String &p_selected);
+ void _property_select();
+
+protected:
+ static void _bind_methods();
+
+public:
+ void setup(Type p_hint, const String &p_hint_text);
+ virtual void update_property();
+ EditorPropertyMember();
+};
+
+class EditorPropertyCheck : public EditorProperty {
+ GDCLASS(EditorPropertyCheck, EditorProperty)
+ CheckBox *checkbox;
+
+ void _checkbox_pressed();
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ EditorPropertyCheck();
+};
+
+class EditorPropertyEnum : public EditorProperty {
+ GDCLASS(EditorPropertyEnum, EditorProperty)
+ OptionButton *options;
+
+ void _option_selected(int p_which);
+
+protected:
+ static void _bind_methods();
+
+public:
+ void setup(const Vector<String> &p_options);
+ virtual void update_property();
+ EditorPropertyEnum();
+};
+
+class EditorPropertyFlags : public EditorProperty {
+ GDCLASS(EditorPropertyFlags, EditorProperty)
+ VBoxContainer *vbox;
+ Vector<CheckBox *> flags;
+ Vector<int> flag_indices;
+
+ void _flag_toggled();
+
+protected:
+ static void _bind_methods();
+
+public:
+ void setup(const Vector<String> &p_options);
+ virtual void update_property();
+ EditorPropertyFlags();
+};
+
+class EditorPropertyLayersGrid;
+
+class EditorPropertyLayers : public EditorProperty {
+ GDCLASS(EditorPropertyLayers, EditorProperty)
+public:
+ enum LayerType {
+ LAYER_PHYSICS_2D,
+ LAYER_RENDER_2D,
+ LAYER_PHYSICS_3D,
+ LAYER_RENDER_3D,
+ };
+
+private:
+ EditorPropertyLayersGrid *grid;
+ void _grid_changed(uint32_t p_grid);
+ LayerType layer_type;
+ PopupMenu *layers;
+ Button *button;
+
+ void _button_pressed();
+ void _menu_pressed(int p_menu);
+
+protected:
+ static void _bind_methods();
+
+public:
+ void setup(LayerType p_layer_type);
+ virtual void update_property();
+ EditorPropertyLayers();
+};
+
+class EditorPropertyInteger : public EditorProperty {
+ GDCLASS(EditorPropertyInteger, EditorProperty)
+ EditorSpinSlider *spin;
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(int p_min, int p_max, bool p_allow_greater, bool p_allow_lesser);
+ EditorPropertyInteger();
+};
+
+class EditorPropertyObjectID : public EditorProperty {
+ GDCLASS(EditorPropertyObjectID, EditorProperty)
+ Button *edit;
+ String base_type;
+ void _edit_pressed();
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(const String &p_base_type);
+ EditorPropertyObjectID();
+};
+
+class EditorPropertyFloat : public EditorProperty {
+ GDCLASS(EditorPropertyFloat, EditorProperty)
+ EditorSpinSlider *spin;
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_exp_range, bool p_greater, bool p_lesser);
+ EditorPropertyFloat();
+};
+
+class EditorPropertyEasing : public EditorProperty {
+ GDCLASS(EditorPropertyEasing, EditorProperty)
+ Control *easing_draw;
+ ToolButton *button_out, *button_in, *button_linear, *button_constant;
+ ToolButton *button_in_out, *button_out_in;
+ VBoxContainer *vb;
+
+ bool flip;
+
+ void _drag_easing(const Ref<InputEvent> &p_ev);
+ void _draw_easing();
+ void _notification(int p_what);
+ void _set_preset(float p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(bool p_full, bool p_flip);
+ EditorPropertyEasing();
+};
+
+class EditorPropertyVector2 : public EditorProperty {
+ GDCLASS(EditorPropertyVector2, EditorProperty)
+ EditorSpinSlider *spin[2];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyVector2();
+};
+
+class EditorPropertyRect2 : public EditorProperty {
+ GDCLASS(EditorPropertyRect2, EditorProperty)
+ EditorSpinSlider *spin[4];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyRect2();
+};
+
+class EditorPropertyVector3 : public EditorProperty {
+ GDCLASS(EditorPropertyVector3, EditorProperty)
+ EditorSpinSlider *spin[3];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyVector3();
+};
+
+class EditorPropertyPlane : public EditorProperty {
+ GDCLASS(EditorPropertyPlane, EditorProperty)
+ EditorSpinSlider *spin[4];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyPlane();
+};
+
+class EditorPropertyQuat : public EditorProperty {
+ GDCLASS(EditorPropertyQuat, EditorProperty)
+ EditorSpinSlider *spin[4];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyQuat();
+};
+
+class EditorPropertyAABB : public EditorProperty {
+ GDCLASS(EditorPropertyAABB, EditorProperty)
+ EditorSpinSlider *spin[6];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyAABB();
+};
+
+class EditorPropertyTransform2D : public EditorProperty {
+ GDCLASS(EditorPropertyTransform2D, EditorProperty)
+ EditorSpinSlider *spin[6];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyTransform2D();
+};
+
+class EditorPropertyBasis : public EditorProperty {
+ GDCLASS(EditorPropertyBasis, EditorProperty)
+ EditorSpinSlider *spin[9];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyBasis();
+};
+
+class EditorPropertyTransform : public EditorProperty {
+ GDCLASS(EditorPropertyTransform, EditorProperty)
+ EditorSpinSlider *spin[12];
+ bool setting;
+ void _value_changed(double p_val);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(double p_min, double p_max, double p_step, bool p_no_slider);
+ EditorPropertyTransform();
+};
+
+class EditorPropertyColor : public EditorProperty {
+ GDCLASS(EditorPropertyColor, EditorProperty)
+ ColorPickerButton *picker;
+ void _color_changed(const Color &p_color);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void update_property();
+ void setup(bool p_show_alpha);
+ EditorPropertyColor();
+};
+
+class EditorPropertyNodePath : public EditorProperty {
+ GDCLASS(EditorPropertyNodePath, EditorProperty)
+ Button *assign;
+ Button *clear;
+ SceneTreeDialog *scene_tree;
+ NodePath base_hint;
+
+ Vector<StringName> valid_types;
+ void _node_selected(const NodePath &p_path);
+ void _node_assign();
+ void _node_clear();
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ virtual void update_property();
+ void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types);
+ EditorPropertyNodePath();
+};
+
+class EditorPropertyResource : public EditorProperty {
+ GDCLASS(EditorPropertyResource, EditorProperty)
+
+ enum MenuOption {
+
+ OBJ_MENU_LOAD = 0,
+ OBJ_MENU_EDIT = 1,
+ OBJ_MENU_CLEAR = 2,
+ OBJ_MENU_MAKE_UNIQUE = 3,
+ OBJ_MENU_COPY = 4,
+ OBJ_MENU_PASTE = 5,
+ OBJ_MENU_NEW_SCRIPT = 6,
+ OBJ_MENU_SHOW_IN_FILE_SYSTEM = 7,
+ TYPE_BASE_ID = 100,
+ CONVERT_BASE_ID = 1000
+
+ };
+
+ Button *assign;
+ Button *edit;
+ PopupMenu *menu;
+ EditorFileDialog *file;
+ Vector<String> inheritors_array;
+ EditorInspector *sub_inspector;
+ VBoxContainer *sub_inspector_vbox;
+
+ bool use_sub_inspector;
+ bool dropping;
+ String base_type;
+
+ SceneTreeDialog *scene_tree;
+
+ void _file_selected(const String &p_path);
+ void _menu_option(int p_which);
+ void _resource_preview(const String &p_path, const Ref<Texture> &p_preview, ObjectID p_obj);
+ void _resource_selected();
+ void _viewport_selected(const NodePath &p_path);
+
+ void _update_menu();
+
+ void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool);
+ void _sub_inspector_resource_selected(const RES &p_resource, const String &p_property);
+ void _sub_inspector_object_id_selected(int p_id);
+
+ void _button_draw();
+ Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
+ bool _is_drop_valid(const Dictionary &p_drag_data) const;
+ bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
+ void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
+
+ void _open_editor_pressed();
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ virtual void update_property();
+ void setup(const String &p_base_type);
+
+ void collapse_all_folding();
+ void expand_all_folding();
+
+ EditorPropertyResource();
+};
+
+///////////////////////////////////////////////////
+/// \brief The EditorInspectorDefaultPlugin class
+///
+class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin)
+
+public:
+ virtual bool can_handle(Object *p_object);
+ virtual void parse_begin(Object *p_object);
+ virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage);
+ virtual void parse_end();
+};
+
+#endif // EDITOR_PROPERTIES_H
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
new file mode 100644
index 0000000000..2bd28170e7
--- /dev/null
+++ b/editor/editor_properties_array_dict.cpp
@@ -0,0 +1,1017 @@
+#include "editor_properties_array_dict.h"
+#include "editor/editor_scale.h"
+#include "editor_properties.h"
+
+bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) {
+
+ String pn = p_name;
+
+ if (pn.begins_with("indices")) {
+ int idx = pn.get_slicec('/', 1).to_int();
+ array.set(idx, p_value);
+ return true;
+ }
+
+ return false;
+}
+
+bool EditorPropertyArrayObject::_get(const StringName &p_name, Variant &r_ret) const {
+
+ String pn = p_name;
+
+ if (pn.begins_with("indices")) {
+
+ int idx = pn.get_slicec('/', 1).to_int();
+ bool valid;
+ r_ret = array.get(idx, &valid);
+ return valid;
+ }
+
+ return false;
+}
+
+void EditorPropertyArrayObject::set_array(const Variant &p_array) {
+ array = p_array;
+}
+
+Variant EditorPropertyArrayObject::get_array() {
+ return array;
+}
+
+EditorPropertyArrayObject::EditorPropertyArrayObject() {
+}
+
+///////////////////
+
+bool EditorPropertyDictionaryObject::_set(const StringName &p_name, const Variant &p_value) {
+
+ String pn = p_name;
+
+ if (pn == "new_item_key") {
+
+ new_item_key = p_value;
+ return true;
+ }
+
+ if (pn == "new_item_value") {
+
+ new_item_value = p_value;
+ return true;
+ }
+
+ if (pn.begins_with("indices")) {
+ int idx = pn.get_slicec('/', 1).to_int();
+ Variant key = dict.get_key_at_index(idx);
+ dict[key] = p_value;
+ return true;
+ }
+
+ return false;
+}
+
+bool EditorPropertyDictionaryObject::_get(const StringName &p_name, Variant &r_ret) const {
+
+ String pn = p_name;
+
+ if (pn == "new_item_key") {
+
+ r_ret = new_item_key;
+ return true;
+ }
+
+ if (pn == "new_item_value") {
+
+ r_ret = new_item_value;
+ return true;
+ }
+
+ if (pn.begins_with("indices")) {
+
+ int idx = pn.get_slicec('/', 1).to_int();
+ Variant key = dict.get_key_at_index(idx);
+ r_ret = dict[key];
+ return true;
+ }
+
+ return false;
+}
+
+void EditorPropertyDictionaryObject::set_dict(const Dictionary &p_dict) {
+ dict = p_dict;
+}
+
+Dictionary EditorPropertyDictionaryObject::get_dict() {
+ return dict;
+}
+
+void EditorPropertyDictionaryObject::set_new_item_key(const Variant &p_new_item) {
+ new_item_key = p_new_item;
+}
+
+Variant EditorPropertyDictionaryObject::get_new_item_key() {
+ return new_item_key;
+}
+
+void EditorPropertyDictionaryObject::set_new_item_value(const Variant &p_new_item) {
+ new_item_value = p_new_item;
+}
+
+Variant EditorPropertyDictionaryObject::get_new_item_value() {
+ return new_item_value;
+}
+
+EditorPropertyDictionaryObject::EditorPropertyDictionaryObject() {
+}
+
+///////////////////// ARRAY ///////////////////////////
+
+void EditorPropertyArray::_property_changed(const String &p_prop, Variant p_value) {
+
+ if (p_prop.begins_with("indices")) {
+ int idx = p_prop.get_slice("/", 1).to_int();
+ Variant array = object->get_array();
+ array.set(idx, p_value);
+ emit_signal("property_changed", get_edited_property(), array);
+
+ if (array.get_type() == Variant::ARRAY) {
+ array = array.call("duplicate"); //dupe, so undo/redo works better
+ }
+ object->set_array(array);
+ }
+}
+
+void EditorPropertyArray::_change_type(Object *p_button, int p_index) {
+
+ Button *button = Object::cast_to<Button>(p_button);
+
+ Rect2 rect = button->get_global_rect();
+ change_type->set_as_minsize();
+ change_type->set_global_position(rect.position + rect.size - Vector2(change_type->get_combined_minimum_size().x, 0));
+ change_type->popup();
+ changing_type_idx = p_index;
+}
+
+void EditorPropertyArray::_change_type_menu(int p_index) {
+
+ Variant value;
+ Variant::CallError ce;
+ value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
+ Variant array = object->get_array();
+ array.set(changing_type_idx, value);
+
+ emit_signal("property_changed", get_edited_property(), array);
+
+ if (array.get_type() == Variant::ARRAY) {
+ array = array.call("duplicate"); //dupe, so undo/redo works better
+ }
+ object->set_array(array);
+ update_property();
+}
+
+void EditorPropertyArray::update_property() {
+
+ Variant array = get_edited_object()->get(get_edited_property());
+
+ String arrtype = "";
+ switch (array_type) {
+ case Variant::ARRAY: {
+ arrtype = "Array";
+
+ } break;
+
+ // arrays
+ case Variant::POOL_BYTE_ARRAY: {
+ arrtype = "ByteArray";
+
+ } break;
+ case Variant::POOL_INT_ARRAY: {
+ arrtype = "IntArray";
+
+ } break;
+ case Variant::POOL_REAL_ARRAY: {
+
+ arrtype = "FltArray";
+ } break;
+ case Variant::POOL_STRING_ARRAY: {
+
+ arrtype = "StrArray";
+ } break;
+ case Variant::POOL_VECTOR2_ARRAY: {
+
+ arrtype = "Vec2Array";
+ } break;
+ case Variant::POOL_VECTOR3_ARRAY: {
+ arrtype = "Vec3Array";
+
+ } break;
+ case Variant::POOL_COLOR_ARRAY: {
+ arrtype = "ColArray";
+ } break;
+ default: {}
+ }
+
+ if (!array.is_array()) {
+ edit->set_text(arrtype + "[" + Variant::get_type_name(array.get_type()) + "]");
+ edit->set_pressed(false);
+ if (vbox) {
+ memdelete(vbox);
+ }
+ return;
+ }
+
+ edit->set_text(arrtype + "[" + itos(array.call("size")) + "]");
+
+#ifdef TOOLS_ENABLED
+
+ bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
+ if (edit->is_pressed() != unfolded) {
+ edit->set_pressed(unfolded);
+ }
+
+ if (unfolded) {
+
+ updating = true;
+
+ if (!vbox) {
+
+ vbox = memnew(VBoxContainer);
+ add_child(vbox);
+ set_bottom_editor(vbox);
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ vbox->add_child(hbc);
+ Label *label = memnew(Label(TTR("Size: ")));
+ label->set_h_size_flags(SIZE_EXPAND_FILL);
+ hbc->add_child(label);
+ length = memnew(EditorSpinSlider);
+ length->set_step(1);
+ length->set_max(1000000);
+ length->set_h_size_flags(SIZE_EXPAND_FILL);
+ hbc->add_child(length);
+ length->connect("value_changed", this, "_length_changed");
+
+ page_hb = memnew(HBoxContainer);
+ vbox->add_child(page_hb);
+ label = memnew(Label(TTR("Page: ")));
+ label->set_h_size_flags(SIZE_EXPAND_FILL);
+ page_hb->add_child(label);
+ page = memnew(EditorSpinSlider);
+ page->set_step(1);
+ page_hb->add_child(page);
+ page->set_h_size_flags(SIZE_EXPAND_FILL);
+ page->connect("value_changed", this, "_page_changed");
+ } else {
+ //bye bye children of the box
+ while (vbox->get_child_count() > 2) {
+ memdelete(vbox->get_child(2));
+ }
+ }
+
+ int len = array.call("size");
+
+ length->set_value(len);
+
+ int pages = MAX(0, len - 1) / page_len + 1;
+
+ page->set_max(pages);
+ page_idx = MIN(page_idx, pages - 1);
+ page->set_value(page_idx);
+ page_hb->set_visible(pages > 1);
+
+ int offset = page_idx * page_len;
+
+ int amount = MIN(len - offset, page_len);
+
+ if (array.get_type() == Variant::ARRAY) {
+ array = array.call("duplicate");
+ }
+
+ object->set_array(array);
+
+ for (int i = 0; i < amount; i++) {
+ String prop_name = "indices/" + itos(i + offset);
+
+ EditorProperty *prop = NULL;
+ Variant value = array.get(i + offset);
+
+ switch (value.get_type()) {
+ case Variant::NIL: {
+ prop = memnew(EditorPropertyNil);
+
+ } break;
+
+ // atomic types
+ case Variant::BOOL: {
+
+ prop = memnew(EditorPropertyCheck);
+
+ } break;
+ case Variant::INT: {
+ EditorPropertyInteger *ed = memnew(EditorPropertyInteger);
+ ed->setup(-100000, 100000, true, true);
+ prop = ed;
+
+ } break;
+ case Variant::REAL: {
+
+ EditorPropertyFloat *ed = memnew(EditorPropertyFloat);
+ ed->setup(-100000, 100000, 0.001, true, false, true, true);
+ prop = ed;
+ } break;
+ case Variant::STRING: {
+
+ prop = memnew(EditorPropertyText);
+
+ } break;
+
+ // math types
+
+ case Variant::VECTOR2: {
+
+ EditorPropertyVector2 *ed = memnew(EditorPropertyVector2);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::RECT2: {
+
+ EditorPropertyRect2 *ed = memnew(EditorPropertyRect2);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::VECTOR3: {
+
+ EditorPropertyVector3 *ed = memnew(EditorPropertyVector3);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::TRANSFORM2D: {
+
+ EditorPropertyTransform2D *ed = memnew(EditorPropertyTransform2D);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::PLANE: {
+
+ EditorPropertyPlane *ed = memnew(EditorPropertyPlane);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::QUAT: {
+
+ EditorPropertyQuat *ed = memnew(EditorPropertyQuat);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::AABB: {
+
+ EditorPropertyAABB *ed = memnew(EditorPropertyAABB);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::BASIS: {
+ EditorPropertyBasis *ed = memnew(EditorPropertyBasis);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::TRANSFORM: {
+ EditorPropertyTransform *ed = memnew(EditorPropertyTransform);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+
+ // misc types
+ case Variant::COLOR: {
+ prop = memnew(EditorPropertyColor);
+
+ } break;
+ case Variant::NODE_PATH: {
+ prop = memnew(EditorPropertyNodePath);
+
+ } break;
+ case Variant::_RID: {
+ prop = memnew(EditorPropertyNil);
+
+ } break;
+ case Variant::OBJECT: {
+
+ prop = memnew(EditorPropertyResource);
+
+ } break;
+ case Variant::DICTIONARY: {
+ prop = memnew(EditorPropertyDictionary);
+
+ } break;
+
+ // arrays
+ case Variant::ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::ARRAY);
+ prop = editor;
+
+ } break;
+ case Variant::POOL_BYTE_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_BYTE_ARRAY);
+ prop = editor;
+
+ } break;
+ case Variant::POOL_INT_ARRAY: {
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_INT_ARRAY);
+ prop = editor;
+
+ } break;
+ case Variant::POOL_REAL_ARRAY: {
+
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_REAL_ARRAY);
+ prop = editor;
+ } break;
+ case Variant::POOL_STRING_ARRAY: {
+
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_STRING_ARRAY);
+ prop = editor;
+ } break;
+ case Variant::POOL_VECTOR2_ARRAY: {
+
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR2_ARRAY);
+ prop = editor;
+ } break;
+ case Variant::POOL_VECTOR3_ARRAY: {
+
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR3_ARRAY);
+ prop = editor;
+ } break;
+ case Variant::POOL_COLOR_ARRAY: {
+
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_COLOR_ARRAY);
+ prop = editor;
+ } break;
+ default: {}
+ }
+
+ prop->set_object_and_property(object.ptr(), prop_name);
+ prop->set_label(itos(i + offset));
+ prop->set_selectable(false);
+ prop->connect("property_changed", this, "_property_changed");
+ if (array.get_type() == Variant::ARRAY) {
+ HBoxContainer *hb = memnew(HBoxContainer);
+ vbox->add_child(hb);
+ hb->add_child(prop);
+ prop->set_h_size_flags(SIZE_EXPAND_FILL);
+ Button *edit = memnew(Button);
+ edit->set_icon(get_icon("Edit", "EditorIcons"));
+ hb->add_child(edit);
+ edit->connect("pressed", this, "_change_type", varray(edit, i + offset));
+ } else {
+ vbox->add_child(prop);
+ }
+
+ prop->update_property();
+ }
+
+ updating = false;
+
+ } else {
+ if (vbox) {
+ set_bottom_editor(NULL);
+ memdelete(vbox);
+ vbox = NULL;
+ }
+ }
+#endif
+}
+
+void EditorPropertyArray::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ }
+}
+void EditorPropertyArray::_edit_pressed() {
+
+ Variant array = get_edited_object()->get(get_edited_property());
+ if (!array.is_array()) {
+ Variant::CallError ce;
+ array = Variant::construct(array_type, NULL, 0, ce);
+
+ get_edited_object()->set(get_edited_property(), array);
+ }
+
+ get_edited_object()->editor_set_section_unfold(get_edited_property(), edit->is_pressed());
+ update_property();
+}
+
+void EditorPropertyArray::_page_changed(double p_page) {
+ if (updating)
+ return;
+ page_idx = p_page;
+ update_property();
+}
+
+void EditorPropertyArray::_length_changed(double p_page) {
+ if (updating)
+ return;
+
+ Variant array = object->get_array();
+ array.call("resize", int(p_page));
+ emit_signal("property_changed", get_edited_property(), array);
+
+ if (array.get_type() == Variant::ARRAY) {
+ array = array.call("duplicate"); //dupe, so undo/redo works better
+ }
+ object->set_array(array);
+ update_property();
+}
+
+void EditorPropertyArray::setup(Variant::Type p_array_type) {
+
+ array_type = p_array_type;
+}
+
+void EditorPropertyArray::_bind_methods() {
+ ClassDB::bind_method("_edit_pressed", &EditorPropertyArray::_edit_pressed);
+ ClassDB::bind_method("_page_changed", &EditorPropertyArray::_page_changed);
+ ClassDB::bind_method("_length_changed", &EditorPropertyArray::_length_changed);
+ ClassDB::bind_method("_property_changed", &EditorPropertyArray::_property_changed);
+ ClassDB::bind_method("_change_type", &EditorPropertyArray::_change_type);
+ ClassDB::bind_method("_change_type_menu", &EditorPropertyArray::_change_type_menu);
+}
+
+EditorPropertyArray::EditorPropertyArray() {
+
+ object.instance();
+ page_idx = 0;
+ page_len = 10;
+ edit = memnew(Button);
+ edit->set_flat(true);
+ edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ edit->set_clip_text(true);
+ edit->connect("pressed", this, "_edit_pressed");
+ edit->set_toggle_mode(true);
+ add_child(edit);
+ add_focusable(edit);
+ vbox = NULL;
+ page = NULL;
+ length = NULL;
+ updating = false;
+ change_type = memnew(PopupMenu);
+ add_child(change_type);
+ change_type->connect("id_pressed", this, "_change_type_menu");
+ changing_type_idx = -1;
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ String type = Variant::get_type_name(Variant::Type(i));
+ change_type->add_item(type, i);
+ }
+ changing_type_idx = -1;
+}
+
+///////////////////// DICTIONARY ///////////////////////////
+
+void EditorPropertyDictionary::_property_changed(const String &p_prop, Variant p_value) {
+
+ if (p_prop == "new_item_key") {
+
+ object->set_new_item_key(p_value);
+ } else if (p_prop == "new_item_value") {
+
+ object->set_new_item_value(p_value);
+ } else if (p_prop.begins_with("indices")) {
+ int idx = p_prop.get_slice("/", 1).to_int();
+ Dictionary dict = object->get_dict();
+ Variant key = dict.get_key_at_index(idx);
+ dict[key] = p_value;
+
+ emit_signal("property_changed", get_edited_property(), dict);
+
+ dict = dict.duplicate(); //dupe, so undo/redo works better
+ object->set_dict(dict);
+ }
+}
+
+void EditorPropertyDictionary::_change_type(Object *p_button, int p_index) {
+
+ Button *button = Object::cast_to<Button>(p_button);
+
+ Rect2 rect = button->get_global_rect();
+ change_type->set_as_minsize();
+ change_type->set_global_position(rect.position + rect.size - Vector2(change_type->get_combined_minimum_size().x, 0));
+ change_type->popup();
+ changing_type_idx = p_index;
+}
+
+void EditorPropertyDictionary::_add_key_value() {
+
+ Dictionary dict = object->get_dict();
+ dict[object->get_new_item_key()] = object->get_new_item_value();
+ object->set_new_item_key(Variant());
+ object->set_new_item_value(Variant());
+
+ emit_signal("property_changed", get_edited_property(), dict);
+
+ dict = dict.duplicate(); //dupe, so undo/redo works better
+ object->set_dict(dict);
+ update_property();
+}
+
+void EditorPropertyDictionary::_change_type_menu(int p_index) {
+
+ if (changing_type_idx < 0) {
+ Variant value;
+ Variant::CallError ce;
+ value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
+ if (changing_type_idx == -1) {
+ object->set_new_item_key(value);
+ } else {
+ object->set_new_item_value(value);
+ }
+ update_property();
+ return;
+ }
+
+ Dictionary dict = object->get_dict();
+
+ if (p_index < Variant::VARIANT_MAX) {
+
+ Variant value;
+ Variant::CallError ce;
+ value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
+ Variant key = dict.get_key_at_index(changing_type_idx);
+ dict[key] = value;
+ } else {
+ Variant key = dict.get_key_at_index(changing_type_idx);
+ dict.erase(key);
+ }
+
+ emit_signal("property_changed", get_edited_property(), dict);
+
+ dict = dict.duplicate(); //dupe, so undo/redo works better
+ object->set_dict(dict);
+ update_property();
+}
+
+void EditorPropertyDictionary::update_property() {
+
+ Dictionary dict = get_edited_object()->get(get_edited_property());
+
+ edit->set_text("Dict[" + itos(dict.size()) + "]");
+
+#ifdef TOOLS_ENABLED
+
+ bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
+ if (edit->is_pressed() != unfolded) {
+ edit->set_pressed(unfolded);
+ }
+
+ if (unfolded) {
+
+ updating = true;
+
+ if (!vbox) {
+
+ vbox = memnew(VBoxContainer);
+ add_child(vbox);
+ set_bottom_editor(vbox);
+
+ page_hb = memnew(HBoxContainer);
+ vbox->add_child(page_hb);
+ Label *label = memnew(Label(TTR("Page: ")));
+ label->set_h_size_flags(SIZE_EXPAND_FILL);
+ page_hb->add_child(label);
+ page = memnew(EditorSpinSlider);
+ page->set_step(1);
+ page_hb->add_child(page);
+ page->set_h_size_flags(SIZE_EXPAND_FILL);
+ page->connect("value_changed", this, "_page_changed");
+ } else {
+ //bye bye children of the box
+ while (vbox->get_child_count() > 1) {
+ memdelete(vbox->get_child(1));
+ }
+ }
+
+ int len = dict.size();
+
+ int pages = MAX(0, len - 1) / page_len + 1;
+
+ page->set_max(pages);
+ page_idx = MIN(page_idx, pages - 1);
+ page->set_value(page_idx);
+ page_hb->set_visible(pages > 1);
+
+ int offset = page_idx * page_len;
+
+ int amount = MIN(len - offset, page_len);
+
+ dict = dict.duplicate();
+
+ object->set_dict(dict);
+ VBoxContainer *add_vbox = NULL;
+
+ for (int i = 0; i < amount + 2; i++) {
+ String prop_name;
+ Variant key;
+ Variant value;
+
+ if (i < amount) {
+ prop_name = "indices/" + itos(i + offset);
+ key = dict.get_key_at_index(i + offset);
+ value = dict.get_value_at_index(i + offset);
+ } else if (i == amount) {
+ prop_name = "new_item_key";
+ value = object->get_new_item_key();
+ } else if (i == amount + 1) {
+ prop_name = "new_item_value";
+ value = object->get_new_item_value();
+ }
+
+ EditorProperty *prop = NULL;
+
+ switch (value.get_type()) {
+ case Variant::NIL: {
+ prop = memnew(EditorPropertyNil);
+
+ } break;
+
+ // atomic types
+ case Variant::BOOL: {
+
+ prop = memnew(EditorPropertyCheck);
+
+ } break;
+ case Variant::INT: {
+ EditorPropertyInteger *ed = memnew(EditorPropertyInteger);
+ ed->setup(-100000, 100000, true, true);
+ prop = ed;
+
+ } break;
+ case Variant::REAL: {
+
+ EditorPropertyFloat *ed = memnew(EditorPropertyFloat);
+ ed->setup(-100000, 100000, 0.001, true, false, true, true);
+ prop = ed;
+ } break;
+ case Variant::STRING: {
+
+ prop = memnew(EditorPropertyText);
+
+ } break;
+
+ // math types
+
+ case Variant::VECTOR2: {
+
+ EditorPropertyVector2 *ed = memnew(EditorPropertyVector2);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::RECT2: {
+
+ EditorPropertyRect2 *ed = memnew(EditorPropertyRect2);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::VECTOR3: {
+
+ EditorPropertyVector3 *ed = memnew(EditorPropertyVector3);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::TRANSFORM2D: {
+
+ EditorPropertyTransform2D *ed = memnew(EditorPropertyTransform2D);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::PLANE: {
+
+ EditorPropertyPlane *ed = memnew(EditorPropertyPlane);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::QUAT: {
+
+ EditorPropertyQuat *ed = memnew(EditorPropertyQuat);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::AABB: {
+
+ EditorPropertyAABB *ed = memnew(EditorPropertyAABB);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::BASIS: {
+ EditorPropertyBasis *ed = memnew(EditorPropertyBasis);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+ case Variant::TRANSFORM: {
+ EditorPropertyTransform *ed = memnew(EditorPropertyTransform);
+ ed->setup(-100000, 100000, 0.001, true);
+ prop = ed;
+
+ } break;
+
+ // misc types
+ case Variant::COLOR: {
+ prop = memnew(EditorPropertyColor);
+
+ } break;
+ case Variant::NODE_PATH: {
+ prop = memnew(EditorPropertyNodePath);
+
+ } break;
+ case Variant::_RID: {
+ prop = memnew(EditorPropertyNil);
+
+ } break;
+ case Variant::OBJECT: {
+
+ prop = memnew(EditorPropertyResource);
+
+ } break;
+ case Variant::DICTIONARY: {
+ prop = memnew(EditorPropertyDictionary);
+
+ } break;
+ case Variant::ARRAY: {
+
+ prop = memnew(EditorPropertyArray);
+
+ } break;
+
+ // arrays
+ case Variant::POOL_BYTE_ARRAY: {
+ prop = memnew(EditorPropertyArray);
+
+ } break;
+ case Variant::POOL_INT_ARRAY: {
+ prop = memnew(EditorPropertyArray);
+
+ } break;
+ case Variant::POOL_REAL_ARRAY: {
+
+ prop = memnew(EditorPropertyArray);
+ } break;
+ case Variant::POOL_STRING_ARRAY: {
+
+ prop = memnew(EditorPropertyArray);
+ } break;
+ case Variant::POOL_VECTOR2_ARRAY: {
+
+ prop = memnew(EditorPropertyArray);
+ } break;
+ case Variant::POOL_VECTOR3_ARRAY: {
+ prop = memnew(EditorPropertyArray);
+
+ } break;
+ case Variant::POOL_COLOR_ARRAY: {
+ prop = memnew(EditorPropertyArray);
+
+ } break;
+ default: {}
+ }
+
+ if (i == amount) {
+ PanelContainer *pc = memnew(PanelContainer);
+ vbox->add_child(pc);
+ Ref<StyleBoxFlat> flat;
+ flat.instance();
+ for (int j = 0; j < 4; j++) {
+ flat->set_default_margin(Margin(j), 2 * EDSCALE);
+ }
+ flat->set_bg_color(get_color("prop_subsection", "Editor"));
+
+ pc->add_style_override("panel", flat);
+ add_vbox = memnew(VBoxContainer);
+ pc->add_child(add_vbox);
+ }
+ prop->set_object_and_property(object.ptr(), prop_name);
+ int change_index;
+
+ if (i < amount) {
+ String cs = key.get_construct_string();
+ prop->set_label(key.get_construct_string());
+ prop->set_tooltip(cs);
+ change_index = i + offset;
+ } else if (i == amount) {
+ prop->set_label(TTR("New Key:"));
+ change_index = -1;
+ } else if (i == amount + 1) {
+ prop->set_label(TTR("New Value:"));
+ change_index = -2;
+ }
+
+ prop->set_selectable(false);
+ prop->connect("property_changed", this, "_property_changed");
+
+ HBoxContainer *hb = memnew(HBoxContainer);
+ if (add_vbox) {
+ add_vbox->add_child(hb);
+ } else {
+ vbox->add_child(hb);
+ }
+ hb->add_child(prop);
+ prop->set_h_size_flags(SIZE_EXPAND_FILL);
+ Button *edit = memnew(Button);
+ edit->set_icon(get_icon("Edit", "EditorIcons"));
+ hb->add_child(edit);
+ edit->connect("pressed", this, "_change_type", varray(edit, change_index));
+
+ prop->update_property();
+
+ if (i == amount + 1) {
+ Button *add_item = memnew(Button);
+ add_item->set_text(TTR("Add Key/Value Pair"));
+ add_vbox->add_child(add_item);
+ add_item->connect("pressed", this, "_add_key_value");
+ }
+ }
+
+ updating = false;
+
+ } else {
+ if (vbox) {
+ set_bottom_editor(NULL);
+ memdelete(vbox);
+ vbox = NULL;
+ }
+ }
+#endif
+}
+
+void EditorPropertyDictionary::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ }
+}
+void EditorPropertyDictionary::_edit_pressed() {
+
+ get_edited_object()->editor_set_section_unfold(get_edited_property(), edit->is_pressed());
+ update_property();
+}
+
+void EditorPropertyDictionary::_page_changed(double p_page) {
+ if (updating)
+ return;
+ page_idx = p_page;
+ update_property();
+}
+
+void EditorPropertyDictionary::_bind_methods() {
+ ClassDB::bind_method("_edit_pressed", &EditorPropertyDictionary::_edit_pressed);
+ ClassDB::bind_method("_page_changed", &EditorPropertyDictionary::_page_changed);
+ ClassDB::bind_method("_property_changed", &EditorPropertyDictionary::_property_changed);
+ ClassDB::bind_method("_change_type", &EditorPropertyDictionary::_change_type);
+ ClassDB::bind_method("_change_type_menu", &EditorPropertyDictionary::_change_type_menu);
+ ClassDB::bind_method("_add_key_value", &EditorPropertyDictionary::_add_key_value);
+}
+
+EditorPropertyDictionary::EditorPropertyDictionary() {
+
+ object.instance();
+ page_idx = 0;
+ page_len = 10;
+ edit = memnew(Button);
+ edit->set_flat(true);
+ edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ edit->set_clip_text(true);
+ edit->connect("pressed", this, "_edit_pressed");
+ edit->set_toggle_mode(true);
+ add_child(edit);
+ add_focusable(edit);
+ vbox = NULL;
+ page = NULL;
+ updating = false;
+ change_type = memnew(PopupMenu);
+ add_child(change_type);
+ change_type->connect("id_pressed", this, "_change_type_menu");
+ changing_type_idx = -1;
+ for (int i = 0; i < Variant::VARIANT_MAX; i++) {
+ String type = Variant::get_type_name(Variant::Type(i));
+ change_type->add_item(type, i);
+ }
+ change_type->add_separator();
+ change_type->add_item(TTR("Remove Item"), Variant::VARIANT_MAX);
+ changing_type_idx = -1;
+}
diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h
new file mode 100644
index 0000000000..75c67d280d
--- /dev/null
+++ b/editor/editor_properties_array_dict.h
@@ -0,0 +1,117 @@
+#ifndef EDITOR_PROPERTIES_ARRAY_DICT_H
+#define EDITOR_PROPERTIES_ARRAY_DICT_H
+
+#include "editor/editor_inspector.h"
+#include "editor/editor_spin_slider.h"
+#include "scene/gui/button.h"
+
+class EditorPropertyArrayObject : public Reference {
+
+ GDCLASS(EditorPropertyArrayObject, Reference);
+
+ Variant array;
+
+protected:
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+
+public:
+ void set_array(const Variant &p_array);
+ Variant get_array();
+
+ EditorPropertyArrayObject();
+};
+
+class EditorPropertyDictionaryObject : public Reference {
+
+ GDCLASS(EditorPropertyDictionaryObject, Reference);
+
+ Variant new_item_key;
+ Variant new_item_value;
+ Dictionary dict;
+
+protected:
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+
+public:
+ void set_dict(const Dictionary &p_dict);
+ Dictionary get_dict();
+
+ void set_new_item_key(const Variant &p_new_item);
+ Variant get_new_item_key();
+
+ void set_new_item_value(const Variant &p_new_item);
+ Variant get_new_item_value();
+
+ EditorPropertyDictionaryObject();
+};
+
+class EditorPropertyArray : public EditorProperty {
+ GDCLASS(EditorPropertyArray, EditorProperty)
+
+ PopupMenu *change_type;
+ bool updating;
+
+ Ref<EditorPropertyArrayObject> object;
+ int page_len;
+ int page_idx;
+ int changing_type_idx;
+ Button *edit;
+ VBoxContainer *vbox;
+ EditorSpinSlider *length;
+ EditorSpinSlider *page;
+ HBoxContainer *page_hb;
+ Variant::Type array_type;
+
+ void _page_changed(double p_page);
+ void _length_changed(double p_page);
+ void _edit_pressed();
+ void _property_changed(const String &p_prop, Variant p_value);
+ void _change_type(Object *p_button, int p_index);
+ void _change_type_menu(int p_index);
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ void setup(Variant::Type p_array_type);
+ virtual void update_property();
+ EditorPropertyArray();
+};
+
+class EditorPropertyDictionary : public EditorProperty {
+ GDCLASS(EditorPropertyDictionary, EditorProperty)
+
+ PopupMenu *change_type;
+ bool updating;
+
+ Ref<EditorPropertyDictionaryObject> object;
+ int page_len;
+ int page_idx;
+ int changing_type_idx;
+ Button *edit;
+ VBoxContainer *vbox;
+ EditorSpinSlider *length;
+ EditorSpinSlider *page;
+ HBoxContainer *page_hb;
+
+ void _page_changed(double p_page);
+ void _edit_pressed();
+ void _property_changed(const String &p_prop, Variant p_value);
+ void _change_type(Object *p_button, int p_index);
+ void _change_type_menu(int p_index);
+
+ void _add_key_value();
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ virtual void update_property();
+ EditorPropertyDictionary();
+};
+
+#endif // EDITOR_PROPERTIES_ARRAY_DICT_H
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 29363e29c1..4045d6c3d3 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -283,15 +283,23 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/editor/editor_language"] = PropertyInfo(Variant::STRING, "interface/editor/editor_language", PROPERTY_HINT_ENUM, lang_hint, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
}
- _initial_set("interface/editor/hidpi_mode", 0);
- hints["interface/editor/hidpi_mode"] = PropertyInfo(Variant::INT, "interface/editor/hidpi_mode", PROPERTY_HINT_ENUM, "Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/display_scale", 0);
+ hints["interface/editor/display_scale"] = PropertyInfo(Variant::INT, "interface/editor/display_scale", PROPERTY_HINT_ENUM, "Auto,75%,100%,125%,150%,175%,200%,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/custom_display_scale", 1.0f);
+ hints["interface/editor/custom_display_scale"] = PropertyInfo(Variant::REAL, "interface/editor/custom_display_scale", PROPERTY_HINT_RANGE, "0.75,3,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/scene_tabs/show_script_button", false);
_initial_set("interface/editor/main_font_size", 14);
hints["interface/editor/main_font_size"] = PropertyInfo(Variant::INT, "interface/editor/main_font_size", PROPERTY_HINT_RANGE, "10,40,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/code_font_size", 14);
hints["interface/editor/code_font_size"] = PropertyInfo(Variant::INT, "interface/editor/code_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/main_font_hinting", 2);
+ hints["interface/editor/main_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/main_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/code_font_hinting", 2);
+ hints["interface/editor/code_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/code_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/main_font", "");
hints["interface/editor/main_font"] = PropertyInfo(Variant::STRING, "interface/editor/main_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/editor/main_font_bold", "");
+ hints["interface/editor/main_font_bold"] = PropertyInfo(Variant::STRING, "interface/editor/main_font_bold", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/code_font", "");
hints["interface/editor/code_font"] = PropertyInfo(Variant::STRING, "interface/editor/code_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/editor/dim_editor_on_dialog_popup", true);
@@ -305,8 +313,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
_initial_set("interface/editor/quit_confirmation", true);
- _initial_set("interface/theme/preset", 0);
- hints["interface/theme/preset"] = PropertyInfo(Variant::INT, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Grey,Godot 2,Arc,Light,Alien,Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("interface/theme/preset", "Default");
+ hints["interface/theme/preset"] = PropertyInfo(Variant::STRING, "interface/theme/preset", PROPERTY_HINT_ENUM, "Default,Alien,Arc,Godot 2,Grey,Light,Solarized (Dark),Solarized (Light),Custom", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/theme/icon_and_font_color", 0);
hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("interface/theme/base_color", Color::html("#323b4f"));
@@ -363,9 +371,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/line_numbers/line_numbers_zero_padded", false);
_initial_set("text_editor/line_numbers/show_breakpoint_gutter", true);
_initial_set("text_editor/line_numbers/code_folding", true);
+ _initial_set("text_editor/line_numbers/word_wrap", false);
_initial_set("text_editor/line_numbers/show_line_length_guideline", false);
_initial_set("text_editor/line_numbers/line_length_guideline_column", 80);
- hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 10");
+ hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 1");
_initial_set("text_editor/open_scripts/smooth_scrolling", true);
_initial_set("text_editor/open_scripts/v_scroll_speed", 80);
@@ -374,12 +383,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/files/trim_trailing_whitespace_on_save", false);
_initial_set("text_editor/completion/idle_parse_delay", 2);
_initial_set("text_editor/tools/create_signal_callbacks", true);
+ _initial_set("text_editor/tools/sort_members_outline_alphabetically", false);
_initial_set("text_editor/files/autosave_interval_secs", 0);
_initial_set("text_editor/cursor/block_caret", false);
_initial_set("text_editor/cursor/caret_blink", true);
_initial_set("text_editor/cursor/caret_blink_speed", 0.65);
- hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.1");
+ hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.01");
_initial_set("text_editor/cursor/right_click_moves_caret", true);
_initial_set("text_editor/completion/auto_brace_complete", false);
@@ -394,8 +404,17 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/grid_map/pick_distance", 5000.0);
- _initial_set("editors/3d/grid_color", Color::html("808080"));
- hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ _initial_set("editors/3d/primary_grid_color", Color::html("909090"));
+ hints["editors/3d/primary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/primary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+
+ _initial_set("editors/3d/secondary_grid_color", Color::html("606060"));
+ hints["editors/3d/secondary_grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/secondary_grid_color", PROPERTY_HINT_COLOR_NO_ALPHA, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+
+ _initial_set("editors/3d/grid_size", 50);
+ hints["editors/3d/grid_size"] = PropertyInfo(Variant::INT, "editors/3d/grid_size", PROPERTY_HINT_RANGE, "1,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+
+ _initial_set("editors/3d/primary_grid_steps", 10);
+ hints["editors/3d/primary_grid_steps"] = PropertyInfo(Variant::INT, "editors/3d/primary_grid_steps", PROPERTY_HINT_RANGE, "1,100,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
_initial_set("editors/3d/default_fov", 70.0);
_initial_set("editors/3d/default_z_near", 0.05);
@@ -403,6 +422,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// navigation
_initial_set("editors/3d/navigation/navigation_scheme", 0);
+ _initial_set("editors/3d/navigation/invert_y-axis", false);
hints["editors/3d/navigation/navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/navigation/navigation_scheme", PROPERTY_HINT_ENUM, "Godot,Maya,Modo");
_initial_set("editors/3d/navigation/zoom_style", 0);
hints["editors/3d/navigation/zoom_style"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_style", PROPERTY_HINT_ENUM, "Vertical, Horizontal");
@@ -447,9 +467,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/2d/guides_color", Color(0.6, 0.0, 0.8));
_initial_set("editors/2d/bone_width", 5);
_initial_set("editors/2d/bone_color1", Color(1.0, 1.0, 1.0, 0.9));
- _initial_set("editors/2d/bone_color2", Color(0.75, 0.75, 0.75, 0.9));
+ _initial_set("editors/2d/bone_color2", Color(0.6, 0.6, 0.6, 0.9));
_initial_set("editors/2d/bone_selected_color", Color(0.9, 0.45, 0.45, 0.9));
_initial_set("editors/2d/bone_ik_color", Color(0.9, 0.9, 0.45, 0.9));
+ _initial_set("editors/2d/bone_outline_color", Color(0.35, 0.35, 0.35));
+ _initial_set("editors/2d/bone_outline_size", 2);
_initial_set("editors/2d/keep_margins_when_changing_anchors", false);
_initial_set("editors/2d/warped_mouse_panning", true);
_initial_set("editors/2d/simple_spacebar_panning", false);
@@ -546,34 +568,37 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
}
void EditorSettings::_load_default_text_editor_theme() {
- _initial_set("text_editor/highlighting/background_color", Color::html("3b000000"));
+
+ bool dark_theme = is_dark_theme();
+
+ _initial_set("text_editor/highlighting/symbol_color", Color::html("badfff"));
+ _initial_set("text_editor/highlighting/keyword_color", Color::html("ffffb3"));
+ _initial_set("text_editor/highlighting/base_type_color", Color::html("a4ffd4"));
+ _initial_set("text_editor/highlighting/engine_type_color", Color::html("83d3ff"));
+ _initial_set("text_editor/highlighting/comment_color", Color::html("676767"));
+ _initial_set("text_editor/highlighting/string_color", Color::html("ef6ebe"));
+ _initial_set("text_editor/highlighting/background_color", dark_theme ? Color::html("3b000000") : Color::html("#323b4f"));
_initial_set("text_editor/highlighting/completion_background_color", Color::html("2C2A32"));
_initial_set("text_editor/highlighting/completion_selected_color", Color::html("434244"));
_initial_set("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
_initial_set("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
_initial_set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"));
+ _initial_set("text_editor/highlighting/text_color", Color::html("aaaaaa"));
+ _initial_set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"));
_initial_set("text_editor/highlighting/caret_color", Color::html("aaaaaa"));
_initial_set("text_editor/highlighting/caret_background_color", Color::html("000000"));
- _initial_set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"));
- _initial_set("text_editor/highlighting/text_color", Color::html("aaaaaa"));
_initial_set("text_editor/highlighting/text_selected_color", Color::html("000000"));
- _initial_set("text_editor/highlighting/keyword_color", Color::html("ffffb3"));
- _initial_set("text_editor/highlighting/base_type_color", Color::html("a4ffd4"));
- _initial_set("text_editor/highlighting/engine_type_color", Color::html("83d3ff"));
- _initial_set("text_editor/highlighting/function_color", Color::html("66a2ce"));
- _initial_set("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
- _initial_set("text_editor/highlighting/comment_color", Color::html("676767"));
- _initial_set("text_editor/highlighting/string_color", Color::html("ef6ebe"));
- _initial_set("text_editor/highlighting/number_color", Color::html("EB9532"));
- _initial_set("text_editor/highlighting/symbol_color", Color::html("badfff"));
_initial_set("text_editor/highlighting/selection_color", Color::html("6ca9c2"));
_initial_set("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
_initial_set("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
_initial_set("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1));
+ _initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
+ _initial_set("text_editor/highlighting/number_color", Color::html("EB9532"));
+ _initial_set("text_editor/highlighting/function_color", Color::html("66a2ce"));
+ _initial_set("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
_initial_set("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
_initial_set("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
_initial_set("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8));
- _initial_set("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
_initial_set("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
_initial_set("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
}
@@ -581,36 +606,17 @@ void EditorSettings::_load_default_text_editor_theme() {
bool EditorSettings::_save_text_editor_theme(String p_file) {
String theme_section = "color_theme";
Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better?
- cf->set_value(theme_section, "background_color", ((Color)get("text_editor/highlighting/background_color")).to_html());
- cf->set_value(theme_section, "completion_background_color", ((Color)get("text_editor/highlighting/completion_background_color")).to_html());
- cf->set_value(theme_section, "completion_selected_color", ((Color)get("text_editor/highlighting/completion_selected_color")).to_html());
- cf->set_value(theme_section, "completion_existing_color", ((Color)get("text_editor/highlighting/completion_existing_color")).to_html());
- cf->set_value(theme_section, "completion_scroll_color", ((Color)get("text_editor/highlighting/completion_scroll_color")).to_html());
- cf->set_value(theme_section, "completion_font_color", ((Color)get("text_editor/highlighting/completion_font_color")).to_html());
- cf->set_value(theme_section, "caret_color", ((Color)get("text_editor/highlighting/caret_color")).to_html());
- cf->set_value(theme_section, "caret_background_color", ((Color)get("text_editor/highlighting/caret_background_color")).to_html());
- cf->set_value(theme_section, "line_number_color", ((Color)get("text_editor/highlighting/line_number_color")).to_html());
- cf->set_value(theme_section, "text_color", ((Color)get("text_editor/highlighting/text_color")).to_html());
- cf->set_value(theme_section, "text_selected_color", ((Color)get("text_editor/highlighting/text_selected_color")).to_html());
- cf->set_value(theme_section, "keyword_color", ((Color)get("text_editor/highlighting/keyword_color")).to_html());
- cf->set_value(theme_section, "base_type_color", ((Color)get("text_editor/highlighting/base_type_color")).to_html());
- cf->set_value(theme_section, "engine_type_color", ((Color)get("text_editor/highlighting/engine_type_color")).to_html());
- cf->set_value(theme_section, "function_color", ((Color)get("text_editor/highlighting/function_color")).to_html());
- cf->set_value(theme_section, "member_variable_color", ((Color)get("text_editor/highlighting/member_variable_color")).to_html());
- cf->set_value(theme_section, "comment_color", ((Color)get("text_editor/highlighting/comment_color")).to_html());
- cf->set_value(theme_section, "string_color", ((Color)get("text_editor/highlighting/string_color")).to_html());
- cf->set_value(theme_section, "number_color", ((Color)get("text_editor/highlighting/number_color")).to_html());
- cf->set_value(theme_section, "symbol_color", ((Color)get("text_editor/highlighting/symbol_color")).to_html());
- cf->set_value(theme_section, "selection_color", ((Color)get("text_editor/highlighting/selection_color")).to_html());
- cf->set_value(theme_section, "brace_mismatch_color", ((Color)get("text_editor/highlighting/brace_mismatch_color")).to_html());
- cf->set_value(theme_section, "current_line_color", ((Color)get("text_editor/highlighting/current_line_color")).to_html());
- cf->set_value(theme_section, "line_length_guideline_color", ((Color)get("text_editor/highlighting/line_length_guideline_color")).to_html());
- cf->set_value(theme_section, "mark_color", ((Color)get("text_editor/highlighting/mark_color")).to_html());
- cf->set_value(theme_section, "breakpoint_color", ((Color)get("text_editor/highlighting/breakpoint_color")).to_html());
- cf->set_value(theme_section, "code_folding_color", ((Color)get("text_editor/highlighting/code_folding_color")).to_html());
- cf->set_value(theme_section, "word_highlighted_color", ((Color)get("text_editor/highlighting/word_highlighted_color")).to_html());
- cf->set_value(theme_section, "search_result_color", ((Color)get("text_editor/highlighting/search_result_color")).to_html());
- cf->set_value(theme_section, "search_result_border_color", ((Color)get("text_editor/highlighting/search_result_border_color")).to_html());
+
+ List<String> keys;
+ props.get_key_list(&keys);
+ keys.sort();
+
+ for (const List<String>::Element *E = keys.front(); E; E = E->next()) {
+ String key = E->get();
+ if (key.begins_with("text_editor/highlighting/") && key.find("color") >= 0) {
+ cf->set_value(theme_section, key.replace("text_editor/highlighting/", ""), ((Color)props[key].variant).to_html());
+ }
+ }
Error err = cf->save(p_file);
@@ -959,11 +965,8 @@ void EditorSettings::save() {
Error err = ResourceSaver::save(singleton->config_file_path, singleton);
if (err != OK) {
- ERR_PRINT("Can't Save!");
- return;
- }
-
- if (OS::get_singleton()->is_stdout_verbose()) {
+ ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path);
+ } else if (OS::get_singleton()->is_stdout_verbose()) {
print_line("EditorSettings Save OK!");
}
}
@@ -1124,7 +1127,7 @@ void EditorSettings::set_project_metadata(const String &p_section, const String
cf->save(path);
}
-Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) {
+Variant EditorSettings::get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const {
Ref<ConfigFile> cf = memnew(ConfigFile);
String path = get_project_settings_dir().plus_file("project_metadata.cfg");
Error err = cf->load(path);
@@ -1189,6 +1192,14 @@ void EditorSettings::load_favorites() {
}
}
+bool EditorSettings::is_dark_theme() {
+ int AUTO_COLOR = 0;
+ int LIGHT_COLOR = 2;
+ Color base_color = get("interface/theme/base_color");
+ int icon_font_color_setting = get("interface/theme/icon_and_font_color");
+ return (icon_font_color_setting == AUTO_COLOR && ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5) || icon_font_color_setting == LIGHT_COLOR;
+}
+
void EditorSettings::list_text_editor_themes() {
String themes = "Adaptive,Default,Custom";
DirAccess *d = DirAccess::open(get_text_editor_themes_dir());
@@ -1375,33 +1386,9 @@ struct ShortCutMapping {
Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) {
#ifdef OSX_ENABLED
- static const ShortCutMapping macos_mappings[] = {
- { "editor/play", KEY_MASK_CMD | KEY_B },
- { "editor/play_scene", KEY_MASK_CMD | KEY_R },
- { "editor/pause_scene", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y },
- { "editor/stop", KEY_MASK_CMD | KEY_PERIOD },
- { "editor/play_custom_scene", KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_R },
- { "editor/editor_2d", KEY_MASK_ALT | KEY_1 },
- { "editor/editor_3d", KEY_MASK_ALT | KEY_2 },
- { "editor/editor_script", KEY_MASK_ALT | KEY_3 },
- { "editor/editor_help", KEY_MASK_ALT | KEY_SPACE },
- { "editor/fullscreen_mode", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F },
- { "editor/distraction_free_mode", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D },
- { "script_text_editor/contextual_help", KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE },
- { "script_text_editor/find_next", KEY_MASK_CMD | KEY_G },
- { "script_text_editor/find_previous", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G },
- { "script_text_editor/toggle_breakpoint", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B }
- };
-
+ // Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
if (p_keycode == KEY_DELETE) {
p_keycode = KEY_MASK_CMD | KEY_BACKSPACE;
- } else {
- for (int i = 0; i < sizeof(macos_mappings) / sizeof(ShortCutMapping); i++) {
- if (p_path == macos_mappings[i].path) {
- p_keycode = macos_mappings[i].keycode;
- break;
- }
- }
}
#endif
@@ -1466,6 +1453,9 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_settings_dir"), &EditorSettings::get_settings_dir);
ClassDB::bind_method(D_METHOD("get_project_settings_dir"), &EditorSettings::get_project_settings_dir);
+ ClassDB::bind_method(D_METHOD("set_project_metadata", "section", "key", "data"), &EditorSettings::set_project_metadata);
+ ClassDB::bind_method(D_METHOD("get_project_metadata", "section", "key", "default"), &EditorSettings::get_project_metadata, DEFVAL(Variant()));
+
ClassDB::bind_method(D_METHOD("set_favorite_dirs", "dirs"), &EditorSettings::set_favorite_dirs);
ClassDB::bind_method(D_METHOD("get_favorite_dirs"), &EditorSettings::get_favorite_dirs);
ClassDB::bind_method(D_METHOD("set_recent_dirs", "dirs"), &EditorSettings::set_recent_dirs);
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index e196ca506e..420e067cad 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -167,7 +167,7 @@ public:
String get_cache_dir() const;
void set_project_metadata(const String &p_section, const String &p_key, Variant p_data);
- Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default);
+ Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const;
void set_favorite_dirs(const Vector<String> &p_favorites_dirs);
Vector<String> get_favorite_dirs() const;
@@ -175,6 +175,8 @@ public:
Vector<String> get_recent_dirs() const;
void load_favorites();
+ bool is_dark_theme();
+
void list_text_editor_themes();
void load_text_editor_theme();
bool import_text_editor_theme(String p_file);
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
new file mode 100644
index 0000000000..0852a42794
--- /dev/null
+++ b/editor/editor_spin_slider.cpp
@@ -0,0 +1,363 @@
+/*************************************************************************/
+/* editor_spin_slider.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "editor_spin_slider.h"
+#include "editor_scale.h"
+#include "os/input.h"
+String EditorSpinSlider::get_text_value() const {
+ int zeros = Math::step_decimals(get_step());
+ return String::num(get_value(), zeros);
+}
+void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
+
+ if (read_only)
+ return;
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
+
+ if (mb->is_pressed()) {
+
+ if (updown_offset != -1 && mb->get_position().x > updown_offset) {
+ //there is an updown, so use it.
+ if (mb->get_position().y < get_size().height / 2) {
+ set_value(get_value() + get_step());
+ } else {
+ set_value(get_value() - get_step());
+ }
+ return;
+ } else {
+
+ grabbing_spinner_attempt = true;
+ grabbing_spinner = false;
+ grabbing_spinner_mouse_pos = Input::get_singleton()->get_mouse_position();
+ }
+ } else {
+
+ if (grabbing_spinner_attempt) {
+
+ if (grabbing_spinner) {
+
+ Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
+ Input::get_singleton()->warp_mouse_position(grabbing_spinner_mouse_pos);
+ update();
+ } else {
+ Rect2 gr = get_global_rect();
+ value_input->set_text(get_text_value());
+ value_input->set_position(gr.position);
+ value_input->set_size(gr.size);
+ value_input->call_deferred("show_modal");
+ value_input->call_deferred("grab_focus");
+ value_input->call_deferred("select_all");
+ }
+
+ grabbing_spinner = false;
+ grabbing_spinner_attempt = false;
+ }
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid()) {
+
+ if (grabbing_spinner_attempt) {
+
+ if (!grabbing_spinner) {
+ Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
+ grabbing_spinner = true;
+ }
+
+ double v = get_value();
+
+ double diff_x = mm->get_relative().x;
+ diff_x = Math::pow(ABS(diff_x), 1.8) * SGN(diff_x);
+ diff_x *= 0.1;
+
+ v += diff_x * get_step();
+
+ set_value(v);
+
+ } else if (updown_offset != -1) {
+ bool new_hover = (mm->get_position().x > updown_offset);
+ if (new_hover != hover_updown) {
+ hover_updown = new_hover;
+ update();
+ }
+ }
+ }
+
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid() && k->is_pressed() && k->is_action("ui_accept")) {
+ Rect2 gr = get_global_rect();
+ value_input->set_text(get_text_value());
+ value_input->set_position(gr.position);
+ value_input->set_size(gr.size);
+ value_input->call_deferred("show_modal");
+ value_input->call_deferred("grab_focus");
+ value_input->call_deferred("select_all");
+ }
+}
+
+void EditorSpinSlider::_value_input_closed() {
+ set_value(value_input->get_text().to_double());
+}
+
+void EditorSpinSlider::_value_input_entered(const String &p_text) {
+ set_value(p_text.to_double());
+ value_input->hide();
+}
+
+void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
+
+ if (mb->is_pressed()) {
+
+ grabbing_grabber = true;
+ grabbing_ratio = get_as_ratio();
+ grabbing_from = grabber->get_transform().xform(mb->get_position()).x;
+ } else {
+ grabbing_grabber = false;
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && grabbing_grabber) {
+
+ float grabbing_ofs = (grabber->get_transform().xform(mm->get_position()).x - grabbing_from) / float(grabber_range);
+ set_as_ratio(grabbing_ratio + grabbing_ofs);
+ update();
+ }
+}
+
+void EditorSpinSlider::_notification(int p_what) {
+
+ if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT || p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT) {
+ if (grabbing_spinner) {
+ Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
+ grabbing_spinner = false;
+ grabbing_spinner_attempt = false;
+ }
+ }
+
+ if (p_what == NOTIFICATION_DRAW) {
+
+ updown_offset = -1;
+
+ Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
+ draw_style_box(sb, Rect2(Vector2(), get_size()));
+ Ref<Font> font = get_font("font", "LineEdit");
+
+ int avail_width = get_size().width - sb->get_minimum_size().width - sb->get_minimum_size().width;
+ avail_width -= font->get_string_size(label).width;
+ Ref<Texture> updown = get_icon("updown", "SpinBox");
+
+ if (get_step() == 1) {
+ avail_width -= updown->get_width();
+ }
+
+ if (has_focus()) {
+ Ref<StyleBox> focus = get_stylebox("focus", "LineEdit");
+ draw_style_box(focus, Rect2(Vector2(), get_size()));
+ }
+
+ String numstr = get_text_value();
+
+ int vofs = (get_size().height - font->get_height()) / 2 + font->get_ascent();
+
+ Color fc = get_color("font_color", "LineEdit");
+
+ int label_ofs = sb->get_offset().x + avail_width;
+ draw_string(font, Vector2(label_ofs, vofs), label, fc * Color(1, 1, 1, 0.5));
+ draw_string(font, Vector2(sb->get_offset().x, vofs), numstr, fc, avail_width);
+
+ if (get_step() == 1) {
+ Ref<Texture> updown = get_icon("updown", "SpinBox");
+ int updown_vofs = (get_size().height - updown->get_height()) / 2;
+ updown_offset = get_size().width - sb->get_margin(MARGIN_RIGHT) - updown->get_width();
+ Color c(1, 1, 1);
+ if (hover_updown) {
+ c *= Color(1.2, 1.2, 1.2);
+ }
+ draw_texture(updown, Vector2(updown_offset, updown_vofs), c);
+ if (grabber->is_visible()) {
+ grabber->hide();
+ }
+ } else if (!hide_slider) {
+ int grabber_w = 4 * EDSCALE;
+ int width = get_size().width - sb->get_minimum_size().width - grabber_w;
+ int ofs = sb->get_offset().x;
+ int svofs = (get_size().height + vofs) / 2 - 1;
+ Color c = fc;
+ c.a = 0.2;
+
+ draw_rect(Rect2(ofs, svofs + 1, width, 2 * EDSCALE), c);
+ int gofs = get_as_ratio() * width;
+ c.a = 0.9;
+ Rect2 grabber_rect = Rect2(ofs + gofs, svofs + 1, grabber_w, 2 * EDSCALE);
+ draw_rect(grabber_rect, c);
+
+ bool display_grabber = (mouse_over_spin || mouse_over_grabber) && !grabbing_spinner;
+ if (grabber->is_visible() != display_grabber) {
+ if (display_grabber) {
+ grabber->show();
+ } else {
+ grabber->hide();
+ }
+ }
+
+ if (display_grabber) {
+ Ref<Texture> grabber_tex;
+ if (mouse_over_grabber) {
+ grabber_tex = get_icon("grabber_highlight", "HSlider");
+ } else {
+ grabber_tex = get_icon("grabber", "HSlider");
+ }
+
+ if (grabber->get_texture() != grabber_tex) {
+ grabber->set_texture(grabber_tex);
+ }
+
+ grabber->set_size(Size2(0, 0));
+ grabber->set_position(get_global_position() + grabber_rect.position + grabber_rect.size * 0.5 - grabber->get_size() * 0.5);
+ grabber_range = width;
+ }
+ }
+ }
+
+ if (p_what == NOTIFICATION_MOUSE_ENTER) {
+
+ mouse_over_spin = true;
+ update();
+ }
+ if (p_what == NOTIFICATION_MOUSE_EXIT) {
+
+ mouse_over_spin = false;
+ update();
+ }
+}
+
+Size2 EditorSpinSlider::get_minimum_size() const {
+
+ Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
+ Ref<Font> font = get_font("font", "LineEdit");
+
+ Size2 ms = sb->get_minimum_size();
+ ms.height += font->get_height();
+
+ return ms;
+}
+
+void EditorSpinSlider::set_hide_slider(bool p_hide) {
+ hide_slider = p_hide;
+ update();
+}
+
+bool EditorSpinSlider::is_hiding_slider() const {
+ return hide_slider;
+}
+
+void EditorSpinSlider::set_label(const String &p_label) {
+ label = p_label;
+ update();
+}
+
+String EditorSpinSlider::get_label() const {
+ return label;
+}
+
+void EditorSpinSlider::_grabber_mouse_entered() {
+ mouse_over_grabber = true;
+ update();
+}
+
+void EditorSpinSlider::_grabber_mouse_exited() {
+ mouse_over_grabber = false;
+ update();
+}
+
+void EditorSpinSlider::set_read_only(bool p_enable) {
+
+ read_only = p_enable;
+ update();
+}
+
+bool EditorSpinSlider::is_read_only() const {
+ return read_only;
+}
+
+void EditorSpinSlider::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_label", "label"), &EditorSpinSlider::set_label);
+ ClassDB::bind_method(D_METHOD("get_label"), &EditorSpinSlider::get_label);
+
+ ClassDB::bind_method(D_METHOD("set_read_only", "read_only"), &EditorSpinSlider::set_read_only);
+ ClassDB::bind_method(D_METHOD("is_read_only"), &EditorSpinSlider::is_read_only);
+
+ ClassDB::bind_method(D_METHOD("_gui_input"), &EditorSpinSlider::_gui_input);
+ ClassDB::bind_method(D_METHOD("_grabber_mouse_entered"), &EditorSpinSlider::_grabber_mouse_entered);
+ ClassDB::bind_method(D_METHOD("_grabber_mouse_exited"), &EditorSpinSlider::_grabber_mouse_exited);
+ ClassDB::bind_method(D_METHOD("_grabber_gui_input"), &EditorSpinSlider::_grabber_gui_input);
+ ClassDB::bind_method(D_METHOD("_value_input_closed"), &EditorSpinSlider::_value_input_closed);
+ ClassDB::bind_method(D_METHOD("_value_input_entered"), &EditorSpinSlider::_value_input_entered);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only");
+}
+
+EditorSpinSlider::EditorSpinSlider() {
+
+ grabbing_spinner_attempt = false;
+ grabbing_spinner = false;
+
+ set_focus_mode(FOCUS_ALL);
+ updown_offset = -1;
+ hover_updown = false;
+ grabber = memnew(TextureRect);
+ add_child(grabber);
+ grabber->hide();
+ grabber->set_as_toplevel(true);
+ grabber->set_mouse_filter(MOUSE_FILTER_STOP);
+ grabber->connect("mouse_entered", this, "_grabber_mouse_entered");
+ grabber->connect("mouse_exited", this, "_grabber_mouse_exited");
+ grabber->connect("gui_input", this, "_grabber_gui_input");
+ mouse_over_spin = false;
+ mouse_over_grabber = false;
+ grabbing_grabber = false;
+ grabber_range = 1;
+ value_input = memnew(LineEdit);
+ add_child(value_input);
+ value_input->set_as_toplevel(true);
+ value_input->hide();
+ value_input->connect("modal_closed", this, "_value_input_closed");
+ value_input->connect("text_entered", this, "_value_input_entered");
+ hide_slider = false;
+ read_only = false;
+}
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
new file mode 100644
index 0000000000..37d8a5f128
--- /dev/null
+++ b/editor/editor_spin_slider.h
@@ -0,0 +1,92 @@
+/*************************************************************************/
+/* editor_spin_slider.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef EDITOR_SPIN_SLIDER_H
+#define EDITOR_SPIN_SLIDER_H
+
+#include "scene/gui/line_edit.h"
+#include "scene/gui/range.h"
+#include "scene/gui/texture_rect.h"
+
+class EditorSpinSlider : public Range {
+ GDCLASS(EditorSpinSlider, Range)
+
+ String label;
+ int updown_offset;
+ bool hover_updown;
+ bool mouse_hover;
+
+ TextureRect *grabber;
+ int grabber_range;
+
+ bool mouse_over_spin;
+ bool mouse_over_grabber;
+
+ bool grabbing_grabber;
+ int grabbing_from;
+ float grabbing_ratio;
+
+ bool grabbing_spinner_attempt;
+ bool grabbing_spinner;
+
+ bool read_only;
+ Vector2 grabbing_spinner_mouse_pos;
+
+ LineEdit *value_input;
+
+ void _grabber_gui_input(const Ref<InputEvent> &p_event);
+ void _value_input_closed();
+ void _value_input_entered(const String &);
+
+ bool hide_slider;
+
+protected:
+ void _notification(int p_what);
+ void _gui_input(const Ref<InputEvent> &p_event);
+ static void _bind_methods();
+ void _grabber_mouse_entered();
+ void _grabber_mouse_exited();
+
+public:
+ String get_text_value() const;
+ void set_label(const String &p_label);
+ String get_label() const;
+
+ void set_hide_slider(bool p_hide);
+ bool is_hiding_slider() const;
+
+ void set_read_only(bool p_enable);
+ bool is_read_only() const;
+
+ virtual Size2 get_minimum_size() const;
+ EditorSpinSlider();
+};
+
+#endif // EDITOR_SPIN_SLIDER_H
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 096a60afa3..98402d8df5 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -254,7 +254,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#323b4f"));
float contrast = EDITOR_DEF("interface/theme/contrast", default_contrast);
- int preset = EDITOR_DEF("interface/theme/preset", 0);
+ String preset = EDITOR_DEF("interface/theme/preset", "Default");
+
int icon_font_color_setting = EDITOR_DEF("interface/theme/icon_and_font_color", 0);
bool highlight_tabs = EDITOR_DEF("interface/theme/highlight_tabs", false);
int border_size = EDITOR_DEF("interface/theme/border_size", 1);
@@ -266,45 +267,52 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color preset_accent_color;
Color preset_base_color;
float preset_contrast;
- switch (preset) {
- case 0: { // Default
- preset_accent_color = Color::html("#699ce8");
- preset_base_color = Color::html("#323b4f");
- preset_contrast = default_contrast;
- } break;
- case 1: { // Grey
- preset_accent_color = Color::html("#b8e4ff");
- preset_base_color = Color::html("#3d3d3d");
- preset_contrast = 0.2;
- } break;
- case 2: { // Godot 2
- preset_accent_color = Color::html("#86ace2");
- preset_base_color = Color::html("#3C3A44");
- preset_contrast = 0.25;
- } break;
- case 3: { // Arc
- preset_accent_color = Color::html("#5294e2");
- preset_base_color = Color::html("#383c4a");
- preset_contrast = 0.25;
- } break;
- case 4: { // Light
- preset_accent_color = Color::html("#2070ff");
- preset_base_color = Color::html("#ffffff");
- preset_contrast = 0.08;
- } break;
- case 5: { // Alien
- preset_accent_color = Color::html("#1bfe99");
- preset_base_color = Color::html("#2f373f");
- preset_contrast = 0.25;
- }
- default: { // Custom
- accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#699ce8"));
- base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#323b4f"));
- contrast = EDITOR_DEF("interface/theme/contrast", default_contrast);
- }
+
+ // Please, use alphabet order if you've added new theme here(After "Default" and "Custom")
+
+ if (preset == "Default") {
+ preset_accent_color = Color::html("#699ce8");
+ preset_base_color = Color::html("#323b4f");
+ preset_contrast = default_contrast;
+ } else if (preset == "Custom") {
+ accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#699ce8"));
+ base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#323b4f"));
+ contrast = EDITOR_DEF("interface/theme/contrast", default_contrast);
+ } else if (preset == "Alien") {
+ preset_accent_color = Color::html("#1bfe99");
+ preset_base_color = Color::html("#2f373f");
+ preset_contrast = 0.25;
+ } else if (preset == "Arc") {
+ preset_accent_color = Color::html("#5294e2");
+ preset_base_color = Color::html("#383c4a");
+ preset_contrast = 0.25;
+ } else if (preset == "Godot 2") {
+ preset_accent_color = Color::html("#86ace2");
+ preset_base_color = Color::html("#3C3A44");
+ preset_contrast = 0.25;
+ } else if (preset == "Grey") {
+ preset_accent_color = Color::html("#b8e4ff");
+ preset_base_color = Color::html("#3d3d3d");
+ preset_contrast = 0.2;
+ } else if (preset == "Light") {
+ preset_accent_color = Color::html("#2070ff");
+ preset_base_color = Color::html("#ffffff");
+ preset_contrast = 0.08;
+ } else if (preset == "Solarized (Dark)") {
+ preset_accent_color = Color::html("#268bd2");
+ preset_base_color = Color::html("#073642");
+ preset_contrast = 0.15;
+ } else if (preset == "Solarized (Light)") {
+ preset_accent_color = Color::html("#268bd2");
+ preset_base_color = Color::html("#fdf6e3");
+ preset_contrast = 0.06;
+ } else { // Default
+ preset_accent_color = Color::html("#699ce8");
+ preset_base_color = Color::html("#323b4f");
+ preset_contrast = default_contrast;
}
- if (preset != 6) {
+ if (preset != "Custom") {
accent_color = preset_accent_color;
base_color = preset_base_color;
contrast = preset_contrast;
@@ -318,9 +326,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
EditorSettings::get_singleton()->set_manually("interface/theme/contrast", contrast);
//Colors
- int AUTO_COLOR = 0;
- int LIGHT_COLOR = 2;
- bool dark_theme = (icon_font_color_setting == AUTO_COLOR && ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5) || icon_font_color_setting == LIGHT_COLOR;
+ bool dark_theme = EditorSettings::get_singleton()->is_dark_theme();
const Color dark_color_1 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast);
const Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5);
@@ -626,8 +632,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("font_color_disabled", "PopupMenu", font_color_disabled);
theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
- theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons"));
- theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
+ theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiRadioChecked", "EditorIcons"));
+ theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiRadioUnchecked", "EditorIcons"));
theme->set_icon("submenu", "PopupMenu", theme->get_icon("ArrowRight", "EditorIcons"));
theme->set_icon("visibility_hidden", "PopupMenu", theme->get_icon("GuiVisibilityHidden", "EditorIcons"));
theme->set_icon("visibility_visible", "PopupMenu", theme->get_icon("GuiVisibilityVisible", "EditorIcons"));
@@ -891,6 +897,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
//RichTextLabel
theme->set_color("default_color", "RichTextLabel", font_color);
+ theme->set_color("font_color_shadow", "RichTextLabel", Color(0, 0, 0, 0));
+ theme->set_constant("shadow_offset_x", "RichTextLabel", 1 * EDSCALE);
+ theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * EDSCALE);
+ theme->set_constant("shadow_as_outline", "RichTextLabel", 0 * EDSCALE);
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
@@ -908,6 +918,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("shadow_as_outline", "Label", 0 * EDSCALE);
theme->set_constant("line_spacing", "Label", 3 * EDSCALE);
+ // LinkButton
+ theme->set_stylebox("focus", "LinkButton", style_empty);
+ theme->set_color("font_color", "LinkButton", font_color);
+
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
style_tooltip->set_bg_color(Color(mono_color.r, mono_color.g, mono_color.b, 0.9));
@@ -932,6 +946,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("bg", "GraphEdit", style_tree_bg);
theme->set_color("grid_major", "GraphEdit", grid_major_color);
theme->set_color("grid_minor", "GraphEdit", grid_minor_color);
+ theme->set_color("activity", "GraphEdit", accent_color);
theme->set_icon("minus", "GraphEdit", theme->get_icon("ZoomLess", "EditorIcons"));
theme->set_icon("more", "GraphEdit", theme->get_icon("ZoomMore", "EditorIcons"));
theme->set_icon("reset", "GraphEdit", theme->get_icon("ZoomReset", "EditorIcons"));
@@ -1039,8 +1054,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color comment_color = dim_color;
const Color string_color = Color::html(dark_theme ? "#ffd942" : "#ffd118").linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
- const Color te_background_color = Color(0, 0, 0, 0);
- const Color completion_background_color = base_color;
+ const Color te_background_color = dark_theme ? background_color : base_color;
+ const Color completion_background_color = dark_theme ? base_color : background_color;
const Color completion_selected_color = alpha1;
const Color completion_existing_color = alpha2;
const Color completion_scroll_color = alpha1;
@@ -1053,7 +1068,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color selection_color = alpha2;
const Color brace_mismatch_color = error_color;
const Color current_line_color = alpha1;
- const Color line_length_guideline_color = warning_color;
+ const Color line_length_guideline_color = dark_theme ? base_color : background_color;
const Color word_highlighted_color = alpha1;
const Color number_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
const Color function_color = main_color;
@@ -1073,7 +1088,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
setting->set_initial_value("text_editor/highlighting/engine_type_color", type_color, true);
setting->set_initial_value("text_editor/highlighting/comment_color", comment_color, true);
setting->set_initial_value("text_editor/highlighting/string_color", string_color, true);
- setting->set_initial_value("text_editor/highlighting/background_color", background_color, true);
+ setting->set_initial_value("text_editor/highlighting/background_color", te_background_color, true);
setting->set_initial_value("text_editor/highlighting/completion_background_color", completion_background_color, true);
setting->set_initial_value("text_editor/highlighting/completion_selected_color", completion_selected_color, true);
setting->set_initial_value("text_editor/highlighting/completion_existing_color", completion_existing_color, true);
@@ -1098,36 +1113,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
setting->set_initial_value("text_editor/highlighting/search_result_color", search_result_color, true);
setting->set_initial_value("text_editor/highlighting/search_result_border_color", search_result_border_color, true);
} else if (text_editor_color_theme == "Default") {
- setting->set_initial_value("text_editor/highlighting/symbol_color", Color::html("badfff"), true);
- setting->set_initial_value("text_editor/highlighting/keyword_color", Color::html("ffffb3"), true);
- setting->set_initial_value("text_editor/highlighting/base_type_color", Color::html("a4ffd4"), true);
- setting->set_initial_value("text_editor/highlighting/engine_type_color", Color::html("83d3ff"), true);
- setting->set_initial_value("text_editor/highlighting/comment_color", Color::html("676767"), true);
- setting->set_initial_value("text_editor/highlighting/string_color", Color::html("ef6ebe"), true);
- setting->set_initial_value("text_editor/highlighting/background_color", Color::html("3b000000"), true);
- setting->set_initial_value("text_editor/highlighting/completion_background_color", Color::html("2C2A32"), true);
- setting->set_initial_value("text_editor/highlighting/completion_selected_color", Color::html("434244"), true);
- setting->set_initial_value("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"), true);
- setting->set_initial_value("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"), true);
- setting->set_initial_value("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"), true);
- setting->set_initial_value("text_editor/highlighting/text_color", Color::html("aaaaaa"), true);
- setting->set_initial_value("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"), true);
- setting->set_initial_value("text_editor/highlighting/caret_color", Color::html("aaaaaa"), true);
- setting->set_initial_value("text_editor/highlighting/caret_background_color", Color::html("000000"), true);
- setting->set_initial_value("text_editor/highlighting/text_selected_color", Color::html("000000"), true);
- setting->set_initial_value("text_editor/highlighting/selection_color", Color::html("6ca9c2"), true);
- setting->set_initial_value("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2), true);
- setting->set_initial_value("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15), true);
- setting->set_initial_value("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1), true);
- setting->set_initial_value("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15), true);
- setting->set_initial_value("text_editor/highlighting/number_color", Color::html("EB9532"), true);
- setting->set_initial_value("text_editor/highlighting/function_color", Color::html("66a2ce"), true);
- setting->set_initial_value("text_editor/highlighting/member_variable_color", Color::html("e64e59"), true);
- setting->set_initial_value("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4), true);
- setting->set_initial_value("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2), true);
- setting->set_initial_value("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8), true);
- setting->set_initial_value("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1), true);
- setting->set_initial_value("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1), true);
+ setting->load_text_editor_theme();
}
return theme;
@@ -1139,7 +1125,9 @@ Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
String custom_theme = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
if (custom_theme != "") {
theme = ResourceLoader::load(custom_theme);
- } else {
+ }
+
+ if (!theme.is_valid()) {
theme = create_editor_theme(p_theme);
}
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 41b016bdca..a39c8b2209 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -70,7 +70,7 @@ void ExportTemplateManager::_update_template_list() {
memdelete(d);
- String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + VERSION_STATUS + VERSION_MODULE_CONFIG;
+ String current_version = VERSION_FULL_CONFIG;
Label *current = memnew(Label);
current->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -128,7 +128,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
memdelete(template_list->get_child(0));
}
template_downloader->popup_centered_minsize();
- template_list_state->set_text(TTR("Retrieving mirrors, please wait.."));
+ template_list_state->set_text(TTR("Retrieving mirrors, please wait..."));
template_download_progress->set_max(100);
template_download_progress->set_value(0);
request_mirror->request("https://godotengine.org/mirrorlist/" + p_version + ".json");
@@ -217,25 +217,15 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
data_str.parse_utf8((const char *)data.ptr(), data.size());
data_str = data_str.strip_edges();
- if (data_str.get_slice_count("-") != 2 || data_str.get_slice_count(".") != 2) {
- EditorNode::get_singleton()->show_warning(TTR("Invalid version.txt format inside templates."));
+ // Version number should be of the form major.minor[.patch].status[.module_config]
+ // so it can in theory have 3 or more slices.
+ if (data_str.get_slice_count(".") < 3) {
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Invalid version.txt format inside templates: %s."), data_str));
unzClose(pkg);
return;
}
- String ver = data_str.get_slice("-", 0);
-
- int major = ver.get_slice(".", 0).to_int();
- int minor = ver.get_slice(".", 1).to_int();
- String rev = data_str.get_slice("-", 1);
-
- if (!rev.is_valid_identifier()) {
- EditorNode::get_singleton()->show_warning(TTR("Invalid version.txt format inside templates. Revision is not a valid identifier."));
- unzClose(pkg);
- return;
- }
-
- version = itos(major) + "." + itos(minor) + "-" + rev;
+ version = data_str;
}
fc++;
@@ -443,7 +433,7 @@ void ExportTemplateManager::_begin_template_download(const String &p_url) {
template_download_progress->set_max(100);
template_download_progress->set_value(0);
template_download_progress->show();
- template_list_state->set_text(TTR("Connecting to Mirror.."));
+ template_list_state->set_text(TTR("Connecting to Mirror..."));
}
void ExportTemplateManager::_notification(int p_what) {
@@ -469,13 +459,13 @@ void ExportTemplateManager::_notification(int p_what) {
status = TTR("Can't Resolve");
errored = true;
break;
- case HTTPClient::STATUS_CONNECTING: status = TTR("Connecting.."); break;
+ case HTTPClient::STATUS_CONNECTING: status = TTR("Connecting..."); break;
case HTTPClient::STATUS_CANT_CONNECT:
status = TTR("Can't Connect");
errored = true;
break;
case HTTPClient::STATUS_CONNECTED: status = TTR("Connected"); break;
- case HTTPClient::STATUS_REQUESTING: status = TTR("Requesting.."); break;
+ case HTTPClient::STATUS_REQUESTING: status = TTR("Requesting..."); break;
case HTTPClient::STATUS_BODY:
status = TTR("Downloading");
if (download_templates->get_body_size() > 0) {
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 0be3bb86c7..e15c876893 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -383,11 +383,11 @@ void FileSystemDock::_update_file_display_toggle_button() {
if (button_display_mode->is_pressed()) {
display_mode = DISPLAY_LIST;
button_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons"));
- button_display_mode->set_tooltip(TTR("View items as a grid of thumbnails"));
+ button_display_mode->set_tooltip(TTR("View items as a grid of thumbnails."));
} else {
display_mode = DISPLAY_THUMBNAILS;
button_display_mode->set_icon(get_icon("FileList", "EditorIcons"));
- button_display_mode->set_tooltip(TTR("View items as a list"));
+ button_display_mode->set_tooltip(TTR("View items as a list."));
}
}
@@ -533,6 +533,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
filelist.push_back(fi);
}
+ filelist.sort();
}
String oi = "Object";
@@ -719,12 +720,13 @@ void FileSystemDock::_push_to_history() {
button_hist_next->set_disabled(history_pos == history.size() - 1);
}
-void FileSystemDock::_get_all_files_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files) const {
+void FileSystemDock::_get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const {
if (efsd == NULL)
return;
for (int i = 0; i < efsd->get_subdir_count(); i++) {
- _get_all_files_in_dir(efsd->get_subdir(i), files);
+ folders.push_back(efsd->get_subdir(i)->get_path());
+ _get_all_items_in_dir(efsd->get_subdir(i), files, folders);
}
for (int i = 0; i < efsd->get_file_count(); i++) {
files.push_back(efsd->get_file_path(i));
@@ -746,7 +748,8 @@ void FileSystemDock::_find_remaps(EditorFileSystemDirectory *efsd, const Map<Str
}
}
-void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_renames) const {
+void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_new_path,
+ Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames) const {
//Ensure folder paths end with "/"
String old_path = (p_item.is_file || p_item.path.ends_with("/")) ? p_item.path : (p_item.path + "/");
String new_path = (p_item.is_file || p_new_path.ends_with("/")) ? p_new_path : (p_new_path + "/");
@@ -763,11 +766,13 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
}
//Build a list of files which will have new paths as a result of this operation
- Vector<String> changed_paths;
+ Vector<String> file_changed_paths;
+ Vector<String> folder_changed_paths;
if (p_item.is_file) {
- changed_paths.push_back(old_path);
+ file_changed_paths.push_back(old_path);
} else {
- _get_all_files_in_dir(EditorFileSystem::get_singleton()->get_filesystem_path(old_path), changed_paths);
+ folder_changed_paths.push_back(old_path);
+ _get_all_items_in_dir(EditorFileSystem::get_singleton()->get_filesystem_path(old_path), file_changed_paths, folder_changed_paths);
}
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
@@ -783,12 +788,12 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
}
// update scene if it is open
- for (int i = 0; i < changed_paths.size(); ++i) {
- String new_item_path = p_item.is_file ? new_path : changed_paths[i].replace_first(old_path, new_path);
- if (ResourceLoader::get_resource_type(new_item_path) == "PackedScene" && editor->is_scene_open(changed_paths[i])) {
+ for (int i = 0; i < file_changed_paths.size(); ++i) {
+ String new_item_path = p_item.is_file ? new_path : file_changed_paths[i].replace_first(old_path, new_path);
+ if (ResourceLoader::get_resource_type(new_item_path) == "PackedScene" && editor->is_scene_open(file_changed_paths[i])) {
EditorData *ed = &editor->get_editor_data();
for (int j = 0; j < ed->get_edited_scene_count(); j++) {
- if (ed->get_scene_path(j) == changed_paths[i]) {
+ if (ed->get_scene_path(j) == file_changed_paths[i]) {
ed->get_edited_scene_root(j)->set_filename(new_item_path);
break;
}
@@ -797,9 +802,12 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_
}
//Only treat as a changed dependency if it was successfully moved
- for (int i = 0; i < changed_paths.size(); ++i) {
- p_renames[changed_paths[i]] = changed_paths[i].replace_first(old_path, new_path);
- print_line(" Remap: " + changed_paths[i] + " -> " + p_renames[changed_paths[i]]);
+ for (int i = 0; i < file_changed_paths.size(); ++i) {
+ p_file_renames[file_changed_paths[i]] = file_changed_paths[i].replace_first(old_path, new_path);
+ print_line(" Remap: " + file_changed_paths[i] + " -> " + p_file_renames[file_changed_paths[i]]);
+ }
+ for (int i = 0; i < folder_changed_paths.size(); ++i) {
+ p_folder_renames[folder_changed_paths[i]] = folder_changed_paths[i].replace_first(old_path, new_path);
}
} else {
EditorNode::get_singleton()->add_io_error(TTR("Error moving:") + "\n" + old_path + "\n");
@@ -912,13 +920,32 @@ void FileSystemDock::_update_dependencies_after_move(const Map<String, String> &
}
}
+void FileSystemDock::_update_favorite_dirs_list_after_move(const Map<String, String> &p_renames) const {
+
+ Vector<String> favorite_dirs = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> new_favorite_dirs;
+
+ for (int i = 0; i < favorite_dirs.size(); i++) {
+ String old_path = favorite_dirs[i] + "/";
+
+ if (p_renames.has(old_path)) {
+ String new_path = p_renames[old_path];
+ new_favorite_dirs.push_back(new_path.substr(0, new_path.length() - 1));
+ } else {
+ new_favorite_dirs.push_back(favorite_dirs[i]);
+ }
+ }
+
+ EditorSettings::get_singleton()->set_favorite_dirs(new_favorite_dirs);
+}
+
void FileSystemDock::_make_dir_confirm() {
String dir_name = make_dir_dialog_text->get_text().strip_edges();
if (dir_name.length() == 0) {
EditorNode::get_singleton()->show_warning(TTR("No name provided"));
return;
- } else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1) {
+ } else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) {
EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters"));
return;
}
@@ -970,10 +997,12 @@ void FileSystemDock::_rename_operation_confirm() {
}
memdelete(da);
- Map<String, String> renames;
- _try_move_item(to_rename, new_path, renames);
- _update_dependencies_after_move(renames);
- _update_resource_paths_after_move(renames);
+ Map<String, String> file_renames;
+ Map<String, String> folder_renames;
+ _try_move_item(to_rename, new_path, file_renames, folder_renames);
+ _update_dependencies_after_move(file_renames);
+ _update_resource_paths_after_move(file_renames);
+ _update_favorite_dirs_list_after_move(folder_renames);
//Rescan everything
print_line("call rescan!");
@@ -1017,25 +1046,44 @@ void FileSystemDock::_duplicate_operation_confirm() {
void FileSystemDock::_move_operation_confirm(const String &p_to_path) {
- Map<String, String> renames;
+ Map<String, String> file_renames;
+ Map<String, String> folder_renames;
+ bool is_moved = false;
for (int i = 0; i < to_move.size(); i++) {
String old_path = to_move[i].path.ends_with("/") ? to_move[i].path.substr(0, to_move[i].path.length() - 1) : to_move[i].path;
String new_path = p_to_path.plus_file(old_path.get_file());
- _try_move_item(to_move[i], new_path, renames);
+ if (old_path != new_path) {
+ _try_move_item(to_move[i], new_path, file_renames, folder_renames);
+ is_moved = true;
+ }
}
- _update_dependencies_after_move(renames);
- _update_resource_paths_after_move(renames);
+ if (is_moved) {
+ _update_dependencies_after_move(file_renames);
+ _update_resource_paths_after_move(file_renames);
+ _update_favorite_dirs_list_after_move(folder_renames);
- print_line("call rescan!");
- _rescan();
+ print_line("call rescan!");
+ _rescan();
+ }
}
void FileSystemDock::_file_option(int p_option) {
switch (p_option) {
case FILE_SHOW_IN_EXPLORER: {
- String dir = ProjectSettings::get_singleton()->globalize_path(this->path);
- OS::get_singleton()->shell_open(String("file://") + dir);
+
+ String path = this->path;
+
+ // first try to grab directory from selected file, so that it works for searched files
+ int idx = files->get_current();
+
+ if (idx >= 0 && idx < files->get_item_count()) {
+ path = files->get_item_metadata(idx);
+ path = path.get_base_dir();
+ }
+
+ path = ProjectSettings::get_singleton()->globalize_path(path);
+ OS::get_singleton()->shell_open(String("file://") + path);
} break;
case FILE_OPEN: {
for (int i = 0; i < files->get_item_count(); i++) {
@@ -1195,6 +1243,15 @@ void FileSystemDock::_file_option(int p_option) {
make_dir_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
make_dir_dialog_text->grab_focus();
} break;
+ case FILE_NEW_SCRIPT: {
+ String tarDir = path;
+ if (tarDir != "res://" && !tarDir.ends_with("/")) {
+ tarDir += "/";
+ }
+
+ make_script_dialog_text->config("Node", tarDir + "new_script.gd");
+ make_script_dialog_text->popup_centered(Size2(300, 300) * EDSCALE);
+ } break;
case FILE_COPY_PATH: {
int idx = files->get_current();
if (idx < 0 || idx >= files->get_item_count())
@@ -1307,12 +1364,12 @@ void FileSystemDock::_dir_rmb_pressed(const Vector2 &p_pos) {
folder_options->add_separator();
folder_options->add_item(TTR("Copy Path"), FOLDER_COPY_PATH);
if (fpath != "res://") {
- folder_options->add_item(TTR("Rename.."), FOLDER_RENAME);
- folder_options->add_item(TTR("Move To.."), FOLDER_MOVE);
+ folder_options->add_item(TTR("Rename..."), FOLDER_RENAME);
+ folder_options->add_item(TTR("Move To..."), FOLDER_MOVE);
folder_options->add_item(TTR("Delete"), FOLDER_REMOVE);
}
folder_options->add_separator();
- folder_options->add_item(TTR("New Folder.."), FOLDER_NEW_FOLDER);
+ folder_options->add_item(TTR("New Folder..."), FOLDER_NEW_FOLDER);
folder_options->add_item(TTR("Show In File Manager"), FOLDER_SHOW_IN_EXPLORER);
}
folder_options->set_position(tree->get_global_position() + p_pos);
@@ -1597,8 +1654,8 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
}
if (filenames.size() == 1) {
- file_options->add_item(TTR("Edit Dependencies.."), FILE_DEPENDENCIES);
- file_options->add_item(TTR("View Owners.."), FILE_OWNERS);
+ file_options->add_item(TTR("Edit Dependencies..."), FILE_DEPENDENCIES);
+ file_options->add_item(TTR("View Owners..."), FILE_OWNERS);
file_options->add_separator();
}
@@ -1611,15 +1668,16 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
if (num_items >= 1) {
if (num_items == 1) {
file_options->add_item(TTR("Copy Path"), FILE_COPY_PATH);
- file_options->add_item(TTR("Rename.."), FILE_RENAME);
- file_options->add_item(TTR("Duplicate.."), FILE_DUPLICATE);
+ file_options->add_item(TTR("Rename..."), FILE_RENAME);
+ file_options->add_item(TTR("Duplicate..."), FILE_DUPLICATE);
}
- file_options->add_item(TTR("Move To.."), FILE_MOVE);
+ file_options->add_item(TTR("Move To..."), FILE_MOVE);
file_options->add_item(TTR("Delete"), FILE_REMOVE);
file_options->add_separator();
}
- file_options->add_item(TTR("New Folder.."), FILE_NEW_FOLDER);
+ file_options->add_item(TTR("New Folder..."), FILE_NEW_FOLDER);
+ file_options->add_item(TTR("New Script..."), FILE_NEW_SCRIPT);
file_options->add_item(TTR("Show In File Manager"), FILE_SHOW_IN_EXPLORER);
file_options->set_position(files->get_global_position() + p_pos);
@@ -1630,7 +1688,8 @@ void FileSystemDock::_rmb_pressed(const Vector2 &p_pos) {
file_options->clear();
file_options->set_size(Size2(1, 1));
- file_options->add_item(TTR("New Folder.."), FILE_NEW_FOLDER);
+ file_options->add_item(TTR("New Folder..."), FILE_NEW_FOLDER);
+ file_options->add_item(TTR("New Script..."), FILE_NEW_SCRIPT);
file_options->add_item(TTR("Show In File Manager"), FILE_SHOW_IN_EXPLORER);
file_options->set_position(files->get_global_position() + p_pos);
file_options->popup();
@@ -1660,6 +1719,8 @@ void FileSystemDock::_files_gui_input(Ref<InputEvent> p_event) {
_file_option(FILE_COPY_PATH);
} else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
_file_option(FILE_REMOVE);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
+ _file_option(FILE_RENAME);
}
}
}
@@ -1770,6 +1831,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_C);
ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE);
+ ED_SHORTCUT("filesystem_dock/rename", TTR("Rename"));
HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
add_child(toolbar_hbc);
@@ -1804,7 +1866,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_favorite->set_flat(true);
button_favorite->set_toggle_mode(true);
button_favorite->connect("pressed", this, "_favorites_pressed");
- button_favorite->set_tooltip(TTR("Toggle folder status as Favorite"));
+ button_favorite->set_tooltip(TTR("Toggle folder status as Favorite."));
button_favorite->set_focus_mode(FOCUS_NONE);
toolbar_hbc->add_child(button_favorite);
@@ -1860,11 +1922,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
file_list_vb->add_child(path_hb);
button_tree = memnew(ToolButton);
+ button_tree->set_tooltip(TTR("Enter tree-view."));
button_tree->hide();
path_hb->add_child(button_tree);
search_box = memnew(LineEdit);
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
+ search_box->set_placeholder(TTR("Search files"));
search_box->connect("text_changed", this, "_search_changed");
path_hb->add_child(search_box);
@@ -1889,7 +1953,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
add_child(scanning_vb);
Label *slabel = memnew(Label);
- slabel->set_text(TTR("Scanning Files,\nPlease Wait.."));
+ slabel->set_text(TTR("Scanning Files,\nPlease Wait..."));
slabel->set_align(Label::ALIGN_CENTER);
scanning_vb->add_child(slabel);
@@ -1943,6 +2007,10 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
make_dir_dialog->register_text_enter(make_dir_dialog_text);
make_dir_dialog->connect("confirmed", this, "_make_dir_confirm");
+ make_script_dialog_text = memnew(ScriptCreateDialog);
+ make_script_dialog_text->set_title(TTR("Create Script"));
+ add_child(make_script_dialog_text);
+
updating_tree = false;
initialized = false;
import_dock_needs_update = false;
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 377316d1ba..e59d4c96e1 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -50,6 +50,7 @@
#include "dependency_editor.h"
#include "editor_dir_dialog.h"
#include "editor_file_system.h"
+#include "script_create_dialog.h"
class EditorNode;
@@ -75,6 +76,7 @@ private:
FILE_REIMPORT,
FILE_INFO,
FILE_NEW_FOLDER,
+ FILE_NEW_SCRIPT,
FILE_SHOW_IN_EXPLORER,
FILE_COPY_PATH
};
@@ -126,6 +128,7 @@ private:
LineEdit *duplicate_dialog_text;
ConfirmationDialog *make_dir_dialog;
LineEdit *make_dir_dialog_text;
+ ScriptCreateDialog *make_script_dialog_text;
class FileOrFolder {
public:
@@ -176,12 +179,13 @@ private:
void _file_selected();
void _dir_selected();
- void _get_all_files_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files) const;
+ void _get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const;
void _find_remaps(EditorFileSystemDirectory *efsd, const Map<String, String> &renames, Vector<String> &to_remaps) const;
- void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_renames) const;
+ void _try_move_item(const FileOrFolder &p_item, const String &p_new_path, Map<String, String> &p_file_renames, Map<String, String> &p_folder_renames) const;
void _try_duplicate_item(const FileOrFolder &p_item, const String &p_new_path) const;
void _update_dependencies_after_move(const Map<String, String> &p_renames) const;
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
+ void _update_favorite_dirs_list_after_move(const Map<String, String> &p_renames) const;
void _make_dir_confirm();
void _rename_operation_confirm();
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
new file mode 100644
index 0000000000..004a49e2b4
--- /dev/null
+++ b/editor/find_in_files.cpp
@@ -0,0 +1,827 @@
+/*************************************************************************/
+/* find_in_files.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "find_in_files.h"
+#include "core/os/dir_access.h"
+#include "core/os/os.h"
+#include "editor_scale.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
+#include "scene/gui/check_box.h"
+#include "scene/gui/file_dialog.h"
+#include "scene/gui/grid_container.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/label.h"
+#include "scene/gui/line_edit.h"
+#include "scene/gui/progress_bar.h"
+
+#define ROOT_PREFIX "res://"
+
+const char *FindInFiles::SIGNAL_RESULT_FOUND = "result_found";
+const char *FindInFiles::SIGNAL_FINISHED = "finished";
+
+// TODO Would be nice in Vector and PoolVectors
+template <typename T>
+inline void pop_back(T &container) {
+ container.resize(container.size() - 1);
+}
+
+// TODO Copied from TextEdit private, would be nice to extract it in a single place
+static bool is_text_char(CharType c) {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
+}
+
+FindInFiles::FindInFiles() {
+ _root_prefix = ROOT_PREFIX;
+ _extension_filter.insert("gd");
+ _extension_filter.insert("cs");
+ _searching = false;
+ _whole_words = true;
+ _match_case = true;
+}
+
+void FindInFiles::set_search_text(String p_pattern) {
+ _pattern = p_pattern;
+}
+
+void FindInFiles::set_whole_words(bool p_whole_word) {
+ _whole_words = p_whole_word;
+}
+
+void FindInFiles::set_match_case(bool p_match_case) {
+ _match_case = p_match_case;
+}
+
+void FindInFiles::set_folder(String folder) {
+ _root_dir = folder;
+}
+
+void FindInFiles::set_filter(const Set<String> &exts) {
+ _extension_filter = exts;
+}
+
+void FindInFiles::_notification(int p_notification) {
+ if (p_notification == NOTIFICATION_PROCESS) {
+ _process();
+ }
+}
+
+void FindInFiles::start() {
+ if (_pattern == "") {
+ print_line("Nothing to search, pattern is empty");
+ emit_signal(SIGNAL_FINISHED);
+ return;
+ }
+ if (_extension_filter.size() == 0) {
+ print_line("Nothing to search, filter matches no files");
+ emit_signal(SIGNAL_FINISHED);
+ return;
+ }
+
+ // Init search
+ _current_dir = "";
+ PoolStringArray init_folder;
+ init_folder.append(_root_dir);
+ _folders_stack.clear();
+ _folders_stack.push_back(init_folder);
+
+ _initial_files_count = 0;
+
+ _searching = true;
+ set_process(true);
+}
+
+void FindInFiles::stop() {
+ _searching = false;
+ _current_dir = "";
+ set_process(false);
+}
+
+void FindInFiles::_process() {
+ // This part can be moved to a thread if needed
+
+ OS &os = *OS::get_singleton();
+ float time_before = os.get_ticks_msec();
+ while (is_processing()) {
+ _iterate();
+ float elapsed = (os.get_ticks_msec() - time_before);
+ if (elapsed > 1000.0 / 120.0)
+ break;
+ }
+}
+
+void FindInFiles::_iterate() {
+
+ if (_folders_stack.size() != 0) {
+
+ // Scan folders first so we can build a list of files and have progress info later
+
+ PoolStringArray &folders_to_scan = _folders_stack[_folders_stack.size() - 1];
+
+ if (folders_to_scan.size() != 0) {
+ // Scan one folder below
+
+ String folder_name = folders_to_scan[folders_to_scan.size() - 1];
+ pop_back(folders_to_scan);
+
+ _current_dir = _current_dir.plus_file(folder_name);
+
+ PoolStringArray sub_dirs;
+ _scan_dir(_root_prefix + _current_dir, sub_dirs);
+
+ _folders_stack.push_back(sub_dirs);
+
+ } else {
+ // Go back one level
+
+ pop_back(_folders_stack);
+ _current_dir = _current_dir.get_base_dir();
+
+ if (_folders_stack.size() == 0) {
+ // All folders scanned
+ _initial_files_count = _files_to_scan.size();
+ }
+ }
+
+ } else if (_files_to_scan.size() != 0) {
+
+ // Then scan files
+
+ String fpath = _files_to_scan[_files_to_scan.size() - 1];
+ pop_back(_files_to_scan);
+ _scan_file(fpath);
+
+ } else {
+ print_line("Search complete");
+ set_process(false);
+ _current_dir = "";
+ _searching = false;
+ emit_signal(SIGNAL_FINISHED);
+ }
+}
+
+float FindInFiles::get_progress() const {
+ if (_initial_files_count != 0) {
+ return static_cast<float>(_initial_files_count - _files_to_scan.size()) / static_cast<float>(_initial_files_count);
+ }
+ return 0;
+}
+
+void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
+
+ DirAccess *dir = DirAccess::open(path);
+ if (dir == NULL) {
+ print_line("Cannot open directory! " + path);
+ return;
+ }
+
+ dir->list_dir_begin();
+
+ for (int i = 0; i < 1000; ++i) {
+ String file = dir->get_next();
+
+ if (file == "")
+ break;
+
+ // Ignore special dirs and hidden dirs (such as .git and .import)
+ if (file == "." || file == ".." || file.begins_with("."))
+ continue;
+
+ if (dir->current_is_dir())
+ out_folders.append(file);
+
+ else {
+ String file_ext = file.get_extension();
+ if (_extension_filter.has(file_ext)) {
+ _files_to_scan.push_back(path.plus_file(file));
+ }
+ }
+ }
+}
+
+void FindInFiles::_scan_file(String fpath) {
+
+ FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
+ if (f == NULL) {
+ print_line(String("Cannot open file ") + fpath);
+ return;
+ }
+
+ int line_number = 0;
+
+ while (!f->eof_reached()) {
+
+ // line number starts at 1
+ ++line_number;
+
+ int begin = 0;
+ int end = 0;
+
+ String line = f->get_line();
+
+ // Find all occurrences in the current line
+ while (true) {
+ begin = _match_case ? line.find(_pattern, end) : line.findn(_pattern, end);
+
+ if (begin == -1)
+ break;
+
+ end = begin + _pattern.length();
+
+ if (_whole_words) {
+ if (begin > 0 && is_text_char(line[begin - 1])) {
+ continue;
+ }
+ if (end < line.size() && is_text_char(line[end])) {
+ continue;
+ }
+ }
+
+ emit_signal(SIGNAL_RESULT_FOUND, fpath, line_number, begin, end, line);
+ }
+ }
+
+ f->close();
+}
+
+void FindInFiles::_bind_methods() {
+
+ ADD_SIGNAL(MethodInfo(SIGNAL_RESULT_FOUND,
+ PropertyInfo(Variant::STRING, "path"),
+ PropertyInfo(Variant::INT, "line_number"),
+ PropertyInfo(Variant::INT, "begin"),
+ PropertyInfo(Variant::INT, "end"),
+ PropertyInfo(Variant::STRING, "text")));
+
+ ADD_SIGNAL(MethodInfo(SIGNAL_FINISHED));
+}
+
+//-----------------------------------------------------------------------------
+const char *FindInFilesDialog::SIGNAL_FIND_REQUESTED = "find_requested";
+const char *FindInFilesDialog::SIGNAL_REPLACE_REQUESTED = "replace_requested";
+
+FindInFilesDialog::FindInFilesDialog() {
+
+ set_custom_minimum_size(Size2(400, 190));
+ set_resizable(true);
+ set_title(TTR("Find in files"));
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
+ add_child(vbc);
+
+ GridContainer *gc = memnew(GridContainer);
+ gc->set_columns(2);
+ vbc->add_child(gc);
+
+ Label *find_label = memnew(Label);
+ find_label->set_text(TTR("Find: "));
+ gc->add_child(find_label);
+
+ _search_text_line_edit = memnew(LineEdit);
+ _search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ _search_text_line_edit->connect("text_changed", this, "_on_search_text_modified");
+ _search_text_line_edit->connect("text_entered", this, "_on_search_text_entered");
+ gc->add_child(_search_text_line_edit);
+
+ {
+ Control *placeholder = memnew(Control);
+ gc->add_child(placeholder);
+ }
+
+ {
+ HBoxContainer *hbc = memnew(HBoxContainer);
+
+ _whole_words_checkbox = memnew(CheckBox);
+ _whole_words_checkbox->set_text(TTR("Whole words"));
+ _whole_words_checkbox->set_pressed(true);
+ hbc->add_child(_whole_words_checkbox);
+
+ _match_case_checkbox = memnew(CheckBox);
+ _match_case_checkbox->set_text(TTR("Match case"));
+ _match_case_checkbox->set_pressed(true);
+ hbc->add_child(_match_case_checkbox);
+
+ gc->add_child(hbc);
+ }
+
+ Label *folder_label = memnew(Label);
+ folder_label->set_text(TTR("Folder: "));
+ gc->add_child(folder_label);
+
+ {
+ HBoxContainer *hbc = memnew(HBoxContainer);
+
+ Label *prefix_label = memnew(Label);
+ prefix_label->set_text(ROOT_PREFIX);
+ hbc->add_child(prefix_label);
+
+ _folder_line_edit = memnew(LineEdit);
+ _folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ hbc->add_child(_folder_line_edit);
+
+ Button *folder_button = memnew(Button);
+ folder_button->set_text("...");
+ folder_button->connect("pressed", this, "_on_folder_button_pressed");
+ hbc->add_child(folder_button);
+
+ _folder_dialog = memnew(FileDialog);
+ _folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
+ _folder_dialog->connect("dir_selected", this, "_on_folder_selected");
+ add_child(_folder_dialog);
+
+ gc->add_child(hbc);
+ }
+
+ Label *filter_label = memnew(Label);
+ filter_label->set_text(TTR("Filter: "));
+ gc->add_child(filter_label);
+
+ {
+ HBoxContainer *hbc = memnew(HBoxContainer);
+
+ Vector<String> exts;
+ exts.push_back("gd");
+ exts.push_back("cs");
+
+ for (int i = 0; i < exts.size(); ++i) {
+ CheckBox *cb = memnew(CheckBox);
+ cb->set_text(exts[i]);
+ cb->set_pressed(true);
+ hbc->add_child(cb);
+ _filters.push_back(cb);
+ }
+
+ gc->add_child(hbc);
+ }
+
+ {
+ Control *placeholder = memnew(Control);
+ placeholder->set_custom_minimum_size(Size2(0, EDSCALE * 16));
+ vbc->add_child(placeholder);
+ }
+
+ {
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ hbc->set_alignment(HBoxContainer::ALIGN_CENTER);
+
+ _find_button = memnew(Button);
+ _find_button->set_text(TTR("Find..."));
+ _find_button->connect("pressed", this, "_on_find_button_pressed");
+ _find_button->set_disabled(true);
+ hbc->add_child(_find_button);
+
+ {
+ Control *placeholder = memnew(Control);
+ placeholder->set_custom_minimum_size(Size2(EDSCALE * 16, 0));
+ hbc->add_child(placeholder);
+ }
+
+ _replace_button = memnew(Button);
+ _replace_button->set_text(TTR("Replace..."));
+ _replace_button->connect("pressed", this, "_on_replace_button_pressed");
+ _replace_button->set_disabled(true);
+ hbc->add_child(_replace_button);
+
+ {
+ Control *placeholder = memnew(Control);
+ placeholder->set_custom_minimum_size(Size2(EDSCALE * 16, 0));
+ hbc->add_child(placeholder);
+ }
+
+ Button *cancel_button = memnew(Button);
+ cancel_button->set_text(TTR("Cancel"));
+ cancel_button->connect("pressed", this, "hide");
+ hbc->add_child(cancel_button);
+
+ vbc->add_child(hbc);
+ }
+}
+
+void FindInFilesDialog::set_search_text(String text) {
+ _search_text_line_edit->set_text(text);
+ _on_search_text_modified(text);
+}
+
+String FindInFilesDialog::get_search_text() const {
+ String text = _search_text_line_edit->get_text();
+ return text.strip_edges();
+}
+
+bool FindInFilesDialog::is_match_case() const {
+ return _match_case_checkbox->is_pressed();
+}
+
+bool FindInFilesDialog::is_whole_words() const {
+ return _whole_words_checkbox->is_pressed();
+}
+
+String FindInFilesDialog::get_folder() const {
+ String text = _folder_line_edit->get_text();
+ return text.strip_edges();
+}
+
+Set<String> FindInFilesDialog::get_filter() const {
+ Set<String> filters;
+ for (int i = 0; i < _filters.size(); ++i) {
+ CheckBox *cb = _filters[i];
+ if (cb->is_pressed()) {
+ filters.insert(_filters[i]->get_text());
+ }
+ }
+ return filters;
+}
+
+void FindInFilesDialog::_notification(int p_what) {
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ if (is_visible()) {
+ // Doesn't work more than once if not deferred...
+ _search_text_line_edit->call_deferred("grab_focus");
+ _search_text_line_edit->select_all();
+ }
+ }
+}
+
+void FindInFilesDialog::_on_folder_button_pressed() {
+ _folder_dialog->popup_centered_ratio();
+}
+
+void FindInFilesDialog::_on_find_button_pressed() {
+ emit_signal(SIGNAL_FIND_REQUESTED);
+ hide();
+}
+
+void FindInFilesDialog::_on_replace_button_pressed() {
+ emit_signal(SIGNAL_REPLACE_REQUESTED);
+ hide();
+}
+
+void FindInFilesDialog::_on_search_text_modified(String text) {
+
+ ERR_FAIL_COND(!_find_button);
+ ERR_FAIL_COND(!_replace_button);
+
+ _find_button->set_disabled(get_search_text().empty());
+ _replace_button->set_disabled(get_search_text().empty());
+}
+
+void FindInFilesDialog::_on_search_text_entered(String text) {
+ // This allows to trigger a global search without leaving the keyboard
+ if (!_find_button->is_disabled())
+ _on_find_button_pressed();
+}
+
+void FindInFilesDialog::_on_folder_selected(String path) {
+ int i = path.find("://");
+ if (i != -1)
+ path = path.right(i + 3);
+ _folder_line_edit->set_text(path);
+}
+
+void FindInFilesDialog::_bind_methods() {
+
+ ClassDB::bind_method("_on_folder_button_pressed", &FindInFilesDialog::_on_folder_button_pressed);
+ ClassDB::bind_method("_on_find_button_pressed", &FindInFilesDialog::_on_find_button_pressed);
+ ClassDB::bind_method("_on_replace_button_pressed", &FindInFilesDialog::_on_replace_button_pressed);
+ ClassDB::bind_method("_on_folder_selected", &FindInFilesDialog::_on_folder_selected);
+ ClassDB::bind_method("_on_search_text_modified", &FindInFilesDialog::_on_search_text_modified);
+ ClassDB::bind_method("_on_search_text_entered", &FindInFilesDialog::_on_search_text_entered);
+
+ ADD_SIGNAL(MethodInfo(SIGNAL_FIND_REQUESTED));
+ ADD_SIGNAL(MethodInfo(SIGNAL_REPLACE_REQUESTED));
+}
+
+//-----------------------------------------------------------------------------
+const char *FindInFilesPanel::SIGNAL_RESULT_SELECTED = "result_selected";
+const char *FindInFilesPanel::SIGNAL_FILES_MODIFIED = "files_modified";
+
+FindInFilesPanel::FindInFilesPanel() {
+
+ _finder = memnew(FindInFiles);
+ _finder->connect(FindInFiles::SIGNAL_RESULT_FOUND, this, "_on_result_found");
+ _finder->connect(FindInFiles::SIGNAL_FINISHED, this, "_on_finished");
+ add_child(_finder);
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
+ vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
+ vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
+ vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
+ add_child(vbc);
+
+ {
+ HBoxContainer *hbc = memnew(HBoxContainer);
+
+ Label *find_label = memnew(Label);
+ find_label->set_text(TTR("Find: "));
+ hbc->add_child(find_label);
+
+ _search_text_label = memnew(Label);
+ _search_text_label->add_font_override("font", get_font("source", "EditorFonts"));
+ hbc->add_child(_search_text_label);
+
+ _progress_bar = memnew(ProgressBar);
+ _progress_bar->set_h_size_flags(SIZE_EXPAND_FILL);
+ hbc->add_child(_progress_bar);
+ set_progress_visible(false);
+
+ _status_label = memnew(Label);
+ hbc->add_child(_status_label);
+
+ _cancel_button = memnew(Button);
+ _cancel_button->set_text(TTR("Cancel"));
+ _cancel_button->connect("pressed", this, "_on_cancel_button_clicked");
+ _cancel_button->set_disabled(true);
+ hbc->add_child(_cancel_button);
+
+ vbc->add_child(hbc);
+ }
+
+ // In the future, this should be replaced by a more specific list container,
+ // which can highlight text regions and change opacity for enabled/disabled states
+ _results_display = memnew(ItemList);
+ _results_display->add_font_override("font", get_font("source", "EditorFonts"));
+ _results_display->set_v_size_flags(SIZE_EXPAND_FILL);
+ _results_display->connect("item_selected", this, "_on_result_selected");
+ vbc->add_child(_results_display);
+
+ {
+ _replace_container = memnew(HBoxContainer);
+
+ Label *replace_label = memnew(Label);
+ replace_label->set_text(TTR("Replace: "));
+ _replace_container->add_child(replace_label);
+
+ _replace_line_edit = memnew(LineEdit);
+ _replace_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
+ _replace_line_edit->connect("text_changed", this, "_on_replace_text_changed");
+ _replace_container->add_child(_replace_line_edit);
+
+ _replace_all_button = memnew(Button);
+ _replace_all_button->set_text(TTR("Replace all (no undo)"));
+ _replace_all_button->connect("pressed", this, "_on_replace_all_clicked");
+ _replace_container->add_child(_replace_all_button);
+
+ _replace_container->hide();
+
+ vbc->add_child(_replace_container);
+ }
+}
+
+void FindInFilesPanel::set_with_replace(bool with_replace) {
+
+ _replace_container->set_visible(with_replace);
+}
+
+void FindInFilesPanel::start_search() {
+
+ _results_display->clear();
+ _status_label->set_text(TTR("Searching..."));
+ _search_text_label->set_text(_finder->get_search_text());
+
+ set_process(true);
+ set_progress_visible(true);
+
+ _finder->start();
+
+ update_replace_buttons();
+ _cancel_button->set_disabled(false);
+}
+
+void FindInFilesPanel::stop_search() {
+
+ _finder->stop();
+
+ _status_label->set_text("");
+ update_replace_buttons();
+ set_progress_visible(false);
+ _cancel_button->set_disabled(true);
+}
+
+void FindInFilesPanel::_notification(int p_what) {
+ if (p_what == NOTIFICATION_PROCESS) {
+ _progress_bar->set_as_ratio(_finder->get_progress());
+ }
+}
+
+void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin, int end, String text) {
+
+ int i = _results_display->get_item_count();
+ _results_display->add_item(fpath + ": " + String::num(line_number) + ": " + text.replace("\t", " "));
+ _results_display->set_item_metadata(i, varray(fpath, line_number, begin, end));
+}
+
+void FindInFilesPanel::_on_finished() {
+
+ _status_label->set_text(TTR("Search complete"));
+ update_replace_buttons();
+ set_progress_visible(false);
+ _cancel_button->set_disabled(true);
+}
+
+void FindInFilesPanel::_on_cancel_button_clicked() {
+ stop_search();
+}
+
+void FindInFilesPanel::_on_result_selected(int i) {
+
+ Array meta = _results_display->get_item_metadata(i);
+ emit_signal(SIGNAL_RESULT_SELECTED, meta[0], meta[1], meta[2], meta[3]);
+}
+
+void FindInFilesPanel::_on_replace_text_changed(String text) {
+ update_replace_buttons();
+}
+
+void FindInFilesPanel::_on_replace_all_clicked() {
+
+ String replace_text = get_replace_text();
+ ERR_FAIL_COND(replace_text.empty());
+
+ String last_fpath;
+ PoolIntArray locations;
+ PoolStringArray modified_files;
+
+ for (int i = 0; i < _results_display->get_item_count(); ++i) {
+
+ Array meta = _results_display->get_item_metadata(i);
+
+ String fpath = meta[0];
+
+ // Results are sorted by file, so we can batch replaces
+ if (fpath != last_fpath) {
+ if (locations.size() != 0) {
+ apply_replaces_in_file(last_fpath, locations, replace_text);
+ modified_files.append(last_fpath);
+ locations.resize(0);
+ }
+ }
+
+ locations.append(meta[1]); // line_number
+ locations.append(meta[2]); // begin
+ locations.append(meta[3]); // end
+
+ last_fpath = fpath;
+ }
+
+ if (locations.size() != 0) {
+ apply_replaces_in_file(last_fpath, locations, replace_text);
+ modified_files.append(last_fpath);
+ }
+
+ // Hide replace bar so we can't trigger the action twice without doing a new search
+ set_with_replace(false);
+
+ emit_signal(SIGNAL_FILES_MODIFIED, modified_files);
+}
+
+// Same as get_line, but preserves line ending characters
+class ConservativeGetLine {
+public:
+ String get_line(FileAccess *f) {
+
+ _line_buffer.clear();
+
+ CharType c = f->get_8();
+
+ while (!f->eof_reached()) {
+
+ if (c == '\n') {
+ _line_buffer.push_back(c);
+ _line_buffer.push_back(0);
+ return String::utf8(_line_buffer.ptr());
+
+ } else if (c == '\0') {
+ _line_buffer.push_back(c);
+ return String::utf8(_line_buffer.ptr());
+
+ } else if (c != '\r') {
+ _line_buffer.push_back(c);
+ }
+
+ c = f->get_8();
+ }
+
+ _line_buffer.push_back(0);
+ return String::utf8(_line_buffer.ptr());
+ }
+
+private:
+ Vector<char> _line_buffer;
+};
+
+void FindInFilesPanel::apply_replaces_in_file(String fpath, PoolIntArray locations, String text) {
+
+ ERR_FAIL_COND(locations.size() % 3 != 0);
+
+ //print_line(String("Replacing {0} occurrences in {1}").format(varray(fpath, locations.size() / 3)));
+
+ // If the file is already open, I assume the editor will reload it.
+ // If there are unsaved changes, the user will be asked on focus,
+ // however that means either loosing changes or loosing replaces.
+
+ FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
+ ERR_FAIL_COND(f == NULL);
+
+ String buffer;
+ int current_line = 1;
+
+ ConservativeGetLine conservative;
+
+ String line = conservative.get_line(f);
+
+ PoolIntArray::Read locations_read = locations.read();
+ for (int i = 0; i < locations.size(); i += 3) {
+
+ int repl_line_number = locations_read[i];
+ int repl_begin = locations_read[i + 1];
+ int repl_end = locations_read[i + 2];
+
+ while (current_line < repl_line_number) {
+ buffer += line;
+ line = conservative.get_line(f);
+ ++current_line;
+ }
+
+ line = line.left(repl_begin) + text + line.right(repl_end);
+ }
+
+ buffer += line;
+
+ while (!f->eof_reached()) {
+ buffer += conservative.get_line(f);
+ }
+
+ // Now the modified contents are in the buffer, rewrite the file with our changes
+
+ Error err = f->reopen(fpath, FileAccess::WRITE);
+ ERR_FAIL_COND(err != OK);
+
+ f->store_string(buffer);
+
+ f->close();
+}
+
+String FindInFilesPanel::get_replace_text() {
+ return _replace_line_edit->get_text().strip_edges();
+}
+
+void FindInFilesPanel::update_replace_buttons() {
+
+ String text = get_replace_text();
+ bool disabled = text.empty() || _finder->is_searching();
+
+ _replace_all_button->set_disabled(disabled);
+}
+
+void FindInFilesPanel::set_progress_visible(bool visible) {
+ _progress_bar->set_self_modulate(Color(1, 1, 1, visible ? 1 : 0));
+}
+
+void FindInFilesPanel::_bind_methods() {
+
+ ClassDB::bind_method("_on_result_found", &FindInFilesPanel::_on_result_found);
+ ClassDB::bind_method("_on_finished", &FindInFilesPanel::_on_finished);
+ ClassDB::bind_method("_on_cancel_button_clicked", &FindInFilesPanel::_on_cancel_button_clicked);
+ ClassDB::bind_method("_on_result_selected", &FindInFilesPanel::_on_result_selected);
+ ClassDB::bind_method("_on_replace_text_changed", &FindInFilesPanel::_on_replace_text_changed);
+ ClassDB::bind_method("_on_replace_all_clicked", &FindInFilesPanel::_on_replace_all_clicked);
+
+ ADD_SIGNAL(MethodInfo(SIGNAL_RESULT_SELECTED,
+ PropertyInfo(Variant::STRING, "path"),
+ PropertyInfo(Variant::INT, "line_number"),
+ PropertyInfo(Variant::INT, "begin"),
+ PropertyInfo(Variant::INT, "end")));
+
+ ADD_SIGNAL(MethodInfo(SIGNAL_FILES_MODIFIED, PropertyInfo(Variant::STRING, "paths")));
+}
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
new file mode 100644
index 0000000000..d57184960b
--- /dev/null
+++ b/editor/find_in_files.h
@@ -0,0 +1,184 @@
+/*************************************************************************/
+/* find_in_files.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef FIND_IN_FILES_H
+#define FIND_IN_FILES_H
+
+#include "scene/gui/dialogs.h"
+
+// Performs the actual search
+class FindInFiles : public Node {
+ GDCLASS(FindInFiles, Node)
+public:
+ static const char *SIGNAL_RESULT_FOUND;
+ static const char *SIGNAL_FINISHED;
+
+ FindInFiles();
+
+ void set_search_text(String p_pattern);
+ void set_whole_words(bool p_whole_word);
+ void set_match_case(bool p_match_case);
+ void set_folder(String folder);
+ void set_filter(const Set<String> &exts);
+
+ String get_search_text() const { return _pattern; }
+
+ bool is_whole_words() const { return _whole_words; }
+ bool is_match_case() const { return _match_case; }
+
+ void start();
+ void stop();
+
+ bool is_searching() const { return _searching; }
+ float get_progress() const;
+
+protected:
+ void _notification(int p_notification);
+
+ static void _bind_methods();
+
+private:
+ void _process();
+ void _iterate();
+ void _scan_dir(String path, PoolStringArray &out_folders);
+ void _scan_file(String fpath);
+
+ // Config
+ String _pattern;
+ Set<String> _extension_filter;
+ String _root_prefix;
+ String _root_dir;
+ bool _whole_words;
+ bool _match_case;
+
+ // State
+ bool _searching;
+ String _current_dir;
+ Vector<PoolStringArray> _folders_stack;
+ Vector<String> _files_to_scan;
+ int _initial_files_count;
+};
+
+class LineEdit;
+class CheckBox;
+class FileDialog;
+
+// Prompts search parameters
+class FindInFilesDialog : public WindowDialog {
+ GDCLASS(FindInFilesDialog, WindowDialog)
+public:
+ static const char *SIGNAL_FIND_REQUESTED;
+ static const char *SIGNAL_REPLACE_REQUESTED;
+
+ FindInFilesDialog();
+
+ void set_search_text(String text);
+
+ String get_search_text() const;
+ bool is_match_case() const;
+ bool is_whole_words() const;
+ String get_folder() const;
+ Set<String> get_filter() const;
+
+protected:
+ static void _bind_methods();
+
+ void _notification(int p_what);
+
+private:
+ void _on_folder_button_pressed();
+ void _on_find_button_pressed();
+ void _on_replace_button_pressed();
+ void _on_folder_selected(String path);
+ void _on_search_text_modified(String text);
+ void _on_search_text_entered(String text);
+
+ LineEdit *_search_text_line_edit;
+ LineEdit *_folder_line_edit;
+ Vector<CheckBox *> _filters;
+ CheckBox *_match_case_checkbox;
+ CheckBox *_whole_words_checkbox;
+ Button *_find_button;
+ Button *_replace_button;
+ FileDialog *_folder_dialog;
+};
+
+class Button;
+class ItemList;
+class ProgressBar;
+
+// Display search results
+class FindInFilesPanel : public Control {
+ GDCLASS(FindInFilesPanel, Control)
+public:
+ static const char *SIGNAL_RESULT_SELECTED;
+ static const char *SIGNAL_FILES_MODIFIED;
+
+ FindInFilesPanel();
+
+ FindInFiles *get_finder() const { return _finder; }
+
+ void set_with_replace(bool with_replace);
+
+ void start_search();
+ void stop_search();
+
+protected:
+ static void _bind_methods();
+
+ void _notification(int p_what);
+
+private:
+ void _on_result_found(String fpath, int line_number, int begin, int end, String text);
+ void _on_finished();
+ void _on_cancel_button_clicked();
+ void _on_result_selected(int i);
+ void _on_replace_text_changed(String text);
+ void _on_replace_all_clicked();
+
+ void apply_replaces_in_file(String fpath, PoolIntArray locations, String text);
+
+ void update_replace_buttons();
+ String get_replace_text();
+ void set_progress_visible(bool visible);
+
+ FindInFiles *_finder;
+ Label *_search_text_label;
+ ItemList *_results_display;
+ Label *_status_label;
+ Button *_cancel_button;
+ ProgressBar *_progress_bar;
+
+ HBoxContainer *_replace_container;
+ LineEdit *_replace_line_edit;
+ Button *_replace_all_button;
+};
+
+#endif // FIND_IN_FILES_H
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index bac18be4a9..e42f9780a6 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -29,12 +29,429 @@
/*************************************************************************/
#include "groups_editor.h"
-
+#include "editor/scene_tree_editor.h"
#include "editor_node.h"
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "scene/resources/packed_scene.h"
+void GroupDialog::ok_pressed() {
+}
+
+void GroupDialog::_cancel_pressed() {
+}
+
+void GroupDialog::_group_selected() {
+ nodes_to_add->clear();
+ add_node_root = nodes_to_add->create_item();
+
+ nodes_to_remove->clear();
+ remove_node_root = nodes_to_remove->create_item();
+
+ if (!groups->is_anything_selected()) {
+ return;
+ }
+
+ selected_group = groups->get_selected()->get_text(0);
+ _load_nodes(scene_tree->get_edited_scene_root());
+}
+
+void GroupDialog::_load_nodes(Node *p_current) {
+ String item_name = p_current->get_name();
+ if (p_current != scene_tree->get_edited_scene_root()) {
+ item_name = String(p_current->get_parent()->get_name()) + "/" + String(item_name);
+ }
+
+ bool keep = true;
+ Node *root = scene_tree->get_edited_scene_root();
+ Node *owner = p_current->get_owner();
+ if (owner != root && p_current != root && !owner && !root->is_editable_instance(owner)) {
+ keep = false;
+ }
+
+ TreeItem *node;
+ NodePath path = scene_tree->get_edited_scene_root()->get_path_to(p_current);
+ if (keep && p_current->is_in_group(selected_group)) {
+ if (remove_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) {
+ node = nodes_to_remove->create_item(remove_node_root);
+ keep = true;
+ } else {
+ keep = false;
+ }
+ } else if (keep && add_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) {
+ node = nodes_to_add->create_item(add_node_root);
+ keep = true;
+ } else {
+ keep = false;
+ }
+
+ if (keep) {
+ node->set_text(0, item_name);
+ node->set_metadata(0, path);
+ node->set_tooltip(0, path);
+
+ Ref<Texture> icon;
+ if (p_current->has_meta("_editor_icon")) {
+ icon = p_current->get_meta("_editor_icon");
+ } else {
+ icon = get_icon((has_icon(p_current->get_class(), "EditorIcons") ? p_current->get_class() : String("Object")), "EditorIcons");
+ }
+ node->set_icon(0, icon);
+
+ if (!_can_edit(p_current, selected_group)) {
+ node->set_selectable(0, false);
+ node->set_custom_color(0, get_color("disabled_font_color", "Editor"));
+ }
+ }
+
+ for (int i = 0; i < p_current->get_child_count(); i++) {
+ _load_nodes(p_current->get_child(i));
+ }
+}
+
+bool GroupDialog::_can_edit(Node *p_node, String p_group) {
+ Node *n = p_node;
+ bool can_edit = true;
+ while (n) {
+ Ref<SceneState> ss = (n == EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state();
+ if (ss.is_valid()) {
+ int path = ss->find_node_by_path(n->get_path_to(p_node));
+ if (path != -1) {
+ if (ss->is_node_in_group(path, p_group)) {
+ can_edit = false;
+ }
+ }
+ }
+ n = n->get_owner();
+ }
+ return can_edit;
+}
+
+void GroupDialog::_add_pressed() {
+ TreeItem *selected = nodes_to_add->get_selected();
+
+ if (!selected) {
+ return;
+ }
+
+ while (selected) {
+ Node *node = scene_tree->get_edited_scene_root()->get_node(selected->get_metadata(0));
+ node->add_to_group(selected_group, true);
+
+ selected = nodes_to_add->get_next_selected(selected);
+ }
+
+ _group_selected();
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
+void GroupDialog::_removed_pressed() {
+ TreeItem *selected = nodes_to_remove->get_selected();
+
+ if (!selected) {
+ return;
+ }
+
+ while (selected) {
+ Node *node = scene_tree->get_edited_scene_root()->get_node(selected->get_metadata(0));
+ node->remove_from_group(selected_group);
+
+ selected = nodes_to_add->get_next_selected(selected);
+ }
+
+ _group_selected();
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
+void GroupDialog::_remove_filter_changed(const String &p_filter) {
+ _group_selected();
+}
+
+void GroupDialog::_add_filter_changed(const String &p_filter) {
+ _group_selected();
+}
+
+void GroupDialog::_add_group_pressed() {
+ _add_group(add_group_text->get_text());
+ add_group_text->clear();
+}
+
+void GroupDialog::_group_renamed() {
+ TreeItem *renamed_group = groups->get_edited();
+ if (!renamed_group) {
+ return;
+ }
+
+ String name = renamed_group->get_text(0).strip_edges();
+ for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) {
+ if (E != renamed_group && E->get_text(0) == name) {
+ renamed_group->set_text(0, selected_group);
+ error->set_text(TTR("Group name already exists."));
+ error->popup_centered();
+ return;
+ }
+ }
+
+ if (name == "") {
+ renamed_group->set_text(0, selected_group);
+ error->set_text(TTR("invalid Group name."));
+ error->popup_centered();
+ return;
+ }
+
+ List<Node *> nodes;
+ scene_tree->get_nodes_in_group(selected_group, &nodes);
+ bool removed_all = true;
+ for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
+ Node *node = E->get();
+ if (_can_edit(node, selected_group)) {
+ node->remove_from_group(selected_group);
+ node->add_to_group(name, true);
+ } else {
+ removed_all = false;
+ }
+ }
+
+ if (!removed_all) {
+ _add_group(selected_group);
+ }
+
+ selected_group = renamed_group->get_text(0);
+ _group_selected();
+}
+
+void GroupDialog::_add_group(String p_name) {
+
+ String name = p_name.strip_edges();
+ if (name == "" || groups->search_item_text(name)) {
+ return;
+ }
+
+ TreeItem *new_group = groups->create_item(groups_root);
+ new_group->set_text(0, name);
+ new_group->add_button(0, get_icon("Remove", "EditorIcons"), 0);
+ new_group->set_editable(0, true);
+}
+
+void GroupDialog::_load_groups(Node *p_current) {
+ List<Node::GroupInfo> gi;
+ p_current->get_groups(&gi);
+
+ for (List<Node::GroupInfo>::Element *E = gi.front(); E; E = E->next()) {
+ if (!E->get().persistent) {
+ continue;
+ }
+ _add_group(E->get().name);
+ }
+
+ for (int i = 0; i < p_current->get_child_count(); i++) {
+ _load_groups(p_current->get_child(i));
+ }
+}
+
+void GroupDialog::_delete_group_pressed(Object *p_item, int p_column, int p_id) {
+ TreeItem *ti = Object::cast_to<TreeItem>(p_item);
+ if (!ti)
+ return;
+
+ String name = ti->get_text(0);
+
+ List<Node *> nodes;
+ scene_tree->get_nodes_in_group(name, &nodes);
+ bool removed_all = true;
+ for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
+ if (_can_edit(E->get(), name)) {
+ E->get()->remove_from_group(name);
+ } else {
+ removed_all = false;
+ }
+ }
+
+ if (removed_all) {
+ if (selected_group == name) {
+ add_filter->clear();
+ remove_filter->clear();
+ nodes_to_remove->clear();
+ nodes_to_add->clear();
+ groups->deselect_all();
+ selected_group = "";
+ }
+ groups_root->remove_child(ti);
+ }
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
+void GroupDialog::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ add_button->set_icon(get_icon("Forward", "EditorIcons"));
+ remove_button->set_icon(get_icon("Back", "EditorIcons"));
+
+ add_filter->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
+ remove_filter->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
+ } break;
+ }
+}
+
+void GroupDialog::edit() {
+
+ popup_centered(Size2(600, 400));
+
+ groups->clear();
+ groups_root = groups->create_item();
+
+ nodes_to_add->clear();
+ nodes_to_remove->clear();
+
+ add_group_text->clear();
+ add_filter->clear();
+ remove_filter->clear();
+
+ _load_groups(scene_tree->get_edited_scene_root());
+}
+
+void GroupDialog::_bind_methods() {
+ ClassDB::bind_method("_cancel", &GroupDialog::_cancel_pressed);
+
+ ClassDB::bind_method("_add_pressed", &GroupDialog::_add_pressed);
+ ClassDB::bind_method("_removed_pressed", &GroupDialog::_removed_pressed);
+ ClassDB::bind_method("_delete_group_pressed", &GroupDialog::_delete_group_pressed);
+
+ ClassDB::bind_method("_group_selected", &GroupDialog::_group_selected);
+ ClassDB::bind_method("_add_group_pressed", &GroupDialog::_add_group_pressed);
+
+ ClassDB::bind_method("_add_filter_changed", &GroupDialog::_add_filter_changed);
+ ClassDB::bind_method("_remove_filter_changed", &GroupDialog::_remove_filter_changed);
+
+ ClassDB::bind_method("_group_renamed", &GroupDialog::_group_renamed);
+}
+
+GroupDialog::GroupDialog() {
+
+ scene_tree = SceneTree::get_singleton();
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ add_child(vbc);
+
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ vbc->add_child(hbc);
+ hbc->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ VBoxContainer *vbc_left = memnew(VBoxContainer);
+ hbc->add_child(vbc_left);
+ vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *group_title = memnew(Label);
+ group_title->set_text(TTR("Groups"));
+ vbc_left->add_child(group_title);
+
+ groups = memnew(Tree);
+ vbc_left->add_child(groups);
+ groups->set_hide_root(true);
+ groups->set_v_size_flags(SIZE_EXPAND_FILL);
+ groups->set_select_mode(Tree::SELECT_SINGLE);
+ groups->set_allow_reselect(true);
+ groups->set_allow_rmb_select(true);
+ groups->connect("item_selected", this, "_group_selected");
+ groups->connect("button_pressed", this, "_delete_group_pressed");
+ groups->connect("item_edited", this, "_group_renamed");
+
+ HBoxContainer *chbc = memnew(HBoxContainer);
+ vbc_left->add_child(chbc);
+ chbc->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ add_group_text = memnew(LineEdit);
+ chbc->add_child(add_group_text);
+ add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Button *add_group_button = memnew(Button);
+ add_group_button->set_text("Add");
+ chbc->add_child(add_group_button);
+ add_group_button->connect("pressed", this, "_add_group_pressed");
+
+ VBoxContainer *vbc_add = memnew(VBoxContainer);
+ hbc->add_child(vbc_add);
+ vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *out_of_group_title = memnew(Label);
+ out_of_group_title->set_text(TTR("Nodes not in Group"));
+ vbc_add->add_child(out_of_group_title);
+
+ nodes_to_add = memnew(Tree);
+ vbc_add->add_child(nodes_to_add);
+ nodes_to_add->set_hide_root(true);
+ nodes_to_add->set_hide_folding(true);
+ nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
+ nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
+ nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected");
+
+ HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
+ add_filter_hbc->add_constant_override("separate", 0);
+ vbc_add->add_child(add_filter_hbc);
+
+ add_filter = memnew(LineEdit);
+ add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_filter->set_placeholder(TTR("Filter nodes"));
+ add_filter_hbc->add_child(add_filter);
+ add_filter->connect("text_changed", this, "_add_filter_changed");
+
+ VBoxContainer *vbc_buttons = memnew(VBoxContainer);
+ hbc->add_child(vbc_buttons);
+ vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
+ vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);
+
+ add_button = memnew(ToolButton);
+ add_button->set_text(TTR("Add"));
+ add_button->connect("pressed", this, "_add_pressed");
+
+ vbc_buttons->add_child(add_button);
+ vbc_buttons->add_spacer();
+ vbc_buttons->add_spacer();
+ vbc_buttons->add_spacer();
+
+ remove_button = memnew(ToolButton);
+ remove_button->set_text(TTR("Remove"));
+ remove_button->connect("pressed", this, "_removed_pressed");
+
+ vbc_buttons->add_child(remove_button);
+
+ VBoxContainer *vbc_remove = memnew(VBoxContainer);
+ hbc->add_child(vbc_remove);
+ vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *in_group_title = memnew(Label);
+ in_group_title->set_text(TTR("Nodes in Group"));
+ vbc_remove->add_child(in_group_title);
+
+ nodes_to_remove = memnew(Tree);
+ vbc_remove->add_child(nodes_to_remove);
+ nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
+ nodes_to_remove->set_hide_root(true);
+ nodes_to_remove->set_hide_folding(true);
+ nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
+ nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected");
+
+ HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
+ remove_filter_hbc->add_constant_override("separate", 0);
+ vbc_remove->add_child(remove_filter_hbc);
+
+ remove_filter = memnew(LineEdit);
+ remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
+ remove_filter->set_placeholder(TTR("Filter nodes"));
+ remove_filter_hbc->add_child(remove_filter);
+ remove_filter->connect("text_changed", this, "_remove_filter_changed");
+
+ set_title("Group Editor");
+ get_cancel()->hide();
+ set_as_toplevel(true);
+
+ error = memnew(ConfirmationDialog);
+ add_child(error);
+ error->get_ok()->set_text(TTR("Close"));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
void GroupsEditor::_add_group(const String &p_group) {
if (!node)
@@ -146,11 +563,22 @@ void GroupsEditor::set_current(Node *p_node) {
update_tree();
}
+void GroupsEditor::_show_group_dialog() {
+ group_dialog->edit();
+}
+
+void GroupsEditor::_group_dialog_closed() {
+ update_tree();
+}
+
void GroupsEditor::_bind_methods() {
ClassDB::bind_method("_add_group", &GroupsEditor::_add_group);
ClassDB::bind_method("_remove_group", &GroupsEditor::_remove_group);
ClassDB::bind_method("update_tree", &GroupsEditor::update_tree);
+
+ ClassDB::bind_method("_show_group_dialog", &GroupsEditor::_show_group_dialog);
+ ClassDB::bind_method("_group_dialog_closed", &GroupsEditor::_group_dialog_closed);
}
GroupsEditor::GroupsEditor() {
@@ -159,6 +587,16 @@ GroupsEditor::GroupsEditor() {
VBoxContainer *vbc = this;
+ group_dialog = memnew(GroupDialog);
+ group_dialog->set_as_toplevel(true);
+ add_child(group_dialog);
+ group_dialog->connect("popup_hide", this, "_group_dialog_closed");
+
+ Button *group_dialog_button = memnew(Button);
+ group_dialog_button->set_text(TTR("Manage Groups"));
+ vbc->add_child(group_dialog_button);
+ group_dialog_button->connect("pressed", this, "_show_group_dialog");
+
HBoxContainer *hbc = memnew(HBoxContainer);
vbc->add_child(hbc);
diff --git a/editor/groups_editor.h b/editor/groups_editor.h
index ad3d5cd14f..461cf0f8c2 100644
--- a/editor/groups_editor.h
+++ b/editor/groups_editor.h
@@ -31,9 +31,13 @@
#ifndef GROUPS_EDITOR_H
#define GROUPS_EDITOR_H
+#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
+#include "scene/gui/item_list.h"
#include "scene/gui/line_edit.h"
+#include "scene/gui/popup.h"
+#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "undo_redo.h"
@@ -41,12 +45,71 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+class GroupDialog : public ConfirmationDialog {
+
+ GDCLASS(GroupDialog, ConfirmationDialog);
+
+ ConfirmationDialog *error;
+
+ SceneTree *scene_tree;
+ TreeItem *groups_root;
+
+ LineEdit *add_group_text;
+
+ Tree *groups;
+
+ Tree *nodes_to_add;
+ TreeItem *add_node_root;
+ LineEdit *add_filter;
+
+ Tree *nodes_to_remove;
+ TreeItem *remove_node_root;
+ LineEdit *remove_filter;
+
+ ToolButton *add_button;
+ ToolButton *remove_button;
+
+ String selected_group;
+
+ void ok_pressed();
+ void _cancel_pressed();
+ void _group_selected();
+
+ void _remove_filter_changed(const String &p_filter);
+ void _add_filter_changed(const String &p_filter);
+
+ void _add_pressed();
+ void _removed_pressed();
+ void _add_group_pressed();
+
+ void _group_renamed();
+
+ void _add_group(String p_name);
+ void _delete_group_pressed(Object *p_item, int p_column, int p_id);
+
+ bool _can_edit(Node *p_node, String p_group);
+
+ void _load_groups(Node *p_current);
+ void _load_nodes(Node *p_current);
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void edit();
+
+ GroupDialog();
+};
+
class GroupsEditor : public VBoxContainer {
GDCLASS(GroupsEditor, VBoxContainer);
Node *node;
+ GroupDialog *group_dialog;
+
LineEdit *group_name;
Button *add;
Tree *tree;
@@ -58,6 +121,9 @@ class GroupsEditor : public VBoxContainer {
void _remove_group(Object *p_item, int p_column, int p_id);
void _close();
+ void _show_group_dialog();
+ void _group_dialog_closed();
+
protected:
static void _bind_methods();
diff --git a/editor/icons/README.md b/editor/icons/README.md
index f3aaa23666..3a2aba5b07 100644
--- a/editor/icons/README.md
+++ b/editor/icons/README.md
@@ -2,11 +2,11 @@ The icons here are optimized SVGs, because the editor renders the svgs at runtim
to be small in size, so they can be efficiently parsed.
The original icons can be found at:
-https://github.com/djrm/godot-design/tree/master/assets/icons
+https://github.com/godotengine/godot-design/tree/master/engine/icons
There you can find the optimizer script.
If you add a new icon, please make a pull request to this repo:
-https://github.com/djrm/godot-design/
+https://github.com/godotengine/godot-design/
and store the the optimized SVG version here.
diff --git a/editor/icons/SCsub b/editor/icons/SCsub
index 64992a9f90..7f94073e01 100644
--- a/editor/icons/SCsub
+++ b/editor/icons/SCsub
@@ -82,10 +82,9 @@ def make_editor_icons_action(target, source, env):
s.write("#endif\n")
+ with open(dst, "w") as f:
+ f.write(s.getvalue())
- f = open(dst, "w")
- f.write(s.getvalue())
- f.close()
s.close()
icons_string.close()
diff --git a/editor/icons/icon_GUI_slider_grabber.svg b/editor/icons/icon_GUI_slider_grabber.svg
index b1dcf980a5..b8e6f0a654 100644
--- a/editor/icons/icon_GUI_slider_grabber.svg
+++ b/editor/icons/icon_GUI_slider_grabber.svg
@@ -1,5 +1,82 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<circle cx="8" cy="1044.4" r="3" fill="#fff" fill-opacity=".78431" stroke-linejoin="round" stroke-opacity=".39216" stroke-width="3"/>
-</g>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 15.999999"
+ id="svg8"
+ sodipodi:docname="icon_GUI_slider_grabber.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1211"
+ inkscape:window-height="644"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="-5.7627119"
+ inkscape:cy="8"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g6" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g6">
+ <path
+ transform="translate(0 1036.4)"
+ d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm0 2a5 5 0 0 1 0.5 0.025391 5 5 0 0 1 0.49414 0.074219 5 5 0 0 1 0.48438 0.12305 5 5 0 0 1 0.46875 0.17188 5 5 0 0 1 0.44922 0.2168 5 5 0 0 1 0.42578 0.26172 5 5 0 0 1 0.39844 0.30273 5 5 0 0 1 0.36524 0.33984 5 5 0 0 1 0.33008 0.37695 5 5 0 0 1 0.29102 0.40625 5 5 0 0 1 0.24805 0.43359 5 5 0 0 1 0.20508 0.45508 5 5 0 0 1 0.1582 0.47461 5 5 0 0 1 0.10938 0.48828 5 5 0 0 1 0.060547 0.49609 5 5 0 0 1 0.011719 0.35352 5 5 0 0 1 -0.025391 0.5 5 5 0 0 1 -0.074218 0.49414 5 5 0 0 1 -0.12305 0.48438 5 5 0 0 1 -0.17188 0.46875 5 5 0 0 1 -0.2168 0.44922 5 5 0 0 1 -0.26172 0.42578 5 5 0 0 1 -0.30273 0.39844 5 5 0 0 1 -0.33984 0.36524 5 5 0 0 1 -0.37695 0.33008 5 5 0 0 1 -0.40625 0.29102 5 5 0 0 1 -0.43359 0.24805 5 5 0 0 1 -0.45508 0.20508 5 5 0 0 1 -0.47461 0.1582 5 5 0 0 1 -0.48828 0.10938 5 5 0 0 1 -0.49609 0.060547 5 5 0 0 1 -0.35352 0.011719 5 5 0 0 1 -0.5 -0.025391 5 5 0 0 1 -0.49414 -0.074218 5 5 0 0 1 -0.48438 -0.12305 5 5 0 0 1 -0.46875 -0.17188 5 5 0 0 1 -0.44922 -0.2168 5 5 0 0 1 -0.42578 -0.26172 5 5 0 0 1 -0.39844 -0.30273 5 5 0 0 1 -0.36523 -0.33984 5 5 0 0 1 -0.33008 -0.37695 5 5 0 0 1 -0.29102 -0.40625 5 5 0 0 1 -0.24805 -0.43359 5 5 0 0 1 -0.20508 -0.45508 5 5 0 0 1 -0.1582 -0.47461 5 5 0 0 1 -0.10938 -0.48828 5 5 0 0 1 -0.060547 -0.49609 5 5 0 0 1 -0.011719 -0.35352 5 5 0 0 1 0.025391 -0.5 5 5 0 0 1 0.074219 -0.49414 5 5 0 0 1 0.12305 -0.48438 5 5 0 0 1 0.17188 -0.46875 5 5 0 0 1 0.2168 -0.44922 5 5 0 0 1 0.26172 -0.42578 5 5 0 0 1 0.30273 -0.39844 5 5 0 0 1 0.33984 -0.36523 5 5 0 0 1 0.37695 -0.33008 5 5 0 0 1 0.40625 -0.29102 5 5 0 0 1 0.43359 -0.24805 5 5 0 0 1 0.45508 -0.20508 5 5 0 0 1 0.47461 -0.1582 5 5 0 0 1 0.48828 -0.10938 5 5 0 0 1 0.49609 -0.060547 5 5 0 0 1 0.35352 -0.011719z"
+ fill="#e0e0e0"
+ id="path2"
+ style="fill:#e0e0e0;fill-opacity:0.28925619" />
+ <circle
+ cx="8"
+ cy="1044.4"
+ r="3"
+ fill="#fff"
+ fill-opacity=".58824"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-opacity=".32549"
+ stroke-width="3"
+ id="circle4" />
+ </g>
+ <g
+ transform="translate(-0.06779632,-1036.4)"
+ id="g18">
+ <circle
+ style="fill:#ffffff;fill-opacity:0.78430996;stroke-width:3;stroke-linejoin:round;stroke-opacity:0.39216003"
+ cx="8"
+ cy="1044.4"
+ r="3"
+ id="circle16" />
+ </g>
</svg>
diff --git a/editor/icons/icon_GUI_slider_grabber_hl.svg b/editor/icons/icon_GUI_slider_grabber_hl.svg
index 73252751ce..a04ac44cf6 100644
--- a/editor/icons/icon_GUI_slider_grabber_hl.svg
+++ b/editor/icons/icon_GUI_slider_grabber_hl.svg
@@ -1,6 +1,80 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm0 2a5 5 0 0 1 0.5 0.025391 5 5 0 0 1 0.49414 0.074219 5 5 0 0 1 0.48438 0.12305 5 5 0 0 1 0.46875 0.17188 5 5 0 0 1 0.44922 0.2168 5 5 0 0 1 0.42578 0.26172 5 5 0 0 1 0.39844 0.30273 5 5 0 0 1 0.36524 0.33984 5 5 0 0 1 0.33008 0.37695 5 5 0 0 1 0.29102 0.40625 5 5 0 0 1 0.24805 0.43359 5 5 0 0 1 0.20508 0.45508 5 5 0 0 1 0.1582 0.47461 5 5 0 0 1 0.10938 0.48828 5 5 0 0 1 0.060547 0.49609 5 5 0 0 1 0.011719 0.35352 5 5 0 0 1 -0.025391 0.5 5 5 0 0 1 -0.074218 0.49414 5 5 0 0 1 -0.12305 0.48438 5 5 0 0 1 -0.17188 0.46875 5 5 0 0 1 -0.2168 0.44922 5 5 0 0 1 -0.26172 0.42578 5 5 0 0 1 -0.30273 0.39844 5 5 0 0 1 -0.33984 0.36524 5 5 0 0 1 -0.37695 0.33008 5 5 0 0 1 -0.40625 0.29102 5 5 0 0 1 -0.43359 0.24805 5 5 0 0 1 -0.45508 0.20508 5 5 0 0 1 -0.47461 0.1582 5 5 0 0 1 -0.48828 0.10938 5 5 0 0 1 -0.49609 0.060547 5 5 0 0 1 -0.35352 0.011719 5 5 0 0 1 -0.5 -0.025391 5 5 0 0 1 -0.49414 -0.074218 5 5 0 0 1 -0.48438 -0.12305 5 5 0 0 1 -0.46875 -0.17188 5 5 0 0 1 -0.44922 -0.2168 5 5 0 0 1 -0.42578 -0.26172 5 5 0 0 1 -0.39844 -0.30273 5 5 0 0 1 -0.36523 -0.33984 5 5 0 0 1 -0.33008 -0.37695 5 5 0 0 1 -0.29102 -0.40625 5 5 0 0 1 -0.24805 -0.43359 5 5 0 0 1 -0.20508 -0.45508 5 5 0 0 1 -0.1582 -0.47461 5 5 0 0 1 -0.10938 -0.48828 5 5 0 0 1 -0.060547 -0.49609 5 5 0 0 1 -0.011719 -0.35352 5 5 0 0 1 0.025391 -0.5 5 5 0 0 1 0.074219 -0.49414 5 5 0 0 1 0.12305 -0.48438 5 5 0 0 1 0.17188 -0.46875 5 5 0 0 1 0.2168 -0.44922 5 5 0 0 1 0.26172 -0.42578 5 5 0 0 1 0.30273 -0.39844 5 5 0 0 1 0.33984 -0.36523 5 5 0 0 1 0.37695 -0.33008 5 5 0 0 1 0.40625 -0.29102 5 5 0 0 1 0.43359 -0.24805 5 5 0 0 1 0.45508 -0.20508 5 5 0 0 1 0.47461 -0.1582 5 5 0 0 1 0.48828 -0.10938 5 5 0 0 1 0.49609 -0.060547 5 5 0 0 1 0.35352 -0.011719z" fill="#e0e0e0"/>
-<circle cx="8" cy="1044.4" r="3" fill="#fff" fill-opacity=".58824" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".32549" stroke-width="3"/>
-</g>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 15.999999"
+ id="svg8"
+ sodipodi:docname="icon_GUI_slider_grabber_hl.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="944"
+ inkscape:window-height="480"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g6">
+ <path
+ transform="translate(0 1036.4)"
+ d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm0 2a5 5 0 0 1 0.5 0.025391 5 5 0 0 1 0.49414 0.074219 5 5 0 0 1 0.48438 0.12305 5 5 0 0 1 0.46875 0.17188 5 5 0 0 1 0.44922 0.2168 5 5 0 0 1 0.42578 0.26172 5 5 0 0 1 0.39844 0.30273 5 5 0 0 1 0.36524 0.33984 5 5 0 0 1 0.33008 0.37695 5 5 0 0 1 0.29102 0.40625 5 5 0 0 1 0.24805 0.43359 5 5 0 0 1 0.20508 0.45508 5 5 0 0 1 0.1582 0.47461 5 5 0 0 1 0.10938 0.48828 5 5 0 0 1 0.060547 0.49609 5 5 0 0 1 0.011719 0.35352 5 5 0 0 1 -0.025391 0.5 5 5 0 0 1 -0.074218 0.49414 5 5 0 0 1 -0.12305 0.48438 5 5 0 0 1 -0.17188 0.46875 5 5 0 0 1 -0.2168 0.44922 5 5 0 0 1 -0.26172 0.42578 5 5 0 0 1 -0.30273 0.39844 5 5 0 0 1 -0.33984 0.36524 5 5 0 0 1 -0.37695 0.33008 5 5 0 0 1 -0.40625 0.29102 5 5 0 0 1 -0.43359 0.24805 5 5 0 0 1 -0.45508 0.20508 5 5 0 0 1 -0.47461 0.1582 5 5 0 0 1 -0.48828 0.10938 5 5 0 0 1 -0.49609 0.060547 5 5 0 0 1 -0.35352 0.011719 5 5 0 0 1 -0.5 -0.025391 5 5 0 0 1 -0.49414 -0.074218 5 5 0 0 1 -0.48438 -0.12305 5 5 0 0 1 -0.46875 -0.17188 5 5 0 0 1 -0.44922 -0.2168 5 5 0 0 1 -0.42578 -0.26172 5 5 0 0 1 -0.39844 -0.30273 5 5 0 0 1 -0.36523 -0.33984 5 5 0 0 1 -0.33008 -0.37695 5 5 0 0 1 -0.29102 -0.40625 5 5 0 0 1 -0.24805 -0.43359 5 5 0 0 1 -0.20508 -0.45508 5 5 0 0 1 -0.1582 -0.47461 5 5 0 0 1 -0.10938 -0.48828 5 5 0 0 1 -0.060547 -0.49609 5 5 0 0 1 -0.011719 -0.35352 5 5 0 0 1 0.025391 -0.5 5 5 0 0 1 0.074219 -0.49414 5 5 0 0 1 0.12305 -0.48438 5 5 0 0 1 0.17188 -0.46875 5 5 0 0 1 0.2168 -0.44922 5 5 0 0 1 0.26172 -0.42578 5 5 0 0 1 0.30273 -0.39844 5 5 0 0 1 0.33984 -0.36523 5 5 0 0 1 0.37695 -0.33008 5 5 0 0 1 0.40625 -0.29102 5 5 0 0 1 0.43359 -0.24805 5 5 0 0 1 0.45508 -0.20508 5 5 0 0 1 0.47461 -0.1582 5 5 0 0 1 0.48828 -0.10938 5 5 0 0 1 0.49609 -0.060547 5 5 0 0 1 0.35352 -0.011719z"
+ fill="#e0e0e0"
+ id="path2" />
+ <circle
+ cx="8"
+ cy="1044.4"
+ r="3"
+ fill="#fff"
+ fill-opacity=".58824"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-opacity=".32549"
+ stroke-width="3"
+ id="circle4" />
+ </g>
+ <g
+ transform="translate(-0.06779632,-1036.4)"
+ id="g18">
+ <circle
+ style="fill:#ffffff;fill-opacity:0.78430996;stroke-width:3;stroke-linejoin:round;stroke-opacity:0.39216003"
+ cx="8"
+ cy="1044.4"
+ r="3"
+ id="circle16" />
+ </g>
</svg>
diff --git a/editor/icons/icon_add_split.svg b/editor/icons/icon_add_split.svg
new file mode 100644
index 0000000000..4555fceb7c
--- /dev/null
+++ b/editor/icons/icon_add_split.svg
@@ -0,0 +1,8 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m3 13 10-10" fill="none" stroke="#f5f5f5" stroke-opacity=".39216" stroke-width="2"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m11 9v2h-2v2h2v2h2v-2h2v-2h-2v-2z" fill="#84ffb1"/>
+</g>
+<circle cx="4" cy="12" r="2" fill="none"/>
+<path d="m13 1a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2zm-10 10a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -2 -2z" fill="#e0e0e0"/>
+</svg>
diff --git a/editor/icons/icon_animation_filter.svg b/editor/icons/icon_animation_filter.svg
new file mode 100644
index 0000000000..4f8e881ea8
--- /dev/null
+++ b/editor/icons/icon_animation_filter.svg
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_animation_filter.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1089"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="10.429825"
+ inkscape:cx="-5.6414698"
+ inkscape:cy="10.961343"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g10" />
+ <g
+ transform="matrix(0.02719109,0,0,0.02719109,1.3153462,1.0022864)"
+ id="g12">
+ <g
+ id="g10">
+ <path
+ inkscape:connector-curvature="0"
+ d="M 495.289,20.143 H 16.709 c -14.938,0 -22.344,18.205 -11.666,28.636 l 169.7,165.778 v 260.587 c 0,14.041 16.259,21.739 27.131,13.031 L 331.017,384.743 c 3.956,-3.169 6.258,-7.962 6.258,-13.031 V 214.556 L 506.955,48.779 c 10.688,-10.44 3.259,-28.636 -11.666,-28.636 z"
+ id="path8"
+ style="fill:#e0e0e0;fill-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_animation_track_group.svg b/editor/icons/icon_animation_track_group.svg
new file mode 100644
index 0000000000..9c4748a528
--- /dev/null
+++ b/editor/icons/icon_animation_track_group.svg
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_animation_track_group.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1089"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="10.429825"
+ inkscape:cx="6.2135985"
+ inkscape:cy="6.5622523"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <path
+ style="fill:#e0e0e0"
+ inkscape:connector-curvature="0"
+ id="path2"
+ d="M 5.0508475,2 V 4 H 14 V 2 Z m -3.322034,-0.016949 v 2 h 2 v -2 z M 8.9830508,7 V 9 H 14 V 7 Z m -3.5254237,5 v 2 h 2 v -2 z m 3.5254237,0 v 2 H 14 v -2 z"
+ sodipodi:nodetypes="ccccccccccccccccccccccccc" />
+ <path
+ style="fill:#e0e0e0"
+ inkscape:connector-curvature="0"
+ id="path2-3"
+ d="m 5.4915255,6.9322039 v 1.999999 h 2 v -1.999999 z"
+ sodipodi:nodetypes="ccccc" />
+</svg>
diff --git a/editor/icons/icon_animation_track_list.svg b/editor/icons/icon_animation_track_list.svg
new file mode 100644
index 0000000000..40e8414598
--- /dev/null
+++ b/editor/icons/icon_animation_track_list.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_animation_track_list.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1089"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g4">
+ <path
+ transform="translate(0 1036.4)"
+ d="m2 2v2h2v-2h-2zm4 0v2h8v-2h-8zm-4 5v2h2v-2h-2zm4 0v2h8v-2h-8zm-4 5v2h2v-2h-2zm4 0v2h8v-2h-8z"
+ fill="#e0e0e0"
+ id="path2" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_animation_tree.svg b/editor/icons/icon_animation_tree.svg
new file mode 100644
index 0000000000..046506fa37
--- /dev/null
+++ b/editor/icons/icon_animation_tree.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m1 1v14h1.166v-2h1.834v2h8v-2h2v2h1v-14h-1v2h-2v-2h-8v2h-1.834v-2h-1.166zm4 3h2v1 1h1 3v2h-2v1 1h1 1v2h-1-2a1.0001 1.0001 0 0 1 -1 -1v-1-2h-1a1.0001 1.0001 0 0 1 -1 -1v-1-1-1zm-2.834 1h1.834v2h-1.834v-2zm9.834 0h2v2h-2v-2zm-9.834 4h1.834v2h-1.834v-2zm9.834 0h2v2h-2v-2z" fill="#cea4f1"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_asset_lib.svg b/editor/icons/icon_asset_lib.svg
index 1348c491fc..967c5bf708 100644
--- a/editor/icons/icon_asset_lib.svg
+++ b/editor/icons/icon_asset_lib.svg
@@ -1,3 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<path d="m8 1c-1.6569 0-3 1.3431-3 3v2h-4v7c0 1.108 0.89199 2 2 2h10c1.108 0 2-0.89199 2-2v-7h-4v-2c0-1.6569-1.3431-3-3-3zm0 2c0.55228 0 1 0.44772 1 1v2h-2v-2c0-0.55228 0.44772-1 1-1z" fill="#e0e0e0"/>
+<path d="m8 1c-1.6569 0-3 1.3431-3 3v2h-3c-0.66446 3.505e-4 -1.1438 0.6366-0.96094 1.2754l2 7c0.12287 0.42881 0.51487 0.7244 0.96094 0.72461h8c0.44606-2.09e-4 0.83806-0.2958 0.96094-0.72461l2-7c0.1829-0.63879-0.29648-1.275-0.96094-1.2754h-3v-2c0-1.6569-1.3431-3-3-3zm0 2c0.55228 0 1 0.44772 1 1v2h-2v-2c0-0.55228 0.44772-1 1-1z" fill="#e0e0e0"/>
</svg>
diff --git a/editor/icons/icon_audio_bus_layout.svg b/editor/icons/icon_audio_bus_layout.svg
index 9162722eb2..fa6b60bc3e 100644
--- a/editor/icons/icon_audio_bus_layout.svg
+++ b/editor/icons/icon_audio_bus_layout.svg
@@ -1,9 +1,9 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="1" y2="15" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -1036.4)">
diff --git a/editor/icons/icon_audio_stream_player.svg b/editor/icons/icon_audio_stream_player.svg
index 218fd995a0..754b72bc96 100644
--- a/editor/icons/icon_audio_stream_player.svg
+++ b/editor/icons/icon_audio_stream_player.svg
@@ -1,9 +1,9 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="1" y2="15" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -1036.4)" shape-rendering="auto">
diff --git a/editor/icons/icon_audio_stream_player_2_d.svg b/editor/icons/icon_audio_stream_player_2_d.svg
index a431b84a55..0e9c0ca5b1 100644
--- a/editor/icons/icon_audio_stream_player_2_d.svg
+++ b/editor/icons/icon_audio_stream_player_2_d.svg
@@ -1,9 +1,9 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="1" y2="15" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -1036.4)" shape-rendering="auto">
diff --git a/editor/icons/icon_audio_stream_player_3_d.svg b/editor/icons/icon_audio_stream_player_3_d.svg
index 4ce9d6da58..d947586f63 100644
--- a/editor/icons/icon_audio_stream_player_3_d.svg
+++ b/editor/icons/icon_audio_stream_player_3_d.svg
@@ -1,9 +1,9 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="1" y2="15" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -1036.4)" shape-rendering="auto">
diff --git a/editor/icons/icon_audio_stream_sample.svg b/editor/icons/icon_audio_stream_sample.svg
index f0be1dc303..a7c7232ee0 100644
--- a/editor/icons/icon_audio_stream_sample.svg
+++ b/editor/icons/icon_audio_stream_sample.svg
@@ -1,9 +1,9 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="1" y2="15" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -1036.4)">
diff --git a/editor/icons/icon_auto_end.svg b/editor/icons/icon_auto_end.svg
new file mode 100644
index 0000000000..9e779c69f4
--- /dev/null
+++ b/editor/icons/icon_auto_end.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_auto_end.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1273"
+ inkscape:window-height="766"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="41.7193"
+ inkscape:cx="12.08616"
+ inkscape:cy="6.9898672"
+ inkscape:window-x="539"
+ inkscape:window-y="208"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path2"
+ style="color:#000000;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;white-space:normal;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ d="m 13.999798,14 c 0.552262,-5.5e-5 0.999945,-0.447738 1,-1 V 3 c -5.5e-5,-0.5522619 -0.447738,-0.9999448 -1,-1 H 5.9997976 C 5.6959349,1.9998247 5.4084731,2.1378063 5.2185476,2.375 l -4,5 c -0.29139692,0.3649711 -0.29139692,0.8830289 0,1.248 l 4,5 c 0.189538,0.237924 0.4770584,0.376652 0.78125,0.37695 h 8.0000004 z m -1,-2 H 6.4802976 l -3.1992,-4 3.1992,-4 H 12.999798 Z M 6.9997976,10 V 6 l -2,2 z"
+ sodipodi:nodetypes="cccccccccccccccccccccc" />
+ <g
+ aria-label="E"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#e0e0e0;fill-opacity:1;stroke:none"
+ id="text829"
+ transform="matrix(0.20475474,0,0,0.20475474,4.7903856,12.365563)">
+ <path
+ d="M 15.129502,-36.414393 H 35.422471 V -30.7308 H 22.649034 v 5.429688 h 12.011718 v 5.683594 H 22.649034 v 6.679687 h 13.203125 v 5.6835938 H 15.129502 Z"
+ style="fill:#e0e0e0;fill-opacity:1"
+ id="path831"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_auto_triangle.svg b/editor/icons/icon_auto_triangle.svg
new file mode 100644
index 0000000000..631f259452
--- /dev/null
+++ b/editor/icons/icon_auto_triangle.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_auto_triangle.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1853"
+ inkscape:window-height="1016"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="17.168167"
+ inkscape:cy="5.5708575"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g6">
+ <g
+ transform="translate(-26.001 -9.8683)"
+ id="g4">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:1.87616086;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8.2324219 0.67773438 L 0.64453125 15.289062 L 15.355469 15.289062 L 8.2324219 0.67773438 z M 6.9414062 5.4433594 L 9.2109375 5.4433594 C 9.5561128 6.0670927 9.8954447 6.7088542 10.230469 7.3671875 C 10.565492 8.0167875 10.901304 8.703974 11.236328 9.4316406 C 11.581503 10.159241 11.931781 10.934946 12.287109 11.757812 C 12.642437 12.580746 13.018126 13.477066 13.414062 14.447266 L 10.871094 14.447266 C 10.75942 14.135399 10.632366 13.815528 10.490234 13.486328 C 10.358255 13.157195 10.225729 12.827247 10.09375 12.498047 L 5.9824219 12.498047 C 5.8504432 12.827247 5.7143976 13.157195 5.5722656 13.486328 C 5.440287 13.815528 5.3167521 14.135399 5.2050781 14.447266 L 2.7382812 14.447266 C 3.1342186 13.477066 3.5099064 12.580746 3.8652344 11.757812 C 4.2205624 10.934946 4.5673204 10.159241 4.9023438 9.4316406 C 5.2475197 8.703974 5.5813793 8.0167875 5.90625 7.3671875 C 6.2412733 6.7088542 6.5860782 6.0670927 6.9414062 5.4433594 z M 8.0234375 7.4824219 C 7.9726708 7.6123552 7.8964385 7.790425 7.7949219 8.015625 C 7.6933999 8.240825 7.5772912 8.5003885 7.4453125 8.7949219 C 7.3133332 9.0894552 7.1643891 9.4143979 7.0019531 9.7695312 C 6.8496698 10.124665 6.6936847 10.496919 6.53125 10.886719 L 9.53125 10.886719 C 9.368814 10.496919 9.2108764 10.124665 9.0585938 9.7695312 C 8.9063104 9.4143979 8.7593188 9.0894552 8.6171875 8.7949219 C 8.4852082 8.5003885 8.3691001 8.240825 8.2675781 8.015625 C 8.1660555 7.790425 8.0843508 7.6123552 8.0234375 7.4824219 z "
+ transform="translate(26.001,1046.2683)"
+ id="path821" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_bezier_handles_balanced.svg b/editor/icons/icon_bezier_handles_balanced.svg
new file mode 100644
index 0000000000..8ab99d79bb
--- /dev/null
+++ b/editor/icons/icon_bezier_handles_balanced.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_bezier_handles_balanced.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1417"
+ inkscape:window-height="685"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="4.2910315"
+ inkscape:cy="11.857644"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:1.70000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="m 1.7627119,13.627119 c 0,0 1.2881355,-6.847458 6.5762712,-8.1355935 5.0847459,0.9491522 5.9661009,8.1355925 5.9661009,8.1355925"
+ id="path4526"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccc" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846"
+ cx="1.8983043"
+ cy="13.491526"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3"
+ cx="14.237288"
+ cy="13.491526"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:0.61799997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 7.4559186,5.1473018 2.7203863,6.7014816"
+ id="path5878"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:0.61489719;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 10.790357,4.2063094 8.2893822,5.149623"
+ id="path5878-7"
+ inkscape:connector-curvature="0" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3-6"
+ cx="8.2711868"
+ cy="4.7796612"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="M 1.7157324,5.8754878 A 1.2675855,1.1997888 0 0 0 0.44815434,7.0747066 1.2675855,1.1997888 0 0 0 1.7157324,8.2739253 1.2675855,1.1997888 0 0 0 2.9833105,7.0747066 1.2675855,1.1997888 0 0 0 1.7157324,5.8754878 Z m 0.00195,0.4238282 A 0.84677333,0.80148375 0 0 1 2.5653417,7.1000972 0.84677333,0.80148375 0 0 1 1.7176855,7.9008784 0.84677333,0.80148375 0 0 1 0.87002934,7.1000972 0.84677333,0.80148375 0 0 1 1.7176855,6.299316 Z"
+ id="path5846-5"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.7567277;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="M 11.909414,2.4642073 A 1.2836218,1.231838 0 0 0 10.6258,3.6954601 1.2836218,1.231838 0 0 0 11.909414,4.9267128 1.2836218,1.231838 0 0 0 13.193028,3.6954601 1.2836218,1.231838 0 0 0 11.909414,2.4642073 Z m 0.002,0.4351497 a 0.85748593,0.82289328 0 0 1 0.858383,0.8221719 0.85748593,0.82289328 0 0 1 -0.85838,0.822172 0.85748593,0.82289328 0 0 1 -0.858379,-0.822172 0.85748593,0.82289328 0 0 1 0.858379,-0.8221719 z"
+ id="path5846-5-6" />
+</svg>
diff --git a/editor/icons/icon_bezier_handles_free.svg b/editor/icons/icon_bezier_handles_free.svg
new file mode 100644
index 0000000000..e5dfb8d0fc
--- /dev/null
+++ b/editor/icons/icon_bezier_handles_free.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_bezier_handles_separate.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1417"
+ inkscape:window-height="685"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="4.2910315"
+ inkscape:cy="11.857644"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:1.70000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="m 1.7627119,13.627119 c 0,0 1.2881355,-6.847458 6.5762712,-8.1355935 5.0847459,0.9491522 5.9661009,8.1355925 5.9661009,8.1355925"
+ id="path4526"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccc" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846"
+ cx="1.8983043"
+ cy="13.491526"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3"
+ cx="14.237288"
+ cy="13.491526"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:0.80513805;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 7.6850253,4.7560401 3.9088983,5.4168"
+ id="path5878"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:0.73079807;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 11.695505,2.3941651 8.696384,4.6876729"
+ id="path5878-7"
+ inkscape:connector-curvature="0" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3-6"
+ cx="8.2711868"
+ cy="4.7796612"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="M 2.4961199,4.3976698 A 1.1997888,1.2675855 80.074672 0 0 1.4542161,5.7974257 1.1997888,1.2675855 80.074672 0 0 2.9095255,6.7602105 1.1997888,1.2675855 80.074672 0 0 3.9514292,5.3604547 1.1997888,1.2675855 80.074672 0 0 2.4961199,4.3976698 Z m 0.074974,0.4171488 A 0.80148375,0.84677333 80.074672 0 1 3.5440925,5.4575082 0.80148375,0.84677333 80.074672 0 1 2.8471493,6.3924102 0.80148375,0.84677333 80.074672 0 1 1.8741535,5.74972 0.80148375,0.84677333 80.074672 0 1 2.5710967,4.814818 Z"
+ id="path5846-5"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.7567277;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="m 11.838896,0.64428913 a 1.231838,1.2836218 52.593897 0 0 -0.271701,1.75779027 1.231838,1.2836218 52.593897 0 0 1.767576,0.1983008 1.231838,1.2836218 52.593897 0 0 0.271701,-1.75779027 1.231838,1.2836218 52.593897 0 0 -1.767576,-0.1983008 z m 0.265925,0.3444462 A 0.82289328,0.85748593 52.593897 0 1 13.286115,1.1203938 0.82289328,0.85748593 52.593897 0 1 13.103698,2.2949179 0.82289328,0.85748593 52.593897 0 1 11.922407,2.163257 0.82289328,0.85748593 52.593897 0 1 12.104824,0.98873353 Z"
+ id="path5846-5-6" />
+</svg>
diff --git a/editor/icons/icon_bezier_handles_mirror.svg b/editor/icons/icon_bezier_handles_mirror.svg
new file mode 100644
index 0000000000..682c898368
--- /dev/null
+++ b/editor/icons/icon_bezier_handles_mirror.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_bezier_handles_mirror.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1417"
+ inkscape:window-height="685"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="4.2910315"
+ inkscape:cy="11.857644"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:1.70000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="m 1.7627119,13.627119 c 0,0 1.2881355,-6.847458 6.5762712,-8.1355935 5.0847459,0.9491522 5.9661009,8.1355925 5.9661009,8.1355925"
+ id="path4526"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccc" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846"
+ cx="1.8983043"
+ cy="13.491526"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3"
+ cx="14.237288"
+ cy="13.491526"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:0.80513805;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8.2033896,4.6779662 H 4.3698875"
+ id="path5878"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:0.71670938;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 11.931789,4.6440679 H 8.2033896"
+ id="path5878-7"
+ inkscape:connector-curvature="0" />
+ <ellipse
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3-6"
+ cx="8.2711868"
+ cy="4.7796612"
+ rx="1.2675855"
+ ry="1.1997888" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="M 3.1539157,3.4305762 A 1.2675855,1.1997888 0 0 0 1.8863376,4.629795 1.2675855,1.1997888 0 0 0 3.1539157,5.8290137 1.2675855,1.1997888 0 0 0 4.4214938,4.629795 1.2675855,1.1997888 0 0 0 3.1539157,3.4305762 Z m 0.00195,0.4238282 A 0.84677333,0.80148375 0 0 1 4.003525,4.6551856 0.84677333,0.80148375 0 0 1 3.1558688,5.4559668 0.84677333,0.80148375 0 0 1 2.3082126,4.6551856 0.84677333,0.80148375 0 0 1 3.1558688,3.8544044 Z"
+ id="path5846-5"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="m 13.093969,3.3750567 a 1.2675855,1.1997888 0 0 0 -1.267578,1.1992188 1.2675855,1.1997888 0 0 0 1.267578,1.1992187 1.2675855,1.1997888 0 0 0 1.267578,-1.1992187 1.2675855,1.1997888 0 0 0 -1.267578,-1.1992188 z m 0.002,0.4238282 a 0.84677333,0.80148375 0 0 1 0.847659,0.8007812 0.84677333,0.80148375 0 0 1 -0.847656,0.8007812 0.84677333,0.80148375 0 0 1 -0.847656,-0.8007812 0.84677333,0.80148375 0 0 1 0.847656,-0.8007812 z"
+ id="path5846-5-6" />
+</svg>
diff --git a/editor/icons/icon_bone_2_d.svg b/editor/icons/icon_bone_2_d.svg
new file mode 100644
index 0000000000..efcbc17e13
--- /dev/null
+++ b/editor/icons/icon_bone_2_d.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_bone_2d.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="836"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g4"
+ style="fill:#a5b7f3;fill-opacity:1">
+ <path
+ d="m10.478 1037.4a2.4664 2.4663 0 0 0 -1.7804 0.7205 2.4664 2.4663 0 0 0 -0.31408 3.1041l-3.559 3.5608a2.4664 2.4663 0 0 0 -3.1023 0.3121 2.4664 2.4663 0 0 0 0 3.4876 2.4664 2.4663 0 0 0 1.397 0.6955 2.4664 2.4663 0 0 0 0.69561 1.397 2.4664 2.4663 0 0 0 3.4877 0 2.4664 2.4663 0 0 0 0.31408 -3.1041l3.5609-3.5608a2.4664 2.4663 0 0 0 3.1004 -0.3102 2.4664 2.4663 0 0 0 0 -3.4875 2.4664 2.4663 0 0 0 -1.397 -0.6974 2.4664 2.4663 0 0 0 -0.69561 -1.3971 2.4664 2.4663 0 0 0 -1.7072 -0.7205z"
+ fill="#fc9c9c"
+ id="path2"
+ style="fill:#a5b7f3;fill-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_bus_vu_db.svg b/editor/icons/icon_bus_vu_db.svg
index 23bcd8841c..236e41e1f5 100644
--- a/editor/icons/icon_bus_vu_db.svg
+++ b/editor/icons/icon_bus_vu_db.svg
@@ -1,9 +1,9 @@
<svg width="32" height="128" version="1.1" viewBox="0 0 32 128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="16" x2="16" y2="128" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -924.36)">
diff --git a/editor/icons/icon_bus_vu_empty.svg b/editor/icons/icon_bus_vu_empty.svg
index 52c86ac704..60fddc535f 100644
--- a/editor/icons/icon_bus_vu_empty.svg
+++ b/editor/icons/icon_bus_vu_empty.svg
@@ -1,9 +1,9 @@
<svg width="16" height="128" version="1.1" viewBox="0 0 16 128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="2" y2="126" gradientTransform="translate(0 924.36)" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -924.36)">
diff --git a/editor/icons/icon_bus_vu_full.svg b/editor/icons/icon_bus_vu_full.svg
index a91b8a06c6..4f2ce5df11 100644
--- a/editor/icons/icon_bus_vu_full.svg
+++ b/editor/icons/icon_bus_vu_full.svg
@@ -1,9 +1,9 @@
<svg width="16" height="128" version="1.1" viewBox="0 0 16 128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" x1="8" x2="8" y1="2" y2="126" gradientUnits="userSpaceOnUse">
-<stop stop-color="#ff8484" offset="0"/>
+<stop stop-color="#ff7a7a" offset="0"/>
<stop stop-color="#e1dc7a" offset=".5"/>
-<stop stop-color="#84ffb1" offset="1"/>
+<stop stop-color="#66ff9e" offset="1"/>
</linearGradient>
</defs>
<g transform="translate(0 -924.36)">
diff --git a/editor/icons/icon_c_s_g_box.svg b/editor/icons/icon_c_s_g_box.svg
new file mode 100644
index 0000000000..67e34df444
--- /dev/null
+++ b/editor/icons/icon_c_s_g_box.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1h-2zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1v-1z" fill="#84c2ff"/>
+<path transform="translate(0 1036.4)" d="m8 0.94531-7 3.5v7.2227l7 3.5 0.29492-0.14844c-0.18282-0.30101-0.29492-0.64737-0.29492-1.0195v-2c0-0.72651 0.40824-1.3664 1-1.7168v-1.6699l4-2v1.3867h1c0.36419 0 0.70336 0.10754 1 0.2832v-3.8379zm0 2.1152 3.9395 1.9707-3.9395 1.9688-3.9395-1.9688zm-5 3.5527 4 2v3.9414l-4-2.002z" fill="#fc9c9c" stroke-width="1.0667"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_capsule.svg b/editor/icons/icon_c_s_g_capsule.svg
new file mode 100644
index 0000000000..92a7b5a870
--- /dev/null
+++ b/editor/icons/icon_c_s_g_capsule.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g>
+<path d="m8 1c-2.7527 0-5 2.2418-5 4.9902v4.0176c0 2.7484 2.2473 4.9922 5 4.9922 0.092943 0 0.18367-0.008623 0.27539-0.013672-0.17055-0.29341-0.27539-0.62792-0.27539-0.98633v-2c0-0.72887 0.41095-1.3691 1.0059-1.7188v-0.28125c0.34771-0.034464 0.68259-0.10691 1.0156-0.19922 0.10394-0.99856 0.95603-1.8008 1.9785-1.8008h1v-2.0098c0-2.7484-2.2473-4.9902-5-4.9902zm-1.0059 2.127v4.8574c-0.66556-0.1047-1.2974-0.37231-1.9941-0.66211v-1.3223c0-1.3474 0.79841-2.4642 1.9941-2.873zm2.0117 0c1.1957 0.4088 1.9941 1.5256 1.9941 2.873v1.3457c-0.68406 0.3054-1.3142 0.57292-1.9941 0.66602v-4.8848zm-4.0059 6.334c0.67836 0.2231 1.3126 0.44599 1.9941 0.52539v2.8848c-1.1957-0.4092-1.9941-1.5237-1.9941-2.8711v-0.53906z" fill="#fc9c9c"/>
+<path d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1z" fill="#84c2ff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_combiner.svg b/editor/icons/icon_c_s_g_combiner.svg
new file mode 100644
index 0000000000..cce2902e24
--- /dev/null
+++ b/editor/icons/icon_c_s_g_combiner.svg
@@ -0,0 +1,8 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1h-2zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1v-1z" fill="#84c2ff"/>
+<g fill="#fc9c9c">
+<path transform="translate(0 1036.4)" d="m3 1c-1.1046 0-2 0.89543-2 2h2zm2 0v2h2v-2zm4 0v2h2v-2zm4 0v2h2c0-1.1046-0.89543-2-2-2zm-12 4v2h2v-2zm12 0v2h2v-2zm-12 4v2h2v-2zm0 4c0 1.1046 0.89543 2 2 2v-2zm4 0v2h2v-2z" fill="#fc9c9c"/>
+</g>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_cylinder.svg b/editor/icons/icon_c_s_g_cylinder.svg
new file mode 100644
index 0000000000..645a74c79b
--- /dev/null
+++ b/editor/icons/icon_c_s_g_cylinder.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 14.999999 14.999999" xmlns="http://www.w3.org/2000/svg">
+<g>
+<path transform="scale(.9375)" d="m8 1c-1.7469 0-3.328 0.22648-4.5586 0.63672-0.61528 0.20512-1.1471 0.45187-1.5898 0.80078-0.44272 0.34891-0.85156 0.88101-0.85156 1.5625v8c0 0.68149 0.40884 1.2155 0.85156 1.5645 0.44272 0.34891 0.97457 0.59577 1.5898 0.80078 1.2306 0.41024 2.8117 0.63477 4.5586 0.63477 0.095648 0 0.18467-0.008426 0.2793-0.009766-0.1722-0.29446-0.2793-0.62995-0.2793-0.99023v-1c-1.5668 0-2.9867-0.2195-3.9277-0.5332-0.46329-0.15435-0.90474-0.33752-1.0723-0.4668v-5.8125c0.1468 0.058667 0.2835 0.12515 0.44141 0.17773 1.2306 0.41024 2.8117 0.63477 4.5586 0.63477s3.328-0.22453 4.5586-0.63477c0.15791-0.052267 0.29461-0.11864 0.44141-0.17773v1.8125h1c0.36396 0 0.70348 0.10774 1 0.2832v-4.2832c0-0.68149-0.40884-1.2136-0.85156-1.5625-0.44272-0.34891-0.97457-0.59566-1.5898-0.80078-1.2306-0.41024-2.8117-0.63672-4.5586-0.63672zm0 2c1.5668 0 2.9867 0.22145 3.9277 0.53516 0.46368 0.15456 0.80138 0.33741 0.96875 0.4668-0.16752 0.12928-0.50546 0.3105-0.96875 0.46484-0.94102 0.31371-2.361 0.5332-3.9277 0.5332s-2.9867-0.2195-3.9277-0.5332c-0.46329-0.15435-0.80123-0.33556-0.96875-0.46484 0.16737-0.12939 0.50507-0.31224 0.96875-0.4668 0.94102-0.31371 2.361-0.53516 3.9277-0.53516z" fill="#fc9c9c" stroke-width="1.0667"/>
+<path d="m11.25 8.4375c-0.51938 0-0.9375 0.41812-0.9375 0.9375v0.9375h1.875v1.875h0.9375c0.51938 0 0.9375-0.41812 0.9375-0.9375v-1.875c0-0.51938-0.41812-0.9375-0.9375-0.9375zm0.9375 3.75h-1.875v-1.875h-0.9375c-0.51938 0-0.9375 0.41812-0.9375 0.9375v1.875c0 0.51938 0.41812 0.9375 0.9375 0.9375h1.875c0.51938 0 0.9375-0.41812 0.9375-0.9375z" fill="#84c2ff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_mesh.svg b/editor/icons/icon_c_s_g_mesh.svg
new file mode 100644
index 0000000000..6e940a4aa5
--- /dev/null
+++ b/editor/icons/icon_c_s_g_mesh.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g>
+<path d="m3 1c-1.1046 0-2 0.89543-2 2 5.649e-4 0.71397 0.38169 1.3735 1 1.7305v6.541c-0.61771 0.35663-0.99874 1.0152-1 1.7285 0 1.1046 0.89543 2 2 2 0.71397-5.65e-4 1.3735-0.38169 1.7305-1h3.2695v-2h-3.2715c-0.17478-0.30301-0.42598-0.55488-0.72852-0.73047v-5.8555l4.916 4.916c0.31428-0.20669 0.68609-0.33008 1.084-0.33008 0-0.3979 0.12338-0.76971 0.33008-1.084l-4.916-4.916h5.8574c0.17478 0.30301 0.42598 0.55488 0.72852 0.73047v3.2695h2v-3.2715c0.61771-0.35663 0.99874-1.0152 1-1.7285 0-1.1046-0.89543-2-2-2-0.71397 5.648e-4 -1.3735 0.38169-1.7305 1h-6.541c-0.35663-0.61771-1.0152-0.99874-1.7285-1z" fill="#fc9c9c"/>
+<path d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1z" fill="#84c2ff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_polygon.svg b/editor/icons/icon_c_s_g_polygon.svg
new file mode 100644
index 0000000000..71b03cb8e6
--- /dev/null
+++ b/editor/icons/icon_c_s_g_polygon.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m7.9629 1.002c-0.14254 0.00487-0.28238 0.04016-0.41016 0.10352l-6 3c-0.33878 0.16944-0.55276 0.51574-0.55273 0.89453v5.832c-0.105 0.61631 0.37487 1.1768 1 1.168h5v2c2.16e-5 0.67546 0.64487 1.1297 1.2617 0.95898-0.16118-0.28721-0.26172-0.61135-0.26172-0.95898v-2c0-0.72673 0.40794-1.3664 1-1.7168v-1.666l4-2v1.3828h1c0.36397 0 0.70348 0.10774 1 0.2832v-3.2773c6e-6 -0.00195 6e-6 -0.0039094 0-0.0058594 2.6e-5 -0.37879-0.21395-0.72509-0.55273-0.89453l-6-3c-0.15022-0.074574-0.31679-0.11017-0.48438-0.10352zm0.037109 2.1172l3.7637 1.8809-2.7637 1.3809v-1.3809c-5.52e-5 -0.55226-0.44774-0.99994-1-1h-1.7617l1.7617-0.88086zm-5 2.8809h4v4h-4v-4z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#fc9c9c" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 1036.4)" d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1h-2zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1v-1z" fill="#84c2ff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_sphere.svg b/editor/icons/icon_c_s_g_sphere.svg
new file mode 100644
index 0000000000..f81b566993
--- /dev/null
+++ b/editor/icons/icon_c_s_g_sphere.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g>
+<path d="m8 1c-3.8541 0-7 3.1459-7 7 0 3.8542 3.1459 7 7 7 0.093042 0 0.18321-0.01004 0.27539-0.013672-0.17055-0.29341-0.27539-0.62792-0.27539-0.98633v-2c0-0.72673 0.40794-1.3664 1-1.7168v-0.33398c0.34074-0.019259 0.67728-0.069097 1.0156-0.10547 0.083091-1.0187 0.94713-1.8438 1.9844-1.8438h2c0.35841 0 0.69292 0.10484 0.98633 0.27539 0.003633-0.092184 0.013672-0.18235 0.013672-0.27539 0-3.8541-3.1459-7-7-7zm-1 2.0977v4.8711c-1.2931-0.071342-2.6061-0.29819-3.9434-0.69141 0.30081-2.0978 1.8852-3.7665 3.9434-4.1797zm2 0c2.0549 0.41253 3.637 2.0767 3.9414 4.1699-1.3046 0.36677-2.6158 0.60259-3.9414 0.6875v-4.8574zm-5.7793 6.2988c1.2733 0.31892 2.5337 0.50215 3.7793 0.5625v2.9414c-1.8291-0.36719-3.266-1.7339-3.7793-3.5039z" fill="#fc9c9c"/>
+<path d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1z" fill="#84c2ff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_c_s_g_torus.svg b/editor/icons/icon_c_s_g_torus.svg
new file mode 100644
index 0000000000..3d30aa47b2
--- /dev/null
+++ b/editor/icons/icon_c_s_g_torus.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m8 3c-1.8145 0-3.4691 0.41721-4.7461 1.1621-1.277 0.745-2.2539 1.9082-2.2539 3.3379 0 1.4298 0.9769 2.5949 2.2539 3.3398 1.277 0.7449 2.9316 1.1602 4.7461 1.1602 0-1.0907 0.90931-2 2-2 0-0.080836 0.013744-0.15778 0.023438-0.23633-0.61769 0.14673-1.3008 0.23633-2.0234 0.23633-1.4992 0-2.8437-0.36687-3.7383-0.88867-0.89456-0.5219-1.2617-1.108-1.2617-1.6113 0-0.5032 0.36716-1.0876 1.2617-1.6094 0.89456-0.5219 2.2391-0.89062 3.7383-0.89062s2.8437 0.36872 3.7383 0.89062c0.89456 0.5218 1.2617 1.1062 1.2617 1.6094 0 0.15978-0.053679 0.32822-0.13281 0.5h1.1328c0.32481 0 0.62893 0.088408 0.90234 0.23047 0.057552-0.23582 0.097656-0.47718 0.097656-0.73047 0-1.4297-0.9769-2.5929-2.2539-3.3379-1.277-0.7449-2.9316-1.1621-4.7461-1.1621z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#fc9c9c" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+<path transform="translate(0 1036.4)" d="m12 9c-0.55401 0-1 0.44599-1 1v1h2v2h1c0.55401 0 1-0.44599 1-1v-2c0-0.55401-0.44599-1-1-1h-2zm1 4h-2v-2h-1c-0.55401 0-1 0.44599-1 1v2c0 0.55401 0.44599 1 1 1h2c0.55401 0 1-0.44599 1-1v-1z" fill="#84c2ff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_color_rect.svg b/editor/icons/icon_color_rect.svg
index c0cd07061e..c2d4cf344d 100644
--- a/editor/icons/icon_color_rect.svg
+++ b/editor/icons/icon_color_rect.svg
@@ -1,9 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<rect x="1" y="1037.4" width="2" height="14" fill="#a5efac"/>
-<rect x="1" y="1049.4" width="14" height="2" fill="#a5efac"/>
-<rect x="1" y="1037.4" width="14" height="2" fill="#a5efac"/>
-<rect x="13" y="1037.4" width="2" height="14" fill="#a5efac"/>
+<path transform="translate(0 1036.4)" d="m1 1v14h14v-14zm2 2h10v10h-10z" fill="#a5efac"/>
<path d="m12 1048.4h-4.8l4.8-4.8z" fill="#70bfff" fill-rule="evenodd"/>
<path d="m4 1040.4h4.8l-4.8 4.8z" fill="#ff7070" fill-rule="evenodd"/>
<path d="m4 1048.4v-3.2l4.8-4.8h3.2v3.2l-4.8 4.8z" fill="#7aff70" fill-rule="evenodd"/>
diff --git a/editor/icons/icon_color_track_vu.svg b/editor/icons/icon_color_track_vu.svg
new file mode 100644
index 0000000000..cad76d0234
--- /dev/null
+++ b/editor/icons/icon_color_track_vu.svg
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="24"
+ version="1.1"
+ viewBox="0 0 16 24"
+ id="svg6"
+ sodipodi:docname="icon_color_track_vu.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10">
+ <linearGradient
+ id="linearGradient4583"
+ inkscape:collect="always">
+ <stop
+ id="stop4579"
+ offset="0"
+ style="stop-color:#f70000;stop-opacity:1" />
+ <stop
+ id="stop4581"
+ offset="1"
+ style="stop-color:#eec315;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4549">
+ <stop
+ style="stop-color:#288027;stop-opacity:1"
+ offset="0"
+ id="stop4545" />
+ <stop
+ style="stop-color:#dbee15;stop-opacity:1"
+ offset="1"
+ id="stop4547" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4549"
+ id="linearGradient4551"
+ x1="7.7288136"
+ y1="16.474577"
+ x2="7.7288136"
+ y2="3.8644071"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.0931873,0,0,1.4762899,-0.98021429,0.08553021)" />
+ <linearGradient
+ gradientTransform="matrix(1.1036585,0,0,0.47778193,-16.507235,-7.9018165)"
+ inkscape:collect="always"
+ xlink:href="#linearGradient4583"
+ id="linearGradient4551-7"
+ x1="7.7288136"
+ y1="16.474577"
+ x2="7.7288136"
+ y2="3.8644071"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1170"
+ inkscape:window-height="712"
+ id="namedview8"
+ showgrid="false"
+ showguides="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="5.3261277"
+ inkscape:cy="13.681053"
+ inkscape:window-x="397"
+ inkscape:window-y="233"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <rect
+ style="fill:url(#linearGradient4551);fill-opacity:1;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke"
+ id="rect822"
+ width="18.232145"
+ height="18.416088"
+ x="-1.3507863"
+ y="5.9906898"
+ ry="0.84580106" />
+ <rect
+ style="fill:url(#linearGradient4551-7);fill-opacity:1;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke"
+ id="rect822-5"
+ width="18.406782"
+ height="5.9601259"
+ x="-16.881357"
+ y="-5.9906898"
+ ry="0.27373245"
+ transform="scale(-1)" />
+</svg>
diff --git a/editor/icons/icon_delete_split.svg b/editor/icons/icon_delete_split.svg
new file mode 100644
index 0000000000..c24f7449d6
--- /dev/null
+++ b/editor/icons/icon_delete_split.svg
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg4"
+ sodipodi:docname="icon_delete_split.svg"
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="3066"
+ inkscape:window-height="1689"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="41.7193"
+ inkscape:cx="7.7924561"
+ inkscape:cy="6.0148972"
+ inkscape:window-x="134"
+ inkscape:window-y="55"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg4" />
+ <rect
+ style="fill:#800000"
+ id="rect12"
+ width="1.8456686"
+ height="2.0853658"
+ x="0.62321275"
+ y="6.9394455" />
+ <rect
+ style="fill:#800000"
+ id="rect14"
+ width="1.6299411"
+ height="1.9894869"
+ x="12.488225"
+ y="7.1791425" />
+ <rect
+ style="fill:#e9afaf"
+ id="rect37"
+ width="3.1640031"
+ height="0.40748528"
+ x="2.5407906"
+ y="7.9701433" />
+ <rect
+ style="fill:#e9afaf"
+ id="rect39"
+ width="3.5235491"
+ height="0.52733386"
+ x="9.0126152"
+ y="8.0420523" />
+ <rect
+ style="fill:#e9afaf"
+ id="rect41"
+ width="3.6433976"
+ height="0.4554247"
+ x="1.5110972"
+ y="-9.732645"
+ transform="rotate(123.99908)" />
+ <rect
+ style="fill:#e9afaf"
+ id="rect41-3"
+ width="3.6433976"
+ height="0.4554247"
+ x="0.072069742"
+ y="-12.144793"
+ transform="rotate(123.99908)" />
+</svg>
diff --git a/editor/icons/icon_edit_bezier.svg b/editor/icons/icon_edit_bezier.svg
new file mode 100644
index 0000000000..542ff52aac
--- /dev/null
+++ b/editor/icons/icon_edit_bezier.svg
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_edit_bezier.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1039"
+ inkscape:window-height="585"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="11.65471"
+ inkscape:cy="9.0988062"
+ inkscape:window-x="277"
+ inkscape:window-y="113"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g4">
+ <path
+ style="fill:none;stroke:#84c2ff;stroke-width:2.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ d="m 1.4758015,1050.3064 c 11.6492855,0.7191 3.1098343,-11.4976 12.2331255,-11.3475"
+ id="path4526"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <circle
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1"
+ id="path5846-3"
+ cy="1038.7133"
+ cx="13.470984"
+ r="1.8230016" />
+ <circle
+ r="1.8230016"
+ cx="2.4449117"
+ cy="1050.1708"
+ id="circle1374"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:5.64574671;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_editor_position.svg b/editor/icons/icon_editor_position.svg
new file mode 100644
index 0000000000..7657eb5160
--- /dev/null
+++ b/editor/icons/icon_editor_position.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m6 0v4.4199a4.2662 4.0576 0 0 0 -1.709 1.5801h-4.291v4h4.2949a4.2662 4.0576 0 0 0 1.7051 1.582v4.418h4v-4.4199a4.2662 4.0576 0 0 0 1.709 -1.5801h4.291v-4h-4.2949a4.2662 4.0576 0 0 0 -1.7051 -1.582v-4.418z" fill="#fff" fill-opacity=".70588"/>
+<path d="m7 1v3.0605a4.2662 4.0576 0 0 1 1 -0.11914 4.2662 4.0576 0 0 1 1 0.11914v-3.0605h-2zm1 4.0801a2.9201 2.9201 0 0 0 -2.9199 2.9199 2.9201 2.9201 0 0 0 2.9199 2.9199 2.9201 2.9201 0 0 0 2.9199 -2.9199 2.9201 2.9201 0 0 0 -2.9199 -2.9199zm-7 1.9199v2h2.8691a4.2662 4.0576 0 0 1 -0.13477 -1 4.2662 4.0576 0 0 1 0.13672 -1h-2.8711zm11.131 0a4.2662 4.0576 0 0 1 0.13477 1 4.2662 4.0576 0 0 1 -0.13672 1h2.8711v-2h-2.8691zm-5.1309 4.9395v3.0605h2v-3.0605a4.2662 4.0576 0 0 1 -1 0.11914 4.2662 4.0576 0 0 1 -1 -0.11914z" fill="#ff8484"/>
+</svg>
diff --git a/editor/icons/icon_editor_position_previous.svg b/editor/icons/icon_editor_position_previous.svg
new file mode 100644
index 0000000000..180156e13a
--- /dev/null
+++ b/editor/icons/icon_editor_position_previous.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m7 1v3.0605a4.2662 4.0576 0 0 1 1 -0.11914 4.2662 4.0576 0 0 1 1 0.11914v-3.0605h-2zm1 4.0801a2.9201 2.9201 0 0 0 -2.9199 2.9199 2.9201 2.9201 0 0 0 2.9199 2.9199 2.9201 2.9201 0 0 0 2.9199 -2.9199 2.9201 2.9201 0 0 0 -2.9199 -2.9199zm-7 1.9199v2h2.8691a4.2662 4.0576 0 0 1 -0.13477 -1 4.2662 4.0576 0 0 1 0.13672 -1h-2.8711zm11.131 0a4.2662 4.0576 0 0 1 0.13477 1 4.2662 4.0576 0 0 1 -0.13672 1h2.8711v-2h-2.8691zm-5.1309 4.9395v3.0605h2v-3.0605a4.2662 4.0576 0 0 1 -1 0.11914 4.2662 4.0576 0 0 1 -1 -0.11914z" fill="#69f" fill-opacity=".69804"/>
+</svg>
diff --git a/editor/icons/icon_editor_position_unselected.svg b/editor/icons/icon_editor_position_unselected.svg
new file mode 100644
index 0000000000..3c7d479b88
--- /dev/null
+++ b/editor/icons/icon_editor_position_unselected.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m6 0v4.4199a4.2662 4.0576 0 0 0 -1.709 1.5801h-4.291v4h4.2949a4.2662 4.0576 0 0 0 1.7051 1.582v4.418h4v-4.4199a4.2662 4.0576 0 0 0 1.709 -1.5801h4.291v-4h-4.2949a4.2662 4.0576 0 0 0 -1.7051 -1.582v-4.418h-4z" fill-opacity=".41077"/>
+<path d="m7 1v3.0605a4.2662 4.0576 0 0 1 1 -0.11914 4.2662 4.0576 0 0 1 1 0.11914v-3.0605h-2zm1 4.0801a2.9201 2.9201 0 0 0 -2.9199 2.9199 2.9201 2.9201 0 0 0 2.9199 2.9199 2.9201 2.9201 0 0 0 2.9199 -2.9199 2.9201 2.9201 0 0 0 -2.9199 -2.9199zm-7 1.9199v2h2.8691a4.2662 4.0576 0 0 1 -0.13477 -1 4.2662 4.0576 0 0 1 0.13672 -1h-2.8711zm11.131 0a4.2662 4.0576 0 0 1 0.13477 1 4.2662 4.0576 0 0 1 -0.13672 1h2.8711v-2h-2.8691zm-5.1309 4.9395v3.0605h2v-3.0605a4.2662 4.0576 0 0 1 -1 0.11914 4.2662 4.0576 0 0 1 -1 -0.11914z" fill="#d9d9d9"/>
+</svg>
diff --git a/editor/icons/icon_insert_after.svg b/editor/icons/icon_insert_after.svg
new file mode 100644
index 0000000000..4696a2fc22
--- /dev/null
+++ b/editor/icons/icon_insert_after.svg
@@ -0,0 +1,7 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<circle cx="4" cy="12" r="2" fill="none"/>
+<path d="m11.99 0.99023a1.0001 1.0001 0 0 0 -0.69726 1.7168l0.29297 0.29297h-2.5859v2h2.5859l-0.29297 0.29297a1.0001 1.0001 0 1 0 1.4141 1.4141l2-2a1.0001 1.0001 0 0 0 0 -1.4141l-2-2a1.0001 1.0001 0 0 0 -0.7168 -0.30273zm-8.9902 0.0097656c-1.108 0-2 0.892-2 2v2c0 1.108 0.892 2 2 2h2c1.108 0 2-0.892 2-2v-2c0-1.108-0.892-2-2-2h-2z" fill="#e0e0e0"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m11 9v2h-2v2h2v2h2v-2h2v-2h-2v-2z" fill="#84ffb1"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_insert_before.svg b/editor/icons/icon_insert_before.svg
new file mode 100644
index 0000000000..eb85144214
--- /dev/null
+++ b/editor/icons/icon_insert_before.svg
@@ -0,0 +1,7 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<circle cx="4" cy="12" r="2" fill="none"/>
+<path d="m4.0096 0.99023a1.0001 1.0001 0 0 1 0.69726 1.7168l-0.29297 0.29297h2.5859v2h-2.5859l0.29297 0.29297a1.0001 1.0001 0 1 1 -1.4141 1.4141l-2-2a1.0001 1.0001 0 0 1 0 -1.4141l2-2a1.0001 1.0001 0 0 1 0.7168 -0.30273zm8.9902 0.0097656c1.108 0 2 0.892 2 2v2c0 1.108-0.892 2-2 2h-2c-1.108 0-2-0.892-2-2v-2c0-1.108 0.892-2 2-2z" fill="#e0e0e0"/>
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m11 9v2h-2v2h2v2h2v-2h2v-2h-2v-2z" fill="#84ffb1"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_key_animation.svg b/editor/icons/icon_key_animation.svg
new file mode 100644
index 0000000000..a09567498f
--- /dev/null
+++ b/editor/icons/icon_key_animation.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_animation.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1852"
+ inkscape:window-height="781"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="-10.271186"
+ inkscape:cy="3.4149032"
+ inkscape:window-x="68"
+ inkscape:window-y="117"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#ea686c"
+ id="rect2"
+ style="fill:#b76ef0;fill-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_key_audio.svg b/editor/icons/icon_key_audio.svg
new file mode 100644
index 0000000000..7c728bfd01
--- /dev/null
+++ b/editor/icons/icon_key_audio.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_audio.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1053"
+ inkscape:window-height="591"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="4"
+ inkscape:cy="4"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#ea686c"
+ id="rect2"
+ style="fill:#eae668;fill-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_key_bezier.svg b/editor/icons/icon_key_bezier.svg
new file mode 100644
index 0000000000..62af6fdb34
--- /dev/null
+++ b/editor/icons/icon_key_bezier.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_bezier.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1852"
+ inkscape:window-height="781"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="-17.152542"
+ inkscape:cy="3.4149032"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#ea686c"
+ id="rect2"
+ style="fill:#5792f6;fill-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_key_bezier_handle.svg b/editor/icons/icon_key_bezier_handle.svg
new file mode 100644
index 0000000000..d7b22d0905
--- /dev/null
+++ b/editor/icons/icon_key_bezier_handle.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_bezier_handle.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1853"
+ inkscape:window-height="1016"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="59"
+ inkscape:cx="2.0952442"
+ inkscape:cy="4.6061633"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1"
+ d="M 3.9960938 -0.037109375 C 3.8010931 -0.037109375 3.6064535 0.038077731 3.4570312 0.1875 L 0.22070312 3.4238281 C -0.078134343 3.7226656 -0.078141414 4.2050617 0.22070312 4.5039062 L 3.4570312 7.7402344 C 3.7558687 8.0390718 4.2382719 8.0390718 4.5371094 7.7402344 L 7.7734375 4.5039062 C 8.072282 4.2050617 8.072275 3.7226656 7.7734375 3.4238281 L 4.5371094 0.1875 C 4.3876871 0.038077731 4.1910944 -0.037109375 3.9960938 -0.037109375 z M 4.0253906 0.81445312 C 4.1770098 0.81445312 4.3291322 0.87241756 4.4453125 0.98828125 L 6.9609375 3.4960938 C 7.193298 3.7278211 7.193298 4.102257 6.9609375 4.3339844 L 4.4453125 6.84375 C 4.212952 7.0754774 3.8378293 7.0754774 3.6054688 6.84375 L 1.0898438 4.3339844 C 0.85748323 4.102257 0.85748323 3.7278211 1.0898438 3.4960938 L 3.6054688 0.98828125 C 3.721649 0.87241756 3.8737714 0.81445312 4.0253906 0.81445312 z "
+ transform="translate(0,1044.4)"
+ id="rect2" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_key_bezier_point.svg b/editor/icons/icon_key_bezier_point.svg
new file mode 100644
index 0000000000..aa33063c95
--- /dev/null
+++ b/editor/icons/icon_key_bezier_point.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_bezier_point.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="836"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="4"
+ inkscape:cy="4"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#e0e0e0"
+ id="rect2" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_key_bezier_selected.svg b/editor/icons/icon_key_bezier_selected.svg
new file mode 100644
index 0000000000..e3f967707a
--- /dev/null
+++ b/editor/icons/icon_key_bezier_selected.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_bezier_selected.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="836"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="4"
+ inkscape:cy="4"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#84c2ff"
+ id="rect2" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_key_call.svg b/editor/icons/icon_key_call.svg
index 7fcc65801a..e702898288 100644
--- a/editor/icons/icon_key_call.svg
+++ b/editor/icons/icon_key_call.svg
@@ -1,5 +1,64 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#adf18f"/>
-</g>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_call.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="836"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="4"
+ inkscape:cy="4"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#adf18f"
+ id="rect2"
+ style="fill:#66f376;fill-opacity:1" />
+ </g>
</svg>
diff --git a/editor/icons/icon_key_selected.svg b/editor/icons/icon_key_selected.svg
index c73d31981d..2842fd93eb 100644
--- a/editor/icons/icon_key_selected.svg
+++ b/editor/icons/icon_key_selected.svg
@@ -1,5 +1,76 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#84c2ff"/>
-</g>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_selected.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1568"
+ inkscape:window-height="767"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="41.7193"
+ inkscape:cx="-0.48848775"
+ inkscape:cy="3.5639274"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4-3" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#84c2ff"
+ id="rect2" />
+ </g>
+ <g
+ transform="translate(0,-1044.4)"
+ id="g4-3">
+ <rect
+ style="fill:#003e7a;fill-opacity:1;stroke-width:0.56281364"
+ transform="matrix(0.71728847,-0.69677633,0.71728847,0.69677633,0,0)"
+ x="-751.20953"
+ y="753.42743"
+ width="3.4346831"
+ height="3.4346831"
+ ry="0.42934799"
+ id="rect2-6" />
+ </g>
</svg>
diff --git a/editor/icons/icon_key_valid.svg b/editor/icons/icon_key_valid.svg
new file mode 100644
index 0000000000..4a3fab4754
--- /dev/null
+++ b/editor/icons/icon_key_valid.svg
@@ -0,0 +1,5 @@
+<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1044.4)">
+<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#fff"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_key_xform.svg b/editor/icons/icon_key_xform.svg
index 7b73715771..fd22b67f52 100644
--- a/editor/icons/icon_key_xform.svg
+++ b/editor/icons/icon_key_xform.svg
@@ -1,5 +1,64 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#ea686c"/>
-</g>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ version="1.1"
+ viewBox="0 0 8 8"
+ id="svg6"
+ sodipodi:docname="icon_key_xform.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="836"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="4"
+ inkscape:cy="4"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1044.4)"
+ id="g4">
+ <rect
+ transform="rotate(-45)"
+ x="-741.53"
+ y="741.08"
+ width="6.1027"
+ height="6.1027"
+ ry=".76286"
+ fill="#ea686c"
+ id="rect2"
+ style="fill:#ea9568;fill-opacity:1" />
+ </g>
</svg>
diff --git a/editor/icons/icon_move_down.svg b/editor/icons/icon_move_down.svg
index 466fa10205..70c5abf9e8 100644
--- a/editor/icons/icon_move_down.svg
+++ b/editor/icons/icon_move_down.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path d="m7.9964 1051.4a1.0002 1.0001 0 0 1 -0.77738 -0.377l-4.0002-5a1.0001 1 0 0 1 0.15626 -1.4043 1.0001 1 0 0 1 1.4063 0.1563l2.2189 2.7734v-5.1484a1.0001 1 0 0 1 1.0001 -1 1.0001 1 0 0 1 1.0001 1v5.1484l2.2189-2.7734a1.0001 1 0 0 1 1.4063 -0.1563 1.0001 1 0 0 1 0.15626 1.4043l-4.0002 5a1.0002 1.0001 0 0 1 -0.7852 0.377zm0.00391-12a1.0001 1 0 0 1 -1.0001 -1 1.0001 1 0 0 1 1.0001 -1 1.0001 1 0 0 1 1.0001 1 1.0001 1 0 0 1 -1.0001 1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".99608" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
-</g>
+<path d="m6 1a1.0001 1.0001 0 1 0 0 2h4a1.0001 1.0001 0 1 0 0 -2zm2 4c-0.55231 0-1 0.4477-1 1v5.1484l-2.2188-2.7734c-0.34504-0.4317-0.97482-0.50165-1.4062-0.15625-0.4305 0.3449-0.5004 0.9732-0.15625 1.4043l4 5c0.18868 0.2369 0.4745 0.37695 0.77734 0.37695 0.30559 9e-4 0.59477-0.13795 0.78516-0.37695l4-5c0.34415-0.4311 0.27424-1.0594-0.15625-1.4043-0.43143-0.3454-1.0612-0.27545-1.4062 0.15625l-2.2188 2.7734v-5.1484c0-0.5523-0.44769-1-1-1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".99608" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</svg>
diff --git a/editor/icons/icon_move_left.svg b/editor/icons/icon_move_left.svg
new file mode 100644
index 0000000000..bab817bfdf
--- /dev/null
+++ b/editor/icons/icon_move_left.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m15 10a1.0001 1.0001 0 1 1 -2 0v-4a1.0001 1.0001 0 1 1 2 0zm-4-2c0 0.55231-0.4477 1-1 1h-5.1484l2.7734 2.2188c0.4317 0.34504 0.50165 0.97482 0.15625 1.4062-0.3449 0.4305-0.9732 0.5004-1.4043 0.15625l-5-4c-0.2369-0.18868-0.37695-0.4745-0.37695-0.77734-9e-4 -0.30559 0.13795-0.59477 0.37695-0.78516l5-4c0.4311-0.34415 1.0594-0.27424 1.4043 0.15625 0.3454 0.43143 0.27545 1.0612-0.15625 1.4062l-2.7734 2.2188h5.1484c0.5523 0 1 0.44769 1 1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".99608" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+</svg>
diff --git a/editor/icons/icon_move_right.svg b/editor/icons/icon_move_right.svg
new file mode 100644
index 0000000000..7721633de5
--- /dev/null
+++ b/editor/icons/icon_move_right.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<path d="m1 10a1.0001 1.0001 0 1 0 2 0v-4a1.0001 1.0001 0 1 0 -2 0zm4-2c0 0.55231 0.4477 1 1 1h5.1484l-2.7734 2.2188c-0.4317 0.34504-0.50165 0.97482-0.15625 1.4062 0.3449 0.4305 0.9732 0.5004 1.4043 0.15625l5-4c0.2369-0.18868 0.37695-0.4745 0.37695-0.77734 9e-4 -0.30559-0.13795-0.59477-0.37695-0.78516l-5-4c-0.4311-0.34415-1.0594-0.27424-1.4043 0.15625-0.3454 0.43143-0.27545 1.0612 0.15625 1.4062l2.7734 2.2188h-5.1484c-0.5523 0-1 0.44769-1 1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".99608" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
+</svg>
diff --git a/editor/icons/icon_move_up.svg b/editor/icons/icon_move_up.svg
index 6e148216d2..06bb26fad3 100644
--- a/editor/icons/icon_move_up.svg
+++ b/editor/icons/icon_move_up.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path d="m7.9964 1037.4a1.0002 1.0001 0 0 0 -0.77739 0.377l-4.0002 5a1.0001 1 0 0 0 0.15626 1.4043 1.0001 1 0 0 0 1.4063 -0.1563l2.2189-2.7734v5.1484a1.0001 1 0 0 0 1.0001 1 1.0001 1 0 0 0 1.0001 -1v-5.1484l2.2189 2.7734a1.0001 1 0 0 0 1.4063 0.1563 1.0001 1 0 0 0 0.15626 -1.4043l-4.0002-5a1.0002 1.0001 0 0 0 -0.7852 -0.377zm0.00391 12a1.0001 1 0 0 0 -1.0001 1 1.0001 1 0 0 0 1.0001 1 1.0001 1 0 0 0 1.0001 -1 1.0001 1 0 0 0 -1.0001 -1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".99608" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
-</g>
+<path d="m6 15a1.0001 1.0001 0 1 1 0 -2h4a1.0001 1.0001 0 1 1 0 2zm2-4c-0.55231 0-1-0.4477-1-1v-5.1484l-2.2188 2.7734c-0.34504 0.4317-0.97482 0.50165-1.4062 0.15625-0.4305-0.3449-0.5004-0.9732-0.15625-1.4043l4-5c0.18868-0.2369 0.4745-0.37695 0.77734-0.37695 0.30559-9e-4 0.59477 0.13795 0.78516 0.37695l4 5c0.34415 0.4311 0.27424 1.0594-0.15625 1.4043-0.43143 0.3454-1.0612 0.27545-1.4062-0.15625l-2.2188-2.7734v5.1484c0 0.5523-0.44769 1-1 1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".99608" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</svg>
diff --git a/editor/icons/icon_oriented_path_follow.svg b/editor/icons/icon_oriented_path_follow.svg
new file mode 100644
index 0000000000..bd3f585e54
--- /dev/null
+++ b/editor/icons/icon_oriented_path_follow.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m13 0l-3 4h1.9473c-0.1385 1.3203-0.5583 1.9074-1.084 2.2754-0.64426 0.451-1.7129 0.60547-2.9629 0.73047s-2.6814 0.22053-3.9121 1.082c-0.89278 0.62493-1.5321 1.6522-1.8184 3.0957a2 2 0 0 0 -1.1699 1.8164 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -0.84961 -1.6328c0.19235-0.88496 0.55306-1.3373 0.98633-1.6406 0.64426-0.451 1.7129-0.60547 2.9629-0.73047s2.6814-0.22053 3.9121-1.082c1.0528-0.73697 1.7552-2.032 1.9375-3.9141h2.0508l-3-4z" fill="#fc9c9c" fill-opacity=".99608"/>
+</g>
+</svg>
diff --git a/editor/icons/icon_paint_vertex.svg b/editor/icons/icon_paint_vertex.svg
new file mode 100644
index 0000000000..b53e005dae
--- /dev/null
+++ b/editor/icons/icon_paint_vertex.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg4"
+ sodipodi:docname="icon_paint_vertex.svg"
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="3066"
+ inkscape:window-height="1689"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="134"
+ inkscape:window-y="55"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg4" />
+ <ellipse
+ style="fill:#ffffff"
+ id="path12"
+ cx="8.3728809"
+ cy="8.1694918"
+ rx="6.6779661"
+ ry="6.0677967" />
+</svg>
diff --git a/editor/icons/icon_panel.svg b/editor/icons/icon_panel.svg
index aebf885e7c..7bd3db7c09 100644
--- a/editor/icons/icon_panel.svg
+++ b/editor/icons/icon_panel.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3 1c-1.1046 0-2 0.89543-2 2v10c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.89543 2-2v-10c0-1.1046-0.89543-2-2-2z" fill="#a5efac"/>
-</g>
+<path d="m3 1c-1.1046 0-2 0.89543-2 2v10c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.89543 2-2v-10c0-1.1046-0.89543-2-2-2z" fill="#a5efac"/>
</svg>
diff --git a/editor/icons/icon_panel_container.svg b/editor/icons/icon_panel_container.svg
index a52493b665..df8a2c0a0e 100644
--- a/editor/icons/icon_panel_container.svg
+++ b/editor/icons/icon_panel_container.svg
@@ -1,5 +1,3 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m3 1c-1.1046 0-2 0.89543-2 2v10c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.89543 2-2v-10c0-1.1046-0.89543-2-2-2zm0 2h10v10h-10z" fill="#a5efac"/>
-</g>
+<path d="m3 1c-1.1046 0-2 0.89543-2 2v10c0 1.1046 0.89543 2 2 2h10c1.1046 0 2-0.89543 2-2v-10c0-1.1046-0.89543-2-2-2zm0 2h10v10h-10z" fill="#a5efac"/>
</svg>
diff --git a/editor/icons/icon_physical_bone.svg b/editor/icons/icon_physical_bone.svg
new file mode 100644
index 0000000000..2efcab3e20
--- /dev/null
+++ b/editor/icons/icon_physical_bone.svg
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg2"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icon_physical_bone.svg">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1027"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="16"
+ inkscape:cx="14.674088"
+ inkscape:cy="7.3239349"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" />
+ <g
+ id="g4505"
+ transform="translate(-2.5625,-18.4375)">
+ <path
+ inkscape:connector-curvature="0"
+ id="path6-9-8"
+ d="m 13.107422,19.382812 a 2.4664,2.4663 0 0 0 -1.78125,0.720704 2.4664,2.4663 0 0 0 -0.185547,0.21289 L 12.472656,22.75 10.867187,23.353516 7.453125,26.767578 a 2.4664,2.4663 0 0 0 -3.1015625,0.3125 2.4664,2.4663 0 0 0 0,3.488281 2.4664,2.4663 0 0 0 1.3964844,0.695313 2.4664,2.4663 0 0 0 0.6953125,1.396484 2.4664,2.4663 0 0 0 3.4882812,0 2.4664,2.4663 0 0 0 0.3144534,-3.103515 l 3.560547,-3.560547 a 2.4664,2.4663 0 0 0 3.099609,-0.310547 2.4664,2.4663 0 0 0 0,-3.488281 A 2.4664,2.4663 0 0 0 15.509766,21.5 2.4664,2.4663 0 0 0 14.814453,20.103516 2.4664,2.4663 0 0 0 13.107422,19.382812 Z"
+ style="fill:#fc9c9c" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="rect4140-5-1-4-3-7-9-03"
+ d="m 3.7211033,21.208326 0.9608286,4.82644 1.3962404,-0.524494 z"
+ style="opacity:1;fill:#fc9c9c;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.42799997;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="rect4140-5-1-4-3-7-9-5-3"
+ d="m 6.4843278,19.465234 0.9608285,4.82644 1.3962404,-0.524494 z"
+ style="opacity:1;fill:#fc9c9c;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.42799997;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="rect4140-5-1-4-3-7-9-5-3-8"
+ d="m 9.6964655,19.33678 0.7108285,3.51394 1.39624,-0.524494 z"
+ style="opacity:1;fill:#fc9c9c;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.42799997;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/icons/icon_play_overlay.svg b/editor/icons/icon_play_overlay.svg
new file mode 100644
index 0000000000..eff33f1b6b
--- /dev/null
+++ b/editor/icons/icon_play_overlay.svg
@@ -0,0 +1,4 @@
+<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
+ <rect x="0" y="0" width="64" height="64" rx="5" ry="5" fill="#044B94" fill-opacity="0.6"/>
+ <path d="M16 16 L48 32 L16 48" fill="#f2f2f2"/>
+</svg> \ No newline at end of file
diff --git a/editor/icons/icon_play_travel.svg b/editor/icons/icon_play_travel.svg
new file mode 100644
index 0000000000..5cd3e07e20
--- /dev/null
+++ b/editor/icons/icon_play_travel.svg
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_play_travel.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1446"
+ inkscape:window-height="646"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8.2818541"
+ inkscape:cy="5.7694884"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="matrix(0.59321602,0,0,0.59321602,-1.2203136,-611.14809)"
+ id="g6">
+ <g
+ id="g4">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <g
+ transform="matrix(0.59321602,0,0,0.59321602,7.5254716,-610.94451)"
+ id="g6-3">
+ <g
+ id="g4-6">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2-7"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1"
+ id="rect842"
+ width="9.5593224"
+ height="0.54237264"
+ x="3.0058463"
+ y="8.1280737"
+ ry="0.27118632" />
+</svg>
diff --git a/editor/icons/icon_time.svg b/editor/icons/icon_time.svg
new file mode 100644
index 0000000000..d50c9570b3
--- /dev/null
+++ b/editor/icons/icon_time.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg6"
+ sodipodi:docname="icon_time.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="836"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="7.375"
+ inkscape:cx="4.4999435"
+ inkscape:cy="13.04848"
+ inkscape:window-x="744"
+ inkscape:window-y="280"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g4">
+ <g
+ id="g8"
+ style="fill:#e0e0e0;fill-opacity:1"
+ transform="matrix(0.0279396,0,0,0.02755726,0.91401567,1037.1343)">
+ <g
+ id="g6"
+ style="fill:#e0e0e0;fill-opacity:1">
+ <path
+ d="M 276.193,58.507 V 40.389 h 14.578 c 11.153,0 20.194,-9.042 20.194,-20.194 C 310.965,9.043 301.923,0 290.771,0 h -69.544 c -11.153,0 -20.194,9.042 -20.194,20.194 0,11.152 9.042,20.194 20.194,20.194 h 14.578 V 58.506 C 119.952,68.76 28.799,166.327 28.799,284.799 28.799,410.078 130.721,512 256,512 381.279,512 483.201,410.078 483.201,284.799 483.2,166.327 392.046,68.76 276.193,58.507 Z m 0,412.009 v -20.124 c 0,-11.153 -9.042,-20.194 -20.194,-20.194 -11.153,0 -20.194,9.042 -20.194,20.194 v 20.124 C 148.895,461.131 79.668,391.902 70.283,304.994 h 20.124 c 11.153,0 20.194,-9.042 20.194,-20.194 0,-11.152 -9.042,-20.194 -20.194,-20.194 H 70.282 c 9.385,-86.91 78.614,-156.137 165.522,-165.523 v 20.124 c 0,11.153 9.042,20.194 20.194,20.194 11.153,0 20.194,-9.042 20.194,-20.194 V 99.081 c 86.91,9.385 156.137,78.614 165.522,165.523 H 421.59 c -11.153,0 -20.194,9.042 -20.194,20.194 0,11.152 9.042,20.194 20.194,20.194 h 20.126 c -9.385,86.911 -78.613,156.14 -165.523,165.524 z"
+ id="path2"
+ style="fill:#e0e0e0;fill-opacity:1"
+ inkscape:connector-curvature="0" />
+ <path
+ d="m 317.248,194.99 -58.179,58.18 c -1.011,-0.097 -2.034,-0.151 -3.071,-0.151 -17.552,0 -31.779,14.229 -31.779,31.779 0,17.552 14.228,31.779 31.779,31.779 17.551,0 31.779,-14.229 31.779,-31.779 0,-1.037 -0.054,-2.06 -0.151,-3.07 l 58.178,-58.18 c 7.887,-7.885 7.887,-20.672 0,-28.559 -7.882,-7.886 -20.669,-7.886 -28.556,0.001 z"
+ id="path4"
+ style="fill:#e0e0e0;fill-opacity:1"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_tool_add_node.svg b/editor/icons/icon_tool_add_node.svg
new file mode 100644
index 0000000000..a4ff4d08a0
--- /dev/null
+++ b/editor/icons/icon_tool_add_node.svg
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_tool_add_node.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1516"
+ inkscape:window-height="747"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g6">
+ <g
+ transform="translate(-26.001 -9.8683)"
+ id="g4">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1"
+ d="m 27.917081,1047.5557 c -0.422624,0 -0.763672,0.3411 -0.763672,0.7637 v 11.8301 c 0,0.4226 0.341048,0.7637 0.763672,0.7637 h 12.507813 c 0.422624,0 0.761719,-0.3411 0.761719,-0.7637 v -11.8301 c 0,-0.4226 -0.339095,-0.7637 -0.761719,-0.7637 z m 1.898438,1.6954 h 8.642578 c 0.422624,0 0.763672,0.341 0.763672,0.7636 v 8.5078 c 0,0.4227 -0.341048,0.7618 -0.763672,0.7618 h -8.642578 c -0.422625,0 -0.763672,-0.3391 -0.763672,-0.7618 v -8.5078 c 0,-0.4226 0.341047,-0.7636 0.763672,-0.7636 z"
+ id="rect821"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1"
+ id="rect826"
+ width="7.7966104"
+ height="2.3728814"
+ x="30.20439"
+ y="1052.9802"
+ ry="0.76286" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke-width:0.88253576"
+ id="rect828"
+ width="2.3728814"
+ height="7.5254235"
+ x="32.916256"
+ y="1050.3361"
+ ry="0.72997814" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_tool_connect.svg b/editor/icons/icon_tool_connect.svg
new file mode 100644
index 0000000000..91d5893163
--- /dev/null
+++ b/editor/icons/icon_tool_connect.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_tool_connect.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1516"
+ inkscape:window-height="747"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="3.6875"
+ inkscape:cx="8.5909556"
+ inkscape:cy="7.8012075"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g6">
+ <g
+ transform="translate(-26.001 -9.8683)"
+ id="g4">
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1"
+ id="rect849"
+ width="14.305085"
+ height="2.1694915"
+ x="26.766621"
+ y="1053.1389"
+ ry="0.76286" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:1.16725671px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 30.596131,1046.927 v 14.8861 l 8.228847,-7.5722 z"
+ id="path853"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_tool_triangle.svg b/editor/icons/icon_tool_triangle.svg
new file mode 100644
index 0000000000..5696008767
--- /dev/null
+++ b/editor/icons/icon_tool_triangle.svg
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_tool_triangle.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1204"
+ inkscape:window-height="703"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="8.0650451"
+ inkscape:cy="7.0341257"
+ inkscape:window-x="542"
+ inkscape:window-y="205"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(0 -1036.4)"
+ id="g6">
+ <g
+ transform="translate(-26.001 -9.8683)"
+ id="g4">
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 27.695915,1056.3022 c 0,0 7.457627,-8.0678 7.118644,-7.8644 -0.338983,0.2034 5.830509,11.7288 5.830509,11.7288 z"
+ id="path821"
+ inkscape:connector-curvature="0" />
+ <circle
+ style="fill:#4b4b4b;fill-opacity:1;stroke:#e0e0e0;stroke-width:0.51200002;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path825"
+ cx="34.662014"
+ cy="1048.5903"
+ r="1.607564" />
+ <circle
+ style="fill:#4b4b4b;fill-opacity:1;stroke:#e0e0e0;stroke-width:0.51200002;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path825-3"
+ cx="39.933205"
+ cy="1059.6581"
+ r="1.607564" />
+ <circle
+ style="fill:#4b4b4b;fill-opacity:1;stroke:#e0e0e0;stroke-width:0.51200002;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path825-3-6"
+ cx="28.17049"
+ cy="1056.2683"
+ r="1.607564" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_track_capture.svg b/editor/icons/icon_track_capture.svg
new file mode 100644
index 0000000000..da6a662746
--- /dev/null
+++ b/editor/icons/icon_track_capture.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="8"
+ version="1.1"
+ viewBox="0 0 16 8"
+ id="svg6"
+ sodipodi:docname="icon_track_capture.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata12">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs10" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1350"
+ inkscape:window-height="593"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="27.577164"
+ inkscape:cx="8.347146"
+ inkscape:cy="4.4012076"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg6" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1"
+ d="m 2.1665128,0.99764963 c -0.422625,0 -0.763672,0.34104737 -0.763672,0.76367187 v 4.5742187 c 0,0.4226242 0.341047,0.7617192 0.763672,0.7617192 h 4.472656 c 0.422625,0 0.763672,-0.339095 0.763672,-0.7617192 V 5.347259 h -3.300781 c -0.1662,0 -0.298828,-0.3390943 -0.298828,-0.7617188 V 3.3609308 c 0,-0.4226244 0.132628,-0.7636718 0.298828,-0.7636718 h 3.300781 V 1.7613215 c 0,-0.4226245 -0.341047,-0.76367187 -0.763672,-0.76367187 z"
+ id="rect1389"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:#e0e0e0;stroke-width:0.80299997;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 9.1827441,4.7953408 C 9.6993662,3.7537783 10.278269,2.5835979 10.469195,2.1949398 l 0.347137,-0.7066511 0.679654,0.00665 0.679654,0.00665 0.956945,2.3125 c 0.526319,1.271875 1.007254,2.4334375 1.068744,2.5812497 l 0.1118,0.26875 H 13.715914 13.1187 L 12.785851,6.0203387 12.453002,5.3765887 H 11.319176 10.185351 L 9.8066761,6.032702 9.4280014,6.6888154 l -0.5922856,1.37e-4 -0.592285,1.36e-4 z m 3.1779349,-0.369483 c 0.0042,-0.00346 -0.233487,-0.4884588 -0.528245,-1.0777779 l -0.535922,-1.0714891 -0.03691,0.0875 c -0.0203,0.048125 -0.183516,0.425 -0.362699,0.8375 -0.179182,0.4125 -0.355738,0.85125 -0.392346,0.975 -0.03661,0.12375 -0.07127,0.2390723 -0.07703,0.2562715 -0.0083,0.024853 0.188215,0.027989 0.957503,0.015278 0.532385,-0.0088 0.971429,-0.018823 0.975651,-0.022283 z"
+ id="path1424"
+ inkscape:connector-curvature="0" />
+</svg>
diff --git a/editor/icons/icon_transition_end.svg b/editor/icons/icon_transition_end.svg
new file mode 100644
index 0000000000..8a1937670a
--- /dev/null
+++ b/editor/icons/icon_transition_end.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_transition_end.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="10.204146"
+ inkscape:cy="5.3391396"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="translate(-2,-1036.4)"
+ id="g6">
+ <g
+ id="g4">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east_asian:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1"
+ id="rect862"
+ width="3.0681243"
+ height="10.067283"
+ x="11.16989"
+ y="3.0084109"
+ ry="0.76286" />
+</svg>
diff --git a/editor/icons/icon_transition_end_auto.svg b/editor/icons/icon_transition_end_auto.svg
new file mode 100644
index 0000000000..18927bc4ef
--- /dev/null
+++ b/editor/icons/icon_transition_end_auto.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_transition_automatic.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="0.56831798"
+ inkscape:cy="5.1473818"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="translate(-2,-1036.4)"
+ id="g6"
+ style="fill:#77ce57;fill-opacity:1">
+ <g
+ id="g4"
+ style="fill:#77ce57;fill-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east_asian:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#77ce57;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto;fill-opacity:1"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#77ce57;fill-opacity:1"
+ id="rect862"
+ width="3.0681243"
+ height="10.067283"
+ x="11.16989"
+ y="3.0084109"
+ ry="0.76286" />
+</svg>
diff --git a/editor/icons/icon_transition_end_auto_big.svg b/editor/icons/icon_transition_end_auto_big.svg
new file mode 100644
index 0000000000..aaedafaf04
--- /dev/null
+++ b/editor/icons/icon_transition_end_auto_big.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ version="1.1"
+ viewBox="0 0 20 20"
+ id="svg8"
+ sodipodi:docname="icon_transition_automatic_big.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="0.3064671"
+ inkscape:cy="14.348448"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="matrix(1.4099529,0,0,1.4099529,-4.1975887,-1462.5094)"
+ id="g6"
+ style="fill:#77ce57;fill-opacity:1;stroke:#41562e;stroke-opacity:1">
+ <g
+ id="g4"
+ style="fill:#77ce57;fill-opacity:1;stroke:#41562e;stroke-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#77ce57;fill-opacity:1;fill-rule:evenodd;stroke:#41562e;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#77ce57;fill-opacity:1;stroke:#41562e;stroke-width:1.409953;stroke-opacity:1"
+ id="rect862"
+ width="4.3259106"
+ height="14.194397"
+ x="14.371336"
+ y="3.0076122"
+ ry="1.0755967" />
+</svg>
diff --git a/editor/icons/icon_transition_end_big.svg b/editor/icons/icon_transition_end_big.svg
new file mode 100644
index 0000000000..46d42e95e3
--- /dev/null
+++ b/editor/icons/icon_transition_end_big.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ version="1.1"
+ viewBox="0 0 20 20"
+ id="svg8"
+ sodipodi:docname="icon_transition_end_big.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="-1.1122019"
+ inkscape:cy="10.839132"
+ inkscape:window-x="517"
+ inkscape:window-y="261"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="matrix(1.4203458,0,0,1.4203458,-4.29479,-1473.1325)"
+ id="g6"
+ style="stroke:#424242;stroke-width:0.99994373;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
+ <g
+ id="g4"
+ style="stroke:#424242;stroke-width:0.99994373;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;stroke:#424242;stroke-width:0.99994373;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:#424242;stroke-width:1.42026603;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect862"
+ width="4.3577976"
+ height="14.299023"
+ x="14.411009"
+ y="3.1868868"
+ ry="1.0835251" />
+</svg>
diff --git a/editor/icons/icon_transition_immediate.svg b/editor/icons/icon_transition_immediate.svg
new file mode 100644
index 0000000000..ba16a33c91
--- /dev/null
+++ b/editor/icons/icon_transition_immediate.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_transition_immediate.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="4.0199579"
+ inkscape:cy="5.3391396"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(-2,-1036.4)"
+ id="g6">
+ <g
+ id="g4">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east_asian:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto;fill-opacity:1"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_transition_immediate_auto.svg b/editor/icons/icon_transition_immediate_auto.svg
new file mode 100644
index 0000000000..c127560145
--- /dev/null
+++ b/editor/icons/icon_transition_immediate_auto.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_transition_immediate_auto.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="-9.2592678"
+ inkscape:cy="5.3391396"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="translate(-2,-1036.4)"
+ id="g6">
+ <g
+ id="g4">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east_asian:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#77ce57;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto;fill-opacity:1"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_transition_immediate_auto_big.svg b/editor/icons/icon_transition_immediate_auto_big.svg
new file mode 100644
index 0000000000..80d35a36f3
--- /dev/null
+++ b/editor/icons/icon_transition_immediate_auto_big.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ version="1.1"
+ viewBox="0 0 20 20"
+ id="svg8"
+ sodipodi:docname="icon_transition_immediate_auto_big.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="11.321237"
+ inkscape:cy="3.5752171"
+ inkscape:window-x="517"
+ inkscape:window-y="261"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="matrix(1.571031,0,0,1.571031,-2.7257681,-1630.6239)"
+ id="g6"
+ style="stroke:#404040;stroke-opacity:1">
+ <g
+ id="g4"
+ style="stroke:#404040;stroke-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#77ce57;fill-rule:evenodd;stroke:#41562e;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;fill-opacity:1"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_transition_immediate_big.svg b/editor/icons/icon_transition_immediate_big.svg
new file mode 100644
index 0000000000..108dcdd500
--- /dev/null
+++ b/editor/icons/icon_transition_immediate_big.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ version="1.1"
+ viewBox="0 0 20 20"
+ id="svg8"
+ sodipodi:docname="icon_transition_immediate_big.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="0.19928629"
+ inkscape:cy="4.534006"
+ inkscape:window-x="517"
+ inkscape:window-y="261"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g4" />
+ <g
+ transform="matrix(1.571031,0,0,1.571031,-2.7257681,-1630.6239)"
+ id="g6"
+ style="stroke:#404040;stroke-opacity:1">
+ <g
+ id="g4"
+ style="stroke:#404040;stroke-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;stroke:#404040;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;fill-opacity:1"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/icon_transition_sync.svg b/editor/icons/icon_transition_sync.svg
new file mode 100644
index 0000000000..267d806615
--- /dev/null
+++ b/editor/icons/icon_transition_sync.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_transition_sync.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="10.204146"
+ inkscape:cy="5.3391396"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="translate(2.5542471,-1036.4)"
+ id="g6">
+ <g
+ id="g4">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1"
+ id="rect862"
+ width="3.0681243"
+ height="10.067283"
+ x="1.9655174"
+ y="3.0084109"
+ ry="0.76286" />
+</svg>
diff --git a/editor/icons/icon_transition_sync_auto.svg b/editor/icons/icon_transition_sync_auto.svg
new file mode 100644
index 0000000000..5ce61e3a6a
--- /dev/null
+++ b/editor/icons/icon_transition_sync_auto.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg8"
+ sodipodi:docname="icon_transition_sync_auto.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="20.85965"
+ inkscape:cx="0.56831798"
+ inkscape:cy="5.1473818"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="translate(3.0815809,-1036.4)"
+ id="g6"
+ style="fill:#77ce57;fill-opacity:1">
+ <g
+ id="g4"
+ style="fill:#77ce57;fill-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#77ce57;fill-opacity:1;fill-rule:evenodd;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#77ce57;fill-opacity:1"
+ id="rect862"
+ width="3.0681243"
+ height="10.067283"
+ x="1.9655174"
+ y="3.0084109"
+ ry="0.76286" />
+</svg>
diff --git a/editor/icons/icon_transition_sync_auto_big.svg b/editor/icons/icon_transition_sync_auto_big.svg
new file mode 100644
index 0000000000..3e84d76398
--- /dev/null
+++ b/editor/icons/icon_transition_sync_auto_big.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ version="1.1"
+ viewBox="0 0 20 20"
+ id="svg8"
+ sodipodi:docname="icon_transition_sync_auto_big.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="0.3064671"
+ inkscape:cy="14.348448"
+ inkscape:window-x="67"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="matrix(1.4099529,0,0,1.4099529,2.1752927,-1462.5094)"
+ id="g6"
+ style="fill:#77ce57;fill-opacity:1;stroke:#41562e;stroke-opacity:1">
+ <g
+ id="g4"
+ style="fill:#77ce57;fill-opacity:1;stroke:#41562e;stroke-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#77ce57;fill-opacity:1;fill-rule:evenodd;stroke:#41562e;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#77ce57;fill-opacity:1;stroke:#41562e;stroke-width:1.409953;stroke-opacity:1"
+ id="rect862"
+ width="4.3259106"
+ height="14.194397"
+ x="1.6255733"
+ y="3.0076122"
+ ry="1.0755967" />
+</svg>
diff --git a/editor/icons/icon_transition_sync_big.svg b/editor/icons/icon_transition_sync_big.svg
new file mode 100644
index 0000000000..e7cf63e0b3
--- /dev/null
+++ b/editor/icons/icon_transition_sync_big.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ version="1.1"
+ viewBox="0 0 20 20"
+ id="svg8"
+ sodipodi:docname="icon_transition_sync_big.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata14">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs12" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1403"
+ inkscape:window-height="782"
+ id="namedview10"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="19.226781"
+ inkscape:cy="9.27981"
+ inkscape:window-x="302"
+ inkscape:window-y="226"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg8" />
+ <g
+ transform="matrix(1.4203458,0,0,1.4203458,1.8747015,-1473.1325)"
+ id="g6"
+ style="stroke:#424242;stroke-width:0.99994373;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
+ <g
+ id="g4"
+ style="stroke:#424242;stroke-width:0.99994373;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
+ <path
+ d="m 4.9883,1039.4 c -0.5469,0.01 -0.98717,0.4511 -0.98828,0.998 v 8 c 1.163e-4,0.7986 0.89011,1.275 1.5547,0.8321 l 6,-4 c 0.59362,-0.3959 0.59362,-1.2682 0,-1.6641 l -6,-4 c -0.1678,-0.1111 -0.3652,-0.1689 -0.56641,-0.166 z"
+ dominant-baseline="auto"
+ style="color:#000000;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;dominant-baseline:auto;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000000;fill:#e0e0e0;fill-rule:evenodd;stroke:#424242;stroke-width:0.99994373;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto"
+ id="path2"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:#424242;stroke-width:1.42026603;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect862"
+ width="4.3577976"
+ height="14.299023"
+ x="1.4618562"
+ y="3.1868868"
+ ry="1.0835251" />
+</svg>
diff --git a/editor/icons/icon_translation.svg b/editor/icons/icon_translation.svg
index 81abe5070e..fa6d7e1ff2 100644
--- a/editor/icons/icon_translation.svg
+++ b/editor/icons/icon_translation.svg
@@ -1,5 +1,5 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m2 1v14h10a2 2 0 0 0 2 -2v-10a2 2 0 0 0 -2 -2v5 2l-2-2-2 2v-2-5h-6z" fill="#e0e0e0"/>
+<path transform="translate(0 1036.4)" d="m4 1c-1.645 0-3 1.355-3 3s1.355 3 3 3c0.46079 0 0.89328-0.11549 1.2852-0.30469 0.18147 0.1867 0.43274 0.30469 0.71484 0.30469 0.554 0 1-0.446 1-1v-2-2c0-0.554-0.446-1-1-1-0.28152 0-0.53345 0.11683-0.71484 0.30273-0.39187-0.1892-0.82436-0.30273-1.2852-0.30273zm0 2c0.56412 0 1 0.4359 1 1s-0.43588 1-1 1-1-0.4359-1-1 0.43588-1 1-1zm6.8867 3.5293l-1.7891 0.89453 0.28906 0.57617h-2.3867v2h0.82031c0.13264 0.9292 0.4994 1.8938 1.1992 2.7305-0.61509 0.163-1.3569 0.26523-2.2656 0.26953l0.0097657 2c1.6777-0.01 3.0414-0.31328 4.1113-0.83398 1.07 0.5208 2.4336 0.82608 4.1113 0.83398l0.009766-2c-0.90873 0-1.6505-0.10653-2.2656-0.26953 0.7-0.8367 1.068-1.8013 1.2012-2.7305h1.0684v-2h-3.3789l-0.73438-1.4707zm-1.0234 3.4707h2.0234c-0.12578 0.5801-0.37537 1.147-0.83594 1.623-0.05313 0.055-0.11651 0.10676-0.17578 0.16016-0.05927-0.053-0.12265-0.10516-0.17578-0.16016-0.46056-0.476-0.71015-1.0429-0.83594-1.623z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
</g>
</svg>
diff --git a/editor/icons/icon_unpaint_vertex.svg b/editor/icons/icon_unpaint_vertex.svg
new file mode 100644
index 0000000000..a4633ee80b
--- /dev/null
+++ b/editor/icons/icon_unpaint_vertex.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg4"
+ sodipodi:docname="icon_unpaint_vertex.svg"
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="3066"
+ inkscape:window-height="1689"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="134"
+ inkscape:window-y="55"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg4" />
+ <ellipse
+ style="fill:#000000"
+ id="path12"
+ cx="8.3728809"
+ cy="8.1694918"
+ rx="6.6779661"
+ ry="6.0677967" />
+</svg>
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 863b13cbd7..a13f741ee7 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -138,7 +138,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n
//should map this bone to something for animation?
} else {
print_line("no rest: " + joint->sid);
- WARN_PRINT("Joint has no rest..");
+ WARN_PRINT("Joint has no rest...");
}
int id = r_bone++;
@@ -339,7 +339,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
NodeMap nm;
nm.node = node;
node_map[p_node->id] = nm;
- node_name_map[p_node->name] = p_node->id;
+ node_name_map[node->get_name()] = p_node->id;
Transform xf = p_node->default_transform;
xf = collada.fix_transform(xf) * p_node->post_transform;
@@ -480,7 +480,7 @@ Error ColladaImport::_create_material(const String &p_target) {
}
}
- float roughness = Math::sqrt(1.0 - ((Math::log(effect.shininess) / Math::log(2.0)) / 8.0)); //not very right..
+ float roughness = (effect.shininess - 1.0) / 510;
material->set_roughness(roughness);
if (effect.double_sided) {
@@ -1785,8 +1785,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
}
- Quat q = xform.basis;
- q.normalize();
+ Quat q = xform.basis.get_rotation_quat();
Vector3 s = xform.basis.get_scale();
Vector3 l = xform.origin;
@@ -1838,8 +1837,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform;
- Quat q = xform.basis;
- q.normalize();
+ Quat q = xform.basis.get_rotation_quat();
Vector3 s = xform.basis.get_scale();
Vector3 l = xform.origin;
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 2636839764..eb0bc0f782 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -762,14 +762,22 @@ PoolVector<Color> EditorSceneImporterGLTF::_decode_accessor_as_color(GLTFState &
PoolVector<Color> ret;
if (attribs.size() == 0)
return ret;
- ERR_FAIL_COND_V(attribs.size() % 4 != 0, ret);
+ int type = state.accessors[p_accessor].type;
+ ERR_FAIL_COND_V(!(type == TYPE_VEC3 || type == TYPE_VEC4), ret);
+ int components;
+ if (type == TYPE_VEC3) {
+ components = 3;
+ } else { // TYPE_VEC4
+ components = 4;
+ }
+ ERR_FAIL_COND_V(attribs.size() % components != 0, ret);
const double *attribs_ptr = attribs.ptr();
- int ret_size = attribs.size() / 4;
+ int ret_size = attribs.size() / components;
ret.resize(ret_size);
{
PoolVector<Color>::Write w = ret.write();
for (int i = 0; i < ret_size; i++) {
- w[i] = Color(attribs_ptr[i * 4 + 0], attribs_ptr[i * 4 + 1], attribs_ptr[i * 4 + 2], attribs_ptr[i * 4 + 3]);
+ w[i] = Color(attribs_ptr[i * 4 + 0], attribs_ptr[i * 4 + 1], attribs_ptr[i * 4 + 2], components == 4 ? attribs_ptr[i * 4 + 3] : 1.0);
}
}
return ret;
@@ -855,6 +863,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
ERR_FAIL_COND_V(!d.has("primitives"), ERR_PARSE_ERROR);
Array primitives = d["primitives"];
+ Dictionary extras = d.has("extras") ? (Dictionary)d["extras"] : Dictionary();
for (int j = 0; j < primitives.size(); j++) {
@@ -992,8 +1001,10 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Array targets = p["targets"];
if (j == 0) {
+ Array target_names = extras.has("targetNames") ? (Array)extras["targetNames"] : Array();
for (int k = 0; k < targets.size(); k++) {
- mesh.mesh->add_blend_shape(String("morph_") + itos(k));
+ String name = k < target_names.size() ? (String)target_names[k] : String("morph_") + itos(k);
+ mesh.mesh->add_blend_shape(name);
}
}
@@ -1155,7 +1166,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
continue;
}
- if (mimetype.findn("jpg") != -1) {
+ if (mimetype.findn("jpeg") != -1) {
//is a jpg
Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size);
@@ -1245,12 +1256,15 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
}
if (mr.has("metallicFactor")) {
-
material->set_metallic(mr["metallicFactor"]);
+ } else {
+ material->set_metallic(1.0);
}
- if (mr.has("roughnessFactor")) {
+ if (mr.has("roughnessFactor")) {
material->set_roughness(mr["roughnessFactor"]);
+ } else {
+ material->set_roughness(1.0);
}
if (mr.has("metallicRoughnessTexture")) {
@@ -1724,14 +1738,19 @@ void EditorSceneImporterGLTF::_generate_bone(GLTFState &state, int p_node, Vecto
for (int i = 0; i < n->joints.size(); i++) {
ERR_FAIL_COND(n->joints[i].skin < 0);
- int bone_index = skeletons[n->joints[i].skin]->get_bone_count();
- skeletons[n->joints[i].skin]->add_bone(n->name);
+ int bone_index = n->joints[i].bone;
+
+ Skeleton *s = skeletons[n->joints[i].skin];
+ while (s->get_bone_count() <= bone_index) {
+ s->add_bone("Bone " + itos(s->get_bone_count()));
+ }
+
if (p_parent_bones.size()) {
- skeletons[n->joints[i].skin]->set_bone_parent(bone_index, p_parent_bones[i]);
+ s->set_bone_parent(bone_index, p_parent_bones[i]);
}
- skeletons[n->joints[i].skin]->set_bone_rest(bone_index, state.skins[n->joints[i].skin].bones[n->joints[i].bone].inverse_bind.affine_inverse());
+ s->set_bone_rest(bone_index, state.skins[n->joints[i].skin].bones[n->joints[i].bone].inverse_bind.affine_inverse());
- n->godot_nodes.push_back(skeletons[n->joints[i].skin]);
+ n->godot_nodes.push_back(s);
n->joints[i].godot_bone_index = bone_index;
parent_bones.push_back(bone_index);
}
@@ -1875,6 +1894,8 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
animation.instance();
animation->set_name(name);
+ float length = 0;
+
for (Map<int, GLTFAnimation::Track>::Element *E = anim.tracks.front(); E; E = E->next()) {
const GLTFAnimation::Track &track = E->get();
@@ -1893,8 +1914,6 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
node_path = ap->get_parent()->get_path_to(node->godot_nodes[i]);
}
- float length = 0;
-
for (int i = 0; i < track.rotation_track.times.size(); i++) {
length = MAX(length, track.rotation_track.times[i]);
}
@@ -1911,8 +1930,6 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
}
}
- animation->set_length(length);
-
if (track.rotation_track.values.size() || track.translation_track.values.size() || track.scale_track.values.size()) {
//make transform track
int track_idx = animation->get_track_count();
@@ -1972,8 +1989,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
int bone = node->joints[i].godot_bone_index;
xform = skeleton->get_bone_rest(bone).affine_inverse() * xform;
- rot = xform.basis;
- rot.normalize();
+ rot = xform.basis.get_rotation_quat();
scale = xform.basis.get_scale();
pos = xform.origin;
}
@@ -2030,6 +2046,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
}
}
}
+ animation->set_length(length);
ap->add_animation(name, animation);
}
diff --git a/editor/import/resource_importer_bitmask.cpp b/editor/import/resource_importer_bitmask.cpp
index a5d3959952..7b330936f6 100644
--- a/editor/import/resource_importer_bitmask.cpp
+++ b/editor/import/resource_importer_bitmask.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* resource_importer_bitmask.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "resource_importer_bitmask.h"
#include "core/image.h"
#include "editor/editor_file_system.h"
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index 8a3cafa7ce..f3537df819 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* resource_importer_bitmask.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef RESOURCE_IMPORTER_BITMASK_H
#define RESOURCE_IMPORTER_BITMASK_H
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 21803a2184..b8dd4a87b7 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -188,7 +188,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
return OK;
}
-static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, Vector3 p_scale_mesh, List<String> *r_missing_deps) {
+static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p_single_mesh, bool p_generate_tangents, bool p_optimize, Vector3 p_scale_mesh, List<String> *r_missing_deps) {
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ);
@@ -200,6 +200,8 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
bool generate_tangents = p_generate_tangents;
Vector3 scale_mesh = p_scale_mesh;
bool flip_faces = false;
+ int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
+
//bool flip_faces = p_options["force/flip_faces"];
//bool force_smooth = p_options["force/smooth_shading"];
//bool weld_vertices = p_options["force/weld_vertices"];
@@ -331,7 +333,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
surf_tool->set_material(material_map[current_material_library][current_material]);
}
- mesh = surf_tool->commit(mesh);
+ mesh = surf_tool->commit(mesh, mesh_flags);
if (current_material != String()) {
mesh->surface_set_name(mesh->get_surface_count() - 1, current_material.get_basename());
@@ -402,7 +404,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
List<Ref<Mesh> > meshes;
- Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, Vector3(1, 1, 1), r_missing_deps);
+ Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, p_flags & IMPORT_USE_COMPRESSION, Vector3(1, 1, 1), r_missing_deps);
if (err != OK) {
if (r_err) {
@@ -470,6 +472,7 @@ void ResourceImporterOBJ::get_import_options(List<ImportOption> *r_options, int
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_tangents"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::VECTOR3, "scale_mesh"), Vector3(1, 1, 1)));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "optimize_mesh"), true));
}
bool ResourceImporterOBJ::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
@@ -480,7 +483,7 @@ Error ResourceImporterOBJ::import(const String &p_source_file, const String &p_s
List<Ref<Mesh> > meshes;
- Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["scale_mesh"], NULL);
+ Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["optimize_mesh"], p_options["scale_mesh"], NULL);
ERR_FAIL_COND_V(err != OK, err);
ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 44948b8209..91644492c3 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -224,24 +224,42 @@ String ResourceImporterScene::get_preset_name(int p_idx) const {
static bool _teststr(const String &p_what, const String &p_str) {
- if (p_what.findn("$" + p_str) != -1) //blender and other stuff
+ String what = p_what;
+
+ //remove trailing spaces and numbers, some apps like blender add ".number" to duplicates so also compensate for this
+ while (what.length() && ((what[what.length() - 1] >= '0' && what[what.length() - 1] <= '9') || what[what.length() - 1] <= 32 || what[what.length() - 1] == '.')) {
+
+ what = what.substr(0, what.length() - 1);
+ }
+
+ if (what.findn("$" + p_str) != -1) //blender and other stuff
return true;
- if (p_what.to_lower().ends_with("-" + p_str)) //collada only supports "_" and "-" besides letters
+ if (what.to_lower().ends_with("-" + p_str)) //collada only supports "_" and "-" besides letters
return true;
- if (p_what.to_lower().ends_with("_" + p_str)) //collada only supports "_" and "-" besides letters
+ if (what.to_lower().ends_with("_" + p_str)) //collada only supports "_" and "-" besides letters
return true;
return false;
}
static String _fixstr(const String &p_what, const String &p_str) {
- if (p_what.findn("$" + p_str) != -1) //blender and other stuff
- return p_what.replace("$" + p_str, "");
- if (p_what.to_lower().ends_with("-" + p_str)) //collada only supports "_" and "-" besides letters
- return p_what.substr(0, p_what.length() - (p_str.length() + 1));
- if (p_what.to_lower().ends_with("_" + p_str)) //collada only supports "_" and "-" besides letters
- return p_what.substr(0, p_what.length() - (p_str.length() + 1));
- return p_what;
+ String what = p_what;
+
+ //remove trailing spaces and numbers, some apps like blender add ".number" to duplicates so also compensate for this
+ while (what.length() && ((what[what.length() - 1] >= '0' && what[what.length() - 1] <= '9') || what[what.length() - 1] <= 32 || what[what.length() - 1] == '.')) {
+
+ what = what.substr(0, what.length() - 1);
+ }
+
+ String end = p_what.substr(what.length(), p_what.length() - what.length());
+
+ if (what.findn("$" + p_str) != -1) //blender and other stuff
+ return what.replace("$" + p_str, "") + end;
+ if (what.to_lower().ends_with("-" + p_str)) //collada only supports "_" and "-" besides letters
+ return what.substr(0, what.length() - (p_str.length() + 1)) + end;
+ if (what.to_lower().ends_with("_" + p_str)) //collada only supports "_" and "-" besides letters
+ return what.substr(0, what.length() - (p_str.length() + 1)) + end;
+ return what;
}
Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map, LightBakeMode p_light_bake_mode) {
@@ -251,7 +269,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
Node *r = _fix_node(p_node->get_child(i), p_root, collision_map, p_light_bake_mode);
if (!r) {
- print_line("was erased..");
+ print_line("was erased...");
i--; //was erased
}
}
@@ -437,13 +455,19 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
Node *col;
if (_teststr(name, "col")) {
- mi->set_name(_fixstr(name, "col"));
+ String new_name = _fixstr(name, "col");
+ if (mi->get_parent() && !mi->get_parent()->has_node(new_name)) {
+ mi->set_name(new_name);
+ }
col = mi->create_trimesh_collision_node();
ERR_FAIL_COND_V(!col, NULL);
col->set_name("col");
} else {
- mi->set_name(_fixstr(name, "convcol"));
+ String new_name = _fixstr(name, "convcol");
+ if (mi->get_parent() && !mi->get_parent()->has_node(new_name)) {
+ mi->set_name(new_name);
+ }
col = mi->create_convex_collision_node();
ERR_FAIL_COND_V(!col, NULL);
@@ -893,7 +917,6 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
}
String ext_name = p_base_path.plus_file(_make_extname(E->get()) + ".anim");
-
if (FileAccess::exists(ext_name) && p_keep_animations) {
//try to keep custom animation tracks
Ref<Animation> old_anim = ResourceLoader::load(ext_name, "Animation", true);
@@ -907,6 +930,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
}
}
+ anim->set_path(ext_name, true); //if not set, then its never saved externally
ResourceSaver::save(ext_name, anim, ResourceSaver::FLAG_CHANGE_PATH);
p_animations[anim] = anim;
}
@@ -1152,7 +1176,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
String ext = src_path.get_extension().to_lower();
EditorProgress progress("import", TTR("Import Scene"), 104);
- progress.step(TTR("Importing Scene.."), 0);
+ progress.step(TTR("Importing Scene..."), 0);
for (Set<Ref<EditorSceneImporter> >::Element *E = importers.front(); E; E = E->next()) {
@@ -1324,7 +1348,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
_make_external_resources(scene, base_path, external_animations, keep_custom_tracks, external_materials, keep_materials, external_meshes, anim_map, mat_map, mesh_map);
}
- progress.step(TTR("Running Custom Script.."), 2);
+ progress.step(TTR("Running Custom Script..."), 2);
String post_import_script_path = p_options["nodes/custom_script"];
Ref<EditorScenePostImport> post_import_script;
@@ -1353,7 +1377,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
}
}
- progress.step(TTR("Saving.."), 104);
+ progress.step(TTR("Saving..."), 104);
if (external_scenes) {
//save sub-scenes as instances!
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 8119b84b7e..17a9394b51 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -295,7 +295,7 @@ void ResourceImporterTexture::_save_stex(const Ref<Image> &p_image, const String
case COMPRESS_VIDEO_RAM: {
Ref<Image> image = p_image->duplicate();
- image->generate_mipmaps();
+ image->generate_mipmaps(p_force_normal);
if (p_force_rgbe && image->get_format() >= Image::FORMAT_R8 && image->get_format() <= Image::FORMAT_RGBE9995) {
image->convert(Image::FORMAT_RGBE9995);
@@ -395,6 +395,10 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC);
}
+
+ if (normal) {
+ image->normalize();
+ }
}
if (fix_alpha_border) {
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 03155b3a48..debdeb1c4a 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -304,17 +304,23 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
int limit_rate_hz = p_options["force/max_rate_hz"];
if (limit_rate && rate > limit_rate_hz && rate > 0 && frames > 0) {
//resampleeee!!!
- int new_data_frames = frames * limit_rate_hz / rate;
+ int new_data_frames = (int)(frames * (float)limit_rate_hz / (float)rate);
+
+ print_line("\tresampling ratio: " + rtos((float)limit_rate_hz / (float)rate));
+ print_line("\tnew frames: " + itos(new_data_frames));
+
Vector<float> new_data;
new_data.resize(new_data_frames * format_channels);
for (int c = 0; c < format_channels; c++) {
+ float frac = .0f;
+ int ipos = 0;
+
for (int i = 0; i < new_data_frames; i++) {
//simple cubic interpolation should be enough.
- float pos = float(i) * frames / new_data_frames;
- float mu = pos - Math::floor(pos);
- int ipos = int(Math::floor(pos));
+
+ float mu = frac;
float y0 = data[MAX(0, ipos - 1) * format_channels + c];
float y1 = data[ipos * format_channels + c];
@@ -330,14 +336,22 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
float res = (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3);
new_data[i * format_channels + c] = res;
+
+ // update position and always keep fractional part within ]0...1]
+ // in order to avoid 32bit floating point precision errors
+
+ frac += (float)rate / (float)limit_rate_hz;
+ int tpos = (int)Math::floor(frac);
+ ipos += tpos;
+ frac -= tpos;
}
}
if (loop) {
-
- loop_begin = loop_begin * new_data_frames / frames;
- loop_end = loop_end * new_data_frames / frames;
+ loop_begin = (int)(loop_begin * (float)new_data_frames / (float)frames);
+ loop_end = (int)(loop_end * (float)new_data_frames / (float)frames);
}
+
data = new_data;
rate = limit_rate_hz;
frames = new_data_frames;
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index ce2a4ec6d8..f91802b352 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -407,6 +407,7 @@ ImportDock::ImportDock() {
set_name("Import");
imported = memnew(Label);
imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit"));
+ imported->set_clip_text(true);
add_child(imported);
HBoxContainer *hb = memnew(HBoxContainer);
add_margin_child(TTR("Import As:"), hb);
@@ -415,7 +416,7 @@ ImportDock::ImportDock() {
hb->add_child(import_as);
import_as->set_h_size_flags(SIZE_EXPAND_FILL);
preset = memnew(MenuButton);
- preset->set_text(TTR("Preset.."));
+ preset->set_text(TTR("Preset..."));
preset->get_popup()->connect("index_pressed", this, "_preset_selected");
hb->add_child(preset);
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
new file mode 100644
index 0000000000..0d0b12c911
--- /dev/null
+++ b/editor/inspector_dock.cpp
@@ -0,0 +1,568 @@
+/*************************************************************************/
+/* inspector_dock.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "inspector_dock.h"
+
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
+#include "editor/plugins/animation_player_editor_plugin.h"
+
+void InspectorDock::_menu_option(int p_option) {
+ switch (p_option) {
+ case RESOURCE_SAVE: {
+ _save_resource(false);
+ } break;
+ case RESOURCE_SAVE_AS: {
+ _save_resource(true);
+ } break;
+
+ case OBJECT_REQUEST_HELP: {
+ if (current) {
+ editor->set_visible_editor(EditorNode::EDITOR_SCRIPT);
+ emit_signal("request_help", current->get_class());
+ }
+ } break;
+
+ case OBJECT_COPY_PARAMS: {
+ editor_data->apply_changes_in_editors();
+ if (current)
+ editor_data->copy_object_params(current);
+ } break;
+
+ case OBJECT_PASTE_PARAMS: {
+ editor_data->apply_changes_in_editors();
+ if (current)
+ editor_data->paste_object_params(current);
+ editor_data->get_undo_redo().clear_history();
+ } break;
+
+ case OBJECT_UNIQUE_RESOURCES: {
+ editor_data->apply_changes_in_editors();
+ if (current) {
+ List<PropertyInfo> props;
+ current->get_property_list(&props);
+ Map<RES, RES> duplicates;
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
+ continue;
+
+ Variant v = current->get(E->get().name);
+ if (v.is_ref()) {
+ REF ref = v;
+ if (ref.is_valid()) {
+
+ RES res = ref;
+ if (res.is_valid()) {
+
+ if (!duplicates.has(res)) {
+ duplicates[res] = res->duplicate();
+ }
+ res = duplicates[res];
+
+ current->set(E->get().name, res);
+ }
+ }
+ }
+ }
+ }
+
+ editor_data->get_undo_redo().clear_history();
+
+ editor->get_editor_plugins_over()->edit(NULL);
+ editor->get_editor_plugins_over()->edit(current);
+
+ } break;
+
+ default: {
+ if (p_option >= OBJECT_METHOD_BASE) {
+ ERR_FAIL_COND(!current);
+
+ int idx = p_option - OBJECT_METHOD_BASE;
+
+ List<MethodInfo> methods;
+ current->get_method_list(&methods);
+
+ ERR_FAIL_INDEX(idx, methods.size());
+ String name = methods[idx].name;
+
+ if (current)
+ current->call(name);
+ }
+ }
+ }
+}
+
+void InspectorDock::_new_resource() {
+ new_resource_dialog->popup_create(true);
+}
+
+void InspectorDock::_load_resource(const String &p_type) {
+ load_resource_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+
+ List<String> extensions;
+ ResourceLoader::get_recognized_extensions_for_type(p_type, &extensions);
+
+ load_resource_dialog->clear_filters();
+ for (int i = 0; i < extensions.size(); i++) {
+ load_resource_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
+ }
+
+ load_resource_dialog->popup_centered_ratio();
+}
+
+void InspectorDock::_resource_file_selected(String p_file) {
+ RES res = ResourceLoader::load(p_file);
+ if (res.is_null()) {
+ warning_dialog->get_ok()->set_text("Ugh");
+ warning_dialog->set_text(TTR("Failed to load resource."));
+ return;
+ };
+
+ editor->push_item(res.operator->());
+}
+
+void InspectorDock::_save_resource(bool save_as) const {
+ uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
+ Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+
+ ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
+
+ RES current_res = RES(Object::cast_to<Resource>(current_obj));
+
+ if (save_as)
+ editor->save_resource_as(current_res);
+ else
+ editor->save_resource(current_res);
+}
+
+void InspectorDock::_unref_resource() const {
+ uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
+ Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+
+ ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
+
+ RES current_res = RES(Object::cast_to<Resource>(current_obj));
+ current_res->set_path("");
+ editor->edit_current();
+}
+
+void InspectorDock::_copy_resource() const {
+ uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
+ Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+
+ ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
+
+ RES current_res = RES(Object::cast_to<Resource>(current_obj));
+
+ EditorSettings::get_singleton()->set_resource_clipboard(current_res);
+}
+
+void InspectorDock::_paste_resource() const {
+ RES r = EditorSettings::get_singleton()->get_resource_clipboard();
+ if (r.is_valid()) {
+ editor->push_item(EditorSettings::get_singleton()->get_resource_clipboard().ptr(), String());
+ }
+}
+
+void InspectorDock::_prepare_history() {
+ EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
+
+ int history_to = MAX(0, editor_history->get_history_len() - 25);
+
+ history_menu->get_popup()->clear();
+
+ Ref<Texture> base_icon = get_icon("Object", "EditorIcons");
+ Set<ObjectID> already;
+ for (int i = editor_history->get_history_len() - 1; i >= history_to; i--) {
+
+ ObjectID id = editor_history->get_history_obj(i);
+ Object *obj = ObjectDB::get_instance(id);
+ if (!obj || already.has(id)) {
+ if (history_to > 0) {
+ history_to--;
+ }
+ continue;
+ }
+
+ already.insert(id);
+
+ Ref<Texture> icon = get_icon("Object", "EditorIcons");
+ if (has_icon(obj->get_class(), "EditorIcons"))
+ icon = get_icon(obj->get_class(), "EditorIcons");
+ else
+ icon = base_icon;
+
+ String text;
+ if (Object::cast_to<Resource>(obj)) {
+ Resource *r = Object::cast_to<Resource>(obj);
+ if (r->get_path().is_resource_file())
+ text = r->get_path().get_file();
+ else if (r->get_name() != String()) {
+ text = r->get_name();
+ } else {
+ text = r->get_class();
+ }
+ } else if (Object::cast_to<Node>(obj)) {
+ text = Object::cast_to<Node>(obj)->get_name();
+ } else if (obj->is_class("ScriptEditorDebuggerInspectedObject")) {
+ text = obj->call("get_title");
+ } else {
+ text = obj->get_class();
+ }
+
+ if (i == editor_history->get_history_pos()) {
+ text = "[" + text + "]";
+ }
+ history_menu->get_popup()->add_icon_item(icon, text, i);
+ }
+}
+
+void InspectorDock::_select_history(int p_idx) const {
+ //push it to the top, it is not correct, but it's more useful
+ ObjectID id = EditorNode::get_singleton()->get_editor_history()->get_history_obj(p_idx);
+ Object *obj = ObjectDB::get_instance(id);
+ if (!obj)
+ return;
+ editor->push_item(obj);
+}
+
+void InspectorDock::_resource_created() const {
+ Object *c = new_resource_dialog->instance_selected();
+
+ ERR_FAIL_COND(!c);
+ Resource *r = Object::cast_to<Resource>(c);
+ ERR_FAIL_COND(!r);
+
+ REF res(r);
+ editor->push_item(c);
+}
+
+void InspectorDock::_resource_selected(const RES &p_res, const String &p_property) const {
+ if (p_res.is_null())
+ return;
+
+ RES r = p_res;
+ editor->push_item(r.operator->(), p_property);
+}
+
+void InspectorDock::_edit_forward() {
+ if (EditorNode::get_singleton()->get_editor_history()->next())
+ editor->edit_current();
+}
+void InspectorDock::_edit_back() {
+ EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
+ if (editor_history->previous() || editor_history->get_path_size() == 1)
+ editor->edit_current();
+}
+
+void InspectorDock::_menu_collapseall() {
+ inspector->collapse_all_folding();
+}
+
+void InspectorDock::_menu_expandall() {
+ inspector->expand_all_folding();
+}
+
+void InspectorDock::_property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance) {
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_value_key(p_keyed, p_value, p_advance);
+}
+
+void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Transform &p_key) {
+ Spatial *s = Object::cast_to<Spatial>(sp);
+ if (!s)
+ return;
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_transform_key(s, p_sub, p_key);
+}
+
+void InspectorDock::_warning_pressed() {
+ warning_dialog->get_ok()->set_text(TTR("Ok"));
+ warning_dialog->popup_centered_minsize();
+}
+
+Container *InspectorDock::get_addon_area() {
+ return this;
+}
+
+void InspectorDock::_bind_methods() {
+ ClassDB::bind_method("_menu_option", &InspectorDock::_menu_option);
+
+ ClassDB::bind_method("update_keying", &InspectorDock::update_keying);
+ ClassDB::bind_method("_property_keyed", &InspectorDock::_property_keyed);
+ ClassDB::bind_method("_transform_keyed", &InspectorDock::_transform_keyed);
+
+ ClassDB::bind_method("_new_resource", &InspectorDock::_new_resource);
+ ClassDB::bind_method("_resource_file_selected", &InspectorDock::_resource_file_selected);
+ ClassDB::bind_method("_open_resource_selector", &InspectorDock::_open_resource_selector);
+ ClassDB::bind_method("_unref_resource", &InspectorDock::_unref_resource);
+ ClassDB::bind_method("_paste_resource", &InspectorDock::_paste_resource);
+ ClassDB::bind_method("_copy_resource", &InspectorDock::_copy_resource);
+
+ ClassDB::bind_method("_select_history", &InspectorDock::_select_history);
+ ClassDB::bind_method("_prepare_history", &InspectorDock::_prepare_history);
+ ClassDB::bind_method("_resource_created", &InspectorDock::_resource_created);
+ ClassDB::bind_method("_resource_selected", &InspectorDock::_resource_selected, DEFVAL(""));
+ ClassDB::bind_method("_menu_collapseall", &InspectorDock::_menu_collapseall);
+ ClassDB::bind_method("_menu_expandall", &InspectorDock::_menu_expandall);
+ ClassDB::bind_method("_warning_pressed", &InspectorDock::_warning_pressed);
+ ClassDB::bind_method("_edit_forward", &InspectorDock::_edit_forward);
+ ClassDB::bind_method("_edit_back", &InspectorDock::_edit_back);
+
+ ADD_SIGNAL(MethodInfo("request_help"));
+}
+
+void InspectorDock::edit_resource(const Ref<Resource> &p_resource) {
+ _resource_selected(p_resource, "");
+}
+
+void InspectorDock::open_resource(const String &p_type) {
+ _load_resource(p_type);
+}
+
+void InspectorDock::set_warning(const String &p_message) {
+ warning->hide();
+ if (p_message != String()) {
+ warning->show();
+ warning_dialog->set_text(p_message);
+ }
+}
+
+void InspectorDock::clear() {
+}
+
+void InspectorDock::update(Object *p_object) {
+
+ EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
+ backward_button->set_disabled(editor_history->is_at_beginning());
+ forward_button->set_disabled(editor_history->is_at_end());
+
+ history_menu->set_disabled(true);
+ if (editor_history->get_history_len() > 0) {
+ history_menu->set_disabled(false);
+ }
+ editor_path->update_path();
+
+ current = p_object;
+
+ if (!p_object) {
+ object_menu->set_disabled(true);
+ warning->hide();
+ search->set_editable(false);
+
+ return;
+ }
+
+ bool is_resource = p_object->is_class("Resource");
+ bool is_node = p_object->is_class("Node");
+
+ object_menu->set_disabled(false);
+ search->set_editable(true);
+
+ PopupMenu *p = object_menu->get_popup();
+
+ p->clear();
+ p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand all properties")), EXPAND_ALL);
+ p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse all properties")), COLLAPSE_ALL);
+ p->add_separator();
+ if (is_resource) {
+ p->add_item(TTR("Save"), RESOURCE_SAVE);
+ p->add_item(TTR("Save As..."), RESOURCE_SAVE_AS);
+ p->add_separator();
+ }
+ p->add_shortcut(ED_SHORTCUT("property_editor/copy_params", TTR("Copy Params")), OBJECT_COPY_PARAMS);
+ p->add_shortcut(ED_SHORTCUT("property_editor/paste_params", TTR("Paste Params")), OBJECT_PASTE_PARAMS);
+ p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("property_editor/paste_resource", TTR("Paste Resource")), RESOURCE_PASTE);
+ if (is_resource) {
+ p->add_shortcut(ED_SHORTCUT("property_editor/copy_resource", TTR("Copy Resource")), RESOURCE_COPY);
+ p->add_shortcut(ED_SHORTCUT("property_editor/unref_resource", TTR("Make Built-In")), RESOURCE_UNREF);
+ }
+
+ if (is_resource || is_node) {
+ p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
+ p->add_separator();
+ p->add_icon_shortcut(get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
+ }
+
+ List<MethodInfo> methods;
+ p_object->get_method_list(&methods);
+
+ if (!methods.empty()) {
+
+ bool found = false;
+ List<MethodInfo>::Element *I = methods.front();
+ int i = 0;
+ while (I) {
+
+ if (I->get().flags & METHOD_FLAG_EDITOR) {
+ if (!found) {
+ p->add_separator();
+ found = true;
+ }
+ p->add_item(I->get().name.capitalize(), OBJECT_METHOD_BASE + i);
+ }
+ i++;
+ I = I->next();
+ }
+ }
+}
+
+void InspectorDock::go_back() {
+ _edit_back();
+}
+
+void InspectorDock::update_keying() {
+ bool valid = false;
+
+ if (AnimationPlayerEditor::singleton->get_track_editor()->has_keying()) {
+
+ EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
+ if (editor_history->get_path_size() >= 1) {
+
+ Object *obj = ObjectDB::get_instance(editor_history->get_path_object(0));
+ if (Object::cast_to<Node>(obj)) {
+
+ valid = true;
+ }
+ }
+ }
+
+ inspector->set_keying(valid);
+}
+
+InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
+ set_name("Inspector");
+ set_theme(p_editor->get_gui_base()->get_theme());
+
+ editor = p_editor;
+ editor_data = &p_editor_data;
+
+ HBoxContainer *general_options_hb = memnew(HBoxContainer);
+ add_child(general_options_hb);
+
+ resource_new_button = memnew(ToolButton);
+ resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it."));
+ resource_new_button->set_icon(get_icon("New", "EditorIcons"));
+ general_options_hb->add_child(resource_new_button);
+ resource_new_button->connect("pressed", this, "_new_resource");
+ resource_new_button->set_focus_mode(Control::FOCUS_NONE);
+
+ resource_load_button = memnew(ToolButton);
+ resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it."));
+ resource_load_button->set_icon(get_icon("Load", "EditorIcons"));
+ general_options_hb->add_child(resource_load_button);
+ resource_load_button->connect("pressed", this, "_open_resource_selector");
+ resource_load_button->set_focus_mode(Control::FOCUS_NONE);
+
+ general_options_hb->add_spacer();
+
+ backward_button = memnew(ToolButton);
+ general_options_hb->add_child(backward_button);
+ backward_button->set_icon(get_icon("Back", "EditorIcons"));
+ backward_button->set_flat(true);
+ backward_button->set_tooltip(TTR("Go to the previous edited object in history."));
+ backward_button->set_disabled(true);
+ backward_button->connect("pressed", this, "_edit_back");
+
+ forward_button = memnew(ToolButton);
+ general_options_hb->add_child(forward_button);
+ forward_button->set_icon(get_icon("Forward", "EditorIcons"));
+ forward_button->set_flat(true);
+ forward_button->set_tooltip(TTR("Go to the next edited object in history."));
+ forward_button->set_disabled(true);
+ forward_button->connect("pressed", this, "_edit_forward");
+
+ history_menu = memnew(MenuButton);
+ history_menu->set_tooltip(TTR("History of recently edited objects."));
+ history_menu->set_icon(get_icon("History", "EditorIcons"));
+ general_options_hb->add_child(history_menu);
+ history_menu->connect("about_to_show", this, "_prepare_history");
+ history_menu->get_popup()->connect("id_pressed", this, "_select_history");
+
+ HBoxContainer *node_info_hb = memnew(HBoxContainer);
+ add_child(node_info_hb);
+
+ editor_path = memnew(EditorPath(editor->get_editor_history()));
+ editor_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ node_info_hb->add_child(editor_path);
+
+ object_menu = memnew(MenuButton);
+ object_menu->set_icon(get_icon("Tools", "EditorIcons"));
+ node_info_hb->add_child(object_menu);
+ object_menu->set_tooltip(TTR("Object properties."));
+ object_menu->get_popup()->connect("id_pressed", this, "_menu_option");
+
+ new_resource_dialog = memnew(CreateDialog);
+ editor->get_gui_base()->add_child(new_resource_dialog);
+ new_resource_dialog->set_base_type("Resource");
+ new_resource_dialog->connect("create", this, "_resource_created");
+
+ search = memnew(LineEdit);
+ search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ search->set_placeholder(TTR("Filter properties"));
+ search->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
+ add_child(search);
+
+ warning = memnew(Button);
+ add_child(warning);
+ warning->set_text(TTR("Changes may be lost!"));
+ warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
+ warning->hide();
+ warning->connect("pressed", this, "_warning_pressed");
+
+ warning_dialog = memnew(AcceptDialog);
+ editor->get_gui_base()->add_child(warning_dialog);
+
+ load_resource_dialog = memnew(EditorFileDialog);
+ add_child(load_resource_dialog);
+ load_resource_dialog->set_current_dir("res://");
+ load_resource_dialog->connect("file_selected", this, "_resource_file_selected");
+
+ inspector = memnew(EditorInspector);
+ add_child(inspector);
+ inspector->set_autoclear(true);
+ inspector->set_show_categories(true);
+ inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ inspector->set_use_doc_hints(true);
+ inspector->set_hide_script(false);
+ inspector->set_enable_capitalize_paths(bool(EDITOR_GET("interface/inspector/capitalize_properties")));
+ inspector->set_use_folding(!bool(EDITOR_GET("interface/inspector/disable_folding")));
+ inspector->register_text_enter(search);
+ inspector->set_undo_redo(&editor_data->get_undo_redo());
+
+ inspector->set_use_filter(true); // TODO: check me
+
+ inspector->connect("resource_selected", this, "_resource_selected");
+ inspector->connect("property_keyed", this, "_property_keyed");
+}
+
+InspectorDock::~InspectorDock() {
+}
diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h
new file mode 100644
index 0000000000..f347056158
--- /dev/null
+++ b/editor/inspector_dock.h
@@ -0,0 +1,138 @@
+/*************************************************************************/
+/* inspector_dock.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef INSPECTOR_DOCK_H
+#define INSPECTOR_DOCK_H
+
+#include "editor/animation_track_editor.h"
+#include "editor/connections_dialog.h"
+#include "editor/create_dialog.h"
+#include "editor/editor_data.h"
+#include "editor/editor_inspector.h"
+#include "editor/editor_path.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/button.h"
+#include "scene/gui/control.h"
+#include "scene/gui/label.h"
+#include "scene/gui/popup_menu.h"
+#include "scene/gui/tool_button.h"
+
+class EditorNode;
+
+class InspectorDock : public VBoxContainer {
+
+ GDCLASS(InspectorDock, VBoxContainer);
+
+ enum MenuOptions {
+ RESOURCE_NEW,
+ RESOURCE_LOAD,
+ RESOURCE_SAVE,
+ RESOURCE_SAVE_AS,
+ RESOURCE_UNREF,
+ RESOURCE_COPY,
+ RESOURCE_PASTE,
+ OBJECT_COPY_PARAMS,
+ OBJECT_PASTE_PARAMS,
+ OBJECT_UNIQUE_RESOURCES,
+ OBJECT_REQUEST_HELP,
+
+ COLLAPSE_ALL,
+ EXPAND_ALL,
+
+ OBJECT_METHOD_BASE = 500
+ };
+
+ EditorNode *editor;
+ EditorData *editor_data;
+
+ EditorInspector *inspector;
+
+ Object *current;
+
+ ToolButton *backward_button;
+ ToolButton *forward_button;
+
+ EditorFileDialog *load_resource_dialog;
+ CreateDialog *new_resource_dialog;
+ ToolButton *resource_new_button;
+ ToolButton *resource_load_button;
+ MenuButton *resource_save_button;
+ MenuButton *history_menu;
+ LineEdit *search;
+
+ MenuButton *object_menu;
+ EditorPath *editor_path;
+
+ Button *warning;
+ AcceptDialog *warning_dialog;
+
+ void _menu_option(int p_option);
+
+ void _new_resource();
+ void _load_resource(const String &p_type = "");
+ void _open_resource_selector() { _load_resource(); }; // just used to call from arg-less signal
+ void _resource_file_selected(String p_file);
+ void _save_resource(bool save_as) const;
+ void _unref_resource() const;
+ void _copy_resource() const;
+ void _paste_resource() const;
+
+ void _warning_pressed();
+ void _resource_created() const;
+ void _resource_selected(const RES &p_res, const String &p_property = "") const;
+ void _edit_forward();
+ void _edit_back();
+ void _menu_collapseall();
+ void _menu_expandall();
+ void _select_history(int p_idx) const;
+ void _prepare_history();
+
+ void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
+ void _transform_keyed(Object *sp, const String &p_sub, const Transform &p_key);
+
+protected:
+ static void _bind_methods();
+
+public:
+ void go_back();
+ void update_keying();
+ void edit_resource(const Ref<Resource> &p_resource);
+ void open_resource(const String &p_type);
+ void clear();
+ void set_warning(const String &p_message);
+ void update(Object *p_object);
+ Container *get_addon_area();
+ EditorInspector *get_inspector() { return inspector; }
+
+ InspectorDock(EditorNode *p_editor, EditorData &p_editor_data);
+ ~InspectorDock();
+};
+
+#endif
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 73e78ddf2a..173be01586 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -80,8 +80,8 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
ur->add_undo_property(n, name, n->get(name));
}
- ur->add_do_method(EditorNode::get_singleton()->get_property_editor(), "refresh");
- ur->add_undo_method(EditorNode::get_singleton()->get_property_editor(), "refresh");
+ ur->add_do_method(EditorNode::get_singleton()->get_inspector(), "refresh");
+ ur->add_undo_method(EditorNode::get_singleton()->get_inspector(), "refresh");
ur->commit_action();
return true;
diff --git a/editor/output_strings.cpp b/editor/output_strings.cpp
index b0b72510a9..e6cadee3e3 100644
--- a/editor/output_strings.cpp
+++ b/editor/output_strings.cpp
@@ -87,6 +87,7 @@ void OutputStrings::_notification(int p_what) {
float h_ofs = (int)h_scroll->get_value();
Point2 icon_ofs = Point2(0, (font_height - (int)icon_error->get_height()) / 2);
+ FontDrawer drawer(font, Color(1, 1, 1));
while (E && ofs.y < (size_height - (int)margin.y)) {
String str = E->get().text;
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
new file mode 100644
index 0000000000..2e128db883
--- /dev/null
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -0,0 +1,741 @@
+#include "animation_blend_space_1d_editor.h"
+
+#include "os/keyboard.h"
+#include "scene/animation/animation_blend_tree.h"
+
+void AnimationNodeBlendSpace1DEditorPlugin::edit(Object *p_object) {
+ anim_tree_editor->edit(Object::cast_to<AnimationNodeBlendSpace1D>(p_object));
+}
+
+bool AnimationNodeBlendSpace1DEditorPlugin::handles(Object *p_object) const {
+ return p_object->is_class("AnimationNodeBlendSpace1D");
+}
+
+void AnimationNodeBlendSpace1DEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+ button->show();
+ editor->make_bottom_panel_item_visible(anim_tree_editor);
+ anim_tree_editor->set_process(true);
+ } else {
+ if (anim_tree_editor->is_visible_in_tree()) {
+ editor->hide_bottom_panel();
+ }
+
+ button->hide();
+ anim_tree_editor->set_process(false);
+ }
+}
+
+AnimationNodeBlendSpace1DEditorPlugin::AnimationNodeBlendSpace1DEditorPlugin(EditorNode *p_node) {
+ editor = p_node;
+ anim_tree_editor = memnew(AnimationNodeBlendSpace1DEditor);
+ anim_tree_editor->set_custom_minimum_size(Size2(0, 150 * EDSCALE));
+
+ button = editor->add_bottom_panel_item(TTR("BlendSpace1D"), anim_tree_editor);
+ button->hide();
+}
+
+AnimationNodeBlendSpace1DEditorPlugin::~AnimationNodeBlendSpace1DEditorPlugin() {
+}
+
+void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
+ Ref<InputEventKey> k = p_event;
+
+ if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (selected_point != -1) {
+ _erase_selected();
+ accept_event();
+ }
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (mb->get_button_index() == BUTTON_LEFT && tool_create->is_pressed()))) {
+ menu->clear();
+ animations_menu->clear();
+ animations_to_add.clear();
+
+ List<StringName> classes;
+ ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
+ classes.sort_custom<StringName::AlphCompare>();
+
+ menu->add_submenu_item(TTR("Add Animation"), "animations");
+
+ AnimationTree *gp = blend_space->get_tree();
+ ERR_FAIL_COND(!gp);
+
+ if (gp->has_node(gp->get_animation_player())) {
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(gp->get_node(gp->get_animation_player()));
+
+ if (ap) {
+ List<StringName> names;
+ ap->get_animation_list(&names);
+
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ animations_menu->add_icon_item(get_icon("Animation", "Editoricons"), E->get());
+ animations_to_add.push_back(E->get());
+ }
+ }
+ }
+
+ for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
+ String name = String(E->get()).replace_first("AnimationNode", "");
+ if (name == "Animation")
+ continue;
+
+ int idx = menu->get_item_count();
+ menu->add_item(vformat("Add %s", name));
+ menu->set_item_metadata(idx, E->get());
+ }
+
+ menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position()));
+ menu->popup();
+
+ add_point_pos = (mb->get_position() / blend_space_draw->get_size()).x;
+ add_point_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
+ add_point_pos += blend_space->get_min_space();
+
+ if (snap->is_pressed()) {
+ add_point_pos = Math::stepify(add_point_pos, blend_space->get_snap());
+ }
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ blend_space_draw->update(); // why not
+
+ // try to see if a point can be selected
+ selected_point = -1;
+ _update_tool_erase();
+
+ for (int i = 0; i < points.size(); i++) {
+
+ if (Math::abs(float(points[i] - mb->get_position().x)) < 10 * EDSCALE) {
+ selected_point = i;
+
+ Ref<AnimationNode> node = blend_space->get_blend_point_node(i);
+ EditorNode::get_singleton()->push_item(node.ptr(), "", true);
+ dragging_selected_attempt = true;
+ drag_from = mb->get_position();
+ _update_tool_erase();
+ _update_edited_point_pos();
+ return;
+ }
+ }
+ }
+
+ if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT) {
+ if (dragging_selected) {
+ // move
+ float point = blend_space->get_blend_point_position(selected_point);
+ point += drag_ofs.x;
+
+ if (snap->is_pressed()) {
+ point = Math::stepify(point, blend_space->get_snap());
+ }
+
+ updating = true;
+ undo_redo->create_action("Move Node Point");
+ undo_redo->add_do_method(blend_space.ptr(), "set_blend_point_position", selected_point, point);
+ undo_redo->add_undo_method(blend_space.ptr(), "set_blend_point_position", selected_point, blend_space->get_blend_point_position(selected_point));
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->add_do_method(this, "_update_edited_point_pos");
+ undo_redo->add_undo_method(this, "_update_edited_point_pos");
+ undo_redo->commit_action();
+ updating = false;
+ _update_edited_point_pos();
+ }
+
+ dragging_selected_attempt = false;
+ dragging_selected = false;
+ blend_space_draw->update();
+ }
+
+ // *set* the blend
+ if (mb.is_valid() && !mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ float blend_pos = mb->get_position().x / blend_space_draw->get_size().x;
+ blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
+ blend_pos += blend_space->get_min_space();
+
+ blend_space->set_blend_pos(blend_pos);
+ blend_space_draw->update();
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid() && !blend_space_draw->has_focus()) {
+ blend_space_draw->grab_focus();
+ blend_space_draw->update();
+ }
+
+ if (mm.is_valid() && dragging_selected_attempt) {
+ dragging_selected = true;
+ drag_ofs = ((mm->get_position() - drag_from) / blend_space_draw->get_size()) * ((blend_space->get_max_space() - blend_space->get_min_space()) * Vector2(1, 0));
+ blend_space_draw->update();
+ _update_edited_point_pos();
+ }
+
+ if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
+ float blend_pos = mm->get_position().x / blend_space_draw->get_size().x;
+ blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
+ blend_pos += blend_space->get_min_space();
+
+ blend_space->set_blend_pos(blend_pos);
+ blend_space_draw->update();
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_blend_space_draw() {
+
+ Color linecolor = get_color("font_color", "Label");
+ Color linecolor_soft = linecolor;
+ linecolor_soft.a *= 0.5;
+
+ Ref<Font> font = get_font("font", "Label");
+ Ref<Texture> icon = get_icon("KeyValue", "EditorIcons");
+ Ref<Texture> icon_selected = get_icon("KeySelected", "EditorIcons");
+
+ Size2 s = blend_space_draw->get_size();
+
+ if (blend_space_draw->has_focus()) {
+ Color color = get_color("accent_color", "Editor");
+ blend_space_draw->draw_rect(Rect2(Point2(), s), color, false);
+ }
+
+ blend_space_draw->draw_line(Point2(1, s.height - 1), Point2(s.width - 1, s.height - 1), linecolor);
+
+ if (blend_space->get_min_space() < 0) {
+ float point = 0.0;
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s.width;
+
+ float x = point;
+
+ blend_space_draw->draw_line(Point2(x, s.height - 1), Point2(x, s.height - 5 * EDSCALE), linecolor);
+ blend_space_draw->draw_string(font, Point2(x + 2 * EDSCALE, s.height - 2 * EDSCALE - font->get_height() + font->get_ascent()), "0", linecolor);
+ blend_space_draw->draw_line(Point2(x, s.height - 5 * EDSCALE), Point2(x, 0), linecolor_soft);
+ }
+
+ if (snap->is_pressed()) {
+
+ linecolor_soft.a = linecolor.a * 0.1;
+
+ if (blend_space->get_snap() > 0) {
+ int prev_idx = -1;
+
+ for (int i = 0; i < s.x; i++) {
+ float v = blend_space->get_min_space() + i * (blend_space->get_max_space() - blend_space->get_min_space()) / s.x;
+ int idx = int(v / blend_space->get_snap());
+
+ if (i > 0 && prev_idx != idx) {
+ blend_space_draw->draw_line(Point2(i, 0), Point2(i, s.height), linecolor_soft);
+ }
+
+ prev_idx = idx;
+ }
+ }
+ }
+
+ points.clear();
+
+ for (int i = 0; i < blend_space->get_blend_point_count(); i++) {
+ float point = blend_space->get_blend_point_position(i);
+
+ if (dragging_selected && selected_point == i) {
+ point += drag_ofs.x;
+ if (snap->is_pressed()) {
+ point = Math::stepify(point, blend_space->get_snap());
+ }
+ }
+
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s.width;
+
+ points.push_back(point);
+
+ Vector2 gui_point = Vector2(point, s.height / 2.0);
+
+ gui_point -= (icon->get_size() / 2.0);
+
+ gui_point = gui_point.floor();
+
+ if (i == selected_point) {
+ blend_space_draw->draw_texture(icon_selected, gui_point);
+ } else {
+ blend_space_draw->draw_texture(icon, gui_point);
+ }
+ }
+
+ // blend position
+ {
+ Color color;
+ if (tool_blend->is_pressed()) {
+ color = get_color("accent_color", "Editor");
+ } else {
+ color = linecolor;
+ color.a *= 0.5;
+ }
+
+ float point = blend_space->get_blend_pos();
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s.width;
+
+ Vector2 gui_point = Vector2(point, s.height / 2.0);
+
+ float mind = 5 * EDSCALE;
+ float maxd = 15 * EDSCALE;
+ blend_space_draw->draw_line(gui_point + Vector2(mind, 0), gui_point + Vector2(maxd, 0), color, 2);
+ blend_space_draw->draw_line(gui_point + Vector2(-mind, 0), gui_point + Vector2(-maxd, 0), color, 2);
+ blend_space_draw->draw_line(gui_point + Vector2(0, mind), gui_point + Vector2(0, maxd), color, 2);
+ blend_space_draw->draw_line(gui_point + Vector2(0, -mind), gui_point + Vector2(0, -maxd), color, 2);
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_update_space() {
+
+ if (updating)
+ return;
+
+ updating = true;
+
+ if (blend_space->get_parent().is_valid()) {
+ goto_parent_hb->show();
+ } else {
+ goto_parent_hb->hide();
+ }
+
+ max_value->set_value(blend_space->get_max_space());
+ min_value->set_value(blend_space->get_min_space());
+
+ label_value->set_text(blend_space->get_value_label());
+
+ snap_value->set_value(blend_space->get_snap());
+
+ blend_space_draw->update();
+
+ updating = false;
+}
+
+void AnimationNodeBlendSpace1DEditor::_config_changed(double) {
+ if (updating)
+ return;
+
+ updating = true;
+ undo_redo->create_action("Change BlendSpace1D Limits");
+ undo_redo->add_do_method(blend_space.ptr(), "set_max_space", max_value->get_value());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_max_space", blend_space->get_max_space());
+ undo_redo->add_do_method(blend_space.ptr(), "set_min_space", min_value->get_value());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_min_space", blend_space->get_min_space());
+ undo_redo->add_do_method(blend_space.ptr(), "set_snap", snap_value->get_value());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_snap", blend_space->get_snap());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace1DEditor::_labels_changed(String) {
+ if (updating)
+ return;
+
+ updating = true;
+ undo_redo->create_action("Change BlendSpace1D Labels", UndoRedo::MERGE_ENDS);
+ undo_redo->add_do_method(blend_space.ptr(), "set_value_label", label_value->get_text());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_value_label", blend_space->get_value_label());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+}
+
+void AnimationNodeBlendSpace1DEditor::_snap_toggled() {
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace1DEditor::_add_menu_type(int p_index) {
+ String type = menu->get_item_metadata(p_index);
+
+ Object *obj = ClassDB::instance(type);
+ ERR_FAIL_COND(!obj);
+ AnimationNode *an = Object::cast_to<AnimationNode>(obj);
+ ERR_FAIL_COND(!an);
+
+ Ref<AnimationNode> node(an);
+
+ updating = true;
+ undo_redo->create_action("Add Node Point");
+ undo_redo->add_do_method(blend_space.ptr(), "add_blend_point", node, add_point_pos);
+ undo_redo->add_undo_method(blend_space.ptr(), "remove_blend_point", blend_space->get_blend_point_count());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace1DEditor::_add_animation_type(int p_index) {
+ Ref<AnimationNodeAnimation> anim;
+ anim.instance();
+
+ anim->set_animation(animations_to_add[p_index]);
+
+ updating = true;
+ undo_redo->create_action("Add Animation Point");
+ undo_redo->add_do_method(blend_space.ptr(), "add_blend_point", anim, add_point_pos);
+ undo_redo->add_undo_method(blend_space.ptr(), "remove_blend_point", blend_space->get_blend_point_count());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace1DEditor::_tool_switch(int p_tool) {
+
+ if (p_tool == 0) {
+ tool_erase->show();
+ tool_erase_sep->show();
+ } else {
+ tool_erase->hide();
+ tool_erase_sep->hide();
+ }
+
+ _update_tool_erase();
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace1DEditor::_update_edited_point_pos() {
+ if (updating)
+ return;
+
+ if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) {
+ float pos = blend_space->get_blend_point_position(selected_point);
+
+ if (dragging_selected) {
+ pos += drag_ofs.x;
+
+ if (snap->is_pressed()) {
+ pos = Math::stepify(pos, blend_space->get_snap());
+ }
+ }
+
+ updating = true;
+ edit_value->set_value(pos);
+ updating = false;
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_update_tool_erase() {
+
+ bool point_valid = selected_point >= 0 && selected_point < blend_space->get_blend_point_count();
+ tool_erase->set_disabled(!point_valid);
+
+ if (point_valid) {
+ Ref<AnimationNode> an = blend_space->get_blend_point_node(selected_point);
+
+ if (EditorNode::get_singleton()->item_has_editor(an.ptr())) {
+ open_editor->show();
+ } else {
+ open_editor->hide();
+ }
+
+ edit_hb->show();
+ } else {
+ edit_hb->hide();
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_erase_selected() {
+ if (selected_point != -1) {
+ updating = true;
+
+ undo_redo->create_action("Remove BlendSpace1D Point");
+ undo_redo->add_do_method(blend_space.ptr(), "remove_blend_point", selected_point);
+ undo_redo->add_undo_method(blend_space.ptr(), "add_blend_point", blend_space->get_blend_point_node(selected_point), blend_space->get_blend_point_position(selected_point), selected_point);
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+
+ updating = false;
+
+ blend_space_draw->update();
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_edit_point_pos(double) {
+ if (updating)
+ return;
+
+ updating = true;
+ undo_redo->create_action("Move BlendSpace1D Node Point");
+ undo_redo->add_do_method(blend_space.ptr(), "set_blend_point_position", selected_point, edit_value->get_value());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_blend_point_position", selected_point, blend_space->get_blend_point_position(selected_point));
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->add_do_method(this, "_update_edited_point_pos");
+ undo_redo->add_undo_method(this, "_update_edited_point_pos");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace1DEditor::_open_editor() {
+
+ if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) {
+ Ref<AnimationNode> an = blend_space->get_blend_point_node(selected_point);
+ ERR_FAIL_COND(an.is_null());
+ EditorNode::get_singleton()->edit_item(an.ptr());
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_goto_parent() {
+ EditorNode::get_singleton()->edit_item(blend_space->get_parent().ptr());
+}
+
+void AnimationNodeBlendSpace1DEditor::_removed_from_graph() {
+ EditorNode::get_singleton()->edit_item(NULL);
+}
+
+void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ error_label->add_color_override("font_color", get_color("error_color", "Editor"));
+ panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ tool_blend->set_icon(get_icon("EditPivot", "EditorIcons"));
+ tool_select->set_icon(get_icon("ToolSelect", "EditorIcons"));
+ tool_create->set_icon(get_icon("EditKey", "EditorIcons"));
+ tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
+ snap->set_icon(get_icon("SnapGrid", "EditorIcons"));
+ open_editor->set_icon(get_icon("Edit", "EditorIcons"));
+ goto_parent->set_icon(get_icon("MoveUp", "EditorIcons"));
+ }
+
+ if (p_what == NOTIFICATION_PROCESS) {
+ String error;
+
+ if (!blend_space->get_tree()) {
+ error = TTR("BlendSpace1D does not belong to an AnimationTree node.");
+ } else if (!blend_space->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (blend_space->get_tree()->is_state_invalid()) {
+ error = blend_space->get_tree()->get_invalid_state_reason();
+ }
+
+ if (error != error_label->get_text()) {
+ error_label->set_text(error);
+ if (error != String()) {
+ error_panel->show();
+ } else {
+ error_panel->hide();
+ }
+ }
+ }
+}
+
+void AnimationNodeBlendSpace1DEditor::_bind_methods() {
+ ClassDB::bind_method("_blend_space_gui_input", &AnimationNodeBlendSpace1DEditor::_blend_space_gui_input);
+ ClassDB::bind_method("_blend_space_draw", &AnimationNodeBlendSpace1DEditor::_blend_space_draw);
+ ClassDB::bind_method("_config_changed", &AnimationNodeBlendSpace1DEditor::_config_changed);
+ ClassDB::bind_method("_labels_changed", &AnimationNodeBlendSpace1DEditor::_labels_changed);
+ ClassDB::bind_method("_update_space", &AnimationNodeBlendSpace1DEditor::_update_space);
+ ClassDB::bind_method("_snap_toggled", &AnimationNodeBlendSpace1DEditor::_snap_toggled);
+ ClassDB::bind_method("_tool_switch", &AnimationNodeBlendSpace1DEditor::_tool_switch);
+ ClassDB::bind_method("_erase_selected", &AnimationNodeBlendSpace1DEditor::_erase_selected);
+ ClassDB::bind_method("_update_tool_erase", &AnimationNodeBlendSpace1DEditor::_update_tool_erase);
+ ClassDB::bind_method("_edit_point_pos", &AnimationNodeBlendSpace1DEditor::_edit_point_pos);
+
+ ClassDB::bind_method("_add_menu_type", &AnimationNodeBlendSpace1DEditor::_add_menu_type);
+ ClassDB::bind_method("_add_animation_type", &AnimationNodeBlendSpace1DEditor::_add_animation_type);
+
+ ClassDB::bind_method("_update_edited_point_pos", &AnimationNodeBlendSpace1DEditor::_update_edited_point_pos);
+
+ ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace1DEditor::_open_editor);
+ ClassDB::bind_method("_goto_parent", &AnimationNodeBlendSpace1DEditor::_goto_parent);
+
+ ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace1DEditor::_removed_from_graph);
+}
+
+void AnimationNodeBlendSpace1DEditor::edit(AnimationNodeBlendSpace1D *p_blend_space) {
+
+ if (blend_space.is_valid()) {
+ blend_space->disconnect("removed_from_graph", this, "_removed_from_graph");
+ }
+
+ if (p_blend_space) {
+ blend_space = Ref<AnimationNodeBlendSpace1D>(p_blend_space);
+ } else {
+ blend_space.unref();
+ }
+
+ if (blend_space.is_null()) {
+ hide();
+ } else {
+ blend_space->connect("removed_from_graph", this, "_removed_from_graph");
+
+ _update_space();
+ }
+}
+
+AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = NULL;
+
+AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
+ singleton = this;
+ updating = false;
+
+ HBoxContainer *top_hb = memnew(HBoxContainer);
+ add_child(top_hb);
+
+ Ref<ButtonGroup> bg;
+ bg.instance();
+
+ goto_parent_hb = memnew(HBoxContainer);
+ top_hb->add_child(goto_parent_hb);
+
+ goto_parent = memnew(ToolButton);
+ goto_parent->connect("pressed", this, "_goto_parent", varray(), CONNECT_DEFERRED);
+ goto_parent_hb->add_child(goto_parent);
+ goto_parent_hb->add_child(memnew(VSeparator));
+ goto_parent_hb->hide();
+
+ tool_blend = memnew(ToolButton);
+ tool_blend->set_toggle_mode(true);
+ tool_blend->set_button_group(bg);
+ top_hb->add_child(tool_blend);
+ tool_blend->set_pressed(true);
+ tool_blend->set_tooltip(TTR("Set the blending position within the space"));
+ tool_blend->connect("pressed", this, "_tool_switch", varray(3));
+
+ tool_select = memnew(ToolButton);
+ tool_select->set_toggle_mode(true);
+ tool_select->set_button_group(bg);
+ top_hb->add_child(tool_select);
+ tool_select->set_tooltip(TTR("Select and move points, create points with RMB."));
+ tool_select->connect("pressed", this, "_tool_switch", varray(0));
+
+ tool_create = memnew(ToolButton);
+ tool_create->set_toggle_mode(true);
+ tool_create->set_button_group(bg);
+ top_hb->add_child(tool_create);
+ tool_create->set_tooltip(TTR("Create points."));
+ tool_create->connect("pressed", this, "_tool_switch", varray(1));
+
+ tool_erase_sep = memnew(VSeparator);
+ top_hb->add_child(tool_erase_sep);
+ tool_erase = memnew(ToolButton);
+ top_hb->add_child(tool_erase);
+ tool_erase->set_tooltip(TTR("Erase points."));
+ tool_erase->connect("pressed", this, "_erase_selected");
+
+ top_hb->add_child(memnew(VSeparator));
+
+ snap = memnew(ToolButton);
+ snap->set_toggle_mode(true);
+ top_hb->add_child(snap);
+ snap->set_pressed(true);
+ snap->connect("pressed", this, "_snap_toggled");
+
+ snap_value = memnew(SpinBox);
+ top_hb->add_child(snap_value);
+ snap_value->set_min(0.01);
+ snap_value->set_step(0.01);
+ snap_value->set_max(1000);
+
+ edit_hb = memnew(HBoxContainer);
+ top_hb->add_child(edit_hb);
+ edit_hb->add_child(memnew(VSeparator));
+ edit_hb->add_child(memnew(Label(TTR("Point"))));
+
+ edit_value = memnew(SpinBox);
+ edit_hb->add_child(edit_value);
+ edit_value->set_min(-1000);
+ edit_value->set_max(1000);
+ edit_value->set_step(0.01);
+ edit_value->connect("value_changed", this, "_edit_point_pos");
+
+ open_editor = memnew(Button);
+ edit_hb->add_child(open_editor);
+ open_editor->set_text(TTR("Open Editor"));
+ open_editor->connect("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED);
+
+ edit_hb->hide();
+ open_editor->hide();
+
+ VBoxContainer *main_vb = memnew(VBoxContainer);
+ add_child(main_vb);
+ main_vb->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ panel = memnew(PanelContainer);
+ panel->set_clip_contents(true);
+ main_vb->add_child(panel);
+ panel->set_h_size_flags(SIZE_EXPAND_FILL);
+ panel->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ blend_space_draw = memnew(Control);
+ blend_space_draw->connect("gui_input", this, "_blend_space_gui_input");
+ blend_space_draw->connect("draw", this, "_blend_space_draw");
+ blend_space_draw->set_focus_mode(FOCUS_ALL);
+
+ panel->add_child(blend_space_draw);
+
+ {
+ HBoxContainer *bottom_hb = memnew(HBoxContainer);
+ main_vb->add_child(bottom_hb);
+ bottom_hb->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ min_value = memnew(SpinBox);
+ min_value->set_max(0);
+ min_value->set_min(-10000);
+ min_value->set_step(0.01);
+
+ max_value = memnew(SpinBox);
+ max_value->set_max(10000);
+ max_value->set_min(0.01);
+ max_value->set_step(0.01);
+
+ label_value = memnew(LineEdit);
+ label_value->set_expand_to_text_length(true);
+
+ // now add
+
+ bottom_hb->add_child(min_value);
+ bottom_hb->add_spacer();
+ bottom_hb->add_child(label_value);
+ bottom_hb->add_spacer();
+ bottom_hb->add_child(max_value);
+ }
+
+ snap_value->connect("value_changed", this, "_config_changed");
+ min_value->connect("value_changed", this, "_config_changed");
+ max_value->connect("value_changed", this, "_config_changed");
+ label_value->connect("text_changed", this, "_labels_changed");
+
+ error_panel = memnew(PanelContainer);
+ add_child(error_panel);
+
+ error_label = memnew(Label);
+ error_panel->add_child(error_label);
+ error_label->set_text("hmmm");
+
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("index_pressed", this, "_add_menu_type");
+
+ animations_menu = memnew(PopupMenu);
+ menu->add_child(animations_menu);
+ animations_menu->set_name("animations");
+ animations_menu->connect("index_pressed", this, "_add_animation_type");
+
+ selected_point = -1;
+ dragging_selected = false;
+ dragging_selected_attempt = false;
+
+ set_custom_minimum_size(Size2(0, 150 * EDSCALE));
+}
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
new file mode 100644
index 0000000000..52139626e6
--- /dev/null
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -0,0 +1,117 @@
+#ifndef ANIMATION_BLEND_SPACE_1D_EDITOR_H
+#define ANIMATION_BLEND_SPACE_1D_EDITOR_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "editor/property_editor.h"
+#include "scene/animation/animation_blend_space_1d.h"
+#include "scene/gui/button.h"
+#include "scene/gui/graph_edit.h"
+#include "scene/gui/popup.h"
+#include "scene/gui/tree.h"
+
+class AnimationNodeBlendSpace1DEditor : public VBoxContainer {
+
+ GDCLASS(AnimationNodeBlendSpace1DEditor, VBoxContainer)
+
+ Ref<AnimationNodeBlendSpace1D> blend_space;
+
+ HBoxContainer *goto_parent_hb;
+ ToolButton *goto_parent;
+
+ PanelContainer *panel;
+ ToolButton *tool_blend;
+ ToolButton *tool_select;
+ ToolButton *tool_create;
+ VSeparator *tool_erase_sep;
+ ToolButton *tool_erase;
+ ToolButton *snap;
+ SpinBox *snap_value;
+
+ LineEdit *label_value;
+ SpinBox *max_value;
+ SpinBox *min_value;
+
+ HBoxContainer *edit_hb;
+ SpinBox *edit_value;
+ Button *open_editor;
+
+ int selected_point;
+
+ Control *blend_space_draw;
+
+ PanelContainer *error_panel;
+ Label *error_label;
+
+ bool updating;
+
+ UndoRedo *undo_redo;
+
+ static AnimationNodeBlendSpace1DEditor *singleton;
+
+ void _blend_space_gui_input(const Ref<InputEvent> &p_event);
+ void _blend_space_draw();
+
+ void _update_space();
+
+ void _config_changed(double);
+ void _labels_changed(String);
+ void _snap_toggled();
+
+ PopupMenu *menu;
+ PopupMenu *animations_menu;
+ Vector<String> animations_to_add;
+ float add_point_pos;
+ Vector<float> points;
+
+ bool dragging_selected_attempt;
+ bool dragging_selected;
+ Vector2 drag_from;
+ Vector2 drag_ofs;
+
+ void _add_menu_type(int p_index);
+ void _add_animation_type(int p_index);
+
+ void _tool_switch(int p_tool);
+ void _update_edited_point_pos();
+ void _update_tool_erase();
+ void _erase_selected();
+ void _edit_point_pos(double);
+ void _open_editor();
+
+ void _goto_parent();
+
+ void _removed_from_graph();
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ static AnimationNodeBlendSpace1DEditor *get_singleton() { return singleton; }
+ void edit(AnimationNodeBlendSpace1D *p_blend_space);
+ AnimationNodeBlendSpace1DEditor();
+};
+
+class AnimationNodeBlendSpace1DEditorPlugin : public EditorPlugin {
+
+ GDCLASS(AnimationNodeBlendSpace1DEditorPlugin, EditorPlugin)
+
+ AnimationNodeBlendSpace1DEditor *anim_tree_editor;
+ EditorNode *editor;
+ Button *button;
+
+public:
+ virtual String get_name() const { return "BlendSpace1D"; }
+
+ bool has_main_screen() const { return false; }
+
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ AnimationNodeBlendSpace1DEditorPlugin(EditorNode *p_node);
+ ~AnimationNodeBlendSpace1DEditorPlugin();
+};
+
+#endif // ANIMATION_BLEND_SPACE_1D_EDITOR_H
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
new file mode 100644
index 0000000000..8d17062248
--- /dev/null
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -0,0 +1,1023 @@
+#include "animation_blend_space_2d_editor.h"
+
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
+#include "math/delaunay.h"
+#include "os/input.h"
+#include "os/keyboard.h"
+#include "scene/animation/animation_blend_tree.h"
+#include "scene/animation/animation_player.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/panel.h"
+#include "scene/main/viewport.h"
+
+void AnimationNodeBlendSpace2DEditor::edit(AnimationNodeBlendSpace2D *p_blend_space) {
+
+ if (blend_space.is_valid()) {
+ blend_space->disconnect("removed_from_graph", this, "_removed_from_graph");
+ }
+
+ if (p_blend_space) {
+ blend_space = Ref<AnimationNodeBlendSpace2D>(p_blend_space);
+ } else {
+ blend_space.unref();
+ }
+
+ if (blend_space.is_null()) {
+ hide();
+ } else {
+ blend_space->connect("removed_from_graph", this, "_removed_from_graph");
+
+ _update_space();
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventKey> k = p_event;
+ if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (selected_point != -1 || selected_triangle != -1) {
+ _erase_selected();
+ accept_event();
+ }
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (mb->get_button_index() == BUTTON_LEFT && tool_create->is_pressed()))) {
+ menu->clear();
+ animations_menu->clear();
+ animations_to_add.clear();
+ List<StringName> classes;
+ classes.sort_custom<StringName::AlphCompare>();
+
+ ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
+ menu->add_submenu_item(TTR("Add Animation"), "animations");
+
+ AnimationTree *gp = blend_space->get_tree();
+ ERR_FAIL_COND(!gp);
+ if (gp && gp->has_node(gp->get_animation_player())) {
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(gp->get_node(gp->get_animation_player()));
+ if (ap) {
+ List<StringName> names;
+ ap->get_animation_list(&names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get());
+ animations_to_add.push_back(E->get());
+ }
+ }
+ }
+
+ for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
+
+ String name = String(E->get()).replace_first("AnimationNode", "");
+ if (name == "Animation")
+ continue; // nope
+ int idx = menu->get_item_count();
+ menu->add_item(vformat("Add %s", name));
+ menu->set_item_metadata(idx, E->get());
+ }
+
+ menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position()));
+ menu->popup();
+ add_point_pos = (mb->get_position() / blend_space_draw->get_size());
+ add_point_pos.y = 1.0 - add_point_pos.y;
+ add_point_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
+ add_point_pos += blend_space->get_min_space();
+
+ if (snap->is_pressed()) {
+ add_point_pos.x = Math::stepify(add_point_pos.x, blend_space->get_snap().x);
+ add_point_pos.y = Math::stepify(add_point_pos.y, blend_space->get_snap().y);
+ }
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ blend_space_draw->update(); //update anyway
+ //try to see if a point can be selected
+ selected_point = -1;
+ selected_triangle = -1;
+ _update_tool_erase();
+
+ for (int i = 0; i < points.size(); i++) {
+
+ if (points[i].distance_to(mb->get_position()) < 10 * EDSCALE) {
+ selected_point = i;
+ Ref<AnimationNode> node = blend_space->get_blend_point_node(i);
+ EditorNode::get_singleton()->push_item(node.ptr(), "", true);
+ dragging_selected_attempt = true;
+ drag_from = mb->get_position();
+ _update_tool_erase();
+ _update_edited_point_pos();
+ return;
+ }
+ }
+
+ //then try to see if a triangle can be selected
+ if (!blend_space->get_auto_triangles()) { //if autotriangles use, disable this
+ for (int i = 0; i < blend_space->get_triangle_count(); i++) {
+ Vector<Vector2> triangle;
+
+ for (int j = 0; j < 3; j++) {
+ int idx = blend_space->get_triangle_point(i, j);
+ ERR_FAIL_INDEX(idx, points.size());
+ triangle.push_back(points[idx]);
+ }
+
+ if (Geometry::is_point_in_triangle(mb->get_position(), triangle[0], triangle[1], triangle[2])) {
+ selected_triangle = i;
+ _update_tool_erase();
+ return;
+ }
+ }
+ }
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ blend_space_draw->update(); //update anyway
+ //try to see if a point can be selected
+ selected_point = -1;
+
+ for (int i = 0; i < points.size(); i++) {
+
+ if (making_triangle.find(i) != -1)
+ continue;
+
+ if (points[i].distance_to(mb->get_position()) < 10 * EDSCALE) {
+ making_triangle.push_back(i);
+ if (making_triangle.size() == 3) {
+ //add triangle!
+ if (blend_space->has_triangle(making_triangle[0], making_triangle[1], making_triangle[2])) {
+ making_triangle.clear();
+ EditorNode::get_singleton()->show_warning(TTR("Triangle already exists"));
+ return;
+ }
+
+ updating = true;
+ undo_redo->create_action("Add Triangle");
+ undo_redo->add_do_method(blend_space.ptr(), "add_triangle", making_triangle[0], making_triangle[1], making_triangle[2]);
+ undo_redo->add_undo_method(blend_space.ptr(), "remove_triangle", blend_space->get_triangle_count());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+ making_triangle.clear();
+ }
+ return;
+ }
+ }
+ }
+
+ if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT) {
+ if (dragging_selected) {
+ //move
+ Vector2 point = blend_space->get_blend_point_position(selected_point);
+ point += drag_ofs;
+ if (snap->is_pressed()) {
+ point.x = Math::stepify(point.x, blend_space->get_snap().x);
+ point.y = Math::stepify(point.y, blend_space->get_snap().y);
+ }
+
+ updating = true;
+ undo_redo->create_action("Move Node Point");
+ undo_redo->add_do_method(blend_space.ptr(), "set_blend_point_position", selected_point, point);
+ undo_redo->add_undo_method(blend_space.ptr(), "set_blend_point_position", selected_point, blend_space->get_blend_point_position(selected_point));
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->add_do_method(this, "_update_edited_point_pos");
+ undo_redo->add_undo_method(this, "_update_edited_point_pos");
+ undo_redo->commit_action();
+ updating = false;
+ _update_edited_point_pos();
+ }
+ dragging_selected_attempt = false;
+ dragging_selected = false;
+ blend_space_draw->update();
+ }
+
+ if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ Vector2 blend_pos = (mb->get_position() / blend_space_draw->get_size());
+ blend_pos.y = 1.0 - blend_pos.y;
+ blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
+ blend_pos += blend_space->get_min_space();
+
+ blend_space->set_blend_position(blend_pos);
+ blend_space_draw->update();
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid() && !blend_space_draw->has_focus()) {
+ blend_space_draw->grab_focus();
+ blend_space_draw->update();
+ }
+
+ if (mm.is_valid() && dragging_selected_attempt) {
+ dragging_selected = true;
+ drag_ofs = ((mm->get_position() - drag_from) / blend_space_draw->get_size()) * (blend_space->get_max_space() - blend_space->get_min_space()) * Vector2(1, -1);
+ blend_space_draw->update();
+ _update_edited_point_pos();
+ }
+
+ if (mm.is_valid() && tool_triangle->is_pressed() && making_triangle.size()) {
+ blend_space_draw->update();
+ }
+
+ if (mm.is_valid() && !tool_triangle->is_pressed() && making_triangle.size()) {
+ making_triangle.clear();
+ blend_space_draw->update();
+ }
+
+ if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
+
+ Vector2 blend_pos = (mm->get_position() / blend_space_draw->get_size());
+ blend_pos.y = 1.0 - blend_pos.y;
+ blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
+ blend_pos += blend_space->get_min_space();
+
+ blend_space->set_blend_position(blend_pos);
+ blend_space_draw->update();
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_add_menu_type(int p_index) {
+
+ String type = menu->get_item_metadata(p_index);
+
+ Object *obj = ClassDB::instance(type);
+ ERR_FAIL_COND(!obj);
+ AnimationNode *an = Object::cast_to<AnimationNode>(obj);
+ ERR_FAIL_COND(!an);
+
+ Ref<AnimationNode> node(an);
+
+ updating = true;
+ undo_redo->create_action("Add Node Point");
+ undo_redo->add_do_method(blend_space.ptr(), "add_blend_point", node, add_point_pos);
+ undo_redo->add_undo_method(blend_space.ptr(), "remove_blend_point", blend_space->get_blend_point_count());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace2DEditor::_add_animation_type(int p_index) {
+
+ Ref<AnimationNodeAnimation> anim;
+ anim.instance();
+
+ anim->set_animation(animations_to_add[p_index]);
+
+ updating = true;
+ undo_redo->create_action("Add Animation Point");
+ undo_redo->add_do_method(blend_space.ptr(), "add_blend_point", anim, add_point_pos);
+ undo_redo->add_undo_method(blend_space.ptr(), "remove_blend_point", blend_space->get_blend_point_count());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace2DEditor::_update_tool_erase() {
+ tool_erase->set_disabled(!(selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) && !(selected_triangle >= 0 && selected_triangle < blend_space->get_triangle_count()));
+ if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) {
+ Ref<AnimationNode> an = blend_space->get_blend_point_node(selected_point);
+ if (EditorNode::get_singleton()->item_has_editor(an.ptr())) {
+ open_editor->show();
+ } else {
+ open_editor->hide();
+ }
+ edit_hb->show();
+ } else {
+ edit_hb->hide();
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_tool_switch(int p_tool) {
+ making_triangle.clear();
+
+ if (p_tool == 2) {
+ Vector<Vector2> points;
+ for (int i = 0; i < blend_space->get_blend_point_count(); i++) {
+ points.push_back(blend_space->get_blend_point_position(i));
+ }
+ Vector<Delaunay2D::Triangle> tr = Delaunay2D::triangulate(points);
+ print_line("triangleS: " + itos(tr.size()));
+ for (int i = 0; i < tr.size(); i++) {
+ blend_space->add_triangle(tr[i].points[0], tr[i].points[1], tr[i].points[2]);
+ }
+ }
+
+ if (p_tool == 0) {
+ tool_erase->show();
+ tool_erase_sep->show();
+ } else {
+ tool_erase->hide();
+ tool_erase_sep->hide();
+ }
+ _update_tool_erase();
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
+
+ Color linecolor = get_color("font_color", "Label");
+ Color linecolor_soft = linecolor;
+ linecolor_soft.a *= 0.5;
+ Ref<Font> font = get_font("font", "Label");
+ Ref<Texture> icon = get_icon("KeyValue", "EditorIcons");
+ Ref<Texture> icon_selected = get_icon("KeySelected", "EditorIcons");
+
+ Size2 s = blend_space_draw->get_size();
+
+ if (blend_space_draw->has_focus()) {
+ Color color = get_color("accent_color", "Editor");
+ blend_space_draw->draw_rect(Rect2(Point2(), s), color, false);
+ }
+ blend_space_draw->draw_line(Point2(1, 0), Point2(1, s.height - 1), linecolor);
+ blend_space_draw->draw_line(Point2(1, s.height - 1), Point2(s.width - 1, s.height - 1), linecolor);
+
+ blend_space_draw->draw_line(Point2(0, 0), Point2(5 * EDSCALE, 0), linecolor);
+ if (blend_space->get_min_space().y < 0) {
+ int y = (blend_space->get_max_space().y / (blend_space->get_max_space().y - blend_space->get_min_space().y)) * s.height;
+ blend_space_draw->draw_line(Point2(0, y), Point2(5 * EDSCALE, y), linecolor);
+ blend_space_draw->draw_string(font, Point2(2 * EDSCALE, y - font->get_height() + font->get_ascent()), "0", linecolor);
+ blend_space_draw->draw_line(Point2(5 * EDSCALE, y), Point2(s.width, y), linecolor_soft);
+ }
+
+ if (blend_space->get_min_space().x < 0) {
+ int x = (-blend_space->get_min_space().x / (blend_space->get_max_space().x - blend_space->get_min_space().x)) * s.width;
+ blend_space_draw->draw_line(Point2(x, s.height - 1), Point2(x, s.height - 5 * EDSCALE), linecolor);
+ blend_space_draw->draw_string(font, Point2(x + 2 * EDSCALE, s.height - 2 * EDSCALE - font->get_height() + font->get_ascent()), "0", linecolor);
+ blend_space_draw->draw_line(Point2(x, s.height - 5 * EDSCALE), Point2(x, 0), linecolor_soft);
+ }
+
+ if (snap->is_pressed()) {
+
+ linecolor_soft.a = linecolor.a * 0.1;
+
+ if (blend_space->get_snap().x > 0) {
+
+ int prev_idx;
+ for (int i = 0; i < s.x; i++) {
+
+ float v = blend_space->get_min_space().x + i * (blend_space->get_max_space().x - blend_space->get_min_space().x) / s.x;
+ int idx = int(v / blend_space->get_snap().x);
+
+ if (i > 0 && prev_idx != idx) {
+ blend_space_draw->draw_line(Point2(i, 0), Point2(i, s.height), linecolor_soft);
+ }
+
+ prev_idx = idx;
+ }
+ }
+
+ if (blend_space->get_snap().y > 0) {
+
+ int prev_idx;
+ for (int i = 0; i < s.y; i++) {
+
+ float v = blend_space->get_max_space().y - i * (blend_space->get_max_space().y - blend_space->get_min_space().y) / s.y;
+ int idx = int(v / blend_space->get_snap().y);
+
+ if (i > 0 && prev_idx != idx) {
+ blend_space_draw->draw_line(Point2(0, i), Point2(s.width, i), linecolor_soft);
+ }
+
+ prev_idx = idx;
+ }
+ }
+ }
+
+ //triangles first
+ for (int i = 0; i < blend_space->get_triangle_count(); i++) {
+
+ Vector<Vector2> points;
+ points.resize(3);
+
+ for (int j = 0; j < 3; j++) {
+ int point_idx = blend_space->get_triangle_point(i, j);
+ Vector2 point = blend_space->get_blend_point_position(point_idx);
+ if (dragging_selected && selected_point == point_idx) {
+ point += drag_ofs;
+ if (snap->is_pressed()) {
+ point.x = Math::stepify(point.x, blend_space->get_snap().x);
+ point.y = Math::stepify(point.y, blend_space->get_snap().y);
+ }
+ }
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s;
+ point.y = s.height - point.y;
+ points[j] = point;
+ }
+
+ for (int j = 0; j < 3; j++) {
+ blend_space_draw->draw_line(points[j], points[(j + 1) % 3], linecolor, 1, true);
+ }
+
+ Color color;
+ if (i == selected_triangle) {
+ color = get_color("accent_color", "Editor");
+ color.a *= 0.5;
+ } else {
+ color = linecolor;
+ color.a *= 0.2;
+ }
+
+ Vector<Color> colors;
+ colors.push_back(color);
+ colors.push_back(color);
+ colors.push_back(color);
+ blend_space_draw->draw_primitive(points, colors, Vector<Vector2>());
+ }
+
+ points.clear();
+ for (int i = 0; i < blend_space->get_blend_point_count(); i++) {
+
+ Vector2 point = blend_space->get_blend_point_position(i);
+ if (dragging_selected && selected_point == i) {
+ point += drag_ofs;
+ if (snap->is_pressed()) {
+ point.x = Math::stepify(point.x, blend_space->get_snap().x);
+ point.y = Math::stepify(point.y, blend_space->get_snap().y);
+ }
+ }
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s;
+ point.y = s.height - point.y;
+
+ points.push_back(point);
+ point -= (icon->get_size() / 2);
+ point = point.floor();
+
+ if (i == selected_point) {
+ blend_space_draw->draw_texture(icon_selected, point);
+ } else {
+ blend_space_draw->draw_texture(icon, point);
+ }
+ }
+
+ if (making_triangle.size()) {
+ Vector<Vector2> points;
+ for (int i = 0; i < making_triangle.size(); i++) {
+ Vector2 point = blend_space->get_blend_point_position(making_triangle[i]);
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s;
+ point.y = s.height - point.y;
+ points.push_back(point);
+ }
+
+ for (int i = 0; i < points.size() - 1; i++) {
+ blend_space_draw->draw_line(points[i], points[i + 1], linecolor, 2, true);
+ }
+ blend_space_draw->draw_line(points[points.size() - 1], blend_space_draw->get_local_mouse_position(), linecolor, 2, true);
+ }
+
+ ///draw cursor position
+
+ {
+ Color color;
+ if (tool_blend->is_pressed()) {
+ color = get_color("accent_color", "Editor");
+ } else {
+ color = linecolor;
+ color.a *= 0.5;
+ }
+
+ Vector2 point = blend_space->get_blend_position();
+ point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ point *= s;
+ point.y = s.height - point.y;
+
+ if (blend_space->get_triangle_count()) {
+ Vector2 closest = blend_space->get_closest_point(blend_space->get_blend_position());
+ closest = (closest - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
+ closest *= s;
+ closest.y = s.height - closest.y;
+
+ Color lcol = color;
+ lcol.a *= 0.4;
+ blend_space_draw->draw_line(point, closest, lcol, 2);
+ }
+
+ float mind = 5 * EDSCALE;
+ float maxd = 15 * EDSCALE;
+ blend_space_draw->draw_line(point + Vector2(mind, 0), point + Vector2(maxd, 0), color, 2);
+ blend_space_draw->draw_line(point + Vector2(-mind, 0), point + Vector2(-maxd, 0), color, 2);
+ blend_space_draw->draw_line(point + Vector2(0, mind), point + Vector2(0, maxd), color, 2);
+ blend_space_draw->draw_line(point + Vector2(0, -mind), point + Vector2(0, -maxd), color, 2);
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_snap_toggled() {
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace2DEditor::_update_space() {
+
+ if (updating)
+ return;
+
+ updating = true;
+
+ if (blend_space->get_parent().is_valid()) {
+ goto_parent_hb->show();
+ } else {
+ goto_parent_hb->hide();
+ }
+
+ if (blend_space->get_auto_triangles()) {
+ tool_triangle->hide();
+ } else {
+ tool_triangle->show();
+ }
+
+ auto_triangles->set_pressed(blend_space->get_auto_triangles());
+
+ max_x_value->set_value(blend_space->get_max_space().x);
+ max_y_value->set_value(blend_space->get_max_space().y);
+
+ min_x_value->set_value(blend_space->get_min_space().x);
+ min_y_value->set_value(blend_space->get_min_space().y);
+
+ label_x->set_text(blend_space->get_x_label());
+ label_y->set_text(blend_space->get_y_label());
+
+ snap_x->set_value(blend_space->get_snap().x);
+ snap_y->set_value(blend_space->get_snap().y);
+
+ blend_space_draw->update();
+
+ updating = false;
+}
+
+void AnimationNodeBlendSpace2DEditor::_config_changed(double) {
+ if (updating)
+ return;
+
+ updating = true;
+ undo_redo->create_action("Change BlendSpace2D Limits");
+ undo_redo->add_do_method(blend_space.ptr(), "set_max_space", Vector2(max_x_value->get_value(), max_y_value->get_value()));
+ undo_redo->add_undo_method(blend_space.ptr(), "set_max_space", blend_space->get_max_space());
+ undo_redo->add_do_method(blend_space.ptr(), "set_min_space", Vector2(min_x_value->get_value(), min_y_value->get_value()));
+ undo_redo->add_undo_method(blend_space.ptr(), "set_min_space", blend_space->get_min_space());
+ undo_redo->add_do_method(blend_space.ptr(), "set_snap", Vector2(snap_x->get_value(), snap_y->get_value()));
+ undo_redo->add_undo_method(blend_space.ptr(), "set_snap", blend_space->get_snap());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace2DEditor::_labels_changed(String) {
+ if (updating)
+ return;
+
+ updating = true;
+ undo_redo->create_action("Change BlendSpace2D Labels", UndoRedo::MERGE_ENDS);
+ undo_redo->add_do_method(blend_space.ptr(), "set_x_label", label_x->get_text());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_x_label", blend_space->get_x_label());
+ undo_redo->add_do_method(blend_space.ptr(), "set_y_label", label_y->get_text());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_y_label", blend_space->get_y_label());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+}
+
+void AnimationNodeBlendSpace2DEditor::_erase_selected() {
+
+ if (selected_point != -1) {
+
+ updating = true;
+ undo_redo->create_action("Remove BlendSpace2D Point");
+ undo_redo->add_do_method(blend_space.ptr(), "remove_blend_point", selected_point);
+ undo_redo->add_undo_method(blend_space.ptr(), "add_blend_point", blend_space->get_blend_point_node(selected_point), blend_space->get_blend_point_position(selected_point), selected_point);
+
+ //restore triangles using this point
+ for (int i = 0; i < blend_space->get_triangle_count(); i++) {
+ for (int j = 0; j < 3; j++) {
+ if (blend_space->get_triangle_point(i, j) == selected_point) {
+ undo_redo->add_undo_method(blend_space.ptr(), "add_triangle", blend_space->get_triangle_point(i, 0), blend_space->get_triangle_point(i, 1), blend_space->get_triangle_point(i, 2), i);
+ break;
+ }
+ }
+ }
+
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+ } else if (selected_triangle != -1) {
+
+ updating = true;
+ undo_redo->create_action("Remove BlendSpace2D Triangle");
+ undo_redo->add_do_method(blend_space.ptr(), "remove_triangle", selected_triangle);
+ undo_redo->add_undo_method(blend_space.ptr(), "add_triangle", blend_space->get_triangle_point(selected_triangle, 0), blend_space->get_triangle_point(selected_triangle, 1), blend_space->get_triangle_point(selected_triangle, 2), selected_triangle);
+
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_update_edited_point_pos() {
+ if (updating)
+ return;
+
+ if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) {
+ Vector2 pos = blend_space->get_blend_point_position(selected_point);
+ if (dragging_selected) {
+ pos += drag_ofs;
+ if (snap->is_pressed()) {
+ pos.x = Math::stepify(pos.x, blend_space->get_snap().x);
+ pos.y = Math::stepify(pos.y, blend_space->get_snap().y);
+ }
+ }
+ updating = true;
+ edit_x->set_value(pos.x);
+ edit_y->set_value(pos.y);
+ updating = false;
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_edit_point_pos(double) {
+ if (updating)
+ return;
+ updating = true;
+ undo_redo->create_action("Move Node Point");
+ undo_redo->add_do_method(blend_space.ptr(), "set_blend_point_position", selected_point, Vector2(edit_x->get_value(), edit_y->get_value()));
+ undo_redo->add_undo_method(blend_space.ptr(), "set_blend_point_position", selected_point, blend_space->get_blend_point_position(selected_point));
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->add_do_method(this, "_update_edited_point_pos");
+ undo_redo->add_undo_method(this, "_update_edited_point_pos");
+ undo_redo->commit_action();
+ updating = false;
+
+ blend_space_draw->update();
+}
+
+void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ error_label->add_color_override("font_color", get_color("error_color", "Editor"));
+ panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ tool_blend->set_icon(get_icon("EditPivot", "EditorIcons"));
+ tool_select->set_icon(get_icon("ToolSelect", "EditorIcons"));
+ tool_create->set_icon(get_icon("EditKey", "EditorIcons"));
+ tool_triangle->set_icon(get_icon("ToolTriangle", "EditorIcons"));
+ tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
+ snap->set_icon(get_icon("SnapGrid", "EditorIcons"));
+ open_editor->set_icon(get_icon("Edit", "EditorIcons"));
+ goto_parent->set_icon(get_icon("MoveUp", "EditorIcons"));
+ auto_triangles->set_icon(get_icon("AutoTriangle", "EditorIcons"));
+ }
+
+ if (p_what == NOTIFICATION_PROCESS) {
+
+ String error;
+
+ if (!blend_space->get_tree()) {
+ error = TTR("BlendSpace2D does not belong to an AnimationTree node.");
+ } else if (!blend_space->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (blend_space->get_tree()->is_state_invalid()) {
+ error = blend_space->get_tree()->get_invalid_state_reason();
+ } else if (blend_space->get_triangle_count() == 0) {
+ error = TTR("No triangles exist, so no blending can take place.");
+ }
+
+ if (error != error_label->get_text()) {
+ error_label->set_text(error);
+ if (error != String()) {
+ error_panel->show();
+ } else {
+ error_panel->hide();
+ }
+ }
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_open_editor() {
+
+ if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) {
+ Ref<AnimationNode> an = blend_space->get_blend_point_node(selected_point);
+ ERR_FAIL_COND(!an.is_valid());
+ EditorNode::get_singleton()->edit_item(an.ptr());
+ }
+}
+
+void AnimationNodeBlendSpace2DEditor::_goto_parent() {
+
+ EditorNode::get_singleton()->edit_item(blend_space->get_parent().ptr());
+}
+
+void AnimationNodeBlendSpace2DEditor::_removed_from_graph() {
+ EditorNode::get_singleton()->edit_item(NULL);
+}
+
+void AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled() {
+
+ undo_redo->create_action("Toggle Auto Triangles");
+ undo_redo->add_do_method(blend_space.ptr(), "set_auto_triangles", auto_triangles->is_pressed());
+ undo_redo->add_undo_method(blend_space.ptr(), "set_auto_triangles", blend_space->get_auto_triangles());
+ undo_redo->add_do_method(this, "_update_space");
+ undo_redo->add_undo_method(this, "_update_space");
+ undo_redo->commit_action();
+}
+
+void AnimationNodeBlendSpace2DEditor::_bind_methods() {
+
+ ClassDB::bind_method("_blend_space_gui_input", &AnimationNodeBlendSpace2DEditor::_blend_space_gui_input);
+ ClassDB::bind_method("_blend_space_draw", &AnimationNodeBlendSpace2DEditor::_blend_space_draw);
+ ClassDB::bind_method("_config_changed", &AnimationNodeBlendSpace2DEditor::_config_changed);
+ ClassDB::bind_method("_labels_changed", &AnimationNodeBlendSpace2DEditor::_labels_changed);
+ ClassDB::bind_method("_update_space", &AnimationNodeBlendSpace2DEditor::_update_space);
+ ClassDB::bind_method("_snap_toggled", &AnimationNodeBlendSpace2DEditor::_snap_toggled);
+ ClassDB::bind_method("_tool_switch", &AnimationNodeBlendSpace2DEditor::_tool_switch);
+ ClassDB::bind_method("_erase_selected", &AnimationNodeBlendSpace2DEditor::_erase_selected);
+ ClassDB::bind_method("_update_tool_erase", &AnimationNodeBlendSpace2DEditor::_update_tool_erase);
+ ClassDB::bind_method("_edit_point_pos", &AnimationNodeBlendSpace2DEditor::_edit_point_pos);
+
+ ClassDB::bind_method("_add_menu_type", &AnimationNodeBlendSpace2DEditor::_add_menu_type);
+ ClassDB::bind_method("_add_animation_type", &AnimationNodeBlendSpace2DEditor::_add_animation_type);
+
+ ClassDB::bind_method("_update_edited_point_pos", &AnimationNodeBlendSpace2DEditor::_update_edited_point_pos);
+
+ ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace2DEditor::_open_editor);
+ ClassDB::bind_method("_goto_parent", &AnimationNodeBlendSpace2DEditor::_goto_parent);
+
+ ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph);
+
+ ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled);
+}
+
+AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL;
+
+AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
+
+ singleton = this;
+ updating = false;
+
+ HBoxContainer *top_hb = memnew(HBoxContainer);
+ add_child(top_hb);
+
+ Ref<ButtonGroup> bg;
+ bg.instance();
+
+ goto_parent_hb = memnew(HBoxContainer);
+ top_hb->add_child(goto_parent_hb);
+ goto_parent = memnew(ToolButton);
+ goto_parent->connect("pressed", this, "_goto_parent", varray(), CONNECT_DEFERRED);
+ goto_parent_hb->add_child(goto_parent);
+ goto_parent_hb->add_child(memnew(VSeparator));
+ goto_parent_hb->hide();
+
+ tool_blend = memnew(ToolButton);
+ tool_blend->set_toggle_mode(true);
+ tool_blend->set_button_group(bg);
+ top_hb->add_child(tool_blend);
+ tool_blend->set_pressed(true);
+ tool_blend->set_tooltip(TTR("Set the blending position within the space"));
+ tool_blend->connect("pressed", this, "_tool_switch", varray(3));
+
+ tool_select = memnew(ToolButton);
+ tool_select->set_toggle_mode(true);
+ tool_select->set_button_group(bg);
+ top_hb->add_child(tool_select);
+ tool_select->set_tooltip(TTR("Select and move points, create points with RMB."));
+ tool_select->connect("pressed", this, "_tool_switch", varray(0));
+
+ tool_create = memnew(ToolButton);
+ tool_create->set_toggle_mode(true);
+ tool_create->set_button_group(bg);
+ top_hb->add_child(tool_create);
+ tool_create->set_tooltip(TTR("Create points."));
+ tool_create->connect("pressed", this, "_tool_switch", varray(1));
+
+ tool_triangle = memnew(ToolButton);
+ tool_triangle->set_toggle_mode(true);
+ tool_triangle->set_button_group(bg);
+ top_hb->add_child(tool_triangle);
+ tool_triangle->set_tooltip(TTR("Create triangles by connecting points."));
+ tool_triangle->connect("pressed", this, "_tool_switch", varray(2));
+
+ tool_erase_sep = memnew(VSeparator);
+ top_hb->add_child(tool_erase_sep);
+ tool_erase = memnew(ToolButton);
+ top_hb->add_child(tool_erase);
+ tool_erase->set_tooltip(TTR("Erase points and triangles."));
+ tool_erase->connect("pressed", this, "_erase_selected");
+ tool_erase->set_disabled(true);
+
+ top_hb->add_child(memnew(VSeparator));
+
+ auto_triangles = memnew(ToolButton);
+ top_hb->add_child(auto_triangles);
+ auto_triangles->connect("pressed", this, "_auto_triangles_toggled");
+ auto_triangles->set_toggle_mode(true);
+ auto_triangles->set_tooltip(TTR("Generate blend triangles automatically (instead of manually)"));
+
+ top_hb->add_child(memnew(VSeparator));
+
+ snap = memnew(ToolButton);
+ snap->set_toggle_mode(true);
+ top_hb->add_child(snap);
+ //snap->set_text(TTR("Snap"));
+ snap->set_pressed(true);
+ snap->connect("pressed", this, "_snap_toggled");
+
+ snap_x = memnew(SpinBox);
+ top_hb->add_child(snap_x);
+ snap_x->set_prefix("x:");
+ snap_x->set_min(0.01);
+ snap_x->set_step(0.01);
+ snap_x->set_max(1000);
+
+ snap_y = memnew(SpinBox);
+ top_hb->add_child(snap_y);
+ snap_y->set_prefix("y:");
+ snap_y->set_min(0.01);
+ snap_y->set_step(0.01);
+ snap_y->set_max(1000);
+
+ edit_hb = memnew(HBoxContainer);
+ top_hb->add_child(edit_hb);
+ edit_hb->add_child(memnew(VSeparator));
+ edit_hb->add_child(memnew(Label(TTR("Point"))));
+ edit_x = memnew(SpinBox);
+ edit_hb->add_child(edit_x);
+ edit_x->set_min(-1000);
+ edit_x->set_step(0.01);
+ edit_x->set_max(1000);
+ edit_x->connect("value_changed", this, "_edit_point_pos");
+ edit_y = memnew(SpinBox);
+ edit_hb->add_child(edit_y);
+ edit_y->set_min(-1000);
+ edit_y->set_step(0.01);
+ edit_y->set_max(1000);
+ edit_y->connect("value_changed", this, "_edit_point_pos");
+ open_editor = memnew(Button);
+ edit_hb->add_child(open_editor);
+ open_editor->set_text(TTR("Open Editor"));
+ open_editor->connect("pressed", this, "_open_editor", varray(), CONNECT_DEFERRED);
+ edit_hb->hide();
+ open_editor->hide();
+
+ HBoxContainer *main_hb = memnew(HBoxContainer);
+ add_child(main_hb);
+ main_hb->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ GridContainer *main_grid = memnew(GridContainer);
+ main_grid->set_columns(2);
+ main_hb->add_child(main_grid);
+ main_grid->set_h_size_flags(SIZE_EXPAND_FILL);
+ {
+ VBoxContainer *left_vbox = memnew(VBoxContainer);
+ main_grid->add_child(left_vbox);
+ left_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
+ max_y_value = memnew(SpinBox);
+ left_vbox->add_child(max_y_value);
+ left_vbox->add_spacer();
+ label_y = memnew(LineEdit);
+ left_vbox->add_child(label_y);
+ label_y->set_expand_to_text_length(true);
+ left_vbox->add_spacer();
+ min_y_value = memnew(SpinBox);
+ left_vbox->add_child(min_y_value);
+
+ max_y_value->set_max(10000);
+ max_y_value->set_min(0.01);
+ max_y_value->set_step(0.01);
+
+ min_y_value->set_min(-10000);
+ min_y_value->set_max(0);
+ min_y_value->set_step(0.01);
+ }
+
+ panel = memnew(PanelContainer);
+ panel->set_clip_contents(true);
+ main_grid->add_child(panel);
+ panel->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ blend_space_draw = memnew(Control);
+ blend_space_draw->connect("gui_input", this, "_blend_space_gui_input");
+ blend_space_draw->connect("draw", this, "_blend_space_draw");
+ blend_space_draw->set_focus_mode(FOCUS_ALL);
+
+ panel->add_child(blend_space_draw);
+ main_grid->add_child(memnew(Control)); //empty bottom left
+
+ {
+ HBoxContainer *bottom_vbox = memnew(HBoxContainer);
+ main_grid->add_child(bottom_vbox);
+ bottom_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
+ min_x_value = memnew(SpinBox);
+ bottom_vbox->add_child(min_x_value);
+ bottom_vbox->add_spacer();
+ label_x = memnew(LineEdit);
+ bottom_vbox->add_child(label_x);
+ label_x->set_expand_to_text_length(true);
+ bottom_vbox->add_spacer();
+ max_x_value = memnew(SpinBox);
+ bottom_vbox->add_child(max_x_value);
+
+ max_x_value->set_max(10000);
+ max_x_value->set_min(0.01);
+ max_x_value->set_step(0.01);
+
+ min_x_value->set_min(-10000);
+ min_x_value->set_max(0);
+ min_x_value->set_step(0.01);
+ }
+
+ snap_x->connect("value_changed", this, "_config_changed");
+ snap_y->connect("value_changed", this, "_config_changed");
+ max_x_value->connect("value_changed", this, "_config_changed");
+ min_x_value->connect("value_changed", this, "_config_changed");
+ max_y_value->connect("value_changed", this, "_config_changed");
+ min_y_value->connect("value_changed", this, "_config_changed");
+ label_x->connect("text_changed", this, "_labels_changed");
+ label_y->connect("text_changed", this, "_labels_changed");
+
+ error_panel = memnew(PanelContainer);
+ add_child(error_panel);
+ error_label = memnew(Label);
+ error_panel->add_child(error_label);
+ error_label->set_text("eh");
+
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+
+ set_custom_minimum_size(Size2(0, 300 * EDSCALE));
+
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("index_pressed", this, "_add_menu_type");
+
+ animations_menu = memnew(PopupMenu);
+ menu->add_child(animations_menu);
+ animations_menu->set_name("animations");
+ animations_menu->connect("index_pressed", this, "_add_animation_type");
+
+ selected_point = -1;
+ selected_triangle = -1;
+
+ dragging_selected = false;
+ dragging_selected_attempt = false;
+}
+
+void AnimationNodeBlendSpace2DEditorPlugin::edit(Object *p_object) {
+
+ anim_tree_editor->edit(Object::cast_to<AnimationNodeBlendSpace2D>(p_object));
+}
+
+bool AnimationNodeBlendSpace2DEditorPlugin::handles(Object *p_object) const {
+
+ return p_object->is_class("AnimationNodeBlendSpace2D");
+}
+
+void AnimationNodeBlendSpace2DEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+ //editor->hide_animation_player_editors();
+ //editor->animation_panel_make_visible(true);
+ button->show();
+ editor->make_bottom_panel_item_visible(anim_tree_editor);
+ anim_tree_editor->set_process(true);
+ } else {
+
+ if (anim_tree_editor->is_visible_in_tree())
+ editor->hide_bottom_panel();
+ button->hide();
+ anim_tree_editor->set_process(false);
+ }
+}
+
+AnimationNodeBlendSpace2DEditorPlugin::AnimationNodeBlendSpace2DEditorPlugin(EditorNode *p_node) {
+
+ editor = p_node;
+ anim_tree_editor = memnew(AnimationNodeBlendSpace2DEditor);
+ anim_tree_editor->set_custom_minimum_size(Size2(0, 300));
+
+ button = editor->add_bottom_panel_item(TTR("BlendSpace2D"), anim_tree_editor);
+ button->hide();
+}
+
+AnimationNodeBlendSpace2DEditorPlugin::~AnimationNodeBlendSpace2DEditorPlugin() {
+}
diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h
new file mode 100644
index 0000000000..a0e497804e
--- /dev/null
+++ b/editor/plugins/animation_blend_space_2d_editor.h
@@ -0,0 +1,130 @@
+#ifndef ANIMATION_BLEND_SPACE_2D_EDITOR_H
+#define ANIMATION_BLEND_SPACE_2D_EDITOR_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "editor/property_editor.h"
+#include "scene/animation/animation_blend_space_2d.h"
+#include "scene/gui/button.h"
+#include "scene/gui/graph_edit.h"
+#include "scene/gui/popup.h"
+#include "scene/gui/tree.h"
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+
+class AnimationNodeBlendSpace2DEditor : public VBoxContainer {
+
+ GDCLASS(AnimationNodeBlendSpace2DEditor, VBoxContainer);
+
+ Ref<AnimationNodeBlendSpace2D> blend_space;
+
+ HBoxContainer *goto_parent_hb;
+ ToolButton *goto_parent;
+
+ PanelContainer *panel;
+ ToolButton *tool_blend;
+ ToolButton *tool_select;
+ ToolButton *tool_create;
+ ToolButton *tool_triangle;
+ VSeparator *tool_erase_sep;
+ ToolButton *tool_erase;
+ ToolButton *snap;
+ SpinBox *snap_x;
+ SpinBox *snap_y;
+
+ ToolButton *auto_triangles;
+
+ LineEdit *label_x;
+ LineEdit *label_y;
+ SpinBox *max_x_value;
+ SpinBox *min_x_value;
+ SpinBox *max_y_value;
+ SpinBox *min_y_value;
+
+ HBoxContainer *edit_hb;
+ SpinBox *edit_x;
+ SpinBox *edit_y;
+ Button *open_editor;
+
+ int selected_point;
+ int selected_triangle;
+
+ Control *blend_space_draw;
+
+ PanelContainer *error_panel;
+ Label *error_label;
+
+ bool updating;
+
+ UndoRedo *undo_redo;
+
+ static AnimationNodeBlendSpace2DEditor *singleton;
+
+ void _blend_space_gui_input(const Ref<InputEvent> &p_event);
+ void _blend_space_draw();
+
+ void _update_space();
+
+ void _config_changed(double);
+ void _labels_changed(String);
+ void _snap_toggled();
+
+ PopupMenu *menu;
+ PopupMenu *animations_menu;
+ Vector<String> animations_to_add;
+ Vector2 add_point_pos;
+ Vector<Vector2> points;
+
+ bool dragging_selected_attempt;
+ bool dragging_selected;
+ Vector2 drag_from;
+ Vector2 drag_ofs;
+
+ Vector<int> making_triangle;
+
+ void _add_menu_type(int p_index);
+ void _add_animation_type(int p_index);
+
+ void _tool_switch(int p_tool);
+ void _update_edited_point_pos();
+ void _update_tool_erase();
+ void _erase_selected();
+ void _edit_point_pos(double);
+ void _open_editor();
+
+ void _goto_parent();
+
+ void _removed_from_graph();
+
+ void _auto_triangles_toggled();
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ static AnimationNodeBlendSpace2DEditor *get_singleton() { return singleton; }
+ void edit(AnimationNodeBlendSpace2D *p_blend_space);
+ AnimationNodeBlendSpace2DEditor();
+};
+
+class AnimationNodeBlendSpace2DEditorPlugin : public EditorPlugin {
+
+ GDCLASS(AnimationNodeBlendSpace2DEditorPlugin, EditorPlugin);
+
+ AnimationNodeBlendSpace2DEditor *anim_tree_editor;
+ EditorNode *editor;
+ Button *button;
+
+public:
+ virtual String get_name() const { return "BlendSpace2D"; }
+ bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ AnimationNodeBlendSpace2DEditorPlugin(EditorNode *p_node);
+ ~AnimationNodeBlendSpace2DEditorPlugin();
+};
+#endif // ANIMATION_BLEND_SPACE_2D_EDITOR_H
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
new file mode 100644
index 0000000000..3efb2736b5
--- /dev/null
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -0,0 +1,848 @@
+#include "animation_blend_tree_editor_plugin.h"
+
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
+#include "os/input.h"
+#include "os/keyboard.h"
+#include "scene/animation/animation_player.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/panel.h"
+#include "scene/main/viewport.h"
+
+void AnimationNodeBlendTreeEditor::edit(AnimationNodeBlendTree *p_blend_tree) {
+
+ if (blend_tree.is_valid()) {
+ blend_tree->disconnect("removed_from_graph", this, "_removed_from_graph");
+ }
+
+ if (p_blend_tree) {
+ blend_tree = Ref<AnimationNodeBlendTree>(p_blend_tree);
+ } else {
+ blend_tree.unref();
+ }
+
+ if (blend_tree.is_null()) {
+ hide();
+ } else {
+ blend_tree->connect("removed_from_graph", this, "_removed_from_graph");
+
+ _update_graph();
+ }
+}
+
+void AnimationNodeBlendTreeEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script) {
+
+ for (int i = 0; i < add_options.size(); i++) {
+ ERR_FAIL_COND(add_options[i].script == p_script);
+ }
+
+ AddOption ao;
+ ao.name = p_name;
+ ao.script = p_script;
+ add_options.push_back(ao);
+
+ _update_options_menu();
+}
+
+void AnimationNodeBlendTreeEditor::remove_custom_type(const Ref<Script> &p_script) {
+
+ for (int i = 0; i < add_options.size(); i++) {
+ if (add_options[i].script == p_script) {
+ add_options.remove(i);
+ return;
+ }
+ }
+
+ _update_options_menu();
+}
+
+void AnimationNodeBlendTreeEditor::_update_options_menu() {
+
+ add_node->get_popup()->clear();
+ for (int i = 0; i < add_options.size(); i++) {
+ add_node->get_popup()->add_item(add_options[i].name);
+ }
+}
+
+Size2 AnimationNodeBlendTreeEditor::get_minimum_size() const {
+
+ return Size2(10, 200);
+}
+
+void AnimationNodeBlendTreeEditor::_update_graph() {
+
+ if (updating)
+ return;
+
+ graph->set_scroll_ofs(blend_tree->get_graph_offset() * EDSCALE);
+
+ if (blend_tree->get_parent().is_valid()) {
+ goto_parent->show();
+ } else {
+ goto_parent->hide();
+ }
+ graph->clear_connections();
+ //erase all nodes
+ for (int i = 0; i < graph->get_child_count(); i++) {
+
+ if (Object::cast_to<GraphNode>(graph->get_child(i))) {
+ memdelete(graph->get_child(i));
+ i--;
+ }
+ }
+
+ animations.clear();
+
+ List<StringName> nodes;
+ blend_tree->get_node_list(&nodes);
+
+ for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
+
+ GraphNode *node = memnew(GraphNode);
+ graph->add_child(node);
+
+ Ref<AnimationNode> agnode = blend_tree->get_node(E->get());
+
+ if (!agnode->is_connected("changed", this, "_node_changed")) {
+ agnode->connect("changed", this, "_node_changed", varray(agnode->get_instance_id()), CONNECT_DEFERRED);
+ }
+
+ node->set_offset(agnode->get_position() * EDSCALE);
+
+ node->set_title(agnode->get_caption());
+ node->set_name(E->get());
+
+ int base = 0;
+ if (String(E->get()) != "output") {
+ LineEdit *name = memnew(LineEdit);
+ name->set_text(E->get());
+ name->set_expand_to_text_length(true);
+ node->add_child(name);
+ node->set_slot(0, false, 0, Color(), true, 0, get_color("font_color", "Label"));
+ name->connect("text_entered", this, "_node_renamed", varray(agnode));
+ name->connect("focus_exited", this, "_node_renamed_focus_out", varray(name, agnode));
+ base = 1;
+ node->set_show_close_button(true);
+ node->connect("close_request", this, "_delete_request", varray(E->get()), CONNECT_DEFERRED);
+ }
+
+ for (int i = 0; i < agnode->get_input_count(); i++) {
+ Label *in_name = memnew(Label);
+ node->add_child(in_name);
+ in_name->set_text(agnode->get_input_name(i));
+ node->set_slot(base + i, true, 0, get_color("font_color", "Label"), false, 0, Color());
+ }
+
+ node->connect("dragged", this, "_node_dragged", varray(agnode));
+
+ if (EditorNode::get_singleton()->item_has_editor(agnode.ptr())) {
+ node->add_child(memnew(HSeparator));
+ Button *open_in_editor = memnew(Button);
+ open_in_editor->set_text(TTR("Open Editor"));
+ open_in_editor->set_icon(get_icon("Edit", "EditorIcons"));
+ node->add_child(open_in_editor);
+ open_in_editor->connect("pressed", this, "_open_in_editor", varray(E->get()), CONNECT_DEFERRED);
+ open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
+ }
+
+ if (agnode->has_filter()) {
+
+ node->add_child(memnew(HSeparator));
+ Button *edit_filters = memnew(Button);
+ edit_filters->set_text(TTR("Edit Filters"));
+ edit_filters->set_icon(get_icon("AnimationFilter", "EditorIcons"));
+ node->add_child(edit_filters);
+ edit_filters->connect("pressed", this, "_edit_filters", varray(E->get()), CONNECT_DEFERRED);
+ edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER);
+ }
+
+ Ref<AnimationNodeAnimation> anim = agnode;
+ if (anim.is_valid()) {
+
+ MenuButton *mb = memnew(MenuButton);
+ mb->set_text(anim->get_animation());
+ mb->set_icon(get_icon("Animation", "EditorIcons"));
+ Array options;
+
+ node->add_child(memnew(HSeparator));
+ node->add_child(mb);
+
+ ProgressBar *pb = memnew(ProgressBar);
+
+ AnimationTree *player = anim->get_tree();
+ if (player->has_node(player->get_animation_player())) {
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(player->get_node(player->get_animation_player()));
+ if (ap) {
+ List<StringName> anims;
+ ap->get_animation_list(&anims);
+
+ for (List<StringName>::Element *F = anims.front(); F; F = F->next()) {
+ mb->get_popup()->add_item(F->get());
+ options.push_back(F->get());
+ }
+
+ if (ap->has_animation(anim->get_animation())) {
+ pb->set_max(ap->get_animation(anim->get_animation())->get_length());
+ }
+ }
+ }
+
+ pb->set_percent_visible(false);
+ animations[E->get()] = pb;
+ node->add_child(pb);
+
+ mb->get_popup()->connect("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED);
+ }
+
+ Ref<AnimationNodeOneShot> oneshot = agnode;
+ if (oneshot.is_valid()) {
+
+ HBoxContainer *play_stop = memnew(HBoxContainer);
+ play_stop->add_spacer();
+ Button *play = memnew(Button);
+ play->set_icon(get_icon("Play", "EditorIcons"));
+ play->connect("pressed", this, "_oneshot_start", varray(E->get()), CONNECT_DEFERRED);
+ play_stop->add_child(play);
+ Button *stop = memnew(Button);
+ stop->set_icon(get_icon("Stop", "EditorIcons"));
+ stop->connect("pressed", this, "_oneshot_stop", varray(E->get()), CONNECT_DEFERRED);
+ play_stop->add_child(stop);
+ play_stop->add_spacer();
+ node->add_child(play_stop);
+ }
+ }
+
+ List<AnimationNodeBlendTree::NodeConnection> connections;
+ blend_tree->get_node_connections(&connections);
+
+ for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) {
+
+ StringName from = E->get().output_node;
+ StringName to = E->get().input_node;
+ int to_idx = E->get().input_index;
+
+ graph->connect_node(from, 0, to, to_idx);
+ }
+}
+
+void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
+
+ ERR_FAIL_INDEX(p_idx, add_options.size());
+
+ Ref<AnimationNode> anode;
+
+ if (add_options[p_idx].type != String()) {
+ AnimationNode *an = Object::cast_to<AnimationNode>(ClassDB::instance(add_options[p_idx].type));
+ ERR_FAIL_COND(!an);
+ anode = Ref<AnimationNode>(an);
+ } else {
+ ERR_FAIL_COND(add_options[p_idx].script.is_null());
+ String base_type = add_options[p_idx].script->get_instance_base_type();
+ AnimationNode *an = Object::cast_to<AnimationNode>(ClassDB::instance(base_type));
+ ERR_FAIL_COND(!an);
+ anode = Ref<AnimationNode>(an);
+ anode->set_script(add_options[p_idx].script.get_ref_ptr());
+ }
+
+ Point2 instance_pos = graph->get_scroll_ofs() + graph->get_size() * 0.5;
+
+ anode->set_position(instance_pos);
+
+ String base_name = add_options[p_idx].name;
+ int base = 1;
+ String name = base_name;
+ while (blend_tree->has_node(name)) {
+ base++;
+ name = base_name + " " + itos(base);
+ }
+
+ undo_redo->create_action("Add Node to BlendTree");
+ undo_redo->add_do_method(blend_tree.ptr(), "add_node", name, anode);
+ undo_redo->add_undo_method(blend_tree.ptr(), "remove_node", name);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+}
+
+void AnimationNodeBlendTreeEditor::_node_dragged(const Vector2 &p_from, const Vector2 &p_to, Ref<AnimationNode> p_node) {
+
+ updating = true;
+ undo_redo->create_action("Node Moved");
+ undo_redo->add_do_method(p_node.ptr(), "set_position", p_to / EDSCALE);
+ undo_redo->add_undo_method(p_node.ptr(), "set_position", p_from / EDSCALE);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+}
+
+void AnimationNodeBlendTreeEditor::_connection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index) {
+
+ AnimationNodeBlendTree::ConnectionError err = blend_tree->can_connect_node(p_to, p_to_index, p_from);
+
+ if (err != AnimationNodeBlendTree::CONNECTION_OK) {
+ EditorNode::get_singleton()->show_warning(TTR("Unable to connect, port may be in use or connection may be invalid."));
+ return;
+ }
+
+ undo_redo->create_action("Nodes Connected");
+ undo_redo->add_do_method(blend_tree.ptr(), "connect_node", p_to, p_to_index, p_from);
+ undo_redo->add_undo_method(blend_tree.ptr(), "disconnect_node", p_to, p_to_index, p_from);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+}
+
+void AnimationNodeBlendTreeEditor::_disconnection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index) {
+
+ graph->disconnect_node(p_from, p_from_index, p_to, p_to_index);
+
+ updating = true;
+ undo_redo->create_action("Nodes Disconnected");
+ undo_redo->add_do_method(blend_tree.ptr(), "disconnect_node", p_to, p_to_index);
+ undo_redo->add_undo_method(blend_tree.ptr(), "connect_node", p_to, p_to_index, p_from);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+}
+
+void AnimationNodeBlendTreeEditor::_anim_selected(int p_index, Array p_options, const String &p_node) {
+
+ String option = p_options[p_index];
+
+ Ref<AnimationNodeAnimation> anim = blend_tree->get_node(p_node);
+ ERR_FAIL_COND(!anim.is_valid());
+
+ undo_redo->create_action("Set Animation");
+ undo_redo->add_do_method(anim.ptr(), "set_animation", option);
+ undo_redo->add_undo_method(anim.ptr(), "set_animation", anim->get_animation());
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+}
+
+void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) {
+
+ undo_redo->create_action("Delete Node");
+ undo_redo->add_do_method(blend_tree.ptr(), "remove_node", p_which);
+ undo_redo->add_undo_method(blend_tree.ptr(), "add_node", p_which, blend_tree->get_node(p_which));
+
+ List<AnimationNodeBlendTree::NodeConnection> conns;
+ blend_tree->get_node_connections(&conns);
+
+ for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = conns.front(); E; E = E->next()) {
+ if (E->get().output_node == p_which || E->get().input_node == p_which) {
+ undo_redo->add_undo_method(blend_tree.ptr(), "connect_node", E->get().input_node, E->get().input_index, E->get().output_node);
+ }
+ }
+
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+}
+
+void AnimationNodeBlendTreeEditor::_oneshot_start(const StringName &p_name) {
+
+ Ref<AnimationNodeOneShot> os = blend_tree->get_node(p_name);
+ ERR_FAIL_COND(!os.is_valid());
+ os->start();
+}
+
+void AnimationNodeBlendTreeEditor::_oneshot_stop(const StringName &p_name) {
+
+ Ref<AnimationNodeOneShot> os = blend_tree->get_node(p_name);
+ ERR_FAIL_COND(!os.is_valid());
+ os->stop();
+}
+
+void AnimationNodeBlendTreeEditor::_node_selected(Object *p_node) {
+
+ GraphNode *gn = Object::cast_to<GraphNode>(p_node);
+ ERR_FAIL_COND(!gn);
+
+ String name = gn->get_name();
+
+ Ref<AnimationNode> anode = blend_tree->get_node(name);
+ ERR_FAIL_COND(!anode.is_valid());
+
+ EditorNode::get_singleton()->push_item(anode.ptr(), "", true);
+}
+
+void AnimationNodeBlendTreeEditor::_open_in_editor(const String &p_which) {
+
+ Ref<AnimationNode> an = blend_tree->get_node(p_which);
+ ERR_FAIL_COND(!an.is_valid())
+ EditorNode::get_singleton()->edit_item(an.ptr());
+}
+
+void AnimationNodeBlendTreeEditor::_open_parent() {
+ if (blend_tree->get_parent().is_valid()) {
+ EditorNode::get_singleton()->edit_item(blend_tree->get_parent().ptr());
+ }
+}
+
+void AnimationNodeBlendTreeEditor::_filter_toggled() {
+
+ updating = true;
+ undo_redo->create_action("Toggle filter on/off");
+ undo_redo->add_do_method(_filter_edit.ptr(), "set_filter_enabled", filter_enabled->is_pressed());
+ undo_redo->add_undo_method(_filter_edit.ptr(), "set_filter_enabled", _filter_edit->is_filter_enabled());
+ undo_redo->add_do_method(this, "_update_filters", _filter_edit);
+ undo_redo->add_undo_method(this, "_update_filters", _filter_edit);
+ undo_redo->commit_action();
+ updating = false;
+}
+
+void AnimationNodeBlendTreeEditor::_filter_edited() {
+
+ TreeItem *edited = filters->get_edited();
+ ERR_FAIL_COND(!edited);
+
+ NodePath edited_path = edited->get_metadata(0);
+ bool filtered = edited->is_checked(0);
+
+ updating = true;
+ undo_redo->create_action("Change filter");
+ undo_redo->add_do_method(_filter_edit.ptr(), "set_filter_path", edited_path, filtered);
+ undo_redo->add_undo_method(_filter_edit.ptr(), "set_filter_path", edited_path, _filter_edit->is_path_filtered(edited_path));
+ undo_redo->add_do_method(this, "_update_filters", _filter_edit);
+ undo_redo->add_undo_method(this, "_update_filters", _filter_edit);
+ undo_redo->commit_action();
+ updating = false;
+}
+
+bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &anode) {
+
+ if (updating || _filter_edit != anode)
+ return false;
+
+ NodePath player_path = anode->get_tree()->get_animation_player();
+
+ if (!anode->get_tree()->has_node(player_path)) {
+ EditorNode::get_singleton()->show_warning(TTR("No animation player set, so unable to retrieve track names."));
+ return false;
+ }
+
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(anode->get_tree()->get_node(player_path));
+ if (!player) {
+ EditorNode::get_singleton()->show_warning(TTR("Player path set is invalid, so unable to retrieve track names."));
+ return false;
+ }
+
+ Node *base = player->get_node(player->get_root());
+
+ if (!base) {
+ EditorNode::get_singleton()->show_warning(TTR("Animation player has no valid root node path, so unable to retrieve track names."));
+ return false;
+ }
+
+ updating = true;
+
+ Set<String> paths;
+ {
+ List<StringName> animations;
+ player->get_animation_list(&animations);
+
+ for (List<StringName>::Element *E = animations.front(); E; E = E->next()) {
+
+ Ref<Animation> anim = player->get_animation(E->get());
+ for (int i = 0; i < anim->get_track_count(); i++) {
+ paths.insert(anim->track_get_path(i));
+ }
+ }
+ }
+
+ filter_enabled->set_pressed(anode->is_filter_enabled());
+ filters->clear();
+ TreeItem *root = filters->create_item();
+
+ Map<String, TreeItem *> parenthood;
+
+ for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
+
+ NodePath path = E->get();
+ TreeItem *ti = NULL;
+ String accum;
+ for (int i = 0; i < path.get_name_count(); i++) {
+ String name = path.get_name(i);
+ if (accum != String()) {
+ accum += "/";
+ }
+ accum += name;
+ if (!parenthood.has(accum)) {
+ if (ti) {
+ ti = filters->create_item(ti);
+ } else {
+ ti = filters->create_item(root);
+ }
+ parenthood[accum] = ti;
+ ti->set_text(0, name);
+ ti->set_selectable(0, false);
+ ti->set_editable(0, false);
+
+ if (base->has_node(accum)) {
+ Node *node = base->get_node(accum);
+ if (has_icon(node->get_class(), "EditorIcons")) {
+ ti->set_icon(0, get_icon(node->get_class(), "EditorIcons"));
+ } else {
+ ti->set_icon(0, get_icon("Node", "EditorIcons"));
+ }
+ }
+
+ } else {
+ ti = parenthood[accum];
+ }
+ }
+
+ Node *node = NULL;
+ if (base->has_node(accum)) {
+ node = base->get_node(accum);
+ }
+ if (!node)
+ continue; //no node, cant edit
+
+ if (path.get_subname_count()) {
+
+ String concat = path.get_concatenated_subnames();
+
+ Skeleton *skeleton = Object::cast_to<Skeleton>(node);
+ if (skeleton && skeleton->find_bone(concat) != -1) {
+ //path in skeleton
+ String bone = concat;
+ int idx = skeleton->find_bone(bone);
+ List<String> bone_path;
+ while (idx != -1) {
+ bone_path.push_front(skeleton->get_bone_name(idx));
+ idx = skeleton->get_bone_parent(idx);
+ }
+
+ accum += ":";
+ for (List<String>::Element *F = bone_path.front(); F; F = F->next()) {
+ if (F != bone_path.front()) {
+ accum += "/";
+ }
+
+ accum += F->get();
+ if (!parenthood.has(accum)) {
+ ti = filters->create_item(ti);
+ parenthood[accum] = ti;
+ ti->set_text(0, F->get());
+ ti->set_selectable(0, false);
+ ti->set_editable(0, false);
+ ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons"));
+ } else {
+ ti = parenthood[accum];
+ }
+ }
+
+ ti->set_editable(0, true);
+ ti->set_selectable(0, true);
+ ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ ti->set_text(0, concat);
+ ti->set_checked(0, anode->is_path_filtered(path));
+ ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons"));
+ ti->set_metadata(0, path);
+
+ } else {
+ //just a property
+ ti = filters->create_item(ti);
+ ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ ti->set_text(0, concat);
+ ti->set_editable(0, true);
+ ti->set_selectable(0, true);
+ ti->set_checked(0, anode->is_path_filtered(path));
+ ti->set_metadata(0, path);
+ }
+ } else {
+ if (ti) {
+ //just a node, likely call or animation track
+ ti->set_editable(0, true);
+ ti->set_selectable(0, true);
+ ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
+ ti->set_checked(0, anode->is_path_filtered(path));
+ ti->set_metadata(0, path);
+ }
+ }
+ }
+
+ updating = false;
+
+ return true;
+}
+
+void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) {
+
+ Ref<AnimationNode> anode = blend_tree->get_node(p_which);
+ ERR_FAIL_COND(!anode.is_valid());
+
+ _filter_edit = anode;
+ if (!_update_filters(anode))
+ return;
+
+ filter_dialog->popup_centered_minsize(Size2(500, 500) * EDSCALE);
+}
+
+void AnimationNodeBlendTreeEditor::_removed_from_graph() {
+ if (is_visible()) {
+ EditorNode::get_singleton()->edit_item(NULL);
+ }
+}
+
+void AnimationNodeBlendTreeEditor::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+
+ goto_parent->set_icon(get_icon("MoveUp", "EditorIcons"));
+
+ error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ error_label->add_color_override("font_color", get_color("error_color", "Editor"));
+ }
+
+ if (p_what == NOTIFICATION_PROCESS) {
+
+ String error;
+
+ if (!blend_tree->get_tree()) {
+ error = TTR("BlendTree does not belong to an AnimationTree node.");
+ } else if (!blend_tree->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (blend_tree->get_tree()->is_state_invalid()) {
+ error = blend_tree->get_tree()->get_invalid_state_reason();
+ }
+
+ if (error != error_label->get_text()) {
+ error_label->set_text(error);
+ if (error != String()) {
+ error_panel->show();
+ } else {
+ error_panel->hide();
+ }
+ }
+
+ List<AnimationNodeBlendTree::NodeConnection> conns;
+ blend_tree->get_node_connections(&conns);
+ for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = conns.front(); E; E = E->next()) {
+ float activity = 0;
+ if (blend_tree->get_tree() && !blend_tree->get_tree()->is_state_invalid()) {
+ activity = blend_tree->get_connection_activity(E->get().input_node, E->get().input_index);
+ }
+ graph->set_connection_activity(E->get().output_node, 0, E->get().input_node, E->get().input_index, activity);
+ }
+
+ AnimationTree *graph_player = blend_tree->get_tree();
+ AnimationPlayer *player = NULL;
+ if (graph_player->has_node(graph_player->get_animation_player())) {
+ player = Object::cast_to<AnimationPlayer>(graph_player->get_node(graph_player->get_animation_player()));
+ }
+
+ if (player) {
+ for (Map<StringName, ProgressBar *>::Element *E = animations.front(); E; E = E->next()) {
+ Ref<AnimationNodeAnimation> an = blend_tree->get_node(E->key());
+ if (an.is_valid()) {
+ if (player->has_animation(an->get_animation())) {
+ Ref<Animation> anim = player->get_animation(an->get_animation());
+ if (anim.is_valid()) {
+ E->get()->set_max(anim->get_length());
+ E->get()->set_value(an->get_playback_time());
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void AnimationNodeBlendTreeEditor::_scroll_changed(const Vector2 &p_scroll) {
+ if (updating)
+ return;
+ updating = true;
+ blend_tree->set_graph_offset(p_scroll / EDSCALE);
+ updating = false;
+}
+
+void AnimationNodeBlendTreeEditor::_node_changed(ObjectID p_node) {
+
+ AnimationNode *an = Object::cast_to<AnimationNode>(ObjectDB::get_instance(p_node));
+ if (an && an->get_parent() == blend_tree) {
+ _update_graph();
+ }
+}
+
+void AnimationNodeBlendTreeEditor::_bind_methods() {
+
+ ClassDB::bind_method("_update_graph", &AnimationNodeBlendTreeEditor::_update_graph);
+ ClassDB::bind_method("_add_node", &AnimationNodeBlendTreeEditor::_add_node);
+ ClassDB::bind_method("_node_dragged", &AnimationNodeBlendTreeEditor::_node_dragged);
+ ClassDB::bind_method("_node_renamed", &AnimationNodeBlendTreeEditor::_node_renamed);
+ ClassDB::bind_method("_node_renamed_focus_out", &AnimationNodeBlendTreeEditor::_node_renamed_focus_out);
+ ClassDB::bind_method("_connection_request", &AnimationNodeBlendTreeEditor::_connection_request);
+ ClassDB::bind_method("_disconnection_request", &AnimationNodeBlendTreeEditor::_disconnection_request);
+ ClassDB::bind_method("_node_selected", &AnimationNodeBlendTreeEditor::_node_selected);
+ ClassDB::bind_method("_open_in_editor", &AnimationNodeBlendTreeEditor::_open_in_editor);
+ ClassDB::bind_method("_open_parent", &AnimationNodeBlendTreeEditor::_open_parent);
+ ClassDB::bind_method("_scroll_changed", &AnimationNodeBlendTreeEditor::_scroll_changed);
+ ClassDB::bind_method("_delete_request", &AnimationNodeBlendTreeEditor::_delete_request);
+ ClassDB::bind_method("_edit_filters", &AnimationNodeBlendTreeEditor::_edit_filters);
+ ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters);
+ ClassDB::bind_method("_filter_edited", &AnimationNodeBlendTreeEditor::_filter_edited);
+ ClassDB::bind_method("_filter_toggled", &AnimationNodeBlendTreeEditor::_filter_toggled);
+ ClassDB::bind_method("_oneshot_start", &AnimationNodeBlendTreeEditor::_oneshot_start);
+ ClassDB::bind_method("_oneshot_stop", &AnimationNodeBlendTreeEditor::_oneshot_stop);
+ ClassDB::bind_method("_node_changed", &AnimationNodeBlendTreeEditor::_node_changed);
+ ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendTreeEditor::_removed_from_graph);
+
+ ClassDB::bind_method("_anim_selected", &AnimationNodeBlendTreeEditor::_anim_selected);
+}
+
+AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = NULL;
+
+void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) {
+
+ String prev_name = blend_tree->get_node_name(p_node);
+ ERR_FAIL_COND(prev_name == String());
+ GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
+ ERR_FAIL_COND(!gn);
+
+ String new_name = p_text;
+
+ ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1)
+
+ ERR_FAIL_COND(new_name == prev_name);
+
+ String base_name = new_name;
+ int base = 1;
+ String name = base_name;
+ while (blend_tree->has_node(name)) {
+ base++;
+ name = base_name + " " + itos(base);
+ }
+
+ updating = true;
+ undo_redo->create_action("Node Renamed");
+ undo_redo->add_do_method(blend_tree.ptr(), "rename_node", prev_name, name);
+ undo_redo->add_undo_method(blend_tree.ptr(), "rename_node", name, prev_name);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+ gn->set_name(new_name);
+ gn->set_size(gn->get_minimum_size());
+}
+
+void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node) {
+ _node_renamed(le->call("get_text"), p_node);
+}
+
+AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
+
+ singleton = this;
+ updating = false;
+
+ graph = memnew(GraphEdit);
+ add_child(graph);
+ graph->add_valid_right_disconnect_type(0);
+ graph->add_valid_left_disconnect_type(0);
+ graph->set_v_size_flags(SIZE_EXPAND_FILL);
+ graph->connect("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED);
+ graph->connect("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED);
+ graph->connect("node_selected", this, "_node_selected");
+ graph->connect("scroll_offset_changed", this, "_scroll_changed");
+
+ VSeparator *vs = memnew(VSeparator);
+ graph->get_zoom_hbox()->add_child(vs);
+ graph->get_zoom_hbox()->move_child(vs, 0);
+
+ add_node = memnew(MenuButton);
+ graph->get_zoom_hbox()->add_child(add_node);
+ add_node->set_text(TTR("Add Node.."));
+ graph->get_zoom_hbox()->move_child(add_node, 0);
+ add_node->get_popup()->connect("index_pressed", this, "_add_node");
+
+ goto_parent = memnew(Button);
+ graph->get_zoom_hbox()->add_child(goto_parent);
+ graph->get_zoom_hbox()->move_child(goto_parent, 0);
+ goto_parent->hide();
+ goto_parent->connect("pressed", this, "_open_parent");
+
+ add_options.push_back(AddOption("Animation", "AnimationNodeAnimation"));
+ add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot"));
+ add_options.push_back(AddOption("Add2", "AnimationNodeAdd2"));
+ add_options.push_back(AddOption("Add3", "AnimationNodeAdd3"));
+ add_options.push_back(AddOption("Blend2", "AnimationNodeBlend2"));
+ add_options.push_back(AddOption("Blend3", "AnimationNodeBlend3"));
+ add_options.push_back(AddOption("Seek", "AnimationNodeTimeSeek"));
+ add_options.push_back(AddOption("TimeScale", "AnimationNodeTimeScale"));
+ add_options.push_back(AddOption("Transition", "AnimationNodeTransition"));
+ add_options.push_back(AddOption("BlendTree", "AnimationNodeBlendTree"));
+ add_options.push_back(AddOption("BlendSpace1D", "AnimationNodeBlendSpace1D"));
+ add_options.push_back(AddOption("BlendSpace2D", "AnimationNodeBlendSpace2D"));
+ add_options.push_back(AddOption("StateMachine", "AnimationNodeStateMachine"));
+ _update_options_menu();
+
+ error_panel = memnew(PanelContainer);
+ add_child(error_panel);
+ error_label = memnew(Label);
+ error_panel->add_child(error_label);
+ error_label->set_text("eh");
+
+ filter_dialog = memnew(AcceptDialog);
+ add_child(filter_dialog);
+ filter_dialog->set_title(TTR("Edit Filtered Tracks:"));
+
+ VBoxContainer *filter_vbox = memnew(VBoxContainer);
+ filter_dialog->add_child(filter_vbox);
+
+ filter_enabled = memnew(CheckBox);
+ filter_enabled->set_text(TTR("Enable filtering"));
+ filter_enabled->connect("pressed", this, "_filter_toggled");
+ filter_vbox->add_child(filter_enabled);
+
+ filters = memnew(Tree);
+ filter_vbox->add_child(filters);
+ filters->set_v_size_flags(SIZE_EXPAND_FILL);
+ filters->set_hide_root(true);
+ filters->connect("item_edited", this, "_filter_edited");
+
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+}
+
+void AnimationNodeBlendTreeEditorPlugin::edit(Object *p_object) {
+
+ anim_tree_editor->edit(Object::cast_to<AnimationNodeBlendTree>(p_object));
+}
+
+bool AnimationNodeBlendTreeEditorPlugin::handles(Object *p_object) const {
+
+ return p_object->is_class("AnimationNodeBlendTree");
+}
+
+void AnimationNodeBlendTreeEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+ //editor->hide_animation_player_editors();
+ //editor->animation_panel_make_visible(true);
+ button->show();
+ editor->make_bottom_panel_item_visible(anim_tree_editor);
+ anim_tree_editor->set_process(true);
+ } else {
+
+ if (anim_tree_editor->is_visible_in_tree())
+ editor->hide_bottom_panel();
+ button->hide();
+ anim_tree_editor->set_process(false);
+ }
+}
+
+AnimationNodeBlendTreeEditorPlugin::AnimationNodeBlendTreeEditorPlugin(EditorNode *p_node) {
+
+ editor = p_node;
+ anim_tree_editor = memnew(AnimationNodeBlendTreeEditor);
+ anim_tree_editor->set_custom_minimum_size(Size2(0, 300));
+
+ button = editor->add_bottom_panel_item(TTR("BlendTree"), anim_tree_editor);
+ button->hide();
+}
+
+AnimationNodeBlendTreeEditorPlugin::~AnimationNodeBlendTreeEditorPlugin() {
+}
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h
new file mode 100644
index 0000000000..deba3b2b0e
--- /dev/null
+++ b/editor/plugins/animation_blend_tree_editor_plugin.h
@@ -0,0 +1,117 @@
+#ifndef ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
+#define ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "editor/property_editor.h"
+#include "scene/animation/animation_blend_tree.h"
+#include "scene/gui/button.h"
+#include "scene/gui/graph_edit.h"
+#include "scene/gui/popup.h"
+#include "scene/gui/tree.h"
+/**
+ @author Juan Linietsky <reduzio@gmail.com>
+*/
+
+class AnimationNodeBlendTreeEditor : public VBoxContainer {
+
+ GDCLASS(AnimationNodeBlendTreeEditor, VBoxContainer);
+
+ Ref<AnimationNodeBlendTree> blend_tree;
+ GraphEdit *graph;
+ MenuButton *add_node;
+ Button *goto_parent;
+
+ PanelContainer *error_panel;
+ Label *error_label;
+
+ UndoRedo *undo_redo;
+
+ AcceptDialog *filter_dialog;
+ Tree *filters;
+ CheckBox *filter_enabled;
+
+ Map<StringName, ProgressBar *> animations;
+
+ void _update_graph();
+
+ struct AddOption {
+ String name;
+ String type;
+ Ref<Script> script;
+ AddOption(const String &p_name = String(), const String &p_type = String()) {
+ name = p_name;
+ type = p_type;
+ }
+ };
+
+ Vector<AddOption> add_options;
+
+ void _add_node(int p_idx);
+ void _update_options_menu();
+
+ static AnimationNodeBlendTreeEditor *singleton;
+
+ void _node_dragged(const Vector2 &p_from, const Vector2 &p_to, Ref<AnimationNode> p_node);
+ void _node_renamed(const String &p_text, Ref<AnimationNode> p_node);
+ void _node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node);
+
+ bool updating;
+
+ void _connection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index);
+ void _disconnection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index);
+
+ void _scroll_changed(const Vector2 &p_scroll);
+ void _node_selected(Object *p_node);
+ void _open_in_editor(const String &p_which);
+ void _open_parent();
+ void _anim_selected(int p_index, Array p_options, const String &p_node);
+ void _delete_request(const String &p_which);
+ void _oneshot_start(const StringName &p_name);
+ void _oneshot_stop(const StringName &p_name);
+
+ bool _update_filters(const Ref<AnimationNode> &anode);
+ void _edit_filters(const String &p_which);
+ void _filter_edited();
+ void _filter_toggled();
+ Ref<AnimationNode> _filter_edit;
+
+ void _node_changed(ObjectID p_node);
+
+ void _removed_from_graph();
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ static AnimationNodeBlendTreeEditor *get_singleton() { return singleton; }
+
+ void add_custom_type(const String &p_name, const Ref<Script> &p_script);
+ void remove_custom_type(const Ref<Script> &p_script);
+
+ virtual Size2 get_minimum_size() const;
+ void edit(AnimationNodeBlendTree *p_blend_tree);
+ AnimationNodeBlendTreeEditor();
+};
+
+class AnimationNodeBlendTreeEditorPlugin : public EditorPlugin {
+
+ GDCLASS(AnimationNodeBlendTreeEditorPlugin, EditorPlugin);
+
+ AnimationNodeBlendTreeEditor *anim_tree_editor;
+ EditorNode *editor;
+ Button *button;
+
+public:
+ virtual String get_name() const { return "BlendTree"; }
+ bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ AnimationNodeBlendTreeEditorPlugin(EditorNode *p_node);
+ ~AnimationNodeBlendTreeEditorPlugin();
+};
+
+#endif // ANIMATION_BLEND_TREE_EDITOR_PLUGIN_H
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index c22e1cd88b..248e386bf1 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -30,7 +30,7 @@
#include "animation_player_editor_plugin.h"
-#include "editor/animation_editor.h"
+#include "editor/animation_track_editor.h"
#include "editor/editor_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
@@ -50,9 +50,9 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) {
set_process(false);
- key_editor->set_animation(Ref<Animation>());
- key_editor->set_root(NULL);
- key_editor->show_select_node_warning(true);
+ track_editor->set_animation(Ref<Animation>());
+ track_editor->set_root(NULL);
+ track_editor->show_select_node_warning(true);
_update_player();
//editor->animation_editor_make_visible(false);
}
@@ -84,8 +84,8 @@ void AnimationPlayerEditor::_notification(int p_what) {
}
}
frame->set_value(player->get_current_animation_position());
- key_editor->set_anim_pos(player->get_current_animation_position());
- EditorNode::get_singleton()->get_property_editor()->refresh();
+ track_editor->set_anim_pos(player->get_current_animation_position());
+ EditorNode::get_singleton()->get_inspector()->refresh();
} else if (last_active) {
//need the last frame after it stopped
@@ -101,8 +101,6 @@ void AnimationPlayerEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
- save_anim->get_popup()->connect("id_pressed", this, "_animation_save_menu");
-
tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu");
onion_skinning->get_popup()->connect("id_pressed", this, "_onion_skinning_menu");
@@ -121,16 +119,8 @@ void AnimationPlayerEditor::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
- add_anim->set_icon(get_icon("New", "EditorIcons"));
- rename_anim->set_icon(get_icon("Rename", "EditorIcons"));
- duplicate_anim->set_icon(get_icon("Duplicate", "EditorIcons"));
autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
- load_anim->set_icon(get_icon("Folder", "EditorIcons"));
- save_anim->set_icon(get_icon("Save", "EditorIcons"));
-
- remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
- blend_anim->set_icon(get_icon("Blend", "EditorIcons"));
play->set_icon(get_icon("PlayStart", "EditorIcons"));
play_from->set_icon(get_icon("Play", "EditorIcons"));
play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons"));
@@ -138,11 +128,27 @@ void AnimationPlayerEditor::_notification(int p_what) {
autoplay_icon = get_icon("AutoPlay", "EditorIcons");
stop->set_icon(get_icon("Stop", "EditorIcons"));
- resource_edit_anim->set_icon(get_icon("EditResource", "EditorIcons"));
+
pin->set_icon(get_icon("Pin", "EditorIcons"));
- tool_anim->set_icon(get_icon("Tools", "EditorIcons"));
onion_skinning->set_icon(get_icon("Onion", "EditorIcons"));
+ tool_anim->add_style_override("normal", get_stylebox("normal", "Button"));
+ track_editor->get_edit_menu()->add_style_override("normal", get_stylebox("normal", "Button"));
+
+#define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_icon(m_icon, "EditorIcons"))
+
+ ITEM_ICON(TOOL_NEW_ANIM, "New");
+ ITEM_ICON(TOOL_LOAD_ANIM, "Load");
+ ITEM_ICON(TOOL_SAVE_ANIM, "Save");
+ ITEM_ICON(TOOL_SAVE_AS_ANIM, "Save");
+ ITEM_ICON(TOOL_DUPLICATE_ANIM, "Duplicate");
+ ITEM_ICON(TOOL_RENAME_ANIM, "Rename");
+ ITEM_ICON(TOOL_EDIT_TRANSITIONS, "Blend");
+ ITEM_ICON(TOOL_EDIT_RESOURCE, "Edit");
+ ITEM_ICON(TOOL_REMOVE_ANIM, "Remove");
+ //ITEM_ICON(TOOL_COPY_ANIM, "Copy");
+ //ITEM_ICON(TOOL_PASTE_ANIM, "Paste");
+
} break;
}
}
@@ -304,10 +310,10 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
Ref<Animation> anim = player->get_animation(current);
{
- key_editor->set_animation(anim);
+ track_editor->set_animation(anim);
Node *root = player->get_node(player->get_root());
if (root) {
- key_editor->set_root(root);
+ track_editor->set_root(root);
}
}
frame->set_max(anim->get_length());
@@ -317,8 +323,8 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
frame->set_step(0.00001);
} else {
- key_editor->set_animation(Ref<Animation>());
- key_editor->set_root(NULL);
+ track_editor->set_animation(Ref<Animation>());
+ track_editor->set_root(NULL);
}
autoplay->set_pressed(current == player->get_autoplay());
@@ -440,7 +446,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
file->set_current_path(existing);
}
file->popup_centered_ratio();
- file->set_title(TTR("Save Resource As.."));
+ file->set_title(TTR("Save Resource As..."));
current_option = RESOURCE_SAVE;
}
@@ -459,6 +465,12 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
Ref<Animation> anim = player->get_animation(current);
undo_redo->create_action(TTR("Remove Animation"));
+ if (player->get_autoplay() == current) {
+ undo_redo->add_do_method(player, "set_autoplay", "");
+ undo_redo->add_undo_method(player, "set_autoplay", current);
+ // Avoid having the autoplay icon linger around if there is only one animation in the player
+ undo_redo->add_do_method(this, "_animation_player_changed", player);
+ }
undo_redo->add_do_method(player, "remove_animation", current);
undo_redo->add_undo_method(player, "add_animation", current, anim);
undo_redo->add_do_method(this, "_animation_player_changed", player);
@@ -491,7 +503,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
String new_name = name->get_text();
if (new_name == "" || new_name.find(":") != -1 || new_name.find("/") != -1) {
- error_dialog->set_text(TTR("ERROR: Invalid animation name!"));
+ error_dialog->set_text(TTR("Invalid animation name!"));
error_dialog->popup_centered_minsize();
return;
}
@@ -502,7 +514,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
}
if (player->has_animation(new_name)) {
- error_dialog->set_text(TTR("ERROR: Animation name already exists!"));
+ error_dialog->set_text(TTR("Animation name already exists!"));
error_dialog->popup_centered_minsize();
return;
}
@@ -698,16 +710,16 @@ void AnimationPlayerEditor::_animation_edit() {
if (animation->get_item_count()) {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
- key_editor->set_animation(anim);
+ track_editor->set_animation(anim);
Node *root = player->get_node(player->get_root());
if (root) {
- key_editor->set_root(root);
+ track_editor->set_root(root);
}
} else {
- key_editor->set_animation(Ref<Animation>());
- key_editor->set_root(NULL);
+ track_editor->set_animation(Ref<Animation>());
+ track_editor->set_root(NULL);
}
}
void AnimationPlayerEditor::_dialog_action(String p_file) {
@@ -804,22 +816,27 @@ void AnimationPlayerEditor::_update_player() {
animation->clear();
- add_anim->set_disabled(player == NULL);
- load_anim->set_disabled(player == NULL);
+#define ITEM_DISABLED(m_item, m_disabled) tool_anim->get_popup()->set_item_disabled(tool_anim->get_popup()->get_item_index(m_item), m_disabled)
+
+ ITEM_DISABLED(TOOL_SAVE_ANIM, animlist.size() == 0);
+ ITEM_DISABLED(TOOL_SAVE_AS_ANIM, animlist.size() == 0);
+ ITEM_DISABLED(TOOL_DUPLICATE_ANIM, animlist.size() == 0);
+ ITEM_DISABLED(TOOL_RENAME_ANIM, animlist.size() == 0);
+ ITEM_DISABLED(TOOL_EDIT_TRANSITIONS, animlist.size() == 0);
+ ITEM_DISABLED(TOOL_COPY_ANIM, animlist.size() == 0);
+ ITEM_DISABLED(TOOL_REMOVE_ANIM, animlist.size() == 0);
+
stop->set_disabled(animlist.size() == 0);
play->set_disabled(animlist.size() == 0);
play_bw->set_disabled(animlist.size() == 0);
play_bw_from->set_disabled(animlist.size() == 0);
play_from->set_disabled(animlist.size() == 0);
+ frame->set_editable(animlist.size() != 0);
+ animation->set_disabled(animlist.size() == 0);
autoplay->set_disabled(animlist.size() == 0);
- duplicate_anim->set_disabled(animlist.size() == 0);
- rename_anim->set_disabled(animlist.size() == 0);
- blend_anim->set_disabled(animlist.size() == 0);
- remove_anim->set_disabled(animlist.size() == 0);
- resource_edit_anim->set_disabled(animlist.size() == 0);
- save_anim->set_disabled(animlist.size() == 0);
tool_anim->set_disabled(player == NULL);
onion_skinning->set_disabled(player == NULL);
+ pin->set_disabled(player == NULL);
int active_idx = -1;
for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) {
@@ -854,10 +871,10 @@ void AnimationPlayerEditor::_update_player() {
if (animation->get_item_count()) {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
- key_editor->set_animation(anim);
+ track_editor->set_animation(anim);
Node *root = player->get_node(player->get_root());
if (root) {
- key_editor->set_root(root);
+ track_editor->set_root(root);
}
}
@@ -875,9 +892,9 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
if (player) {
_update_player();
- key_editor->show_select_node_warning(false);
+ track_editor->show_select_node_warning(false);
} else {
- key_editor->show_select_node_warning(true);
+ track_editor->show_select_node_warning(true);
//hide();
}
@@ -1011,10 +1028,11 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set) {
player->seek_delta(pos, pos - cpos);
} else {
+ player->stop(true);
player->seek(pos, true);
}
- key_editor->set_anim_pos(pos);
+ track_editor->set_anim_pos(pos);
updating = true;
};
@@ -1063,7 +1081,7 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_drag)
updating = false;
_seek_value_changed(p_pos, !p_drag);
- EditorNode::get_singleton()->get_property_editor()->refresh();
+ EditorNode::get_singleton()->get_inspector()->refresh();
//seekit
}
@@ -1074,20 +1092,59 @@ void AnimationPlayerEditor::_hide_anim_editors() {
hide();
set_process(false);
- key_editor->set_animation(Ref<Animation>());
- key_editor->set_root(NULL);
- key_editor->show_select_node_warning(true);
+ track_editor->set_animation(Ref<Animation>());
+ track_editor->set_root(NULL);
+ track_editor->show_select_node_warning(true);
//editor->animation_editor_make_visible(false);
}
+void AnimationPlayerEditor::_animation_about_to_show_menu() {
+}
+
void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
+ String current = animation->get_item_text(animation->get_selected());
+ Ref<Animation> anim;
+ if (current != "") {
+ anim = player->get_animation(current);
+ }
+
switch (p_option) {
+ case TOOL_NEW_ANIM: {
+ _animation_new();
+ } break;
+
+ case TOOL_LOAD_ANIM: {
+ _animation_load();
+ break;
+ } break;
+ case TOOL_SAVE_ANIM: {
+ if (anim.is_valid()) {
+ _animation_save(anim);
+ }
+ } break;
+ case TOOL_SAVE_AS_ANIM: {
+ if (anim.is_valid()) {
+ _animation_save_as(anim);
+ }
+ } break;
+ case TOOL_DUPLICATE_ANIM: {
+ _animation_duplicate();
+ } break;
+ case TOOL_RENAME_ANIM: {
+ _animation_rename();
+ } break;
+ case TOOL_EDIT_TRANSITIONS: {
+ _animation_blend();
+ } break;
+ case TOOL_REMOVE_ANIM: {
+ _animation_remove();
+ } break;
case TOOL_COPY_ANIM: {
if (!animation->get_item_count()) {
- error_dialog->set_text(TTR("ERROR: No animation to copy!"));
+ error_dialog->set_text(TTR("No animation to copy!"));
error_dialog->popup_centered_minsize();
return;
}
@@ -1102,7 +1159,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
Ref<Animation> anim = EditorSettings::get_singleton()->get_resource_clipboard();
if (!anim.is_valid()) {
- error_dialog->set_text(TTR("ERROR: No animation resource on clipboard!"));
+ error_dialog->set_text(TTR("No animation resource on clipboard!"));
error_dialog->popup_centered_minsize();
return;
}
@@ -1133,7 +1190,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
case TOOL_EDIT_RESOURCE: {
if (!animation->get_item_count()) {
- error_dialog->set_text(TTR("ERROR: No animation to edit!"));
+ error_dialog->set_text(TTR("No animation to edit!"));
error_dialog->popup_centered_minsize();
return;
}
@@ -1146,23 +1203,6 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
}
}
-void AnimationPlayerEditor::_animation_save_menu(int p_option) {
-
- String current = animation->get_item_text(animation->get_selected());
- if (current != "") {
- Ref<Animation> anim = player->get_animation(current);
-
- switch (p_option) {
- case ANIM_SAVE:
- _animation_save(anim);
- break;
- case ANIM_SAVE_AS:
- _animation_save_as(anim);
- break;
- }
- }
-}
-
void AnimationPlayerEditor::_onion_skinning_menu(int p_option) {
PopupMenu *menu = onion_skinning->get_popup();
@@ -1421,7 +1461,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
float pos = cpos + step_off * anim->get_step();
- bool valid = anim->has_loop() || pos >= 0 && pos <= anim->get_length();
+ bool valid = anim->has_loop() || (pos >= 0 && pos <= anim->get_length());
onion.captures_valid[cidx] = valid;
if (valid) {
player->seek(pos, true);
@@ -1484,6 +1524,10 @@ void AnimationPlayerEditor::_stop_onion_skinning() {
}
}
+void AnimationPlayerEditor::_pin_pressed() {
+ EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
+}
+
void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &AnimationPlayerEditor::_gui_input);
@@ -1522,11 +1566,13 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_blend_editor_next_changed"), &AnimationPlayerEditor::_blend_editor_next_changed);
ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &AnimationPlayerEditor::_unhandled_key_input);
ClassDB::bind_method(D_METHOD("_animation_tool_menu"), &AnimationPlayerEditor::_animation_tool_menu);
- ClassDB::bind_method(D_METHOD("_animation_save_menu"), &AnimationPlayerEditor::_animation_save_menu);
+
ClassDB::bind_method(D_METHOD("_onion_skinning_menu"), &AnimationPlayerEditor::_onion_skinning_menu);
ClassDB::bind_method(D_METHOD("_editor_visibility_changed"), &AnimationPlayerEditor::_editor_visibility_changed);
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_1"), &AnimationPlayerEditor::_prepare_onion_layers_1);
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2);
+
+ ClassDB::bind_method(D_METHOD("_pin_pressed"), &AnimationPlayerEditor::_pin_pressed);
}
AnimationPlayerEditor *AnimationPlayerEditor::singleton = NULL;
@@ -1596,26 +1642,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
scale->set_tooltip(TTR("Scale animation playback globally for the node."));
scale->hide();
- add_anim = memnew(ToolButton);
- ED_SHORTCUT("animation_player_editor/add_animation", TTR("Create new animation in player."));
- add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/add_animation"));
- add_anim->set_tooltip(TTR("Create new animation in player."));
-
- hb->add_child(add_anim);
-
- load_anim = memnew(ToolButton);
- ED_SHORTCUT("animation_player_editor/load_from_disk", TTR("Load animation from disk."));
- add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/load_from_disk"));
- load_anim->set_tooltip(TTR("Load an animation from disk."));
- hb->add_child(load_anim);
-
- save_anim = memnew(MenuButton);
- save_anim->set_tooltip(TTR("Save the current animation"));
- save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save", TTR("Save")), ANIM_SAVE);
- save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_as", TTR("Save As")), ANIM_SAVE_AS);
- save_anim->set_focus_mode(Control::FOCUS_NONE);
- hb->add_child(save_anim);
-
accept = memnew(AcceptDialog);
add_child(accept);
accept->connect("confirmed", this, "_menu_confirm_current");
@@ -1624,23 +1650,28 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
add_child(delete_dialog);
delete_dialog->connect("confirmed", this, "_animation_remove_confirmed");
- duplicate_anim = memnew(ToolButton);
- hb->add_child(duplicate_anim);
- ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate Animation"));
- duplicate_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/duplicate_animation"));
- duplicate_anim->set_tooltip(TTR("Duplicate Animation"));
-
- rename_anim = memnew(ToolButton);
- hb->add_child(rename_anim);
- ED_SHORTCUT("animation_player_editor/rename_animation", TTR("Rename Animation"));
- rename_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/rename_animation"));
- rename_anim->set_tooltip(TTR("Rename Animation"));
-
- remove_anim = memnew(ToolButton);
- hb->add_child(remove_anim);
- ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove Animation"));
- remove_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/remove_animation"));
- remove_anim->set_tooltip(TTR("Remove Animation"));
+ tool_anim = memnew(MenuButton);
+ tool_anim->set_flat(false);
+ //tool_anim->set_flat(false);
+ tool_anim->set_tooltip(TTR("Animation Tools"));
+ tool_anim->set_text(TTR("Animation"));
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/new_animation", TTR("New")), TOOL_NEW_ANIM);
+ tool_anim->get_popup()->add_separator();
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/open_animation", TTR("Load")), TOOL_LOAD_ANIM);
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_animation", TTR("Save")), TOOL_SAVE_ANIM);
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_as_animation", TTR("Save As...")), TOOL_SAVE_AS_ANIM);
+ tool_anim->get_popup()->add_separator();
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/copy_animation", TTR("Copy")), TOOL_COPY_ANIM);
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/paste_animation", TTR("Paste")), TOOL_PASTE_ANIM);
+ tool_anim->get_popup()->add_separator();
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate")), TOOL_DUPLICATE_ANIM);
+ tool_anim->get_popup()->add_separator();
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/rename_animation", TTR("Rename...")), TOOL_RENAME_ANIM);
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/edit_transitions", TTR("Edit Transitions...")), TOOL_EDIT_TRANSITIONS);
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/open_animation_in_inspector", TTR("Open in Inspector")), TOOL_EDIT_RESOURCE);
+ tool_anim->get_popup()->add_separator();
+ tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove")), TOOL_REMOVE_ANIM);
+ hb->add_child(tool_anim);
animation = memnew(OptionButton);
hb->add_child(animation);
@@ -1652,18 +1683,12 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
hb->add_child(autoplay);
autoplay->set_tooltip(TTR("Autoplay on Load"));
- blend_anim = memnew(ToolButton);
- hb->add_child(blend_anim);
- blend_anim->set_tooltip(TTR("Edit Target Blend Times"));
-
- tool_anim = memnew(MenuButton);
- //tool_anim->set_flat(false);
- tool_anim->set_tooltip(TTR("Animation Tools"));
- tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/copy_animation", TTR("Copy Animation")), TOOL_COPY_ANIM);
- tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/paste_animation", TTR("Paste Animation")), TOOL_PASTE_ANIM);
//tool_anim->get_popup()->add_separator();
//tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM);
- hb->add_child(tool_anim);
+
+ track_editor = memnew(AnimationTrackEditor);
+
+ hb->add_child(track_editor->get_edit_menu());
onion_skinning = memnew(MenuButton);
//onion_skinning->set_flat(false);
@@ -1678,10 +1703,10 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
onion_skinning->get_popup()->add_separator();
onion_skinning->get_popup()->add_item(TTR("Depth"), -1);
onion_skinning->get_popup()->set_item_disabled(onion_skinning->get_popup()->get_item_count() - 1, true);
- onion_skinning->get_popup()->add_check_item(TTR("1 step"), ONION_SKINNING_1_STEP);
+ onion_skinning->get_popup()->add_radio_check_item(TTR("1 step"), ONION_SKINNING_1_STEP);
onion_skinning->get_popup()->set_item_checked(onion_skinning->get_popup()->get_item_count() - 1, true);
- onion_skinning->get_popup()->add_check_item(TTR("2 steps"), ONION_SKINNING_2_STEPS);
- onion_skinning->get_popup()->add_check_item(TTR("3 steps"), ONION_SKINNING_3_STEPS);
+ onion_skinning->get_popup()->add_radio_check_item(TTR("2 steps"), ONION_SKINNING_2_STEPS);
+ onion_skinning->get_popup()->add_radio_check_item(TTR("3 steps"), ONION_SKINNING_3_STEPS);
onion_skinning->get_popup()->add_separator();
onion_skinning->get_popup()->add_check_item(TTR("Differences Only"), ONION_SKINNING_DIFFERENCES_ONLY);
onion_skinning->get_popup()->add_check_item(TTR("Force White Modulate"), ONION_SKINNING_FORCE_WHITE_MODULATE);
@@ -1690,11 +1715,9 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
pin = memnew(ToolButton);
pin->set_toggle_mode(true);
+ pin->set_tooltip(TTR("Pin AnimationPlayer"));
hb->add_child(pin);
-
- resource_edit_anim = memnew(Button);
- hb->add_child(resource_edit_anim);
- resource_edit_anim->hide();
+ pin->connect("pressed", this, "_pin_pressed");
file = memnew(EditorFileDialog);
add_child(file);
@@ -1717,7 +1740,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
error_dialog = memnew(ConfirmationDialog);
error_dialog->get_ok()->set_text(TTR("Close"));
- error_dialog->set_text(TTR("Error!"));
+ error_dialog->set_title(TTR("Error!"));
add_child(error_dialog);
name_dialog->connect("confirmed", this, "_animation_name_edited");
@@ -1747,16 +1770,10 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
play_bw_from->connect("pressed", this, "_play_bw_from_pressed");
stop->connect("pressed", this, "_stop_pressed");
//pause->connect("pressed", this,"_pause_pressed");
- add_anim->connect("pressed", this, "_animation_new");
- rename_anim->connect("pressed", this, "_animation_rename");
- load_anim->connect("pressed", this, "_animation_load");
- duplicate_anim->connect("pressed", this, "_animation_duplicate");
//frame->connect("text_entered", this,"_seek_frame_changed");
- blend_anim->connect("pressed", this, "_animation_blend");
- remove_anim->connect("pressed", this, "_animation_remove");
animation->connect("item_selected", this, "_animation_selected", Vector<Variant>(), true);
- resource_edit_anim->connect("pressed", this, "_animation_resource_edit");
+
file->connect("file_selected", this, "_dialog_action");
frame->connect("value_changed", this, "_seek_value_changed", Vector<Variant>(), true);
scale->connect("text_entered", this, "_scale_changed", Vector<Variant>(), true);
@@ -1766,18 +1783,17 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
set_process_unhandled_key_input(true);
- key_editor = memnew(AnimationKeyEditor);
- add_child(key_editor);
- key_editor->set_v_size_flags(SIZE_EXPAND_FILL);
- key_editor->connect("timeline_changed", this, "_animation_key_editor_seek");
- key_editor->connect("animation_len_changed", this, "_animation_key_editor_anim_len_changed");
- key_editor->connect("animation_step_changed", this, "_animation_key_editor_anim_step_changed");
+ add_child(track_editor);
+ track_editor->set_v_size_flags(SIZE_EXPAND_FILL);
+ track_editor->connect("timeline_changed", this, "_animation_key_editor_seek");
+ track_editor->connect("animation_len_changed", this, "_animation_key_editor_anim_len_changed");
+ track_editor->connect("animation_step_changed", this, "_animation_key_editor_anim_step_changed");
_update_player();
// Onion skinning
- key_editor->connect("visibility_changed", this, "_editor_visibility_changed");
+ track_editor->connect("visibility_changed", this, "_editor_visibility_changed");
onion.enabled = false;
onion.past = true;
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index a7b7c6c465..5ac7b99903 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -42,8 +42,9 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class AnimationKeyEditor;
+class AnimationTrackEditor;
class AnimationPlayerEditorPlugin;
+
class AnimationPlayerEditor : public VBoxContainer {
GDCLASS(AnimationPlayerEditor, VBoxContainer);
@@ -53,6 +54,14 @@ class AnimationPlayerEditor : public VBoxContainer {
AnimationPlayer *player;
enum {
+ TOOL_NEW_ANIM,
+ TOOL_LOAD_ANIM,
+ TOOL_SAVE_ANIM,
+ TOOL_SAVE_AS_ANIM,
+ TOOL_DUPLICATE_ANIM,
+ TOOL_RENAME_ANIM,
+ TOOL_EDIT_TRANSITIONS,
+ TOOL_REMOVE_ANIM,
TOOL_COPY_ANIM,
TOOL_PASTE_ANIM,
TOOL_EDIT_RESOURCE
@@ -72,6 +81,7 @@ class AnimationPlayerEditor : public VBoxContainer {
};
enum {
+ ANIM_OPEN,
ANIM_SAVE,
ANIM_SAVE_AS
};
@@ -89,16 +99,8 @@ class AnimationPlayerEditor : public VBoxContainer {
Button *play_bw_from;
//Button *pause;
- Button *add_anim;
Button *autoplay;
- Button *rename_anim;
- Button *duplicate_anim;
-
- Button *resource_edit_anim;
- Button *load_anim;
- MenuButton *save_anim;
- Button *blend_anim;
- Button *remove_anim;
+
MenuButton *tool_anim;
MenuButton *onion_skinning;
ToolButton *pin;
@@ -130,7 +132,7 @@ class AnimationPlayerEditor : public VBoxContainer {
bool updating;
bool updating_blends;
- AnimationKeyEditor *key_editor;
+ AnimationTrackEditor *track_editor;
// Onion skinning
struct {
@@ -207,8 +209,8 @@ class AnimationPlayerEditor : public VBoxContainer {
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
void _animation_tool_menu(int p_option);
- void _animation_save_menu(int p_option);
void _onion_skinning_menu(int p_option);
+ void _animation_about_to_show_menu();
void _editor_visibility_changed();
bool _are_onion_layers_valid();
@@ -219,6 +221,8 @@ class AnimationPlayerEditor : public VBoxContainer {
void _start_onion_skinning();
void _stop_onion_skinning();
+ void _pin_pressed();
+
AnimationPlayerEditor();
~AnimationPlayerEditor();
@@ -232,7 +236,9 @@ public:
AnimationPlayer *get_player() const;
static AnimationPlayerEditor *singleton;
- AnimationKeyEditor *get_key_editor() { return key_editor; }
+ bool is_pinned() const { return pin->is_pressed(); }
+ void unpin() { pin->set_pressed(false); }
+ AnimationTrackEditor *get_track_editor() { return track_editor; }
Dictionary get_state() const;
void set_state(const Dictionary &p_state);
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
new file mode 100644
index 0000000000..04bd5f0cec
--- /dev/null
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -0,0 +1,1313 @@
+#include "animation_state_machine_editor.h"
+
+#include "core/io/resource_loader.h"
+#include "core/project_settings.h"
+#include "math/delaunay.h"
+#include "os/input.h"
+#include "os/keyboard.h"
+#include "scene/animation/animation_blend_tree.h"
+#include "scene/animation/animation_player.h"
+#include "scene/gui/menu_button.h"
+#include "scene/gui/panel.h"
+#include "scene/main/viewport.h"
+
+void AnimationNodeStateMachineEditor::edit(AnimationNodeStateMachine *p_state_machine) {
+
+ if (state_machine.is_valid()) {
+ state_machine->disconnect("removed_from_graph", this, "_removed_from_graph");
+ }
+
+ if (p_state_machine) {
+ state_machine = Ref<AnimationNodeStateMachine>(p_state_machine);
+ } else {
+ state_machine.unref();
+ }
+
+ if (state_machine.is_null()) {
+ hide();
+ } else {
+ state_machine->connect("removed_from_graph", this, "_removed_from_graph");
+
+ selected_transition_from = StringName();
+ selected_transition_to = StringName();
+ selected_node = StringName();
+ _update_mode();
+ _update_graph();
+ }
+}
+
+void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventKey> k = p_event;
+ if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (selected_node != StringName() || selected_transition_to != StringName() || selected_transition_from != StringName()) {
+ _erase_selected();
+ accept_event();
+ }
+ }
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ //Add new node
+ if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == BUTTON_LEFT))) {
+ menu->clear();
+ animations_menu->clear();
+ animations_to_add.clear();
+ List<StringName> classes;
+ classes.sort_custom<StringName::AlphCompare>();
+
+ ClassDB::get_inheriters_from_class("AnimationRootNode", &classes);
+ menu->add_submenu_item(TTR("Add Animation"), "animations");
+
+ AnimationTree *gp = state_machine->get_tree();
+ ERR_FAIL_COND(!gp);
+ if (gp && gp->has_node(gp->get_animation_player())) {
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(gp->get_node(gp->get_animation_player()));
+ if (ap) {
+ List<StringName> names;
+ ap->get_animation_list(&names);
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get());
+ animations_to_add.push_back(E->get());
+ }
+ }
+ }
+
+ for (List<StringName>::Element *E = classes.front(); E; E = E->next()) {
+
+ String name = String(E->get()).replace_first("AnimationNode", "");
+ if (name == "Animation")
+ continue; // nope
+ int idx = menu->get_item_count();
+ menu->add_item(vformat("Add %s", name));
+ menu->set_item_metadata(idx, E->get());
+ }
+
+ menu->set_global_position(state_machine_draw->get_global_transform().xform(mb->get_position()));
+ menu->popup();
+ add_node_pos = mb->get_position() / EDSCALE + state_machine->get_graph_offset();
+ }
+
+ // select node or push a field inside
+ if (mb.is_valid() && !mb->get_shift() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+ selected_transition_from = StringName();
+ selected_transition_to = StringName();
+ selected_node = StringName();
+
+ for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
+
+ if (node_rects[i].play.has_point(mb->get_position())) { //edit name
+ if (play_mode->get_selected() == 1 || !state_machine->is_playing()) {
+ //start
+ state_machine->start(node_rects[i].node_name);
+ } else {
+ //travel
+ if (!state_machine->travel(node_rects[i].node_name)) {
+
+ state_machine->start(node_rects[i].node_name);
+ //removing this due to usability..
+ //error_time = 5;
+ //error_text = vformat(TTR("No path found from '%s' to '%s'."), state_machine->get_current_node(), node_rects[i].node_name);
+ }
+ }
+ state_machine_draw->update();
+ return;
+ }
+
+ if (node_rects[i].name.has_point(mb->get_position())) { //edit name
+
+ Ref<StyleBox> line_sb = get_stylebox("normal", "LineEdit");
+
+ Rect2 edit_rect = node_rects[i].name;
+ edit_rect.position -= line_sb->get_offset();
+ edit_rect.size += line_sb->get_minimum_size();
+
+ name_edit->set_global_position(state_machine_draw->get_global_transform().xform(edit_rect.position));
+ name_edit->set_size(edit_rect.size);
+ name_edit->set_text(node_rects[i].node_name);
+ name_edit->show_modal();
+ name_edit->grab_focus();
+ name_edit->select_all();
+
+ prev_name = node_rects[i].node_name;
+ return;
+ }
+
+ if (node_rects[i].edit.has_point(mb->get_position())) { //edit name
+ call_deferred("_open_editor", node_rects[i].node_name);
+ return;
+ }
+
+ if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected
+ selected_node = node_rects[i].node_name;
+
+ Ref<AnimationNode> anode = state_machine->get_node(selected_node);
+ EditorNode::get_singleton()->push_item(anode.ptr(), "", true);
+ state_machine_draw->update();
+ dragging_selected_attempt = true;
+ dragging_selected = false;
+ drag_from = mb->get_position();
+ snap_x = StringName();
+ snap_y = StringName();
+ _update_mode();
+ return;
+ }
+ }
+
+ //test the lines now
+ int closest = -1;
+ float closest_d = 1e20;
+ for (int i = 0; i < transition_lines.size(); i++) {
+
+ Vector2 s[2] = {
+ transition_lines[i].from,
+ transition_lines[i].to
+ };
+ Vector2 cpoint = Geometry::get_closest_point_to_segment_2d(mb->get_position(), s);
+ float d = cpoint.distance_to(mb->get_position());
+ if (d > transition_lines[i].width) {
+ continue;
+ }
+
+ if (d < closest_d) {
+ closest = i;
+ closest_d = d;
+ }
+ }
+
+ if (closest >= 0) {
+ selected_transition_from = transition_lines[closest].from_node;
+ selected_transition_to = transition_lines[closest].to_node;
+
+ Ref<AnimationNodeStateMachineTransition> tr = state_machine->get_transition(closest);
+ EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
+ }
+
+ state_machine_draw->update();
+ _update_mode();
+ }
+
+ //end moving node
+ if (mb.is_valid() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
+
+ if (dragging_selected) {
+
+ Ref<AnimationNode> an = state_machine->get_node(selected_node);
+ updating = true;
+ undo_redo->create_action("Move Node");
+ undo_redo->add_do_method(an.ptr(), "set_position", an->get_position() + drag_ofs / EDSCALE);
+ undo_redo->add_undo_method(an.ptr(), "set_position", an->get_position());
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+ }
+ snap_x = StringName();
+ snap_y = StringName();
+
+ dragging_selected_attempt = false;
+ dragging_selected = false;
+ state_machine_draw->update();
+ }
+
+ //connect nodes
+ if (mb.is_valid() && ((tool_select->is_pressed() && mb->get_shift()) || tool_connect->is_pressed()) && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
+
+ for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
+ if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected
+ connecting = true;
+ connecting_from = node_rects[i].node_name;
+ connecting_to = mb->get_position();
+ connecting_to_node = StringName();
+ return;
+ }
+ }
+ }
+
+ //end connecting nodes
+ if (mb.is_valid() && connecting && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
+
+ if (connecting_to_node != StringName()) {
+
+ if (state_machine->has_transition(connecting_from, connecting_to_node)) {
+ EditorNode::get_singleton()->show_warning("Transition exists!");
+
+ } else {
+
+ Ref<AnimationNodeStateMachineTransition> tr;
+ tr.instance();
+ tr->set_switch_mode(AnimationNodeStateMachineTransition::SwitchMode(transition_mode->get_selected()));
+
+ updating = true;
+ undo_redo->create_action("Add Transition");
+ undo_redo->add_do_method(state_machine.ptr(), "add_transition", connecting_from, connecting_to_node, tr);
+ undo_redo->add_undo_method(state_machine.ptr(), "remove_transition", connecting_from, connecting_to_node);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+
+ selected_transition_from = connecting_from;
+ selected_transition_to = connecting_to_node;
+
+ EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
+ _update_mode();
+ }
+ }
+ connecting_to_node = StringName();
+ connecting = false;
+ state_machine_draw->update();
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ //pan window
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
+
+ h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
+ v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
+ }
+
+ //move mouse while connecting
+ if (mm.is_valid() && connecting) {
+
+ connecting_to = mm->get_position();
+ connecting_to_node = StringName();
+ state_machine_draw->update();
+
+ for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
+ if (node_rects[i].node_name != connecting_from && node_rects[i].node.has_point(connecting_to)) { //select node since nothing else was selected
+ connecting_to_node = node_rects[i].node_name;
+ return;
+ }
+ }
+ }
+
+ //move mouse while moving a node
+ if (mm.is_valid() && dragging_selected_attempt) {
+
+ dragging_selected = true;
+ drag_ofs = mm->get_position() - drag_from;
+ snap_x = StringName();
+ snap_y = StringName();
+ {
+ //snap
+ Vector2 cpos = state_machine->get_node(selected_node)->get_position() + drag_ofs / EDSCALE;
+ List<StringName> nodes;
+ state_machine->get_node_list(&nodes);
+
+ float best_d_x = 1e20;
+ float best_d_y = 1e20;
+
+ for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
+ if (E->get() == selected_node)
+ continue;
+ Vector2 npos = state_machine->get_node(E->get())->get_position();
+
+ float d_x = ABS(npos.x - cpos.x);
+ if (d_x < MIN(5, best_d_x)) {
+ drag_ofs.x -= cpos.x - npos.x;
+ best_d_x = d_x;
+ snap_x = E->get();
+ }
+
+ float d_y = ABS(npos.y - cpos.y);
+ if (d_y < MIN(5, best_d_y)) {
+ drag_ofs.y -= cpos.y - npos.y;
+ best_d_y = d_y;
+ snap_y = E->get();
+ }
+ }
+ }
+
+ state_machine_draw->update();
+ }
+
+ //put ibeam (text cursor) over names to make it clearer that they are editable
+ if (mm.is_valid()) {
+
+ state_machine_draw->grab_focus();
+
+ bool over_text_now = false;
+ String new_over_node = StringName();
+ int new_over_node_what = -1;
+ if (tool_select->is_pressed()) {
+
+ for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
+
+ if (node_rects[i].name.has_point(mm->get_position())) {
+ over_text_now = true;
+ break;
+ }
+
+ if (node_rects[i].node.has_point(mm->get_position())) {
+ new_over_node = node_rects[i].node_name;
+ if (node_rects[i].play.has_point(mm->get_position())) {
+ new_over_node_what = 0;
+ }
+ if (node_rects[i].edit.has_point(mm->get_position())) {
+ new_over_node_what = 1;
+ }
+ }
+ }
+ }
+
+ if (new_over_node != over_node || new_over_node_what != over_node_what) {
+ over_node = new_over_node;
+ over_node_what = new_over_node_what;
+ state_machine_draw->update();
+ }
+
+ if (over_text != over_text_now) {
+
+ if (over_text_now) {
+ state_machine_draw->set_default_cursor_shape(CURSOR_IBEAM);
+ } else {
+ state_machine_draw->set_default_cursor_shape(CURSOR_ARROW);
+ }
+
+ over_text = over_text_now;
+ }
+ }
+}
+
+void AnimationNodeStateMachineEditor::_add_menu_type(int p_index) {
+
+ String type = menu->get_item_metadata(p_index);
+
+ Object *obj = ClassDB::instance(type);
+ ERR_FAIL_COND(!obj);
+ AnimationNode *an = Object::cast_to<AnimationNode>(obj);
+ ERR_FAIL_COND(!an);
+
+ Ref<AnimationNode> node(an);
+ node->set_position(add_node_pos);
+
+ String base_name = type.replace_first("AnimationNode", "");
+ int base = 1;
+ String name = base_name;
+ while (state_machine->has_node(name)) {
+ base++;
+ name = base_name + " " + itos(base);
+ }
+
+ updating = true;
+ undo_redo->create_action("Add Node");
+ undo_redo->add_do_method(state_machine.ptr(), "add_node", name, node);
+ undo_redo->add_undo_method(state_machine.ptr(), "remove_node", name);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+
+ state_machine_draw->update();
+}
+
+void AnimationNodeStateMachineEditor::_add_animation_type(int p_index) {
+
+ Ref<AnimationNodeAnimation> anim;
+ anim.instance();
+
+ anim->set_animation(animations_to_add[p_index]);
+
+ String base_name = animations_to_add[p_index];
+ int base = 1;
+ String name = base_name;
+ while (state_machine->has_node(name)) {
+ base++;
+ name = base_name + " " + itos(base);
+ }
+
+ anim->set_position(add_node_pos);
+
+ updating = true;
+ undo_redo->create_action("Add Node");
+ undo_redo->add_do_method(state_machine.ptr(), "add_node", name, anim);
+ undo_redo->add_undo_method(state_machine.ptr(), "remove_node", name);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+
+ state_machine_draw->update();
+}
+
+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) {
+
+ Color linecolor = get_color("font_color", "Label");
+ Color icon_color(1, 1, 1);
+ Color accent = get_color("accent_color", "Editor");
+
+ if (!p_enabled) {
+ linecolor.a *= 0.2;
+ icon_color.a *= 0.2;
+ accent.a *= 0.6;
+ }
+
+ Ref<Texture> icons[6] = {
+ get_icon("TransitionImmediateBig", "EditorIcons"),
+ get_icon("TransitionSyncBig", "EditorIcons"),
+ get_icon("TransitionEndBig", "EditorIcons"),
+ get_icon("TransitionImmediateAutoBig", "EditorIcons"),
+ get_icon("TransitionSyncAutoBig", "EditorIcons"),
+ get_icon("TransitionEndAutoBig", "EditorIcons")
+ };
+
+ if (p_selected) {
+ state_machine_draw->draw_line(p_from, p_to, accent, 6, true);
+ }
+
+ 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, true);
+
+ Ref<Texture> icon = icons[p_mode + (p_auto_advance ? 3 : 0)];
+
+ Transform2D xf;
+ xf.elements[0] = (p_to - p_from).normalized();
+ xf.elements[1] = xf.elements[0].tangent();
+ xf.elements[2] = (p_from + p_to) * 0.5 - xf.elements[1] * icon->get_height() * 0.5 - xf.elements[0] * icon->get_height() * 0.5;
+
+ state_machine_draw->draw_set_transform_matrix(xf);
+ state_machine_draw->draw_texture(icon, Vector2(), icon_color);
+ state_machine_draw->draw_set_transform_matrix(Transform2D());
+}
+
+void AnimationNodeStateMachineEditor::_clip_src_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect) {
+
+ if (r_to == r_from)
+ return;
+
+ //this could be optimized...
+ Vector2 n = (r_to - r_from).normalized();
+ while (p_rect.has_point(r_from)) {
+ r_from += n;
+ }
+}
+
+void AnimationNodeStateMachineEditor::_clip_dst_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect) {
+
+ if (r_to == r_from)
+ return;
+
+ //this could be optimized...
+ Vector2 n = (r_to - r_from).normalized();
+ while (p_rect.has_point(r_to)) {
+ r_to -= n;
+ }
+}
+
+void AnimationNodeStateMachineEditor::_state_machine_draw() {
+
+ Ref<StyleBox> style = get_stylebox("frame", "GraphNode");
+ Ref<StyleBox> style_selected = get_stylebox("selectedframe", "GraphNode");
+
+ Ref<Font> font = get_font("title_font", "GraphNode");
+ Color font_color = get_color("title_color", "GraphNode");
+ Ref<Texture> play = get_icon("Play", "EditorIcons");
+ Ref<Texture> auto_play = get_icon("AutoPlay", "EditorIcons");
+ Ref<Texture> edit = get_icon("Edit", "EditorIcons");
+ Color accent = get_color("accent_color", "Editor");
+ Color linecolor = get_color("font_color", "Label");
+ linecolor.a *= 0.3;
+ Ref<StyleBox> playing_overlay = get_stylebox("position", "GraphNode");
+
+ bool playing = state_machine->is_playing();
+ StringName current = state_machine->get_current_node();
+ StringName blend_from = state_machine->get_blend_from_node();
+ Vector<StringName> travel_path = state_machine->get_travel_path();
+
+ if (state_machine_draw->has_focus()) {
+ state_machine_draw->draw_rect(Rect2(Point2(), state_machine_draw->get_size()), accent, false);
+ }
+ int sep = 3 * EDSCALE;
+
+ List<StringName> nodes;
+ state_machine->get_node_list(&nodes);
+
+ node_rects.clear();
+ Rect2 scroll_range(Point2(), state_machine_draw->get_size());
+
+ //snap lines
+ if (dragging_selected) {
+
+ Vector2 from = (state_machine->get_node(selected_node)->get_position() * EDSCALE) + drag_ofs - state_machine->get_graph_offset() * EDSCALE;
+ if (snap_x != StringName()) {
+ Vector2 to = (state_machine->get_node(snap_x)->get_position() * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
+ state_machine_draw->draw_line(from, to, linecolor, 2);
+ }
+ if (snap_y != StringName()) {
+ Vector2 to = (state_machine->get_node(snap_y)->get_position() * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
+ state_machine_draw->draw_line(from, to, linecolor, 2);
+ }
+ }
+
+ //pre pass nodes so we know the rectangles
+ for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
+
+ Ref<AnimationNode> anode = state_machine->get_node(E->get());
+ String name = E->get();
+ bool needs_editor = EditorNode::get_singleton()->item_has_editor(anode.ptr());
+ Ref<StyleBox> sb = E->get() == selected_node ? style_selected : style;
+
+ Size2 s = sb->get_minimum_size();
+ int strsize = font->get_string_size(name).width;
+ s.width += strsize;
+ s.height += MAX(font->get_height(), play->get_height());
+ s.width += sep + play->get_width();
+ if (needs_editor) {
+ s.width += sep + edit->get_width();
+ }
+
+ Vector2 offset;
+ offset += anode->get_position() * EDSCALE;
+ if (selected_node == E->get() && dragging_selected) {
+ offset += drag_ofs;
+ }
+ offset -= s / 2;
+ offset = offset.floor();
+
+ //prepre rect
+
+ NodeRect nr;
+ nr.node = Rect2(offset, s);
+ nr.node_name = E->get();
+
+ scroll_range = scroll_range.merge(nr.node); //merge with range
+
+ //now scroll it to draw
+ nr.node.position -= state_machine->get_graph_offset() * EDSCALE;
+
+ node_rects.push_back(nr);
+ }
+
+ transition_lines.clear();
+
+ //draw conecting line for potential new transition
+ if (connecting) {
+ Vector2 from = (state_machine->get_node(connecting_from)->get_position() * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
+ Vector2 to;
+ if (connecting_to_node != StringName()) {
+ to = (state_machine->get_node(connecting_to_node)->get_position() * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
+ } else {
+ to = connecting_to;
+ }
+
+ for (int i = 0; i < node_rects.size(); i++) {
+ if (node_rects[i].node_name == connecting_from) {
+ _clip_src_line_to_rect(from, to, node_rects[i].node);
+ }
+ if (node_rects[i].node_name == connecting_to_node) {
+ _clip_dst_line_to_rect(from, to, node_rects[i].node);
+ }
+ }
+
+ _connection_draw(from, to, AnimationNodeStateMachineTransition::SwitchMode(transition_mode->get_selected()), true, false, false, false);
+ }
+
+ Ref<Texture> tr_reference_icon = get_icon("TransitionImmediateBig", "EditorIcons");
+ float tr_bidi_offset = int(tr_reference_icon->get_height() * 0.8);
+
+ //draw transition lines
+ for (int i = 0; i < state_machine->get_transition_count(); i++) {
+
+ TransitionLine tl;
+ tl.from_node = state_machine->get_transition_from(i);
+ Vector2 ofs_from = (dragging_selected && tl.from_node == selected_node) ? drag_ofs : Vector2();
+ tl.from = (state_machine->get_node(tl.from_node)->get_position() * EDSCALE) + ofs_from - state_machine->get_graph_offset() * EDSCALE;
+
+ tl.to_node = state_machine->get_transition_to(i);
+ Vector2 ofs_to = (dragging_selected && tl.to_node == selected_node) ? drag_ofs : Vector2();
+ tl.to = (state_machine->get_node(tl.to_node)->get_position() * EDSCALE) + ofs_to - state_machine->get_graph_offset() * EDSCALE;
+
+ Ref<AnimationNodeStateMachineTransition> tr = state_machine->get_transition(i);
+ tl.disabled = tr->is_disabled();
+ tl.auto_advance = tr->has_auto_advance();
+ tl.mode = tr->get_switch_mode();
+ tl.width = tr_bidi_offset;
+
+ if (state_machine->has_transition(tl.to_node, tl.from_node)) { //offset if same exists
+ Vector2 offset = -(tl.from - tl.to).normalized().tangent() * tr_bidi_offset;
+ tl.from += offset;
+ tl.to += offset;
+ }
+
+ for (int i = 0; i < node_rects.size(); i++) {
+ if (node_rects[i].node_name == tl.from_node) {
+ _clip_src_line_to_rect(tl.from, tl.to, node_rects[i].node);
+ }
+ if (node_rects[i].node_name == tl.to_node) {
+ _clip_dst_line_to_rect(tl.from, tl.to, node_rects[i].node);
+ }
+ }
+
+ bool selected = selected_transition_from == tl.from_node && selected_transition_to == tl.to_node;
+
+ bool travel = false;
+
+ if (blend_from == tl.from_node && current == tl.to_node) {
+ travel = true;
+ }
+
+ if (travel_path.size()) {
+
+ if (current == tl.from_node && travel_path[0] == tl.to_node) {
+ travel = true;
+ } else {
+ for (int j = 0; j < travel_path.size() - 1; j++) {
+ if (travel_path[j] == tl.from_node && travel_path[j + 1] == tl.to_node) {
+ travel = true;
+ break;
+ }
+ }
+ }
+ }
+ _connection_draw(tl.from, tl.to, tl.mode, !tl.disabled, selected, travel, tl.auto_advance);
+
+ transition_lines.push_back(tl);
+ }
+
+ //draw actual nodes
+ for (int i = 0; i < node_rects.size(); i++) {
+
+ String name = node_rects[i].node_name;
+ Ref<AnimationNode> anode = state_machine->get_node(name);
+ bool needs_editor = EditorNode::get_singleton()->item_has_editor(anode.ptr());
+ Ref<StyleBox> sb = name == selected_node ? style_selected : style;
+ int strsize = font->get_string_size(name).width;
+
+ NodeRect &nr = node_rects[i];
+
+ Vector2 offset = nr.node.position;
+ int h = nr.node.size.height;
+
+ //prepre rect
+
+ //now scroll it to draw
+ state_machine_draw->draw_style_box(sb, nr.node);
+
+ if (playing && (blend_from == name || current == name || travel_path.find(name) != -1)) {
+ state_machine_draw->draw_style_box(playing_overlay, nr.node);
+ }
+
+ bool onstart = state_machine->get_start_node() == name;
+ if (onstart) {
+ state_machine_draw->draw_string(font, offset + Vector2(0, -font->get_height() - 3 * EDSCALE + font->get_ascent()), TTR("Start"), font_color);
+ }
+
+ if (state_machine->get_end_node() == name) {
+
+ int endofs = nr.node.size.x - font->get_string_size(TTR("End")).x;
+ state_machine_draw->draw_string(font, offset + Vector2(endofs, -font->get_height() - 3 * EDSCALE + font->get_ascent()), TTR("End"), font_color);
+ }
+
+ offset.x += sb->get_offset().x;
+
+ nr.play.position = offset + Vector2(0, (h - play->get_height()) / 2).floor();
+ nr.play.size = play->get_size();
+
+ Ref<Texture> play_tex = onstart ? auto_play : play;
+
+ if (over_node == name && over_node_what == 0) {
+ state_machine_draw->draw_texture(play_tex, nr.play.position, accent);
+ } else {
+ state_machine_draw->draw_texture(play_tex, nr.play.position);
+ }
+ offset.x += sep + play->get_width();
+
+ nr.name.position = offset + Vector2(0, (h - font->get_height()) / 2).floor();
+ nr.name.size = Vector2(strsize, font->get_height());
+
+ state_machine_draw->draw_string(font, nr.name.position + Vector2(0, font->get_ascent()), name, font_color);
+ offset.x += strsize + sep;
+
+ if (needs_editor) {
+ nr.edit.position = offset + Vector2(0, (h - edit->get_height()) / 2).floor();
+ nr.edit.size = edit->get_size();
+
+ if (over_node == name && over_node_what == 1) {
+ state_machine_draw->draw_texture(edit, nr.edit.position, accent);
+ } else {
+ state_machine_draw->draw_texture(edit, nr.edit.position);
+ }
+ offset.x += sep + edit->get_width();
+ }
+ }
+
+ scroll_range = scroll_range.grow(200 * EDSCALE);
+
+ //adjust scrollbars
+ updating = true;
+ h_scroll->set_min(scroll_range.position.x);
+ h_scroll->set_max(scroll_range.position.x + scroll_range.size.x);
+ h_scroll->set_page(state_machine_draw->get_size().x);
+ h_scroll->set_value(state_machine->get_graph_offset().x);
+
+ v_scroll->set_min(scroll_range.position.y);
+ v_scroll->set_max(scroll_range.position.y + scroll_range.size.y);
+ v_scroll->set_page(state_machine_draw->get_size().y);
+ v_scroll->set_value(state_machine->get_graph_offset().y);
+ updating = false;
+
+ state_machine_play_pos->update();
+}
+
+void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
+
+ if (!state_machine->is_playing())
+ return;
+
+ int idx = -1;
+ for (int i = 0; node_rects.size(); i++) {
+ if (node_rects[i].node_name == state_machine->get_current_node()) {
+ idx = i;
+ break;
+ }
+ }
+
+ if (idx == -1)
+ return;
+
+ NodeRect &nr = node_rects[idx];
+
+ Vector2 from;
+ from.x = nr.play.position.x;
+ from.y = (nr.play.position.y + nr.play.size.y + nr.node.position.y + nr.node.size.y) * 0.5;
+
+ Vector2 to;
+ if (nr.edit.size.x) {
+ to.x = nr.edit.position.x + nr.edit.size.x;
+ } else {
+ to.x = nr.name.position.x + nr.name.size.x;
+ }
+ to.y = from.y;
+
+ float len = MAX(0.0001, state_machine->get_current_length());
+
+ float pos = CLAMP(state_machine->get_current_play_pos(), 0, len);
+ float c = pos / len;
+ Color fg = get_color("font_color", "Label");
+ Color bg = fg;
+ bg.a *= 0.3;
+
+ state_machine_play_pos->draw_line(from, to, bg, 2);
+
+ to = from.linear_interpolate(to, c);
+
+ state_machine_play_pos->draw_line(from, to, fg, 2);
+}
+
+void AnimationNodeStateMachineEditor::_update_graph() {
+
+ if (updating)
+ return;
+
+ updating = true;
+
+ if (state_machine->get_parent().is_valid()) {
+ goto_parent_hbox->show();
+ } else {
+ goto_parent_hbox->hide();
+ }
+
+ state_machine_draw->update();
+
+ updating = false;
+}
+
+void AnimationNodeStateMachineEditor::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ error_label->add_color_override("font_color", get_color("error_color", "Editor"));
+ panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ goto_parent->set_icon(get_icon("MoveUp", "EditorIcons"));
+
+ tool_select->set_icon(get_icon("ToolSelect", "EditorIcons"));
+ tool_create->set_icon(get_icon("ToolAddNode", "EditorIcons"));
+ tool_connect->set_icon(get_icon("ToolConnect", "EditorIcons"));
+
+ transition_mode->clear();
+ transition_mode->add_icon_item(get_icon("TransitionImmediate", "EditorIcons"), TTR("Immediate"));
+ transition_mode->add_icon_item(get_icon("TransitionSync", "EditorIcons"), TTR("Sync"));
+ transition_mode->add_icon_item(get_icon("TransitionEnd", "EditorIcons"), TTR("At End"));
+
+ //force filter on those, so they deform better
+ get_icon("TransitionImmediateBig", "EditorIcons")->set_flags(Texture::FLAG_FILTER);
+ get_icon("TransitionEndBig", "EditorIcons")->set_flags(Texture::FLAG_FILTER);
+ get_icon("TransitionSyncBig", "EditorIcons")->set_flags(Texture::FLAG_FILTER);
+ get_icon("TransitionImmediateAutoBig", "EditorIcons")->set_flags(Texture::FLAG_FILTER);
+ get_icon("TransitionEndAutoBig", "EditorIcons")->set_flags(Texture::FLAG_FILTER);
+ get_icon("TransitionSyncAutoBig", "EditorIcons")->set_flags(Texture::FLAG_FILTER);
+
+ tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
+ tool_autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
+ tool_end->set_icon(get_icon("AutoEnd", "EditorIcons"));
+
+ play_mode->clear();
+ play_mode->add_icon_item(get_icon("PlayTravel", "EditorIcons"), TTR("Travel"));
+ play_mode->add_icon_item(get_icon("Play", "EditorIcons"), TTR("Immediate"));
+ }
+
+ if (p_what == NOTIFICATION_PROCESS) {
+
+ String error;
+
+ if (error_time > 0) {
+ error = error_text;
+ error_time -= get_process_delta_time();
+ } else if (!state_machine->get_tree()) {
+ error = TTR("StateMachine does not belong to an AnimationTree node.");
+ } else if (!state_machine->get_tree()->is_active()) {
+ error = TTR("AnimationTree is inactive.\nActivate to enable playback, check node warnings if activation fails.");
+ } else if (state_machine->get_tree()->is_state_invalid()) {
+ error = state_machine->get_tree()->get_invalid_state_reason();
+ } else if (state_machine->get_parent().is_valid() && state_machine->get_parent()->is_class("AnimationNodeStateMachine")) {
+ if (state_machine->get_start_node() == StringName() || state_machine->get_end_node() == StringName()) {
+ error = TTR("Start and end nodes are needed for a sub-transition.");
+ }
+ }
+
+ if (error != error_label->get_text()) {
+ error_label->set_text(error);
+ if (error != String()) {
+ error_panel->show();
+ } else {
+ error_panel->hide();
+ }
+ }
+
+ for (int i = 0; i < transition_lines.size(); i++) {
+ int tidx = -1;
+ for (int j = 0; j < state_machine->get_transition_count(); j++) {
+ if (transition_lines[i].from_node == state_machine->get_transition_from(j) && transition_lines[i].to_node == state_machine->get_transition_to(j)) {
+ tidx = j;
+ break;
+ }
+ }
+
+ if (tidx == -1) { //missing transition, should redraw
+ state_machine_draw->update();
+ break;
+ }
+
+ if (transition_lines[i].disabled != state_machine->get_transition(tidx)->is_disabled()) {
+ state_machine_draw->update();
+ break;
+ }
+
+ if (transition_lines[i].auto_advance != state_machine->get_transition(tidx)->has_auto_advance()) {
+ state_machine_draw->update();
+ break;
+ }
+
+ if (transition_lines[i].mode != state_machine->get_transition(tidx)->get_switch_mode()) {
+ state_machine_draw->update();
+ break;
+ }
+ }
+
+ bool same_travel_path = true;
+ Vector<StringName> tp = state_machine->get_travel_path();
+
+ {
+
+ if (last_travel_path.size() != tp.size()) {
+ same_travel_path = false;
+ } else {
+ for (int i = 0; i < last_travel_path.size(); i++) {
+ if (last_travel_path[i] != tp[i]) {
+ same_travel_path = false;
+ break;
+ }
+ }
+ }
+ }
+
+ //update if travel state changed
+ if (!same_travel_path || last_active != state_machine->is_playing() || last_current_node != state_machine->get_current_node() || last_blend_from_node != state_machine->get_blend_from_node()) {
+
+ state_machine_draw->update();
+ last_travel_path = tp;
+ last_current_node = state_machine->get_current_node();
+ last_active = state_machine->is_playing();
+ last_blend_from_node = state_machine->get_blend_from_node();
+ state_machine_play_pos->update();
+ }
+
+ if (last_play_pos != state_machine->get_current_play_pos()) {
+
+ last_play_pos = state_machine->get_current_play_pos();
+ state_machine_play_pos->update();
+ }
+ }
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ over_node = StringName();
+ }
+}
+
+void AnimationNodeStateMachineEditor::_open_editor(const String &p_name) {
+ Ref<AnimationNode> an = state_machine->get_node(p_name);
+ ERR_FAIL_COND(!an.is_valid());
+ EditorNode::get_singleton()->edit_item(an.ptr());
+}
+
+void AnimationNodeStateMachineEditor::_goto_parent() {
+
+ EditorNode::get_singleton()->edit_item(state_machine->get_parent().ptr());
+}
+
+void AnimationNodeStateMachineEditor::_removed_from_graph() {
+ EditorNode::get_singleton()->edit_item(NULL);
+}
+
+void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
+
+ String new_name = p_text;
+
+ ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1)
+
+ ERR_FAIL_COND(new_name == prev_name);
+
+ String base_name = new_name;
+ int base = 1;
+ String name = base_name;
+ while (state_machine->has_node(name)) {
+ base++;
+ name = base_name + " " + itos(base);
+ }
+
+ updating = true;
+ undo_redo->create_action("Node Renamed");
+ undo_redo->add_do_method(state_machine.ptr(), "rename_node", prev_name, name);
+ undo_redo->add_undo_method(state_machine.ptr(), "rename_node", name, prev_name);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+
+ state_machine_draw->update();
+
+ name_edit->hide();
+}
+
+void AnimationNodeStateMachineEditor::_scroll_changed(double) {
+ if (updating)
+ return;
+
+ state_machine->set_graph_offset(Vector2(h_scroll->get_value(), v_scroll->get_value()));
+ state_machine_draw->update();
+}
+
+void AnimationNodeStateMachineEditor::_erase_selected() {
+
+ if (selected_node != StringName() && state_machine->has_node(selected_node)) {
+ updating = true;
+ undo_redo->create_action("Node Removed");
+ undo_redo->add_do_method(state_machine.ptr(), "remove_node", selected_node);
+ undo_redo->add_undo_method(state_machine.ptr(), "add_node", selected_node, state_machine->get_node(selected_node));
+ for (int i = 0; i < state_machine->get_transition_count(); i++) {
+ String from = state_machine->get_transition_from(i);
+ String to = state_machine->get_transition_to(i);
+ if (from == selected_node || to == selected_node) {
+ undo_redo->add_undo_method(state_machine.ptr(), "add_transition", from, to, state_machine->get_transition(i));
+ }
+ }
+ if (String(state_machine->get_start_node()) == selected_node) {
+ undo_redo->add_undo_method(state_machine.ptr(), "set_start_node", selected_node);
+ }
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+ selected_node = StringName();
+ }
+
+ if (selected_transition_to != StringName() && selected_transition_from != StringName() && state_machine->has_transition(selected_transition_from, selected_transition_to)) {
+
+ Ref<AnimationNodeStateMachineTransition> tr = state_machine->get_transition(state_machine->find_transition(selected_transition_from, selected_transition_to));
+ updating = true;
+ undo_redo->create_action("Transition Removed");
+ undo_redo->add_do_method(state_machine.ptr(), "remove_transition", selected_transition_from, selected_transition_to);
+ undo_redo->add_undo_method(state_machine.ptr(), "add_transition", selected_transition_from, selected_transition_to, tr);
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+ selected_transition_from = StringName();
+ selected_transition_to = StringName();
+ }
+
+ state_machine_draw->update();
+}
+
+void AnimationNodeStateMachineEditor::_autoplay_selected() {
+
+ if (selected_node != StringName() && state_machine->has_node(selected_node)) {
+
+ StringName new_start_node;
+ if (state_machine->get_start_node() == selected_node) { //toggle it
+ new_start_node = StringName();
+ } else {
+ new_start_node = selected_node;
+ }
+
+ updating = true;
+ undo_redo->create_action("Set Start Node (Autoplay)");
+ undo_redo->add_do_method(state_machine.ptr(), "set_start_node", new_start_node);
+ undo_redo->add_undo_method(state_machine.ptr(), "set_start_node", state_machine->get_start_node());
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+ state_machine_draw->update();
+ }
+}
+
+void AnimationNodeStateMachineEditor::_end_selected() {
+
+ if (selected_node != StringName() && state_machine->has_node(selected_node)) {
+
+ StringName new_end_node;
+ if (state_machine->get_end_node() == selected_node) { //toggle it
+ new_end_node = StringName();
+ } else {
+ new_end_node = selected_node;
+ }
+
+ updating = true;
+ undo_redo->create_action("Set Start Node (Autoplay)");
+ undo_redo->add_do_method(state_machine.ptr(), "set_end_node", new_end_node);
+ undo_redo->add_undo_method(state_machine.ptr(), "set_end_node", state_machine->get_end_node());
+ undo_redo->add_do_method(this, "_update_graph");
+ undo_redo->add_undo_method(this, "_update_graph");
+ undo_redo->commit_action();
+ updating = false;
+ state_machine_draw->update();
+ }
+}
+void AnimationNodeStateMachineEditor::_update_mode() {
+
+ if (tool_select->is_pressed()) {
+ tool_erase_hb->show();
+ tool_erase->set_disabled(selected_node == StringName() && selected_transition_from == StringName() && selected_transition_to == StringName());
+ tool_autoplay->set_disabled(selected_node == StringName());
+ tool_end->set_disabled(selected_node == StringName());
+ } else {
+ tool_erase_hb->hide();
+ }
+}
+
+void AnimationNodeStateMachineEditor::_bind_methods() {
+
+ ClassDB::bind_method("_state_machine_gui_input", &AnimationNodeStateMachineEditor::_state_machine_gui_input);
+ ClassDB::bind_method("_state_machine_draw", &AnimationNodeStateMachineEditor::_state_machine_draw);
+ ClassDB::bind_method("_state_machine_pos_draw", &AnimationNodeStateMachineEditor::_state_machine_pos_draw);
+ ClassDB::bind_method("_update_graph", &AnimationNodeStateMachineEditor::_update_graph);
+
+ ClassDB::bind_method("_add_menu_type", &AnimationNodeStateMachineEditor::_add_menu_type);
+ ClassDB::bind_method("_add_animation_type", &AnimationNodeStateMachineEditor::_add_animation_type);
+
+ ClassDB::bind_method("_name_edited", &AnimationNodeStateMachineEditor::_name_edited);
+
+ ClassDB::bind_method("_goto_parent", &AnimationNodeStateMachineEditor::_goto_parent);
+ ClassDB::bind_method("_removed_from_graph", &AnimationNodeStateMachineEditor::_removed_from_graph);
+
+ ClassDB::bind_method("_open_editor", &AnimationNodeStateMachineEditor::_open_editor);
+ ClassDB::bind_method("_scroll_changed", &AnimationNodeStateMachineEditor::_scroll_changed);
+
+ ClassDB::bind_method("_erase_selected", &AnimationNodeStateMachineEditor::_erase_selected);
+ ClassDB::bind_method("_autoplay_selected", &AnimationNodeStateMachineEditor::_autoplay_selected);
+ ClassDB::bind_method("_end_selected", &AnimationNodeStateMachineEditor::_end_selected);
+ ClassDB::bind_method("_update_mode", &AnimationNodeStateMachineEditor::_update_mode);
+}
+
+AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = NULL;
+
+AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
+
+ singleton = this;
+ updating = false;
+
+ HBoxContainer *top_hb = memnew(HBoxContainer);
+ add_child(top_hb);
+
+ goto_parent_hbox = memnew(HBoxContainer);
+ goto_parent = memnew(ToolButton);
+ goto_parent->connect("pressed", this, "_goto_parent", varray(), CONNECT_DEFERRED);
+ goto_parent_hbox->add_child(goto_parent);
+ goto_parent_hbox->add_child(memnew(VSeparator));
+ top_hb->add_child(goto_parent_hbox);
+
+ Ref<ButtonGroup> bg;
+ bg.instance();
+
+ tool_select = memnew(ToolButton);
+ top_hb->add_child(tool_select);
+ tool_select->set_toggle_mode(true);
+ tool_select->set_button_group(bg);
+ tool_select->set_pressed(true);
+ tool_select->set_tooltip(TTR("Select and move nodes.\nRMB to add new nodes.\nShift+LMB to create connections."));
+ tool_select->connect("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED);
+
+ tool_create = memnew(ToolButton);
+ top_hb->add_child(tool_create);
+ tool_create->set_toggle_mode(true);
+ tool_create->set_button_group(bg);
+ tool_create->set_tooltip(TTR("Create new nodes."));
+ tool_create->connect("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED);
+
+ tool_connect = memnew(ToolButton);
+ top_hb->add_child(tool_connect);
+ tool_connect->set_toggle_mode(true);
+ tool_connect->set_button_group(bg);
+ tool_connect->set_tooltip(TTR("Connect nodes."));
+ tool_connect->connect("pressed", this, "_update_mode", varray(), CONNECT_DEFERRED);
+
+ tool_erase_hb = memnew(HBoxContainer);
+ top_hb->add_child(tool_erase_hb);
+ tool_erase_hb->add_child(memnew(VSeparator));
+ tool_erase = memnew(ToolButton);
+ tool_erase->set_tooltip(TTR("Remove selected node or transition"));
+ tool_erase_hb->add_child(tool_erase);
+ tool_erase->connect("pressed", this, "_erase_selected");
+ tool_erase->set_disabled(true);
+
+ tool_erase_hb->add_child(memnew(VSeparator));
+
+ tool_autoplay = memnew(ToolButton);
+ tool_autoplay->set_tooltip(TTR("Toggle autoplay this animation on start, restart or seek to zero."));
+ tool_erase_hb->add_child(tool_autoplay);
+ tool_autoplay->connect("pressed", this, "_autoplay_selected");
+ tool_autoplay->set_disabled(true);
+
+ tool_end = memnew(ToolButton);
+ tool_end->set_tooltip(TTR("Set the end animation. This is useful for sub-transitions."));
+ tool_erase_hb->add_child(tool_end);
+ tool_end->connect("pressed", this, "_end_selected");
+ tool_end->set_disabled(true);
+
+ top_hb->add_child(memnew(VSeparator));
+ top_hb->add_child(memnew(Label(TTR("Transition: "))));
+ transition_mode = memnew(OptionButton);
+ top_hb->add_child(transition_mode);
+
+ top_hb->add_spacer();
+
+ top_hb->add_child(memnew(Label("Play Mode:")));
+ play_mode = memnew(OptionButton);
+ top_hb->add_child(play_mode);
+
+ GridContainer *main_grid = memnew(GridContainer);
+ main_grid->set_columns(2);
+ add_child(main_grid);
+ main_grid->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ panel = memnew(PanelContainer);
+ panel->set_clip_contents(true);
+ main_grid->add_child(panel);
+ panel->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ state_machine_draw = memnew(Control);
+ state_machine_draw->connect("gui_input", this, "_state_machine_gui_input");
+ state_machine_draw->connect("draw", this, "_state_machine_draw");
+ state_machine_draw->set_focus_mode(FOCUS_ALL);
+
+ state_machine_play_pos = memnew(Control);
+ 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_margins_preset(PRESET_WIDE);
+ state_machine_play_pos->connect("draw", this, "_state_machine_pos_draw");
+
+ panel->add_child(state_machine_draw);
+ panel->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ v_scroll = memnew(VScrollBar);
+ main_grid->add_child(v_scroll);
+ v_scroll->connect("value_changed", this, "_scroll_changed");
+
+ h_scroll = memnew(HScrollBar);
+ main_grid->add_child(h_scroll);
+ h_scroll->connect("value_changed", this, "_scroll_changed");
+
+ main_grid->add_child(memnew(Control)); //empty bottom right
+
+ error_panel = memnew(PanelContainer);
+ add_child(error_panel);
+ error_label = memnew(Label);
+ error_panel->add_child(error_label);
+ error_label->set_text("eh");
+
+ undo_redo = EditorNode::get_singleton()->get_undo_redo();
+
+ set_custom_minimum_size(Size2(0, 300 * EDSCALE));
+
+ menu = memnew(PopupMenu);
+ add_child(menu);
+ menu->connect("index_pressed", this, "_add_menu_type");
+
+ animations_menu = memnew(PopupMenu);
+ menu->add_child(animations_menu);
+ animations_menu->set_name("animations");
+ animations_menu->connect("index_pressed", this, "_add_animation_type");
+
+ name_edit = memnew(LineEdit);
+ state_machine_draw->add_child(name_edit);
+ name_edit->hide();
+ name_edit->connect("text_entered", this, "_name_edited");
+ name_edit->set_as_toplevel(true);
+
+ over_text = false;
+
+ over_node_what = -1;
+ dragging_selected_attempt = false;
+ connecting = false;
+
+ last_active = false;
+
+ error_time = 0;
+}
+
+void AnimationNodeStateMachineEditorPlugin::edit(Object *p_object) {
+
+ anim_tree_editor->edit(Object::cast_to<AnimationNodeStateMachine>(p_object));
+}
+
+bool AnimationNodeStateMachineEditorPlugin::handles(Object *p_object) const {
+
+ return p_object->is_class("AnimationNodeStateMachine");
+}
+
+void AnimationNodeStateMachineEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+ //editor->hide_animation_player_editors();
+ //editor->animation_panel_make_visible(true);
+ button->show();
+ editor->make_bottom_panel_item_visible(anim_tree_editor);
+ anim_tree_editor->set_process(true);
+ } else {
+
+ if (anim_tree_editor->is_visible_in_tree())
+ editor->hide_bottom_panel();
+ button->hide();
+ anim_tree_editor->set_process(false);
+ }
+}
+
+AnimationNodeStateMachineEditorPlugin::AnimationNodeStateMachineEditorPlugin(EditorNode *p_node) {
+
+ editor = p_node;
+ anim_tree_editor = memnew(AnimationNodeStateMachineEditor);
+ anim_tree_editor->set_custom_minimum_size(Size2(0, 300));
+
+ button = editor->add_bottom_panel_item(TTR("StateMachine"), anim_tree_editor);
+ button->hide();
+}
+
+AnimationNodeStateMachineEditorPlugin::~AnimationNodeStateMachineEditorPlugin() {
+}
diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h
new file mode 100644
index 0000000000..efd3de7415
--- /dev/null
+++ b/editor/plugins/animation_state_machine_editor.h
@@ -0,0 +1,167 @@
+#ifndef ANIMATION_STATE_MACHINE_EDITOR_H
+#define ANIMATION_STATE_MACHINE_EDITOR_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "editor/property_editor.h"
+#include "scene/animation/animation_node_state_machine.h"
+#include "scene/gui/button.h"
+#include "scene/gui/graph_edit.h"
+#include "scene/gui/popup.h"
+#include "scene/gui/tree.h"
+
+class AnimationNodeStateMachineEditor : public VBoxContainer {
+
+ GDCLASS(AnimationNodeStateMachineEditor, VBoxContainer);
+
+ Ref<AnimationNodeStateMachine> state_machine;
+
+ ToolButton *tool_select;
+ ToolButton *tool_create;
+ ToolButton *tool_connect;
+ LineEdit *name_edit;
+
+ HBoxContainer *tool_erase_hb;
+ ToolButton *tool_erase;
+ ToolButton *tool_autoplay;
+ ToolButton *tool_end;
+
+ OptionButton *transition_mode;
+ OptionButton *play_mode;
+
+ HBoxContainer *goto_parent_hbox;
+ ToolButton *goto_parent;
+
+ PanelContainer *panel;
+
+ StringName selected_node;
+
+ HScrollBar *h_scroll;
+ VScrollBar *v_scroll;
+
+ Control *state_machine_draw;
+ Control *state_machine_play_pos;
+
+ PanelContainer *error_panel;
+ Label *error_label;
+
+ bool updating;
+
+ UndoRedo *undo_redo;
+
+ 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);
+ void _state_machine_draw();
+ void _state_machine_pos_draw();
+
+ void _update_graph();
+
+ PopupMenu *menu;
+ PopupMenu *animations_menu;
+ Vector<String> animations_to_add;
+
+ Vector2 add_node_pos;
+
+ bool dragging_selected_attempt;
+ bool dragging_selected;
+ Vector2 drag_from;
+ Vector2 drag_ofs;
+ StringName snap_x;
+ StringName snap_y;
+
+ bool connecting;
+ StringName connecting_from;
+ Vector2 connecting_to;
+ StringName connecting_to_node;
+
+ void _add_menu_type(int p_index);
+ void _add_animation_type(int p_index);
+
+ void _goto_parent();
+
+ void _removed_from_graph();
+
+ struct NodeRect {
+ StringName node_name;
+ Rect2 node;
+ Rect2 play;
+ Rect2 name;
+ Rect2 edit;
+ };
+
+ Vector<NodeRect> node_rects;
+
+ struct TransitionLine {
+ StringName from_node;
+ StringName to_node;
+ Vector2 from;
+ Vector2 to;
+ AnimationNodeStateMachineTransition::SwitchMode mode;
+ bool disabled;
+ bool auto_advance;
+ float width;
+ };
+
+ Vector<TransitionLine> transition_lines;
+
+ StringName selected_transition_from;
+ StringName selected_transition_to;
+
+ bool over_text;
+ StringName over_node;
+ int over_node_what;
+
+ String prev_name;
+ void _name_edited(const String &p_text);
+ void _open_editor(const String &p_name);
+ void _scroll_changed(double);
+
+ void _clip_src_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect);
+ void _clip_dst_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect);
+
+ void _erase_selected();
+ void _update_mode();
+ void _autoplay_selected();
+ void _end_selected();
+
+ bool last_active;
+ StringName last_blend_from_node;
+ StringName last_current_node;
+ Vector<StringName> last_travel_path;
+ float last_play_pos;
+
+ float error_time;
+ String error_text;
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ static AnimationNodeStateMachineEditor *get_singleton() { return singleton; }
+ void edit(AnimationNodeStateMachine *p_state_machine);
+ AnimationNodeStateMachineEditor();
+};
+
+class AnimationNodeStateMachineEditorPlugin : public EditorPlugin {
+
+ GDCLASS(AnimationNodeStateMachineEditorPlugin, EditorPlugin);
+
+ AnimationNodeStateMachineEditor *anim_tree_editor;
+ EditorNode *editor;
+ Button *button;
+
+public:
+ virtual String get_name() const { return "StateMachine"; }
+ bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ AnimationNodeStateMachineEditorPlugin(EditorNode *p_node);
+ ~AnimationNodeStateMachineEditorPlugin();
+};
+
+#endif // ANIMATION_STATE_MACHINE_EDITOR_H
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index f0e186e4b0..25582ae0b9 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -578,7 +578,7 @@ void AnimationTreeEditor::_draw_node(const StringName &p_node) {
if (anim_tree->animation_node_get_master_animation(p_node) != "")
text = anim_tree->animation_node_get_master_animation(p_node);
else if (anim.is_null())
- text = "load..";
+ text = "load...";
else
text = anim->get_name();
@@ -593,7 +593,7 @@ void AnimationTreeEditor::_draw_node(const StringName &p_node) {
case AnimationTreePlayer::NODE_TIMESCALE:
case AnimationTreePlayer::NODE_TRANSITION: {
- font->draw_halign(ci, ofs + ascofs, HALIGN_CENTER, w, "edit..", font_color_title);
+ font->draw_halign(ci, ofs + ascofs, HALIGN_CENTER, w, "edit...", font_color_title);
} break;
default: editable = false;
}
@@ -756,6 +756,7 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
if (rclick_type == CLICK_INPUT_SLOT || rclick_type == CLICK_OUTPUT_SLOT) {
node_popup->clear();
+ node_popup->set_size(Size2(1, 1));
node_popup->add_item(TTR("Disconnect"), NODE_DISCONNECT);
if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION) {
node_popup->add_item(TTR("Add Input"), NODE_ADD_INPUT);
@@ -774,6 +775,7 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
if (rclick_type == CLICK_NODE) {
node_popup->clear();
+ node_popup->set_size(Size2(1, 1));
node_popup->add_item(TTR("Rename"), NODE_RENAME);
node_popup->add_item(TTR("Remove"), NODE_ERASE);
if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION)
@@ -1288,7 +1290,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
p->add_item(TTR("TimeSeek Node"), AnimationTreePlayer::NODE_TIMESEEK);
p->add_item(TTR("Transition Node"), AnimationTreePlayer::NODE_TRANSITION);
p->add_separator();
- p->add_item(TTR("Import Animations.."), MENU_IMPORT_ANIMATIONS); // wtf
+ p->add_item(TTR("Import Animations..."), MENU_IMPORT_ANIMATIONS); // wtf
p->add_separator();
p->add_item(TTR("Clear"), MENU_GRAPH_CLEAR);
@@ -1397,7 +1399,7 @@ AnimationTreeEditor::AnimationTreeEditor() {
filter_button->set_margin(MARGIN_RIGHT, -10);
edit_dialog->add_child(filter_button);
filter_button->hide();
- filter_button->set_text(TTR("Filters.."));
+ filter_button->set_text(TTR("Filters..."));
filter_button->connect("pressed", this, "_edit_filters");
set_clip_contents(true);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 26afc78825..505dd4ab76 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -30,11 +30,10 @@
#include "asset_library_editor_plugin.h"
+#include "core/io/json.h"
+#include "core/version.h"
#include "editor_node.h"
#include "editor_settings.h"
-#include "io/json.h"
-
-#include "version_generated.gen.h"
void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost) {
@@ -66,7 +65,7 @@ void EditorAssetLibraryItem::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- icon->set_normal_texture(get_icon("GodotAssetDefault", "EditorIcons"));
+ icon->set_normal_texture(get_icon("DefaultProjectIcon", "EditorIcons"));
category->add_color_override("font_color", Color(0.5, 0.5, 0.5));
author->add_color_override("font_color", Color(0.5, 0.5, 0.5));
}
@@ -111,6 +110,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
add_child(hb);
icon = memnew(TextureButton);
+ icon->set_custom_minimum_size(Size2(64, 64));
icon->set_default_cursor_shape(CURSOR_POINTING_HAND);
icon->connect("pressed", this, "_asset_clicked");
@@ -171,7 +171,23 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
for (int i = 0; i < preview_images.size(); i++) {
if (preview_images[i].id == p_index) {
- preview_images[i].button->set_icon(p_image);
+ if (preview_images[i].is_video) {
+ Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data();
+ Ref<Image> thumbnail = p_image->get_data();
+ Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2);
+
+ thumbnail->lock();
+ thumbnail->blend_rect(overlay, overlay->get_used_rect(), overlay_pos);
+ thumbnail->unlock();
+
+ Ref<ImageTexture> tex;
+ tex.instance();
+ tex->create_from_image(thumbnail);
+
+ preview_images[i].button->set_icon(tex);
+ } else {
+ preview_images[i].button->set_icon(p_image);
+ }
break;
}
}
@@ -218,6 +234,7 @@ void EditorAssetLibraryItemDescription::_preview_click(int p_id) {
if (!preview_images[i].is_video) {
if (preview_images[i].image.is_valid()) {
preview->set_texture(preview_images[i].image);
+ minimum_size_changed();
}
} else {
_link_click(preview_images[i].video_link);
@@ -384,7 +401,7 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse
icon->set_texture(p_preview);
asset_id = p_asset_id;
if (!p_preview.is_valid())
- icon->set_texture(get_icon("GodotAssetDefault", "EditorIcons"));
+ icon->set_texture(get_icon("DefaultProjectIcon", "EditorIcons"));
host = p_download_url;
sha256 = p_sha256_hash;
asset_installer->connect("confirmed", this, "_close");
@@ -408,13 +425,13 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
switch (cstatus) {
case HTTPClient::STATUS_RESOLVING: {
- status->set_text(TTR("Resolving.."));
+ status->set_text(TTR("Resolving..."));
} break;
case HTTPClient::STATUS_CONNECTING: {
- status->set_text(TTR("Connecting.."));
+ status->set_text(TTR("Connecting..."));
} break;
case HTTPClient::STATUS_REQUESTING: {
- status->set_text(TTR("Requesting.."));
+ status->set_text(TTR("Requesting..."));
} break;
default: {}
}
@@ -515,6 +532,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
download = memnew(HTTPRequest);
add_child(download);
download->connect("request_completed", this, "_http_download_completed");
+ download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));
download_error = memnew(AcceptDialog);
add_child(download_error);
@@ -534,11 +552,9 @@ void EditorAssetLibrary::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
- TextureRect *tf = memnew(TextureRect);
- tf->set_texture(get_icon("Error", "EditorIcons"));
+ error_tr->set_texture(get_icon("Error", "EditorIcons"));
reverse->set_icon(get_icon("Sort", "EditorIcons"));
- error_hb->add_child(tf);
error_label->raise();
} break;
@@ -586,6 +602,8 @@ void EditorAssetLibrary::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
+ error_tr->set_texture(get_icon("Error", "EditorIcons"));
+ reverse->set_icon(get_icon("Sort", "EditorIcons"));
} break;
}
}
@@ -639,7 +657,7 @@ const char *EditorAssetLibrary::support_key[SUPPORT_MAX] = {
void EditorAssetLibrary::_select_author(int p_id) {
- //opemn author window
+ // Open author window
}
void EditorAssetLibrary::_select_category(int p_id) {
@@ -659,16 +677,6 @@ void EditorAssetLibrary::_select_category(int p_id) {
void EditorAssetLibrary::_select_asset(int p_id) {
_api_request("asset/" + itos(p_id), REQUESTING_ASSET);
-
- /*
- if (description) {
- memdelete(description);
- }
-
-
- description = memnew( EditorAssetLibraryItemDescription );
- add_child(description);
- description->popup_centered_minsize();*/
}
void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id) {
@@ -698,13 +706,24 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
int len = image_data.size();
PoolByteArray::Read r = image_data.read();
- Ref<Image> image = Ref<Image>(memnew(Image(r.ptr(), len)));
+ Ref<Image> image = Ref<Image>(memnew(Image));
+
+ uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
+ uint8_t jpg_signature[3] = { 255, 216, 255 };
+
+ if (r.ptr()) {
+ if (memcmp(&r[0], &png_signature[0], 8) == 0) {
+ image->copy_internals_from(Image::_png_mem_loader_func(r.ptr(), len));
+ } else if (memcmp(&r[0], &jpg_signature[0], 3) == 0) {
+ image->copy_internals_from(Image::_jpg_mem_loader_func(r.ptr(), len));
+ }
+ }
if (!image->empty()) {
switch (image_queue[p_queue_id].image_type) {
case IMAGE_QUEUE_ICON:
- image->resize(80 * EDSCALE, 80 * EDSCALE, Image::INTERPOLATE_CUBIC);
+ image->resize(64 * EDSCALE, 64 * EDSCALE, Image::INTERPOLATE_CUBIC);
break;
case IMAGE_QUEUE_THUMBNAIL: {
@@ -734,7 +753,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
}
if (!image_set && final) {
- obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons"));
+ obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons"));
}
}
}
@@ -743,7 +762,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
ERR_FAIL_COND(!image_queue.has(p_queue_id));
- if (p_status == HTTPRequest::RESULT_SUCCESS) {
+ if (p_status == HTTPRequest::RESULT_SUCCESS && p_code < HTTPClient::RESPONSE_BAD_REQUEST) {
if (p_code != HTTPClient::RESPONSE_NOT_MODIFIED) {
for (int i = 0; i < headers.size(); i++) {
@@ -774,10 +793,10 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons
_image_update(p_code == HTTPClient::RESPONSE_NOT_MODIFIED, true, p_data, p_queue_id);
} else {
- WARN_PRINTS("Error getting PNG file for asset id " + itos(image_queue[p_queue_id].asset_id));
+ // WARN_PRINTS("Error getting image file from URL: " + image_queue[p_queue_id].image_url);
Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target);
if (obj) {
- obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons"));
+ obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons"));
}
}
@@ -833,6 +852,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag
iq.image_index = p_image_index;
iq.image_type = p_type;
iq.request = memnew(HTTPRequest);
+ iq.request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));
iq.target = p_for;
iq.queue_id = ++last_queue_id;
@@ -877,7 +897,8 @@ void EditorAssetLibrary::_search(int p_page) {
}
args += String() + "sort=" + sort_key[sort->get_selected()];
- args += "&godot_version=" + itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR);
+ // We use the "branch" version, i.e. major.minor, as patch releases should be compatible
+ args += "&godot_version=" + String(VERSION_BRANCH);
String support_list;
for (int i = 0; i < SUPPORT_MAX; i++) {
@@ -927,41 +948,43 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
if (to > p_page_count)
to = p_page_count;
- Color gray = Color(0.65, 0.65, 0.65);
-
hbc->add_spacer();
- hbc->add_constant_override("separation", 10);
+ hbc->add_constant_override("separation", 5);
+ Button *first = memnew(Button);
+ first->set_text(TTR("First"));
if (p_page != 0) {
- LinkButton *first = memnew(LinkButton);
- first->set_text(TTR("first"));
- first->add_color_override("font_color", gray);
- first->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
first->connect("pressed", this, "_search", varray(0));
- hbc->add_child(first);
+ } else {
+ first->set_disabled(true);
+ first->set_focus_mode(Control::FOCUS_NONE);
}
+ hbc->add_child(first);
+ Button *prev = memnew(Button);
+ prev->set_text(TTR("Previous"));
if (p_page > 0) {
- LinkButton *prev = memnew(LinkButton);
- prev->set_text(TTR("prev"));
- prev->add_color_override("font_color", gray);
- prev->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
prev->connect("pressed", this, "_search", varray(p_page - 1));
- hbc->add_child(prev);
+ } else {
+ prev->set_disabled(true);
+ prev->set_focus_mode(Control::FOCUS_NONE);
}
+ hbc->add_child(prev);
+ hbc->add_child(memnew(VSeparator));
for (int i = from; i < to; i++) {
if (i == p_page) {
- Label *current = memnew(Label);
+ Button *current = memnew(Button);
current->set_text(itos(i + 1));
+ current->set_disabled(true);
+ current->set_focus_mode(Control::FOCUS_NONE);
+
hbc->add_child(current);
} else {
- LinkButton *current = memnew(LinkButton);
- current->add_color_override("font_color", gray);
- current->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
+ Button *current = memnew(Button);
current->set_text(itos(i + 1));
current->connect("pressed", this, "_search", varray(i));
@@ -969,28 +992,26 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
}
}
+ Button *next = memnew(Button);
+ next->set_text(TTR("Next"));
if (p_page < p_page_count - 1) {
- LinkButton *next = memnew(LinkButton);
- next->set_text(TTR("next"));
- next->add_color_override("font_color", gray);
- next->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
next->connect("pressed", this, "_search", varray(p_page + 1));
-
- hbc->add_child(next);
+ } else {
+ next->set_disabled(true);
+ next->set_focus_mode(Control::FOCUS_NONE);
}
+ hbc->add_child(memnew(VSeparator));
+ hbc->add_child(next);
+ Button *last = memnew(Button);
+ last->set_text(TTR("Last"));
if (p_page != p_page_count - 1) {
- LinkButton *last = memnew(LinkButton);
- last->set_text(TTR("last"));
- last->add_color_override("font_color", gray);
- last->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
- hbc->add_child(last);
last->connect("pressed", this, "_search", varray(p_page_count - 1));
+ } else {
+ last->set_disabled(true);
+ last->set_focus_mode(Control::FOCUS_NONE);
}
-
- Label *totals = memnew(Label);
- totals->set_text("( " + itos(from * p_page_len) + " - " + itos(from * p_page_len + p_current_items - 1) + " / " + itos(p_total_items) + " )");
- hbc->add_child(totals);
+ hbc->add_child(last);
hbc->add_spacer();
@@ -1380,7 +1401,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
support = memnew(MenuButton);
search_hb2->add_child(support);
- support->set_text(TTR("Support.."));
+ support->set_text(TTR("Support..."));
support->get_popup()->add_check_item(TTR("Official"), SUPPORT_OFFICIAL);
support->get_popup()->add_check_item(TTR("Community"), SUPPORT_COMMUNITY);
support->get_popup()->add_check_item(TTR("Testing"), SUPPORT_TESTING);
@@ -1452,6 +1473,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
error_label = memnew(Label);
error_label->add_color_override("color", get_color("error_color", "Editor"));
error_hb->add_child(error_label);
+ error_tr = memnew(TextureRect);
+ error_hb->add_child(error_tr);
description = NULL;
diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h
index b344716c1d..69a65dd3dc 100644
--- a/editor/plugins/asset_library_editor_plugin.h
+++ b/editor/plugins/asset_library_editor_plugin.h
@@ -194,6 +194,7 @@ class EditorAssetLibrary : public PanelContainer {
Button *search;
ProgressBar *load_status;
HBoxContainer *error_hb;
+ TextureRect *error_tr;
Label *error_label;
MenuButton *support;
@@ -240,7 +241,6 @@ class EditorAssetLibrary : public PanelContainer {
bool active;
int queue_id;
- int asset_id;
ImageType image_type;
int image_index;
String image_url;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index f16747f929..48ee011fc1 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -30,7 +30,6 @@
#include "canvas_item_editor_plugin.h"
-#include "editor/animation_editor.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
@@ -44,6 +43,7 @@
#include "scene/2d/particles_2d.h"
#include "scene/2d/polygon_2d.h"
#include "scene/2d/screen_button.h"
+#include "scene/2d/skeleton_2d.h"
#include "scene/2d/sprite.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/nine_patch_rect.h"
@@ -196,11 +196,15 @@ void CanvasItemEditor::_snap_other_nodes(Point2 p_value, Point2 &r_current_snap,
Transform2D ci_transform = canvas_item->get_global_transform_with_canvas();
Transform2D to_snap_transform = p_to_snap ? p_to_snap->get_global_transform_with_canvas() : Transform2D();
if (fmod(ci_transform.get_rotation() - to_snap_transform.get_rotation(), (real_t)360.0) == 0.0) {
- Point2 begin = ci_transform.xform(canvas_item->_edit_get_rect().get_position());
- Point2 end = ci_transform.xform(canvas_item->_edit_get_rect().get_position() + canvas_item->_edit_get_rect().get_size());
-
- _snap_if_closer_point(p_value, begin, r_current_snap, r_snapped, ci_transform.get_rotation());
- _snap_if_closer_point(p_value, end, r_current_snap, r_snapped, ci_transform.get_rotation());
+ if (canvas_item->_edit_use_rect()) {
+ Point2 begin = ci_transform.xform(canvas_item->_edit_get_rect().get_position());
+ Point2 end = ci_transform.xform(canvas_item->_edit_get_rect().get_position() + canvas_item->_edit_get_rect().get_size());
+ _snap_if_closer_point(p_value, begin, r_current_snap, r_snapped, ci_transform.get_rotation());
+ _snap_if_closer_point(p_value, end, r_current_snap, r_snapped, ci_transform.get_rotation());
+ } else {
+ Point2 position = ci_transform.xform(Point2());
+ _snap_if_closer_point(p_value, position, r_current_snap, r_snapped, ci_transform.get_rotation());
+ }
}
}
for (int i = 0; i < p_current->get_child_count(); i++) {
@@ -210,6 +214,7 @@ void CanvasItemEditor::_snap_other_nodes(Point2 p_value, Point2 &r_current_snap,
Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const CanvasItem *p_canvas_item, unsigned int p_forced_modes) {
bool snapped[2] = { false, false };
+ bool is_snap_active = snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL);
// Smart snap using the canvas position
Vector2 output = p_target;
@@ -219,29 +224,29 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const
rotation = p_canvas_item->get_global_transform_with_canvas().get_rotation();
// Parent sides and center
- if ((snap_active && snap_node_parent && (p_modes & SNAP_NODE_PARENT)) || (p_forced_modes & SNAP_NODE_PARENT)) {
- Point2 begin;
- Point2 end;
- bool can_snap = false;
+ if ((is_snap_active && snap_node_parent && (p_modes & SNAP_NODE_PARENT)) || (p_forced_modes & SNAP_NODE_PARENT)) {
if (const Control *c = Object::cast_to<Control>(p_canvas_item)) {
- begin = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(0, 0)));
- end = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(1, 1)));
- can_snap = true;
- } else if (const CanvasItem *parent_ci = Object::cast_to<CanvasItem>(p_canvas_item->get_parent())) {
- begin = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->_edit_get_rect().get_position());
- end = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->_edit_get_rect().get_position() + parent_ci->_edit_get_rect().get_size());
- can_snap = true;
- }
-
- if (can_snap) {
+ Point2 begin = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(0, 0)));
+ Point2 end = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(1, 1)));
_snap_if_closer_point(p_target, begin, output, snapped, rotation);
_snap_if_closer_point(p_target, (begin + end) / 2.0, output, snapped, rotation);
_snap_if_closer_point(p_target, end, output, snapped, rotation);
+ } else if (const CanvasItem *parent_ci = Object::cast_to<CanvasItem>(p_canvas_item->get_parent())) {
+ if (parent_ci->_edit_use_rect()) {
+ Point2 begin = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->_edit_get_rect().get_position());
+ Point2 end = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->_edit_get_rect().get_position() + parent_ci->_edit_get_rect().get_size());
+ _snap_if_closer_point(p_target, begin, output, snapped, rotation);
+ _snap_if_closer_point(p_target, (begin + end) / 2.0, output, snapped, rotation);
+ _snap_if_closer_point(p_target, end, output, snapped, rotation);
+ } else {
+ Point2 position = p_canvas_item->get_transform().affine_inverse().xform(Point2());
+ _snap_if_closer_point(p_target, position, output, snapped, rotation);
+ }
}
}
// Self anchors
- if ((snap_active && snap_node_anchors && (p_modes & SNAP_NODE_ANCHORS)) || (p_forced_modes & SNAP_NODE_ANCHORS)) {
+ if ((is_snap_active && snap_node_anchors && (p_modes & SNAP_NODE_ANCHORS)) || (p_forced_modes & SNAP_NODE_ANCHORS)) {
if (const Control *c = Object::cast_to<Control>(p_canvas_item)) {
Point2 begin = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(MARGIN_LEFT), c->get_anchor(MARGIN_TOP))));
Point2 end = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(MARGIN_RIGHT), c->get_anchor(MARGIN_BOTTOM))));
@@ -251,26 +256,33 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const
}
// Self sides
- if ((snap_active && snap_node_sides && (p_modes & SNAP_NODE_SIDES)) || (p_forced_modes & SNAP_NODE_SIDES)) {
- Point2 begin = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position());
- Point2 end = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position() + p_canvas_item->_edit_get_rect().get_size());
- _snap_if_closer_point(p_target, begin, output, snapped, rotation);
- _snap_if_closer_point(p_target, end, output, snapped, rotation);
+ if ((is_snap_active && snap_node_sides && (p_modes & SNAP_NODE_SIDES)) || (p_forced_modes & SNAP_NODE_SIDES)) {
+ if (p_canvas_item->_edit_use_rect()) {
+ Point2 begin = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position());
+ Point2 end = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position() + p_canvas_item->_edit_get_rect().get_size());
+ _snap_if_closer_point(p_target, begin, output, snapped, rotation);
+ _snap_if_closer_point(p_target, end, output, snapped, rotation);
+ }
}
// Self center
- if ((snap_active && snap_node_center && (p_modes & SNAP_NODE_CENTER)) || (p_forced_modes & SNAP_NODE_CENTER)) {
- Point2 center = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position() + p_canvas_item->_edit_get_rect().get_size() / 2.0);
- _snap_if_closer_point(p_target, center, output, snapped, rotation);
+ if ((is_snap_active && snap_node_center && (p_modes & SNAP_NODE_CENTER)) || (p_forced_modes & SNAP_NODE_CENTER)) {
+ if (p_canvas_item->_edit_use_rect()) {
+ Point2 center = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position() + p_canvas_item->_edit_get_rect().get_size() / 2.0);
+ _snap_if_closer_point(p_target, center, output, snapped, rotation);
+ } else {
+ Point2 position = p_canvas_item->get_global_transform_with_canvas().xform(Point2());
+ _snap_if_closer_point(p_target, position, output, snapped, rotation);
+ }
}
}
// Other nodes sides
- if ((snap_active && snap_other_nodes && (p_modes & SNAP_OTHER_NODES)) || (p_forced_modes & SNAP_OTHER_NODES)) {
+ if ((is_snap_active && snap_other_nodes && (p_modes & SNAP_OTHER_NODES)) || (p_forced_modes & SNAP_OTHER_NODES)) {
_snap_other_nodes(p_target, output, snapped, get_tree()->get_edited_scene_root(), p_canvas_item);
}
- if (((snap_active && snap_guides && (p_modes & SNAP_GUIDES)) || (p_forced_modes & SNAP_GUIDES)) && fmod(rotation, (real_t)360.0) == 0.0) {
+ if (((is_snap_active && snap_guides && (p_modes & SNAP_GUIDES)) || (p_forced_modes & SNAP_GUIDES)) && fmod(rotation, (real_t)360.0) == 0.0) {
// Guides
if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->has_meta("_edit_vertical_guides_")) {
Array vguides = EditorNode::get_singleton()->get_edited_scene()->get_meta("_edit_vertical_guides_");
@@ -287,7 +299,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const
}
}
- if (((snap_active && snap_grid && (p_modes & SNAP_GRID)) || (p_forced_modes & SNAP_GRID)) && fmod(rotation, (real_t)360.0) == 0.0) {
+ if (((is_snap_active && snap_grid && (p_modes & SNAP_GRID)) || (p_forced_modes & SNAP_GRID)) && fmod(rotation, (real_t)360.0) == 0.0) {
// Grid
Point2 offset = grid_offset;
if (snap_relative) {
@@ -313,7 +325,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const
}
float CanvasItemEditor::snap_angle(float p_target, float p_start) const {
- return (snap_rotation && snap_rotation_step != 0) ? Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset : p_target;
+ return (((snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) && snap_rotation_step != 0) ? Math::stepify(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset : p_target;
}
void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
@@ -352,7 +364,7 @@ Object *CanvasItemEditor::_get_editor_data(Object *p_what) {
void CanvasItemEditor::_keying_changed() {
- if (AnimationPlayerEditor::singleton->get_key_editor()->is_visible_in_tree())
+ if (AnimationPlayerEditor::singleton->get_track_editor()->is_visible_in_tree())
animation_hb->show();
else
animation_hb->hide();
@@ -363,67 +375,89 @@ Rect2 CanvasItemEditor::_get_encompassing_rect_from_list(List<CanvasItem *> p_li
// Handles the first element
CanvasItem *canvas_item = p_list.front()->get();
- Rect2 rect = Rect2(canvas_item->get_global_transform_with_canvas().xform(canvas_item->_edit_get_rect().position + canvas_item->_edit_get_rect().size / 2), Size2());
+ Rect2 rect;
+ if (canvas_item->_edit_use_rect()) {
+ rect = Rect2(canvas_item->get_global_transform_with_canvas().xform(canvas_item->_edit_get_rect().position + canvas_item->_edit_get_rect().size / 2), Size2());
+ } else {
+ rect = Rect2(canvas_item->get_global_transform_with_canvas().xform(Point2()), Size2());
+ }
- // Handles the other ones
+ // Expand with the other ones
for (List<CanvasItem *>::Element *E = p_list.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get();
- Rect2 current_rect = canvas_item->_edit_get_rect();
Transform2D xform = canvas_item->get_global_transform_with_canvas();
- rect.expand_to(xform.xform(current_rect.position));
- rect.expand_to(xform.xform(current_rect.position + Vector2(current_rect.size.x, 0)));
- rect.expand_to(xform.xform(current_rect.position + current_rect.size));
- rect.expand_to(xform.xform(current_rect.position + Vector2(0, current_rect.size.y)));
+ if (canvas_item->_edit_use_rect()) {
+ Rect2 current_rect = canvas_item->_edit_get_rect();
+
+ rect.expand_to(xform.xform(current_rect.position));
+ rect.expand_to(xform.xform(current_rect.position + Vector2(current_rect.size.x, 0)));
+ rect.expand_to(xform.xform(current_rect.position + current_rect.size));
+ rect.expand_to(xform.xform(current_rect.position + Vector2(0, current_rect.size.y)));
+ } else {
+ rect.expand_to(xform.xform(Point2()));
+ }
}
return rect;
}
-void CanvasItemEditor::_expand_encompassing_rect_using_children(Rect2 &r_rect, Node *p_node, bool &r_first, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
+void CanvasItemEditor::_expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
if (!p_node)
return;
if (Object::cast_to<Viewport>(p_node))
return;
- CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
+ const CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
- bool inherited = p_node != get_tree()->get_edited_scene_root() && p_node->get_filename() != "";
- bool editable = inherited && EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(p_node);
+ /*bool inherited = p_node != get_tree()->get_edited_scene_root() && p_node->get_filename() != "";
+ bool editable = !inherited || EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(p_node);
bool lock_children = p_node->has_meta("_edit_group_") && p_node->get_meta("_edit_group_");
- if (!lock_children && (!inherited || editable)) {
- for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
- if (canvas_item && !canvas_item->is_set_as_toplevel()) {
- _expand_encompassing_rect_using_children(r_rect, p_node->get_child(i), r_first, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
- } else {
- CanvasLayer *canvas_layer = Object::cast_to<CanvasLayer>(p_node);
- _expand_encompassing_rect_using_children(r_rect, p_node->get_child(i), r_first, Transform2D(), canvas_layer ? canvas_layer->get_transform() : p_canvas_xform);
- }
+ if (!lock_children && editable) {}*/
+
+ for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
+ if (canvas_item && !canvas_item->is_set_as_toplevel()) {
+ _expand_encompassing_rect_using_children(r_rect, p_node->get_child(i), r_first, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ } else {
+ const CanvasLayer *canvas_layer = Object::cast_to<CanvasLayer>(p_node);
+ _expand_encompassing_rect_using_children(r_rect, p_node->get_child(i), r_first, Transform2D(), canvas_layer ? canvas_layer->get_transform() : p_canvas_xform);
}
}
if (canvas_item && canvas_item->is_visible_in_tree() && !canvas_item->has_meta("_edit_lock_")) {
- Rect2 rect = canvas_item->_edit_get_rect();
Transform2D xform = p_parent_xform * p_canvas_xform * canvas_item->get_transform();
- if (r_first) {
- r_rect = Rect2(xform.xform(rect.position + rect.size / 2), Size2());
- r_first = false;
+ if (canvas_item->_edit_use_rect()) {
+ Rect2 rect = canvas_item->_edit_get_rect();
+ if (r_first) {
+ r_rect = Rect2(xform.xform(rect.position + rect.size / 2), Size2());
+ r_first = false;
+ }
+ if (r_rect.size != Size2()) {
+ r_rect.expand_to(xform.xform(rect.position));
+ r_rect.expand_to(xform.xform(rect.position + Point2(rect.size.x, 0)));
+ r_rect.expand_to(xform.xform(rect.position + Point2(0, rect.size.y)));
+ r_rect.expand_to(xform.xform(rect.position + rect.size));
+ }
+ } else {
+ if (r_first) {
+ r_rect = Rect2(xform.xform(Point2()), Size2());
+ r_first = false;
+ } else {
+ r_rect.expand_to(xform.xform(Point2()));
+ }
}
- r_rect.expand_to(xform.xform(rect.position));
- r_rect.expand_to(xform.xform(rect.position + Point2(rect.size.x, 0)));
- r_rect.expand_to(xform.xform(rect.position + Point2(0, rect.size.y)));
- r_rect.expand_to(xform.xform(rect.position + rect.size));
}
}
-Rect2 CanvasItemEditor::_get_scene_encompassing_rect() {
+Rect2 CanvasItemEditor::_get_encompassing_rect(const Node *p_node) {
Rect2 rect;
bool first = true;
- _expand_encompassing_rect_using_children(rect, editor->get_edited_scene(), first);
+ _expand_encompassing_rect_using_children(rect, p_node, first);
+
return rect;
}
-void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, int limit, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
+void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, int p_limit, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
if (!p_node)
return;
if (Object::cast_to<Viewport>(p_node))
@@ -433,21 +467,19 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
- if (canvas_item && !canvas_item->is_set_as_toplevel())
- _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, 0, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
- else {
+ if (canvas_item && !canvas_item->is_set_as_toplevel()) {
+ _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_limit, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ } else {
CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
- _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, 0, Transform2D(), cl ? cl->get_transform() : p_canvas_xform); //use base transform
+ _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_limit, Transform2D(), cl ? cl->get_transform() : p_canvas_xform);
}
- if (limit != 0 && r_items.size() >= limit)
+ if (p_limit != 0 && r_items.size() >= p_limit)
return;
}
- if (canvas_item && canvas_item->is_visible_in_tree() && !canvas_item->has_meta("_edit_lock_")) {
-
+ if (canvas_item && canvas_item->is_visible_in_tree()) {
Transform2D xform = (p_parent_xform * p_canvas_xform * canvas_item->get_transform()).affine_inverse();
const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length();
-
if (canvas_item->_edit_is_selected_on_click(xform.xform(p_pos), local_grab_distance)) {
Node2D *node = Object::cast_to<Node2D>(canvas_item);
@@ -462,40 +494,171 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
return;
}
-void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_node, List<CanvasItem *> *r_items, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
+void CanvasItemEditor::_get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items, int p_limit) {
+
+ Node *scene = editor->get_edited_scene();
+
+ _find_canvas_items_at_pos(p_pos, scene, r_items, p_limit);
+
+ //Remove invalid results
+ for (int i = 0; i < r_items.size(); i++) {
+ Node *node = r_items[i].item;
+
+ // Make sure the selected node is in the current scene, or editable
+ while (node && node != get_tree()->get_edited_scene_root() && node->get_owner() != scene && !scene->is_editable_instance(node->get_owner())) {
+ node = node->get_parent();
+ };
+
+ // Replace the node by the group if grouped
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(node);
+ while (node && node != scene->get_parent()) {
+ CanvasItem *canvas_item_tmp = Object::cast_to<CanvasItem>(node);
+ if (canvas_item_tmp && node->has_meta("_edit_group_")) {
+ canvas_item = canvas_item_tmp;
+ }
+ node = node->get_parent();
+ }
+
+ // Check if the canvas item is already in the list (for groups or scenes)
+ bool duplicate = false;
+ for (int j = 0; j < i; j++) {
+ if (r_items[j].item == canvas_item) {
+ duplicate = true;
+ break;
+ }
+ }
+
+ //Remove the item if invalid
+ if (!canvas_item || duplicate || (canvas_item != scene && canvas_item->get_owner() != scene && !scene->is_editable_instance(canvas_item->get_owner())) || (canvas_item->has_meta("_edit_lock_") && canvas_item->get_meta("_edit_lock_"))) {
+ r_items.remove(i);
+ i--;
+ } else {
+ r_items[i].item = canvas_item;
+ }
+ }
+}
+
+void CanvasItemEditor::_get_bones_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items) {
+ Point2 screen_pos = transform.xform(p_pos);
+
+ for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
+ Node2D *from_node = Object::cast_to<Node2D>(ObjectDB::get_instance(E->key().from));
+
+ Vector<Vector2> bone_shape;
+ if (!_get_bone_shape(&bone_shape, NULL, E))
+ continue;
+
+ // Check if the point is inside the Polygon2D
+ if (Geometry::is_point_in_polygon(screen_pos, bone_shape)) {
+ // Check if the item is already in the list
+ bool duplicate = false;
+ for (int i = 0; i < r_items.size(); i++) {
+ if (r_items[i].item == from_node) {
+ duplicate = true;
+ break;
+ }
+ }
+ if (duplicate)
+ continue;
+
+ // Else, add it
+ _SelectResult res;
+ res.item = from_node;
+ res.z_index = from_node ? from_node->get_z_index() : 0;
+ res.has_z = from_node;
+ r_items.push_back(res);
+ }
+ }
+}
+
+bool CanvasItemEditor::_get_bone_shape(Vector<Vector2> *shape, Vector<Vector2> *outline_shape, Map<BoneKey, BoneList>::Element *bone) {
+ int bone_width = EditorSettings::get_singleton()->get("editors/2d/bone_width");
+ int bone_outline_width = EditorSettings::get_singleton()->get("editors/2d/bone_outline_size");
+
+ Node2D *from_node = Object::cast_to<Node2D>(ObjectDB::get_instance(bone->key().from));
+ Node2D *to_node = Object::cast_to<Node2D>(ObjectDB::get_instance(bone->key().to));
+
+ if (!from_node->is_inside_tree())
+ return false; //may have been removed
+ if (!from_node)
+ return false;
+
+ if (!to_node && bone->get().length == 0)
+ return false;
+
+ Vector2 from = transform.xform(from_node->get_global_position());
+ Vector2 to;
+
+ if (to_node)
+ to = transform.xform(to_node->get_global_position());
+ else
+ to = transform.xform(from_node->get_global_transform().xform(Vector2(bone->get().length, 0)));
+
+ Vector2 rel = to - from;
+ Vector2 relt = rel.tangent().normalized() * bone_width;
+ Vector2 reln = rel.normalized();
+ Vector2 reltn = relt.normalized();
+
+ if (shape) {
+ shape->clear();
+ shape->push_back(from);
+ shape->push_back(from + rel * 0.2 + relt);
+ shape->push_back(to);
+ shape->push_back(from + rel * 0.2 - relt);
+ }
+
+ if (outline_shape) {
+ outline_shape->clear();
+ outline_shape->push_back(from + (-reln - reltn) * bone_outline_width);
+ outline_shape->push_back(from + (-reln + reltn) * bone_outline_width);
+ outline_shape->push_back(from + rel * 0.2 + relt + reltn * bone_outline_width);
+ outline_shape->push_back(to + (reln + reltn) * bone_outline_width);
+ outline_shape->push_back(to + (reln - reltn) * bone_outline_width);
+ outline_shape->push_back(from + rel * 0.2 - relt - reltn * bone_outline_width);
+ }
+ return true;
+}
+
+void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_node, List<CanvasItem *> *r_items, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
if (!p_node)
return;
if (Object::cast_to<Viewport>(p_node))
return;
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
+ Node *scene = editor->get_edited_scene();
- bool inherited = p_node != get_tree()->get_edited_scene_root() && p_node->get_filename() != "";
- bool editable = inherited && EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(p_node);
+ bool editable = p_node == scene || p_node->get_owner() == scene || scene->is_editable_instance(p_node->get_owner());
bool lock_children = p_node->has_meta("_edit_group_") && p_node->get_meta("_edit_group_");
+ bool locked = p_node->has_meta("_edit_lock_") && p_node->get_meta("_edit_lock_");
- if (!lock_children && (!inherited || editable)) {
+ if (!lock_children || !editable) {
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
if (canvas_item && !canvas_item->is_set_as_toplevel()) {
- _find_canvas_items_at_rect(p_rect, p_node->get_child(i), r_items, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ _find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
} else {
CanvasLayer *canvas_layer = Object::cast_to<CanvasLayer>(p_node);
- _find_canvas_items_at_rect(p_rect, p_node->get_child(i), r_items, Transform2D(), canvas_layer ? canvas_layer->get_transform() : p_canvas_xform);
+ _find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, Transform2D(), canvas_layer ? canvas_layer->get_transform() : p_canvas_xform);
}
}
}
- if (canvas_item && canvas_item->is_visible_in_tree() && !canvas_item->has_meta("_edit_lock_")) {
-
- Rect2 rect = canvas_item->_edit_get_rect();
+ if (canvas_item && canvas_item->is_visible_in_tree() && !locked && editable) {
Transform2D xform = p_parent_xform * p_canvas_xform * canvas_item->get_transform();
- if (p_rect.has_point(xform.xform(rect.position)) &&
- p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, 0))) &&
- p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, rect.size.y))) &&
- p_rect.has_point(xform.xform(rect.position + Vector2(0, rect.size.y)))) {
+ if (canvas_item->_edit_use_rect()) {
+ Rect2 rect = canvas_item->_edit_get_rect();
+ if (p_rect.has_point(xform.xform(rect.position)) &&
+ p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, 0))) &&
+ p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, rect.size.y))) &&
+ p_rect.has_point(xform.xform(rect.position + Vector2(0, rect.size.y)))) {
- r_items->push_back(canvas_item);
+ r_items->push_back(canvas_item);
+ }
+ } else {
+ if (p_rect.has_point(xform.xform(Point2()))) {
+ r_items->push_back(canvas_item);
+ }
}
}
}
@@ -555,16 +718,17 @@ Vector2 CanvasItemEditor::_anchor_to_position(const Control *p_control, Vector2
ERR_FAIL_COND_V(!p_control, Vector2());
Transform2D parent_transform = p_control->get_transform().affine_inverse();
- Size2 parent_size = p_control->get_parent_area_size();
+ Rect2 parent_rect = p_control->get_parent_anchorable_rect();
- return parent_transform.xform(Vector2(parent_size.x * anchor.x, parent_size.y * anchor.y));
+ return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y));
}
Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 position) {
ERR_FAIL_COND_V(!p_control, Vector2());
- Size2 parent_size = p_control->get_parent_area_size();
- return p_control->get_transform().xform(position) / parent_size;
+ Rect2 parent_rect = p_control->get_parent_anchorable_rect();
+
+ return (p_control->get_transform().xform(position) - parent_rect.position) / parent_rect.size;
}
void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items, bool save_bones) {
@@ -574,8 +738,11 @@ void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items
if (se) {
se->undo_state = canvas_item->_edit_get_state();
se->pre_drag_xform = canvas_item->get_global_transform_with_canvas();
- se->pre_drag_rect = canvas_item->_edit_get_rect();
-
+ if (canvas_item->_edit_use_rect()) {
+ se->pre_drag_rect = canvas_item->_edit_get_rect();
+ } else {
+ se->pre_drag_rect = Rect2();
+ }
se->pre_drag_bones_length = List<float>();
se->pre_drag_bones_undo_state = List<Dictionary>();
@@ -584,7 +751,7 @@ void CanvasItemEditor::_save_canvas_item_state(List<CanvasItem *> p_canvas_items
if (bone && bone->has_meta("_edit_bone_")) {
// Check if we have an IK chain
List<Node2D *> bone_ik_list;
- bool ik_found;
+ bool ik_found = false;
bone = Object::cast_to<Node2D>(bone->get_parent());
while (bone) {
bone_ik_list.push_back(bone);
@@ -852,11 +1019,11 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
- if (b->get_button_index() == BUTTON_WHEEL_DOWN) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_DOWN) {
// Scroll or pan down
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
- v_scroll->set_value(v_scroll->get_value() + int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor());
- _update_scroll(0);
+ view_offset.y += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
+ _update_scrollbars();
viewport->update();
} else {
_zoom_on_position(zoom * (1 - (0.05 * b->get_factor())), b->get_position());
@@ -864,11 +1031,11 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
return true;
}
- if (b->get_button_index() == BUTTON_WHEEL_UP) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_UP) {
// Scroll or pan up
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
- v_scroll->set_value(v_scroll->get_value() - int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor());
- _update_scroll(0);
+ view_offset.y -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
+ _update_scrollbars();
viewport->update();
} else {
_zoom_on_position(zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95), b->get_position());
@@ -876,42 +1043,76 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
return true;
}
- if (b->get_button_index() == BUTTON_WHEEL_LEFT) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_LEFT) {
// Pan left
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
- h_scroll->set_value(h_scroll->get_value() - int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor());
+ view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
+ _update_scrollbars();
+ viewport->update();
return true;
}
}
- if (b->get_button_index() == BUTTON_WHEEL_RIGHT) {
+ if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_RIGHT) {
// Pan right
if (bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan"))) {
- h_scroll->set_value(h_scroll->get_value() + int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor());
+ view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
+ _update_scrollbars();
+ viewport->update();
return true;
}
}
- }
- Ref<InputEventMouseMotion> m = p_event;
- if (m.is_valid()) {
if (drag_type == DRAG_NONE) {
- if (((m->get_button_mask() & BUTTON_MASK_LEFT) && tool == TOOL_PAN) ||
- (m->get_button_mask() & BUTTON_MASK_MIDDLE) ||
- ((m->get_button_mask() & BUTTON_MASK_LEFT) && Input::get_singleton()->is_key_pressed(KEY_SPACE)) ||
- (EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
+ if (b->is_pressed() &&
+ (b->get_button_index() == BUTTON_MIDDLE ||
+ (b->get_button_index() == BUTTON_LEFT && tool == TOOL_PAN) ||
+ (b->get_button_index() == BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning") && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
// Pan the viewport
- Point2i relative;
- if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
- relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
- } else {
- relative = m->get_relative();
+ drag_type = DRAG_PAN;
+ }
+ }
+
+ if (drag_type == DRAG_PAN) {
+ if (!b->is_pressed()) {
+ // Stop panning the viewport (for any mouse button press)
+ drag_type = DRAG_NONE;
+ }
+ }
+ }
+
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid()) {
+ if (k->get_scancode() == KEY_SPACE && EditorSettings::get_singleton()->get("editors/2d/simple_spacebar_panning")) {
+ if (drag_type == DRAG_NONE) {
+ if (k->is_pressed() && !k->is_echo()) {
+ //Pan the viewport
+ drag_type = DRAG_PAN;
+ }
+ } else if (drag_type == DRAG_PAN) {
+ if (!k->is_pressed()) {
+ // Stop panning the viewport (for any mouse button press)
+ drag_type = DRAG_NONE;
}
+ }
+ }
+ }
- h_scroll->set_value(h_scroll->get_value() - relative.x / zoom);
- v_scroll->set_value(v_scroll->get_value() - relative.y / zoom);
- return true;
+ Ref<InputEventMouseMotion> m = p_event;
+ if (m.is_valid()) {
+ if (drag_type == DRAG_PAN) {
+ // Pan the viewport
+ Point2i relative;
+ if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
+ relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
+ } else {
+ relative = m->get_relative();
}
+ view_offset.x -= relative.x / zoom;
+ view_offset.y -= relative.y / zoom;
+ _update_scrollbars();
+ viewport->update();
+ return true;
}
}
@@ -926,8 +1127,10 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event) {
if (pan_gesture.is_valid()) {
// Pan gesture
const Vector2 delta = (int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom) * pan_gesture->get_delta();
- h_scroll->set_value(h_scroll->get_value() + delta.x);
- v_scroll->set_value(v_scroll->get_value() + delta.y);
+ view_offset.x += delta.x;
+ view_offset.y += delta.y;
+ _update_scrollbars();
+ viewport->update();
return true;
}
@@ -1227,26 +1430,26 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
switch (drag_type) {
case DRAG_ANCHOR_TOP_LEFT:
- if (!use_single_axis || (use_single_axis && !use_y)) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
- if (!use_single_axis || (use_single_axis && use_y)) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
+ if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
+ if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
break;
case DRAG_ANCHOR_TOP_RIGHT:
- if (!use_single_axis || (use_single_axis && !use_y)) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
- if (!use_single_axis || (use_single_axis && use_y)) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
+ if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
+ if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
break;
case DRAG_ANCHOR_BOTTOM_RIGHT:
- if (!use_single_axis || (use_single_axis && !use_y)) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
- if (!use_single_axis || (use_single_axis && use_y)) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
+ if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
+ if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
break;
case DRAG_ANCHOR_BOTTOM_LEFT:
- if (!use_single_axis || (use_single_axis && !use_y)) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
- if (!use_single_axis || (use_single_axis && use_y)) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
+ if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
+ if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
break;
case DRAG_ANCHOR_ALL:
- if (!use_single_axis || (use_single_axis && !use_y)) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
- if (!use_single_axis || (use_single_axis && !use_y)) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
- if (!use_single_axis || (use_single_axis && use_y)) control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
- if (!use_single_axis || (use_single_axis && use_y)) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
+ if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
+ if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
+ if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
+ if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
break;
default:
break;
@@ -1282,54 +1485,55 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (selection.size() == 1) {
CanvasItem *canvas_item = selection[0];
+ if (canvas_item->_edit_use_rect()) {
+ Rect2 rect = canvas_item->_edit_get_rect();
+ Transform2D xform = transform * canvas_item->get_global_transform_with_canvas();
+
+ Vector2 endpoints[4] = {
+ xform.xform(rect.position),
+ xform.xform(rect.position + Vector2(rect.size.x, 0)),
+ xform.xform(rect.position + rect.size),
+ xform.xform(rect.position + Vector2(0, rect.size.y))
+ };
- Rect2 rect = canvas_item->_edit_get_rect();
- Transform2D xform = transform * canvas_item->get_global_transform_with_canvas();
-
- Vector2 endpoints[4] = {
- xform.xform(rect.position),
- xform.xform(rect.position + Vector2(rect.size.x, 0)),
- xform.xform(rect.position + rect.size),
- xform.xform(rect.position + Vector2(0, rect.size.y))
- };
-
- DragType dragger[] = {
- DRAG_TOP_LEFT,
- DRAG_TOP,
- DRAG_TOP_RIGHT,
- DRAG_RIGHT,
- DRAG_BOTTOM_RIGHT,
- DRAG_BOTTOM,
- DRAG_BOTTOM_LEFT,
- DRAG_LEFT
- };
-
- DragType resize_drag = DRAG_NONE;
- float radius = (select_handle->get_size().width / 2) * 1.5;
-
- for (int i = 0; i < 4; i++) {
- int prev = (i + 3) % 4;
- int next = (i + 1) % 4;
+ DragType dragger[] = {
+ DRAG_TOP_LEFT,
+ DRAG_TOP,
+ DRAG_TOP_RIGHT,
+ DRAG_RIGHT,
+ DRAG_BOTTOM_RIGHT,
+ DRAG_BOTTOM,
+ DRAG_BOTTOM_LEFT,
+ DRAG_LEFT
+ };
- Vector2 ofs = ((endpoints[i] - endpoints[prev]).normalized() + ((endpoints[i] - endpoints[next]).normalized())).normalized();
- ofs *= (select_handle->get_size().width / 2);
- ofs += endpoints[i];
- if (ofs.distance_to(b->get_position()) < radius)
- resize_drag = dragger[i * 2];
+ DragType resize_drag = DRAG_NONE;
+ float radius = (select_handle->get_size().width / 2) * 1.5;
- ofs = (endpoints[i] + endpoints[next]) / 2;
- ofs += (endpoints[next] - endpoints[i]).tangent().normalized() * (select_handle->get_size().width / 2);
- if (ofs.distance_to(b->get_position()) < radius)
- resize_drag = dragger[i * 2 + 1];
- }
+ for (int i = 0; i < 4; i++) {
+ int prev = (i + 3) % 4;
+ int next = (i + 1) % 4;
+
+ Vector2 ofs = ((endpoints[i] - endpoints[prev]).normalized() + ((endpoints[i] - endpoints[next]).normalized())).normalized();
+ ofs *= (select_handle->get_size().width / 2);
+ ofs += endpoints[i];
+ if (ofs.distance_to(b->get_position()) < radius)
+ resize_drag = dragger[i * 2];
+
+ ofs = (endpoints[i] + endpoints[next]) / 2;
+ ofs += (endpoints[next] - endpoints[i]).tangent().normalized() * (select_handle->get_size().width / 2);
+ if (ofs.distance_to(b->get_position()) < radius)
+ resize_drag = dragger[i * 2 + 1];
+ }
- if (resize_drag != DRAG_NONE) {
- drag_type = resize_drag;
- drag_from = transform.affine_inverse().xform(b->get_position());
- drag_selection = List<CanvasItem *>();
- drag_selection.push_back(canvas_item);
- _save_canvas_item_state(drag_selection);
- return true;
+ if (resize_drag != DRAG_NONE) {
+ drag_type = resize_drag;
+ drag_from = transform.affine_inverse().xform(b->get_position());
+ drag_selection = List<CanvasItem *>();
+ drag_selection.push_back(canvas_item);
+ _save_canvas_item_state(drag_selection);
+ return true;
+ }
}
}
}
@@ -1527,61 +1731,64 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
_save_canvas_item_state(drag_selection, true);
}
- _restore_canvas_item_state(drag_selection, true);
+ if (drag_selection.size() > 0) {
- bool move_local_base = k->get_alt();
- bool move_local_base_rotated = k->get_control() || k->get_metakey();
+ _restore_canvas_item_state(drag_selection, true);
- Vector2 dir;
- if (k->get_scancode() == KEY_UP)
- dir += Vector2(0, -1);
- else if (k->get_scancode() == KEY_DOWN)
- dir += Vector2(0, 1);
- else if (k->get_scancode() == KEY_LEFT)
- dir += Vector2(-1, 0);
- else if (k->get_scancode() == KEY_RIGHT)
- dir += Vector2(1, 0);
- if (k->get_shift())
- dir *= grid_step * Math::pow(2.0, grid_step_multiplier);
+ bool move_local_base = k->get_alt();
+ bool move_local_base_rotated = k->get_control() || k->get_metakey();
+
+ Vector2 dir;
+ if (k->get_scancode() == KEY_UP)
+ dir += Vector2(0, -1);
+ else if (k->get_scancode() == KEY_DOWN)
+ dir += Vector2(0, 1);
+ else if (k->get_scancode() == KEY_LEFT)
+ dir += Vector2(-1, 0);
+ else if (k->get_scancode() == KEY_RIGHT)
+ dir += Vector2(1, 0);
+ if (k->get_shift())
+ dir *= grid_step * Math::pow(2.0, grid_step_multiplier);
+
+ drag_to += dir;
+ if (k->get_shift())
+ drag_to = drag_to.snapped(grid_step * Math::pow(2.0, grid_step_multiplier));
- drag_to += dir;
- if (k->get_shift())
- drag_to = drag_to.snapped(grid_step * Math::pow(2.0, grid_step_multiplier));
+ Point2 previous_pos;
+ if (drag_selection.size() == 1) {
+ Transform2D xform = drag_selection[0]->get_global_transform_with_canvas() * drag_selection[0]->get_transform().affine_inverse();
+ previous_pos = xform.xform(drag_selection[0]->_edit_get_position());
+ } else {
+ previous_pos = _get_encompassing_rect_from_list(drag_selection).position;
+ }
- Point2 previous_pos;
- if (drag_selection.size() == 1) {
- Transform2D xform = drag_selection[0]->get_global_transform_with_canvas() * drag_selection[0]->get_transform().affine_inverse();
- previous_pos = xform.xform(drag_selection[0]->_edit_get_position());
- } else {
- previous_pos = _get_encompassing_rect_from_list(drag_selection).position;
- }
-
- Point2 new_pos;
- if (drag_selection.size() == 1) {
- Node2D *node_2d = Object::cast_to<Node2D>(drag_selection[0]);
- if (node_2d && move_local_base_rotated) {
- Transform2D m;
- m.rotate(node_2d->get_rotation());
- new_pos += m.xform(drag_to);
- } else if (move_local_base) {
- new_pos += drag_to;
+ Point2 new_pos;
+ if (drag_selection.size() == 1) {
+ Node2D *node_2d = Object::cast_to<Node2D>(drag_selection[0]);
+ if (node_2d && move_local_base_rotated) {
+ Transform2D m;
+ m.rotate(node_2d->get_rotation());
+ new_pos += m.xform(drag_to);
+ } else if (move_local_base) {
+ new_pos += drag_to;
+ } else {
+ new_pos = previous_pos + (drag_to - drag_from);
+ }
} else {
new_pos = previous_pos + (drag_to - drag_from);
}
- } else {
- new_pos = previous_pos + (drag_to - drag_from);
- }
- for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
- CanvasItem *canvas_item = E->get();
- CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
- Transform2D xform = canvas_item->get_global_transform_with_canvas().affine_inverse() * canvas_item->get_transform();
+ for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
+ CanvasItem *canvas_item = E->get();
+ CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
+ Transform2D xform = canvas_item->get_global_transform_with_canvas().affine_inverse() * canvas_item->get_transform();
- Node2D *node2d = Object::cast_to<Node2D>(canvas_item);
- if (node2d && se->pre_drag_bones_undo_state.size() > 0) {
- _solve_IK(node2d, new_pos);
- } else {
- canvas_item->_edit_set_position(canvas_item->_edit_get_position() + xform.xform(new_pos) - xform.xform(previous_pos));
+ Node2D *node2d = Object::cast_to<Node2D>(canvas_item);
+ if (node2d && se->pre_drag_bones_undo_state.size() > 0) {
+ _solve_IK(node2d, new_pos);
+ } else {
+ canvas_item->_edit_set_position(canvas_item->_edit_get_position() + xform.xform(new_pos) - xform.xform(previous_pos));
+ }
}
}
return true;
@@ -1615,22 +1822,12 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
if (drag_type == DRAG_NONE) {
if (b.is_valid() &&
- ((b->get_button_index() == BUTTON_LEFT && b->get_alt() && tool == TOOL_SELECT) ||
+ ((b->get_button_index() == BUTTON_RIGHT && b->get_alt() && tool == TOOL_SELECT) ||
(b->get_button_index() == BUTTON_LEFT && tool == TOOL_LIST_SELECT))) {
// Popup the selection menu list
- Point2 click = transform.xform(b->get_position());
-
- Node *scene = editor->get_edited_scene();
+ Point2 click = transform.affine_inverse().xform(b->get_position());
- _find_canvas_items_at_pos(click, scene, selection_results);
- for (int i = 0; i < selection_results.size(); i++) {
- CanvasItem *item = selection_results[i].item;
- if (item != scene && item->get_owner() != scene && !scene->is_editable_instance(item->get_owner())) {
- //invalid result
- selection_results.remove(i);
- i--;
- }
- }
+ _get_canvas_items_at_pos(click, selection_results);
if (selection_results.size() == 1) {
CanvasItem *item = selection_results[0].item;
@@ -1640,6 +1837,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
return true;
} else if (!selection_results.empty()) {
+ // Sorts items according the their z-index
selection_results.sort();
NodePath root_path = get_tree()->get_edited_scene_root()->get_path();
@@ -1664,8 +1862,6 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
selection_menu_additive_selection = b->get_shift();
selection_menu->set_global_position(b->get_global_position());
selection_menu->popup();
- selection_menu->call_deferred("grab_click_focus");
- selection_menu->set_invalidate_click_until_motion();
return true;
}
}
@@ -1681,25 +1877,29 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Find the item to select
CanvasItem *canvas_item = NULL;
Vector<_SelectResult> selection;
- _find_canvas_items_at_pos(click, scene, selection, 1);
- if (!selection.empty())
- canvas_item = selection[0].item;
- // Check if the canvas item is in a group, and select the group instead if it is the case
- CanvasItem *canvas_item_tmp = canvas_item;
- while (canvas_item_tmp) {
- if (canvas_item->has_meta("_edit_group_")) {
- canvas_item = canvas_item_tmp;
+ // Retrieve the items
+ _get_canvas_items_at_pos(click, selection, editor_selection->get_selection().empty() ? 1 : 0);
+
+ // Retrieve the bones
+ _get_bones_at_pos(click, selection);
+
+ for (int i = 0; i < selection.size(); i++) {
+ if (editor_selection->is_selected(selection[i].item)) {
+ // Drag the node(s) if requested
+ List<CanvasItem *> selection = _get_edited_canvas_items();
+
+ drag_type = DRAG_ALL;
+ drag_selection = selection;
+ drag_from = click;
+ _save_canvas_item_state(drag_selection);
+
+ return true;
}
- canvas_item_tmp = canvas_item_tmp->get_parent_item();
}
- // Make sure the selected node is in the current scene
- Node *node = canvas_item;
- while (node && ((node != scene && node->get_owner() != scene) || !node->is_class("CanvasItem"))) {
- node = node->get_parent();
- };
- canvas_item = Object::cast_to<CanvasItem>(node);
+ if (!selection.empty())
+ canvas_item = selection[0].item;
if (!canvas_item) {
// Start a box selection
@@ -1745,7 +1945,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
if (bsfrom.y > bsto.y)
SWAP(bsfrom.y, bsto.y);
- _find_canvas_items_at_rect(Rect2(bsfrom, bsto - bsfrom), scene, &selitems);
+ _find_canvas_items_in_rect(Rect2(bsfrom, bsto - bsfrom), scene, &selitems);
for (List<CanvasItem *>::Element *E = selitems.front(); E; E = E->next()) {
editor_selection->add_node(E->get());
}
@@ -1779,6 +1979,62 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
return false;
}
+bool CanvasItemEditor::_gui_input_hover(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventMouseMotion> m = p_event;
+ if (m.is_valid()) {
+ Point2 click = transform.affine_inverse().xform(m->get_position());
+
+ // Checks if the hovered items changed, update the viewport if so
+ Vector<_SelectResult> hovering_results_items;
+ _get_canvas_items_at_pos(click, hovering_results_items);
+ hovering_results_items.sort();
+
+ // Compute the nodes names and icon position
+ Vector<_HoverResult> hovering_results_tmp;
+ for (int i = 0; i < hovering_results_items.size(); i++) {
+ CanvasItem *canvas_item = hovering_results_items[i].item;
+
+ if (canvas_item->_edit_use_rect())
+ continue;
+
+ _HoverResult hover_result;
+ hover_result.position = canvas_item->get_global_transform_with_canvas().get_origin();
+ if (has_icon(canvas_item->get_class(), "EditorIcons"))
+ hover_result.icon = get_icon(canvas_item->get_class(), "EditorIcons");
+ else
+ hover_result.icon = get_icon("Object", "EditorIcons");
+ hover_result.name = canvas_item->get_name();
+
+ hovering_results_tmp.push_back(hover_result);
+ }
+
+ // Check if changed, if so, update.
+ bool changed = false;
+ if (hovering_results_tmp.size() == hovering_results.size()) {
+ for (int i = 0; i < hovering_results_tmp.size(); i++) {
+ _HoverResult a = hovering_results_tmp[i];
+ _HoverResult b = hovering_results[i];
+ if (a.icon != b.icon || a.name != b.name || a.position != b.position) {
+ changed = true;
+ break;
+ }
+ }
+ } else {
+ changed = true;
+ }
+
+ if (changed) {
+ hovering_results = hovering_results_tmp;
+ viewport->update();
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
bool accepted = false;
if ((accepted = _gui_input_rulers_and_guides(p_event))) {
@@ -1797,35 +2053,34 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
//printf("Rotate\n");
} else if ((accepted = _gui_input_move(p_event))) {
//printf("Move\n");
- } else if ((accepted = _gui_input_select(p_event))) {
- //printf("Selection\n");
} else if ((accepted = _gui_input_zoom_or_pan(p_event))) {
//printf("Zoom or pan\n");
+ } else if ((accepted = _gui_input_select(p_event))) {
+ //printf("Selection\n");
}
if (accepted)
accept_event();
+ // Handles the mouse hovering
+ _gui_input_hover(p_event);
+
// Change the cursor
CursorShape c = CURSOR_ARROW;
switch (drag_type) {
case DRAG_NONE:
- if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
- c = CURSOR_DRAG;
- } else {
- switch (tool) {
- case TOOL_MOVE:
- c = CURSOR_MOVE;
- break;
- case TOOL_EDIT_PIVOT:
- c = CURSOR_CROSS;
- break;
- case TOOL_PAN:
- c = CURSOR_DRAG;
- break;
- default:
- break;
- }
+ switch (tool) {
+ case TOOL_MOVE:
+ c = CURSOR_MOVE;
+ break;
+ case TOOL_EDIT_PIVOT:
+ c = CURSOR_CROSS;
+ break;
+ case TOOL_PAN:
+ c = CURSOR_DRAG;
+ break;
+ default:
+ break;
}
break;
case DRAG_LEFT:
@@ -1847,6 +2102,8 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
case DRAG_ALL:
c = CURSOR_MOVE;
break;
+ case DRAG_PAN:
+ c = CURSOR_DRAG;
default:
break;
}
@@ -1952,10 +2209,11 @@ void CanvasItemEditor::_draw_rulers() {
Color font_color = get_color("font_color", "Editor");
font_color.a = 0.8;
Ref<Font> font = get_font("rulers", "EditorFonts");
+ bool is_snap_active = snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL);
// The rule transform
Transform2D ruler_transform = Transform2D();
- if (show_grid || (snap_active && snap_grid)) {
+ if (show_grid || (is_snap_active && snap_grid)) {
List<CanvasItem *> selection = _get_edited_canvas_items();
if (snap_relative && selection.size() > 0) {
ruler_transform.translate(_get_encompassing_rect_from_list(selection).position);
@@ -2071,6 +2329,9 @@ void CanvasItemEditor::_draw_grid() {
void CanvasItemEditor::_draw_selection() {
Ref<Texture> pivot_icon = get_icon("EditorPivot", "EditorIcons");
+ Ref<Texture> position_icon = get_icon("EditorPosition", "EditorIcons");
+ Ref<Texture> previous_position_icon = get_icon("EditorPositionPrevious", "EditorIcons");
+
RID ci = viewport->get_canvas_item();
List<CanvasItem *> selection = _get_edited_canvas_items(false, false);
@@ -2080,8 +2341,6 @@ void CanvasItemEditor::_draw_selection() {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E->get());
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
- Rect2 rect = canvas_item->_edit_get_rect();
-
// Draw the previous position if we are dragging the node
if (show_helpers &&
(drag_type == DRAG_ALL || drag_type == DRAG_ROTATE ||
@@ -2090,42 +2349,52 @@ void CanvasItemEditor::_draw_selection() {
const Transform2D pre_drag_xform = transform * se->pre_drag_xform;
const Color pre_drag_color = Color(0.4, 0.6, 1, 0.7);
- Vector2 pre_drag_endpoints[4] = {
+ if (canvas_item->_edit_use_rect()) {
+ Vector2 pre_drag_endpoints[4] = {
- pre_drag_xform.xform(se->pre_drag_rect.position),
- pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(se->pre_drag_rect.size.x, 0)),
- pre_drag_xform.xform(se->pre_drag_rect.position + se->pre_drag_rect.size),
- pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(0, se->pre_drag_rect.size.y))
- };
+ pre_drag_xform.xform(se->pre_drag_rect.position),
+ pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(se->pre_drag_rect.size.x, 0)),
+ pre_drag_xform.xform(se->pre_drag_rect.position + se->pre_drag_rect.size),
+ pre_drag_xform.xform(se->pre_drag_rect.position + Vector2(0, se->pre_drag_rect.size.y))
+ };
- for (int i = 0; i < 4; i++) {
- viewport->draw_line(pre_drag_endpoints[i], pre_drag_endpoints[(i + 1) % 4], pre_drag_color, 2);
+ for (int i = 0; i < 4; i++) {
+ viewport->draw_line(pre_drag_endpoints[i], pre_drag_endpoints[(i + 1) % 4], pre_drag_color, 2);
+ }
+ } else {
+ viewport->draw_texture(previous_position_icon, (pre_drag_xform.xform(Point2()) - (previous_position_icon->get_size() / 2)).floor());
}
}
Transform2D xform = transform * canvas_item->get_global_transform_with_canvas();
- VisualServer::get_singleton()->canvas_item_add_set_transform(ci, xform);
-
- // Draw the selected items surrounding boxes
- Vector2 endpoints[4] = {
- xform.xform(rect.position),
- xform.xform(rect.position + Vector2(rect.size.x, 0)),
- xform.xform(rect.position + rect.size),
- xform.xform(rect.position + Vector2(0, rect.size.y))
- };
- Color c = Color(1, 0.6, 0.4, 0.7);
+ // Draw the selected items position / surrounding boxes
+ if (canvas_item->_edit_use_rect()) {
+ Rect2 rect = canvas_item->_edit_get_rect();
+ Vector2 endpoints[4] = {
+ xform.xform(rect.position),
+ xform.xform(rect.position + Vector2(rect.size.x, 0)),
+ xform.xform(rect.position + rect.size),
+ xform.xform(rect.position + Vector2(0, rect.size.y))
+ };
- VisualServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D());
+ Color c = Color(1, 0.6, 0.4, 0.7);
- for (int i = 0; i < 4; i++) {
- viewport->draw_line(endpoints[i], endpoints[(i + 1) % 4], c, 2);
+ for (int i = 0; i < 4; i++) {
+ viewport->draw_line(endpoints[i], endpoints[(i + 1) % 4], c, 2);
+ }
+ } else {
+
+ Transform2D transform = Transform2D(xform.get_rotation(), xform.get_origin());
+ viewport->draw_set_transform_matrix(transform);
+ viewport->draw_texture(position_icon, -(position_icon->get_size() / 2));
+ viewport->draw_set_transform_matrix(Transform2D());
}
if (single && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE || tool == TOOL_EDIT_PIVOT)) { //kind of sucks
// Draw the pivot
if (canvas_item->_edit_get_pivot() != Vector2() || drag_type == DRAG_PIVOT || tool == TOOL_EDIT_PIVOT) { // This is not really clean :/
- viewport->draw_texture(pivot_icon, xform.xform(canvas_item->_edit_get_pivot()) + (-pivot_icon->get_size() / 2).floor());
+ viewport->draw_texture(pivot_icon, (xform.xform(canvas_item->_edit_get_pivot()) - (pivot_icon->get_size() / 2)).floor());
}
Control *control = Object::cast_to<Control>(canvas_item);
@@ -2222,10 +2491,12 @@ void CanvasItemEditor::_draw_selection() {
Transform2D parent_transform = xform * control->get_transform().affine_inverse();
float node_pos_in_parent[4];
- node_pos_in_parent[0] = control->get_anchor(MARGIN_LEFT) * control->get_parent_area_size().width + control->get_margin(MARGIN_LEFT);
- node_pos_in_parent[1] = control->get_anchor(MARGIN_TOP) * control->get_parent_area_size().height + control->get_margin(MARGIN_TOP);
- node_pos_in_parent[2] = control->get_anchor(MARGIN_RIGHT) * control->get_parent_area_size().width + control->get_margin(MARGIN_RIGHT);
- node_pos_in_parent[3] = control->get_anchor(MARGIN_BOTTOM) * control->get_parent_area_size().height + control->get_margin(MARGIN_BOTTOM);
+ Rect2 parent_rect = control->get_parent_anchorable_rect();
+
+ node_pos_in_parent[0] = control->get_anchor(MARGIN_LEFT) * parent_rect.size.width + control->get_margin(MARGIN_LEFT) + parent_rect.position.x;
+ node_pos_in_parent[1] = control->get_anchor(MARGIN_TOP) * parent_rect.size.height + control->get_margin(MARGIN_TOP) + parent_rect.position.y;
+ node_pos_in_parent[2] = control->get_anchor(MARGIN_RIGHT) * parent_rect.size.width + control->get_margin(MARGIN_RIGHT) + parent_rect.position.x;
+ node_pos_in_parent[3] = control->get_anchor(MARGIN_BOTTOM) * parent_rect.size.height + control->get_margin(MARGIN_BOTTOM) + parent_rect.position.y;
Point2 start, end;
switch (drag_type) {
@@ -2307,7 +2578,14 @@ void CanvasItemEditor::_draw_selection() {
}
}
- if (tool == TOOL_SELECT) {
+ if (tool == TOOL_SELECT && canvas_item->_edit_use_rect()) {
+ Rect2 rect = canvas_item->_edit_get_rect();
+ Vector2 endpoints[4] = {
+ xform.xform(rect.position),
+ xform.xform(rect.position + Vector2(rect.size.x, 0)),
+ xform.xform(rect.position + rect.size),
+ xform.xform(rect.position + Vector2(0, rect.size.y))
+ };
for (int i = 0; i < 4; i++) {
// Draw the resize handles
int prev = (i + 3) % 4;
@@ -2384,26 +2662,34 @@ void CanvasItemEditor::_draw_straight_line(Point2 p_from, Point2 p_to, Color p_c
}
void CanvasItemEditor::_draw_axis() {
- RID ci = viewport->get_canvas_item();
- Color x_axis_color(1.0, 0.4, 0.4, 0.6);
- Color y_axis_color(0.4, 1.0, 0.4, 0.6);
- Color area_axis_color(0.4, 0.4, 1.0, 0.4);
+ if (show_origin) {
+
+ Color x_axis_color(1.0, 0.4, 0.4, 0.6);
+ Color y_axis_color(0.4, 1.0, 0.4, 0.6);
- _draw_straight_line(Point2(), Point2(1, 0), x_axis_color);
- _draw_straight_line(Point2(), Point2(0, 1), y_axis_color);
+ _draw_straight_line(Point2(), Point2(1, 0), x_axis_color);
+ _draw_straight_line(Point2(), Point2(0, 1), y_axis_color);
+ }
- Size2 screen_size = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
+ if (show_viewport) {
- Vector2 screen_endpoints[4] = {
- transform.xform(Vector2(0, 0)),
- transform.xform(Vector2(screen_size.width, 0)),
- transform.xform(Vector2(screen_size.width, screen_size.height)),
- transform.xform(Vector2(0, screen_size.height))
- };
+ RID ci = viewport->get_canvas_item();
- for (int i = 0; i < 4; i++) {
- VisualServer::get_singleton()->canvas_item_add_line(ci, screen_endpoints[i], screen_endpoints[(i + 1) % 4], area_axis_color);
+ Color area_axis_color(0.4, 0.4, 1.0, 0.4);
+
+ Size2 screen_size = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
+
+ Vector2 screen_endpoints[4] = {
+ transform.xform(Vector2(0, 0)),
+ transform.xform(Vector2(screen_size.width, 0)),
+ transform.xform(Vector2(screen_size.width, screen_size.height)),
+ transform.xform(Vector2(0, screen_size.height))
+ };
+
+ for (int i = 0; i < 4; i++) {
+ VisualServer::get_singleton()->canvas_item_add_line(ci, screen_endpoints[i], screen_endpoints[(i + 1) % 4], area_axis_color);
+ }
}
}
@@ -2411,48 +2697,25 @@ void CanvasItemEditor::_draw_bones() {
RID ci = viewport->get_canvas_item();
if (skeleton_show_bones) {
- int bone_width = EditorSettings::get_singleton()->get("editors/2d/bone_width");
Color bone_color1 = EditorSettings::get_singleton()->get("editors/2d/bone_color1");
Color bone_color2 = EditorSettings::get_singleton()->get("editors/2d/bone_color2");
Color bone_ik_color = EditorSettings::get_singleton()->get("editors/2d/bone_ik_color");
+ Color bone_outline_color = EditorSettings::get_singleton()->get("editors/2d/bone_outline_color");
Color bone_selected_color = EditorSettings::get_singleton()->get("editors/2d/bone_selected_color");
- for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
-
- E->get().from = Vector2();
- E->get().to = Vector2();
-
- Node2D *n2d = Object::cast_to<Node2D>(ObjectDB::get_instance(E->key()));
- if (!n2d)
- continue;
+ for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
- if (!n2d->get_parent())
+ Vector<Vector2> bone_shape;
+ Vector<Vector2> bone_shape_outline;
+ if (!_get_bone_shape(&bone_shape, &bone_shape_outline, E))
continue;
- CanvasItem *pi = n2d->get_parent_item();
-
- Node2D *pn2d = Object::cast_to<Node2D>(n2d->get_parent());
-
- if (!pn2d)
+ Node2D *from_node = Object::cast_to<Node2D>(ObjectDB::get_instance(E->key().from));
+ if (!from_node->is_visible_in_tree())
continue;
- Vector2 from = transform.xform(pn2d->get_global_position());
- Vector2 to = transform.xform(n2d->get_global_position());
-
- E->get().from = from;
- E->get().to = to;
-
- Vector2 rel = to - from;
- Vector2 relt = rel.tangent().normalized() * bone_width;
-
- Vector<Vector2> bone_shape;
- bone_shape.push_back(from);
- bone_shape.push_back(from + rel * 0.2 + relt);
- bone_shape.push_back(to);
- bone_shape.push_back(from + rel * 0.2 - relt);
Vector<Color> colors;
- if (pi->has_meta("_edit_ik_")) {
-
+ if (from_node->has_meta("_edit_ik_")) {
colors.push_back(bone_ik_color);
colors.push_back(bone_ik_color);
colors.push_back(bone_ik_color);
@@ -2464,71 +2727,212 @@ void CanvasItemEditor::_draw_bones() {
colors.push_back(bone_color2);
}
+ Vector<Color> outline_colors;
+
+ if (editor_selection->is_selected(from_node)) {
+ outline_colors.push_back(bone_selected_color);
+ outline_colors.push_back(bone_selected_color);
+ outline_colors.push_back(bone_selected_color);
+ outline_colors.push_back(bone_selected_color);
+ outline_colors.push_back(bone_selected_color);
+ outline_colors.push_back(bone_selected_color);
+ } else {
+ outline_colors.push_back(bone_outline_color);
+ outline_colors.push_back(bone_outline_color);
+ outline_colors.push_back(bone_outline_color);
+ outline_colors.push_back(bone_outline_color);
+ outline_colors.push_back(bone_outline_color);
+ outline_colors.push_back(bone_outline_color);
+ }
+
+ VisualServer::get_singleton()->canvas_item_add_polygon(ci, bone_shape_outline, outline_colors);
VisualServer::get_singleton()->canvas_item_add_primitive(ci, bone_shape, colors, Vector<Vector2>(), RID());
+ }
+ }
+}
- if (editor_selection->is_selected(pi)) {
- for (int i = 0; i < bone_shape.size(); i++) {
+void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
+ ERR_FAIL_COND(!p_node);
- VisualServer::get_singleton()->canvas_item_add_line(ci, bone_shape[i], bone_shape[(i + 1) % bone_shape.size()], bone_selected_color, 2);
- }
+ Node *scene = editor->get_edited_scene();
+ if (p_node != scene && p_node->get_owner() != scene && !scene->is_editable_instance(p_node->get_owner()))
+ return;
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
+ if (canvas_item && !canvas_item->is_visible())
+ return;
+
+ Transform2D parent_xform = p_parent_xform;
+ Transform2D canvas_xform = p_canvas_xform;
+
+ if (canvas_item && !canvas_item->is_set_as_toplevel()) {
+ parent_xform = parent_xform * canvas_item->get_transform();
+ } else {
+ CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
+ parent_xform = Transform2D();
+ canvas_xform = cl ? cl->get_transform() : p_canvas_xform;
+ }
+
+ for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
+ _draw_invisible_nodes_positions(p_node->get_child(i), parent_xform, canvas_xform);
+ }
+
+ if (canvas_item && !canvas_item->_edit_use_rect() && !editor_selection->is_selected(canvas_item)) {
+ Transform2D xform = transform * canvas_xform * parent_xform;
+
+ // Draw the node's position
+ Ref<Texture> position_icon = get_icon("EditorPositionUnselected", "EditorIcons");
+ Transform2D transform = Transform2D(xform.get_rotation(), xform.get_origin());
+ viewport->draw_set_transform_matrix(transform);
+ viewport->draw_texture(position_icon, -position_icon->get_size() / 2, Color(1.0, 1.0, 1.0, 0.5));
+ viewport->draw_set_transform_matrix(Transform2D());
+ }
+}
+
+void CanvasItemEditor::_draw_hover() {
+ List<Rect2> previous_rects;
+
+ for (int i = 0; i < hovering_results.size(); i++) {
+
+ Ref<Texture> node_icon = hovering_results[i].icon;
+ String node_name = hovering_results[i].name;
+
+ Ref<Font> font = get_font("font", "Label");
+ Size2 node_name_size = font->get_string_size(node_name);
+ Size2 item_size = Size2(node_icon->get_size().x + 4 + node_name_size.x, MAX(node_icon->get_size().y, node_name_size.y - 3));
+
+ Point2 pos = transform.xform(hovering_results[i].position) - Point2(0, item_size.y) + (Point2(node_icon->get_size().x, -node_icon->get_size().y) / 4);
+ // Rectify the position to avoid overlaping items
+ for (List<Rect2>::Element *E = previous_rects.front(); E; E = E->next()) {
+ if (E->get().intersects(Rect2(pos, item_size))) {
+ pos.y = E->get().get_position().y - item_size.y;
}
}
+
+ previous_rects.push_back(Rect2(pos, item_size));
+
+ // Draw icon
+ viewport->draw_texture(node_icon, pos, Color(1.0, 1.0, 1.0, 0.5));
+
+ // Draw name
+ viewport->draw_string(font, pos + Point2(node_icon->get_size().x + 4, item_size.y - 3), node_name, Color(1.0, 1.0, 1.0, 0.5));
}
}
-void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p_xform) {
+void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) {
ERR_FAIL_COND(!p_node);
- RID viewport_ci = viewport->get_canvas_item();
+ Node *scene = editor->get_edited_scene();
+ if (p_node != scene && p_node->get_owner() != scene && !scene->is_editable_instance(p_node->get_owner()))
+ return;
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
+ if (canvas_item && !canvas_item->is_visible())
+ return;
+
+ Transform2D parent_xform = p_parent_xform;
+ Transform2D canvas_xform = p_canvas_xform;
- Transform2D transform_ci = p_xform;
- CanvasItem *ci = Object::cast_to<CanvasItem>(p_node);
- if (ci)
- transform_ci = transform_ci * ci->get_transform();
+ if (canvas_item && !canvas_item->is_set_as_toplevel()) {
+ parent_xform = parent_xform * canvas_item->get_transform();
+ } else {
+ CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
+ parent_xform = Transform2D();
+ canvas_xform = cl ? cl->get_transform() : p_canvas_xform;
+ }
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
- _draw_locks_and_groups(p_node->get_child(i), transform_ci);
+ _draw_locks_and_groups(p_node->get_child(i), parent_xform, canvas_xform);
}
- if (ci) {
+ RID viewport_canvas_item = viewport->get_canvas_item();
+ if (canvas_item) {
+ float offset = 0;
+
Ref<Texture> lock = get_icon("LockViewport", "EditorIcons");
if (p_node->has_meta("_edit_lock_")) {
- lock->draw(viewport_ci, transform_ci.xform(Point2(0, 0)));
+ lock->draw(viewport_canvas_item, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0));
+ offset += lock->get_size().x;
}
Ref<Texture> group = get_icon("GroupViewport", "EditorIcons");
- if (ci->has_meta("_edit_group_")) {
- Vector2 ofs = transform_ci.xform(Point2(0, 0));
- if (ci->has_meta("_edit_lock_"))
- ofs = Point2(ofs.x + lock->get_size().x, ofs.y);
- group->draw(viewport_ci, ofs);
+ if (canvas_item->has_meta("_edit_group_")) {
+ group->draw(viewport_canvas_item, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0));
+ //offset += group->get_size().x;
}
}
}
-void CanvasItemEditor::_build_bones_list(Node *p_node) {
- ERR_FAIL_COND(!p_node);
+bool CanvasItemEditor::_build_bones_list(Node *p_node) {
+ ERR_FAIL_COND_V(!p_node, false);
+
+ bool has_child_bones = false;
for (int i = 0; i < p_node->get_child_count(); i++) {
- _build_bones_list(p_node->get_child(i));
+ if (_build_bones_list(p_node->get_child(i))) {
+ has_child_bones = true;
+ }
+ }
+
+ CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
+ Node *scene = editor->get_edited_scene();
+ if (!canvas_item || !canvas_item->is_visible() || (canvas_item != scene && canvas_item->get_owner() != scene && !scene->is_editable_instance(canvas_item->get_owner()))) {
+ return false;
}
- CanvasItem *c = Object::cast_to<CanvasItem>(p_node);
- if (c && c->is_visible_in_tree()) {
- if (c->has_meta("_edit_bone_")) {
+ Node *parent = canvas_item->get_parent();
- ObjectID id = c->get_instance_id();
- if (!bone_list.has(id)) {
- BoneList bone;
- bone_list[id] = bone;
+ if (Object::cast_to<Bone2D>(canvas_item)) {
+ if (Object::cast_to<Bone2D>(parent)) {
+ // Add as bone->parent relationship
+ BoneKey bk;
+ bk.from = parent->get_instance_id();
+ bk.to = canvas_item->get_instance_id();
+ if (!bone_list.has(bk)) {
+ BoneList b;
+ b.length = 0;
+ bone_list[bk] = b;
}
- bone_list[id].last_pass = bone_last_frame;
+ bone_list[bk].last_pass = bone_last_frame;
}
+
+ if (!has_child_bones) {
+ // Add a last bone if the Bone2D has no Bone2D child
+ BoneKey bk;
+ bk.from = canvas_item->get_instance_id();
+ bk.to = 0;
+ if (!bone_list.has(bk)) {
+ BoneList b;
+ b.length = 0;
+ bone_list[bk] = b;
+ }
+ bone_list[bk].last_pass = bone_last_frame;
+ }
+
+ return true;
+ }
+
+ if (canvas_item->has_meta("_edit_bone_")) {
+ // Add a "custom bone"
+ BoneKey bk;
+ bk.from = parent->get_instance_id();
+ bk.to = canvas_item->get_instance_id();
+ if (!bone_list.has(bk)) {
+ BoneList b;
+ b.length = 0;
+ bone_list[bk] = b;
+ }
+ bone_list[bk].last_pass = bone_last_frame;
}
+
+ return false;
}
void CanvasItemEditor::_draw_viewport() {
+ // Update the transform
+ transform = Transform2D();
+ transform.scale_basis(Size2(zoom, zoom));
+ transform.elements[2] = -view_offset * zoom;
+ editor->get_scene_root()->set_global_canvas_transform(transform);
// hide/show buttons depending on the selection
bool all_locked = true;
@@ -2559,13 +2963,13 @@ void CanvasItemEditor::_draw_viewport() {
group_button->set_disabled(selection.empty());
ungroup_button->set_visible(all_group);
- _update_scrollbars();
-
_draw_grid();
_draw_selection();
_draw_axis();
- if (editor->get_edited_scene())
- _draw_locks_and_groups(editor->get_edited_scene(), transform);
+ if (editor->get_edited_scene()) {
+ _draw_locks_and_groups(editor->get_edited_scene());
+ _draw_invisible_nodes_positions(editor->get_edited_scene());
+ }
RID ci = viewport->get_canvas_item();
VisualServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D());
@@ -2585,6 +2989,7 @@ void CanvasItemEditor::_draw_viewport() {
if (show_guides)
_draw_guides();
_draw_focus();
+ _draw_hover();
}
void CanvasItemEditor::_notification(int p_what) {
@@ -2595,17 +3000,23 @@ void CanvasItemEditor::_notification(int p_what) {
int nb_control = 0;
int nb_having_pivot = 0;
+ // Update the viewport if the canvas_item changes
List<CanvasItem *> selection = _get_edited_canvas_items();
for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get();
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
- Rect2 r = canvas_item->_edit_get_rect();
+ Rect2 rect;
+ if (canvas_item->_edit_use_rect()) {
+ rect = canvas_item->_edit_get_rect();
+ } else {
+ rect = Rect2();
+ }
Transform2D xform = canvas_item->get_transform();
- if (r != se->prev_rect || xform != se->prev_xform) {
+ if (rect != se->prev_rect || xform != se->prev_xform) {
viewport->update();
- se->prev_rect = r;
+ se->prev_rect = rect;
se->prev_xform = xform;
}
@@ -2635,15 +3046,17 @@ void CanvasItemEditor::_notification(int p_what) {
nb_having_pivot++;
}
}
+
// Activate / Deactivate the pivot tool
pivot_button->set_disabled(nb_having_pivot == 0);
// Show / Hide the layout button
presets_menu->set_visible(nb_control > 0 && nb_control == selection.size());
- for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
+ // Update the viewport if bones changes
+ for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
- Object *b = ObjectDB::get_instance(E->key());
+ Object *b = ObjectDB::get_instance(E->key().from);
if (!b) {
viewport->update();
@@ -2651,13 +3064,22 @@ void CanvasItemEditor::_notification(int p_what) {
}
Node2D *b2 = Object::cast_to<Node2D>(b);
- if (!b2) {
+ if (!b2 || !b2->is_inside_tree()) {
continue;
}
- if (b2->get_global_transform() != E->get().xform) {
+ Transform2D global_xform = b2->get_global_transform();
+
+ if (global_xform != E->get().xform) {
- E->get().xform = b2->get_global_transform();
+ E->get().xform = global_xform;
+ viewport->update();
+ }
+
+ Bone2D *bone = Object::cast_to<Bone2D>(b);
+ if (bone && bone->get_default_length() != E->get().length) {
+
+ E->get().length = bone->get_default_length();
viewport->update();
}
}
@@ -2671,14 +3093,21 @@ void CanvasItemEditor::_notification(int p_what) {
select_sb->set_default_margin(Margin(i), 4);
}
- AnimationPlayerEditor::singleton->get_key_editor()->connect("visibility_changed", this, "_keying_changed");
+ AnimationPlayerEditor::singleton->get_track_editor()->connect("visibility_changed", this, "_keying_changed");
_keying_changed();
+ get_tree()->connect("node_added", this, "_tree_changed", varray());
+ get_tree()->connect("node_removed", this, "_tree_changed", varray());
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
select_sb->set_texture(get_icon("EditorRect2D", "EditorIcons"));
}
+ if (p_what == NOTIFICATION_EXIT_TREE) {
+ get_tree()->disconnect("node_added", this, "_tree_changed");
+ get_tree()->disconnect("node_removed", this, "_tree_changed");
+ }
+
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
select_button->set_icon(get_icon("ToolSelect", "EditorIcons"));
list_select_button->set_icon(get_icon("ListSelect", "EditorIcons"));
@@ -2761,17 +3190,59 @@ void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
// Clear the selection
editor_selection->clear(); //_clear_canvas_items();
editor_selection->add_node(p_canvas_item);
- viewport->update();
+}
+
+void CanvasItemEditor::_queue_update_bone_list() {
+
+ if (bone_list_dirty)
+ return;
+
+ call_deferred("_update_bone_list");
+ bone_list_dirty = true;
+}
+
+void CanvasItemEditor::_update_bone_list() {
+
+ bone_last_frame++;
+
+ if (editor->get_edited_scene()) {
+ _build_bones_list(editor->get_edited_scene());
+ }
+
+ List<Map<BoneKey, BoneList>::Element *> bone_to_erase;
+ for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
+ if (E->get().last_pass != bone_last_frame) {
+ bone_to_erase.push_back(E);
+ continue;
+ }
+
+ Node *node = Object::cast_to<Node>(ObjectDB::get_instance(E->key().from));
+ if (!node || !node->is_inside_tree() || (node != get_tree()->get_edited_scene_root() && !get_tree()->get_edited_scene_root()->is_a_parent_of(node))) {
+ bone_to_erase.push_back(E);
+ continue;
+ }
+ }
+ while (bone_to_erase.size()) {
+ bone_list.erase(bone_to_erase.front()->get());
+ bone_to_erase.pop_front();
+ }
+ bone_list_dirty = false;
+}
+
+void CanvasItemEditor::_tree_changed(Node *) {
+ _queue_update_bone_list();
}
void CanvasItemEditor::_update_scrollbars() {
updating_scroll = true;
+ // Move the zoom buttons
Point2 zoom_hb_begin = Point2(5, 5);
zoom_hb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2();
zoom_hb->set_begin(zoom_hb_begin);
+ // Move and resize the scrollbars
Size2 size = viewport->get_size();
Size2 hmin = h_scroll->get_minimum_size();
Size2 vmin = v_scroll->get_minimum_size();
@@ -2782,79 +3253,72 @@ void CanvasItemEditor::_update_scrollbars() {
h_scroll->set_begin(Point2((show_rulers) ? RULER_WIDTH : 0, size.height - hmin.height));
h_scroll->set_end(Point2(size.width - vmin.width, size.height));
+ // Get the visible frame
Size2 screen_rect = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
-
Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height));
- bone_last_frame++;
-
- if (editor->get_edited_scene()) {
- _build_bones_list(editor->get_edited_scene());
- }
-
- List<Map<ObjectID, BoneList>::Element *> bone_to_erase;
- for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
- if (E->get().last_pass != bone_last_frame) {
- bone_to_erase.push_back(E);
- }
- }
- while (bone_to_erase.size()) {
- bone_list.erase(bone_to_erase.front()->get());
- bone_to_erase.pop_front();
- }
+ _queue_update_bone_list();
// Calculate scrollable area
Rect2 canvas_item_rect = Rect2(Point2(), screen_rect);
if (editor->get_edited_scene()) {
- Rect2 content_rect = _get_scene_encompassing_rect();
+ Rect2 content_rect = _get_encompassing_rect(editor->get_edited_scene());
canvas_item_rect.expand_to(content_rect.position);
canvas_item_rect.expand_to(content_rect.position + content_rect.size);
}
canvas_item_rect.size += screen_rect * 2;
canvas_item_rect.position -= screen_rect;
- Point2 ofs;
+ // Constraints the view offset and updates the scrollbars
+ Point2 begin = canvas_item_rect.position;
+ Point2 end = canvas_item_rect.position + canvas_item_rect.size - local_rect.size / zoom;
if (canvas_item_rect.size.height <= (local_rect.size.y / zoom)) {
+ if (ABS(begin.y - previous_update_view_offset.y) < ABS(begin.y - view_offset.y)) {
+ view_offset.y = previous_update_view_offset.y;
+ }
+
v_scroll->hide();
- ofs.y = canvas_item_rect.position.y;
} else {
-
- v_scroll->show();
- v_scroll->set_min(canvas_item_rect.position.y);
- v_scroll->set_max(canvas_item_rect.position.y + canvas_item_rect.size.y);
- v_scroll->set_page(local_rect.size.y / zoom);
- if (first_update) {
- //so 0,0 is visible
- v_scroll->set_value(-10);
- h_scroll->set_value(-10);
- first_update = false;
+ if (view_offset.y > end.y && view_offset.y > previous_update_view_offset.y) {
+ view_offset.y = MAX(end.y, previous_update_view_offset.y);
+ }
+ if (view_offset.y < begin.y && view_offset.y < previous_update_view_offset.y) {
+ view_offset.y = MIN(begin.y, previous_update_view_offset.y);
}
- ofs.y = v_scroll->get_value();
+ v_scroll->show();
+ v_scroll->set_min(MIN(view_offset.y, begin.y));
+ v_scroll->set_max(MAX(view_offset.y, end.y) + screen_rect.y);
+ v_scroll->set_page(screen_rect.y);
}
if (canvas_item_rect.size.width <= (local_rect.size.x / zoom)) {
+ if (ABS(begin.x - previous_update_view_offset.x) < ABS(begin.x - view_offset.x)) {
+ view_offset.x = previous_update_view_offset.x;
+ }
h_scroll->hide();
- ofs.x = canvas_item_rect.position.x;
} else {
+ if (view_offset.x > end.x && view_offset.x > previous_update_view_offset.x) {
+ view_offset.x = MAX(end.x, previous_update_view_offset.x);
+ }
+ if (view_offset.x < begin.x && view_offset.x < previous_update_view_offset.x) {
+ view_offset.x = MIN(begin.x, previous_update_view_offset.x);
+ }
h_scroll->show();
- h_scroll->set_min(canvas_item_rect.position.x);
- h_scroll->set_max(canvas_item_rect.position.x + canvas_item_rect.size.x);
- h_scroll->set_page(local_rect.size.x / zoom);
- ofs.x = h_scroll->get_value();
+ h_scroll->set_min(MIN(view_offset.x, begin.x));
+ h_scroll->set_max(MAX(view_offset.x, end.x) + screen_rect.x);
+ h_scroll->set_page(screen_rect.x);
}
- //transform=Matrix32();
- transform.elements[2] = -ofs * zoom;
-
- editor->get_scene_root()->set_global_canvas_transform(transform);
+ // Calculate scrollable area
+ v_scroll->set_value(view_offset.y);
+ h_scroll->set_value(view_offset.x);
+ previous_update_view_offset = view_offset;
updating_scroll = false;
-
- //transform.scale_basis(Vector2(zoom,zoom));
}
void CanvasItemEditor::_update_scroll(float) {
@@ -2862,19 +3326,8 @@ void CanvasItemEditor::_update_scroll(float) {
if (updating_scroll)
return;
- Point2 ofs;
- ofs.x = h_scroll->get_value();
- ofs.y = v_scroll->get_value();
-
- //current_window->set_scroll(-ofs);
-
- transform = Transform2D();
-
- transform.scale_basis(Size2(zoom, zoom));
- transform.elements[2] = -ofs;
-
- editor->get_scene_root()->set_global_canvas_transform(transform);
-
+ view_offset.x = h_scroll->get_value();
+ view_offset.y = v_scroll->get_value();
viewport->update();
}
@@ -2941,15 +3394,15 @@ void CanvasItemEditor::_zoom_on_position(float p_zoom, Point2 p_position) {
zoom = p_zoom;
Point2 ofs = p_position;
ofs = ofs / prev_zoom - ofs / zoom;
- h_scroll->set_value(Math::round(h_scroll->get_value() + ofs.x));
- v_scroll->set_value(Math::round(v_scroll->get_value() + ofs.y));
+ view_offset.x = Math::round(view_offset.x + ofs.x);
+ view_offset.y = Math::round(view_offset.y + ofs.y);
- _update_scroll(0);
+ _update_scrollbars();
viewport->update();
}
void CanvasItemEditor::_button_zoom_minus() {
- _zoom_on_position(zoom / 2.0, viewport_scrollable->get_size() / 2.0);
+ _zoom_on_position(zoom / 1.5, viewport_scrollable->get_size() / 2.0);
}
void CanvasItemEditor::_button_zoom_reset() {
@@ -2957,7 +3410,7 @@ void CanvasItemEditor::_button_zoom_reset() {
}
void CanvasItemEditor::_button_zoom_plus() {
- _zoom_on_position(zoom * 2.0, viewport_scrollable->get_size() / 2.0);
+ _zoom_on_position(zoom * 1.5, viewport_scrollable->get_size() / 2.0);
}
void CanvasItemEditor::_button_toggle_snap(bool p_status) {
@@ -2987,6 +3440,18 @@ void CanvasItemEditor::_popup_callback(int p_op) {
view_menu->get_popup()->set_item_checked(idx, show_grid);
viewport->update();
} break;
+ case SHOW_ORIGIN: {
+ show_origin = !show_origin;
+ int idx = view_menu->get_popup()->get_item_index(SHOW_ORIGIN);
+ view_menu->get_popup()->set_item_checked(idx, show_origin);
+ viewport->update();
+ } break;
+ case SHOW_VIEWPORT: {
+ show_viewport = !show_viewport;
+ int idx = view_menu->get_popup()->get_item_index(SHOW_VIEWPORT);
+ view_menu->get_popup()->set_item_checked(idx, show_viewport);
+ viewport->update();
+ } break;
case SNAP_USE_NODE_PARENT: {
snap_node_parent = !snap_node_parent;
int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_PARENT);
@@ -3240,11 +3705,11 @@ void CanvasItemEditor::_popup_callback(int p_op) {
Node2D *n2d = Object::cast_to<Node2D>(canvas_item);
if (key_pos)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(n2d, "position", n2d->get_position(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(n2d, "position", n2d->get_position(), existing);
if (key_rot)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(n2d, "rotation_degrees", Math::rad2deg(n2d->get_rotation()), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(n2d, "rotation_degrees", Math::rad2deg(n2d->get_rotation()), existing);
if (key_scale)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(n2d, "scale", n2d->get_scale(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(n2d, "scale", n2d->get_scale(), existing);
if (n2d->has_meta("_edit_bone_") && n2d->get_parent_item()) {
//look for an IK chain
@@ -3271,11 +3736,11 @@ void CanvasItemEditor::_popup_callback(int p_op) {
for (List<Node2D *>::Element *F = ik_chain.front(); F; F = F->next()) {
if (key_pos)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(F->get(), "position", F->get()->get_position(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F->get(), "position", F->get()->get_position(), existing);
if (key_rot)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(F->get(), "rotation_degrees", Math::rad2deg(F->get()->get_rotation()), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F->get(), "rotation_degrees", Math::rad2deg(F->get()->get_rotation()), existing);
if (key_scale)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(F->get(), "scale", F->get()->get_scale(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(F->get(), "scale", F->get()->get_scale(), existing);
}
}
}
@@ -3285,11 +3750,11 @@ void CanvasItemEditor::_popup_callback(int p_op) {
Control *ctrl = Object::cast_to<Control>(canvas_item);
if (key_pos)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl, "rect_position", ctrl->get_position(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(ctrl, "rect_position", ctrl->get_position(), existing);
if (key_rot)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl, "rect_rotation", ctrl->get_rotation_degrees(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(ctrl, "rect_rotation", ctrl->get_rotation_degrees(), existing);
if (key_scale)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl, "rect_size", ctrl->get_size(), existing);
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(ctrl, "rect_size", ctrl->get_size(), existing);
}
}
@@ -3385,7 +3850,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
ctrl->set_position(Point2());
/*
if (key_scale)
- AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size());
+ AnimationPlayerEditor::singleton->get_track_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size());
*/
}
}
@@ -3496,7 +3961,12 @@ void CanvasItemEditor::_focus_selection(int p_op) {
//if (!canvas_item->is_visible_in_tree()) continue;
++count;
- Rect2 item_rect = canvas_item->_edit_get_rect();
+ Rect2 item_rect;
+ if (canvas_item->_edit_use_rect()) {
+ item_rect = canvas_item->_edit_get_rect();
+ } else {
+ item_rect = Rect2();
+ }
Vector2 pos = canvas_item->get_global_transform().get_origin();
Vector2 scale = canvas_item->get_global_transform().get_scale();
@@ -3517,8 +3987,10 @@ void CanvasItemEditor::_focus_selection(int p_op) {
center = rect.position + rect.size / 2;
Vector2 offset = viewport->get_size() / 2 - editor->get_scene_root()->get_global_canvas_transform().xform(center);
- h_scroll->set_value(h_scroll->get_value() - offset.x / zoom);
- v_scroll->set_value(v_scroll->get_value() - offset.y / zoom);
+ view_offset.x -= offset.x / zoom;
+ view_offset.y -= offset.y / zoom;
+ _update_scrollbars();
+ viewport->update();
} else { // VIEW_FRAME_TO_SELECTION
@@ -3527,7 +3999,7 @@ void CanvasItemEditor::_focus_selection(int p_op) {
float scale_y = viewport->get_size().y / rect.size.y;
zoom = scale_x < scale_y ? scale_x : scale_y;
zoom *= 0.90;
- _update_scroll(0);
+ viewport->update();
call_deferred("_popup_callback", VIEW_CENTER_TO_SELECTION);
}
}
@@ -3540,6 +4012,7 @@ void CanvasItemEditor::_bind_methods() {
ClassDB::bind_method("_button_zoom_plus", &CanvasItemEditor::_button_zoom_plus);
ClassDB::bind_method("_button_toggle_snap", &CanvasItemEditor::_button_toggle_snap);
ClassDB::bind_method("_update_scroll", &CanvasItemEditor::_update_scroll);
+ ClassDB::bind_method("_update_scrollbars", &CanvasItemEditor::_update_scrollbars);
ClassDB::bind_method("_popup_callback", &CanvasItemEditor::_popup_callback);
ClassDB::bind_method("_get_editor_data", &CanvasItemEditor::_get_editor_data);
ClassDB::bind_method("_button_tool_select", &CanvasItemEditor::_button_tool_select);
@@ -3548,6 +4021,9 @@ void CanvasItemEditor::_bind_methods() {
ClassDB::bind_method("_draw_viewport", &CanvasItemEditor::_draw_viewport);
ClassDB::bind_method("_gui_input_viewport", &CanvasItemEditor::_gui_input_viewport);
ClassDB::bind_method("_snap_changed", &CanvasItemEditor::_snap_changed);
+ ClassDB::bind_method("_update_bone_list", &CanvasItemEditor::_update_bone_list);
+ ClassDB::bind_method("_tree_changed", &CanvasItemEditor::_tree_changed);
+
ClassDB::bind_method(D_METHOD("_selection_result_pressed"), &CanvasItemEditor::_selection_result_pressed);
ClassDB::bind_method(D_METHOD("_selection_menu_hide"), &CanvasItemEditor::_selection_menu_hide);
ClassDB::bind_method(D_METHOD("set_state"), &CanvasItemEditor::set_state);
@@ -3560,7 +4036,7 @@ Dictionary CanvasItemEditor::get_state() const {
Dictionary state;
state["zoom"] = zoom;
- state["ofs"] = Point2(h_scroll->get_value(), v_scroll->get_value());
+ state["ofs"] = view_offset;
state["grid_offset"] = grid_offset;
state["grid_step"] = grid_step;
state["snap_rotation_offset"] = snap_rotation_offset;
@@ -3574,6 +4050,8 @@ Dictionary CanvasItemEditor::get_state() const {
state["snap_grid"] = snap_grid;
state["snap_guides"] = snap_guides;
state["show_grid"] = show_grid;
+ state["show_origin"] = show_origin;
+ state["show_viewport"] = show_viewport;
state["show_rulers"] = show_rulers;
state["show_guides"] = show_guides;
state["show_helpers"] = show_helpers;
@@ -3592,10 +4070,9 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
}
if (state.has("ofs")) {
- _update_scrollbars(); // i wonder how safe is calling this here..
- Point2 ofs = p_state["ofs"];
- h_scroll->set_value(ofs.x);
- v_scroll->set_value(ofs.y);
+ view_offset = p_state["ofs"];
+ previous_update_view_offset = view_offset;
+ _update_scrollbars();
}
if (state.has("grid_offset")) {
@@ -3667,6 +4144,18 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
view_menu->get_popup()->set_item_checked(idx, show_grid);
}
+ if (state.has("show_origin")) {
+ show_origin = state["show_origin"];
+ int idx = view_menu->get_popup()->get_item_index(SHOW_ORIGIN);
+ view_menu->get_popup()->set_item_checked(idx, show_origin);
+ }
+
+ if (state.has("show_viewport")) {
+ show_viewport = state["show_viewport"];
+ int idx = view_menu->get_popup()->get_item_index(SHOW_VIEWPORT);
+ view_menu->get_popup()->set_item_checked(idx, show_viewport);
+ }
+
if (state.has("show_rulers")) {
show_rulers = state["show_rulers"];
int idx = view_menu->get_popup()->get_item_index(SHOW_RULERS);
@@ -3738,6 +4227,7 @@ void CanvasItemEditor::focus_selection() {
CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
+ bone_list_dirty = false;
tool = TOOL_SELECT;
undo_redo = p_editor->get_undo_redo();
editor = p_editor;
@@ -3763,6 +4253,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
viewport_scrollable->set_clip_contents(true);
viewport_scrollable->set_v_size_flags(SIZE_EXPAND_FILL);
viewport_scrollable->set_h_size_flags(SIZE_EXPAND_FILL);
+ viewport_scrollable->connect("draw", this, "_update_scrollbars");
ViewportContainer *scene_tree = memnew(ViewportContainer);
viewport_scrollable->add_child(scene_tree);
@@ -3781,12 +4272,12 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
h_scroll = memnew(HScrollBar);
viewport->add_child(h_scroll);
- h_scroll->connect("value_changed", this, "_update_scroll", Vector<Variant>(), Object::CONNECT_DEFERRED);
+ h_scroll->connect("value_changed", this, "_update_scroll");
h_scroll->hide();
v_scroll = memnew(VScrollBar);
viewport->add_child(v_scroll);
- v_scroll->connect("value_changed", this, "_update_scroll", Vector<Variant>(), Object::CONNECT_DEFERRED);
+ v_scroll->connect("value_changed", this, "_update_scroll");
v_scroll->hide();
zoom_hb = memnew(HBoxContainer);
@@ -3796,20 +4287,22 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
zoom_minus = memnew(ToolButton);
zoom_hb->add_child(zoom_minus);
zoom_minus->connect("pressed", this, "_button_zoom_minus");
+ zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom out"), KEY_MASK_CMD | KEY_MINUS));
zoom_minus->set_focus_mode(FOCUS_NONE);
zoom_reset = memnew(ToolButton);
zoom_hb->add_child(zoom_reset);
zoom_reset->connect("pressed", this, "_button_zoom_reset");
+ zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom reset"), KEY_MASK_CMD | KEY_0));
zoom_reset->set_focus_mode(FOCUS_NONE);
zoom_plus = memnew(ToolButton);
zoom_hb->add_child(zoom_plus);
zoom_plus->connect("pressed", this, "_button_zoom_plus");
+ zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom in"), KEY_MASK_CMD | KEY_PLUS));
zoom_plus->set_focus_mode(FOCUS_NONE);
updating_scroll = false;
- first_update = true;
select_button = memnew(ToolButton);
hb->add_child(select_button);
@@ -3859,13 +4352,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb->add_child(snap_button);
snap_button->set_toggle_mode(true);
snap_button->connect("toggled", this, "_button_toggle_snap");
- snap_button->set_tooltip(TTR("Toggles snapping"));
- snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap"), KEY_S));
+ snap_button->set_tooltip(TTR("Toggle snapping."));
+ snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap"), KEY_MASK_SHIFT | KEY_S));
snap_config_menu = memnew(MenuButton);
hb->add_child(snap_config_menu);
snap_config_menu->set_h_size_flags(SIZE_SHRINK_END);
- snap_config_menu->set_tooltip(TTR("Snapping options"));
+ snap_config_menu->set_tooltip(TTR("Snapping Options"));
PopupMenu *p = snap_config_menu->get_popup();
p->connect("id_pressed", this, "_popup_callback");
@@ -3919,13 +4412,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p = skeleton_menu->get_popup();
p->set_hide_on_checkable_item_selection(false);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES);
- p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES);
- p->add_separator();
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_show_bones", TTR("Show Bones")), SKELETON_SHOW_BONES);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN);
+ p->add_separator();
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Custom Bone(s) from Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Custom Bones")), SKELETON_CLEAR_BONES);
p->connect("id_pressed", this, "_popup_callback");
hb->add_child(memnew(VSeparator));
@@ -3940,6 +4433,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), KEY_H), SHOW_HELPERS);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers"), KEY_R), SHOW_RULERS);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), KEY_Y), SHOW_GUIDES);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_origin", TTR("Show Origin")), SHOW_ORIGIN);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_viewport", TTR("Show Viewport")), SHOW_VIEWPORT);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION);
@@ -4025,10 +4520,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
key_scale = false;
show_grid = false;
+ show_origin = true;
+ show_viewport = true;
show_helpers = false;
show_rulers = true;
show_guides = true;
zoom = 1;
+ view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH);
+ previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
grid_offset = Point2();
grid_step = Point2(10, 10);
grid_step_multiplier = 0;
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index adf203cf3d..adc4010f39 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -100,6 +100,8 @@ class CanvasItemEditor : public VBoxContainer {
SHOW_HELPERS,
SHOW_RULERS,
SHOW_GUIDES,
+ SHOW_ORIGIN,
+ SHOW_VIEWPORT,
LOCK_SELECTED,
UNLOCK_SELECTED,
GROUP_SELECTED,
@@ -192,14 +194,14 @@ class CanvasItemEditor : public VBoxContainer {
DRAG_V_GUIDE,
DRAG_H_GUIDE,
DRAG_DOUBLE_GUIDE,
- DRAG_KEY_MOVE
+ DRAG_KEY_MOVE,
+ DRAG_PAN
};
EditorSelection *editor_selection;
bool selection_menu_additive_selection;
Tool tool;
- bool first_update;
Control *viewport;
Control *viewport_scrollable;
@@ -215,8 +217,12 @@ class CanvasItemEditor : public VBoxContainer {
bool show_grid;
bool show_rulers;
bool show_guides;
+ bool show_origin;
+ bool show_viewport;
bool show_helpers;
float zoom;
+ Point2 view_offset;
+ Point2 previous_update_view_offset;
Point2 grid_offset;
Point2 grid_step;
@@ -251,18 +257,37 @@ class CanvasItemEditor : public VBoxContainer {
return has_z && p_rr.has_z ? p_rr.z_index < z_index : p_rr.has_z;
}
};
-
Vector<_SelectResult> selection_results;
+ struct _HoverResult {
+
+ Point2 position;
+ Ref<Texture> icon;
+ String name;
+ };
+ Vector<_HoverResult> hovering_results;
+
struct BoneList {
Transform2D xform;
- Vector2 from;
- Vector2 to;
+ float length;
uint64_t last_pass;
};
+
uint64_t bone_last_frame;
- Map<ObjectID, BoneList> bone_list;
+
+ struct BoneKey {
+ ObjectID from;
+ ObjectID to;
+ _FORCE_INLINE_ bool operator<(const BoneKey &p_key) const {
+ if (from == p_key.from)
+ return to < p_key.to;
+ else
+ return from < p_key.from;
+ }
+ };
+
+ Map<BoneKey, BoneList> bone_list;
struct PoseClipboard {
Vector2 pos;
@@ -330,8 +355,11 @@ class CanvasItemEditor : public VBoxContainer {
Ref<ShortCut> multiply_grid_step_shortcut;
Ref<ShortCut> divide_grid_step_shortcut;
- void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, int limit = 0, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
- void _find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_node, List<CanvasItem *> *r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
+ void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<_SelectResult> &r_items, int p_limit = 0, 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, int p_limit = 0);
+ void _get_bones_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items);
+
+ void _find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_node, List<CanvasItem *> *r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
bool _select_click_on_item(CanvasItem *item, Point2 p_click_pos, bool p_append);
ConfirmationDialog *snap_dialog;
@@ -357,12 +385,13 @@ class CanvasItemEditor : public VBoxContainer {
void _selection_menu_hide();
UndoRedo *undo_redo;
- void _build_bones_list(Node *p_node);
+ bool _build_bones_list(Node *p_node);
+ bool _get_bone_shape(Vector<Vector2> *shape, Vector<Vector2> *outline_shape, Map<BoneKey, BoneList>::Element *bone);
List<CanvasItem *> _get_edited_canvas_items(bool retreive_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
- void _expand_encompassing_rect_using_children(Rect2 &p_rect, Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
- Rect2 _get_scene_encompassing_rect();
+ void _expand_encompassing_rect_using_children(Rect2 &p_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
+ Rect2 _get_encompassing_rect(const Node *p_node);
Object *_get_editor_data(Object *p_what);
@@ -382,7 +411,9 @@ class CanvasItemEditor : public VBoxContainer {
void _draw_selection();
void _draw_axis();
void _draw_bones();
- void _draw_locks_and_groups(Node *p_node, const Transform2D &p_xform);
+ void _draw_invisible_nodes_positions(Node *p_node, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
+ void _draw_locks_and_groups(Node *p_node, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());
+ void _draw_hover();
void _draw_viewport();
@@ -395,6 +426,7 @@ class CanvasItemEditor : public VBoxContainer {
bool _gui_input_select(const Ref<InputEvent> &p_event);
bool _gui_input_zoom_or_pan(const Ref<InputEvent> &p_event);
bool _gui_input_rulers_and_guides(const Ref<InputEvent> &p_event);
+ bool _gui_input_hover(const Ref<InputEvent> &p_event);
void _gui_input_viewport(const Ref<InputEvent> &p_event);
@@ -421,6 +453,11 @@ class CanvasItemEditor : public VBoxContainer {
HSplitContainer *palette_split;
VSplitContainer *bottom_split;
+ bool bone_list_dirty;
+ void _queue_update_bone_list();
+ void _update_bone_list();
+ void _tree_changed(Node *);
+
friend class CanvasItemEditorPlugin;
protected:
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index b624d69810..672337ba2f 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -42,6 +42,7 @@ void CollisionPolygon2DEditor::_set_node(Node *p_polygon) {
CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
+ node = NULL;
}
CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index 4410242d9c..e837359d0c 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -33,10 +33,12 @@
#include "canvas_item_editor_plugin.h"
#include "editor/editor_settings.h"
#include "os/file_access.h"
+#include "os/input.h"
+#include "os/keyboard.h"
#include "scene/3d/camera.h"
#include "spatial_editor_plugin.h"
-void CollisionPolygonEditor::_notification(int p_what) {
+void Polygon3DEditor::_notification(int p_what) {
switch (p_what) {
@@ -53,15 +55,15 @@ void CollisionPolygonEditor::_notification(int p_what) {
return;
}
- if (node->get_depth() != prev_depth) {
+ if (_get_depth() != prev_depth) {
_polygon_draw();
- prev_depth = node->get_depth();
+ prev_depth = _get_depth();
}
} break;
}
}
-void CollisionPolygonEditor::_node_removed(Node *p_node) {
+void Polygon3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
node = NULL;
@@ -72,7 +74,7 @@ void CollisionPolygonEditor::_node_removed(Node *p_node) {
}
}
-void CollisionPolygonEditor::_menu_option(int p_option) {
+void Polygon3DEditor::_menu_option(int p_option) {
switch (p_option) {
@@ -91,10 +93,10 @@ void CollisionPolygonEditor::_menu_option(int p_option) {
}
}
-void CollisionPolygonEditor::_wip_close() {
+void Polygon3DEditor::_wip_close() {
undo_redo->create_action(TTR("Create Poly3D"));
- undo_redo->add_undo_method(node, "set_polygon", node->get_polygon());
+ undo_redo->add_undo_method(node, "set_polygon", node->call("get_polygon"));
undo_redo->add_do_method(node, "set_polygon", wip);
undo_redo->add_do_method(this, "_polygon_draw");
undo_redo->add_undo_method(this, "_polygon_draw");
@@ -107,14 +109,14 @@ void CollisionPolygonEditor::_wip_close() {
undo_redo->commit_action();
}
-bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
+bool Polygon3DEditor::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
if (!node)
return false;
Transform gt = node->get_global_transform();
Transform gi = gt.affine_inverse();
- float depth = node->get_depth() * 0.5;
+ float depth = _get_depth() * 0.5;
Vector3 n = gt.basis.get_axis(2).normalized();
Plane p(gt.origin + n * depth, n);
@@ -135,9 +137,11 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
Vector2 cpoint(spoint.x, spoint.y);
- cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint);
+ //DO NOT snap here, it's confusing in 3D for adding points.
+ //Let the snap happen when the point is being moved, instead.
+ //cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint);
- Vector<Vector2> poly = node->get_polygon();
+ Vector<Vector2> poly = node->call("get_polygon");
//first check if a point is to be added (segment split)
real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
@@ -154,6 +158,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
wip.push_back(cpoint);
wip_active = true;
edited_point_pos = cpoint;
+ snap_ignore = false;
_polygon_draw();
edited_point = 1;
return true;
@@ -168,6 +173,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
wip.push_back(cpoint);
edited_point = wip.size();
+ snap_ignore = false;
_polygon_draw();
return true;
}
@@ -226,8 +232,10 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
poly.insert(closest_idx + 1, cpoint);
edited_point = closest_idx + 1;
edited_point_pos = cpoint;
- node->set_polygon(poly);
+ node->call("set_polygon", poly);
_polygon_draw();
+ snap_ignore = true;
+
return true;
}
} else {
@@ -255,11 +263,14 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
edited_point = closest_idx;
edited_point_pos = poly[closest_idx];
_polygon_draw();
+ snap_ignore = false;
return true;
}
}
} else {
+ snap_ignore = false;
+
if (edited_point != -1) {
//apply
@@ -315,7 +326,6 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
-
if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
Vector2 gpoint = mm->get_position();
@@ -332,7 +342,13 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
Vector2 cpoint(spoint.x, spoint.y);
- cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint);
+ if (snap_ignore && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
+ snap_ignore = false;
+ }
+
+ if (!snap_ignore) {
+ cpoint = CanvasItemEditor::get_singleton()->snap_point(cpoint);
+ }
edited_point_pos = cpoint;
_polygon_draw();
@@ -341,7 +357,16 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera *p_camera, const R
return false;
}
-void CollisionPolygonEditor::_polygon_draw() {
+
+float Polygon3DEditor::_get_depth() {
+
+ if (bool(node->call("_has_editable_3d_polygon_no_depth")))
+ return 0;
+
+ return float(node->call("get_depth"));
+}
+
+void Polygon3DEditor::_polygon_draw() {
if (!node)
return;
@@ -351,9 +376,9 @@ void CollisionPolygonEditor::_polygon_draw() {
if (wip_active)
poly = wip;
else
- poly = node->get_polygon();
+ poly = node->call("get_polygon");
- float depth = node->get_depth() * 0.5;
+ float depth = _get_depth() * 0.5;
imgeom->clear();
imgeom->set_material_override(line_material);
@@ -464,13 +489,13 @@ void CollisionPolygonEditor::_polygon_draw() {
m->surface_set_material(0, handle_material);
}
-void CollisionPolygonEditor::edit(Node *p_collision_polygon) {
+void Polygon3DEditor::edit(Node *p_collision_polygon) {
if (p_collision_polygon) {
- node = Object::cast_to<CollisionPolygon>(p_collision_polygon);
+ node = Object::cast_to<Spatial>(p_collision_polygon);
//Enable the pencil tool if the polygon is empty
- if (node->get_polygon().size() == 0) {
+ if (Vector<Vector2>(node->call("get_polygon")).size() == 0) {
_menu_option(MODE_CREATE);
}
wip.clear();
@@ -491,14 +516,14 @@ void CollisionPolygonEditor::edit(Node *p_collision_polygon) {
}
}
-void CollisionPolygonEditor::_bind_methods() {
+void Polygon3DEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_menu_option"), &CollisionPolygonEditor::_menu_option);
- ClassDB::bind_method(D_METHOD("_polygon_draw"), &CollisionPolygonEditor::_polygon_draw);
- ClassDB::bind_method(D_METHOD("_node_removed"), &CollisionPolygonEditor::_node_removed);
+ ClassDB::bind_method(D_METHOD("_menu_option"), &Polygon3DEditor::_menu_option);
+ ClassDB::bind_method(D_METHOD("_polygon_draw"), &Polygon3DEditor::_polygon_draw);
+ ClassDB::bind_method(D_METHOD("_node_removed"), &Polygon3DEditor::_node_removed);
}
-CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) {
+Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
node = NULL;
editor = p_editor;
@@ -543,24 +568,26 @@ CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) {
m.instance();
pointsm->set_mesh(m);
pointsm->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
+
+ snap_ignore = false;
}
-CollisionPolygonEditor::~CollisionPolygonEditor() {
+Polygon3DEditor::~Polygon3DEditor() {
memdelete(imgeom);
}
-void CollisionPolygonEditorPlugin::edit(Object *p_object) {
+void Polygon3DEditorPlugin::edit(Object *p_object) {
collision_polygon_editor->edit(Object::cast_to<Node>(p_object));
}
-bool CollisionPolygonEditorPlugin::handles(Object *p_object) const {
+bool Polygon3DEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("CollisionPolygon");
+ return Object::cast_to<Spatial>(p_object) && bool(p_object->call("_is_editable_3d_polygon"));
}
-void CollisionPolygonEditorPlugin::make_visible(bool p_visible) {
+void Polygon3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
collision_polygon_editor->show();
@@ -571,14 +598,14 @@ void CollisionPolygonEditorPlugin::make_visible(bool p_visible) {
}
}
-CollisionPolygonEditorPlugin::CollisionPolygonEditorPlugin(EditorNode *p_node) {
+Polygon3DEditorPlugin::Polygon3DEditorPlugin(EditorNode *p_node) {
editor = p_node;
- collision_polygon_editor = memnew(CollisionPolygonEditor(p_node));
+ collision_polygon_editor = memnew(Polygon3DEditor(p_node));
SpatialEditor::get_singleton()->add_control_to_menu_panel(collision_polygon_editor);
collision_polygon_editor->hide();
}
-CollisionPolygonEditorPlugin::~CollisionPolygonEditorPlugin() {
+Polygon3DEditorPlugin::~Polygon3DEditorPlugin() {
}
diff --git a/editor/plugins/collision_polygon_editor_plugin.h b/editor/plugins/collision_polygon_editor_plugin.h
index f1f215b092..4229808e2f 100644
--- a/editor/plugins/collision_polygon_editor_plugin.h
+++ b/editor/plugins/collision_polygon_editor_plugin.h
@@ -44,9 +44,9 @@
class CanvasItemEditor;
-class CollisionPolygonEditor : public HBoxContainer {
+class Polygon3DEditor : public HBoxContainer {
- GDCLASS(CollisionPolygonEditor, HBoxContainer);
+ GDCLASS(Polygon3DEditor, HBoxContainer);
UndoRedo *undo_redo;
enum Mode {
@@ -66,7 +66,7 @@ class CollisionPolygonEditor : public HBoxContainer {
EditorNode *editor;
Panel *panel;
- CollisionPolygon *node;
+ Spatial *node;
ImmediateGeometry *imgeom;
MeshInstance *pointsm;
Ref<ArrayMesh> m;
@@ -78,6 +78,7 @@ class CollisionPolygonEditor : public HBoxContainer {
Vector<Vector2> pre_move_edit;
Vector<Vector2> wip;
bool wip_active;
+ bool snap_ignore;
float prev_depth;
@@ -85,6 +86,8 @@ class CollisionPolygonEditor : public HBoxContainer {
void _polygon_draw();
void _menu_option(int p_option);
+ float _get_depth();
+
protected:
void _notification(int p_what);
void _node_removed(Node *p_node);
@@ -93,28 +96,28 @@ protected:
public:
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
- CollisionPolygonEditor(EditorNode *p_editor);
- ~CollisionPolygonEditor();
+ Polygon3DEditor(EditorNode *p_editor);
+ ~Polygon3DEditor();
};
-class CollisionPolygonEditorPlugin : public EditorPlugin {
+class Polygon3DEditorPlugin : public EditorPlugin {
- GDCLASS(CollisionPolygonEditorPlugin, EditorPlugin);
+ GDCLASS(Polygon3DEditorPlugin, EditorPlugin);
- CollisionPolygonEditor *collision_polygon_editor;
+ Polygon3DEditor *collision_polygon_editor;
EditorNode *editor;
public:
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_spatial_gui_input(p_camera, p_event); }
- virtual String get_name() const { return "CollisionPolygon"; }
+ virtual String get_name() const { return "Polygon3DEditor"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
- CollisionPolygonEditorPlugin(EditorNode *p_node);
- ~CollisionPolygonEditorPlugin();
+ Polygon3DEditorPlugin(EditorNode *p_node);
+ ~Polygon3DEditorPlugin();
};
#endif // COLLISION_POLYGON_EDITOR_PLUGIN_H
diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp
index 81f45b9f55..68d5ea5247 100644
--- a/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -198,7 +198,7 @@ void MeshLibraryEditor::_menu_cbk(int p_option) {
} break;
case MENU_OPTION_REMOVE_ITEM: {
- String p = editor->get_property_editor()->get_selected_path();
+ String p = editor->get_inspector()->get_selected_path();
if (p.begins_with("/MeshLibrary/item") && p.get_slice_count("/") >= 3) {
to_erase = p.get_slice("/", 3).to_int();
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 7c49408c35..49c54ad67d 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -91,7 +91,7 @@ void CurveEditor::set_curve(Ref<Curve> curve) {
}
Size2 CurveEditor::get_minimum_size() const {
- return Vector2(64, 64);
+ return Vector2(64, 150) * EDSCALE;
}
void CurveEditor::_notification(int p_what) {
@@ -639,7 +639,7 @@ void CurveEditor::_draw() {
Ref<Font> font = get_font("font", "Label");
float font_height = font->get_height();
- const Color text_color = get_color("font_color", "Editor");
+ Color text_color = get_color("font_color", "Editor");
{
// X axis
@@ -720,6 +720,7 @@ void CurveEditor::_draw() {
// Help text
if (_selected_point > 0 && _selected_point + 1 < curve.get_point_count()) {
+ text_color.a *= 0.4;
draw_string(font, Vector2(50, font_height), TTR("Hold Shift to edit tangents individually"), text_color);
}
}
@@ -750,87 +751,28 @@ void CurveEditor::_bind_methods() {
//---------------
-CurveEditorPlugin::CurveEditorPlugin(EditorNode *p_node) {
- _editor_node = p_node;
-
- _view = memnew(CurveEditor);
- _view->set_custom_minimum_size(Size2(100, 128 * EDSCALE));
- _view->hide();
-
- _toggle_button = _editor_node->add_bottom_panel_item(get_name(), _view);
- _toggle_button->hide();
-
- get_editor_interface()->get_resource_previewer()->add_preview_generator(memnew(CurvePreviewGenerator));
-}
-
-CurveEditorPlugin::~CurveEditorPlugin() {
-}
-
-void CurveEditorPlugin::edit(Object *p_object) {
-
- Ref<Curve> curve_ref;
-
- if (_current_ref.is_valid()) {
- CurveTexture *ct = Object::cast_to<CurveTexture>(*_current_ref);
- if (ct)
- ct->disconnect(CoreStringNames::get_singleton()->changed, this, "_curve_texture_changed");
- }
-
- if (p_object) {
- Resource *res = Object::cast_to<Resource>(p_object);
- ERR_FAIL_COND(res == NULL);
- ERR_FAIL_COND(!handles(p_object));
-
- _current_ref = Ref<Resource>(Object::cast_to<Resource>(p_object));
-
- if (_current_ref.is_valid()) {
- Curve *curve = Object::cast_to<Curve>(*_current_ref);
- if (curve)
- curve_ref = Ref<Curve>(curve);
- else {
- CurveTexture *ct = Object::cast_to<CurveTexture>(*_current_ref);
- if (ct) {
- ct->connect(CoreStringNames::get_singleton()->changed, this, "_curve_texture_changed");
- curve_ref = ct->get_curve();
- }
- }
- }
+bool EditorInspectorPluginCurve::can_handle(Object *p_object) {
- } else {
- _current_ref = Ref<Resource>();
- }
-
- _view->set_curve(curve_ref);
+ return Object::cast_to<Curve>(p_object) != NULL;
}
-bool CurveEditorPlugin::handles(Object *p_object) const {
- // Both handled so that we can keep the curve editor open
- return Object::cast_to<Curve>(p_object) || Object::cast_to<CurveTexture>(p_object);
-}
+void EditorInspectorPluginCurve::parse_begin(Object *p_object) {
-void CurveEditorPlugin::make_visible(bool p_visible) {
- if (p_visible) {
- _toggle_button->show();
- _editor_node->make_bottom_panel_item_visible(_view);
- } else {
- _toggle_button->hide();
- if (_view->is_visible_in_tree())
- _editor_node->hide_bottom_panel();
- }
-}
+ Curve *curve = Object::cast_to<Curve>(p_object);
+ ERR_FAIL_COND(!curve);
+ Ref<Curve> c(curve);
-void CurveEditorPlugin::_curve_texture_changed() {
- // If the curve is shown indirectly as a CurveTexture is edited,
- // we need to monitor when the curve property gets assigned
- CurveTexture *ct = Object::cast_to<CurveTexture>(*_current_ref);
- if (ct) {
- _view->set_curve(ct->get_curve());
- }
+ CurveEditor *editor = memnew(CurveEditor);
+ editor->set_curve(curve);
+ add_custom_control(editor);
}
-void CurveEditorPlugin::_bind_methods() {
+CurveEditorPlugin::CurveEditorPlugin(EditorNode *p_node) {
+ Ref<EditorInspectorPluginCurve> curve_plugin;
+ curve_plugin.instance();
+ EditorInspector::add_inspector_plugin(curve_plugin);
- ClassDB::bind_method(D_METHOD("_curve_texture_changed"), &CurveEditorPlugin::_curve_texture_changed);
+ get_editor_interface()->get_resource_previewer()->add_preview_generator(memnew(CurvePreviewGenerator));
}
//-----------------------------------
@@ -852,13 +794,13 @@ Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from) {
img_ref.instance();
Image &im = **img_ref;
- im.create(thumbnail_size, thumbnail_size, 0, Image::FORMAT_RGBA8);
+ im.create(thumbnail_size, thumbnail_size / 2, 0, Image::FORMAT_RGBA8);
im.lock();
Color bg_color(0.1, 0.1, 0.1, 1.0);
for (int i = 0; i < thumbnail_size; i++) {
- for (int j = 0; j < thumbnail_size; j++) {
+ for (int j = 0; j < thumbnail_size / 2; j++) {
im.set_pixel(i, j, bg_color);
}
}
diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h
index 97f1ba2fa1..255f359ed2 100644
--- a/editor/plugins/curve_editor_plugin.h
+++ b/editor/plugins/curve_editor_plugin.h
@@ -119,28 +119,19 @@ private:
float _tangents_length;
};
+class EditorInspectorPluginCurve : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorPluginCurve, EditorInspectorPlugin)
+public:
+ virtual bool can_handle(Object *p_object);
+ virtual void parse_begin(Object *p_object);
+};
+
class CurveEditorPlugin : public EditorPlugin {
GDCLASS(CurveEditorPlugin, EditorPlugin)
public:
CurveEditorPlugin(EditorNode *p_node);
- ~CurveEditorPlugin();
String get_name() const { return "Curve"; }
- bool has_main_screen() const { return false; }
- void edit(Object *p_object);
- bool handles(Object *p_object) const;
- void make_visible(bool p_visible);
-
-private:
- static void _bind_methods();
-
- void _curve_texture_changed();
-
-private:
- CurveEditor *_view;
- Ref<Resource> _current_ref;
- EditorNode *_editor_node;
- ToolButton *_toggle_button;
};
class CurvePreviewGenerator : public EditorResourcePreviewGenerator {
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 47d730cdf1..0d25b3685a 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -37,10 +37,11 @@
#include "io/resource_loader.h"
#include "os/os.h"
#include "scene/resources/bit_mask.h"
+#include "scene/resources/dynamic_font.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
-static void post_process_preview(Ref<Image> p_image) {
+void post_process_preview(Ref<Image> p_image) {
if (p_image->get_format() != Image::FORMAT_RGBA8)
p_image->convert(Image::FORMAT_RGBA8);
@@ -96,6 +97,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from) {
if (img.is_null() || img->empty())
return Ref<Texture>();
+ img = img->duplicate();
img->clear_mipmaps();
int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
@@ -467,15 +469,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) {
Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color");
Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color");
- if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") {
- Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme();
-
- bg_color = tm->get_color("text_editor/highlighting/background_color", "Editor");
- keyword_color = tm->get_color("text_editor/highlighting/keyword_color", "Editor");
- text_color = tm->get_color("text_editor/highlighting/text_color", "Editor");
- symbol_color = tm->get_color("text_editor/highlighting/symbol_color", "Editor");
- }
-
img->lock();
if (bg_color.a == 0)
@@ -561,274 +554,92 @@ EditorScriptPreviewPlugin::EditorScriptPreviewPlugin() {
}
///////////////////////////////////////////////////////////////////
-// FIXME: Needs to be rewritten for AudioStream in Godot 3.0+
-#if 0
-bool EditorSamplePreviewPlugin::handles(const String& p_type) const {
+bool EditorAudioStreamPreviewPlugin::handles(const String &p_type) const {
- return ClassDB::is_parent_class(p_type,"Sample");
+ return ClassDB::is_parent_class(p_type, "AudioStream");
}
-Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
-
- Ref<Sample> smp =p_from;
- ERR_FAIL_COND_V(smp.is_null(),Ref<Texture>());
+Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from) {
+ Ref<AudioStream> stream = p_from;
+ ERR_FAIL_COND_V(stream.is_null(), Ref<Texture>());
int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size*=EDSCALE;
+ thumbnail_size *= EDSCALE;
PoolVector<uint8_t> img;
int w = thumbnail_size;
int h = thumbnail_size;
- img.resize(w*h*3);
+ img.resize(w * h * 3);
PoolVector<uint8_t>::Write imgdata = img.write();
- uint8_t * imgw = imgdata.ptr();
- PoolVector<uint8_t> data = smp->get_data();
- PoolVector<uint8_t>::Read sampledata = data.read();
- const uint8_t *sdata=sampledata.ptr();
-
- bool stereo = smp->is_stereo();
- bool _16=smp->get_format()==Sample::FORMAT_PCM16;
- int len = smp->get_length();
+ uint8_t *imgw = imgdata.ptr();
- if (len<1)
- return Ref<Texture>();
+ Ref<AudioStreamPlayback> playback = stream->instance_playback();
- if (smp->get_format()==Sample::FORMAT_IMA_ADPCM) {
-
- struct IMA_ADPCM_State {
-
- int16_t step_index;
- int32_t predictor;
- /* values at loop point */
- int16_t loop_step_index;
- int32_t loop_predictor;
- int32_t last_nibble;
- int32_t loop_pos;
- int32_t window_ofs;
- const uint8_t *ptr;
- } ima_adpcm;
-
- ima_adpcm.step_index=0;
- ima_adpcm.predictor=0;
- ima_adpcm.loop_step_index=0;
- ima_adpcm.loop_predictor=0;
- ima_adpcm.last_nibble=-1;
- ima_adpcm.loop_pos=0x7FFFFFFF;
- ima_adpcm.window_ofs=0;
- ima_adpcm.ptr=NULL;
-
-
- for(int i=0;i<w;i++) {
-
- float max[2]={-1e10,-1e10};
- float min[2]={1e10,1e10};
- int from = i*len/w;
- int to = (i+1)*len/w;
- if (to>=len)
- to=len-1;
-
- for(int j=from;j<to;j++) {
-
- while(j>ima_adpcm.last_nibble) {
-
- static const int16_t _ima_adpcm_step_table[89] = {
- 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
- 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
- 50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
- 130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
- 337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
- 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
- 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
- 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
- 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
- };
-
- static const int8_t _ima_adpcm_index_table[16] = {
- -1, -1, -1, -1, 2, 4, 6, 8,
- -1, -1, -1, -1, 2, 4, 6, 8
- };
-
- int16_t nibble,diff,step;
-
- ima_adpcm.last_nibble++;
- const uint8_t *src_ptr=sdata;
-
- int ofs = ima_adpcm.last_nibble>>1;
-
- if (stereo)
- ofs*=2;
-
-
- nibble = (ima_adpcm.last_nibble&1)?
- (src_ptr[ofs]>>4):(src_ptr[ofs]&0xF);
- step=_ima_adpcm_step_table[ima_adpcm.step_index];
-
- ima_adpcm.step_index += _ima_adpcm_index_table[nibble];
- if (ima_adpcm.step_index<0)
- ima_adpcm.step_index=0;
- if (ima_adpcm.step_index>88)
- ima_adpcm.step_index=88;
-
- diff = step >> 3 ;
- if (nibble & 1)
- diff += step >> 2 ;
- if (nibble & 2)
- diff += step >> 1 ;
- if (nibble & 4)
- diff += step ;
- if (nibble & 8)
- diff = -diff ;
-
- ima_adpcm.predictor+=diff;
- if (ima_adpcm.predictor<-0x8000)
- ima_adpcm.predictor=-0x8000;
- else if (ima_adpcm.predictor>0x7FFF)
- ima_adpcm.predictor=0x7FFF;
-
-
- /* store loop if there */
- if (ima_adpcm.last_nibble==ima_adpcm.loop_pos) {
-
- ima_adpcm.loop_step_index = ima_adpcm.step_index;
- ima_adpcm.loop_predictor = ima_adpcm.predictor;
- }
+ float len_s = stream->get_length();
+ if (len_s == 0) {
+ len_s = 60; //one minute audio if no length specified
+ }
+ int frame_length = AudioServer::get_singleton()->get_mix_rate() * len_s;
- }
+ Vector<AudioFrame> frames;
+ frames.resize(frame_length);
- float v=ima_adpcm.predictor/32767.0;
- if (v>max[0])
- max[0]=v;
- if (v<min[0])
- min[0]=v;
- }
- max[0]*=0.8;
- min[0]*=0.8;
-
- for(int j=0;j<h;j++) {
- float v = (j/(float)h) * 2.0 - 1.0;
- uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3];
- if (v>min[0] && v<max[0]) {
- imgofs[0]=255;
- imgofs[1]=150;
- imgofs[2]=80;
- } else {
- imgofs[0]=0;
- imgofs[1]=0;
- imgofs[2]=0;
- }
- }
- }
- } else {
- for(int i=0;i<w;i++) {
- // i trust gcc will optimize this loop
- float max[2]={-1e10,-1e10};
- float min[2]={1e10,1e10};
- int c=stereo?2:1;
- int from = uint64_t(i)*len/w;
- int to = (uint64_t(i)+1)*len/w;
- if (to>=len)
- to=len-1;
-
- if (_16) {
- const int16_t*src =(const int16_t*)sdata;
-
- for(int j=0;j<c;j++) {
-
- for(int k=from;k<=to;k++) {
-
- float v = src[uint64_t(k)*c+j]/32768.0;
- if (v>max[j])
- max[j]=v;
- if (v<min[j])
- min[j]=v;
- }
+ playback->start();
+ playback->mix(frames.ptrw(), 1, frames.size());
+ playback->stop();
- }
- } else {
+ for (int i = 0; i < w; i++) {
- const int8_t*src =(const int8_t*)sdata;
+ float max = -1000;
+ float min = 1000;
+ int from = uint64_t(i) * frame_length / w;
+ int to = uint64_t(i + 1) * frame_length / w;
+ to = MIN(to, frame_length);
+ from = MIN(from, frame_length - 1);
+ if (to == from) {
+ to = from + 1;
+ }
- for(int j=0;j<c;j++) {
+ for (int j = from; j < to; j++) {
- for(int k=from;k<=to;k++) {
+ max = MAX(max, frames[j].l);
+ max = MAX(max, frames[j].r);
- float v = src[uint64_t(k)*c+j]/128.0;
- if (v>max[j])
- max[j]=v;
- if (v<min[j])
- min[j]=v;
- }
+ min = MIN(min, frames[j].l);
+ min = MIN(min, frames[j].r);
+ }
- }
- }
+ int pfrom = CLAMP((min * 0.5 + 0.5) * h / 2, 0, h / 2) + h / 4;
+ int pto = CLAMP((max * 0.5 + 0.5) * h / 2, 0, h / 2) + h / 4;
- max[0]*=0.8;
- max[1]*=0.8;
- min[0]*=0.8;
- min[1]*=0.8;
-
- if (!stereo) {
- for(int j=0;j<h;j++) {
- float v = (j/(float)h) * 2.0 - 1.0;
- uint8_t* imgofs = &imgw[(j*w+i)*3];
- if (v>min[0] && v<max[0]) {
- imgofs[0]=255;
- imgofs[1]=150;
- imgofs[2]=80;
- } else {
- imgofs[0]=0;
- imgofs[1]=0;
- imgofs[2]=0;
- }
- }
+ for (int j = 0; j < h; j++) {
+ uint8_t *p = &imgw[(j * w + i) * 3];
+ if (j < pfrom || j > pto) {
+ p[0] = 100;
+ p[1] = 100;
+ p[2] = 100;
} else {
-
- for(int j=0;j<h;j++) {
-
- int half;
- float v;
- if (j<(h/2)) {
- half=0;
- v = (j/(float)(h/2)) * 2.0 - 1.0;
- } else {
- half=1;
- if( (float)(h/2) != 0 ) {
- v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0;
- } else {
- v = ((j-(h/2))/(float)(1/2)) * 2.0 - 1.0;
- }
- }
-
- uint8_t* imgofs = &imgw[(j*w+i)*3];
- if (v>min[half] && v<max[half]) {
- imgofs[0]=255;
- imgofs[1]=150;
- imgofs[2]=80;
- } else {
- imgofs[0]=0;
- imgofs[1]=0;
- imgofs[2]=0;
- }
- }
-
+ p[0] = 180;
+ p[1] = 180;
+ p[2] = 180;
}
-
}
}
imgdata = PoolVector<uint8_t>::Write();
- post_process_preview(img);
+ //post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>( memnew( ImageTexture));
- ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB8,img),0);
+ Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
+ Ref<Image> image;
+ image.instance();
+ image->create(w, h, false, Image::FORMAT_RGB8, img);
+ ptex->create_from_image(image, 0);
return ptex;
-
}
-EditorSamplePreviewPlugin::EditorSamplePreviewPlugin() {
+EditorAudioStreamPreviewPlugin::EditorAudioStreamPreviewPlugin() {
}
-#endif
///////////////////////////////////////////////////////////////////////////
@@ -942,3 +753,100 @@ EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
VS::get_singleton()->free(camera);
VS::get_singleton()->free(scenario);
}
+
+///////////////////////////////////////////////////////////////////////////
+
+void EditorFontPreviewPlugin::_preview_done(const Variant &p_udata) {
+
+ preview_done = true;
+}
+
+void EditorFontPreviewPlugin::_bind_methods() {
+
+ ClassDB::bind_method("_preview_done", &EditorFontPreviewPlugin::_preview_done);
+}
+
+bool EditorFontPreviewPlugin::handles(const String &p_type) const {
+
+ return ClassDB::is_parent_class(p_type, "DynamicFontData");
+}
+
+Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path) {
+ if (canvas.is_valid()) {
+ VS::get_singleton()->viewport_remove_canvas(viewport, canvas);
+ }
+
+ canvas = VS::get_singleton()->canvas_create();
+ canvas_item = VS::get_singleton()->canvas_item_create();
+
+ VS::get_singleton()->viewport_attach_canvas(viewport, canvas);
+ VS::get_singleton()->canvas_item_set_parent(canvas_item, canvas);
+
+ Ref<DynamicFontData> SampledFont;
+ SampledFont.instance();
+ SampledFont->set_font_path(p_path);
+
+ int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
+ thumbnail_size *= EDSCALE;
+
+ Ref<DynamicFont> sampled_font;
+ sampled_font.instance();
+ sampled_font->set_size(50);
+ sampled_font->set_font_data(SampledFont);
+
+ String sampled_text = "Abg";
+ Vector2 size = sampled_font->get_string_size(sampled_text);
+
+ Vector2 pos;
+
+ pos.x = 64 - size.x / 2;
+ pos.y = 80;
+
+ Ref<Font> font = sampled_font;
+
+ font->draw(canvas_item, pos, sampled_text);
+
+ VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ONCE); //once used for capture
+
+ preview_done = false;
+ VS::get_singleton()->request_frame_drawn_callback(this, "_preview_done", Variant());
+
+ while (!preview_done) {
+ OS::get_singleton()->delay_usec(10);
+ }
+
+ Ref<Image> img = VS::get_singleton()->VS::get_singleton()->texture_get_data(viewport_texture);
+ ERR_FAIL_COND_V(img.is_null(), Ref<ImageTexture>());
+
+ img->convert(Image::FORMAT_RGBA8);
+ img->resize(thumbnail_size, thumbnail_size);
+
+ post_process_preview(img);
+
+ Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
+ ptex->create_from_image(img, 0);
+
+ return ptex;
+}
+
+Ref<Texture> EditorFontPreviewPlugin::generate(const RES &p_from) {
+
+ return generate_from_path(p_from->get_path());
+}
+
+EditorFontPreviewPlugin::EditorFontPreviewPlugin() {
+
+ viewport = VS::get_singleton()->viewport_create();
+ VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_DISABLED);
+ VS::get_singleton()->viewport_set_vflip(viewport, true);
+ VS::get_singleton()->viewport_set_size(viewport, 128, 128);
+ VS::get_singleton()->viewport_set_active(viewport, true);
+ viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
+}
+
+EditorFontPreviewPlugin::~EditorFontPreviewPlugin() {
+
+ VS::get_singleton()->free(canvas_item);
+ VS::get_singleton()->free(canvas);
+ VS::get_singleton()->free(viewport);
+}
diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h
index 2e12515e30..140d9f849f 100644
--- a/editor/plugins/editor_preview_plugins.h
+++ b/editor/plugins/editor_preview_plugins.h
@@ -33,6 +33,8 @@
#include "editor/editor_resource_preview.h"
+void post_process_preview(Ref<Image> p_image);
+
class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator)
public:
@@ -98,17 +100,13 @@ public:
EditorScriptPreviewPlugin();
};
-// FIXME: Needs to be rewritten for AudioStream in Godot 3.0+
-#if 0
-class EditorSamplePreviewPlugin : public EditorResourcePreviewGenerator {
+class EditorAudioStreamPreviewPlugin : public EditorResourcePreviewGenerator {
public:
+ virtual bool handles(const String &p_type) const;
+ virtual Ref<Texture> generate(const RES &p_from);
- virtual bool handles(const String& p_type) const;
- virtual Ref<Texture> generate(const RES& p_from);
-
- EditorSamplePreviewPlugin();
+ EditorAudioStreamPreviewPlugin();
};
-#endif
class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator {
@@ -138,4 +136,27 @@ public:
~EditorMeshPreviewPlugin();
};
+class EditorFontPreviewPlugin : public EditorResourcePreviewGenerator {
+
+ GDCLASS(EditorFontPreviewPlugin, EditorResourcePreviewGenerator)
+
+ RID viewport;
+ RID viewport_texture;
+ RID canvas;
+ RID canvas_item;
+ volatile bool preview_done;
+
+ void _preview_done(const Variant &p_udata);
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual bool handles(const String &p_type) const;
+ virtual Ref<Texture> generate(const RES &p_from);
+ virtual Ref<Texture> generate_from_path(const String &p_path);
+
+ EditorFontPreviewPlugin();
+ ~EditorFontPreviewPlugin();
+};
#endif // EDITORPREVIEWPLUGINS_H
diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp
index e89cb68935..442bd52ea7 100644
--- a/editor/plugins/gradient_editor_plugin.cpp
+++ b/editor/plugins/gradient_editor_plugin.cpp
@@ -33,77 +33,70 @@
#include "canvas_item_editor_plugin.h"
#include "spatial_editor_plugin.h"
-GradientEditorPlugin::GradientEditorPlugin(EditorNode *p_node) {
-
- editor = p_node;
- ramp_editor = memnew(GradientEdit);
-
- add_control_to_container(CONTAINER_PROPERTY_EDITOR_BOTTOM, ramp_editor);
-
- ramp_editor->set_custom_minimum_size(Size2(100, 48));
- ramp_editor->hide();
- ramp_editor->connect("ramp_changed", this, "ramp_changed");
+Size2 GradientEditor::get_minimum_size() const {
+ return Size2(0, 60) * EDSCALE;
}
+void GradientEditor::_gradient_changed() {
-void GradientEditorPlugin::edit(Object *p_object) {
-
- Gradient *gradient = Object::cast_to<Gradient>(p_object);
- if (!gradient)
+ if (editing)
return;
- gradient_ref = Ref<Gradient>(gradient);
- ramp_editor->set_points(gradient_ref->get_points());
-}
-bool GradientEditorPlugin::handles(Object *p_object) const {
+ editing = true;
+ Vector<Gradient::Point> points = gradient->get_points();
+ set_points(points);
+ editing = false;
+}
- return p_object->is_class("Gradient");
+void GradientEditor::_ramp_changed() {
+
+ editing = true;
+ UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ undo_redo->create_action("Gradient Edited");
+ undo_redo->add_do_method(gradient.ptr(), "set_offsets", get_offsets());
+ undo_redo->add_do_method(gradient.ptr(), "set_colors", get_colors());
+ undo_redo->add_undo_method(gradient.ptr(), "set_offsets", gradient->get_offsets());
+ undo_redo->add_undo_method(gradient.ptr(), "set_colors", gradient->get_colors());
+ undo_redo->commit_action();
+ editing = false;
}
-void GradientEditorPlugin::make_visible(bool p_visible) {
+void GradientEditor::_bind_methods() {
- if (p_visible) {
- ramp_editor->show();
- } else {
- ramp_editor->hide();
- }
+ ClassDB::bind_method("_gradient_changed", &GradientEditor::_gradient_changed);
+ ClassDB::bind_method("_ramp_changed", &GradientEditor::_ramp_changed);
}
-void GradientEditorPlugin::_ramp_changed() {
-
- if (gradient_ref.is_valid()) {
+void GradientEditor::set_gradient(const Ref<Gradient> &p_gradient) {
+ gradient = p_gradient;
+ connect("ramp_changed", this, "_ramp_changed");
+ gradient->connect("changed", this, "_gradient_changed");
+ set_points(gradient->get_points());
+}
- UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+GradientEditor::GradientEditor() {
+ editing = false;
+}
- //Not sure if I should convert this data to PoolVector
- Vector<float> new_offsets = ramp_editor->get_offsets();
- Vector<Color> new_colors = ramp_editor->get_colors();
- Vector<float> old_offsets = gradient_ref->get_offsets();
- Vector<Color> old_colors = gradient_ref->get_colors();
+///////////////////////
- if (old_offsets.size() != new_offsets.size())
- ur->create_action(TTR("Add/Remove Color Ramp Point"));
- else
- ur->create_action(TTR("Modify Color Ramp"), UndoRedo::MERGE_ENDS);
- ur->add_do_method(this, "undo_redo_gradient", new_offsets, new_colors);
- ur->add_undo_method(this, "undo_redo_gradient", old_offsets, old_colors);
- ur->commit_action();
+bool EditorInspectorPluginGradient::can_handle(Object *p_object) {
- //color_ramp_ref->set_points(ramp_editor->get_points());
- }
+ return Object::cast_to<Gradient>(p_object) != NULL;
}
-void GradientEditorPlugin::_undo_redo_gradient(const Vector<float> &offsets, const Vector<Color> &colors) {
+void EditorInspectorPluginGradient::parse_begin(Object *p_object) {
- gradient_ref->set_offsets(offsets);
- gradient_ref->set_colors(colors);
- ramp_editor->set_points(gradient_ref->get_points());
- ramp_editor->update();
-}
+ Gradient *gradient = Object::cast_to<Gradient>(p_object);
+ Ref<Gradient> g(gradient);
-GradientEditorPlugin::~GradientEditorPlugin() {
+ GradientEditor *editor = memnew(GradientEditor);
+ editor->set_gradient(g);
+ add_custom_control(editor);
}
-void GradientEditorPlugin::_bind_methods() {
- ClassDB::bind_method(D_METHOD("ramp_changed"), &GradientEditorPlugin::_ramp_changed);
- ClassDB::bind_method(D_METHOD("undo_redo_gradient", "offsets", "colors"), &GradientEditorPlugin::_undo_redo_gradient);
+GradientEditorPlugin::GradientEditorPlugin(EditorNode *p_node) {
+
+ Ref<EditorInspectorPluginGradient> plugin;
+ plugin.instance();
+ add_inspector_plugin(plugin);
}
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index 52f4c59575..0c878b168f 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -35,28 +35,39 @@
#include "editor/editor_plugin.h"
#include "scene/gui/gradient_edit.h"
-class GradientEditorPlugin : public EditorPlugin {
+class GradientEditor : public GradientEdit {
+ GDCLASS(GradientEditor, GradientEdit)
- GDCLASS(GradientEditorPlugin, EditorPlugin);
+ bool editing;
+ Ref<Gradient> gradient;
- Ref<Gradient> gradient_ref;
- GradientEdit *ramp_editor;
- EditorNode *editor;
+ void _gradient_changed();
+ void _ramp_changed();
protected:
static void _bind_methods();
- void _ramp_changed();
- void _undo_redo_gradient(const Vector<float> &offsets, const Vector<Color> &colors);
+
+public:
+ virtual Size2 get_minimum_size() const;
+ void set_gradient(const Ref<Gradient> &p_gradient);
+ GradientEditor();
+};
+
+class EditorInspectorPluginGradient : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorPluginGradient, EditorInspectorPlugin)
+public:
+ virtual bool can_handle(Object *p_object);
+ virtual void parse_begin(Object *p_object);
+};
+
+class GradientEditorPlugin : public EditorPlugin {
+
+ GDCLASS(GradientEditorPlugin, EditorPlugin);
public:
virtual String get_name() const { return "ColorRamp"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_object);
- virtual bool handles(Object *p_object) const;
- virtual void make_visible(bool p_visible);
GradientEditorPlugin(EditorNode *p_node);
- ~GradientEditorPlugin();
};
#endif /* TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_ */
diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp
index fd5a1f185f..f75fb0d109 100644
--- a/editor/plugins/item_list_editor_plugin.cpp
+++ b/editor/plugins/item_list_editor_plugin.cpp
@@ -42,9 +42,18 @@ bool ItemListPlugin::_set(const StringName &p_name, const Variant &p_value) {
set_item_text(idx, p_value);
else if (what == "icon")
set_item_icon(idx, p_value);
- else if (what == "checkable")
- set_item_checkable(idx, p_value);
- else if (what == "checked")
+ else if (what == "checkable") {
+ // This keeps compatibility to/from versions where this property was a boolean, before radio buttons
+ switch ((int)p_value) {
+ case 0:
+ case 1:
+ set_item_checkable(idx, p_value);
+ break;
+ case 2:
+ set_item_radio_checkable(idx, true);
+ break;
+ }
+ } else if (what == "checked")
set_item_checked(idx, p_value);
else if (what == "id")
set_item_id(idx, p_value);
@@ -68,9 +77,14 @@ bool ItemListPlugin::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = get_item_text(idx);
else if (what == "icon")
r_ret = get_item_icon(idx);
- else if (what == "checkable")
- r_ret = is_item_checkable(idx);
- else if (what == "checked")
+ else if (what == "checkable") {
+ // This keeps compatibility to/from versions where this property was a boolean, before radio buttons
+ if (!is_item_checkable(idx)) {
+ r_ret = 0;
+ } else {
+ r_ret = is_item_radio_checkable(idx) ? 2 : 1;
+ }
+ } else if (what == "checked")
r_ret = is_item_checked(idx);
else if (what == "id")
r_ret = get_item_id(idx);
@@ -95,7 +109,7 @@ void ItemListPlugin::_get_property_list(List<PropertyInfo> *p_list) const {
int flags = get_flags();
if (flags & FLAG_CHECKABLE) {
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "checkable"));
+ p_list->push_back(PropertyInfo(Variant::BOOL, base + "checkable", PROPERTY_HINT_ENUM, "No,As checkbox,As radio button"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "checked"));
}
@@ -247,7 +261,7 @@ void ItemListEditor::_node_removed(Node *p_node) {
void ItemListEditor::_notification(int p_notification) {
- if (p_notification == NOTIFICATION_ENTER_TREE) {
+ if (p_notification == NOTIFICATION_ENTER_TREE || p_notification == NOTIFICATION_THEME_CHANGED) {
add_button->set_icon(get_icon("Add", "EditorIcons"));
del_button->set_icon(get_icon("Remove", "EditorIcons"));
@@ -374,7 +388,7 @@ ItemListEditor::ItemListEditor() {
vbc->add_child(property_editor);
property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
- tree = property_editor->get_scene_tree();
+ tree = property_editor->get_property_tree();
}
ItemListEditor::~ItemListEditor() {
diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h
index bd7d3db10d..d6a071b9b9 100644
--- a/editor/plugins/item_list_editor_plugin.h
+++ b/editor/plugins/item_list_editor_plugin.h
@@ -74,7 +74,9 @@ public:
virtual Ref<Texture> get_item_icon(int p_idx) const { return Ref<Texture>(); };
virtual void set_item_checkable(int p_idx, bool p_check) {}
+ virtual void set_item_radio_checkable(int p_idx, bool p_check) {}
virtual bool is_item_checkable(int p_idx) const { return false; };
+ virtual bool is_item_radio_checkable(int p_idx) const { return false; };
virtual void set_item_checked(int p_idx, bool p_checked) {}
virtual bool is_item_checked(int p_idx) const { return false; };
@@ -145,7 +147,9 @@ public:
virtual Ref<Texture> get_item_icon(int p_idx) const { return pp->get_item_icon(p_idx); }
virtual void set_item_checkable(int p_idx, bool p_check) { pp->set_item_as_checkable(p_idx, p_check); }
+ virtual void set_item_radio_checkable(int p_idx, bool p_check) { pp->set_item_as_radio_checkable(p_idx, p_check); }
virtual bool is_item_checkable(int p_idx) const { return pp->is_item_checkable(p_idx); }
+ virtual bool is_item_radio_checkable(int p_idx) const { return pp->is_item_radio_checkable(p_idx); }
virtual void set_item_checked(int p_idx, bool p_checked) { pp->set_item_checked(p_idx, p_checked); }
virtual bool is_item_checked(int p_idx) const { return pp->is_item_checked(p_idx); }
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index 47d5a73078..ba6452c1d1 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -64,6 +64,7 @@ void Line2DEditor::_action_set_polygon(int p_idx, const Variant &p_previous, con
Line2DEditor::Line2DEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
+ node = NULL;
}
Line2DEditorPlugin::Line2DEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp
index cb5f7ba76c..74b6f14c2e 100644
--- a/editor/plugins/mesh_instance_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_editor_plugin.cpp
@@ -344,6 +344,10 @@ void MeshInstanceEditor::_create_outline_mesh() {
err_dialog->set_text(TTR("Mesh has not surface to create outlines from!"));
err_dialog->popup_centered_minsize();
return;
+ } else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) {
+ err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES!"));
+ err_dialog->popup_centered_minsize();
+ return;
}
Ref<Mesh> mesho = mesh->create_outline(outline_size->get_value());
@@ -396,7 +400,7 @@ MeshInstanceEditor::MeshInstanceEditor() {
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH);
options->get_popup()->add_separator();
- options->get_popup()->add_item(TTR("Create Outline Mesh.."), MENU_OPTION_CREATE_OUTLINE_MESH);
+ options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("View UV1"), MENU_OPTION_DEBUG_UV1);
options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2);
diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index d1edf1ae10..0332e15b0e 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -123,6 +123,7 @@ void NavigationPolygonEditor::_create_resource() {
NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
+ node = NULL;
}
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index abee9a9893..6d11079759 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -94,7 +94,7 @@ void Particles2DEditorPlugin::_generate_visibility_rect() {
while (running < time) {
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
- ep.step("Generating..", int(running), true);
+ ep.step("Generating...", int(running), true);
OS::get_singleton()->delay_usec(1000);
Rect2 capture = particles->capture_rect();
@@ -229,7 +229,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() {
valid_normals.resize(vpc);
}
- ERR_EXPLAIN(TTR("No pixels with transparency > 128 in image.."));
+ ERR_EXPLAIN(TTR("No pixels with transparency > 128 in image..."));
ERR_FAIL_COND(valid_positions.size() == 0);
PoolVector<uint8_t> texdata;
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index d129b6c5c3..7728995a99 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -129,7 +129,7 @@ void ParticlesEditor::_generate_aabb() {
while (running < time) {
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
- ep.step("Generating..", int(running), true);
+ ep.step("Generating...", int(running), true);
OS::get_singleton()->delay_usec(1000);
AABB capture = node->capture_aabb();
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index 056219a575..6dde639c54 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -167,18 +167,12 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
Vector3 ofs;
- if (p_cancel) {
-
- return;
- }
-
if (t == 0) {
-
if (p_cancel) {
-
c->set_point_in(p_idx, p_restore);
return;
}
+
ur->create_action(TTR("Set Curve In Position"));
ur->add_do_method(c.ptr(), "set_point_in", idx, c->get_point_in(idx));
ur->add_undo_method(c.ptr(), "set_point_in", idx, p_restore);
@@ -186,10 +180,11 @@ void PathSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p
} else {
if (p_cancel) {
-
c->set_point_out(idx, p_restore);
+
return;
}
+
ur->create_action(TTR("Set Curve Out Position"));
ur->add_do_method(c.ptr(), "set_point_out", idx, c->get_point_out(idx));
ur->add_undo_method(c.ptr(), "set_point_out", idx, p_restore);
diff --git a/editor/plugins/physical_bone_plugin.cpp b/editor/plugins/physical_bone_plugin.cpp
new file mode 100644
index 0000000000..42f1adcadf
--- /dev/null
+++ b/editor/plugins/physical_bone_plugin.cpp
@@ -0,0 +1,123 @@
+/*************************************************************************/
+/* physical_bone_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "physical_bone_plugin.h"
+#include "editor/plugins/spatial_editor_plugin.h"
+#include "scene/3d/physics_body.h"
+
+void PhysicalBoneEditor::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_on_toggle_button_transform_joint", "is_pressed"), &PhysicalBoneEditor::_on_toggle_button_transform_joint);
+}
+
+void PhysicalBoneEditor::_on_toggle_button_transform_joint(bool p_is_pressed) {
+
+ _set_move_joint();
+}
+
+void PhysicalBoneEditor::_set_move_joint() {
+ if (selected) {
+ selected->_set_gizmo_move_joint(button_transform_joint->is_pressed());
+ }
+}
+
+PhysicalBoneEditor::PhysicalBoneEditor(EditorNode *p_editor) :
+ editor(p_editor),
+ selected(NULL) {
+
+ spatial_editor_hb = memnew(HBoxContainer);
+ spatial_editor_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ spatial_editor_hb->set_alignment(BoxContainer::ALIGN_BEGIN);
+ SpatialEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
+
+ spatial_editor_hb->add_child(memnew(VSeparator));
+
+ button_transform_joint = memnew(ToolButton);
+ spatial_editor_hb->add_child(button_transform_joint);
+
+ button_transform_joint->set_text(TTR("Move joint"));
+ button_transform_joint->set_icon(SpatialEditor::get_singleton()->get_icon("PhysicalBone", "EditorIcons"));
+ button_transform_joint->set_toggle_mode(true);
+ button_transform_joint->connect("toggled", this, "_on_toggle_button_transform_joint");
+
+ hide();
+}
+
+PhysicalBoneEditor::~PhysicalBoneEditor() {
+ // TODO the spatial_editor_hb should be removed from SpatialEditor, but in this moment it's not possible
+ for (int i = spatial_editor_hb->get_child_count() - 1; 0 <= i; --i) {
+ Node *n = spatial_editor_hb->get_child(i);
+ spatial_editor_hb->remove_child(n);
+ memdelete(n);
+ }
+ memdelete(spatial_editor_hb);
+}
+
+void PhysicalBoneEditor::set_selected(PhysicalBone *p_pb) {
+
+ button_transform_joint->set_pressed(false);
+
+ _set_move_joint();
+ selected = p_pb;
+ _set_move_joint();
+}
+
+void PhysicalBoneEditor::hide() {
+ spatial_editor_hb->hide();
+}
+
+void PhysicalBoneEditor::show() {
+ spatial_editor_hb->show();
+}
+
+PhysicalBonePlugin::PhysicalBonePlugin(EditorNode *p_editor) :
+ editor(p_editor),
+ selected(NULL) {
+
+ physical_bone_editor = memnew(PhysicalBoneEditor(editor));
+}
+
+void PhysicalBonePlugin::make_visible(bool p_visible) {
+ if (p_visible) {
+
+ physical_bone_editor->show();
+ } else {
+
+ physical_bone_editor->hide();
+ physical_bone_editor->set_selected(NULL);
+ selected = NULL;
+ }
+}
+
+void PhysicalBonePlugin::edit(Object *p_node) {
+ selected = static_cast<PhysicalBone *>(p_node); // Trust it
+ ERR_FAIL_COND(!selected);
+
+ physical_bone_editor->set_selected(selected);
+}
diff --git a/editor/plugins/physical_bone_plugin.h b/editor/plugins/physical_bone_plugin.h
new file mode 100644
index 0000000000..9e7a50307a
--- /dev/null
+++ b/editor/plugins/physical_bone_plugin.h
@@ -0,0 +1,78 @@
+/*************************************************************************/
+/* physical_bone_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef PHYSICAL_BONE_PLUGIN_H
+#define PHYSICAL_BONE_PLUGIN_H
+
+#include "editor/editor_node.h"
+
+class PhysicalBoneEditor : public Object {
+ GDCLASS(PhysicalBoneEditor, Object);
+
+ EditorNode *editor;
+ HBoxContainer *spatial_editor_hb;
+ ToolButton *button_transform_joint;
+
+ PhysicalBone *selected;
+
+protected:
+ static void _bind_methods();
+
+private:
+ void _on_toggle_button_transform_joint(bool p_is_pressed);
+ void _set_move_joint();
+
+public:
+ PhysicalBoneEditor(EditorNode *p_editor);
+ ~PhysicalBoneEditor();
+
+ void set_selected(PhysicalBone *p_pb);
+
+ void hide();
+ void show();
+};
+
+class PhysicalBonePlugin : public EditorPlugin {
+ GDCLASS(PhysicalBonePlugin, EditorPlugin);
+
+ EditorNode *editor;
+ PhysicalBone *selected;
+ PhysicalBoneEditor *physical_bone_editor;
+
+public:
+ virtual String get_name() const { return "PhysicalBone"; }
+ virtual bool handles(Object *p_object) const { return p_object->is_class("PhysicalBone"); }
+ virtual void make_visible(bool p_visible);
+ virtual void edit(Object *p_node);
+
+ PhysicalBonePlugin(EditorNode *p_editor);
+};
+
+#endif
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index f106d2a78e..4840b1899d 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -35,7 +35,7 @@
#include "os/file_access.h"
#include "os/input.h"
#include "os/keyboard.h"
-
+#include "scene/2d/skeleton_2d.h"
Node2D *Polygon2DEditor::_get_node() const {
return node;
@@ -64,6 +64,10 @@ void Polygon2DEditor::_notification(int p_what) {
uv_button[UV_MODE_MOVE]->set_icon(get_icon("ToolMove", "EditorIcons"));
uv_button[UV_MODE_ROTATE]->set_icon(get_icon("ToolRotate", "EditorIcons"));
uv_button[UV_MODE_SCALE]->set_icon(get_icon("ToolScale", "EditorIcons"));
+ uv_button[UV_MODE_ADD_SPLIT]->set_icon(get_icon("AddSplit", "EditorIcons"));
+ uv_button[UV_MODE_REMOVE_SPLIT]->set_icon(get_icon("DeleteSplit", "EditorIcons"));
+ uv_button[UV_MODE_PAINT_WEIGHT]->set_icon(get_icon("PaintVertex", "EditorIcons"));
+ uv_button[UV_MODE_CLEAR_WEIGHT]->set_icon(get_icon("UnpaintVertex", "EditorIcons"));
b_snap_grid->set_icon(get_icon("Grid", "EditorIcons"));
b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons"));
@@ -76,15 +80,167 @@ void Polygon2DEditor::_notification(int p_what) {
}
}
-void Polygon2DEditor::_uv_edit_mode_select(int p_mode) {
+void Polygon2DEditor::_sync_bones() {
+
+ print_line("syncinc");
+ if (!node->has_node(node->get_skeleton())) {
+ error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node"));
+ error->popup_centered_minsize();
+ return;
+ }
+
+ Node *sn = node->get_node(node->get_skeleton());
+ Skeleton2D *skeleton = Object::cast_to<Skeleton2D>(sn);
+
+ if (!skeleton) {
+ error->set_text(TTR("The skeleton property of the Polygon2D does not point to a Skeleton2D node"));
+ error->popup_centered_minsize();
+ return;
+ }
+
+ Array prev_bones = node->call("_get_bones");
+ node->clear_bones();
+
+ print_line("bones in skeleton: " + itos(skeleton->get_bone_count()));
- if (p_mode == 0) {
- if (uv_button[UV_MODE_CREATE]->is_pressed()) {
- _uv_mode(1);
+ for (int i = 0; i < skeleton->get_bone_count(); i++) {
+ NodePath path = skeleton->get_path_to(skeleton->get_bone(i));
+ PoolVector<float> weights;
+ int wc = node->get_polygon().size();
+
+ for (int j = 0; j < prev_bones.size(); j += 2) {
+ NodePath pvp = prev_bones[j];
+ PoolVector<float> pv = prev_bones[j + 1];
+ if (pvp == path && pv.size() == wc) {
+ weights = pv;
+ }
+ }
+
+ if (weights.size() == 0) { //create them
+ weights.resize(node->get_polygon().size());
+ PoolVector<float>::Write w = weights.write();
+ for (int j = 0; j < wc; j++) {
+ w[j] = 0.0;
+ }
}
+
+ node->add_bone(path, weights);
+ }
+ Array new_bones = node->call("_get_bones");
+
+ undo_redo->create_action(TTR("Sync bones"));
+ undo_redo->add_do_method(node, "_set_bones", new_bones);
+ undo_redo->add_undo_method(node, "_set_bones", prev_bones);
+ undo_redo->add_do_method(uv_edit_draw, "update");
+ undo_redo->add_undo_method(uv_edit_draw, "update");
+ undo_redo->add_do_method(this, "_update_bone_list");
+ undo_redo->add_undo_method(this, "_update_bone_list");
+ undo_redo->commit_action();
+}
+
+void Polygon2DEditor::_update_bone_list() {
+
+ NodePath selected;
+ while (bone_scroll_vb->get_child_count()) {
+ CheckBox *cb = Object::cast_to<CheckBox>(bone_scroll_vb->get_child(0));
+ if (cb && cb->is_pressed()) {
+ selected = cb->get_meta("bone_path");
+ }
+ memdelete(bone_scroll_vb->get_child(0));
+ }
+
+ Ref<ButtonGroup> bg;
+ bg.instance();
+ for (int i = 0; i < node->get_bone_count(); i++) {
+ CheckBox *cb = memnew(CheckBox);
+ NodePath np = node->get_bone_path(i);
+ String name;
+ if (np.get_name_count()) {
+ name = np.get_name(np.get_name_count() - 1);
+ }
+ if (name == String()) {
+ name = "Bone " + itos(i);
+ }
+ cb->set_text(name);
+ cb->set_button_group(bg);
+ cb->set_meta("bone_path", np);
+ bone_scroll_vb->add_child(cb);
+
+ if (np == selected)
+ cb->set_pressed(true);
+
+ cb->connect("pressed", this, "_bone_paint_selected", varray(i));
+ }
+
+ uv_edit_draw->update();
+}
+
+void Polygon2DEditor::_bone_paint_selected(int p_index) {
+ uv_edit_draw->update();
+}
+
+void Polygon2DEditor::_uv_edit_mode_select(int p_mode) {
+
+ if (p_mode == 0) { //uv
uv_button[UV_MODE_CREATE]->hide();
- } else {
- uv_button[UV_MODE_CREATE]->show();
+ for (int i = UV_MODE_MOVE; i <= UV_MODE_SCALE; i++) {
+ uv_button[i]->show();
+ }
+ uv_button[UV_MODE_ADD_SPLIT]->hide();
+ uv_button[UV_MODE_REMOVE_SPLIT]->hide();
+ uv_button[UV_MODE_PAINT_WEIGHT]->hide();
+ uv_button[UV_MODE_CLEAR_WEIGHT]->hide();
+ _uv_mode(UV_MODE_EDIT_POINT);
+
+ bone_scroll_main_vb->hide();
+ bone_paint_strength->hide();
+ bone_paint_radius->hide();
+ bone_paint_radius_label->hide();
+
+ } else if (p_mode == 1) { //poly
+ for (int i = 0; i <= UV_MODE_SCALE; i++) {
+ uv_button[i]->show();
+ }
+ uv_button[UV_MODE_ADD_SPLIT]->hide();
+ uv_button[UV_MODE_REMOVE_SPLIT]->hide();
+ uv_button[UV_MODE_PAINT_WEIGHT]->hide();
+ uv_button[UV_MODE_CLEAR_WEIGHT]->hide();
+ _uv_mode(UV_MODE_EDIT_POINT);
+
+ bone_scroll_main_vb->hide();
+ bone_paint_strength->hide();
+ bone_paint_radius->hide();
+ bone_paint_radius_label->hide();
+
+ } else if (p_mode == 2) { //splits
+ for (int i = 0; i <= UV_MODE_SCALE; i++) {
+ uv_button[i]->hide();
+ }
+ uv_button[UV_MODE_ADD_SPLIT]->show();
+ uv_button[UV_MODE_REMOVE_SPLIT]->show();
+ uv_button[UV_MODE_PAINT_WEIGHT]->hide();
+ uv_button[UV_MODE_CLEAR_WEIGHT]->hide();
+ _uv_mode(UV_MODE_ADD_SPLIT);
+
+ bone_scroll_main_vb->hide();
+ bone_paint_strength->hide();
+ bone_paint_radius->hide();
+ bone_paint_radius_label->hide();
+
+ } else if (p_mode == 3) { //bones´
+ for (int i = 0; i <= UV_MODE_REMOVE_SPLIT; i++) {
+ uv_button[i]->hide();
+ }
+ uv_button[UV_MODE_PAINT_WEIGHT]->show();
+ uv_button[UV_MODE_CLEAR_WEIGHT]->show();
+ _uv_mode(UV_MODE_PAINT_WEIGHT);
+
+ bone_scroll_main_vb->show();
+ bone_paint_strength->show();
+ bone_paint_radius->show();
+ bone_paint_radius_label->show();
+ _update_bone_list();
+ bone_paint_pos = Vector2(-100000, -100000); //send brush away when switching
}
uv_edit_draw->update();
@@ -158,6 +314,9 @@ void Polygon2DEditor::_menu_option(int p_option) {
undo_redo->commit_action();
} break;
+ case UVEDIT_GRID_SETTINGS: {
+ grid_settings->popup_centered_minsize();
+ } break;
default: {
AbstractPolygon2DEditor::_menu_option(p_option);
} break;
@@ -195,6 +354,10 @@ void Polygon2DEditor::_set_snap_step_y(float p_val) {
void Polygon2DEditor::_uv_mode(int p_mode) {
+ split_create = false;
+ uv_drag = false;
+ uv_create = false;
+
uv_mode = UVMode(p_mode);
for (int i = 0; i < UV_MODE_MAX; i++) {
uv_button[i]->set_pressed(p_mode == i);
@@ -217,39 +380,44 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
uv_drag_from = Vector2(mb->get_position().x, mb->get_position().y);
uv_drag = true;
- uv_prev = node->get_uv();
+ points_prev = node->get_uv();
- if (uv_edit_mode[0]->is_pressed()) //edit uv
- uv_prev = node->get_uv();
- else
- uv_prev = node->get_polygon();
+ if (uv_edit_mode[0]->is_pressed()) { //edit uv
+ points_prev = node->get_uv();
+ } else { //edit polygon
+ points_prev = node->get_polygon();
+ }
uv_move_current = uv_mode;
if (uv_move_current == UV_MODE_CREATE) {
if (!uv_create) {
- uv_prev.resize(0);
+ points_prev.resize(0);
Vector2 tuv = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
- uv_prev.push_back(tuv);
+ points_prev.push_back(tuv);
uv_create_to = tuv;
- uv_drag_index = 0;
+ point_drag_index = 0;
uv_drag_from = tuv;
uv_drag = true;
uv_create = true;
uv_create_uv_prev = node->get_uv();
uv_create_poly_prev = node->get_polygon();
- node->set_polygon(uv_prev);
- node->set_uv(uv_prev);
+ uv_create_bones_prev = node->call("_get_bones");
+ splits_prev = node->get_splits();
+ node->set_polygon(points_prev);
+ node->set_uv(points_prev);
} else {
Vector2 tuv = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
- if (uv_prev.size() > 3 && tuv.distance_to(uv_prev[0]) < 8) {
+ if (points_prev.size() > 3 && tuv.distance_to(points_prev[0]) < 8) {
undo_redo->create_action(TTR("Create Polygon & UV"));
undo_redo->add_do_method(node, "set_uv", node->get_uv());
- undo_redo->add_undo_method(node, "set_uv", uv_prev);
+ undo_redo->add_undo_method(node, "set_uv", points_prev);
undo_redo->add_do_method(node, "set_polygon", node->get_polygon());
- undo_redo->add_undo_method(node, "set_polygon", uv_prev);
+ undo_redo->add_undo_method(node, "set_polygon", points_prev);
+ undo_redo->add_do_method(node, "clear_bones");
+ undo_redo->add_undo_method(node, "_set_bones", node->call("_get_bones"));
undo_redo->add_do_method(uv_edit_draw, "update");
undo_redo->add_undo_method(uv_edit_draw, "update");
undo_redo->commit_action();
@@ -257,12 +425,12 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
uv_create = false;
_uv_mode(UV_MODE_EDIT_POINT);
} else {
- uv_prev.push_back(tuv);
- uv_drag_index = uv_prev.size() - 1;
+ points_prev.push_back(tuv);
+ point_drag_index = points_prev.size() - 1;
uv_drag_from = tuv;
}
- node->set_polygon(uv_prev);
- node->set_uv(uv_prev);
+ node->set_polygon(points_prev);
+ node->set_uv(points_prev);
}
}
@@ -278,36 +446,193 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
if (uv_move_current == UV_MODE_EDIT_POINT) {
- uv_drag_index = -1;
- for (int i = 0; i < uv_prev.size(); i++) {
+ point_drag_index = -1;
+ for (int i = 0; i < points_prev.size(); i++) {
- Vector2 tuv = mtx.xform(uv_prev[i]);
+ Vector2 tuv = mtx.xform(points_prev[i]);
if (tuv.distance_to(Vector2(mb->get_position().x, mb->get_position().y)) < 8) {
uv_drag_from = tuv;
- uv_drag_index = i;
+ point_drag_index = i;
}
}
- if (uv_drag_index == -1) {
+ if (point_drag_index == -1) {
uv_drag = false;
}
}
+
+ if (uv_move_current == UV_MODE_ADD_SPLIT) {
+
+ int split_to_index = -1;
+ split_to_index = -1;
+ for (int i = 0; i < points_prev.size(); i++) {
+
+ Vector2 tuv = mtx.xform(points_prev[i]);
+ if (tuv.distance_to(Vector2(mb->get_position().x, mb->get_position().y)) < 8) {
+ split_to_index = i;
+ }
+ }
+
+ if (split_to_index == -1) {
+ split_create = false;
+ return;
+ }
+
+ if (split_create) {
+
+ split_create = false;
+ if (split_to_index < point_drag_index) {
+ SWAP(split_to_index, point_drag_index);
+ }
+ bool valid = true;
+ String split_error;
+ if (split_to_index == point_drag_index) {
+ split_error = TTR("Split point with itself.");
+ valid = false;
+ }
+ if (split_to_index + 1 == point_drag_index) {
+ //not a split,goes along the edge
+ split_error = TTR("Split can't form an existing edge.");
+ valid = false;
+ }
+ if (split_to_index == points_prev.size() - 1 && point_drag_index == 0) {
+ //not a split,goes along the edge
+ split_error = TTR("Split can't form an existing edge.");
+ valid = false;
+ }
+
+ for (int i = 0; i < splits_prev.size(); i += 2) {
+
+ if (splits_prev[i] == point_drag_index && splits_prev[i + 1] == split_to_index) {
+ //already exists
+ split_error = TTR("Split already exists.");
+ valid = false;
+ break;
+ }
+
+ int a_state; //-1, outside split, 0 split point, +1, inside split
+ if (point_drag_index == splits_prev[i] || point_drag_index == splits_prev[i + 1]) {
+ a_state = 0;
+ } else if (point_drag_index < splits_prev[i] || point_drag_index > splits_prev[i + 1]) {
+ a_state = -1;
+ } else {
+ a_state = 1;
+ }
+
+ int b_state; //-1, outside split, 0 split point, +1, inside split
+ if (split_to_index == splits_prev[i] || split_to_index == splits_prev[i + 1]) {
+ b_state = 0;
+ } else if (split_to_index < splits_prev[i] || split_to_index > splits_prev[i + 1]) {
+ b_state = -1;
+ } else {
+ b_state = 1;
+ }
+
+ if (b_state * a_state < 0) {
+ //crossing
+ split_error = "Split crosses another split.";
+ valid = false;
+ break;
+ }
+ }
+
+ if (valid) {
+
+ splits_prev.push_back(point_drag_index);
+ splits_prev.push_back(split_to_index);
+
+ undo_redo->create_action(TTR("Add Split"));
+
+ undo_redo->add_do_method(node, "set_splits", splits_prev);
+ undo_redo->add_undo_method(node, "set_splits", node->get_splits());
+ undo_redo->add_do_method(uv_edit_draw, "update");
+ undo_redo->add_undo_method(uv_edit_draw, "update");
+ undo_redo->commit_action();
+ } else {
+ error->set_text(TTR("Invalid Split: ") + split_error);
+ error->popup_centered_minsize();
+ }
+
+ } else {
+ point_drag_index = split_to_index;
+ split_create = true;
+ splits_prev = node->get_splits();
+ uv_create_to = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
+ }
+ }
+
+ if (uv_move_current == UV_MODE_REMOVE_SPLIT) {
+
+ splits_prev = node->get_splits();
+ for (int i = 0; i < splits_prev.size(); i += 2) {
+ if (splits_prev[i] < 0 || splits_prev[i] >= points_prev.size())
+ continue;
+ if (splits_prev[i + 1] < 0 || splits_prev[i] >= points_prev.size())
+ continue;
+ Vector2 e[2] = { mtx.xform(points_prev[splits_prev[i]]), mtx.xform(points_prev[splits_prev[i + 1]]) };
+ Vector2 mp = Vector2(mb->get_position().x, mb->get_position().y);
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(mp, e);
+ if (cp.distance_to(mp) < 8) {
+ splits_prev.remove(i);
+ splits_prev.remove(i);
+
+ undo_redo->create_action(TTR("Remove Split"));
+
+ undo_redo->add_do_method(node, "set_splits", splits_prev);
+ undo_redo->add_undo_method(node, "set_splits", node->get_splits());
+ undo_redo->add_do_method(uv_edit_draw, "update");
+ undo_redo->add_undo_method(uv_edit_draw, "update");
+ undo_redo->commit_action();
+
+ break;
+ }
+ }
+ }
+
+ if (uv_move_current == UV_MODE_PAINT_WEIGHT || uv_move_current == UV_MODE_CLEAR_WEIGHT) {
+
+ int bone_selected = -1;
+ for (int i = 0; i < bone_scroll_vb->get_child_count(); i++) {
+ CheckBox *c = Object::cast_to<CheckBox>(bone_scroll_vb->get_child(i));
+ if (c && c->is_pressed()) {
+ bone_selected = i;
+ break;
+ }
+ }
+
+ if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == points_prev.size()) {
+
+ prev_weights = node->get_bone_weights(bone_selected);
+ bone_painting = true;
+ bone_painting_bone = bone_selected;
+ }
+ }
+
} else if (uv_drag && !uv_create) {
undo_redo->create_action(TTR("Transform UV Map"));
if (uv_edit_mode[0]->is_pressed()) { //edit uv
undo_redo->add_do_method(node, "set_uv", node->get_uv());
- undo_redo->add_undo_method(node, "set_uv", uv_prev);
- } else {
+ undo_redo->add_undo_method(node, "set_uv", points_prev);
+ } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon
undo_redo->add_do_method(node, "set_polygon", node->get_polygon());
- undo_redo->add_undo_method(node, "set_polygon", uv_prev);
+ undo_redo->add_undo_method(node, "set_polygon", points_prev);
}
undo_redo->add_do_method(uv_edit_draw, "update");
undo_redo->add_undo_method(uv_edit_draw, "update");
undo_redo->commit_action();
uv_drag = false;
+ } else if (bone_painting) {
+
+ undo_redo->create_action(TTR("Paint bone weights"));
+ undo_redo->add_do_method(node, "set_bone_weights", bone_painting_bone, node->get_bone_weights(bone_painting_bone));
+ undo_redo->add_undo_method(node, "set_bone_weights", bone_painting_bone, prev_weights);
+ undo_redo->add_do_method(uv_edit_draw, "update");
+ undo_redo->add_undo_method(uv_edit_draw, "update");
+ undo_redo->commit_action();
+ bone_painting = false;
}
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
@@ -318,16 +643,23 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
uv_create = false;
node->set_uv(uv_create_uv_prev);
node->set_polygon(uv_create_poly_prev);
+ node->call("_set_bones", uv_create_bones_prev);
+ node->set_splits(splits_prev);
uv_edit_draw->update();
} else if (uv_drag) {
uv_drag = false;
if (uv_edit_mode[0]->is_pressed()) { //edit uv
- node->set_uv(uv_prev);
- } else {
- node->set_polygon(uv_prev);
+ node->set_uv(points_prev);
+ } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon
+ node->set_polygon(points_prev);
}
uv_edit_draw->update();
+ } else if (split_create) {
+ split_create = false;
+ uv_edit_draw->update();
+ } else if (bone_painting) {
+ node->set_bone_weights(bone_painting_bone, prev_weights);
}
} else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
@@ -363,24 +695,24 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
} break;
case UV_MODE_EDIT_POINT: {
- PoolVector<Vector2> uv_new = uv_prev;
- uv_new.set(uv_drag_index, uv_new[uv_drag_index] + drag);
+ PoolVector<Vector2> uv_new = points_prev;
+ uv_new.set(point_drag_index, uv_new[point_drag_index] + drag);
if (uv_edit_mode[0]->is_pressed()) { //edit uv
node->set_uv(uv_new);
- } else {
+ } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon
node->set_polygon(uv_new);
}
} break;
case UV_MODE_MOVE: {
- PoolVector<Vector2> uv_new = uv_prev;
+ PoolVector<Vector2> uv_new = points_prev;
for (int i = 0; i < uv_new.size(); i++)
uv_new.set(i, uv_new[i] + drag);
if (uv_edit_mode[0]->is_pressed()) { //edit uv
node->set_uv(uv_new);
- } else {
+ } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon
node->set_polygon(uv_new);
}
@@ -388,23 +720,23 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
case UV_MODE_ROTATE: {
Vector2 center;
- PoolVector<Vector2> uv_new = uv_prev;
+ PoolVector<Vector2> uv_new = points_prev;
for (int i = 0; i < uv_new.size(); i++)
- center += uv_prev[i];
+ center += points_prev[i];
center /= uv_new.size();
float angle = (uv_drag_from - mtx.xform(center)).normalized().angle_to((uv_drag_to - mtx.xform(center)).normalized());
for (int i = 0; i < uv_new.size(); i++) {
- Vector2 rel = uv_prev[i] - center;
+ Vector2 rel = points_prev[i] - center;
rel = rel.rotated(angle);
uv_new.set(i, center + rel);
}
if (uv_edit_mode[0]->is_pressed()) { //edit uv
node->set_uv(uv_new);
- } else {
+ } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon
node->set_polygon(uv_new);
}
@@ -412,10 +744,10 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
case UV_MODE_SCALE: {
Vector2 center;
- PoolVector<Vector2> uv_new = uv_prev;
+ PoolVector<Vector2> uv_new = points_prev;
for (int i = 0; i < uv_new.size(); i++)
- center += uv_prev[i];
+ center += points_prev[i];
center /= uv_new.size();
float from_dist = uv_drag_from.distance_to(mtx.xform(center));
@@ -426,18 +758,51 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
float scale = to_dist / from_dist;
for (int i = 0; i < uv_new.size(); i++) {
- Vector2 rel = uv_prev[i] - center;
+ Vector2 rel = points_prev[i] - center;
rel = rel * scale;
uv_new.set(i, center + rel);
}
if (uv_edit_mode[0]->is_pressed()) { //edit uv
node->set_uv(uv_new);
- } else {
+ } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon
node->set_polygon(uv_new);
}
} break;
}
+
+ if (bone_painting) {
+ bone_paint_pos = Vector2(mm->get_position().x, mm->get_position().y);
+ PoolVector<float> painted_weights = node->get_bone_weights(bone_painting_bone);
+
+ {
+ int pc = painted_weights.size();
+ float amount = bone_paint_strength->get_value();
+ float radius = bone_paint_radius->get_value() * EDSCALE;
+
+ if (uv_mode == UV_MODE_CLEAR_WEIGHT) {
+ amount = -amount;
+ }
+
+ PoolVector<float>::Write w = painted_weights.write();
+ PoolVector<float>::Read r = prev_weights.read();
+ PoolVector<Vector2>::Read rv = points_prev.read();
+
+ for (int i = 0; i < pc; i++) {
+ if (mtx.xform(rv[i]).distance_to(bone_paint_pos) < radius) {
+ w[i] = CLAMP(r[i] + amount, 0, 1);
+ }
+ }
+ }
+
+ node->set_bone_weights(bone_painting_bone, painted_weights);
+ }
+ uv_edit_draw->update();
+ } else if (split_create) {
+ uv_create_to = mtx.affine_inverse().xform(Vector2(mm->get_position().x, mm->get_position().y));
+ uv_edit_draw->update();
+ } else if (uv_mode == UV_MODE_PAINT_WEIGHT || uv_mode == UV_MODE_CLEAR_WEIGHT) {
+ bone_paint_pos = Vector2(mm->get_position().x, mm->get_position().y);
uv_edit_draw->update();
}
}
@@ -473,6 +838,8 @@ void Polygon2DEditor::_uv_draw() {
if (base_tex.is_null())
return;
+ String warning;
+
Transform2D mtx;
mtx.elements[2] = -uv_draw_ofs;
mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom));
@@ -509,10 +876,29 @@ void Polygon2DEditor::_uv_draw() {
}
PoolVector<Vector2> uvs;
- if (uv_edit_mode[0]->is_pressed()) //edit uv
+ if (uv_edit_mode[0]->is_pressed()) { //edit uv
uvs = node->get_uv();
- else
+ } else { //edit polygon
uvs = node->get_polygon();
+ }
+
+ PoolVector<float>::Read weight_r;
+
+ if (uv_edit_mode[3]->is_pressed()) {
+ int bone_selected = -1;
+ for (int i = 0; i < bone_scroll_vb->get_child_count(); i++) {
+ CheckBox *c = Object::cast_to<CheckBox>(bone_scroll_vb->get_child(i));
+ if (c && c->is_pressed()) {
+ bone_selected = i;
+ break;
+ }
+ }
+
+ if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) {
+
+ weight_r = node->get_bone_weights(bone_selected).read();
+ }
+ }
Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
@@ -527,10 +913,82 @@ void Polygon2DEditor::_uv_draw() {
next_point = uv_create_to;
}
uv_edit_draw->draw_line(mtx.xform(uvs[i]), mtx.xform(next_point), Color(0.9, 0.5, 0.5), 2);
- uv_edit_draw->draw_texture(handle, mtx.xform(uvs[i]) - handle->get_size() * 0.5);
+ if (weight_r.ptr()) {
+
+ Vector2 draw_pos = mtx.xform(uvs[i]);
+ float weight = weight_r[i];
+ uv_edit_draw->draw_rect(Rect2(draw_pos - Vector2(2, 2) * EDSCALE, Vector2(5, 5) * EDSCALE), Color(weight, weight, weight, 1.0));
+ } else {
+ uv_edit_draw->draw_texture(handle, mtx.xform(uvs[i]) - handle->get_size() * 0.5);
+ }
rect.expand_to(mtx.basis_xform(uvs[i]));
}
+ if (split_create) {
+ Vector2 from = uvs[point_drag_index];
+ Vector2 to = uv_create_to;
+ uv_edit_draw->draw_line(mtx.xform(from), mtx.xform(to), Color(0.9, 0.5, 0.5), 2);
+ }
+
+ PoolVector<int> splits = node->get_splits();
+
+ for (int i = 0; i < splits.size(); i += 2) {
+ int idx_from = splits[i];
+ int idx_to = splits[i + 1];
+ if (idx_from < 0 || idx_to >= uvs.size())
+ continue;
+ uv_edit_draw->draw_line(mtx.xform(uvs[idx_from]), mtx.xform(uvs[idx_to]), Color(0.9, 0.5, 0.5), 2);
+ }
+
+ if (uv_mode == UV_MODE_PAINT_WEIGHT || uv_mode == UV_MODE_CLEAR_WEIGHT) {
+
+ NodePath bone_path;
+ for (int i = 0; i < bone_scroll_vb->get_child_count(); i++) {
+ CheckBox *c = Object::cast_to<CheckBox>(bone_scroll_vb->get_child(i));
+ if (c && c->is_pressed()) {
+ bone_path = node->get_bone_path(i);
+ break;
+ }
+ }
+
+ //draw skeleton
+ NodePath skeleton_path = node->get_skeleton();
+ if (node->has_node(skeleton_path)) {
+ Skeleton2D *skeleton = Object::cast_to<Skeleton2D>(node->get_node(skeleton_path));
+ if (skeleton) {
+ for (int i = 0; i < skeleton->get_bone_count(); i++) {
+
+ Bone2D *bone = skeleton->get_bone(i);
+ if (bone->get_rest() == Transform2D(0, 0, 0, 0, 0, 0))
+ continue; //not set
+
+ bool current = bone_path == skeleton->get_path_to(bone);
+
+ for (int j = 0; j < bone->get_child_count(); j++) {
+
+ Node2D *n = Object::cast_to<Node2D>(bone->get_child(j));
+ if (!n)
+ continue;
+
+ bool edit_bone = n->has_meta("_edit_bone_") && n->get_meta("_edit_bone_");
+ if (edit_bone) {
+
+ Transform2D bone_xform = node->get_global_transform().affine_inverse() * (skeleton->get_global_transform() * bone->get_skeleton_rest());
+ Transform2D endpoint_xform = bone_xform * n->get_transform();
+
+ Color color = current ? Color(1, 1, 1) : Color(0.5, 0.5, 0.5);
+ uv_edit_draw->draw_line(mtx.xform(bone_xform.get_origin()), mtx.xform(endpoint_xform.get_origin()), Color(0, 0, 0), current ? 5 : 4);
+ uv_edit_draw->draw_line(mtx.xform(bone_xform.get_origin()), mtx.xform(endpoint_xform.get_origin()), color, current ? 3 : 2);
+ }
+ }
+ }
+ }
+ }
+
+ //draw paint circle
+ uv_edit_draw->draw_circle(bone_paint_pos, bone_paint_radius->get_value() * EDSCALE, Color(1, 1, 1, 0.1));
+ }
+
rect = rect.grow(200);
updating_uv_scroll = true;
uv_hscroll->set_min(rect.position.x);
@@ -560,6 +1018,10 @@ void Polygon2DEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_snap_step_x"), &Polygon2DEditor::_set_snap_step_x);
ClassDB::bind_method(D_METHOD("_set_snap_step_y"), &Polygon2DEditor::_set_snap_step_y);
ClassDB::bind_method(D_METHOD("_uv_edit_mode_select"), &Polygon2DEditor::_uv_edit_mode_select);
+ ClassDB::bind_method(D_METHOD("_sync_bones"), &Polygon2DEditor::_sync_bones);
+ ClassDB::bind_method(D_METHOD("_update_bone_list"), &Polygon2DEditor::_update_bone_list);
+
+ ClassDB::bind_method(D_METHOD("_bone_paint_selected"), &Polygon2DEditor::_bone_paint_selected);
}
Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const {
@@ -574,6 +1036,7 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const {
Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
+ node = NULL;
snap_step = Vector2(10, 10);
use_snap = false;
snap_show_grid = false;
@@ -601,16 +1064,28 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_edit_mode[1] = memnew(ToolButton);
uv_mode_hb->add_child(uv_edit_mode[1]);
uv_edit_mode[1]->set_toggle_mode(true);
+ uv_edit_mode[2] = memnew(ToolButton);
+ uv_mode_hb->add_child(uv_edit_mode[2]);
+ uv_edit_mode[2]->set_toggle_mode(true);
+ uv_edit_mode[3] = memnew(ToolButton);
+ uv_mode_hb->add_child(uv_edit_mode[3]);
+ uv_edit_mode[3]->set_toggle_mode(true);
uv_edit_mode[0]->set_text(TTR("UV"));
uv_edit_mode[0]->set_pressed(true);
uv_edit_mode[1]->set_text(TTR("Poly"));
+ uv_edit_mode[2]->set_text(TTR("Splits"));
+ uv_edit_mode[3]->set_text(TTR("Bones"));
uv_edit_mode[0]->set_button_group(uv_edit_group);
uv_edit_mode[1]->set_button_group(uv_edit_group);
+ uv_edit_mode[2]->set_button_group(uv_edit_group);
+ uv_edit_mode[3]->set_button_group(uv_edit_group);
uv_edit_mode[0]->connect("pressed", this, "_uv_edit_mode_select", varray(0));
uv_edit_mode[1]->connect("pressed", this, "_uv_edit_mode_select", varray(1));
+ uv_edit_mode[2]->connect("pressed", this, "_uv_edit_mode_select", varray(2));
+ uv_edit_mode[3]->connect("pressed", this, "_uv_edit_mode_select", varray(3));
uv_mode_hb->add_child(memnew(VSeparator));
@@ -629,9 +1104,40 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_button[2]->set_tooltip(TTR("Move Polygon"));
uv_button[3]->set_tooltip(TTR("Rotate Polygon"));
uv_button[4]->set_tooltip(TTR("Scale Polygon"));
+ uv_button[5]->set_tooltip(TTR("Connect two points to make a split"));
+ uv_button[6]->set_tooltip(TTR("Select a split to erase it"));
+ uv_button[7]->set_tooltip(TTR("Paint weights with specified intensity"));
+ uv_button[8]->set_tooltip(TTR("UnPaint weights with specified intensity"));
uv_button[0]->hide();
+ uv_button[5]->hide();
+ uv_button[6]->hide();
+ uv_button[7]->hide();
+ uv_button[8]->hide();
uv_button[1]->set_pressed(true);
+
+ bone_paint_strength = memnew(HSlider);
+ uv_mode_hb->add_child(bone_paint_strength);
+ bone_paint_strength->set_custom_minimum_size(Size2(75 * EDSCALE, 0));
+ bone_paint_strength->set_v_size_flags(SIZE_SHRINK_CENTER);
+ bone_paint_strength->set_min(0);
+ bone_paint_strength->set_max(1);
+ bone_paint_strength->set_step(0.01);
+ bone_paint_strength->set_value(0.5);
+
+ bone_paint_radius_label = memnew(Label(" " + TTR("Radius:") + " "));
+ uv_mode_hb->add_child(bone_paint_radius_label);
+ bone_paint_radius = memnew(SpinBox);
+ uv_mode_hb->add_child(bone_paint_radius);
+
+ bone_paint_strength->hide();
+ bone_paint_radius->hide();
+ bone_paint_radius_label->hide();
+ bone_paint_radius->set_min(1);
+ bone_paint_radius->set_max(100);
+ bone_paint_radius->set_step(1);
+ bone_paint_radius->set_value(32);
+
HBoxContainer *uv_main_hb = memnew(HBoxContainer);
uv_main_vb->add_child(uv_main_hb);
uv_edit_draw = memnew(Control);
@@ -645,6 +1151,8 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_menu->get_popup()->add_item(TTR("UV->Polygon"), UVEDIT_UV_TO_POLYGON);
uv_menu->get_popup()->add_separator();
uv_menu->get_popup()->add_item(TTR("Clear UV"), UVEDIT_UV_CLEAR);
+ uv_menu->get_popup()->add_separator();
+ uv_menu->get_popup()->add_item(TTR("Grid Settings"), UVEDIT_GRID_SETTINGS);
uv_menu->get_popup()->connect("id_pressed", this, "_menu_option");
uv_mode_hb->add_child(memnew(VSeparator));
@@ -667,8 +1175,11 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
b_snap_grid->set_tooltip(TTR("Show Grid"));
b_snap_grid->connect("toggled", this, "_set_show_grid");
- uv_mode_hb->add_child(memnew(VSeparator));
- uv_mode_hb->add_child(memnew(Label(TTR("Grid Offset:"))));
+ grid_settings = memnew(AcceptDialog);
+ grid_settings->set_title(TTR("Configure Grid:"));
+ add_child(grid_settings);
+ VBoxContainer *grid_settings_vb = memnew(VBoxContainer);
+ grid_settings->add_child(grid_settings_vb);
SpinBox *sb_off_x = memnew(SpinBox);
sb_off_x->set_min(-256);
@@ -677,7 +1188,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
sb_off_x->set_value(snap_offset.x);
sb_off_x->set_suffix("px");
sb_off_x->connect("value_changed", this, "_set_snap_off_x");
- uv_mode_hb->add_child(sb_off_x);
+ grid_settings_vb->add_margin_child(TTR("Grid Offset X:"), sb_off_x);
SpinBox *sb_off_y = memnew(SpinBox);
sb_off_y->set_min(-256);
@@ -686,10 +1197,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
sb_off_y->set_value(snap_offset.y);
sb_off_y->set_suffix("px");
sb_off_y->connect("value_changed", this, "_set_snap_off_y");
- uv_mode_hb->add_child(sb_off_y);
-
- uv_mode_hb->add_child(memnew(VSeparator));
- uv_mode_hb->add_child(memnew(Label(TTR("Grid Step:"))));
+ grid_settings_vb->add_margin_child(TTR("Grid Offset Y:"), sb_off_y);
SpinBox *sb_step_x = memnew(SpinBox);
sb_step_x->set_min(-256);
@@ -698,7 +1206,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
sb_step_x->set_value(snap_step.x);
sb_step_x->set_suffix("px");
sb_step_x->connect("value_changed", this, "_set_snap_step_x");
- uv_mode_hb->add_child(sb_step_x);
+ grid_settings_vb->add_margin_child(TTR("Grid Step X:"), sb_step_x);
SpinBox *sb_step_y = memnew(SpinBox);
sb_step_y->set_min(-256);
@@ -707,7 +1215,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
sb_step_y->set_value(snap_step.y);
sb_step_y->set_suffix("px");
sb_step_y->connect("value_changed", this, "_set_snap_step_y");
- uv_mode_hb->add_child(sb_step_y);
+ grid_settings_vb->add_margin_child(TTR("Grid Step Y:"), sb_step_y);
uv_mode_hb->add_child(memnew(VSeparator));
uv_icon_zoom = memnew(TextureRect);
@@ -717,8 +1225,10 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_zoom->set_max(4);
uv_zoom->set_value(1);
uv_zoom->set_step(0.01);
+ uv_zoom->set_v_size_flags(SIZE_SHRINK_CENTER);
+
uv_mode_hb->add_child(uv_zoom);
- uv_zoom->set_custom_minimum_size(Size2(200, 0));
+ uv_zoom->set_custom_minimum_size(Size2(80 * EDSCALE, 0));
uv_zoom_value = memnew(SpinBox);
uv_zoom->share(uv_zoom_value);
uv_zoom_value->set_custom_minimum_size(Size2(50, 0));
@@ -732,13 +1242,29 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_main_vb->add_child(uv_hscroll);
uv_hscroll->connect("value_changed", this, "_uv_scroll_changed");
+ bone_scroll_main_vb = memnew(VBoxContainer);
+ bone_scroll_main_vb->hide();
+ sync_bones = memnew(Button(TTR("Sync Bones to Polygon")));
+ bone_scroll_main_vb->add_child(sync_bones);
+ uv_main_hb->add_child(bone_scroll_main_vb);
+ bone_scroll = memnew(ScrollContainer);
+ bone_scroll->set_v_scroll(true);
+ bone_scroll->set_h_scroll(false);
+ bone_scroll_main_vb->add_child(bone_scroll);
+ bone_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
+ bone_scroll_vb = memnew(VBoxContainer);
+ bone_scroll->add_child(bone_scroll_vb);
+ sync_bones->connect("pressed", this, "_sync_bones");
+
uv_edit_draw->connect("draw", this, "_uv_draw");
uv_edit_draw->connect("gui_input", this, "_uv_input");
uv_draw_zoom = 1.0;
- uv_drag_index = -1;
+ point_drag_index = -1;
uv_drag = false;
- uv_create = true;
+ uv_create = false;
updating_uv_scroll = false;
+ split_create = false;
+ bone_painting = false;
error = memnew(AcceptDialog);
add_child(error);
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 2ea2082052..f9b42a21c2 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -32,7 +32,7 @@
#define POLYGON_2D_EDITOR_PLUGIN_H
#include "editor/plugins/abstract_polygon_2d_editor.h"
-
+#include "scene/gui/scroll_container.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -45,7 +45,8 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
MODE_EDIT_UV = MODE_CONT,
UVEDIT_POLYGON_TO_UV,
UVEDIT_UV_TO_POLYGON,
- UVEDIT_UV_CLEAR
+ UVEDIT_UV_CLEAR,
+ UVEDIT_GRID_SETTINGS
};
@@ -55,17 +56,21 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
UV_MODE_MOVE,
UV_MODE_ROTATE,
UV_MODE_SCALE,
+ UV_MODE_ADD_SPLIT,
+ UV_MODE_REMOVE_SPLIT,
+ UV_MODE_PAINT_WEIGHT,
+ UV_MODE_CLEAR_WEIGHT,
UV_MODE_MAX
};
- ToolButton *uv_edit_mode[2];
+ ToolButton *uv_edit_mode[4];
Ref<ButtonGroup> uv_edit_group;
Polygon2D *node;
UVMode uv_mode;
AcceptDialog *uv_edit;
- ToolButton *uv_button[5];
+ ToolButton *uv_button[UV_MODE_MAX];
ToolButton *b_snap_enable;
ToolButton *b_snap_grid;
Control *uv_edit_draw;
@@ -76,15 +81,35 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
MenuButton *uv_menu;
TextureRect *uv_icon_zoom;
+ VBoxContainer *bone_scroll_main_vb;
+ ScrollContainer *bone_scroll;
+ VBoxContainer *bone_scroll_vb;
+ Button *sync_bones;
+ HSlider *bone_paint_strength;
+ SpinBox *bone_paint_radius;
+ Label *bone_paint_radius_label;
+ bool bone_painting;
+ int bone_painting_bone;
+ PoolVector<float> prev_weights;
+ Vector2 bone_paint_pos;
+ AcceptDialog *grid_settings;
+
+ void _sync_bones();
+ void _update_bone_list();
+
Vector2 uv_draw_ofs;
float uv_draw_zoom;
- PoolVector<Vector2> uv_prev;
+ PoolVector<Vector2> points_prev;
PoolVector<Vector2> uv_create_uv_prev;
PoolVector<Vector2> uv_create_poly_prev;
+ Array uv_create_bones_prev;
+ PoolVector<int> splits_prev;
+
Vector2 uv_create_to;
- int uv_drag_index;
+ int point_drag_index;
bool uv_drag;
bool uv_create;
+ bool split_create;
UVMode uv_move_current;
Vector2 uv_drag_from;
bool updating_uv_scroll;
@@ -113,6 +138,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
void _set_snap_step_y(float p_val);
void _uv_edit_mode_select(int p_mode);
+ void _bone_paint_selected(int p_index);
protected:
virtual Node2D *_get_node() const;
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
new file mode 100644
index 0000000000..89c1b3a978
--- /dev/null
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -0,0 +1,293 @@
+#include "root_motion_editor_plugin.h"
+#include "editor/editor_node.h"
+#include "scene/main/viewport.h"
+
+void EditorPropertyRootMotion::_confirmed() {
+
+ TreeItem *ti = filters->get_selected();
+ if (!ti)
+ return;
+
+ NodePath path = ti->get_metadata(0);
+ emit_signal("property_changed", get_edited_property(), path);
+ update_property();
+ filter_dialog->hide(); //may come from activated
+}
+
+void EditorPropertyRootMotion::_node_assign() {
+
+ NodePath current = get_edited_object()->get(get_edited_property());
+
+ AnimationTree *atree = Object::cast_to<AnimationTree>(get_edited_object());
+ if (!atree->has_node(atree->get_animation_player())) {
+ EditorNode::get_singleton()->show_warning(TTR("AnimationTree has no path set to an AnimationPlayer"));
+ return;
+ }
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(atree->get_node(atree->get_animation_player()));
+ if (!player) {
+ EditorNode::get_singleton()->show_warning(TTR("Path to AnimationPlayer is invalid"));
+ return;
+ }
+
+ Node *base = player->get_node(player->get_root());
+
+ if (!base) {
+ EditorNode::get_singleton()->show_warning(TTR("Animation player has no valid root node path, so unable to retrieve track names."));
+ return;
+ }
+
+ Set<String> paths;
+ {
+ List<StringName> animations;
+ player->get_animation_list(&animations);
+
+ for (List<StringName>::Element *E = animations.front(); E; E = E->next()) {
+
+ Ref<Animation> anim = player->get_animation(E->get());
+ for (int i = 0; i < anim->get_track_count(); i++) {
+ paths.insert(anim->track_get_path(i));
+ }
+ }
+ }
+
+ filters->clear();
+ TreeItem *root = filters->create_item();
+
+ Map<String, TreeItem *> parenthood;
+
+ for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
+
+ NodePath path = E->get();
+ TreeItem *ti = NULL;
+ String accum;
+ for (int i = 0; i < path.get_name_count(); i++) {
+ String name = path.get_name(i);
+ if (accum != String()) {
+ accum += "/";
+ }
+ accum += name;
+ if (!parenthood.has(accum)) {
+ if (ti) {
+ ti = filters->create_item(ti);
+ } else {
+ ti = filters->create_item(root);
+ }
+ parenthood[accum] = ti;
+ ti->set_text(0, name);
+ ti->set_selectable(0, false);
+ ti->set_editable(0, false);
+
+ if (base->has_node(accum)) {
+ Node *node = base->get_node(accum);
+ if (has_icon(node->get_class(), "EditorIcons")) {
+ ti->set_icon(0, get_icon(node->get_class(), "EditorIcons"));
+ } else {
+ ti->set_icon(0, get_icon("Node", "EditorIcons"));
+ }
+ }
+
+ } else {
+ ti = parenthood[accum];
+ }
+ }
+
+ Node *node = NULL;
+ if (base->has_node(accum)) {
+ node = base->get_node(accum);
+ }
+ if (!node)
+ continue; //no node, cant edit
+
+ if (path.get_subname_count()) {
+
+ String concat = path.get_concatenated_subnames();
+
+ Skeleton *skeleton = Object::cast_to<Skeleton>(node);
+ if (skeleton && skeleton->find_bone(concat) != -1) {
+ //path in skeleton
+ String bone = concat;
+ int idx = skeleton->find_bone(bone);
+ List<String> bone_path;
+ while (idx != -1) {
+ bone_path.push_front(skeleton->get_bone_name(idx));
+ idx = skeleton->get_bone_parent(idx);
+ }
+
+ accum += ":";
+ for (List<String>::Element *F = bone_path.front(); F; F = F->next()) {
+ if (F != bone_path.front()) {
+ accum += "/";
+ }
+
+ accum += F->get();
+ if (!parenthood.has(accum)) {
+ ti = filters->create_item(ti);
+ parenthood[accum] = ti;
+ ti->set_text(0, F->get());
+ ti->set_selectable(0, true);
+ ti->set_editable(0, false);
+ ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons"));
+ ti->set_metadata(0, accum);
+ } else {
+ ti = parenthood[accum];
+ }
+ }
+
+ ti->set_selectable(0, true);
+ ti->set_text(0, concat);
+ ti->set_icon(0, get_icon("BoneAttachment", "EditorIcons"));
+ ti->set_metadata(0, path);
+ if (path == current) {
+ ti->select(0);
+ }
+
+ } else {
+ //just a property
+ ti = filters->create_item(ti);
+ ti->set_text(0, concat);
+ ti->set_selectable(0, true);
+ ti->set_metadata(0, path);
+ if (path == current) {
+ ti->select(0);
+ }
+ }
+ } else {
+ if (ti) {
+ //just a node, likely call or animation track
+ ti->set_selectable(0, true);
+ ti->set_metadata(0, path);
+ if (path == current) {
+ ti->select(0);
+ }
+ }
+ }
+ }
+
+ filters->ensure_cursor_is_visible();
+ filter_dialog->popup_centered_ratio();
+}
+
+void EditorPropertyRootMotion::_node_clear() {
+
+ emit_signal("property_changed", get_edited_property(), NodePath());
+ update_property();
+}
+
+void EditorPropertyRootMotion::update_property() {
+
+ NodePath p = get_edited_object()->get(get_edited_property());
+
+ assign->set_tooltip(p);
+ if (p == NodePath()) {
+ assign->set_icon(Ref<Texture>());
+ assign->set_text(TTR("Assign.."));
+ assign->set_flat(false);
+ return;
+ }
+ assign->set_flat(true);
+
+ Node *base_node = NULL;
+ if (base_hint != NodePath()) {
+ if (get_tree()->get_root()->has_node(base_hint)) {
+ base_node = get_tree()->get_root()->get_node(base_hint);
+ }
+ } else {
+ base_node = Object::cast_to<Node>(get_edited_object());
+ }
+
+ if (!base_node || !base_node->has_node(p)) {
+ assign->set_icon(Ref<Texture>());
+ assign->set_text(p);
+ return;
+ }
+
+ Node *target_node = base_node->get_node(p);
+ ERR_FAIL_COND(!target_node);
+
+ assign->set_text(target_node->get_name());
+
+ Ref<Texture> icon;
+ if (has_icon(target_node->get_class(), "EditorIcons"))
+ icon = get_icon(target_node->get_class(), "EditorIcons");
+ else
+ icon = get_icon("Node", "EditorIcons");
+
+ assign->set_icon(icon);
+}
+
+void EditorPropertyRootMotion::setup(const NodePath &p_base_hint) {
+
+ base_hint = p_base_hint;
+}
+
+void EditorPropertyRootMotion::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
+ Ref<Texture> t = get_icon("Clear", "EditorIcons");
+ clear->set_icon(t);
+ }
+}
+
+void EditorPropertyRootMotion::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_confirmed"), &EditorPropertyRootMotion::_confirmed);
+ ClassDB::bind_method(D_METHOD("_node_assign"), &EditorPropertyRootMotion::_node_assign);
+ ClassDB::bind_method(D_METHOD("_node_clear"), &EditorPropertyRootMotion::_node_clear);
+}
+
+EditorPropertyRootMotion::EditorPropertyRootMotion() {
+
+ HBoxContainer *hbc = memnew(HBoxContainer);
+ add_child(hbc);
+ assign = memnew(Button);
+ assign->set_flat(true);
+ assign->set_h_size_flags(SIZE_EXPAND_FILL);
+ assign->set_clip_text(true);
+ assign->connect("pressed", this, "_node_assign");
+ hbc->add_child(assign);
+
+ clear = memnew(Button);
+ clear->set_flat(true);
+ clear->connect("pressed", this, "_node_clear");
+ hbc->add_child(clear);
+
+ filter_dialog = memnew(ConfirmationDialog);
+ add_child(filter_dialog);
+ filter_dialog->set_title(TTR("Edit Filtered Tracks:"));
+ filter_dialog->connect("confirmed", this, "_confirmed");
+
+ filters = memnew(Tree);
+ filter_dialog->add_child(filters);
+ filters->set_v_size_flags(SIZE_EXPAND_FILL);
+ filters->set_hide_root(true);
+ filters->connect("item_activated", this, "_confirmed");
+ //filters->connect("item_edited", this, "_filter_edited");
+}
+//////////////////////////
+
+bool EditorInspectorRootMotionPlugin::can_handle(Object *p_object) {
+ return true; //can handle everything
+}
+
+void EditorInspectorRootMotionPlugin::parse_begin(Object *p_object) {
+ //do none
+}
+
+bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) {
+
+ if (p_path == "root_motion_track" && p_object->is_class("AnimationTree") && p_type == Variant::NODE_PATH) {
+ print_line("use custom!");
+ EditorPropertyRootMotion *editor = memnew(EditorPropertyRootMotion);
+ if (p_hint == PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE && p_hint_text != String()) {
+ editor->setup(p_hint_text);
+ }
+ add_property_editor(p_path, editor);
+ return true;
+ }
+
+ return false; //can be overriden, although it will most likely be last anyway
+}
+
+void EditorInspectorRootMotionPlugin::parse_end() {
+ //do none
+}
diff --git a/editor/plugins/root_motion_editor_plugin.h b/editor/plugins/root_motion_editor_plugin.h
new file mode 100644
index 0000000000..84af47872f
--- /dev/null
+++ b/editor/plugins/root_motion_editor_plugin.h
@@ -0,0 +1,42 @@
+#ifndef ROOT_MOTION_EDITOR_PLUGIN_H
+#define ROOT_MOTION_EDITOR_PLUGIN_H
+
+#include "editor/editor_inspector.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_selector.h"
+#include "scene/animation/animation_tree.h"
+
+class EditorPropertyRootMotion : public EditorProperty {
+ GDCLASS(EditorPropertyRootMotion, EditorProperty)
+ Button *assign;
+ Button *clear;
+ NodePath base_hint;
+
+ ConfirmationDialog *filter_dialog;
+ Tree *filters;
+
+ void _confirmed();
+ void _node_assign();
+ void _node_clear();
+
+protected:
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+ virtual void update_property();
+ void setup(const NodePath &p_base_hint);
+ EditorPropertyRootMotion();
+};
+
+class EditorInspectorRootMotionPlugin : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorRootMotionPlugin, EditorInspectorPlugin)
+
+public:
+ virtual bool can_handle(Object *p_object);
+ virtual void parse_begin(Object *p_object);
+ virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage);
+ virtual void parse_end();
+};
+
+#endif // ROOT_MOTION_EDITOR_PLUGIN_H
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 261bece8f7..aa4673f41e 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -39,9 +39,11 @@
#include "core/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
+#include "editor/find_in_files.h"
#include "editor/node_dock.h"
#include "editor/script_editor_debugger.h"
#include "scene/main/viewport.h"
+#include "script_text_editor.h"
/*** SCRIPT EDITOR ****/
@@ -54,6 +56,8 @@ void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("request_open_script_at_line", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::INT, "line")));
ADD_SIGNAL(MethodInfo("request_save_history"));
ADD_SIGNAL(MethodInfo("go_to_help", PropertyInfo(Variant::STRING, "what")));
+ // TODO This signal is no use for VisualScript...
+ ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text")));
}
static bool _can_open_in_editor(Script *p_script) {
@@ -298,15 +302,9 @@ void ScriptEditor::_script_created(Ref<Script> p_script) {
void ScriptEditor::_goto_script_line2(int p_line) {
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return;
-
- ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
- if (!current)
- return;
-
- current->goto_line(p_line);
+ ScriptEditorBase *current = _get_current_editor();
+ if (current)
+ current->goto_line(p_line);
}
void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
@@ -316,19 +314,22 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
if (edit(p_script, p_line, 0)) {
editor->push_item(p_script.ptr());
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return;
-
- ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
- if (!current)
- return;
-
- current->goto_line(p_line, true);
+ ScriptEditorBase *current = _get_current_editor();
+ if (current)
+ current->goto_line(p_line, true);
}
}
}
+ScriptEditorBase *ScriptEditor::_get_current_editor() const {
+
+ int selected = tab_container->get_current_tab();
+ if (selected < 0 || selected >= tab_container->get_child_count())
+ return NULL;
+
+ return Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
+}
+
void ScriptEditor::_update_history_arrows() {
script_back->set_disabled(history_pos <= 0);
@@ -587,7 +588,7 @@ void ScriptEditor::_close_docs_tab() {
}
void ScriptEditor::_copy_script_path() {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(tab_container->get_current_tab()));
+ ScriptEditorBase *se = _get_current_editor();
Ref<Script> script = se->get_edited_script();
OS::get_singleton()->set_clipboard(script->get_path());
}
@@ -803,12 +804,12 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) {
void ScriptEditor::_file_dialog_action(String p_file) {
switch (file_dialog_option) {
- case FILE_SAVE_THEME_AS: {
+ case THEME_SAVE_AS: {
if (!EditorSettings::get_singleton()->save_text_editor_theme_as(p_file)) {
editor->show_warning(TTR("Error while saving theme"), TTR("Error saving"));
}
} break;
- case FILE_IMPORT_THEME: {
+ case THEME_IMPORT: {
if (!EditorSettings::get_singleton()->import_text_editor_theme(p_file)) {
editor->show_warning(TTR("Error importing theme"), TTR("Error importing"));
}
@@ -819,11 +820,8 @@ void ScriptEditor::_file_dialog_action(String p_file) {
Ref<Script> ScriptEditor::_get_current_script() {
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return NULL;
+ ScriptEditorBase *current = _get_current_editor();
- ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
if (current) {
return current->get_edited_script();
} else {
@@ -861,33 +859,6 @@ void ScriptEditor::_menu_option(int p_option) {
save_all_scripts();
} break;
- case FILE_IMPORT_THEME: {
- file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
- file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
- file_dialog_option = FILE_IMPORT_THEME;
- file_dialog->clear_filters();
- file_dialog->add_filter("*.tet");
- file_dialog->popup_centered_ratio();
- file_dialog->set_title(TTR("Import Theme"));
- } break;
- case FILE_RELOAD_THEME: {
- EditorSettings::get_singleton()->load_text_editor_theme();
- } break;
- case FILE_SAVE_THEME: {
- if (!EditorSettings::get_singleton()->save_text_editor_theme()) {
- editor->show_warning(TTR("Error while saving theme"), TTR("Error saving"));
- }
- } break;
- case FILE_SAVE_THEME_AS: {
- file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
- file_dialog_option = FILE_SAVE_THEME_AS;
- file_dialog->clear_filters();
- file_dialog->add_filter("*.tet");
- file_dialog->set_current_path(EditorSettings::get_singleton()->get_text_editor_themes_dir().plus_file(EditorSettings::get_singleton()->get("text_editor/theme/color_theme")));
- file_dialog->popup_centered_ratio();
- file_dialog->set_title(TTR("Save Theme As.."));
- } break;
case SEARCH_HELP: {
help_search_dialog->popup();
@@ -939,11 +910,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
}
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return;
-
- ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
+ ScriptEditorBase *current = _get_current_editor();
if (current) {
switch (p_option) {
@@ -1033,7 +1000,7 @@ void ScriptEditor::_menu_option(int p_option) {
_copy_script_path();
} break;
case SHOW_IN_FILE_SYSTEM: {
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(tab_container->get_current_tab()));
+ ScriptEditorBase *se = _get_current_editor();
Ref<Script> script = se->get_edited_script();
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
file_system_dock->navigate_to_path(script->get_path());
@@ -1149,6 +1116,38 @@ void ScriptEditor::_menu_option(int p_option) {
}
}
+void ScriptEditor::_theme_option(int p_option) {
+ switch (p_option) {
+ case THEME_IMPORT: {
+ file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+ file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
+ file_dialog_option = THEME_IMPORT;
+ file_dialog->clear_filters();
+ file_dialog->add_filter("*.tet");
+ file_dialog->popup_centered_ratio();
+ file_dialog->set_title(TTR("Import Theme"));
+ } break;
+ case THEME_RELOAD: {
+ EditorSettings::get_singleton()->load_text_editor_theme();
+ } break;
+ case THEME_SAVE: {
+ if (!EditorSettings::get_singleton()->save_text_editor_theme()) {
+ editor->show_warning(TTR("Error while saving theme"), TTR("Error saving"));
+ }
+ } break;
+ case THEME_SAVE_AS: {
+ file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
+ file_dialog_option = THEME_SAVE_AS;
+ file_dialog->clear_filters();
+ file_dialog->add_filter("*.tet");
+ file_dialog->set_current_path(EditorSettings::get_singleton()->get_text_editor_themes_dir().plus_file(EditorSettings::get_singleton()->get("text_editor/theme/color_theme")));
+ file_dialog->popup_centered_ratio();
+ file_dialog->set_title(TTR("Save Theme As..."));
+ } break;
+ }
+}
+
void ScriptEditor::_tab_changed(int p_which) {
ensure_select_current();
@@ -1188,12 +1187,13 @@ void ScriptEditor::_notification(int p_what) {
script_forward->set_icon(get_icon("Forward", "EditorIcons"));
script_back->set_icon(get_icon("Back", "EditorIcons"));
+ members_overview_alphabeta_sort_button->set_icon(get_icon("Sort", "EditorIcons"));
} break;
case NOTIFICATION_READY: {
get_tree()->connect("tree_changed", this, "_tree_changed");
- editor->connect("request_help", this, "_request_help");
+ editor->get_inspector_dock()->connect("request_help", this, "_request_help");
editor->connect("request_help_search", this, "_help_search");
editor->connect("request_help_index", this, "_help_index");
} break;
@@ -1220,9 +1220,23 @@ void ScriptEditor::_notification(int p_what) {
script_forward->set_icon(get_icon("Forward", "EditorIcons"));
script_back->set_icon(get_icon("Back", "EditorIcons"));
+ members_overview_alphabeta_sort_button->set_icon(get_icon("Sort", "EditorIcons"));
+ filename->add_style_override("normal", editor->get_gui_base()->get_stylebox("normal", "LineEdit"));
+
recent_scripts->set_as_minsize();
} break;
+ case CanvasItem::NOTIFICATION_VISIBILITY_CHANGED: {
+
+ if (is_visible()) {
+ find_in_files_button->show();
+ } else {
+ find_in_files->hide();
+ find_in_files_button->hide();
+ }
+
+ } break;
+
default:
break;
}
@@ -1230,15 +1244,11 @@ void ScriptEditor::_notification(int p_what) {
bool ScriptEditor::can_take_away_focus() const {
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return true;
-
- ScriptEditorBase *current = Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
- if (!current)
+ ScriptEditorBase *current = _get_current_editor();
+ if (current)
+ return current->can_lose_focus_on_node_selection();
+ else
return true;
-
- return current->can_lose_focus_on_node_selection();
}
void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) {
@@ -1315,20 +1325,13 @@ void ScriptEditor::ensure_focus_current() {
if (!is_inside_tree())
return;
- int cidx = tab_container->get_current_tab();
- if (cidx < 0 || cidx >= tab_container->get_tab_count())
- return;
-
- Control *c = Object::cast_to<Control>(tab_container->get_child(cidx));
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(c);
- if (!se)
- return;
- se->ensure_focus();
+ ScriptEditorBase *current = _get_current_editor();
+ if (current)
+ current->ensure_focus();
}
void ScriptEditor::_members_overview_selected(int p_idx) {
- Node *current = tab_container->get_child(tab_container->get_current_tab());
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(current);
+ ScriptEditorBase *se = _get_current_editor();
if (!se) {
return;
}
@@ -1362,18 +1365,12 @@ void ScriptEditor::ensure_select_current() {
if (tab_container->get_child_count() && tab_container->get_current_tab() >= 0) {
- Node *current = tab_container->get_child(tab_container->get_current_tab());
-
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(current);
+ ScriptEditorBase *se = _get_current_editor();
if (se) {
- Ref<Script> script = se->get_edited_script();
-
if (!grab_focus_block && is_visible_in_tree())
se->ensure_focus();
}
-
- EditorHelp *eh = Object::cast_to<EditorHelp>(current);
}
_update_selected_editor_menu();
@@ -1413,42 +1410,52 @@ struct _ScriptEditorItemData {
void ScriptEditor::_update_members_overview_visibility() {
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return;
-
- Node *current = tab_container->get_child(tab_container->get_current_tab());
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(current);
+ ScriptEditorBase *se = _get_current_editor();
if (!se) {
+ members_overview_alphabeta_sort_button->set_visible(false);
members_overview->set_visible(false);
+ overview_vbox->set_visible(false);
return;
}
if (members_overview_enabled && se->show_members_overview()) {
+ members_overview_alphabeta_sort_button->set_visible(true);
members_overview->set_visible(true);
+ overview_vbox->set_visible(true);
} else {
+ members_overview_alphabeta_sort_button->set_visible(false);
members_overview->set_visible(false);
+ overview_vbox->set_visible(false);
}
}
+void ScriptEditor::_toggle_members_overview_alpha_sort(bool p_alphabetic_sort) {
+ EditorSettings::get_singleton()->set("text_editor/tools/sort_members_outline_alphabetically", p_alphabetic_sort);
+ _update_members_overview();
+}
+
void ScriptEditor::_update_members_overview() {
members_overview->clear();
- int selected = tab_container->get_current_tab();
- if (selected < 0 || selected >= tab_container->get_child_count())
- return;
-
- Node *current = tab_container->get_child(tab_container->get_current_tab());
- ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(current);
+ ScriptEditorBase *se = _get_current_editor();
if (!se) {
return;
}
Vector<String> functions = se->get_functions();
+ if (EditorSettings::get_singleton()->get("text_editor/tools/sort_members_outline_alphabetically")) {
+ functions.sort();
+ }
+
for (int i = 0; i < functions.size(); i++) {
members_overview->add_item(functions[i].get_slice(":", 0));
members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1);
}
+
+ String path = se->get_edited_script()->get_path();
+ bool built_in = !path.is_resource_file();
+ String name = built_in ? path.get_file() : se->get_name();
+ filename->set_text(name);
}
void ScriptEditor::_update_help_overview_visibility() {
@@ -1467,9 +1474,13 @@ void ScriptEditor::_update_help_overview_visibility() {
}
if (help_overview_enabled) {
+ members_overview_alphabeta_sort_button->set_visible(false);
help_overview->set_visible(true);
+ overview_vbox->set_visible(true);
+ filename->set_text(se->get_name());
} else {
help_overview->set_visible(false);
+ overview_vbox->set_visible(false);
}
}
@@ -1558,9 +1569,10 @@ void ScriptEditor::_update_script_names() {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
if (se) {
- String name = se->get_name();
Ref<Texture> icon = se->get_icon();
String path = se->get_edited_script()->get_path();
+ bool built_in = !path.is_resource_file();
+ String name = built_in ? path.get_file() : se->get_name();
_ScriptEditorItemData sd;
sd.icon = icon;
@@ -1778,6 +1790,20 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
}
ERR_FAIL_COND_V(!se, false);
+ bool highlighter_set = false;
+ for (int i = 0; i < syntax_highlighters_func_count; i++) {
+ SyntaxHighlighter *highlighter = syntax_highlighters_funcs[i]();
+ se->add_syntax_highlighter(highlighter);
+
+ if (!highlighter_set) {
+ List<String> languages = highlighter->get_supported_languages();
+ if (languages.find(p_script->get_language()->get_name())) {
+ se->set_syntax_highlighter(highlighter);
+ highlighter_set = true;
+ }
+ }
+ }
+
tab_container->add_child(se);
se->set_edited_script(p_script);
se->set_tooltip_request_func("_get_debug_tooltip", this);
@@ -1799,6 +1825,7 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
se->connect("request_open_script_at_line", this, "_goto_script_line");
se->connect("go_to_help", this, "_help_class_goto");
se->connect("request_save_history", this, "_save_history");
+ se->connect("search_in_files_requested", this, "_on_find_in_files_requested");
//test for modification, maybe the script was not edited but was loaded
@@ -2494,6 +2521,14 @@ void ScriptEditor::_open_script_request(const String &p_path) {
}
}
+int ScriptEditor::syntax_highlighters_func_count = 0;
+CreateSyntaxHighlighterFunc ScriptEditor::syntax_highlighters_funcs[ScriptEditor::SYNTAX_HIGHLIGHTER_FUNC_MAX];
+
+void ScriptEditor::register_create_syntax_highlighter_function(CreateSyntaxHighlighterFunc p_func) {
+ ERR_FAIL_COND(syntax_highlighters_func_count == SYNTAX_HIGHLIGHTER_FUNC_MAX);
+ syntax_highlighters_funcs[syntax_highlighters_func_count++] = p_func;
+}
+
int ScriptEditor::script_editor_func_count = 0;
CreateScriptEditorFunc ScriptEditor::script_editor_funcs[ScriptEditor::SCRIPT_EDITOR_FUNC_MAX];
@@ -2508,6 +2543,48 @@ void ScriptEditor::_script_changed() {
NodeDock::singleton->update_lists();
}
+void ScriptEditor::_on_find_in_files_requested(String text) {
+
+ find_in_files_dialog->set_search_text(text);
+ find_in_files_dialog->popup_centered_minsize();
+}
+
+void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) {
+
+ Ref<Resource> res = ResourceLoader::load(fpath);
+ edit(res);
+
+ ScriptEditorBase *seb = _get_current_editor();
+
+ ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(seb);
+ if (ste) {
+ ste->goto_line_selection(line_number - 1, begin, end);
+ }
+}
+
+void ScriptEditor::_start_find_in_files(bool with_replace) {
+
+ FindInFiles *f = find_in_files->get_finder();
+
+ f->set_search_text(find_in_files_dialog->get_search_text());
+ f->set_match_case(find_in_files_dialog->is_match_case());
+ f->set_whole_words(find_in_files_dialog->is_match_case());
+ f->set_folder(find_in_files_dialog->get_folder());
+ f->set_filter(find_in_files_dialog->get_filter());
+
+ find_in_files->set_with_replace(with_replace);
+ find_in_files->start_search();
+
+ find_in_files_button->set_pressed(true);
+ find_in_files->show();
+}
+
+void ScriptEditor::_on_find_in_files_modified_files(PoolStringArray paths) {
+
+ _test_script_times_on_disk();
+ _update_modified_scripts_for_external_editor();
+}
+
void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action);
@@ -2519,6 +2596,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_close_all_tabs", &ScriptEditor::_close_all_tabs);
ClassDB::bind_method("_close_other_tabs", &ScriptEditor::_close_other_tabs);
ClassDB::bind_method("_open_recent_script", &ScriptEditor::_open_recent_script);
+ ClassDB::bind_method("_theme_option", &ScriptEditor::_theme_option);
ClassDB::bind_method("_editor_play", &ScriptEditor::_editor_play);
ClassDB::bind_method("_editor_pause", &ScriptEditor::_editor_pause);
ClassDB::bind_method("_editor_stop", &ScriptEditor::_editor_stop);
@@ -2553,8 +2631,14 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
ClassDB::bind_method("_script_list_gui_input", &ScriptEditor::_script_list_gui_input);
+ ClassDB::bind_method("_toggle_members_overview_alpha_sort", &ScriptEditor::_toggle_members_overview_alpha_sort);
+ ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed);
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);
+ ClassDB::bind_method("_on_find_in_files_requested", &ScriptEditor::_on_find_in_files_requested);
+ ClassDB::bind_method("_start_find_in_files", &ScriptEditor::_start_find_in_files);
+ ClassDB::bind_method("_on_find_in_files_result_selected", &ScriptEditor::_on_find_in_files_result_selected);
+ ClassDB::bind_method("_on_find_in_files_modified_files", &ScriptEditor::_on_find_in_files_modified_files);
ClassDB::bind_method(D_METHOD("get_drag_data_fw", "point", "from"), &ScriptEditor::get_drag_data_fw);
ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &ScriptEditor::can_drop_data_fw);
@@ -2577,8 +2661,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
waiting_update_names = false;
pending_auto_reload = false;
auto_reload_running_scripts = false;
- members_overview_enabled = true;
- help_overview_enabled = true;
+ members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/show_members_overview");
+ help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index");
editor = p_editor;
VBoxContainer *main_container = memnew(VBoxContainer);
@@ -2609,14 +2693,39 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
add_child(context_menu);
context_menu->connect("id_pressed", this, "_menu_option");
+ overview_vbox = memnew(VBoxContainer);
+ overview_vbox->set_custom_minimum_size(Size2(0, 90));
+ overview_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ list_split->add_child(overview_vbox);
+ buttons_hbox = memnew(HBoxContainer);
+ overview_vbox->add_child(buttons_hbox);
+
+ filename = memnew(Label);
+ filename->set_clip_text(true);
+ filename->set_h_size_flags(SIZE_EXPAND_FILL);
+ filename->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit"));
+ buttons_hbox->add_child(filename);
+
+ members_overview_alphabeta_sort_button = memnew(ToolButton);
+ members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list."));
+ members_overview_alphabeta_sort_button->set_toggle_mode(true);
+ members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/tools/sort_members_outline_alphabetically"));
+ members_overview_alphabeta_sort_button->connect("toggled", this, "_toggle_members_overview_alpha_sort");
+
+ buttons_hbox->add_child(members_overview_alphabeta_sort_button);
+
members_overview = memnew(ItemList);
- list_split->add_child(members_overview);
+ overview_vbox->add_child(members_overview);
+
members_overview->set_allow_reselect(true);
members_overview->set_custom_minimum_size(Size2(0, 90)); //need to give a bit of limit to avoid it from disappearing
members_overview->set_v_size_flags(SIZE_EXPAND_FILL);
+ members_overview->set_allow_rmb_select(true);
+ members_overview->set_drag_forwarding(this);
help_overview = memnew(ItemList);
- list_split->add_child(help_overview);
+ overview_vbox->add_child(help_overview);
help_overview->set_allow_reselect(true);
help_overview->set_custom_minimum_size(Size2(0, 90)); //need to give a bit of limit to avoid it from disappearing
help_overview->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -2649,7 +2758,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KEY_MASK_ALT | KEY_MASK_CMD | KEY_S), FILE_SAVE);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As..")), FILE_SAVE_AS);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As...")), FILE_SAVE_AS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_S), FILE_SAVE_ALL);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTR("Soft Reload Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R), FILE_TOOL_RELOAD_SOFT);
@@ -2660,10 +2769,18 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_ALT | KEY_LEFT), WINDOW_PREV);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_ALT | KEY_RIGHT), WINDOW_NEXT);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme")), FILE_IMPORT_THEME);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), FILE_RELOAD_THEME);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_theme", TTR("Save Theme")), FILE_SAVE_THEME);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTR("Save Theme As")), FILE_SAVE_THEME_AS);
+
+ file_menu->get_popup()->add_submenu_item(TTR("Theme"), "Theme", FILE_THEME);
+
+ theme_submenu = memnew(PopupMenu);
+ theme_submenu->set_name("Theme");
+ file_menu->get_popup()->add_child(theme_submenu);
+ theme_submenu->connect("id_pressed", this, "_theme_option");
+ theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme")), THEME_IMPORT);
+ theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), THEME_RELOAD);
+ theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/save_theme", TTR("Save Theme")), THEME_SAVE);
+ theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTR("Save Theme As")), THEME_SAVE_AS);
+
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE);
@@ -2678,7 +2795,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_search_menu = memnew(MenuButton);
menu_hb->add_child(script_search_menu);
script_search_menu->set_text(TTR("Search"));
- script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
+ script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
script_search_menu->get_popup()->connect("id_pressed", this, "_menu_option");
script_search_menu->hide();
@@ -2767,7 +2884,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
error_dialog = memnew(AcceptDialog);
add_child(error_dialog);
- error_dialog->get_ok()->set_text(TTR("I see.."));
+ error_dialog->get_ok()->set_text(TTR("I see..."));
debugger = memnew(ScriptEditorDebugger(editor));
debugger->connect("goto_script_line", this, "_goto_script_line");
@@ -2816,13 +2933,26 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
add_child(help_index);
help_index->connect("open_class", this, "_help_class_open");
+ find_in_files_dialog = memnew(FindInFilesDialog);
+ find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_FIND_REQUESTED, this, "_start_find_in_files", varray(false));
+ find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, this, "_start_find_in_files", varray(true));
+ add_child(find_in_files_dialog);
+ find_in_files = memnew(FindInFilesPanel);
+ find_in_files_button = editor->add_bottom_panel_item(TTR("Search results"), find_in_files);
+ find_in_files_button->set_tooltip(TTR("Search in files"));
+ find_in_files->set_custom_minimum_size(Size2(0, 200));
+ find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, this, "_on_find_in_files_result_selected");
+ find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, this, "_on_find_in_files_modified_files");
+ find_in_files->hide();
+ find_in_files_button->hide();
+
history_pos = -1;
//debugger_gui->hide();
edit_pass = 0;
- trim_trailing_whitespace_on_save = false;
- convert_indent_on_save = false;
- use_space_indentation = false;
+ trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/files/trim_trailing_whitespace_on_save");
+ convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/indent/convert_indent_on_save");
+ use_space_indentation = EditorSettings::get_singleton()->get("text_editor/indent/type");
ScriptServer::edit_request_func = _open_script_request;
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index bcc604d990..67f506fdda 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -80,6 +80,9 @@ protected:
static void _bind_methods();
public:
+ virtual void add_syntax_highlighter(SyntaxHighlighter *p_highlighter) = 0;
+ virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter) = 0;
+
virtual void apply_code() = 0;
virtual Ref<Script> get_edited_script() const = 0;
virtual Vector<String> get_functions() = 0;
@@ -112,9 +115,12 @@ public:
ScriptEditorBase() {}
};
+typedef SyntaxHighlighter *(*CreateSyntaxHighlighterFunc)();
typedef ScriptEditorBase *(*CreateScriptEditorFunc)(const Ref<Script> &p_script);
class EditorScriptCodeCompletionCache;
+class FindInFilesDialog;
+class FindInFilesPanel;
class ScriptEditor : public PanelContainer {
@@ -128,10 +134,7 @@ class ScriptEditor : public PanelContainer {
FILE_SAVE,
FILE_SAVE_AS,
FILE_SAVE_ALL,
- FILE_IMPORT_THEME,
- FILE_RELOAD_THEME,
- FILE_SAVE_THEME,
- FILE_SAVE_THEME_AS,
+ FILE_THEME,
FILE_RUN,
FILE_CLOSE,
CLOSE_DOCS,
@@ -162,6 +165,13 @@ class ScriptEditor : public PanelContainer {
WINDOW_SELECT_BASE = 100
};
+ enum {
+ THEME_IMPORT,
+ THEME_RELOAD,
+ THEME_SAVE,
+ THEME_SAVE_AS
+ };
+
enum ScriptSortBy {
SORT_BY_NAME,
SORT_BY_PATH,
@@ -184,6 +194,7 @@ class ScriptEditor : public PanelContainer {
uint64_t idle;
PopupMenu *recent_scripts;
+ PopupMenu *theme_submenu;
Button *help_search;
Button *site_search;
@@ -193,6 +204,10 @@ class ScriptEditor : public PanelContainer {
ItemList *script_list;
HSplitContainer *script_split;
ItemList *members_overview;
+ VBoxContainer *overview_vbox;
+ HBoxContainer *buttons_hbox;
+ Label *filename;
+ ToolButton *members_overview_alphabeta_sort_button;
bool members_overview_enabled;
ItemList *help_overview;
bool help_overview_enabled;
@@ -213,13 +228,21 @@ class ScriptEditor : public PanelContainer {
ToolButton *script_back;
ToolButton *script_forward;
+ FindInFilesDialog *find_in_files_dialog;
+ FindInFilesPanel *find_in_files;
+ Button *find_in_files_button;
+
enum {
- SCRIPT_EDITOR_FUNC_MAX = 32
+ SCRIPT_EDITOR_FUNC_MAX = 32,
+ SYNTAX_HIGHLIGHTER_FUNC_MAX = 32
};
static int script_editor_func_count;
static CreateScriptEditorFunc script_editor_funcs[SCRIPT_EDITOR_FUNC_MAX];
+ static int syntax_highlighters_func_count;
+ static CreateSyntaxHighlighterFunc syntax_highlighters_funcs[SYNTAX_HIGHLIGHTER_FUNC_MAX];
+
struct ScriptHistory {
Control *control;
@@ -233,6 +256,7 @@ class ScriptEditor : public PanelContainer {
void _tab_changed(int p_which);
void _menu_option(int p_option);
+ void _theme_option(int p_option);
Tree *disk_changed_list;
ConfirmationDialog *disk_changed;
@@ -296,12 +320,15 @@ class ScriptEditor : public PanelContainer {
void _update_window_menu();
void _script_created(Ref<Script> p_script);
+ ScriptEditorBase *_get_current_editor() const;
+
void _save_layout();
void _editor_settings_changed();
void _autosave_scripts();
void _update_members_overview_visibility();
void _update_members_overview();
+ void _toggle_members_overview_alpha_sort(bool p_alphabetic_sort);
void _update_script_names();
bool _sort_list_on_update;
@@ -351,6 +378,11 @@ class ScriptEditor : public PanelContainer {
Ref<Script> _get_current_script();
Array _get_open_scripts() const;
+ void _on_find_in_files_requested(String text);
+ void _on_find_in_files_result_selected(String fpath, int line_number, int begin, int end);
+ void _start_find_in_files(bool with_replace);
+ void _on_find_in_files_modified_files(PoolStringArray paths);
+
static void _open_script_request(const String &p_path);
static ScriptEditor *script_editor;
@@ -399,7 +431,9 @@ public:
ScriptEditorDebugger *get_debugger() { return debugger; }
void set_live_auto_reload_running_scripts(bool p_enabled);
+ static void register_create_syntax_highlighter_function(CreateSyntaxHighlighterFunc p_func);
static void register_create_script_editor_function(CreateScriptEditorFunc p_func);
+
ScriptEditor(EditorNode *p_editor);
~ScriptEditor();
};
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index aeba0ff930..345c7c06eb 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -349,7 +349,12 @@ void ScriptTextEditor::_convert_case(CaseStyle p_case) {
int end_col = te->get_selection_to_column();
for (int i = begin; i <= end; i++) {
- String new_line = te->get_line(i);
+ int len = te->get_line(i).length();
+ if (i == end)
+ len -= len - end_col;
+ if (i == begin)
+ len -= begin_col;
+ String new_line = te->get_line(i).substr(i == begin ? begin_col : 0, len);
switch (p_case) {
case UPPER: {
@@ -364,10 +369,10 @@ void ScriptTextEditor::_convert_case(CaseStyle p_case) {
}
if (i == begin) {
- new_line = te->get_line(i).left(begin_col) + new_line.right(begin_col);
+ new_line = te->get_line(i).left(begin_col) + new_line;
}
if (i == end) {
- new_line = new_line.left(end_col) + te->get_line(i).right(end_col);
+ new_line = new_line + te->get_line(i).right(end_col);
}
te->set_line(i, new_line);
}
@@ -524,6 +529,14 @@ void ScriptTextEditor::goto_line(int p_line, bool p_with_error) {
tx->call_deferred("cursor_set_line", p_line);
}
+void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
+ TextEdit *tx = code_editor->get_text_edit();
+ tx->unfold_line(p_line);
+ tx->call_deferred("cursor_set_line", p_line);
+ tx->call_deferred("cursor_set_column", p_begin);
+ tx->select(p_line, p_begin, p_line, p_end);
+}
+
void ScriptTextEditor::ensure_focus() {
code_editor->get_text_edit()->grab_focus();
@@ -568,6 +581,7 @@ void ScriptTextEditor::set_edited_script(const Ref<Script> &p_script) {
ERR_FAIL_COND(!script.is_null());
script = p_script;
+ _set_theme_for_script();
code_editor->get_text_edit()->set_text(script->get_source_code());
code_editor->get_text_edit()->clear_undo_history();
@@ -575,8 +589,6 @@ void ScriptTextEditor::set_edited_script(const Ref<Script> &p_script) {
emit_signal("name_changed");
code_editor->update_line_and_column();
-
- _set_theme_for_script();
}
void ScriptTextEditor::_validate_script() {
@@ -734,6 +746,8 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
_goto_line(p_row);
+ result.class_name = result.class_name.trim_prefix("_");
+
switch (result.type) {
case ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION: {
@@ -784,6 +798,26 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c
emit_signal("go_to_help", "class_method:" + result.class_name + ":" + result.class_member);
} break;
+ case ScriptLanguage::LookupResult::RESULT_CLASS_ENUM: {
+
+ StringName cname = result.class_name;
+ StringName success;
+ while (true) {
+ success = ClassDB::get_integer_constant_enum(cname, result.class_member, true);
+ if (success != StringName()) {
+ result.class_name = cname;
+ cname = ClassDB::get_parent_class(cname);
+ } else {
+ break;
+ }
+ }
+
+ emit_signal("go_to_help", "class_enum:" + result.class_name + ":" + result.class_member);
+
+ } break;
+ case ScriptLanguage::LookupResult::RESULT_CLASS_TBD_GLOBALSCOPE: {
+ emit_signal("go_to_help", "class_global:" + result.class_name + ":" + result.class_member);
+ } break;
}
}
}
@@ -975,6 +1009,10 @@ void ScriptTextEditor::_edit_option(int p_op) {
}
int next_line = to_line + 1;
+ if (to_line >= tx->get_line_count() - 1) {
+ tx->set_line(to_line, tx->get_line(to_line) + "\n");
+ }
+
tx->begin_complex_operation();
for (int i = from_line; i <= to_line; i++) {
@@ -1149,6 +1187,15 @@ void ScriptTextEditor::_edit_option(int p_op) {
code_editor->get_find_replace_bar()->popup_replace();
} break;
+ case SEARCH_IN_FILES: {
+
+ String selected_text = code_editor->get_text_edit()->get_selection_text();
+
+ // Yep, because it doesn't make sense to instance this dialog for every single script open...
+ // So this will be delegated to the ScriptEditor
+ emit_signal("search_in_files_requested", selected_text);
+
+ } break;
case SEARCH_LOCATE_FUNCTION: {
quick_open->popup(get_functions());
@@ -1240,11 +1287,36 @@ void ScriptTextEditor::_edit_option(int p_op) {
}
}
+void ScriptTextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
+ highlighters[p_highlighter->get_name()] = p_highlighter;
+ highlighter_menu->add_radio_check_item(p_highlighter->get_name());
+}
+
+void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
+ TextEdit *te = code_editor->get_text_edit();
+ te->_set_syntax_highlighting(p_highlighter);
+ if (p_highlighter != NULL)
+ highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(p_highlighter->get_name()), true);
+ else
+ highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text("Standard"), true);
+}
+
+void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
+ Map<String, SyntaxHighlighter *>::Element *el = highlighters.front();
+ while (el != NULL) {
+ highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false);
+ el = el->next();
+ }
+ // highlighter_menu->set_item_checked(p_idx, true);
+ set_syntax_highlighter(highlighters[highlighter_menu->get_item_text(p_idx)]);
+}
+
void ScriptTextEditor::_bind_methods() {
ClassDB::bind_method("_validate_script", &ScriptTextEditor::_validate_script);
ClassDB::bind_method("_load_theme_settings", &ScriptTextEditor::_load_theme_settings);
ClassDB::bind_method("_breakpoint_toggled", &ScriptTextEditor::_breakpoint_toggled);
+ ClassDB::bind_method("_change_syntax_highlighter", &ScriptTextEditor::_change_syntax_highlighter);
ClassDB::bind_method("_edit_option", &ScriptTextEditor::_edit_option);
ClassDB::bind_method("_goto_line", &ScriptTextEditor::_goto_line);
ClassDB::bind_method("_lookup_symbol", &ScriptTextEditor::_lookup_symbol);
@@ -1604,6 +1676,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT);
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT);
edit_menu->get_popup()->add_separator();
+
PopupMenu *convert_case = memnew(PopupMenu);
convert_case->set_name("convert_case");
edit_menu->get_popup()->add_child(convert_case);
@@ -1613,6 +1686,14 @@ ScriptTextEditor::ScriptTextEditor() {
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", this, "_edit_option");
+ highlighters["Standard"] = NULL;
+ highlighter_menu = memnew(PopupMenu);
+ highlighter_menu->set_name("highlighter_menu");
+ edit_menu->get_popup()->add_child(highlighter_menu);
+ edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu");
+ highlighter_menu->add_radio_check_item(TTR("Standard"));
+ highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter");
+
search_menu = memnew(MenuButton);
edit_hb->add_child(search_menu);
search_menu->set_text(TTR("Search"));
@@ -1621,6 +1702,8 @@ ScriptTextEditor::ScriptTextEditor() {
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
search_menu->get_popup()->add_separator();
+ search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_in_files"), SEARCH_IN_FILES);
+ search_menu->get_popup()->add_separator();
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_function"), SEARCH_LOCATE_FUNCTION);
search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);
search_menu->get_popup()->add_separator();
@@ -1655,7 +1738,7 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD | KEY_A);
ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT | KEY_UP);
ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT | KEY_DOWN);
- ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_K);
+ ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K);
//leave these at zero, same can be accomplished with tab/shift-tab, including selection
//the next/previous in history shortcut in this case makes a lot more sene.
@@ -1668,34 +1751,48 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), 0);
#ifdef OSX_ENABLED
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
- ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CTRL | KEY_SPACE);
#else
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_B);
- ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
#endif
- ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CTRL | KEY_MASK_ALT | KEY_T);
- ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_Y);
- ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_X);
+ ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE);
+ ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
+ ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
+ ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X);
ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I);
+#ifdef OSX_ENABLED
+ ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
+#else
ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
- ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_F9);
- ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Goto Next Breakpoint"), KEY_MASK_CTRL | KEY_PERIOD);
- ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Goto Previous Breakpoint"), KEY_MASK_CTRL | KEY_COMMA);
+#endif
+ ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F9);
+ ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Goto Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
+ ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Goto Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Convert To Uppercase"), KEY_MASK_SHIFT | KEY_F4);
ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Convert To Lowercase"), KEY_MASK_SHIFT | KEY_F3);
ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F2);
- ED_SHORTCUT("script_text_editor/find", TTR("Find.."), KEY_MASK_CMD | KEY_F);
+ ED_SHORTCUT("script_text_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F);
+#ifdef OSX_ENABLED
+ ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_MASK_CMD | KEY_G);
+ ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G);
+#else
ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_F3);
ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3);
- ED_SHORTCUT("script_text_editor/replace", TTR("Replace.."), KEY_MASK_CMD | KEY_R);
+#endif
+ ED_SHORTCUT("script_text_editor/replace", TTR("Replace..."), KEY_MASK_CMD | KEY_R);
+
+ ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
- ED_SHORTCUT("script_text_editor/goto_function", TTR("Goto Function.."), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_F);
- ED_SHORTCUT("script_text_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD | KEY_L);
+ ED_SHORTCUT("script_text_editor/goto_function", TTR("Goto Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
+ ED_SHORTCUT("script_text_editor/goto_line", TTR("Goto Line..."), KEY_MASK_CMD | KEY_L);
+#ifdef OSX_ENABLED
+ ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);
+#else
ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_SHIFT | KEY_F1);
+#endif
ScriptEditor::register_create_script_editor_function(create_editor);
}
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 22e8fbce25..a415f478e8 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -50,6 +50,7 @@ class ScriptTextEditor : public ScriptEditorBase {
MenuButton *edit_menu;
MenuButton *search_menu;
+ PopupMenu *highlighter_menu;
PopupMenu *context_menu;
GotoLineDialog *goto_line_dialog;
@@ -105,6 +106,7 @@ class ScriptTextEditor : public ScriptEditorBase {
SEARCH_REPLACE,
SEARCH_LOCATE_FUNCTION,
SEARCH_GOTO_LINE,
+ SEARCH_IN_FILES,
DEBUG_TOGGLE_BREAKPOINT,
DEBUG_REMOVE_ALL_BREAKPOINTS,
DEBUG_GOTO_NEXT_BREAKPOINT,
@@ -125,6 +127,9 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+ Map<String, SyntaxHighlighter *> highlighters;
+ void _change_syntax_highlighter(int p_idx);
+
void _edit_option(int p_op);
void _make_context_menu(bool p_selection, bool p_color, bool p_can_fold, bool p_is_folded);
void _text_edit_gui_input(const Ref<InputEvent> &ev);
@@ -145,6 +150,9 @@ protected:
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
public:
+ virtual void add_syntax_highlighter(SyntaxHighlighter *p_highlighter);
+ virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter);
+
virtual void apply_code();
virtual Ref<Script> get_edited_script() const;
virtual Vector<String> get_functions();
@@ -163,6 +171,7 @@ public:
virtual void tag_saved_version();
virtual void goto_line(int p_line, bool p_with_error = false);
+ void goto_line_selection(int p_line, int p_begin, int p_end);
virtual void reload(bool p_soft);
virtual void get_breakpoints(List<int> *p_breakpoints);
diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp
index 59085c203f..1a9d980feb 100644
--- a/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/editor/plugins/shader_graph_editor_plugin.cpp
@@ -1478,7 +1478,7 @@ void ShaderGraphView::_create_node(int p_id) {
case ShaderGraph::NODE_XFORM_CONST: {
gn->set_title("XForm");
ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit..");
+ edit->set_text("edit...");
edit->connect("pressed",this,"_xform_const_changed",varray(p_id,edit));
gn->add_child(edit);
gn->set_slot(0,false,0,Color(),true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]);
@@ -2289,7 +2289,7 @@ void ShaderGraphView::_create_node(int p_id) {
le->set_text(graph->input_node_get_name(type,p_id));
le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit..");
+ edit->set_text("edit...");
edit->connect("pressed",this,"_xform_input_changed",varray(p_id,edit));
gn->add_child(edit);
gn->set_slot(1,false,0,Color(),true,ShaderGraph::SLOT_TYPE_XFORM,typecol[ShaderGraph::SLOT_TYPE_XFORM]);
@@ -2310,7 +2310,7 @@ void ShaderGraphView::_create_node(int p_id) {
tex->set_mouse_filter(MOUSE_FILTER_PASS);
tex->set_texture(graph->texture_input_node_get_value(type,p_id));
ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit..");
+ edit->set_text("edit...");
edit->connect("pressed",this,"_tex_edited",varray(p_id,edit));
gn->add_child(edit);
@@ -2345,7 +2345,7 @@ void ShaderGraphView::_create_node(int p_id) {
le->connect("text_entered",this,"_input_name_changed",varray(p_id,le));
ToolButton *edit = memnew( ToolButton );
- edit->set_text("edit..");
+ edit->set_text("edit...");
edit->connect("pressed",this,"_cube_edited",varray(p_id,edit));
gn->add_child(edit);
@@ -2769,8 +2769,6 @@ void ShaderGraphEditor::_popup_requested(const Vector2 &p_position)
popup->set_global_position(p_position);
popup->set_size( Size2( 200, 0) );
popup->popup();
- popup->call_deferred("grab_click_focus");
- popup->set_invalidate_click_until_motion();
}
void ShaderGraphEditor::_notification(int p_what) {
diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp
index 6bf94b95eb..08bfebefbd 100644
--- a/editor/plugins/skeleton_2d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_2d_editor_plugin.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* skeleton_2d_editor_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "skeleton_2d_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
@@ -20,6 +50,10 @@ void Skeleton2DEditor::edit(Skeleton2D *p_sprite) {
void Skeleton2DEditor::_menu_option(int p_option) {
+ if (!node) {
+ return;
+ }
+
switch (p_option) {
case MENU_OPTION_MAKE_REST: {
@@ -107,6 +141,7 @@ Skeleton2DEditorPlugin::Skeleton2DEditorPlugin(EditorNode *p_node) {
editor = p_node;
sprite_editor = memnew(Skeleton2DEditor);
editor->get_viewport()->add_child(sprite_editor);
+ make_visible(false);
//sprite_editor->options->hide();
}
diff --git a/editor/plugins/skeleton_2d_editor_plugin.h b/editor/plugins/skeleton_2d_editor_plugin.h
index bbe2a3a6f2..26ab4328b0 100644
--- a/editor/plugins/skeleton_2d_editor_plugin.h
+++ b/editor/plugins/skeleton_2d_editor_plugin.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* skeleton_2d_editor_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef SKELETON_2D_EDITOR_PLUGIN_H
#define SKELETON_2D_EDITOR_PLUGIN_H
diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp
new file mode 100644
index 0000000000..40a696119e
--- /dev/null
+++ b/editor/plugins/skeleton_editor_plugin.cpp
@@ -0,0 +1,183 @@
+/*************************************************************************/
+/* skeleton_editor_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "skeleton_editor_plugin.h"
+#include "scene/3d/collision_shape.h"
+#include "scene/3d/physics_body.h"
+#include "scene/3d/physics_joint.h";
+#include "scene/resources/capsule_shape.h"
+#include "scene/resources/sphere_shape.h"
+#include "spatial_editor_plugin.h"
+
+void SkeletonEditor::_on_click_option(int p_option) {
+ if (!skeleton) {
+ return;
+ }
+
+ switch (p_option) {
+ case MENU_OPTION_CREATE_PHYSICAL_SKELETON: {
+ create_physical_skeleton();
+ } break;
+ }
+}
+
+void SkeletonEditor::create_physical_skeleton() {
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ Node *owner = skeleton == get_tree()->get_edited_scene_root() ? skeleton : skeleton->get_owner();
+
+ const int bc = skeleton->get_bone_count();
+
+ if (!bc) {
+ return;
+ }
+
+ Vector<BoneInfo> bones_infos;
+ bones_infos.resize(bc);
+
+ for (int bone_id = 0; bc > bone_id; ++bone_id) {
+
+ const int parent = skeleton->get_bone_parent(bone_id);
+ const int parent_parent = skeleton->get_bone_parent(parent);
+
+ if (parent < 0) {
+
+ bones_infos[bone_id].relative_rest = skeleton->get_bone_rest(bone_id);
+
+ } else {
+
+ bones_infos[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) {
+
+ bones_infos[parent].physical_bone = create_physical_bone(parent, bone_id, bones_infos);
+
+ ur->create_action(TTR("Create physical bones"));
+ ur->add_do_method(skeleton, "add_child", bones_infos[parent].physical_bone);
+ ur->add_do_reference(bones_infos[parent].physical_bone);
+ ur->add_undo_method(skeleton, "remove_child", bones_infos[parent].physical_bone);
+ ur->commit_action();
+
+ bones_infos[parent].physical_bone->set_bone_name(skeleton->get_bone_name(parent));
+ bones_infos[parent].physical_bone->set_owner(owner);
+ bones_infos[parent].physical_bone->get_child(0)->set_owner(owner); // set shape owner
+
+ /// Create joint between parent of parent
+ if (-1 != parent_parent) {
+
+ bones_infos[parent].physical_bone->set_joint_type(PhysicalBone::JOINT_TYPE_PIN);
+ }
+ }
+ }
+ }
+}
+
+PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) {
+
+ real_t half_height(skeleton->get_bone_rest(bone_child_id).origin.length() * 0.5);
+ real_t radius(half_height * 0.2);
+
+ CapsuleShape *bone_shape_capsule = memnew(CapsuleShape);
+ bone_shape_capsule->set_height((half_height - radius) * 2);
+ bone_shape_capsule->set_radius(radius);
+
+ CollisionShape *bone_shape = memnew(CollisionShape);
+ bone_shape->set_shape(bone_shape_capsule);
+
+ Transform body_transform;
+ body_transform.origin = Vector3(0, 0, -half_height);
+
+ Transform joint_transform;
+ joint_transform.origin = Vector3(0, 0, half_height);
+
+ PhysicalBone *physical_bone = memnew(PhysicalBone);
+ physical_bone->add_child(bone_shape);
+ physical_bone->set_name("Physical Bone " + skeleton->get_bone_name(bone_id));
+ physical_bone->set_body_offset(body_transform);
+ physical_bone->set_joint_offset(joint_transform);
+ return physical_bone;
+}
+
+void SkeletonEditor::edit(Skeleton *p_node) {
+ skeleton = p_node;
+}
+
+void SkeletonEditor::_node_removed(Node *p_node) {
+
+ if (p_node == skeleton) {
+ skeleton = NULL;
+ options->hide();
+ }
+}
+
+void SkeletonEditor::_bind_methods() {
+ ClassDB::bind_method("_on_click_option", &SkeletonEditor::_on_click_option);
+}
+
+SkeletonEditor::SkeletonEditor() {
+ options = memnew(MenuButton);
+ SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
+
+ options->set_text(TTR("Skeleton"));
+ options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Skeleton", "EditorIcons"));
+
+ options->get_popup()->add_item(TTR("Create physical skeleton"), MENU_OPTION_CREATE_PHYSICAL_SKELETON);
+
+ options->get_popup()->connect("id_pressed", this, "_on_click_option");
+ options->hide();
+}
+
+SkeletonEditor::~SkeletonEditor() {}
+
+void SkeletonEditorPlugin::edit(Object *p_object) {
+ skeleton_editor->edit(Object::cast_to<Skeleton>(p_object));
+}
+
+bool SkeletonEditorPlugin::handles(Object *p_object) const {
+ return p_object->is_class("Skeleton");
+}
+
+void SkeletonEditorPlugin::make_visible(bool p_visible) {
+ if (p_visible) {
+ skeleton_editor->options->show();
+ } else {
+
+ skeleton_editor->options->hide();
+ skeleton_editor->edit(NULL);
+ }
+}
+
+SkeletonEditorPlugin::SkeletonEditorPlugin(EditorNode *p_node) {
+ editor = p_node;
+ skeleton_editor = memnew(SkeletonEditor);
+ editor->get_viewport()->add_child(skeleton_editor);
+}
+
+SkeletonEditorPlugin::~SkeletonEditorPlugin() {}
diff --git a/editor/plugins/skeleton_editor_plugin.h b/editor/plugins/skeleton_editor_plugin.h
new file mode 100644
index 0000000000..b9bdf91902
--- /dev/null
+++ b/editor/plugins/skeleton_editor_plugin.h
@@ -0,0 +1,95 @@
+/*************************************************************************/
+/* skeleton_editor_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef SKELETON_EDITOR_PLUGIN_H
+#define SKELETON_EDITOR_PLUGIN_H
+
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "scene/3d/skeleton.h"
+
+class PhysicalBone;
+class Joint;
+
+class SkeletonEditor : public Node {
+ GDCLASS(SkeletonEditor, Node);
+
+ enum Menu {
+ MENU_OPTION_CREATE_PHYSICAL_SKELETON
+ };
+
+ struct BoneInfo {
+ PhysicalBone *physical_bone;
+ Transform relative_rest; // Relative to skeleton node
+ BoneInfo() :
+ physical_bone(NULL) {}
+ };
+
+ Skeleton *skeleton;
+
+ MenuButton *options;
+
+ void _on_click_option(int p_option);
+
+ friend class SkeletonEditorPlugin;
+
+protected:
+ void _node_removed(Node *p_node);
+ static void _bind_methods();
+
+ void create_physical_skeleton();
+ PhysicalBone *create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos);
+
+public:
+ void edit(Skeleton *p_mesh);
+
+ SkeletonEditor();
+ ~SkeletonEditor();
+};
+
+class SkeletonEditorPlugin : public EditorPlugin {
+
+ GDCLASS(SkeletonEditorPlugin, EditorPlugin);
+
+ EditorNode *editor;
+ SkeletonEditor *skeleton_editor;
+
+public:
+ virtual String get_name() const { return "Skeleton"; }
+ virtual bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_object);
+ virtual bool handles(Object *p_object) const;
+ virtual void make_visible(bool p_visible);
+
+ SkeletonEditorPlugin(EditorNode *p_node);
+ ~SkeletonEditorPlugin();
+};
+
+#endif // SKELETON_EDITOR_PLUGIN_H
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 9e7bfd5787..30fff474d7 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -32,7 +32,7 @@
#include "camera_matrix.h"
#include "core/os/input.h"
-#include "editor/animation_editor.h"
+
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/plugins/animation_player_editor_plugin.h"
@@ -72,6 +72,14 @@
#define MIN_FOV 0.01
#define MAX_FOV 179
+#ifdef TOOLS_ENABLED
+#define get_global_gizmo_transform get_global_gizmo_transform
+#define get_local_gizmo_transform get_local_gizmo_transform
+#else
+#define get_global_gizmo_transform get_global_transform
+#define get_local_gizmo_transform get_transform
+#endif
+
void SpatialEditorViewport::_update_camera(float p_interp_delta) {
bool is_orthogonal = camera->get_projection() == Camera::PROJECTION_ORTHOGONAL;
@@ -209,7 +217,7 @@ bool SpatialEditorGizmo::intersect_frustum(const Camera *p_camera, const Vector<
return false;
}
-bool SpatialEditorGizmo::intersect_ray(const Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle, bool p_sec_first) {
+bool SpatialEditorGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle, bool p_sec_first) {
return false;
}
@@ -312,24 +320,20 @@ void SpatialEditorViewport::_select_clicked(bool p_append, bool p_single) {
void SpatialEditorViewport::_select(Spatial *p_node, bool p_append, bool p_single) {
if (!p_append) {
+ editor_selection->clear();
+ }
- // should not modify the selection..
+ if (editor_selection->is_selected(p_node)) {
+ //erase
+ editor_selection->remove_node(p_node);
+ } else {
- editor_selection->clear();
editor_selection->add_node(p_node);
+ }
+ if (p_single) {
if (Engine::get_singleton()->is_editor_hint())
editor->call("edit_node", p_node);
-
- } else {
-
- if (editor_selection->is_selected(p_node) && p_single) {
- //erase
- editor_selection->remove_node(p_node);
- } else {
-
- editor_selection->add_node(p_node);
- }
}
}
@@ -368,7 +372,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
Vector3 normal;
int handle = -1;
- bool inters = seg->intersect_ray(camera, p_pos, point, normal, NULL, p_alt_select);
+ bool inters = seg->intersect_ray(camera, p_pos, point, normal, &handle, p_alt_select);
if (!inters)
continue;
@@ -467,7 +471,7 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_incl
Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
CameraMatrix cm;
- cm.set_perspective(get_fov(), get_size().aspect(), get_znear(), get_zfar());
+ cm.set_perspective(get_fov(), get_size().aspect(), get_znear() + p_vector3.z, get_zfar());
float screen_w, screen_h;
cm.get_viewport_size(screen_w, screen_h);
@@ -477,7 +481,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
camera_transform.translate(0, 0, cursor.distance);
- return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear()));
+ return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_h, -(get_znear() + p_vector3.z)));
}
void SpatialEditorViewport::_select_region() {
@@ -485,23 +489,25 @@ void SpatialEditorViewport::_select_region() {
if (cursor.region_begin == cursor.region_end)
return; //nothing really
+ float z_offset = MAX(0.0, 5.0 - get_znear());
+
Vector3 box[4] = {
Vector3(
MIN(cursor.region_begin.x, cursor.region_end.x),
MIN(cursor.region_begin.y, cursor.region_end.y),
- 0),
+ z_offset),
Vector3(
MAX(cursor.region_begin.x, cursor.region_end.x),
MIN(cursor.region_begin.y, cursor.region_end.y),
- 0),
+ z_offset),
Vector3(
MAX(cursor.region_begin.x, cursor.region_end.x),
MAX(cursor.region_begin.y, cursor.region_end.y),
- 0),
+ z_offset),
Vector3(
MIN(cursor.region_begin.x, cursor.region_end.x),
MAX(cursor.region_begin.y, cursor.region_end.y),
- 0)
+ z_offset)
};
Vector<Plane> frustum;
@@ -521,7 +527,7 @@ void SpatialEditorViewport::_select_region() {
frustum.push_back(near);
Plane far = -near;
- far.d += 500.0;
+ far.d += get_zfar();
frustum.push_back(far);
@@ -536,19 +542,26 @@ void SpatialEditorViewport::_select_region() {
if (!sp)
continue;
+ Spatial *root_sp = sp;
+ while (root_sp && root_sp != edited_scene && root_sp->get_owner() != edited_scene && !edited_scene->is_editable_instance(root_sp->get_owner())) {
+ root_sp = Object::cast_to<Spatial>(root_sp->get_owner());
+ }
+
+ if (selected.find(root_sp) != -1) continue;
+
Ref<SpatialEditorGizmo> seg = sp->get_gizmo();
if (!seg.is_valid())
continue;
- Spatial *root_sp = sp;
- while (root_sp && root_sp != edited_scene && root_sp->get_owner() != edited_scene && !edited_scene->is_editable_instance(root_sp->get_owner())) {
- root_sp = Object::cast_to<Spatial>(root_sp->get_owner());
+ if (seg->intersect_frustum(camera, frustum)) {
+ selected.push_back(root_sp);
}
+ }
- if (selected.find(root_sp) == -1)
- if (seg->intersect_frustum(camera, frustum))
- _select(root_sp, true, false);
+ bool single = selected.size() == 1;
+ for (int i = 0; i < selected.size(); i++) {
+ _select(selected[i], true, single);
}
}
@@ -584,8 +597,8 @@ void SpatialEditorViewport::_compute_edit(const Point2 &p_point) {
if (!se)
continue;
- se->original = se->sp->get_global_transform();
- se->original_local = se->sp->get_transform();
+ se->original = se->sp->get_global_gizmo_transform();
+ se->original_local = se->sp->get_local_gizmo_transform();
}
}
@@ -886,8 +899,6 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
selection_menu->set_global_position(b->get_global_position());
selection_menu->popup();
- selection_menu->call_deferred("grab_click_focus");
- selection_menu->set_invalidate_click_until_motion();
}
}
@@ -1164,6 +1175,9 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (cursor.region_select) {
+
+ if (!clicked_wants_append) _clear_selected();
+
_select_region();
cursor.region_select = false;
surface->update();
@@ -1186,7 +1200,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!se)
continue;
- undo_redo->add_do_method(sp, "set_global_transform", sp->get_global_transform());
+ undo_redo->add_do_method(sp, "set_global_transform", sp->get_global_gizmo_transform());
undo_redo->add_undo_method(sp, "set_global_transform", se->original);
}
undo_redo->commit_action();
@@ -1273,7 +1287,6 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (cursor.region_select && nav_mode == NAVIGATION_NONE) {
-
cursor.region_end = m->get_position();
surface->update();
return;
@@ -1823,7 +1836,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!get_selected_count() || _edit.mode != TRANSFORM_NONE)
return;
- if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
+ if (!AnimationPlayerEditor::singleton->get_track_editor()->has_keying()) {
set_message(TTR("Keying is disabled (no key inserted)."));
return;
}
@@ -1907,8 +1920,13 @@ void SpatialEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, con
real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity");
real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+ bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y-axis");
- cursor.x_rot += p_relative.y * radians_per_pixel;
+ if (invert_y_axis) {
+ cursor.x_rot -= p_relative.y * radians_per_pixel;
+ } else {
+ cursor.x_rot += p_relative.y * radians_per_pixel;
+ }
cursor.y_rot += p_relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
@@ -1925,11 +1943,16 @@ void SpatialEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, cons
if (!orthogonal) {
real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity");
real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
+ bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y-axis");
// Note: do NOT assume the camera has the "current" transform, because it is interpolated and may have "lag".
Transform prev_camera_transform = to_camera_transform(cursor);
- cursor.x_rot += p_relative.y * radians_per_pixel;
+ if (invert_y_axis) {
+ cursor.x_rot -= p_relative.y * radians_per_pixel;
+ } else {
+ cursor.x_rot += p_relative.y * radians_per_pixel;
+ }
cursor.y_rot += p_relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
@@ -2137,12 +2160,9 @@ void SpatialEditorViewport::_notification(int p_what) {
VisualInstance *vi = Object::cast_to<VisualInstance>(sp);
- if (se->aabb.has_no_surface()) {
+ se->aabb = vi ? vi->get_aabb() : AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4));
- se->aabb = vi ? vi->get_aabb() : AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4));
- }
-
- Transform t = sp->get_global_transform();
+ Transform t = sp->get_global_gizmo_transform();
t.translate(se->aabb.position);
// apply AABB scaling before item's global transform
@@ -2495,7 +2515,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
xform.scale_basis(sp->get_scale());
undo_redo->add_do_method(sp, "set_global_transform", xform);
- undo_redo->add_undo_method(sp, "set_global_transform", sp->get_global_transform());
+ undo_redo->add_undo_method(sp, "set_global_transform", sp->get_global_gizmo_transform());
}
undo_redo->commit_action();
} break;
@@ -2953,7 +2973,7 @@ void SpatialEditorViewport::focus_selection() {
if (!se)
continue;
- center += sp->get_global_transform().origin;
+ center += sp->get_global_gizmo_transform().origin;
count++;
}
@@ -3035,7 +3055,7 @@ AABB SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, c
MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(child);
if (mesh_instance) {
AABB mesh_instance_bounds = mesh_instance->get_aabb();
- mesh_instance_bounds.position += mesh_instance->get_global_transform().origin - p_parent->get_global_transform().origin;
+ mesh_instance_bounds.position += mesh_instance->get_global_gizmo_transform().origin - p_parent->get_global_gizmo_transform().origin;
bounds.merge_with(mesh_instance_bounds);
}
bounds = _calculate_spatial_bounds(child, bounds);
@@ -3113,7 +3133,7 @@ bool SpatialEditorViewport::_create_instance(Node *parent, String &path, const P
if (!scene.is_valid()) { // invalid scene
return false;
} else {
- instanced_scene = scene->instance();
+ instanced_scene = scene->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
}
}
}
@@ -3146,7 +3166,7 @@ bool SpatialEditorViewport::_create_instance(Node *parent, String &path, const P
Transform global_transform;
Spatial *parent_spatial = Object::cast_to<Spatial>(parent);
if (parent_spatial)
- global_transform = parent_spatial->get_global_transform();
+ global_transform = parent_spatial->get_global_gizmo_transform();
global_transform.origin = spatial_editor->snap_point(_get_instance_position(p_point));
@@ -3275,7 +3295,7 @@ void SpatialEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p
}
}
if (list.size() != 1) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation requires a single selected node."));
accept->popup_centered_minsize();
_remove_preview();
@@ -3343,14 +3363,14 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
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_check_item(TTR("Perspective") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_PERSPECTIVE);
- view_menu->get_popup()->add_check_item(TTR("Orthogonal") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_ORTHOGONAL);
+ 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()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_PERSPECTIVE), true);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_normal", TTR("Display Normal")), VIEW_DISPLAY_NORMAL);
- view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_wireframe", TTR("Display Wireframe")), VIEW_DISPLAY_WIREFRAME);
- view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_overdraw", TTR("Display Overdraw")), VIEW_DISPLAY_OVERDRAW);
- view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_unshaded", TTR("Display Unshaded")), VIEW_DISPLAY_SHADELESS);
+ view_menu->get_popup()->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_normal", TTR("Display Normal")), VIEW_DISPLAY_NORMAL);
+ view_menu->get_popup()->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_wireframe", TTR("Display Wireframe")), VIEW_DISPLAY_WIREFRAME);
+ view_menu->get_popup()->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_overdraw", TTR("Display Overdraw")), VIEW_DISPLAY_OVERDRAW);
+ view_menu->get_popup()->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/view_display_unshaded", TTR("Display Unshaded")), VIEW_DISPLAY_SHADELESS);
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_DISPLAY_NORMAL), true);
view_menu->get_popup()->add_separator();
view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_environment", TTR("View Environment")), VIEW_ENVIRONMENT);
@@ -3779,7 +3799,8 @@ void SpatialEditor::update_transform_gizmo() {
if (!se)
continue;
- Transform xf = se->sp->get_global_transform();
+ Transform xf = se->sp->get_global_gizmo_transform();
+
if (first) {
center.position = xf.origin;
first = false;
@@ -4046,7 +4067,7 @@ void SpatialEditor::_xform_dialog_action() {
bool post = xform_type->get_selected() > 0;
- Transform tr = sp->get_global_transform();
+ Transform tr = sp->get_global_gizmo_transform();
if (post)
tr = tr * t;
else {
@@ -4056,7 +4077,7 @@ void SpatialEditor::_xform_dialog_action() {
}
undo_redo->add_do_method(sp, "set_global_transform", tr);
- undo_redo->add_undo_method(sp, "set_global_transform", sp->get_global_transform());
+ undo_redo->add_undo_method(sp, "set_global_transform", sp->get_global_gizmo_transform());
}
undo_redo->commit_action();
}
@@ -4590,7 +4611,10 @@ void SpatialEditor::_init_grid() {
PoolVector<Color> grid_colors[3];
PoolVector<Vector3> grid_points[3];
- Color grid_color = EditorSettings::get_singleton()->get("editors/3d/grid_color");
+ Color primary_grid_color = EditorSettings::get_singleton()->get("editors/3d/primary_grid_color");
+ Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/3d/secondary_grid_color");
+ int grid_size = EditorSettings::get_singleton()->get("editors/3d/grid_size");
+ int primary_grid_steps = EditorSettings::get_singleton()->get("editors/3d/primary_grid_steps");
for (int i = 0; i < 3; i++) {
Vector3 axis;
@@ -4600,19 +4624,17 @@ void SpatialEditor::_init_grid() {
Vector3 axis_n2;
axis_n2[(i + 2) % 3] = 1;
-#define ORIGIN_GRID_SIZE 50
-
- for (int j = -ORIGIN_GRID_SIZE; j <= ORIGIN_GRID_SIZE; j++) {
- Vector3 p1 = axis_n1 * j + axis_n2 * -ORIGIN_GRID_SIZE;
+ for (int j = -grid_size; j <= grid_size; j++) {
+ Vector3 p1 = axis_n1 * j + axis_n2 * -grid_size;
Vector3 p1_dest = p1 * (-axis_n2 + axis_n1);
- Vector3 p2 = axis_n2 * j + axis_n1 * -ORIGIN_GRID_SIZE;
+ Vector3 p2 = axis_n2 * j + axis_n1 * -grid_size;
Vector3 p2_dest = p2 * (-axis_n1 + axis_n2);
- Color line_color = grid_color;
+ Color line_color = secondary_grid_color;
if (j == 0) {
continue;
- } else if (j % 10 == 0) {
- line_color *= 1.5;
+ } else if (j % primary_grid_steps == 0) {
+ line_color = primary_grid_color;
}
grid_points[i].push_back(p1);
@@ -5074,8 +5096,6 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Tool Rotate"), KEY_E);
ED_SHORTCUT("spatial_editor/tool_scale", TTR("Tool Scale"), KEY_R);
- ED_SHORTCUT("spatial_editor/display_wireframe", TTR("Display Wireframe"), KEY_Z);
-
ED_SHORTCUT("spatial_editor/freelook_toggle", TTR("Toggle Freelook"), KEY_MASK_SHIFT + KEY_F);
PopupMenu *p;
@@ -5085,9 +5105,9 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
hbc_menu->add_child(transform_menu);
p = transform_menu->get_popup();
- p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap..")), MENU_TRANSFORM_CONFIGURE_SNAP);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap...")), MENU_TRANSFORM_CONFIGURE_SNAP);
p->add_separator();
- p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog..")), MENU_TRANSFORM_DIALOG);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog...")), MENU_TRANSFORM_DIALOG);
p->connect("id_pressed", this, "_menu_item_pressed");
@@ -5101,12 +5121,12 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
accept = memnew(AcceptDialog);
editor->get_gui_base()->add_child(accept);
- p->add_check_shortcut(ED_SHORTCUT("spatial_editor/1_viewport", TTR("1 Viewport"), KEY_MASK_CMD + KEY_1), MENU_VIEW_USE_1_VIEWPORT);
- p->add_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports", TTR("2 Viewports"), KEY_MASK_CMD + KEY_2), MENU_VIEW_USE_2_VIEWPORTS);
- p->add_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports_alt", TTR("2 Viewports (Alt)"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_2), MENU_VIEW_USE_2_VIEWPORTS_ALT);
- p->add_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTR("3 Viewports"), KEY_MASK_CMD + KEY_3), MENU_VIEW_USE_3_VIEWPORTS);
- p->add_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTR("3 Viewports (Alt)"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_3), MENU_VIEW_USE_3_VIEWPORTS_ALT);
- p->add_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTR("4 Viewports"), KEY_MASK_CMD + KEY_4), MENU_VIEW_USE_4_VIEWPORTS);
+ p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/1_viewport", TTR("1 Viewport"), KEY_MASK_CMD + KEY_1), MENU_VIEW_USE_1_VIEWPORT);
+ p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports", TTR("2 Viewports"), KEY_MASK_CMD + KEY_2), MENU_VIEW_USE_2_VIEWPORTS);
+ p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports_alt", TTR("2 Viewports (Alt)"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_2), MENU_VIEW_USE_2_VIEWPORTS_ALT);
+ p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTR("3 Viewports"), KEY_MASK_CMD + KEY_3), MENU_VIEW_USE_3_VIEWPORTS);
+ p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTR("3 Viewports (Alt)"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_3), MENU_VIEW_USE_3_VIEWPORTS_ALT);
+ p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTR("4 Viewports"), KEY_MASK_CMD + KEY_4), MENU_VIEW_USE_4_VIEWPORTS);
p->add_separator();
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_origin", TTR("View Origin")), MENU_VIEW_ORIGIN);
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 7736db67b1..637926a913 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -62,7 +62,7 @@ public:
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
virtual bool intersect_frustum(const Camera *p_camera, const Vector<Plane> &p_frustum);
- virtual bool intersect_ray(const Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
+ virtual bool intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
SpatialEditorGizmo();
};
diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp
index 99aabcb3eb..66673cca00 100644
--- a/editor/plugins/sprite_editor_plugin.cpp
+++ b/editor/plugins/sprite_editor_plugin.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* sprite_editor_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "sprite_editor_plugin.h"
#include "canvas_item_editor_plugin.h"
@@ -80,6 +110,10 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
void SpriteEditor::_menu_option(int p_option) {
+ if (!node) {
+ return;
+ }
+
switch (p_option) {
case MENU_OPTION_CREATE_MESH_2D: {
@@ -389,6 +423,7 @@ SpriteEditorPlugin::SpriteEditorPlugin(EditorNode *p_node) {
editor = p_node;
sprite_editor = memnew(SpriteEditor);
editor->get_viewport()->add_child(sprite_editor);
+ make_visible(false);
//sprite_editor->options->hide();
}
diff --git a/editor/plugins/sprite_editor_plugin.h b/editor/plugins/sprite_editor_plugin.h
index 17aa3eb1f9..238227e4a0 100644
--- a/editor/plugins/sprite_editor_plugin.h
+++ b/editor/plugins/sprite_editor_plugin.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* sprite_editor_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef SPRITE_EDITOR_PLUGIN_H
#define SPRITE_EDITOR_PLUGIN_H
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index d8d0a6f013..a9afc7a670 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -45,6 +45,12 @@ void SpriteFramesEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
load->set_icon(get_icon("Load", "EditorIcons"));
+ copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
+ paste->set_icon(get_icon("ActionPaste", "EditorIcons"));
+ empty->set_icon(get_icon("InsertBefore", "EditorIcons"));
+ empty2->set_icon(get_icon("InsertAfter", "EditorIcons"));
+ move_up->set_icon(get_icon("MoveLeft", "EditorIcons"));
+ move_down->set_icon(get_icon("MoveRight", "EditorIcons"));
_delete->set_icon(get_icon("Remove", "EditorIcons"));
new_anim->set_icon(get_icon("New", "EditorIcons"));
remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
@@ -458,8 +464,6 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
List<StringName> anim_names;
- anim_names.sort_custom<StringName::AlphCompare>();
-
frames->get_animation_list(&anim_names);
anim_names.sort_custom<StringName::AlphCompare>();
@@ -738,27 +742,35 @@ SpriteFramesEditor::SpriteFramesEditor() {
hbc->add_child(load);
copy = memnew(Button);
- copy->set_text(TTR("Copy"));
+ copy->set_flat(true);
+ copy->set_tooltip(TTR("Copy"));
hbc->add_child(copy);
paste = memnew(Button);
- paste->set_text(TTR("Paste"));
+ paste->set_flat(true);
+ paste->set_tooltip(TTR("Paste"));
hbc->add_child(paste);
empty = memnew(Button);
- empty->set_text(TTR("Insert Empty (Before)"));
+ empty->set_flat(true);
+ empty->set_tooltip(TTR("Insert Empty (Before)"));
hbc->add_child(empty);
empty2 = memnew(Button);
- empty2->set_text(TTR("Insert Empty (After)"));
+ empty2->set_flat(true);
+ empty2->set_tooltip(TTR("Insert Empty (After)"));
hbc->add_child(empty2);
+ hbc->add_spacer(false);
+
move_up = memnew(Button);
- move_up->set_text(TTR("Move (Before)"));
+ move_up->set_flat(true);
+ move_up->set_tooltip(TTR("Move (Before)"));
hbc->add_child(move_up);
move_down = memnew(Button);
- move_down->set_text(TTR("Move (After)"));
+ move_down->set_flat(true);
+ move_down->set_tooltip(TTR("Move (After)"));
hbc->add_child(move_down);
_delete = memnew(Button);
diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp
index f4faab69ed..f6d98cb4c7 100644
--- a/editor/plugins/style_box_editor_plugin.cpp
+++ b/editor/plugins/style_box_editor_plugin.cpp
@@ -30,7 +30,26 @@
#include "style_box_editor_plugin.h"
-void StyleBoxEditor::edit(const Ref<StyleBox> &p_stylebox) {
+bool EditorInspectorPluginStyleBox::can_handle(Object *p_object) {
+
+ return Object::cast_to<StyleBox>(p_object) != NULL;
+}
+
+void EditorInspectorPluginStyleBox::parse_begin(Object *p_object) {
+
+ Ref<StyleBox> sb = Ref<StyleBox>(Object::cast_to<StyleBox>(p_object));
+
+ StyleBoxPreview *preview = memnew(StyleBoxPreview);
+ preview->edit(sb);
+ add_custom_control(preview);
+}
+bool EditorInspectorPluginStyleBox::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage) {
+ return false; //do not want
+}
+void EditorInspectorPluginStyleBox::parse_end() {
+}
+
+void StyleBoxPreview::edit(const Ref<StyleBox> &p_stylebox) {
if (stylebox.is_valid())
stylebox->disconnect("changed", this, "_sb_changed");
@@ -39,71 +58,33 @@ void StyleBoxEditor::edit(const Ref<StyleBox> &p_stylebox) {
preview->add_style_override("panel", stylebox);
stylebox->connect("changed", this, "_sb_changed");
}
+ _sb_changed();
}
-void StyleBoxEditor::_sb_changed() {
+void StyleBoxPreview::_sb_changed() {
preview->update();
+ if (stylebox.is_valid()) {
+ Size2 ms = stylebox->get_minimum_size() * 4 / 3;
+ ms.height = MAX(ms.height, 150 * EDSCALE);
+ preview->set_custom_minimum_size(ms);
+ }
}
-void StyleBoxEditor::_bind_methods() {
+void StyleBoxPreview::_bind_methods() {
- ClassDB::bind_method("_sb_changed", &StyleBoxEditor::_sb_changed);
- //ClassDB::bind_method("_import",&StyleBoxEditor::_import);
- //ClassDB::bind_method("_import_accept",&StyleBoxEditor::_import_accept);
- //ClassDB::bind_method("_preview_text_changed",&StyleBoxEditor::_preview_text_changed);
+ ClassDB::bind_method("_sb_changed", &StyleBoxPreview::_sb_changed);
}
-StyleBoxEditor::StyleBoxEditor() {
-
- panel = memnew(Panel);
- add_child(panel);
- panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
-
- Label *l = memnew(Label);
- l->set_text(TTR("StyleBox Preview:"));
- l->set_position(Point2(5, 5));
- panel->add_child(l);
+StyleBoxPreview::StyleBoxPreview() {
preview = memnew(Panel);
- panel->add_child(preview);
- preview->set_position(Point2(50, 50));
- preview->set_size(Size2(200, 100));
-}
-
-void StyleBoxEditorPlugin::edit(Object *p_node) {
-
- if (Object::cast_to<StyleBox>(p_node)) {
- stylebox_editor->edit(Object::cast_to<StyleBox>(p_node));
- stylebox_editor->show();
- } else
- stylebox_editor->hide();
-}
-
-bool StyleBoxEditorPlugin::handles(Object *p_node) const {
-
- return p_node->is_class("StyleBox");
-}
-
-void StyleBoxEditorPlugin::make_visible(bool p_visible) {
-
- if (p_visible) {
- button->show();
- EditorNode::get_singleton()->make_bottom_panel_item_visible(stylebox_editor);
-
- } else {
- if (stylebox_editor->is_visible_in_tree())
- EditorNode::get_singleton()->hide_bottom_panel();
- button->hide();
- }
+ add_margin_child(TTR("Preview:"), preview);
}
StyleBoxEditorPlugin::StyleBoxEditorPlugin(EditorNode *p_node) {
- stylebox_editor = memnew(StyleBoxEditor);
- stylebox_editor->set_custom_minimum_size(Size2(0, 250));
-
- //p_node->get_viewport()->add_child(stylebox_editor);
- button = p_node->add_bottom_panel_item(TTR("StyleBox"), stylebox_editor);
- button->hide();
+ Ref<EditorInspectorPluginStyleBox> inspector_plugin;
+ inspector_plugin.instance();
+ add_inspector_plugin(inspector_plugin);
}
diff --git a/editor/plugins/style_box_editor_plugin.h b/editor/plugins/style_box_editor_plugin.h
index 34d8caaeb6..6b0d7e57a8 100644
--- a/editor/plugins/style_box_editor_plugin.h
+++ b/editor/plugins/style_box_editor_plugin.h
@@ -31,18 +31,17 @@
#ifndef STYLE_BOX_EDITOR_PLUGIN_H
#define STYLE_BOX_EDITOR_PLUGIN_H
+#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "scene/gui/option_button.h"
#include "scene/gui/texture_rect.h"
#include "scene/resources/style_box.h"
-class StyleBoxEditor : public Control {
+class StyleBoxPreview : public VBoxContainer {
- GDCLASS(StyleBoxEditor, Control);
+ GDCLASS(StyleBoxPreview, VBoxContainer);
- Panel *panel;
Panel *preview;
-
Ref<StyleBox> stylebox;
void _sb_changed();
@@ -53,23 +52,24 @@ protected:
public:
void edit(const Ref<StyleBox> &p_stylebox);
- StyleBoxEditor();
+ StyleBoxPreview();
+};
+
+class EditorInspectorPluginStyleBox : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorPluginStyleBox, EditorInspectorPlugin)
+public:
+ virtual bool can_handle(Object *p_object);
+ virtual void parse_begin(Object *p_object);
+ virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage);
+ virtual void parse_end();
};
class StyleBoxEditorPlugin : public EditorPlugin {
GDCLASS(StyleBoxEditorPlugin, EditorPlugin);
- StyleBoxEditor *stylebox_editor;
- EditorNode *editor;
- Button *button;
-
public:
virtual String get_name() const { return "StyleBox"; }
- bool has_main_screen() const { return false; }
- virtual void edit(Object *p_node);
- virtual bool handles(Object *p_node) const;
- virtual void make_visible(bool p_visible);
StyleBoxEditorPlugin(EditorNode *p_node);
};
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 215d2ca551..e4fdd1f251 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -57,8 +57,9 @@ void TextureRegionEditor::_region_draw() {
base_tex = obj_styleBox->get_texture();
else if (atlas_tex.is_valid())
base_tex = atlas_tex->get_atlas();
- else if (tile_set.is_valid() && selected_tile != -1)
+ else if (tile_set.is_valid() && selected_tile != -1 && tile_set->has_tile(selected_tile))
base_tex = tile_set->tile_get_texture(selected_tile);
+
if (base_tex.is_null())
return;
@@ -600,6 +601,18 @@ void TextureRegionEditor::apply_rect(const Rect2 &rect) {
void TextureRegionEditor::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_PROCESS: {
+ if (node_sprite) {
+ if (node_sprite->is_region()) {
+
+ set_process(false);
+ EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
+ }
+ } else {
+ set_process(false);
+ }
+ } break;
+ case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_READY: {
zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
@@ -638,6 +651,23 @@ void TextureRegionEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_zoom_out"), &TextureRegionEditor::_zoom_out);
}
+bool TextureRegionEditor::is_stylebox() {
+ return obj_styleBox.is_valid();
+}
+
+bool TextureRegionEditor::is_atlas_texture() {
+
+ return atlas_tex.is_valid();
+}
+
+bool TextureRegionEditor::is_ninepatch() {
+ return node_ninepatch != NULL;
+}
+
+Sprite *TextureRegionEditor::get_sprite() {
+ return node_sprite;
+}
+
void TextureRegionEditor::edit(Object *p_obj) {
if (node_sprite)
node_sprite->remove_change_receptor(this);
@@ -668,6 +698,12 @@ void TextureRegionEditor::edit(Object *p_obj) {
tile_set = Ref<TileSet>(NULL);
}
edit_draw->update();
+ if (node_sprite && !node_sprite->is_region()) {
+ set_process(true);
+ }
+ if (!p_obj) {
+ set_process(false);
+ }
}
void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_prop) {
@@ -688,10 +724,11 @@ void TextureRegionEditor::_edit_region() {
texture = obj_styleBox->get_texture();
else if (atlas_tex.is_valid())
texture = atlas_tex->get_atlas();
- else if (tile_set.is_valid() && selected_tile != -1)
+ else if (tile_set.is_valid() && selected_tile != -1 && tile_set->has_tile(selected_tile))
texture = tile_set->tile_get_texture(selected_tile);
if (texture.is_null()) {
+ edit_draw->update();
return;
}
@@ -780,9 +817,11 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
tile_set = Ref<TileSet>(NULL);
editor = p_editor;
undo_redo = editor->get_undo_redo();
+ selected_tile = -1;
snap_step = Vector2(10, 10);
snap_separation = Vector2(0, 0);
+ snap_mode = SNAP_NONE;
edited_margin = -1;
drag_index = -1;
drag = false;
@@ -800,12 +839,10 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
snap_mode_button->set_text(TTR("<None>"));
PopupMenu *p = snap_mode_button->get_popup();
p->set_hide_on_checkable_item_selection(false);
- p->add_item(TTR("<None>"), 0);
- p->add_item(TTR("Pixel Snap"), 1);
- p->add_item(TTR("Grid Snap"), 2);
- p->add_item(TTR("Auto Slice"), 3);
- for (int i = 0; i < 4; i++)
- p->set_item_as_checkable(i, true);
+ p->add_radio_check_item(TTR("<None>"), 0);
+ p->add_radio_check_item(TTR("Pixel Snap"), 1);
+ p->add_radio_check_item(TTR("Grid Snap"), 2);
+ p->add_radio_check_item(TTR("Auto Slice"), 3);
p->set_item_checked(0, true);
p->connect("id_pressed", this, "_set_snap_mode");
hb_grid = memnew(HBoxContainer);
@@ -929,8 +966,12 @@ bool TextureRegionEditorPlugin::handles(Object *p_object) const {
void TextureRegionEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
texture_region_button->show();
- if (texture_region_button->is_pressed())
- region_editor->show();
+ if (region_editor->is_stylebox() || region_editor->is_atlas_texture() || region_editor->is_ninepatch() || (region_editor->get_sprite() && region_editor->get_sprite()->is_region())) {
+ editor->make_bottom_panel_item_visible(region_editor);
+ } else {
+ if (texture_region_button->is_pressed())
+ region_editor->show();
+ }
} else {
texture_region_button->hide();
region_editor->edit(NULL);
@@ -986,10 +1027,10 @@ TextureRegionEditorPlugin::TextureRegionEditorPlugin(EditorNode *p_node) {
editor = p_node;
region_editor = memnew(TextureRegionEditor(p_node));
- texture_region_button = p_node->add_bottom_panel_item(TTR("Texture Region"), region_editor);
+ texture_region_button = p_node->add_bottom_panel_item(TTR("TextureRegion"), region_editor);
texture_region_button->set_tooltip(TTR("Texture Region Editor"));
- region_editor->set_custom_minimum_size(Size2(0, 200));
+ region_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
region_editor->hide();
texture_region_button->hide();
}
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 1244953a3f..eeba1987a6 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -131,6 +131,10 @@ public:
void _region_draw();
void _region_input(const Ref<InputEvent> &p_input);
void _scroll_changed(float);
+ bool is_stylebox();
+ bool is_atlas_texture();
+ bool is_ninepatch();
+ Sprite *get_sprite();
void edit(Object *p_obj);
TextureRegionEditor(EditorNode *p_editor);
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index f51e691be3..92b95963f9 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -244,7 +244,7 @@ void ThemeEditor::_save_template_cbk(String fname) {
file->store_line("; ");
file->store_line("; ******************* ");
file->store_line("; ");
- file->store_line("; Template Generated Using: " + String(VERSION_MKSTRING));
+ file->store_line("; Template Generated Using: " + String(VERSION_FULL_BUILD));
file->store_line("; ");
file->store_line("; ");
file->store_line("");
@@ -632,7 +632,7 @@ ThemeEditor::ThemeEditor() {
main_vb->add_child(hb_menu);
theme_menu = memnew(MenuButton);
- theme_menu->set_text(TTR("Edit theme.."));
+ theme_menu->set_text(TTR("Edit theme..."));
theme_menu->set_flat(false);
theme_menu->set_tooltip(TTR("Theme editing menu."));
theme_menu->get_popup()->add_item(TTR("Add Item"), POPUP_ADD);
@@ -691,7 +691,11 @@ ThemeEditor::ThemeEditor() {
test_menu_button->get_popup()->add_separator();
test_menu_button->get_popup()->add_check_item(TTR("Check Item"));
test_menu_button->get_popup()->add_check_item(TTR("Checked Item"));
- test_menu_button->get_popup()->set_item_checked(2, true);
+ test_menu_button->get_popup()->set_item_checked(3, true);
+ test_menu_button->get_popup()->add_separator();
+ test_menu_button->get_popup()->add_radio_check_item(TTR("Radio Item"));
+ test_menu_button->get_popup()->add_radio_check_item(TTR("Checked Radio Item"));
+ test_menu_button->get_popup()->set_item_checked(6, true);
first_vb->add_child(test_menu_button);
OptionButton *test_option_button = memnew(OptionButton);
@@ -740,7 +744,7 @@ ThemeEditor::ThemeEditor() {
item = test_tree->create_item(test_tree->get_root());
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_editable(0, true);
- item->set_text(0, "check");
+ item->set_text(0, "Check");
item = test_tree->create_item(test_tree->get_root());
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
item->set_editable(0, true);
@@ -749,7 +753,7 @@ ThemeEditor::ThemeEditor() {
item = test_tree->create_item(test_tree->get_root());
item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
item->set_editable(0, true);
- item->set_text(0, TTR("Have,Many,Several,Options!"));
+ item->set_text(0, TTR("Has,Many,Options"));
item->set_range(0, 2);
VBoxContainer *third_vb = memnew(VBoxContainer);
@@ -780,58 +784,6 @@ ThemeEditor::ThemeEditor() {
main_hb->add_constant_override("separation", 20 * EDSCALE);
- /*
- test_h_scroll = memnew( HScrollBar );
- test_h_scroll->set_position( Point2( 25, 225 ) );
- test_h_scroll->set_size( Point2( 150, 5 ) );
- panel->add_child(test_h_scroll);
-
- line_edit = memnew( LineEdit );
- line_edit->set_position( Point2( 25, 275 ) );
- line_edit->set_size( Point2( 150, 5 ) );
- line_edit->set_text("Line Edit");
- panel->add_child(line_edit);
-
- test_v_scroll = memnew( VScrollBar );
- test_v_scroll->set_position( Point2( 200, 25 ) );
- test_v_scroll->set_size( Point2( 5, 150 ) );
- panel->add_child(test_v_scroll);
-
- test_tree = memnew(Tree);
- test_tree->set_position( Point2( 300, 25 ) );
- test_tree->set_size( Point2( 200, 200 ) );
- panel->add_child(test_tree);
-
-
- TreeItem *item = test_tree->create_item();
- item->set_editable(0,true);
- item->set_text(0,"root");
- item = test_tree->create_item( test_tree->get_root() );
- item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_editable(0,true);
- item->set_text(0,"check");
- item = test_tree->create_item( test_tree->get_root() );
- item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
- item->set_editable(0,true);
- item->set_range_config(0,0,20,0.1);
- item->set_range(0,2);
- item = test_tree->create_item( test_tree->get_root() );
- item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
- item->set_editable(0,true);
- item->set_text(0,"Have,Many,Several,Options!"));
- item->set_range(0,2);
-
- Button *fd_button= memnew( Button );
- fd_button->set_position(Point2(300,275));
- fd_button->set_text("Open File Dialog");
- panel->add_child(fd_button);
-
- test_file_dialog = memnew( EditorFileDialog );
- panel->add_child(test_file_dialog);
-
- fd_button->connect("pressed", this,"_open_file_dialog");
-*/
-
add_del_dialog = memnew(ConfirmationDialog);
add_del_dialog->hide();
add_child(add_del_dialog);
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index c97e949403..19646f37b5 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -35,6 +35,7 @@
#include "editor/editor_settings.h"
#include "os/input.h"
#include "os/keyboard.h"
+#include "scene/gui/split_container.h"
void TileMapEditor::_notification(int p_what) {
@@ -48,6 +49,20 @@ void TileMapEditor::_notification(int p_what) {
} break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+
+ bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover");
+ if (new_show_tile_info != show_tile_info) {
+ show_tile_info = new_show_tile_info;
+ tile_info->set_visible(show_tile_info);
+ }
+
+ if (is_visible_in_tree()) {
+ _update_palette();
+ }
+
+ } // fallthrough
+
case NOTIFICATION_ENTER_TREE: {
transp->set_icon(get_icon("Transpose", "EditorIcons"));
@@ -60,19 +75,14 @@ void TileMapEditor::_notification(int p_what) {
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
- } break;
-
- case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
-
- bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover");
- if (new_show_tile_info != show_tile_info) {
- show_tile_info = new_show_tile_info;
- tile_info->set_visible(show_tile_info);
- }
+ PopupMenu *p = options->get_popup();
+ p->set_item_icon(p->get_item_index(OPTION_PAINTING), get_icon("Edit", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_PICK_TILE), get_icon("ColorPick", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_SELECT), get_icon("ToolSelect", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_MOVE), get_icon("ToolMove", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_DUPLICATE), get_icon("Duplicate", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(OPTION_ERASE_SELECTION), get_icon("Remove", "EditorIcons"));
- if (is_visible_in_tree()) {
- _update_palette();
- }
} break;
}
}
@@ -123,22 +133,44 @@ void TileMapEditor::_menu_option(int p_option) {
if (!selection_active)
return;
- undo_redo->create_action(TTR("Erase Selection"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ _start_undo(TTR("Erase Selection"));
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
- _set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false);
+ _set_cell(Point2i(j, i), invalid_cell, false, false, false);
}
}
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
- undo_redo->commit_action();
+ _finish_undo();
selection_active = false;
copydata.clear();
canvas_item_editor->update();
} break;
+ case OPTION_FIX_INVALID: {
+
+ undo_redo->create_action(TTR("Fix Invalid Tiles"));
+ undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ node->fix_invalid_tiles();
+ undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
+ undo_redo->commit_action();
+
+ } break;
+ case OPTION_MOVE: {
+
+ if (selection_active) {
+ _update_copydata();
+ tool = TOOL_MOVING;
+ canvas_item_editor->update();
+ }
+ } break;
+ }
+}
+
+void TileMapEditor::_palette_selected(int index) {
+
+ if (manual_autotile) {
+ _update_palette();
}
}
@@ -154,41 +186,129 @@ void TileMapEditor::_canvas_mouse_exit() {
canvas_item_editor->update();
}
-int TileMapEditor::get_selected_tile() const {
+Vector<int> TileMapEditor::get_selected_tiles() const {
- int item = palette->get_current();
+ Vector<int> items = palette->get_selected_items();
- if (item == -1)
- return TileMap::INVALID_CELL;
+ if (items.size() == 0) {
+ items.push_back(TileMap::INVALID_CELL);
+ return items;
+ }
- return palette->get_item_metadata(item);
+ for (int i = items.size() - 1; i >= 0; i--) {
+ items[i] = palette->get_item_metadata(items[i]);
+ }
+ return items;
}
-void TileMapEditor::set_selected_tile(int p_tile) {
+void TileMapEditor::set_selected_tiles(Vector<int> p_tiles) {
- int idx = palette->find_metadata(p_tile);
+ palette->unselect_all();
- if (idx >= 0) {
- palette->select(idx, true);
- palette->ensure_current_is_visible();
+ for (int i = p_tiles.size() - 1; i >= 0; i--) {
+ int idx = palette->find_metadata(p_tiles[i]);
+
+ if (idx >= 0) {
+ palette->select(idx, false);
+ }
}
+
+ palette->ensure_current_is_visible();
}
-void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose) {
+void TileMapEditor::_create_set_cell_undo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new) {
+
+ Dictionary cell_old;
+ Dictionary cell_new;
+
+ cell_old["id"] = p_cell_old.idx;
+ cell_old["flip_h"] = p_cell_old.xf;
+ cell_old["flip_y"] = p_cell_old.yf;
+ cell_old["transpose"] = p_cell_old.tr;
+ cell_old["auto_coord"] = p_cell_old.ac;
+
+ cell_new["id"] = p_cell_new.idx;
+ cell_new["flip_h"] = p_cell_new.xf;
+ cell_new["flip_y"] = p_cell_new.yf;
+ cell_new["transpose"] = p_cell_new.tr;
+ cell_new["auto_coord"] = p_cell_new.ac;
+
+ undo_redo->add_undo_method(node, "set_celld", p_vec, cell_old);
+ undo_redo->add_do_method(node, "set_celld", p_vec, cell_new);
+}
+
+void TileMapEditor::_start_undo(const String &p_action) {
+
+ undo_data.clear();
+ undo_redo->create_action(p_action);
+}
+
+void TileMapEditor::_finish_undo() {
+
+ if (undo_data.size()) {
+ for (Map<Point2i, CellOp>::Element *E = undo_data.front(); E; E = E->next()) {
+ _create_set_cell_undo(E->key(), E->get(), _get_op_from_cell(E->key()));
+ }
+
+ undo_data.clear();
+ }
+
+ undo_redo->commit_action();
+}
+
+void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p_flip_h, bool p_flip_v, bool p_transpose) {
ERR_FAIL_COND(!node);
+ if (p_values.size() == 0)
+ return;
+
+ int p_value = p_values[Math::rand() % p_values.size()];
int prev_val = node->get_cell(p_pos.x, p_pos.y);
bool prev_flip_h = node->is_cell_x_flipped(p_pos.x, p_pos.y);
bool prev_flip_v = node->is_cell_y_flipped(p_pos.x, p_pos.y);
bool prev_transpose = node->is_cell_transposed(p_pos.x, p_pos.y);
+ Vector2 prev_position = node->get_cell_autotile_coord(p_pos.x, p_pos.y);
- if (p_value == prev_val && p_flip_h == prev_flip_h && p_flip_v == prev_flip_v && p_transpose == prev_transpose)
+ Vector2 position;
+ int current = manual_palette->get_current();
+ if (current != -1) {
+ position = manual_palette->get_item_metadata(current);
+ } else {
+ // if there is no manual tile selected, that either means that
+ // autotiling is enabled, or the given tile is not autotiling. Either
+ // way, the coordinate of the tile does not matter, so assigning it to
+ // the coordinate of the existing tile works fine.
+ position = prev_position;
+ }
+
+ if (p_value == prev_val && p_flip_h == prev_flip_h && p_flip_v == prev_flip_v && p_transpose == prev_transpose && prev_position == position)
return; //check that it's actually different
+ for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) {
+ for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) {
+ Point2i p = Point2i(x, y);
+ if (!undo_data.has(p)) {
+ undo_data[p] = _get_op_from_cell(p);
+ }
+ }
+ }
+
node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose);
- node->update_bitmask_area(Point2(p_pos));
+ if (manual_autotile) {
+ if (current != -1) {
+ node->set_cell_autotile_coord(p_pos.x, p_pos.y, position);
+ }
+ } else {
+ // manually placing tiles should not update bitmasks
+ node->update_bitmask_area(Point2(p_pos));
+ }
+}
+
+void TileMapEditor::_manual_toggled(bool p_enabled) {
+ manual_autotile = p_enabled;
+ _update_palette();
}
void TileMapEditor::_text_entered(const String &p_text) {
@@ -233,8 +353,10 @@ void TileMapEditor::_update_palette() {
if (!node)
return;
- int selected = get_selected_tile();
+ Vector<int> selected = get_selected_tiles();
palette->clear();
+ manual_palette->clear();
+ manual_palette->hide();
Ref<TileSet> tileset = node->get_tileset();
if (tileset.is_null())
@@ -242,7 +364,6 @@ void TileMapEditor::_update_palette() {
List<int> tiles;
tileset->get_tile_list(&tiles);
-
if (tiles.empty())
return;
@@ -258,6 +379,9 @@ void TileMapEditor::_update_palette() {
palette->set_fixed_icon_size(Size2(min_size, min_size));
palette->set_fixed_column_width(min_size * MAX(size_slider->get_value(), 1));
+ palette->set_same_column_width(true);
+ manual_palette->set_fixed_icon_size(Size2(min_size, min_size));
+ manual_palette->set_same_column_width(true);
String filter = search_box->get_text().strip_edges();
@@ -318,12 +442,54 @@ void TileMapEditor::_update_palette() {
palette->set_item_metadata(palette->get_item_count() - 1, entries[i].id);
}
- palette->set_same_column_width(true);
-
- if (selected != -1)
- set_selected_tile(selected);
- else
+ int sel_tile = selected.get(0);
+ if (selected.get(0) != TileMap::INVALID_CELL) {
+ set_selected_tiles(selected);
+ sel_tile = selected.get(Math::rand() % selected.size());
+ } else {
palette->select(0);
+ }
+
+ if (manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) {
+
+ const Map<Vector2, uint16_t> &tiles = tileset->autotile_get_bitmask_map(sel_tile);
+
+ Vector<Vector2> entries;
+ for (const Map<Vector2, uint16_t>::Element *E = tiles.front(); E; E = E->next()) {
+ entries.push_back(E->key());
+ }
+ entries.sort();
+
+ Ref<Texture> tex = tileset->tile_get_texture(sel_tile);
+
+ for (int i = 0; i < entries.size(); i++) {
+
+ manual_palette->add_item(String());
+
+ if (tex.is_valid()) {
+
+ Rect2 region = tileset->tile_get_region(sel_tile);
+ int spacing = tileset->autotile_get_spacing(sel_tile);
+ region.size = tileset->autotile_get_size(sel_tile); // !!
+ region.position += (region.size + Vector2(spacing, spacing)) * entries[i];
+
+ if (!region.has_no_area())
+ manual_palette->set_item_icon_region(manual_palette->get_item_count() - 1, region);
+
+ manual_palette->set_item_icon(manual_palette->get_item_count() - 1, tex);
+ }
+
+ manual_palette->set_item_metadata(manual_palette->get_item_count() - 1, entries[i]);
+ }
+ }
+
+ if (manual_palette->get_item_count() > 0) {
+ // Only show the manual palette if at least tile exists in it
+ int selected = manual_palette->get_current();
+ if (selected == -1) selected = 0;
+ manual_palette->set_current(selected);
+ manual_palette->show();
+ }
}
void TileMapEditor::_pick_tile(const Point2 &p_pos) {
@@ -339,7 +505,10 @@ void TileMapEditor::_pick_tile(const Point2 &p_pos) {
_update_palette();
}
- set_selected_tile(id);
+ Vector<int> selected;
+
+ selected.push_back(id);
+ set_selected_tiles(selected);
mirror_x->set_pressed(node->is_cell_x_flipped(p_pos.x, p_pos.y));
mirror_y->set_pressed(node->is_cell_y_flipped(p_pos.x, p_pos.y));
@@ -352,18 +521,21 @@ void TileMapEditor::_pick_tile(const Point2 &p_pos) {
PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) {
int prev_id = node->get_cell(p_start.x, p_start.y);
- int id = TileMap::INVALID_CELL;
+ Vector<int> ids;
+ ids.push_back(TileMap::INVALID_CELL);
if (!erase) {
- id = get_selected_tile();
+ ids = get_selected_tiles();
- if (id == TileMap::INVALID_CELL)
+ if (ids.size() == 0 && ids[0] == TileMap::INVALID_CELL)
return PoolVector<Vector2>();
} else if (prev_id == TileMap::INVALID_CELL) {
return PoolVector<Vector2>();
}
- if (id == prev_id) {
- return PoolVector<Vector2>();
+ for (int i = ids.size() - 1; i >= 0; i--) {
+ if (ids[i] == prev_id) {
+ return PoolVector<Vector2>();
+ }
}
Rect2i r = node->_edit_get_rect();
@@ -453,13 +625,13 @@ void TileMapEditor::_fill_points(const PoolVector<Vector2> p_points, const Dicti
int len = p_points.size();
PoolVector<Vector2>::Read pr = p_points.read();
- int id = p_op["id"];
+ Vector<int> ids = p_op["id"];
bool xf = p_op["flip_h"];
bool yf = p_op["flip_v"];
bool tr = p_op["transpose"];
for (int i = 0; i < len; i++) {
- _set_cell(pr[i], id, xf, yf, tr);
+ _set_cell(pr[i], ids, xf, yf, tr);
node->make_bitmask_area_dirty(pr[i]);
}
node->update_dirty_bitmask();
@@ -472,7 +644,7 @@ void TileMapEditor::_erase_points(const PoolVector<Vector2> p_points) {
for (int i = 0; i < len; i++) {
- _set_cell(pr[i], TileMap::INVALID_CELL);
+ _set_cell(pr[i], invalid_cell);
}
}
@@ -507,9 +679,17 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h
Rect2 r = node->get_tileset()->tile_get_region(p_cell);
if (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::AUTO_TILE) {
+ Vector2 offset;
+ int selected = manual_palette->get_current();
+ if (manual_autotile && selected != -1) {
+ offset = manual_palette->get_item_metadata(selected);
+ } else {
+ offset = node->get_tileset()->autotile_get_icon_coordinate(p_cell);
+ }
+
int spacing = node->get_tileset()->autotile_get_spacing(p_cell);
r.size = node->get_tileset()->autotile_get_size(p_cell);
- r.position += (r.size + Vector2(spacing, spacing)) * node->get_tileset()->autotile_get_icon_coordinate(p_cell);
+ r.position += (r.size + Vector2(spacing, spacing)) * offset;
}
Size2 sc = p_xform.get_scale();
@@ -698,7 +878,11 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mb->get_shift()) {
+#ifdef APPLE_STYLE_KEYS
+ if (mb->get_command())
+#else
if (mb->get_control())
+#endif
tool = TOOL_RECTANGLE_PAINT;
else
tool = TOOL_LINE_PAINT;
@@ -708,9 +892,11 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
-
+#ifdef APPLE_STYLE_KEYS
+ if (mb->get_command()) {
+#else
if (mb->get_control()) {
-
+#endif
tool = TOOL_PICKING;
_pick_tile(over_tile);
@@ -722,14 +908,13 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_PAINTING) {
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
- if (id != TileMap::INVALID_CELL) {
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
tool = TOOL_PAINTING;
- undo_redo->create_action(TTR("Paint TileMap"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ _start_undo(TTR("Paint TileMap"));
}
} else if (tool == TOOL_PICKING) {
@@ -748,30 +933,27 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_PAINTING) {
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
- if (id != TileMap::INVALID_CELL) {
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
- _set_cell(over_tile, id, flip_h, flip_v, transpose);
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
- undo_redo->commit_action();
+ _set_cell(over_tile, ids, flip_h, flip_v, transpose);
+ _finish_undo();
paint_undo.clear();
}
} else if (tool == TOOL_LINE_PAINT) {
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
- if (id != TileMap::INVALID_CELL) {
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
- undo_redo->create_action(TTR("Line Draw"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ _start_undo(TTR("Line Draw"));
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- _set_cell(E->key(), id, flip_h, flip_v, transpose);
+ _set_cell(E->key(), ids, flip_h, flip_v, transpose);
}
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
- undo_redo->commit_action();
+ _finish_undo();
paint_undo.clear();
@@ -779,39 +961,62 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
} else if (tool == TOOL_RECTANGLE_PAINT) {
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
- if (id != TileMap::INVALID_CELL) {
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
- undo_redo->create_action(TTR("Rectangle Paint"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ _start_undo(TTR("Rectangle Paint"));
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
- _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose);
+ _set_cell(Point2i(j, i), ids, flip_h, flip_v, transpose);
}
}
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
- undo_redo->commit_action();
+ _finish_undo();
canvas_item_editor->update();
}
} else if (tool == TOOL_DUPLICATING) {
Point2 ofs = over_tile - rectangle.position;
+ Vector<int> ids;
- undo_redo->create_action(TTR("Duplicate"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ _start_undo(TTR("Duplicate"));
+ ids.push_back(0);
for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
- _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose);
+ ids[0] = E->get().cell;
+ _set_cell(E->get().pos + ofs, ids, E->get().flip_h, E->get().flip_v, E->get().transpose);
}
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
- undo_redo->commit_action();
+ _finish_undo();
copydata.clear();
canvas_item_editor->update();
+ } else if (tool == TOOL_MOVING) {
+
+ Point2 ofs = over_tile - rectangle.position;
+ Vector<int> ids;
+
+ _start_undo(TTR("Move"));
+ ids.push_back(TileMap::INVALID_CELL);
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
+
+ _set_cell(Point2i(j, i), ids, false, false, false);
+ }
+ }
+ for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
+
+ ids[0] = E->get().cell;
+ _set_cell(E->get().pos + ofs, ids, E->get().flip_h, E->get().flip_v, E->get().transpose);
+ }
+ _finish_undo();
+
+ copydata.clear();
+ selection_active = false;
+
+ canvas_item_editor->update();
} else if (tool == TOOL_SELECTING) {
@@ -825,17 +1030,15 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return false;
undo_redo->create_action(TTR("Bucket Fill"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
Dictionary op;
- op["id"] = get_selected_tile();
+ op["id"] = get_selected_tiles();
op["flip_h"] = flip_h;
op["flip_v"] = flip_v;
op["transpose"] = transpose;
_fill_points(points, op);
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
undo_redo->commit_action();
// We want to keep the bucket-tool active
@@ -871,18 +1074,30 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
+ if (tool == TOOL_MOVING) {
+
+ tool = TOOL_NONE;
+ copydata.clear();
+
+ canvas_item_editor->update();
+
+ return true;
+ }
+
if (tool == TOOL_NONE) {
paint_undo.clear();
Point2 local = node->world_to_map(xform_inv.xform(mb->get_position()));
- undo_redo->create_action(TTR("Erase TileMap"));
- undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));
+ _start_undo(TTR("Erase TileMap"));
if (mb->get_shift()) {
-
+#ifdef APPLE_STYLE_KEYS
+ if (mb->get_command())
+#else
if (mb->get_control())
+#endif
tool = TOOL_RECTANGLE_ERASE;
else
tool = TOOL_LINE_ERASE;
@@ -893,7 +1108,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
tool = TOOL_ERASING;
- _set_cell(local, TileMap::INVALID_CELL);
+ _set_cell(local, invalid_cell);
}
return true;
@@ -902,8 +1117,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
} else {
if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
- undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));
- undo_redo->commit_action();
+ _finish_undo();
if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
canvas_item_editor->update();
@@ -915,8 +1129,10 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
} else if (tool == TOOL_BUCKET) {
+ Vector<int> ids;
+ ids.push_back(node->get_cell(over_tile.x, over_tile.y));
Dictionary pop;
- pop["id"] = node->get_cell(over_tile.x, over_tile.y);
+ pop["id"] = ids;
pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y);
pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y);
pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y);
@@ -964,7 +1180,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
// Paint using bresenham line to prevent holes in painting if the user moves fast
Vector<Point2i> points = line(old_over_tile.x, over_tile.x, old_over_tile.y, over_tile.y);
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
for (int i = 0; i < points.size(); ++i) {
@@ -974,7 +1190,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
paint_undo[pos] = _get_op_from_cell(pos);
}
- _set_cell(pos, id, flip_h, flip_v, transpose);
+ _set_cell(pos, ids, flip_h, flip_v, transpose);
}
return true;
@@ -990,7 +1206,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Point2i pos = points[i];
- _set_cell(pos, TileMap::INVALID_CELL);
+ _set_cell(pos, invalid_cell);
}
return true;
@@ -1005,20 +1221,23 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_LINE_PAINT || tool == TOOL_LINE_ERASE) {
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
+ Vector<int> tmp_cell;
bool erasing = (tool == TOOL_LINE_ERASE);
+ tmp_cell.push_back(0);
if (erasing && paint_undo.size()) {
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr);
+ tmp_cell[0] = E->get().idx;
+ _set_cell(E->key(), tmp_cell, E->get().xf, E->get().yf, E->get().tr);
}
}
paint_undo.clear();
- if (id != TileMap::INVALID_CELL) {
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
Vector<Point2i> points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y);
@@ -1027,7 +1246,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
paint_undo[points[i]] = _get_op_from_cell(points[i]);
if (erasing)
- _set_cell(points[i], TileMap::INVALID_CELL);
+ _set_cell(points[i], invalid_cell);
}
canvas_item_editor->update();
@@ -1037,6 +1256,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
if (tool == TOOL_RECTANGLE_PAINT || tool == TOOL_RECTANGLE_ERASE) {
+ Vector<int> tmp_cell;
+ tmp_cell.push_back(0);
+
_select(rectangle_begin, over_tile);
if (tool == TOOL_RECTANGLE_ERASE) {
@@ -1045,7 +1267,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr);
+ tmp_cell[0] = E->get().idx;
+ _set_cell(E->key(), tmp_cell, E->get().xf, E->get().yf, E->get().tr);
}
}
@@ -1057,7 +1280,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Point2i tile = Point2i(j, i);
paint_undo[tile] = _get_op_from_cell(tile);
- _set_cell(tile, TileMap::INVALID_CELL);
+ _set_cell(tile, invalid_cell);
}
}
}
@@ -1078,7 +1301,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (k->get_scancode() == KEY_ESCAPE) {
- if (tool == TOOL_DUPLICATING)
+ if (tool == TOOL_DUPLICATING || tool == TOOL_MOVING)
copydata.clear();
else if (tool == TOOL_SELECTING || selection_active)
selection_active = false;
@@ -1133,6 +1356,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
}
+ if (ED_IS_SHORTCUT("tile_map_editor/move_selection", p_event)) {
+ if (selection_active) {
+ _update_copydata();
+ tool = TOOL_MOVING;
+ canvas_item_editor->update();
+ return true;
+ }
+ }
if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) {
search_box->select_all();
search_box->grab_focus();
@@ -1142,18 +1373,21 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) {
flip_h = !flip_h;
mirror_x->set_pressed(flip_h);
+ _update_transform_buttons();
canvas_item_editor->update();
return true;
}
if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) {
flip_v = !flip_v;
mirror_y->set_pressed(flip_v);
+ _update_transform_buttons();
canvas_item_editor->update();
return true;
}
if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) {
transpose = !transpose;
transp->set_pressed(transpose);
+ _update_transform_buttons();
canvas_item_editor->update();
return true;
}
@@ -1303,30 +1537,30 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
if (paint_undo.empty())
return;
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
- if (id == TileMap::INVALID_CELL)
+ if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL)
return;
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- _draw_cell(id, E->key(), flip_h, flip_v, transpose, xform);
+ _draw_cell(ids[0], E->key(), flip_h, flip_v, transpose, xform);
}
} else if (tool == TOOL_RECTANGLE_PAINT) {
- int id = get_selected_tile();
+ Vector<int> ids = get_selected_tiles();
- if (id == TileMap::INVALID_CELL)
+ if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL)
return;
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
- _draw_cell(id, Point2i(j, i), flip_h, flip_v, transpose, xform);
+ _draw_cell(ids[0], Point2i(j, i), flip_h, flip_v, transpose, xform);
}
}
- } else if (tool == TOOL_DUPLICATING) {
+ } else if (tool == TOOL_DUPLICATING || tool == TOOL_MOVING) {
if (copydata.empty())
return;
@@ -1361,17 +1595,17 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
} else if (tool == TOOL_BUCKET) {
- int tile = get_selected_tile();
- _draw_fill_preview(tile, over_tile, flip_h, flip_v, transpose, xform);
+ Vector<int> tiles = get_selected_tiles();
+ _draw_fill_preview(tiles[0], over_tile, flip_h, flip_v, transpose, xform);
} else {
- int st = get_selected_tile();
+ Vector<int> st = get_selected_tiles();
- if (st == TileMap::INVALID_CELL)
+ if (st.size() == 1 && st[0] == TileMap::INVALID_CELL)
return;
- _draw_cell(st, over_tile, flip_h, flip_v, transpose, xform);
+ _draw_cell(st[0], over_tile, flip_h, flip_v, transpose, xform);
}
}
}
@@ -1424,12 +1658,14 @@ void TileMapEditor::_tileset_settings_changed() {
void TileMapEditor::_icon_size_changed(float p_value) {
if (node) {
palette->set_icon_scale(p_value);
+ manual_palette->set_icon_scale(p_value);
_update_palette();
}
}
void TileMapEditor::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_manual_toggled"), &TileMapEditor::_manual_toggled);
ClassDB::bind_method(D_METHOD("_text_entered"), &TileMapEditor::_text_entered);
ClassDB::bind_method(D_METHOD("_text_changed"), &TileMapEditor::_text_changed);
ClassDB::bind_method(D_METHOD("_sbox_input"), &TileMapEditor::_sbox_input);
@@ -1438,6 +1674,7 @@ void TileMapEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_canvas_mouse_exit"), &TileMapEditor::_canvas_mouse_exit);
ClassDB::bind_method(D_METHOD("_tileset_settings_changed"), &TileMapEditor::_tileset_settings_changed);
ClassDB::bind_method(D_METHOD("_update_transform_buttons"), &TileMapEditor::_update_transform_buttons);
+ ClassDB::bind_method(D_METHOD("_palette_selected"), &TileMapEditor::_palette_selected);
ClassDB::bind_method(D_METHOD("_fill_points"), &TileMapEditor::_fill_points);
ClassDB::bind_method(D_METHOD("_erase_points"), &TileMapEditor::_erase_points);
@@ -1455,6 +1692,7 @@ TileMapEditor::CellOp TileMapEditor::_get_op_from_cell(const Point2i &p_pos) {
op.yf = true;
if (node->is_cell_transposed(p_pos.x, p_pos.y))
op.tr = true;
+ op.ac = node->get_cell_autotile_coord(p_pos.x, p_pos.y);
}
return op;
}
@@ -1495,6 +1733,8 @@ void TileMapEditor::_update_transform_buttons(Object *p_button) {
TileMapEditor::TileMapEditor(EditorNode *p_editor) {
node = NULL;
+ manual_autotile = false;
+ manual_position = Vector2(0, 0);
canvas_item_editor = NULL;
editor = p_editor;
undo_redo = editor->get_undo_redo();
@@ -1511,8 +1751,11 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
bucket_cache_tile = -1;
bucket_cache_visited = 0;
- ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase selection"), KEY_DELETE);
- ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find tile"), KEY_MASK_CMD + KEY_F);
+ invalid_cell.resize(1);
+ invalid_cell[0] = TileMap::INVALID_CELL;
+
+ ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase Selection"), KEY_DELETE);
+ ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find Tile"), KEY_MASK_CMD + KEY_F);
ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose"), KEY_T);
ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A);
ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S);
@@ -1522,6 +1765,11 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
HBoxContainer *tool_hb2 = memnew(HBoxContainer);
add_child(tool_hb2);
+ manual_button = memnew(CheckBox);
+ manual_button->set_text("Disable Autotile");
+ manual_button->connect("toggled", this, "_manual_toggled");
+ add_child(manual_button);
+
search_box = memnew(LineEdit);
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
search_box->connect("text_entered", this, "_text_entered");
@@ -1540,14 +1788,31 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
int mw = EDITOR_DEF("editors/tile_map/palette_min_width", 80);
+ VSplitContainer *palette_container = memnew(VSplitContainer);
+ palette_container->set_v_size_flags(SIZE_EXPAND_FILL);
+ palette_container->set_custom_minimum_size(Size2(mw, 0));
+ add_child(palette_container);
+
// Add tile palette
palette = memnew(ItemList);
+ palette->set_h_size_flags(SIZE_EXPAND_FILL);
palette->set_v_size_flags(SIZE_EXPAND_FILL);
- palette->set_custom_minimum_size(Size2(mw, 0));
palette->set_max_columns(0);
palette->set_icon_mode(ItemList::ICON_MODE_TOP);
palette->set_max_text_lines(2);
- add_child(palette);
+ palette->set_select_mode(ItemList::SELECT_MULTI);
+ palette->connect("item_selected", this, "_palette_selected");
+ palette_container->add_child(palette);
+
+ // Add autotile override palette
+ manual_palette = memnew(ItemList);
+ manual_palette->set_h_size_flags(SIZE_EXPAND_FILL);
+ manual_palette->set_v_size_flags(SIZE_EXPAND_FILL);
+ manual_palette->set_max_columns(0);
+ manual_palette->set_icon_mode(ItemList::ICON_MODE_TOP);
+ manual_palette->set_max_text_lines(2);
+ manual_palette->hide();
+ palette_container->add_child(manual_palette);
// Add menu items
toolbar = memnew(HBoxContainer);
@@ -1573,8 +1838,11 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD + KEY_B), OPTION_SELECT);
+ p->add_shortcut(ED_SHORTCUT("tile_map_editor/move_selection", TTR("Move Selection"), KEY_MASK_CMD + KEY_M), OPTION_MOVE);
p->add_shortcut(ED_SHORTCUT("tile_map_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD + KEY_D), OPTION_DUPLICATE);
p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION);
+ p->add_separator();
+ p->add_item(TTR("Fix Invalid Tiles"), OPTION_FIX_INVALID);
p->connect("id_pressed", this, "_menu_option");
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 0a937e200e..b8443ca962 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -35,6 +35,7 @@
#include "editor/editor_plugin.h"
#include "scene/2d/tile_map.h"
+#include "scene/gui/check_box.h"
#include "scene/gui/label.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/menu_button.h"
@@ -61,6 +62,7 @@ class TileMapEditor : public VBoxContainer {
TOOL_BUCKET,
TOOL_PICKING,
TOOL_DUPLICATING,
+ TOOL_MOVING
};
enum Options {
@@ -71,9 +73,13 @@ class TileMapEditor : public VBoxContainer {
OPTION_DUPLICATE,
OPTION_ERASE_SELECTION,
OPTION_PAINTING,
+ OPTION_FIX_INVALID,
+ OPTION_MOVE
};
TileMap *node;
+ bool manual_autotile;
+ Vector2 manual_position;
EditorNode *editor;
UndoRedo *undo_redo;
@@ -82,6 +88,7 @@ class TileMapEditor : public VBoxContainer {
LineEdit *search_box;
HSlider *size_slider;
ItemList *palette;
+ ItemList *manual_palette;
HBoxContainer *toolbar;
@@ -94,6 +101,7 @@ class TileMapEditor : public VBoxContainer {
ToolButton *rotate_90;
ToolButton *rotate_180;
ToolButton *rotate_270;
+ CheckBox *manual_button;
Tool tool;
@@ -121,13 +129,13 @@ class TileMapEditor : public VBoxContainer {
bool xf;
bool yf;
bool tr;
+ Vector2 ac;
- CellOp() {
- idx = -1;
- xf = false;
- yf = false;
- tr = false;
- }
+ CellOp() :
+ idx(TileMap::INVALID_CELL),
+ xf(false),
+ yf(false),
+ tr(false) {}
};
Map<Point2i, CellOp> paint_undo;
@@ -138,12 +146,19 @@ class TileMapEditor : public VBoxContainer {
bool flip_h;
bool flip_v;
bool transpose;
- int auto_x;
- int auto_y;
+
+ TileData() :
+ cell(TileMap::INVALID_CELL),
+ flip_h(false),
+ flip_v(false),
+ transpose(false) {}
};
List<TileData> copydata;
+ Map<Point2i, CellOp> undo_data;
+ Vector<int> invalid_cell;
+
void _pick_tile(const Point2 &p_pos);
PoolVector<Vector2> _bucket_fill(const Point2i &p_start, bool erase = false, bool preview = false);
@@ -159,16 +174,21 @@ class TileMapEditor : public VBoxContainer {
void _update_copydata();
- int get_selected_tile() const;
- void set_selected_tile(int p_tile);
+ Vector<int> get_selected_tiles() const;
+ void set_selected_tiles(Vector<int> p_tile);
+ void _manual_toggled(bool p_enabled);
void _text_entered(const String &p_text);
void _text_changed(const String &p_text);
void _sbox_input(const Ref<InputEvent> &p_ie);
void _update_palette();
void _menu_option(int p_option);
+ void _palette_selected(int index);
- void _set_cell(const Point2i &p_pos, int p_value, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false);
+ void _start_undo(const String &p_action);
+ void _finish_undo();
+ void _create_set_cell_undo(const Vector2 &p_vec, const CellOp &p_cell_old, const CellOp &p_cell_new);
+ void _set_cell(const Point2i &p_pos, Vector<int> p_values, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false);
void _canvas_mouse_enter();
void _canvas_mouse_exit();
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 71c0d8a782..087c4293f1 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -123,10 +123,10 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
for (List<uint32_t>::Element *E = shapes.front(); E; E = E->next()) {
if (sb->is_shape_owner_disabled(E->get())) continue;
- Transform2D shape_transform = sb->shape_owner_get_transform(E->get());
+ Transform2D shape_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get());
bool one_way = sb->is_shape_owner_one_way_collision_enabled(E->get());
- shape_transform.set_origin(shape_transform.get_origin() - phys_offset);
+ shape_transform[2] -= phys_offset;
for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) {
@@ -149,6 +149,7 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
p_library->tile_set_light_occluder(id, occluder);
p_library->tile_set_occluder_offset(id, -phys_offset);
p_library->tile_set_navigation_polygon_offset(id, -phys_offset);
+ p_library->tile_set_z_index(id, mi->get_z_index());
}
}
@@ -242,6 +243,7 @@ void TileSetEditor::_bind_methods() {
ClassDB::bind_method("_name_dialog_confirm", &TileSetEditor::_name_dialog_confirm);
ClassDB::bind_method("_on_tile_list_selected", &TileSetEditor::_on_tile_list_selected);
ClassDB::bind_method("_on_edit_mode_changed", &TileSetEditor::_on_edit_mode_changed);
+ ClassDB::bind_method("_on_workspace_overlay_draw", &TileSetEditor::_on_workspace_overlay_draw);
ClassDB::bind_method("_on_workspace_draw", &TileSetEditor::_on_workspace_draw);
ClassDB::bind_method("_on_workspace_input", &TileSetEditor::_on_workspace_input);
ClassDB::bind_method("_on_tool_clicked", &TileSetEditor::_on_tool_clicked);
@@ -256,7 +258,7 @@ void TileSetEditor::_bind_methods() {
}
void TileSetEditor::_notification(int p_what) {
- if (p_what == NOTIFICATION_ENTER_TREE) {
+ if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
tools[TOOL_SELECT]->set_icon(get_icon("ToolSelect", "EditorIcons"));
tools[BITMASK_COPY]->set_icon(get_icon("Duplicate", "EditorIcons"));
tools[BITMASK_PASTE]->set_icon(get_icon("Override", "EditorIcons"));
@@ -277,10 +279,11 @@ void TileSetEditor::_changed_callback(Object *p_changed, const char *p_prop) {
preview->set_region_rect(tileset->tile_get_region(get_current_tile()));
} else if (p_prop == StringName("name")) {
update_tile_list_icon();
- } else if (p_prop == StringName("texture") || p_prop == StringName("tile_mode")) {
+ } else if (p_prop == StringName("texture") || p_prop == StringName("modulate") || p_prop == StringName("tile_mode")) {
_on_tile_list_selected(get_current_tile());
workspace->update();
preview->set_texture(tileset->tile_get_texture(get_current_tile()));
+ preview->set_modulate(tileset->tile_get_modulate(get_current_tile()));
preview->set_region_rect(tileset->tile_get_region(get_current_tile()));
if (tileset->tile_get_tile_mode(get_current_tile()) == TileSet::AUTO_TILE)
property_editor->show();
@@ -401,7 +404,7 @@ void TileSetEditor::initialize_bottom_editor() {
p.push_back((int)SHAPE_DELETE);
tools[SHAPE_DELETE]->connect("pressed", this, "_on_tool_clicked", p);
tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_DELETE]);
- tool_containers[TOOLBAR_SHAPE]->add_change_receptor(memnew(VSeparator));
+ tool_containers[TOOLBAR_SHAPE]->add_child(memnew(VSeparator));
tools[SHAPE_KEEP_INSIDE_TILE] = memnew(ToolButton);
tools[SHAPE_KEEP_INSIDE_TILE]->set_toggle_mode(true);
tools[SHAPE_KEEP_INSIDE_TILE]->set_pressed(true);
@@ -519,10 +522,15 @@ void TileSetEditor::initialize_bottom_editor() {
workspace_container = memnew(Control);
scroll->add_child(workspace_container);
+ workspace_overlay = memnew(Control);
+ workspace_overlay->connect("draw", this, "_on_workspace_overlay_draw");
+ workspace_container->add_child(workspace_overlay);
+
workspace = memnew(Control);
workspace->connect("draw", this, "_on_workspace_draw");
workspace->connect("gui_input", this, "_on_workspace_input");
- workspace_container->add_child(workspace);
+ workspace->set_draw_behind_parent(true);
+ workspace_overlay->add_child(workspace);
preview = memnew(Sprite);
workspace->add_child(preview);
@@ -558,13 +566,21 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
add_child(err_dialog);
err_dialog->set_title(TTR("Error"));
+ draw_handles = false;
+
initialize_bottom_editor();
}
+TileSetEditor::~TileSetEditor() {
+ if (helper)
+ memdelete(helper);
+}
+
void TileSetEditor::_on_tile_list_selected(int p_index) {
if (get_current_tile() >= 0) {
current_item_index = p_index;
preview->set_texture(tileset->tile_get_texture(get_current_tile()));
+ preview->set_modulate(tileset->tile_get_modulate(get_current_tile()));
preview->set_region_rect(tileset->tile_get_region(get_current_tile()));
workspace->set_custom_minimum_size(tileset->tile_get_region(get_current_tile()).size);
update_workspace_tile_mode();
@@ -651,7 +667,7 @@ void TileSetEditor::_on_workspace_draw() {
if (mask & TileSet::BIND_BOTTOMRIGHT) {
workspace->draw_rect(Rect2(anchor + size / 2, size / 2), c);
}
- } else if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_3X3) {
+ } else {
if (mask & TileSet::BIND_TOPLEFT) {
workspace->draw_rect(Rect2(anchor, size / 3), c);
}
@@ -734,9 +750,23 @@ void TileSetEditor::_on_workspace_draw() {
}
}
}
+ workspace_overlay->update();
+}
+
+void TileSetEditor::_on_workspace_overlay_draw() {
+
+ int t_id = get_current_tile();
+ if (t_id < 0 || !draw_handles)
+ return;
+
+ Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
+
+ for (int i = 0; i < current_shape.size(); i++) {
+ workspace_overlay->draw_texture(handle, current_shape[i] * workspace->get_scale().x - handle->get_size() * 0.5);
+ }
}
-#define MIN_DISTANCE_SQUARED 10
+#define MIN_DISTANCE_SQUARED 6
void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
if (get_current_tile() >= 0 && !tileset.is_null()) {
@@ -776,7 +806,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
Vector2 coord((int)(mb->get_position().x / (spacing + size.x)), (int)(mb->get_position().y / (spacing + size.y)));
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
pos = mb->get_position() - pos;
- uint16_t bit;
+ uint16_t bit = 0;
if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) {
if (pos.x < size.x / 2) {
if (pos.y < size.y / 2) {
@@ -791,7 +821,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
bit = TileSet::BIND_BOTTOMRIGHT;
}
}
- } else if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_3X3) {
+ } else {
if (pos.x < size.x / 3) {
if (pos.y < size.y / 3) {
bit = TileSet::BIND_TOPLEFT;
@@ -839,7 +869,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
Vector2 coord((int)(mm->get_position().x / (spacing + size.x)), (int)(mm->get_position().y / (spacing + size.y)));
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
pos = mm->get_position() - pos;
- uint16_t bit;
+ uint16_t bit = 0;
if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_2X2) {
if (pos.x < size.x / 2) {
if (pos.y < size.y / 2) {
@@ -854,7 +884,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
bit = TileSet::BIND_BOTTOMRIGHT;
}
}
- } else if (tileset->autotile_get_bitmask_mode(get_current_tile()) == TileSet::BITMASK_3X3) {
+ } else {
if (pos.x < size.x / 3) {
if (pos.y < size.y / 3) {
bit = TileSet::BIND_TOPLEFT;
@@ -1117,7 +1147,7 @@ void TileSetEditor::_on_tool_clicked(int p_tool) {
case EDITMODE_COLLISION: {
if (!edited_collision_shape.is_null()) {
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(get_current_tile());
- int index;
+ int index = -1;
for (int i = 0; i < sd.size(); i++) {
if (sd[i].shape == edited_collision_shape) {
index = i;
@@ -1157,15 +1187,18 @@ void TileSetEditor::_on_tool_clicked(int p_tool) {
scale /= 2;
workspace->set_scale(Vector2(scale, scale));
workspace_container->set_custom_minimum_size(preview->get_region_rect().size * scale);
+ workspace_overlay->set_custom_minimum_size(preview->get_region_rect().size * scale);
}
} else if (p_tool == ZOOM_1) {
workspace->set_scale(Vector2(1, 1));
workspace_container->set_custom_minimum_size(preview->get_region_rect().size);
+ workspace_overlay->set_custom_minimum_size(preview->get_region_rect().size);
} else if (p_tool == ZOOM_IN) {
float scale = workspace->get_scale().x;
scale *= 2;
workspace->set_scale(Vector2(scale, scale));
workspace_container->set_custom_minimum_size(preview->get_region_rect().size * scale);
+ workspace_overlay->set_custom_minimum_size(preview->get_region_rect().size * scale);
} else if (p_tool == TOOL_SELECT) {
if (creating_shape) {
//Cancel Creation
@@ -1287,6 +1320,8 @@ void TileSetEditor::draw_polygon_shapes() {
if (t_id < 0)
return;
+ draw_handles = false;
+
switch (edit_mode) {
case EDITMODE_COLLISION: {
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(t_id);
@@ -1334,9 +1369,7 @@ void TileSetEditor::draw_polygon_shapes() {
}
if (shape == edited_collision_shape) {
- for (int j = 0; j < current_shape.size(); j++) {
- workspace->draw_circle(current_shape[j], 8 / workspace->get_scale().x, Color(1, 0, 0, 0.7f));
- }
+ draw_handles = true;
}
}
}
@@ -1362,9 +1395,7 @@ void TileSetEditor::draw_polygon_shapes() {
}
workspace->draw_line(shape->get_polygon()[shape->get_polygon().size() - 1], shape->get_polygon()[0], c_border, 1, true);
if (shape == edited_occlusion_shape) {
- for (int j = 0; j < current_shape.size(); j++) {
- workspace->draw_circle(current_shape[j], 8 / workspace->get_scale().x, Color(1, 0, 0));
- }
+ draw_handles = true;
}
}
} else {
@@ -1407,9 +1438,7 @@ void TileSetEditor::draw_polygon_shapes() {
}
workspace->draw_line(shape->get_polygon()[shape->get_polygon().size() - 1] + anchor, shape->get_polygon()[0] + anchor, c_border, 1, true);
if (shape == edited_occlusion_shape) {
- for (int j = 0; j < current_shape.size(); j++) {
- workspace->draw_circle(current_shape[j], 8 / workspace->get_scale().x, Color(1, 0, 0));
- }
+ draw_handles = true;
}
}
}
@@ -1440,9 +1469,7 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_line(vertices[shape->get_polygon(0)[j]], vertices[shape->get_polygon(0)[j + 1]], c_border, 1, true);
}
if (shape == edited_navigation_shape) {
- for (int j = 0; j < current_shape.size(); j++) {
- workspace->draw_circle(current_shape[j], 8 / workspace->get_scale().x, Color(1, 0, 0));
- }
+ draw_handles = true;
}
}
}
@@ -1489,9 +1516,7 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_line(vertices[shape->get_polygon(0)[j]] + anchor, vertices[shape->get_polygon(0)[j + 1]] + anchor, c_border, 1, true);
}
if (shape == edited_navigation_shape) {
- for (int j = 0; j < current_shape.size(); j++) {
- workspace->draw_circle(current_shape[j], 8 / workspace->get_scale().x, Color(1, 0, 0));
- }
+ draw_handles = true;
}
}
}
@@ -1714,6 +1739,7 @@ void TileSetEditor::update_tile_list() {
region.position += pos;
}
tile_list->set_item_icon_region(tile_list->get_item_count() - 1, region);
+ tile_list->set_item_icon_modulate(tile_list->get_item_count() - 1, tileset->tile_get_modulate(E->get()));
}
if (tile_list->get_item_count() > 0 && selected_tile < tile_list->get_item_count()) {
tile_list->select(selected_tile);
@@ -1741,6 +1767,7 @@ void TileSetEditor::update_tile_list_icon() {
tile_list->set_item_metadata(current_idx, E->get());
tile_list->set_item_icon(current_idx, tileset->tile_get_texture(E->get()));
tile_list->set_item_icon_region(current_idx, region);
+ tile_list->set_item_icon_modulate(current_idx, tileset->tile_get_modulate(E->get()));
tile_list->set_item_text(current_idx, tileset->tile_get_name(E->get()));
current_idx += 1;
}
@@ -1804,6 +1831,8 @@ bool TileSetEditorHelper::_get(const StringName &p_name, Variant &r_ret) const {
if (selected_tile < 0 || tileset.is_null())
return false;
+ if (!tileset->has_tile(selected_tile))
+ return false;
String name = p_name.operator String();
bool v = false;
@@ -1820,7 +1849,7 @@ void TileSetEditorHelper::_get_property_list(List<PropertyInfo> *p_list) const {
if (selected_tile < 0 || tileset.is_null())
return;
- p_list->push_back(PropertyInfo(Variant::INT, "bitmask_mode", PROPERTY_HINT_ENUM, "2x2,3x3"));
+ p_list->push_back(PropertyInfo(Variant::INT, "bitmask_mode", PROPERTY_HINT_ENUM, "2x2,3x3 (minimal),3x3"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "layout/tile_size"));
p_list->push_back(PropertyInfo(Variant::INT, "layout/spacing", PROPERTY_HINT_RANGE, "0,256,1"));
}
@@ -1828,6 +1857,7 @@ void TileSetEditorHelper::_get_property_list(List<PropertyInfo> *p_list) const {
TileSetEditorHelper::TileSetEditorHelper(TileSetEditor *p_tileset_editor) {
tileset_editor = p_tileset_editor;
+ selected_tile = -1;
}
void TileSetEditorPlugin::edit(Object *p_node) {
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index 0404c5236a..4894d641a3 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -91,6 +91,8 @@ class TileSetEditor : public Control {
Sprite *preview;
ScrollContainer *scroll;
Control *workspace_container;
+ bool draw_handles;
+ Control *workspace_overlay;
Control *workspace;
Button *tool_editmode[EDITMODE_MAX];
HBoxContainer *tool_containers[TOOLBAR_MAX];
@@ -155,10 +157,12 @@ public:
static Error update_library_file(Node *p_base_scene, Ref<TileSet> ml, bool p_merge = true);
TileSetEditor(EditorNode *p_editor);
+ ~TileSetEditor();
private:
void _on_tile_list_selected(int p_index);
void _on_edit_mode_changed(int p_edit_mode);
+ void _on_workspace_overlay_draw();
void _on_workspace_draw();
void _on_workspace_input(const Ref<InputEvent> &p_ie);
void _on_tool_clicked(int p_tool);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index d15a37a19c..9f87fc82b5 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -56,6 +56,12 @@ void ProjectExportDialog::_notification(int p_what) {
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect());
} break;
+ case NOTIFICATION_THEME_CHANGED: {
+ delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
+ Control *panel = custom_feature_display->get_parent_control();
+ if (panel)
+ panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ } break;
}
}
@@ -75,7 +81,14 @@ void ProjectExportDialog::popup_export() {
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds"));
} else {
- popup_centered_ratio();
+
+ Size2 popup_size = Size2(900, 700) * editor_get_scale();
+ Size2 window_size = get_viewport_rect().size;
+
+ popup_size.x = MIN(window_size.x * 0.8, popup_size.x);
+ popup_size.y = MIN(window_size.y * 0.8, popup_size.y);
+
+ popup_centered(popup_size);
}
}
@@ -201,9 +214,9 @@ void ProjectExportDialog::_edit_preset(int p_index) {
TreeItem *patch_add = patches->create_item(patch_root);
patch_add->set_metadata(0, patchlist.size());
if (patchlist.size() == 0)
- patch_add->set_text(0, "Add initial export..");
+ patch_add->set_text(0, "Add initial export...");
else
- patch_add->set_text(0, "Add previous patches..");
+ patch_add->set_text(0, "Add previous patches...");
patch_add->add_button(0, get_icon("folder", "FileDialog"), 1);
@@ -697,9 +710,9 @@ void ProjectExportDialog::_export_pck_zip_selected(const String &p_path) {
ERR_FAIL_COND(platform.is_null());
if (p_path.ends_with(".zip")) {
- platform->save_zip(current, p_path);
+ platform->export_zip(current, export_pck_zip_debug->is_pressed(), p_path);
} else if (p_path.ends_with(".pck")) {
- platform->save_pack(current, p_path);
+ platform->export_pack(current, export_pck_zip_debug->is_pressed(), p_path);
}
}
@@ -797,7 +810,7 @@ ProjectExportDialog::ProjectExportDialog() {
preset_vb->add_child(preset_hb);
add_preset = memnew(MenuButton);
- add_preset->set_text(TTR("Add.."));
+ add_preset->set_text(TTR("Add..."));
add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
preset_hb->add_child(add_preset);
MarginContainer *mc = memnew(MarginContainer);
@@ -975,11 +988,20 @@ ProjectExportDialog::ProjectExportDialog() {
export_debug->set_pressed(true);
export_project->get_vbox()->add_child(export_debug);
+ export_pck_zip_debug = memnew(CheckButton);
+ export_pck_zip_debug->set_text(TTR("Export With Debug"));
+ export_pck_zip_debug->set_pressed(true);
+ export_pck_zip->get_vbox()->add_child(export_pck_zip_debug);
+
set_hide_on_ok(false);
editor_icons = "EditorIcons";
default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", String());
+
+ if (default_filename == "") {
+ default_filename = ProjectSettings::get_singleton()->get("application/config/name");
+ }
}
ProjectExportDialog::~ProjectExportDialog() {
diff --git a/editor/project_export.h b/editor/project_export.h
index 6c74743769..b62254974d 100644
--- a/editor/project_export.h
+++ b/editor/project_export.h
@@ -131,6 +131,7 @@ private:
FileDialog *export_pck_zip;
FileDialog *export_project;
CheckButton *export_debug;
+ CheckButton *export_pck_zip_debug;
void _open_export_template_manager();
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index bd700342f6..0d06b71420 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -199,6 +199,7 @@ private:
sp = TTR("Imported Project");
project_name->set_text(sp);
+ _text_changed(sp);
}
}
@@ -222,6 +223,7 @@ private:
}
String sp = p.simplify_path();
project_path->set_text(sp);
+ _path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
}
@@ -230,6 +232,7 @@ private:
String p = p_path;
String sp = p.simplify_path();
project_path->set_text(sp);
+ _path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
}
@@ -250,8 +253,10 @@ private:
void _create_folder() {
- if (project_name->get_text() == "" || created_folder_path != "")
+ if (project_name->get_text() == "" || created_folder_path != "" || project_name->get_text().ends_with(".") || project_name->get_text().ends_with(" ")) {
+ set_message(TTR("Invalid Project Name."), MESSAGE_WARNING);
return;
+ }
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (d->change_dir(project_path->get_text()) == OK) {
@@ -261,7 +266,9 @@ private:
if (d->make_dir(project_name->get_text()) == OK) {
d->change_dir(project_name->get_text());
- project_path->set_text(d->get_current_dir());
+ String dir_str = d->get_current_dir();
+ project_path->set_text(dir_str);
+ _path_text_changed(dir_str);
created_folder_path = d->get_current_dir();
create_dir->set_disabled(true);
} else {
@@ -473,7 +480,9 @@ private:
_remove_created_folder();
project_path->clear();
+ _path_text_changed("");
project_name->clear();
+ _text_changed("");
if (status_rect->get_texture() == get_icon("StatusError", "EditorIcons"))
msg->show();
@@ -538,7 +547,9 @@ public:
msg->show();
get_ok()->set_disabled(true);
} else if (current->has_setting("application/config/name")) {
- project_name->set_text(current->get("application/config/name"));
+ String proj = current->get("application/config/name");
+ project_name->set_text(proj);
+ _text_changed(proj);
}
project_name->call_deferred("grab_focus");
@@ -557,7 +568,9 @@ public:
fdialog->set_current_dir(d->get_current_dir());
memdelete(d);
}
- project_name->set_text(TTR("New Game Project"));
+ String proj = TTR("New Game Project");
+ project_name->set_text(proj);
+ _text_changed(proj);
project_path->set_editable(true);
browse->set_disabled(false);
@@ -689,7 +702,7 @@ void ProjectManager::_notification(int p_what) {
} break;
case NOTIFICATION_READY: {
- if (scroll_children->get_child_count() == 0)
+ if (scroll_children->get_child_count() == 0 && StreamPeerSSL::is_available())
open_templates->popup_centered_minsize();
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -723,9 +736,11 @@ void ProjectManager::_update_project_buttons() {
}
}
- erase_btn->set_disabled(selected_list.size() < 1);
- open_btn->set_disabled(selected_list.size() < 1);
- rename_btn->set_disabled(selected_list.size() < 1);
+ bool empty_selection = selected_list.empty();
+ erase_btn->set_disabled(empty_selection);
+ open_btn->set_disabled(empty_selection);
+ rename_btn->set_disabled(empty_selection);
+ run_btn->set_disabled(empty_selection);
}
void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
@@ -1517,18 +1532,43 @@ ProjectManager::ProjectManager() {
EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came
{
- int dpi_mode = EditorSettings::get_singleton()->get("interface/editor/hidpi_mode");
- if (dpi_mode == 0) {
- const int screen = OS::get_singleton()->get_current_screen();
- editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0);
- } else if (dpi_mode == 1) {
- editor_set_scale(0.75);
- } else if (dpi_mode == 2) {
- editor_set_scale(1.0);
- } else if (dpi_mode == 3) {
- editor_set_scale(1.5);
- } else if (dpi_mode == 4) {
- editor_set_scale(2.0);
+ int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale");
+ float custom_display_scale = EditorSettings::get_singleton()->get("interface/editor/custom_display_scale");
+
+ switch (display_scale) {
+ case 0: {
+ // Try applying a suitable display scale automatically
+ const int screen = OS::get_singleton()->get_current_screen();
+ editor_set_scale(OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000 ? 2.0 : 1.0);
+ } break;
+
+ case 1: {
+ editor_set_scale(0.75);
+ } break;
+
+ case 2: {
+ editor_set_scale(1.0);
+ } break;
+
+ case 3: {
+ editor_set_scale(1.25);
+ } break;
+
+ case 4: {
+ editor_set_scale(1.5);
+ } break;
+
+ case 5: {
+ editor_set_scale(1.75);
+ } break;
+
+ case 6: {
+ editor_set_scale(2.0);
+ } break;
+
+ default: {
+ editor_set_scale(custom_display_scale);
+ } break;
}
}
@@ -1570,7 +1610,7 @@ ProjectManager::ProjectManager() {
String hash = String(VERSION_HASH);
if (hash.length() != 0)
hash = "." + hash.left(7);
- l->set_text("v" VERSION_MKSTRING "" + hash);
+ l->set_text("v" VERSION_FULL_BUILD "" + hash);
l->set_align(Label::ALIGN_CENTER);
top_hb->add_child(l);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 9625bc19c0..cf136a5e58 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -31,6 +31,7 @@
#include "project_settings_editor.h"
#include "core/global_constants.h"
+#include "core/input_map.h"
#include "core/os/keyboard.h"
#include "core/project_settings.h"
#include "core/translation.h"
@@ -110,11 +111,28 @@ void ProjectSettingsEditor::_notification(int p_what) {
EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+
+ search_button->set_icon(get_icon("Search", "EditorIcons"));
+ clear_button->set_icon(get_icon("Close", "EditorIcons"));
+ action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
+ popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
+ popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
+ popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons"));
+ popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons"));
_update_actions();
} break;
}
}
+static bool _validate_action_name(const String &p_name) {
+ const CharType *cstr = p_name.c_str();
+ for (int i = 0; cstr[i]; i++)
+ if (cstr[i] == '/' || cstr[i] == ':' || cstr[i] == '"' ||
+ cstr[i] == '=' || cstr[i] == '\\' || cstr[i] < 32)
+ return false;
+ return true;
+}
+
void ProjectSettingsEditor::_action_selected() {
TreeItem *ti = input_editor->get_selected();
@@ -131,53 +149,71 @@ void ProjectSettingsEditor::_action_edited() {
if (!ti)
return;
- String new_name = ti->get_text(0);
- String old_name = add_at.substr(add_at.find("/") + 1, add_at.length());
+ if (input_editor->get_selected_column() == 0) {
- if (new_name == old_name)
- return;
+ String new_name = ti->get_text(0);
+ String old_name = add_at.substr(add_at.find("/") + 1, add_at.length());
- if (new_name.find("/") != -1 || new_name.find(":") != -1 || new_name == "") {
+ if (new_name == old_name)
+ return;
- ti->set_text(0, old_name);
- add_at = "input/" + old_name;
+ if (new_name == "" || !_validate_action_name(new_name)) {
- message->set_text(TTR("Invalid action (anything goes but '/' or ':')."));
- message->popup_centered(Size2(300, 100) * EDSCALE);
- return;
- }
+ ti->set_text(0, old_name);
+ add_at = "input/" + old_name;
- String action_prop = "input/" + new_name;
+ message->set_text(TTR("Invalid action name. it cannot be empty nor contain '/', ':', '=', '\\' or '\"'"));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
+ return;
+ }
- if (ProjectSettings::get_singleton()->has_setting(action_prop)) {
+ String action_prop = "input/" + new_name;
- ti->set_text(0, old_name);
- add_at = "input/" + old_name;
+ if (ProjectSettings::get_singleton()->has_setting(action_prop)) {
- message->set_text(vformat(TTR("Action '%s' already exists!"), new_name));
- message->popup_centered(Size2(300, 100) * EDSCALE);
- return;
- }
+ ti->set_text(0, old_name);
+ add_at = "input/" + old_name;
- int order = ProjectSettings::get_singleton()->get_order(add_at);
- Array va = ProjectSettings::get_singleton()->get(add_at);
-
- setting = true;
- undo_redo->create_action(TTR("Rename Input Action Event"));
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", add_at);
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", action_prop, va);
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", action_prop, order);
- undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", action_prop);
- undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", add_at, va);
- undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", add_at, order);
- undo_redo->add_do_method(this, "_update_actions");
- undo_redo->add_undo_method(this, "_update_actions");
- undo_redo->add_do_method(this, "_settings_changed");
- undo_redo->add_undo_method(this, "_settings_changed");
- undo_redo->commit_action();
- setting = false;
+ message->set_text(vformat(TTR("Action '%s' already exists!"), new_name));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
+ return;
+ }
- add_at = action_prop;
+ int order = ProjectSettings::get_singleton()->get_order(add_at);
+ Dictionary action = ProjectSettings::get_singleton()->get(add_at);
+
+ setting = true;
+ undo_redo->create_action(TTR("Rename Input Action Event"));
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", add_at);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", action_prop, action);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", action_prop, order);
+ undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", action_prop);
+ undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", add_at, action);
+ undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", add_at, order);
+ undo_redo->add_do_method(this, "_update_actions");
+ undo_redo->add_undo_method(this, "_update_actions");
+ undo_redo->add_do_method(this, "_settings_changed");
+ undo_redo->add_undo_method(this, "_settings_changed");
+ undo_redo->commit_action();
+ setting = false;
+
+ add_at = action_prop;
+ } else if (input_editor->get_selected_column() == 1) {
+
+ String name = "input/" + ti->get_text(0);
+ Dictionary old_action = ProjectSettings::get_singleton()->get(name);
+ Dictionary new_action = old_action.duplicate();
+ new_action["deadzone"] = ti->get_range(1);
+
+ undo_redo->create_action(TTR("Change Action deadzone"));
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, new_action);
+ undo_redo->add_do_method(this, "_update_actions");
+ undo_redo->add_do_method(this, "_settings_changed");
+ undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_action);
+ undo_redo->add_undo_method(this, "_update_actions");
+ undo_redo->add_undo_method(this, "_settings_changed");
+ undo_redo->commit_action();
+ }
}
void ProjectSettingsEditor::_device_input_add() {
@@ -185,8 +221,9 @@ void ProjectSettingsEditor::_device_input_add() {
Ref<InputEvent> ie;
String name = add_at;
int idx = edit_idx;
- Array old_val = ProjectSettings::get_singleton()->get(name);
- Array arr = old_val.duplicate();
+ Dictionary old_val = ProjectSettings::get_singleton()->get(name);
+ Dictionary action = old_val.duplicate();
+ Array events = action["events"];
switch (add_type) {
@@ -195,11 +232,11 @@ void ProjectSettingsEditor::_device_input_add() {
Ref<InputEventMouseButton> mb;
mb.instance();
mb->set_button_index(device_index->get_selected() + 1);
- mb->set_device(device_id->get_value());
+ mb->set_device(_get_current_device());
- for (int i = 0; i < arr.size(); i++) {
+ for (int i = 0; i < events.size(); i++) {
- Ref<InputEventMouseButton> aie = arr[i];
+ Ref<InputEventMouseButton> aie = events[i];
if (aie.is_null())
continue;
if (aie->get_device() == mb->get_device() && aie->get_button_index() == mb->get_button_index()) {
@@ -216,13 +253,14 @@ void ProjectSettingsEditor::_device_input_add() {
jm.instance();
jm->set_axis(device_index->get_selected() >> 1);
jm->set_axis_value(device_index->get_selected() & 1 ? 1 : -1);
- jm->set_device(device_id->get_value());
+ jm->set_device(_get_current_device());
- for (int i = 0; i < arr.size(); i++) {
+ for (int i = 0; i < events.size(); i++) {
- Ref<InputEventJoypadMotion> aie = arr[i];
+ Ref<InputEventJoypadMotion> aie = events[i];
if (aie.is_null())
continue;
+
if (aie->get_device() == jm->get_device() && aie->get_axis() == jm->get_axis() && aie->get_axis_value() == jm->get_axis_value()) {
return;
}
@@ -237,11 +275,11 @@ void ProjectSettingsEditor::_device_input_add() {
jb.instance();
jb->set_button_index(device_index->get_selected());
- jb->set_device(device_id->get_value());
+ jb->set_device(_get_current_device());
- for (int i = 0; i < arr.size(); i++) {
+ for (int i = 0; i < events.size(); i++) {
- Ref<InputEventJoypadButton> aie = arr[i];
+ Ref<InputEventJoypadButton> aie = events[i];
if (aie.is_null())
continue;
if (aie->get_device() == jb->get_device() && aie->get_button_index() == jb->get_button_index()) {
@@ -254,14 +292,15 @@ void ProjectSettingsEditor::_device_input_add() {
default: {}
}
- if (idx < 0 || idx >= arr.size()) {
- arr.push_back(ie);
+ if (idx < 0 || idx >= events.size()) {
+ events.push_back(ie);
} else {
- arr[idx] = ie;
+ events[idx] = ie;
}
+ action["events"] = events;
undo_redo->create_action(TTR("Add Input Action Event"));
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, arr);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, action);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val);
undo_redo->add_do_method(this, "_update_actions");
undo_redo->add_undo_method(this, "_update_actions");
@@ -272,6 +311,20 @@ void ProjectSettingsEditor::_device_input_add() {
_show_last_added(ie, name);
}
+void ProjectSettingsEditor::_set_current_device(int i_device) {
+ device_id->select(i_device + 1);
+}
+
+int ProjectSettingsEditor::_get_current_device() {
+ return device_id->get_selected() - 1;
+}
+
+String ProjectSettingsEditor::_get_device_string(int i_device) {
+ if (i_device == InputMap::ALL_DEVICES)
+ return TTR("All Devices");
+ return TTR("Device") + " " + itos(i_device);
+}
+
void ProjectSettingsEditor::_press_a_key_confirm() {
if (last_wait_for_key.is_null())
@@ -288,12 +341,13 @@ void ProjectSettingsEditor::_press_a_key_confirm() {
String name = add_at;
int idx = edit_idx;
- Array old_val = ProjectSettings::get_singleton()->get(name);
- Array arr = old_val.duplicate();
+ Dictionary old_val = ProjectSettings::get_singleton()->get(name);
+ Dictionary action = old_val.duplicate();
+ Array events = action["events"];
- for (int i = 0; i < arr.size(); i++) {
+ for (int i = 0; i < events.size(); i++) {
- Ref<InputEventKey> aie = arr[i];
+ Ref<InputEventKey> aie = events[i];
if (aie.is_null())
continue;
if (aie->get_scancode_with_modifiers() == ie->get_scancode_with_modifiers()) {
@@ -301,14 +355,15 @@ void ProjectSettingsEditor::_press_a_key_confirm() {
}
}
- if (idx < 0 || idx >= arr.size()) {
- arr.push_back(ie);
+ if (idx < 0 || idx >= events.size()) {
+ events.push_back(ie);
} else {
- arr[idx] = ie;
+ events[idx] = ie;
}
+ action["events"] = events;
undo_redo->create_action(TTR("Add Input Action Event"));
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, arr);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, action);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val);
undo_redo->add_do_method(this, "_update_actions");
undo_redo->add_undo_method(this, "_update_actions");
@@ -382,10 +437,11 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
case INPUT_KEY: {
- press_a_key_label->set_text(TTR("Press a Key.."));
+ press_a_key_label->set_text(TTR("Press a Key..."));
last_wait_for_key = Ref<InputEvent>();
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
press_a_key->grab_focus();
+
} break;
case INPUT_MOUSE_BUTTON: {
@@ -405,12 +461,13 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
Ref<InputEventMouseButton> mb = p_exiting_event;
if (mb.is_valid()) {
device_index->select(mb->get_button_index() - 1);
- device_id->set_value(mb->get_device());
+ _set_current_device(mb->get_device());
device_input->get_ok()->set_text(TTR("Change"));
} else {
- device_id->set_value(0);
+ _set_current_device(0);
device_input->get_ok()->set_text(TTR("Add"));
}
+
} break;
case INPUT_JOY_MOTION: {
@@ -426,12 +483,13 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
Ref<InputEventJoypadMotion> jm = p_exiting_event;
if (jm.is_valid()) {
device_index->select(jm->get_axis() * 2 + (jm->get_axis_value() > 0 ? 1 : 0));
- device_id->set_value(jm->get_device());
+ _set_current_device(jm->get_device());
device_input->get_ok()->set_text(TTR("Change"));
} else {
- device_id->set_value(0);
+ _set_current_device(0);
device_input->get_ok()->set_text(TTR("Add"));
}
+
} break;
case INPUT_JOY_BUTTON: {
@@ -447,10 +505,10 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
Ref<InputEventJoypadButton> jb = p_exiting_event;
if (jb.is_valid()) {
device_index->select(jb->get_button_index());
- device_id->set_value(jb->get_device());
+ _set_current_device(jb->get_device());
device_input->get_ok()->set_text(TTR("Change"));
} else {
- device_id->set_value(0);
+ _set_current_device(0);
device_input->get_ok()->set_text(TTR("Add"));
}
@@ -490,18 +548,17 @@ void ProjectSettingsEditor::_action_activated() {
String name = "input/" + ti->get_parent()->get_text(0);
int idx = ti->get_metadata(0);
- Array va = ProjectSettings::get_singleton()->get(name);
-
- ERR_FAIL_INDEX(idx, va.size());
+ Dictionary action = ProjectSettings::get_singleton()->get(name);
+ Array events = action["events"];
- Ref<InputEvent> ie = va[idx];
-
- if (ie.is_null())
+ ERR_FAIL_INDEX(idx, events.size());
+ Ref<InputEvent> event = events[idx];
+ if (event.is_null())
return;
add_at = name;
edit_idx = idx;
- _edit_item(ie);
+ _edit_item(event);
}
void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column, int p_id) {
@@ -511,6 +568,7 @@ void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column,
ERR_FAIL_COND(!ti);
if (p_id == 1) {
+ // Add action event
Point2 ofs = input_editor->get_global_position();
Rect2 ir = input_editor->get_item_rect(ti);
ir.position.y -= input_editor->get_scroll().y;
@@ -522,14 +580,12 @@ void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column,
edit_idx = -1;
} else if (p_id == 2) {
- //remove
+ // Remove
if (ti->get_parent() == input_editor->get_root()) {
-
- //remove main thing
-
+ // Remove action
String name = "input/" + ti->get_text(0);
- Variant old_val = ProjectSettings::get_singleton()->get(name);
+ Dictionary old_val = ProjectSettings::get_singleton()->get(name);
int order = ProjectSettings::get_singleton()->get_order(name);
undo_redo->create_action(TTR("Erase Input Action"));
@@ -543,24 +599,19 @@ void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column,
undo_redo->commit_action();
} else {
- //remove action
+ // Remove action event
String name = "input/" + ti->get_parent()->get_text(0);
- Variant old_val = ProjectSettings::get_singleton()->get(name);
+ Dictionary old_val = ProjectSettings::get_singleton()->get(name);
+ Dictionary action = old_val.duplicate();
int idx = ti->get_metadata(0);
- Array va = old_val;
-
- ERR_FAIL_INDEX(idx, va.size());
-
- for (int i = idx; i < va.size() - 1; i++) {
-
- va[i] = va[i + 1];
- }
-
- va.resize(va.size() - 1);
+ Array events = action["events"];
+ ERR_FAIL_INDEX(idx, events.size());
+ events.remove(idx);
+ action["events"] = events;
undo_redo->create_action(TTR("Erase Input Action Event"));
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, va);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, action);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val);
undo_redo->add_do_method(this, "_update_actions");
undo_redo->add_undo_method(this, "_update_actions");
@@ -569,30 +620,31 @@ void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column,
undo_redo->commit_action();
}
} else if (p_id == 3) {
- //edit
+ // Edit
if (ti->get_parent() == input_editor->get_root()) {
-
+ // Edit action name
ti->set_as_cursor(0);
input_editor->edit_selected();
} else {
- //edit action
+ // Edit action event
String name = "input/" + ti->get_parent()->get_text(0);
int idx = ti->get_metadata(0);
- Array va = ProjectSettings::get_singleton()->get(name);
+ Dictionary action = ProjectSettings::get_singleton()->get(name);
- ERR_FAIL_INDEX(idx, va.size());
+ Array events = action["events"];
+ ERR_FAIL_INDEX(idx, events.size());
- Ref<InputEvent> ie = va[idx];
+ Ref<InputEvent> event = events[idx];
- if (ie.is_null())
+ if (event.is_null())
return;
ti->set_as_cursor(0);
add_at = name;
edit_idx = idx;
- _edit_item(ie);
+ _edit_item(event);
}
}
}
@@ -619,26 +671,34 @@ void ProjectSettingsEditor::_update_actions() {
if (name == "")
continue;
+ Dictionary action = ProjectSettings::get_singleton()->get(pi.name);
+ Array events = action["events"];
+
TreeItem *item = input_editor->create_item(root);
item->set_text(0, name);
- item->add_button(0, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
- if (!ProjectSettings::get_singleton()->get_input_presets().find(pi.name)) {
- item->add_button(0, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
- item->set_editable(0, true);
- }
item->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
- Array actions = ProjectSettings::get_singleton()->get(pi.name);
+ item->set_editable(1, true);
+ item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
+ item->set_range_config(1, 0.0, 1.0, 0.01);
+ item->set_range(1, action["deadzone"]);
+ item->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
- for (int i = 0; i < actions.size(); i++) {
+ item->add_button(2, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
+ if (!ProjectSettings::get_singleton()->get_input_presets().find(pi.name)) {
+ item->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
+ item->set_editable(2, true);
+ }
+
+ for (int i = 0; i < events.size(); i++) {
- Ref<InputEvent> ie = actions[i];
- if (ie.is_null())
+ Ref<InputEvent> event = events[i];
+ if (event.is_null())
continue;
TreeItem *action = input_editor->create_item(item);
- Ref<InputEventKey> k = ie;
+ Ref<InputEventKey> k = event;
if (k.is_valid()) {
String str = keycode_get_string(k->get_scancode()).capitalize();
@@ -655,11 +715,11 @@ void ProjectSettingsEditor::_update_actions() {
action->set_icon(0, get_icon("Keyboard", "EditorIcons"));
}
- Ref<InputEventJoypadButton> jb = ie;
+ Ref<InputEventJoypadButton> jb = event;
if (jb.is_valid()) {
- String str = TTR("Device") + " " + itos(jb->get_device()) + ", " + TTR("Button") + " " + itos(jb->get_button_index());
+ String str = _get_device_string(jb->get_device()) + ", " + TTR("Button") + " " + itos(jb->get_button_index());
if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_BUTTON_MAX)
str += String() + " (" + _button_names[jb->get_button_index()] + ").";
else
@@ -669,10 +729,10 @@ void ProjectSettingsEditor::_update_actions() {
action->set_icon(0, get_icon("JoyButton", "EditorIcons"));
}
- Ref<InputEventMouseButton> mb = ie;
+ Ref<InputEventMouseButton> mb = event;
if (mb.is_valid()) {
- String str = TTR("Device") + " " + itos(mb->get_device()) + ", ";
+ String str = _get_device_string(mb->get_device()) + ", ";
switch (mb->get_button_index()) {
case BUTTON_LEFT: str += TTR("Left Button."); break;
case BUTTON_RIGHT: str += TTR("Right Button."); break;
@@ -686,21 +746,22 @@ void ProjectSettingsEditor::_update_actions() {
action->set_icon(0, get_icon("Mouse", "EditorIcons"));
}
- Ref<InputEventJoypadMotion> jm = ie;
+ Ref<InputEventJoypadMotion> jm = event;
if (jm.is_valid()) {
int ax = jm->get_axis();
int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1);
String desc = _axis_names[n];
- String str = TTR("Device") + " " + itos(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc + ".";
+ String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc + ".";
action->set_text(0, str);
action->set_icon(0, get_icon("JoyAxis", "EditorIcons"));
}
- action->add_button(0, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit"));
- action->add_button(0, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
action->set_metadata(0, i);
- action->set_meta("__input", ie);
+ action->set_meta("__input", event);
+
+ action->add_button(2, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit"));
+ action->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
}
}
@@ -713,7 +774,14 @@ void ProjectSettingsEditor::popup_project_settings() {
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/project_settings_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds"));
} else {
- popup_centered_ratio();
+
+ Size2 popup_size = Size2(900, 700) * editor_get_scale();
+ Size2 window_size = get_viewport_rect().size;
+
+ popup_size.x = MIN(window_size.x * 0.8, popup_size.x);
+ popup_size.y = MIN(window_size.y * 0.8, popup_size.y);
+
+ popup_centered(popup_size);
}
globals_editor->update_category_list();
_update_translations();
@@ -723,7 +791,7 @@ void ProjectSettingsEditor::popup_project_settings() {
void ProjectSettingsEditor::_item_selected() {
- TreeItem *ti = globals_editor->get_property_editor()->get_scene_tree()->get_selected();
+ TreeItem *ti = globals_editor->get_property_editor()->get_property_tree()->get_selected();
if (!ti)
return;
if (!ti->get_parent())
@@ -830,9 +898,9 @@ void ProjectSettingsEditor::_action_check(String p_action) {
action_add->set_disabled(true);
} else {
- if (p_action.find("/") != -1 || p_action.find(":") != -1) {
+ if (!_validate_action_name(p_action)) {
- action_add_error->set_text(TTR("Can't contain '/' or ':'"));
+ action_add_error->set_text(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'."));
action_add_error->show();
action_add->set_disabled(true);
return;
@@ -860,10 +928,12 @@ void ProjectSettingsEditor::_action_adds(String) {
void ProjectSettingsEditor::_action_add() {
- Array va;
+ Dictionary action;
+ action["events"] = Array();
+ action["deadzone"] = 0.5f;
String name = "input/" + action_name->get_text();
undo_redo->create_action(TTR("Add Input Action"));
- undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, va);
+ undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, action);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name);
undo_redo->add_do_method(this, "_update_actions");
undo_redo->add_undo_method(this, "_update_actions");
@@ -1663,7 +1733,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
//globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
globals_editor->register_search_box(search_box);
- globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected", this, "_item_selected");
+ globals_editor->get_property_editor()->get_property_tree()->connect("cell_selected", this, "_item_selected");
globals_editor->get_property_editor()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited");
@@ -1675,7 +1745,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
add_prop_bar->add_child(memnew(VSeparator));
popup_copy_to_feature = memnew(MenuButton);
- popup_copy_to_feature->set_text(TTR("Override For.."));
+ popup_copy_to_feature->set_text(TTR("Override For..."));
popup_copy_to_feature->set_disabled(true);
add_prop_bar->add_child(popup_copy_to_feature);
@@ -1726,6 +1796,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
input_editor = memnew(Tree);
vbc->add_child(input_editor);
input_editor->set_v_size_flags(SIZE_EXPAND_FILL);
+ input_editor->set_columns(3);
+ input_editor->set_column_titles_visible(true);
+ input_editor->set_column_title(0, TTR("Action"));
+ input_editor->set_column_title(1, TTR("Deadzone"));
+ input_editor->set_column_expand(1, false);
+ input_editor->set_column_min_width(1, 80);
+ input_editor->set_column_expand(2, false);
+ input_editor->set_column_min_width(2, 50);
input_editor->connect("item_edited", this, "_action_edited");
input_editor->connect("item_activated", this, "_action_activated");
input_editor->connect("cell_selected", this, "_action_selected");
@@ -1739,7 +1817,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
add_child(press_a_key);
l = memnew(Label);
- l->set_text(TTR("Press a Key.."));
+ l->set_text(TTR("Press a Key..."));
l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
l->set_margin(MARGIN_TOP, 20);
@@ -1764,8 +1842,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
l->set_text(TTR("Device:"));
vbc_left->add_child(l);
- device_id = memnew(SpinBox);
- device_id->set_value(0);
+ device_id = memnew(OptionButton);
+ for (int i = -1; i < 8; i++)
+ device_id->add_item(_get_device_string(i));
+ _set_current_device(0);
vbc_left->add_child(device_id);
VBoxContainer *vbc_right = memnew(VBoxContainer);
@@ -1800,7 +1880,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tvb->add_child(thb);
thb->add_child(memnew(Label(TTR("Translations:"))));
thb->add_spacer();
- Button *addtr = memnew(Button(TTR("Add..")));
+ Button *addtr = memnew(Button(TTR("Add...")));
addtr->connect("pressed", this, "_translation_file_open");
thb->add_child(addtr);
VBoxContainer *tmc = memnew(VBoxContainer);
@@ -1824,7 +1904,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tvb->add_child(thb);
thb->add_child(memnew(Label(TTR("Resources:"))));
thb->add_spacer();
- Button *addtr = memnew(Button(TTR("Add..")));
+ Button *addtr = memnew(Button(TTR("Add...")));
addtr->connect("pressed", this, "_translation_res_file_open");
thb->add_child(addtr);
VBoxContainer *tmc = memnew(VBoxContainer);
@@ -1845,7 +1925,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tvb->add_child(thb);
thb->add_child(memnew(Label(TTR("Remaps by Locale:"))));
thb->add_spacer();
- addtr = memnew(Button(TTR("Add..")));
+ addtr = memnew(Button(TTR("Add...")));
addtr->connect("pressed", this, "_translation_res_option_file_open");
translation_res_option_add_button = addtr;
thb->add_child(addtr);
@@ -1905,7 +1985,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tab_container->add_child(plugin_settings);
timer = memnew(Timer);
- timer->set_wait_time(1.5);
+ timer->set_wait_time(0.1);
timer->connect("timeout", ProjectSettings::get_singleton(), "save");
timer->set_one_shot(true);
add_child(timer);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 9364b0ff2c..0ced88d7f6 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -80,7 +80,7 @@ class ProjectSettingsEditor : public AcceptDialog {
ConfirmationDialog *press_a_key;
Label *press_a_key_label;
ConfirmationDialog *device_input;
- SpinBox *device_id;
+ OptionButton *device_id;
OptionButton *device_index;
Label *device_index_label;
MenuButton *popup_copy_to_feature;
@@ -170,6 +170,10 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+ int _get_current_device();
+ void _set_current_device(int i_device);
+ String _get_device_string(int i_device);
+
public:
void add_translation(const String &p_translation);
static ProjectSettingsEditor *get_singleton() { return singleton; }
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 043add046e..7f46844f6c 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -285,6 +285,11 @@ void CustomPropertyEditor::_menu_option(int p_which) {
}
Object *obj = ClassDB::instance(intype);
+
+ if (!obj) {
+ obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
+ }
+
ERR_BREAK(!obj);
Resource *res = Object::cast_to<Resource>(obj);
ERR_BREAK(!res);
@@ -481,7 +486,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -3 * EDSCALE);
type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -25 * EDSCALE);
type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -7 * EDSCALE);
- type_button->set_text(TTR("Preset.."));
+ type_button->set_text(TTR("Preset..."));
type_button->get_popup()->clear();
type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR);
type_button->get_popup()->add_item(TTR("Ease In"), EASING_EASE_IN);
@@ -525,14 +530,14 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
if (hint == PROPERTY_HINT_FILE || hint == PROPERTY_HINT_GLOBAL_FILE) {
List<String> names;
- names.push_back(TTR("File.."));
+ names.push_back(TTR("File..."));
names.push_back(TTR("Clear"));
config_action_buttons(names);
} else if (hint == PROPERTY_HINT_DIR || hint == PROPERTY_HINT_GLOBAL_DIR) {
List<String> names;
- names.push_back(TTR("Dir.."));
+ names.push_back(TTR("Dir..."));
names.push_back(TTR("Clear"));
config_action_buttons(names);
} else if (hint == PROPERTY_HINT_ENUM) {
@@ -842,6 +847,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
if (!color_picker) {
//late init for performance
color_picker = memnew(ColorPicker);
+ color_picker->set_deferred_mode(true);
add_child(color_picker);
color_picker->hide();
color_picker->connect("color_changed", this, "_color_changed");
@@ -877,6 +883,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
} else if (hint_text != "") {
int idx = 0;
+ Vector<EditorData::CustomType> custom_resources;
+
+ if (EditorNode::get_editor_data().get_custom_types().has("Resource")) {
+ custom_resources = EditorNode::get_editor_data().get_custom_types()["Resource"];
+ }
+
for (int i = 0; i < hint_text.get_slice_count(","); i++) {
String base = hint_text.get_slice(",", i);
@@ -885,6 +897,11 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
valid_inheritors.insert(base);
List<StringName> inheritors;
ClassDB::get_inheriters_from_class(base.strip_edges(), &inheritors);
+
+ for (int i = 0; i < custom_resources.size(); i++) {
+ inheritors.push_back(custom_resources[i].name);
+ }
+
List<StringName>::Element *E = inheritors.front();
while (E) {
valid_inheritors.insert(E->get());
@@ -893,14 +910,34 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
for (Set<String>::Element *E = valid_inheritors.front(); E; E = E->next()) {
String t = E->get();
- if (!ClassDB::can_instance(t))
+
+ bool is_custom_resource = false;
+ Ref<Texture> icon;
+ if (!custom_resources.empty()) {
+ for (int i = 0; i < custom_resources.size(); i++) {
+ if (custom_resources[i].name == t) {
+ is_custom_resource = true;
+ if (custom_resources[i].icon.is_valid())
+ icon = custom_resources[i].icon;
+ break;
+ }
+ }
+ }
+
+ if (!is_custom_resource && !ClassDB::can_instance(t))
continue;
+
inheritors_array.push_back(t);
int id = TYPE_BASE_ID + idx;
- if (has_icon(t, "EditorIcons")) {
- menu->add_icon_item(get_icon(t, "EditorIcons"), vformat(TTR("New %s"), t), id);
+ if (!icon.is_valid() && has_icon(t, "EditorIcons")) {
+ icon = get_icon(t, "EditorIcons");
+ }
+
+ if (icon.is_valid()) {
+
+ menu->add_icon_item(icon, vformat(TTR("New %s"), t), id);
} else {
menu->add_item(vformat(TTR("New %s"), t), id);
@@ -1094,6 +1131,10 @@ void CustomPropertyEditor::_type_create_selected(int p_idx) {
Object *obj = ClassDB::instance(intype);
+ if (!obj) {
+ obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
+ }
+
ERR_FAIL_COND(!obj);
Resource *res = Object::cast_to<Resource>(obj);
@@ -1291,6 +1332,11 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
if (hint == PROPERTY_HINT_RESOURCE_TYPE) {
Object *obj = ClassDB::instance(intype);
+
+ if (!obj) {
+ obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
+ }
+
ERR_BREAK(!obj);
Resource *res = Object::cast_to<Resource>(obj);
ERR_BREAK(!res);
@@ -3228,22 +3274,34 @@ void PropertyEditor::update_tree() {
while (hint.begins_with(itos(Variant::ARRAY) + ":")) {
type_name += "<Array";
type_name_suffix += ">";
- hint = hint.substr(2, hint.size() - 2);
+ hint = hint.right(2);
}
if (hint.find(":") >= 0) {
- hint = hint.substr(0, hint.find(":"));
+ int colon_pos = hint.find(":");
+ String hint_string = hint.right(colon_pos + 1);
+ hint = hint.left(colon_pos);
+
+ PropertyHint property_hint = PROPERTY_HINT_NONE;
+
if (hint.find("/") >= 0) {
- hint = hint.substr(0, hint.find("/"));
+ int slash_pos = hint.find("/");
+ property_hint = PropertyHint(hint.right(slash_pos + 1).to_int());
+ hint = hint.left(slash_pos);
+ }
+
+ if (property_hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ type_name += "<" + hint_string;
+ } else {
+ type_name += "<" + Variant::get_type_name(Variant::Type(hint.to_int()));
}
- type_name += "<" + Variant::get_type_name(Variant::Type(hint.to_int()));
type_name_suffix += ">";
}
type_name += type_name_suffix;
if (v.is_array())
- item->set_text(1, type_name + "[" + itos(v.call("size")) + "]");
+ item->set_text(1, type_name + "(" + itos(v.call("size")) + ")");
else
- item->set_text(1, type_name + "[]");
+ item->set_text(1, type_name + "()");
if (show_type_icons)
item->set_icon(0, get_icon("PoolByteArray", "EditorIcons"));
@@ -3939,7 +3997,7 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
if (_might_be_in_instance() && _get_instanced_node_original_property(prop, vorig)) {
- _edit_set(prop, vorig);
+ _edit_set(prop, vorig.duplicate(true)); // Set, making sure to duplicate arrays properly
return;
}
@@ -4155,7 +4213,7 @@ void PropertyEditor::_bind_methods() {
ADD_SIGNAL(MethodInfo("property_edited", PropertyInfo(Variant::STRING, "property")));
}
-Tree *PropertyEditor::get_scene_tree() {
+Tree *PropertyEditor::get_property_tree() {
return tree;
}
@@ -4638,7 +4696,7 @@ SectionedPropertyEditor::SectionedPropertyEditor() {
editor->set_v_size_flags(SIZE_EXPAND_FILL);
right_vb->add_child(editor, true);
- editor->get_scene_tree()->set_column_titles_visible(false);
+ editor->get_property_tree()->set_column_titles_visible(false);
editor->hide_top_label();
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 017a190adb..56743822d2 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -275,7 +275,7 @@ public:
String get_selected_path() const;
- Tree *get_scene_tree();
+ Tree *get_property_tree();
Label *get_top_label();
void hide_top_label();
void update_tree();
@@ -309,6 +309,7 @@ public:
void collapse_all_folding();
void expand_all_folding();
+
PropertyEditor();
~PropertyEditor();
};
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 3e95064ead..d927e07976 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -120,33 +120,33 @@ void PropertySelector::_update_search() {
bool found = false;
Ref<Texture> type_icons[Variant::VARIANT_MAX] = {
- Control::get_icon("MiniVariant", "EditorIcons"),
- Control::get_icon("MiniBoolean", "EditorIcons"),
- Control::get_icon("MiniInteger", "EditorIcons"),
- Control::get_icon("MiniFloat", "EditorIcons"),
- Control::get_icon("MiniString", "EditorIcons"),
- Control::get_icon("MiniVector2", "EditorIcons"),
- Control::get_icon("MiniRect2", "EditorIcons"),
- Control::get_icon("MiniVector3", "EditorIcons"),
- Control::get_icon("MiniMatrix2", "EditorIcons"),
- Control::get_icon("MiniPlane", "EditorIcons"),
- Control::get_icon("MiniQuat", "EditorIcons"),
- Control::get_icon("MiniAabb", "EditorIcons"),
- Control::get_icon("MiniMatrix3", "EditorIcons"),
- Control::get_icon("MiniTransform", "EditorIcons"),
- Control::get_icon("MiniColor", "EditorIcons"),
- Control::get_icon("MiniPath", "EditorIcons"),
- Control::get_icon("MiniRid", "EditorIcons"),
- Control::get_icon("MiniObject", "EditorIcons"),
- Control::get_icon("MiniDictionary", "EditorIcons"),
- Control::get_icon("MiniArray", "EditorIcons"),
- Control::get_icon("MiniRawArray", "EditorIcons"),
- Control::get_icon("MiniIntArray", "EditorIcons"),
- Control::get_icon("MiniFloatArray", "EditorIcons"),
- Control::get_icon("MiniStringArray", "EditorIcons"),
- Control::get_icon("MiniVector2Array", "EditorIcons"),
- Control::get_icon("MiniVector3Array", "EditorIcons"),
- Control::get_icon("MiniColorArray", "EditorIcons")
+ Control::get_icon("Variant", "EditorIcons"),
+ Control::get_icon("bool", "EditorIcons"),
+ Control::get_icon("int", "EditorIcons"),
+ Control::get_icon("float", "EditorIcons"),
+ Control::get_icon("String", "EditorIcons"),
+ Control::get_icon("Vector2", "EditorIcons"),
+ Control::get_icon("Rect2", "EditorIcons"),
+ Control::get_icon("Vector3", "EditorIcons"),
+ Control::get_icon("Transform2D", "EditorIcons"),
+ Control::get_icon("Plane", "EditorIcons"),
+ Control::get_icon("Quat", "EditorIcons"),
+ Control::get_icon("AABB", "EditorIcons"),
+ Control::get_icon("Basis", "EditorIcons"),
+ Control::get_icon("Transform", "EditorIcons"),
+ Control::get_icon("Color", "EditorIcons"),
+ Control::get_icon("Path", "EditorIcons"),
+ Control::get_icon("RID", "EditorIcons"),
+ Control::get_icon("Object", "EditorIcons"),
+ Control::get_icon("Dictionary", "EditorIcons"),
+ Control::get_icon("Array", "EditorIcons"),
+ Control::get_icon("PoolByteArray", "EditorIcons"),
+ Control::get_icon("PoolIntArray", "EditorIcons"),
+ Control::get_icon("PoolRealArray", "EditorIcons"),
+ Control::get_icon("PoolStringArray", "EditorIcons"),
+ Control::get_icon("PoolVector2Array", "EditorIcons"),
+ Control::get_icon("PoolVector3Array", "EditorIcons"),
+ Control::get_icon("PoolColorArray", "EditorIcons")
};
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
@@ -175,6 +175,10 @@ void PropertySelector::_update_search() {
if (search_box->get_text() != String() && E->get().name.find(search_box->get_text()) == -1)
continue;
+
+ if (type_filter.size() && type_filter.find(E->get().type) == -1)
+ continue;
+
TreeItem *item = search_options->create_item(category ? category : root);
item->set_text(0, E->get().name);
item->set_metadata(0, E->get().name);
@@ -534,6 +538,10 @@ void PropertySelector::select_property_from_instance(Object *p_instance, const S
_update_search();
}
+void PropertySelector::set_type_filter(const Vector<Variant::Type> &p_type_filter) {
+ type_filter = p_type_filter;
+}
+
void PropertySelector::_bind_methods() {
ClassDB::bind_method(D_METHOD("_text_changed"), &PropertySelector::_text_changed);
diff --git a/editor/property_selector.h b/editor/property_selector.h
index d9b1aee422..f5b34d210e 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -60,6 +60,8 @@ class PropertySelector : public ConfirmationDialog {
void _item_selected();
+ Vector<Variant::Type> type_filter;
+
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -75,6 +77,8 @@ public:
void select_property_from_basic_type(Variant::Type p_type, const String &p_current = "");
void select_property_from_instance(Object *p_instance, const String &p_current = "");
+ void set_type_filter(const Vector<Variant::Type> &p_type_filter);
+
PropertySelector();
};
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
new file mode 100644
index 0000000000..d617089142
--- /dev/null
+++ b/editor/rename_dialog.cpp
@@ -0,0 +1,691 @@
+/*************************************************************************/
+/* rename_dialog.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "rename_dialog.h"
+
+#include "editor_node.h"
+#include "editor_settings.h"
+#include "editor_themes.h"
+#include "modules/regex/regex.h"
+#include "plugins/script_editor_plugin.h"
+#include "print_string.h"
+#include "scene/gui/control.h"
+#include "scene/gui/label.h"
+#include "scene/gui/tab_container.h"
+
+RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {
+
+ scene_tree_editor = p_scene_tree_editor;
+ undo_redo = p_undo_redo;
+ preview_node = NULL;
+
+ set_title(TTR("Batch Rename"));
+
+ VBoxContainer *vbc = memnew(VBoxContainer);
+ add_child(vbc);
+
+ // -- Search/Replace Area
+
+ GridContainer *grd_main = memnew(GridContainer);
+ grd_main->set_columns(2);
+ grd_main->set_v_size_flags(SIZE_EXPAND_FILL);
+ vbc->add_child(grd_main);
+
+ // ---- 1st & 2nd row
+
+ Label *lbl_search = memnew(Label);
+ lbl_search->set_text(TTR("Search"));
+
+ lne_search = memnew(LineEdit);
+ lne_search->set_placeholder(TTR("Search"));
+ lne_search->set_name("lne_search");
+ lne_search->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *lbl_replace = memnew(Label);
+ lbl_replace->set_text(TTR("Replace"));
+
+ lne_replace = memnew(LineEdit);
+ lne_replace->set_placeholder(TTR("Replace"));
+ lne_replace->set_name("lne_replace");
+ lne_replace->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ grd_main->add_child(lbl_search);
+ grd_main->add_child(lbl_replace);
+ grd_main->add_child(lne_search);
+ grd_main->add_child(lne_replace);
+
+ // ---- 3rd & 4th row
+
+ Label *lbl_prefix = memnew(Label);
+ lbl_prefix->set_text(TTR("Prefix"));
+
+ lne_prefix = memnew(LineEdit);
+ lne_prefix->set_placeholder(TTR("Prefix"));
+ lne_prefix->set_name("lne_prefix");
+ lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ Label *lbl_suffix = memnew(Label);
+ lbl_suffix->set_text(TTR("Suffix"));
+
+ lne_suffix = memnew(LineEdit);
+ lne_suffix->set_placeholder(TTR("Suffix"));
+ lne_suffix->set_name("lne_suffix");
+ lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL);
+
+ grd_main->add_child(lbl_prefix);
+ grd_main->add_child(lbl_suffix);
+ grd_main->add_child(lne_prefix);
+ grd_main->add_child(lne_suffix);
+
+ // -- Feature Tabs
+
+ const int feature_min_height = 160;
+
+ Ref<Theme> collapse_theme = create_editor_theme();
+ collapse_theme->set_icon("checked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
+ collapse_theme->set_icon("unchecked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
+
+ CheckBox *chk_collapse_features = memnew(CheckBox);
+ chk_collapse_features->set_text(TTR("Advanced options"));
+ chk_collapse_features->set_theme(collapse_theme);
+ chk_collapse_features->set_focus_mode(FOCUS_NONE);
+ vbc->add_child(chk_collapse_features);
+
+ tabc_features = memnew(TabContainer);
+ tabc_features->set_tab_align(TabContainer::ALIGN_LEFT);
+ vbc->add_child(tabc_features);
+
+ // ---- Tab Substitute
+
+ VBoxContainer *vbc_substitute = memnew(VBoxContainer);
+ vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL);
+ vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height));
+
+ vbc_substitute->set_name(TTR("Substitute"));
+ tabc_features->add_child(vbc_substitute);
+
+ cbut_substitute = memnew(CheckButton);
+ cbut_substitute->set_text(TTR("Substitute"));
+ vbc_substitute->add_child(cbut_substitute);
+
+ GridContainer *grd_substitute = memnew(GridContainer);
+ grd_substitute->set_columns(3);
+ vbc_substitute->add_child(grd_substitute);
+
+ // Name
+
+ but_insert_name = memnew(Button);
+ but_insert_name->set_text("NAME");
+ but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name"));
+ but_insert_name->set_focus_mode(FOCUS_NONE);
+ but_insert_name->connect("pressed", this, "_insert_text", make_binds("${NAME}"));
+ but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL);
+ grd_substitute->add_child(but_insert_name);
+
+ // Parent
+
+ but_insert_parent = memnew(Button);
+ but_insert_parent->set_text("PARENT");
+ but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available"));
+ but_insert_parent->set_focus_mode(FOCUS_NONE);
+ but_insert_parent->connect("pressed", this, "_insert_text", make_binds("${PARENT}"));
+ but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL);
+ grd_substitute->add_child(but_insert_parent);
+
+ // Type
+
+ but_insert_type = memnew(Button);
+ but_insert_type->set_text("TYPE");
+ but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type"));
+ but_insert_type->set_focus_mode(FOCUS_NONE);
+ but_insert_type->connect("pressed", this, "_insert_text", make_binds("${TYPE}"));
+ but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL);
+ grd_substitute->add_child(but_insert_type);
+
+ // Scene
+
+ but_insert_scene = memnew(Button);
+ but_insert_scene->set_text("SCENE");
+ but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name"));
+ but_insert_scene->set_focus_mode(FOCUS_NONE);
+ but_insert_scene->connect("pressed", this, "_insert_text", make_binds("${SCENE}"));
+ but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL);
+ grd_substitute->add_child(but_insert_scene);
+
+ // Root
+
+ but_insert_root = memnew(Button);
+ but_insert_root->set_text("ROOT");
+ but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name"));
+ but_insert_root->set_focus_mode(FOCUS_NONE);
+ but_insert_root->connect("pressed", this, "_insert_text", make_binds("${ROOT}"));
+ but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL);
+ grd_substitute->add_child(but_insert_root);
+
+ // Count
+
+ but_insert_count = memnew(Button);
+ but_insert_count->set_text("COUNTER");
+ but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options."));
+ but_insert_count->set_focus_mode(FOCUS_NONE);
+ but_insert_count->connect("pressed", this, "_insert_text", make_binds("${COUNTER}"));
+ but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL);
+ grd_substitute->add_child(but_insert_count);
+
+ chk_per_level_counter = memnew(CheckBox);
+ chk_per_level_counter->set_text(TTR("Per Level counter"));
+ chk_per_level_counter->set_tooltip(TTR("If set the counter restarts for each group of child nodes"));
+ vbc_substitute->add_child(chk_per_level_counter);
+
+ HBoxContainer *hbc_count_options = memnew(HBoxContainer);
+ vbc_substitute->add_child(hbc_count_options);
+
+ Label *lbl_count_start = memnew(Label);
+ lbl_count_start->set_text(TTR("Start"));
+ lbl_count_start->set_tooltip(TTR("Initial value for the counter"));
+ hbc_count_options->add_child(lbl_count_start);
+
+ spn_count_start = memnew(SpinBox);
+ spn_count_start->set_tooltip(TTR("Initial value for the counter"));
+ spn_count_start->set_step(1);
+ spn_count_start->set_min(0);
+ hbc_count_options->add_child(spn_count_start);
+
+ Label *lbl_count_step = memnew(Label);
+ lbl_count_step->set_text(TTR("Step"));
+ lbl_count_step->set_tooltip(TTR("Ammount by which counter is incremented for each node"));
+ hbc_count_options->add_child(lbl_count_step);
+
+ spn_count_step = memnew(SpinBox);
+ spn_count_step->set_tooltip(TTR("Ammount by which counter is incremented for each node"));
+ spn_count_step->set_step(1);
+ hbc_count_options->add_child(spn_count_step);
+
+ Label *lbl_count_padding = memnew(Label);
+ lbl_count_padding->set_text(TTR("Padding"));
+ lbl_count_padding->set_tooltip(TTR("Minium number of digits for the counter.\nMissing digits are padded with leading zeros."));
+ hbc_count_options->add_child(lbl_count_padding);
+
+ spn_count_padding = memnew(SpinBox);
+ spn_count_padding->set_tooltip(TTR("Minium number of digits for the counter.\nMissing digits are padded with leading zeros."));
+ spn_count_padding->set_step(1);
+ hbc_count_options->add_child(spn_count_padding);
+
+ // ---- Tab RegEx
+
+ VBoxContainer *vbc_regex = memnew(VBoxContainer);
+ vbc_regex->set_h_size_flags(SIZE_EXPAND_FILL);
+ vbc_regex->set_name(TTR("Regular Expressions"));
+ vbc_regex->set_custom_minimum_size(Size2(0, feature_min_height));
+ tabc_features->add_child(vbc_regex);
+
+ cbut_regex = memnew(CheckButton);
+ cbut_regex->set_text(TTR("Regular Expressions"));
+ vbc_regex->add_child(cbut_regex);
+
+ // ---- Tab Process
+
+ VBoxContainer *vbc_process = memnew(VBoxContainer);
+ vbc_process->set_h_size_flags(SIZE_EXPAND_FILL);
+ vbc_process->set_name(TTR("Post-Process"));
+ vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
+ tabc_features->add_child(vbc_process);
+
+ cbut_process = memnew(CheckButton);
+ cbut_process->set_text(TTR("Post-Process"));
+ vbc_process->add_child(cbut_process);
+
+ // ------ Style
+
+ HBoxContainer *hbc_style = memnew(HBoxContainer);
+ vbc_process->add_child(hbc_style);
+
+ Label *lbl_style = memnew(Label);
+ lbl_style->set_text(TTR("Style"));
+ hbc_style->add_child(lbl_style);
+
+ opt_style = memnew(OptionButton);
+ opt_style->add_item(TTR("Keep"));
+ opt_style->add_item(TTR("CamelCase to under_scored"));
+ opt_style->add_item(TTR("under_scored to CamelCase"));
+ hbc_style->add_child(opt_style);
+
+ // ------ Case
+
+ HBoxContainer *hbc_case = memnew(HBoxContainer);
+ vbc_process->add_child(hbc_case);
+
+ Label *lbl_case = memnew(Label);
+ lbl_case->set_text(TTR("Case"));
+ hbc_case->add_child(lbl_case);
+
+ opt_case = memnew(OptionButton);
+ opt_case->add_item(TTR("Keep"));
+ opt_case->add_item(TTR("To Lowercase"));
+ opt_case->add_item(TTR("To Uppercase"));
+ hbc_case->add_child(opt_case);
+
+ // -- Preview
+
+ HSeparator *sep_preview = memnew(HSeparator);
+ sep_preview->set_custom_minimum_size(Size2(10, 20));
+ vbc->add_child(sep_preview);
+
+ lbl_preview_title = memnew(Label);
+ lbl_preview_title->set_text(TTR("Preview"));
+ vbc->add_child(lbl_preview_title);
+
+ lbl_preview = memnew(Label);
+ lbl_preview->set_text("");
+ lbl_preview->add_color_override("font_color", Color(1, 0.5f, 0, 1));
+ vbc->add_child(lbl_preview);
+
+ // ---- Dialog related
+
+ set_custom_minimum_size(Size2(383, 0));
+ set_as_toplevel(true);
+ get_ok()->set_text(TTR("Rename"));
+ Button *but_reset = add_button(TTR("Reset"));
+
+ eh.errfunc = _error_handler;
+ eh.userdata = this;
+
+ // ---- Connections
+
+ chk_collapse_features->connect("toggled", this, "_features_toggled");
+
+ // Substitite Buttons
+
+ lne_search->connect("focus_entered", this, "_update_substitute");
+ lne_search->connect("focus_exited", this, "_update_substitute");
+ lne_replace->connect("focus_entered", this, "_update_substitute");
+ lne_replace->connect("focus_exited", this, "_update_substitute");
+ lne_prefix->connect("focus_entered", this, "_update_substitute");
+ lne_prefix->connect("focus_exited", this, "_update_substitute");
+ lne_suffix->connect("focus_entered", this, "_update_substitute");
+ lne_suffix->connect("focus_exited", this, "_update_substitute");
+
+ // Preview
+
+ lne_prefix->connect("text_changed", this, "_update_preview");
+ lne_suffix->connect("text_changed", this, "_update_preview");
+ lne_search->connect("text_changed", this, "_update_preview");
+ lne_replace->connect("text_changed", this, "_update_preview");
+ spn_count_start->connect("value_changed", this, "_update_preview_int");
+ spn_count_step->connect("value_changed", this, "_update_preview_int");
+ spn_count_padding->connect("value_changed", this, "_update_preview_int");
+ opt_style->connect("item_selected", this, "_update_preview_int");
+ opt_case->connect("item_selected", this, "_update_preview_int");
+ cbut_substitute->connect("pressed", this, "_update_preview", varray(""));
+ cbut_regex->connect("pressed", this, "_update_preview", varray(""));
+ cbut_process->connect("pressed", this, "_update_preview", varray(""));
+
+ but_reset->connect("pressed", this, "reset");
+
+ reset();
+ _features_toggled(false);
+}
+
+void RenameDialog::_bind_methods() {
+
+ ClassDB::bind_method("_features_toggled", &RenameDialog::_features_toggled);
+ ClassDB::bind_method("_update_preview", &RenameDialog::_update_preview);
+ ClassDB::bind_method("_update_preview_int", &RenameDialog::_update_preview_int);
+ ClassDB::bind_method("_insert_text", &RenameDialog::_insert_text);
+ ClassDB::bind_method("_update_substitute", &RenameDialog::_update_substitute);
+ ClassDB::bind_method("reset", &RenameDialog::reset);
+ ClassDB::bind_method("rename", &RenameDialog::rename);
+}
+
+void RenameDialog::_update_substitute() {
+
+ LineEdit *focus_owner_line_edit = Object::cast_to<LineEdit>(get_focus_owner());
+ bool is_main_field = _is_main_field(focus_owner_line_edit);
+
+ but_insert_name->set_disabled(!is_main_field);
+ but_insert_parent->set_disabled(!is_main_field);
+ but_insert_type->set_disabled(!is_main_field);
+ but_insert_scene->set_disabled(!is_main_field);
+ but_insert_root->set_disabled(!is_main_field);
+ but_insert_count->set_disabled(!is_main_field);
+
+ // The focus mode seems to be reset when disabling/re-enabling
+ but_insert_name->set_focus_mode(FOCUS_NONE);
+ but_insert_parent->set_focus_mode(FOCUS_NONE);
+ but_insert_type->set_focus_mode(FOCUS_NONE);
+ but_insert_scene->set_focus_mode(FOCUS_NONE);
+ but_insert_root->set_focus_mode(FOCUS_NONE);
+ but_insert_count->set_focus_mode(FOCUS_NONE);
+}
+
+void RenameDialog::_post_popup() {
+
+ EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
+ preview_node = NULL;
+
+ Array selected_node_list = editor_selection->get_selected_nodes();
+ ERR_FAIL_COND(selected_node_list.size() == 0);
+
+ preview_node = selected_node_list[0];
+
+ _update_preview();
+ _update_substitute();
+}
+
+void RenameDialog::_update_preview_int(int new_value) {
+ _update_preview();
+}
+
+void RenameDialog::_update_preview(String new_text) {
+
+ if (lock_preview_update || preview_node == NULL)
+ return;
+
+ has_errors = false;
+ add_error_handler(&eh);
+
+ String new_name = _apply_rename(preview_node, spn_count_start->get_value());
+
+ if (!has_errors) {
+
+ lbl_preview_title->set_text(TTR("Preview"));
+ lbl_preview->set_text(new_name);
+
+ if (new_name == preview_node->get_name()) {
+ lbl_preview->add_color_override("font_color", Color(0, 0.5f, 0.25f, 1));
+ } else {
+ lbl_preview->add_color_override("font_color", Color(0, 1, 0.5f, 1));
+ }
+ }
+
+ remove_error_handler(&eh);
+}
+
+String RenameDialog::_apply_rename(const Node *node, int count) {
+
+ String search = lne_search->get_text();
+ String replace = lne_replace->get_text();
+ String prefix = lne_prefix->get_text();
+ String suffix = lne_suffix->get_text();
+ String new_name = node->get_name();
+
+ if (cbut_substitute->is_pressed()) {
+ search = _substitute(search, node, count);
+ replace = _substitute(replace, node, count);
+ prefix = _substitute(prefix, node, count);
+ suffix = _substitute(suffix, node, count);
+ }
+
+ if (cbut_regex->is_pressed()) {
+
+ new_name = _regex(search, new_name, replace);
+ } else {
+ new_name = new_name.replace(search, replace);
+ }
+
+ new_name = prefix + new_name + suffix;
+
+ if (cbut_process->is_pressed()) {
+ new_name = _postprocess(new_name);
+ }
+
+ return new_name;
+}
+
+String RenameDialog::_substitute(const String &subject, const Node *node, int count) {
+
+ String result = subject.replace("${COUNTER}", vformat("%0" + itos(spn_count_padding->get_value()) + "d", count));
+
+ if (node) {
+ result = result.replace("${NAME}", node->get_name());
+ result = result.replace("${TYPE}", node->get_class());
+ }
+
+ int current = EditorNode::get_singleton()->get_editor_data().get_edited_scene();
+ result = result.replace("${SCENE}", EditorNode::get_singleton()->get_editor_data().get_scene_title(current));
+
+ Node *root_node = SceneTree::get_singleton()->get_edited_scene_root();
+ if (root_node) {
+ result = result.replace("${ROOT}", root_node->get_name());
+ }
+
+ Node *parent_node = node->get_parent();
+ if (parent_node) {
+ if (node == root_node) {
+ // Can not substitute parent of root.
+ result = result.replace("${PARENT}", "");
+ } else {
+ result = result.replace("${PARENT}", parent_node->get_name());
+ }
+ }
+
+ return result;
+}
+
+void RenameDialog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type) {
+
+ RenameDialog *self = (RenameDialog *)p_self;
+ String source_file(p_file);
+
+ // Only show first error that is related to "regex"
+ if (self->has_errors || source_file.find("regex") < 0)
+ return;
+
+ String err_str;
+ if (p_errorexp && p_errorexp[0]) {
+ err_str = p_errorexp;
+ } else {
+ err_str = p_error;
+ }
+
+ self->has_errors = true;
+ self->lbl_preview_title->set_text(TTR("Error"));
+ self->lbl_preview->add_color_override("font_color", Color(1, 0.25f, 0, 1));
+ self->lbl_preview->set_text(err_str);
+}
+
+String RenameDialog::_regex(const String &pattern, const String &subject, const String &replacement) {
+
+ RegEx regex(pattern);
+
+ return regex.sub(subject, replacement, true);
+}
+
+String RenameDialog::_postprocess(const String &subject) {
+
+ int style_id = opt_style->get_selected();
+
+ String result = subject;
+
+ if (style_id == 1) {
+
+ // CamelCase to Under_Line
+ result = result.camelcase_to_underscore(true);
+ result = _regex("_+", result, "_");
+
+ } else if (style_id == 2) {
+
+ // Under_Line to CamelCase
+ RegEx pattern("_+(.?)");
+ Array matches = pattern.search_all(result);
+
+ // _ name would become empty. Ignore
+ if (matches.size() && result != "_") {
+ String buffer;
+ int start = 0;
+ int end = 0;
+ for (int i = 0; i < matches.size(); ++i) {
+ start = ((Ref<RegExMatch>)matches[i])->get_start(1);
+ buffer += result.substr(end, start - end - 1);
+ buffer += result.substr(start, 1).to_upper();
+ end = start + 1;
+ }
+ buffer += result.substr(end, result.size() - (end + 1));
+ result = buffer.replace("_", "").capitalize();
+ }
+ }
+
+ int case_id = opt_case->get_selected();
+
+ if (case_id == 1) {
+ // To Lowercase
+ result = result.to_lower();
+ } else if (case_id == 2) {
+ // To Upercase
+ result = result.to_upper();
+ }
+
+ return result;
+}
+
+void RenameDialog::_iterate_scene(const Node *node, const Array &selection, int *counter) {
+
+ if (!node)
+ return;
+
+ if (selection.has(node)) {
+
+ String new_name = _apply_rename(node, *counter);
+
+ if (node->get_name() != new_name) {
+ Pair<NodePath, String> rename_item;
+ rename_item.first = node->get_path();
+ rename_item.second = new_name;
+ to_rename.push_back(rename_item);
+ }
+
+ *counter += spn_count_step->get_value();
+ }
+
+ int *cur_counter = counter;
+ int level_counter = spn_count_start->get_value();
+
+ if (chk_per_level_counter->is_pressed()) {
+ cur_counter = &level_counter;
+ }
+
+ for (int i = 0; i < node->get_child_count(); ++i) {
+ _iterate_scene(node->get_child(i), selection, cur_counter);
+ }
+}
+
+void RenameDialog::rename() {
+
+ // Editor selection is not ordered via scene tree. Instead iterate
+ // over scene tree until all selected nodes are found in order.
+
+ EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
+ Array selected_node_list = editor_selection->get_selected_nodes();
+ Node *root_node = SceneTree::get_singleton()->get_edited_scene_root();
+
+ global_count = spn_count_start->get_value();
+ to_rename.clear();
+
+ // Forward recursive as opposed to the actual renaming.
+ _iterate_scene(root_node, selected_node_list, &global_count);
+
+ if (undo_redo && !to_rename.empty()) {
+
+ undo_redo->create_action(TTR("Batch Rename"));
+
+ // Make sure to iterate reversed so that child nodes will find parents.
+ for (int i = to_rename.size() - 1; i >= 0; --i) {
+
+ Node *n = root_node->get_node(to_rename[i].first);
+ const String &new_name = to_rename[i].second;
+
+ if (!n) {
+ ERR_PRINTS("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames());
+ continue;
+ }
+
+ scene_tree_editor->emit_signal("node_prerename", n, new_name);
+ undo_redo->add_do_method(scene_tree_editor, "_rename_node", n->get_instance_id(), new_name);
+ undo_redo->add_undo_method(scene_tree_editor, "_rename_node", n->get_instance_id(), n->get_name());
+ }
+
+ undo_redo->commit_action();
+ }
+}
+
+void RenameDialog::reset() {
+
+ lock_preview_update = true;
+
+ lne_prefix->clear();
+ lne_suffix->clear();
+ lne_search->clear();
+ lne_replace->clear();
+
+ cbut_substitute->set_pressed(false);
+ cbut_regex->set_pressed(false);
+ cbut_process->set_pressed(false);
+
+ chk_per_level_counter->set_pressed(true);
+
+ spn_count_start->set_value(1);
+ spn_count_step->set_value(1);
+ spn_count_padding->set_value(1);
+
+ opt_style->select(0);
+ opt_case->select(0);
+
+ lock_preview_update = false;
+ _update_preview();
+}
+
+bool RenameDialog::_is_main_field(LineEdit *line_edit) {
+ return line_edit &&
+ (line_edit == lne_search || line_edit == lne_replace || line_edit == lne_prefix || line_edit == lne_suffix);
+}
+
+void RenameDialog::_insert_text(String text) {
+
+ LineEdit *focus_owner = Object::cast_to<LineEdit>(get_focus_owner());
+
+ if (_is_main_field(focus_owner)) {
+ focus_owner->selection_delete();
+ focus_owner->append_at_cursor(text);
+ _update_preview();
+ }
+}
+
+void RenameDialog::_features_toggled(bool pressed) {
+ if (pressed) {
+ tabc_features->show();
+ } else {
+ tabc_features->hide();
+ }
+
+ // Adjust to minimum size in y
+ Size2i size = get_size();
+ size.y = 0;
+ set_size(size);
+}
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
new file mode 100644
index 0000000000..c5ebc30c0c
--- /dev/null
+++ b/editor/rename_dialog.h
@@ -0,0 +1,119 @@
+/*************************************************************************/
+/* rename_dialog.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef RENAME_DIALOG_H
+#define RENAME_DIALOG_H
+
+#include "scene/gui/check_box.h"
+#include "scene/gui/check_button.h"
+#include "scene/gui/dialogs.h"
+#include "scene/gui/option_button.h"
+#include "scene/gui/spin_box.h"
+
+#include "editor/scene_tree_editor.h"
+#include "undo_redo.h"
+
+/**
+@author Blazej Floch
+*/
+
+class RenameDialog : public ConfirmationDialog {
+
+ GDCLASS(RenameDialog, ConfirmationDialog);
+
+ virtual void ok_pressed() { rename(); };
+ void _cancel_pressed(){};
+ void _features_toggled(bool pressed);
+ void _insert_text(String text);
+ void _update_substitute();
+ bool _is_main_field(LineEdit *line_edit);
+
+ void _iterate_scene(const Node *node, const Array &selection, int *count);
+ String _apply_rename(const Node *node, int count);
+ String _substitute(const String &subject, const Node *node, int count);
+ String _regex(const String &pattern, const String &subject, const String &replacement);
+ String _postprocess(const String &subject);
+ void _update_preview(String new_text = "");
+ void _update_preview_int(int new_value = 0);
+ static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type);
+
+ SceneTreeEditor *scene_tree_editor;
+ UndoRedo *undo_redo;
+ int global_count;
+
+ LineEdit *lne_search;
+ LineEdit *lne_replace;
+ LineEdit *lne_prefix;
+ LineEdit *lne_suffix;
+
+ TabContainer *tabc_features;
+
+ CheckButton *cbut_substitute;
+ CheckButton *cbut_regex;
+ CheckButton *cbut_process;
+ CheckBox *chk_per_level_counter;
+
+ Button *but_insert_name;
+ Button *but_insert_parent;
+ Button *but_insert_type;
+ Button *but_insert_scene;
+ Button *but_insert_root;
+ Button *but_insert_count;
+
+ SpinBox *spn_count_start;
+ SpinBox *spn_count_step;
+ SpinBox *spn_count_padding;
+
+ OptionButton *opt_style;
+ OptionButton *opt_case;
+
+ Label *lbl_preview_title;
+ Label *lbl_preview;
+
+ List<Pair<NodePath, String> > to_rename;
+ Node *preview_node;
+ bool lock_preview_update;
+ ErrorHandlerList eh;
+ bool has_errors;
+
+protected:
+ void _notification(int p_what){};
+ static void _bind_methods();
+ virtual void _post_popup();
+
+public:
+ void reset();
+ void rename();
+
+ RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo = NULL);
+ ~RenameDialog(){};
+};
+
+#endif
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 9f0f62592b..77ee65879b 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -33,7 +33,7 @@
#include "core/io/resource_saver.h"
#include "core/os/keyboard.h"
#include "core/project_settings.h"
-#include "editor/animation_editor.h"
+
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
#include "editor/multi_node_edit.h"
@@ -73,7 +73,11 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
if (!p_event->is_pressed() || p_event->is_echo())
return;
- if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
+ if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
+ _tool_selected(TOOL_BATCH_RENAME);
+ } else if (ED_IS_SHORTCUT("scene_tree/rename", p_event)) {
+ _tool_selected(TOOL_RENAME);
+ } else if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
_tool_selected(TOOL_NEW);
} else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) {
_tool_selected(TOOL_INSTANCE);
@@ -107,7 +111,12 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
void SceneTreeDock::instance(const String &p_file) {
Node *parent = scene_tree->get_selected();
- if (!parent || !edited_scene) {
+
+ if (!parent) {
+ parent = edited_scene;
+ };
+
+ if (!edited_scene) {
current_option = -1;
accept->get_ok()->set_text(TTR("OK :("));
@@ -280,6 +289,19 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
switch (p_tool) {
+ case TOOL_BATCH_RENAME: {
+ Tree *tree = scene_tree->get_scene_tree();
+ if (tree->is_anything_selected()) {
+ rename_dialog->popup_centered();
+ }
+ } break;
+ case TOOL_RENAME: {
+ Tree *tree = scene_tree->get_scene_tree();
+ if (tree->is_anything_selected()) {
+ tree->grab_focus();
+ tree->edit_selected();
+ }
+ } break;
case TOOL_NEW: {
String preferred = "";
@@ -345,17 +367,30 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_CLEAR_SCRIPT: {
- Node *selected = scene_tree->get_selected();
- if (!selected)
- break;
- Ref<Script> existing = selected->get_script();
- if (existing.is_valid()) {
- const RefPtr empty;
- selected->set_script(empty);
- _update_script_button();
+ List<Node *> selection = editor_selection->get_selected_node_list();
+
+ if (selection.empty())
+ return;
+
+ editor_data->get_undo_redo().create_action(TTR("Clear Script"));
+ editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)NULL);
+
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+
+ Ref<Script> existing = E->get()->get_script();
+ if (existing.is_valid()) {
+ const RefPtr empty;
+ editor_data->get_undo_redo().add_do_method(E->get(), "set_script", empty);
+ editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing);
+ }
}
+ editor_data->get_undo_redo().add_do_method(this, "_update_script_button");
+ editor_data->get_undo_redo().add_undo_method(this, "_update_script_button");
+
+ editor_data->get_undo_redo().commit_action();
+
} break;
case TOOL_MOVE_UP:
case TOOL_MOVE_DOWN: {
@@ -366,7 +401,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (scene_tree->get_selected() == edited_scene) {
current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
break;
@@ -427,7 +462,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (editor_selection->is_selected(edited_scene)) {
current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
break;
@@ -497,7 +532,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (editor_selection->is_selected(edited_scene)) {
current_option = -1;
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
break;
@@ -558,7 +593,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *scene = editor_data->get_edited_scene_root();
if (!scene) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation can't be done without a scene."));
accept->popup_centered_minsize();
break;
@@ -567,7 +602,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.size() != 1) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation requires a single selected node."));
accept->popup_centered_minsize();
break;
@@ -576,14 +611,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *tocopy = selection.front()->get();
if (tocopy == scene) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("Can not perform with the root node."));
accept->popup_centered_minsize();
break;
}
if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_filename() != "") {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation can't be done on instanced scenes."));
accept->popup_centered_minsize();
break;
@@ -607,7 +642,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
new_scene_from_dialog->set_current_path(existing);
new_scene_from_dialog->popup_centered_ratio();
- new_scene_from_dialog->set_title(TTR("Save New Scene As.."));
+ new_scene_from_dialog->set_title(TTR("Save New Scene As..."));
} break;
case TOOL_COPY_NODE_PATH: {
List<Node *> selection = editor_selection->get_selected_node_list();
@@ -706,7 +741,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (node) {
node->set_scene_inherited_state(Ref<SceneState>());
scene_tree->update_tree();
- EditorNode::get_singleton()->get_property_editor()->update_tree();
+ EditorNode::get_singleton()->get_inspector()->update_tree();
}
}
} break;
@@ -903,9 +938,6 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP
if (!r_rem_anims)
r_rem_anims = &rem_anims;
- if (!bool(EDITOR_DEF("editors/animation/autorename_animation_tracks", true)))
- return;
-
if (!p_base) {
p_base = edited_scene;
@@ -914,7 +946,54 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP
if (!p_base)
return;
- if (Object::cast_to<AnimationPlayer>(p_base)) {
+ // Renaming node paths used in script instances
+ if (p_base->get_script_instance()) {
+
+ ScriptInstance *si = p_base->get_script_instance();
+
+ if (si) {
+
+ List<PropertyInfo> properties;
+ si->get_property_list(&properties);
+
+ for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
+
+ String propertyname = E->get().name;
+ Variant p = p_base->get(propertyname);
+ if (p.get_type() == Variant::NODE_PATH) {
+
+ // Goes through all paths to check if its matching
+ for (List<Pair<NodePath, NodePath> >::Element *E = p_renames->front(); E; E = E->next()) {
+
+ NodePath root_path = p_base->get_path();
+
+ NodePath rel_path_old = root_path.rel_path_to(E->get().first);
+
+ NodePath rel_path_new = E->get().second;
+
+ // if not empty, get new relative path
+ if (E->get().second != NodePath()) {
+ rel_path_new = root_path.rel_path_to(E->get().second);
+ }
+
+ // if old path detected, then it needs to be replaced with the new one
+ if (p == rel_path_old) {
+
+ editor_data->get_undo_redo().add_do_property(p_base, propertyname, rel_path_new);
+ editor_data->get_undo_redo().add_undo_property(p_base, propertyname, rel_path_old);
+
+ p_base->set(propertyname, rel_path_new);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bool autorename_animation_tracks = bool(EDITOR_DEF("editors/animation/autorename_animation_tracks", true));
+
+ if (autorename_animation_tracks && Object::cast_to<AnimationPlayer>(p_base)) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_base);
List<StringName> anims;
@@ -1145,8 +1224,31 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
editor_data->get_undo_redo().add_do_method(new_parent, "move_child", node, p_position_in_parent + inc);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
+ String old_name = former_names[ni];
String new_name = new_parent->validate_child_name(node);
- editor_data->get_undo_redo().add_do_method(sed, "live_debug_reparent_node", edited_scene->get_path_to(node), edited_scene->get_path_to(new_parent), new_name, -1);
+
+ // name was modified, fix the path renames
+ if (old_name.casecmp_to(new_name) != 0) {
+
+ // Fix the to name to have the new name
+ NodePath old_new_name = path_renames[ni].second;
+ NodePath new_path;
+
+ Vector<StringName> unfixed_new_names = old_new_name.get_names();
+ Vector<StringName> fixed_new_names;
+
+ // Get last name and replace with fixed new name
+ for (int a = 0; a < (unfixed_new_names.size() - 1); a++) {
+ fixed_new_names.push_back(unfixed_new_names[a]);
+ }
+ fixed_new_names.push_back(new_name);
+
+ NodePath fixed_node_path = NodePath(fixed_new_names, true);
+
+ path_renames[ni].second = fixed_node_path;
+ }
+
+ editor_data->get_undo_redo().add_do_method(sed, "live_debug_reparent_node", edited_scene->get_path_to(node), edited_scene->get_path_to(new_parent), new_name, p_position_in_parent + inc);
editor_data->get_undo_redo().add_undo_method(sed, "live_debug_reparent_node", NodePath(String(edited_scene->get_path_to(new_parent)) + "/" + new_name), edited_scene->get_path_to(node->get_parent()), node->get_name(), node->get_index());
if (p_keep_global_xform) {
@@ -1160,8 +1262,8 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
editor_data->get_undo_redo().add_do_method(this, "_set_owners", edited_scene, owners);
- if (AnimationPlayerEditor::singleton->get_key_editor()->get_root() == node)
- editor_data->get_undo_redo().add_do_method(AnimationPlayerEditor::singleton->get_key_editor(), "set_root", node);
+ if (AnimationPlayerEditor::singleton->get_track_editor()->get_root() == node)
+ editor_data->get_undo_redo().add_do_method(AnimationPlayerEditor::singleton->get_track_editor(), "set_root", node);
editor_data->get_undo_redo().add_undo_method(new_parent, "remove_child", node);
editor_data->get_undo_redo().add_undo_method(node, "set_name", former_names[ni]);
@@ -1188,8 +1290,8 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node);
editor_data->get_undo_redo().add_undo_method(node->get_parent(), "move_child", node, child_pos);
editor_data->get_undo_redo().add_undo_method(this, "_set_owners", edited_scene, owners);
- if (AnimationPlayerEditor::singleton->get_key_editor()->get_root() == node)
- editor_data->get_undo_redo().add_undo_method(AnimationPlayerEditor::singleton->get_key_editor(), "set_root", node);
+ if (AnimationPlayerEditor::singleton->get_track_editor()->get_root() == node)
+ editor_data->get_undo_redo().add_undo_method(AnimationPlayerEditor::singleton->get_track_editor(), "set_root", node);
if (p_keep_global_xform) {
if (Object::cast_to<Node2D>(node))
@@ -1208,12 +1310,26 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
void SceneTreeDock::_script_created(Ref<Script> p_script) {
- Node *selected = scene_tree->get_selected();
- if (!selected)
+ List<Node *> selected = editor_selection->get_selected_node_list();
+
+ if (selected.empty())
return;
- selected->set_script(p_script.get_ref_ptr());
- editor->push_item(p_script.operator->());
- _update_script_button();
+
+ editor_data->get_undo_redo().create_action(TTR("Attach Script"));
+ for (List<Node *>::Element *E = selected.front(); E; E = E->next()) {
+
+ Ref<Script> existing = E->get()->get_script();
+ editor_data->get_undo_redo().add_do_method(E->get(), "set_script", p_script.get_ref_ptr());
+ editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing);
+ }
+
+ editor_data->get_undo_redo().add_do_method(editor, "push_item", p_script.operator->());
+ editor_data->get_undo_redo().add_undo_method(editor, "push_item", (Script *)NULL);
+
+ editor_data->get_undo_redo().add_do_method(this, "_update_script_button");
+ editor_data->get_undo_redo().add_undo_method(this, "_update_script_button");
+
+ editor_data->get_undo_redo().commit_action();
}
void SceneTreeDock::_delete_confirm() {
@@ -1276,8 +1392,8 @@ void SceneTreeDock::_delete_confirm() {
editor_data->get_undo_redo().add_do_method(n->get_parent(), "remove_child", n);
editor_data->get_undo_redo().add_undo_method(n->get_parent(), "add_child", n);
editor_data->get_undo_redo().add_undo_method(n->get_parent(), "move_child", n, n->get_index());
- if (AnimationPlayerEditor::singleton->get_key_editor()->get_root() == n)
- editor_data->get_undo_redo().add_undo_method(AnimationPlayerEditor::singleton->get_key_editor(), "set_root", n);
+ if (AnimationPlayerEditor::singleton->get_track_editor()->get_root() == n)
+ editor_data->get_undo_redo().add_undo_method(AnimationPlayerEditor::singleton->get_track_editor(), "set_root", n);
editor_data->get_undo_redo().add_undo_method(this, "_set_owners", edited_scene, owners);
editor_data->get_undo_redo().add_undo_reference(n);
@@ -1411,6 +1527,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node) {
Node *n = p_node;
Node *newnode = p_by_node;
+ Node *default_oldnode = Object::cast_to<Node>(ClassDB::instance(n->get_class()));
List<PropertyInfo> pinfo;
n->get_property_list(&pinfo);
@@ -1419,8 +1536,11 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node) {
continue;
if (E->get().name == "__meta__")
continue;
- newnode->set(E->get().name, n->get(E->get().name));
+ if (default_oldnode->get(E->get().name) != n->get(E->get().name)) {
+ newnode->set(E->get().name, n->get(E->get().name));
+ }
}
+ memdelete(default_oldnode);
editor->push_item(NULL);
@@ -1508,7 +1628,7 @@ void SceneTreeDock::_new_scene_from(String p_file) {
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.size() != 1) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("This operation requires a single selected node."));
accept->popup_centered_minsize();
return;
@@ -1526,7 +1646,7 @@ void SceneTreeDock::_new_scene_from(String p_file) {
memdelete(copy);
if (err != OK) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("Couldn't save new scene. Likely dependencies (instances) couldn't be satisfied."));
accept->popup_centered_minsize();
return;
@@ -1538,14 +1658,14 @@ void SceneTreeDock::_new_scene_from(String p_file) {
err = ResourceSaver::save(p_file, sdata, flg);
if (err != OK) {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("Error saving scene."));
accept->popup_centered_minsize();
return;
}
_replace_with_branch_scene(p_file, base);
} else {
- accept->get_ok()->set_text(TTR("I see.."));
+ accept->get_ok()->set_text(TTR("I see..."));
accept->set_text(TTR("Error duplicating scene to save it."));
accept->popup_centered_minsize();
return;
@@ -1665,8 +1785,12 @@ void SceneTreeDock::_script_dropped(String p_file, NodePath p_to) {
ERR_FAIL_COND(!scr.is_valid());
Node *n = get_node(p_to);
if (n) {
- n->set_script(scr.get_ref_ptr());
- _update_script_button();
+ editor_data->get_undo_redo().create_action(TTR("Attach Script"));
+ editor_data->get_undo_redo().add_do_method(n, "set_script", scr);
+ editor_data->get_undo_redo().add_undo_method(n, "set_script", n->get_script());
+ editor_data->get_undo_redo().add_do_method(this, "_update_script_button");
+ editor_data->get_undo_redo().add_undo_method(this, "_update_script_button");
+ editor_data->get_undo_redo().commit_action();
}
}
@@ -1759,6 +1883,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
subresources.clear();
menu_subresources->clear();
+ menu_subresources->set_size(Size2(1, 1));
_add_children_to_popup(selection.front()->get(), 0);
if (menu->get_item_count() > 0)
menu->add_separator();
@@ -1769,6 +1894,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT);
menu->add_separator();
+ menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME);
}
menu->add_icon_shortcut(get_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
menu->add_separator();
@@ -1803,6 +1929,16 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
menu->set_item_checked(menu->get_item_idx_from_text(TTR("Load As Placeholder")), placeholder);
}
}
+ } else {
+ menu->add_separator();
+ menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
+ menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT);
+ }
+
+ if (selection.size() > 1) {
+ //this is not a commonly used action, it makes no sense for it to be where it was nor always present.
+ menu->add_separator();
+ menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
}
menu->add_separator();
menu->add_icon_shortcut(get_icon("Remove", "EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE);
@@ -1921,6 +2057,7 @@ void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_focus_node"), &SceneTreeDock::_focus_node);
ClassDB::bind_method(D_METHOD("_remote_tree_selected"), &SceneTreeDock::_remote_tree_selected);
ClassDB::bind_method(D_METHOD("_local_tree_selected"), &SceneTreeDock::_local_tree_selected);
+ ClassDB::bind_method(D_METHOD("_update_script_button"), &SceneTreeDock::_update_script_button);
ClassDB::bind_method(D_METHOD("instance"), &SceneTreeDock::instance);
@@ -1942,6 +2079,8 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
filter_hbc->add_constant_override("separate", 0);
ToolButton *tb;
+ ED_SHORTCUT("scene_tree/rename", TTR("Rename"));
+ ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_CMD | KEY_F2);
ED_SHORTCUT("scene_tree/add_child_node", TTR("Add Child Node"), KEY_MASK_CMD | KEY_A);
ED_SHORTCUT("scene_tree/instance_scene", TTR("Instance Child Scene"));
ED_SHORTCUT("scene_tree/change_node_type", TTR("Change Type"));
@@ -2040,6 +2179,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
add_child(create_dialog);
create_dialog->connect("create", this, "_create");
+ rename_dialog = memnew(RenameDialog(scene_tree, &editor_data->get_undo_redo()));
+ add_child(rename_dialog);
+
script_create_dialog = memnew(ScriptCreateDialog);
add_child(script_create_dialog);
script_create_dialog->connect("script_created", this, "_script_created");
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index a4f36e31ee..ed13e063bb 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -36,6 +36,7 @@
#include "editor/editor_data.h"
#include "editor/editor_sub_scene.h"
#include "editor/groups_editor.h"
+#include "editor/rename_dialog.h"
#include "editor/reparent_dialog.h"
#include "editor/script_create_dialog.h"
#include "scene/animation/animation_player.h"
@@ -58,6 +59,8 @@ class SceneTreeDock : public VBoxContainer {
TOOL_NEW,
TOOL_INSTANCE,
+ TOOL_RENAME,
+ TOOL_BATCH_RENAME,
TOOL_REPLACE,
TOOL_ATTACH_SCRIPT,
TOOL_CLEAR_SCRIPT,
@@ -90,6 +93,7 @@ class SceneTreeDock : public VBoxContainer {
int current_option;
CreateDialog *create_dialog;
+ RenameDialog *rename_dialog;
ToolButton *button_add;
ToolButton *button_instance;
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 8f3113c816..88d614ab89 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -30,6 +30,7 @@
#include "scene_tree_editor.h"
+#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor_node.h"
#include "message_queue.h"
@@ -70,8 +71,18 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
} else if (p_id == BUTTON_VISIBILITY) {
undo_redo->create_action(TTR("Toggle Visible"));
- undo_redo->add_do_method(this, "toggle_visible", n);
- undo_redo->add_undo_method(this, "toggle_visible", n);
+ _toggle_visible(n);
+ List<Node *> selection = editor_selection->get_selected_node_list();
+ if (selection.size() > 1) {
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Node *nv = E->get();
+ ERR_FAIL_COND(!nv);
+ if (nv == n) {
+ continue;
+ }
+ _toggle_visible(nv);
+ }
+ }
undo_redo->commit_action();
} else if (p_id == BUTTON_LOCK) {
@@ -80,6 +91,12 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
_update_tree();
emit_signal("node_changed");
}
+ } else if (p_id == BUTTON_PIN) {
+
+ if (n->is_class("AnimationPlayer")) {
+ AnimationPlayerEditor::singleton->unpin();
+ _update_tree();
+ }
} else if (p_id == BUTTON_GROUP) {
if (n->is_class("CanvasItem")) {
@@ -118,33 +135,13 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
}
}
void SceneTreeEditor::_toggle_visible(Node *p_node) {
- if (p_node->is_class("Spatial")) {
- bool v = bool(p_node->call("is_visible"));
- p_node->call("set_visible", !v);
- } else if (p_node->is_class("CanvasItem")) {
+ if (p_node->has_method("is_visible") && p_node->has_method("set_visible")) {
bool v = bool(p_node->call("is_visible"));
- if (v) {
- p_node->call("hide");
- } else {
- p_node->call("show");
- }
+ undo_redo->add_do_method(p_node, "set_visible", !v);
+ undo_redo->add_undo_method(p_node, "set_visible", v);
}
}
-void SceneTreeEditor::toggle_visible(Node *p_node) {
- _toggle_visible(p_node);
- List<Node *> selection = editor_selection->get_selected_node_list();
- if (selection.size() > 1) {
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Node *nv = E->get();
- ERR_FAIL_COND(!nv);
- if (nv == p_node) {
- continue;
- }
- _toggle_visible(nv);
- }
- }
-}
bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (!p_node)
@@ -169,6 +166,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
}
TreeItem *item = tree->create_item(p_parent);
+
item->set_text(0, p_node->get_name());
if (can_rename && !part_of_subscene /*(p_node->get_owner() == get_scene_node() || p_node==get_scene_node())*/)
item->set_editable(0, true);
@@ -199,7 +197,9 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (part_of_subscene) {
//item->set_selectable(0,marked_selectable);
- item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
+ if (valid_types.size() == 0) {
+ item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
+ }
} else if (marked.has(p_node)) {
@@ -229,7 +229,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
bool has_groups = p_node->has_persistent_groups();
if (has_connections && has_groups) {
- item->add_button(0, get_icon("SignalsAndGroups", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connection(s) and group(s)\nClick to show signals dock."));
+ item->add_button(0, get_icon("SignalsAndGroups", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connection(s) and group(s).\nClick to show signals dock."));
} else if (has_connections) {
item->add_button(0, get_icon("Signals", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connections.\nClick to show signals dock."));
} else if (has_groups) {
@@ -255,18 +255,18 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (!p_node->get_script().is_null()) {
- item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open script"));
+ item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script"));
}
if (p_node->is_class("CanvasItem")) {
bool is_locked = p_node->has_meta("_edit_lock_"); //_edit_group_
if (is_locked)
- item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock"));
+ item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it."));
bool is_grouped = p_node->has_meta("_edit_group_");
if (is_grouped)
- item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable"));
+ item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable."));
bool v = p_node->call("is_visible");
if (v)
@@ -282,7 +282,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
bool is_locked = p_node->has_meta("_edit_lock_");
if (is_locked)
- item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock"));
+ item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock it."));
bool v = p_node->call("is_visible");
if (v)
@@ -294,6 +294,13 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
p_node->connect("visibility_changed", this, "_node_visibility_changed", varray(p_node));
_update_visibility_color(p_node, item);
+ } else if (p_node->is_class("AnimationPlayer")) {
+
+ bool is_pinned = AnimationPlayerEditor::singleton->get_player() == p_node && AnimationPlayerEditor::singleton->is_pinned();
+
+ if (is_pinned) {
+ item->add_button(0, get_icon("Pin", "EditorIcons"), BUTTON_PIN, false, TTR("AnimationPlayer is pinned.\nClick to unpin."));
+ }
}
}
@@ -319,6 +326,22 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
keep = keep || child_keep;
}
+ if (valid_types.size()) {
+ bool valid = false;
+ for (int i = 0; i < valid_types.size(); i++) {
+ if (p_node->is_class(valid_types[i])) {
+ valid = true;
+ break;
+ }
+ }
+
+ if (!valid) {
+ //item->set_selectable(0,marked_selectable);
+ item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
+ item->set_selectable(0, false);
+ }
+ }
+
if (!keep) {
memdelete(item);
return false;
@@ -550,6 +573,10 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
EditorSettings::get_singleton()->disconnect("settings_changed", this, "_editor_settings_changed");
}
+ if (p_what == NOTIFICATION_THEME_CHANGED) {
+
+ _update_tree();
+ }
}
TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) {
@@ -640,11 +667,12 @@ void SceneTreeEditor::_renamed() {
ERR_FAIL_COND(!n);
String new_name = which->get_text(0);
- if (new_name.find(".") != -1 || new_name.find("/") != -1) {
+ if (!Node::_validate_node_name(new_name)) {
- error->set_text(TTR("Invalid node name, the following characters are not allowed:") + "\n \".\", \"/\"");
+ error->set_text(TTR("Invalid node name, the following characters are not allowed:") + "\n" + Node::invalid_character);
error->popup_centered_minsize();
- new_name = n->get_name();
+
+ which->set_text(0, new_name);
}
if (new_name == n->get_name())
@@ -707,6 +735,10 @@ bool SceneTreeEditor::get_display_foreign_nodes() const {
return display_foreign;
}
+void SceneTreeEditor::set_valid_types(const Vector<StringName> &p_valid) {
+ valid_types = p_valid;
+}
+
void SceneTreeEditor::set_editor_selection(EditorSelection *p_selection) {
editor_selection = p_selection;
@@ -963,8 +995,6 @@ void SceneTreeEditor::_bind_methods() {
ClassDB::bind_method("_cell_collapsed", &SceneTreeEditor::_cell_collapsed);
ClassDB::bind_method("_rmb_select", &SceneTreeEditor::_rmb_select);
ClassDB::bind_method("_warning_changed", &SceneTreeEditor::_warning_changed);
- ClassDB::bind_method("_toggle_visible", &SceneTreeEditor::_toggle_visible);
- ClassDB::bind_method("toggle_visible", &SceneTreeEditor::toggle_visible);
ClassDB::bind_method("_node_script_changed", &SceneTreeEditor::_node_script_changed);
ClassDB::bind_method("_node_visibility_changed", &SceneTreeEditor::_node_visibility_changed);
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index b63eb2a1f0..c4f63f5736 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -55,6 +55,7 @@ class SceneTreeEditor : public Control {
BUTTON_WARNING = 5,
BUTTON_SIGNALS = 6,
BUTTON_GROUPS = 7,
+ BUTTON_PIN = 8,
};
Tree *tree;
@@ -70,8 +71,6 @@ class SceneTreeEditor : public Control {
void _compute_hash(Node *p_node, uint64_t &hash);
- void toggle_visible(Node *p_node);
-
bool _add_nodes(Node *p_node, TreeItem *p_parent);
void _test_update_tree();
void _update_tree();
@@ -132,6 +131,8 @@ class SceneTreeEditor : public Control {
List<StringName> *script_types;
bool _is_script_type(const StringName &p_type) const;
+ Vector<StringName> valid_types;
+
public:
void set_filter(const String &p_filter);
String get_filter() const;
@@ -148,6 +149,7 @@ public:
void set_editor_selection(EditorSelection *p_selection);
void set_show_enabled_subscene(bool p_show) { show_enabled_subscene = p_show; }
+ void set_valid_types(const Vector<StringName> &p_valid);
void update_tree() { _update_tree(); }
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index b893b098ac..57a003060e 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -41,10 +41,12 @@
void ScriptCreateDialog::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
path_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
- }
+ status_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
+ } break;
}
}
@@ -434,6 +436,13 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
return;
}
+ String path_error = ScriptServer::get_language(language_menu->get_selected())->validate_path(p);
+ if (path_error != "") {
+ _msg_path_valid(false, path_error);
+ _update_dialog();
+ return;
+ }
+
/* All checks passed */
is_path_valid = true;
@@ -609,10 +618,10 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb->add_child(path_error_label);
vb->add_child(hb);
- PanelContainer *pc = memnew(PanelContainer);
- pc->set_h_size_flags(Control::SIZE_FILL);
- pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
- pc->add_child(vb);
+ status_panel = memnew(PanelContainer);
+ status_panel->set_h_size_flags(Control::SIZE_FILL);
+ status_panel->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
+ status_panel->add_child(vb);
/* Margins */
@@ -631,7 +640,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
vb->add_child(empty_h->duplicate());
vb->add_child(gc);
vb->add_child(empty_h->duplicate());
- vb->add_child(pc);
+ vb->add_child(status_panel);
vb->add_child(empty_h->duplicate());
hb = memnew(HBoxContainer);
hb->add_child(empty_v->duplicate());
diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h
index 99e5bc9e6a..1ad4a1b7a1 100644
--- a/editor/script_create_dialog.h
+++ b/editor/script_create_dialog.h
@@ -46,6 +46,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
LineEdit *class_name;
Label *error_label;
Label *path_error_label;
+ PanelContainer *status_panel;
LineEdit *parent_name;
Button *parent_browse_button;
OptionButton *language_menu;
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index da3a4ee919..62848a6035 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -46,6 +46,7 @@
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_button.h"
#include "scene/gui/tree.h"
+#include "scene/resources/packed_scene.h"
#include "ustring.h"
class ScriptEditorDebuggerVariables : public Object {
@@ -286,6 +287,30 @@ void ScriptEditorDebugger::_scene_tree_selected() {
ppeer->put_var(msg);
}
+void ScriptEditorDebugger::_scene_tree_rmb_selected(const Vector2 &p_position) {
+
+ TreeItem *item = inspect_scene_tree->get_item_at_position(p_position);
+ if (!item)
+ return;
+
+ item->select(0);
+
+ item_menu->clear();
+ item_menu->add_icon_item(get_icon("CreateNewSceneFrom", "EditorIcons"), TTR("Save Branch as Scene"), ITEM_MENU_SAVE_REMOTE_NODE);
+ item_menu->set_global_position(get_global_mouse_position());
+ item_menu->popup();
+}
+
+void ScriptEditorDebugger::_file_selected(const String &p_file) {
+ if (file_dialog->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
+ Array msg;
+ msg.push_back("save_node");
+ msg.push_back(inspected_object_id);
+ msg.push_back(p_file);
+ ppeer->put_var(msg);
+ }
+}
+
void ScriptEditorDebugger::_scene_tree_property_value_edited(const String &p_prop, const Variant &p_value) {
Array msg;
@@ -710,25 +735,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
error_list->set_item_metadata(error_list->get_item_count() - 1, stack);
error_count++;
- /*
- int count = p_data[1];
-
- Array cstack;
-
- OutputError oe = errors.front()->get();
-
- packet_peer_stream->put_var(oe.hr);
- packet_peer_stream->put_var(oe.min);
- packet_peer_stream->put_var(oe.sec);
- packet_peer_stream->put_var(oe.msec);
- packet_peer_stream->put_var(oe.source_func);
- packet_peer_stream->put_var(oe.source_file);
- packet_peer_stream->put_var(oe.source_line);
- packet_peer_stream->put_var(oe.error);
- packet_peer_stream->put_var(oe.error_descr);
- packet_peer_stream->put_var(oe.warning);
- packet_peer_stream->put_var(oe.callstack);
- */
} else if (p_msg == "profile_sig") {
//cache a signature
@@ -755,6 +761,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
EditorProfiler::Metric::Category::Item item;
item.calls = 1;
item.line = 0;
+
item.name = "Physics Time";
item.total = metric.physics_time;
item.self = item.total;
@@ -792,8 +799,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
for (int i = 0; i < values.size(); i += 2) {
EditorProfiler::Metric::Category::Item item;
- item.name = values[i];
item.calls = 1;
+ item.line = 0;
+ item.name = values[i];
item.self = values[i + 1];
item.total = item.self;
item.signature = "categ::" + name + "::" + item.name;
@@ -864,7 +872,7 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType
reason->add_color_override("font_color", get_color("success_color", "Editor"));
}
reason->set_text(p_reason);
- reason->set_tooltip(p_reason);
+ reason->set_tooltip(p_reason.word_wrap(80));
}
void ScriptEditorDebugger::_performance_select() {
@@ -1160,6 +1168,16 @@ void ScriptEditorDebugger::_notification(int p_what) {
inspect_scene_tree->add_color_override("relationship_line_color", rl_color);
} else
inspect_scene_tree->add_constant_override("draw_relationship_lines", 0);
+
+ copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
+ step->set_icon(get_icon("DebugStep", "EditorIcons"));
+ next->set_icon(get_icon("DebugNext", "EditorIcons"));
+ back->set_icon(get_icon("Back", "EditorIcons"));
+ forward->set_icon(get_icon("Forward", "EditorIcons"));
+ dobreak->set_icon(get_icon("Pause", "EditorIcons"));
+ docontinue->set_icon(get_icon("DebugContinue", "EditorIcons"));
+ vmem_refresh->set_icon(get_icon("Reload", "EditorIcons"));
+
} break;
}
}
@@ -1646,12 +1664,20 @@ void ScriptEditorDebugger::_error_selected(int p_idx) {
md.push_back(st[i + 1]);
md.push_back(st[i + 2]);
- String str = func + " in " + script.get_file() + ":line " + itos(line);
+ String str = func;
+ String tooltip_str = TTR("Function:") + " " + func;
+ if (script.length() > 0) {
+ str += " in " + script.get_file();
+ tooltip_str = TTR("File:") + " " + script + "\n" + tooltip_str;
+ if (line > 0) {
+ str += ":line " + itos(line);
+ tooltip_str += "\n" + TTR("Line:") + " " + itos(line);
+ }
+ }
error_stack->add_item(str);
error_stack->set_item_metadata(error_stack->get_item_count() - 1, md);
- error_stack->set_item_tooltip(error_stack->get_item_count() - 1,
- TTR("File:") + " " + script + "\n" + TTR("Function:") + " " + func + "\n" + TTR("Line:") + " " + itos(line));
+ error_stack->set_item_tooltip(error_stack->get_item_count() - 1, tooltip_str);
}
}
@@ -1753,6 +1779,21 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
OS::get_singleton()->set_clipboard(title + "\n----------\n" + desc);
} break;
+ case ITEM_MENU_SAVE_REMOTE_NODE: {
+
+ file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
+ file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+
+ List<String> extensions;
+ Ref<PackedScene> sd = memnew(PackedScene);
+ ResourceSaver::get_recognized_extensions(sd, &extensions);
+ file_dialog->clear_filters();
+ for (int i = 0; i < extensions.size(); i++) {
+ file_dialog->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
+ }
+
+ file_dialog->popup_centered_ratio();
+ } break;
}
}
@@ -1787,6 +1828,8 @@ void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_scene_tree_selected"), &ScriptEditorDebugger::_scene_tree_selected);
ClassDB::bind_method(D_METHOD("_scene_tree_folded"), &ScriptEditorDebugger::_scene_tree_folded);
+ ClassDB::bind_method(D_METHOD("_scene_tree_rmb_selected"), &ScriptEditorDebugger::_scene_tree_rmb_selected);
+ ClassDB::bind_method(D_METHOD("_file_selected"), &ScriptEditorDebugger::_file_selected);
ClassDB::bind_method(D_METHOD("live_debug_create_node"), &ScriptEditorDebugger::live_debug_create_node);
ClassDB::bind_method(D_METHOD("live_debug_instance_node"), &ScriptEditorDebugger::live_debug_instance_node);
@@ -1808,7 +1851,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
ppeer = Ref<PacketPeerStream>(memnew(PacketPeerStream));
ppeer->set_input_buffer_max_size(1024 * 1024 * 8); //8mb should be enough
editor = p_editor;
- editor->get_property_editor()->connect("object_id_selected", this, "_scene_tree_property_select_object");
+ editor->get_inspector()->connect("object_id_selected", this, "_scene_tree_property_select_object");
tabs = memnew(TabContainer);
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
@@ -1834,6 +1877,9 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
reason->set_text("");
hbc->add_child(reason);
reason->set_h_size_flags(SIZE_EXPAND_FILL);
+ reason->set_autowrap(true);
+ reason->set_max_lines_visible(3);
+ reason->set_mouse_filter(Control::MOUSE_FILTER_PASS);
hbc->add_child(memnew(VSeparator));
@@ -1893,7 +1939,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
inspector = memnew(PropertyEditor);
inspector->set_h_size_flags(SIZE_EXPAND_FILL);
inspector->hide_top_label();
- inspector->get_scene_tree()->set_column_title(0, TTR("Variable"));
+ inspector->get_property_tree()->set_column_title(0, TTR("Variable"));
inspector->set_enable_capitalize_paths(false);
inspector->set_read_only(true);
inspector->connect("object_id_selected", this, "_scene_tree_property_select_object");
@@ -1959,7 +2005,8 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
inspect_scene_tree->set_v_size_flags(SIZE_EXPAND_FILL);
inspect_scene_tree->connect("cell_selected", this, "_scene_tree_selected");
inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded");
-
+ inspect_scene_tree->set_allow_rmb_select(true);
+ inspect_scene_tree->connect("item_rmb_selected", this, "_scene_tree_rmb_selected");
auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false);
inspect_scene_tree_timeout = EDITOR_DEF("debugger/remote_scene_tree_refresh_interval", 1.0);
inspect_edited_object_timeout = EDITOR_DEF("debugger/remote_inspect_refresh_interval", 0.2);
@@ -1967,6 +2014,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
updating_scene_tree = false;
}
+ { // File dialog
+ file_dialog = memnew(EditorFileDialog);
+ file_dialog->connect("file_selected", this, "_file_selected");
+ add_child(file_dialog);
+ }
+
{ //profiler
profiler = memnew(EditorProfiler);
profiler->set_name(TTR("Profiler"));
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index 669d8737fe..f7fe348b65 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -65,6 +65,7 @@ class ScriptEditorDebugger : public Control {
enum ItemMenu {
ITEM_MENU_COPY_ERROR,
+ ITEM_MENU_SAVE_REMOTE_NODE,
};
AcceptDialog *msgdialog;
@@ -92,6 +93,7 @@ class ScriptEditorDebugger : public Control {
Tree *inspect_scene_tree;
Button *clearbutton;
PopupMenu *item_menu;
+ EditorFileDialog *file_dialog;
int error_count;
int last_error_count;
@@ -155,6 +157,8 @@ class ScriptEditorDebugger : public Control {
void _scene_tree_folded(Object *obj);
void _scene_tree_selected();
+ void _scene_tree_rmb_selected(const Vector2 &p_position);
+ void _file_selected(const String &p_file);
void _scene_tree_request();
void _parse_message(const String &p_msg, const Array &p_data);
void _set_reason_text(const String &p_reason, MessageType p_type);
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index d75ef5df8a..45041bcf59 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -61,7 +61,7 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
if (full_name == "text_editor/theme/color_theme") {
property_editor->get_property_editor()->update_tree();
} else if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") {
- EditorSettings::get_singleton()->set_manually("interface/theme/preset", 6); // set preset to Custom
+ EditorSettings::get_singleton()->set_manually("interface/theme/preset", "Custom"); // set preset to Custom
} else if (full_name.begins_with("text_editor/highlighting")) {
EditorSettings::get_singleton()->set_manually("text_editor/theme/color_theme", "Custom");
}
@@ -101,7 +101,14 @@ void EditorSettingsDialog::popup_edit_settings() {
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/editor_settings_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds"));
} else {
- popup_centered_ratio(0.7);
+
+ Size2 popup_size = Size2(900, 700) * editor_get_scale();
+ Size2 window_size = get_viewport_rect().size;
+
+ popup_size.x = MIN(window_size.x * 0.8, popup_size.x);
+ popup_size.y = MIN(window_size.y * 0.8, popup_size.y);
+
+ popup_centered(popup_size);
}
_focus_current_search_box();
@@ -199,6 +206,14 @@ void EditorSettingsDialog::_update_icons() {
void EditorSettingsDialog::_update_shortcuts() {
+ Map<String, bool> collapsed;
+
+ if (shortcuts->get_root() && shortcuts->get_root()->get_children()) {
+ for (TreeItem *item = shortcuts->get_root()->get_children(); item; item = item->get_next()) {
+ collapsed[item->get_text(0)] = item->is_collapsed();
+ }
+ }
+
shortcuts->clear();
List<String> slist;
@@ -223,7 +238,13 @@ void EditorSettingsDialog::_update_shortcuts() {
section = sections[section_name];
} else {
section = shortcuts->create_item(root);
- section->set_text(0, section_name.capitalize());
+
+ String item_name = section_name.capitalize();
+ section->set_text(0, item_name);
+
+ if (collapsed.has(item_name)) {
+ section->set_collapsed(collapsed[item_name]);
+ }
sections[section_name] = section;
section->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
@@ -263,7 +284,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(item);
if (p_idx == 0) {
- press_a_key_label->set_text(TTR("Press a Key.."));
+ press_a_key_label->set_text(TTR("Press a Key..."));
last_wait_for_key = Ref<InputEventKey>();
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
press_a_key->grab_focus();
@@ -457,7 +478,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
add_child(press_a_key);
Label *l = memnew(Label);
- l->set_text(TTR("Press a Key.."));
+ l->set_text(TTR("Press a Key..."));
l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
l->set_margin(MARGIN_TOP, 20);
@@ -472,7 +493,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
//get_cancel()->set_text("Close");
timer = memnew(Timer);
- timer->set_wait_time(1.5);
+ timer->set_wait_time(0.1);
timer->connect("timeout", this, "_settings_save");
timer->set_one_shot(true);
add_child(timer);
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 8c90d86b9e..873420b383 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -201,6 +201,9 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
}
}
+ selectable_icon_size = p_scale;
+ mesh->set_custom_aabb(AABB(Vector3(-selectable_icon_size, -selectable_icon_size, -selectable_icon_size) * 40.0f, Vector3(selectable_icon_size, selectable_icon_size, selectable_icon_size) * 80.0f));
+
ins.mesh = mesh;
ins.unscaled = true;
ins.billboard = true;
@@ -209,13 +212,13 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
}
+ selectable_icon_size = p_scale * 2.0;
+
instances.push_back(ins);
}
-void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const AABB &p_bounds) {
-
+void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh) {
collision_mesh = p_tmesh;
- collision_mesh_bounds = p_bounds;
}
void EditorSpatialGizmo::add_collision_segments(const Vector<Vector3> &p_lines) {
@@ -299,13 +302,24 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi
}
}
-void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size) {
+void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size, Vector3 p_position) {
ERR_FAIL_COND(!spatial_node);
CubeMesh cubem;
cubem.set_size(p_size);
+
+ Array arrays = cubem.surface_get_arrays(0);
+ PoolVector3Array vertex = arrays[VS::ARRAY_VERTEX];
+ PoolVector3Array::Write w = vertex.write();
+
+ for (int i = 0; i < vertex.size(); ++i) {
+ w[i] += p_position;
+ }
+
+ arrays[VS::ARRAY_VERTEX] = vertex;
+
Ref<ArrayMesh> m = memnew(ArrayMesh);
- m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), cubem.surface_get_arrays(0));
+ m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), arrays);
m->surface_set_material(0, p_material);
add_mesh(m);
}
@@ -321,64 +335,74 @@ bool EditorSpatialGizmo::intersect_frustum(const Camera *p_camera, const Vector<
ERR_FAIL_COND_V(!spatial_node, false);
ERR_FAIL_COND_V(!valid, false);
- if (collision_segments.size()) {
+ if (selectable_icon_size > 0.0f) {
+ Vector3 origin = spatial_node->get_global_transform().get_origin();
const Plane *p = p_frustum.ptr();
int fc = p_frustum.size();
- int vc = collision_segments.size();
- const Vector3 *vptr = collision_segments.ptr();
- Transform t = spatial_node->get_global_transform();
+ bool any_out = false;
- for (int i = 0; i < vc / 2; i++) {
+ for (int j = 0; j < fc; j++) {
- Vector3 a = t.xform(vptr[i * 2 + 0]);
- Vector3 b = t.xform(vptr[i * 2 + 1]);
+ if (p[j].is_point_over(origin)) {
+ any_out = true;
+ break;
+ }
+ }
- bool any_out = false;
- for (int j = 0; j < fc; j++) {
+ if (!any_out)
+ return true;
+ return false;
+ }
+
+ if (collision_segments.size()) {
+
+ const Plane *p = p_frustum.ptr();
+ int fc = p_frustum.size();
- if (p[j].distance_to(a) > 0 && p[j].distance_to(b) > 0) {
+ int vc = collision_segments.size();
+ const Vector3 *vptr = collision_segments.ptr();
+ Transform t = spatial_node->get_global_transform();
+ bool any_out = false;
+ for (int j = 0; j < fc; j++) {
+ for (int i = 0; i < vc; i++) {
+ Vector3 v = t.xform(vptr[i]);
+ if (p[j].is_point_over(v)) {
any_out = true;
break;
}
}
-
- if (!any_out)
- return true;
+ if (any_out) break;
}
- return false;
+ if (!any_out) return true;
}
- if (collision_mesh_bounds.size != Vector3(0.0, 0.0, 0.0)) {
+ if (collision_mesh.is_valid()) {
Transform t = spatial_node->get_global_transform();
- const Plane *p = p_frustum.ptr();
- int fc = p_frustum.size();
- Vector3 mins = t.xform(collision_mesh_bounds.get_position());
- Vector3 max = t.xform(collision_mesh_bounds.get_position() + collision_mesh_bounds.get_size());
-
- bool any_out = false;
+ Vector3 mesh_scale = t.get_basis().get_scale();
+ t.orthonormalize();
- for (int j = 0; j < fc; j++) {
+ Transform it = t.affine_inverse();
- if (p[j].distance_to(mins) > 0 || p[j].distance_to(max) > 0) {
+ Vector<Plane> transformed_frustum;
- any_out = true;
- break;
- }
+ for (int i = 0; i < 4; i++) {
+ transformed_frustum.push_back(it.xform(p_frustum[i]));
}
- if (!any_out)
+ if (collision_mesh->inside_convex_shape(transformed_frustum.ptr(), transformed_frustum.size(), mesh_scale)) {
return true;
+ }
}
return false;
}
-bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle, bool p_sec_first) {
+bool EditorSpatialGizmo::intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle, bool p_sec_first) {
ERR_FAIL_COND_V(!spatial_node, false);
ERR_FAIL_COND_V(!valid, false);
@@ -442,6 +466,43 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera, const Point2 &p_p
}
}
+ if (selectable_icon_size > 0.0f) {
+
+ Transform t = spatial_node->get_global_transform();
+ t.orthonormalize();
+ t.set_look_at(t.origin, p_camera->get_camera_transform().origin, Vector3(0, 1, 0));
+
+ float scale = t.origin.distance_to(p_camera->get_camera_transform().origin);
+
+ if (p_camera->get_projection() == Camera::PROJECTION_ORTHOGONAL) {
+ float h = Math::abs(p_camera->get_size());
+ scale = (h * 2.0);
+ }
+
+ Point2 center = p_camera->unproject_position(t.origin);
+
+ Transform oct = p_camera->get_camera_transform();
+
+ p_camera->look_at(t.origin, Vector3(0, 1, 0));
+ Vector3 c0 = t.xform(Vector3(selectable_icon_size, selectable_icon_size, 0) * scale);
+ Vector3 c1 = t.xform(Vector3(-selectable_icon_size, -selectable_icon_size, 0) * scale);
+
+ Point2 p0 = p_camera->unproject_position(c0);
+ Point2 p1 = p_camera->unproject_position(c1);
+
+ p_camera->set_global_transform(oct);
+
+ Rect2 rect(p0, p1 - p0);
+
+ rect.set_position(center - rect.get_size() / 2.0);
+
+ if (rect.has_point(p_point)) {
+ return true;
+ }
+
+ return false;
+ }
+
if (collision_segments.size()) {
Plane camp(p_camera->get_transform().origin, (-p_camera->get_transform().basis.get_axis(2)).normalized());
@@ -653,7 +714,7 @@ void EditorSpatialGizmo::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_lines", "lines", "material", "billboard"), &EditorSpatialGizmo::add_lines, DEFVAL(false));
ClassDB::bind_method(D_METHOD("add_mesh", "mesh", "billboard", "skeleton"), &EditorSpatialGizmo::add_mesh, DEFVAL(false), DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("add_collision_segments", "segments"), &EditorSpatialGizmo::add_collision_segments);
- ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles", "bounds"), &EditorSpatialGizmo::add_collision_triangles);
+ ClassDB::bind_method(D_METHOD("add_collision_triangles", "triangles"), &EditorSpatialGizmo::add_collision_triangles);
ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material", "default_scale"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1));
ClassDB::bind_method(D_METHOD("add_handles", "handles", "billboard", "secondary"), &EditorSpatialGizmo::add_handles, DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_spatial_node", "node"), &EditorSpatialGizmo::_set_spatial_node);
@@ -1261,14 +1322,15 @@ bool MeshInstanceSpatialGizmo::can_draw() const {
}
void MeshInstanceSpatialGizmo::redraw() {
+ clear();
+
Ref<Mesh> m = mesh->get_mesh();
if (!m.is_valid())
return; //none
Ref<TriangleMesh> tm = m->generate_triangle_mesh();
if (tm.is_valid()) {
- AABB aabb;
- add_collision_triangles(tm, aabb);
+ add_collision_triangles(tm);
}
}
@@ -1280,6 +1342,27 @@ MeshInstanceSpatialGizmo::MeshInstanceSpatialGizmo(MeshInstance *p_mesh) {
/////
+bool Sprite3DSpatialGizmo::can_draw() const {
+ return true;
+}
+void Sprite3DSpatialGizmo::redraw() {
+
+ clear();
+
+ Ref<TriangleMesh> tm = sprite->generate_triangle_mesh();
+ if (tm.is_valid()) {
+ add_collision_triangles(tm);
+ }
+}
+
+Sprite3DSpatialGizmo::Sprite3DSpatialGizmo(SpriteBase3D *p_sprite) {
+
+ sprite = p_sprite;
+ set_spatial_node(p_sprite);
+}
+
+///
+
void Position3DSpatialGizmo::redraw() {
clear();
@@ -1523,6 +1606,120 @@ SkeletonSpatialGizmo::SkeletonSpatialGizmo(Skeleton *p_skel) {
set_spatial_node(p_skel);
}
+PhysicalBoneSpatialGizmo::PhysicalBoneSpatialGizmo(PhysicalBone *p_pb) :
+ EditorSpatialGizmo(),
+ physical_bone(p_pb) {
+ set_spatial_node(p_pb);
+}
+
+void PhysicalBoneSpatialGizmo::redraw() {
+
+ clear();
+
+ if (!physical_bone)
+ return;
+
+ Skeleton *sk(physical_bone->find_skeleton_parent());
+ PhysicalBone *pb(sk->get_physical_bone(physical_bone->get_bone_id()));
+ PhysicalBone *pbp(sk->get_physical_bone_parent(physical_bone->get_bone_id()));
+
+ Vector<Vector3> points;
+
+ switch (physical_bone->get_joint_type()) {
+ case PhysicalBone::JOINT_TYPE_PIN: {
+
+ PinJointSpatialGizmo::CreateGizmo(physical_bone->get_joint_offset(), points);
+ } break;
+ case PhysicalBone::JOINT_TYPE_CONE: {
+
+ const PhysicalBone::ConeJointData *cjd(static_cast<const PhysicalBone::ConeJointData *>(physical_bone->get_joint_data()));
+ ConeTwistJointSpatialGizmo::CreateGizmo(
+ physical_bone->get_joint_offset(),
+ physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
+ pb ? pb->get_global_transform() : Transform(),
+ pbp ? pbp->get_global_transform() : Transform(),
+ cjd->swing_span,
+ cjd->twist_span,
+ points,
+ pb ? &points : NULL,
+ pbp ? &points : NULL);
+ } break;
+ case PhysicalBone::JOINT_TYPE_HINGE: {
+
+ const PhysicalBone::HingeJointData *hjd(static_cast<const PhysicalBone::HingeJointData *>(physical_bone->get_joint_data()));
+ HingeJointSpatialGizmo::CreateGizmo(
+ physical_bone->get_joint_offset(),
+ physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
+ pb ? pb->get_global_transform() : Transform(),
+ pbp ? pbp->get_global_transform() : Transform(),
+ hjd->angular_limit_lower,
+ hjd->angular_limit_upper,
+ hjd->angular_limit_enabled,
+ points,
+ pb ? &points : NULL,
+ pbp ? &points : NULL);
+ } break;
+ case PhysicalBone::JOINT_TYPE_SLIDER: {
+
+ const PhysicalBone::SliderJointData *sjd(static_cast<const PhysicalBone::SliderJointData *>(physical_bone->get_joint_data()));
+ SliderJointSpatialGizmo::CreateGizmo(
+ physical_bone->get_joint_offset(),
+ physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
+ pb ? pb->get_global_transform() : Transform(),
+ pbp ? pbp->get_global_transform() : Transform(),
+ sjd->angular_limit_lower,
+ sjd->angular_limit_upper,
+ sjd->linear_limit_lower,
+ sjd->linear_limit_upper,
+ points,
+ pb ? &points : NULL,
+ pbp ? &points : NULL);
+ } break;
+ case PhysicalBone::JOINT_TYPE_6DOF: {
+
+ const PhysicalBone::SixDOFJointData *sdofjd(static_cast<const PhysicalBone::SixDOFJointData *>(physical_bone->get_joint_data()));
+ Generic6DOFJointSpatialGizmo::CreateGizmo(
+ physical_bone->get_joint_offset(),
+
+ physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
+ pb ? pb->get_global_transform() : Transform(),
+ pbp ? pbp->get_global_transform() : Transform(),
+
+ sdofjd->axis_data[0].angular_limit_lower,
+ sdofjd->axis_data[0].angular_limit_upper,
+ sdofjd->axis_data[0].linear_limit_lower,
+ sdofjd->axis_data[0].linear_limit_upper,
+ sdofjd->axis_data[0].angular_limit_enabled,
+ sdofjd->axis_data[0].linear_limit_enabled,
+
+ sdofjd->axis_data[1].angular_limit_lower,
+ sdofjd->axis_data[1].angular_limit_upper,
+ sdofjd->axis_data[1].linear_limit_lower,
+ sdofjd->axis_data[1].linear_limit_upper,
+ sdofjd->axis_data[1].angular_limit_enabled,
+ sdofjd->axis_data[1].linear_limit_enabled,
+
+ sdofjd->axis_data[2].angular_limit_lower,
+ sdofjd->axis_data[2].angular_limit_upper,
+ sdofjd->axis_data[2].linear_limit_lower,
+ sdofjd->axis_data[2].linear_limit_upper,
+ sdofjd->axis_data[2].angular_limit_enabled,
+ sdofjd->axis_data[2].linear_limit_enabled,
+
+ points,
+ pb ? &points : NULL,
+ pbp ? &points : NULL);
+ } break;
+ default:
+ return;
+ }
+
+ Ref<Material> material = create_material("joint_material", EDITOR_GET("editors/3d_gizmos/gizmo_colors/joint"));
+
+ add_collision_segments(points);
+ add_lines(points, material);
+}
+
// FIXME: Kept as reference for reimplementation in 3.1+
#if 0
void RoomSpatialGizmo::redraw() {
@@ -2411,12 +2608,13 @@ void ParticlesGizmo::redraw() {
gizmo_color.a = 0.1;
Ref<Material> solid_material = create_material("particles_solid_material", gizmo_color);
- add_solid_box(solid_material, aabb.get_size());
+ add_solid_box(solid_material, aabb.get_size(), aabb.get_position() + aabb.get_size() / 2.0);
}
//add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05);
- add_unscaled_billboard(icon, 0.05);
+
add_handles(handles);
+ add_unscaled_billboard(icon, 0.05);
}
ParticlesGizmo::ParticlesGizmo(Particles *p_particles) {
@@ -3724,6 +3922,12 @@ Ref<SpatialEditorGizmo> SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) {
return lsg;
}
+ if (Object::cast_to<PhysicalBone>(p_spatial)) {
+
+ Ref<PhysicalBoneSpatialGizmo> pbsg = memnew(PhysicalBoneSpatialGizmo(Object::cast_to<PhysicalBone>(p_spatial)));
+ return pbsg;
+ }
+
if (Object::cast_to<Position3D>(p_spatial)) {
Ref<Position3DSpatialGizmo> lsg = memnew(Position3DSpatialGizmo(Object::cast_to<Position3D>(p_spatial)));
@@ -4052,9 +4256,9 @@ SpatialEditorGizmos::SpatialEditorGizmos() {
for (int k = 0; k < 3; k++) {
if (i < 3)
- face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[j][(i + k) % 3] = v[k];
else
- face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[3 - j][(i + k) % 3] = -v[k];
}
}
//tri 1
diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h
index eedab7fdef..924f82dc16 100644
--- a/editor/spatial_editor_gizmos.h
+++ b/editor/spatial_editor_gizmos.h
@@ -49,6 +49,7 @@
#include "scene/3d/ray_cast.h"
#include "scene/3d/reflection_probe.h"
#include "scene/3d/room_instance.h"
+#include "scene/3d/sprite_3d.h"
#include "scene/3d/vehicle_body.h"
#include "scene/3d/visibility_notifier.h"
@@ -80,7 +81,6 @@ class EditorSpatialGizmo : public SpatialEditorGizmo {
Vector<Vector3> collision_segments;
Ref<TriangleMesh> collision_mesh;
- AABB collision_mesh_bounds;
struct Handle {
Vector3 pos;
@@ -89,6 +89,7 @@ class EditorSpatialGizmo : public SpatialEditorGizmo {
Vector<Vector3> handles;
Vector<Vector3> secondary_handles;
+ float selectable_icon_size = -1.0f;
bool billboard_handle;
bool valid;
@@ -102,10 +103,10 @@ protected:
void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false);
void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const RID &p_skeleton = RID());
void add_collision_segments(const Vector<Vector3> &p_lines);
- void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const AABB &p_bounds = AABB());
+ void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh);
void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1);
void add_handles(const Vector<Vector3> &p_handles, bool p_billboard = false, bool p_secondary = false);
- void add_solid_box(Ref<Material> &p_material, Vector3 p_size);
+ void add_solid_box(Ref<Material> &p_material, Vector3 p_size, Vector3 p_position = Vector3());
void set_spatial_node(Spatial *p_node);
const Spatial *get_spatial_node() const { return spatial_node; }
@@ -118,7 +119,7 @@ protected:
public:
virtual Vector3 get_handle_pos(int p_idx) const;
virtual bool intersect_frustum(const Camera *p_camera, const Vector<Plane> &p_frustum);
- virtual bool intersect_ray(const Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
+ virtual bool intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
void clear();
void create();
@@ -192,6 +193,18 @@ public:
MeshInstanceSpatialGizmo(MeshInstance *p_mesh = NULL);
};
+class Sprite3DSpatialGizmo : public EditorSpatialGizmo {
+
+ GDCLASS(Sprite3DSpatialGizmo, EditorSpatialGizmo);
+
+ SpriteBase3D *sprite;
+
+public:
+ virtual bool can_draw() const;
+ void redraw();
+ Sprite3DSpatialGizmo(SpriteBase3D *p_sprite = NULL);
+};
+
class Position3DSpatialGizmo : public EditorSpatialGizmo {
GDCLASS(Position3DSpatialGizmo, EditorSpatialGizmo);
@@ -214,6 +227,17 @@ public:
SkeletonSpatialGizmo(Skeleton *p_skel = NULL);
};
+class PhysicalBoneSpatialGizmo : public EditorSpatialGizmo {
+ GDCLASS(PhysicalBoneSpatialGizmo, EditorSpatialGizmo);
+
+ PhysicalBone *physical_bone;
+
+public:
+ //virtual Transform get_global_gizmo_transform();
+ virtual void redraw();
+ PhysicalBoneSpatialGizmo(PhysicalBone *p_pb = NULL);
+};
+
#if 0
class PortalSpatialGizmo : public EditorSpatialGizmo {
diff --git a/editor/translations/af.po b/editor/translations/af.po
index d2aa951580..c5853bbb2f 100644
--- a/editor/translations/af.po
+++ b/editor/translations/af.po
@@ -502,7 +502,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Koppel '%s' aan '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Koppel..."
#: editor/connections_dialog.cpp
@@ -928,11 +928,11 @@ msgid "Move Audio Bus"
msgstr "Skuif Oudio-Bus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Stoor Oudio-Bus Uitleg As..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "Ligging van Nuwe Uitleg..."
#: editor/editor_audio_buses.cpp
@@ -1071,11 +1071,11 @@ msgid "Updating Scene"
msgstr "Toneel word Opgedateer"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "Plaaslike veranderinge word gebêre..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "Toneel word opgedateer..."
#: editor/editor_data.cpp
@@ -1146,7 +1146,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1407,17 +1407,21 @@ msgstr "Vee uit"
msgid "Clear Output"
msgstr "Afvoer:"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Fout tydens storing van hulpbron!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Stoor Hulpbron As..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Ek sien..."
#: editor/editor_node.cpp
@@ -1622,11 +1626,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1638,7 +1642,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1690,7 +1694,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1835,7 +1839,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1847,11 +1851,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1871,15 +1875,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2124,7 +2128,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2233,7 +2237,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2384,7 +2388,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2400,12 +2404,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2466,7 +2464,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2483,7 +2481,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2497,7 +2495,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2634,11 +2632,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2651,16 +2649,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Dupliseer"
#: editor/filesystem_dock.cpp
@@ -2686,7 +2684,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2752,7 +2750,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2764,7 +2762,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2780,7 +2778,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2800,7 +2798,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3215,7 +3213,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3223,7 +3221,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3292,7 +3290,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3359,7 +3357,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3546,6 +3544,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3642,6 +3641,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3927,6 +3934,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3955,7 +3966,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4160,7 +4171,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4522,7 +4533,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4619,7 +4630,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4825,15 +4836,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5284,11 +5295,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5541,7 +5548,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5589,6 +5596,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5601,7 +5616,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5790,7 +5805,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5881,6 +5896,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Ongeldige naam."
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Kon nie vouer skep nie."
@@ -6068,7 +6088,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6096,7 +6118,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6212,10 +6234,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6284,7 +6302,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6380,11 +6398,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6555,7 +6573,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7256,6 +7274,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7306,6 +7328,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7893,10 +7919,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/ar.po b/editor/translations/ar.po
index 69f011012e..ccf2b97d9a 100644
--- a/editor/translations/ar.po
+++ b/editor/translations/ar.po
@@ -3,6 +3,7 @@
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
#
+# Adel <dragonhunter250@gmail.com>, 2018.
# athomield <athomield@hotmail.com>, 2017.
# Basil Al-Khateeb <basil.y.alkhateeb@gmail.com>, 2017.
# Jamal Alyafei <jamal.qassim@gmail.com>, 2017.
@@ -13,14 +14,15 @@
# noureldin sharaf <sharaf.noureldin@yahoo.com>, 2017.
# omar anwar aglan <omar.aglan91@yahoo.com>, 2017-2018.
# OWs Tetra <owstetra@gmail.com>, 2017.
+# Rached Noureddine <rached.noureddine@gmail.com>, 2018.
# Rex_sa <asd1234567890m@gmail.com>, 2017.
# Wajdi Feki <wajdi.feki@gmail.com>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-30 16:34+0000\n"
-"Last-Translator: Yaron Shahrabani <sh.yaron@gmail.com>\n"
+"PO-Revision-Date: 2018-05-28 18:34+0000\n"
+"Last-Translator: Rached Noureddine <rached.noureddine@gmail.com>\n"
"Language-Team: Arabic <https://hosted.weblate.org/projects/godot-engine/"
"godot/ar/>\n"
"Language: ar\n"
@@ -28,7 +30,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\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 2.19-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -508,7 +510,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "قطع إتصال'%s' من '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "يتصل..."
#: editor/connections_dialog.cpp
@@ -928,11 +930,11 @@ msgid "Move Audio Bus"
msgstr "تحريك بيوس الصوت"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Ø¥Ø­ÙØ¸ نسق بيوس الصوت كـ..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "المكان للنسق الجديد..."
#: editor/editor_audio_buses.cpp
@@ -1068,11 +1070,11 @@ msgid "Updating Scene"
msgstr "ÙŠÙØ­Ø¯Ø« المشهد"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "جاري تخزين التعديلات المحلية.."
+msgid "Storing local changes..."
+msgstr "جاري تخزين التعديلات المحلية..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "ÙŠÙØ­Ø¯Ø« المشهد..."
#: editor/editor_data.cpp
@@ -1141,8 +1143,8 @@ msgid "Show In File Manager"
msgstr "أظهر ÙÙŠ مدير Ø§Ù„Ù…Ù„ÙØ§Øª"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "مجلد جديد.."
+msgid "New Folder..."
+msgstr "مجلد جديد..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1401,18 +1403,22 @@ msgstr "خالي"
msgid "Clear Output"
msgstr "أخلاء الخرج"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "تصدير المشروع ÙØ´Ù„, رمز الخطأ % d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "خطأ ÙÙŠ Ø­ÙØ¸ المورد!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Ø­ÙØ¸ المورد باسم..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "أنا أري.."
+msgid "I see..."
+msgstr "أنا أري..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1636,11 +1642,11 @@ msgid "Open Base Scene"
msgstr "ÙØªØ­ مشهد أساسي"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "ÙØªØ­ سريع للمشهد..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "ÙØªØ­ سريع للكود..."
#: editor/editor_node.cpp
@@ -1652,8 +1658,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "هل تريد Ø­ÙØ¸ التغييرات إلي'%s' قبل الإغلاق؟"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Ø­ÙØ¸ المشهد كـ.."
+msgid "Save Scene As..."
+msgstr "Ø­ÙØ¸ المشهد كـ..."
#: editor/editor_node.cpp
msgid "No"
@@ -1704,7 +1710,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "هذا Ø§Ù„ÙØ¹Ù„ لا يمكن إرجاعة. إرجاع علي أية حال؟"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "تشغيل مشهد بسرعة..."
#: editor/editor_node.cpp
@@ -1861,8 +1867,8 @@ msgid "Previous tab"
msgstr "التبويب السابق"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Ùلتر Ø§Ù„Ù…Ù„ÙØ§Øª.."
+msgid "Filter Files..."
+msgstr "Ùلتر Ø§Ù„Ù…Ù„ÙØ§Øª..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1873,12 +1879,12 @@ msgid "New Scene"
msgstr "مشهد جديد"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "مشهد مورث جديد.."
+msgid "New Inherited Scene..."
+msgstr "مشهد مورث جديد..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Ø§ÙØªØ­ مشهد.."
+msgid "Open Scene..."
+msgstr "Ø§ÙØªØ­ مشهد..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1897,16 +1903,16 @@ msgid "Open Recent"
msgstr "ÙÙØªØ­ مؤخراً"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "تحويل الي.."
+msgid "Convert To..."
+msgstr "تحويل الي..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "مكتبة الميش.."
+msgid "MeshLibrary..."
+msgstr "مكتبة الميش..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "مجموعة البلاط.."
+msgid "TileSet..."
+msgstr "مجموعة البلاط..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2167,7 +2173,7 @@ msgid "Save the currently edited resource."
msgstr "Ø­ÙØ¸ المورد الذي يتم تعديله حاليا."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Ø­ÙØ¸ باسم..."
#: editor/editor_node.cpp
@@ -2276,8 +2282,8 @@ msgid "Creating Mesh Previews"
msgstr "ÙŠÙنشئ مستعرضات الميش"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "الصورة المصغرة.."
+msgid "Thumbnail..."
+msgstr "الصورة المصغرة..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2429,8 +2435,8 @@ msgid "(Current)"
msgstr "(الحالي)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "يستقبل المرايا، من ÙØ¶Ù„Ùƒ إنتظر.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "يستقبل المرايا، من ÙØ¶Ù„Ùƒ إنتظر..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2445,12 +2451,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "صيغة غير صالحة لـ version.txt داخل القالب."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr "صيغة غير صالحة لـ version.txt داخل القالب. المراجعة ليست Ù…Ø¹Ø±ÙØ§Ù‹ صالحاً."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "لا مل٠version.txt تم إيجاده داخل القالب."
@@ -2513,8 +2513,8 @@ msgid "Error requesting url: "
msgstr "خطأ ÙÙŠ طلب الرابط: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "يتصل Ø¨Ø§Ù„Ø³Ø±ÙØ±.."
+msgid "Connecting to Mirror..."
+msgstr "يتصل Ø¨Ø§Ù„Ø³Ø±ÙØ±..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2530,7 +2530,7 @@ msgstr "لا يمكن الحل"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "جاري الإتصال..."
#: editor/export_template_manager.cpp
@@ -2543,7 +2543,7 @@ msgstr "متصل"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "جار الطلب..."
#: editor/export_template_manager.cpp
@@ -2676,12 +2676,12 @@ msgid "Collapse all"
msgstr "طوي الكل"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "إعادة تسمية.."
+msgid "Rename..."
+msgstr "إعادة تسمية..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "تحريك إلي.."
+msgid "Move To..."
+msgstr "تحريك إلي..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2692,15 +2692,15 @@ msgid "Instance"
msgstr "نموذج"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "تعديل التبعيات.."
+msgid "Edit Dependencies..."
+msgstr "تعديل التبعيات..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "أظهر المÙلاك.."
+msgid "View Owners..."
+msgstr "أظهر المÙلاك..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "تكرير..."
#: editor/filesystem_dock.cpp
@@ -2726,10 +2726,10 @@ msgstr "نمذج المشهد(المشاهد) المحددة كطÙÙ„ للعقد
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"ÙŠÙØ­Øµ Ø§Ù„Ù…Ù„ÙØ§ØªØŒ\n"
-"من ÙØ¶Ù„Ùƒ إنتظر.."
+"من ÙØ¶Ù„Ùƒ إنتظر..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2794,8 +2794,8 @@ msgid "Import Scene"
msgstr "إستيراد مشهد"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "حاري إستيراد المشهد.."
+msgid "Importing Scene..."
+msgstr "حاري إستيراد المشهد..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2806,8 +2806,8 @@ msgid "Generating for Mesh: "
msgstr "انشاء من اجل الميش: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "تشغيل الكود Ø§Ù„Ù…ÙØ®ØµØµ.."
+msgid "Running Custom Script..."
+msgstr "تشغيل الكود Ø§Ù„Ù…ÙØ®ØµØµ..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2822,8 +2822,8 @@ msgid "Error running post-import script:"
msgstr "خطأ ÙÙŠ تشغيل الكود الملصق- المستورد:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "جاري Ø§Ù„Ø­ÙØ¸.."
+msgid "Saving..."
+msgstr "جاري Ø§Ù„Ø­ÙØ¸..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2842,8 +2842,8 @@ msgid "Import As:"
msgstr "إستيراد كـ:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "إعداد Ù…ÙØ³Ø¨Ù‚.."
+msgid "Preset..."
+msgstr "إعداد Ù…ÙØ³Ø¨Ù‚..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3260,16 +3260,16 @@ msgid "Transition Node"
msgstr "عقدة التنقل"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "إستيراد الحركة.."
+msgid "Import Animations..."
+msgstr "إستيراد الحركة..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "تعديل مصاÙÙŠ العقد"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "الÙلترة.."
+msgid "Filters..."
+msgstr "الÙلترة..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3336,7 +3336,7 @@ msgid "Fetching:"
msgstr "يجلب:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "جاري الحل..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3403,7 +3403,7 @@ msgid "Site:"
msgstr "الموقع:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "الدعم..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3597,6 +3597,7 @@ msgid "Use Rotation Snap"
msgstr "إستعمال كبس التدوير"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "تعديل الكبس..."
@@ -3693,6 +3694,14 @@ msgid "Show Guides"
msgstr "أظهر الموجهات"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "إظهار المركز"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "أظهر الشاشة"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Ù†ØµÙ Ø§Ù„Ù…ÙØ­Ø¯Ø¯"
@@ -3750,11 +3759,11 @@ msgstr "Ø¥Ø¶Ø§ÙØ© %s..."
#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ok"
-msgstr ""
+msgstr "حسنا"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Cannot instantiate multiple nodes without root."
-msgstr ""
+msgstr "لا يمكن إنشاء عقد متعددة بدون العقدة الجذر."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -3982,6 +3991,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "الميش ليس لديه سطح لكي ينشئ حدود منه!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "شبكة بسيطة ليست PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "لا يمكن إنشاء الحد!"
@@ -4010,8 +4023,8 @@ msgid "Create Convex Collision Sibling"
msgstr "إنشاء متصادم محدب قريب"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "إنشاء شبكة الخطوط العريضة .."
+msgid "Create Outline Mesh..."
+msgstr "إنشاء شبكة الخطوط العريضة ..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4159,7 +4172,7 @@ msgstr "إنشاء مجال Ø§Ù„Ø¥Ø±ØªÙØ§Ø¹..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Marking walkable triangles..."
-msgstr "تعليم مثلثات التحرك.."
+msgstr "تعليم مثلثات التحرك..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
@@ -4204,101 +4217,101 @@ msgstr "إنشاء Ù…ÙØ¶Ù„ع التنقل"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generating AABB"
-msgstr "ÙŠÙنشئ AABB"
+msgstr "توليد AABB"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Can only set point into a ParticlesMaterial process material"
-msgstr ""
+msgstr "لا يمكن إنشاء سوى نقطة وحيدة داخل ParticlesMaterial معالج المواد"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Error loading image:"
-msgstr ""
+msgstr "خطأ تحميل الصورة:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr ""
+msgid "No pixels with transparency > 128 in image..."
+msgstr "لا بيكسل Ø¨Ø´ÙØ§Ùية > 128 ÙÙŠ الصورة..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
-msgstr ""
+msgstr "توليد Rect الرؤية"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Load Emission Mask"
-msgstr ""
+msgstr "حمل قناع الانبعاث"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Clear Emission Mask"
-msgstr ""
+msgstr "إمسح قناع الانبعاث"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Particles"
-msgstr ""
+msgstr "جسيمات"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generated Point Count:"
-msgstr ""
+msgstr "عدد النقاط المولدة:"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generation Time (sec):"
-msgstr ""
+msgstr "وقت التوليد (تانية):"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Mask"
-msgstr ""
+msgstr "قناع الانبعاث"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Capture from Pixel"
-msgstr ""
+msgstr "التقط من البيكسل"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Colors"
-msgstr ""
+msgstr "الوان الانبعاث"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry."
-msgstr ""
+msgstr "العقدة لا تحتوي على هندسة."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry (faces)."
-msgstr ""
+msgstr "العقدة لا تحتوي على هندسة (الوجوه)."
#: editor/plugins/particles_editor_plugin.cpp
msgid "A processor material of type 'ParticlesMaterial' is required."
-msgstr ""
+msgstr "معالج المواد من نوع 'ParticlesMaterial' مطلوب."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Faces contain no area!"
-msgstr ""
+msgstr "الوجوه لا تحتوي على منطقة!"
#: editor/plugins/particles_editor_plugin.cpp
msgid "No faces!"
-msgstr ""
+msgstr "لا وجوه!"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate AABB"
-msgstr ""
+msgstr "ولد AABB"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Mesh"
-msgstr ""
+msgstr "أنشئ نقاط إنبعاث من الشبكة"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Node"
-msgstr ""
+msgstr "أنشئ نقاط إنبعاث من العقدة"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emitter"
-msgstr ""
+msgstr "أنشئ باعث"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Points:"
-msgstr ""
+msgstr "نقاط الانبعاث:"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points"
-msgstr ""
+msgstr "نقاط المساحة"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points+Normal (Directed)"
@@ -4306,15 +4319,15 @@ msgstr ""
#: editor/plugins/particles_editor_plugin.cpp
msgid "Volume"
-msgstr ""
+msgstr "حجم"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Source: "
-msgstr ""
+msgstr "مصدر الانبعاث: "
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate Visibility AABB"
-msgstr ""
+msgstr "ولد رؤية AABB"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove Point from Curve"
@@ -4326,39 +4339,39 @@ msgstr ""
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove In-Control from Curve"
-msgstr ""
+msgstr "أزل In-Control من المنحنى"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Add Point to Curve"
-msgstr ""
+msgstr "أض٠نقطة للمنحنى"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Point in Curve"
-msgstr ""
+msgstr "حرك النقطة داخل المنحنى"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move In-Control in Curve"
-msgstr ""
+msgstr "حرك In-Control داخل المنحنى"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Out-Control in Curve"
-msgstr ""
+msgstr "حرك Out-Control داخل المنحنى"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Select Points"
-msgstr ""
+msgstr "إختر النقاط"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Shift+Drag: Select Control Points"
-msgstr ""
+msgstr "Shift+سحب: إختر نقاط التحكم"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Click: Add Point"
-msgstr ""
+msgstr "إظغط: أض٠نقطة"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
@@ -4576,7 +4589,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4673,7 +4686,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4879,15 +4892,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5338,11 +5351,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5595,7 +5604,7 @@ msgid "Remove All"
msgstr "مسح الكل"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5623,24 +5632,39 @@ msgid "Create From Current Editor Theme"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "CheckBox Radio1"
-msgstr ""
+msgstr "صندوق تأشير ١"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "CheckBox Radio2"
-msgstr ""
+msgstr "صندوق تأشير٢"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "Item"
-msgstr ""
+msgstr "عنصر"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "Check Item"
-msgstr ""
+msgstr "اختار العنصر"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "Checked Item"
-msgstr ""
+msgstr "عنصر مَضْبÙوط"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "عنصر انتقاء"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "عنصر انتقاء مَضْبÙوط"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
@@ -5651,24 +5675,26 @@ msgid "Many"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
+#, fuzzy
msgid "Options"
-msgstr ""
+msgstr "الخيارات"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "بكثير، خيارات عديدة،!"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
-msgstr ""
+msgstr "علامة التبويب 1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 2"
-msgstr ""
+msgstr "علامة التبويب 2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 3"
-msgstr ""
+msgstr "علامة التبويب 3"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Data Type:"
@@ -5843,7 +5869,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5933,6 +5959,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "اسم غير صالح."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "لا يمكن إنشاء المجلد."
@@ -6118,7 +6149,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6146,7 +6179,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6262,10 +6295,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "لا يمكن أن يحتوي علي '/' أو ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6334,7 +6363,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6430,11 +6459,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6605,7 +6634,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7311,6 +7340,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "إنشاء الحل..."
@@ -7359,6 +7392,10 @@ msgstr "بناء المشروع"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7947,10 +7984,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8031,12 +8078,21 @@ msgstr ""
msgid "Invalid font size."
msgstr ""
-#~ msgid "Can't write file."
-#~ msgstr "لا يمكن كتابة الملÙ."
-
#~ msgid "Next"
#~ msgstr "التالي"
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "لا يمكن أن يحتوي علي '/' أو ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "صيغة غير صالحة لـ version.txt داخل القالب. المراجعة ليست Ù…Ø¹Ø±ÙØ§Ù‹ صالحاً."
+
+#~ msgid "Can't write file."
+#~ msgstr "لا يمكن كتابة الملÙ."
+
#~ msgid "Not found!"
#~ msgstr "لم يوجد!"
@@ -8085,8 +8141,8 @@ msgstr ""
#~ msgid "Exporting for %s"
#~ msgstr "التصدير كـ %s"
-#~ msgid "Setting Up.."
-#~ msgstr "جاري الإعداد.."
+#~ msgid "Setting Up..."
+#~ msgstr "جاري الإعداد..."
#~ msgid "The quick brown fox jumps over the lazy dog."
#~ msgstr "أبجد هوز حطي كلمن ØµØ¹ÙØµ قرشت ثخذ ضظغ."
diff --git a/editor/translations/bg.po b/editor/translations/bg.po
index 79b1571b06..9f366b3d2f 100644
--- a/editor/translations/bg.po
+++ b/editor/translations/bg.po
@@ -497,7 +497,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -907,11 +907,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1048,12 +1048,12 @@ msgid "Updating Scene"
msgstr "ОбновÑване на Ñцената"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "ОбновÑване на Ñцената.."
+msgid "Updating scene..."
+msgstr "ОбновÑване на Ñцената..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1121,8 +1121,8 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Ðова папка.."
+msgid "New Folder..."
+msgstr "Ðова папка..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1375,17 +1375,21 @@ msgstr "ИзчиÑтване"
msgid "Clear Output"
msgstr "Ðова Ñцена"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1590,11 +1594,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Бързо отварÑне на Ñцена.."
+msgid "Quick Open Scene..."
+msgstr "Бързо отварÑне на Ñцена..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1606,8 +1610,8 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Запазване на Ñцената като.."
+msgid "Save Scene As..."
+msgstr "Запазване на Ñцената като..."
#: editor/editor_node.cpp
msgid "No"
@@ -1658,8 +1662,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Бързо пуÑкане на Ñцена.."
+msgid "Quick Run Scene..."
+msgstr "Бързо пуÑкане на Ñцена..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1808,7 +1812,7 @@ msgid "Previous tab"
msgstr "Предишен подпрозорец"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1820,12 +1824,12 @@ msgid "New Scene"
msgstr "Ðова Ñцена"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "ОтварÑне на Ñцена.."
+msgid "Open Scene..."
+msgstr "ОтварÑне на Ñцена..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1844,15 +1848,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2097,7 +2101,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2207,7 +2211,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2359,7 +2363,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2375,12 +2379,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2422,7 +2420,7 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
msgid "Request Failed."
-msgstr "Запитване.."
+msgstr "Запитване..."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2445,8 +2443,8 @@ msgstr "Имаше грешка при внаÑÑнето:"
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
-msgstr "Свързване.."
+msgid "Connecting to Mirror..."
+msgstr "Свързване..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2462,8 +2460,8 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Свързване.."
+msgid "Connecting..."
+msgstr "Свързване..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2477,8 +2475,8 @@ msgstr "ИзрÑзване на възелите"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Запитване.."
+msgid "Requesting..."
+msgstr "Запитване..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2487,7 +2485,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#, fuzzy
msgid "Connection Error"
-msgstr "Свързване.."
+msgstr "Свързване..."
#: editor/export_template_manager.cpp
msgid "SSL Handshake Error"
@@ -2618,11 +2616,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2635,15 +2633,15 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2669,7 +2667,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2692,12 +2690,12 @@ msgstr ""
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Import as Single Scene"
-msgstr "ВнаÑÑне на Ñцената.."
+msgstr "ВнаÑÑне на Ñцената..."
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Import with Separate Animations"
-msgstr "ВнаÑÑне на анимации.."
+msgstr "ВнаÑÑне на анимации..."
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
@@ -2738,8 +2736,8 @@ msgid "Import Scene"
msgstr "ВнаÑÑне на Ñцена"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "ВнаÑÑне на Ñцената.."
+msgid "Importing Scene..."
+msgstr "ВнаÑÑне на Ñцената..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2750,7 +2748,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2766,7 +2764,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2787,7 +2785,7 @@ msgid "Import As:"
msgstr "ВнаÑÑне като:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3205,15 +3203,15 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "ВнаÑÑне на анимации.."
+msgid "Import Animations..."
+msgstr "ВнаÑÑне на анимации..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3282,7 +3280,7 @@ msgid "Fetching:"
msgstr "ИзтеглÑне:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3350,7 +3348,7 @@ msgid "Site:"
msgstr "МÑÑто:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Поддръжка"
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3540,6 +3538,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3636,6 +3635,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3922,6 +3929,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3950,7 +3961,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4157,7 +4168,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4519,7 +4530,7 @@ msgid "Import Theme"
msgstr "ВнаÑÑне на тема"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4617,7 +4628,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4825,15 +4836,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5289,11 +5300,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5548,7 +5555,7 @@ msgid "Remove All"
msgstr "ЗатварÑне на вÑичко"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5596,6 +5603,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5608,7 +5623,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5799,7 +5814,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5893,6 +5908,11 @@ msgstr "ВнеÑен проект"
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Име:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "ÐеуÑпешно Ñъздаване на папка."
@@ -6085,7 +6105,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6113,7 +6135,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6229,10 +6251,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6301,7 +6319,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6398,11 +6416,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6576,7 +6594,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7311,6 +7329,10 @@ msgstr "ÐаÑтройки"
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7361,6 +7383,10 @@ msgstr "Проект"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7981,10 +8007,20 @@ msgstr ""
"работи."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8105,8 +8141,8 @@ msgstr ""
#~ "Status: Needs Re-Import"
#~ msgstr "Запазване и повторно внаÑÑне"
-#~ msgid "Re-Import.."
-#~ msgstr "Повторно внаÑÑне.."
+#~ msgid "Re-Import..."
+#~ msgstr "Повторно внаÑÑне..."
#~ msgid "Font Import"
#~ msgstr "ВнаÑÑне на шрифт"
@@ -8195,5 +8231,5 @@ msgstr ""
#~ msgid "Export all files in the project directory."
#~ msgstr "ИзнаÑÑне на вÑички файлове в папката на проекта."
-#~ msgid "Export.."
-#~ msgstr "ИзнаÑÑне.."
+#~ msgid "Export..."
+#~ msgstr "ИзнаÑÑне..."
diff --git a/editor/translations/bn.po b/editor/translations/bn.po
index dec1917280..3d00e3450c 100644
--- a/editor/translations/bn.po
+++ b/editor/translations/bn.po
@@ -502,8 +502,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "'%s' à¦à¦° সাথে '%s' সংযà§à¦•à§à¦¤ করà§à¦¨"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "সংযোগ.."
+msgid "Connect..."
+msgstr "সংযোগ..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -927,12 +927,12 @@ msgid "Move Audio Bus"
msgstr "অডিও বাস মà§à¦­ করà§à¦¨"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "অডিও বাস লেআউট সেভ করà§à¦¨.."
+msgid "Save Audio Bus Layout As..."
+msgstr "অডিও বাস লেআউট সেভ করà§à¦¨..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "নতà§à¦¨ লেআউট লোকেশন.."
+msgid "Location for New Layout..."
+msgstr "নতà§à¦¨ লেআউট লোকেশন..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1073,12 +1073,12 @@ msgid "Updating Scene"
msgstr "দৃশà§à¦¯ হাল নাগাদ হচà§à¦›à§‡"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "সà§à¦¥à¦¾à¦¨à§€à§Ÿ পরিবরà§à¦¤à¦¨-সমূহ সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡.."
+msgid "Storing local changes..."
+msgstr "সà§à¦¥à¦¾à¦¨à§€à§Ÿ পরিবরà§à¦¤à¦¨-সমূহ সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "দৃশà§à¦¯ হাল নাগাদ হচà§à¦›à§‡.."
+msgid "Updating scene..."
+msgstr "দৃশà§à¦¯ হাল নাগাদ হচà§à¦›à§‡..."
#: editor/editor_data.cpp
#, fuzzy
@@ -1151,7 +1151,7 @@ msgstr "ফাইল-মà§à¦¯à¦¾à¦¨à§‡à¦œà¦¾à¦°à§‡ দেখà§à¦¨"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
#, fuzzy
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "ফোলà§à¦¡à¦¾à¦° তৈরি করà§à¦¨"
#: editor/editor_file_dialog.cpp
@@ -1428,18 +1428,22 @@ msgstr "পরিসà§à¦•ার করà§à¦¨/কà§à¦²à§€à§Ÿà¦¾à¦°"
msgid "Clear Output"
msgstr "আউটপà§à¦Ÿ/ফলাফল"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "রিসোরà§à¦¸ সংরকà§à¦·à¦£à§‡ সমসà§à¦¯à¦¾ হয়েছে!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "রিসোরà§à¦¸ à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨.."
+msgid "Save Resource As..."
+msgstr "রিসোরà§à¦¸ à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "বà§à¦à¦²à¦¾à¦®.."
+msgid "I see..."
+msgstr "বà§à¦à¦²à¦¾à¦®..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1676,12 +1680,12 @@ msgid "Open Base Scene"
msgstr "গোড়ার দৃশà§à¦¯ খà§à¦²à§à¦¨"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "দà§à¦°à§à¦¤ দৃশà§à¦¯ খà§à¦²à§à¦¨.."
+msgid "Quick Open Scene..."
+msgstr "দà§à¦°à§à¦¤ দৃশà§à¦¯ খà§à¦²à§à¦¨..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "দà§à¦°à§à¦¤ সà§à¦•à§à¦°à¦¿à¦ªà§à¦Ÿ খà§à¦²à§à¦¨.."
+msgid "Quick Open Script..."
+msgstr "দà§à¦°à§à¦¤ সà§à¦•à§à¦°à¦¿à¦ªà§à¦Ÿ খà§à¦²à§à¦¨..."
#: editor/editor_node.cpp
#, fuzzy
@@ -1693,8 +1697,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "'%s' বনà§à¦§ করার পূরà§à¦¬à§‡ পরিবরà§à¦¤à¦¨à¦¸à¦®à§‚হ সংরকà§à¦·à¦£ করবেন?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "দৃশà§à¦¯ à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨.."
+msgid "Save Scene As..."
+msgstr "দৃশà§à¦¯ à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨..."
#: editor/editor_node.cpp
#, fuzzy
@@ -1748,8 +1752,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "à¦à¦‡ কাজটি অসমà§à¦ªà¦¾à¦¦à¦¿à¦¤ করা সমà§à¦­à¦¬ হবে না। তবà§à¦“ পà§à¦°à¦¤à§à¦¯à¦¾à¦¬à¦°à§à¦¤à¦¨ করবেন?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "দà§à¦°à§à¦¤ দৃশà§à¦¯ চালান.."
+msgid "Quick Run Scene..."
+msgstr "দà§à¦°à§à¦¤ দৃশà§à¦¯ চালান..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1911,8 +1915,8 @@ msgstr "পূরà§à¦¬à§‡à¦° টà§à¦¯à¦¾à¦¬"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Filter Files.."
-msgstr "দà§à¦°à§à¦¤ ফাইলসমূহ ফিলà§à¦Ÿà¦¾à¦° করà§à¦¨.."
+msgid "Filter Files..."
+msgstr "দà§à¦°à§à¦¤ ফাইলসমূহ ফিলà§à¦Ÿà¦¾à¦° করà§à¦¨..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1923,12 +1927,12 @@ msgid "New Scene"
msgstr "নতà§à¦¨ দৃশà§à¦¯"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "নতà§à¦¨ উতà§à¦¤à¦°à¦¾à¦§à¦¿à¦•ারী দৃশà§à¦¯.."
+msgid "New Inherited Scene..."
+msgstr "নতà§à¦¨ উতà§à¦¤à¦°à¦¾à¦§à¦¿à¦•ারী দৃশà§à¦¯..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "দৃশà§à¦¯ খà§à¦²à§à¦¨.."
+msgid "Open Scene..."
+msgstr "দৃশà§à¦¯ খà§à¦²à§à¦¨..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1947,16 +1951,16 @@ msgid "Open Recent"
msgstr "সামà§à¦ªà§à¦°à¦¤à¦¿à¦•সমূহ খà§à¦²à§à¦¨"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨.."
+msgid "Convert To..."
+msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary (মেস-লাইবà§à¦°à§‡à¦°à¦¿).."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary (মেস-লাইবà§à¦°à§‡à¦°à¦¿)..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet (টাইল-সেট).."
+msgid "TileSet..."
+msgstr "TileSet (টাইল-সেট)..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2224,8 +2228,8 @@ msgid "Save the currently edited resource."
msgstr "à¦à¦‡-মà§à¦¹à§‚রà§à¦¤à§‡ সমà§à¦ªà¦¾à¦¦à¦¿à¦¤ রিসোরà§à¦¸à¦Ÿà¦¿ সংরকà§à¦·à¦£ করà§à¦¨à¥¤"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨.."
+msgid "Save As..."
+msgstr "à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2296,7 +2300,7 @@ msgstr "à¦à¦•টি সà§à¦•à§à¦°à¦¿à¦ªà§à¦Ÿ খà§à¦²à§à¦¨ à¦à¦¬à¦‚ চà¦
#: editor/editor_node.cpp
#, fuzzy
msgid "New Inherited"
-msgstr "নতà§à¦¨ উতà§à¦¤à¦°à¦¾à¦§à¦¿à¦•ারী দৃশà§à¦¯.."
+msgstr "নতà§à¦¨ উতà§à¦¤à¦°à¦¾à¦§à¦¿à¦•ারী দৃশà§à¦¯..."
#: editor/editor_node.cpp
msgid "Load Errors"
@@ -2342,8 +2346,8 @@ msgid "Creating Mesh Previews"
msgstr "মেস লাইবà§à¦°à§‡à¦°à¦¿ তৈরি হচà§à¦›à§‡"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "থামà§à¦¬à¦¨à§‡à¦‡à¦².."
+msgid "Thumbnail..."
+msgstr "থামà§à¦¬à¦¨à§‡à¦‡à¦²..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2503,8 +2507,8 @@ msgid "(Current)"
msgstr "বরà§à¦¤à¦®à¦¾à¦¨:"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "মিরর রিটà§à¦°à¦¾à¦‡à¦­ করা হচà§à¦›à§‡, দযা করে অপেকà§à¦·à¦¾ করà§à¦¨.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "মিরর রিটà§à¦°à¦¾à¦‡à¦­ করা হচà§à¦›à§‡, দযা করে অপেকà§à¦·à¦¾ করà§à¦¨..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2519,13 +2523,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "টেমপà§à¦²à§‡à¦Ÿ à¦à¦° version.txt ফরমà§à¦¯à¦¾à¦Ÿ গà§à¦°à¦¹à¦£à¦¯à§‹à¦—à§à¦¯ নয়।"
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"টেমপà§à¦²à§‡à¦Ÿ à¦à¦° version.txt ফরমà§à¦¯à¦¾à¦Ÿ অগà§à¦°à¦¹à¦£à¦¯à§‹à¦—à§à¦¯à¥¤ Revision কোন কাংখিত আইডেনà§à¦Ÿà¦¿à¦«à¦¾à§Ÿà¦¾à¦° নয়।"
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "টেমপà§à¦²à§‡à¦Ÿà§‡ version.txt খà§à¦à¦œà§‡ পাওয়া যায়নি।"
@@ -2560,7 +2557,7 @@ msgstr "সমসà§à¦¯à¦¾ সমাধানে বà§à¦¯à¦°à§à¦¥à¥¤"
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
msgid "Can't connect."
-msgstr "সংযোগ.."
+msgstr "সংযোগ..."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2595,8 +2592,8 @@ msgstr "à¦à¦Ÿà¦²à¦¾à¦¸/মানচিতà§à¦°à¦¾à¦¬à¦²à§€ সংরকà§à¦·à
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
-msgstr "সংযোগ.."
+msgid "Connecting to Mirror..."
+msgstr "সংযোগ..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2606,7 +2603,7 @@ msgstr "সংযোগ বিচà§à¦›à¦¿à¦¨à§à¦¨ করà§à¦¨"
#: editor/export_template_manager.cpp
#, fuzzy
msgid "Resolving"
-msgstr "সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡.."
+msgstr "সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡..."
#: editor/export_template_manager.cpp
msgid "Can't Resolve"
@@ -2615,13 +2612,13 @@ msgstr "কাংখিত সমাধানে বà§à¦¯à¦°à§à¦¥"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Connecting.."
-msgstr "সংযোগ.."
+msgid "Connecting..."
+msgstr "সংযোগ..."
#: editor/export_template_manager.cpp
#, fuzzy
msgid "Can't Connect"
-msgstr "সংযোগ.."
+msgstr "সংযোগ..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2631,7 +2628,7 @@ msgstr "সংযোগ"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "পরীকà§à¦·à¦¾à¦®à§‚লক উৎস"
#: editor/export_template_manager.cpp
@@ -2642,7 +2639,7 @@ msgstr "নীচে"
#: editor/export_template_manager.cpp
#, fuzzy
msgid "Connection Error"
-msgstr "সংযোগ.."
+msgstr "সংযোগ..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2750,7 +2747,7 @@ msgstr "বà§à¦¯à¦¬à¦¹à§ƒà¦¤ নামে অগà§à¦°à¦¹à¦£à¦¯à§‹à¦—à§à¦¯ অ
#: editor/filesystem_dock.cpp
#, fuzzy
msgid "No name provided."
-msgstr "পà§à¦¨à¦ƒà¦¨à¦¾à¦®à¦•রণ করà§à¦¨ অথবা সরান.."
+msgstr "পà§à¦¨à¦ƒà¦¨à¦¾à¦®à¦•রণ করà§à¦¨ অথবা সরান..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2793,12 +2790,12 @@ msgstr "কলাপà§à¦¸ করà§à¦¨"
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Rename.."
+msgid "Rename..."
msgstr "পà§à¦¨à¦ƒà¦¨à¦¾à¦®à¦•রণ করà§à¦¨"
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "à¦à¦–ানে সরান.."
+msgid "Move To..."
+msgstr "à¦à¦–ানে সরান..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2810,16 +2807,16 @@ msgid "Instance"
msgstr "ইনসà§à¦Ÿà§à¦¯à¦¾à¦¨à§à¦¸"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "নিরà§à¦­à¦°à¦¤à¦¾à¦¸à¦®à§‚হ সমà§à¦ªà¦¾à¦¦à¦¨ করà§à¦¨.."
+msgid "Edit Dependencies..."
+msgstr "নিরà§à¦­à¦°à¦¤à¦¾à¦¸à¦®à§‚হ সমà§à¦ªà¦¾à¦¦à¦¨ করà§à¦¨..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "সà§à¦¬à¦¤à§à¦¬à¦¾à¦§à¦¿à¦•ারীদের দেখà§à¦¨.."
+msgid "View Owners..."
+msgstr "সà§à¦¬à¦¤à§à¦¬à¦¾à¦§à¦¿à¦•ারীদের দেখà§à¦¨..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "ডà§à¦ªà§à¦²à¦¿à¦•েট"
#: editor/filesystem_dock.cpp
@@ -2845,10 +2842,10 @@ msgstr "নিরà§à¦¬à¦¾à¦šà¦¿à¦¤ দৃশà§à¦¯(সমূহ)-কে নিà
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"ফাইল সà§à¦•à§à¦¯à¦¾à¦¨ করা হচà§à¦›à§‡,\n"
-"অনà§à¦—à§à¦°à¦¹à¦ªà§‚রà§à¦¬à¦• অপেকà§à¦·à¦¾ করà§à¦¨.."
+"অনà§à¦—à§à¦°à¦¹à¦ªà§‚রà§à¦¬à¦• অপেকà§à¦·à¦¾ করà§à¦¨..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2870,12 +2867,12 @@ msgstr "গà§à¦°à§à¦ª/দল হতে অপসারণ করà§à¦¨"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Import as Single Scene"
-msgstr "দৃশà§à¦¯ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করা হচà§à¦›à§‡.."
+msgstr "দৃশà§à¦¯ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করা হচà§à¦›à§‡..."
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Import with Separate Animations"
-msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à¦¸à¦®à§‚হ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨.."
+msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à¦¸à¦®à§‚হ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨..."
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
@@ -2916,8 +2913,8 @@ msgid "Import Scene"
msgstr "দৃশà§à¦¯ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "দৃশà§à¦¯ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করা হচà§à¦›à§‡.."
+msgid "Importing Scene..."
+msgstr "দৃশà§à¦¯ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করা হচà§à¦›à§‡..."
#: editor/import/resource_importer_scene.cpp
#, fuzzy
@@ -2930,8 +2927,8 @@ msgid "Generating for Mesh: "
msgstr "AABB উৎপনà§à¦¨ করà§à¦¨"
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "সà§à¦¬à¦¨à¦¿à¦°à§à¦®à¦¿à¦¤ সà§à¦•à§à¦°à¦¿à¦ªà§à¦Ÿ চালানো হচà§à¦›à§‡.."
+msgid "Running Custom Script..."
+msgstr "সà§à¦¬à¦¨à¦¿à¦°à§à¦®à¦¿à¦¤ সà§à¦•à§à¦°à¦¿à¦ªà§à¦Ÿ চালানো হচà§à¦›à§‡..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2946,8 +2943,8 @@ msgid "Error running post-import script:"
msgstr "ইমà§à¦ªà§‹à¦°à§à¦Ÿ-পরবরà§à¦¤à§€ সà§à¦•à§à¦°à¦¿à¦ªà§à¦Ÿ চালানোয় সমসà§à¦¯à¦¾ হয়েছে:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡.."
+msgid "Saving..."
+msgstr "সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2968,8 +2965,8 @@ msgid "Import As:"
msgstr "ইমà§à¦ªà§‹à¦°à§à¦Ÿ"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "পà§à¦°à¦¿à¦¸à§‡à¦Ÿ.."
+msgid "Preset..."
+msgstr "পà§à¦°à¦¿à¦¸à§‡à¦Ÿ..."
#: editor/import_dock.cpp
#, fuzzy
@@ -3395,16 +3392,16 @@ msgid "Transition Node"
msgstr "টà§à¦°à§à¦¯à¦¾à¦¨à¦œà¦¿à¦¶à¦¨ নোড"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à¦¸à¦®à§‚হ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨.."
+msgid "Import Animations..."
+msgstr "অà§à¦¯à¦¾à¦¨à¦¿à¦®à§‡à¦¶à¦¨à¦¸à¦®à§‚হ ইমà§à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "নোড ফিলà§à¦Ÿà¦¾à¦°à¦¸à¦®à§‚হ সমà§à¦ªà¦¾à¦¦à¦¨ করà§à¦¨"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "ফিলà§à¦Ÿà¦¾à¦°à¦¸à¦®à§‚হ.."
+msgid "Filters..."
+msgstr "ফিলà§à¦Ÿà¦¾à¦°à¦¸à¦®à§‚হ..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3477,8 +3474,8 @@ msgstr "খà§à¦à¦œà§‡ আনার চেসà§à¦Ÿà¦¾ চলছে:"
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Resolving.."
-msgstr "সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡.."
+msgid "Resolving..."
+msgstr "সংরকà§à¦·à¦¿à¦¤ হচà§à¦›à§‡..."
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
@@ -3546,8 +3543,8 @@ msgid "Site:"
msgstr "ওয়েবসাইট:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "সমরà§à¦¥à¦¨.."
+msgid "Support..."
+msgstr "সমরà§à¦¥à¦¨..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3746,9 +3743,10 @@ msgid "Use Rotation Snap"
msgstr "ঘূরà§à¦£à¦¨ সà§à¦¨à§à¦¯à¦¾à¦ª বà§à¦¯à¦¬à¦¹à¦¾à¦° করà§à¦¨"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
msgid "Configure Snap..."
-msgstr "সà§à¦¨à§à¦¯à¦¾à¦ª কনফিগার করà§à¦¨.."
+msgstr "সà§à¦¨à§à¦¯à¦¾à¦ª কনফিগার করà§à¦¨..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3848,6 +3846,16 @@ msgid "Show Guides"
msgstr "বোনà§â€Œ/হাড় দেখান"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Origin"
+msgstr "অরিজিন দেখà§à¦¨"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Viewport"
+msgstr "১ টি Viewport"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "নিরà§à¦¬à¦¾à¦šà¦¨à¦•ে কেনà§à¦¦à§à¦°à§€à¦­à§‚ত করà§à¦¨"
@@ -4150,6 +4158,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "পà§à¦°à¦¾à¦¨à§à¦¤à¦°à§‡à¦–া তৈরি করার জনà§à¦¯ পà§à¦°à§Ÿà§‹à¦œà¦¨à§€à§Ÿ Mesh à¦à¦° কোনো পৃষà§à¦ à¦¤à¦² নেই!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "পà§à¦°à¦¾à¦¨à§à¦¤à¦°à§‡à¦–া তৈরি করা সমà§à¦­à¦¬ হয়নি!"
@@ -4178,8 +4190,8 @@ msgid "Create Convex Collision Sibling"
msgstr "কনভেকà§à¦¸ কলিশ়ন সহোদর তৈরি করà§à¦¨"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "পà§à¦°à¦¾à¦¨à§à¦¤à¦°à§‡à¦–া মেস তৈরি করà§à¦¨.."
+msgid "Create Outline Mesh..."
+msgstr "পà§à¦°à¦¾à¦¨à§à¦¤à¦°à§‡à¦–া মেস তৈরি করà§à¦¨..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
@@ -4323,7 +4335,7 @@ msgstr "কনফিগারেশন তৈরি করা হচà§à¦›à§‡...
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Calculating grid size..."
-msgstr "গà§à¦°à¦¿à¦¡ সাইজ হিসাব করা হচà§à¦›à§‡.."
+msgstr "গà§à¦°à¦¿à¦¡ সাইজ হিসাব করা হচà§à¦›à§‡..."
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
@@ -4333,7 +4345,7 @@ msgstr "লাইটের ওকটà§à¦°à§€ (octree) তৈরি করা à¦
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "অনà§à¦¬à¦¾à¦¦-সমà§à¦­à¦¬ শবà§à¦¦à¦®à¦¾à¦²à¦¾/বাকà§à¦¯-সমূহ.."
+msgstr "অনà§à¦¬à¦¾à¦¦-সমà§à¦­à¦¬ শবà§à¦¦à¦®à¦¾à¦²à¦¾/বাকà§à¦¯-সমূহ..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
@@ -4356,7 +4368,7 @@ msgstr "ওকটà§à¦°à§€ (octree) গঠনবিনà§à¦¯à¦¾à¦¸ তৈরি
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Creating polymesh..."
-msgstr "পà§à¦°à¦¾à¦¨à§à¦¤à¦°à§‡à¦–া মেস তৈরি করà§à¦¨.."
+msgstr "পà§à¦°à¦¾à¦¨à§à¦¤à¦°à§‡à¦–া মেস তৈরি করà§à¦¨..."
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
@@ -4395,8 +4407,8 @@ msgid "Error loading image:"
msgstr "ছবি লোডে সমসà§à¦¯à¦¾ হয়েছে:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "সà§à¦¬à¦šà§à¦›à¦¤à¦¾à¦¸à¦¹ কোনো পিকà§à¦¸à§‡à¦² নেই > ছবিতে ১২৮.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "সà§à¦¬à¦šà§à¦›à¦¤à¦¾à¦¸à¦¹ কোনো পিকà§à¦¸à§‡à¦² নেই > ছবিতে ১২৮..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4779,8 +4791,8 @@ msgid "Import Theme"
msgstr "থিম ইমà§à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "থিম à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨.."
+msgid "Save Theme As..."
+msgstr "থিম à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4880,8 +4892,8 @@ msgstr "ফেবরিট/পà§à¦°à¦¿à¦¯à¦¼-সমূহ অদলবদল/à¦
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "খà§à¦à¦œà§à¦¨.."
+msgid "Find..."
+msgstr "খà§à¦à¦œà§à¦¨..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -5084,28 +5096,28 @@ msgstr "পূরà§à¦¬à§‡à¦° বিরতিবিনà§à¦¦à§à¦¤à§‡ যান"
#: editor/plugins/script_text_editor.cpp
#, fuzzy
msgid "Convert To Uppercase"
-msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨.."
+msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨..."
#: editor/plugins/script_text_editor.cpp
#, fuzzy
msgid "Convert To Lowercase"
-msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨.."
+msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨..."
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
msgstr "পূরà§à¦¬à§‡ খà§à¦à¦œà§à¦¨"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "পà§à¦°à¦¤à¦¿à¦¸à§à¦¥à¦¾à¦ªà¦¨.."
+msgid "Replace..."
+msgstr "পà§à¦°à¦¤à¦¿à¦¸à§à¦¥à¦¾à¦ªà¦¨..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "ফাংশনে যান.."
+msgid "Goto Function..."
+msgstr "ফাংশনে যান..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "লাইনে যান.."
+msgid "Goto Line..."
+msgstr "লাইনে যান..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5579,12 +5591,8 @@ msgid "Transform"
msgstr "রà§à¦ªà¦¾à¦¨à§à¦¤à¦°"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "সà§à¦¨à§à¦¯à¦¾à¦ª কনফিগার করà§à¦¨.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "রà§à¦ªà¦¾à¦¨à§à¦¤à¦°à§‡à¦° à¦à¦° সংলাপ.."
+msgid "Transform Dialog..."
+msgstr "রà§à¦ªà¦¾à¦¨à§à¦¤à¦°à§‡à¦° à¦à¦° সংলাপ..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5843,8 +5851,8 @@ msgid "Remove All"
msgstr "অপসারণ করà§à¦¨"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "থিম à¦à¦¡à¦¿à¦Ÿ করà§à¦¨.."
+msgid "Edit theme..."
+msgstr "থিম à¦à¦¡à¦¿à¦Ÿ করà§à¦¨..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5892,6 +5900,16 @@ msgid "Checked Item"
msgstr "চিহà§à¦¨à¦¿à¦¤ আইটেম"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "বসà§à¦¤à§ যোগ করà§à¦¨"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "চিহà§à¦¨à¦¿à¦¤ আইটেম"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "আছে"
@@ -5904,7 +5922,8 @@ msgid "Options"
msgstr "সিদà§à¦§à¦¾à¦¨à§à¦¤à¦¸à¦®à§‚হ"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+#, fuzzy
+msgid "Has,Many,Options"
msgstr "আছে,অনেক,à¦à¦•াধিক,সিদà§à¦§à¦¾à¦¨à§à¦¤à¦¸à¦®à§‚হ!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -6034,7 +6053,7 @@ msgstr "দৃশà§à¦¯ হতে à¦à¦•তà§à¦°à¦¿à¦¤ করবেন?"
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet (টাইল-সেট).."
+msgstr "TileSet (টাইল-সেট)..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -6102,11 +6121,11 @@ msgstr ""
#: editor/project_export.cpp
#, fuzzy
msgid "Presets"
-msgstr "পà§à¦°à¦¿à¦¸à§‡à¦Ÿ.."
+msgstr "পà§à¦°à¦¿à¦¸à§‡à¦Ÿ..."
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "সংযোগ.."
+msgid "Add..."
+msgstr "সংযোগ..."
#: editor/project_export.cpp
msgid "Resources"
@@ -6215,6 +6234,11 @@ msgstr "পà§à¦°à¦•লà§à¦ª ইমà§à¦ªà§‹à¦°à§à¦Ÿ করা হয়েছে
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "পà§à¦°à¦•লà§à¦ªà§‡à¦° নাম:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "ফোলà§à¦¡à¦¾à¦° তৈরী করা সমà§à¦­à¦¬ হয়নি।"
@@ -6311,7 +6335,7 @@ msgstr "নামহীন পà§à¦°à¦•লà§à¦ª"
#: editor/project_manager.cpp
#, fuzzy
msgid "Can't open project"
-msgstr "সংযোগ.."
+msgstr "সংযোগ..."
#: editor/project_manager.cpp
msgid "Are you sure to open more than one project?"
@@ -6397,7 +6421,7 @@ msgstr "পà§à¦¨à¦°à¦¾à¦°à¦®à§à¦­ (সেঃ):"
#: editor/project_manager.cpp
#, fuzzy
msgid "Can't run project"
-msgstr "সংযোগ.."
+msgstr "সংযোগ..."
#: editor/project_manager.cpp
msgid ""
@@ -6422,8 +6446,10 @@ msgid "Mouse Button"
msgstr "মাউসের বোতাম"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "অকারà§à¦¯à¦•র অà§à¦¯à¦¾à¦•শন ('/' বা ':' ছাড়া কিছà§à¦‡ যাবে না)।"
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6450,8 +6476,8 @@ msgid "Control+"
msgstr "কনà§à¦Ÿà§à¦°à§‹à¦²+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "যেকোনো কী/চাবি চাপà§à¦¨.."
+msgid "Press a Key..."
+msgstr "যেকোনো কী/চাবি চাপà§à¦¨..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6574,11 +6600,6 @@ msgstr "ইনপà§à¦Ÿ অপসারণ করà§à¦¨"
#: editor/project_settings_editor.cpp
#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "নোডের সাথে সংযà§à¦•à§à¦¤ করà§à¦¨:"
-
-#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Already existing"
msgstr "সà§à¦¥à¦¾à§Ÿà§€à§Ÿà¦¤à¦¾ টগল করà§à¦¨"
@@ -6649,8 +6670,8 @@ msgid "Property:"
msgstr "পà§à¦°à¦ªà¦¾à¦°à§à¦Ÿà¦¿:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "ওভাররাইড.."
+msgid "Override For..."
+msgstr "ওভাররাইড..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6750,12 +6771,12 @@ msgid "Easing Out-In"
msgstr "গমন-আগমন সহজ/আলগা করন"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "ফাইল.."
+msgid "File..."
+msgstr "ফাইল..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "পথ.."
+msgid "Dir..."
+msgstr "পথ..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6787,7 +6808,7 @@ msgstr "ফাইলসিসà§à¦Ÿà§‡à¦®"
#: editor/property_editor.cpp
#, fuzzy
msgid "Convert To %s"
-msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨.."
+msgstr "à¦à¦¤à§‡ রূপানà§à¦¤à¦° করà§à¦¨..."
#: editor/property_editor.cpp
msgid "Error loading file: Not a resource!"
@@ -6935,8 +6956,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "ইনà§à¦¸à¦Ÿà§à¦¯à¦¾à¦¨à§à¦¸ করা দৃশà§à¦¯à§‡ à¦à¦Ÿà¦¿ করা সমà§à¦­à¦¬ হবে না।"
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "নতà§à¦¨ দৃশà§à¦¯ à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨.."
+msgid "Save New Scene As..."
+msgstr "নতà§à¦¨ দৃশà§à¦¯ à¦à¦‡à¦°à§‚পে সংরকà§à¦·à¦£ করà§à¦¨..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7479,12 +7500,12 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Platform"
-msgstr "পà§à¦²à¦¾à¦Ÿà¦«à¦°à§à¦®à§‡ পà§à¦°à¦¤à¦¿à¦²à¦¿à¦ªà¦¿ করà§à¦¨.."
+msgstr "পà§à¦²à¦¾à¦Ÿà¦«à¦°à§à¦®à§‡ পà§à¦°à¦¤à¦¿à¦²à¦¿à¦ªà¦¿ করà§à¦¨..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Dynamic Library"
-msgstr "MeshLibrary (মেস-লাইবà§à¦°à§‡à¦°à¦¿).."
+msgstr "MeshLibrary (মেস-লাইবà§à¦°à§‡à¦°à¦¿)..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
@@ -7498,7 +7519,7 @@ msgstr "জিডিনà§à¦¯à¦¾à¦Ÿà¦¿à¦­"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
msgid "Library"
-msgstr "MeshLibrary (মেস-লাইবà§à¦°à§‡à¦°à¦¿).."
+msgstr "MeshLibrary (মেস-লাইবà§à¦°à§‡à¦°à¦¿)..."
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
@@ -7692,6 +7713,10 @@ msgstr "সà§à¦¨à§à¦¯à¦¾à¦ª সেটিংস"
msgid "Pick Distance:"
msgstr "ইনà§à¦¸à¦Ÿà§à¦¯à¦¾à¦¨à§à¦¸:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
#, fuzzy
msgid "Generating solution..."
@@ -7748,6 +7773,10 @@ msgstr "নতà§à¦¨ পà§à¦°à¦•লà§à¦ª"
msgid "Warnings"
msgstr "সতরà§à¦•তা"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8411,12 +8440,22 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Path à¦à¦° দিক অবশà§à¦¯à¦‡ à¦à¦•টি কারà§à¦¯à¦•র Spatial নোডের à¦à¦° দিকে নিরà§à¦¦à§‡à¦¶ করাতে হবে।"
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"পà§à¦°à¦¤à¦¿ দৃশà§à¦¯à§‡ (অথবা ইনà§à¦¸à¦Ÿà§à¦¯à¦¾à¦¨à§à¦¸à¦¡ দৃশà§à¦¯à§‡à¦° সমà§à¦®à§‡à¦²à¦¨à§‡) সরà§à¦¬à§‹à¦šà§à¦š à¦à¦•টি দৃশà§à¦¯à¦®à¦¾à¦¨ WorldEnvironment "
"সমà§à¦­à¦¬à¥¤"
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8509,6 +8548,27 @@ msgid "Invalid font size."
msgstr "ফনà§à¦Ÿà§‡à¦° আকার অগà§à¦°à¦¹à¦¨à¦¯à§‹à¦—à§à¦¯à¥¤"
#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "পূরà§à¦¬à§‡à¦° টà§à¦¯à¦¾à¦¬"
+
+#~ msgid "Next"
+#~ msgstr "পরবরà§à¦¤à§€"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "অকারà§à¦¯à¦•র অà§à¦¯à¦¾à¦•শন ('/' বা ':' ছাড়া কিছà§à¦‡ যাবে না)।"
+
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "নোডের সাথে সংযà§à¦•à§à¦¤ করà§à¦¨:"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "টেমপà§à¦²à§‡à¦Ÿ à¦à¦° version.txt ফরমà§à¦¯à¦¾à¦Ÿ অগà§à¦°à¦¹à¦£à¦¯à§‹à¦—à§à¦¯à¥¤ Revision কোন কাংখিত আইডেনà§à¦Ÿà¦¿à¦«à¦¾à§Ÿà¦¾à¦° "
+#~ "নয়।"
+
+#, fuzzy
#~ msgid "Can't write file."
#~ msgstr "টাইলটি খà§à¦à¦œà§‡ পাওয়া যায়নি:"
@@ -8523,9 +8583,6 @@ msgstr "ফনà§à¦Ÿà§‡à¦° আকার অগà§à¦°à¦¹à¦¨à¦¯à§‹à¦—à§à¦¯à¥¤"
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "পà§à¦°à¦•লà§à¦ªà§‡à¦° পথে engine.cfg তৈরি করা সমà§à¦­à¦¬ হয়নি।"
-#~ msgid "Next"
-#~ msgstr "পরবরà§à¦¤à§€"
-
#~ msgid "Not found!"
#~ msgstr "খà§à¦à¦œà§‡ পাওয়া যায়নি!"
@@ -8667,8 +8724,8 @@ msgstr "ফনà§à¦Ÿà§‡à¦° আকার অগà§à¦°à¦¹à¦¨à¦¯à§‹à¦—à§à¦¯à¥¤"
#~ msgid "Exporting for %s"
#~ msgstr "%s à¦à¦° জনà§à¦¯ à¦à¦•à§à¦¸à¦ªà§‹à¦°à§à¦Ÿ (export) হচà§à¦›à§‡"
-#~ msgid "Setting Up.."
-#~ msgstr "সà§à¦¥à¦¾à¦ªà¦¿à¦¤/বিনà§à¦¯à¦¸à§à¦¤ হচà§à¦›à§‡.."
+#~ msgid "Setting Up..."
+#~ msgstr "সà§à¦¥à¦¾à¦ªà¦¿à¦¤/বিনà§à¦¯à¦¸à§à¦¤ হচà§à¦›à§‡..."
#~ msgid "Error loading scene."
#~ msgstr "দৃশà§à¦¯ লোডে সমসà§à¦¯à¦¾ হয়েছে।"
@@ -8722,8 +8779,8 @@ msgstr "ফনà§à¦Ÿà§‡à¦° আকার অগà§à¦°à¦¹à¦¨à¦¯à§‹à¦—à§à¦¯à¥¤"
#~ msgid "Info"
#~ msgstr "তথà§à¦¯"
-#~ msgid "Re-Import.."
-#~ msgstr "পà§à¦¨-ইমà§à¦ªà§‹à¦°à§à¦Ÿ.."
+#~ msgid "Re-Import..."
+#~ msgstr "পà§à¦¨-ইমà§à¦ªà§‹à¦°à§à¦Ÿ..."
#~ msgid "No bit masks to import!"
#~ msgstr "ইমà§à¦ªà§‹à¦°à§à¦Ÿ করার জনà§à¦¯ কোনো বিট মাসà§à¦• নেই!"
@@ -9120,14 +9177,14 @@ msgstr "ফনà§à¦Ÿà§‡à¦° আকার অগà§à¦°à¦¹à¦¨à¦¯à§‹à¦—à§à¦¯à¥¤"
#~ msgid "Zoom (%):"
#~ msgstr "জà§à¦®à§ (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "সà§à¦•েলেটন/কাঠাম.."
+#~ msgid "Skeleton..."
+#~ msgstr "সà§à¦•েলেটন/কাঠাম..."
#~ msgid "Zoom Reset"
#~ msgstr "জà§à¦®à§ পà§à¦¨:সà§à¦¥à¦¾à¦ªà¦¨ করà§à¦¨"
-#~ msgid "Zoom Set.."
-#~ msgstr "জà§à¦®à§ নিরà§à¦§à¦¾à¦°à¦£ করà§à¦¨.."
+#~ msgid "Zoom Set..."
+#~ msgstr "জà§à¦®à§ নিরà§à¦§à¦¾à¦°à¦£ করà§à¦¨..."
#~ msgid "Set a Value"
#~ msgstr "à¦à¦•টি মান নিরà§à¦§à¦¾à¦°à¦£ করà§à¦¨"
@@ -9592,8 +9649,8 @@ msgstr "ফনà§à¦Ÿà§‡à¦° আকার অগà§à¦°à¦¹à¦¨à¦¯à§‹à¦—à§à¦¯à¥¤"
#~ msgid "Export Project PCK"
#~ msgstr "পà§à¦°à¦•লà§à¦ªà§‡à¦° PCK à¦à¦•à§à¦¸à¦ªà§‹à¦°à§à¦Ÿ করà§à¦¨"
-#~ msgid "Export.."
-#~ msgstr "à¦à¦•à§à¦¸à¦ªà§‹à¦°à§à¦Ÿ.."
+#~ msgid "Export..."
+#~ msgstr "à¦à¦•à§à¦¸à¦ªà§‹à¦°à§à¦Ÿ..."
#~ msgid "Project Export"
#~ msgstr "à¦à¦•à§à¦¸à¦ªà§‹à¦°à§à¦Ÿ পà§à¦°à¦•লà§à¦ª"
diff --git a/editor/translations/ca.po b/editor/translations/ca.po
index 6b27845274..d2bffb0f84 100644
--- a/editor/translations/ca.po
+++ b/editor/translations/ca.po
@@ -2,14 +2,13 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# BennyBeat <bennybeat@gmail.com>, 2017.
+# Javier Ocampos <xavier.ocampos@gmail.com>, 2018.
# Roger Blanco Ribera <roger.blancoribera@gmail.com>, 2016-2018.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-24 02:50+0000\n"
+"PO-Revision-Date: 2018-06-08 03:41+0000\n"
"Last-Translator: Roger Blanco Ribera <roger.blancoribera@gmail.com>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/godot-engine/"
"godot/ca/>\n"
@@ -17,7 +16,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 2.19-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -498,8 +497,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Desconnecta '%s' de '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Connecta.."
+msgid "Connect..."
+msgstr "Connecta..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -919,11 +918,11 @@ msgid "Move Audio Bus"
msgstr "Mou el Bus d'Àudio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Anomena i Desa el Disseny del Bus d'Àudio..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "Ubicació del Nou Disseny..."
#: editor/editor_audio_buses.cpp
@@ -1065,12 +1064,12 @@ msgid "Updating Scene"
msgstr "Actualitzant l'Escena"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "Emmagatzemant canvis locals..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "S'està actualitzant l'escena.."
+msgid "Updating scene..."
+msgstr "S'està actualitzant l'escena..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1138,8 +1137,8 @@ msgid "Show In File Manager"
msgstr "Mostra en el Gestor de Fitxers"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nou Directori.."
+msgid "New Folder..."
+msgstr "Nou Directori..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1398,17 +1397,21 @@ msgstr "Neteja"
msgid "Clear Output"
msgstr "Buida la Sortida"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "L'exportació del projecte ha fallat amb el codi d'error %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Error en desar recurs!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Anomena i Desa el Recurs..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Vaja..."
#: editor/editor_node.cpp
@@ -1638,11 +1641,11 @@ msgid "Open Base Scene"
msgstr "Obre una Escena Base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "Obertura Ràpida d'Escenes..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "Obertura Ràpida d'Scripts..."
#: editor/editor_node.cpp
@@ -1654,7 +1657,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "Desar els canvis a '%s' abans de tancar?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "Anomena i Desa l'Escena..."
#: editor/editor_node.cpp
@@ -1707,7 +1710,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Aquesta acció no es pot desfer. N'esteu segur?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "Execució Ràpida de l'Escena..."
#: editor/editor_node.cpp
@@ -1868,7 +1871,7 @@ msgid "Previous tab"
msgstr "Pestanya Anterior"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Filtrat de Fitxers..."
#: editor/editor_node.cpp
@@ -1880,11 +1883,11 @@ msgid "New Scene"
msgstr "Nova Escena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Nova Escena heretada..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "Obre Escena..."
#: editor/editor_node.cpp
@@ -1904,15 +1907,15 @@ msgid "Open Recent"
msgstr "Obre Recent"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "Converteix a..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "Biblioteca de Models (MeshLibrary)..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2177,7 +2180,7 @@ msgid "Save the currently edited resource."
msgstr "Desa el recurs editat ara."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Anomena i Desa..."
#: editor/editor_node.cpp
@@ -2286,8 +2289,8 @@ msgid "Creating Mesh Previews"
msgstr "Creant Previsualitzacions de Malles"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatura.."
+msgid "Thumbnail..."
+msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2439,7 +2442,7 @@ msgid "(Current)"
msgstr "(Actual)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "S'estan buscant rèpliques..."
#: editor/export_template_manager.cpp
@@ -2455,14 +2458,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "El format de version.txt dins de les plantilles no és vàlid."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"El format de version.txt dins les plantilles no és vàlid. \"Revision\" no és "
-"un indentificador vàlid."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "No s'ha trobat cap version.txt dins les plantilles."
@@ -2494,7 +2489,7 @@ msgstr "No es pot resoldre."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't connect."
-msgstr "No es pot connectar.."
+msgstr "No es pot connectar..."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2525,7 +2520,7 @@ msgid "Error requesting url: "
msgstr "Error en la sol·licitud de l'url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "Connexió amb la Rèplica..."
#: editor/export_template_manager.cpp
@@ -2542,7 +2537,7 @@ msgstr "No es pot resoldre"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "Connexió en marxa..."
#: editor/export_template_manager.cpp
@@ -2555,7 +2550,7 @@ msgstr "Connectat"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "Sol·licitud en marxa..."
#: editor/export_template_manager.cpp
@@ -2689,11 +2684,11 @@ msgid "Collapse all"
msgstr "Col·lapsar tot"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Reanomena.."
+msgid "Rename..."
+msgstr "Reanomena..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Mou cap a..."
#: editor/filesystem_dock.cpp
@@ -2705,16 +2700,16 @@ msgid "Instance"
msgstr "Instància"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "Edita Dependències..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "Mostra Propietaris..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Duplica.."
+msgid "Duplicate..."
+msgstr "Duplica..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2739,7 +2734,7 @@ msgstr "Instancia les escenes seleccionades com a filles del node seleccionat."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr "Analitzant Fitxers..."
#: editor/filesystem_dock.cpp
@@ -2805,7 +2800,7 @@ msgid "Import Scene"
msgstr "Importa Escena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "Important Escena..."
#: editor/import/resource_importer_scene.cpp
@@ -2817,7 +2812,7 @@ msgid "Generating for Mesh: "
msgstr "S'està generant per a la Malla: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Executant Script Personalitzat..."
#: editor/import/resource_importer_scene.cpp
@@ -2833,7 +2828,7 @@ msgid "Error running post-import script:"
msgstr "Error en l'execució de l'Script de post-importació:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Desant..."
#: editor/import_dock.cpp
@@ -2853,8 +2848,8 @@ msgid "Import As:"
msgstr "Importar com a:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Configuració.."
+msgid "Preset..."
+msgstr "Configuració..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3272,7 +3267,7 @@ msgid "Transition Node"
msgstr "Node de Transició"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr "Importa animacions..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3280,7 +3275,7 @@ msgid "Edit Node Filters"
msgstr "Edita els filtres de Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Filtres..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3348,8 +3343,8 @@ msgid "Fetching:"
msgstr "Recollida:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "s'està resolent.."
+msgid "Resolving..."
+msgstr "s'està resolent..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3415,7 +3410,7 @@ msgid "Site:"
msgstr "Lloc:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Suport..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3614,6 +3609,7 @@ msgid "Use Rotation Snap"
msgstr "Rotació alineada"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Configura l'Alineament..."
@@ -3710,6 +3706,14 @@ msgid "Show Guides"
msgstr "Mostra les guies"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Mostra l'Origen"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Mostra el Viewport"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centra la Selecció"
@@ -3980,7 +3984,7 @@ msgstr "La Malla continguda no és del tipus ArrayMesh."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "UV Unwrap failed, mesh may not be manifold?"
-msgstr "No s'han pogut desembolcar les UV. Comproveu la topologia de la malla"
+msgstr "No s'han pogut desembolcar les UV. Comproveu la topologia de la malla."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "No mesh to debug."
@@ -3999,6 +4003,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "La Malla manca d'una superfície on delinear-hi els contorns!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "El tipus primitiu de Mesh no és PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "No es pot crear el contorn!"
@@ -4027,7 +4035,7 @@ msgid "Create Convex Collision Sibling"
msgstr "Crea col·lisions convexes entre nodes germans"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr "Crea una malla de contorn..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4232,7 +4240,7 @@ msgid "Error loading image:"
msgstr "Error en carregar la imatge:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr "Cap píxel amb transparència > 128 en la imatge..."
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4593,7 +4601,7 @@ msgid "Import Theme"
msgstr "Importa un Tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Desa el Tema com a..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4690,7 +4698,7 @@ msgstr "Panell d'Scripts"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "Cerca..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4900,15 +4908,15 @@ msgid "Find Previous"
msgstr "Cerca l'Anterior"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "Substitueix..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Vés a la Funció.."
+msgid "Goto Function..."
+msgstr "Vés a la Funció..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "Vés a la Línia..."
#: editor/plugins/script_text_editor.cpp
@@ -5362,11 +5370,7 @@ msgid "Transform"
msgstr "Transforma"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configura l'Alineament..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr "Diàleg de Transformació..."
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5619,7 +5623,7 @@ msgid "Remove All"
msgstr "Treu-los tots"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Edita el Tema..."
#: editor/plugins/theme_editor_plugin.cpp
@@ -5667,6 +5671,14 @@ msgid "Checked Item"
msgstr "Element validat"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Element de ràdio"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Element de ràdio validat"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Té"
@@ -5679,8 +5691,8 @@ msgid "Options"
msgstr "Opcions"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Tens,Moltes,Diverses,Opcions!"
+msgid "Has,Many,Options"
+msgstr "Té,Moltes,Opcions"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5872,7 +5884,7 @@ msgid "Presets"
msgstr "Configuracions prestablertes"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Afegeix..."
#: editor/project_export.cpp
@@ -5966,6 +5978,10 @@ msgid "Imported Project"
msgstr "Project importat"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "El nom del Projecte no és vàlid."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "No s'ha pogut crear el directori."
@@ -5982,11 +5998,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "El Camí del Projecte no és vàlid (S'ha produit algun canvi?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "No es pot editar el fitxer 'project.godot' en el camí del projecte."
+msgstr ""
+"No es pot carregar el fitxer 'project.godot' en el camí del projecte (error "
+"%d). Pot ser que falti o que estigui malmès."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6144,7 +6161,7 @@ msgid ""
"Would you like to explore the official example projects in the Asset Library?"
msgstr ""
"Encara no teniu cap projecte.\n"
-"Voleu explorar els projectes oficials d'exemple a la llibreria activa?"
+"Voleu explorar els projectes d'exemple oficials a la Biblioteca d'Actius?"
#: editor/project_settings_editor.cpp
msgid "Key "
@@ -6163,8 +6180,12 @@ msgid "Mouse Button"
msgstr "Botó del ratolí"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "L'Acció no és vàlida (no es pot utilitzar ' / ' o ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Nom d'acció no vàlid. No pot estar buit ni contenir '/', ':', '=', '\\' o "
+"'\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6191,8 +6212,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Premeu una Tecla.."
+msgid "Press a Key..."
+msgstr "Premeu una Tecla..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6307,10 +6328,6 @@ msgid "Delete Item"
msgstr "Esborra l'Element"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "No pot contenir '/' o ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Ja existeix"
@@ -6379,7 +6396,7 @@ msgid "Property:"
msgstr "Propietat:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "Substitutiu per a..."
#: editor/project_settings_editor.cpp
@@ -6475,11 +6492,11 @@ msgid "Easing Out-In"
msgstr "Esmorteeix Sortida-Entrada"
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr "Fitxer..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr "Directori..."
#: editor/property_editor.cpp
@@ -6652,7 +6669,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Aquesta operació no es pot dur a terme en escenes instanciadas."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Anomena i Desa la Nova Escena..."
#: editor/scene_tree_dock.cpp
@@ -7254,18 +7271,16 @@ msgid "Object can't provide a length."
msgstr "L'objecte no pot proporcionar una longitud."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Pestanya Següent"
+msgstr "Pla següent"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Pestanya Anterior"
+msgstr "Pla anterior"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Pla:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7371,6 +7386,10 @@ msgstr "Configuració del GridMap"
msgid "Pick Distance:"
msgstr "Trieu la distància:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "El nom de la classe no pot ser una paraula clau reservada"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "S'està generant la solució..."
@@ -7401,7 +7420,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Sobre el suport de C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7419,6 +7438,10 @@ msgstr "Munta el Projecte"
msgid "Warnings"
msgstr "Avisos"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Final de la traça de la pila d'excepció interna"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7972,11 +7995,11 @@ msgstr "El node ARVROrigin requreix un node Fill del tipus ARVRCamera"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Temps restant: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8075,12 +8098,24 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Cal que la propietat Camí assenyali cap a un node Spatial vàlid."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment necessita un recurs Ambiental."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Només es permet un sol WorldEnvironment per escena ( o conjunt d'escenes "
"instanciades)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Aquest WorldEnvironment s'ignora. Afegiu una càmera (per a escenes 3D) o "
+"configureu el Background Mode a Canvas (per a escenes 2D)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8178,6 +8213,26 @@ msgstr "Error carregant lletra."
msgid "Invalid font size."
msgstr "La mida de la lletra no és vàlida."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Pestanya Anterior"
+
+#~ msgid "Next"
+#~ msgstr "Següent"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "L'Acció no és vàlida (no es pot utilitzar ' / ' o ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "No pot contenir '/' o ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "El format de version.txt dins les plantilles no és vàlid. \"Revision\" no "
+#~ "és un indentificador vàlid."
+
#~ msgid "Can't write file."
#~ msgstr "No es pot escriure el fitxer."
@@ -8192,9 +8247,6 @@ msgstr "La mida de la lletra no és vàlida."
#~ msgstr ""
#~ "No es pot trobat el el fitxer 'project.godot' en el camí del projecte."
-#~ msgid "Next"
-#~ msgstr "Següent"
-
#~ msgid "Not found!"
#~ msgstr "No s'ha trobat!"
@@ -8327,8 +8379,8 @@ msgstr "La mida de la lletra no és vàlida."
#~ msgid "Exporting for %s"
#~ msgstr "Exportació per a %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Instal·lant.."
+#~ msgid "Setting Up..."
+#~ msgstr "Instal·lant..."
#~ msgid "Error loading scene."
#~ msgstr "No s'ha pogut carregar l'escena."
@@ -8385,7 +8437,7 @@ msgstr "La mida de la lletra no és vàlida."
#~ msgid "Info"
#~ msgstr "Informació"
-#~ msgid "Re-Import.."
+#~ msgid "Re-Import..."
#~ msgstr "ReImporta..."
#~ msgid "No bit masks to import!"
diff --git a/editor/translations/cs.po b/editor/translations/cs.po
index 453253e192..1066bbad94 100644
--- a/editor/translations/cs.po
+++ b/editor/translations/cs.po
@@ -6,6 +6,7 @@
# Fadex <vitekpaulik@gmail.com>, 2017.
# Jan 'spl!te' Kondelík <j.kondelik@centrum.cz>, 2016.
# Jiri Hysek <contact@jirihysek.com>, 2017.
+# Josef KuchaÅ™ <josef.kuchar267@gmail.com>, 2018.
# Luděk Novotný <gladosicek@gmail.com>, 2016, 2018.
# Martin Novák <maidx@seznam.cz>, 2017.
# zxey <r.hozak@seznam.cz>, 2018.
@@ -13,15 +14,15 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-24 12:07+0000\n"
-"Last-Translator: zxey <r.hozak@seznam.cz>\n"
+"PO-Revision-Date: 2018-05-21 12:36+0000\n"
+"Last-Translator: Josef KuchaÅ™ <josef.kuchar267@gmail.com>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/godot-engine/godot/"
"cs/>\n"
"Language: cs\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -32,9 +33,8 @@ msgid "All Selection"
msgstr "Všechny vybrané"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "Animace: změna hodnoty"
+msgstr "Animace: ZmÄ›nit Äas klíÄového snímku"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
@@ -45,9 +45,8 @@ msgid "Anim Change Transform"
msgstr "Animace: změna transformace"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Animace: změna hodnoty"
+msgstr "Animace: ZmÄ›nit hodnotu klíÄového snímku"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -92,7 +91,7 @@ msgstr "Animace: změna typu hodnot"
#: editor/animation_editor.cpp
#, fuzzy
msgid "Anim Track Change Wrap Mode"
-msgstr "ZmÄ›na režimu opakování animaÄní stopy"
+msgstr "Animace: ZmÄ›na režimu opakování animaÄní stopy"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
@@ -230,7 +229,7 @@ msgstr "Změnit opakování animace"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
-msgstr ""
+msgstr "Animace: VytvoÅ™it typovaný klíÄ"
#: editor/animation_editor.cpp
msgid "Anim Insert"
@@ -326,7 +325,7 @@ msgstr "Přechod"
#: editor/animation_editor.cpp
msgid "Scale Ratio:"
-msgstr "Poměr měřítka:"
+msgstr "Poměr zvětšení:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
@@ -504,8 +503,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Odpojit '%s' od '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Připojit.."
+msgid "Connect..."
+msgstr "Připojit..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -876,7 +875,7 @@ msgstr "Ztlumit"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
-msgstr ""
+msgstr "Obejít"
#: editor/editor_audio_buses.cpp
msgid "Bus options"
@@ -924,12 +923,12 @@ msgid "Move Audio Bus"
msgstr "Přesunout Audio Bus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Uložit rozložení Audio Busu jako.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Uložit rozložení Audio Busu jako..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Umístění pro nové rozložení.."
+msgid "Location for New Layout..."
+msgstr "Umístění pro nové rozložení..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1066,12 +1065,12 @@ msgid "Updating Scene"
msgstr "Aktualizuji scénu"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Ukládám lokální změny.."
+msgid "Storing local changes..."
+msgstr "Ukládám lokální změny..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Aktualizuji scénu.."
+msgid "Updating scene..."
+msgstr "Aktualizuji scénu..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1139,8 +1138,8 @@ msgid "Show In File Manager"
msgstr "Ukázat ve správci souborů"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nová složka.."
+msgid "New Folder..."
+msgstr "Nová složka..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1209,14 +1208,12 @@ msgid "Focus Path"
msgstr ""
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Move Favorite Up"
-msgstr "Přesunout oblíbenou položku o úroveň výš"
+msgstr "Přesunout oblíbenou položku nahoru"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Move Favorite Down"
-msgstr "Přesunout oblíbenou položku o úroveň níž"
+msgstr "Přesunout oblíbenou položku dolů"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Go to parent folder"
@@ -1245,7 +1242,7 @@ msgstr ""
#: editor/editor_file_system.cpp
msgid "(Re)Importing Assets"
-msgstr ""
+msgstr "(Re)Importování assetů"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -1401,18 +1398,22 @@ msgstr "VyÄistit"
msgid "Clear Output"
msgstr "Vymazat výstup"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Chápu.."
+msgid "I see..."
+msgstr "Chápu..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1618,12 +1619,12 @@ msgid "Open Base Scene"
msgstr "Otevřít základní scénu"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Rychlé otevření scény.."
+msgid "Quick Open Scene..."
+msgstr "Rychle otevřít scénu..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Rychlé otevření skriptu.."
+msgid "Quick Open Script..."
+msgstr "Rychlé otevření skriptu..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1634,8 +1635,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Uložit změny '%s' před zavřením?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Uložit scénu jako.."
+msgid "Save Scene As..."
+msgstr "Uložit scénu jako..."
#: editor/editor_node.cpp
msgid "No"
@@ -1686,7 +1687,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Tuto akci nelze vrátit zpÄ›t. PokraÄovat?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "Rychlé spuštění scény..."
#: editor/editor_node.cpp
@@ -1841,7 +1842,7 @@ msgid "Previous tab"
msgstr "Předchozí záložka"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Filtrovat soubory..."
#: editor/editor_node.cpp
@@ -1853,12 +1854,12 @@ msgid "New Scene"
msgstr "Nová scéna"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Nová odvozená scéna.."
+msgid "New Inherited Scene..."
+msgstr "Nová odvozená scéna..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Otevřít scénu.."
+msgid "Open Scene..."
+msgstr "Otevřít scénu..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1877,16 +1878,16 @@ msgid "Open Recent"
msgstr "Otevřít nedávné"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Konvertovat na.."
+msgid "Convert To..."
+msgstr "Konvertovat na..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2061,9 +2062,8 @@ msgid "Q&A"
msgstr "Q&A"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Issue Tracker"
-msgstr "Správa chyb"
+msgstr "Issue Tracker"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
msgid "Community"
@@ -2111,7 +2111,7 @@ msgstr "Přehrát vlastní scénu"
#: editor/editor_node.cpp
msgid "Play Custom Scene"
-msgstr "Přehrát vlastní scénu"
+msgstr "Spustit vlastní scénu"
#: editor/editor_node.cpp
msgid "Spins when the editor window repaints!"
@@ -2146,8 +2146,8 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Uložit jako.."
+msgid "Save As..."
+msgstr "Uložit jako..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2255,8 +2255,8 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Náhled.."
+msgid "Thumbnail..."
+msgstr "Náhled..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2300,14 +2300,12 @@ msgid "Average Time (sec)"
msgstr "PrůmÄ›rný Äas (sek.)"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Frame %"
-msgstr "% snímku"
+msgstr "Snímek %"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Physics Frame %"
-msgstr "% fyzikálního snímku"
+msgstr "Fyzikální snímek %"
#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
msgid "Time:"
@@ -2322,7 +2320,6 @@ msgid "Self"
msgstr ""
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Frame #:"
msgstr "Snímek Ä.:"
@@ -2412,7 +2409,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2428,13 +2425,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Neplatný formát version.txt uvnitř šablon."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Neplatný formát version.txt uvnitř šablon. Revize není platný identifikátor."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Nenalezena version.txt uvnitř šablon."
@@ -2495,9 +2485,8 @@ msgid "Error requesting url: "
msgstr "Chyba požadavku o url: "
#: editor/export_template_manager.cpp
-#, fuzzy
-msgid "Connecting to Mirror.."
-msgstr "Připojuji se k mirroru.."
+msgid "Connecting to Mirror..."
+msgstr "Připojuji se k zrcadlu..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2513,22 +2502,21 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Připojuji.."
+msgid "Connecting..."
+msgstr "Připojuji..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
msgstr "Nelze se připojit"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Connected"
msgstr "Připojeno"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Posílá se žádost.."
+msgid "Requesting..."
+msgstr "Posílá se žádost..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2656,44 +2644,43 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid "Collapse all"
-msgstr ""
+msgstr "Sbalit vše"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr ""
+msgid "Rename..."
+msgstr "Přejmenovat..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr ""
+msgid "Move To..."
+msgstr "Přesunout do..."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Open Scene(s)"
-msgstr "Otevřít scénu"
+msgstr "Otevřít scénu(y)"
#: editor/filesystem_dock.cpp
msgid "Instance"
-msgstr ""
+msgstr "Instance"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr ""
+msgid "Edit Dependencies..."
+msgstr "Upravit závislosti..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr ""
+msgid "View Owners..."
+msgstr "Zobrazit vlastníky..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Duplikovat.."
+msgid "Duplicate..."
+msgstr "Duplikovat..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
-msgstr ""
+msgstr "Předchozí adresář"
#: editor/filesystem_dock.cpp
msgid "Next Directory"
-msgstr ""
+msgstr "Následující adresář"
#: editor/filesystem_dock.cpp
msgid "Re-Scan Filesystem"
@@ -2710,7 +2697,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2776,7 +2763,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2788,7 +2775,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2804,7 +2791,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2824,8 +2811,8 @@ msgid "Import As:"
msgstr "Importovat jako:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Preset.."
+msgid "Preset..."
+msgstr "Předvolba..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -2881,7 +2868,6 @@ msgid ""
msgstr ""
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Delete points"
msgstr "Odstranit body"
@@ -2986,7 +2972,7 @@ msgstr "Přehrát vybranou animaci od vybrané pozice. (D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation position (in seconds)."
-msgstr ""
+msgstr "Pozice animace (v sekundách)."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Scale animation playback globally for the node."
@@ -3037,17 +3023,14 @@ msgid "Enable Onion Skinning"
msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Directions"
msgstr "Směry"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Past"
-msgstr "Minulý"
+msgstr "Předcházející"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Future"
msgstr "Budoucí"
@@ -3162,7 +3145,6 @@ msgid "Amount:"
msgstr "Množství:"
#: editor/plugins/animation_tree_editor_plugin.cpp
-#, fuzzy
msgid "Blend:"
msgstr "Prolínání:"
@@ -3244,21 +3226,20 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importovat animace.."
+msgid "Import Animations..."
+msgstr "Importovat animace..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filtry.."
+msgid "Filters..."
+msgstr "Filtry..."
#: editor/plugins/animation_tree_editor_plugin.cpp
-#, fuzzy
msgid "AnimationTree"
-msgstr "Přiblížení animace."
+msgstr "Strom animací"
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
@@ -3322,8 +3303,8 @@ msgid "Fetching:"
msgstr "Stahuji:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Zjišťování.."
+msgid "Resolving..."
+msgstr "Zjišťování..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3389,8 +3370,8 @@ msgid "Site:"
msgstr "Web:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Podpora.."
+msgid "Support..."
+msgstr "Podpora..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3438,28 +3419,28 @@ msgstr "Nastavení přichycování"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid Offset:"
-msgstr ""
+msgstr "Offset mřížky:"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid Step:"
-msgstr ""
+msgstr "Krok mřížky:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation Offset:"
-msgstr ""
+msgstr "Offset rotace:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation Step:"
-msgstr ""
+msgstr "Krok rotace:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Pivot"
-msgstr ""
+msgstr "Přemístit střed"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Action"
-msgstr ""
+msgstr "Přesunout akci"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move vertical guide"
@@ -3490,23 +3471,20 @@ msgid "Create new horizontal and vertical guides"
msgstr "Vytvořit nové vodorovné a svislé vodítka"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Edit IK Chain"
msgstr "Upravit IK řetězec"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Edit CanvasItem"
-msgstr ""
+msgstr "Upravit CanvasItem"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Anchors only"
msgstr "Pouze kotvy"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Change Anchors and Margins"
-msgstr "Upravit kotvy a okraje"
+msgstr "Změnit kotvy a okraje"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change Anchors"
@@ -3522,19 +3500,20 @@ msgstr "Režim výběru"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Drag: Rotate"
-msgstr ""
+msgstr "Táhnutí: OtoÄit"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+Drag: Move"
-msgstr ""
+msgstr "Alt+Táhnutí: Přemístit"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving)."
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Alt+RMB: Depth list selection"
-msgstr ""
+msgstr "Alt+Pravé tlaÄíko myÅ¡i:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Mode"
@@ -3572,7 +3551,6 @@ msgid "Snapping options"
msgstr "Možnosti přichytávání"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to grid"
msgstr "Přichytit k mřížce"
@@ -3581,6 +3559,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Nastavení přichytávání..."
@@ -3594,11 +3573,11 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Smart snapping"
-msgstr ""
+msgstr "Chytré přichytávání"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to parent"
-msgstr ""
+msgstr "PÅ™ichytit k rodiÄovi"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node anchor"
@@ -3614,7 +3593,7 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to guides"
-msgstr ""
+msgstr "Přichytit k vodítkům"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3636,15 +3615,15 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Make Bones"
-msgstr ""
+msgstr "Vytvořit kosti"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Clear Bones"
-msgstr ""
+msgstr "Vymazat kosti"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Bones"
-msgstr ""
+msgstr "Zobrazit kosti"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Make IK Chain"
@@ -3665,9 +3644,8 @@ msgid "Show Grid"
msgstr "Zobrazit mřížku"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Show Helpers"
-msgstr "Zobrazit pomocné"
+msgstr "Zobrazit pomocníky"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Rulers"
@@ -3678,25 +3656,31 @@ msgid "Show Guides"
msgstr "Zobrazit vodítka"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Zobrazit poÄátek"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
+msgid "Show Viewport"
+msgstr "Zobrazit pomocné"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Vycentrovat výběr"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Frame Selection"
-msgstr ""
+msgstr "Výběr snímku"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Layout"
msgstr "Rozložení"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert Keys"
msgstr "Vložit klíÄe"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Insert Key"
msgstr "Vložit klíÄ"
@@ -3717,9 +3701,8 @@ msgid "Drag pivot from mouse position"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Set pivot at mouse position"
-msgstr "Odstranit signál"
+msgstr "Nastavit střed na pozici myši"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Multiply grid step by 2"
@@ -3748,7 +3731,7 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Create Node"
-msgstr ""
+msgstr "Vytvořit uzel"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -3767,7 +3750,7 @@ msgstr ""
#: editor/plugins/collision_polygon_editor_plugin.cpp
msgid "Create Poly3D"
-msgstr ""
+msgstr "Vytvořit Poly3D"
#: editor/plugins/collision_shape_2d_editor_plugin.cpp
msgid "Set Handle"
@@ -3775,17 +3758,17 @@ msgstr ""
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Remove item %d?"
-msgstr ""
+msgstr "Odstranit %d?"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Add Item"
-msgstr ""
+msgstr "Přidat položku"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Remove Selected Item"
-msgstr ""
+msgstr "Odstranit vybranou položku"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import from Scene"
@@ -3797,11 +3780,11 @@ msgstr "Aktualizovat ze scény"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat0"
-msgstr ""
+msgstr "Flat0"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat1"
-msgstr ""
+msgstr "Flat1"
#: editor/plugins/curve_editor_plugin.cpp
#, fuzzy
@@ -3876,7 +3859,7 @@ msgstr ""
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item %d"
-msgstr ""
+msgstr "Položka %d"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Items"
@@ -3884,17 +3867,19 @@ msgstr "Položky"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item List Editor"
-msgstr ""
+msgstr "Editor seznamu položek"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid ""
"No OccluderPolygon2D resource on this node.\n"
"Create and assign one?"
msgstr ""
+"Na tomto uzlu není žádný OccluderPolygon2D.\n"
+"Vytvořit a přiřadit k tomuto uzlu?"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Occluder Polygon"
-msgstr ""
+msgstr "Vytvořit Occluder Polygon"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create a new polygon from scratch."
@@ -3930,19 +3915,19 @@ msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "This doesn't work on scene root!"
-msgstr ""
+msgstr "Toto v kořenu scény nefunguje!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Shape"
-msgstr ""
+msgstr "Vytvořit Trimesh Shape"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Shape"
-msgstr ""
+msgstr "Vytvořit Convex Shape"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Navigation Mesh"
-msgstr ""
+msgstr "Vytvořit Navigation Mesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Contained Mesh is not of type ArrayMesh."
@@ -3969,6 +3954,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Mesh némá povrch z jakého vytvořit obrysy!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Nelze vytvořit obrys!"
@@ -3997,7 +3986,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4009,7 +3998,6 @@ msgid "View UV2"
msgstr "Zobrazit UV2"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "Unwrap UV2 for Lightmap/AO"
msgstr "Rozbalit UV2 pro Lightmapu/AO"
@@ -4092,15 +4080,15 @@ msgstr ""
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "X-Axis"
-msgstr ""
+msgstr "Osa X"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Y-Axis"
-msgstr ""
+msgstr "Osa Y"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Z-Axis"
-msgstr ""
+msgstr "Osa Z"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh Up Axis:"
@@ -4116,11 +4104,11 @@ msgstr ""
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Random Scale:"
-msgstr ""
+msgstr "Náhodné měřítko:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate"
-msgstr ""
+msgstr "Naplnit"
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Bake!"
@@ -4204,7 +4192,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4267,7 +4255,7 @@ msgstr ""
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate AABB"
-msgstr ""
+msgstr "Vygenerovat AABB"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Mesh"
@@ -4324,7 +4312,7 @@ msgstr ""
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Point in Curve"
-msgstr ""
+msgstr "Přesunout bod v křivce"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move In-Control in Curve"
@@ -4337,17 +4325,18 @@ msgstr ""
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Select Points"
-msgstr ""
+msgstr "Vybrat body"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
+#, fuzzy
msgid "Shift+Drag: Select Control Points"
-msgstr ""
+msgstr "Shift+Táhnutí:"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Click: Add Point"
-msgstr ""
+msgstr "Kliknutí: Přidat bod"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
@@ -4371,16 +4360,16 @@ msgstr ""
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Delete Point"
-msgstr ""
+msgstr "Odstranit bod"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Close Curve"
-msgstr ""
+msgstr "Uzavřít křivku"
#: editor/plugins/path_editor_plugin.cpp
msgid "Curve Point #"
-msgstr ""
+msgstr "Bod křivky #"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
@@ -4388,9 +4377,8 @@ msgid "Set Curve Point Position"
msgstr "Odstranit signál"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve In Position"
-msgstr "Odstranit signál"
+msgstr "Nastavit křivku na pozici"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
@@ -4399,11 +4387,11 @@ msgstr "Odstranit signál"
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Path"
-msgstr ""
+msgstr "Rozdělit cestu"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove Path Point"
-msgstr ""
+msgstr "Odstranit bod cesty"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
@@ -4420,7 +4408,7 @@ msgstr "Vytvořit UV mapu"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Transform UV Map"
-msgstr ""
+msgstr "Transformovat UV mapu"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon 2D UV Editor"
@@ -4432,16 +4420,15 @@ msgstr "Přesunout bod"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Ctrl: Rotate"
-msgstr ""
+msgstr "Ctrl: OtoÄit"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift: Move All"
msgstr "Shift: Přesunout vše"
#: editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Shift+Ctrl: Scale"
-msgstr "Shift+Ctrl: Zvětšení"
+msgstr "Shift+Ctrl: Změnit měřítko"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Polygon"
@@ -4453,7 +4440,7 @@ msgstr "OtoÄit polygon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Scale Polygon"
-msgstr ""
+msgstr "Změnit měřítko mnohoúhelníku"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4512,18 +4499,18 @@ msgstr "Schránka zdroje je prázdná!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
msgid "Open in Editor"
-msgstr ""
+msgstr "Otevřít v editoru"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
msgid "Instance:"
-msgstr ""
+msgstr "Instance:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
msgid "Type:"
-msgstr ""
+msgstr "Typ:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
@@ -4570,13 +4557,12 @@ msgid "Import Theme"
msgstr "Importovat motiv"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Uložit motiv jako.."
+msgid "Save Theme As..."
+msgstr "Uložit motiv jako..."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid " Class Reference"
-msgstr " ReferenÄní třídy"
+msgstr " Reference třídy"
#: editor/plugins/script_editor_plugin.cpp
msgid "Sort"
@@ -4616,12 +4602,11 @@ msgstr "Uložit vše"
#: editor/plugins/script_editor_plugin.cpp
msgid "Soft Reload Script"
-msgstr ""
+msgstr "Lehký restart skriptu"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Copy Script Path"
-msgstr "Zkopírovat uzly"
+msgstr "Zkopírovat cestu ke skriptu"
#: editor/plugins/script_editor_plugin.cpp
msgid "Show In File System"
@@ -4669,8 +4654,8 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Najít.."
+msgid "Find..."
+msgstr "Najít..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4688,7 +4673,7 @@ msgstr "Vstoupit"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Break"
-msgstr ""
+msgstr "Přerušit"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
#: editor/script_editor_debugger.cpp
@@ -4697,7 +4682,7 @@ msgstr "PokraÄovat"
#: editor/plugins/script_editor_plugin.cpp
msgid "Keep Debugger Open"
-msgstr ""
+msgstr "Nechat ladící program otevřený"
#: editor/plugins/script_editor_plugin.cpp
msgid "Debug with external editor"
@@ -4810,12 +4795,11 @@ msgstr "Odsadit zprava"
#: editor/plugins/script_text_editor.cpp
msgid "Toggle Comment"
-msgstr ""
+msgstr "Přepnout komentář"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Fold/Unfold Line"
-msgstr "Běž na řádek"
+msgstr "Složit/Rozložit řádek"
#: editor/plugins/script_text_editor.cpp
msgid "Fold All Lines"
@@ -4879,16 +4863,16 @@ msgid "Find Previous"
msgstr "Najít předchozí"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Nahradit.."
+msgid "Replace..."
+msgstr "Nahradit..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Přejít na funkci.."
+msgid "Goto Function..."
+msgstr "Přejít na funkci..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Přejít na řádek.."
+msgid "Goto Line..."
+msgstr "Přejít na řádek..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -4936,7 +4920,7 @@ msgstr "Změnit skalární funkci"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Function"
-msgstr ""
+msgstr "Změnit vektorovou funkci"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Uniform"
@@ -5032,19 +5016,19 @@ msgstr "Perspektivní"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Aborted."
-msgstr ""
+msgstr "Transformace zrušena."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "X-Axis Transform."
-msgstr ""
+msgstr "Změnit osu X."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Y-Axis Transform."
-msgstr ""
+msgstr "Změnit osu Y."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Z-Axis Transform."
-msgstr ""
+msgstr "Změnit osu Z."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Plane Transform."
@@ -5052,7 +5036,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scaling: "
-msgstr ""
+msgstr "Škálování: "
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
@@ -5069,7 +5053,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Animation Key Inserted."
-msgstr ""
+msgstr "AnimaÄní klÃ­Ä vložen."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Objects Drawn"
@@ -5092,9 +5076,8 @@ msgid "Draw Calls"
msgstr "Vykreslovací volání"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Vertices"
-msgstr "Vertexy"
+msgstr "Vrcholy"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "FPS"
@@ -5177,9 +5160,8 @@ msgid "Display Unshaded"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View Environment"
-msgstr "Zobrazení prostředí"
+msgstr "Zobrazit prostředí"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Gizmos"
@@ -5236,7 +5218,7 @@ msgstr "Rychlost volného pohledu"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "XForm Dialog"
-msgstr ""
+msgstr "XForm Dialog"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Select Mode (Q)"
@@ -5248,6 +5230,9 @@ msgid ""
"Alt+Drag: Move\n"
"Alt+RMB: Depth list selection"
msgstr ""
+"Táhnutí: OtoÄit\n"
+"Alt+Táhnutí: Přemístit\n"
+"Alt+Pravé tlaÄíko myÅ¡i: VýbÄ›r seznamu hloubky"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Move Mode (W)"
@@ -5303,19 +5288,19 @@ msgstr "Přepnout perspektivní/ortogonální pohled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Insert Animation Key"
-msgstr ""
+msgstr "Vložit animaÄní klíÄ"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Focus Origin"
-msgstr ""
+msgstr "Zaměřit poÄátek"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Focus Selection"
-msgstr ""
+msgstr "Zaměřit výběr"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Align Selection With View"
-msgstr ""
+msgstr "Zarovnat výběr s pohledem"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Tool Select"
@@ -5342,44 +5327,40 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Nastavit přichycení.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
-msgstr ""
+msgstr "1 výřez"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports"
-msgstr ""
+msgstr "2 výřezy"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports (Alt)"
-msgstr ""
+msgstr "2 výřezy (Alt)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "3 Viewports"
-msgstr ""
+msgstr "3 výřezy"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "3 Viewports (Alt)"
-msgstr ""
+msgstr "3 výřezy (Alt)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "4 Viewports"
-msgstr ""
+msgstr "4 výřezy"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Origin"
-msgstr ""
+msgstr "Zobrazit poÄátek"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Grid"
-msgstr ""
+msgstr "Zobrazit mřížku"
#: editor/plugins/spatial_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
@@ -5433,11 +5414,11 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate (deg.):"
-msgstr ""
+msgstr "OtoÄit (stupnÄ›):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale (ratio):"
-msgstr ""
+msgstr "Změnit měřítko (poměr):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Type"
@@ -5445,11 +5426,11 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Pre"
-msgstr ""
+msgstr "Před"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Post"
-msgstr ""
+msgstr "Po"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "ERROR: Couldn't load frame resource!"
@@ -5457,7 +5438,7 @@ msgstr ""
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Frame"
-msgstr ""
+msgstr "Přidat snímek"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Resource clipboard is empty or not a texture!"
@@ -5465,7 +5446,7 @@ msgstr ""
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Paste Frame"
-msgstr ""
+msgstr "Vložit snímek"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Empty"
@@ -5477,27 +5458,27 @@ msgstr ""
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Change Animation FPS"
-msgstr ""
+msgstr "Změnit FPS animace"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "(empty)"
-msgstr ""
+msgstr "(prázdný)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animations"
-msgstr ""
+msgstr "Animace"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Speed (FPS):"
-msgstr ""
+msgstr "Rychlost (FPS):"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Loop"
-msgstr ""
+msgstr "SmyÄka"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animation Frames"
-msgstr ""
+msgstr "Snímky animace"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Insert Empty (Before)"
@@ -5514,7 +5495,7 @@ msgstr "Zkopírovat uzly"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Move (After)"
-msgstr ""
+msgstr "Přemístit (za)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "SpriteFrames"
@@ -5538,7 +5519,7 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "<None>"
-msgstr ""
+msgstr "<Žádné>"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Pixel Snap"
@@ -5555,25 +5536,25 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Offset:"
-msgstr ""
+msgstr "Offset:"
#: editor/plugins/texture_region_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Step:"
-msgstr ""
+msgstr "Krok:"
#: editor/plugins/texture_region_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Separation:"
-msgstr ""
+msgstr "Oddělení:"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Texture Region"
-msgstr ""
+msgstr "Oblast textury"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Texture Region Editor"
-msgstr ""
+msgstr "Editor oblasti textury"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Can't save theme to file:"
@@ -5581,29 +5562,28 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add All Items"
-msgstr ""
+msgstr "Přidat všechny položky"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add All"
-msgstr ""
+msgstr "Přidat vše"
#: editor/plugins/theme_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Remove Item"
-msgstr ""
+msgstr "Odstranit položku"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove All Items"
-msgstr "Odstranit výběr"
+msgstr "Odstranit všechny položky"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Remove All"
msgstr "Odebrat vše"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr ""
+msgid "Edit theme..."
+msgstr "Editovat téma..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5611,15 +5591,15 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add Class Items"
-msgstr ""
+msgstr "Přidat položky třídy"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Remove Class Items"
-msgstr ""
+msgstr "Odstranit položky třídy"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create Empty Template"
-msgstr ""
+msgstr "Vytvořit prázdnou šablonu"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create Empty Editor Template"
@@ -5631,25 +5611,34 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
-msgstr ""
+msgstr "CheckBox Radio1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio2"
-msgstr ""
+msgstr "CheckBox Radio2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Item"
-msgstr ""
+msgstr "Položka"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "Check Item"
-msgstr ""
+msgstr "Zkontrolovat položku"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5659,61 +5648,60 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
msgid "Options"
-msgstr ""
+msgstr "Možnosti"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "Možnosti"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
-msgstr ""
+msgstr "Tab 1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 2"
-msgstr ""
+msgstr "Tab 2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 3"
-msgstr ""
+msgstr "Tab 3"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Data Type:"
-msgstr ""
+msgstr "Datový typ:"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Icon"
-msgstr ""
+msgstr "Ikona"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Style"
-msgstr ""
+msgstr "Styl"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Font"
-msgstr ""
+msgstr "Font"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Color"
-msgstr ""
+msgstr "Barva"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme"
msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Erase Selection"
-msgstr "Změnit měřítko výběru"
+msgstr "Vymazat oznaÄené"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint TileMap"
msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Line Draw"
-msgstr "Lineární"
+msgstr "Nakreslit Äáru"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rectangle Paint"
@@ -5741,11 +5729,11 @@ msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror X"
-msgstr ""
+msgstr "Zrcadlit X"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror Y"
-msgstr ""
+msgstr "Zrcadlit Y"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint Tile"
@@ -5757,19 +5745,19 @@ msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 0 degrees"
-msgstr ""
+msgstr "OtoÄit o 0 stupňů"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 90 degrees"
-msgstr ""
+msgstr "OtoÄit o 90 stupňů"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 180 degrees"
-msgstr ""
+msgstr "OtoÄit o 180 stupňů"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 270 degrees"
-msgstr ""
+msgstr "OtoÄit o 270 stupňů"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Could not find tile:"
@@ -5777,15 +5765,15 @@ msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Item name or ID:"
-msgstr ""
+msgstr "Název položky nebo ID:"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from scene?"
-msgstr ""
+msgstr "Vytvořit ze scény?"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Merge from scene?"
-msgstr ""
+msgstr "SlouÄit ze scény?"
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
@@ -5794,15 +5782,15 @@ msgstr "Soubor:"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
-msgstr ""
+msgstr "Vytvořit ze scény"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Merge from Scene"
-msgstr ""
+msgstr "SlouÄit ze scény"
#: editor/plugins/tile_set_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Error"
-msgstr ""
+msgstr "Chyba"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Autotiles"
@@ -5845,7 +5833,7 @@ msgstr "Odstranit"
#: editor/project_export.cpp
msgid "Delete preset '%s'?"
-msgstr "Odstranit preset '%s'?"
+msgstr "Odstranit předvolbu '%s'?"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing/corrupted: "
@@ -5853,35 +5841,35 @@ msgstr "Exportní šablony pro tuto platformu chybí nebo jsou poškozené: "
#: editor/project_export.cpp
msgid "Presets"
-msgstr ""
+msgstr "Předvolby"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr ""
+msgid "Add..."
+msgstr "Přidat..."
#: editor/project_export.cpp
msgid "Resources"
-msgstr ""
+msgstr "Zdroje"
#: editor/project_export.cpp
msgid "Export all resources in the project"
-msgstr ""
+msgstr "Exportovat vÄechny zdroje tohoto projektu"
#: editor/project_export.cpp
msgid "Export selected scenes (and dependencies)"
-msgstr ""
+msgstr "Exportovat vybrané scény (a závislosti)"
#: editor/project_export.cpp
msgid "Export selected resources (and dependencies)"
-msgstr ""
+msgstr "Exportovat vybrané zdroje (a závislosti)"
#: editor/project_export.cpp
msgid "Export Mode:"
-msgstr ""
+msgstr "Expertní režim:"
#: editor/project_export.cpp
msgid "Resources to export:"
-msgstr ""
+msgstr "Zdroje k exportu:"
#: editor/project_export.cpp
msgid ""
@@ -5947,6 +5935,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Jméno projektu:"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Nelze vytvořit složku."
@@ -5994,11 +5987,11 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Import & Edit"
-msgstr ""
+msgstr "Importovat a upravit"
#: editor/project_manager.cpp
msgid "Create New Project"
-msgstr ""
+msgstr "Vytvořit nový projekt"
#: editor/project_manager.cpp
msgid "Create & Edit"
@@ -6006,7 +5999,7 @@ msgstr "Vytvořit a editovat"
#: editor/project_manager.cpp
msgid "Install Project:"
-msgstr ""
+msgstr "Instalovat projekt:"
#: editor/project_manager.cpp
msgid "Install & Edit"
@@ -6014,7 +6007,7 @@ msgstr "Instalovat a editovat"
#: editor/project_manager.cpp
msgid "Project Name:"
-msgstr ""
+msgstr "Jméno projektu:"
#: editor/project_manager.cpp
msgid "Create folder"
@@ -6022,15 +6015,15 @@ msgstr "Vytvořit složku"
#: editor/project_manager.cpp
msgid "Project Path:"
-msgstr ""
+msgstr "Cesta k projektu:"
#: editor/project_manager.cpp
msgid "Browse"
-msgstr ""
+msgstr "Procházet"
#: editor/project_manager.cpp
msgid "Unnamed Project"
-msgstr ""
+msgstr "Nepojmenovaný projekt"
#: editor/project_manager.cpp
msgid "Can't open project"
@@ -6038,7 +6031,7 @@ msgstr "Nelze otevřít projekt"
#: editor/project_manager.cpp
msgid "Are you sure to open more than one project?"
-msgstr ""
+msgstr "Jste si jisti, že chcete otevřit více než jeden projekt?"
#: editor/project_manager.cpp
msgid ""
@@ -6055,11 +6048,11 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Are you sure to run more than one project?"
-msgstr ""
+msgstr "Jste si jisti, že chcete spustit více než jeden projekt?"
#: editor/project_manager.cpp
msgid "Remove project from the list? (Folder contents will not be modified)"
-msgstr ""
+msgstr "Odstranit projekt ze seznamu? (Obsah složky zůstane nedotÄen)"
#: editor/project_manager.cpp
msgid ""
@@ -6083,15 +6076,15 @@ msgstr "Seznam projektů"
#: editor/project_manager.cpp
msgid "Scan"
-msgstr ""
+msgstr "Skenovat"
#: editor/project_manager.cpp
msgid "Select a Folder to Scan"
-msgstr ""
+msgstr "Vyberte složku pro skenování"
#: editor/project_manager.cpp
msgid "New Project"
-msgstr ""
+msgstr "Nový projekt"
#: editor/project_manager.cpp
msgid "Templates"
@@ -6099,11 +6092,11 @@ msgstr "Å ablony"
#: editor/project_manager.cpp
msgid "Exit"
-msgstr ""
+msgstr "UkonÄit"
#: editor/project_manager.cpp
msgid "Restart Now"
-msgstr ""
+msgstr "Restartovat nyní"
#: editor/project_manager.cpp
msgid "Can't run project"
@@ -6129,15 +6122,20 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Mouse Button"
-msgstr ""
+msgstr "TlaÄítko myÅ¡i"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+#, fuzzy
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
+"Neplatné jméno akce. Nesmí být prázdné nebo obsahovat '/', ':', '=', '\\' "
+"nebo '\"'"
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
-msgstr ""
+msgstr "Akce '%s' již existuje!"
#: editor/project_settings_editor.cpp
msgid "Rename Input Action Event"
@@ -6157,51 +6155,51 @@ msgstr "Alt+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "Control+"
-msgstr ""
+msgstr "Ctrl+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr ""
+msgid "Press a Key..."
+msgstr "Stiskněte klávesu..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
-msgstr ""
+msgstr "Index tlaÄítka myÅ¡i:"
#: editor/project_settings_editor.cpp
msgid "Left Button"
-msgstr ""
+msgstr "Levé tlaÄítko"
#: editor/project_settings_editor.cpp
msgid "Right Button"
-msgstr ""
+msgstr "Pravé tlaÄítko"
#: editor/project_settings_editor.cpp
msgid "Middle Button"
-msgstr ""
+msgstr "ProstÅ™ední tlaÄítko"
#: editor/project_settings_editor.cpp
msgid "Wheel Up Button"
-msgstr ""
+msgstr "KoleÄko nahoru"
#: editor/project_settings_editor.cpp
msgid "Wheel Down Button"
-msgstr ""
+msgstr "KoleÄko dolů"
#: editor/project_settings_editor.cpp
msgid "Button 6"
-msgstr ""
+msgstr "TlaÄítko Ä. 6"
#: editor/project_settings_editor.cpp
msgid "Button 7"
-msgstr ""
+msgstr "TlaÄítko Ä. 7"
#: editor/project_settings_editor.cpp
msgid "Button 8"
-msgstr ""
+msgstr "TlaÄítko Ä. 8"
#: editor/project_settings_editor.cpp
msgid "Button 9"
-msgstr ""
+msgstr "TlaÄítko Ä. 9"
#: editor/project_settings_editor.cpp
msgid "Joypad Axis Index:"
@@ -6226,7 +6224,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Add Event"
-msgstr ""
+msgstr "Přidat akci"
#: editor/project_settings_editor.cpp
msgid "Device"
@@ -6266,7 +6264,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "No property '%s' exists."
-msgstr ""
+msgstr "Vlastnost '%s' neexistuje."
#: editor/project_settings_editor.cpp
msgid "Setting '%s' is internal, and it can't be deleted."
@@ -6277,12 +6275,8 @@ msgid "Delete Item"
msgstr "Odstranit položku"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Nesmí obsaovat '/' nebo ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
-msgstr ""
+msgstr "Již existující"
#: editor/project_settings_editor.cpp
msgid "Add Input Action"
@@ -6290,11 +6284,11 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Error saving settings."
-msgstr ""
+msgstr "Chyba při ukládání nastavení."
#: editor/project_settings_editor.cpp
msgid "Settings saved OK."
-msgstr ""
+msgstr "Nastavení úspěšně uloženo."
#: editor/project_settings_editor.cpp
msgid "Override for Feature"
@@ -6302,11 +6296,11 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Add Translation"
-msgstr ""
+msgstr "Přidat překlad"
#: editor/project_settings_editor.cpp
msgid "Remove Translation"
-msgstr ""
+msgstr "Odstranit překlad"
#: editor/project_settings_editor.cpp
msgid "Add Remapped Path"
@@ -6343,14 +6337,14 @@ msgstr "Nastavení projektu (project.godot)"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr ""
+msgstr "Všeobecné"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
-msgstr ""
+msgstr "Vlastnost:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6359,35 +6353,35 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Action:"
-msgstr ""
+msgstr "Akce:"
#: editor/project_settings_editor.cpp
msgid "Device:"
-msgstr ""
+msgstr "Zařízení:"
#: editor/project_settings_editor.cpp
msgid "Index:"
-msgstr ""
+msgstr "Index:"
#: editor/project_settings_editor.cpp
msgid "Localization"
-msgstr ""
+msgstr "Lokalizace"
#: editor/project_settings_editor.cpp
msgid "Translations"
-msgstr ""
+msgstr "Překlady"
#: editor/project_settings_editor.cpp
msgid "Translations:"
-msgstr ""
+msgstr "Překlady:"
#: editor/project_settings_editor.cpp
msgid "Remaps"
-msgstr ""
+msgstr "Přemapování"
#: editor/project_settings_editor.cpp
msgid "Resources:"
-msgstr ""
+msgstr "Zdroje:"
#: editor/project_settings_editor.cpp
msgid "Remaps by Locale:"
@@ -6435,7 +6429,7 @@ msgstr ""
#: editor/property_editor.cpp
msgid "Zero"
-msgstr ""
+msgstr "Nula"
#: editor/property_editor.cpp
msgid "Easing In-Out"
@@ -6446,37 +6440,36 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
-msgstr ""
+msgid "File..."
+msgstr "Soubor..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr ""
+msgid "Dir..."
+msgstr "Složka..."
#: editor/property_editor.cpp
msgid "Assign"
-msgstr ""
+msgstr "Přiřadit"
#: editor/property_editor.cpp
-#, fuzzy
msgid "Select Node"
-msgstr "Vybrat vše"
+msgstr "Vybrat uzel"
#: editor/property_editor.cpp
msgid "New Script"
-msgstr ""
+msgstr "Nový skript"
#: editor/property_editor.cpp
msgid "New %s"
-msgstr ""
+msgstr "Nový %s"
#: editor/property_editor.cpp
msgid "Make Unique"
-msgstr ""
+msgstr "Vytvořit unikátní"
#: editor/property_editor.cpp
msgid "Show in File System"
-msgstr ""
+msgstr "Zobrazit v souborovém systému"
#: editor/property_editor.cpp
msgid "Convert To %s"
@@ -6491,9 +6484,8 @@ msgid "Selected node is not a Viewport!"
msgstr ""
#: editor/property_editor.cpp
-#, fuzzy
msgid "Pick a Node"
-msgstr "Vložit uzly"
+msgstr "Vybrat uzel"
#: editor/property_editor.cpp
msgid "Bit %d, val %d."
@@ -6505,20 +6497,19 @@ msgstr ""
#: editor/property_editor.cpp
msgid "[Empty]"
-msgstr ""
+msgstr "[Prázdné]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
-msgstr ""
+msgstr "Nastavit"
#: editor/property_editor.cpp
msgid "Properties:"
-msgstr ""
+msgstr "Vlastnosti:"
#: editor/property_selector.cpp
-#, fuzzy
msgid "Select Property"
-msgstr "Přidat vlastnost setter"
+msgstr "Vybrat vlastnost"
#: editor/property_selector.cpp
msgid "Select Virtual Method"
@@ -6558,15 +6549,15 @@ msgstr ""
#: editor/run_settings_dialog.cpp
msgid "Current Scene"
-msgstr ""
+msgstr "Aktuální scéna"
#: editor/run_settings_dialog.cpp
msgid "Main Scene"
-msgstr ""
+msgstr "Hlavní scéna"
#: editor/run_settings_dialog.cpp
msgid "Main Scene Arguments:"
-msgstr ""
+msgstr "Argumenty hlavní scény:"
#: editor/run_settings_dialog.cpp
msgid "Scene Run Settings"
@@ -6583,7 +6574,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Error loading scene from %s"
-msgstr ""
+msgstr "Chyba pÅ™i naÄítání scény z %s"
#: editor/scene_tree_dock.cpp
msgid ""
@@ -6601,19 +6592,19 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Move Node In Parent"
-msgstr ""
+msgstr "PÅ™esunout uzel v rodiÄi"
#: editor/scene_tree_dock.cpp
msgid "Move Nodes In Parent"
-msgstr ""
+msgstr "PÅ™esunout uzly v rodiÄi"
#: editor/scene_tree_dock.cpp
msgid "Duplicate Node(s)"
-msgstr ""
+msgstr "Duplikovat uzel/uzly"
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)?"
-msgstr ""
+msgstr "Odstranit uzel/uzly?"
#: editor/scene_tree_dock.cpp
msgid "Can not perform with the root node."
@@ -6624,8 +6615,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr ""
+msgid "Save New Scene As..."
+msgstr "Uložit novou scénu jako..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -6641,7 +6632,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Makes Sense!"
-msgstr ""
+msgstr "Dává smysl!"
#: editor/scene_tree_dock.cpp
msgid "Can't operate on nodes from a foreign scene!"
@@ -6653,7 +6644,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Remove Node(s)"
-msgstr ""
+msgstr "Odstranit uzel/uzly"
#: editor/scene_tree_dock.cpp
msgid ""
@@ -6663,7 +6654,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Error saving scene."
-msgstr ""
+msgstr "Chyba při ukládání scény."
#: editor/scene_tree_dock.cpp
msgid "Error duplicating scene to save it."
@@ -6679,11 +6670,11 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)"
-msgstr ""
+msgstr "Odstranit uzel/uzly"
#: editor/scene_tree_dock.cpp
msgid "Add Child Node"
-msgstr ""
+msgstr "Přidat podřízený uzel"
#: editor/scene_tree_dock.cpp
msgid "Instance Child Scene"
@@ -6691,11 +6682,11 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Change Type"
-msgstr ""
+msgstr "Změnit typ"
#: editor/scene_tree_dock.cpp
msgid "Attach Script"
-msgstr ""
+msgstr "Připojit skript"
#: editor/scene_tree_dock.cpp
msgid "Clear Script"
@@ -6703,16 +6694,15 @@ msgstr "Vymazat skript"
#: editor/scene_tree_dock.cpp
msgid "Merge From Scene"
-msgstr ""
+msgstr "SlouÄit ze scény"
#: editor/scene_tree_dock.cpp
msgid "Save Branch as Scene"
-msgstr ""
+msgstr "Uložit větev jako scénu"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Copy Node Path"
-msgstr "Kopírovat cestu uzlu"
+msgstr "Kopírovat cestu k uzlu"
#: editor/scene_tree_dock.cpp
msgid "Delete (No Confirm)"
@@ -6720,7 +6710,7 @@ msgstr "Odstranit (bez potvrzení)"
#: editor/scene_tree_dock.cpp
msgid "Add/Create a New Node"
-msgstr ""
+msgstr "Přidat/Vytvořit nový uzel"
#: editor/scene_tree_dock.cpp
msgid ""
@@ -6729,26 +6719,24 @@ msgid ""
msgstr ""
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Filter nodes"
msgstr "Filtrovat uzly"
#: editor/scene_tree_dock.cpp
msgid "Attach a new or existing script for the selected node."
-msgstr ""
+msgstr "Připojit nový, nebo existující skript k vybranému uzlu."
#: editor/scene_tree_dock.cpp
msgid "Clear a script for the selected node."
msgstr ""
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Remote"
msgstr "Vzdálený"
#: editor/scene_tree_dock.cpp
msgid "Local"
-msgstr ""
+msgstr "Místní"
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance? (No Undo!)"
@@ -6806,7 +6794,7 @@ msgstr ""
#: editor/scene_tree_editor.cpp
msgid "Toggle Visibility"
-msgstr ""
+msgstr "Přepnout viditelnost"
#: editor/scene_tree_editor.cpp
msgid "Invalid node name, the following characters are not allowed:"
@@ -6814,11 +6802,11 @@ msgstr ""
#: editor/scene_tree_editor.cpp
msgid "Rename Node"
-msgstr ""
+msgstr "Přejmenovat uzel"
#: editor/scene_tree_editor.cpp
msgid "Scene Tree (Nodes):"
-msgstr ""
+msgstr "Strom scény (uzly):"
#: editor/scene_tree_editor.cpp
msgid "Node Configuration Warning!"
@@ -6826,7 +6814,7 @@ msgstr ""
#: editor/scene_tree_editor.cpp
msgid "Select a Node"
-msgstr ""
+msgstr "Vybrat uzel"
#: editor/script_create_dialog.cpp
msgid "Error loading template '%s'"
@@ -6842,36 +6830,35 @@ msgstr "Chyba nahrávání skriptu z %s"
#: editor/script_create_dialog.cpp
msgid "N/A"
-msgstr ""
+msgstr "N/A"
#: editor/script_create_dialog.cpp
msgid "Path is empty"
-msgstr ""
+msgstr "Cesta je prázdná"
#: editor/script_create_dialog.cpp
msgid "Path is not local"
-msgstr ""
+msgstr "Cesta není místní"
#: editor/script_create_dialog.cpp
msgid "Invalid base path"
-msgstr ""
+msgstr "Neplatná základní cesta"
#: editor/script_create_dialog.cpp
msgid "Directory of the same name exists"
-msgstr ""
+msgstr "Složka se stejným jménem již existuje"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "File exists, will be reused"
-msgstr "Soubor už existuje. Přepsat?"
+msgstr "Soubor již existuje, bude znovu použit"
#: editor/script_create_dialog.cpp
msgid "Invalid extension"
-msgstr ""
+msgstr "Neplatná přípona"
#: editor/script_create_dialog.cpp
msgid "Wrong extension chosen"
-msgstr ""
+msgstr "Vybrána špatná přípona"
#: editor/script_create_dialog.cpp
msgid "Invalid Path"
@@ -6879,7 +6866,7 @@ msgstr "Neplatná cesta"
#: editor/script_create_dialog.cpp
msgid "Invalid class name"
-msgstr ""
+msgstr "Neplatné jméno třídy"
#: editor/script_create_dialog.cpp
#, fuzzy
@@ -6888,11 +6875,11 @@ msgstr "Neplatné jméno vlastnosti."
#: editor/script_create_dialog.cpp
msgid "Script valid"
-msgstr ""
+msgstr "Skript je validní"
#: editor/script_create_dialog.cpp
msgid "Allowed: a-z, A-Z, 0-9 and _"
-msgstr ""
+msgstr "Povoleno: a-z, A-Z, 0-9 a _"
#: editor/script_create_dialog.cpp
msgid "Built-in script (into scene file)"
@@ -6908,15 +6895,15 @@ msgstr ""
#: editor/script_create_dialog.cpp
msgid "Language"
-msgstr ""
+msgstr "Jazyk"
#: editor/script_create_dialog.cpp
msgid "Inherits"
-msgstr ""
+msgstr "Dědí"
#: editor/script_create_dialog.cpp
msgid "Class Name"
-msgstr ""
+msgstr "Jméno třídy"
#: editor/script_create_dialog.cpp
msgid "Template"
@@ -6931,29 +6918,28 @@ msgid "Attach Node Script"
msgstr ""
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Remote "
msgstr "Vzdálený "
#: editor/script_editor_debugger.cpp
msgid "Bytes:"
-msgstr ""
+msgstr "Bajtů:"
#: editor/script_editor_debugger.cpp
msgid "Warning"
-msgstr ""
+msgstr "Varování"
#: editor/script_editor_debugger.cpp
msgid "Error:"
-msgstr ""
+msgstr "Chyba:"
#: editor/script_editor_debugger.cpp
msgid "Source:"
-msgstr ""
+msgstr "Zdroj:"
#: editor/script_editor_debugger.cpp
msgid "Function:"
-msgstr ""
+msgstr "Funkce:"
#: editor/script_editor_debugger.cpp
msgid "Pick one or more items from the list to display the graph."
@@ -6961,16 +6947,15 @@ msgstr ""
#: editor/script_editor_debugger.cpp modules/mono/editor/mono_bottom_panel.cpp
msgid "Errors"
-msgstr ""
+msgstr "Chyby"
#: editor/script_editor_debugger.cpp
msgid "Child Process Connected"
msgstr ""
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Copy Error"
-msgstr "Připojit.."
+msgstr "Kopírovat chybu"
#: editor/script_editor_debugger.cpp
msgid "Inspect Previous Instance"
@@ -6986,11 +6971,11 @@ msgstr ""
#: editor/script_editor_debugger.cpp
msgid "Variable"
-msgstr ""
+msgstr "Proměnná"
#: editor/script_editor_debugger.cpp
msgid "Errors:"
-msgstr ""
+msgstr "Chyby:"
#: editor/script_editor_debugger.cpp
msgid "Stack Trace (if applicable):"
@@ -7006,7 +6991,7 @@ msgstr ""
#: editor/script_editor_debugger.cpp
msgid "Value"
-msgstr ""
+msgstr "Hodnota"
#: editor/script_editor_debugger.cpp
msgid "Monitors"
@@ -7018,7 +7003,7 @@ msgstr ""
#: editor/script_editor_debugger.cpp
msgid "Total:"
-msgstr ""
+msgstr "Celkem:"
#: editor/script_editor_debugger.cpp
msgid "Video Mem"
@@ -7026,23 +7011,23 @@ msgstr ""
#: editor/script_editor_debugger.cpp
msgid "Resource Path"
-msgstr ""
+msgstr "Cesta ke zdroji"
#: editor/script_editor_debugger.cpp
msgid "Type"
-msgstr ""
+msgstr "Typ"
#: editor/script_editor_debugger.cpp
msgid "Format"
-msgstr ""
+msgstr "Formát"
#: editor/script_editor_debugger.cpp
msgid "Usage"
-msgstr ""
+msgstr "Používání"
#: editor/script_editor_debugger.cpp
msgid "Misc"
-msgstr ""
+msgstr "Různé"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
@@ -7062,7 +7047,7 @@ msgstr ""
#: editor/settings_config_dialog.cpp
msgid "Shortcuts"
-msgstr ""
+msgstr "Zkratky"
#: editor/settings_config_dialog.cpp
msgid "Binding"
@@ -7070,7 +7055,7 @@ msgstr ""
#: editor/spatial_editor_gizmos.cpp
msgid "Change Light Radius"
-msgstr ""
+msgstr "Změnit rádius světla"
#: editor/spatial_editor_gizmos.cpp
msgid "Change AudioStreamPlayer3D Emission Angle"
@@ -7078,11 +7063,11 @@ msgstr ""
#: editor/spatial_editor_gizmos.cpp
msgid "Change Camera FOV"
-msgstr ""
+msgstr "Změnit zorné pole kamery"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Camera Size"
-msgstr ""
+msgstr "Změnit velikost kamery"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Sphere Shape Radius"
@@ -7135,15 +7120,15 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Platform:"
-msgstr ""
+msgstr "Platforma:"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Platform"
-msgstr ""
+msgstr "Platforma"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Dynamic Library"
-msgstr ""
+msgstr "Dynamická knihovna"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
@@ -7151,23 +7136,23 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "GDNativeLibrary"
-msgstr ""
+msgstr "GDNativeLibrary"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Library"
-msgstr ""
+msgstr "Knihovna"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Status"
-msgstr ""
+msgstr "Status"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Libraries: "
-msgstr ""
+msgstr "Knihovny: "
#: modules/gdnative/register_types.cpp
msgid "GDNative"
-msgstr ""
+msgstr "GDNative"
#: modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -7243,14 +7228,12 @@ msgid "Floor:"
msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Delete Selection"
-msgstr "Smazat vybraný"
+msgstr "GridMap Smazat výběr"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Duplicate Selection"
-msgstr "Duplikovat výběr"
+msgstr "GridMap Duplikovat výběr"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Grid Map"
@@ -7275,15 +7258,15 @@ msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Edit X Axis"
-msgstr ""
+msgstr "Editovat osu X"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Edit Y Axis"
-msgstr ""
+msgstr "Editovat osu Y"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Edit Z Axis"
-msgstr ""
+msgstr "Editovat osu Z"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Cursor Rotate X"
@@ -7314,9 +7297,8 @@ msgid "Cursor Clear Rotation"
msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Create Area"
-msgstr "Vytvořit nový"
+msgstr "Vytvořit plochu"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Create Exterior Connector"
@@ -7324,15 +7306,13 @@ msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Erase Area"
-msgstr ""
+msgstr "Vymazat oblast"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Clear Selection"
-msgstr "Změnit měřítko výběru"
+msgstr "Vymazat výběr"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Settings"
msgstr "Nastavení GridMap"
@@ -7340,27 +7320,29 @@ msgstr "Nastavení GridMap"
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
-msgstr ""
+msgstr "Generování řešení..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating C# project..."
-msgstr ""
+msgstr "Generování C# projektu..."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to create solution."
msgstr "Nepodařilo se vytvořit řešení."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to save solution."
msgstr "Nepodařilo se uložit řešení."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Done"
-msgstr ""
+msgstr "Hotovo"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Failed to create C# project."
@@ -7368,14 +7350,13 @@ msgstr ""
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Mono"
-msgstr ""
+msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "O podpoře C#"
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Create C# solution"
msgstr "Vytvořit C# řešení"
@@ -7389,6 +7370,10 @@ msgstr "Sestavit projekt"
#: modules/mono/editor/mono_bottom_panel.cpp
msgid "Warnings"
+msgstr "Varování"
+
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
msgstr ""
#: modules/visual_script/visual_script.cpp
@@ -7433,9 +7418,8 @@ msgid "Change Signal Arguments"
msgstr "Upravit argumenty signálu"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Argument Type"
-msgstr "Změnit typ hodnot pole"
+msgstr "Změnit typ argumentu"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Argument name"
@@ -7490,29 +7474,25 @@ msgid "Add Signal"
msgstr "Přidat signál"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Expression"
-msgstr "Animace: změna přechodu"
+msgstr "Změnit výraz"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node"
msgstr "Přidat uzel"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Remove VisualScript Nodes"
-msgstr "Odstranit neplatné klíÄe"
+msgstr "Odstranit uzly VisualScriptu"
#: modules/visual_script/visual_script_editor.cpp
msgid "Duplicate VisualScript Nodes"
msgstr ""
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature."
msgstr ""
-"Podržte Meta k uvolnění getteru. Podržte Shift k uvolnění generického "
-"podpisu."
+"Podržte %s k uvolnění getteru. Podržte Shift k uvolnění generického podpisu."
#: modules/visual_script/visual_script_editor.cpp
#, fuzzy
@@ -7522,7 +7502,6 @@ msgstr ""
"podpisu."
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Hold %s to drop a simple reference to the node."
msgstr "Podržte %s k uvolnění jednoduché reference na uzel."
@@ -7602,11 +7581,11 @@ msgstr "Zavolat"
#: modules/visual_script/visual_script_editor.cpp
msgid "Get"
-msgstr ""
+msgstr "Získat"
#: modules/visual_script/visual_script_editor.cpp
msgid "Script already has function '%s'"
-msgstr ""
+msgstr "Script již má funkci '%s'"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Input Value"
@@ -7618,7 +7597,7 @@ msgstr ""
#: modules/visual_script/visual_script_editor.cpp
msgid "Clipboard is empty!"
-msgstr ""
+msgstr "Schránka je prázdná!"
#: modules/visual_script/visual_script_editor.cpp
msgid "Paste VisualScript Nodes"
@@ -7750,11 +7729,11 @@ msgstr ""
#: platform/javascript/export/export.cpp
msgid "Run in Browser"
-msgstr ""
+msgstr "Spustit v prohlížeÄi"
#: platform/javascript/export/export.cpp
msgid "Run exported HTML in the system's default browser."
-msgstr ""
+msgstr "Spustit vyexportované HTML ve výchozím prohlížeÄi."
#: platform/javascript/export/export.cpp
msgid "Could not write file:"
@@ -7820,7 +7799,7 @@ msgstr ""
#: scene/2d/collision_polygon_2d.cpp
msgid "An empty CollisionPolygon2D has no effect on collision."
-msgstr "Prázdný CollisionPolygon2D nemá žádný efekt na kolizích."
+msgstr "Prázdný CollisionPolygon2D nemá při kolizi žádný efekt."
#: scene/2d/collision_shape_2d.cpp
msgid ""
@@ -7905,6 +7884,8 @@ msgid ""
"VisibilityEnable2D works best when used with the edited scene root directly "
"as parent."
msgstr ""
+"VisibilityEnable2D funguje nejlépe, když je nastaven jako rodiÄ editované "
+"scény."
#: scene/3d/arvr_nodes.cpp
msgid "ARVRCamera must have an ARVROrigin node as its parent"
@@ -7936,11 +7917,11 @@ msgstr ""
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Zbývající Äas: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8035,12 +8016,22 @@ msgstr ""
"uzel Particles2D."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Na každou scénu (nebo skupinu instancovaných scén) je povolen pouze jeden "
"WorldEnvironment."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8057,11 +8048,11 @@ msgstr ""
#: scene/gui/color_picker.cpp
msgid "Raw Mode"
-msgstr ""
+msgstr "RAW mód"
#: scene/gui/color_picker.cpp
msgid "Add current color as a preset"
-msgstr ""
+msgstr "Přidat aktuální barvu jako předvolbu"
#: scene/gui/dialogs.cpp
msgid "Alert!"
@@ -8069,7 +8060,7 @@ msgstr "Pozor!"
#: scene/gui/dialogs.cpp
msgid "Please Confirm..."
-msgstr "PotvrÄte prosím.."
+msgstr "PotvrÄte prosím..."
#: scene/gui/file_dialog.cpp
msgid "Select this Folder"
@@ -8133,12 +8124,26 @@ msgstr "Chyba nahrávání fontu."
msgid "Invalid font size."
msgstr "Neplatná velikost fontu."
-#~ msgid "Can't write file."
-#~ msgstr "Nelze zapsat soubor."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Předchozí záložka"
#~ msgid "Next"
#~ msgstr "Další"
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Nesmí obsaovat '/' nebo ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Neplatný formát version.txt uvnitř šablon. Revize není platný "
+#~ "identifikátor."
+
+#~ msgid "Can't write file."
+#~ msgstr "Nelze zapsat soubor."
+
#~ msgid "Not found!"
#~ msgstr "Nenalezeno!"
diff --git a/editor/translations/da.po b/editor/translations/da.po
index 3825e15c23..3b5854334a 100644
--- a/editor/translations/da.po
+++ b/editor/translations/da.po
@@ -3,14 +3,16 @@
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
#
+# Dankse Memes <purplelops@gmail.com>, 2018.
# David Lamhauge <davidlamhauge@gmail.com>, 2016.
-# Kim Nielsen <kimmowich@stofanet.dk>, 2017.
+# Esben Damkjær Sørensen <esben@damkjaergaard.com>, 2018.
+# Kim Nielsen <kimmowich@stofanet.dk>, 2017, 2018.
# Michael Madsen <mim@michael-madsen.dk>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-12-20 15:42+0000\n"
+"PO-Revision-Date: 2018-05-17 19:35+0000\n"
"Last-Translator: Kim Nielsen <kimmowich@stofanet.dk>\n"
"Language-Team: Danish <https://hosted.weblate.org/projects/godot-engine/"
"godot/da/>\n"
@@ -18,7 +20,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 2.18\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -29,9 +31,8 @@ msgid "All Selection"
msgstr "All selection"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "Anim Skift Værdi"
+msgstr "Anim Skift Keyframetid"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
@@ -42,9 +43,8 @@ msgid "Anim Change Transform"
msgstr "Anim Skift Transformering"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Anim Skift Værdi"
+msgstr "Anim Skift Keyframeværdi"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -497,12 +497,11 @@ msgid "Connecting Signal:"
msgstr "Forbindelses Signal:"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect '%s' from '%s'"
-msgstr "Forbind '%s' til '%s'"
+msgstr "Afbryd '%s' fra '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Forbind..."
#: editor/connections_dialog.cpp
@@ -515,9 +514,8 @@ msgid "Signals"
msgstr "Signaler"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Change %s Type"
-msgstr "Skift Base Type"
+msgstr "Skift %s Type"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -525,9 +523,8 @@ msgid "Change"
msgstr "Skift"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Create New %s"
-msgstr "Opret Nyt"
+msgstr "Opret Ny %s"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
@@ -639,7 +636,7 @@ msgstr ""
#: editor/dependency_editor.cpp
#, fuzzy
msgid "Cannot remove:"
-msgstr "Kan ikke fjerne:\n"
+msgstr "Kan ikke fjerne:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
@@ -722,9 +719,8 @@ msgid "Lead Developer"
msgstr "Ledende Udvikler"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Project Manager "
-msgstr "Projektleder"
+msgstr "Projektleder "
#: editor/editor_about.cpp
msgid "Developers"
@@ -817,9 +813,8 @@ msgid "Install"
msgstr "Installér"
#: editor/editor_asset_installer.cpp
-#, fuzzy
msgid "Package Installer"
-msgstr "Pakke Installatør"
+msgstr "Pakkeinstallatør"
#: editor/editor_audio_buses.cpp
msgid "Speakers"
@@ -834,9 +829,8 @@ msgid "Rename Audio Bus"
msgstr "Omdøb Audio Bus"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Change Audio Bus Volume"
-msgstr "Skifter Audio Bus Solo"
+msgstr "Skift Audio Bus Volume"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
@@ -901,7 +895,7 @@ msgstr "Slet Effect"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Lyd"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
@@ -928,12 +922,12 @@ msgid "Move Audio Bus"
msgstr "Flyt Audio Bus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Gem Audio Bus Layout Som.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Gem Audio Bus Layout Som..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Placering for Ny Layout.."
+msgid "Location for New Layout..."
+msgstr "Placering for Ny Layout..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1074,20 +1068,20 @@ msgid "Updating Scene"
msgstr "Opdatere Scene"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Gemmer lokale ændringer.."
+msgid "Storing local changes..."
+msgstr "Gemmer lokale ændringer..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Opdatere scene.."
+msgid "Updating scene..."
+msgstr "Opdatere scene..."
#: editor/editor_data.cpp
msgid "[empty]"
-msgstr ""
+msgstr "[tom]"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr ""
+msgstr "[ikke gemt]"
#: editor/editor_dir_dialog.cpp
msgid "Please select a base directory first"
@@ -1127,18 +1121,16 @@ msgid "Packing"
msgstr "Pakker"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
-#, fuzzy
msgid "Template file not found:"
-msgstr "Skabelon fil ikke fundet:\n"
+msgstr "Skabelonfil ikke fundet:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "File Exists, Overwrite?"
msgstr "Filen Eksisterer, Overskrives?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select Current Folder"
-msgstr "Opret mappe"
+msgstr "Vælg nurværende mappe"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
@@ -1149,8 +1141,8 @@ msgid "Show In File Manager"
msgstr "Vis I Fil Manager"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Opret mappe.."
+msgid "New Folder..."
+msgstr "Opret mappe..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1244,9 +1236,8 @@ msgid "File:"
msgstr "Fil:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Must use a valid extension."
-msgstr "Skal bruge en gyldig extension."
+msgstr "Du skal bruge en gyldig udvidelse."
#: editor/editor_file_system.cpp
msgid "ScanSources"
@@ -1343,18 +1334,16 @@ msgid "Description"
msgstr "Beskrivelse"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Online Tutorials:"
-msgstr "Online Dokumentation"
+msgstr "Online Undervisning:"
#: editor/editor_help.cpp
-#, fuzzy
msgid ""
"There are currently no tutorials for this class, you can [color=$color][url="
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Der er i øjeblikket ingen beskrivelse af denne metode. Det vil være en stor "
+"Der er i øjeblikket ingen beskrivelse af denne klasse. Det vil være en stor "
"hjælp, hvis du kan [color=$color][url=$url]bidrage[/url][/color] med en "
"beskrivelse!"
@@ -1412,26 +1401,28 @@ msgid "Clear"
msgstr "Clear"
#: editor/editor_log.cpp
-#, fuzzy
msgid "Clear Output"
-msgstr "Output"
+msgstr "Ryd Output"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Projekt eksport fejlede med fejlkode %d."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Fejl, kan ikke gemme ressource!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Gem Ressource Som.."
+msgid "Save Resource As..."
+msgstr "Gem Ressource Som..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
#, fuzzy
-msgid "I see.."
-msgstr "Jeg ser.."
+msgid "I see..."
+msgstr "Jeg ser..."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Can't open file for writing:"
msgstr "Kan ikke åbne fil til skrivning:"
@@ -1452,7 +1443,6 @@ msgid "Error while parsing '%s'."
msgstr "Error ved parsing af '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Unexpected end of file '%s'."
msgstr "Uventet afslutning af fil '%s'."
@@ -1482,12 +1472,11 @@ msgid "This operation can't be done without a tree root."
msgstr "Denne handling kan ikke foretages uden tree root"
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
msgstr ""
-"Kunne ikke gemme scene. Der er nogle afhængigheder (forekomster) some ikke "
+"Kunne ikke gemme scene. Der er nogle afhængigheder (forekomster) som ikke "
"kunne opfyldes."
#: editor/editor_node.cpp
@@ -1664,12 +1653,12 @@ msgid "Open Base Scene"
msgstr "Ã…bn Grund Scene"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Hurtig Ã…bn Scene.."
+msgid "Quick Open Scene..."
+msgstr "Hurtig Ã…bn Scene..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Hurtig Ã…bn Script.."
+msgid "Quick Open Script..."
+msgstr "Hurtig Ã…bn Script..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1680,8 +1669,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Gem ændringer til '%s' før lukning?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Gem Scene Som.."
+msgid "Save Scene As..."
+msgstr "Gem Scene Som..."
#: editor/editor_node.cpp
msgid "No"
@@ -1732,8 +1721,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Denne handling kan ikke fortrydes. Vend tilbage alligevel?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Hurtig Kør Scene.."
+msgid "Quick Run Scene..."
+msgstr "Hurtig Kør Scene..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1891,8 +1880,8 @@ msgid "Previous tab"
msgstr "Forrige fane"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrer filer.."
+msgid "Filter Files..."
+msgstr "Filtrer filer..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1904,12 +1893,12 @@ msgstr "Ny Scene"
#: editor/editor_node.cpp
#, fuzzy
-msgid "New Inherited Scene.."
-msgstr "Ny Nedarvet Scene.."
+msgid "New Inherited Scene..."
+msgstr "Ny Nedarvet Scene..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Ã…bn Scene.."
+msgid "Open Scene..."
+msgstr "Ã…bn Scene..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1928,16 +1917,16 @@ msgid "Open Recent"
msgstr "Ã…ben Seneste"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Konverter Til.."
+msgid "Convert To..."
+msgstr "Konverter Til..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MaskeBibliotek.."
+msgid "MeshLibrary..."
+msgstr "MaskeBibliotek..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2203,8 +2192,8 @@ msgid "Save the currently edited resource."
msgstr "Gem den aktuelt redigerede ressource."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Gem Som.."
+msgid "Save As..."
+msgstr "Gem Som..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2312,8 +2301,8 @@ msgid "Creating Mesh Previews"
msgstr "Opretter Maske Forhåndsvisninger"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniature.."
+msgid "Thumbnail..."
+msgstr "Miniature..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2469,8 +2458,8 @@ msgid "(Current)"
msgstr "(Nuværende)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Henter spejle, vent venligst .."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Henter spejle, vent venligst ..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2485,14 +2474,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ugyldigt version.txt format inde i skabeloner."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ugyldigt version.txt format inde i skabeloner. Revision er ikke en gyldig "
-"identifikator."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Ingen version.txt fundet inde i skabeloner."
@@ -2560,7 +2541,7 @@ msgstr "Fejl i anmodning url: "
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "Forbinder..."
#: editor/export_template_manager.cpp
@@ -2578,8 +2559,8 @@ msgstr "Kan ikke Løses"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Forbinder.."
+msgid "Connecting..."
+msgstr "Forbinder..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2592,8 +2573,8 @@ msgstr "Tilsluttet"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Anmoder.."
+msgid "Requesting..."
+msgstr "Anmoder..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2734,12 +2715,12 @@ msgid "Collapse all"
msgstr "Klap alle sammen"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Omdøb.."
+msgid "Rename..."
+msgstr "Omdøb..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Flyt Til.."
+msgid "Move To..."
+msgstr "Flyt Til..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2751,16 +2732,16 @@ msgid "Instance"
msgstr "Instans"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Rediger Afhængigheder.."
+msgid "Edit Dependencies..."
+msgstr "Rediger Afhængigheder..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Vis Ejere.."
+msgid "View Owners..."
+msgstr "Vis Ejere..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Duplikere"
#: editor/filesystem_dock.cpp
@@ -2786,10 +2767,10 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Scanner Filer,\n"
-"Vent Venligst.."
+"Vent Venligst..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2854,20 +2835,20 @@ msgid "Import Scene"
msgstr "Importer Scene"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Importerer Scene.."
+msgid "Importing Scene..."
+msgstr "Importerer Scene..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
-msgstr ""
+msgstr "Generering af lightmaps"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
-msgstr ""
+msgstr "Generering til Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Kører Brugerdefineret Script.."
+msgid "Running Custom Script..."
+msgstr "Kører Brugerdefineret Script..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2882,8 +2863,8 @@ msgid "Error running post-import script:"
msgstr "Fejl ved kørsel af efter-import script:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Gemmer.."
+msgid "Saving..."
+msgstr "Gemmer..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2902,8 +2883,8 @@ msgid "Import As:"
msgstr "Importer Som:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Forudindstillet.."
+msgid "Preset..."
+msgstr "Forudindstillet..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -2993,21 +2974,21 @@ msgstr "Fjern Animation"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Invalid animation name!"
-msgstr ""
+msgstr "FEJL: Ugyldig animationsnavn!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Animation name already exists!"
-msgstr ""
+msgstr "FEJL: Animationsnavn eksisterer allerede!"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Rename Animation"
-msgstr ""
+msgstr "Omdøb animation"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Animation"
-msgstr ""
+msgstr "Tilføj animation"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Next Changed"
@@ -3019,19 +3000,19 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load Animation"
-msgstr ""
+msgstr "Indlæs animation"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Duplicate Animation"
-msgstr ""
+msgstr "Lav en kopi af animation"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to copy!"
-msgstr ""
+msgstr "FEJL: Der er ingen animation der kan kopieres!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation resource on clipboard!"
-msgstr ""
+msgstr "FEJL: Ingen animationsressource i udklipsholder!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Pasted Animation"
@@ -3043,31 +3024,31 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to edit!"
-msgstr ""
+msgstr "FEJL: Der er ingen animation som kan redigeres!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from current pos. (A)"
-msgstr ""
+msgstr "Afspil valgte animation baglæns fra nuværende position. (A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from end. (Shift+A)"
-msgstr ""
+msgstr "Afspil valgt animation baglæns fra slutningen. (Shift+A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Stop animation playback. (S)"
-msgstr ""
+msgstr "Stop animation afspilning. (S)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from start. (Shift+D)"
-msgstr ""
+msgstr "Afspil valgt animation fra start. (Shift+D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from current pos. (D)"
-msgstr ""
+msgstr "Afspil valgt animation fra nuværende position. (D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation position (in seconds)."
-msgstr ""
+msgstr "Animationsposition (i sekunder)."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Scale animation playback globally for the node."
@@ -3322,7 +3303,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3330,7 +3311,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3399,7 +3380,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3466,7 +3447,7 @@ msgid "Site:"
msgstr "Websted:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Støtte..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3654,6 +3635,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3750,6 +3732,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -4037,6 +4027,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -4065,7 +4059,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4272,7 +4266,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4638,7 +4632,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4737,7 +4731,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4944,15 +4938,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5405,11 +5399,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5662,7 +5652,7 @@ msgid "Remove All"
msgstr "Fjern Alt"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5710,6 +5700,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5722,7 +5720,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5848,7 +5846,7 @@ msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet.."
+msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5912,7 +5910,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -6003,6 +6001,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Ugyldigt navn."
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Kunne ikke oprette mappe."
@@ -6192,7 +6195,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6220,7 +6225,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6337,10 +6342,6 @@ msgid "Delete Item"
msgstr "Slet Valgte"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Kan ikke indeholde '/' eller ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6409,7 +6410,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6505,11 +6506,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6680,7 +6681,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7387,6 +7388,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7440,6 +7445,10 @@ msgstr "Projekt"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8077,12 +8086,22 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Stien skal pege på en gyldig fysisk node for at virke."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Kun én WorldEnvironment er tilladt pr. scene (eller et sæt af instanserede "
"scener)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8173,12 +8192,26 @@ msgstr "Error loading skrifttype."
msgid "Invalid font size."
msgstr "Ugyldig skriftstørrelse."
-#~ msgid "Can't write file."
-#~ msgstr "Kan ikke skrive til fil."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Forrige fane"
#~ msgid "Next"
#~ msgstr "Næste"
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Kan ikke indeholde '/' eller ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ugyldigt version.txt format inde i skabeloner. Revision er ikke en gyldig "
+#~ "identifikator."
+
+#~ msgid "Can't write file."
+#~ msgstr "Kan ikke skrive til fil."
+
#~ msgid "Not found!"
#~ msgstr "Ikke fundet!"
diff --git a/editor/translations/de.po b/editor/translations/de.po
index 2ee39425de..d5d63f654b 100644
--- a/editor/translations/de.po
+++ b/editor/translations/de.po
@@ -2,7 +2,6 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Alexander Mahr <alex.mahr@gmail.com>, 2016.
# Andreas Esau <andreasesau@gmail.com>, 2016.
# Andreas Haas <liu.gam3@gmail.com>, 2016.
@@ -12,24 +11,28 @@
# CitrusEdition <mariankloesler@web.de>, 2017.
# danjo <atze@libra.uberspace.de>, 2016.
# Eurocloud KnowHow <tobias.kloy@werde-volunteer.info>, 2017.
+# HugeGameArt <hugegameartgd@gmail.com>, 2018.
# hyperglow <greensoma@web.de>, 2016.
# Jan Groß <jan@grossit.de>, 2016.
# Kim <github@aggsol.de>, 2017.
+# Metin Celik <metincelik88@gmail.com>, 2018.
+# Neicul <neicul@gmx.de>, 2018.
+# nimradium <nimra242001@gmail.com>, 2018.
# Oliver Ruehl <oliver@ruehldesign.co>, 2016-2017.
# Paul-Vincent Roll <paviro@me.com>, 2016.
# 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.
# Tim Schellenberg <smwleod@gmail.com>, 2017.
# Timo Schwarzer <account@timoschwarzer.com>, 2016-2018.
# viernullvier <hannes.breul+github@gmail.com>, 2016.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-02-12 08:36+0000\n"
-"Last-Translator: So Wieso <sowieso@dukun.de>\n"
+"PO-Revision-Date: 2018-06-19 19:38+0000\n"
+"Last-Translator: nimradium <nimra242001@gmail.com>\n"
"Language-Team: German <https://hosted.weblate.org/projects/godot-engine/"
"godot/de/>\n"
"Language: de\n"
@@ -37,7 +40,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 2.19-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -328,7 +331,8 @@ msgstr "Optimieren"
#: editor/animation_editor.cpp
msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
msgstr ""
-"AnimationPlayer aus dem Szenenbaum auswählen um Animationen zu bearbeiten."
+"Wählen Sie einen AnimationPlayer aus dem Szenenbaum aus, um Animationen zu "
+"bearbeiten."
#: editor/animation_editor.cpp
msgid "Key"
@@ -344,7 +348,7 @@ msgstr "Skalierungsverhältnis:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr "Node dessen Funktionen aufgerufen werden sollen auswählen."
+msgstr "Funktionen in welcher Node aufrufen?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
@@ -518,8 +522,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "'%s' von '%s' trennen"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Verbinden.."
+msgid "Connect..."
+msgstr "Verbinden..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -944,12 +948,12 @@ msgid "Move Audio Bus"
msgstr "Audiobus verschieben"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Audiobus-Layout speichern als.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Audiobus-Layout speichern als..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Speicherort für neues Layout.."
+msgid "Location for New Layout..."
+msgstr "Speicherort für neues Layout..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1090,11 +1094,11 @@ msgid "Updating Scene"
msgstr "Aktualisiere Szene"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Speichere lokale Änderungen.."
+msgid "Storing local changes..."
+msgstr "Speichere lokale Änderungen..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "Aktualisiere Szene..."
#: editor/editor_data.cpp
@@ -1163,8 +1167,8 @@ msgid "Show In File Manager"
msgstr "Zeige im Dateimanager"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Neuer Ordner.."
+msgid "New Folder..."
+msgstr "Neuer Ordner..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1423,17 +1427,21 @@ msgstr "Löschen"
msgid "Clear Output"
msgstr "Ausgabe löschen"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Projekt-Export ist fehlgeschlagen mit Fehlercode %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Fehler beim speichern der Ressource!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Speichere Ressource als.."
+msgid "Save Resource As..."
+msgstr "Speichere Ressource als..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Verstehe..."
#: editor/editor_node.cpp
@@ -1622,7 +1630,7 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"Es ist keine Hauptszene wurde jemals bestimmt, soll eine ausgewählt werden?\n"
+"Es wurde noch keine Hauptszene bestimmt, soll eine ausgewählt werden?\n"
"Dies kann später in den Projekteinstellungen unter der Kategorie ‚Anwendung‘ "
"geändert werden."
@@ -1665,12 +1673,12 @@ msgid "Open Base Scene"
msgstr "Basisszene öffnen"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Schnell Szenen öffnen.."
+msgid "Quick Open Scene..."
+msgstr "Schnell Szenen öffnen..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Schnell Skripte öffnen.."
+msgid "Quick Open Script..."
+msgstr "Schnell Skripte öffnen..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1681,8 +1689,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Änderungen in ‚%s‘ vor dem Schließen speichern?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Szene speichern als.."
+msgid "Save Scene As..."
+msgstr "Szene speichern als..."
#: editor/editor_node.cpp
msgid "No"
@@ -1735,8 +1743,8 @@ msgstr ""
"Diese Aktion kann nicht rückgängig gemacht werden. Trotzdem zurücksetzen?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Schnell Szene starten.."
+msgid "Quick Run Scene..."
+msgstr "Schnell Szene starten..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1899,8 +1907,8 @@ msgid "Previous tab"
msgstr "Vorheriger Tab"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Dateien filtern.."
+msgid "Filter Files..."
+msgstr "Dateien filtern..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1911,12 +1919,12 @@ msgid "New Scene"
msgstr "Neue Szene"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Neue gererbte Szene.."
+msgid "New Inherited Scene..."
+msgstr "Neue geerbte Szene..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Szene öffnen.."
+msgid "Open Scene..."
+msgstr "Szene öffnen..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1935,16 +1943,16 @@ msgid "Open Recent"
msgstr "Zuletzt benutzte Szenen"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Umwandeln zu.."
+msgid "Convert To..."
+msgstr "Umwandeln zu..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2208,8 +2216,8 @@ msgid "Save the currently edited resource."
msgstr "Speichere die so eben bearbeitete Ressource."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Speichern als.."
+msgid "Save As..."
+msgstr "Speichern als..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2317,8 +2325,8 @@ msgid "Creating Mesh Previews"
msgstr "Mesh-Vorschauen erzeugen"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Vorschau.."
+msgid "Thumbnail..."
+msgstr "Vorschau..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2470,12 +2478,12 @@ msgid "(Current)"
msgstr "(Aktuell)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Mirrors werden geladen, bitte warten..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
-msgstr "Template-Version ‚%s‘ entfernen?"
+msgstr "Template-Version '%s' entfernen?"
#: editor/export_template_manager.cpp
msgid "Can't open export templates zip."
@@ -2486,14 +2494,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ungültiges version.txt-Format in Templates."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ungültiges version.txt-Format in Templates. Revision ist kein gültiger "
-"Bezeichner."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Keine version.txt in Templates gefunden."
@@ -2556,8 +2556,8 @@ msgid "Error requesting url: "
msgstr "Fehler beim Abrufen der URL: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Verbinde mit Mirror.."
+msgid "Connecting to Mirror..."
+msgstr "Verbinde mit Mirror..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2573,8 +2573,8 @@ msgstr "Kann nicht aufgelöst werden"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Verbinde.."
+msgid "Connecting..."
+msgstr "Verbinde..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2586,8 +2586,8 @@ msgstr "Verbunden"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Frage an.."
+msgid "Requesting..."
+msgstr "Frage an..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2723,12 +2723,12 @@ msgid "Collapse all"
msgstr "Alle einklappen"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Umbenennen.."
+msgid "Rename..."
+msgstr "Umbenennen..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Verschiebe zu.."
+msgid "Move To..."
+msgstr "Verschiebe zu..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2739,16 +2739,16 @@ msgid "Instance"
msgstr "Instanz"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Abhängigkeiten bearbeiten.."
+msgid "Edit Dependencies..."
+msgstr "Abhängigkeiten bearbeiten..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Zeige Besitzer.."
+msgid "View Owners..."
+msgstr "Zeige Besitzer..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Duplizieren.."
+msgid "Duplicate..."
+msgstr "Duplizieren..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2773,10 +2773,10 @@ msgstr "Instantiiere gewählte Szene(n) als Unterobjekt des ausgewählten Nodes.
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Lese Dateien,\n"
-"Bitte warten.."
+"Bitte warten..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2841,8 +2841,8 @@ msgid "Import Scene"
msgstr "Szene importieren"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Szene wird importiert.."
+msgid "Importing Scene..."
+msgstr "Szene wird importiert..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2853,8 +2853,8 @@ msgid "Generating for Mesh: "
msgstr "Generierung für Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Angepasstes Skript wird ausgeführt.."
+msgid "Running Custom Script..."
+msgstr "Angepasstes Skript wird ausgeführt..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2869,8 +2869,8 @@ msgid "Error running post-import script:"
msgstr "Fehler beim ausführen des Post-Import Skripts:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Speichere.."
+msgid "Saving..."
+msgstr "Speichere..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2889,8 +2889,8 @@ msgid "Import As:"
msgstr "Importiere als:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Voreinstellungen.."
+msgid "Preset..."
+msgstr "Voreinstellungen..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3307,16 +3307,16 @@ msgid "Transition Node"
msgstr "Übergangs-Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Animationen importieren.."
+msgid "Import Animations..."
+msgstr "Animationen importieren..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Nodefilter bearbeiten"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filter.."
+msgid "Filters..."
+msgstr "Filter..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3383,8 +3383,8 @@ msgid "Fetching:"
msgstr "Hole:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Löse auf.."
+msgid "Resolving..."
+msgstr "Löse auf..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3450,8 +3450,8 @@ msgid "Site:"
msgstr "Seite:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Stabilität.."
+msgid "Support..."
+msgstr "Stabilität..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3487,8 +3487,8 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
msgstr ""
-"Erstellung der Lightmap-Bilder fehlgeschlagen. Ist der Speicherpfad "
-"beschreibbar?"
+"Erstellung der Lightmap-Bilder fehlgeschlagen. Stellen Sie sicher, dass der "
+"Speicherpfad beschreibbar ist."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Bake Lightmaps"
@@ -3650,6 +3650,7 @@ msgid "Use Rotation Snap"
msgstr "Rotationsraster benutzen"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Einrasten konfigurieren..."
@@ -3747,6 +3748,14 @@ msgid "Show Guides"
msgstr "Hilfslinien anzeigen"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Zeige Ursprung"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Zeige Ansichtsfenster (Viewport)"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Auswahl zentrieren"
@@ -4037,6 +4046,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Mesh hat keine Oberfläche von der Umrisse erzeugt werden könnten!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Der Mesh-Grundtyp ist nicht ist nicht PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Konnte keinen Umriss erzeugen!"
@@ -4065,8 +4078,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Konvexes Kollisionselement erzeugen"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Umriss-Mesh erzeugen.."
+msgid "Create Outline Mesh..."
+msgstr "Umriss-Mesh erzeugen..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4273,8 +4286,8 @@ msgid "Error loading image:"
msgstr "Fehler beim Laden des Bilds:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Keine Pixel mit einer Transparenz > 128 im Bild.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Keine Pixel mit einer Transparenz > 128 im Bild..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4634,8 +4647,8 @@ msgid "Import Theme"
msgstr "Motiv importieren"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Motiv speichern als.."
+msgid "Save Theme As..."
+msgstr "Motiv speichern als..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4731,8 +4744,8 @@ msgstr "Seitenleiste umschalten"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Finde.."
+msgid "Find..."
+msgstr "Finde..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4941,16 +4954,16 @@ msgid "Find Previous"
msgstr "Finde Vorheriges"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Ersetzen.."
+msgid "Replace..."
+msgstr "Ersetzen..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Springe zu Funktion.."
+msgid "Goto Function..."
+msgstr "Springe zu Funktion..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Springe zu Zeile.."
+msgid "Goto Line..."
+msgstr "Springe zu Zeile..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5403,12 +5416,8 @@ msgid "Transform"
msgstr "Transformation"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Einrasten konfigurieren.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Transformationsdialog.."
+msgid "Transform Dialog..."
+msgstr "Transformationsdialog..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5660,8 +5669,8 @@ msgid "Remove All"
msgstr "Alles entfernen"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Thema bearbeiten.."
+msgid "Edit theme..."
+msgstr "Thema bearbeiten..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5708,6 +5717,14 @@ msgid "Checked Item"
msgstr "Überprüftes Element"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Element der Auswahl"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Markiertes Element der Auswahl"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Enthält"
@@ -5720,8 +5737,8 @@ msgid "Options"
msgstr "Optionen"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Enthalten,Viele,Einige,Optionen!"
+msgid "Has,Many,Options"
+msgstr "Einstellungen"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5912,8 +5929,8 @@ msgid "Presets"
msgstr "Vorlagen"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Hinzufügen.."
+msgid "Add..."
+msgstr "Hinzufügen..."
#: editor/project_export.cpp
msgid "Resources"
@@ -6006,6 +6023,10 @@ msgid "Imported Project"
msgstr "Importiertes Projekt"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Ungültiger Projektname."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Ordner konnte nicht erstellt werden."
@@ -6023,11 +6044,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "Ungültiger Projektpfad (etwas geändert?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "project.godot des Projektpfads konnte nicht bearbeitet werden."
+msgstr ""
+"Konnte project.godot im Projektpfad nicht laden (Fehler %d). Sie könnte "
+"fehlen oder beschädigt worden sein."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6206,8 +6228,12 @@ msgid "Mouse Button"
msgstr "Maustaste"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Ungültiger Name für Aktion (alle Zeichen außer ‚/‘ und ‚:‘ möglich)."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Ungültiger Aktionsname. Er kann weder leer sein noch ‚/‘, ‚:‘, ‚=‘, ‘\\‘ "
+"oder ‚\"‘ enthalten."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6234,8 +6260,8 @@ msgid "Control+"
msgstr "Steuerung+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Drücke eine Taste.."
+msgid "Press a Key..."
+msgstr "Drücke eine Taste..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6350,10 +6376,6 @@ msgid "Delete Item"
msgstr "Eintrag löschen"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Darf nicht ‚/‘ oder ‚:‘ beinhalten"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Existiert bereits"
@@ -6422,8 +6444,8 @@ msgid "Property:"
msgstr "Eigenschaft:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Überschreiben für.."
+msgid "Override For..."
+msgstr "Überschreiben für..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6518,12 +6540,12 @@ msgid "Easing Out-In"
msgstr "Glätten Aus-Ein"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Datei.."
+msgid "File..."
+msgstr "Datei..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Verzeichnis.."
+msgid "Dir..."
+msgstr "Verzeichnis..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6698,8 +6720,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Diese Aktion kann nicht auf instantiierten Szenen ausgeführt werden."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Speichere neue Szene als.."
+msgid "Save New Scene As..."
+msgstr "Speichere neue Szene als..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7301,18 +7323,16 @@ msgid "Object can't provide a length."
msgstr "Objekt kann keine Länge vorweisen."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Nächster Tab"
+msgstr "Nächste Ebene"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Vorheriger Tab"
+msgstr "Vorherige Ebene"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Ebene:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7418,6 +7438,10 @@ msgstr "GridMap-Einstellungen"
msgid "Pick Distance:"
msgstr "Auswahlradius:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Der Klassenname kann nicht ein reserviertes Schlüsselwort sein"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Lösungen erzeugen..."
@@ -7448,7 +7472,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Über die C#-Unterstützung"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7466,6 +7490,10 @@ msgstr "Projekt bauen"
msgid "Warnings"
msgstr "Warnungen"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Ende des inneren Exception-Stack-Traces"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7650,7 +7678,7 @@ msgstr "Sequenz"
#: modules/visual_script/visual_script_editor.cpp
msgid "Switch"
-msgstr "Schalter"
+msgstr "Switch"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
@@ -7658,7 +7686,7 @@ msgstr "Iterator"
#: modules/visual_script/visual_script_editor.cpp
msgid "While"
-msgstr "Während"
+msgstr "While"
#: modules/visual_script/visual_script_editor.cpp
msgid "Return"
@@ -8031,11 +8059,11 @@ msgstr "ARVROrigin benötigt ein ARVRCamera-Unterobjekt"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Verbleibende Zeit: %d:%20d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8136,12 +8164,25 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Die Pfad-Eigenschaft muss auf ein gültiges Spatial-Node verweisen."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "Ein WorldEnvironment benötigt eine Environment-Ressource."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Pro Szene (oder einem Satz von instanzierten Szenen) ist nur ein einziges "
"WorldEnvironment erlaubt."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Dieses WorldEnvironment wird ignoriert. Entweder füge eine Kamera (für 3D-"
+"Szenen) hinzu oder setze den Hintergrund-Modus des Environments nach Canvas "
+"(für 2D-Szenen)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8243,6 +8284,27 @@ msgstr "Fehler beim Laden der Schriftart."
msgid "Invalid font size."
msgstr "Ungültige Schriftgröße."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Vorheriger Tab"
+
+#~ msgid "Next"
+#~ msgstr "Nächste"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr ""
+#~ "Ungültiger Name für Aktion (alle Zeichen außer ‚/‘ und ‚:‘ möglich)."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Darf nicht ‚/‘ oder ‚:‘ beinhalten"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ungültiges version.txt-Format in Templates. Revision ist kein gültiger "
+#~ "Bezeichner."
+
#~ msgid "Can't write file."
#~ msgstr "Konnte Datei nicht schreiben."
@@ -8255,9 +8317,6 @@ msgstr "Ungültige Schriftgröße."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "project.godot konnte nicht im Projektpfad gefunden werden."
-#~ msgid "Next"
-#~ msgstr "Nächste"
-
#~ msgid "Not found!"
#~ msgstr "Nicht gefunden!"
@@ -8406,7 +8465,7 @@ msgstr "Ungültige Schriftgröße."
#~ msgid "Exporting for %s"
#~ msgstr "Exportiere für %s"
-#~ msgid "Setting Up.."
+#~ msgid "Setting Up..."
#~ msgstr "Bereite vor..."
#~ msgid "Error loading scene."
@@ -8469,8 +8528,8 @@ msgstr "Ungültige Schriftgröße."
#~ msgid "Info"
#~ msgstr "Info"
-#~ msgid "Re-Import.."
-#~ msgstr "Neuimport.."
+#~ msgid "Re-Import..."
+#~ msgstr "Neuimport..."
#~ msgid "No bit masks to import!"
#~ msgstr "Keine Bitmasken zu importieren!"
@@ -8864,14 +8923,14 @@ msgstr "Ungültige Schriftgröße."
#~ msgid "Zoom (%):"
#~ msgstr "Vergrößerung (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Skelett.."
+#~ msgid "Skeleton..."
+#~ msgstr "Skelett..."
#~ msgid "Zoom Reset"
#~ msgstr "Vergrößerung zurücksetzen"
-#~ msgid "Zoom Set.."
-#~ msgstr "Vergrößerung setzen.."
+#~ msgid "Zoom Set..."
+#~ msgstr "Vergrößerung setzen..."
#~ msgid "Set a Value"
#~ msgstr "Einen Wert setzen"
@@ -9341,8 +9400,8 @@ msgstr "Ungültige Schriftgröße."
#~ msgid "Export Project PCK"
#~ msgstr "Exportiere Projekt-PCK"
-#~ msgid "Export.."
-#~ msgstr "Exportieren.."
+#~ msgid "Export..."
+#~ msgstr "Exportieren..."
#~ msgid "Project Export"
#~ msgstr "Projekt exportieren"
@@ -9407,8 +9466,8 @@ msgstr "Ungültige Schriftgröße."
#~ msgid "Method In Node:"
#~ msgstr "Methode in Node:"
-#~ msgid "Edit Connections.."
-#~ msgstr "Bearbeite Verbindungen.."
+#~ msgid "Edit Connections..."
+#~ msgstr "Bearbeite Verbindungen..."
#~ msgid "Plugin List:"
#~ msgstr "Plugin Liste:"
diff --git a/editor/translations/de_CH.po b/editor/translations/de_CH.po
index 38b337667e..26f824bc4b 100644
--- a/editor/translations/de_CH.po
+++ b/editor/translations/de_CH.po
@@ -495,7 +495,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -916,11 +916,11 @@ msgid "Move Audio Bus"
msgstr "Bild bewegen/einfügen"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1056,11 +1056,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1130,7 +1130,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1385,17 +1385,21 @@ msgstr ""
msgid "Clear Output"
msgstr "Script hinzufügen"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1604,11 +1608,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1621,7 +1625,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1676,7 +1680,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1824,7 +1828,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1836,11 +1840,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1861,15 +1865,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2119,7 +2123,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2231,7 +2235,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2382,7 +2386,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2398,12 +2402,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2467,7 +2465,7 @@ msgstr "Szene kann nicht gespeichert werden."
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "Connections editieren"
#: editor/export_template_manager.cpp
@@ -2485,7 +2483,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "Connections editieren"
#: editor/export_template_manager.cpp
@@ -2500,7 +2498,7 @@ msgstr "Verbindung zu Node:"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2641,11 +2639,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2658,16 +2656,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Node(s) duplizieren"
#: editor/filesystem_dock.cpp
@@ -2693,7 +2691,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2759,7 +2757,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2771,7 +2769,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2787,7 +2785,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2808,7 +2806,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3233,7 +3231,7 @@ msgid "Transition Node"
msgstr "Transition-Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3241,7 +3239,7 @@ msgid "Edit Node Filters"
msgstr "Node Filter editieren"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3312,7 +3310,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3380,7 +3378,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3573,6 +3571,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3669,6 +3668,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3960,6 +3967,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3988,7 +3999,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4196,7 +4207,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4565,7 +4576,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4662,7 +4673,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4871,15 +4882,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5337,11 +5348,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5597,7 +5604,7 @@ msgid "Remove All"
msgstr "Ungültige Bilder löschen"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5645,6 +5652,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5657,7 +5672,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5847,7 +5862,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5943,6 +5958,11 @@ msgstr "Importierte Projekte"
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Projektname:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Node erstellen"
@@ -6138,7 +6158,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6166,8 +6188,8 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Taste drücken.."
+msgid "Press a Key..."
+msgstr "Taste drücken..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6283,11 +6305,6 @@ msgid "Delete Item"
msgstr "Node(s) löschen"
#: editor/project_settings_editor.cpp
-#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "Verbindung zu Node:"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6358,7 +6375,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6455,11 +6472,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6636,7 +6653,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Das funktioniert nicht bei einer instanzierten Szene."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Neue Szene speichern als..."
#: editor/scene_tree_dock.cpp
@@ -7354,6 +7371,10 @@ msgstr "Projekteinstellungen"
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7403,6 +7424,10 @@ msgstr "Projektname:"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8033,10 +8058,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Die Pfad-Variable muss auf einen gültigen Particles2D Node verweisen."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8121,6 +8156,10 @@ msgid "Invalid font size."
msgstr ""
#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Verbindung zu Node:"
+
+#, fuzzy
#~ msgid "Can't write file."
#~ msgstr "Neues Projekt erstellen"
diff --git a/editor/translations/editor.pot b/editor/translations/editor.pot
index eb8a983eb4..1cb31e0ee9 100644
--- a/editor/translations/editor.pot
+++ b/editor/translations/editor.pot
@@ -488,7 +488,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -898,11 +898,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1038,11 +1038,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1111,7 +1111,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1364,17 +1364,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1579,11 +1583,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1595,7 +1599,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1647,7 +1651,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1792,7 +1796,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1804,11 +1808,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1828,15 +1832,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2081,7 +2085,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2190,7 +2194,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2341,7 +2345,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2357,12 +2361,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2423,7 +2421,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2440,7 +2438,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2453,7 +2451,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2585,11 +2583,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2601,15 +2599,15 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2635,7 +2633,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2701,7 +2699,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2713,7 +2711,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2729,7 +2727,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2749,7 +2747,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3163,7 +3161,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3171,7 +3169,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3239,7 +3237,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3263,19 +3261,19 @@ msgid "Download for this asset is already in progress!"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "first"
+msgid "First"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "prev"
+msgid "Previous"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "next"
+msgid "Next"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "last"
+msgid "Last"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3306,7 +3304,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3493,6 +3491,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3589,6 +3588,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3874,6 +3881,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3902,7 +3913,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4107,7 +4118,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4468,7 +4479,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4565,7 +4576,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4771,15 +4782,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5230,11 +5241,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5487,7 +5494,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5535,6 +5542,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5547,7 +5562,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5735,7 +5750,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5825,6 +5840,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6010,7 +6029,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6038,7 +6059,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6154,10 +6175,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6226,7 +6243,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6322,11 +6339,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6497,7 +6514,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7196,6 +7213,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7244,6 +7265,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7828,10 +7853,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/el.po b/editor/translations/el.po
index 3163d5c277..b3275b4647 100644
--- a/editor/translations/el.po
+++ b/editor/translations/el.po
@@ -8,7 +8,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-24 19:46+0000\n"
+"PO-Revision-Date: 2018-05-20 09:37+0000\n"
"Last-Translator: George Tsiamasiotis <gtsiam@windowslive.com>\n"
"Language-Team: Greek <https://hosted.weblate.org/projects/godot-engine/godot/"
"el/>\n"
@@ -16,7 +16,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 2.19-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -498,8 +498,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "ΑποσÏνδεση του '%s' απο το '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "ΣÏνδεση.."
+msgid "Connect..."
+msgstr "ΣÏνδεση..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -919,12 +919,12 @@ msgid "Move Audio Bus"
msgstr "Μετακίνηση διαÏλου ήχου"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Αποθήκευση διάταξης διαÏλων ήχου ÏŽÏ‚.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Αποθήκευση διάταξης διαÏλων ήχου ÏŽÏ‚..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Τοποθεσία για νέα διάταξη.."
+msgid "Location for New Layout..."
+msgstr "Τοποθεσία για νέα διάταξη..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1061,12 +1061,12 @@ msgid "Updating Scene"
msgstr "ΕνημέÏωση σκηνής"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Αποθήκευση τοπικών αλλαγών.."
+msgid "Storing local changes..."
+msgstr "Αποθήκευση τοπικών αλλαγών..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "ΕνημέÏωση σκηνής.."
+msgid "Updating scene..."
+msgstr "ΕνημέÏωση σκηνής..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1134,7 +1134,7 @@ msgid "Show In File Manager"
msgstr "Εμφάνιση στη διαχείÏιση αÏχείων"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "Îέος φάκελος"
#: editor/editor_file_dialog.cpp
@@ -1394,18 +1394,22 @@ msgstr "ΕκκαθάÏιση"
msgid "Clear Output"
msgstr "ΕκκαθάÏιση εξόδου"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Η εξαγωγή του έÏγου απέτυχε με κωδικό %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Σφάλμα κατά την αποθήκευση πόÏου!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Αποθήκευση πόÏου ως.."
+msgid "Save Resource As..."
+msgstr "Αποθήκευση πόÏου ως..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Εντάξει.."
+msgid "I see..."
+msgstr "Εντάξει..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1639,11 +1643,11 @@ msgid "Open Base Scene"
msgstr "Άνοιγμα σκηνής βάσης"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "ΓÏήγοÏο άνοιγμα σκηνής..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "ΓÏήγοÏη άνοιγμα δεσμής ενεÏγειών..."
#: editor/editor_node.cpp
@@ -1655,7 +1659,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "Αποθήκευση αλλαγών στο '%s' Ï€Ïιν το κλείσιμο;"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "Αποθήκευση σκηνή ως..."
#: editor/editor_node.cpp
@@ -1710,7 +1714,7 @@ msgstr ""
"επαναφοÏά;"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "ΓÏήγοÏη εκτέλεση σκηνής..."
#: editor/editor_node.cpp
@@ -1873,7 +1877,7 @@ msgid "Previous tab"
msgstr "ΠÏοηγοÏμενη καÏτέλα"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "ΦιλτÏάÏισμα αÏχείων..."
#: editor/editor_node.cpp
@@ -1885,12 +1889,12 @@ msgid "New Scene"
msgstr "Îέα σκηνή"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Îέα κληÏονομημένη σκηνή.."
+msgid "New Inherited Scene..."
+msgstr "Îέα κληÏονομημένη σκηνή..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Άνοιγμα σκηνής.."
+msgid "Open Scene..."
+msgstr "Άνοιγμα σκηνής..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1909,15 +1913,15 @@ msgid "Open Recent"
msgstr "Άνοιγμα Ï€Ïόσφατων"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "ΜετατÏοπή σε..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "Βιβλιοθήκη πλεγμάτων..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2182,7 +2186,7 @@ msgid "Save the currently edited resource."
msgstr "Αποθήκευσε το Ï„Ïέχων επεξεÏγαζόμενο πόÏο."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Αποθήκευση ως..."
#: editor/editor_node.cpp
@@ -2291,8 +2295,8 @@ msgid "Creating Mesh Previews"
msgstr "ΔημιουÏγία Ï€Ïοεπισκοπήσεων πλεγμάτων"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "ΜικÏογÏαφία.."
+msgid "Thumbnail..."
+msgstr "ΜικÏογÏαφία..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2444,8 +2448,8 @@ msgid "(Current)"
msgstr "(ΤÏέχων)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Ανάκτηση δεδοένων κατοπτÏισμοÏ, παÏακαλώ πεÏιμένετε.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Ανάκτηση δεδοένων κατοπτÏισμοÏ, παÏακαλώ πεÏιμένετε..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2460,14 +2464,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "ΆκυÏη μοÏφή version.txt μέσα στα Ï€Ïότυπα."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"ΆκυÏη μοÏφή version.txt μέσα στα Ï€Ïότυπα. Το Revision δεν είναι έγκυÏο "
-"αναγνωÏιστικό."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Δεν βÏέθηκε version.txt μέσα στα Ï€Ïότυπα."
@@ -2530,8 +2526,8 @@ msgid "Error requesting url: "
msgstr "Σφάλμα κατά Ï„o αίτημα για διεÏθηνση url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "ΣÏνδεση σε διακομιστή κατοπτÏισμοÏ.."
+msgid "Connecting to Mirror..."
+msgstr "ΣÏνδεση σε διακομιστή κατοπτÏισμοÏ..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2547,8 +2543,8 @@ msgstr "Δεν είναι δυνατή η επίλυση"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "ΣÏνδεση.."
+msgid "Connecting..."
+msgstr "ΣÏνδεση..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2560,8 +2556,8 @@ msgstr "Συνδέθηκε"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Γίνεται αίτημα.."
+msgid "Requesting..."
+msgstr "Γίνεται αίτημα..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2697,11 +2693,11 @@ msgid "Collapse all"
msgstr "ΣÏμπτηξη όλων"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "Μετονομασία..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Μετακίνηση σε"
#: editor/filesystem_dock.cpp
@@ -2713,15 +2709,15 @@ msgid "Instance"
msgstr "Στιγμιότυπο"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "ΕπεξεÏγασία εξαÏτήσεων"
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "ΠÏοβολή ιδιοκτητών"
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "ΑναπαÏαγωγή"
#: editor/filesystem_dock.cpp
@@ -2749,10 +2745,10 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"ΣάÏωση αÏχείων,\n"
-"ΠαÏακαλώ πεÏιμένετε.."
+"ΠαÏακαλώ πεÏιμένετε..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2817,7 +2813,7 @@ msgid "Import Scene"
msgstr "Εισαγωγή σκηνής"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "Εισαγωγή σκηνής..."
#: editor/import/resource_importer_scene.cpp
@@ -2829,7 +2825,7 @@ msgid "Generating for Mesh: "
msgstr "ΔημιουÏία για πλέγμα: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Εκτέλεση Ï€ÏοσαÏμοσμένης δέσμης ενεÏγειών..."
#: editor/import/resource_importer_scene.cpp
@@ -2847,7 +2843,7 @@ msgid "Error running post-import script:"
msgstr "Σφάλμα κατά την εκτέλεση της δέσμης ενεÏγειών μετ-εισαγωγής:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Αποθήκευση..."
#: editor/import_dock.cpp
@@ -2867,7 +2863,7 @@ msgid "Import As:"
msgstr "Εισαγωγή ώς:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr "ΔιαμόÏφωση..."
#: editor/import_dock.cpp
@@ -3285,16 +3281,16 @@ msgid "Transition Node"
msgstr "Κόμβος μετάβασης"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Εισαγωγή κινήσεων.."
+msgid "Import Animations..."
+msgstr "Εισαγωγή κινήσεων..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "ΕπεξεÏγασία φίλτÏων κόμβων"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "ΦίλτÏα.."
+msgid "Filters..."
+msgstr "ΦίλτÏα..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3362,7 +3358,7 @@ msgid "Fetching:"
msgstr "Λήψη:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "Επίλυση..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3429,8 +3425,8 @@ msgid "Site:"
msgstr "ΔιεÏθυνση:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "ΥποστήÏιξη.."
+msgid "Support..."
+msgstr "ΥποστήÏιξη..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3628,6 +3624,7 @@ msgid "Use Rotation Snap"
msgstr "ΧÏήση κουμπώματος πεÏιστÏοφής"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "ΔιαμόÏφωση κουμπώματος..."
@@ -3724,6 +3721,14 @@ msgid "Show Guides"
msgstr "Εμφάνιση οδηγών"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "ΠÏοβολή πηγής"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "ΠÏοβολή οπτικής γωνίας"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "ΚεντÏάÏισμα επιλογής"
@@ -4013,6 +4018,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Το πλέγμα δεν έχει επιφάνει από την οποία να δημιουÏγήσει πεÏιγÏάματα!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "O Ï€ÏωταÏχικός Ï„Ïπος δεν είναι PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Δεν ήταν δυνατή η δημιουÏγία πεÏιγÏάμματος!"
@@ -4041,8 +4050,8 @@ msgid "Create Convex Collision Sibling"
msgstr "ΔημιουÏγία Î±Î´ÎµÎ»Ï†Î¿Ï ÏƒÏγκÏουσης κυÏÏ„Î¿Ï ÏƒÏŽÎ¼Î±Ï„Î¿Ï‚"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "ΔημιουÏγία πλέγματος πεÏιγÏάμματος.."
+msgid "Create Outline Mesh..."
+msgstr "ΔημιουÏγία πλέγματος πεÏιγÏάμματος..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4250,8 +4259,8 @@ msgid "Error loading image:"
msgstr "Σφάλμα κατά την φόÏτωση εικόνας:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Δεν υπάÏχουν εικονοστοιχεία με διαφάνεια >128 στην εικόνα.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Δεν υπάÏχουν εικονοστοιχεία με διαφάνεια >128 στην εικόνα..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4611,8 +4620,8 @@ msgid "Import Theme"
msgstr "Εισαγωγή θέματος"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Αποθήκευση θέματος ως.."
+msgid "Save Theme As..."
+msgstr "Αποθήκευση θέματος ως..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4708,8 +4717,8 @@ msgstr "Εναλλαγή πλαισίου δεσμών ενεÏγειών"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "ΕÏÏεση.."
+msgid "Find..."
+msgstr "ΕÏÏεση..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4918,16 +4927,16 @@ msgid "Find Previous"
msgstr "ΈυÏεση Ï€ÏοηγοÏμενου"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Αντικατάσταση.."
+msgid "Replace..."
+msgstr "Αντικατάσταση..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Πήγαινε σε συνάÏτηση.."
+msgid "Goto Function..."
+msgstr "Πήγαινε σε συνάÏτηση..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Πήγαινε σε γÏαμμή.."
+msgid "Goto Line..."
+msgstr "Πήγαινε σε γÏαμμή..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5382,12 +5391,8 @@ msgid "Transform"
msgstr "Μετασχηματισμός"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "ΔιαμόÏφωση κουμπώματος.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Διάλογος μετασχηματισμοÏ.."
+msgid "Transform Dialog..."
+msgstr "Διάλογος μετασχηματισμοÏ..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5639,8 +5644,8 @@ msgid "Remove All"
msgstr "ΑφαίÏεση όλων"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "ΕπεξεÏγασία θέματος.."
+msgid "Edit theme..."
+msgstr "ΕπεξεÏγασία θέματος..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5687,6 +5692,14 @@ msgid "Checked Item"
msgstr "Επιλεγμένο στοιχείο"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Στοιχείο επιλογής"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Επιλεγμένο στοιχείο επιλογής"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Έχει"
@@ -5699,7 +5712,8 @@ msgid "Options"
msgstr "Επιλογές"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+#, fuzzy
+msgid "Has,Many,Options"
msgstr "Έχει,ΠάÏα,Πολλές,Επιλογές!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5892,8 +5906,8 @@ msgid "Presets"
msgstr "ΔιαμοÏφώσεις"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "ΠÏοσθήκη.."
+msgid "Add..."
+msgstr "ΠÏοσθήκη..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5987,6 +6001,11 @@ msgid "Imported Project"
msgstr "Εισαγμένο έÏγο"
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Όνομα έÏγου:"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "ΑδÏνατη η δημιουÏγία φακέλου."
@@ -6003,12 +6022,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "Μη έγκυÏη διαδÏομή έÏγου (Αλλάξατε τίποτα;)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
msgstr ""
-"Δεν ήταν δυνατή η επεξεÏγασία του project.godot στη διαδÏομή του έÏγου."
+"ΑδÏνατη η φόÏτωση του project.godot (σφάλμα %d). ΜποÏεί να λείπει ή να είναι "
+"κατεστÏαμένο."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6169,7 +6188,7 @@ msgid ""
"Would you like to explore the official example projects in the Asset Library?"
msgstr ""
"Δεν έχετε κανένα έÏγο.\n"
-"Θα θέλατε να εξεÏευνήσετε μεÏικά παÏαδείγματα στην βιβλιοθήκη πόÏων;"
+"Θέλετε να εξεÏευνήσετε μεÏικά παÏαδείγματα στην βιβλιοθήκη πόÏων;"
#: editor/project_settings_editor.cpp
msgid "Key "
@@ -6188,8 +6207,13 @@ msgid "Mouse Button"
msgstr "Κουμπί ποντικιοÏ"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Μη έγκυÏη ενέÏγεια (Όλα επιτÏέποντα εκτός από το '/' και το ':')."
+#, fuzzy
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"ΆκυÏο όνομα ενέÏγειας. Δεν μποÏεί να είναι άδειο ή να πεÏιέχει '/', ':', "
+"'=', '\\' ή '\"'"
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6216,8 +6240,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Πατήστε ένα κουμπί.."
+msgid "Press a Key..."
+msgstr "Πατήστε ένα κουμπί..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6332,10 +6356,6 @@ msgid "Delete Item"
msgstr "ΔιαγÏαφή αντικειμένου"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Δεν μποÏεί να πεÏιέχει '/' ή ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "ΥπάÏχει ήδη"
@@ -6404,7 +6424,7 @@ msgid "Property:"
msgstr "Ιδιότητα:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "ΠαÏάκαμψη για..."
#: editor/project_settings_editor.cpp
@@ -6500,12 +6520,12 @@ msgid "Easing Out-In"
msgstr "Ομαλή κίνηση από έξω Ï€Ïος τα μέσα"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "ΑÏχείο.."
+msgid "File..."
+msgstr "ΑÏχείο..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Κατάλογος.."
+msgid "Dir..."
+msgstr "Κατάλογος..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6681,8 +6701,8 @@ msgstr ""
"δημιουÏγηθεί στιγμιότυπα."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Αποθήκευση νέας σκηνής ως.."
+msgid "Save New Scene As..."
+msgstr "Αποθήκευση νέας σκηνής ως..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7287,18 +7307,16 @@ msgid "Object can't provide a length."
msgstr "Το αντικείμενο δεν έχει μήκος."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Επόμενη καÏτέλα"
+msgstr "Επόμενο επίπεδο"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "ΠÏοηγοÏμενη καÏτέλα"
+msgstr "ΠÏοηγοÏμενο επίπεδο"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Επίπεδο:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7404,6 +7422,10 @@ msgstr "Ρυθμίσεις GridMap"
msgid "Pick Distance:"
msgstr "Επιλογή απόστασης:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Το όνομα της κλάσης δεν μποÏεί να είναι λέξη-κλειδί"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "ΔημιουÏγία λÏσης..."
@@ -7434,7 +7456,7 @@ msgstr "Μονοφωνικό"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Σχετικά με την υποστήÏιξη C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7452,6 +7474,10 @@ msgstr "Δόμηση έÏγου"
msgid "Warnings"
msgstr "ΠÏοειδοποιήσεις"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Τέλος ιχνηλάτησης στοίβας εσωτεÏικής εξαίÏεσης"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8011,11 +8037,11 @@ msgstr "Το ARVROrigin απαιτεί έναν κόμβο ARVRCamera ως παÎ
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(ΟλοκλήÏωση σε: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8119,12 +8145,24 @@ msgstr ""
"δουλέψει αυτός ο κόμβος."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "Το WorldEnvironment χÏειάζεται έναν πόÏο Environment."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Μόνο ένα WorldEnvironment επιτÏέπεται σε κάθε σκηνή (ή σÏνολο στιγμιοτÏπων "
"σκηνών)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Αυτό το WorldEnvironment θα αγνοηθεί. ΠÏοσθέστε μια κάμεÏα (για 3d) ή οÏίστε "
+"το Background Mode Î±Ï…Ï„Î¿Ï Ï„Î¿Ï… πεÏιβάλλοντος σε Canvas (για 2d)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8222,6 +8260,26 @@ msgstr "Σφάλμα κατά την φόÏτωση της γÏαμματοσεÎ
msgid "Invalid font size."
msgstr "Μη έγκυÏο μέγεθος γÏαμματοσειÏάς."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "ΠÏοηγοÏμενη καÏτέλα"
+
+#~ msgid "Next"
+#~ msgstr "Επόμενο"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Μη έγκυÏη ενέÏγεια (Όλα επιτÏέποντα εκτός από το '/' και το ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Δεν μποÏεί να πεÏιέχει '/' ή ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "ΆκυÏη μοÏφή version.txt μέσα στα Ï€Ïότυπα. Το Revision δεν είναι έγκυÏο "
+#~ "αναγνωÏιστικό."
+
#~ msgid "Can't write file."
#~ msgstr "Δεν ήταν δυνατή η εγγÏαφή στο αÏχείο."
@@ -8236,9 +8294,6 @@ msgstr "Μη έγκυÏο μέγεθος γÏαμματοσειÏάς."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Δεν βÏέθηκε το project.godot στη διαδÏομή του έÏγου."
-#~ msgid "Next"
-#~ msgstr "Επόμενο"
-
#~ msgid "Not found!"
#~ msgstr "Δεν βÏέθηκε!"
@@ -8384,8 +8439,8 @@ msgstr "Μη έγκυÏο μέγεθος γÏαμματοσειÏάς."
#~ msgid "Exporting for %s"
#~ msgstr "Εξαγωγή για %s"
-#~ msgid "Setting Up.."
-#~ msgstr "ΑÏχικοποίηση.."
+#~ msgid "Setting Up..."
+#~ msgstr "ΑÏχικοποίηση..."
#~ msgid "Error loading scene."
#~ msgstr "Σφάλμα κατά τη φόÏτωση σκηνής."
@@ -8447,7 +8502,7 @@ msgstr "Μη έγκυÏο μέγεθος γÏαμματοσειÏάς."
#~ msgid "Info"
#~ msgstr "ΠληÏοφοÏίες"
-#~ msgid "Re-Import.."
+#~ msgid "Re-Import..."
#~ msgstr "Εκ νέου εισαγωγή..."
#~ msgid "No bit masks to import!"
@@ -8847,14 +8902,14 @@ msgstr "Μη έγκυÏο μέγεθος γÏαμματοσειÏάς."
#~ msgid "Zoom (%):"
#~ msgstr "Μεγέθυνση (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Σκελετός.."
+#~ msgid "Skeleton..."
+#~ msgstr "Σκελετός..."
#~ msgid "Zoom Reset"
#~ msgstr "ΕπαναφοÏά μεγέθυνσης"
-#~ msgid "Zoom Set.."
-#~ msgstr "ΟÏισμός μεγέθυνσης.."
+#~ msgid "Zoom Set..."
+#~ msgstr "ΟÏισμός μεγέθυνσης..."
#~ msgid "Set a Value"
#~ msgstr "ΟÏισμός τιμής"
diff --git a/editor/translations/es.po b/editor/translations/es.po
index 591efe631e..89118d2501 100644
--- a/editor/translations/es.po
+++ b/editor/translations/es.po
@@ -2,35 +2,39 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Addiel Lucena Perez <addiell2017@gmail.com>, 2017.
-# Aleix Sanchis <aleixsanchis@hotmail.com>, 2017.
+# Aleix Sanchis <aleixsanchis@hotmail.com>, 2017, 2018.
# Alejandro Alvarez <eliluminado00@gmail.com>, 2017.
+# Avocado <avocadosan42@gmail.com>, 2018.
# BLaDoM GUY <simplybladom@gmail.com>, 2017.
# Carlos López <genetita@gmail.com>, 2016.
# David Arranz <davarrcal@hotmail.com>, 2018.
# David Couto <davidcouto@gmail.com>, 2017.
# Dharkael <izhe@hotmail.es>, 2017.
# Diego López <diegodario21@gmail.com>, 2017.
+# eon-s <emanuel.segretin@gmail.com>, 2018.
# Gustavo Leon <gleondiaz@gmail.com>, 2017-2018.
+# Javier Ocampos <xavier.ocampos@gmail.com>, 2018.
+# Jose Maria Martinez <josemar1992@hotmail.com>, 2018.
# Juan Quiroga <juanquiroga9@gmail.com>, 2017.
# Kiji Pixel <raccoon.fella@gmail.com>, 2017.
# Lisandro Lorea <lisandrolorea@gmail.com>, 2016-2017.
# Lonsfor <lotharw@protonmail.com>, 2017-2018.
# Mario Nachbaur <manachbaur@gmail.com>, 2018.
# Oscar Carballal <oscar.carballal@protonmail.com>, 2017-2018.
-# Rabid Orange <theorangerabid@gmail.com>, 2017.
+# R. Joshua Seville <rjoshua@protonmail.com>, 2018.
+# Rabid Orange <theorangerabid@gmail.com>, 2017, 2018.
# Roger Blanco Ribera <roger.blancoribera@gmail.com>, 2016-2018.
# Sebastian Silva <sebastian@fuentelibre.org>, 2016.
# Swyter <swyterzone@gmail.com>, 2016-2017.
# Vazquinhos <vazquinhos@gmail.com>, 2018.
-#
+# Yovani Damián <blackblex@gmail.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-02-19 20:49+0000\n"
-"Last-Translator: anonymous <>\n"
+"PO-Revision-Date: 2018-06-22 08:31+0000\n"
+"Last-Translator: R. Joshua Seville <rjoshua@protonmail.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/"
"godot/es/>\n"
"Language: es\n"
@@ -38,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 2.19\n"
+"X-Generator: Weblate 3.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -46,15 +50,15 @@ msgstr "Desactivado"
#: editor/animation_editor.cpp
msgid "All Selection"
-msgstr "Toda la selección"
+msgstr "Toda la Selección"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr "Cambiar el tiempo de la clave de animación"
+msgstr "Cambiar el tiempo del Fotograma Clave de Animación"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Cambiar transición de animación"
+msgstr "Cambiar Transición de Animación"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
@@ -62,76 +66,76 @@ msgstr "Cambiar transformación de animación"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr "Cambiar valor de la clave de animación"
+msgstr "Cambiar valor del Fotograma Clave de Animación"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
-msgstr "Cambiar llamada de animación"
+msgstr "Cambiar Llamada de Animación"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
-msgstr "Añadir pista de animación"
+msgstr "Añadir Pista de Animación"
#: editor/animation_editor.cpp
msgid "Anim Duplicate Keys"
-msgstr "Duplicar claves de animación"
+msgstr "Duplicar Claves de Animación"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
-msgstr "Subir pista de animación"
+msgstr "Subir Pista de Animación"
#: editor/animation_editor.cpp
msgid "Move Anim Track Down"
-msgstr "Bajar pista de animación"
+msgstr "Bajar Pista de Animación"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr "Quitar pista de animación"
+msgstr "Quitar Pista de Animación"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr "Establecer transiciones en:"
+msgstr "Establecer Transiciones en:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr "Renombrar pista de animación"
+msgstr "Renombrar Pista de Animación"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr "Cambiar interpolación de pista de animación"
+msgstr "Cambiar Interpolación de Pista de Animación"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr "Cambiar modo de valor de pista de animación"
+msgstr "Cambiar Modo de Valor de Pista de Animación"
#: editor/animation_editor.cpp
msgid "Anim Track Change Wrap Mode"
-msgstr "Cambiar modo de ciclo de pista de animación"
+msgstr "Cambiar Modo de Ciclo de Pista de Animación"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
-msgstr "Editar nodo de curva"
+msgstr "Editar Nodo de Curva"
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
-msgstr "Editar curva de selección"
+msgstr "Editar Curva de Selección"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
-msgstr "Borrar claves de animación"
+msgstr "Borrar Claves de Animación"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Duplicate Selection"
-msgstr "Duplicar selección"
+msgstr "Duplicar Selección"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
-msgstr "Duplicar transpuesto"
+msgstr "Duplicar Transpuesto"
#: editor/animation_editor.cpp
msgid "Remove Selection"
-msgstr "Quitar selección"
+msgstr "Quitar Selección"
#: editor/animation_editor.cpp
msgid "Continuous"
@@ -147,15 +151,15 @@ msgstr "Trigger"
#: editor/animation_editor.cpp
msgid "Anim Add Key"
-msgstr "Añadir clave de animación"
+msgstr "Añadir Clave de Animación"
#: editor/animation_editor.cpp
msgid "Anim Move Keys"
-msgstr "Mover claves de animación"
+msgstr "Mover Claves de Animación"
#: editor/animation_editor.cpp
msgid "Scale Selection"
-msgstr "Escalar selección"
+msgstr "Escalar Selección"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
@@ -163,11 +167,11 @@ msgstr "Escalar desde cursor"
#: editor/animation_editor.cpp
msgid "Goto Next Step"
-msgstr "Ir al siguiente paso"
+msgstr "Ir al Siguiente Paso"
#: editor/animation_editor.cpp
msgid "Goto Prev Step"
-msgstr "Ir al paso anterior"
+msgstr "Ir al Paso Anterior"
#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
#: editor/property_editor.cpp
@@ -200,11 +204,11 @@ msgstr "Transiciones"
#: editor/animation_editor.cpp
msgid "Optimize Animation"
-msgstr "Optimizar animación"
+msgstr "Optimizar Animación"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation"
-msgstr "Limpiar animación"
+msgstr "Limpiar Animación"
#: editor/animation_editor.cpp
msgid "Create NEW track for %s and insert key?"
@@ -224,31 +228,31 @@ msgstr "Crear"
#: editor/animation_editor.cpp
msgid "Anim Create & Insert"
-msgstr "Crear e insertar animación"
+msgstr "Crear e Insertar Animación"
#: editor/animation_editor.cpp
msgid "Anim Insert Track & Key"
-msgstr "Insertar pista y clave de animación"
+msgstr "Insertar Pista y Clave de Animación"
#: editor/animation_editor.cpp
msgid "Anim Insert Key"
-msgstr "Insertar clave de animación"
+msgstr "Insertar Clave de Animación"
#: editor/animation_editor.cpp
msgid "Change Anim Len"
-msgstr "Cambiar duración de animación"
+msgstr "Cambiar Duración de Animación"
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
-msgstr "Cambiar repeticiones de animación"
+msgstr "Cambiar Bucle de Animación"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
-msgstr "Crear clave de valor de tipo para animación"
+msgstr "Crear Clave de Valor Tipado para Animación"
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr "Insertar animación"
+msgstr "Insertar Animación"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
@@ -256,7 +260,7 @@ msgstr "Escalar Claves de Animación"
#: editor/animation_editor.cpp
msgid "Anim Add Call Track"
-msgstr "Añadir «call track» de Animación"
+msgstr "Añadir Call Track de Animación"
#: editor/animation_editor.cpp
msgid "Animation zoom."
@@ -264,15 +268,15 @@ msgstr "Zoom de Animación."
#: editor/animation_editor.cpp
msgid "Length (s):"
-msgstr "Duración (s):"
+msgstr "Duración (segs.):"
#: editor/animation_editor.cpp
msgid "Animation length (in seconds)."
-msgstr "Duración de Animación (en segundos)."
+msgstr "Duración de la Animación (en segundos)."
#: editor/animation_editor.cpp
msgid "Step (s):"
-msgstr "Paso (s):"
+msgstr "Paso(s):"
#: editor/animation_editor.cpp
msgid "Cursor step snap (in seconds)."
@@ -304,7 +308,7 @@ msgstr "Herramientas de pistas"
#: editor/animation_editor.cpp
msgid "Enable editing of individual keys by clicking them."
-msgstr "Editar claves individuales al hacer clic."
+msgstr "Habilitar la edición de claves individuales al hacer clic."
#: editor/animation_editor.cpp
msgid "Anim. Optimizer"
@@ -342,11 +346,11 @@ msgstr "Transición"
#: editor/animation_editor.cpp
msgid "Scale Ratio:"
-msgstr "Relación de Escalado:"
+msgstr "Relación de Escala:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr "¿En qué nodo quieres llamar funciones?"
+msgstr "¿Desde que Nodo quieres realizar Llamadas a Funciones?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
@@ -438,19 +442,19 @@ msgstr "Columna:"
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
-msgstr "¡Debes establecer un método en el nodo seleccionado!"
+msgstr "¡Debes establecer un método en el Nodo seleccionado!"
#: editor/connections_dialog.cpp
msgid ""
"Target method not found! Specify a valid method or attach a script to target "
"Node."
msgstr ""
-"No se ha encontrado el método objetivo. Especifica un método válido o "
-"adjunta un script en el Nodo objetivo."
+"No se encontró el método del objetivo! Especifica un método válido o adjunta "
+"un script al Nodo objetivo."
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
-msgstr "Conectar a nodo:"
+msgstr "Conectar a Nodo:"
#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
@@ -475,7 +479,7 @@ msgstr "Argumentos extras de llamada:"
#: editor/connections_dialog.cpp
msgid "Path to Node:"
-msgstr "Ruta al nodo:"
+msgstr "Ruta al Nodo:"
#: editor/connections_dialog.cpp
msgid "Make Function"
@@ -487,7 +491,7 @@ msgstr "Diferido"
#: editor/connections_dialog.cpp
msgid "Oneshot"
-msgstr "Una vez"
+msgstr "OneShot"
#: editor/connections_dialog.cpp editor/dependency_editor.cpp
#: editor/export_template_manager.cpp
@@ -513,15 +517,15 @@ msgstr "Conectar «%s» a «%s»"
#: editor/connections_dialog.cpp
msgid "Connecting Signal:"
-msgstr "Conectando señal:"
+msgstr "Conectando Señal:"
#: editor/connections_dialog.cpp
msgid "Disconnect '%s' from '%s'"
msgstr "Desconectar '%s' de '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Conectar.."
+msgid "Connect..."
+msgstr "Conectar..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -543,7 +547,7 @@ msgstr "Cambiar"
#: editor/create_dialog.cpp
msgid "Create New %s"
-msgstr "Crear nuevo %s"
+msgstr "Crear Nuevo %s"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
@@ -622,7 +626,7 @@ msgstr "Arreglar rota(s)"
#: editor/dependency_editor.cpp
msgid "Dependency Editor"
-msgstr "Editor de dependencias"
+msgstr "Editor de Dependencias"
#: editor/dependency_editor.cpp
msgid "Search Replacement Resource:"
@@ -713,7 +717,7 @@ msgstr "Eliminar"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Key"
-msgstr "Cambiar Clave de Diccionario"
+msgstr "Cambiar Clave del Diccionario"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Value"
@@ -733,7 +737,7 @@ msgstr "Contribuidores de Godot"
#: editor/editor_about.cpp
msgid "Project Founders"
-msgstr "Fundadores del proyecto"
+msgstr "Fundadores del Proyecto"
#: editor/editor_about.cpp
msgid "Lead Developer"
@@ -753,11 +757,11 @@ msgstr "Autores"
#: editor/editor_about.cpp
msgid "Platinum Sponsors"
-msgstr "Patrocinadores Platino"
+msgstr "Patrocinadores Platinum"
#: editor/editor_about.cpp
msgid "Gold Sponsors"
-msgstr "Patrocinadores Oro"
+msgstr "Patrocinadores Gold"
#: editor/editor_about.cpp
msgid "Mini Sponsors"
@@ -765,11 +769,11 @@ msgstr "Mini Patrocinadores"
#: editor/editor_about.cpp
msgid "Gold Donors"
-msgstr "Donantes Oro"
+msgstr "Donantes Gold"
#: editor/editor_about.cpp
msgid "Silver Donors"
-msgstr "Donantes Plata"
+msgstr "Donantes Silver"
#: editor/editor_about.cpp
msgid "Bronze Donors"
@@ -847,15 +851,15 @@ msgstr "Añadir Efecto"
#: editor/editor_audio_buses.cpp
msgid "Rename Audio Bus"
-msgstr "Renombrar bus de audio"
+msgstr "Renombrar Bus de Audio"
#: editor/editor_audio_buses.cpp
msgid "Change Audio Bus Volume"
-msgstr "Cambiar volumen del bus de audio"
+msgstr "Cambiar Volumen de Bus de Audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
-msgstr "Alternar Audio Bus Solo"
+msgstr "Act./Desact. Solo de Bus de Audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Mute"
@@ -867,7 +871,7 @@ msgstr "Alternar puenteado de efectos en Bus de Audio"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr "Seleccionar envío a bus de audio"
+msgstr "Seleccionar Envío de Audio Bus"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
@@ -879,7 +883,7 @@ msgstr "Mover Efecto de Bus"
#: editor/editor_audio_buses.cpp
msgid "Delete Bus Effect"
-msgstr "Borrar Efecto de Bus"
+msgstr "Eliminar Efecto de Bus"
#: editor/editor_audio_buses.cpp
msgid "Audio Bus, Drag and Drop to rearrange."
@@ -895,7 +899,7 @@ msgstr "Silenciar"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
-msgstr "Puentear"
+msgstr "Bypass"
#: editor/editor_audio_buses.cpp
msgid "Bus options"
@@ -943,12 +947,12 @@ msgid "Move Audio Bus"
msgstr "Mover Bus de Audio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Guardar configuración de los Buses de Audio como..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Ruta para nueva configuración.."
+msgid "Location for New Layout..."
+msgstr "Ubicación para Nueva Configuración..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1036,7 +1040,7 @@ msgstr "No está en la ruta de recursos."
#: editor/editor_autoload_settings.cpp
msgid "Add AutoLoad"
-msgstr "Añadir «AutoLoad»"
+msgstr "Añadir AutoLoad"
#: editor/editor_autoload_settings.cpp
msgid "Autoload '%s' already exists!"
@@ -1044,19 +1048,19 @@ msgstr "¡El fichero «%s» ya existe!"
#: editor/editor_autoload_settings.cpp
msgid "Rename Autoload"
-msgstr "Renombrar «Autoload»"
+msgstr "Renombrar Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Toggle AutoLoad Globals"
-msgstr "Des/activar globales de «Autoload»"
+msgstr "Des/Activar Globales de Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Move Autoload"
-msgstr "Mover «Autoload»"
+msgstr "Mover Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Remove Autoload"
-msgstr "Quitar «Autoload»"
+msgstr "Quitar Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Enable"
@@ -1064,7 +1068,7 @@ msgstr "Activar"
#: editor/editor_autoload_settings.cpp
msgid "Rearrange Autoloads"
-msgstr "Reordenar «Autoloads»"
+msgstr "Reordenar Autoloads"
#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
#: scene/gui/file_dialog.cpp
@@ -1073,7 +1077,7 @@ msgstr "Ruta:"
#: editor/editor_autoload_settings.cpp
msgid "Node Name:"
-msgstr "Nombre del nodo:"
+msgstr "Nombre del Nodo:"
#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
#: editor/project_manager.cpp editor/settings_config_dialog.cpp
@@ -1082,19 +1086,19 @@ msgstr "Nombre"
#: editor/editor_autoload_settings.cpp
msgid "Singleton"
-msgstr "«Singleton»"
+msgstr "Singleton"
#: editor/editor_data.cpp
msgid "Updating Scene"
-msgstr "Actualizando escena"
+msgstr "Actualizando Escena"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Guardando cambios locales.."
+msgid "Storing local changes..."
+msgstr "Guardando cambios locales..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Actualizando escena.."
+msgid "Updating scene..."
+msgstr "Actualizando escena..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1106,7 +1110,7 @@ msgstr "[no guardado]"
#: editor/editor_dir_dialog.cpp
msgid "Please select a base directory first"
-msgstr "Por favor, primero seleccione un directorio base"
+msgstr "Por favor, selecciona primero un directorio base"
#: editor/editor_dir_dialog.cpp
msgid "Choose a Directory"
@@ -1162,7 +1166,7 @@ msgid "Show In File Manager"
msgstr "Mostrar en el navegador de archivos"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "Nueva carpeta..."
#: editor/editor_file_dialog.cpp
@@ -1422,18 +1426,22 @@ msgstr "Borrar todo"
msgid "Clear Output"
msgstr "Borrar salida"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "La exportación del proyecto falló con el código de error %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "¡Hubo un error al guardar el recurso!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Guardar recurso como.."
+msgid "Save Resource As..."
+msgstr "Guardar Recurso Como..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Ya veo.."
+msgid "I see..."
+msgstr "Ya veo..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1469,7 +1477,7 @@ msgstr "Error al cargar '%s'."
#: editor/editor_node.cpp
msgid "Saving Scene"
-msgstr "Guardar escena"
+msgstr "Guardar Escena"
#: editor/editor_node.cpp
msgid "Analyzing"
@@ -1582,7 +1590,7 @@ msgstr "Expandir todas las propiedades"
#: editor/editor_node.cpp
msgid "Collapse all properties"
-msgstr "Colapsar todo"
+msgstr "Ocultar todas las propiedades"
#: editor/editor_node.cpp
msgid "Copy Params"
@@ -1606,7 +1614,7 @@ msgstr "Convertirlo en integrado"
#: editor/editor_node.cpp
msgid "Make Sub-Resources Unique"
-msgstr "Hacer sub-recursos únicos"
+msgstr "Creación de Subrecursos Únicos"
#: editor/editor_node.cpp
msgid "Open in Help"
@@ -1658,31 +1666,31 @@ msgstr "¡No se pudo comenzar el subproceso!"
#: editor/editor_node.cpp
msgid "Open Scene"
-msgstr "Abrir escena"
+msgstr "Abrir Escena"
#: editor/editor_node.cpp
msgid "Open Base Scene"
-msgstr "Abrir escena base"
+msgstr "Abrir Escena Base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Apertura rápida de escena.."
+msgid "Quick Open Scene..."
+msgstr "Apertura Rápida de Escena..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Apertura rápida de script.."
+msgid "Quick Open Script..."
+msgstr "Apertura Rápida de Script..."
#: editor/editor_node.cpp
msgid "Save & Close"
-msgstr "Guardar & Cerrar"
+msgstr "Guardar y Cerrar"
#: editor/editor_node.cpp
msgid "Save changes to '%s' before closing?"
msgstr "¿Guardar cambios de '%s' antes de cerrar?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Guardar escena como.."
+msgid "Save Scene As..."
+msgstr "Guardar Escena Como..."
#: editor/editor_node.cpp
msgid "No"
@@ -1736,8 +1744,8 @@ msgstr ""
"modos?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Ejecución rápida de escena.."
+msgid "Quick Run Scene..."
+msgstr "Ejecución Rápida de Escena..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1775,7 +1783,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Pick a Main Scene"
-msgstr "Elige una escena principal"
+msgstr "Elige una Escena Principal"
#: editor/editor_node.cpp
msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
@@ -1838,11 +1846,11 @@ msgstr "Limpiar Escenas Recientes"
#: editor/editor_node.cpp
msgid "Save Layout"
-msgstr "Guardar ajustes"
+msgstr "Guardar Ajustes"
#: editor/editor_node.cpp
msgid "Delete Layout"
-msgstr "Borrar ajustes"
+msgstr "Borrar Ajustes"
#: editor/editor_node.cpp editor/import_dock.cpp
#: editor/script_create_dialog.cpp
@@ -1851,7 +1859,7 @@ msgstr "Predeterminado"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr "Cambiar pestaña de escena"
+msgstr "Cambiar Pestaña de Escena"
#: editor/editor_node.cpp
msgid "%d more files or folders"
@@ -1879,11 +1887,11 @@ msgstr "Alternar modo sin distracciones."
#: editor/editor_node.cpp
msgid "Add a new scene."
-msgstr "Añadir nueva Escena."
+msgstr "Añadir nueva escena."
#: editor/editor_node.cpp
msgid "Scene"
-msgstr "Escena"
+msgstr "Escenas"
#: editor/editor_node.cpp
msgid "Go to previously opened scene."
@@ -1898,8 +1906,8 @@ msgid "Previous tab"
msgstr "Pestaña anterior"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrado de archivos.."
+msgid "Filter Files..."
+msgstr "Filtrado de Archivos..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1907,19 +1915,19 @@ msgstr "Operaciones con archivos de escena."
#: editor/editor_node.cpp
msgid "New Scene"
-msgstr "Nueva escena"
+msgstr "Nueva Escena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Nueva escena heredada.."
+msgid "New Inherited Scene..."
+msgstr "Nueva Escena Heredada..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Abrir escena.."
+msgid "Open Scene..."
+msgstr "Abrir Escena..."
#: editor/editor_node.cpp
msgid "Save Scene"
-msgstr "Guardar escena"
+msgstr "Guardar Escena"
#: editor/editor_node.cpp
msgid "Save all Scenes"
@@ -1934,16 +1942,16 @@ msgid "Open Recent"
msgstr "Abrir reciente"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Convertir a.."
+msgid "Convert To..."
+msgstr "Convertir a..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "Librería de mallas.."
+msgid "MeshLibrary..."
+msgstr "Librería de mallas..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "\"TileSet\".."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -1957,7 +1965,7 @@ msgstr "Rehacer"
#: editor/editor_node.cpp
msgid "Revert Scene"
-msgstr "Revertir escena"
+msgstr "Revertir Escena"
#: editor/editor_node.cpp
msgid "Miscellaneous project or scene-wide tools."
@@ -1969,11 +1977,11 @@ msgstr "Proyecto"
#: editor/editor_node.cpp
msgid "Project Settings"
-msgstr "Ajustes del proyecto"
+msgstr "Ajustes del Proyecto"
#: editor/editor_node.cpp
msgid "Run Script"
-msgstr "Ejecutar script"
+msgstr "Ejecutar Script"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export"
@@ -1981,7 +1989,7 @@ msgstr "Exportar"
#: editor/editor_node.cpp
msgid "Tools"
-msgstr "Herramientas"
+msgstr "Tools"
#: editor/editor_node.cpp
msgid "Quit to Project List"
@@ -2084,11 +2092,11 @@ msgstr "Editor"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
-msgstr "Ajustes del editor"
+msgstr "Ajustes del Editor"
#: editor/editor_node.cpp
msgid "Editor Layout"
-msgstr "Ajustes de diseño del editor"
+msgstr "Ajustes de Diseño del Editor"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
@@ -2096,7 +2104,7 @@ msgstr "Modo Pantalla Completa"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
-msgstr "Cargando Plantillas de Exportación"
+msgstr "Cargar Plantillas de Exportación"
#: editor/editor_node.cpp
msgid "Help"
@@ -2135,7 +2143,7 @@ msgstr "Acerca de"
#: editor/editor_node.cpp
msgid "Play the project."
-msgstr "Inicia el proyecto para poder jugarlo."
+msgstr "Reproducir el proyecto."
#: editor/editor_node.cpp
msgid "Play"
@@ -2206,8 +2214,8 @@ msgid "Save the currently edited resource."
msgstr "Guardar el recurso editado actualmente."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Guardar como.."
+msgid "Save As..."
+msgstr "Guardar Como..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2236,11 +2244,11 @@ msgstr "Importar"
#: editor/editor_node.cpp
msgid "Node"
-msgstr "Nodo"
+msgstr "Nodos"
#: editor/editor_node.cpp
msgid "FileSystem"
-msgstr "SistDeArchivos"
+msgstr "Sistema de Archivos"
#: editor/editor_node.cpp
msgid "Output"
@@ -2256,7 +2264,7 @@ msgstr "Importar plantillas desde un archivo ZIP"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export Project"
-msgstr "Exportar proyecto"
+msgstr "Exportar Proyecto"
#: editor/editor_node.cpp
msgid "Export Library"
@@ -2276,7 +2284,7 @@ msgstr "Abrir y ejecutar un script"
#: editor/editor_node.cpp
msgid "New Inherited"
-msgstr "Nueva escena heredada"
+msgstr "Nueva Escena Heredada"
#: editor/editor_node.cpp
msgid "Load Errors"
@@ -2315,8 +2323,8 @@ msgid "Creating Mesh Previews"
msgstr "Creando vistas previas de las mallas"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatura.."
+msgid "Thumbnail..."
+msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2418,7 +2426,7 @@ msgstr "No se pudo instanciar el script:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
-msgstr "Has olvidado la palabra clave 'tool'?"
+msgstr "¿Olvidaste la palabra clave 'tool'?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
@@ -2430,19 +2438,19 @@ msgstr "Te olvidaste del método '_run'?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
-msgstr "Predeterminado (Igual que el editor)"
+msgstr "Predeterminado (Igual que el Editor)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
-msgstr "Selecciona nodos a importar"
+msgstr "Selecciona Nodos a importar"
#: editor/editor_sub_scene.cpp
msgid "Scene Path:"
-msgstr "Ruta a la escena:"
+msgstr "Ruta de la Escena:"
#: editor/editor_sub_scene.cpp
msgid "Import From Node:"
-msgstr "Importar desde nodo:"
+msgstr "Importar desde Nodo:"
#: editor/export_template_manager.cpp
msgid "Re-Download"
@@ -2469,7 +2477,7 @@ msgid "(Current)"
msgstr "(Actual)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Obteniendo mirrors, por favor espere..."
#: editor/export_template_manager.cpp
@@ -2485,14 +2493,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Formato de \"version.txt\" inválido dentro de las plantillas."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"El archivo \"version.txt\" que hay dentro de las plantillas tiene un formato "
-"inválido. \"Revisión\" no es un identificador válido."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "No se ha encontrado el archivo version.txt dentro de las plantillas."
@@ -2555,8 +2555,8 @@ msgid "Error requesting url: "
msgstr "Error al solicitar url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Intentando conexión alternativa.."
+msgid "Connecting to Mirror..."
+msgstr "Intentando conexión alternativa..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2572,8 +2572,8 @@ msgstr "No se puede resolver"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Conectando.."
+msgid "Connecting..."
+msgstr "Conectando..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2585,8 +2585,8 @@ msgstr "Conectado"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Solicitando.."
+msgid "Requesting..."
+msgstr "Solicitando..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2723,32 +2723,32 @@ msgid "Collapse all"
msgstr "Colapsar todo"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Renombrar.."
+msgid "Rename..."
+msgstr "Renombrar..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Mover a.."
+msgid "Move To..."
+msgstr "Mover a..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
-msgstr "Abrir escena/s"
+msgstr "Abrir Escena(s)"
#: editor/filesystem_dock.cpp
msgid "Instance"
msgstr "Instanciar"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Editar dependencias.."
+msgid "Edit Dependencies..."
+msgstr "Editar Dependencias..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Ver propietarios.."
+msgid "View Owners..."
+msgstr "Ver Propietarios..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Duplicar.."
+msgid "Duplicate..."
+msgstr "Duplicar..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2760,7 +2760,7 @@ msgstr "Carpeta siguiente"
#: editor/filesystem_dock.cpp
msgid "Re-Scan Filesystem"
-msgstr "Reanalizar sistema de archivos"
+msgstr "Reanalizar Sistema de Archivos"
#: editor/filesystem_dock.cpp
msgid "Toggle folder status as Favorite"
@@ -2774,7 +2774,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Escaneando archivos,\n"
"Por favor, espere..."
@@ -2842,8 +2842,8 @@ msgid "Import Scene"
msgstr "Importar escena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Importando escena.."
+msgid "Importing Scene..."
+msgstr "Importando Escena..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2854,8 +2854,8 @@ msgid "Generating for Mesh: "
msgstr "Generando para modelo: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Ejecutando script personalizado.."
+msgid "Running Custom Script..."
+msgstr "Ejecutando Script Personalizado..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2871,8 +2871,8 @@ msgid "Error running post-import script:"
msgstr "Error ejecutando el script de posimportacion:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Guardando.."
+msgid "Saving..."
+msgstr "Guardando..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2891,8 +2891,8 @@ msgid "Import As:"
msgstr "Importar como:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Ajuste.."
+msgid "Preset..."
+msgstr "Ajuste..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -2908,7 +2908,7 @@ msgstr "Grupos"
#: editor/node_dock.cpp
msgid "Select a Node to edit Signals and Groups."
-msgstr "Selecciona un nodo para editar señales y grupos."
+msgstr "Selecciona un Nodo para editar Señales y Grupos."
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -2947,9 +2947,9 @@ msgid ""
"RMB: Erase Point."
msgstr ""
"Editar polígono existente:\n"
-"Click izquierdo: Mover punto.\n"
-"Control + Click izquierdo: Dividir segmento.\n"
-"Click derecho: Borrar punto."
+"Clic izquierdo: Mover punto.\n"
+"Control + Clic izquierdo: Dividir segmento.\n"
+"Clic derecho: Borrar punto."
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Delete points"
@@ -3086,11 +3086,11 @@ msgstr "Mostrar la lista de animaciones en el reproductor."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Autoplay on Load"
-msgstr "Autoreproducir al cargar"
+msgstr "Autoreproducir al Cargar"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Edit Target Blend Times"
-msgstr "Editar tiempos de mezcla de selección"
+msgstr "Editar tiempos de mezcla con otras animaciones"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Tools"
@@ -3118,7 +3118,7 @@ msgstr "Anterior"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Future"
-msgstr "Futuro"
+msgstr "Posterior"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Depth"
@@ -3207,7 +3207,7 @@ msgstr "Mezcla"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix"
-msgstr "Mezclar"
+msgstr "Mix"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Auto Restart:"
@@ -3252,7 +3252,7 @@ msgstr "Actual:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Add Input"
-msgstr "Añadir entrada"
+msgstr "Añadir Entrada"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Clear Auto-Advance"
@@ -3264,7 +3264,7 @@ msgstr "Establecer autoavanzar"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Delete Input"
-msgstr "Eliminar entrada"
+msgstr "Eliminar Entrada"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation tree is valid."
@@ -3276,15 +3276,15 @@ msgstr "El árbol de animación no es correcto."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation Node"
-msgstr "Nodo de animación"
+msgstr "Nodo de Animación"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "OneShot Node"
-msgstr "Nodo UnaVez"
+msgstr "Nodo OneShot"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix Node"
-msgstr "Nodo Mezcla"
+msgstr "Nodo Mix"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend2 Node"
@@ -3300,7 +3300,7 @@ msgstr "Nodo Blend4"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeScale Node"
-msgstr "Nodo TimeScale (Escala de tiempo)"
+msgstr "Nodo TimeScale"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeSeek Node"
@@ -3308,19 +3308,19 @@ msgstr "Nodo TimeSeek"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Transition Node"
-msgstr "Nodo de transición"
+msgstr "Nodo Transition"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importar animaciones.."
+msgid "Import Animations..."
+msgstr "Importar Animaciones..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
-msgstr "Editar filtros de nodo"
+msgstr "Editar Filtros de Nodo"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filtros.."
+msgid "Filters..."
+msgstr "Filtros..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3387,7 +3387,7 @@ msgid "Fetching:"
msgstr "Buscando:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "Resolviendo..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3454,8 +3454,8 @@ msgid "Site:"
msgstr "Sitio:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Soporte.."
+msgid "Support..."
+msgstr "Soporte..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3495,7 +3495,7 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Bake Lightmaps"
-msgstr "Calculando «lightmaps»"
+msgstr "Calculando Lightmaps"
#: editor/plugins/camera_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3509,20 +3509,20 @@ msgstr "Configurar ajuste"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid Offset:"
-msgstr "Desplazamiento de rejilla:"
+msgstr "Desplazamiento de Cuadrícula:"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid Step:"
-msgstr "Pasos de rejilla:"
+msgstr "Paso de Cuadrícula:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation Offset:"
-msgstr "Desplazamiento de rotación:"
+msgstr "Desplazamiento de Rotación:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation Step:"
-msgstr "Cantidad de rotaciones:"
+msgstr "Cantidad de Rotaciones:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Pivot"
@@ -3604,7 +3604,7 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+RMB: Depth list selection"
-msgstr "Alt+Click Der.: Selección en listado de solapamientos"
+msgstr "Alt + Clic Derecho: Selección en listado de solapamientos"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Mode"
@@ -3620,12 +3620,13 @@ msgid ""
"Show a list of all objects at the position clicked\n"
"(same as Alt+RMB in select mode)."
msgstr ""
-"Mostrar una lista de todos los objetos en la posición cliqueada\n"
-"(igual que Alt+Click Der. en modo selección)."
+"Mostrar una lista de todos los objetos en la posición en la que se ha hecho "
+"clic\n"
+"(igual que Alt + Clic Derecho en modo selección)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Click to change object's rotation pivot."
-msgstr "Click para cambiar el pivote de rotación de un objeto."
+msgstr "Haz clic para cambiar el pivote de rotación de un objeto."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Pan Mode"
@@ -3652,8 +3653,9 @@ msgid "Use Rotation Snap"
msgstr "Ajustar rotación"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "Configurar fijado..."
+msgstr "Configurar Ajuste..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3673,7 +3675,7 @@ msgstr "Ajustar al padre"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node anchor"
-msgstr "Ajustar al anclado del nodo"
+msgstr "Ajustar al anclaje del nodo"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node sides"
@@ -3733,7 +3735,7 @@ msgstr "Ver"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Show Grid"
-msgstr "Mostrar rejilla"
+msgstr "Mostrar Cuadrícula"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Helpers"
@@ -3748,6 +3750,14 @@ msgid "Show Guides"
msgstr "Mostrar guías"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Ver Origen"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Ver Viewport"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centrar selección"
@@ -3765,11 +3775,11 @@ msgstr "Insertar claves"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key"
-msgstr "Insertar clave"
+msgstr "Insertar Clave"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
-msgstr "Insertar clave (pistas existentes)"
+msgstr "Insertar Clave (Pistas Existentes)"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Copy Pose"
@@ -3814,7 +3824,7 @@ msgstr "No se pueden instanciar varios nodos sin un nodo raíz."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Create Node"
-msgstr "Crear nodo"
+msgstr "Crear Nodo"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -4039,6 +4049,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "¡La malla no tiene superficie de la que crear contornos!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "El tipo de la malla primitiva no es PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "¡No se pudo crear el contorno!"
@@ -4067,8 +4081,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Crear colisión hermanada convexa"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Crear contorno de malla.."
+msgid "Create Outline Mesh..."
+msgstr "Crear Contorno de Malla..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4214,7 +4228,7 @@ msgstr "Calculando tamaño de cuadrícula..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating heightfield..."
-msgstr "Creando octree de luces (\"heigfield\")..."
+msgstr "Creando heightfield..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Marking walkable triangles..."
@@ -4238,7 +4252,7 @@ msgstr "Creando contornos..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating polymesh..."
-msgstr "Crear malla 3D de contorno (\"polymesh\")..."
+msgstr "Crear polymesh..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Converting to native navigation mesh..."
@@ -4250,7 +4264,7 @@ msgstr "Configuración del Generador de Mallas de Navegación:"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Parsing Geometry..."
-msgstr "Analizando geometría..."
+msgstr "Analizando Geometría..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Done!"
@@ -4275,8 +4289,8 @@ msgid "Error loading image:"
msgstr "Error al cargar la imagen:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "No hay píxeles con transparencia > 128 en la imagen.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "No hay píxeles con transparencia > 128 en la imagen..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4318,11 +4332,11 @@ msgstr "Colores de emisión"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry."
-msgstr "El nodo no contiene geometría."
+msgstr "El nodo no posee geometría."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry (faces)."
-msgstr "El nodo no contiene geometría (caras)."
+msgstr "El nodo no posee geometría (caras)."
#: editor/plugins/particles_editor_plugin.cpp
msgid "A processor material of type 'ParticlesMaterial' is required."
@@ -4346,7 +4360,7 @@ msgstr "Crear puntos de emisión desde malla"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Node"
-msgstr "Crear puntos de emisión desde el nodo"
+msgstr "Crear Puntos de Emisión desde el Nodo"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emitter"
@@ -4418,12 +4432,12 @@ msgstr "Mayús + arrastrar: Seleccionar puntos de control"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Click: Add Point"
-msgstr "Click: Añadir punto"
+msgstr "Clic: Añadir Punto"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Right Click: Delete Point"
-msgstr "Clic derecho: Eliminar punto"
+msgstr "Clic Derecho: Eliminar Punto"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Select Control Points (Shift+Drag)"
@@ -4552,7 +4566,7 @@ msgstr "Habilitar fijado"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid"
-msgstr "Rejilla"
+msgstr "Cuadrícula"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "ERROR: Couldn't load resource!"
@@ -4578,7 +4592,7 @@ msgstr "¡El portapapeles de recursos está vacío!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
msgid "Open in Editor"
-msgstr "Abrir en el editor"
+msgstr "Abrir en el Editor"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
@@ -4636,8 +4650,8 @@ msgid "Import Theme"
msgstr "Importar tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Guardar tema como.."
+msgid "Save Theme As..."
+msgstr "Guardar Tema Como..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4733,8 +4747,8 @@ msgstr "Alternar panel de scripts"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Buscar.."
+msgid "Find..."
+msgstr "Buscar..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4843,7 +4857,7 @@ msgstr "Minúscula"
#: editor/plugins/script_text_editor.cpp
msgid "Capitalize"
-msgstr "Convertir en Mayúsculas"
+msgstr "Poner en mayúsculas"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
@@ -4907,7 +4921,7 @@ msgstr "Convertir Indentación a Espacios"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Tabs"
-msgstr "Convertir indentación a tabuladores"
+msgstr "Convertir Indentación a Tabuladores"
#: editor/plugins/script_text_editor.cpp
msgid "Auto Indent"
@@ -4920,7 +4934,7 @@ msgstr "Des/activar «breakpoint»"
#: editor/plugins/script_text_editor.cpp
msgid "Remove All Breakpoints"
-msgstr "Desactivar todos los «breakpoints»"
+msgstr "Borrar todos los «breakpoints»"
#: editor/plugins/script_text_editor.cpp
msgid "Goto Next Breakpoint"
@@ -4943,16 +4957,16 @@ msgid "Find Previous"
msgstr "Buscar anterior"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Reemplazar.."
+msgid "Replace..."
+msgstr "Reemplazar..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Ir a función.."
+msgid "Goto Function..."
+msgstr "Ir a función..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Ir a línea.."
+msgid "Goto Line..."
+msgstr "Ir a línea..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -4960,7 +4974,7 @@ msgstr "Ayuda contextual"
#: editor/plugins/shader_editor_plugin.cpp
msgid "Shader"
-msgstr "\"Shader\""
+msgstr "Shader"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Constant"
@@ -5052,27 +5066,27 @@ msgstr "Cambiar Nombre de Entrada"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Connect Graph Nodes"
-msgstr "Conectar Nodos de Gráfico"
+msgstr "Conectar Nodos Gráficos"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Disconnect Graph Nodes"
-msgstr "Desconectar Nodo de Gráfico"
+msgstr "Desconectar Nodos Gráficos"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Remove Shader Graph Node"
-msgstr "Quitar Nodo de Gráfico de Shaders"
+msgstr "Eliminar el Nodo Gráfico del Shader"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Move Shader Graph Node"
-msgstr "Mover Nodo de Gráfico de Shaders"
+msgstr "Mover el Nodo Gráfico del Shader"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Duplicate Graph Node(s)"
-msgstr "Duplicar Nodo(s) de Gráfico"
+msgstr "Duplicar Nodo(s) Gráfico"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Delete Shader Graph Node(s)"
-msgstr "Quitar Nodo(s) de Gráfico de Shaders"
+msgstr "Eliminar Nodo(s) Gráfico(s) del Shader"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Error: Cyclic Connection Link"
@@ -5084,7 +5098,7 @@ msgstr "Error: Conexiones de Entrada Faltantes"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add Shader Graph Node"
-msgstr "Añadir nodo de gráfico de Shader"
+msgstr "Añadir Nodo Gráfico del Shader"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Orthogonal"
@@ -5112,7 +5126,7 @@ msgstr "Transformación en el eje Z."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Plane Transform."
-msgstr "Ver transformación en plano."
+msgstr "Ver Transformación de Plano."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scaling: "
@@ -5128,11 +5142,11 @@ msgstr "Girando %s grados."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Keying is disabled (no key inserted)."
-msgstr "Poner claves está desactivado (no se insertaron claves)."
+msgstr "Insertar claves está desactivado (no se insertaron claves)."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Animation Key Inserted."
-msgstr "Clave de animación insertada."
+msgstr "Clave de Animación Insertada."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Objects Drawn"
@@ -5144,7 +5158,7 @@ msgstr "Cambios del material"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Shader Changes"
-msgstr "Cambios de shader"
+msgstr "Cambios del Shader"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Surface Changes"
@@ -5164,11 +5178,11 @@ msgstr "FPS"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View."
-msgstr "Vista superior."
+msgstr "Vista Superior."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View."
-msgstr "Vista inferior."
+msgstr "Vista Inferior."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom"
@@ -5176,7 +5190,7 @@ msgstr "Fondo"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left View."
-msgstr "Vista izquierda."
+msgstr "Vista Izquierda."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left"
@@ -5184,7 +5198,7 @@ msgstr "Izquierda"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right View."
-msgstr "Vista derecha."
+msgstr "Vista Derecha."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right"
@@ -5192,7 +5206,7 @@ msgstr "Derecha"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View."
-msgstr "Vista frontal."
+msgstr "Vista Frontal."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front"
@@ -5200,7 +5214,7 @@ msgstr "Frente"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View."
-msgstr "Vista anterior."
+msgstr "Vista Posterior."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear"
@@ -5268,31 +5282,31 @@ msgstr "Activar Doppler"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
-msgstr "Vista libre izquierda"
+msgstr "Vista Libre Izquierda"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Right"
-msgstr "Vista libre derecha"
+msgstr "Vista Libre Derecha"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Forward"
-msgstr "Vista libre frente"
+msgstr "Vista Libre Frontal"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Backwards"
-msgstr "Vista libre atrás"
+msgstr "Vista Libre Posterior"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Up"
-msgstr "Vista libre arriba"
+msgstr "Vista Libre Arriba"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Down"
-msgstr "Vista libre abajo"
+msgstr "Vista Libre Abajo"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Speed Modifier"
-msgstr "Modificador de velocidad de \"vista libre\""
+msgstr "Modificador de Velocidad de Vista Libre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "XForm Dialog"
@@ -5310,7 +5324,7 @@ msgid ""
msgstr ""
"Arrastrar: Rotar\n"
"Alt + Arrastrar: Mover\n"
-"Alt + Click derecho: Selección en la lista de superposición"
+"Alt + Clic Derecho: Selección en la lista de superposición"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Move Mode (W)"
@@ -5326,7 +5340,7 @@ msgstr "Modo escalado (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
-msgstr "Coordenadas locales"
+msgstr "Local Coords (Coordenadas Locales)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
@@ -5338,35 +5352,35 @@ msgstr "Modo de ajuste (%s)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
-msgstr "Vista inferior"
+msgstr "Vista Inferior"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View"
-msgstr "Vista superior"
+msgstr "Vista Superior"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View"
-msgstr "Vista anterior"
+msgstr "Vista Posterior"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View"
-msgstr "Vista frontal"
+msgstr "Vista Frontal"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left View"
-msgstr "Vista izquierda"
+msgstr "Vista Izquierda"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right View"
-msgstr "Vista derecha"
+msgstr "Vista Derecha"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Switch Perspective/Orthogonal view"
-msgstr "Intercambiar entre vista de perspectiva y ortogonal"
+msgstr "Intercambiar vista Perspectiva/Ortogonal"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Insert Animation Key"
-msgstr "Insertar clave de animación"
+msgstr "Insertar Clave de Animación"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Focus Origin"
@@ -5398,23 +5412,19 @@ msgstr "Escalar"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Toggle Freelook"
-msgstr "Alternar vista libre"
+msgstr "Activar Vista Libre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform"
-msgstr "Transformar"
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configurar ajuste.."
+msgstr "Transform"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Ventana de transformación.."
+msgid "Transform Dialog..."
+msgstr "Ventana de transformación..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
-msgstr "1 visor"
+msgstr "1 Viewport"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports"
@@ -5442,7 +5452,7 @@ msgstr "Ver origen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Grid"
-msgstr "Ver rejilla"
+msgstr "Ver Cuadrícula"
#: editor/plugins/spatial_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
@@ -5471,7 +5481,7 @@ msgstr "Ajuste de escala (%):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Viewport Settings"
-msgstr "Ajustes del visor"
+msgstr "Ajustes del Viewport"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Perspective FOV (deg.):"
@@ -5579,7 +5589,7 @@ msgstr "Mover (Después)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "SpriteFrames"
-msgstr "Fotogramas del sprite"
+msgstr "SpriteFrames"
#: editor/plugins/style_box_editor_plugin.cpp
msgid "StyleBox Preview:"
@@ -5607,7 +5617,7 @@ msgstr "Ajustar a píxeles"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Grid Snap"
-msgstr "Ajustar a cuadrícula"
+msgstr "Ajustar a Cuadrícula"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Auto Slice"
@@ -5662,8 +5672,8 @@ msgid "Remove All"
msgstr "Quitar todos"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Editar tema.."
+msgid "Edit theme..."
+msgstr "Editar tema..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5710,6 +5720,14 @@ msgid "Checked Item"
msgstr "Casilla de verificación activa"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Radio Item"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Ratio Item Activo"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Tiene"
@@ -5722,8 +5740,8 @@ msgid "Options"
msgstr "Opciones"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "¡Tienes,Muchas,Y,Variadas,Opciones!"
+msgid "Has,Many,Options"
+msgstr "Tienes, Muchas, Opciones"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5767,7 +5785,7 @@ msgstr "Borrar selección"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint TileMap"
-msgstr "Pintar TileMap"
+msgstr "Dibujar TileMap"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Line Draw"
@@ -5779,7 +5797,7 @@ msgstr "Dibujar Rectángulo"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Bucket Fill"
-msgstr "Cubo"
+msgstr "Cubo de relleno"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Erase TileMap"
@@ -5807,7 +5825,7 @@ msgstr "Voltear verticalmente"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint Tile"
-msgstr "Pintar Tile"
+msgstr "Dibujar Tile"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Pick Tile"
@@ -5843,11 +5861,11 @@ msgstr "¿Crear desde escena?"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Merge from scene?"
-msgstr "¿Mergear desde escena?"
+msgstr "¿Mezclar desde escena?"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Tile Set"
-msgstr "\"Tile Set\""
+msgstr "Tile Set"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5863,23 +5881,23 @@ msgstr "Error"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Autotiles"
-msgstr "\"Autotiles\""
+msgstr "Autotiles"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid ""
"Select sub-tile to use as icon, this will be also used on invalid autotile "
"bindings."
msgstr ""
-"Seleccione sub-tile para utilizar como icono, este se utilizará también en "
-"enlaces de autotile no válidos."
+"Seleccione sub-tile para utilizar como icono, éste se utilizará también en "
+"enlazados automáticos no válidos."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid ""
"LMB: set bit on.\n"
"RMB: set bit off."
msgstr ""
-"Click izquierdo: habilitar bit.\n"
-"Click derecho: deshabilitar bit."
+"Clic Izquierdo: habilitar bit.\n"
+"Clic Derecho: deshabilitar bit."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select current edited sub-tile."
@@ -5915,8 +5933,8 @@ msgid "Presets"
msgstr "Preajustes"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Añadir.."
+msgid "Add..."
+msgstr "Añadir..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5924,7 +5942,7 @@ msgstr "Recursos"
#: editor/project_export.cpp
msgid "Export all resources in the project"
-msgstr "Exportar todos los recursos en el proyecto"
+msgstr "Exportar todos los recursos del proyecto"
#: editor/project_export.cpp
msgid "Export selected scenes (and dependencies)"
@@ -5991,7 +6009,7 @@ msgstr ""
#: editor/project_export.cpp
msgid "Export With Debug"
-msgstr "Exportar con depuración"
+msgstr "Exportar con Depuración"
#: editor/project_manager.cpp
msgid "The path does not exist."
@@ -6007,7 +6025,11 @@ msgstr "Por favor elija una carpeta vacía."
#: editor/project_manager.cpp
msgid "Imported Project"
-msgstr "Proyecto importado"
+msgstr "Proyecto Importado"
+
+#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Nombre de Proyecto Inválido."
#: editor/project_manager.cpp
msgid "Couldn't create folder."
@@ -6026,11 +6048,12 @@ 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.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "No se pudo editar project.godot en la ruta del proyecto."
+msgstr ""
+"No se pudo cargar project.godot desde la ruta de proyecto (error %d). La "
+"ruta no existe o está corrupta."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6050,11 +6073,11 @@ msgstr "Renombrar proyecto"
#: editor/project_manager.cpp
msgid "New Game Project"
-msgstr "Nuevo proyecto de juego"
+msgstr "Nuevo Proyecto de Juego"
#: editor/project_manager.cpp
msgid "Import Existing Project"
-msgstr "Importar proyecto existente"
+msgstr "Importar Proyecto Existente"
#: editor/project_manager.cpp
msgid "Import & Edit"
@@ -6062,7 +6085,7 @@ msgstr "Importar y editar"
#: editor/project_manager.cpp
msgid "Create New Project"
-msgstr "Crear proyecto nuevo"
+msgstr "Crear Nuevo Proyecto"
#: editor/project_manager.cpp
msgid "Create & Edit"
@@ -6070,7 +6093,7 @@ msgstr "Crear y editar"
#: editor/project_manager.cpp
msgid "Install Project:"
-msgstr "Instalar proyecto:"
+msgstr "Instalar Proyecto:"
#: editor/project_manager.cpp
msgid "Install & Edit"
@@ -6078,7 +6101,7 @@ msgstr "Instalar y editar"
#: editor/project_manager.cpp
msgid "Project Name:"
-msgstr "Nombre del proyecto:"
+msgstr "Nombre del Proyecto:"
#: editor/project_manager.cpp
msgid "Create folder"
@@ -6086,7 +6109,7 @@ msgstr "Crear carpeta"
#: editor/project_manager.cpp
msgid "Project Path:"
-msgstr "Ruta del proyecto:"
+msgstr "Ruta del Proyecto:"
#: editor/project_manager.cpp
msgid "Browse"
@@ -6094,7 +6117,7 @@ msgstr "Examinar"
#: editor/project_manager.cpp
msgid "Unnamed Project"
-msgstr "Proyecto sin nombre"
+msgstr "Proyecto sin Nombre"
#: editor/project_manager.cpp
msgid "Can't open project"
@@ -6111,8 +6134,8 @@ msgid ""
"the \"Application\" category."
msgstr ""
"No hay una escena principal definida para ejecutar el proyecto.\n"
-"Por favor elija la escena principal en \"Ajustes del proyecto\" en la "
-"categoría \"Aplicación\"."
+"Por favor elija la escena principal en \"Ajustes del Proyecto\" en la "
+"categoría \"Application\"."
#: editor/project_manager.cpp
msgid ""
@@ -6129,8 +6152,8 @@ msgstr "¿Seguro que quieres ejecutar más de un proyecto?"
#: editor/project_manager.cpp
msgid "Remove project from the list? (Folder contents will not be modified)"
msgstr ""
-"¿Quieres quitar proyecto de la lista? (El contenido de la carpeta no se "
-"modificarán)"
+"¿Quieres quitar el proyecto de la lista? (El contenido de la carpeta no se "
+"modificará)"
#: editor/project_manager.cpp
msgid ""
@@ -6167,7 +6190,7 @@ msgstr "Selecciona la carpeta a analizar"
#: editor/project_manager.cpp
msgid "New Project"
-msgstr "Proyecto nuevo"
+msgstr "Nuevo Proyecto"
#: editor/project_manager.cpp
msgid "Templates"
@@ -6190,8 +6213,9 @@ msgid ""
"You don't currently have any projects.\n"
"Would you like to explore the official example projects in the Asset Library?"
msgstr ""
-"Ahora mismo no tiene ningún proyecto.\n"
-"¿Le gustaría explorar los proyectos ejemplo oficiales del Asset Library?"
+"Actualmente no tienes ningún proyecto.\n"
+"¿Quieres explorar los proyectos de ejemplo oficiales en la Biblioteca de "
+"Assets?"
#: editor/project_settings_editor.cpp
msgid "Key "
@@ -6210,8 +6234,12 @@ msgid "Mouse Button"
msgstr "Botón del ratón"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "La acción no es correcta (no puedes utilizar «/» o «:»)."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Nombre de acción inválido. No puede estar vacío ni contener '/', ':', '=', "
+"'\\' o '\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6219,11 +6247,11 @@ msgstr "¡La acción «%s» ya existe!"
#: editor/project_settings_editor.cpp
msgid "Rename Input Action Event"
-msgstr "Renombrar evento de acción de entrada"
+msgstr "Renombrar Evento de Acción de Entrada"
#: editor/project_settings_editor.cpp
msgid "Add Input Action Event"
-msgstr "Añadir evento de acción de entrada"
+msgstr "Añadir Evento de Acción de Entrada"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "Shift+"
@@ -6238,8 +6266,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Presiona una tecla.."
+msgid "Press a Key..."
+msgstr "Presiona una tecla..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6295,11 +6323,11 @@ msgstr "Ãndice de boton del mando:"
#: editor/project_settings_editor.cpp
msgid "Erase Input Action"
-msgstr "Borrar \"Input Action\""
+msgstr "Borrar Acción de Entrada"
#: editor/project_settings_editor.cpp
msgid "Erase Input Action Event"
-msgstr "Borrar evento de acción de entrada"
+msgstr "Borrar Evento de Acción de Entrada"
#: editor/project_settings_editor.cpp
msgid "Add Event"
@@ -6354,16 +6382,12 @@ msgid "Delete Item"
msgstr "Eliminar elemento"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "No puede contener '/' o ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Ya existe"
#: editor/project_settings_editor.cpp
msgid "Add Input Action"
-msgstr "Añadir acción de entrada"
+msgstr "Añadir Acción de Entrada"
#: editor/project_settings_editor.cpp
msgid "Error saving settings."
@@ -6375,7 +6399,7 @@ msgstr "Los ajustes se han guardado correctamente."
#: editor/project_settings_editor.cpp
msgid "Override for Feature"
-msgstr "Sobreescribir para esta característica"
+msgstr "Sobrescribir la Característica"
#: editor/project_settings_editor.cpp
msgid "Add Translation"
@@ -6426,12 +6450,12 @@ msgid "Property:"
msgstr "Propiedad:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Sobre escribir por.."
+msgid "Override For..."
+msgstr "Sustituir por..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
-msgstr "Mapa de entradas"
+msgstr "Mapa de Entradas"
#: editor/project_settings_editor.cpp
msgid "Action:"
@@ -6499,7 +6523,7 @@ msgstr "AutoLoad"
#: editor/property_editor.cpp
msgid "Pick a Viewport"
-msgstr "Selecciona un visor"
+msgstr "Selecciona un Viewport"
#: editor/property_editor.cpp
msgid "Ease In"
@@ -6522,12 +6546,12 @@ msgid "Easing Out-In"
msgstr "Transición salida-entrada"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Archivo.."
+msgid "File..."
+msgstr "Archivo..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Directorio.."
+msgid "Dir..."
+msgstr "Directorio..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6535,7 +6559,7 @@ msgstr "Asignar"
#: editor/property_editor.cpp
msgid "Select Node"
-msgstr "Seleccionar nodo"
+msgstr "Seleccionar Nodo"
#: editor/property_editor.cpp
msgid "New Script"
@@ -6563,11 +6587,11 @@ msgstr "Error al cargar el archivo: ¡No es un recurso!"
#: editor/property_editor.cpp
msgid "Selected node is not a Viewport!"
-msgstr "¡El nodo seleccionado no es un visor!"
+msgstr "¡El nodo seleccionado no es un Viewport!"
#: editor/property_editor.cpp
msgid "Pick a Node"
-msgstr "Selecciona un nodo"
+msgstr "Selecciona un Nodo"
#: editor/property_editor.cpp
msgid "Bit %d, val %d."
@@ -6612,7 +6636,7 @@ msgstr ""
#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
msgid "Reparent Node"
-msgstr "Reemparentar nodo"
+msgstr "Reemparentar Nodo"
#: editor/reparent_dialog.cpp
msgid "Reparent Location (Select new Parent):"
@@ -6685,11 +6709,11 @@ msgstr "Mover Nodos Dentro del Padre"
#: editor/scene_tree_dock.cpp
msgid "Duplicate Node(s)"
-msgstr "Duplicar nodos"
+msgstr "Duplicar Nodo(s)"
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)?"
-msgstr "¿Quieres borrar los nodos?"
+msgstr "¿Eliminar Nodo(s)?"
#: editor/scene_tree_dock.cpp
msgid "Can not perform with the root node."
@@ -6700,20 +6724,20 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Esta operación no puede realizarse en escenas instanciadas."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Guardar nueva escena como.."
+msgid "Save New Scene As..."
+msgstr "Guardar Nueva Escena Como..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
-msgstr "Hijos editables"
+msgstr "Hijos Editables"
#: editor/scene_tree_dock.cpp
msgid "Load As Placeholder"
-msgstr "Cargar como temporal"
+msgstr "Cargar como Temporal"
#: editor/scene_tree_dock.cpp
msgid "Discard Instancing"
-msgstr "Descartar instancia"
+msgstr "Descartar Instancia"
#: editor/scene_tree_dock.cpp
msgid "Makes Sense!"
@@ -6729,7 +6753,7 @@ msgstr "¡No se puede operar sobre los nodos heredados por la escena actual!"
#: editor/scene_tree_dock.cpp
msgid "Remove Node(s)"
-msgstr "Borrar nodos"
+msgstr "Eliminar Nodo(s)"
#: editor/scene_tree_dock.cpp
msgid ""
@@ -6737,7 +6761,7 @@ msgid ""
"satisfied."
msgstr ""
"No se pudo guardar la escena nueva. Es posible que no se hayan podido "
-"satisfacer las dependencias (instancias)."
+"resolver las dependencias (instancias)."
#: editor/scene_tree_dock.cpp
msgid "Error saving scene."
@@ -6749,31 +6773,31 @@ msgstr "Error al duplicar escena para guardarla."
#: editor/scene_tree_dock.cpp
msgid "Sub-Resources"
-msgstr "Sub-recursos"
+msgstr "Sub-Recursos"
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance"
-msgstr "Limpiar heredado"
+msgstr "Limpiar Heredado"
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)"
-msgstr "Borrar nodos"
+msgstr "Eliminar Nodo(s)"
#: editor/scene_tree_dock.cpp
msgid "Add Child Node"
-msgstr "Añadir nodo hijo"
+msgstr "Añadir Nodo Hijo"
#: editor/scene_tree_dock.cpp
msgid "Instance Child Scene"
-msgstr "Instanciar escena hija"
+msgstr "Instanciar Escena Hija"
#: editor/scene_tree_dock.cpp
msgid "Change Type"
-msgstr "Cambiar tipo"
+msgstr "Cambiar Tipo"
#: editor/scene_tree_dock.cpp
msgid "Attach Script"
-msgstr "Adjuntar script"
+msgstr "Añadir Script"
#: editor/scene_tree_dock.cpp
msgid "Clear Script"
@@ -6781,7 +6805,7 @@ msgstr "Quitar script"
#: editor/scene_tree_dock.cpp
msgid "Merge From Scene"
-msgstr "Unir desde escena"
+msgstr "Unir Desde Escena"
#: editor/scene_tree_dock.cpp
msgid "Save Branch as Scene"
@@ -6789,22 +6813,22 @@ msgstr "Guardar Rama como Escena"
#: editor/scene_tree_dock.cpp
msgid "Copy Node Path"
-msgstr "Copiar ruta del nodo"
+msgstr "Copiar Ruta del Nodo"
#: editor/scene_tree_dock.cpp
msgid "Delete (No Confirm)"
-msgstr "Eliminar (sin confirmar)"
+msgstr "Eliminar (Sin Confirmar)"
#: editor/scene_tree_dock.cpp
msgid "Add/Create a New Node"
-msgstr "Añadir/crear nodo nuevo"
+msgstr "Añadir/Crear un Nuevo Nodo"
#: editor/scene_tree_dock.cpp
msgid ""
"Instance a scene file as a Node. Creates an inherited scene if no root node "
"exists."
msgstr ""
-"Instanciar un archivo de escena como Nodo. Crear una escena heredada si no "
+"Instanciar un archivo de escena como Nodo. Crea una escena heredada si no "
"existe ningún nodo raíz."
#: editor/scene_tree_dock.cpp
@@ -6813,11 +6837,11 @@ msgstr "Filtrar nodos"
#: editor/scene_tree_dock.cpp
msgid "Attach a new or existing script for the selected node."
-msgstr "Adjuntar un script nuevo o existente al nodo seleccionado."
+msgstr "Añadir un script nuevo o existente al nodo seleccionado."
#: editor/scene_tree_dock.cpp
msgid "Clear a script for the selected node."
-msgstr "Borra el script del nodo seleccionado."
+msgstr "Borrar el script del nodo seleccionado."
#: editor/scene_tree_dock.cpp
msgid "Remote"
@@ -6852,8 +6876,8 @@ msgid ""
"Node has connection(s) and group(s)\n"
"Click to show signals dock."
msgstr ""
-"El nodo tiene conexión/es y grupo/s\n"
-"Haz click para mostrar el panel de señales."
+"El nodo tiene conexión(es) y grupo(s)\n"
+"Haz clic para mostrar el panel de señales."
#: editor/scene_tree_editor.cpp
msgid ""
@@ -6861,7 +6885,7 @@ msgid ""
"Click to show signals dock."
msgstr ""
"El nodo tiene conexiones.\n"
-"Haz click para mostrar el panel de señales."
+"Haz clic para mostrar el panel de señales."
#: editor/scene_tree_editor.cpp
msgid ""
@@ -6869,7 +6893,7 @@ msgid ""
"Click to show groups dock."
msgstr ""
"El nodo está en el/los grupo(s).\n"
-"Click para mostrar el panel de grupos."
+"Haz clic para mostrar el panel de grupos."
#: editor/scene_tree_editor.cpp
msgid "Open script"
@@ -6881,7 +6905,7 @@ msgid ""
"Click to unlock"
msgstr ""
"El nodo está bloqueado.\n"
-"Click para desbloquear"
+"Haz clic para desbloquear"
#: editor/scene_tree_editor.cpp
msgid ""
@@ -6889,7 +6913,7 @@ msgid ""
"Click to make selectable"
msgstr ""
"Los hijos no son seleccionables.\n"
-"Haz click para hacerlos seleccionables"
+"Haz clic para hacerlos seleccionables"
#: editor/scene_tree_editor.cpp
msgid "Toggle Visibility"
@@ -6902,7 +6926,7 @@ msgstr ""
#: editor/scene_tree_editor.cpp
msgid "Rename Node"
-msgstr "Renombrar nodo"
+msgstr "Renombrar Nodo"
#: editor/scene_tree_editor.cpp
msgid "Scene Tree (Nodes):"
@@ -6910,11 +6934,11 @@ msgstr "Ãrbol de escenas (nodos):"
#: editor/scene_tree_editor.cpp
msgid "Node Configuration Warning!"
-msgstr "¡Alerta de configuración de nodos!"
+msgstr "¡Alerta de Configuración de Nodos!"
#: editor/scene_tree_editor.cpp
msgid "Select a Node"
-msgstr "Selecciona un nodo"
+msgstr "Selecciona un Nodo"
#: editor/script_create_dialog.cpp
msgid "Error loading template '%s'"
@@ -6922,7 +6946,7 @@ msgstr "Error al cargar la plantilla '%s'"
#: editor/script_create_dialog.cpp
msgid "Error - Could not create script in filesystem."
-msgstr "Error - No se pudo crear script en el sistema."
+msgstr "Error - No se pudo crear script en el sistema de archivos."
#: editor/script_create_dialog.cpp
msgid "Error loading script from %s"
@@ -6958,7 +6982,7 @@ msgstr "La extensión no es correcta"
#: editor/script_create_dialog.cpp
msgid "Wrong extension chosen"
-msgstr "Extensión seleccionada errónea"
+msgstr "Se ha elegido una extensión incorrecta"
#: editor/script_create_dialog.cpp
msgid "Invalid Path"
@@ -6994,7 +7018,7 @@ msgstr "Cargar archivo de script existente"
#: editor/script_create_dialog.cpp
msgid "Language"
-msgstr "Idioma"
+msgstr "Lenguaje"
#: editor/script_create_dialog.cpp
msgid "Inherits"
@@ -7014,7 +7038,7 @@ msgstr "Script integrado"
#: editor/script_create_dialog.cpp
msgid "Attach Node Script"
-msgstr "Adjuntar script de nodo"
+msgstr "Añadir Script de Nodo"
#: editor/script_editor_debugger.cpp
msgid "Remote "
@@ -7058,11 +7082,11 @@ msgstr "Error de copia"
#: editor/script_editor_debugger.cpp
msgid "Inspect Previous Instance"
-msgstr "Inspeccionar instancia anterior"
+msgstr "Inspeccionar Instancia Anterior"
#: editor/script_editor_debugger.cpp
msgid "Inspect Next Instance"
-msgstr "Inspeccionar instancia siguiente"
+msgstr "Inspeccionar Instancia Siguiente"
#: editor/script_editor_debugger.cpp
msgid "Stack Frames"
@@ -7130,11 +7154,11 @@ msgstr "Otros"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
-msgstr "Controles seleccionados:"
+msgstr "Controles Seleccionados:"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control Type:"
-msgstr "Tipo de controles seleccionados:"
+msgstr "Tipo de Controles Seleccionados:"
#: editor/script_editor_debugger.cpp
msgid "Live Edit Root:"
@@ -7214,7 +7238,7 @@ msgstr "Borrar entrada actual"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Double click to create a new entry"
-msgstr "Doble click para crear una nueva entrada"
+msgstr "Haz doble clic para crear una nueva entrada"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Platform:"
@@ -7226,15 +7250,15 @@ msgstr "Plataforma"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Dynamic Library"
-msgstr "Librería dinámica"
+msgstr "Librería Dinámica"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
-msgstr "Añadir entrada de arquitectura"
+msgstr "Añadir una entrada de arquitectura"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "GDNativeLibrary"
-msgstr "\"GDNativeLibrary\""
+msgstr "GDNativeLibrary"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Library"
@@ -7250,7 +7274,7 @@ msgstr "Bibliotecas: "
#: modules/gdnative/register_types.cpp
msgid "GDNative"
-msgstr "\"GDNative\""
+msgstr "GDNative"
#: modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -7268,7 +7292,7 @@ msgstr ""
#: modules/gdscript/gdscript_functions.cpp
msgid "step argument is zero!"
-msgstr "¡El argumento «step» es cero!"
+msgstr "¡el argumento del paso es cero!"
#: modules/gdscript/gdscript_functions.cpp
msgid "Not a script with an instance"
@@ -7307,22 +7331,20 @@ msgid "Object can't provide a length."
msgstr "El objeto no puede proporcionar una longitud."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Pestaña siguiente"
+msgstr "Siguiente Plano"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Pestaña anterior"
+msgstr "Plano anterior"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Plano:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
-msgstr "Suelo Posterior"
+msgstr "Siguiente Piso"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Previous Floor"
@@ -7342,7 +7364,7 @@ msgstr "GridMap Duplicar selección"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Grid Map"
-msgstr "Rejilla"
+msgstr "Mapa de Cuadrícula"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Snap View"
@@ -7424,6 +7446,10 @@ msgstr "Ajustes del GridMap"
msgid "Pick Distance:"
msgstr "Seleccionar distancia:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "El nombre de la clase no puede ser una palabra reservada"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Generando solución..."
@@ -7454,7 +7480,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Sobre el soporte de C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7466,18 +7492,22 @@ msgstr "Compilaciones"
#: modules/mono/editor/mono_bottom_panel.cpp
msgid "Build Project"
-msgstr "Compilar proyecto"
+msgstr "Compilar Proyecto"
#: modules/mono/editor/mono_bottom_panel.cpp
msgid "Warnings"
msgstr "Advertencias"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Fin del reporte de la pila de excepciones"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
"properly!"
msgstr ""
-"¡Un nodo ejecutó un «yield» sin memoria de trabajo. Prueba leyendo la "
+"¡Un nodo ejecutó un yield sin memoria de trabajo. Prueba leyendo la "
"documentación sobre cómo utilizar yield!"
#: modules/visual_script/visual_script.cpp
@@ -7485,8 +7515,8 @@ msgid ""
"Node yielded, but did not return a function state in the first working "
"memory."
msgstr ""
-"Un nodo ejecutó un «yield» pero no devolvió un estado de función en la "
-"memoria de trabajo original."
+"Un nodo ejecutó un yield pero no devolvió un estado de función en la memoria "
+"de trabajo original."
#: modules/visual_script/visual_script.cpp
msgid ""
@@ -7512,7 +7542,7 @@ msgstr "Desbordamiento de pila en el nivel: "
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Signal Arguments"
-msgstr "Cambiar argumentos de la señal"
+msgstr "Cambiar Argumentos de la Señal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Argument Type"
@@ -7548,35 +7578,35 @@ msgstr "Otra función/variable/señal ya utiliza este nombre:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Rename Function"
-msgstr "Renombrar función"
+msgstr "Renombrar Función"
#: modules/visual_script/visual_script_editor.cpp
msgid "Rename Variable"
-msgstr "Renombrar variable"
+msgstr "Renombrar Variable"
#: modules/visual_script/visual_script_editor.cpp
msgid "Rename Signal"
-msgstr "Renombrar señal"
+msgstr "Renombrar Señal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Function"
-msgstr "Añadir función"
+msgstr "Añadir Función"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Variable"
-msgstr "Añadir variable"
+msgstr "Añadir Variable"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Signal"
-msgstr "Añadir señal"
+msgstr "Añadir Señal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Expression"
-msgstr "Cambiar expresión"
+msgstr "Cambiar Expresión"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node"
-msgstr "Añadir nodo"
+msgstr "Añadir Nodo"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove VisualScript Nodes"
@@ -7584,7 +7614,7 @@ msgstr "Quitar nodos de VisualScript"
#: modules/visual_script/visual_script_editor.cpp
msgid "Duplicate VisualScript Nodes"
-msgstr "Duplicar nodos de VisualScript"
+msgstr "Duplicar Nodos de VisualScript"
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature."
@@ -7604,7 +7634,7 @@ msgstr "Mantén pulsado %s para quitar una referencia simple del nodo."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold Ctrl to drop a simple reference to the node."
-msgstr "Mantén pulsado Ctrl para soltar una referencia al nodo."
+msgstr "Mantén pulsado Ctrl para soltar una referencia simple al nodo."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold %s to drop a Variable Setter."
@@ -7616,19 +7646,19 @@ msgstr "Mantén pulsado Ctrl para soltar un «Setter» de variable."
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Preload Node"
-msgstr "Añadir nodo «Preload»"
+msgstr "Añadir Nodo Preload"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node(s) From Tree"
-msgstr "Añadir nodo/s desde árbol"
+msgstr "Añadir Nodo(s) desde Ãrbol"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Getter Property"
-msgstr "Añadir propiedad «Getter»"
+msgstr "Añadir propiedad Getter"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Setter Property"
-msgstr "Añadir propiedad «Setter»"
+msgstr "Añadir propiedad Setter"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Base Type"
@@ -7636,15 +7666,15 @@ msgstr "Cambiar tipo base"
#: modules/visual_script/visual_script_editor.cpp
msgid "Move Node(s)"
-msgstr "Mover nodo/s"
+msgstr "Mover Nodo(s)"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove VisualScript Node"
-msgstr "Quitar nodo de VisualScript"
+msgstr "Quitar Nodo de VisualScript"
#: modules/visual_script/visual_script_editor.cpp
msgid "Connect Nodes"
-msgstr "Conectar nodos"
+msgstr "Conectar Nodos"
#: modules/visual_script/visual_script_editor.cpp
msgid "Condition"
@@ -7656,7 +7686,7 @@ msgstr "Secuencia"
#: modules/visual_script/visual_script_editor.cpp
msgid "Switch"
-msgstr "Interruptor"
+msgstr "Switch"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
@@ -7684,7 +7714,7 @@ msgstr "El script ya contiene la función '%s'"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Input Value"
-msgstr "Cambiar valor de entrada"
+msgstr "Cambiar Valor de Entrada"
#: modules/visual_script/visual_script_editor.cpp
msgid "Can't copy the function node."
@@ -7700,35 +7730,35 @@ msgstr "Pegar nodos de VisualScript"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Function"
-msgstr "Quitar función"
+msgstr "Quitar Función"
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit Variable"
-msgstr "Editar variable"
+msgstr "Editar Variable"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Variable"
-msgstr "Quitar variable"
+msgstr "Quitar Variable"
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit Signal"
-msgstr "Editar señal"
+msgstr "Editar Señal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Signal"
-msgstr "Quitar señal"
+msgstr "Quitar Señal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Editing Variable:"
-msgstr "Editando variable:"
+msgstr "Editando Variable:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Editing Signal:"
-msgstr "Editando señal:"
+msgstr "Editando Señal:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Base Type:"
-msgstr "Tipo base:"
+msgstr "Tipo Base:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Available Nodes:"
@@ -7744,7 +7774,7 @@ msgstr "Editar argumentos de la señal:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit Variable:"
-msgstr "Editar variable:"
+msgstr "Editar Variable:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Delete Selected"
@@ -7752,19 +7782,19 @@ msgstr "Quitar seleccionados"
#: modules/visual_script/visual_script_editor.cpp
msgid "Find Node Type"
-msgstr "Buscar tipo de nodo"
+msgstr "Buscar Tipo de Nodo"
#: modules/visual_script/visual_script_editor.cpp
msgid "Copy Nodes"
-msgstr "Copiar nodos"
+msgstr "Copiar Nodos"
#: modules/visual_script/visual_script_editor.cpp
msgid "Cut Nodes"
-msgstr "Cortar nodos"
+msgstr "Cortar Nodos"
#: modules/visual_script/visual_script_editor.cpp
msgid "Paste Nodes"
-msgstr "Pegar nodos"
+msgstr "Pegar Nodos"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Input type not iterable: "
@@ -7784,11 +7814,11 @@ msgstr "Ãndice del nombre de la propiedad inválido."
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Base object is not a Node!"
-msgstr "¡El objeto base no es un nodo!"
+msgstr "¡El objeto base no es un Nodo!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Path does not lead Node!"
-msgstr "¡La ruta no apunta a un nodo!"
+msgstr "¡La ruta no apunta a un Nodo!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Invalid index property name '%s' in node %s."
@@ -7830,7 +7860,7 @@ msgstr "Ejecutar en navegador"
#: platform/javascript/export/export.cpp
msgid "Run exported HTML in the system's default browser."
-msgstr "Ejecutar HTML exportado en el navegador por defecto del sistema."
+msgstr "Ejecutar HTML exportado en el navegador predeterminado del sistema."
#: platform/javascript/export/export.cpp
msgid "Could not write file:"
@@ -7861,8 +7891,8 @@ msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
"order for AnimatedSprite to display frames."
msgstr ""
-"Se debe crear un recurso \"SpriteFrames\" o asignar uno en la propiedad "
-"'Frames' para que AnimatedSprite pueda mostrar fotogramas."
+"Se debe crear un recurso SpriteFrames o asignar uno en la propiedad 'Frames' "
+"para que AnimatedSprite pueda mostrar fotogramas."
#: scene/2d/canvas_modulate.cpp
msgid ""
@@ -7906,9 +7936,8 @@ msgid ""
"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
msgstr ""
"CollisionShape2D solo sirve para proveer de una forma de colisión a un nodo "
-"derivado de \"CollisionObject2D\". Por favor, úsalo solo como hijo de "
-"Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc... para dotarlos de "
-"forma."
+"derivado de CollisionObject2D. Por favor, úsalo solo como hijo de Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. para dotarlos de forma."
#: scene/2d/collision_shape_2d.cpp
msgid ""
@@ -7951,15 +7980,15 @@ msgid ""
"NavigationPolygonInstance must be a child or grandchild to a Navigation2D "
"node. It only provides navigation data."
msgstr ""
-"NavigationPolygonInstance debe ser hijo o nieto de un nodo \"Navigation2D\". "
+"NavigationPolygonInstance debe ser hijo o nieto de un nodo Navigation2D. "
"Solo provee datos de navegación."
#: scene/2d/parallax_layer.cpp
msgid ""
"ParallaxLayer node only works when set as child of a ParallaxBackground node."
msgstr ""
-"En nodo \"ParallaxLayer\" solo funciona cuando esta posicionado como hijo de "
-"un nodo \"ParallaxBackground\"."
+"En nodo ParallaxLayer solo funciona cuando esta posicionado como hijo de un "
+"nodo ParallaxBackground."
#: scene/2d/particles_2d.cpp scene/3d/particles.cpp
msgid ""
@@ -7972,8 +8001,7 @@ msgstr ""
#: scene/2d/path_2d.cpp
msgid "PathFollow2D only works when set as a child of a Path2D node."
msgstr ""
-"\"PathFollow2D\" solo funciona cuando está posicionado como hijo de un nodo "
-"\"Path2D\"."
+"PathFollow2D solo funciona cuando está colocado como hijo de un nodo Path2D."
#: scene/2d/physics_body_2d.cpp
msgid ""
@@ -8032,11 +8060,11 @@ msgstr "ARVROrigin necesita un nodo ARVRCamera hijo"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Tiempo restante: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8062,8 +8090,8 @@ msgid ""
msgstr ""
"Este nodo no tiene formas hijas, por lo que no puede interactuar con el "
"espacio.\n"
-"Considera añadir un \"CollisionShape\" o \"CollisionPolygon\" como hijos de "
-"este nodo para dotarlo de una forma."
+"Considera añadir un CollisionShape o CollisionPolygon como hijos de este "
+"nodo para dotarlo de una forma."
#: scene/3d/collision_polygon.cpp
msgid ""
@@ -8086,8 +8114,8 @@ msgid ""
"KinematicBody, etc. to give them a shape."
msgstr ""
"CollisionShape solo sirve para proveer de una forma a un nodo derivado de un "
-"CollisionObject. Por favor, úsalo solo como hijo de \"Area\", \"StaticBody"
-"\", \"RigidBody\", \"KinematicBody\", etc. para darles dicha forma."
+"CollisionObject. Por favor, úsalo solo como hijo de Area, StaticBody, "
+"RigidBody, KinematicBody, etc. para darles dicha forma."
#: scene/3d/collision_shape.cpp
msgid ""
@@ -8137,12 +8165,25 @@ msgstr ""
"La propiedad Path debe apuntar a un nodo Spatial válido para funcionar."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment necesita un recurso Environment."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Solo se permite un WorldEnvironment por escena (o conjunto de escenas "
"instanciadas)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Este WorldEnvironment está siendo ignorado. Agrega un nodo Camera (para "
+"escenas 3D) o configura el Background Mode de este entorno en modo Canvas "
+"(para escenas 2D)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8165,7 +8206,7 @@ msgstr "Modo Raw"
#: scene/gui/color_picker.cpp
msgid "Add current color as a preset"
-msgstr "Añadir el color actual como predefinido"
+msgstr "Añadir el color actual como predeterminado"
#: scene/gui/dialogs.cpp
msgid "Alert!"
@@ -8173,7 +8214,7 @@ msgstr "¡Alerta!"
#: scene/gui/dialogs.cpp
msgid "Please Confirm..."
-msgstr "Confirmar decisión…"
+msgstr "Por favor, Confirma..."
#: scene/gui/file_dialog.cpp
msgid "Select this Folder"
@@ -8208,8 +8249,8 @@ msgid ""
"Default Environment as specified in Project Settings (Rendering -> "
"Environment -> Default Environment) could not be loaded."
msgstr ""
-"El entorno especificado por defecto en los Ajustes del Proyecto (Renderizado "
-"-> Ventana -> Entorno por Defecto) no se ha podido cargar."
+"El Entorno por Defecto como se especifica en los Ajustes del Proyecto "
+"(Rendering -> Environment -> Default Environment) no se ha podido cargar."
#: scene/main/viewport.cpp
msgid ""
@@ -8218,10 +8259,10 @@ msgid ""
"obtain a size. Otherwise, make it a RenderTarget and assign its internal "
"texture to some node for display."
msgstr ""
-"Este viewport no está configurado como \"render target\". Si tienes "
-"intención de que muestre su contenido directamente en la pantalla, hazlo "
-"hijo de un Control para que pueda obtener un tamaño. Alternativamente, hazlo "
-"un RenderTarget y asigna su textura interna a algún otro nodo para mostrar."
+"Este viewport no está configurado como render target. Si quieres que muestre "
+"su contenido directamente en la pantalla, hazlo hijo de un Control para que "
+"pueda obtener un tamaño. De lo contrario, conviértelo en un RenderTarget y "
+"asigna su textura interna a algún nodo para mostrarlo."
#: scene/resources/dynamic_font.cpp
msgid "Error initializing FreeType."
@@ -8239,6 +8280,26 @@ msgstr "Error al cargar la tipografía."
msgid "Invalid font size."
msgstr "Tamaño de tipografía incorrecto."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Pestaña anterior"
+
+#~ msgid "Next"
+#~ msgstr "Siguiente"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "La acción no es correcta (no puedes utilizar «/» o «:»)."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "No puede contener '/' o ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "El archivo \"version.txt\" que hay dentro de las plantillas tiene un "
+#~ "formato inválido. \"Revisión\" no es un identificador válido."
+
#~ msgid "Can't write file."
#~ msgstr "No se puede escribir el archivo."
@@ -8252,9 +8313,6 @@ msgstr "Tamaño de tipografía incorrecto."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "No se encontró project.godot en la ruta del proyecto."
-#~ msgid "Next"
-#~ msgstr "Siguiente"
-
#~ msgid "Not found!"
#~ msgstr "¡No se ha encontrado!"
@@ -8408,8 +8466,8 @@ msgstr "Tamaño de tipografía incorrecto."
#~ msgid "Exporting for %s"
#~ msgstr "Exportando para %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Configurando.."
+#~ msgid "Setting Up..."
+#~ msgstr "Configurando..."
#~ msgid "Error loading scene."
#~ msgstr "Hubo un error al cargar la escena."
@@ -8474,8 +8532,8 @@ msgstr "Tamaño de tipografía incorrecto."
#~ msgid "Info"
#~ msgstr "Info"
-#~ msgid "Re-Import.."
-#~ msgstr "Reimportar.."
+#~ msgid "Re-Import..."
+#~ msgstr "Reimportar..."
#~ msgid "No bit masks to import!"
#~ msgstr "¡Sin máscaras de bits para importar!"
@@ -8874,14 +8932,14 @@ msgstr "Tamaño de tipografía incorrecto."
#~ msgid "Zoom (%):"
#~ msgstr "Zoom (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Esqueleto.."
+#~ msgid "Skeleton..."
+#~ msgstr "Esqueleto..."
#~ msgid "Zoom Reset"
#~ msgstr "Restablecer zoom"
-#~ msgid "Zoom Set.."
-#~ msgstr "Ajustar zoom.."
+#~ msgid "Zoom Set..."
+#~ msgstr "Ajustar zoom..."
#~ msgid "Set a Value"
#~ msgstr "Establecer valor"
@@ -9392,7 +9450,7 @@ msgstr "Tamaño de tipografía incorrecto."
#~ msgid "Export Project PCK"
#~ msgstr "Exportar PCK del proyecto"
-#~ msgid "Export.."
+#~ msgid "Export..."
#~ msgstr "Exportar…"
#~ msgid "Project Export"
@@ -9506,8 +9564,8 @@ msgstr "Tamaño de tipografía incorrecto."
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "Volver a Cargar Script de Herramientas (Soft)"
-#~ msgid "Edit Connections.."
-#~ msgstr "Editar Conecciones.."
+#~ msgid "Edit Connections..."
+#~ msgstr "Editar Conecciones..."
#~ msgid "Set Params"
#~ msgstr "Setear Params"
diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po
index e706603e69..64ee2404f1 100644
--- a/editor/translations/es_AR.po
+++ b/editor/translations/es_AR.po
@@ -2,17 +2,15 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Diego López <diegodario21@gmail.com>, 2017.
# Lisandro Lorea <lisandrolorea@gmail.com>, 2016-2018.
# Roger Blanco Ribera <roger.blancoribera@gmail.com>, 2016-2018.
# Sebastian Silva <sebastian@sugarlabs.org>, 2016.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-01-24 20:49+0000\n"
+"PO-Revision-Date: 2018-06-06 13:28+0000\n"
"Last-Translator: Lisandro Lorea <lisandrolorea@gmail.com>\n"
"Language-Team: Spanish (Argentina) <https://hosted.weblate.org/projects/"
"godot-engine/godot/es_AR/>\n"
@@ -21,7 +19,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -502,8 +500,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Desconectar '%s' de '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Conectar.."
+msgid "Connect..."
+msgstr "Conectar..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -922,12 +920,12 @@ msgid "Move Audio Bus"
msgstr "Mover Bus de Audio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Guardar Layout de Bus de Audio Como.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Guardar Layout de Bus de Audio Como..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Ubicación para el Nuevo Layout.."
+msgid "Location for New Layout..."
+msgstr "Ubicación para el Nuevo Layout..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1068,12 +1066,12 @@ msgid "Updating Scene"
msgstr "Actualizando Escena"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Guardando cambios locales.."
+msgid "Storing local changes..."
+msgstr "Guardando cambios locales..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Actualizando escena.."
+msgid "Updating scene..."
+msgstr "Actualizando escena..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1141,8 +1139,8 @@ msgid "Show In File Manager"
msgstr "Mostrar en Gestor de Archivos"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nueva Carpeta.."
+msgid "New Folder..."
+msgstr "Nueva Carpeta..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1401,18 +1399,22 @@ msgstr "Limpiar"
msgid "Clear Output"
msgstr "Limpiar Salida"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "La exportación del proyecto falló con el código de error %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Error al guardar el recurso!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Guardar Recurso Como.."
+msgid "Save Resource As..."
+msgstr "Guardar Recurso Como..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Ya Veo.."
+msgid "I see..."
+msgstr "Ya Veo..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1645,12 +1647,12 @@ msgid "Open Base Scene"
msgstr "Abrir Escena Base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Abrir Escena Rapido.."
+msgid "Quick Open Scene..."
+msgstr "Abrir Escena Rapido..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Abrir Script Rapido.."
+msgid "Quick Open Script..."
+msgstr "Abrir Script Rapido..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1661,8 +1663,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Guardar cambios a '%s' antes de cerrar?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Guardar Escena Como.."
+msgid "Save Scene As..."
+msgstr "Guardar Escena Como..."
#: editor/editor_node.cpp
msgid "No"
@@ -1713,8 +1715,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Esta acción no se puede deshacer. Revertir de todos modos?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Ejecutar Escena Rapido.."
+msgid "Quick Run Scene..."
+msgstr "Ejecutar Escena Rapido..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1876,8 +1878,8 @@ msgid "Previous tab"
msgstr "Pestaña anterior"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrar Archivos.."
+msgid "Filter Files..."
+msgstr "Filtrar Archivos..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1888,12 +1890,12 @@ msgid "New Scene"
msgstr "Nueva Escena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Nueva Escena Heredada.."
+msgid "New Inherited Scene..."
+msgstr "Nueva Escena Heredada..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Abrir Escena.."
+msgid "Open Scene..."
+msgstr "Abrir Escena..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1912,16 +1914,16 @@ msgid "Open Recent"
msgstr "Abrir Reciente"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Convertir A.."
+msgid "Convert To..."
+msgstr "Convertir A..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2185,8 +2187,8 @@ msgid "Save the currently edited resource."
msgstr "Guardar el recurso editado actualmente."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Guardar Como.."
+msgid "Save As..."
+msgstr "Guardar Como..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2294,8 +2296,8 @@ msgid "Creating Mesh Previews"
msgstr "Creando Vistas Previas de Mesh/es"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatura.."
+msgid "Thumbnail..."
+msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2448,8 +2450,8 @@ msgid "(Current)"
msgstr "(Actual)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Recuperando mirrors, esperá, por favor.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Recuperando mirrors, esperá, por favor..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2464,14 +2466,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Formato de version.txt invalido dentro de plantillas."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Formato de version.txt invalido dentro de plantillas. Revision no es un "
-"identificador valido."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "No se encontro ningún version.txt dentro de las plantillas."
@@ -2534,8 +2528,8 @@ msgid "Error requesting url: "
msgstr "Error al pedir el url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Conectando al Mirror.."
+msgid "Connecting to Mirror..."
+msgstr "Conectando al Mirror..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2551,8 +2545,8 @@ msgstr "No se ha podido resolver"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Conectando.."
+msgid "Connecting..."
+msgstr "Conectando..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2564,8 +2558,8 @@ msgstr "Conectado"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Solicitando.."
+msgid "Requesting..."
+msgstr "Solicitando..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2701,12 +2695,12 @@ msgid "Collapse all"
msgstr "Colapsar todos"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Renombrar.."
+msgid "Rename..."
+msgstr "Renombrar..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Mover A.."
+msgid "Move To..."
+msgstr "Mover A..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2717,16 +2711,16 @@ msgid "Instance"
msgstr "Instancia"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Editar Dependencias.."
+msgid "Edit Dependencies..."
+msgstr "Editar Dependencias..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Ver Dueños.."
+msgid "View Owners..."
+msgstr "Ver Dueños..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Duplicar.."
+msgid "Duplicate..."
+msgstr "Duplicar..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2752,7 +2746,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Examinando Archivos,\n"
"Aguardá, por favor."
@@ -2820,8 +2814,8 @@ msgid "Import Scene"
msgstr "Importar Escena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Importando Escena.."
+msgid "Importing Scene..."
+msgstr "Importando Escena..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2832,8 +2826,8 @@ msgid "Generating for Mesh: "
msgstr "Generando para Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Ejecutando Script Personalizado.."
+msgid "Running Custom Script..."
+msgstr "Ejecutando Script Personalizado..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2848,8 +2842,8 @@ msgid "Error running post-import script:"
msgstr "Error ejecutando el script de post-importacion:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Guardando.."
+msgid "Saving..."
+msgstr "Guardando..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2868,8 +2862,8 @@ msgid "Import As:"
msgstr "Importar Como:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Preseteo.."
+msgid "Preset..."
+msgstr "Preseteo..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3288,16 +3282,16 @@ msgid "Transition Node"
msgstr "Nodo Transición"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importar Animaciones.."
+msgid "Import Animations..."
+msgstr "Importar Animaciones..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Editar Filtros de Nodo"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filtros.."
+msgid "Filters..."
+msgstr "Filtros..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3364,8 +3358,8 @@ msgid "Fetching:"
msgstr "Obteniendo:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Resolviendo.."
+msgid "Resolving..."
+msgstr "Resolviendo..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3431,8 +3425,8 @@ msgid "Site:"
msgstr "Sitio:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Soporte.."
+msgid "Support..."
+msgstr "Soporte..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3629,8 +3623,9 @@ msgid "Use Rotation Snap"
msgstr "Usar Snap de Rotación"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "Configurar alineado.."
+msgstr "Configurar Snap..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3725,6 +3720,14 @@ msgid "Show Guides"
msgstr "Mostrar guías"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Mostrar Orígen"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Mostrar Viewport"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centrar Selección"
@@ -4014,6 +4017,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "El mesh no tiene una superficie de donde crear contornos(outlines)!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "El tipo de la malla primitiva no es PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "No se pudo crear el outline!"
@@ -4042,8 +4049,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Crear Collision Sibling Convexo"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Crear Outline Mesh.."
+msgid "Create Outline Mesh..."
+msgstr "Crear Outline Mesh..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4249,8 +4256,8 @@ msgid "Error loading image:"
msgstr "Error al cargar la imagen:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Sin pixeles con transparencia > 128 en imagen.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Sin pixeles con transparencia > 128 en imagen..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4610,8 +4617,8 @@ msgid "Import Theme"
msgstr "Importar Tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Guardar Tema Como.."
+msgid "Save Theme As..."
+msgstr "Guardar Tema Como..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4707,8 +4714,8 @@ msgstr "Act/Desact. Panel de Scripts"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Encontrar.."
+msgid "Find..."
+msgstr "Encontrar..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4917,16 +4924,16 @@ msgid "Find Previous"
msgstr "Encontrar Anterior"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Reemplazar.."
+msgid "Replace..."
+msgstr "Reemplazar..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Ir a Función.."
+msgid "Goto Function..."
+msgstr "Ir a Función..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Ir a Línea.."
+msgid "Goto Line..."
+msgstr "Ir a Línea..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5379,12 +5386,8 @@ msgid "Transform"
msgstr "Transformar"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configurar Snap.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Dialogo de Transformación.."
+msgid "Transform Dialog..."
+msgstr "Dialogo de Transformación..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5636,8 +5639,8 @@ msgid "Remove All"
msgstr "Quitar Todos"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Editar tema.."
+msgid "Edit theme..."
+msgstr "Editar tema..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5684,6 +5687,14 @@ msgid "Checked Item"
msgstr "Item Tildado"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Radio Item"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Radio Item Tildado"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Tiene"
@@ -5696,8 +5707,8 @@ msgid "Options"
msgstr "Opciones"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Tienes, Muchas, Variadas, Opciones!"
+msgid "Has,Many,Options"
+msgstr "Tiene,Muchas,Opciones"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5890,8 +5901,8 @@ msgid "Presets"
msgstr "Presets"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Agregar.."
+msgid "Add..."
+msgstr "Agregar..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5986,6 +5997,10 @@ msgid "Imported Project"
msgstr "Proyecto Importado"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Nombre de Proyecto Inválido."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "No se pudo crear la carpeta."
@@ -6002,11 +6017,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "Ruta de proyecto inválida (cambiaste algo?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "No se pudo editar project.godot en la ruta de proyecto."
+msgstr ""
+"No se pudo cargar project.godot desde la ruta de proyecto (error %d). La "
+"ruta no existe o está corrupta."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6187,8 +6203,12 @@ msgid "Mouse Button"
msgstr "Botón de Mouse"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Acción Invalida (cualquier cosa va menos '/' o ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Nombre de acción inválido. No puede estar vacío o contener '/', ':', '=', "
+"'\\' o '\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6215,8 +6235,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Presionar una Tecla.."
+msgid "Press a Key..."
+msgstr "Presionar una Tecla..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6331,10 +6351,6 @@ msgid "Delete Item"
msgstr "Eliminar Ãtem"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "No puede contener '/' o ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Ya existe"
@@ -6403,8 +6419,8 @@ msgid "Property:"
msgstr "Propiedad:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Sobreescribir Para.."
+msgid "Override For..."
+msgstr "Sobreescribir Para..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6499,12 +6515,12 @@ msgid "Easing Out-In"
msgstr "Easing Out-In"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Archivo.."
+msgid "File..."
+msgstr "Archivo..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Dir.."
+msgid "Dir..."
+msgstr "Dir..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6677,8 +6693,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Esta operación no puede ser realizada en escenas instanciadas."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Guardar Nueva Escena Como.."
+msgid "Save New Scene As..."
+msgstr "Guardar Nueva Escena Como..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7281,18 +7297,16 @@ msgid "Object can't provide a length."
msgstr "El objeto no puede proveer un largo."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Pestaña siguiente"
+msgstr "Plano siguiente"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Pestaña anterior"
+msgstr "Plano anterior"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Plano:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7398,6 +7412,10 @@ msgstr "Ajustes de GridMap"
msgid "Pick Distance:"
msgstr "Elegir Instancia:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "El nombre de la clase no puede ser una palabra reservada"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Generando solución..."
@@ -7428,7 +7446,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Sobre el soporte de C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7446,6 +7464,10 @@ msgstr "Construir Proyecto"
msgid "Warnings"
msgstr "Advertencias"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Fin del stack trace de excepción interna"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7999,11 +8021,11 @@ msgstr "ARVROrigin requiere un nodo hijo ARVRCamera"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Tiempo Restante: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8102,12 +8124,25 @@ msgstr ""
"La propiedad Path debe apuntar a un nodo Spatial valido para funcionar."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment necesita un recurso Environment."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Solo se permite un WorldEnvironment por escena (o conjunto de escenas "
"instanciadas)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Este WorldEnvironment esta siendo ignorado. Agregá un nodo Camera (para "
+"escenas 3D) o configurá el Background Mode de este entorno en modo Canvas "
+"(para escenas 2D)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8204,6 +8239,26 @@ msgstr "Error cargando tipografía."
msgid "Invalid font size."
msgstr "Tamaño de tipografía inválido."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Pestaña anterior"
+
+#~ msgid "Next"
+#~ msgstr "Siguiente"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Acción Invalida (cualquier cosa va menos '/' o ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "No puede contener '/' o ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Formato de version.txt invalido dentro de plantillas. Revision no es un "
+#~ "identificador valido."
+
#~ msgid "Can't write file."
#~ msgstr "No se puede escribir el archivo."
@@ -8217,9 +8272,6 @@ msgstr "Tamaño de tipografía inválido."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "No se pudo obtener project.godot en la ruta de proyecto."
-#~ msgid "Next"
-#~ msgstr "Siguiente"
-
#~ msgid "Not found!"
#~ msgstr "No se encontró!"
@@ -8365,8 +8417,8 @@ msgstr "Tamaño de tipografía inválido."
#~ msgid "Exporting for %s"
#~ msgstr "Exportando para %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Configurando.."
+#~ msgid "Setting Up..."
+#~ msgstr "Configurando..."
#~ msgid "Error loading scene."
#~ msgstr "Error al cargar la escena."
@@ -8428,8 +8480,8 @@ msgstr "Tamaño de tipografía inválido."
#~ msgid "Info"
#~ msgstr "Info"
-#~ msgid "Re-Import.."
-#~ msgstr "Reimportando.."
+#~ msgid "Re-Import..."
+#~ msgstr "Reimportando..."
#~ msgid "No bit masks to import!"
#~ msgstr "Sin máscaras de bits para importar!"
@@ -8825,14 +8877,14 @@ msgstr "Tamaño de tipografía inválido."
#~ msgid "Zoom (%):"
#~ msgstr "Zoom (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Esqueleto.."
+#~ msgid "Skeleton..."
+#~ msgstr "Esqueleto..."
#~ msgid "Zoom Reset"
#~ msgstr "Resetear Zoom"
-#~ msgid "Zoom Set.."
-#~ msgstr "Setear Zoom.."
+#~ msgid "Zoom Set..."
+#~ msgstr "Setear Zoom..."
#~ msgid "Set a Value"
#~ msgstr "Setear un Valor"
@@ -9314,8 +9366,8 @@ msgstr "Tamaño de tipografía inválido."
#~ msgid "Export Project PCK"
#~ msgstr "Exportar PCK de Proyecto"
-#~ msgid "Export.."
-#~ msgstr "Exportar.."
+#~ msgid "Export..."
+#~ msgstr "Exportar..."
#~ msgid "Project Export"
#~ msgstr "Exportar Proyecto"
@@ -9435,8 +9487,8 @@ msgstr "Tamaño de tipografía inválido."
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "Volver a Cargar Script de Herramientas (Soft)"
-#~ msgid "Edit Connections.."
-#~ msgstr "Editar Conecciones.."
+#~ msgid "Edit Connections..."
+#~ msgstr "Editar Conecciones..."
#~ msgid "Set Params"
#~ msgstr "Setear Params"
diff --git a/editor/translations/extract.py b/editor/translations/extract.py
index bbc157788d..4b3f416343 100755
--- a/editor/translations/extract.py
+++ b/editor/translations/extract.py
@@ -52,11 +52,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\\n"
"""
-print("Updating the editor.pot template...")
-
-for fname in matches:
-
- f = open(fname, "rb")
+def process_file(f, fname):
l = f.readline()
lc = 1
@@ -100,12 +96,14 @@ for fname in matches:
l = f.readline()
lc += 1
- f.close()
+print("Updating the editor.pot template...")
+for fname in matches:
+ with open(fname, "rb") as f:
+ process_file(f, fname)
-f = open("editor.pot", "wb")
-f.write(main_po)
-f.close()
+with open("editor.pot", "wb") as f:
+ f.write(main_po)
if (os.name == "posix"):
print("Wrapping template at 79 characters for compatibility with Weblate.")
diff --git a/editor/translations/fa.po b/editor/translations/fa.po
index 7f784fc253..f674ef99cc 100644
--- a/editor/translations/fa.po
+++ b/editor/translations/fa.po
@@ -4,6 +4,7 @@
# This file is distributed under the same license as the Godot source code.
#
# alabd14313 <alabd14313@yahoo.com>, 2016.
+# Dante Marshal <Marshal.Devilhunter@gmail.com>, 2018.
# hamed nasib <cghamed752@chmail.ir>, 2016.
# Hasan Hejdari Nasab <hsn6@openmailbox.org>, 2017.
# rezapouya <r.pouya@chmail.ir>, 2016.
@@ -12,15 +13,15 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-11-26 16:49+0000\n"
-"Last-Translator: sayyed hamed nasib <cghamed752@chmail.ir>\n"
+"PO-Revision-Date: 2018-04-29 05:39+0000\n"
+"Last-Translator: Dante Marshal <Marshal.Devilhunter@gmail.com>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/godot-engine/"
"godot/fa/>\n"
"Language: fa\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 2.18-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -31,9 +32,8 @@ msgid "All Selection"
msgstr "همه‌ی انتخاب ها"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "مقدار را در انیمیشن تغییر بده"
+msgstr "تغییر زمان ÙØ±ÛŒÙ… کلید در انیمیشن"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
@@ -44,9 +44,8 @@ msgid "Anim Change Transform"
msgstr "انتقال را در انیمیشن تغییر بده"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "مقدار را در انیمیشن تغییر بده"
+msgstr "تغییر مقدار ÙØ±ÛŒÙ… کلید در انیمیشن"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -54,52 +53,51 @@ msgstr "ÙØ±Ø§Ø®ÙˆØ§Ù†ÛŒ را در انیمیشن تغییر بده"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
-msgstr ""
+msgstr "Ø§ÙØ²ÙˆØ¯Ù† ترَک به انیمیشن"
#: editor/animation_editor.cpp
msgid "Anim Duplicate Keys"
-msgstr ""
+msgstr "تکرار کلید‌های انیمیشن"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
-msgstr ""
+msgstr "انتقال ترک انیمشین به بالا"
#: editor/animation_editor.cpp
msgid "Move Anim Track Down"
-msgstr ""
+msgstr "انتقال ترک انیمشین به پایین"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr ""
+msgstr "حذ٠ترک انیمشین"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr ""
+msgstr "تنظیم گذار‌ها به :"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr ""
+msgstr "تغییر نام ترک انیمشین"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr ""
+msgstr "تغییر سبک الحاق ترک انیمیشن"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr ""
+msgstr "تغییر حالت مقدار ترک انیمیشن"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Track Change Wrap Mode"
-msgstr "مقدار را در انیمیشن تغییر بده"
+msgstr "تغییر حالت بسته شدن ترک انیمشین"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
-msgstr ""
+msgstr "ویرایش منحنی گره"
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
-msgstr ""
+msgstr "ویرایش منحنی انتخاب شده"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
@@ -377,7 +375,6 @@ msgid "No Matches"
msgstr "تطبیقی ندارد"
#: editor/code_editor.cpp
-#, fuzzy
msgid "Replaced %d occurrence(s)."
msgstr "تعداد d% رخداد جایگزین شد."
@@ -430,6 +427,8 @@ msgid ""
"Target method not found! Specify a valid method or attach a script to target "
"Node."
msgstr ""
+"متد هد٠پیدا نشد! Ù„Ø·ÙØ§ یک متد صحیح مشخص کنید یا یک اسکریپت به گره هد٠الحاق "
+"کنید."
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
@@ -499,12 +498,11 @@ msgid "Connecting Signal:"
msgstr "اتصال سیگنال:"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect '%s' from '%s'"
-msgstr "'s%' را به 's%' متصل کن"
+msgstr "'s%' را از 's%' جدا کن"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "در حال اتصال..."
#: editor/connections_dialog.cpp
@@ -517,9 +515,8 @@ msgid "Signals"
msgstr "سیگنال‌ها"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Change %s Type"
-msgstr "تغییر نوع"
+msgstr "تغییر نوع %s"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -527,18 +524,17 @@ msgid "Change"
msgstr "تغییر بده"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Create New %s"
-msgstr "ساختن جدید"
+msgstr "ساختن %s جدید"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
msgid "Favorites:"
-msgstr ""
+msgstr "برگزیده‌ها:"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
msgid "Recent:"
-msgstr ""
+msgstr "اخیر:"
#: editor/create_dialog.cpp editor/editor_node.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -640,8 +636,9 @@ msgstr ""
"آیا در هر صورت حذ٠شوند؟(بدون برگشت)"
#: editor/dependency_editor.cpp
+#, fuzzy
msgid "Cannot remove:"
-msgstr ""
+msgstr "ناتوانی در حذ٠:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
@@ -697,80 +694,82 @@ msgstr "حذ٠کن"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Key"
-msgstr ""
+msgstr "تغییر کلید دیکشنری"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Value"
-msgstr "تغییر ارزش دیکشنری"
+msgstr "تغییر مقدار دیکشنری"
#: editor/editor_about.cpp
msgid "Thanks from the Godot community!"
-msgstr ""
+msgstr "با تشکر از سوی جامعه‌ی Godot!"
#: editor/editor_about.cpp
msgid "Thanks!"
-msgstr "تشکرات!"
+msgstr "با تشکر !"
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
-msgstr ""
+msgstr "شرکت‌کنندگان در ساخت موتور Godot"
#: editor/editor_about.cpp
msgid "Project Founders"
-msgstr "برپا کننده های پروژه"
+msgstr "بنیان‌گذاران پروژه"
#: editor/editor_about.cpp
msgid "Lead Developer"
-msgstr ""
+msgstr "توسعه‌دهنده‌ی اصلی"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Project Manager "
-msgstr "مدیر پروژه"
+msgstr "مدیر پروژه "
#: editor/editor_about.cpp
msgid "Developers"
-msgstr ""
+msgstr "توسعه دهندگان"
#: editor/editor_about.cpp
msgid "Authors"
msgstr "Ù…Ø¤Ù„ÙØ§Ù†"
#: editor/editor_about.cpp
+#, fuzzy
msgid "Platinum Sponsors"
-msgstr ""
+msgstr "اسپانسر‌های درجه ۱"
#: editor/editor_about.cpp
+#, fuzzy
msgid "Gold Sponsors"
-msgstr ""
+msgstr "اسپانسر‌های درجه ۲"
#: editor/editor_about.cpp
+#, fuzzy
msgid "Mini Sponsors"
-msgstr ""
+msgstr "اسپانسر‌های دیگر"
#: editor/editor_about.cpp
msgid "Gold Donors"
-msgstr ""
+msgstr "اهداکنندگان طلایی"
#: editor/editor_about.cpp
msgid "Silver Donors"
-msgstr ""
+msgstr "اهداکنندگان نقره‌ای"
#: editor/editor_about.cpp
msgid "Bronze Donors"
-msgstr ""
+msgstr "اهداکنندگان برنزی"
#: editor/editor_about.cpp
msgid "Donors"
-msgstr ""
+msgstr "اهدا کنندگان"
#: editor/editor_about.cpp
msgid "License"
-msgstr ""
+msgstr "مجوز"
#: editor/editor_about.cpp
msgid "Thirdparty License"
-msgstr ""
+msgstr "مجوز‌های شخص ثالث"
#: editor/editor_about.cpp
msgid ""
@@ -929,11 +928,11 @@ msgid "Move Audio Bus"
msgstr "کلید Add را جابجا کن"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1069,11 +1068,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1144,8 +1143,8 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "ساختن پوشه.."
+msgid "New Folder..."
+msgstr "ساختن پوشه..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1333,7 +1332,7 @@ msgstr ""
#: editor/editor_help.cpp
msgid "Description"
-msgstr "توضیح"
+msgstr "توضیحات"
#: editor/editor_help.cpp
msgid "Online Tutorials:"
@@ -1398,17 +1397,21 @@ msgstr "پاک کردن"
msgid "Clear Output"
msgstr "خروجی"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "ذخیره منبع از ..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "من میبینم ..."
#: editor/editor_node.cpp
@@ -1616,11 +1619,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1632,7 +1635,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "ذخیره صحنه در ..."
#: editor/editor_node.cpp
@@ -1684,7 +1687,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1831,7 +1834,7 @@ msgid "Previous tab"
msgstr "زبانه قبلی"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1843,11 +1846,11 @@ msgid "New Scene"
msgstr "صحنه جدید"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1867,15 +1870,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2046,7 +2049,7 @@ msgstr "انجمن"
#: editor/editor_node.cpp
msgid "About"
-msgstr "معرÙÛŒ"
+msgstr "درباره"
#: editor/editor_node.cpp
msgid "Play the project."
@@ -2121,7 +2124,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "ذخیره در..."
#: editor/editor_node.cpp
@@ -2230,7 +2233,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2383,7 +2386,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2399,12 +2402,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2446,7 +2443,7 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
msgid "Request Failed."
-msgstr "در حال درخواست.."
+msgstr "در حال درخواست..."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2468,7 +2465,7 @@ msgstr "خطای آدرس درخواستی: "
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "در حال اتصال..."
#: editor/export_template_manager.cpp
@@ -2485,8 +2482,8 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "در حال اتصال.."
+msgid "Connecting..."
+msgstr "در حال اتصال..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2499,8 +2496,8 @@ msgstr "وصل شده"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "در حال درخواست.."
+msgid "Requesting..."
+msgstr "در حال درخواست..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2637,11 +2634,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "تغییر نام.."
+msgid "Rename..."
+msgstr "تغییر نام..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2654,16 +2651,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "انتخاب شده را به دو تا تکثیر کن"
#: editor/filesystem_dock.cpp
@@ -2689,7 +2686,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2755,7 +2752,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2767,7 +2764,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2783,7 +2780,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2803,7 +2800,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3220,7 +3217,7 @@ msgid "Transition Node"
msgstr "گره جابجای"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3228,7 +3225,7 @@ msgid "Edit Node Filters"
msgstr "ویرایش صاÙÛŒ های گره"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3298,7 +3295,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3366,8 +3363,8 @@ msgid "Site:"
msgstr "تارنما:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "پشتیبانی.."
+msgid "Support..."
+msgstr "پشتیبانی..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3556,6 +3553,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3652,6 +3650,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3940,6 +3946,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3968,7 +3978,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4175,7 +4185,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4541,7 +4551,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4642,7 +4652,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4853,15 +4863,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5321,11 +5331,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5581,7 +5587,7 @@ msgid "Remove All"
msgstr "برداشتن"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5629,6 +5635,15 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "Ø§ÙØ²ÙˆØ¯Ù† مورد"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5641,7 +5656,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5835,7 +5850,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5929,6 +5944,11 @@ msgstr "پروژه واردشده"
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "نام پروژه:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "ناتوان در ساختن پوشه."
@@ -6119,7 +6139,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6147,7 +6169,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6264,10 +6286,6 @@ msgid "Delete Item"
msgstr "حذ٠مورد"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "نمی‌تواند شامل '/' یا ':' باشد"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "پیش از این وجود داشته است"
@@ -6336,7 +6354,7 @@ msgid "Property:"
msgstr "ویژگی:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6432,11 +6450,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6612,7 +6630,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7346,6 +7364,10 @@ msgstr "ترجیحات"
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7398,6 +7420,10 @@ msgstr "پروژه"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7584,14 +7610,16 @@ msgid "Sequence"
msgstr "دنباله"
#: modules/visual_script/visual_script_editor.cpp
+#, fuzzy
msgid "Switch"
-msgstr "گزینه"
+msgstr "سوییچ"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
msgstr "تکرارکننده"
#: modules/visual_script/visual_script_editor.cpp
+#, fuzzy
msgid "While"
msgstr "تا زمانی که"
@@ -8051,12 +8079,22 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "دارایی Path باید به یک گره Particles2D معتبر اشاره کند تا کار کند."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Ùقط یک WorldEnvironment در هر صحنه (یا مجموعه ای از صحنه های نمونه‌گذاری شده) "
"مجاز است."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8147,12 +8185,19 @@ msgstr "خطای بارگذاری قلم."
msgid "Invalid font size."
msgstr "اندازهٔ قلم نامعتبر."
-#~ msgid "Can't write file."
-#~ msgstr "ناتوان در نوشتن پرونده."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "زبانه قبلی"
#~ msgid "Next"
#~ msgstr "بعدی"
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "نمی‌تواند شامل '/' یا ':' باشد"
+
+#~ msgid "Can't write file."
+#~ msgstr "ناتوان در نوشتن پرونده."
+
#~ msgid "Not found!"
#~ msgstr "چیزی ÛŒØ§ÙØª نشد!"
diff --git a/editor/translations/fi.po b/editor/translations/fi.po
index f9bf16edfe..f80efffd42 100644
--- a/editor/translations/fi.po
+++ b/editor/translations/fi.po
@@ -2,25 +2,25 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# basse <basse@roiske.org>, 2017.
-# Bastian Salmela <bastian.salmela@gmail.com>, 2017.
+# Bastian Salmela <bastian.salmela@gmail.com>, 2017, 2018.
# ekeimaja <ekeimaja@gmail.com>, 2017-2018.
# Jarmo Riikonen <amatrelan@gmail.com>, 2017.
+# Nuutti Varvikko <nvarvikko@gmail.com>, 2018.
# Sami Lehtilä <sami.lehtila@gmail.com>, 2018.
-#
+# Tapani Niemi <tapani.niemi@kapsi.fi>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-31 04:36+0000\n"
-"Last-Translator: Sami Lehtilä <sami.lehtila@gmail.com>\n"
+"PO-Revision-Date: 2018-06-14 20:37+0000\n"
+"Last-Translator: Tapani Niemi <tapani.niemi@kapsi.fi>\n"
"Language-Team: Finnish <https://hosted.weblate.org/projects/godot-engine/"
"godot/fi/>\n"
"Language: fi\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 2.19-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -31,26 +31,24 @@ msgid "All Selection"
msgstr "Koko valinta"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "Animaatio: muuta arvoa"
+msgstr "Animaatio: muuta avainruudun aikaa"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Vaihda animaation siirtymää"
+msgstr "Animaatio: muuta siirtymää"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
-msgstr "Animaatio: muuta siirtymää"
+msgstr "Animaatio: muuta muunnosta"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Animaatio: muuta arvoa"
+msgstr "Animaatio: muuta avainruudun arvoa"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
-msgstr "Anmaatio: Muuta kutsua"
+msgstr "Animaatio: muuta kutsua"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
@@ -70,7 +68,7 @@ msgstr "Siirrä animaatioraita alas"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr "Poista animaation raita"
+msgstr "Poista animaatioraita"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
@@ -78,24 +76,23 @@ msgstr "Aseta siirtymät:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr "Nimeä animaatioraita uudelleen"
+msgstr "Animaatioraita: nimeä uudelleen"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr "Animaatio: Vaihda raidan interpolaatiota"
+msgstr "Animaatioraita: muuta interpolaatiota"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr "Animaatio: Muuta avainta tila"
+msgstr "Animaatioraita: muuta arvon tilaa"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Track Change Wrap Mode"
-msgstr "Animaatio: Muuta toisto tila"
+msgstr "Animaatioraita: muuta kierron tilaa"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
-msgstr "Muokkaa noden käyrää"
+msgstr "Muokkaa solmun käyrää"
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
@@ -103,16 +100,16 @@ msgstr "Muokkaa valinnan käyrää"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
-msgstr "Poista avaimet"
+msgstr "Animaatio: poista avaimet"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Duplicate Selection"
-msgstr "Monista valinta"
+msgstr "Kahdenna valinta"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
-msgstr "Monista käänteisesti"
+msgstr "Kahdenna käänteisesti"
#: editor/animation_editor.cpp
msgid "Remove Selection"
@@ -132,11 +129,11 @@ msgstr "Liipaisin"
#: editor/animation_editor.cpp
msgid "Anim Add Key"
-msgstr "Lisää avain"
+msgstr "Animaatio: lisää avain"
#: editor/animation_editor.cpp
msgid "Anim Move Keys"
-msgstr "SIirrä avaimia"
+msgstr "Animaatio: siirrä avaimia"
#: editor/animation_editor.cpp
msgid "Scale Selection"
@@ -193,7 +190,7 @@ msgstr "Siivoa animaatio"
#: editor/animation_editor.cpp
msgid "Create NEW track for %s and insert key?"
-msgstr "Luo UUSI raita %lle ja lisää avain?"
+msgstr "Luo kohteelle %s UUSI raita ja lisää avain?"
#: editor/animation_editor.cpp
msgid "Create %d NEW tracks and insert keys?"
@@ -209,7 +206,7 @@ msgstr "Luo"
#: editor/animation_editor.cpp
msgid "Anim Create & Insert"
-msgstr "Animaatio: Luo ja lisää"
+msgstr "Animaatio: luo ja lisää"
#: editor/animation_editor.cpp
msgid "Anim Insert Track & Key"
@@ -221,7 +218,7 @@ msgstr "Animaatio: Lisää avain"
#: editor/animation_editor.cpp
msgid "Change Anim Len"
-msgstr "Vaihda animaation pituutta"
+msgstr "Muuta animaation pituutta"
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
@@ -233,7 +230,7 @@ msgstr "Animaatio: Luo tyypitetty arvoavain"
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr "Animaatio: Lisää"
+msgstr "Animaatio: lisää"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
@@ -245,7 +242,7 @@ msgstr "Animaatio: Lisää kutsuraita"
#: editor/animation_editor.cpp
msgid "Animation zoom."
-msgstr "Animaation zoom."
+msgstr "Animaation lähennystaso."
#: editor/animation_editor.cpp
msgid "Length (s):"
@@ -257,7 +254,7 @@ msgstr "Animaation pituus (sekunteina)."
#: editor/animation_editor.cpp
msgid "Step (s):"
-msgstr "Askellus:"
+msgstr "Askellus (s):"
#: editor/animation_editor.cpp
msgid "Cursor step snap (in seconds)."
@@ -265,7 +262,7 @@ msgstr "Kohdistimen askelrajoitin (sekunneissa)."
#: editor/animation_editor.cpp
msgid "Enable/Disable looping in animation."
-msgstr "Ota käyttöön/poista käytöstä animaation toisto."
+msgstr "Ota käyttöön tai poista käytöstä animaation toisto."
#: editor/animation_editor.cpp
msgid "Add new tracks."
@@ -289,7 +286,7 @@ msgstr "Raidan työkalut"
#: editor/animation_editor.cpp
msgid "Enable editing of individual keys by clicking them."
-msgstr "Mahdollistaa avainten muokkaamisen klikkaamalla."
+msgstr "Mahdollistaa avainten muokkaamisen napsauttamalla niitä."
#: editor/animation_editor.cpp
msgid "Anim. Optimizer"
@@ -301,11 +298,11 @@ msgstr "Max. lineaarinen virhe:"
#: editor/animation_editor.cpp
msgid "Max. Angular Error:"
-msgstr "Max. Kulmavirhe:"
+msgstr "Max. kulmavirhe:"
#: editor/animation_editor.cpp
msgid "Max Optimizable Angle:"
-msgstr "Max. Optimoitava kulma:"
+msgstr "Max. optimoitava kulma:"
#: editor/animation_editor.cpp
msgid "Optimize"
@@ -313,7 +310,7 @@ msgstr "Optimoi"
#: editor/animation_editor.cpp
msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
-msgstr "Valitse AnimationPlayer Scenepuusta muokataksesi animaatioita."
+msgstr "Valitse AnimationPlayer skenen puusta muokataksesi animaatioita."
#: editor/animation_editor.cpp
msgid "Key"
@@ -329,7 +326,7 @@ msgstr "Skaalaussuhde:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr "Mistä nodesta kutsutaan funktiota?"
+msgstr "Mistä solmusta kutsutaan funktiota?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
@@ -345,7 +342,7 @@ msgstr "Siivoa kaikki animaatiot"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation(s) (NO UNDO!)"
-msgstr "Siivoa animaatio(t) (EI VOI KUMOTA)"
+msgstr "Siivoa animaatio(t) (EI VOI KUMOTA!)"
#: editor/animation_editor.cpp
msgid "Clean-Up"
@@ -369,7 +366,7 @@ msgstr "Mene riville"
#: editor/code_editor.cpp
msgid "Line Number:"
-msgstr "RIvinumero:"
+msgstr "Rivinumero:"
#: editor/code_editor.cpp
msgid "No Matches"
@@ -409,7 +406,7 @@ msgstr "Loitonna"
#: editor/code_editor.cpp
msgid "Reset Zoom"
-msgstr "Nollaa lähennys"
+msgstr "Palauta oletuslähennystaso"
#: editor/code_editor.cpp editor/script_editor_debugger.cpp
msgid "Line:"
@@ -417,23 +414,23 @@ msgstr "Rivi:"
#: editor/code_editor.cpp
msgid "Col:"
-msgstr "Kolumni:"
+msgstr "Sarake:"
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
-msgstr "Kohdenoden metodi täytyy määrittää!"
+msgstr "Kohdesolmun metodi täytyy määrittää!"
#: editor/connections_dialog.cpp
msgid ""
"Target method not found! Specify a valid method or attach a script to target "
"Node."
msgstr ""
-"Kohde metodia ei löytynyt! Määrittele voimassa oleva metodi tai kiinnitä "
-"skripti nodeen."
+"Kohdemetodia ei löytynyt! Määrittele voimassa oleva metodi tai kiinnitä "
+"skripti solmuun."
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
-msgstr "Yhdistä Nodeen:"
+msgstr "Yhdistä solmuun:"
#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
@@ -458,7 +455,7 @@ msgstr "Ylimääräiset argumentit:"
#: editor/connections_dialog.cpp
msgid "Path to Node:"
-msgstr "Polku Nodeen:"
+msgstr "Polku solmuun:"
#: editor/connections_dialog.cpp
msgid "Make Function"
@@ -492,7 +489,7 @@ msgstr "Yhdistä"
#: editor/connections_dialog.cpp
msgid "Connect '%s' to '%s'"
-msgstr "Yhdistä '%s' '%s':n"
+msgstr "Yhdistä solmu '%s' solmuun '%s'"
#: editor/connections_dialog.cpp
msgid "Connecting Signal:"
@@ -500,10 +497,10 @@ msgstr "Yhdistävä signaali:"
#: editor/connections_dialog.cpp
msgid "Disconnect '%s' from '%s'"
-msgstr "Katkaise yhteys '%s' '%s':n"
+msgstr "Katkaise yhteys solmusta '%s' solmuun '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Yhdistä..."
#: editor/connections_dialog.cpp
@@ -569,7 +566,7 @@ msgid ""
"Scene '%s' is currently being edited.\n"
"Changes will not take effect unless reloaded."
msgstr ""
-"Sceneä '%s' muokataan parhaillaan.\n"
+"Skeneä '%s' muokataan parhaillaan.\n"
"Muutokset tulevat voimaan vasta päivityksen jälkeen."
#: editor/dependency_editor.cpp
@@ -619,9 +616,8 @@ msgid "Open"
msgstr "Avaa"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Owners Of:"
-msgstr "Omistajat:"
+msgstr "Omistajat kohteelle:"
#: editor/dependency_editor.cpp
msgid "Remove selected files from the project? (no undo)"
@@ -638,7 +634,6 @@ msgstr ""
"Poistetaanko silti? (ei mahdollisuutta kumota)"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Cannot remove:"
msgstr "Ei voida poistaa:"
@@ -648,7 +643,7 @@ msgstr "Virhe ladatessa:"
#: editor/dependency_editor.cpp
msgid "Scene failed to load due to missing dependencies:"
-msgstr "Scenen lataaminen epäonnistui puuttuvan riippuvuuden takia:"
+msgstr "Skenen lataaminen epäonnistui puuttuvan riippuvuuden takia:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Open Anyway"
@@ -667,9 +662,8 @@ msgid "Errors loading!"
msgstr "Virheitä ladatessa!"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Permanently delete %d item(s)? (No undo!)"
-msgstr "Poista pysyvästi %d ? (Ei voi kumota!)"
+msgstr "Poista pysyvästi %d kohdetta? (Ei voi kumota!)"
#: editor/dependency_editor.cpp
msgid "Owns"
@@ -680,9 +674,8 @@ msgid "Resources Without Explicit Ownership:"
msgstr "Resurssit, joilla ei ole selvää omistajaa:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
-#, fuzzy
msgid "Orphan Resource Explorer"
-msgstr "Orpojen resurssien selain"
+msgstr "Irrallisten resurssien hallinta"
#: editor/dependency_editor.cpp
msgid "Delete selected files?"
@@ -697,14 +690,12 @@ msgid "Delete"
msgstr "Poista"
#: editor/dictionary_property_edit.cpp
-#, fuzzy
msgid "Change Dictionary Key"
-msgstr "Vaihda taulukon avainta"
+msgstr "Vaihda hakurakenteen avainta"
#: editor/dictionary_property_edit.cpp
-#, fuzzy
msgid "Change Dictionary Value"
-msgstr "Vaihda taulukon arvoa"
+msgstr "Vaihda hakurakenteen arvoa"
#: editor/editor_about.cpp
msgid "Thanks from the Godot community!"
@@ -727,9 +718,8 @@ msgid "Lead Developer"
msgstr "Pääkehittäjä"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Project Manager "
-msgstr "Projektinhallinta"
+msgstr "Projektipäällikkö "
#: editor/editor_about.cpp
msgid "Developers"
@@ -741,27 +731,27 @@ msgstr "Tekijät"
#: editor/editor_about.cpp
msgid "Platinum Sponsors"
-msgstr "Platinum sponsorit"
+msgstr "Platinasponsorit"
#: editor/editor_about.cpp
msgid "Gold Sponsors"
-msgstr "Kulta sponsorit"
+msgstr "Kultasponsorit"
#: editor/editor_about.cpp
msgid "Mini Sponsors"
-msgstr "Mini sponsorit"
+msgstr "Minisponsorit"
#: editor/editor_about.cpp
msgid "Gold Donors"
-msgstr "Kulta lahjoittajat"
+msgstr "Kultalahjoittajat"
#: editor/editor_about.cpp
msgid "Silver Donors"
-msgstr "Hopea lahjoittajat"
+msgstr "Hopealahjoittajat"
#: editor/editor_about.cpp
msgid "Bronze Donors"
-msgstr "Pronssi lahjoittajat"
+msgstr "Pronssilahjoittajat"
#: editor/editor_about.cpp
msgid "Donors"
@@ -784,8 +774,8 @@ msgid ""
msgstr ""
"Godot moottori käyttää useita kolmannen osapuolen ilmaisia ja avoimia "
"kirjastoja, jotka kaikki ovat yhteensopivia sen MIT lisenssin kanssa. "
-"Seuraava tyhjentävä listaus sisältää kaikki tälläiset kolmannen osapuolen "
-"komponentit ja niiden vastaavat copyright ja lisenssi määritelmät."
+"Seuraava tyhjentävä listaus sisältää kaikki tällaiset kolmannen osapuolen "
+"komponentit ja niiden vastaavat tekijänoikeustiedot ja käyttöoikeusehdot."
#: editor/editor_about.cpp
msgid "All Components"
@@ -801,7 +791,7 @@ msgstr "Lisenssit"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Error opening package file, not in zip format."
-msgstr "Virhe avattaessa pakettia, ei zip muotoinen."
+msgstr "Virhe avattaessa pakettitiedostoa, ei zip-muodossa."
#: editor/editor_asset_installer.cpp
msgid "Uncompressing Assets"
@@ -835,12 +825,11 @@ msgstr "Lisää efekti"
#: editor/editor_audio_buses.cpp
msgid "Rename Audio Bus"
-msgstr "Nimeä väylä uudelleen"
+msgstr "Nimeä ääniväylä uudelleen"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Change Audio Bus Volume"
-msgstr "Ääniväylä sooloksi"
+msgstr "Muuta ääniväylän voimakkuutta"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
@@ -856,7 +845,7 @@ msgstr "Käytä ääniväylän efektejä"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr ""
+msgstr "Valitse ääniväylän lähtö"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
@@ -905,7 +894,7 @@ msgstr "Poista efekti"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Äänet"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
@@ -925,18 +914,18 @@ msgstr "Monista ääniväylä"
#: editor/editor_audio_buses.cpp
msgid "Reset Bus Volume"
-msgstr "Palauta äänenvoimakkuus"
+msgstr "Palauta väylän äänenvoimakkuus"
#: editor/editor_audio_buses.cpp
msgid "Move Audio Bus"
msgstr "Siirrä ääniväylää"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Tallenna ääniväylän asettelu nimellä..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "Sijainti uudelle asettelulle..."
#: editor/editor_audio_buses.cpp
@@ -1020,18 +1009,16 @@ msgid "File does not exist."
msgstr "Tiedostoa ei ole olemassa."
#: editor/editor_autoload_settings.cpp
-#, fuzzy
msgid "Not in resource path."
msgstr "Ei löytynyt resurssipolusta."
#: editor/editor_autoload_settings.cpp
-#, fuzzy
msgid "Add AutoLoad"
msgstr "Lisää automaattisesti ladattava"
#: editor/editor_autoload_settings.cpp
msgid "Autoload '%s' already exists!"
-msgstr "Automaattisesti ladattava '%s' löytyi jo!"
+msgstr "Automaattisesti ladattava '%s' on jo olemassa!"
#: editor/editor_autoload_settings.cpp
msgid "Rename Autoload"
@@ -1039,10 +1026,9 @@ msgstr "Nimeä automaattisesti ladattava uudelleen"
#: editor/editor_autoload_settings.cpp
msgid "Toggle AutoLoad Globals"
-msgstr ""
+msgstr "Aseta globaalien automaattilataus"
#: editor/editor_autoload_settings.cpp
-#, fuzzy
msgid "Move Autoload"
msgstr "Siirrä automaattisesti ladattavaa"
@@ -1065,7 +1051,7 @@ msgstr "Polku:"
#: editor/editor_autoload_settings.cpp
msgid "Node Name:"
-msgstr "Noden nimi:"
+msgstr "Solmun nimi:"
#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
#: editor/project_manager.cpp editor/settings_config_dialog.cpp
@@ -1073,30 +1059,28 @@ msgid "Name"
msgstr "Nimi"
#: editor/editor_autoload_settings.cpp
-#, fuzzy
msgid "Singleton"
-msgstr "Ainokainen"
+msgstr "Singleton"
#: editor/editor_data.cpp
msgid "Updating Scene"
msgstr "Päivitetään skeneä"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "Varastoidaan paikalliset muutokset..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "Päivitetään skeneä..."
#: editor/editor_data.cpp
-#, fuzzy
msgid "[empty]"
-msgstr "(tyhjä)"
+msgstr "[tyhjä]"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr "[ei tallennettu]"
+msgstr "[tallentamaton]"
#: editor/editor_dir_dialog.cpp
msgid "Please select a base directory first"
@@ -1136,18 +1120,16 @@ msgid "Packing"
msgstr "Pakataan"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
-#, fuzzy
msgid "Template file not found:"
-msgstr "Mallitiedostoa ei löytynyt:\n"
+msgstr "Mallitiedostoa ei löytynyt:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "File Exists, Overwrite?"
msgstr "Tiedosto on jo olemassa, korvaa?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select Current Folder"
-msgstr "Luo kansio"
+msgstr "Valitse nykyinen kansio"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
@@ -1158,8 +1140,8 @@ msgid "Show In File Manager"
msgstr "Näytä tiedostonhallinnassa"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Luo kansio..."
+msgid "New Folder..."
+msgstr "Uusi kansio..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1216,19 +1198,16 @@ msgid "Toggle Hidden Files"
msgstr "Näytä piilotiedostot"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Toggle Favorite"
-msgstr "Näytä suosikit"
+msgstr "Aseta suosikiksi"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Toggle Mode"
-msgstr "Näytä/piilota"
+msgstr "Aseta tila"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Focus Path"
-msgstr "Kohdista polku"
+msgstr "Kohdista polkuun"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Up"
@@ -1239,13 +1218,12 @@ msgid "Move Favorite Down"
msgstr "Siirrä suosikkia alas"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Go to parent folder"
-msgstr "Kansiota ei voitu luoda."
+msgstr "Siirry yläkansioon"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
-msgstr "Hakemistot & tiedostot:"
+msgstr "Hakemistot ja tiedostot:"
#: editor/editor_file_dialog.cpp
msgid "Preview:"
@@ -1257,23 +1235,21 @@ msgid "File:"
msgstr "Tiedosto:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Must use a valid extension."
-msgstr "Käytä sopivaa laajennusta"
+msgstr "Käytä sopivaa tiedostopäätettä."
#: editor/editor_file_system.cpp
msgid "ScanSources"
-msgstr ""
+msgstr "Selaa lähdetiedostoja"
#: editor/editor_file_system.cpp
msgid "(Re)Importing Assets"
-msgstr "Tuodaan (uudelleen) Assetteja"
+msgstr "Tuodaan (uudelleen) assetteja"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Search Help"
-msgstr "Hae oppaasta"
+msgstr "Etsi ohjeesta"
#: editor/editor_help.cpp
msgid "Class List:"
@@ -1285,7 +1261,7 @@ msgstr "Etsi luokkia"
#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Top"
-msgstr "Pinta"
+msgstr "Yläpuoli"
#: editor/editor_help.cpp editor/property_editor.cpp
msgid "Class:"
@@ -1296,27 +1272,24 @@ msgid "Inherits:"
msgstr "Perii:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Inherited by:"
-msgstr "Peritty:"
+msgstr "Perivät:"
#: editor/editor_help.cpp
msgid "Brief Description:"
msgstr "Lyhyt kuvaus:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Members"
-msgstr "Jäsenet:"
+msgstr "Jäsenet"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Members:"
msgstr "Jäsenet:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Public Methods"
-msgstr "Julkiset metodit:"
+msgstr "Julkiset metodit"
#: editor/editor_help.cpp
msgid "Public Methods:"
@@ -1324,66 +1297,59 @@ msgstr "Julkiset metodit:"
#: editor/editor_help.cpp
msgid "GUI Theme Items"
-msgstr "GUI teeman osat"
+msgstr "Käyttöliittymäteeman osat"
#: editor/editor_help.cpp
msgid "GUI Theme Items:"
-msgstr "GUI teeman osat:"
+msgstr "Käyttöliittymäteeman osat:"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Signals:"
msgstr "Signaalit:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Enumerations"
-msgstr "Animaatiot"
+msgstr "Enumeraatiot"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Enumerations:"
-msgstr "Animaatiot"
+msgstr "Enumeraatiot:"
#: editor/editor_help.cpp
msgid "enum "
-msgstr "enum"
+msgstr "enum "
#: editor/editor_help.cpp
-#, fuzzy
msgid "Constants"
-msgstr "Vakiot:"
+msgstr "Vakiot"
#: editor/editor_help.cpp
msgid "Constants:"
msgstr "Vakiot:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Description"
-msgstr "Kuvaus:"
+msgstr "Kuvaus"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Online Tutorials:"
-msgstr "Oppaat"
+msgstr "Online-oppaat:"
#: editor/editor_help.cpp
-#, fuzzy
msgid ""
"There are currently no tutorials for this class, you can [color=$color][url="
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Tälle metodille ei vielä löydy kuvailua. Voit auttaa meitä [color=$color]"
-"[url=$url]kirjoittamalla sellaisen[/url][/color]!"
+"Tälle luokalle ei vielä löydy kuvausta. Voit [color=$color][url=$url]auttaa "
+"luomalla sellaisen[/url][/color] tai [color=$color][url=$url2]pyytää "
+"sellaisen[/url][/color]."
#: editor/editor_help.cpp
-#, fuzzy
msgid "Properties"
-msgstr "Ominaisuudet:"
+msgstr "Ominaisuudet"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Property Description:"
msgstr "Ominaisuuden kuvaus:"
@@ -1392,13 +1358,12 @@ msgid ""
"There is currently no description for this property. Please help us by "
"[color=$color][url=$url]contributing one[/url][/color]!"
msgstr ""
-"Tälle ei vielä löydy kuvailua. Voit auttaa meitä [color=$color][url="
-"$url]kirjoittamalla sellaisen[/url][/color]!"
+"Tälle ominaisuudelle ei vielä löydy kuvausta. Voit auttaa meitä [color="
+"$color][url=$url]kirjoittamalla sellaisen[/url][/color]!"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Methods"
-msgstr "Metodilista:"
+msgstr "Metodit"
#: editor/editor_help.cpp
msgid "Method Description:"
@@ -1409,7 +1374,7 @@ msgid ""
"There is currently no description for this method. Please help us by [color="
"$color][url=$url]contributing one[/url][/color]!"
msgstr ""
-"Tälle metodille ei vielä löydy kuvailua. Voit auttaa meitä [color=$color]"
+"Tälle metodille ei vielä löydy kuvausta. Voit auttaa meitä [color=$color]"
"[url=$url]kirjoittamalla sellaisen[/url][/color]!"
#: editor/editor_help.cpp
@@ -1421,9 +1386,8 @@ msgid "Find"
msgstr "Etsi"
#: editor/editor_log.cpp
-#, fuzzy
msgid "Output:"
-msgstr " Tuloste:"
+msgstr "Tuloste:"
#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/property_editor.cpp editor/script_editor_debugger.cpp
@@ -1433,21 +1397,24 @@ msgid "Clear"
msgstr "Tyhjennä"
#: editor/editor_log.cpp
-#, fuzzy
msgid "Clear Output"
-msgstr "Tuloste"
+msgstr "Tyhjennä tuloste"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Projektin vienti epäonnistui virhekoodilla %d."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Virhe tallennettaessa resurssia!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Tallenna resurssi nimellä..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Ymmärrän..."
#: editor/editor_node.cpp
@@ -1463,32 +1430,28 @@ msgid "Error while saving."
msgstr "Virhe tallennettaessa."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Can't open '%s'."
-msgstr "Yhdistä..."
+msgstr "Ei voida avata tiedostoa '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while parsing '%s'."
-msgstr "Virhe tallennettaessa."
+msgstr "Virhe jäsennettäessä tiedostoa '%s'."
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
msgstr "Odottamaton loppu tiedostossa '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Missing '%s' or its dependencies."
-msgstr "Scenellä '%s' on rikkinäisiä riippuvuuksia:"
+msgstr "Tiedosto '%s' tai jokin sen riippuvuuksista puuttuu."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while loading '%s'."
-msgstr "Virhe tallennettaessa."
+msgstr "Virhe ladattaessa tiedostoa '%s'."
#: editor/editor_node.cpp
msgid "Saving Scene"
-msgstr "Tallennetaan sceneä"
+msgstr "Tallennetaan skeneä"
#: editor/editor_node.cpp
msgid "Analyzing"
@@ -1499,16 +1462,16 @@ msgid "Creating Thumbnail"
msgstr "Luodaan pienoiskuvaa"
#: editor/editor_node.cpp
-#, fuzzy
msgid "This operation can't be done without a tree root."
-msgstr "Tätä toimintoa ei voi tehdä ilman Sceneä."
+msgstr "Tätä toimintoa ei voi tehdä ilman että puun juuri on olemassa."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
-msgstr "Sceneä ei voitu tallentaa. Riippuvuuksia ei voitu tyydyttää."
+msgstr ""
+"Skeneä ei voitu tallentaa. Mahdollisia riippuvuuksia (ilmentymiä tai "
+"perintää) ei voida toteuttaa."
#: editor/editor_node.cpp
msgid "Failed to load resource."
@@ -1516,19 +1479,19 @@ msgstr "Resurssin lataaminen epäonnistui."
#: editor/editor_node.cpp
msgid "Can't load MeshLibrary for merging!"
-msgstr "MalliKirjastojen yhdistäminen ei onnistunut!"
+msgstr "Ei voitu ladata MeshLibrary resurssia yhdistämistä varten!"
#: editor/editor_node.cpp
msgid "Error saving MeshLibrary!"
-msgstr "Virhe tallennettaessa MeshLibrarya!"
+msgstr "Virhe tallennettaessa MeshLibrary resurssia!"
#: editor/editor_node.cpp
msgid "Can't load TileSet for merging!"
-msgstr "Ei voida ladata tilesetiä tuontia varten!"
+msgstr "Ei voida ladata ruutuvalikoimaa yhdistämistä varten!"
#: editor/editor_node.cpp
msgid "Error saving TileSet!"
-msgstr "Virhe tallennettaessa tilesetiä!"
+msgstr "Virhe tallennettaessa ruutuvalikoimaa!"
#: editor/editor_node.cpp
msgid "Error trying to save layout!"
@@ -1536,16 +1499,15 @@ msgstr "Virhe tallennettaessa asettelua!"
#: editor/editor_node.cpp
msgid "Default editor layout overridden."
-msgstr "Editorin oletusulkoasu ylikirjoitettu."
+msgstr "Editorin oletusasettelu ylikirjoitettu."
#: editor/editor_node.cpp
msgid "Layout name not found!"
-msgstr "Layoutin nimeä ei löytynyt!"
+msgstr "Asettelun nimeä ei löytynyt!"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Restored default layout to base settings."
-msgstr "Palautettiin oletusasettelu alkuperäiseen muotoonsa."
+msgstr "Palautettiin oletusasettelu alkuperäisiin asetuksiinsa."
#: editor/editor_node.cpp
msgid ""
@@ -1554,16 +1516,16 @@ msgid ""
"understand this workflow."
msgstr ""
"Tämä resurssi kuuluu tuotuun skeneen, joten sitä ei voi suoraan muokata.\n"
-"Lue ohjeet skenejen tuomisesta, jotta ymmärrät paremmin tämän työkulun."
+"Lue ohjeet skenejen tuomisesta, jotta ymmärrät paremmin tämän työnkulun."
#: editor/editor_node.cpp
msgid ""
"This resource belongs to a scene that was instanced or inherited.\n"
"Changes to it will not be kept when saving the current scene."
msgstr ""
-"Tämä resurssi kuuluu skeneen josta on luotu instanssi, tai joka on "
+"Tämä resurssi kuuluu skeneen, josta on luotu ilmentymä, tai joka on "
"periytyvä.\n"
-"Muutokset tähän eivät ole pysyviä, kun tallennat nykyisen skenen."
+"Muutokset siihen eivät ole pysyviä, kun tallennat nykyisen skenen."
#: editor/editor_node.cpp
msgid ""
@@ -1581,9 +1543,10 @@ msgid ""
"understand this workflow."
msgstr ""
"Tämä skene on tuotu, joten siihen tehtyjä muutoksia ei säilytetä.\n"
-"Instanssin, tai periytyvän skenen luominen mahdollistaa tämän.\n"
-"Ole hyvä ja lue tarkemmat ohjeet skenejen tuomisesta jotta ymmärrät paremmin "
-"tämän työnkulun."
+"Ilmentymän tai periytyvän skenen luominen siitä mahdollistaa muutoksien "
+"tekemisen siihen.\n"
+"Ole hyvä ja lue dokumentaatiosta tarkemmat ohjeet skenejen tuomisesta, jotta "
+"ymmärrät paremmin tämän työnkulun."
#: editor/editor_node.cpp
msgid ""
@@ -1595,14 +1558,12 @@ msgstr ""
"Ole hyvä ja lue ohjeet testaamisesta ymmärtääksesi paremmin tämän työnkulun."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Expand all properties"
-msgstr "Laajenna kaikki"
+msgstr "Laajenna kaikki ominaisuudet"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Collapse all properties"
-msgstr "Pienennä kaikki"
+msgstr "Tiivistä kaikki ominaisuudet"
#: editor/editor_node.cpp
msgid "Copy Params"
@@ -1621,14 +1582,12 @@ msgid "Copy Resource"
msgstr "Kopioi resurssi"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Make Built-In"
msgstr "Tee sisäänrakennettu"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Make Sub-Resources Unique"
-msgstr "Tee ali-resursseista yksilöllisiä."
+msgstr "Tee aliresursseista yksilöllisiä"
#: editor/editor_node.cpp
msgid "Open in Help"
@@ -1636,17 +1595,16 @@ msgstr "Avaa ohjeessa"
#: editor/editor_node.cpp
msgid "There is no defined scene to run."
-msgstr "Suoritettavaa sceneä ei ole määritetty."
+msgstr "Suoritettavaa skeneä ei ole määritetty."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"No main scene has ever been defined, select one?\n"
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"Pääsceneä ei ole määritetty, haluatko valita sen?\n"
-"Voit muuttaa sitä myöhemmin projektin asetuksista."
+"Pääskeneä ei ole määritetty, haluatko valita sen?\n"
+"Voit muuttaa sen myöhemmin projektin asetuksista, kohdasta 'Application'."
#: editor/editor_node.cpp
msgid ""
@@ -1654,8 +1612,8 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"Valittua sceneä '%s' ei ole olemassa, valitse kelvollinen?\n"
-"Voit muuttaa sitä myöhemmin projektin asetuksista."
+"Valittua skeneä '%s' ei ole olemassa, valitse kelvollinen?\n"
+"Voit muuttaa sitä myöhemmin projektin asetuksista, kohdasta 'Application'."
#: editor/editor_node.cpp
msgid ""
@@ -1663,13 +1621,13 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"Valittu scene '%s' ei ole scene-tiedosto, valitse kelvollinen?\n"
-"Voit muuttaa sitä myöhemmin projektin asetuksista."
+"Valittu skene '%s' ei ole scene-tiedosto, valitse kelvollinen?\n"
+"Voit muuttaa sitä myöhemmin projektin asetuksista, kohdasta 'Application'."
#: editor/editor_node.cpp
msgid "Current scene was never saved, please save it prior to running."
msgstr ""
-"Nykyistä sceneä ei ole vielä tallennettu. Tallenna se ennen suorittamista."
+"Nykyistä skeneä ei ole vielä tallennettu. Tallenna se ennen suorittamista."
#: editor/editor_node.cpp
msgid "Could not start subprocess!"
@@ -1677,32 +1635,31 @@ msgstr "Aliprosessia ei voitu käynnistää!"
#: editor/editor_node.cpp
msgid "Open Scene"
-msgstr "Avaa scene"
+msgstr "Avaa skene"
#: editor/editor_node.cpp
msgid "Open Base Scene"
-msgstr "Avaa kantascene"
+msgstr "Avaa kantaskene"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Nopea skenen avaus..."
+msgid "Quick Open Scene..."
+msgstr "Skenen pika-avaus..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Nopea skriptin avaus..."
+msgid "Quick Open Script..."
+msgstr "Skriptin pika-avaus..."
#: editor/editor_node.cpp
msgid "Save & Close"
msgstr "Tallenna ja sulje"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save changes to '%s' before closing?"
-msgstr "Tallennetaanko muutokset '%s' ennen sulkemista?"
+msgstr "Tallennetaanko muutokset tiedostoon '%s' ennen sulkemista?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Tallenna scene nimellä..."
+msgid "Save Scene As..."
+msgstr "Tallenna skene nimellä..."
#: editor/editor_node.cpp
msgid "No"
@@ -1714,35 +1671,35 @@ msgstr "Kyllä"
#: editor/editor_node.cpp
msgid "This scene has never been saved. Save before running?"
-msgstr "Tätä sceneä ei ole koskaan tallennettu. Tallenna ennen suorittamista?"
+msgstr "Tätä skeneä ei ole koskaan tallennettu. Tallenna ennen suorittamista?"
#: editor/editor_node.cpp editor/scene_tree_dock.cpp
msgid "This operation can't be done without a scene."
-msgstr "Tätä toimintoa ei voi tehdä ilman sceneä."
+msgstr "Tätä toimintoa ei voi tehdä ilman skeneä."
#: editor/editor_node.cpp
msgid "Export Mesh Library"
-msgstr "Vie malli kirjasto"
+msgstr "Vie mesh-kirjasto"
#: editor/editor_node.cpp
msgid "This operation can't be done without a root node."
-msgstr "Tätä toimintoa ei voida suorittaa ilman päänodea."
+msgstr "Tätä toimintoa ei voida suorittaa ilman juurisolmua."
#: editor/editor_node.cpp
msgid "Export Tile Set"
-msgstr "Vie tileset"
+msgstr "Vie ruutuvalikoima"
#: editor/editor_node.cpp
msgid "This operation can't be done without a selected node."
-msgstr "Tätä toimintoa ei voi tehdä ilman valittua nodea."
+msgstr "Tätä toimintoa ei voi tehdä ilman valittua solmua."
#: editor/editor_node.cpp
msgid "Current scene not saved. Open anyway?"
-msgstr "Nykyistä sceneä ei ole tallennettu. Avaa joka tapauksessa?"
+msgstr "Nykyistä skeneä ei ole tallennettu. Avaa joka tapauksessa?"
#: editor/editor_node.cpp
msgid "Can't reload a scene that was never saved."
-msgstr "Ei voida uudelleen ladata skeneä jota ei ole vielä tallennettu."
+msgstr "Ei voida ladata uudelleen skeneä, jota ei ole koskaan tallennettu."
#: editor/editor_node.cpp
msgid "Revert"
@@ -1753,8 +1710,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Tätä toimintoa ei voida peruttaa. Palauta joka tapauksessa?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Nopea skenen käynnistys..."
+msgid "Quick Run Scene..."
+msgstr "Skenen pikakäynnistys..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1766,7 +1723,7 @@ msgstr "Poistu editorista?"
#: editor/editor_node.cpp
msgid "Open Project Manager?"
-msgstr "Projektienhallinta"
+msgstr "Avataanko projektinhallinta?"
#: editor/editor_node.cpp
msgid "Save & Quit"
@@ -1792,7 +1749,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Pick a Main Scene"
-msgstr "Valitse pääscene"
+msgstr "Valitse pääskene"
#: editor/editor_node.cpp
msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
@@ -1800,7 +1757,7 @@ msgstr "Lisäosan '%s' aktivointi epäonnistui, virheellinen asetustiedosto."
#: editor/editor_node.cpp
msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
-msgstr ""
+msgstr "Skriptikenttää ei löytynyt lisäosan tiedostosta: 'res://addons/%s'."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s'."
@@ -1821,8 +1778,8 @@ msgid ""
"Scene '%s' was automatically imported, so it can't be modified.\n"
"To make changes to it, a new inherited scene can be created."
msgstr ""
-"Scene '%s' tuotiin automaattisesti, joten sitä ei voida muokata.\n"
-"Muokataksesi sitä voit luoda uuden perityn Scenen."
+"Skene '%s' tuotiin automaattisesti, joten sitä ei voida muokata.\n"
+"Muokataksesi sitä voit luoda uuden perityn skenen."
#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -1834,20 +1791,20 @@ msgid ""
"Error loading scene, it must be inside the project path. Use 'Import' to "
"open the scene, then save it inside the project path."
msgstr ""
-"Virhe Scenen latauksessa, sen täytyy sijaita projektin polussa. Käytä 'Tuo' -"
-"toimintoa avataksesi Scenen ja tallenna se projektin polkuun."
+"Virhe skenen latauksessa, sen täytyy sijaita projektin polussa. Käytä 'Tuo'-"
+"toimintoa avataksesi skenen ja tallenna se projektin polkuun."
#: editor/editor_node.cpp
msgid "Scene '%s' has broken dependencies:"
-msgstr "Scenellä '%s' on rikkinäisiä riippuvuuksia:"
+msgstr "Skenellä '%s' on rikkinäisiä riippuvuuksia:"
#: editor/editor_node.cpp
msgid "Clear Recent Scenes"
-msgstr "Tyhjennä viimeiset scenet"
+msgstr "Tyhjennä viimeisimmät skenet"
#: editor/editor_node.cpp
msgid "Save Layout"
-msgstr "Tallenna asettelut"
+msgstr "Tallenna asettelu"
#: editor/editor_node.cpp
msgid "Delete Layout"
@@ -1860,7 +1817,7 @@ msgstr "Oletus"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr "Vaihda Scenen välilehteä"
+msgstr "Vaihda skenen välilehteä"
#: editor/editor_node.cpp
msgid "%d more files or folders"
@@ -1907,23 +1864,23 @@ msgid "Previous tab"
msgstr "Edellinen välilehti"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Suodata tiedostot..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
-msgstr "Toiminnot skene tiedostoille."
+msgstr "Toiminnot skenetiedostoille."
#: editor/editor_node.cpp
msgid "New Scene"
msgstr "Uusi skene"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Uusi peritty skene..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "Avaa skene..."
#: editor/editor_node.cpp
@@ -1943,16 +1900,16 @@ msgid "Open Recent"
msgstr "Avaa viimeaikainen"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "Muunna..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MalliKirjasto..."
+msgid "MeshLibrary..."
+msgstr "Mesh-kirjastoksi..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr ""
+msgid "TileSet..."
+msgstr "Ruutuvalikoimaksi..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -1973,9 +1930,8 @@ msgid "Miscellaneous project or scene-wide tools."
msgstr "Sekalaiset projekti- tai skenetyökalut."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Project"
-msgstr "Uusi projekti"
+msgstr "Projekti"
#: editor/editor_node.cpp
msgid "Project Settings"
@@ -1999,23 +1955,23 @@ msgstr "Lopeta ja palaa projektiluetteloon"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Debug"
-msgstr "Testaa"
+msgstr "Virheenkorjaus"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
-msgstr "Julkaise etätestauksen kasnsa"
+msgstr "Julkaise etätestauksen kanssa"
#: editor/editor_node.cpp
msgid ""
"When exporting or deploying, the resulting executable will attempt to "
"connect to the IP of this computer in order to be debugged."
msgstr ""
-"Vietäessä tai julkaistaessa, käynnistystiedosto yrittää ottaa yhteyden tämän "
-"tietokoneen IP osoitteeseen testaamista varten."
+"Vietäessä tai julkaistaessa, käynnistettävä ohjelma yrittää ottaa yhteyden "
+"tämän tietokoneen IP-osoitteeseen testaamista varten."
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr ""
+msgstr "Kevyt käyttöönotto verkkolevyn avulla"
#: editor/editor_node.cpp
msgid ""
@@ -2034,16 +1990,15 @@ msgstr ""
"kohdalla."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Visible Collision Shapes"
-msgstr "Näytä osuma-alueet"
+msgstr "Näytä törmäysmuodot"
#: editor/editor_node.cpp
msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
-"Osuma-alueet ja raycast nodet (2D ja 3D) ovat näkyvillä peliä ajettaessa "
+"Törmäysmuodot ja raycast-solmut (2D ja 3D) ovat näkyvillä peliä ajettaessa "
"tämän ollessa valittuna."
#: editor/editor_node.cpp
@@ -2055,8 +2010,8 @@ msgid ""
"Navigation meshes and polygons will be visible on the running game if this "
"option is turned on."
msgstr ""
-"Navigaatiomuodot ja -polygonit ovat näkyvillä peliä ajettaessa tämän ollessa "
-"valittuna."
+"Navigointiverkot ja niiden polygonit ovat näkyvillä peliä ajettaessa tämän "
+"ollessa valittuna."
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
@@ -2071,15 +2026,13 @@ msgid ""
msgstr ""
"Tämän ollessa valittuna, kaikki skeneen tehdyt muutokset toteutetaan myös "
"käynnissä olevassa pelissä.\n"
-"Tämä on tehokkainta verkkotiedostojärjestelmän kanssa mikäli käytössä on "
-"etälaite."
+"Mikäli peliä ajetaan etälaitteella, on tehokkaampaa käyttää verkkolevyä."
#: editor/editor_node.cpp
msgid "Sync Script Changes"
msgstr "Synkronoi skriptin muutokset"
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"When this option is turned on, any script that is saved will be reloaded on "
"the running game.\n"
@@ -2088,13 +2041,11 @@ msgid ""
msgstr ""
"Jos tämä on valittu, kaikki tallennetut skriptit ladataan uudelleen pelin "
"käynnistyessä.\n"
-"Mikäli peli ajetaan etälaitteella, on tehokkaampaa käyttää "
-"verkkotiedostojärjestelmää ."
+"Mikäli peliä ajetaan etälaitteella, on tehokkaampaa käyttää verkkolevyä."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Editor"
-msgstr "Muokkaa"
+msgstr "Editori"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
@@ -2110,7 +2061,7 @@ msgstr "Siirry koko näytön tilaan"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
-msgstr "Hallitse vietäviä Templateja"
+msgstr "Hallinnoi vientimalleja"
#: editor/editor_node.cpp
msgid "Help"
@@ -2132,9 +2083,8 @@ msgid "Online Docs"
msgstr "Dokumentaatio"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Q&A"
-msgstr "Kysy&Vastaa"
+msgstr "Kysymykset ja vastaukset"
#: editor/editor_node.cpp
msgid "Issue Tracker"
@@ -2150,24 +2100,23 @@ msgstr "Tietoja"
#: editor/editor_node.cpp
msgid "Play the project."
-msgstr "Käynnistä projekti"
+msgstr "Käynnistä projekti."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Play"
-msgstr "Toista"
+msgstr "Pelaa"
#: editor/editor_node.cpp
msgid "Pause the scene"
-msgstr "Pysäytä Scene"
+msgstr "Keskeytä skenen suorittaminen hetkellisesti"
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr "Pysäytä Scene"
+msgstr "Keskeytä skene"
#: editor/editor_node.cpp
msgid "Stop the scene."
-msgstr "Lopeta Scene."
+msgstr "Lopeta skenen suorittaminen."
#: editor/editor_node.cpp
msgid "Stop"
@@ -2175,11 +2124,11 @@ msgstr "Pysäytä"
#: editor/editor_node.cpp
msgid "Play the edited scene."
-msgstr "Käynnistä muokattu skene."
+msgstr "Käynnistä muokattavana oleva skene."
#: editor/editor_node.cpp
msgid "Play Scene"
-msgstr "Toista Scene"
+msgstr "Toista skene"
#: editor/editor_node.cpp
msgid "Play custom scene"
@@ -2207,7 +2156,7 @@ msgstr "Poista päivitysanimaatio"
#: editor/editor_node.cpp
msgid "Inspector"
-msgstr "Tarkastaja"
+msgstr "Tarkastelu"
#: editor/editor_node.cpp
msgid "Create a new resource in memory and edit it."
@@ -2222,7 +2171,7 @@ msgid "Save the currently edited resource."
msgstr "Tallenna tällä hetkellä muokattu resurssi."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Tallenna nimellä..."
#: editor/editor_node.cpp
@@ -2252,7 +2201,7 @@ msgstr "Tuo"
#: editor/editor_node.cpp
msgid "Node"
-msgstr "Node"
+msgstr "Solmu"
#: editor/editor_node.cpp
msgid "FileSystem"
@@ -2288,16 +2237,15 @@ msgstr "Salasana:"
#: editor/editor_node.cpp
msgid "Open & Run a Script"
-msgstr "Avaa & suorita skripti"
+msgstr "Avaa ja suorita skripti"
#: editor/editor_node.cpp
-#, fuzzy
msgid "New Inherited"
-msgstr "Uusi peritty Scene..."
+msgstr "Uusi peritty skene"
#: editor/editor_node.cpp
msgid "Load Errors"
-msgstr "Lataa virheet"
+msgstr "Latausvirheet"
#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Select"
@@ -2317,7 +2265,7 @@ msgstr "Avaa skriptieditori"
#: editor/editor_node.cpp editor/project_manager.cpp
msgid "Open Asset Library"
-msgstr "Avaa Asset-kirjasto"
+msgstr "Avaa asset-kirjasto"
#: editor/editor_node.cpp
msgid "Open the next Editor"
@@ -2329,10 +2277,10 @@ msgstr "Avaa edellinen editori"
#: editor/editor_plugin.cpp
msgid "Creating Mesh Previews"
-msgstr "Luodaan mallien esikatseluita"
+msgstr "Luodaan meshien esikatseluita"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr "Pienoiskuva..."
#: editor/editor_plugin_settings.cpp
@@ -2365,13 +2313,12 @@ msgid "Start Profiling"
msgstr "Aloita profilointi"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Measure:"
-msgstr "Mittayksikkö:"
+msgstr "Mittaa:"
#: editor/editor_profiler.cpp
msgid "Frame Time (sec)"
-msgstr "Framen aika (sek)"
+msgstr "Kuvaruudun aika (sek)"
#: editor/editor_profiler.cpp
msgid "Average Time (sec)"
@@ -2379,12 +2326,11 @@ msgstr "Keskimääräinen aika (sek)"
#: editor/editor_profiler.cpp
msgid "Frame %"
-msgstr "Frame %"
+msgstr "Kuvaruutujen %"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Physics Frame %"
-msgstr "Kiinteä Frame %"
+msgstr "Fysiikkaruutujen %"
#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
msgid "Time:"
@@ -2392,7 +2338,7 @@ msgstr "Aika:"
#: editor/editor_profiler.cpp
msgid "Inclusive"
-msgstr ""
+msgstr "Sisältävä"
#: editor/editor_profiler.cpp
msgid "Self"
@@ -2403,14 +2349,12 @@ msgid "Frame #:"
msgstr "Ruutu #:"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Time"
-msgstr "Aika:"
+msgstr "Aika"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Calls"
-msgstr "Kutsu"
+msgstr "Kutsuja"
#: editor/editor_run_native.cpp
msgid "Select device from the list"
@@ -2422,15 +2366,15 @@ msgid ""
"Please add a runnable preset in the export menu."
msgstr ""
"Käynnistettävää vientipohjaa ei löytynyt tälle alustalle.\n"
-"Lisää sellainen vienti-valikosta."
+"Lisää sellainen vientivalikosta."
#: editor/editor_run_script.cpp
msgid "Write your logic in the _run() method."
-msgstr "Kirjoita logiikka _run() -metodiin."
+msgstr "Kirjoita logiikka _run() metodiin."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
-msgstr "Muokattu Scene on jo olemassa."
+msgstr "Muokattu skene on jo olemassa."
#: editor/editor_run_script.cpp
msgid "Couldn't instance script:"
@@ -2438,7 +2382,7 @@ msgstr "Ei voitu luoda instanssia skriptistä:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
-msgstr "Unohditko 'tool' hakusanan?"
+msgstr "Unohditko 'tool' avainsanan?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
@@ -2446,7 +2390,7 @@ msgstr "Skriptiä ei voitu suorittaa:"
#: editor/editor_run_script.cpp
msgid "Did you forget the '_run' method?"
-msgstr "Unohditko '_run' -metodin?"
+msgstr "Unohditko '_run' metodin?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
@@ -2454,15 +2398,15 @@ msgstr "Oletus (sama kuin editori)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
-msgstr "Valitse tuotava(t) node(t)"
+msgstr "Valitse tuotavat solmut"
#: editor/editor_sub_scene.cpp
msgid "Scene Path:"
-msgstr "Scenen polku:"
+msgstr "Skenen polku:"
#: editor/editor_sub_scene.cpp
msgid "Import From Node:"
-msgstr "Tuo Nodesta:"
+msgstr "Tuo solmusta:"
#: editor/export_template_manager.cpp
msgid "Re-Download"
@@ -2489,7 +2433,7 @@ msgid "(Current)"
msgstr "(Nykyinen)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Noudetaan peilipalvelimia, hetkinen..."
#: editor/export_template_manager.cpp
@@ -2498,32 +2442,23 @@ msgstr "Poista mallin versio '%s'?"
#: editor/export_template_manager.cpp
msgid "Can't open export templates zip."
-msgstr "Vientipohjien zip-tiedostoa ei voitu avata."
+msgstr "Vientimallien zip-tiedostoa ei voitu avata."
#: editor/export_template_manager.cpp
msgid "Invalid version.txt format inside templates."
-msgstr "Paketti sisältää viallisen version.txt tiedoston."
-
-#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Paketti sisältää viallisen version.txt tiedoston. 'Revision' ei ole "
-"hyväksytty tunniste."
+msgstr "Vientimalli sisältää virheellisen version.txt tiedoston."
#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
-msgstr "version.txt -tiedostoa ei löytynyt."
+msgstr "Vientimalleista ei löytynyt version.txt tiedostoa."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Error creating path for templates:"
-msgstr "Virhe luotaessa polkua mallille:\n"
+msgstr "Virhe luotaessa polkua malleille:"
#: editor/export_template_manager.cpp
msgid "Extracting Export Templates"
-msgstr "Puretaan vientipohjia."
+msgstr "Puretaan vientimalleja"
#: editor/export_template_manager.cpp
msgid "Importing:"
@@ -2554,7 +2489,6 @@ msgstr "Ei vastausta."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Request Failed."
msgstr "Pyyntö epäonnistui."
@@ -2569,29 +2503,24 @@ msgid "Failed:"
msgstr "Epäonnistui:"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Download Complete."
-msgstr "Lataa"
+msgstr "Lataus valmis."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Error requesting url: "
-msgstr "Virhe tallennettaessa atlas-kuvaa:"
+msgstr "Virhe pyydettäessä osoitetta: "
#: editor/export_template_manager.cpp
-#, fuzzy
-msgid "Connecting to Mirror.."
-msgstr "Yhdistä..."
+msgid "Connecting to Mirror..."
+msgstr "Yhdistetään peilipalvelimeen..."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Disconnected"
-msgstr "Katkaise yhteys"
+msgstr "Yhteys katkaistu"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Resolving"
-msgstr "Tallennetaan..."
+msgstr "Selvitetään"
#: editor/export_template_manager.cpp
msgid "Can't Resolve"
@@ -2599,29 +2528,25 @@ msgstr "Yhdistäminen epäonnistui"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
-msgid "Connecting.."
-msgstr "Yhdistä..."
+msgid "Connecting..."
+msgstr "Yhdistetään..."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Can't Connect"
msgstr "Ei voitu yhdistää"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Connected"
-msgstr "Yhdistä"
+msgstr "Yhdistetty"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "Pyydetään..."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Downloading"
-msgstr "Lataa"
+msgstr "Ladataan"
#: editor/export_template_manager.cpp
msgid "Connection Error"
@@ -2652,14 +2577,12 @@ msgid "Select template file"
msgstr "Valitse mallin tiedosto"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Export Template Manager"
msgstr "Vientimallien hallinta"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Download Templates"
-msgstr "Poista malli"
+msgstr "Lataa mallit"
#: editor/export_template_manager.cpp
msgid "Select mirror from list: "
@@ -2669,7 +2592,7 @@ msgstr "Valitse peilipalvelin listasta: "
msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
msgstr ""
"Tiedostoa file_type_cache.cch ei voitu avata kirjoittamista varten. "
-"Välimuistia ei tallenneta. "
+"Välimuistia ei tallenneta!"
#: editor/filesystem_dock.cpp
msgid "Cannot navigate to '%s' as it has not been found in the file system!"
@@ -2686,79 +2609,65 @@ msgid "View items as a list"
msgstr "Listanäkymä"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Status: Import of file failed. Please fix file and reimport manually."
msgstr ""
-"\n"
-"Tila: Tuonti epäonnistui. Ole hyvä, korjaa tiedosto, ja tuo uudelleen."
+"Tila: Tuonti epäonnistui. Ole hyvä, korjaa tiedosto ja tuo se uudelleen."
#: editor/filesystem_dock.cpp
msgid "Cannot move/rename resources root."
msgstr "Ei voitu siirtää/nimetä uudelleen resurssien päätasoa."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Cannot move a folder into itself."
-msgstr "Hakemistoa ei voi siirtää itsensä sisään.\n"
+msgstr "Kansiota ei voi siirtää itsensä sisään."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error moving:"
-msgstr "Virhe tuotaessa:"
+msgstr "Virhe siirrettäessä:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error duplicating:"
-msgstr "Virhe ladatessa:"
+msgstr "Virhe kahdennettaessa:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Unable to update dependencies:"
-msgstr "Scenellä '%s' on rikkinäisiä riippuvuuksia:"
+msgstr "Ei voida päivittää riippuvuuksia:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "No name provided"
msgstr "Nimeä ei annettu"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Provided name contains invalid characters"
-msgstr "Annettu nimi sisältää laittomia kirjaimia"
+msgstr "Annettu nimi sisältää virheellisiä kirjainmerkkejä"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "No name provided."
-msgstr "Nimeä uudelleen tai siirrä..."
+msgstr "Nimeä ei annettu."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Name contains invalid characters."
-msgstr "Kelvolliset merkit:"
+msgstr "Nimi sisältää virheellisiä kirjainmerkkejä."
#: editor/filesystem_dock.cpp
msgid "A file or folder with this name already exists."
msgstr "Tällä nimellä löytyy jo kansio tai tiedosto."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Renaming file:"
-msgstr "Nimeä muuttuja uudelleen"
+msgstr "Nimetään tiedosto uudelleen:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Renaming folder:"
-msgstr "Nimeä Node uudelleen"
+msgstr "Nimetään kansio uudelleen:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating file:"
-msgstr "Monista"
+msgstr "Kahdennetaan tiedosto:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating folder:"
-msgstr "Nimeä Node uudelleen"
+msgstr "Kahdennetaan kansio:"
#: editor/filesystem_dock.cpp
msgid "Expand all"
@@ -2769,35 +2678,32 @@ msgid "Collapse all"
msgstr "Pienennä kaikki"
#: editor/filesystem_dock.cpp
-#, fuzzy
-msgid "Rename.."
-msgstr "Nimeä uudelleen"
+msgid "Rename..."
+msgstr "Nimeä uudelleen..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Siirrä..."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Open Scene(s)"
-msgstr "Avaa scene"
+msgstr "Avaa skene tai skenejä"
#: editor/filesystem_dock.cpp
msgid "Instance"
-msgstr "Instanssi"
+msgstr "Luo ilmentymä"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "Muokkaa riippuvuuksia..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "Tarkastele omistajia..."
#: editor/filesystem_dock.cpp
-#, fuzzy
-msgid "Duplicate.."
-msgstr "Monista"
+msgid "Duplicate..."
+msgstr "Kahdenna..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2809,7 +2715,7 @@ msgstr "Seuraava hakemisto"
#: editor/filesystem_dock.cpp
msgid "Re-Scan Filesystem"
-msgstr ""
+msgstr "Skannaa tiedostojärjestelmä uudelleen"
#: editor/filesystem_dock.cpp
msgid "Toggle folder status as Favorite"
@@ -2817,16 +2723,15 @@ msgstr "Merkitse kansio suosikkeihin"
#: editor/filesystem_dock.cpp
msgid "Instance the selected scene(s) as child of the selected node."
-msgstr "Luo valituista skeneistä instanssi valitun noden alle."
+msgstr "Luo valituista skeneistä ilmentymä valitun solmun alle."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Selataan tiedostoja,\n"
-"Hetkinen..."
+"Hetkinen…"
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2846,49 +2751,40 @@ msgid "Remove from Group"
msgstr "Poista ryhmästä"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import as Single Scene"
-msgstr "Tuodaan Scene..."
+msgstr "Tuo yhtenä skenenä"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Animations"
-msgstr "Tuo animaatiot..."
+msgstr "Tuo erillisten animaatioiden kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Materials"
msgstr "Tuo erillisten materiaalien kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Objects"
msgstr "Tuo erillisten objektien kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Objects+Materials"
msgstr "Tuo erillisten objektien ja materiaalien kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Objects+Animations"
msgstr "Tuo erillisten objektien ja animaatioiden kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Materials+Animations"
msgstr "Tuo erillisten materiaalien ja animaatioiden kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import with Separate Objects+Materials+Animations"
msgstr "Tuo erillisten objektien, materiaalien ja animaatioiden kanssa"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import as Multiple Scenes"
-msgstr "Tuo 3D Scene"
+msgstr "Tuo useina skeneinä"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes+Materials"
@@ -2897,49 +2793,48 @@ msgstr "Tuo useina skeneinä ja materiaaleina"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import Scene"
-msgstr "Tuo Scene"
+msgstr "Tuo skene"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Tuodaan Scene..."
+msgid "Importing Scene..."
+msgstr "Tuodaan skene..."
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Generating Lightmaps"
-msgstr "Muunna Lightmapiksi:"
+msgstr "Luodaan Lightmappeja"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Generating for Mesh: "
-msgstr "Luo AABB"
+msgstr "Luodaan meshille: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Suorita valitsemasi skripti..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
-msgstr "Ei voitu ladata tuonnin jälkeistä skriptiä: "
+msgstr "Ei voitu ladata tuonnin jälkeistä skriptiä:"
#: editor/import/resource_importer_scene.cpp
msgid "Invalid/broken script for post-import (check console):"
-msgstr "Viallinen tuonnin jälkeinen skripti (tarkista konsoli) : "
+msgstr ""
+"Virheellinen tai viallinen tuonnin jälkeinen skripti (tarkista konsoli):"
#: editor/import/resource_importer_scene.cpp
msgid "Error running post-import script:"
-msgstr "Virhe ajettaessa tuonnin jälkeistä skriptiä: "
+msgstr "Virhe ajettaessa tuonnin jälkeistä skriptiä:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Tallennetaan..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
-msgstr ""
+msgstr "Aseta oletus valinnalle '%s'"
#: editor/import_dock.cpp
msgid "Clear Default for '%s'"
-msgstr ""
+msgstr "Poista oletus valinnalta '%s'"
#: editor/import_dock.cpp
msgid " Files"
@@ -2950,7 +2845,7 @@ msgid "Import As:"
msgstr "Tuo nimellä:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr "Esiasetus..."
#: editor/import_dock.cpp
@@ -2959,7 +2854,7 @@ msgstr "Tuo uudelleen"
#: editor/multi_node_edit.cpp
msgid "MultiNode Set"
-msgstr ""
+msgstr "Aseta usealle solmulle"
#: editor/node_dock.cpp
msgid "Groups"
@@ -2967,7 +2862,7 @@ msgstr "Ryhmät"
#: editor/node_dock.cpp
msgid "Select a Node to edit Signals and Groups."
-msgstr "Valitse node jonka signaaleja ja ryhmiä haluat muokata."
+msgstr "Valitse solmu, jonka signaaleja ja ryhmiä haluat muokata."
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -3059,11 +2954,11 @@ msgstr "Lisää animaatio"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Next Changed"
-msgstr "Sekoita seuraavaan vaihdettu"
+msgstr "Sulauta seuraavaan vaihdettu"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Blend Time"
-msgstr ""
+msgstr "Muuta sulautusaikaa"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load Animation"
@@ -3115,11 +3010,11 @@ msgstr "Toista valittu animaatio nykyisestä kohdasta. (D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation position (in seconds)."
-msgstr "Animaation sijainti (sekunneissa)."
+msgstr "Animaation kohta (sekunneissa)."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Scale animation playback globally for the node."
-msgstr ""
+msgstr "Skaalaa animaation toistoa globaalisti solmulle."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create new animation in player."
@@ -3143,11 +3038,11 @@ msgstr "Näytä lista animaatioista soittimessa."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Autoplay on Load"
-msgstr "Toista automaattisesti"
+msgstr "Toista automaattisesti ladattaessa"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Edit Target Blend Times"
-msgstr ""
+msgstr "Muokkaa kohteen sulautusaikoja"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Tools"
@@ -3163,7 +3058,7 @@ msgstr "Onion skinning"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Enable Onion Skinning"
-msgstr "Käytä Onion skinningiä"
+msgstr "Käytä onion skinningiä"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Directions"
@@ -3203,7 +3098,7 @@ msgstr "Pakota valkoisen modulaatio"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Include Gizmos (3D)"
-msgstr ""
+msgstr "Näytä 3D-muokkaimet"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create New Animation"
@@ -3264,7 +3159,7 @@ msgstr "Sulauta"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix"
-msgstr "Sekoitus"
+msgstr "Sekoita"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Auto Restart:"
@@ -3313,11 +3208,11 @@ msgstr "Lisää syöte"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Clear Auto-Advance"
-msgstr ""
+msgstr "Poista automaattinen eteneminen"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Set Auto-Advance"
-msgstr ""
+msgstr "Aseta automaattinen eteneminen"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Delete Input"
@@ -3333,56 +3228,55 @@ msgstr "Animaatiopuu ei ole kelvollinen."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation Node"
-msgstr "Animaationode"
+msgstr "Animaatiosolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "OneShot Node"
-msgstr "OneShot node"
+msgstr "Vaiheistussolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix Node"
-msgstr "Mix Node"
+msgstr "Sekoitussolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend2 Node"
-msgstr "Sulautus2 node"
+msgstr "2-sulautussolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend3 Node"
-msgstr ""
+msgstr "3-sulautussolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend4 Node"
-msgstr ""
+msgstr "4-sulautussolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeScale Node"
-msgstr ""
+msgstr "Ajanskaalaussolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeSeek Node"
-msgstr ""
+msgstr "Ajanhakusolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Transition Node"
-msgstr "Siirtymänode"
+msgstr "Siirtymäsolmu"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr "Tuo animaatiot..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
-msgstr "Muokkaa noden suodattimia"
+msgstr "Muokkaa solmun suodattimia"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Suodattimet..."
#: editor/plugins/animation_tree_editor_plugin.cpp
-#, fuzzy
msgid "AnimationTree"
-msgstr "Animaatio"
+msgstr "Animaatiopuu"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
@@ -3393,9 +3287,8 @@ msgid "Contents:"
msgstr "Sisällöt:"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "View Files"
-msgstr " Tiedostot"
+msgstr "Näytä tiedostot"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve hostname:"
@@ -3406,18 +3299,16 @@ msgid "Connection error, please try again."
msgstr "Yhteysvirhe, ole hyvä ja yritä uudelleen."
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Can't connect to host:"
-msgstr "Yhdistä Nodeen:"
+msgstr "Isäntään yhdistäminen epäonnistui:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No response from host:"
-msgstr "Ei vastausta isännältä: "
+msgstr "Ei vastausta isännältä:"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Request failed, return code:"
-msgstr "Pyydetty tiedostomuoto tuntematon:"
+msgstr "Pyyntö epäonnistui, virhekoodi:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request failed, too many redirects"
@@ -3448,14 +3339,12 @@ msgid "Fetching:"
msgstr "Noudetaan:"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
-msgid "Resolving.."
-msgstr "Tallennetaan..."
+msgid "Resolving..."
+msgstr "Selvitetään..."
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Error making request"
-msgstr "Virhe tallennettaessa resurssia!"
+msgstr "Virhe pyynnön luonnissa"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Idle"
@@ -3466,9 +3355,8 @@ msgid "Retry"
msgstr "Yritä uudelleen"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Download Error"
-msgstr "Lataa"
+msgstr "Latausvirhe"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download for this asset is already in progress!"
@@ -3518,7 +3406,7 @@ msgid "Site:"
msgstr "Sivu:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Tuki..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3526,7 +3414,6 @@ msgid "Official"
msgstr "Virallinen"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Testing"
msgstr "Testaus"
@@ -3540,21 +3427,27 @@ msgid ""
"Save your scene (for images to be saved in the same dir), or pick a save "
"path from the BakedLightmap properties."
msgstr ""
+"Lightmap-kuvien tallennuspolun määrittäminen ei onnistu.\n"
+"Tallenna skenesi (jotta kuvat tallentuisivat samaan hakemistoon), tai "
+"valitse tallennuspolku BakedLightmapin asetuksista."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
"Light' flag is on."
msgstr ""
+"Ei meshejä kehitettävänä. Varmista, että ne sisältävät UV2-kanavan, ja että "
+"'Bake Light' asetus on päällä."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
msgstr ""
+"Lightmap-kuvien luonti epäonnistui, varmista, että polku on "
+"kirjoituskelpoinen."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
-#, fuzzy
msgid "Bake Lightmaps"
-msgstr "Muunna Lightmapiksi:"
+msgstr "Kehitä Lightmapit"
#: editor/plugins/camera_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3589,36 +3482,31 @@ msgstr "Siirrä keskikohtaa"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Action"
-msgstr "Siirrä "
+msgstr "Siirrä"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move vertical guide"
msgstr "Siirrä pystysuuntaista apuviivaa"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Create new vertical guide"
-msgstr "Luo uusi skripti"
+msgstr "Luo uusi pystysuora apuviiva"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Remove vertical guide"
-msgstr "Poista muuttuja"
+msgstr "Poista pystysuora apuviiva"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Move horizontal guide"
-msgstr "Siirrä pistettä käyrällä"
+msgstr "Siirrä vaakasuoraa apuviivaa"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Create new horizontal guide"
-msgstr "Luo uusi skripti"
+msgstr "Luo uusi vaakasuora apuviiva"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Remove horizontal guide"
-msgstr "Poista virheelliset avaimet"
+msgstr "Poista vaakasuora apuviiva"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Create new horizontal and vertical guides"
@@ -3633,14 +3521,12 @@ msgid "Edit CanvasItem"
msgstr "Muokkaa CanvasItemiä"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Anchors only"
-msgstr "Ankkuri"
+msgstr "Vain ankkurit"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Change Anchors and Margins"
-msgstr "Muuta ankkureita"
+msgstr "Muuta ankkureita ja marginaaleja"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change Anchors"
@@ -3670,7 +3556,7 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+RMB: Depth list selection"
-msgstr ""
+msgstr "Alt + Hiiren oikea painike: Syvyyslistan valinta"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Mode"
@@ -3686,6 +3572,8 @@ msgid ""
"Show a list of all objects at the position clicked\n"
"(same as Alt+RMB in select mode)."
msgstr ""
+"Näytä lista kaikista napsautetussa kohdassa olevista objekteista\n"
+"(sama kuin Alt + Hiiren oikea painike valintatilassa)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Click to change object's rotation pivot."
@@ -3693,7 +3581,7 @@ msgstr "Klikkaa vaihtaaksesi objektin kääntökeskiötä."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Pan Mode"
-msgstr ""
+msgstr "Panorointitila"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Toggles snapping"
@@ -3704,9 +3592,8 @@ msgid "Use Snap"
msgstr "Käytä tarttumista"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snapping options"
-msgstr "Animaation asetukset"
+msgstr "Tarttumisen asetukset"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to grid"
@@ -3717,6 +3604,7 @@ msgid "Use Rotation Snap"
msgstr "Tartu käännettäessä"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Määrittele tarttuminen..."
@@ -3733,28 +3621,24 @@ msgid "Smart snapping"
msgstr "Älykäs tarttuminen"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to parent"
-msgstr "Laajenna Parentiin"
+msgstr "Tartu isäntään"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node anchor"
-msgstr "Tartu noden ankkuriin"
+msgstr "Tartu solmun ankkuriin"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to node sides"
-msgstr "Tartu noden sivustoihin"
+msgstr "Tartu solmun reunoihin"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to other nodes"
-msgstr "Tartu muihin nodeihin"
+msgstr "Tartu muihin solmuihin"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to guides"
-msgstr "Laajenna Parentiin"
+msgstr "Tartu apuviivoihin"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3772,7 +3656,7 @@ msgstr "Varmistaa ettei objektin lapsia voi valita."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Restores the object's children's ability to be selected."
-msgstr ""
+msgstr "Palauttaa objektin aliobjektien mahdollisuuden tulla valituksi."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Make Bones"
@@ -3796,9 +3680,8 @@ msgstr "Tyhjennä IK ketju"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View"
-msgstr "Näytä/Tarkastele"
+msgstr "Näytä"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -3806,9 +3689,8 @@ msgid "Show Grid"
msgstr "Näytä ruudukko"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Show Helpers"
-msgstr "Näytä luut"
+msgstr "Näytä avustimet"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Rulers"
@@ -3819,6 +3701,14 @@ msgid "Show Guides"
msgstr "Näytä apuviivat"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Näytä origo"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Näytä näyttöikkuna"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Valinta keskikohtaan"
@@ -3832,7 +3722,7 @@ msgstr "Asettelu"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Keys"
-msgstr "Lisää keyframeja"
+msgstr "Lisää avainruutuja"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key"
@@ -3840,7 +3730,7 @@ msgstr "Lisää keyframe"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
-msgstr "Lisää keyframe (olemassaolevalle raidalle)"
+msgstr "Lisää avainruutu (olemassa olevat raidat)"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Copy Pose"
@@ -3851,9 +3741,8 @@ msgid "Clear Pose"
msgstr "Tyhjennä asento"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Drag pivot from mouse position"
-msgstr "Rahaa pistettä hiiren sijainnista"
+msgstr "Vedä keskipistettä hiiren sijainnista"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Set pivot at mouse position"
@@ -3877,21 +3766,21 @@ msgstr "Lisätään %s..."
#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ok"
-msgstr ""
+msgstr "Ok"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Cannot instantiate multiple nodes without root."
-msgstr ""
+msgstr "Ei voida luoda ilmentymiä useasta solmusta ilman juurta."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Create Node"
-msgstr "Luo Node"
+msgstr "Luo solmu"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Error instancing scene from %s"
-msgstr "Virhe luotaessa instanssia kohteesta %s"
+msgstr "Virhe luotaessa ilmentymää kohteesta %s"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change default type"
@@ -3902,8 +3791,8 @@ msgid ""
"Drag & drop + Shift : Add node as sibling\n"
"Drag & drop + Alt : Change node type"
msgstr ""
-"Vedä & pudota + Shift: Lisää Node sisarena\n"
-"Vedä & pudota + Alt: Muuta Noden tyyppiä"
+"Vedä & pudota + Shift: Lisää solmu sisarena\n"
+"Vedä & pudota + Alt: Muuta solmun tyyppiä"
#: editor/plugins/collision_polygon_editor_plugin.cpp
msgid "Create Poly3D"
@@ -3915,48 +3804,45 @@ msgstr "Aseta kahva"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Remove item %d?"
-msgstr ""
+msgstr "Poistetaanko kohde %d?"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Add Item"
-msgstr "Lisää"
+msgstr "Lisää kohde"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove Selected Item"
-msgstr "Poista valitut"
+msgstr "Poista valitut kohteet"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import from Scene"
-msgstr "Tuo Scenestä"
+msgstr "Tuo skenestä"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Update from Scene"
-msgstr "Päivitä Scenestä"
+msgstr "Päivitä skenestä"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat0"
-msgstr ""
+msgstr "Tasainen0"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat1"
-msgstr ""
+msgstr "Tasainen1"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Ease in"
-msgstr "Framen valinta"
+msgstr "Kiihdytä alussa"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Ease out"
-msgstr ""
+msgstr "Hidasta lopussa"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Smoothstep"
-msgstr ""
+msgstr "Pehmeä askellus"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Modify Curve Point"
@@ -3996,7 +3882,7 @@ msgstr "Poista käyrän piste"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Toggle Curve Linear Tangent"
-msgstr ""
+msgstr "Aseta käyrälle lineaarinen tangentti"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Hold Shift to edit tangents individually"
@@ -4004,7 +3890,7 @@ msgstr "Pidä shift pohjassa muokataksesi tangentteja yksitellen"
#: editor/plugins/gi_probe_editor_plugin.cpp
msgid "Bake GI Probe"
-msgstr ""
+msgstr "Kehitä GI Probe"
#: editor/plugins/gradient_editor_plugin.cpp
msgid "Add/Remove Color Ramp Point"
@@ -4017,27 +3903,27 @@ msgstr "Muokkaa väriliukumaa"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item %d"
-msgstr ""
+msgstr "Kohde %d"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Items"
-msgstr ""
+msgstr "Sisältö"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item List Editor"
-msgstr ""
+msgstr "Sisällön muokkaus"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid ""
"No OccluderPolygon2D resource on this node.\n"
"Create and assign one?"
msgstr ""
-"Tälle nodelle ei ole OccluderPolygon2D:tä.\n"
-"Luodaanko sellainen?"
+"Tälle solmulle ei ole OccluderPolygon2D resurssia.\n"
+"Luodaanko ja asetetaanko sellainen?"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Occluder Polygon"
-msgstr "Luo Occluder polygooni"
+msgstr "Luo peittävä polygoni"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create a new polygon from scratch."
@@ -4053,7 +3939,7 @@ msgstr "VHP: Siirrä pistettä."
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Ctrl+LMB: Split Segment."
-msgstr "Ctrl+Vasen hiirennappi: Puolita osa"
+msgstr "Ctrl+Vasen hiirennappi: Puolita osa."
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "RMB: Erase Point."
@@ -4061,56 +3947,59 @@ msgstr "OHP: Pyyhi piste."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh is empty!"
-msgstr ""
+msgstr "Mesh on tyhjä!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Static Trimesh Body"
-msgstr ""
+msgstr "Luo konkaavi staattinen kappale"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Static Convex Body"
-msgstr ""
+msgstr "Luo konveksi staattinen kappale"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "This doesn't work on scene root!"
-msgstr "Tämä ei toimi root-Scenessä!"
+msgstr "Tämä ei toimi skenen juuressa!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Shape"
-msgstr ""
+msgstr "Luo konkaavi muoto"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Shape"
-msgstr ""
+msgstr "Luo konveksi muoto"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Navigation Mesh"
-msgstr ""
+msgstr "Luo navigointiverkko"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Contained Mesh is not of type ArrayMesh."
-msgstr ""
+msgstr "Sisällytetty Mesh ei ole tyyppiä ArrayMesh."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "UV Unwrap failed, mesh may not be manifold?"
-msgstr ""
+msgstr "UV-aukaisu epäonnistui, mesh ei ehkä ole jaettavissa osiin?"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "No mesh to debug."
-msgstr ""
+msgstr "Ei meshiä debugattavaksi."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Model has no UV in this layer"
-msgstr ""
+msgstr "Mallilla ei ole UV-kanavaa tällä kerroksella"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "MeshInstance lacks a Mesh!"
-msgstr ""
+msgstr "MeshInstance solmulta puuttuu Mesh!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh has not surface to create outlines from!"
-msgstr ""
+msgstr "Meshillä ei ole pintaa, josta ääriviivat voitaisiin luoda!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Meshin primitiivityyppi ei ole PRIMITIVE_TRIANGLES!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
@@ -4122,90 +4011,89 @@ msgstr "Luo ääriviivat"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh"
-msgstr ""
+msgstr "Mesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Static Body"
-msgstr ""
+msgstr "Luo konkaavi staattinen kappale"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Static Body"
-msgstr ""
+msgstr "Luo konveksi staattinen kappale"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Collision Sibling"
-msgstr ""
+msgstr "Luo konkaavi törmäysmuoto sisareksi"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Collision Sibling"
-msgstr ""
+msgstr "Luo konveksi törmäysmuoto sisareksi"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr ""
+msgid "Create Outline Mesh..."
+msgstr "Luo reunoista Mesh..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "View UV1"
-msgstr "Näytä/Tarkastele"
+msgstr "Näytä UV1"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "View UV2"
-msgstr "Näytä/Tarkastele"
+msgstr "Näytä UV2"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Unwrap UV2 for Lightmap/AO"
-msgstr ""
+msgstr "Aukaise UV2 Lightmapille tai AO:lle"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Outline Mesh"
-msgstr ""
+msgstr "Luo reunoista Mesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Outline Size:"
msgstr "Ääriviivojen koko:"
#: editor/plugins/multimesh_editor_plugin.cpp
-#, fuzzy
msgid "No mesh source specified (and no MultiMesh set in node)."
-msgstr "Mesh:in lähdettä ei määritetty"
+msgstr ""
+"Meshin lähdettä ei ole määritetty (ja MultiMesh ei ole asetettu solmulle)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and MultiMesh contains no Mesh)."
msgstr ""
+"Meshin lähdettä ei ole määritetty (ja MultiMesh ei sisällä Mesh solmua)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (invalid path)."
-msgstr "Virheellinen Mesh:in lähde (virheellinen polku)."
+msgstr "Meshin lähde on virheellinen (virheellinen polku)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (not a MeshInstance)."
-msgstr ""
+msgstr "Meshin lähde on virheellinen (ei MeshInstance)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (contains no Mesh resource)."
-msgstr ""
+msgstr "Meshin lähde on virheellinen (ei sisällä Mesh resurssia)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No surface source specified."
-msgstr ""
+msgstr "Pinnan lähdettä ei ole määritelty."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (invalid path)."
-msgstr ""
+msgstr "Pinnan lähde on virheellinen (virheellinen polku)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (no geometry)."
-msgstr ""
+msgstr "Pinnan lähde on virheellinen (geometria puuttuu)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (no faces)."
-msgstr ""
+msgstr "Pinnan lähde on virheellinen (tahkot puuttuvat)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Parent has no solid faces to populate."
-msgstr ""
+msgstr "Lähteellä ei ole kiinteitä tahkoja täytettäväksi."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Couldn't map area."
@@ -4213,27 +4101,27 @@ msgstr "Aluetta ei voitu kartoittaa."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Source Mesh:"
-msgstr ""
+msgstr "Valitse lähdemesh:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Target Surface:"
-msgstr ""
+msgstr "Valitse kohdepinta:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate Surface"
-msgstr ""
+msgstr "Täytä pinta"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate MultiMesh"
-msgstr ""
+msgstr "Täytä MultiMesh"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Target Surface:"
-msgstr ""
+msgstr "Kohdepinta:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Source Mesh:"
-msgstr ""
+msgstr "Lähde Mesh:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "X-Axis"
@@ -4249,7 +4137,7 @@ msgstr "Z-akseli"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh Up Axis:"
-msgstr ""
+msgstr "Meshin ylös-akseli:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Random Rotation:"
@@ -4265,19 +4153,19 @@ msgstr "Satunnainen skaalaus:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate"
-msgstr ""
+msgstr "Täytä"
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Bake!"
-msgstr ""
+msgstr "Kehitä!"
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Bake the navigation mesh."
-msgstr ""
+msgstr "Kehitä navigointiverkko."
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Clear the navigation mesh."
-msgstr ""
+msgstr "Tyhjennä navigointiverkko."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Setting up Configuration..."
@@ -4289,45 +4177,43 @@ msgstr "Lasketaan ruudukon kokoa..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating heightfield..."
-msgstr ""
+msgstr "Luodaan korkeuskenttää..."
#: editor/plugins/navigation_mesh_generator.cpp
-#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "Varastoidaan paikalliset muutokset..."
+msgstr "Merkitään kuljettavat kolmiot..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
-msgstr ""
+msgstr "Rakennetaan tiivistä korkeuskenttää..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Eroding walkable area..."
-msgstr ""
+msgstr "Syövytetään kuljettavaa aluetta..."
#: editor/plugins/navigation_mesh_generator.cpp
-#, fuzzy
msgid "Partitioning..."
-msgstr "Varoitus"
+msgstr "Ositetaan..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating contours..."
-msgstr ""
+msgstr "Luodaan korkeuskäyriä..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating polymesh..."
-msgstr ""
+msgstr "Luodaan polymesh..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Converting to native navigation mesh..."
-msgstr ""
+msgstr "Muunnetaan alkuperäiseksi navigointiverkoksi..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Navigation Mesh Generator Setup:"
-msgstr ""
+msgstr "Navigointiverkon generaattorin asetukset:"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Parsing Geometry..."
-msgstr ""
+msgstr "Jäsentää geometriaa…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Done!"
@@ -4335,29 +4221,29 @@ msgstr "Valmis!"
#: editor/plugins/navigation_polygon_editor_plugin.cpp
msgid "Create Navigation Polygon"
-msgstr ""
+msgstr "Luo navigointipolygoni"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
-#, fuzzy
msgid "Generating AABB"
-msgstr "Luo AABB"
+msgstr "Luodaan AABB"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Can only set point into a ParticlesMaterial process material"
msgstr ""
+"Piste voidaan asettaa ainoastaan ParticlesMaterial käsittelyn materiaaliin"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Error loading image:"
msgstr "Virhe ladattaessa kuvaa:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr ""
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Kuvassa ei ole pikseleitä, joiden läpinäkyvyys on enemmän kuin 128…"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
-msgstr ""
+msgstr "Kartoita näkyvä alue"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Load Emission Mask"
@@ -4365,7 +4251,7 @@ msgstr "Lataa emissiomaski"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Clear Emission Mask"
-msgstr ""
+msgstr "Tyhjennä emissiomaski"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
@@ -4378,18 +4264,16 @@ msgstr "Luotujen pisteiden määrä:"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
-#, fuzzy
msgid "Generation Time (sec):"
-msgstr "Keskimääräinen aika (sek)"
+msgstr "Luontiaika (s):"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Mask"
msgstr "Emission maski"
#: editor/plugins/particles_2d_editor_plugin.cpp
-#, fuzzy
msgid "Capture from Pixel"
-msgstr "Luo Scenestä"
+msgstr "Nappaa pikselistä"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Colors"
@@ -4397,15 +4281,15 @@ msgstr "Emission väri"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry."
-msgstr "Node ei sisällä geometriaa."
+msgstr "Solmu ei sisällä geometriaa."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry (faces)."
-msgstr ""
+msgstr "Solmulta puuttuu geometria (tahkot)."
#: editor/plugins/particles_editor_plugin.cpp
msgid "A processor material of type 'ParticlesMaterial' is required."
-msgstr ""
+msgstr "Tarvitaan 'ParticlesMaterial' tyyppinen prosessorimateriaali."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Faces contain no area!"
@@ -4421,14 +4305,13 @@ msgstr "Luo AABB"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Mesh"
-msgstr ""
+msgstr "Luo säteilypisteet meshistä"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Node"
-msgstr ""
+msgstr "Luo säteilypisteet solmusta"
#: editor/plugins/particles_editor_plugin.cpp
-#, fuzzy
msgid "Create Emitter"
msgstr "Luo säteilijä/lähetin"
@@ -4450,26 +4333,23 @@ msgstr "Äänenvoimakkuus"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Source: "
-msgstr "Emission lähde:"
+msgstr "Emission lähde: "
#: editor/plugins/particles_editor_plugin.cpp
-#, fuzzy
msgid "Generate Visibility AABB"
-msgstr "Luo AABB"
+msgstr "Kartoita näkyvä alue"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove Point from Curve"
msgstr "Poista pisteet käyrästä"
#: editor/plugins/path_2d_editor_plugin.cpp
-#, fuzzy
msgid "Remove Out-Control from Curve"
-msgstr "Poista pisteet käyrästä"
+msgstr "Poista lähtöohjain käyrästä"
#: editor/plugins/path_2d_editor_plugin.cpp
-#, fuzzy
msgid "Remove In-Control from Curve"
-msgstr "Poista pisteet käyrästä"
+msgstr "Poista tulo-ohjain käyrästä"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
@@ -4482,11 +4362,11 @@ msgstr "Siirrä pistettä käyrällä"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move In-Control in Curve"
-msgstr ""
+msgstr "Siirrä tulo-ohjainta käyrällä"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Out-Control in Curve"
-msgstr ""
+msgstr "Siirrä lähtöohjainta käyrällä"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
@@ -4537,19 +4417,16 @@ msgid "Curve Point #"
msgstr "Käyrän piste #"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve Point Position"
-msgstr "Siirrä pistettä"
+msgstr "Aseta käyräpisteen sijainti"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve In Position"
-msgstr "Siirrä pistettä"
+msgstr "Aseta käyrän aloitussijainti"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve Out Position"
-msgstr "Siirrä pistettä"
+msgstr "Aseta käyrän lopetussijainti"
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Path"
@@ -4560,14 +4437,12 @@ msgid "Remove Path Point"
msgstr "Poista polun piste"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Remove Out-Control Point"
-msgstr "Poista polygoni ja piste"
+msgstr "Poista lähtöohjaimen piste"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Remove In-Control Point"
-msgstr "Poista polygoni ja piste"
+msgstr "Poista tulo-ohjaimen piste"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Create UV Map"
@@ -4579,16 +4454,15 @@ msgstr "Muunna UV kartta"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon 2D UV Editor"
-msgstr ""
+msgstr "Polygon 2D UV-editori"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Point"
msgstr "Siirrä pistettä"
#: editor/plugins/polygon_2d_editor_plugin.cpp
-#, fuzzy
msgid "Ctrl: Rotate"
-msgstr "Ctrl: Pyöritä/kierrä"
+msgstr "Ctrl: Kierrä"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift: Move All"
@@ -4604,7 +4478,7 @@ msgstr "Siirrä polygonia"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Rotate Polygon"
-msgstr "Käännä polygonia"
+msgstr "Kierrä polygonia"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Scale Polygon"
@@ -4620,11 +4494,11 @@ msgstr "Muokkaa"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon->UV"
-msgstr "Polygooni->UV"
+msgstr "Polygoni->UV"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "UV->Polygon"
-msgstr "UV->Polygooni"
+msgstr "UV->Polygoni"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Clear UV"
@@ -4672,7 +4546,7 @@ msgstr "Avaa editorissa"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
msgid "Instance:"
-msgstr ""
+msgstr "Ilmentymä:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
@@ -4693,21 +4567,16 @@ msgid "Paste"
msgstr "Liitä"
#: editor/plugins/resource_preloader_editor_plugin.cpp
-#, fuzzy
msgid "ResourcePreloader"
-msgstr "Resurssi"
+msgstr "Resurssien esilataaja"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Clear Recent Files"
-msgstr "Tyhjennä luut"
+msgstr "Tyhjennä viimeisimpien tiedostojen luettelo"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Close and save changes?"
-msgstr ""
-"Sulje ja tallenna muutokset?\n"
-"\""
+msgstr "Sulje ja tallenna muutokset?"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error while saving theme"
@@ -4730,7 +4599,7 @@ msgid "Import Theme"
msgstr "Tuo teema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Tallenna teema nimellä..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4738,9 +4607,8 @@ msgid " Class Reference"
msgstr " Luokan referenssi"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Sort"
-msgstr "Lajittele:"
+msgstr "Lajittele"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
@@ -4776,15 +4644,13 @@ msgstr "Tallenna kaikki"
#: editor/plugins/script_editor_plugin.cpp
msgid "Soft Reload Script"
-msgstr ""
+msgstr "Lataa skripti uudelleen kevyesti"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Copy Script Path"
-msgstr "Kopioi polku"
+msgstr "Kopioi skriptin polku"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Show In File System"
msgstr "Näytä tiedostojärjestelmässä"
@@ -4830,7 +4696,7 @@ msgstr "Näytä/piilota skriptipaneeli"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "Etsi..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4839,13 +4705,12 @@ msgid "Find Next"
msgstr "Etsi seuraava"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Step Over"
-msgstr "Ohita"
+msgstr "Siirry seuraavaan"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Into"
-msgstr "Siirry"
+msgstr "Siirry sisään"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Break"
@@ -4870,7 +4735,7 @@ msgstr "Avaa Godotin online-dokumentaatio"
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the class hierarchy."
-msgstr "Etsi luokkahierarkia."
+msgstr "Etsi luokkahierarkiasta."
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the reference documentation."
@@ -4916,21 +4781,20 @@ msgstr "Debuggeri"
msgid ""
"Built-in scripts can only be edited when the scene they belong to is loaded"
msgstr ""
-"Sisäänrakennettuja skriptejä voi muokata ainoastaan kun Scene, johon ne "
+"Sisäänrakennettuja skriptejä voi muokata ainoastaan, kun skene, johon ne "
"kuuluvat, on ladattu"
#: editor/plugins/script_text_editor.cpp
msgid "Only resources from filesystem can be dropped."
-msgstr ""
+msgstr "Vain tiedostojärjestelmän resursseja voi raahata ja pudottaa."
#: editor/plugins/script_text_editor.cpp
msgid "Pick Color"
msgstr "Poimi väri"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Convert Case"
-msgstr "Muunnetaan kuvia"
+msgstr "Muunna aakkoslaji"
#: editor/plugins/script_text_editor.cpp
msgid "Uppercase"
@@ -4942,7 +4806,7 @@ msgstr "Pienet kirjaimet"
#: editor/plugins/script_text_editor.cpp
msgid "Capitalize"
-msgstr ""
+msgstr "Isot alkukirjaimet"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
@@ -4961,9 +4825,8 @@ msgid "Select All"
msgstr "Valitse kaikki"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Delete Line"
-msgstr "Poista piste"
+msgstr "Poista rivi"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Left"
@@ -4978,9 +4841,8 @@ msgid "Toggle Comment"
msgstr "Näytä/Piilota kommentit"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Fold/Unfold Line"
-msgstr "Avaa rivi"
+msgstr "Laskosta tai avaa rivi"
#: editor/plugins/script_text_editor.cpp
msgid "Fold All Lines"
@@ -5000,7 +4862,7 @@ msgstr "Täydennä symbooli"
#: editor/plugins/script_text_editor.cpp
msgid "Trim Trailing Whitespace"
-msgstr ""
+msgstr "Poista välilyönnit lopusta"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Spaces"
@@ -5017,7 +4879,7 @@ msgstr "Automaattinen sisennys"
#: editor/plugins/script_text_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Toggle Breakpoint"
-msgstr ""
+msgstr "Aseta tai poista breakpoint"
#: editor/plugins/script_text_editor.cpp
msgid "Remove All Breakpoints"
@@ -5032,106 +4894,104 @@ msgid "Goto Previous Breakpoint"
msgstr "Mene edelliseen breakpointiin"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Convert To Uppercase"
-msgstr "Muunna..."
+msgstr "Muunna isoiksi kirjaimiksi"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Convert To Lowercase"
-msgstr "Muunna..."
+msgstr "Muunna pieniksi kirjaimiksi"
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
msgstr "Etsi edellinen"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "Korvaa..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr "Mene funktioon..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "Mene riville..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
-msgstr ""
+msgstr "Asiayhteydellinen ohje"
#: editor/plugins/shader_editor_plugin.cpp
msgid "Shader"
-msgstr ""
+msgstr "Sävytin"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Constant"
-msgstr ""
+msgstr "Muuta skalaarivakiota"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Constant"
-msgstr ""
+msgstr "Muuta vektorivakiota"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Constant"
-msgstr ""
+msgstr "Muuta RGB-värivakiota"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Operator"
-msgstr ""
+msgstr "Muuta skalaarioperaattoria"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Operator"
-msgstr ""
+msgstr "Muuta vektorioperaattoria"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Scalar Operator"
-msgstr ""
+msgstr "Muuta vektori- ja skalaarioperaattoria"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Operator"
-msgstr ""
+msgstr "Muuta RGB-värioperaattoria"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Toggle Rot Only"
-msgstr ""
+msgstr "Vain kierto"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Function"
-msgstr ""
+msgstr "Muuta skalaarifunktiota"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Function"
-msgstr ""
+msgstr "Muuta vektorifunktiota"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Uniform"
-msgstr ""
+msgstr "Muuta skalaariuniformia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Uniform"
-msgstr ""
+msgstr "Muuta vektoriuniformia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Uniform"
-msgstr ""
+msgstr "Muuta RGB-uniformia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Default Value"
-msgstr ""
+msgstr "Muuta oletusarvoa"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change XForm Uniform"
-msgstr ""
+msgstr "Muuta XForm-uniformia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Texture Uniform"
-msgstr ""
+msgstr "Muuta tekstuuriuniformia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Cubemap Uniform"
-msgstr ""
+msgstr "Muuta Cubemap-uniformia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Comment"
@@ -5139,15 +4999,15 @@ msgstr "Vaihda kommenttia"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add/Remove to Color Ramp"
-msgstr ""
+msgstr "Lisää tai poista väriluiskalta"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add/Remove to Curve Map"
-msgstr ""
+msgstr "Lisää tai poista käyräkartalta"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Modify Curve Map"
-msgstr ""
+msgstr "Muokkaa käyräkarttaa"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Input Name"
@@ -5155,39 +5015,39 @@ msgstr "Vaihda syötteen nimi"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Connect Graph Nodes"
-msgstr ""
+msgstr "Yhdistä graafin solmut"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Disconnect Graph Nodes"
-msgstr ""
+msgstr "Erota graafin solmut"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Remove Shader Graph Node"
-msgstr ""
+msgstr "Poista sävytingraafin solmu"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Move Shader Graph Node"
-msgstr ""
+msgstr "Siirrä sävytingraafin solmua"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Duplicate Graph Node(s)"
-msgstr ""
+msgstr "Kahdenna graafin solmut(t)"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Delete Shader Graph Node(s)"
-msgstr ""
+msgstr "Poista sävytingraafin solmuja"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Error: Cyclic Connection Link"
-msgstr ""
+msgstr "Virhe: syklinen kytkentä"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Error: Missing Input Connections"
-msgstr ""
+msgstr "Virhe: syöteliitännät puuttuvat"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add Shader Graph Node"
-msgstr ""
+msgstr "Lisää sävytingraafin solmu"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Orthogonal"
@@ -5203,29 +5063,27 @@ msgstr "Muunnos keskeytetty."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "X-Axis Transform."
-msgstr ""
+msgstr "X-akselin muunnos."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Y-Axis Transform."
-msgstr ""
+msgstr "Y-akselin muunnos."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Z-Axis Transform."
-msgstr ""
+msgstr "Z-akselin muunnos."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Plane Transform."
-msgstr ""
+msgstr "Näkymätason muunnos."
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Scaling: "
-msgstr "Skaalaus:"
+msgstr "Skaalataan: "
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Translating: "
-msgstr "Siirtymä"
+msgstr "Siirretään: "
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotating %s degrees."
@@ -5233,7 +5091,7 @@ msgstr "Kierto %s astetta."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Keying is disabled (no key inserted)."
-msgstr ""
+msgstr "Animaation avainnus on pois päältä (avainta ei lisätty)."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Animation Key Inserted."
@@ -5241,35 +5099,31 @@ msgstr "Animaatioavain lisätty."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Objects Drawn"
-msgstr ""
+msgstr "Objekteja piirretty"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Material Changes"
-msgstr "Päivitä muutokset"
+msgstr "Materiaalimuutokset"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Shader Changes"
-msgstr "Päivitä muutokset"
+msgstr "Sävytinmuutokset"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Surface Changes"
-msgstr "Päivitä muutokset"
+msgstr "Pintamuutokset"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Draw Calls"
-msgstr ""
+msgstr "Piirtokutsuja"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Vertices"
-msgstr "Ominaisuudet:"
+msgstr "Kärkipisteet"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "FPS"
-msgstr ""
+msgstr "FPS"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View."
@@ -5312,9 +5166,8 @@ msgid "Rear View."
msgstr "Takanäkymä."
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Rear"
-msgstr "Taka/perä"
+msgstr "Taka"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Align with view"
@@ -5326,11 +5179,11 @@ msgstr "Asia kunnossa :("
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "No parent to instance a child at."
-msgstr ""
+msgstr "Isäntää, jonka alle ilmentymä luodaan, ei ole valittu."
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "This operation requires a single selected node."
-msgstr "Tämä toiminto vaatii yhden valitun noden."
+msgstr "Tämä toiminto vaatii yhden valitun solmun."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Normal"
@@ -5342,85 +5195,75 @@ msgstr "Näytä rautalankamalli"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Overdraw"
-msgstr ""
+msgstr "Näytä ylipiirto"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Display Unshaded"
-msgstr "Näytä varjoton"
+msgstr "Näytä sävyttämätön"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View Environment"
-msgstr "Ympäristö"
+msgstr "Näytä ympäristö"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View Gizmos"
-msgstr "Näytä ruudukko"
+msgstr "Näytä muokkaimet"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Information"
msgstr "Näytä tiedot"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View FPS"
-msgstr " Tiedostot"
+msgstr "Näytä FPS"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Half Resolution"
-msgstr "Skaalaa valintaa"
+msgstr "Puolikas näyttötarkkuus"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Audio Listener"
-msgstr ""
+msgstr "Äänikuuntelija"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Doppler Enable"
-msgstr "Ota käyttöön"
+msgstr "Doppler käytössä"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
-msgstr ""
+msgstr "Liiku vasemmalle"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Right"
-msgstr ""
+msgstr "Liiku oikealle"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Forward"
-msgstr "Mene eteenpäin"
+msgstr "Liiku eteenpäin"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Backwards"
-msgstr "Taaksepäin"
+msgstr "Liiku taaksepäin"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Up"
-msgstr ""
+msgstr "Liiku ylös"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Down"
-msgstr "Rulla alas."
+msgstr "Liiku alas"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Speed Modifier"
-msgstr ""
+msgstr "Liikkumisen nopeussäädin"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "XForm Dialog"
-msgstr ""
+msgstr "XForm-ikkuna"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Select Mode (Q)"
-msgstr "Valitse tila"
+msgstr "Valintatila (Q)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid ""
@@ -5428,6 +5271,9 @@ msgid ""
"Alt+Drag: Move\n"
"Alt+RMB: Depth list selection"
msgstr ""
+"Vedä: Kierrä\n"
+"Alt + Vedä: Siirrä\n"
+"Alt + Hiiren oikea painike: Syvyyslistan valinta"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Move Mode (W)"
@@ -5446,14 +5292,12 @@ msgid "Local Coords"
msgstr "Paikalliset koordinaatit"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Local Space Mode (%s)"
-msgstr "Skaalaustila (R)"
+msgstr "Paikallisavaruuden tila (%s)"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Snap Mode (%s)"
-msgstr "Tarttumisen tila:"
+msgstr "Tarttumisen tila (%s)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
@@ -5500,41 +5344,32 @@ msgid "Align Selection With View"
msgstr "Kohdista valinta näkymään"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Tool Select"
-msgstr "Valitse"
+msgstr "Valintatyökalu"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Tool Move"
-msgstr "Siirrä"
+msgstr "Siirtotyökalu"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Tool Rotate"
-msgstr "Ctrl: Pyöritä/kierrä"
+msgstr "Kiertotyökalu"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Tool Scale"
-msgstr "Skaalaus:"
+msgstr "Skaalaustyökalu"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Toggle Freelook"
-msgstr "Siirry koko näytön tilaan"
+msgstr "Kytke liikkuminen päälle/pois"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform"
msgstr "Muunna"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Määrittele tarttuminen..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr ""
+msgid "Transform Dialog..."
+msgstr "Muunnosikkuna..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5575,7 +5410,7 @@ msgstr "Asetukset"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Skeleton Gizmo visibility"
-msgstr ""
+msgstr "Luurankomuokkaimen näkyvyys"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap Settings"
@@ -5603,19 +5438,19 @@ msgstr "Näkökentän perspektiivi (ast.):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Z-Near:"
-msgstr "Minimi etäisyys:"
+msgstr "Pienin etäisyys:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Z-Far:"
-msgstr "Maksimi etäisyys:"
+msgstr "Suurin etäisyys:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Change"
-msgstr ""
+msgstr "Muunnoksen muutos"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translate:"
-msgstr "Käännä:"
+msgstr "Siirrä:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate (deg.):"
@@ -5627,7 +5462,7 @@ msgstr "Skaalaa (kuvasuhde):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Type"
-msgstr ""
+msgstr "Muunnoksen tyyppi"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Pre"
@@ -5647,7 +5482,7 @@ msgstr "Lisää frame"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Resource clipboard is empty or not a texture!"
-msgstr ""
+msgstr "Resurssileikepöytä on tyhjä tai ei sisällä tekstuuria!"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Paste Frame"
@@ -5678,9 +5513,8 @@ msgid "Speed (FPS):"
msgstr "Nopeus (FPS):"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "Loop"
-msgstr "Toisto"
+msgstr "Toista"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animation Frames"
@@ -5695,33 +5529,28 @@ msgid "Insert Empty (After)"
msgstr "Syötä tyhjä (jälkeen)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "Move (Before)"
-msgstr "Poista Node(t)"
+msgstr "Siirrä (ennen)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "Move (After)"
-msgstr "Siirry vasemmalle"
+msgstr "Siirrä (jälkeen)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "SpriteFrames"
-msgstr "Pinoa Framet"
+msgstr "SpriteFrames"
#: editor/plugins/style_box_editor_plugin.cpp
msgid "StyleBox Preview:"
-msgstr "StyleBox:in esikatselu:"
+msgstr "StyleBoxin esikatselu:"
#: editor/plugins/style_box_editor_plugin.cpp
-#, fuzzy
msgid "StyleBox"
-msgstr "Tyyli"
+msgstr "StyleBox"
#: editor/plugins/texture_region_editor_plugin.cpp
-#, fuzzy
msgid "Set Region Rect"
-msgstr "Tekstuurialue"
+msgstr "Aseta alueen suorakulmio"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Snap Mode:"
@@ -5771,7 +5600,6 @@ msgid "Can't save theme to file:"
msgstr "Teemaa ei voi tallentaa tiedostoon:"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Add All Items"
msgstr "Lisää kaikki"
@@ -5785,29 +5613,28 @@ msgid "Remove Item"
msgstr "Poista"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove All Items"
-msgstr "Poista valitut"
+msgstr "Poista kaikki"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Remove All"
msgstr "Poista kaikki"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Muokkaa teemaa..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
-msgstr "Teeman muokkaus."
+msgstr "Teeman muokkausvalikko."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add Class Items"
-msgstr ""
+msgstr "Lisää luokka"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Remove Class Items"
-msgstr ""
+msgstr "Poista luokka"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create Empty Template"
@@ -5823,15 +5650,15 @@ msgstr "Luo nykyisestä editorin teemasta"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
-msgstr ""
+msgstr "Valintaruudun valinta 1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio2"
-msgstr ""
+msgstr "Valintaruudun valinta 2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Item"
-msgstr ""
+msgstr "Osanen"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Check Item"
@@ -5842,22 +5669,28 @@ msgid "Checked Item"
msgstr "Valittu"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Valintapainike"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Valittu valintapainike"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "On"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Many"
-msgstr "Moni(a)/Monta"
+msgstr "Useita"
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
msgid "Options"
-msgstr "Asetukset"
+msgstr "Asetuksia"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
-msgid "Have,Many,Several,Options!"
-msgstr "On,Monia,Useita,Asetuksia"
+msgid "Has,Many,Options"
+msgstr "On,Useita,Asetuksia"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5896,13 +5729,12 @@ msgid "Theme"
msgstr "Teema"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Erase Selection"
-msgstr "Framen valinta"
+msgstr "Tyhjennä valittu alue"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint TileMap"
-msgstr ""
+msgstr "Täytä ruudukko"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Line Draw"
@@ -5910,7 +5742,7 @@ msgstr "Viivan piirto"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rectangle Paint"
-msgstr ""
+msgstr "Suorakaidetäyttö"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Bucket Fill"
@@ -5918,19 +5750,19 @@ msgstr "Täyttö"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Erase TileMap"
-msgstr ""
+msgstr "Tyhjennä ruudukko"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Erase selection"
-msgstr ""
+msgstr "Tyhjennä valinta"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Find tile"
-msgstr "Etsi tile"
+msgstr "Etsi ruutu"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Transpose"
-msgstr ""
+msgstr "Transponoi"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror X"
@@ -5941,13 +5773,12 @@ msgid "Mirror Y"
msgstr "Peilaa Y"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Paint Tile"
-msgstr "Poimi tile"
+msgstr "Maalaa ruutu"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Pick Tile"
-msgstr "Poimi tile"
+msgstr "Poimi ruutu"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 0 degrees"
@@ -5967,7 +5798,7 @@ msgstr "Käännä 270 astetta"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Could not find tile:"
-msgstr "Tileä ei löytynyt:"
+msgstr "Ruutua ei löytynyt:"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Item name or ID:"
@@ -5982,9 +5813,8 @@ msgid "Merge from scene?"
msgstr "Yhdistä skenestä?"
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Tile Set"
-msgstr "Vie tileset"
+msgstr "Ruutuvalikoima"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5992,37 +5822,39 @@ msgstr "Luo skenestä"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Merge from Scene"
-msgstr ""
+msgstr "Yhdistä skenestä"
#: editor/plugins/tile_set_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Error"
msgstr "Virhe"
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Autotiles"
-msgstr "Jaa automaattisesti"
+msgstr "Automaattiruudutus"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid ""
"Select sub-tile to use as icon, this will be also used on invalid autotile "
"bindings."
msgstr ""
+"Valitse aliruutu, jota käytetään ikonina ja myös virheellisten "
+"automaattiruudutusten ilmaisemiseen."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid ""
"LMB: set bit on.\n"
"RMB: set bit off."
msgstr ""
+"Hiiren vasen: aseta bitti päälle.\n"
+"Hiiren oikea: aseta bitti pois päältä."
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Select current edited sub-tile."
-msgstr "Tallenna tällä hetkellä muokattu resurssi."
+msgstr "Valitse muokattavana oleva aliruutu."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select sub-tile to change its priority."
-msgstr ""
+msgstr "Valitse aliruutu muuttaaksesi sen tärkeyttä."
#: editor/progress_dialog.cpp scene/gui/dialogs.cpp
msgid "Cancel"
@@ -6034,7 +5866,7 @@ msgstr "Suoritettava"
#: editor/project_export.cpp
msgid "Delete patch '%s' from list?"
-msgstr ""
+msgstr "Poista päivitys '%s' listasta?"
#: editor/project_export.cpp
msgid "Delete preset '%s'?"
@@ -6042,14 +5874,14 @@ msgstr "Poista esiasetus '%s'?"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing/corrupted: "
-msgstr ""
+msgstr "Vientimallit tälle alustalle puuttuvat tai ovat viallisia: "
#: editor/project_export.cpp
msgid "Presets"
msgstr "Esiasetukset"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Lisää..."
#: editor/project_export.cpp
@@ -6062,7 +5894,7 @@ msgstr "Vie kaikki projektin resurssit"
#: editor/project_export.cpp
msgid "Export selected scenes (and dependencies)"
-msgstr "Vie valitut Scenet (ja riippuvuudet)"
+msgstr "Vie valitut skenet (ja riippuvuudet)"
#: editor/project_export.cpp
msgid "Export selected resources (and dependencies)"
@@ -6092,25 +5924,23 @@ msgstr ""
#: editor/project_export.cpp
msgid "Patches"
-msgstr ""
+msgstr "Päivitykset"
#: editor/project_export.cpp
msgid "Make Patch"
-msgstr "Tee patchi"
+msgstr "Luo päivitys"
#: editor/project_export.cpp
-#, fuzzy
msgid "Features"
-msgstr "Tekstuuri"
+msgstr "Ominaisuudet"
#: editor/project_export.cpp
msgid "Custom (comma-separated):"
-msgstr ""
+msgstr "Mukautettu (pilkulla erotettu):"
#: editor/project_export.cpp
-#, fuzzy
msgid "Feature List:"
-msgstr "Metodilista:"
+msgstr "Ominaisuuslista:"
#: editor/project_export.cpp
msgid "Export PCK/Zip"
@@ -6122,7 +5952,7 @@ msgstr "Tälle alustalle ei löytynyt vientipohjia:"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing/corrupted:"
-msgstr ""
+msgstr "Vientimallit tälle alustalle puuttuvat tai ovat viallisia:"
#: editor/project_export.cpp
msgid "Export With Debug"
@@ -6137,22 +5967,24 @@ msgid "Please choose a 'project.godot' file."
msgstr "Ole hyvä ja valitse 'project.godot' tiedosto."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Please choose an empty folder."
-msgstr "Ole hyvä ja valitse 'project.godot' tiedosto."
+msgstr "Ole hyvä ja valitse tyhjä kansio."
#: editor/project_manager.cpp
msgid "Imported Project"
msgstr "Tuotu projekti"
#: editor/project_manager.cpp
-#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Virheellinen projektin nimi."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Kansiota ei voitu luoda."
#: editor/project_manager.cpp
msgid "There is already a folder in this path with the specified name."
-msgstr ""
+msgstr "Polusta löytyy jo kansio annetulla nimellä."
#: editor/project_manager.cpp
msgid "It would be a good idea to name your project."
@@ -6163,21 +5995,20 @@ msgid "Invalid project path (changed anything?)."
msgstr "Virheellinen projektin polku (muuttuiko mikään?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "Ei voitu luoda godot.cfg -tiedostoa projektin polkuun."
+msgstr ""
+"Tiedoston project.godot lataus projektin polusta epäonnistui (virhe %d). Se "
+"saattaa puuttua tai olla vioittunut."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't edit project.godot in project path."
-msgstr "Ei voitu luoda godot.cfg -tiedostoa projektin polkuun."
+msgstr "Ei voitu muokata project.godot tiedostoa projektin polussa."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Couldn't create project.godot in project path."
-msgstr "Ei voitu luoda godot.cfg -tiedostoa projektin polkuun."
+msgstr "Tiedoston project.godot luonti projektin polkuun epäonnistui."
#: editor/project_manager.cpp
msgid "The following files failed extraction from package:"
@@ -6196,34 +6027,30 @@ msgid "Import Existing Project"
msgstr "Tuo olemassaoleva projekti"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Import & Edit"
-msgstr "Tuo & Avaa"
+msgstr "Tuo ja muokkaa"
#: editor/project_manager.cpp
msgid "Create New Project"
msgstr "Luo uusi projekti"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create & Edit"
-msgstr "Luo säteilijä/lähetin"
+msgstr "Luo ja muokkaa"
#: editor/project_manager.cpp
msgid "Install Project:"
msgstr "Asenna projekti:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Install & Edit"
-msgstr "Asenna"
+msgstr "Asenna ja muokkaa"
#: editor/project_manager.cpp
msgid "Project Name:"
msgstr "Projektin nimi:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create folder"
msgstr "Luo kansio"
@@ -6253,9 +6080,9 @@ msgid ""
"Please edit the project and set the main scene in \"Project Settings\" under "
"the \"Application\" category."
msgstr ""
-"Projektia ei voida suorittaa: pääsceneä ei ole määritetty.\n"
-"Ole hyvä ja muokkaa projektia ja aseta pääscene projektin asetuksista "
-"\"Application\" -kategoriasta."
+"Projektia ei voida suorittaa: pääskeneä ei ole määritetty.\n"
+"Ole hyvä ja muokkaa projektia ja aseta pääskene projektin asetuksista "
+"\"Application\"-kategoriasta."
#: editor/project_manager.cpp
msgid ""
@@ -6317,14 +6144,12 @@ msgid "Exit"
msgstr "Poistu"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Restart Now"
-msgstr "Käynnistä uudelleen (s):"
+msgstr "Käynnistä uudelleen nyt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Can't run project"
-msgstr "Yhdistä..."
+msgstr "Projektia ei voida käynnistää"
#: editor/project_manager.cpp
msgid ""
@@ -6336,7 +6161,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Key "
-msgstr "Näppäin... "
+msgstr "Näppäin "
#: editor/project_settings_editor.cpp
msgid "Joy Button"
@@ -6351,8 +6176,12 @@ msgid "Mouse Button"
msgstr "Hiiren painike"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Virheellinen tapahtuma (muut käy, paitsi '/' tai ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Virheellinen toiminnon nimi. Se ei voi olla tyhjä eikä voi sisältää merkkejä "
+"'/', ':', '=', '\\' tai '\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6360,11 +6189,11 @@ msgstr "Tapahtuma '%s' on jo olemassa!"
#: editor/project_settings_editor.cpp
msgid "Rename Input Action Event"
-msgstr "Nimeä syöttötapahtuma uudelleen"
+msgstr "Nimeä syötetoiminto uudelleen"
#: editor/project_settings_editor.cpp
msgid "Add Input Action Event"
-msgstr "Lisää syöttötapahtuma"
+msgstr "Lisää syötetoiminnon tapahtuma"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "Shift+"
@@ -6379,7 +6208,7 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr "Paina näppäintä..."
#: editor/project_settings_editor.cpp
@@ -6435,18 +6264,16 @@ msgid "Joypad Button Index:"
msgstr "Ohjaimen painikkeen indeksi:"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Erase Input Action"
-msgstr "Tyhjennä syöttötapahtuma"
+msgstr "Tyhjennä syötetoiminto"
#: editor/project_settings_editor.cpp
msgid "Erase Input Action Event"
-msgstr "Tyhjennä syöttötapahtuma"
+msgstr "Tyhjennä syötetoiminnon tapahtuma"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Add Event"
-msgstr "Lisää tyhjä"
+msgstr "Lisää tapahtuma"
#: editor/project_settings_editor.cpp
msgid "Device"
@@ -6482,7 +6309,7 @@ msgstr "Lisää yleinen ominaisuus"
#: editor/project_settings_editor.cpp
msgid "Select a setting item first!"
-msgstr ""
+msgstr "Valitse asetus ensin!"
#: editor/project_settings_editor.cpp
msgid "No property '%s' exists."
@@ -6490,17 +6317,11 @@ msgstr "Ominaisuutta '%s' ei löytynyt."
#: editor/project_settings_editor.cpp
msgid "Setting '%s' is internal, and it can't be deleted."
-msgstr ""
+msgstr "Asetus '%s' on sisäinen, eikä sitä voi poistaa."
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Delete Item"
-msgstr "Poista syöte"
-
-#: editor/project_settings_editor.cpp
-#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "Yhdistä Nodeen:"
+msgstr "Poista kohde"
#: editor/project_settings_editor.cpp
msgid "Already existing"
@@ -6508,7 +6329,7 @@ msgstr "On jo olemassa"
#: editor/project_settings_editor.cpp
msgid "Add Input Action"
-msgstr "Lisää syöttötapahtuma"
+msgstr "Lisää syötetapahtuma"
#: editor/project_settings_editor.cpp
msgid "Error saving settings."
@@ -6520,7 +6341,7 @@ msgstr "Asetukset tallennettu onnistuneesti."
#: editor/project_settings_editor.cpp
msgid "Override for Feature"
-msgstr ""
+msgstr "Ominaisuuden ohitus"
#: editor/project_settings_editor.cpp
msgid "Add Translation"
@@ -6532,53 +6353,51 @@ msgstr "Poista käännös"
#: editor/project_settings_editor.cpp
msgid "Add Remapped Path"
-msgstr ""
+msgstr "Lisää korvaavuuspolku"
#: editor/project_settings_editor.cpp
msgid "Resource Remap Add Remap"
-msgstr ""
+msgstr "Lisää resurssin korvaavuus"
#: editor/project_settings_editor.cpp
msgid "Change Resource Remap Language"
-msgstr ""
+msgstr "Vaihda resurssin korvaavuuskieli"
#: editor/project_settings_editor.cpp
msgid "Remove Resource Remap"
-msgstr ""
+msgstr "Poista resurssin korvaavuus"
#: editor/project_settings_editor.cpp
msgid "Remove Resource Remap Option"
-msgstr ""
+msgstr "Poista resurssin korvaavuusvalinta"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Changed Locale Filter"
-msgstr "Muuta kameran kokoa"
+msgstr "Vaihdettu kielisuodatin"
#: editor/project_settings_editor.cpp
msgid "Changed Locale Filter Mode"
-msgstr ""
+msgstr "Vaihdettu kielisuodattimen tila"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Project Settings (project.godot)"
-msgstr "Projektin asetukset"
+msgstr "Projektin asetukset (project.godot)"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr "Yleinen"
+msgstr "Yleistä"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr "Ominaisuus:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr ""
+msgid "Override For..."
+msgstr "Ohita alustalle..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
-msgstr ""
+msgstr "Syötekartta"
#: editor/project_settings_editor.cpp
msgid "Action:"
@@ -6606,7 +6425,7 @@ msgstr "Käännökset:"
#: editor/project_settings_editor.cpp
msgid "Remaps"
-msgstr ""
+msgstr "Korvaavuudet"
#: editor/project_settings_editor.cpp
msgid "Resources:"
@@ -6614,11 +6433,11 @@ msgstr "Resurssit:"
#: editor/project_settings_editor.cpp
msgid "Remaps by Locale:"
-msgstr ""
+msgstr "Korvaavuudet kielikohtaisesti:"
#: editor/project_settings_editor.cpp
msgid "Locale"
-msgstr "Kieli"
+msgstr "Kielialue"
#: editor/project_settings_editor.cpp
msgid "Locales Filter"
@@ -6642,7 +6461,7 @@ msgstr "Kielet:"
#: editor/project_settings_editor.cpp
msgid "AutoLoad"
-msgstr "Lataa automaattisesti"
+msgstr "Automaattilataus"
#: editor/property_editor.cpp
msgid "Pick a Viewport"
@@ -6650,40 +6469,39 @@ msgstr "Valitse näyttöruutu"
#: editor/property_editor.cpp
msgid "Ease In"
-msgstr ""
+msgstr "Kiihdytä alussa"
#: editor/property_editor.cpp
msgid "Ease Out"
-msgstr ""
+msgstr "Hidasta lopussa"
#: editor/property_editor.cpp
msgid "Zero"
-msgstr ""
+msgstr "Nolla"
#: editor/property_editor.cpp
msgid "Easing In-Out"
-msgstr ""
+msgstr "Helpotus sisään-ulos"
#: editor/property_editor.cpp
msgid "Easing Out-In"
-msgstr ""
+msgstr "Helpotus ulos-sisään"
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr "Tiedosto..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr "Hakemisto..."
#: editor/property_editor.cpp
msgid "Assign"
-msgstr ""
+msgstr "Aseta"
#: editor/property_editor.cpp
-#, fuzzy
msgid "Select Node"
-msgstr "Valitse Node"
+msgstr "Valitse solmu"
#: editor/property_editor.cpp
msgid "New Script"
@@ -6694,9 +6512,8 @@ msgid "New %s"
msgstr "Uusi %s"
#: editor/property_editor.cpp
-#, fuzzy
msgid "Make Unique"
-msgstr "Tee luut"
+msgstr "Tee yksilölliseksi"
#: editor/property_editor.cpp
msgid "Show in File System"
@@ -6711,26 +6528,24 @@ msgid "Error loading file: Not a resource!"
msgstr "Virhe ladattaessa tiedostoa: Ei ole resurssi!"
#: editor/property_editor.cpp
-#, fuzzy
msgid "Selected node is not a Viewport!"
-msgstr "Valitse tuotava(t) node(t)"
+msgstr "Valittu solmu ei ole Viewport!"
#: editor/property_editor.cpp
msgid "Pick a Node"
-msgstr "Poimi node"
+msgstr "Poimi solmu"
#: editor/property_editor.cpp
msgid "Bit %d, val %d."
-msgstr ""
+msgstr "Bitti %d, arvo %d."
#: editor/property_editor.cpp
msgid "On"
msgstr "Päällä"
#: editor/property_editor.cpp
-#, fuzzy
msgid "[Empty]"
-msgstr "Lisää tyhjä"
+msgstr "[Tyhjä]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
@@ -6754,15 +6569,15 @@ msgstr "Valitse metodi"
#: editor/pvrtc_compress.cpp
msgid "Could not execute PVRTC tool:"
-msgstr ""
+msgstr "PVRTC-työkalun suoritus ei onnistunut:"
#: editor/pvrtc_compress.cpp
msgid "Can't load back converted image using PVRTC tool:"
-msgstr ""
+msgstr "Muunnettua kuva ei voitu ladata takaisin PVRTC-työkalulla:"
#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
msgid "Reparent Node"
-msgstr "Vaihda noden isäntää"
+msgstr "Vaihda solmun isäntää"
#: editor/reparent_dialog.cpp
msgid "Reparent Location (Select new Parent):"
@@ -6770,7 +6585,7 @@ msgstr "Valitse uusi isäntä:"
#: editor/reparent_dialog.cpp
msgid "Keep Global Transform"
-msgstr ""
+msgstr "Pidä globaali muunnos"
#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
msgid "Reparent"
@@ -6778,7 +6593,7 @@ msgstr "Uusi isäntä"
#: editor/run_settings_dialog.cpp
msgid "Run Mode:"
-msgstr ""
+msgstr "Käynnistystila:"
#: editor/run_settings_dialog.cpp
msgid "Current Scene"
@@ -6794,74 +6609,76 @@ msgstr "Pääskenen argumentit:"
#: editor/run_settings_dialog.cpp
msgid "Scene Run Settings"
-msgstr "Scenen suorittamisasetukset"
+msgstr "Skenen suorittamisasetukset"
#: editor/scene_tree_dock.cpp editor/script_create_dialog.cpp
#: scene/gui/dialogs.cpp
msgid "OK"
-msgstr ""
+msgstr "OK"
#: editor/scene_tree_dock.cpp
msgid "No parent to instance the scenes at."
-msgstr ""
+msgstr "Solmua, jonka alle skenen ilmentymä luodaan, ei ole valittu."
#: editor/scene_tree_dock.cpp
msgid "Error loading scene from %s"
-msgstr ""
+msgstr "Virhe ladattaessa skeneä paikasta %s"
#: editor/scene_tree_dock.cpp
msgid ""
"Cannot instance the scene '%s' because the current scene exists within one "
"of its nodes."
msgstr ""
+"Skenestä '%s' ei voida luoda ilmentymää, koska nykyinen skene on olemassa "
+"jossakin sen solmuista."
#: editor/scene_tree_dock.cpp
msgid "Instance Scene(s)"
-msgstr ""
+msgstr "Luo ilmentymä skenestä tai skeneistä"
#: editor/scene_tree_dock.cpp
msgid "This operation can't be done on the tree root."
-msgstr ""
+msgstr "Tätä toimenpidettä ei voi tehdä puun juurelle."
#: editor/scene_tree_dock.cpp
msgid "Move Node In Parent"
-msgstr ""
+msgstr "Siirrä solmu isännän alle"
#: editor/scene_tree_dock.cpp
msgid "Move Nodes In Parent"
-msgstr ""
+msgstr "Siirrä solmut isännän alle"
#: editor/scene_tree_dock.cpp
msgid "Duplicate Node(s)"
-msgstr "Monista node(t)"
+msgstr "Kahdenna solmu(t)"
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)?"
-msgstr "Poista Node(t)?"
+msgstr "Poista solmu(t)?"
#: editor/scene_tree_dock.cpp
msgid "Can not perform with the root node."
-msgstr ""
+msgstr "Ei voi tehdä juurisolmulle."
#: editor/scene_tree_dock.cpp
msgid "This operation can't be done on instanced scenes."
-msgstr ""
+msgstr "Tätä toimintoa ei voi tehdä skenejen ilmentymille."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Tallenna uusi scene nimellä..."
+msgid "Save New Scene As..."
+msgstr "Tallenna uusi skene nimellä..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
-msgstr ""
+msgstr "Muokattavat alisolmut"
#: editor/scene_tree_dock.cpp
msgid "Load As Placeholder"
-msgstr ""
+msgstr "Lataa paikanpitäjäksi"
#: editor/scene_tree_dock.cpp
msgid "Discard Instancing"
-msgstr ""
+msgstr "Hylkää ilmentymä"
#: editor/scene_tree_dock.cpp
msgid "Makes Sense!"
@@ -6869,50 +6686,51 @@ msgstr "Käy järkeen!"
#: editor/scene_tree_dock.cpp
msgid "Can't operate on nodes from a foreign scene!"
-msgstr "Ei voida käyttää ulkopuolisen scenen nodeja!"
+msgstr "Ei voida käyttää ulkopuolisen skenen solmuja!"
#: editor/scene_tree_dock.cpp
msgid "Can't operate on nodes the current scene inherits from!"
-msgstr "Ei voida käyttää nodeja, jotka periytyvät nykyisestä scenestä!"
+msgstr "Ei voida käyttää solmuja, joista nykyinen skene periytyy!"
#: editor/scene_tree_dock.cpp
msgid "Remove Node(s)"
-msgstr "Poista Node(t)"
+msgstr "Poista solmu(t)"
#: editor/scene_tree_dock.cpp
msgid ""
"Couldn't save new scene. Likely dependencies (instances) couldn't be "
"satisfied."
msgstr ""
+"Skeneä ei voitu tallentaa. Mahdollisia riippuvuuksia (ilmentymiä) ei voida "
+"toteuttaa."
#: editor/scene_tree_dock.cpp
msgid "Error saving scene."
-msgstr "Virhe tallennettaessa sceneä."
+msgstr "Virhe tallennettaessa skeneä."
#: editor/scene_tree_dock.cpp
msgid "Error duplicating scene to save it."
-msgstr ""
+msgstr "Virhe kahdennettaessa skeneä sen tallentamiseksi."
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Sub-Resources"
-msgstr "Resurssit"
+msgstr "Aliresurssit"
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance"
-msgstr ""
+msgstr "Poista perintä"
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)"
-msgstr "Poista Node(t)"
+msgstr "Poista solmu(t)"
#: editor/scene_tree_dock.cpp
msgid "Add Child Node"
-msgstr "Lisää lapsinode"
+msgstr "Lisää alisolmu"
#: editor/scene_tree_dock.cpp
msgid "Instance Child Scene"
-msgstr ""
+msgstr "Luo aliskenen ilmentymä"
#: editor/scene_tree_dock.cpp
msgid "Change Type"
@@ -6928,15 +6746,15 @@ msgstr "Tyhjennä skripti"
#: editor/scene_tree_dock.cpp
msgid "Merge From Scene"
-msgstr "Yhdistä scenestä"
+msgstr "Yhdistä skenestä"
#: editor/scene_tree_dock.cpp
msgid "Save Branch as Scene"
-msgstr ""
+msgstr "Tallenna haara skenenä"
#: editor/scene_tree_dock.cpp
msgid "Copy Node Path"
-msgstr "Kopioi Noden polku"
+msgstr "Kopioi solmun polku"
#: editor/scene_tree_dock.cpp
msgid "Delete (No Confirm)"
@@ -6944,40 +6762,39 @@ msgstr "Poista (ei varmistusta)"
#: editor/scene_tree_dock.cpp
msgid "Add/Create a New Node"
-msgstr "Lisää/Luo uusi Node"
+msgstr "Lisää/Luo uusi solmu"
#: editor/scene_tree_dock.cpp
msgid ""
"Instance a scene file as a Node. Creates an inherited scene if no root node "
"exists."
msgstr ""
+"Luo skenetiedostosta ilmentymän solmuksi. Luo periytetyn skenen jos "
+"juurisolmua ei ole olemassa."
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Filter nodes"
-msgstr "Suodattimet"
+msgstr "Suodata solmuja"
#: editor/scene_tree_dock.cpp
msgid "Attach a new or existing script for the selected node."
-msgstr ""
+msgstr "Liitä uusi tai olemassa oleva skripti valitulle solmulle."
#: editor/scene_tree_dock.cpp
msgid "Clear a script for the selected node."
-msgstr ""
+msgstr "Poista skripti valitulta solmulta."
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Remote"
-msgstr "Poista"
+msgstr "Etäinen"
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Local"
-msgstr "Skaalaus:"
+msgstr "Paikallinen"
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance? (No Undo!)"
-msgstr ""
+msgstr "Poistetaanko perintä? (Ei voi perua!)"
#: editor/scene_tree_dock.cpp
msgid "Clear!"
@@ -6985,84 +6802,91 @@ msgstr "Tyhjennä!"
#: editor/scene_tree_editor.cpp
msgid "Toggle Spatial Visible"
-msgstr ""
+msgstr "Aseta Spatial näkyvyys päälle/pois"
#: editor/scene_tree_editor.cpp
msgid "Toggle CanvasItem Visible"
-msgstr ""
+msgstr "Aseta CanvasItem näkyvyys päälle/pois"
#: editor/scene_tree_editor.cpp
msgid "Node configuration warning:"
-msgstr ""
+msgstr "Solmun konfiguroinnin varoitus:"
#: editor/scene_tree_editor.cpp
msgid ""
"Node has connection(s) and group(s)\n"
"Click to show signals dock."
msgstr ""
+"Solmulla on liitäntöjä ja ryhmiä\n"
+"Napsauta näyttääksesi signaalitelakan."
#: editor/scene_tree_editor.cpp
msgid ""
"Node has connections.\n"
"Click to show signals dock."
msgstr ""
+"Solmulla on liitäntöjä.\n"
+"Napsauta näyttääksesi signaalitelakan."
#: editor/scene_tree_editor.cpp
msgid ""
"Node is in group(s).\n"
"Click to show groups dock."
msgstr ""
+"Solmu kuuluu ryhmään.\n"
+"Napsauta näyttääksesi ryhmätelakan."
#: editor/scene_tree_editor.cpp
-#, fuzzy
msgid "Open script"
-msgstr "Seuraava skripti"
+msgstr "Avaa skripti"
#: editor/scene_tree_editor.cpp
msgid ""
"Node is locked.\n"
"Click to unlock"
msgstr ""
+"Solmu on lukittu.\n"
+"Napsauta lukituksen avaamiseksi"
#: editor/scene_tree_editor.cpp
msgid ""
"Children are not selectable.\n"
"Click to make selectable"
msgstr ""
+"Alisolmut eivät ole valittavissa.\n"
+"Napsauta niiden tekemiseksi valittavaksi"
#: editor/scene_tree_editor.cpp
msgid "Toggle Visibility"
-msgstr ""
+msgstr "Aseta näkyvyys"
#: editor/scene_tree_editor.cpp
msgid "Invalid node name, the following characters are not allowed:"
-msgstr ""
+msgstr "Virheellinen solmun nimi, seuraavat merkit eivät ole sallittuja:"
#: editor/scene_tree_editor.cpp
msgid "Rename Node"
-msgstr "Nimeä Node uudelleen"
+msgstr "Nimeä solmu uudelleen"
#: editor/scene_tree_editor.cpp
msgid "Scene Tree (Nodes):"
-msgstr ""
+msgstr "Skenepuu (solmut):"
#: editor/scene_tree_editor.cpp
msgid "Node Configuration Warning!"
-msgstr ""
+msgstr "Solmun konfigurointivaroitus!"
#: editor/scene_tree_editor.cpp
msgid "Select a Node"
-msgstr "Valitse Node"
+msgstr "Valitse solmu"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Error loading template '%s'"
-msgstr "Virhe ladattaessa kuvaa:"
+msgstr "Virhe ladattaessa mallia '%s'"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Error - Could not create script in filesystem."
-msgstr "Ei voitu luoda skriptiä tiedostojärjestelmään."
+msgstr "Virhe - Ei voitu luoda skriptiä tiedostojärjestelmään."
#: editor/script_create_dialog.cpp
msgid "Error loading script from %s"
@@ -7070,7 +6894,7 @@ msgstr "Virhe ladattaessa skripti %s:stä"
#: editor/script_create_dialog.cpp
msgid "N/A"
-msgstr ""
+msgstr "Ei mitään"
#: editor/script_create_dialog.cpp
msgid "Path is empty"
@@ -7082,16 +6906,15 @@ msgstr "Polku ei ole paikallinen"
#: editor/script_create_dialog.cpp
msgid "Invalid base path"
-msgstr ""
+msgstr "Virheellinen kantapolku"
#: editor/script_create_dialog.cpp
msgid "Directory of the same name exists"
msgstr "Samanniminen hakemisto on jo olemassa"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "File exists, will be reused"
-msgstr "Tiedosto on jo olemassa, korvaa?"
+msgstr "Tiedosto on jo olemassa, käytetään uudelleen"
#: editor/script_create_dialog.cpp
msgid "Invalid extension"
@@ -7099,12 +6922,11 @@ msgstr "Virheellinen laajennus"
#: editor/script_create_dialog.cpp
msgid "Wrong extension chosen"
-msgstr ""
+msgstr "Valittu väärä tiedostopääte"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Invalid Path"
-msgstr "Virheellinen polku."
+msgstr "Virheellinen polku"
#: editor/script_create_dialog.cpp
msgid "Invalid class name"
@@ -7112,62 +6934,55 @@ msgstr "Virheellinen luokan nimi"
#: editor/script_create_dialog.cpp
msgid "Invalid inherited parent name or path"
-msgstr ""
+msgstr "Virheellinen peritty isännän nimi tai polku"
#: editor/script_create_dialog.cpp
msgid "Script valid"
-msgstr ""
+msgstr "Skripti kelpaa"
#: editor/script_create_dialog.cpp
msgid "Allowed: a-z, A-Z, 0-9 and _"
-msgstr ""
+msgstr "Sallittu: a-z, A-Z, 0-9 ja _"
#: editor/script_create_dialog.cpp
msgid "Built-in script (into scene file)"
-msgstr ""
+msgstr "Sisäänrakennettu skripti (skenetiedostoon)"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Create new script file"
-msgstr "Luo uusi skripti"
+msgstr "Luo uusi skriptitiedosto"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Load existing script file"
-msgstr "Lataa olemassaoleva skripti"
+msgstr "Lataa olemassaoleva skriptitiedosto"
#: editor/script_create_dialog.cpp
msgid "Language"
msgstr "Kieli"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Inherits"
-msgstr "Perii:"
+msgstr "Perii"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Class Name"
-msgstr "Luokan nimi:"
+msgstr "Luokan nimi"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Template"
-msgstr "Poista malli"
+msgstr "Malli"
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Built-in Script"
msgstr "Sisäänrakennettu skripti"
#: editor/script_create_dialog.cpp
msgid "Attach Node Script"
-msgstr "Liitä Noden skripti"
+msgstr "Liitä solmun skripti"
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Remote "
-msgstr "Poista"
+msgstr "Etäinen "
#: editor/script_editor_debugger.cpp
msgid "Bytes:"
@@ -7191,7 +7006,7 @@ msgstr "Funktio:"
#: editor/script_editor_debugger.cpp
msgid "Pick one or more items from the list to display the graph."
-msgstr ""
+msgstr "Valitse yksi tai useampi kohde listasta näyttääksesi graafin."
#: editor/script_editor_debugger.cpp modules/mono/editor/mono_bottom_panel.cpp
msgid "Errors"
@@ -7199,20 +7014,19 @@ msgstr "Virheet"
#: editor/script_editor_debugger.cpp
msgid "Child Process Connected"
-msgstr "Lapsiprosessi yhdistetty"
+msgstr "Aliprosessi yhdistetty"
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Copy Error"
-msgstr "Lataa virheet"
+msgstr "Kopiointivirhe"
#: editor/script_editor_debugger.cpp
msgid "Inspect Previous Instance"
-msgstr "Tarkastele edellistä instanssia"
+msgstr "Tarkastele edellistä ilmentymää"
#: editor/script_editor_debugger.cpp
msgid "Inspect Next Instance"
-msgstr "Tarkastele seuraavaa instanssia"
+msgstr "Tarkastele seuraavaa ilmentymää"
#: editor/script_editor_debugger.cpp
msgid "Stack Frames"
@@ -7228,15 +7042,15 @@ msgstr "Virheet:"
#: editor/script_editor_debugger.cpp
msgid "Stack Trace (if applicable):"
-msgstr ""
+msgstr "Metodipino (jos soveltuva):"
#: editor/script_editor_debugger.cpp
msgid "Profiler"
-msgstr ""
+msgstr "Profiloija"
#: editor/script_editor_debugger.cpp
msgid "Monitor"
-msgstr ""
+msgstr "Monitoroija"
#: editor/script_editor_debugger.cpp
msgid "Value"
@@ -7244,11 +7058,11 @@ msgstr "Arvo"
#: editor/script_editor_debugger.cpp
msgid "Monitors"
-msgstr ""
+msgstr "Monitoroijat"
#: editor/script_editor_debugger.cpp
msgid "List of Video Memory Usage by Resource:"
-msgstr ""
+msgstr "Lista näyttömuistin käytöstä resurssikohtaisesti:"
#: editor/script_editor_debugger.cpp
msgid "Total:"
@@ -7256,11 +7070,11 @@ msgstr "Yhteensä:"
#: editor/script_editor_debugger.cpp
msgid "Video Mem"
-msgstr ""
+msgstr "Näyttömuisti"
#: editor/script_editor_debugger.cpp
msgid "Resource Path"
-msgstr ""
+msgstr "Resurssipolku"
#: editor/script_editor_debugger.cpp
msgid "Type"
@@ -7276,23 +7090,23 @@ msgstr "Käyttö"
#: editor/script_editor_debugger.cpp
msgid "Misc"
-msgstr ""
+msgstr "Sekalaista"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
-msgstr ""
+msgstr "Napsautettu kontrolli:"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control Type:"
-msgstr ""
+msgstr "Napsautetun kontrollin tyyppi:"
#: editor/script_editor_debugger.cpp
msgid "Live Edit Root:"
-msgstr ""
+msgstr "Juuren suora muokkaus:"
#: editor/script_editor_debugger.cpp
msgid "Set From Tree"
-msgstr ""
+msgstr "Aseta puusta"
#: editor/settings_config_dialog.cpp
msgid "Shortcuts"
@@ -7300,7 +7114,7 @@ msgstr "Pikakuvakkeet"
#: editor/settings_config_dialog.cpp
msgid "Binding"
-msgstr ""
+msgstr "Sidonta"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Light Radius"
@@ -7308,7 +7122,7 @@ msgstr "Muuta valon sädettä"
#: editor/spatial_editor_gizmos.cpp
msgid "Change AudioStreamPlayer3D Emission Angle"
-msgstr ""
+msgstr "Muuta AudioStreamPlayer3D solmun suuntausta"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Camera FOV"
@@ -7320,19 +7134,19 @@ msgstr "Muuta kameran kokoa"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Sphere Shape Radius"
-msgstr "Muuta pallon sädettä"
+msgstr "Muuta pallomuodon sädettä"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Box Shape Extents"
-msgstr ""
+msgstr "Muuta laatikkomuodon ulottuvuuksia"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Capsule Shape Radius"
-msgstr ""
+msgstr "Muuta kapselimuodon sädettä"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Capsule Shape Height"
-msgstr ""
+msgstr "Muuta kapselimuodon korkeutta"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Ray Shape Length"
@@ -7340,32 +7154,31 @@ msgstr "Vaihda säteen muodon pituutta"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Notifier Extents"
-msgstr ""
+msgstr "Muuta ilmoittajan kattavuutta"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Particles AABB"
-msgstr ""
+msgstr "Muuta partikkelien AABB"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Probe Extents"
-msgstr ""
+msgstr "Muuta Proben ulottuvuuksia"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Select the dynamic library for this entry"
-msgstr ""
+msgstr "Valitse dynaaminen kirjasto tälle kohteelle"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Select dependencies of the library for this entry"
-msgstr ""
+msgstr "Valitse kirjaston riippuvuudet tälle kohteelle"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Remove current entry"
-msgstr "Poista käyrän piste"
+msgstr "Poista nykyinen kohde"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Double click to create a new entry"
-msgstr ""
+msgstr "Kaksoisnapsauta luodaksesi uuden kohteen"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Platform:"
@@ -7376,28 +7189,24 @@ msgid "Platform"
msgstr "Alusta"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Dynamic Library"
-msgstr "Vie kirjasto"
+msgstr "Dynaaminen kirjasto"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
-msgstr ""
+msgstr "Lisää arkkitehtuurikohde"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "GDNativeLibrary"
-msgstr "Vie kirjasto"
+msgstr "GDNativeLibrary"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
-#, fuzzy
msgid "Library"
-msgstr "Vie kirjasto"
+msgstr "Kirjasto"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
-#, fuzzy
msgid "Status"
-msgstr "Tila:"
+msgstr "Tila"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Libraries: "
@@ -7405,113 +7214,110 @@ msgstr "Kirjastot: "
#: modules/gdnative/register_types.cpp
msgid "GDNative"
-msgstr ""
+msgstr "GDNative"
#: modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Invalid type argument to convert(), use TYPE_* constants."
msgstr ""
+"Virheellinen tyyppiargumentti convert() metodille, käytä TYPE_* vakioita."
#: modules/gdscript/gdscript_functions.cpp modules/mono/glue/glue_header.h
#: modules/visual_script/visual_script_builtin_funcs.cpp
msgid "Not enough bytes for decoding bytes, or invalid format."
-msgstr ""
+msgstr "Ei tarpeeksi tavuja tavujen purkamiseksi tai virheellinen formaatti."
#: modules/gdscript/gdscript_functions.cpp
msgid "step argument is zero!"
-msgstr ""
+msgstr "askeleen argumentti on nolla!"
#: modules/gdscript/gdscript_functions.cpp
msgid "Not a script with an instance"
-msgstr ""
+msgstr "Ei ole skripti, jolla on ilmentymä"
#: modules/gdscript/gdscript_functions.cpp
msgid "Not based on a script"
-msgstr ""
+msgstr "Ei pohjaudu skriptiin"
#: modules/gdscript/gdscript_functions.cpp
msgid "Not based on a resource file"
-msgstr ""
+msgstr "Ei pohjaudu resurssitiedostoon"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary format (missing @path)"
-msgstr ""
+msgstr "Virheellinen ilmentymän sanakirjaformaatti (puuttuu @path)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary format (can't load script at @path)"
msgstr ""
+"Virheellinen ilmentymän sanakirjaformaatti (ei voida ladata skriptiä polusta "
+"@path)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary format (invalid script at @path)"
msgstr ""
+"Virheellinen ilmentymän sanakirjaformaatti (virheellinen skripti kohdassa "
+"@path)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Invalid instance dictionary (invalid subclasses)"
-msgstr ""
+msgstr "Virheellinen ilmentymän sanakirja (virheelliset aliluokat)"
#: modules/gdscript/gdscript_functions.cpp
msgid "Object can't provide a length."
-msgstr ""
+msgstr "Objektille ei voida määrittää pituutta."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Seuraava välilehti"
+msgstr "Seuraava taso"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Edellinen välilehti"
+msgstr "Edellinen taso"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Taso:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
-msgstr ""
+msgstr "Seuraava kerros"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Floor"
-msgstr "Edellinen välilehti"
+msgstr "Edellinen kerros"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Floor:"
-msgstr ""
+msgstr "Kerros:"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Delete Selection"
-msgstr "Poista valitut"
+msgstr "Poista valinta"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Duplicate Selection"
-msgstr "Monista valinta"
+msgstr "Kahdenna valinta"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Grid Map"
msgstr "Ruudukko"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Snap View"
-msgstr "Huippunäkymä"
+msgstr "Tartu näkymään"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Clip Disabled"
-msgstr "Poistettu käytöstä"
+msgstr "Leikkaus pois käytöstä"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Clip Above"
-msgstr ""
+msgstr "Leikkaa yläpuolelta"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Clip Below"
-msgstr ""
+msgstr "Leikkaa alapuolelta"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Edit X Axis"
@@ -7526,158 +7332,156 @@ msgid "Edit Z Axis"
msgstr "Muokkaa Z-akselia"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Cursor Rotate X"
-msgstr "Ctrl: Pyöritä/kierrä"
+msgstr "Kierrä kohdistinta X-akselilla"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Cursor Rotate Y"
-msgstr "Ctrl: Pyöritä/kierrä"
+msgstr "Kierrä kohdistinta Y-akselilla"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Cursor Rotate Z"
-msgstr "Ctrl: Pyöritä/kierrä"
+msgstr "Kierrä kohdistinta Z-akselilla"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Cursor Back Rotate X"
-msgstr ""
+msgstr "Kierrä kohdistinta X-akselilla takaperin"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Cursor Back Rotate Y"
-msgstr ""
+msgstr "Kierrä kohdistinta Y-akselilla takaperin"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Cursor Back Rotate Z"
-msgstr ""
+msgstr "Kierrä kohdistinta Z-akselilla takaperin"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Cursor Clear Rotation"
-msgstr ""
+msgstr "Poista kohdistimen kierto"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Create Area"
-msgstr "Luo uusi"
+msgstr "Luo alue"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Create Exterior Connector"
-msgstr "Luo uusi projekti"
+msgstr "Luo ulkoliitin"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Erase Area"
-msgstr ""
+msgstr "Tyhjennä alue"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Clear Selection"
-msgstr "Valinta keskikohtaan"
+msgstr "Tyhjennä valinta"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Settings"
-msgstr "Näyttöruudun asetukset"
+msgstr "Ruudukon asetukset"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Pick Distance:"
-msgstr "Poimi tile"
+msgstr "Poimintaetäisyys:"
+
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Luokan nimi ei voi olla varattu avainsana"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
-msgstr ""
+msgstr "Luodaan ratkaisua..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating C# project..."
msgstr "Luodaan C# projekti..."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to create solution."
-msgstr "Ääriviivoja ei voitu luoda!"
+msgstr "Ratkaisun luonti epäonnistui."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to save solution."
-msgstr "Resurssin lataaminen epäonnistui."
+msgstr "Ratkaisun tallennus epäonnistui."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Done"
-msgstr "Valmis!"
+msgstr "Valmis"
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to create C# project."
-msgstr "Resurssin lataaminen epäonnistui."
+msgstr "C# projektin luonti epäonnistui."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Mono"
-msgstr ""
+msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Lisätietoja C# tuesta"
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Create C# solution"
-msgstr "Luo ääriviivat"
+msgstr "Luo C# ratkaisu"
#: modules/mono/editor/mono_bottom_panel.cpp
msgid "Builds"
-msgstr ""
+msgstr "Käännökset"
#: modules/mono/editor/mono_bottom_panel.cpp
-#, fuzzy
msgid "Build Project"
-msgstr "Uusi projekti"
+msgstr "Käännä projekti"
#: modules/mono/editor/mono_bottom_panel.cpp
-#, fuzzy
msgid "Warnings"
-msgstr "Varoitus"
+msgstr "Varoitukset"
+
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Sisemmän poikkeuksen kutsupinon loppu"
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
"properly!"
msgstr ""
+"Solmu väisti ilman työmuistia, ole hyvä ja lue dokumentaatiosta kuinka "
+"väistö (yield) on tehtävä!"
#: modules/visual_script/visual_script.cpp
msgid ""
"Node yielded, but did not return a function state in the first working "
"memory."
msgstr ""
+"Solmu väisti (yield), mutta ei palauttanut funktion tilaa ensimmäiselle "
+"työmuistille."
#: modules/visual_script/visual_script.cpp
msgid ""
"Return value must be assigned to first element of node working memory! Fix "
"your node please."
msgstr ""
+"Paluuarvo täytyy sijoittaa työmuistin ensimmäiselle elementille! Ole hyvä ja "
+"korjaa solmusi."
#: modules/visual_script/visual_script.cpp
msgid "Node returned an invalid sequence output: "
-msgstr ""
+msgstr "Solmu palautti virheellisen jakson tulosteen: "
#: modules/visual_script/visual_script.cpp
msgid "Found sequence bit but not the node in the stack, report bug!"
-msgstr ""
+msgstr "Jaksobitti löytyi, mutta solmua ei löydy pinosta, raportoi bugi!"
#: modules/visual_script/visual_script.cpp
msgid "Stack overflow with stack depth: "
-msgstr ""
+msgstr "Pinon ylivuoto pinosyvyydellä: "
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Signal Arguments"
-msgstr ""
+msgstr "Muuta signaalin argumentit"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Argument Type"
-msgstr "Vaihda taulukon arvon tyyppiä"
+msgstr "Vaihda argumentin tyyppiä"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Argument name"
@@ -7685,12 +7489,11 @@ msgstr "Vaihda argumentin nimi"
#: modules/visual_script/visual_script_editor.cpp
msgid "Set Variable Default Value"
-msgstr ""
+msgstr "Aseta muuttujan oletusarvo"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Set Variable Type"
-msgstr "Muokkaa muuttujaa:"
+msgstr "Aseta muuttujan tyyppi"
#: modules/visual_script/visual_script_editor.cpp
msgid "Functions:"
@@ -7738,76 +7541,76 @@ msgstr "Vaihda lauseketta"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node"
-msgstr "Lisää Node"
+msgstr "Lisää solmu"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Remove VisualScript Nodes"
-msgstr "Poista virheelliset avaimet"
+msgstr "Poista VisualScript solmut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Duplicate VisualScript Nodes"
-msgstr ""
+msgstr "Kahdenna VisualScript solmut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature."
msgstr ""
+"Pidä %s pohjassa pudottaaksesi Getterin. Pidä Shift pohjassa pudottaaksesi "
+"yleisen tunnisteen."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."
msgstr ""
+"Pidä Ctrl pohjassa pudottaaksesi Getterin. Pidä Shift pohjassa pudottaaksesi "
+"yleisen tunnisteen."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold %s to drop a simple reference to the node."
-msgstr ""
+msgstr "Pidä %s pohjassa pudottaaksesi yksinkertaisen viittauksen solmuun."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold Ctrl to drop a simple reference to the node."
-msgstr ""
+msgstr "Pidä Ctrl pohjassa pudottaaksesi yksinkertaisen viittauksen solmuun."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold %s to drop a Variable Setter."
-msgstr ""
+msgstr "Pidä %s pohjassa pudottaaksesi muuttujan asettajan (Variable Setter)."
#: modules/visual_script/visual_script_editor.cpp
msgid "Hold Ctrl to drop a Variable Setter."
msgstr ""
+"Pidä Ctrl pohjassa pudottaaksesi muuttujan asettajan (Variable Setter)."
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Preload Node"
-msgstr ""
+msgstr "Lisää esiladattu solmu"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node(s) From Tree"
-msgstr "Lisää Nodet puusta"
+msgstr "Lisää solmut puusta"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Getter Property"
-msgstr ""
+msgstr "Lisää palauttajaominaisuus"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Setter Property"
-msgstr ""
+msgstr "Lisää asettajaominaisuus"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Base Type"
-msgstr "Muuta tyyppiä"
+msgstr "Muuta kantatyyppiä"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Move Node(s)"
-msgstr "Poista Node(t)"
+msgstr "Siirrä solmu(t)"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Remove VisualScript Node"
-msgstr "Poista muuttuja"
+msgstr "Poista VisualScript solmu"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Connect Nodes"
-msgstr "Yhdistä Nodeen:"
+msgstr "Kytke solmut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Condition"
@@ -7815,19 +7618,19 @@ msgstr "Ehtolause"
#: modules/visual_script/visual_script_editor.cpp
msgid "Sequence"
-msgstr ""
+msgstr "Sarja"
#: modules/visual_script/visual_script_editor.cpp
msgid "Switch"
-msgstr ""
+msgstr "Valinta (Switch)"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
-msgstr ""
+msgstr "Iteraattori"
#: modules/visual_script/visual_script_editor.cpp
msgid "While"
-msgstr ""
+msgstr "Kun (While)"
#: modules/visual_script/visual_script_editor.cpp
msgid "Return"
@@ -7839,48 +7642,43 @@ msgstr "Kutsu"
#: modules/visual_script/visual_script_editor.cpp
msgid "Get"
-msgstr ""
+msgstr "Get"
#: modules/visual_script/visual_script_editor.cpp
msgid "Script already has function '%s'"
-msgstr ""
+msgstr "Skriptillä on jo funktio '%s'"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Input Value"
-msgstr "Vaihda syötteen nimi"
+msgstr "Vaihda syötteen arvo"
#: modules/visual_script/visual_script_editor.cpp
msgid "Can't copy the function node."
-msgstr ""
+msgstr "Ei voida kopioida funktiosolmua."
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Clipboard is empty!"
-msgstr "Resurssien leikepöytä on tyhjä!"
+msgstr "Leikepöytä on tyhjä!"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Paste VisualScript Nodes"
-msgstr "Liitä Nodet"
+msgstr "Liitä VisualScript solmut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Function"
msgstr "Poista funktio"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Edit Variable"
-msgstr "Muokkaa muuttujaa:"
+msgstr "Muokkaa muuttujaa"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Variable"
msgstr "Poista muuttuja"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Edit Signal"
-msgstr "Muokataan signaalia:"
+msgstr "Muokkaa signaalia"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Signal"
@@ -7896,19 +7694,19 @@ msgstr "Muokataan signaalia:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Base Type:"
-msgstr ""
+msgstr "Kantatyyppi:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Available Nodes:"
-msgstr "Saatavilla olevat Nodet:"
+msgstr "Saatavilla olevat solmut:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Select or create a function to edit graph"
-msgstr ""
+msgstr "Valitse tai luo funktio graafin muokkaamiseksi"
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit Signal Arguments:"
-msgstr ""
+msgstr "Muokkaa signaalin argumentteja:"
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit Variable:"
@@ -7920,51 +7718,51 @@ msgstr "Poista valitut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Find Node Type"
-msgstr "Etsi Noden tyyppi"
+msgstr "Etsi solmun tyyppi"
#: modules/visual_script/visual_script_editor.cpp
msgid "Copy Nodes"
-msgstr "Kopioi Nodet"
+msgstr "Kopioi solmut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Cut Nodes"
-msgstr "Leikkaa Nodet"
+msgstr "Leikkaa solmut"
#: modules/visual_script/visual_script_editor.cpp
msgid "Paste Nodes"
-msgstr "Liitä Nodet"
+msgstr "Liitä solmut"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Input type not iterable: "
-msgstr ""
+msgstr "Syötetyyppi ei ole iteroitavissa: "
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Iterator became invalid"
-msgstr ""
+msgstr "Iteraattori muuttui epäkelvoksi"
#: modules/visual_script/visual_script_flow_control.cpp
msgid "Iterator became invalid: "
-msgstr ""
+msgstr "Iteraattori muuttui epäkelvoksi: "
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Invalid index property name."
-msgstr ""
+msgstr "Virheellinen osoitinominaisuuden nimi."
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Base object is not a Node!"
-msgstr ""
+msgstr "Kantaobjekti ei ole solmu!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Path does not lead Node!"
-msgstr "Polku ei vie Nodeen!"
+msgstr "Polku ei johda solmuun!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Invalid index property name '%s' in node %s."
-msgstr ""
+msgstr "Virheellinen osoitinominaisuuden nimi '%s' solmussa %s."
#: modules/visual_script/visual_script_nodes.cpp
msgid ": Invalid argument of type: "
-msgstr ""
+msgstr ": Virheellinen argumentti tyyppiä: "
#: modules/visual_script/visual_script_nodes.cpp
msgid ": Invalid arguments: "
@@ -7972,21 +7770,24 @@ msgstr ": Virheelliset argumentit: "
#: modules/visual_script/visual_script_nodes.cpp
msgid "VariableGet not found in script: "
-msgstr ""
+msgstr "VariableGet ei löytynyt skriptistä: "
#: modules/visual_script/visual_script_nodes.cpp
msgid "VariableSet not found in script: "
-msgstr ""
+msgstr "VariableSet ei löytynyt skriptistä: "
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
msgstr ""
+"Mukautetulla solmulla ei ole _step() metodia, graafia ei voida käsitellä."
#: modules/visual_script/visual_script_nodes.cpp
msgid ""
"Invalid return value from _step(), must be integer (seq out), or string "
"(error)."
msgstr ""
+"Virheellinen paluuarvo _step() metodilta, täytyy olla kokonaisluku (seq out) "
+"tai merkkijono (virhe)."
#: platform/javascript/export/export.cpp
msgid "Run in Browser"
@@ -7997,46 +7798,44 @@ msgid "Run exported HTML in the system's default browser."
msgstr "Suorita viety HTML järjestelmän oletusselaimessa."
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not write file:"
-msgstr "Ei voitu kirjoittaa tiedostoa:\n"
+msgstr "Ei voitu kirjoittaa tiedostoa:"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not open template for export:"
-msgstr "Kansiota ei voitu luoda."
+msgstr "Mallin avaus vientiin epäonnistui:"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Invalid export template:"
-msgstr "Hallitse vietäviä Templateja"
+msgstr "Virheellinen vientimalli:"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not read custom HTML shell:"
-msgstr "Ei voitu lukea tiedostoa:\n"
+msgstr "Ei voitu lukea mukautettua HTML tulkkia:"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not read boot splash image file:"
-msgstr "Ei voitu lukea tiedostoa:\n"
+msgstr "Ei voitu lukea käynnistyskuvan tiedostoa:"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Using default boot splash image."
-msgstr "Ei voitu lukea tiedostoa:\n"
+msgstr "Käytetään oletuskäynnistyskuvaa."
#: scene/2d/animated_sprite.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
"order for AnimatedSprite to display frames."
msgstr ""
+"SpriteFrames resurssi on luotava tai asetettava 'Frames' ominaisuudelle, "
+"jotta AnimatedSprite voi näyttää ruutuja."
#: scene/2d/canvas_modulate.cpp
msgid ""
"Only one visible CanvasModulate is allowed per scene (or set of instanced "
"scenes). The first created one will work, while the rest will be ignored."
msgstr ""
+"Vain yksi CanvasModulate on sallittu per skene (tai per skeneilmentymien "
+"joukko). Ensimmäisenä luotu toimii ja loput jätetään huomioimatta."
#: scene/2d/collision_object_2d.cpp
msgid ""
@@ -8044,6 +7843,10 @@ msgid ""
"Consider adding CollisionShape2D or CollisionPolygon2D children nodes to "
"define its shape."
msgstr ""
+"Tämän solmun alaisuudessa ei ole muotoja, joten se ei voi olla "
+"vuorovaikutuksessa avaruuden kanssa.\n"
+"Harkitse CollisionShape2D tai CollisionPolygon2D solmun lisäämistä "
+"alisolmuksi muodon määrittämiseksi."
#: scene/2d/collision_polygon_2d.cpp
msgid ""
@@ -8051,10 +7854,13 @@ msgid ""
"CollisionObject2D derived node. Please only use it as a child of Area2D, "
"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
msgstr ""
+"CollisionPolygon2D toimii törmäysmuotona ainoastaan CollisionObject2D "
+"solmusta perityille solmuille. Käytä sitä ainoastaan Area2D, StaticBody2D, "
+"RigidBody2D, KinematicBody2D, jne. alla antaaksesi niille muodon."
#: scene/2d/collision_polygon_2d.cpp
msgid "An empty CollisionPolygon2D has no effect on collision."
-msgstr "Tyhjällä CollisionPolygon2D:llä ei ole vaikutusta törmäyksessä."
+msgstr "Tyhjällä CollisionPolygon2D solmulla ei ole vaikutusta törmäyksessä."
#: scene/2d/collision_shape_2d.cpp
msgid ""
@@ -8062,56 +7868,73 @@ msgid ""
"CollisionObject2D derived node. Please only use it as a child of Area2D, "
"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
msgstr ""
+"CollisionShape2D toimii törmäysmuotona ainoastaan CollisionObject2D solmusta "
+"perityille solmuille. Käytä sitä ainoastaan Area2D, StaticBody2D, "
+"RigidBody2D, KinematicBody2D, jne. alla antaaksesi niille muodon."
#: scene/2d/collision_shape_2d.cpp
msgid ""
"A shape must be provided for CollisionShape2D to function. Please create a "
"shape resource for it!"
msgstr ""
+"CollisionShape2D solmulla täytyy olla muoto, jotta se toimisi. Ole hyvä ja "
+"luo sille muotoresurssi!"
#: scene/2d/light_2d.cpp
msgid ""
"A texture with the shape of the light must be supplied to the 'texture' "
"property."
msgstr ""
+"Tekstuuri, jolta löytyy valon muoto, täytyy antaa 'texture' ominaisuudella."
#: scene/2d/light_occluder_2d.cpp
msgid ""
"An occluder polygon must be set (or drawn) for this occluder to take effect."
msgstr ""
+"Toimimiseksi tälle peittäjälle on asetettava (tai piirrettävä) peittävä "
+"monikulmio."
#: scene/2d/light_occluder_2d.cpp
msgid "The occluder polygon for this occluder is empty. Please draw a polygon!"
msgstr ""
+"Peittävä monikulmio tälle peittäjälle on tyhjä. Ole hyvä ja piirrä "
+"monikulmio!"
#: scene/2d/navigation_polygon.cpp
msgid ""
"A NavigationPolygon resource must be set or created for this node to work. "
"Please set a property or draw a polygon."
msgstr ""
+"Tälle solmulle on asetettava tai luotava NavigationPolygon resurssi, jotta "
+"se toimisi. Ole hyvä ja aseta ominaisuus tai piirrä monikulmio."
#: scene/2d/navigation_polygon.cpp
msgid ""
"NavigationPolygonInstance must be a child or grandchild to a Navigation2D "
"node. It only provides navigation data."
msgstr ""
+"NavigationPolygonInstance solmun täytyy olla Navigation2D solmun "
+"alaisuudessa. Se tarjoaa vain navigointidataa."
#: scene/2d/parallax_layer.cpp
msgid ""
"ParallaxLayer node only works when set as child of a ParallaxBackground node."
msgstr ""
+"ParallaxLayer solmu toimii ainoastaan, jos se on ParallaxBackground solmun "
+"alla."
#: scene/2d/particles_2d.cpp scene/3d/particles.cpp
msgid ""
"A material to process the particles is not assigned, so no behavior is "
"imprinted."
msgstr ""
+"Materiaalia partikkeleiden käsittelemiseksi ei ole määritetty, joten mitään "
+"ei tapahdu."
#: scene/2d/path_2d.cpp
msgid "PathFollow2D only works when set as a child of a Path2D node."
msgstr ""
-"PathFollow2D toimii ainoastaan ollessaan asetettuna Path2D Node:n "
-"lapsiolioksi."
+"PathFollow2D toimii ainoastaan ollessaan asetettuna Path2D solmun alle."
#: scene/2d/physics_body_2d.cpp
msgid ""
@@ -8119,68 +7942,78 @@ msgid ""
"by the physics engine when running.\n"
"Change the size in children collision shapes instead."
msgstr ""
+"Fysiikkamoottori ylikirjoittaa RigidBody2D kokomuutokset (hahmo- tai "
+"jäykkätila) ajon aikana.\n"
+"Muuta sen sijaan solmun alla olevia törmäysmuotoja."
#: scene/2d/remote_transform_2d.cpp
msgid "Path property must point to a valid Node2D node to work."
-msgstr "Polku täytyy olla määritetty toimivaan Node2D solmuun toimiakseen."
+msgstr ""
+"Polkuominaisuuden täytyy osoittaa kelvolliseen Node2D solmuun toimiakseen."
#: scene/2d/visibility_notifier_2d.cpp
msgid ""
"VisibilityEnable2D works best when used with the edited scene root directly "
"as parent."
msgstr ""
+"VisibilityEnable2D toimii parhaiten, kun sitä käytetään suoraan muokatun "
+"skenen juuren isäntänä."
#: scene/3d/arvr_nodes.cpp
msgid "ARVRCamera must have an ARVROrigin node as its parent"
-msgstr ""
+msgstr "ARVRCamera solmun isännän täytyy olla ARVROrigin solmu"
#: scene/3d/arvr_nodes.cpp
msgid "ARVRController must have an ARVROrigin node as its parent"
-msgstr ""
+msgstr "ARVRController solmun isännän täytyy olla ARVROrigin solmu"
#: scene/3d/arvr_nodes.cpp
msgid ""
"The controller id must not be 0 or this controller will not be bound to an "
"actual controller"
msgstr ""
+"Ohjaimen tunnus ei saa olla 0, tai tämä ohjain ei ole sidottu oikeaan "
+"ohjaimeen"
#: scene/3d/arvr_nodes.cpp
msgid "ARVRAnchor must have an ARVROrigin node as its parent"
-msgstr ""
+msgstr "ARVRAnchor solmun isännän täytyy olla ARVROrigin solmu"
#: scene/3d/arvr_nodes.cpp
msgid ""
"The anchor id must not be 0 or this anchor will not be bound to an actual "
"anchor"
msgstr ""
+"Ankkurin tunnus ei saa olla 0, tai tämä ankkuri ei ole sidottu oikeaan "
+"ankkuriin"
#: scene/3d/arvr_nodes.cpp
msgid "ARVROrigin requires an ARVRCamera child node"
-msgstr ""
+msgstr "ARVROrigin solmu tarvitsee ARVRCamera alisolmun"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Aikaa jäljellä: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
-msgstr ""
+msgstr "Piirretään meshejä: "
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Lights:"
-msgstr ""
+msgstr "Piirretään valoja:"
#: scene/3d/baked_lightmap.cpp scene/3d/gi_probe.cpp
msgid "Finishing Plot"
-msgstr ""
+msgstr "Viimeistellään piirto"
#: scene/3d/baked_lightmap.cpp
msgid "Lighting Meshes: "
-msgstr ""
+msgstr "Valaistaan meshejä: "
#: scene/3d/collision_object.cpp
msgid ""
@@ -8188,6 +8021,10 @@ msgid ""
"Consider adding CollisionShape or CollisionPolygon children nodes to define "
"its shape."
msgstr ""
+"Tällä solmulla ei ole alimuotoja, joten se ei voi olla vuorovaikutuksessa "
+"avaruuden kanssa.\n"
+"Harkitse CollisionShape tai CollisionPolygon solmun lisäämistä sen "
+"alisolmuksi määritelläksesi sen muodon."
#: scene/3d/collision_polygon.cpp
msgid ""
@@ -8195,10 +8032,13 @@ msgid ""
"CollisionObject derived node. Please only use it as a child of Area, "
"StaticBody, RigidBody, KinematicBody, etc. to give them a shape."
msgstr ""
+"CollisionPolygon solmu antaa ainoastaan törmäysmuodon CollisionObject "
+"solmusta periytyville solmuille. Käytä sitä Area, StaticBody, RigidBody, "
+"KinematicBody, jne. solmujen alla antaaksesi niille muodon."
#: scene/3d/collision_polygon.cpp
msgid "An empty CollisionPolygon has no effect on collision."
-msgstr "Tyhjällä CollisionPolygon:illa ei ole vaikutusta törmäyksessä."
+msgstr "Tyhjällä CollisionPolygon solmulla ei ole vaikutusta törmäyksessä."
#: scene/3d/collision_shape.cpp
msgid ""
@@ -8206,31 +8046,42 @@ msgid ""
"derived node. Please only use it as a child of Area, StaticBody, RigidBody, "
"KinematicBody, etc. to give them a shape."
msgstr ""
+"CollisionShape solmu antaa ainoastaan törmäysmuodon CollisionObject solmusta "
+"periytyville solmuille. Käytä sitä Area, StaticBody, RigidBody, "
+"KinematicBody, jne. solmujen alla antaaksesi niille muodon."
#: scene/3d/collision_shape.cpp
msgid ""
"A shape must be provided for CollisionShape to function. Please create a "
"shape resource for it!"
msgstr ""
+"CollisionShape solmulle täytyy antaa muoto, jotta se toimisi. Ole hyvä ja "
+"luo sille muotoresurssi!"
#: scene/3d/gi_probe.cpp
msgid "Plotting Meshes"
-msgstr ""
+msgstr "Piirretään meshejä"
#: scene/3d/navigation_mesh.cpp
msgid "A NavigationMesh resource must be set or created for this node to work."
msgstr ""
+"Tälle solmulle täytyy asettaa tai luoda NavigationMesh resurssi, jotta se "
+"toimisi."
#: scene/3d/navigation_mesh.cpp
msgid ""
"NavigationMeshInstance must be a child or grandchild to a Navigation node. "
"It only provides navigation data."
msgstr ""
+"NavigationMeshInstance solmun täytyy olla Navigation solmun alaisuudessa. Se "
+"tarjoaa vain navigointidataa."
#: scene/3d/particles.cpp
msgid ""
"Nothing is visible because meshes have not been assigned to draw passes."
msgstr ""
+"Mitään ei näy, koska mesheille ei ole asetettu piirtopyyhkäisyjä (draw "
+"passes)."
#: scene/3d/physics_body.cpp
msgid ""
@@ -8238,32 +8089,53 @@ msgid ""
"by the physics engine when running.\n"
"Change the size in children collision shapes instead."
msgstr ""
+"Fysiikkamoottori ylikirjoittaa RigidBody kokomuutokset (hahmo- tai "
+"jäykkätilassa) ajon aikana.\n"
+"Muuta sen sijaan solmun alla olevia törmäysmuotoja."
#: scene/3d/remote_transform.cpp
msgid "Path property must point to a valid Spatial node to work."
-msgstr ""
+msgstr "Polkuominaisuuden täytyy osoittaa Spatial solmuun toimiakseen."
+
+#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment tarvitsee Environment resurssin."
#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+"Vain yksi WorldEnvironment on sallittu per skene (tai per skeneilmentymien "
+"joukko)."
+
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Tämä WorldEnvironment jätetään huomioimatta. Lisää joko Camera (3D-"
+"skeneille) tai aseta tälle ympäristölle Background Mode asetukseksi Canvas "
+"(2D-skeneille)."
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
"order for AnimatedSprite3D to display frames."
msgstr ""
+"AnimatedSprite3D solmulle täytyy luoda tai asettaa 'Frames' ominaisuudeksi "
+"SpriteFrames resurssi ruutujen näyttämiseksi."
#: scene/3d/vehicle_body.cpp
msgid ""
"VehicleWheel serves to provide a wheel system to a VehicleBody. Please use "
"it as a child of a VehicleBody."
msgstr ""
+"VehicleWheel solmu tarjoaa rengasjärjestelmän VehicleBody solmulle. Ole hyvä "
+"ja käytä sitä VehicleBody solmun alla."
#: scene/gui/color_picker.cpp
-#, fuzzy
msgid "Raw Mode"
-msgstr "Kääntötila"
+msgstr "Raakatila"
#: scene/gui/color_picker.cpp
msgid "Add current color as a preset"
@@ -8278,9 +8150,8 @@ msgid "Please Confirm..."
msgstr "Ole hyvä ja vahvista..."
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select this Folder"
-msgstr "Valitse metodi"
+msgstr "Valitse tämä kansio"
#: scene/gui/popup.cpp
msgid ""
@@ -8307,13 +8178,12 @@ msgid "(Other)"
msgstr "(Muu)"
#: scene/main/scene_tree.cpp
-#, fuzzy
msgid ""
"Default Environment as specified in Project Settings (Rendering -> "
"Environment -> Default Environment) could not be loaded."
msgstr ""
-"Projektin asetuksissa määriteltyä oletusympäristöä (Renderöinti -> Näkymä -"
-"> Oletusympäristö) ei voitu ladata."
+"Projektin asetuksissa määriteltyä oletusympäristöä (Rendering -> "
+"Environment -> Default Environment) ei voitu ladata."
#: scene/main/viewport.cpp
msgid ""
@@ -8322,14 +8192,14 @@ msgid ""
"obtain a size. Otherwise, make it a RenderTarget and assign its internal "
"texture to some node for display."
msgstr ""
-"Tätä näyttöruutua ei ole asetettu renderöitäväksi. Jos haluat sen näyttävän "
-"sisältöä suoraan näytölle, tee sitä Control:in lapsi, jotta se voi saada "
-"koon. Muutoin tee siitä RenderTarget ja aseta sen sisäinen tekstuuri "
-"johonkin Nodeen näkyväksi."
+"Tätä näyttöikkunaa ei ole asetettu renderöitäväksi. Jos haluat sen näyttävän "
+"sisältöä suoraan näytölle, tee sitä Control solmun alisolmu, jotta se voi "
+"saada koon. Muutoin tee siitä RenderTarget ja aseta sen sisäinen tekstuuri "
+"johonkin solmuun näkyväksi."
#: scene/resources/dynamic_font.cpp
msgid "Error initializing FreeType."
-msgstr "Virhe FreetType:n alustamisessa."
+msgstr "Virhe FreeType:n alustamisessa."
#: scene/resources/dynamic_font.cpp
msgid "Unknown font format."
@@ -8344,6 +8214,27 @@ msgid "Invalid font size."
msgstr "Virheellinen fonttikoko."
#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Edellinen välilehti"
+
+#~ msgid "Next"
+#~ msgstr "Seuraava"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Virheellinen tapahtuma (muut käy, paitsi '/' tai ':')."
+
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Yhdistä Nodeen:"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Paketti sisältää viallisen version.txt tiedoston. 'Revision' ei ole "
+#~ "hyväksytty tunniste."
+
+#, fuzzy
#~ msgid "Can't write file."
#~ msgstr "Ei voitu kirjoittaa tiedostoa:\n"
@@ -8359,9 +8250,6 @@ msgstr "Virheellinen fonttikoko."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Ei voitu luoda godot.cfg -tiedostoa projektin polkuun."
-#~ msgid "Next"
-#~ msgstr "Seuraava"
-
#~ msgid "Not found!"
#~ msgstr "Ei löytynyt!"
@@ -8515,7 +8403,7 @@ msgstr "Virheellinen fonttikoko."
#~ msgid "Info"
#~ msgstr "Tietoja"
-#~ msgid "Re-Import.."
+#~ msgid "Re-Import..."
#~ msgstr "Tuo uudelleen..."
#~ msgid "Target path is empty."
@@ -8767,13 +8655,13 @@ msgstr "Virheellinen fonttikoko."
#~ msgid "Zoom (%):"
#~ msgstr "Lähennä (%):"
-#~ msgid "Skeleton.."
+#~ msgid "Skeleton..."
#~ msgstr "Luuranko..."
#~ msgid "Zoom Reset"
#~ msgstr "Palauta lähennys"
-#~ msgid "Zoom Set.."
+#~ msgid "Zoom Set..."
#~ msgstr "Aseta Zoomaus..."
#~ msgid "Set a Value"
diff --git a/editor/translations/fr.po b/editor/translations/fr.po
index d08986aa0c..ee1d7b2cad 100644
--- a/editor/translations/fr.po
+++ b/editor/translations/fr.po
@@ -2,41 +2,50 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
-# Antoine Carrier <ac.g392@gmail.com>, 2017.
+# Antoine Carrier <ac.g392@gmail.com>, 2017-2018.
# ARocherVj <a.rocher.vj@gmail.com>, 2017.
# Arthur Templé <tuturtemple@gmail.com>, 2018.
# Brice <bbric@free.fr>, 2016.
# Chenebel Dorian <LoubiTek54@gmail.com>, 2016-2017.
+# Cindy Dallaire <c.dallaire93@gmail.com>, 2018.
# derderder77 <derderder77380@gmail.com>, 2016.
# finkiki <specialpopol@gmx.fr>, 2016.
# Gilles Roudiere <gilles.roudiere@gmail.com>, 2017-2018.
# Hugo Locurcio <hugo.l@openmailbox.org>, 2016-2018.
-# Kanabenki <lucien.menassol@gmail.com>, 2017.
-# keltwookie <keltwookie@protonmail.com>, 2017.
+# Javier Ocampos <xavier.ocampos@gmail.com>, 2018.
+# John Bernier <john.bp@unknit.net>, 2018.
+# Kanabenki <lucien.menassol@gmail.com>, 2017, 2018.
+# keltwookie <keltwookie@protonmail.com>, 2017-2018.
+# LL <lu.lecocq@free.fr>, 2018.
# Luc Stepniewski <lior@gradstein.info>, 2017.
# Marc <marc.gilleron@gmail.com>, 2016-2017.
+# Marc-Andre Belisle <belisle.ma@gmail.com>, 2018.
# Nathan Lovato <nathan.lovato.art@gmail.com>, 2017.
+# Nathan Vallet <nathanvalletmarseille@gmail.com>, 2018.
# Nicolas <flaithotw@gmail.com>, 2017.
# Nicolas Lehuen <nicolas@lehuen.com>, 2016.
# Nobelix <noe.le.cam@laposte.net>, 2017.
-# Omicron <tritonic.dev@gmail.com>, 2016.
+# Nocta Senestra <nocta@net-c.com>, 2018.
+# Omicron <omicron666.dev@gmail.com>, 2016, 2018.
# Onyx Steinheim <thevoxelmanonyx@gmail.com>, 2016.
+# Philippe Gervaise <blah@malvese.org>, 2018.
# Przemyslaw Gasinski <gasinski.przemek@protonmail.ch>, 2017.
# rafeu <duchainer@gmail.com>, 2016-2017.
+# rawida <rawida@tempinbox.com>, 2018.
# Rémi Verschelde <rverschelde@gmail.com>, 2016-2017.
# Robin Arys <robinarys@hotmail.com>, 2017.
# Roger BR <drai_kin@hotmail.com>, 2016.
+# salty64 <cedric.arrabie@univ-pau.fr>, 2018.
# Thomas Baijot <thomasbaijot@gmail.com>, 2016.
-# Tommy Melançon-Roy <tommel1234@hotmail.com>, 2017.
-# Xananax <xananax@yelostudio.com>, 2017.
-#
+# Tommy Melançon-Roy <tommel1234@hotmail.com>, 2017-2018.
+# Willow <theotimefd@aol.com>, 2018.
+# Xananax <xananax@yelostudio.com>, 2017-2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-02-06 00:36+0000\n"
-"Last-Translator: Hugo Locurcio <hugo.locurcio@hugo.pro>\n"
+"PO-Revision-Date: 2018-06-12 16:38+0000\n"
+"Last-Translator: Philippe Gervaise <blah@malvese.org>\n"
"Language-Team: French <https://hosted.weblate.org/projects/godot-engine/"
"godot/fr/>\n"
"Language: fr\n"
@@ -44,7 +53,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -60,7 +69,7 @@ msgstr "Changer l'heure de l'animation des images clés"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Animation Changer la transition"
+msgstr "Transition du changement d'animation"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
@@ -526,7 +535,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Déconnecter « %s » de « %s »"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Connecter…"
#: editor/connections_dialog.cpp
@@ -831,7 +840,7 @@ msgstr "Paquetage installé avec succès !"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Success!"
-msgstr "Succès!"
+msgstr "Succès !"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -852,31 +861,31 @@ msgstr "Ajouter effet"
#: editor/editor_audio_buses.cpp
msgid "Rename Audio Bus"
-msgstr "Renommer bus audio"
+msgstr "Renommer le bus audio"
#: editor/editor_audio_buses.cpp
msgid "Change Audio Bus Volume"
-msgstr "Modifier le volume audio du bus"
+msgstr "Modifier le volume du bus audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
-msgstr "Basculer vers transport audio solo"
+msgstr "Activer/désactiver le mode solo du bus audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Mute"
-msgstr "Basculer vers désactivation de transport audio"
+msgstr "Activer/désactiver le mode muet du bus audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Bypass Effects"
-msgstr "Basculer vers effets de contournement de transport audio"
+msgstr "Activer/désactiver le contournement du bus audio"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr "Sélectionner l'envoi de tranport audio"
+msgstr "Sélectionner l'envoi du bus audio"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
-msgstr "Ajouter effet de tranport audio"
+msgstr "Ajouter un effet bus audio"
#: editor/editor_audio_buses.cpp
msgid "Move Bus Effect"
@@ -888,7 +897,7 @@ msgstr "Supprimer l'effet de transport"
#: editor/editor_audio_buses.cpp
msgid "Audio Bus, Drag and Drop to rearrange."
-msgstr "Transport audio, glisser-déposer pour réorganiser."
+msgstr "Bus audio, glisser-déposer pour réorganiser."
#: editor/editor_audio_buses.cpp
msgid "Solo"
@@ -896,11 +905,11 @@ msgstr "Solo"
#: editor/editor_audio_buses.cpp
msgid "Mute"
-msgstr "Assourdir"
+msgstr "Rendre muet"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
-msgstr "Contournement"
+msgstr "Contourner"
#: editor/editor_audio_buses.cpp
msgid "Bus options"
@@ -925,19 +934,19 @@ msgstr "Audio"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
-msgstr "Ajouter un transport audio"
+msgstr "Ajouter un bus audio"
#: editor/editor_audio_buses.cpp
msgid "Master bus can't be deleted!"
-msgstr "Le transport maître ne peut pas être supprimé !"
+msgstr "Le bus maître ne peut pas être supprimé !"
#: editor/editor_audio_buses.cpp
msgid "Delete Audio Bus"
-msgstr "Supprimer le transport audio"
+msgstr "Supprimer le bus audio"
#: editor/editor_audio_buses.cpp
msgid "Duplicate Audio Bus"
-msgstr "Dupliquer le transport audio"
+msgstr "Dupliquer le bus audio"
#: editor/editor_audio_buses.cpp
msgid "Reset Bus Volume"
@@ -945,19 +954,19 @@ msgstr "Réinitialiser le volume de bus"
#: editor/editor_audio_buses.cpp
msgid "Move Audio Bus"
-msgstr "Déplacer le transport audio"
+msgstr "Déplacer le bus audio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Enregistrer l'agencement du transport audio sous.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Enregistrer la disposition des bus audio sous…"
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Emplacement du nouvel agencement.."
+msgid "Location for New Layout..."
+msgstr "Emplacement du nouvel agencement..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
-msgstr "Ouvrir agencement de transport audio"
+msgstr "Ouvrir une disposition de bus audio"
#: editor/editor_audio_buses.cpp
msgid "There is no 'res://default_bus_layout.tres' file."
@@ -965,11 +974,11 @@ msgstr "Il n'existe aucun 'res://default_bus_layout.tres'."
#: editor/editor_audio_buses.cpp
msgid "Invalid file, not an audio bus layout."
-msgstr "Fichier invalide, pas un agencement de transport audio."
+msgstr "Fichier invalide, pas une disposition de bus audio."
#: editor/editor_audio_buses.cpp
msgid "Add Bus"
-msgstr "Ajouter un transport"
+msgstr "Ajouter un bus"
#: editor/editor_audio_buses.cpp
msgid "Create a new Bus Layout."
@@ -1094,16 +1103,16 @@ msgid "Updating Scene"
msgstr "Mise à jour de la scène"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "Stockage des modifications locales…"
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "Mise à jour de la scène…"
#: editor/editor_data.cpp
msgid "[empty]"
-msgstr "(vide)"
+msgstr "[vide]"
#: editor/editor_data.cpp
msgid "[unsaved]"
@@ -1156,7 +1165,7 @@ msgstr "Le fichier existe, l'écraser ?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Select Current Folder"
-msgstr "Selectionner le dossier actuel"
+msgstr "Sélectionner le dossier courant"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
@@ -1167,8 +1176,8 @@ msgid "Show In File Manager"
msgstr "Montrer dans le gestionnaire de fichiers"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nouveau dossier.."
+msgid "New Folder..."
+msgstr "Nouveau dossier..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1226,7 +1235,7 @@ msgstr "Basculer les fichiers cachés"
#: editor/editor_file_dialog.cpp
msgid "Toggle Favorite"
-msgstr "Basculer le favori"
+msgstr "Basculer l'état favori"
#: editor/editor_file_dialog.cpp
msgid "Toggle Mode"
@@ -1368,8 +1377,8 @@ msgid ""
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Pas de tutoriels disponibles pour cette classe, vous pouvez [color=$color]"
-"[url=$url]en contribuer un[/url][/color] ou [color=$color][url=$url2]en "
+"Il n'y a pas de tutoriels disponibles pour cette classe, vous pouvez [color="
+"$color][url=$url]en créer un[/url][/color] ou [color=$color][url=$url2]en "
"demander un[/url][/color]."
#: editor/editor_help.cpp
@@ -1385,8 +1394,8 @@ msgid ""
"There is currently no description for this property. Please help us by "
"[color=$color][url=$url]contributing one[/url][/color]!"
msgstr ""
-"Pas de description disponible pour cette propriété. [color=$color][url="
-"$url]Contribuez[/url][/color] pour nous aider!"
+"Il n'y a pas de description disponible pour cette propriété. Aidez-nous en "
+"[color=$color][url=$url]en créant[/url][/color] une !"
#: editor/editor_help.cpp
msgid "Methods"
@@ -1401,8 +1410,8 @@ msgid ""
"There is currently no description for this method. Please help us by [color="
"$color][url=$url]contributing one[/url][/color]!"
msgstr ""
-"Pas de description disponible pour cette méthode. [color=$color][url="
-"$url]Contribuez[/url][/color] pour nous aider!"
+"Il n'y a pas de description disponible pour cette méthode. Aidez-nous en "
+"[color=$color][url=$url]en créant[/url][/color] une !"
#: editor/editor_help.cpp
msgid "Search Text"
@@ -1427,17 +1436,21 @@ msgstr "Effacer"
msgid "Clear Output"
msgstr "Effacer la sortie"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "L'export du projet a échoué avec le code erreur %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Erreur d'enregistrement de la ressource !"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Enregistrer la ressource sous…"
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Je vois…"
#: editor/editor_node.cpp
@@ -1458,7 +1471,7 @@ msgstr "Impossible d'ouvrir '%s'."
#: editor/editor_node.cpp
msgid "Error while parsing '%s'."
-msgstr "Erreur lors de l'analyse de '%s'."
+msgstr "Erreur lors de l'analyse syntaxique de '%s'."
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
@@ -1466,7 +1479,7 @@ msgstr "Fin de fichier inattendue '%s'."
#: editor/editor_node.cpp
msgid "Missing '%s' or its dependencies."
-msgstr "Fichier '%s' ou dépendances manquantes."
+msgstr "La scène '%s' ou ses dépendances sont introuvables."
#: editor/editor_node.cpp
msgid "Error while loading '%s'."
@@ -1510,11 +1523,11 @@ msgstr "Erreur d'enregistrement de la MeshLibrary !"
#: editor/editor_node.cpp
msgid "Can't load TileSet for merging!"
-msgstr "Impossible de charger la TileSet pour fusion !"
+msgstr "Impossible de charger le TileSet pour fusion !"
#: editor/editor_node.cpp
msgid "Error saving TileSet!"
-msgstr "Erreur d'enregistrement de la TileSet !"
+msgstr "Erreur d'enregistrement du TileSet !"
#: editor/editor_node.cpp
msgid "Error trying to save layout!"
@@ -1538,10 +1551,10 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
-"Cette ressource appartient à une scène qui a été importée, elle n'est donc "
-"pas éditable.\n"
-"Veuillez lire la documentation concernant l'import de scènes afin de mieux "
-"comprendre son déroulement."
+"Cette ressource n'est pas éditable car elle appartient à une scène "
+"importée.\n"
+"Merci de lire la documentation concernant l'import des scènes pour en "
+"comprendre le processus."
#: editor/editor_node.cpp
msgid ""
@@ -1549,16 +1562,15 @@ msgid ""
"Changes to it will not be kept when saving the current scene."
msgstr ""
"Cette ressource appartient a une scène qui a été instanciée ou héritée.\n"
-"Ses changements ne seront pas retenus lors de la sauvegarde de la scène "
-"actuelle."
+"Ses modifications seront perdues lors de la sauvegarde de la scène actuelle."
#: editor/editor_node.cpp
msgid ""
"This resource was imported, so it's not editable. Change its settings in the "
"import panel and then re-import."
msgstr ""
-"Cette ressource a été importée, aucune modification n’est possible. Modifiez "
-"ses paramètres dans le menu d'importation et, ensuite, réimportez-la."
+"Cette ressource a été importée, elle n'est donc pas éditable. Modifiez ses "
+"paramètres dans le panneau d'importation et, ensuite, réimportez-la."
#: editor/editor_node.cpp
msgid ""
@@ -1568,9 +1580,9 @@ msgid ""
"understand this workflow."
msgstr ""
"Cette scène a été importée, les changements ne seront donc pas conservés.\n"
-"L'instancier ou en hériter permettra de faire ces changements\n"
+"L'instancier ou l'hériter permettra de faire ces changements.\n"
"Veuillez lire la documentation concernant l'importation des scènes afin de "
-"mieux comprendre ce déroulement."
+"mieux comprendre ce processus."
#: editor/editor_node.cpp
msgid ""
@@ -1578,17 +1590,18 @@ msgid ""
"Please read the documentation relevant to debugging to better understand "
"this workflow."
msgstr ""
-"Ceci est un objet distant, les changements ne seront donc pas conservés.\n"
-"Veuillez lire la documentation concernant le débogage afin de mieux "
-"comprendre ce fonctionnement."
+"Ceci est un objet distant, les changements qui y sont faits ne seront pas "
+"sauvegardés.\n"
+"Merci de lire la section de la documentation portant sur le débogage pour "
+"mieux comprendre ce mécanisme."
#: editor/editor_node.cpp
msgid "Expand all properties"
-msgstr "Développer tout"
+msgstr "Développer toutes les propriétés"
#: editor/editor_node.cpp
msgid "Collapse all properties"
-msgstr "Réduire tout"
+msgstr "Réduire toutes les propriétés"
#: editor/editor_node.cpp
msgid "Copy Params"
@@ -1672,11 +1685,11 @@ msgid "Open Base Scene"
msgstr "Ouvrir scène de base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "Ouvrir une scène rapidement…"
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "Ouvrir un script rapidement…"
#: editor/editor_node.cpp
@@ -1688,7 +1701,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "Sauvegarder modifications de '%s' avant de quitter ?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "Enregistrer la scène sous…"
#: editor/editor_node.cpp
@@ -1718,7 +1731,7 @@ msgstr "Cette opération ne peut être réalisée sans nœud racine."
#: editor/editor_node.cpp
msgid "Export Tile Set"
-msgstr "Exporter un ensemble de tuiles"
+msgstr "Exporter le TileSet"
#: editor/editor_node.cpp
msgid "This operation can't be done without a selected node."
@@ -1741,7 +1754,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Cette action ne peut être annulée. Réinitialiser quand même ?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "Lancer une scène rapidement…"
#: editor/editor_node.cpp
@@ -1778,8 +1791,8 @@ msgid ""
"considered a bug. Please report."
msgstr ""
"Cette option est dépréciée. Les situations dans lesquelles un "
-"rafraîchissement doit être forcé sont désormais considérés comme bug. "
-"Veuillez le signaler."
+"rafraîchissement doit être forcé sont désormais considérées comme un bogue. "
+"Merci de le signaler."
#: editor/editor_node.cpp
msgid "Pick a Main Scene"
@@ -1788,8 +1801,8 @@ msgstr "Choisir une scène principale"
#: editor/editor_node.cpp
msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
msgstr ""
-"Impossible d'activer le plugin depuis : '%s' la lecture de la configuration "
-"a échoué."
+"Impossible d'activer le greffon depuis : '%s' l’analyse syntaxique de la "
+"configuration a échoué."
#: editor/editor_node.cpp
msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
@@ -1844,7 +1857,7 @@ msgstr "La scène « %s » a des dépendences cassées :"
#: editor/editor_node.cpp
msgid "Clear Recent Scenes"
-msgstr "Retirer les scènes récentes"
+msgstr "Vider la liste des scènes récentes"
#: editor/editor_node.cpp
msgid "Save Layout"
@@ -1861,7 +1874,7 @@ msgstr "Par défaut"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr "Basculer entre les onglets de scène"
+msgstr "Basculer entre onglets de scène"
#: editor/editor_node.cpp
msgid "%d more files or folders"
@@ -1885,7 +1898,7 @@ msgstr "Mode Sans Distraction"
#: editor/editor_node.cpp
msgid "Toggle distraction-free mode."
-msgstr "Basculer vers mode sans-distraction."
+msgstr "Basculer en mode sans distraction."
#: editor/editor_node.cpp
msgid "Add a new scene."
@@ -1908,8 +1921,8 @@ msgid "Previous tab"
msgstr "Onglet precedent"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrer Fichiers.."
+msgid "Filter Files..."
+msgstr "Filtrer Fichiers..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1920,11 +1933,11 @@ msgid "New Scene"
msgstr "Nouvelle scène"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Nouvelle scène héritée…"
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "Ouvrir une scène…"
#: editor/editor_node.cpp
@@ -1944,15 +1957,15 @@ msgid "Open Recent"
msgstr "Fichiers récents"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "Convertir vers…"
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "MeshLibrary…"
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet…"
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2015,7 +2028,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr "Petit déploiement avec le réseau"
+msgstr "Déploiement minime avec système de fichier réseau"
#: editor/editor_node.cpp
msgid ""
@@ -2092,7 +2105,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Editor"
-msgstr "Editeur"
+msgstr "Éditeur"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
@@ -2104,7 +2117,7 @@ msgstr "Disposition de l'éditeur"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
-msgstr "Basculer le mode plein écran"
+msgstr "Activer/Désactiver le plein écran"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
@@ -2218,7 +2231,7 @@ msgid "Save the currently edited resource."
msgstr "Enregistrer la ressource actuellement modifiée."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Enregistrer sous…"
#: editor/editor_node.cpp
@@ -2239,7 +2252,7 @@ msgstr "Propriétés de l'objet."
#: editor/editor_node.cpp
msgid "Changes may be lost!"
-msgstr "Les changements risquent d’être perdus !"
+msgstr "Les modifications risquent d'être perdues !"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_manager.cpp
@@ -2308,7 +2321,7 @@ msgstr "Ouvrir éditeur 3D"
#: editor/editor_node.cpp
msgid "Open Script Editor"
-msgstr "Ouvrir éditeur de script"
+msgstr "Ouvrir l'éditeur de script"
#: editor/editor_node.cpp editor/project_manager.cpp
msgid "Open Asset Library"
@@ -2316,18 +2329,18 @@ msgstr "Ouvrir bibliothèque de ressource"
#: editor/editor_node.cpp
msgid "Open the next Editor"
-msgstr "Ouvrir éditeur suivant"
+msgstr "Ouvrir l'éditeur suivant"
#: editor/editor_node.cpp
msgid "Open the previous Editor"
-msgstr "Ouvrir éditeur précédant"
+msgstr "Ouvrir l'éditeur précédant"
#: editor/editor_plugin.cpp
msgid "Creating Mesh Previews"
msgstr "Création des prévisualisations des maillages"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr "Aperçu…"
#: editor/editor_plugin_settings.cpp
@@ -2389,7 +2402,7 @@ msgstr "Inclusif"
#: editor/editor_profiler.cpp
msgid "Self"
-msgstr "Soi"
+msgstr "Self"
#: editor/editor_profiler.cpp
msgid "Frame #:"
@@ -2397,7 +2410,7 @@ msgstr "Frame # :"
#: editor/editor_profiler.cpp
msgid "Time"
-msgstr "Temps :"
+msgstr "Temps"
#: editor/editor_profiler.cpp
msgid "Calls"
@@ -2441,7 +2454,7 @@ msgstr "Avez-vous oublié la méthode « _run » ?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
-msgstr "Par défaut (même que l'éditeur)"
+msgstr "Par défaut (le même que l'éditeur)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
@@ -2480,8 +2493,8 @@ msgid "(Current)"
msgstr "(Actuel)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Récupération des miroirs, veuillez patienter.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Récupération des miroirs, veuillez patienter..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2496,14 +2509,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Format de version.txt invalide dans les modèles."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Format de version.txt invalide dans les modèles. Revision n'est pas un "
-"identifiant valide."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Aucun version.txt n'a été trouvé dans les modèles."
@@ -2524,9 +2529,8 @@ msgid ""
"No download links found for this version. Direct download is only available "
"for official releases."
msgstr ""
-"Aucun lien de téléchargement n'a été trouvé pour cette version. Le "
-"téléchargement direct est uniquement disponible pour les versions "
-"officielles."
+"Aucun lien de téléchargement trouvé pour cette version. Le téléchargement "
+"direct est uniquement disponible pour les versions officielles."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2546,7 +2550,7 @@ msgstr "Pas de réponse."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request Failed."
-msgstr "Requête échouée."
+msgstr "Échec de la requête."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2567,8 +2571,8 @@ msgid "Error requesting url: "
msgstr "Erreur lors de la requête de l’URL : "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Connexion au miroir"
+msgid "Connecting to Mirror..."
+msgstr "Connexion au Miroir..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2584,8 +2588,8 @@ msgstr "Impossible à résoudre"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Connexion en cours.."
+msgid "Connecting..."
+msgstr "Connexion en cours..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2597,8 +2601,8 @@ msgstr "Connecté"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Envoi d'une requête.."
+msgid "Requesting..."
+msgstr "Envoi d'une requête..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2652,7 +2656,9 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid "Cannot navigate to '%s' as it has not been found in the file system!"
-msgstr "Impossible d'accédez à '%s' car celui-ci n'a pas été trouvé !"
+msgstr ""
+"Impossible d'accédez à '%s' car celui-ci n'existe pas dans le système de "
+"fichiers !"
#: editor/filesystem_dock.cpp
msgid "View items as a grid of thumbnails"
@@ -2690,11 +2696,11 @@ msgstr "Impossible de mettre à jour les dépendences :"
#: editor/filesystem_dock.cpp
msgid "No name provided"
-msgstr "Aucun nom fourni"
+msgstr "Aucun nom renseigné"
#: editor/filesystem_dock.cpp
msgid "Provided name contains invalid characters"
-msgstr "Le nom fourni contient des caractères invalides"
+msgstr "Le nom renseigné contient des caractères invalides"
#: editor/filesystem_dock.cpp
msgid "No name provided."
@@ -2733,11 +2739,11 @@ msgid "Collapse all"
msgstr "Réduire tout"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Renommer.."
+msgid "Rename..."
+msgstr "Renommer..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Déplacer vers…"
#: editor/filesystem_dock.cpp
@@ -2749,15 +2755,15 @@ msgid "Instance"
msgstr "Instance"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "Modifier les dépendances…"
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "Voir les propriétaires…"
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Dupliquer…"
#: editor/filesystem_dock.cpp
@@ -2785,7 +2791,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Analyse des fichiers en cours,\n"
"Veuillez patienter..."
@@ -2853,7 +2859,7 @@ msgid "Import Scene"
msgstr "Importer une scène"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "Importation de la scène…"
#: editor/import/resource_importer_scene.cpp
@@ -2862,10 +2868,10 @@ msgstr "Génération des lightmaps :"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
-msgstr "Généreration pour le Mesh : "
+msgstr "Génération pour le Mesh : "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Lancement du script personnalisé…"
#: editor/import/resource_importer_scene.cpp
@@ -2882,7 +2888,7 @@ msgid "Error running post-import script:"
msgstr "Erreur d'exécution du script de post-importation :"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Enregistrement…"
#: editor/import_dock.cpp
@@ -2902,7 +2908,7 @@ msgid "Import As:"
msgstr "Importer comme :"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr "Pré-réglage…"
#: editor/import_dock.cpp
@@ -3100,7 +3106,7 @@ msgstr "Lecture automatique au chargement"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Edit Target Blend Times"
-msgstr "Modifier les temps de mélange des cibles"
+msgstr "Modifier les temps de mélange de la cible"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Tools"
@@ -3148,7 +3154,7 @@ msgstr "3 étapes"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Differences Only"
-msgstr "seul les différence"
+msgstr "Différences seules"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Force White Modulate"
@@ -3321,7 +3327,7 @@ msgid "Transition Node"
msgstr "Nœud Transition"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr "Importer des animations…"
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3329,7 +3335,7 @@ msgid "Edit Node Filters"
msgstr "Modifier les filtres de nœud"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Filtres…"
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3397,8 +3403,8 @@ msgid "Fetching:"
msgstr "Récupération:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Résolution.."
+msgid "Resolving..."
+msgstr "Résolution..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3464,7 +3470,7 @@ msgid "Site:"
msgstr "Site :"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Support…"
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3473,7 +3479,7 @@ msgstr "Officiel"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Testing"
-msgstr "En test"
+msgstr "Tester"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
@@ -3565,11 +3571,11 @@ msgstr "créer un nouveau guide horizontal"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Remove horizontal guide"
-msgstr "Créer un nouveau guide horizontal"
+msgstr "Supprimer le guide horizontal"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Create new horizontal and vertical guides"
-msgstr "Créer des nouveaux guides horizontaux et verticaux"
+msgstr "Créer de nouveaux guides horizontaux et verticaux"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Edit IK Chain"
@@ -3644,7 +3650,7 @@ msgstr "Mode navigation"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Toggles snapping"
-msgstr "Active le magnétisme"
+msgstr "Activer/Désactiver le magnétisme de grille"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Snap"
@@ -3652,7 +3658,7 @@ msgstr "Aligner sur la grille"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snapping options"
-msgstr "Options de magnétisme"
+msgstr "Options du magnétisme"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to grid"
@@ -3663,8 +3669,9 @@ msgid "Use Rotation Snap"
msgstr "Rotation alignée"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "Configurer la grille…"
+msgstr "Configurer le magnétisme…"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3676,7 +3683,7 @@ msgstr "Aligner au pixel près"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Smart snapping"
-msgstr "Alignement intelligent"
+msgstr "Magnétisme intelligent"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to parent"
@@ -3684,15 +3691,15 @@ msgstr "Aimanter au parent"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node anchor"
-msgstr "Accrocher à l'ancre du noeud"
+msgstr "Accrocher à l'ancre du nœud"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node sides"
-msgstr "Accrocher aux flancs du noeud"
+msgstr "Accrocher aux flancs du nœud"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to other nodes"
-msgstr "Accrocher aux autres noeuds"
+msgstr "Accrocher aux autres nœuds"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to guides"
@@ -3756,7 +3763,15 @@ msgstr "Afficher les règles"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Guides"
-msgstr "Montrer les guides"
+msgstr "Afficher les guides"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Afficher l'origine"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Afficher la Viewport"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
@@ -4048,6 +4063,10 @@ msgstr ""
"Le maillage n'a pas de surfaces où des contours pourraient être créées !"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Le type de maillage primitif n'est pas PRIMITIVE_TRIANGLES !"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Impossible de créer le contour !"
@@ -4076,7 +4095,7 @@ msgid "Create Convex Collision Sibling"
msgstr "Créer une collision convexe"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr "Créer un maillage de contour…"
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4226,7 +4245,7 @@ msgstr "Calcul de la taille de la grille..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating heightfield..."
-msgstr "Création de la heightmap…"
+msgstr "Création du champ de hauteur…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Marking walkable triangles..."
@@ -4234,7 +4253,7 @@ msgstr "Marquage des triangles parcourables..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
-msgstr "Construction d'une heightmap compacte..."
+msgstr "Construction d'un champ de hauteur compact..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Eroding walkable area..."
@@ -4246,7 +4265,7 @@ msgstr "Partitionnement..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating contours..."
-msgstr "Création des coutours..."
+msgstr "Création des contours..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating polymesh..."
@@ -4287,8 +4306,8 @@ msgid "Error loading image:"
msgstr "Erreur de chargement d'image :"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Pas de pixels avec transparence > 128 dans l'image.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Pas de pixels avec transparence > 128 dans l'image..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4539,7 +4558,7 @@ msgstr "Mettre à l'échelle le polygone"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit"
-msgstr "Modifier"
+msgstr "Édition"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon->UV"
@@ -4648,7 +4667,7 @@ msgid "Import Theme"
msgstr "Importer un thème"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Enregistrer le thème sous…"
#: editor/plugins/script_editor_plugin.cpp
@@ -4741,11 +4760,11 @@ msgstr "Lancer"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle Scripts Panel"
-msgstr "Basculer vers le panneau de scripts"
+msgstr "Afficher/Cacher le panneau des scripts"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "Trouver…"
#: editor/plugins/script_editor_plugin.cpp
@@ -4776,7 +4795,7 @@ msgstr "Garder le débogueur ouvert"
#: editor/plugins/script_editor_plugin.cpp
msgid "Debug with external editor"
-msgstr "Deboguer avec un éditeur externe"
+msgstr "Déboguer avec un éditeur externe"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open Godot online documentation"
@@ -4843,7 +4862,7 @@ msgstr "Prélever une couleur"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Case"
-msgstr "Cas de conversion"
+msgstr "Modifier la casse"
#: editor/plugins/script_text_editor.cpp
msgid "Uppercase"
@@ -4919,7 +4938,7 @@ msgstr "Convertir indentations en espaces"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Tabs"
-msgstr "Convertir indentations en espaces"
+msgstr "Convertir les indentations en tabulations"
#: editor/plugins/script_text_editor.cpp
msgid "Auto Indent"
@@ -4952,18 +4971,18 @@ msgstr "Convertir en minuscule"
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
-msgstr "trouver précédente"
+msgstr "Trouver le précédent"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "Remplacer…"
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr "Aller à la fonction…"
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "Aller à la ligne…"
#: editor/plugins/script_text_editor.cpp
@@ -5004,7 +5023,7 @@ msgstr "Modifier un opérateur RVB"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Toggle Rot Only"
-msgstr "Basculer seulement la rotation"
+msgstr "Basculer en mode rotation seule"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Function"
@@ -5172,7 +5191,7 @@ msgstr "Vertex"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "FPS"
-msgstr "Images par secondes"
+msgstr "IPS"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View."
@@ -5412,18 +5431,14 @@ msgstr "Outil échelle"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Toggle Freelook"
-msgstr "Activer mode vue libre"
+msgstr "Basculer en vue libre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform"
msgstr "Transformation"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configurer la grille…"
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr "Dialogue de transformation…"
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5585,7 +5600,7 @@ msgstr "Insérer vide (après)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Move (Before)"
-msgstr "Déplacer avant"
+msgstr "Déplacer (Avant)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Move (After)"
@@ -5676,12 +5691,12 @@ msgid "Remove All"
msgstr "Supprimer tout"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Éditer le thème..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
-msgstr "Menu d'édition des thèmes..."
+msgstr "Menu d'édition des thèmes."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add Class Items"
@@ -5701,7 +5716,7 @@ msgstr "Créer un nouveau modèle d'éditeur"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create From Current Editor Theme"
-msgstr "Créer à partir du thème éditeur actuel"
+msgstr "Créer à partir du thème actuel de l'éditeur"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
@@ -5724,6 +5739,14 @@ msgid "Checked Item"
msgstr "Item coché"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Item radio"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Item radio coché"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Possède"
@@ -5736,8 +5759,8 @@ msgid "Options"
msgstr "Options"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Ont,Plusieurs,Possibilités,D'options !"
+msgid "Has,Many,Options"
+msgstr "Possède,Plusieurs,Options"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5805,7 +5828,7 @@ msgstr "Supprimer la sélection"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Find tile"
-msgstr "Chercher une case"
+msgstr "Trouver une tuile"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Transpose"
@@ -5861,7 +5884,7 @@ msgstr "Fusionner depuis la scène ?"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Tile Set"
-msgstr "Ensemble de cases"
+msgstr "Jeu de tuiles"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5877,28 +5900,31 @@ msgstr "Erreur"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Autotiles"
-msgstr "Coupe automatique"
+msgstr "Autotiles"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid ""
"Select sub-tile to use as icon, this will be also used on invalid autotile "
"bindings."
msgstr ""
+"Sélectionner une sous-tuile à utiliser comme icône, celle-ci sera aussi "
+"utilisée pour les liaisons de tuiles automatiques invalides."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid ""
"LMB: set bit on.\n"
"RMB: set bit off."
msgstr ""
+"Clic-gauche : Activer\n"
+"Clic-droit : Désactiver"
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Select current edited sub-tile."
-msgstr "Enregistrer la ressource actuellement modifiée."
+msgstr "Sélectionner la sous-tuile en cours d'édition."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select sub-tile to change its priority."
-msgstr ""
+msgstr "Sélectionner une sous-tuile pour changer sa priorité."
#: editor/progress_dialog.cpp scene/gui/dialogs.cpp
msgid "Cancel"
@@ -5906,7 +5932,7 @@ msgstr "Annuler"
#: editor/project_export.cpp
msgid "Runnable"
-msgstr "Activable"
+msgstr "Exécutable"
#: editor/project_export.cpp
msgid "Delete patch '%s' from list?"
@@ -5925,7 +5951,7 @@ msgid "Presets"
msgstr "Pré-réglages"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Ajouter…"
#: editor/project_export.cpp
@@ -5968,7 +5994,7 @@ msgstr ""
#: editor/project_export.cpp
msgid "Patches"
-msgstr "Patches"
+msgstr "Patchs"
#: editor/project_export.cpp
msgid "Make Patch"
@@ -6011,22 +6037,24 @@ msgid "Please choose a 'project.godot' file."
msgstr "Veuillez choisir un fichier 'project.godot'."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Please choose an empty folder."
-msgstr "Veuillez choisir un fichier 'project.godot'."
+msgstr "Veuillez choisir un dossier vide."
#: editor/project_manager.cpp
msgid "Imported Project"
msgstr "Projet importé"
#: editor/project_manager.cpp
-#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Nom du Projet Invalide."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Impossible de créer le dossier."
#: editor/project_manager.cpp
msgid "There is already a folder in this path with the specified name."
-msgstr ""
+msgstr "Un dossier avec le nom spécifié existe déjà dans ce chemin."
#: editor/project_manager.cpp
msgid "It would be a good idea to name your project."
@@ -6037,12 +6065,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "Chemin de projet non valide (avez-vous changé quelque chose ?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
msgstr ""
-"Impossible de modifier le fichier project.godot dans le chemin du projet."
+"Impossible de charger le fichier project.godot dans le chemin du projet "
+"(erreur %d). Le fichier est manquant ou corrompu."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6070,27 +6098,24 @@ msgid "Import Existing Project"
msgstr "Importer un projet existant"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Import & Edit"
-msgstr "Importer et ouvrir"
+msgstr "Importer et Modifier"
#: editor/project_manager.cpp
msgid "Create New Project"
msgstr "Créer un nouveau projet"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create & Edit"
-msgstr "Créer Émetteur"
+msgstr "Créer et ouvrir"
#: editor/project_manager.cpp
msgid "Install Project:"
msgstr "Installer projet :"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Install & Edit"
-msgstr "Installer"
+msgstr "Installer et ouvrir"
#: editor/project_manager.cpp
msgid "Project Name:"
@@ -6226,8 +6251,12 @@ msgid "Mouse Button"
msgstr "Bouton de souris"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Action invalide (tout passe, sauf « / » ou « : »)."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Nom d'action invalide. Il ne peux être vide ou contenir '/', ':', '=', '\\' "
+"ou '\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6254,7 +6283,7 @@ msgid "Control+"
msgstr "Contrôle+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr "Appuyez sur une touche…"
#: editor/project_settings_editor.cpp
@@ -6310,9 +6339,8 @@ msgid "Joypad Button Index:"
msgstr "Index de bouton de la manette de jeu :"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Erase Input Action"
-msgstr "Effacer l'événement d'action d'entrée"
+msgstr "Effacer l'action d'entrée"
#: editor/project_settings_editor.cpp
msgid "Erase Input Action Event"
@@ -6355,9 +6383,8 @@ msgid "Add Global Property"
msgstr "Ajouter une propriété globale"
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Select a setting item first!"
-msgstr "Choisissez d'abord un élément de réglage !"
+msgstr "Sélectionnez d'abord un élément à configurer !"
#: editor/project_settings_editor.cpp
msgid "No property '%s' exists."
@@ -6372,10 +6399,6 @@ msgid "Delete Item"
msgstr "Supprimer élément"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Ne peut pas contenir de '/' ou ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Existe déjà"
@@ -6393,7 +6416,7 @@ msgstr "Paramètres enregistrés avec succès."
#: editor/project_settings_editor.cpp
msgid "Override for Feature"
-msgstr "Remplacement de fonctionnalité"
+msgstr "Écrasement d'un paramètre, dédié à un tag de fonctionnalité"
#: editor/project_settings_editor.cpp
msgid "Add Translation"
@@ -6444,8 +6467,8 @@ msgid "Property:"
msgstr "Propriété :"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Remplacement pour.."
+msgid "Override For..."
+msgstr "Écraser pour…"
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6540,11 +6563,11 @@ msgid "Easing Out-In"
msgstr "Ease out-in"
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr "Fichier…"
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr "Répertoire…"
#: editor/property_editor.cpp
@@ -6596,9 +6619,8 @@ msgid "On"
msgstr "Activé"
#: editor/property_editor.cpp
-#, fuzzy
msgid "[Empty]"
-msgstr "Ajouter vide"
+msgstr "[Vide]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
@@ -6692,7 +6714,7 @@ msgstr "Instancier scène(s)"
#: editor/scene_tree_dock.cpp
msgid "This operation can't be done on the tree root."
-msgstr "Cette opération ne peut être réalisée sur la racine de l'arbre."
+msgstr "Cette opération ne peut être réalisée sur la racine de l'arborescence."
#: editor/scene_tree_dock.cpp
msgid "Move Node In Parent"
@@ -6719,7 +6741,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Cette opération ne peut être réalisée sur des scènes instanciées."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Enregistrer la nouvelle scène sous…"
#: editor/scene_tree_dock.cpp
@@ -6767,7 +6789,6 @@ msgid "Error duplicating scene to save it."
msgstr "Erreur de duplication de la scène afin de l'enregistrer."
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Sub-Resources"
msgstr "Ressources secondaires :"
@@ -6914,7 +6935,7 @@ msgstr ""
#: editor/scene_tree_editor.cpp
msgid "Toggle Visibility"
-msgstr "Basculer visibilité"
+msgstr "Basculer la visibilité"
#: editor/scene_tree_editor.cpp
msgid "Invalid node name, the following characters are not allowed:"
@@ -7063,7 +7084,7 @@ msgstr "Fonction :"
#: editor/script_editor_debugger.cpp
msgid "Pick one or more items from the list to display the graph."
msgstr ""
-"Chosissez un ou plusieurs éléments dans la liste pour afficher le graphique."
+"Sélectionnez un ou plusieurs éléments de la liste pour afficher le graphique."
#: editor/script_editor_debugger.cpp modules/mono/editor/mono_bottom_panel.cpp
msgid "Errors"
@@ -7074,9 +7095,8 @@ msgid "Child Process Connected"
msgstr "Processus enfant connecté"
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Copy Error"
-msgstr "Erreurs de chargement"
+msgstr "Erreurs de copie"
#: editor/script_editor_debugger.cpp
msgid "Inspect Previous Instance"
@@ -7152,11 +7172,11 @@ msgstr "Divers"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
-msgstr "Control cliqué :"
+msgstr "Contrôle cliqué :"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control Type:"
-msgstr "Type de Control cliqué :"
+msgstr "Type de contrôle cliqué :"
#: editor/script_editor_debugger.cpp
msgid "Live Edit Root:"
@@ -7231,47 +7251,40 @@ msgid "Select dependencies of the library for this entry"
msgstr "Sélectionnez les dépendances de la librairie pour cette entrée"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Remove current entry"
-msgstr "Supprimer point de courbe"
+msgstr "Supprimer l’entrée"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Double click to create a new entry"
msgstr "Double-cliquez pour créer une nouvelle entrée"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Platform:"
-msgstr "Platform:"
+msgstr "Plateforme :"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Platform"
-msgstr "Copier vers la plate-forme…"
+msgstr "Plateforme"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Dynamic Library"
-msgstr "Bibliothèque"
+msgstr "Bibliothèque dynamique"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Add an architecture entry"
-msgstr "Ajouter une entrée architecturale"
+msgstr "Ajouter une entrée architecture"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "GDNativeLibrary"
-msgstr "GDNative"
+msgstr "GDNativeLibrary"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Library"
msgstr "Bibliothèque"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
-#, fuzzy
msgid "Status"
-msgstr "État :"
+msgstr "État"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Libraries: "
@@ -7333,25 +7346,22 @@ msgid "Object can't provide a length."
msgstr "L'objet ne peut fournir une longueur."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Onglet suivant"
+msgstr "Plan suivant"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Onglet precedent"
+msgstr "Plan précédent"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Plan :"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
msgstr "Étage suivant"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Floor"
msgstr "Onglet précédent"
@@ -7451,34 +7461,33 @@ msgstr "Paramètres GridMap"
msgid "Pick Distance:"
msgstr "Choisissez distance :"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Le nom de la classe ne peut pas être un mot clé réservé"
+
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Generating solution..."
-msgstr "Création des coutours..."
+msgstr "Génération de la solution en cours..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating C# project..."
-msgstr ""
+msgstr "Création du projet C#..."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to create solution."
-msgstr "Impossible de créer le contour !"
+msgstr "Impossible de créer la solution."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to save solution."
-msgstr "Impossible de charger la ressource."
+msgstr "Impossible de sauvegarder la solution."
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Done"
msgstr "C'est fait !"
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Failed to create C# project."
-msgstr "Impossible de charger la ressource."
+msgstr "Impossible de créer le projet C#."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Mono"
@@ -7486,26 +7495,27 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "À propos du support C#"
#: modules/mono/editor/godotsharp_editor.cpp
-#, fuzzy
msgid "Create C# solution"
-msgstr "Créer le contour"
+msgstr "Créer la solution C#"
#: modules/mono/editor/mono_bottom_panel.cpp
msgid "Builds"
msgstr "Constructions"
#: modules/mono/editor/mono_bottom_panel.cpp
-#, fuzzy
msgid "Build Project"
-msgstr "Projet"
+msgstr "Compiler le projet"
#: modules/mono/editor/mono_bottom_panel.cpp
-#, fuzzy
msgid "Warnings"
-msgstr "Avertissement"
+msgstr "Avertissements"
+
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Fin de la trace d'appel (stack trace) intrinsèque"
#: modules/visual_script/visual_script.cpp
msgid ""
@@ -7868,34 +7878,28 @@ msgid "Run exported HTML in the system's default browser."
msgstr "Exécutez le HTML exporté dans le navigateur par défaut du système."
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not write file:"
-msgstr "Impossible d'écrire le fichier:\n"
+msgstr "Impossible d'écrire le fichier :"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not open template for export:"
-msgstr "Impossible d'ouvrir le modèle pour exportation:\n"
+msgstr "Impossible d'ouvrir le modèle pour exportation :"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Invalid export template:"
-msgstr "Modèle d'exportation non valide :\n"
+msgstr "Modèle d'exportation non valide :"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not read custom HTML shell:"
-msgstr "Impossible de lire le shell HTML :\n"
+msgstr "Impossible de lire le shell HTML personnalisé :"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Could not read boot splash image file:"
-msgstr "Impossible de lire l'image de démarrage :\n"
+msgstr "Impossible de lire l'image de démarrage :"
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Using default boot splash image."
-msgstr "Impossible de lire l'image de démarrage :\n"
+msgstr "Impossible de lire l'image de démarrage."
#: scene/2d/animated_sprite.cpp
msgid ""
@@ -7919,6 +7923,9 @@ msgid ""
"Consider adding CollisionShape2D or CollisionPolygon2D children nodes to "
"define its shape."
msgstr ""
+"Ce nœud n'a aucune forme enfant, et ne peut donc interagir avec l'espace.\n"
+"Considérez ajouter un nœud enfant CollisionShape2D ou un CollisionPolygon2D "
+"pour définir sa forme."
#: scene/2d/collision_polygon_2d.cpp
msgid ""
@@ -8069,30 +8076,27 @@ msgstr "ARVROrigin requiert un nœud enfant ARVRCamera"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Temps restant: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
-#, fuzzy
msgid "Plotting Meshes: "
-msgstr "Tracer les maillages"
+msgstr "Tracer les maillages : "
#: scene/3d/baked_lightmap.cpp
-#, fuzzy
msgid "Plotting Lights:"
-msgstr "Tracer les maillages"
+msgstr "Tracer les lumières :"
#: scene/3d/baked_lightmap.cpp scene/3d/gi_probe.cpp
msgid "Finishing Plot"
msgstr "Finalisation du tracer"
#: scene/3d/baked_lightmap.cpp
-#, fuzzy
msgid "Lighting Meshes: "
-msgstr "Tracer les maillages"
+msgstr "Tracer les maillages : "
#: scene/3d/collision_object.cpp
msgid ""
@@ -8100,6 +8104,9 @@ msgid ""
"Consider adding CollisionShape or CollisionPolygon children nodes to define "
"its shape."
msgstr ""
+"Ce nœud n'a aucune forme enfant, il ne peut donc interagir avec l'espace.\n"
+"Considérez ajouter un nœud enfant CollisionShape ou CollisionPolygon pour "
+"définir sa forme."
#: scene/3d/collision_polygon.cpp
msgid ""
@@ -8172,12 +8179,25 @@ msgstr ""
"La propriété Path doit pointer vers un nœud Spatial valide pour fonctionner."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "L'environnement mondial a besoin d'une ressource environnementale."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Seul un WorldEnvironnement ne peut être utilisé par scène (ou ensemble de "
"scènes instanciées)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Cet WorldEnvironment est ignoré. Ajoutez une caméra (pour les scènes 3D) ou "
+"définissez le mode Background Mode de cet environnement sur Canvas (pour les "
+"scènes 2D)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8191,8 +8211,8 @@ msgid ""
"VehicleWheel serves to provide a wheel system to a VehicleBody. Please use "
"it as a child of a VehicleBody."
msgstr ""
-"VehicleWheel ajoute un système de roues à un VehicleBody. Veuillez "
-"l'utiliser en tant qu'enfant d'un VehicleBody."
+"VehicleWheel permet de fournir un système de roue à un VehicleBody. Merci de "
+"l'utiliser comme enfant d'un VehicleBody."
#: scene/gui/color_picker.cpp
msgid "Raw Mode"
@@ -8212,7 +8232,7 @@ msgstr "Veuillez confirmer…"
#: scene/gui/file_dialog.cpp
msgid "Select this Folder"
-msgstr "Sélectionnez ce dossier"
+msgstr "Sélectionner ce dossier"
#: scene/gui/popup.cpp
msgid ""
@@ -8240,13 +8260,12 @@ msgid "(Other)"
msgstr "(Autre)"
#: scene/main/scene_tree.cpp
-#, fuzzy
msgid ""
"Default Environment as specified in Project Settings (Rendering -> "
"Environment -> Default Environment) could not be loaded."
msgstr ""
"L'environnement par défaut spécifié dans les réglages du projet (Rendu -> "
-"Viewport -> Environnement par défaut) ne peut pas être chargé."
+"Environnement -> Environnement par défaut) ne peut pas être chargé."
#: scene/main/viewport.cpp
msgid ""
@@ -8276,6 +8295,26 @@ msgstr "Erreur lors du chargement de la police."
msgid "Invalid font size."
msgstr "Taille de police invalide."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Onglet precedent"
+
+#~ msgid "Next"
+#~ msgstr "Suivant"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Action invalide (tout passe, sauf « / » ou « : »)."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Ne peut pas contenir de '/' ou ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Format de version.txt invalide dans les modèles. Revision n'est pas un "
+#~ "identifiant valide."
+
#~ msgid "Can't write file."
#~ msgstr "Impossible d'écrire le fichier."
@@ -8292,9 +8331,6 @@ msgstr "Taille de police invalide."
#~ msgstr ""
#~ "Impossible de trouver le fichier project.godot dans le chemin du projet."
-#~ msgid "Next"
-#~ msgstr "Suivant"
-
#~ msgid "Not found!"
#~ msgstr "Non trouvé !"
@@ -8442,7 +8478,7 @@ msgstr "Taille de police invalide."
#~ msgid "Exporting for %s"
#~ msgstr "Exportation pour %s"
-#~ msgid "Setting Up.."
+#~ msgid "Setting Up..."
#~ msgstr "Configuration…"
#~ msgid "Error loading scene."
@@ -8505,7 +8541,7 @@ msgstr "Taille de police invalide."
#~ msgid "Info"
#~ msgstr "Information"
-#~ msgid "Re-Import.."
+#~ msgid "Re-Import..."
#~ msgstr "Ré-importer…"
#~ msgid "No bit masks to import!"
@@ -8902,13 +8938,13 @@ msgstr "Taille de police invalide."
#~ msgid "Zoom (%):"
#~ msgstr "Zoom (%) :"
-#~ msgid "Skeleton.."
+#~ msgid "Skeleton..."
#~ msgstr "Squelette…"
#~ msgid "Zoom Reset"
#~ msgstr "Réinitialiser le zoom"
-#~ msgid "Zoom Set.."
+#~ msgid "Zoom Set..."
#~ msgstr "Définir le zoom…"
#~ msgid "Set a Value"
@@ -9386,7 +9422,7 @@ msgstr "Taille de police invalide."
#~ msgid "Export Project PCK"
#~ msgstr "Exporter le PCK du projet"
-#~ msgid "Export.."
+#~ msgid "Export..."
#~ msgstr "Exporter…"
#~ msgid "Project Export"
@@ -9481,7 +9517,7 @@ msgstr "Taille de police invalide."
#~ msgid "Method In Node:"
#~ msgstr "Méthode dans le nœud :"
-#~ msgid "Edit Connections.."
+#~ msgid "Edit Connections..."
#~ msgstr "Modifier les connexions..."
#~ msgid "Set Params"
@@ -9536,5 +9572,5 @@ msgstr "Taille de police invalide."
#~ "modifiez les options d'exportation par la suite. Vous pouvez également "
#~ "générer des atlas à l'exportation."
-#~ msgid "Merging.."
+#~ msgid "Merging..."
#~ msgstr "Fusion..."
diff --git a/editor/translations/he.po b/editor/translations/he.po
index b35c09bf55..0f1881211f 100644
--- a/editor/translations/he.po
+++ b/editor/translations/he.po
@@ -3,6 +3,7 @@
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
#
+# Daniel <lorddaniel09@gmail.com>, 2018.
# Ben Golan <golanben4@gmail.com>, 2017.
# Luc Stepniewski <lior@gradstein.info>, 2017.
# Yaron Shahrabani <sh.yaron@gmail.com>, 2018.
@@ -10,8 +11,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-02-22 12:37+0000\n"
-"Last-Translator: Yaron Shahrabani <sh.yaron@gmail.com>\n"
+"PO-Revision-Date: 2018-04-18 16:38+0000\n"
+"Last-Translator: Daniel <lorddaniel09@gmail.com>\n"
"Language-Team: Hebrew <https://hosted.weblate.org/projects/godot-engine/"
"godot/he/>\n"
"Language: he\n"
@@ -19,7 +20,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && "
"n % 10 == 0) ? 2 : 3));\n"
-"X-Generator: Weblate 2.20-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -31,19 +32,19 @@ msgstr "כל הבחירה"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr ""
+msgstr "שינוי זמן פריי×-מפתח ×נימציה"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr ""
+msgstr "שינוי ×ž×™×§×•× ×נימציה"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
-msgstr ""
+msgstr "שינוי ×ž×™×§×•× ×נימציה"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr ""
+msgstr "שינוי ערך פריי×-מפתח ×נימציה"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -497,7 +498,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -907,11 +908,11 @@ msgid "Move Audio Bus"
msgstr "הזזת ×פיק שמע"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "שמירת פריסת ×פיקי השמע בתור…"
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "×ž×™×§×•× ×œ×¤×¨×™×¡×” החדשה…"
#: editor/editor_audio_buses.cpp
@@ -1047,11 +1048,11 @@ msgid "Updating Scene"
msgstr "הסצנה מתעדכנת"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "×”×©×™× ×•×™×™× ×”×ž×§×•×ž×™×™× ×ž×וחסני×…"
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "הסצנה מתעדכנת…"
#: editor/editor_data.cpp
@@ -1120,7 +1121,7 @@ msgid "Show In File Manager"
msgstr "הצגה במנהל הקבצי×"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "תיקייה חדשה…"
#: editor/editor_file_dialog.cpp
@@ -1373,17 +1374,21 @@ msgstr "מחיקה"
msgid "Clear Output"
msgstr "מחיקת הפלט"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "שגי××” בשמירת המש×ב!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "שמירת המש×ב בתור…"
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "×× ×™ רו×ה…"
#: editor/editor_node.cpp
@@ -1592,11 +1597,11 @@ msgid "Open Base Scene"
msgstr "פתיחת סצנת בסיס"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "פתיחת סצנה מהירה…"
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "פתיחת סקריפט מהירה…"
#: editor/editor_node.cpp
@@ -1608,7 +1613,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "לשמור ×ת ×”×©×™× ×•×™×™× ×œÖ¾â€š%s’ לפני הסגירה?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "שמירת סצנה בש×…"
#: editor/editor_node.cpp
@@ -1660,7 +1665,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "×œ× × ×™×ª×Ÿ לבטל פעולה זו. לשחזר בכל ×–×ת?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1807,7 +1812,7 @@ msgid "Previous tab"
msgstr "הלשונית הקודמת"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1819,11 +1824,11 @@ msgid "New Scene"
msgstr "סצנה חדשה"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "סצנה חדשה בירושה…"
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "פתיחת סצנה…"
#: editor/editor_node.cpp
@@ -1843,15 +1848,15 @@ msgid "Open Recent"
msgstr "פתיחה מה×חרוני×"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "המרה ×ל…"
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2098,7 +2103,7 @@ msgid "Save the currently edited resource."
msgstr "שמירת המש×ב שנערך כרגע."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "שמירה בש×…"
#: editor/editor_node.cpp
@@ -2207,7 +2212,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr "תמונה ממוזערת…"
#: editor/editor_plugin_settings.cpp
@@ -2358,7 +2363,7 @@ msgid "(Current)"
msgstr "(נוכחי)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2374,12 +2379,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "תבנית ה־version.txt שגויה בתוך התבניות."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "×œ× × ×ž×¦× version.txt בתוך התבניות."
@@ -2440,7 +2439,7 @@ msgid "Error requesting url: "
msgstr "שגי××” בבקשת כתובת: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2457,7 +2456,7 @@ msgstr "×œ× × ×™×ª×Ÿ לפתור"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "מתבצעת התחברות…"
#: editor/export_template_manager.cpp
@@ -2470,7 +2469,7 @@ msgstr "מחובר"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "מוגשת בקשה…"
#: editor/export_template_manager.cpp
@@ -2603,11 +2602,11 @@ msgid "Collapse all"
msgstr "×œ×¦×ž×¦× ×”×›×•×œ"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "שינוי ש×…"
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "העברה ×ל…"
#: editor/filesystem_dock.cpp
@@ -2619,15 +2618,15 @@ msgid "Instance"
msgstr "עותק"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "עריכת תלויות…"
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "צפייה בבעלי×…"
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "שכפול…"
#: editor/filesystem_dock.cpp
@@ -2653,7 +2652,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"×”×§×‘×¦×™× × ×¡×¨×§×™×,\n"
"× × ×œ×”×ž×ª×™×Ÿâ€¦"
@@ -2721,7 +2720,7 @@ msgid "Import Scene"
msgstr "×™×™×‘×•× ×¡×¦× ×”"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "סצנה מיוב×ת…"
#: editor/import/resource_importer_scene.cpp
@@ -2733,7 +2732,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "מופעל סקריפט מות×× ×ישית…"
#: editor/import/resource_importer_scene.cpp
@@ -2749,7 +2748,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "שמירה…"
#: editor/import_dock.cpp
@@ -2769,7 +2768,7 @@ msgid "Import As:"
msgstr "×™×™×‘×•× ×‘×ª×•×¨:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr "ערכה מוגדרת…"
#: editor/import_dock.cpp
@@ -3183,7 +3182,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3191,7 +3190,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3259,7 +3258,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3326,7 +3325,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3513,8 +3512,9 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr ""
+msgstr "הגדרת הצמדה…"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3609,6 +3609,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3894,6 +3902,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3922,7 +3934,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4127,7 +4139,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4488,7 +4500,7 @@ msgid "Import Theme"
msgstr "×™×™×‘×•× ×¢×¨×›×ª עיצוב"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "שמירת ערכת עיצוב בש×…"
#: editor/plugins/script_editor_plugin.cpp
@@ -4585,7 +4597,7 @@ msgstr "החלפת תצוגת חלונית סקריפטי×"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "×יתור…"
#: editor/plugins/script_editor_plugin.cpp
@@ -4664,7 +4676,7 @@ msgstr "שמירה מחדש"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Debugger"
-msgstr "מנפה שגי×ות"
+msgstr "ניפוי שגי×ות"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
@@ -4793,15 +4805,15 @@ msgid "Find Previous"
msgstr "×יתור הקוד×"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "החלפה…"
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr "מעבר לפונקציה…"
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "מעבר לשורה…"
#: editor/plugins/script_text_editor.cpp
@@ -5255,11 +5267,7 @@ msgid "Transform"
msgstr "התמרה"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "הגדרת הצמדה…"
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5397,7 +5405,7 @@ msgstr ""
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animations"
-msgstr "הנפשות"
+msgstr "×נימציות"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Speed (FPS):"
@@ -5512,7 +5520,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5560,6 +5568,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5572,7 +5588,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5760,7 +5776,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5850,6 +5866,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "×©× ×©×’×•×™."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -5969,6 +5990,8 @@ msgid ""
"Language changed.\n"
"The UI will update next time the editor or project manager starts."
msgstr ""
+"השפה הוחלפה.\n"
+"מנשק המשתמש יתעדכן ×‘×¤×¢× ×”×‘××” שהעורך ×ו מנהל ×”×ž×™×–×ž×™× ×ž×ª×—×™×œ."
#: editor/project_manager.cpp
msgid ""
@@ -5978,11 +6001,11 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Project Manager"
-msgstr ""
+msgstr "מנהל המיזמי×"
#: editor/project_manager.cpp
msgid "Project List"
-msgstr ""
+msgstr "רשימת המיזמי×"
#: editor/project_manager.cpp
msgid "Scan"
@@ -5990,27 +6013,27 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Select a Folder to Scan"
-msgstr ""
+msgstr "× × ×œ×‘×—×•×¨ תיקייה לסריקה"
#: editor/project_manager.cpp
msgid "New Project"
-msgstr ""
+msgstr "×ž×™×–× ×—×“×©"
#: editor/project_manager.cpp
msgid "Templates"
-msgstr ""
+msgstr "תבניות"
#: editor/project_manager.cpp
msgid "Exit"
-msgstr ""
+msgstr "יצי××”"
#: editor/project_manager.cpp
msgid "Restart Now"
-msgstr ""
+msgstr "להפעיל מחדש כעת"
#: editor/project_manager.cpp
msgid "Can't run project"
-msgstr ""
+msgstr "×œ× × ×™×ª×Ÿ להריץ מיז×"
#: editor/project_manager.cpp
msgid ""
@@ -6020,7 +6043,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Key "
-msgstr ""
+msgstr "מקש "
#: editor/project_settings_editor.cpp
msgid "Joy Button"
@@ -6032,15 +6055,17 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Mouse Button"
-msgstr ""
+msgstr "כפתור עכבר"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
-msgstr ""
+msgstr "הפעולה ‚%s’ כבר קיימת!"
#: editor/project_settings_editor.cpp
msgid "Rename Input Action Event"
@@ -6063,48 +6088,48 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr ""
+msgid "Press a Key..."
+msgstr "× × ×œ×œ×—×•×¥ על מקש…"
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
-msgstr ""
+msgstr "מפתח כפתורי עכבר:"
#: editor/project_settings_editor.cpp
msgid "Left Button"
-msgstr ""
+msgstr "כפתור שמ×לי"
#: editor/project_settings_editor.cpp
msgid "Right Button"
-msgstr ""
+msgstr "כפתור ימני"
#: editor/project_settings_editor.cpp
msgid "Middle Button"
-msgstr ""
+msgstr "כפתור ×מצעי"
#: editor/project_settings_editor.cpp
msgid "Wheel Up Button"
-msgstr ""
+msgstr "כפתור גלגלת למעלה"
#: editor/project_settings_editor.cpp
msgid "Wheel Down Button"
-msgstr ""
+msgstr "כפתור גלגלת למטה"
#: editor/project_settings_editor.cpp
msgid "Button 6"
-msgstr ""
+msgstr "כפתור 6"
#: editor/project_settings_editor.cpp
msgid "Button 7"
-msgstr ""
+msgstr "כפתור 7"
#: editor/project_settings_editor.cpp
msgid "Button 8"
-msgstr ""
+msgstr "כפתור 8"
#: editor/project_settings_editor.cpp
msgid "Button 9"
-msgstr ""
+msgstr "כפתור 9"
#: editor/project_settings_editor.cpp
msgid "Joypad Axis Index:"
@@ -6128,47 +6153,47 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Add Event"
-msgstr ""
+msgstr "הוספת ×ירוע"
#: editor/project_settings_editor.cpp
msgid "Device"
-msgstr ""
+msgstr "התקן"
#: editor/project_settings_editor.cpp
msgid "Button"
-msgstr ""
+msgstr "כפתור"
#: editor/project_settings_editor.cpp
msgid "Left Button."
-msgstr ""
+msgstr "כפתור שמ×לי."
#: editor/project_settings_editor.cpp
msgid "Right Button."
-msgstr ""
+msgstr "כפתור ימני."
#: editor/project_settings_editor.cpp
msgid "Middle Button."
-msgstr ""
+msgstr "כפתור ×מצעי."
#: editor/project_settings_editor.cpp
msgid "Wheel Up."
-msgstr ""
+msgstr "גלגלת למעלה."
#: editor/project_settings_editor.cpp
msgid "Wheel Down."
-msgstr ""
+msgstr "גלגלת למטה."
#: editor/project_settings_editor.cpp
msgid "Add Global Property"
-msgstr ""
+msgstr "הוספת מ×פיין גלובלי"
#: editor/project_settings_editor.cpp
msgid "Select a setting item first!"
-msgstr ""
+msgstr "יש לבחור פריט הגדרה ×§×•×“× ×›×œ!"
#: editor/project_settings_editor.cpp
msgid "No property '%s' exists."
-msgstr ""
+msgstr "×œ× ×§×™×™× ×ž×פיין ‚%s’."
#: editor/project_settings_editor.cpp
msgid "Setting '%s' is internal, and it can't be deleted."
@@ -6176,11 +6201,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Delete Item"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
+msgstr "מחיקת פריט"
#: editor/project_settings_editor.cpp
msgid "Already existing"
@@ -6251,7 +6272,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6347,11 +6368,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6522,7 +6543,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7106,14 +7127,12 @@ msgid "Object can't provide a length."
msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "הלשונית הב××”"
+msgstr "המישור הב×"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "הלשונית הקודמת"
+msgstr "המישור הקוד×"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
@@ -7223,6 +7242,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr "בחירת מרחק:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "הפתרון נוצר…"
@@ -7271,6 +7294,10 @@ msgstr ""
msgid "Warnings"
msgstr "×זהרות"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7667,7 +7694,7 @@ msgstr ""
#: scene/2d/collision_polygon_2d.cpp
msgid "An empty CollisionPolygon2D has no effect on collision."
-msgstr ""
+msgstr "ל־CollisionPolygon2D ריק ×ין השפעה על התנגשות."
#: scene/2d/collision_shape_2d.cpp
msgid ""
@@ -7776,7 +7803,7 @@ msgstr ""
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(זמן שנותר: %d:%02d שנ׳)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -7856,10 +7883,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -7874,11 +7911,11 @@ msgstr ""
#: scene/gui/color_picker.cpp
msgid "Raw Mode"
-msgstr ""
+msgstr "מצב גולמי"
#: scene/gui/color_picker.cpp
msgid "Add current color as a preset"
-msgstr ""
+msgstr "הוספת הצבע הנוכחי כערכה"
#: scene/gui/dialogs.cpp
msgid "Alert!"
@@ -7886,11 +7923,11 @@ msgstr ""
#: scene/gui/dialogs.cpp
msgid "Please Confirm..."
-msgstr ""
+msgstr "× × ×œ×מת…"
#: scene/gui/file_dialog.cpp
msgid "Select this Folder"
-msgstr ""
+msgstr "בחירת התיקייה"
#: scene/gui/popup.cpp
msgid ""
@@ -7908,7 +7945,7 @@ msgstr ""
#: scene/gui/tree.cpp
msgid "(Other)"
-msgstr ""
+msgstr "(×חר)"
#: scene/main/scene_tree.cpp
msgid ""
@@ -7940,12 +7977,16 @@ msgstr "שגי××” בטעינת הגופן."
msgid "Invalid font size."
msgstr "גודל הגופן שגוי."
-#~ msgid "Can't write file."
-#~ msgstr "×œ× × ×™×ª×Ÿ לכתוב קובץ."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "הלשונית הקודמת"
#~ msgid "Next"
#~ msgstr "הב×"
+#~ msgid "Can't write file."
+#~ msgstr "×œ× × ×™×ª×Ÿ לכתוב קובץ."
+
#~ msgid "Not found!"
#~ msgstr "×œ× × ×ž×¦×!"
diff --git a/editor/translations/hi.po b/editor/translations/hi.po
index 76395eea30..3340f13471 100644
--- a/editor/translations/hi.po
+++ b/editor/translations/hi.po
@@ -511,8 +511,8 @@ msgstr "जà¥à¤¡à¤¿à¤¯à¥‡ '%s' to '%s'"
#: editor/connections_dialog.cpp
#, fuzzy
-msgid "Connect.."
-msgstr "जà¥à¤¡à¤¿à¤¯à¥‡.."
+msgid "Connect..."
+msgstr "जà¥à¤¡à¤¿à¤¯à¥‡..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -946,11 +946,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1086,11 +1086,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1159,7 +1159,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1412,17 +1412,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1627,11 +1631,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1643,7 +1647,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1695,7 +1699,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1840,7 +1844,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1852,11 +1856,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1876,15 +1880,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2129,7 +2133,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2238,7 +2242,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2389,7 +2393,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2405,12 +2409,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2471,7 +2469,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2488,7 +2486,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2502,7 +2500,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2639,11 +2637,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2655,16 +2653,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "पà¥à¤°à¤¤à¤¿à¤²à¤¿à¤ªà¤¿"
#: editor/filesystem_dock.cpp
@@ -2690,7 +2688,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2756,7 +2754,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2768,7 +2766,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2784,7 +2782,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2804,7 +2802,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3219,7 +3217,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3227,7 +3225,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3295,7 +3293,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3362,7 +3360,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3549,6 +3547,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3645,6 +3644,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3930,6 +3937,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3958,7 +3969,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4163,7 +4174,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4525,7 +4536,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4622,7 +4633,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4828,15 +4839,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5287,11 +5298,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5544,7 +5551,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5592,6 +5599,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5604,7 +5619,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5792,7 +5807,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5882,6 +5897,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "गलत फॉणà¥à¤Ÿ का आकार |"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6069,7 +6089,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6097,7 +6119,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6213,10 +6235,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6285,7 +6303,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6381,11 +6399,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6556,7 +6574,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7256,6 +7274,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7305,6 +7327,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7889,10 +7915,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/hu.po b/editor/translations/hu.po
index 2e498f29a7..b04dd073df 100644
--- a/editor/translations/hu.po
+++ b/editor/translations/hu.po
@@ -2,23 +2,22 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
+# Ãrpád Horváth <horvatha4@googlemail.com>, 2018.
# Nagy Lajos <neutron9707@gmail.com>, 2017.
-# Sandor Domokos <sandor.domokos@gmail.com>, 2017.
+# Sandor Domokos <sandor.domokos@gmail.com>, 2017-2018.
# Varga Dániel <danikah.danikah@gmail.com>, 2016-2018.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-02-05 23:37+0000\n"
-"Last-Translator: Varga Dániel <danikah.danikah@gmail.com>\n"
+"PO-Revision-Date: 2018-06-17 07:39+0000\n"
+"Last-Translator: Ãrpád Horváth <horvatha4@googlemail.com>\n"
"Language-Team: Hungarian <https://hosted.weblate.org/projects/godot-engine/"
"godot/hu/>\n"
"Language: hu\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 2.19-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -26,47 +25,47 @@ msgstr "Tiltva"
#: editor/animation_editor.cpp
msgid "All Selection"
-msgstr "Minden Kiválasztás"
+msgstr "Minden kiválasztás"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr "Animáció Kulcsképkocka Idő Változtatása"
+msgstr "Animáció kulcsképkocka idő változtatás"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Animáció Ãtmenet Váltás"
+msgstr "Animáció átmenet változtatása"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
-msgstr "Animáció Transzformáció Váltás"
+msgstr "Animáció transzformáció változtatás"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr "Animáció Kulcsképkocka Érték"
+msgstr "Animáció kulcsképkocka érték változtatás"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
-msgstr "Animáció Hívás Váltás"
+msgstr "Animáció hívás változtatás"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
-msgstr "Animáció Nyomvonal Hozzáadása"
+msgstr "Animáció nyomvonal hozzáadás"
#: editor/animation_editor.cpp
msgid "Anim Duplicate Keys"
-msgstr "Animáció Kulcs Megkettőzése"
+msgstr "Animáció kulcsok megkettőzése"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
-msgstr "Animáció Nyomvonal Felfelé Mozgatása"
+msgstr "Animáció nyomvonal felfelé mozgatás"
#: editor/animation_editor.cpp
msgid "Move Anim Track Down"
-msgstr "Animáció Nyomvonal Lefelé Mozgatása"
+msgstr "Animáció nyomvonal lefelé mozgatás"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr "Animáció Nyomvonal Eltávolítása"
+msgstr "Animáció nyomvonal eltávolítás"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
@@ -74,44 +73,44 @@ msgstr "Ãtmenet beállítása erre:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr "Animáció Nyomvonal Ãtnevezése"
+msgstr "Animáció nyomvonal átnevezés"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr "Animáció Nyomvonal Interpoláció Változtatása"
+msgstr "Animáció nyomvonal interpoláció változtatás"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr "Animáció Nyomvonal Érték Mód Változtatása"
+msgstr "Animáció nyomvonal érték mód változtatás"
#: editor/animation_editor.cpp
msgid "Anim Track Change Wrap Mode"
-msgstr "Animáció Nyomvonal Takarási Mód Változtatása"
+msgstr "Animáció nyomvonal takarási mód változtatás"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
-msgstr "Node Görbe Szerkesztése"
+msgstr "Node görbe szerkesztés"
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
-msgstr "Kiválasztás Görbe Szerkesztése"
+msgstr "Kiválasztás görbe szerkesztés"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
-msgstr "Animáció Kulcs Törlése"
+msgstr "Animáció kulcs törlés"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Duplicate Selection"
-msgstr "Kiválasztás Megkettőzése"
+msgstr "Kiválasztás megkettőzés"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
-msgstr "Ãthelyezettek MegkettÅ‘zése"
+msgstr "Ãthelyezettek megkettÅ‘zés"
#: editor/animation_editor.cpp
msgid "Remove Selection"
-msgstr "Kiválasztás Eltávolítása"
+msgstr "Kiválasztás eltávolítás"
#: editor/animation_editor.cpp
msgid "Continuous"
@@ -127,27 +126,27 @@ msgstr "Érzékelő"
#: editor/animation_editor.cpp
msgid "Anim Add Key"
-msgstr "Animáció Kulcs Hozzáadása"
+msgstr "Animáció kulcs hozzáadás"
#: editor/animation_editor.cpp
msgid "Anim Move Keys"
-msgstr "Animáció Kulcs Mozgatása"
+msgstr "Animáció kulcs mozgatás"
#: editor/animation_editor.cpp
msgid "Scale Selection"
-msgstr "Kiválasztás Ãtméretezése"
+msgstr "Kiválasztás átméretezés"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
-msgstr "Ãtméretezés A Kurzortól"
+msgstr "Ãtméretezés a kurzortól"
#: editor/animation_editor.cpp
msgid "Goto Next Step"
-msgstr "Ugrás A következő lépésre"
+msgstr "Ugrás a következő lépésre"
#: editor/animation_editor.cpp
msgid "Goto Prev Step"
-msgstr "Ugrás Az Előző Lépésre"
+msgstr "Ugrás az előző lépésre"
#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
#: editor/property_editor.cpp
@@ -180,11 +179,11 @@ msgstr "Ãtmenetek"
#: editor/animation_editor.cpp
msgid "Optimize Animation"
-msgstr "Animáció Optimalizálása"
+msgstr "Animáció optimalizálás"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation"
-msgstr "Animáció Megtisztítása"
+msgstr "Animáció megtisztítás"
#: editor/animation_editor.cpp
msgid "Create NEW track for %s and insert key?"
@@ -204,39 +203,39 @@ msgstr "Létrehozás"
#: editor/animation_editor.cpp
msgid "Anim Create & Insert"
-msgstr "Animáció Létrehozása És Beillesztése"
+msgstr "Animáció létrehozás és beillesztés"
#: editor/animation_editor.cpp
msgid "Anim Insert Track & Key"
-msgstr "Animáció Nyomvonal És Kulcs Beillesztése"
+msgstr "Animáció nyomvonal és kulcs beillesztés"
#: editor/animation_editor.cpp
msgid "Anim Insert Key"
-msgstr "Animáció Kulcs Beillesztése"
+msgstr "Animáció kulcs beillesztés"
#: editor/animation_editor.cpp
msgid "Change Anim Len"
-msgstr "Animáció Hossz Változtatása"
+msgstr "Animáció hossz változtatás"
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
-msgstr "Animáció Loop Megváltoztatása"
+msgstr "Animáció hurok változtatás"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
-msgstr "Animáció Típusos Érték Kulcs Létrehozása"
+msgstr "Animáció típusos érték kulcs létrehozás"
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr "Animáció Beilleszt"
+msgstr "Animáció beillesztés"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
-msgstr "Animáció Kulcsok Nyújtása"
+msgstr "Animáció kulcsok nyújtás"
#: editor/animation_editor.cpp
msgid "Anim Add Call Track"
-msgstr "Animáció Hívási Nyomvonal Hozzáadása"
+msgstr "Animációhoz hívási nyomvonal hozzáadása"
#: editor/animation_editor.cpp
msgid "Animation zoom."
@@ -326,7 +325,7 @@ msgstr "Méretezési arány:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr "Melyik Node-ban Hívjon Funkciókat?"
+msgstr "Melyik Node-ban hívjon funkciókat?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
@@ -426,7 +425,7 @@ msgid ""
"Node."
msgstr ""
"Nem található a cél metódus! Nevezzen meg egy érvényes metódust, vagy "
-"csatoljon egy scriptet a cél Node-hoz."
+"csatoljon egy szkriptet a cél Node-hoz."
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
@@ -500,7 +499,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "'%s' Lecsatlakoztatása '%s'-ról"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Kapcsolás..."
#: editor/connections_dialog.cpp
@@ -566,8 +565,8 @@ msgid ""
"Scene '%s' is currently being edited.\n"
"Changes will not take effect unless reloaded."
msgstr ""
-"'%s' Jelenet éppen szerkesztés alatt ál.\n"
-"A változások nem lépnek érvénybe, ha csak újra nem tölti a jelenetet."
+"'%s' Scene éppen szerkesztés alatt áll.\n"
+"A változások újratöltés után lépnek érvénybe."
#: editor/dependency_editor.cpp
msgid ""
@@ -920,12 +919,12 @@ msgid "Move Audio Bus"
msgstr "Hangbusz Ãthelyezése"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Hangbusz Elrendezés Mentése Másként.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Hangbusz Elrendezés Mentése Másként..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Új Elrendezés Helye.."
+msgid "Location for New Layout..."
+msgstr "Új Elrendezés Helye..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1045,7 +1044,7 @@ msgstr "Útvonal:"
#: editor/editor_autoload_settings.cpp
msgid "Node Name:"
-msgstr "Node Neve:"
+msgstr "Node neve:"
#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
#: editor/project_manager.cpp editor/settings_config_dialog.cpp
@@ -1058,15 +1057,15 @@ msgstr "Egyke"
#: editor/editor_data.cpp
msgid "Updating Scene"
-msgstr "Jelenet Frissítése"
+msgstr "Scene Frissítése"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Helyi módosítások eltárolása.."
+msgid "Storing local changes..."
+msgstr "Helyi módosítások eltárolása..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Jelenet frissítése.."
+msgid "Updating scene..."
+msgstr "Scene frissítése..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1134,8 +1133,8 @@ msgid "Show In File Manager"
msgstr "Mutat Fájlkezelőben"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Új Mappa.."
+msgid "New Folder..."
+msgstr "Új Mappa..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1394,18 +1393,22 @@ msgstr "Töröl"
msgid "Clear Output"
msgstr "Kimenet Törlése"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Projekt export nem sikerült, hibakód %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Hiba történt az erőforrás mentésekor!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Erőforrás Mentése Másként.."
+msgid "Save Resource As..."
+msgstr "Erőforrás Mentése Másként..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Értem.."
+msgid "I see..."
+msgstr "Értem..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1441,7 +1444,7 @@ msgstr "Hiba történt '%s' betöltése közben."
#: editor/editor_node.cpp
msgid "Saving Scene"
-msgstr "Jelenet Mentése"
+msgstr "Scene mentése"
#: editor/editor_node.cpp
msgid "Analyzing"
@@ -1460,8 +1463,8 @@ msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
msgstr ""
-"Nem sikerült a jelenet mentése. Valószínű, hogy a függőségei (példányok vagy "
-"öröklések) nem voltak kielégíthetők."
+"Nem sikerült a Scene mentése. Valószínű, hogy a függőségei (példányok vagy "
+"öröklések) nem voltak megfelelőek."
#: editor/editor_node.cpp
msgid "Failed to load resource."
@@ -1516,10 +1519,9 @@ msgid ""
"This resource belongs to a scene that was instanced or inherited.\n"
"Changes to it will not be kept when saving the current scene."
msgstr ""
-"Ez az erőforrás egy olyan jelenethez tartozik, amit példányosítottak, vagy "
-"amit örökölt a jelenet.\n"
-"A rajta végzett módosítások nem lesznek megtartva a jelenlegi jelenet "
-"elmentésekor."
+"Ez az erőforrás egy olyan Scene-hez tartozik amit példányosítottak vagy "
+"örökölt.\n"
+"A módosítások nem lesznek megtartva a jelenlegi Scene mentésekor."
#: editor/editor_node.cpp
msgid ""
@@ -1591,7 +1593,7 @@ msgstr "Megnyitás Súgóban"
#: editor/editor_node.cpp
msgid "There is no defined scene to run."
-msgstr "Nincs meghatározva jelenet a futtatáshoz."
+msgstr "Nincs meghatározva Scene a futtatáshoz."
#: editor/editor_node.cpp
msgid ""
@@ -1609,8 +1611,7 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"A kiválasztott '%s' jelenet nem létezik, kiválaszt most egy érvényes "
-"jelenetet?\n"
+"A kiválasztott '%s' Scene nem létezik, kiválaszt most egy érvényeset?\n"
"Ezt megváltoztathatja később a \"Projekt Beállításokban\" az \"Alkalmazás\" "
"kategóriában."
@@ -1620,15 +1621,15 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"A kiválasztott '%s' jelenet nem egy jelenetfájl, kiválaszt most egy érvényes "
-"jelenetet?\n"
+"A kiválasztott '%s' Scene nem egy Scene fájl, kiválaszt most egy "
+"érvényeset?\n"
"Ezt megváltoztathatja később a \"Projekt Beállításokban\" az \"Alkalmazás\" "
"kategóriában."
#: editor/editor_node.cpp
msgid "Current scene was never saved, please save it prior to running."
msgstr ""
-"A jelenlegi jelenet soha nem volt még mentve, mentse el a futtatás előtt."
+"A jelenlegi Scene soha nem volt még mentve, mentse el a futtatás előtt."
#: editor/editor_node.cpp
msgid "Could not start subprocess!"
@@ -1636,19 +1637,19 @@ msgstr "Az alprocesszt nem lehetett elindítani!"
#: editor/editor_node.cpp
msgid "Open Scene"
-msgstr "Jelenet Megnyitása"
+msgstr "Scene megnyitás"
#: editor/editor_node.cpp
msgid "Open Base Scene"
-msgstr "Alap Jelenet Megnyitása"
+msgstr "Alap Scene megnyitás"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Jelenet Gyors Megnyitása.."
+msgid "Quick Open Scene..."
+msgstr "Jelenet gyors megnyitása..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Script Gyors Megnyitása.."
+msgid "Quick Open Script..."
+msgstr "Szkript gyors megnyitás..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1659,8 +1660,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Bezárás előtt menti a '%s'-n végzett módosításokat?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Jelenet Mentése Másként.."
+msgid "Save Scene As..."
+msgstr "Scene mentés másként..."
#: editor/editor_node.cpp
msgid "No"
@@ -1672,27 +1673,27 @@ msgstr "Igen"
#: editor/editor_node.cpp
msgid "This scene has never been saved. Save before running?"
-msgstr "Ez a jelenet soha nem volt mentve. Menti futtatás előtt?"
+msgstr "Ez a Scene még soha nem volt mentve. Menti futtatás előtt?"
#: editor/editor_node.cpp editor/scene_tree_dock.cpp
msgid "This operation can't be done without a scene."
-msgstr "Ezt a műveletet nem lehet végrehajtani jelenet nélkül."
+msgstr "Ezt a műveletet nem lehet végrehajtani egy Scene nélkül."
#: editor/editor_node.cpp
msgid "Export Mesh Library"
-msgstr "Mesh Könyvtár Exportálása"
+msgstr "Mesh könyvtár exportálás"
#: editor/editor_node.cpp
msgid "This operation can't be done without a root node."
-msgstr "Ezt a műveletet nem lehet végrehajtani gyökér node nélkül."
+msgstr "Ezt a műveletet nem lehet végrehajtani gyökér Node nélkül."
#: editor/editor_node.cpp
msgid "Export Tile Set"
-msgstr "Tile Set Exportálása"
+msgstr "Tile Set exportálás"
#: editor/editor_node.cpp
msgid "This operation can't be done without a selected node."
-msgstr "Ezt a műveletet nem lehet végrehajtani egy kiválaszott node nélkül."
+msgstr "Ezt a műveletet nem lehet végrehajtani egy kiválaszott Node nélkül."
#: editor/editor_node.cpp
msgid "Current scene not saved. Open anyway?"
@@ -1711,8 +1712,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Ez a művelet nem vonható vissza. Visszaállítja mindenképp?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Jelenet Gyors Futtatása.."
+msgid "Quick Run Scene..."
+msgstr "Scene gyors futtatás..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1732,13 +1733,12 @@ msgstr "Mentés és Kilépés"
#: editor/editor_node.cpp
msgid "Save changes to the following scene(s) before quitting?"
-msgstr ""
-"Elmenti a következő jelenet(ek)en végzett változtatásokat kilépés előtt?"
+msgstr "Elmenti a következő Scene(ek)en végzett változtatásokat kilépés előtt?"
#: editor/editor_node.cpp
msgid "Save changes the following scene(s) before opening Project Manager?"
msgstr ""
-"Elmenti a következő jelenet(ek)en végzett változtatásokat a Projektkezelő "
+"Elmenti a következő Scene(ek)en végzett változtatásokat a Projektkezelő "
"megnyitása előtt?"
#: editor/editor_node.cpp
@@ -1762,34 +1762,33 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
msgstr ""
-"Nem található script mező az addon pluginnak a következő helyen: 'res://"
+"Nem található szkript mező az addon pluginnak a következő helyen: 'res://"
"addons/%s'."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s'."
-msgstr "Nem sikerült az addon script betöltése a következő útvonalról: '%s'."
+msgstr "Nem sikerült az addon szkript betöltése a következő útvonalról: '%s'."
#: editor/editor_node.cpp
msgid ""
"Unable to load addon script from path: '%s' Base type is not EditorPlugin."
msgstr ""
-"Nem sikerült az addon script betöltése a következő útvonalról: '%s' Az "
+"Nem sikerült az addon szkript betöltése a következő útvonalról: '%s' Az "
"alaptípus nem EditorPlugin."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
msgstr ""
-"Nem sikerült az addon script betöltése a következő útvonalról: '%s' A script "
-"nem eszközmódban van."
+"Nem sikerült az addon szkript betöltése a következő útvonalról: '%s' A "
+"szkript nem eszközmódban van."
#: editor/editor_node.cpp
msgid ""
"Scene '%s' was automatically imported, so it can't be modified.\n"
"To make changes to it, a new inherited scene can be created."
msgstr ""
-"A(z) '%s' jelenet automatikusan be lett importálva, ezért nem módosítható.\n"
-"Ahhoz, hogy változtatásokat végezhessen rajta, egy új, azt öröklő jelenetet "
-"hozhat létre."
+"A(z) '%s' Scene automatikusan be lett importálva, ezért nem módosítható.\n"
+"Változtatások végzéséhez egy új öröklött Scene-t hozhat létre."
#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -1801,9 +1800,9 @@ msgid ""
"Error loading scene, it must be inside the project path. Use 'Import' to "
"open the scene, then save it inside the project path."
msgstr ""
-"Hiba történt a jelenet betöltésekor, benne kell, hogy legyen a projekt "
-"útvonalában. Használja az 'import' lehetőséget a jelenet megnyitására, majd "
-"mentse el a projekt útvonalán belülre."
+"Hiba történt a Scene betöltésekor, benne kell lennnie a projekt útvonalában. "
+"Használja az 'import' lehetőséget a Scene megnyitására, majd mentse el a "
+"projekt útvonalán belülre."
#: editor/editor_node.cpp
msgid "Scene '%s' has broken dependencies:"
@@ -1828,7 +1827,7 @@ msgstr "Alapértelmezett"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr "Jelenet Fül Váltása"
+msgstr "Scene fül váltás"
#: editor/editor_node.cpp
msgid "%d more files or folders"
@@ -1875,52 +1874,52 @@ msgid "Previous tab"
msgstr "Előző fül"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Fájlok Szűrése.."
+msgid "Filter Files..."
+msgstr "Fájlok Szűrése..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
-msgstr "Műveletek a jelenet fájlokkal."
+msgstr "Műveletek Scene fájlokkal."
#: editor/editor_node.cpp
msgid "New Scene"
-msgstr "Új Jelenet"
+msgstr "Új Scene"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Új Örökölt Jelenet.."
+msgid "New Inherited Scene..."
+msgstr "Új örökölt Jelenet..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Jelenet Megnyitása.."
+msgid "Open Scene..."
+msgstr "Jelenet megnyitása..."
#: editor/editor_node.cpp
msgid "Save Scene"
-msgstr "Jelenet Mentése"
+msgstr "Scene mentés"
#: editor/editor_node.cpp
msgid "Save all Scenes"
-msgstr "Minden Jelenet Mentése"
+msgstr "Minden Scene mentés"
#: editor/editor_node.cpp
msgid "Close Scene"
-msgstr "Jelenet Bezárása"
+msgstr "Scene bezárás"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Open Recent"
msgstr "Legutóbbi Megnyitása"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Ãtkonvertálás.."
+msgid "Convert To..."
+msgstr "Ãtkonvertálás..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary-ra.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary-ra..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet-re.."
+msgid "TileSet..."
+msgstr "TileSet-re..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -1934,11 +1933,11 @@ msgstr "Mégis"
#: editor/editor_node.cpp
msgid "Revert Scene"
-msgstr "Jelenet Visszaállítása"
+msgstr "Scene visszaállítás"
#: editor/editor_node.cpp
msgid "Miscellaneous project or scene-wide tools."
-msgstr "Egyéb projekt- vagy jelenet-szintű eszközök."
+msgstr "Egyéb projekt- vagy Scene-szintű eszközök."
#: editor/editor_node.cpp
msgid "Project"
@@ -1950,7 +1949,7 @@ msgstr "Projekt Beállítások"
#: editor/editor_node.cpp
msgid "Run Script"
-msgstr "Script Futtatása"
+msgstr "Szkript Futtatása"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export"
@@ -1982,7 +1981,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr "Kis Telepítés Hálózati FR-rel"
+msgstr "Kis Telepítés Hálózati FS-sel"
#: editor/editor_node.cpp
msgid ""
@@ -2009,7 +2008,7 @@ msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
-"Az ütközési alakzatok és a fénysugárkövető node-ok (mind 2D-hez és 3D-hez) "
+"Az ütközési alakzatok és a fénysugárkövető Node-ok (mind 2D-hez és 3D-hez) "
"láthatóak lesznek a játék futásakor, ha ez az opció be van kapcsolva."
#: editor/editor_node.cpp
@@ -2026,7 +2025,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr "Jelenet Változtatások Szinkronizálása"
+msgstr "Jelenet változtatások szinkronizálása"
#: editor/editor_node.cpp
msgid ""
@@ -2042,7 +2041,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Script Changes"
-msgstr "Script Változtatások Szinkronizálása"
+msgstr "Szkript Változtatások Szinkronizálása"
#: editor/editor_node.cpp
msgid ""
@@ -2051,7 +2050,7 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
-"Ha ez a beállítás be van kapcsolva, bármilyen script, amit elment, újra "
+"Ha ez a beállítás be van kapcsolva, bármilyen szkript, amit elment, újra "
"betöltődik a futó játékba.\n"
"Ha egy távoli eszközön használja, sokkal hatékonyabb a hálózati "
"fájlrendszerrel együtt."
@@ -2125,7 +2124,7 @@ msgstr "Szünetelteti a jelenetet"
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr "Jelenet Szüneteltetése"
+msgstr "Scene szüneteltetés"
#: editor/editor_node.cpp
msgid "Stop the scene."
@@ -2137,19 +2136,19 @@ msgstr "Leállítás"
#: editor/editor_node.cpp
msgid "Play the edited scene."
-msgstr "Szerkesztett jelenet futtatása."
+msgstr "Szerkesztett Scene futtatása."
#: editor/editor_node.cpp
msgid "Play Scene"
-msgstr "Jelenet Futtatása"
+msgstr "Scene futtatás"
#: editor/editor_node.cpp
msgid "Play custom scene"
-msgstr "Tetszőleges jelenet futtatása"
+msgstr "Tetszőleges Scene futtatás"
#: editor/editor_node.cpp
msgid "Play Custom Scene"
-msgstr "Tetszőleges Jelenet Futtatása"
+msgstr "Tetszőleges Scene futtatás"
#: editor/editor_node.cpp
msgid "Spins when the editor window repaints!"
@@ -2184,8 +2183,8 @@ msgid "Save the currently edited resource."
msgstr "A jelenleg szerkesztett erőforrás elmentése."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Mentés Másként.."
+msgid "Save As..."
+msgstr "Mentés Másként..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2250,7 +2249,7 @@ msgstr "Jelszó:"
#: editor/editor_node.cpp
msgid "Open & Run a Script"
-msgstr "Megnyit és Scriptet Futtat"
+msgstr "Szkriptet Megnyit és Futtat"
#: editor/editor_node.cpp
msgid "New Inherited"
@@ -2274,7 +2273,7 @@ msgstr "3D Szerkesztő Megnyitása"
#: editor/editor_node.cpp
msgid "Open Script Editor"
-msgstr "Script Szerkesztő Megnyitása"
+msgstr "Szkript Szerkesztő Megnyitása"
#: editor/editor_node.cpp editor/project_manager.cpp
msgid "Open Asset Library"
@@ -2293,8 +2292,8 @@ msgid "Creating Mesh Previews"
msgstr "Háló Előnézetek Létrehozása"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Indexkép.."
+msgid "Thumbnail..."
+msgstr "Indexkép..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2387,11 +2386,11 @@ msgstr "Ãrja a logikát a _run() metódusba."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
-msgstr "Már létezik szerkesztett jelenet."
+msgstr "Már létezik a szerkesztett Scene."
#: editor/editor_run_script.cpp
msgid "Couldn't instance script:"
-msgstr "Nem sikerült a script példányosítása:"
+msgstr "Nem sikerült a szkript példányosítása:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
@@ -2399,7 +2398,7 @@ msgstr "Nem felejtette el a 'tool' kulcsszót?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
-msgstr "Nem sikerült a script futtatása:"
+msgstr "Nem sikerült a szkript futtatása:"
#: editor/editor_run_script.cpp
msgid "Did you forget the '_run' method?"
@@ -2411,11 +2410,11 @@ msgstr "Alapértelmezett (Ugyanaz, Mint a Szerkesztőnek)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
-msgstr "Válassza Ki Az Importálandó Node-okat"
+msgstr "Válassza ki az importálandó Node-okat"
#: editor/editor_sub_scene.cpp
msgid "Scene Path:"
-msgstr "Jelenet Elérési Útja:"
+msgstr "Scene elérési Út:"
#: editor/editor_sub_scene.cpp
msgid "Import From Node:"
@@ -2446,8 +2445,8 @@ msgid "(Current)"
msgstr "(Jelenlegi)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Tükrök letöltése, kérjük várjon.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Tükrök letöltése, kérjük várjon..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2462,14 +2461,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Érvénytelen version.txt formátum a sablonokban."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Érvénytelen version.txt formátum a sablonokban. A revízió nem érvényes "
-"azonosító."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Nem található version.txt a sablonokban."
@@ -2532,8 +2523,8 @@ msgid "Error requesting url: "
msgstr "Hiba történt az url lekérdezésekor: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Csatlakozás Tükörhöz.."
+msgid "Connecting to Mirror..."
+msgstr "Csatlakozás Tükörhöz..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2549,8 +2540,8 @@ msgstr "Nem Megoldható"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Csatlakozás.."
+msgid "Connecting..."
+msgstr "Csatlakozás..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2562,8 +2553,8 @@ msgstr "Csatlakozva"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Lekérdezés.."
+msgid "Requesting..."
+msgstr "Lekérdezés..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2698,32 +2689,32 @@ msgid "Collapse all"
msgstr "Összes összecsukása"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Ãtnevezés.."
+msgid "Rename..."
+msgstr "Ãtnevezés..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Ãthelyezés.."
+msgid "Move To..."
+msgstr "Ãthelyezés..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
-msgstr "Jelenet(ek) Megnyitása"
+msgstr "Scene(k) megnyitás"
#: editor/filesystem_dock.cpp
msgid "Instance"
msgstr "Példány"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Függőségek Szerkesztése.."
+msgid "Edit Dependencies..."
+msgstr "Függőségek Szerkesztése..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Tulajdonosok Megtekintése.."
+msgid "View Owners..."
+msgstr "Tulajdonosok Megtekintése..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Megkettőzés.."
+msgid "Duplicate..."
+msgstr "Megkettőzés..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2743,16 +2734,15 @@ msgstr "Mappa Kedvencnek jelölése / Kedvenc jelölés visszavonása"
#: editor/filesystem_dock.cpp
msgid "Instance the selected scene(s) as child of the selected node."
-msgstr ""
-"Kiválasztott jelenet(ek) példányosítása a kiválasztott Node gyermekeként."
+msgstr "Kiválasztott Scene(k) példányosítása a kiválasztott Node gyermekeként."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Fájlok Vizsgálata,\n"
-"Kérem Várjon.."
+"Kérem Várjon..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2814,11 +2804,11 @@ msgstr "Importálás Több Jelentként és Anyagokként"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import Scene"
-msgstr "Jelenet Importálása"
+msgstr "Scene importálás"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Jelenet Importálása.."
+msgid "Importing Scene..."
+msgstr "Jelenet importálása..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2829,25 +2819,25 @@ msgid "Generating for Mesh: "
msgstr "Létrehozás a Következő Hálóhoz: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Tetszőleges Script Futtatása.."
+msgid "Running Custom Script..."
+msgstr "Tetszőleges Szkript Futtatása..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
-msgstr "Nem sikerült az import utáni script betöltése:"
+msgstr "Nem sikerült az import utáni szkript betöltése:"
#: editor/import/resource_importer_scene.cpp
msgid "Invalid/broken script for post-import (check console):"
msgstr ""
-"Érvénytelen vagy sérült az importálás utáni script (ellenőrizze a konzolt):"
+"Érvénytelen vagy sérült az importálás utáni szkript (ellenőrizze a konzolt):"
#: editor/import/resource_importer_scene.cpp
msgid "Error running post-import script:"
-msgstr "Hiba történt az importálás utána script futtatásakor:"
+msgstr "Hiba történt az importálás utána szkript futtatásakor:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Mentés.."
+msgid "Saving..."
+msgstr "Mentés..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2866,8 +2856,8 @@ msgid "Import As:"
msgstr "Importálás Mint:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Beépített Beállítások.."
+msgid "Preset..."
+msgstr "Beépített Beállítások..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3250,7 +3240,7 @@ msgstr "Az animációs fa érvénytelen."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation Node"
-msgstr "Animációs Node"
+msgstr "Animáció Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "OneShot Node"
@@ -3274,7 +3264,7 @@ msgstr "Keverés4 Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeScale Node"
-msgstr "IdőSkála Node"
+msgstr "Időskála Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeSeek Node"
@@ -3285,20 +3275,20 @@ msgid "Transition Node"
msgstr "Ãtmenet Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Animációk Importálása.."
+msgid "Import Animations..."
+msgstr "Animációk Importálása..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
-msgstr "Node Szűrők Módosítása"
+msgstr "Node szűrők szerkesztés"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Szűrők.."
+msgid "Filters..."
+msgstr "Szűrők..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
-msgstr "AnimationTree"
+msgstr "AnimációFa"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
@@ -3363,8 +3353,8 @@ msgid "Fetching:"
msgstr "Lekérés:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Megoldás.."
+msgid "Resolving..."
+msgstr "Megoldás..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3430,8 +3420,8 @@ msgid "Site:"
msgstr "Oldal:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Támogatás.."
+msgid "Support..."
+msgstr "Támogatás..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3439,7 +3429,7 @@ msgstr "Hivatalos"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Testing"
-msgstr "Tesztelés Alatt"
+msgstr "Tesztelés"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
@@ -3630,6 +3620,7 @@ msgid "Use Rotation Snap"
msgstr "Forgatási Illesztés Használata"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Illesztés Beállítása..."
@@ -3651,15 +3642,15 @@ msgstr "Illesztés szülőhöz"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node anchor"
-msgstr "Illesztés node horgonyhoz"
+msgstr "Illesztés Node horgonyhoz"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node sides"
-msgstr "Illesztés node oldalakhoz"
+msgstr "Illesztés Node oldalakhoz"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to other nodes"
-msgstr "Illesztés más node-okhoz"
+msgstr "Illesztés más Node-okhoz"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to guides"
@@ -3726,6 +3717,14 @@ msgid "Show Guides"
msgstr "Vezetővonalak Megjelenítése"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Origó Megjelenítése"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Nézet Megjelenítése"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Kijelölés Középre"
@@ -3787,17 +3786,17 @@ msgstr "Rendben"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Cannot instantiate multiple nodes without root."
-msgstr "Nem lehet több node-ot példányosítani gyökér nélkül."
+msgstr "Nem lehet több Node-ot példányosítani gyökér nélkül."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Create Node"
-msgstr "Node Létrehozása"
+msgstr "Node létrehozás"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Error instancing scene from %s"
-msgstr "Hiba történt a jelenet példányosításkor %s-ből"
+msgstr "Hiba történt a Scene példányosításkor %s-ből"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change default type"
@@ -3935,8 +3934,8 @@ msgid ""
"No OccluderPolygon2D resource on this node.\n"
"Create and assign one?"
msgstr ""
-"Nincs OccluderPolygon2D erőforrás ezen a node-on.\n"
-"Létrehoz egyet és hozzárendeli a node-hoz?"
+"Nincs OccluderPolygon2D erőforrás ezen a Node-on.\n"
+"Létrehoz egyet és hozzárendeli a Node-hoz?"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Occluder Polygon"
@@ -3976,7 +3975,7 @@ msgstr "Statikus Konvex Test Létrehozása"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "This doesn't work on scene root!"
-msgstr "Ez nem hajtható végre a jelenet gyökerén!"
+msgstr "Ez nem hajtható végre a gyökér Scene-en!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Shape"
@@ -4016,6 +4015,10 @@ msgstr ""
"A Mesh-nek nincsenek felszínei, ami alapján körvonalakat lehetni készíteni!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "A Háló-primitív típusa nem háromszög (PRIMITIVE_TRIANGLES)!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Körvonalkészítés sikertelen!"
@@ -4044,8 +4047,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Konvex Ütközési Testvér Létrehozása"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Körvonalháló Létrehozása.."
+msgid "Create Outline Mesh..."
+msgstr "Körvonalháló Létrehozása..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4070,102 +4073,103 @@ msgstr "Körvonal Mérete:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and no MultiMesh set in node)."
msgstr ""
+"Nincs háló forrás meghatározva (és nincs MultiMesh a Node-ban beállítva)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and MultiMesh contains no Mesh)."
-msgstr ""
+msgstr "Nincs háló forrás meghatározva (és a MultiMesh nem tartalmaz Mesh-t)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (invalid path)."
-msgstr ""
+msgstr "Mesh forrás érvénytelen (érvénytelen útvonal)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (not a MeshInstance)."
-msgstr ""
+msgstr "Mesh forrás érvénytelen (nem MeshInstance)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (contains no Mesh resource)."
-msgstr ""
+msgstr "Mesh forrás érvénytelen (nem tartalmaz Mesh erőforrást)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No surface source specified."
-msgstr ""
+msgstr "Nincs felületi forrás meghatározva."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (invalid path)."
-msgstr ""
+msgstr "Felületi forrás érvénytelen (érvénytelen útvonal)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (no geometry)."
-msgstr ""
+msgstr "Felületi forrás érvénytelen (nincs geometria)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (no faces)."
-msgstr ""
+msgstr "Felületi forrás érvénytelen (nincsenek oldalak)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Parent has no solid faces to populate."
-msgstr ""
+msgstr "A szülőnek nincsenek kitölthető szilárd oldalai."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Couldn't map area."
-msgstr ""
+msgstr "A területet nem lehetett leképezni."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Source Mesh:"
-msgstr ""
+msgstr "Válasszon Ki Egy Forrás Mesh-t:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Target Surface:"
-msgstr ""
+msgstr "Válasszon Ki Egy Cél Felületet:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate Surface"
-msgstr ""
+msgstr "Felület Kitöltése"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate MultiMesh"
-msgstr ""
+msgstr "MultiMesh Kitöltése"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Target Surface:"
-msgstr ""
+msgstr "Cél Felület:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Source Mesh:"
-msgstr ""
+msgstr "Forrás Mesh:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "X-Axis"
-msgstr ""
+msgstr "X-Tengely"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Y-Axis"
-msgstr ""
+msgstr "Y-Tengely"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Z-Axis"
-msgstr ""
+msgstr "Z-Tengely"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh Up Axis:"
-msgstr ""
+msgstr "Mesh \"Fel\" Tengelye:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Random Rotation:"
-msgstr ""
+msgstr "Véletlenszerű Forgatás:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Random Tilt:"
-msgstr ""
+msgstr "Véletlenszerű Billentés:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Random Scale:"
-msgstr ""
+msgstr "Véletlenszerű Skálázás:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate"
-msgstr ""
+msgstr "Kitöltés"
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Bake!"
@@ -4177,323 +4181,323 @@ msgstr "A navigációs mesh besütése."
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Clear the navigation mesh."
-msgstr ""
+msgstr "Navigációs háló törlése."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Setting up Configuration..."
-msgstr ""
+msgstr "Konfiguráció beállítása…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Calculating grid size..."
-msgstr ""
+msgstr "Rácsméret kiszámítása…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating heightfield..."
-msgstr ""
+msgstr "Magasságmező létrehozása…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Marking walkable triangles..."
-msgstr ""
+msgstr "Járható háromszögek megjelölése…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
-msgstr ""
+msgstr "Kompakt magasságmező kiépítése…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Eroding walkable area..."
-msgstr ""
+msgstr "Járható terület lepusztítása…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Partitioning..."
-msgstr ""
+msgstr "Particionálás…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating contours..."
-msgstr ""
+msgstr "Kontúrok létrehozása…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating polymesh..."
-msgstr ""
+msgstr "Polymesh létrehozása…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Converting to native navigation mesh..."
-msgstr ""
+msgstr "Ãtkonvertálás natív navigációs hálóra…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Navigation Mesh Generator Setup:"
-msgstr ""
+msgstr "Navigációs Háló Generátor Beállítás:"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Parsing Geometry..."
-msgstr ""
+msgstr "Geometria Elemzése…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Done!"
-msgstr ""
+msgstr "Kész!"
#: editor/plugins/navigation_polygon_editor_plugin.cpp
msgid "Create Navigation Polygon"
-msgstr ""
+msgstr "Navigációs Sokszög Létrehozása"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generating AABB"
-msgstr ""
+msgstr "AABB Generálása"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Can only set point into a ParticlesMaterial process material"
-msgstr ""
+msgstr "Csak egy ParticlesMaterial feldolgozó anyagba állíthat pontot"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Error loading image:"
-msgstr ""
+msgstr "Hiba a kép betöltésekor:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr ""
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Nem létezik egyetlen pixel sem >128-as átlátszósággal a képben..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
-msgstr ""
+msgstr "Láthatósági Téglalap Generálása"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Load Emission Mask"
-msgstr ""
+msgstr "Kibocsátási Maszk Betöltése"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Clear Emission Mask"
-msgstr ""
+msgstr "Kibocsátási Maszk Törlése"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Particles"
-msgstr ""
+msgstr "Részecskék"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generated Point Count:"
-msgstr ""
+msgstr "Generált Pontok Száma:"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generation Time (sec):"
-msgstr ""
+msgstr "Generálási Idő (mp):"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Mask"
-msgstr ""
+msgstr "Kibocsátási Maszk"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Capture from Pixel"
-msgstr ""
+msgstr "Kinyerés Pixelből"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Colors"
-msgstr ""
+msgstr "Kibocsátási Színek"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry."
-msgstr ""
+msgstr "A Node nem tartalmaz geometriát."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry (faces)."
-msgstr ""
+msgstr "A Node nem tartalmaz geometriát (oldalakat)."
#: editor/plugins/particles_editor_plugin.cpp
msgid "A processor material of type 'ParticlesMaterial' is required."
-msgstr ""
+msgstr "Egy 'ParticlesMaterial' típusú feldolgozó anyag szükséges."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Faces contain no area!"
-msgstr ""
+msgstr "Az oldalak nem tartalmaznak területet!"
#: editor/plugins/particles_editor_plugin.cpp
msgid "No faces!"
-msgstr ""
+msgstr "Nincsenek oldalak!"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate AABB"
-msgstr ""
+msgstr "AABB Generálása"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Mesh"
-msgstr ""
+msgstr "Kibocsátási Pontok Létrehozása A Mesh Alapján"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Node"
-msgstr ""
+msgstr "Kibocsátási pontok létrehozása a Node alapján"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emitter"
-msgstr ""
+msgstr "Kibocsátó Létrehozása"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Points:"
-msgstr ""
+msgstr "Kibocsátási Pontok:"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points"
-msgstr ""
+msgstr "Felületi Pontok"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points+Normal (Directed)"
-msgstr ""
+msgstr "Felületi Pontok + Normálok (Irányított)"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Volume"
-msgstr ""
+msgstr "Mennyiség"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Source: "
-msgstr ""
+msgstr "Kibocsátási Forrás: "
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate Visibility AABB"
-msgstr ""
+msgstr "Láthatósági AABB Generálása"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove Point from Curve"
-msgstr ""
+msgstr "Pont Eltávolítása Görbéről"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove Out-Control from Curve"
-msgstr ""
+msgstr "Ki-Vezérlő Eltávolítása Görbéből"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove In-Control from Curve"
-msgstr ""
+msgstr "Be-Vezérlő Eltávolítása Görbéből"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Add Point to Curve"
-msgstr ""
+msgstr "Pont Hozzáadása a Görbéhez"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Point in Curve"
-msgstr ""
+msgstr "Pont Mozgatása a Görbén"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move In-Control in Curve"
-msgstr ""
+msgstr "Be-Vezérlő Mozgatása a Görbén"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Out-Control in Curve"
-msgstr ""
+msgstr "Ki-Vezérlő Mozgatása a Görbén"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Select Points"
-msgstr ""
+msgstr "Pontok Kiválasztása"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Shift+Drag: Select Control Points"
-msgstr ""
+msgstr "Shift + Húzás: Vezérlőpontok Kiválasztása"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Click: Add Point"
-msgstr ""
+msgstr "Kattintás: Pont Hozzáadása"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Right Click: Delete Point"
-msgstr ""
+msgstr "Jobb Kattintás: Pont Törlése"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Select Control Points (Shift+Drag)"
-msgstr ""
+msgstr "Vezérlőpontok Kiválasztása (Shift + Húzás)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Add Point (in empty space)"
-msgstr ""
+msgstr "Pont Hozzáadása (üres helyre)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Segment (in curve)"
-msgstr ""
+msgstr "Szakasz Felosztása (görbén)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Delete Point"
-msgstr ""
+msgstr "Pont Törlése"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Close Curve"
-msgstr ""
+msgstr "Görbe Lezárása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Curve Point #"
-msgstr ""
+msgstr "Görbe Pont #"
#: editor/plugins/path_editor_plugin.cpp
msgid "Set Curve Point Position"
-msgstr ""
+msgstr "Görbe Pont Pozíció Beállítása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Set Curve In Position"
-msgstr ""
+msgstr "Be-Görbe Pozíció Beállítása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Set Curve Out Position"
-msgstr ""
+msgstr "Ki-Görbe Pozíció Beállítása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Path"
-msgstr ""
+msgstr "Útvonal Felosztása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove Path Point"
-msgstr ""
+msgstr "Útvonal Pont Eltávolítása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove Out-Control Point"
-msgstr ""
+msgstr "Ki-Vezérlő Pont Eltávolítása"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove In-Control Point"
-msgstr ""
+msgstr "Be-Vezérlő Pont Eltávolítása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Create UV Map"
-msgstr ""
+msgstr "UV Térkép Létrehozása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Transform UV Map"
-msgstr ""
+msgstr "UV Térkép Transzformálása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon 2D UV Editor"
-msgstr ""
+msgstr "2D UV Sokszög Szerkesztő"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Point"
-msgstr ""
+msgstr "Pont Mozgatása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Ctrl: Rotate"
-msgstr ""
+msgstr "Ctrl: Forgatás"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift: Move All"
-msgstr ""
+msgstr "Shift: Mind Mozgatása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift+Ctrl: Scale"
-msgstr ""
+msgstr "Shift + Ctrl: Skálázás"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Polygon"
-msgstr ""
+msgstr "Sokszög Mozgatása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Rotate Polygon"
-msgstr ""
+msgstr "Sokszög Forgatása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Scale Polygon"
-msgstr ""
+msgstr "Sokszög Skálázása"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4505,321 +4509,324 @@ msgstr "Szerkesztés"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon->UV"
-msgstr ""
+msgstr "Sokszög -> UV"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "UV->Polygon"
-msgstr ""
+msgstr "UV -> Sokszög"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Clear UV"
-msgstr ""
+msgstr "UV Törlése"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap"
-msgstr ""
+msgstr "Illesztés"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Enable Snap"
-msgstr ""
+msgstr "Illesztés Engedélyezése"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid"
-msgstr ""
+msgstr "Rács"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "ERROR: Couldn't load resource!"
-msgstr ""
+msgstr "HIBA: Nem sikerült betölteni az erőforrást!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Add Resource"
-msgstr ""
+msgstr "Erőforrás Hozzáadása"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Rename Resource"
-msgstr ""
+msgstr "ErÅ‘forrás Ãtnevezése"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Delete Resource"
-msgstr ""
+msgstr "Erőforrás Törlése"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Resource clipboard is empty!"
-msgstr ""
+msgstr "Az erőforrás vágólap üres!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
msgid "Open in Editor"
-msgstr ""
+msgstr "Megnyitás Szerkesztőben"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
msgid "Instance:"
-msgstr ""
+msgstr "Példány:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
msgid "Type:"
-msgstr ""
+msgstr "Típus:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Load Resource"
-msgstr ""
+msgstr "Erőforrás Betöltése"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Paste"
-msgstr ""
+msgstr "Beillesztés"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "ResourcePreloader"
-msgstr ""
+msgstr "ForrásElőtöltö"
#: editor/plugins/script_editor_plugin.cpp
msgid "Clear Recent Files"
-msgstr ""
+msgstr "Legutóbbi Fájlok Törlése"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close and save changes?"
-msgstr ""
+msgstr "Bezárja és menti a változásokat?"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error while saving theme"
-msgstr ""
+msgstr "HIba történt a téma mentésekor"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error saving"
-msgstr ""
+msgstr "Hiba mentés közben"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error importing theme"
-msgstr ""
+msgstr "Hiba történt a téma importálásakor"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error importing"
-msgstr ""
+msgstr "Hiba importáláskor"
#: editor/plugins/script_editor_plugin.cpp
msgid "Import Theme"
-msgstr ""
+msgstr "Téma Importálása"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr ""
+msgid "Save Theme As..."
+msgstr "Téma Mentése Másként..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
-msgstr ""
+msgstr " Osztály Referencia"
#: editor/plugins/script_editor_plugin.cpp
msgid "Sort"
-msgstr ""
+msgstr "Rendezés"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Move Up"
-msgstr ""
+msgstr "Mozgatás Felfelé"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Move Down"
-msgstr ""
+msgstr "Mozgatás Lefelé"
#: editor/plugins/script_editor_plugin.cpp
msgid "Next script"
-msgstr ""
+msgstr "Következő Szkript"
#: editor/plugins/script_editor_plugin.cpp
msgid "Previous script"
-msgstr ""
+msgstr "Előző Szkript"
#: editor/plugins/script_editor_plugin.cpp
msgid "File"
-msgstr ""
+msgstr "Fájl"
#: editor/plugins/script_editor_plugin.cpp
msgid "New"
-msgstr ""
+msgstr "Új"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save All"
-msgstr ""
+msgstr "Összes Mentése"
#: editor/plugins/script_editor_plugin.cpp
msgid "Soft Reload Script"
-msgstr ""
+msgstr "Szkript Puha Újratöltése"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Copy Script Path"
-msgstr "Útvonal másolása"
+msgstr "Szkript Útvonal Másolása"
#: editor/plugins/script_editor_plugin.cpp
msgid "Show In File System"
-msgstr ""
+msgstr "Mutassa a Fájlrendszerben"
#: editor/plugins/script_editor_plugin.cpp
msgid "History Prev"
-msgstr ""
+msgstr "Előző Előzmény"
#: editor/plugins/script_editor_plugin.cpp
msgid "History Next"
-msgstr ""
+msgstr "Következő Előzmény"
#: editor/plugins/script_editor_plugin.cpp
msgid "Reload Theme"
-msgstr ""
+msgstr "Téma Újratöltése"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save Theme"
-msgstr ""
+msgstr "Téma Mentése"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save Theme As"
-msgstr ""
+msgstr "Téma Mentése Másként"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Docs"
-msgstr ""
+msgstr "Dokumentációs Lapok Bezárása"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close All"
-msgstr ""
+msgstr "Mind Bezárása"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Other Tabs"
-msgstr ""
+msgstr "A Többi Lap Bezárása"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
msgid "Run"
-msgstr ""
+msgstr "Futtatás"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle Scripts Panel"
-msgstr ""
+msgstr "Szkript Panel Megjelenítése"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr ""
+msgid "Find..."
+msgstr "Keresés..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
msgid "Find Next"
-msgstr ""
+msgstr "Következő Keresése"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Over"
-msgstr ""
+msgstr "Ãtlépés"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Into"
-msgstr ""
+msgstr "Belépés"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Break"
-msgstr ""
+msgstr "Szünet"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
#: editor/script_editor_debugger.cpp
msgid "Continue"
-msgstr ""
+msgstr "Folytatás"
#: editor/plugins/script_editor_plugin.cpp
msgid "Keep Debugger Open"
-msgstr ""
+msgstr "Hibakereső Nyitva Tartása"
#: editor/plugins/script_editor_plugin.cpp
msgid "Debug with external editor"
-msgstr ""
+msgstr "Hibakeresés külső szerkesztővel"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open Godot online documentation"
-msgstr ""
+msgstr "Godot online dokumentáció megnyitása"
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the class hierarchy."
-msgstr ""
+msgstr "Keresés az osztályhierarchiában."
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the reference documentation."
-msgstr ""
+msgstr "Keresés a referencia dokumentációban."
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to previous edited document."
-msgstr ""
+msgstr "Ugrás az előzőleg szerkesztett dokumentumra."
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to next edited document."
-msgstr ""
+msgstr "Ugrás a következőleg szerkesztett dokumentumra."
#: editor/plugins/script_editor_plugin.cpp
msgid "Discard"
-msgstr ""
+msgstr "Elvetés"
#: editor/plugins/script_editor_plugin.cpp
msgid "Create Script"
-msgstr ""
+msgstr "Szkript Létrehozása"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
"The following files are newer on disk.\n"
"What action should be taken?:"
msgstr ""
+"A alábbi fájlok újabbak a lemezen.\n"
+"Mit szeretne lépni?:"
#: editor/plugins/script_editor_plugin.cpp
msgid "Reload"
-msgstr ""
+msgstr "Újratöltés"
#: editor/plugins/script_editor_plugin.cpp
msgid "Resave"
-msgstr ""
+msgstr "Újramentés"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Debugger"
-msgstr ""
+msgstr "Hibakereső"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
"Built-in scripts can only be edited when the scene they belong to is loaded"
msgstr ""
+"A beépített szkriptek csak akkor szerkeszthetőek, amikor az a Scene amihez "
+"tartoznak éppen be van töltve"
#: editor/plugins/script_text_editor.cpp
msgid "Only resources from filesystem can be dropped."
-msgstr ""
+msgstr "Csak a fájlrendszerből eredő erőforrásokat lehet bedobni."
#: editor/plugins/script_text_editor.cpp
msgid "Pick Color"
-msgstr ""
+msgstr "Szín Választása"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Case"
-msgstr ""
+msgstr "Kis- és Nagybetűk Konvertálása"
#: editor/plugins/script_text_editor.cpp
msgid "Uppercase"
-msgstr ""
+msgstr "Mind Nagybetű"
#: editor/plugins/script_text_editor.cpp
msgid "Lowercase"
-msgstr ""
+msgstr "Mind Kisbetű"
#: editor/plugins/script_text_editor.cpp
msgid "Capitalize"
-msgstr ""
+msgstr "Szó Eleji Nagybetű"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
msgid "Cut"
-msgstr ""
+msgstr "Kivágás"
#: editor/plugins/script_text_editor.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
@@ -4830,59 +4837,59 @@ msgstr "Másolás"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
msgid "Select All"
-msgstr ""
+msgstr "Összes Kijelölése"
#: editor/plugins/script_text_editor.cpp
msgid "Delete Line"
-msgstr ""
+msgstr "Sor Törlése"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Left"
-msgstr ""
+msgstr "Behúzás Balra"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Right"
-msgstr ""
+msgstr "Behúzás Jobbra"
#: editor/plugins/script_text_editor.cpp
msgid "Toggle Comment"
-msgstr ""
+msgstr "Ãtváltás Megjegyzésre"
#: editor/plugins/script_text_editor.cpp
msgid "Fold/Unfold Line"
-msgstr ""
+msgstr "Sor Összezárása / Kibontása"
#: editor/plugins/script_text_editor.cpp
msgid "Fold All Lines"
-msgstr ""
+msgstr "Összes Sor Összezárása"
#: editor/plugins/script_text_editor.cpp
msgid "Unfold All Lines"
-msgstr ""
+msgstr "Összes Sor Kibontása"
#: editor/plugins/script_text_editor.cpp
msgid "Clone Down"
-msgstr ""
+msgstr "Klónozás Lefelé"
#: editor/plugins/script_text_editor.cpp
msgid "Complete Symbol"
-msgstr ""
+msgstr "Szimbólum Befejezése"
#: editor/plugins/script_text_editor.cpp
msgid "Trim Trailing Whitespace"
-msgstr ""
+msgstr "Sorvégi Szóközök Lenyírása"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Spaces"
-msgstr ""
+msgstr "Behúzások Ãtkonvertálása Szóközökre"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Tabs"
-msgstr ""
+msgstr "Behúzások Ãtkonvertálása Tabokra"
#: editor/plugins/script_text_editor.cpp
msgid "Auto Indent"
-msgstr ""
+msgstr "Automatikus Behúzás"
#: editor/plugins/script_text_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -4891,103 +4898,103 @@ msgstr "Töréspont Elhelyezése"
#: editor/plugins/script_text_editor.cpp
msgid "Remove All Breakpoints"
-msgstr ""
+msgstr "Összes Töréspont Eltávolítása"
#: editor/plugins/script_text_editor.cpp
msgid "Goto Next Breakpoint"
-msgstr ""
+msgstr "Ugrás Következő Töréspontra"
#: editor/plugins/script_text_editor.cpp
msgid "Goto Previous Breakpoint"
-msgstr ""
+msgstr "Ugrás Előző Töréspontra"
#: editor/plugins/script_text_editor.cpp
msgid "Convert To Uppercase"
-msgstr ""
+msgstr "Konvertálás Nagybetűsre"
#: editor/plugins/script_text_editor.cpp
msgid "Convert To Lowercase"
-msgstr ""
+msgstr "Konvertálás Kisbetűsre"
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
-msgstr ""
+msgstr "Előző Keresése"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr ""
+msgid "Replace..."
+msgstr "Csere..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr ""
+msgid "Goto Function..."
+msgstr "Ugrás Funkcióra..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr ""
+msgid "Goto Line..."
+msgstr "Ugrás Sorra..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
-msgstr ""
+msgstr "Kontextusérzékeny Súgó"
#: editor/plugins/shader_editor_plugin.cpp
msgid "Shader"
-msgstr ""
+msgstr "Ãrnyaló"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Constant"
-msgstr ""
+msgstr "Skaláris állandó változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Constant"
-msgstr ""
+msgstr "Vec állandó változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Constant"
-msgstr ""
+msgstr "RGB állandó változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Operator"
-msgstr ""
+msgstr "Skaláris kezelő változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Operator"
-msgstr ""
+msgstr "Vec kezelő változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Scalar Operator"
-msgstr ""
+msgstr "Vektor skalár kezelő változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Operator"
-msgstr ""
+msgstr "RGB kezelő változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Toggle Rot Only"
-msgstr ""
+msgstr "Csak vörös kapcsolása"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Function"
-msgstr ""
+msgstr "Skalár-függvény változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Function"
-msgstr ""
+msgstr "Vektor-függvény változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Uniform"
-msgstr ""
+msgstr "Egységes-skalár változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Uniform"
-msgstr ""
+msgstr "Egységes-vektor változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Uniform"
-msgstr ""
+msgstr "Egységes-RGB változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Default Value"
-msgstr ""
+msgstr "Alapérték változtatás"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change XForm Uniform"
@@ -5083,7 +5090,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Plane Transform."
-msgstr ""
+msgstr "Megnéz a Síklap transzformációját."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scaling: "
@@ -5235,7 +5242,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Doppler Enable"
-msgstr ""
+msgstr "Doppler engedélyezése"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
@@ -5373,11 +5380,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5630,7 +5633,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5678,6 +5681,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Rádió Elem"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5690,7 +5701,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5878,7 +5889,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5968,6 +5979,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Érvénytelen projektnév."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6022,9 +6037,8 @@ msgid "Create New Project"
msgstr ""
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create & Edit"
-msgstr "Létrehozás"
+msgstr "Létrehozás és Szerkesztés"
#: editor/project_manager.cpp
msgid "Install Project:"
@@ -6154,7 +6168,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6182,7 +6198,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6298,10 +6314,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6363,14 +6375,14 @@ msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr ""
+msgstr "Ãltalános"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6466,11 +6478,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6641,7 +6653,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -6687,9 +6699,8 @@ msgid "Error duplicating scene to save it."
msgstr ""
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Sub-Resources"
-msgstr "Forrás másolása"
+msgstr "Al-Erőforrások"
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance"
@@ -6980,9 +6991,8 @@ msgid "Child Process Connected"
msgstr ""
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Copy Error"
-msgstr "Póz másolása"
+msgstr "Hiba Másolása"
#: editor/script_editor_debugger.cpp
msgid "Inspect Previous Instance"
@@ -7137,9 +7147,8 @@ msgid "Select dependencies of the library for this entry"
msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Remove current entry"
-msgstr "Jelenlegi nyomvonal felfelé mozgatása."
+msgstr "Jelenlegi tétel eltávolítása"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Double click to create a new entry"
@@ -7229,14 +7238,12 @@ msgid "Object can't provide a length."
msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Következő fül"
+msgstr "Következő Síklap"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Előző fül"
+msgstr "Előző Sík"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
@@ -7346,6 +7353,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7394,6 +7405,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7704,7 +7719,7 @@ msgstr ""
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Path does not lead Node!"
-msgstr ""
+msgstr "Az út nem vezeti a csomópontot!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Invalid index property name '%s' in node %s."
@@ -7984,10 +7999,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8072,12 +8097,23 @@ msgstr "Hiba a betűtípus betöltésekor."
msgid "Invalid font size."
msgstr "Érvénytelen betűtípus méret."
-#~ msgid "Can't write file."
-#~ msgstr "Nem lehet fájlt írni."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Előző fül"
#~ msgid "Next"
#~ msgstr "Következő"
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Érvénytelen version.txt formátum a sablonokban. A revízió nem érvényes "
+#~ "azonosító."
+
+#~ msgid "Can't write file."
+#~ msgstr "Nem lehet fájlt írni."
+
#~ msgid "Not found!"
#~ msgstr "Nincs Találat!"
diff --git a/editor/translations/id.po b/editor/translations/id.po
index cb17c0a2a3..3956378ce7 100644
--- a/editor/translations/id.po
+++ b/editor/translations/id.po
@@ -2,30 +2,31 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Abdul Aziz Muslim Alqudsy <abdul.aziz.muslim.alqudsy@gmail.com>, 2016.
# Andevid Dynmyn <doyan4forum@gmail.com>, 2016.
# Andinawan Asa <asaandinawan@gmail.com>, 2016.
# Damar Inderajati <damarind@gmail.com>, 2017.
# Damar S. M <the.last.walla@gmail.com>, 2017.
+# Fajar Ru <kzofajar@gmail.com>, 2018.
# Khairul Hidayat <khairulcyber4rt@gmail.com>, 2016.
+# Reza Hidayat Bayu Prabowo <rh.bayu.prabowo@gmail.com>, 2018.
# Romi Kusuma Bakti <romikusumab@gmail.com>, 2017.
-# Sofyan Sugianto <sofyanartem@gmail.com>, 2017.
+# Sofyan Sugianto <sofyanartem@gmail.com>, 2017-2018.
+# Tito <ijavadroid@gmail.com>, 2018.
# Tom My <tom.asadinawan@gmail.com>, 2017.
# yursan9 <rizal.sagi@gmail.com>, 2016.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-12-11 10:47+0000\n"
-"Last-Translator: Romi Kusuma Bakti <romikusumab@gmail.com>\n"
+"PO-Revision-Date: 2018-06-22 08:30+0000\n"
+"Last-Translator: Fajar Ru <kzofajar@gmail.com>\n"
"Language-Team: Indonesian <https://hosted.weblate.org/projects/godot-engine/"
"godot/id/>\n"
"Language: id\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 2.18-dev\n"
+"X-Generator: Weblate 3.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -36,9 +37,8 @@ msgid "All Selection"
msgstr "Semua pilihan"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "Ubah Nilai Animasi"
+msgstr "Ubah Waktu Keyframe Animasi"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
@@ -49,9 +49,8 @@ msgid "Anim Change Transform"
msgstr "Ubah Transformasi Animasi"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Ubah Nilai Animasi"
+msgstr "Ubah Nilai Keyframe Animasi"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -99,7 +98,7 @@ msgstr "Ubah Trek Anim ke Wrap Mode"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
-msgstr "Edit Kurva Node"
+msgstr "Sunting Kurva Node"
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
@@ -380,9 +379,8 @@ msgid "No Matches"
msgstr "Tidak ada yang cocok"
#: editor/code_editor.cpp
-#, fuzzy
msgid "Replaced %d occurrence(s)."
-msgstr "Diganti kejadian (kejadian-kejadian) %d."
+msgstr "%d kejadian diganti."
#: editor/code_editor.cpp
msgid "Match Case"
@@ -504,13 +502,12 @@ msgid "Connecting Signal:"
msgstr "Menyambungkan Sinyal:"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect '%s' from '%s'"
-msgstr "Sambungkan '%s' ke '%s'"
+msgstr "Memutuskan '%s' dari '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Menyambungkan.."
+msgid "Connect..."
+msgstr "Menyambungkan..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -522,9 +519,8 @@ msgid "Signals"
msgstr "Sinyal-sinyal"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Change %s Type"
-msgstr "Ubah Tipe Nilai Array"
+msgstr "Ubah Tipe %s"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -532,9 +528,8 @@ msgid "Change"
msgstr "Ubah"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Create New %s"
-msgstr "Buat Baru"
+msgstr "Buat Baru %s"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
@@ -612,9 +607,8 @@ msgid "Fix Broken"
msgstr "Perbaiki yang Rusak"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Dependency Editor"
-msgstr "Editor Ketergantungan"
+msgstr "Penyunting Dependensi"
#: editor/dependency_editor.cpp
msgid "Search Replacement Resource:"
@@ -647,9 +641,8 @@ msgstr ""
"Hapus saja? (tidak bisa dibatalkan/undo)"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Cannot remove:"
-msgstr "Tidak bisa dibuang:\n"
+msgstr "Tidak bisa menghapus:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
@@ -708,9 +701,8 @@ msgid "Change Dictionary Key"
msgstr "Ubah Kunci Kamus"
#: editor/dictionary_property_edit.cpp
-#, fuzzy
msgid "Change Dictionary Value"
-msgstr "Ubah Nilai Array"
+msgstr "Ubah Nilai Kamus"
#: editor/editor_about.cpp
msgid "Thanks from the Godot community!"
@@ -733,9 +725,8 @@ msgid "Lead Developer"
msgstr "Pengembang Utama"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Project Manager "
-msgstr "Manajer Proyek"
+msgstr "Manajer Proyek "
#: editor/editor_about.cpp
msgid "Developers"
@@ -794,14 +785,12 @@ msgstr ""
"lisensi masing-masing."
#: editor/editor_about.cpp
-#, fuzzy
msgid "All Components"
-msgstr "Konstanta:"
+msgstr "Semua Komponen"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Components"
-msgstr "Konstanta:"
+msgstr "Komponen"
#: editor/editor_about.cpp
msgid "Licenses"
@@ -812,9 +801,8 @@ msgid "Error opening package file, not in zip format."
msgstr "Gagal saat membuka paket, tidak dalam bentuk zip."
#: editor/editor_asset_installer.cpp
-#, fuzzy
msgid "Uncompressing Assets"
-msgstr "Mengimpor ulang"
+msgstr "Membuka Aset Terkompresi"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Package Installed Successfully!"
@@ -843,14 +831,12 @@ msgid "Add Effect"
msgstr "Tambahkan Efek"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Rename Audio Bus"
-msgstr "Namai kembali Autoload"
+msgstr "Ubah Nama Bus Audio"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Change Audio Bus Volume"
-msgstr "Alih Audio Bus Solo"
+msgstr "Ubah Volume Bus Audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
@@ -877,9 +863,8 @@ msgid "Move Bus Effect"
msgstr "Pindah Efek Bus"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Delete Bus Effect"
-msgstr "Hapus yang Dipilih"
+msgstr "Hapus Effect Bus"
#: editor/editor_audio_buses.cpp
msgid "Audio Bus, Drag and Drop to rearrange."
@@ -907,18 +892,16 @@ msgid "Duplicate"
msgstr "Gandakan"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Reset Volume"
-msgstr "Kebalikan Semula Pandangan"
+msgstr "Setel Ulang Volume"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Delete Effect"
-msgstr "Hapus yang Dipilih"
+msgstr "Hapus Efek"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Suara"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
@@ -931,30 +914,28 @@ msgstr "Master Bus tidak dapat dihapus!"
#: editor/editor_audio_buses.cpp
#, fuzzy
msgid "Delete Audio Bus"
-msgstr "Hapus Penampilan"
+msgstr "Hapus Bus Audio"
#: editor/editor_audio_buses.cpp
#, fuzzy
msgid "Duplicate Audio Bus"
-msgstr "Duplikat Pilihan"
+msgstr "Duplikat Audio Bus"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Reset Bus Volume"
-msgstr "Kebalikan Semula Pandangan"
+msgstr "Setel Ulang Bus Volume"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Move Audio Bus"
-msgstr "Pindahkan Kunci Tambah"
+msgstr "Pindahkan Audio Bus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Simpan Layout Suara Bus Ke.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Simpan Layout Suara Bus Ke..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Lokasi untuk Layout Baru.."
+msgid "Location for New Layout..."
+msgstr "Lokasi untuk Layout Baru..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -997,7 +978,7 @@ msgstr "Simpan Layout Bus ke berkas."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
#, fuzzy
msgid "Load Default"
-msgstr "Bawaan"
+msgstr "Muat Konfigurasi Bawaan"
#: editor/editor_audio_buses.cpp
msgid "Load the default Bus Layout."
@@ -1012,9 +993,9 @@ msgid "Valid characters:"
msgstr "Karakter sah:"
#: editor/editor_autoload_settings.cpp
-#, fuzzy
msgid "Invalid name. Must not collide with an existing engine class name."
-msgstr "Nama tidak sah. Harus tidak serupa dengan class name engine yang ada."
+msgstr ""
+"Nama tidak valid. Tidak boleh sama dengan nama kelas bawaan engine yang ada."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing buit-in type name."
@@ -1062,7 +1043,6 @@ msgid "Remove Autoload"
msgstr "Hapus Autoload"
#: editor/editor_autoload_settings.cpp
-#, fuzzy
msgid "Enable"
msgstr "Aktifkan"
@@ -1093,25 +1073,24 @@ msgid "Updating Scene"
msgstr "Memperbaharui Scene"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Menyimpan perubahan-perubahan lokal.."
+msgid "Storing local changes..."
+msgstr "Menyimpan perubahan-perubahan lokal..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Memperbaharui scene.."
+msgid "Updating scene..."
+msgstr "Memperbaharui scene..."
#: editor/editor_data.cpp
msgid "[empty]"
-msgstr ""
+msgstr "[kosong]"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr ""
+msgstr "[belum disimpan]"
#: editor/editor_dir_dialog.cpp
-#, fuzzy
msgid "Please select a base directory first"
-msgstr "Mohon simpan scene terlebih dahulu."
+msgstr "Slahkan pilih direktori kerja terlebih dahulu"
#: editor/editor_dir_dialog.cpp
msgid "Choose a Directory"
@@ -1147,31 +1126,28 @@ msgid "Packing"
msgstr "Mengemas"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
-#, fuzzy
msgid "Template file not found:"
-msgstr "Template berkas tidak ditemukan:\n"
+msgstr "Templat berkas tidak ditemukan:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "File Exists, Overwrite?"
msgstr "File telah ada, Overwrite?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select Current Folder"
-msgstr "Buat Folder"
+msgstr "Pilih Folder Saat Ini"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
-msgstr ""
+msgstr "Salin Lokasi"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Show In File Manager"
msgstr "Tampilkan di Manajer Berkas"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-#, fuzzy
-msgid "New Folder.."
-msgstr "Buat Folder"
+msgid "New Folder..."
+msgstr "Buat Direktori..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1212,17 +1188,14 @@ msgid "Save a File"
msgstr "Simpan sebuah File"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Go Back"
-msgstr "Mundur"
+msgstr "Kembali"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Go Forward"
msgstr "Maju"
#: editor/editor_file_dialog.cpp
-#, fuzzy
msgid "Go Up"
msgstr "Naik"
@@ -1251,9 +1224,8 @@ msgid "Move Favorite Down"
msgstr "Pindahkan Favorit Kebawah"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Go to parent folder"
-msgstr "Tidak dapat membuat folder."
+msgstr "Pergi ke direktori induk"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
@@ -1277,9 +1249,8 @@ msgid "ScanSources"
msgstr "Sumber Pemindaian"
#: editor/editor_file_system.cpp
-#, fuzzy
msgid "(Re)Importing Assets"
-msgstr "Mengimpor ulang"
+msgstr "Mengimpor ulang Aset"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -1315,9 +1286,8 @@ msgid "Brief Description:"
msgstr "Deskripsi Singkat:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Members"
-msgstr "Member-member:"
+msgstr "Anggota"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Members:"
@@ -1326,7 +1296,7 @@ msgstr "Member-member:"
#: editor/editor_help.cpp
#, fuzzy
msgid "Public Methods"
-msgstr "Metode Publik:"
+msgstr "Fungsi Publik"
#: editor/editor_help.cpp
msgid "Public Methods:"
@@ -1346,57 +1316,50 @@ msgid "Signals:"
msgstr "Sinyal-sinyal:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Enumerations"
-msgstr "Fungsi-fungsi:"
+msgstr "Enumerasi"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Enumerations:"
-msgstr "Fungsi-fungsi:"
+msgstr "Enumerasi:"
#: editor/editor_help.cpp
msgid "enum "
-msgstr ""
+msgstr "enum "
#: editor/editor_help.cpp
-#, fuzzy
msgid "Constants"
-msgstr "Konstanta:"
+msgstr "Konstanta"
#: editor/editor_help.cpp
msgid "Constants:"
msgstr "Konstanta:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Description"
-msgstr "Deskripsi:"
+msgstr "Deskripsi"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Online Tutorials:"
-msgstr "Online Dokumentasi"
+msgstr "Tutorial Daring:"
#: editor/editor_help.cpp
-#, fuzzy
msgid ""
"There are currently no tutorials for this class, you can [color=$color][url="
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Untuk saat ini tidak ada deskripsi metode ini. Tolong bantu kita dengan "
-"[color=$color][url=$url]kontribusi[/url][/color]!"
+"Untuk saat ini tidak ada tutorial dalam kelas ini, anda bisa [color=$color]"
+"[url=$url]ikut berkontribusi[/url][/color] atau [color=$color][url="
+"$url2]memberikan usulan[/url][/color]."
#: editor/editor_help.cpp
-#, fuzzy
msgid "Properties"
-msgstr "Properti Objek."
+msgstr "Properti Objek"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Property Description:"
-msgstr "Deskripsi Singkat:"
+msgstr "Deskripsi Properti Objek:"
#: editor/editor_help.cpp
msgid ""
@@ -1407,9 +1370,8 @@ msgstr ""
"dengan[color=$color][url=$url]kontribusi[/url][/color]!"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Methods"
-msgstr "Daftar Fungsi:"
+msgstr "Fungsi"
#: editor/editor_help.cpp
msgid "Method Description:"
@@ -1432,9 +1394,8 @@ msgid "Find"
msgstr "Cari"
#: editor/editor_log.cpp
-#, fuzzy
msgid "Output:"
-msgstr " Keluaran:"
+msgstr "Keluaran:"
#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/property_editor.cpp editor/script_editor_debugger.cpp
@@ -1444,23 +1405,26 @@ msgid "Clear"
msgstr "Bersihkan"
#: editor/editor_log.cpp
-#, fuzzy
msgid "Clear Output"
-msgstr "Luaran"
+msgstr "Bersihkan Luaran"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Ekspor proyek gagal dengan kode kesalahan% d."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Error menyimpan resource!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Simpan Resource Sebagai.."
+msgid "Save Resource As..."
+msgstr "Simpan Resource Sebagai..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
#, fuzzy
-msgid "I see.."
-msgstr "Aku tahu.."
+msgid "I see..."
+msgstr "Aku tahu..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1475,28 +1439,24 @@ msgid "Error while saving."
msgstr "Error saat menyimpan."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Can't open '%s'."
-msgstr "Menyambungkan.."
+msgstr "Tidak dapat membuka '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while parsing '%s'."
-msgstr "Error saat menyimpan."
+msgstr "Kesalahan saat melakukan parsing '%s'."
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
msgstr "akhir dari berkas tak terduga '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Missing '%s' or its dependencies."
-msgstr "Scene '%s' memiliki dependensi yang rusak:"
+msgstr "'%s' hilang atau memiliki dependensi yang rusak."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while loading '%s'."
-msgstr "Error saat menyimpan."
+msgstr "Terjadi kesalahan saat memuat '%s'."
#: editor/editor_node.cpp
msgid "Saving Scene"
@@ -1513,15 +1473,15 @@ msgstr "Membuat Thumbnail"
#: editor/editor_node.cpp
#, fuzzy
msgid "This operation can't be done without a tree root."
-msgstr "Tindakan ini tidak dapat dibatalkan. Pulihkan saja?"
+msgstr "Tindakan ini tidak bisa dilakukan tanpa \"tree root\""
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
msgstr ""
-"Tidak dapat menyimpan scene. Dependensi (instance) mungkin tidak terpenuhi."
+"Tidak dapat menyimpan scene. Dependensi (instance atau turunannya) mungkin "
+"tidak terpenuhi."
#: editor/editor_node.cpp
msgid "Failed to load resource."
@@ -1532,9 +1492,8 @@ msgid "Can't load MeshLibrary for merging!"
msgstr "Tidak dapat memuat MeshLibrary untuk menggabungkan!"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error saving MeshLibrary!"
-msgstr "Error menyimpan MeshLibrary!"
+msgstr "Terjadi kesalahan saat menyimpan MeshLibrary!"
#: editor/editor_node.cpp
msgid "Can't load TileSet for merging!"
@@ -1611,11 +1570,11 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Expand all properties"
-msgstr ""
+msgstr "Perluas semua properti"
#: editor/editor_node.cpp
msgid "Collapse all properties"
-msgstr ""
+msgstr "Ciutkan semua properti"
#: editor/editor_node.cpp
msgid "Copy Params"
@@ -1650,15 +1609,14 @@ msgid "There is no defined scene to run."
msgstr "Tidak ada definisi scene untuk dijalankan."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"No main scene has ever been defined, select one?\n"
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
"Tidak ada scene utama yang pernah didefinisikan, pilih satu?\n"
-"Anda dapat mengubahnya nanti di akhir dalam \"Project Settings\" dibawah "
-"kategori 'application'."
+"Anda dapat mengubahnya nanti di \"Project Settings\" di bawah kategori "
+"'application'."
#: editor/editor_node.cpp
msgid ""
@@ -1699,25 +1657,24 @@ msgid "Open Base Scene"
msgstr "Buka Scene Dasar"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Buka Cepat Scene.."
+msgid "Quick Open Scene..."
+msgstr "Buka Cepat Scene..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Buka Cepat Script.."
+msgid "Quick Open Script..."
+msgstr "Buka Cepat Script..."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save & Close"
-msgstr "Simpan sebuah File"
+msgstr "Simpan & Tutup"
#: editor/editor_node.cpp
msgid "Save changes to '%s' before closing?"
msgstr "Simpan perubahan '%s' sebelum tutup?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Simpan Scene Sebagai.."
+msgid "Save Scene As..."
+msgstr "Simpan Scene Sebagai..."
#: editor/editor_node.cpp
msgid "No"
@@ -1740,9 +1697,8 @@ msgid "Export Mesh Library"
msgstr "Ekspor Mesh Library"
#: editor/editor_node.cpp
-#, fuzzy
msgid "This operation can't be done without a root node."
-msgstr "Tindakan ini tidak dapat dibatalkan. Pulihkan saja?"
+msgstr "Tindakan ini tidak bisa dilakukan tanpa node dasar."
#: editor/editor_node.cpp
msgid "Export Tile Set"
@@ -1769,8 +1725,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Tindakan ini tidak dapat dibatalkan. Pulihkan saja?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Jalankan Cepat Scene.."
+msgid "Quick Run Scene..."
+msgstr "Jalankan Cepat Scene..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1785,19 +1741,16 @@ msgid "Open Project Manager?"
msgstr "Buka Project Manager?"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save & Quit"
-msgstr "Simpan sebuah File"
+msgstr "Simpan & Keluar"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save changes to the following scene(s) before quitting?"
-msgstr "Simpan perubahan saat ini sebelum keluar?"
+msgstr "Simpan perubahan scene saat ini sebelum keluar?"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save changes the following scene(s) before opening Project Manager?"
-msgstr "Simpan perubahan saat ini sebelum membuka Manajer Projek?"
+msgstr "Simpan perubahan scene saat ini sebelum membuka Manajer Projek?"
#: editor/editor_node.cpp
msgid ""
@@ -1823,9 +1776,8 @@ msgstr ""
"Tidak dapat mencari bidang script untuk addon plugin pada: 'res://addons/%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Unable to load addon script from path: '%s'."
-msgstr "Error memuat font."
+msgstr "Tidak bisa memuat script addon dari lokasi: '%s'."
#: editor/editor_node.cpp
msgid ""
@@ -1849,9 +1801,8 @@ msgstr ""
#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Ugh"
-msgstr "Wadoo"
+msgstr "Duh"
#: editor/editor_node.cpp
msgid ""
@@ -1887,17 +1838,14 @@ msgid "Switch Scene Tab"
msgstr "Pilih Tab Scene"
#: editor/editor_node.cpp
-#, fuzzy
msgid "%d more files or folders"
msgstr "%d file atau folder lagi"
#: editor/editor_node.cpp
-#, fuzzy
msgid "%d more folders"
-msgstr "%d file lagi"
+msgstr "%d folder lagi"
#: editor/editor_node.cpp
-#, fuzzy
msgid "%d more files"
msgstr "%d file lagi"
@@ -1915,9 +1863,8 @@ msgid "Toggle distraction-free mode."
msgstr "Mode Tanpa Gangguan"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Add a new scene."
-msgstr "Tambah tracks baru."
+msgstr "Tambah scene baru."
#: editor/editor_node.cpp
msgid "Scene"
@@ -1936,8 +1883,8 @@ msgid "Previous tab"
msgstr "Tab sebelumnya"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Saring berkas.."
+msgid "Filter Files..."
+msgstr "Saring berkas..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1948,12 +1895,12 @@ msgid "New Scene"
msgstr "Scene Baru"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Scene Turunan Baru.."
+msgid "New Inherited Scene..."
+msgstr "Scene Turunan Baru..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Buka Scene.."
+msgid "Open Scene..."
+msgstr "Buka Scene..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1972,16 +1919,16 @@ msgid "Open Recent"
msgstr "Buka baru-baru ini"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Ubah ke.."
+msgid "Convert To..."
+msgstr "Ubah ke..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr ""
+msgid "MeshLibrary..."
+msgstr "PerpustakaanMesh..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2027,7 +1974,7 @@ msgstr "Keluar ke daftar proyek"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Debug"
-msgstr ""
+msgstr "\"Debug\""
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
@@ -2117,9 +2064,8 @@ msgstr ""
"jaringan filesystem."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Editor"
-msgstr "Edit"
+msgstr "Editor"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
@@ -2130,14 +2076,12 @@ msgid "Editor Layout"
msgstr "Tata Letak Editor"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Toggle Fullscreen"
msgstr "Mode Layar Penuh"
#: editor/editor_node.cpp editor/project_export.cpp
-#, fuzzy
msgid "Manage Export Templates"
-msgstr "Memuat Ekspor Template-template."
+msgstr "Mengatur Templat Ekspor"
#: editor/editor_node.cpp
msgid "Help"
@@ -2145,7 +2089,7 @@ msgstr "Bantuan"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Classes"
-msgstr ""
+msgstr "Kelas"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -2160,7 +2104,7 @@ msgstr "Online Dokumentasi"
#: editor/editor_node.cpp
msgid "Q&A"
-msgstr ""
+msgstr "Tanya Jawab"
#: editor/editor_node.cpp
msgid "Issue Tracker"
@@ -2184,11 +2128,11 @@ msgstr "Mainkan"
#: editor/editor_node.cpp
msgid "Pause the scene"
-msgstr ""
+msgstr "Hentikan sementara scene ini"
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr ""
+msgstr "Hentikan Sementara Scene"
#: editor/editor_node.cpp
msgid "Stop the scene."
@@ -2247,8 +2191,8 @@ msgid "Save the currently edited resource."
msgstr "Simpan sumber yang sedang diatur."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Simpan Sebagai.."
+msgid "Save As..."
+msgstr "Simpan Sebagai..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2276,9 +2220,8 @@ msgid "Import"
msgstr "Impor"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Node"
-msgstr "Titik"
+msgstr "Node"
#: editor/editor_node.cpp
msgid "FileSystem"
@@ -2293,7 +2236,6 @@ msgid "Don't Save"
msgstr "Jangan Simpan"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Import Templates From ZIP File"
msgstr "Impor Templat dari Berkas ZIP"
@@ -2306,7 +2248,6 @@ msgid "Export Library"
msgstr "Ekspor Pustaka"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Merge With Existing"
msgstr "Gabung dengan yang Ada"
@@ -2319,12 +2260,10 @@ msgid "Open & Run a Script"
msgstr "Buka & Jalankan Skrip"
#: editor/editor_node.cpp
-#, fuzzy
msgid "New Inherited"
-msgstr "Scene Turunan Baru.."
+msgstr "Turunan Baru"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Load Errors"
msgstr "Muat Galat"
@@ -2333,12 +2272,10 @@ msgid "Select"
msgstr "Pilih"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Open 2D Editor"
msgstr "Buka Penyunting 2D"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Open 3D Editor"
msgstr "Buka Penyunting 3D"
@@ -2363,8 +2300,8 @@ msgid "Creating Mesh Previews"
msgstr "Buat Pratinjau Mesh"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr ""
+msgid "Thumbnail..."
+msgstr "Thumbnail..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2385,7 +2322,7 @@ msgstr "Pembuat:"
#: editor/editor_plugin_settings.cpp
msgid "Status:"
-msgstr ""
+msgstr "Status:"
#: editor/editor_profiler.cpp
msgid "Stop Profiling"
@@ -2409,7 +2346,7 @@ msgstr "Waktu Rata-rata (sec)"
#: editor/editor_profiler.cpp
msgid "Frame %"
-msgstr ""
+msgstr "Bingkai %"
#: editor/editor_profiler.cpp
msgid "Physics Frame %"
@@ -2432,12 +2369,10 @@ msgid "Frame #:"
msgstr "Bingkai #:"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Time"
-msgstr "Waktu:"
+msgstr "Waktu"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Calls"
msgstr "Panggil"
@@ -2450,79 +2385,80 @@ msgid ""
"No runnable export preset found for this platform.\n"
"Please add a runnable preset in the export menu."
msgstr ""
+"Tidak ada preset ekspor yang bisa digunakan untuk platform ini.\n"
+"Mohon tambahkan preset yang bisa digunakan di menu ekspor."
#: editor/editor_run_script.cpp
msgid "Write your logic in the _run() method."
-msgstr ""
+msgstr "Tulis logika di dalam fungsi _run()."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
-msgstr ""
+msgstr "Ada scene yang disunting."
#: editor/editor_run_script.cpp
msgid "Couldn't instance script:"
-msgstr ""
+msgstr "Tidak bisa meng-instance script:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
-msgstr ""
+msgstr "Apakah anda lupa dengan kata kunci 'tool'?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
-msgstr ""
+msgstr "Tidak bisa menjalankan script:"
#: editor/editor_run_script.cpp
msgid "Did you forget the '_run' method?"
-msgstr ""
+msgstr "Apakah anda lupa dengan fungsi '_run' ?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
-msgstr ""
+msgstr "Baku (Samakan seperti Penyunting saat ini)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
-msgstr ""
+msgstr "Pilih node untuk diimpor"
#: editor/editor_sub_scene.cpp
msgid "Scene Path:"
-msgstr ""
+msgstr "Lokasi Scene:"
#: editor/editor_sub_scene.cpp
msgid "Import From Node:"
-msgstr ""
+msgstr "Impor dari Node:"
#: editor/export_template_manager.cpp
msgid "Re-Download"
-msgstr ""
+msgstr "Unduh Ulang"
#: editor/export_template_manager.cpp
msgid "Uninstall"
-msgstr ""
+msgstr "Copot Pemasangan"
#: editor/export_template_manager.cpp
msgid "(Installed)"
-msgstr ""
+msgstr "(terpasang)"
#: editor/export_template_manager.cpp
msgid "Download"
-msgstr ""
+msgstr "Unduh"
#: editor/export_template_manager.cpp
msgid "(Missing)"
-msgstr ""
+msgstr "(hilang)"
#: editor/export_template_manager.cpp
msgid "(Current)"
-msgstr ""
+msgstr "(Kondisi Saat Ini)"
#: editor/export_template_manager.cpp
-#, fuzzy
-msgid "Retrieving mirrors, please wait.."
-msgstr "Gangguan koneks, silakan coba lagi."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Mendapatkan informasi cermin, silakan tunggu..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
-msgstr ""
+msgstr "Hapus templat versi '%s'?"
#: editor/export_template_manager.cpp
msgid "Can't open export templates zip."
@@ -2530,27 +2466,19 @@ msgstr "Tidak dapat membuka ekspor template-template zip."
#: editor/export_template_manager.cpp
msgid "Invalid version.txt format inside templates."
-msgstr ""
-
-#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
+msgstr "Format version.txt tidak valid dalam berkas templat."
#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
-msgstr ""
+msgstr "Berkas version.txt tidak ditemukan dalam templat."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Error creating path for templates:"
-msgstr "Gagal menyimpan atlas:"
+msgstr "Kesalahan saat membuat lokasi untuk templat:"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Extracting Export Templates"
-msgstr "Memuat Ekspor Template-template."
+msgstr "Mengekstrak Berkas Templat Ekspor"
#: editor/export_template_manager.cpp
msgid "Importing:"
@@ -2561,17 +2489,18 @@ msgid ""
"No download links found for this version. Direct download is only available "
"for official releases."
msgstr ""
+"Tautan unduh tidak ditemukan untuk versi ini. Unduhan langsung hanya "
+"tersedia untuk versi rilis resmi."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve."
-msgstr ""
+msgstr "Tidak bisa menyelesaikan."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Can't connect."
-msgstr "Menyambungkan.."
+msgstr "Tidak dapat terhubung."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2580,223 +2509,204 @@ msgstr "Tidak ada respon."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Request Failed."
-msgstr "Menguji"
+msgstr "Permintaan Gagal."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
+#, fuzzy
msgid "Redirect Loop."
-msgstr ""
+msgstr "Mengarahkan Loop"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Failed:"
-msgstr ""
+msgstr "Gagal:"
#: editor/export_template_manager.cpp
msgid "Download Complete."
-msgstr ""
+msgstr "Unduhan Selesai."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Error requesting url: "
-msgstr "Gagal menyimpan atlas:"
+msgstr "Kesalahan saat meminta url: "
#: editor/export_template_manager.cpp
-#, fuzzy
-msgid "Connecting to Mirror.."
-msgstr "Menyambungkan.."
+msgid "Connecting to Mirror..."
+msgstr "Menyambungkan..."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Disconnected"
-msgstr "Tidak tersambung"
+msgstr "Terputus"
#: editor/export_template_manager.cpp
msgid "Resolving"
-msgstr ""
+msgstr "Menyelesaikan"
#: editor/export_template_manager.cpp
msgid "Can't Resolve"
-msgstr ""
+msgstr "Tidak Bisa Menyelesaikan"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
-msgid "Connecting.."
-msgstr "Menyambungkan.."
+msgid "Connecting..."
+msgstr "Menyambungkan..."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Can't Connect"
-msgstr "Menyambungkan.."
+msgstr "Tidak dapat terhubung"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Connected"
-msgstr "Menghubungkan"
+msgstr "Terhubung"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
-msgid "Requesting.."
-msgstr "Menguji"
+msgid "Requesting..."
+msgstr "Melakukan permintaan..."
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Downloading"
-msgstr "Error memuat:"
+msgstr "Mengunduh"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Connection Error"
-msgstr "Menyambungkan.."
+msgstr "Gangguan Koneksi"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "SSL Handshake Error"
-msgstr "Muat Galat"
+msgstr "Kesalahan jabat tangan SSL"
#: editor/export_template_manager.cpp
msgid "Current Version:"
-msgstr ""
+msgstr "Versi sekarang:"
#: editor/export_template_manager.cpp
msgid "Installed Versions:"
-msgstr ""
+msgstr "Versi Terpasang:"
#: editor/export_template_manager.cpp
msgid "Install From File"
-msgstr ""
+msgstr "Memasang dari berkas"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Remove Template"
-msgstr "Hapus Pilihan"
+msgstr "Hapus Templat"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Select template file"
-msgstr "Hapus file yang dipilih?"
+msgstr "Pilih berkas templat"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Export Template Manager"
-msgstr "Memuat Ekspor Template-template."
+msgstr "Manajer Templat Ekspor"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Download Templates"
-msgstr "Hapus Pilihan"
+msgstr "Unduh Templat"
#: editor/export_template_manager.cpp
msgid "Select mirror from list: "
-msgstr ""
+msgstr "Pilih cermin dari daftar: "
#: editor/file_type_cache.cpp
msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
msgstr ""
+"Tidak dapat membuka file_type_cache.cch untuk menulis, berkas cache tidak "
+"disimpan!"
#: editor/filesystem_dock.cpp
msgid "Cannot navigate to '%s' as it has not been found in the file system!"
msgstr ""
+"'%s' tidak bisa ditelusuri karena tidak bisa ditemukan dalam berkas sistem!"
#: editor/filesystem_dock.cpp
msgid "View items as a grid of thumbnails"
-msgstr ""
+msgstr "Tampilkan item sebagai grid thumbnail"
#: editor/filesystem_dock.cpp
msgid "View items as a list"
-msgstr ""
+msgstr "Tampilkan item sebagai daftar"
#: editor/filesystem_dock.cpp
msgid "Status: Import of file failed. Please fix file and reimport manually."
msgstr ""
+"Status: Gagal mengimpor berkas. Mohon perbaiki berkas dan impor ulang secara "
+"manual."
#: editor/filesystem_dock.cpp
msgid "Cannot move/rename resources root."
-msgstr ""
+msgstr "Tidak bisa memindah/mengubah nama aset root."
#: editor/filesystem_dock.cpp
msgid "Cannot move a folder into itself."
-msgstr ""
+msgstr "Tidak dapat memindahkan folder ke dalam dirinya sendiri."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error moving:"
-msgstr "Error memuat:"
+msgstr "Galat saat memindahkan:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error duplicating:"
-msgstr "Error saat memuat:"
+msgstr "Galat saat menggandakan berkas:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Unable to update dependencies:"
-msgstr "Scene '%s' memiliki dependensi yang rusak:"
+msgstr "Tidak bisa memperbarui dependensi:"
#: editor/filesystem_dock.cpp
msgid "No name provided"
-msgstr ""
+msgstr "Nama masih kosong"
#: editor/filesystem_dock.cpp
msgid "Provided name contains invalid characters"
-msgstr ""
+msgstr "Nama yang dimasukkan tidak valid"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "No name provided."
-msgstr "Ubah Nama atau Pindahkan.."
+msgstr "Nama masih kosong."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Name contains invalid characters."
-msgstr "Karakter sah:"
+msgstr "Nama mengandung karakter tidak valid."
#: editor/filesystem_dock.cpp
msgid "A file or folder with this name already exists."
-msgstr ""
+msgstr "Sudah ada nama berkas atau folder seperti itu."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Renaming file:"
-msgstr "Namai kembali Variabel"
+msgstr "Mengubah nama berkas dengan:"
#: editor/filesystem_dock.cpp
msgid "Renaming folder:"
-msgstr ""
+msgstr "Mengubah nama folder dengan:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating file:"
-msgstr "Gandakan"
+msgstr "Menggandakan berkas:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating folder:"
-msgstr "Gandakan"
+msgstr "Menggandakan folder:"
#: editor/filesystem_dock.cpp
msgid "Expand all"
-msgstr ""
+msgstr "Perluas semua"
#: editor/filesystem_dock.cpp
msgid "Collapse all"
-msgstr ""
+msgstr "Ciutkan semua"
#: editor/filesystem_dock.cpp
-#, fuzzy
-msgid "Rename.."
-msgstr "Ubah Nama atau Pindahkan.."
+msgid "Rename..."
+msgstr "Ubah Nama..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Pindah Ke.."
+msgid "Move To..."
+msgstr "Pindahkan ke..."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Open Scene(s)"
msgstr "Buka Scene"
@@ -2805,17 +2715,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr ""
+msgid "Edit Dependencies..."
+msgstr "Sunting Dependensi..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr ""
+msgid "View Owners..."
+msgstr "Tampilkan Pemilik Berkas..."
#: editor/filesystem_dock.cpp
-#, fuzzy
-msgid "Duplicate.."
-msgstr "Gandakan"
+msgid "Duplicate..."
+msgstr "Gandakan..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2831,20 +2740,19 @@ msgstr "Pindai Ulang Berkas Sistem"
#: editor/filesystem_dock.cpp
msgid "Toggle folder status as Favorite"
-msgstr ""
+msgstr "Kondisikan status folder sebagai Favorit"
#: editor/filesystem_dock.cpp
msgid "Instance the selected scene(s) as child of the selected node."
-msgstr ""
+msgstr "Instance scene terpilih sebagai anak node saat ini."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Memindai Berkas,\n"
-"Silakan Tunggu.."
+"Silakan Tunggu..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2853,7 +2761,7 @@ msgstr "Pindahkan"
#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Rename"
-msgstr ""
+msgstr "Ubah Nama"
#: editor/groups_editor.cpp
msgid "Add to Group"
@@ -2861,210 +2769,216 @@ msgstr "Tambahkan ke Grup"
#: editor/groups_editor.cpp
msgid "Remove from Group"
-msgstr ""
+msgstr "Hapus dari Grup"
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Import as Single Scene"
-msgstr "Memperbaharui Scene"
+msgstr "Impor sebagai Scene Tunggal"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Animations"
-msgstr ""
+msgstr "Impor dengan Animasi Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
-msgstr ""
+msgstr "Impor dengan Material Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects"
-msgstr ""
+msgstr "Impor dengan Objek Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials"
-msgstr ""
+msgstr "Impor dengan Objek+Material Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Animations"
-msgstr ""
+msgstr "Impor dengan Objek+Animasi Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials+Animations"
-msgstr ""
+msgstr "Impor dengan Material+Animasi Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials+Animations"
-msgstr ""
+msgstr "Impor dengan Objek+Material+Animasi Terpisah"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes"
-msgstr ""
+msgstr "Impor sebagai Beberapa Scene"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes+Materials"
-msgstr ""
+msgstr "Impor Beberapa Scene+Material"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import Scene"
-msgstr ""
+msgstr "Impor Scene"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr ""
+msgid "Importing Scene..."
+msgstr "Mengimpor scene..."
#: editor/import/resource_importer_scene.cpp
+#, fuzzy
msgid "Generating Lightmaps"
-msgstr ""
+msgstr "Sedang Membuat Pemetaan Cahaya"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr ""
+#, fuzzy
+msgid "Running Custom Script..."
+msgstr "Menjalankan Skrip Buatan..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
-msgstr ""
+msgstr "Tidak dapat memuat skrip post-import:"
#: editor/import/resource_importer_scene.cpp
msgid "Invalid/broken script for post-import (check console):"
-msgstr ""
+msgstr "Skrip post-import rusak/tidak valid (cek konsol):"
#: editor/import/resource_importer_scene.cpp
msgid "Error running post-import script:"
-msgstr ""
+msgstr "Kesalahan saat menjalankan skrip post-import:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr ""
+msgid "Saving..."
+msgstr "Menyimpan..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
-msgstr ""
+msgstr "Jadikan Baku untuk '%s'"
#: editor/import_dock.cpp
msgid "Clear Default for '%s'"
-msgstr ""
+msgstr "Bersihkan Baku untuk '%s'"
#: editor/import_dock.cpp
-#, fuzzy
msgid " Files"
-msgstr "File:"
+msgstr " Berkas"
#: editor/import_dock.cpp
-#, fuzzy
msgid "Import As:"
-msgstr "Mengimpor:"
+msgstr "Impor sebagai:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
-#, fuzzy
msgid "Reimport"
-msgstr "Mengimpor ulang"
+msgstr "Impor ulang"
#: editor/multi_node_edit.cpp
msgid "MultiNode Set"
-msgstr ""
+msgstr "Set MultiNode"
#: editor/node_dock.cpp
msgid "Groups"
-msgstr ""
+msgstr "Grup"
#: editor/node_dock.cpp
msgid "Select a Node to edit Signals and Groups."
-msgstr ""
+msgstr "Pilih sebuah node untuk menyunting Sinyal dan Grup."
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+#, fuzzy
msgid "Create Poly"
-msgstr ""
+msgstr "Buat Bidang"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+#, fuzzy
msgid "Edit Poly"
-msgstr ""
+msgstr "Sunting Bidang"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Insert Point"
-msgstr ""
+msgstr "Tambah Titik"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly (Remove Point)"
-msgstr ""
+msgstr "Sunting Bidang (Hapus Titik)"
#: editor/plugins/abstract_polygon_2d_editor.cpp
+#, fuzzy
msgid "Remove Poly And Point"
-msgstr ""
+msgstr "Hapus Bidang dan Titik"
#: editor/plugins/abstract_polygon_2d_editor.cpp
+#, fuzzy
msgid "Create a new polygon from scratch"
-msgstr ""
+msgstr "Buat bidang baru dari awal"
#: editor/plugins/abstract_polygon_2d_editor.cpp
+#, fuzzy
msgid ""
"Edit existing polygon:\n"
"LMB: Move Point.\n"
"Ctrl+LMB: Split Segment.\n"
"RMB: Erase Point."
msgstr ""
+"Sunting bidang yang ada:\n"
+"LMB: Pindahkan Titik.\n"
+"Ctrl+LMB: Pecah Segmen.\n"
+"RMB: Hapus Titik."
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Delete points"
-msgstr "Hapus"
+msgstr "Hapus Titik"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Toggle Autoplay"
-msgstr ""
+msgstr "Kondisikan Putar Otomatis"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Animation Name:"
-msgstr ""
+msgstr "Nama Animasi Baru:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Anim"
-msgstr ""
+msgstr "Animasi Baru"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Animation Name:"
-msgstr ""
+msgstr "Ubah Nama Animasi:"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Delete Animation?"
-msgstr "Optimalkan Animasi"
+msgstr "Hapus Animasi?"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Remove Animation"
-msgstr ""
+msgstr "Hapus Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Invalid animation name!"
-msgstr ""
+msgstr "KESALAHAN: Nama animasi tidak valid!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Animation name already exists!"
-msgstr ""
+msgstr "KESALAHAN: Nama animasi sudah ada!"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Rename Animation"
-msgstr ""
+msgstr "Ubah Nama Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Animation"
-msgstr ""
+msgstr "Tambah Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Next Changed"
@@ -3072,103 +2986,115 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Blend Time"
-msgstr ""
+msgstr "Ubah Waktu Blend"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load Animation"
-msgstr ""
+msgstr "Muat Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Duplicate Animation"
-msgstr ""
+msgstr "Gandakan Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to copy!"
-msgstr ""
+msgstr "KESALAHAN: Tidak ada animasi untuk disalin!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation resource on clipboard!"
-msgstr ""
+msgstr "KESALAHAN: Tidak ada aset animasi di clipboard!"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Pasted Animation"
-msgstr ""
+msgstr "Animasi Ditempel"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Paste Animation"
-msgstr ""
+msgstr "Tempelkan Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "ERROR: No animation to edit!"
-msgstr ""
+msgstr "KESALAHAN: Tidak ada animasi untuk disunting!"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Play selected animation backwards from current pos. (A)"
-msgstr ""
+msgstr "Mainkan mundur animasi terpilih dari lokasi sekarang. (A)"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Play selected animation backwards from end. (Shift+A)"
-msgstr ""
+msgstr "Mainkan mundur animasi terpilih dari akhir. (Shift+A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Stop animation playback. (S)"
-msgstr ""
+msgstr "Hentikan playback animasi. (S)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from start. (Shift+D)"
-msgstr ""
+msgstr "Mainkan animasi terpilih dari awal. (Shift+D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from current pos. (D)"
-msgstr ""
+msgstr "Mainkan animasi terpilih dari posisi sekarang. (D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation position (in seconds)."
-msgstr ""
+msgstr "Posisi Animasi (dalam detik)."
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Scale animation playback globally for the node."
-msgstr ""
+msgstr "Skalakan playback animasi secara global untuk node ini."
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Create new animation in player."
-msgstr ""
+msgstr "Buat animasi baru dalam pemutar animasi."
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Load animation from disk."
-msgstr ""
+msgstr "Memuat animasi dari diska."
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Load an animation from disk."
-msgstr ""
+msgstr "Memuat animasi dari diska."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Save the current animation"
-msgstr ""
+msgstr "Simpan animasi saat ini"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Display list of animations in player."
-msgstr ""
+msgstr "Tampilkan daftar animasi dalam pemutar animasi."
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Autoplay on Load"
-msgstr ""
+msgstr "Putar Otomatis saat Dimuat"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Edit Target Blend Times"
-msgstr ""
+msgstr "Sunting Target Waktu Blend"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Tools"
-msgstr ""
+msgstr "Perkakas Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Copy Animation"
-msgstr ""
+msgstr "Salin Animasi"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Onion Skinning"
-msgstr ""
+msgstr "Onion Skinning"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Enable Onion Skinning"
@@ -3194,19 +3120,19 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "1 step"
-msgstr ""
+msgstr "1 langkah"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "2 steps"
-msgstr ""
+msgstr "2 langkah"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "3 steps"
-msgstr ""
+msgstr "3 langkah"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Differences Only"
-msgstr ""
+msgstr "Hanya yang berbeda"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Force White Modulate"
@@ -3218,18 +3144,18 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create New Animation"
-msgstr ""
+msgstr "Buat Animasi Baru"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Name:"
-msgstr ""
+msgstr "Nama Animasi:"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Error!"
-msgstr ""
+msgstr "Kesalahan!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Times:"
@@ -3237,7 +3163,7 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Next (Auto Queue):"
-msgstr ""
+msgstr "Selanjutnya (Antrian Otomatis):"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Cross-Animation Blend Times"
@@ -3250,17 +3176,17 @@ msgstr "Animasi"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "New name:"
-msgstr ""
+msgstr "Nama baru:"
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
msgid "Edit Filters"
-msgstr "File:"
+msgstr "Sunting Filter"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Scale:"
-msgstr ""
+msgstr "Skala:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Fade In (s):"
@@ -3280,11 +3206,11 @@ msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Auto Restart:"
-msgstr ""
+msgstr "Mulai Ulang Otomatis:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Restart (s):"
-msgstr ""
+msgstr "Mulai Ulang:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Random Restart (s):"
@@ -3292,7 +3218,7 @@ msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Start!"
-msgstr ""
+msgstr "Mulai!"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
@@ -3380,21 +3306,21 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr ""
+msgid "Import Animations..."
+msgstr "Impor Animasi..."
#: editor/plugins/animation_tree_editor_plugin.cpp
+#, fuzzy
msgid "Edit Node Filters"
-msgstr ""
+msgstr "Sunting Filter Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr ""
+msgid "Filters..."
+msgstr "Penyaring..."
#: editor/plugins/animation_tree_editor_plugin.cpp
-#, fuzzy
msgid "AnimationTree"
-msgstr "Animasi"
+msgstr "PohonAnimasi"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
@@ -3415,27 +3341,26 @@ msgid "Can't resolve hostname:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Connection error, please try again."
-msgstr "Gangguan koneks, silakan coba lagi."
+msgstr "Gangguan koneksi, silakan coba lagi."
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
msgid "Can't connect to host:"
-msgstr "Sambungkan Ke Node:"
+msgstr "Tidak bisa terhubung ke host:"
#: editor/plugins/asset_library_editor_plugin.cpp
+#, fuzzy
msgid "No response from host:"
-msgstr ""
+msgstr "Tidak ada respon dari host:"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Request failed, return code:"
-msgstr "Format file yang diminta tidak diketahui:"
+msgstr "Permintaan gagal, return code:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request failed, too many redirects"
-msgstr ""
+msgstr "Permintaan gagal, terlalu banyak pengalihan"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Bad download hash, assuming file has been tampered with."
@@ -3450,25 +3375,25 @@ msgid "Got:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
+#, fuzzy
msgid "Failed sha256 hash check"
-msgstr ""
+msgstr "Gagal mengecek hash sha256"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Asset Download Error:"
-msgstr ""
+msgstr "Gagal Mengunduh Aset:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Error making request"
-msgstr "Error menyimpan resource!"
+msgstr "Kesalahan saat melakukan permintaan"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Idle"
@@ -3480,27 +3405,27 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download Error"
-msgstr ""
+msgstr "Unduhan Gagal"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download for this asset is already in progress!"
-msgstr ""
+msgstr "Unduhan untuk aset ini sedang diproses!"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "first"
-msgstr ""
+msgstr "pertama"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "prev"
-msgstr ""
+msgstr "sebelumnya"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "next"
-msgstr ""
+msgstr "selanjutnya"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "last"
-msgstr ""
+msgstr "terakhir"
#: editor/plugins/asset_library_editor_plugin.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -3510,7 +3435,7 @@ msgstr "Semua"
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_settings_editor.cpp
msgid "Plugins"
-msgstr ""
+msgstr "Pengaya"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Sort:"
@@ -3530,8 +3455,8 @@ msgid "Site:"
msgstr "Situs:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Dukungan.."
+msgid "Support..."
+msgstr "Dukungan..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3543,14 +3468,18 @@ msgstr "Menguji"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
-msgstr "Aset-aset File ZIP"
+msgstr "Berkas Aset ZIP"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
+#, fuzzy
msgid ""
"Can't determine a save path for lightmap images.\n"
"Save your scene (for images to be saved in the same dir), or pick a save "
"path from the BakedLightmap properties."
msgstr ""
+"Tidak dapat menentukan lokasi penyimpanan untuk gambar lightmap\n"
+"Simpan scene-mu (untuk gambar silakan simpan di direktori yang sama dengan "
+"scene), atau tentukan lokasi penyimpanan dari properti BakedLightmap"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
@@ -3570,11 +3499,11 @@ msgstr "Ganti Radius Lampu"
#: editor/plugins/camera_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Preview"
-msgstr ""
+msgstr "Pratinjau"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Configure Snap"
-msgstr ""
+msgstr "Atur Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -3635,12 +3564,14 @@ msgid "Create new horizontal and vertical guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Edit IK Chain"
-msgstr ""
+msgstr "Sunting Rantai IK"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Edit CanvasItem"
-msgstr ""
+msgstr "Sunting CanvasItem"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Anchors only"
@@ -3723,6 +3654,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3819,6 +3751,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -4001,8 +3941,9 @@ msgid "Toggle Curve Linear Tangent"
msgstr ""
#: editor/plugins/curve_editor_plugin.cpp
+#, fuzzy
msgid "Hold Shift to edit tangents individually"
-msgstr ""
+msgstr "Tahan Shift untuk menyunting tangen kurva satu-persatu"
#: editor/plugins/gi_probe_editor_plugin.cpp
msgid "Bake GI Probe"
@@ -4026,8 +3967,9 @@ msgid "Items"
msgstr ""
#: editor/plugins/item_list_editor_plugin.cpp
+#, fuzzy
msgid "Item List Editor"
-msgstr ""
+msgstr "Penyunting Daftar Item"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid ""
@@ -4044,8 +3986,9 @@ msgid "Create a new polygon from scratch."
msgstr ""
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+#, fuzzy
msgid "Edit existing polygon:"
-msgstr ""
+msgstr "Sunting poligon yang ada:"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "LMB: Move Point."
@@ -4112,6 +4055,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -4140,7 +4087,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4292,7 +4239,7 @@ msgstr ""
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "Menyimpan perubahan-perubahan lokal.."
+msgstr "Menyimpan perubahan-perubahan lokal..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
@@ -4348,7 +4295,7 @@ msgid "Error loading image:"
msgstr "Galat saat memuat gambar:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4567,8 +4514,9 @@ msgid "Transform UV Map"
msgstr ""
#: editor/plugins/polygon_2d_editor_plugin.cpp
+#, fuzzy
msgid "Polygon 2D UV Editor"
-msgstr ""
+msgstr "Penyunting UV Poligon 2D"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Point"
@@ -4604,7 +4552,7 @@ msgstr ""
#: editor/project_settings_editor.cpp editor/property_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Edit"
-msgstr "Edit"
+msgstr "Sunting"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon->UV"
@@ -4654,8 +4602,9 @@ msgstr ""
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
+#, fuzzy
msgid "Open in Editor"
-msgstr ""
+msgstr "Buka dalam Penyunting"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
@@ -4715,7 +4664,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4816,8 +4765,8 @@ msgstr "Beralih Favorit"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Cari.."
+msgid "Find..."
+msgstr "Cari..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4848,7 +4797,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#, fuzzy
msgid "Debug with external editor"
-msgstr "Editor Ketergantungan"
+msgstr "Debug menggunakan penyunting eksternal"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open Godot online documentation"
@@ -4864,11 +4813,12 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to previous edited document."
-msgstr ""
+msgstr "Ke dokumen yang disunting sebelumnya."
#: editor/plugins/script_editor_plugin.cpp
+#, fuzzy
msgid "Go to next edited document."
-msgstr ""
+msgstr "Ke dokumen yang disunting selanjutnya."
#: editor/plugins/script_editor_plugin.cpp
#, fuzzy
@@ -4900,7 +4850,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
msgid ""
"Built-in scripts can only be edited when the scene they belong to is loaded"
-msgstr ""
+msgstr "Skrip built-in hanya bisa disunting ketika scene induknya dimuat"
#: editor/plugins/script_text_editor.cpp
msgid "Only resources from filesystem can be dropped."
@@ -5027,15 +4977,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5226,7 +5176,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
msgid "Material Changes"
-msgstr "Menyimpan perubahan-perubahan lokal.."
+msgstr "Menyimpan perubahan-perubahan lokal..."
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
@@ -5499,11 +5449,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5728,8 +5674,9 @@ msgid "Texture Region"
msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
+#, fuzzy
msgid "Texture Region Editor"
-msgstr ""
+msgstr "Penyunting Daerah Tekstur"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Can't save theme to file:"
@@ -5759,12 +5706,12 @@ msgid "Remove All"
msgstr "Hapus"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr ""
+msgid "Edit theme..."
+msgstr "Sunting tema..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
-msgstr ""
+msgstr "Menu untuk menyunting tema."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add Class Items"
@@ -5779,12 +5726,14 @@ msgid "Create Empty Template"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "Create Empty Editor Template"
-msgstr ""
+msgstr "Buat Templat Penyunting Kosongan"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
msgid "Create From Current Editor Theme"
-msgstr ""
+msgstr "Buat dari Tema Editor Saat Ini"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
@@ -5807,6 +5756,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5819,7 +5776,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5948,7 +5905,7 @@ msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet.."
+msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -6015,7 +5972,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -6110,6 +6067,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Nama Projek:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Tidak dapat membuat folder."
@@ -6133,7 +6095,7 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
-msgstr ""
+msgstr "Tidak dapat menyunting project.godot dalam lokasi proyek."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
@@ -6158,27 +6120,24 @@ msgid "Import Existing Project"
msgstr "Impor Projek yang Sudah Ada"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Import & Edit"
-msgstr "Impor"
+msgstr "Impor & Ubah"
#: editor/project_manager.cpp
msgid "Create New Project"
msgstr "Buat Projek Baru"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create & Edit"
-msgstr "Buat"
+msgstr "Buat & Ubah"
#: editor/project_manager.cpp
msgid "Install Project:"
msgstr ""
#: editor/project_manager.cpp
-#, fuzzy
msgid "Install & Edit"
-msgstr "Pasang"
+msgstr "Pasang & Ubah"
#: editor/project_manager.cpp
msgid "Project Name:"
@@ -6204,7 +6163,7 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
msgid "Can't open project"
-msgstr "Menyambungkan.."
+msgstr "Menyambungkan..."
#: editor/project_manager.cpp
#, fuzzy
@@ -6285,7 +6244,7 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
msgid "Can't run project"
-msgstr "Menyambungkan.."
+msgstr "Menyambungkan..."
#: editor/project_manager.cpp
msgid ""
@@ -6310,7 +6269,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6338,7 +6299,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6459,11 +6420,6 @@ msgid "Delete Item"
msgstr "Hapus"
#: editor/project_settings_editor.cpp
-#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "Sambungkan Ke Node:"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6526,14 +6482,14 @@ msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr ""
+msgstr "Umum"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6630,11 +6586,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Berkas.."
+msgid "File..."
+msgstr "Berkas..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6815,7 +6771,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -6985,7 +6941,7 @@ msgstr ""
#: editor/scene_tree_editor.cpp
#, fuzzy
msgid "Open script"
-msgstr "Buka Cepat Script.."
+msgstr "Buka Cepat Script..."
#: editor/scene_tree_editor.cpp
msgid ""
@@ -7550,6 +7506,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7603,6 +7563,10 @@ msgstr "Proyek"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8274,12 +8238,22 @@ msgstr ""
"bekerja."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Hanya satu WorldEnvironment yang diizinkan per scene (atau atur scene-scene "
"yang diacu)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8312,9 +8286,8 @@ msgid "Please Confirm..."
msgstr "Mohon konfirmasi..."
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select this Folder"
-msgstr "Metode Publik:"
+msgstr "Pilih Folder ini"
#: scene/gui/popup.cpp
msgid ""
@@ -8335,7 +8308,7 @@ msgstr ""
#: scene/gui/tree.cpp
msgid "(Other)"
-msgstr ""
+msgstr "(Yang Lain)"
#: scene/main/scene_tree.cpp
#, fuzzy
@@ -8347,7 +8320,6 @@ msgstr ""
"> Lingkungan Baku) tidak dapat dimuat"
#: scene/main/viewport.cpp
-#, fuzzy
msgid ""
"This viewport is not set as render target. If you intend for it to display "
"its contents directly to the screen, make it a child of a Control so it can "
@@ -8356,9 +8328,9 @@ msgid ""
msgstr ""
"Viewport ini tidak diatur sebagai target render. Jika anda berniat untuk "
"menampilkan konten-kontennya secara langsung ke layar, buatlah sebuah child "
-"dari kontrol jadi hal tersebut bisa memperoleh ukuran. Jika tidak, buatlah "
-"sebuah RenderTarget dan tetapkannya tekstur internal untuk beberapa node "
-"untuk ditampilkan."
+"dari Kontrol jadi hal tersebut bisa memperoleh ukuran. Jika tidak, buatlah "
+"sebuah RenderTarget dan tetapkan tekstur internal untuk beberapa node untuk "
+"ditampilkan."
#: scene/resources/dynamic_font.cpp
msgid "Error initializing FreeType."
@@ -8377,12 +8349,27 @@ msgid "Invalid font size."
msgstr "Ukuran font tidak sah."
#, fuzzy
-#~ msgid "Can't write file."
-#~ msgstr "Tidak dapat membuat folder."
+#~ msgid "Previous"
+#~ msgstr "Tab sebelumnya"
#~ msgid "Next"
#~ msgstr "Berikutnya"
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Sambungkan Ke Node:"
+
+#, fuzzy
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Format version.txt tidak valid dalam berkas templat. Revisi tidak valid."
+
+#, fuzzy
+#~ msgid "Can't write file."
+#~ msgstr "Tidak dapat membuat folder."
+
#~ msgid "Not found!"
#~ msgstr "Tidak ditemukan!"
@@ -8427,7 +8414,7 @@ msgstr "Ukuran font tidak sah."
#, fuzzy
#~ msgid "Setting '"
-#~ msgstr "Mengatur.."
+#~ msgstr "Mengatur..."
#, fuzzy
#~ msgid "Selection -> Duplicate"
@@ -8476,8 +8463,8 @@ msgstr "Ukuran font tidak sah."
#~ msgid "Exporting for %s"
#~ msgstr "Mengekspor untuk %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Mengatur.."
+#~ msgid "Setting Up..."
+#~ msgstr "Mengatur..."
#~ msgid "Error loading scene."
#~ msgstr "Gagal memuat scene."
@@ -8501,8 +8488,8 @@ msgstr "Ukuran font tidak sah."
#~ msgid "No files selected!"
#~ msgstr "Tidak ada berkas dipilih!"
-#~ msgid "Re-Import.."
-#~ msgstr "Impor Ulang.."
+#~ msgid "Re-Import..."
+#~ msgstr "Impor Ulang..."
#, fuzzy
#~ msgid "Root Node Name:"
diff --git a/editor/translations/is.po b/editor/translations/is.po
index b5cfaed2af..98a376edca 100644
--- a/editor/translations/is.po
+++ b/editor/translations/is.po
@@ -4,138 +4,165 @@
# This file is distributed under the same license as the Godot source code.
#
# Jóhannes G. Þorsteinsson <johannesg@johannesg.com>, 2017.
+# Kaan Gül <qaantum@hotmail.com>, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-12-05 21:47+0000\n"
-"Last-Translator: Jóhannes G. Þorsteinsson <johannesg@johannesg.com>\n"
+"PO-Revision-Date: 2018-06-05 05:39+0000\n"
+"Last-Translator: Kaan Gül <qaantum@hotmail.com>\n"
"Language-Team: Icelandic <https://hosted.weblate.org/projects/godot-engine/"
"godot/is/>\n"
"Language: is\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 2.18-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Disabled"
msgstr "Óvirkt"
#: editor/animation_editor.cpp
msgid "All Selection"
-msgstr "Allt Val"
+msgstr "Allt úrvalið"
#: editor/animation_editor.cpp
#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "Hreyfimynd Breyta Gildi"
+msgstr "Anim breyta lyklagrind tími"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Change Transition"
-msgstr "Hreyfimynd Breyta Stöðuskiptum"
+msgstr "Anim breyting umskipti"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Change Transform"
-msgstr "Hreyfimynd Breyta Ummyndun"
+msgstr "Breyta umbreytingu"
#: editor/animation_editor.cpp
#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Hreyfimynd Breyta Gildi"
+msgstr "Anim breyta lyklagrind gildi"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Change Call"
-msgstr "Hreyfimynd Breyta Kalli"
+msgstr "Útkall breyting símtal"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Add Track"
-msgstr "Hreyfimynd Bæta Við Rás"
+msgstr "Anim bæta við lag"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Duplicate Keys"
-msgstr "Hreyfimynd Tvöfalda Lykla"
+msgstr "Tvíteknir lyklar"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Move Anim Track Up"
-msgstr "Færa Hreyfimynda Rás Upp"
+msgstr "Færa Anim track upp"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Move Anim Track Down"
-msgstr "Færa Hreyfimynda Rás Niður"
+msgstr "Færa Anim track niður"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Remove Anim Track"
-msgstr "Fjarlægja Hreyfimynda Rás"
+msgstr "Fjarlægja Anim track"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Set Transitions to:"
-msgstr "Sitja Stöðuskipti á:"
+msgstr "Stillið breyting á:"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Track Rename"
-msgstr "Endurnefna Hreyfimyndarás"
+msgstr "Endurnefning Anim track"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Track Change Interpolation"
-msgstr "Breyta Brúun á Hreyfimyndarás"
+msgstr "Breytingar á Anim track"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Track Change Value Mode"
-msgstr ""
+msgstr "Breyta gildisstilling í Anim track"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Track Change Wrap Mode"
-msgstr ""
+msgstr "Anim track breyta hulum ham"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Edit Node Curve"
-msgstr ""
+msgstr "Breyta hnútnum Ferill"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Edit Selection Curve"
-msgstr ""
+msgstr "Breyta valferil"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Delete Keys"
-msgstr ""
+msgstr "Anim DELETE-lyklar"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
+#, fuzzy
msgid "Duplicate Selection"
-msgstr ""
+msgstr "Afrita val"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Duplicate Transposed"
-msgstr ""
+msgstr "Tvískipt transposed"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Remove Selection"
-msgstr ""
+msgstr "Fjarlægja val"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Continuous"
-msgstr ""
+msgstr "Samfellt"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Discrete"
-msgstr ""
+msgstr "Afmarkað"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Trigger"
-msgstr ""
+msgstr "Kveikja:"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Add Key"
-msgstr ""
+msgstr "Anim bæta við lykli"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Move Keys"
-msgstr ""
+msgstr "Færa lykla af Anim"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Scale Selection"
-msgstr ""
+msgstr "Val á kvarða"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
@@ -496,7 +523,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -906,11 +933,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1046,11 +1073,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1119,7 +1146,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1372,17 +1399,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1587,11 +1618,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1603,7 +1634,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1655,7 +1686,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1800,7 +1831,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1812,11 +1843,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1836,15 +1867,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2089,7 +2120,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2198,7 +2229,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2349,7 +2380,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2365,12 +2396,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2431,7 +2456,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2448,7 +2473,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2461,7 +2486,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2593,11 +2618,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2609,16 +2634,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Hreyfimynd Tvöfalda Lykla"
#: editor/filesystem_dock.cpp
@@ -2644,7 +2669,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2710,7 +2735,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2722,7 +2747,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2738,7 +2763,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2758,7 +2783,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3172,7 +3197,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3180,7 +3205,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3248,7 +3273,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3315,7 +3340,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3502,6 +3527,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3598,6 +3624,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3883,6 +3917,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3911,7 +3949,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4116,7 +4154,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4477,7 +4515,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4574,7 +4612,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4780,15 +4818,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5239,11 +5277,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5496,7 +5530,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5544,6 +5578,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5556,7 +5598,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5744,7 +5786,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5834,6 +5876,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6019,7 +6065,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6047,7 +6095,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6163,10 +6211,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6235,7 +6279,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6331,11 +6375,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6506,7 +6550,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7205,6 +7249,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7253,6 +7301,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7837,10 +7889,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/it.po b/editor/translations/it.po
index 1d1094ef30..2d566fe163 100644
--- a/editor/translations/it.po
+++ b/editor/translations/it.po
@@ -3,22 +3,25 @@
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
#
+# Alessio Corridori <alessiocorridori@hotmail.com>, 2018.
# Dario Bonfanti <bonfi.96@hotmail.it>, 2016-2017.
# Dario D'Ambra <legione0@gmail.com>, 2017.
# dariocavada <cavada@ectrlsolutions.com>, 2017.
# Elia Zanaboni <elia.zanaboni@gmail.com>, 2017.
# Giovanni Solimeno (Crax97) <gsolimeno97@gmail.com>, 2017.
# Marco Melorio <m.melorio@icloud.com>, 2017.
-# Myself <whatamidoing.wt@gmail.com>, 2017.
+# Matteo <matteo.guglielmetti@hotmail.it>, 2018.
+# Myself <whatamidoing.wt@gmail.com>, 2017-2018.
# RealAquilus <JamesHeller@live.it>, 2017.
+# Samuele Zolfanelli <samdazel@gmail.com>, 2018.
# Sean Bone <seanbone@zumguy.com>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2017-12-14 12:48+0000\n"
-"Last-Translator: anonymous <>\n"
+"PO-Revision-Date: 2018-05-18 16:39+0000\n"
+"Last-Translator: Alessio Corridori <alessiocorridori@hotmail.com>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/godot-engine/"
"godot/it/>\n"
"Language: it\n"
@@ -26,7 +29,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 2.18-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -505,13 +508,12 @@ msgid "Connecting Signal:"
msgstr "Connessione Segnali:"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect '%s' from '%s'"
-msgstr "Connetti '%s' a '%s'"
+msgstr "Disconnetti '%s' da '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Connetti.."
+msgid "Connect..."
+msgstr "Connetti..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -525,7 +527,7 @@ msgstr "Segnali"
#: editor/create_dialog.cpp
#, fuzzy
msgid "Change %s Type"
-msgstr "Cambia Tipo"
+msgstr "Cambia Tipo di %s"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -533,9 +535,8 @@ msgid "Change"
msgstr "Cambia"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Create New %s"
-msgstr "Crea Nuovo"
+msgstr "Crea Nuovo %s"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
@@ -646,9 +647,8 @@ msgstr ""
"Rimuoverli comunque? (no undo)"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Cannot remove:"
-msgstr "Impossibile rimouvere:\n"
+msgstr "Impossibile rimuovere:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
@@ -761,7 +761,7 @@ msgstr "Donatori Oro"
#: editor/editor_about.cpp
msgid "Silver Donors"
-msgstr "Sponsors Argento"
+msgstr "Donatori Argento"
#: editor/editor_about.cpp
msgid "Bronze Donors"
@@ -842,9 +842,8 @@ msgid "Rename Audio Bus"
msgstr "Rinomina Bus Audio"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Change Audio Bus Volume"
-msgstr "Imposta Bus Audio su Solo"
+msgstr "Cambia il volume del Bus Audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
@@ -909,7 +908,7 @@ msgstr "Elimina Effetto"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Audio"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
@@ -936,12 +935,12 @@ msgid "Move Audio Bus"
msgstr "Sposta bus audio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Salva Layout Bus Audio Come..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Posizione per Nuovo Layout.."
+msgid "Location for New Layout..."
+msgstr "Posizione per Nuovo Layout..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1082,21 +1081,20 @@ msgid "Updating Scene"
msgstr "Aggiornamento Scena"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Memorizzando i cambiamenti locali.."
+msgid "Storing local changes..."
+msgstr "Memorizzando i cambiamenti locali..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Aggiornando la scena.."
+msgid "Updating scene..."
+msgstr "Aggiornando la scena..."
#: editor/editor_data.cpp
-#, fuzzy
msgid "[empty]"
-msgstr "(vuoto)"
+msgstr "[vuoto]"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr ""
+msgstr "[non salvato]"
#: editor/editor_dir_dialog.cpp
msgid "Please select a base directory first"
@@ -1157,8 +1155,8 @@ msgid "Show In File Manager"
msgstr "Mostra nel File Manager"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nuova Cartella.."
+msgid "New Folder..."
+msgstr "Nuova Cartella..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1349,9 +1347,8 @@ msgid "Description"
msgstr "Descrizione"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Online Tutorials:"
-msgstr "Tutorials"
+msgstr "Tutorial online:"
#: editor/editor_help.cpp
#, fuzzy
@@ -1360,7 +1357,7 @@ msgid ""
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Al momento una descrizione per questo metodo non esiste. Aiutaci [color="
+"Al momento una descrizione per questa classe non esiste. Aiutaci [color="
"$color][url=$url]aggiungendone una[/url][/color]!"
#: editor/editor_help.cpp
@@ -1417,20 +1414,24 @@ msgstr "Rimuovi"
#: editor/editor_log.cpp
#, fuzzy
msgid "Clear Output"
-msgstr "Output"
+msgstr "Pulisci output"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Errore salvando la Risorsa!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Salva Risorsa Come.."
+msgid "Save Resource As..."
+msgstr "Salva Risorsa Come..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Capisco.."
+msgid "I see..."
+msgstr "Capisco..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1666,12 +1667,12 @@ msgid "Open Base Scene"
msgstr "Apri Scena Base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Apri scena rapido.."
+msgid "Quick Open Scene..."
+msgstr "Apri scena rapido..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Apri Script Rapido.."
+msgid "Quick Open Script..."
+msgstr "Apri Script Rapido..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1682,8 +1683,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Salvare le modifiche a '%s' prima di chiudere?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Salva Scena Come.."
+msgid "Save Scene As..."
+msgstr "Salva Scena Come..."
#: editor/editor_node.cpp
msgid "No"
@@ -1734,8 +1735,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Questa azione non può essere annullata. Ripristinare comunque?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Esegui Scena Rapido.."
+msgid "Quick Run Scene..."
+msgstr "Esegui Scena Rapido..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1895,8 +1896,8 @@ msgid "Previous tab"
msgstr "Scheda precedente"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtra Files.."
+msgid "Filter Files..."
+msgstr "Filtra Files..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1907,12 +1908,12 @@ msgid "New Scene"
msgstr "Nuova scena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Nuova Scena Ereditata.."
+msgid "New Inherited Scene..."
+msgstr "Nuova Scena Ereditata..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Apri Scena.."
+msgid "Open Scene..."
+msgstr "Apri Scena..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1931,16 +1932,16 @@ msgid "Open Recent"
msgstr "Apri Recente"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Converti In.."
+msgid "Convert To..."
+msgstr "Converti In..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2203,8 +2204,8 @@ msgid "Save the currently edited resource."
msgstr "Salva la risorsa in modifica."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Salva Come.."
+msgid "Save As..."
+msgstr "Salva Come..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2312,8 +2313,8 @@ msgid "Creating Mesh Previews"
msgstr "Creazione Anteprime Mesh"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatura.."
+msgid "Thumbnail..."
+msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2382,9 +2383,8 @@ msgid "Frame #:"
msgstr "Frame #:"
#: editor/editor_profiler.cpp
-#, fuzzy
msgid "Time"
-msgstr "Tempo:"
+msgstr "Tempo"
#: editor/editor_profiler.cpp
#, fuzzy
@@ -2469,7 +2469,7 @@ msgid "(Current)"
msgstr "(Corrente)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Recupero dei mirror, attendi..."
#: editor/export_template_manager.cpp
@@ -2485,21 +2485,13 @@ msgid "Invalid version.txt format inside templates."
msgstr "Formato di version.txt invalido nelle templates."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Formato di version.txt invalido nelle templates. Revision non é un "
-"identificatore valido."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Non é stato trovato version.txt all'interno di templates."
#: editor/export_template_manager.cpp
#, fuzzy
msgid "Error creating path for templates:"
-msgstr "Errore di creazione del percorso per le template:\n"
+msgstr "Errore di creazione del percorso per i template:"
#: editor/export_template_manager.cpp
msgid "Extracting Export Templates"
@@ -2534,9 +2526,8 @@ msgstr "Nessuna risposta."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Request Failed."
-msgstr "Rich. Fall."
+msgstr "Richiesta fallita."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2557,8 +2548,8 @@ msgid "Error requesting url: "
msgstr "Errore di connessione all'URL: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Connessione al mirror in corso.."
+msgid "Connecting to Mirror..."
+msgstr "Connessione al mirror in corso..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2574,13 +2565,13 @@ msgstr "Impossibile risolvere"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Connettendo.."
+msgid "Connecting..."
+msgstr "Connettendo..."
#: editor/export_template_manager.cpp
#, fuzzy
msgid "Can't Connect"
-msgstr "Impossibile connettersi"
+msgstr "Impossibile connettere."
#: editor/export_template_manager.cpp
msgid "Connected"
@@ -2588,8 +2579,8 @@ msgstr "Connesso"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Richiedendo.."
+msgid "Requesting..."
+msgstr "Richiedendo..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2600,7 +2591,6 @@ msgid "Connection Error"
msgstr "Errore di connessione"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "SSL Handshake Error"
msgstr "Errore nell'Handshake SSL"
@@ -2659,8 +2649,7 @@ msgstr "Visualizza elementi come una lista"
#, fuzzy
msgid "Status: Import of file failed. Please fix file and reimport manually."
msgstr ""
-"\n"
-"Stato: Importazione file fallita. Si prega di sistemare il file e "
+"Stato: Importazione file fallita. Si prega di riparare il file e "
"reimportarlo manualmente."
#: editor/filesystem_dock.cpp
@@ -2670,7 +2659,7 @@ msgstr "Impossibile spostare/rinominare risorse root."
#: editor/filesystem_dock.cpp
#, fuzzy
msgid "Cannot move a folder into itself."
-msgstr "Impossibile spostare una cartella in se stessa.\n"
+msgstr "Impossibile spostare una cartella in se stessa."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2678,14 +2667,12 @@ msgid "Error moving:"
msgstr "Errore spostamento:\n"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error duplicating:"
-msgstr "Errore in caricamento:"
+msgstr "Errore duplicazione:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Unable to update dependencies:"
-msgstr "Impossibile aggiornare le dipendenze:\n"
+msgstr "Impossibile aggiornare le dipendenze:"
#: editor/filesystem_dock.cpp
msgid "No name provided"
@@ -2716,14 +2703,12 @@ msgid "Renaming folder:"
msgstr "Rinomina cartella:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating file:"
-msgstr "duplica"
+msgstr "Duplicando file:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating folder:"
-msgstr "Rinomina cartella:"
+msgstr "Duplicando cartella:"
#: editor/filesystem_dock.cpp
msgid "Expand all"
@@ -2734,34 +2719,33 @@ msgid "Collapse all"
msgstr "Comprimi tutto"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Rinomina.."
+msgid "Rename..."
+msgstr "Rinomina..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Sposta in.."
+msgid "Move To..."
+msgstr "Sposta in..."
#: editor/filesystem_dock.cpp
#, fuzzy
msgid "Open Scene(s)"
-msgstr "Apri Scena"
+msgstr "Apri Scena/e"
#: editor/filesystem_dock.cpp
msgid "Instance"
msgstr "Istanza"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Modifica Dipendenze.."
+msgid "Edit Dependencies..."
+msgstr "Modifica Dipendenze..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Vedi Proprietari.."
+msgid "View Owners..."
+msgstr "Vedi Proprietari..."
#: editor/filesystem_dock.cpp
-#, fuzzy
-msgid "Duplicate.."
-msgstr "duplica"
+msgid "Duplicate..."
+msgstr "Duplica..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2786,10 +2770,10 @@ msgstr "Istanzia le scene selezionate come figlie del nodo selezionato."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Scansione File,\n"
-"Si prega di attendere.."
+"Si prega di attendere..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2854,22 +2838,21 @@ msgid "Import Scene"
msgstr "Importa Scena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Importando Scena.."
+msgid "Importing Scene..."
+msgstr "Importando Scena..."
#: editor/import/resource_importer_scene.cpp
-#, fuzzy
msgid "Generating Lightmaps"
-msgstr "Trasferisci a Lightmap:"
+msgstr "Generando Lightmap"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Generating for Mesh: "
-msgstr "Generando AABB"
+msgstr "Generando per Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Eseguendo Script Personalizzato.."
+msgid "Running Custom Script..."
+msgstr "Eseguendo Script Personalizzato..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2884,8 +2867,8 @@ msgid "Error running post-import script:"
msgstr "Errore di esecuzione dello script di post-import:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Salvataggio.."
+msgid "Saving..."
+msgstr "Salvataggio..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2904,8 +2887,8 @@ msgid "Import As:"
msgstr "Importa Come:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Preset.."
+msgid "Preset..."
+msgstr "Preset..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3114,15 +3097,16 @@ msgstr "Copia Animazione"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Onion Skinning"
-msgstr ""
+msgstr "Onion Skinning"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Enable Onion Skinning"
msgstr "Attiva Onion Skinning"
#: editor/plugins/animation_player_editor_plugin.cpp
+#, fuzzy
msgid "Directions"
-msgstr ""
+msgstr "Direzioni"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Past"
@@ -3143,12 +3127,12 @@ msgstr "1 Passo"
#: editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
msgid "2 steps"
-msgstr "2 Passi"
+msgstr "2 passi"
#: editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
msgid "3 steps"
-msgstr "3 Passi"
+msgstr "3 passi"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Differences Only"
@@ -3156,11 +3140,11 @@ msgstr "Solo Differenze"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Force White Modulate"
-msgstr ""
+msgstr "Forza Modulazione Bianca"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Include Gizmos (3D)"
-msgstr ""
+msgstr "Includi Gizmo (3D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create New Animation"
@@ -3325,16 +3309,16 @@ msgid "Transition Node"
msgstr "Nodo Transizione"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importa animazioni.."
+msgid "Import Animations..."
+msgstr "Importa animazioni..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Modifica Filtri Nodi"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filtri.."
+msgid "Filters..."
+msgstr "Filtri..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3402,8 +3386,8 @@ msgid "Fetching:"
msgstr "Recupero:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Risolvendo.."
+msgid "Resolving..."
+msgstr "Risolvendo..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3469,8 +3453,8 @@ msgid "Site:"
msgstr "Sito:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Supporta.."
+msgid "Support..."
+msgstr "Supporta..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3490,21 +3474,28 @@ msgid ""
"Save your scene (for images to be saved in the same dir), or pick a save "
"path from the BakedLightmap properties."
msgstr ""
+"Impossibile determinare un percorso di salvataggio per le immagini di "
+"lightmap.\n"
+"Salva la scena (per salvare le immagini nella stessa directory), o scegli un "
+"percorso di salvataggio nelle proprietà di BackedLightmap."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
"Light' flag is on."
msgstr ""
+"Nessuna mesh da preprocessare. Assicurarsi che contengano un canale UV2 e "
+"che la spunta 'Bake Light' sia abilitata."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
msgstr ""
+"Tentativo di creazione delle immagini di lightmap fallito, assicurarsi che "
+"il percorso dei file sia scrivibile."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
-#, fuzzy
msgid "Bake Lightmaps"
-msgstr "Trasferisci a Lightmap:"
+msgstr "Preprocessa Lightmaps"
#: editor/plugins/camera_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3662,6 +3653,7 @@ msgid "Use Rotation Snap"
msgstr "Usa lo Snap di Rotazione"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Configura Snap..."
@@ -3765,6 +3757,16 @@ msgid "Show Guides"
msgstr "Mostra guide"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Origin"
+msgstr "Visualizza Origine"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Viewport"
+msgstr "1 Vista"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centra Selezione"
@@ -4068,6 +4070,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "La mesh non ha superficie dalla quale creare un'outline!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Impossiblile creare outline!"
@@ -4096,8 +4102,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Crea Fratello di Collisione Convessa"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Crea Mesh di Outline.."
+msgid "Create Outline Mesh..."
+msgstr "Crea Mesh di Outline..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
@@ -4254,7 +4260,7 @@ msgstr "Creazione Octree Luci"
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "Stringhe Traducibili.."
+msgstr "Stringhe Traducibili..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
@@ -4276,7 +4282,7 @@ msgstr "Creazione Octree Texture"
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Creating polymesh..."
-msgstr "Crea Mesh di Outline.."
+msgstr "Crea Mesh di Outline..."
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
@@ -4317,8 +4323,8 @@ msgid "Error loading image:"
msgstr "Errore di caricamento immagine:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Nessun pixel con trasparenza >128 nell'immagine.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Nessun pixel con trasparenza >128 nell'immagine..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4684,8 +4690,8 @@ msgid "Import Theme"
msgstr "Importa Tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Salva Tema Come.."
+msgid "Save Theme As..."
+msgstr "Salva Tema Come..."
#: editor/plugins/script_editor_plugin.cpp
#, fuzzy
@@ -4787,8 +4793,8 @@ msgstr "Attiva Preferito"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Trova.."
+msgid "Find..."
+msgstr "Trova..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -5002,16 +5008,16 @@ msgid "Find Previous"
msgstr "Trova Precedente"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Rimpiazza.."
+msgid "Replace..."
+msgstr "Rimpiazza..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Vai a Funzione.."
+msgid "Goto Function..."
+msgstr "Vai a Funzione..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Vai a Linea.."
+msgid "Goto Line..."
+msgstr "Vai a Linea..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5471,12 +5477,8 @@ msgid "Transform"
msgstr "Transform"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configura Snap..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Finestra di Transform.."
+msgid "Transform Dialog..."
+msgstr "Finestra di Transform..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5735,7 +5737,7 @@ msgid "Remove All"
msgstr "Rimuovi"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Modifica Tema…"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5784,6 +5786,16 @@ msgid "Checked Item"
msgstr "Checked Item"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "Aggiungi Elemento"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "Checked Item"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Ha"
@@ -5796,7 +5808,8 @@ msgid "Options"
msgstr "Opzioni"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+#, fuzzy
+msgid "Has,Many,Options"
msgstr "Ha, Molte, Diverse, Opzioni!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5926,7 +5939,7 @@ msgstr "Unisci da scena?"
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet.."
+msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5993,7 +6006,7 @@ msgid "Presets"
msgstr "Presets"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Aggiungi..."
#: editor/project_export.cpp
@@ -6094,6 +6107,11 @@ msgstr "Progetto Importato"
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Nome Progetto:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Impossibile creare cartella."
@@ -6303,8 +6321,10 @@ msgid "Mouse Button"
msgstr "Pulsante Mouse"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Azione invalida (va bene tutto a parte '/' o ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6331,8 +6351,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Premi un tasto.."
+msgid "Press a Key..."
+msgstr "Premi un tasto..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6452,11 +6472,6 @@ msgstr "Elimina Input"
#: editor/project_settings_editor.cpp
#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "Impossibile connetersi all'host:"
-
-#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Already existing"
msgstr "Attiva Persistenza"
@@ -6519,15 +6534,15 @@ msgstr "Impostazioni Progetto (project.godot)"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr "Generali"
+msgstr "Informazioni Generali"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr "Proprietà:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Sovrascrivi Per.."
+msgid "Override For..."
+msgstr "Sovrascrivi Per..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6626,12 +6641,12 @@ msgid "Easing Out-In"
msgstr "Easing Out-In"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "File.."
+msgid "File..."
+msgstr "File..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Dir.."
+msgid "Dir..."
+msgstr "Dir..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6662,7 +6677,7 @@ msgstr "Mostra nel File System"
#: editor/property_editor.cpp
#, fuzzy
msgid "Convert To %s"
-msgstr "Converti In.."
+msgstr "Converti In..."
#: editor/property_editor.cpp
msgid "Error loading file: Not a resource!"
@@ -6809,8 +6824,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Questa operazione no può essere eseguita su scene istanziate."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Salva Nuova Scena Come.."
+msgid "Save New Scene As..."
+msgstr "Salva Nuova Scena Come..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7342,12 +7357,12 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Platform"
-msgstr "Copia A Piattaforma.."
+msgstr "Copia A Piattaforma..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Dynamic Library"
-msgstr "MeshLibrary.."
+msgstr "MeshLibrary..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
@@ -7361,7 +7376,7 @@ msgstr "GDNative"
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
msgid "Library"
-msgstr "MeshLibrary.."
+msgstr "MeshLibrary..."
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
@@ -7564,6 +7579,10 @@ msgstr "Impostazioni Snap"
msgid "Pick Distance:"
msgstr "Istanza:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
#, fuzzy
msgid "Generating solution..."
@@ -7621,6 +7640,10 @@ msgstr "Progetto"
msgid "Warnings"
msgstr "Avvertimento"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7825,7 +7848,7 @@ msgstr "Iteratore"
#: modules/visual_script/visual_script_editor.cpp
msgid "While"
-msgstr "Mentre"
+msgstr "While"
#: modules/visual_script/visual_script_editor.cpp
msgid "Return"
@@ -8311,12 +8334,22 @@ msgstr ""
"poter funzionare."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Solamente un WorldEnvironment è consentito per scena (o insieme di scene "
"istanziate)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8416,6 +8449,27 @@ msgstr "Errore caricamento font."
msgid "Invalid font size."
msgstr "Dimensione font Invalida."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Scheda precedente"
+
+#~ msgid "Next"
+#~ msgstr "Successivo"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Azione invalida (va bene tutto a parte '/' o ':')."
+
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Impossibile connetersi all'host:"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Formato di version.txt invalido nelle templates. Revision non é un "
+#~ "identificatore valido."
+
#~ msgid "Can't write file."
#~ msgstr "Impossibile scrivere il file."
@@ -8432,9 +8486,6 @@ msgstr "Dimensione font Invalida."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Impossibile creare project.godot nel percorso di progetto."
-#~ msgid "Next"
-#~ msgstr "Successivo"
-
#~ msgid "Not found!"
#~ msgstr "Non trovato!"
@@ -8580,8 +8631,8 @@ msgstr "Dimensione font Invalida."
#~ msgid "Exporting for %s"
#~ msgstr "Esportando per %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Impostando.."
+#~ msgid "Setting Up..."
+#~ msgstr "Impostando..."
#~ msgid "Error loading scene."
#~ msgstr "Errore di caricamento della scena."
@@ -8645,8 +8696,8 @@ msgstr "Dimensione font Invalida."
#~ msgid "Info"
#~ msgstr "Info"
-#~ msgid "Re-Import.."
-#~ msgstr "Re-Importa.."
+#~ msgid "Re-Import..."
+#~ msgstr "Re-Importa..."
#~ msgid "No bit masks to import!"
#~ msgstr "Nessuna bit mask da importare!"
@@ -9041,14 +9092,14 @@ msgstr "Dimensione font Invalida."
#~ msgid "Zoom (%):"
#~ msgstr "Zoom(%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Scheletro.."
+#~ msgid "Skeleton..."
+#~ msgstr "Scheletro..."
#~ msgid "Zoom Reset"
#~ msgstr "Zoom Reset"
-#~ msgid "Zoom Set.."
-#~ msgstr "Imposta Zoom.."
+#~ msgid "Zoom Set..."
+#~ msgstr "Imposta Zoom..."
#~ msgid "Set a Value"
#~ msgstr "Imposta un Valore"
@@ -9523,8 +9574,8 @@ msgstr "Dimensione font Invalida."
#~ msgid "Export Project PCK"
#~ msgstr "Esporta Progetto PCK"
-#~ msgid "Export.."
-#~ msgstr "Esporta.."
+#~ msgid "Export..."
+#~ msgstr "Esporta..."
#~ msgid "Project Export"
#~ msgstr "Esportazione Progetto"
@@ -9644,8 +9695,8 @@ msgstr "Dimensione font Invalida."
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "Ricarica Tool Script (Soft)"
-#~ msgid "Edit Connections.."
-#~ msgstr "Modifica Connessioni.."
+#~ msgid "Edit Connections..."
+#~ msgstr "Modifica Connessioni..."
#~ msgid "Set Params"
#~ msgstr "Imposta parametri"
@@ -9699,5 +9750,5 @@ msgstr "Dimensione font Invalida."
#~ msgid "Next Time:"
#~ msgstr "Prossima Volta:"
-#~ msgid "Merging.."
-#~ msgstr "Unione.."
+#~ msgid "Merging..."
+#~ msgstr "Unione..."
diff --git a/editor/translations/ja.po b/editor/translations/ja.po
index e53819c999..5ce73d0442 100644
--- a/editor/translations/ja.po
+++ b/editor/translations/ja.po
@@ -2,30 +2,31 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# akirakido <achts.y@gmail.com>, 2016-2017.
-# D_first <dntk.daisei@gmail.com>, 2017.
-# Daisuke Saito <d.saito@coriginate.com>, 2017.
+# D_first <dntk.daisei@gmail.com>, 2017, 2018.
+# Daisuke Saito <d.saito@coriginate.com>, 2017, 2018.
# h416 <shinichiro.hirama@gmail.com>, 2017.
-# hopping tappy (ãŸã£ã´ã•ã‚“) <hopping.tappy@gmail.com>, 2016-2017.
-# Jun Shiozawa <haresecret@gmail.com>, 2017.
+# hopping tappy (ãŸã£ã´ã•ã‚“) <hopping.tappy@gmail.com>, 2016-2017, 2018.
+# Jun Shiozawa <haresecret@gmail.com>, 2017, 2018.
# Lexi Grafen <shfeedly@gmail.com>, 2017.
# NoahDigital <taku_58@hotmail.com>, 2017.
+# Shinsuke Masuda <shinsuke.masuda@gmail.com>, 2018.
# Tetsuji Ochiai <ochiaixp@gmail.com>, 2017.
-# Tohru Ike (rokujyouhitoma) <rokujyouhitomajp@gmail.com>, 2017.
-#
+# Tohru Ike (rokujyouhitoma) <rokujyouhitomajp@gmail.com>, 2017-2018.
+# yu tang <0011solo@gmail.com>, 2018.
+# zukkun <zukkun@gmail.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-06 13:19+0000\n"
-"Last-Translator: NoahDigital <taku_58@hotmail.com>\n"
+"PO-Revision-Date: 2018-06-15 22:40+0000\n"
+"Last-Translator: yu tang <0011solo@gmail.com>\n"
"Language-Team: Japanese <https://hosted.weblate.org/projects/godot-engine/"
"godot/ja/>\n"
"Language: ja\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -41,14 +42,12 @@ msgid "Anim Change Keyframe Time"
msgstr "Anim 値を変更"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Transition"
-msgstr "Anim é·ç§»ï¼ˆãƒˆãƒ©ãƒ³ã‚¸ã‚·ãƒ§ãƒ³ï¼‰"
+msgstr "アニメーション 変化ã¨ãã®ç§»ã‚Šå¤‰ã‚り(トランジション)"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Transform"
-msgstr "Anim 変形(トランスフォーム)"
+msgstr "アニメーションã®ãƒˆãƒ©ãƒ³ã‚¹ãƒ•ォーム(変形)"
#: editor/animation_editor.cpp
#, fuzzy
@@ -66,9 +65,8 @@ msgid "Anim Add Track"
msgstr "Anim トラックを追加"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Duplicate Keys"
-msgstr "Anim キーを複製"
+msgstr "アニメーションã®ã‚­ãƒ¼ãƒ•レームを複製"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
@@ -84,7 +82,7 @@ msgstr "Anim トラックを削除"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr "ã“れã«ãƒˆãƒ©ãƒ³ã‚¸ã‚·ãƒ§ãƒ³ã‚’設定:"
+msgstr "トランジションを設定:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
@@ -114,7 +112,7 @@ msgstr "é¸æŠžæ›²ç·šã‚’ç·¨é›†"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
-msgstr "Anim キー削除"
+msgstr "アニメーションã®ã‚­ãƒ¼ãƒ•レームを削除"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
@@ -468,7 +466,6 @@ msgstr "追加"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_manager.cpp
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Remove"
msgstr "削除"
@@ -537,8 +534,8 @@ msgstr "'%s' ã‚’ '%s' ã«æŽ¥ç¶š"
#: editor/connections_dialog.cpp
#, fuzzy
-msgid "Connect.."
-msgstr "接続.."
+msgid "Connect..."
+msgstr "接続..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -581,7 +578,6 @@ msgstr "最近ã®:"
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp
-#, fuzzy
msgid "Search:"
msgstr "検索:"
@@ -640,7 +636,6 @@ msgstr "リソース"
#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
#: editor/project_manager.cpp editor/project_settings_editor.cpp
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Path"
msgstr "パス"
@@ -856,14 +851,12 @@ msgstr ""
"ãƒãƒ¼ãƒãƒ³ãƒˆã®è‘—作権ãŠã‚ˆã³ãƒ©ã‚¤ã‚»ãƒ³ã‚¹æ¡é …ã®å®Œå…¨ãªãƒªã‚¹ãƒˆã§ã™ã€‚"
#: editor/editor_about.cpp
-#, fuzzy
msgid "All Components"
-msgstr "コンテンツ:"
+msgstr "ã™ã¹ã¦ã®ã‚³ãƒ³ãƒãƒ¼ãƒãƒ³ãƒˆ(æ§‹æˆéƒ¨åˆ†)"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Components"
-msgstr "コンテンツ:"
+msgstr "コンãƒãƒ¼ãƒãƒ³ãƒˆ(æ§‹æˆéƒ¨åˆ†)"
#: editor/editor_about.cpp
#, fuzzy
@@ -871,9 +864,8 @@ msgid "Licenses"
msgstr "ライセンス"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
-#, fuzzy
msgid "Error opening package file, not in zip format."
-msgstr "zipå½¢å¼ã§ãªã„ãŸã‚パッケージをファイルを開ãéš›ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚"
+msgstr "パッケージファイルを開ã‘ã¾ã›ã‚“ã§ã—ãŸã€‚ zip å½¢å¼ã§ã¯ã‚りã¾ã›ã‚“。"
#: editor/editor_asset_installer.cpp
#, fuzzy
@@ -897,9 +889,8 @@ msgid "Install"
msgstr "インストール"
#: editor/editor_asset_installer.cpp
-#, fuzzy
msgid "Package Installer"
-msgstr "パッケージインストールæˆåŠŸ!"
+msgstr "パッケージインストーラー"
#: editor/editor_audio_buses.cpp
msgid "Speakers"
@@ -923,24 +914,23 @@ msgstr "オーディオãƒã‚¹ã‚’ソロã«åˆ‡ã‚Šæ›¿ãˆ"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Mute"
-msgstr "オーディオãƒã‚¹ã‚’ミュートã«åˆ‡ã‚Šæ›¿ãˆ"
+msgstr "オーディオãƒã‚¹ã‚’ミュート(無音)ã«åˆ‡ã‚Šæ›¿ãˆ"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Bypass Effects"
-msgstr "オーディオãƒã‚¹ã®ãƒã‚¤ãƒ‘スエフェクト切り替ãˆ"
+msgstr "オーディオãƒã‚¹ã®ãƒã‚¤ãƒ‘スエフェクトã®åˆ‡ã‚Šæ›¿ãˆ"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr "オーディオãƒã‚¹ã®é€ä¿¡å…ˆã‚’é¸æŠž"
+msgstr "オーディオãƒã‚¹ã®å‡ºåŠ›å…ˆã®é¸æŠž"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
msgstr "オーディオãƒã‚¹ã‚¨ãƒ•ェクトを追加"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Move Bus Effect"
-msgstr "ãƒã‚¹ã‚¨ãƒ•ェクトã®ç§»å‹•"
+msgstr "ãƒã‚¹ã‚¨ãƒ•ェクトを移動"
#: editor/editor_audio_buses.cpp
msgid "Delete Bus Effect"
@@ -952,11 +942,11 @@ msgstr "オーディオãƒã‚¹ã‚’ドラッグ・アンド・ドロップã§(å†)æ
#: editor/editor_audio_buses.cpp
msgid "Solo"
-msgstr "ソロ"
+msgstr "ソロ(独立)"
#: editor/editor_audio_buses.cpp
msgid "Mute"
-msgstr "ミュート"
+msgstr "ミュート(無音)"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
@@ -1010,12 +1000,12 @@ msgstr "オーディオãƒã‚¹ã‚’移動"
#: editor/editor_audio_buses.cpp
#, fuzzy
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "オーディオãƒã‚¹ã®ãƒ¬ã‚¤ã‚¢ã‚¦ãƒˆã‚’別åã§ä¿å­˜"
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "æ–°ã—ã„レイアウトã®å ´æ‰€.."
+msgid "Location for New Layout..."
+msgstr "æ–°ã—ã„レイアウトã®å ´æ‰€..."
#: editor/editor_audio_buses.cpp
#, fuzzy
@@ -1024,7 +1014,8 @@ msgstr "オーディオãƒã‚¹ã®ãƒ¬ã‚¤ã‚¢ã‚¦ãƒˆã‚’é–‹ã"
#: editor/editor_audio_buses.cpp
msgid "There is no 'res://default_bus_layout.tres' file."
-msgstr "'res://default_bus_layout.tres' ファイルãŒã‚りã¾ã›ã‚“."
+msgstr ""
+"リソースディレクトリã«ã€Œres://default_bus_layout.tresã€ãƒ•ァイルãŒã‚りã¾ã›ã‚“!"
#: editor/editor_audio_buses.cpp
msgid "Invalid file, not an audio bus layout."
@@ -1150,7 +1141,7 @@ msgstr "自動読ã¿è¾¼ã¿ã‚’çµ„ã¿æ›¿ãˆã‚‹"
#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
#: scene/gui/file_dialog.cpp
msgid "Path:"
-msgstr "Path:"
+msgstr "パス:"
#: editor/editor_autoload_settings.cpp
#, fuzzy
@@ -1159,7 +1150,6 @@ msgstr "ノードã®åå‰:"
#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
#: editor/project_manager.cpp editor/settings_config_dialog.cpp
-#, fuzzy
msgid "Name"
msgstr "åå‰"
@@ -1174,12 +1164,12 @@ msgstr "シーンを更新"
#: editor/editor_data.cpp
#, fuzzy
-msgid "Storing local changes.."
-msgstr "ローカル環境ã®å¤‰æ›´ã‚’ä¿å­˜ã™ã‚‹.."
+msgid "Storing local changes..."
+msgstr "ローカル環境ã®å¤‰æ›´ã‚’ä¿å­˜ã™ã‚‹..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "シーンを更新ã—ã¦ã„ã¾ã™.."
+msgid "Updating scene..."
+msgstr "シーンを更新ã—ã¦ã„ã¾ã™..."
#: editor/editor_data.cpp
#, fuzzy
@@ -1188,7 +1178,7 @@ msgstr "(空)"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr ""
+msgstr "(未ä¿å­˜)"
#: editor/editor_dir_dialog.cpp
#, fuzzy
@@ -1203,7 +1193,7 @@ msgstr "ディレクトリをé¸ã¶"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
msgid "Create Folder"
-msgstr "フォルダを作æˆã™ã‚‹"
+msgstr "フォルダーを作æˆ"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp
@@ -1242,9 +1232,8 @@ msgid "File Exists, Overwrite?"
msgstr "ãƒ•ã‚¡ã‚¤ãƒ«ãŒæ—¢ã«å­˜åœ¨ã—ã¾ã™ã€‚上書ãã—ã¾ã™ã‹ï¼Ÿ"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select Current Folder"
-msgstr "フォルダを作æˆã™ã‚‹"
+msgstr "ç¾åœ¨ã®ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ã‚’é¸æŠž"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
@@ -1255,8 +1244,8 @@ msgid "Show In File Manager"
msgstr "ファイルマãƒãƒ¼ã‚¸ãƒ£ãƒ¼ã§è¡¨ç¤º"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "フォルダを作æˆã™ã‚‹.."
+msgid "New Folder..."
+msgstr "フォルダを作æˆã™ã‚‹..."
#: editor/editor_file_dialog.cpp
#, fuzzy
@@ -1377,7 +1366,6 @@ msgstr "アセットを(å†ï¼‰ã‚¤ãƒ³ãƒãƒ¼ãƒˆ"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Search Help"
msgstr "ヘルプを検索"
@@ -1554,6 +1542,10 @@ msgstr "削除"
msgid "Clear Output"
msgstr "出力"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "エラーコード %d ã«ã‚ˆã‚Šã€ãƒ—ロジェクトã®ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã«å¤±æ•—ã—ã¾ã—ãŸã€‚"
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
msgid "Error saving resource!"
@@ -1561,14 +1553,14 @@ msgstr "リソースä¿å­˜ã‚¨ãƒ©ãƒ¼!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "~ã¨ã„ã†åå‰ã§ãƒªã‚½ãƒ¼ã‚¹ã‚’ä¿å­˜ã™ã‚‹"
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
#, fuzzy
-msgid "I see.."
-msgstr "ã‚ã‹ã£ãŸ.."
+msgid "I see..."
+msgstr "ã‚ã‹ã£ãŸ..."
#: editor/editor_node.cpp
#, fuzzy
@@ -1581,9 +1573,8 @@ msgid "Requested file format unknown:"
msgstr "ãã®ãƒ•ã‚¡ã‚¤ãƒ«ã¯æœªçŸ¥ã®ãƒ•ォーマットã§ã™:"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while saving."
-msgstr "ä¿å­˜ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒèµ·ãã¾ã—ãŸ."
+msgstr "ä¿å­˜ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚"
#: editor/editor_node.cpp
#, fuzzy
@@ -1591,9 +1582,8 @@ msgid "Can't open '%s'."
msgstr "'..'を処ç†ã§ãã¾ã›ã‚“"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while parsing '%s'."
-msgstr "ä¿å­˜ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒèµ·ãã¾ã—ãŸ."
+msgstr "「%sã€ã®è§£æžä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚"
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
@@ -1605,9 +1595,8 @@ msgid "Missing '%s' or its dependencies."
msgstr "シーン'%s' ã¯ä¾å­˜é–¢ä¿‚ãŒå£Šã‚Œã¦ã„ã¾ã™:"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Error while loading '%s'."
-msgstr "ä¿å­˜ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒèµ·ãã¾ã—ãŸ."
+msgstr "「%sã€ã®èª­è¾¼ä¸­ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚"
#: editor/editor_node.cpp
msgid "Saving Scene"
@@ -1832,13 +1821,13 @@ msgid "Open Base Scene"
msgstr "基本シーンを開ã"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "シーンã®ã‚¯ã‚¤ãƒƒã‚¯ã‚ªãƒ¼ãƒ—ン.."
+msgid "Quick Open Scene..."
+msgstr "シーンã®ã‚¯ã‚¤ãƒƒã‚¯ã‚ªãƒ¼ãƒ—ン..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "Quick Open Script.."
-msgstr "スクリプトã®ã‚¯ã‚¤ãƒƒã‚¯ã‚ªãƒ¼ãƒ—ン.."
+msgid "Quick Open Script..."
+msgstr "スクリプトã®ã‚¯ã‚¤ãƒƒã‚¯ã‚ªãƒ¼ãƒ—ン..."
#: editor/editor_node.cpp
#, fuzzy
@@ -1851,7 +1840,7 @@ msgstr "終了ã™ã‚‹å‰ã«ã€'%s' ã¸ã®å¤‰æ›´ã‚’ä¿å­˜ã—ã¾ã™ã‹ï¼Ÿ"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "~ã®åå‰ã§ã‚·ãƒ¼ãƒ³ã‚’ä¿å­˜ã™ã‚‹"
#: editor/editor_node.cpp
@@ -1914,7 +1903,7 @@ msgstr "ã“ã®ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã¯undoã§ãã¾ã›ã‚“. å…ƒã«æˆ»ã—ã¾ã™ã‹ï¼Ÿ"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "シーンをクイックランã™ã‚‹"
#: editor/editor_node.cpp
@@ -1926,14 +1915,12 @@ msgid "Exit the editor?"
msgstr "エディターを終了ã—ã¾ã™ã‹ï¼Ÿ"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Open Project Manager?"
-msgstr "プロジェクトマãƒãƒ¼ã‚¸ãƒ£ãƒ¼"
+msgstr "プロジェクトマãƒãƒ¼ã‚¸ãƒ£ãƒ¼ã‚’é–‹ãã¾ã™ã‹ï¼Ÿ"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Save & Quit"
-msgstr "ファイルをä¿å­˜"
+msgstr "ファイルをä¿å­˜ã—ã¦çµ‚了"
#: editor/editor_node.cpp
msgid "Save changes to the following scene(s) before quitting?"
@@ -2093,8 +2080,8 @@ msgstr "以å‰ã®ã‚¿ãƒ–"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Filter Files.."
-msgstr "ファイルを絞り込む.."
+msgid "Filter Files..."
+msgstr "ファイルを絞り込む..."
#: editor/editor_node.cpp
#, fuzzy
@@ -2108,13 +2095,13 @@ msgstr "æ–°ã—ã„シーン"
#: editor/editor_node.cpp
#, fuzzy
-msgid "New Inherited Scene.."
-msgstr "æ–°ã—ã„継承ã—ãŸã‚·ãƒ¼ãƒ³.."
+msgid "New Inherited Scene..."
+msgstr "æ–°ã—ã„継承ã—ãŸã‚·ãƒ¼ãƒ³..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "Open Scene.."
-msgstr "シーンを開ã.."
+msgid "Open Scene..."
+msgstr "シーンを開ã..."
#: editor/editor_node.cpp
#, fuzzy
@@ -2136,18 +2123,18 @@ msgstr "最近使ã£ãŸãƒ•ァイルを開ã"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Convert To.."
-msgstr "~ã«å¤‰æ›ã™ã‚‹.."
+msgid "Convert To..."
+msgstr "~ã«å¤‰æ›ã™ã‚‹..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "MeshLibrary.."
-msgstr "メッシュライブラリ.."
+msgid "MeshLibrary..."
+msgstr "メッシュライブラリ..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "TileSet.."
-msgstr "タイルセット.."
+msgid "TileSet..."
+msgstr "タイルセット..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2196,7 +2183,7 @@ msgstr "ツール"
#: editor/editor_node.cpp
msgid "Quit to Project List"
-msgstr "終了ã—ã¦ãƒ—ロジェクトリストを開ã"
+msgstr "終了ã—ã¦ãƒ—ロジェクト一覧を開ã"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
#, fuzzy
@@ -2336,7 +2323,6 @@ msgstr "クラス"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
#: editor/plugins/shader_editor_plugin.cpp editor/project_settings_editor.cpp
-#, fuzzy
msgid "Search"
msgstr "検索"
@@ -2355,7 +2341,6 @@ msgid "Issue Tracker"
msgstr "課題(ãƒã‚°ï¼‰ç®¡ç†ã‚·ã‚¹ãƒ†ãƒ "
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Community"
msgstr "コミュニティ"
@@ -2453,8 +2438,8 @@ msgid "Save the currently edited resource."
msgstr "ç¾åœ¨ç·¨é›†ä¸­ã®ãƒªã‚½ãƒ¼ã‚¹ã‚’ä¿å­˜ã™ã‚‹"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "åå‰ã‚’付ã‘ã¦ä¿å­˜.."
+msgid "Save As..."
+msgstr "åå‰ã‚’付ã‘ã¦ä¿å­˜..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2483,7 +2468,7 @@ msgstr "ベクトル定数を変更"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Import"
-msgstr "インãƒãƒ¼ãƒˆï¼ˆå–り込ã¿ï¼‰"
+msgstr "インãƒãƒ¼ãƒˆ"
#: editor/editor_node.cpp
#, fuzzy
@@ -2532,7 +2517,7 @@ msgstr "é–‹ã„ã¦ã‚¹ã‚¯ãƒªãƒ—トを実行ã™ã‚‹"
#: editor/editor_node.cpp
#, fuzzy
msgid "New Inherited"
-msgstr "æ–°ã—ã„継承ã—ãŸã‚·ãƒ¼ãƒ³.."
+msgstr "æ–°ã—ã„継承ã—ãŸã‚·ãƒ¼ãƒ³..."
#: editor/editor_node.cpp
msgid "Load Errors"
@@ -2571,8 +2556,8 @@ msgid "Creating Mesh Previews"
msgstr "メッシュライブラリを生æˆ"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "サムãƒã‚¤ãƒ«.."
+msgid "Thumbnail..."
+msgstr "サムãƒã‚¤ãƒ«..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2730,8 +2715,8 @@ msgid "(Current)"
msgstr "(ç¾åœ¨ã®ï¼‰"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "ミラーサイトをå–å¾—ã—ã¦ã„ã¾ã™ã€‚ã—ã°ã‚‰ããŠå¾…ã¡ãã ã•ã„.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "ミラーサイトをå–å¾—ã—ã¦ã„ã¾ã™ã€‚ã—ã°ã‚‰ããŠå¾…ã¡ãã ã•ã„..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2746,14 +2731,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "テンプレート内ã®version.txt フォーマットãŒä¸æ­£ã§ã™."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"テンプレート内ã®version.txt フォーマットãŒä¸æ­£ã§ã™. Revisionã¯æœ‰åйãªè­˜åˆ¥å­ã§"
-"ã¯ã‚りã¾ã›ã‚“."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "テンプレート内ã«version.txtãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“."
@@ -2822,8 +2799,8 @@ msgid "Error requesting url: "
msgstr "urlã®è¦æ±‚ã«å¤±æ•—ã—ã¾ã—ãŸ: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "ãƒŸãƒ©ãƒ¼ã‚µã‚¤ãƒˆã«æŽ¥ç¶šä¸­.."
+msgid "Connecting to Mirror..."
+msgstr "ãƒŸãƒ©ãƒ¼ã‚µã‚¤ãƒˆã«æŽ¥ç¶šä¸­..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2840,8 +2817,8 @@ msgstr "解決ã§ãã¾ã›ã‚“"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "接続中.."
+msgid "Connecting..."
+msgstr "接続中..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2854,8 +2831,8 @@ msgstr "接続ã—ã¾ã—ãŸ"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "リクエスト中.."
+msgid "Requesting..."
+msgstr "リクエスト中..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2919,7 +2896,7 @@ msgstr "サムãƒã‚¤ãƒ«è¡¨ç¤º"
#: editor/filesystem_dock.cpp
msgid "View items as a list"
-msgstr "リスト表示"
+msgstr "リストã§ã‚¢ã‚¤ãƒ†ãƒ ã‚’見る"
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -3001,12 +2978,12 @@ msgid "Collapse all"
msgstr "ã™ã¹ã¦æŠ˜ã‚ŠãŸãŸã‚€"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "åå‰ã‚’変更ã™ã‚‹.."
+msgid "Rename..."
+msgstr "åå‰ã‚’変更ã™ã‚‹..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "~ã¸ç§»å‹•ã™ã‚‹.."
+msgid "Move To..."
+msgstr "~ã¸ç§»å‹•ã™ã‚‹..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -3018,17 +2995,17 @@ msgid "Instance"
msgstr "インスタンス"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "ä¾å­˜é–¢ä¿‚を編集.."
+msgid "Edit Dependencies..."
+msgstr "ä¾å­˜é–¢ä¿‚を編集..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "View Owners.."
-msgstr "オーナーを見る.."
+msgid "View Owners..."
+msgstr "オーナーを見る..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "複製"
#: editor/filesystem_dock.cpp
@@ -3056,7 +3033,7 @@ msgstr "é¸æŠžã—ãŸãƒŽãƒ¼ãƒ‰ã®å­ã¨ã—ã¦ã€é¸æŠžã—ãŸã‚·ãƒ¼ãƒ³ã‚’インス
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"ファイルをスキャンã—ã¦ã„ã¾ã™\n"
"ã—ã°ã‚‰ããŠå¾…ã¡ä¸‹ã•ã„..."
@@ -3069,7 +3046,7 @@ msgstr "移動"
#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Rename"
-msgstr "åå‰ã‚’変更ã™ã‚‹"
+msgstr "åå‰ã®å¤‰æ›´"
#: editor/groups_editor.cpp
#, fuzzy
@@ -3084,12 +3061,12 @@ msgstr "グループã‹ã‚‰å–り除ã"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Import as Single Scene"
-msgstr "シーンをインãƒãƒ¼ãƒˆä¸­.."
+msgstr "シーンをインãƒãƒ¼ãƒˆä¸­..."
#: editor/import/resource_importer_scene.cpp
#, fuzzy
msgid "Import with Separate Animations"
-msgstr "アニメーションをインãƒãƒ¼ãƒˆ.."
+msgstr "アニメーションをインãƒãƒ¼ãƒˆ..."
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
@@ -3132,8 +3109,8 @@ msgstr "シーンをインãƒãƒ¼ãƒˆ"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
-msgid "Importing Scene.."
-msgstr "シーンをインãƒãƒ¼ãƒˆä¸­.."
+msgid "Importing Scene..."
+msgstr "シーンをインãƒãƒ¼ãƒˆä¸­..."
#: editor/import/resource_importer_scene.cpp
#, fuzzy
@@ -3147,7 +3124,7 @@ msgstr "軸平行境界ボックス(AABB)を生æˆ"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "カスタムスクリプトを実行中"
#: editor/import/resource_importer_scene.cpp
@@ -3168,8 +3145,8 @@ msgstr "インãƒãƒ¼ãƒˆæ¸ˆã¿ã®ã‚¹ã‚¯ãƒªãƒ—ト実行エラー"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
-msgid "Saving.."
-msgstr "ä¿å­˜ä¸­.."
+msgid "Saving..."
+msgstr "ä¿å­˜ä¸­..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -3190,8 +3167,8 @@ msgid "Import As:"
msgstr "~ã¨ã—ã¦ã‚¤ãƒ³ãƒãƒ¼ãƒˆ:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "åˆæœŸè¨­å®šå€¤.."
+msgid "Preset..."
+msgstr "åˆæœŸè¨­å®šå€¤..."
#: editor/import_dock.cpp
#, fuzzy
@@ -3675,8 +3652,8 @@ msgstr "トランジション(é·ç§»ï¼‰ãƒŽãƒ¼ãƒ‰"
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
-msgid "Import Animations.."
-msgstr "アニメーションをインãƒãƒ¼ãƒˆ.."
+msgid "Import Animations..."
+msgstr "アニメーションをインãƒãƒ¼ãƒˆ..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3684,8 +3661,8 @@ msgid "Edit Node Filters"
msgstr "ノードフィルターã®ç·¨é›†"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "フィルター.."
+msgid "Filters..."
+msgstr "フィルター..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3716,12 +3693,10 @@ msgid "Connection error, please try again."
msgstr "接続失敗 å†è©¦è¡Œã‚’"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Can't connect to host:"
msgstr "ãƒ›ã‚¹ãƒˆã«æŽ¥ç¶šã§ãã¾ã›ã‚“:"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "No response from host:"
msgstr "ホストã‹ã‚‰å¿œç­”ãŒã‚りã¾ã›ã‚“:"
@@ -3767,8 +3742,8 @@ msgstr "å–得中:"
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Resolving.."
-msgstr "解決中.."
+msgid "Resolving..."
+msgstr "解決中..."
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
@@ -3836,8 +3811,8 @@ msgid "Site:"
msgstr "サイト:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "サãƒãƒ¼ãƒˆ.."
+msgid "Support..."
+msgstr "サãƒãƒ¼ãƒˆ..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -4042,6 +4017,7 @@ msgid "Use Rotation Snap"
msgstr "回転スナップ機能を使ã†"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
msgid "Configure Snap..."
msgstr "スナップ機能ã®è¨­å®š"
@@ -4156,6 +4132,16 @@ msgstr "ボーンを表示ã™ã‚‹"
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
+msgid "Show Origin"
+msgstr "原点を見る"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Viewport"
+msgstr "1 ビューãƒãƒ¼ãƒˆ"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Center Selection"
msgstr "é¸æŠžå¯¾è±¡ã‚’ä¸­å¤®ã«"
@@ -4475,6 +4461,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "メッシュã«ã‚¢ã‚¦ãƒˆãƒ©ã‚¤ãƒ³ã‚’作æˆã™ã‚‹ãŸã‚ã®ã‚µãƒ¼ãƒ•ェイスãŒå­˜åœ¨ã—ã¾ã›ã‚“"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
msgid "Could not create outline!"
msgstr "アウトラインを生æˆã§ãã¾ã›ã‚“ã§ã—ãŸ!"
@@ -4507,8 +4497,8 @@ msgstr "凸型兄弟コリジョンを生æˆ"
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
-msgid "Create Outline Mesh.."
-msgstr "アウトラインメッシュを生æˆ.."
+msgid "Create Outline Mesh..."
+msgstr "アウトラインメッシュを生æˆ..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
@@ -4708,7 +4698,7 @@ msgstr "八分木テクスãƒãƒ£ã‚’生æˆ"
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Creating polymesh..."
-msgstr "アウトラインメッシュを生æˆ.."
+msgstr "アウトラインメッシュを生æˆ..."
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
@@ -4749,8 +4739,8 @@ msgstr "イメージ読ã¿è¾¼ã¿ã‚¨ãƒ©ãƒ¼:"
#: editor/plugins/particles_2d_editor_plugin.cpp
#, fuzzy
-msgid "No pixels with transparency > 128 in image.."
-msgstr "イメージ内ã«é€æ˜Žåº¦>128ã®ãƒ”クセルãŒã‚りã¾ã›ã‚“.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "イメージ内ã«é€æ˜Žåº¦>128ã®ãƒ”クセルãŒã‚りã¾ã›ã‚“..."
#: editor/plugins/particles_2d_editor_plugin.cpp
#, fuzzy
@@ -5170,8 +5160,8 @@ msgid "Import Theme"
msgstr "テーマã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆ"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "テーマをåå‰ã‚’ã¤ã‘ã¦ä¿å­˜.."
+msgid "Save Theme As..."
+msgstr "テーマをåå‰ã‚’ã¤ã‘ã¦ä¿å­˜..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -5209,7 +5199,7 @@ msgstr "ファイル"
#: editor/plugins/script_editor_plugin.cpp
msgid "New"
-msgstr "æ–°ã—ã„"
+msgstr "æ–°è¦ä½œæˆ"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save All"
@@ -5277,8 +5267,8 @@ msgstr "ãŠæ°—ã«å…¥ã‚Šã‚’切り替ãˆã‚‹"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
#, fuzzy
-msgid "Find.."
-msgstr "検索.."
+msgid "Find..."
+msgstr "検索..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -5499,18 +5489,18 @@ msgid "Find Previous"
msgstr "å‰ã‚’検索"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "ç½®ãæ›ãˆ.."
+msgid "Replace..."
+msgstr "ç½®ãæ›ãˆ..."
#: editor/plugins/script_text_editor.cpp
#, fuzzy
-msgid "Goto Function.."
-msgstr "関数~ã«ç§»å‹•.."
+msgid "Goto Function..."
+msgstr "関数~ã«ç§»å‹•..."
#: editor/plugins/script_text_editor.cpp
#, fuzzy
-msgid "Goto Line.."
-msgstr "~行ã«ç§»å‹•.."
+msgid "Goto Line..."
+msgstr "~行ã«ç§»å‹•..."
#: editor/plugins/script_text_editor.cpp
#, fuzzy
@@ -6004,13 +5994,8 @@ msgstr "トランスフォーム"
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
-msgid "Configure Snap.."
-msgstr "スナップ機能ã®è¨­å®š"
-
-#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
-msgid "Transform Dialog.."
-msgstr "トランスフォームã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°.."
+msgid "Transform Dialog..."
+msgstr "トランスフォームã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -6279,7 +6264,7 @@ msgid "Remove All"
msgstr "削除"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "テーマを編集..."
#: editor/plugins/theme_editor_plugin.cpp
@@ -6330,6 +6315,16 @@ msgid "Checked Item"
msgstr "ãƒã‚§ãƒƒã‚¯æ¸ˆã¿ã‚¢ã‚¤ãƒ†ãƒ "
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "アイテムを追加"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "ãƒã‚§ãƒƒã‚¯æ¸ˆã¿ã‚¢ã‚¤ãƒ†ãƒ "
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -6342,8 +6337,9 @@ msgid "Options"
msgstr "オプション"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "オプション"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -6477,7 +6473,7 @@ msgstr "シーンã‹ã‚‰ãƒžãƒ¼ã‚¸ã—ã¾ã™ã‹ï¼Ÿ"
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "タイルセット.."
+msgstr "タイルセット..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -6546,8 +6542,8 @@ msgid "Presets"
msgstr "åˆæœŸè¨­å®šå€¤"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "追加.."
+msgid "Add..."
+msgstr "追加..."
#: editor/project_export.cpp
msgid "Resources"
@@ -6645,9 +6641,8 @@ msgid "Please choose a 'project.godot' file."
msgstr "'project.godot' ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠžã—ã¦ãã ã•ã„."
#: editor/project_manager.cpp
-#, fuzzy
msgid "Please choose an empty folder."
-msgstr "'project.godot' ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠžã—ã¦ãã ã•ã„."
+msgstr "空ã®ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ã‚’é¸æŠžã—ã¦ãã ã•ã„。"
#: editor/project_manager.cpp
msgid "Imported Project"
@@ -6655,12 +6650,17 @@ msgstr "インãƒãƒ¼ãƒˆã•れãŸãƒ—ロジェクト"
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "プロジェクトå:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "フォルダを作æˆã§ãã¾ã›ã‚“ã§ã—ãŸã€‚"
#: editor/project_manager.cpp
msgid "There is already a folder in this path with the specified name."
-msgstr ""
+msgstr "ã“ã®ãƒ‘スã«ã¯ã€æŒ‡å®šã•れãŸåå‰ã®ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ãŒæ—¢ã«å­˜åœ¨ã—ã¾ã™ã€‚"
#: editor/project_manager.cpp
msgid "It would be a good idea to name your project."
@@ -6694,9 +6694,8 @@ msgid "The following files failed extraction from package:"
msgstr "以下ã®ãƒ•ァイルをパッケージã‹ã‚‰æŠ½å‡ºã§ãã¾ã›ã‚“ã§ã—ãŸ:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Rename Project"
-msgstr "åç„¡ã—ã®ãƒ—ロジェクト"
+msgstr "プロジェクトåã®å¤‰æ›´"
#: editor/project_manager.cpp
msgid "New Game Project"
@@ -6713,12 +6712,11 @@ msgstr "インãƒãƒ¼ãƒˆã—ã¦é–‹ã"
#: editor/project_manager.cpp
msgid "Create New Project"
-msgstr "æ–°ã—ã„プロジェクトを作る"
+msgstr "æ–°è¦ãƒ—ロジェクトを作æˆ"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create & Edit"
-msgstr "発光物を生æˆ"
+msgstr "作æˆã—ã¦ç·¨é›†"
#: editor/project_manager.cpp
msgid "Install Project:"
@@ -6730,14 +6728,12 @@ msgid "Install & Edit"
msgstr "インストール"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Project Name:"
msgstr "プロジェクトå:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create folder"
-msgstr "フォルダを作æˆã™ã‚‹"
+msgstr "フォルダを作æˆ"
#: editor/project_manager.cpp
msgid "Project Path:"
@@ -6745,16 +6741,15 @@ msgstr "プロジェクトパス:"
#: editor/project_manager.cpp
msgid "Browse"
-msgstr "ブラウズ"
+msgstr "å‚照…"
#: editor/project_manager.cpp
msgid "Unnamed Project"
msgstr "åç„¡ã—ã®ãƒ—ロジェクト"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Can't open project"
-msgstr "接続失敗."
+msgstr "プロジェクトを開ã‘ã¾ã›ã‚“"
#: editor/project_manager.cpp
msgid "Are you sure to open more than one project?"
@@ -6782,19 +6777,17 @@ msgid "Are you sure to run more than one project?"
msgstr "複数ã®ãƒ—ロジェクトを本当ã«å®Ÿè¡Œã—ã¾ã™ã‹ï¼Ÿ"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Remove project from the list? (Folder contents will not be modified)"
msgstr ""
-"リストã‹ã‚‰ãƒ—ロジェクトを除去ã—ã¾ã™ã‹ï¼Ÿï¼ˆãƒ•ォルダーã®ã‚³ãƒ³ãƒ†ãƒ³ãƒ„ã¯å½±éŸ¿ã‚’å—ã‘ã¾"
-"ã›ã‚“)"
+"一覧ã‹ã‚‰ãƒ—ロジェクトを削除ã—ã¾ã™ã‹ï¼Ÿï¼ˆãƒ•ォルダーã®å†…容ã¯å¤‰æ›´ã•れã¾ã›ã‚“)"
#: editor/project_manager.cpp
msgid ""
"Language changed.\n"
"The UI will update next time the editor or project manager starts."
msgstr ""
-"言語ãŒå¤‰æ›´ã•れã¾ã—ãŸ.\n"
-"エディタã¾ãŸã¯ãƒ—ロジェクトマãƒã‚¸ãƒ£ãƒ¼å†é–‹æ™‚ã«UIãŒæ›´æ–°ã•れã¾ã™."
+"言語ãŒå¤‰æ›´ã•れã¾ã—ãŸã€‚\n"
+"エディターã¾ãŸã¯ãƒ—ロジェクトマãƒãƒ¼ã‚¸ãƒ£ãƒ¼å†èµ·å‹•後ã«UIãŒæ›´æ–°ã•れã¾ã™ã€‚"
#: editor/project_manager.cpp
msgid ""
@@ -6808,7 +6801,7 @@ msgstr "プロジェクトマãƒãƒ¼ã‚¸ãƒ£ãƒ¼"
#: editor/project_manager.cpp
msgid "Project List"
-msgstr "プロジェクトã®ãƒªã‚¹ãƒˆ"
+msgstr "プロジェクト一覧"
#: editor/project_manager.cpp
msgid "Scan"
@@ -6820,32 +6813,31 @@ msgstr "スキャンã™ã‚‹ãƒ•ã‚©ãƒ«ãƒ€ãƒ¼ã‚’é¸æŠž"
#: editor/project_manager.cpp
msgid "New Project"
-msgstr "æ–°ã—ã„プロジェクト"
+msgstr "æ–°è¦ãƒ—ロジェクト"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Templates"
-msgstr "é¸æŠžã—ã¦ã„ã‚‹ã‚‚ã®ã‚’削除"
+msgstr "テンプレート"
#: editor/project_manager.cpp
msgid "Exit"
msgstr "終了"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Restart Now"
-msgstr "アニメーションを最åˆã‹ã‚‰å†ç”Ÿã™ã‚‹ :"
+msgstr "今ã™ãå†èµ·å‹•"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Can't run project"
-msgstr "接続失敗."
+msgstr "プロジェクトを実行ã§ãã¾ã›ã‚“"
#: editor/project_manager.cpp
msgid ""
"You don't currently have any projects.\n"
"Would you like to explore the official example projects in the Asset Library?"
msgstr ""
+"プロジェクトãŒä½•も登録ã•れã¦ã„ã¾ã›ã‚“。\n"
+"アセットライブラリã§å…¬å¼ã®ã‚µãƒ³ãƒ—ルプロジェクトをãƒã‚§ãƒƒã‚¯ã—ã¾ã™ã‹ï¼Ÿ"
#: editor/project_settings_editor.cpp
#, fuzzy
@@ -6867,8 +6859,10 @@ msgid "Mouse Button"
msgstr "マウスボタン"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "䏿­£ãªã‚¢ã‚¯ã‚·ãƒ§ãƒ³ï¼ˆ '/' ã¨':'ã¯ä¸å¯ã§ã™ï¼‰."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6897,8 +6891,8 @@ msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
#, fuzzy
-msgid "Press a Key.."
-msgstr "キーを押ã—ã¦ãã ã•ã„.."
+msgid "Press a Key..."
+msgstr "キーを押ã—ã¦ãã ã•ã„..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -7024,11 +7018,6 @@ msgstr "入力を消去"
#: editor/project_settings_editor.cpp
#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "ãƒ›ã‚¹ãƒˆã«æŽ¥ç¶šã§ãã¾ã›ã‚“:"
-
-#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Already existing"
msgstr "アクション'%s'ã¯æ—¢ã«ã‚りã¾ã™!"
@@ -7105,7 +7094,7 @@ msgid "Property:"
msgstr "プロパティ:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -7208,12 +7197,12 @@ msgid "Easing Out-In"
msgstr "イージング(Out-In)"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "ファイル.."
+msgid "File..."
+msgstr "ファイル..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "ディレクトリ.."
+msgid "Dir..."
+msgstr "ディレクトリ..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -7244,7 +7233,7 @@ msgstr "ファイルシステム上ã§è¡¨ç¤º"
#: editor/property_editor.cpp
#, fuzzy
msgid "Convert To %s"
-msgstr "~ã«å¤‰æ›ã™ã‚‹.."
+msgstr "~ã«å¤‰æ›ã™ã‚‹..."
#: editor/property_editor.cpp
#, fuzzy
@@ -7409,8 +7398,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "ã“ã®å‡¦ç†ã«ã¯ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹åŒ–ã•れãŸã‚·ãƒ¼ãƒ³ãŒå¿…è¦ã§ã™."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "æ–°è¦ã‚·ãƒ¼ãƒ³ã«åå‰ã‚’付ã‘ã¦ä¿å­˜.."
+msgid "Save New Scene As..."
+msgstr "æ–°è¦ã‚·ãƒ¼ãƒ³ã«åå‰ã‚’付ã‘ã¦ä¿å­˜..."
#: editor/scene_tree_dock.cpp
#, fuzzy
@@ -7984,12 +7973,12 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Platform"
-msgstr "プラットフォームã¸ã‚³ãƒ”ー.."
+msgstr "プラットフォームã¸ã‚³ãƒ”ー..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Dynamic Library"
-msgstr "メッシュライブラリ.."
+msgstr "メッシュライブラリ..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
@@ -7998,12 +7987,12 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "GDNativeLibrary"
-msgstr "メッシュライブラリ.."
+msgstr "メッシュライブラリ..."
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
msgid "Library"
-msgstr "メッシュライブラリ.."
+msgstr "メッシュライブラリ..."
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
@@ -8202,6 +8191,10 @@ msgstr "Snapã®è¨­å®š"
msgid "Pick Distance:"
msgstr "インスタンス:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
#, fuzzy
msgid "Generating solution..."
@@ -8258,6 +8251,10 @@ msgstr "プロジェクト"
msgid "Warnings"
msgstr "警告"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
#, fuzzy
msgid ""
@@ -8981,6 +8978,10 @@ msgstr ""
"ã™ã€‚"
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
#, fuzzy
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
@@ -8988,6 +8989,12 @@ msgstr ""
"1 ã¤ã ã‘ã® WorldEnvironment ã¯ã€ã‚·ãƒ¼ãƒ³ (ã¾ãŸã¯ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹åŒ–ã•れãŸã‚·ãƒ¼ãƒ³ã®"
"セット) ã”ã¨ã«è¨±å¯ã•れã¾ã™ã€‚"
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -9018,7 +9025,7 @@ msgstr "警告!"
#: scene/gui/dialogs.cpp
msgid "Please Confirm..."
-msgstr "確èªã—ã¦ãã ã•ã„。"
+msgstr "確èª"
#: scene/gui/file_dialog.cpp
#, fuzzy
@@ -9036,15 +9043,14 @@ msgstr ""
"らã¯å®Ÿè¡Œæ™‚ã«éžè¡¨ç¤ºã«ãªã‚Šã¾ã™ã€‚"
#: scene/gui/scroll_container.cpp
-#, fuzzy
msgid ""
"ScrollContainer is intended to work with a single child control.\n"
"Use a container as child (VBox,HBox,etc), or a Control and set the custom "
"minimum size manually."
msgstr ""
-"スクロールコンテナã¯å­ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ãŒå‹•作ã«å¿…è¦ã§ã™. VBox,HBoxãªã©ã®ã‚³ãƒ³ãƒ†ãƒŠ"
-"ã‚’å­ã¨ã™ã‚‹ã‹ã€ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ã‚’カスタム最å°ã‚µã‚¤ã‚ºã«ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ã§æŒ‡å®šã—ã¦ä½¿ç”¨ã—ã¦"
-"ãã ã•ã„."
+"ScrollContainerã¯å˜ä¸€ã®å­ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ã§å‹•作ã™ã‚‹ã‚ˆã†ã«æ„図ã•れã¦ã„ã¾ã™ã€‚コンテ"
+"ナ(VBox, HBoxãªã©)ã‚’å­ã¨ã—ã¦ä½¿ç”¨ã™ã‚‹ã‹ã€ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ«ã‚’使用ã—ã¦ã‚«ã‚¹ã‚¿ãƒ æœ€å°ã‚µ"
+"イズを手動ã§è¨­å®šã—ã¦ãã ã•ã„。"
#: scene/gui/tree.cpp
#, fuzzy
@@ -9088,6 +9094,27 @@ msgstr "フォント読ã¿è¾¼ã¿ã‚¨ãƒ©ãƒ¼ã€‚"
msgid "Invalid font size."
msgstr "無効ãªãƒ•ォント サイズã§ã™ã€‚"
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "以å‰ã®ã‚¿ãƒ–"
+
+#~ msgid "Next"
+#~ msgstr "次"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "䏿­£ãªã‚¢ã‚¯ã‚·ãƒ§ãƒ³ï¼ˆ '/' ã¨':'ã¯ä¸å¯ã§ã™ï¼‰."
+
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "ãƒ›ã‚¹ãƒˆã«æŽ¥ç¶šã§ãã¾ã›ã‚“:"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "テンプレート内ã®version.txt フォーマットãŒä¸æ­£ã§ã™. Revisionã¯æœ‰åйãªè­˜åˆ¥å­"
+#~ "ã§ã¯ã‚りã¾ã›ã‚“."
+
#~ msgid "Can't write file."
#~ msgstr "ãƒ•ã‚¡ã‚¤ãƒ«ã«æ›¸ãè¾¼ã¿ã§ãã¾ã›ã‚“ã§ã—ãŸ."
@@ -9102,9 +9129,6 @@ msgstr "無効ãªãƒ•ォント サイズã§ã™ã€‚"
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "project.godotをプロジェクトパスã«ç”Ÿæˆã§ãã¾ã›ã‚“ã§ã—ãŸ"
-#~ msgid "Next"
-#~ msgstr "次"
-
#~ msgid "Not found!"
#~ msgstr "見ã¤ã‹ã‚Šã¾ã›ã‚“!"
@@ -9256,8 +9280,8 @@ msgstr "無効ãªãƒ•ォント サイズã§ã™ã€‚"
#~ msgstr "%sã«ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆä¸­"
#, fuzzy
-#~ msgid "Setting Up.."
-#~ msgstr "セットアップ中.."
+#~ msgid "Setting Up..."
+#~ msgstr "セットアップ中..."
#, fuzzy
#~ msgid "Error loading scene."
@@ -9325,8 +9349,8 @@ msgstr "無効ãªãƒ•ォント サイズã§ã™ã€‚"
#~ msgstr "インフォーメーション"
#, fuzzy
-#~ msgid "Re-Import.."
-#~ msgstr "å†ã‚¤ãƒ³ãƒãƒ¼ãƒˆ.."
+#~ msgid "Re-Import..."
+#~ msgstr "å†ã‚¤ãƒ³ãƒãƒ¼ãƒˆ..."
#, fuzzy
#~ msgid "No bit masks to import!"
@@ -9821,15 +9845,15 @@ msgstr "無効ãªãƒ•ォント サイズã§ã™ã€‚"
#~ msgstr "ズーム (%):"
#, fuzzy
-#~ msgid "Skeleton.."
-#~ msgstr "スケルトン.."
+#~ msgid "Skeleton..."
+#~ msgstr "スケルトン..."
#~ msgid "Zoom Reset"
#~ msgstr "ズームをリセット"
#, fuzzy
-#~ msgid "Zoom Set.."
-#~ msgstr "ズームをセットã™ã‚‹.."
+#~ msgid "Zoom Set..."
+#~ msgstr "ズームをセットã™ã‚‹..."
#~ msgid "Set a Value"
#~ msgstr "値を設定ã™ã‚‹"
diff --git a/editor/translations/ko.po b/editor/translations/ko.po
index b80beb1273..be6b540a9a 100644
--- a/editor/translations/ko.po
+++ b/editor/translations/ko.po
@@ -2,19 +2,20 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
-# 박한얼 (volzhs) <volzhs@gmail.com>, 2016-2018.
# Ch <ccwpc@hanmail.net>, 2017.
# paijai 송 (fivejobi) <xotjq237@gmail.com>, 2018.
+# pgyage3263 <pgyage3263@naver.com>, 2018.
+# Sun Kim <perplexingsun@gmail.com>, 2018.
# TheRedPlanet <junmo.moon8@gmail.com>, 2018.
# Xavier Cho <mysticfallband@gmail.com>, 2018.
-#
+# 박한얼 (volzhs) <volzhs@gmail.com>, 2016-2018.
+# 송태섭 <xotjq237@gmail.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-02-04 04:40+0000\n"
-"Last-Translator: Xavier Cho <mysticfallband@gmail.com>\n"
+"PO-Revision-Date: 2018-06-07 16:40+0000\n"
+"Last-Translator: pgyage3263 <pgyage3263@naver.com>\n"
"Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/"
"godot/ko/>\n"
"Language: ko\n"
@@ -22,7 +23,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 2.19-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -38,7 +39,7 @@ msgstr "애니메ì´ì…˜ 키프레임 시간 변경"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "애니메ì´ì…˜ 변화 변경"
+msgstr "애니메ì´ì…˜ 전환 변경"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
@@ -74,7 +75,7 @@ msgstr "애니메ì´ì…˜ 트랙 ì‚­ì œ"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr "변화 설정:"
+msgstr "전환 설정:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
@@ -164,7 +165,7 @@ msgstr "비선형"
#: editor/animation_editor.cpp
msgid "In"
-msgstr "안"
+msgstr "In"
#: editor/animation_editor.cpp
msgid "Out"
@@ -180,7 +181,7 @@ msgstr "밖-안"
#: editor/animation_editor.cpp
msgid "Transitions"
-msgstr "변화"
+msgstr "전환"
#: editor/animation_editor.cpp
msgid "Optimize Animation"
@@ -321,7 +322,7 @@ msgstr "키"
#: editor/animation_editor.cpp
msgid "Transition"
-msgstr "변화"
+msgstr "전환"
#: editor/animation_editor.cpp
msgid "Scale Ratio:"
@@ -503,8 +504,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "'%s'와 '%s'ì˜ ì—°ê²° í•´ì œ"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "연결하기.."
+msgid "Connect..."
+msgstr "연결하기..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -895,7 +896,7 @@ msgstr "ì´íŽ™íŠ¸ ì‚­ì œ"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr "ìŒì„±"
+msgstr "오디오"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
@@ -922,12 +923,12 @@ msgid "Move Audio Bus"
msgstr "오디오 버스 ì´ë™"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "오디오 버스 ë ˆì´ì•„ì›ƒì„ ë‹¤ë¥¸ ì´ë¦„으로 저장.."
+msgid "Save Audio Bus Layout As..."
+msgstr "오디오 버스 ë ˆì´ì•„ì›ƒì„ ë‹¤ë¥¸ ì´ë¦„으로 저장..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "새 ë ˆì´ì•„ì›ƒì„ ì €ìž¥í•  장소.."
+msgid "Location for New Layout..."
+msgstr "새 ë ˆì´ì•„ì›ƒì„ ì €ìž¥í•  장소..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -965,7 +966,7 @@ msgstr "다른 ì´ë¦„으로 저장"
#: editor/editor_audio_buses.cpp
msgid "Save this Bus Layout to a file."
-msgstr "ì´ ë²„ìŠ¤ ë ˆì´ì•„ì›ƒì„ íŒŒì¼ë¡œ 저장합니다.."
+msgstr "ì´ ë²„ìŠ¤ ë ˆì´ì•„ì›ƒì„ íŒŒì¼ë¡œ 저장합니다..."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
msgid "Load Default"
@@ -1064,12 +1065,12 @@ msgid "Updating Scene"
msgstr "씬 ì—…ë°ì´íЏ 중"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "로컬 ë³€ê²½ì‚¬í•­ì„ ì €ìž¥ 중.."
+msgid "Storing local changes..."
+msgstr "로컬 ë³€ê²½ì‚¬í•­ì„ ì €ìž¥ 중..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "씬 ì—…ë°ì´íЏ 중.."
+msgid "Updating scene..."
+msgstr "씬 ì—…ë°ì´íЏ 중..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1137,8 +1138,8 @@ msgid "Show In File Manager"
msgstr "íŒŒì¼ ë§¤ë‹ˆì €ì—서 보기"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "새 í´ë”.."
+msgid "New Folder..."
+msgstr "새 í´ë”..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1397,18 +1398,22 @@ msgstr "지우기"
msgid "Clear Output"
msgstr "출력 지우기"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "프로ì íЏ 내보내기가 오류 코드 %d 로 실패했습니다."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "리소스 저장 중 ì—러!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "리소스를 다른 ì´ë¦„으로 저장.."
+msgid "Save Resource As..."
+msgstr "리소스를 다른 ì´ë¦„으로 저장..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "알겠습니다.."
+msgid "I see..."
+msgstr "알겠습니다..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1432,7 +1437,7 @@ msgstr "'%s' 파싱 중 ì—러."
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
-msgstr "예ìƒì¹˜ 못한 파ì¼ì˜ ë '%s' 입니다.."
+msgstr "예ìƒì¹˜ 못한 파ì¼ì˜ ë '%s' 입니다..."
#: editor/editor_node.cpp
msgid "Missing '%s' or its dependencies."
@@ -1634,12 +1639,12 @@ msgid "Open Base Scene"
msgstr "기본 씬 열기"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "빠른 씬 열기.."
+msgid "Quick Open Scene..."
+msgstr "빠른 씬 열기..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "빠른 스í¬ë¦½íЏ 열기.."
+msgid "Quick Open Script..."
+msgstr "빠른 스í¬ë¦½íЏ 열기..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1650,8 +1655,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "닫기 ì „ì— '%s' ì— ë³€ê²½ì‚¬í•­ì„ ì €ìž¥í•˜ì‹œê² ìŠµë‹ˆê¹Œ?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "ì”¬ì„ ë‹¤ë¥¸ ì´ë¦„으로 저장.."
+msgid "Save Scene As..."
+msgstr "ì”¬ì„ ë‹¤ë¥¸ ì´ë¦„으로 저장..."
#: editor/editor_node.cpp
msgid "No"
@@ -1702,8 +1707,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "ì´ í–‰ë™ì€ 취소가 불가능합니다. 무시하고 ë˜ëŒë¦¬ì‹œê² ìŠµë‹ˆê¹Œ?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "빠른 씬 실행.."
+msgid "Quick Run Scene..."
+msgstr "빠른 씬 실행..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1857,8 +1862,8 @@ msgid "Previous tab"
msgstr "ì´ì „ 탭"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "íŒŒì¼ í•„í„°ë§.."
+msgid "Filter Files..."
+msgstr "íŒŒì¼ í•„í„°ë§..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1869,12 +1874,12 @@ msgid "New Scene"
msgstr "새 씬"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "새 ìƒì† 씬.."
+msgid "New Inherited Scene..."
+msgstr "새 ìƒì† 씬..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "씬 열기.."
+msgid "Open Scene..."
+msgstr "씬 열기..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1893,16 +1898,16 @@ msgid "Open Recent"
msgstr "최근 ì—´ì—ˆë˜ í•­ëª©"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "변환.."
+msgid "Convert To..."
+msgstr "변환..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "메시 ë¼ì´ë¸ŒëŸ¬ë¦¬.."
+msgid "MeshLibrary..."
+msgstr "메시 ë¼ì´ë¸ŒëŸ¬ë¦¬..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "íƒ€ì¼ ì…‹.."
+msgid "TileSet..."
+msgstr "íƒ€ì¼ ì…‹..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2166,8 +2171,8 @@ msgid "Save the currently edited resource."
msgstr "현재 íŽ¸ì§‘ëœ ë¦¬ì†ŒìŠ¤ 저장."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "다른 ì´ë¦„으로 저장.."
+msgid "Save As..."
+msgstr "다른 ì´ë¦„으로 저장..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2275,8 +2280,8 @@ msgid "Creating Mesh Previews"
msgstr "메시 미리보기 ìƒì„± 중"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "ì¸ë„¤ì¼.."
+msgid "Thumbnail..."
+msgstr "ì¸ë„¤ì¼..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2428,8 +2433,8 @@ msgid "(Current)"
msgstr "(현재)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "미러를 가져오는 중입니다, 잠시만 기다리세요.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "미러를 가져오는 중입니다, 잠시만 기다리세요..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2444,14 +2449,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "템플릿 ì•ˆì— version.txtê°€ 유효하지 ì•Šì€ í˜•ì‹ìž…니다."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"í…œí”Œë¦¿ì— version.txt 형ì‹ì´ 유효하지 않습니다. ë¦¬ë¹„ì „ì€ ìœ íš¨í•œ ì‹ë³„ìžê°€ ì•„ë‹™"
-"니다."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "í…œí”Œë¦¿ì— version.txt를 ì°¾ì„ ìˆ˜ 없습니다."
@@ -2514,8 +2511,8 @@ msgid "Error requesting url: "
msgstr "url 요청 ì—러: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "ë¯¸ëŸ¬ì— ì—°ê²°ì¤‘.."
+msgid "Connecting to Mirror..."
+msgstr "ë¯¸ëŸ¬ì— ì—°ê²°ì¤‘..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2531,8 +2528,8 @@ msgstr "í•´ê²°í•  수 ì—†ìŒ"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "연결중.."
+msgid "Connecting..."
+msgstr "연결중..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2544,8 +2541,8 @@ msgstr "ì—°ê²°ë¨"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "요청중.."
+msgid "Requesting..."
+msgstr "요청중..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2677,12 +2674,12 @@ msgid "Collapse all"
msgstr "ëª¨ë‘ ì ‘ê¸°"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "ì´ë¦„ 변경.."
+msgid "Rename..."
+msgstr "ì´ë¦„ 변경..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "ì´ë™.."
+msgid "Move To..."
+msgstr "ì´ë™..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2693,16 +2690,16 @@ msgid "Instance"
msgstr "ì¸ìŠ¤í„´ìŠ¤"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "ì¢…ì† ê´€ê³„ 편집.."
+msgid "Edit Dependencies..."
+msgstr "ì¢…ì† ê´€ê³„ 편집..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "ì†Œìœ ìž ë³´ê¸°.."
+msgid "View Owners..."
+msgstr "ì†Œìœ ìž ë³´ê¸°..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "복제.."
+msgid "Duplicate..."
+msgstr "복제..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2727,10 +2724,10 @@ msgstr "ì„ íƒëœ ì”¬ì„ ì„ íƒëœ ë…¸ë“œì˜ ìžì‹ìœ¼ë¡œ ì¸ìŠ¤í„´ìŠ¤ 합니다
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"íŒŒì¼ ìŠ¤ìº”ì¤‘,\n"
-"잠시만 기다려주세요.."
+"잠시만 기다려주세요..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2795,8 +2792,8 @@ msgid "Import Scene"
msgstr "씬 가져오기"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "씬 가져오는 중.."
+msgid "Importing Scene..."
+msgstr "씬 가져오는 중..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2807,8 +2804,8 @@ msgid "Generating for Mesh: "
msgstr "메시를 위해 ìƒì„± 중: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "ì‚¬ìš©ìž ì •ì˜ ìŠ¤í¬ë¦½íЏ 실행중.."
+msgid "Running Custom Script..."
+msgstr "ì‚¬ìš©ìž ì •ì˜ ìŠ¤í¬ë¦½íЏ 실행중..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2824,8 +2821,8 @@ msgid "Error running post-import script:"
msgstr "가져오기 후 실행할 스í¬ë¦½íЏ 실행 중 ì—러:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "저장 중.."
+msgid "Saving..."
+msgstr "저장 중..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2844,8 +2841,8 @@ msgid "Import As:"
msgstr "ë‹¤ìŒ í˜•ì‹ìœ¼ë¡œ 가져오기:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "프리셋.."
+msgid "Preset..."
+msgstr "프리셋..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3259,19 +3256,19 @@ msgstr "시간 íƒìƒ‰ 노드"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Transition Node"
-msgstr "변화 노드"
+msgstr "전환 노드"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "애니메ì´ì…˜ 가져오기.."
+msgid "Import Animations..."
+msgstr "애니메ì´ì…˜ 가져오기..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "노드 필터 편집"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "í•„í„°.."
+msgid "Filters..."
+msgstr "í•„í„°..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3338,8 +3335,8 @@ msgid "Fetching:"
msgstr "가져오는 중:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "해결 중.."
+msgid "Resolving..."
+msgstr "해결 중..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3405,8 +3402,8 @@ msgid "Site:"
msgstr "사ì´íЏ:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "ì§€ì›.."
+msgid "Support..."
+msgstr "ì§€ì›..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3599,6 +3596,7 @@ msgid "Use Rotation Snap"
msgstr "회전 스냅 사용"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "스냅 설정..."
@@ -3695,6 +3693,14 @@ msgid "Show Guides"
msgstr "ê°€ì´ë“œ 보기"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "ì›ì  보기"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "ë·°í¬íЏ 보기"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "ì„ íƒ í•­ëª© 화면 ì¤‘ì•™ì— í‘œì‹œ"
@@ -3984,6 +3990,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "ë©”ì‹œì— ì™¸ê³½ì„ ì„ ë§Œë“¤ê¸° 위한 서피스가 없습니다!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "메시 기본 íƒ€ìž…ì´ PRIMITIVE_TRIANGLESì´ ì•„ë‹™ë‹ˆë‹¤!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "ì™¸ê³½ì„ ì„ ë§Œë“¤ìˆ˜ 없습니다!"
@@ -4012,8 +4022,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Convex ì¶©ëŒ í˜•ì œ 만들기"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "외곽선 메시 만들기.."
+msgid "Create Outline Mesh..."
+msgstr "외곽선 메시 만들기..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4217,8 +4227,8 @@ msgid "Error loading image:"
msgstr "ì´ë¯¸ì§€ 로드 ì—러:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "ì´ë¯¸ì§€ì— 투명ë„ê°€ 128보다 í° í”½ì…€ì´ ì—†ìŠµë‹ˆë‹¤.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "ì´ë¯¸ì§€ì— 투명ë„ê°€ 128보다 í° í”½ì…€ì´ ì—†ìŠµë‹ˆë‹¤..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4578,8 +4588,8 @@ msgid "Import Theme"
msgstr "테마 가져오기"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "테마 다른 ì´ë¦„으로 저장.."
+msgid "Save Theme As..."
+msgstr "테마 다른 ì´ë¦„으로 저장..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4615,7 +4625,7 @@ msgstr "파ì¼"
#: editor/plugins/script_editor_plugin.cpp
msgid "New"
-msgstr "새로운"
+msgstr "새 파ì¼"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save All"
@@ -4675,8 +4685,8 @@ msgstr "스í¬ë¦½íЏ íŒ¨ë„ í† ê¸€"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "찾기.."
+msgid "Find..."
+msgstr "찾기..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4883,16 +4893,16 @@ msgid "Find Previous"
msgstr "ì´ì „ 찾기"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "변경.."
+msgid "Replace..."
+msgstr "변경..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "함수로 ì´ë™.."
+msgid "Goto Function..."
+msgstr "함수로 ì´ë™..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "ë¼ì¸ìœ¼ë¡œ ì´ë™.."
+msgid "Goto Line..."
+msgstr "ë¼ì¸ìœ¼ë¡œ ì´ë™..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5345,12 +5355,8 @@ msgid "Transform"
msgstr "변형"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "스냅 설정.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "변형 다ì´ì–¼ë¡œê·¸.."
+msgid "Transform Dialog..."
+msgstr "변형 다ì´ì–¼ë¡œê·¸..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5602,8 +5608,8 @@ msgid "Remove All"
msgstr "ëª¨ë‘ ì‚­ì œ"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "테마 편집.."
+msgid "Edit theme..."
+msgstr "테마 편집..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5650,6 +5656,14 @@ msgid "Checked Item"
msgstr "항목 확ì¸ë¨"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "ë¼ë””오 항목"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "ë¼ë””오 항목 확ì¸ë¨"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "가진다"
@@ -5662,8 +5676,8 @@ msgid "Options"
msgstr "옵션"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "가진다,ë§Žì€,여러,옵션들!"
+msgid "Has,Many,Options"
+msgstr "가진다,ë§Žì€,옵션들"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5854,8 +5868,8 @@ msgid "Presets"
msgstr "프리셋"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "추가.."
+msgid "Add..."
+msgstr "추가..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5867,7 +5881,7 @@ msgstr "프로ì íŠ¸ì˜ ëª¨ë“  리소스 내보내기"
#: editor/project_export.cpp
msgid "Export selected scenes (and dependencies)"
-msgstr "ì„ íƒëœ 리소스 내보내기 (종ì†ëœ 리소스 í¬í•¨)"
+msgstr "ì„ íƒëœ 씬 내보내기 (종ì†ëœ 리소스 í¬í•¨)"
#: editor/project_export.cpp
msgid "Export selected resources (and dependencies)"
@@ -5944,6 +5958,10 @@ msgid "Imported Project"
msgstr "가져온 프로ì íЏ"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "ì¸ì‹í• ìˆ˜ 없는 프로ì íЏ 명입니다."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "í´ë”를 만들 수 없습니다."
@@ -5960,11 +5978,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "유효하지 ì•Šì€ í”„ë¡œì íЏ 경로 (뭔가 변경하신 ê±°ë¼ë„?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "프로ì íЏ ê²½ë¡œì— project.godot 파ì¼ì„ 편집할 수 없습니다."
+msgstr ""
+"프로ì íЏ 경로로 부터 project.godot 파ì¼ì„ 로드 í•  수 없습니다 (ì—러 %d). 존재"
+"하지 않거나 ì†ìƒë˜ì—ˆì„ 수 있습니다."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6140,8 +6159,12 @@ msgid "Mouse Button"
msgstr "마우스 버튼"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "유효하지 ì•Šì€ ì•¡ì…˜ ('/' ë˜ëŠ” ':' ë¬¸ìž ì‚¬ìš© 불가)."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"ì¸ì‹í• ìˆ˜ 없는 ì•¡ì…˜ ì´ë¦„입니다. 공백ì´ê±°ë‚˜, '/' , ':', '=', '\\', '\"' ê°€ í¬í•¨"
+"ë˜ë©´ 안 ë©ë‹ˆë‹¤."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6168,8 +6191,8 @@ msgid "Control+"
msgstr "컨트롤+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "키를 눌러주세요.."
+msgid "Press a Key..."
+msgstr "키를 눌러주세요..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6284,10 +6307,6 @@ msgid "Delete Item"
msgstr "ì•„ì´í…œ ì‚­ì œ"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "'/' ë˜ëŠ” ':' 문ìžë¥¼ í¬í•¨í•  수 ì—†ìŒ"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "ì´ë¯¸ 존재함"
@@ -6356,8 +6375,8 @@ msgid "Property:"
msgstr "ì†ì„±:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "재정ì˜.."
+msgid "Override For..."
+msgstr "재정ì˜..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6452,12 +6471,12 @@ msgid "Easing Out-In"
msgstr "ê°€ì†-ê°ì†"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "파ì¼.."
+msgid "File..."
+msgstr "파ì¼..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "디렉토리.."
+msgid "Dir..."
+msgstr "디렉토리..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6627,8 +6646,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "ì´ ìž‘ì—…ì€ ì¸ìŠ¤í„´ìŠ¤ëœ ì”¬ì—서는 불가합니다."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "새 ì”¬ì„ ë‹¤ë¥¸ ì´ë¦„으로 저장.."
+msgid "Save New Scene As..."
+msgstr "새 ì”¬ì„ ë‹¤ë¥¸ ì´ë¦„으로 저장..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -6806,15 +6825,15 @@ msgid ""
"Click to unlock"
msgstr ""
"노드가 잠겨있습니다.\n"
-"í´ë¦­í•´ì„œ 잠금해제 하십시오"
+"í´ë¦­í•˜ë©´ 잠금 í•´ì œë©ë‹ˆë‹¤"
#: editor/scene_tree_editor.cpp
msgid ""
"Children are not selectable.\n"
"Click to make selectable"
msgstr ""
-"ìžì‹ë“¤ì„ ì„ íƒ í•  수 없습니다.\n"
-"í´ë¦­í•´ì„œ ì„ íƒ í•  수 있게 하십시오"
+"ìžì‹ë“¤ì„ ì„ íƒí•  수 없습니다.\n"
+"í´ë¦­í•˜ë©´ ì„ íƒí•  수 있게 ë©ë‹ˆë‹¤"
#: editor/scene_tree_editor.cpp
msgid "Toggle Visibility"
@@ -7226,18 +7245,16 @@ msgid "Object can't provide a length."
msgstr "오브ì íŠ¸ëŠ” 길ì´ë¥¼ 제공할 수 없습니다."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "ë‹¤ìŒ íƒ­"
+msgstr "ë‹¤ìŒ í‰ë©´"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "ì´ì „ 탭"
+msgstr "ì´ì „ í‰ë©´"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "í‰ë©´:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7343,6 +7360,10 @@ msgstr "그리드맵 설정"
msgid "Pick Distance:"
msgstr "거리 ì„ íƒ:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "í´ëž˜ìФ ì´ë¦„ì€ í‚¤ì›Œë“œê°€ ë  ìˆ˜ 없습니다"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "솔루션 ìƒì„± 중..."
@@ -7373,7 +7394,7 @@ msgstr "모노"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "C# ì§€ì›ì— 대하여"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7391,6 +7412,10 @@ msgstr "프로ì íЏ 빌드"
msgid "Warnings"
msgstr "경고"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "ë‚´ë¶€ 예외 ìŠ¤íƒ ì¶”ì ì˜ ë"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7421,7 +7446,8 @@ msgstr "유효하지 ì•Šì€ ì‹œí€€ìŠ¤ ì¶œë ¥ì„ ë°˜í™˜í•œ 노드: "
#: modules/visual_script/visual_script.cpp
msgid "Found sequence bit but not the node in the stack, report bug!"
-msgstr "시퀀스 비트를 발견했지만 스íƒì•ˆì˜ 노드ì—는 없습니다, 버그를 기ë¡!"
+msgstr ""
+"시퀀스 비트를 발견했지만 스íƒì•ˆì˜ 노드ì—는 없습니다, 버그를 제보하세요!"
#: modules/visual_script/visual_script.cpp
msgid "Stack overflow with stack depth: "
@@ -7933,11 +7959,11 @@ msgstr "ARVROriginì€ ARVRCamera ìžì‹ 노드를 요구 함"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(ë‚¨ì€ ì‹œê°„: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8036,10 +8062,22 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Path ì†ì„±ì€ 유효한 Spatial 노드를 가리켜야 합니다."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment는 Environment 리소스가 필요합니다."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr "씬마다 WorldEnvironmentê°€ 단 하나만 허용ë©ë‹ˆë‹¤."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"ì´ WorldEnvironment는 무시ë©ë‹ˆë‹¤. (3D ì”¬ì„ ìœ„í•´) Camera를 추가하거나 아니면 "
+"(2D ì”¬ì„ ìœ„í•´) ì´ í™˜ê²½ì˜ ë°°ê²½ 모드를 Canvas로 설정하세요."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8135,6 +8173,26 @@ msgstr "í°íЏ 로딩 ì—러."
msgid "Invalid font size."
msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "ì´ì „ 탭"
+
+#~ msgid "Next"
+#~ msgstr "다ìŒ"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "유효하지 ì•Šì€ ì•¡ì…˜ ('/' ë˜ëŠ” ':' ë¬¸ìž ì‚¬ìš© 불가)."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "'/' ë˜ëŠ” ':' 문ìžë¥¼ í¬í•¨í•  수 ì—†ìŒ"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "í…œí”Œë¦¿ì— version.txt 형ì‹ì´ 유효하지 않습니다. ë¦¬ë¹„ì „ì€ ìœ íš¨í•œ ì‹ë³„ìžê°€ ì•„"
+#~ "닙니다."
+
#~ msgid "Can't write file."
#~ msgstr "파ì¼ì— 쓸 수 없습니다."
@@ -8147,9 +8205,6 @@ msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "프로ì íЏ ê²½ë¡œì— project.godot 파ì¼ì„ ì°¾ì„ ìˆ˜ 없습니다."
-#~ msgid "Next"
-#~ msgstr "다ìŒ"
-
#~ msgid "Not found!"
#~ msgstr "ì°¾ì„ ìˆ˜ ì—†ìŒ!"
@@ -8283,8 +8338,8 @@ msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
#~ msgid "Exporting for %s"
#~ msgstr "%s 내보내기"
-#~ msgid "Setting Up.."
-#~ msgstr "설정 중.."
+#~ msgid "Setting Up..."
+#~ msgstr "설정 중..."
#~ msgid "Error loading scene."
#~ msgstr "씬 로딩 중 ì—러."
@@ -8338,8 +8393,8 @@ msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
#~ msgid "Info"
#~ msgstr "ì •ë³´"
-#~ msgid "Re-Import.."
-#~ msgstr "다시 가져오기.."
+#~ msgid "Re-Import..."
+#~ msgstr "다시 가져오기..."
#~ msgid "No bit masks to import!"
#~ msgstr "가져올 비트 마스í¬ê°€ 없습니다!"
@@ -8731,14 +8786,14 @@ msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
#~ msgid "Zoom (%):"
#~ msgstr "확대 (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "스켈레톤.."
+#~ msgid "Skeleton..."
+#~ msgstr "스켈레톤..."
#~ msgid "Zoom Reset"
#~ msgstr "확대 초기화"
-#~ msgid "Zoom Set.."
-#~ msgstr "확대 설정.."
+#~ msgid "Zoom Set..."
+#~ msgstr "확대 설정..."
#~ msgid "Set a Value"
#~ msgstr "값 설정"
@@ -9169,8 +9224,8 @@ msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
#~ msgid "Export Project PCK"
#~ msgstr "프로ì íЏ PCK 내보내기"
-#~ msgid "Export.."
-#~ msgstr "내보내기.."
+#~ msgid "Export..."
+#~ msgstr "내보내기..."
#~ msgid "Project Export"
#~ msgstr "프로ì íЏ 내보내기"
@@ -9283,8 +9338,8 @@ msgstr "유효하지 ì•Šì€ í°íЏ í¬ê¸°."
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "툴 스í¬ë¦½íЏ 다시 로드 (소프트)"
-#~ msgid "Edit Connections.."
-#~ msgstr "연결 편집.."
+#~ msgid "Edit Connections..."
+#~ msgstr "연결 편집..."
#~ msgid "Set Params"
#~ msgstr "ì†ì„± ì ìš©"
diff --git a/editor/translations/lt.po b/editor/translations/lt.po
index 520e4fd1d8..bf4443627a 100644
--- a/editor/translations/lt.po
+++ b/editor/translations/lt.po
@@ -2,14 +2,12 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Ignas Kiela <ignaskiela@super.lt>, 2017.
-# Kornelijus <kornelijus.github@gmail.com>, 2017.
-#
+# Kornelijus <kornelijus.github@gmail.com>, 2017, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-11-27 00:48+0000\n"
+"PO-Revision-Date: 2018-06-12 09:40+0000\n"
"Last-Translator: Kornelijus <kornelijus.github@gmail.com>\n"
"Language-Team: Lithuanian <https://hosted.weblate.org/projects/godot-engine/"
"godot/lt/>\n"
@@ -18,7 +16,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=4; plural=n==1 ? 0 : n%10>=2 && (n%100<10 || n"
"%100>=20) ? 1 : n%10==0 || (n%100>10 && n%100<20) ? 2 : 3;\n"
-"X-Generator: Weblate 2.18-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -503,7 +501,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Prijungti '%s' prie '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -914,11 +912,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1054,11 +1052,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1127,7 +1125,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1380,17 +1378,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1595,11 +1597,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1611,7 +1613,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1663,7 +1665,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1808,7 +1810,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1820,11 +1822,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1844,15 +1846,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2018,11 +2020,11 @@ msgstr ""
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
msgid "Community"
-msgstr ""
+msgstr "BendruomenÄ—"
#: editor/editor_node.cpp
msgid "About"
-msgstr ""
+msgstr "Apie"
#: editor/editor_node.cpp
msgid "Play the project."
@@ -2097,7 +2099,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2206,8 +2208,8 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatūra.."
+msgid "Thumbnail..."
+msgstr "Miniatūra..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2358,7 +2360,7 @@ msgid "(Current)"
msgstr "(Esama)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2374,12 +2376,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Å ablonuose nerasta version.txt failo."
@@ -2441,7 +2437,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2458,7 +2454,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2471,7 +2467,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2607,11 +2603,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2623,16 +2619,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Duplikuoti"
#: editor/filesystem_dock.cpp
@@ -2658,7 +2654,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2724,7 +2720,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2736,7 +2732,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2752,7 +2748,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2772,7 +2768,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3188,8 +3184,8 @@ msgid "Transition Node"
msgstr "Transition Nodas"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importuoti Animacijas.."
+msgid "Import Animations..."
+msgstr "Importuoti Animacijas..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
@@ -3197,8 +3193,8 @@ msgstr "Redaguoti Nodų Filtrus"
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
-msgid "Filters.."
-msgstr "Filtrai.."
+msgid "Filters..."
+msgstr "Filtrai..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3266,7 +3262,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3333,7 +3329,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3520,6 +3516,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3616,6 +3613,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3901,6 +3906,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3929,7 +3938,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4134,7 +4143,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4495,7 +4504,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4592,7 +4601,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4798,15 +4807,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5258,11 +5267,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5515,7 +5520,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5563,6 +5568,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5575,7 +5588,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5763,7 +5776,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5853,6 +5866,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Netinkamas šrifto dydis."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6041,7 +6059,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6069,7 +6089,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6185,10 +6205,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6257,7 +6273,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6353,11 +6369,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6528,7 +6544,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7227,6 +7243,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7275,6 +7295,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7861,10 +7885,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/ms.po b/editor/translations/ms.po
new file mode 100644
index 0000000000..19d8b6b7d8
--- /dev/null
+++ b/editor/translations/ms.po
@@ -0,0 +1,7956 @@
+# Malay translation of the Godot Engine editor
+# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
+# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
+# This file is distributed under the same license as the Godot source code.
+#
+# Sam Vanguard <syafz119@gmail.com>, 2018.
+# Shaqir Rafiq <moshamoradev@gmail.com>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Godot Engine editor\n"
+"PO-Revision-Date: 2018-06-05 19:27+0000\n"
+"Last-Translator: Shaqir Rafiq <moshamoradev@gmail.com>\n"
+"Language-Team: Malay <https://hosted.weblate.org/projects/godot-engine/godot/"
+"ms/>\n"
+"Language: ms\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8-bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Weblate 3.0\n"
+
+#: editor/animation_editor.cpp
+msgid "Disabled"
+msgstr "Tidak Aktif"
+
+#: editor/animation_editor.cpp
+msgid "All Selection"
+msgstr "Semua Pilihan"
+
+#: editor/animation_editor.cpp
+#, fuzzy
+msgid "Anim Change Keyframe Time"
+msgstr "Anim Ubah Masa Keyframe"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Transition"
+msgstr "Anim Ubah Peralihan"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Transform"
+msgstr "Anim Ubah Penukaran"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Keyframe Value"
+msgstr "Anim Ubah Nilai Keyframe"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Call"
+msgstr "Anim Ubah Panggilan"
+
+#: editor/animation_editor.cpp
+msgid "Anim Add Track"
+msgstr "Anim Tambah Trek"
+
+#: editor/animation_editor.cpp
+msgid "Anim Duplicate Keys"
+msgstr "Anim Menduakan Kunci"
+
+#: editor/animation_editor.cpp
+msgid "Move Anim Track Up"
+msgstr "Ubah Trek Anim Ke Atas"
+
+#: editor/animation_editor.cpp
+msgid "Move Anim Track Down"
+msgstr "Ubah Trek Anim Ke Bawah"
+
+#: editor/animation_editor.cpp
+msgid "Remove Anim Track"
+msgstr "Buang Trek Anim"
+
+#: editor/animation_editor.cpp
+msgid "Set Transitions to:"
+msgstr "Set Peralihan ke:"
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Rename"
+msgstr "Ubah Nama Trek Anim"
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Change Interpolation"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Change Value Mode"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Change Wrap Mode"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Edit Node Curve"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Edit Selection Curve"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Delete Keys"
+msgstr ""
+
+#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Duplicate Selection"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Duplicate Transposed"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove Selection"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Continuous"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Discrete"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Trigger"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Add Key"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Move Keys"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Scale Selection"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Scale From Cursor"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Goto Next Step"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Goto Prev Step"
+msgstr ""
+
+#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
+#: editor/property_editor.cpp
+msgid "Linear"
+msgstr ""
+
+#: editor/animation_editor.cpp editor/plugins/theme_editor_plugin.cpp
+msgid "Constant"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "In"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Out"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "In-Out"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Out-In"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Transitions"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Optimize Animation"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-Up Animation"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Create NEW track for %s and insert key?"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Create %d NEW tracks and insert keys?"
+msgstr ""
+
+#: editor/animation_editor.cpp editor/create_dialog.cpp
+#: editor/editor_audio_buses.cpp editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp editor/script_create_dialog.cpp
+msgid "Create"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Create & Insert"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Insert Track & Key"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Insert Key"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Change Anim Len"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Change Anim Loop"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Create Typed Value Key"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Insert"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Scale Keys"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Add Call Track"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Animation zoom."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Length (s):"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Animation length (in seconds)."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Step (s):"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Cursor step snap (in seconds)."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Enable/Disable looping in animation."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Add new tracks."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Move current track up."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Move current track down."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove selected track."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Track tools"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Enable editing of individual keys by clicking them."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim. Optimizer"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Max. Linear Error:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Max. Angular Error:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Max Optimizable Angle:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Optimize"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Key"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Transition"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Scale Ratio:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Call Functions in Which Node?"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove invalid keys"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove unresolved and empty tracks"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-up all animations"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-Up Animation(s) (NO UNDO!)"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-Up"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Resize Array"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Change Array Value Type"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Change Array Value"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Go to Line"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Line Number:"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "No Matches"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replaced %d occurrence(s)."
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Match Case"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Whole Words"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replace"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replace All"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Selection Only"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Zoom In"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Zoom Out"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Reset Zoom"
+msgstr ""
+
+#: editor/code_editor.cpp editor/script_editor_debugger.cpp
+msgid "Line:"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Col:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Method in target Node must be specified!"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid ""
+"Target method not found! Specify a valid method or attach a script to target "
+"Node."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect To Node:"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
+#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
+msgid "Add"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/dependency_editor.cpp
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_manager.cpp
+#: editor/project_settings_editor.cpp
+msgid "Remove"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Add Extra Call Argument:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Extra Call Arguments:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Path to Node:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Make Function"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Deferred"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Oneshot"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/dependency_editor.cpp
+#: editor/export_template_manager.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/project_export.cpp
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+#: editor/run_settings_dialog.cpp editor/settings_config_dialog.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Close"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect '%s' to '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connecting Signal:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Disconnect '%s' from '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect..."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Disconnect"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
+msgid "Signals"
+msgstr ""
+
+#: editor/create_dialog.cpp
+msgid "Change %s Type"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/project_settings_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change"
+msgstr ""
+
+#: editor/create_dialog.cpp
+msgid "Create New %s"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp
+msgid "Favorites:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
+msgid "Recent:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_node.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
+#: editor/quick_open.cpp
+msgid "Search:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_help.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
+#: editor/quick_open.cpp
+msgid "Matches:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_help.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp editor/property_selector.cpp
+#: editor/script_editor_debugger.cpp
+msgid "Description:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Search Replacement For:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependencies For:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"Scene '%s' is currently being edited.\n"
+"Changes will not take effect unless reloaded."
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"Resource '%s' is in use.\n"
+"Changes will take effect when reloaded."
+msgstr ""
+
+#: editor/dependency_editor.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Dependencies"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Resource"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
+#: editor/project_manager.cpp editor/project_settings_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Path"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependencies:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Fix Broken"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependency Editor"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Search Replacement Resource:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_file_dialog.cpp
+#: editor/editor_help.cpp editor/editor_node.cpp editor/filesystem_dock.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
+#: editor/quick_open.cpp scene/gui/file_dialog.cpp
+msgid "Open"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Owners Of:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Remove selected files from the project? (no undo)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"The files being removed are required by other resources in order for them to "
+"work.\n"
+"Remove them anyway? (no undo)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Cannot remove:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Error loading:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Scene failed to load due to missing dependencies:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_node.cpp
+msgid "Open Anyway"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Which action should be taken?"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Fix Dependencies"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Errors loading!"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Permanently delete %d item(s)? (No undo!)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Owns"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Resources Without Explicit Ownership:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_node.cpp
+msgid "Orphan Resource Explorer"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Delete selected files?"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_audio_buses.cpp
+#: editor/editor_file_dialog.cpp editor/editor_node.cpp
+#: editor/filesystem_dock.cpp editor/plugins/item_list_editor_plugin.cpp
+#: editor/project_export.cpp editor/project_settings_editor.cpp
+#: editor/scene_tree_dock.cpp
+msgid "Delete"
+msgstr ""
+
+#: editor/dictionary_property_edit.cpp
+msgid "Change Dictionary Key"
+msgstr ""
+
+#: editor/dictionary_property_edit.cpp
+msgid "Change Dictionary Value"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thanks from the Godot community!"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thanks!"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Godot Engine contributors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Project Founders"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Lead Developer"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Project Manager "
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Developers"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Authors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Platinum Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Gold Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Mini Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Gold Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Silver Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Bronze Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "License"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thirdparty License"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid ""
+"Godot Engine relies on a number of thirdparty free and open source "
+"libraries, all compatible with the terms of its MIT license. The following "
+"is an exhaustive list of all such thirdparty components with their "
+"respective copyright statements and license terms."
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "All Components"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Components"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Licenses"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp editor/project_manager.cpp
+msgid "Error opening package file, not in zip format."
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+msgid "Uncompressing Assets"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp editor/project_manager.cpp
+msgid "Package Installed Successfully!"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Success!"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Install"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+msgid "Package Installer"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Speakers"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Rename Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Change Audio Bus Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Solo"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Mute"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Bypass Effects"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Select Audio Bus Send"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Audio Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Move Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Audio Bus, Drag and Drop to rearrange."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Solo"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Mute"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Bypass"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Bus options"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/filesystem_dock.cpp
+#: editor/plugins/tile_map_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Duplicate"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Reset Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Audio"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Master bus can't be deleted!"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Duplicate Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Reset Bus Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Move Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save Audio Bus Layout As..."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Location for New Layout..."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Open Audio Bus Layout"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "There is no 'res://default_bus_layout.tres' file."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Invalid file, not an audio bus layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Create a new Bus Layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/property_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Load"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Load an existing Bus Layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save As"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save this Bus Layout to a file."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/import_dock.cpp
+msgid "Load Default"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Load the default Bus Layout."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Valid characters:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing engine class name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing buit-in type name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing global constant name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid Path."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "File does not exist."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Not in resource path."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Add AutoLoad"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Autoload '%s' already exists!"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Rename Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Toggle AutoLoad Globals"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Move Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Remove Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Enable"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Rearrange Autoloads"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
+#: scene/gui/file_dialog.cpp
+msgid "Path:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Node Name:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
+#: editor/project_manager.cpp editor/settings_config_dialog.cpp
+msgid "Name"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Singleton"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Updating Scene"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Storing local changes..."
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Updating scene..."
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "[empty]"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "[unsaved]"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Please select a base directory first"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Choose a Directory"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
+msgid "Create Folder"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
+#: scene/gui/file_dialog.cpp
+msgid "Name:"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
+msgid "Could not create folder."
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Choose"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "Storing File:"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "Packing"
+msgstr ""
+
+#: editor/editor_export.cpp platform/javascript/export/export.cpp
+msgid "Template file not found:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "File Exists, Overwrite?"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Select Current Folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "Copy Path"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "Show In File Manager"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "New Folder..."
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Refresh"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "All Recognized"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "All Files (*)"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a File"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open File(s)"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a Directory"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a File or Directory"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/editor_node.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp scene/gui/file_dialog.cpp
+msgid "Save"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Save a File"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Back"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Forward"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Up"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Hidden Files"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Favorite"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Mode"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Focus Path"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Move Favorite Up"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Move Favorite Down"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Go to parent folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Directories & Files:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Preview:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/script_editor_debugger.cpp
+#: scene/gui/file_dialog.cpp
+msgid "File:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Must use a valid extension."
+msgstr ""
+
+#: editor/editor_file_system.cpp
+msgid "ScanSources"
+msgstr ""
+
+#: editor/editor_file_system.cpp
+msgid "(Re)Importing Assets"
+msgstr ""
+
+#: editor/editor_help.cpp editor/editor_node.cpp
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search Help"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Class List:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Search Classes"
+msgstr ""
+
+#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
+msgid "Top"
+msgstr ""
+
+#: editor/editor_help.cpp editor/property_editor.cpp
+msgid "Class:"
+msgstr ""
+
+#: editor/editor_help.cpp editor/scene_tree_editor.cpp
+msgid "Inherits:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Inherited by:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Brief Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Members"
+msgstr ""
+
+#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Members:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Public Methods"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Public Methods:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "GUI Theme Items"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "GUI Theme Items:"
+msgstr ""
+
+#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Signals:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Enumerations"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Enumerations:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "enum "
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Constants"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Constants:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Description"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Online Tutorials:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There are currently no tutorials for this class, you can [color=$color][url="
+"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
+"url][/color]."
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Properties"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Property Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There is currently no description for this property. Please help us by "
+"[color=$color][url=$url]contributing one[/url][/color]!"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Methods"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Method Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There is currently no description for this method. Please help us by [color="
+"$color][url=$url]contributing one[/url][/color]!"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Search Text"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Find"
+msgstr ""
+
+#: editor/editor_log.cpp
+msgid "Output:"
+msgstr ""
+
+#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/property_editor.cpp editor/script_editor_debugger.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Clear"
+msgstr ""
+
+#: editor/editor_log.cpp
+msgid "Clear Output"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Error saving resource!"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save Resource As..."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
+#: editor/scene_tree_dock.cpp
+msgid "I see..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't open file for writing:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Requested file format unknown:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while saving."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't open '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while parsing '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unexpected end of file '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Missing '%s' or its dependencies."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while loading '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Saving Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Analyzing"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Creating Thumbnail"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a tree root."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
+"be satisfied."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Failed to load resource."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't load MeshLibrary for merging!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error saving MeshLibrary!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't load TileSet for merging!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error saving TileSet!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error trying to save layout!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Default editor layout overridden."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Layout name not found!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Restored default layout to base settings."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource belongs to a scene that was imported, so it's not editable.\n"
+"Please read the documentation relevant to importing scenes to better "
+"understand this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource belongs to a scene that was instanced or inherited.\n"
+"Changes to it will not be kept when saving the current scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource was imported, so it's not editable. Change its settings in the "
+"import panel and then re-import."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This scene was imported, so changes to it will not be kept.\n"
+"Instancing it or inheriting will allow making changes to it.\n"
+"Please read the documentation relevant to importing scenes to better "
+"understand this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This is a remote object so changes to it will not be kept.\n"
+"Please read the documentation relevant to debugging to better understand "
+"this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Expand all properties"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Collapse all properties"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Copy Params"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Paste Params"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Paste Resource"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Copy Resource"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Make Built-In"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Make Sub-Resources Unique"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open in Help"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "There is no defined scene to run."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"No main scene has ever been defined, select one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Selected scene '%s' does not exist, select a valid one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Selected scene '%s' is not a scene file, select a valid one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Current scene was never saved, please save it prior to running."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Could not start subprocess!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Base Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Open Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Open Script..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save & Close"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes to '%s' before closing?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Scene As..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "No"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Yes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This scene has never been saved. Save before running?"
+msgstr ""
+
+#: editor/editor_node.cpp editor/scene_tree_dock.cpp
+msgid "This operation can't be done without a scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Mesh Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a root node."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Tile Set"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a selected node."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Current scene not saved. Open anyway?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't reload a scene that was never saved."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Revert"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This action cannot be undone. Revert anyway?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Run Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quit"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Exit the editor?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Project Manager?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save & Quit"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes to the following scene(s) before quitting?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes the following scene(s) before opening Project Manager?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This option is deprecated. Situations where refresh must be forced are now "
+"considered a bug. Please report."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pick a Main Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to load addon script from path: '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Unable to load addon script from path: '%s' Base type is not EditorPlugin."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Scene '%s' was automatically imported, so it can't be modified.\n"
+"To make changes to it, a new inherited scene can be created."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Ugh"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Error loading scene, it must be inside the project path. Use 'Import' to "
+"open the scene, then save it inside the project path."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Scene '%s' has broken dependencies:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Clear Recent Scenes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Layout"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Delete Layout"
+msgstr ""
+
+#: editor/editor_node.cpp editor/import_dock.cpp
+#: editor/script_create_dialog.cpp
+msgid "Default"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Switch Scene Tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more files or folders"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more folders"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more files"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Dock Position"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Distraction Free Mode"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Toggle distraction-free mode."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Add a new scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to previously opened scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Next tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Previous tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Filter Files..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Operations with scene files."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Inherited Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save all Scenes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Close Scene"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Open Recent"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Convert To..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "MeshLibrary..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "TileSet..."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Undo"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
+#: scene/gui/line_edit.cpp
+msgid "Redo"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Revert Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Miscellaneous project or scene-wide tools."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project Settings"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Run Script"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Export"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Tools"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quit to Project List"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Debug"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Deploy with Remote Debug"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When exporting or deploying, the resulting executable will attempt to "
+"connect to the IP of this computer in order to be debugged."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Small Deploy with Network FS"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is enabled, export or deploy will produce a minimal "
+"executable.\n"
+"The filesystem will be provided from the project by the editor over the "
+"network.\n"
+"On Android, deploy will use the USB cable for faster performance. This "
+"option speeds up testing for games with a large footprint."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Visible Collision Shapes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
+"running game if this option is turned on."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Visible Navigation"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Navigation meshes and polygons will be visible on the running game if this "
+"option is turned on."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Sync Scene Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is turned on, any changes made to the scene in the editor "
+"will be replicated in the running game.\n"
+"When used remotely on a device, this is more efficient with network "
+"filesystem."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Sync Script Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is turned on, any script that is saved will be reloaded on "
+"the running game.\n"
+"When used remotely on a device, this is more efficient with network "
+"filesystem."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Editor"
+msgstr ""
+
+#: editor/editor_node.cpp editor/settings_config_dialog.cpp
+msgid "Editor Settings"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Editor Layout"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Toggle Fullscreen"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Manage Export Templates"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Help"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Classes"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/shader_editor_plugin.cpp editor/project_settings_editor.cpp
+msgid "Search"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Online Docs"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Q&A"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Issue Tracker"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+msgid "Community"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "About"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play the project."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pause the scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pause Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Stop the scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Stop"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play the edited scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play custom scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play Custom Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Spins when the editor window repaints!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Update Always"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Update Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Disable Update Spinner"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Inspector"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Create a new resource in memory and edit it."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Load an existing resource from disk and edit it."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save the currently edited resource."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Save As..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to the previous edited object in history."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to the next edited object in history."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "History of recently edited objects."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Object properties."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Changes may be lost!"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_manager.cpp
+msgid "Import"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Node"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "FileSystem"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Output"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Don't Save"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Import Templates From ZIP File"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Export Project"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Merge With Existing"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Password:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open & Run a Script"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Inherited"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Load Errors"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
+msgid "Select"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open 2D Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open 3D Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Script Editor"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_manager.cpp
+msgid "Open Asset Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open the next Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open the previous Editor"
+msgstr ""
+
+#: editor/editor_plugin.cpp
+msgid "Creating Mesh Previews"
+msgstr ""
+
+#: editor/editor_plugin.cpp
+msgid "Thumbnail..."
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Installed Plugins:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Update"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Version:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Author:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Status:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Stop Profiling"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Start Profiling"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Measure:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame Time (sec)"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Average Time (sec)"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame %"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Physics Frame %"
+msgstr ""
+
+#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
+msgid "Time:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Inclusive"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Self"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame #:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Time"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Calls"
+msgstr ""
+
+#: editor/editor_run_native.cpp
+msgid "Select device from the list"
+msgstr ""
+
+#: editor/editor_run_native.cpp
+msgid ""
+"No runnable export preset found for this platform.\n"
+"Please add a runnable preset in the export menu."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Write your logic in the _run() method."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "There is an edited scene already."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Couldn't instance script:"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Did you forget the 'tool' keyword?"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Couldn't run script:"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Did you forget the '_run' method?"
+msgstr ""
+
+#: editor/editor_settings.cpp
+msgid "Default (Same as Editor)"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Select Node(s) to Import"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Scene Path:"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Import From Node:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Re-Download"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Uninstall"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Installed)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Missing)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Current)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Retrieving mirrors, please wait..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Remove template version '%s'?"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't open export templates zip."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Invalid version.txt format inside templates."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "No version.txt found inside templates."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Error creating path for templates:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Extracting Export Templates"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Importing:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid ""
+"No download links found for this version. Direct download is only available "
+"for official releases."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't resolve."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't connect."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "No response."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request Failed."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Redirect Loop."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Failed:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download Complete."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Error requesting url: "
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connecting to Mirror..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Disconnected"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Resolving"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't Resolve"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Connecting..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't Connect"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connected"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Requesting..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Downloading"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connection Error"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "SSL Handshake Error"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Current Version:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Installed Versions:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Install From File"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Remove Template"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Select template file"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Export Template Manager"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download Templates"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Select mirror from list: "
+msgstr ""
+
+#: editor/file_type_cache.cpp
+msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot navigate to '%s' as it has not been found in the file system!"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View items as a grid of thumbnails"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View items as a list"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Status: Import of file failed. Please fix file and reimport manually."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot move/rename resources root."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot move a folder into itself."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Error moving:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Error duplicating:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Unable to update dependencies:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "No name provided"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Provided name contains invalid characters"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "No name provided."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Name contains invalid characters."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "A file or folder with this name already exists."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Renaming file:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Renaming folder:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicating file:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicating folder:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Expand all"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Collapse all"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Rename..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Move To..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Open Scene(s)"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Instance"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Edit Dependencies..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View Owners..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicate..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Previous Directory"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Next Directory"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Re-Scan Filesystem"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Toggle folder status as Favorite"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Instance the selected scene(s) as child of the selected node."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid ""
+"Scanning Files,\n"
+"Please Wait..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Move"
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/project_manager.cpp
+msgid "Rename"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Add to Group"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Remove from Group"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Single Scene"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Materials+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Materials+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Multiple Scenes"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Multiple Scenes+Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Import Scene"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Importing Scene..."
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Generating Lightmaps"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Generating for Mesh: "
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Running Custom Script..."
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Couldn't load post-import script:"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Invalid/broken script for post-import (check console):"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Error running post-import script:"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Saving..."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Set as Default for '%s'"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Clear Default for '%s'"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid " Files"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Import As:"
+msgstr ""
+
+#: editor/import_dock.cpp editor/property_editor.cpp
+msgid "Preset..."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Reimport"
+msgstr ""
+
+#: editor/multi_node_edit.cpp
+msgid "MultiNode Set"
+msgstr ""
+
+#: editor/node_dock.cpp
+msgid "Groups"
+msgstr ""
+
+#: editor/node_dock.cpp
+msgid "Select a Node to edit Signals and Groups."
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create Poly"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Edit Poly"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Insert Point"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Edit Poly (Remove Point)"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Remove Poly And Point"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Create a new polygon from scratch"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid ""
+"Edit existing polygon:\n"
+"LMB: Move Point.\n"
+"Ctrl+LMB: Split Segment.\n"
+"RMB: Erase Point."
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Delete points"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Toggle Autoplay"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New Anim"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Change Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Delete Animation?"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Remove Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: Invalid animation name!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: Animation name already exists!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Rename Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Blend Next Changed"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Change Blend Time"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Duplicate Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: No animation to copy!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: No animation resource on clipboard!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Pasted Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Paste Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: No animation to edit!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation backwards from current pos. (A)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation backwards from end. (Shift+A)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Stop animation playback. (S)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation from start. (Shift+D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation from current pos. (D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation position (in seconds)."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Scale animation playback globally for the node."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Create new animation in player."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load animation from disk."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load an animation from disk."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save the current animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Display list of animations in player."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Autoplay on Load"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Edit Target Blend Times"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation Tools"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Copy Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Onion Skinning"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Enable Onion Skinning"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Directions"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Past"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Future"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Depth"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "1 step"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "2 steps"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "3 steps"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Differences Only"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Force White Modulate"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Include Gizmos (3D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Create New Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Error!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Blend Times:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Next (Auto Queue):"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Cross-Animation Blend Times"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Animation"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "New name:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Edit Filters"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Scale:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Fade In (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Fade Out (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Mix"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Auto Restart:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Restart (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Random Restart (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Start!"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Amount:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend 0:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend 1:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "X-Fade Time (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Current:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Add Input"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Clear Auto-Advance"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Set Auto-Advance"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Delete Input"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Animation tree is valid."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Animation tree is invalid."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Animation Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "OneShot Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Mix Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend2 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend3 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend4 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "TimeScale Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "TimeSeek Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Transition Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Import Animations..."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Edit Node Filters"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Filters..."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "AnimationTree"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Free"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Contents:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "View Files"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't resolve hostname:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Connection error, please try again."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't connect to host:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "No response from host:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request failed, return code:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request failed, too many redirects"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Bad download hash, assuming file has been tampered with."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Expected:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Got:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Failed sha256 hash check"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Asset Download Error:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Fetching:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Resolving..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Error making request"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Idle"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Retry"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download Error"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download for this asset is already in progress!"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "first"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "prev"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "next"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "last"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "All"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_settings_editor.cpp
+msgid "Plugins"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Sort:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Reverse"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_settings_editor.cpp
+msgid "Category:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Site:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Support..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Official"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Testing"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Assets ZIP File"
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid ""
+"Can't determine a save path for lightmap images.\n"
+"Save your scene (for images to be saved in the same dir), or pick a save "
+"path from the BakedLightmap properties."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid ""
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
+"Light' flag is on."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid "Failed creating lightmap images, make sure path is writable."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid "Bake Lightmaps"
+msgstr ""
+
+#: editor/plugins/camera_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Preview"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Configure Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Offset:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Step:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation Offset:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation Step:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Pivot"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Action"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Remove vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Remove horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new horizontal and vertical guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Edit IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Edit CanvasItem"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Anchors only"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change Anchors and Margins"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change Anchors"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Paste Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Select Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Drag: Rotate"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Alt+Drag: Move"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Alt+RMB: Depth list selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotate Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Show a list of all objects at the position clicked\n"
+"(same as Alt+RMB in select mode)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Click to change object's rotation pivot."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Pan Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Toggles snapping"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snapping options"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to grid"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Rotation Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Configure Snap..."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap Relative"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Pixel Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Smart snapping"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to parent"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node anchor"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node sides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to other nodes"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Lock the selected object in place (can't be moved)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Unlock the selected object (can be moved)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Makes sure the object's children are not selectable."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Restores the object's children's ability to be selected."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Make Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Make IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Show Grid"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Helpers"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Rulers"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Center Selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Frame Selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Layout"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Keys"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Key"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Key (Existing Tracks)"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Copy Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Drag pivot from mouse position"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Set pivot at mouse position"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Multiply grid step by 2"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Divide grid step by 2"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Add %s"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Adding %s..."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Ok"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Cannot instantiate multiple nodes without root."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Create Node"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Error instancing scene from %s"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change default type"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid ""
+"Drag & drop + Shift : Add node as sibling\n"
+"Drag & drop + Alt : Change node type"
+msgstr ""
+
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+msgid "Create Poly3D"
+msgstr ""
+
+#: editor/plugins/collision_shape_2d_editor_plugin.cpp
+msgid "Set Handle"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Remove item %d?"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Add Item"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Remove Selected Item"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Import from Scene"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Update from Scene"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Flat0"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Flat1"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Ease in"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Ease out"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Smoothstep"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Modify Curve Point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Modify Curve Tangent"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Load Curve Preset"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Add point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Remove point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Left linear"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Right linear"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Load preset"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Remove Curve Point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Toggle Curve Linear Tangent"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Hold Shift to edit tangents individually"
+msgstr ""
+
+#: editor/plugins/gi_probe_editor_plugin.cpp
+msgid "Bake GI Probe"
+msgstr ""
+
+#: editor/plugins/gradient_editor_plugin.cpp
+msgid "Add/Remove Color Ramp Point"
+msgstr ""
+
+#: editor/plugins/gradient_editor_plugin.cpp
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Modify Color Ramp"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Item %d"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Items"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Item List Editor"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid ""
+"No OccluderPolygon2D resource on this node.\n"
+"Create and assign one?"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create Occluder Polygon"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create a new polygon from scratch."
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Edit existing polygon:"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "LMB: Move Point."
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Ctrl+LMB: Split Segment."
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "RMB: Erase Point."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh is empty!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Static Trimesh Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Static Convex Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "This doesn't work on scene root!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Shape"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Shape"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Navigation Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Contained Mesh is not of type ArrayMesh."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "UV Unwrap failed, mesh may not be manifold?"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "No mesh to debug."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Model has no UV in this layer"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "MeshInstance lacks a Mesh!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh has not surface to create outlines from!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Could not create outline!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Static Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Static Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Collision Sibling"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Collision Sibling"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline Mesh..."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "View UV1"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "View UV2"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Unwrap UV2 for Lightmap/AO"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Outline Size:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No mesh source specified (and no MultiMesh set in node)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No mesh source specified (and MultiMesh contains no Mesh)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (invalid path)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (not a MeshInstance)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (contains no Mesh resource)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No surface source specified."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (invalid path)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (no geometry)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (no faces)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Parent has no solid faces to populate."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Couldn't map area."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Select a Source Mesh:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Select a Target Surface:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate Surface"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate MultiMesh"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Target Surface:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Source Mesh:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "X-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Y-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Z-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh Up Axis:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Rotation:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Tilt:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Scale:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate"
+msgstr ""
+
+#: editor/plugins/navigation_mesh_editor_plugin.cpp
+msgid "Bake!"
+msgstr ""
+
+#: editor/plugins/navigation_mesh_editor_plugin.cpp
+msgid "Bake the navigation mesh."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_editor_plugin.cpp
+msgid "Clear the navigation mesh."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Setting up Configuration..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Calculating grid size..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Creating heightfield..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Marking walkable triangles..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Constructing compact heightfield..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Eroding walkable area..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Partitioning..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Creating contours..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Creating polymesh..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Converting to native navigation mesh..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Navigation Mesh Generator Setup:"
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Parsing Geometry..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Done!"
+msgstr ""
+
+#: editor/plugins/navigation_polygon_editor_plugin.cpp
+msgid "Create Navigation Polygon"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generating AABB"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Can only set point into a ParticlesMaterial process material"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Error loading image:"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "No pixels with transparency > 128 in image..."
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generate Visibility Rect"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Load Emission Mask"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Clear Emission Mask"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Particles"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generated Point Count:"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generation Time (sec):"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Emission Mask"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Capture from Pixel"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Emission Colors"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Node does not contain geometry."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Node does not contain geometry (faces)."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "A processor material of type 'ParticlesMaterial' is required."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Faces contain no area!"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "No faces!"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generate AABB"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emission Points From Mesh"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emission Points From Node"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emitter"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Emission Points:"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Surface Points"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Surface Points+Normal (Directed)"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Volume"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Emission Source: "
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generate Visibility AABB"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove Point from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove Out-Control from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove In-Control from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Add Point to Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move Point in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move In-Control in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move Out-Control in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Select Points"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Shift+Drag: Select Control Points"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Click: Add Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Right Click: Delete Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Select Control Points (Shift+Drag)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Add Point (in empty space)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Split Segment (in curve)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Delete Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Close Curve"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Curve Point #"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve Point Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve In Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve Out Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Split Path"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove Path Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove Out-Control Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove In-Control Point"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create UV Map"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Transform UV Map"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygon 2D UV Editor"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Move Point"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Ctrl: Rotate"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Shift: Move All"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Shift+Ctrl: Scale"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Move Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Rotate Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Scale Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/shader_editor_plugin.cpp editor/project_manager.cpp
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygon->UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "UV->Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Clear UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Enable Snap"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "ERROR: Couldn't load resource!"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Add Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Rename Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Delete Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Resource clipboard is empty!"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
+msgid "Open in Editor"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/scene_tree_editor.cpp
+msgid "Instance:"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
+#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
+msgid "Type:"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Load Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Paste"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "ResourcePreloader"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Clear Recent Files"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close and save changes?"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error while saving theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error saving"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error importing theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error importing"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Import Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme As..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid " Class Reference"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Sort"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Move Up"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Move Down"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Next script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Previous script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "File"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "New"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save All"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Soft Reload Script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Copy Script Path"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Show In File System"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "History Prev"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "History Next"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Reload Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme As"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close Docs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close All"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close Other Tabs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+msgid "Run"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Toggle Scripts Panel"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+msgid "Find..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+msgid "Find Next"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Step Over"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Step Into"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Break"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+#: editor/script_editor_debugger.cpp
+msgid "Continue"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Keep Debugger Open"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Debug with external editor"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Open Godot online documentation"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search the class hierarchy."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search the reference documentation."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Go to previous edited document."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Go to next edited document."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Discard"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Create Script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid ""
+"The following files are newer on disk.\n"
+"What action should be taken?:"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Reload"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Resave"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Debugger"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid ""
+"Built-in scripts can only be edited when the scene they belong to is loaded"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Only resources from filesystem can be dropped."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Pick Color"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Case"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Uppercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Lowercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Capitalize"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Cut"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Copy"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Select All"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Delete Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Indent Left"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Indent Right"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Toggle Comment"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Fold/Unfold Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Fold All Lines"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Unfold All Lines"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Clone Down"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Complete Symbol"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Trim Trailing Whitespace"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Indent To Spaces"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Indent To Tabs"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Auto Indent"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Toggle Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Remove All Breakpoints"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Next Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Previous Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert To Uppercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert To Lowercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Find Previous"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Replace..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Function..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Line..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Contextual Help"
+msgstr ""
+
+#: editor/plugins/shader_editor_plugin.cpp
+msgid "Shader"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Constant"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Constant"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change RGB Constant"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Scalar Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change RGB Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Toggle Rot Only"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Function"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Function"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change RGB Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Default Value"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change XForm Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Texture Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Cubemap Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Comment"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Add/Remove to Color Ramp"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Add/Remove to Curve Map"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Modify Curve Map"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Input Name"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Connect Graph Nodes"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Disconnect Graph Nodes"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Remove Shader Graph Node"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Move Shader Graph Node"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Duplicate Graph Node(s)"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Delete Shader Graph Node(s)"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Error: Cyclic Connection Link"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Error: Missing Input Connections"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Add Shader Graph Node"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Orthogonal"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Perspective"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Aborted."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "X-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Y-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Z-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Plane Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scaling: "
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translating: "
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotating %s degrees."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Keying is disabled (no key inserted)."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Animation Key Inserted."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Objects Drawn"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Material Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Shader Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Surface Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Draw Calls"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Vertices"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "FPS"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Top View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Align with view"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "OK :("
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "No parent to instance a child at."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "This operation requires a single selected node."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Normal"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Wireframe"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Overdraw"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Unshaded"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Environment"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Gizmos"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Information"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View FPS"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Half Resolution"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Audio Listener"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Doppler Enable"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Left"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Right"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Forward"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Backwards"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Up"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Down"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Speed Modifier"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "XForm Dialog"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Select Mode (Q)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Drag: Rotate\n"
+"Alt+Drag: Move\n"
+"Alt+RMB: Depth list selection"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Move Mode (W)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate Mode (E)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale Mode (R)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Local Coords"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Local Space Mode (%s)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Mode (%s)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Top View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Switch Perspective/Orthogonal view"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Insert Animation Key"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Focus Origin"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Focus Selection"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Align Selection With View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Select"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Move"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Rotate"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Scale"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Toggle Freelook"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Dialog..."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "1 Viewport"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "2 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "2 Viewports (Alt)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "3 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "3 Viewports (Alt)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "4 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Origin"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Grid"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Skeleton Gizmo visibility"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translate Snap:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate Snap (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale Snap (%):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Viewport Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Perspective FOV (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Z-Near:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Z-Far:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Change"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translate:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale (ratio):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Type"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Pre"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Post"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "ERROR: Couldn't load frame resource!"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Frame"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Resource clipboard is empty or not a texture!"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Paste Frame"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Empty"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Change Animation Loop"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Change Animation FPS"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "(empty)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Animations"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Speed (FPS):"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Loop"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Animation Frames"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Insert Empty (Before)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Insert Empty (After)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Move (Before)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Move (After)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "SpriteFrames"
+msgstr ""
+
+#: editor/plugins/style_box_editor_plugin.cpp
+msgid "StyleBox Preview:"
+msgstr ""
+
+#: editor/plugins/style_box_editor_plugin.cpp
+msgid "StyleBox"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Set Region Rect"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Snap Mode:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "<None>"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Pixel Snap"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Grid Snap"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Auto Slice"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Offset:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Step:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Separation:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Texture Region"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Texture Region Editor"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Can't save theme to file:"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add All Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add All"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove All Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove All"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Edit theme..."
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Theme editing menu."
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add Class Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove Class Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create Empty Template"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create Empty Editor Template"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create From Current Editor Theme"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "CheckBox Radio1"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "CheckBox Radio2"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Check Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Many"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
+msgid "Options"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has,Many,Options"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 1"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 2"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 3"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Data Type:"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Icon"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Style"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Font"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Color"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Theme"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase Selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Paint TileMap"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Line Draw"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rectangle Paint"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Bucket Fill"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase TileMap"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Find tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Transpose"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Mirror X"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Mirror Y"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Paint Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Pick Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 0 degrees"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 90 degrees"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 180 degrees"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 270 degrees"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Could not find tile:"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Item name or ID:"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create from scene?"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Merge from scene?"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Tile Set"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create from Scene"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Merge from Scene"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Error"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Autotiles"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Select sub-tile to use as icon, this will be also used on invalid autotile "
+"bindings."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"LMB: set bit on.\n"
+"RMB: set bit off."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Select current edited sub-tile."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Select sub-tile to change its priority."
+msgstr ""
+
+#: editor/progress_dialog.cpp scene/gui/dialogs.cpp
+msgid "Cancel"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Runnable"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Delete patch '%s' from list?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Delete preset '%s'?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing/corrupted: "
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Presets"
+msgstr ""
+
+#: editor/project_export.cpp editor/project_settings_editor.cpp
+msgid "Add..."
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Resources"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export all resources in the project"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export selected scenes (and dependencies)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export selected resources (and dependencies)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export Mode:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Resources to export:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Patches"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Make Patch"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Features"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Custom (comma-separated):"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Feature List:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export PCK/Zip"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing/corrupted:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export With Debug"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "The path does not exist."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Please choose a 'project.godot' file."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Please choose an empty folder."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Imported Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't create folder."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "There is already a folder in this path with the specified name."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "It would be a good idea to name your project."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid project path (changed anything?)."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Couldn't load project.godot in project path (error %d). It may be missing or "
+"corrupted."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't edit project.godot in project path."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't create project.godot in project path."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "The following files failed extraction from package:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Rename Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "New Game Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Import Existing Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Import & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create New Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Install Project:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Install & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Name:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create folder"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Path:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Browse"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Unnamed Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Can't open project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Are you sure to open more than one project?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Can't run project: no main scene defined.\n"
+"Please edit the project and set the main scene in \"Project Settings\" under "
+"the \"Application\" category."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Can't run project: Assets need to be imported.\n"
+"Please edit the project to trigger the initial import."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Are you sure to run more than one project?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Remove project from the list? (Folder contents will not be modified)"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Language changed.\n"
+"The UI will update next time the editor or project manager starts."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"You are about the scan %s folders for existing Godot projects. Do you "
+"confirm?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Manager"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project List"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Scan"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Select a Folder to Scan"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "New Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Templates"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Exit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Restart Now"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Can't run project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"You don't currently have any projects.\n"
+"Would you like to explore the official example projects in the Asset Library?"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Key "
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joy Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joy Axis"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Mouse Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action '%s' already exists!"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Rename Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Shift+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Alt+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Control+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Press a Key..."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Mouse Button Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Left Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Right Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Middle Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Up Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Down Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 6"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 7"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 8"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 9"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joypad Axis Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Axis"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joypad Button Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Erase Input Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Erase Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Device"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Left Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Right Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Middle Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Up."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Down."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Global Property"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Select a setting item first!"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "No property '%s' exists."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Setting '%s' is internal, and it can't be deleted."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Delete Item"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Already existing"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Input Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Error saving settings."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Settings saved OK."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Override for Feature"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Translation"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Translation"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Remapped Path"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Resource Remap Add Remap"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Change Resource Remap Language"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Resource Remap"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Resource Remap Option"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Changed Locale Filter"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Changed Locale Filter Mode"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Project Settings (project.godot)"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "General"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+msgid "Property:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Override For..."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Input Map"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Device:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Localization"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Translations"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Translations:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remaps"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Resources:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remaps by Locale:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locale"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locales Filter"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Show all locales"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Show only selected locales"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Filter mode:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locales:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "AutoLoad"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Pick a Viewport"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Ease In"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Ease Out"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Zero"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Easing In-Out"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Easing Out-In"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "File..."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Dir..."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Assign"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Select Node"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "New Script"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "New %s"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Make Unique"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Show in File System"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Convert To %s"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Error loading file: Not a resource!"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Selected node is not a Viewport!"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Pick a Node"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Bit %d, val %d."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "On"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "[Empty]"
+msgstr ""
+
+#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Set"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Properties:"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Property"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Virtual Method"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Method"
+msgstr ""
+
+#: editor/pvrtc_compress.cpp
+msgid "Could not execute PVRTC tool:"
+msgstr ""
+
+#: editor/pvrtc_compress.cpp
+msgid "Can't load back converted image using PVRTC tool:"
+msgstr ""
+
+#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Reparent Node"
+msgstr ""
+
+#: editor/reparent_dialog.cpp
+msgid "Reparent Location (Select new Parent):"
+msgstr ""
+
+#: editor/reparent_dialog.cpp
+msgid "Keep Global Transform"
+msgstr ""
+
+#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Reparent"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Run Mode:"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Current Scene"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Main Scene"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Main Scene Arguments:"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Scene Run Settings"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp editor/script_create_dialog.cpp
+#: scene/gui/dialogs.cpp
+msgid "OK"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "No parent to instance the scenes at."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error loading scene from %s"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Cannot instance the scene '%s' because the current scene exists within one "
+"of its nodes."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instance Scene(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "This operation can't be done on the tree root."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Move Node In Parent"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Move Nodes In Parent"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Duplicate Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete Node(s)?"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can not perform with the root node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "This operation can't be done on instanced scenes."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Save New Scene As..."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Editable Children"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Load As Placeholder"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Discard Instancing"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Makes Sense!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't operate on nodes from a foreign scene!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't operate on nodes the current scene inherits from!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Remove Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Couldn't save new scene. Likely dependencies (instances) couldn't be "
+"satisfied."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error saving scene."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error duplicating scene to save it."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Sub-Resources"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Inheritance"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Add Child Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instance Child Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Change Type"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Attach Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Merge From Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Save Branch as Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Copy Node Path"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete (No Confirm)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Add/Create a New Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Instance a scene file as a Node. Creates an inherited scene if no root node "
+"exists."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Filter nodes"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Attach a new or existing script for the selected node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear a script for the selected node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Remote"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Local"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Inheritance? (No Undo!)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear!"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle Spatial Visible"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle CanvasItem Visible"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Node configuration warning:"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node has connection(s) and group(s)\n"
+"Click to show signals dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node has connections.\n"
+"Click to show signals dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node is in group(s).\n"
+"Click to show groups dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Open script"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node is locked.\n"
+"Click to unlock"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Children are not selectable.\n"
+"Click to make selectable"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle Visibility"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Invalid node name, the following characters are not allowed:"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Rename Node"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Scene Tree (Nodes):"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Node Configuration Warning!"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Select a Node"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error loading template '%s'"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error - Could not create script in filesystem."
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error loading script from %s"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "N/A"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Path is empty"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Path is not local"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid base path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Directory of the same name exists"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "File exists, will be reused"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid extension"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Wrong extension chosen"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid Path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid class name"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid inherited parent name or path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Script valid"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Allowed: a-z, A-Z, 0-9 and _"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Built-in script (into scene file)"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Create new script file"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Load existing script file"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Language"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Inherits"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Class Name"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Template"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Built-in Script"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Attach Node Script"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Remote "
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Bytes:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Warning"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Error:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Source:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Function:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Pick one or more items from the list to display the graph."
+msgstr ""
+
+#: editor/script_editor_debugger.cpp modules/mono/editor/mono_bottom_panel.cpp
+msgid "Errors"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Child Process Connected"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Copy Error"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Inspect Previous Instance"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Inspect Next Instance"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Stack Frames"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Variable"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Errors:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Stack Trace (if applicable):"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Profiler"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Monitor"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Value"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Monitors"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "List of Video Memory Usage by Resource:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Total:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Video Mem"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Resource Path"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Type"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Format"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Usage"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Misc"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Clicked Control:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Clicked Control Type:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Live Edit Root:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Set From Tree"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Shortcuts"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Binding"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Light Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change AudioStreamPlayer3D Emission Angle"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Camera FOV"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Camera Size"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Sphere Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Box Shape Extents"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Capsule Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Capsule Shape Height"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Ray Shape Length"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Notifier Extents"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Particles AABB"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Probe Extents"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Select the dynamic library for this entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Select dependencies of the library for this entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Remove current entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Double click to create a new entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Platform:"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Platform"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Dynamic Library"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Add an architecture entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "GDNativeLibrary"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Library"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Status"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Libraries: "
+msgstr ""
+
+#: modules/gdnative/register_types.cpp
+msgid "GDNative"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+#: modules/visual_script/visual_script_builtin_funcs.cpp
+msgid "Invalid type argument to convert(), use TYPE_* constants."
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp modules/mono/glue/glue_header.h
+#: modules/visual_script/visual_script_builtin_funcs.cpp
+msgid "Not enough bytes for decoding bytes, or invalid format."
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "step argument is zero!"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not a script with an instance"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not based on a script"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not based on a resource file"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (missing @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (can't load script at @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (invalid script at @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary (invalid subclasses)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Object can't provide a length."
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Next Plane"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Previous Plane"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Plane:"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Next Floor"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Previous Floor"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Floor:"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Delete Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Duplicate Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Grid Map"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Snap View"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Disabled"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Above"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Below"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit X Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit Y Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit Z Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate X"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate Y"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate Z"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate X"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate Y"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate Z"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Clear Rotation"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Create Area"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Create Exterior Connector"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Erase Area"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clear Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Settings"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Pick Distance:"
+msgstr ""
+
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Generating solution..."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Generating C# project..."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to create solution."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to save solution."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Done"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to create C# project."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Mono"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "About C# support"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Create C# solution"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Builds"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Build Project"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Warnings"
+msgstr ""
+
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"A node yielded without working memory, please read the docs on how to yield "
+"properly!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"Node yielded, but did not return a function state in the first working "
+"memory."
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"Return value must be assigned to first element of node working memory! Fix "
+"your node please."
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Node returned an invalid sequence output: "
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Found sequence bit but not the node in the stack, report bug!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Stack overflow with stack depth: "
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Signal Arguments"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Argument Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Argument name"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Set Variable Default Value"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Set Variable Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Functions:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Variables:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Name is not a valid identifier:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Name already in use by another func/var/signal:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Expression"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Duplicate VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a simple reference to the node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a simple reference to the node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a Variable Setter."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a Variable Setter."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Preload Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Node(s) From Tree"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Getter Property"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Setter Property"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Base Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Move Node(s)"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove VisualScript Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Connect Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Condition"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Sequence"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Switch"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Iterator"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "While"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Return"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Call"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Get"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Script already has function '%s'"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Input Value"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Can't copy the function node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Clipboard is empty!"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Paste VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Editing Variable:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Editing Signal:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Base Type:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Available Nodes:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Select or create a function to edit graph"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Signal Arguments:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Variable:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Delete Selected"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Find Node Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Copy Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Cut Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Paste Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Input type not iterable: "
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Iterator became invalid"
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Iterator became invalid: "
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Invalid index property name."
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Base object is not a Node!"
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Path does not lead Node!"
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Invalid index property name '%s' in node %s."
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ": Invalid argument of type: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ": Invalid arguments: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "VariableGet not found in script: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "VariableSet not found in script: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "Custom node has no _step() method, can't process graph."
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ""
+"Invalid return value from _step(), must be integer (seq out), or string "
+"(error)."
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Run in Browser"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Run exported HTML in the system's default browser."
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not write file:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not open template for export:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Invalid export template:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not read custom HTML shell:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not read boot splash image file:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Using default boot splash image."
+msgstr ""
+
+#: scene/2d/animated_sprite.cpp
+msgid ""
+"A SpriteFrames resource must be created or set in the 'Frames' property in "
+"order for AnimatedSprite to display frames."
+msgstr ""
+
+#: scene/2d/canvas_modulate.cpp
+msgid ""
+"Only one visible CanvasModulate is allowed per scene (or set of instanced "
+"scenes). The first created one will work, while the rest will be ignored."
+msgstr ""
+
+#: scene/2d/collision_object_2d.cpp
+msgid ""
+"This node has no children shapes, so it can't interact with the space.\n"
+"Consider adding CollisionShape2D or CollisionPolygon2D children nodes to "
+"define its shape."
+msgstr ""
+
+#: scene/2d/collision_polygon_2d.cpp
+msgid ""
+"CollisionPolygon2D only serves to provide a collision shape to a "
+"CollisionObject2D derived node. Please only use it as a child of Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
+msgstr ""
+
+#: scene/2d/collision_polygon_2d.cpp
+msgid "An empty CollisionPolygon2D has no effect on collision."
+msgstr ""
+
+#: scene/2d/collision_shape_2d.cpp
+msgid ""
+"CollisionShape2D only serves to provide a collision shape to a "
+"CollisionObject2D derived node. Please only use it as a child of Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
+msgstr ""
+
+#: scene/2d/collision_shape_2d.cpp
+msgid ""
+"A shape must be provided for CollisionShape2D to function. Please create a "
+"shape resource for it!"
+msgstr ""
+
+#: scene/2d/light_2d.cpp
+msgid ""
+"A texture with the shape of the light must be supplied to the 'texture' "
+"property."
+msgstr ""
+
+#: scene/2d/light_occluder_2d.cpp
+msgid ""
+"An occluder polygon must be set (or drawn) for this occluder to take effect."
+msgstr ""
+
+#: scene/2d/light_occluder_2d.cpp
+msgid "The occluder polygon for this occluder is empty. Please draw a polygon!"
+msgstr ""
+
+#: scene/2d/navigation_polygon.cpp
+msgid ""
+"A NavigationPolygon resource must be set or created for this node to work. "
+"Please set a property or draw a polygon."
+msgstr ""
+
+#: scene/2d/navigation_polygon.cpp
+msgid ""
+"NavigationPolygonInstance must be a child or grandchild to a Navigation2D "
+"node. It only provides navigation data."
+msgstr ""
+
+#: scene/2d/parallax_layer.cpp
+msgid ""
+"ParallaxLayer node only works when set as child of a ParallaxBackground node."
+msgstr ""
+
+#: scene/2d/particles_2d.cpp scene/3d/particles.cpp
+msgid ""
+"A material to process the particles is not assigned, so no behavior is "
+"imprinted."
+msgstr ""
+
+#: scene/2d/path_2d.cpp
+msgid "PathFollow2D only works when set as a child of a Path2D node."
+msgstr ""
+
+#: scene/2d/physics_body_2d.cpp
+msgid ""
+"Size changes to RigidBody2D (in character or rigid modes) will be overridden "
+"by the physics engine when running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/2d/remote_transform_2d.cpp
+msgid "Path property must point to a valid Node2D node to work."
+msgstr ""
+
+#: scene/2d/visibility_notifier_2d.cpp
+msgid ""
+"VisibilityEnable2D works best when used with the edited scene root directly "
+"as parent."
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRCamera must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRController must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid ""
+"The controller id must not be 0 or this controller will not be bound to an "
+"actual controller"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRAnchor must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid ""
+"The anchor id must not be 0 or this anchor will not be bound to an actual "
+"anchor"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVROrigin requires an ARVRCamera child node"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "%d%%"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "(Time Left: %d:%02d s)"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Plotting Meshes: "
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Plotting Lights:"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp scene/3d/gi_probe.cpp
+msgid "Finishing Plot"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Lighting Meshes: "
+msgstr ""
+
+#: scene/3d/collision_object.cpp
+msgid ""
+"This node has no children shapes, so it can't interact with the space.\n"
+"Consider adding CollisionShape or CollisionPolygon children nodes to define "
+"its shape."
+msgstr ""
+
+#: scene/3d/collision_polygon.cpp
+msgid ""
+"CollisionPolygon only serves to provide a collision shape to a "
+"CollisionObject derived node. Please only use it as a child of Area, "
+"StaticBody, RigidBody, KinematicBody, etc. to give them a shape."
+msgstr ""
+
+#: scene/3d/collision_polygon.cpp
+msgid "An empty CollisionPolygon has no effect on collision."
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"CollisionShape only serves to provide a collision shape to a CollisionObject "
+"derived node. Please only use it as a child of Area, StaticBody, RigidBody, "
+"KinematicBody, etc. to give them a shape."
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"A shape must be provided for CollisionShape to function. Please create a "
+"shape resource for it!"
+msgstr ""
+
+#: scene/3d/gi_probe.cpp
+msgid "Plotting Meshes"
+msgstr ""
+
+#: scene/3d/navigation_mesh.cpp
+msgid "A NavigationMesh resource must be set or created for this node to work."
+msgstr ""
+
+#: scene/3d/navigation_mesh.cpp
+msgid ""
+"NavigationMeshInstance must be a child or grandchild to a Navigation node. "
+"It only provides navigation data."
+msgstr ""
+
+#: scene/3d/particles.cpp
+msgid ""
+"Nothing is visible because meshes have not been assigned to draw passes."
+msgstr ""
+
+#: scene/3d/physics_body.cpp
+msgid ""
+"Size changes to RigidBody (in character or rigid modes) will be overridden "
+"by the physics engine when running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/3d/remote_transform.cpp
+msgid "Path property must point to a valid Spatial node to work."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
+#: scene/3d/sprite_3d.cpp
+msgid ""
+"A SpriteFrames resource must be created or set in the 'Frames' property in "
+"order for AnimatedSprite3D to display frames."
+msgstr ""
+
+#: scene/3d/vehicle_body.cpp
+msgid ""
+"VehicleWheel serves to provide a wheel system to a VehicleBody. Please use "
+"it as a child of a VehicleBody."
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Raw Mode"
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Add current color as a preset"
+msgstr ""
+
+#: scene/gui/dialogs.cpp
+msgid "Alert!"
+msgstr ""
+
+#: scene/gui/dialogs.cpp
+msgid "Please Confirm..."
+msgstr ""
+
+#: scene/gui/file_dialog.cpp
+msgid "Select this Folder"
+msgstr ""
+
+#: scene/gui/popup.cpp
+msgid ""
+"Popups will hide by default unless you call popup() or any of the popup*() "
+"functions. Making them visible for editing is fine though, but they will "
+"hide upon running."
+msgstr ""
+
+#: scene/gui/scroll_container.cpp
+msgid ""
+"ScrollContainer is intended to work with a single child control.\n"
+"Use a container as child (VBox,HBox,etc), or a Control and set the custom "
+"minimum size manually."
+msgstr ""
+
+#: scene/gui/tree.cpp
+msgid "(Other)"
+msgstr ""
+
+#: scene/main/scene_tree.cpp
+msgid ""
+"Default Environment as specified in Project Settings (Rendering -> "
+"Environment -> Default Environment) could not be loaded."
+msgstr ""
+
+#: scene/main/viewport.cpp
+msgid ""
+"This viewport is not set as render target. If you intend for it to display "
+"its contents directly to the screen, make it a child of a Control so it can "
+"obtain a size. Otherwise, make it a RenderTarget and assign its internal "
+"texture to some node for display."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Error initializing FreeType."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Unknown font format."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Error loading font."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Invalid font size."
+msgstr ""
diff --git a/editor/translations/nb.po b/editor/translations/nb.po
index e6ad8950f6..e76053150c 100644
--- a/editor/translations/nb.po
+++ b/editor/translations/nb.po
@@ -2,27 +2,27 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
-# Allan Nordhøy <epost@anotheragency.no>, 2017.
+# Allan Nordhøy <epost@anotheragency.no>, 2017-2018.
# Anonymous <GentleSaucepan@protonmail.com>, 2017.
+# Elias <eliasnykrem@gmail.com>, 2018.
# flesk <eivindkn@gmail.com>, 2017.
+# Frank T. Rambol <frank@d-fect.com>, 2018.
# Jørgen Aarmo Lund <jorgen.aarmo@gmail.com>, 2016.
# NicolaiF <nico-fre@hotmail.com>, 2017-2018.
# Norwegian Disaster <stian.furu.overbye@gmail.com>, 2017.
# passeride <lukas@passeride.com>, 2017.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-20 08:55+0000\n"
-"Last-Translator: NicolaiF <nico-fre@hotmail.com>\n"
+"PO-Revision-Date: 2018-06-22 08:31+0000\n"
+"Last-Translator: Frank T. Rambol <frank@d-fect.com>\n"
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/godot-"
"engine/godot/nb/>\n"
"Language: nb\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 2.19-dev\n"
+"X-Generator: Weblate 3.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -33,9 +33,8 @@ msgid "All Selection"
msgstr "Alle valg"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Time"
-msgstr "Anim Forandre Verdi"
+msgstr "Anim Endre Nøkkelbildetid"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
@@ -46,9 +45,8 @@ msgid "Anim Change Transform"
msgstr "Anim Forandre Omforming"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Anim Forandre Verdi"
+msgstr "Anim Endre Nøkkelbildeverdi"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -99,9 +97,8 @@ msgid "Edit Node Curve"
msgstr "Forandre Nodekurve"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Edit Selection Curve"
-msgstr "Forandre utvalgskurve"
+msgstr "Rediger utvalgskurve"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
@@ -501,13 +498,12 @@ msgid "Connecting Signal:"
msgstr "Kobler Til Signal:"
#: editor/connections_dialog.cpp
-#, fuzzy
msgid "Disconnect '%s' from '%s'"
-msgstr "Koble '%s' til '%s'"
+msgstr "Koble '%s' fra '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Koble Til.."
+msgid "Connect..."
+msgstr "Koble Til..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -519,9 +515,8 @@ msgid "Signals"
msgstr "Signaler"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Change %s Type"
-msgstr "Endre standard type"
+msgstr "Endre %s type"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -529,9 +524,8 @@ msgid "Change"
msgstr "Forandre"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Create New %s"
-msgstr "Lag Ny"
+msgstr "Lag ny %s"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
@@ -598,7 +592,7 @@ msgstr "Ressurs"
#: editor/project_manager.cpp editor/project_settings_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Path"
-msgstr "Sti"
+msgstr "Søkesti"
#: editor/dependency_editor.cpp
msgid "Dependencies:"
@@ -642,9 +636,8 @@ msgstr ""
"Fjern dem likevel? (kan ikke angres)"
#: editor/dependency_editor.cpp
-#, fuzzy
msgid "Cannot remove:"
-msgstr "Kan ikke fjerne:\n"
+msgstr "Kan ikke fjerne:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
@@ -729,9 +722,8 @@ msgid "Lead Developer"
msgstr "Utviklingsleder"
#: editor/editor_about.cpp
-#, fuzzy
msgid "Project Manager "
-msgstr "Prosjektleder"
+msgstr "Prosjektleder "
#: editor/editor_about.cpp
msgid "Developers"
@@ -840,9 +832,8 @@ msgid "Rename Audio Bus"
msgstr "Gi nytt navn til Audio Bus"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Change Audio Bus Volume"
-msgstr "Veksle Audio Bus Solo"
+msgstr "Endre Lydbuss Volum"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
@@ -885,7 +876,6 @@ msgid "Mute"
msgstr "Demp"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Bypass"
msgstr "Omgå"
@@ -935,12 +925,12 @@ msgid "Move Audio Bus"
msgstr "Flytt Audio Bus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Lagre Audio Bus Oppsett som..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Plassering for nytt oppsett.."
+msgid "Location for New Layout..."
+msgstr "Plassering for nytt oppsett..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1078,12 +1068,12 @@ msgid "Updating Scene"
msgstr "Oppdaterer Scene"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Lagrer lokale endringer.."
+msgid "Storing local changes..."
+msgstr "Lagrer lokale endringer..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Oppdaterer scene.."
+msgid "Updating scene..."
+msgstr "Oppdaterer scene..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1131,9 +1121,8 @@ msgid "Packing"
msgstr "Pakking"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
-#, fuzzy
msgid "Template file not found:"
-msgstr "Malfil ble ikke funnet:\n"
+msgstr "Malfil ble ikke funnet:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "File Exists, Overwrite?"
@@ -1152,8 +1141,8 @@ msgid "Show In File Manager"
msgstr "Vis I Filutforsker"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Ny Mappe.."
+msgid "New Folder..."
+msgstr "Ny Mappe..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1219,15 +1208,15 @@ msgstr "Veksle modus"
#: editor/editor_file_dialog.cpp
msgid "Focus Path"
-msgstr ""
+msgstr "Fokuser Bane"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Up"
-msgstr "Flytt favoritt oppover"
+msgstr "Flytt Favoritt Oppover"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Down"
-msgstr "Flytt favoritt nedover"
+msgstr "Flytt Favoritt Nedover"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Go to parent folder"
@@ -1235,7 +1224,7 @@ msgstr "GÃ¥ til overnevnt mappe"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
-msgstr "Mapper og filer:"
+msgstr "Mapper og Filer:"
#: editor/editor_file_dialog.cpp
msgid "Preview:"
@@ -1252,7 +1241,7 @@ msgstr "MÃ¥ ha en gyldig filutvidelse."
#: editor/editor_file_system.cpp
msgid "ScanSources"
-msgstr ""
+msgstr "SkannKilder"
#: editor/editor_file_system.cpp
msgid "(Re)Importing Assets"
@@ -1344,19 +1333,18 @@ msgid "Description"
msgstr "Beskrivelse"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Online Tutorials:"
-msgstr "Online Dokumentasjon"
+msgstr "Online dokumentasjon:"
#: editor/editor_help.cpp
-#, fuzzy
msgid ""
"There are currently no tutorials for this class, you can [color=$color][url="
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Det finnes i øyeblikket ingen beskrivelse av denne metoden. Hjelp til ved å "
-"[colour=$color][url=$url]bidra med en[/url][/color]!"
+"Det finnes i øyeblikket ingen beskrivelse av denne metoden, men du kan "
+"[colour=$color][url=$url]bidra med en[/url][/color] eller [color=$color][url="
+"$url2]be om en[/url][/color]."
#: editor/editor_help.cpp
msgid "Properties"
@@ -1410,23 +1398,25 @@ msgid "Clear"
msgstr "Tøm"
#: editor/editor_log.cpp
-#, fuzzy
msgid "Clear Output"
-msgstr "Output"
+msgstr "Nullstill resultat"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Eksport av prosjektet mislyktes med feilkode %d."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Feil ved lagring av ressurs!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Lagre Ressurs Som.."
+msgid "Save Resource As..."
+msgstr "Lagre Ressurs Som..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-#, fuzzy
-msgid "I see.."
-msgstr "Jeg ser.."
+msgid "I see..."
+msgstr "Jeg forstår..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1449,9 +1439,8 @@ msgid "Error while parsing '%s'."
msgstr "Error ved parsing av '%s'."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Unexpected end of file '%s'."
-msgstr "Uventet ende av fil '%s'."
+msgstr "Uventet slutt på fil '%s'."
#: editor/editor_node.cpp
msgid "Missing '%s' or its dependencies."
@@ -1478,13 +1467,12 @@ msgid "This operation can't be done without a tree root."
msgstr "Denne operasjonen kan ikke gjennomføres uten en trerot."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
msgstr ""
-"Kunne ikke lagre scene. Sannsynligvis avhengigheter (instanser) ikke kunne "
-"oppfylles."
+"Kunne ikke lagre scene. Sannsynligvis kunne ikke avhengigheter (instanser "
+"eller arvinger) oppfylles."
#: editor/editor_node.cpp
msgid "Failed to load resource."
@@ -1596,14 +1584,12 @@ msgid "Copy Resource"
msgstr "Kopier Ressurs"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Make Built-In"
-msgstr "Lag Innebygd"
+msgstr "Lag innebygget"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Make Sub-Resources Unique"
-msgstr "Gjør Underressurs Unik"
+msgstr "Lag underressurser unike"
#: editor/editor_node.cpp
msgid "Open in Help"
@@ -1624,14 +1610,13 @@ msgstr ""
"'applikasjon'."
#: editor/editor_node.cpp
-#, fuzzy
msgid ""
"Selected scene '%s' does not exist, select a valid one?\n"
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
-"Valgte scene '%s' finnes ikke, velg en gyldig en?\n"
-"Du kan endre dette senere under \"Prosjekt Innstillinger\" under kategorien "
+"Den valgte scenen '%s' finnes ikke. Vil du velge en gyldig scene?\n"
+"Du kan endre dette senere i \"Prosjektinnstillinger\" under kategorien "
"'applikasjon'."
#: editor/editor_node.cpp
@@ -1640,6 +1625,9 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Valgte scene '%s' er ikke en scenefil, velg en gyldig én?\n"
+"Du kan endre dette senere i \"Prosjekt Instillinger\" under 'applikasjon' "
+"kategorien."
#: editor/editor_node.cpp
msgid "Current scene was never saved, please save it prior to running."
@@ -1655,15 +1643,15 @@ msgstr "Ã…pne Scene"
#: editor/editor_node.cpp
msgid "Open Base Scene"
-msgstr ""
+msgstr "Ã…pne Base Scene"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Hurtigåpne Scene.."
+msgid "Quick Open Scene..."
+msgstr "Hurtigåpne Scene..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Hurtigåpne Skript.."
+msgid "Quick Open Script..."
+msgstr "Hurtigåpne Skript..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1674,8 +1662,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Lagre endringer til '%s' før lukking?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Lagre Scene Som.."
+msgid "Save Scene As..."
+msgstr "Lagre Scene Som..."
#: editor/editor_node.cpp
msgid "No"
@@ -1726,8 +1714,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Denne handlingen kan ikke angres. GÃ¥ tilbake likevel?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Hurtigkjør Scene.."
+msgid "Quick Run Scene..."
+msgstr "Hurtigkjør Scene..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1787,6 +1775,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
msgstr ""
+"Kunne ikke laste tillegsskript fra sti: '%s' Script er ikke i verktøymodus."
#: editor/editor_node.cpp
msgid ""
@@ -1879,8 +1868,8 @@ msgid "Previous tab"
msgstr "Forrige fane"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrer Filer.."
+msgid "Filter Files..."
+msgstr "Filtrer Filer..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1891,12 +1880,12 @@ msgid "New Scene"
msgstr "Ny Scene"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Ny Arvet Scene.."
+msgid "New Inherited Scene..."
+msgstr "Ny Arvet Scene..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Ã…pne Scene.."
+msgid "Open Scene..."
+msgstr "Ã…pne Scene..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1915,17 +1904,17 @@ msgid "Open Recent"
msgstr "Ã…pne Nylig"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Konverter Til.."
+msgid "Convert To..."
+msgstr "Konverter Til..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshBibliotek.."
+msgid "MeshLibrary..."
+msgstr "MeshBibliotek..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet…"
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -1975,9 +1964,8 @@ msgid "Debug"
msgstr "Debug"
#: editor/editor_node.cpp
-#, fuzzy
msgid "Deploy with Remote Debug"
-msgstr "Deploy med Ekstern Debug"
+msgstr "Distribuer med ekstern feilsøking"
#: editor/editor_node.cpp
#, fuzzy
@@ -2002,6 +1990,11 @@ msgid ""
"On Android, deploy will use the USB cable for faster performance. This "
"option speeds up testing for games with a large footprint."
msgstr ""
+"NÃ¥r dette alternativet er aktivert, eksportering eller distribuering vil "
+"produsere en kjørbar fil.\n"
+"Filstystemet vil få prosjektet fra redigerinsverktøyet over nettverket. \n"
+"PÃ¥ Android, distribusjon du vil bruke USB-kabelen for raskere ytelse. Dette "
+"alternativet gjør testing for spill med et stort fotavtrykk raskere."
#: editor/editor_node.cpp
#, fuzzy
@@ -2068,11 +2061,11 @@ msgstr "Redigeringsverktøy"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
-msgstr ""
+msgstr "Redigeringsverktøy-instillinger"
#: editor/editor_node.cpp
msgid "Editor Layout"
-msgstr ""
+msgstr "Redigeringsverktøy Layout"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
@@ -2132,7 +2125,7 @@ msgstr "Pause scenen"
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr "Pause Scene"
+msgstr "Sett scenen på pause"
#: editor/editor_node.cpp
msgid "Stop the scene."
@@ -2189,11 +2182,11 @@ msgstr "Last inn en eksisterende ressurs fra disk og rediger den."
#: editor/editor_node.cpp
msgid "Save the currently edited resource."
-msgstr ""
+msgstr "Lagre den nylige redigerte ressursen."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Lagre Som.."
+msgid "Save As..."
+msgstr "Lagre Som..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2302,8 +2295,8 @@ msgid "Creating Mesh Previews"
msgstr "Lager Forhåndsvisning av Mesh"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatyrbilde.."
+msgid "Thumbnail..."
+msgstr "Miniatyrbilde..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2460,8 +2453,8 @@ msgid "(Current)"
msgstr "(Gjeldende)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Henter fillager, vennligst vent.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Henter fillager, vennligst vent..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2477,13 +2470,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ugyldig version.txt format i mal."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ugyldig version.txt format i mal. Revisjon er ikke en gyldig identifikator."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Ingen version.txt funnet i mal."
@@ -2494,7 +2480,7 @@ msgstr "Feil ved laging av sti for mal:\n"
#: editor/export_template_manager.cpp
msgid "Extracting Export Templates"
-msgstr ""
+msgstr "Ekstraherer Eksport Mal"
#: editor/export_template_manager.cpp
msgid "Importing:"
@@ -2550,8 +2536,8 @@ msgid "Error requesting url: "
msgstr "Error ved forespørsel av url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Kobler til Fillager.."
+msgid "Connecting to Mirror..."
+msgstr "Kobler til Fillager..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2567,8 +2553,8 @@ msgstr "Kan ikke Løses"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Kobler til.."
+msgid "Connecting..."
+msgstr "Kobler til..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2582,8 +2568,8 @@ msgstr "Tilkoblet"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Requesting.."
-msgstr "Ber om.."
+msgid "Requesting..."
+msgstr "Ber om..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2728,12 +2714,12 @@ msgid "Collapse all"
msgstr "Kollaps alle"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Endre Navn.."
+msgid "Rename..."
+msgstr "Endre Navn..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Flytt Til.."
+msgid "Move To..."
+msgstr "Flytt Til..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2745,16 +2731,16 @@ msgid "Instance"
msgstr "Instans"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Endre Avhengigheter.."
+msgid "Edit Dependencies..."
+msgstr "Endre Avhengigheter..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Vis Eiere.."
+msgid "View Owners..."
+msgstr "Vis Eiere..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Duplisér"
#: editor/filesystem_dock.cpp
@@ -2781,10 +2767,10 @@ msgstr "Instanser den valgte scene(r) som barn av den valgte noden."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Skanner Filer,\n"
-"Vennligst Vent.."
+"Vennligst Vent..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2849,8 +2835,8 @@ msgid "Import Scene"
msgstr "Importer Scene"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Importerer Scene.."
+msgid "Importing Scene..."
+msgstr "Importerer Scene..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2858,11 +2844,11 @@ msgstr ""
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
-msgstr ""
+msgstr "Genererer for Maske: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Kjører Tilpasser Skript.."
+msgid "Running Custom Script..."
+msgstr "Kjører Tilpasser Skript..."
#: editor/import/resource_importer_scene.cpp
#, fuzzy
@@ -2878,8 +2864,8 @@ msgid "Error running post-import script:"
msgstr "Error ved kjøring av post-import script:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Lagrer.."
+msgid "Saving..."
+msgstr "Lagrer..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2899,8 +2885,8 @@ msgstr "Importer Som:"
#: editor/import_dock.cpp editor/property_editor.cpp
#, fuzzy
-msgid "Preset.."
-msgstr "Preset.."
+msgid "Preset..."
+msgstr "Preset..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3330,16 +3316,16 @@ msgid "Transition Node"
msgstr "Overgang Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importer Animasjoner.."
+msgid "Import Animations..."
+msgstr "Importer Animasjoner..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Rediger Node-Filtre"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filtre.."
+msgid "Filters..."
+msgstr "Filtre..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3408,8 +3394,8 @@ msgid "Fetching:"
msgstr "Henter:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Løser.."
+msgid "Resolving..."
+msgstr "Løser..."
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
@@ -3478,8 +3464,8 @@ msgid "Site:"
msgstr "Side:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Support.."
+msgid "Support..."
+msgstr "Support..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3508,7 +3494,7 @@ msgstr ""
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
-msgstr ""
+msgstr "Laging av lysmapbilder feilet, forsikre om at stien er skrivbar."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Bake Lightmaps"
@@ -3669,6 +3655,7 @@ msgid "Use Rotation Snap"
msgstr "Bruk Rotasjons-Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Konfigurer Snap..."
@@ -3767,6 +3754,16 @@ msgstr "Vis veiledere"
#: editor/plugins/canvas_item_editor_plugin.cpp
#, fuzzy
+msgid "Show Origin"
+msgstr "Vis Rutenett"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Viewport"
+msgstr "Vis hjelpere"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
msgid "Center Selection"
msgstr "Plasser Utvalg I Midten"
@@ -3789,7 +3786,7 @@ msgstr "Sett inn Nøkkel"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
-msgstr ""
+msgstr "Sett inn Nøkkel (Eksisterende Spor)"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Copy Pose"
@@ -3821,15 +3818,15 @@ msgstr "Legg til %s"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Adding %s..."
-msgstr "Legger til %s.."
+msgstr "Legger til %s..."
#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ok"
-msgstr ""
+msgstr "Ok"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Cannot instantiate multiple nodes without root."
-msgstr ""
+msgstr "Kan ikke instansiere flere noder uten rot."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -4058,6 +4055,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Kunne ikke lage omriss!"
@@ -4086,7 +4087,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4229,7 +4230,7 @@ msgstr ""
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Calculating grid size..."
-msgstr ""
+msgstr "Regner ut rutenettstørrelse…"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating heightfield..."
@@ -4290,11 +4291,11 @@ msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Error loading image:"
-msgstr ""
+msgstr "Feil ved innlasting av bilde:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Ingen piksler med gjennomsiktighet > 128 i bilde.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Ingen piksler med gjennomsiktighet > 128 i bilde..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4376,7 +4377,7 @@ msgstr ""
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points"
-msgstr ""
+msgstr "Overflatepunkter"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points+Normal (Directed)"
@@ -4488,11 +4489,11 @@ msgstr "Fjern Funksjon"
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Path"
-msgstr ""
+msgstr "Splitt Sti"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove Path Point"
-msgstr ""
+msgstr "Fjern Stipunkt"
#: editor/plugins/path_editor_plugin.cpp
#, fuzzy
@@ -4570,7 +4571,7 @@ msgstr ""
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Enable Snap"
-msgstr ""
+msgstr "Aktiver Snap"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid"
@@ -4595,28 +4596,28 @@ msgstr "Fjern Ressurs"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Resource clipboard is empty!"
-msgstr ""
+msgstr "Ressurs-utklippstavle er tom!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
msgid "Open in Editor"
-msgstr ""
+msgstr "Åpne i Redigeringsverktøy"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
msgid "Instance:"
-msgstr ""
+msgstr "Instans:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
msgid "Type:"
-msgstr ""
+msgstr "Type:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Load Resource"
-msgstr ""
+msgstr "Last Ressurs"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4662,8 +4663,8 @@ msgid "Import Theme"
msgstr "Importer Tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Lagre Tema Som.."
+msgid "Save Theme As..."
+msgstr "Lagre Tema Som..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4687,35 +4688,33 @@ msgstr "Flytt Ned"
#: editor/plugins/script_editor_plugin.cpp
msgid "Next script"
-msgstr ""
+msgstr "Neste skript"
#: editor/plugins/script_editor_plugin.cpp
msgid "Previous script"
-msgstr ""
+msgstr "Forrige skript"
#: editor/plugins/script_editor_plugin.cpp
msgid "File"
-msgstr ""
+msgstr "Fil"
#: editor/plugins/script_editor_plugin.cpp
msgid "New"
-msgstr ""
+msgstr "Ny"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save All"
-msgstr ""
+msgstr "Lagre Alle"
#: editor/plugins/script_editor_plugin.cpp
msgid "Soft Reload Script"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Copy Script Path"
-msgstr "Kopier Sti"
+msgstr "Kopier Skript-Sti"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Show In File System"
msgstr "Vis I Filutforsker"
@@ -4729,40 +4728,40 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
msgid "Reload Theme"
-msgstr ""
+msgstr "Gjeninnlast drakt"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save Theme"
-msgstr ""
+msgstr "Lagre drakt"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save Theme As"
-msgstr ""
+msgstr "Lagre drakt som"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Docs"
-msgstr ""
+msgstr "Lukk Dokumentasjon"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close All"
-msgstr ""
+msgstr "Lukk Alle"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Other Tabs"
-msgstr ""
+msgstr "Lukk Andre Faner"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
msgid "Run"
-msgstr ""
+msgstr "Kjør"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle Scripts Panel"
-msgstr ""
+msgstr "Veksle skriptpanel"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Finn.."
+msgid "Find..."
+msgstr "Finn..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4771,15 +4770,15 @@ msgstr "Finn neste"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Over"
-msgstr ""
+msgstr "Hopp Over"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Into"
-msgstr ""
+msgstr "Tre inn i"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Break"
-msgstr ""
+msgstr "Brekk"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
#: editor/script_editor_debugger.cpp
@@ -4788,35 +4787,35 @@ msgstr "Fortsett"
#: editor/plugins/script_editor_plugin.cpp
msgid "Keep Debugger Open"
-msgstr ""
+msgstr "Hold feilretteren åpen"
#: editor/plugins/script_editor_plugin.cpp
msgid "Debug with external editor"
-msgstr ""
+msgstr "Feilrett med ekstern behandler"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open Godot online documentation"
-msgstr ""
+msgstr "Ã…pne Godots nettbaserte dokumentasjon"
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the class hierarchy."
-msgstr ""
+msgstr "Søk i klasse-hierarkiet."
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the reference documentation."
-msgstr ""
+msgstr "Søk i referanse-dokumentasjonen."
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to previous edited document."
-msgstr ""
+msgstr "GÃ¥ til tidligere redigert dokument."
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to next edited document."
-msgstr ""
+msgstr "GÃ¥ til neste redigerte dokument."
#: editor/plugins/script_editor_plugin.cpp
msgid "Discard"
-msgstr ""
+msgstr "Forkast"
#: editor/plugins/script_editor_plugin.cpp
msgid "Create Script"
@@ -4830,15 +4829,15 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
msgid "Reload"
-msgstr ""
+msgstr "Gjeninnlat"
#: editor/plugins/script_editor_plugin.cpp
msgid "Resave"
-msgstr ""
+msgstr "Lagre på nytt"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Debugger"
-msgstr ""
+msgstr "Feilretter"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
@@ -4859,15 +4858,15 @@ msgstr ""
#: editor/plugins/script_text_editor.cpp
msgid "Uppercase"
-msgstr ""
+msgstr "Store versaler"
#: editor/plugins/script_text_editor.cpp
msgid "Lowercase"
-msgstr ""
+msgstr "Små bokstaver"
#: editor/plugins/script_text_editor.cpp
msgid "Capitalize"
-msgstr ""
+msgstr "Store bokstaver"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
@@ -4883,7 +4882,7 @@ msgstr "Lim inn"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
msgid "Select All"
-msgstr ""
+msgstr "Velg Alle"
#: editor/plugins/script_text_editor.cpp
#, fuzzy
@@ -4892,15 +4891,15 @@ msgstr "Slett Valgte"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Left"
-msgstr ""
+msgstr "Innrykk Venstre"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Right"
-msgstr ""
+msgstr "Innrykk Høyre"
#: editor/plugins/script_text_editor.cpp
msgid "Toggle Comment"
-msgstr ""
+msgstr "Veksle kommentar"
#: editor/plugins/script_text_editor.cpp
#, fuzzy
@@ -4909,15 +4908,15 @@ msgstr "Slett Valgte"
#: editor/plugins/script_text_editor.cpp
msgid "Fold All Lines"
-msgstr ""
+msgstr "Fold sammen alle linjer"
#: editor/plugins/script_text_editor.cpp
msgid "Unfold All Lines"
-msgstr ""
+msgstr "Brett ut alle linjer"
#: editor/plugins/script_text_editor.cpp
msgid "Clone Down"
-msgstr ""
+msgstr "Klon nedover"
#: editor/plugins/script_text_editor.cpp
msgid "Complete Symbol"
@@ -4937,7 +4936,7 @@ msgstr ""
#: editor/plugins/script_text_editor.cpp
msgid "Auto Indent"
-msgstr ""
+msgstr "Automatisk innrykk"
#: editor/plugins/script_text_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -4958,26 +4957,26 @@ msgstr ""
#: editor/plugins/script_text_editor.cpp
msgid "Convert To Uppercase"
-msgstr ""
+msgstr "Konverter til store versaler"
#: editor/plugins/script_text_editor.cpp
msgid "Convert To Lowercase"
-msgstr ""
+msgstr "Konverter til små versaler"
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
msgstr "Finn forrige"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Erstatt.."
+msgid "Replace..."
+msgstr "Erstatt..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5058,7 +5057,7 @@ msgstr ""
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Comment"
-msgstr ""
+msgstr "Endre Kommentar"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add/Remove to Color Ramp"
@@ -5142,15 +5141,15 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scaling: "
-msgstr ""
+msgstr "Skalerer: "
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translating: "
-msgstr ""
+msgstr "Oversetter: "
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotating %s degrees."
-msgstr ""
+msgstr "Roterer %s grader."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Keying is disabled (no key inserted)."
@@ -5175,7 +5174,7 @@ msgstr "Forandre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Surface Changes"
-msgstr ""
+msgstr "Overflateendringer"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Draw Calls"
@@ -5207,31 +5206,31 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left"
-msgstr ""
+msgstr "Venstre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right View."
-msgstr ""
+msgstr "Høyrevisning."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right"
-msgstr ""
+msgstr "Høyre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View."
-msgstr ""
+msgstr "Frontvisning."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front"
-msgstr ""
+msgstr "Front"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View."
-msgstr ""
+msgstr "Bakvisning."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear"
-msgstr ""
+msgstr "Bak"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Align with view"
@@ -5275,15 +5274,15 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Information"
-msgstr ""
+msgstr "Vis Informasjon"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View FPS"
-msgstr ""
+msgstr "Vis FPS"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Half Resolution"
-msgstr ""
+msgstr "Halver Oppløsning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Audio Listener"
@@ -5364,27 +5363,27 @@ msgstr "Snap til veiledere"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
-msgstr ""
+msgstr "Bunnvisning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View"
-msgstr ""
+msgstr "Toppvisning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View"
-msgstr ""
+msgstr "Bakvisning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View"
-msgstr ""
+msgstr "Frontvisning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left View"
-msgstr ""
+msgstr "Venstrevisning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right View"
-msgstr ""
+msgstr "Høyrevisning"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Switch Perspective/Orthogonal view"
@@ -5432,11 +5431,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5570,15 +5565,15 @@ msgstr ""
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "(empty)"
-msgstr ""
+msgstr "(tom)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animations"
-msgstr ""
+msgstr "Animasjoner"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Speed (FPS):"
-msgstr ""
+msgstr "Hastighet (FPS):"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Loop"
@@ -5691,7 +5686,7 @@ msgid "Remove All"
msgstr "Fjern Funksjon"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5739,6 +5734,15 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "Legg til Element"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5748,23 +5752,24 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
msgid "Options"
-msgstr ""
+msgstr "Innstillinger"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "Innstillinger"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
-msgstr ""
+msgstr "Fane 1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 2"
-msgstr ""
+msgstr "Fane 2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 3"
-msgstr ""
+msgstr "Fane 3"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Data Type:"
@@ -5772,7 +5777,7 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "Icon"
-msgstr ""
+msgstr "Ikon"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Style"
@@ -5780,15 +5785,15 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "Font"
-msgstr ""
+msgstr "Font"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Color"
-msgstr ""
+msgstr "Farge"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme"
-msgstr ""
+msgstr "Tema"
#: editor/plugins/tile_map_editor_plugin.cpp
#, fuzzy
@@ -5829,11 +5834,11 @@ msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror X"
-msgstr ""
+msgstr "Speil X"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror Y"
-msgstr ""
+msgstr "Speil Y"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint Tile"
@@ -5845,19 +5850,19 @@ msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 0 degrees"
-msgstr ""
+msgstr "Roter 0 grader"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 90 degrees"
-msgstr ""
+msgstr "Roter 90 grader"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 180 degrees"
-msgstr ""
+msgstr "Roter 180 grader"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 270 degrees"
-msgstr ""
+msgstr "Roter 270 grader"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Could not find tile:"
@@ -5878,7 +5883,7 @@ msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet.."
+msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5919,11 +5924,11 @@ msgstr ""
#: editor/progress_dialog.cpp scene/gui/dialogs.cpp
msgid "Cancel"
-msgstr ""
+msgstr "Avbryt"
#: editor/project_export.cpp
msgid "Runnable"
-msgstr ""
+msgstr "Kjørbar"
#: editor/project_export.cpp
msgid "Delete patch '%s' from list?"
@@ -5942,24 +5947,24 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
msgid "Resources"
-msgstr ""
+msgstr "Ressurser"
#: editor/project_export.cpp
msgid "Export all resources in the project"
-msgstr ""
+msgstr "Eksporter alle ressurser til prosjektet"
#: editor/project_export.cpp
msgid "Export selected scenes (and dependencies)"
-msgstr ""
+msgstr "Eksporter valgte scener (og avhengigheter)"
#: editor/project_export.cpp
msgid "Export selected resources (and dependencies)"
-msgstr ""
+msgstr "Exporter valgte ressurs (og avhengigheter)"
#: editor/project_export.cpp
msgid "Export Mode:"
@@ -6033,6 +6038,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Prosjektnavn:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Kunne ikke opprette mappe."
@@ -6053,39 +6063,40 @@ msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
msgstr ""
+"Kunne ikke laste project.godot i prosjekt sti (error %d). Den kan være "
+"manglet eller korruptert."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
-msgstr ""
+msgstr "Kunne ikke endre project.godot i projsektstien."
#: editor/project_manager.cpp
msgid "Couldn't create project.godot in project path."
-msgstr ""
+msgstr "Kunne ikke lage project.godot i prosjektstien."
#: editor/project_manager.cpp
msgid "The following files failed extraction from package:"
-msgstr ""
+msgstr "De følgende filene feilet ekstrahering fra pakke:"
#: editor/project_manager.cpp
msgid "Rename Project"
-msgstr ""
+msgstr "Endre Navn på Prosjekt"
#: editor/project_manager.cpp
msgid "New Game Project"
-msgstr ""
+msgstr "Nytt Spill-Prosjekt"
#: editor/project_manager.cpp
msgid "Import Existing Project"
-msgstr ""
+msgstr "Importer Eksisterende Prosjekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Import & Edit"
-msgstr "Importer"
+msgstr "Importer & Endre"
#: editor/project_manager.cpp
msgid "Create New Project"
-msgstr ""
+msgstr "Opprett Nytt Prosjekt"
#: editor/project_manager.cpp
#, fuzzy
@@ -6094,24 +6105,23 @@ msgstr "Opprett skript"
#: editor/project_manager.cpp
msgid "Install Project:"
-msgstr ""
+msgstr "Installer Prosjekt:"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Install & Edit"
-msgstr "Installer"
+msgstr "Installer & Endre"
#: editor/project_manager.cpp
msgid "Project Name:"
-msgstr ""
+msgstr "Prosjektnavn:"
#: editor/project_manager.cpp
msgid "Create folder"
-msgstr ""
+msgstr "Opprett mappe"
#: editor/project_manager.cpp
msgid "Project Path:"
-msgstr ""
+msgstr "Prosjektsti:"
#: editor/project_manager.cpp
msgid "Browse"
@@ -6123,11 +6133,11 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Can't open project"
-msgstr ""
+msgstr "Kan ikke åpne prosjekt"
#: editor/project_manager.cpp
msgid "Are you sure to open more than one project?"
-msgstr ""
+msgstr "Er du sikker på at du vil åpne mer enn ett prosjekt?"
#: editor/project_manager.cpp
msgid ""
@@ -6144,11 +6154,11 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Are you sure to run more than one project?"
-msgstr ""
+msgstr "Er du sikker på at du vil kjøre mer enn ett prosjekt?"
#: editor/project_manager.cpp
msgid "Remove project from the list? (Folder contents will not be modified)"
-msgstr ""
+msgstr "Fjern prosjekt fra listen? (Mappeinnhold vil ikke bli modifisert)"
#: editor/project_manager.cpp
msgid ""
@@ -6161,6 +6171,8 @@ msgid ""
"You are about the scan %s folders for existing Godot projects. Do you "
"confirm?"
msgstr ""
+"Du er i ferd med å skanne %s mapper for eksisterende Godotprosjekter. "
+"Bekrefter du?"
#: editor/project_manager.cpp
msgid "Project Manager"
@@ -6168,19 +6180,19 @@ msgstr "Prosjektleder"
#: editor/project_manager.cpp
msgid "Project List"
-msgstr ""
+msgstr "Prosjektliste"
#: editor/project_manager.cpp
msgid "Scan"
-msgstr ""
+msgstr "Skann"
#: editor/project_manager.cpp
msgid "Select a Folder to Scan"
-msgstr ""
+msgstr "Velg en Mappe å Skanne"
#: editor/project_manager.cpp
msgid "New Project"
-msgstr ""
+msgstr "Nytt Prosjekt"
#: editor/project_manager.cpp
msgid "Templates"
@@ -6188,15 +6200,15 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Exit"
-msgstr ""
+msgstr "Avslutt"
#: editor/project_manager.cpp
msgid "Restart Now"
-msgstr ""
+msgstr "Omstart NÃ¥"
#: editor/project_manager.cpp
msgid "Can't run project"
-msgstr ""
+msgstr "Kan ikke kjøre prosjekt"
#: editor/project_manager.cpp
msgid ""
@@ -6218,10 +6230,12 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Mouse Button"
-msgstr ""
+msgstr "Museknapp"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6249,7 +6263,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6367,12 +6381,8 @@ msgid "Delete Item"
msgstr "Slett Valgte"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
-msgstr ""
+msgstr "Eksisterer allerede"
#: editor/project_settings_editor.cpp
msgid "Add Input Action"
@@ -6439,7 +6449,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6536,11 +6546,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6713,7 +6723,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7426,6 +7436,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
#, fuzzy
msgid "Generating solution..."
@@ -7481,6 +7495,10 @@ msgstr "Prosjekt"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8087,10 +8105,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8166,18 +8194,29 @@ msgstr ""
#: scene/resources/dynamic_font.cpp
msgid "Error loading font."
-msgstr ""
+msgstr "Feil ved innlasting av font."
#: scene/resources/dynamic_font.cpp
msgid "Invalid font size."
msgstr "Ugyldig fontstørrelse."
-#~ msgid "Can't write file."
-#~ msgstr "Kan ikke skrive fil."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Forrige fane"
#~ msgid "Next"
#~ msgstr "Neste"
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ugyldig version.txt format i mal. Revisjon er ikke en gyldig "
+#~ "identifikator."
+
+#~ msgid "Can't write file."
+#~ msgstr "Kan ikke skrive fil."
+
#~ msgid "Not found!"
#~ msgstr "Ikke funnet!"
diff --git a/editor/translations/nl.po b/editor/translations/nl.po
index fb2ba35793..bfedf322b3 100644
--- a/editor/translations/nl.po
+++ b/editor/translations/nl.po
@@ -11,8 +11,12 @@
# Daeran Wereld <daeran@gmail.com>, 2017.
# Dzejkop <jakubtrad@gmail.com>, 2017.
# Ferdinand de Coninck <ferdinand.deconinck@gmail.com>, 2018.
+# frank <frankvprive@gmail.com>, 2018.
+# Johannes Smit <smitjohannes96@gmail.com>, 2018.
# Jorn Theunissen <jorn-theunissen@hotmail.com>, 2018.
# Maikel <maikel_martens_1@hotmail.com>, 2017.
+# millenniumproof <millenniumproof@gmail.com>, 2018.
+# nee <lespam@protonmail.com>, 2018.
# Pieter-Jan Briers <pieterjan.briers@gmail.com>, 2017-2018.
# Robin Arys <robinarys@hotmail.com>, 2017.
# Senno Kaasjager <senno.kaasjager@gmail.com>, 2017.
@@ -24,15 +28,15 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-02-17 19:35+0000\n"
-"Last-Translator: Pieter-Jan Briers <pieterjan.briers@gmail.com>\n"
+"PO-Revision-Date: 2018-05-21 18:36+0000\n"
+"Last-Translator: Johannes Smit <smitjohannes96@gmail.com>\n"
"Language-Team: Dutch <https://hosted.weblate.org/projects/godot-engine/godot/"
"nl/>\n"
"Language: nl\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 2.19\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -513,8 +517,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Ontkoppel '%s' van '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Verbind.."
+msgid "Connect..."
+msgstr "Verbind..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -754,7 +758,7 @@ msgstr "Gouden Sponsors"
#: editor/editor_about.cpp
msgid "Mini Sponsors"
-msgstr "Mini Sponsors"
+msgstr "Mini Sponsoren"
#: editor/editor_about.cpp
msgid "Gold Donors"
@@ -770,7 +774,7 @@ msgstr "Bronzen Donors"
#: editor/editor_about.cpp
msgid "Donors"
-msgstr "Donors"
+msgstr "Donoren"
#: editor/editor_about.cpp
msgid "License"
@@ -936,12 +940,12 @@ msgid "Move Audio Bus"
msgstr "Verplaats audiobus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Sla Audio Bus Layout Op Als.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Sla Audio Bus Layout Op Als..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Locatie voor Nieuwe Layout.."
+msgid "Location for New Layout..."
+msgstr "Locatie voor Nieuwe Layout..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1079,12 +1083,12 @@ msgid "Updating Scene"
msgstr "Scene aan het Updaten"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Lokale wijziging aan het opslaan.."
+msgid "Storing local changes..."
+msgstr "Lokale wijziging aan het opslaan..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Scene aan het updaten.."
+msgid "Updating scene..."
+msgstr "Scene aan het updaten..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1152,8 +1156,8 @@ msgid "Show In File Manager"
msgstr "Weergeven in Bestandsbeheer"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nieuwe Map.."
+msgid "New Folder..."
+msgstr "Nieuwe Map..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1412,18 +1416,22 @@ msgstr "Leegmaken"
msgid "Clear Output"
msgstr "Maak Uitvoer Leeg"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Project exporteren faalt door foutcode %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Error bij het opslaan van resource!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Resource Opslaan Als.."
+msgid "Save Resource As..."
+msgstr "Resource Opslaan Als..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Ik snap het.."
+msgid "I see..."
+msgstr "Ik snap het..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1655,11 +1663,11 @@ msgid "Open Base Scene"
msgstr "Open Basisscene"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "Open Scene Snel..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "Open Script Snel..."
#: editor/editor_node.cpp
@@ -1671,7 +1679,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "Sla wijzigen aan '%s' op voor het afsluiten?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "Sla Scene Op Als..."
#: editor/editor_node.cpp
@@ -1724,7 +1732,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Deze actie kan niet ongedaan gemaakt worden. Toch herstellen?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "Snel Scene Uitvoeren..."
#: editor/editor_node.cpp
@@ -1884,7 +1892,7 @@ msgid "Previous tab"
msgstr "Vorig tabblad"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Bestanden Filteren..."
#: editor/editor_node.cpp
@@ -1896,11 +1904,11 @@ msgid "New Scene"
msgstr "Nieuwe Scene"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Nieuwe Geërfde Scene..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "Scene Openen..."
#: editor/editor_node.cpp
@@ -1920,15 +1928,15 @@ msgid "Open Recent"
msgstr "Recente Scenes Openen"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "Converteer Naar..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2193,8 +2201,8 @@ msgid "Save the currently edited resource."
msgstr "De bewerkte bron opslaan."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Opslaan Als.."
+msgid "Save As..."
+msgstr "Opslaan Als..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2302,8 +2310,8 @@ msgid "Creating Mesh Previews"
msgstr "Creëren van Mesh Previews"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Voorbeeld.."
+msgid "Thumbnail..."
+msgstr "Voorbeeld..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2455,8 +2463,8 @@ msgid "(Current)"
msgstr "(Huidig)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Mirrors ophalen, even wachten a.u.b.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Mirrors ophalen, even wachten a.u.b..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2471,14 +2479,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ongeldig version.txt formaat in sjablonen."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ongeldig version.txt formaat in sjablonen. Revisie is geen geldig "
-"identificatienummer."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Geen version.txt gevonden in sjablonen."
@@ -2541,8 +2541,8 @@ msgid "Error requesting url: "
msgstr "Fout bij het opvragen van een URL: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Verbinden met Mirror.."
+msgid "Connecting to Mirror..."
+msgstr "Verbinden met Mirror..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2558,8 +2558,8 @@ msgstr "Kan niet oplossen"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Verbinden.."
+msgid "Connecting..."
+msgstr "Verbinden..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2571,7 +2571,7 @@ msgstr "Verbonden"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "Opvragen..."
#: editor/export_template_manager.cpp
@@ -2709,12 +2709,12 @@ msgid "Collapse all"
msgstr "Klap alles in"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Hernoemen.."
+msgid "Rename..."
+msgstr "Hernoemen..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Verplaats Naar.."
+msgid "Move To..."
+msgstr "Verplaats Naar..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2725,16 +2725,16 @@ msgid "Instance"
msgstr "Instantie"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Afhankelijkheden aanpassen.."
+msgid "Edit Dependencies..."
+msgstr "Afhankelijkheden aanpassen..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Bekijk eigenaren.."
+msgid "View Owners..."
+msgstr "Bekijk eigenaren..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Dupliceren.."
+msgid "Duplicate..."
+msgstr "Dupliceren..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2761,10 +2761,10 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Bestanden Scannen,\n"
-"Wacht Alstublieft.."
+"Wacht Alstublieft..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2829,8 +2829,8 @@ msgid "Import Scene"
msgstr "Importeer Scene"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Scene Importeren.."
+msgid "Importing Scene..."
+msgstr "Scene Importeren..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2841,8 +2841,8 @@ msgid "Generating for Mesh: "
msgstr "Bouw voor Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Aangepast script uitvoeren .."
+msgid "Running Custom Script..."
+msgstr "Aangepast script uitvoeren ..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2857,8 +2857,8 @@ msgid "Error running post-import script:"
msgstr "Fout bij uitvoeren post-import script:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Opslaan.."
+msgid "Saving..."
+msgstr "Opslaan..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2877,8 +2877,8 @@ msgid "Import As:"
msgstr "Importereen Als:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Voorinstelling.."
+msgid "Preset..."
+msgstr "Voorinstelling..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3095,14 +3095,12 @@ msgid "Enable Onion Skinning"
msgstr "\"Onion Skinning\" Inschakelen"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Directions"
-msgstr "Beschrijving"
+msgstr "Richtingen"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Past"
-msgstr "Plakken"
+msgstr "Verleden"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Future"
@@ -3299,15 +3297,15 @@ msgid "Transition Node"
msgstr "Transition Node"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Importeer Animaties.."
+msgid "Import Animations..."
+msgstr "Importeer Animaties..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Wijzig Node Filters"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Filters..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3375,8 +3373,8 @@ msgid "Fetching:"
msgstr "Ophalen:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "Oplossen .."
+msgid "Resolving..."
+msgstr "Oplossen ..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3442,8 +3440,8 @@ msgid "Site:"
msgstr "Site:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Ondersteuning.."
+msgid "Support..."
+msgstr "Ondersteuning..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3620,9 +3618,8 @@ msgid "Pan Mode"
msgstr "Verschuif Modus"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Toggles snapping"
-msgstr "Breekpunt Aan- of Uitschakelen"
+msgstr "Snappen Aan- of Uitschakelen"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Snap"
@@ -3641,13 +3638,13 @@ msgid "Use Rotation Snap"
msgstr "Gebruik Rotatie Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "Configureer Uitlijnen..."
+msgstr "Configureer Snap..."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap Relative"
-msgstr "Uitlijn Relatief"
+msgstr "Snap Relatief"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Pixel Snap"
@@ -3658,14 +3655,12 @@ msgid "Smart snapping"
msgstr "Slim Uitlijnen"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to parent"
-msgstr "Uitlijnen naar ouder"
+msgstr "Snap naar ouder"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Snap to node anchor"
-msgstr "Uitlijnen naar node anker"
+msgstr "Snap naar node anker"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node sides"
@@ -3744,6 +3739,14 @@ msgid "Show Guides"
msgstr "Toon hulplijnen"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Toon Oorsprongspunt"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Toon Aanzicht Portaal"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centreer Selectie"
@@ -3780,9 +3783,8 @@ msgid "Drag pivot from mouse position"
msgstr "Versleep draaipunt vanaf muispositie"
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Set pivot at mouse position"
-msgstr "Verwijder Signaal"
+msgstr "Plaats pivot bij muispositie"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Multiply grid step by 2"
@@ -3854,11 +3856,11 @@ msgstr "Verwijder Geselecteerde Item"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import from Scene"
-msgstr "Importeer vanaf de Scene"
+msgstr "Importeer Vanuit Scene"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Update from Scene"
-msgstr "Werk bij vanaf de Scene"
+msgstr "Update Vanuit Scene"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat0"
@@ -3869,13 +3871,12 @@ msgid "Flat1"
msgstr "Plat1"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Ease in"
-msgstr "Schaal Selectie"
+msgstr "Rustig Aanzetten"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Ease out"
-msgstr "Neem af naar buiten"
+msgstr "Rustig Afzetten"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Smoothstep"
@@ -3902,9 +3903,8 @@ msgid "Remove point"
msgstr "Punt verwijderen"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Left linear"
-msgstr "Lineair"
+msgstr "Links Lineair"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Right linear"
@@ -3915,9 +3915,8 @@ msgid "Load preset"
msgstr "Laad voorinstelling"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Remove Curve Point"
-msgstr "Verwijder Signaal"
+msgstr "Verwijder Curve Punt"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Toggle Curve Linear Tangent"
@@ -3933,9 +3932,8 @@ msgid "Bake GI Probe"
msgstr "Bak GI Probe"
#: editor/plugins/gradient_editor_plugin.cpp
-#, fuzzy
msgid "Add/Remove Color Ramp Point"
-msgstr "Verwijder/Voeg Kleuren Hellings Punt Toe"
+msgstr "Voeg Toe/Verwijder Kleur Hellingspunt"
#: editor/plugins/gradient_editor_plugin.cpp
#: editor/plugins/shader_graph_editor_plugin.cpp
@@ -3961,7 +3959,7 @@ msgid ""
"Create and assign one?"
msgstr ""
"Geen OccluderPolygon2D resource op deze node.\n"
-"Creëer en wijs een toe?"
+"Creëer en wijs één toe?"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Occluder Polygon"
@@ -4020,13 +4018,12 @@ msgid "Create Navigation Mesh"
msgstr "Creëer Navigatie Mesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "Contained Mesh is not of type ArrayMesh."
-msgstr "Bevatte Mesh is niet van type ArrayMesh"
+msgstr "Bevatte Mesh is niet van type ArrayMesh."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "UV Unwrap failed, mesh may not be manifold?"
-msgstr ""
+msgstr "UV Uitpakken is gefaald, wellicht is de mesh niet manifold?"
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
@@ -4046,6 +4043,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Mesh heeft geen oppervlakte om omlijning van te maken!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Mesh grondtype is niet PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Kon omlijning niet maken!"
@@ -4066,19 +4067,17 @@ msgid "Create Convex Static Body"
msgstr "Creëer Convex Statisch Lichaam"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "Create Trimesh Collision Sibling"
-msgstr "Creëer Trimesh Botsings Broer"
+msgstr "Creëer Trimesh Botsing Broer"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "Create Convex Collision Sibling"
-msgstr "Creëer Convex Botsings Broer"
+msgstr "Creëer Convex Botsing Broer"
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
-msgid "Create Outline Mesh.."
-msgstr "Creëer Omlijning Mesh.."
+msgid "Create Outline Mesh..."
+msgstr "Creëer Omlijning Mesh..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4090,7 +4089,7 @@ msgstr "Geef UV2 Weer"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Unwrap UV2 for Lightmap/AO"
-msgstr ""
+msgstr "Pak UV2 uit voor Lichtmap/AO"
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
@@ -4098,9 +4097,8 @@ msgid "Create Outline Mesh"
msgstr "Creëer Omlijning Mesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "Outline Size:"
-msgstr "Omlijning Grootte:"
+msgstr "Grootte Omlijning:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and no MultiMesh set in node)."
@@ -4146,7 +4144,7 @@ msgstr "Ouder heeft geen vaste vlakken om te bevolken."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Couldn't map area."
-msgstr ""
+msgstr "Kon het gebied niet mappen."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Source Mesh:"
@@ -4158,7 +4156,7 @@ msgstr "Selecteer een Doel Oppervlakte:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate Surface"
-msgstr ""
+msgstr "Bevolk Oppervlakte"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate MultiMesh"
@@ -4229,9 +4227,8 @@ msgid "Creating heightfield..."
msgstr "Hoogteveld aan het creëeren..."
#: editor/plugins/navigation_mesh_generator.cpp
-#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "Lokale wijziging aan het opslaan.."
+msgstr "Markeer loopbare driehoeken..."
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
@@ -4239,9 +4236,8 @@ msgid "Constructing compact heightfield..."
msgstr "Compact hoogteveld aan het bouwen..."
#: editor/plugins/navigation_mesh_generator.cpp
-#, fuzzy
msgid "Eroding walkable area..."
-msgstr "Wandelbaar gebied eroderen..."
+msgstr "Wandelbaar gebied aan het eroderen..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Partitioning..."
@@ -4257,15 +4253,15 @@ msgstr "Polymesh aan het creëeren..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Converting to native navigation mesh..."
-msgstr ""
+msgstr "Naar navigatie mesh aan het converteren..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Navigation Mesh Generator Setup:"
-msgstr ""
+msgstr "Navigatie Mesh Generator Setup:"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Parsing Geometry..."
-msgstr ""
+msgstr "Geometrie aan het ontleden..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Done!"
@@ -4282,262 +4278,258 @@ msgstr "AABB Genereren"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Can only set point into a ParticlesMaterial process material"
-msgstr ""
+msgstr "Kan punt alleen plaatsen in een PartikelsMateriaal proces materiaal"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Error loading image:"
msgstr "Error bij het laden van afbeelding:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Geen pixels met transparantie > 128 in afbeelding.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Geen pixels met transparantie > 128 in afbeelding..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
-msgstr ""
+msgstr "Genereer Zichtbaarheid Rechthoek"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Load Emission Mask"
-msgstr ""
+msgstr "Laad Emissie Masker"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Clear Emission Mask"
-msgstr ""
+msgstr "Leeg Emissie Masker"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Particles"
-msgstr ""
+msgstr "Partikels"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generated Point Count:"
-msgstr ""
+msgstr "Telling Gegenereerde Punten:"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generation Time (sec):"
-msgstr ""
+msgstr "Genereer Tijd (sec):"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Mask"
-msgstr ""
+msgstr "Emissie Masker"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Capture from Pixel"
-msgstr ""
+msgstr "Neem uit Pixel"
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Emission Colors"
-msgstr ""
+msgstr "Kleuren Emissie"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry."
-msgstr ""
+msgstr "Node bevat geen geometrie."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Node does not contain geometry (faces)."
-msgstr ""
+msgstr "Node bevat geen geometrie (vlakken)."
#: editor/plugins/particles_editor_plugin.cpp
msgid "A processor material of type 'ParticlesMaterial' is required."
-msgstr ""
+msgstr "Een processor materiaal of type 'PartikelMateriaal' is nodig."
#: editor/plugins/particles_editor_plugin.cpp
msgid "Faces contain no area!"
-msgstr ""
+msgstr "Vlakken bevatten geen gebied!"
#: editor/plugins/particles_editor_plugin.cpp
msgid "No faces!"
-msgstr ""
+msgstr "Geen vlakken!"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate AABB"
-msgstr ""
+msgstr "Genereer AABB"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Mesh"
-msgstr ""
+msgstr "Creëer Emissie Punten Vanuit Mesh"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Node"
-msgstr ""
+msgstr "Creëer Emissie Punten Vanuit Node"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emitter"
-msgstr ""
+msgstr "Creëer Emitter"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Points:"
-msgstr ""
+msgstr "Emissie Punten:"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points"
-msgstr ""
+msgstr "Oppervlakte Punten"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Surface Points+Normal (Directed)"
-msgstr ""
+msgstr "Oppervlakte Punten+Normaal (Gericht)"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Volume"
-msgstr ""
+msgstr "Volume"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Emission Source: "
-msgstr ""
+msgstr "Emissie Bron: "
#: editor/plugins/particles_editor_plugin.cpp
msgid "Generate Visibility AABB"
-msgstr ""
+msgstr "Genereer Zichtbaarheid AABB"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove Point from Curve"
-msgstr ""
+msgstr "Verwijder Punt van Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove Out-Control from Curve"
-msgstr ""
+msgstr "Verwijder Uit-Control van Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Remove In-Control from Curve"
-msgstr ""
+msgstr "Verwijder In-Controle van Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Add Point to Curve"
-msgstr ""
+msgstr "Voeg Punt toe aan Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Point in Curve"
-msgstr ""
+msgstr "Verplaats Punt in Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move In-Control in Curve"
-msgstr ""
+msgstr "Verplaats In-Control in Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Move Out-Control in Curve"
-msgstr ""
+msgstr "Verplaats Uit-Controle in Curve"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Select Points"
-msgstr ""
+msgstr "Selecteer Punten"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Shift+Drag: Select Control Points"
-msgstr ""
+msgstr "Shift+Drag: Selecteer Controle Punten"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Click: Add Point"
-msgstr ""
+msgstr "Klik: Voeg Punt Toe"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Right Click: Delete Point"
-msgstr ""
+msgstr "Rechter Klik: Verwijder Punt"
#: editor/plugins/path_2d_editor_plugin.cpp
msgid "Select Control Points (Shift+Drag)"
-msgstr ""
+msgstr "Selecteer Controle Punten (Shift+Sleep)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Add Point (in empty space)"
-msgstr ""
+msgstr "Voeg Punt Toe (in lege ruimte)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Segment (in curve)"
-msgstr ""
+msgstr "Splits Segment (in curve)"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Delete Point"
-msgstr ""
+msgstr "Verwijder Punt"
#: editor/plugins/path_2d_editor_plugin.cpp
#: editor/plugins/path_editor_plugin.cpp
msgid "Close Curve"
-msgstr ""
+msgstr "Sluit Curve"
#: editor/plugins/path_editor_plugin.cpp
msgid "Curve Point #"
-msgstr ""
+msgstr "Curve Punt #"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve Point Position"
-msgstr "Verwijder Signaal"
+msgstr "Zet Curve Punt Positie"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve In Position"
-msgstr "Verwijder Signaal"
+msgstr "Zet Curve In Positie"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve Out Position"
-msgstr "Verwijder Signaal"
+msgstr "Set Curve Uit Positie"
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Path"
-msgstr ""
+msgstr "Splits Pad"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove Path Point"
-msgstr ""
+msgstr "Verwijder Pad Punt"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Remove Out-Control Point"
-msgstr "Verwijder Autoload"
+msgstr "Verwijder Uit-Controle Punt"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove In-Control Point"
-msgstr ""
+msgstr "Verwijder In-Controle Punt"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Create UV Map"
-msgstr ""
+msgstr "Creëer UV Map"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Transform UV Map"
-msgstr ""
+msgstr "Transformeer UV Map"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon 2D UV Editor"
-msgstr ""
+msgstr "Polygon 2D UV Editor"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Point"
-msgstr ""
+msgstr "Beweeg Punt"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Ctrl: Rotate"
-msgstr ""
+msgstr "Ctrl: Roteer"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift: Move All"
-msgstr ""
+msgstr "Shift: Beweeg alles"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift+Ctrl: Scale"
-msgstr ""
+msgstr "Shift+Ctrl: Schaal"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Polygon"
-msgstr ""
+msgstr "Beweeg Polygon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Rotate Polygon"
-msgstr ""
+msgstr "Roteer Polygon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Scale Polygon"
-msgstr ""
+msgstr "Schaal Polygon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4549,70 +4541,70 @@ msgstr "Bewerken"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Polygon->UV"
-msgstr ""
+msgstr "Polygon->UV"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "UV->Polygon"
-msgstr ""
+msgstr "UV->Polygon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Clear UV"
-msgstr ""
+msgstr "Wis UV"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap"
-msgstr ""
+msgstr "Snap"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Enable Snap"
-msgstr ""
+msgstr "Zet Snap Aan"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid"
-msgstr ""
+msgstr "Grid"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "ERROR: Couldn't load resource!"
-msgstr ""
+msgstr "ERROR: Laden van bron mislukt!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Add Resource"
-msgstr ""
+msgstr "Voeg Bron Toe"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Rename Resource"
-msgstr ""
+msgstr "Naam Wijzigen Bron"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Delete Resource"
-msgstr ""
+msgstr "Verwijder Bron"
#: editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Resource clipboard is empty!"
-msgstr ""
+msgstr "Bronnen klembord is leeg!"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
msgid "Open in Editor"
-msgstr ""
+msgstr "Openen in Editor"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/scene_tree_editor.cpp
msgid "Instance:"
-msgstr ""
+msgstr "Instantie:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
msgid "Type:"
-msgstr ""
+msgstr "Type:"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Load Resource"
-msgstr ""
+msgstr "Laad Bron"
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4622,249 +4614,246 @@ msgid "Paste"
msgstr "Plakken"
#: editor/plugins/resource_preloader_editor_plugin.cpp
-#, fuzzy
msgid "ResourcePreloader"
-msgstr "Resource"
+msgstr "BronnenPrelader"
#: editor/plugins/script_editor_plugin.cpp
msgid "Clear Recent Files"
-msgstr ""
+msgstr "Wis Recente Bestanden"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close and save changes?"
-msgstr ""
+msgstr "Wijzigingen oplaan en sluiten?"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error while saving theme"
-msgstr ""
+msgstr "Fout bij het opslaan van het thema"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error saving"
-msgstr ""
+msgstr "Fout bij het opslaan"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error importing theme"
-msgstr ""
+msgstr "Fout bij import van thema"
#: editor/plugins/script_editor_plugin.cpp
msgid "Error importing"
-msgstr ""
+msgstr "Fout bij importeren"
#: editor/plugins/script_editor_plugin.cpp
msgid "Import Theme"
-msgstr ""
+msgstr "Importeer Thema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr ""
+msgid "Save Theme As..."
+msgstr "Thema Opslaan Als..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
-msgstr ""
+msgstr " Klasse Referentie"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Sort"
-msgstr "Sorteren:"
+msgstr "Sorteren"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Move Up"
-msgstr ""
+msgstr "Plaats Omhoog"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Move Down"
-msgstr ""
+msgstr "Plaats Omlaag"
#: editor/plugins/script_editor_plugin.cpp
msgid "Next script"
-msgstr ""
+msgstr "Volgend script"
#: editor/plugins/script_editor_plugin.cpp
msgid "Previous script"
-msgstr ""
+msgstr "Vorig script"
#: editor/plugins/script_editor_plugin.cpp
msgid "File"
-msgstr ""
+msgstr "Bestand"
#: editor/plugins/script_editor_plugin.cpp
msgid "New"
-msgstr ""
+msgstr "Nieuw"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save All"
-msgstr ""
+msgstr "Alles Opslaan"
#: editor/plugins/script_editor_plugin.cpp
msgid "Soft Reload Script"
-msgstr ""
+msgstr "Zacht Herladen Script"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Copy Script Path"
-msgstr "Kopieer Pad"
+msgstr "Kopieer Script Pad"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Show In File System"
-msgstr "Weergeven in Bestandsbeheer"
+msgstr "Toon in Bestandsbeheer"
#: editor/plugins/script_editor_plugin.cpp
msgid "History Prev"
-msgstr ""
+msgstr "Geschiedenis voorgaande"
#: editor/plugins/script_editor_plugin.cpp
msgid "History Next"
-msgstr ""
+msgstr "Geschiedenis Volgende"
#: editor/plugins/script_editor_plugin.cpp
msgid "Reload Theme"
-msgstr ""
+msgstr "Herlaad Thema"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save Theme"
-msgstr ""
+msgstr "Thema Opslaan"
#: editor/plugins/script_editor_plugin.cpp
msgid "Save Theme As"
-msgstr ""
+msgstr "Thema Opslaan Als"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Docs"
-msgstr ""
+msgstr "Sluit Docs"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close All"
-msgstr ""
+msgstr "Sluit Alles"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Other Tabs"
-msgstr ""
+msgstr "Sluit Andere Tabbladen"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
msgid "Run"
msgstr "Starten"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Toggle Scripts Panel"
-msgstr "Toggle Favoriet"
+msgstr "Schakel Scripten Paneel"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr ""
+msgid "Find..."
+msgstr "Vind..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
msgid "Find Next"
-msgstr ""
+msgstr "Vind Volgende"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Over"
-msgstr ""
+msgstr "Stap Over"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Step Into"
-msgstr ""
+msgstr "Stap In"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Break"
-msgstr ""
+msgstr "Breek"
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
#: editor/script_editor_debugger.cpp
msgid "Continue"
-msgstr ""
+msgstr "Vervolg"
#: editor/plugins/script_editor_plugin.cpp
msgid "Keep Debugger Open"
-msgstr ""
+msgstr "Houd Debugger Open"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Debug with external editor"
-msgstr "Afhankelijkheden Editor"
+msgstr "Debug met externe editor"
#: editor/plugins/script_editor_plugin.cpp
msgid "Open Godot online documentation"
-msgstr ""
+msgstr "Open Godot online documentatie"
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the class hierarchy."
-msgstr ""
+msgstr "Zoek in de klasse hiërarchie."
#: editor/plugins/script_editor_plugin.cpp
msgid "Search the reference documentation."
-msgstr ""
+msgstr "Zoek in de referentie documentatie."
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to previous edited document."
-msgstr ""
+msgstr "Ga naar voorgaand bewerkte document."
#: editor/plugins/script_editor_plugin.cpp
msgid "Go to next edited document."
-msgstr ""
+msgstr "Ga naar volgend bewerkte document."
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Discard"
-msgstr "Discreet"
+msgstr "Verwerp"
#: editor/plugins/script_editor_plugin.cpp
msgid "Create Script"
-msgstr ""
+msgstr "Creëer Script"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
"The following files are newer on disk.\n"
"What action should be taken?:"
msgstr ""
+"De volgende bestanden zijn nieuwer op de schijf.\n"
+"Welke aktie moet worden genomen?:"
#: editor/plugins/script_editor_plugin.cpp
msgid "Reload"
-msgstr ""
+msgstr "Herlaad"
#: editor/plugins/script_editor_plugin.cpp
msgid "Resave"
-msgstr ""
+msgstr "Heropslaan"
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Debugger"
-msgstr ""
+msgstr "Debugger"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
"Built-in scripts can only be edited when the scene they belong to is loaded"
msgstr ""
+"Ingebouwde scripts kunnen alleen ge-edit worden wanneer de bijbehorende "
+"scène geladen is"
#: editor/plugins/script_text_editor.cpp
msgid "Only resources from filesystem can be dropped."
-msgstr ""
+msgstr "Alleen bronnen uit bestandssysteem kunnen gedropt worden."
#: editor/plugins/script_text_editor.cpp
msgid "Pick Color"
-msgstr ""
+msgstr "Kies Kleur"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Case"
-msgstr ""
+msgstr "Converteer Hoofdlettergebruik"
#: editor/plugins/script_text_editor.cpp
msgid "Uppercase"
-msgstr ""
+msgstr "Hoofdletters"
#: editor/plugins/script_text_editor.cpp
msgid "Lowercase"
-msgstr ""
+msgstr "Kleine letters"
#: editor/plugins/script_text_editor.cpp
msgid "Capitalize"
-msgstr ""
+msgstr "Maak Hoofdletters"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
@@ -4883,58 +4872,56 @@ msgid "Select All"
msgstr "Alles Selecteren"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Delete Line"
-msgstr "Verwijder"
+msgstr "Verwijder Regel"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Left"
-msgstr ""
+msgstr "Links Inspringen"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Right"
-msgstr ""
+msgstr "Rechts Inspringen"
#: editor/plugins/script_text_editor.cpp
msgid "Toggle Comment"
-msgstr ""
+msgstr "Commentaar Aan/Uit"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Fold/Unfold Line"
-msgstr "Ga naar Regel"
+msgstr "Vouw/Ontvouw Regel"
#: editor/plugins/script_text_editor.cpp
msgid "Fold All Lines"
-msgstr ""
+msgstr "Vouw Alle Regels"
#: editor/plugins/script_text_editor.cpp
msgid "Unfold All Lines"
-msgstr ""
+msgstr "Ontvouw Alle Regels"
#: editor/plugins/script_text_editor.cpp
msgid "Clone Down"
-msgstr ""
+msgstr "Kloon Omlaag"
#: editor/plugins/script_text_editor.cpp
msgid "Complete Symbol"
-msgstr ""
+msgstr "Voltooi Symbool"
#: editor/plugins/script_text_editor.cpp
msgid "Trim Trailing Whitespace"
-msgstr ""
+msgstr "Trim Navolgende Spaties"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Spaces"
-msgstr ""
+msgstr "Converteer Indentatie Naar Spaties"
#: editor/plugins/script_text_editor.cpp
msgid "Convert Indent To Tabs"
-msgstr ""
+msgstr "Converteer Indentatie Naar Tabs"
#: editor/plugins/script_text_editor.cpp
msgid "Auto Indent"
-msgstr ""
+msgstr "Auto Indentatie"
#: editor/plugins/script_text_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -4943,398 +4930,387 @@ msgstr "Breekpunt Aan- of Uitschakelen"
#: editor/plugins/script_text_editor.cpp
msgid "Remove All Breakpoints"
-msgstr ""
+msgstr "Verwijder Alle Breekpunten"
#: editor/plugins/script_text_editor.cpp
msgid "Goto Next Breakpoint"
-msgstr ""
+msgstr "Ga Naar Volgende Breekpunt"
#: editor/plugins/script_text_editor.cpp
msgid "Goto Previous Breakpoint"
-msgstr ""
+msgstr "Ga Naar Vorige Breekpunt"
#: editor/plugins/script_text_editor.cpp
msgid "Convert To Uppercase"
-msgstr ""
+msgstr "Converteer Naar Hoofdletters"
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Convert To Lowercase"
-msgstr "Verbind Aan Node:"
+msgstr "Converteer Naar Kleine Letters"
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
-msgstr ""
+msgstr "Vind Vorige"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr ""
+msgid "Replace..."
+msgstr "Vervang..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr ""
+msgid "Goto Function..."
+msgstr "Ga Naar Functie..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr ""
+msgid "Goto Line..."
+msgstr "Ga Naar Regel..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
-msgstr ""
+msgstr "Contextuele Hulp"
#: editor/plugins/shader_editor_plugin.cpp
msgid "Shader"
-msgstr ""
+msgstr "Shader"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Constant"
-msgstr ""
+msgstr "Verander Shalar Constante"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Constant"
-msgstr ""
+msgstr "Verander Vec Constante"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Constant"
-msgstr ""
+msgstr "Verander RGB Constante"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Operator"
-msgstr ""
+msgstr "Verander Scalar Operator"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Operator"
-msgstr ""
+msgstr "Verander Vec Operator"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Scalar Operator"
-msgstr ""
+msgstr "Verander Vec Scalar Operator"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Operator"
-msgstr ""
+msgstr "Verander RGB Operator"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Toggle Rot Only"
-msgstr ""
+msgstr "Aan/Uit Alleen Rot"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Function"
-msgstr ""
+msgstr "Verander Scalar Functie"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Function"
-msgstr ""
+msgstr "Verander Vec Functie"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Scalar Uniform"
-msgstr ""
+msgstr "Verander Scalar Uniform"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Vec Uniform"
-msgstr ""
+msgstr "Verander Vec Uniform"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change RGB Uniform"
-msgstr ""
+msgstr "Verander RGB Uniform"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Default Value"
-msgstr ""
+msgstr "Verander Standaardwaarde"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change XForm Uniform"
-msgstr ""
+msgstr "Verander XForm Uniform"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Texture Uniform"
-msgstr ""
+msgstr "Verander Textuur Uniform"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Cubemap Uniform"
-msgstr ""
+msgstr "Verander Cubemap Uniform"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Comment"
-msgstr ""
+msgstr "Verander Commentaar"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add/Remove to Color Ramp"
-msgstr ""
+msgstr "Voeg Toe/Verwijder van Kleur Helling"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add/Remove to Curve Map"
-msgstr ""
+msgstr "Voeg Toe/Verwijder van Curve Map"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Modify Curve Map"
-msgstr ""
+msgstr "Wijzig Curve Map"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Change Input Name"
-msgstr ""
+msgstr "Verander Input Naam"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Connect Graph Nodes"
-msgstr ""
+msgstr "Verbind Graaf Knooppunten"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Disconnect Graph Nodes"
-msgstr ""
+msgstr "Ontkoppel Graaf Knooppunten"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Remove Shader Graph Node"
-msgstr ""
+msgstr "Verwijder Shader Graaf Knooppunten"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Move Shader Graph Node"
-msgstr ""
+msgstr "Verplaats Shader Graaf Knooppunten"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Duplicate Graph Node(s)"
-msgstr ""
+msgstr "Dupliceer Graaf Knooppunt(en)"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Delete Shader Graph Node(s)"
-msgstr ""
+msgstr "Verwijder Shader Graaf Knooppunt(en)"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Error: Cyclic Connection Link"
-msgstr ""
+msgstr "Fout: Cyclische Connectie Link"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Error: Missing Input Connections"
-msgstr ""
+msgstr "Fout: Ontbrekende Input Connecties"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add Shader Graph Node"
-msgstr ""
+msgstr "Voeg Shader Graaf Knooppunt Toe"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Orthogonal"
-msgstr ""
+msgstr "Orthogonaal"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Perspective"
-msgstr ""
+msgstr "Perspectief"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Aborted."
-msgstr ""
+msgstr "Transformatie Afgebroken."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "X-Axis Transform."
-msgstr ""
+msgstr "X-As Transformatie."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Y-Axis Transform."
-msgstr ""
+msgstr "Y-As Transformatie."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Z-Axis Transform."
-msgstr ""
+msgstr "Z-As Transformatie."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Plane Transform."
-msgstr ""
+msgstr "Bekijk Vlak Transformatie."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scaling: "
-msgstr ""
+msgstr "Schaling: "
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Translating: "
-msgstr "Transitie"
+msgstr "Transitie: "
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotating %s degrees."
-msgstr ""
+msgstr "Roteren %s graden."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Keying is disabled (no key inserted)."
-msgstr ""
+msgstr "Key-en is uitgeschakeld (geen key ingevoegd)."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Animation Key Inserted."
-msgstr ""
+msgstr "Animatie Key Ingevoegd."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Objects Drawn"
-msgstr ""
+msgstr "Objecten Getekend"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Material Changes"
-msgstr "Lokale wijziging aan het opslaan.."
+msgstr "Materiaal Wijzigingen"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Shader Changes"
-msgstr "Wijzig"
+msgstr "Shader Wijzigingen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Surface Changes"
-msgstr ""
+msgstr "Oppervlakte Wijzigingen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Draw Calls"
-msgstr ""
+msgstr "Teken Aanroepingen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Vertices"
-msgstr ""
+msgstr "Vertices"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "FPS"
-msgstr ""
+msgstr "FPS"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View."
-msgstr ""
+msgstr "Bovenaanzicht."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View."
-msgstr ""
+msgstr "Onderaanzicht."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom"
-msgstr ""
+msgstr "Onder"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left View."
-msgstr ""
+msgstr "Linkeraanzicht."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left"
-msgstr ""
+msgstr "Links"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right View."
-msgstr ""
+msgstr "Rechteraanzicht."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right"
-msgstr ""
+msgstr "Rechts"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View."
-msgstr ""
+msgstr "Vooraanzicht."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front"
-msgstr ""
+msgstr "Voor"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View."
-msgstr ""
+msgstr "Achteraanzicht."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear"
-msgstr ""
+msgstr "Achter"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Align with view"
-msgstr ""
+msgstr "Uitlijnen met zicht"
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "OK :("
-msgstr ""
+msgstr "OK :("
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "No parent to instance a child at."
-msgstr ""
+msgstr "Geen ouder om kind aan te instantiëren."
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "This operation requires a single selected node."
-msgstr ""
+msgstr "Deze bewerking vereist één geselecteerde knooppunt."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Normal"
-msgstr ""
+msgstr "Weergave Normaalvector"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Wireframe"
-msgstr ""
+msgstr "Weergave Wireframe"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Overdraw"
-msgstr ""
+msgstr "Weergave Overdraw"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Display Unshaded"
-msgstr ""
+msgstr "Weergave Zonder Shading"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Environment"
-msgstr ""
+msgstr "Bekijk Omgeving"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Gizmos"
-msgstr ""
+msgstr "Bekijk Gizmos"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Information"
-msgstr ""
+msgstr "Bekijk Informatie"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "View FPS"
-msgstr "Bekijk Bestanden"
+msgstr "Bekijk FPS"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Half Resolution"
-msgstr "Schaal Selectie"
+msgstr "Halve Resolutie"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Audio Listener"
-msgstr ""
+msgstr "Audio Luisteraar"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Doppler Enable"
-msgstr "Inschakelen"
+msgstr "Inschakelen Doppler"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
-msgstr ""
+msgstr "Vrijekijk Links"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Right"
-msgstr ""
+msgstr "Vrijekijk Rechts"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Forward"
-msgstr "Ga Verder"
+msgstr "Vrijekijk Vooruit"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Backwards"
-msgstr "Achterwaarts"
+msgstr "Vrijekijk Achteruit"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Up"
-msgstr ""
+msgstr "Vrijekijk Omhoog"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Down"
-msgstr "Scrollwiel Omlaag."
+msgstr "Vrijekijk Omlaag"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Speed Modifier"
-msgstr ""
+msgstr "Vrijekijk Snelheid Modificator"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "XForm Dialog"
-msgstr ""
+msgstr "XForm Dialoog"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Select Mode (Q)"
-msgstr "Selecteer Modus"
+msgstr "Selectiestand (Q)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid ""
@@ -5342,22 +5318,25 @@ msgid ""
"Alt+Drag: Move\n"
"Alt+RMB: Depth list selection"
msgstr ""
+"Slepen: Roteren\n"
+"Atl+Slepen: Verplaatsen\n"
+"Alt+RMB: Diepte selectie"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Move Mode (W)"
-msgstr ""
+msgstr "Beweegstand (W)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate Mode (E)"
-msgstr ""
+msgstr "Rotatiestand (E)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale Mode (R)"
-msgstr ""
+msgstr "Schaalstand (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
-msgstr ""
+msgstr "Lokale Coördinaten"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
@@ -5370,64 +5349,63 @@ msgstr "Op hulplijnen uitlijnen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
-msgstr ""
+msgstr "Onderaanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Top View"
-msgstr ""
+msgstr "Bovenaanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rear View"
-msgstr ""
+msgstr "Achteraanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Front View"
-msgstr ""
+msgstr "Vooraanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Left View"
-msgstr ""
+msgstr "Linker Zijaanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Right View"
-msgstr ""
+msgstr "Rechter Zijaanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Switch Perspective/Orthogonal view"
-msgstr ""
+msgstr "Schakel Perspectief/Orthogonaal aanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Insert Animation Key"
-msgstr ""
+msgstr "Voeg Animatiesleutel toe"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Focus Origin"
-msgstr ""
+msgstr "Focus op Oorsprongspunt"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Focus Selection"
-msgstr ""
+msgstr "Focus Selectie"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Align Selection With View"
-msgstr ""
+msgstr "Arrangeer Selectie naar Aanzicht"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Tool Select"
-msgstr "Alle Selectie"
+msgstr "Gereedschappen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Tool Move"
-msgstr ""
+msgstr "Beweeg Gereedschap"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Tool Rotate"
-msgstr ""
+msgstr "Roteer Gereedschap"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Tool Scale"
-msgstr ""
+msgstr "Verschalen Gereedschap"
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
@@ -5436,52 +5414,48 @@ msgstr "Toggle Favoriet"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform"
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
+msgstr "Transformatie"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr ""
+msgid "Transform Dialog..."
+msgstr "Transformatie Dialoog..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
-msgstr ""
+msgstr "1 Aanzicht Portaal"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports"
-msgstr ""
+msgstr "2 Aanzicht Portalen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "2 Viewports (Alt)"
-msgstr ""
+msgstr "2 Aanzicht Portalen (Alt)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "3 Viewports"
-msgstr ""
+msgstr "3 Aanzicht Portalen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "3 Viewports (Alt)"
-msgstr ""
+msgstr "3 Aanzicht Portalen (Alt)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "4 Viewports"
-msgstr ""
+msgstr "4 Aanzicht Portalen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Origin"
-msgstr ""
+msgstr "Bekijk Oorsprongspunt"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Grid"
-msgstr ""
+msgstr "Bekijk Raster"
#: editor/plugins/spatial_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Settings"
-msgstr ""
+msgstr "Instellingen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Skeleton Gizmo visibility"
@@ -5489,71 +5463,71 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap Settings"
-msgstr ""
+msgstr "Snap instellingen"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translate Snap:"
-msgstr ""
+msgstr "Verplaats Snap:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate Snap (deg.):"
-msgstr ""
+msgstr "Draai Snap (grad.):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale Snap (%):"
-msgstr ""
+msgstr "Verander Grootte van Snap (%):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Viewport Settings"
-msgstr ""
+msgstr "Instellingen Aanzicht Portaal"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Perspective FOV (deg.):"
-msgstr ""
+msgstr "Perspectief FOV (grad.):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Z-Near:"
-msgstr ""
+msgstr "Bekijk Z-Near:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View Z-Far:"
-msgstr ""
+msgstr "Bekijk Z-Far:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Change"
-msgstr ""
+msgstr "Transformatie Verandering"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translate:"
-msgstr ""
+msgstr "Verplaats:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate (deg.):"
-msgstr ""
+msgstr "Rotatie (graden):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale (ratio):"
-msgstr ""
+msgstr "Verschalen (ratio):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Type"
-msgstr ""
+msgstr "Transformatie Type"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Pre"
-msgstr ""
+msgstr "Pre"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Post"
-msgstr ""
+msgstr "Post"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "ERROR: Couldn't load frame resource!"
-msgstr ""
+msgstr "FOUT: Kan frame benodigdheden niet laden!"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Frame"
-msgstr ""
+msgstr "Voeg Frame toe"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Resource clipboard is empty or not a texture!"
@@ -5561,60 +5535,59 @@ msgstr ""
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Paste Frame"
-msgstr ""
+msgstr "Frame Plakken"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Empty"
-msgstr ""
+msgstr "Lege Toevoegen"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Change Animation Loop"
-msgstr ""
+msgstr "Verander Animatie Lus"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Change Animation FPS"
-msgstr ""
+msgstr "Verander Animatie FPS"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "(empty)"
-msgstr ""
+msgstr "(leeg)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animations"
-msgstr ""
+msgstr "Animaties"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Speed (FPS):"
-msgstr ""
+msgstr "Snelheid (FPS):"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Loop"
-msgstr ""
+msgstr "Lus"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Animation Frames"
-msgstr ""
+msgstr "Animatie Frames"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Insert Empty (Before)"
-msgstr ""
+msgstr "Lege Toevoegen (Hiervoor)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Insert Empty (After)"
-msgstr ""
+msgstr "Lege Toevoegen (Hierna)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "Move (Before)"
-msgstr "Kopiëer Nodes"
+msgstr "Verplaats (Hiervoor)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Move (After)"
-msgstr ""
+msgstr "Verplaats (Hierna)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "SpriteFrames"
-msgstr ""
+msgstr "Sprite-Frames"
#: editor/plugins/style_box_editor_plugin.cpp
msgid "StyleBox Preview:"
@@ -5634,7 +5607,7 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "<None>"
-msgstr ""
+msgstr "<Geen>"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Pixel Snap"
@@ -5661,50 +5634,48 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Separation:"
-msgstr ""
+msgstr "Afzondering:"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Texture Region"
-msgstr ""
+msgstr "Textuur Regio"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Texture Region Editor"
-msgstr ""
+msgstr "Textuur Regio Editor"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Can't save theme to file:"
-msgstr ""
+msgstr "Kan thema niet opslaan in bestand:"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add All Items"
-msgstr ""
+msgstr "Alle Items Toevoegen"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add All"
-msgstr ""
+msgstr "Allen Toevoegen"
#: editor/plugins/theme_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Remove Item"
-msgstr ""
+msgstr "Verwijder Item"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove All Items"
-msgstr "Verwijder Selectie"
+msgstr "Verwijder Alle Items"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove All"
-msgstr "Verwijderen"
+msgstr "Verwijder Alles"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr ""
+msgid "Edit theme..."
+msgstr "Bewerk Thema..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
-msgstr ""
+msgstr "Thema Bewerkingsmenu."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Add Class Items"
@@ -5716,15 +5687,15 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create Empty Template"
-msgstr ""
+msgstr "Creëer Leeg Sjabloon"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create Empty Editor Template"
-msgstr ""
+msgstr "Creëer Lege Sjabloon Editor"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create From Current Editor Theme"
-msgstr ""
+msgstr "Creëer Derivatie Huidig Editor Thema"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
@@ -5736,7 +5707,7 @@ msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
msgid "Item"
-msgstr ""
+msgstr "Item"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Check Item"
@@ -5747,70 +5718,78 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Has"
+#, fuzzy
+msgid "Radio Item"
+msgstr "Item Toevoegen"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has"
+msgstr "Had"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Many"
-msgstr ""
+msgstr "Veel"
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
msgid "Options"
-msgstr ""
+msgstr "Opties"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "Opties"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
-msgstr ""
+msgstr "Tabblad 1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 2"
-msgstr ""
+msgstr "Tabblad 2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 3"
-msgstr ""
+msgstr "Tabblad 3"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Data Type:"
-msgstr ""
+msgstr "Data Type:"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Icon"
-msgstr ""
+msgstr "Icoon"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Style"
-msgstr ""
+msgstr "Stijl"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Font"
-msgstr ""
+msgstr "Lettertype"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Color"
-msgstr ""
+msgstr "Kleur"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme"
-msgstr ""
+msgstr "Thema"
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Erase Selection"
-msgstr "Schaal Selectie"
+msgstr "Selectie Verwijderen"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint TileMap"
msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
-#, fuzzy
msgid "Line Draw"
-msgstr "Lineair"
+msgstr "Teken Lijn"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rectangle Paint"
@@ -5826,23 +5805,23 @@ msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Erase selection"
-msgstr ""
+msgstr "Verwijder Selectie"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Find tile"
-msgstr ""
+msgstr "Vind Tegel"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Transpose"
-msgstr ""
+msgstr "Transponeren"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror X"
-msgstr ""
+msgstr "Spiegel X"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Mirror Y"
-msgstr ""
+msgstr "Spiegel Y"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Paint Tile"
@@ -5850,39 +5829,39 @@ msgstr ""
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Pick Tile"
-msgstr ""
+msgstr "Kies Tegel"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 0 degrees"
-msgstr ""
+msgstr "0 Graden Roteren"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 90 degrees"
-msgstr ""
+msgstr "90 Graden Roteren"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 180 degrees"
-msgstr ""
+msgstr "180 Graden Roteren"
#: editor/plugins/tile_map_editor_plugin.cpp
msgid "Rotate 270 degrees"
-msgstr ""
+msgstr "270 Graden Roteren"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Could not find tile:"
-msgstr ""
+msgstr "Niet gevonden titel:"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Item name or ID:"
-msgstr ""
+msgstr "Item naam of identificatiecode:"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from scene?"
-msgstr ""
+msgstr "Creëer vanuit scene?"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Merge from scene?"
-msgstr ""
+msgstr "Vervoegen vanuit scene?"
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
@@ -5891,15 +5870,15 @@ msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
-msgstr ""
+msgstr "Creëer vanuit Scene"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Merge from Scene"
-msgstr ""
+msgstr "Vervoeg vanuit Scene"
#: editor/plugins/tile_set_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Error"
-msgstr ""
+msgstr "Fout"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Autotiles"
@@ -5918,44 +5897,40 @@ msgid ""
msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Select current edited sub-tile."
-msgstr "De bewerkte bron opslaan."
+msgstr "Selecteer zojuist bewerkte sub-tegel."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select sub-tile to change its priority."
-msgstr ""
+msgstr "Selecteer een sub-tegel om zijn prioriteit te veranderen."
#: editor/progress_dialog.cpp scene/gui/dialogs.cpp
msgid "Cancel"
-msgstr "Annuleren"
+msgstr "Annuleer"
#: editor/project_export.cpp
-#, fuzzy
msgid "Runnable"
-msgstr "Inschakelen"
+msgstr "Uitvoerbaar"
#: editor/project_export.cpp
-#, fuzzy
msgid "Delete patch '%s' from list?"
-msgstr "Verwijder"
+msgstr "Verwijder patch '%s' van lijst?"
#: editor/project_export.cpp
-#, fuzzy
msgid "Delete preset '%s'?"
-msgstr "Verwijder geselecteerde bestanden?"
+msgstr "Verwijder voorinstelling '%s'?"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing/corrupted: "
-msgstr ""
+msgstr "Exportsjablonen voor dit platform zijn vermist/corrupt: "
#: editor/project_export.cpp
msgid "Presets"
-msgstr ""
+msgstr "Voorinstelling"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr ""
+msgid "Add..."
+msgstr "Toevoegen..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5967,7 +5942,7 @@ msgstr ""
#: editor/project_export.cpp
msgid "Export selected scenes (and dependencies)"
-msgstr ""
+msgstr "Exporteer geselecteerde scenes (en afhankelijkheden)"
#: editor/project_export.cpp
msgid "Export selected resources (and dependencies)"
@@ -5992,9 +5967,8 @@ msgid ""
msgstr ""
#: editor/project_export.cpp
-#, fuzzy
msgid "Patches"
-msgstr "Matches:"
+msgstr "Patches"
#: editor/project_export.cpp
msgid "Make Patch"
@@ -6002,24 +5976,23 @@ msgstr ""
#: editor/project_export.cpp
msgid "Features"
-msgstr ""
+msgstr "Kenmerken"
#: editor/project_export.cpp
msgid "Custom (comma-separated):"
msgstr ""
#: editor/project_export.cpp
-#, fuzzy
msgid "Feature List:"
-msgstr "Methode Lijst:"
+msgstr "Kenmerkenlijst:"
#: editor/project_export.cpp
msgid "Export PCK/Zip"
-msgstr ""
+msgstr "Exporteer PCK/Zip"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing:"
-msgstr ""
+msgstr "Vermiste Exportsjablonen voor dit platform:"
#: editor/project_export.cpp
msgid "Export templates for this platform are missing/corrupted:"
@@ -6030,30 +6003,33 @@ msgid "Export With Debug"
msgstr ""
#: editor/project_manager.cpp
-#, fuzzy
msgid "The path does not exist."
-msgstr "Bestand bestaat niet."
+msgstr "Dit pad bestaat niet."
#: editor/project_manager.cpp
msgid "Please choose a 'project.godot' file."
-msgstr ""
+msgstr "Kies alstublieft een 'project.godot' bestand."
#: editor/project_manager.cpp
msgid "Please choose an empty folder."
-msgstr ""
+msgstr "Kies alstublieft een lege map."
#: editor/project_manager.cpp
msgid "Imported Project"
-msgstr ""
+msgstr "Geïmporteerd Project"
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Ongeldige naam."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
-msgstr "Map kon niet gemaakt worden."
+msgstr "Kon map niet creëren."
#: editor/project_manager.cpp
msgid "There is already a folder in this path with the specified name."
-msgstr ""
+msgstr "Er is al een map in dit pad met dezelfde naam."
#: editor/project_manager.cpp
msgid "It would be a good idea to name your project."
@@ -6141,7 +6117,7 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
msgid "Can't open project"
-msgstr "Verbind.."
+msgstr "Verbind..."
#: editor/project_manager.cpp
msgid "Are you sure to open more than one project?"
@@ -6216,7 +6192,7 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
msgid "Can't run project"
-msgstr "Verbind.."
+msgstr "Verbind..."
#: editor/project_manager.cpp
msgid ""
@@ -6241,7 +6217,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6269,7 +6247,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6388,11 +6366,6 @@ msgid "Delete Item"
msgstr "Verwijder"
#: editor/project_settings_editor.cpp
-#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "Kan niet verbinden met host:"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6461,7 +6434,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6535,7 +6508,7 @@ msgstr ""
#: editor/property_editor.cpp
msgid "Pick a Viewport"
-msgstr ""
+msgstr "Kies een Aanzicht portaal"
#: editor/property_editor.cpp
msgid "Ease In"
@@ -6558,11 +6531,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6600,8 +6573,9 @@ msgid "Error loading file: Not a resource!"
msgstr ""
#: editor/property_editor.cpp
+#, fuzzy
msgid "Selected node is not a Viewport!"
-msgstr ""
+msgstr "Geselecteerde ..... is geen Aanzicht Portaal!"
#: editor/property_editor.cpp
#, fuzzy
@@ -6736,7 +6710,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7461,6 +7435,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7514,6 +7492,10 @@ msgstr "Project"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8180,12 +8162,22 @@ msgstr ""
"Pad eigenschap moet verwijzen naar een geldige Spatial node om te werken."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Slechts één WorldEnvironment is toegestaan per scene (of set van "
"geïnstantieerde scenes)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8258,10 +8250,10 @@ msgid ""
"obtain a size. Otherwise, make it a RenderTarget and assign its internal "
"texture to some node for display."
msgstr ""
-"Deze viewport is niet ingesteld als render target. Maak het een kind van een "
-"Control zodat het een grootte kan ontvangen, als je de bedoeling hebt zijn "
-"inhoud direct op het scherm te weergeven. Anders, maak er een RenderTarget "
-"van en wijs zijn interne texture toe aan een node om te tonen."
+"Dit Aanzicht Portaal is niet ingesteld als render target. Maak het een kind "
+"van een Control zodat het een grootte kan ontvangen, als je de bedoeling "
+"hebt zijn inhoud direct op het scherm te weergeven. Anders, maak er een "
+"RenderTarget van en wijs zijn interne texture toe aan een node om te tonen."
#: scene/resources/dynamic_font.cpp
msgid "Error initializing FreeType."
@@ -8279,12 +8271,27 @@ msgstr "Fout bij het laden van lettertype."
msgid "Invalid font size."
msgstr "Ongeldige lettertype grootte."
-#~ msgid "Can't write file."
-#~ msgstr "Kan niet naar bestand schrijven."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Vorig tabblad"
#~ msgid "Next"
#~ msgstr "Volgende"
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Kan niet verbinden met host:"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ongeldig version.txt formaat in sjablonen. Revisie is geen geldig "
+#~ "identificatienummer."
+
+#~ msgid "Can't write file."
+#~ msgstr "Kan niet naar bestand schrijven."
+
#~ msgid "Not found!"
#~ msgstr "Niet gevonden!"
@@ -8328,7 +8335,7 @@ msgstr "Ongeldige lettertype grootte."
#, fuzzy
#~ msgid "Setting '"
-#~ msgstr "Aan Het Opzetten.."
+#~ msgstr "Aan Het Opzetten..."
#, fuzzy
#~ msgid "Selection -> Duplicate"
@@ -8379,8 +8386,8 @@ msgstr "Ongeldige lettertype grootte."
#~ msgid "Exporting for %s"
#~ msgstr "Aan het exporteren voor %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Aan Het Opzetten.."
+#~ msgid "Setting Up..."
+#~ msgstr "Aan Het Opzetten..."
#~ msgid "Re-Importing"
#~ msgstr "Aan Het Herimporteren"
diff --git a/editor/translations/pl.po b/editor/translations/pl.po
index efd392cf27..5ca2760249 100644
--- a/editor/translations/pl.po
+++ b/editor/translations/pl.po
@@ -2,14 +2,15 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 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.
# Adam Wolanski <adam.wolanski94@gmail.com>, 2017.
# Adrian Węcławski <weclawskiadrian@gmail.com>, 2016.
# aelspire <aelspire@gmail.com>, 2017.
# Daniel Lewan <vision360.daniel@gmail.com>, 2016-2018.
+# Dariusz Król <rexioweb@gmail.com>, 2018.
# heya10 <igor.gielzak@gmail.com>, 2017.
# holistyczny interlokutor <jakubowesmieci@gmail.com>, 2017.
+# Igor <igor.gielzak@gmail.com>, 2018.
# Kajetan Kuszczyński <kajetanek99@gmail.com>, 2016.
# Kamil Lewan <lewan.kamil@gmail.com>, 2016.
# Karol Walasek <coreconviction@gmail.com>, 2016.
@@ -18,16 +19,16 @@
# NeverK <neverkoxu@gmail.com>, 2018.
# Rafal Brozio <rafal.brozio@gmail.com>, 2016.
# Rafał Ziemniak <synaptykq@gmail.com>, 2017.
+# RM <synaptykq@gmail.com>, 2018.
# Sebastian Krzyszkowiak <dos@dosowisko.net>, 2017.
# Sebastian Pasich <sebastian.pasich@gmail.com>, 2017.
# siatek papieros <sbigneu@gmail.com>, 2016.
# Zatherz <zatherz@linux.pl>, 2017.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-22 08:08+0000\n"
-"Last-Translator: Maksymilian Świąć <maksymilian.swiac@gmail.com>\n"
+"PO-Revision-Date: 2018-06-22 08:31+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"
@@ -35,7 +36,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\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 2.19-dev\n"
+"X-Generator: Weblate 3.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -47,19 +48,19 @@ msgstr "Wszystkie zaznaczenia"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr "Zmień czas klatki kluczowej"
+msgstr "Zmiana czasu klatki kluczowej"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Zmiana przejścia animacji"
+msgstr "Zmiana przejścia"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
-msgstr "Animacja transformacji"
+msgstr "Zmiana transformacji"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr "Zmień wartość klatki kluczowej"
+msgstr "Zmiana wartości klatki kluczowej"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
@@ -83,7 +84,7 @@ msgstr "Przesuń ścieżkę animacji w dół"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr "Usuń animację"
+msgstr "Usuń ścieżkę animacji"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
@@ -91,7 +92,7 @@ msgstr "Ustaw przejścia na:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr "Zmień nazwę animacji"
+msgstr "Zmień nazwę ściezki animacji"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
@@ -242,7 +243,7 @@ msgstr "Zmień pętlę animacji"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
-msgstr ""
+msgstr "Utwórz klucz dla wpisanej wartości"
#: editor/animation_editor.cpp
msgid "Anim Insert"
@@ -516,7 +517,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Rozłącz '%s' z '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Połącz..."
#: editor/connections_dialog.cpp
@@ -936,11 +937,11 @@ msgid "Move Audio Bus"
msgstr "Przemieść magistralę audio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Zapisz układ magistrali audio jako..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "Lokalizacja nowego układu..."
#: editor/editor_audio_buses.cpp
@@ -1077,12 +1078,12 @@ msgid "Updating Scene"
msgstr "Aktualizowanie Sceny"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Zachowywanie lokalnych zmian.."
+msgid "Storing local changes..."
+msgstr "Zachowywanie lokalnych zmian..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Aktualizacja sceny .."
+msgid "Updating scene..."
+msgstr "Aktualizacja sceny ..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1150,7 +1151,7 @@ msgid "Show In File Manager"
msgstr "Pokaż w menadżerze plików"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "Utwórz katalog..."
#: editor/editor_file_dialog.cpp
@@ -1342,9 +1343,8 @@ msgid "Description"
msgstr "Opis"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Online Tutorials:"
-msgstr "Poradniki"
+msgstr "Poradniki online:"
#: editor/editor_help.cpp
#, fuzzy
@@ -1353,8 +1353,9 @@ msgid ""
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
-"Obecnie nie ma opisu dla tej metody. Pomóż nam, [color=$color][url="
-"$url]wysyłając ją[/url][/color]!"
+"Obecnie nie ma żadnych samouczków dla tej klasy, możesz [color=$color][url="
+"$url]dodać jeden[/url][/kolor] lub [color=$color] [url=$url2]poprosić o "
+"jeden[/url][/barl]."
#: editor/editor_help.cpp
msgid "Properties"
@@ -1411,18 +1412,22 @@ msgstr "Wyczyść"
msgid "Clear Output"
msgstr "Wyczyść dane wyjściowe"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Eksport projektu nie powiódł się, kod błędu to %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Błąd podczas zapisu zasobu!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Zapisz zasób jako..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "WidzÄ™.."
+msgid "I see..."
+msgstr "WidzÄ™..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1652,12 +1657,12 @@ msgid "Open Base Scene"
msgstr "Otwórz scenę bazową"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Szybkie otwieranie sceny.."
+msgid "Quick Open Scene..."
+msgstr "Szybkie otwieranie sceny..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Szybkie otwieranie skryptu.."
+msgid "Quick Open Script..."
+msgstr "Szybkie otwieranie skryptu..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1668,8 +1673,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Zapisać zmiany w '%s' przed zamknięciem?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Zapisz scenÄ™ jako.."
+msgid "Save Scene As..."
+msgstr "Zapisz scenÄ™ jako..."
#: editor/editor_node.cpp
msgid "No"
@@ -1720,8 +1725,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Tego nie można cofnąć. Przywrócić mimo to?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Szybkie uruchomienie sceny.."
+msgid "Quick Run Scene..."
+msgstr "Szybkie uruchomienie sceny..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1879,7 +1884,7 @@ msgid "Previous tab"
msgstr "Poprzednia zakładka"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Filtrowanie plików..."
#: editor/editor_node.cpp
@@ -1891,12 +1896,12 @@ msgid "New Scene"
msgstr "Nowa scena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Nowa scena dziedziczÄ…ca..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Otwórz scenę.."
+msgid "Open Scene..."
+msgstr "Otwórz scenę..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1915,15 +1920,15 @@ msgid "Open Recent"
msgstr "Ostatnio otwierane"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Konwertuje na.."
+msgid "Convert To..."
+msgstr "Konwertuje na..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2109,7 +2114,7 @@ msgstr "Społeczność"
#: editor/editor_node.cpp
msgid "About"
-msgstr "O programie"
+msgstr "O silniku"
#: editor/editor_node.cpp
msgid "Play the project."
@@ -2184,7 +2189,7 @@ msgid "Save the currently edited resource."
msgstr "Zapisz aktualnie edytowany zasób."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Zapisz jako..."
#: editor/editor_node.cpp
@@ -2293,8 +2298,8 @@ msgid "Creating Mesh Previews"
msgstr "Tworzenie podglÄ…du Mesh"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatura.."
+msgid "Thumbnail..."
+msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2447,8 +2452,8 @@ msgid "(Current)"
msgstr "(Bieżący)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Pobieranie informacji o serwerach lustrzanych, proszę czekać.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Pobieranie informacji o serwerach lustrzanych, proszę czekać..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2463,14 +2468,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Nieprawidłowy format pliku version.txt w szablonach."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"nieprawidłowy format pliku version.txt wewnątrz szablonów. Zmiana nie jest "
-"prawidłowym identyfikatorem."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Nie znaleziono pliku version.txt w szablonach."
@@ -2533,8 +2530,8 @@ msgid "Error requesting url: "
msgstr "Błąd podczas żądania adresu url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "ÅÄ…czenie z serwerem lustrzanym.."
+msgid "Connecting to Mirror..."
+msgstr "ÅÄ…czenie z serwerem lustrzanym..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2550,8 +2547,8 @@ msgstr "Nie można rozwiązać"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "ÅÄ…czenie.."
+msgid "Connecting..."
+msgstr "ÅÄ…czenie..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2563,7 +2560,7 @@ msgstr "Podłączony"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "Żądanie danych..."
#: editor/export_template_manager.cpp
@@ -2699,11 +2696,11 @@ msgid "Collapse all"
msgstr "Zwiń foldery"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "Zmień nazwę..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "PrzenieÅ› Do..."
#: editor/filesystem_dock.cpp
@@ -2715,16 +2712,16 @@ msgid "Instance"
msgstr "Instancja"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "Edytuj Zależności..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Pokaż właścicieli.."
+msgid "View Owners..."
+msgstr "Pokaż właścicieli..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Duplikuj.."
+msgid "Duplicate..."
+msgstr "Duplikuj..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2749,7 +2746,7 @@ msgstr "Utwórz instancje wybranej sceny/scen jako dziecko wybranego węzła."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Skanowanie plików,\n"
"Proszę czekać..."
@@ -2817,8 +2814,8 @@ msgid "Import Scene"
msgstr "Importuj ScenÄ™"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Importowanie Sceny.."
+msgid "Importing Scene..."
+msgstr "Importowanie Sceny..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2829,7 +2826,7 @@ msgid "Generating for Mesh: "
msgstr "Generowanie dla siatki: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Uruchamiam skrypt..."
#: editor/import/resource_importer_scene.cpp
@@ -2847,8 +2844,8 @@ msgid "Error running post-import script:"
msgstr "Błąd podczas uruchamiania skryptu po imporcie:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Zapisywanie.."
+msgid "Saving..."
+msgstr "Zapisywanie..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2867,8 +2864,8 @@ msgid "Import As:"
msgstr "Importuj jako:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Ustawienie predefiniowane.."
+msgid "Preset..."
+msgstr "Ustawienie predefiniowane..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3084,12 +3081,11 @@ msgstr "Tryb łusek cebuli"
#: editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
msgid "Enable Onion Skinning"
-msgstr "Włącz tryb łusek cebuli"
+msgstr "Włącz tryb warstw cebuli"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Directions"
-msgstr "Kategorie:"
+msgstr "Kierunki"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Past"
@@ -3293,16 +3289,16 @@ msgid "Transition Node"
msgstr "Węzeł Przejścia"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Zaimportuj animacje.."
+msgid "Import Animations..."
+msgstr "Zaimportuj animacje..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Edytuj filtry węzłów"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Filtry.."
+msgid "Filters..."
+msgstr "Filtry..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3345,9 +3341,10 @@ msgid "Request failed, too many redirects"
msgstr "Żądanie nieudane, zbyt dużo przekierowań"
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Bad download hash, assuming file has been tampered with."
-msgstr "Zły hash pobranego pliku. Zakładamy, że ktoś przy nim majstrował."
+msgstr ""
+"Zły hash pobranego pliku. Zakładamy, że ktoś przy nim majstrował, lub został "
+"niepoprawnie pobrany."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Expected:"
@@ -3370,13 +3367,12 @@ msgid "Fetching:"
msgstr "Pobieranie:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "RozwiÄ…zywanie..."
#: editor/plugins/asset_library_editor_plugin.cpp
-#, fuzzy
msgid "Error making request"
-msgstr "Wystąpił błąd podczas tworzenia żądania"
+msgstr "Wystąpił błąd podczas żądania"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Idle"
@@ -3438,8 +3434,8 @@ msgid "Site:"
msgstr "Źródło:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Wsparcie.."
+msgid "Support..."
+msgstr "Wsparcie..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3478,9 +3474,8 @@ msgstr ""
"jedynie do odczytu."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
-#, fuzzy
msgid "Bake Lightmaps"
-msgstr "Wypal Lightmaps"
+msgstr "Stwórz Lightmaps"
#: editor/plugins/camera_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3588,9 +3583,8 @@ msgstr ""
"poruszania)."
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Alt+RMB: Depth list selection"
-msgstr "Alt+PPM: Lista wyboru głębi"
+msgstr "Alt + RMB: Głębokość listy"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Mode"
@@ -3638,8 +3632,9 @@ msgid "Use Rotation Snap"
msgstr "Użyj kroków obrotu"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "Konfiguruj przyciÄ…ganie.."
+msgstr "Konfiguruj przyciÄ…ganie..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3734,6 +3729,14 @@ msgid "Show Guides"
msgstr "Pokaż prowadnice"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Pokaż pozycję początkową"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Pokaż widok"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Wyśrodkowywanie na zaznaczeniu"
@@ -3775,11 +3778,11 @@ msgstr "Ustaw pivot w pozycji myszy"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Multiply grid step by 2"
-msgstr ""
+msgstr "Podwój wielkość siatki"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Divide grid step by 2"
-msgstr ""
+msgstr "Zmniejsz wielkość siatki dwukrotnie"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Add %s"
@@ -3795,7 +3798,7 @@ msgstr "Ok"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Cannot instantiate multiple nodes without root."
-msgstr ""
+msgstr "Nie można utworzyć wielu wezłów bez węzła głównego."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
@@ -3851,11 +3854,11 @@ msgstr "Aktualizuj ze sceny"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat0"
-msgstr ""
+msgstr "Flat0"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat1"
-msgstr ""
+msgstr "Flat1"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Ease in"
@@ -4027,11 +4030,14 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Siatka nie posiada powierzchni z której można utworzyć zarys!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Nie udało się utworzyć zarysu!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-#, fuzzy
msgid "Create Outline"
msgstr "Utwórz zarys"
@@ -4056,8 +4062,8 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Utwórz siatkę zarysu.."
+msgid "Create Outline Mesh..."
+msgstr "Utwórz siatkę zarysu..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4271,8 +4277,8 @@ msgid "Error loading image:"
msgstr "Błąd wczytywania obrazu:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Brak pikseli z przeźroczystością > 128 w obrazie.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Brak pikseli z przeźroczystością > 128 w obrazie..."
#: editor/plugins/particles_2d_editor_plugin.cpp
#, fuzzy
@@ -4642,8 +4648,8 @@ msgid "Import Theme"
msgstr "Zaimportuj motyw"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Zapisz motyw jako.."
+msgid "Save Theme As..."
+msgstr "Zapisz motyw jako..."
#: editor/plugins/script_editor_plugin.cpp
#, fuzzy
@@ -4741,8 +4747,8 @@ msgstr "Przełącz panel skryptów"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Znajdź.."
+msgid "Find..."
+msgstr "Znajdź..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4952,16 +4958,16 @@ msgid "Find Previous"
msgstr "Znajdź poprzedni"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Zamień.."
+msgid "Replace..."
+msgstr "Zamień..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Przejdź do funkcji.."
+msgid "Goto Function..."
+msgstr "Przejdź do funkcji..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Przejdź do linii.."
+msgid "Goto Line..."
+msgstr "Przejdź do linii..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5050,11 +5056,11 @@ msgstr ""
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Add/Remove to Curve Map"
-msgstr ""
+msgstr "Dodaj/Usuń do mapy krzywej"
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Modify Curve Map"
-msgstr ""
+msgstr "Edytuj mape krzywej"
#: editor/plugins/shader_graph_editor_plugin.cpp
#, fuzzy
@@ -5288,34 +5294,31 @@ msgstr "Efekt Dopplera"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Left"
-msgstr ""
+msgstr "\"Wolny widok\" w lewo"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Right"
-msgstr ""
+msgstr "\"Wolny widok\" w prawo"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Forward"
-msgstr "Dalej"
+msgstr "\"Wolny widok\" w przód"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Backwards"
-msgstr "Wstecz"
+msgstr "\"Wolny widok\" w tył"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Up"
-msgstr ""
+msgstr "\"Wolny widok\" w góre"
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Freelook Down"
-msgstr "Kółko myszy w dół."
+msgstr "\"Wolny widok\" w dół"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Freelook Speed Modifier"
-msgstr ""
+msgstr "Zmiennik prędkości \"Wolnego widoku\""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "XForm Dialog"
@@ -5331,6 +5334,9 @@ msgid ""
"Alt+Drag: Move\n"
"Alt+RMB: Depth list selection"
msgstr ""
+"Pociągnięcie: Obrót\n"
+"Alt+Pociągnięcie: Poruszenie\n"
+"Alt+PPM: Lista wyboru głębi"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Move Mode (W)"
@@ -5346,7 +5352,7 @@ msgstr "Tryb skalowania (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
-msgstr "Koordynaty lokalne"
+msgstr "Local Coords"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
@@ -5429,12 +5435,8 @@ msgid "Transform"
msgstr "Przekształcanie"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Konfiguruj krokowanie.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Okno transformowania.."
+msgid "Transform Dialog..."
+msgstr "Okno transformowania..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5688,8 +5690,8 @@ msgid "Remove All"
msgstr "Usuń wszystkie"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Edytuj motyw interfejsu.."
+msgid "Edit theme..."
+msgstr "Edytuj motyw interfejsu..."
#: editor/plugins/theme_editor_plugin.cpp
#, fuzzy
@@ -5738,6 +5740,16 @@ msgid "Checked Item"
msgstr "Zaznaczony element"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "Dodaj element"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "Zaznaczony element"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Ma"
@@ -5751,7 +5763,7 @@ msgstr "Opcje"
#: editor/plugins/theme_editor_plugin.cpp
#, fuzzy
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr "Ma,Wiele,Różnych,Opcji!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5944,8 +5956,8 @@ msgid "Presets"
msgstr "Profile eksportu"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Dodaj.."
+msgid "Add..."
+msgstr "Dodaj..."
#: editor/project_export.cpp
msgid "Resources"
@@ -6039,12 +6051,17 @@ msgid "Imported Project"
msgstr "Zaimportowano projekt"
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Nazwa projektu:"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Nie można utworzyć katalogu."
#: editor/project_manager.cpp
msgid "There is already a folder in this path with the specified name."
-msgstr ""
+msgstr "Folder o podanej nazwie istnieje już w tej lokalizacji."
#: editor/project_manager.cpp
msgid "It would be a good idea to name your project."
@@ -6235,8 +6252,13 @@ msgid "Mouse Button"
msgstr "Przycisk myszy"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Nieprawidłowa akcja (wszystko oprócz '/' lub ':')."
+#, fuzzy
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Niepoprawna nazwa akcji. Nazwa nie może być pusta ani zawierać znaki takie "
+"jak: '/', ':', '=', '\\' lub '\"'"
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6263,8 +6285,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Naciśnij klawisz.."
+msgid "Press a Key..."
+msgstr "Naciśnij klawisz..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6336,7 +6358,7 @@ msgstr "UrzÄ…dzenie"
#: editor/project_settings_editor.cpp
msgid "Button"
-msgstr "Przycisk"
+msgstr "Button"
#: editor/project_settings_editor.cpp
msgid "Left Button."
@@ -6379,10 +6401,6 @@ msgid "Delete Item"
msgstr "Usuń element"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Nie może zawierać '/ 'lub':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Już istnieje"
@@ -6444,15 +6462,15 @@ msgstr "Ustawienia projektu (project.godot)"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr "Ogólny"
+msgstr "Ogólne"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr "Właściwość:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Nadpisz dla.."
+msgid "Override For..."
+msgstr "Nadpisz dla..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6547,12 +6565,12 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Plik.."
+msgid "File..."
+msgstr "Plik..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Katalog.."
+msgid "Dir..."
+msgstr "Katalog..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6663,7 +6681,7 @@ msgstr "Aktualna scena"
#: editor/run_settings_dialog.cpp
msgid "Main Scene"
-msgstr "Główna scena"
+msgstr "Scena główna"
#: editor/run_settings_dialog.cpp
msgid "Main Scene Arguments:"
@@ -6691,6 +6709,7 @@ msgid ""
"Cannot instance the scene '%s' because the current scene exists within one "
"of its nodes."
msgstr ""
+"Nie można utworzyć sceny '%s' ponieważ obecna scena jest jednym z jej wezłów."
#: editor/scene_tree_dock.cpp
#, fuzzy
@@ -6728,7 +6747,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Tej operacji nie można wykonać na dziedziczącej scenie."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Zapisz nowÄ… scenÄ™ jako ..."
#: editor/scene_tree_dock.cpp
@@ -7178,7 +7197,7 @@ msgstr "Skróty"
#: editor/settings_config_dialog.cpp
msgid "Binding"
-msgstr ""
+msgstr "WiÄ…zanie"
#: editor/spatial_editor_gizmos.cpp
msgid "Change Light Radius"
@@ -7454,13 +7473,17 @@ msgstr "Ustawienia GridMap"
msgid "Pick Distance:"
msgstr "Wybierz odległość:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Nazwa klasy nie może być słowem zastrzeżonym"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Generowanie solucji..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating C# project..."
-msgstr ""
+msgstr "Generowanie projektu C#..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Failed to create solution."
@@ -7484,7 +7507,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "O wsparciu języka C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7502,6 +7525,10 @@ msgstr "Zbuduj projekt"
msgid "Warnings"
msgstr "Ostrzeżenia"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7681,7 +7708,7 @@ msgstr "Przełącznik"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
-msgstr ""
+msgstr "Iterator"
#: modules/visual_script/visual_script_editor.cpp
msgid "While"
@@ -7903,6 +7930,10 @@ msgid ""
"Consider adding CollisionShape2D or CollisionPolygon2D children nodes to "
"define its shape."
msgstr ""
+"Ten węzeł nie posiada podwezła, który definiował by jego kształt, więc nie "
+"może wchodzić w interakcje.\n"
+"Powinieneś dodać węzeł \"CollisionShape2D\" lub \"CollisionPolygon2D\" jako "
+"podwęzeł aby zdefiniować kształt."
#: scene/2d/collision_polygon_2d.cpp
msgid ""
@@ -7982,6 +8013,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."
#: scene/2d/path_2d.cpp
msgid "PathFollow2D only works when set as a child of a Path2D node."
@@ -8024,6 +8057,8 @@ msgid ""
"The controller id must not be 0 or this controller will not be bound to an "
"actual controller"
msgstr ""
+"Id kontrolera nie może być '0' w innym przypadku kontroler nie zostanie "
+"przypisany do żadnego rzeczywistego kontrolera"
#: scene/3d/arvr_nodes.cpp
#, fuzzy
@@ -8046,7 +8081,7 @@ msgstr ""
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Pozostały czas: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8143,12 +8178,22 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "Pole Path musi wskazywać na węzeł Spatial."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Tylko jeden WorldEnvironment jest dozwolony na scenÄ™ (lub zestaw "
"zinstancjonowanych scen)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8247,6 +8292,26 @@ msgstr "Błąd ładowania fonta."
msgid "Invalid font size."
msgstr "Niepoprawny rozmiar fonta."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Poprzednia zakładka"
+
+#~ msgid "Next"
+#~ msgstr "Następny"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Nieprawidłowa akcja (wszystko oprócz '/' lub ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Nie może zawierać '/ 'lub':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "nieprawidłowy format pliku version.txt wewnątrz szablonów. Zmiana nie "
+#~ "jest prawidłowym identyfikatorem."
+
#~ msgid "Can't write file."
#~ msgstr "Nie można zapisać pliku."
@@ -8259,9 +8324,6 @@ msgstr "Niepoprawny rozmiar fonta."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Nie znaleziono project.godot w ścieżce projektu."
-#~ msgid "Next"
-#~ msgstr "Następny"
-
#~ msgid "Not found!"
#~ msgstr "Nie znaleziono!"
@@ -8400,8 +8462,8 @@ msgstr "Niepoprawny rozmiar fonta."
#~ msgid "Exporting for %s"
#~ msgstr "Exportowanie do %s"
-#~ msgid "Setting Up.."
-#~ msgstr "Konfigurowanie .."
+#~ msgid "Setting Up..."
+#~ msgstr "Konfigurowanie ..."
#~ msgid "Error loading scene."
#~ msgstr "Błąd ładowania sceny."
@@ -8459,8 +8521,8 @@ msgstr "Niepoprawny rozmiar fonta."
#~ msgid "Info"
#~ msgstr "Informacje"
-#~ msgid "Re-Import.."
-#~ msgstr "Importuj ponownie.."
+#~ msgid "Re-Import..."
+#~ msgstr "Importuj ponownie..."
#~ msgid "No bit masks to import!"
#~ msgstr "Brak mask bitowych do zaimportowania!"
@@ -8833,13 +8895,13 @@ msgstr "Niepoprawny rozmiar fonta."
#~ msgid "Zoom (%):"
#~ msgstr "Powiększenie (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Szkielet.."
+#~ msgid "Skeleton..."
+#~ msgstr "Szkielet..."
#~ msgid "Zoom Reset"
#~ msgstr "Wyzeruj przybliżenie"
-#~ msgid "Zoom Set.."
+#~ msgid "Zoom Set..."
#~ msgstr "Ustaw przybliżenie..."
#~ msgid "Set a Value"
@@ -9188,8 +9250,8 @@ msgstr "Niepoprawny rozmiar fonta."
#~ msgid "Export Project PCK"
#~ msgstr "Eksport projektu PCK"
-#~ msgid "Export.."
-#~ msgstr "Eksport.."
+#~ msgid "Export..."
+#~ msgstr "Eksport..."
#~ msgid "Project Export"
#~ msgstr "Eksport projektu"
diff --git a/editor/translations/pr.po b/editor/translations/pr.po
index ee893fa770..0c085024e0 100644
--- a/editor/translations/pr.po
+++ b/editor/translations/pr.po
@@ -500,7 +500,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -915,11 +915,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1055,11 +1055,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1129,7 +1129,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1385,17 +1385,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1602,11 +1606,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1618,7 +1622,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1670,7 +1674,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1815,7 +1819,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1827,11 +1831,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1851,15 +1855,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2105,7 +2109,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2214,7 +2218,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2366,7 +2370,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2382,12 +2386,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2449,7 +2447,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2466,7 +2464,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2481,7 +2479,7 @@ msgstr "Slit th' Node"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2620,11 +2618,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2636,15 +2634,15 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2670,7 +2668,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2736,7 +2734,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2748,7 +2746,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2764,7 +2762,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2784,7 +2782,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3201,7 +3199,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3209,7 +3207,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3277,7 +3275,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3344,7 +3342,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3534,6 +3532,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3630,6 +3629,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3919,6 +3926,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3947,7 +3958,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4152,7 +4163,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4517,7 +4528,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4615,7 +4626,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4823,15 +4834,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5286,11 +5297,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5546,7 +5553,7 @@ msgid "Remove All"
msgstr "Discharge ye' Signal"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5594,6 +5601,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5606,7 +5621,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5795,7 +5810,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5885,6 +5900,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Yer index property name be thrown overboard!"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6072,7 +6092,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6100,7 +6122,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6218,10 +6240,6 @@ msgid "Delete Item"
msgstr "Yar, Blow th' Selected Down!"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6290,7 +6308,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6387,11 +6405,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6564,7 +6582,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7280,6 +7298,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7328,6 +7350,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7941,10 +7967,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po
index 534aed164c..6d26cbc500 100644
--- a/editor/translations/pt_BR.po
+++ b/editor/translations/pt_BR.po
@@ -2,13 +2,15 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Allyson Souza <allyson_as@outlook.com>, 2017.
+# Anderson Araujo <anderson.araujoprog@gmail.com>, 2018.
# António Sarmento <antonio.luis.sarmento@gmail.com>, 2016.
# AWK <arthurwk1800@gmail.com>, 2017.
+# Breno Caldeira <breno.caldeira@gmail.com>, 2018.
# Francesco Perrotti-Garcia <fpg1503@gmail.com>, 2017.
# George Marques <george@gmarqu.es>, 2016.
-# Guilherme Felipe C G Silva <guilhermefelipecgs@gmail.com>, 2017.
+# Guilherme Felipe C G Silva <guilhermefelipecgs@gmail.com>, 2017, 2018.
+# João Victor Lima <victordevtb@outlook.com>, 2018.
# João Vitor de Oliveira Carlos <lopogax@gmail.com>, 2018.
# Joaquim Ferreira <joaquimferreira1996@bol.com.br>, 2016.
# jonathan railarem <railarem@gmail.com>, 2017.
@@ -19,16 +21,14 @@
# Marcus Correia <marknokalt@live.com>, 2017-2018.
# Michael Alexsander Silva Dias <michaelalexsander@protonmail.com>, 2017-2018.
# Renato Rotenberg <renato.rotenberg@gmail.com>, 2017.
-# Rodolfo R Gomes <rodolforg@gmail.com>, 2017.
+# Rodolfo R Gomes <rodolforg@gmail.com>, 2017-2018.
# Tiago Almeida <thyagoeap@gmail.com>, 2017.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: 2016-05-30\n"
-"PO-Revision-Date: 2018-02-19 19:38+0000\n"
-"Last-Translator: Michael Alexsander Silva Dias <michaelalexsander@protonmail."
-"com>\n"
+"PO-Revision-Date: 2018-06-16 18:43+0000\n"
+"Last-Translator: Rodolfo R Gomes <rodolforg@gmail.com>\n"
"Language-Team: Portuguese (Brazil) <https://hosted.weblate.org/projects/"
"godot-engine/godot/pt_BR/>\n"
"Language: pt_BR\n"
@@ -36,7 +36,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 2.19\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -44,7 +44,7 @@ msgstr "Desabilitado"
#: editor/animation_editor.cpp
msgid "All Selection"
-msgstr "Toda a Seleção"
+msgstr "Toda a seleção"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
@@ -516,13 +516,13 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Desconectar '%s' do '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Conectar..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Disconnect"
-msgstr "Disconectar"
+msgstr "Desconectar"
#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
msgid "Signals"
@@ -775,7 +775,7 @@ msgstr "Doadores"
#: editor/editor_about.cpp
msgid "License"
-msgstr "LIcença"
+msgstr "Licença"
#: editor/editor_about.cpp
msgid "Thirdparty License"
@@ -937,12 +937,12 @@ msgid "Move Audio Bus"
msgstr "Mover Canal de Ãudio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Salvar Layout de Canais de Ãudio Como..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Localização para o Novo Layout.."
+msgid "Location for New Layout..."
+msgstr "Localização para o Novo Layout..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1080,11 +1080,11 @@ msgid "Updating Scene"
msgstr "Atualizando Cena"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "Armazenando alterações locais..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "Atualizando Cena..."
#: editor/editor_data.cpp
@@ -1153,7 +1153,7 @@ msgid "Show In File Manager"
msgstr "Mostrar no Gerenciador de Arquivos"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "Nova Pasta..."
#: editor/editor_file_dialog.cpp
@@ -1413,17 +1413,21 @@ msgstr "Limpar"
msgid "Clear Output"
msgstr "Limpar Saída"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Falha na exportação do projeto com código de erro %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Erro ao salvar Recurso!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Salvar Recuso como..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Entendo..."
#: editor/editor_node.cpp
@@ -1653,12 +1657,12 @@ msgid "Open Base Scene"
msgstr "Abrir Cena Base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Abri Cena Rápidamente..."
+msgid "Quick Open Scene..."
+msgstr "Abrir Cena Rapidamente..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Abrir Script Rápidamente..."
+msgid "Quick Open Script..."
+msgstr "Abrir Script Rapidamente..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1669,7 +1673,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "Salvar alterações em '%s' antes de fechar?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "Salvar Cena Como..."
#: editor/editor_node.cpp
@@ -1721,7 +1725,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Esta ação não pode ser desfeita. Reverter mesmo assim?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "Rodar Cena Ãgil..."
#: editor/editor_node.cpp
@@ -1882,8 +1886,8 @@ msgid "Previous tab"
msgstr "Guia anterior"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrar Arquivos.."
+msgid "Filter Files..."
+msgstr "Filtrar Arquivos..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1894,11 +1898,11 @@ msgid "New Scene"
msgstr "Nova Cena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Nova Cena Herdada..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "Abrir Cena..."
#: editor/editor_node.cpp
@@ -1918,15 +1922,15 @@ msgid "Open Recent"
msgstr "Abrir Recente"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "Converter Para..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -1977,7 +1981,7 @@ msgstr "Depurar"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
-msgstr "Instalar Depuração Remota"
+msgstr "Distribuir com Depuragem Remota"
#: editor/editor_node.cpp
msgid ""
@@ -1989,7 +1993,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr "Instalação Pequena com FS em rede"
+msgstr "Pequena DIstribuição com Sistema de Arquivos de Rede"
#: editor/editor_node.cpp
msgid ""
@@ -2032,7 +2036,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr "Sincronizar Alterações na Cena"
+msgstr "Sincronizar Mudanças de Cena"
#: editor/editor_node.cpp
msgid ""
@@ -2048,7 +2052,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Script Changes"
-msgstr "Sincronizar Alterações no Script"
+msgstr "Sincronizar Mudanças de Script"
#: editor/editor_node.cpp
msgid ""
@@ -2190,7 +2194,7 @@ msgid "Save the currently edited resource."
msgstr "Salva o recurso editado atualmente."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Salvar Como..."
#: editor/editor_node.cpp
@@ -2299,7 +2303,7 @@ msgid "Creating Mesh Previews"
msgstr "Criando Previsualizações das Malhas"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
@@ -2361,7 +2365,7 @@ msgstr "Inclusivo"
#: editor/editor_profiler.cpp
msgid "Self"
-msgstr "Mesmo"
+msgstr "Self"
#: editor/editor_profiler.cpp
msgid "Frame #:"
@@ -2453,7 +2457,7 @@ msgid "(Current)"
msgstr "(Atual)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Reconectando, por favor aguarde."
#: editor/export_template_manager.cpp
@@ -2469,14 +2473,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Formato do version.txt dentro dos modelos é inválido."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Formato do version.txt dentro dos modelos é inválido. A revisão não é um "
-"identificador válido."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Não foi encontrado um version.txt dentro dos modelos."
@@ -2539,7 +2535,7 @@ msgid "Error requesting url: "
msgstr "Erro ao solicitar url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "Conectando..."
#: editor/export_template_manager.cpp
@@ -2556,8 +2552,8 @@ msgstr "Não foi possível resolver"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Conectando.."
+msgid "Connecting..."
+msgstr "Conectando..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2569,8 +2565,8 @@ msgstr "Conectado"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Solicitando.."
+msgid "Requesting..."
+msgstr "Solicitando..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2705,11 +2701,11 @@ msgid "Collapse all"
msgstr "Recolher tudo"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "Renomear..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Mover Para..."
#: editor/filesystem_dock.cpp
@@ -2721,15 +2717,15 @@ msgid "Instance"
msgstr "Instância"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Editar Dependências.."
+msgid "Edit Dependencies..."
+msgstr "Editar Dependências..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "Visualizar Proprietários..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Duplicar..."
#: editor/filesystem_dock.cpp
@@ -2755,7 +2751,7 @@ msgstr "Instanciar a(s) cena(s) selecionada como filho do nó selecionado."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Escaneando arquivos,\n"
"Por favor aguarde..."
@@ -2823,7 +2819,7 @@ msgid "Import Scene"
msgstr "Importar cena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "Importando Cena..."
#: editor/import/resource_importer_scene.cpp
@@ -2835,7 +2831,7 @@ msgid "Generating for Mesh: "
msgstr "Generando para a Malha: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Rodando Script Personalizado..."
#: editor/import/resource_importer_scene.cpp
@@ -2851,7 +2847,7 @@ msgid "Error running post-import script:"
msgstr "Erro ao rodar script pós-importação:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Salvando..."
#: editor/import_dock.cpp
@@ -2871,7 +2867,7 @@ msgid "Import As:"
msgstr "Importar como:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr "Predefinição..."
#: editor/import_dock.cpp
@@ -3292,7 +3288,7 @@ msgid "Transition Node"
msgstr "Nó Transition"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr "Importar Animações..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3300,7 +3296,7 @@ msgid "Edit Node Filters"
msgstr "Editar Filtros de Nó"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Filtros..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3309,7 +3305,7 @@ msgstr "AnimationTree"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
-msgstr "Livrar"
+msgstr "Livre"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Contents:"
@@ -3368,7 +3364,7 @@ msgid "Fetching:"
msgstr "Procurando:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "Resolvendo..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3435,8 +3431,8 @@ msgid "Site:"
msgstr "Site:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Suporte.."
+msgid "Support..."
+msgstr "Suporte..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3444,7 +3440,7 @@ msgstr "Oficial"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Testing"
-msgstr "Em teste"
+msgstr "Testando"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
@@ -3633,8 +3629,9 @@ msgid "Use Rotation Snap"
msgstr "Usar Snap de Rotação"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "Configurar Encaixe..."
+msgstr "Configurar Snap..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3729,6 +3726,14 @@ msgid "Show Guides"
msgstr "Mostrar guias"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Mostrar Origem"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Mostrar Viewport"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centralizar Seleção"
@@ -4018,6 +4023,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Malha não tem superfície para criar contornos dela!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Tipo primitivo da Mesh não é PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Não se pôde criar contorno!"
@@ -4046,8 +4055,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Criar Colisão Convexa Irmã"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Criar Malha de Contorno.."
+msgid "Create Outline Mesh..."
+msgstr "Criar Malha de Contorno..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4254,7 +4263,7 @@ msgid "Error loading image:"
msgstr "Erro ao carregar imagem:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr "Nenhum pixel com transparência > 128 na imagem."
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4615,7 +4624,7 @@ msgid "Import Theme"
msgstr "Importar Tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Salvar Tema Como..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4712,7 +4721,7 @@ msgstr "Alternar Painel de Scripts"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "Localizar..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4922,15 +4931,15 @@ msgid "Find Previous"
msgstr "Encontrar Anterior"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "Substituir..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr "Ir para Função..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "Ir para linha..."
#: editor/plugins/script_text_editor.cpp
@@ -5305,7 +5314,7 @@ msgstr "Modo Escala (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
-msgstr "Coordenadas Locais"
+msgstr "Local Coords"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
@@ -5384,11 +5393,7 @@ msgid "Transform"
msgstr "Transformação"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configurar Snap..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr "Diálogo Transformação..."
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5641,8 +5646,8 @@ msgid "Remove All"
msgstr "Remover Tudo"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Editar tema.."
+msgid "Edit theme..."
+msgstr "Editar tema..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5670,11 +5675,11 @@ msgstr "Criar a Partir do Tema Atual do Editor"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
-msgstr "Rádio Checkbox 1"
+msgstr "CheckBox Rádio1"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio2"
-msgstr "Caixa de Seleção 2"
+msgstr "CheckBox Rádio2"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Item"
@@ -5682,27 +5687,35 @@ msgstr "Item"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Check Item"
-msgstr "Checar Item"
+msgstr "Item Marcável"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Checked Item"
msgstr "Item Checado"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Item Rádio"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Item Rádio Marcado"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Tem"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Many"
-msgstr "Muitos"
+msgstr "Muitas"
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
msgid "Options"
msgstr "Opções"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Ter,Muitas,Várias,Opções!"
+msgid "Has,Many,Options"
+msgstr "Tem,Muitas,Opções"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5895,7 +5908,7 @@ msgid "Presets"
msgstr "Predefiniçoes"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Adicionar..."
#: editor/project_export.cpp
@@ -5991,6 +6004,10 @@ msgid "Imported Project"
msgstr "Projeto Importado"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Nome do Projeto Inválido."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Impossível criar a pasta."
@@ -6007,11 +6024,12 @@ 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.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "Não foi possível editar project.godot no caminho do projeto."
+msgstr ""
+"Não foi possível carregar project.godot no caminho do projeto (erro %d). Ele "
+"pode estar ausente ou corrompido."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6189,8 +6207,12 @@ msgid "Mouse Button"
msgstr "Botão do Mous"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Ação Inválida (qualquer coisa serve, exceto '/' ou ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Nome de ação inválido. Ele não pode estar vazio ou conter '/', ':', '=', "
+"'\\' ou '\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6217,7 +6239,7 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr "Pressione uma Tecla..."
#: editor/project_settings_editor.cpp
@@ -6333,10 +6355,6 @@ msgid "Delete Item"
msgstr "Excluir Item"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Não pode conter '/' ou ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Já existe"
@@ -6405,7 +6423,7 @@ msgid "Property:"
msgstr "Propriedade:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "Sobrescrever Para..."
#: editor/project_settings_editor.cpp
@@ -6450,7 +6468,7 @@ msgstr "Remapeamentos por Localidade:"
#: editor/project_settings_editor.cpp
msgid "Locale"
-msgstr "Localidade"
+msgstr "Locale"
#: editor/project_settings_editor.cpp
msgid "Locales Filter"
@@ -6501,11 +6519,11 @@ msgid "Easing Out-In"
msgstr "Easing Out-In"
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr "Arquivo..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr "Dir..."
#: editor/property_editor.cpp
@@ -6562,7 +6580,7 @@ msgstr "[Vazio]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
-msgstr "Definir"
+msgstr "Set"
#: editor/property_editor.cpp
msgid "Properties:"
@@ -6678,7 +6696,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Essa operação não pode ser realizada em cenas instanciadas."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Salvar Nova Cena Como..."
#: editor/scene_tree_dock.cpp
@@ -6971,7 +6989,7 @@ msgstr "Carregar arquivo de script existente"
#: editor/script_create_dialog.cpp
msgid "Language"
-msgstr "Idioma"
+msgstr "Linguagem"
#: editor/script_create_dialog.cpp
msgid "Inherits"
@@ -7059,7 +7077,7 @@ msgstr "Pilha de Rastreamento (se aplicável):"
#: editor/script_editor_debugger.cpp
msgid "Profiler"
-msgstr "Profiler"
+msgstr "Profilador"
#: editor/script_editor_debugger.cpp
msgid "Monitor"
@@ -7083,11 +7101,11 @@ msgstr "Total:"
#: editor/script_editor_debugger.cpp
msgid "Video Mem"
-msgstr "Memória de Vídeo"
+msgstr "Mem. de Vídeo"
#: editor/script_editor_debugger.cpp
msgid "Resource Path"
-msgstr "Caminho do recurso"
+msgstr "Caminho do Recurso"
#: editor/script_editor_debugger.cpp
msgid "Type"
@@ -7278,18 +7296,16 @@ msgid "Object can't provide a length."
msgstr "Objeto não pôde fornecer um comprimento."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Próxima guia"
+msgstr "Próximo Plano"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Guia anterior"
+msgstr "Plano Anterior"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Plano:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7395,6 +7411,10 @@ msgstr "Configurações do GridMap"
msgid "Pick Distance:"
msgstr "Escolha uma Distância:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Nome da classe não pode ser uma palavra reservada"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Gerando solução..."
@@ -7425,7 +7445,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Sobre o suporte ao C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7443,6 +7463,10 @@ msgstr "Compilar Projeto"
msgid "Warnings"
msgstr "Avisos"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Fim da pilha de rastreamento de exceção interna"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7621,27 +7645,27 @@ msgstr "Condição"
#: modules/visual_script/visual_script_editor.cpp
msgid "Sequence"
-msgstr "Sequência"
+msgstr "Sequence"
#: modules/visual_script/visual_script_editor.cpp
msgid "Switch"
-msgstr "Trocar"
+msgstr "Switch"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
-msgstr "Iterador"
+msgstr "Iterator"
#: modules/visual_script/visual_script_editor.cpp
msgid "While"
-msgstr "Enquanto"
+msgstr "While"
#: modules/visual_script/visual_script_editor.cpp
msgid "Return"
-msgstr "Retornar"
+msgstr "Return"
#: modules/visual_script/visual_script_editor.cpp
msgid "Call"
-msgstr "Chamar"
+msgstr "Call"
#: modules/visual_script/visual_script_editor.cpp
msgid "Get"
@@ -7998,11 +8022,11 @@ msgstr "ARVROrigin necessita um nó ARVRCamera como filho"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Tempo Restante: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8102,12 +8126,24 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "A propriedade Caminho deve apontar para um nó Spatial para funcionar."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment precisa de um recurso Environment."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"É permitido apenas um nó WorldEnvironment por cena (ou conjunto de cenas "
"instanciadas)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Este WorldEnvironment está sendo ignorado. Adicione uma Camera (para cenas "
+"3D) ou defina o Background Mode deste ambiente para Canvas (para cenas 2D)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8204,6 +8240,26 @@ msgstr "Erro ao carregar fonte."
msgid "Invalid font size."
msgstr "Tamanho de fonte inválido."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Guia anterior"
+
+#~ msgid "Next"
+#~ msgstr "Próximo"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Ação Inválida (qualquer coisa serve, exceto '/' ou ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Não pode conter '/' ou ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Formato do version.txt dentro dos modelos é inválido. A revisão não é um "
+#~ "identificador válido."
+
#~ msgid "Can't write file."
#~ msgstr "Não foi possível escrever o arquivo."
@@ -8217,9 +8273,6 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Não foi possível encontrar project.godot no caminho do projeto."
-#~ msgid "Next"
-#~ msgstr "Próximo"
-
#~ msgid "Not found!"
#~ msgstr "Não encontrado!"
@@ -8365,7 +8418,7 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Exporting for %s"
#~ msgstr "Exportando para %s"
-#~ msgid "Setting Up.."
+#~ msgid "Setting Up..."
#~ msgstr "Ajustando..."
#~ msgid "Error loading scene."
@@ -8427,7 +8480,7 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Info"
#~ msgstr "Informação"
-#~ msgid "Re-Import.."
+#~ msgid "Re-Import..."
#~ msgstr "Re-importar..."
#~ msgid "No bit masks to import!"
@@ -8822,13 +8875,13 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Zoom (%):"
#~ msgstr "Ampliação (%):"
-#~ msgid "Skeleton.."
+#~ msgid "Skeleton..."
#~ msgstr "Esqueleto..."
#~ msgid "Zoom Reset"
#~ msgstr "Restaurar Ampliação"
-#~ msgid "Zoom Set.."
+#~ msgid "Zoom Set..."
#~ msgstr "Definir Ampliação..."
#~ msgid "Set a Value"
@@ -9248,7 +9301,7 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Export Project PCK"
#~ msgstr "Exportar PCK do Projeto"
-#~ msgid "Export.."
+#~ msgid "Export..."
#~ msgstr "Exportar..."
#~ msgid "Project Export"
@@ -9355,7 +9408,7 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "Recarregar Tool Script (suave)"
-#~ msgid "Edit Connections.."
+#~ msgid "Edit Connections..."
#~ msgstr "Editar Conexões..."
#~ msgid "Set Params"
@@ -9412,5 +9465,5 @@ msgstr "Tamanho de fonte inválido."
#~ msgid "Source Texture:"
#~ msgstr "Textura de Origem:"
-#~ msgid "Merging.."
+#~ msgid "Merging..."
#~ msgstr "Fundindo..."
diff --git a/editor/translations/pt_PT.po b/editor/translations/pt_PT.po
index 9ba20417e5..71275cd19a 100644
--- a/editor/translations/pt_PT.po
+++ b/editor/translations/pt_PT.po
@@ -2,21 +2,21 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# António Sarmento <antonio.luis.sarmento@gmail.com>, 2016.
# Carlos Vieira <carlos.vieira@gmail.com>, 2017.
+# João <joao@nogordio.com>, 2018.
# João Graça <jgraca95@gmail.com>, 2017.
# João Lopes <linux-man@hotmail.com>, 2017-2018.
# Miguel Gomes <miggas09@gmail.com>, 2017.
+# Paulo Caldeira <paucal@gmail.com>, 2018.
# Pedro Gomes <pedrogomes1698@gmail.com>, 2017.
# Rueben Stevens <supercell03@gmail.com>, 2017.
# SARDON <fabio3_Santos@hotmail.com>, 2017.
# Vinicius Gonçalves <viniciusgoncalves21@gmail.com>, 2017.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-31 20:40+0000\n"
+"PO-Revision-Date: 2018-06-10 01:02+0000\n"
"Last-Translator: João Lopes <linux-man@hotmail.com>\n"
"Language-Team: Portuguese (Portugal) <https://hosted.weblate.org/projects/"
"godot-engine/godot/pt_PT/>\n"
@@ -24,7 +24,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 2.19-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -504,7 +504,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Desligar '%s' de '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Ligar..."
#: editor/connections_dialog.cpp
@@ -829,31 +829,31 @@ msgstr "Adicionar Efeito"
#: editor/editor_audio_buses.cpp
msgid "Rename Audio Bus"
-msgstr "Mudar Barramento de Ãudio"
+msgstr "Renomear o barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Change Audio Bus Volume"
-msgstr "Alterar Volume do canal áudio"
+msgstr "Alterar Volume do barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
-msgstr "Alternar solo do canal áudio"
+msgstr "Alternar solo do barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Mute"
-msgstr "Alternar silêncio do canal áudio"
+msgstr "Alternar silêncio do barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Bypass Effects"
-msgstr "Alternar efeitos do canal áudio"
+msgstr "Alternar efeitos bypass do barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr "Selecionar envio do canal áudio"
+msgstr "Selecionar envio do barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
-msgstr "Adicionar Efeito de Barramento de Ãudio"
+msgstr "Adicionar Efeito de barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Move Bus Effect"
@@ -865,7 +865,7 @@ msgstr "Apagar Efeito de Barramento"
#: editor/editor_audio_buses.cpp
msgid "Audio Bus, Drag and Drop to rearrange."
-msgstr "Canal áudio, arrastar e largar para reorganizar."
+msgstr "Barramento de áudio, arrastar e largar para reorganizar."
#: editor/editor_audio_buses.cpp
msgid "Solo"
@@ -902,7 +902,7 @@ msgstr "Ãudio"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
-msgstr "Adicionar Barramento de Ãudio"
+msgstr "Adicionar barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Master bus can't be deleted!"
@@ -910,31 +910,31 @@ msgstr "O barramento principal não pode ser removido!"
#: editor/editor_audio_buses.cpp
msgid "Delete Audio Bus"
-msgstr "Apagar Barramento de Ãudio"
+msgstr "Apagar barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Duplicate Audio Bus"
-msgstr "Barramento de Ãudio Duplicado"
+msgstr "Duplicar barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "Reset Bus Volume"
-msgstr "Restabelecer Volume do Barramento"
+msgstr "Restabelecer volume do barramento"
#: editor/editor_audio_buses.cpp
msgid "Move Audio Bus"
-msgstr "Mover Barramento de Ãudio"
+msgstr "Mover barramento de áudio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Guardar Modelo de Barramento de Ãudio Como.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Guardar Modelo do barramento de áudio como..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Localização para o Novo Modelo.."
+msgid "Location for New Layout..."
+msgstr "Localização para o Novo Modelo..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
-msgstr "Abrir Modelo de Barramento de Ãudio"
+msgstr "Abrir Modelo de barramento de áudio"
#: editor/editor_audio_buses.cpp
msgid "There is no 'res://default_bus_layout.tres' file."
@@ -968,7 +968,7 @@ msgstr "Guardar Como"
#: editor/editor_audio_buses.cpp
msgid "Save this Bus Layout to a file."
-msgstr "Guardar este Modelo de Barramento para um Ficheiro."
+msgstr "Guardar este Modelo de Barramento para um ficheiro."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
msgid "Load Default"
@@ -1071,12 +1071,12 @@ msgid "Updating Scene"
msgstr "Atualizando a Cena"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Armazenando alterações locais.."
+msgid "Storing local changes..."
+msgstr "Armazenando alterações locais..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Atualizando a Cena.."
+msgid "Updating scene..."
+msgstr "Atualizando a Cena..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1144,8 +1144,8 @@ msgid "Show In File Manager"
msgstr "Mostrar no Gestor de Ficheiros"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Nova Diretoria.."
+msgid "New Folder..."
+msgstr "Nova Diretoria..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1404,18 +1404,22 @@ msgstr "Limpar"
msgid "Clear Output"
msgstr "Limpar Saída"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Exportação do projeto falhou com código de erro %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Erro ao guardar recurso!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Guardar Recurso Como.."
+msgid "Save Resource As..."
+msgstr "Guardar Recurso Como..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Eu vejo.."
+msgid "I see..."
+msgstr "Eu vejo..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1648,12 +1652,12 @@ msgid "Open Base Scene"
msgstr "Abrir Cena Base"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Abrir Cena de forma rápida.."
+msgid "Quick Open Scene..."
+msgstr "Abrir Cena de forma rápida..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Abrir Script de forma rápida.."
+msgid "Quick Open Script..."
+msgstr "Abrir Script de forma rápida..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1664,8 +1668,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Guardar alterações a '%s' antes de fechar?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Guardar Cena como.."
+msgid "Save Scene As..."
+msgstr "Guardar Cena como..."
#: editor/editor_node.cpp
msgid "No"
@@ -1716,8 +1720,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Esta acção não pode ser desfeita. Reverter na mesma?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Executar Cena de forma rápida.."
+msgid "Quick Run Scene..."
+msgstr "Executar Cena de forma rápida..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1873,8 +1877,8 @@ msgid "Previous tab"
msgstr "Guia anterior"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrar Ficheiro.."
+msgid "Filter Files..."
+msgstr "Filtrar Ficheiro..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1885,12 +1889,12 @@ msgid "New Scene"
msgstr "Nova Cena"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Nova Cena Herdada.."
+msgid "New Inherited Scene..."
+msgstr "Nova Cena Herdada..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Abrir Cena.."
+msgid "Open Scene..."
+msgstr "Abrir Cena..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1909,16 +1913,16 @@ msgid "Open Recent"
msgstr "Abrir Recente"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Converter Para.."
+msgid "Convert To..."
+msgstr "Converter Para..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2105,7 +2109,7 @@ msgstr "Comunidade"
#: editor/editor_node.cpp
msgid "About"
-msgstr "Sobre"
+msgstr "Sobre Nós"
#: editor/editor_node.cpp
msgid "Play the project."
@@ -2180,8 +2184,8 @@ msgid "Save the currently edited resource."
msgstr "Guarde o recurso editado."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Guardar Como.."
+msgid "Save As..."
+msgstr "Guardar Como..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2289,8 +2293,8 @@ msgid "Creating Mesh Previews"
msgstr "A criar pré-visualizações de Mesh"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Miniatura.."
+msgid "Thumbnail..."
+msgstr "Miniatura..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2442,7 +2446,7 @@ msgid "(Current)"
msgstr "(Atual)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "A readquirir servidores, espere por favor..."
#: editor/export_template_manager.cpp
@@ -2458,14 +2462,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Formato de version.txt inválido, dentro dos Modelos."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Formato de version.txt inválido, dentro dos Modelos. Revisão não é um "
-"identificador válido."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Não foi encontrado version.txt dentro dos Modelos."
@@ -2528,7 +2524,7 @@ msgid "Error requesting url: "
msgstr "Erro ao solicitar url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "A ligar ao servidor..."
#: editor/export_template_manager.cpp
@@ -2545,8 +2541,8 @@ msgstr "Impossível resolver"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "A ligar.."
+msgid "Connecting..."
+msgstr "A ligar..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2558,7 +2554,7 @@ msgstr "Ligado"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "A solicitar..."
#: editor/export_template_manager.cpp
@@ -2694,12 +2690,12 @@ msgid "Collapse all"
msgstr "Colapsar tudo"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Renomear.."
+msgid "Rename..."
+msgstr "Renomear..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Mover para.."
+msgid "Move To..."
+msgstr "Mover para..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2710,15 +2706,15 @@ msgid "Instance"
msgstr "Instância"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Editar Dependências.."
+msgid "Edit Dependencies..."
+msgstr "Editar Dependências..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "Ver proprietários..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Duplicar..."
#: editor/filesystem_dock.cpp
@@ -2744,7 +2740,7 @@ msgstr "Instancie a(s) Cena(s) selecionada(s) como filha(s) do Nó selecionado."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"A analisar Ficheiros,\n"
"Espere, por favor..."
@@ -2812,8 +2808,8 @@ msgid "Import Scene"
msgstr "Importar Cena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "A importar Cena.."
+msgid "Importing Scene..."
+msgstr "A importar Cena..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2824,8 +2820,8 @@ msgid "Generating for Mesh: "
msgstr "A gerar para Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "A executar Script Customizado.."
+msgid "Running Custom Script..."
+msgstr "A executar Script Customizado..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2840,8 +2836,8 @@ msgid "Error running post-import script:"
msgstr "Erro na execução do Script de pós-importação:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "A guardar.."
+msgid "Saving..."
+msgstr "A guardar..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2860,8 +2856,8 @@ msgid "Import As:"
msgstr "Importar Como:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Predefinido.."
+msgid "Preset..."
+msgstr "Predefinido..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3279,7 +3275,7 @@ msgid "Transition Node"
msgstr "Nó Transition"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr "Importar Animações..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3287,7 +3283,7 @@ msgid "Edit Node Filters"
msgstr "Editar filtros de Nó"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Filtros..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3355,7 +3351,7 @@ msgid "Fetching:"
msgstr "Em busca:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "A resolver..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3422,7 +3418,7 @@ msgid "Site:"
msgstr "Site:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Suporte..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3617,6 +3613,7 @@ msgid "Use Rotation Snap"
msgstr "Usar Ajuste na rotação"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Configurar Ajuste..."
@@ -3713,6 +3710,14 @@ msgid "Show Guides"
msgstr "Mostrar guias"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Mostrar Origem"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Mostrar Vista"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Centrar seleção"
@@ -4002,6 +4007,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "A Mesh não tem superfície para criar contornos!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Tipo primitivo de Mesh não é PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Contorno não pode ser criado!"
@@ -4030,7 +4039,7 @@ msgid "Create Convex Collision Sibling"
msgstr "Criar irmão de colisão convexa"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr "Criar Mesh contorno..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4235,7 +4244,7 @@ msgid "Error loading image:"
msgstr "Erro ao carregar imagem:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr "Sem pixeis com transparência > 128 na imagem..."
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4596,7 +4605,7 @@ msgid "Import Theme"
msgstr "Importar tema"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Guardar tema como..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4693,7 +4702,7 @@ msgstr "Alternar painel de Scripts"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "Encontrar..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4903,15 +4912,15 @@ msgid "Find Previous"
msgstr "Encontrar anterior"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "Substituir..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr "Ir para Função..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "Ir para linha..."
#: editor/plugins/script_text_editor.cpp
@@ -5365,11 +5374,7 @@ msgid "Transform"
msgstr "Transformar"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Configurar Ajuste..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr "Diálogo de transformação..."
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5431,7 +5436,7 @@ msgstr "Ajuste de escala (%):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Viewport Settings"
-msgstr "Configuração de vista"
+msgstr "Configuração de Vista"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Perspective FOV (deg.):"
@@ -5622,7 +5627,7 @@ msgid "Remove All"
msgstr "Remover tudo"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Editar tema..."
#: editor/plugins/theme_editor_plugin.cpp
@@ -5670,6 +5675,14 @@ msgid "Checked Item"
msgstr "Item verificado"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Item Rádio"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Item Rádio marcado"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Tem"
@@ -5682,8 +5695,8 @@ msgid "Options"
msgstr "Opções"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Tem,Muitos,Vários,Opções!"
+msgid "Has,Many,Options"
+msgstr "Tem,Muitas,Opções"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5875,7 +5888,7 @@ msgid "Presets"
msgstr "Predefinições"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Adicionar..."
#: editor/project_export.cpp
@@ -5970,6 +5983,10 @@ msgid "Imported Project"
msgstr "Projeto importado"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Nome do Projeto Inválido."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Impossível criar pasta."
@@ -5986,11 +6003,12 @@ 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.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "Impossível editar project.godot no Caminho do Projeto."
+msgstr ""
+"Não foi possível carregar o project.godot no caminho do projeto (erro %d). "
+"Poderá estar em falta ou corrompido."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6167,8 +6185,12 @@ msgid "Mouse Button"
msgstr "Botão do rato"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Ação inválida (tudo menos '/' ou ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Nome de ação inválido. Não pode ser vazio nem conter '/', ':', '=', '\\' ou "
+"'\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6195,7 +6217,7 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr "Pressione uma tecla..."
#: editor/project_settings_editor.cpp
@@ -6311,10 +6333,6 @@ msgid "Delete Item"
msgstr "Apagar item"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Não pode conter '/' ou ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Já existe"
@@ -6383,7 +6401,7 @@ msgid "Property:"
msgstr "Propriedade:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "Sobrepor por..."
#: editor/project_settings_editor.cpp
@@ -6456,7 +6474,7 @@ msgstr "Carregamento automático"
#: editor/property_editor.cpp
msgid "Pick a Viewport"
-msgstr "Escolha uma vista"
+msgstr "Escolha uma Vista"
#: editor/property_editor.cpp
msgid "Ease In"
@@ -6479,11 +6497,11 @@ msgid "Easing Out-In"
msgstr "Easing Out-In"
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr "Ficheiro..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr "Diretoria..."
#: editor/property_editor.cpp
@@ -6520,7 +6538,7 @@ msgstr "Erro ao carregar Ficheiro: Não é um recurso!"
#: editor/property_editor.cpp
msgid "Selected node is not a Viewport!"
-msgstr "Nó selecionado não é uma vista!"
+msgstr "Nó selecionado não é uma Vista!"
#: editor/property_editor.cpp
msgid "Pick a Node"
@@ -6656,7 +6674,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Esta operação não pode ser feita numa Cena instanciada."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Guardar nova Cena como..."
#: editor/scene_tree_dock.cpp
@@ -7033,7 +7051,7 @@ msgstr "Erros:"
#: editor/script_editor_debugger.cpp
msgid "Stack Trace (if applicable):"
-msgstr "Rastreamento de pilha (se aplicável):"
+msgstr "Stack Trace (se aplicável):"
#: editor/script_editor_debugger.cpp
msgid "Profiler"
@@ -7065,7 +7083,7 @@ msgstr "Memória Vídeo"
#: editor/script_editor_debugger.cpp
msgid "Resource Path"
-msgstr "Caminho de recurso"
+msgstr "Caminho do recurso"
#: editor/script_editor_debugger.cpp
msgid "Type"
@@ -7081,7 +7099,7 @@ msgstr "Uso"
#: editor/script_editor_debugger.cpp
msgid "Misc"
-msgstr "Misc"
+msgstr "Diversos"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
@@ -7257,18 +7275,16 @@ msgid "Object can't provide a length."
msgstr "Objeto não fornece um comprimento."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Próxima guia"
+msgstr "Plano seguinte"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "Guia anterior"
+msgstr "Plano anterior"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Plano:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7374,6 +7390,10 @@ msgstr "Configurações do GridMap"
msgid "Pick Distance:"
msgstr "Distância de escolha:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Nome de classe não pode ser uma palavra-chave reservada"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "A gerar soluções..."
@@ -7404,7 +7424,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Sobre o suporte C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7422,6 +7442,10 @@ msgstr "Construir Projeto"
msgid "Warnings"
msgstr "Avisos"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Fim do stack trace de exceção interna"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7452,12 +7476,11 @@ msgstr "O Nó retornou uma sequência de saída (output) incorreta: "
#: modules/visual_script/visual_script.cpp
msgid "Found sequence bit but not the node in the stack, report bug!"
-msgstr ""
-"A sequência foi encontrada mas não o Nó na pilha (stack), faça report de bug!"
+msgstr "Foi encontrada o bit da sequência mas não o Nó na pilha, relate o bug!"
#: modules/visual_script/visual_script.cpp
msgid "Stack overflow with stack depth: "
-msgstr "Stack overflow com a profundidade da pilha (stack): "
+msgstr "Pilha cheia com a profundidade da pilha: "
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Signal Arguments"
@@ -7976,11 +7999,11 @@ msgstr "ARVROrigin exige um Nó filho ARVRCamera"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Tempo restante: %d:%02d s)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8082,12 +8105,24 @@ msgstr ""
"válido."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment precisa de um recurso Environment."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Apenas um WorldEnvironment é permitido por Cena (ou grupo de cenas "
"instanciadas)."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Este WorldEnvironment Ä— ignorado. Pode adicionar uma Camera (para cenas 3D) "
+"ou definir o Modo Background deste ambiente como Canvas (para cenas 2D)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8184,6 +8219,26 @@ msgstr "Erro ao carregar letra."
msgid "Invalid font size."
msgstr "Tamanho de letra inválido."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Guia anterior"
+
+#~ msgid "Next"
+#~ msgstr "Proximo"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Ação inválida (tudo menos '/' ou ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Não pode conter '/' ou ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Formato de version.txt inválido, dentro dos Modelos. Revisão não é um "
+#~ "identificador válido."
+
#~ msgid "Can't write file."
#~ msgstr "Impossível escrever o Ficheiro."
@@ -8196,9 +8251,6 @@ msgstr "Tamanho de letra inválido."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Impossível encontrar project.godot no Caminho do Projeto."
-#~ msgid "Next"
-#~ msgstr "Proximo"
-
#~ msgid "Not found!"
#~ msgstr "Não encontrado!"
diff --git a/editor/translations/ro.po b/editor/translations/ro.po
index 287ababbd6..eaf931092a 100644
--- a/editor/translations/ro.po
+++ b/editor/translations/ro.po
@@ -2,14 +2,15 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
+# Calin Sopterean <csopterean@gmail.com>, 2018.
+# Filip <filipanton@tutanota.com>, 2018.
+# Nitroretro <nitroretro@protonmail.com>, 2018.
# TigerxWood <TigerxWood@gmail.com>, 2018.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-20 08:55+0000\n"
-"Last-Translator: TigerxWood <TigerxWood@gmail.com>\n"
+"PO-Revision-Date: 2018-06-20 20:43+0000\n"
+"Last-Translator: Calin Sopterean <csopterean@gmail.com>\n"
"Language-Team: Romanian <https://hosted.weblate.org/projects/godot-engine/"
"godot/ro/>\n"
"Language: ro\n"
@@ -17,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
"20)) ? 1 : 2;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -25,15 +26,15 @@ msgstr "Dezactivat"
#: editor/animation_editor.cpp
msgid "All Selection"
-msgstr "Toate selecțiile"
+msgstr "Toată selecția"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr "Anim Schimbare timp cadre cheie"
+msgstr "Anim Schimbați Timpul Cadru Cheie"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Anim Schimbare tranziție"
+msgstr "Anim Schimbați Tranziție"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
@@ -49,149 +50,149 @@ msgstr "Anim Schimbare apelare"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
-msgstr "Anim Adăugare pistă"
+msgstr "Anim Adăugați Pistă"
#: editor/animation_editor.cpp
msgid "Anim Duplicate Keys"
-msgstr "Anim Clonare chei"
+msgstr "Anim Clonare Chei"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
-msgstr "Mutare sus pistă anim"
+msgstr "Mută Pista Anim Sus"
#: editor/animation_editor.cpp
msgid "Move Anim Track Down"
-msgstr "Mutare jos pistă anim"
+msgstr "Mută Pista Anim Jos"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr "Eliminare pistă anim"
+msgstr "Elimină Pista Anim"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr "Setare tranziții la:"
+msgstr "Setează Tranziții la:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr "Redenumire pistă anim"
+msgstr "Redenumește Pista Anim"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr ""
+msgstr "Anim Schimbați Interpolarea Pistei"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr ""
+msgstr "Anim Schimbați Modul Valorii Pistei"
#: editor/animation_editor.cpp
msgid "Anim Track Change Wrap Mode"
-msgstr ""
+msgstr "Anim Schimbați Modul Învelirii Pistei"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
-msgstr ""
+msgstr "Editați Curba Nodului"
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
-msgstr ""
+msgstr "Editați Curba Selecției"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
-msgstr ""
+msgstr "Anim Ștergeți Cheile"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Duplicate Selection"
-msgstr ""
+msgstr "Duplicați Selecția"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
-msgstr ""
+msgstr "Duplicați Transpunerea"
#: editor/animation_editor.cpp
msgid "Remove Selection"
-msgstr ""
+msgstr "Elminați Selecția"
#: editor/animation_editor.cpp
msgid "Continuous"
-msgstr ""
+msgstr "Continuu"
#: editor/animation_editor.cpp
msgid "Discrete"
-msgstr ""
+msgstr "Discret"
#: editor/animation_editor.cpp
msgid "Trigger"
-msgstr ""
+msgstr "Trăgaci"
#: editor/animation_editor.cpp
msgid "Anim Add Key"
-msgstr ""
+msgstr "Anim Adaugați Cheie"
#: editor/animation_editor.cpp
msgid "Anim Move Keys"
-msgstr ""
+msgstr "Anim Mutați Cheie"
#: editor/animation_editor.cpp
msgid "Scale Selection"
-msgstr ""
+msgstr "Scalați Selecția"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
-msgstr ""
+msgstr "Scalați De La Cursor"
#: editor/animation_editor.cpp
msgid "Goto Next Step"
-msgstr ""
+msgstr "Mergeți la Pasul Următor"
#: editor/animation_editor.cpp
msgid "Goto Prev Step"
-msgstr ""
+msgstr "Mergeți la Pasul Anterior"
#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
#: editor/property_editor.cpp
msgid "Linear"
-msgstr ""
+msgstr "Linear"
#: editor/animation_editor.cpp editor/plugins/theme_editor_plugin.cpp
msgid "Constant"
-msgstr ""
+msgstr "Constant"
#: editor/animation_editor.cpp
msgid "In"
-msgstr ""
+msgstr "ÃŽn"
#: editor/animation_editor.cpp
msgid "Out"
-msgstr ""
+msgstr "Afară"
#: editor/animation_editor.cpp
msgid "In-Out"
-msgstr ""
+msgstr "Înăuntru-Afară"
#: editor/animation_editor.cpp
msgid "Out-In"
-msgstr ""
+msgstr "Afară-Înăuntru"
#: editor/animation_editor.cpp
msgid "Transitions"
-msgstr ""
+msgstr "Tranziții"
#: editor/animation_editor.cpp
msgid "Optimize Animation"
-msgstr ""
+msgstr "Optimizați Animația"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation"
-msgstr ""
+msgstr "Curățați Animația"
#: editor/animation_editor.cpp
msgid "Create NEW track for %s and insert key?"
-msgstr ""
+msgstr "Creați pistă NOUA pentru %s și inserați cheie?"
#: editor/animation_editor.cpp
msgid "Create %d NEW tracks and insert keys?"
-msgstr ""
+msgstr "Creați %d piste NOI și inserați cheie?"
#: editor/animation_editor.cpp editor/create_dialog.cpp
#: editor/editor_audio_buses.cpp editor/plugins/abstract_polygon_2d_editor.cpp
@@ -199,270 +200,272 @@ msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp editor/script_create_dialog.cpp
msgid "Create"
-msgstr ""
+msgstr "Creați"
#: editor/animation_editor.cpp
msgid "Anim Create & Insert"
-msgstr ""
+msgstr "Anim Creați și Inserați"
#: editor/animation_editor.cpp
msgid "Anim Insert Track & Key"
-msgstr ""
+msgstr "Anim Inserați Pistă și Cheie"
#: editor/animation_editor.cpp
msgid "Anim Insert Key"
-msgstr ""
+msgstr "Anim Inserați Cheie"
#: editor/animation_editor.cpp
msgid "Change Anim Len"
-msgstr ""
+msgstr "Schimbați Lung Anim"
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
-msgstr ""
+msgstr "Schimbați Bucla Anim"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
-msgstr ""
+msgstr "Anim Creați Cheie Valoare Typed"
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr ""
+msgstr "Anim Inserați"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
-msgstr ""
+msgstr "Anim Scalați Cheile"
#: editor/animation_editor.cpp
msgid "Anim Add Call Track"
-msgstr ""
+msgstr "Anim Adăugați Pistă Chemare"
#: editor/animation_editor.cpp
msgid "Animation zoom."
-msgstr ""
+msgstr "Zoom Animație."
#: editor/animation_editor.cpp
msgid "Length (s):"
-msgstr ""
+msgstr "Lungime (s):"
#: editor/animation_editor.cpp
msgid "Animation length (in seconds)."
-msgstr ""
+msgstr "Lungime Animație (în secunde)."
#: editor/animation_editor.cpp
msgid "Step (s):"
-msgstr ""
+msgstr "Pas (s):"
#: editor/animation_editor.cpp
msgid "Cursor step snap (in seconds)."
-msgstr ""
+msgstr "Pas de Cursor Snap (în secunde)."
#: editor/animation_editor.cpp
msgid "Enable/Disable looping in animation."
-msgstr ""
+msgstr "Activați / Dezactivați Repetiția în Animație."
#: editor/animation_editor.cpp
msgid "Add new tracks."
-msgstr ""
+msgstr "Adăugați piste noi."
#: editor/animation_editor.cpp
msgid "Move current track up."
-msgstr ""
+msgstr "Mișcați pista curentă sus."
#: editor/animation_editor.cpp
msgid "Move current track down."
-msgstr ""
+msgstr "Mișcați pista curentă jos."
#: editor/animation_editor.cpp
msgid "Remove selected track."
-msgstr ""
+msgstr "Ștergeți pista selectată."
#: editor/animation_editor.cpp
msgid "Track tools"
-msgstr ""
+msgstr "Unelte Pistă"
#: editor/animation_editor.cpp
msgid "Enable editing of individual keys by clicking them."
-msgstr ""
+msgstr "Activați editarea de chei individuale prin clic."
#: editor/animation_editor.cpp
msgid "Anim. Optimizer"
-msgstr ""
+msgstr "Anim. Optimizator"
#: editor/animation_editor.cpp
msgid "Max. Linear Error:"
-msgstr ""
+msgstr "Eroare Lineară Max:"
#: editor/animation_editor.cpp
msgid "Max. Angular Error:"
-msgstr ""
+msgstr "Eroare Angulară Max:"
#: editor/animation_editor.cpp
msgid "Max Optimizable Angle:"
-msgstr ""
+msgstr "Max Unghi Optimizabil:"
#: editor/animation_editor.cpp
msgid "Optimize"
-msgstr ""
+msgstr "Optimizați"
#: editor/animation_editor.cpp
msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
-msgstr ""
+msgstr "Selectați un Animator din Copacul Scenă să editați animații."
#: editor/animation_editor.cpp
msgid "Key"
-msgstr ""
+msgstr "Cheie"
#: editor/animation_editor.cpp
msgid "Transition"
-msgstr ""
+msgstr "Tranziție"
#: editor/animation_editor.cpp
msgid "Scale Ratio:"
-msgstr ""
+msgstr "Proporție Scalare:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr ""
+msgstr "Chemați Funcții în Care Nod?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
-msgstr ""
+msgstr "Ștergeți chei inoperabile"
#: editor/animation_editor.cpp
msgid "Remove unresolved and empty tracks"
-msgstr ""
+msgstr "Ștergeți piste nerezolvate sau goale"
#: editor/animation_editor.cpp
msgid "Clean-up all animations"
-msgstr ""
+msgstr "Curățați toate animațiile"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation(s) (NO UNDO!)"
-msgstr ""
+msgstr "Curățați Animațiile (FĂRĂ ANULARE!)"
#: editor/animation_editor.cpp
msgid "Clean-Up"
-msgstr ""
+msgstr "Curățați"
#: editor/array_property_edit.cpp
msgid "Resize Array"
-msgstr ""
+msgstr "Redimensionați Array-ul"
#: editor/array_property_edit.cpp
msgid "Change Array Value Type"
-msgstr ""
+msgstr "Schimbați Tipul Array-ului"
#: editor/array_property_edit.cpp
msgid "Change Array Value"
-msgstr ""
+msgstr "Schimbați Valoarea Array-ului"
#: editor/code_editor.cpp
msgid "Go to Line"
-msgstr ""
+msgstr "Duceți-vă la Linie"
#: editor/code_editor.cpp
msgid "Line Number:"
-msgstr ""
+msgstr "Linia Numărul:"
#: editor/code_editor.cpp
msgid "No Matches"
-msgstr ""
+msgstr "Nici o Potrivire"
#: editor/code_editor.cpp
msgid "Replaced %d occurrence(s)."
-msgstr ""
+msgstr "ÃŽnlocuit %d potriviri."
#: editor/code_editor.cpp
msgid "Match Case"
-msgstr ""
+msgstr "Potrivește Caz-ul"
#: editor/code_editor.cpp
msgid "Whole Words"
-msgstr ""
+msgstr "Cuvinte Complete"
#: editor/code_editor.cpp
msgid "Replace"
-msgstr ""
+msgstr "Înlocuiți"
#: editor/code_editor.cpp
msgid "Replace All"
-msgstr ""
+msgstr "Înlocuiți Tot"
#: editor/code_editor.cpp
msgid "Selection Only"
-msgstr ""
+msgstr "Numai Selecția"
#: editor/code_editor.cpp
msgid "Zoom In"
-msgstr ""
+msgstr "Zoom-ați În"
#: editor/code_editor.cpp
msgid "Zoom Out"
-msgstr ""
+msgstr "Zoom-ați Afară"
#: editor/code_editor.cpp
msgid "Reset Zoom"
-msgstr ""
+msgstr "Resetați Zoom-area"
#: editor/code_editor.cpp editor/script_editor_debugger.cpp
msgid "Line:"
-msgstr ""
+msgstr "Linie:"
#: editor/code_editor.cpp
msgid "Col:"
-msgstr ""
+msgstr "Col:"
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
-msgstr ""
+msgstr "Metoda din Nod-ul țintă trebuie specificată!"
#: editor/connections_dialog.cpp
msgid ""
"Target method not found! Specify a valid method or attach a script to target "
"Node."
msgstr ""
+"Metoda țintă nu există! Specificați o metodă validă sau atașați un script la "
+"Nod-ul țintă."
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
-msgstr ""
+msgstr "Conectați la Nod:"
#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
msgid "Add"
-msgstr ""
+msgstr "Adăugați"
#: editor/connections_dialog.cpp editor/dependency_editor.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_manager.cpp
#: editor/project_settings_editor.cpp
msgid "Remove"
-msgstr ""
+msgstr "Ștergeți"
#: editor/connections_dialog.cpp
msgid "Add Extra Call Argument:"
-msgstr ""
+msgstr "Adăugați Extra Argument de Chemare:"
#: editor/connections_dialog.cpp
msgid "Extra Call Arguments:"
-msgstr ""
+msgstr "Extra Argumente de Chemare:"
#: editor/connections_dialog.cpp
msgid "Path to Node:"
-msgstr ""
+msgstr "Drum la Nod:"
#: editor/connections_dialog.cpp
msgid "Make Function"
-msgstr ""
+msgstr "Faceți Funcția"
#: editor/connections_dialog.cpp
msgid "Deferred"
-msgstr ""
+msgstr "Amânat(ă)"
#: editor/connections_dialog.cpp
msgid "Oneshot"
-msgstr ""
+msgstr "Oneshot"
#: editor/connections_dialog.cpp editor/dependency_editor.cpp
#: editor/export_template_manager.cpp
@@ -476,143 +479,147 @@ msgstr ""
#: editor/run_settings_dialog.cpp editor/settings_config_dialog.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Close"
-msgstr ""
+msgstr "Aproape"
#: editor/connections_dialog.cpp
msgid "Connect"
-msgstr ""
+msgstr "Conectați"
#: editor/connections_dialog.cpp
msgid "Connect '%s' to '%s'"
-msgstr ""
+msgstr "Conectați '%s' la '%s'"
#: editor/connections_dialog.cpp
msgid "Connecting Signal:"
-msgstr ""
+msgstr "Conectați Semnal:"
#: editor/connections_dialog.cpp
msgid "Disconnect '%s' from '%s'"
-msgstr ""
+msgstr "Deconectați '%s' de la '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr ""
+msgid "Connect..."
+msgstr "Conectați..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Disconnect"
-msgstr ""
+msgstr "Deconectați"
#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
msgid "Signals"
-msgstr ""
+msgstr "Semnale"
#: editor/create_dialog.cpp
msgid "Change %s Type"
-msgstr ""
+msgstr "Schimbați Tipul %s"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Change"
-msgstr ""
+msgstr "Schimbați"
#: editor/create_dialog.cpp
msgid "Create New %s"
-msgstr ""
+msgstr "Creați %s Nou"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
msgid "Favorites:"
-msgstr ""
+msgstr "Favorite:"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
msgid "Recent:"
-msgstr ""
+msgstr "Recent:"
#: editor/create_dialog.cpp editor/editor_node.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp
msgid "Search:"
-msgstr ""
+msgstr "Cautați:"
#: editor/create_dialog.cpp editor/editor_help.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp
msgid "Matches:"
-msgstr ""
+msgstr "Potriviri:"
#: editor/create_dialog.cpp editor/editor_help.cpp
#: editor/plugins/asset_library_editor_plugin.cpp editor/property_selector.cpp
#: editor/script_editor_debugger.cpp
msgid "Description:"
-msgstr ""
+msgstr "Descriere:"
#: editor/dependency_editor.cpp
msgid "Search Replacement For:"
-msgstr ""
+msgstr "Cautați Înlocuitor Pentru:"
#: editor/dependency_editor.cpp
msgid "Dependencies For:"
-msgstr ""
+msgstr "Dependențe Pentru:"
#: editor/dependency_editor.cpp
msgid ""
"Scene '%s' is currently being edited.\n"
"Changes will not take effect unless reloaded."
msgstr ""
+"Scena '%s' este în proces de editare. \n"
+"Modificările nu vor avea efect dacă nu reîncărcați."
#: editor/dependency_editor.cpp
msgid ""
"Resource '%s' is in use.\n"
"Changes will take effect when reloaded."
msgstr ""
+"Resursa '%s' este în folosință.\n"
+"Modificările vor avea efect după ce reîncărcați."
#: editor/dependency_editor.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Dependencies"
-msgstr ""
+msgstr "Dependențe"
#: editor/dependency_editor.cpp
msgid "Resource"
-msgstr ""
+msgstr "Resursă"
#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
#: editor/project_manager.cpp editor/project_settings_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Path"
-msgstr ""
+msgstr "Cale"
#: editor/dependency_editor.cpp
msgid "Dependencies:"
-msgstr ""
+msgstr "Dependințe:"
#: editor/dependency_editor.cpp
msgid "Fix Broken"
-msgstr ""
+msgstr "Reparați Stricat"
#: editor/dependency_editor.cpp
msgid "Dependency Editor"
-msgstr ""
+msgstr "Editor de Dependență"
#: editor/dependency_editor.cpp
msgid "Search Replacement Resource:"
-msgstr ""
+msgstr "Cautați Înlocuitor Resursă:"
#: editor/dependency_editor.cpp editor/editor_file_dialog.cpp
#: editor/editor_help.cpp editor/editor_node.cpp editor/filesystem_dock.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp scene/gui/file_dialog.cpp
msgid "Open"
-msgstr ""
+msgstr "Deschide"
#: editor/dependency_editor.cpp
msgid "Owners Of:"
-msgstr ""
+msgstr "Stăpâni La:"
#: editor/dependency_editor.cpp
msgid "Remove selected files from the project? (no undo)"
-msgstr ""
+msgstr "Ștergeți fișierele selectate din proiect? (fără anulare)"
#: editor/dependency_editor.cpp
msgid ""
@@ -620,54 +627,57 @@ msgid ""
"work.\n"
"Remove them anyway? (no undo)"
msgstr ""
+"Fișierele în proces de ștergere sunt necesare pentru alte resurse ca ele să "
+"sa funcționeze.\n"
+"Ștergeți oricum? (fără anulare)"
#: editor/dependency_editor.cpp
msgid "Cannot remove:"
-msgstr ""
+msgstr "Nu se poate șterge:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
-msgstr ""
+msgstr "Eroare încărcând:"
#: editor/dependency_editor.cpp
msgid "Scene failed to load due to missing dependencies:"
-msgstr ""
+msgstr "Scena nu a putut fi încărcata deoarece are dependențe în lipsa:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Open Anyway"
-msgstr ""
+msgstr "Deschide Oricum"
#: editor/dependency_editor.cpp
msgid "Which action should be taken?"
-msgstr ""
+msgstr "Ce acțiune trebuie să fie luată?"
#: editor/dependency_editor.cpp
msgid "Fix Dependencies"
-msgstr ""
+msgstr "Rezolvă dependențele"
#: editor/dependency_editor.cpp
msgid "Errors loading!"
-msgstr ""
+msgstr "Erori încărcând!"
#: editor/dependency_editor.cpp
msgid "Permanently delete %d item(s)? (No undo!)"
-msgstr ""
+msgstr "Ștergeți permanent %d articol(e)? (Fără anulare!)"
#: editor/dependency_editor.cpp
msgid "Owns"
-msgstr ""
+msgstr "Deține"
#: editor/dependency_editor.cpp
msgid "Resources Without Explicit Ownership:"
-msgstr ""
+msgstr "Resurse Fără Deținere Explicită:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Orphan Resource Explorer"
-msgstr ""
+msgstr "Explorator de Resurse Orfane"
#: editor/dependency_editor.cpp
msgid "Delete selected files?"
-msgstr ""
+msgstr "Ştergeți fişierele selectate?"
#: editor/dependency_editor.cpp editor/editor_audio_buses.cpp
#: editor/editor_file_dialog.cpp editor/editor_node.cpp
@@ -675,83 +685,83 @@ msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
#: editor/scene_tree_dock.cpp
msgid "Delete"
-msgstr ""
+msgstr "Ștergeți"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Key"
-msgstr ""
+msgstr "Schimbați Cheie Dicţionar"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Value"
-msgstr ""
+msgstr "Schimbaţi Valoarea Dicţionar"
#: editor/editor_about.cpp
msgid "Thanks from the Godot community!"
-msgstr ""
+msgstr "Mulțumesc din partea comunităţii Godot!"
#: editor/editor_about.cpp
msgid "Thanks!"
-msgstr ""
+msgstr "Mulţumiri!"
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
-msgstr ""
+msgstr "Contribuabili Motor Godot"
#: editor/editor_about.cpp
msgid "Project Founders"
-msgstr ""
+msgstr "Fondatorii Proiectului"
#: editor/editor_about.cpp
msgid "Lead Developer"
-msgstr ""
+msgstr "Dezvoltator Principal"
#: editor/editor_about.cpp
msgid "Project Manager "
-msgstr ""
+msgstr "Manager de Proiect "
#: editor/editor_about.cpp
msgid "Developers"
-msgstr ""
+msgstr "Dezvoltatori"
#: editor/editor_about.cpp
msgid "Authors"
-msgstr ""
+msgstr "Autori"
#: editor/editor_about.cpp
msgid "Platinum Sponsors"
-msgstr ""
+msgstr "Sponsori Platină"
#: editor/editor_about.cpp
msgid "Gold Sponsors"
-msgstr ""
+msgstr "Sponsori Aur"
#: editor/editor_about.cpp
msgid "Mini Sponsors"
-msgstr ""
+msgstr "Mini Sponsori"
#: editor/editor_about.cpp
msgid "Gold Donors"
-msgstr ""
+msgstr "Donatori de Aur"
#: editor/editor_about.cpp
msgid "Silver Donors"
-msgstr ""
+msgstr "Donatori de Argint"
#: editor/editor_about.cpp
msgid "Bronze Donors"
-msgstr ""
+msgstr "Donatori de Bronz"
#: editor/editor_about.cpp
msgid "Donors"
-msgstr ""
+msgstr "Donatori"
#: editor/editor_about.cpp
msgid "License"
-msgstr ""
+msgstr "Licență"
#: editor/editor_about.cpp
msgid "Thirdparty License"
-msgstr ""
+msgstr "Licenţe Thirdparty"
#: editor/editor_about.cpp
msgid ""
@@ -760,558 +770,567 @@ msgid ""
"is an exhaustive list of all such thirdparty components with their "
"respective copyright statements and license terms."
msgstr ""
+"Motorul Godot se bazează pe un număr de biblioteci thirdparty gratis și "
+"opensource, toate compatibile cu termenii licenţei MIT ai lui. Mai jos este "
+"o listă exhaustivă a tuturor acestor componente de thirdparty cu declaraţii "
+"de autor respective şi termenii licenței."
#: editor/editor_about.cpp
msgid "All Components"
-msgstr ""
+msgstr "Toate Componentele"
#: editor/editor_about.cpp
msgid "Components"
-msgstr ""
+msgstr "Componente"
#: editor/editor_about.cpp
msgid "Licenses"
-msgstr ""
+msgstr "Licențe"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Error opening package file, not in zip format."
-msgstr ""
+msgstr "Eroare la deschiderea fişierului pachet, nu este în format zip."
#: editor/editor_asset_installer.cpp
msgid "Uncompressing Assets"
-msgstr ""
+msgstr "Decomprimare Asset-uri"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Package Installed Successfully!"
-msgstr ""
+msgstr "Pachet Instalat cu Succes!"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Success!"
-msgstr ""
+msgstr "Succes!"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Install"
-msgstr ""
+msgstr "Instalați"
#: editor/editor_asset_installer.cpp
msgid "Package Installer"
-msgstr ""
+msgstr "Instalator de Pachet"
#: editor/editor_audio_buses.cpp
msgid "Speakers"
-msgstr ""
+msgstr "Difuzoare"
#: editor/editor_audio_buses.cpp
msgid "Add Effect"
-msgstr ""
+msgstr "Adaugă Efect"
#: editor/editor_audio_buses.cpp
msgid "Rename Audio Bus"
-msgstr ""
+msgstr "Redenumiţi Pista Audio"
#: editor/editor_audio_buses.cpp
msgid "Change Audio Bus Volume"
-msgstr ""
+msgstr "Schimbați Volumul Pistei Audio"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
-msgstr ""
+msgstr "Comutați Pista Audio Singură"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Mute"
-msgstr ""
+msgstr "Comutați Pista Audio Mută"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Bypass Effects"
-msgstr ""
+msgstr "Comutați Efecte de Ocolire Pista Audio"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr ""
+msgstr "Selectați Pista Audio Trimitere"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
-msgstr ""
+msgstr "Adaugați Efect Pista Audio"
#: editor/editor_audio_buses.cpp
msgid "Move Bus Effect"
-msgstr ""
+msgstr "Mutați Pista Efect"
#: editor/editor_audio_buses.cpp
msgid "Delete Bus Effect"
-msgstr ""
+msgstr "Ștergeți Pista Efect"
#: editor/editor_audio_buses.cpp
msgid "Audio Bus, Drag and Drop to rearrange."
-msgstr ""
+msgstr "Pista Audio, Trageți și Plasați pentru a rearanja."
#: editor/editor_audio_buses.cpp
msgid "Solo"
-msgstr ""
+msgstr "Singură"
#: editor/editor_audio_buses.cpp
msgid "Mute"
-msgstr ""
+msgstr "Mut"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
-msgstr ""
+msgstr "Ocolire"
#: editor/editor_audio_buses.cpp
msgid "Bus options"
-msgstr ""
+msgstr "Opțiuni Pistă Audio"
#: editor/editor_audio_buses.cpp editor/filesystem_dock.cpp
#: editor/plugins/tile_map_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Duplicate"
-msgstr ""
+msgstr "Duplicați"
#: editor/editor_audio_buses.cpp
msgid "Reset Volume"
-msgstr ""
+msgstr "Resetați Volumul"
#: editor/editor_audio_buses.cpp
msgid "Delete Effect"
-msgstr ""
+msgstr "Ștergeți Efectul"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Sunet"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
-msgstr ""
+msgstr "Adaugă Pistă Audio"
#: editor/editor_audio_buses.cpp
msgid "Master bus can't be deleted!"
-msgstr ""
+msgstr "Imposibil de Șters Pistă Audio Master!"
#: editor/editor_audio_buses.cpp
msgid "Delete Audio Bus"
-msgstr ""
+msgstr "Ştergeţi Pista Audio"
#: editor/editor_audio_buses.cpp
msgid "Duplicate Audio Bus"
-msgstr ""
+msgstr "Duplicați Pista Audio"
#: editor/editor_audio_buses.cpp
msgid "Reset Bus Volume"
-msgstr ""
+msgstr "Resetați Volumul Pistei Audio"
#: editor/editor_audio_buses.cpp
msgid "Move Audio Bus"
-msgstr ""
+msgstr "Mutați Pista Audio"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr ""
+msgid "Save Audio Bus Layout As..."
+msgstr "Salvați Schema Pistei Audio Ca..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr ""
+msgid "Location for New Layout..."
+msgstr "Locație pentru Noua Schemă..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
-msgstr ""
+msgstr "Deschide Schema Pistei Audio"
#: editor/editor_audio_buses.cpp
msgid "There is no 'res://default_bus_layout.tres' file."
-msgstr ""
+msgstr "Nu există nici un fişier 'res://default_bus_layout.tres'."
#: editor/editor_audio_buses.cpp
msgid "Invalid file, not an audio bus layout."
-msgstr ""
+msgstr "Fişier nevalid, nu este o schemă de pistă audio."
#: editor/editor_audio_buses.cpp
msgid "Add Bus"
-msgstr ""
+msgstr "Adaugați Pistă Audio"
#: editor/editor_audio_buses.cpp
msgid "Create a new Bus Layout."
-msgstr ""
+msgstr "Creaţi o Schemă nouă de Pistă Audio."
#: editor/editor_audio_buses.cpp editor/property_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Load"
-msgstr ""
+msgstr "Încărcați"
#: editor/editor_audio_buses.cpp
msgid "Load an existing Bus Layout."
-msgstr ""
+msgstr "Încărcaţi o Schemă de Pistă Audio existentă."
#: editor/editor_audio_buses.cpp
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Save As"
-msgstr ""
+msgstr "Salvați Ca"
#: editor/editor_audio_buses.cpp
msgid "Save this Bus Layout to a file."
-msgstr ""
+msgstr "Salvaţi acestă Schemă de Pistă Audio într-un fişier."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
msgid "Load Default"
-msgstr ""
+msgstr "Încărcați Implicit"
#: editor/editor_audio_buses.cpp
msgid "Load the default Bus Layout."
-msgstr ""
+msgstr "Încarcă Schema de Pistă Audio implicită."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name."
-msgstr ""
+msgstr "Nume nevalid."
#: editor/editor_autoload_settings.cpp
msgid "Valid characters:"
-msgstr ""
+msgstr "Caractere valide:"
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing engine class name."
msgstr ""
+"Nume nevalid. Nu trebuie să se lovească cu un nume de clasa deja existent în "
+"motor."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing buit-in type name."
msgstr ""
+"Nume nevalid. Nu trebuie să se lovească cu un nume de tip deja existent în "
+"motor tip."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing global constant name."
msgstr ""
+"Nume nevalid. Nu trebuie să se lovească cu un nume ce constante globale."
#: editor/editor_autoload_settings.cpp
msgid "Invalid Path."
-msgstr ""
+msgstr "Cale nevalidă."
#: editor/editor_autoload_settings.cpp
msgid "File does not exist."
-msgstr ""
+msgstr "Fișierul nu există."
#: editor/editor_autoload_settings.cpp
msgid "Not in resource path."
-msgstr ""
+msgstr "Nu în calea de resurse."
#: editor/editor_autoload_settings.cpp
msgid "Add AutoLoad"
-msgstr ""
+msgstr "Adaugați AutoLoad"
#: editor/editor_autoload_settings.cpp
msgid "Autoload '%s' already exists!"
-msgstr ""
+msgstr "AutoLoad '%s' există deja!"
#: editor/editor_autoload_settings.cpp
msgid "Rename Autoload"
-msgstr ""
+msgstr "Redenumiţi Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Toggle AutoLoad Globals"
-msgstr ""
+msgstr "Comutați Globale AutoLoad"
#: editor/editor_autoload_settings.cpp
msgid "Move Autoload"
-msgstr ""
+msgstr "Mutați Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Remove Autoload"
-msgstr ""
+msgstr "Eliminați Autoload"
#: editor/editor_autoload_settings.cpp
msgid "Enable"
-msgstr ""
+msgstr "Activați"
#: editor/editor_autoload_settings.cpp
msgid "Rearrange Autoloads"
-msgstr ""
+msgstr "Rearanjați Autoload-urile"
#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
#: scene/gui/file_dialog.cpp
msgid "Path:"
-msgstr ""
+msgstr "Cale:"
#: editor/editor_autoload_settings.cpp
msgid "Node Name:"
-msgstr ""
+msgstr "Nume Nod:"
#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
#: editor/project_manager.cpp editor/settings_config_dialog.cpp
msgid "Name"
-msgstr ""
+msgstr "Nume"
#: editor/editor_autoload_settings.cpp
msgid "Singleton"
-msgstr ""
+msgstr "Singleton"
#: editor/editor_data.cpp
msgid "Updating Scene"
-msgstr ""
+msgstr "Scena se Actualizează"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr ""
+msgid "Storing local changes..."
+msgstr "Modificările locale se stochează..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr ""
+msgid "Updating scene..."
+msgstr "Scena se Actualizează..."
#: editor/editor_data.cpp
msgid "[empty]"
-msgstr ""
+msgstr "[gol]"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr ""
+msgstr "[nesalvat]"
#: editor/editor_dir_dialog.cpp
msgid "Please select a base directory first"
-msgstr ""
+msgstr "Vă rugăm să selectaţi mai întâi un director de baza"
#: editor/editor_dir_dialog.cpp
msgid "Choose a Directory"
-msgstr ""
+msgstr "Alegeţi un Director"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
msgid "Create Folder"
-msgstr ""
+msgstr "Creați Director"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
#: scene/gui/file_dialog.cpp
msgid "Name:"
-msgstr ""
+msgstr "Nume:"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
msgid "Could not create folder."
-msgstr ""
+msgstr "Directorul nu a putut fi creat."
#: editor/editor_dir_dialog.cpp
msgid "Choose"
-msgstr ""
+msgstr "Alegeți"
#: editor/editor_export.cpp
msgid "Storing File:"
-msgstr ""
+msgstr "Fişierul se Stochează:"
#: editor/editor_export.cpp
msgid "Packing"
-msgstr ""
+msgstr "Ambalare"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
msgid "Template file not found:"
-msgstr ""
+msgstr "Fișierul șablon nu a fost găsit:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "File Exists, Overwrite?"
-msgstr ""
+msgstr "Fișierul există, suprascrieţi?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Select Current Folder"
-msgstr ""
+msgstr "Selectaţi directorul curent"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
-msgstr ""
+msgstr "Copiaţi Calea"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Show In File Manager"
-msgstr ""
+msgstr "Arătați în Administratorul de Fișiere"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr ""
+msgid "New Folder..."
+msgstr "Director Nou..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
-msgstr ""
+msgstr "Reîmprospătați"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Recognized"
-msgstr ""
+msgstr "Toate Recunoscute"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Files (*)"
-msgstr ""
+msgstr "Toate FiÅŸierele (*)"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a File"
-msgstr ""
+msgstr "Deschideți un Fișier"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open File(s)"
-msgstr ""
+msgstr "Deschideți Fișier(e)"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a Directory"
-msgstr ""
+msgstr "Deschideţi un Director"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a File or Directory"
-msgstr ""
+msgstr "Deschideți un Fişier sau Director"
#: editor/editor_file_dialog.cpp editor/editor_node.cpp
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp scene/gui/file_dialog.cpp
msgid "Save"
-msgstr ""
+msgstr "Salvați"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Save a File"
-msgstr ""
+msgstr "Salvați un Fișier"
#: editor/editor_file_dialog.cpp
msgid "Go Back"
-msgstr ""
+msgstr "ÃŽnapoi"
#: editor/editor_file_dialog.cpp
msgid "Go Forward"
-msgstr ""
+msgstr "ÃŽnainte"
#: editor/editor_file_dialog.cpp
msgid "Go Up"
-msgstr ""
+msgstr "Sus"
#: editor/editor_file_dialog.cpp
msgid "Toggle Hidden Files"
-msgstr ""
+msgstr "Comutați Fișiere Ascunse"
#: editor/editor_file_dialog.cpp
msgid "Toggle Favorite"
-msgstr ""
+msgstr "Comutați Favorite"
#: editor/editor_file_dialog.cpp
msgid "Toggle Mode"
-msgstr ""
+msgstr "Modul de Comutare"
#: editor/editor_file_dialog.cpp
msgid "Focus Path"
-msgstr ""
+msgstr "Calea Focală"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Up"
-msgstr ""
+msgstr "Deplasați Favorit Sus"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Down"
-msgstr ""
+msgstr "Deplasați Favorit Jos"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Go to parent folder"
-msgstr ""
+msgstr "Accesați Directorul Părinte"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
-msgstr ""
+msgstr "Directoare și Fişiere:"
#: editor/editor_file_dialog.cpp
msgid "Preview:"
-msgstr ""
+msgstr "Previzualizați:"
#: editor/editor_file_dialog.cpp editor/script_editor_debugger.cpp
#: scene/gui/file_dialog.cpp
msgid "File:"
-msgstr ""
+msgstr "Fișier:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Must use a valid extension."
-msgstr ""
+msgstr "Trebuie să utilizaţi o extensie valida."
#: editor/editor_file_system.cpp
msgid "ScanSources"
-msgstr ""
+msgstr "SurseScan"
#: editor/editor_file_system.cpp
msgid "(Re)Importing Assets"
-msgstr ""
+msgstr "(Re)Importând Asset-uri"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
msgid "Search Help"
-msgstr ""
+msgstr "Căutați în Ajutor"
#: editor/editor_help.cpp
msgid "Class List:"
-msgstr ""
+msgstr "Listă de Clase:"
#: editor/editor_help.cpp
msgid "Search Classes"
-msgstr ""
+msgstr "Căutare Clase"
#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Top"
-msgstr ""
+msgstr "Sus"
#: editor/editor_help.cpp editor/property_editor.cpp
msgid "Class:"
-msgstr ""
+msgstr "Clasă:"
#: editor/editor_help.cpp editor/scene_tree_editor.cpp
msgid "Inherits:"
-msgstr ""
+msgstr "Moștenește:"
#: editor/editor_help.cpp
msgid "Inherited by:"
-msgstr ""
+msgstr "MoÅŸtenit de:"
#: editor/editor_help.cpp
msgid "Brief Description:"
-msgstr ""
+msgstr "Descriere Scurtă:"
#: editor/editor_help.cpp
msgid "Members"
-msgstr ""
+msgstr "Membri"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Members:"
-msgstr ""
+msgstr "Membri:"
#: editor/editor_help.cpp
msgid "Public Methods"
-msgstr ""
+msgstr "Metode Publice"
#: editor/editor_help.cpp
msgid "Public Methods:"
-msgstr ""
+msgstr "Metode Publice:"
#: editor/editor_help.cpp
msgid "GUI Theme Items"
-msgstr ""
+msgstr "Obiecte Tema Interfața Grafică"
#: editor/editor_help.cpp
msgid "GUI Theme Items:"
-msgstr ""
+msgstr "Obiecte Tema Interfața Grafică:"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Signals:"
-msgstr ""
+msgstr "Semnale:"
#: editor/editor_help.cpp
msgid "Enumerations"
-msgstr ""
+msgstr "Enumerări"
#: editor/editor_help.cpp
msgid "Enumerations:"
-msgstr ""
+msgstr "Enumerări:"
#: editor/editor_help.cpp
msgid "enum "
-msgstr ""
+msgstr "enum "
#: editor/editor_help.cpp
msgid "Constants"
-msgstr ""
+msgstr "Constante"
#: editor/editor_help.cpp
msgid "Constants:"
-msgstr ""
+msgstr "Constante:"
#: editor/editor_help.cpp
msgid "Description"
-msgstr ""
+msgstr "Descriere"
#: editor/editor_help.cpp
msgid "Online Tutorials:"
-msgstr ""
+msgstr "Tutoriale Internet:"
#: editor/editor_help.cpp
msgid ""
@@ -1319,160 +1338,174 @@ msgid ""
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
+"Nu există în prezent nici un tutorial pentru această clasă, puteţi [culoare "
+"= $color] [url = $url] contribui unul [/ URL] [/ color] sau [culoare = "
+"$color] [url = $url2] cerere unul[/ URL] [/ color]."
#: editor/editor_help.cpp
msgid "Properties"
-msgstr ""
+msgstr "Proprietăți"
#: editor/editor_help.cpp
msgid "Property Description:"
-msgstr ""
+msgstr "Descriere Proprietate:"
#: editor/editor_help.cpp
msgid ""
"There is currently no description for this property. Please help us by "
"[color=$color][url=$url]contributing one[/url][/color]!"
msgstr ""
+"Nu există în prezent nici o descriere pentru această proprietate. Te rog "
+"ajută-ne prin a [color = $color] [url = $url] contribui cu una [/ URL] [/ "
+"color]!"
#: editor/editor_help.cpp
msgid "Methods"
-msgstr ""
+msgstr "Metode"
#: editor/editor_help.cpp
msgid "Method Description:"
-msgstr ""
+msgstr "Descrierea metodei:"
#: editor/editor_help.cpp
msgid ""
"There is currently no description for this method. Please help us by [color="
"$color][url=$url]contributing one[/url][/color]!"
msgstr ""
+"Nu există în prezent nici o descriere pentru această metodă. Te rog ajută-ne "
+"de prin a [color = $color] [url = $url] contribui cu una [/ URL] [/ color]!"
#: editor/editor_help.cpp
msgid "Search Text"
-msgstr ""
+msgstr "Căutați Text"
#: editor/editor_help.cpp
msgid "Find"
-msgstr ""
+msgstr "Găsiți"
#: editor/editor_log.cpp
msgid "Output:"
-msgstr ""
+msgstr "Afișare:"
#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/property_editor.cpp editor/script_editor_debugger.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
msgid "Clear"
-msgstr ""
+msgstr "Curăță"
#: editor/editor_log.cpp
msgid "Clear Output"
-msgstr ""
+msgstr "Curăță Afișarea"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Exportul de proiect nu a reuÅŸit cu un cod de eroare %d."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
-msgstr ""
+msgstr "Eroare la salvarea resursei!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr ""
+msgid "Save Resource As..."
+msgstr "Salvați Resursa Ca..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr ""
+msgid "I see..."
+msgstr "Am înțeles..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
-msgstr ""
+msgstr "Nu pot deschide fiÅŸierul pentru scris:"
#: editor/editor_node.cpp
msgid "Requested file format unknown:"
-msgstr ""
+msgstr "Formatul fiÅŸierului solicitat este necunoscut:"
#: editor/editor_node.cpp
msgid "Error while saving."
-msgstr ""
+msgstr "Eroare la salvare."
#: editor/editor_node.cpp
msgid "Can't open '%s'."
-msgstr ""
+msgstr "Imposibil de deschis '%s'."
#: editor/editor_node.cpp
msgid "Error while parsing '%s'."
-msgstr ""
+msgstr "Eroare analizând '%s'."
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
-msgstr ""
+msgstr "Sfârșit de fișier neaşteptat '%s'."
#: editor/editor_node.cpp
msgid "Missing '%s' or its dependencies."
-msgstr ""
+msgstr "Lipsește '%s' sau dependenţele sale."
#: editor/editor_node.cpp
msgid "Error while loading '%s'."
-msgstr ""
+msgstr "Eroare în timpul încărcării '%s'."
#: editor/editor_node.cpp
msgid "Saving Scene"
-msgstr ""
+msgstr "Salvând Scena"
#: editor/editor_node.cpp
msgid "Analyzing"
-msgstr ""
+msgstr "Analizând"
#: editor/editor_node.cpp
msgid "Creating Thumbnail"
-msgstr ""
+msgstr "Creând Thumbnail"
#: editor/editor_node.cpp
msgid "This operation can't be done without a tree root."
-msgstr ""
+msgstr "Aceasta operațiune nu se poate face fără o rădăcină de copac."
#: editor/editor_node.cpp
msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
msgstr ""
+"Nu am putut salva scena. Probabil dependenţe (instanţe sau moşteniri) nu au "
+"putut fi satisfăcute."
#: editor/editor_node.cpp
msgid "Failed to load resource."
-msgstr ""
+msgstr "Încărcarea resursei a eșuat."
#: editor/editor_node.cpp
msgid "Can't load MeshLibrary for merging!"
-msgstr ""
+msgstr "Imposibil de încărcat MeshLibrary pentru unire!"
#: editor/editor_node.cpp
msgid "Error saving MeshLibrary!"
-msgstr ""
+msgstr "Eroare la salvarea MeshLibrary!"
#: editor/editor_node.cpp
msgid "Can't load TileSet for merging!"
-msgstr ""
+msgstr "Imposibil de încărcat TileSet pentru unire!"
#: editor/editor_node.cpp
msgid "Error saving TileSet!"
-msgstr ""
+msgstr "Eroare la salvarea TileSet!"
#: editor/editor_node.cpp
msgid "Error trying to save layout!"
-msgstr ""
+msgstr "Eroare la încercarea de a salva schema!"
#: editor/editor_node.cpp
msgid "Default editor layout overridden."
-msgstr ""
+msgstr "Schemă implicită de editor suprascrisă."
#: editor/editor_node.cpp
msgid "Layout name not found!"
-msgstr ""
+msgstr "Numele schemei nu a fost găsit!"
#: editor/editor_node.cpp
msgid "Restored default layout to base settings."
-msgstr ""
+msgstr "S-a restaurat schema implictă la setările de bază."
#: editor/editor_node.cpp
msgid ""
@@ -1480,18 +1513,26 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
+"Această resursă aparţine de o scena care a fost importată, astfel încât nu "
+"este editabilă.\n"
+"Vă rugăm să citiţi documentaţia relevantă pentru importul scene pentru a "
+"înţelege mai bine cum sa lucrați cu acestea."
#: editor/editor_node.cpp
msgid ""
"This resource belongs to a scene that was instanced or inherited.\n"
"Changes to it will not be kept when saving the current scene."
msgstr ""
+"Această resursă este o scena care a fost instanțată sau moştenită.\n"
+"Modificările la acesta nu vor fi păstrate la salvarea scenei curente."
#: editor/editor_node.cpp
msgid ""
"This resource was imported, so it's not editable. Change its settings in the "
"import panel and then re-import."
msgstr ""
+"Această resursă a fost importată, astfel încât nu este editabilă. Modificaţi "
+"setările din panoul de import şi apoi reimportați."
#: editor/editor_node.cpp
msgid ""
@@ -1500,6 +1541,11 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
+"Această scenă a fost importată, astfel încât modificările la acesta nu vor "
+"fi păstrate.\n"
+"Instanțarea sau moştenirea vă permite efectuarea de modificări la acesta.\n"
+"Vă rugăm să citiţi documentaţia relevantă pentru importul scene pentru a "
+"înţelege mai bine acest mod de lucru."
#: editor/editor_node.cpp
msgid ""
@@ -1507,46 +1553,50 @@ msgid ""
"Please read the documentation relevant to debugging to better understand "
"this workflow."
msgstr ""
+"Acesta este un obiect îndepărtat, astfel încât modificările la acesta nu vor "
+"fi păstrate.\n"
+"Vă rugăm să citiţi documentaţia relevantă pentru depanare pentru a înţelege "
+"mai bine acest mod de lucru."
#: editor/editor_node.cpp
msgid "Expand all properties"
-msgstr ""
+msgstr "Extinde toate proprietăţile"
#: editor/editor_node.cpp
msgid "Collapse all properties"
-msgstr ""
+msgstr "Restrânge toate proprietăţile"
#: editor/editor_node.cpp
msgid "Copy Params"
-msgstr ""
+msgstr "Copie Parametrii"
#: editor/editor_node.cpp
msgid "Paste Params"
-msgstr ""
+msgstr "Lipiţi Parametrii"
#: editor/editor_node.cpp editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Paste Resource"
-msgstr ""
+msgstr "Lipiți Resursa"
#: editor/editor_node.cpp
msgid "Copy Resource"
-msgstr ""
+msgstr "Copiați Resursa"
#: editor/editor_node.cpp
msgid "Make Built-In"
-msgstr ""
+msgstr "Faceți Încorporat"
#: editor/editor_node.cpp
msgid "Make Sub-Resources Unique"
-msgstr ""
+msgstr "Faceți Sub-Resursa Unică"
#: editor/editor_node.cpp
msgid "Open in Help"
-msgstr ""
+msgstr "Deschideți în Ajutor"
#: editor/editor_node.cpp
msgid "There is no defined scene to run."
-msgstr ""
+msgstr "Nu există nici o scenă definită pentru a execuție."
#: editor/editor_node.cpp
msgid ""
@@ -1554,6 +1604,8 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Nici o scena principala a fost definită, selectați una?\n"
+"Puteți schimba mai târziu, în \"Setări Proiect\" în categoria 'Aplicație'."
#: editor/editor_node.cpp
msgid ""
@@ -1561,6 +1613,8 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Scena selectată ’%s’ nu există, selectați una?\n"
+"PuteÈ›i schimba mai târziu în „Setări Proiect†în categoria „AplicaÈ›ieâ€."
#: editor/editor_node.cpp
msgid ""
@@ -1568,343 +1622,364 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Scena selectată ’%s’ nu este un fișier scenă, selectați una validă?\n"
+"PuteÈ›i schimba mai târziu în „Setări Proiect†în categoria „AplicaÈ›ieâ€."
#: editor/editor_node.cpp
msgid "Current scene was never saved, please save it prior to running."
msgstr ""
+"Scena curentă nu a fost salvată niciodată, salvați-o înainte de rulare."
#: editor/editor_node.cpp
msgid "Could not start subprocess!"
-msgstr ""
+msgstr "Nu s-a putut porni subprocesul!"
#: editor/editor_node.cpp
msgid "Open Scene"
-msgstr ""
+msgstr "Deschide o scenă"
#: editor/editor_node.cpp
msgid "Open Base Scene"
-msgstr ""
+msgstr "Deschide o scenă de bază"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr ""
+msgid "Quick Open Scene..."
+msgstr "Deschide o scenă rapid..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr ""
+msgid "Quick Open Script..."
+msgstr "Deschide un script rapid..."
#: editor/editor_node.cpp
msgid "Save & Close"
-msgstr ""
+msgstr "Salvează și închide"
#: editor/editor_node.cpp
msgid "Save changes to '%s' before closing?"
-msgstr ""
+msgstr "Salvează schimbările la ’%s’ înainte de ieșire?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr ""
+msgid "Save Scene As..."
+msgstr "Salvează scena ca..."
#: editor/editor_node.cpp
msgid "No"
-msgstr ""
+msgstr "Nu"
#: editor/editor_node.cpp
msgid "Yes"
-msgstr ""
+msgstr "Da"
#: editor/editor_node.cpp
msgid "This scene has never been saved. Save before running?"
-msgstr ""
+msgstr "Această scenă nu a fost salvată niciodata. Salvați înainte de rulare?"
#: editor/editor_node.cpp editor/scene_tree_dock.cpp
msgid "This operation can't be done without a scene."
-msgstr ""
+msgstr "Această operație nu se poate face fără o scenă."
#: editor/editor_node.cpp
msgid "Export Mesh Library"
-msgstr ""
+msgstr "Exportă Librăria de Mesh-uri"
#: editor/editor_node.cpp
msgid "This operation can't be done without a root node."
-msgstr ""
+msgstr "Această operațiune nu poate fi făcută fără un nod de bază."
#: editor/editor_node.cpp
msgid "Export Tile Set"
-msgstr ""
+msgstr "Exportă Setul de Plăci"
#: editor/editor_node.cpp
msgid "This operation can't be done without a selected node."
-msgstr ""
+msgstr "Această operațiune nu poate fi făcută fără un nod selectat."
#: editor/editor_node.cpp
msgid "Current scene not saved. Open anyway?"
-msgstr ""
+msgstr "Scena curentă nu este salvată. Deschizi oricum?"
#: editor/editor_node.cpp
msgid "Can't reload a scene that was never saved."
-msgstr ""
+msgstr "Nu se poate reîncărca o scenă care nu a fost salvată niciodată."
#: editor/editor_node.cpp
msgid "Revert"
-msgstr ""
+msgstr "ÃŽntoarcere"
#: editor/editor_node.cpp
msgid "This action cannot be undone. Revert anyway?"
-msgstr ""
+msgstr "Această acțiune nu poate fi recuperată. Te reîntorci oricum?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr ""
+msgid "Quick Run Scene..."
+msgstr "Execută Rapid Scena..."
#: editor/editor_node.cpp
msgid "Quit"
-msgstr ""
+msgstr "ÃŽnchidere"
#: editor/editor_node.cpp
msgid "Exit the editor?"
-msgstr ""
+msgstr "Ieși din editor?"
#: editor/editor_node.cpp
msgid "Open Project Manager?"
-msgstr ""
+msgstr "Deschizi Managerul de Proiect?"
#: editor/editor_node.cpp
msgid "Save & Quit"
-msgstr ""
+msgstr "Salvează și Închide"
#: editor/editor_node.cpp
msgid "Save changes to the following scene(s) before quitting?"
msgstr ""
+"Salvezi modificările făcute în urmatoarea(le) scenă(e) înainte să închizi?"
#: editor/editor_node.cpp
msgid "Save changes the following scene(s) before opening Project Manager?"
msgstr ""
+"Salvezi modificările făcute în urmatoarea(le) scenă(e) înainte să deschizi "
+"Managerul de Proiect?"
#: editor/editor_node.cpp
msgid ""
"This option is deprecated. Situations where refresh must be forced are now "
"considered a bug. Please report."
msgstr ""
+"Această opțiune este depreciată. Situațiile în care reînprospătarea trebuie "
+"forțată sunt acum considerate buguri. Te rugăm să raportezi."
#: editor/editor_node.cpp
msgid "Pick a Main Scene"
-msgstr ""
+msgstr "Alege o Scenă Principală"
#: editor/editor_node.cpp
msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
msgstr ""
+"Nu se poate inițializa plugin-ul la: '%s' analizarea configurației a eșuat."
#: editor/editor_node.cpp
msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
msgstr ""
+"Nu a putut fi găsit câmpul scriptului pentru plugin la: 'res://addons/%s'."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s'."
-msgstr ""
+msgstr "Nu a putut fi încărcat scriptul add-on din calea: '%s'."
#: editor/editor_node.cpp
msgid ""
"Unable to load addon script from path: '%s' Base type is not EditorPlugin."
msgstr ""
+"Nu a putut fi încărcat scriptul add-on din calea: '%s' tipul de Bază nu este "
+"EditorPlugin."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
msgstr ""
+"Nu a putut fi încărcat scriptul add-on din calea: '%s' Scriptul nu este în "
+"modul unealtă."
#: editor/editor_node.cpp
msgid ""
"Scene '%s' was automatically imported, so it can't be modified.\n"
"To make changes to it, a new inherited scene can be created."
msgstr ""
+"Scena '%s' nu a fost importată automat, deci ea nu poate fi modificată.\n"
+"Ca să poți face modificări, o nouă scenă derivată poate fi creată."
#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ugh"
-msgstr ""
+msgstr "Uh"
#: editor/editor_node.cpp
msgid ""
"Error loading scene, it must be inside the project path. Use 'Import' to "
"open the scene, then save it inside the project path."
msgstr ""
+"Eroare la încărcarea scenei, aceasta trebuie să fie în calea spre proiect. "
+"Folosește 'Importă' ca să deschizi scena, apoi salveaz-o în calea spre "
+"proiect."
#: editor/editor_node.cpp
msgid "Scene '%s' has broken dependencies:"
-msgstr ""
+msgstr "Scena '%s' are dependințe nefuncționale:"
#: editor/editor_node.cpp
msgid "Clear Recent Scenes"
-msgstr ""
+msgstr "Curăță Scenele Recente"
#: editor/editor_node.cpp
msgid "Save Layout"
-msgstr ""
+msgstr "Salvează Schema"
#: editor/editor_node.cpp
msgid "Delete Layout"
-msgstr ""
+msgstr "Șterge Schema"
#: editor/editor_node.cpp editor/import_dock.cpp
#: editor/script_create_dialog.cpp
msgid "Default"
-msgstr ""
+msgstr "Implicit"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr ""
+msgstr "Comutați între Scene"
#: editor/editor_node.cpp
msgid "%d more files or folders"
-msgstr ""
+msgstr "%d mai multe fișiere sau foldere"
#: editor/editor_node.cpp
msgid "%d more folders"
-msgstr ""
+msgstr "%d mai multe foldere"
#: editor/editor_node.cpp
msgid "%d more files"
-msgstr ""
+msgstr "%d mai multe fișiere"
#: editor/editor_node.cpp
msgid "Dock Position"
-msgstr ""
+msgstr "Poziția Dock-ului"
#: editor/editor_node.cpp
msgid "Distraction Free Mode"
-msgstr ""
+msgstr "Modul Fără Distrageri"
#: editor/editor_node.cpp
msgid "Toggle distraction-free mode."
-msgstr ""
+msgstr "Comutează modul fără distrageri."
#: editor/editor_node.cpp
msgid "Add a new scene."
-msgstr ""
+msgstr "Adaugă o nouă scenă."
#: editor/editor_node.cpp
msgid "Scene"
-msgstr ""
+msgstr "Scenă"
#: editor/editor_node.cpp
msgid "Go to previously opened scene."
-msgstr ""
+msgstr "Mergi la o scenă deschisă anterior."
#: editor/editor_node.cpp
msgid "Next tab"
-msgstr ""
+msgstr "Fila următoare"
#: editor/editor_node.cpp
msgid "Previous tab"
-msgstr ""
+msgstr "Fila anterioară"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr ""
+msgid "Filter Files..."
+msgstr "Filtrează fișierele..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
-msgstr ""
+msgstr "Operațiuni cu fișiere tip scenă."
#: editor/editor_node.cpp
msgid "New Scene"
-msgstr ""
+msgstr "Scenă Nouă"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr ""
+msgid "New Inherited Scene..."
+msgstr "Scenă Derivată Nouă..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr ""
+msgid "Open Scene..."
+msgstr "Deschide Scena..."
#: editor/editor_node.cpp
msgid "Save Scene"
-msgstr ""
+msgstr "Salvează Scena"
#: editor/editor_node.cpp
msgid "Save all Scenes"
-msgstr ""
+msgstr "Salvează toate Scenele"
#: editor/editor_node.cpp
msgid "Close Scene"
-msgstr ""
+msgstr "ÃŽnchide Scena"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Open Recent"
-msgstr ""
+msgstr "Deschide Recente"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr ""
+msgid "Convert To..."
+msgstr "Convertește În..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr ""
+msgid "MeshLibrary..."
+msgstr "Librărie_de_Structuri..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr ""
+msgid "TileSet..."
+msgstr "Set_de_Plăci..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Undo"
-msgstr ""
+msgstr "Revenire"
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp
msgid "Redo"
-msgstr ""
+msgstr "Reîntoarcere"
#: editor/editor_node.cpp
msgid "Revert Scene"
-msgstr ""
+msgstr "Restabilește Scena"
#: editor/editor_node.cpp
msgid "Miscellaneous project or scene-wide tools."
-msgstr ""
+msgstr "Proiect Divers sau unelte pentru scenă."
#: editor/editor_node.cpp
msgid "Project"
-msgstr ""
+msgstr "Proiect"
#: editor/editor_node.cpp
msgid "Project Settings"
-msgstr ""
+msgstr "Setări ale Proiectului"
#: editor/editor_node.cpp
msgid "Run Script"
-msgstr ""
+msgstr "Execută Scriptul"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export"
-msgstr ""
+msgstr "Exportare"
#: editor/editor_node.cpp
msgid "Tools"
-msgstr ""
+msgstr "Unelte"
#: editor/editor_node.cpp
msgid "Quit to Project List"
-msgstr ""
+msgstr "ÃŽnchide spre Lista Proiectului"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Debug"
-msgstr ""
+msgstr "Depanare"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
-msgstr ""
+msgstr "Lansează cu Depanare la Distanță"
#: editor/editor_node.cpp
msgid ""
"When exporting or deploying, the resulting executable will attempt to "
"connect to the IP of this computer in order to be debugged."
msgstr ""
+"Când exporți sau lansezi, executabilul rezultat va încerca să se conecteze "
+"la IP-ul acestui computer pentru a putea fi depanat."
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr ""
+msgstr "Mini Lansare cu Rețea FS"
#: editor/editor_node.cpp
msgid ""
@@ -1915,30 +1990,39 @@ msgid ""
"On Android, deploy will use the USB cable for faster performance. This "
"option speeds up testing for games with a large footprint."
msgstr ""
+"Când această opțiune este activată, exportarea sau lansarea va produce un "
+"executabil minimal.\n"
+"Sistemul de fișiere va fi furnizat de la proiect la editor prin rețea.\n"
+"Pe Android, lansarea va folosi cablul USB pentru performanță mai rapidă. "
+"Această opțiune accelerează testarea jocurilor cu o marime substanțială."
#: editor/editor_node.cpp
msgid "Visible Collision Shapes"
-msgstr ""
+msgstr "Forme de Coliziune Vizibile"
#: editor/editor_node.cpp
msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
+"Formele de coliziune si nodurile raycast (pentru 2D și 3D) vor fi vizibile "
+"când jocul rulează dacă această opțiune este activată."
#: editor/editor_node.cpp
msgid "Visible Navigation"
-msgstr ""
+msgstr "Navigare Vizibilă"
#: editor/editor_node.cpp
msgid ""
"Navigation meshes and polygons will be visible on the running game if this "
"option is turned on."
msgstr ""
+"Structurile de navigare și poligoanele vor fi vizibile când jocul rulează "
+"dacă această opțiune este activată."
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr ""
+msgstr "Sincronizează Modificările Scenei"
#: editor/editor_node.cpp
msgid ""
@@ -1947,10 +2031,14 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
+"Când această opțiune este activată, orice modificare facută în scenă din "
+"editor va fi replicată în jocul care rulează.\n"
+"Când această opțiune este folosită de la distanță pe un dispozitiv, este "
+"mult mai eficient dacă este folosit un sistem de fișiere în rețea."
#: editor/editor_node.cpp
msgid "Sync Script Changes"
-msgstr ""
+msgstr "Sincronizează Modificările Scriptului"
#: editor/editor_node.cpp
msgid ""
@@ -1959,850 +2047,861 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
+"Când această opțiune este activată, orice script salvat ulterior va fi "
+"reîncărcat în jocul care rulează.\n"
+"Când această opțiune este folosită de la distanță pe un dispozitiv, este "
+"mult mai eficient dacă este folosit un sistem de fișiere în rețea."
#: editor/editor_node.cpp
msgid "Editor"
-msgstr ""
+msgstr "Editor"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
-msgstr ""
+msgstr "Setări ale Editorului"
#: editor/editor_node.cpp
msgid "Editor Layout"
-msgstr ""
+msgstr "Schema Editorului"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
-msgstr ""
+msgstr "Comută în Ecran Complet"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
-msgstr ""
+msgstr "Administrează Șabloanele de Export"
#: editor/editor_node.cpp
msgid "Help"
-msgstr ""
+msgstr "Ajutor"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Classes"
-msgstr ""
+msgstr "Clase"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
#: editor/plugins/shader_editor_plugin.cpp editor/project_settings_editor.cpp
msgid "Search"
-msgstr ""
+msgstr "Căutare"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Online Docs"
-msgstr ""
+msgstr "Documentație Online"
#: editor/editor_node.cpp
msgid "Q&A"
-msgstr ""
+msgstr "Întrebări și Răspunsuri"
#: editor/editor_node.cpp
msgid "Issue Tracker"
-msgstr ""
+msgstr "Agent de Monitorizare al Problemelor"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
msgid "Community"
-msgstr ""
+msgstr "Comunitate"
#: editor/editor_node.cpp
msgid "About"
-msgstr ""
+msgstr "Despre"
#: editor/editor_node.cpp
msgid "Play the project."
-msgstr ""
+msgstr "Rulează proiectul."
#: editor/editor_node.cpp
msgid "Play"
-msgstr ""
+msgstr "Rulează"
#: editor/editor_node.cpp
msgid "Pause the scene"
-msgstr ""
+msgstr "ÃŽntrerupe scena"
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr ""
+msgstr "Întrerupere Scenă"
#: editor/editor_node.cpp
msgid "Stop the scene."
-msgstr ""
+msgstr "Oprește scena."
#: editor/editor_node.cpp
msgid "Stop"
-msgstr ""
+msgstr "Oprește"
#: editor/editor_node.cpp
msgid "Play the edited scene."
-msgstr ""
+msgstr "Rulează scena editată."
#: editor/editor_node.cpp
msgid "Play Scene"
-msgstr ""
+msgstr "Rulează Scena"
#: editor/editor_node.cpp
msgid "Play custom scene"
-msgstr ""
+msgstr "Rulează scena personalizată"
#: editor/editor_node.cpp
msgid "Play Custom Scene"
-msgstr ""
+msgstr "Rulează Scena Personalizată"
#: editor/editor_node.cpp
msgid "Spins when the editor window repaints!"
-msgstr ""
+msgstr "Se rotește când ferestra editorului se recolorează!"
#: editor/editor_node.cpp
msgid "Update Always"
-msgstr ""
+msgstr "Actualizează Întotdeauna"
#: editor/editor_node.cpp
msgid "Update Changes"
-msgstr ""
+msgstr "Modificări ale Actualizării"
#: editor/editor_node.cpp
msgid "Disable Update Spinner"
-msgstr ""
+msgstr "Dezactivează Cercul de Actualizare"
#: editor/editor_node.cpp
msgid "Inspector"
-msgstr ""
+msgstr "Inspector"
#: editor/editor_node.cpp
msgid "Create a new resource in memory and edit it."
-msgstr ""
+msgstr "Creează o nouă resursă în memorie și editeaz-o."
#: editor/editor_node.cpp
msgid "Load an existing resource from disk and edit it."
-msgstr ""
+msgstr "Încarcă o resursă existentă de pe disc si editeaz-o."
#: editor/editor_node.cpp
msgid "Save the currently edited resource."
-msgstr ""
+msgstr "Salvează resursa editată curentă."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr ""
+msgid "Save As..."
+msgstr "Salvează Ca..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
-msgstr ""
+msgstr "Mergi la un obiect din istoric editat anterior."
#: editor/editor_node.cpp
msgid "Go to the next edited object in history."
-msgstr ""
+msgstr "Mergi la următorul obiect editat din istoric."
#: editor/editor_node.cpp
msgid "History of recently edited objects."
-msgstr ""
+msgstr "Istoricul obiectelor editate recent."
#: editor/editor_node.cpp
msgid "Object properties."
-msgstr ""
+msgstr "Proprietățile obiectului."
#: editor/editor_node.cpp
msgid "Changes may be lost!"
-msgstr ""
+msgstr "Modificările pot fi pierdute!"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Import"
-msgstr ""
+msgstr "Importă"
#: editor/editor_node.cpp
msgid "Node"
-msgstr ""
+msgstr "Nod"
#: editor/editor_node.cpp
msgid "FileSystem"
-msgstr ""
+msgstr "Sistemul De Fișiere"
#: editor/editor_node.cpp
msgid "Output"
-msgstr ""
+msgstr "Ieșire"
#: editor/editor_node.cpp
msgid "Don't Save"
-msgstr ""
+msgstr "Nu Salva"
#: editor/editor_node.cpp
msgid "Import Templates From ZIP File"
-msgstr ""
+msgstr "Importă Șabloane Dintr-o Arhivă ZIP"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export Project"
-msgstr ""
+msgstr "Exportă Proiectul"
#: editor/editor_node.cpp
msgid "Export Library"
-msgstr ""
+msgstr "Exportă Librăria"
#: editor/editor_node.cpp
msgid "Merge With Existing"
-msgstr ""
+msgstr "Contopește Cu Existentul"
#: editor/editor_node.cpp
msgid "Password:"
-msgstr ""
+msgstr "Parola:"
#: editor/editor_node.cpp
msgid "Open & Run a Script"
-msgstr ""
+msgstr "Deschide și Execută un Script"
#: editor/editor_node.cpp
msgid "New Inherited"
-msgstr ""
+msgstr "Derivare Nouă"
#: editor/editor_node.cpp
msgid "Load Errors"
-msgstr ""
+msgstr "Încarcă Erorile"
#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Select"
-msgstr ""
+msgstr "Selectează"
#: editor/editor_node.cpp
msgid "Open 2D Editor"
-msgstr ""
+msgstr "Deschide Editorul 2D"
#: editor/editor_node.cpp
msgid "Open 3D Editor"
-msgstr ""
+msgstr "Deschide Editorul 3D"
#: editor/editor_node.cpp
msgid "Open Script Editor"
-msgstr ""
+msgstr "Deschide Editorul de Scripturi"
#: editor/editor_node.cpp editor/project_manager.cpp
msgid "Open Asset Library"
-msgstr ""
+msgstr "Deschide Librăria de Asseturi"
#: editor/editor_node.cpp
msgid "Open the next Editor"
-msgstr ""
+msgstr "Deschide Editorul următor"
#: editor/editor_node.cpp
msgid "Open the previous Editor"
-msgstr ""
+msgstr "Deschide Editorul anterior"
#: editor/editor_plugin.cpp
msgid "Creating Mesh Previews"
-msgstr ""
+msgstr "Se creează Previzualizările Mesh-ului"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr ""
+msgid "Thumbnail..."
+msgstr "Miniatură..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
-msgstr ""
+msgstr "Pluginuri instalate:"
#: editor/editor_plugin_settings.cpp
msgid "Update"
-msgstr ""
+msgstr "Actualizare"
#: editor/editor_plugin_settings.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Version:"
-msgstr ""
+msgstr "Versiune:"
#: editor/editor_plugin_settings.cpp
msgid "Author:"
-msgstr ""
+msgstr "Autor:"
#: editor/editor_plugin_settings.cpp
msgid "Status:"
-msgstr ""
+msgstr "Stare:"
#: editor/editor_profiler.cpp
msgid "Stop Profiling"
-msgstr ""
+msgstr "Oprește Profilarea"
#: editor/editor_profiler.cpp
msgid "Start Profiling"
-msgstr ""
+msgstr "Pornește Profilarea"
#: editor/editor_profiler.cpp
msgid "Measure:"
-msgstr ""
+msgstr "Măsura:"
#: editor/editor_profiler.cpp
msgid "Frame Time (sec)"
-msgstr ""
+msgstr "Timpul Cadrului (sec)"
#: editor/editor_profiler.cpp
msgid "Average Time (sec)"
-msgstr ""
+msgstr "Media Timpului (sec)"
#: editor/editor_profiler.cpp
msgid "Frame %"
-msgstr ""
+msgstr "Cadru %"
#: editor/editor_profiler.cpp
msgid "Physics Frame %"
-msgstr ""
+msgstr "Cadru Fizic %"
#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
msgid "Time:"
-msgstr ""
+msgstr "Timp:"
#: editor/editor_profiler.cpp
msgid "Inclusive"
-msgstr ""
+msgstr "Inclusiv"
#: editor/editor_profiler.cpp
msgid "Self"
-msgstr ""
+msgstr "Propriu"
#: editor/editor_profiler.cpp
msgid "Frame #:"
-msgstr ""
+msgstr "Cadru #:"
#: editor/editor_profiler.cpp
msgid "Time"
-msgstr ""
+msgstr "Timp"
#: editor/editor_profiler.cpp
msgid "Calls"
-msgstr ""
+msgstr "Apeluri"
#: editor/editor_run_native.cpp
msgid "Select device from the list"
-msgstr ""
+msgstr "Selectează un dispozitiv din listă"
#: editor/editor_run_native.cpp
msgid ""
"No runnable export preset found for this platform.\n"
"Please add a runnable preset in the export menu."
msgstr ""
+"Nu a fost găsită nicio presetare de export care să poată rula pentru această "
+"platformă.\n"
+"Te rog adaugă o presetare de rulare în meniul pentru export."
#: editor/editor_run_script.cpp
msgid "Write your logic in the _run() method."
-msgstr ""
+msgstr "Scrie logica programului în metoda _run()."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
-msgstr ""
+msgstr "Acolo este o scenă deja editată."
#: editor/editor_run_script.cpp
msgid "Couldn't instance script:"
-msgstr ""
+msgstr "Nu s-a putut inițializa scriptul:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
-msgstr ""
+msgstr "Ai uitat cumva cuvântul 'unealtă'?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
-msgstr ""
+msgstr "Nu a putut fi executat scriptul:"
#: editor/editor_run_script.cpp
msgid "Did you forget the '_run' method?"
-msgstr ""
+msgstr "Ai uitat cumva metoda '_run' ?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
-msgstr ""
+msgstr "Implicit (Asemănător ca Editor)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
-msgstr ""
+msgstr "Selectează Nodul(rile) pentru Importare"
#: editor/editor_sub_scene.cpp
msgid "Scene Path:"
-msgstr ""
+msgstr "Calea Scenei:"
#: editor/editor_sub_scene.cpp
msgid "Import From Node:"
-msgstr ""
+msgstr "Importă Din Nod:"
#: editor/export_template_manager.cpp
msgid "Re-Download"
-msgstr ""
+msgstr "Descarcă din nou"
#: editor/export_template_manager.cpp
msgid "Uninstall"
-msgstr ""
+msgstr "Dezinstalează"
#: editor/export_template_manager.cpp
msgid "(Installed)"
-msgstr ""
+msgstr "(Instalat)"
#: editor/export_template_manager.cpp
msgid "Download"
-msgstr ""
+msgstr "Descarcă"
#: editor/export_template_manager.cpp
msgid "(Missing)"
-msgstr ""
+msgstr "(Lipsește)"
#: editor/export_template_manager.cpp
msgid "(Current)"
-msgstr ""
+msgstr "(Curent)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr ""
+msgid "Retrieving mirrors, please wait..."
+msgstr "Se recuperează oglinzile, te rog așteaptă..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
-msgstr ""
+msgstr "Elimini șablonul versiunea '%s'?"
#: editor/export_template_manager.cpp
msgid "Can't open export templates zip."
-msgstr ""
+msgstr "Nu se pot deschide șabloanele de export zip."
#: editor/export_template_manager.cpp
msgid "Invalid version.txt format inside templates."
-msgstr ""
-
-#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
+msgstr "Format nevalid versiune.txt în șabloane."
#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
-msgstr ""
+msgstr "Nu s-a găsit versiune.txt în șabloane."
#: editor/export_template_manager.cpp
msgid "Error creating path for templates:"
-msgstr ""
+msgstr "Eroare la crearea căii pentru șabloane:"
#: editor/export_template_manager.cpp
msgid "Extracting Export Templates"
-msgstr ""
+msgstr "Se extrag Șabloanele de Export"
#: editor/export_template_manager.cpp
msgid "Importing:"
-msgstr ""
+msgstr "Se importă:"
#: editor/export_template_manager.cpp
msgid ""
"No download links found for this version. Direct download is only available "
"for official releases."
msgstr ""
+"Niciun link pentru descărcare nu a fost găsit pentru această versiune. "
+"Descărcarea directă este disponibilă numai pentru lansări oficiale."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve."
-msgstr ""
+msgstr "Nu se poate rezolva."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't connect."
-msgstr ""
+msgstr "Nu se poate face conexiunea."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No response."
-msgstr ""
+msgstr "Niciun răspuns."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request Failed."
-msgstr ""
+msgstr "Cerere Eșuată."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Redirect Loop."
-msgstr ""
+msgstr "Buclă de Redirecționare."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Failed:"
-msgstr ""
+msgstr "A Eșuat:"
#: editor/export_template_manager.cpp
msgid "Download Complete."
-msgstr ""
+msgstr "Descărcare Completă."
#: editor/export_template_manager.cpp
msgid "Error requesting url: "
-msgstr ""
+msgstr "Eroare la solicitarea URL: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr ""
+msgid "Connecting to Mirror..."
+msgstr "Se conectează la Oglinda..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
-msgstr ""
+msgstr "Deconectat"
#: editor/export_template_manager.cpp
msgid "Resolving"
-msgstr ""
+msgstr "Se Soluționează"
#: editor/export_template_manager.cpp
msgid "Can't Resolve"
-msgstr ""
+msgstr "Nu se poate Soluționa"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr ""
+msgid "Connecting..."
+msgstr "Conectare..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
-msgstr ""
+msgstr "Nu se poate Conecta"
#: editor/export_template_manager.cpp
msgid "Connected"
-msgstr ""
+msgstr "Conectat"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr ""
+msgid "Requesting..."
+msgstr "Se Solicită..."
#: editor/export_template_manager.cpp
msgid "Downloading"
-msgstr ""
+msgstr "Se Descarcă"
#: editor/export_template_manager.cpp
msgid "Connection Error"
-msgstr ""
+msgstr "Eroare de Conexiune"
#: editor/export_template_manager.cpp
msgid "SSL Handshake Error"
-msgstr ""
+msgstr "Eroare SSL Handshake"
#: editor/export_template_manager.cpp
msgid "Current Version:"
-msgstr ""
+msgstr "Versiune Curentă:"
#: editor/export_template_manager.cpp
msgid "Installed Versions:"
-msgstr ""
+msgstr "Versiuni Instalate:"
#: editor/export_template_manager.cpp
msgid "Install From File"
-msgstr ""
+msgstr "Instalează Din Fișier"
#: editor/export_template_manager.cpp
msgid "Remove Template"
-msgstr ""
+msgstr "Elimină Șablon"
#: editor/export_template_manager.cpp
msgid "Select template file"
-msgstr ""
+msgstr "Selectează fișierul șablon"
#: editor/export_template_manager.cpp
msgid "Export Template Manager"
-msgstr ""
+msgstr "Exportă Managerul de Șabloane"
#: editor/export_template_manager.cpp
msgid "Download Templates"
-msgstr ""
+msgstr "Descarcă Șabloane"
#: editor/export_template_manager.cpp
msgid "Select mirror from list: "
-msgstr ""
+msgstr "Selectează oglinda din listă: "
#: editor/file_type_cache.cpp
msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
msgstr ""
+"Nu se poate deschide file_type_cache.cch pentru scriere, nu se salvează "
+"fișierul tip cache!"
#: editor/filesystem_dock.cpp
msgid "Cannot navigate to '%s' as it has not been found in the file system!"
msgstr ""
+"Nu se poate naviga către '%s' pentru că nu a fost găsit în sistemul de "
+"fișiere!"
#: editor/filesystem_dock.cpp
msgid "View items as a grid of thumbnails"
-msgstr ""
+msgstr "Vizualizează articolele ca și o grilă de miniaturi"
#: editor/filesystem_dock.cpp
msgid "View items as a list"
-msgstr ""
+msgstr "Vizualizează articolele ca și o listă"
#: editor/filesystem_dock.cpp
msgid "Status: Import of file failed. Please fix file and reimport manually."
msgstr ""
+"Stare: Importarea fișierului eșuată. Te rog repară fișierul și reimportă "
+"manual."
#: editor/filesystem_dock.cpp
msgid "Cannot move/rename resources root."
-msgstr ""
+msgstr "Nu se poate muta/redenumi rădăcina resurselor."
#: editor/filesystem_dock.cpp
msgid "Cannot move a folder into itself."
-msgstr ""
+msgstr "Nu se poate muta un director în el însuși."
#: editor/filesystem_dock.cpp
msgid "Error moving:"
-msgstr ""
+msgstr "Eroare mutând:"
#: editor/filesystem_dock.cpp
msgid "Error duplicating:"
-msgstr ""
+msgstr "Eroare duplicând:"
#: editor/filesystem_dock.cpp
msgid "Unable to update dependencies:"
-msgstr ""
+msgstr "Imposibil de actualizat dependințele:"
#: editor/filesystem_dock.cpp
msgid "No name provided"
-msgstr ""
+msgstr "Niciun nume furnizat"
#: editor/filesystem_dock.cpp
msgid "Provided name contains invalid characters"
-msgstr ""
+msgstr "Numele furnizat conține caractere nevalide"
#: editor/filesystem_dock.cpp
msgid "No name provided."
-msgstr ""
+msgstr "Niciun nume furnizat."
#: editor/filesystem_dock.cpp
msgid "Name contains invalid characters."
-msgstr ""
+msgstr "Numele furnizat conține caractere nevalide."
#: editor/filesystem_dock.cpp
msgid "A file or folder with this name already exists."
-msgstr ""
+msgstr "Un fișier sau un director cu acest nume există deja."
#: editor/filesystem_dock.cpp
msgid "Renaming file:"
-msgstr ""
+msgstr "Redenumind fișierul:"
#: editor/filesystem_dock.cpp
msgid "Renaming folder:"
-msgstr ""
+msgstr "Redenumind directorul:"
#: editor/filesystem_dock.cpp
msgid "Duplicating file:"
-msgstr ""
+msgstr "Duplicând fișierul:"
#: editor/filesystem_dock.cpp
msgid "Duplicating folder:"
-msgstr ""
+msgstr "Duplicând directorul:"
#: editor/filesystem_dock.cpp
msgid "Expand all"
-msgstr ""
+msgstr "Extinde toate"
#: editor/filesystem_dock.cpp
msgid "Collapse all"
-msgstr ""
+msgstr "Restrânge toate"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr ""
+msgid "Rename..."
+msgstr "Redenumește..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr ""
+msgid "Move To..."
+msgstr "Mută În..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
-msgstr ""
+msgstr "Deschide Scena(ele)"
#: editor/filesystem_dock.cpp
msgid "Instance"
-msgstr ""
+msgstr "Instanță"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr ""
+msgid "Edit Dependencies..."
+msgstr "Editează Dependințele..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr ""
+msgid "View Owners..."
+msgstr "Vizualizează Proprietarii..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr ""
+msgid "Duplicate..."
+msgstr "Duplicați..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
-msgstr ""
+msgstr "Directorul Anterior"
#: editor/filesystem_dock.cpp
msgid "Next Directory"
-msgstr ""
+msgstr "Directorul Urmator"
#: editor/filesystem_dock.cpp
msgid "Re-Scan Filesystem"
-msgstr ""
+msgstr "Rescanează Sistemul de Fișiere"
#: editor/filesystem_dock.cpp
msgid "Toggle folder status as Favorite"
-msgstr ""
+msgstr "Marchează statutul directorului ca Favorit"
#: editor/filesystem_dock.cpp
msgid "Instance the selected scene(s) as child of the selected node."
-msgstr ""
+msgstr "Instanțiază scena(ele) selectată ca un copil al nodului selectat."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
+"Se Scanează Fișierele,\n"
+"Te Rog Așteaptă..."
#: editor/filesystem_dock.cpp
msgid "Move"
-msgstr ""
+msgstr "Mută"
#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Rename"
-msgstr ""
+msgstr "Redenumește"
#: editor/groups_editor.cpp
msgid "Add to Group"
-msgstr ""
+msgstr "Adaugă în Grup"
#: editor/groups_editor.cpp
msgid "Remove from Group"
-msgstr ""
+msgstr "Elimină din Grup"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Single Scene"
-msgstr ""
+msgstr "Importă ca Scenă Simplă"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Animations"
-msgstr ""
+msgstr "Importă cu Animații Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
-msgstr ""
+msgstr "Importă cu Materiale Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects"
-msgstr ""
+msgstr "Importă cu Obiecte Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials"
-msgstr ""
+msgstr "Importă cu Obiecte+Materiale Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Animations"
-msgstr ""
+msgstr "Importă cu Obiecte+Animații Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials+Animations"
-msgstr ""
+msgstr "Importă cu Materiale+Animații Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials+Animations"
-msgstr ""
+msgstr "Importă cu Obiecte+Materiale+Animații Separate"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes"
-msgstr ""
+msgstr "Importă ca Scene Multiple"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes+Materials"
-msgstr ""
+msgstr "Importă ca Scene+Materiale Multiple"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import Scene"
-msgstr ""
+msgstr "Importă Scena"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr ""
+msgid "Importing Scene..."
+msgstr "Se Importa Scena..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
-msgstr ""
+msgstr "Se Genereaza Lightmaps"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
-msgstr ""
+msgstr "Se Generează pentru Mesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr ""
+msgid "Running Custom Script..."
+msgstr "Se Execută un Script Personalizat..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
-msgstr ""
+msgstr "Nu s-a putut încărca scriptul post-importare:"
#: editor/import/resource_importer_scene.cpp
msgid "Invalid/broken script for post-import (check console):"
-msgstr ""
+msgstr "Script nevalid/nefuncțional pentru post-importare (vezi consola):"
#: editor/import/resource_importer_scene.cpp
msgid "Error running post-import script:"
-msgstr ""
+msgstr "Eroare la executarea scripyului post-importare:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr ""
+msgid "Saving..."
+msgstr "Se Salvează..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
-msgstr ""
+msgstr "Setează ca Implicit pentru '%s'"
#: editor/import_dock.cpp
msgid "Clear Default for '%s'"
-msgstr ""
+msgstr "Curăță setarea Implicită pentru '%s'"
#: editor/import_dock.cpp
msgid " Files"
-msgstr ""
+msgstr " Fișiere"
#: editor/import_dock.cpp
msgid "Import As:"
-msgstr ""
+msgstr "Importă Ca:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr ""
+msgid "Preset..."
+msgstr "Presetare..."
#: editor/import_dock.cpp
msgid "Reimport"
-msgstr ""
+msgstr "Reimportă"
#: editor/multi_node_edit.cpp
msgid "MultiNode Set"
-msgstr ""
+msgstr "Set MultiNod"
#: editor/node_dock.cpp
msgid "Groups"
-msgstr ""
+msgstr "Grupuri"
#: editor/node_dock.cpp
msgid "Select a Node to edit Signals and Groups."
-msgstr ""
+msgstr "Selectează un Nod pentru a edita Semnalele și Grupurile."
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Poly"
-msgstr ""
+msgstr "Crează Poligon"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly"
-msgstr ""
+msgstr "Editează Poligon"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Insert Point"
-msgstr ""
+msgstr "Inserează Punct"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly (Remove Point)"
-msgstr ""
+msgstr "Editează Poligon (Elimină Punct)"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Remove Poly And Point"
-msgstr ""
+msgstr "Elimină Poligon Și Punct"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Create a new polygon from scratch"
-msgstr ""
+msgstr "Crează un nou poligon de la zero"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid ""
@@ -2811,522 +2910,526 @@ msgid ""
"Ctrl+LMB: Split Segment.\n"
"RMB: Erase Point."
msgstr ""
+"Editează poligon existent:\n"
+"LMB: Mută Punct.\n"
+"Ctrl+LMB: Despică Segment.\n"
+"RMB: Șterge Punct."
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Delete points"
-msgstr ""
+msgstr "Șterge puncte"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Toggle Autoplay"
-msgstr ""
+msgstr "Comutează Auto-Execuție"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Animation Name:"
-msgstr ""
+msgstr "Nume Nou Animație:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Anim"
-msgstr ""
+msgstr "Anim Nouă"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Animation Name:"
-msgstr ""
+msgstr "Schimbă Numele Animației:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Delete Animation?"
-msgstr ""
+msgstr "Ștergi Animația?"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Remove Animation"
-msgstr ""
+msgstr "Elimină Animația"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Invalid animation name!"
-msgstr ""
+msgstr "EROARE: Nume animație nevalid!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Animation name already exists!"
-msgstr ""
+msgstr "EROARE: Numele animației există deja!"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Rename Animation"
-msgstr ""
+msgstr "Redenumește Animația"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Animation"
-msgstr ""
+msgstr "Adaugă Animația"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Next Changed"
-msgstr ""
+msgstr "Amestecă Următoarea Schimbare"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Blend Time"
-msgstr ""
+msgstr "Schimbă Timpul Amestecului"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load Animation"
-msgstr ""
+msgstr "Încarcă Animație"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Duplicate Animation"
-msgstr ""
+msgstr "Duplicare Animație"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to copy!"
-msgstr ""
+msgstr "EROARE: Nicio copie a animației!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation resource on clipboard!"
-msgstr ""
+msgstr "EROARE: Nicio resursă de animație în clipboard!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Pasted Animation"
-msgstr ""
+msgstr "Animație Lipită"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Paste Animation"
-msgstr ""
+msgstr "Lipește Animație"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to edit!"
-msgstr ""
+msgstr "EROARE: Nicio animație pentru editare!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from current pos. (A)"
-msgstr ""
+msgstr "Rulează animația selectată în sens invers de la poziția curentă. (A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from end. (Shift+A)"
-msgstr ""
+msgstr "Rulează animația selectată în sens invers de la sfârșit. (Shift+A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Stop animation playback. (S)"
-msgstr ""
+msgstr "Oprește rularea animației. (S)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from start. (Shift+D)"
-msgstr ""
+msgstr "Rulează animația selectată de la început. (Shift+D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from current pos. (D)"
-msgstr ""
+msgstr "Rulează animația selectată de la poziția curentă. (D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation position (in seconds)."
-msgstr ""
+msgstr "Poziția animației (în secunde)."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Scale animation playback globally for the node."
-msgstr ""
+msgstr "Redimensionează rularea animației pentru nod."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create new animation in player."
-msgstr ""
+msgstr "Creează o nouă animație în player."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load animation from disk."
-msgstr ""
+msgstr "Încarcă animație de pe disc."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load an animation from disk."
-msgstr ""
+msgstr "Încarcă o animație de pe disc."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Save the current animation"
-msgstr ""
+msgstr "Salvează actuala animație"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Display list of animations in player."
-msgstr ""
+msgstr "Afișează o listă a animațiilor în player."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Autoplay on Load"
-msgstr ""
+msgstr "Auto-Execută la Încărcare"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Edit Target Blend Times"
-msgstr ""
+msgstr "Editează Timpul de Amestecare al Țintei"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Tools"
-msgstr ""
+msgstr "Unelte Animație"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Copy Animation"
-msgstr ""
+msgstr "Copiză Animație"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Onion Skinning"
-msgstr ""
+msgstr "Onion Skinning"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Enable Onion Skinning"
-msgstr ""
+msgstr "Activează Onion Skinning"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Directions"
-msgstr ""
+msgstr "Direcții"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Past"
-msgstr ""
+msgstr "Trecut"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Future"
-msgstr ""
+msgstr "Viitor"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Depth"
-msgstr ""
+msgstr "Adâncime"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "1 step"
-msgstr ""
+msgstr "1 pas"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "2 steps"
-msgstr ""
+msgstr "2 pași"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "3 steps"
-msgstr ""
+msgstr "3 pași"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Differences Only"
-msgstr ""
+msgstr "Doar Diferențe"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Force White Modulate"
-msgstr ""
+msgstr "Forțează Modulare Albă"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Include Gizmos (3D)"
-msgstr ""
+msgstr "Include Gizmos (3D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create New Animation"
-msgstr ""
+msgstr "Creează Animație Nouă"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Name:"
-msgstr ""
+msgstr "Nume Animație:"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Error!"
-msgstr ""
+msgstr "Eroare!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Times:"
-msgstr ""
+msgstr "Timpi de Amestecare:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Next (Auto Queue):"
-msgstr ""
+msgstr "Următorul (Rând Automat):"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Cross-Animation Blend Times"
-msgstr ""
+msgstr "Timpi de Amestecare Cross-Animație"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Animation"
-msgstr ""
+msgstr "Animație"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "New name:"
-msgstr ""
+msgstr "Nume nou:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Filters"
-msgstr ""
+msgstr "Editează Filtrele"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Scale:"
-msgstr ""
+msgstr "Dimensiune:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Fade In (s):"
-msgstr ""
+msgstr "Estompează (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Fade Out (s):"
-msgstr ""
+msgstr "Reliefează (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend"
-msgstr ""
+msgstr "Amestec"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix"
-msgstr ""
+msgstr "Mix"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Auto Restart:"
-msgstr ""
+msgstr "Restartare Automată:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Restart (s):"
-msgstr ""
+msgstr "Restartare (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Random Restart (s):"
-msgstr ""
+msgstr "Restartare Aleatorie (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Start!"
-msgstr ""
+msgstr "Start!"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Amount:"
-msgstr ""
+msgstr "Cantitate:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend:"
-msgstr ""
+msgstr "Amestec:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend 0:"
-msgstr ""
+msgstr "Amestec 0:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend 1:"
-msgstr ""
+msgstr "Amestec 1:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "X-Fade Time (s):"
-msgstr ""
+msgstr "Timp X-Decolorare (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Current:"
-msgstr ""
+msgstr "Curent:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Add Input"
-msgstr ""
+msgstr "Adaugă Intrare(Input)"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Clear Auto-Advance"
-msgstr ""
+msgstr "Curăță Auto-Avansarea"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Set Auto-Advance"
-msgstr ""
+msgstr "Setează Auto-Avansare"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Delete Input"
-msgstr ""
+msgstr "Șterge Intrare(Input)"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation tree is valid."
-msgstr ""
+msgstr "Arborele Animației este valid."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation tree is invalid."
-msgstr ""
+msgstr "Arborele Animației este nevalid."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation Node"
-msgstr ""
+msgstr "Nod de Animație"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "OneShot Node"
-msgstr ""
+msgstr "Nod OneShot"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix Node"
-msgstr ""
+msgstr "Nod de Amestecare"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend2 Node"
-msgstr ""
+msgstr "Nod Amestec2"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend3 Node"
-msgstr ""
+msgstr "Nod Amestec3"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend4 Node"
-msgstr ""
+msgstr "Nod Amestec4"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeScale Node"
-msgstr ""
+msgstr "Nod DimensiuneTimp"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeSeek Node"
-msgstr ""
+msgstr "Nod CăutareTimp"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Transition Node"
-msgstr ""
+msgstr "Nod Tranziție"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr ""
+msgid "Import Animations..."
+msgstr "Importă Animații..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
-msgstr ""
+msgstr "Editează Filtrele Nodurilor"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr ""
+msgid "Filters..."
+msgstr "Filtre..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
-msgstr ""
+msgstr "ArboreAnimație"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
-msgstr ""
+msgstr "Gratuit"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Contents:"
-msgstr ""
+msgstr "Conținut:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "View Files"
-msgstr ""
+msgstr "Vizualizează Fișierele"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve hostname:"
-msgstr ""
+msgstr "Nu se poate rezolva numele gazdei:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Connection error, please try again."
-msgstr ""
+msgstr "Eroare la conectare, te rog încearcă din nou."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't connect to host:"
-msgstr ""
+msgstr "Nu se poate conecta la gazda:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No response from host:"
-msgstr ""
+msgstr "Nciun răspuns de la gazda:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request failed, return code:"
-msgstr ""
+msgstr "Cerere eșuată, cod returnat:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request failed, too many redirects"
-msgstr ""
+msgstr "Cerere eșuată, prea multe redirecționări"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Bad download hash, assuming file has been tampered with."
-msgstr ""
+msgstr "Hash eronat de descărcare, se presupune că fișierul este falsificat."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Expected:"
-msgstr ""
+msgstr "Așteptat:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Got:"
-msgstr ""
+msgstr "Primit:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Failed sha256 hash check"
-msgstr ""
+msgstr "Verificare hash sha256 eșuată"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Asset Download Error:"
-msgstr ""
+msgstr "Eroare la Descărcarea Asset-ului:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Fetching:"
-msgstr ""
+msgstr "Se Preia(u):"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr ""
+msgid "Resolving..."
+msgstr "Se Rezolvă..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
-msgstr ""
+msgstr "Eroare la solicitare"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Idle"
-msgstr ""
+msgstr "Inactiv"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Retry"
-msgstr ""
+msgstr "Reîncearcă"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download Error"
-msgstr ""
+msgstr "Eroare Descărcare"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Download for this asset is already in progress!"
-msgstr ""
+msgstr "Descărcarea acestui asset rulează deja!"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "first"
-msgstr ""
+msgstr "primul"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "prev"
-msgstr ""
+msgstr "anterior"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "next"
-msgstr ""
+msgstr "următorul"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "last"
-msgstr ""
+msgstr "ultimul"
#: editor/plugins/asset_library_editor_plugin.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "All"
-msgstr ""
+msgstr "Toate"
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_settings_editor.cpp
msgid "Plugins"
-msgstr ""
+msgstr "Plugin-uri"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Sort:"
-msgstr ""
+msgstr "Sorare:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Reverse"
-msgstr ""
+msgstr "Revers"
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_settings_editor.cpp
msgid "Category:"
-msgstr ""
+msgstr "Categorie:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Site:"
-msgstr ""
+msgstr "Site:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr ""
+msgid "Support..."
+msgstr "Suport..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
-msgstr ""
+msgstr "Oficial"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Testing"
-msgstr ""
+msgstr "Se Testează"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Assets ZIP File"
-msgstr ""
+msgstr "Fișier ZIP cu Asset-uri"
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
@@ -3334,135 +3437,144 @@ msgid ""
"Save your scene (for images to be saved in the same dir), or pick a save "
"path from the BakedLightmap properties."
msgstr ""
+"Nu se poate determina p cale de salvare pentru imaginile lightmap.\n"
+"Salvează scena (imaginile vor fi salvate în acelasi director), sau alege o "
+"cale de salvare din proprietățile BakedLightmap."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid ""
"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
"Light' flag is on."
msgstr ""
+"Nicio structură pentru procesare. Asigură-te că acestea conțin un canal UV2 "
+"și că opțiunea 'Procesează Lumina' este pornită."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
msgstr ""
+"Crearea imaginilor lightmap eșuată, asigură-te că poate fi scrisă calea spre "
+"ele."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Bake Lightmaps"
-msgstr ""
+msgstr "Procesează Lightmaps"
#: editor/plugins/camera_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Preview"
-msgstr ""
+msgstr "Previzualizare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Configure Snap"
-msgstr ""
+msgstr "Configurare Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid Offset:"
-msgstr ""
+msgstr "Compensare Grilă:"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid Step:"
-msgstr ""
+msgstr "Pas Grilă:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation Offset:"
-msgstr ""
+msgstr "Compensare Rotație:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotation Step:"
-msgstr ""
+msgstr "Pas Rotație:"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Pivot"
-msgstr ""
+msgstr "Mută Pivot"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Action"
-msgstr ""
+msgstr "Acțiune de Mutare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move vertical guide"
-msgstr ""
+msgstr "Mută ghidul vertical"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Create new vertical guide"
-msgstr ""
+msgstr "Creează un nou ghid vertical"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Remove vertical guide"
-msgstr ""
+msgstr "Elimină ghidul vertical"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move horizontal guide"
-msgstr ""
+msgstr "Mută ghidul orizontal"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Create new horizontal guide"
-msgstr ""
+msgstr "Creează un nou ghid orizontal"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Remove horizontal guide"
-msgstr ""
+msgstr "Elimină ghidul orizontal"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Create new horizontal and vertical guides"
-msgstr ""
+msgstr "Creează ghizi noi orizontal și vertical"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Edit IK Chain"
-msgstr ""
+msgstr "Editează Lanț IK"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Edit CanvasItem"
-msgstr ""
+msgstr "Editează ObiectulPânză"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Anchors only"
-msgstr ""
+msgstr "Doar ancore"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change Anchors and Margins"
-msgstr ""
+msgstr "Modifică Ancorele și Limitele"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change Anchors"
-msgstr ""
+msgstr "Modifică Ancorele"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Paste Pose"
-msgstr ""
+msgstr "Lipește Postura"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Select Mode"
-msgstr ""
+msgstr "Mod Selectare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Drag: Rotate"
-msgstr ""
+msgstr "Trage: Rotire"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+Drag: Move"
-msgstr ""
+msgstr "Alt+Trage: Mutare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving)."
msgstr ""
+"Apasă 'v' pentru a Schimba Pivotul, 'Shift+v' pentru a Trage Pivotul (în "
+"timpul mișcării)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+RMB: Depth list selection"
-msgstr ""
+msgstr "Alt+RMB: Selecție adâncime listă"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Mode"
-msgstr ""
+msgstr "Mod Mutare"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotate Mode"
-msgstr ""
+msgstr "Mod Rotație"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3470,547 +3582,566 @@ msgid ""
"Show a list of all objects at the position clicked\n"
"(same as Alt+RMB in select mode)."
msgstr ""
+"Arată o listă a tuturor obiectelor la poziția clickului\n"
+"(similar cu Alt+RMB în modul selectare)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Click to change object's rotation pivot."
-msgstr ""
+msgstr "Click pentru a modifica pivotul de rotație al obiectului."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Pan Mode"
-msgstr ""
+msgstr "Mod ÃŽn Jur"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Toggles snapping"
-msgstr ""
+msgstr "Comutare snapping"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Snap"
-msgstr ""
+msgstr "Utilizează Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snapping options"
-msgstr ""
+msgstr "Opțiuni Snapping"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to grid"
-msgstr ""
+msgstr "Snap pe grilă"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Rotation Snap"
-msgstr ""
+msgstr "Folosește Rotația Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr ""
+msgstr "Configurare Snap..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
-msgstr ""
+msgstr "Snap Relativ"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Pixel Snap"
-msgstr ""
+msgstr "Utilizează Pixel Snap"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Smart snapping"
-msgstr ""
+msgstr "Snapping inteligent"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to parent"
-msgstr ""
+msgstr "Snap către părinte"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node anchor"
-msgstr ""
+msgstr "Snap către ancora nodului"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to node sides"
-msgstr ""
+msgstr "Snap pe fețele nodului"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to other nodes"
-msgstr ""
+msgstr "Snap către alte noduri"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap to guides"
-msgstr ""
+msgstr "Snap pe ghizi"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Lock the selected object in place (can't be moved)."
-msgstr ""
+msgstr "Imobilizează obiectul selectat (nu poate fi mișcat)."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Unlock the selected object (can be moved)."
-msgstr ""
+msgstr "Remobilizează obiectul selectat (poate fi mișcat)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Makes sure the object's children are not selectable."
-msgstr ""
+msgstr "Asigură-te că nu pot fi selectați copiii obiectului."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Restores the object's children's ability to be selected."
-msgstr ""
+msgstr "Restaurează abilitatea copiilor obiectului de a fi selectați."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Make Bones"
-msgstr ""
+msgstr "Creează Oase"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Clear Bones"
-msgstr ""
+msgstr "Curăță Oasele"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Bones"
-msgstr ""
+msgstr "Arată Oasele"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Make IK Chain"
-msgstr ""
+msgstr "Creează Lanț IK"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Clear IK Chain"
-msgstr ""
+msgstr "Curăță Lanțul IK"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View"
-msgstr ""
+msgstr "Perspectivă"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Show Grid"
-msgstr ""
+msgstr "Arată Grila"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Helpers"
-msgstr ""
+msgstr "Arată Asistenții"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Rulers"
-msgstr ""
+msgstr "Arată Riglele"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Guides"
-msgstr ""
+msgstr "Arată Ghizii"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Arată Originea"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Arată Fereastra de Lucru"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
-msgstr ""
+msgstr "Centrează Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Frame Selection"
-msgstr ""
+msgstr "Încadrează în Ecran Selecția"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Layout"
-msgstr ""
+msgstr "Schemă"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Keys"
-msgstr ""
+msgstr "Inserează Note"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key"
-msgstr ""
+msgstr "Inserează Notă"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Insert Key (Existing Tracks)"
-msgstr ""
+msgstr "Inserează Notă (Melodii existente)"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Copy Pose"
-msgstr ""
+msgstr "Copiază Postura"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Clear Pose"
-msgstr ""
+msgstr "Curăță Postura"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Drag pivot from mouse position"
-msgstr ""
+msgstr "Trage pivotul de la poziția mouse-ului"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Set pivot at mouse position"
-msgstr ""
+msgstr "Setează pivotul la poziția mouse-ului"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Multiply grid step by 2"
-msgstr ""
+msgstr "Multiplică pasul pe grilă cu 2"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Divide grid step by 2"
-msgstr ""
+msgstr "Împarte pasul pe grilă cu 2"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Add %s"
-msgstr ""
+msgstr "Adaugă %s"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Adding %s..."
-msgstr ""
+msgstr "Se adaugă %s..."
#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ok"
-msgstr ""
+msgstr "Bine"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Cannot instantiate multiple nodes without root."
-msgstr ""
+msgstr "Nu se pot instanția noduri multiple fără o rădacină."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Create Node"
-msgstr ""
+msgstr "Creează Nod"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Error instancing scene from %s"
-msgstr ""
+msgstr "Eroare la instanțierea scenei din %s"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Change default type"
-msgstr ""
+msgstr "Schimbă tipul implicit"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid ""
"Drag & drop + Shift : Add node as sibling\n"
"Drag & drop + Alt : Change node type"
msgstr ""
+"Trage & lasă + Shift: Adaugă nod ca și frate\n"
+"Trage & lasă + Shift: Schimbă tipul nodului"
#: editor/plugins/collision_polygon_editor_plugin.cpp
msgid "Create Poly3D"
-msgstr ""
+msgstr "Creează Poligon3D"
#: editor/plugins/collision_shape_2d_editor_plugin.cpp
msgid "Set Handle"
-msgstr ""
+msgstr "Setează Mâner"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Remove item %d?"
-msgstr ""
+msgstr "Elimini obiectul %d?"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Add Item"
-msgstr ""
+msgstr "Adaugă Obiect"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Remove Selected Item"
-msgstr ""
+msgstr "Elimină Obiectul Selectat"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import from Scene"
-msgstr ""
+msgstr "Importă din Scenă"
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Update from Scene"
-msgstr ""
+msgstr "Actualizează din Scenă"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat0"
-msgstr ""
+msgstr "Plat0"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat1"
-msgstr ""
+msgstr "Plat1"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Ease in"
-msgstr ""
+msgstr "Facilitare în"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Ease out"
-msgstr ""
+msgstr "Facilitare din"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Smoothstep"
-msgstr ""
+msgstr "PasOmogen"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Modify Curve Point"
-msgstr ""
+msgstr "Modifică Punctul Curbei"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Modify Curve Tangent"
-msgstr ""
+msgstr "Modifică Tangenta Curbei"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Load Curve Preset"
-msgstr ""
+msgstr "Încarcă Presetare a Curbei"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Add point"
-msgstr ""
+msgstr "Adaugă punct"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Remove point"
-msgstr ""
+msgstr "Elimină punct"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Left linear"
-msgstr ""
+msgstr "Stânga liniară"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Right linear"
-msgstr ""
+msgstr "Dreapta liniară"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Load preset"
-msgstr ""
+msgstr "Încarcă presetare"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Remove Curve Point"
-msgstr ""
+msgstr "Elimină Punctul Curbei"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Toggle Curve Linear Tangent"
-msgstr ""
+msgstr "Comută Tangenta Liniară a Curbei"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Hold Shift to edit tangents individually"
-msgstr ""
+msgstr "Ține apăsat Shift pentru a edita individual tangentele"
#: editor/plugins/gi_probe_editor_plugin.cpp
msgid "Bake GI Probe"
-msgstr ""
+msgstr "Procesează Sonda GI"
#: editor/plugins/gradient_editor_plugin.cpp
msgid "Add/Remove Color Ramp Point"
-msgstr ""
+msgstr "Adaugă/Elimină Punctul Rampei de Culori"
#: editor/plugins/gradient_editor_plugin.cpp
#: editor/plugins/shader_graph_editor_plugin.cpp
msgid "Modify Color Ramp"
-msgstr ""
+msgstr "Modifică Rampa de Culori"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item %d"
-msgstr ""
+msgstr "Obiect %d"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Items"
-msgstr ""
+msgstr "Obiecte"
#: editor/plugins/item_list_editor_plugin.cpp
msgid "Item List Editor"
-msgstr ""
+msgstr "Editor Lista de Obiect"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid ""
"No OccluderPolygon2D resource on this node.\n"
"Create and assign one?"
msgstr ""
+"Nicio resursă OccluderPolygon2D în acest nod.\n"
+"Vrei să creezi și să atribui una?"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Occluder Polygon"
-msgstr ""
+msgstr "Creează Poligon de Ocluziune"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create a new polygon from scratch."
-msgstr ""
+msgstr "Creează un nou poligon de la zero."
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit existing polygon:"
-msgstr ""
+msgstr "Editează poligonul existent:"
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "LMB: Move Point."
-msgstr ""
+msgstr "LMB: Mișcă Punctul."
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Ctrl+LMB: Split Segment."
-msgstr ""
+msgstr "Ctrl+LMB: Despică Segmentul."
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "RMB: Erase Point."
-msgstr ""
+msgstr "RMB: Șterge Punctul."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh is empty!"
-msgstr ""
+msgstr "Mesh-ul este gol!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Static Trimesh Body"
-msgstr ""
+msgstr "Creează un Corp Static Trimesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Static Convex Body"
-msgstr ""
+msgstr "Creează un Corp Static Convex"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "This doesn't work on scene root!"
-msgstr ""
+msgstr "Asta nu funcționează în rădăcina scenei!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Shape"
-msgstr ""
+msgstr "Creează o Formă Trimesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Shape"
-msgstr ""
+msgstr "Creează o Formă Convexă"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Navigation Mesh"
-msgstr ""
+msgstr "Creează un Mesh de Navigare"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Contained Mesh is not of type ArrayMesh."
-msgstr ""
+msgstr "Mesh-ul conținut nu este de tipul ArrayMesh."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "UV Unwrap failed, mesh may not be manifold?"
-msgstr ""
+msgstr "Despachetarea UV a eșuat, se poate ca mesh-ul să nu fie multiplu?"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "No mesh to debug."
-msgstr ""
+msgstr "Niciun mesh de depanat."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Model has no UV in this layer"
-msgstr ""
+msgstr "Modelul nu are UV în acest strat"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "MeshInstance lacks a Mesh!"
-msgstr ""
+msgstr "MeshInstance nu are un Mesh!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh has not surface to create outlines from!"
-msgstr ""
+msgstr "Mesh-ul nu are o suprafață din care să se poată creea contururi!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Mesh-ul primitiv nu este de tipul PRIMITIVE_TRIANGLES!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
-msgstr ""
+msgstr "Nu s-a putut creea un contur!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Outline"
-msgstr ""
+msgstr "Creează Contur"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh"
-msgstr ""
+msgstr "Mesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Static Body"
-msgstr ""
+msgstr "Creează un Corp Static Trimesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Static Body"
-msgstr ""
+msgstr "Creează un Corp Static Convex"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Trimesh Collision Sibling"
-msgstr ""
+msgstr "Creează un Frate de Coliziune Trimesh"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Convex Collision Sibling"
-msgstr ""
+msgstr "Creează un Frate de Coliziune Convex"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr ""
+msgid "Create Outline Mesh..."
+msgstr "Se Creează un Mesh de Contur..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
-msgstr ""
+msgstr "Vizionare UV1"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV2"
-msgstr ""
+msgstr "Vizionare UV2"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Unwrap UV2 for Lightmap/AO"
-msgstr ""
+msgstr "Despachetează UV2 pentru Lightmap/AO"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Outline Mesh"
-msgstr ""
+msgstr "Creează Mesh de Contur"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Outline Size:"
-msgstr ""
+msgstr "Dimensiunea Conturului:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and no MultiMesh set in node)."
-msgstr ""
+msgstr "Niciun mesh sursă specificată (și niciun MultiMesh setat în nod)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No mesh source specified (and MultiMesh contains no Mesh)."
-msgstr ""
+msgstr "Niciun mesh sursă specificată (și MultiMesh nu conține un Mesh)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (invalid path)."
-msgstr ""
+msgstr "Sursa mesh-ului nevalidă (cale nevalidă)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (not a MeshInstance)."
-msgstr ""
+msgstr "Sursa mesh-ului nevalidă (nu este un MeshInstance)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh source is invalid (contains no Mesh resource)."
-msgstr ""
+msgstr "Sursa mesh-ului nevalidă (nu conține nicio resursă Mesh)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "No surface source specified."
-msgstr ""
+msgstr "Nicio sursă de suprafață specificată."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (invalid path)."
-msgstr ""
+msgstr "Sursa suprafeței nevalidă (cale nevalidă)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (no geometry)."
-msgstr ""
+msgstr "Sursa suprafeței nevalidă (nu există geometrie)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Surface source is invalid (no faces)."
-msgstr ""
+msgstr "Sursa suprafeței nevalidă (nu există fețe)."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Parent has no solid faces to populate."
-msgstr ""
+msgstr "Părintele nu are fețe solide pentru a fi populate."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Couldn't map area."
-msgstr ""
+msgstr "Nu s-a putut mapa zona."
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Source Mesh:"
-msgstr ""
+msgstr "Selectează un Mesh Sursă:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Select a Target Surface:"
-msgstr ""
+msgstr "Selectează o Suprafață Țintă:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate Surface"
-msgstr ""
+msgstr "Populează Suprafața"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate MultiMesh"
-msgstr ""
+msgstr "Populează MultiMesh"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Target Surface:"
-msgstr ""
+msgstr "Suprafață Țintă:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Source Mesh:"
-msgstr ""
+msgstr "Mesh Sursă:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "X-Axis"
-msgstr ""
+msgstr "Axa-X"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Y-Axis"
-msgstr ""
+msgstr "Axa-Y"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Z-Axis"
-msgstr ""
+msgstr "Axa-Z"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Mesh Up Axis:"
@@ -4026,7 +4157,7 @@ msgstr ""
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Random Scale:"
-msgstr ""
+msgstr "Dimensiune Aleatorie:"
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Populate"
@@ -4038,11 +4169,11 @@ msgstr ""
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Bake the navigation mesh."
-msgstr ""
+msgstr "Procesează mesh-ul de navigare."
#: editor/plugins/navigation_mesh_editor_plugin.cpp
msgid "Clear the navigation mesh."
-msgstr ""
+msgstr "Curăță mesh-ul de navigare."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Setting up Configuration..."
@@ -4082,11 +4213,11 @@ msgstr ""
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Converting to native navigation mesh..."
-msgstr ""
+msgstr "Se convertește în mesh nativ de navigare..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Navigation Mesh Generator Setup:"
-msgstr ""
+msgstr "Setup Generare Mesh de Navigare:"
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Parsing Geometry..."
@@ -4114,7 +4245,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4127,7 +4258,7 @@ msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Clear Emission Mask"
-msgstr ""
+msgstr "Curăță Masca de Emisie"
#: editor/plugins/particles_2d_editor_plugin.cpp
#: editor/plugins/particles_editor_plugin.cpp
@@ -4181,7 +4312,7 @@ msgstr ""
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Mesh"
-msgstr ""
+msgstr "Creează Puncte de Emisie Din Mesh"
#: editor/plugins/particles_editor_plugin.cpp
msgid "Create Emission Points From Node"
@@ -4346,7 +4477,7 @@ msgstr ""
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift+Ctrl: Scale"
-msgstr ""
+msgstr "Shift+Ctrl: Dimensiune"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Move Polygon"
@@ -4358,7 +4489,7 @@ msgstr ""
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Scale Polygon"
-msgstr ""
+msgstr "Redimensionează Poligon"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4378,16 +4509,16 @@ msgstr ""
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Clear UV"
-msgstr ""
+msgstr "Curăță UV"
#: editor/plugins/polygon_2d_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap"
-msgstr ""
+msgstr "Snap"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Enable Snap"
-msgstr ""
+msgstr "Activează Snap"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Grid"
@@ -4448,7 +4579,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
msgid "Clear Recent Files"
-msgstr ""
+msgstr "Curăță Fișierele Recente"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close and save changes?"
@@ -4475,7 +4606,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4564,7 +4695,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
msgid "Run"
-msgstr ""
+msgstr "Execută"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle Scripts Panel"
@@ -4572,7 +4703,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4778,15 +4909,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5154,7 +5285,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale Mode (R)"
-msgstr ""
+msgstr "Mod Redimensionare (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
@@ -5166,7 +5297,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap Mode (%s)"
-msgstr ""
+msgstr "Mod Snap (%s)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
@@ -5226,7 +5357,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Tool Scale"
-msgstr ""
+msgstr "Unealtă Dimensiune"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Toggle Freelook"
@@ -5237,11 +5368,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5287,19 +5414,19 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap Settings"
-msgstr ""
+msgstr "Setări Snap"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translate Snap:"
-msgstr ""
+msgstr "Tradu Snap:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate Snap (deg.):"
-msgstr ""
+msgstr "Rotație Snap (grade):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale Snap (%):"
-msgstr ""
+msgstr "Dimensionare Snap (%):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Viewport Settings"
@@ -5331,7 +5458,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale (ratio):"
-msgstr ""
+msgstr "Dimensiune (raport):"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Type"
@@ -5427,7 +5554,7 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Snap Mode:"
-msgstr ""
+msgstr "Mod Snap:"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "<None>"
@@ -5435,11 +5562,11 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Pixel Snap"
-msgstr ""
+msgstr "Pixel Snap"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Grid Snap"
-msgstr ""
+msgstr "Snap Grilă"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Auto Slice"
@@ -5494,7 +5621,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5542,6 +5669,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5554,7 +5689,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5742,7 +5877,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5832,6 +5967,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Nume de Proiect Nevalid."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -5931,16 +6070,21 @@ msgid ""
"Please edit the project and set the main scene in \"Project Settings\" under "
"the \"Application\" category."
msgstr ""
+"Proiectul nu poate fi executat: nicio scenă principală nu a fost definită.\n"
+"Te rog editează proiectul și setează o scenă principală în \"Setările "
+"Proiectului\" din categoria \"Aplicații\"."
#: editor/project_manager.cpp
msgid ""
"Can't run project: Assets need to be imported.\n"
"Please edit the project to trigger the initial import."
msgstr ""
+"Nu se poate executa priectul: există Asset-uri care trebuie importate.\n"
+"Te rog editează proiectul pentru a declanșa importul inițial."
#: editor/project_manager.cpp
msgid "Are you sure to run more than one project?"
-msgstr ""
+msgstr "Ești sigur că vrei să execuți acel proiect?"
#: editor/project_manager.cpp
msgid "Remove project from the list? (Folder contents will not be modified)"
@@ -5992,13 +6136,16 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Can't run project"
-msgstr ""
+msgstr "Proiectul nu poate fi executat"
#: editor/project_manager.cpp
msgid ""
"You don't currently have any projects.\n"
"Would you like to explore the official example projects in the Asset Library?"
msgstr ""
+"Deocamdată nu ai niciun proiect.\n"
+"Dorești să explorezi exemplele de proiecte oficiale din Librăria de Asset-"
+"uri?"
#: editor/project_settings_editor.cpp
msgid "Key "
@@ -6017,7 +6164,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6045,7 +6194,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6161,10 +6310,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6226,14 +6371,14 @@ msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr ""
+msgstr "General"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6329,11 +6474,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6434,7 +6579,7 @@ msgstr ""
#: editor/run_settings_dialog.cpp
msgid "Run Mode:"
-msgstr ""
+msgstr "Modul de Execuție:"
#: editor/run_settings_dialog.cpp
msgid "Current Scene"
@@ -6450,7 +6595,7 @@ msgstr ""
#: editor/run_settings_dialog.cpp
msgid "Scene Run Settings"
-msgstr ""
+msgstr "Setările de Execuție ale Scenei"
#: editor/scene_tree_dock.cpp editor/script_create_dialog.cpp
#: scene/gui/dialogs.cpp
@@ -6504,7 +6649,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -6555,7 +6700,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance"
-msgstr ""
+msgstr "Curăță Derivarea"
#: editor/scene_tree_dock.cpp
msgid "Delete Node(s)"
@@ -6579,7 +6724,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Clear Script"
-msgstr ""
+msgstr "Curăță Scriptul"
#: editor/scene_tree_dock.cpp
msgid "Merge From Scene"
@@ -6617,7 +6762,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Clear a script for the selected node."
-msgstr ""
+msgstr "Curăță un script pentru nodul selectat."
#: editor/scene_tree_dock.cpp
msgid "Remote"
@@ -6629,11 +6774,11 @@ msgstr ""
#: editor/scene_tree_dock.cpp
msgid "Clear Inheritance? (No Undo!)"
-msgstr ""
+msgstr "Curăță Derivarea? (Fără Întoarcere)"
#: editor/scene_tree_dock.cpp
msgid "Clear!"
-msgstr ""
+msgstr "Curăță!"
#: editor/scene_tree_editor.cpp
msgid "Toggle Spatial Visible"
@@ -7125,7 +7270,7 @@ msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Snap View"
-msgstr ""
+msgstr "Perspectivă Snap"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Clip Disabled"
@@ -7177,7 +7322,7 @@ msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Cursor Clear Rotation"
-msgstr ""
+msgstr "Curăță Rotația Cursorului"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Create Area"
@@ -7193,7 +7338,7 @@ msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Clear Selection"
-msgstr ""
+msgstr "Curăță Selecția"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "GridMap Settings"
@@ -7203,6 +7348,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7251,6 +7400,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7589,11 +7742,11 @@ msgstr ""
#: platform/javascript/export/export.cpp
msgid "Run in Browser"
-msgstr ""
+msgstr "Execută în Browser"
#: platform/javascript/export/export.cpp
msgid "Run exported HTML in the system's default browser."
-msgstr ""
+msgstr "Execută HTML-ul exportat în browserul prestabilit al sistemului."
#: platform/javascript/export/export.cpp
msgid "Could not write file:"
@@ -7835,10 +7988,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -7918,3 +8081,11 @@ msgstr ""
#: scene/resources/dynamic_font.cpp
msgid "Invalid font size."
msgstr ""
+
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Fila anterioară"
+
+#, fuzzy
+#~ msgid "Next"
+#~ msgstr "Fila următoare"
diff --git a/editor/translations/ru.po b/editor/translations/ru.po
index 95627dbb37..97c7284404 100644
--- a/editor/translations/ru.po
+++ b/editor/translations/ru.po
@@ -2,23 +2,26 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
+# Ðркадий ÐÐ²Ð°Ñ <savvot@gmail.com>, 2018.
# Artem Varaksa <aymfst@gmail.com>, 2018.
# B10nicMachine <shumik1337@gmail.com>, 2017.
+# Chaosus89 <chaosus89@gmail.com>, 2018.
# DimOkGamer <dimokgamer@gmail.com>, 2016-2017.
+# Forest Swamp <sample1989@mail.ru>, 2018.
# Igor S <scorched@bk.ru>, 2017.
# ijet <my-ijet@mail.ru>, 2017-2018.
# Maxim Kim <habamax@gmail.com>, 2016.
# Maxim toby3d Lebedev <mail@toby3d.ru>, 2016.
# outbools <drag4e@yandex.ru>, 2017.
# pitchblack <pitchblack@mail.ru>, 2017.
+# Sergey <maligin.serega2010@yandex.ru>, 2018.
# Sergey Agarkov <zorgsoft@gmail.com>, 2017.
-#
+# teriva <spirin.cos@yandex.ru>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
"POT-Creation-Date: \n"
-"PO-Revision-Date: 2018-01-24 12:27+0000\n"
+"PO-Revision-Date: 2018-06-18 19:42+0000\n"
"Last-Translator: ijet <my-ijet@mail.ru>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/godot-engine/"
"godot/ru/>\n"
@@ -28,7 +31,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 2.19-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -508,8 +511,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Отключить '%s' от '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "ПриÑоединить.."
+msgid "Connect..."
+msgstr "ПриÑоединить..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -928,12 +931,12 @@ msgid "Move Audio Bus"
msgstr "ПеремеÑтить аудио шину"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Сохранить раÑкладку звуковой шины как.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Сохранить раÑкладку звуковой шины как..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "МеÑтоположение новой раÑкладки.."
+msgid "Location for New Layout..."
+msgstr "МеÑтоположение новой раÑкладки..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1074,12 +1077,12 @@ msgid "Updating Scene"
msgstr "Обновление Ñцены"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Сохранение локальных изменений.."
+msgid "Storing local changes..."
+msgstr "Сохранение локальных изменений..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Обновление Ñцены.."
+msgid "Updating scene..."
+msgstr "Обновление Ñцены..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1147,8 +1150,8 @@ msgid "Show In File Manager"
msgstr "ПроÑмотреть в проводнике"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "ÐÐ¾Ð²Ð°Ñ Ð¿Ð°Ð¿ÐºÐ°.."
+msgid "New Folder..."
+msgstr "ÐÐ¾Ð²Ð°Ñ Ð¿Ð°Ð¿ÐºÐ°..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1288,11 +1291,11 @@ msgstr "Краткое опиÑание:"
#: editor/editor_help.cpp
msgid "Members"
-msgstr "УчаÑтники"
+msgstr "СвойÑтва"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Members:"
-msgstr "УчаÑтники:"
+msgstr "СвойÑтва:"
#: editor/editor_help.cpp
msgid "Public Methods"
@@ -1358,7 +1361,7 @@ msgstr "СвойÑтва"
#: editor/editor_help.cpp
msgid "Property Description:"
-msgstr "ОпиÑание ÑвойÑтва:"
+msgstr "ОпиÑание ÑвойÑтв:"
#: editor/editor_help.cpp
msgid ""
@@ -1407,18 +1410,22 @@ msgstr "ОчиÑтить"
msgid "Clear Output"
msgstr "ОчиÑтить вывод"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "ЭкÑпорт проекта не удалÑÑ, код %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Ошибка при Ñохранении реÑурÑа!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Сохранить реÑÑƒÑ€Ñ ÐºÐ°Ðº.."
+msgid "Save Resource As..."
+msgstr "Сохранить реÑÑƒÑ€Ñ ÐºÐ°Ðº..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "ЯÑно.."
+msgid "I see..."
+msgstr "ЯÑно..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1648,12 +1655,12 @@ msgid "Open Base Scene"
msgstr "Открыть оÑновную Ñцену"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "БыÑтро открыть Ñцену.."
+msgid "Quick Open Scene..."
+msgstr "БыÑтро открыть Ñцену..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "БыÑтро открыть Ñкрипт.."
+msgid "Quick Open Script..."
+msgstr "БыÑтро открыть Ñкрипт..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1664,8 +1671,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Сохранить Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð² «%s» перед закрытием?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Сохранить Ñцену как.."
+msgid "Save Scene As..."
+msgstr "Сохранить Ñцену как..."
#: editor/editor_node.cpp
msgid "No"
@@ -1716,8 +1723,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Это дейÑтвие Ð½ÐµÐ»ÑŒÐ·Ñ Ð¾Ñ‚Ð¼ÐµÐ½Ð¸Ñ‚ÑŒ. ВоÑÑтановить в любом Ñлучае?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "БыÑтро запуÑтить Ñцену.."
+msgid "Quick Run Scene..."
+msgstr "БыÑтро запуÑтить Ñцену..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1873,8 +1880,8 @@ msgid "Previous tab"
msgstr "ÐŸÑ€ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "ОтÑортировать файлы.."
+msgid "Filter Files..."
+msgstr "ОтÑортировать файлы..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1885,12 +1892,12 @@ msgid "New Scene"
msgstr "ÐÐ¾Ð²Ð°Ñ Ñцена"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "ÐÐ¾Ð²Ð°Ñ ÑƒÐ½Ð°ÑÐ»ÐµÐ´Ð¾Ð²Ð°Ð½Ð½Ð°Ñ Ð¡Ñ†ÐµÐ½Ð°.."
+msgid "New Inherited Scene..."
+msgstr "ÐÐ¾Ð²Ð°Ñ ÑƒÐ½Ð°ÑÐ»ÐµÐ´Ð¾Ð²Ð°Ð½Ð½Ð°Ñ Ð¡Ñ†ÐµÐ½Ð°..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Открыть Ñцену.."
+msgid "Open Scene..."
+msgstr "Открыть Ñцену..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1909,16 +1916,16 @@ msgid "Open Recent"
msgstr "Открыть поÑледнее"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Конвертировать в.."
+msgid "Convert To..."
+msgstr "Конвертировать в..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "Библиотека полиÑеток.."
+msgid "MeshLibrary..."
+msgstr "Библиотека полиÑеток..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "Ðабор тайлов.."
+msgid "TileSet..."
+msgstr "Ðабор тайлов..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2011,7 +2018,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Visible Navigation"
-msgstr "Видимые облаÑти навигации"
+msgstr "Ð’Ð¸Ð´Ð¸Ð¼Ð°Ñ Ð½Ð°Ð²Ð¸Ð³Ð°Ñ†Ð¸Ñ"
#: editor/editor_node.cpp
msgid ""
@@ -2102,7 +2109,7 @@ msgstr "СиÑтема отÑÐ»ÐµÐ¶Ð¸Ð²Ð°Ð½Ð¸Ñ Ð¾ÑˆÐ¸Ð±Ð¾Ðº"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
msgid "Community"
-msgstr "ОбщеÑтвенные"
+msgstr "СообщеÑтво"
#: editor/editor_node.cpp
msgid "About"
@@ -2181,8 +2188,8 @@ msgid "Save the currently edited resource."
msgstr "Сохранить текущий редактируемый реÑурÑ."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Сохранить как.."
+msgid "Save As..."
+msgstr "Сохранить как..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2290,8 +2297,8 @@ msgid "Creating Mesh Previews"
msgstr "Создание предпроÑмотра"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Миниатюра.."
+msgid "Thumbnail..."
+msgstr "Миниатюра..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2352,7 +2359,7 @@ msgstr "Включительно"
#: editor/editor_profiler.cpp
msgid "Self"
-msgstr "СущноÑть"
+msgstr ""
#: editor/editor_profiler.cpp
msgid "Frame #:"
@@ -2443,7 +2450,7 @@ msgid "(Current)"
msgstr "(Текущий)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Получение зеркал, пожалуйÑта подождите."
#: editor/export_template_manager.cpp
@@ -2459,14 +2466,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ðеверный формат version.txt файла внутри шаблонов."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ðеверный формат version.txt файла внутри шаблонов. Идентификатор ревизии не "
-"верен."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Ðе найден version.txt файл в шаблонах."
@@ -2529,8 +2528,8 @@ msgid "Error requesting url: "
msgstr "Ошибка запроÑа адреÑа ÑÑылки: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Подключение к зеркалам.."
+msgid "Connecting to Mirror..."
+msgstr "Подключение к зеркалам..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2546,8 +2545,8 @@ msgstr "Ðе удаётÑÑ Ñ€Ð°Ð·Ñ€ÐµÑˆÐ¸Ñ‚ÑŒ"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Подключение.."
+msgid "Connecting..."
+msgstr "Подключение..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2559,8 +2558,8 @@ msgstr "Подключен"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "Запрашиваю.."
+msgid "Requesting..."
+msgstr "Запрашиваю..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2696,12 +2695,12 @@ msgid "Collapse all"
msgstr "Свернуть вÑе"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Переименовать.."
+msgid "Rename..."
+msgstr "Переименовать..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "ПеремеÑтить в.."
+msgid "Move To..."
+msgstr "ПеремеÑтить в..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2712,16 +2711,16 @@ msgid "Instance"
msgstr "Добавить ÑкземплÑÑ€"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Редактировать завиÑимоÑти.."
+msgid "Edit Dependencies..."
+msgstr "Редактировать завиÑимоÑти..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "ПроÑмотреть владельцев.."
+msgid "View Owners..."
+msgstr "ПроÑмотреть владельцев..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Дублировать.."
+msgid "Duplicate..."
+msgstr "Дублировать..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2746,7 +2745,7 @@ msgstr "Добавить выбранную Ñцену(Ñ‹), в качеÑтве
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Сканирование файлов,\n"
"пожалуйÑта, подождите..."
@@ -2814,8 +2813,8 @@ msgid "Import Scene"
msgstr "Импортировать Ñцену"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Импортирование Ñцены.."
+msgid "Importing Scene..."
+msgstr "Импортирование Ñцены..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2826,8 +2825,8 @@ msgid "Generating for Mesh: "
msgstr "Создание Ð´Ð»Ñ Ð¿Ð¾Ð»Ð¸Ñетки: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "ЗапуÑк пользовательÑкого Ñкрипта.."
+msgid "Running Custom Script..."
+msgstr "ЗапуÑк пользовательÑкого Ñкрипта..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2842,8 +2841,8 @@ msgid "Error running post-import script:"
msgstr "Ошибка запуÑка поÑÑ‚-импорт Ñкрипта:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Сохранение.."
+msgid "Saving..."
+msgstr "Сохранение..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2862,8 +2861,8 @@ msgid "Import As:"
msgstr "Импортировать как:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "ПредуÑтановка.."
+msgid "Preset..."
+msgstr "ПредуÑтановка..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3283,16 +3282,16 @@ msgid "Transition Node"
msgstr "Transition узел"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Импортировать анимации.."
+msgid "Import Animations..."
+msgstr "Импортировать анимации..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Редактировать фильтры узла"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "Фильтры.."
+msgid "Filters..."
+msgstr "Фильтры..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3359,7 +3358,7 @@ msgid "Fetching:"
msgstr "Извлечение:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "ИнициализациÑ..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3426,8 +3425,8 @@ msgid "Site:"
msgstr "Сайт:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "Поддержка.."
+msgid "Support..."
+msgstr "Поддержка..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3623,6 +3622,7 @@ msgid "Use Rotation Snap"
msgstr "ИÑпользовать привÑзку вращениÑ"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "ÐаÑтроить привÑзку..."
@@ -3719,8 +3719,16 @@ msgid "Show Guides"
msgstr "Показывать направлÑющие"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Отображать центр"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Показать окно проÑмотра"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
-msgstr "Центрировать на выбранном"
+msgstr "Центрировать выбранное"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Frame Selection"
@@ -4008,6 +4016,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Полиcетка не имеет поверхноÑти Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÐºÐ¾Ð½Ñ‚ÑƒÑ€Ð°!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Тип полиÑетки не PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Ðевозможно Ñоздать контур!"
@@ -4036,8 +4048,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Создать выпуклую облаÑть ÑтолкновениÑ"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Создать полиÑетку обводки.."
+msgid "Create Outline Mesh..."
+msgstr "Создать полиÑетку обводки..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4241,8 +4253,8 @@ msgid "Error loading image:"
msgstr "Ошибка при загрузке изображениÑ:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Ðикаких пикÑелей Ñ Ð¿Ñ€Ð¾Ð·Ñ€Ð°Ñ‡Ð½Ð¾Ñтью > 128 в изображении.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Ðикаких пикÑелей Ñ Ð¿Ñ€Ð¾Ð·Ñ€Ð°Ñ‡Ð½Ð¾Ñтью > 128 в изображении..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4602,8 +4614,8 @@ msgid "Import Theme"
msgstr "Импортировать тему"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Сохранить тему как.."
+msgid "Save Theme As..."
+msgstr "Сохранить тему как..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4647,7 +4659,7 @@ msgstr "Сохранить вÑÑ‘"
#: editor/plugins/script_editor_plugin.cpp
msgid "Soft Reload Script"
-msgstr "МÑгко перезагрузить Ñкрипты"
+msgstr "МÑгко перезагрузить Ñкрипт"
#: editor/plugins/script_editor_plugin.cpp
msgid "Copy Script Path"
@@ -4699,8 +4711,8 @@ msgstr "Переключить панель Ñкриптов"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Ðайти.."
+msgid "Find..."
+msgstr "Ðайти..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4909,16 +4921,16 @@ msgid "Find Previous"
msgstr "Ðайти предыдущее"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Заменить.."
+msgid "Replace..."
+msgstr "Заменить..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Перейти к функции.."
+msgid "Goto Function..."
+msgstr "Перейти к функции..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Перейти к Ñтроке.."
+msgid "Goto Line..."
+msgstr "Перейти к Ñтроке..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5371,12 +5383,8 @@ msgid "Transform"
msgstr "Преобразование"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "ÐаÑтроить привÑзку.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Окно преобразованиÑ.."
+msgid "Transform Dialog..."
+msgstr "Окно преобразованиÑ..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5544,18 +5552,16 @@ msgid "Move (After)"
msgstr "ПеремеÑтить (поÑле)"
#: editor/plugins/sprite_frames_editor_plugin.cpp
-#, fuzzy
msgid "SpriteFrames"
-msgstr "Кадры cпрайта"
+msgstr "Спрайт кадры"
#: editor/plugins/style_box_editor_plugin.cpp
msgid "StyleBox Preview:"
-msgstr "StyleBox предпроÑмотр:"
+msgstr "ПредпроÑмотр StyleBox:"
#: editor/plugins/style_box_editor_plugin.cpp
-#, fuzzy
msgid "StyleBox"
-msgstr "Стиль"
+msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Set Region Rect"
@@ -5630,8 +5636,8 @@ msgid "Remove All"
msgstr "Удалить вÑе"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Редактировать тему.."
+msgid "Edit theme..."
+msgstr "Редактировать тему..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5678,6 +5684,16 @@ msgid "Checked Item"
msgstr "Отмеченный Ñлемент"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "Добавить Ñлемент"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "Отмеченный Ñлемент"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Имеет"
@@ -5690,8 +5706,8 @@ msgid "Options"
msgstr "Параметры"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Имеет,Много,Разных,Опций!"
+msgid "Has,Many,Options"
+msgstr "ЕÑть,Много,Вариантов"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5882,8 +5898,8 @@ msgid "Presets"
msgstr "ПредуÑтановки"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Добавить.."
+msgid "Add..."
+msgstr "Добавить..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5931,7 +5947,7 @@ msgstr "Создать латку"
#: editor/project_export.cpp
msgid "Features"
-msgstr "СвойÑтва"
+msgstr "ОÑобенноÑти"
#: editor/project_export.cpp
msgid "Custom (comma-separated):"
@@ -5974,6 +5990,10 @@ msgid "Imported Project"
msgstr "Импортированный проект"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "ÐедопуÑтимое Ð¸Ð¼Ñ Ð¿Ñ€Ð¾ÐµÐºÑ‚Ð°."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Ðе удалоÑÑŒ Ñоздать папку."
@@ -5990,11 +6010,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "Ðеверный путь к проекту (Что-то изменили?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "Ðе удалоÑÑŒ изменить project.godot в папке проекта."
+msgstr ""
+"Ðе удалоÑÑŒ загрузить project.godot в пути проекта (ошибка %d). Возможно, он "
+"отÑутÑтвует или поврежден."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6156,7 +6177,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
msgid "Key "
-msgstr "Кнопка "
+msgstr "Ключ "
#: editor/project_settings_editor.cpp
msgid "Joy Button"
@@ -6171,8 +6192,12 @@ msgid "Mouse Button"
msgstr "Кнопка мыши"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "ÐедопуÑтимое название дейÑÑ‚Ð²Ð¸Ñ (подойдёт вÑÑ‘ кроме '/' или ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"ÐедопуÑтимое Ð¸Ð¼Ñ Ð´ÐµÐ¹ÑтвиÑ. Оно не может быть пуÑтым или Ñодержать '/', ':', "
+"'=', '\\' или '\"'."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6199,7 +6224,7 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr "Ðажмите любую клавишу..."
#: editor/project_settings_editor.cpp
@@ -6315,10 +6340,6 @@ msgid "Delete Item"
msgstr "Удалить Ñлемент"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Ðе может Ñодержать '/' или ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Уже ÑущеÑтвует"
@@ -6387,7 +6408,7 @@ msgid "Property:"
msgstr "Параметр:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "Переопределить длÑ..."
#: editor/project_settings_editor.cpp
@@ -6483,12 +6504,12 @@ msgid "Easing Out-In"
msgstr "Переход ИЗ-В"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Файл.."
+msgid "File..."
+msgstr "Файл..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Папка.."
+msgid "Dir..."
+msgstr "Папка..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6662,8 +6683,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Эта Ð¾Ð¿ÐµÑ€Ð°Ñ†Ð¸Ñ Ð½Ðµ может быть Ñделана на редактируемой Ñцене."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Сохранить новую Сцену как.."
+msgid "Save New Scene As..."
+msgstr "Сохранить новую Сцену как..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -6975,7 +6996,7 @@ msgstr "Ð’Ñтроенный Скрипт"
#: editor/script_create_dialog.cpp
msgid "Attach Node Script"
-msgstr "Добавление Ñкрипта"
+msgstr "Прикрепить Ñкрипт"
#: editor/script_editor_debugger.cpp
msgid "Remote "
@@ -7212,7 +7233,7 @@ msgstr "Библиотеки: "
#: modules/gdnative/register_types.cpp
msgid "GDNative"
-msgstr "GDNative"
+msgstr ""
#: modules/gdscript/gdscript_functions.cpp
#: modules/visual_script/visual_script_builtin_funcs.cpp
@@ -7262,18 +7283,16 @@ msgid "Object can't provide a length."
msgstr "Объект не может предоÑтавить длину."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "Ð¡Ð»ÐµÐ´ÑƒÑŽÑ‰Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
+msgstr "Ð¡Ð»ÐµÐ´ÑƒÑŽÑ‰Ð°Ñ Ð¿Ð¾ÑкоÑть"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "ÐŸÑ€ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
+msgstr "ÐŸÑ€ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ð¿Ð»Ð¾ÑкоÑть"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "ПлоÑкоÑть:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7379,6 +7398,10 @@ msgstr "GridMap Параметры"
msgid "Pick Distance:"
msgstr "РаÑÑтоÑние выбора:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Ð˜Ð¼Ñ ÐºÐ»Ð°ÑÑа не может быть зарезервированным ключевым Ñловом"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñ€ÐµÑˆÐµÐ½Ð¸Ñ..."
@@ -7409,7 +7432,7 @@ msgstr "Моно"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "О C# поддержке"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7427,6 +7450,10 @@ msgstr "Собрать проект"
msgid "Warnings"
msgstr "ПредупреждениÑ"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Конец траÑÑировки внутреннего Ñтека иÑключений"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7830,6 +7857,10 @@ msgid ""
"Consider adding CollisionShape2D or CollisionPolygon2D children nodes to "
"define its shape."
msgstr ""
+"Этот узел не имеет дочерних форм, поÑтому он не может взаимодейÑтвовать Ñ "
+"проÑтранÑтвом.\n"
+"РаÑÑмотрите возможноÑть Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ CollisionShape2D или CollisionPolygon2D "
+"дочерних узлов, Ð´Ð»Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ ÐµÐ³Ð¾ формы."
#: scene/2d/collision_polygon_2d.cpp
msgid ""
@@ -7978,11 +8009,11 @@ msgstr "ARVROrigin требует дочерний узел ARVRCamera"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(ОÑталоÑÑŒ: %d:%02d Ñек)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8006,6 +8037,10 @@ msgid ""
"Consider adding CollisionShape or CollisionPolygon children nodes to define "
"its shape."
msgstr ""
+"Этот узел не имеет дочерних форм, поÑтому он не может взаимодейÑтвовать Ñ "
+"проÑтранÑтвом.\n"
+"РаÑÑмотрите возможноÑть Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ CollisionShape или CollisionPolygon "
+"дочерних узлов, чтобы определить его форму."
#: scene/3d/collision_polygon.cpp
msgid ""
@@ -8076,12 +8111,24 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "СвойÑтво Path должно указывать на дейÑтвительный Spatial узел."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment необходим Environment реÑурÑ."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Только один WorldEnvironment допуÑкаетÑÑ Ð½Ð° Ñцену или ÑовокупноÑть "
"приведённых Ñцен."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Этот WorldEnvironment игнорируетÑÑ. Либо добавьте Camera (Ð´Ð»Ñ 3D-Ñцен), либо "
+"уÑтановите в Environment реÑурÑе Background режим в Canvas (Ð´Ð»Ñ 2D Ñцен)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8181,6 +8228,26 @@ msgstr "Ошибка загрузки шрифта."
msgid "Invalid font size."
msgstr "ÐедопуÑтимый размер шрифта."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "ÐŸÑ€ÐµÐ´Ñ‹Ð´ÑƒÑ‰Ð°Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
+
+#~ msgid "Next"
+#~ msgstr "Следующий"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "ÐедопуÑтимое название дейÑÑ‚Ð²Ð¸Ñ (подойдёт вÑÑ‘ кроме '/' или ':')."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Ðе может Ñодержать '/' или ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ðеверный формат version.txt файла внутри шаблонов. Идентификатор ревизии "
+#~ "не верен."
+
#~ msgid "Can't write file."
#~ msgstr "Ðе удалоÑÑŒ запиÑать файл."
@@ -8194,9 +8261,6 @@ msgstr "ÐедопуÑтимый размер шрифта."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "ОтÑутÑтвует project.godot в папке проекта."
-#~ msgid "Next"
-#~ msgstr "Следующий"
-
#~ msgid "Not found!"
#~ msgstr "Ðе найдено!"
@@ -8341,8 +8405,8 @@ msgstr "ÐедопуÑтимый размер шрифта."
#~ msgid "Exporting for %s"
#~ msgstr "ЭкÑпортирование Ð´Ð»Ñ %s"
-#~ msgid "Setting Up.."
-#~ msgstr "ÐаÑтройка.."
+#~ msgid "Setting Up..."
+#~ msgstr "ÐаÑтройка..."
#~ msgid "Error loading scene."
#~ msgstr "Ошибка загрузки Ñцены."
@@ -8402,8 +8466,8 @@ msgstr "ÐедопуÑтимый размер шрифта."
#~ msgid "Info"
#~ msgstr "ИнформациÑ"
-#~ msgid "Re-Import.."
-#~ msgstr "Переимпортировать.."
+#~ msgid "Re-Import..."
+#~ msgstr "Переимпортировать..."
#~ msgid "No bit masks to import!"
#~ msgstr "Ðет битовой маÑки Ð´Ð»Ñ Ð¸Ð¼Ð¿Ð¾Ñ€Ñ‚Ð°!"
@@ -8799,14 +8863,14 @@ msgstr "ÐедопуÑтимый размер шрифта."
#~ msgid "Zoom (%):"
#~ msgstr "МаÑштаб (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "Скелет.."
+#~ msgid "Skeleton..."
+#~ msgstr "Скелет..."
#~ msgid "Zoom Reset"
#~ msgstr "СброÑить маÑштаб"
-#~ msgid "Zoom Set.."
-#~ msgstr "УÑтановить маÑштаб.."
+#~ msgid "Zoom Set..."
+#~ msgstr "УÑтановить маÑштаб..."
#~ msgid "Set a Value"
#~ msgstr "УÑтановить значение"
@@ -9279,8 +9343,8 @@ msgstr "ÐедопуÑтимый размер шрифта."
#~ msgid "Export Project PCK"
#~ msgstr "ЭкÑпортировать PCK проекта"
-#~ msgid "Export.."
-#~ msgstr "ЭкÑпортировать.."
+#~ msgid "Export..."
+#~ msgstr "ЭкÑпортировать..."
#~ msgid "Project Export"
#~ msgstr "ЭкÑпортирование проекта"
@@ -9400,8 +9464,8 @@ msgstr "ÐедопуÑтимый размер шрифта."
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "Перезагрузить инÑтрум. Ñкрипт (мÑгко)"
-#~ msgid "Edit Connections.."
-#~ msgstr "Изменить ÑвÑзи.."
+#~ msgid "Edit Connections..."
+#~ msgstr "Изменить ÑвÑзи..."
#~ msgid "Set Params"
#~ msgstr "Ðазначить параметры"
diff --git a/editor/translations/sk.po b/editor/translations/sk.po
index d9bd671d69..9716dee696 100644
--- a/editor/translations/sk.po
+++ b/editor/translations/sk.po
@@ -2,25 +2,24 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# J08nY <johnenter@gmail.com>, 2016.
-#
+# MineGame 159 <minegame459@gmail.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2016-06-25 14:16+0000\n"
-"Last-Translator: J08nY <johnenter@gmail.com>\n"
+"PO-Revision-Date: 2018-06-18 08:43+0000\n"
+"Last-Translator: MineGame 159 <minegame459@gmail.com>\n"
"Language-Team: Slovak <https://hosted.weblate.org/projects/godot-engine/"
"godot/sk/>\n"
"Language: sk\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Generator: Weblate 2.7-dev\n"
+"X-Generator: Weblate 3.0.1\n"
#: editor/animation_editor.cpp
msgid "Disabled"
-msgstr ""
+msgstr "Vypnuté"
#: editor/animation_editor.cpp
msgid "All Selection"
@@ -28,11 +27,11 @@ msgstr "Všetky vybrané"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr ""
+msgstr "Animácia Zmeniť Keyframe Čas"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr ""
+msgstr "Animácia zmeniť prechod"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
@@ -40,11 +39,12 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr ""
+msgstr "Animácia Zmeniť Keyframe Hodnotu"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Change Call"
-msgstr ""
+msgstr "Animácia Zmeniť Hovor"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
@@ -68,7 +68,7 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr ""
+msgstr "Nastaviť prechody na:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
@@ -92,7 +92,7 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Edit Selection Curve"
-msgstr ""
+msgstr "Upraviť výber krivky"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
@@ -101,20 +101,19 @@ msgstr ""
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Duplicate Selection"
-msgstr ""
+msgstr "Duplikovať výber"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
msgstr ""
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Remove Selection"
-msgstr "Všetky vybrané"
+msgstr "Odstrániť výber"
#: editor/animation_editor.cpp
msgid "Continuous"
-msgstr ""
+msgstr "Priebežný"
#: editor/animation_editor.cpp
msgid "Discrete"
@@ -134,19 +133,19 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Scale Selection"
-msgstr ""
+msgstr "Zmeniť veľkosť výberu"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
-msgstr ""
+msgstr "Zmeniť veľkosť od kurzora"
#: editor/animation_editor.cpp
msgid "Goto Next Step"
-msgstr ""
+msgstr "PrejsÅ¥ na Äalší krok"
#: editor/animation_editor.cpp
msgid "Goto Prev Step"
-msgstr ""
+msgstr "Prejsť na predchádzajúci krok"
#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
#: editor/property_editor.cpp
@@ -159,23 +158,25 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "In"
-msgstr ""
+msgstr "V"
#: editor/animation_editor.cpp
msgid "Out"
-msgstr ""
+msgstr "Von"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "In-Out"
-msgstr ""
+msgstr "V-Von"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Out-In"
-msgstr ""
+msgstr "Von-V"
#: editor/animation_editor.cpp
msgid "Transitions"
-msgstr ""
+msgstr "Prechody"
#: editor/animation_editor.cpp
msgid "Optimize Animation"
@@ -495,7 +496,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -910,11 +911,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1051,11 +1052,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1126,7 +1127,7 @@ msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
#, fuzzy
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "Vytvoriť adresár"
#: editor/editor_file_dialog.cpp
@@ -1385,17 +1386,21 @@ msgstr ""
msgid "Clear Output"
msgstr "Popis:"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1600,11 +1605,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1617,7 +1622,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1669,7 +1674,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1816,7 +1821,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1828,11 +1833,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1853,15 +1858,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2106,7 +2111,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2218,7 +2223,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2369,7 +2374,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2385,12 +2390,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2451,7 +2450,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2468,7 +2467,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2481,7 +2480,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2615,11 +2614,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2632,15 +2631,15 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2666,7 +2665,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2732,7 +2731,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2744,7 +2743,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2760,7 +2759,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2781,7 +2780,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3199,7 +3198,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3207,7 +3206,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3277,7 +3276,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3344,7 +3343,7 @@ msgid "Site:"
msgstr "Stránka:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3534,6 +3533,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3630,6 +3630,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3920,6 +3928,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3948,7 +3960,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4155,7 +4167,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4520,7 +4532,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4618,7 +4630,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4824,15 +4836,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5287,11 +5299,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5548,7 +5556,7 @@ msgid "Remove All"
msgstr "Všetky vybrané"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5596,6 +5604,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5608,7 +5624,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5799,7 +5815,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5889,6 +5905,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
#, fuzzy
msgid "Couldn't create folder."
msgstr "Vytvoriť adresár"
@@ -6079,7 +6099,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6107,7 +6129,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6224,10 +6246,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6296,7 +6314,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6393,11 +6411,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6570,7 +6588,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7284,6 +7302,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7332,6 +7354,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7933,10 +7959,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8015,7 +8051,7 @@ msgstr ""
#: scene/resources/dynamic_font.cpp
msgid "Invalid font size."
-msgstr ""
+msgstr "Nesprávna veľkosť písma."
#, fuzzy
#~ msgid "Can't write file."
diff --git a/editor/translations/sl.po b/editor/translations/sl.po
index 787d5e23c3..0fe619654f 100644
--- a/editor/translations/sl.po
+++ b/editor/translations/sl.po
@@ -2,17 +2,16 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
-# matevž lapajne <sivar.lapajne@gmail.com>, 2016-2017.
-# Matjaž Vitas <matjaz.vitas@gmail.com>, 2017.
+# matevž lapajne <sivar.lapajne@gmail.com>, 2016-2018.
+# Matjaž Vitas <matjaz.vitas@gmail.com>, 2017-2018.
# Miha Komatar <miha.komatar@gmail.com>, 2018.
# Simon Å ander <simon.sand3r@gmail.com>, 2017.
-#
+# Yahara Octanis <yaharao55@gmail.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-25 22:27+0000\n"
-"Last-Translator: Miha Komatar <miha.komatar@gmail.com>\n"
+"PO-Revision-Date: 2018-06-10 08:44+0000\n"
+"Last-Translator: matevž lapajne <sivar.lapajne@gmail.com>\n"
"Language-Team: Slovenian <https://hosted.weblate.org/projects/godot-engine/"
"godot/sl/>\n"
"Language: sl\n"
@@ -20,7 +19,7 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.0.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -28,130 +27,128 @@ msgstr "OnemogoÄen"
#: editor/animation_editor.cpp
msgid "All Selection"
-msgstr "Vsa izbira"
+msgstr "Celotna izbira"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Time"
-msgstr ""
+msgstr "Animacija Spremeni Äas kljuÄne slike"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr "Anim spremeni prehod"
+msgstr "Animacija Spremeni prehod"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
-msgstr ""
+msgstr "Animacija Spremeni transformacijo"
#: editor/animation_editor.cpp
msgid "Anim Change Keyframe Value"
-msgstr ""
+msgstr "Animacija Spremeni vrednost kljuÄne slike"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
-msgstr "Anim izberi klic"
+msgstr "Animacija Spremeni klic"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
-msgstr ""
+msgstr "Animacija Dodaj sled"
#: editor/animation_editor.cpp
msgid "Anim Duplicate Keys"
-msgstr ""
+msgstr "Animacija Podvoji kljuÄe"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
-msgstr ""
+msgstr "Premakni animacijsko sled gor"
#: editor/animation_editor.cpp
msgid "Move Anim Track Down"
-msgstr ""
+msgstr "Premakni animacijsko sled dol"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
-msgstr ""
+msgstr "Odstrani animacijsko sled"
#: editor/animation_editor.cpp
msgid "Set Transitions to:"
-msgstr "Nastavite Prehode na:"
+msgstr "Nastavi prehode na:"
#: editor/animation_editor.cpp
msgid "Anim Track Rename"
-msgstr ""
+msgstr "Animacija Preimenuj sled"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr ""
+msgstr "Animacija Spremeni interpolacijo sledi"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr ""
+msgstr "Animacija Spremeni naÄin vrednosti sledi"
#: editor/animation_editor.cpp
msgid "Anim Track Change Wrap Mode"
-msgstr ""
+msgstr "Animacija Spremeni naÄin ovijanja sledi"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Edit Node Curve"
-msgstr "Uredi Node Krivuljo"
+msgstr "Uredi krivuljo vozliÅ¡Äa"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Edit Selection Curve"
-msgstr "Uredi Izbor Krivulje"
+msgstr "Uredi Krivulje izbora"
#: editor/animation_editor.cpp
msgid "Anim Delete Keys"
-msgstr ""
+msgstr "Animacija IzbriÅ¡i kljuÄe"
#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Duplicate Selection"
-msgstr "Podvoji Izbrano"
+msgstr "Podvoji izbrano"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
-msgstr ""
+msgstr "Podvoji transponirano"
#: editor/animation_editor.cpp
msgid "Remove Selection"
-msgstr "Odstrani Izbiro"
+msgstr "Odstrani izbrano"
#: editor/animation_editor.cpp
msgid "Continuous"
-msgstr ""
+msgstr "Neprekinjeno"
#: editor/animation_editor.cpp
msgid "Discrete"
-msgstr ""
+msgstr "Diskretno"
#: editor/animation_editor.cpp
msgid "Trigger"
-msgstr ""
+msgstr "Sprožilec"
#: editor/animation_editor.cpp
msgid "Anim Add Key"
-msgstr ""
+msgstr "Animacija Dodaj kljuÄ"
#: editor/animation_editor.cpp
msgid "Anim Move Keys"
-msgstr ""
+msgstr "Animacija Premakni kljuÄ"
#: editor/animation_editor.cpp
msgid "Scale Selection"
-msgstr "PoveÄaj Izbiro"
+msgstr "PoveÄaj izbiro"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
-msgstr ""
+msgstr "PoveÄaj iz kazalca"
#: editor/animation_editor.cpp
msgid "Goto Next Step"
-msgstr "Pojdite na Naslednji Korak"
+msgstr "Pojdi na naslednji korak"
#: editor/animation_editor.cpp
msgid "Goto Prev Step"
-msgstr "Pojdite na Predhodni Korak"
+msgstr "Pojdi na prejšnji korak"
#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
#: editor/property_editor.cpp
@@ -160,7 +157,7 @@ msgstr "Linearno"
#: editor/animation_editor.cpp editor/plugins/theme_editor_plugin.cpp
msgid "Constant"
-msgstr ""
+msgstr "Konstanta"
#: editor/animation_editor.cpp
msgid "In"
@@ -192,11 +189,11 @@ msgstr "PoÄisti Animacijo"
#: editor/animation_editor.cpp
msgid "Create NEW track for %s and insert key?"
-msgstr ""
+msgstr "Ustvarim NOVO sled za %s in vstavim kljuÄ?"
#: editor/animation_editor.cpp
msgid "Create %d NEW tracks and insert keys?"
-msgstr ""
+msgstr "Ustvarim %d NOVO sled in vstavim kljuÄe?"
#: editor/animation_editor.cpp editor/create_dialog.cpp
#: editor/editor_audio_buses.cpp editor/plugins/abstract_polygon_2d_editor.cpp
@@ -208,43 +205,43 @@ msgstr "Ustvari"
#: editor/animation_editor.cpp
msgid "Anim Create & Insert"
-msgstr ""
+msgstr "Ustvari & Vstavi Animacijo"
#: editor/animation_editor.cpp
msgid "Anim Insert Track & Key"
-msgstr ""
+msgstr "V Animacijo Vstavi Sled & KljuÄ"
#: editor/animation_editor.cpp
msgid "Anim Insert Key"
-msgstr ""
+msgstr "V Animacijo Vstavi KljuÄ"
#: editor/animation_editor.cpp
msgid "Change Anim Len"
-msgstr ""
+msgstr "Spremeni Dolžino Animacije"
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
-msgstr ""
+msgstr "Spremeni Zanko Animacije"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
-msgstr ""
+msgstr "V Animaciji Ustvari Vneseno Vrednost KljuÄa"
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr ""
+msgstr "Vstavi Animacijo"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
-msgstr ""
+msgstr "Spremeni Obseg KljuÄev"
#: editor/animation_editor.cpp
msgid "Anim Add Call Track"
-msgstr ""
+msgstr "Dodaj KlicajoÄo Sled v Animacijo"
#: editor/animation_editor.cpp
msgid "Animation zoom."
-msgstr "Približaj Animacijo"
+msgstr "Približaj animacijo."
#: editor/animation_editor.cpp
msgid "Length (s):"
@@ -252,7 +249,7 @@ msgstr "Dolžina (s):"
#: editor/animation_editor.cpp
msgid "Animation length (in seconds)."
-msgstr ""
+msgstr "Dolžina animacije (v sekundah)."
#: editor/animation_editor.cpp
msgid "Step (s):"
@@ -260,39 +257,39 @@ msgstr "Korak (s):"
#: editor/animation_editor.cpp
msgid "Cursor step snap (in seconds)."
-msgstr ""
+msgstr "Korak postavitve kazalca (v sekundah)."
#: editor/animation_editor.cpp
msgid "Enable/Disable looping in animation."
-msgstr ""
+msgstr "OmogoÄi/OnemogoÄi zankanje v animaciji."
#: editor/animation_editor.cpp
msgid "Add new tracks."
-msgstr ""
+msgstr "Dodaj Novo Sled."
#: editor/animation_editor.cpp
msgid "Move current track up."
-msgstr ""
+msgstr "Trenutno sled premakni gor."
#: editor/animation_editor.cpp
msgid "Move current track down."
-msgstr ""
+msgstr "Trenutno sled premakni dol."
#: editor/animation_editor.cpp
msgid "Remove selected track."
-msgstr ""
+msgstr "Odstrani izbrano sled."
#: editor/animation_editor.cpp
msgid "Track tools"
-msgstr ""
+msgstr "Orodja sledi"
#: editor/animation_editor.cpp
msgid "Enable editing of individual keys by clicking them."
-msgstr ""
+msgstr "S klikom na posamezne kljuÄe omogoÄite njihovo urejanje."
#: editor/animation_editor.cpp
msgid "Anim. Optimizer"
-msgstr ""
+msgstr "Optimizacija Animacije"
#: editor/animation_editor.cpp
msgid "Max. Linear Error:"
@@ -308,11 +305,12 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Optimize"
-msgstr ""
+msgstr "Optimiziraj"
#: editor/animation_editor.cpp
msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
msgstr ""
+"Če želite urediti animacije, izberite AnimationPlayer iz drevesa scene."
#: editor/animation_editor.cpp
msgid "Key"
@@ -320,15 +318,15 @@ msgstr "ÄŒrka"
#: editor/animation_editor.cpp
msgid "Transition"
-msgstr ""
+msgstr "Prehod"
#: editor/animation_editor.cpp
msgid "Scale Ratio:"
-msgstr ""
+msgstr "Razmerje Obsega:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr ""
+msgstr "Klic funkcije v katerem gradniku?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
@@ -336,7 +334,7 @@ msgstr "Odstrani nedovoljene ÄŒrke"
#: editor/animation_editor.cpp
msgid "Remove unresolved and empty tracks"
-msgstr ""
+msgstr "Odstrani nedoloÄene in prazne sledi"
#: editor/animation_editor.cpp
msgid "Clean-up all animations"
@@ -344,11 +342,11 @@ msgstr "Pobriši vse animacije"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation(s) (NO UNDO!)"
-msgstr "Izbriši Animacij(o/e) (BREZ VRNITVE)"
+msgstr "Izbriši Animacijo/e (BREZ VRNITVE!)"
#: editor/animation_editor.cpp
msgid "Clean-Up"
-msgstr "Pobriši"
+msgstr "PoÄisti"
#: editor/array_property_edit.cpp
msgid "Resize Array"
@@ -356,35 +354,35 @@ msgstr "PoveÄaj Niz"
#: editor/array_property_edit.cpp
msgid "Change Array Value Type"
-msgstr ""
+msgstr "Spremeni Tip Vrednosti Niza"
#: editor/array_property_edit.cpp
msgid "Change Array Value"
-msgstr ""
+msgstr "Spremeni Vrednost Niza"
#: editor/code_editor.cpp
msgid "Go to Line"
-msgstr ""
+msgstr "Pojdi na Vrstico"
#: editor/code_editor.cpp
msgid "Line Number:"
-msgstr "Å tevilka vrste:"
+msgstr "Å tevilka Vrste:"
#: editor/code_editor.cpp
msgid "No Matches"
-msgstr ""
+msgstr "Ni Zadetkov"
#: editor/code_editor.cpp
msgid "Replaced %d occurrence(s)."
-msgstr ""
+msgstr "Zamenjana %d ponovitev/e."
#: editor/code_editor.cpp
msgid "Match Case"
-msgstr ""
+msgstr "Ujemanje Velikih ÄŒrk"
#: editor/code_editor.cpp
msgid "Whole Words"
-msgstr ""
+msgstr "Cele Besede"
#: editor/code_editor.cpp
msgid "Replace"
@@ -392,82 +390,84 @@ msgstr "Zamenjaj"
#: editor/code_editor.cpp
msgid "Replace All"
-msgstr ""
+msgstr "Zamenjaj Vse"
#: editor/code_editor.cpp
msgid "Selection Only"
-msgstr ""
+msgstr "Samo Izbira"
#: editor/code_editor.cpp
msgid "Zoom In"
-msgstr ""
+msgstr "Približaj"
#: editor/code_editor.cpp
msgid "Zoom Out"
-msgstr ""
+msgstr "Oddalji"
#: editor/code_editor.cpp
msgid "Reset Zoom"
-msgstr ""
+msgstr "Ponastavi PoveÄavo/PomanjÅ¡avo"
#: editor/code_editor.cpp editor/script_editor_debugger.cpp
msgid "Line:"
-msgstr ""
+msgstr "Vrstica:"
#: editor/code_editor.cpp
msgid "Col:"
-msgstr ""
+msgstr "Stolpec:"
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
-msgstr ""
+msgstr "Metoda v ciljnem gradniku mora biti navedena!"
#: editor/connections_dialog.cpp
msgid ""
"Target method not found! Specify a valid method or attach a script to target "
"Node."
msgstr ""
+"Ciljna metoda ni bila najdena! Navedite veljavno metodo ali priložite "
+"skripto, ki cilja na Gradnik."
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
-msgstr ""
+msgstr "Poveži se z Gradnikom:"
#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
msgid "Add"
-msgstr ""
+msgstr "Dodaj"
#: editor/connections_dialog.cpp editor/dependency_editor.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_manager.cpp
#: editor/project_settings_editor.cpp
msgid "Remove"
-msgstr ""
+msgstr "Odstrani"
#: editor/connections_dialog.cpp
msgid "Add Extra Call Argument:"
-msgstr ""
+msgstr "Dodaj Dodaten Klicni Argument:"
#: editor/connections_dialog.cpp
msgid "Extra Call Arguments:"
-msgstr ""
+msgstr "Dodatni Klicni Argumenti:"
#: editor/connections_dialog.cpp
msgid "Path to Node:"
-msgstr ""
+msgstr "Pot do Gradnika:"
#: editor/connections_dialog.cpp
msgid "Make Function"
-msgstr ""
+msgstr "Naredi Funkcijo"
#: editor/connections_dialog.cpp
msgid "Deferred"
-msgstr ""
+msgstr "Odloženo"
#: editor/connections_dialog.cpp
msgid "Oneshot"
-msgstr ""
+msgstr "En Poizkus"
#: editor/connections_dialog.cpp editor/dependency_editor.cpp
#: editor/export_template_manager.cpp
@@ -485,37 +485,36 @@ msgstr "Zapri"
#: editor/connections_dialog.cpp
msgid "Connect"
-msgstr ""
+msgstr "Poveži"
#: editor/connections_dialog.cpp
msgid "Connect '%s' to '%s'"
-msgstr ""
+msgstr "Poveži '%s' v '%s'"
#: editor/connections_dialog.cpp
msgid "Connecting Signal:"
-msgstr ""
+msgstr "Povezovanje Signala:"
#: editor/connections_dialog.cpp
msgid "Disconnect '%s' from '%s'"
-msgstr ""
+msgstr "Odklopite '%s' iz '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr ""
+msgid "Connect..."
+msgstr "Poveži..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Disconnect"
-msgstr ""
+msgstr "Odklopi"
#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
msgid "Signals"
-msgstr ""
+msgstr "Signali"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Change %s Type"
-msgstr "Osnovni Tip:"
+msgstr "Spremeni Tip %s"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
@@ -523,103 +522,106 @@ msgid "Change"
msgstr "Spremeni"
#: editor/create_dialog.cpp
-#, fuzzy
msgid "Create New %s"
-msgstr "Ustvari"
+msgstr "Ustvari Nov %s"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp
msgid "Favorites:"
-msgstr ""
+msgstr "Priljubljene:"
#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
msgid "Recent:"
-msgstr ""
+msgstr "Nedavni:"
#: editor/create_dialog.cpp editor/editor_node.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp
msgid "Search:"
-msgstr ""
+msgstr "Iskanje:"
#: editor/create_dialog.cpp editor/editor_help.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp
msgid "Matches:"
-msgstr ""
+msgstr "Zadetki:"
#: editor/create_dialog.cpp editor/editor_help.cpp
#: editor/plugins/asset_library_editor_plugin.cpp editor/property_selector.cpp
#: editor/script_editor_debugger.cpp
msgid "Description:"
-msgstr ""
+msgstr "Opis:"
#: editor/dependency_editor.cpp
msgid "Search Replacement For:"
-msgstr ""
+msgstr "Iskanje Zamenjave Za:"
#: editor/dependency_editor.cpp
msgid "Dependencies For:"
-msgstr ""
+msgstr "Odvisnosti Za:"
#: editor/dependency_editor.cpp
msgid ""
"Scene '%s' is currently being edited.\n"
"Changes will not take effect unless reloaded."
msgstr ""
+"Scena '%s' je trenutno v urejanju.\n"
+"Spremembe bodo zaÄele veljati, ko bodo znova naložene."
#: editor/dependency_editor.cpp
msgid ""
"Resource '%s' is in use.\n"
"Changes will take effect when reloaded."
msgstr ""
+"Vir '%s' je v uporabi.\n"
+"Spremembe bodo zaÄele veljati, ko bodo znova naložene."
#: editor/dependency_editor.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Dependencies"
-msgstr ""
+msgstr "Odvisnosti"
#: editor/dependency_editor.cpp
msgid "Resource"
-msgstr ""
+msgstr "Viri"
#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
#: editor/project_manager.cpp editor/project_settings_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Path"
-msgstr ""
+msgstr "Pot"
#: editor/dependency_editor.cpp
msgid "Dependencies:"
-msgstr ""
+msgstr "Odvisnosti:"
#: editor/dependency_editor.cpp
msgid "Fix Broken"
-msgstr ""
+msgstr "Popravi Pokvarjeno"
#: editor/dependency_editor.cpp
msgid "Dependency Editor"
-msgstr ""
+msgstr "Urejevalnik Odvisnosti"
#: editor/dependency_editor.cpp
msgid "Search Replacement Resource:"
-msgstr ""
+msgstr "Iskanje Nadomestnih Virov:"
#: editor/dependency_editor.cpp editor/editor_file_dialog.cpp
#: editor/editor_help.cpp editor/editor_node.cpp editor/filesystem_dock.cpp
#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
#: editor/quick_open.cpp scene/gui/file_dialog.cpp
msgid "Open"
-msgstr ""
+msgstr "Odpri"
#: editor/dependency_editor.cpp
msgid "Owners Of:"
-msgstr ""
+msgstr "Lastniki:"
#: editor/dependency_editor.cpp
msgid "Remove selected files from the project? (no undo)"
-msgstr ""
+msgstr "Odstranim izbrane datoteke iz projekta? (brez vrnitve)"
#: editor/dependency_editor.cpp
msgid ""
@@ -627,54 +629,56 @@ msgid ""
"work.\n"
"Remove them anyway? (no undo)"
msgstr ""
+"Izbrisane datoteke so potrebne za delovanje drugih virov.\n"
+"Ali jih vseeno odstranim? (brez vrnitve)"
#: editor/dependency_editor.cpp
msgid "Cannot remove:"
-msgstr ""
+msgstr "Ni mogoÄe odstraniti:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
-msgstr ""
+msgstr "Napaka pri nalaganju:"
#: editor/dependency_editor.cpp
msgid "Scene failed to load due to missing dependencies:"
-msgstr ""
+msgstr "Nalaganje scene je spodletelo zaradi manjkajoÄih odvisnosti:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Open Anyway"
-msgstr ""
+msgstr "Vseeno Odpri"
#: editor/dependency_editor.cpp
msgid "Which action should be taken?"
-msgstr ""
+msgstr "Katere ukrepe je treba sprejeti?"
#: editor/dependency_editor.cpp
msgid "Fix Dependencies"
-msgstr ""
+msgstr "Popravi Odvisnosti"
#: editor/dependency_editor.cpp
msgid "Errors loading!"
-msgstr ""
+msgstr "Napake pri nalaganju!"
#: editor/dependency_editor.cpp
msgid "Permanently delete %d item(s)? (No undo!)"
-msgstr ""
+msgstr "Trajno izbrišem %d predmet(e)? (Brez vrnitve!)"
#: editor/dependency_editor.cpp
msgid "Owns"
-msgstr ""
+msgstr "Lastnik"
#: editor/dependency_editor.cpp
msgid "Resources Without Explicit Ownership:"
-msgstr ""
+msgstr "Viri Brez Izrecnega Lastništva:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Orphan Resource Explorer"
-msgstr ""
+msgstr "Raziskovalec Osamljenih Virov"
#: editor/dependency_editor.cpp
msgid "Delete selected files?"
-msgstr ""
+msgstr "Izbrišem izbrane datoteke?"
#: editor/dependency_editor.cpp editor/editor_audio_buses.cpp
#: editor/editor_file_dialog.cpp editor/editor_node.cpp
@@ -682,83 +686,83 @@ msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
#: editor/scene_tree_dock.cpp
msgid "Delete"
-msgstr ""
+msgstr "Izbriši"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Key"
-msgstr ""
+msgstr "Spremeni Slovarski KljuÄ"
#: editor/dictionary_property_edit.cpp
msgid "Change Dictionary Value"
-msgstr ""
+msgstr "Spremeni Slovarsko Vrednost"
#: editor/editor_about.cpp
msgid "Thanks from the Godot community!"
-msgstr ""
+msgstr "Zahvaljujemo se vam iz skupnosti Godota!"
#: editor/editor_about.cpp
msgid "Thanks!"
-msgstr ""
+msgstr "Hvala!"
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
-msgstr ""
+msgstr "Godot Engine sodelovci"
#: editor/editor_about.cpp
msgid "Project Founders"
-msgstr ""
+msgstr "Ustanovitelji Projekta"
#: editor/editor_about.cpp
msgid "Lead Developer"
-msgstr ""
+msgstr "Vodilni Razvajalec"
#: editor/editor_about.cpp
msgid "Project Manager "
-msgstr ""
+msgstr "Upravljalnik Projekta "
#: editor/editor_about.cpp
msgid "Developers"
-msgstr ""
+msgstr "Razvajalci"
#: editor/editor_about.cpp
msgid "Authors"
-msgstr ""
+msgstr "Avtorji"
#: editor/editor_about.cpp
msgid "Platinum Sponsors"
-msgstr ""
+msgstr "Platina Sponzorji"
#: editor/editor_about.cpp
msgid "Gold Sponsors"
-msgstr ""
+msgstr "Zlati Sponzorji"
#: editor/editor_about.cpp
msgid "Mini Sponsors"
-msgstr ""
+msgstr "Majhni Sponzorji"
#: editor/editor_about.cpp
msgid "Gold Donors"
-msgstr ""
+msgstr "Zlati Donatorji"
#: editor/editor_about.cpp
msgid "Silver Donors"
-msgstr ""
+msgstr "Srebrni Donatorji"
#: editor/editor_about.cpp
msgid "Bronze Donors"
-msgstr ""
+msgstr "Bronasti Donatorji"
#: editor/editor_about.cpp
msgid "Donors"
-msgstr ""
+msgstr "Donatorji"
#: editor/editor_about.cpp
msgid "License"
-msgstr ""
+msgstr "Licenca"
#: editor/editor_about.cpp
msgid "Thirdparty License"
-msgstr ""
+msgstr "Licenca Tretjih Oseb"
#: editor/editor_about.cpp
msgid ""
@@ -767,512 +771,512 @@ msgid ""
"is an exhaustive list of all such thirdparty components with their "
"respective copyright statements and license terms."
msgstr ""
+"Godot Engine se nanaÅ¡a na Å¡tevilne brezplaÄne in odprokodne knjižnice tretih "
+"oseb, ki so združljive z doloÄili MIT licence. SledeÄi obÅ¡iren seznam "
+"predstavi komponente tretjih oseb s pripadajoÄimi izjavami o avtorskih "
+"pravicah in licenÄnimi pogoji."
#: editor/editor_about.cpp
msgid "All Components"
-msgstr ""
+msgstr "Vse Komponente"
#: editor/editor_about.cpp
msgid "Components"
-msgstr ""
+msgstr "Komponente"
#: editor/editor_about.cpp
msgid "Licenses"
-msgstr ""
+msgstr "Licence"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Error opening package file, not in zip format."
-msgstr ""
+msgstr "Napaka pri odpiranju datoteke paketa, ker ni v formatu zip."
#: editor/editor_asset_installer.cpp
msgid "Uncompressing Assets"
-msgstr ""
+msgstr "Razširjenje Dodatkov"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Package Installed Successfully!"
-msgstr ""
+msgstr "Paket je UspeÅ¡no NameÅ¡Äen!"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Success!"
-msgstr ""
+msgstr "Uspelo je!"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Install"
-msgstr ""
+msgstr "Namesti"
#: editor/editor_asset_installer.cpp
msgid "Package Installer"
-msgstr ""
+msgstr "Namestnik Paketov"
#: editor/editor_audio_buses.cpp
msgid "Speakers"
-msgstr ""
+msgstr "ZvoÄniki"
#: editor/editor_audio_buses.cpp
msgid "Add Effect"
-msgstr ""
+msgstr "Dodaj UÄinek"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Rename Audio Bus"
-msgstr "Preimenuj Funkcijo"
+msgstr "Preimenuj ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Change Audio Bus Volume"
-msgstr "Preimenuj Funkcijo"
+msgstr "Spremeni Glasnost ZvoÄnega Vodila"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Solo"
-msgstr ""
+msgstr "Preklopi samo na ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Mute"
-msgstr ""
+msgstr "Preklopi na Tihi NaÄin ZvoÄnega Vodila"
#: editor/editor_audio_buses.cpp
msgid "Toggle Audio Bus Bypass Effects"
-msgstr ""
+msgstr "Preklopi na UÄinke Prehoda ZvoÄnega Vodila"
#: editor/editor_audio_buses.cpp
msgid "Select Audio Bus Send"
-msgstr ""
+msgstr "Izberi PoÅ¡lji možnost ZvoÄnega vodila"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
-msgstr ""
+msgstr "Dodaj uÄinek ZvoÄnega Vodila"
#: editor/editor_audio_buses.cpp
msgid "Move Bus Effect"
-msgstr ""
+msgstr "Premakni uÄinek Vodila"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Delete Bus Effect"
-msgstr "Izbriši Izbrano"
+msgstr "IzbriÅ¡i uÄinek Vodila"
#: editor/editor_audio_buses.cpp
msgid "Audio Bus, Drag and Drop to rearrange."
-msgstr ""
+msgstr "ZvoÄno Vodilo, Povelci in Izpusti za preureditev."
#: editor/editor_audio_buses.cpp
msgid "Solo"
-msgstr ""
+msgstr "Sam"
#: editor/editor_audio_buses.cpp
msgid "Mute"
-msgstr ""
+msgstr "Nem"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
-msgstr ""
+msgstr "Prehod"
#: editor/editor_audio_buses.cpp
msgid "Bus options"
-msgstr ""
+msgstr "Možnosti Vodila"
#: editor/editor_audio_buses.cpp editor/filesystem_dock.cpp
#: editor/plugins/tile_map_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Duplicate"
-msgstr ""
+msgstr "Podvoji"
#: editor/editor_audio_buses.cpp
msgid "Reset Volume"
-msgstr ""
+msgstr "Ponastavi Glasnost"
#: editor/editor_audio_buses.cpp
-#, fuzzy
msgid "Delete Effect"
-msgstr "Izbriši Izbrano"
+msgstr "IzbriÅ¡i UÄinek"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Zvok"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
-msgstr ""
+msgstr "Dodaj ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
msgid "Master bus can't be deleted!"
-msgstr ""
+msgstr "Glavno vodilo ni mogoÄe izbrisati!"
#: editor/editor_audio_buses.cpp
msgid "Delete Audio Bus"
-msgstr ""
+msgstr "IzbriÅ¡i ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
msgid "Duplicate Audio Bus"
-msgstr ""
+msgstr "Podvoji ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
msgid "Reset Bus Volume"
-msgstr ""
+msgstr "Ponastavi Glasnost Vodila"
#: editor/editor_audio_buses.cpp
msgid "Move Audio Bus"
-msgstr ""
+msgstr "Premakni ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr ""
+msgid "Save Audio Bus Layout As..."
+msgstr "Shrani Postavitev ZvoÄnega Vodila Kot..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr ""
+msgid "Location for New Layout..."
+msgstr "Lokacija za Novo Postavitev..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
-msgstr ""
+msgstr "Odpri ZvoÄno Vodilo"
#: editor/editor_audio_buses.cpp
msgid "There is no 'res://default_bus_layout.tres' file."
-msgstr ""
+msgstr "Datoteka 'res://default_bus_layout.tres' ne obstaja."
#: editor/editor_audio_buses.cpp
msgid "Invalid file, not an audio bus layout."
-msgstr ""
+msgstr "Neveljavna datoteka, ker ni postavitve zvoÄnega vodila."
#: editor/editor_audio_buses.cpp
msgid "Add Bus"
-msgstr ""
+msgstr "Dodaj Vodilo"
#: editor/editor_audio_buses.cpp
msgid "Create a new Bus Layout."
-msgstr ""
+msgstr "Ustvari novo Postavitev Vodila."
#: editor/editor_audio_buses.cpp editor/property_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Load"
-msgstr ""
+msgstr "Naloži"
#: editor/editor_audio_buses.cpp
msgid "Load an existing Bus Layout."
-msgstr ""
+msgstr "Naloži obstojeÄo Postavitev Vodila."
#: editor/editor_audio_buses.cpp
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Save As"
-msgstr ""
+msgstr "Shrani Kot"
#: editor/editor_audio_buses.cpp
msgid "Save this Bus Layout to a file."
-msgstr ""
+msgstr "Shrani to Postavitev Vodila v datoteko."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
msgid "Load Default"
-msgstr ""
+msgstr "Naložite Prevzeto"
#: editor/editor_audio_buses.cpp
msgid "Load the default Bus Layout."
-msgstr ""
+msgstr "Naloži prevezeto Postavitev Vodila."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name."
-msgstr ""
+msgstr "Neveljavno ime."
#: editor/editor_autoload_settings.cpp
msgid "Valid characters:"
-msgstr ""
+msgstr "Veljavni znaki:"
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing engine class name."
-msgstr ""
+msgstr "Neveljavno ime. Ne sme se prekrivati z obstojeÄim imenom razreda."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing buit-in type name."
msgstr ""
+"Neveljavno ime. Ne sme se prekrivati z obstojeÄim vgrajenim imenom tipa."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing global constant name."
msgstr ""
+"Neveljavno ime. Ne sme se prekrivati z obstojeÄim imenom globalne konstante."
#: editor/editor_autoload_settings.cpp
msgid "Invalid Path."
-msgstr ""
+msgstr "Neveljavna Pot."
#: editor/editor_autoload_settings.cpp
msgid "File does not exist."
-msgstr ""
+msgstr "Datoteka ne obstaja."
#: editor/editor_autoload_settings.cpp
msgid "Not in resource path."
-msgstr ""
+msgstr "Ni na poti virov."
#: editor/editor_autoload_settings.cpp
msgid "Add AutoLoad"
-msgstr ""
+msgstr "Dodaj SamodejnoNalaganje"
#: editor/editor_autoload_settings.cpp
msgid "Autoload '%s' already exists!"
-msgstr ""
+msgstr "SamodejnoNalaganje '%s' že obstaja!"
#: editor/editor_autoload_settings.cpp
msgid "Rename Autoload"
-msgstr ""
+msgstr "Preimenuj SamodejnoNalaganje"
#: editor/editor_autoload_settings.cpp
msgid "Toggle AutoLoad Globals"
-msgstr ""
+msgstr "Preklopi na Globalno SamodejnoNalaganje"
#: editor/editor_autoload_settings.cpp
msgid "Move Autoload"
-msgstr ""
+msgstr "Premakni SamodejnoNalaganje"
#: editor/editor_autoload_settings.cpp
msgid "Remove Autoload"
-msgstr ""
+msgstr "Odstrani SamodejnoNalaganje"
#: editor/editor_autoload_settings.cpp
msgid "Enable"
-msgstr ""
+msgstr "OmogoÄi"
#: editor/editor_autoload_settings.cpp
msgid "Rearrange Autoloads"
-msgstr ""
+msgstr "Preuredi SamodejnoNalaganje"
#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
#: scene/gui/file_dialog.cpp
msgid "Path:"
-msgstr ""
+msgstr "Pot:"
#: editor/editor_autoload_settings.cpp
msgid "Node Name:"
-msgstr ""
+msgstr "Ime Gradnika:"
#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
#: editor/project_manager.cpp editor/settings_config_dialog.cpp
msgid "Name"
-msgstr ""
+msgstr "Ime"
#: editor/editor_autoload_settings.cpp
msgid "Singleton"
-msgstr ""
+msgstr "Posameznik"
#: editor/editor_data.cpp
msgid "Updating Scene"
-msgstr ""
+msgstr "Posodabljanje Scene"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr ""
+msgid "Storing local changes..."
+msgstr "Shranjevanje lokalnih sprememb..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr ""
+msgid "Updating scene..."
+msgstr "Posodabljanje scene..."
#: editor/editor_data.cpp
msgid "[empty]"
-msgstr ""
+msgstr "[prazno]"
#: editor/editor_data.cpp
msgid "[unsaved]"
-msgstr ""
+msgstr "[neshranjeno]"
#: editor/editor_dir_dialog.cpp
msgid "Please select a base directory first"
-msgstr ""
+msgstr "Najprej izberi osnovno mapo"
#: editor/editor_dir_dialog.cpp
msgid "Choose a Directory"
-msgstr ""
+msgstr "Izberi Mapo"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
msgid "Create Folder"
-msgstr ""
+msgstr "Ustvarite Mapo"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
#: scene/gui/file_dialog.cpp
msgid "Name:"
-msgstr ""
+msgstr "Ime:"
#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
msgid "Could not create folder."
-msgstr ""
+msgstr "Mape ni mogoÄe ustvariti."
#: editor/editor_dir_dialog.cpp
msgid "Choose"
-msgstr ""
+msgstr "Izberi"
#: editor/editor_export.cpp
msgid "Storing File:"
-msgstr ""
+msgstr "Shranjevanje Datoteke:"
#: editor/editor_export.cpp
msgid "Packing"
-msgstr ""
+msgstr "Pakiranje"
#: editor/editor_export.cpp platform/javascript/export/export.cpp
msgid "Template file not found:"
-msgstr ""
+msgstr "Predloge ni mogoÄe najti:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "File Exists, Overwrite?"
-msgstr ""
+msgstr "Datoteka Obstaja, Prepišem?"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select Current Folder"
-msgstr "Dodaj Setter Lastnost"
+msgstr "Izberite Trenutno Mapo"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Copy Path"
-msgstr ""
+msgstr "Kopiraj Pot"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
msgid "Show In File Manager"
-msgstr ""
+msgstr "Pokaži V Upravitelju Datotek"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr ""
+msgid "New Folder..."
+msgstr "Nova Mapa..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
-msgstr ""
+msgstr "Osveži"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Recognized"
-msgstr ""
+msgstr "Vse Prepoznano"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Files (*)"
-msgstr ""
+msgstr "Vse Datoteke (*)"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a File"
-msgstr ""
+msgstr "Odpri v Datoteki"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open File(s)"
-msgstr ""
+msgstr "Odpri Datotek(o/e)"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a Directory"
-msgstr ""
+msgstr "Odpri v Mapi"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a File or Directory"
-msgstr ""
+msgstr "Odpri Datoteko ali Mapo"
#: editor/editor_file_dialog.cpp editor/editor_node.cpp
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp scene/gui/file_dialog.cpp
msgid "Save"
-msgstr ""
+msgstr "Shrani"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Save a File"
-msgstr ""
+msgstr "Shrani Datoteko"
#: editor/editor_file_dialog.cpp
msgid "Go Back"
-msgstr ""
+msgstr "Pojdi Nazaj"
#: editor/editor_file_dialog.cpp
msgid "Go Forward"
-msgstr ""
+msgstr "Pojdi Naprej"
#: editor/editor_file_dialog.cpp
msgid "Go Up"
-msgstr ""
+msgstr "Pojdi Navzgor"
#: editor/editor_file_dialog.cpp
msgid "Toggle Hidden Files"
-msgstr ""
+msgstr "Preklopi na Skrite Datoteke"
#: editor/editor_file_dialog.cpp
msgid "Toggle Favorite"
-msgstr ""
+msgstr "Preklopi na Najljubše"
#: editor/editor_file_dialog.cpp
msgid "Toggle Mode"
-msgstr ""
+msgstr "Preklopi NaÄin"
#: editor/editor_file_dialog.cpp
msgid "Focus Path"
-msgstr ""
+msgstr "Poudari Pot"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Up"
-msgstr ""
+msgstr "Premakni Priljubljeno Navzgor"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Down"
-msgstr ""
+msgstr "Premakni Priljubljeno Navzdol"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Go to parent folder"
-msgstr ""
+msgstr "Pojdi v nadrejeno mapo"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Directories & Files:"
-msgstr ""
+msgstr "Mape & Datoteke:"
#: editor/editor_file_dialog.cpp
msgid "Preview:"
-msgstr ""
+msgstr "Predogled:"
#: editor/editor_file_dialog.cpp editor/script_editor_debugger.cpp
#: scene/gui/file_dialog.cpp
msgid "File:"
-msgstr ""
+msgstr "Datoteka:"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Must use a valid extension."
-msgstr ""
+msgstr "Uporabiti moraš valjavno razširitev."
#: editor/editor_file_system.cpp
msgid "ScanSources"
-msgstr ""
+msgstr "BranjeVirov"
#: editor/editor_file_system.cpp
msgid "(Re)Importing Assets"
-msgstr ""
+msgstr "Uvoz Dodatkov"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
msgid "Search Help"
-msgstr ""
+msgstr "IÅ¡Äi PomoÄ"
#: editor/editor_help.cpp
msgid "Class List:"
-msgstr ""
+msgstr "Seznam Razredov:"
#: editor/editor_help.cpp
msgid "Search Classes"
-msgstr ""
+msgstr "IÅ¡Äi Razrede"
#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Top"
-msgstr ""
+msgstr "Vrh"
#: editor/editor_help.cpp editor/property_editor.cpp
msgid "Class:"
-msgstr ""
+msgstr "Razred:"
#: editor/editor_help.cpp editor/scene_tree_editor.cpp
msgid "Inherits:"
-msgstr ""
+msgstr "Dedovanja:"
#: editor/editor_help.cpp
msgid "Inherited by:"
-msgstr ""
+msgstr "Podedovano od:"
#: editor/editor_help.cpp
msgid "Brief Description:"
-msgstr ""
+msgstr "Kratek Opis:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Members"
-msgstr "ÄŒlani:"
+msgstr "ÄŒlani"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Members:"
@@ -1280,53 +1284,51 @@ msgstr "ÄŒlani:"
#: editor/editor_help.cpp
msgid "Public Methods"
-msgstr ""
+msgstr "Javne Metode"
#: editor/editor_help.cpp
msgid "Public Methods:"
-msgstr ""
+msgstr "Javne Metode:"
#: editor/editor_help.cpp
msgid "GUI Theme Items"
-msgstr ""
+msgstr "Elementi GUI Teme"
#: editor/editor_help.cpp
msgid "GUI Theme Items:"
-msgstr ""
+msgstr "Elementi GUI Teme:"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Signals:"
msgstr "Signali:"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Enumerations"
-msgstr "Funkcije:"
+msgstr "OÅ¡tevilÄenja"
#: editor/editor_help.cpp
-#, fuzzy
msgid "Enumerations:"
-msgstr "Funkcije:"
+msgstr "OÅ¡tevilÄenja:"
#: editor/editor_help.cpp
msgid "enum "
-msgstr ""
+msgstr "oštevil "
#: editor/editor_help.cpp
msgid "Constants"
-msgstr ""
+msgstr "Konstante"
#: editor/editor_help.cpp
msgid "Constants:"
-msgstr ""
+msgstr "Konstante:"
#: editor/editor_help.cpp
msgid "Description"
-msgstr ""
+msgstr "Opis"
#: editor/editor_help.cpp
msgid "Online Tutorials:"
-msgstr ""
+msgstr "Spletne Vaje:"
#: editor/editor_help.cpp
msgid ""
@@ -1334,160 +1336,172 @@ msgid ""
"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
"url][/color]."
msgstr ""
+"Trenutno ni vaj za ta razred, lahko ga [color=$color][url=$url]prispevate[/"
+"url][/color] ali [color=$color][url=$url2]zahtevate enega[/url][/color]."
#: editor/editor_help.cpp
msgid "Properties"
-msgstr ""
+msgstr "Lastnosti"
#: editor/editor_help.cpp
msgid "Property Description:"
-msgstr ""
+msgstr "Opis lastnosti:"
#: editor/editor_help.cpp
msgid ""
"There is currently no description for this property. Please help us by "
"[color=$color][url=$url]contributing one[/url][/color]!"
msgstr ""
+"Trenutno ni opisa za to lastnost. Pomagajte nam s [color=$color][url="
+"$url]prispevkom[/url][/color]!"
#: editor/editor_help.cpp
msgid "Methods"
-msgstr ""
+msgstr "Metode"
#: editor/editor_help.cpp
msgid "Method Description:"
-msgstr ""
+msgstr "Opis Metode:"
#: editor/editor_help.cpp
msgid ""
"There is currently no description for this method. Please help us by [color="
"$color][url=$url]contributing one[/url][/color]!"
msgstr ""
+"Trenutno ni opisa za to metodo. Pomagajte nam s [color=$color][url="
+"$url]prispevkom[/url][/color]!"
#: editor/editor_help.cpp
msgid "Search Text"
-msgstr ""
+msgstr "IÅ¡Äi Besedilo"
#: editor/editor_help.cpp
msgid "Find"
-msgstr ""
+msgstr "Najdi"
#: editor/editor_log.cpp
msgid "Output:"
-msgstr ""
+msgstr "Izhod:"
#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/property_editor.cpp editor/script_editor_debugger.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
msgid "Clear"
-msgstr ""
+msgstr "PoÄisti"
#: editor/editor_log.cpp
msgid "Clear Output"
-msgstr ""
+msgstr "PoÄisti Izhod"
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Izvoz projekta ni uspelo s kodno napako %d."
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
-msgstr ""
+msgstr "Napaka pri shranjevanju virov!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr ""
+msgid "Save Resource As..."
+msgstr "Shrani Vire Kot..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr ""
+msgid "I see..."
+msgstr "Vidim..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
-msgstr ""
+msgstr "Datoteke ni mogoÄe odpreti za pisanje:"
#: editor/editor_node.cpp
msgid "Requested file format unknown:"
-msgstr ""
+msgstr "Zahtevan format datoteke ni znan:"
#: editor/editor_node.cpp
msgid "Error while saving."
-msgstr ""
+msgstr "Napaka med shranjevanjem."
#: editor/editor_node.cpp
msgid "Can't open '%s'."
-msgstr ""
+msgstr "Ni mogoÄe odpreti '%s'."
#: editor/editor_node.cpp
msgid "Error while parsing '%s'."
-msgstr ""
+msgstr "Napaka pri razÄlenjevanju '%s'."
#: editor/editor_node.cpp
msgid "Unexpected end of file '%s'."
-msgstr ""
+msgstr "NepriÄakovan konec datoteke '%s'."
#: editor/editor_node.cpp
msgid "Missing '%s' or its dependencies."
-msgstr ""
+msgstr "Manjka '%s' ali njegove odvisnosti."
#: editor/editor_node.cpp
msgid "Error while loading '%s'."
-msgstr ""
+msgstr "Napaka pri nalaganju '%s'."
#: editor/editor_node.cpp
msgid "Saving Scene"
-msgstr ""
+msgstr "Shranjevanje Scene"
#: editor/editor_node.cpp
msgid "Analyzing"
-msgstr ""
+msgstr "Analiziranje"
#: editor/editor_node.cpp
msgid "Creating Thumbnail"
-msgstr ""
+msgstr "Ustvarjanje SliÄic"
#: editor/editor_node.cpp
msgid "This operation can't be done without a tree root."
-msgstr ""
+msgstr "Te operacije ne moremo storiti brez osnovnega drevesa."
#: editor/editor_node.cpp
msgid ""
"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
"be satisfied."
msgstr ""
+"Ni mogoÄe shraniti scene. Najverjetneje odvisnosti (primeri ali dedovanja) "
+"ne morejo biti izpolnjene."
#: editor/editor_node.cpp
msgid "Failed to load resource."
-msgstr ""
+msgstr "Napaka pri nalaganju vira."
#: editor/editor_node.cpp
msgid "Can't load MeshLibrary for merging!"
-msgstr ""
+msgstr "Knjižnice Modelov ni mogoÄe naložiti za združitev!"
#: editor/editor_node.cpp
msgid "Error saving MeshLibrary!"
-msgstr ""
+msgstr "Napaka pri shranjevanju Knjižnice Modelov!"
#: editor/editor_node.cpp
msgid "Can't load TileSet for merging!"
-msgstr ""
+msgstr "PloÅ¡ÄniNiz ni mogoÄe naložiti za združitev!"
#: editor/editor_node.cpp
msgid "Error saving TileSet!"
-msgstr ""
+msgstr "Napaka pri shranjevanju PloÅ¡ÄnegaNiza!"
#: editor/editor_node.cpp
msgid "Error trying to save layout!"
-msgstr ""
+msgstr "Napaka pri shranjevanju postavitev!"
#: editor/editor_node.cpp
msgid "Default editor layout overridden."
-msgstr ""
+msgstr "Privzeti urejevalnik postavitev je bil prepisan."
#: editor/editor_node.cpp
msgid "Layout name not found!"
-msgstr ""
+msgstr "Ime postavitve ni mogoÄe najti!"
#: editor/editor_node.cpp
msgid "Restored default layout to base settings."
-msgstr ""
+msgstr "Privzeta postavitev je bila ponastavljena na osnovne nastaviteve."
#: editor/editor_node.cpp
msgid ""
@@ -1495,18 +1509,24 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
+"Ta vir pripada uvoženi sceni, zato ga ne moremo spreminjati.\n"
+"Za boljše razumevanje preberi dokumentacijo namenjeno za uvažanje scen."
#: editor/editor_node.cpp
msgid ""
"This resource belongs to a scene that was instanced or inherited.\n"
"Changes to it will not be kept when saving the current scene."
msgstr ""
+"Ta vir pripada sceni, ki je dedovana ali je primer druge.\n"
+"Pri shranjevanju trenutne scene se spremembe ne bodo ohranile."
#: editor/editor_node.cpp
msgid ""
"This resource was imported, so it's not editable. Change its settings in the "
"import panel and then re-import."
msgstr ""
+"Ta vir je bil uvožen tako, da ga ne morete spreminjati. Spremenite svoje "
+"nastavitve na ploÅ¡Äi za uvoz in nato znova uvozite."
#: editor/editor_node.cpp
msgid ""
@@ -1515,6 +1535,9 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
+"Ta scena je bila uvožena tako, da spremembe ne bodo shranjene.\n"
+"Primer druge ali dedovanje bo omogoÄilo spremembe v njem.\n"
+"Za boljše razumevanje preberi dokumentacijo namenjeno za uvažanje scen."
#: editor/editor_node.cpp
msgid ""
@@ -1522,46 +1545,48 @@ msgid ""
"Please read the documentation relevant to debugging to better understand "
"this workflow."
msgstr ""
+"To je objekt odprt na daljavo, zato spremembe v njem ne bodo shranjene.\n"
+"Za boljÅ¡e razumevanje preberi dokumentacijo namenjeno razhroÅ¡Äevanju."
#: editor/editor_node.cpp
msgid "Expand all properties"
-msgstr ""
+msgstr "Razširi vse lastnosti"
#: editor/editor_node.cpp
msgid "Collapse all properties"
-msgstr ""
+msgstr "SkrÄi vse lastnosti"
#: editor/editor_node.cpp
msgid "Copy Params"
-msgstr ""
+msgstr "Kopiraj Parametre"
#: editor/editor_node.cpp
msgid "Paste Params"
-msgstr ""
+msgstr "Prilepi Parametre"
#: editor/editor_node.cpp editor/plugins/resource_preloader_editor_plugin.cpp
msgid "Paste Resource"
-msgstr ""
+msgstr "Prilepi Vir"
#: editor/editor_node.cpp
msgid "Copy Resource"
-msgstr ""
+msgstr "Kopiraj Vir"
#: editor/editor_node.cpp
msgid "Make Built-In"
-msgstr ""
+msgstr "Naredi Vgrajeno"
#: editor/editor_node.cpp
msgid "Make Sub-Resources Unique"
-msgstr ""
+msgstr "Naredi Pod-Vire Samostojne"
#: editor/editor_node.cpp
msgid "Open in Help"
-msgstr ""
+msgstr "Odpri v PomoÄi"
#: editor/editor_node.cpp
msgid "There is no defined scene to run."
-msgstr ""
+msgstr "Ni doloÄene scene za zagon."
#: editor/editor_node.cpp
msgid ""
@@ -1569,6 +1594,9 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Glavna scena ni bila doloÄena, izberem eno?\n"
+"Kasneje jo lahko spremeniš v \"Nastavitve Projekta\" pod kategorijo "
+"'aplikacija'."
#: editor/editor_node.cpp
msgid ""
@@ -1576,6 +1604,9 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Izbrana scena '%s' ne obstaja, izberem veljavno?\n"
+"Kasneje jo lahko spremeniš v \"Nastavitve Projekta\" pod kategorijo "
+"'aplikacija'."
#: editor/editor_node.cpp
msgid ""
@@ -1583,343 +1614,361 @@ msgid ""
"You can change it later in \"Project Settings\" under the 'application' "
"category."
msgstr ""
+"Izbrana scena '%s' ni datoteka scene, izberem veljavno?\n"
+"Kasneje jo lahko spremeniš v \"Nastavitve Projekta\" pod kategorijo "
+"'aplikacija'."
#: editor/editor_node.cpp
msgid "Current scene was never saved, please save it prior to running."
-msgstr ""
+msgstr "Trenutna scena ni bila shranjena, shranite jo pred zagonom."
#: editor/editor_node.cpp
msgid "Could not start subprocess!"
-msgstr ""
+msgstr "Nemorem zaÄeti podprocesa!"
#: editor/editor_node.cpp
msgid "Open Scene"
-msgstr ""
+msgstr "Odpri Sceno"
#: editor/editor_node.cpp
msgid "Open Base Scene"
-msgstr ""
+msgstr "Odpri Osnovno Sceno"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr ""
+msgid "Quick Open Scene..."
+msgstr "Hitro Odpri Sceno..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr ""
+msgid "Quick Open Script..."
+msgstr "Hitro Odpri Skripto..."
#: editor/editor_node.cpp
msgid "Save & Close"
-msgstr ""
+msgstr "Shrani & Zapri"
#: editor/editor_node.cpp
msgid "Save changes to '%s' before closing?"
-msgstr ""
+msgstr "Shranim spremembe v '%s' pred zapiranjem?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr ""
+msgid "Save Scene As..."
+msgstr "Shrani Sceno Kot..."
#: editor/editor_node.cpp
msgid "No"
-msgstr ""
+msgstr "Ne"
#: editor/editor_node.cpp
msgid "Yes"
-msgstr ""
+msgstr "Da"
#: editor/editor_node.cpp
msgid "This scene has never been saved. Save before running?"
-msgstr ""
+msgstr "Ta scena ni bila nikoli shranjena. Shranim pred zagonom?"
#: editor/editor_node.cpp editor/scene_tree_dock.cpp
msgid "This operation can't be done without a scene."
-msgstr ""
+msgstr "Ta operacija ni mogoÄa brez scene."
#: editor/editor_node.cpp
msgid "Export Mesh Library"
-msgstr ""
+msgstr "Izvozi Knjižnico Modelov"
#: editor/editor_node.cpp
msgid "This operation can't be done without a root node."
-msgstr ""
+msgstr "Ta operacija ni mogoÄa brez osnovnega gradnika."
#: editor/editor_node.cpp
msgid "Export Tile Set"
-msgstr ""
+msgstr "Izvozi PloÅ¡Äno Zbirko"
#: editor/editor_node.cpp
msgid "This operation can't be done without a selected node."
-msgstr ""
+msgstr "Te operacije ne moremo storiti brez izbranega gradnika."
#: editor/editor_node.cpp
msgid "Current scene not saved. Open anyway?"
-msgstr ""
+msgstr "Trenutna scena ni shranjena. Vseeno odprem?"
#: editor/editor_node.cpp
msgid "Can't reload a scene that was never saved."
-msgstr ""
+msgstr "Ni mogoÄe osvežiti scene, ki ni bila shranjena."
#: editor/editor_node.cpp
msgid "Revert"
-msgstr ""
+msgstr "Povrni"
#: editor/editor_node.cpp
msgid "This action cannot be undone. Revert anyway?"
-msgstr ""
+msgstr "Tega dejanja ni mogoÄe razveljaviti. Vseeno povrni?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr ""
+msgid "Quick Run Scene..."
+msgstr "Hitro Zaženi Sceno..."
#: editor/editor_node.cpp
msgid "Quit"
-msgstr ""
+msgstr "Zapri"
#: editor/editor_node.cpp
msgid "Exit the editor?"
-msgstr ""
+msgstr "Zaprem urejevalnik?"
#: editor/editor_node.cpp
msgid "Open Project Manager?"
-msgstr ""
+msgstr "Odprem Upravljalnik Projekta?"
#: editor/editor_node.cpp
msgid "Save & Quit"
-msgstr ""
+msgstr "Shrani & Zapri"
#: editor/editor_node.cpp
msgid "Save changes to the following scene(s) before quitting?"
-msgstr ""
+msgstr "Shranim spremembe na sledeÄih scenah pred zaprtjem?"
#: editor/editor_node.cpp
msgid "Save changes the following scene(s) before opening Project Manager?"
msgstr ""
+"Shranim spremembe na sledeÄih scenah pred odpiranjem Upravljalnika Projekta?"
#: editor/editor_node.cpp
msgid ""
"This option is deprecated. Situations where refresh must be forced are now "
"considered a bug. Please report."
msgstr ""
+"Ta možnost je zastarela. Situacije, kjer je treba osvežitev prisiliti, se "
+"zdaj štejejo za napako. Prosimo, prijavite."
#: editor/editor_node.cpp
msgid "Pick a Main Scene"
-msgstr ""
+msgstr "Izberi Glavno Sceno"
#: editor/editor_node.cpp
msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
msgstr ""
+"Ni mogoÄe omogoÄiti dodatnega vtiÄnika na: '%s'. RazÄlenjevanje "
+"konfiguracije ni uspelo."
#: editor/editor_node.cpp
msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
msgstr ""
+"Ni mogoÄe najti polja skripte za dodatni vtiÄnik na: 'res://addons/%s'."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s'."
-msgstr ""
+msgstr "Ni mogoÄe naložiti dodatno skripto iz poti: '%s'."
#: editor/editor_node.cpp
msgid ""
"Unable to load addon script from path: '%s' Base type is not EditorPlugin."
msgstr ""
+"Ni mogoÄe naložiti dodatno skripto iz poti: '%s' Osnovni tip ni "
+"UrejevalniVtiÄnik."
#: editor/editor_node.cpp
msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
msgstr ""
+"Ni mogoÄe naložiti dodatno skripto iz poti: '%s' Skripta ni v naÄinu orodje."
#: editor/editor_node.cpp
msgid ""
"Scene '%s' was automatically imported, so it can't be modified.\n"
"To make changes to it, a new inherited scene can be created."
msgstr ""
+"Scena '%s' je bila samodejno uvožena, zato je ni mogoÄe spremeniti.\n"
+"Če želite narediti spremembe, lahko ustvarite novo podedovano sceno."
#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ugh"
-msgstr ""
+msgstr "Uh"
#: editor/editor_node.cpp
msgid ""
"Error loading scene, it must be inside the project path. Use 'Import' to "
"open the scene, then save it inside the project path."
msgstr ""
+"Napaka pri nalaganju prizora, zato ker ni znotraj poti projekta. Uporabite "
+"'Uvoz', da odprete prizor in ga nato shranite znotraj poti projekta."
#: editor/editor_node.cpp
msgid "Scene '%s' has broken dependencies:"
-msgstr ""
+msgstr "Prizor '%s' ima pretrgane odvisnosti:"
#: editor/editor_node.cpp
msgid "Clear Recent Scenes"
-msgstr ""
+msgstr "PoÄisti Nedavne Prizore"
#: editor/editor_node.cpp
msgid "Save Layout"
-msgstr ""
+msgstr "Shrani Postavitev"
#: editor/editor_node.cpp
msgid "Delete Layout"
-msgstr ""
+msgstr "Izbriši Postavitev"
#: editor/editor_node.cpp editor/import_dock.cpp
#: editor/script_create_dialog.cpp
msgid "Default"
-msgstr ""
+msgstr "Prevzeto"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr ""
+msgstr "Preklopi na zavihek Prizor"
#: editor/editor_node.cpp
msgid "%d more files or folders"
-msgstr ""
+msgstr "%d veÄ datotek ali map"
#: editor/editor_node.cpp
msgid "%d more folders"
-msgstr ""
+msgstr "%d veÄ map"
#: editor/editor_node.cpp
msgid "%d more files"
-msgstr ""
+msgstr "%d veÄ datotek"
#: editor/editor_node.cpp
msgid "Dock Position"
-msgstr ""
+msgstr "Položaj Sidranja"
#: editor/editor_node.cpp
msgid "Distraction Free Mode"
-msgstr ""
+msgstr "NaÄin Brez Motenj"
#: editor/editor_node.cpp
msgid "Toggle distraction-free mode."
-msgstr ""
+msgstr "Preklop naÄin pisanja brez motenj."
#: editor/editor_node.cpp
msgid "Add a new scene."
-msgstr ""
+msgstr "Dodaj nov Prizor."
#: editor/editor_node.cpp
msgid "Scene"
-msgstr ""
+msgstr "Prizor"
#: editor/editor_node.cpp
msgid "Go to previously opened scene."
-msgstr ""
+msgstr "Pojdi na predhodno odprti prizor."
#: editor/editor_node.cpp
msgid "Next tab"
-msgstr ""
+msgstr "Naslednji zavihek"
#: editor/editor_node.cpp
msgid "Previous tab"
-msgstr ""
+msgstr "Prejšnji zavihek"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr ""
+msgid "Filter Files..."
+msgstr "Filtriraj datoteke..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
-msgstr ""
+msgstr "Operacije z datotekami prizora."
#: editor/editor_node.cpp
msgid "New Scene"
-msgstr ""
+msgstr "Nov Prizor"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr ""
+msgid "New Inherited Scene..."
+msgstr "Nov Podedovan Prizor..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr ""
+msgid "Open Scene..."
+msgstr "Odpri Prizor..."
#: editor/editor_node.cpp
msgid "Save Scene"
-msgstr ""
+msgstr "Shrani Prizor"
#: editor/editor_node.cpp
msgid "Save all Scenes"
-msgstr ""
+msgstr "Shrani vse Prizore"
#: editor/editor_node.cpp
msgid "Close Scene"
-msgstr ""
+msgstr "Zapri Prizor"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Open Recent"
-msgstr ""
+msgstr "Odpri Nedavne"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr ""
+msgid "Convert To..."
+msgstr "Pretvori V..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr ""
+msgid "MeshLibrary..."
+msgstr "Knjižnica Modelov..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
msgid "Undo"
-msgstr ""
+msgstr "Razveljavi"
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp
msgid "Redo"
-msgstr ""
+msgstr "Ponovi"
#: editor/editor_node.cpp
msgid "Revert Scene"
-msgstr ""
+msgstr "Povrni Prizor"
#: editor/editor_node.cpp
msgid "Miscellaneous project or scene-wide tools."
-msgstr ""
+msgstr "RazliÄna projektna ali prizorska orodja."
#: editor/editor_node.cpp
msgid "Project"
-msgstr ""
+msgstr "Projekt"
#: editor/editor_node.cpp
msgid "Project Settings"
-msgstr ""
+msgstr "Nastavitve Projekta"
#: editor/editor_node.cpp
msgid "Run Script"
-msgstr ""
+msgstr "Zaženi Skripto"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export"
-msgstr ""
+msgstr "Izvozi"
#: editor/editor_node.cpp
msgid "Tools"
-msgstr ""
+msgstr "Orodja"
#: editor/editor_node.cpp
msgid "Quit to Project List"
-msgstr ""
+msgstr "Zapri na Seznam Projektov"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Debug"
-msgstr ""
+msgstr "RazhroÅ¡Äevalnik"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
-msgstr ""
+msgstr "Uvajanje z Oddaljenim RazhroÅ¡Äevanjem"
#: editor/editor_node.cpp
msgid ""
"When exporting or deploying, the resulting executable will attempt to "
"connect to the IP of this computer in order to be debugged."
msgstr ""
+"Pri izvažanju ali uvajanju se bo konÄna izvrÅ¡ljiva datoteka razhroÅ¡Äevala, "
+"tako da se bo skuÅ¡ala povezati z IP-jem tega raÄunalnika."
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr ""
+msgstr "Kratko Uvajanje z Omrežjem FS"
#: editor/editor_node.cpp
msgid ""
@@ -1930,30 +1979,39 @@ msgid ""
"On Android, deploy will use the USB cable for faster performance. This "
"option speeds up testing for games with a large footprint."
msgstr ""
+"Ko je ta možnost omogoÄena, se bo pri izvozu ali uvajanju ustvarila "
+"minimalna izvršljiva datoteka.\n"
+"DatoteÄni sistem bo iz projekta zagotovljen z urejevalnikom preko omrežja.\n"
+"Na Androidu bo uvajanje zaradi hitrejšega delovanja potekalo preko kabla "
+"USB. Ta možnost pospeši testiranje iger z velikim odtisom."
#: editor/editor_node.cpp
msgid "Visible Collision Shapes"
-msgstr ""
+msgstr "Vidne Oblike Trka"
#: editor/editor_node.cpp
msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
+"Gradniki oblike trka in prikaz žarka (za 2D in 3D) bodo vidni pri poteku "
+"igre, Äe je ta možnost vklopljena."
#: editor/editor_node.cpp
msgid "Visible Navigation"
-msgstr ""
+msgstr "Vidna Navigacija"
#: editor/editor_node.cpp
msgid ""
"Navigation meshes and polygons will be visible on the running game if this "
"option is turned on."
msgstr ""
+"ÄŒe je ta možnost vkljuÄena, bodo navigacijske oblike in poligoni vidni pri "
+"poteku igre."
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr ""
+msgstr "Usklajuj Spremembe Prizora"
#: editor/editor_node.cpp
msgid ""
@@ -1962,10 +2020,12 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
+"Ko je ta možnost vkljuÄena, bodo vse spremebe v prizoru ali urejevalniku "
+"ponovljene med potekom igre."
#: editor/editor_node.cpp
msgid "Sync Script Changes"
-msgstr ""
+msgstr "Usklajuj Spremembe Skript"
#: editor/editor_node.cpp
msgid ""
@@ -1974,35 +2034,38 @@ msgid ""
"When used remotely on a device, this is more efficient with network "
"filesystem."
msgstr ""
+"ÄŒe je ta možnost vkljuÄena, bo vsaka shranjena skripta ponovno naložena v "
+"igro, ki se izvaja.\n"
+"ÄŒe se uporablja napravo na daljavo, je to bolj uÄinkovito pri omrežnem "
+"datoteÄnem sistemu."
#: editor/editor_node.cpp
-#, fuzzy
msgid "Editor"
-msgstr "Uredi"
+msgstr "Urejevalnik"
#: editor/editor_node.cpp editor/settings_config_dialog.cpp
msgid "Editor Settings"
-msgstr ""
+msgstr "Nastavitve Urejevalnika"
#: editor/editor_node.cpp
msgid "Editor Layout"
-msgstr ""
+msgstr "Postavitev Urejevalnika"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
-msgstr ""
+msgstr "Preklopi na Celozaslonski NaÄin"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Manage Export Templates"
-msgstr ""
+msgstr "Upravljaj Izvozne Predloge"
#: editor/editor_node.cpp
msgid "Help"
-msgstr ""
+msgstr "PomoÄ"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Classes"
-msgstr ""
+msgstr "Razredi"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -2013,819 +2076,818 @@ msgstr "Iskanje"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Online Docs"
-msgstr ""
+msgstr "Spletna Dokumentacija"
#: editor/editor_node.cpp
msgid "Q&A"
-msgstr ""
+msgstr "V&O"
#: editor/editor_node.cpp
msgid "Issue Tracker"
-msgstr ""
+msgstr "Sledilnik Napak"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
msgid "Community"
-msgstr ""
+msgstr "Skupnost"
#: editor/editor_node.cpp
msgid "About"
-msgstr ""
+msgstr "O Programu"
#: editor/editor_node.cpp
msgid "Play the project."
-msgstr ""
+msgstr "Zaženi projekt."
#: editor/editor_node.cpp
msgid "Play"
-msgstr ""
+msgstr "Zaženi"
#: editor/editor_node.cpp
msgid "Pause the scene"
-msgstr ""
+msgstr "Zaustavi prizor"
#: editor/editor_node.cpp
msgid "Pause Scene"
-msgstr ""
+msgstr "Zaustavi prizor"
#: editor/editor_node.cpp
msgid "Stop the scene."
-msgstr ""
+msgstr "Ustavi Prizor."
#: editor/editor_node.cpp
msgid "Stop"
-msgstr ""
+msgstr "Ustavi"
#: editor/editor_node.cpp
msgid "Play the edited scene."
-msgstr ""
+msgstr "Zaženi prizor u urejanju."
#: editor/editor_node.cpp
msgid "Play Scene"
-msgstr ""
+msgstr "Zaženi Prizor"
#: editor/editor_node.cpp
msgid "Play custom scene"
-msgstr ""
+msgstr "Zaženi prizor po meri"
#: editor/editor_node.cpp
msgid "Play Custom Scene"
-msgstr ""
+msgstr "Zaženi Prizor po Meri"
#: editor/editor_node.cpp
msgid "Spins when the editor window repaints!"
-msgstr ""
+msgstr "Vrti se ob spremembi okna urejevalnika!"
#: editor/editor_node.cpp
msgid "Update Always"
-msgstr ""
+msgstr "Posodobi Vedno"
#: editor/editor_node.cpp
msgid "Update Changes"
-msgstr ""
+msgstr "Posodobi Spremembe"
#: editor/editor_node.cpp
msgid "Disable Update Spinner"
-msgstr ""
+msgstr "OnemogoÄi Posodobitve Kolesca"
#: editor/editor_node.cpp
msgid "Inspector"
-msgstr ""
+msgstr "Nadzornik"
#: editor/editor_node.cpp
msgid "Create a new resource in memory and edit it."
-msgstr ""
+msgstr "Ustvari nov vir v pomnilniku in ga uredi."
#: editor/editor_node.cpp
msgid "Load an existing resource from disk and edit it."
-msgstr ""
+msgstr "Naloži obstojeÄi vir iz spomina in ga uredi."
#: editor/editor_node.cpp
msgid "Save the currently edited resource."
-msgstr ""
+msgstr "Shrani trenutno urejani vir."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr ""
+msgid "Save As..."
+msgstr "Shrani Kot..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
-msgstr ""
+msgstr "Pojdi na prejšnji urejani objekt v zgodovini."
#: editor/editor_node.cpp
msgid "Go to the next edited object in history."
-msgstr ""
+msgstr "Pojdi na naslednji urejani objekt v zgodovini."
#: editor/editor_node.cpp
msgid "History of recently edited objects."
-msgstr ""
+msgstr "Zgodovina nedavno urejanih objektov."
#: editor/editor_node.cpp
msgid "Object properties."
-msgstr ""
+msgstr "Lastnosti objekta."
#: editor/editor_node.cpp
msgid "Changes may be lost!"
-msgstr ""
+msgstr "Spremembe se lahko izgubijo!"
#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Import"
-msgstr ""
+msgstr "Uvozi"
#: editor/editor_node.cpp
msgid "Node"
-msgstr ""
+msgstr "Gradnik"
#: editor/editor_node.cpp
msgid "FileSystem"
-msgstr ""
+msgstr "DatoteÄniSistem"
#: editor/editor_node.cpp
msgid "Output"
-msgstr ""
+msgstr "Izhod"
#: editor/editor_node.cpp
msgid "Don't Save"
-msgstr ""
+msgstr "Ne Shrani"
#: editor/editor_node.cpp
msgid "Import Templates From ZIP File"
-msgstr ""
+msgstr "Uvozi Predloge iz ZIP Datoteke"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export Project"
-msgstr ""
+msgstr "Izvozi Projekt"
#: editor/editor_node.cpp
msgid "Export Library"
-msgstr ""
+msgstr "Izvozi Knjižnico"
#: editor/editor_node.cpp
msgid "Merge With Existing"
-msgstr ""
+msgstr "Spoji z ObstojeÄim"
#: editor/editor_node.cpp
msgid "Password:"
-msgstr ""
+msgstr "Geslo:"
#: editor/editor_node.cpp
msgid "Open & Run a Script"
-msgstr ""
+msgstr "Odpri & Zaženi Skripto"
#: editor/editor_node.cpp
msgid "New Inherited"
-msgstr ""
+msgstr "Novo Podedovano"
#: editor/editor_node.cpp
msgid "Load Errors"
-msgstr ""
+msgstr "Napake pri Nalaganju"
#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Select"
-msgstr ""
+msgstr "Izberi"
#: editor/editor_node.cpp
msgid "Open 2D Editor"
-msgstr ""
+msgstr "Odpri 2D Urejevalnik"
#: editor/editor_node.cpp
msgid "Open 3D Editor"
-msgstr ""
+msgstr "Odpri 3D Urejevalnik"
#: editor/editor_node.cpp
msgid "Open Script Editor"
-msgstr ""
+msgstr "Odpri Urejevalnik Skript"
#: editor/editor_node.cpp editor/project_manager.cpp
msgid "Open Asset Library"
-msgstr ""
+msgstr "Odpri Knjižnico Dodatkov"
#: editor/editor_node.cpp
msgid "Open the next Editor"
-msgstr ""
+msgstr "Odpri naslednji Urejevalnik"
#: editor/editor_node.cpp
msgid "Open the previous Editor"
-msgstr ""
+msgstr "Odpri prejšnji Urejevalnik"
#: editor/editor_plugin.cpp
msgid "Creating Mesh Previews"
-msgstr ""
+msgstr "Ustvari Predogled Modela"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr ""
+msgid "Thumbnail..."
+msgstr "SliÄica..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
-msgstr ""
+msgstr "NameÅ¡Äeni VtiÄniki:"
#: editor/editor_plugin_settings.cpp
msgid "Update"
-msgstr ""
+msgstr "Posodobi"
#: editor/editor_plugin_settings.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Version:"
-msgstr ""
+msgstr "RazliÄica:"
#: editor/editor_plugin_settings.cpp
msgid "Author:"
-msgstr ""
+msgstr "Avtor:"
#: editor/editor_plugin_settings.cpp
msgid "Status:"
-msgstr ""
+msgstr "Stanje:"
#: editor/editor_profiler.cpp
msgid "Stop Profiling"
-msgstr ""
+msgstr "Ustavi Modeliranje"
#: editor/editor_profiler.cpp
msgid "Start Profiling"
-msgstr ""
+msgstr "ZaÄni Modeliranje"
#: editor/editor_profiler.cpp
msgid "Measure:"
-msgstr ""
+msgstr "Mera:"
#: editor/editor_profiler.cpp
msgid "Frame Time (sec)"
-msgstr ""
+msgstr "Okvirni ÄŒas (sek)"
#: editor/editor_profiler.cpp
msgid "Average Time (sec)"
-msgstr ""
+msgstr "PovpreÄni ÄŒas (sek)"
#: editor/editor_profiler.cpp
msgid "Frame %"
-msgstr ""
+msgstr "Okvir %"
#: editor/editor_profiler.cpp
msgid "Physics Frame %"
-msgstr ""
+msgstr "Fizikalni Okvir %"
#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
msgid "Time:"
-msgstr ""
+msgstr "ÄŒas:"
#: editor/editor_profiler.cpp
msgid "Inclusive"
-msgstr ""
+msgstr "VkljuÄno"
#: editor/editor_profiler.cpp
msgid "Self"
-msgstr ""
+msgstr "Samo"
#: editor/editor_profiler.cpp
msgid "Frame #:"
-msgstr ""
+msgstr "Okvir #:"
#: editor/editor_profiler.cpp
msgid "Time"
-msgstr ""
+msgstr "ÄŒas"
#: editor/editor_profiler.cpp
msgid "Calls"
-msgstr ""
+msgstr "Klici"
#: editor/editor_run_native.cpp
msgid "Select device from the list"
-msgstr ""
+msgstr "Izberite napravo s seznama"
#: editor/editor_run_native.cpp
msgid ""
"No runnable export preset found for this platform.\n"
"Please add a runnable preset in the export menu."
msgstr ""
+"Za to platformo ni mogoÄe najti obstojeÄih izvoznih nastavitev.\n"
+"V izvoznem meniju dodajte svoje nastavitve."
#: editor/editor_run_script.cpp
msgid "Write your logic in the _run() method."
-msgstr ""
+msgstr "Napišite svojo logiko v metodi _run() ."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
-msgstr ""
+msgstr "Tu že obstaja prizor v urejanju."
#: editor/editor_run_script.cpp
msgid "Couldn't instance script:"
-msgstr ""
+msgstr "Ni mogoÄe ustvariti primera skripte:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
-msgstr ""
+msgstr "Ali si pozabil kljuÄno besedo 'orodje'?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
-msgstr ""
+msgstr "Ni mogoÄe zagnati skripte:"
#: editor/editor_run_script.cpp
msgid "Did you forget the '_run' method?"
-msgstr ""
+msgstr "Ali si pozabil metodo '_run' ?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
-msgstr ""
+msgstr "Privzeto (Enako kot Urejevalnik)"
#: editor/editor_sub_scene.cpp
msgid "Select Node(s) to Import"
-msgstr ""
+msgstr "Izberi Gradnik(e) za Uvoz"
#: editor/editor_sub_scene.cpp
msgid "Scene Path:"
-msgstr ""
+msgstr "Pot Prizora:"
#: editor/editor_sub_scene.cpp
msgid "Import From Node:"
-msgstr ""
+msgstr "Uvozi iz Gradnika:"
#: editor/export_template_manager.cpp
msgid "Re-Download"
-msgstr ""
+msgstr "Ponovno Prenesi"
#: editor/export_template_manager.cpp
msgid "Uninstall"
-msgstr ""
+msgstr "Odstrani"
#: editor/export_template_manager.cpp
msgid "(Installed)"
-msgstr ""
+msgstr "(NameÅ¡Äeno)"
#: editor/export_template_manager.cpp
msgid "Download"
-msgstr ""
+msgstr "Prenesi"
#: editor/export_template_manager.cpp
msgid "(Missing)"
-msgstr ""
+msgstr "(ManjkajoÄe)"
#: editor/export_template_manager.cpp
msgid "(Current)"
-msgstr ""
+msgstr "(Trenutno)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr ""
+msgid "Retrieving mirrors, please wait..."
+msgstr "Pridobivanje virov, poÄakajte..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
-msgstr ""
+msgstr "ŽeliÅ¡ odstraniti predlogo razliÄice '%s'?"
#: editor/export_template_manager.cpp
msgid "Can't open export templates zip."
-msgstr ""
+msgstr "Ne morem odpreti zip izvozne predloge."
#: editor/export_template_manager.cpp
msgid "Invalid version.txt format inside templates."
-msgstr ""
-
-#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
+msgstr "Neveljaven format version.txt znotraj predloge."
#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
-msgstr ""
+msgstr "Datoteke version.txt ni v predlogi."
#: editor/export_template_manager.cpp
msgid "Error creating path for templates:"
-msgstr ""
+msgstr "Napaka pri ustvarjanju poti za predloge:"
#: editor/export_template_manager.cpp
msgid "Extracting Export Templates"
-msgstr ""
+msgstr "Razširjanje Izvoznih Predlog"
#: editor/export_template_manager.cpp
msgid "Importing:"
-msgstr ""
+msgstr "Uvažanje:"
#: editor/export_template_manager.cpp
msgid ""
"No download links found for this version. Direct download is only available "
"for official releases."
msgstr ""
+"Za to razliÄico ni mogoÄe najti linkov za prenos. Neposredni prenos je na "
+"voljo samo za uradne izdaje."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve."
-msgstr ""
+msgstr "Ni mogoÄe razreÅ¡iti."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't connect."
-msgstr ""
+msgstr "NemogoÄe se je povezati."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No response."
-msgstr ""
+msgstr "Ni odgovora."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request Failed."
-msgstr ""
+msgstr "Zahteva Ni Uspela."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Redirect Loop."
-msgstr ""
+msgstr "Preusmeritev Zanke."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Failed:"
-msgstr ""
+msgstr "Spodletelo:"
#: editor/export_template_manager.cpp
msgid "Download Complete."
-msgstr ""
+msgstr "Prenos je DokonÄan."
#: editor/export_template_manager.cpp
msgid "Error requesting url: "
-msgstr ""
+msgstr "Napaka pri zahtevi URL-ja: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr ""
+msgid "Connecting to Mirror..."
+msgstr "Povezovanje z Virom..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
-msgstr ""
+msgstr "Nepovezano"
#: editor/export_template_manager.cpp
msgid "Resolving"
-msgstr ""
+msgstr "Razreševanje"
#: editor/export_template_manager.cpp
msgid "Can't Resolve"
-msgstr ""
+msgstr "Ni MogoÄe RazreÅ¡iti"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr ""
+msgid "Connecting..."
+msgstr "Povezovanje..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
-msgstr ""
+msgstr "NemogoÄe se je Povezati"
#: editor/export_template_manager.cpp
msgid "Connected"
-msgstr ""
+msgstr "Povezano"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr ""
+msgid "Requesting..."
+msgstr "Zahtevam..."
#: editor/export_template_manager.cpp
msgid "Downloading"
-msgstr ""
+msgstr "Prenašanje"
#: editor/export_template_manager.cpp
msgid "Connection Error"
-msgstr ""
+msgstr "Napaka Pri Povezavi"
#: editor/export_template_manager.cpp
msgid "SSL Handshake Error"
-msgstr ""
+msgstr "Napaka Pri Usklanjevanju SSH"
#: editor/export_template_manager.cpp
msgid "Current Version:"
-msgstr ""
+msgstr "Trenutna RazliÄica:"
#: editor/export_template_manager.cpp
msgid "Installed Versions:"
-msgstr ""
+msgstr "NameÅ¡Äene RazliÄice:"
#: editor/export_template_manager.cpp
msgid "Install From File"
-msgstr ""
+msgstr "Namesti Iz Datoteke"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Remove Template"
-msgstr "Odstrani Spremenljivko"
+msgstr "Odstrani Predlogo"
#: editor/export_template_manager.cpp
msgid "Select template file"
-msgstr ""
+msgstr "Izberi datoteko predloge"
#: editor/export_template_manager.cpp
msgid "Export Template Manager"
-msgstr ""
+msgstr "Izvozni Upravitelj Predlog"
#: editor/export_template_manager.cpp
-#, fuzzy
msgid "Download Templates"
-msgstr "Odstrani Spremenljivko"
+msgstr "Prenesi Predloge"
#: editor/export_template_manager.cpp
msgid "Select mirror from list: "
-msgstr ""
+msgstr "Izberi vire s seznama: "
#: editor/file_type_cache.cpp
msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
msgstr ""
+"Za pisanje ni mogoÄe odpreti file_type_cache.cch, ne da bi shranili "
+"predpomnilnik tipa datoteke!"
#: editor/filesystem_dock.cpp
msgid "Cannot navigate to '%s' as it has not been found in the file system!"
msgstr ""
+"Ne morem se postaviti na mesto '%s', ker ni bilo najdeno v datoteÄnem "
+"sistemu!"
#: editor/filesystem_dock.cpp
msgid "View items as a grid of thumbnails"
-msgstr ""
+msgstr "Oglejte si elemente, kot mrežo sliÄic"
#: editor/filesystem_dock.cpp
msgid "View items as a list"
-msgstr ""
+msgstr "Oglejte si elemente v seznamu"
#: editor/filesystem_dock.cpp
msgid "Status: Import of file failed. Please fix file and reimport manually."
msgstr ""
+"Stanje: Uvoz datoteke ni uspel. Popravi datoteko in ponovno roÄno uvozi."
#: editor/filesystem_dock.cpp
msgid "Cannot move/rename resources root."
-msgstr ""
+msgstr "Ni mogoÄe premakniti/preimenovati osnovne vire."
#: editor/filesystem_dock.cpp
msgid "Cannot move a folder into itself."
-msgstr ""
+msgstr "Mape ni mogoÄe premakniti vase."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error moving:"
-msgstr "Napaka naložitve pisave."
+msgstr "Napaka pri premikanju:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Error duplicating:"
-msgstr "Preimenuj Spremenljivko"
+msgstr "Napaka pri podvajanju:"
#: editor/filesystem_dock.cpp
msgid "Unable to update dependencies:"
-msgstr ""
+msgstr "Odvisnosti ni mogoÄe posodobiti:"
#: editor/filesystem_dock.cpp
msgid "No name provided"
-msgstr ""
+msgstr "Ime ni na voljo"
#: editor/filesystem_dock.cpp
msgid "Provided name contains invalid characters"
-msgstr ""
+msgstr "Vnešeno ime vsebuje neveljavne znake"
#: editor/filesystem_dock.cpp
msgid "No name provided."
-msgstr ""
+msgstr "Ime ni doloÄeno."
#: editor/filesystem_dock.cpp
msgid "Name contains invalid characters."
-msgstr ""
+msgstr "Ime vsebuje neveljavne znake."
#: editor/filesystem_dock.cpp
msgid "A file or folder with this name already exists."
-msgstr ""
+msgstr "Datoteka ali mapa s tem imenom že obstaja."
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Renaming file:"
-msgstr "Preimenuj Spremenljivko"
+msgstr "Preimenovanje Datoteke:"
#: editor/filesystem_dock.cpp
msgid "Renaming folder:"
-msgstr ""
+msgstr "Preimenovanje mape:"
#: editor/filesystem_dock.cpp
-#, fuzzy
msgid "Duplicating file:"
-msgstr "Preimenuj Spremenljivko"
+msgstr "Podvajanje datoteke:"
#: editor/filesystem_dock.cpp
msgid "Duplicating folder:"
-msgstr ""
+msgstr "Podvajanje mape:"
#: editor/filesystem_dock.cpp
msgid "Expand all"
-msgstr ""
+msgstr "Razširi vse"
#: editor/filesystem_dock.cpp
msgid "Collapse all"
-msgstr ""
+msgstr "SkrÄi vse"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr ""
+msgid "Rename..."
+msgstr "Preimenuj..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr ""
+msgid "Move To..."
+msgstr "Premakni V..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
-msgstr ""
+msgstr "Odpri Prizor(e)"
#: editor/filesystem_dock.cpp
msgid "Instance"
-msgstr ""
+msgstr "Primer"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr ""
+msgid "Edit Dependencies..."
+msgstr "Uredi Odvisnosti..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr ""
+msgid "View Owners..."
+msgstr "Poglej Lastnike..."
#: editor/filesystem_dock.cpp
-#, fuzzy
-msgid "Duplicate.."
-msgstr "Podvoji Izbrano"
+msgid "Duplicate..."
+msgstr "Podvoji..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
-msgstr ""
+msgstr "Prejšna Mapa"
#: editor/filesystem_dock.cpp
msgid "Next Directory"
-msgstr ""
+msgstr "Naslednja Mapa"
#: editor/filesystem_dock.cpp
msgid "Re-Scan Filesystem"
-msgstr ""
+msgstr "Ponovno Preglej DatoteÄni Sistem"
#: editor/filesystem_dock.cpp
msgid "Toggle folder status as Favorite"
-msgstr ""
+msgstr "Nastavi mapo status kot Priljubljeno"
#: editor/filesystem_dock.cpp
msgid "Instance the selected scene(s) as child of the selected node."
msgstr ""
+"Naredi primer iz izbranih prizorov, ki bo naslednik izbranega gradnika."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
+"Pregledovanje Datotek,\n"
+"Prosimo, PoÄakajte..."
#: editor/filesystem_dock.cpp
msgid "Move"
-msgstr ""
+msgstr "Premakni"
#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Rename"
-msgstr ""
+msgstr "Preimenuj"
#: editor/groups_editor.cpp
msgid "Add to Group"
-msgstr ""
+msgstr "Dodaj v Skupino"
#: editor/groups_editor.cpp
msgid "Remove from Group"
-msgstr ""
+msgstr "Odstrani iz Skupine"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Single Scene"
-msgstr ""
+msgstr "Uvozi kot En Prizor"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Animations"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Animacijami"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Materiali"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Objekti"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Objekti+Materiali"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Animations"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Objekti+Animacijami"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials+Animations"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Materiali+Animacijami"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials+Animations"
-msgstr ""
+msgstr "Uvozi z LoÄenimi Objekti+Materiali+Animacijami"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes"
-msgstr ""
+msgstr "Uvozi kot VeÄ Prizorov"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes+Materials"
-msgstr ""
+msgstr "Uvozi kot VeÄkratnik Prizorov+Materialov"
#: editor/import/resource_importer_scene.cpp
#: editor/plugins/cube_grid_theme_editor_plugin.cpp
msgid "Import Scene"
-msgstr ""
+msgstr "Uvozi Prizor"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr ""
+msgid "Importing Scene..."
+msgstr "Uvažanje Prizora..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
-msgstr ""
+msgstr "Ustvarjanje Svetlobnih Kart"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
-msgstr ""
+msgstr "Ustvarjanje za Model: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr ""
+msgid "Running Custom Script..."
+msgstr "Izvajanje Skripte Po Meri..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
-msgstr ""
+msgstr "Skripte po uvozu ni bilo mogoÄe naložiti:"
#: editor/import/resource_importer_scene.cpp
msgid "Invalid/broken script for post-import (check console):"
-msgstr ""
+msgstr "Neveljavna/pokvarjena skripta za naknadno uvažanje (Glej konzolo):"
#: editor/import/resource_importer_scene.cpp
msgid "Error running post-import script:"
-msgstr ""
+msgstr "Napaka pri zagonu skripte po uvozu:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr ""
+msgid "Saving..."
+msgstr "Shranjevanje..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
-msgstr ""
+msgstr "Nastavi kot Privzeto za '%s'"
#: editor/import_dock.cpp
msgid "Clear Default for '%s'"
-msgstr ""
+msgstr "PoÄisti privzeto za '%s'"
#: editor/import_dock.cpp
msgid " Files"
-msgstr ""
+msgstr " Datoteke"
#: editor/import_dock.cpp
msgid "Import As:"
-msgstr ""
+msgstr "Uvozi Kot:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr ""
+msgid "Preset..."
+msgstr "Prednastavitev..."
#: editor/import_dock.cpp
msgid "Reimport"
-msgstr ""
+msgstr "Ponovno Uvozi"
#: editor/multi_node_edit.cpp
msgid "MultiNode Set"
-msgstr ""
+msgstr "Niz VeÄkratnih Gradnikov"
#: editor/node_dock.cpp
msgid "Groups"
-msgstr ""
+msgstr "Skupine"
#: editor/node_dock.cpp
msgid "Select a Node to edit Signals and Groups."
-msgstr ""
+msgstr "Za urejanje Signalov in Skupin izberi Gradnik."
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Create Poly"
-msgstr ""
+msgstr "Ustvarite Poligon"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly"
-msgstr ""
+msgstr "Uredi Poligon"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Insert Point"
-msgstr ""
+msgstr "Ustavi ToÄko"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly (Remove Point)"
-msgstr ""
+msgstr "Uredi Poligon (Odstrani ToÄko)"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Remove Poly And Point"
-msgstr ""
+msgstr "Odstrani Poligon in ToÄko"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Create a new polygon from scratch"
-msgstr ""
+msgstr "Ustvari nov poligon od zaÄetka"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid ""
@@ -2834,199 +2896,201 @@ msgid ""
"Ctrl+LMB: Split Segment.\n"
"RMB: Erase Point."
msgstr ""
+"Uredi obstojeÄi poligon:\n"
+"LMG: Premakni ToÄko.\n"
+"Ctrl+LMG: Razdeli Älen.\n"
+"DMG: ZbriÅ¡i ToÄko."
#: editor/plugins/abstract_polygon_2d_editor.cpp
-#, fuzzy
msgid "Delete points"
-msgstr "Izbriši Izbrano"
+msgstr "IzbriÅ¡i toÄke"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Toggle Autoplay"
-msgstr ""
+msgstr "Preklop funkcije Samodejno Predvajanje"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Animation Name:"
-msgstr ""
+msgstr "Novo Ime Animacije:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Anim"
-msgstr ""
+msgstr "Nova Animacija"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Animation Name:"
-msgstr ""
+msgstr "Spremeni Ime Animacije:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Delete Animation?"
-msgstr ""
+msgstr "Izbrišem animacijo?"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Remove Animation"
-msgstr ""
+msgstr "Odstrani Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Invalid animation name!"
-msgstr ""
+msgstr "Napaka: Neveljavno ime animacije!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Animation name already exists!"
-msgstr ""
+msgstr "NAPAKA: Animacija s tem imenom že obstaja!"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Rename Animation"
-msgstr ""
+msgstr "Preimenuj Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
msgid "Add Animation"
-msgstr ""
+msgstr "Dodaj Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Next Changed"
-msgstr ""
+msgstr "Naslednjo Mešanje se je Spremenilo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Blend Time"
-msgstr ""
+msgstr "Spremeni Mešalni Čas"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load Animation"
-msgstr ""
+msgstr "Naloži Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Duplicate Animation"
-msgstr ""
+msgstr "Podvoji Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to copy!"
-msgstr ""
+msgstr "NAPAKA: Ni animacije za kopiranje!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation resource on clipboard!"
-msgstr ""
+msgstr "NAPAKA: Ni animacije virov na odložiÅ¡Äu!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Pasted Animation"
-msgstr ""
+msgstr "Prilepljena Animacija"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Paste Animation"
-msgstr ""
+msgstr "Prilepi animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to edit!"
-msgstr ""
+msgstr "NAPAKA: Ni animacije za urejanje!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from current pos. (A)"
-msgstr ""
+msgstr "Predvajaj izbrano animacijo nazaj od trenutnega položaja. (A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation backwards from end. (Shift+A)"
-msgstr ""
+msgstr "Predvajaj izbrano animacijo nazaj od konca. (Shift+A)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Stop animation playback. (S)"
-msgstr ""
+msgstr "Ustavi predvajanje animacije. (S)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from start. (Shift+D)"
-msgstr ""
+msgstr "Predvajaj izbrano animacijo od zaÄetka. (Shift+D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Play selected animation from current pos. (D)"
-msgstr ""
+msgstr "Predvajaj izbrano animacijo iz trenutne pozicije. (D)"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation position (in seconds)."
-msgstr ""
+msgstr "Mesto animacije (v sekundah)."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Scale animation playback globally for the node."
-msgstr ""
+msgstr "Spremeni velikost predvajanja za gradnike globalno."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create new animation in player."
-msgstr ""
+msgstr "Ustvari novo animacijo v predvajalniku."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load animation from disk."
-msgstr ""
+msgstr "Naloži animacijo z diska."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load an animation from disk."
-msgstr ""
+msgstr "Naloži animacijo z diska."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Save the current animation"
-msgstr ""
+msgstr "Shrani trenutno animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Display list of animations in player."
-msgstr ""
+msgstr "Prikaži seznam animacij v predvajalniku."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Autoplay on Load"
-msgstr ""
+msgstr "Samodejno predvajaj ob nalaganju"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Edit Target Blend Times"
-msgstr ""
+msgstr "Uredi Äas meÅ¡anice cilja"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Tools"
-msgstr ""
+msgstr "Animacijska Orodja"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Copy Animation"
-msgstr ""
+msgstr "Kopiraj Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Onion Skinning"
-msgstr ""
+msgstr "Lupljenje ÄŒebule"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Enable Onion Skinning"
-msgstr ""
+msgstr "OmogoÄi Lupljenje ÄŒebule"
#: editor/plugins/animation_player_editor_plugin.cpp
-#, fuzzy
msgid "Directions"
-msgstr "Funkcije:"
+msgstr "Smeri"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Past"
-msgstr ""
+msgstr "Preteklost"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Future"
-msgstr ""
+msgstr "Prihodnost"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Depth"
-msgstr ""
+msgstr "Globina"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "1 step"
-msgstr ""
+msgstr "1 korak"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "2 steps"
-msgstr ""
+msgstr "2 koraka"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "3 steps"
-msgstr ""
+msgstr "3 koraki"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Differences Only"
-msgstr ""
+msgstr "Samo Razlike"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Force White Modulate"
-msgstr ""
+msgstr "Sile Bele Modulacije"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Include Gizmos (3D)"
@@ -3034,110 +3098,109 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create New Animation"
-msgstr ""
+msgstr "Ustvari Novo Animacijo"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Animation Name:"
-msgstr ""
+msgstr "Ime Animacije:"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/resource_preloader_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
#: editor/script_create_dialog.cpp
msgid "Error!"
-msgstr ""
+msgstr "Napaka!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Blend Times:"
-msgstr ""
+msgstr "Čas Mešanja:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Next (Auto Queue):"
-msgstr ""
+msgstr "Naprej (Samodejna Razvrstitev):"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Cross-Animation Blend Times"
-msgstr ""
+msgstr "Navzkrižna Animacija Časa Mešanice"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Animation"
-msgstr ""
+msgstr "Animacija"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "New name:"
-msgstr ""
+msgstr "Novo ime:"
#: editor/plugins/animation_tree_editor_plugin.cpp
-#, fuzzy
msgid "Edit Filters"
-msgstr "Uredi Spremenljivko:"
+msgstr "Uredi Filtre"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Scale:"
-msgstr ""
+msgstr "Prilagodi Velikost:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Fade In (s):"
-msgstr ""
+msgstr "Postopno Prikazovanje (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Fade Out (s):"
-msgstr ""
+msgstr "Postopno Izginevanje (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend"
-msgstr ""
+msgstr "Zmešaj"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix"
-msgstr ""
+msgstr "Mešaj"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Auto Restart:"
-msgstr ""
+msgstr "Samodejni Ponovni Zagon:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Restart (s):"
-msgstr ""
+msgstr "Znova Zaženi (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Random Restart (s):"
-msgstr ""
+msgstr "NakljuÄno Zaženi (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Start!"
-msgstr ""
+msgstr "Zaženi!"
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
msgid "Amount:"
-msgstr ""
+msgstr "KoliÄina:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend:"
-msgstr ""
+msgstr "Zmešaj:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend 0:"
-msgstr ""
+msgstr "Zmešaj 0:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend 1:"
-msgstr ""
+msgstr "Zmešaj 1:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "X-Fade Time (s):"
-msgstr ""
+msgstr "ÄŒas X-Bledenja (s):"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Current:"
-msgstr ""
+msgstr "Trenutno:"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Add Input"
-msgstr ""
+msgstr "Dodaj Vnos"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Clear Auto-Advance"
@@ -3145,136 +3208,135 @@ msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Set Auto-Advance"
-msgstr ""
+msgstr "Nastavi Samodejno-Napredovanje"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Delete Input"
-msgstr ""
+msgstr "Izbriši Vnos"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation tree is valid."
-msgstr ""
+msgstr "Drevo animacije je veljavno."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation tree is invalid."
-msgstr ""
+msgstr "Drevo animacije ni veljavno."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Animation Node"
-msgstr ""
+msgstr "Animacijski Gradnik"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "OneShot Node"
-msgstr ""
+msgstr "Gradnik EnPoizkus"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Mix Node"
-msgstr ""
+msgstr "Gradnik Mešanica"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend2 Node"
-msgstr ""
+msgstr "Gradnik Zmešaj2"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend3 Node"
-msgstr ""
+msgstr "Gradnik Zmešaj3"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Blend4 Node"
-msgstr ""
+msgstr "Gradnik Zmešaj4"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeScale Node"
-msgstr ""
+msgstr "Gradnik ÄŒasovnoMerilo"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "TimeSeek Node"
-msgstr ""
+msgstr "Gradnik ÄŒasovniIskalnik"
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Transition Node"
-msgstr ""
+msgstr "Gradnik Prehod"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr ""
+msgid "Import Animations..."
+msgstr "Uvozi Animacije..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
-msgstr ""
+msgstr "Uredi Gradnike Filtri"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr ""
+msgid "Filters..."
+msgstr "Filtri..."
#: editor/plugins/animation_tree_editor_plugin.cpp
-#, fuzzy
msgid "AnimationTree"
-msgstr "Približaj Animacijo"
+msgstr "AnimacijskoDrevo"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Free"
-msgstr ""
+msgstr "Prosto"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Contents:"
-msgstr ""
+msgstr "Vsebina:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "View Files"
-msgstr ""
+msgstr "Ogled datotek"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve hostname:"
-msgstr ""
+msgstr "Ne morem razrešiti imena gostitelja:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Connection error, please try again."
-msgstr ""
+msgstr "Napaka pri povezavi, poskusi znova."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't connect to host:"
-msgstr ""
+msgstr "NemogoÄe se je povezati z gostiteljem:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "No response from host:"
-msgstr ""
+msgstr "Gostitelj se ne odziva:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request failed, return code:"
-msgstr ""
+msgstr "Zahteva ni uspela, povratna koda:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Request failed, too many redirects"
-msgstr ""
+msgstr "Zahteva ni uspela, preveÄ preusmeritev"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Bad download hash, assuming file has been tampered with."
-msgstr ""
+msgstr "Slab prenos hash kode, predvidevamo, da je bila datoteka spremenjena."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Expected:"
-msgstr ""
+msgstr "PriÄakovano:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Got:"
-msgstr ""
+msgstr "Dobil:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Failed sha256 hash check"
-msgstr ""
+msgstr "Neuspešno preverjanje preizkusa sha256"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Asset Download Error:"
-msgstr ""
+msgstr "Napaka pri prenosu sredstev:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Fetching:"
-msgstr ""
+msgstr "Pridobivanje:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr ""
+msgid "Resolving..."
+msgstr "Razreševanje..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3298,24 +3360,24 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "first"
-msgstr ""
+msgstr "prvi"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "prev"
-msgstr ""
+msgstr "prejšnji"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "next"
-msgstr ""
+msgstr "naslednji"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "last"
-msgstr ""
+msgstr "zadnji"
#: editor/plugins/asset_library_editor_plugin.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "All"
-msgstr ""
+msgstr "Vse"
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_settings_editor.cpp
@@ -3324,7 +3386,7 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Sort:"
-msgstr ""
+msgstr "Razvrsti:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Reverse"
@@ -3333,15 +3395,15 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_settings_editor.cpp
msgid "Category:"
-msgstr ""
+msgstr "Kategorija:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Site:"
-msgstr ""
+msgstr "Stran:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr ""
+msgid "Support..."
+msgstr "Podpora..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3367,6 +3429,8 @@ msgid ""
"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
"Light' flag is on."
msgstr ""
+"Brez modelov za peko. Poskrbi, da vsebujejo kanal UV2 in da je vkljuÄena "
+"oznaka 'ZapeÄi Svetlobo'."
#: editor/plugins/baked_lightmap_editor_plugin.cpp
msgid "Failed creating lightmap images, make sure path is writable."
@@ -3420,9 +3484,8 @@ msgid "Create new vertical guide"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Remove vertical guide"
-msgstr "Odstrani Spremenljivko"
+msgstr "Odstranite navpiÄni vodnik"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move horizontal guide"
@@ -3433,9 +3496,8 @@ msgid "Create new horizontal guide"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Remove horizontal guide"
-msgstr "Odstrani Spremenljivko"
+msgstr "Odstrani vodoravno vodilo"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Create new horizontal and vertical guides"
@@ -3467,11 +3529,11 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Select Mode"
-msgstr ""
+msgstr "Izberite NaÄin"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Drag: Rotate"
-msgstr ""
+msgstr "Povlecite: Zavrti"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+Drag: Move"
@@ -3483,15 +3545,15 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Alt+RMB: Depth list selection"
-msgstr ""
+msgstr "Alt+RMB: Izbira globine"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Move Mode"
-msgstr ""
+msgstr "NaÄin Premika"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Rotate Mode"
-msgstr ""
+msgstr "NaÄin Vrtenja"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
@@ -3499,6 +3561,8 @@ msgid ""
"Show a list of all objects at the position clicked\n"
"(same as Alt+RMB in select mode)."
msgstr ""
+"Ob kliku prikaži seznam vseh objektov na tem mestu.\n"
+"(isto kot Alt+RMB v naÄinu izbire)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Click to change object's rotation pivot."
@@ -3509,9 +3573,8 @@ msgid "Pan Mode"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Toggles snapping"
-msgstr "Preklopi na Zaustavitev"
+msgstr "Preklopi pripenjanje"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Use Snap"
@@ -3530,8 +3593,9 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr ""
+msgstr "Preoblikuj Zaskok..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3568,12 +3632,12 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Lock the selected object in place (can't be moved)."
-msgstr ""
+msgstr "Izbrani predmet zaklenite na svoje mesto (ga ni mogoÄe premakniti)."
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Unlock the selected object (can be moved)."
-msgstr ""
+msgstr "Odklenite izbrani predmet (ga lahko premaknete)."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Makes sure the object's children are not selectable."
@@ -3606,7 +3670,7 @@ msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/spatial_editor_plugin.cpp
msgid "View"
-msgstr ""
+msgstr "Pogled"
#: editor/plugins/canvas_item_editor_plugin.cpp
#: editor/plugins/polygon_2d_editor_plugin.cpp
@@ -3626,6 +3690,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3662,9 +3734,8 @@ msgid "Drag pivot from mouse position"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
-#, fuzzy
msgid "Set pivot at mouse position"
-msgstr "Odstrani Signal"
+msgstr "Nastavite toÄko na položaj miÅ¡ke"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Multiply grid step by 2"
@@ -3773,14 +3844,12 @@ msgid "Load Curve Preset"
msgstr ""
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Add point"
-msgstr "Dodaj Signal"
+msgstr "Dodaj toÄko"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Remove point"
-msgstr "Odstrani Signal"
+msgstr "Odstrani toÄko"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Left linear"
@@ -3795,9 +3864,8 @@ msgid "Load preset"
msgstr ""
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Remove Curve Point"
-msgstr "Odstrani Signal"
+msgstr "Odstrani Krivuljno ToÄko"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Toggle Curve Linear Tangent"
@@ -3864,11 +3932,11 @@ msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Mesh is empty!"
-msgstr ""
+msgstr "Model je prazen!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Static Trimesh Body"
-msgstr ""
+msgstr "Ustvari StatiÄno Telo TriModel"
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Create Static Convex Body"
@@ -3915,6 +3983,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3943,7 +4015,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4148,7 +4220,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4327,19 +4399,16 @@ msgid "Curve Point #"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve Point Position"
-msgstr "Odstrani Signal"
+msgstr "Nastavi Položaj Krivuljne ToÄke"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve In Position"
-msgstr "Odstrani Signal"
+msgstr "Nastavi Krivuljo na Položaj"
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Set Curve Out Position"
-msgstr "Odstrani Signal"
+msgstr "Nastavi Krivuljo iz Položaja"
#: editor/plugins/path_editor_plugin.cpp
msgid "Split Path"
@@ -4350,9 +4419,8 @@ msgid "Remove Path Point"
msgstr ""
#: editor/plugins/path_editor_plugin.cpp
-#, fuzzy
msgid "Remove Out-Control Point"
-msgstr "Odstrani Funkcijo"
+msgstr "Odstrani ToÄko Izven Nadzora"
#: editor/plugins/path_editor_plugin.cpp
msgid "Remove In-Control Point"
@@ -4376,7 +4444,7 @@ msgstr ""
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Ctrl: Rotate"
-msgstr ""
+msgstr "Ctrl: Vrtenje"
#: editor/plugins/polygon_2d_editor_plugin.cpp
msgid "Shift: Move All"
@@ -4513,7 +4581,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4593,9 +4661,8 @@ msgid "Close Docs"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Close All"
-msgstr "Zapri"
+msgstr "Zapri Vse"
#: editor/plugins/script_editor_plugin.cpp
msgid "Close Other Tabs"
@@ -4603,7 +4670,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
msgid "Run"
-msgstr ""
+msgstr "Zaženi"
#: editor/plugins/script_editor_plugin.cpp
msgid "Toggle Scripts Panel"
@@ -4611,7 +4678,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4688,7 +4755,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
msgid "Debugger"
-msgstr ""
+msgstr "RazhroÅ¡Äevalnik"
#: editor/plugins/script_editor_plugin.cpp
msgid ""
@@ -4736,9 +4803,8 @@ msgid "Select All"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Delete Line"
-msgstr "Izbriši Izbrano"
+msgstr "Izbriši Vrstico"
#: editor/plugins/script_text_editor.cpp
msgid "Indent Left"
@@ -4753,9 +4819,8 @@ msgid "Toggle Comment"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-#, fuzzy
msgid "Fold/Unfold Line"
-msgstr "Izbriši Izbrano"
+msgstr "Pregibna/Nepregibna ÄŒrta"
#: editor/plugins/script_text_editor.cpp
msgid "Fold All Lines"
@@ -4819,15 +4884,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5019,9 +5084,8 @@ msgid "Material Changes"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Shader Changes"
-msgstr "Spremeni"
+msgstr "Spremebe v Shader"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Surface Changes"
@@ -5176,9 +5240,8 @@ msgid "XForm Dialog"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Select Mode (Q)"
-msgstr "Dodaj Setter Lastnost"
+msgstr "Izberite NaÄin (Q)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid ""
@@ -5186,18 +5249,21 @@ msgid ""
"Alt+Drag: Move\n"
"Alt+RMB: Depth list selection"
msgstr ""
+"Povlecite: Zavrtite\n"
+"Alt+Drag: Premaknite\n"
+"Alt+RMB: Izbira globine"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Move Mode (W)"
-msgstr ""
+msgstr "NaÄin Premika (W)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate Mode (E)"
-msgstr ""
+msgstr "NaÄin Vrtenja (E)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Scale Mode (R)"
-msgstr ""
+msgstr "NaÄin Obsega (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
@@ -5205,11 +5271,11 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
-msgstr ""
+msgstr "Lokalno prostorski naÄin (%s)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap Mode (%s)"
-msgstr ""
+msgstr "NaÄin Zaskoka (%s)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Bottom View"
@@ -5256,9 +5322,8 @@ msgid "Align Selection With View"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Tool Select"
-msgstr "Izbriši Izbrano"
+msgstr "Izbira Orodja"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Tool Move"
@@ -5273,21 +5338,16 @@ msgid "Tool Scale"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-#, fuzzy
msgid "Toggle Freelook"
-msgstr "Preklopi na Zaustavitev"
+msgstr "Preklopi Svobodni Pregled"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform"
-msgstr ""
+msgstr "Preoblikovanje"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr ""
+msgid "Transform Dialog..."
+msgstr "Preoblikovanje Dialoga..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5332,11 +5392,11 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Snap Settings"
-msgstr ""
+msgstr "Nastavitve ZaskoÄenja"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translate Snap:"
-msgstr ""
+msgstr "Prestavi ZaskoÄenje:"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotate Snap (deg.):"
@@ -5364,7 +5424,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Transform Change"
-msgstr ""
+msgstr "Preoblikovanje Sprememb"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translate:"
@@ -5472,7 +5532,7 @@ msgstr ""
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "Snap Mode:"
-msgstr ""
+msgstr "NaÄin Postavljanja:"
#: editor/plugins/texture_region_editor_plugin.cpp
msgid "<None>"
@@ -5531,17 +5591,15 @@ msgid "Remove Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove All Items"
-msgstr "Odstrani Spremenljivko"
+msgstr "Odstrani Vse Stvari"
#: editor/plugins/theme_editor_plugin.cpp
-#, fuzzy
msgid "Remove All"
-msgstr "Odstrani Signal"
+msgstr "Odstrani Vse"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5589,6 +5647,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5601,7 +5667,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5757,9 +5823,8 @@ msgid ""
msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
-#, fuzzy
msgid "Select current edited sub-tile."
-msgstr "Dodaj Setter Lastnost"
+msgstr "Izberi trenutno pod-ploÅ¡Äo v urejanju."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select sub-tile to change its priority."
@@ -5790,7 +5855,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5869,17 +5934,22 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Please choose a 'project.godot' file."
-msgstr ""
+msgstr "Izberite datoteko 'projekt.godot'."
#: editor/project_manager.cpp
msgid "Please choose an empty folder."
-msgstr ""
+msgstr "Izberite prazno mapo."
#: editor/project_manager.cpp
msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Ime Projekta:"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -5914,17 +5984,16 @@ msgid "The following files failed extraction from package:"
msgstr ""
#: editor/project_manager.cpp
-#, fuzzy
msgid "Rename Project"
-msgstr "Preimenuj Funkcijo"
+msgstr "Preimenuj Projekt"
#: editor/project_manager.cpp
msgid "New Game Project"
-msgstr ""
+msgstr "Novi Projekt Igre"
#: editor/project_manager.cpp
msgid "Import Existing Project"
-msgstr ""
+msgstr "Uvoz ObstojeÄega Projekta"
#: editor/project_manager.cpp
msgid "Import & Edit"
@@ -5932,12 +6001,11 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Create New Project"
-msgstr ""
+msgstr "Ustvarite Nov Projekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Create & Edit"
-msgstr "Ustvari"
+msgstr "Ustvari & Uredi"
#: editor/project_manager.cpp
msgid "Install Project:"
@@ -5949,19 +6017,19 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Project Name:"
-msgstr ""
+msgstr "Ime Projekta:"
#: editor/project_manager.cpp
msgid "Create folder"
-msgstr ""
+msgstr "Ustvarite mapo"
#: editor/project_manager.cpp
msgid "Project Path:"
-msgstr ""
+msgstr "Pot Projekta:"
#: editor/project_manager.cpp
msgid "Browse"
-msgstr ""
+msgstr "Brskaj"
#: editor/project_manager.cpp
msgid "Unnamed Project"
@@ -6010,32 +6078,31 @@ msgstr ""
#: editor/project_manager.cpp
msgid "Project Manager"
-msgstr ""
+msgstr "Upravljalnik Projekta"
#: editor/project_manager.cpp
msgid "Project List"
-msgstr ""
+msgstr "Seznam Projektov"
#: editor/project_manager.cpp
msgid "Scan"
-msgstr ""
+msgstr "Preglej"
#: editor/project_manager.cpp
msgid "Select a Folder to Scan"
-msgstr ""
+msgstr "Izberite Mapo za Skeniranje"
#: editor/project_manager.cpp
msgid "New Project"
-msgstr ""
+msgstr "Nov Projekt"
#: editor/project_manager.cpp
-#, fuzzy
msgid "Templates"
-msgstr "Odstrani Spremenljivko"
+msgstr "Predloge"
#: editor/project_manager.cpp
msgid "Exit"
-msgstr ""
+msgstr "Izhod"
#: editor/project_manager.cpp
msgid "Restart Now"
@@ -6050,6 +6117,8 @@ msgid ""
"You don't currently have any projects.\n"
"Would you like to explore the official example projects in the Asset Library?"
msgstr ""
+"Trenutno nimate projektov.\n"
+"Želite raziskovati uradne primere projektov v Asset Library?"
#: editor/project_settings_editor.cpp
msgid "Key "
@@ -6068,7 +6137,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6096,7 +6167,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6192,9 +6263,8 @@ msgid "Wheel Down."
msgstr ""
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Add Global Property"
-msgstr "Dodaj Getter Lastnost"
+msgstr "Dodaj Globalno Lastnost"
#: editor/project_settings_editor.cpp
msgid "Select a setting item first!"
@@ -6209,13 +6279,8 @@ msgid "Setting '%s' is internal, and it can't be deleted."
msgstr ""
#: editor/project_settings_editor.cpp
-#, fuzzy
msgid "Delete Item"
-msgstr "Izbriši Izbrano"
-
-#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
+msgstr "Izbriši Predmet"
#: editor/project_settings_editor.cpp
msgid "Already existing"
@@ -6286,7 +6351,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6382,11 +6447,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6394,9 +6459,8 @@ msgid "Assign"
msgstr ""
#: editor/property_editor.cpp
-#, fuzzy
msgid "Select Node"
-msgstr "Dodaj Setter Lastnost"
+msgstr "Izberi Gradnik"
#: editor/property_editor.cpp
msgid "New Script"
@@ -6440,7 +6504,7 @@ msgstr ""
#: editor/property_editor.cpp
msgid "[Empty]"
-msgstr ""
+msgstr "[Prazen]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
@@ -6451,9 +6515,8 @@ msgid "Properties:"
msgstr ""
#: editor/property_selector.cpp
-#, fuzzy
msgid "Select Property"
-msgstr "Dodaj Setter Lastnost"
+msgstr "Izberi Lastnost"
#: editor/property_selector.cpp
msgid "Select Virtual Method"
@@ -6559,7 +6622,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -6675,9 +6738,8 @@ msgid "Clear a script for the selected node."
msgstr ""
#: editor/scene_tree_dock.cpp
-#, fuzzy
msgid "Remote"
-msgstr "Odstrani Signal"
+msgstr "Upravljalnik"
#: editor/scene_tree_dock.cpp
msgid "Local"
@@ -6806,18 +6868,16 @@ msgid "Wrong extension chosen"
msgstr ""
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Invalid Path"
-msgstr ": Neveljavni argumenti: "
+msgstr "Neveljavna Pot"
#: editor/script_create_dialog.cpp
msgid "Invalid class name"
msgstr ""
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Invalid inherited parent name or path"
-msgstr "Neveljaven indeks lastnosti imena."
+msgstr "Neveljaveno prevzeto ime ali pot nadrejenega"
#: editor/script_create_dialog.cpp
msgid "Script valid"
@@ -6852,9 +6912,8 @@ msgid "Class Name"
msgstr ""
#: editor/script_create_dialog.cpp
-#, fuzzy
msgid "Template"
-msgstr "Odstrani Spremenljivko"
+msgstr "Predloga"
#: editor/script_create_dialog.cpp
msgid "Built-in Script"
@@ -6865,9 +6924,8 @@ msgid "Attach Node Script"
msgstr ""
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Remote "
-msgstr "Odstrani Signal"
+msgstr "Upravljalnik "
#: editor/script_editor_debugger.cpp
msgid "Bytes:"
@@ -7058,9 +7116,8 @@ msgid "Select dependencies of the library for this entry"
msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
-#, fuzzy
msgid "Remove current entry"
-msgstr "Odstrani Signal"
+msgstr "Odstrani trenutni vnos"
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Double click to create a new entry"
@@ -7174,9 +7231,8 @@ msgid "Floor:"
msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "GridMap Delete Selection"
-msgstr "Izbriši Izbrano"
+msgstr "GridMap Izbriši Izbor"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "GridMap Duplicate Selection"
@@ -7255,9 +7311,8 @@ msgid "Erase Area"
msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Clear Selection"
-msgstr "Izbriši Izbrano"
+msgstr "PoÄisti izbrano"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "GridMap Settings"
@@ -7267,6 +7322,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7315,20 +7374,24 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
"properly!"
msgstr ""
-"Node je bil sprejet brez potrebnega pomnilnika, pravilen postopek je opisan "
-"v dokumentaciji!"
+"Gradnik je bil ustavljen brez delovnega spomina, v dokumentaciji si "
+"preberite kako ga pravilno ustaviti!"
#: modules/visual_script/visual_script.cpp
msgid ""
"Node yielded, but did not return a function state in the first working "
"memory."
msgstr ""
-"Node pridobljen, vendar se ne vrne v funkcijalno stanje v prvem delavnem "
+"VozliÅ¡Äe se je ustavilo, vendar ni vrnilo stanje funkcije v prvem delovnem "
"spominu."
#: modules/visual_script/visual_script.cpp
@@ -7336,25 +7399,25 @@ msgid ""
"Return value must be assigned to first element of node working memory! Fix "
"your node please."
msgstr ""
-"Vrnjena vrednost mora biti dodeljena prvemu elementu v node-delavnemu "
-"spominu! Prosim, da popraviš node."
+"Vrnjena vrednost mora biti dodeljena prvemu elementu delovnega spomina "
+"vozliÅ¡Äa! Prosimo popravite vozliÅ¡Äe."
#: modules/visual_script/visual_script.cpp
msgid "Node returned an invalid sequence output: "
-msgstr "Node je vrnil napaÄno zaporedje na izhodu: "
+msgstr "VozliÅ¡Äe je vrnilo napaÄno sekvenco na izhodu: "
#: modules/visual_script/visual_script.cpp
msgid "Found sequence bit but not the node in the stack, report bug!"
-msgstr "Zaporedni bit najden, vendar ne node v skladu, prijavi napako!"
+msgstr ""
+"SekvenÄni bit je bil najden, vozliÅ¡Äe na skladu pa ne; prijavite napako!"
#: modules/visual_script/visual_script.cpp
msgid "Stack overflow with stack depth: "
msgstr "Sklad prepoln z stack depth: "
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Signal Arguments"
-msgstr "Uredi Argumente Signala:"
+msgstr "Spremeni Argumente Signala"
#: modules/visual_script/visual_script_editor.cpp
msgid "Change Argument Type"
@@ -7369,9 +7432,8 @@ msgid "Set Variable Default Value"
msgstr ""
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Set Variable Type"
-msgstr "Uredi Spremenljivko:"
+msgstr "Nastavite Tip Spremenljivke"
#: modules/visual_script/visual_script_editor.cpp
msgid "Functions:"
@@ -7419,12 +7481,11 @@ msgstr ""
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node"
-msgstr "Dodaj Node"
+msgstr "Dodaj vozliÅ¡Äe"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Remove VisualScript Nodes"
-msgstr "Odstrani Spremenljivko"
+msgstr "Odstrani Gradnike VizualnaSkripta"
#: modules/visual_script/visual_script_editor.cpp
msgid "Duplicate VisualScript Nodes"
@@ -7455,13 +7516,12 @@ msgid "Hold Ctrl to drop a Variable Setter."
msgstr ""
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Add Preload Node"
-msgstr "Dodaj Node"
+msgstr "Dodaj prednaloženo vozliÅ¡Äe"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Node(s) From Tree"
-msgstr "Dodaj Node(e) iz Drevesa"
+msgstr "Dodaj Gradnik(e) iz Drevesa"
#: modules/visual_script/visual_script_editor.cpp
msgid "Add Getter Property"
@@ -7472,18 +7532,16 @@ msgid "Add Setter Property"
msgstr "Dodaj Setter Lastnost"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Change Base Type"
-msgstr "Osnovni Tip:"
+msgstr "Spremeni Osnovni Tip"
#: modules/visual_script/visual_script_editor.cpp
msgid "Move Node(s)"
msgstr ""
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Remove VisualScript Node"
-msgstr "Odstrani Spremenljivko"
+msgstr "Odstrani Gradnik VizualnaSkripta"
#: modules/visual_script/visual_script_editor.cpp
msgid "Connect Nodes"
@@ -7546,18 +7604,16 @@ msgid "Remove Function"
msgstr "Odstrani Funkcijo"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Edit Variable"
-msgstr "Uredi Spremenljivko:"
+msgstr "Uredi Spremenljivko"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Variable"
msgstr "Odstrani Spremenljivko"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Edit Signal"
-msgstr "Urejanje Signala:"
+msgstr "Uredi Signal"
#: modules/visual_script/visual_script_editor.cpp
msgid "Remove Signal"
@@ -7596,9 +7652,8 @@ msgid "Delete Selected"
msgstr "Izbriši Izbrano"
#: modules/visual_script/visual_script_editor.cpp
-#, fuzzy
msgid "Find Node Type"
-msgstr "Najdi Node Type"
+msgstr "PoiÅ¡Äi tip vozliÅ¡Äa"
#: modules/visual_script/visual_script_editor.cpp
msgid "Copy Nodes"
@@ -7630,15 +7685,15 @@ msgstr "Neveljaven indeks lastnosti imena."
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Base object is not a Node!"
-msgstr "Osnovni objekt ni Node!"
+msgstr "ZaÄetni objekt ni vozliÅ¡Äe!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Path does not lead Node!"
-msgstr "Pot ne vodi do Node!"
+msgstr "Pot ne vodi do vozliÅ¡Äa!"
#: modules/visual_script/visual_script_func_nodes.cpp
msgid "Invalid index property name '%s' in node %s."
-msgstr "Neveljaven indeks lastnosti imena '%s' v node %s."
+msgstr "Neveljaven indeks lastnosti imena '%s' v vozliÅ¡Äu %s."
#: modules/visual_script/visual_script_nodes.cpp
msgid ": Invalid argument of type: "
@@ -7658,7 +7713,7 @@ msgstr "VariableSet ni najden v skripti: "
#: modules/visual_script/visual_script_nodes.cpp
msgid "Custom node has no _step() method, can't process graph."
-msgstr "Custom node nima _step() metode, grafa ni mogoÄe obdelati."
+msgstr "VozliÅ¡Äe po meri nima metode _step(); grafa ni mogoÄe obdelati."
#: modules/visual_script/visual_script_nodes.cpp
msgid ""
@@ -7685,9 +7740,8 @@ msgid "Could not open template for export:"
msgstr ""
#: platform/javascript/export/export.cpp
-#, fuzzy
msgid "Invalid export template:"
-msgstr "Neveljaven indeks lastnosti imena."
+msgstr "Neveljavna izvozna predloga:"
#: platform/javascript/export/export.cpp
msgid "Could not read custom HTML shell:"
@@ -7929,10 +7983,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -7947,20 +8011,19 @@ msgstr ""
#: scene/gui/color_picker.cpp
msgid "Raw Mode"
-msgstr ""
+msgstr "Neobdelan naÄin"
#: scene/gui/color_picker.cpp
msgid "Add current color as a preset"
-msgstr "Dodaj trenutno barvo za prednastavitev"
+msgstr "Dodaj trenutno barvo kot prednastavljeno"
#: scene/gui/dialogs.cpp
msgid "Alert!"
msgstr "Opozorilo!"
#: scene/gui/dialogs.cpp
-#, fuzzy
msgid "Please Confirm..."
-msgstr "Potrdite..."
+msgstr "Prosimo Potrdite..."
#: scene/gui/file_dialog.cpp
msgid "Select this Folder"
@@ -8017,6 +8080,14 @@ msgstr "Napaka nalaganja pisave."
msgid "Invalid font size."
msgstr "Neveljavna velikost pisave."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Prejšnji zavihek"
+
+#, fuzzy
+#~ msgid "Next"
+#~ msgstr "Naslednji zavihek"
+
#~ msgid "Not found!"
#~ msgstr "Ni Zadetka!"
diff --git a/editor/translations/sr_Cyrl.po b/editor/translations/sr_Cyrl.po
index 66ceb3e449..c838174131 100644
--- a/editor/translations/sr_Cyrl.po
+++ b/editor/translations/sr_Cyrl.po
@@ -500,7 +500,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Повежи '%s' Ñа '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "Повежи..."
#: editor/connections_dialog.cpp
@@ -925,11 +925,11 @@ msgid "Move Audio Bus"
msgstr "Помери звучни баÑ"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr "Сачувај раÑпоред звучног баÑа као..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr "Локација за нови раÑпоред..."
#: editor/editor_audio_buses.cpp
@@ -1065,11 +1065,11 @@ msgid "Updating Scene"
msgstr "Ðжурирање Ñцене"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr "Чувам локалне промене..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "Ðжурирам Ñцену..."
#: editor/editor_data.cpp
@@ -1140,7 +1140,7 @@ msgid "Show In File Manager"
msgstr "Покажи у менаџеру датотека"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "Ðови директоријум..."
#: editor/editor_file_dialog.cpp
@@ -1402,17 +1402,21 @@ msgstr "Обриши"
msgid "Clear Output"
msgstr "Излаз"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Грешка при чувању реÑурÑа!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "Сачувај реÑÑƒÑ€Ñ ÐºÐ°Ð¾..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "Разумем..."
#: editor/editor_node.cpp
@@ -1641,11 +1645,11 @@ msgid "Open Base Scene"
msgstr "Отвори базну Ñцену"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "Брзо отварање Ñцене..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "Брзо отварање Ñкриптице..."
#: editor/editor_node.cpp
@@ -1657,7 +1661,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "Сачувај промене '%s' пре излаÑка?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "Сачувај Ñцену као..."
#: editor/editor_node.cpp
@@ -1709,7 +1713,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Ова акција Ñе не може опозвати. ÐаÑтави?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr "Брзо покретање Ñцене..."
#: editor/editor_node.cpp
@@ -1865,7 +1869,7 @@ msgid "Previous tab"
msgstr "Претходни таб"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Филтрирај датотеке..."
#: editor/editor_node.cpp
@@ -1877,11 +1881,11 @@ msgid "New Scene"
msgstr "Ðова Ñцена"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr "Ðова наÑлеђена Ñцена..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "Отвори Ñцену..."
#: editor/editor_node.cpp
@@ -1901,15 +1905,15 @@ msgid "Open Recent"
msgstr "Отвори недавно коришћено"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "Конвертуј у..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2173,7 +2177,7 @@ msgid "Save the currently edited resource."
msgstr "Сачувај тренутно измењени реÑурÑ."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Сачувај као..."
#: editor/editor_node.cpp
@@ -2282,7 +2286,7 @@ msgid "Creating Mesh Previews"
msgstr "Ðаправи приказ мрежа"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr "Сличица..."
#: editor/editor_plugin_settings.cpp
@@ -2437,7 +2441,7 @@ msgid "(Current)"
msgstr "(Тренутно)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr "Прихватам одредишта, молим Ñачекајте..."
#: editor/export_template_manager.cpp
@@ -2453,14 +2457,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ðеважећи формат датотеке version.txt унутар шаблона."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ðеважећи формат датотеке „version.txt“ унутар шаблона. „Revision“ није "
-"важећи идентификатор."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "„version.txt“ није пронаћен у шаблону."
@@ -2525,7 +2521,7 @@ msgid "Error requesting url: "
msgstr "Грешка при захтеву url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "Повезивање Ñа одредиштем..."
#: editor/export_template_manager.cpp
@@ -2542,7 +2538,7 @@ msgstr "Ðе могу решити"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "Повезивање..."
#: editor/export_template_manager.cpp
@@ -2556,7 +2552,7 @@ msgstr "Повезан"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "Захтевање..."
#: editor/export_template_manager.cpp
@@ -2700,11 +2696,11 @@ msgid "Collapse all"
msgstr "Умањи Ñве"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "Преименуј..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Помери у..."
#: editor/filesystem_dock.cpp
@@ -2717,16 +2713,16 @@ msgid "Instance"
msgstr "Додај инÑтанцу"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr "Измени завиÑноÑти..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr "Погледај влаÑнике..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Дуплирај"
#: editor/filesystem_dock.cpp
@@ -2752,7 +2748,7 @@ msgstr "Ðаправи Ñледећу Ñцену/е као дете одабра
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Скенирање датотека,\n"
"Молим Ñачекајте..."
@@ -2820,7 +2816,7 @@ msgid "Import Scene"
msgstr "Увези Ñцену"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "Увожење Ñцеене..."
#: editor/import/resource_importer_scene.cpp
@@ -2834,7 +2830,7 @@ msgid "Generating for Mesh: "
msgstr "ГенериÑање оÑног поравнаног граничниог оквира (AABB)"
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr "Обрађивање Ñкриптице..."
#: editor/import/resource_importer_scene.cpp
@@ -2850,7 +2846,7 @@ msgid "Error running post-import script:"
msgstr "Грешка при обрађивању поÑÑ‚-увозне Ñкриптице:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Чување..."
#: editor/import_dock.cpp
@@ -2870,7 +2866,7 @@ msgid "Import As:"
msgstr "Увези као:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr "ПоÑтавке..."
#: editor/import_dock.cpp
@@ -3288,7 +3284,7 @@ msgid "Transition Node"
msgstr "Transition чвор"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr "Увези анимације..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3296,7 +3292,7 @@ msgid "Edit Node Filters"
msgstr "Измени филтере чвора"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Филтери..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3365,7 +3361,7 @@ msgid "Fetching:"
msgstr "Преузимање:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "Решавање..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3432,7 +3428,7 @@ msgid "Site:"
msgstr "Веб Ñтраница:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Подршка..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3622,6 +3618,7 @@ msgid "Use Rotation Snap"
msgstr "КориÑти лепљење ротације"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "ПоÑтавке лепљења..."
@@ -3718,6 +3715,16 @@ msgid "Show Guides"
msgstr "Покажи водиче"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Origin"
+msgstr "Прикажи центар"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Viewport"
+msgstr "1 прозор"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Центрирај одабрано"
@@ -4007,6 +4014,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Мрежа нема површине за прављење ивица!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "ÐеуÑпех при прављењу ивица!"
@@ -4035,7 +4046,7 @@ msgid "Create Convex Collision Sibling"
msgstr "Ðаправи конвекÑног Ñударног брата"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr "Ðаправи ивичну мрежу..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4243,7 +4254,7 @@ msgid "Error loading image:"
msgstr "Грешка при учитавању Ñлике:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr "У Ñлици нема пикÑела Ñа транÑпарентношћу већом од 128..."
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4608,7 +4619,7 @@ msgid "Import Theme"
msgstr "Увези тему"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Сачувај тему као..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4707,7 +4718,7 @@ msgstr "Прикажи панел Ñкриптица"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr "Тражи..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4918,15 +4929,15 @@ msgid "Find Previous"
msgstr "Ðађи претходни"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr "Замени..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr "Иди на функцију..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr "Иди на линију..."
#: editor/plugins/script_text_editor.cpp
@@ -5383,11 +5394,7 @@ msgid "Transform"
msgstr "ТранÑформација"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Конфигуриши лепљење..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr "Прозор транÑформације..."
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5643,7 +5650,7 @@ msgid "Remove All"
msgstr "Обриши Ñве"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Измени тему..."
#: editor/plugins/theme_editor_plugin.cpp
@@ -5693,6 +5700,16 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "Додај Ñтвар"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "CheckBox Radio1"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Има"
@@ -5705,7 +5722,8 @@ msgid "Options"
msgstr "Опција"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+#, fuzzy
+msgid "Has,Many,Options"
msgstr "Има,много,неколико,опција!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5904,7 +5922,7 @@ msgid "Presets"
msgstr "ПоÑтавке"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Додај..."
#: editor/project_export.cpp
@@ -6000,6 +6018,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Ðеважеће име."
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "ÐеуÑпех при прављењу директоријума."
@@ -6188,7 +6211,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6216,7 +6241,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6333,10 +6358,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6405,7 +6426,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6501,11 +6522,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6677,7 +6698,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7381,6 +7402,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
#, fuzzy
msgid "Generating solution..."
@@ -7436,6 +7461,10 @@ msgstr "Пројекат"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8026,10 +8055,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8110,12 +8149,23 @@ msgstr ""
msgid "Invalid font size."
msgstr "Ðеважећа величина фонта."
-#~ msgid "Can't write file."
-#~ msgstr "ÐеуÑпех при запиÑивању датотеке."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Претходни таб"
#~ msgid "Next"
#~ msgstr "Следеће"
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ðеважећи формат датотеке „version.txt“ унутар шаблона. „Revision“ није "
+#~ "важећи идентификатор."
+
+#~ msgid "Can't write file."
+#~ msgstr "ÐеуÑпех при запиÑивању датотеке."
+
#~ msgid "Not found!"
#~ msgstr "Ðије пронађено!"
diff --git a/editor/translations/sr_Latn.po b/editor/translations/sr_Latn.po
new file mode 100644
index 0000000000..975418d4fb
--- /dev/null
+++ b/editor/translations/sr_Latn.po
@@ -0,0 +1,7955 @@
+# Serbian (latin) translation of the Godot Engine editor
+# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
+# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
+# This file is distributed under the same license as the Godot source code.
+#
+# Milos Ponjavusic <brane@branegames.com>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Godot Engine editor\n"
+"PO-Revision-Date: 2018-05-15 08:41+0000\n"
+"Last-Translator: Milos Ponjavusic <brane@branegames.com>\n"
+"Language-Team: Serbian (latin) <https://hosted.weblate.org/projects/godot-"
+"engine/godot/sr_Latn/>\n"
+"Language: sr_Latn\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8-bit\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"X-Generator: Weblate 3.0-dev\n"
+
+#: editor/animation_editor.cpp
+msgid "Disabled"
+msgstr "Onemogućeno"
+
+#: editor/animation_editor.cpp
+msgid "All Selection"
+msgstr "Sve sekcije"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Keyframe Time"
+msgstr "Animacija Promjeni Vrijeme KljuÄnog Kadra"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Transition"
+msgstr "Animacija Promjeni Tranziciju"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Transform"
+msgstr "Animacija Promjeni Transformaciju"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Keyframe Value"
+msgstr "Animacija Promjeni Vrijednost KljuÄnog Kadra"
+
+#: editor/animation_editor.cpp
+msgid "Anim Change Call"
+msgstr "Animacija Promjeni Poziv"
+
+#: editor/animation_editor.cpp
+msgid "Anim Add Track"
+msgstr "Animacija Dodaj Kanal"
+
+#: editor/animation_editor.cpp
+msgid "Anim Duplicate Keys"
+msgstr "Animacija Uduplaj KljuÄeve"
+
+#: editor/animation_editor.cpp
+msgid "Move Anim Track Up"
+msgstr "Pomjeri Kanal Animacije Gore"
+
+#: editor/animation_editor.cpp
+msgid "Move Anim Track Down"
+msgstr "Pomjeri Kanal Animacije Dole"
+
+#: editor/animation_editor.cpp
+msgid "Remove Anim Track"
+msgstr "Odstrani Kanal Animacije"
+
+#: editor/animation_editor.cpp
+msgid "Set Transitions to:"
+msgstr "Postavi tranzicije na:"
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Rename"
+msgstr "Animacija Preimenuj Kanal"
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Change Interpolation"
+msgstr "Animacija Promjeni Interpolaciju Kanala"
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Change Value Mode"
+msgstr "Animacija Promjeni Vrijednosni Režim Kanala"
+
+#: editor/animation_editor.cpp
+msgid "Anim Track Change Wrap Mode"
+msgstr "Animacija Promjeni Režim Omotavanja Kanala"
+
+#: editor/animation_editor.cpp
+msgid "Edit Node Curve"
+msgstr "Izmjeni Krivulju ÄŒvora"
+
+#: editor/animation_editor.cpp
+msgid "Edit Selection Curve"
+msgstr "Izmjeni Selekciju Krivulje"
+
+#: editor/animation_editor.cpp
+msgid "Anim Delete Keys"
+msgstr "Animacija ObriÅ¡i KljuÄeve"
+
+#: editor/animation_editor.cpp editor/plugins/tile_map_editor_plugin.cpp
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Duplicate Selection"
+msgstr "Uduplaj Selekciju"
+
+#: editor/animation_editor.cpp
+msgid "Duplicate Transposed"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove Selection"
+msgstr "Obriši Selekciju"
+
+#: editor/animation_editor.cpp
+msgid "Continuous"
+msgstr "Neprekidna"
+
+#: editor/animation_editor.cpp
+msgid "Discrete"
+msgstr "Diskretna"
+
+#: editor/animation_editor.cpp
+msgid "Trigger"
+msgstr "OkidaÄ"
+
+#: editor/animation_editor.cpp
+msgid "Anim Add Key"
+msgstr "Animacija Dodaj KljuÄ"
+
+#: editor/animation_editor.cpp
+msgid "Anim Move Keys"
+msgstr "Animacija Pomjeri KljuÄeve"
+
+#: editor/animation_editor.cpp
+msgid "Scale Selection"
+msgstr "Skaliraj Selekciju"
+
+#: editor/animation_editor.cpp
+msgid "Scale From Cursor"
+msgstr "Skaliraj od Kursora"
+
+#: editor/animation_editor.cpp
+msgid "Goto Next Step"
+msgstr "Otiđi Na Sljedeći Korak"
+
+#: editor/animation_editor.cpp
+msgid "Goto Prev Step"
+msgstr "Otiđi Na Prethodni Korak"
+
+#: editor/animation_editor.cpp editor/plugins/curve_editor_plugin.cpp
+#: editor/property_editor.cpp
+msgid "Linear"
+msgstr "Linearna"
+
+#: editor/animation_editor.cpp editor/plugins/theme_editor_plugin.cpp
+msgid "Constant"
+msgstr "Kontanta"
+
+#: editor/animation_editor.cpp
+msgid "In"
+msgstr "U"
+
+#: editor/animation_editor.cpp
+msgid "Out"
+msgstr "Izvan"
+
+#: editor/animation_editor.cpp
+msgid "In-Out"
+msgstr "U-Izvan"
+
+#: editor/animation_editor.cpp
+msgid "Out-In"
+msgstr "Izvan-U"
+
+#: editor/animation_editor.cpp
+msgid "Transitions"
+msgstr "Tranzicije"
+
+#: editor/animation_editor.cpp
+msgid "Optimize Animation"
+msgstr "Optimizuj Animaciju"
+
+#: editor/animation_editor.cpp
+msgid "Clean-Up Animation"
+msgstr "PoÄisti Animaciju"
+
+#: editor/animation_editor.cpp
+msgid "Create NEW track for %s and insert key?"
+msgstr "Napravi Novi kanal za %s i dodaj kljuÄ?"
+
+#: editor/animation_editor.cpp
+msgid "Create %d NEW tracks and insert keys?"
+msgstr "Napravi %d novih kanala i dodaj kljuÄeve?"
+
+#: editor/animation_editor.cpp editor/create_dialog.cpp
+#: editor/editor_audio_buses.cpp editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp editor/script_create_dialog.cpp
+msgid "Create"
+msgstr "Napravi"
+
+#: editor/animation_editor.cpp
+msgid "Anim Create & Insert"
+msgstr "Animacija Napravi i Dodaj"
+
+#: editor/animation_editor.cpp
+msgid "Anim Insert Track & Key"
+msgstr "Animacija Dodaj kanal i kljuÄ"
+
+#: editor/animation_editor.cpp
+msgid "Anim Insert Key"
+msgstr "Animacija dodaj kljuÄ"
+
+#: editor/animation_editor.cpp
+msgid "Change Anim Len"
+msgstr "Promijeni Dužinu Animacije"
+
+#: editor/animation_editor.cpp
+msgid "Change Anim Loop"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim Create Typed Value Key"
+msgstr "Animacija Napravit Tip Vrijednosni KljuÄ"
+
+#: editor/animation_editor.cpp
+msgid "Anim Insert"
+msgstr "Animacija Umetni"
+
+#: editor/animation_editor.cpp
+msgid "Anim Scale Keys"
+msgstr "Animacija Skaliraj KljuÄeve"
+
+#: editor/animation_editor.cpp
+msgid "Anim Add Call Track"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Animation zoom."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Length (s):"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Animation length (in seconds)."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Step (s):"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Cursor step snap (in seconds)."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Enable/Disable looping in animation."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Add new tracks."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Move current track up."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Move current track down."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove selected track."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Track tools"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Enable editing of individual keys by clicking them."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Anim. Optimizer"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Max. Linear Error:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Max. Angular Error:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Max Optimizable Angle:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Optimize"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Key"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Transition"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Scale Ratio:"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Call Functions in Which Node?"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove invalid keys"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Remove unresolved and empty tracks"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-up all animations"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-Up Animation(s) (NO UNDO!)"
+msgstr ""
+
+#: editor/animation_editor.cpp
+msgid "Clean-Up"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Resize Array"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Change Array Value Type"
+msgstr ""
+
+#: editor/array_property_edit.cpp
+msgid "Change Array Value"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Go to Line"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Line Number:"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "No Matches"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replaced %d occurrence(s)."
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Match Case"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Whole Words"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replace"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Replace All"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Selection Only"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Zoom In"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Zoom Out"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Reset Zoom"
+msgstr ""
+
+#: editor/code_editor.cpp editor/script_editor_debugger.cpp
+msgid "Line:"
+msgstr ""
+
+#: editor/code_editor.cpp
+msgid "Col:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Method in target Node must be specified!"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid ""
+"Target method not found! Specify a valid method or attach a script to target "
+"Node."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect To Node:"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
+#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
+msgid "Add"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/dependency_editor.cpp
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_manager.cpp
+#: editor/project_settings_editor.cpp
+msgid "Remove"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Add Extra Call Argument:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Extra Call Arguments:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Path to Node:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Make Function"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Deferred"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Oneshot"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/dependency_editor.cpp
+#: editor/export_template_manager.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/project_export.cpp
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+#: editor/run_settings_dialog.cpp editor/settings_config_dialog.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Close"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect '%s' to '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connecting Signal:"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Disconnect '%s' from '%s'"
+msgstr ""
+
+#: editor/connections_dialog.cpp
+msgid "Connect..."
+msgstr ""
+
+#: editor/connections_dialog.cpp
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Disconnect"
+msgstr ""
+
+#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
+msgid "Signals"
+msgstr ""
+
+#: editor/create_dialog.cpp
+msgid "Change %s Type"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/project_settings_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change"
+msgstr ""
+
+#: editor/create_dialog.cpp
+msgid "Create New %s"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp
+msgid "Favorites:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_file_dialog.cpp
+msgid "Recent:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_node.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
+#: editor/quick_open.cpp
+msgid "Search:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_help.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
+#: editor/quick_open.cpp
+msgid "Matches:"
+msgstr ""
+
+#: editor/create_dialog.cpp editor/editor_help.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp editor/property_selector.cpp
+#: editor/script_editor_debugger.cpp
+msgid "Description:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Search Replacement For:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependencies For:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"Scene '%s' is currently being edited.\n"
+"Changes will not take effect unless reloaded."
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"Resource '%s' is in use.\n"
+"Changes will take effect when reloaded."
+msgstr ""
+
+#: editor/dependency_editor.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Dependencies"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Resource"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
+#: editor/project_manager.cpp editor/project_settings_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Path"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependencies:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Fix Broken"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Dependency Editor"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Search Replacement Resource:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_file_dialog.cpp
+#: editor/editor_help.cpp editor/editor_node.cpp editor/filesystem_dock.cpp
+#: editor/plugins/script_editor_plugin.cpp editor/property_selector.cpp
+#: editor/quick_open.cpp scene/gui/file_dialog.cpp
+msgid "Open"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Owners Of:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Remove selected files from the project? (no undo)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid ""
+"The files being removed are required by other resources in order for them to "
+"work.\n"
+"Remove them anyway? (no undo)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Cannot remove:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Error loading:"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Scene failed to load due to missing dependencies:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_node.cpp
+msgid "Open Anyway"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Which action should be taken?"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Fix Dependencies"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Errors loading!"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Permanently delete %d item(s)? (No undo!)"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Owns"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Resources Without Explicit Ownership:"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_node.cpp
+msgid "Orphan Resource Explorer"
+msgstr ""
+
+#: editor/dependency_editor.cpp
+msgid "Delete selected files?"
+msgstr ""
+
+#: editor/dependency_editor.cpp editor/editor_audio_buses.cpp
+#: editor/editor_file_dialog.cpp editor/editor_node.cpp
+#: editor/filesystem_dock.cpp editor/plugins/item_list_editor_plugin.cpp
+#: editor/project_export.cpp editor/project_settings_editor.cpp
+#: editor/scene_tree_dock.cpp
+msgid "Delete"
+msgstr ""
+
+#: editor/dictionary_property_edit.cpp
+msgid "Change Dictionary Key"
+msgstr ""
+
+#: editor/dictionary_property_edit.cpp
+msgid "Change Dictionary Value"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thanks from the Godot community!"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thanks!"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Godot Engine contributors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Project Founders"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Lead Developer"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Project Manager "
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Developers"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Authors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Platinum Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Gold Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Mini Sponsors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Gold Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Silver Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Bronze Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Donors"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "License"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Thirdparty License"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid ""
+"Godot Engine relies on a number of thirdparty free and open source "
+"libraries, all compatible with the terms of its MIT license. The following "
+"is an exhaustive list of all such thirdparty components with their "
+"respective copyright statements and license terms."
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "All Components"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Components"
+msgstr ""
+
+#: editor/editor_about.cpp
+msgid "Licenses"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp editor/project_manager.cpp
+msgid "Error opening package file, not in zip format."
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+msgid "Uncompressing Assets"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp editor/project_manager.cpp
+msgid "Package Installed Successfully!"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Success!"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Install"
+msgstr ""
+
+#: editor/editor_asset_installer.cpp
+msgid "Package Installer"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Speakers"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Rename Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Change Audio Bus Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Solo"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Mute"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Toggle Audio Bus Bypass Effects"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Select Audio Bus Send"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Audio Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Move Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Bus Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Audio Bus, Drag and Drop to rearrange."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Solo"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Mute"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Bypass"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Bus options"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/filesystem_dock.cpp
+#: editor/plugins/tile_map_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Duplicate"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Reset Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Effect"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Audio"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Master bus can't be deleted!"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Delete Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Duplicate Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Reset Bus Volume"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Move Audio Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save Audio Bus Layout As..."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Location for New Layout..."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Open Audio Bus Layout"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "There is no 'res://default_bus_layout.tres' file."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Invalid file, not an audio bus layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Add Bus"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Create a new Bus Layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/property_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Load"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Load an existing Bus Layout."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save As"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Save this Bus Layout to a file."
+msgstr ""
+
+#: editor/editor_audio_buses.cpp editor/import_dock.cpp
+msgid "Load Default"
+msgstr ""
+
+#: editor/editor_audio_buses.cpp
+msgid "Load the default Bus Layout."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Valid characters:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing engine class name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing buit-in type name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid name. Must not collide with an existing global constant name."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Invalid Path."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "File does not exist."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Not in resource path."
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Add AutoLoad"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Autoload '%s' already exists!"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Rename Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Toggle AutoLoad Globals"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Move Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Remove Autoload"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Enable"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Rearrange Autoloads"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp editor/editor_file_dialog.cpp
+#: scene/gui/file_dialog.cpp
+msgid "Path:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Node Name:"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp editor/editor_profiler.cpp
+#: editor/project_manager.cpp editor/settings_config_dialog.cpp
+msgid "Name"
+msgstr ""
+
+#: editor/editor_autoload_settings.cpp
+msgid "Singleton"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Updating Scene"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Storing local changes..."
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "Updating scene..."
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "[empty]"
+msgstr ""
+
+#: editor/editor_data.cpp
+msgid "[unsaved]"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Please select a base directory first"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Choose a Directory"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
+msgid "Create Folder"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
+#: scene/gui/file_dialog.cpp
+msgid "Name:"
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp
+#: editor/filesystem_dock.cpp scene/gui/file_dialog.cpp
+msgid "Could not create folder."
+msgstr ""
+
+#: editor/editor_dir_dialog.cpp
+msgid "Choose"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "Storing File:"
+msgstr ""
+
+#: editor/editor_export.cpp
+msgid "Packing"
+msgstr ""
+
+#: editor/editor_export.cpp platform/javascript/export/export.cpp
+msgid "Template file not found:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "File Exists, Overwrite?"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Select Current Folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "Copy Path"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "Show In File Manager"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
+msgid "New Folder..."
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Refresh"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "All Recognized"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "All Files (*)"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a File"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open File(s)"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a Directory"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Open a File or Directory"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/editor_node.cpp
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp scene/gui/file_dialog.cpp
+msgid "Save"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Save a File"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Back"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Forward"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Go Up"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Hidden Files"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Favorite"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Toggle Mode"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Focus Path"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Move Favorite Up"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Move Favorite Down"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Go to parent folder"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Directories & Files:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp
+msgid "Preview:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp editor/script_editor_debugger.cpp
+#: scene/gui/file_dialog.cpp
+msgid "File:"
+msgstr ""
+
+#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
+msgid "Must use a valid extension."
+msgstr ""
+
+#: editor/editor_file_system.cpp
+msgid "ScanSources"
+msgstr ""
+
+#: editor/editor_file_system.cpp
+msgid "(Re)Importing Assets"
+msgstr ""
+
+#: editor/editor_help.cpp editor/editor_node.cpp
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search Help"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Class List:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Search Classes"
+msgstr ""
+
+#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
+msgid "Top"
+msgstr ""
+
+#: editor/editor_help.cpp editor/property_editor.cpp
+msgid "Class:"
+msgstr ""
+
+#: editor/editor_help.cpp editor/scene_tree_editor.cpp
+msgid "Inherits:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Inherited by:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Brief Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Members"
+msgstr ""
+
+#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Members:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Public Methods"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Public Methods:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "GUI Theme Items"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "GUI Theme Items:"
+msgstr ""
+
+#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Signals:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Enumerations"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Enumerations:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "enum "
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Constants"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Constants:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Description"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Online Tutorials:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There are currently no tutorials for this class, you can [color=$color][url="
+"$url]contribute one[/url][/color] or [color=$color][url=$url2]request one[/"
+"url][/color]."
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Properties"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Property Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There is currently no description for this property. Please help us by "
+"[color=$color][url=$url]contributing one[/url][/color]!"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Methods"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Method Description:"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid ""
+"There is currently no description for this method. Please help us by [color="
+"$color][url=$url]contributing one[/url][/color]!"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Search Text"
+msgstr ""
+
+#: editor/editor_help.cpp
+msgid "Find"
+msgstr ""
+
+#: editor/editor_log.cpp
+msgid "Output:"
+msgstr ""
+
+#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/property_editor.cpp editor/script_editor_debugger.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Clear"
+msgstr ""
+
+#: editor/editor_log.cpp
+msgid "Clear Output"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Error saving resource!"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save Resource As..."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
+#: editor/scene_tree_dock.cpp
+msgid "I see..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't open file for writing:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Requested file format unknown:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while saving."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't open '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while parsing '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unexpected end of file '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Missing '%s' or its dependencies."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error while loading '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Saving Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Analyzing"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Creating Thumbnail"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a tree root."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Couldn't save scene. Likely dependencies (instances or inheritance) couldn't "
+"be satisfied."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Failed to load resource."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't load MeshLibrary for merging!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error saving MeshLibrary!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't load TileSet for merging!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error saving TileSet!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Error trying to save layout!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Default editor layout overridden."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Layout name not found!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Restored default layout to base settings."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource belongs to a scene that was imported, so it's not editable.\n"
+"Please read the documentation relevant to importing scenes to better "
+"understand this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource belongs to a scene that was instanced or inherited.\n"
+"Changes to it will not be kept when saving the current scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This resource was imported, so it's not editable. Change its settings in the "
+"import panel and then re-import."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This scene was imported, so changes to it will not be kept.\n"
+"Instancing it or inheriting will allow making changes to it.\n"
+"Please read the documentation relevant to importing scenes to better "
+"understand this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This is a remote object so changes to it will not be kept.\n"
+"Please read the documentation relevant to debugging to better understand "
+"this workflow."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Expand all properties"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Collapse all properties"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Copy Params"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Paste Params"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Paste Resource"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Copy Resource"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Make Built-In"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Make Sub-Resources Unique"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open in Help"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "There is no defined scene to run."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"No main scene has ever been defined, select one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Selected scene '%s' does not exist, select a valid one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Selected scene '%s' is not a scene file, select a valid one?\n"
+"You can change it later in \"Project Settings\" under the 'application' "
+"category."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Current scene was never saved, please save it prior to running."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Could not start subprocess!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Base Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Open Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Open Script..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save & Close"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes to '%s' before closing?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Scene As..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "No"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Yes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This scene has never been saved. Save before running?"
+msgstr ""
+
+#: editor/editor_node.cpp editor/scene_tree_dock.cpp
+msgid "This operation can't be done without a scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Mesh Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a root node."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Tile Set"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This operation can't be done without a selected node."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Current scene not saved. Open anyway?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Can't reload a scene that was never saved."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Revert"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "This action cannot be undone. Revert anyway?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quick Run Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quit"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Exit the editor?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Project Manager?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save & Quit"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes to the following scene(s) before quitting?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save changes the following scene(s) before opening Project Manager?"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"This option is deprecated. Situations where refresh must be forced are now "
+"considered a bug. Please report."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pick a Main Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to enable addon plugin at: '%s' parsing of config failed."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to find script field for addon plugin at: 'res://addons/%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to load addon script from path: '%s'."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Unable to load addon script from path: '%s' Base type is not EditorPlugin."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Unable to load addon script from path: '%s' Script is not in tool mode."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Scene '%s' was automatically imported, so it can't be modified.\n"
+"To make changes to it, a new inherited scene can be created."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Ugh"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Error loading scene, it must be inside the project path. Use 'Import' to "
+"open the scene, then save it inside the project path."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Scene '%s' has broken dependencies:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Clear Recent Scenes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Layout"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Delete Layout"
+msgstr ""
+
+#: editor/editor_node.cpp editor/import_dock.cpp
+#: editor/script_create_dialog.cpp
+msgid "Default"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Switch Scene Tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more files or folders"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more folders"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "%d more files"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Dock Position"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Distraction Free Mode"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Toggle distraction-free mode."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Add a new scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to previously opened scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Next tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Previous tab"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Filter Files..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Operations with scene files."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Inherited Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Scene..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save all Scenes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Close Scene"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Open Recent"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Convert To..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "MeshLibrary..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "TileSet..."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Undo"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
+#: scene/gui/line_edit.cpp
+msgid "Redo"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Revert Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Miscellaneous project or scene-wide tools."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Project Settings"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Run Script"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Export"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Tools"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Quit to Project List"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Debug"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Deploy with Remote Debug"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When exporting or deploying, the resulting executable will attempt to "
+"connect to the IP of this computer in order to be debugged."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Small Deploy with Network FS"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is enabled, export or deploy will produce a minimal "
+"executable.\n"
+"The filesystem will be provided from the project by the editor over the "
+"network.\n"
+"On Android, deploy will use the USB cable for faster performance. This "
+"option speeds up testing for games with a large footprint."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Visible Collision Shapes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
+"running game if this option is turned on."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Visible Navigation"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"Navigation meshes and polygons will be visible on the running game if this "
+"option is turned on."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Sync Scene Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is turned on, any changes made to the scene in the editor "
+"will be replicated in the running game.\n"
+"When used remotely on a device, this is more efficient with network "
+"filesystem."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Sync Script Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid ""
+"When this option is turned on, any script that is saved will be reloaded on "
+"the running game.\n"
+"When used remotely on a device, this is more efficient with network "
+"filesystem."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Editor"
+msgstr ""
+
+#: editor/editor_node.cpp editor/settings_config_dialog.cpp
+msgid "Editor Settings"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Editor Layout"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Toggle Fullscreen"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Manage Export Templates"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Help"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Classes"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/shader_editor_plugin.cpp editor/project_settings_editor.cpp
+msgid "Search"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Online Docs"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Q&A"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Issue Tracker"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+msgid "Community"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "About"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play the project."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pause the scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Pause Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Stop the scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Stop"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play the edited scene."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play custom scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Play Custom Scene"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Spins when the editor window repaints!"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Update Always"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Update Changes"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Disable Update Spinner"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Inspector"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Create a new resource in memory and edit it."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Load an existing resource from disk and edit it."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Save the currently edited resource."
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
+msgid "Save As..."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to the previous edited object in history."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Go to the next edited object in history."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "History of recently edited objects."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Object properties."
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Changes may be lost!"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_manager.cpp
+msgid "Import"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Node"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "FileSystem"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Output"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Don't Save"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Import Templates From ZIP File"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_export.cpp
+msgid "Export Project"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Export Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Merge With Existing"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Password:"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open & Run a Script"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "New Inherited"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Load Errors"
+msgstr ""
+
+#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
+msgid "Select"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open 2D Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open 3D Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open Script Editor"
+msgstr ""
+
+#: editor/editor_node.cpp editor/project_manager.cpp
+msgid "Open Asset Library"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open the next Editor"
+msgstr ""
+
+#: editor/editor_node.cpp
+msgid "Open the previous Editor"
+msgstr ""
+
+#: editor/editor_plugin.cpp
+msgid "Creating Mesh Previews"
+msgstr ""
+
+#: editor/editor_plugin.cpp
+msgid "Thumbnail..."
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Installed Plugins:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Update"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Version:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Author:"
+msgstr ""
+
+#: editor/editor_plugin_settings.cpp
+msgid "Status:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Stop Profiling"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Start Profiling"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Measure:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame Time (sec)"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Average Time (sec)"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame %"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Physics Frame %"
+msgstr ""
+
+#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
+msgid "Time:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Inclusive"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Self"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Frame #:"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Time"
+msgstr ""
+
+#: editor/editor_profiler.cpp
+msgid "Calls"
+msgstr ""
+
+#: editor/editor_run_native.cpp
+msgid "Select device from the list"
+msgstr ""
+
+#: editor/editor_run_native.cpp
+msgid ""
+"No runnable export preset found for this platform.\n"
+"Please add a runnable preset in the export menu."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Write your logic in the _run() method."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "There is an edited scene already."
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Couldn't instance script:"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Did you forget the 'tool' keyword?"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Couldn't run script:"
+msgstr ""
+
+#: editor/editor_run_script.cpp
+msgid "Did you forget the '_run' method?"
+msgstr ""
+
+#: editor/editor_settings.cpp
+msgid "Default (Same as Editor)"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Select Node(s) to Import"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Scene Path:"
+msgstr ""
+
+#: editor/editor_sub_scene.cpp
+msgid "Import From Node:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Re-Download"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Uninstall"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Installed)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Missing)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "(Current)"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Retrieving mirrors, please wait..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Remove template version '%s'?"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't open export templates zip."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Invalid version.txt format inside templates."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "No version.txt found inside templates."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Error creating path for templates:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Extracting Export Templates"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Importing:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid ""
+"No download links found for this version. Direct download is only available "
+"for official releases."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't resolve."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't connect."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "No response."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request Failed."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Redirect Loop."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Failed:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download Complete."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Error requesting url: "
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connecting to Mirror..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Disconnected"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Resolving"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't Resolve"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Connecting..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Can't Connect"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connected"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Requesting..."
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Downloading"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Connection Error"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "SSL Handshake Error"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Current Version:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Installed Versions:"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Install From File"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Remove Template"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Select template file"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Export Template Manager"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Download Templates"
+msgstr ""
+
+#: editor/export_template_manager.cpp
+msgid "Select mirror from list: "
+msgstr ""
+
+#: editor/file_type_cache.cpp
+msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot navigate to '%s' as it has not been found in the file system!"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View items as a grid of thumbnails"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View items as a list"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Status: Import of file failed. Please fix file and reimport manually."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot move/rename resources root."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Cannot move a folder into itself."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Error moving:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Error duplicating:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Unable to update dependencies:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "No name provided"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Provided name contains invalid characters"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "No name provided."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Name contains invalid characters."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "A file or folder with this name already exists."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Renaming file:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Renaming folder:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicating file:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicating folder:"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Expand all"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Collapse all"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Rename..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Move To..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Open Scene(s)"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Instance"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Edit Dependencies..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "View Owners..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Duplicate..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Previous Directory"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Next Directory"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Re-Scan Filesystem"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Toggle folder status as Favorite"
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Instance the selected scene(s) as child of the selected node."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid ""
+"Scanning Files,\n"
+"Please Wait..."
+msgstr ""
+
+#: editor/filesystem_dock.cpp
+msgid "Move"
+msgstr ""
+
+#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/project_manager.cpp
+msgid "Rename"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Add to Group"
+msgstr ""
+
+#: editor/groups_editor.cpp
+msgid "Remove from Group"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Single Scene"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Materials+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import with Separate Objects+Materials+Animations"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Multiple Scenes"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Import as Multiple Scenes+Materials"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Import Scene"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Importing Scene..."
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Generating Lightmaps"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Generating for Mesh: "
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Running Custom Script..."
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Couldn't load post-import script:"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Invalid/broken script for post-import (check console):"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Error running post-import script:"
+msgstr ""
+
+#: editor/import/resource_importer_scene.cpp
+msgid "Saving..."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Set as Default for '%s'"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Clear Default for '%s'"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid " Files"
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Import As:"
+msgstr ""
+
+#: editor/import_dock.cpp editor/property_editor.cpp
+msgid "Preset..."
+msgstr ""
+
+#: editor/import_dock.cpp
+msgid "Reimport"
+msgstr ""
+
+#: editor/multi_node_edit.cpp
+msgid "MultiNode Set"
+msgstr ""
+
+#: editor/node_dock.cpp
+msgid "Groups"
+msgstr ""
+
+#: editor/node_dock.cpp
+msgid "Select a Node to edit Signals and Groups."
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create Poly"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Edit Poly"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Insert Point"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Edit Poly (Remove Point)"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Remove Poly And Point"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Create a new polygon from scratch"
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid ""
+"Edit existing polygon:\n"
+"LMB: Move Point.\n"
+"Ctrl+LMB: Split Segment.\n"
+"RMB: Erase Point."
+msgstr ""
+
+#: editor/plugins/abstract_polygon_2d_editor.cpp
+msgid "Delete points"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Toggle Autoplay"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "New Anim"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Change Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Delete Animation?"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Remove Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: Invalid animation name!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: Animation name already exists!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Rename Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Blend Next Changed"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Change Blend Time"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Duplicate Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: No animation to copy!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: No animation resource on clipboard!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Pasted Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Paste Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "ERROR: No animation to edit!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation backwards from current pos. (A)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation backwards from end. (Shift+A)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Stop animation playback. (S)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation from start. (Shift+D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Play selected animation from current pos. (D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation position (in seconds)."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Scale animation playback globally for the node."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Create new animation in player."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load animation from disk."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Load an animation from disk."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Save the current animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Display list of animations in player."
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Autoplay on Load"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Edit Target Blend Times"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation Tools"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Copy Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Onion Skinning"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Enable Onion Skinning"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Directions"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Past"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Future"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Depth"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "1 step"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "2 steps"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "3 steps"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Differences Only"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Force White Modulate"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Include Gizmos (3D)"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Create New Animation"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Animation Name:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: editor/script_create_dialog.cpp
+msgid "Error!"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Blend Times:"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Next (Auto Queue):"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+msgid "Cross-Animation Blend Times"
+msgstr ""
+
+#: editor/plugins/animation_player_editor_plugin.cpp
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Animation"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "New name:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Edit Filters"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Scale:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Fade In (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Fade Out (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Mix"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Auto Restart:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Restart (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Random Restart (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Start!"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Amount:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend 0:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend 1:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "X-Fade Time (s):"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Current:"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Add Input"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Clear Auto-Advance"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Set Auto-Advance"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Delete Input"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Animation tree is valid."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Animation tree is invalid."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Animation Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "OneShot Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Mix Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend2 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend3 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Blend4 Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "TimeScale Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "TimeSeek Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Transition Node"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Import Animations..."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Edit Node Filters"
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "Filters..."
+msgstr ""
+
+#: editor/plugins/animation_tree_editor_plugin.cpp
+msgid "AnimationTree"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Free"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Contents:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "View Files"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't resolve hostname:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Connection error, please try again."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Can't connect to host:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "No response from host:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request failed, return code:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Request failed, too many redirects"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Bad download hash, assuming file has been tampered with."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Expected:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Got:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Failed sha256 hash check"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Asset Download Error:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Fetching:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Resolving..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Error making request"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Idle"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Retry"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download Error"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Download for this asset is already in progress!"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "first"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "prev"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "next"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "last"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "All"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_settings_editor.cpp
+msgid "Plugins"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Sort:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Reverse"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+#: editor/project_settings_editor.cpp
+msgid "Category:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Site:"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Support..."
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Official"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Testing"
+msgstr ""
+
+#: editor/plugins/asset_library_editor_plugin.cpp
+msgid "Assets ZIP File"
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid ""
+"Can't determine a save path for lightmap images.\n"
+"Save your scene (for images to be saved in the same dir), or pick a save "
+"path from the BakedLightmap properties."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid ""
+"No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake "
+"Light' flag is on."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid "Failed creating lightmap images, make sure path is writable."
+msgstr ""
+
+#: editor/plugins/baked_lightmap_editor_plugin.cpp
+msgid "Bake Lightmaps"
+msgstr ""
+
+#: editor/plugins/camera_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Preview"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Configure Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Offset:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid Step:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation Offset:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotation Step:"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Pivot"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Action"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Remove vertical guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Remove horizontal guide"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Create new horizontal and vertical guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Edit IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Edit CanvasItem"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Anchors only"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change Anchors and Margins"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change Anchors"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Paste Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Select Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Drag: Rotate"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Alt+Drag: Move"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Alt+RMB: Depth list selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Move Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Rotate Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Show a list of all objects at the position clicked\n"
+"(same as Alt+RMB in select mode)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Click to change object's rotation pivot."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Pan Mode"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Toggles snapping"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snapping options"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to grid"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Rotation Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Configure Snap..."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap Relative"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Use Pixel Snap"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Smart snapping"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to parent"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node anchor"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to node sides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to other nodes"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Snap to guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Lock the selected object in place (can't be moved)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Unlock the selected object (can be moved)."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Makes sure the object's children are not selectable."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Restores the object's children's ability to be selected."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Make Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Bones"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Make IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear IK Chain"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Show Grid"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Helpers"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Rulers"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Guides"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Center Selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Frame Selection"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Layout"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Keys"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Key"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Insert Key (Existing Tracks)"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Copy Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Clear Pose"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Drag pivot from mouse position"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Set pivot at mouse position"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Multiply grid step by 2"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Divide grid step by 2"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Add %s"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Adding %s..."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Ok"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Cannot instantiate multiple nodes without root."
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Create Node"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "Error instancing scene from %s"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Change default type"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid ""
+"Drag & drop + Shift : Add node as sibling\n"
+"Drag & drop + Alt : Change node type"
+msgstr ""
+
+#: editor/plugins/collision_polygon_editor_plugin.cpp
+msgid "Create Poly3D"
+msgstr ""
+
+#: editor/plugins/collision_shape_2d_editor_plugin.cpp
+msgid "Set Handle"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Remove item %d?"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Add Item"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Remove Selected Item"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Import from Scene"
+msgstr ""
+
+#: editor/plugins/cube_grid_theme_editor_plugin.cpp
+msgid "Update from Scene"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Flat0"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Flat1"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Ease in"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Ease out"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Smoothstep"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Modify Curve Point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Modify Curve Tangent"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Load Curve Preset"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Add point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Remove point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Left linear"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Right linear"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Load preset"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Remove Curve Point"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Toggle Curve Linear Tangent"
+msgstr ""
+
+#: editor/plugins/curve_editor_plugin.cpp
+msgid "Hold Shift to edit tangents individually"
+msgstr ""
+
+#: editor/plugins/gi_probe_editor_plugin.cpp
+msgid "Bake GI Probe"
+msgstr ""
+
+#: editor/plugins/gradient_editor_plugin.cpp
+msgid "Add/Remove Color Ramp Point"
+msgstr ""
+
+#: editor/plugins/gradient_editor_plugin.cpp
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Modify Color Ramp"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Item %d"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Items"
+msgstr ""
+
+#: editor/plugins/item_list_editor_plugin.cpp
+msgid "Item List Editor"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid ""
+"No OccluderPolygon2D resource on this node.\n"
+"Create and assign one?"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create Occluder Polygon"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Create a new polygon from scratch."
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Edit existing polygon:"
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "LMB: Move Point."
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "Ctrl+LMB: Split Segment."
+msgstr ""
+
+#: editor/plugins/light_occluder_2d_editor_plugin.cpp
+msgid "RMB: Erase Point."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh is empty!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Static Trimesh Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Static Convex Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "This doesn't work on scene root!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Shape"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Shape"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Navigation Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Contained Mesh is not of type ArrayMesh."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "UV Unwrap failed, mesh may not be manifold?"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "No mesh to debug."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Model has no UV in this layer"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "MeshInstance lacks a Mesh!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh has not surface to create outlines from!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Could not create outline!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Static Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Static Body"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Trimesh Collision Sibling"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Convex Collision Sibling"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline Mesh..."
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "View UV1"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "View UV2"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Unwrap UV2 for Lightmap/AO"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Create Outline Mesh"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Outline Size:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No mesh source specified (and no MultiMesh set in node)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No mesh source specified (and MultiMesh contains no Mesh)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (invalid path)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (not a MeshInstance)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh source is invalid (contains no Mesh resource)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "No surface source specified."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (invalid path)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (no geometry)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Surface source is invalid (no faces)."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Parent has no solid faces to populate."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Couldn't map area."
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Select a Source Mesh:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Select a Target Surface:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate Surface"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate MultiMesh"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Target Surface:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Source Mesh:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "X-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Y-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Z-Axis"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Mesh Up Axis:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Rotation:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Tilt:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Random Scale:"
+msgstr ""
+
+#: editor/plugins/multimesh_editor_plugin.cpp
+msgid "Populate"
+msgstr ""
+
+#: editor/plugins/navigation_mesh_editor_plugin.cpp
+msgid "Bake!"
+msgstr ""
+
+#: editor/plugins/navigation_mesh_editor_plugin.cpp
+msgid "Bake the navigation mesh."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_editor_plugin.cpp
+msgid "Clear the navigation mesh."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Setting up Configuration..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Calculating grid size..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Creating heightfield..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Marking walkable triangles..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Constructing compact heightfield..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Eroding walkable area..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Partitioning..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Creating contours..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Creating polymesh..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Converting to native navigation mesh..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Navigation Mesh Generator Setup:"
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Parsing Geometry..."
+msgstr ""
+
+#: editor/plugins/navigation_mesh_generator.cpp
+msgid "Done!"
+msgstr ""
+
+#: editor/plugins/navigation_polygon_editor_plugin.cpp
+msgid "Create Navigation Polygon"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generating AABB"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Can only set point into a ParticlesMaterial process material"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Error loading image:"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "No pixels with transparency > 128 in image..."
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generate Visibility Rect"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Load Emission Mask"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Clear Emission Mask"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Particles"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Generated Point Count:"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generation Time (sec):"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Emission Mask"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Capture from Pixel"
+msgstr ""
+
+#: editor/plugins/particles_2d_editor_plugin.cpp
+msgid "Emission Colors"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Node does not contain geometry."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Node does not contain geometry (faces)."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "A processor material of type 'ParticlesMaterial' is required."
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Faces contain no area!"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "No faces!"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generate AABB"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emission Points From Mesh"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emission Points From Node"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Create Emitter"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Emission Points:"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Surface Points"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Surface Points+Normal (Directed)"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Volume"
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Emission Source: "
+msgstr ""
+
+#: editor/plugins/particles_editor_plugin.cpp
+msgid "Generate Visibility AABB"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove Point from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove Out-Control from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Remove In-Control from Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Add Point to Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move Point in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move In-Control in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Move Out-Control in Curve"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Select Points"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Shift+Drag: Select Control Points"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Click: Add Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Right Click: Delete Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+msgid "Select Control Points (Shift+Drag)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Add Point (in empty space)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Split Segment (in curve)"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Delete Point"
+msgstr ""
+
+#: editor/plugins/path_2d_editor_plugin.cpp
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Close Curve"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Curve Point #"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve Point Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve In Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Set Curve Out Position"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Split Path"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove Path Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove Out-Control Point"
+msgstr ""
+
+#: editor/plugins/path_editor_plugin.cpp
+msgid "Remove In-Control Point"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Create UV Map"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Transform UV Map"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygon 2D UV Editor"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Move Point"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Ctrl: Rotate"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Shift: Move All"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Shift+Ctrl: Scale"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Move Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Rotate Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Scale Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/shader_editor_plugin.cpp editor/project_manager.cpp
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Polygon->UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "UV->Polygon"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Clear UV"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Enable Snap"
+msgstr ""
+
+#: editor/plugins/polygon_2d_editor_plugin.cpp
+msgid "Grid"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "ERROR: Couldn't load resource!"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Add Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Rename Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Delete Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "Resource clipboard is empty!"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/scene_tree_dock.cpp editor/scene_tree_editor.cpp
+msgid "Open in Editor"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/scene_tree_editor.cpp
+msgid "Instance:"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/theme_editor_plugin.cpp editor/project_settings_editor.cpp
+#: editor/scene_tree_editor.cpp editor/script_editor_debugger.cpp
+msgid "Type:"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Load Resource"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Paste"
+msgstr ""
+
+#: editor/plugins/resource_preloader_editor_plugin.cpp
+msgid "ResourcePreloader"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Clear Recent Files"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close and save changes?"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error while saving theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error saving"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error importing theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Error importing"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Import Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme As..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid " Class Reference"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Sort"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Move Up"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Move Down"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Next script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Previous script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "File"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "New"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save All"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Soft Reload Script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Copy Script Path"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Show In File System"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "History Prev"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "History Next"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Reload Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Save Theme As"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close Docs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close All"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Close Other Tabs"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+msgid "Run"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Toggle Scripts Panel"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+msgid "Find..."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+#: editor/plugins/script_text_editor.cpp
+msgid "Find Next"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Step Over"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Step Into"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Break"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/project_manager.cpp
+#: editor/script_editor_debugger.cpp
+msgid "Continue"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Keep Debugger Open"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Debug with external editor"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Open Godot online documentation"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search the class hierarchy."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Search the reference documentation."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Go to previous edited document."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Go to next edited document."
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Discard"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Create Script"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid ""
+"The following files are newer on disk.\n"
+"What action should be taken?:"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Reload"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid "Resave"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Debugger"
+msgstr ""
+
+#: editor/plugins/script_editor_plugin.cpp
+msgid ""
+"Built-in scripts can only be edited when the scene they belong to is loaded"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Only resources from filesystem can be dropped."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Pick Color"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Case"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Uppercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Lowercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Capitalize"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Cut"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+#: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp
+#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
+msgid "Copy"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
+#: scene/gui/text_edit.cpp
+msgid "Select All"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Delete Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Indent Left"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Indent Right"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Toggle Comment"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Fold/Unfold Line"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Fold All Lines"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Unfold All Lines"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Clone Down"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Complete Symbol"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Trim Trailing Whitespace"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Indent To Spaces"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert Indent To Tabs"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Auto Indent"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Toggle Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Remove All Breakpoints"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Next Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Previous Breakpoint"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert To Uppercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Convert To Lowercase"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Find Previous"
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Replace..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Function..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Goto Line..."
+msgstr ""
+
+#: editor/plugins/script_text_editor.cpp
+msgid "Contextual Help"
+msgstr ""
+
+#: editor/plugins/shader_editor_plugin.cpp
+msgid "Shader"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Constant"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Constant"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change RGB Constant"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Scalar Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change RGB Operator"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Toggle Rot Only"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Function"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Function"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Scalar Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Vec Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change RGB Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Default Value"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change XForm Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Texture Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Cubemap Uniform"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Comment"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Add/Remove to Color Ramp"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Add/Remove to Curve Map"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Modify Curve Map"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Change Input Name"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Connect Graph Nodes"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Disconnect Graph Nodes"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Remove Shader Graph Node"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Move Shader Graph Node"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Duplicate Graph Node(s)"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Delete Shader Graph Node(s)"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Error: Cyclic Connection Link"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Error: Missing Input Connections"
+msgstr ""
+
+#: editor/plugins/shader_graph_editor_plugin.cpp
+msgid "Add Shader Graph Node"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Orthogonal"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Perspective"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Aborted."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "X-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Y-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Z-Axis Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Plane Transform."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scaling: "
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translating: "
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotating %s degrees."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Keying is disabled (no key inserted)."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Animation Key Inserted."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Objects Drawn"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Material Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Shader Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Surface Changes"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Draw Calls"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Vertices"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "FPS"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Top View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear View."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Align with view"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "OK :("
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "No parent to instance a child at."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp
+msgid "This operation requires a single selected node."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Normal"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Wireframe"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Overdraw"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Display Unshaded"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Environment"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Gizmos"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Information"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View FPS"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Half Resolution"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Audio Listener"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Doppler Enable"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Left"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Right"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Forward"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Backwards"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Up"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Down"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Freelook Speed Modifier"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "XForm Dialog"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Select Mode (Q)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid ""
+"Drag: Rotate\n"
+"Alt+Drag: Move\n"
+"Alt+RMB: Depth list selection"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Move Mode (W)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate Mode (E)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale Mode (R)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Local Coords"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Local Space Mode (%s)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Mode (%s)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Bottom View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Top View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rear View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Front View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Left View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Right View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Switch Perspective/Orthogonal view"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Insert Animation Key"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Focus Origin"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Focus Selection"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Align Selection With View"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Select"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Move"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Rotate"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Tool Scale"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Toggle Freelook"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Dialog..."
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "1 Viewport"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "2 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "2 Viewports (Alt)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "3 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "3 Viewports (Alt)"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "4 Viewports"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Origin"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Grid"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Skeleton Gizmo visibility"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Snap Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translate Snap:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate Snap (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale Snap (%):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Viewport Settings"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Perspective FOV (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Z-Near:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "View Z-Far:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Change"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Translate:"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Rotate (deg.):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Scale (ratio):"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Transform Type"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Pre"
+msgstr ""
+
+#: editor/plugins/spatial_editor_plugin.cpp
+msgid "Post"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "ERROR: Couldn't load frame resource!"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Frame"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Resource clipboard is empty or not a texture!"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Paste Frame"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Add Empty"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Change Animation Loop"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Change Animation FPS"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "(empty)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Animations"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Speed (FPS):"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Loop"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Animation Frames"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Insert Empty (Before)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Insert Empty (After)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Move (Before)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "Move (After)"
+msgstr ""
+
+#: editor/plugins/sprite_frames_editor_plugin.cpp
+msgid "SpriteFrames"
+msgstr ""
+
+#: editor/plugins/style_box_editor_plugin.cpp
+msgid "StyleBox Preview:"
+msgstr ""
+
+#: editor/plugins/style_box_editor_plugin.cpp
+msgid "StyleBox"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Set Region Rect"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Snap Mode:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "<None>"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Pixel Snap"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Grid Snap"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Auto Slice"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Offset:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Step:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Separation:"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Texture Region"
+msgstr ""
+
+#: editor/plugins/texture_region_editor_plugin.cpp
+msgid "Texture Region Editor"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Can't save theme to file:"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add All Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add All"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Remove Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove All Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove All"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Edit theme..."
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Theme editing menu."
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Add Class Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Remove Class Items"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create Empty Template"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create Empty Editor Template"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Create From Current Editor Theme"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "CheckBox Radio1"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "CheckBox Radio2"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Check Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Many"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
+msgid "Options"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Has,Many,Options"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 1"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 2"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Tab 3"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Data Type:"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Icon"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Style"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Font"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Color"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Theme"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase Selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Paint TileMap"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Line Draw"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rectangle Paint"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Bucket Fill"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase TileMap"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Erase selection"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Find tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Transpose"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Mirror X"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Mirror Y"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Paint Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Pick Tile"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 0 degrees"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 90 degrees"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 180 degrees"
+msgstr ""
+
+#: editor/plugins/tile_map_editor_plugin.cpp
+msgid "Rotate 270 degrees"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Could not find tile:"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Item name or ID:"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create from scene?"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Merge from scene?"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Tile Set"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Create from Scene"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Merge from Scene"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp editor/script_editor_debugger.cpp
+msgid "Error"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Autotiles"
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"Select sub-tile to use as icon, this will be also used on invalid autotile "
+"bindings."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid ""
+"LMB: set bit on.\n"
+"RMB: set bit off."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Select current edited sub-tile."
+msgstr ""
+
+#: editor/plugins/tile_set_editor_plugin.cpp
+msgid "Select sub-tile to change its priority."
+msgstr ""
+
+#: editor/progress_dialog.cpp scene/gui/dialogs.cpp
+msgid "Cancel"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Runnable"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Delete patch '%s' from list?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Delete preset '%s'?"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing/corrupted: "
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Presets"
+msgstr ""
+
+#: editor/project_export.cpp editor/project_settings_editor.cpp
+msgid "Add..."
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Resources"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export all resources in the project"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export selected scenes (and dependencies)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export selected resources (and dependencies)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export Mode:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Resources to export:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid ""
+"Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Patches"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Make Patch"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Features"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Custom (comma-separated):"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Feature List:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export PCK/Zip"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export templates for this platform are missing/corrupted:"
+msgstr ""
+
+#: editor/project_export.cpp
+msgid "Export With Debug"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "The path does not exist."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Please choose a 'project.godot' file."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Please choose an empty folder."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Imported Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't create folder."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "There is already a folder in this path with the specified name."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "It would be a good idea to name your project."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Invalid project path (changed anything?)."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Couldn't load project.godot in project path (error %d). It may be missing or "
+"corrupted."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't edit project.godot in project path."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Couldn't create project.godot in project path."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "The following files failed extraction from package:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Rename Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "New Game Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Import Existing Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Import & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create New Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Install Project:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Install & Edit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Name:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Create folder"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Path:"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Browse"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Unnamed Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Can't open project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Are you sure to open more than one project?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Can't run project: no main scene defined.\n"
+"Please edit the project and set the main scene in \"Project Settings\" under "
+"the \"Application\" category."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Can't run project: Assets need to be imported.\n"
+"Please edit the project to trigger the initial import."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Are you sure to run more than one project?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Remove project from the list? (Folder contents will not be modified)"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"Language changed.\n"
+"The UI will update next time the editor or project manager starts."
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"You are about the scan %s folders for existing Godot projects. Do you "
+"confirm?"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project Manager"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Project List"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Scan"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Select a Folder to Scan"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "New Project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Templates"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Exit"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Restart Now"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid "Can't run project"
+msgstr ""
+
+#: editor/project_manager.cpp
+msgid ""
+"You don't currently have any projects.\n"
+"Would you like to explore the official example projects in the Asset Library?"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Key "
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joy Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joy Axis"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Mouse Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action '%s' already exists!"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Rename Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Shift+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Alt+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Control+"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "Press a Key..."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Mouse Button Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Left Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Right Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Middle Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Up Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Down Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 6"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 7"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 8"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button 9"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joypad Axis Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Axis"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Joypad Button Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Erase Input Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Erase Input Action Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Event"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Device"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Button"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Left Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Right Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Middle Button."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Up."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Wheel Down."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Global Property"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Select a setting item first!"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "No property '%s' exists."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Setting '%s' is internal, and it can't be deleted."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Delete Item"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Already existing"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Input Action"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Error saving settings."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Settings saved OK."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Override for Feature"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Translation"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Translation"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Add Remapped Path"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Resource Remap Add Remap"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Change Resource Remap Language"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Resource Remap"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remove Resource Remap Option"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Changed Locale Filter"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Changed Locale Filter Mode"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Project Settings (project.godot)"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
+msgid "General"
+msgstr ""
+
+#: editor/project_settings_editor.cpp editor/property_editor.cpp
+msgid "Property:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Override For..."
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Input Map"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Action:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Device:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Index:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Localization"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Translations"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Translations:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remaps"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Resources:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Remaps by Locale:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locale"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locales Filter"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Show all locales"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Show only selected locales"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Filter mode:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "Locales:"
+msgstr ""
+
+#: editor/project_settings_editor.cpp
+msgid "AutoLoad"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Pick a Viewport"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Ease In"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Ease Out"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Zero"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Easing In-Out"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Easing Out-In"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "File..."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Dir..."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Assign"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Select Node"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "New Script"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "New %s"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Make Unique"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Show in File System"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Convert To %s"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Error loading file: Not a resource!"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Selected node is not a Viewport!"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Pick a Node"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Bit %d, val %d."
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "On"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "[Empty]"
+msgstr ""
+
+#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
+msgid "Set"
+msgstr ""
+
+#: editor/property_editor.cpp
+msgid "Properties:"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Property"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Virtual Method"
+msgstr ""
+
+#: editor/property_selector.cpp
+msgid "Select Method"
+msgstr ""
+
+#: editor/pvrtc_compress.cpp
+msgid "Could not execute PVRTC tool:"
+msgstr ""
+
+#: editor/pvrtc_compress.cpp
+msgid "Can't load back converted image using PVRTC tool:"
+msgstr ""
+
+#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Reparent Node"
+msgstr ""
+
+#: editor/reparent_dialog.cpp
+msgid "Reparent Location (Select new Parent):"
+msgstr ""
+
+#: editor/reparent_dialog.cpp
+msgid "Keep Global Transform"
+msgstr ""
+
+#: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp
+msgid "Reparent"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Run Mode:"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Current Scene"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Main Scene"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Main Scene Arguments:"
+msgstr ""
+
+#: editor/run_settings_dialog.cpp
+msgid "Scene Run Settings"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp editor/script_create_dialog.cpp
+#: scene/gui/dialogs.cpp
+msgid "OK"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "No parent to instance the scenes at."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error loading scene from %s"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Cannot instance the scene '%s' because the current scene exists within one "
+"of its nodes."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instance Scene(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "This operation can't be done on the tree root."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Move Node In Parent"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Move Nodes In Parent"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Duplicate Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete Node(s)?"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can not perform with the root node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "This operation can't be done on instanced scenes."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Save New Scene As..."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Editable Children"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Load As Placeholder"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Discard Instancing"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Makes Sense!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't operate on nodes from a foreign scene!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Can't operate on nodes the current scene inherits from!"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Remove Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Couldn't save new scene. Likely dependencies (instances) couldn't be "
+"satisfied."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error saving scene."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Error duplicating scene to save it."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Sub-Resources"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Inheritance"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete Node(s)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Add Child Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Instance Child Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Change Type"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Attach Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Script"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Merge From Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Save Branch as Scene"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Copy Node Path"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Delete (No Confirm)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Add/Create a New Node"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid ""
+"Instance a scene file as a Node. Creates an inherited scene if no root node "
+"exists."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Filter nodes"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Attach a new or existing script for the selected node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear a script for the selected node."
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Remote"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Local"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear Inheritance? (No Undo!)"
+msgstr ""
+
+#: editor/scene_tree_dock.cpp
+msgid "Clear!"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle Spatial Visible"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle CanvasItem Visible"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Node configuration warning:"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node has connection(s) and group(s)\n"
+"Click to show signals dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node has connections.\n"
+"Click to show signals dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node is in group(s).\n"
+"Click to show groups dock."
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Open script"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Node is locked.\n"
+"Click to unlock"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid ""
+"Children are not selectable.\n"
+"Click to make selectable"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Toggle Visibility"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Invalid node name, the following characters are not allowed:"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Rename Node"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Scene Tree (Nodes):"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Node Configuration Warning!"
+msgstr ""
+
+#: editor/scene_tree_editor.cpp
+msgid "Select a Node"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error loading template '%s'"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error - Could not create script in filesystem."
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Error loading script from %s"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "N/A"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Path is empty"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Path is not local"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid base path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Directory of the same name exists"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "File exists, will be reused"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid extension"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Wrong extension chosen"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid Path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid class name"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Invalid inherited parent name or path"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Script valid"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Allowed: a-z, A-Z, 0-9 and _"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Built-in script (into scene file)"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Create new script file"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Load existing script file"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Language"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Inherits"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Class Name"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Template"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Built-in Script"
+msgstr ""
+
+#: editor/script_create_dialog.cpp
+msgid "Attach Node Script"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Remote "
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Bytes:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Warning"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Error:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Source:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Function:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Pick one or more items from the list to display the graph."
+msgstr ""
+
+#: editor/script_editor_debugger.cpp modules/mono/editor/mono_bottom_panel.cpp
+msgid "Errors"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Child Process Connected"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Copy Error"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Inspect Previous Instance"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Inspect Next Instance"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Stack Frames"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Variable"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Errors:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Stack Trace (if applicable):"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Profiler"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Monitor"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Value"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Monitors"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "List of Video Memory Usage by Resource:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Total:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Video Mem"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Resource Path"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Type"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Format"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Usage"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Misc"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Clicked Control:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Clicked Control Type:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Live Edit Root:"
+msgstr ""
+
+#: editor/script_editor_debugger.cpp
+msgid "Set From Tree"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Shortcuts"
+msgstr ""
+
+#: editor/settings_config_dialog.cpp
+msgid "Binding"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Light Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change AudioStreamPlayer3D Emission Angle"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Camera FOV"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Camera Size"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Sphere Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Box Shape Extents"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Capsule Shape Radius"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Capsule Shape Height"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Ray Shape Length"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Notifier Extents"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Particles AABB"
+msgstr ""
+
+#: editor/spatial_editor_gizmos.cpp
+msgid "Change Probe Extents"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Select the dynamic library for this entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Select dependencies of the library for this entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Remove current entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Double click to create a new entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Platform:"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Platform"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Dynamic Library"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "Add an architecture entry"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_editor_plugin.cpp
+msgid "GDNativeLibrary"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Library"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Status"
+msgstr ""
+
+#: modules/gdnative/gdnative_library_singleton_editor.cpp
+msgid "Libraries: "
+msgstr ""
+
+#: modules/gdnative/register_types.cpp
+msgid "GDNative"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+#: modules/visual_script/visual_script_builtin_funcs.cpp
+msgid "Invalid type argument to convert(), use TYPE_* constants."
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp modules/mono/glue/glue_header.h
+#: modules/visual_script/visual_script_builtin_funcs.cpp
+msgid "Not enough bytes for decoding bytes, or invalid format."
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "step argument is zero!"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not a script with an instance"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not based on a script"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Not based on a resource file"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (missing @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (can't load script at @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary format (invalid script at @path)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Invalid instance dictionary (invalid subclasses)"
+msgstr ""
+
+#: modules/gdscript/gdscript_functions.cpp
+msgid "Object can't provide a length."
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Next Plane"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Previous Plane"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Plane:"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Next Floor"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Previous Floor"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Floor:"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Delete Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Duplicate Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Grid Map"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Snap View"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Disabled"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Above"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clip Below"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit X Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit Y Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Edit Z Axis"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate X"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate Y"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Rotate Z"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate X"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate Y"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Back Rotate Z"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Cursor Clear Rotation"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Create Area"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Create Exterior Connector"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Erase Area"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Clear Selection"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "GridMap Settings"
+msgstr ""
+
+#: modules/gridmap/grid_map_editor_plugin.cpp
+msgid "Pick Distance:"
+msgstr ""
+
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Generating solution..."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Generating C# project..."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to create solution."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to save solution."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Done"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Failed to create C# project."
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Mono"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "About C# support"
+msgstr ""
+
+#: modules/mono/editor/godotsharp_editor.cpp
+msgid "Create C# solution"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Builds"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Build Project"
+msgstr ""
+
+#: modules/mono/editor/mono_bottom_panel.cpp
+msgid "Warnings"
+msgstr ""
+
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"A node yielded without working memory, please read the docs on how to yield "
+"properly!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"Node yielded, but did not return a function state in the first working "
+"memory."
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid ""
+"Return value must be assigned to first element of node working memory! Fix "
+"your node please."
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Node returned an invalid sequence output: "
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Found sequence bit but not the node in the stack, report bug!"
+msgstr ""
+
+#: modules/visual_script/visual_script.cpp
+msgid "Stack overflow with stack depth: "
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Signal Arguments"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Argument Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Argument name"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Set Variable Default Value"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Set Variable Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Functions:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Variables:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Name is not a valid identifier:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Name already in use by another func/var/signal:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Rename Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Expression"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Duplicate VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a simple reference to the node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a simple reference to the node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold %s to drop a Variable Setter."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Hold Ctrl to drop a Variable Setter."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Preload Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Node(s) From Tree"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Getter Property"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Add Setter Property"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Base Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Move Node(s)"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove VisualScript Node"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Connect Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Condition"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Sequence"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Switch"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Iterator"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "While"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Return"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Call"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Get"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Script already has function '%s'"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Change Input Value"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Can't copy the function node."
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Clipboard is empty!"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Paste VisualScript Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Function"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Variable"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Remove Signal"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Editing Variable:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Editing Signal:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Base Type:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Available Nodes:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Select or create a function to edit graph"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Signal Arguments:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Edit Variable:"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Delete Selected"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Find Node Type"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Copy Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Cut Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_editor.cpp
+msgid "Paste Nodes"
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Input type not iterable: "
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Iterator became invalid"
+msgstr ""
+
+#: modules/visual_script/visual_script_flow_control.cpp
+msgid "Iterator became invalid: "
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Invalid index property name."
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Base object is not a Node!"
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Path does not lead Node!"
+msgstr ""
+
+#: modules/visual_script/visual_script_func_nodes.cpp
+msgid "Invalid index property name '%s' in node %s."
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ": Invalid argument of type: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ": Invalid arguments: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "VariableGet not found in script: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "VariableSet not found in script: "
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid "Custom node has no _step() method, can't process graph."
+msgstr ""
+
+#: modules/visual_script/visual_script_nodes.cpp
+msgid ""
+"Invalid return value from _step(), must be integer (seq out), or string "
+"(error)."
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Run in Browser"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Run exported HTML in the system's default browser."
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not write file:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not open template for export:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Invalid export template:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not read custom HTML shell:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Could not read boot splash image file:"
+msgstr ""
+
+#: platform/javascript/export/export.cpp
+msgid "Using default boot splash image."
+msgstr ""
+
+#: scene/2d/animated_sprite.cpp
+msgid ""
+"A SpriteFrames resource must be created or set in the 'Frames' property in "
+"order for AnimatedSprite to display frames."
+msgstr ""
+
+#: scene/2d/canvas_modulate.cpp
+msgid ""
+"Only one visible CanvasModulate is allowed per scene (or set of instanced "
+"scenes). The first created one will work, while the rest will be ignored."
+msgstr ""
+
+#: scene/2d/collision_object_2d.cpp
+msgid ""
+"This node has no children shapes, so it can't interact with the space.\n"
+"Consider adding CollisionShape2D or CollisionPolygon2D children nodes to "
+"define its shape."
+msgstr ""
+
+#: scene/2d/collision_polygon_2d.cpp
+msgid ""
+"CollisionPolygon2D only serves to provide a collision shape to a "
+"CollisionObject2D derived node. Please only use it as a child of Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
+msgstr ""
+
+#: scene/2d/collision_polygon_2d.cpp
+msgid "An empty CollisionPolygon2D has no effect on collision."
+msgstr ""
+
+#: scene/2d/collision_shape_2d.cpp
+msgid ""
+"CollisionShape2D only serves to provide a collision shape to a "
+"CollisionObject2D derived node. Please only use it as a child of Area2D, "
+"StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."
+msgstr ""
+
+#: scene/2d/collision_shape_2d.cpp
+msgid ""
+"A shape must be provided for CollisionShape2D to function. Please create a "
+"shape resource for it!"
+msgstr ""
+
+#: scene/2d/light_2d.cpp
+msgid ""
+"A texture with the shape of the light must be supplied to the 'texture' "
+"property."
+msgstr ""
+
+#: scene/2d/light_occluder_2d.cpp
+msgid ""
+"An occluder polygon must be set (or drawn) for this occluder to take effect."
+msgstr ""
+
+#: scene/2d/light_occluder_2d.cpp
+msgid "The occluder polygon for this occluder is empty. Please draw a polygon!"
+msgstr ""
+
+#: scene/2d/navigation_polygon.cpp
+msgid ""
+"A NavigationPolygon resource must be set or created for this node to work. "
+"Please set a property or draw a polygon."
+msgstr ""
+
+#: scene/2d/navigation_polygon.cpp
+msgid ""
+"NavigationPolygonInstance must be a child or grandchild to a Navigation2D "
+"node. It only provides navigation data."
+msgstr ""
+
+#: scene/2d/parallax_layer.cpp
+msgid ""
+"ParallaxLayer node only works when set as child of a ParallaxBackground node."
+msgstr ""
+
+#: scene/2d/particles_2d.cpp scene/3d/particles.cpp
+msgid ""
+"A material to process the particles is not assigned, so no behavior is "
+"imprinted."
+msgstr ""
+
+#: scene/2d/path_2d.cpp
+msgid "PathFollow2D only works when set as a child of a Path2D node."
+msgstr ""
+
+#: scene/2d/physics_body_2d.cpp
+msgid ""
+"Size changes to RigidBody2D (in character or rigid modes) will be overridden "
+"by the physics engine when running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/2d/remote_transform_2d.cpp
+msgid "Path property must point to a valid Node2D node to work."
+msgstr ""
+
+#: scene/2d/visibility_notifier_2d.cpp
+msgid ""
+"VisibilityEnable2D works best when used with the edited scene root directly "
+"as parent."
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRCamera must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRController must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid ""
+"The controller id must not be 0 or this controller will not be bound to an "
+"actual controller"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVRAnchor must have an ARVROrigin node as its parent"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid ""
+"The anchor id must not be 0 or this anchor will not be bound to an actual "
+"anchor"
+msgstr ""
+
+#: scene/3d/arvr_nodes.cpp
+msgid "ARVROrigin requires an ARVRCamera child node"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "%d%%"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "(Time Left: %d:%02d s)"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Plotting Meshes: "
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Plotting Lights:"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp scene/3d/gi_probe.cpp
+msgid "Finishing Plot"
+msgstr ""
+
+#: scene/3d/baked_lightmap.cpp
+msgid "Lighting Meshes: "
+msgstr ""
+
+#: scene/3d/collision_object.cpp
+msgid ""
+"This node has no children shapes, so it can't interact with the space.\n"
+"Consider adding CollisionShape or CollisionPolygon children nodes to define "
+"its shape."
+msgstr ""
+
+#: scene/3d/collision_polygon.cpp
+msgid ""
+"CollisionPolygon only serves to provide a collision shape to a "
+"CollisionObject derived node. Please only use it as a child of Area, "
+"StaticBody, RigidBody, KinematicBody, etc. to give them a shape."
+msgstr ""
+
+#: scene/3d/collision_polygon.cpp
+msgid "An empty CollisionPolygon has no effect on collision."
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"CollisionShape only serves to provide a collision shape to a CollisionObject "
+"derived node. Please only use it as a child of Area, StaticBody, RigidBody, "
+"KinematicBody, etc. to give them a shape."
+msgstr ""
+
+#: scene/3d/collision_shape.cpp
+msgid ""
+"A shape must be provided for CollisionShape to function. Please create a "
+"shape resource for it!"
+msgstr ""
+
+#: scene/3d/gi_probe.cpp
+msgid "Plotting Meshes"
+msgstr ""
+
+#: scene/3d/navigation_mesh.cpp
+msgid "A NavigationMesh resource must be set or created for this node to work."
+msgstr ""
+
+#: scene/3d/navigation_mesh.cpp
+msgid ""
+"NavigationMeshInstance must be a child or grandchild to a Navigation node. "
+"It only provides navigation data."
+msgstr ""
+
+#: scene/3d/particles.cpp
+msgid ""
+"Nothing is visible because meshes have not been assigned to draw passes."
+msgstr ""
+
+#: scene/3d/physics_body.cpp
+msgid ""
+"Size changes to RigidBody (in character or rigid modes) will be overridden "
+"by the physics engine when running.\n"
+"Change the size in children collision shapes instead."
+msgstr ""
+
+#: scene/3d/remote_transform.cpp
+msgid "Path property must point to a valid Spatial node to work."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
+#: scene/3d/sprite_3d.cpp
+msgid ""
+"A SpriteFrames resource must be created or set in the 'Frames' property in "
+"order for AnimatedSprite3D to display frames."
+msgstr ""
+
+#: scene/3d/vehicle_body.cpp
+msgid ""
+"VehicleWheel serves to provide a wheel system to a VehicleBody. Please use "
+"it as a child of a VehicleBody."
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Raw Mode"
+msgstr ""
+
+#: scene/gui/color_picker.cpp
+msgid "Add current color as a preset"
+msgstr ""
+
+#: scene/gui/dialogs.cpp
+msgid "Alert!"
+msgstr ""
+
+#: scene/gui/dialogs.cpp
+msgid "Please Confirm..."
+msgstr ""
+
+#: scene/gui/file_dialog.cpp
+msgid "Select this Folder"
+msgstr ""
+
+#: scene/gui/popup.cpp
+msgid ""
+"Popups will hide by default unless you call popup() or any of the popup*() "
+"functions. Making them visible for editing is fine though, but they will "
+"hide upon running."
+msgstr ""
+
+#: scene/gui/scroll_container.cpp
+msgid ""
+"ScrollContainer is intended to work with a single child control.\n"
+"Use a container as child (VBox,HBox,etc), or a Control and set the custom "
+"minimum size manually."
+msgstr ""
+
+#: scene/gui/tree.cpp
+msgid "(Other)"
+msgstr ""
+
+#: scene/main/scene_tree.cpp
+msgid ""
+"Default Environment as specified in Project Settings (Rendering -> "
+"Environment -> Default Environment) could not be loaded."
+msgstr ""
+
+#: scene/main/viewport.cpp
+msgid ""
+"This viewport is not set as render target. If you intend for it to display "
+"its contents directly to the screen, make it a child of a Control so it can "
+"obtain a size. Otherwise, make it a RenderTarget and assign its internal "
+"texture to some node for display."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Error initializing FreeType."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Unknown font format."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Error loading font."
+msgstr ""
+
+#: scene/resources/dynamic_font.cpp
+msgid "Invalid font size."
+msgstr ""
diff --git a/editor/translations/sv.po b/editor/translations/sv.po
index 4754d7cb18..9ec654128a 100644
--- a/editor/translations/sv.po
+++ b/editor/translations/sv.po
@@ -3,21 +3,23 @@
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
#
-# bergmarklund <davemcgroin@gmail.com>, 2017.
+# bergmarklund <davemcgroin@gmail.com>, 2017, 2018.
# Christoffer Sundbom <christoffer_karlsson@live.se>, 2017.
+# Jakob Sinclair <sinclair.jakob@mailbox.org>, 2018.
+# . <grenoscar@gmail.com>, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-12-01 23:50+0000\n"
-"Last-Translator: bergmarklund <davemcgroin@gmail.com>\n"
+"PO-Revision-Date: 2018-05-07 11:42+0000\n"
+"Last-Translator: anonymous <>\n"
"Language-Team: Swedish <https://hosted.weblate.org/projects/godot-engine/"
"godot/sv/>\n"
"Language: sv\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 2.18-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -41,17 +43,16 @@ msgid "Anim Change Transform"
msgstr "Anim Ändra Transformation"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "Anim Ändra Värde"
+msgstr "Anim Ändra Värde På Tidsnyckeln"
#: editor/animation_editor.cpp
msgid "Anim Change Call"
-msgstr "Anim Ändra Samtal"
+msgstr "Anim Ändra Anrop"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
-msgstr "Lägg till spår"
+msgstr "Anim Lägg till spår"
#: editor/animation_editor.cpp
msgid "Anim Duplicate Keys"
@@ -59,11 +60,11 @@ msgstr "Anim Duplicera Nycklar"
#: editor/animation_editor.cpp
msgid "Move Anim Track Up"
-msgstr "Flytta Anim Spåra Upp"
+msgstr "Flytta Anim Spåra Uppåt"
#: editor/animation_editor.cpp
msgid "Move Anim Track Down"
-msgstr "Flytta Anim Spår Ner"
+msgstr "Flytta Anim Spår Neråt"
#: editor/animation_editor.cpp
msgid "Remove Anim Track"
@@ -83,16 +84,15 @@ msgstr "Anim Ändra Spårets Interpolation"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
-msgstr ""
+msgstr "Ändra Anim Spårets Värde Läge"
#: editor/animation_editor.cpp
msgid "Anim Track Change Wrap Mode"
msgstr ""
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Edit Node Curve"
-msgstr "Redigera Node-Kurva"
+msgstr "Redigera Nodkurva"
#: editor/animation_editor.cpp
#, fuzzy
@@ -491,7 +491,7 @@ msgstr "Skapa Funktion"
#: editor/connections_dialog.cpp
msgid "Deferred"
-msgstr ""
+msgstr "Uppskjuten"
#: editor/connections_dialog.cpp
#, fuzzy
@@ -531,8 +531,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Anslut '%s' till '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Anslut.."
+msgid "Connect..."
+msgstr "Anslut..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -733,7 +733,7 @@ msgstr "Resurser Utan Explicit Ägande:"
#: editor/dependency_editor.cpp editor/editor_node.cpp
msgid "Orphan Resource Explorer"
-msgstr ""
+msgstr "Föräldralös Resursutforskare"
#: editor/dependency_editor.cpp
msgid "Delete selected files?"
@@ -988,7 +988,7 @@ msgstr "Ta bort Effekt"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr ""
+msgstr "Ljud"
#: editor/editor_audio_buses.cpp
#, fuzzy
@@ -1022,13 +1022,13 @@ msgstr "Flytta Ljud-Buss"
#: editor/editor_audio_buses.cpp
#, fuzzy
-msgid "Save Audio Bus Layout As.."
-msgstr "Spara Ljud-Buss Layout Som.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Spara Ljud-Buss Layout Som..."
#: editor/editor_audio_buses.cpp
#, fuzzy
-msgid "Location for New Layout.."
-msgstr "Plats för Ny Layout.."
+msgid "Location for New Layout..."
+msgstr "Plats för Ny Layout..."
#: editor/editor_audio_buses.cpp
#, fuzzy
@@ -1193,12 +1193,12 @@ msgstr "Uppdaterar Scen"
#: editor/editor_data.cpp
#, fuzzy
-msgid "Storing local changes.."
-msgstr "Lagrar lokala ändringar.."
+msgid "Storing local changes..."
+msgstr "Lagrar lokala ändringar..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Uppdaterar scen.."
+msgid "Updating scene..."
+msgstr "Uppdaterar scen..."
#: editor/editor_data.cpp
#, fuzzy
@@ -1276,8 +1276,8 @@ msgid "Show In File Manager"
msgstr "Visa I Filhanteraren"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Ny Mapp.."
+msgid "New Folder..."
+msgstr "Ny Mapp..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1285,7 +1285,7 @@ msgstr "Uppdatera"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Recognized"
-msgstr ""
+msgstr "Alla Erkända"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Files (*)"
@@ -1348,7 +1348,7 @@ msgstr "Växla Läge"
#: editor/editor_file_dialog.cpp
msgid "Focus Path"
-msgstr ""
+msgstr "Fokusera på Sökväg"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Up"
@@ -1360,7 +1360,7 @@ msgstr "Flytta Favorit Ner"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Go to parent folder"
-msgstr ""
+msgstr "Gå till överordnad mapp"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
#, fuzzy
@@ -1464,11 +1464,11 @@ msgstr "Signaler:"
#: editor/editor_help.cpp
msgid "Enumerations"
-msgstr ""
+msgstr "Enumerations"
#: editor/editor_help.cpp
msgid "Enumerations:"
-msgstr ""
+msgstr "Enumerations:"
#: editor/editor_help.cpp
#, fuzzy
@@ -1568,19 +1568,23 @@ msgstr "Rensa"
msgid "Clear Output"
msgstr "Output:"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Projekt exporten misslyckades med följande felmeddelande %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
msgid "Error saving resource!"
msgstr "Fel vid sparande av resurs!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Spara Resurs Som.."
+msgid "Save Resource As..."
+msgstr "Spara Resurs Som..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Jag förstår.."
+msgid "I see..."
+msgstr "Jag förstår..."
#: editor/editor_node.cpp
#, fuzzy
@@ -1841,13 +1845,13 @@ msgstr "Öppna Bas-Scen"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Quick Open Scene.."
-msgstr "Snabböppna Scen.."
+msgid "Quick Open Scene..."
+msgstr "Snabböppna Scen..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "Quick Open Script.."
-msgstr "Snabböppna Skript.."
+msgid "Quick Open Script..."
+msgstr "Snabböppna Skript..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1859,8 +1863,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Spara ändringar i '%s' innan stängning?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Spara Scen Som.."
+msgid "Save Scene As..."
+msgstr "Spara Scen Som..."
#: editor/editor_node.cpp
msgid "No"
@@ -1921,8 +1925,8 @@ msgstr "Åtgärden kan inte ångras. Återställ ändå?"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Quick Run Scene.."
-msgstr "Snabbkör Scen.."
+msgid "Quick Run Scene..."
+msgstr "Snabbkör Scen..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -2098,8 +2102,8 @@ msgid "Previous tab"
msgstr "Föregående flik"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Filtrera Filer.."
+msgid "Filter Files..."
+msgstr "Filtrera Filer..."
#: editor/editor_node.cpp
#, fuzzy
@@ -2112,12 +2116,12 @@ msgstr "Ny Scen"
#: editor/editor_node.cpp
#, fuzzy
-msgid "New Inherited Scene.."
-msgstr "Ny Ärvd Scen.."
+msgid "New Inherited Scene..."
+msgstr "Ny Ärvd Scen..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Öppna Scen.."
+msgid "Open Scene..."
+msgstr "Öppna Scen..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -2137,18 +2141,18 @@ msgid "Open Recent"
msgstr "Öppna Senaste"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Konvertera Till.."
+msgid "Convert To..."
+msgstr "Konvertera Till..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
#, fuzzy
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2336,7 +2340,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Play"
-msgstr ""
+msgstr "Spela"
#: editor/editor_node.cpp
msgid "Pause the scene"
@@ -2362,7 +2366,7 @@ msgstr "Spela den redigerade scenen."
#: editor/editor_node.cpp
msgid "Play Scene"
-msgstr ""
+msgstr "Spela Scen"
#: editor/editor_node.cpp
msgid "Play custom scene"
@@ -2408,8 +2412,8 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Spara Som.."
+msgid "Save As..."
+msgstr "Spara Som..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2522,8 +2526,8 @@ msgstr ""
#: editor/editor_plugin.cpp
#, fuzzy
-msgid "Thumbnail.."
-msgstr "Miniatyr.."
+msgid "Thumbnail..."
+msgstr "Miniatyr..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2560,7 +2564,7 @@ msgstr ""
#: editor/editor_profiler.cpp
msgid "Frame Time (sec)"
-msgstr ""
+msgstr "Bildrutetid (sek)"
#: editor/editor_profiler.cpp
msgid "Average Time (sec)"
@@ -2682,7 +2686,7 @@ msgid "(Current)"
msgstr "(Nuvarande)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2699,12 +2703,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2769,7 +2767,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2788,8 +2786,8 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Connecting.."
-msgstr "Ansluter.."
+msgid "Connecting..."
+msgstr "Ansluter..."
#: editor/export_template_manager.cpp
#, fuzzy
@@ -2803,7 +2801,7 @@ msgstr "Ansluten"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2953,13 +2951,13 @@ msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Rename.."
-msgstr "Byt namn.."
+msgid "Rename..."
+msgstr "Byt namn..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Move To.."
-msgstr "Flytta Till.."
+msgid "Move To..."
+msgstr "Flytta Till..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2972,17 +2970,17 @@ msgid "Instance"
msgstr "Instans"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "View Owners.."
-msgstr "Visa Ägare.."
+msgid "View Owners..."
+msgstr "Visa Ägare..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Duplicera"
#: editor/filesystem_dock.cpp
@@ -3009,7 +3007,7 @@ msgstr "Instansiera valda scen(er) som barn till vald Node."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -3079,8 +3077,8 @@ msgstr "Importera Scen"
#: editor/import/resource_importer_scene.cpp
#, fuzzy
-msgid "Importing Scene.."
-msgstr "Importerar Scen.."
+msgid "Importing Scene..."
+msgstr "Importerar Scen..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -3091,7 +3089,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -3107,8 +3105,8 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "Sparar.."
+msgid "Saving..."
+msgstr "Sparar..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -3128,7 +3126,7 @@ msgid "Import As:"
msgstr "Importera Som:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3158,25 +3156,26 @@ msgstr ""
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly"
-msgstr ""
+msgstr "Redigera Polygon"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Insert Point"
-msgstr ""
+msgstr "Infoga Punkt"
#: editor/plugins/abstract_polygon_2d_editor.cpp
#: editor/plugins/collision_polygon_editor_plugin.cpp
#: editor/plugins/light_occluder_2d_editor_plugin.cpp
msgid "Edit Poly (Remove Point)"
-msgstr ""
+msgstr "Redigera Polygon (ta bort punkt)"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Remove Poly And Point"
-msgstr ""
+msgstr "Ta bort Polygon och Punkt"
#: editor/plugins/abstract_polygon_2d_editor.cpp
+#, fuzzy
msgid "Create a new polygon from scratch"
-msgstr ""
+msgstr "Skapa ny polygon från grunden"
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid ""
@@ -3188,7 +3187,7 @@ msgstr ""
#: editor/plugins/abstract_polygon_2d_editor.cpp
msgid "Delete points"
-msgstr ""
+msgstr "Radera punkter"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Toggle Autoplay"
@@ -3196,7 +3195,7 @@ msgstr ""
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Animation Name:"
-msgstr ""
+msgstr "Nytt Animationsnamn:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "New Anim"
@@ -3204,7 +3203,7 @@ msgstr "Ny Anim"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Animation Name:"
-msgstr ""
+msgstr "Ändra Animationsnamn:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Delete Animation?"
@@ -3217,11 +3216,11 @@ msgstr "Ta bort Animation"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Invalid animation name!"
-msgstr ""
+msgstr "ERROR: Ogiltigt animationsnamn!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: Animation name already exists!"
-msgstr ""
+msgstr "ERROR: Animationsnamn finns redan!"
#: editor/plugins/animation_player_editor_plugin.cpp
#: editor/plugins/sprite_frames_editor_plugin.cpp
@@ -3560,8 +3559,8 @@ msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
-msgid "Import Animations.."
-msgstr "Importera Animationer.."
+msgid "Import Animations..."
+msgstr "Importera Animationer..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3570,8 +3569,8 @@ msgstr "Redigera Node-Filter"
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
-msgid "Filters.."
-msgstr "Filter.."
+msgid "Filters..."
+msgstr "Filter..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
@@ -3640,7 +3639,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3669,8 +3668,9 @@ msgid "first"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
+#, fuzzy
msgid "prev"
-msgstr ""
+msgstr "förhandsgranska"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "next"
@@ -3709,7 +3709,7 @@ msgid "Site:"
msgstr "Webbplats:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3897,6 +3897,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3995,6 +3996,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -4290,6 +4299,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -4318,7 +4331,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4487,7 +4500,7 @@ msgstr ""
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Partitioning..."
-msgstr "Partitionerar.."
+msgstr "Partitionerar..."
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
@@ -4532,7 +4545,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4904,8 +4917,8 @@ msgstr "Importera Tema"
#: editor/plugins/script_editor_plugin.cpp
#, fuzzy
-msgid "Save Theme As.."
-msgstr "Spara Tema Som.."
+msgid "Save Theme As..."
+msgstr "Spara Tema Som..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -5013,8 +5026,8 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
#, fuzzy
-msgid "Find.."
-msgstr "Hitta.."
+msgid "Find..."
+msgstr "Hitta..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -5234,15 +5247,15 @@ msgstr ""
#: editor/plugins/script_text_editor.cpp
#, fuzzy
-msgid "Replace.."
-msgstr "Ersätt.."
+msgid "Replace..."
+msgstr "Ersätt..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5723,11 +5736,7 @@ msgid "Transform"
msgstr "Transformera"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5989,8 +5998,8 @@ msgstr "Ta bort Alla"
#: editor/plugins/theme_editor_plugin.cpp
#, fuzzy
-msgid "Edit theme.."
-msgstr "Redigera tema.."
+msgid "Edit theme..."
+msgstr "Redigera tema..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -6038,6 +6047,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -6051,8 +6068,9 @@ msgid "Options"
msgstr "Alternativ"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "Alternativ"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -6183,7 +6201,7 @@ msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet.."
+msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -6249,8 +6267,8 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Lägg till.."
+msgid "Add..."
+msgstr "Lägg till..."
#: editor/project_export.cpp
msgid "Resources"
@@ -6344,6 +6362,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Projektnamn:"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "Kunde inte skapa mapp."
@@ -6553,7 +6576,9 @@ msgid "Mouse Button"
msgstr "Musknapp"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6582,8 +6607,8 @@ msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
#, fuzzy
-msgid "Press a Key.."
-msgstr "Tryck på en Knapp.."
+msgid "Press a Key..."
+msgstr "Tryck på en Knapp..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6700,10 +6725,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6775,7 +6796,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6876,11 +6897,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Fil.."
+msgid "File..."
+msgstr "Fil..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -7066,8 +7087,8 @@ msgstr ""
#: editor/scene_tree_dock.cpp
#, fuzzy
-msgid "Save New Scene As.."
-msgstr "Spara Ny Scen Som.."
+msgid "Save New Scene As..."
+msgstr "Spara Ny Scen Som..."
#: editor/scene_tree_dock.cpp
#, fuzzy
@@ -7822,6 +7843,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
#, fuzzy
msgid "Generating solution..."
@@ -7878,6 +7903,10 @@ msgstr "Projekt"
msgid "Warnings"
msgstr "Varning"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8519,10 +8548,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8612,6 +8651,10 @@ msgstr "Fel vid laddning av font."
msgid "Invalid font size."
msgstr "Ogiltig teckenstorlek."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Föregående flik"
+
#~ msgid "Next"
#~ msgstr "Nästa"
@@ -8647,10 +8690,6 @@ msgstr "Ogiltig teckenstorlek."
#~ msgid "That's a BINGO!"
#~ msgstr "Det är en BINGO!"
-#, fuzzy
-#~ msgid "preview"
-#~ msgstr "förhandsgranska"
-
#~ msgid "Move Add Key"
#~ msgstr "Flytta Lägg Till Nyckel"
diff --git a/editor/translations/ta.po b/editor/translations/ta.po
index 0fb480b38a..d7910c2c87 100644
--- a/editor/translations/ta.po
+++ b/editor/translations/ta.po
@@ -496,7 +496,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -906,11 +906,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1046,11 +1046,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1119,7 +1119,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1372,17 +1372,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1587,11 +1591,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1603,7 +1607,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1655,7 +1659,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1800,7 +1804,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1812,11 +1816,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1836,15 +1840,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2089,7 +2093,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2198,7 +2202,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2349,7 +2353,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2365,12 +2369,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2431,7 +2429,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2448,7 +2446,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2461,7 +2459,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2593,11 +2591,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2609,16 +2607,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "அசைவூடà¯à®Ÿà¯ போலிபசà¯à®šà®¾à®µà®¿à®•ளà¯"
#: editor/filesystem_dock.cpp
@@ -2644,7 +2642,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2710,7 +2708,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2722,7 +2720,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2738,7 +2736,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2758,7 +2756,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3172,7 +3170,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3180,7 +3178,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3248,7 +3246,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3315,7 +3313,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3502,6 +3500,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3598,6 +3597,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3883,6 +3890,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3911,7 +3922,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4116,7 +4127,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4477,7 +4488,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4574,7 +4585,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4780,15 +4791,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5239,11 +5250,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5496,7 +5503,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5544,6 +5551,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5556,7 +5571,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5744,7 +5759,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5834,6 +5849,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6019,7 +6038,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6047,7 +6068,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6163,10 +6184,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6235,7 +6252,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6331,11 +6348,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6506,7 +6523,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7205,6 +7222,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7253,6 +7274,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7837,10 +7862,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/th.po b/editor/translations/th.po
index 5b664777b0..4db8459f1b 100644
--- a/editor/translations/th.po
+++ b/editor/translations/th.po
@@ -9,7 +9,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-02-22 12:40+0000\n"
+"PO-Revision-Date: 2018-03-10 03:46+0000\n"
"Last-Translator: Poommetee Ketson <poommetee@protonmail.com>\n"
"Language-Team: Thai <https://hosted.weblate.org/projects/godot-engine/godot/"
"th/>\n"
@@ -495,8 +495,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "ลบà¸à¸²à¸£à¹€à¸Šà¸·à¹ˆà¸­à¸¡à¹‚ยง '%s' à¸à¸±à¸š '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "เชื่อมโยง.."
+msgid "Connect..."
+msgstr "เชื่อมโยง..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -914,12 +914,12 @@ msgid "Move Audio Bus"
msgstr "ย้าย Audio Bus"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "บันทึà¸à¹€à¸¥à¸¢à¹Œà¹€à¸­à¸²à¸•์ของ Audio Bus เป็น.."
+msgid "Save Audio Bus Layout As..."
+msgstr "บันทึà¸à¹€à¸¥à¸¢à¹Œà¹€à¸­à¸²à¸•์ของ Audio Bus เป็น..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "ตำà¹à¸«à¸™à¹ˆà¸‡à¸‚องเลย์เอาต์ใหม่.."
+msgid "Location for New Layout..."
+msgstr "ตำà¹à¸«à¸™à¹ˆà¸‡à¸‚องเลย์เอาต์ใหม่..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1054,12 +1054,12 @@ msgid "Updating Scene"
msgstr "อัพเดทฉาà¸"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "เà¸à¹‡à¸šà¸à¸²à¸£à¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸›à¸¥à¸‡à¸ à¸²à¸¢à¹ƒà¸™.."
+msgid "Storing local changes..."
+msgstr "เà¸à¹‡à¸šà¸à¸²à¸£à¹€à¸›à¸¥à¸µà¹ˆà¸¢à¸™à¹à¸›à¸¥à¸‡à¸ à¸²à¸¢à¹ƒà¸™..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "อัพเดทฉาà¸.."
+msgid "Updating scene..."
+msgstr "อัพเดทฉาà¸..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1127,8 +1127,8 @@ msgid "Show In File Manager"
msgstr "à¹à¸ªà¸”งในตัวจัดà¸à¸²à¸£à¹„ฟล์"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "สร้างโฟลเดอร์.."
+msgid "New Folder..."
+msgstr "สร้างโฟลเดอร์..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1382,18 +1382,22 @@ msgstr "ลบ"
msgid "Clear Output"
msgstr "ลบข้อความ"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "บันทึà¸à¸£à¸µà¸‹à¸­à¸£à¹Œà¸ªà¸œà¸´à¸”พลาด!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "บันทึà¸à¸£à¸µà¸‹à¸­à¸£à¹Œà¸ªà¹€à¸›à¹‡à¸™.."
+msgid "Save Resource As..."
+msgstr "บันทึà¸à¸£à¸µà¸‹à¸­à¸£à¹Œà¸ªà¹€à¸›à¹‡à¸™..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "ตà¸à¸¥à¸‡.."
+msgid "I see..."
+msgstr "ตà¸à¸¥à¸‡..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1612,12 +1616,12 @@ msgid "Open Base Scene"
msgstr "เปิดไฟล์ฉาà¸à¸—ี่ใช้สืบทอด"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "เปิดไฟล์ฉาà¸à¸”่วน.."
+msgid "Quick Open Scene..."
+msgstr "เปิดไฟล์ฉาà¸à¸”่วน..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "เปิดไฟล์สคริปต์ด่วน.."
+msgid "Quick Open Script..."
+msgstr "เปิดไฟล์สคริปต์ด่วน..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1628,8 +1632,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "บันทึภ'%s' à¸à¹ˆà¸­à¸™à¸›à¸´à¸”โปรà¹à¸à¸£à¸¡à¸«à¸£à¸·à¸­à¹„ม่?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "บันทึà¸à¸‰à¸²à¸à¹€à¸›à¹‡à¸™.."
+msgid "Save Scene As..."
+msgstr "บันทึà¸à¸‰à¸²à¸à¹€à¸›à¹‡à¸™..."
#: editor/editor_node.cpp
msgid "No"
@@ -1680,8 +1684,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "à¸à¸²à¸£à¸„ืนà¸à¸¥à¸±à¸šà¹„ม่สามารถยà¸à¹€à¸¥à¸´à¸à¹„ด้ คืนà¸à¸¥à¸±à¸š?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "เริ่มฉาà¸à¸”่วน.."
+msgid "Quick Run Scene..."
+msgstr "เริ่มฉาà¸à¸”่วน..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1830,8 +1834,8 @@ msgid "Previous tab"
msgstr "à¹à¸—็บà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "คัดà¸à¸£à¸­à¸‡à¹„ฟล์.."
+msgid "Filter Files..."
+msgstr "คัดà¸à¸£à¸­à¸‡à¹„ฟล์..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1842,12 +1846,12 @@ msgid "New Scene"
msgstr "ฉาà¸à¹ƒà¸«à¸¡à¹ˆ"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "สืบทอดฉาà¸à¹ƒà¸«à¸¡à¹ˆ.."
+msgid "New Inherited Scene..."
+msgstr "สืบทอดฉาà¸à¹ƒà¸«à¸¡à¹ˆ..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "เปิดไฟล์ฉาà¸.."
+msgid "Open Scene..."
+msgstr "เปิดไฟล์ฉาà¸..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1866,16 +1870,16 @@ msgid "Open Recent"
msgstr "เปิดไฟล์ล่าสุด"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "à¹à¸›à¸¥à¸‡à¹€à¸›à¹‡à¸™.."
+msgid "Convert To..."
+msgstr "à¹à¸›à¸¥à¸‡à¹€à¸›à¹‡à¸™..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2126,8 +2130,8 @@ msgid "Save the currently edited resource."
msgstr "บันทึà¸à¸£à¸µà¸‹à¸­à¸£à¹Œà¸ªà¸—ี่à¸à¸³à¸¥à¸±à¸‡à¸›à¸£à¸±à¸šà¹à¸•่ง"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "บันทึà¸à¹€à¸›à¹‡à¸™.."
+msgid "Save As..."
+msgstr "บันทึà¸à¹€à¸›à¹‡à¸™..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2235,8 +2239,8 @@ msgid "Creating Mesh Previews"
msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸£à¹‰à¸²à¸‡à¸ à¸²à¸žà¸•ัวอย่าง Mesh"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "รูปตัวอย่าง.."
+msgid "Thumbnail..."
+msgstr "รูปตัวอย่าง..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2388,8 +2392,8 @@ msgid "(Current)"
msgstr "(ปัจจุบัน)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸£à¸µà¸¢à¸à¸‚้อมูล โปรดรอ.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸£à¸µà¸¢à¸à¸‚้อมูล โปรดรอ..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2404,12 +2408,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "รูปà¹à¸šà¸šà¸‚อง version.txt ในà¹à¸¡à¹ˆà¹à¸šà¸šà¹„ม่ถูà¸à¸•้อง"
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr "รูปà¹à¸šà¸šà¸‚อง version.txt ในà¹à¸¡à¹ˆà¹à¸šà¸šà¹„ม่ถูà¸à¸•้อง หมายเลขรุ่น revision ต้องใช้ระบุได้"
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "ไม่พบ version.txt ในà¹à¸¡à¹ˆà¹à¸šà¸š"
@@ -2470,8 +2468,8 @@ msgid "Error requesting url: "
msgstr "ผิดพลาดขณะร้องขอที่อยู่: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸Šà¸·à¹ˆà¸­à¸¡à¸•่อ.."
+msgid "Connecting to Mirror..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸Šà¸·à¹ˆà¸­à¸¡à¸•่อ..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2479,7 +2477,7 @@ msgstr "à¸à¸²à¸£à¹€à¸Šà¸·à¹ˆà¸­à¸¡à¸•่อสิ้นสุด"
#: editor/export_template_manager.cpp
msgid "Resolving"
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¸„้นหา.."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¸„้นหา..."
#: editor/export_template_manager.cpp
msgid "Can't Resolve"
@@ -2487,8 +2485,8 @@ msgstr "ค้นหาไม่สำเร็จ"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸Šà¸·à¹ˆà¸­à¸¡à¸•่อ.."
+msgid "Connecting..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸Šà¸·à¹ˆà¸­à¸¡à¸•่อ..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2500,8 +2498,8 @@ msgstr "เชื่อมต่อà¹à¸¥à¹‰à¸§"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¸£à¹‰à¸­à¸‡à¸‚อ.."
+msgid "Requesting..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¸£à¹‰à¸­à¸‡à¸‚อ..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2632,12 +2630,12 @@ msgid "Collapse all"
msgstr "ยุบโฟลเดอร์"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "เปลี่ยนชื่อ.."
+msgid "Rename..."
+msgstr "เปลี่ยนชื่อ..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "ย้ายไป.."
+msgid "Move To..."
+msgstr "ย้ายไป..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2648,16 +2646,16 @@ msgid "Instance"
msgstr "อินสà¹à¸•นซ์"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "à¹à¸à¹‰à¹„ขà¸à¸²à¸£à¸­à¹‰à¸²à¸‡à¸­à¸´à¸‡.."
+msgid "Edit Dependencies..."
+msgstr "à¹à¸à¹‰à¹„ขà¸à¸²à¸£à¸­à¹‰à¸²à¸‡à¸­à¸´à¸‡..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "ดูเจ้าของ.."
+msgid "View Owners..."
+msgstr "ดูเจ้าของ..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "ทำซ้ำ.."
+msgid "Duplicate..."
+msgstr "ทำซ้ำ..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2682,10 +2680,10 @@ msgstr "อินสà¹à¸•นซ์ฉาà¸à¸—ี่เลือà¸à¹ƒà¸«à¹‰à¹€
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"à¸à¸³à¸¥à¸±à¸‡à¸ªà¹à¸à¸™à¹„ฟล์,\n"
-"à¸à¸£à¸¸à¸“ารอ.."
+"à¸à¸£à¸¸à¸“ารอ..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2750,8 +2748,8 @@ msgid "Import Scene"
msgstr "นำเข้าฉาà¸"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¸™à¸³à¹€à¸‚้าฉาà¸.."
+msgid "Importing Scene..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¸™à¸³à¹€à¸‚้าฉาà¸..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2762,8 +2760,8 @@ msgid "Generating for Mesh: "
msgstr "สร้างสำหรับพื้นผิว: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¸£à¸±à¸™à¸ªà¸„ริปต์.."
+msgid "Running Custom Script..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¸£à¸±à¸™à¸ªà¸„ริปต์..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2778,8 +2776,8 @@ msgid "Error running post-import script:"
msgstr "ผิดพลาดขณะรันสคริปต์หลังนำเข้า:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¸šà¸±à¸™à¸—ึà¸.."
+msgid "Saving..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¸šà¸±à¸™à¸—ึà¸..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2798,8 +2796,8 @@ msgid "Import As:"
msgstr "นำเข้าเป็น:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "à¹à¸šà¸š.."
+msgid "Preset..."
+msgstr "à¹à¸šà¸š..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3216,16 +3214,16 @@ msgid "Transition Node"
msgstr "โหนดทรานสิชัน"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "นำเข้าà¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™.."
+msgid "Import Animations..."
+msgstr "นำเข้าà¹à¸­à¸™à¸´à¹€à¸¡à¸Šà¸±à¸™..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "à¹à¸à¹‰à¹„ขตัวà¸à¸£à¸­à¸‡à¹‚หนด"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "ตัวà¸à¸£à¸­à¸‡.."
+msgid "Filters..."
+msgstr "ตัวà¸à¸£à¸­à¸‡..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3292,8 +3290,8 @@ msgid "Fetching:"
msgstr "à¸à¸³à¸¥à¸±à¸‡à¸£à¸±à¸šà¸‚้อมูล:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "à¸à¸³à¸¥à¸±à¸‡à¸„้นหา.."
+msgid "Resolving..."
+msgstr "à¸à¸³à¸¥à¸±à¸‡à¸„้นหา..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3359,8 +3357,8 @@ msgid "Site:"
msgstr "ไซต์:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "à¸à¸²à¸£à¸ªà¸™à¸±à¸šà¸ªà¸™à¸¸à¸™.."
+msgid "Support..."
+msgstr "à¸à¸²à¸£à¸ªà¸™à¸±à¸šà¸ªà¸™à¸¸à¸™..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3551,6 +3549,7 @@ msgid "Use Rotation Snap"
msgstr "จำà¸à¸±à¸”à¸à¸²à¸£à¸«à¸¡à¸¸à¸™"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "ตั้งค่าà¸à¸²à¸£à¸ˆà¸³à¸à¸±à¸”..."
@@ -3647,6 +3646,16 @@ msgid "Show Guides"
msgstr "à¹à¸ªà¸”งเส้นนำ"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Origin"
+msgstr "à¹à¸ªà¸”งจุดà¸à¸³à¹€à¸™à¸´à¸”"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+#, fuzzy
+msgid "Show Viewport"
+msgstr "1 มุมมอง"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "ให้สิ่งที่เลือà¸à¸­à¸¢à¸¹à¹ˆà¸à¸¥à¸²à¸‡à¸ˆà¸­"
@@ -3936,6 +3945,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Mesh ไม่มีพื้นผิวให้สร้างเส้นขอบได้!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "สร้างเส้นรอบรูปไม่ได้!"
@@ -3964,8 +3977,8 @@ msgid "Create Convex Collision Sibling"
msgstr "สร้างรูปทรงตันà¸à¸²à¸¢à¸ à¸²à¸žà¹€à¸›à¹‡à¸™à¹‚หนดà¸à¸²à¸•ิ"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "สร้างเส้นขอบ Mesh.."
+msgid "Create Outline Mesh..."
+msgstr "สร้างเส้นขอบ Mesh..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4169,8 +4182,8 @@ msgid "Error loading image:"
msgstr "ผิดพลาดขณะโหลดรูป:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "รูปไม่มีพิà¸à¹€à¸‹à¸¥à¹ƒà¸”ที่ความโปร่งà¹à¸ªà¸‡ > 128 .."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "รูปไม่มีพิà¸à¹€à¸‹à¸¥à¹ƒà¸”ที่ความโปร่งà¹à¸ªà¸‡ > 128 ..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4530,7 +4543,7 @@ msgid "Import Theme"
msgstr "นำเข้าธีม"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "บันทึà¸à¸˜à¸µà¸¡à¹€à¸›à¹‡à¸™"
#: editor/plugins/script_editor_plugin.cpp
@@ -4627,8 +4640,8 @@ msgstr "เปิด/ปิดà¹à¸œà¸‡à¸ªà¸„ริปต์"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "ค้นหา.."
+msgid "Find..."
+msgstr "ค้นหา..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4835,16 +4848,16 @@ msgid "Find Previous"
msgstr "ค้นหาà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "à¹à¸—นที่.."
+msgid "Replace..."
+msgstr "à¹à¸—นที่..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "ไปยังฟังà¸à¹Œà¸Šà¸±à¸™.."
+msgid "Goto Function..."
+msgstr "ไปยังฟังà¸à¹Œà¸Šà¸±à¸™..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "ไปยังบรรทัด.."
+msgid "Goto Line..."
+msgstr "ไปยังบรรทัด..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5297,12 +5310,8 @@ msgid "Transform"
msgstr "เคลื่อนย้าย"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "ตั้งค่าà¸à¸²à¸£à¸ˆà¸³à¸à¸±à¸”.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "เครื่องมือเคลื่อนย้าย.."
+msgid "Transform Dialog..."
+msgstr "เครื่องมือเคลื่อนย้าย..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5554,8 +5563,8 @@ msgid "Remove All"
msgstr "ลบทั้งหมด"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "à¹à¸à¹‰à¹„ขธีม.."
+msgid "Edit theme..."
+msgstr "à¹à¸à¹‰à¹„ขธีม..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5602,6 +5611,16 @@ msgid "Checked Item"
msgstr "ไอเทมมีเครื่องหมาย"
#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Radio Item"
+msgstr "เพิ่มไอเทม"
+
+#: editor/plugins/theme_editor_plugin.cpp
+#, fuzzy
+msgid "Checked Radio Item"
+msgstr "ไอเทมมีเครื่องหมาย"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "มี"
@@ -5614,7 +5633,8 @@ msgid "Options"
msgstr "ตัวเลือà¸"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+#, fuzzy
+msgid "Has,Many,Options"
msgstr "มี,มาà¸à¸¡à¸²à¸¢,หลาย,ตัวเลือà¸!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5804,8 +5824,8 @@ msgid "Presets"
msgstr "à¸à¸²à¸£à¸ªà¹ˆà¸‡à¸­à¸­à¸"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "เพิ่ม.."
+msgid "Add..."
+msgstr "เพิ่ม..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5894,6 +5914,11 @@ msgid "Imported Project"
msgstr "นำเข้าโปรเจà¸à¸•์à¹à¸¥à¹‰à¸§"
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "ชื่อโปรเจà¸à¸•์:"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "ไม่สามารถสร้างโฟลเดอร์"
@@ -5910,11 +5935,11 @@ msgid "Invalid project path (changed anything?)."
msgstr "ตำà¹à¸«à¸™à¹ˆà¸‡à¹‚ปรเจà¸à¸•์ผิดพลาด (ได้à¹à¸à¹‰à¹„ขอะไรไปหรือไม่?)"
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "à¹à¸à¹‰à¹„ขไฟล์ project.godot ไม่ได้"
+msgstr ""
+"โหลดไฟล์ project.godot ในโฟลเดอร์โปรเจà¸à¸•์ไม่ได้ (ข้อผิดพลาด %d) ไฟล์อาจสูà¸à¸«à¸²à¸¢à¸«à¸£à¸·à¸­à¹€à¸ªà¸µà¸¢à¸«à¸²à¸¢"
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6088,8 +6113,10 @@ msgid "Mouse Button"
msgstr "ปุ่มเมาส์"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "ใช้ชื่อนี้ไม่ได้ (มี '/' หรือ ':')"
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6116,8 +6143,8 @@ msgid "Control+"
msgstr "Control+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "à¸à¸”ปุ่ม.."
+msgid "Press a Key..."
+msgstr "à¸à¸”ปุ่ม..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6232,10 +6259,6 @@ msgid "Delete Item"
msgstr "ลบไอเทม"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "ต้องไม่มี '/' หรือ ':'"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "มีอยู่à¸à¹ˆà¸­à¸™à¹à¸¥à¹‰à¸§"
@@ -6304,8 +6327,8 @@ msgid "Property:"
msgstr "คุณสมบัติ:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "à¸à¸³à¸«à¸™à¸”เฉพาะ.."
+msgid "Override For..."
+msgstr "à¸à¸³à¸«à¸™à¸”เฉพาะ..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6345,11 +6368,11 @@ msgstr "รีซอร์ส:"
#: editor/project_settings_editor.cpp
msgid "Remaps by Locale:"
-msgstr "à¹à¸—นที่ตามท้องถิ่น:"
+msgstr "à¹à¸—นที่ตามภูมิภาค:"
#: editor/project_settings_editor.cpp
msgid "Locale"
-msgstr "ท้องถิ่น"
+msgstr "ภูมิภาค"
#: editor/project_settings_editor.cpp
msgid "Locales Filter"
@@ -6400,12 +6423,12 @@ msgid "Easing Out-In"
msgstr "ออà¸-เข้านุ่มนวล"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "ไฟล์.."
+msgid "File..."
+msgstr "ไฟล์..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "โฟลเดอร์.."
+msgid "Dir..."
+msgstr "โฟลเดอร์..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6575,8 +6598,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "ทำà¸à¸±à¸šà¸‰à¸²à¸à¸—ี่เป็นอินสà¹à¸•นซ์ไม่ได้"
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "บันทึà¸à¸‰à¸²à¸à¹ƒà¸«à¸¡à¹ˆà¹€à¸›à¹‡à¸™.."
+msgid "Save New Scene As..."
+msgstr "บันทึà¸à¸‰à¸²à¸à¹ƒà¸«à¸¡à¹ˆà¹€à¸›à¹‡à¸™..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7169,18 +7192,16 @@ msgid "Object can't provide a length."
msgstr "ไม่สามารถบอà¸à¸„วามยาวของวัตถุได้"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "à¹à¸—็บถัดไป"
+msgstr "ระนาบถัดไป"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "à¹à¸—็บà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²"
+msgstr "ระนาบà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "ระนาบ:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7286,6 +7307,10 @@ msgstr "à¸à¸²à¸£à¸•ั้งค่า GridMap"
msgid "Pick Distance:"
msgstr "ระยะà¸à¸²à¸£à¹€à¸¥à¸·à¸­à¸:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸£à¹‰à¸²à¸‡ solution..."
@@ -7316,7 +7341,7 @@ msgstr "โมโน"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "เà¸à¸µà¹ˆà¸¢à¸§à¸à¸±à¸šà¸à¸²à¸£à¸ªà¸™à¸±à¸šà¸ªà¸™à¸¸à¸™ C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7334,6 +7359,10 @@ msgstr "Build โปรเจà¸à¸•์"
msgid "Warnings"
msgstr "คำเตือน"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "สิ้นสุดสà¹à¸•คข้อผิดพลาดภายใน"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7850,11 +7879,11 @@ msgstr "ARVROrigin ต้องมี ARVRCamera เป็นโหนดลูà
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(เหลืออีà¸: %d:%02d วิ)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -7944,10 +7973,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "ต้องà¹à¸à¹‰à¹„ข Path ให้ชี้ไปยังโหนด Spatial จึงจะทำงานได้"
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr "จะมี WorldEnvironment ได้เพียงโหนดเดียวในฉาภ(หรือà¸à¸¥à¸¸à¹ˆà¸¡à¸‚องฉาà¸à¸—ี่เป็นอินสà¹à¸•นซ์)"
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8038,6 +8077,24 @@ msgstr "ผิดพลาดขณะโหลดฟอนต์"
msgid "Invalid font size."
msgstr "ขนาดฟอนต์ผิดพลาด"
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "à¹à¸—็บà¸à¹ˆà¸­à¸™à¸«à¸™à¹‰à¸²"
+
+#~ msgid "Next"
+#~ msgstr "ต่อไป"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "ใช้ชื่อนี้ไม่ได้ (มี '/' หรือ ':')"
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "ต้องไม่มี '/' หรือ ':'"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr "รูปà¹à¸šà¸šà¸‚อง version.txt ในà¹à¸¡à¹ˆà¹à¸šà¸šà¹„ม่ถูà¸à¸•้อง หมายเลขรุ่น revision ต้องใช้ระบุได้"
+
#~ msgid "Can't write file."
#~ msgstr "เขียนไฟล์ไม่ได้"
@@ -8050,9 +8107,6 @@ msgstr "ขนาดฟอนต์ผิดพลาด"
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "ไม่พบไฟล์ project.godot"
-#~ msgid "Next"
-#~ msgstr "ต่อไป"
-
#~ msgid "Not found!"
#~ msgstr "ไม่พบ!"
@@ -8195,8 +8249,8 @@ msgstr "ขนาดฟอนต์ผิดพลาด"
#~ msgid "Exporting for %s"
#~ msgstr "ส่งออà¸à¸ªà¸³à¸«à¸£à¸±à¸š %s"
-#~ msgid "Setting Up.."
-#~ msgstr "à¸à¸³à¸¥à¸±à¸‡à¸•ั้งค่า.."
+#~ msgid "Setting Up..."
+#~ msgstr "à¸à¸³à¸¥à¸±à¸‡à¸•ั้งค่า..."
#~ msgid "Error loading scene."
#~ msgstr "ผิดพลาดขณะโหลดฉาà¸"
@@ -8256,8 +8310,8 @@ msgstr "ขนาดฟอนต์ผิดพลาด"
#~ msgid "Info"
#~ msgstr "ข้อมูล"
-#~ msgid "Re-Import.."
-#~ msgstr "นำเข้าอีà¸à¸„รั้ง.."
+#~ msgid "Re-Import..."
+#~ msgstr "นำเข้าอีà¸à¸„รั้ง..."
#~ msgid "No bit masks to import!"
#~ msgstr "ไม่มีบิตà¹à¸¡à¸ªà¸à¹Œà¹ƒà¸«à¹‰à¸™à¸³à¹€à¸‚้า!"
@@ -8637,14 +8691,14 @@ msgstr "ขนาดฟอนต์ผิดพลาด"
#~ msgid "Zoom (%):"
#~ msgstr "ซูม (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "โครงà¸à¸£à¸°à¸”ูà¸.."
+#~ msgid "Skeleton..."
+#~ msgstr "โครงà¸à¸£à¸°à¸”ูà¸..."
#~ msgid "Zoom Reset"
#~ msgstr "รีเซ็ตà¸à¸²à¸£à¸‹à¸¹à¸¡"
-#~ msgid "Zoom Set.."
-#~ msgstr "ตั้งค่าà¸à¸²à¸£à¸‹à¸¹à¸¡.."
+#~ msgid "Zoom Set..."
+#~ msgstr "ตั้งค่าà¸à¸²à¸£à¸‹à¸¹à¸¡..."
#~ msgid "Set a Value"
#~ msgstr "เซ็ตค่า"
@@ -9058,8 +9112,8 @@ msgstr "ขนาดฟอนต์ผิดพลาด"
#~ msgid "Export Project PCK"
#~ msgstr "ส่งออภPCK โปรเจà¸à¸•์"
-#~ msgid "Export.."
-#~ msgstr "ส่งออà¸.."
+#~ msgid "Export..."
+#~ msgstr "ส่งออà¸..."
#~ msgid "Project Export"
#~ msgstr "ส่งออà¸à¹‚ปรเจà¸à¸•์"
diff --git a/editor/translations/tr.po b/editor/translations/tr.po
index f486ca5fce..292cec4063 100644
--- a/editor/translations/tr.po
+++ b/editor/translations/tr.po
@@ -2,31 +2,33 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Aprın Çor Tigin <kabusturk38@gmail.com>, 2016-2017.
+# Aykut YILDIRIM <aykutyildirim@windowslive.com>, 2018.
# Ceyhun Can Ulker <ceyhuncanu@gmail.com>, 2016.
# Enes Kaya Öcal <ekayaocal@hotmail.com>, 2016.
# Enescan Yerlikaya <enescanyerlikaya@gmail.com>, 2017.
# Fatih Mert DoÄŸancan <fatihmertdogancan@hotmail.com>, 2017.
# hubbyist <hub@legrud.net>, 2017.
+# H.Hüseyin CİHANGİR <hashusfb@gmail.com>, 2018.
+# Kaan Gül <qaantum@hotmail.com>, 2018.
# M. Yavuz Uzun <myavuzuzun@yandex.com>, 2016.
+# monolifed <monolifed@gmail.com>, 2018.
# Orkun Turan <holygatestudio@yandex.com>, 2016-2017.
# razah <icnikerazah@gmail.com>, 2017-2018.
# stnmycri <satenmeycri@gmail.com>, 2017-2018.
# Yavuz Günay <yavuzgunay@gmail.com>, 2017.
-#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-24 23:40+0000\n"
-"Last-Translator: razah <icnikerazah@gmail.com>\n"
+"PO-Revision-Date: 2018-06-10 09:46+0000\n"
+"Last-Translator: Aykut YILDIRIM <aykutyildirim@windowslive.com>\n"
"Language-Team: Turkish <https://hosted.weblate.org/projects/godot-engine/"
"godot/tr/>\n"
"Language: tr\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 2.19-dev\n"
+"X-Generator: Weblate 3.0.1-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -508,7 +510,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Şunun: '%s' şununla: '%s' bağlantısını kes"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "BaÄŸlan..."
#: editor/connections_dialog.cpp
@@ -928,12 +930,12 @@ msgid "Move Audio Bus"
msgstr "Audio Bus'ı Taşı"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Audio Bus Yerleşim Düzenini Farklı Kaydet.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Audio Bus Yerleşim Düzenini Farklı Kaydet..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Yeni Yerleşim Düzeni için Konum.."
+msgid "Location for New Layout..."
+msgstr "Yeni Yerleşim Düzeni için Konum..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -1068,12 +1070,12 @@ msgid "Updating Scene"
msgstr "Sahne Güncelleniyor"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Yerel değişiklikler kayıt ediliyor.."
+msgid "Storing local changes..."
+msgstr "Yerel değişiklikler kayıt ediliyor..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "Sahne güncelleniyor.."
+msgid "Updating scene..."
+msgstr "Sahne güncelleniyor..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1141,8 +1143,8 @@ msgid "Show In File Manager"
msgstr "Dosya Yöneticisinde Göster"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Yeni Klasör.."
+msgid "New Folder..."
+msgstr "Yeni Klasör..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1401,18 +1403,22 @@ msgstr "Temizle"
msgid "Clear Output"
msgstr "Çıktıyı Temizle"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Proje dışa aktarımı %d hata koduyla başarısız."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Kaynak kaydedilirken hata!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Kaynağı Farklı Kaydet.."
+msgid "Save Resource As..."
+msgstr "Kaynağı Farklı Kaydet..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Anlıyorum.."
+msgid "I see..."
+msgstr "Anlıyorum..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1643,12 +1649,12 @@ msgid "Open Base Scene"
msgstr "Ana Sahneyi Aç"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Sahneyi Hızlı Aç.."
+msgid "Quick Open Scene..."
+msgstr "Sahneyi Hızlı Aç..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Betiği Hızlı Aç.."
+msgid "Quick Open Script..."
+msgstr "Betiği Hızlı Aç..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1659,8 +1665,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "Kapatmadan önce değişklikler buraya '%s' kaydedilsin mi?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Sahneyi Farklı Kaydet.."
+msgid "Save Scene As..."
+msgstr "Sahneyi Farklı Kaydet..."
#: editor/editor_node.cpp
msgid "No"
@@ -1711,8 +1717,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Bu eylem geri alınamaz. Yine de geri dönsün mü?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Sahneyi Hızlı Çalıştır.."
+msgid "Quick Run Scene..."
+msgstr "Sahneyi Hızlı Çalıştır..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1867,8 +1873,8 @@ msgid "Previous tab"
msgstr "Önceki sekme"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "Dosyaları Süz.."
+msgid "Filter Files..."
+msgstr "Dosyaları Süz..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1879,12 +1885,12 @@ msgid "New Scene"
msgstr "Yeni Sahne"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Yeni Miras Alınmış Sahne .."
+msgid "New Inherited Scene..."
+msgstr "Yeni Miras Alınmış Sahne ..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Sahne Aç.."
+msgid "Open Scene..."
+msgstr "Sahne Aç..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1903,16 +1909,16 @@ msgid "Open Recent"
msgstr "En Sonuncuyu Aç"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Şuna Dönüştür.."
+msgid "Convert To..."
+msgstr "Şuna Dönüştür..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary .."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary ..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet .."
+msgid "TileSet..."
+msgstr "TileSet ..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2017,7 +2023,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Scene Changes"
-msgstr "Sahne DeÄŸiÅŸikliklerini EÅŸzamanla"
+msgstr "Sahne DeÄŸiÅŸikliklerini EÅŸ Zamanla"
#: editor/editor_node.cpp
msgid ""
@@ -2033,7 +2039,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Sync Script Changes"
-msgstr "Betik DeÄŸiÅŸikliklerini EÅŸzamanla"
+msgstr "Betik DeÄŸiÅŸikliklerini EÅŸ Zamanla"
#: editor/editor_node.cpp
msgid ""
@@ -2175,8 +2181,8 @@ msgid "Save the currently edited resource."
msgstr "Düzenlenen kaynağı kaydedin."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "Farklı Kaydet.."
+msgid "Save As..."
+msgstr "Farklı Kaydet..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2284,8 +2290,8 @@ msgid "Creating Mesh Previews"
msgstr "Mesh Önizlemeleri Oluşturuluyor"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Küçük Resim.."
+msgid "Thumbnail..."
+msgstr "Küçük Resim..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2437,8 +2443,8 @@ msgid "(Current)"
msgstr "(Åžuanki)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "Aynalar alınıyor, lütfen bekleyin.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "Aynalar alınıyor, lütfen bekleyin..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2453,14 +2459,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Şablonların içinde geçersiz version.txt formatı."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Şablonların içinde geçersiz version.txt formatı. Revizyon geçerli bir "
-"tanımlayıcı değil."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Şablonların içinde version.txt bulunamadı."
@@ -2523,8 +2521,8 @@ msgid "Error requesting url: "
msgstr "Url isteği hatası: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "Aynaya bağlanılıyor.."
+msgid "Connecting to Mirror..."
+msgstr "Aynaya bağlanılıyor..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2540,8 +2538,8 @@ msgstr "Çözümlenemedi"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "Bağlanılıyor.."
+msgid "Connecting..."
+msgstr "Bağlanılıyor..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2553,8 +2551,8 @@ msgstr "Bağlı"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "İsteniyor.."
+msgid "Requesting..."
+msgstr "İsteniyor..."
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2689,12 +2687,12 @@ msgid "Collapse all"
msgstr "Hepsini daralt"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
-msgstr "Yeniden Adlandır.."
+msgid "Rename..."
+msgstr "Yeniden Adlandır..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "Şuraya Taşı.."
+msgid "Move To..."
+msgstr "Şuraya Taşı..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2705,16 +2703,16 @@ msgid "Instance"
msgstr "Örnek"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Bağımlılıkları Düzenle.."
+msgid "Edit Dependencies..."
+msgstr "Bağımlılıkları Düzenle..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Sahipleri Görüntüle.."
+msgid "View Owners..."
+msgstr "Sahipleri Görüntüle..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Çoğalt.."
+msgid "Duplicate..."
+msgstr "Çoğalt..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2739,10 +2737,10 @@ msgstr "Seçilen sahneyi/sahneleri seçilen düğüme çocuk olarak örneklendir
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Dosyalar Taranıyor,\n"
-"Lütfen Bekleyiniz.."
+"Lütfen Bekleyiniz..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2807,7 +2805,7 @@ msgid "Import Scene"
msgstr "Sahneyi İçe Aktar"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr "Sahneyi İçe Aktarıyor..."
#: editor/import/resource_importer_scene.cpp
@@ -2819,8 +2817,8 @@ msgid "Generating for Mesh: "
msgstr "Örüntü için Üretiliyor: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "Çalışan Özel Betik.."
+msgid "Running Custom Script..."
+msgstr "Çalışan Özel Betik..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2837,7 +2835,7 @@ msgid "Error running post-import script:"
msgstr "sonradan-içe aktarılmış betik çalıştırılırken hata:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "Kaydediliyor..."
#: editor/import_dock.cpp
@@ -2857,8 +2855,8 @@ msgid "Import As:"
msgstr "Şu Şekilde İçe Aktar:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Ön ayar.."
+msgid "Preset..."
+msgstr "Ön ayar..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3275,15 +3273,15 @@ msgid "Transition Node"
msgstr "Geçiş Düğümü"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Animasyonları İçe Aktar.."
+msgid "Import Animations..."
+msgstr "Animasyonları İçe Aktar..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Düğüm Süzgeçlerini Düzenle"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Süzgeçler..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3351,7 +3349,7 @@ msgid "Fetching:"
msgstr "Alınıyor:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "Çözümleniyor..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3418,7 +3416,7 @@ msgid "Site:"
msgstr "Yer:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Destek..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3616,6 +3614,7 @@ msgid "Use Rotation Snap"
msgstr "Döndürme Yapışması Kullan"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "Yapışmayı Yapılandır..."
@@ -3712,6 +3711,14 @@ msgid "Show Guides"
msgstr "Kılavuzları göster"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Başlatımı Göster"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Görüntükapısını Göster"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "İçre Seçimi"
@@ -3765,7 +3772,7 @@ msgstr "Ekle %s"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Adding %s..."
-msgstr "Ekliyor %s.."
+msgstr "Ekliyor %s..."
#: editor/plugins/canvas_item_editor_plugin.cpp editor/scene_tree_dock.cpp
msgid "Ok"
@@ -4001,6 +4008,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Örüntü anahat oluşturmak için bir yüzeye sahip değil!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Örüntü ilkel türü PRIMITIVE_TRIANGLES değil!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Anahat oluşturulamadı!"
@@ -4029,8 +4040,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Dışbükey Çarpışma Kardeşi Oluştur"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Anahat Örüntüsü Oluştur.."
+msgid "Create Outline Mesh..."
+msgstr "Anahat Örüntüsü Oluştur..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4234,8 +4245,8 @@ msgid "Error loading image:"
msgstr "Resim yüklenirken hata:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Saydamlığı olan nokta yok > 128 bedizde.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Saydamlığı olan nokta yok > 128 bedizde..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4595,8 +4606,8 @@ msgid "Import Theme"
msgstr "Kalıbı İçe Aktar"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "Temayı Farklı Kaydet.."
+msgid "Save Theme As..."
+msgstr "Temayı Farklı Kaydet..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4692,8 +4703,8 @@ msgstr "Betikler Panelini Aç/Kapa"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Bul.."
+msgid "Find..."
+msgstr "Bul..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4902,16 +4913,16 @@ msgid "Find Previous"
msgstr "Öncekini Bul"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "DeÄŸiÅŸtir.."
+msgid "Replace..."
+msgstr "DeÄŸiÅŸtir..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "İşleve Git.."
+msgid "Goto Function..."
+msgstr "İşleve Git..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Dizeye Git.."
+msgid "Goto Line..."
+msgstr "Dizeye Git..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5285,7 +5296,7 @@ msgstr "Ölçek Biçimi (R)"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Coords"
-msgstr "Yerel Koordlar"
+msgstr "Yerel Kordinatlar"
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Local Space Mode (%s)"
@@ -5364,12 +5375,8 @@ msgid "Transform"
msgstr "Dönüşüm"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Yapışmayı Yapılandır.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "Dönüştürme İletişim Kutusu.."
+msgid "Transform Dialog..."
+msgstr "Dönüştürme İletişim Kutusu..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5621,8 +5628,8 @@ msgid "Remove All"
msgstr "Tümünü Kaldır"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "Tema düzenle.."
+msgid "Edit theme..."
+msgstr "Tema düzenle..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5669,6 +5676,14 @@ msgid "Checked Item"
msgstr "Denetlenen Öğe"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Radyo Ögesi"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Seçili Radyo Ögesi"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Var"
@@ -5681,7 +5696,8 @@ msgid "Options"
msgstr "Seçenekler"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+#, fuzzy
+msgid "Has,Many,Options"
msgstr "Bir Çok,Seçenek,Var!"
#: editor/plugins/theme_editor_plugin.cpp
@@ -5873,8 +5889,8 @@ msgid "Presets"
msgstr "Önayarlar"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "Ekle.."
+msgid "Add..."
+msgstr "Ekle..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5967,6 +5983,10 @@ msgid "Imported Project"
msgstr "İçe Aktarılan Proje"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Geçersiz Proje Adı."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Klasör oluşturulamadı."
@@ -5983,11 +6003,11 @@ msgid "Invalid project path (changed anything?)."
msgstr "Geçersiz proje yolu (bir şey değişti mi?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "proje yolundaki proje.godot düzenlenemedi."
+msgstr ""
+"Proje yolundaki proje.godot düzenlenemedi.Eksik veya bozulmuş olabilir."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6165,8 +6185,11 @@ msgid "Mouse Button"
msgstr "Fare Düğmesi"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Geçersiz işlem (her şey ancak şu '/' ya da şuna ':' gider)."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Geçersiz işlem adı. Boş olamaz ve '/', ':', '=', '\\' veya '\"' içeremez."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6193,8 +6216,8 @@ msgid "Control+"
msgstr "Denetim+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "Bir Dokunaca Basın.."
+msgid "Press a Key..."
+msgstr "Bir Dokunaca Basın..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6309,10 +6332,6 @@ msgid "Delete Item"
msgstr "Öğeyi Sil"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "'/' veya ':' içeremez"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Zaten mevcut"
@@ -6381,8 +6400,8 @@ msgid "Property:"
msgstr "Özellik:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
-msgstr "Şunun Üzerine Yaz.."
+msgid "Override For..."
+msgstr "Şunun Üzerine Yaz..."
#: editor/project_settings_editor.cpp
msgid "Input Map"
@@ -6450,7 +6469,7 @@ msgstr "Yereller:"
#: editor/project_settings_editor.cpp
msgid "AutoLoad"
-msgstr "KendindenYükle"
+msgstr "Otomatik Yükle"
#: editor/property_editor.cpp
msgid "Pick a Viewport"
@@ -6477,12 +6496,12 @@ msgid "Easing Out-In"
msgstr "Kararma Açılma"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "Dosya.."
+msgid "File..."
+msgstr "Dosya..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "Diz.."
+msgid "Dir..."
+msgstr "Diz..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6654,8 +6673,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Bu işlem örneklenmiş sahnelerde yapılamaz."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "Yeni Sahneyi Farklı Kaydet .."
+msgid "Save New Scene As..."
+msgstr "Yeni Sahneyi Farklı Kaydet ..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -7058,7 +7077,7 @@ msgstr "Toplam:"
#: editor/script_editor_debugger.cpp
msgid "Video Mem"
-msgstr "İzleti Belleği"
+msgstr "Görüntü Belleği"
#: editor/script_editor_debugger.cpp
msgid "Resource Path"
@@ -7078,7 +7097,7 @@ msgstr "Kullanım"
#: editor/script_editor_debugger.cpp
msgid "Misc"
-msgstr "Türlü"
+msgstr "Çeşitli"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
@@ -7252,18 +7271,16 @@ msgid "Object can't provide a length."
msgstr "Nesne bir uzunluk saÄŸlayamaz."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
msgstr "Sonraki sekme"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
msgstr "Önceki sekme"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Sekme:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7369,9 +7386,13 @@ msgstr "IzgaraHaritası Ayarları"
msgid "Pick Distance:"
msgstr "Uzaklık Seç:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Sınıf ismi ayrılmış anahtar kelime olamaz"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
-msgstr "solü oluşturuluyor..."
+msgstr "Çözüm oluşturuluyor..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating C# project..."
@@ -7399,7 +7420,7 @@ msgstr "Tekli"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "C# desteği hakkında"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7417,6 +7438,10 @@ msgstr "Projeyi İnşa et"
msgid "Warnings"
msgstr "Uyarılar"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "İç özel durum yığını izlemesinin sonu"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7599,7 +7624,7 @@ msgstr "Dizi"
#: modules/visual_script/visual_script_editor.cpp
msgid "Switch"
-msgstr "DeÄŸiÅŸtir"
+msgstr "Anahtar"
#: modules/visual_script/visual_script_editor.cpp
msgid "Iterator"
@@ -7968,11 +7993,11 @@ msgstr "ARVROrigin bir ARVRCamera çocuk düğümü gerektirir"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(Kalan Zaman:%d:%02d sn)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8073,12 +8098,24 @@ msgstr ""
"Yol özelliği, çalışmak için geçerli bir Spatial düğümüne işaret etmelidir."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment bir Environment kaynağı gerektirir."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"Her sahne başına (ya da örneklenmiş sahneler dizisine) sadece bir tane "
"WorldEnvironment 'a izin verilir."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Bu WorldEnvironment yoksayıldı. (3B sahneler için) Bir Kamera ekleyin veya "
+"(2B sahneler için) bu ortamın Arkaplan Kipini Canvas olarak ayarlayın."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8175,6 +8212,26 @@ msgstr "Yazıtipi yükleme hatası."
msgid "Invalid font size."
msgstr "Geçersiz yazıtipi boyutu."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Önceki sekme"
+
+#~ msgid "Next"
+#~ msgstr "Sonraki"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Geçersiz işlem (her şey ancak şu '/' ya da şuna ':' gider)."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "'/' veya ':' içeremez"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Şablonların içinde geçersiz version.txt formatı. Revizyon geçerli bir "
+#~ "tanımlayıcı değil."
+
#~ msgid "Can't write file."
#~ msgstr "Dosyaya yazılamıyor."
@@ -8187,9 +8244,6 @@ msgstr "Geçersiz yazıtipi boyutu."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Proje yolunda proje.godot alınamadı."
-#~ msgid "Next"
-#~ msgstr "Sonraki"
-
#~ msgid "Not found!"
#~ msgstr "Bulunamadı!"
@@ -8329,7 +8383,7 @@ msgstr "Geçersiz yazıtipi boyutu."
#~ msgid "Exporting for %s"
#~ msgstr "%s için Dışa Aktarım"
-#~ msgid "Setting Up.."
+#~ msgid "Setting Up..."
#~ msgstr "Kurulum..."
#~ msgid "Error loading scene."
@@ -8384,8 +8438,8 @@ msgstr "Geçersiz yazıtipi boyutu."
#~ msgid "Info"
#~ msgstr "Bilgi"
-#~ msgid "Re-Import.."
-#~ msgstr "Yeniden İçe Aktar.."
+#~ msgid "Re-Import..."
+#~ msgstr "Yeniden İçe Aktar..."
#~ msgid "No bit masks to import!"
#~ msgstr "Alınacak hiç bit örteci yok!"
@@ -8781,14 +8835,14 @@ msgstr "Geçersiz yazıtipi boyutu."
#~ msgid "Zoom (%):"
#~ msgstr "YaklaÅŸ (%):"
-#~ msgid "Skeleton.."
-#~ msgstr "İskelet.."
+#~ msgid "Skeleton..."
+#~ msgstr "İskelet..."
#~ msgid "Zoom Reset"
#~ msgstr "Yakınlaşmayı Sıfırla"
-#~ msgid "Zoom Set.."
-#~ msgstr "Yakınlaşmayı Ayarla.."
+#~ msgid "Zoom Set..."
+#~ msgstr "Yakınlaşmayı Ayarla..."
#~ msgid "Set a Value"
#~ msgstr "Bir DeÄŸer Ata"
@@ -8929,7 +8983,7 @@ msgstr "Geçersiz yazıtipi boyutu."
#~ "Download and install export templates."
#~ msgstr ""
#~ "Hiçbir dışa aktarım kalıbı bulunamadı.\n"
-#~ "Dışa aktarım kalıplarını indirin ve yükleyin.."
+#~ "Dışa aktarım kalıplarını indirin ve yükleyin..."
#~ msgid "Custom debug package not found."
#~ msgstr "Özel kusur ayıklama çıkını bulunmadı."
@@ -9252,8 +9306,8 @@ msgstr "Geçersiz yazıtipi boyutu."
#~ msgid "Export Project PCK"
#~ msgstr "Tasarı PCK Dışa Aktar"
-#~ msgid "Export.."
-#~ msgstr "Dışa Aktar.."
+#~ msgid "Export..."
+#~ msgstr "Dışa Aktar..."
#~ msgid "Project Export"
#~ msgstr "Tasarı Dışa Aktar"
diff --git a/editor/translations/uk.po b/editor/translations/uk.po
index 4b5943bd44..067c7be724 100644
--- a/editor/translations/uk.po
+++ b/editor/translations/uk.po
@@ -2,18 +2,17 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# Aleksandr <XpycT.TOP@gmail.com>, 2017.
+# Yuri Chornoivan <yurchor@ukr.net>, 2018.
# Ðндрій Бандура <andriykopanytsia@gmail.com>, 2018.
# Гидеон Теон <t.kudely94@gmail.com>, 2017.
+# МакÑим Якимчук <xpinovo@gmail.com>, 2018.
# ÐœÐ°Ñ€Ñ Ð¯Ð¼Ð±Ð°Ñ€ <mjambarmeta@gmail.com>, 2017-2018.
# ОлекÑандр Пилипчук <pilipchukap@rambler.ru>, 2018.
-# Yuri Chornoivan <yurchor@ukr.net>, 2018.
-#
msgid ""
msgstr ""
"Project-Id-Version: Ukrainian (Godot Engine)\n"
-"PO-Revision-Date: 2018-01-24 17:51+0000\n"
+"PO-Revision-Date: 2018-06-06 04:03+0000\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/godot-engine/"
"godot/uk/>\n"
@@ -22,7 +21,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 2.19-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -300,11 +299,11 @@ msgstr "МакÑимальна лінійна похибка:"
#: editor/animation_editor.cpp
msgid "Max. Angular Error:"
-msgstr "МакÑ. Кутові похибки:"
+msgstr "МакÑ. кутова похибка:"
#: editor/animation_editor.cpp
msgid "Max Optimizable Angle:"
-msgstr "МакÑимальний оптимізований кут:"
+msgstr "МакÑ. оптимізований кут:"
#: editor/animation_editor.cpp
msgid "Optimize"
@@ -344,7 +343,7 @@ msgstr "ÐžÑ‡Ð¸Ñ‰ÐµÐ½Ð½Ñ Ð²ÑÑ–Ñ… анімації"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation(s) (NO UNDO!)"
-msgstr "ÐžÑ‡Ð¸Ñ‰ÐµÐ½Ð½Ñ Ð°Ð½Ñ–Ð¼Ð°Ñ†Ñ–Ñ—(Ñ–) (не ÑкаÑувати!)"
+msgstr "ОчиÑтити анімацію(Ñ—) (ÐЕ СКÐСУВÐТИ!)"
#: editor/animation_editor.cpp
msgid "Clean-Up"
@@ -491,7 +490,7 @@ msgstr "З'єднати"
#: editor/connections_dialog.cpp
msgid "Connect '%s' to '%s'"
-msgstr "З'Ñ”Ð´Ð½Ð°Ð½Ð½Ñ '%s' Ð´Ð»Ñ %s'"
+msgstr "Приєднати '%s' до %s'"
#: editor/connections_dialog.cpp
msgid "Connecting Signal:"
@@ -502,8 +501,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "Від'єднати '%s' від '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "Приєднати.."
+msgid "Connect..."
+msgstr "Приєднати..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -665,7 +664,7 @@ msgstr "Помилки завантаженнÑ!"
#: editor/dependency_editor.cpp
msgid "Permanently delete %d item(s)? (No undo!)"
-msgstr "ОÑтаточно вилучити %d об'єкти (неможливо ÑкаÑувати)"
+msgstr "ОÑтаточно вилучити %d об'єкт(и)? (Ðеможливо ÑкаÑувати)"
#: editor/dependency_editor.cpp
msgid "Owns"
@@ -705,7 +704,7 @@ msgstr "СпаÑибі від Ñпільноти Godot!"
#: editor/editor_about.cpp
msgid "Thanks!"
-msgstr "ДÑкую!"
+msgstr "ПодÑка!"
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
@@ -775,7 +774,7 @@ msgid ""
"respective copyright statements and license terms."
msgstr ""
"Рушій Godot ÑпираєтьÑÑ Ð½Ð° Ñ€Ñд Ñторонніх безкоштовних Ñ– відкритих бібліотек, "
-"ÑуміÑних з умовами ліцензії mit. Ðижче наводитьÑÑ Ð²Ð¸Ñ‡ÐµÑ€Ð¿Ð½Ð¸Ð¹ ÑпиÑок вÑÑ–Ñ… "
+"ÑуміÑних з умовами ліцензії MIT. Ðижче наводитьÑÑ Ð²Ð¸Ñ‡ÐµÑ€Ð¿Ð½Ð¸Ð¹ ÑпиÑок вÑÑ–Ñ… "
"таких Ñторонніх компонентів з відповідними заÑвами авторÑьких прав Ñ– умов "
"ліцензійної угоди."
@@ -823,7 +822,7 @@ msgstr "Динаміки"
#: editor/editor_audio_buses.cpp
msgid "Add Effect"
-msgstr "Додати ефект"
+msgstr "Ð”Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ ÐµÑ„ÐµÐºÑ‚Ñƒ"
#: editor/editor_audio_buses.cpp
msgid "Rename Audio Bus"
@@ -851,7 +850,7 @@ msgstr "Вибір передачі аудіо шини"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus Effect"
-msgstr "Додати ефект аудіо шини"
+msgstr "Ð”Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ ÐµÑ„ÐµÐºÑ‚Ñƒ аудіо шини"
#: editor/editor_audio_buses.cpp
msgid "Move Bus Effect"
@@ -896,11 +895,11 @@ msgstr "Видалити ефект"
#: editor/editor_audio_buses.cpp
msgid "Audio"
-msgstr "Звук"
+msgstr "Ðудіо"
#: editor/editor_audio_buses.cpp
msgid "Add Audio Bus"
-msgstr "Додати аудіо шину"
+msgstr "Ð”Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ Ð°ÑƒÐ´Ñ–Ð¾ шини"
#: editor/editor_audio_buses.cpp
msgid "Master bus can't be deleted!"
@@ -923,16 +922,16 @@ msgid "Move Audio Bus"
msgstr "ПереміÑтити аудіо шину"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "Зберегти макет аудіо шини Ñк.."
+msgid "Save Audio Bus Layout As..."
+msgstr "Зберегти ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ð°ÑƒÐ´Ñ–Ð¾ шини Ñк..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "Ð Ð¾Ð·Ñ‚Ð°ÑˆÑƒÐ²Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ макета..."
+msgid "Location for New Layout..."
+msgstr "Ð Ð¾Ð·Ñ‚Ð°ÑˆÑƒÐ²Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ компонуваннÑ..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
-msgstr "Відкрити макет аудіо шини"
+msgstr "Відкрити ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ð°ÑƒÐ´Ñ–Ð¾ шини"
#: editor/editor_audio_buses.cpp
msgid "There is no 'res://default_bus_layout.tres' file."
@@ -940,7 +939,7 @@ msgstr "Файл 'res: //default_bus_layout.tres' не знайдено."
#: editor/editor_audio_buses.cpp
msgid "Invalid file, not an audio bus layout."
-msgstr "ÐеприпуÑтимий файл, це не макет аудіо-шини."
+msgstr "ÐеприпуÑтимий файл, це не ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ð°ÑƒÐ´Ñ–Ð¾-шини."
#: editor/editor_audio_buses.cpp
msgid "Add Bus"
@@ -948,7 +947,7 @@ msgstr "Додати шину"
#: editor/editor_audio_buses.cpp
msgid "Create a new Bus Layout."
-msgstr "Ð¡Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ макету шини."
+msgstr "Ð¡Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð½Ð¾Ð²Ð¾Ð³Ð¾ ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ ÑˆÐ¸Ð½Ð¸."
#: editor/editor_audio_buses.cpp editor/property_editor.cpp
#: editor/script_create_dialog.cpp
@@ -957,16 +956,16 @@ msgstr "Завантажити"
#: editor/editor_audio_buses.cpp
msgid "Load an existing Bus Layout."
-msgstr "Ð—Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ñ–Ñнуючого макета шини."
+msgstr "Ð—Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ñ–Ñнуючого ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ ÑˆÐ¸Ð½Ð¸."
#: editor/editor_audio_buses.cpp
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Save As"
-msgstr "Зберегти Як"
+msgstr "Зберегти Ñк"
#: editor/editor_audio_buses.cpp
msgid "Save this Bus Layout to a file."
-msgstr "Зберегти цей макет шини у файлі."
+msgstr "Зберегти це ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ ÑˆÐ¸Ð½Ð¸ у файлі."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
msgid "Load Default"
@@ -974,7 +973,7 @@ msgstr "Завантажити типовий"
#: editor/editor_audio_buses.cpp
msgid "Load the default Bus Layout."
-msgstr "Завантажити типовий макет шини."
+msgstr "Завантажити типове ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ ÑˆÐ¸Ð½Ð¸."
#: editor/editor_autoload_settings.cpp
msgid "Invalid name."
@@ -997,7 +996,7 @@ msgstr ""
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing global constant name."
msgstr ""
-"Ðеправильне ім'Ñ. Ðе повинно збігатиÑÑŒ з іменем Ñ–Ñнуючої глобальної "
+"ÐеприпуÑтиме ім'Ñ. Ðе повинно збігатиÑÑŒ з іменем Ñ–Ñнуючої глобальної "
"конÑтанти."
#: editor/editor_autoload_settings.cpp
@@ -1067,12 +1066,12 @@ msgid "Updating Scene"
msgstr "ÐžÐ½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ñцени"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "Ð—Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ Ð»Ð¾ÐºÐ°Ð»ÑŒÐ½Ð¸Ñ… змін.."
+msgid "Storing local changes..."
+msgstr "Ð—Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ Ð»Ð¾ÐºÐ°Ð»ÑŒÐ½Ð¸Ñ… змін..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "ÐžÐ½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ñцени.."
+msgid "Updating scene..."
+msgstr "ÐžÐ½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ñцени..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1140,8 +1139,8 @@ msgid "Show In File Manager"
msgstr "Показати в файловому менеджері"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "Створити теку.."
+msgid "New Folder..."
+msgstr "Створити теку..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1153,7 +1152,7 @@ msgstr "УÑе розпізнано"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "All Files (*)"
-msgstr "УÑÑ– фали (*)"
+msgstr "УÑÑ– файли (*)"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a File"
@@ -1179,11 +1178,11 @@ msgstr "Зберегти"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Save a File"
-msgstr "Ð—Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ Ñ„Ð°Ð¹Ð»Ñƒ"
+msgstr "Зберегти файл"
#: editor/editor_file_dialog.cpp
msgid "Go Back"
-msgstr "ПовертатиÑÑ"
+msgstr "ПовернутиÑÑ Ð½Ð°Ð·Ð°Ð´"
#: editor/editor_file_dialog.cpp
msgid "Go Forward"
@@ -1211,11 +1210,11 @@ msgstr "ФокуÑувати шлÑÑ…"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Up"
-msgstr "ПереміÑтити обране вгору"
+msgstr "ПереміÑтити вибране вгору"
#: editor/editor_file_dialog.cpp
msgid "Move Favorite Down"
-msgstr "ПереміÑтити обране вниз"
+msgstr "ПереміÑтити вибране вниз"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Go to parent folder"
@@ -1244,7 +1243,7 @@ msgstr "Сканувати Ñирці"
#: editor/editor_file_system.cpp
msgid "(Re)Importing Assets"
-msgstr "(Re)Імпорт активів"
+msgstr "Ð†Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ð°ÐºÑ‚Ð¸Ð²Ñ–Ð²"
#: editor/editor_help.cpp editor/editor_node.cpp
#: editor/plugins/script_editor_plugin.cpp
@@ -1257,7 +1256,7 @@ msgstr "СпиÑок клаÑів:"
#: editor/editor_help.cpp
msgid "Search Classes"
-msgstr "Пошук клаÑу"
+msgstr "Пошук клаÑів"
#: editor/editor_help.cpp editor/plugins/spatial_editor_plugin.cpp
msgid "Top"
@@ -1273,19 +1272,19 @@ msgstr "УÑпадковує:"
#: editor/editor_help.cpp
msgid "Inherited by:"
-msgstr "УÑпадкована:"
+msgstr "УÑпадковано:"
#: editor/editor_help.cpp
msgid "Brief Description:"
-msgstr "Короткий опиÑ:"
+msgstr "СтиÑлий опиÑ:"
#: editor/editor_help.cpp
msgid "Members"
-msgstr "УчаÑники"
+msgstr "Члени"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Members:"
-msgstr "УчаÑники:"
+msgstr "Члени:"
#: editor/editor_help.cpp
msgid "Public Methods"
@@ -1297,11 +1296,11 @@ msgstr "Публічні методи:"
#: editor/editor_help.cpp
msgid "GUI Theme Items"
-msgstr "Елементи графічного інтерфейÑу теми"
+msgstr "Тема елементів ГІК"
#: editor/editor_help.cpp
msgid "GUI Theme Items:"
-msgstr "Елементи графічного інтерфейÑу теми:"
+msgstr "Тема елементів ГІК:"
#: editor/editor_help.cpp modules/visual_script/visual_script_editor.cpp
msgid "Signals:"
@@ -1309,15 +1308,15 @@ msgstr "Сигнали:"
#: editor/editor_help.cpp
msgid "Enumerations"
-msgstr "Перелік"
+msgstr "Перелічуваний"
#: editor/editor_help.cpp
msgid "Enumerations:"
-msgstr "Перелік:"
+msgstr "Перелічуваний:"
#: editor/editor_help.cpp
msgid "enum "
-msgstr "перелік "
+msgstr "перелічуваний "
#: editor/editor_help.cpp
msgid "Constants"
@@ -1367,7 +1366,7 @@ msgstr "Методи"
#: editor/editor_help.cpp
msgid "Method Description:"
-msgstr "ÐžÐ¿Ð¸Ñ Ð¼ÐµÑ‚Ð¾Ð´Ñƒ:"
+msgstr "ÐžÐ¿Ð¸Ñ Ð¼ÐµÑ‚Ð¾Ð´Ñ–Ð²:"
#: editor/editor_help.cpp
msgid ""
@@ -1400,18 +1399,22 @@ msgstr "ОчиÑтити"
msgid "Clear Output"
msgstr "ОчиÑтити вивід"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "Ðе вдалоÑÑ ÐµÐºÑпортувати проект, код помилки — %d."
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "Помилка Ð·Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ Ñ€ÐµÑурÑу!"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "Зберегти реÑÑƒÑ€Ñ Ñк.."
+msgid "Save Resource As..."
+msgstr "Зберегти реÑÑƒÑ€Ñ Ñк..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "Бачу.."
+msgid "I see..."
+msgstr "Бачу..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1491,7 +1494,7 @@ msgstr "Помилка Ð·Ð±ÐµÑ€ÐµÐ¶ÐµÐ½Ð½Ñ Ð½Ð°Ð±Ð¾Ñ€Ñƒ тайлів!"
#: editor/editor_node.cpp
msgid "Error trying to save layout!"
-msgstr "Помилка при Ñпробі зберегти макет!"
+msgstr "Помилка при Ñпробі зберегти компонуваннÑ!"
#: editor/editor_node.cpp
msgid "Default editor layout overridden."
@@ -1499,7 +1502,7 @@ msgstr "Типове ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ñ€ÐµÐ´Ð°ÐºÑ‚Ð¾Ñ€Ð° перевизÐ
#: editor/editor_node.cpp
msgid "Layout name not found!"
-msgstr "Ðазву макета не знайдено!"
+msgstr "Ðазву ÐºÐ¾Ð¼Ð¿Ð¾Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ð½Ðµ знайдено!"
#: editor/editor_node.cpp
msgid "Restored default layout to base settings."
@@ -1511,7 +1514,7 @@ msgid ""
"Please read the documentation relevant to importing scenes to better "
"understand this workflow."
msgstr ""
-"Цей реÑÑƒÑ€Ñ Ð½Ð°Ð»ÐµÐ¶Ð¸Ñ‚ÑŒ до Ñцени, Ñкий було імпортовано, тому не можна "
+"Цей реÑÑƒÑ€Ñ Ð½Ð°Ð»ÐµÐ¶Ð¸Ñ‚ÑŒ до Ñцени, Ñкий було імпортовано, тому його не можна "
"редагувати.\n"
"Будь лаÑка, прочитайте документацію, що ÑтоÑуютьÑÑ Ñ–Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ñцен, щоб "
"краще зрозуміти цей робочий процеÑ."
@@ -1592,7 +1595,7 @@ msgstr "Відкрити у довідці"
#: editor/editor_node.cpp
msgid "There is no defined scene to run."
-msgstr "Ðе Ñ–Ñнує визначеної Ñцени Ð´Ð»Ñ Ð·Ð°Ð¿ÑƒÑку."
+msgstr "Ðемає визначеної Ñцени Ð´Ð»Ñ Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ."
#: editor/editor_node.cpp
msgid ""
@@ -1642,12 +1645,12 @@ msgid "Open Base Scene"
msgstr "Відкрити оÑновну Ñцену"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "Швидке Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ñ‚Ñ Ñцени.."
+msgid "Quick Open Scene..."
+msgstr "Швидке Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ñ‚Ñ Ñцени..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "Швидке Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ñ‚Ñ Ñкрипту.."
+msgid "Quick Open Script..."
+msgstr "Швидке Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ñ‚Ñ Ñкрипту..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1655,11 +1658,11 @@ msgstr "Зберегти та закрити"
#: editor/editor_node.cpp
msgid "Save changes to '%s' before closing?"
-msgstr "Зберегти зміни, внеÑені до '%s ' перед закриттÑм?"
+msgstr "Зберегти зміни, внеÑені до '%s' перед закриттÑм?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Зберегти Ñцени, Ñк..."
+msgid "Save Scene As..."
+msgstr "Зберегти Ñцену Ñк..."
#: editor/editor_node.cpp
msgid "No"
@@ -1710,8 +1713,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "Цю дію не можна ÑкаÑувати. ПовернутиÑÑ Ð² будь-Ñкому випадку?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "Швидкий запуÑк Ñцени.."
+msgid "Quick Run Scene..."
+msgstr "Швидкий запуÑк Ñцени..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1810,11 +1813,11 @@ msgstr "ОчиÑтити недавні Ñцени"
#: editor/editor_node.cpp
msgid "Save Layout"
-msgstr "Зберегти макет"
+msgstr "Зберегти компонуваннÑ"
#: editor/editor_node.cpp
msgid "Delete Layout"
-msgstr "Видалити макет"
+msgstr "Видалити компонуваннÑ"
#: editor/editor_node.cpp editor/import_dock.cpp
#: editor/script_create_dialog.cpp
@@ -1823,7 +1826,7 @@ msgstr "Типовий"
#: editor/editor_node.cpp
msgid "Switch Scene Tab"
-msgstr "Перемкнути вкладку \"Сцена\""
+msgstr "ÐŸÐµÑ€ÐµÐ¼Ð¸ÐºÐ°Ð½Ð½Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ¸ \"Сцена\""
#: editor/editor_node.cpp
msgid "%d more files or folders"
@@ -1870,7 +1873,7 @@ msgid "Previous tab"
msgstr "ÐŸÐ¾Ð¿ÐµÑ€ÐµÐ´Ð½Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr "Фільтрувати файли..."
#: editor/editor_node.cpp
@@ -1882,12 +1885,12 @@ msgid "New Scene"
msgstr "Ðова Ñцена"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Ðова уÑпадкована Ñцена.."
+msgid "New Inherited Scene..."
+msgstr "Ðова уÑпадкована Ñцена..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "Відкрити Ñцену.."
+msgid "Open Scene..."
+msgstr "Відкрити Ñцену..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1906,16 +1909,16 @@ msgid "Open Recent"
msgstr "Відкрити оÑтанні"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "Перетворити на.."
+msgid "Convert To..."
+msgstr "Перетворити на..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "Бібліотека Ñітки.."
+msgid "MeshLibrary..."
+msgstr "Бібліотека Ñітки..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "Ðабір тайлів.."
+msgid "TileSet..."
+msgstr "Ðабір тайлів..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -1925,7 +1928,7 @@ msgstr "СкаÑувати"
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp
msgid "Redo"
-msgstr "Повторити"
+msgstr "Повернути"
#: editor/editor_node.cpp
msgid "Revert Scene"
@@ -1949,7 +1952,7 @@ msgstr "ЗапуÑтити Ñкрипт"
#: editor/editor_node.cpp editor/project_export.cpp
msgid "Export"
-msgstr "ЕкÑпортувати"
+msgstr "ЕкÑпортуваннÑ"
#: editor/editor_node.cpp
msgid "Tools"
@@ -1961,7 +1964,7 @@ msgstr "Вийти в ÑпиÑок проектів"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
msgid "Debug"
-msgstr "ÐалагодженнÑ"
+msgstr "ДіагноÑтика"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
@@ -1996,14 +1999,14 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Visible Collision Shapes"
-msgstr "Видимі форми зіткнень"
+msgstr "Видимі контури зіткнень"
#: editor/editor_node.cpp
msgid ""
"Collision shapes and raycast nodes (for 2D and 3D) will be visible on the "
"running game if this option is turned on."
msgstr ""
-"Форми Ð·Ñ–Ñ‚ÐºÐ½ÐµÐ½Ð½Ñ Ñ‚Ð° вузли raycast (Ð´Ð»Ñ 2D та 3D) будуть видно в роботі гри, "
+"Контури Ð·Ñ–Ñ‚ÐºÐ½ÐµÐ½Ð½Ñ Ñ‚Ð° вузли raycast (Ð´Ð»Ñ 2D та 3D) буде видно в роботі гри, "
"Ñкщо Ñ†Ñ Ð¾Ð¿Ñ†Ñ–Ñ ÑƒÐ²Ñ–Ð¼ÐºÐ½ÐµÐ½Ð°."
#: editor/editor_node.cpp
@@ -2031,8 +2034,8 @@ msgid ""
msgstr ""
"Якщо цей параметр увімкнено, будь-Ñкі зміни, внеÑені в Ñцену в редакторі, "
"будуть відтворені в роботі гри.\n"
-"Коли він викориÑтовуєтьÑÑ Ð²Ñ–Ð´Ð´Ð°Ð»ÐµÐ½Ð¾ на приÑтрої, це більш ефективно з "
-"мережевою файловою ÑиÑтемою."
+"При віддаленому викориÑтанні на приÑтрої, це більш ефективно з мережевою "
+"файловою ÑиÑтемою."
#: editor/editor_node.cpp
msgid "Sync Script Changes"
@@ -2047,8 +2050,8 @@ msgid ""
msgstr ""
"Якщо цей параметр увімкнено, будь-Ñкий Ñкрипт, Ñкий буде збережений, буде "
"перезавантажений у поточній грі.\n"
-"Коли він викориÑтовуєтьÑÑ Ð²Ñ–Ð´Ð´Ð°Ð»ÐµÐ½Ð¾ на приÑтрої, це більш ефективно з "
-"мережевою файловою ÑиÑтемою."
+"При віддаленому викориÑтанні на приÑтрої, це більш ефективно з мережевою "
+"файловою ÑиÑтемою."
#: editor/editor_node.cpp
msgid "Editor"
@@ -2060,7 +2063,7 @@ msgstr "Параметри редактора"
#: editor/editor_node.cpp
msgid "Editor Layout"
-msgstr "Редактор макетів"
+msgstr "Редактор компонуваннÑ"
#: editor/editor_node.cpp
msgid "Toggle Fullscreen"
@@ -2155,7 +2158,7 @@ msgstr "Завжди оновлювати"
#: editor/editor_node.cpp
msgid "Update Changes"
-msgstr "Оновити зміни"
+msgstr "Оновлювати зміни"
#: editor/editor_node.cpp
msgid "Disable Update Spinner"
@@ -2178,7 +2181,7 @@ msgid "Save the currently edited resource."
msgstr "Зберегти поточний редагований реÑурÑ."
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr "Зберегти Ñк..."
#: editor/editor_node.cpp
@@ -2252,7 +2255,7 @@ msgstr "Ðовий уÑпадкований"
#: editor/editor_node.cpp
msgid "Load Errors"
-msgstr "Завантажити помилки"
+msgstr "Помилки завантаженнÑ"
#: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp
msgid "Select"
@@ -2287,12 +2290,12 @@ msgid "Creating Mesh Previews"
msgstr "Ð¡Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð¿Ð¾Ð¿ÐµÑ€ÐµÐ´Ð½ÑŒÐ¾Ð³Ð¾ переглÑду Ñітки"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "Мініатюра.."
+msgid "Thumbnail..."
+msgstr "Мініатюра..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
-msgstr "Ð’Ñтановлені плагіни:"
+msgstr "Ð’Ñтановлені плаґіни:"
#: editor/editor_plugin_settings.cpp
msgid "Update"
@@ -2337,7 +2340,7 @@ msgstr "Кадр %"
#: editor/editor_profiler.cpp
msgid "Physics Frame %"
-msgstr "Фізика кадрів %"
+msgstr "Фізичний кадр %"
#: editor/editor_profiler.cpp editor/script_editor_debugger.cpp
msgid "Time:"
@@ -2381,7 +2384,7 @@ msgstr "Ðапишіть Ñвою логіку в методі _run ()."
#: editor/editor_run_script.cpp
msgid "There is an edited scene already."
-msgstr "Є вже редагована Ñцена."
+msgstr "Редагована Ñцена вже Ñ–Ñнує."
#: editor/editor_run_script.cpp
msgid "Couldn't instance script:"
@@ -2389,7 +2392,7 @@ msgstr "Ðеможливо Ñтворити екземплÑÑ€ Ñкрипту:"
#: editor/editor_run_script.cpp
msgid "Did you forget the 'tool' keyword?"
-msgstr "Ви забули ключове Ñлово \"інÑтрумент\"?"
+msgstr "Ви забули ключове Ñлово 'tool'?"
#: editor/editor_run_script.cpp
msgid "Couldn't run script:"
@@ -2397,7 +2400,7 @@ msgstr "Ðе вдалоÑÑ Ð·Ð°Ð¿ÑƒÑтити Ñкрипт:"
#: editor/editor_run_script.cpp
msgid "Did you forget the '_run' method?"
-msgstr "Ви забули метод \"_run\"?"
+msgstr "Ви забули метод '_run'?"
#: editor/editor_settings.cpp
msgid "Default (Same as Editor)"
@@ -2440,12 +2443,12 @@ msgid "(Current)"
msgstr "(Поточний)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "ÐžÑ‚Ñ€Ð¸Ð¼Ð°Ð½Ð½Ñ Ð´Ð·ÐµÑ€ÐºÐ°Ð», будь лаÑка, зачекайте.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "ÐžÑ‚Ñ€Ð¸Ð¼Ð°Ð½Ð½Ñ Ð´Ð·ÐµÑ€ÐºÐ°Ð», будь лаÑка, зачекайте..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
-msgstr "Видалити верÑÑ–ÑŽ шаблону '%s'?"
+msgstr "Видалити верÑÑ–ÑŽ шаблону '%s'?"
#: editor/export_template_manager.cpp
msgid "Can't open export templates zip."
@@ -2456,14 +2459,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "Ðеправильний формат version.txt у шаблонах."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-"Ðеправильний формат version.txt у шаблонах. Ідентифікатор ревізії не Ñ” "
-"дійÑним."
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "Файл version.txt не знайдено у шаблонах."
@@ -2473,7 +2468,7 @@ msgstr "Помилка ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ ÑˆÐ»Ñху Ð´Ð»Ñ ÑˆÐ°Ð±Ð»Ð¾Ð½Ñ–Ð²:"
#: editor/export_template_manager.cpp
msgid "Extracting Export Templates"
-msgstr "ВитÑг шаблонів екÑпорту"
+msgstr "Ð Ð¾Ð·Ð¿Ð°ÐºÑƒÐ²Ð°Ð½Ð½Ñ ÑˆÐ°Ð±Ð»Ð¾Ð½Ñ–Ð² екÑпорту"
#: editor/export_template_manager.cpp
msgid "Importing:"
@@ -2484,8 +2479,8 @@ msgid ""
"No download links found for this version. Direct download is only available "
"for official releases."
msgstr ""
-"Ðемає поÑилань на Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ð´Ð»Ñ Ñ†Ñ–Ñ”Ñ— верÑÑ–Ñ—. ПрÑме Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ð´Ð¾Ñтупне "
-"лише Ð´Ð»Ñ Ð¾Ñ„Ñ–Ñ†Ñ–Ð¹Ð½Ð¸Ñ… випуÑків."
+"Ðе знайдено поÑилань Ð´Ð»Ñ Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ñ†Ñ–Ñ”Ñ— верÑÑ–Ñ—. ПрÑме Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ "
+"доÑтупне лише Ð´Ð»Ñ Ð¾Ñ„Ñ–Ñ†Ñ–Ð¹Ð½Ð¸Ñ… випуÑків."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2526,8 +2521,8 @@ msgid "Error requesting url: "
msgstr "Помилка запиту url: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "ÐŸÑ–Ð´ÐºÐ»ÑŽÑ‡ÐµÐ½Ð½Ñ Ð´Ð¾ дзеркала.."
+msgid "Connecting to Mirror..."
+msgstr "ÐŸÑ–Ð´ÐºÐ»ÑŽÑ‡ÐµÐ½Ð½Ñ Ð´Ð¾ дзеркала..."
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2543,8 +2538,8 @@ msgstr "Ðе вдаєтьÑÑ Ð²Ð¸Ñ€Ñ–ÑˆÐ¸Ñ‚Ð¸"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "З’єднаннÑ.."
+msgid "Connecting..."
+msgstr "З’єднаннÑ..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2556,7 +2551,7 @@ msgstr "З’єднано"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "Запит..."
#: editor/export_template_manager.cpp
@@ -2569,7 +2564,7 @@ msgstr "Помилка з'єднаннÑ"
#: editor/export_template_manager.cpp
msgid "SSL Handshake Error"
-msgstr "Помилка SSL Handshake"
+msgstr "Помилка SSL РукоÑтиÑканнÑ"
#: editor/export_template_manager.cpp
msgid "Current Version:"
@@ -2589,7 +2584,7 @@ msgstr "Видалити шаблон"
#: editor/export_template_manager.cpp
msgid "Select template file"
-msgstr "Виберіть файл шаблону"
+msgstr "Вибрати файл шаблону"
#: editor/export_template_manager.cpp
msgid "Export Template Manager"
@@ -2606,18 +2601,17 @@ msgstr "Виберіть дзеркало зі ÑпиÑку: "
#: editor/file_type_cache.cpp
msgid "Can't open file_type_cache.cch for writing, not saving file type cache!"
msgstr ""
-"Ðе вдаєтьÑÑ Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ð¸ файл file_type_cache.cch Ð´Ð»Ñ Ð½Ð°Ð¿Ð¸ÑаннÑ, кеш тип файлу "
-"не буде збережений!"
+"Ðе вдаєтьÑÑ Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ð¸ file_type_cache.cch Ð´Ð»Ñ Ð·Ð°Ð¿Ð¸Ñу, не буде збережений файл "
+"тип кешу!"
#: editor/filesystem_dock.cpp
msgid "Cannot navigate to '%s' as it has not been found in the file system!"
msgstr ""
-"Ðеможливо перейти до \"'%s' , оÑкільки він не був знайдений в файлової "
-"ÑиÑтемі!"
+"Ðеможливо перейти до '%s' , оÑкільки він не був знайдений в файловій ÑиÑтемі!"
#: editor/filesystem_dock.cpp
msgid "View items as a grid of thumbnails"
-msgstr "ПереглÑд елементів у виглÑді Ñітки еÑкізів"
+msgstr "ПереглÑд елементів у виглÑді Ñітки мініатюр"
#: editor/filesystem_dock.cpp
msgid "View items as a list"
@@ -2626,8 +2620,8 @@ msgstr "ПереглÑд елементів Ñк ÑпиÑок"
#: editor/filesystem_dock.cpp
msgid "Status: Import of file failed. Please fix file and reimport manually."
msgstr ""
-"СтатуÑ: не вдалоÑÑ Ñ–Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ñ‚Ð¸ файл. Виправте файл та повторно імпортуйте "
-"вручну."
+"СтатуÑ: не вдалоÑÑ Ñ–Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ñ‚Ð¸ файл. Будь лаÑка, виправте файл та повторно "
+"імпортуйте вручну."
#: editor/filesystem_dock.cpp
msgid "Cannot move/rename resources root."
@@ -2687,18 +2681,18 @@ msgstr "Ð”ÑƒÐ±Ð»ÑŽÐ²Ð°Ð½Ð½Ñ Ñ‚ÐµÐºÐ¸:"
#: editor/filesystem_dock.cpp
msgid "Expand all"
-msgstr "Розгорнути вÑÑ–"
+msgstr "Розгорнути вÑе"
#: editor/filesystem_dock.cpp
msgid "Collapse all"
-msgstr "Згорнути вÑÑ–"
+msgstr "Згорнути вÑе"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "Перейменувати..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "ПереміÑтити до..."
#: editor/filesystem_dock.cpp
@@ -2710,16 +2704,16 @@ msgid "Instance"
msgstr "ЕкземплÑÑ€"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Редагувати залежноÑті.."
+msgid "Edit Dependencies..."
+msgstr "Редагувати залежноÑті..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "ПереглÑнути влаÑників.."
+msgid "View Owners..."
+msgstr "ПереглÑнути влаÑників..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "Дублювати.."
+msgid "Duplicate..."
+msgstr "Дублювати..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2731,20 +2725,20 @@ msgstr "ÐаÑтупний каталог"
#: editor/filesystem_dock.cpp
msgid "Re-Scan Filesystem"
-msgstr "Повторне ÑÐºÐ°Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ñ„Ð°Ð¹Ð»Ð¾Ð²Ð¾Ñ— ÑиÑтеми"
+msgstr "ПереÑÐºÐ°Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ñ„Ð°Ð¹Ð»Ð¾Ð²Ð¾Ñ— ÑиÑтеми"
#: editor/filesystem_dock.cpp
msgid "Toggle folder status as Favorite"
-msgstr "Переключити ÑÑ‚Ð°Ñ‚ÑƒÑ Ñ‚ÐµÐºÐ¸ у вибране"
+msgstr "Переключити ÑÑ‚Ð°Ñ‚ÑƒÑ Ñ‚ÐµÐºÐ¸ Ñк обране"
#: editor/filesystem_dock.cpp
msgid "Instance the selected scene(s) as child of the selected node."
-msgstr "Додати обрану Ñцену(и), Ñк нащадка обраного вузла."
+msgstr "Додати вибрану Ñцену(и), Ñк нащадка вибраного вузла."
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Ð¡ÐºÐ°Ð½ÑƒÐ²Ð°Ð½Ð½Ñ Ñ„Ð°Ð¹Ð»Ñ–Ð²,\n"
"будь лаÑка, зачекайте..."
@@ -2812,8 +2806,8 @@ msgid "Import Scene"
msgstr "Імпортувати Ñцену"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "Ð†Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ñцени.."
+msgid "Importing Scene..."
+msgstr "Ð†Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ñцени..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2824,8 +2818,8 @@ msgid "Generating for Mesh: "
msgstr "Ð¡Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð´Ð»Ñ Ñітки: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "ЗапуÑк кориÑтувацького Ñкрипту.."
+msgid "Running Custom Script..."
+msgstr "ЗапуÑк кориÑтувацького Ñкрипту..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2840,16 +2834,16 @@ msgid "Error running post-import script:"
msgstr "Помилка запуÑку піÑÐ»Ñ Ñ–Ð¼Ð¿Ð¾Ñ€Ñ‚Ñƒ Ñкрипту:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "ЗбереженнÑ..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
-msgstr "Ð’Ñтановити за замовчуваннÑм Ð´Ð»Ñ \"%s\""
+msgstr "Ð’Ñтановити Ñк типове Ð´Ð»Ñ '%s'"
#: editor/import_dock.cpp
msgid "Clear Default for '%s'"
-msgstr "ОчиÑтити за замовчуваннÑм Ð´Ð»Ñ '%s'"
+msgstr "ОчиÑтити типове Ð´Ð»Ñ '%s'"
#: editor/import_dock.cpp
msgid " Files"
@@ -2860,12 +2854,12 @@ msgid "Import As:"
msgstr "Імпортувати Ñк:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "Заздалегідь уÑтановлений.."
+msgid "Preset..."
+msgstr "Заздалегідь уÑтановлений..."
#: editor/import_dock.cpp
msgid "Reimport"
-msgstr "Переімпортивути"
+msgstr "Переімпортувати"
#: editor/multi_node_edit.cpp
msgid "MultiNode Set"
@@ -2938,7 +2932,7 @@ msgstr "Ðова анімаціÑ"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Change Animation Name:"
-msgstr "Змініть ім'Ñ Ð°Ð½Ñ–Ð¼Ð°Ñ†Ñ–Ñ—:"
+msgstr "Змінити ім'Ñ Ð°Ð½Ñ–Ð¼Ð°Ñ†Ñ–Ñ—:"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Delete Animation?"
@@ -2985,7 +2979,7 @@ msgstr "Дублювати анімацію"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation to copy!"
-msgstr "ПОМИЛКÐ: Ðемає копії анімації!"
+msgstr "ПОМИЛКÐ: Ðемає анімації Ð´Ð»Ñ ÐºÐ¾Ð¿Ñ–ÑŽÐ²Ð°Ð½Ð½Ñ!"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "ERROR: No animation resource on clipboard!"
@@ -3034,7 +3028,7 @@ msgstr "Шкала Ð²Ñ–Ð´Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð³Ð»Ð¾Ð±Ð°Ð»ÑŒÐ½Ð¾ анімації д
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Create new animation in player."
-msgstr "Створювати нові анімації у програвачі."
+msgstr "Створити нову анімацію у програвачі."
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Load animation from disk."
@@ -3279,15 +3273,15 @@ msgid "Transition Node"
msgstr "Вузол переходу"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "Імпортувати анімації.."
+msgid "Import Animations..."
+msgstr "Імпортувати анімації..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "Редагувати фільтри вузла"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr "Фільтри..."
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3355,7 +3349,7 @@ msgid "Fetching:"
msgstr "ВидобуваннÑ:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr "ВирішеннÑ..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3402,7 +3396,7 @@ msgstr "Ð’Ñе"
#: editor/plugins/asset_library_editor_plugin.cpp
#: editor/project_settings_editor.cpp
msgid "Plugins"
-msgstr "Плагіни"
+msgstr "Плаґіни"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Sort:"
@@ -3422,7 +3416,7 @@ msgid "Site:"
msgstr "Сайт:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr "Підтримка..."
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3620,6 +3614,7 @@ msgid "Use Rotation Snap"
msgstr "ВикориÑÑ‚Ð°Ð½Ð½Ñ Ð¾Ð±ÐµÑ€Ñ‚Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¸Ð²'Ñзки"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr "ÐÐ°Ð»Ð°ÑˆÑ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ð¿Ñ€Ð¸Ð²'Ñзки..."
@@ -3716,6 +3711,14 @@ msgid "Show Guides"
msgstr "Показати напрÑмні"
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "Показати центр"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "Показати панель переглÑду"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr "Центрувати на вибраному"
@@ -4006,6 +4009,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Сітка не має поверхні, щоб Ñтворити контури!"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "Типом Ñітки примітива не Ñ” PRIMITIVE_TRIANGLES!"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "Ðе вдалоÑÑ Ñтворити контур!"
@@ -4034,8 +4041,8 @@ msgid "Create Convex Collision Sibling"
msgstr "Створити опуклу облаÑть зіткненнÑ"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "Створити контурну Ñітку .."
+msgid "Create Outline Mesh..."
+msgstr "Створити контурну Ñітку ..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4240,8 +4247,8 @@ msgid "Error loading image:"
msgstr "Помилка Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ Ð·Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð½Ñ:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "Ð’ зображенні немає пікÑелів з прозоріÑтю > 128.."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "Ð’ зображенні немає пікÑелів з прозоріÑтю > 128..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4601,7 +4608,7 @@ msgid "Import Theme"
msgstr "Імпортувати тему"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr "Зберегти тему Ñк..."
#: editor/plugins/script_editor_plugin.cpp
@@ -4698,8 +4705,8 @@ msgstr "Перемкнути панель Ñценаріїв"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "Знайти.."
+msgid "Find..."
+msgstr "Знайти..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4824,7 +4831,7 @@ msgstr "Копіювати"
#: editor/plugins/script_text_editor.cpp scene/gui/line_edit.cpp
#: scene/gui/text_edit.cpp
msgid "Select All"
-msgstr "Вибрати вÑе"
+msgstr "Виділити вÑе"
#: editor/plugins/script_text_editor.cpp
msgid "Delete Line"
@@ -4908,16 +4915,16 @@ msgid "Find Previous"
msgstr "Знайти попереднє"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "Замінити.."
+msgid "Replace..."
+msgstr "Замінити..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "Перейти до функції.."
+msgid "Goto Function..."
+msgstr "Перейти до функції..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "Перейти до Ñ€Ñдка.."
+msgid "Goto Line..."
+msgstr "Перейти до Ñ€Ñдка..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5370,11 +5377,7 @@ msgid "Transform"
msgstr "ПеретвореннÑ"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "Ðалаштувати прилипаннÑ..."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr "Вікно перетвореннÑ..."
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5627,7 +5630,7 @@ msgid "Remove All"
msgstr "Вилучити уÑÑ–"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr "Редагувати тему..."
#: editor/plugins/theme_editor_plugin.cpp
@@ -5675,6 +5678,14 @@ msgid "Checked Item"
msgstr "Позначений елемент"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "Пункт варіанта"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "Позначений пункт варіанта"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "Має"
@@ -5684,11 +5695,11 @@ msgstr "Багато"
#: editor/plugins/theme_editor_plugin.cpp editor/project_export.cpp
msgid "Options"
-msgstr "Параметрів"
+msgstr "Параметри"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "Має,Багато,Декілька,Параметрів!"
+msgid "Has,Many,Options"
+msgstr "Має,Багато,Параметрів"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5880,7 +5891,7 @@ msgid "Presets"
msgstr "Ðабори"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "Додати..."
#: editor/project_export.cpp
@@ -5975,6 +5986,10 @@ msgid "Imported Project"
msgstr "Імпортований проект"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "Ðекоректна назва проекту."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "Ðеможливо Ñтворити теку."
@@ -5991,11 +6006,12 @@ msgid "Invalid project path (changed anything?)."
msgstr "Ðекоректний шлÑÑ… до проекту (щоÑÑŒ змінилоÑÑ?)."
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "Ðе вдалоÑÑ Ñ€ÐµÐ´Ð°Ð³ÑƒÐ²Ð°Ñ‚Ð¸ project.godot у каталозі проекту."
+msgstr ""
+"Ðе вдалоÑÑ Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶Ð¸Ñ‚Ð¸ project.godot у каталозі проекту (помилка %d). "
+"Можливо, файл вилучено або пошкоджено."
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6173,8 +6189,12 @@ msgid "Mouse Button"
msgstr "Кнопка миші"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Ðекоректна Ð´Ñ–Ñ (можна уÑе, окрім «/» або «:»)."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr ""
+"Ðекоректна назва дії. Ðазва не може бути порожньою Ñ– не може міÑтити "
+"Ñимволів «/», «:», «=», «\\» та «\"»."
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6201,7 +6221,7 @@ msgid "Control+"
msgstr "Ctrl+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr "ÐатиÑніть клавішу,..."
#: editor/project_settings_editor.cpp
@@ -6317,10 +6337,6 @@ msgid "Delete Item"
msgstr "Вилучити елемент"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "Ðе може міÑтити «/» або «:»"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "Вже Ñ–Ñнує"
@@ -6382,14 +6398,14 @@ msgstr "Параметри проекту (project.godot)"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr "Загальне"
+msgstr "\"Загальне\""
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr "ВлаÑтивіÑть:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "Перевизначити на..."
#: editor/project_settings_editor.cpp
@@ -6434,19 +6450,19 @@ msgstr "ПереÑпрÑÐ¼ÑƒÐ²Ð°Ð½Ð½Ñ Ð·Ð° локаллю:"
#: editor/project_settings_editor.cpp
msgid "Locale"
-msgstr "Локаль"
+msgstr "Мова"
#: editor/project_settings_editor.cpp
msgid "Locales Filter"
-msgstr "Фільтр локалей"
+msgstr "Фільтр локалізацій"
#: editor/project_settings_editor.cpp
msgid "Show all locales"
-msgstr "Показати уÑÑ– локалі"
+msgstr "Показати уÑÑ– локалізації"
#: editor/project_settings_editor.cpp
msgid "Show only selected locales"
-msgstr "Показати лише позначені локалі"
+msgstr "Показати лише позначені локалізації"
#: editor/project_settings_editor.cpp
msgid "Filter mode:"
@@ -6454,7 +6470,7 @@ msgstr "Режим фільтруваннÑ:"
#: editor/project_settings_editor.cpp
msgid "Locales:"
-msgstr "Локалі:"
+msgstr "Мови:"
#: editor/project_settings_editor.cpp
msgid "AutoLoad"
@@ -6485,11 +6501,11 @@ msgid "Easing Out-In"
msgstr "Перейти з-у"
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr "Файл..."
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr "Каталог..."
#: editor/property_editor.cpp
@@ -6546,7 +6562,7 @@ msgstr "[Порожньо]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
-msgstr "Ð’Ñтановити"
+msgstr "Множина"
#: editor/property_editor.cpp
msgid "Properties:"
@@ -6663,7 +6679,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr "Цю дію не можна виконувати над Ñценами з екземплÑрами."
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr "Зберегти нову Ñцену Ñк..."
#: editor/scene_tree_dock.cpp
@@ -7264,18 +7280,16 @@ msgid "Object can't provide a length."
msgstr "Об'єкт не може надавати довжину."
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "ÐаÑтупна вкладка"
+msgstr "ÐаÑтупна площина"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "ÐŸÐ¾Ð¿ÐµÑ€ÐµÐ´Ð½Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
+msgstr "ÐŸÐ¾Ð¿ÐµÑ€ÐµÐ´Ð½Ñ Ð¿Ð»Ð¾Ñ‰Ð¸Ð½Ð°"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "Площина:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7381,6 +7395,10 @@ msgstr "Параметри GridMap"
msgid "Pick Distance:"
msgstr "ВідÑтань вибору:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "Ðазвою клаÑу не може бути зарезервоване ключове Ñлово"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr "Ð¡Ñ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ñ€Ð¾Ð·Ð²'Ñзку..."
@@ -7411,7 +7429,7 @@ msgstr "Моно"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "Про підтримку C#"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7429,6 +7447,10 @@ msgstr "Зібрати проект"
msgid "Warnings"
msgstr "ПопередженнÑ"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "Кінець траÑÑƒÐ²Ð°Ð½Ð½Ñ Ñтека Ð´Ð»Ñ Ð²Ð½ÑƒÑ‚Ñ€Ñ–ÑˆÐ½ÑŒÐ¾Ð³Ð¾ виключеннÑ"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7981,11 +8003,11 @@ msgstr "ARVROrigin повинен мати дочірній вузол ARVRCamer
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(ЛишилоÑÑ Ñ‡Ð°Ñу: %d:%02d Ñ)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -8087,12 +8109,25 @@ msgstr ""
"коректний вузол Spatial."
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment потребує реÑурÑу Environment."
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
"У Ñцені (або наборі екземплÑрів Ñцен) може бути лише один елемент "
"WorldEnvironment."
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"Цей Ð·Ð°Ð¿Ð¸Ñ WorldEnvironment проігноровано. Ðбо додайте Ð·Ð°Ð¿Ð¸Ñ Camera (Ð´Ð»Ñ "
+"проÑторових Ñцен) або вÑтановіть Ð´Ð»Ñ Background Mode цього Ñередовища "
+"Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Canvas (Ð´Ð»Ñ Ð´Ð²Ð¾Ð²Ð¸Ð¼Ñ–Ñ€Ð½Ð¸Ñ… Ñцен)."
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8190,6 +8225,26 @@ msgstr "Помилка Ð·Ð°Ð²Ð°Ð½Ñ‚Ð°Ð¶ÐµÐ½Ð½Ñ ÑˆÑ€Ð¸Ñ„Ñ‚Ñƒ."
msgid "Invalid font size."
msgstr "Ðекоректний розмір шрифту."
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "ÐŸÐ¾Ð¿ÐµÑ€ÐµÐ´Ð½Ñ Ð²ÐºÐ»Ð°Ð´ÐºÐ°"
+
+#~ msgid "Next"
+#~ msgstr "Далі"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Ðекоректна Ð´Ñ–Ñ (можна уÑе, окрім «/» або «:»)."
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "Ðе може міÑтити «/» або «:»"
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr ""
+#~ "Ðеправильний формат version.txt у шаблонах. Ідентифікатор ревізії не Ñ” "
+#~ "дійÑним."
+
#~ msgid "Can't write file."
#~ msgstr "Ðе вдалоÑÑ Ð·Ð°Ð¿Ð¸Ñати файл."
@@ -8203,9 +8258,6 @@ msgstr "Ðекоректний розмір шрифту."
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "Ðе вдалоÑÑ Ð¾Ñ‚Ñ€Ð¸Ð¼Ð°Ñ‚Ð¸ project.godot у каталозі проекту."
-#~ msgid "Next"
-#~ msgstr "Далі"
-
#~ msgid "Not found!"
#~ msgstr "Ðе знайдено!"
diff --git a/editor/translations/ur_PK.po b/editor/translations/ur_PK.po
index 556701f7d9..0162eb0788 100644
--- a/editor/translations/ur_PK.po
+++ b/editor/translations/ur_PK.po
@@ -495,7 +495,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -909,11 +909,11 @@ msgid "Move Audio Bus"
msgstr "ایکشن منتقل کریں"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1051,11 +1051,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1124,7 +1124,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1382,17 +1382,21 @@ msgstr ""
msgid "Clear Output"
msgstr "سب سکریپشن بنائیں"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1597,11 +1601,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1613,7 +1617,7 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr ""
#: editor/editor_node.cpp
@@ -1665,7 +1669,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1811,7 +1815,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1823,11 +1827,11 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1847,15 +1851,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2100,7 +2104,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2210,7 +2214,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2361,7 +2365,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2377,12 +2381,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2443,7 +2441,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2460,7 +2458,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2473,7 +2471,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2607,11 +2605,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2623,15 +2621,15 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2657,7 +2655,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2723,7 +2721,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2735,7 +2733,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2751,7 +2749,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2771,7 +2769,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3187,7 +3185,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3195,7 +3193,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3263,7 +3261,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3330,7 +3328,7 @@ msgid "Site:"
msgstr "سائٹ:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ".سپورٹ"
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3521,6 +3519,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3617,6 +3616,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3906,6 +3913,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3934,7 +3945,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4139,7 +4150,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4504,7 +4515,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4602,7 +4613,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4808,15 +4819,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5270,11 +5281,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5531,7 +5538,7 @@ msgid "Remove All"
msgstr ".تمام کا انتخاب"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5579,6 +5586,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5591,7 +5606,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5780,7 +5795,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5870,6 +5885,10 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr ""
+
+#: editor/project_manager.cpp
#, fuzzy
msgid "Couldn't create folder."
msgstr "سب سکریپشن بنائیں"
@@ -6059,7 +6078,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6087,7 +6108,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6204,10 +6225,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6276,7 +6293,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6372,11 +6389,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6548,7 +6565,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7261,6 +7278,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7310,6 +7331,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7899,10 +7924,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
diff --git a/editor/translations/vi.po b/editor/translations/vi.po
index 8ca55c778b..6651bd170c 100644
--- a/editor/translations/vi.po
+++ b/editor/translations/vi.po
@@ -3,6 +3,7 @@
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
#
+# 01lifeleft <01lifeleft@gmail.com>, 2018.
# Dlean Jeans <dleanjeans@gmail.com>, 2018.
# Hai Le <dark.hades.1102@gmail.com>, 2017.
# Nguyễn Tuấn Anh <anhnt.fami@gmail.com>, 2017.
@@ -11,15 +12,15 @@
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2018-01-24 12:35+0000\n"
-"Last-Translator: Dlean Jeans <dleanjeans@gmail.com>\n"
+"PO-Revision-Date: 2018-04-18 15:44+0000\n"
+"Last-Translator: 01lifeleft <01lifeleft@gmail.com>\n"
"Language-Team: Vietnamese <https://hosted.weblate.org/projects/godot-engine/"
"godot/vi/>\n"
"Language: vi\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 2.19-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -79,7 +80,7 @@ msgstr "Äổi tên Anim Track"
#: editor/animation_editor.cpp
msgid "Anim Track Change Interpolation"
-msgstr ""
+msgstr "Äổi phép ná»™i suy Anim Track"
#: editor/animation_editor.cpp
msgid "Anim Track Change Value Mode"
@@ -112,31 +113,31 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Remove Selection"
-msgstr ""
+msgstr "Bá» lá»±a chá»n"
#: editor/animation_editor.cpp
msgid "Continuous"
-msgstr ""
+msgstr "Liên tục"
#: editor/animation_editor.cpp
msgid "Discrete"
-msgstr ""
+msgstr "Äứt Ä‘oạn"
#: editor/animation_editor.cpp
msgid "Trigger"
-msgstr ""
+msgstr "Kích hoạt"
#: editor/animation_editor.cpp
msgid "Anim Add Key"
-msgstr ""
+msgstr "Thêm Key Anim"
#: editor/animation_editor.cpp
msgid "Anim Move Keys"
-msgstr ""
+msgstr "Di chuyển các Key Anim"
#: editor/animation_editor.cpp
msgid "Scale Selection"
-msgstr ""
+msgstr "Chá»n Scale"
#: editor/animation_editor.cpp
msgid "Scale From Cursor"
@@ -165,15 +166,15 @@ msgstr "Trong"
#: editor/animation_editor.cpp
msgid "Out"
-msgstr ""
+msgstr "Ngoài"
#: editor/animation_editor.cpp
msgid "In-Out"
-msgstr ""
+msgstr "Trong-Ngoài"
#: editor/animation_editor.cpp
msgid "Out-In"
-msgstr ""
+msgstr "Ngoài-Trong"
#: editor/animation_editor.cpp
msgid "Transitions"
@@ -185,7 +186,7 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Clean-Up Animation"
-msgstr ""
+msgstr "Dá»n dẹp Animation"
#: editor/animation_editor.cpp
msgid "Create NEW track for %s and insert key?"
@@ -205,7 +206,7 @@ msgstr "Tạo"
#: editor/animation_editor.cpp
msgid "Anim Create & Insert"
-msgstr ""
+msgstr "Tạo & Chèn Anim"
#: editor/animation_editor.cpp
msgid "Anim Insert Track & Key"
@@ -221,7 +222,7 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
-msgstr ""
+msgstr "Äổi vòng lặp Anim"
#: editor/animation_editor.cpp
msgid "Anim Create Typed Value Key"
@@ -229,7 +230,7 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr ""
+msgstr "Chèn Anim"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
@@ -249,7 +250,7 @@ msgstr "Äá»™ dài (giây):"
#: editor/animation_editor.cpp
msgid "Animation length (in seconds)."
-msgstr ""
+msgstr "Äá»™ dài Animation (giây)."
#: editor/animation_editor.cpp
msgid "Step (s):"
@@ -261,7 +262,7 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Enable/Disable looping in animation."
-msgstr ""
+msgstr "Mở/Tắt lặp animation."
#: editor/animation_editor.cpp
msgid "Add new tracks."
@@ -497,7 +498,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr ""
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr ""
#: editor/connections_dialog.cpp
@@ -907,11 +908,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1047,11 +1048,11 @@ msgid "Updating Scene"
msgstr ""
#: editor/editor_data.cpp
-msgid "Storing local changes.."
+msgid "Storing local changes..."
msgstr ""
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr ""
#: editor/editor_data.cpp
@@ -1120,7 +1121,7 @@ msgid "Show In File Manager"
msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
+msgid "New Folder..."
msgstr ""
#: editor/editor_file_dialog.cpp
@@ -1373,17 +1374,21 @@ msgstr ""
msgid "Clear Output"
msgstr ""
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr ""
#: editor/editor_node.cpp
@@ -1588,11 +1593,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1604,8 +1609,8 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "Lưu Scene với tên.."
+msgid "Save Scene As..."
+msgstr "Lưu Scene với tên..."
#: editor/editor_node.cpp
msgid "No"
@@ -1656,7 +1661,7 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
+msgid "Quick Run Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1803,7 +1808,7 @@ msgid "Previous tab"
msgstr ""
#: editor/editor_node.cpp
-msgid "Filter Files.."
+msgid "Filter Files..."
msgstr ""
#: editor/editor_node.cpp
@@ -1815,11 +1820,11 @@ msgid "New Scene"
msgstr "Tạo Scene Mới"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "Tạo Scene Con.."
+msgid "New Inherited Scene..."
+msgstr "Tạo Scene Con..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr ""
#: editor/editor_node.cpp
@@ -1839,15 +1844,15 @@ msgid "Open Recent"
msgstr ""
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr ""
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2092,7 +2097,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2201,7 +2206,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2352,7 +2357,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2368,12 +2373,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2434,7 +2433,7 @@ msgid "Error requesting url: "
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2451,7 +2450,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
+msgid "Connecting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2464,7 +2463,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2596,11 +2595,11 @@ msgid "Collapse all"
msgstr "Thu gá»n tất cả"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "Äổi tên..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr "Di chuyển đến..."
#: editor/filesystem_dock.cpp
@@ -2612,15 +2611,15 @@ msgid "Instance"
msgstr "Thêm vào scene"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "Chỉnh sửa các File phụ thuộc.."
+msgid "Edit Dependencies..."
+msgstr "Chỉnh sửa các File phụ thuộc..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "Xem các scene sở hữu.."
+msgid "View Owners..."
+msgstr "Xem các scene sở hữu..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "Nhân đôi..."
#: editor/filesystem_dock.cpp
@@ -2646,10 +2645,10 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"Äang quét file,\n"
-"ChỠmôt chút.."
+"ChỠmôt chút..."
#: editor/filesystem_dock.cpp
msgid "Move"
@@ -2714,7 +2713,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2726,7 +2725,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2742,7 +2741,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2762,7 +2761,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3176,7 +3175,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3184,7 +3183,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3252,7 +3251,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3319,7 +3318,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3506,6 +3505,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3602,6 +3602,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3887,6 +3895,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3915,7 +3927,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4120,7 +4132,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4481,7 +4493,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4578,7 +4590,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4784,15 +4796,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5243,11 +5255,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5500,7 +5508,7 @@ msgid "Remove All"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5548,6 +5556,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5560,7 +5576,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5748,7 +5764,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5838,6 +5854,11 @@ msgid "Imported Project"
msgstr ""
#: editor/project_manager.cpp
+#, fuzzy
+msgid "Invalid Project Name."
+msgstr "Kích thước font không hợp lệ."
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr ""
@@ -6025,7 +6046,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6053,7 +6076,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6169,10 +6192,6 @@ msgid "Delete Item"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6241,7 +6260,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6337,11 +6356,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6512,7 +6531,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7118,7 +7137,7 @@ msgstr ""
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Floor:"
-msgstr ""
+msgstr "Tầng:"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "GridMap Delete Selection"
@@ -7212,6 +7231,10 @@ msgstr ""
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7260,6 +7283,10 @@ msgstr ""
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7844,10 +7871,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -7930,3 +7967,7 @@ msgstr "Lỗi tải font."
#: scene/resources/dynamic_font.cpp
msgid "Invalid font size."
msgstr "Kích thước font không hợp lệ."
+
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "Thư mục trước"
diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po
index c83806677e..48e30ceab3 100644
--- a/editor/translations/zh_CN.po
+++ b/editor/translations/zh_CN.po
@@ -2,7 +2,6 @@
# Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)
# This file is distributed under the same license as the Godot source code.
-#
# 360119124 <360119124@qq.com>, 2018.
# æŸ æª¬æ€æ‰‹ <lemonkiller@gmail.com>, 2018.
# 纯æ´çš„å蛋 <tqj.zyy@gmail.com>, 2016.
@@ -10,23 +9,29 @@
# å´äº®å¼Ÿ <wu@liangdi.me>, 2017.
# ageazrael <ageazrael@gmail.com>, 2016.
# Bruce Guo <guoboism@hotmail.com>, 2016.
-# dragonandy <dragonandy@foxmail.com>, 2017.
+# dragonandy <dragonandy@foxmail.com>, 2017-2018.
# Geequlim <geequlim@gmail.com>, 2016-2018.
+# jie Shi <meishijiemeimeimei@gmail.com>, 2018.
+# Jingtian Pan <panjingtian@126.com>, 2018.
# lalalaring <783482203@qq.com>, 2017.
-# Luo Jun <vipsbpig@gmail.com>, 2016-2017.
+# Luo Jun <vipsbpig@gmail.com>, 2016-2017, 2018.
# oberon-tonya <360119124@qq.com>, 2016.
+# plumsky <x-wolf@163.com>, 2018.
# Qichunren <whyruby@gmail.com>, 2017.
-# sersoong <seraphim945@qq.com>, 2017.
+# seanfy <everxiao@qq.com>, 2018.
+# sersoong <seraphim945@qq.com>, 2017-2018.
# wanfang liu <wanfang.liu@gmail.com>, 2016.
# WeiXiong Huang <wx_Huang@sina.com>, 2017.
# Youmu <konpaku.w@gmail.com>, 2017.
-#
+# yuetian <18829280955@163.com>, 2018.
+# Zae Chao <zae.vito@live.com>, 2018.
+# zwj36028 <23732399@qq.com>, 2018.
msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified) (Godot Engine)\n"
"POT-Creation-Date: 2018-01-20 12:15+0200\n"
-"PO-Revision-Date: 2018-02-03 05:35+0000\n"
-"Last-Translator: 360119124 <360119124@qq.com>\n"
+"PO-Revision-Date: 2018-06-09 03:55+0000\n"
+"Last-Translator: zwj36028 <23732399@qq.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"godot-engine/godot/zh_Hans/>\n"
"Language: zh_CN\n"
@@ -34,7 +39,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 2.19-dev\n"
+"X-Generator: Weblate 3.0\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -328,7 +333,7 @@ msgstr "在场景树中选择一个AnimationPlayeræ¥ç¼–辑动画。"
#: editor/animation_editor.cpp
msgid "Key"
-msgstr "é”®"
+msgstr "关键帧"
#: editor/animation_editor.cpp
msgid "Transition"
@@ -512,8 +517,8 @@ msgid "Disconnect '%s' from '%s'"
msgstr "å–æ¶ˆ'%s'的连接'%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
-msgstr "连接信å·.."
+msgid "Connect..."
+msgstr "连接信å·..."
#: editor/connections_dialog.cpp
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -807,7 +812,7 @@ msgstr "软件包安装æˆåŠŸï¼"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Success!"
-msgstr "完æˆï¼"
+msgstr "æˆåŠŸï¼"
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -924,12 +929,12 @@ msgid "Move Audio Bus"
msgstr "移动音频总线"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
-msgstr "将音频Bus布局ä¿å­˜ä¸º.."
+msgid "Save Audio Bus Layout As..."
+msgstr "将音频Bus布局ä¿å­˜ä¸º..."
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
-msgstr "新布局的ä½ç½®.."
+msgid "Location for New Layout..."
+msgstr "新布局的ä½ç½®..."
#: editor/editor_audio_buses.cpp
msgid "Open Audio Bus Layout"
@@ -967,7 +972,7 @@ msgstr "å¦å­˜ä¸º"
#: editor/editor_audio_buses.cpp
msgid "Save this Bus Layout to a file."
-msgstr "将音频Bus布局ä¿å­˜ä¸º.."
+msgstr "将音频Bus布局ä¿å­˜ä¸º..."
#: editor/editor_audio_buses.cpp editor/import_dock.cpp
msgid "Load Default"
@@ -1064,12 +1069,12 @@ msgid "Updating Scene"
msgstr "更新场景"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "ä¿å­˜ä¿®æ”¹ä¸­.."
+msgid "Storing local changes..."
+msgstr "ä¿å­˜ä¿®æ”¹ä¸­..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "更新场景中.."
+msgid "Updating scene..."
+msgstr "更新场景中..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1137,8 +1142,8 @@ msgid "Show In File Manager"
msgstr "在资æºç®¡ç†å™¨ä¸­æ‰“å¼€"
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
-msgid "New Folder.."
-msgstr "新建文件夹 .."
+msgid "New Folder..."
+msgstr "新建文件夹 ..."
#: editor/editor_file_dialog.cpp
msgid "Refresh"
@@ -1154,7 +1159,7 @@ msgstr "所有文件(*)"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open a File"
-msgstr "打开文件"
+msgstr "打开å•个文件"
#: editor/editor_file_dialog.cpp scene/gui/file_dialog.cpp
msgid "Open File(s)"
@@ -1383,7 +1388,7 @@ msgstr "查找"
#: editor/editor_log.cpp
msgid "Output:"
-msgstr "输出:"
+msgstr "日志:"
#: editor/editor_log.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/property_editor.cpp editor/script_editor_debugger.cpp
@@ -1396,18 +1401,22 @@ msgstr "清除"
msgid "Clear Output"
msgstr "清空输出"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr "é¡¹ç›®å¯¼å‡ºå¤±è´¥ï¼Œé”™è¯¯ä»£ç  %d。"
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr "ä¿å­˜èµ„æºå‡ºé”™ï¼"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
-msgstr "资æºå¦å­˜ä¸º.."
+msgid "Save Resource As..."
+msgstr "资æºå¦å­˜ä¸º..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
-msgstr "好å§.."
+msgid "I see..."
+msgstr "好å§..."
#: editor/editor_node.cpp
msgid "Can't open file for writing:"
@@ -1627,12 +1636,12 @@ msgid "Open Base Scene"
msgstr "打开父场景"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
-msgstr "快速打开场景.."
+msgid "Quick Open Scene..."
+msgstr "快速打开场景..."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
-msgstr "快速打开脚本.."
+msgid "Quick Open Script..."
+msgstr "快速打开脚本..."
#: editor/editor_node.cpp
msgid "Save & Close"
@@ -1643,8 +1652,8 @@ msgid "Save changes to '%s' before closing?"
msgstr "在关闭å‰ä¿å­˜æ›´æ”¹åˆ° %s å—?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "场景å¦å­˜ä¸º.."
+msgid "Save Scene As..."
+msgstr "场景å¦å­˜ä¸º..."
#: editor/editor_node.cpp
msgid "No"
@@ -1668,7 +1677,7 @@ msgstr "导出网格库(Mesh Library)"
#: editor/editor_node.cpp
msgid "This operation can't be done without a root node."
-msgstr "æ­¤æ“作必须有一个根节点(root node)æ‰èƒ½æ‰§è¡Œã€‚"
+msgstr "éœ€è¦æœ‰æ ¹èŠ‚ç‚¹æ‰èƒ½å®Œæˆæ­¤æ“作。"
#: editor/editor_node.cpp
msgid "Export Tile Set"
@@ -1695,8 +1704,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "æ­¤æ“作无法撤销,确定è¦ç»§ç»­å—?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "快速è¿è¡Œåœºæ™¯.."
+msgid "Quick Run Scene..."
+msgstr "快速è¿è¡Œåœºæ™¯..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1824,7 +1833,7 @@ msgstr "åˆ‡æ¢æ— å¹²æ‰°æ¨¡å¼ã€‚"
#: editor/editor_node.cpp
msgid "Add a new scene."
-msgstr "新建场景"
+msgstr "添加新场景。"
#: editor/editor_node.cpp
msgid "Scene"
@@ -1843,8 +1852,8 @@ msgid "Previous tab"
msgstr "上一个目录"
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "筛选文件.."
+msgid "Filter Files..."
+msgstr "筛选文件..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1855,12 +1864,12 @@ msgid "New Scene"
msgstr "新建场景"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
-msgstr "从现有场景中创建.."
+msgid "New Inherited Scene..."
+msgstr "从现有场景中创建..."
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "打开场景.."
+msgid "Open Scene..."
+msgstr "打开场景..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1879,16 +1888,16 @@ msgid "Open Recent"
msgstr "最近打开"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "转æ¢ä¸º.."
+msgid "Convert To..."
+msgstr "转æ¢ä¸º..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary(网格库).."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary(网格库)..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "ç –å—集.."
+msgid "TileSet..."
+msgstr "ç –å—集..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -1926,7 +1935,7 @@ msgstr "导出"
#: editor/editor_node.cpp
msgid "Tools"
-msgstr "工具"
+msgstr "工具(tools)"
#: editor/editor_node.cpp
msgid "Quit to Project List"
@@ -1938,7 +1947,7 @@ msgstr "调试"
#: editor/editor_node.cpp
msgid "Deploy with Remote Debug"
-msgstr "部署远程调试"
+msgstr "使用远程调试部署"
#: editor/editor_node.cpp
msgid ""
@@ -1949,7 +1958,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Small Deploy with Network FS"
-msgstr "å‘布基于网络文件系统的最å°åº”用包"
+msgstr "å°åž‹éƒ¨ç½²ä¸Žç½‘络文件系统"
#: editor/editor_node.cpp
msgid ""
@@ -1967,7 +1976,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Visible Collision Shapes"
-msgstr "碰撞区域å¯è§"
+msgstr "å¯è§ç¢°æ’žåŒºåŸŸ"
#: editor/editor_node.cpp
msgid ""
@@ -1977,7 +1986,7 @@ msgstr "如果å¯ç”¨æ­¤é¡¹ï¼ŒèŠ‚ç‚¹çš„ç¢°æ’žåŒºåŸŸå’Œraycast将在游æˆè¿è¡Œæ—
#: editor/editor_node.cpp
msgid "Visible Navigation"
-msgstr "Navigationå¯è§"
+msgstr "å¯è§å¯¼èˆª"
#: editor/editor_node.cpp
msgid ""
@@ -2141,8 +2150,8 @@ msgid "Save the currently edited resource."
msgstr "ä¿å­˜å½“å‰ç¼–辑的资æºã€‚"
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "å¦å­˜ä¸º.."
+msgid "Save As..."
+msgstr "å¦å­˜ä¸º..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2179,7 +2188,7 @@ msgstr "文件系统"
#: editor/editor_node.cpp
msgid "Output"
-msgstr "输出"
+msgstr "日志"
#: editor/editor_node.cpp
msgid "Don't Save"
@@ -2250,8 +2259,8 @@ msgid "Creating Mesh Previews"
msgstr "创建网格预览"
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
-msgstr "缩略图.."
+msgid "Thumbnail..."
+msgstr "缩略图..."
#: editor/editor_plugin_settings.cpp
msgid "Installed Plugins:"
@@ -2403,8 +2412,8 @@ msgid "(Current)"
msgstr "(当å‰)"
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
-msgstr "正在链接镜åƒåœ°å€ï¼Œè¯·ç¨åŽ.."
+msgid "Retrieving mirrors, please wait..."
+msgstr "检索镜åƒï¼Œè¯·ç­‰å¾…..."
#: editor/export_template_manager.cpp
msgid "Remove template version '%s'?"
@@ -2419,12 +2428,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "æ¨¡æ¿æ–‡ä»¶ä¸­çš„version.txtä¸åˆæ³•。"
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr "模æ¿ä¸­çš„ version.txt文件格å¼ä¸åˆæ³•,无效的版本标识符。"
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr "模æ¿ä¸­æ²¡æœ‰æ‰¾åˆ°version.txt文件。"
@@ -2444,7 +2447,7 @@ msgstr "导入:"
msgid ""
"No download links found for this version. Direct download is only available "
"for official releases."
-msgstr "当å‰ç‰ˆæœ¬æ²¡æœ‰ä¸‹è½½é“¾æŽ¥ã€‚åªèƒ½é€šè¿‡å®˜æ–¹å‘布下载。"
+msgstr "当å‰ç‰ˆæœ¬æ²¡æœ‰ä¸‹è½½é“¾æŽ¥ã€‚ç›´é“¾ä¸‹è½½åªæä¾›å®˜æ–¹æ­£å¼ç‰ˆã€‚"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -2478,15 +2481,15 @@ msgstr "失败:"
#: editor/export_template_manager.cpp
msgid "Download Complete."
-msgstr "下载完æˆ"
+msgstr "下载完æˆã€‚"
#: editor/export_template_manager.cpp
msgid "Error requesting url: "
msgstr "请求链接错误: "
#: editor/export_template_manager.cpp
-msgid "Connecting to Mirror.."
-msgstr "正在连接镜åƒâ€¦â€¦"
+msgid "Connecting to Mirror..."
+msgstr "正在连接镜åƒç½‘站。。"
#: editor/export_template_manager.cpp
msgid "Disconnected"
@@ -2502,8 +2505,8 @@ msgstr "无法解æž"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Connecting.."
-msgstr "连接中.."
+msgid "Connecting..."
+msgstr "连接中..."
#: editor/export_template_manager.cpp
msgid "Can't Connect"
@@ -2515,8 +2518,8 @@ msgstr "已连接"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
-msgstr "正在请求……"
+msgid "Requesting..."
+msgstr "正在请求。。"
#: editor/export_template_manager.cpp
msgid "Downloading"
@@ -2647,12 +2650,12 @@ msgid "Collapse all"
msgstr "收起所有"
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr "é‡å‘½å为..."
#: editor/filesystem_dock.cpp
-msgid "Move To.."
-msgstr "移动.."
+msgid "Move To..."
+msgstr "移动..."
#: editor/filesystem_dock.cpp
msgid "Open Scene(s)"
@@ -2663,16 +2666,16 @@ msgid "Instance"
msgstr "创建实例节点"
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
-msgstr "编辑ä¾èµ–.."
+msgid "Edit Dependencies..."
+msgstr "编辑ä¾èµ–..."
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
-msgstr "查看所有者.."
+msgid "View Owners..."
+msgstr "查看所有者..."
#: editor/filesystem_dock.cpp
-msgid "Duplicate.."
-msgstr "æ‹·è´.."
+msgid "Duplicate..."
+msgstr "æ‹·è´..."
#: editor/filesystem_dock.cpp
msgid "Previous Directory"
@@ -2697,7 +2700,7 @@ msgstr "将选中的场景实例为选中节点的å­èŠ‚ç‚¹ã€‚"
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
"æ‰«ææ–‡ä»¶ï¼Œ\n"
"请ç¨å€™ã€‚"
@@ -2725,7 +2728,7 @@ msgstr "导入为独立场景"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Animations"
-msgstr "导入独立的动画"
+msgstr "与独立的动画一åŒå¯¼å…¥"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials"
@@ -2741,15 +2744,15 @@ msgstr "导入独立物体 + æè´¨"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Animations"
-msgstr "导入独立物体+动画"
+msgstr "导入独立的物体和动画"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Materials+Animations"
-msgstr "导入独立æè´¨+动画"
+msgstr "与独立的æè´¨å’ŒåŠ¨ç”»ä¸€åŒå¯¼å…¥"
#: editor/import/resource_importer_scene.cpp
msgid "Import with Separate Objects+Materials+Animations"
-msgstr "导入独立物体+æè´¨+动画"
+msgstr "ä¸Žç‹¬ç«‹çš„ç‰©ä½“ã€æè´¨å’ŒåŠ¨ç”»ä¸€åŒå¯¼å…¥"
#: editor/import/resource_importer_scene.cpp
msgid "Import as Multiple Scenes"
@@ -2765,8 +2768,8 @@ msgid "Import Scene"
msgstr "导入场景"
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
-msgstr "导入场景.."
+msgid "Importing Scene..."
+msgstr "导入场景..."
#: editor/import/resource_importer_scene.cpp
msgid "Generating Lightmaps"
@@ -2774,11 +2777,11 @@ msgstr "正在生æˆå…‰ç…§è´´å›¾"
#: editor/import/resource_importer_scene.cpp
msgid "Generating for Mesh: "
-msgstr "正在生æˆMesh"
+msgstr "正在生æˆMesh: "
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
-msgstr "执行自定义脚本.."
+msgid "Running Custom Script..."
+msgstr "执行自定义脚本..."
#: editor/import/resource_importer_scene.cpp
msgid "Couldn't load post-import script:"
@@ -2793,7 +2796,7 @@ msgid "Error running post-import script:"
msgstr "åŽå¤„ç†è„šæœ¬è¿è¡Œå‘生错误:"
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr "ä¿å­˜ä¸­..."
#: editor/import_dock.cpp
@@ -2813,8 +2816,8 @@ msgid "Import As:"
msgstr "导入为:"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
-msgstr "预设.."
+msgid "Preset..."
+msgstr "预设..."
#: editor/import_dock.cpp
msgid "Reimport"
@@ -3062,7 +3065,7 @@ msgstr "ä»…ä¸åŒ"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Force White Modulate"
-msgstr ""
+msgstr "强制用白色调和"
#: editor/plugins/animation_player_editor_plugin.cpp
msgid "Include Gizmos (3D)"
@@ -3231,16 +3234,16 @@ msgid "Transition Node"
msgstr "过渡节点"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
-msgstr "导入动画.."
+msgid "Import Animations..."
+msgstr "导入动画..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "Edit Node Filters"
msgstr "编辑节点筛选"
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
-msgstr "筛选.."
+msgid "Filters..."
+msgstr "筛选..."
#: editor/plugins/animation_tree_editor_plugin.cpp
msgid "AnimationTree"
@@ -3307,8 +3310,8 @@ msgid "Fetching:"
msgstr "获å–:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
-msgstr "è§£æžä¸­.."
+msgid "Resolving..."
+msgstr "è§£æžä¸­..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Error making request"
@@ -3374,8 +3377,8 @@ msgid "Site:"
msgstr "站点:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
-msgstr "支æŒ.."
+msgid "Support..."
+msgstr "支æŒ..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Official"
@@ -3564,8 +3567,9 @@ msgid "Use Rotation Snap"
msgstr "使用旋转å¸é™„"
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
-msgstr "设置å¸é™„.."
+msgstr "设置å¸é™„..."
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Snap Relative"
@@ -3657,7 +3661,15 @@ msgstr "显示标尺"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Show Guides"
-msgstr "显示标尺 "
+msgstr "显示引导"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr "显示原点"
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr "显示视图窗å£"
#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
@@ -3776,13 +3788,12 @@ msgid "Update from Scene"
msgstr "从场景中更新"
#: editor/plugins/curve_editor_plugin.cpp
-#, fuzzy
msgid "Flat0"
msgstr "Flat0"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Flat1"
-msgstr ""
+msgstr "Flat1"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Ease in"
@@ -3794,7 +3805,7 @@ msgstr "æ¸å‡º"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Smoothstep"
-msgstr "圆滑级别 "
+msgstr "平滑æ’值"
#: editor/plugins/curve_editor_plugin.cpp
msgid "Modify Curve Point"
@@ -3842,7 +3853,7 @@ msgstr "æŒ‰ä½ Shift å¯å•独编辑切线"
#: editor/plugins/gi_probe_editor_plugin.cpp
msgid "Bake GI Probe"
-msgstr "烘焙GI Probe"
+msgstr "渲染GI Probe"
#: editor/plugins/gradient_editor_plugin.cpp
msgid "Add/Remove Color Ramp Point"
@@ -3950,6 +3961,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr "Mesh(网格)æ²¡æœ‰è¡¨é¢æ¥åˆ›å»ºè½®å»“(outlines)ï¼"
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr "ç½‘æ ¼åŽŸå§‹ç±»åž‹ä¸æ˜¯ PRIMITIVE_TRIANGLES(三角形网格)ï¼"
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr "无法创建轮廓(outlines)ï¼"
@@ -3978,8 +3993,8 @@ msgid "Create Convex Collision Sibling"
msgstr "创建凸(Convex)碰撞åŒçº§"
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
-msgstr "创建轮廓网格(Outline Mesh).."
+msgid "Create Outline Mesh..."
+msgstr "创建轮廓网格(Outline Mesh)..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "View UV1"
@@ -4131,7 +4146,7 @@ msgstr "标记å¯ç§»åŠ¨ä¸‰è§’å½¢..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
-msgstr "构建紧凑高度图... "
+msgstr "构建紧凑高度图..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Eroding walkable area..."
@@ -4139,11 +4154,11 @@ msgstr "正在计算å¯è¡ŒåŒºåŸŸ..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Partitioning..."
-msgstr "分区中... "
+msgstr "分区中..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating contours..."
-msgstr "正在创建轮廓... "
+msgstr "正在创建轮廓..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Creating polymesh..."
@@ -4151,7 +4166,7 @@ msgstr "创建多边形网格..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Converting to native navigation mesh..."
-msgstr "转æ¢ä¸ºå¯¼èˆªç½‘æ ¼(mesh)... "
+msgstr "转æ¢ä¸ºå¯¼èˆªç½‘æ ¼(mesh)..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Navigation Mesh Generator Setup:"
@@ -4183,8 +4198,8 @@ msgid "Error loading image:"
msgstr "加载图片出错:"
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
-msgstr "å›¾ç‰‡ä¸­æ²¡æœ‰é€æ˜Žåº¦> 128çš„åƒç´ .."
+msgid "No pixels with transparency > 128 in image..."
+msgstr "å›¾ç‰‡ä¸­æ²¡æœ‰é€æ˜Žåº¦> 128çš„åƒç´ ..."
#: editor/plugins/particles_2d_editor_plugin.cpp
msgid "Generate Visibility Rect"
@@ -4367,7 +4382,7 @@ msgstr "è®¾ç½®æ›²çº¿çš„é¡¶ç‚¹åæ ‡"
#: editor/plugins/path_editor_plugin.cpp
msgid "Set Curve In Position"
-msgstr "设置曲线的内控制点"
+msgstr "设置的曲线åˆå§‹ä½ç½®ï¼ˆPos)"
#: editor/plugins/path_editor_plugin.cpp
msgid "Set Curve Out Position"
@@ -4544,8 +4559,8 @@ msgid "Import Theme"
msgstr "导入主题"
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
-msgstr "主题å¦å­˜ä¸º.."
+msgid "Save Theme As..."
+msgstr "主题å¦å­˜ä¸º..."
#: editor/plugins/script_editor_plugin.cpp
msgid " Class Reference"
@@ -4596,9 +4611,8 @@ msgid "Copy Script Path"
msgstr "æ‹·è´è„šæœ¬è·¯å¾„"
#: editor/plugins/script_editor_plugin.cpp
-#, fuzzy
msgid "Show In File System"
-msgstr "在资æºç®¡ç†å™¨ä¸­å±•示"
+msgstr "在资æºç®¡ç†å™¨ä¸­æ˜¾ç¤º"
#: editor/plugins/script_editor_plugin.cpp
msgid "History Prev"
@@ -4642,8 +4656,8 @@ msgstr "切æ¢è„šæœ¬é¢æ¿"
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
-msgstr "查找.."
+msgid "Find..."
+msgstr "查找..."
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
@@ -4850,16 +4864,16 @@ msgid "Find Previous"
msgstr "查找上一项"
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
-msgstr "替æ¢.."
+msgid "Replace..."
+msgstr "替æ¢..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
-msgstr "å‰å¾€å‡½æ•°.."
+msgid "Goto Function..."
+msgstr "å‰å¾€å‡½æ•°..."
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
-msgstr "å‰å¾€è¡Œ.."
+msgid "Goto Line..."
+msgstr "å‰å¾€è¡Œ..."
#: editor/plugins/script_text_editor.cpp
msgid "Contextual Help"
@@ -5027,7 +5041,7 @@ msgstr "缩放: "
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Translating: "
-msgstr "语言:"
+msgstr "移动: "
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Rotating %s degrees."
@@ -5312,12 +5326,8 @@ msgid "Transform"
msgstr "å˜æ¢"
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr "设置å¸é™„.."
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
-msgstr "å˜æ¢å¯¹è¯æ¡†.."
+msgid "Transform Dialog..."
+msgstr "å˜æ¢å¯¹è¯æ¡†..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "1 Viewport"
@@ -5569,8 +5579,8 @@ msgid "Remove All"
msgstr "移除全部"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
-msgstr "编辑主题.."
+msgid "Edit theme..."
+msgstr "编辑主题..."
#: editor/plugins/theme_editor_plugin.cpp
msgid "Theme editing menu."
@@ -5594,7 +5604,7 @@ msgstr "创建空编辑器主题模æ¿"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Create From Current Editor Theme"
-msgstr "从当å‰ç¼–辑器主题创建"
+msgstr "从当å‰ç¼–辑器主题模æ¿åˆ›å»º"
#: editor/plugins/theme_editor_plugin.cpp
msgid "CheckBox Radio1"
@@ -5617,6 +5627,14 @@ msgid "Checked Item"
msgstr "已选项目(Checked Item)"
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr "å•选项目"
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr "已选å•选项目"
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr "有(Has)"
@@ -5629,8 +5647,8 @@ msgid "Options"
msgstr "选项"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr "有,很多,几个,选项(Have,Many,Several,Options)ï¼"
+msgid "Has,Many,Options"
+msgstr "有,很多,选项"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5784,8 +5802,8 @@ msgid ""
"LMB: set bit on.\n"
"RMB: set bit off."
msgstr ""
-"鼠标左键: å¯ç”¨bit.\n"
-"é¼ æ ‡å³é”®ï¼š ç¦ç”¨bit"
+"鼠标左键: å¯ç”¨è¯¥bit。\n"
+"é¼ æ ‡å³é”®ï¼š ç¦ç”¨è¯¥bit。"
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Select current edited sub-tile."
@@ -5805,7 +5823,7 @@ msgstr "坿‰§è¡Œçš„"
#: editor/project_export.cpp
msgid "Delete patch '%s' from list?"
-msgstr "确认è¦ä»Žåˆ—表中删除Patch '%s' å—?"
+msgstr "从列表中删除补ä¸''%s'?"
#: editor/project_export.cpp
msgid "Delete preset '%s'?"
@@ -5820,8 +5838,8 @@ msgid "Presets"
msgstr "预设"
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
-msgstr "添加.."
+msgid "Add..."
+msgstr "添加..."
#: editor/project_export.cpp
msgid "Resources"
@@ -5910,6 +5928,10 @@ msgid "Imported Project"
msgstr "已导入的项目"
#: editor/project_manager.cpp
+msgid "Invalid Project Name."
+msgstr "无效项目å称。"
+
+#: editor/project_manager.cpp
msgid "Couldn't create folder."
msgstr "无法创建文件夹。"
@@ -5926,11 +5948,11 @@ msgid "Invalid project path (changed anything?)."
msgstr "é¡¹ç›®è·¯å¾„éžæ³•(被外部修改?)。"
#: editor/project_manager.cpp
-#, fuzzy
msgid ""
"Couldn't load project.godot in project path (error %d). It may be missing or "
"corrupted."
-msgstr "无法在项目目录下编辑project.godot文件。"
+msgstr ""
+"无法在项目路径中加载 project.godot 文件(错误 %d)。该文件å¯èƒ½ç¼ºå¤±æˆ–å·²æŸå。"
#: editor/project_manager.cpp
msgid "Couldn't edit project.godot in project path."
@@ -6104,8 +6126,10 @@ msgid "Mouse Button"
msgstr "鼠标按键"
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
-msgstr "Actionåéžæ³•(ä¸å¾—包å«'/'或':')。"
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
+msgstr "无效的æ“作å称。它ä¸èƒ½æ˜¯ç©ºçš„也ä¸èƒ½åŒ…å« '/', ':', '=', '\\' 或者 '\"'。"
#: editor/project_settings_editor.cpp
msgid "Action '%s' already exists!"
@@ -6132,8 +6156,8 @@ msgid "Control+"
msgstr "Ctrl+"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
-msgstr "按下一个键.."
+msgid "Press a Key..."
+msgstr "按下一个键..."
#: editor/project_settings_editor.cpp
msgid "Mouse Button Index:"
@@ -6237,7 +6261,7 @@ msgstr "请先选择一个设置项目 ï¼"
#: editor/project_settings_editor.cpp
msgid "No property '%s' exists."
-msgstr "属性 '%s' ä¸å­˜åœ¨"
+msgstr "ä¸å­˜åœ¨å±žæ€§ '%s'。"
#: editor/project_settings_editor.cpp
msgid "Setting '%s' is internal, and it can't be deleted."
@@ -6248,10 +6272,6 @@ msgid "Delete Item"
msgstr "删除æ¡ç›®"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr "ä¸èƒ½åŒ…å« \"/\" 或 \":\""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr "å·²ç»å­˜åœ¨"
@@ -6313,14 +6333,14 @@ msgstr "项目设置(project.godot)"
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
msgid "General"
-msgstr "一般"
+msgstr "常规"
#: editor/project_settings_editor.cpp editor/property_editor.cpp
msgid "Property:"
msgstr "属性:"
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr "é‡å†™çš„......"
#: editor/project_settings_editor.cpp
@@ -6365,7 +6385,7 @@ msgstr "地区é‡å®šå‘:"
#: editor/project_settings_editor.cpp
msgid "Locale"
-msgstr "地区"
+msgstr "区域"
#: editor/project_settings_editor.cpp
msgid "Locales Filter"
@@ -6416,12 +6436,12 @@ msgid "Easing Out-In"
msgstr "å缓入缓出"
#: editor/property_editor.cpp
-msgid "File.."
-msgstr "文件.."
+msgid "File..."
+msgstr "文件..."
#: editor/property_editor.cpp
-msgid "Dir.."
-msgstr "目录.."
+msgid "Dir..."
+msgstr "目录..."
#: editor/property_editor.cpp
msgid "Assign"
@@ -6472,13 +6492,12 @@ msgid "On"
msgstr "å¯ç”¨"
#: editor/property_editor.cpp
-#, fuzzy
msgid "[Empty]"
-msgstr "添加空白帧"
+msgstr "[空]"
#: editor/property_editor.cpp modules/visual_script/visual_script_editor.cpp
msgid "Set"
-msgstr "设置"
+msgstr "Set"
#: editor/property_editor.cpp
msgid "Properties:"
@@ -6592,8 +6611,8 @@ msgid "This operation can't be done on instanced scenes."
msgstr "æ­¤æ“作ä¸èƒ½åº”用于实例化的场景。"
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
-msgstr "将新场景å¦å­˜ä¸º.."
+msgid "Save New Scene As..."
+msgstr "将新场景å¦å­˜ä¸º..."
#: editor/scene_tree_dock.cpp
msgid "Editable Children"
@@ -6837,7 +6856,7 @@ msgstr "存在åŒå目录"
#: editor/script_create_dialog.cpp
msgid "File exists, will be reused"
-msgstr "文件存在,将被é‡ç”¨"
+msgstr "文件已存在, 将被é‡ç”¨"
#: editor/script_create_dialog.cpp
msgid "Invalid extension"
@@ -6904,7 +6923,6 @@ msgid "Attach Node Script"
msgstr "设置节点的脚本"
#: editor/script_editor_debugger.cpp
-#, fuzzy
msgid "Remote "
msgstr "远程 "
@@ -6974,7 +6992,7 @@ msgstr "性能分æž"
#: editor/script_editor_debugger.cpp
msgid "Monitor"
-msgstr "显示"
+msgstr "监视"
#: editor/script_editor_debugger.cpp
msgid "Value"
@@ -7014,7 +7032,7 @@ msgstr "用é‡"
#: editor/script_editor_debugger.cpp
msgid "Misc"
-msgstr "æ‚项"
+msgstr "å…¶ä»–"
#: editor/script_editor_debugger.cpp
msgid "Clicked Control:"
@@ -7187,18 +7205,16 @@ msgid "Object can't provide a length."
msgstr "对象无法æä¾›é•¿åº¦ã€‚"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Next Plane"
-msgstr "下一项"
+msgstr "下一个平é¢"
#: modules/gridmap/grid_map_editor_plugin.cpp
-#, fuzzy
msgid "Previous Plane"
-msgstr "上一个目录"
+msgstr "上一个平é¢"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Plane:"
-msgstr ""
+msgstr "å¹³é¢ï¼š"
#: modules/gridmap/grid_map_editor_plugin.cpp
msgid "Next Floor"
@@ -7304,9 +7320,13 @@ msgstr "GridMap设置"
msgid "Pick Distance:"
msgstr "拾å–è·ç¦»:"
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr "ç±»åä¸èƒ½æ˜¯ä¿ç•™å…³é”®å­—"
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
-msgstr "正在创生æˆå†³æ–¹æ¡ˆ... "
+msgstr "正在创生æˆå†³æ–¹æ¡ˆ..."
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating C# project..."
@@ -7326,7 +7346,7 @@ msgstr "完æˆ"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Failed to create C# project."
-msgstr "创建C#项目失败"
+msgstr "创建C#项目失败。"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Mono"
@@ -7334,7 +7354,7 @@ msgstr "Mono"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "About C# support"
-msgstr ""
+msgstr "关于C#支æŒ"
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Create C# solution"
@@ -7352,6 +7372,10 @@ msgstr "构建项目"
msgid "Warnings"
msgstr "警告"
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr "内部异常堆栈追朔结æŸ"
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7517,11 +7541,11 @@ msgstr "连接节点"
#: modules/visual_script/visual_script_editor.cpp
msgid "Condition"
-msgstr "æ¡ä»¶ï¼ˆCondition)"
+msgstr "æ¡ä»¶"
#: modules/visual_script/visual_script_editor.cpp
msgid "Sequence"
-msgstr "åºåˆ—(Sequence)"
+msgstr "åºåˆ—"
#: modules/visual_script/visual_script_editor.cpp
msgid "Switch"
@@ -7870,11 +7894,11 @@ msgstr "ARVROrigin 必须拥有 ARVRCamera å­èŠ‚ç‚¹"
#: scene/3d/baked_lightmap.cpp
msgid "%d%%"
-msgstr ""
+msgstr "%d%%"
#: scene/3d/baked_lightmap.cpp
msgid "(Time Left: %d:%02d s)"
-msgstr ""
+msgstr "(剩余时间:%d:%02d 秒)"
#: scene/3d/baked_lightmap.cpp
msgid "Plotting Meshes: "
@@ -7966,10 +7990,22 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr "path属性必须指å‘ä¸€ä¸ªåˆæ³•çš„Spatial节点æ‰èƒ½æ­£å¸¸å·¥ä½œã€‚"
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr "WorldEnvironment需è¦ä¸€ä¸ªçŽ¯å¢ƒèµ„æºã€‚"
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr "æ¯ä¸ªåœºæ™¯ä¸­åªå…许有一个WorldEnvironment类型的节点。"
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+"这个WorldEnvironment被忽略。添加摄åƒå¤´ï¼ˆç”¨äºŽ3D场景)或将此环境的背景模å¼è®¾ç½®"
+"为画布(用于2D场景)。"
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8061,6 +8097,24 @@ msgstr "加载字体出错。"
msgid "Invalid font size."
msgstr "字体大å°éžæ³•。"
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "上一个目录"
+
+#~ msgid "Next"
+#~ msgstr "下一项"
+
+#~ msgid "Invalid action (anything goes but '/' or ':')."
+#~ msgstr "Actionåéžæ³•(ä¸å¾—包å«'/'或':')。"
+
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "ä¸èƒ½åŒ…å« \"/\" 或 \":\""
+
+#~ msgid ""
+#~ "Invalid version.txt format inside templates. Revision is not a valid "
+#~ "identifier."
+#~ msgstr "模æ¿ä¸­çš„ version.txt文件格å¼ä¸åˆæ³•,无效的版本标识符。"
+
#~ msgid "Can't write file."
#~ msgstr "无法写入文件。"
@@ -8073,9 +8127,6 @@ msgstr "字体大å°éžæ³•。"
#~ msgid "Couldn't get project.godot in the project path."
#~ msgstr "无法在项目目录下找到project.godot文件。"
-#~ msgid "Next"
-#~ msgstr "下一项"
-
#~ msgid "Not found!"
#~ msgstr "未找到ï¼"
@@ -8222,8 +8273,8 @@ msgstr "字体大å°éžæ³•。"
#~ msgid "Exporting for %s"
#~ msgstr "正在导出 %s"
-#~ msgid "Setting Up.."
-#~ msgstr "é…ç½®.."
+#~ msgid "Setting Up..."
+#~ msgstr "é…ç½®..."
#~ msgid "Error loading scene."
#~ msgstr "加载场景出错。"
@@ -8283,8 +8334,8 @@ msgstr "字体大å°éžæ³•。"
#~ msgid "Info"
#~ msgstr "ä¿¡æ¯"
-#~ msgid "Re-Import.."
-#~ msgstr "釿–°å¯¼å…¥.."
+#~ msgid "Re-Import..."
+#~ msgstr "釿–°å¯¼å…¥..."
#~ msgid "No bit masks to import!"
#~ msgstr "没有è¦å¯¼å…¥çš„bit masksï¼"
@@ -8675,14 +8726,14 @@ msgstr "字体大å°éžæ³•。"
#~ msgid "Zoom (%):"
#~ msgstr "缩放(%):"
-#~ msgid "Skeleton.."
-#~ msgstr "骨骼.."
+#~ msgid "Skeleton..."
+#~ msgstr "骨骼..."
#~ msgid "Zoom Reset"
#~ msgstr "é‡ç½®ç¼©æ”¾"
-#~ msgid "Zoom Set.."
-#~ msgstr "设置缩放.."
+#~ msgid "Zoom Set..."
+#~ msgstr "设置缩放..."
#~ msgid "Set a Value"
#~ msgstr "设置值"
@@ -9150,8 +9201,8 @@ msgstr "字体大å°éžæ³•。"
#~ msgid "Export Project PCK"
#~ msgstr "导出项目PCK文件"
-#~ msgid "Export.."
-#~ msgstr "导出.."
+#~ msgid "Export..."
+#~ msgstr "导出..."
#~ msgid "Project Export"
#~ msgstr "项目导出"
@@ -9240,7 +9291,7 @@ msgstr "字体大å°éžæ³•。"
#~ msgid "Reload Tool Script (Soft)"
#~ msgstr "釿–°åŠ è½½Tool脚本(Soft)"
-#~ msgid "Edit Connections.."
+#~ msgid "Edit Connections..."
#~ msgstr "编辑事件连接"
#~ msgid "Set Params"
diff --git a/editor/translations/zh_HK.po b/editor/translations/zh_HK.po
index 5d5ea0fa4d..568390a7a8 100644
--- a/editor/translations/zh_HK.po
+++ b/editor/translations/zh_HK.po
@@ -534,7 +534,7 @@ msgid "Disconnect '%s' from '%s'"
msgstr "由 '%s' 連到 '%s'"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "連到..."
#: editor/connections_dialog.cpp
@@ -972,11 +972,11 @@ msgid "Move Audio Bus"
msgstr "移動"
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -1126,11 +1126,11 @@ msgid "Updating Scene"
msgstr "更新場景"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "儲存本地更改.."
+msgid "Storing local changes..."
+msgstr "儲存本地更改..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
+msgid "Updating scene..."
msgstr "正在更新場景..."
#: editor/editor_data.cpp
@@ -1203,7 +1203,7 @@ msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
#, fuzzy
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "新增資料夾"
#: editor/editor_file_dialog.cpp
@@ -1471,18 +1471,22 @@ msgstr "清空"
msgid "Clear Output"
msgstr "下一個腳本"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
#, fuzzy
msgid "Error saving resource!"
msgstr "å„²å­˜è³‡æºæ™‚出ç¾éŒ¯èª¤ï¼"
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr "把資æºå¦å­˜ç‚º..."
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "如來如此"
#: editor/editor_node.cpp
@@ -1709,11 +1713,11 @@ msgid "Open Base Scene"
msgstr "開啟基礎場景"
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "快速開啟場景.."
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr "快速開啟腳本.."
#: editor/editor_node.cpp
@@ -1727,7 +1731,7 @@ msgid "Save changes to '%s' before closing?"
msgstr "關閉å‰è¦å…ˆå„²å­˜å° '%s' 任何更改嗎?"
#: editor/editor_node.cpp
-msgid "Save Scene As.."
+msgid "Save Scene As..."
msgstr "把場景å¦å­˜ç‚º"
#: editor/editor_node.cpp
@@ -1779,8 +1783,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "快速é‹è¡Œå ´æ™¯.."
+msgid "Quick Run Scene..."
+msgstr "快速é‹è¡Œå ´æ™¯..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1939,8 +1943,8 @@ msgstr "上一個tab"
#: editor/editor_node.cpp
#, fuzzy
-msgid "Filter Files.."
-msgstr "ç¯©é¸æª”案.."
+msgid "Filter Files..."
+msgstr "ç¯©é¸æª”案..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1951,11 +1955,11 @@ msgid "New Scene"
msgstr "新增場景"
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
+msgid "Open Scene..."
msgstr "開啓場景"
#: editor/editor_node.cpp
@@ -1975,16 +1979,16 @@ msgid "Open Recent"
msgstr "開啓最近的"
#: editor/editor_node.cpp
-msgid "Convert To.."
+msgid "Convert To..."
msgstr "轉為..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
-msgstr "MeshLibrary.."
+msgid "MeshLibrary..."
+msgstr "MeshLibrary..."
#: editor/editor_node.cpp
-msgid "TileSet.."
-msgstr "TileSet.."
+msgid "TileSet..."
+msgstr "TileSet..."
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
#: scene/gui/line_edit.cpp scene/gui/text_edit.cpp
@@ -2232,8 +2236,8 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
-msgstr "å¦å­˜ç‚º.."
+msgid "Save As..."
+msgstr "å¦å­˜ç‚º..."
#: editor/editor_node.cpp
msgid "Go to the previous edited object in history."
@@ -2347,7 +2351,7 @@ msgstr ""
#: editor/editor_plugin.cpp
#, fuzzy
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr "縮圖"
#: editor/editor_plugin_settings.cpp
@@ -2503,7 +2507,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2520,12 +2524,6 @@ msgid "Invalid version.txt format inside templates."
msgstr "無效的 version.txt æ ¼å¼ inside templates."
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
#, fuzzy
msgid "No version.txt found inside templates."
msgstr "找ä¸åˆ°version.txt inside templates."
@@ -2593,7 +2591,7 @@ msgstr "請求時出ç¾éŒ¯èª¤"
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "連到..."
#: editor/export_template_manager.cpp
@@ -2612,7 +2610,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "連到..."
#: editor/export_template_manager.cpp
@@ -2627,7 +2625,7 @@ msgstr "連到"
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr "請求中..."
#: editor/export_template_manager.cpp
@@ -2773,13 +2771,13 @@ msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Rename.."
-msgstr "釿–°å‘½å.."
+msgid "Rename..."
+msgstr "釿–°å‘½å..."
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Move To.."
-msgstr "æ¬åˆ°.."
+msgid "Move To..."
+msgstr "æ¬åˆ°..."
#: editor/filesystem_dock.cpp
#, fuzzy
@@ -2791,16 +2789,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "複製"
#: editor/filesystem_dock.cpp
@@ -2826,7 +2824,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2836,7 +2834,7 @@ msgstr "移動"
#: editor/filesystem_dock.cpp editor/plugins/animation_tree_editor_plugin.cpp
#: editor/project_manager.cpp
msgid "Rename"
-msgstr "釿–°å‘½å.."
+msgstr "釿–°å‘½å..."
#: editor/groups_editor.cpp
msgid "Add to Group"
@@ -2893,7 +2891,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2905,7 +2903,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2921,8 +2919,8 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
-msgstr "儲存中.."
+msgid "Saving..."
+msgstr "儲存中..."
#: editor/import_dock.cpp
msgid "Set as Default for '%s'"
@@ -2943,7 +2941,7 @@ msgid "Import As:"
msgstr "å°Žå…¥"
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3366,7 +3364,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3374,7 +3372,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3446,7 +3444,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3513,7 +3511,7 @@ msgid "Site:"
msgstr "地å€:"
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3703,6 +3701,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3799,6 +3798,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -4091,6 +4098,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -4119,7 +4130,7 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
@@ -4271,7 +4282,7 @@ msgstr ""
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "儲存本地更改.."
+msgstr "儲存本地更改..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
@@ -4327,7 +4338,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4694,7 +4705,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4796,7 +4807,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -5009,15 +5020,15 @@ msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5481,11 +5492,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5741,7 +5748,7 @@ msgid "Remove All"
msgstr "移除"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5789,6 +5796,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5801,8 +5816,9 @@ msgid "Options"
msgstr "é¸é …"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
-msgstr ""
+#, fuzzy
+msgid "Has,Many,Options"
+msgstr "é¸é …"
#: editor/plugins/theme_editor_plugin.cpp
msgid "Tab 1"
@@ -5929,7 +5945,7 @@ msgstr ""
#: editor/plugins/tile_set_editor_plugin.cpp
#, fuzzy
msgid "Tile Set"
-msgstr "TileSet.."
+msgstr "TileSet..."
#: editor/plugins/tile_set_editor_plugin.cpp
msgid "Create from Scene"
@@ -5996,7 +6012,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr "添加..."
#: editor/project_export.cpp
@@ -6091,6 +6107,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "無效å稱"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "無法新增資料夾"
@@ -6284,7 +6305,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6312,7 +6335,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6431,11 +6454,6 @@ msgid "Delete Item"
msgstr "刪除"
#: editor/project_settings_editor.cpp
-#, fuzzy
-msgid "Can't contain '/' or ':'"
-msgstr "ä¸èƒ½é€£åˆ°ä¸»æ©Ÿï¼š"
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6504,7 +6522,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6601,11 +6619,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6783,7 +6801,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -7316,7 +7334,7 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "Dynamic Library"
-msgstr "MeshLibrary.."
+msgstr "MeshLibrary..."
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Add an architecture entry"
@@ -7325,12 +7343,12 @@ msgstr ""
#: modules/gdnative/gdnative_library_editor_plugin.cpp
#, fuzzy
msgid "GDNativeLibrary"
-msgstr "MeshLibrary.."
+msgstr "MeshLibrary..."
#: modules/gdnative/gdnative_library_singleton_editor.cpp
#, fuzzy
msgid "Library"
-msgstr "MeshLibrary.."
+msgstr "MeshLibrary..."
#: modules/gdnative/gdnative_library_singleton_editor.cpp
msgid "Status"
@@ -7514,6 +7532,10 @@ msgstr "設定"
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7567,6 +7589,10 @@ msgstr "專案"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -8173,10 +8199,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8259,12 +8295,20 @@ msgid "Invalid font size."
msgstr "無效字型"
#, fuzzy
-#~ msgid "Can't write file."
-#~ msgstr "無法新增資料夾"
+#~ msgid "Previous"
+#~ msgstr "上一個tab"
#~ msgid "Next"
#~ msgstr "下一個"
+#, fuzzy
+#~ msgid "Can't contain '/' or ':'"
+#~ msgstr "ä¸èƒ½é€£åˆ°ä¸»æ©Ÿï¼š"
+
+#, fuzzy
+#~ msgid "Can't write file."
+#~ msgstr "無法新增資料夾"
+
#~ msgid "Not found!"
#~ msgstr "找ä¸åˆ°!"
@@ -8415,7 +8459,7 @@ msgstr "無效字型"
#~ msgid "Cannot go into subdir:"
#~ msgstr "無法進入次è¦è³‡æ–™å¤¾"
-#~ msgid "Edit Connections.."
+#~ msgid "Edit Connections..."
#~ msgstr "編輯連接"
#~ msgid "Live Editing"
diff --git a/editor/translations/zh_TW.po b/editor/translations/zh_TW.po
index d212fa995f..38b565a37f 100644
--- a/editor/translations/zh_TW.po
+++ b/editor/translations/zh_TW.po
@@ -4,24 +4,27 @@
# This file is distributed under the same license as the Godot source code.
#
# Allen H <w84miracle@gmail.com>, 2017.
+# Billy SU <g4691821@gmail.com>, 2018.
# Chao Yu <casd82@gmail.com>, 2017.
# Cliffs Dover <bottle@dancingbottle.com>, 2017.
+# Kisaragi Hiu <mail@kisaragi-hiu.com>, 2018.
# Matt <chchwy@gmail.com>, 2017.
# popcade <popcade@gmail.com>, 2016.
+# Qing <icinriiq@gmail.com>, 2018.
# Sam Pan <sampan66@gmail.com>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine editor\n"
-"PO-Revision-Date: 2017-11-24 10:45+0000\n"
-"Last-Translator: Matt <chchwy@gmail.com>\n"
+"PO-Revision-Date: 2018-04-24 09:35+0000\n"
+"Last-Translator: Qing <icinriiq@gmail.com>\n"
"Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/"
"godot-engine/godot/zh_Hant/>\n"
"Language: zh_TW\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8-bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Weblate 2.18-dev\n"
+"X-Generator: Weblate 3.0-dev\n"
#: editor/animation_editor.cpp
msgid "Disabled"
@@ -38,20 +41,20 @@ msgstr "動畫更改座標"
#: editor/animation_editor.cpp
msgid "Anim Change Transition"
-msgstr ""
+msgstr "動畫更改轉場效果"
#: editor/animation_editor.cpp
msgid "Anim Change Transform"
msgstr "動畫更改座標"
#: editor/animation_editor.cpp
-#, fuzzy
msgid "Anim Change Keyframe Value"
-msgstr "動畫更改座標"
+msgstr "動畫更改關éµå¹€æ•¸å€¼"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Change Call"
-msgstr ""
+msgstr "動畫改變呼å«"
#: editor/animation_editor.cpp
msgid "Anim Add Track"
@@ -90,8 +93,9 @@ msgid "Anim Track Change Value Mode"
msgstr "動畫軌改變模å¼"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Track Change Wrap Mode"
-msgstr ""
+msgstr "å‹•ç•«è»Œé“æ›´æ”¹ç’°ç¹žæ¨¡å¼"
#: editor/animation_editor.cpp
msgid "Edit Node Curve"
@@ -112,7 +116,7 @@ msgstr "複製所é¸"
#: editor/animation_editor.cpp
msgid "Duplicate Transposed"
-msgstr ""
+msgstr "é‡è¤‡è½‰ç½®"
#: editor/animation_editor.cpp
msgid "Remove Selection"
@@ -177,7 +181,7 @@ msgstr "進出"
#: editor/animation_editor.cpp
msgid "Out-In"
-msgstr ""
+msgstr "外-內"
#: editor/animation_editor.cpp
msgid "Transitions"
@@ -212,28 +216,30 @@ msgid "Anim Create & Insert"
msgstr "動畫建立與æ’å…¥"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Insert Track & Key"
-msgstr ""
+msgstr "動畫新增軌跡與按éµ"
#: editor/animation_editor.cpp
msgid "Anim Insert Key"
-msgstr ""
+msgstr "動畫新增按éµ"
#: editor/animation_editor.cpp
msgid "Change Anim Len"
-msgstr ""
+msgstr "變更動畫長度"
#: editor/animation_editor.cpp
msgid "Change Anim Loop"
-msgstr ""
+msgstr "變更動畫迴圈"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim Create Typed Value Key"
-msgstr ""
+msgstr "動畫新增具類別之éµå€¼"
#: editor/animation_editor.cpp
msgid "Anim Insert"
-msgstr ""
+msgstr "æ’入動畫"
#: editor/animation_editor.cpp
msgid "Anim Scale Keys"
@@ -241,19 +247,19 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Anim Add Call Track"
-msgstr ""
+msgstr "動畫新增呼å«è»Œè·¡"
#: editor/animation_editor.cpp
msgid "Animation zoom."
-msgstr ""
+msgstr "動畫空間。"
#: editor/animation_editor.cpp
msgid "Length (s):"
-msgstr ""
+msgstr "長度(s):"
#: editor/animation_editor.cpp
msgid "Animation length (in seconds)."
-msgstr "動畫長度 (秒)"
+msgstr "動畫長度 (秒)。"
#: editor/animation_editor.cpp
msgid "Step (s):"
@@ -265,75 +271,77 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Enable/Disable looping in animation."
-msgstr ""
+msgstr "啟用/åœç”¨ 動畫迴圈。"
#: editor/animation_editor.cpp
msgid "Add new tracks."
-msgstr ""
+msgstr "新增動畫軌。"
#: editor/animation_editor.cpp
msgid "Move current track up."
-msgstr ""
+msgstr "上移當å‰å‹•畫軌。"
#: editor/animation_editor.cpp
msgid "Move current track down."
-msgstr ""
+msgstr "下移當å‰å‹•畫軌。"
#: editor/animation_editor.cpp
msgid "Remove selected track."
-msgstr ""
+msgstr "ç§»é™¤é¸æ“‡çš„動畫軌。"
#: editor/animation_editor.cpp
msgid "Track tools"
-msgstr ""
+msgstr "軌跡工具"
#: editor/animation_editor.cpp
msgid "Enable editing of individual keys by clicking them."
-msgstr ""
+msgstr "啟用å¯ä½¿ç”¨é»žæ“Šä¾†æ›´æ”¹å„個éµã€‚"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Anim. Optimizer"
-msgstr ""
+msgstr "動畫. 最佳化"
#: editor/animation_editor.cpp
msgid "Max. Linear Error:"
-msgstr ""
+msgstr "最大線性錯誤:"
#: editor/animation_editor.cpp
msgid "Max. Angular Error:"
-msgstr ""
+msgstr "最大角度錯誤:"
#: editor/animation_editor.cpp
msgid "Max Optimizable Angle:"
-msgstr ""
+msgstr "最大å¯å„ªåŒ–角度:"
#: editor/animation_editor.cpp
msgid "Optimize"
-msgstr ""
+msgstr "最佳化"
#: editor/animation_editor.cpp
+#, fuzzy
msgid "Select an AnimationPlayer from the Scene Tree to edit animations."
-msgstr ""
+msgstr "å¾žå ´æ™¯æ¨¹ä¸­é¸æ“‡ä¸€å€‹ AnimationPlayer 來編輯動畫。"
#: editor/animation_editor.cpp
msgid "Key"
-msgstr ""
+msgstr "éµ"
#: editor/animation_editor.cpp
msgid "Transition"
-msgstr ""
+msgstr "轉場"
#: editor/animation_editor.cpp
msgid "Scale Ratio:"
-msgstr ""
+msgstr "縮放比例:"
#: editor/animation_editor.cpp
msgid "Call Functions in Which Node?"
-msgstr ""
+msgstr "呼å«å“ªå€‹ç¯€é»žè£¡çš„函å¼?"
#: editor/animation_editor.cpp
msgid "Remove invalid keys"
-msgstr ""
+msgstr "移除無效按éµ"
#: editor/animation_editor.cpp
msgid "Remove unresolved and empty tracks"
@@ -341,27 +349,27 @@ msgstr ""
#: editor/animation_editor.cpp
msgid "Clean-up all animations"
-msgstr ""
+msgstr "清除所有動畫"
#: editor/animation_editor.cpp
msgid "Clean-Up Animation(s) (NO UNDO!)"
-msgstr ""
+msgstr "清除動畫 (無法復原!)"
#: editor/animation_editor.cpp
msgid "Clean-Up"
-msgstr ""
+msgstr "清除"
#: editor/array_property_edit.cpp
msgid "Resize Array"
-msgstr ""
+msgstr "調整陣列大å°"
#: editor/array_property_edit.cpp
msgid "Change Array Value Type"
-msgstr ""
+msgstr "調整陣列資料型態"
#: editor/array_property_edit.cpp
msgid "Change Array Value"
-msgstr ""
+msgstr "調整陣列資料"
#: editor/code_editor.cpp
msgid "Go to Line"
@@ -385,7 +393,7 @@ msgstr "符åˆå¤§å°å¯«"
#: editor/code_editor.cpp
msgid "Whole Words"
-msgstr ""
+msgstr "整個字"
#: editor/code_editor.cpp
msgid "Replace"
@@ -421,17 +429,17 @@ msgstr "列:"
#: editor/connections_dialog.cpp
msgid "Method in target Node must be specified!"
-msgstr ""
+msgstr "需指定在目標節點上的方法!"
#: editor/connections_dialog.cpp
msgid ""
"Target method not found! Specify a valid method or attach a script to target "
"Node."
-msgstr ""
+msgstr "找ä¸åˆ°ç›®æ¨™æ–¹æ³•! 指定一個å°çš„æ–¹æ³•或附加一個腳本到目標的節點上。"
#: editor/connections_dialog.cpp
msgid "Connect To Node:"
-msgstr ""
+msgstr "連接到節點:"
#: editor/connections_dialog.cpp editor/editor_autoload_settings.cpp
#: editor/groups_editor.cpp editor/plugins/item_list_editor_plugin.cpp
@@ -448,15 +456,15 @@ msgstr "移除"
#: editor/connections_dialog.cpp
msgid "Add Extra Call Argument:"
-msgstr ""
+msgstr "新增é¡å¤–呼å«åƒæ•¸:"
#: editor/connections_dialog.cpp
msgid "Extra Call Arguments:"
-msgstr ""
+msgstr "é¡å¤–呼å«åƒæ•¸:"
#: editor/connections_dialog.cpp
msgid "Path to Node:"
-msgstr ""
+msgstr "節點路徑:"
#: editor/connections_dialog.cpp
msgid "Make Function"
@@ -469,7 +477,7 @@ msgstr "å»¶é²"
#: editor/connections_dialog.cpp
msgid "Oneshot"
-msgstr ""
+msgstr "一次性"
#: editor/connections_dialog.cpp editor/dependency_editor.cpp
#: editor/export_template_manager.cpp
@@ -483,26 +491,26 @@ msgstr ""
#: editor/run_settings_dialog.cpp editor/settings_config_dialog.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Close"
-msgstr ""
+msgstr "關閉"
#: editor/connections_dialog.cpp
msgid "Connect"
-msgstr ""
+msgstr "連接"
#: editor/connections_dialog.cpp
msgid "Connect '%s' to '%s'"
-msgstr ""
+msgstr "連接 '%s' 到 '%s'"
#: editor/connections_dialog.cpp
msgid "Connecting Signal:"
-msgstr ""
+msgstr "連çµè¨Šè™Ÿ:"
#: editor/connections_dialog.cpp
msgid "Disconnect '%s' from '%s'"
-msgstr ""
+msgstr "將 '%s' 從 '%s' 中斷連接"
#: editor/connections_dialog.cpp
-msgid "Connect.."
+msgid "Connect..."
msgstr "連接..."
#: editor/connections_dialog.cpp
@@ -512,7 +520,7 @@ msgstr "æ–·ç·š"
#: editor/connections_dialog.cpp editor/editor_help.cpp editor/node_dock.cpp
msgid "Signals"
-msgstr ""
+msgstr "信號"
#: editor/create_dialog.cpp
#, fuzzy
@@ -522,7 +530,7 @@ msgstr "變更é¡é ­å°ºå¯¸"
#: editor/create_dialog.cpp editor/project_settings_editor.cpp
#: modules/visual_script/visual_script_editor.cpp
msgid "Change"
-msgstr ""
+msgstr "æ›´æ›"
#: editor/create_dialog.cpp
#, fuzzy
@@ -559,11 +567,11 @@ msgstr "æè¿°:"
#: editor/dependency_editor.cpp
msgid "Search Replacement For:"
-msgstr ""
+msgstr "尋找å–代目標:"
#: editor/dependency_editor.cpp
msgid "Dependencies For:"
-msgstr ""
+msgstr "ç›¸ä¾æ–¼:"
#: editor/dependency_editor.cpp
msgid ""
@@ -578,15 +586,17 @@ msgid ""
"Resource '%s' is in use.\n"
"Changes will take effect when reloaded."
msgstr ""
+"'%s' è³‡æºæ­£åœ¨ä½¿ç”¨ä¸­ã€‚\n"
+"è®Šæ›´æœƒåœ¨é‡æ–°è¼‰å…¥æ™‚套用。"
#: editor/dependency_editor.cpp
#: modules/gdnative/gdnative_library_editor_plugin.cpp
msgid "Dependencies"
-msgstr ""
+msgstr "相ä¾"
#: editor/dependency_editor.cpp
msgid "Resource"
-msgstr ""
+msgstr "資æº"
#: editor/dependency_editor.cpp editor/editor_autoload_settings.cpp
#: editor/project_manager.cpp editor/project_settings_editor.cpp
@@ -596,15 +606,15 @@ msgstr "路徑"
#: editor/dependency_editor.cpp
msgid "Dependencies:"
-msgstr ""
+msgstr "相ä¾:"
#: editor/dependency_editor.cpp
msgid "Fix Broken"
-msgstr ""
+msgstr "修復æå£žçš„"
#: editor/dependency_editor.cpp
msgid "Dependency Editor"
-msgstr ""
+msgstr "ç›¸ä¾æ€§ç·¨è¼¯å™¨"
#: editor/dependency_editor.cpp
msgid "Search Replacement Resource:"
@@ -619,7 +629,7 @@ msgstr "開啟"
#: editor/dependency_editor.cpp
msgid "Owners Of:"
-msgstr ""
+msgstr "æ“æœ‰è€…:"
#: editor/dependency_editor.cpp
msgid "Remove selected files from the project? (no undo)"
@@ -636,7 +646,7 @@ msgstr ""
#: editor/dependency_editor.cpp
msgid "Cannot remove:"
-msgstr ""
+msgstr "無法移除:"
#: editor/dependency_editor.cpp
msgid "Error loading:"
@@ -656,7 +666,7 @@ msgstr "該執行什麼æ“作呢?"
#: editor/dependency_editor.cpp
msgid "Fix Dependencies"
-msgstr ""
+msgstr "ä¿®å¾©ç›¸ä¾æ€§"
#: editor/dependency_editor.cpp
msgid "Errors loading!"
@@ -704,7 +714,7 @@ msgstr ""
#: editor/editor_about.cpp
msgid "Thanks!"
-msgstr ""
+msgstr "è¬è¬!"
#: editor/editor_about.cpp
msgid "Godot Engine contributors"
@@ -725,7 +735,7 @@ msgstr "專案創始人"
#: editor/editor_about.cpp
msgid "Developers"
-msgstr ""
+msgstr "開發者"
#: editor/editor_about.cpp
msgid "Authors"
@@ -761,7 +771,7 @@ msgstr ""
#: editor/editor_about.cpp
msgid "License"
-msgstr ""
+msgstr "授權"
#: editor/editor_about.cpp
msgid "Thirdparty License"
@@ -785,7 +795,7 @@ msgstr ""
#: editor/editor_about.cpp
msgid "Licenses"
-msgstr ""
+msgstr "授權"
#: editor/editor_asset_installer.cpp editor/project_manager.cpp
msgid "Error opening package file, not in zip format."
@@ -808,7 +818,7 @@ msgstr ""
#: editor/editor_asset_installer.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Install"
-msgstr ""
+msgstr "安è£"
#: editor/editor_asset_installer.cpp
msgid "Package Installer"
@@ -869,7 +879,7 @@ msgstr ""
#: editor/editor_audio_buses.cpp
msgid "Mute"
-msgstr ""
+msgstr "éœéŸ³"
#: editor/editor_audio_buses.cpp
msgid "Bypass"
@@ -926,11 +936,11 @@ msgid "Move Audio Bus"
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Save Audio Bus Layout As.."
+msgid "Save Audio Bus Layout As..."
msgstr ""
#: editor/editor_audio_buses.cpp
-msgid "Location for New Layout.."
+msgid "Location for New Layout..."
msgstr ""
#: editor/editor_audio_buses.cpp
@@ -981,11 +991,11 @@ msgstr ""
#: editor/editor_autoload_settings.cpp
msgid "Invalid name."
-msgstr ""
+msgstr "ä¸èƒ½ä½¿ç”¨çš„å稱。"
#: editor/editor_autoload_settings.cpp
msgid "Valid characters:"
-msgstr ""
+msgstr "åˆæ³•å­—å…ƒ:"
#: editor/editor_autoload_settings.cpp
msgid "Invalid name. Must not collide with an existing engine class name."
@@ -1059,19 +1069,19 @@ msgstr "å稱"
#: editor/editor_autoload_settings.cpp
msgid "Singleton"
-msgstr ""
+msgstr "單例"
#: editor/editor_data.cpp
msgid "Updating Scene"
msgstr "更新場景"
#: editor/editor_data.cpp
-msgid "Storing local changes.."
-msgstr "正在儲存變更.."
+msgid "Storing local changes..."
+msgstr "正在儲存變更..."
#: editor/editor_data.cpp
-msgid "Updating scene.."
-msgstr "更新場景中.."
+msgid "Updating scene..."
+msgstr "更新場景中..."
#: editor/editor_data.cpp
msgid "[empty]"
@@ -1141,7 +1151,7 @@ msgstr ""
#: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp
#, fuzzy
-msgid "New Folder.."
+msgid "New Folder..."
msgstr "新增資料夾"
#: editor/editor_file_dialog.cpp
@@ -1196,7 +1206,7 @@ msgstr "往上"
#: editor/editor_file_dialog.cpp
msgid "Toggle Hidden Files"
-msgstr ""
+msgstr "切æ›é¡¯ç¤ºéš±è—檔案"
#: editor/editor_file_dialog.cpp
msgid "Toggle Favorite"
@@ -1396,17 +1406,21 @@ msgstr "清除"
msgid "Clear Output"
msgstr "輸出:"
+#: editor/editor_node.cpp
+msgid "Project export failed with error code %d."
+msgstr ""
+
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
msgid "Error saving resource!"
msgstr ""
#: editor/editor_node.cpp editor/plugins/animation_player_editor_plugin.cpp
-msgid "Save Resource As.."
+msgid "Save Resource As..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/spatial_editor_plugin.cpp
#: editor/scene_tree_dock.cpp
-msgid "I see.."
+msgid "I see..."
msgstr "我知é“了"
#: editor/editor_node.cpp
@@ -1536,7 +1550,7 @@ msgstr ""
#: editor/editor_node.cpp
msgid "Expand all properties"
-msgstr ""
+msgstr "展開所有屬性"
#: editor/editor_node.cpp
msgid "Collapse all properties"
@@ -1612,11 +1626,11 @@ msgid "Open Base Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "Quick Open Scene.."
+msgid "Quick Open Scene..."
msgstr "快速開啟場景"
#: editor/editor_node.cpp
-msgid "Quick Open Script.."
+msgid "Quick Open Script..."
msgstr ""
#: editor/editor_node.cpp
@@ -1629,8 +1643,8 @@ msgid "Save changes to '%s' before closing?"
msgstr ""
#: editor/editor_node.cpp
-msgid "Save Scene As.."
-msgstr "å¦å­˜å ´æ™¯ç‚º.."
+msgid "Save Scene As..."
+msgstr "å¦å­˜å ´æ™¯ç‚º..."
#: editor/editor_node.cpp
msgid "No"
@@ -1653,17 +1667,17 @@ msgid "Export Mesh Library"
msgstr ""
#: editor/editor_node.cpp
-#, fuzzy
msgid "This operation can't be done without a root node."
-msgstr "æ­¤æ“作無法復原, 確定è¦é‚„原嗎?"
+msgstr "æ­¤æ“作無法在沒有根節點的情æ³ä¸‹é€²è¡Œã€‚"
#: editor/editor_node.cpp
msgid "Export Tile Set"
msgstr ""
#: editor/editor_node.cpp
+#, fuzzy
msgid "This operation can't be done without a selected node."
-msgstr ""
+msgstr "æ­¤æ“ä½œéœ€è¦æœ‰é¸æ“‡è‘—節點æ‰èƒ½é€²è¡Œã€‚"
#: editor/editor_node.cpp
msgid "Current scene not saved. Open anyway?"
@@ -1682,8 +1696,8 @@ msgid "This action cannot be undone. Revert anyway?"
msgstr "æ­¤æ“作無法復原, 確定è¦é‚„原嗎?"
#: editor/editor_node.cpp
-msgid "Quick Run Scene.."
-msgstr "快速執行場景.."
+msgid "Quick Run Scene..."
+msgstr "快速執行場景..."
#: editor/editor_node.cpp
msgid "Quit"
@@ -1813,7 +1827,7 @@ msgstr ""
#: editor/editor_node.cpp
#, fuzzy
msgid "Add a new scene."
-msgstr "更新場景中.."
+msgstr "更新場景中..."
#: editor/editor_node.cpp
#, fuzzy
@@ -1833,8 +1847,8 @@ msgid "Previous tab"
msgstr "上個分é "
#: editor/editor_node.cpp
-msgid "Filter Files.."
-msgstr "éŽæ¿¾æª”案.."
+msgid "Filter Files..."
+msgstr "éŽæ¿¾æª”案..."
#: editor/editor_node.cpp
msgid "Operations with scene files."
@@ -1845,12 +1859,12 @@ msgid "New Scene"
msgstr ""
#: editor/editor_node.cpp
-msgid "New Inherited Scene.."
+msgid "New Inherited Scene..."
msgstr ""
#: editor/editor_node.cpp
-msgid "Open Scene.."
-msgstr "開啟場景.."
+msgid "Open Scene..."
+msgstr "開啟場景..."
#: editor/editor_node.cpp
msgid "Save Scene"
@@ -1869,15 +1883,15 @@ msgid "Open Recent"
msgstr "開啟最近存å–"
#: editor/editor_node.cpp
-msgid "Convert To.."
-msgstr "è½‰æ›æˆ.."
+msgid "Convert To..."
+msgstr "è½‰æ›æˆ..."
#: editor/editor_node.cpp
-msgid "MeshLibrary.."
+msgid "MeshLibrary..."
msgstr ""
#: editor/editor_node.cpp
-msgid "TileSet.."
+msgid "TileSet..."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_text_editor.cpp
@@ -2123,7 +2137,7 @@ msgid "Save the currently edited resource."
msgstr ""
#: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp
-msgid "Save As.."
+msgid "Save As..."
msgstr ""
#: editor/editor_node.cpp
@@ -2152,8 +2166,9 @@ msgid "Import"
msgstr ""
#: editor/editor_node.cpp
+#, fuzzy
msgid "Node"
-msgstr ""
+msgstr "節點"
#: editor/editor_node.cpp
msgid "FileSystem"
@@ -2233,7 +2248,7 @@ msgid "Creating Mesh Previews"
msgstr ""
#: editor/editor_plugin.cpp
-msgid "Thumbnail.."
+msgid "Thumbnail..."
msgstr ""
#: editor/editor_plugin_settings.cpp
@@ -2384,7 +2399,7 @@ msgid "(Current)"
msgstr ""
#: editor/export_template_manager.cpp
-msgid "Retrieving mirrors, please wait.."
+msgid "Retrieving mirrors, please wait..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2400,12 +2415,6 @@ msgid "Invalid version.txt format inside templates."
msgstr ""
#: editor/export_template_manager.cpp
-msgid ""
-"Invalid version.txt format inside templates. Revision is not a valid "
-"identifier."
-msgstr ""
-
-#: editor/export_template_manager.cpp
msgid "No version.txt found inside templates."
msgstr ""
@@ -2470,7 +2479,7 @@ msgstr "載入場景時發生錯誤"
#: editor/export_template_manager.cpp
#, fuzzy
-msgid "Connecting to Mirror.."
+msgid "Connecting to Mirror..."
msgstr "連接..."
#: editor/export_template_manager.cpp
@@ -2489,7 +2498,7 @@ msgstr ""
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
-msgid "Connecting.."
+msgid "Connecting..."
msgstr "連接..."
#: editor/export_template_manager.cpp
@@ -2504,7 +2513,7 @@ msgstr "連接..."
#: editor/export_template_manager.cpp
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Requesting.."
+msgid "Requesting..."
msgstr ""
#: editor/export_template_manager.cpp
@@ -2644,11 +2653,11 @@ msgid "Collapse all"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Rename.."
+msgid "Rename..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Move To.."
+msgid "Move To..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2661,16 +2670,16 @@ msgid "Instance"
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "Edit Dependencies.."
+msgid "Edit Dependencies..."
msgstr ""
#: editor/filesystem_dock.cpp
-msgid "View Owners.."
+msgid "View Owners..."
msgstr ""
#: editor/filesystem_dock.cpp
#, fuzzy
-msgid "Duplicate.."
+msgid "Duplicate..."
msgstr "複製動畫關éµç•«æ ¼"
#: editor/filesystem_dock.cpp
@@ -2696,7 +2705,7 @@ msgstr ""
#: editor/filesystem_dock.cpp
msgid ""
"Scanning Files,\n"
-"Please Wait.."
+"Please Wait..."
msgstr ""
#: editor/filesystem_dock.cpp
@@ -2763,7 +2772,7 @@ msgid "Import Scene"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Importing Scene.."
+msgid "Importing Scene..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2775,7 +2784,7 @@ msgid "Generating for Mesh: "
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Running Custom Script.."
+msgid "Running Custom Script..."
msgstr ""
#: editor/import/resource_importer_scene.cpp
@@ -2791,7 +2800,7 @@ msgid "Error running post-import script:"
msgstr ""
#: editor/import/resource_importer_scene.cpp
-msgid "Saving.."
+msgid "Saving..."
msgstr ""
#: editor/import_dock.cpp
@@ -2811,7 +2820,7 @@ msgid "Import As:"
msgstr ""
#: editor/import_dock.cpp editor/property_editor.cpp
-msgid "Preset.."
+msgid "Preset..."
msgstr ""
#: editor/import_dock.cpp
@@ -3103,7 +3112,7 @@ msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
#, fuzzy
msgid "Edit Filters"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/plugins/animation_tree_editor_plugin.cpp
#: editor/plugins/multimesh_editor_plugin.cpp
@@ -3228,7 +3237,7 @@ msgid "Transition Node"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Import Animations.."
+msgid "Import Animations..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3236,7 +3245,7 @@ msgid "Edit Node Filters"
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
-msgid "Filters.."
+msgid "Filters..."
msgstr ""
#: editor/plugins/animation_tree_editor_plugin.cpp
@@ -3254,7 +3263,7 @@ msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
#, fuzzy
msgid "View Files"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "Can't resolve hostname:"
@@ -3305,7 +3314,7 @@ msgid "Fetching:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Resolving.."
+msgid "Resolving..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3334,8 +3343,9 @@ msgid "first"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
+#, fuzzy
msgid "prev"
-msgstr ""
+msgstr "é è¦½:"
#: editor/plugins/asset_library_editor_plugin.cpp
msgid "next"
@@ -3373,7 +3383,7 @@ msgid "Site:"
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
-msgid "Support.."
+msgid "Support..."
msgstr ""
#: editor/plugins/asset_library_editor_plugin.cpp
@@ -3562,6 +3572,7 @@ msgid "Use Rotation Snap"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+#: editor/plugins/spatial_editor_plugin.cpp
msgid "Configure Snap..."
msgstr ""
@@ -3658,6 +3669,14 @@ msgid "Show Guides"
msgstr ""
#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Origin"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
+msgid "Show Viewport"
+msgstr ""
+
+#: editor/plugins/canvas_item_editor_plugin.cpp
msgid "Center Selection"
msgstr ""
@@ -3948,6 +3967,10 @@ msgid "Mesh has not surface to create outlines from!"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
+msgid "Mesh primitive type is not PRIMITIVE_TRIANGLES!"
+msgstr ""
+
+#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Could not create outline!"
msgstr ""
@@ -3976,18 +3999,18 @@ msgid "Create Convex Collision Sibling"
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
-msgid "Create Outline Mesh.."
+msgid "Create Outline Mesh..."
msgstr ""
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
msgid "View UV1"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
#, fuzzy
msgid "View UV2"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/plugins/mesh_instance_editor_plugin.cpp
msgid "Unwrap UV2 for Lightmap/AO"
@@ -4128,7 +4151,7 @@ msgstr ""
#: editor/plugins/navigation_mesh_generator.cpp
#, fuzzy
msgid "Marking walkable triangles..."
-msgstr "正在儲存變更.."
+msgstr "正在儲存變更..."
#: editor/plugins/navigation_mesh_generator.cpp
msgid "Constructing compact heightfield..."
@@ -4184,7 +4207,7 @@ msgid "Error loading image:"
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
-msgid "No pixels with transparency > 128 in image.."
+msgid "No pixels with transparency > 128 in image..."
msgstr ""
#: editor/plugins/particles_2d_editor_plugin.cpp
@@ -4550,7 +4573,7 @@ msgid "Import Theme"
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
-msgid "Save Theme As.."
+msgid "Save Theme As..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4648,7 +4671,7 @@ msgstr ""
#: editor/plugins/script_editor_plugin.cpp
#: editor/plugins/script_text_editor.cpp
-msgid "Find.."
+msgid "Find..."
msgstr ""
#: editor/plugins/script_editor_plugin.cpp
@@ -4744,7 +4767,7 @@ msgstr ""
#: editor/plugins/script_text_editor.cpp
#, fuzzy
msgid "Convert Case"
-msgstr "è½‰æ›æˆ.."
+msgstr "è½‰æ›æˆ..."
#: editor/plugins/script_text_editor.cpp
msgid "Uppercase"
@@ -4848,27 +4871,27 @@ msgstr ""
#: editor/plugins/script_text_editor.cpp
#, fuzzy
msgid "Convert To Uppercase"
-msgstr "è½‰æ›æˆ.."
+msgstr "è½‰æ›æˆ..."
#: editor/plugins/script_text_editor.cpp
#, fuzzy
msgid "Convert To Lowercase"
-msgstr "è½‰æ›æˆ.."
+msgstr "è½‰æ›æˆ..."
#: editor/plugins/script_text_editor.cpp
msgid "Find Previous"
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Replace.."
+msgid "Replace..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Function.."
+msgid "Goto Function..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
-msgid "Goto Line.."
+msgid "Goto Line..."
msgstr ""
#: editor/plugins/script_text_editor.cpp
@@ -5058,7 +5081,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
msgid "Material Changes"
-msgstr "正在儲存變更.."
+msgstr "正在儲存變更..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Shader Changes"
@@ -5171,7 +5194,7 @@ msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
msgid "View FPS"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/plugins/spatial_editor_plugin.cpp
msgid "Half Resolution"
@@ -5325,11 +5348,7 @@ msgid "Transform"
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Configure Snap.."
-msgstr ""
-
-#: editor/plugins/spatial_editor_plugin.cpp
-msgid "Transform Dialog.."
+msgid "Transform Dialog..."
msgstr ""
#: editor/plugins/spatial_editor_plugin.cpp
@@ -5583,7 +5602,7 @@ msgid "Remove All"
msgstr "移除"
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Edit theme.."
+msgid "Edit theme..."
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5631,6 +5650,14 @@ msgid "Checked Item"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
+msgid "Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
+msgid "Checked Radio Item"
+msgstr ""
+
+#: editor/plugins/theme_editor_plugin.cpp
msgid "Has"
msgstr ""
@@ -5643,7 +5670,7 @@ msgid "Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
-msgid "Have,Many,Several,Options!"
+msgid "Has,Many,Options"
msgstr ""
#: editor/plugins/theme_editor_plugin.cpp
@@ -5834,7 +5861,7 @@ msgid "Presets"
msgstr ""
#: editor/project_export.cpp editor/project_settings_editor.cpp
-msgid "Add.."
+msgid "Add..."
msgstr ""
#: editor/project_export.cpp
@@ -5928,6 +5955,11 @@ msgstr ""
#: editor/project_manager.cpp
#, fuzzy
+msgid "Invalid Project Name."
+msgstr "ä¸èƒ½ä½¿ç”¨çš„å稱。"
+
+#: editor/project_manager.cpp
+#, fuzzy
msgid "Couldn't create folder."
msgstr "無法新增資料夾"
@@ -6118,7 +6150,9 @@ msgid "Mouse Button"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Invalid action (anything goes but '/' or ':')."
+msgid ""
+"Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or "
+"'\"'."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6146,7 +6180,7 @@ msgid "Control+"
msgstr ""
#: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp
-msgid "Press a Key.."
+msgid "Press a Key..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6264,10 +6298,6 @@ msgid "Delete Item"
msgstr "刪除"
#: editor/project_settings_editor.cpp
-msgid "Can't contain '/' or ':'"
-msgstr ""
-
-#: editor/project_settings_editor.cpp
msgid "Already existing"
msgstr ""
@@ -6338,7 +6368,7 @@ msgid "Property:"
msgstr ""
#: editor/project_settings_editor.cpp
-msgid "Override For.."
+msgid "Override For..."
msgstr ""
#: editor/project_settings_editor.cpp
@@ -6400,7 +6430,7 @@ msgstr ""
#: editor/project_settings_editor.cpp
#, fuzzy
msgid "Filter mode:"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/project_settings_editor.cpp
msgid "Locales:"
@@ -6435,11 +6465,11 @@ msgid "Easing Out-In"
msgstr ""
#: editor/property_editor.cpp
-msgid "File.."
+msgid "File..."
msgstr ""
#: editor/property_editor.cpp
-msgid "Dir.."
+msgid "Dir..."
msgstr ""
#: editor/property_editor.cpp
@@ -6469,7 +6499,7 @@ msgstr ""
#: editor/property_editor.cpp
#, fuzzy
msgid "Convert To %s"
-msgstr "è½‰æ›æˆ.."
+msgstr "è½‰æ›æˆ..."
#: editor/property_editor.cpp
msgid "Error loading file: Not a resource!"
@@ -6611,7 +6641,7 @@ msgid "This operation can't be done on instanced scenes."
msgstr ""
#: editor/scene_tree_dock.cpp
-msgid "Save New Scene As.."
+msgid "Save New Scene As..."
msgstr ""
#: editor/scene_tree_dock.cpp
@@ -6718,7 +6748,7 @@ msgstr ""
#: editor/scene_tree_dock.cpp
#, fuzzy
msgid "Filter nodes"
-msgstr "éŽæ¿¾æª”案.."
+msgstr "éŽæ¿¾æª”案..."
#: editor/scene_tree_dock.cpp
msgid "Attach a new or existing script for the selected node."
@@ -6806,7 +6836,7 @@ msgstr ""
#: editor/scene_tree_editor.cpp
msgid "Scene Tree (Nodes):"
-msgstr ""
+msgstr "場景樹 (節點):"
#: editor/scene_tree_editor.cpp
msgid "Node Configuration Warning!"
@@ -7340,6 +7370,10 @@ msgstr "專案設定"
msgid "Pick Distance:"
msgstr ""
+#: modules/mono/csharp_script.cpp
+msgid "Class name can't be a reserved keyword"
+msgstr ""
+
#: modules/mono/editor/godotsharp_editor.cpp
msgid "Generating solution..."
msgstr ""
@@ -7390,6 +7424,10 @@ msgstr "專案設定"
msgid "Warnings"
msgstr ""
+#: modules/mono/mono_gd/gd_mono_utils.cpp
+msgid "End of inner exception stack trace"
+msgstr ""
+
#: modules/visual_script/visual_script.cpp
msgid ""
"A node yielded without working memory, please read the docs on how to yield "
@@ -7989,10 +8027,20 @@ msgid "Path property must point to a valid Spatial node to work."
msgstr ""
#: scene/3d/scenario_fx.cpp
+msgid "WorldEnvironment needs an Environment resource."
+msgstr ""
+
+#: scene/3d/scenario_fx.cpp
msgid ""
"Only one WorldEnvironment is allowed per scene (or set of instanced scenes)."
msgstr ""
+#: scene/3d/scenario_fx.cpp
+msgid ""
+"This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set "
+"this environment's Background Mode to Canvas (for 2D scenes)."
+msgstr ""
+
#: scene/3d/sprite_3d.cpp
msgid ""
"A SpriteFrames resource must be created or set in the 'Frames' property in "
@@ -8011,20 +8059,19 @@ msgstr ""
#: scene/gui/color_picker.cpp
msgid "Add current color as a preset"
-msgstr ""
+msgstr "將目å‰é¡è‰²è¨­ç‚ºé è¨­"
#: scene/gui/dialogs.cpp
msgid "Alert!"
-msgstr ""
+msgstr "警告!"
#: scene/gui/dialogs.cpp
msgid "Please Confirm..."
-msgstr ""
+msgstr "請確èª..."
#: scene/gui/file_dialog.cpp
-#, fuzzy
msgid "Select this Folder"
-msgstr "åƒ…é¸æ“‡å€åŸŸ"
+msgstr "鏿“‡æ­¤è³‡æ–™å¤¾"
#: scene/gui/popup.cpp
msgid ""
@@ -8042,13 +8089,15 @@ msgstr ""
#: scene/gui/tree.cpp
msgid "(Other)"
-msgstr ""
+msgstr "(其它)"
#: scene/main/scene_tree.cpp
msgid ""
"Default Environment as specified in Project Settings (Rendering -> "
"Environment -> Default Environment) could not be loaded."
msgstr ""
+"在專案設定中的é è¨­ç’°å¢ƒ(Rendering -> Environment -> Default Environment)ä¸èƒ½è¢«"
+"載入"
#: scene/main/viewport.cpp
msgid ""
@@ -8074,6 +8123,10 @@ msgstr "讀å–字體錯誤。"
msgid "Invalid font size."
msgstr "無效的字體大å°ã€‚"
+#, fuzzy
+#~ msgid "Previous"
+#~ msgstr "上個分é "
+
#~ msgid "Next"
#~ msgstr "下一個"
@@ -8092,10 +8145,6 @@ msgstr "無效的字體大å°ã€‚"
#~ msgid "Skip"
#~ msgstr "è·³éŽ"
-#, fuzzy
-#~ msgid "preview"
-#~ msgstr "é è¦½:"
-
#~ msgid "List:"
#~ msgstr "列表:"
diff --git a/icon.png b/icon.png
index 29c4a7b8fc..6ad9b43117 100644
--- a/icon.png
+++ b/icon.png
Binary files differ
diff --git a/logo.png b/logo.png
index 8cf3e15ebc..60e2ee9532 100644
--- a/logo.png
+++ b/logo.png
Binary files differ
diff --git a/main/SCsub b/main/SCsub
index 5748bc38d2..0692175799 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -2,81 +2,149 @@
Import('env')
from compat import byte_to_str
-
+from collections import OrderedDict
def make_splash(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
- f = open(src, "rb")
- g = open(dst, "w")
- buf = f.read()
+ with open(src, "rb") as f:
+ buf = f.read()
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef BOOT_SPLASH_H\n")
- g.write("#define BOOT_SPLASH_H\n")
- g.write('static const Color boot_splash_bg_color = Color::html("#232323");\n')
- g.write("static const unsigned char boot_splash_png[] = {\n")
- for i in range(len(buf)):
- g.write(byte_to_str(buf[i]) + ",\n")
- g.write("};\n")
- g.write("#endif")
+ with open(dst, "w") as g:
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef BOOT_SPLASH_H\n")
+ g.write("#define BOOT_SPLASH_H\n")
+ g.write('static const Color boot_splash_bg_color = Color::html("#232323");\n')
+ g.write("static const unsigned char boot_splash_png[] = {\n")
+ for i in range(len(buf)):
+ g.write(byte_to_str(buf[i]) + ",\n")
+ g.write("};\n")
+ g.write("#endif")
def make_splash_editor(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
- f = open(src, "rb")
- g = open(dst, "w")
- buf = f.read()
-
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef BOOT_SPLASH_EDITOR_H\n")
- g.write("#define BOOT_SPLASH_EDITOR_H\n")
- g.write('static const Color boot_splash_editor_bg_color = Color::html("#232323");\n')
- g.write("static const unsigned char boot_splash_editor_png[] = {\n")
- for i in range(len(buf)):
- g.write(byte_to_str(buf[i]) + ",\n")
- g.write("};\n")
- g.write("#endif")
+ with open(src, "rb") as f:
+ buf = f.read()
+ with open(dst, "w") as g:
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef BOOT_SPLASH_EDITOR_H\n")
+ g.write("#define BOOT_SPLASH_EDITOR_H\n")
+ g.write('static const Color boot_splash_editor_bg_color = Color::html("#232323");\n')
+ g.write("static const unsigned char boot_splash_editor_png[] = {\n")
+ for i in range(len(buf)):
+ g.write(byte_to_str(buf[i]) + ",\n")
+ g.write("};\n")
+ g.write("#endif")
def make_app_icon(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
- f = open(src, "rb")
- g = open(dst, "w")
- buf = f.read()
+ with open(src, "rb") as f:
+ buf = f.read()
- g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#ifndef APP_ICON_H\n")
- g.write("#define APP_ICON_H\n")
- g.write("static const unsigned char app_icon_png[] = {\n")
- for i in range(len(buf)):
- g.write(byte_to_str(buf[i]) + ",\n")
- g.write("};\n")
- g.write("#endif")
+ with open(dst, "w") as g:
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef APP_ICON_H\n")
+ g.write("#define APP_ICON_H\n")
+ g.write("static const unsigned char app_icon_png[] = {\n")
+ for i in range(len(buf)):
+ g.write(byte_to_str(buf[i]) + ",\n")
+ g.write("};\n")
+ g.write("#endif")
+def make_default_controller_mappings(target, source, env):
+ dst = target[0].srcnode().abspath
+ g = open(dst, "w")
+
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#include \"default_controller_mappings.h\"\n")
+ g.write("#include \"typedefs.h\"\n")
+
+ # ensure mappings have a consistent order
+ platform_mappings = OrderedDict()
+ for src in source:
+ src_path = src.srcnode().abspath
+ with open(src_path, "r") as f:
+ # read mapping file and skip header
+ mapping_file_lines = f.readlines()[2:]
+
+ current_platform = None
+ for line in mapping_file_lines:
+ if not line:
+ continue
+ line = line.strip()
+ if len(line) == 0:
+ continue
+ if line[0] == "#":
+ current_platform = line[1:].strip()
+ if current_platform not in platform_mappings:
+ platform_mappings[current_platform] = {}
+ elif current_platform:
+ line_parts = line.split(",")
+ guid = line_parts[0]
+ if guid in platform_mappings[current_platform]:
+ g.write("// WARNING - DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format(src_path, current_platform, platform_mappings[current_platform][guid]))
+ valid_mapping = True
+ for input_map in line_parts[2:]:
+ if "+" in input_map or "-" in input_map or "~" in input_map:
+ g.write("// WARNING - DISCARDED UNSUPPORTED MAPPING TYPE FROM DATABASE {}: {} {}\n".format(src_path, current_platform, line))
+ valid_mapping = False
+ break
+ if valid_mapping:
+ platform_mappings[current_platform][guid] = line
+
+ platform_variables = {
+ "Linux": "#if X11_ENABLED",
+ "Windows": "#ifdef WINDOWS_ENABLED",
+ "Mac OS X": "#ifdef OSX_ENABLED",
+ "Android": "#if defined(__ANDROID__)",
+ "iOS": "#ifdef IPHONE_ENABLED",
+ "Javascript": "#ifdef JAVASCRIPT_ENABLED",
+ "UWP": "#ifdef UWP_ENABLED",
+ }
+
+ g.write("const char* DefaultControllerMappings::mappings[] = {\n")
+ for platform, mappings in platform_mappings.items():
+ variable = platform_variables[platform]
+ g.write("{}\n".format(variable))
+ for mapping in mappings.values():
+ g.write("\t\"{}\",\n".format(mapping))
+ g.write("#endif\n")
+
+ g.write("\tNULL\n};\n")
+ g.close()
env.main_sources = []
env.add_source_files(env.main_sources, "*.cpp")
+# order matters here. higher index controller database files write on top of lower index database files
+controller_databases = ["#main/gamecontrollerdb.txt", "#main/gamecontrollerdb_205.txt", "#main/gamecontrollerdb_204.txt", "#main/godotcontrollerdb.txt"]
+
+env.Depends("#main/default_controller_mappings.gen.cpp", controller_databases)
+env.CommandNoCache("#main/default_controller_mappings.gen.cpp", controller_databases, make_default_controller_mappings)
+
+env.main_sources.append("#main/default_controller_mappings.gen.cpp")
+
Export('env')
env.Depends("#main/splash.gen.h", "#main/splash.png")
-env.Command("#main/splash.gen.h", "#main/splash.png", make_splash)
+env.CommandNoCache("#main/splash.gen.h", "#main/splash.png", make_splash)
env.Depends("#main/splash_editor.gen.h", "#main/splash_editor.png")
-env.Command("#main/splash_editor.gen.h", "#main/splash_editor.png", make_splash_editor)
+env.CommandNoCache("#main/splash_editor.gen.h", "#main/splash_editor.png", make_splash_editor)
env.Depends("#main/app_icon.gen.h", "#main/app_icon.png")
-env.Command("#main/app_icon.gen.h", "#main/app_icon.png", make_app_icon)
+env.CommandNoCache("#main/app_icon.gen.h", "#main/app_icon.png", make_app_icon)
SConscript('tests/SCsub')
diff --git a/main/app_icon.png b/main/app_icon.png
index 1d75cdc710..cf31af18a4 100644
--- a/main/app_icon.png
+++ b/main/app_icon.png
Binary files differ
diff --git a/platform/javascript/power_javascript.h b/main/default_controller_mappings.h
index c0c564aa60..6319b875eb 100644
--- a/platform/javascript/power_javascript.h
+++ b/main/default_controller_mappings.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* power_javascript.h */
+/* default_controller_mappings.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,26 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_
-#define PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_
-
-#include "os/os.h"
-
-class PowerJavascript {
-private:
- int nsecs_left;
- int percent_left;
- OS::PowerState power_state;
-
- bool UpdatePowerInfo();
+#ifndef DEFAULT_CONTROLLER_MAPPINGS_H
+#define DEFAULT_CONTROLLER_MAPPINGS_H
+class DefaultControllerMappings {
public:
- PowerJavascript();
- virtual ~PowerJavascript();
-
- OS::PowerState get_power_state();
- int get_power_seconds_left();
- int get_power_percent_left();
+ static const char *mappings[];
};
-#endif /* PLATFORM_JAVASCRIPT_POWER_JAVASCRIPT_H_ */
+#endif // DEFAULT_CONTROLLER_MAPPINGS_H
diff --git a/main/gamecontrollerdb.txt b/main/gamecontrollerdb.txt
new file mode 100644
index 0000000000..80687bd037
--- /dev/null
+++ b/main/gamecontrollerdb.txt
@@ -0,0 +1,423 @@
+# Game Controller DB for SDL in 2.0.6 format
+# Source: https://github.com/gabomdq/SDL_GameControllerDB
+
+# Windows
+03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,
+03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,
+03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,
+03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,
+03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows,
+030000008f0e00001200000000000000,Acme,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,
+03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,
+030000006b1400000055000000000000,bigben ps3padstreetnew,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows,
+03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+030000005e0400008e02000000000000,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Windows,
+03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+030000004f04000023b3000000000000,Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+030000000d0f00008500000000000000,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008400000000000000,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,
+030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,
+03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,
+03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,
+030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000451300000010000000000000,Generic USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00004d00000000000000,HORIPAD3 A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,platform:Windows,
+030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Windows,
+03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Windows,
+03000000b50700001403000000000000,IMPACT BLACK,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+030000006f0e00002401000000000000,INJUSTICE FightStick for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,platform:Windows,
+030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008433000000000000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008483000000000000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b6,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000008305000031b0000000000000,MaxfireBlaze3,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,platform:Windows,
+03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows,
+0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,
+03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
+030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Windows,
+03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,
+030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,leftx:h0.6,lefty:h0.12,rightshoulder:b5,rightstick:a2,righttrigger:b7,rightx:h0.9,righty:h0.4,start:b9,x:b2,y:b3,platform:Windows,
+03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,platform:Windows,
+03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000008f0e00007530000000000000,PS (R) Gamepad,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
+03000000100800000100000000000000,PS1 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+03000000100800000300000000000000,PS2 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,
+03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,
+03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,
+03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,platform:Windows,
+03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,
+03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,
+03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,platform:Windows,
+03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,
+0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,
+0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,
+030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000006f0e00001e01000000000000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,platform:Windows,
+03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Windows,
+03000000300f00001101000000000000,saitek rumble pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,
+030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,
+03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,platform:Windows,
+030000008f0e00000800000000000000,SpeedLink Strike FX Wireless,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,platform:Windows,
+03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+030000004f04000015b3000000000000,Thrustmaster Dual Analog 2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,
+030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Windows,
+030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,
+03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
+03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+03000000380700006652000000000000,UnKnown,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Windows,
+03000000786901006e70000000000000,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+
+# Mac OS X
+03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,
+03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,
+03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X,
+030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X,
+03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000790000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
+030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,platform:Mac OS X,
+03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,
+03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,
+030000006d04000016c2000000020000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Mac OS X,
+0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Mac OS X,
+03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X,
+03000000d8140000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Mac OS X,
+030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
+030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Mac OS X,
+030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,
+030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,
+030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,platform:Mac OS X,
+03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Mac OS X,
+030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000005e0400008e02000001000000,Steam Virtual GamePad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+03000000110100002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,
+03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,platform:Mac OS X,
+03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,platform:Mac OS X,
+03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,
+03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,
+030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Mac OS X,
+030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Mac OS X,
+03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,platform:Mac OS X,
+050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,platform:Mac OS X,
+050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,platform:Mac OS X,
+030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e040000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,
+030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,
+030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,
+03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,
+03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+
+# Linux
+03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+05000000c82d00002038000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+03000000c82d00000190000011010000,8Bitdo NES30 Pro 8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,
+05000000c82d00003028000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,
+05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,
+05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,
+030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,platform:Linux,
+03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Linux,
+03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Linux,
+03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,
+03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,
+030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,
+0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00001f01000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys GamePad ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,platform:Linux,
+030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,
+0500000047532067616d657061640000,GS gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,platform:Linux,
+03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,platform:Linux,
+030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00006a00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00006b00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,platform:Linux,
+03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,
+050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,
+03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,platform:Linux,
+030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Linux,
+03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,
+03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,a:b0,b:b4,back:b6,guide:b8,leftshoulder:b9,leftstick:h0.8,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:h0.2,start:b7,x:b2,y:b5,platform:Linux,
+030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,platform:Linux,
+05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Linux,
+03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700003888000010010000,MadCatz PC USB Wired Stick 8838,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:a0,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,
+03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,
+030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,
+03000000250900006688000000010000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,platform:Linux,
+050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux,
+05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Linux,
+03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000005e0400000202000000010000,Old Xbox pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,
+05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,
+03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,
+03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c0500006802000000800000,PS3 Controller (Bluetooth),a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+05000000504c415953544154494f4e00,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,platform:Linux,
+030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,platform:Linux,
+030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,
+0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,
+0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,
+030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,
+03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,platform:Linux,
+03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,
+03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Linux,
+03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,platform:Linux,
+03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,
+05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000ad1b000038f0000090040000,Street Fighter IV FightStick TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,
+030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,
+030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Linux,
+030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,
+03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,platform:Linux,
+03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,platform:Linux,
+05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:Linux,
+0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
+03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Linux,
+03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,
+xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+
+# Android
+64633436313965656664373634323364,Microsoft X-Box 360 pad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,platform:Android,
+37336435666338653565313731303834,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
+4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
+61363931656135336130663561616264,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
+35643031303033326130316330353564,PS4 Controller,a:b1,b:b17,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,platform:Android,
+05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Android,
+5477696e20555342204a6f7973746963,Twin USB Joystick,a:b22,b:b21,back:b28,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,leftstick:b30,lefttrigger:b24,leftx:a0,lefty:a1,rightshoulder:b27,rightstick:b31,righttrigger:b25,rightx:a3,righty:a2,start:b29,x:b23,y:b20,platform:Android,
+34356136633366613530316338376136,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,x:b17,y:b2,platform:Android,
+
+# iOS
+4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:iOS,
+4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,platform:iOS,
+05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:iOS, \ No newline at end of file
diff --git a/main/gamecontrollerdb_204.txt b/main/gamecontrollerdb_204.txt
new file mode 100644
index 0000000000..7f3068d1b1
--- /dev/null
+++ b/main/gamecontrollerdb_204.txt
@@ -0,0 +1,269 @@
+# Game Controller DB for SDL in 2.0.4 format
+# Source: https://github.com/gabomdq/SDL_GameControllerDB
+
+# Windows
+02200090000000000000504944564944,8Bitdo NES30 PRO USB,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+20380900000000000000504944564944,8Bitdo NES30 PRO Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+10280900000000000000504944564944,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,
+8f0e1200000000000000504944564944,Acme,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,
+341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+c0111352000000000000504944564944,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,
+d81d0b00000000000000504944564944,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows,
+e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+5e048e02000000000000504944564944,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+791d0103000000000000504944564944,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+4f0423b3000000000000504944564944,Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+341a0108000000000000504944564944,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+0d0f8500000000000000504944564944,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+0d0f5e00000000000000504944564944,Fighting Commander 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:a3,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+0d0f5f00000000000000504944564944,Fighting Commander 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+0d0f8400000000000000504944564944,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+0d0f8700000000000000504944564944,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+0d0f8800000000000000504944564944,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,
+0d0f2700000000000000504944564944,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+79000600000000000000504944564944,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,
+28040140000000000000504944564944,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+45130010000000000000504944564944,Generic USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+0d0f4900000000000000504944564944,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+d8140862000000000000504944564944,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+0d0f4000000000000000504944564944,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+0d0f6e00000000000000504944564944,HORIPAD 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+0d0fee00000000000000504944564944,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+0d0f4d00000000000000504944564944,HORIPAD3 A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+25090017000000000000504944564944,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,platform:Windows,
+d81d0f00000000000000504944564944,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+d81d1000000000000000504944564944,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+83056020000000000000504944564944,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Windows,
+6f0e2401000000000000504944564944,INJUSTICE FightStick for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+49190204000000000000504944564944,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+38075032000000000000504944564944,Mad Catz FightPad PRO PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+38075082000000000000504944564944,Mad Catz FightPad PRO PS4,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+38078433000000000000504944564944,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+38078483000000000000504944564944,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b6,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+38078134000000000000504944564944,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+38078184000000000000504944564944,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+38078034000000000000504944564944,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+38078084000000000000504944564944,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+38078532000000000000504944564944,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+38073888000000000000504944564944,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+38071888000000000000504944564944,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+25090128000000000000504944564944,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,platform:Windows,
+79004318000000000000504944564944,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+8f0e1030000000000000504944564944,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows,
+2509e803000000000000504944564944,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,
+79000018000000000000504944564944,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+8f0e0d31000000000000504944564944,Multilaser JS071 USB,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+100801e5000000000000504944564944,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,leftx:a0,lefty:a1,rightx:a2,righty:a3,start:b9,platform:Windows,
+bd1215d0000000000000504944564944,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,
+4b12014d000000000000504944564944,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,leftx:h0.6,lefty:h0.12,rightshoulder:b5,rightstick:a2,righttrigger:b7,rightx:h0.9,righty:h0.4,start:b9,x:b2,y:b3,platform:Windows,
+36280100000000000000504944564944,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b15,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,start:b14,x:b1,y:b2,platform:Windows,
+4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,platform:Windows,
+120cf60e000000000000504944564944,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+8f0e0300000000000000504944564944,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+10080100000000000000504944564944,PS1 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+10080300000000000000504944564944,PS2 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,
+88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,
+25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,
+10008200000000000000504944564944,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+300f0011000000000000504944564944,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,platform:Windows,
+300f1611000000000000504944564944,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,
+222c0020000000000000504944564944,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Windows,
+300f1210000000000000504944564944,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,
+341a0104000000000000504944564944,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,platform:Windows,
+222c0223000000000000504944564944,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+222c0023000000000000504944564944,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+0d0f1100000000000000504944564944,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+0d0f6a00000000000000504944564944,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+0d0f6b00000000000000504944564944,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+0d0f8a00000000000000504944564944,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+0d0f8b00000000000000504944564944,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+0d0f7000000000000000504944564944,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+0d0f2200000000000000504944564944,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+00f00300000000000000504944564944,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,
+00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,
+6f0e1e01000000000000504944564944,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+300f1201000000000000504944564944,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,back:b5,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b9,rightx:a2,righty:a3,start:b4,x:b0,y:b1,platform:Windows,
+300f1001000000000000504944564944,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+9b280500000000000000504944564944,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,
+79001100000000000000504944564944,Sega Saturn Gamepad,a:b1,b:b2,leftshoulder:b6,lefttrigger:b3,leftx:a0,lefty:a4,rightshoulder:b7,righttrigger:b0,start:b8,x:b4,y:b5,platform:Windows,
+4c05cc09000000000000504944564944,Sony DualShock 4,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+4c05a00b000000000000504944564944,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+ff113133000000000000504944564944,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,platform:Windows,
+4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,
+4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Windows,
+66660488000000000000504944564944,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
+38076652000000000000504944564944,UnKnown,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+63252305000000000000504944564944,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+79001b18000000000000504944564944,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+
+# Mac OS X
+10280000000000000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+830500000000000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+79000000000000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Mac OS X,
+AD1B00000000000001F9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
+0d0f0000000000004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+0d0f0000000000006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+83050000000000006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,
+6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+2509000000000000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Mac OS X,
+79000000000000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X,
+d814000000000000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,
+8f0e0000000000000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Mac OS X,
+4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,
+4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+891600000000000000fd000000000000,Razer Onza Tournament,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+79000000000000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+81170000000000007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,platform:Mac OS X,
+b4040000000000000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Mac OS X,
+351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+4c05000000000000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+4c05000000000000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,
+11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,
+4f0400000000000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Mac OS X,
+4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Mac OS X,
+bd1200000000000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+10080000000000000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,platform:Mac OS X,
+050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,platform:Mac OS X,
+050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,platform:Mac OS X,
+5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+5e04000000000000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+5e04000000000000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,
+5e04000000000000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+
+# Linux
+05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,
+05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,
+030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,
+030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,
+03000000260900008888000000010000,GameCube {WiseGroup USB box},a:b0,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b1,y:b3,platform:Linux,
+0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00001f01000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick ,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick ,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,
+03000000ff1100004133000010010000,GreenAsia Inc.USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,platform:Linux,
+03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,platform:Linux,
+030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,
+03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,platform:Linux,
+030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Linux,
+03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,
+03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000016c2000011010000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000016c2000010010000,Logitech Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,platform:Linux,
+05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Linux,
+03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,
+030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000dd02000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,
+030000001008000001e5000010010000,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,leftx:a0,lefty:a1,rightx:a2,righty:a3,start:b9,platform:Linux,
+050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,
+05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,
+03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+050000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+05000000504c415953544154494f4e00,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,platform:Linux,
+030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000790000001100000010010000,RetroLink Saturn Classic Controller,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,
+0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,
+0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,
+030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,platform:Linux,
+03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,
+03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,platform:Linux,
+030000004c050000c405000011810000,Sony DualShock 4,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c050000cc09000000810000,Sony DualShock 4 (CUH-ZCT2U) (Bluetooth),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c050000cc09000011810000,Sony DualShock 4 (CUH-ZCT2U) (USB),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c050000cc09000011010000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+050000004c050000cc09000000010000,Sony DualShock 4 V2 BT,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c050000a00b000011010000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,
+030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,
+030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Linux,
+030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,
+03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,platform:Linux,
+03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000d102000001010000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,
+xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+
+# Android
+4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
+
+# iOS
+4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:iOS,
+4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,platform:iOS, \ No newline at end of file
diff --git a/main/gamecontrollerdb_205.txt b/main/gamecontrollerdb_205.txt
new file mode 100644
index 0000000000..4c3eae623c
--- /dev/null
+++ b/main/gamecontrollerdb_205.txt
@@ -0,0 +1,337 @@
+# Game Controller DB for SDL in 2.0.5 format
+# Source: https://github.com/gabomdq/SDL_GameControllerDB
+
+# Windows
+xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows,
+78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,
+6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,platform:Windows,
+4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,
+341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,
+10280900000000000000504944564944,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,
+03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,platform:Windows,
+03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
+03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows,
+03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,
+03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,
+03000000b50700001403000000000000,IMPACT BLACK,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000a30600000cff000000000000,Saitek P2500,a:b2,b:b3,back:b5,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b9,rightx:a2,righty:a3,start:b4,x:b0,y:b1,platform:Windows,
+03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,
+030000008f0e00007530000000000000,PS (R) Gamepad,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000008f0e00001200000000000000,Acme,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Windows,
+030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows,
+030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000008f0e00000800000000000000,SpeedLink Strike FX Wireless,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+03000000888800000803000000000000,PS3,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Windows,
+03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Windows,
+030000008305000031b0000000000000,MaxfireBlaze3,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000790000004318000000000000,Mayflash GameCube Controller Adapter,a:b1,b:b2,back:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b4,leftstick:b0,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b0,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000790000001100000000000000,Sega Saturn Gamepad,a:b1,b:b2,leftshoulder:b6,lefttrigger:b3,leftx:a0,lefty:a4,rightshoulder:b7,righttrigger:b0,start:b8,x:b4,y:b5,platform:Windows,
+03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,
+03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000786901006e70000000000000,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+030000006f0e00002401000000000000,INJUSTICE FightStick for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000006f0e00001e01000000000000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000006d04000019c2000000000000,Logitech Cordless RumblePad 2 USB,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000006d04000018c2000000000000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000006d04000016c2000000000000,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,platform:Windows,
+030000006b1400000055000000000000,bigben ps3padstreetnew,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows,
+03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows,
+03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
+030000005e0400008e02000000000000,Controller (XBOX 360 For Windows),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+030000004f04000023b3000000000000,Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004f04000015b3000000000000,Thrustmaster Dual Analog 2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,
+030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,
+030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Windows,
+030000004c050000cc09000000000000,Sony DualShock 4,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows,
+030000004b120000014d000000000000,NYKO AIRFLO,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a3,leftstick:a0,lefttrigger:b6,leftx:h0.6,lefty:h0.12,rightshoulder:b5,rightstick:a2,righttrigger:b7,rightx:h0.9,righty:h0.4,start:b9,x:b2,y:b3,platform:Windows,
+03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+03000000451300000010000000000000,Generic USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008483000000000000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b6,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008433000000000000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700006652000000000000,UnKnown,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700005082000000000000,Mad Catz FightPad PRO PS4,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700005032000000000000,Mad Catz FightPad PRO PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000362800000100000000000000,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b15,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,start:b14,x:b1,y:b2,platform:Windows,
+03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,platform:Windows,
+03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,platform:Windows,
+03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,
+03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,platform:Windows,
+03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000300f00001101000000000000,saitek rumble pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Windows,
+03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,platform:Windows,
+03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,
+0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows,
+03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,platform:Windows,
+03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,platform:Windows,
+03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,platform:Windows,
+03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Windows,
+03000000203800000900000000000000,8Bitdo NES30 PRO Wireless,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Windows,
+03000000100800000300000000000000,PS2 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+030000001008000001e5000000000000,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,leftx:a0,lefty:a1,rightx:a2,righty:a3,start:b9,platform:Windows,
+03000000100800000100000000000000,PS1 USB,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows,
+03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,platform:Windows,
+030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008500000000000000,Fighting Commander 2016 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00008400000000000000,Fighting Commander 5,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006e00000000000000,HORIPAD 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005f00000000000000,Fighting Commander 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005e00000000000000,Fighting Commander 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:a3,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00004d00000000000000,HORIPAD3 A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
+030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,
+03000000022000000090000000000000,8Bitdo NES30 PRO USB,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
+0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,
+0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Windows,
+0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,platform:Windows,
+
+# Mac OS X
+830500000000000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,
+351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,
+11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,platform:Mac OS X,
+10280000000000000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,platform:Mac OS X,
+050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,platform:Mac OS X,
+0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
+03000000d8140000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,
+03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Mac OS X,
+03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Mac OS X,
+030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Mac OS X,
+03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,platform:Mac OS X,
+03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000790000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Mac OS X,
+03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X,
+030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e040000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X,
+030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,
+030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Mac OS X,
+030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Mac OS X,
+030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Mac OS X,
+030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Mac OS X,
+03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
+03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,platform:Mac OS X,
+030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
+
+# Linux
+xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,
+05000000c82d00002038000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,
+05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Linux,
+050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+05000000504c415953544154494f4e00,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+050000004c050000cc09000000810000,Sony DualShock 4 (CUH-ZCT2U) (Bluetooth),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+050000004c0500006802000000810000,Sony PLAYSTATION(R)3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+050000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+0500000047532067616d657061640000,GS gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,
+05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Linux,
+050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux,
+05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+03000000ff1100004133000010010000,GreenAsia Inc.USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,platform:Linux,
+03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
+03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,platform:Linux,
+03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,platform:Linux,
+03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+03000000c82d00000190000011010000,8Bitdo NES30 Pro 8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,
+03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,
+03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,platform:Linux,
+03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Linux,
+03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,
+03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Linux,
+03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
+03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,platform:Linux,
+03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,platform:Linux,
+030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,platform:Linux,
+030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux,
+030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,
+03000000790000001100000010010000,RetroLink Saturn Classic Controller,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Linux,
+03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,platform:Linux,
+03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux,
+03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,
+030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006f0e00001f01000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:a0,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:a3,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,platform:Linux,
+030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000016c2000011010000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000016c2000010010000,Logitech Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,platform:Linux,
+03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Linux,
+03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+030000005e040000dd02000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000d102000001010000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000005e0400000202000000010000,Old Xbox pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
+03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,
+030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Linux,
+030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,platform:Linux,
+030000004c050000cc09000011810000,Sony DualShock 4 (CUH-ZCT2U) (USB),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c050000c405000011810000,Sony DualShock 4,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c050000a00b000011010000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+030000004c0500006802000011810000,Sony PLAYSTATION(R)3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,platform:Linux,
+030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Linux,
+03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700003888000010010000,MadCatz PC USB Wired Stick 8838,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:a0,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
+03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
+03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,platform:Linux,
+03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,
+03000000280400000140000000010000,Gravis GamePad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+03000000260900008888000000010000,GameCube {WiseGroup USB box},a:b0,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b1,y:b3,platform:Linux,
+03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Linux,
+03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+030000001008000001e5000010010000,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,leftx:a0,lefty:a1,rightx:a2,righty:a3,start:b9,platform:Linux,
+03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
+03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
+030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
+030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,platform:Linux,
+0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,
+0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,platform:Linux,
+0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
+0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:Linux,
+
+# Android
+4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android,
+
+# iOS
+4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,platform:iOS,
+4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,platform:iOS,
diff --git a/main/godotcontrollerdb.txt b/main/godotcontrollerdb.txt
new file mode 100644
index 0000000000..031a761f30
--- /dev/null
+++ b/main/godotcontrollerdb.txt
@@ -0,0 +1,38 @@
+# Game Controller DB for SDL in 2.0.6 format
+# Source: https://github.com/godotengine/godot
+
+# Windows
+9000318000000000000504944564944,Mayflash Wiimote PC Adapter,a:b2,b:h0.4,x:b0,y:b1,back:b4,start:b5,guide:b11,leftshoulder:b6,rightshoulder:b3,leftx:a0,lefty:a1,platform:Windows,
+c911f055000000000000504944564944,GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
+__XINPUT_DEVICE__,XInput Gamepad,a:b12,b:b13,x:b14,y:b15,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpdown:b1,dpleft:b2,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Windows,
+
+# Linux
+030000005e040000e302000003020000,Microsoft X-Box One Elite pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+030000006f0e00001302000000010000,Afterglow Gamepad for Xbox 360,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
+05000000362800000100000004010000,OUYA Game Controller,leftx:a0,lefty:a1,dpdown:b9,rightstick:b7,rightshoulder:b5,rightx:a3,start:b16,righty:a4,dpleft:b10,lefttrigger:b12,x:b1,dpup:b8,back:b14,leftstick:b6,leftshoulder:b4,y:b2,a:b0,dpright:b11,righttrigger:b13,b:b3,platform:Windows,
+030000005e0400001907000000010000,X360 Wireless Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:h0.8,lefttrigger:a2,x:b2,dpup:h0.1,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,platform:Windows,
+030000005e0400008e02000001000000,Microsoft X-Box 360 pad,leftstick:b9,leftx:a0,lefty:a1,dpdown:h0.1,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:h0.2,lefttrigger:a2,x:b2,dpup:h0.4,back:b6,leftshoulder:b4,y:b3,a:b0,dpright:h0.8,righttrigger:a5,b:b1,platform:Windows,
+03000000fd0500002a26000000010000,3dfx InterAct HammerHead FX,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b5,rightshoulder:b7,rightx:a2,start:b11,righty:a3,dpleft:h0.8,lefttrigger:b8,x:b0,dpup:h0.1,back:b10,leftstick:b2,leftshoulder:b6,y:b1,a:b3,dpright:h0.2,righttrigger:b9,b:b4,platform:Windows,
+030000006f0e00002801000011010000,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:h0.8,lefttrigger:b6,x:b0,dpup:h0.1,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,dpright:h0.2,righttrigger:b7,b:b2,platform:Windows,
+030000000d0f00004d00000011010000,HORI Gem Pad 3,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,platform:Windows,
+
+# Android
+4f5559412047616d6520436f6e74726f,OUYA Game Controller,leftx:a1,lefty:a3,dpdown:b12,rightstick:b8,rightshoulder:b10,rightx:a6,start:b-86,righty:a7,dpleft:b13,lefttrigger:b15,x:b2,dpup:b11,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:b14,righttrigger:b16,b:b1,platform:Windows,
+Default Android Gamepad,Default Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,back:b4,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,platform:Windows,
+532e542e442e20496e74657261637420,3dfx InterAct HammerHead FX,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b25,rightshoulder:b27,rightx:a2,start:b31,righty:a3,dpleft:h0.8,lefttrigger:b28,x:b20,dpup:h0.1,back:b30,leftstick:b22,leftshoulder:b26,y:b21,a:b23,dpright:h0.2,righttrigger:b29,b:b24,platform:Windows,
+506572666f726d616e63652044657369,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b6,rightshoulder:b18,rightx:a2,start:b16,righty:a3,dpleft:h0.8,lefttrigger:b9,x:b0,dpup:h0.1,back:h0.2,leftstick:b4,leftshoulder:b3,y:b2,a:b1,dpright:h0.2,righttrigger:b10,b:b17,platform:Windows,
+4d6963726f736f667420582d426f7820,Microsoft X-Box 360 pad,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,platform:Windows,
+484f524920434f2e2c4c544420205041,Hori Gem Pad 3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b6,rightshoulder:b18,rightx:a2,start:b16,righty:a3,dpleft:h0.8,lefttrigger:b9,x:b0,dpup:h0.1,back:b15,leftstick:b4,leftshoulder:b3,y:b2,a:b1,dpright:h0.2,righttrigger:b10,b:b17,platform:Windows,
+47656e6572696320582d426f78207061,Logitech F-310,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a5,x:b2,dpup:h0.1,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a4,b:b1,platform:Windows,
+
+# Javascript
+Default HTML5 Gamepad, Default Mapping,leftx:a0,lefty:a1,dpdown:b13,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:b14,lefttrigger:a6,x:b2,dpup:b12,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:b15,righttrigger:a7,b:b1,platform:Windows,
+c2a94d6963726f736f66742058626f78,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,platform:Windows,
+303534632d303563342d576972656c65,PS4 Controller USB/Win,leftx:a0,lefty:a1,dpdown:b15,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,lefttrigger:a3,x:b0,dpup:b14,dpleft:b16,dpright:b17,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,righttrigger:b7,b:b2,platform:Windows,
+303534632d303563342d536f6e792043,PS4 Controller USB/Linux,leftx:a0,lefty:a1,dpdown:a7,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,dpleft:a6,lefttrigger:a3,x:b0,dpup:a7,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,dpright:a6,righttrigger:a4,b:b2,platform:Windows,
+303534632d303236382d536f6e792050,PS3 Controller USB/Linux,leftx:a0,lefty:a1,dpdown:b6,rightstick:b2,rightshoulder:b11,rightx:a2,start:b3,righty:a3,dpleft:b7,lefttrigger:b8,x:b15,dpup:b4,back:b0,leftstick:b1,leftshoulder:b10,y:b12,a:b14,dpright:b5,righttrigger:b9,b:b13,platform:Windows,
+303435652d303731392d58626f782033,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,platform:Windows,
+303435652d303238652d4d6963726f73,Wired X360 Controller,leftx:a0,lefty:a1,dpdown:a7,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:a6,lefttrigger:a2,x:b2,dpup:a7,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:a6,righttrigger:a5,b:b1,platform:Windows,
+
+# UWP
+__UWP_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Windows, \ No newline at end of file
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 323748346a..29d30110e3 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -30,6 +30,7 @@
#include "input_default.h"
+#include "default_controller_mappings.h"
#include "input_map.h"
#include "os/os.h"
#include "scene/resources/texture.h"
@@ -126,6 +127,14 @@ bool InputDefault::is_action_just_released(const StringName &p_action) const {
}
}
+float InputDefault::get_action_strength(const StringName &p_action) const {
+ const Map<StringName, Action>::Element *E = action_state.find(p_action);
+ if (!E)
+ return 0.0f;
+
+ return E->get().strength;
+}
+
float InputDefault::get_joy_axis(int p_device, int p_axis) const {
_THREAD_SAFE_METHOD_
@@ -185,8 +194,6 @@ void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_
Joypad js;
js.name = p_connected ? p_name : "";
js.uid = p_connected ? p_guid : "";
- js.mapping = -1;
- js.hat_current = 0;
if (p_connected) {
@@ -249,6 +256,11 @@ Vector3 InputDefault::get_gyroscope() const {
void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
+ _parse_input_event_impl(p_event, false);
+}
+
+void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) {
+
_THREAD_SAFE_METHOD_
Ref<InputEventKey> k = p_event;
@@ -272,25 +284,30 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
mouse_button_mask &= ~(1 << (mb->get_button_index() - 1));
}
- if (main_loop && emulate_touch && mb->get_button_index() == 1) {
+ Point2 pos = mb->get_global_position();
+ if (mouse_pos != pos) {
+ set_mouse_position(pos);
+ }
+
+ if (main_loop && emulate_touch_from_mouse && !p_is_emulated && mb->get_button_index() == 1) {
Ref<InputEventScreenTouch> touch_event;
touch_event.instance();
touch_event->set_pressed(mb->is_pressed());
touch_event->set_position(mb->get_position());
main_loop->input_event(touch_event);
}
-
- Point2 pos = mb->get_global_position();
- if (mouse_pos != pos) {
- set_mouse_position(pos);
- }
}
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
- if (main_loop && emulate_touch && mm->get_button_mask() & 1) {
+ Point2 pos = mm->get_global_position();
+ if (mouse_pos != pos) {
+ set_mouse_position(pos);
+ }
+
+ if (main_loop && emulate_touch_from_mouse && !p_is_emulated && mm->get_button_mask() & 1) {
Ref<InputEventScreenDrag> drag_event;
drag_event.instance();
@@ -302,6 +319,58 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
}
}
+ if (emulate_mouse_from_touch) {
+
+ Ref<InputEventScreenTouch> st = p_event;
+
+ if (st.is_valid()) {
+ bool translate = false;
+ if (st->is_pressed()) {
+ if (mouse_from_touch_index == -1) {
+ translate = true;
+ mouse_from_touch_index = st->get_index();
+ }
+ } else {
+ if (st->get_index() == mouse_from_touch_index) {
+ translate = true;
+ mouse_from_touch_index = -1;
+ }
+ }
+
+ if (translate) {
+ Ref<InputEventMouseButton> button_event;
+ button_event.instance();
+
+ button_event->set_position(st->get_position());
+ button_event->set_global_position(st->get_position());
+ button_event->set_pressed(st->is_pressed());
+ button_event->set_button_index(BUTTON_LEFT);
+ if (st->is_pressed()) {
+ button_event->set_button_mask(mouse_button_mask | (1 << BUTTON_LEFT - 1));
+ } else {
+ button_event->set_button_mask(mouse_button_mask & ~(1 << BUTTON_LEFT - 1));
+ }
+
+ _parse_input_event_impl(button_event, true);
+ }
+ }
+
+ Ref<InputEventScreenDrag> sd = p_event;
+
+ if (sd.is_valid() && sd->get_index() == mouse_from_touch_index) {
+ Ref<InputEventMouseMotion> motion_event;
+ motion_event.instance();
+
+ motion_event->set_position(sd->get_position());
+ motion_event->set_global_position(sd->get_position());
+ motion_event->set_relative(sd->get_relative());
+ motion_event->set_speed(sd->get_speed());
+ motion_event->set_button_mask(mouse_button_mask);
+
+ _parse_input_event_impl(motion_event, true);
+ }
+ }
+
Ref<InputEventJoypadButton> jb = p_event;
if (jb.is_valid()) {
@@ -329,16 +398,18 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
}
}
- if (!p_event->is_echo()) {
- for (const Map<StringName, InputMap::Action>::Element *E = InputMap::get_singleton()->get_action_map().front(); E; E = E->next()) {
+ for (const Map<StringName, InputMap::Action>::Element *E = InputMap::get_singleton()->get_action_map().front(); E; E = E->next()) {
+ if (InputMap::get_singleton()->event_is_action(p_event, E->key())) {
- if (InputMap::get_singleton()->event_is_action(p_event, E->key()) && is_action_pressed(E->key()) != p_event->is_pressed()) {
+ // Save the action's state
+ if (!p_event->is_echo() && is_action_pressed(E->key()) != p_event->is_action_pressed(E->key())) {
Action action;
action.physics_frame = Engine::get_singleton()->get_physics_frames();
action.idle_frame = Engine::get_singleton()->get_idle_frames();
- action.pressed = p_event->is_pressed();
+ action.pressed = p_event->is_action_pressed(E->key());
action_state[E->key()] = action;
}
+ action_state[E->key()].strength = p_event->get_action_strength(E->key());
}
}
@@ -412,10 +483,6 @@ void InputDefault::set_mouse_position(const Point2 &p_posf) {
mouse_speed_track.update(p_posf - mouse_pos);
mouse_pos = p_posf;
- if (custom_cursor.is_valid()) {
- //removed, please insist that we implement hardware cursors
- // VisualServer::get_singleton()->cursor_set_pos(get_mouse_position());
- }
}
Point2 InputDefault::get_mouse_position() const {
@@ -488,25 +555,59 @@ void InputDefault::action_release(const StringName &p_action) {
action_state[p_action] = action;
}
-void InputDefault::set_emulate_touch(bool p_emulate) {
+void InputDefault::set_emulate_touch_from_mouse(bool p_emulate) {
- emulate_touch = p_emulate;
+ emulate_touch_from_mouse = p_emulate;
}
-bool InputDefault::is_emulating_touchscreen() const {
+bool InputDefault::is_emulating_touch_from_mouse() const {
- return emulate_touch;
+ return emulate_touch_from_mouse;
+}
+
+// Calling this whenever the game window is focused helps unstucking the "touch mouse"
+// if the OS or its abstraction class hasn't properly reported that touch pointers raised
+void InputDefault::ensure_touch_mouse_raised() {
+
+ if (mouse_from_touch_index != -1) {
+ mouse_from_touch_index = -1;
+
+ Ref<InputEventMouseButton> button_event;
+ button_event.instance();
+
+ button_event->set_position(mouse_pos);
+ button_event->set_global_position(mouse_pos);
+ button_event->set_pressed(false);
+ button_event->set_button_index(BUTTON_LEFT);
+ button_event->set_button_mask(mouse_button_mask & ~(1 << BUTTON_LEFT - 1));
+
+ _parse_input_event_impl(button_event, true);
+ }
+}
+
+void InputDefault::set_emulate_mouse_from_touch(bool p_emulate) {
+
+ emulate_mouse_from_touch = p_emulate;
+}
+
+bool InputDefault::is_emulating_mouse_from_touch() const {
+
+ return emulate_mouse_from_touch;
+}
+
+Input::CursorShape InputDefault::get_default_cursor_shape() {
+ return default_shape;
+}
+
+void InputDefault::set_default_cursor_shape(CursorShape p_shape) {
+ default_shape = p_shape;
+ OS::get_singleton()->set_cursor_shape((OS::CursorShape)p_shape);
}
void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
if (Engine::get_singleton()->is_editor_hint())
return;
- if (custom_cursor == p_cursor)
- return;
-
- custom_cursor = p_cursor;
-
OS::get_singleton()->set_custom_mouse_cursor(p_cursor, (OS::CursorShape)p_shape, p_hotspot);
}
@@ -525,296 +626,12 @@ void InputDefault::set_mouse_in_window(bool p_in_window) {
*/
}
-// from github.com/gabomdq/SDL_GameControllerDB
-static const char *s_ControllerMappings[] = {
-#ifdef WINDOWS_ENABLED
- "00f00300000000000000504944564944,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "00f0f100000000000000504944564944,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "02200090000000000000504944564944,8Bitdo NES30 PRO USB,a:b0,b:b1,x:b3,y:b4,leftshoulder:b6,rightshoulder:b7,lefttrigger:b8,righttrigger:b9,back:b10,start:b11,leftstick:b13,rightstick:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
- "03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
- "0d0f1100000000000000504944564944,REAL ARCADE PRO.3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "0d0f2200000000000000504944564944,REAL ARCADE Pro.V3,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "0d0f2700000000000000504944564944,FIGHTING STICK V3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "0d0f4000000000000000504944564944,Hori Fighting Stick Mini 3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b5,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b4,righttrigger:b6,",
- "0d0f4900000000000000504944564944,Hatsune Miku Sho Controller,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "0d0f4d00000000000000504944564944,HORIPAD3 A,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "0d0f5e00000000000000504944564944,Fighting Commander 4,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b5,rightshoulder:b4,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a4,righttrigger:a3,",
- "0d0f5f00000000000000504944564944,Fighting Commander 4,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "0d0f6a00000000000000504944564944,Real Arcade Pro.4,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,",
- "0d0f6b00000000000000504944564944,Real Arcade Pro.4,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "0d0f6e00000000000000504944564944,HORIPAD 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "0d0f7000000000000000504944564944,REAL ARCADE PRO.4 VLX,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "0d0f8400000000000000504944564944,Fighting Commander 5,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
- "0d0f8500000000000000504944564944,Fighting Commander 2016 PS3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "0d0f8700000000000000504944564944,Fighting Stick mini 4,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "0d0f8800000000000000504944564944,Fighting Stick mini 4,a:b1,b:b2,x:b0,y:b3,back:b9,guide:b12,start:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "0d0f8a00000000000000504944564944,Real Arcade Pro.4,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,",
- "0d0f8b00000000000000504944564944,Real Arcade Pro.4,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "10008200000000000000504944564944,PS360+ v1.66,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:h0.4,lefttrigger:b6,righttrigger:b7,",
- "10080100000000000000504944564944,PS1 USB,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
- "100801e5000000000000504944564944,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,start:b9,rightx:a2,righty:a3,leftx:a0,lefty:a1,",
- "10080300000000000000504944564944,PS2 USB,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a4,righty:a2,lefttrigger:b4,righttrigger:b5,",
- "10280900000000000000504944564944,8Bitdo SFC30 GamePad,a:b1,b:b0,y:b3,x:b4,start:b11,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,",
- "120cf60e000000000000504944564944,P4 Wired Gamepad,a:b1,b:b2,x:b0,y:b3,back:b12,guide:b8,start:b9,leftshoulder:b5,rightshoulder:b4,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:h0.0,lefttrigger:b7,righttrigger:b6,",
- "20380900000000000000504944564944,8Bitdo NES30 PRO Wireless,a:b0,b:b1,x:b3,y:b4,leftshoulder:b6,rightshoulder:b7,lefttrigger:b8,righttrigger:b9,back:b10,start:b11,leftstick:b13,rightstick:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
- "222c0020000000000000504944564944,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:a3,righttrigger:a4,",
- "222c0023000000000000504944564944,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,x:b0,y:b3,back:b13,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "222c0223000000000000504944564944,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "25090017000000000000504944564944,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b5,rightshoulder:b7,leftx:a0,lefty:a1,lefttrigger:b4,righttrigger:b6,",
- "25090128000000000000504944564944,Mayflash Arcade Stick,a:b1,b:b2,x:b5,y:b6,back:b8,start:b9,leftshoulder:b0,rightshoulder:b3,leftx:a0,lefty:a1,rightx:h0.4,righty:h0.0,lefttrigger:b4,righttrigger:b7,",
- "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,",
- "2509e803000000000000504944564944,Mayflash Wii Classic Controller,a:b1,b:b0,x:b3,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:b11,dpdown:b13,dpleft:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "28040140000000000000504944564944,GamePad Pro USB,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,",
- "300f0011000000000000504944564944,QanBa Arcade JoyStick 1008,x:b0,a:b1,b:b2,y:b3,back:b8,start:b10,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftx:a0,lefty:a1,",
- "300f1001000000000000504944564944,Saitek P480 Rumble Pad,a:b2,b:b3,x:b0,y:b1,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b5,righttrigger:b7,",
- "300f1201000000000000504944564944,Saitek Dual Analog Pad,a:b2,b:b3,x:b0,y:b1,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b5,righttrigger:b7,",
- "300f1210000000000000504944564944,QanBa Joystick Plus,a:b0,b:b1,x:b2,y:b3,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,",
- "300f1611000000000000504944564944,QanBa Arcade JoyStick 4018,a:b1,b:b2,x:b0,y:b3,back:b10,guide:b9,start:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "341a0104000000000000504944564944,QanBa Joystick Q4RAF,a:b5,b:b6,x:b1,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b0,rightshoulder:b3,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,lefttrigger:b4,righttrigger:b7,",
- "341a0108000000000000504944564944,EXEQ RF USB Gamepad 8206,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,leftstick:b8,rightstick:b7,back:b8,start:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "36280100000000000000504944564944,OUYA Controller,a:b0,b:b3,y:b2,x:b1,start:b14,guide:b15,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b8,dpleft:b10,dpdown:b9,dpright:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b12,righttrigger:b13,",
- "38071888000000000000504944564944,MadCatz SFIV FightStick PS3,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b5,rightshoulder:b4,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b7,righttrigger:b6,",
- "38073888000000000000504944564944,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "38075032000000000000504944564944,Mad Catz FightPad PRO PS3,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "38075082000000000000504944564944,Mad Catz FightPad PRO PS4,x:b0,a:b1,b:b2,y:b3,back:b13,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,",
- "38076652000000000000504944564944,UnKnown,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "38078034000000000000504944564944,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "38078084000000000000504944564944,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "38078134000000000000504944564944,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b7,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b4,",
- "38078184000000000000504944564944,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b5,rightshoulder:b4,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a4,righttrigger:b7,",
- "38078433000000000000504944564944,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "38078483000000000000504944564944,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:b6,",
- "38078532000000000000504944564944,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "45130010000000000000504944564944,Generic USB Joystick,a:b0,b:b1,x:b2,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "49190204000000000000504944564944,Ipega PG-9023,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b8,righttrigger:b9,",
- "4b12014d000000000000504944564944,NYKO AIRFLO,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b10,start:b9,leftstick:a0,rightstick:a2,leftshoulder:a3,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:h0.6,lefty:h0.12,rightx:h0.9,righty:h0.4,lefttrigger:b6,righttrigger:b7,",
- "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
- "4c05a00b000000000000504944564944,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
- "4c05cc09000000000000504944564944,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "4f0400b3000000000000504944564944,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
- "4f0415b3000000000000504944564944,Thrustmaster Dual Analog 3.2,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "4f0423b3000000000000504944564944,Dual Trigger 3-in-1,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
- "5e048e02000000000000504944564944,Controller (XBOX 360 For Windows),x:b2,a:b0,b:b1,y:b3,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,righttrigger:a2,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "63252305000000000000504944564944,USB Vibration Joystick (BM),x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "66660488000000000000504944564944,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpdown:b14,dpleft:b15,dpright:b13,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,",
- "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "6d0418c2000000000000504944564944,Logitech RumblePad 2 USB,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "6f0e1e01000000000000504944564944,Rock Candy Gamepad for PS3,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
- "6f0e2401000000000000504944564944,INJUSTICE FightStick for PS3,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2",
- "79000018000000000000504944564944,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "79000600000000000000504944564944,G-Shark GS-GP702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,",
- "79001100000000000000504944564944,Sega Saturn Gamepad,a:b1,b:b2,x:b4,y:b5,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a4,lefttrigger:b3,righttrigger:b0,",
- "79001b18000000000000504944564944,Venom Arcade Joystick,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b6,righttrigger:b7,",
- "79004318000000000000504944564944,Mayflash GameCube Controller Adapter,a:b1,b:b2,x:b0,y:b3,back:b0,start:b9,guide:b0,leftshoulder:b4,rightshoulder:b7,leftstick:b0,rightstick:b0,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
- "83056020000000000000504944564944,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,y:b2,x:b3,start:b7,back:b6,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
- "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,",
- "8f0e0300000000000000504944564944,Piranha xtreme,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "8f0e0d31000000000000504944564944,Multilaser JS071 USB,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "8f0e1030000000000000504944564944,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,x:b3,y:b4,start:b9,leftshoulder:b6,rightshoulder:b2,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b5,righttrigger:b7,",
- "8f0e1200000000000000504944564944,Acme,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "9000318000000000000504944564944,Mayflash Wiimote PC Adapter,a:b2,b:h0.4,x:b0,y:b1,back:b4,start:b5,guide:b11,leftshoulder:b6,rightshoulder:b3,leftx:a0,lefty:a1,",
- "9b280500000000000000504944564944,Saturn_Adapter_2.0,a:b1,b:b2,x:b0,y:b3,start:b9,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,lefttrigger:b4,righttrigger:b5,",
- "a3060cff000000000000504944564944,Saitek P2500,a:b2,b:b3,y:b1,x:b0,start:b4,guide:b10,back:b5,leftstick:b8,rightstick:b9,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "bd1215d0000000000000504944564944,Nintendo Retrolink USB Super SNES Classic Controller,y:b0,b:b1,a:b2,x:b3,leftshoulder:b4,rightshoulder:b5,start:b9,back:b8,leftx:a0,lefty:a1,",
- "c0111352000000000000504944564944,Battalife Joystick,x:b4,a:b6,b:b7,y:b5,back:b2,start:b3,leftshoulder:b0,rightshoulder:b1,leftx:a0,lefty:a1,",
- "c911f055000000000000504944564944,GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
- "d6206dca000000000000504944564944,PowerA Pro Ex,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.0,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "d8140862000000000000504944564944,HitBox Edition Cthulhu+,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b5,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,lefttrigger:b4,righttrigger:b6,",
- "d81d0b00000000000000504944564944,BUFFALO BSGP1601 Series ,x:b4,a:b5,b:b3,y:b2,back:b12,start:b13,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b6,rightshoulder:b9,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "d81d0f00000000000000504944564944,iBUFFALO BSGP1204 Series,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "d81d1000000000000000504944564944,iBUFFALO BSGP1204P Series,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "ff113133000000000000504944564944,SVEN X-PAD,a:b2,b:b3,y:b1,x:b0,start:b5,back:b4,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b8,righttrigger:b9,",
- "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
- "__XINPUT_DEVICE__,XInput Gamepad,a:b12,b:b13,x:b14,y:b15,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpdown:b1,dpleft:b2,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,",
-#endif
-
-#ifdef OSX_ENABLED
- "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
- "050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,y:b9,x:b10,start:b6,guide:b8,back:b7,dpup:b2,dpleft:b0,dpdown:b3,dpright:b1,leftx:a0,lefty:a1,lefttrigger:b12,righttrigger:,leftshoulder:b11,",
- "050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,x:b18,y:b17,back:b7,guide:b8,start:b6,leftstick:b23,rightstick:b24,leftshoulder:b19,rightshoulder:b20,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b21,righttrigger:b22,",
- "0d0f0000000000004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "0d0f0000000000006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:a4,",
- "10080000000000000100000000000000,Twin USB Joystick,a:b4,b:b2,x:b6,y:b0,back:b16,start:b18,leftstick:b20,rightstick:b22,leftshoulder:b12,rightshoulder:b14,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a2,rightx:a6,righty:a4,lefttrigger:b8,righttrigger:b10,",
- "10280000000000000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "2509000000000000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,x:b3,y:b2,back:b8,guide:b10,start:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:b11,dpdown:b13,dpleft:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,x:b4,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
- "4c05000000000000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
- "4c05000000000000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "4f0400000000000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
- "4f0400000000000015b3000000000000,Thrustmaster Dual Analog 3.2,x:b1,a:b0,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
- "5e04000000000000dd02000000000000,Xbox One Wired Controller,x:b2,a:b0,b:b1,y:b3,back:b9,guide:b10,start:b8,dpleft:b13,dpdown:b12,dpright:b14,dpup:b11,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "5e04000000000000e002000000000000,Xbox Wireless Controller,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b10,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "5e04000000000000ea02000000000000,Xbox Wireless Controller,x:b2,a:b0,b:b1,y:b3,back:b9,guide:b10,start:b8,dpleft:b13,dpdown:b12,dpright:b14,dpup:b11,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b6,rightstick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
- "79000000000000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,x:b0,y:b12,back:b32,start:b36,leftstick:b40,rightstick:b44,leftshoulder:b16,rightshoulder:b20,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a4,rightx:a8,righty:a12,lefttrigger:b24,righttrigger:b28,",
- "79000000000000000600000000000000,G-Shark GP-702,a:b2,b:b1,x:b3,y:b0,back:b8,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b6,righttrigger:b7,",
- "79000000000000001100000000000000,Retrolink Classic Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a3,lefty:a4,",
- "81170000000000007e05000000000000,Sega Saturn,x:b0,a:b2,b:b4,y:b6,start:b13,dpleft:b15,dpdown:b16,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,lefttrigger:b10,rightshoulder:b9,righttrigger:a4,righttrigger:b11,leftx:a0,lefty:a2,",
- "83050000000000006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
- "891600000000000000fd000000000000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b8,guide:b10,back:b9,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpleft:b13,dpdown:b12,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "8f0e0000000000000300000000000000,Piranha xtreme,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "AD1B00000000000001F9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
- "ad1b00000000000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
- "b4040000000000000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,x:b3,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "bd1200000000000015d0000000000000,Tomee SNES USB Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
- "d814000000000000cecf000000000000,MC Cthulhu,leftx:,lefty:,rightx:,righty:,lefttrigger:b6,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,righttrigger:b7,",
-#endif
-
-#if X11_ENABLED
- "0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,x:b2,y:b3,start:b7,back:b6,guide:b8,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,lefttrigger:a5,righttrigger:a4,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "0300000000f000000300000000010000,RetroUSB.com RetroPad,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "0300000000f00000f100000000010000,RetroUSB.com Super RetroPort,a:b1,b:b5,x:b0,y:b4,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "030000000d0f00000d00000000010000,hori,a:b0,b:b6,y:b2,x:b1,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,start:b9,guide:b10,back:b8,leftshoulder:b3,rightshoulder:b7,leftx:b4,lefty:b5,",
- "030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7",
- "030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,",
- "030000000d0f00004d00000011010000,HORI Gem Pad 3,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,y:b0,x:b3,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,",
- "030000001008000001e5000010010000,NEXT Classic USB Game Controller,a:b0,b:b1,back:b8,start:b9,rightx:a2,righty:a3,leftx:a0,lefty:a1,",
- "03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,x:b3,y:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,",
- "03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,y:b0,x:b3,start:b8,back:b9,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,",
- "03000000260900008888000000010000,GameCube {WiseGroup USB box},a:b0,b:b2,y:b3,x:b1,start:b7,leftshoulder:,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,rightstick:,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,",
- "03000000280400000140000000010000,Gravis GamePad Pro USB ,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftx:a0,lefty:a1,",
- "03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,x:b0,a:b2,b:b3,y:b1,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,y:b3,x:b0,start:b9,guide:,back:,leftstick:,rightstick:,leftshoulder:,dpleft:b15,dpdown:b14,dpright:b13,leftx:a0,lefty:a1,rightx:a5,righty:a2,lefttrigger:a3,righttrigger:a4,rightshoulder:b7,dpup:b12,",
- "03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
- "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
- "030000004c050000a00b000011010000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
- "030000004c050000c405000011810000,Sony DualShock 4,a:b0,b:b1,y:b2,x:b3,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "030000004c050000cc09000011010000,Sony DualShock 4 V2,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "030000004c050000cc09000011810000,Sony DualShock 4 (CUH-ZCT2U) (USB),a:b0,b:b1,y:b2,x:b3,leftshoulder:b4,rightshoulder:b5,back:b8,start:b9,guide:b10,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,lefttrigger:a2,rightx:a3,righty:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
- "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
- "030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,x:b0,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,",
- "030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,x:b0,y:b3,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,x:b1,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
- "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,y:b3,x:b1,start:b9,guide:,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,",
- "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a5,",
- "030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000005e0400008502000000010000,Microsoft X-Box pad (Japan),x:b3,a:b0,b:b1,y:b4,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:a2,rightshoulder:b2,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),x:b3,a:b0,b:b1,y:b4,back:b6,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:a2,rightshoulder:b2,righttrigger:a5,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e0400008e02000001000000,Microsoft X-Box 360 pad,leftstick:b9,leftx:a0,lefty:a1,dpdown:h0.1,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:h0.2,lefttrigger:a2,x:b2,dpup:h0.4,back:b6,leftshoulder:b4,y:b3,a:b0,dpright:h0.8,righttrigger:a5,b:b1,",
- "030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,guide:b8,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
- "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e0400008e02000062230000,Microsoft X-Box 360 pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000005e040000d102000001010000,Microsoft X-Box One pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e040000dd02000003020000,Microsoft X-Box One pad v2,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000005e040000e302000003020000,Microsoft X-Box One Elite pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,x:b3,y:b0,back:b9,start:b8,leftshoulder:b6,rightshoulder:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b4,righttrigger:b5,dpup:b12,dpleft:b15,dpdown:b14,dpright:b13,",
- "030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,y:b4,x:b3,start:b8,guide:b5,back:b2,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b9,righttrigger:b10,",
- "030000006d04000016c2000010010000,Logitech Logitech Dual Action,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "030000006d04000016c2000011010000,Logitech F310 Gamepad (DInput),x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "030000006d04000018c2000010010000,Logitech Logitech RumblePad 2 USB,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
- "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,x:b0,a:b2,b:b3,y:b1,back:b10,guide:b12,start:b11,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "030000006f0e00000103000000020000,Logic3 Controller,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000006f0e00001302000000010000,Afterglow Gamepad for Xbox 360,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "030000006f0e00001304000000010000,Generic X-Box pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:a0,rightstick:a3,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000006f0e00001e01000011010000,Rock Candy Gamepad for PS3,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,guide:b12,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,",
- "030000006f0e00001f01000000010000,Generic X-Box pad,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000006f0e00002801000011010000,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:h0.8,lefttrigger:b6,x:b0,dpup:h0.1,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,dpright:h0.2,righttrigger:b7,b:b2,",
- "030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "030000006f0e00003901000020060000,Afterglow Wired Controller for Xbox One,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000006f0e00004601000001010000,Rock Candy Wired Controller for Xbox One,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,guide:b8,leftstick:b9,rightstick:b10,lefttrigger:a2,righttrigger:a5,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "03000000780000000600000010010000,Microntek USB Joystick,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftx:a0,lefty:a1,",
- "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick ,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "03000000790000001100000010010000,RetroLink Saturn Classic Controller,x:b3,a:b0,b:b1,y:b4,back:b5,guide:b2,start:b8,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "03000000830500006020000010010000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
- "030000008916000000fd000024010000,Razer Onza Tournament,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b11,dpdown:b14,dpright:b12,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "030000008916000001fd000024010000,Razer Onza Classic Edition,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:b11,dpdown:b14,dpright:b12,dpup:b13,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick ,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick ,x:b2,a:b0,b:b1,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b5,rightshoulder:b6,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,x:b1,a:b0,b:b4,y:b5,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,y:b1,x:b0,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b6,righttrigger:b7,",
- "03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,y:b3,x:b0,start:b12,guide:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,",
- "03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,x:b0,a:b1,b:b2,y:b3,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:a2,rightshoulder:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
- "03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:b6,righttrigger:b7,",
- "03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,",
- "03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,lefttrigger:a2,righttrigger:a5,",
- "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
- "03000000bd12000015d0000010010000,Tomee SNES USB Controller,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,",
- "03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,x:b13,y:b11,back:b4,start:b5,leftstick:b14,rightstick:b15,leftshoulder:b9,rightshoulder:b8,dpup:b0,dpdown:b2,dpleft:b3,dpright:b1,leftx:a1,lefty:a0,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,y:b0,x:b1,b:b3,a:b4,leftshoulder:b2,rightshoulder:b5,back:b6,start:b7,guide:b9,dpleft:b13,dpdown:b12,dpright:b14,dpup:b11,leftx:a0,lefty:a1,",
- "03000000c9110000f055000011010000,HJC Game GAMEPAD,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:h0.8,lefttrigger:b6,x:b2,dpup:h0.1,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:h0.2,righttrigger:b7,b:b1,",
- "03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,leftx:a0,lefty:a1,lefttrigger:b6,righttrigger:b7,",
- "03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,y:b3,x:b0,start:b12,guide:b9,back:b8,leftshoulder:b4,rightshoulder:b5,lefttrigger:b6,righttrigger:b7,leftx:a0,lefty:a1,",
- "03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,y:b1,x:b0,start:b7,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,",
- "03000000fd0500002a26000000010000,3dfx InterAct HammerHead FX,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b5,rightshoulder:b7,rightx:a2,start:b11,righty:a3,dpleft:h0.8,lefttrigger:b8,x:b0,dpup:h0.1,back:b10,leftstick:b2,leftshoulder:b6,y:b1,a:b3,dpright:h0.2,righttrigger:b9,b:b4,",
- "03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "03000000ff1100004133000010010000,GreenAsia Inc.USB Joystick,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,",
- "05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,y:b3,x:b2,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,",
- "05000000102800000900000000010000,8Bitdo SFC30 GamePad,x:b4,a:b1,b:b0,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,",
- "05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,",
- "05000000362800000100000004010000,OUYA Game Controller,leftx:a0,lefty:a1,dpdown:b9,rightstick:b7,rightshoulder:b5,rightx:a3,start:b16,righty:a4,dpleft:b10,lefttrigger:b12,x:b1,dpup:b8,back:b14,leftstick:b6,leftshoulder:b4,y:b2,a:b0,dpright:b11,righttrigger:b13,b:b3,",
- "05000000380700006652000025010000,Mad Catz C.T.R.L.R ,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,",
- "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
- "050000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,",
- "050000004c050000c405000000010000,Sony DualShock 4 BT,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
- "050000004c050000cc09000000010000,Sony DualShock 4 V2 BT,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,",
- "050000004c050000cc09000000810000,Sony DualShock 4 (CUH-ZCT2U) (Bluetooth),a:b0,b:b1,y:b2,x:b3,leftshoulder:b4,rightshoulder:b5,back:b8,start:b9,guide:b10,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,lefttrigger:a2,rightx:a3,righty:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
- "05000000504c415953544154494f4e00,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,",
- "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
- "050000007e0500003003000001000000,Nintendo Wii U Pro Controller,a:b0,b:b1,x:b3,y:b2,back:b8,start:b9,guide:b10,leftshoulder:b4,rightshoulder:b5,leftstick:b11,rightstick:b12,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,",
- "05000000a00500003232000001000000,8Bitdo Zero GamePad,a:b0,b:b1,x:b3,y:b4,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,",
- "05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,x:b2,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a2,lefttrigger:b4,righttrigger:b5,",
- "05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,y:b3,x:b2,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,",
- "060000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,",
- "06000000adde0000efbe000002010000,Hidromancer Game Controller,x:b2,a:b0,b:b1,y:b3,back:b6,guide:b8,start:b7,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,",
-#endif
-
-#if defined(__ANDROID__)
- "Default Android Gamepad,Default Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,back:b4,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,",
- "47656e6572696320582d426f78207061,Logitech F-310,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a5,x:b2,dpup:h0.1,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a4,b:b1,",
- "484f524920434f2e2c4c544420205041,Hori Gem Pad 3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b6,rightshoulder:b18,rightx:a2,start:b16,righty:a3,dpleft:h0.8,lefttrigger:b9,x:b0,dpup:h0.1,back:b15,leftstick:b4,leftshoulder:b3,y:b2,a:b1,dpright:h0.2,righttrigger:b10,b:b17,",
- "4d6963726f736f667420582d426f7820,Microsoft X-Box 360 pad,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b8,rightshoulder:b10,rightx:a2,start:b6,righty:a3,dpleft:h0.8,lefttrigger:a4,x:b2,dpup:h0.1,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:h0.2,righttrigger:a5,b:b1,",
- "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
- "532e542e442e20496e74657261637420,3dfx InterAct HammerHead FX,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b25,rightshoulder:b27,rightx:a2,start:b31,righty:a3,dpleft:h0.8,lefttrigger:b28,x:b20,dpup:h0.1,back:b30,leftstick:b22,leftshoulder:b26,y:b21,a:b23,dpright:h0.2,righttrigger:b29,b:b24,",
- "506572666f726d616e63652044657369,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b6,rightshoulder:b18,rightx:a2,start:b16,righty:a3,dpleft:h0.8,lefttrigger:b9,x:b0,dpup:h0.1,back:h0.2,leftstick:b4,leftshoulder:b3,y:b2,a:b1,dpright:h0.2,righttrigger:b10,b:b17,",
- "4f5559412047616d6520436f6e74726f,OUYA Game Controller,leftx:a1,lefty:a3,dpdown:b12,rightstick:b8,rightshoulder:b10,rightx:a6,start:b-86,righty:a7,dpleft:b13,lefttrigger:b15,x:b2,dpup:b11,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:b14,righttrigger:b16,b:b1,",
-#endif
-
-#ifdef JAVASCRIPT_ENABLED
- "Default HTML5 Gamepad, Default Mapping,leftx:a0,lefty:a1,dpdown:b13,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:b14,lefttrigger:a6,x:b2,dpup:b12,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:b15,righttrigger:a7,b:b1,",
- "303435652d303238652d4d6963726f73,Wired X360 Controller,leftx:a0,lefty:a1,dpdown:a7,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:a6,lefttrigger:a2,x:b2,dpup:a7,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:a6,righttrigger:a5,b:b1,",
- "303435652d303731392d58626f782033,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,",
- "303534632d303236382d536f6e792050,PS3 Controller USB/Linux,leftx:a0,lefty:a1,dpdown:b6,rightstick:b2,rightshoulder:b11,rightx:a2,start:b3,righty:a3,dpleft:b7,lefttrigger:b8,x:b15,dpup:b4,back:b0,leftstick:b1,leftshoulder:b10,y:b12,a:b14,dpright:b5,righttrigger:b9,b:b13,",
- "303534632d303563342d536f6e792043,PS4 Controller USB/Linux,leftx:a0,lefty:a1,dpdown:a7,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,dpleft:a6,lefttrigger:a3,x:b0,dpup:a7,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,dpright:a6,righttrigger:a4,b:b2,",
- "303534632d303563342d576972656c65,PS4 Controller USB/Win,leftx:a0,lefty:a1,dpdown:b15,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,lefttrigger:a3,x:b0,dpup:b14,dpleft:b16,dpright:b17,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,righttrigger:b7,b:b2,",
- "c2a94d6963726f736f66742058626f78,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,",
-#endif
-
-#ifdef UWP_ENABLED
- "__UWP_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,",
-#endif
- NULL
-};
-
InputDefault::InputDefault() {
mouse_button_mask = 0;
- emulate_touch = false;
+ emulate_touch_from_mouse = false;
+ emulate_mouse_from_touch = false;
+ mouse_from_touch_index = -1;
main_loop = NULL;
hat_map_default[HAT_UP].type = TYPE_BUTTON;
@@ -847,9 +664,9 @@ InputDefault::InputDefault() {
};
int i = 0;
- while (s_ControllerMappings[i]) {
+ while (DefaultControllerMappings::mappings[i]) {
- parse_mapping(s_ControllerMappings[i++]);
+ parse_mapping(DefaultControllerMappings::mappings[i++]);
};
}
@@ -1072,12 +889,12 @@ InputDefault::JoyEvent InputDefault::_find_to_event(String p_to) {
JoyEvent ret;
ret.type = -1;
+ ret.index = 0;
int i = 0;
while (buttons[i]) {
if (p_to == buttons[i]) {
- //printf("mapping button %s\n", buttons[i]);
ret.type = TYPE_BUTTON;
ret.index = i;
ret.value = 0;
@@ -1109,6 +926,10 @@ void InputDefault::parse_mapping(String p_mapping) {
mapping.hat[i].index = 1024 + i;
Vector<String> entry = p_mapping.split(",");
+ if (entry.size() < 2) {
+ return;
+ }
+
CharString uid;
uid.resize(17);
diff --git a/main/input_default.h b/main/input_default.h
index 0479fdc0ff..2e3cae8520 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -55,11 +55,15 @@ class InputDefault : public Input {
uint64_t physics_frame;
uint64_t idle_frame;
bool pressed;
+ float strength;
};
Map<StringName, Action> action_state;
- bool emulate_touch;
+ bool emulate_touch_from_mouse;
+ bool emulate_mouse_from_touch;
+
+ int mouse_from_touch_index;
struct VibrationInfo {
float weak_magnitude;
@@ -96,7 +100,6 @@ class InputDefault : public Input {
int hat_current;
Joypad() {
-
for (int i = 0; i < JOY_AXIS_MAX; i++) {
last_axis[i] = 0.0f;
@@ -109,13 +112,14 @@ class InputDefault : public Input {
last_hat = HAT_MASK_CENTER;
filter = 0.01f;
mapping = -1;
+ hat_current = 0;
}
};
SpeedTrack mouse_speed_track;
Map<int, Joypad> joy_names;
int fallback_mapping;
- RES custom_cursor;
+ CursorShape default_shape = CURSOR_ARROW;
public:
enum HatMask {
@@ -175,6 +179,8 @@ private:
void _axis_event(int p_device, int p_axis, float p_value);
float _handle_deadzone(int p_device, int p_axis, float p_value);
+ void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated);
+
public:
virtual bool is_key_pressed(int p_scancode) const;
virtual bool is_mouse_button_pressed(int p_button) const;
@@ -182,6 +188,7 @@ public:
virtual bool is_action_pressed(const StringName &p_action) const;
virtual bool is_action_just_pressed(const StringName &p_action) const;
virtual bool is_action_just_released(const StringName &p_action) const;
+ virtual float get_action_strength(const StringName &p_action) const;
virtual float get_joy_axis(int p_device, int p_axis) const;
String get_joy_name(int p_idx);
@@ -223,9 +230,15 @@ public:
void iteration(float p_step);
- void set_emulate_touch(bool p_emulate);
- virtual bool is_emulating_touchscreen() const;
+ void set_emulate_touch_from_mouse(bool p_emulate);
+ virtual bool is_emulating_touch_from_mouse() const;
+ void ensure_touch_mouse_raised();
+
+ void set_emulate_mouse_from_touch(bool p_emulate);
+ virtual bool is_emulating_mouse_from_touch() const;
+ virtual CursorShape get_default_cursor_shape();
+ virtual void set_default_cursor_shape(CursorShape p_shape);
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = Input::CURSOR_ARROW, const Vector2 &p_hotspot = Vector2());
virtual void set_mouse_in_window(bool p_in_window);
diff --git a/main/main.cpp b/main/main.cpp
index 4d7273b4e4..e2b3bb8e6f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -82,6 +82,8 @@
#include "version.h"
#include "version_hash.gen.h"
+#include "main/timer_sync.h"
+
static ProjectSettings *globals = NULL;
static Engine *engine = NULL;
static InputMap *input_map = NULL;
@@ -127,6 +129,7 @@ static bool disable_render_loop = false;
static int fixed_fps = -1;
static bool auto_build_solutions = false;
static bool auto_quit = false;
+static bool print_fps = false;
static OS::ProcessID allow_focus_steal_pid = 0;
@@ -175,7 +178,7 @@ static String get_full_version_string() {
String hash = String(VERSION_HASH);
if (hash.length() != 0)
hash = "." + hash.left(7);
- return String(VERSION_MKSTRING) + hash;
+ return String(VERSION_FULL_BUILD) + hash;
}
//#define DEBUG_INIT
@@ -206,6 +209,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n");
OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n");
#endif
+ OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n");
OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n");
OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n");
OS::get_singleton()->print(" -u, --upwards Scan folders upwards for project.godot file.\n");
@@ -254,16 +258,18 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n");
OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n");
OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n");
+ OS::get_singleton()->print(" --print-fps Print the frames per second to the stdout.\n");
OS::get_singleton()->print("\n");
OS::get_singleton()->print("Standalone tools:\n");
OS::get_singleton()->print(" -s, --script <script> Run a script.\n");
+ OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n");
#ifdef TOOLS_ENABLED
- OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
- OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
+ OS::get_singleton()->print(" --export <target> Export the project using the given export target. Export only main pack if path ends with .pck or .zip'.\n");
+ OS::get_singleton()->print(" --export-debug <target> Like --export, but use debug template.\n");
OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
- OS::get_singleton()->print(" --build-solutions Builds the scripting solutions (IE. C#).\n");
+ OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects).\n");
#ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
@@ -334,7 +340,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String video_driver = "";
String audio_driver = "";
- String game_path = ".";
+ String project_path = ".";
bool upwards = false;
String debug_mode;
String debug_host;
@@ -348,6 +354,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
+ bool found_project = false;
packed_data = PackedData::get_singleton();
if (!packed_data)
@@ -532,6 +539,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--build-solutions") { // Build the scripting solution such C#
auto_build_solutions = true;
+ editor = true;
#endif
} else if (I->get() == "--no-window") { // disable window creation, Windows only
@@ -549,7 +557,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (OS::get_singleton()->set_cwd(p) == OK) {
//nothing
} else {
- game_path = I->next()->get(); //use game_path instead
+ project_path = I->next()->get(); //use project_path instead
}
N = I->next()->next();
} else {
@@ -558,7 +566,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
} else if (I->get() == "-u" || I->get() == "--upwards") { // scan folders upwards
upwards = true;
- } else if (I->get() == "--quit" || I->get() == "-q") { // Auto quit at the end of the first main loop iteration
+ } else if (I->get() == "-q" || I->get() == "--quit") { // Auto quit at the end of the first main loop iteration
auto_quit = true;
} else if (I->get().ends_with("project.godot")) {
String path;
@@ -572,7 +580,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (OS::get_singleton()->set_cwd(path) == OK) {
// path already specified, don't override
} else {
- game_path = path;
+ project_path = path;
}
#ifdef TOOLS_ENABLED
editor = true;
@@ -663,28 +671,28 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing fixed-fps argument, aborting.\n");
goto error;
}
+ } else if (I->get() == "--print-fps") {
+ print_fps = true;
} else if (I->get() == "--disable-crash-handler") {
OS::get_singleton()->disable_crash_handler();
} else {
+ main_args.push_back(I->get());
+ }
- //test for game path
- bool gpfound = false;
+ I = N;
+ }
- if (!I->get().begins_with("-") && game_path == "") {
- DirAccess *da = DirAccess::open(I->get());
- if (da != NULL) {
- game_path = I->get();
- gpfound = true;
- memdelete(da);
- }
- }
+ if (globals->setup(project_path, main_pack, upwards) == OK) {
+ found_project = true;
+ } else {
- if (!gpfound) {
- main_args.push_back(I->get());
- }
- }
+#ifdef TOOLS_ENABLED
+ editor = false;
+#else
+ OS::get_singleton()->print("Error: Could not load game path '%s'.\n", project_path.ascii().get_data());
- I = N;
+ goto error;
+#endif
}
GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60);
@@ -711,6 +719,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (debug_mode == "local") {
script_debugger = memnew(ScriptDebuggerLocal);
+ OS::get_singleton()->initialize_debugging();
}
FileAccessNetwork::configure();
@@ -759,26 +768,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#endif
- if (globals->setup(game_path, main_pack, upwards) != OK) {
-
-#ifdef TOOLS_ENABLED
- editor = false;
-#else
- OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data());
-
- goto error;
-#endif
- } else if (String(GLOBAL_DEF("application/run/main_scene", "")) == "") {
-#ifdef TOOLS_ENABLED
- if (!editor) {
-#endif
- OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n");
- goto error;
-#ifdef TOOLS_ENABLED
- }
-#endif
- }
-
GLOBAL_DEF("logging/file_logging/enable_file_logging", false);
GLOBAL_DEF("logging/file_logging/log_path", "user://logs/log.txt");
GLOBAL_DEF("logging/file_logging/max_log_files", 10);
@@ -800,14 +789,21 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (!project_manager) {
// Determine if the project manager should be requested
- project_manager =
- main_args.size() == 0 &&
- !ProjectSettings::get_singleton()->has_setting("application/run/main_loop_type") &&
- (!ProjectSettings::get_singleton()->has_setting("application/run/main_scene") ||
- String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "");
+ project_manager = main_args.size() == 0 && !found_project;
}
#endif
+ if (main_args.size() == 0 && String(GLOBAL_DEF("application/run/main_scene", "")) == "") {
+#ifdef TOOLS_ENABLED
+ if (!editor && !project_manager) {
+#endif
+ OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n");
+ goto error;
+#ifdef TOOLS_ENABLED
+ }
+#endif
+ }
+
if (editor || project_manager) {
use_custom_res = false;
input_map->load_default(); //keys for editor
@@ -827,8 +823,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->set_cmdline(execpath, main_args);
- //if (video_driver == "") // useless for now, so removing
- // video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0)));
+ GLOBAL_DEF("rendering/quality/driver/driver_name", "GLES3");
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/driver/driver_name", PropertyInfo(Variant::STRING, "rendering/quality/driver/driver_name", PROPERTY_HINT_ENUM, "GLES3,GLES2"));
+ if (video_driver == "") {
+ video_driver = GLOBAL_GET("rendering/quality/driver/driver_name");
+ }
GLOBAL_DEF("display/window/size/width", 1024);
GLOBAL_DEF("display/window/size/height", 600);
@@ -865,7 +864,13 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_allow_hidpi = GLOBAL_DEF("display/window/dpi/allow_hidpi", false);
}
+ OS::get_singleton()->_allow_layered = GLOBAL_DEF("display/window/allow_per_pixel_transparency", false);
+
video_mode.use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", true);
+ OS::get_singleton()->_use_vsync = video_mode.use_vsync;
+
+ video_mode.layered = GLOBAL_DEF("display/window/per_pixel_transparency", false);
+ video_mode.layered_splash = GLOBAL_DEF("display/window/per_pixel_transparency_splash", false);
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2);
GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3);
@@ -873,6 +878,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (editor || project_manager) {
// The editor and project manager always detect and use hiDPI if needed
OS::get_singleton()->_allow_hidpi = true;
+ OS::get_singleton()->_allow_layered = false;
}
Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false);
@@ -946,9 +952,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/physics_fps", 60));
+ Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5));
Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0));
- GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose());
+ GLOBAL_DEF("debug/settings/stdout/print_fps", false);
if (!OS::get_singleton()->_verbose_stdout) //overridden
OS::get_singleton()->_verbose_stdout = GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false);
@@ -975,7 +982,7 @@ error:
video_driver = "";
audio_driver = "";
- game_path = "";
+ project_path = "";
args.clear();
main_args.clear();
@@ -1132,13 +1139,16 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
GLOBAL_DEF("application/config/icon", String());
ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp"));
- if (bool(GLOBAL_DEF("display/window/handheld/emulate_touchscreen", false))) {
- if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !(editor || project_manager)) {
- //only if no touchscreen ui hint, set emulation
- InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
- if (id)
- id->set_emulate_touch(true);
+ InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
+ if (id) {
+ if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) && !(editor || project_manager)) {
+ if (!OS::get_singleton()->has_touchscreen_ui_hint()) {
+ //only if no touchscreen ui hint, set emulation
+ id->set_emulate_touch_from_mouse(true);
+ }
}
+
+ id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input_devices/pointing/emulate_mouse_from_touch", true)));
}
MAIN_PRINT("Main: Load Remaps");
@@ -1216,6 +1226,10 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
return OK;
}
+// everything the main loop needs to know about frame timings
+
+static MainTimerSync main_timer_sync;
+
bool Main::start() {
ERR_FAIL_COND_V(!_start_success, false);
@@ -1229,6 +1243,9 @@ bool Main::start() {
String test;
String _export_preset;
bool export_debug = false;
+ bool check_only = false;
+
+ main_timer_sync.init(OS::get_singleton()->get_ticks_usec());
List<String> args = OS::get_singleton()->get_cmdline_args();
for (int i = 0; i < args.size(); i++) {
@@ -1249,6 +1266,8 @@ bool Main::start() {
bool parsed_pair = true;
if (args[i] == "-s" || args[i] == "--script") {
script = args[i + 1];
+ } else if (args[i] == "--check-only") {
+ check_only = true;
} else if (args[i] == "--test") {
test = args[i + 1];
#ifdef TOOLS_ENABLED
@@ -1303,7 +1322,7 @@ bool Main::start() {
DocData docsrc;
Map<String, String> doc_data_classes;
Set<String> checked_paths;
- print_line("Loading docs..");
+ print_line("Loading docs...");
for (int i = 0; i < _doc_data_class_path_count; i++) {
String path = doc_tool.plus_file(_doc_data_class_paths[i].path);
@@ -1321,14 +1340,14 @@ bool Main::start() {
checked_paths.insert(index_path);
print_line("Loading docs from: " + index_path);
- print_line("Merging docs..");
+ print_line("Merging docs...");
doc.merge_from(docsrc);
for (Set<String>::Element *E = checked_paths.front(); E; E = E->next()) {
print_line("Erasing old docs at: " + E->get());
DocData::erase_classes(E->get());
}
- print_line("Generating new docs..");
+ print_line("Generating new docs...");
doc.save_classes(index_path, doc_data_classes);
return false;
@@ -1371,6 +1390,10 @@ bool Main::start() {
ERR_EXPLAIN("Can't load script: " + script);
ERR_FAIL_COND_V(script_res.is_null(), false);
+ if (check_only) {
+ return false;
+ }
+
if (script_res->can_instance() /*&& script_res->inherits_from("SceneTreeScripted")*/) {
StringName instance_type = script_res->get_instance_base_type();
@@ -1432,6 +1455,91 @@ bool Main::start() {
}
#endif
+ if (!project_manager && !editor) { // game
+ if (game_path != "" || script != "") {
+ //autoload
+ List<PropertyInfo> props;
+ ProjectSettings::get_singleton()->get_property_list(&props);
+
+ //first pass, add the constants so they exist before any script is loaded
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ String s = E->get().name;
+ if (!s.begins_with("autoload/"))
+ continue;
+ String name = s.get_slicec('/', 1);
+ String path = ProjectSettings::get_singleton()->get(s);
+ bool global_var = false;
+ if (path.begins_with("*")) {
+ global_var = true;
+ }
+
+ if (global_var) {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptServer::get_language(i)->add_global_constant(name, Variant());
+ }
+ }
+ }
+
+ //second pass, load into global constants
+ List<Node *> to_add;
+ for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
+
+ String s = E->get().name;
+ if (!s.begins_with("autoload/"))
+ continue;
+ String name = s.get_slicec('/', 1);
+ String path = ProjectSettings::get_singleton()->get(s);
+ bool global_var = false;
+ if (path.begins_with("*")) {
+ global_var = true;
+ path = path.substr(1, path.length() - 1);
+ }
+
+ RES res = ResourceLoader::load(path);
+ ERR_EXPLAIN("Can't autoload: " + path);
+ ERR_CONTINUE(res.is_null());
+ Node *n = NULL;
+ if (res->is_class("PackedScene")) {
+ Ref<PackedScene> ps = res;
+ n = ps->instance();
+ } else if (res->is_class("Script")) {
+ Ref<Script> s = res;
+ StringName ibt = s->get_instance_base_type();
+ bool valid_type = ClassDB::is_parent_class(ibt, "Node");
+ ERR_EXPLAIN("Script does not inherit a Node: " + path);
+ ERR_CONTINUE(!valid_type);
+
+ Object *obj = ClassDB::instance(ibt);
+
+ ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
+ ERR_CONTINUE(obj == NULL);
+
+ n = Object::cast_to<Node>(obj);
+ n->set_script(s.get_ref_ptr());
+ }
+
+ ERR_EXPLAIN("Path in autoload not a node or script: " + path);
+ ERR_CONTINUE(!n);
+ n->set_name(name);
+
+ //defer so references are all valid on _ready()
+ to_add.push_back(n);
+
+ if (global_var) {
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptServer::get_language(i)->add_global_constant(name, n);
+ }
+ }
+ }
+
+ for (List<Node *>::Element *E = to_add.front(); E; E = E->next()) {
+
+ sml->get_root()->add_child(E->get());
+ }
+ }
+ }
+
#ifdef TOOLS_ENABLED
EditorNode *editor_node = NULL;
@@ -1451,9 +1559,6 @@ bool Main::start() {
}
#endif
- {
- }
-
if (!editor && !project_manager) {
//standard helpers that can be changed from main config
@@ -1503,7 +1608,7 @@ bool Main::start() {
bool snap_controls = GLOBAL_DEF("gui/common/snap_controls_to_pixels", true);
sml->get_root()->set_snap_controls_to_pixels(snap_controls);
- bool font_oversampling = GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", false);
+ bool font_oversampling = GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", true);
sml->set_use_font_oversampling(font_oversampling);
} else {
@@ -1516,7 +1621,7 @@ bool Main::start() {
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
GLOBAL_DEF("gui/common/snap_controls_to_pixels", true);
- GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", false);
+ GLOBAL_DEF("rendering/quality/dynamic_fonts/use_oversampling", true);
}
String local_game_path;
@@ -1566,89 +1671,6 @@ bool Main::start() {
}
if (!project_manager && !editor) { // game
- if (game_path != "" || script != "") {
- //autoload
- List<PropertyInfo> props;
- ProjectSettings::get_singleton()->get_property_list(&props);
-
- //first pass, add the constants so they exist before any script is loaded
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
- String s = E->get().name;
- if (!s.begins_with("autoload/"))
- continue;
- String name = s.get_slicec('/', 1);
- String path = ProjectSettings::get_singleton()->get(s);
- bool global_var = false;
- if (path.begins_with("*")) {
- global_var = true;
- }
-
- if (global_var) {
- for (int i = 0; i < ScriptServer::get_language_count(); i++) {
- ScriptServer::get_language(i)->add_global_constant(name, Variant());
- }
- }
- }
-
- //second pass, load into global constants
- List<Node *> to_add;
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
- String s = E->get().name;
- if (!s.begins_with("autoload/"))
- continue;
- String name = s.get_slicec('/', 1);
- String path = ProjectSettings::get_singleton()->get(s);
- bool global_var = false;
- if (path.begins_with("*")) {
- global_var = true;
- path = path.substr(1, path.length() - 1);
- }
-
- RES res = ResourceLoader::load(path);
- ERR_EXPLAIN("Can't autoload: " + path);
- ERR_CONTINUE(res.is_null());
- Node *n = NULL;
- if (res->is_class("PackedScene")) {
- Ref<PackedScene> ps = res;
- n = ps->instance();
- } else if (res->is_class("Script")) {
- Ref<Script> s = res;
- StringName ibt = s->get_instance_base_type();
- bool valid_type = ClassDB::is_parent_class(ibt, "Node");
- ERR_EXPLAIN("Script does not inherit a Node: " + path);
- ERR_CONTINUE(!valid_type);
-
- Object *obj = ClassDB::instance(ibt);
-
- ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
- ERR_CONTINUE(obj == NULL);
-
- n = Object::cast_to<Node>(obj);
- n->set_script(s.get_ref_ptr());
- }
-
- ERR_EXPLAIN("Path in autoload not a node or script: " + path);
- ERR_CONTINUE(!n);
- n->set_name(name);
-
- //defer so references are all valid on _ready()
- to_add.push_back(n);
-
- if (global_var) {
- for (int i = 0; i < ScriptServer::get_language_count(); i++) {
- ScriptServer::get_language(i)->add_global_constant(name, n);
- }
- }
- }
-
- for (List<Node *>::Element *E = to_add.front(); E; E = E->next()) {
-
- sml->get_root()->add_child(E->get());
- }
- }
-
if (game_path != "") {
Node *scene = NULL;
Ref<PackedScene> scenedata = ResourceLoader::load(local_game_path);
@@ -1695,7 +1717,6 @@ bool Main::start() {
uint64_t Main::last_ticks = 0;
uint64_t Main::target_ticks = 0;
-float Main::time_accum = 0;
uint32_t Main::frames = 0;
uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
@@ -1708,14 +1729,16 @@ bool Main::iteration() {
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
Engine::get_singleton()->_frame_ticks = ticks;
+ main_timer_sync.set_cpu_ticks_usec(ticks);
+ main_timer_sync.set_fixed_fps(fixed_fps);
uint64_t ticks_elapsed = ticks - last_ticks;
- double step = (double)ticks_elapsed / 1000000.0;
- if (fixed_fps != -1)
- step = 1.0 / fixed_fps;
+ int physics_fps = Engine::get_singleton()->get_iterations_per_second();
+ float frame_slice = 1.0 / physics_fps;
- float frame_slice = 1.0 / Engine::get_singleton()->get_iterations_per_second();
+ MainFrameTime advance = main_timer_sync.advance(frame_slice, physics_fps);
+ double step = advance.idle_step;
Engine::get_singleton()->_frame_step = step;
@@ -1731,20 +1754,19 @@ bool Main::iteration() {
last_ticks = ticks;
- if (fixed_fps == -1 && step > frame_slice * 8)
- step = frame_slice * 8;
-
- time_accum += step;
+ static const int max_physics_steps = 8;
+ if (fixed_fps == -1 && advance.physics_steps > max_physics_steps) {
+ step -= (advance.physics_steps - max_physics_steps) * frame_slice;
+ advance.physics_steps = max_physics_steps;
+ }
float time_scale = Engine::get_singleton()->get_time_scale();
bool exit = false;
- int iters = 0;
-
Engine::get_singleton()->_in_physics = true;
- while (time_accum > frame_slice) {
+ for (int iters = 0; iters < advance.physics_steps; ++iters) {
uint64_t physics_begin = OS::get_singleton()->get_ticks_usec();
@@ -1766,12 +1788,10 @@ bool Main::iteration() {
Physics2DServer::get_singleton()->end_sync();
Physics2DServer::get_singleton()->step(frame_slice * time_scale);
- time_accum -= frame_slice;
message_queue->flush();
physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - physics_begin); // keep the largest one for reference
physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - physics_begin, physics_process_max);
- iters++;
Engine::get_singleton()->_physics_frames++;
}
@@ -1798,9 +1818,6 @@ bool Main::iteration() {
}
}
- if (AudioServer::get_singleton())
- AudioServer::get_singleton()->update();
-
idle_process_ticks = OS::get_singleton()->get_ticks_usec() - idle_begin;
idle_process_max = MAX(idle_process_ticks, idle_process_max);
uint64_t frame_time = OS::get_singleton()->get_ticks_usec() - ticks;
@@ -1821,9 +1838,13 @@ bool Main::iteration() {
if (frame > 1000000) {
- if (GLOBAL_DEF("debug/settings/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()) && !editor) {
- print_line("FPS: " + itos(frames));
- };
+ if (editor || project_manager) {
+ if (print_fps) {
+ print_line("Editor FPS: " + itos(frames));
+ }
+ } else if (GLOBAL_GET("debug/settings/stdout/print_fps") || print_fps) {
+ print_line("Game FPS: " + itos(frames));
+ }
Engine::get_singleton()->_fps = frames;
performance->set_process_time(USEC_TO_SEC(idle_process_max));
diff --git a/main/main.h b/main/main.h
index 8b805fa1d0..c20592bf3b 100644
--- a/main/main.h
+++ b/main/main.h
@@ -44,7 +44,6 @@ class Main {
static void print_help(const char *p_binary);
static uint64_t last_ticks;
static uint64_t target_ticks;
- static float time_accum;
static uint32_t frames;
static uint32_t frame;
static bool force_redraw_requested;
diff --git a/main/splash.png b/main/splash.png
index 34be46557f..32960db65f 100644
--- a/main/splash.png
+++ b/main/splash.png
Binary files differ
diff --git a/main/splash_editor.png b/main/splash_editor.png
index d8677f1749..f003995d6f 100644
--- a/main/splash_editor.png
+++ b/main/splash_editor.png
Binary files differ
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index b7b6c21692..305b749717 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -185,6 +185,10 @@ public:
popup->add_item("Popup");
popup->add_check_item("Check Popup");
popup->set_item_checked(4, true);
+ popup->add_separator();
+ popup->add_radio_check_item("Option A");
+ popup->set_item_checked(6, true);
+ popup->add_radio_check_item("Option B");
OptionButton *options = memnew(OptionButton);
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index c9431a1a09..cbc1107acb 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -50,15 +50,20 @@ const char **tests_get_names() {
static const char *test_names[] = {
"string",
- "containers",
"math",
+ "physics",
+ "physics_2d",
"render",
- "multimesh",
+ "oa_hash_map",
"gui",
"io",
"shaderlang",
- "physics",
- "oa_hash_map",
+ "gd_tokenizer",
+ "gd_parser",
+ "gd_compiler",
+ "gd_bytecode",
+ "image",
+ "ordered_hash_map",
NULL
};
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index ac65fdf19c..0e34faace7 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -49,7 +49,7 @@ MainLoop *test() {
map.set(42, 11880);
int value;
- map.lookup(42, &value);
+ map.lookup(42, value);
OS::get_singleton()->print("capacity %d\n", map.get_capacity());
OS::get_singleton()->print("elements %d\n", map.get_num_elements());
@@ -72,7 +72,7 @@ MainLoop *test() {
uint32_t num_elems = 0;
for (int i = 0; i < 500; i++) {
int tmp;
- if (map.lookup(i, &tmp))
+ if (map.lookup(i, tmp) && tmp == i * 2)
num_elems++;
}
@@ -88,7 +88,7 @@ MainLoop *test() {
map.set("Godot rocks", 42);
for (OAHashMap<String, int>::Iterator it = map.iter(); it.valid; it = map.next_iter(it)) {
- OS::get_singleton()->print("map[\"%s\"] = %d\n", it.key->utf8().get_data(), *it.data);
+ OS::get_singleton()->print("map[\"%s\"] = %d\n", it.key->utf8().get_data(), *it.value);
}
}
diff --git a/main/timer_sync.cpp b/main/timer_sync.cpp
new file mode 100644
index 0000000000..9f4f6ed271
--- /dev/null
+++ b/main/timer_sync.cpp
@@ -0,0 +1,223 @@
+/*************************************************************************/
+/* timer_sync.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "timer_sync.h"
+
+void MainFrameTime::clamp_idle(float min_idle_step, float max_idle_step) {
+ if (idle_step < min_idle_step) {
+ idle_step = min_idle_step;
+ } else if (idle_step > max_idle_step) {
+ idle_step = max_idle_step;
+ }
+}
+
+/////////////////////////////////
+
+// returns the fraction of p_frame_slice required for the timer to overshoot
+// before advance_core considers changing the physics_steps return from
+// the typical values as defined by typical_physics_steps
+float MainTimerSync::get_physics_jitter_fix() {
+ return Engine::get_singleton()->get_physics_jitter_fix();
+}
+
+// gets our best bet for the average number of physics steps per render frame
+// return value: number of frames back this data is consistent
+int MainTimerSync::get_average_physics_steps(float &p_min, float &p_max) {
+ p_min = typical_physics_steps[0];
+ p_max = p_min + 1;
+
+ for (int i = 1; i < CONTROL_STEPS; ++i) {
+ const float typical_lower = typical_physics_steps[i];
+ const float current_min = typical_lower / (i + 1);
+ if (current_min > p_max)
+ return i; // bail out of further restrictions would void the interval
+ else if (current_min > p_min)
+ p_min = current_min;
+ const float current_max = (typical_lower + 1) / (i + 1);
+ if (current_max < p_min)
+ return i;
+ else if (current_max < p_max)
+ p_max = current_max;
+ }
+
+ return CONTROL_STEPS;
+}
+
+// advance physics clock by p_idle_step, return appropriate number of steps to simulate
+MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_per_second, float p_idle_step) {
+ MainFrameTime ret;
+
+ ret.idle_step = p_idle_step;
+
+ // simple determination of number of physics iteration
+ time_accum += ret.idle_step;
+ ret.physics_steps = floor(time_accum * p_iterations_per_second);
+
+ int min_typical_steps = typical_physics_steps[0];
+ int max_typical_steps = min_typical_steps + 1;
+
+ // given the past recorded steps and typcial steps to match, calculate bounds for this
+ // step to be typical
+ bool update_typical = false;
+
+ for (int i = 0; i < CONTROL_STEPS - 1; ++i) {
+ int steps_left_to_match_typical = typical_physics_steps[i + 1] - accumulated_physics_steps[i];
+ if (steps_left_to_match_typical > max_typical_steps ||
+ steps_left_to_match_typical + 1 < min_typical_steps) {
+ update_typical = true;
+ break;
+ }
+
+ if (steps_left_to_match_typical > min_typical_steps)
+ min_typical_steps = steps_left_to_match_typical;
+ if (steps_left_to_match_typical + 1 < max_typical_steps)
+ max_typical_steps = steps_left_to_match_typical + 1;
+ }
+
+ // try to keep it consistent with previous iterations
+ if (ret.physics_steps < min_typical_steps) {
+ const int max_possible_steps = floor((time_accum)*p_iterations_per_second + get_physics_jitter_fix());
+ if (max_possible_steps < min_typical_steps) {
+ ret.physics_steps = max_possible_steps;
+ update_typical = true;
+ } else {
+ ret.physics_steps = min_typical_steps;
+ }
+ } else if (ret.physics_steps > max_typical_steps) {
+ const int min_possible_steps = floor((time_accum)*p_iterations_per_second - get_physics_jitter_fix());
+ if (min_possible_steps > max_typical_steps) {
+ ret.physics_steps = min_possible_steps;
+ update_typical = true;
+ } else {
+ ret.physics_steps = max_typical_steps;
+ }
+ }
+
+ time_accum -= ret.physics_steps * p_frame_slice;
+
+ // keep track of accumulated step counts
+ for (int i = CONTROL_STEPS - 2; i >= 0; --i) {
+ accumulated_physics_steps[i + 1] = accumulated_physics_steps[i] + ret.physics_steps;
+ }
+ accumulated_physics_steps[0] = ret.physics_steps;
+
+ if (update_typical) {
+ for (int i = CONTROL_STEPS - 1; i >= 0; --i) {
+ if (typical_physics_steps[i] > accumulated_physics_steps[i]) {
+ typical_physics_steps[i] = accumulated_physics_steps[i];
+ } else if (typical_physics_steps[i] < accumulated_physics_steps[i] - 1) {
+ typical_physics_steps[i] = accumulated_physics_steps[i] - 1;
+ }
+ }
+ }
+
+ return ret;
+}
+
+// calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
+MainFrameTime MainTimerSync::advance_checked(float p_frame_slice, int p_iterations_per_second, float p_idle_step) {
+ if (fixed_fps != -1)
+ p_idle_step = 1.0 / fixed_fps;
+
+ // compensate for last deficit
+ p_idle_step += time_deficit;
+
+ MainFrameTime ret = advance_core(p_frame_slice, p_iterations_per_second, p_idle_step);
+
+ // we will do some clamping on ret.idle_step and need to sync those changes to time_accum,
+ // that's easiest if we just remember their fixed difference now
+ const double idle_minus_accum = ret.idle_step - time_accum;
+
+ // first, least important clamping: keep ret.idle_step consistent with typical_physics_steps.
+ // this smoothes out the idle steps and culls small but quick variations.
+ {
+ float min_average_physics_steps, max_average_physics_steps;
+ int consistent_steps = get_average_physics_steps(min_average_physics_steps, max_average_physics_steps);
+ if (consistent_steps > 3) {
+ ret.clamp_idle(min_average_physics_steps * p_frame_slice, max_average_physics_steps * p_frame_slice);
+ }
+ }
+
+ // second clamping: keep abs(time_deficit) < jitter_fix * frame_slise
+ float max_clock_deviation = get_physics_jitter_fix() * p_frame_slice;
+ ret.clamp_idle(p_idle_step - max_clock_deviation, p_idle_step + max_clock_deviation);
+
+ // last clamping: make sure time_accum is between 0 and p_frame_slice for consistency between physics and idle
+ ret.clamp_idle(idle_minus_accum, idle_minus_accum + p_frame_slice);
+
+ // restore time_accum
+ time_accum = ret.idle_step - idle_minus_accum;
+
+ // track deficit
+ time_deficit = p_idle_step - ret.idle_step;
+
+ return ret;
+}
+
+// determine wall clock step since last iteration
+float MainTimerSync::get_cpu_idle_step() {
+ uint64_t cpu_ticks_elapsed = current_cpu_ticks_usec - last_cpu_ticks_usec;
+ last_cpu_ticks_usec = current_cpu_ticks_usec;
+
+ return cpu_ticks_elapsed / 1000000.0;
+}
+
+MainTimerSync::MainTimerSync() :
+ last_cpu_ticks_usec(0),
+ current_cpu_ticks_usec(0),
+ time_accum(0),
+ time_deficit(0),
+ fixed_fps(0) {
+ for (int i = CONTROL_STEPS - 1; i >= 0; --i) {
+ typical_physics_steps[i] = i;
+ accumulated_physics_steps[i] = i;
+ }
+}
+
+// start the clock
+void MainTimerSync::init(uint64_t p_cpu_ticks_usec) {
+ current_cpu_ticks_usec = last_cpu_ticks_usec = p_cpu_ticks_usec;
+}
+
+// set measured wall clock time
+void MainTimerSync::set_cpu_ticks_usec(uint64_t p_cpu_ticks_usec) {
+ current_cpu_ticks_usec = p_cpu_ticks_usec;
+}
+
+void MainTimerSync::set_fixed_fps(int p_fixed_fps) {
+ fixed_fps = p_fixed_fps;
+}
+
+// advance one frame, return timesteps to take
+MainFrameTime MainTimerSync::advance(float p_frame_slice, int p_iterations_per_second) {
+ float cpu_idle_step = get_cpu_idle_step();
+
+ return advance_checked(p_frame_slice, p_iterations_per_second, cpu_idle_step);
+}
diff --git a/main/timer_sync.h b/main/timer_sync.h
new file mode 100644
index 0000000000..75fbe6a9dc
--- /dev/null
+++ b/main/timer_sync.h
@@ -0,0 +1,101 @@
+/*************************************************************************/
+/* timer_sync.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef TIMER_SYNC_H
+#define TIMER_SYNC_H
+
+#include "core/engine.h"
+
+struct MainFrameTime {
+ float idle_step; // time to advance idles for (argument to process())
+ int physics_steps; // number of times to iterate the physics engine
+
+ void clamp_idle(float min_idle_step, float max_idle_step);
+};
+
+class MainTimerSync {
+ // wall clock time measured on the main thread
+ uint64_t last_cpu_ticks_usec;
+ uint64_t current_cpu_ticks_usec;
+
+ // logical game time since last physics timestep
+ float time_accum;
+
+ // current difference between wall clock time and reported sum of idle_steps
+ float time_deficit;
+
+ // number of frames back for keeping accumulated physics steps roughly constant.
+ // value of 12 chosen because that is what is required to make 144 Hz monitors
+ // behave well with 60 Hz physics updates. The only worse commonly available refresh
+ // would be 85, requiring CONTROL_STEPS = 17.
+ static const int CONTROL_STEPS = 12;
+
+ // sum of physics steps done over the last (i+1) frames
+ int accumulated_physics_steps[CONTROL_STEPS];
+
+ // typical value for accumulated_physics_steps[i] is either this or this plus one
+ int typical_physics_steps[CONTROL_STEPS];
+
+ int fixed_fps;
+
+protected:
+ // returns the fraction of p_frame_slice required for the timer to overshoot
+ // before advance_core considers changing the physics_steps return from
+ // the typical values as defined by typical_physics_steps
+ float get_physics_jitter_fix();
+
+ // gets our best bet for the average number of physics steps per render frame
+ // return value: number of frames back this data is consistent
+ int get_average_physics_steps(float &p_min, float &p_max);
+
+ // advance physics clock by p_idle_step, return appropriate number of steps to simulate
+ MainFrameTime advance_core(float p_frame_slice, int p_iterations_per_second, float p_idle_step);
+
+ // calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
+ MainFrameTime advance_checked(float p_frame_slice, int p_iterations_per_second, float p_idle_step);
+
+ // determine wall clock step since last iteration
+ float get_cpu_idle_step();
+
+public:
+ MainTimerSync();
+
+ // start the clock
+ void init(uint64_t p_cpu_ticks_usec);
+ // set measured wall clock time
+ void set_cpu_ticks_usec(uint64_t p_cpu_ticks_usec);
+ //set fixed fps
+ void set_fixed_fps(int p_fixed_fps);
+
+ // advance one frame, return timesteps to take
+ MainFrameTime advance(float p_frame_slice, int p_iterations_per_second);
+};
+
+#endif // TIMER_SYNC_H
diff --git a/methods.py b/methods.py
index ab49ae9dda..227a17d312 100644
--- a/methods.py
+++ b/methods.py
@@ -1,5 +1,5 @@
import os
-from compat import iteritems
+from compat import iteritems, itervalues, open_utf8, escape_string
def add_source_files(self, sources, filetype, lib_env=None, shared=False):
@@ -19,637 +19,6 @@ def add_source_files(self, sources, filetype, lib_env=None, shared=False):
sources.append(self.Object(f))
-def build_shader_header(target, source, env):
-
- for x in source:
- print(x)
-
- name = str(x)
- name = name[name.rfind("/") + 1:]
- name = name[name.rfind("\\") + 1:]
- name = name.replace(".", "_")
-
- fs = open(str(x), "r")
- fd = open(str(x) + ".gen.h", "w")
- fd.write("/* this file has been generated by SCons, do not edit! */\n")
- fd.write("static const char *" + name + "=\n")
- line = fs.readline()
- while(line):
- line = line.replace("\r", "")
- line = line.replace("\n", "")
- line = line.replace("\\", "\\\\")
- line = line.replace("\"", "\\\"")
- fd.write("\"" + line + "\\n\"\n")
- line = fs.readline()
-
- fd.write(";\n")
-
- return 0
-
-
-def build_glsl_header(filename):
-
- fs = open(filename, "r")
- line = fs.readline()
-
- vertex_lines = []
- fragment_lines = []
- uniforms = []
- attributes = []
- fbos = []
- conditionals = []
- texunits = []
- texunit_names = []
- ubos = []
- ubo_names = []
-
- reading = ""
- line_offset = 0
- vertex_offset = 0
- fragment_offset = 0
-
- while(line):
-
- if (line.find("[vertex]") != -1):
- reading = "vertex"
- line = fs.readline()
- line_offset += 1
- vertex_offset = line_offset
- continue
-
- if (line.find("[fragment]") != -1):
- reading = "fragment"
- line = fs.readline()
- line_offset += 1
- fragment_offset = line_offset
- continue
-
- if (line.find("#ifdef ") != -1):
- ifdefline = line.replace("#ifdef ", "").strip()
- if (not ifdefline in conditionals):
- conditionals += [ifdefline]
-
- if (line.find("#elif defined(") != -1):
- ifdefline = line.replace("#elif defined(", "").strip()
- ifdefline = ifdefline.replace(")", "").strip()
- if (not ifdefline in conditionals):
- conditionals += [ifdefline]
-
- import re
- if re.search(r"^\s*uniform", line):
-
- if (line.lower().find("texunit:") != -1):
- # texture unit
- texunit = str(int(line[line.find(":") + 1:].strip()))
- uline = line[:line.lower().find("//")]
- uline = uline.replace("uniform", "")
- uline = uline.replace(";", "")
- lines = uline.split(",")
- for x in lines:
-
- x = x.strip()
- x = x[x.rfind(" ") + 1:]
- if (x.find("[") != -1):
- # unfiorm array
- x = x[:x.find("[")]
-
- if (not x in texunit_names):
- texunits += [(x, texunit)]
- texunit_names += [x]
-
- elif (line.lower().find("ubo:") != -1):
- # ubo
- uboidx = str(int(line[line.find(":") + 1:].strip()))
- uline = line[:line.lower().find("//")]
- uline = uline[uline.find("uniform") + len("uniform"):]
- uline = uline.replace(";", "")
- uline = uline.replace("{", "").strip()
- lines = uline.split(",")
- for x in lines:
-
- x = x.strip()
- x = x[x.rfind(" ") + 1:]
- if (x.find("[") != -1):
- # unfiorm array
- x = x[:x.find("[")]
-
- if (not x in ubo_names):
- ubos += [(x, uboidx)]
- ubo_names += [x]
-
- else:
- uline = line.replace("uniform", "")
- uline = uline.replace(";", "")
- lines = uline.split(",")
- for x in lines:
-
- x = x.strip()
- x = x[x.rfind(" ") + 1:]
- if (x.find("[") != -1):
- # unfiorm array
- x = x[:x.find("[")]
-
- if (not x in uniforms):
- uniforms += [x]
-
- if ((line.strip().find("in ") == 0 or line.strip().find("attribute ") == 0) and line.find("attrib:") != -1):
- uline = line.replace("in ", "")
- uline = uline.replace("attribute ", "")
- uline = uline.replace(";", "")
- uline = uline[uline.find(" "):].strip()
-
- if (uline.find("//") != -1):
- name, bind = uline.split("//")
- if (bind.find("attrib:") != -1):
- name = name.strip()
- bind = bind.replace("attrib:", "").strip()
- attributes += [(name, bind)]
-
- if (line.strip().find("out ") == 0):
- uline = line.replace("out", "").strip()
- uline = uline.replace(";", "")
- uline = uline[uline.find(" "):].strip()
-
- if (uline.find("//") != -1):
- name, bind = uline.split("//")
- if (bind.find("drawbuffer:") != -1):
- name = name.strip()
- bind = bind.replace("drawbuffer:", "").strip()
- fbos += [(name, bind)]
-
- line = line.replace("\r", "")
- line = line.replace("\n", "")
- line = line.replace("\\", "\\\\")
- line = line.replace("\"", "\\\"")
- # line=line+"\\n\\" no need to anymore
-
- if (reading == "vertex"):
- vertex_lines += [line]
- if (reading == "fragment"):
- fragment_lines += [line]
-
- line = fs.readline()
- line_offset += 1
-
- fs.close()
-
- out_file = filename + ".gen.h"
- fd = open(out_file, "w")
-
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
-
- out_file_base = out_file
- out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
- out_file_base = out_file_base[out_file_base.rfind("\\") + 1:]
-# print("out file "+out_file+" base " +out_file_base)
- out_file_ifdef = out_file_base.replace(".", "_").upper()
- fd.write("#ifndef " + out_file_ifdef + "\n")
- fd.write("#define " + out_file_ifdef + "\n")
-
- out_file_class = out_file_base.replace(".glsl.h", "").title().replace("_", "").replace(".", "") + "ShaderGL"
- fd.write("\n\n")
- fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n")
- fd.write("class " + out_file_class + " : public ShaderGL {\n\n")
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
- fd.write("public:\n\n")
-
- if (len(conditionals)):
- fd.write("\tenum Conditionals {\n")
- for x in conditionals:
- fd.write("\t\t" + x + ",\n")
- fd.write("\t};\n\n")
- if (len(uniforms)):
- fd.write("\tenum Uniforms {\n")
- for x in uniforms:
- fd.write("\t\t" + x.upper() + ",\n")
- fd.write("\t};\n\n")
-
- fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n")
- if (len(conditionals)):
-
- fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
- fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value?1:0); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Plane& p_plane) { _FU GLfloat plane[4]={p_plane.normal.x,p_plane.normal.y,p_plane.normal.z,p_plane.d}; glUniform4fv(get_uniform(p_uniform),1,plane); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n")
-
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
-
- const Transform &tr = p_transform;
-
- GLfloat matrix[16]={ /* build a 16x16 matrix */
- tr.basis.elements[0][0],
- tr.basis.elements[1][0],
- tr.basis.elements[2][0],
- 0,
- tr.basis.elements[0][1],
- tr.basis.elements[1][1],
- tr.basis.elements[2][1],
- 0,
- tr.basis.elements[0][2],
- tr.basis.elements[1][2],
- tr.basis.elements[2][2],
- 0,
- tr.origin.x,
- tr.origin.y,
- tr.origin.z,
- 1
- };
-
-
- glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
-
-
- }
-
- """)
-
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform2D& p_transform) { _FU
-
- const Transform2D &tr = p_transform;
-
- GLfloat matrix[16]={ /* build a 16x16 matrix */
- tr.elements[0][0],
- tr.elements[0][1],
- 0,
- 0,
- tr.elements[1][0],
- tr.elements[1][1],
- 0,
- 0,
- 0,
- 0,
- 1,
- 0,
- tr.elements[2][0],
- tr.elements[2][1],
- 0,
- 1
- };
-
-
- glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
-
-
- }
-
- """)
-
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
-
- GLfloat matrix[16];
-
- for (int i=0;i<4;i++) {
- for (int j=0;j<4;j++) {
-
- matrix[i*4+j]=p_matrix.matrix[i][j];
- }
- }
-
- glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
- }; """)
-
- fd.write("\n\n#undef _FU\n\n\n")
-
- fd.write("\tvirtual void init() {\n\n")
- if (len(conditionals)):
-
- fd.write("\t\tstatic const char* _conditional_strings[]={\n")
- if (len(conditionals)):
- for x in conditionals:
- fd.write("\t\t\t\"#define " + x + "\\n\",\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
-
- if (len(uniforms)):
-
- fd.write("\t\tstatic const char* _uniform_strings[]={\n")
- if (len(uniforms)):
- for x in uniforms:
- fd.write("\t\t\t\"" + x + "\",\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
-
- if (len(attributes)):
-
- fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
- for x in attributes:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
-
- if (len(fbos)):
- fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n")
- for x in fbos:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic FBOPair *_fbo_pairs=NULL;\n")
-
- if (len(ubos)):
- fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
- for x in ubos:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
-
- if (len(texunits)):
- fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
- for x in texunits:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
-
- fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
- for x in vertex_lines:
- fd.write("\t\t\t" + x + "\n")
- fd.write("\t\t\";\n\n")
-
- fd.write("\t\tstatic const int _vertex_code_start=" + str(vertex_offset) + ";\n")
-
- fd.write("\t\tstatic const char* _fragment_code=\"\\\n")
- for x in fragment_lines:
- fd.write("\t\t\t" + x + "\n")
- fd.write("\t\t\";\n\n")
-
- fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
-
- fd.write("\t\tsetup(_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_attribute_pairs," + str(len(attributes)) + ",_fbo_pairs," + str(len(fbos)) + ",_ubo_pairs," + str(len(ubos)) + ",_texunit_pairs," + str(len(texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
- fd.write("\t};\n\n")
-
- fd.write("};\n\n")
- fd.write("#endif\n\n")
- fd.close()
-
-
-def build_glsl_headers(target, source, env):
-
- for x in source:
-
- build_glsl_header(str(x))
-
- return 0
-
-
-def build_hlsl_dx9_header(filename):
-
- fs = open(filename, "r")
- line = fs.readline()
-
- vertex_lines = []
- fragment_lines = []
- uniforms = []
- fragment_uniforms = []
- attributes = []
- fbos = []
- conditionals = []
-
- reading = ""
- line_offset = 0
- vertex_offset = 0
- fragment_offset = 0
-
- while(line):
-
- if (line.find("[vertex]") != -1):
- reading = "vertex"
- line = fs.readline()
- line_offset += 1
- vertex_offset = line_offset
- continue
-
- if (line.find("[fragment]") != -1):
- reading = "fragment"
- line = fs.readline()
- line_offset += 1
- fragment_offset = line_offset
- continue
-
- if (line.find("#ifdef ") != -1):
- ifdefline = line.replace("#ifdef ", "").strip()
- if (not ifdefline in conditionals):
- conditionals += [ifdefline]
-
- if (line.find("#elif defined(") != -1):
- ifdefline = line.replace("#elif defined(", "").strip()
- ifdefline = ifdefline.replace(")", "").strip()
- if (not ifdefline in conditionals):
- conditionals += [ifdefline]
- if (line.find("uniform") != -1):
- uline = line.replace("uniform", "")
- uline = uline.replace(";", "")
- lines = uline.split(",")
- for x in lines:
-
- x = x.strip()
- x = x[x.rfind(" ") + 1:]
- if (x.find("[") != -1):
- # unfiorm array
- x = x[:x.find("[")]
-
- if (not x in uniforms):
- uniforms += [x]
- fragment_uniforms += [reading == "fragment"]
- line = line.replace("\r", "")
- line = line.replace("\n", "")
- line = line.replace("\\", "\\\\")
- line = line.replace("\"", "\\\"")
- line = line + "\\n\\"
-
- if (reading == "vertex"):
- vertex_lines += [line]
- if (reading == "fragment"):
- fragment_lines += [line]
-
- line = fs.readline()
- line_offset += 1
-
- fs.close()
-
- out_file = filename + ".gen.h"
- fd = open(out_file, "w")
-
- fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
-
- out_file_base = out_file
- out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
- out_file_base = out_file_base[out_file_base.rfind("\\") + 1:]
-# print("out file "+out_file+" base " +out_file_base)
- out_file_ifdef = out_file_base.replace(".", "_").upper()
- fd.write("#ifndef " + out_file_ifdef + "\n")
- fd.write("#define " + out_file_ifdef + "\n")
-
- out_file_class = out_file_base.replace(".hlsl.h", "").title().replace("_", "").replace(".", "") + "ShaderDX9"
- fd.write("\n\n")
- fd.write("#include \"drivers/directx9/shader_dx9.h\"\n\n\n")
- fd.write("class " + out_file_class + " : public ShaderDX9 {\n\n")
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
- fd.write("public:\n\n")
-
- if (len(conditionals)):
- fd.write("\tenum Conditionals {\n")
- for x in conditionals:
- fd.write("\t\t" + x + ",\n")
- fd.write("\t};\n\n")
- if (len(uniforms)):
- fd.write("\tenum Uniforms {\n")
- for x in uniforms:
- fd.write("\t\t" + x.upper() + ",\n")
- fd.write("\t};\n\n")
-
- if (len(conditionals)):
- fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n")
-
- fd.write("\t#define _FU if (!_uniform_valid(p_uniform)) return; ERR_FAIL_COND( get_active()!=this );\n\n ")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, bool p_value) { _FU set_uniformb(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU set_uniformf(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n");
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU set_uniformi(p_uniform,p_value); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU float col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; set_uniformfv(p_uniform,col); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU float vec2[4]={p_vec2.x,p_vec2.y,0,0}; set_uniformfv(p_uniform,vec2); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU float vec3[4]={p_vec3.x,p_vec3.y,p_vec3.z,0}; set_uniformfv(p_uniform,vec3); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU float vec2[4]={p_a,p_b,0,0}; set_uniformfv(p_uniform,vec2); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU float vec3[4]={p_a,p_b,p_c,0}; set_uniformfv(p_uniform,vec3); }\n\n")
- fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU float vec4[4]={p_a,p_b,p_c,p_d}; set_uniformfv(p_uniform,vec4); }\n\n")
-
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
-
- const Transform &tr = p_transform;
-
- float matrix[16]={ /* build a 16x16 matrix */
- tr.basis.elements[0][0],
- tr.basis.elements[0][1],
- tr.basis.elements[0][2],
- tr.origin.x,
- tr.basis.elements[1][0],
- tr.basis.elements[1][1],
- tr.basis.elements[1][2],
- tr.origin.y,
- tr.basis.elements[2][0],
- tr.basis.elements[2][1],
- tr.basis.elements[2][2],
- tr.origin.z,
- 0,
- 0,
- 0,
- 1
- };
-
- set_uniformfv(p_uniform,&matrix[0],4);
-
- }
-
- """)
-
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
-
- float matrix[16];
-
- for (int i=0;i<4;i++) {
- for (int j=0;j<4;j++) {
-
- matrix[i*4+j]=p_matrix.matrix[j][i];
- }
- }
-
- set_uniformfv(p_uniform,&matrix[0],4);
- }; """)
-
- fd.write("\n\n#undef _FU\n\n\n")
-
- fd.write("\tvirtual void init(IDirect3DDevice9 *p_device,ShaderSupport p_version) {\n\n")
- if (len(conditionals)):
-
- fd.write("\t\tstatic const char* _conditional_strings[]={\n")
- if (len(conditionals)):
- for x in conditionals:
- fd.write("\t\t\t\"" + x + "\",\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
-
- if (len(uniforms)):
-
- fd.write("\t\tstatic const char* _uniform_strings[]={\n")
- if (len(uniforms)):
- for x in uniforms:
- fd.write("\t\t\t\"" + x + "\",\n")
- fd.write("\t\t};\n\n")
-
- fd.write("\t\tstatic const bool _fragment_uniforms[]={\n")
-
- if (len(uniforms)):
- for x in fragment_uniforms:
- if (x):
- fd.write("\t\t\ttrue,\n")
- else:
- fd.write("\t\t\tfalse,\n")
- fd.write("\t\t};\n\n")
- else:
- fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
- fd.write("\t\tstatic const bool *_fragment_uniforms=NULL;\n")
-
- fd.write("\t\tstatic const char* _vertex_code=\"\\\n")
- for x in vertex_lines:
- fd.write("\t\t\t" + x + "\n")
- fd.write("\t\t\";\n\n")
-
- fd.write("\t\tstatic const int _vertex_code_start=" + str(vertex_offset) + ";\n")
-
- fd.write("\t\tstatic const char* _fragment_code=\"\\\n")
- for x in fragment_lines:
- fd.write("\t\t\t" + x + "\n")
- fd.write("\t\t\";\n\n")
-
- fd.write("\t\tstatic const int _fragment_code_start=" + str(fragment_offset) + ";\n")
-
- fd.write("\t\tsetup(p_device,p_version,_conditional_strings," + str(len(conditionals)) + ",_uniform_strings," + str(len(uniforms)) + ",_fragment_uniforms,_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
- fd.write("\t};\n\n")
-
- fd.write("};\n\n")
- fd.write("#endif\n\n")
- fd.close()
-
-
-def build_hlsl_dx9_headers(target, source, env):
-
- for x in source:
-
- build_hlsl_dx9_header(str(x))
-
- return 0
-
class LegacyGLHeaderStruct:
@@ -724,7 +93,6 @@ def include_file_in_legacygl_header(filename, header_data, depth):
enumbase = ifdefline[:ifdefline.find("_EN_")]
ifdefline = ifdefline.replace("_EN_", "_")
line = line.replace("_EN_", "_")
-# print(enumbase+":"+ifdefline);
if (enumbase not in header_data.enums):
header_data.enums[enumbase] = []
if (ifdefline not in header_data.enums[enumbase]):
@@ -823,9 +191,6 @@ def include_file_in_legacygl_header(filename, header_data, depth):
line = line.replace("\r", "")
line = line.replace("\n", "")
- # line=line.replace("\\","\\\\")
- # line=line.replace("\"","\\\"")
- # line=line+"\\n\\"
if (header_data.reading == "vertex"):
header_data.vertex_lines += [line]
@@ -840,7 +205,7 @@ def include_file_in_legacygl_header(filename, header_data, depth):
return header_data
-def build_legacygl_header(filename, include, class_suffix, output_attribs):
+def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2=False):
header_data = LegacyGLHeaderStruct()
include_file_in_legacygl_header(filename, header_data, 0)
@@ -855,7 +220,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1:]
out_file_base = out_file_base[out_file_base.rfind("\\") + 1:]
-# print("out file "+out_file+" base " +out_file_base)
out_file_ifdef = out_file_base.replace(".", "_").upper()
fd.write("#ifndef " + out_file_ifdef + class_suffix + "_120\n")
fd.write("#define " + out_file_ifdef + class_suffix + "_120\n")
@@ -893,10 +257,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n")
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int64_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, unsigned long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
- #fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, long p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n");
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n")
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n")
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n")
@@ -928,14 +288,14 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
};
- glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
}
""")
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform2D& p_transform) { _FU
+ fd.write("""_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform2D& p_transform) { _FU
const Transform2D &tr = p_transform;
@@ -959,14 +319,14 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
};
- glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
+ glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
}
""")
- fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
+ fd.write("""_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
GLfloat matrix[16];
@@ -978,7 +338,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
}
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
- }; """)
+ } """)
fd.write("\n\n#undef _FU\n\n\n")
@@ -998,10 +358,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
x = header_data.enums[xv]
bits = 1
amt = len(x)
-# print(x)
while(2**bits < amt):
bits += 1
-# print("amount: "+str(amt)+" bits "+str(bits));
strs = "{"
for i in range(amt):
strs += "\"#define " + x[i] + "\\n\","
@@ -1061,7 +419,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
feedback_count = 0
- if (len(header_data.feedbacks)):
+ if (not gles2 and len(header_data.feedbacks)):
fd.write("\t\tstatic const Feedback _feedbacks[]={\n")
for x in header_data.feedbacks:
@@ -1076,7 +434,10 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\t};\n\n")
else:
- fd.write("\t\tstatic const Feedback* _feedbacks=NULL;\n")
+ if gles2:
+ pass
+ else:
+ fd.write("\t\tstatic const Feedback* _feedbacks=NULL;\n")
if (len(header_data.texunits)):
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
@@ -1086,13 +447,16 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
- if (len(header_data.ubos)):
+ if (not gles2 and len(header_data.ubos)):
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
for x in header_data.ubos:
fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
fd.write("\t\t};\n\n")
else:
- fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
+ if gles2:
+ pass
+ else:
+ fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
fd.write("\t\tstatic const char _vertex_code[]={\n")
for x in header_data.vertex_lines:
@@ -1115,11 +479,17 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n")
if output_attribs:
- fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_attribute_pairs," + str(len(header_data.attributes)) + ", _texunit_pairs," + str(len(header_data.texunits)) + ",_ubo_pairs," + str(len(header_data.ubos)) + ",_feedbacks," + str(feedback_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ if gles2:
+ fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_attribute_pairs," + str(len(header_data.attributes)) + ", _texunit_pairs," + str(len(header_data.texunits)) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ else:
+ fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_attribute_pairs," + str(len(header_data.attributes)) + ", _texunit_pairs," + str(len(header_data.texunits)) + ",_ubo_pairs," + str(len(header_data.ubos)) + ",_feedbacks," + str(feedback_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
else:
- fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_texunit_pairs," + str(len(header_data.texunits)) + ",_enums," + str(len(header_data.enums)) + ",_enum_values," + str(enum_value_count) + ",_ubo_pairs," + str(len(header_data.ubos)) + ",_feedbacks," + str(feedback_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ if gles2:
+ fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_texunit_pairs," + str(len(header_data.texunits)) + ",_enums," + str(len(header_data.enums)) + ",_enum_values," + str(enum_value_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
+ else:
+ fd.write("\t\tsetup(_conditional_strings," + str(len(header_data.conditionals)) + ",_uniform_strings," + str(len(header_data.uniforms)) + ",_texunit_pairs," + str(len(header_data.texunits)) + ",_enums," + str(len(header_data.enums)) + ",_enum_values," + str(enum_value_count) + ",_ubo_pairs," + str(len(header_data.ubos)) + ",_feedbacks," + str(feedback_count) + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
- fd.write("\t};\n\n")
+ fd.write("\t}\n\n")
if (len(enum_constants)):
@@ -1134,21 +504,243 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.close()
-def build_legacygl_headers(target, source, env):
+def build_gles3_headers(target, source, env):
for x in source:
+ build_legacygl_header(str(x), include="drivers/gles3/shader_gles3.h", class_suffix="GLES3", output_attribs=True)
- build_legacygl_header(str(x), include="drivers/legacygl/shader_lgl.h", class_suffix="LGL", output_attribs=False)
- return 0
+def build_gles2_headers(target, source, env):
+ for x in source:
+ build_legacygl_header(str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True, gles2=True)
+
+def make_authors_header(target, source, env):
+
+ sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"]
+ sections_id = ["AUTHORS_FOUNDERS", "AUTHORS_LEAD_DEVELOPERS", "AUTHORS_PROJECT_MANAGERS", "AUTHORS_DEVELOPERS"]
+
+ src = source[0].srcnode().abspath
+ dst = target[0].srcnode().abspath
+ f = open_utf8(src, "r")
+ g = open_utf8(dst, "w")
+
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef _EDITOR_AUTHORS_H\n")
+ g.write("#define _EDITOR_AUTHORS_H\n")
+
+ current_section = ""
+ reading = False
+
+ def close_section():
+ g.write("\t0\n")
+ g.write("};\n")
+
+ for line in f:
+ if reading:
+ if line.startswith(" "):
+ g.write("\t\"" + escape_string(line.strip()) + "\",\n")
+ continue
+ if line.startswith("## "):
+ if reading:
+ close_section()
+ reading = False
+ for i in range(len(sections)):
+ if line.strip().endswith(sections[i]):
+ current_section = escape_string(sections_id[i])
+ reading = True
+ g.write("const char *const " + current_section + "[] = {\n")
+ break
-def build_gles3_headers(target, source, env):
+ if reading:
+ close_section()
- for x in source:
- build_legacygl_header(str(x), include="drivers/gles3/shader_gles3.h", class_suffix="GLES3", output_attribs=True)
+ g.write("#endif\n")
+
+ g.close()
+ f.close()
+
+def make_donors_header(target, source, env):
+
+ sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors",
+ "Gold donors", "Silver donors", "Bronze donors"]
+ sections_id = ["DONORS_SPONSOR_PLAT", "DONORS_SPONSOR_GOLD", "DONORS_SPONSOR_MINI",
+ "DONORS_GOLD", "DONORS_SILVER", "DONORS_BRONZE"]
+
+ src = source[0].srcnode().abspath
+ dst = target[0].srcnode().abspath
+ f = open_utf8(src, "r")
+ g = open_utf8(dst, "w")
+
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef _EDITOR_DONORS_H\n")
+ g.write("#define _EDITOR_DONORS_H\n")
+
+ current_section = ""
+ reading = False
+
+ def close_section():
+ g.write("\t0\n")
+ g.write("};\n")
+
+ for line in f:
+ if reading >= 0:
+ if line.startswith(" "):
+ g.write("\t\"" + escape_string(line.strip()) + "\",\n")
+ continue
+ if line.startswith("## "):
+ if reading:
+ close_section()
+ reading = False
+ for i in range(len(sections)):
+ if line.strip().endswith(sections[i]):
+ current_section = escape_string(sections_id[i])
+ reading = True
+ g.write("const char *const " + current_section + "[] = {\n")
+ break
+
+ if reading:
+ close_section()
+ g.write("#endif\n")
+ g.close()
+ f.close()
+
+
+def make_license_header(target, source, env):
+ src_copyright = source[0].srcnode().abspath
+ src_license = source[1].srcnode().abspath
+ dst = target[0].srcnode().abspath
+
+ class LicenseReader:
+ def __init__(self, license_file):
+ self._license_file = license_file
+ self.line_num = 0
+ self.current = self.next_line()
+
+ def next_line(self):
+ line = self._license_file.readline()
+ self.line_num += 1
+ while line.startswith("#"):
+ line = self._license_file.readline()
+ self.line_num += 1
+ self.current = line
+ return line
+
+ def next_tag(self):
+ if not ':' in self.current:
+ return ('',[])
+ tag, line = self.current.split(":", 1)
+ lines = [line.strip()]
+ while self.next_line() and self.current.startswith(" "):
+ lines.append(self.current.strip())
+ return (tag, lines)
+
+ from collections import OrderedDict
+ projects = OrderedDict()
+ license_list = []
+
+ with open_utf8(src_copyright, "r") as copyright_file:
+ reader = LicenseReader(copyright_file)
+ part = {}
+ while reader.current:
+ tag, content = reader.next_tag()
+ if tag in ("Files", "Copyright", "License"):
+ part[tag] = content[:]
+ elif tag == "Comment":
+ # attach part to named project
+ projects[content[0]] = projects.get(content[0], []) + [part]
+
+ if not tag or not reader.current:
+ # end of a paragraph start a new part
+ if "License" in part and not "Files" in part:
+ # no Files tag in this one, so assume standalone license
+ license_list.append(part["License"])
+ part = {}
+ reader.next_line()
+
+ data_list = []
+ for project in itervalues(projects):
+ for part in project:
+ part["file_index"] = len(data_list)
+ data_list += part["Files"]
+ part["copyright_index"] = len(data_list)
+ data_list += part["Copyright"]
+
+ with open_utf8(dst, "w") as f:
+
+ f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ f.write("#ifndef _EDITOR_LICENSE_H\n")
+ f.write("#define _EDITOR_LICENSE_H\n")
+ f.write("const char *const GODOT_LICENSE_TEXT =")
+
+ with open_utf8(src_license, "r") as license_file:
+ for line in license_file:
+ escaped_string = escape_string(line.strip())
+ f.write("\n\t\t\"" + escaped_string + "\\n\"")
+ f.write(";\n\n")
+
+ f.write("struct ComponentCopyrightPart {\n"
+ "\tconst char *license;\n"
+ "\tconst char *const *files;\n"
+ "\tconst char *const *copyright_statements;\n"
+ "\tint file_count;\n"
+ "\tint copyright_count;\n"
+ "};\n\n")
+
+ f.write("struct ComponentCopyright {\n"
+ "\tconst char *name;\n"
+ "\tconst ComponentCopyrightPart *parts;\n"
+ "\tint part_count;\n"
+ "};\n\n")
+
+ f.write("const char *const COPYRIGHT_INFO_DATA[] = {\n")
+ for line in data_list:
+ f.write("\t\"" + escape_string(line) + "\",\n")
+ f.write("};\n\n")
+
+ f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n")
+ part_index = 0
+ part_indexes = {}
+ for project_name, project in iteritems(projects):
+ part_indexes[project_name] = part_index
+ for part in project:
+ f.write("\t{ \"" + escape_string(part["License"][0]) + "\", "
+ + "&COPYRIGHT_INFO_DATA[" + str(part["file_index"]) + "], "
+ + "&COPYRIGHT_INFO_DATA[" + str(part["copyright_index"]) + "], "
+ + str(len(part["Files"])) + ", "
+ + str(len(part["Copyright"])) + " },\n")
+ part_index += 1
+ f.write("};\n\n")
+
+ f.write("const int COPYRIGHT_INFO_COUNT = " + str(len(projects)) + ";\n")
+
+ f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n")
+ for project_name, project in iteritems(projects):
+ f.write("\t{ \"" + escape_string(project_name) + "\", "
+ + "&COPYRIGHT_PROJECT_PARTS[" + str(part_indexes[project_name]) + "], "
+ + str(len(project)) + " },\n")
+ f.write("};\n\n")
+
+ f.write("const int LICENSE_COUNT = " + str(len(license_list)) + ";\n")
+
+ f.write("const char *const LICENSE_NAMES[] = {\n")
+ for l in license_list:
+ f.write("\t\"" + escape_string(l[0]) + "\",\n")
+ f.write("};\n\n")
+
+ f.write("const char *const LICENSE_BODIES[] = {\n\n")
+ for l in license_list:
+ for line in l[1:]:
+ if line == ".":
+ f.write("\t\"\\n\"\n")
+ else:
+ f.write("\t\"" + escape_string(line) + "\\n\"\n")
+ f.write("\t\"\",\n\n")
+ f.write("};\n\n")
+
+ f.write("#endif\n")
def add_module_version_string(self,s):
self.module_version_string += "." + s
@@ -1220,43 +812,7 @@ def parse_cg_file(fname, uniforms, sizes, conditionals):
line = fs.readline()
-
-def build_cg_shader(sname):
-
- vp_uniforms = []
- vp_uniform_sizes = []
- vp_conditionals = []
-
- parse_cg_file("vp_" + sname + ".cg", vp_uniforms, vp_uniform_sizes, vp_conditionals)
-
- fp_uniforms = []
- fp_uniform_sizes = []
- fp_conditionals = []
-
- parse_cg_file("fp_" + sname + ".cg", fp_uniforms, fp_uniform_sizes, fp_conditionals)
-
- fd = open("shader_" + sname + ".cg.gen.h", "w")
-
- fd.write('\n#include "shader_cell.h"\n')
- fd.write("\nclass Shader_" + sname + " : public ShaderCell {\n")
- fd.write("\n\tstatic struct VertexUniforms[] = {\n")
-
- offset = 0
- for i in range(0, len(vp_uniforms)):
-
- fd.write('\t\t{ "%s", %d, %d },\n' % (vp_uniforms[i], offset, vp_uniform_sizes[i]))
- offset = offset + vp_uniform_sizes[i]
- fd.write("\t};\n\n")
-
- fd.write("public:\n\n")
-
- fd.write("\tenum {\n")
-
- for i in range(0, len(vp_uniforms)):
-
- fd.write('\t\tVP_%s,\n' % vp_uniforms[i].upper())
-
- fd.write("\t};\n")
+ fs.close()
import glob
@@ -1306,8 +862,8 @@ void unregister_module_types() {
}
"""
- f = open("modules/register_module_types.gen.cpp", "w")
- f.write(modules_cpp)
+ with open("modules/register_module_types.gen.cpp", "w") as f:
+ f.write(modules_cpp)
return module_list
@@ -1317,7 +873,6 @@ def win32_spawn(sh, escape, cmd, args, env):
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
startupinfo = subprocess.STARTUPINFO()
- #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
for e in env:
if type(env[e]) != type(""):
env[e] = str(env[e])
@@ -1406,18 +961,18 @@ def android_add_default_config(self, config):
def android_add_to_manifest(self, file):
base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file
- f = open(base_path, "r")
- self.android_manifest_chunk += f.read()
+ with open(base_path, "r") as f:
+ self.android_manifest_chunk += f.read()
def android_add_to_permissions(self, file):
base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file
- f = open(base_path, "r")
- self.android_permission_chunk += f.read()
+ with open(base_path, "r") as f:
+ self.android_permission_chunk += f.read()
def android_add_to_attributes(self, file):
base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file
- f = open(base_path, "r")
- self.android_appattributes_chunk += f.read()
+ with open(base_path, "r") as f:
+ self.android_appattributes_chunk += f.read()
def disable_module(self):
self.disabled_modules.append(self.current_module)
@@ -1440,13 +995,10 @@ def use_windows_spawn_fix(self, platform=None):
import subprocess
def mySubProcess(cmdline, env):
- prefix = ""
- if(platform == 'javascript'):
- prefix = "python.exe "
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- proc = subprocess.Popen(prefix + cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
data, err = proc.communicate()
rv = proc.wait()
@@ -1548,9 +1100,11 @@ def save_active_platforms(apnames, ap):
str += "};\n"
+ pngf.close()
+
wf = x + "/" + name + ".gen.h"
- pngw = open(wf, "w")
- pngw.write(str)
+ with open(wf, "w") as pngw:
+ pngw.write(str)
def no_verbose(sys, env):
@@ -1658,7 +1212,6 @@ def detect_visual_c_compiler_version(tools_env):
# and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
if 'VCTOOLSINSTALLDIR' in tools_env:
- # print("Checking VCTOOLSINSTALLDIR")
# Newer versions have a different path available
vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
@@ -1687,13 +1240,6 @@ def detect_visual_c_compiler_version(tools_env):
vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64"
- # debug help
- # print(vc_amd64_compiler_detection_index)
- # print(vc_amd64_x86_compiler_detection_index)
- # print(vc_x86_compiler_detection_index)
- # print(vc_x86_amd64_compiler_detection_index)
- # print("chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str))
-
return vc_chosen_compiler_str
def find_visual_c_batch_file(env):
@@ -1710,8 +1256,8 @@ def generate_cpp_hint_file(filename):
pass
else:
try:
- fd = open(filename, "w")
- fd.write("#define GDCLASS(m_class, m_inherits)\n")
+ with open(filename, "w") as fd:
+ fd.write("#define GDCLASS(m_class, m_inherits)\n")
except IOError:
print("Could not write cpp.hint file.")
@@ -1726,7 +1272,6 @@ def generate_vs_project(env, num_jobs):
'call "' + batch_file + '" !plat!']
result = " ^& ".join(common_build_prefix + [commands])
- # print("Building commandline: ", result)
return result
env.AddToVSProject(env.core_sources)
@@ -1784,3 +1329,8 @@ def add_program(env, name, sources, **args):
program = env.Program(name, sources, **args)
env.NoCache(program)
return program
+
+def CommandNoCache(env, target, sources, command, **args):
+ result = env.Command(target, sources, command, **args)
+ env.NoCache(result)
+ return result
diff --git a/misc/dist/appimage/AppRun b/misc/dist/appimage/AppRun
deleted file mode 100755
index db3398a92a..0000000000
--- a/misc/dist/appimage/AppRun
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-HERE="$(dirname "$(readlink -f "${0}")")"
-"${HERE}"/godot $@
diff --git a/misc/dist/appimage/godot.desktop b/misc/dist/appimage/godot.desktop
deleted file mode 100644
index 545c491256..0000000000
--- a/misc/dist/appimage/godot.desktop
+++ /dev/null
@@ -1,9 +0,0 @@
-[Desktop Entry]
-Name=Godot Engine
-GenericName=Libre game engine
-Comment=Multi-platform 2D and 3D game engine with a feature rich editor
-Exec=godot -pm
-Icon=godot
-Terminal=false
-Type=Application
-Categories=Development;IDE;
diff --git a/misc/dist/appimage/godot.png b/misc/dist/appimage/godot.png
deleted file mode 100644
index e334f5fa78..0000000000
--- a/misc/dist/appimage/godot.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/html/default.html b/misc/dist/html/default.html
index a1a4e89d02..14766e8239 100644
--- a/misc/dist/html/default.html
+++ b/misc/dist/html/default.html
@@ -195,7 +195,7 @@ $GODOT_HEAD_INCLUDE
</head>
<body>
<div id="container">
- <canvas id="canvas" oncontextmenu="event.preventDefault();" width="640" height="480">
+ <canvas id="canvas" width="640" height="480">
HTML5 canvas appears to be unsupported in the current browser.<br />
Please try updating or use a different browser.
</canvas>
@@ -229,7 +229,7 @@ $GODOT_HEAD_INCLUDE
(function() {
- const BASENAME = '$GODOT_BASENAME';
+ const MAIN_PACK = '$GODOT_BASENAME.pck';
const DEBUG_ENABLED = $GODOT_DEBUG_ENABLED;
const INDETERMINATE_STATUS_STEP_MS = 100;
@@ -244,9 +244,6 @@ $GODOT_HEAD_INCLUDE
var statusMode = 'hidden';
var indeterminiateStatusAnimationId = 0;
- setStatusMode('indeterminate');
- engine.setCanvas(canvas);
-
function setStatusMode(mode) {
if (statusMode === mode || !initializing)
@@ -367,18 +364,27 @@ $GODOT_HEAD_INCLUDE
});
}
- engine.startGame(BASENAME + '.pck').then(() => {
- setStatusMode('hidden');
- initializing = false;
- }, err => {
+ function displayFailureNotice(err) {
+ var msg = err.message || err;
if (DEBUG_ENABLED) {
- printError(err.message);
- console.warn(err);
+ printError(msg);
}
- setStatusNotice(err.message);
+ console.error(msg);
+ setStatusNotice(msg);
setStatusMode('notice');
initializing = false;
- });
+ };
+
+ if (!Engine.isWebGLAvailable()) {
+ displayFailureNotice("WebGL not available");
+ } else {
+ setStatusMode('indeterminate');
+ engine.setCanvas(canvas);
+ engine.startGame(MAIN_PACK).then(() => {
+ setStatusMode('hidden');
+ initializing = false;
+ }, displayFailureNotice);
+ }
})();
//]]></script>
</body>
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
index ab15e35f63..a9a40c0508 100644
--- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
@@ -22,14 +22,6 @@
1FF4C1851F584E3F00A41E41 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FF4C1841F584E3F00A41E41 /* GameKit.framework */; };
1FF4C1871F584E5600A41E41 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FF4C1861F584E5600A41E41 /* StoreKit.framework */; };
1FF4C1871F584E7600A41E41 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FF4C1881F584E7600A41E41 /* StoreKit.framework */; };
- D07CD43F1C5D573600B7FB28 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4331C5D573600B7FB28 /* Default-568h@2x.png */; };
- D07CD4411C5D573600B7FB28 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4351C5D573600B7FB28 /* Default-667h@2x.png */; };
- D07CD4421C5D573600B7FB28 /* Default-Portrait-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4361C5D573600B7FB28 /* Default-Portrait-736h@3x.png */; };
- D07CD4441C5D573600B7FB28 /* Default-Landscape-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4381C5D573600B7FB28 /* Default-Landscape-736h@3x.png */; };
- D07CD4451C5D573600B7FB28 /* Default-Landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD4391C5D573600B7FB28 /* Default-Landscape@2x.png */; };
- D07CD4461C5D573600B7FB28 /* Default-Landscape-1366h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43A1C5D573600B7FB28 /* Default-Landscape-1366h@2x.png */; };
- D07CD4471C5D573600B7FB28 /* Default-Portrait@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x.png */; };
- D07CD4481C5D573600B7FB28 /* Default-Portrait-1366h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D07CD43C1C5D573600B7FB28 /* Default-Portrait-1366h@2x.png */; };
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D07CD44D1C5D589C00B7FB28 /* Images.xcassets */; };
D0BCFE3818AEBDA2004A7AAE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */; };
D0BCFE3A18AEBDA2004A7AAE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */; };
@@ -57,14 +49,6 @@
1FF4C1881F584E7600A41E41 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
1FF4C1881F584E6300A41E41 /* $binary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = $binary.entitlements; sourceTree = "<group>"; };
1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dummy.cpp; sourceTree = "<group>"; };
- D07CD4331C5D573600B7FB28 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
- D07CD4351C5D573600B7FB28 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = "<group>"; };
- D07CD4361C5D573600B7FB28 /* Default-Portrait-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait-736h@3x.png"; sourceTree = "<group>"; };
- D07CD4381C5D573600B7FB28 /* Default-Landscape-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-736h@3x.png"; sourceTree = "<group>"; };
- D07CD4391C5D573600B7FB28 /* Default-Landscape@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x.png"; sourceTree = "<group>"; };
- D07CD43A1C5D573600B7FB28 /* Default-Landscape-1366h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-1366h@2x.png"; sourceTree = "<group>"; };
- D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x.png"; sourceTree = "<group>"; };
- D07CD43C1C5D573600B7FB28 /* Default-Portrait-1366h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait-1366h@2x.png"; sourceTree = "<group>"; };
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = $binary.app; sourceTree = BUILT_PRODUCTS_DIR; };
D0BCFE3718AEBDA2004A7AAE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -159,14 +143,6 @@
isa = PBXGroup;
children = (
1FF4C1881F584E6300A41E41 /* $binary.entitlements */,
- D07CD4331C5D573600B7FB28 /* Default-568h@2x.png */,
- D07CD4351C5D573600B7FB28 /* Default-667h@2x.png */,
- D07CD4361C5D573600B7FB28 /* Default-Portrait-736h@3x.png */,
- D07CD4381C5D573600B7FB28 /* Default-Landscape-736h@3x.png */,
- D07CD4391C5D573600B7FB28 /* Default-Landscape@2x.png */,
- D07CD43A1C5D573600B7FB28 /* Default-Landscape-1366h@2x.png */,
- D07CD43B1C5D573600B7FB28 /* Default-Portrait@2x.png */,
- D07CD43C1C5D573600B7FB28 /* Default-Portrait-1366h@2x.png */,
D07CD44D1C5D589C00B7FB28 /* Images.xcassets */,
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */,
1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */,
@@ -254,14 +230,6 @@
1F1575721F582BE20003B888 /* dylibs in Resources */,
D07CD44E1C5D589C00B7FB28 /* Images.xcassets in Resources */,
D0BCFE7818AEBFEB004A7AAE /* $binary.pck in Resources */,
- D07CD4471C5D573600B7FB28 /* Default-Portrait@2x.png in Resources */,
- D07CD4461C5D573600B7FB28 /* Default-Landscape-1366h@2x.png in Resources */,
- D07CD4411C5D573600B7FB28 /* Default-667h@2x.png in Resources */,
- D07CD43F1C5D573600B7FB28 /* Default-568h@2x.png in Resources */,
- D07CD4451C5D573600B7FB28 /* Default-Landscape@2x.png in Resources */,
- D07CD4441C5D573600B7FB28 /* Default-Landscape-736h@3x.png in Resources */,
- D07CD4421C5D573600B7FB28 /* Default-Portrait-736h@3x.png in Resources */,
- D07CD4481C5D573600B7FB28 /* Default-Portrait-1366h@2x.png in Resources */,
D0BCFE4618AEBDA2004A7AAE /* InfoPlist.strings in Resources */,
$additional_pbx_resources_build
);
@@ -377,6 +345,7 @@
buildSettings = {
ARCHS = "$godot_archs";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements;
CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
@@ -401,6 +370,7 @@
buildSettings = {
ARCHS = "$godot_archs";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements;
CODE_SIGN_IDENTITY = "$code_sign_identity_release";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";
diff --git a/misc/dist/ios_xcode/godot_ios/Default-568h@2x.png b/misc/dist/ios_xcode/godot_ios/Default-568h@2x.png
deleted file mode 100644
index 1d5e472665..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-568h@2x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-667h@2x.png b/misc/dist/ios_xcode/godot_ios/Default-667h@2x.png
deleted file mode 100644
index b51598fed0..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-667h@2x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.png
deleted file mode 100644
index ec5b4f7888..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Landscape-1366h@2x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.png
deleted file mode 100644
index 2a025b745b..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Landscape-736h@3x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.png
deleted file mode 100644
index 7099f3e18d..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Landscape@2x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.png
deleted file mode 100644
index a6d054ba2a..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Portrait-1366h@2x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.png
deleted file mode 100644
index 8c44edbccd..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Portrait-736h@3x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.png b/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.png
deleted file mode 100644
index a6d054ba2a..0000000000
--- a/misc/dist/ios_xcode/godot_ios/Default-Portrait@2x.png
+++ /dev/null
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json
new file mode 100644
index 0000000000..ce81d76027
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json
@@ -0,0 +1,102 @@
+{
+ "images" : [
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2436h",
+ "filename" : "Default-Portrait-X.png",
+ "minimum-system-version" : "11.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2436h",
+ "filename" : "Default-Landscape-X.png",
+ "minimum-system-version" : "11.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "736h",
+ "filename" : "Default-Portrait-736h@3x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "736h",
+ "filename" : "Default-Landscape-736h@3x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "667h",
+ "filename" : "Default-667h@2x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default-480h@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "retina4",
+ "filename" : "Default-568h@2x.png",
+ "minimum-system-version" : "7.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.png
new file mode 100644
index 0000000000..1299ceaee5
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png
new file mode 100644
index 0000000000..604a7ba701
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png
new file mode 100644
index 0000000000..bffb8c9fde
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png
new file mode 100644
index 0000000000..47826cd683
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png
new file mode 100644
index 0000000000..0f44a704b5
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png
new file mode 100644
index 0000000000..07ab777bc2
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
new file mode 100644
index 0000000000..774b9c5bbf
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png
new file mode 100644
index 0000000000..fff36679c7
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png
new file mode 100644
index 0000000000..0804519faa
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png
new file mode 100644
index 0000000000..833142222c
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png
Binary files differ
diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
new file mode 100644
index 0000000000..4c934c4a53
--- /dev/null
+++ b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
Binary files differ
diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6
index 22836e03ed..64495d817e 100644
--- a/misc/dist/linux/godot.6
+++ b/misc/dist/linux/godot.6
@@ -1,4 +1,4 @@
-.TH GODOT "6" "January 2018" "godot 3.0" "Games"
+.TH GODOT "6" "February 2018" "godot 3.1" "Games"
.SH NAME
godot \- multi\-platform 2D and 3D game engine with a feature\-rich editor
.SH SYNOPSIS
@@ -31,6 +31,9 @@ Start the editor instead of running the scene.
\fB\-p\fR, \fB\-\-project\-manager\fR
Start the project manager, even if a project is auto\-detected.
.TP
+\fB\-q\fR, \fB\-\-quit\fR
+Quit after the first iteration.
+.TP
\fB\-l\fR, \fB\-\-language\fR <locale>
Use a specific locale (<locale> being a two\-letter code).
.TP
@@ -56,7 +59,7 @@ Password for remote filesystem.
Audio driver ('PulseAudio', 'ALSA').
.TP
\fB\-\-video\-driver\fR <driver>
-Video driver ('GLES3').
+Video driver ('GLES3', 'GLES2').
.SS "Display options:"
.TP
\fB\-f\fR, \fB\-\-fullscreen\fR
@@ -68,6 +71,9 @@ Request a maximized window.
\fB\-w\fR, \fB\-\-windowed\fR
Request windowed mode.
.TP
+\fB\-t\fR, \fB\-\-always\-on\-top\fR
+Request an always\-on\-top window.
+.TP
\fB\-\-resolution\fR <W>x<H>
Request window resolution.
.TP
@@ -113,16 +119,19 @@ Disable crash handler when supported by the platform code.
.TP
\fB\-\-fixed\-fps\fR <fps>
Force a fixed number of frames per second. This setting disables real\-time synchronization.
+.TP
+\fB\-\-print\-fps\fR
+Print the frames per second to the stdout.
.SS "Standalone tools:"
.TP
\fB\-s\fR, \fB\-\-script\fR <script>
Run a script.
.TP
\fB\-\-export\fR <target>
-Export the project using the given export target.
+Export the project using the given export target. Export only main pack if path ends with .pck or .zip.
.TP
\fB\-\-export\-debug\fR
-Use together with \fB\-\-export\fR, enables debug mode for the template.
+Like \-\-export, but use debug template.
.TP
\fB\-\-doctool\fR <path>
Dump the engine API reference to the given <path> in XML format, merging if existing files are found.
@@ -130,6 +139,9 @@ Dump the engine API reference to the given <path> in XML format, merging if exis
\fB\-\-no\-docbase\fR
Disallow dumping the base types (used with \fB\-\-doctool\fR).
.TP
+\fB\-\-build\-solutions\fR
+Build the scripting solutions (e.g. for C# projects).
+.TP
\fB\-\-gdnative\-generate\-json\-api\fR
Generate JSON dump of the Godot API for GDNative bindings.
.TP
diff --git a/misc/dist/linux/godot.appdata.xml b/misc/dist/linux/godot.appdata.xml
index 907fe1f3be..a381556025 100644
--- a/misc/dist/linux/godot.appdata.xml
+++ b/misc/dist/linux/godot.appdata.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright 2017 Rémi Verschelde <akien@godotengine.org> -->
+<!-- Copyright 2017-2018 Rémi Verschelde <akien@godotengine.org> -->
<component type="desktop">
<id>godot.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
diff --git a/misc/dist/linux/godot.desktop b/misc/dist/linux/godot.desktop
index 545c491256..974352b117 100644
--- a/misc/dist/linux/godot.desktop
+++ b/misc/dist/linux/godot.desktop
@@ -2,7 +2,7 @@
Name=Godot Engine
GenericName=Libre game engine
Comment=Multi-platform 2D and 3D game engine with a feature rich editor
-Exec=godot -pm
+Exec=godot -p
Icon=godot
Terminal=false
Type=Application
diff --git a/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png b/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png
index 540bfb1c01..0c27fda8e7 100644
--- a/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png
+++ b/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png
Binary files differ
diff --git a/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png
index 6e307e5eb8..96871f7413 100644
--- a/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png
Binary files differ
diff --git a/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png
index cb2516d7a0..96494b1020 100644
--- a/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png
Binary files differ
diff --git a/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png
index 6e14223e87..d21bc42009 100644
--- a/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png
Binary files differ
diff --git a/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png
index 0d4bd54da8..22a43cf95f 100644
--- a/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png
Binary files differ
diff --git a/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png b/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png
index 1501a09557..3960b0424b 100644
--- a/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png
Binary files differ
diff --git a/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png b/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png
index 593568e980..d836e113b1 100644
--- a/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png
Binary files differ
diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format
index 8ef4e27748..016a43038b 100755
--- a/misc/hooks/pre-commit-clang-format
+++ b/misc/hooks/pre-commit-clang-format
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# git pre-commit hook that runs a clang-format stylecheck.
# Features:
diff --git a/misc/scripts/fix_headers.py b/misc/scripts/fix_headers.py
index 809820c20f..48b9628b1f 100644
--- a/misc/scripts/fix_headers.py
+++ b/misc/scripts/fix_headers.py
@@ -92,9 +92,11 @@ while (fname != ""):
fileread.close()
# Write
- fileread = open(fname.strip(), "wb")
- fileread.write(text)
- fileread.close()
+ filewrite = open(fname.strip(), "wb")
+ filewrite.write(text)
+ filewrite.close()
# Next file
fname = files.readline()
+
+files.close() \ No newline at end of file
diff --git a/misc/scripts/make_glwrapper.py b/misc/scripts/make_glwrapper.py
index 5694d2327e..15b66a950b 100644
--- a/misc/scripts/make_glwrapper.py
+++ b/misc/scripts/make_glwrapper.py
@@ -16,9 +16,7 @@ READ_CONSTANTS = 2
read_what = READ_TYPES
-for x in (range(len(sys.argv) - 1)):
- f = open(sys.argv[x + 1], "r")
-
+def read_file(f):
while(True):
line = f.readline()
@@ -86,6 +84,9 @@ for x in (range(len(sys.argv) - 1)):
functions.append(funcdata)
print(funcdata)
+for path in sys.argv[1:]:
+ with open(path, "r") as f:
+ read_file(f)
# print(types)
# print(constants)
@@ -156,6 +157,7 @@ f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n")
f.write("#ifdef __cplusplus\n}\n#endif\n")
f.write("#endif\n\n")
+f.close()
f = open("glwrapper.c", "w")
@@ -176,3 +178,4 @@ for x in functions:
f.write("\n\n")
f.write("}\n")
f.write("\n\n")
+f.close()
diff --git a/misc/scripts/make_icons.sh b/misc/scripts/make_icons.sh
index 71037cd1c3..5f3ea40d6a 100644
--- a/misc/scripts/make_icons.sh
+++ b/misc/scripts/make_icons.sh
@@ -1,5 +1,24 @@
-convert -resize 32x32 ../../icon.svg icon32.ico
-convert -resize 32x32 ../../icon.svg icon32.icns
-for s in 16 24 32 64 96 128 256; do convert -resize ${s}x$s ../../icon.svg icon$s.png; done
-zip icons.zip icon*.png
-rm icon*.png
+# Generate .ico, .icns and .zip set of icons for Steam
+
+# Make icons with transparent backgrounds and all sizes
+for s in 16 24 32 48 64 128 256 512 1024; do
+ convert -resize ${s}x$s -antialias \
+ -background transparent \
+ ../../icon.svg icon$s.png
+done
+
+# 16px tga file for library
+convert icon16.png icon16.tga
+
+# zip for Linux
+zip godot-icons.zip icon*.png
+
+# ico for Windows
+# Not including biggest ones or it blows up in size
+icotool -c -o godot-icon.ico icon{16,24,32,48,64,128,256}.png
+
+# icns for macOS
+# Only some sizes: http://iconhandbook.co.uk/reference/chart/osx/
+png2icns godot-icon.icns icon{16,32,128,256,512,1024}.png
+
+rm -f icon*.png
diff --git a/misc/travis/scons-local-osx.sh b/misc/travis/scons-local-osx.sh
index d9d7d98b38..fe7b43aadc 100755
--- a/misc/travis/scons-local-osx.sh
+++ b/misc/travis/scons-local-osx.sh
@@ -5,10 +5,10 @@ echo "Download and install Scons local package ..."
echo
echo "Downloading sources ..."
-curl -L -O http://prdownloads.sourceforge.net/scons/scons-local-3.0.0.zip # latest version available here: http://scons.org/pages/download.html
+curl -L -O https://downloads.sourceforge.net/scons/scons-local-3.0.1.zip # latest version available here: http://scons.org/pages/download.html
echo "Extracting to build directory ..."
-unzip -qq -n scons-local-3.0.0.zip -d $TRAVIS_BUILD_DIR/scons-local
+unzip -qq -n scons-local-3.0.1.zip -d $TRAVIS_BUILD_DIR/scons-local
echo "Installing symlinks ..."
ln -s $TRAVIS_BUILD_DIR/scons-local/scons.py /usr/local/bin/scons
diff --git a/modules/bmp/SCsub b/modules/bmp/SCsub
new file mode 100644
index 0000000000..e7da7cf108
--- /dev/null
+++ b/modules/bmp/SCsub
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_bmp = env_modules.Clone()
+
+# Godot's own source files
+env_bmp.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/bmp/config.py b/modules/bmp/config.py
new file mode 100644
index 0000000000..1c8cd12a2d
--- /dev/null
+++ b/modules/bmp/config.py
@@ -0,0 +1,5 @@
+def can_build(env, platform):
+ return True
+
+def configure(env):
+ pass
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp
new file mode 100644
index 0000000000..769119a0dc
--- /dev/null
+++ b/modules/bmp/image_loader_bmp.cpp
@@ -0,0 +1,194 @@
+/*************************************************************************/
+/* image_loader_bmp.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "image_loader_bmp.h"
+
+Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
+ const uint8_t *p_buffer,
+ const uint8_t *p_color_buffer,
+ const bmp_header_s &p_header) {
+
+ Error err = OK;
+
+ if (p_buffer == NULL)
+ err = FAILED;
+
+ if (err == OK) {
+ size_t index = 0;
+ size_t width =
+ static_cast<size_t>(p_header.bmp_info_header.bmp_width < 0 ? -p_header.bmp_info_header.bmp_width : p_header.bmp_info_header.bmp_width);
+ size_t height =
+ static_cast<size_t>(p_header.bmp_info_header.bmp_height < 0 ? -p_header.bmp_info_header.bmp_height : p_header.bmp_info_header.bmp_height);
+ size_t bits_per_pixel =
+ static_cast<size_t>(p_header.bmp_info_header.bmp_bit_count);
+
+ if (p_header.bmp_info_header.bmp_compression != 0) {
+ err = FAILED;
+ }
+
+ if (bits_per_pixel != 24 || bits_per_pixel != 32) {
+ err = FAILED;
+ }
+
+ if (err == OK) {
+
+ uint32_t line_width = ((p_header.bmp_info_header.bmp_width *
+ p_header.bmp_info_header.bmp_bit_count / 8) +
+ 3) &
+ ~3;
+
+ PoolVector<uint8_t> image_data;
+ err = image_data.resize(width * height * 4);
+
+ PoolVector<uint8_t>::Write image_data_w = image_data.write();
+ uint8_t *write_buffer = image_data_w.ptr();
+
+ const uint8_t *line = p_buffer + (line_width * (height - 1));
+ for (unsigned int i = 0; i < height; i++) {
+ const uint8_t *line_ptr = line;
+ for (unsigned int j = 0; j < width; j++) {
+ switch (bits_per_pixel) {
+ case 24: {
+ uint32_t color = *((uint32_t *)line_ptr);
+
+ write_buffer[index + 2] = color & 0xff;
+ write_buffer[index + 1] = (color >> 8) & 0xff;
+ write_buffer[index + 0] = (color >> 16) & 0xff;
+ write_buffer[index + 3] = 0xff;
+ index += 4;
+ line_ptr += 3;
+ } break;
+ case 32: {
+ uint32_t color = *((uint32_t *)line_ptr);
+
+ write_buffer[index + 2] = color & 0xff;
+ write_buffer[index + 1] = (color >> 8) & 0xff;
+ write_buffer[index + 0] = (color >> 16) & 0xff;
+ write_buffer[index + 3] = color >> 24;
+ index += 4;
+ line_ptr += 4;
+ } break;
+ }
+ }
+ line -= line_width;
+ }
+ p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data);
+ }
+ }
+ return err;
+}
+
+Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
+ bool p_force_linear, float p_scale) {
+
+ bmp_header_s bmp_header;
+ Error err = ERR_INVALID_DATA;
+
+ if (f->get_len() > sizeof(bmp_header)) {
+ // File Header
+ bmp_header.bmp_file_header.bmp_signature = f->get_16();
+ if (bmp_header.bmp_file_header.bmp_signature == BITMAP_SIGNATURE) {
+ bmp_header.bmp_file_header.bmp_file_size = f->get_32();
+ bmp_header.bmp_file_header.bmp_file_padding = f->get_32();
+ bmp_header.bmp_file_header.bmp_file_offset = f->get_32();
+
+ // Info Header
+ bmp_header.bmp_info_header.bmp_header_size = f->get_32();
+ bmp_header.bmp_info_header.bmp_width = f->get_32();
+ bmp_header.bmp_info_header.bmp_height = f->get_32();
+ bmp_header.bmp_info_header.bmp_planes = f->get_16();
+ bmp_header.bmp_info_header.bmp_bit_count = f->get_16();
+ bmp_header.bmp_info_header.bmp_compression = f->get_32();
+ bmp_header.bmp_info_header.bmp_size_image = f->get_32();
+ bmp_header.bmp_info_header.bmp_pixels_per_meter_x = f->get_32();
+ bmp_header.bmp_info_header.bmp_pixels_per_meter_y = f->get_32();
+ bmp_header.bmp_info_header.bmp_colors_used = f->get_32();
+ bmp_header.bmp_info_header.bmp_important_colors = f->get_32();
+
+ bmp_header.bmp_info_header.bmp_red_mask = f->get_32();
+ bmp_header.bmp_info_header.bmp_green_mask = f->get_32();
+ bmp_header.bmp_info_header.bmp_blue_mask = f->get_32();
+ bmp_header.bmp_info_header.bmp_alpha_mask = f->get_32();
+ bmp_header.bmp_info_header.bmp_cs_type = f->get_32();
+ for (int i = 0; i < 9; i++)
+ bmp_header.bmp_info_header.bmp_endpoints[i] = f->get_32();
+
+ bmp_header.bmp_info_header.bmp_gamma_red = f->get_32();
+ bmp_header.bmp_info_header.bmp_gamma_green = f->get_32();
+ bmp_header.bmp_info_header.bmp_gamma_blue = f->get_32();
+
+ f->seek(sizeof(bmp_header.bmp_file_header) +
+ bmp_header.bmp_info_header.bmp_header_size);
+
+ uint32_t color_table_size = 0;
+ if (bmp_header.bmp_info_header.bmp_bit_count == 1)
+ color_table_size = 2;
+ else if (bmp_header.bmp_info_header.bmp_bit_count == 4)
+ color_table_size = 16;
+ else if (bmp_header.bmp_info_header.bmp_bit_count == 8)
+ color_table_size = 256;
+
+ PoolVector<uint8_t> bmp_color_table;
+ if (color_table_size > 0) {
+ err = bmp_color_table.resize(color_table_size * 4);
+ PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write();
+ f->get_buffer(bmp_color_table_w.ptr(),
+ bmp_header.bmp_info_header.bmp_colors_used * 4);
+ }
+
+ f->seek(bmp_header.bmp_file_header.bmp_file_offset);
+
+ uint32_t bmp_buffer_size = (bmp_header.bmp_file_header.bmp_file_size -
+ bmp_header.bmp_file_header.bmp_file_offset);
+
+ PoolVector<uint8_t> bmp_buffer;
+ err = bmp_buffer.resize(bmp_buffer_size);
+ if (err == OK) {
+ PoolVector<uint8_t>::Write bmp_buffer_w = bmp_buffer.write();
+ f->get_buffer(bmp_buffer_w.ptr(), bmp_buffer_size);
+
+ PoolVector<uint8_t>::Read bmp_buffer_r = bmp_buffer.read();
+ PoolVector<uint8_t>::Read bmp_color_table_r = bmp_color_table.read();
+ err = convert_to_image(p_image, bmp_buffer_r.ptr(),
+ bmp_color_table_r.ptr(), bmp_header);
+ }
+ f->close();
+ }
+ }
+ return err;
+}
+
+void ImageLoaderBMP::get_recognized_extensions(
+ List<String> *p_extensions) const {
+
+ p_extensions->push_back("bmp");
+}
+
+ImageLoaderBMP::ImageLoaderBMP() {}
diff --git a/modules/bmp/image_loader_bmp.h b/modules/bmp/image_loader_bmp.h
new file mode 100644
index 0000000000..3fa7481287
--- /dev/null
+++ b/modules/bmp/image_loader_bmp.h
@@ -0,0 +1,84 @@
+/*************************************************************************/
+/* image_loader_bmp.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef IMAGE_LOADER_BMP_H
+#define IMAGE_LOADER_BMP_H
+
+#include "io/image_loader.h"
+
+class ImageLoaderBMP : public ImageFormatLoader {
+protected:
+ static const unsigned BITMAP_SIGNATURE = 0x4d42;
+
+ struct bmp_header_s {
+ struct bmp_file_header_s {
+ uint16_t bmp_signature;
+ uint32_t bmp_file_size;
+ uint32_t bmp_file_padding;
+ uint32_t bmp_file_offset;
+ } bmp_file_header;
+
+ struct bmp_info_header_s {
+ uint32_t bmp_header_size;
+ uint32_t bmp_width;
+ uint32_t bmp_height;
+ uint16_t bmp_planes;
+ uint16_t bmp_bit_count;
+ uint32_t bmp_compression;
+ uint32_t bmp_size_image;
+ uint32_t bmp_pixels_per_meter_x;
+ uint32_t bmp_pixels_per_meter_y;
+ uint32_t bmp_colors_used;
+ uint32_t bmp_important_colors;
+ uint32_t bmp_red_mask;
+ uint32_t bmp_green_mask;
+ uint32_t bmp_blue_mask;
+ uint32_t bmp_alpha_mask;
+ uint32_t bmp_cs_type;
+ uint32_t bmp_endpoints[9];
+ uint32_t bmp_gamma_red;
+ uint32_t bmp_gamma_green;
+ uint32_t bmp_gamma_blue;
+ } bmp_info_header;
+ };
+
+ static Error convert_to_image(Ref<Image> p_image,
+ const uint8_t *p_buffer,
+ const uint8_t *p_color_buffer,
+ const bmp_header_s &p_header);
+
+public:
+ virtual Error load_image(Ref<Image> p_image, FileAccess *f,
+ bool p_force_linear, float p_scale);
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ ImageLoaderBMP();
+};
+
+#endif // IMAGE_LOADER_BMP_H
diff --git a/modules/bmp/register_types.cpp b/modules/bmp/register_types.cpp
new file mode 100644
index 0000000000..1f68a03e85
--- /dev/null
+++ b/modules/bmp/register_types.cpp
@@ -0,0 +1,44 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "register_types.h"
+
+#include "image_loader_bmp.h"
+
+static ImageLoaderBMP *image_loader_bmp = NULL;
+
+void register_bmp_types() {
+ image_loader_bmp = memnew(ImageLoaderBMP);
+ ImageLoader::add_image_format_loader(image_loader_bmp);
+}
+
+void unregister_bmp_types() {
+ memdelete(image_loader_bmp);
+}
diff --git a/modules/bmp/register_types.h b/modules/bmp/register_types.h
new file mode 100644
index 0000000000..d8755db397
--- /dev/null
+++ b/modules/bmp/register_types.h
@@ -0,0 +1,32 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+void register_bmp_types();
+void unregister_bmp_types();
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index 648919e612..bfb452d109 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -68,7 +68,9 @@ AreaBullet::AreaBullet() :
}
AreaBullet::~AreaBullet() {
- remove_all_overlapping_instantly();
+ // signal are handled by godot, so just clear without notify
+ for (int i = overlappingObjects.size() - 1; 0 <= i; --i)
+ overlappingObjects[i].object->on_exit_area(this);
}
void AreaBullet::dispatch_callbacks() {
@@ -121,23 +123,21 @@ void AreaBullet::scratch() {
isScratched = true;
}
-void AreaBullet::remove_all_overlapping_instantly() {
- CollisionObjectBullet *supportObject;
+void AreaBullet::clear_overlaps(bool p_notify) {
for (int i = overlappingObjects.size() - 1; 0 <= i; --i) {
- supportObject = overlappingObjects[i].object;
- call_event(supportObject, PhysicsServer::AREA_BODY_REMOVED);
- supportObject->on_exit_area(this);
+ if (p_notify)
+ call_event(overlappingObjects[i].object, PhysicsServer::AREA_BODY_REMOVED);
+ overlappingObjects[i].object->on_exit_area(this);
}
overlappingObjects.clear();
}
-void AreaBullet::remove_overlapping_instantly(CollisionObjectBullet *p_object) {
- CollisionObjectBullet *supportObject;
+void AreaBullet::remove_overlap(CollisionObjectBullet *p_object, bool p_notify) {
for (int i = overlappingObjects.size() - 1; 0 <= i; --i) {
- supportObject = overlappingObjects[i].object;
- if (supportObject == p_object) {
- call_event(supportObject, PhysicsServer::AREA_BODY_REMOVED);
- supportObject->on_exit_area(this);
+ if (overlappingObjects[i].object == p_object) {
+ if (p_notify)
+ call_event(overlappingObjects[i].object, PhysicsServer::AREA_BODY_REMOVED);
+ overlappingObjects[i].object->on_exit_area(this);
overlappingObjects.remove(i);
break;
}
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index 78136d574b..b2046c684e 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -150,9 +150,9 @@ public:
void set_on_state_change(ObjectID p_id, const StringName &p_method, const Variant &p_udata = Variant());
void scratch();
- void remove_all_overlapping_instantly();
+ void clear_overlaps(bool p_notify);
// Dispatch the callbacks and removes from overlapping list
- void remove_overlapping_instantly(CollisionObjectBullet *p_object);
+ void remove_overlap(CollisionObjectBullet *p_object, bool p_notify);
virtual void on_collision_filters_change();
virtual void on_collision_checker_start() {}
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 61ce26e9fd..6246a295ec 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -89,7 +89,9 @@ BulletPhysicsServer::BulletPhysicsServer() :
active(true),
active_spaces_count(0) {}
-BulletPhysicsServer::~BulletPhysicsServer() {}
+BulletPhysicsServer::~BulletPhysicsServer() {
+ bulletdelete(emptyShape);
+}
RID BulletPhysicsServer::shape_create(ShapeType p_shape) {
ShapeBullet *shape = NULL;
@@ -619,11 +621,11 @@ uint32_t BulletPhysicsServer::body_get_collision_mask(RID p_body) const {
}
void BulletPhysicsServer::body_set_user_flags(RID p_body, uint32_t p_flags) {
- WARN_PRINT("This function si not currently supported by bullet and Godot");
+ // This function si not currently supported
}
uint32_t BulletPhysicsServer::body_get_user_flags(RID p_body) const {
- WARN_PRINT("This function si not currently supported by bullet and Godot");
+ // This function si not currently supported
return 0;
}
@@ -784,21 +786,26 @@ int BulletPhysicsServer::body_get_max_contacts_reported(RID p_body) const {
}
void BulletPhysicsServer::body_set_contacts_reported_depth_threshold(RID p_body, float p_threshold) {
- WARN_PRINT("Not supported by bullet and even Godot");
+ // Not supported by bullet and even Godot
}
float BulletPhysicsServer::body_get_contacts_reported_depth_threshold(RID p_body) const {
- WARN_PRINT("Not supported by bullet and even Godot");
+ // Not supported by bullet and even Godot
return 0.;
}
void BulletPhysicsServer::body_set_omit_force_integration(RID p_body, bool p_omit) {
- WARN_PRINT("Not supported by bullet");
+ RigidBodyBullet *body = rigid_body_owner.get(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_omit_forces_integration(p_omit);
}
bool BulletPhysicsServer::body_is_omitting_force_integration(RID p_body) const {
- WARN_PRINT("Not supported by bullet");
- return false;
+ RigidBodyBullet *body = rigid_body_owner.get(p_body);
+ ERR_FAIL_COND_V(!body, false);
+
+ return body->get_omit_forces_integration();
}
void BulletPhysicsServer::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
@@ -979,11 +986,11 @@ PhysicsServer::JointType BulletPhysicsServer::joint_get_type(RID p_joint) const
}
void BulletPhysicsServer::joint_set_solver_priority(RID p_joint, int p_priority) {
- //WARN_PRINTS("Joint priority not supported by bullet");
+ // Joint priority not supported by bullet
}
int BulletPhysicsServer::joint_get_solver_priority(RID p_joint) const {
- //WARN_PRINTS("Joint priority not supported by bullet");
+ // Joint priority not supported by bullet
return 0;
}
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp
index 34aff68a4a..57e4db708e 100644
--- a/modules/bullet/collision_object_bullet.cpp
+++ b/modules/bullet/collision_object_bullet.cpp
@@ -49,7 +49,7 @@
CollisionObjectBullet::ShapeWrapper::~ShapeWrapper() {}
void CollisionObjectBullet::ShapeWrapper::set_transform(const Transform &p_transform) {
- G_TO_B(p_transform.get_basis().get_scale(), scale);
+ G_TO_B(p_transform.get_basis().get_scale_abs(), scale);
G_TO_B(p_transform, transform);
UNSCALE_BT_BASIS(transform);
}
@@ -68,12 +68,10 @@ CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
force_shape_reset(false) {}
CollisionObjectBullet::~CollisionObjectBullet() {
- // Remove all overlapping
+ // Remove all overlapping, notify is not required since godot take care of it
for (int i = areasOverlapped.size() - 1; 0 <= i; --i) {
- areasOverlapped[i]->remove_overlapping_instantly(this);
+ areasOverlapped[i]->remove_overlap(this, /*Notify*/ false);
}
- // not required
- // areasOverlapped.clear();
destroyBulletCollisionObject();
}
@@ -160,7 +158,7 @@ int CollisionObjectBullet::get_godot_object_flags() const {
void CollisionObjectBullet::set_transform(const Transform &p_global_transform) {
- set_body_scale(p_global_transform.basis.get_scale());
+ set_body_scale(p_global_transform.basis.get_scale_abs());
btTransform bt_transform;
G_TO_B(p_global_transform, bt_transform);
diff --git a/modules/bullet/config.py b/modules/bullet/config.py
index 0a31c2e503..92dbcf5cb0 100644
--- a/modules/bullet/config.py
+++ b/modules/bullet/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
index 8c8647e097..a4dc61d0bc 100644
--- a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
+++ b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.1-dev">
+<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/bullet/doc_classes/BulletPhysicsServer.xml b/modules/bullet/doc_classes/BulletPhysicsServer.xml
index 8ed84e1dec..1486936cf4 100644
--- a/modules/bullet/doc_classes/BulletPhysicsServer.xml
+++ b/modules/bullet/doc_classes/BulletPhysicsServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.1-dev">
+<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index 151a79a69f..adfad7803f 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -138,6 +138,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value;
break;
+ case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
+ sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value;
+ break;
+ case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
+ sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis] = p_value;
+ break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
limits_lower[1][p_axis] = p_value;
set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
@@ -185,6 +191,10 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
return sixDOFConstraint->getTranslationalLimitMotor()->m_restitution;
case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
return sixDOFConstraint->getTranslationalLimitMotor()->m_damping;
+ case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
+ return sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis];
+ case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
+ return sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
return limits_lower[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
@@ -232,6 +242,9 @@ void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOF
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag];
break;
+ case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR:
+ sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = flags[p_axis][p_flag];
+ break;
default:
WARN_PRINT("This flag is not supported by Bullet engine");
return;
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp
index 7c051f8f17..197550d686 100644
--- a/modules/bullet/godot_result_callbacks.cpp
+++ b/modules/bullet/godot_result_callbacks.cpp
@@ -63,6 +63,9 @@ bool GodotClosestRayResultCallback::needsCollision(btBroadphaseProxy *proxy0) co
}
bool GodotAllConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {
+ if (count >= m_resultMax)
+ return false;
+
const bool needs = GodotFilterCallback::test_collision_filters(m_collisionFilterGroup, m_collisionFilterMask, proxy0->m_collisionFilterGroup, proxy0->m_collisionFilterMask);
if (needs) {
btCollisionObject *btObj = static_cast<btCollisionObject *>(proxy0->m_clientObject);
@@ -70,6 +73,7 @@ bool GodotAllConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0) con
if (m_exclude->has(gObj->get_self())) {
return false;
}
+
return true;
} else {
return false;
@@ -87,7 +91,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id);
++count;
- return count < m_resultMax;
+ return 1; // not used by bullet
}
bool GodotKinClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {
@@ -106,7 +110,7 @@ bool GodotKinClosestConvexResultCallback::needsCollision(btBroadphaseProxy *prox
if (gObj->getType() == CollisionObjectBullet::TYPE_AREA)
return false;
- if (m_self_object->has_collision_exception(gObj))
+ if (m_self_object->has_collision_exception(gObj) || gObj->has_collision_exception(m_self_object))
return false;
}
return true;
@@ -168,10 +172,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
result.shape = cp.m_index0;
}
- if (colObj)
- result.collider_id = colObj->get_instance_id();
- else
- result.collider_id = 0;
+ result.collider_id = colObj->get_instance_id();
result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id);
result.rid = colObj->get_self();
++m_count;
@@ -181,6 +182,9 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
}
bool GodotContactPairContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {
+ if (m_count >= m_resultMax)
+ return false;
+
const bool needs = GodotFilterCallback::test_collision_filters(m_collisionFilterGroup, m_collisionFilterMask, proxy0->m_collisionFilterGroup, proxy0->m_collisionFilterMask);
if (needs) {
btCollisionObject *btObj = static_cast<btCollisionObject *>(proxy0->m_clientObject);
@@ -206,7 +210,7 @@ btScalar GodotContactPairContactResultCallback::addSingleResult(btManifoldPoint
++m_count;
- return m_count < m_resultMax;
+ return 1; // Not used by bullet
}
bool GodotRestInfoContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {
@@ -243,32 +247,23 @@ btScalar GodotRestInfoContactResultCallback::addSingleResult(btManifoldPoint &cp
m_rest_info_collision_object = colObj0Wrap->getCollisionObject();
}
- if (colObj)
- m_result->collider_id = colObj->get_instance_id();
- else
- m_result->collider_id = 0;
+ m_result->collider_id = colObj->get_instance_id();
m_result->rid = colObj->get_self();
m_collided = true;
}
- return cp.getDistance();
+ return 1; // Not used by bullet
}
void GodotDeepPenetrationContactResultCallback::addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorldOnB, btScalar depth) {
- if (depth < 0) {
- // Has penetration
- if (m_most_penetrated_distance > depth) {
+ if (m_penetration_distance > depth) { // Has penetration?
- bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
-
- m_most_penetrated_distance = depth;
- m_pointCollisionObject = (isSwapped ? m_body0Wrap : m_body1Wrap)->getCollisionObject();
- m_other_compound_shape_index = isSwapped ? m_index1 : m_index0;
- m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld;
- m_pointWorld = isSwapped ? (pointInWorldOnB + normalOnBInWorld * depth) : pointInWorldOnB;
- m_penetration_distance = depth;
- }
+ bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
+ m_penetration_distance = depth;
+ m_other_compound_shape_index = isSwapped ? m_index0 : m_index1;
+ m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld;
+ m_pointWorld = isSwapped ? (pointInWorldOnB + (normalOnBInWorld * depth)) : pointInWorldOnB;
}
}
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index ed6d4b7d6d..363051f24c 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -185,24 +185,18 @@ struct GodotDeepPenetrationContactResultCallback : public btManifoldResult {
btVector3 m_pointWorld;
btScalar m_penetration_distance;
int m_other_compound_shape_index;
- const btCollisionObject *m_pointCollisionObject;
-
- btScalar m_most_penetrated_distance;
GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap) :
btManifoldResult(body0Wrap, body1Wrap),
- m_pointCollisionObject(NULL),
m_penetration_distance(0),
- m_other_compound_shape_index(0),
- m_most_penetrated_distance(1e20) {}
+ m_other_compound_shape_index(0) {}
void reset() {
- m_pointCollisionObject = NULL;
- m_most_penetrated_distance = 1e20;
+ m_penetration_distance = 0;
}
bool hasHit() {
- return m_pointCollisionObject;
+ return m_penetration_distance < 0;
}
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorldOnB, btScalar depth);
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 75b4cc054a..2494063c22 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -255,6 +255,7 @@ RigidBodyBullet::RigidBodyBullet() :
linearDamp(0),
angularDamp(0),
can_sleep(true),
+ omit_forces_integration(false),
force_integration_callback(NULL),
isTransformChanged(false),
previousActiveState(true),
@@ -334,6 +335,9 @@ void RigidBodyBullet::dispatch_callbacks() {
/// The check isTransformChanged is necessary in order to call integrated forces only when the first transform is sent
if ((btBody->isActive() || previousActiveState != btBody->isActive()) && force_integration_callback && isTransformChanged) {
+ if (omit_forces_integration)
+ btBody->clearForces();
+
BulletPhysicsDirectBodyState *bodyDirect = BulletPhysicsDirectBodyState::get_singleton(this);
Variant variantBodyDirect = bodyDirect;
@@ -437,6 +441,10 @@ bool RigidBodyBullet::is_active() const {
return btBody->isActive();
}
+void RigidBodyBullet::set_omit_forces_integration(bool p_omit) {
+ omit_forces_integration = p_omit;
+}
+
void RigidBodyBullet::set_param(PhysicsServer::BodyParameter p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer::BODY_PARAM_BOUNCE:
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index 2d529f6dc7..b9511243c7 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -198,6 +198,7 @@ private:
real_t linearDamp;
real_t angularDamp;
bool can_sleep;
+ bool omit_forces_integration;
Vector<CollisionData> collisions;
// these parameters are used to avoid vector resize
@@ -254,6 +255,9 @@ public:
void set_activation_state(bool p_active);
bool is_active() const;
+ void set_omit_forces_integration(bool p_omit);
+ _FORCE_INLINE_ bool get_omit_forces_integration() const { return omit_forces_integration; }
+
void set_param(PhysicsServer::BodyParameter p_param, real_t);
real_t get_param(PhysicsServer::BodyParameter p_param) const;
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index 5d8d391bd9..76d9614465 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -125,14 +125,13 @@ btScaledBvhTriangleMeshShape *ShapeBullet::create_shape_concave(btBvhTriangleMes
}
}
-btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_cell_size) {
+btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) {
const btScalar ignoredHeightScale(1);
- const btScalar fieldHeight(500); // Meters
const int YAxis = 1; // 0=X, 1=Y, 2=Z
const bool flipQuadEdges = false;
const void *heightsPtr = p_heights.read().ptr();
- return bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, -fieldHeight, fieldHeight, YAxis, PHY_FLOAT, flipQuadEdges));
+ return bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges));
}
btRayShape *ShapeBullet::create_shape_ray(real_t p_length, bool p_slips_on_slope) {
@@ -337,10 +336,10 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) {
int src_face_count = faces.size();
if (0 < src_face_count) {
- btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh);
-
// It counts the faces and assert the array contains the correct number of vertices.
ERR_FAIL_COND(src_face_count % 3);
+
+ btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh);
src_face_count /= 3;
PoolVector<Vector3>::Read r = p_faces.read();
const Vector3 *facesr = r.ptr();
@@ -387,19 +386,44 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) {
Dictionary d = p_data;
ERR_FAIL_COND(!d.has("width"));
ERR_FAIL_COND(!d.has("depth"));
- ERR_FAIL_COND(!d.has("cell_size"));
ERR_FAIL_COND(!d.has("heights"));
+ real_t l_min_height = 0.0;
+ real_t l_max_height = 0.0;
+
+ // If specified, min and max height will be used as precomputed values
+ if (d.has("min_height"))
+ l_min_height = d["min_height"];
+ if (d.has("max_height"))
+ l_max_height = d["max_height"];
+
+ ERR_FAIL_COND(l_min_height > l_max_height);
+
int l_width = d["width"];
int l_depth = d["depth"];
- real_t l_cell_size = d["cell_size"];
PoolVector<real_t> l_heights = d["heights"];
ERR_FAIL_COND(l_width <= 0);
ERR_FAIL_COND(l_depth <= 0);
- ERR_FAIL_COND(l_cell_size <= CMP_EPSILON);
- ERR_FAIL_COND(l_heights.size() != (width * depth));
- setup(heights, width, depth, cell_size);
+ ERR_FAIL_COND(l_heights.size() != (l_width * l_depth));
+
+ // Compute min and max heights if not specified.
+ if (!d.has("min_height") && !d.has("max_height")) {
+
+ PoolVector<real_t>::Read r = heights.read();
+ int heights_size = heights.size();
+
+ for (int i = 0; i < heights_size; ++i) {
+ real_t h = r[i];
+
+ if (h < l_min_height)
+ l_min_height = h;
+ else if (h > l_max_height)
+ l_max_height = h;
+ }
+ }
+
+ setup(l_heights, l_width, l_depth, l_min_height, l_max_height);
}
Variant HeightMapShapeBullet::get_data() const {
@@ -410,8 +434,14 @@ PhysicsServer::ShapeType HeightMapShapeBullet::get_type() const {
return PhysicsServer::SHAPE_HEIGHTMAP;
}
-void HeightMapShapeBullet::setup(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_cell_size) {
+void HeightMapShapeBullet::setup(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) {
+ // TODO cell size must be tweaked using localScaling, which is a shared property for all Bullet shapes
+
{ // Copy
+
+ // TODO If Godot supported 16-bit integer image format, we could share the same memory block for heightfields
+ // without having to copy anything, optimizing memory and loading performance (Bullet only reads and doesn't take ownership of the data).
+
const int heights_size = p_heights.size();
heights.resize(heights_size);
PoolVector<real_t>::Read p_heights_r = p_heights.read();
@@ -420,14 +450,16 @@ void HeightMapShapeBullet::setup(PoolVector<real_t> &p_heights, int p_width, int
heights_w[i] = p_heights_r[i];
}
}
+
width = p_width;
depth = p_depth;
- cell_size = p_cell_size;
+ min_height = p_min_height;
+ max_height = p_max_height;
notifyShapeChanged();
}
btCollisionShape *HeightMapShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_margin) {
- btCollisionShape *cs(ShapeBullet::create_shape_height_field(heights, width, depth, cell_size));
+ btCollisionShape *cs(ShapeBullet::create_shape_height_field(heights, width, depth, min_height, max_height));
cs->setLocalScaling(p_implicit_scale);
prepare(cs);
cs->setMargin(p_margin);
diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h
index 2acba90e36..abeea0f9ce 100644
--- a/modules/bullet/shape_bullet.h
+++ b/modules/bullet/shape_bullet.h
@@ -85,7 +85,7 @@ public:
/// IMPORTANT: Remember to delete the shape interface by calling: delete my_shape->getMeshInterface();
static class btConvexPointCloudShape *create_shape_convex(btAlignedObjectArray<btVector3> &p_vertices, const btVector3 &p_local_scaling = btVector3(1, 1, 1));
static class btScaledBvhTriangleMeshShape *create_shape_concave(btBvhTriangleMeshShape *p_mesh_shape, const btVector3 &p_local_scaling = btVector3(1, 1, 1));
- static class btHeightfieldTerrainShape *create_shape_height_field(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_cell_size);
+ static class btHeightfieldTerrainShape *create_shape_height_field(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height);
static class btRayShape *create_shape_ray(real_t p_length, bool p_slips_on_slope);
};
@@ -199,7 +199,8 @@ public:
PoolVector<real_t> heights;
int width;
int depth;
- real_t cell_size;
+ real_t min_height;
+ real_t max_height;
HeightMapShapeBullet();
@@ -209,7 +210,7 @@ public:
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_margin = 0);
private:
- void setup(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_cell_size);
+ void setup(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height);
};
class RayShapeBullet : public ShapeBullet {
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index e20a79f667..971fd39509 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -122,7 +122,7 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btCollisionShape *btShape = shape->create_bt_shape(p_xform.basis.get_scale(), p_margin);
+ btCollisionShape *btShape = shape->create_bt_shape(p_xform.basis.get_scale_abs(), p_margin);
if (!btShape->isConvex()) {
bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
@@ -202,7 +202,7 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btCollisionShape *btShape = shape->create_bt_shape(p_shape_xform.basis.get_scale(), p_margin);
+ btCollisionShape *btShape = shape->create_bt_shape(p_shape_xform.basis.get_scale_abs(), p_margin);
if (!btShape->isConvex()) {
bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
@@ -234,7 +234,7 @@ bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_sh
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btCollisionShape *btShape = shape->create_bt_shape(p_shape_xform.basis.get_scale(), p_margin);
+ btCollisionShape *btShape = shape->create_bt_shape(p_shape_xform.basis.get_scale_abs(), p_margin);
if (!btShape->isConvex()) {
bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
@@ -660,7 +660,10 @@ void SpaceBullet::check_ghost_overlaps() {
// For each overlapping
for (i = ghostOverlaps.size() - 1; 0 <= i; --i) {
- if (!(ghostOverlaps[i]->getUserIndex() == CollisionObjectBullet::TYPE_RIGID_BODY || ghostOverlaps[i]->getUserIndex() == CollisionObjectBullet::TYPE_AREA))
+ if (ghostOverlaps[i]->getUserIndex() == CollisionObjectBullet::TYPE_AREA) {
+ if (!static_cast<AreaBullet *>(ghostOverlaps[i]->getUserPointer())->is_monitorable())
+ continue;
+ } else if (ghostOverlaps[i]->getUserIndex() != CollisionObjectBullet::TYPE_RIGID_BODY)
continue;
otherObject = static_cast<RigidCollisionObjectBullet *>(ghostOverlaps[i]->getUserPointer());
@@ -790,7 +793,7 @@ void SpaceBullet::update_gravity() {
/// I'm leaving this here just for future tests.
/// Debug motion and normal vector drawing
#define debug_test_motion 0
-#define PERFORM_INITIAL_UNSTACK 0
+
#define RECOVERING_MOVEMENT_SCALE 0.4
#define RECOVERING_MOVEMENT_CYCLES 4
@@ -838,23 +841,20 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
}
#endif
- btTransform body_safe_position;
- G_TO_B(p_from, body_safe_position);
- UNSCALE_BT_BASIS(body_safe_position);
+ btTransform body_transform;
+ G_TO_B(p_from, body_transform);
+ UNSCALE_BT_BASIS(body_transform);
-#if PERFORM_INITIAL_UNSTACK
- btVector3 recover_initial_position(0, 0, 0);
+ btVector3 initial_recover_motion(0, 0, 0);
{ /// Phase one - multi shapes depenetration using margin
for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) {
- if (!recover_from_penetration(p_body, body_safe_position, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, recover_initial_position)) {
+ if (!recover_from_penetration(p_body, body_transform, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, initial_recover_motion)) {
break;
}
}
-
// Add recover movement in order to make it safe
- body_safe_position.getOrigin() += recover_initial_position;
+ body_transform.getOrigin() += initial_recover_motion;
}
-#endif
btVector3 motion;
G_TO_B(p_motion, motion);
@@ -884,7 +884,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
}
btConvexShape *convex_shape_test(static_cast<btConvexShape *>(p_body->get_bt_shape(shIndex)));
- btTransform shape_world_from = body_safe_position * p_body->get_kinematic_utilities()->shapes[shIndex].transform;
+ btTransform shape_world_from = body_transform * p_body->get_kinematic_utilities()->shapes[shIndex].transform;
btTransform shape_world_to(shape_world_from);
shape_world_to.getOrigin() += motion;
@@ -893,7 +893,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
btResult.m_collisionFilterGroup = p_body->get_collision_layer();
btResult.m_collisionFilterMask = p_body->get_collision_mask();
- dynamicsWorld->convexSweepTest(convex_shape_test, shape_world_from, shape_world_to, btResult, 0.002);
+ dynamicsWorld->convexSweepTest(convex_shape_test, shape_world_from, shape_world_to, btResult, dynamicsWorld->getDispatchInfo().m_allowedCcdPenetration);
if (btResult.hasHit()) {
/// Since for each sweep test I fix the motion of new shapes in base the recover result,
@@ -902,65 +902,49 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
}
}
- body_safe_position.getOrigin() += motion;
+ body_transform.getOrigin() += motion;
}
bool has_penetration = false;
- { /// Phase three - Recover + contact test with margin
+ { /// Phase three - contact test with margin
- btVector3 delta_recover_movement(0, 0, 0);
+ btVector3 __rec(0, 0, 0);
RecoverResult r_recover_result;
- bool l_has_penetration;
- real_t l_penetration_distance = 1e20;
- for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) {
- l_has_penetration = recover_from_penetration(p_body, body_safe_position, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, delta_recover_movement, &r_recover_result);
+ has_penetration = recover_from_penetration(p_body, body_transform, 0, p_infinite_inertia, __rec, &r_recover_result);
- if (r_result) {
-#if PERFORM_INITIAL_UNSTACK
- B_TO_G(motion + delta_recover_movement + recover_initial_position, r_result->motion);
-#else
- B_TO_G(motion + delta_recover_movement, r_result->motion);
-#endif
- if (l_has_penetration) {
- has_penetration = true;
- if (l_penetration_distance <= r_recover_result.penetration_distance) {
- continue;
- }
+ // Parse results
+ if (r_result) {
+ B_TO_G(motion + initial_recover_motion, r_result->motion);
- l_penetration_distance = r_recover_result.penetration_distance;
+ if (has_penetration) {
- const btRigidBody *btRigid = static_cast<const btRigidBody *>(r_recover_result.other_collision_object);
- CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(btRigid->getUserPointer());
+ const btRigidBody *btRigid = static_cast<const btRigidBody *>(r_recover_result.other_collision_object);
+ CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(btRigid->getUserPointer());
- B_TO_G(motion, r_result->remainder); // is the remaining movements
- r_result->remainder = p_motion - r_result->remainder;
- B_TO_G(r_recover_result.pointWorld, r_result->collision_point);
- B_TO_G(r_recover_result.normal, r_result->collision_normal);
- B_TO_G(btRigid->getVelocityInLocalPoint(r_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot
- r_result->collider = collisionObject->get_self();
- r_result->collider_id = collisionObject->get_instance_id();
- r_result->collider_shape = r_recover_result.other_compound_shape_index;
- r_result->collision_local_shape = r_recover_result.local_shape_most_recovered;
+ B_TO_G(motion, r_result->remainder); // is the remaining movements
+ r_result->remainder = p_motion - r_result->remainder;
+
+ B_TO_G(r_recover_result.pointWorld, r_result->collision_point);
+ B_TO_G(r_recover_result.normal, r_result->collision_normal);
+ B_TO_G(btRigid->getVelocityInLocalPoint(r_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot
+ r_result->collider = collisionObject->get_self();
+ r_result->collider_id = collisionObject->get_instance_id();
+ r_result->collider_shape = r_recover_result.other_compound_shape_index;
+ r_result->collision_local_shape = r_recover_result.local_shape_most_recovered;
#if debug_test_motion
- Vector3 sup_line2;
- B_TO_G(motion, sup_line2);
- normalLine->clear();
- normalLine->begin(Mesh::PRIMITIVE_LINES, NULL);
- normalLine->add_vertex(r_result->collision_point);
- normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10);
- normalLine->end();
+ Vector3 sup_line2;
+ B_TO_G(motion, sup_line2);
+ normalLine->clear();
+ normalLine->begin(Mesh::PRIMITIVE_LINES, NULL);
+ normalLine->add_vertex(r_result->collision_point);
+ normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10);
+ normalLine->end();
#endif
- } else {
- r_result->remainder = Vector3();
- }
} else {
- if (!l_has_penetration)
- break;
- else
- has_penetration = true;
+ r_result->remainder = Vector3();
}
}
}
@@ -998,7 +982,7 @@ public:
}
void reset() {
- result_collision_objects.empty();
+ result_collision_objects.clear();
}
};
@@ -1033,7 +1017,10 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
for (int i = recover_broad_result.result_collision_objects.size() - 1; 0 <= i; --i) {
btCollisionObject *otherObject = recover_broad_result.result_collision_objects[i];
- if (!p_body->get_bt_collision_object()->checkCollideWith(otherObject) || !otherObject->checkCollideWith(p_body->get_bt_collision_object()) || (p_infinite_inertia && !otherObject->isStaticOrKinematicObject()))
+ if (p_infinite_inertia && !otherObject->isStaticOrKinematicObject()) {
+ otherObject->activate(); // Force activation of hitten rigid, soft body
+ continue;
+ } else if (!p_body->get_bt_collision_object()->checkCollideWith(otherObject) || !otherObject->checkCollideWith(p_body->get_bt_collision_object()))
continue;
if (otherObject->getCollisionShape()->isCompound()) {
@@ -1112,7 +1099,7 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC
btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, tA, -1, p_shapeId_A);
btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
- btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CLOSEST_POINT_ALGORITHMS);
+ btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
if (algorithm) {
GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
//discrete collision detection query
diff --git a/modules/csg/SCsub b/modules/csg/SCsub
new file mode 100644
index 0000000000..57c504efd8
--- /dev/null
+++ b/modules/csg/SCsub
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_csg = env_modules.Clone()
+
+# Godot's own source files
+env_csg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/csg/config.py b/modules/csg/config.py
new file mode 100644
index 0000000000..38ccc66d91
--- /dev/null
+++ b/modules/csg/config.py
@@ -0,0 +1,21 @@
+def can_build(env, platform):
+ return True
+
+def configure(env):
+ pass
+
+def get_doc_classes():
+ return [
+ "CSGBox",
+ "CSGCombiner",
+ "CSGCylinder",
+ "CSGMesh",
+ "CSGPolygon",
+ "CSGPrimitive",
+ "CSGShape",
+ "CSGSphere",
+ "CSGTorus",
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp
new file mode 100644
index 0000000000..4e6e701bfd
--- /dev/null
+++ b/modules/csg/csg.cpp
@@ -0,0 +1,1518 @@
+/*************************************************************************/
+/* csg.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "csg.h"
+#include "face3.h"
+#include "geometry.h"
+#include "os/os.h"
+#include "sort.h"
+#include "thirdparty/misc/triangulator.h"
+
+void CSGBrush::clear() {
+ faces.clear();
+}
+
+void CSGBrush::build_from_faces(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uvs, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials, const PoolVector<bool> &p_invert_faces) {
+
+ clear();
+
+ int vc = p_vertices.size();
+
+ ERR_FAIL_COND((vc % 3) != 0)
+
+ PoolVector<Vector3>::Read rv = p_vertices.read();
+ int uvc = p_uvs.size();
+ PoolVector<Vector2>::Read ruv = p_uvs.read();
+ int sc = p_smooth.size();
+ PoolVector<bool>::Read rs = p_smooth.read();
+ int mc = p_materials.size();
+ PoolVector<Ref<Material> >::Read rm = p_materials.read();
+ int ic = p_invert_faces.size();
+ PoolVector<bool>::Read ri = p_invert_faces.read();
+
+ Map<Ref<Material>, int> material_map;
+
+ faces.resize(p_vertices.size() / 3);
+
+ for (int i = 0; i < faces.size(); i++) {
+ Face &f = faces[i];
+ f.vertices[0] = rv[i * 3 + 0];
+ f.vertices[1] = rv[i * 3 + 1];
+ f.vertices[2] = rv[i * 3 + 2];
+ if (uvc == vc) {
+ f.uvs[0] = ruv[i * 3 + 0];
+ f.uvs[1] = ruv[i * 3 + 1];
+ f.uvs[2] = ruv[i * 3 + 2];
+ }
+ if (sc == vc / 3) {
+ f.smooth = rs[i];
+ } else {
+ f.smooth = false;
+ }
+
+ if (ic == vc / 3) {
+ f.invert = ri[i];
+ } else {
+ f.invert = false;
+ }
+
+ if (mc == vc / 3) {
+ Ref<Material> mat = rm[i];
+ if (mat.is_valid()) {
+ const Map<Ref<Material>, int>::Element *E = material_map.find(mat);
+ if (E) {
+ f.material = E->get();
+ } else {
+ f.material = material_map.size();
+ material_map[mat] = f.material;
+ }
+ } else {
+ f.material = -1;
+ }
+ }
+ }
+
+ materials.resize(material_map.size());
+ for (Map<Ref<Material>, int>::Element *E = material_map.front(); E; E = E->next()) {
+ materials[E->get()] = E->key();
+ }
+
+ _regen_face_aabbs();
+}
+
+void CSGBrush::_regen_face_aabbs() {
+
+ for (int i = 0; i < faces.size(); i++) {
+
+ faces[i].aabb.position = faces[i].vertices[0];
+ faces[i].aabb.expand_to(faces[i].vertices[1]);
+ faces[i].aabb.expand_to(faces[i].vertices[2]);
+ faces[i].aabb.grow_by(faces[i].aabb.get_longest_axis_size() * 0.001); //make it a tad bigger to avoid num precision erros
+ }
+}
+
+void CSGBrush::copy_from(const CSGBrush &p_brush, const Transform &p_xform) {
+
+ faces = p_brush.faces;
+ materials = p_brush.materials;
+
+ for (int i = 0; i < faces.size(); i++) {
+ for (int j = 0; j < 3; j++) {
+ faces[i].vertices[j] = p_xform.xform(p_brush.faces[i].vertices[j]);
+ }
+ }
+
+ _regen_face_aabbs();
+}
+
+////////////////////////
+
+void CSGBrushOperation::BuildPoly::create(const CSGBrush *p_brush, int p_face, MeshMerge &mesh_merge, bool p_for_B) {
+
+ //creates the initial face that will be used for clipping against the other faces
+
+ Vector3 va[3] = {
+ p_brush->faces[p_face].vertices[0],
+ p_brush->faces[p_face].vertices[1],
+ p_brush->faces[p_face].vertices[2],
+ };
+
+ plane = Plane(va[0], va[1], va[2]);
+
+ to_world.origin = va[0];
+
+ to_world.basis.set_axis(2, plane.normal);
+ to_world.basis.set_axis(0, (va[1] - va[2]).normalized());
+ to_world.basis.set_axis(1, to_world.basis.get_axis(0).cross(to_world.basis.get_axis(2)).normalized());
+
+ to_poly = to_world.affine_inverse();
+
+ face_index = p_face;
+
+ for (int i = 0; i < 3; i++) {
+
+ Point p;
+ Vector3 localp = to_poly.xform(va[i]);
+ p.point.x = localp.x;
+ p.point.y = localp.y;
+ p.uv = p_brush->faces[p_face].uvs[i];
+
+ points.push_back(p);
+
+ ///edge
+
+ Edge e;
+ e.points[0] = i;
+ e.points[1] = (i + 1) % 3;
+ e.outer = true;
+ edges.push_back(e);
+ }
+
+ smooth = p_brush->faces[p_face].smooth;
+ invert = p_brush->faces[p_face].invert;
+
+ if (p_brush->faces[p_face].material != -1) {
+ material = p_brush->materials[p_brush->faces[p_face].material];
+ }
+
+ base_edges = 3;
+}
+
+static Vector2 interpolate_uv(const Vector2 &p_vertex_a, const Vector2 &p_vertex_b, const Vector2 &p_vertex_c, const Vector2 &p_uv_a, const Vector2 &p_uv_c) {
+
+ float len_a_c = (p_vertex_c - p_vertex_a).length();
+ if (len_a_c < CMP_EPSILON) {
+ return p_uv_a;
+ }
+
+ float len_a_b = (p_vertex_b - p_vertex_a).length();
+
+ float c = len_a_b / len_a_c;
+
+ return p_uv_a.linear_interpolate(p_uv_c, c);
+}
+
+static Vector2 interpolate_triangle_uv(const Vector2 &p_pos, const Vector2 *p_vtx, const Vector2 *p_uv) {
+
+ if (p_pos.distance_squared_to(p_vtx[0]) < CMP_EPSILON2) {
+ return p_uv[0];
+ }
+ if (p_pos.distance_squared_to(p_vtx[1]) < CMP_EPSILON2) {
+ return p_uv[1];
+ }
+ if (p_pos.distance_squared_to(p_vtx[2]) < CMP_EPSILON2) {
+ return p_uv[2];
+ }
+
+ Vector2 v0 = p_vtx[1] - p_vtx[0];
+ Vector2 v1 = p_vtx[2] - p_vtx[0];
+ Vector2 v2 = p_pos - p_vtx[0];
+
+ float d00 = v0.dot(v0);
+ float d01 = v0.dot(v1);
+ float d11 = v1.dot(v1);
+ float d20 = v2.dot(v0);
+ float d21 = v2.dot(v1);
+ float denom = (d00 * d11 - d01 * d01);
+ if (denom == 0) {
+ return p_uv[0];
+ }
+ float v = (d11 * d20 - d01 * d21) / denom;
+ float w = (d00 * d21 - d01 * d20) / denom;
+ float u = 1.0f - v - w;
+
+ return p_uv[0] * u + p_uv[1] * v + p_uv[2] * w;
+}
+
+void CSGBrushOperation::BuildPoly::_clip_segment(const CSGBrush *p_brush, int p_face, const Vector2 *segment, MeshMerge &mesh_merge, bool p_for_B) {
+
+ //keep track of what was inserted
+ Vector<int> inserted_points;
+
+ //keep track of point indices for what was inserted, allowing reuse of points.
+ int segment_idx[2] = { -1, -1 };
+
+ //check if edge and poly share a vertex, of so, assign it to segment_idx
+ for (int i = 0; i < points.size(); i++) {
+ for (int j = 0; j < 2; j++) {
+ if (segment[j].distance_to(points[i].point) < CMP_EPSILON) {
+ segment_idx[j] = i;
+ inserted_points.push_back(i);
+ break;
+ }
+ }
+ }
+
+ //check if both segment points are shared with other vertices
+ if (segment_idx[0] != -1 && segment_idx[1] != -1) {
+
+ if (segment_idx[0] == segment_idx[1]) {
+ return; //segment was too tiny, both mapped to same point
+ }
+
+ bool found = false;
+
+ //check if the segment already exists
+ for (int i = 0; i < edges.size(); i++) {
+
+ if (
+ (edges[i].points[0] == segment_idx[0] && edges[i].points[1] == segment_idx[1]) ||
+ (edges[i].points[0] == segment_idx[1] && edges[i].points[1] == segment_idx[0])) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ //it does already exist, do nothing
+ return;
+ }
+
+ //directly add the new segment
+ Edge new_edge;
+ new_edge.points[0] = segment_idx[0];
+ new_edge.points[1] = segment_idx[1];
+ edges.push_back(new_edge);
+ return;
+ }
+
+ //check edge by edge against the segment points to see if intersects
+
+ for (int i = 0; i < base_edges; i++) {
+
+ //if a point is shared with one of the edge points, then this edge must not be tested, as it will result in a numerical precision error.
+ bool edge_valid = true;
+ for (int j = 0; j < 2; j++) {
+
+ if (edges[i].points[0] == segment_idx[0] || edges[i].points[1] == segment_idx[1] || edges[i].points[0] == segment_idx[1] || edges[i].points[1] == segment_idx[0]) {
+ edge_valid = false; //segment has this point, cant check against this
+ break;
+ }
+ }
+
+ if (!edge_valid) //already hit a point in this edge, so dont test it
+ continue;
+
+ //see if either points are within the edge isntead of crossing it
+ Vector2 res;
+ bool found = false;
+ int assign_segment_id = -1;
+
+ for (int j = 0; j < 2; j++) {
+
+ Vector2 edgeseg[2] = { points[edges[i].points[0]].point, points[edges[i].points[1]].point };
+ Vector2 closest = Geometry::get_closest_point_to_segment_2d(segment[j], edgeseg);
+
+ if (closest.distance_to(segment[j]) < CMP_EPSILON) {
+ //point rest of this edge
+ res = closest;
+ found = true;
+ assign_segment_id = j;
+ }
+ }
+
+ //test if the point crosses the edge
+ if (!found && Geometry::segment_intersects_segment_2d(segment[0], segment[1], points[edges[i].points[0]].point, points[edges[i].points[1]].point, &res)) {
+ //point does cross the edge
+ found = true;
+ }
+
+ //check whether an intersection against the segment happened
+ if (found) {
+
+ //It did! so first, must slice the segment
+ Point new_point;
+ new_point.point = res;
+ //make sure to interpolate UV too
+ new_point.uv = interpolate_uv(points[edges[i].points[0]].point, new_point.point, points[edges[i].points[1]].point, points[edges[i].points[0]].uv, points[edges[i].points[1]].uv);
+
+ int point_idx = points.size();
+ points.push_back(new_point);
+
+ //split the edge in 2
+ Edge new_edge;
+ new_edge.points[0] = edges[i].points[0];
+ new_edge.points[1] = point_idx;
+ new_edge.outer = edges[i].outer;
+ edges[i].points[0] = point_idx;
+ edges.insert(i, new_edge);
+ i++; //skip newly inserted edge
+ base_edges++; //will need an extra one in the base triangle
+ if (assign_segment_id >= 0) {
+ //point did split a segment, so make sure to remember this
+ segment_idx[assign_segment_id] = point_idx;
+ }
+ inserted_points.push_back(point_idx);
+ }
+ }
+
+ //final step: after cutting the original triangle, try to see if we can still insert
+ //this segment
+
+ //if already inserted two points, just use them for a segment
+
+ if (inserted_points.size() >= 2) { //should never be >2 on non-manifold geometry, but cope with error
+ //two points were inserted, create the new edge
+ Edge new_edge;
+ new_edge.points[0] = inserted_points[0];
+ new_edge.points[1] = inserted_points[1];
+ edges.push_back(new_edge);
+ return;
+ }
+
+ // One or no points were inserted (besides splitting), so try to see if extra points can be placed inside the triangle.
+ // This needs to be done here, after the previous tests were exhausted
+ for (int i = 0; i < 2; i++) {
+
+ if (segment_idx[i] != -1)
+ continue; //already assigned to something, so skip
+
+ //check whether one of the segment endpoints is inside the triangle. If it is, this points needs to be inserted
+ if (Geometry::is_point_in_triangle(segment[i], points[0].point, points[1].point, points[2].point)) {
+
+ Point new_point;
+ new_point.point = segment[i];
+
+ Vector2 point3[3] = { points[0].point, points[1].point, points[2].point };
+ Vector2 uv3[3] = { points[0].uv, points[1].uv, points[2].uv };
+
+ new_point.uv = interpolate_triangle_uv(new_point.point, point3, uv3);
+
+ int point_idx = points.size();
+ points.push_back(new_point);
+ inserted_points.push_back(point_idx);
+ }
+ }
+
+ //check again whether two points were inserted, if so then create the new edge
+ if (inserted_points.size() >= 2) { //should never be >2 on non-manifold geometry, but cope with error
+ Edge new_edge;
+ new_edge.points[0] = inserted_points[0];
+ new_edge.points[1] = inserted_points[1];
+ edges.push_back(new_edge);
+ }
+}
+
+void CSGBrushOperation::BuildPoly::clip(const CSGBrush *p_brush, int p_face, MeshMerge &mesh_merge, bool p_for_B) {
+
+ //Clip function.. find triangle points that will be mapped to the plane and form a segment
+
+ Vector2 segment[3]; //2D
+
+ int src_points = 0;
+
+ for (int i = 0; i < 3; i++) {
+ Vector3 p = p_brush->faces[p_face].vertices[i];
+ if (plane.has_point(p)) {
+ Vector3 pp = plane.project(p);
+ pp = to_poly.xform(pp);
+ segment[src_points++] = Vector2(pp.x, pp.y);
+ } else {
+ Vector3 q = p_brush->faces[p_face].vertices[(i + 1) % 3];
+ if (plane.has_point(q))
+ continue; //next point is in plane, will be added eventually
+ if (plane.is_point_over(p) == plane.is_point_over(q))
+ continue; // both on same side of the plane, don't add
+
+ Vector3 res;
+ if (plane.intersects_segment(p, q, &res)) {
+ res = to_poly.xform(res);
+ segment[src_points++] = Vector2(res.x, res.y);
+ }
+ }
+ }
+
+ //all above or all below, nothing to do. Should not happen though since a precheck was done before.
+ if (src_points == 0)
+ return;
+
+ //just one point in plane is not worth doing anything
+ if (src_points == 1)
+ return;
+
+ //transform A points to 2D
+
+ if (segment[0].distance_to(segment[1]) < CMP_EPSILON)
+ return; //too small
+
+ _clip_segment(p_brush, p_face, segment, mesh_merge, p_for_B);
+}
+
+void CSGBrushOperation::_collision_callback(const CSGBrush *A, int p_face_a, Map<int, BuildPoly> &build_polys_a, const CSGBrush *B, int p_face_b, Map<int, BuildPoly> &build_polys_b, MeshMerge &mesh_merge) {
+
+ //construct a frame of reference for both transforms, in order to do intersection test
+ Vector3 va[3] = {
+ A->faces[p_face_a].vertices[0],
+ A->faces[p_face_a].vertices[1],
+ A->faces[p_face_a].vertices[2],
+ };
+ Vector3 vb[3] = {
+ B->faces[p_face_b].vertices[0],
+ B->faces[p_face_b].vertices[1],
+ B->faces[p_face_b].vertices[2],
+ };
+
+ {
+ //check if either is a degenerate
+ if (va[0].distance_to(va[1]) < CMP_EPSILON || va[0].distance_to(va[2]) < CMP_EPSILON || va[1].distance_to(va[2]) < CMP_EPSILON)
+ return;
+
+ if (vb[0].distance_to(vb[1]) < CMP_EPSILON || vb[0].distance_to(vb[2]) < CMP_EPSILON || vb[1].distance_to(vb[2]) < CMP_EPSILON)
+ return;
+ }
+
+ {
+ //check if points are the same
+ int equal_count = 0;
+
+ for (int i = 0; i < 3; i++) {
+
+ for (int j = 0; j < 3; j++) {
+ if (va[i].distance_to(vb[j]) < mesh_merge.vertex_snap) {
+ equal_count++;
+ break;
+ }
+ }
+ }
+
+ //if 2 or 3 points are the same, there is no point in doing anything. They can't
+ //be clipped either, so add both.
+ if (equal_count == 2 || equal_count == 3) {
+ return;
+ }
+ }
+
+ // do a quick pre-check for no-intersection using the SAT theorem
+
+ {
+
+ //b under or over a plane
+ int over_count = 0, in_plane_count = 0, under_count = 0;
+ Plane plane_a(va[0], va[1], va[2]);
+ if (plane_a.normal == Vector3()) {
+ return; //degenerate
+ }
+
+ for (int i = 0; i < 3; i++) {
+ if (plane_a.has_point(vb[i]))
+ in_plane_count++;
+ else if (plane_a.is_point_over(vb[i]))
+ over_count++;
+ else
+ under_count++;
+ }
+
+ if (over_count == 0 || under_count == 0)
+ return; //no intersection, something needs to be under AND over
+
+ //a under or over b plane
+ over_count = 0;
+ under_count = 0;
+ in_plane_count = 0;
+
+ Plane plane_b(vb[0], vb[1], vb[2]);
+ if (plane_b.normal == Vector3())
+ return; //degenerate
+
+ for (int i = 0; i < 3; i++) {
+ if (plane_b.has_point(va[i]))
+ in_plane_count++;
+ else if (plane_b.is_point_over(va[i]))
+ over_count++;
+ else
+ under_count++;
+ }
+
+ if (over_count == 0 || under_count == 0)
+ return; //no intersection, something needs to be under AND over
+
+ //edge pairs (cross product combinations), see SAT theorem
+
+ for (int i = 0; i < 3; i++) {
+
+ Vector3 axis_a = (va[i] - va[(i + 1) % 3]).normalized();
+
+ for (int j = 0; j < 3; j++) {
+
+ Vector3 axis_b = (vb[j] - vb[(j + 1) % 3]).normalized();
+
+ Vector3 sep_axis = axis_a.cross(axis_b);
+ if (sep_axis == Vector3())
+ continue; //colineal
+ sep_axis.normalize();
+
+ real_t min_a = 1e20, max_a = -1e20;
+ real_t min_b = 1e20, max_b = -1e20;
+
+ for (int k = 0; k < 3; k++) {
+ real_t d = sep_axis.dot(va[k]);
+ min_a = MIN(min_a, d);
+ max_a = MAX(max_a, d);
+ d = sep_axis.dot(vb[k]);
+ min_b = MIN(min_b, d);
+ max_b = MAX(max_b, d);
+ }
+
+ min_b -= (max_a - min_a) * 0.5;
+ max_b += (max_a - min_a) * 0.5;
+
+ real_t dmin = min_b - (min_a + max_a) * 0.5;
+ real_t dmax = max_b - (min_a + max_a) * 0.5;
+
+ if (dmin > CMP_EPSILON || dmax < -CMP_EPSILON) {
+ return; //does not contain zero, so they don't overlap
+ }
+ }
+ }
+ }
+
+ //if we are still here, it means they most likely intersect, so create BuildPolys if they dont existy
+
+ BuildPoly *poly_a = NULL;
+
+ if (!build_polys_a.has(p_face_a)) {
+
+ BuildPoly bp;
+ bp.create(A, p_face_a, mesh_merge, false);
+ build_polys_a[p_face_a] = bp;
+ }
+
+ poly_a = &build_polys_a[p_face_a];
+
+ BuildPoly *poly_b = NULL;
+
+ if (!build_polys_b.has(p_face_b)) {
+
+ BuildPoly bp;
+ bp.create(B, p_face_b, mesh_merge, true);
+ build_polys_b[p_face_b] = bp;
+ }
+
+ poly_b = &build_polys_b[p_face_b];
+
+ //clip each other, this could be improved by using vertex unique IDs (more vertices may be shared instead of using snap)
+ poly_a->clip(B, p_face_b, mesh_merge, false);
+ poly_b->clip(A, p_face_a, mesh_merge, true);
+}
+
+void CSGBrushOperation::_add_poly_points(const BuildPoly &p_poly, int p_edge, int p_from_point, int p_to_point, const Vector<Vector<int> > &vertex_process, Vector<bool> &edge_process, Vector<PolyPoints> &r_poly) {
+
+ //this function follows the polygon points counter clockwise and adds them. It creates lists of unique polygons
+ //every time an unused edge is found, it's pushed to a stack and continues from there.
+
+ List<EdgeSort> edge_stack;
+
+ {
+ EdgeSort es;
+ es.angle = 0; //wont be checked here
+ es.edge = p_edge;
+ es.prev_point = p_from_point;
+ es.edge_point = p_to_point;
+
+ edge_stack.push_back(es);
+ }
+
+ //attempt to empty the stack.
+ while (edge_stack.size()) {
+
+ EdgeSort e = edge_stack.front()->get();
+ edge_stack.pop_front();
+
+ if (edge_process[e.edge]) {
+ //nothing to do here
+ continue;
+ }
+
+ Vector<int> points;
+ points.push_back(e.prev_point);
+
+ int prev_point = e.prev_point;
+ int to_point = e.edge_point;
+ int current_edge = e.edge;
+
+ edge_process[e.edge] = true; //mark as processed
+
+ int limit = p_poly.points.size() * 4; //avoid infinite recursion
+
+ while (to_point != e.prev_point && limit) {
+
+ Vector2 segment[2] = { p_poly.points[prev_point].point, p_poly.points[to_point].point };
+
+ //construct a basis transform from the segment, which will be used to check the angle
+ Transform2D t2d;
+ t2d[0] = (segment[1] - segment[0]).normalized(); //use as Y
+ t2d[1] = Vector2(-t2d[0].y, t2d[0].x); // use as tangent
+ t2d[2] = segment[1]; //origin
+
+ if (t2d.basis_determinant() == 0)
+ break; //abort poly
+
+ t2d.affine_invert();
+
+ //push all edges found here, they will be sorted by minimum angle later.
+ Vector<EdgeSort> next_edges;
+
+ for (int i = 0; i < vertex_process[to_point].size(); i++) {
+
+ int edge = vertex_process[to_point][i];
+ int opposite_point = p_poly.edges[edge].points[0] == to_point ? p_poly.edges[edge].points[1] : p_poly.edges[edge].points[0];
+ if (opposite_point == prev_point)
+ continue; //not going back
+
+ EdgeSort e;
+ Vector2 local_vec = t2d.xform(p_poly.points[opposite_point].point);
+ e.angle = -local_vec.angle(); //negate so we can sort by minimum angle
+ e.edge = edge;
+ e.edge_point = opposite_point;
+ e.prev_point = to_point;
+
+ next_edges.push_back(e);
+ }
+
+ //finally, sort by minimum angle
+ next_edges.sort();
+
+ int next_point = -1;
+ int next_edge = -1;
+
+ for (int i = 0; i < next_edges.size(); i++) {
+
+ if (i == 0) {
+ //minimum angle found is the next point
+ next_point = next_edges[i].edge_point;
+ next_edge = next_edges[i].edge;
+
+ } else {
+ //the rest are pushed to the stack IF they were not processed yet.
+ if (!edge_process[next_edges[i].edge]) {
+ edge_stack.push_back(next_edges[i]);
+ }
+ }
+ }
+
+ if (next_edge == -1) {
+ //did not find anything, may be a dead-end edge (this should normally not happen)
+ //just flip the direction and go back
+ next_point = prev_point;
+ next_edge = current_edge;
+ }
+
+ points.push_back(to_point);
+
+ prev_point = to_point;
+ to_point = next_point;
+ edge_process[next_edge] = true; //mark this edge as processed
+ current_edge = next_edge;
+
+ limit--;
+ }
+
+ //if more than 2 points were added to the polygon, add it to the list of polygons.
+ if (points.size() > 2) {
+ PolyPoints pp;
+ pp.points = points;
+ r_poly.push_back(pp);
+ }
+ }
+}
+
+void CSGBrushOperation::_add_poly_outline(const BuildPoly &p_poly, int p_from_point, int p_to_point, const Vector<Vector<int> > &vertex_process, Vector<int> &r_outline) {
+
+ //this is the opposite of the function above. It adds polygon outlines instead.
+ //this is used for triangulating holes.
+ //no stack is used here because only the bigger outline is interesting.
+
+ r_outline.push_back(p_from_point);
+
+ int prev_point = p_from_point;
+ int to_point = p_to_point;
+
+ int limit = p_poly.points.size() * 4; //avoid infinite recursion
+
+ while (to_point != p_from_point && limit) {
+
+ Vector2 segment[2] = { p_poly.points[prev_point].point, p_poly.points[to_point].point };
+ //again create a transform to compute the angle.
+ Transform2D t2d;
+ t2d[0] = (segment[1] - segment[0]).normalized(); //use as Y
+ t2d[1] = Vector2(-t2d[0].y, t2d[0].x); // use as tangent
+ t2d[2] = segment[1]; //origin
+
+ if (t2d.basis_determinant() == 0)
+ break; //abort poly
+
+ t2d.affine_invert();
+
+ float max_angle;
+ int next_point_angle = -1;
+
+ for (int i = 0; i < vertex_process[to_point].size(); i++) {
+
+ int edge = vertex_process[to_point][i];
+ int opposite_point = p_poly.edges[edge].points[0] == to_point ? p_poly.edges[edge].points[1] : p_poly.edges[edge].points[0];
+ if (opposite_point == prev_point)
+ continue; //not going back
+
+ float angle = -t2d.xform(p_poly.points[opposite_point].point).angle();
+ if (next_point_angle == -1 || angle > max_angle) { //same as before but use greater to check.
+ max_angle = angle;
+ next_point_angle = opposite_point;
+ }
+ }
+
+ if (next_point_angle == -1) {
+ //go back because no route found
+ next_point_angle = prev_point;
+ }
+
+ r_outline.push_back(to_point);
+ prev_point = to_point;
+ to_point = next_point_angle;
+
+ limit--;
+ }
+}
+
+void CSGBrushOperation::_merge_poly(MeshMerge &mesh, int p_face_idx, const BuildPoly &p_poly, bool p_from_b) {
+
+ //finally, merge the 2D polygon back to 3D
+
+ Vector<Vector<int> > vertex_process;
+ Vector<bool> edge_process;
+
+ vertex_process.resize(p_poly.points.size());
+ edge_process.resize(p_poly.edges.size());
+
+ //none processed by default
+ for (int i = 0; i < edge_process.size(); i++) {
+ edge_process[i] = false;
+ }
+
+ //put edges in points, so points can go through them
+ for (int i = 0; i < p_poly.edges.size(); i++) {
+ vertex_process[p_poly.edges[i].points[0]].push_back(i);
+ vertex_process[p_poly.edges[i].points[1]].push_back(i);
+ }
+
+ Vector<PolyPoints> polys;
+
+ //process points that were not processed
+ for (int i = 0; i < edge_process.size(); i++) {
+ if (edge_process[i] == true)
+ continue; //already processed
+
+ int intersect_poly = -1;
+
+ if (i > 0) {
+ //this is disconnected, so it's clearly a hole. lets find where it belongs
+ Vector2 ref_point = p_poly.points[p_poly.edges[i].points[0]].point;
+
+ for (int j = 0; j < polys.size(); j++) {
+
+ //find a point outside poly
+ Vector2 out_point(-1e20, -1e20);
+
+ const PolyPoints &pp = polys[j];
+
+ for (int k = 0; k < pp.points.size(); k++) {
+ Vector2 p = p_poly.points[pp.points[k]].point;
+ out_point.x = MAX(out_point.x, p.x);
+ out_point.y = MAX(out_point.y, p.y);
+ }
+
+ out_point += Vector2(0.12341234, 0.4123412); // move to a random place to avoid direct edge-point chances
+
+ int intersections = 0;
+
+ for (int k = 0; k < pp.points.size(); k++) {
+ Vector2 p1 = p_poly.points[pp.points[k]].point;
+ Vector2 p2 = p_poly.points[pp.points[(k + 1) % pp.points.size()]].point;
+
+ if (Geometry::segment_intersects_segment_2d(ref_point, out_point, p1, p2, NULL)) {
+ intersections++;
+ }
+ }
+
+ if (intersections % 2 == 1) {
+ //hole is inside this poly
+ intersect_poly = j;
+ break;
+ }
+ }
+ }
+
+ if (intersect_poly != -1) {
+ //must add this as a hole
+ Vector<int> outline;
+ _add_poly_outline(p_poly, p_poly.edges[i].points[0], p_poly.edges[i].points[1], vertex_process, outline);
+
+ if (outline.size() > 1) {
+ polys[intersect_poly].holes.push_back(outline);
+ }
+ }
+ _add_poly_points(p_poly, i, p_poly.edges[i].points[0], p_poly.edges[i].points[1], vertex_process, edge_process, polys);
+ }
+
+ //get rid of holes, not the most optiomal way, but also not a common case at all to be inoptimal
+ for (int i = 0; i < polys.size(); i++) {
+
+ if (!polys[i].holes.size())
+ continue;
+
+ //repeat until no more holes are left to be merged
+ while (polys[i].holes.size()) {
+
+ //try to merge a hole with the outline
+ bool added_hole = false;
+
+ for (int j = 0; j < polys[i].holes.size(); j++) {
+
+ //try hole vertices
+ int with_outline_vertex = -1;
+ int from_hole_vertex = -1;
+
+ bool found = false;
+
+ for (int k = 0; k < polys[i].holes[j].size(); k++) {
+
+ int from_idx = polys[i].holes[j][k];
+ Vector2 from = p_poly.points[from_idx].point;
+
+ //try a segment from hole vertex to outline vertices
+ from_hole_vertex = k;
+
+ bool valid = true;
+
+ for (int l = 0; l < polys[i].points.size(); l++) {
+
+ int to_idx = polys[i].points[l];
+ Vector2 to = p_poly.points[to_idx].point;
+ with_outline_vertex = l;
+
+ //try agaisnt outline (other points) first
+
+ valid = true;
+
+ for (int m = 0; m < polys[i].points.size(); m++) {
+
+ int m_next = (m + 1) % polys[i].points.size();
+ if (m == with_outline_vertex || m_next == with_outline_vertex) //do not test with edges that share this point
+ continue;
+
+ if (Geometry::segment_intersects_segment_2d(from, to, p_poly.points[polys[i].points[m]].point, p_poly.points[polys[i].points[m_next]].point, NULL)) {
+ valid = false;
+ break;
+ }
+ }
+
+ if (!valid)
+ continue;
+
+ //try agaisnt all holes including self
+
+ for (int m = 0; m < polys[i].holes.size(); m++) {
+
+ for (int n = 0; n < polys[i].holes[m].size(); n++) {
+
+ int n_next = (n + 1) % polys[i].holes[m].size();
+ if (m == j && (n == from_hole_vertex || n_next == from_hole_vertex)) //contains vertex being tested from current hole, skip
+ continue;
+
+ if (Geometry::segment_intersects_segment_2d(from, to, p_poly.points[polys[i].holes[m][n]].point, p_poly.points[polys[i].holes[m][n_next]].point, NULL)) {
+ valid = false;
+ break;
+ }
+ }
+
+ if (!valid)
+ break;
+ }
+
+ if (valid) //all passed! exit loop
+ break;
+ else
+ continue; //something went wrong, go on.
+ }
+
+ if (valid) {
+ found = true; //if in the end this was valid, use it
+ break;
+ }
+ }
+
+ if (found) {
+
+ //hook this hole with outline, and remove from list of holes
+
+ //duplicate point
+ int insert_at = with_outline_vertex;
+ polys[i].points.insert(insert_at, polys[i].points[insert_at]);
+ insert_at++;
+ //insert all others, outline should be backwards (must check)
+ int holesize = polys[i].holes[j].size();
+ for (int k = 0; k <= holesize; k++) {
+ int idx = (from_hole_vertex + k) % holesize;
+ polys[i].points.insert(insert_at, polys[i].holes[j][idx]);
+ insert_at++;
+ }
+
+ added_hole = true;
+ polys[i].holes.remove(j);
+ break; //got rid of hole, break and continue
+ }
+ }
+
+ ERR_BREAK(!added_hole);
+ }
+ }
+
+ //triangulate polygons
+
+ for (int i = 0; i < polys.size(); i++) {
+
+ Vector<Vector2> vertices;
+ vertices.resize(polys[i].points.size());
+ for (int j = 0; j < vertices.size(); j++) {
+ vertices[j] = p_poly.points[polys[i].points[j]].point;
+ }
+
+ Vector<int> indices = Geometry::triangulate_polygon(vertices);
+
+ for (int j = 0; j < indices.size(); j += 3) {
+
+ //obtain the vertex
+
+ Vector3 face[3];
+ Vector2 uv[3];
+ float cp = Geometry::vec2_cross(p_poly.points[polys[i].points[indices[j + 0]]].point, p_poly.points[polys[i].points[indices[j + 1]]].point, p_poly.points[polys[i].points[indices[j + 2]]].point);
+ if (Math::abs(cp) < CMP_EPSILON)
+ continue;
+
+ for (int k = 0; k < 3; k++) {
+
+ Vector2 p = p_poly.points[polys[i].points[indices[j + k]]].point;
+ face[k] = p_poly.to_world.xform(Vector3(p.x, p.y, 0));
+ uv[k] = p_poly.points[polys[i].points[indices[j + k]]].uv;
+ }
+
+ mesh.add_face(face[0], face[1], face[2], uv[0], uv[1], uv[2], p_poly.smooth, p_poly.invert, p_poly.material, p_from_b);
+ }
+ }
+}
+
+//use a limit to speed up bvh and limit the depth
+#define BVH_LIMIT 8
+
+int CSGBrushOperation::MeshMerge::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &max_depth, int &max_alloc) {
+
+ if (p_depth > max_depth) {
+ max_depth = p_depth;
+ }
+
+ if (p_size <= BVH_LIMIT) {
+
+ for (int i = 0; i < p_size - 1; i++) {
+ p_bb[p_from + i]->next = p_bb[p_from + i + 1] - p_bvh;
+ }
+ return p_bb[p_from] - p_bvh;
+ } else if (p_size == 0) {
+
+ return -1;
+ }
+
+ AABB aabb;
+ aabb = p_bb[p_from]->aabb;
+ for (int i = 1; i < p_size; i++) {
+
+ aabb.merge_with(p_bb[p_from + i]->aabb);
+ }
+
+ int li = aabb.get_longest_axis_index();
+
+ switch (li) {
+
+ case Vector3::AXIS_X: {
+ SortArray<BVH *, BVHCmpX> sort_x;
+ sort_x.nth_element(0, p_size, p_size / 2, &p_bb[p_from]);
+ //sort_x.sort(&p_bb[p_from],p_size);
+ } break;
+ case Vector3::AXIS_Y: {
+ SortArray<BVH *, BVHCmpY> sort_y;
+ sort_y.nth_element(0, p_size, p_size / 2, &p_bb[p_from]);
+ //sort_y.sort(&p_bb[p_from],p_size);
+ } break;
+ case Vector3::AXIS_Z: {
+ SortArray<BVH *, BVHCmpZ> sort_z;
+ sort_z.nth_element(0, p_size, p_size / 2, &p_bb[p_from]);
+ //sort_z.sort(&p_bb[p_from],p_size);
+
+ } break;
+ }
+
+ int left = _create_bvh(p_bvh, p_bb, p_from, p_size / 2, p_depth + 1, max_depth, max_alloc);
+ int right = _create_bvh(p_bvh, p_bb, p_from + p_size / 2, p_size - p_size / 2, p_depth + 1, max_depth, max_alloc);
+
+ int index = max_alloc++;
+ BVH *_new = &p_bvh[index];
+ _new->aabb = aabb;
+ _new->center = aabb.position + aabb.size * 0.5;
+ _new->face = -1;
+ _new->left = left;
+ _new->right = right;
+ _new->next = -1;
+
+ return index;
+}
+
+int CSGBrushOperation::MeshMerge::_bvh_count_intersections(BVH *bvhptr, int p_max_depth, int p_bvh_first, const Vector3 &p_begin, const Vector3 &p_end, int p_exclude) const {
+
+ uint32_t *stack = (uint32_t *)alloca(sizeof(int) * p_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 intersections = 0;
+
+ int level = 0;
+
+ const Vector3 *vertexptr = points.ptr();
+ const Face *facesptr = faces.ptr();
+ AABB segment_aabb;
+ segment_aabb.position = p_begin;
+ segment_aabb.expand_to(p_end);
+
+ int pos = p_bvh_first;
+
+ 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.face >= 0) {
+
+ const BVH *bp = &b;
+
+ while (bp) {
+
+ bool valid = segment_aabb.intersects(bp->aabb) && bp->aabb.intersects_segment(p_begin, p_end);
+
+ if (valid && p_exclude != bp->face) {
+ const Face &s = facesptr[bp->face];
+ Face3 f3(vertexptr[s.points[0]], vertexptr[s.points[1]], vertexptr[s.points[2]]);
+
+ Vector3 res;
+
+ if (f3.intersects_segment(p_begin, p_end, &res)) {
+ intersections++;
+ }
+ }
+ if (bp->next != -1) {
+ bp = &bvhptr[bp->next];
+ } else {
+ bp = NULL;
+ }
+ }
+
+ stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
+
+ } else {
+
+ bool valid = segment_aabb.intersects(b.aabb) && b.aabb.intersects_segment(p_begin, p_end);
+
+ if (!valid) {
+
+ 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;
+ stack[level + 1] = b.left | TEST_AABB_BIT;
+ level++;
+ continue;
+ }
+ case VISIT_RIGHT_BIT: {
+
+ stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node;
+ stack[level + 1] = b.right | TEST_AABB_BIT;
+ level++;
+ continue;
+ }
+ case VISIT_DONE_BIT: {
+
+ if (level == 0) {
+ done = true;
+ break;
+ } else
+ level--;
+ continue;
+ }
+ }
+
+ if (done)
+ break;
+ }
+
+ return intersections;
+}
+
+void CSGBrushOperation::MeshMerge::mark_inside_faces() {
+
+ // mark faces that are inside. This helps later do the boolean ops when merging.
+ // this approach is very brute force (with a bunch of optimizatios, such as BVH and pre AABB intersection test)
+
+ AABB aabb;
+
+ for (int i = 0; i < points.size(); i++) {
+ if (i == 0) {
+ aabb.position = points[i];
+ } else {
+ aabb.expand_to(points[i]);
+ }
+ }
+
+ float max_distance = aabb.size.length() * 1.2;
+
+ Vector<BVH> bvhvec;
+ bvhvec.resize(faces.size() * 3); //will never be larger than this (todo make better)
+ BVH *bvh = bvhvec.ptrw();
+
+ AABB faces_a;
+ AABB faces_b;
+
+ bool first_a = true;
+ bool first_b = true;
+
+ for (int i = 0; i < faces.size(); i++) {
+ bvh[i].left = -1;
+ bvh[i].right = -1;
+ bvh[i].face = i;
+ bvh[i].aabb.position = points[faces[i].points[0]];
+ bvh[i].aabb.expand_to(points[faces[i].points[1]]);
+ bvh[i].aabb.expand_to(points[faces[i].points[2]]);
+ bvh[i].center = bvh[i].aabb.position + bvh[i].aabb.size * 0.5;
+ bvh[i].next = -1;
+ if (faces[i].from_b) {
+ if (first_b) {
+ faces_b = bvh[i].aabb;
+ first_b = false;
+ } else {
+ faces_b.merge_with(bvh[i].aabb);
+ }
+ } else {
+ if (first_a) {
+ faces_a = bvh[i].aabb;
+ first_a = false;
+ } else {
+ faces_a.merge_with(bvh[i].aabb);
+ }
+ }
+ }
+
+ AABB intersection_aabb = faces_a.intersection(faces_b);
+ intersection_aabb.grow_by(intersection_aabb.get_longest_axis_size() * 0.01); //grow a little, avoid numerical error
+
+ if (intersection_aabb.size == Vector3()) //AABB do not intersect, so neither do shapes.
+ return;
+
+ Vector<BVH *> bvhtrvec;
+ bvhtrvec.resize(faces.size());
+ BVH **bvhptr = bvhtrvec.ptrw();
+ for (int i = 0; i < faces.size(); i++) {
+
+ bvhptr[i] = &bvh[i];
+ }
+
+ int max_depth = 0;
+ int max_alloc = faces.size();
+ _create_bvh(bvh, bvhptr, 0, faces.size(), 1, max_depth, max_alloc);
+
+ for (int i = 0; i < faces.size(); i++) {
+
+ if (!intersection_aabb.intersects(bvh[i].aabb))
+ continue; //not in AABB intersection, so not in face intersection
+ Vector3 center = points[faces[i].points[0]];
+ center += points[faces[i].points[1]];
+ center += points[faces[i].points[2]];
+ center /= 3.0;
+
+ Plane plane(points[faces[i].points[0]], points[faces[i].points[1]], points[faces[i].points[2]]);
+ Vector3 target = center + plane.normal * max_distance + Vector3(0.0001234, 0.000512, 0.00013423); //reduce chance of edge hits by doing a small increment
+
+ int intersections = _bvh_count_intersections(bvh, max_depth, max_alloc - 1, center, target, i);
+
+ if (intersections & 1) {
+ faces[i].inside = true;
+ }
+ }
+}
+
+void CSGBrushOperation::MeshMerge::add_face(const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_c, const Vector2 &p_uv_a, const Vector2 &p_uv_b, const Vector2 &p_uv_c, bool p_smooth, bool p_invert, const Ref<Material> &p_material, bool p_from_b) {
+
+ Vector3 src_points[3] = { p_a, p_b, p_c };
+ Vector2 src_uvs[3] = { p_uv_a, p_uv_b, p_uv_c };
+ int indices[3];
+ for (int i = 0; i < 3; i++) {
+
+ VertexKey vk;
+ vk.x = int((double(src_points[i].x) + double(vertex_snap) * 0.31234) / double(vertex_snap));
+ vk.y = int((double(src_points[i].y) + double(vertex_snap) * 0.31234) / double(vertex_snap));
+ vk.z = int((double(src_points[i].z) + double(vertex_snap) * 0.31234) / double(vertex_snap));
+
+ int res;
+ if (snap_cache.lookup(vk, res)) {
+ indices[i] = res;
+ } else {
+ indices[i] = points.size();
+ points.push_back(src_points[i]);
+ snap_cache.set(vk, indices[i]);
+ }
+ }
+
+ if (indices[0] == indices[2] || indices[0] == indices[1] || indices[1] == indices[2])
+ return; //not adding degenerate
+
+ MeshMerge::Face face;
+ face.from_b = p_from_b;
+ face.inside = false;
+ face.smooth = p_smooth;
+ face.invert = p_invert;
+ if (p_material.is_valid()) {
+ if (!materials.has(p_material)) {
+ face.material_idx = materials.size();
+ materials[p_material] = face.material_idx;
+ } else {
+ face.material_idx = materials[p_material];
+ }
+ } else {
+ face.material_idx = -1;
+ }
+
+ for (int k = 0; k < 3; k++) {
+
+ face.points[k] = indices[k];
+ face.uvs[k] = src_uvs[k];
+ ;
+ }
+
+ faces.push_back(face);
+}
+
+void CSGBrushOperation::merge_brushes(Operation p_operation, const CSGBrush &p_A, const CSGBrush &p_B, CSGBrush &result, float p_snap) {
+
+ CallbackData cd;
+ cd.self = this;
+ cd.A = &p_A;
+ cd.B = &p_B;
+
+ MeshMerge mesh_merge;
+ mesh_merge.vertex_snap = p_snap;
+
+ //check intersections between faces. Use AABB to speed up precheck
+ //this generates list of buildpolys and clips them.
+ //this was originally BVH optimized, but its not really worth it.
+ for (int i = 0; i < p_A.faces.size(); i++) {
+ cd.face_a = i;
+ for (int j = 0; j < p_B.faces.size(); j++) {
+ if (p_A.faces[i].aabb.intersects(p_B.faces[j].aabb)) {
+ _collision_callback(&p_A, i, cd.build_polys_A, &p_B, j, cd.build_polys_B, mesh_merge);
+ }
+ }
+ }
+
+ //merge the already cliped polys back to 3D
+ for (Map<int, BuildPoly>::Element *E = cd.build_polys_A.front(); E; E = E->next()) {
+ _merge_poly(mesh_merge, E->key(), E->get(), false);
+ }
+
+ for (Map<int, BuildPoly>::Element *E = cd.build_polys_B.front(); E; E = E->next()) {
+ _merge_poly(mesh_merge, E->key(), E->get(), true);
+ }
+
+ //merge the non clipped faces back
+
+ for (int i = 0; i < p_A.faces.size(); i++) {
+
+ if (cd.build_polys_A.has(i))
+ continue; //made from buildpoly, skipping
+
+ Vector3 points[3];
+ Vector2 uvs[3];
+ for (int j = 0; j < 3; j++) {
+ points[j] = p_A.faces[i].vertices[j];
+ uvs[j] = p_A.faces[i].uvs[j];
+ }
+ Ref<Material> material;
+ if (p_A.faces[i].material != -1) {
+ material = p_A.materials[p_A.faces[i].material];
+ }
+ mesh_merge.add_face(points[0], points[1], points[2], uvs[0], uvs[1], uvs[2], p_A.faces[i].smooth, p_A.faces[i].invert, material, false);
+ }
+
+ for (int i = 0; i < p_B.faces.size(); i++) {
+
+ if (cd.build_polys_B.has(i))
+ continue; //made from buildpoly, skipping
+
+ Vector3 points[3];
+ Vector2 uvs[3];
+ for (int j = 0; j < 3; j++) {
+ points[j] = p_B.faces[i].vertices[j];
+ uvs[j] = p_B.faces[i].uvs[j];
+ }
+ Ref<Material> material;
+ if (p_B.faces[i].material != -1) {
+ material = p_B.materials[p_B.faces[i].material];
+ }
+ mesh_merge.add_face(points[0], points[1], points[2], uvs[0], uvs[1], uvs[2], p_B.faces[i].smooth, p_B.faces[i].invert, material, true);
+ }
+
+ //mark faces that ended up inside the intersection
+ mesh_merge.mark_inside_faces();
+
+ //regen new brush to start filling it again
+ result.clear();
+
+ switch (p_operation) {
+
+ case OPERATION_UNION: {
+
+ int outside_count = 0;
+
+ for (int i = 0; i < mesh_merge.faces.size(); i++) {
+ if (mesh_merge.faces[i].inside)
+ continue;
+
+ outside_count++;
+ }
+
+ result.faces.resize(outside_count);
+
+ outside_count = 0;
+
+ for (int i = 0; i < mesh_merge.faces.size(); i++) {
+ if (mesh_merge.faces[i].inside)
+ continue;
+ for (int j = 0; j < 3; j++) {
+ result.faces[outside_count].vertices[j] = mesh_merge.points[mesh_merge.faces[i].points[j]];
+ result.faces[outside_count].uvs[j] = mesh_merge.faces[i].uvs[j];
+ }
+
+ result.faces[outside_count].smooth = mesh_merge.faces[i].smooth;
+ result.faces[outside_count].invert = mesh_merge.faces[i].invert;
+ result.faces[outside_count].material = mesh_merge.faces[i].material_idx;
+ outside_count++;
+ }
+
+ result._regen_face_aabbs();
+
+ } break;
+ case OPERATION_INTERSECTION: {
+
+ int inside_count = 0;
+
+ for (int i = 0; i < mesh_merge.faces.size(); i++) {
+ if (!mesh_merge.faces[i].inside)
+ continue;
+
+ inside_count++;
+ }
+
+ result.faces.resize(inside_count);
+
+ inside_count = 0;
+
+ for (int i = 0; i < mesh_merge.faces.size(); i++) {
+ if (!mesh_merge.faces[i].inside)
+ continue;
+ for (int j = 0; j < 3; j++) {
+ result.faces[inside_count].vertices[j] = mesh_merge.points[mesh_merge.faces[i].points[j]];
+ result.faces[inside_count].uvs[j] = mesh_merge.faces[i].uvs[j];
+ }
+
+ result.faces[inside_count].smooth = mesh_merge.faces[i].smooth;
+ result.faces[inside_count].invert = mesh_merge.faces[i].invert;
+ result.faces[inside_count].material = mesh_merge.faces[i].material_idx;
+ inside_count++;
+ }
+
+ result._regen_face_aabbs();
+
+ } break;
+ case OPERATION_SUBSTRACTION: {
+
+ int face_count = 0;
+
+ for (int i = 0; i < mesh_merge.faces.size(); i++) {
+ if (mesh_merge.faces[i].from_b && !mesh_merge.faces[i].inside)
+ continue;
+ if (!mesh_merge.faces[i].from_b && mesh_merge.faces[i].inside)
+ continue;
+
+ face_count++;
+ }
+
+ result.faces.resize(face_count);
+
+ face_count = 0;
+
+ for (int i = 0; i < mesh_merge.faces.size(); i++) {
+
+ if (mesh_merge.faces[i].from_b && !mesh_merge.faces[i].inside)
+ continue;
+ if (!mesh_merge.faces[i].from_b && mesh_merge.faces[i].inside)
+ continue;
+
+ for (int j = 0; j < 3; j++) {
+ result.faces[face_count].vertices[j] = mesh_merge.points[mesh_merge.faces[i].points[j]];
+ result.faces[face_count].uvs[j] = mesh_merge.faces[i].uvs[j];
+ }
+
+ if (mesh_merge.faces[i].from_b) {
+ //invert facing of insides of B
+ SWAP(result.faces[face_count].vertices[1], result.faces[face_count].vertices[2]);
+ SWAP(result.faces[face_count].uvs[1], result.faces[face_count].uvs[2]);
+ }
+
+ result.faces[face_count].smooth = mesh_merge.faces[i].smooth;
+ result.faces[face_count].invert = mesh_merge.faces[i].invert;
+ result.faces[face_count].material = mesh_merge.faces[i].material_idx;
+ face_count++;
+ }
+
+ result._regen_face_aabbs();
+
+ } break;
+ }
+
+ //updatelist of materials
+ result.materials.resize(mesh_merge.materials.size());
+ for (const Map<Ref<Material>, int>::Element *E = mesh_merge.materials.front(); E; E = E->next()) {
+ result.materials[E->get()] = E->key();
+ }
+}
diff --git a/modules/csg/csg.h b/modules/csg/csg.h
new file mode 100644
index 0000000000..53303a6533
--- /dev/null
+++ b/modules/csg/csg.h
@@ -0,0 +1,236 @@
+/*************************************************************************/
+/* csg.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef CSG_H
+#define CSG_H
+
+#include "aabb.h"
+#include "dvector.h"
+#include "map.h"
+#include "math_2d.h"
+#include "oa_hash_map.h"
+#include "plane.h"
+#include "scene/resources/material.h"
+#include "transform.h"
+#include "vector3.h"
+
+struct CSGBrush {
+
+ struct Face {
+
+ Vector3 vertices[3];
+ Vector2 uvs[3];
+ AABB aabb;
+ bool smooth;
+ bool invert;
+ int material;
+ };
+
+ Vector<Face> faces;
+ Vector<Ref<Material> > materials;
+
+ void _regen_face_aabbs();
+ //create a brush from faces
+ void build_from_faces(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uvs, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials, const PoolVector<bool> &p_invert_faces);
+ void copy_from(const CSGBrush &p_brush, const Transform &p_xform);
+
+ void clear();
+};
+
+struct CSGBrushOperation {
+
+ enum Operation {
+ OPERATION_UNION,
+ OPERATION_INTERSECTION,
+ OPERATION_SUBSTRACTION,
+
+ };
+
+ struct MeshMerge {
+
+ struct BVH {
+ int face;
+ int left;
+ int right;
+ int next;
+ Vector3 center;
+ AABB aabb;
+ };
+
+ struct BVHCmpX {
+
+ bool operator()(const BVH *p_left, const BVH *p_right) const {
+
+ return p_left->center.x < p_right->center.x;
+ }
+ };
+
+ struct BVHCmpY {
+
+ bool operator()(const BVH *p_left, const BVH *p_right) const {
+
+ return p_left->center.y < p_right->center.y;
+ }
+ };
+ struct BVHCmpZ {
+
+ bool operator()(const BVH *p_left, const BVH *p_right) const {
+
+ return p_left->center.z < p_right->center.z;
+ }
+ };
+
+ int _bvh_count_intersections(BVH *bvhptr, int p_max_depth, int p_bvh_first, const Vector3 &p_begin, const Vector3 &p_end, int p_exclude) const;
+ int _create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &max_depth, int &max_alloc);
+
+ struct VertexKey {
+ int32_t x, y, z;
+ _FORCE_INLINE_ bool operator<(const VertexKey &p_key) const {
+ if (x == p_key.x) {
+ if (y == p_key.y) {
+ return z < p_key.z;
+ } else {
+ return y < p_key.y;
+ }
+ } else {
+ return x < p_key.x;
+ }
+ }
+
+ _FORCE_INLINE_ bool operator==(const VertexKey &p_key) const {
+ return (x == p_key.x && y == p_key.y && z == p_key.z);
+ }
+ };
+
+ struct VertexKeyHash {
+ static _FORCE_INLINE_ uint32_t hash(const VertexKey &p_vk) {
+ uint32_t h = hash_djb2_one_32(p_vk.x);
+ h = hash_djb2_one_32(p_vk.y, h);
+ h = hash_djb2_one_32(p_vk.z, h);
+ return h;
+ }
+ };
+
+ OAHashMap<VertexKey, int, VertexKeyHash> snap_cache;
+
+ Vector<Vector3> points;
+
+ struct Face {
+ bool from_b;
+ bool inside;
+ int points[3];
+ Vector2 uvs[3];
+ bool smooth;
+ bool invert;
+ int material_idx;
+ };
+
+ Vector<Face> faces;
+
+ Map<Ref<Material>, int> materials;
+
+ Map<Vector3, int> vertex_map;
+ void add_face(const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_c, const Vector2 &p_uv_a, const Vector2 &p_uv_b, const Vector2 &p_uv_c, bool p_smooth, bool p_invert, const Ref<Material> &p_material, bool p_from_b);
+ // void add_face(const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_c, bool p_from_b);
+
+ float vertex_snap;
+ void mark_inside_faces();
+ };
+
+ struct BuildPoly {
+
+ Plane plane;
+ Transform to_poly;
+ Transform to_world;
+ int face_index;
+
+ struct Point {
+ Vector2 point;
+ Vector2 uv;
+ };
+
+ Vector<Point> points;
+
+ struct Edge {
+ bool outer;
+ int points[2];
+ Edge() {
+ outer = false;
+ }
+ };
+
+ Vector<Edge> edges;
+ Ref<Material> material;
+ bool smooth;
+ bool invert;
+
+ int base_edges; //edges from original triangle, even if split
+
+ void _clip_segment(const CSGBrush *p_brush, int p_face, const Vector2 *segment, MeshMerge &mesh_merge, bool p_for_B);
+
+ void create(const CSGBrush *p_brush, int p_face, MeshMerge &mesh_merge, bool p_for_B);
+ void clip(const CSGBrush *p_brush, int p_face, MeshMerge &mesh_merge, bool p_for_B);
+ };
+
+ struct PolyPoints {
+
+ Vector<int> points;
+
+ Vector<Vector<int> > holes;
+ };
+
+ struct EdgeSort {
+ int edge;
+ int prev_point;
+ int edge_point;
+ float angle;
+ bool operator<(const EdgeSort &p_edge) const { return angle < p_edge.angle; }
+ };
+
+ struct CallbackData {
+ const CSGBrush *A;
+ const CSGBrush *B;
+ int face_a;
+ CSGBrushOperation *self;
+ Map<int, BuildPoly> build_polys_A;
+ Map<int, BuildPoly> build_polys_B;
+ };
+
+ void _add_poly_points(const BuildPoly &p_poly, int p_edge, int p_from_point, int p_to_point, const Vector<Vector<int> > &vertex_process, Vector<bool> &edge_process, Vector<PolyPoints> &r_poly);
+ void _add_poly_outline(const BuildPoly &p_poly, int p_from_point, int p_to_point, const Vector<Vector<int> > &vertex_process, Vector<int> &r_outline);
+ void _merge_poly(MeshMerge &mesh, int p_face_idx, const BuildPoly &p_poly, bool p_from_b);
+
+ void _collision_callback(const CSGBrush *A, int p_face_a, Map<int, BuildPoly> &build_polys_a, const CSGBrush *B, int p_face_b, Map<int, BuildPoly> &build_polys_b, MeshMerge &mesh_merge);
+
+ static void _collision_callbacks(void *ud, int p_face_b);
+ void merge_brushes(Operation p_operation, const CSGBrush &p_A, const CSGBrush &p_B, CSGBrush &result, float p_snap = 0.001);
+};
+
+#endif // CSG_H
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp
new file mode 100644
index 0000000000..2150320c4a
--- /dev/null
+++ b/modules/csg/csg_gizmos.cpp
@@ -0,0 +1,345 @@
+/*************************************************************************/
+/* csg_gizmos.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "csg_gizmos.h"
+
+///////////
+
+String CSGShapeSpatialGizmo::get_handle_name(int p_idx) const {
+
+ if (Object::cast_to<CSGSphere>(cs)) {
+
+ return "Radius";
+ }
+
+ if (Object::cast_to<CSGBox>(cs)) {
+
+ static const char *hname[3] = { "Width", "Height", "Depth" };
+ return hname[p_idx];
+ }
+
+ if (Object::cast_to<CSGCylinder>(cs)) {
+
+ return p_idx == 0 ? "Radius" : "Height";
+ }
+
+ if (Object::cast_to<CSGTorus>(cs)) {
+
+ return p_idx == 0 ? "InnerRadius" : "OuterRadius";
+ }
+
+ return "";
+}
+Variant CSGShapeSpatialGizmo::get_handle_value(int p_idx) const {
+
+ if (Object::cast_to<CSGSphere>(cs)) {
+
+ CSGSphere *s = Object::cast_to<CSGSphere>(cs);
+ return s->get_radius();
+ }
+
+ if (Object::cast_to<CSGBox>(cs)) {
+
+ CSGBox *s = Object::cast_to<CSGBox>(cs);
+ switch (p_idx) {
+ case 0: return s->get_width();
+ case 1: return s->get_height();
+ case 2: return s->get_depth();
+ }
+ }
+
+ if (Object::cast_to<CSGCylinder>(cs)) {
+
+ CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
+ return p_idx == 0 ? s->get_radius() : s->get_height();
+ }
+
+ if (Object::cast_to<CSGTorus>(cs)) {
+
+ CSGTorus *s = Object::cast_to<CSGTorus>(cs);
+ return p_idx == 0 ? s->get_inner_radius() : s->get_outer_radius();
+ }
+
+ return Variant();
+}
+void CSGShapeSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) {
+
+ Transform gt = cs->get_global_transform();
+ gt.orthonormalize();
+ Transform gi = gt.affine_inverse();
+
+ Vector3 ray_from = p_camera->project_ray_origin(p_point);
+ Vector3 ray_dir = p_camera->project_ray_normal(p_point);
+
+ Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 16384) };
+
+ if (Object::cast_to<CSGSphere>(cs)) {
+
+ CSGSphere *s = Object::cast_to<CSGSphere>(cs);
+
+ Vector3 ra, rb;
+ Geometry::get_closest_points_between_segments(Vector3(), Vector3(4096, 0, 0), sg[0], sg[1], ra, rb);
+ float d = ra.x;
+ if (d < 0.001)
+ d = 0.001;
+
+ s->set_radius(d);
+ }
+
+ if (Object::cast_to<CSGBox>(cs)) {
+
+ CSGBox *s = Object::cast_to<CSGBox>(cs);
+
+ Vector3 axis;
+ axis[p_idx] = 1.0;
+ Vector3 ra, rb;
+ Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
+ float d = ra[p_idx];
+ if (d < 0.001)
+ d = 0.001;
+
+ switch (p_idx) {
+ case 0: s->set_width(d); break;
+ case 1: s->set_height(d); break;
+ case 2: s->set_depth(d); break;
+ }
+ }
+
+ if (Object::cast_to<CSGCylinder>(cs)) {
+
+ CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
+
+ Vector3 axis;
+ axis[p_idx == 0 ? 0 : 1] = 1.0;
+ Vector3 ra, rb;
+ Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
+ float d = axis.dot(ra);
+
+ if (d < 0.001)
+ d = 0.001;
+
+ if (p_idx == 0)
+ s->set_radius(d);
+ else if (p_idx == 1)
+ s->set_height(d * 2.0);
+ }
+
+ if (Object::cast_to<CSGTorus>(cs)) {
+
+ CSGTorus *s = Object::cast_to<CSGTorus>(cs);
+
+ Vector3 axis;
+ axis[0] = 1.0;
+ Vector3 ra, rb;
+ Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
+ float d = axis.dot(ra);
+
+ if (d < 0.001)
+ d = 0.001;
+
+ if (p_idx == 0)
+ s->set_inner_radius(d);
+ else if (p_idx == 1)
+ s->set_outer_radius(d);
+ }
+}
+void CSGShapeSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
+
+ if (Object::cast_to<CSGSphere>(cs)) {
+ CSGSphere *s = Object::cast_to<CSGSphere>(cs);
+ if (p_cancel) {
+ s->set_radius(p_restore);
+ return;
+ }
+
+ UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
+ ur->create_action(TTR("Change Sphere Shape Radius"));
+ ur->add_do_method(s, "set_radius", s->get_radius());
+ ur->add_undo_method(s, "set_radius", p_restore);
+ ur->commit_action();
+ }
+
+ if (Object::cast_to<CSGBox>(cs)) {
+ CSGBox *s = Object::cast_to<CSGBox>(cs);
+ if (p_cancel) {
+ switch (p_idx) {
+ case 0: s->set_width(p_restore); break;
+ case 1: s->set_height(p_restore); break;
+ case 2: s->set_depth(p_restore); break;
+ }
+ return;
+ }
+
+ UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
+ ur->create_action(TTR("Change Box Shape Extents"));
+ static const char *method[3] = { "set_width", "set_height", "set_depth" };
+ float current;
+ switch (p_idx) {
+ case 0: current = s->get_width(); break;
+ case 1: current = s->get_height(); break;
+ case 2: current = s->get_depth(); break;
+ }
+
+ ur->add_do_method(s, method[p_idx], current);
+ ur->add_undo_method(s, method[p_idx], p_restore);
+ ur->commit_action();
+ }
+
+ if (Object::cast_to<CSGCylinder>(cs)) {
+ CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
+ if (p_cancel) {
+ if (p_idx == 0)
+ s->set_radius(p_restore);
+ else
+ s->set_height(p_restore);
+ return;
+ }
+
+ UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
+ if (p_idx == 0) {
+ ur->create_action(TTR("Change Cylinder Radius"));
+ ur->add_do_method(s, "set_radius", s->get_radius());
+ ur->add_undo_method(s, "set_radius", p_restore);
+ } else {
+ ur->create_action(TTR("Change Cylinder Height"));
+ ur->add_do_method(s, "set_height", s->get_height());
+ ur->add_undo_method(s, "set_height", p_restore);
+ }
+
+ ur->commit_action();
+ }
+
+ if (Object::cast_to<CSGTorus>(cs)) {
+ CSGTorus *s = Object::cast_to<CSGTorus>(cs);
+ if (p_cancel) {
+ if (p_idx == 0)
+ s->set_inner_radius(p_restore);
+ else
+ s->set_outer_radius(p_restore);
+ return;
+ }
+
+ UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
+ if (p_idx == 0) {
+ ur->create_action(TTR("Change Torus Inner Radius"));
+ ur->add_do_method(s, "set_inner_radius", s->get_inner_radius());
+ ur->add_undo_method(s, "set_inner_radius", p_restore);
+ } else {
+ ur->create_action(TTR("Change Torus Outer Radius"));
+ ur->add_do_method(s, "set_outer_radius", s->get_outer_radius());
+ ur->add_undo_method(s, "set_outer_radius", p_restore);
+ }
+
+ ur->commit_action();
+ }
+}
+void CSGShapeSpatialGizmo::redraw() {
+
+ clear();
+
+ Color gizmo_color = EDITOR_GET("editors/3d_gizmos/gizmo_colors/csg");
+ Ref<Material> material = create_material("shape_material", gizmo_color);
+
+ PoolVector<Vector3> faces = cs->get_brush_faces();
+
+ Vector<Vector3> lines;
+ lines.resize(faces.size() * 2);
+ {
+ PoolVector<Vector3>::Read r = faces.read();
+
+ for (int i = 0; i < lines.size(); i += 6) {
+ int f = i / 6;
+ for (int j = 0; j < 3; j++) {
+ int j_n = (j + 1) % 3;
+ lines[i + j * 2 + 0] = r[f * 3 + j];
+ lines[i + j * 2 + 1] = r[f * 3 + j_n];
+ }
+ }
+ }
+
+ add_lines(lines, material);
+ add_collision_segments(lines);
+
+ if (Object::cast_to<CSGSphere>(cs)) {
+ CSGSphere *s = Object::cast_to<CSGSphere>(cs);
+
+ float r = s->get_radius();
+ Vector<Vector3> handles;
+ handles.push_back(Vector3(r, 0, 0));
+ add_handles(handles);
+ }
+
+ if (Object::cast_to<CSGBox>(cs)) {
+ CSGBox *s = Object::cast_to<CSGBox>(cs);
+
+ Vector<Vector3> handles;
+ handles.push_back(Vector3(s->get_width(), 0, 0));
+ handles.push_back(Vector3(0, s->get_height(), 0));
+ handles.push_back(Vector3(0, 0, s->get_depth()));
+ add_handles(handles);
+ }
+
+ if (Object::cast_to<CSGCylinder>(cs)) {
+ CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
+
+ Vector<Vector3> handles;
+ handles.push_back(Vector3(s->get_radius(), 0, 0));
+ handles.push_back(Vector3(0, s->get_height() * 0.5, 0));
+ add_handles(handles);
+ }
+
+ if (Object::cast_to<CSGTorus>(cs)) {
+ CSGTorus *s = Object::cast_to<CSGTorus>(cs);
+
+ Vector<Vector3> handles;
+ handles.push_back(Vector3(s->get_inner_radius(), 0, 0));
+ handles.push_back(Vector3(s->get_outer_radius(), 0, 0));
+ add_handles(handles);
+ }
+}
+CSGShapeSpatialGizmo::CSGShapeSpatialGizmo(CSGShape *p_cs) {
+
+ cs = p_cs;
+ set_spatial_node(p_cs);
+}
+
+Ref<SpatialEditorGizmo> EditorPluginCSG::create_spatial_gizmo(Spatial *p_spatial) {
+ if (Object::cast_to<CSGSphere>(p_spatial) || Object::cast_to<CSGBox>(p_spatial) || Object::cast_to<CSGCylinder>(p_spatial) || Object::cast_to<CSGTorus>(p_spatial) || Object::cast_to<CSGMesh>(p_spatial) || Object::cast_to<CSGPolygon>(p_spatial)) {
+ Ref<CSGShapeSpatialGizmo> csg = memnew(CSGShapeSpatialGizmo(Object::cast_to<CSGShape>(p_spatial)));
+ return csg;
+ }
+
+ return Ref<SpatialEditorGizmo>();
+}
+
+EditorPluginCSG::EditorPluginCSG(EditorNode *p_editor) {
+
+ EDITOR_DEF("editors/3d_gizmos/gizmo_colors/csg", Color(0.2, 0.5, 1, 0.1));
+}
diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h
new file mode 100644
index 0000000000..68e916823b
--- /dev/null
+++ b/modules/csg/csg_gizmos.h
@@ -0,0 +1,60 @@
+/*************************************************************************/
+/* csg_gizmos.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef CSG_GIZMOS_H
+#define CSG_GIZMOS_H
+
+#include "csg_shape.h"
+#include "editor/editor_plugin.h"
+#include "editor/spatial_editor_gizmos.h"
+
+class CSGShapeSpatialGizmo : public EditorSpatialGizmo {
+
+ GDCLASS(CSGShapeSpatialGizmo, EditorSpatialGizmo);
+
+ CSGShape *cs;
+
+public:
+ virtual String get_handle_name(int p_idx) const;
+ virtual Variant get_handle_value(int p_idx) const;
+ virtual void set_handle(int p_idx, Camera *p_camera, const Point2 &p_point);
+ virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
+ void redraw();
+ CSGShapeSpatialGizmo(CSGShape *p_cs = NULL);
+};
+
+class EditorPluginCSG : public EditorPlugin {
+ GDCLASS(EditorPluginCSG, EditorPlugin)
+public:
+ virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
+ EditorPluginCSG(EditorNode *p_editor);
+};
+
+#endif // CSG_GIZMOS_H
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
new file mode 100644
index 0000000000..5f13474d2c
--- /dev/null
+++ b/modules/csg/csg_shape.cpp
@@ -0,0 +1,2164 @@
+/*************************************************************************/
+/* csg_shape.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "csg_shape.h"
+#include "scene/3d/path.h"
+
+void CSGShape::set_use_collision(bool p_enable) {
+
+ if (use_collision == p_enable)
+ return;
+
+ use_collision = p_enable;
+
+ if (!is_inside_tree() || !is_root_shape())
+ return;
+
+ if (use_collision) {
+ root_collision_shape.instance();
+ root_collision_instance = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
+ PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
+ PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
+ PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
+ _make_dirty(); //force update
+ } else {
+ PhysicsServer::get_singleton()->free(root_collision_instance);
+ root_collision_instance = RID();
+ root_collision_shape.unref();
+ }
+}
+
+bool CSGShape::is_using_collision() const {
+ return use_collision;
+}
+
+bool CSGShape::is_root_shape() const {
+
+ return !parent;
+}
+
+void CSGShape::set_snap(float p_snap) {
+ snap = p_snap;
+}
+
+float CSGShape::get_snap() const {
+ return snap;
+}
+
+void CSGShape::_make_dirty() {
+
+ if (!is_inside_tree())
+ return;
+
+ if (dirty) {
+ return;
+ }
+
+ dirty = true;
+
+ if (parent) {
+ parent->_make_dirty();
+ } else {
+ //only parent will do
+ call_deferred("_update_shape");
+ }
+}
+
+CSGBrush *CSGShape::_get_brush() {
+
+ if (dirty) {
+ if (brush) {
+ memdelete(brush);
+ }
+ brush = NULL;
+
+ CSGBrush *n = _build_brush();
+
+ for (int i = 0; i < get_child_count(); i++) {
+
+ CSGShape *child = Object::cast_to<CSGShape>(get_child(i));
+ if (!child)
+ continue;
+ if (!child->is_visible_in_tree())
+ continue;
+
+ CSGBrush *n2 = child->_get_brush();
+ if (!n2)
+ continue;
+ if (!n) {
+ n = memnew(CSGBrush);
+
+ n->copy_from(*n2, child->get_transform());
+
+ } else {
+
+ CSGBrush *nn = memnew(CSGBrush);
+ CSGBrush *nn2 = memnew(CSGBrush);
+ nn2->copy_from(*n2, child->get_transform());
+
+ CSGBrushOperation bop;
+
+ switch (child->get_operation()) {
+ case CSGShape::OPERATION_UNION: bop.merge_brushes(CSGBrushOperation::OPERATION_UNION, *n, *nn2, *nn, snap); break;
+ case CSGShape::OPERATION_INTERSECTION: bop.merge_brushes(CSGBrushOperation::OPERATION_INTERSECTION, *n, *nn2, *nn, snap); break;
+ case CSGShape::OPERATION_SUBTRACTION: bop.merge_brushes(CSGBrushOperation::OPERATION_SUBSTRACTION, *n, *nn2, *nn, snap); break;
+ }
+ memdelete(n);
+ memdelete(nn2);
+ n = nn;
+ }
+ }
+
+ if (n) {
+ AABB aabb;
+ for (int i = 0; i < n->faces.size(); i++) {
+ for (int j = 0; j < 3; j++) {
+ if (i == 0 && j == 0)
+ aabb.position = n->faces[i].vertices[j];
+ else
+ aabb.expand_to(n->faces[i].vertices[j]);
+ }
+ }
+ node_aabb = aabb;
+ } else {
+ node_aabb = AABB();
+ }
+
+ brush = n;
+
+ dirty = false;
+ }
+
+ return brush;
+}
+
+void CSGShape::_update_shape() {
+
+ //print_line("updating shape for " + String(get_path()));
+
+ if (parent)
+ return;
+
+ set_base(RID());
+ root_mesh.unref(); //byebye root mesh
+
+ CSGBrush *n = _get_brush();
+ ERR_FAIL_COND(!n);
+
+ OAHashMap<Vector3, Vector3> vec_map;
+
+ Vector<int> face_count;
+ face_count.resize(n->materials.size() + 1);
+ for (int i = 0; i < face_count.size(); i++) {
+ face_count[i] = 0;
+ }
+
+ for (int i = 0; i < n->faces.size(); i++) {
+ int mat = n->faces[i].material;
+ ERR_CONTINUE(mat < -1 || mat >= face_count.size());
+ int idx = mat == -1 ? face_count.size() - 1 : mat;
+ if (n->faces[i].smooth) {
+
+ Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]);
+
+ for (int j = 0; j < 3; j++) {
+ Vector3 v = n->faces[i].vertices[j];
+ Vector3 add;
+ if (vec_map.lookup(v, add)) {
+ add += p.normal;
+ } else {
+ add = p.normal;
+ }
+ vec_map.set(v, add);
+ }
+ }
+
+ face_count[idx]++;
+ }
+
+ Vector<ShapeUpdateSurface> surfaces;
+
+ surfaces.resize(face_count.size());
+
+ //create arrays
+ for (int i = 0; i < surfaces.size(); i++) {
+
+ surfaces[i].vertices.resize(face_count[i] * 3);
+ surfaces[i].normals.resize(face_count[i] * 3);
+ surfaces[i].uvs.resize(face_count[i] * 3);
+ surfaces[i].last_added = 0;
+
+ if (i != surfaces.size() - 1) {
+ surfaces[i].material = n->materials[i];
+ }
+
+ surfaces[i].verticesw = surfaces[i].vertices.write();
+ surfaces[i].normalsw = surfaces[i].normals.write();
+ surfaces[i].uvsw = surfaces[i].uvs.write();
+ }
+
+ //fill arrays
+ PoolVector<Vector3> physics_faces;
+ bool fill_physics_faces = false;
+ if (root_collision_shape.is_valid()) {
+ physics_faces.resize(n->faces.size() * 3);
+ fill_physics_faces = true;
+ }
+
+ {
+ PoolVector<Vector3>::Write physicsw;
+
+ if (fill_physics_faces) {
+ physicsw = physics_faces.write();
+ }
+
+ for (int i = 0; i < n->faces.size(); i++) {
+
+ int order[3] = { 0, 1, 2 };
+
+ if (n->faces[i].invert) {
+ SWAP(order[1], order[2]);
+ }
+
+ if (fill_physics_faces) {
+ physicsw[i * 3 + 0] = n->faces[i].vertices[order[0]];
+ physicsw[i * 3 + 1] = n->faces[i].vertices[order[1]];
+ physicsw[i * 3 + 2] = n->faces[i].vertices[order[2]];
+ }
+
+ int mat = n->faces[i].material;
+ ERR_CONTINUE(mat < -1 || mat >= face_count.size());
+ int idx = mat == -1 ? face_count.size() - 1 : mat;
+
+ int last = surfaces[idx].last_added;
+
+ Plane p(n->faces[i].vertices[0], n->faces[i].vertices[1], n->faces[i].vertices[2]);
+
+ for (int j = 0; j < 3; j++) {
+
+ Vector3 v = n->faces[i].vertices[j];
+
+ Vector3 normal = p.normal;
+
+ if (n->faces[i].smooth && vec_map.lookup(v, normal)) {
+ normal.normalize();
+ }
+
+ if (n->faces[i].invert) {
+
+ normal = -normal;
+ }
+
+ surfaces[idx].verticesw[last + order[j]] = v;
+ surfaces[idx].uvsw[last + order[j]] = n->faces[i].uvs[j];
+ surfaces[idx].normalsw[last + order[j]] = normal;
+ }
+
+ surfaces[idx].last_added += 3;
+ }
+ }
+
+ root_mesh.instance();
+ //create surfaces
+
+ for (int i = 0; i < surfaces.size(); i++) {
+
+ surfaces[i].verticesw = PoolVector<Vector3>::Write();
+ surfaces[i].normalsw = PoolVector<Vector3>::Write();
+ surfaces[i].uvsw = PoolVector<Vector2>::Write();
+
+ if (surfaces[i].last_added == 0)
+ continue;
+
+ Array array;
+ array.resize(Mesh::ARRAY_MAX);
+
+ array[Mesh::ARRAY_VERTEX] = surfaces[i].vertices;
+ array[Mesh::ARRAY_NORMAL] = surfaces[i].normals;
+ array[Mesh::ARRAY_TEX_UV] = surfaces[i].uvs;
+
+ int idx = root_mesh->get_surface_count();
+ root_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, array);
+ root_mesh->surface_set_material(idx, surfaces[i].material);
+ }
+
+ if (root_collision_shape.is_valid()) {
+ root_collision_shape->set_faces(physics_faces);
+ }
+
+ set_base(root_mesh->get_rid());
+}
+AABB CSGShape::get_aabb() const {
+ return node_aabb;
+}
+
+PoolVector<Vector3> CSGShape::get_brush_faces() {
+ ERR_FAIL_COND_V(!is_inside_tree(), PoolVector<Vector3>());
+ CSGBrush *b = _get_brush();
+ if (!b) {
+ return PoolVector<Vector3>();
+ }
+
+ PoolVector<Vector3> faces;
+ int fc = b->faces.size();
+ faces.resize(fc * 3);
+ {
+ PoolVector<Vector3>::Write w = faces.write();
+ for (int i = 0; i < fc; i++) {
+ w[i * 3 + 0] = b->faces[i].vertices[0];
+ w[i * 3 + 1] = b->faces[i].vertices[1];
+ w[i * 3 + 2] = b->faces[i].vertices[2];
+ }
+ }
+
+ return faces;
+}
+
+PoolVector<Face3> CSGShape::get_faces(uint32_t p_usage_flags) const {
+
+ return PoolVector<Face3>();
+}
+
+void CSGShape::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+
+ Node *parentn = get_parent();
+ if (parentn) {
+ parent = Object::cast_to<CSGShape>(parentn);
+ if (parent) {
+ set_base(RID());
+ root_mesh.unref();
+ }
+ }
+
+ if (use_collision && is_root_shape()) {
+ root_collision_shape.instance();
+ root_collision_instance = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
+ PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
+ PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
+ PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
+ }
+
+ _make_dirty();
+ }
+
+ if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
+
+ //print_line("local xform changed");
+ if (parent) {
+ parent->_make_dirty();
+ }
+ }
+
+ if (p_what == NOTIFICATION_EXIT_TREE) {
+
+ if (parent)
+ parent->_make_dirty();
+ parent = NULL;
+
+ if (use_collision && is_root_shape()) {
+ PhysicsServer::get_singleton()->free(root_collision_instance);
+ root_collision_instance = RID();
+ root_collision_shape.unref();
+ }
+ _make_dirty();
+ }
+}
+
+void CSGShape::set_operation(Operation p_operation) {
+
+ operation = p_operation;
+ _make_dirty();
+}
+
+CSGShape::Operation CSGShape::get_operation() const {
+ return operation;
+}
+
+void CSGShape::_validate_property(PropertyInfo &property) const {
+ if (is_inside_tree() && property.name.begins_with("use_collision") && !is_root_shape()) {
+ //hide collision if not root
+ property.usage = PROPERTY_USAGE_NOEDITOR;
+ }
+}
+
+void CSGShape::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("_update_shape"), &CSGShape::_update_shape);
+ ClassDB::bind_method(D_METHOD("is_root_shape"), &CSGShape::is_root_shape);
+
+ ClassDB::bind_method(D_METHOD("set_operation", "operation"), &CSGShape::set_operation);
+ ClassDB::bind_method(D_METHOD("get_operation"), &CSGShape::get_operation);
+
+ ClassDB::bind_method(D_METHOD("set_use_collision", "operation"), &CSGShape::set_use_collision);
+ ClassDB::bind_method(D_METHOD("is_using_collision"), &CSGShape::is_using_collision);
+
+ ClassDB::bind_method(D_METHOD("set_snap", "snap"), &CSGShape::set_snap);
+ ClassDB::bind_method(D_METHOD("get_snap"), &CSGShape::get_snap);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "Union,Intersection,Subtraction"), "set_operation", "get_operation");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_collision"), "set_use_collision", "is_using_collision");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "snap", PROPERTY_HINT_RANGE, "0.0001,1,0.001"), "set_snap", "get_snap");
+
+ BIND_ENUM_CONSTANT(OPERATION_UNION);
+ BIND_ENUM_CONSTANT(OPERATION_INTERSECTION);
+ BIND_ENUM_CONSTANT(OPERATION_SUBTRACTION);
+}
+
+CSGShape::CSGShape() {
+ brush = NULL;
+ set_notify_local_transform(true);
+ dirty = false;
+ parent = NULL;
+ use_collision = false;
+ operation = OPERATION_UNION;
+ snap = 0.001;
+}
+
+CSGShape::~CSGShape() {
+ if (brush) {
+ memdelete(brush);
+ brush = NULL;
+ }
+}
+//////////////////////////////////
+
+CSGBrush *CSGCombiner::_build_brush() {
+
+ return NULL; //does not build anything
+}
+
+CSGCombiner::CSGCombiner() {
+}
+
+/////////////////////
+
+CSGBrush *CSGPrimitive::_create_brush_from_arrays(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uv, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials) {
+
+ CSGBrush *brush = memnew(CSGBrush);
+
+ PoolVector<bool> invert;
+ invert.resize(p_vertices.size() / 3);
+ {
+ int ic = invert.size();
+ PoolVector<bool>::Write w = invert.write();
+ for (int i = 0; i < ic; i++) {
+ w[i] = invert_faces;
+ }
+ }
+ brush->build_from_faces(p_vertices, p_uv, p_smooth, p_materials, invert);
+
+ return brush;
+}
+
+void CSGPrimitive::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_invert_faces", "invert_faces"), &CSGPrimitive::set_invert_faces);
+ ClassDB::bind_method(D_METHOD("is_inverting_faces"), &CSGPrimitive::is_inverting_faces);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "invert_faces"), "set_invert_faces", "is_inverting_faces");
+}
+
+void CSGPrimitive::set_invert_faces(bool p_invert) {
+ if (invert_faces == p_invert)
+ return;
+
+ invert_faces = p_invert;
+
+ _make_dirty();
+}
+
+bool CSGPrimitive::is_inverting_faces() {
+ return invert_faces;
+}
+
+CSGPrimitive::CSGPrimitive() {
+ invert_faces = false;
+}
+
+/////////////////////
+
+CSGBrush *CSGMesh::_build_brush() {
+
+ if (!mesh.is_valid())
+ return NULL;
+
+ PoolVector<Vector3> vertices;
+ PoolVector<bool> smooth;
+ PoolVector<Ref<Material> > materials;
+ PoolVector<Vector2> uvs;
+
+ for (int i = 0; i < mesh->get_surface_count(); i++) {
+
+ if (mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
+ continue;
+ }
+
+ Array arrays = mesh->surface_get_arrays(i);
+
+ PoolVector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX];
+ if (avertices.size() == 0)
+ continue;
+
+ PoolVector<Vector3>::Read vr = avertices.read();
+
+ PoolVector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL];
+ PoolVector<Vector3>::Read nr;
+ bool nr_used = false;
+ if (anormals.size()) {
+ nr = anormals.read();
+ nr_used = true;
+ }
+
+ PoolVector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV];
+ PoolVector<Vector2>::Read uvr;
+ bool uvr_used = false;
+ if (auvs.size()) {
+ uvr = auvs.read();
+ uvr_used = true;
+ }
+
+ Ref<Material> mat = mesh->surface_get_material(i);
+
+ PoolVector<int> aindices = arrays[Mesh::ARRAY_INDEX];
+ if (aindices.size()) {
+ int as = vertices.size();
+ int is = aindices.size();
+
+ vertices.resize(as + is);
+ smooth.resize((as + is) / 3);
+ materials.resize((as + is) / 3);
+ uvs.resize(as + is);
+
+ PoolVector<Vector3>::Write vw = vertices.write();
+ PoolVector<bool>::Write sw = smooth.write();
+ PoolVector<Vector2>::Write uvw = uvs.write();
+ PoolVector<Ref<Material> >::Write mw = materials.write();
+
+ PoolVector<int>::Read ir = aindices.read();
+
+ for (int j = 0; j < is; j += 3) {
+
+ Vector3 vertex[3];
+ Vector3 normal[3];
+ Vector2 uv[3];
+
+ for (int k = 0; k < 3; k++) {
+ int idx = ir[j + k];
+ vertex[k] = vr[idx];
+ if (nr_used) {
+ normal[k] = nr[idx];
+ }
+ if (uvr_used) {
+ uv[k] = uvr[idx];
+ }
+ }
+
+ bool flat = normal[0].distance_to(normal[1]) < CMP_EPSILON && normal[0].distance_to(normal[2]) < CMP_EPSILON;
+
+ vw[as + j + 0] = vertex[0];
+ vw[as + j + 1] = vertex[1];
+ vw[as + j + 2] = vertex[2];
+
+ uvw[as + j + 0] = uv[0];
+ uvw[as + j + 1] = uv[1];
+ uvw[as + j + 2] = uv[2];
+
+ sw[j / 3] = !flat;
+ mw[j / 3] = mat;
+ }
+ } else {
+ int is = vertices.size();
+ int as = avertices.size();
+
+ vertices.resize(as + is);
+ smooth.resize((as + is) / 3);
+ uvs.resize(as + is);
+ materials.resize((as + is) / 3);
+
+ PoolVector<Vector3>::Write vw = vertices.write();
+ PoolVector<bool>::Write sw = smooth.write();
+ PoolVector<Vector2>::Write uvw = uvs.write();
+ PoolVector<Ref<Material> >::Write mw = materials.write();
+
+ for (int j = 0; j < is; j += 3) {
+
+ Vector3 vertex[3];
+ Vector3 normal[3];
+ Vector2 uv[3];
+
+ for (int k = 0; k < 3; k++) {
+ vertex[k] = vr[j + k];
+ if (nr_used) {
+ normal[k] = nr[j + k];
+ }
+ if (uvr_used) {
+ uv[k] = uvr[j + k];
+ }
+ }
+
+ bool flat = normal[0].distance_to(normal[1]) < CMP_EPSILON && normal[0].distance_to(normal[2]) < CMP_EPSILON;
+
+ vw[as + j + 0] = vertex[0];
+ vw[as + j + 1] = vertex[1];
+ vw[as + j + 2] = vertex[2];
+
+ uvw[as + j + 0] = uv[0];
+ uvw[as + j + 1] = uv[1];
+ uvw[as + j + 2] = uv[2];
+
+ sw[j / 3] = !flat;
+ mw[j / 3] = mat;
+ }
+ }
+ }
+
+ //print_line("total vertices? " + itos(vertices.size()));
+ if (vertices.size() == 0)
+ return NULL;
+
+ return _create_brush_from_arrays(vertices, uvs, smooth, materials);
+}
+
+void CSGMesh::_mesh_changed() {
+ _make_dirty();
+ update_gizmo();
+}
+
+void CSGMesh::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &CSGMesh::set_mesh);
+ ClassDB::bind_method(D_METHOD("get_mesh"), &CSGMesh::get_mesh);
+
+ ClassDB::bind_method(D_METHOD("_mesh_changed"), &CSGMesh::_mesh_changed);
+
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
+}
+
+void CSGMesh::set_mesh(const Ref<Mesh> &p_mesh) {
+
+ if (mesh == p_mesh)
+ return;
+ if (mesh.is_valid()) {
+ mesh->disconnect("changed", this, "_mesh_changed");
+ }
+ mesh = p_mesh;
+
+ if (mesh.is_valid()) {
+ mesh->connect("changed", this, "_mesh_changed");
+ }
+
+ _make_dirty();
+}
+
+Ref<Mesh> CSGMesh::get_mesh() {
+ return mesh;
+}
+
+////////////////////////////////
+
+CSGBrush *CSGSphere::_build_brush() {
+
+ // set our bounding box
+
+ CSGBrush *brush = memnew(CSGBrush);
+
+ int face_count = rings * radial_segments * 2 - radial_segments * 2;
+
+ bool invert_val = is_inverting_faces();
+ Ref<Material> material = get_material();
+
+ PoolVector<Vector3> faces;
+ PoolVector<Vector2> uvs;
+ PoolVector<bool> smooth;
+ PoolVector<Ref<Material> > materials;
+ PoolVector<bool> invert;
+
+ faces.resize(face_count * 3);
+ uvs.resize(face_count * 3);
+
+ smooth.resize(face_count);
+ materials.resize(face_count);
+ invert.resize(face_count);
+
+ {
+
+ PoolVector<Vector3>::Write facesw = faces.write();
+ PoolVector<Vector2>::Write uvsw = uvs.write();
+ PoolVector<bool>::Write smoothw = smooth.write();
+ PoolVector<Ref<Material> >::Write materialsw = materials.write();
+ PoolVector<bool>::Write invertw = invert.write();
+
+ int face = 0;
+
+ for (int i = 1; i <= rings; i++) {
+ double lat0 = Math_PI * (-0.5 + (double)(i - 1) / rings);
+ double z0 = Math::sin(lat0);
+ double zr0 = Math::cos(lat0);
+ double u0 = double(i - 1) / rings;
+
+ double lat1 = Math_PI * (-0.5 + (double)i / rings);
+ double z1 = Math::sin(lat1);
+ double zr1 = Math::cos(lat1);
+ double u1 = double(i) / rings;
+
+ for (int j = radial_segments; j >= 1; j--) {
+
+ double lng0 = 2 * Math_PI * (double)(j - 1) / radial_segments;
+ double x0 = Math::cos(lng0);
+ double y0 = Math::sin(lng0);
+ double v0 = double(i - 1) / radial_segments;
+
+ double lng1 = 2 * Math_PI * (double)(j) / radial_segments;
+ double x1 = Math::cos(lng1);
+ double y1 = Math::sin(lng1);
+ double v1 = double(i) / radial_segments;
+
+ Vector3 v[4] = {
+ Vector3(x1 * zr0, z0, y1 * zr0) * radius,
+ Vector3(x1 * zr1, z1, y1 * zr1) * radius,
+ Vector3(x0 * zr1, z1, y0 * zr1) * radius,
+ Vector3(x0 * zr0, z0, y0 * zr0) * radius
+ };
+
+ Vector2 u[4] = {
+ Vector2(v1, u0),
+ Vector2(v1, u1),
+ Vector2(v0, u1),
+ Vector2(v0, u0),
+
+ };
+
+ if (i < rings) {
+
+ //face 1
+ facesw[face * 3 + 0] = v[0];
+ facesw[face * 3 + 1] = v[1];
+ facesw[face * 3 + 2] = v[2];
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[1];
+ uvsw[face * 3 + 2] = u[2];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ }
+
+ if (i > 1) {
+ //face 2
+ facesw[face * 3 + 0] = v[2];
+ facesw[face * 3 + 1] = v[3];
+ facesw[face * 3 + 2] = v[0];
+
+ uvsw[face * 3 + 0] = u[2];
+ uvsw[face * 3 + 1] = u[3];
+ uvsw[face * 3 + 2] = u[0];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ }
+ }
+ }
+
+ if (face != face_count) {
+ ERR_PRINT("Face mismatch bug! fix code");
+ }
+ }
+
+ brush->build_from_faces(faces, uvs, smooth, materials, invert);
+
+ return brush;
+}
+
+void CSGSphere::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CSGSphere::set_radius);
+ ClassDB::bind_method(D_METHOD("get_radius"), &CSGSphere::get_radius);
+
+ ClassDB::bind_method(D_METHOD("set_radial_segments", "radial_segments"), &CSGSphere::set_radial_segments);
+ ClassDB::bind_method(D_METHOD("get_radial_segments"), &CSGSphere::get_radial_segments);
+ ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CSGSphere::set_rings);
+ ClassDB::bind_method(D_METHOD("get_rings"), &CSGSphere::get_rings);
+
+ ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGSphere::set_smooth_faces);
+ ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGSphere::get_smooth_faces);
+
+ ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGSphere::set_material);
+ ClassDB::bind_method(D_METHOD("get_material"), &CSGSphere::get_material);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+}
+
+void CSGSphere::set_radius(const float p_radius) {
+ ERR_FAIL_COND(p_radius <= 0);
+ radius = p_radius;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGSphere::get_radius() const {
+ return radius;
+}
+
+void CSGSphere::set_radial_segments(const int p_radial_segments) {
+ radial_segments = p_radial_segments > 4 ? p_radial_segments : 4;
+ _make_dirty();
+ update_gizmo();
+}
+
+int CSGSphere::get_radial_segments() const {
+ return radial_segments;
+}
+
+void CSGSphere::set_rings(const int p_rings) {
+ rings = p_rings > 1 ? p_rings : 1;
+ _make_dirty();
+ update_gizmo();
+}
+
+int CSGSphere::get_rings() const {
+ return rings;
+}
+
+void CSGSphere::set_smooth_faces(const bool p_smooth_faces) {
+ smooth_faces = p_smooth_faces;
+ _make_dirty();
+}
+
+bool CSGSphere::get_smooth_faces() const {
+ return smooth_faces;
+}
+
+void CSGSphere::set_material(const Ref<Material> &p_material) {
+
+ material = p_material;
+ _make_dirty();
+}
+
+Ref<Material> CSGSphere::get_material() const {
+
+ return material;
+}
+
+CSGSphere::CSGSphere() {
+ // defaults
+ radius = 1.0;
+ radial_segments = 12;
+ rings = 6;
+ smooth_faces = true;
+}
+
+///////////////
+
+CSGBrush *CSGBox::_build_brush() {
+
+ // set our bounding box
+
+ CSGBrush *brush = memnew(CSGBrush);
+
+ int face_count = 12; //it's a cube..
+
+ bool invert_val = is_inverting_faces();
+ Ref<Material> material = get_material();
+
+ PoolVector<Vector3> faces;
+ PoolVector<Vector2> uvs;
+ PoolVector<bool> smooth;
+ PoolVector<Ref<Material> > materials;
+ PoolVector<bool> invert;
+
+ faces.resize(face_count * 3);
+ uvs.resize(face_count * 3);
+
+ smooth.resize(face_count);
+ materials.resize(face_count);
+ invert.resize(face_count);
+
+ {
+
+ PoolVector<Vector3>::Write facesw = faces.write();
+ PoolVector<Vector2>::Write uvsw = uvs.write();
+ PoolVector<bool>::Write smoothw = smooth.write();
+ PoolVector<Ref<Material> >::Write materialsw = materials.write();
+ PoolVector<bool>::Write invertw = invert.write();
+
+ int face = 0;
+
+ Vector3 vertex_mul(width, height, depth);
+
+ {
+
+ for (int i = 0; i < 6; i++) {
+
+ Vector3 face_points[4];
+ float uv_points[8] = { 0, 0, 0, 1, 1, 1, 1, 0 };
+
+ for (int j = 0; j < 4; j++) {
+
+ float v[3];
+ v[0] = 1.0;
+ v[1] = 1 - 2 * ((j >> 1) & 1);
+ v[2] = v[1] * (1 - 2 * (j & 1));
+
+ for (int k = 0; k < 3; k++) {
+
+ if (i < 3)
+ face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ else
+ face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ }
+ }
+
+ Vector2 u[4];
+ for (int j = 0; j < 4; j++) {
+ u[j] = Vector2(uv_points[j * 2 + 0], uv_points[j * 2 + 1]);
+ }
+
+ //face 1
+ facesw[face * 3 + 0] = face_points[0] * vertex_mul;
+ facesw[face * 3 + 1] = face_points[1] * vertex_mul;
+ facesw[face * 3 + 2] = face_points[2] * vertex_mul;
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[1];
+ uvsw[face * 3 + 2] = u[2];
+
+ smoothw[face] = false;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ //face 1
+ facesw[face * 3 + 0] = face_points[2] * vertex_mul;
+ facesw[face * 3 + 1] = face_points[3] * vertex_mul;
+ facesw[face * 3 + 2] = face_points[0] * vertex_mul;
+
+ uvsw[face * 3 + 0] = u[2];
+ uvsw[face * 3 + 1] = u[3];
+ uvsw[face * 3 + 2] = u[0];
+
+ smoothw[face] = false;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ }
+ }
+
+ if (face != face_count) {
+ ERR_PRINT("Face mismatch bug! fix code");
+ }
+ }
+
+ brush->build_from_faces(faces, uvs, smooth, materials, invert);
+
+ return brush;
+}
+
+void CSGBox::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_width", "width"), &CSGBox::set_width);
+ ClassDB::bind_method(D_METHOD("get_width"), &CSGBox::get_width);
+
+ ClassDB::bind_method(D_METHOD("set_height", "height"), &CSGBox::set_height);
+ ClassDB::bind_method(D_METHOD("get_height"), &CSGBox::get_height);
+
+ ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CSGBox::set_depth);
+ ClassDB::bind_method(D_METHOD("get_depth"), &CSGBox::get_depth);
+
+ ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGBox::set_material);
+ ClassDB::bind_method(D_METHOD("get_material"), &CSGBox::get_material);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "width", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_width", "get_width");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+}
+
+void CSGBox::set_width(const float p_width) {
+ width = p_width;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGBox::get_width() const {
+ return width;
+}
+
+void CSGBox::set_height(const float p_height) {
+ height = p_height;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGBox::get_height() const {
+ return height;
+}
+
+void CSGBox::set_depth(const float p_depth) {
+ depth = p_depth;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGBox::get_depth() const {
+ return depth;
+}
+
+void CSGBox::set_material(const Ref<Material> &p_material) {
+
+ material = p_material;
+ _make_dirty();
+ update_gizmo();
+}
+
+Ref<Material> CSGBox::get_material() const {
+
+ return material;
+}
+
+CSGBox::CSGBox() {
+ // defaults
+ width = 1.0;
+ height = 1.0;
+ depth = 1.0;
+}
+
+///////////////
+
+CSGBrush *CSGCylinder::_build_brush() {
+
+ // set our bounding box
+
+ CSGBrush *brush = memnew(CSGBrush);
+
+ int face_count = sides * (cone ? 1 : 2) + sides + (cone ? 0 : sides);
+
+ bool invert_val = is_inverting_faces();
+ Ref<Material> material = get_material();
+
+ PoolVector<Vector3> faces;
+ PoolVector<Vector2> uvs;
+ PoolVector<bool> smooth;
+ PoolVector<Ref<Material> > materials;
+ PoolVector<bool> invert;
+
+ faces.resize(face_count * 3);
+ uvs.resize(face_count * 3);
+
+ smooth.resize(face_count);
+ materials.resize(face_count);
+ invert.resize(face_count);
+
+ {
+
+ PoolVector<Vector3>::Write facesw = faces.write();
+ PoolVector<Vector2>::Write uvsw = uvs.write();
+ PoolVector<bool>::Write smoothw = smooth.write();
+ PoolVector<Ref<Material> >::Write materialsw = materials.write();
+ PoolVector<bool>::Write invertw = invert.write();
+
+ int face = 0;
+
+ Vector3 vertex_mul(radius, height * 0.5, radius);
+
+ {
+
+ for (int i = 0; i < sides; i++) {
+
+ float inc = float(i) / sides;
+ float inc_n = float((i + 1)) / sides;
+
+ float ang = inc * Math_PI * 2.0;
+ float ang_n = inc_n * Math_PI * 2.0;
+
+ Vector3 base(Math::cos(ang), 0, Math::sin(ang));
+ Vector3 base_n(Math::cos(ang_n), 0, Math::sin(ang_n));
+
+ Vector3 face_points[4] = {
+ base + Vector3(0, -1, 0),
+ base_n + Vector3(0, -1, 0),
+ base_n * (cone ? 0.0 : 1.0) + Vector3(0, 1, 0),
+ base * (cone ? 0.0 : 1.0) + Vector3(0, 1, 0),
+ };
+
+ Vector2 u[4] = {
+ Vector2(inc, 0),
+ Vector2(inc_n, 0),
+ Vector2(inc_n, 1),
+ Vector2(inc, 1),
+ };
+
+ //side face 1
+ facesw[face * 3 + 0] = face_points[0] * vertex_mul;
+ facesw[face * 3 + 1] = face_points[1] * vertex_mul;
+ facesw[face * 3 + 2] = face_points[2] * vertex_mul;
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[1];
+ uvsw[face * 3 + 2] = u[2];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+
+ if (!cone) {
+ //side face 2
+ facesw[face * 3 + 0] = face_points[2] * vertex_mul;
+ facesw[face * 3 + 1] = face_points[3] * vertex_mul;
+ facesw[face * 3 + 2] = face_points[0] * vertex_mul;
+
+ uvsw[face * 3 + 0] = u[2];
+ uvsw[face * 3 + 1] = u[3];
+ uvsw[face * 3 + 2] = u[0];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+ face++;
+ }
+
+ //bottom face 1
+ facesw[face * 3 + 0] = face_points[1] * vertex_mul;
+ facesw[face * 3 + 1] = face_points[0] * vertex_mul;
+ facesw[face * 3 + 2] = Vector3(0, -1, 0) * vertex_mul;
+
+ uvsw[face * 3 + 0] = Vector2(face_points[1].x, face_points[1].y) * 0.5 + Vector2(0.5, 0.5);
+ uvsw[face * 3 + 1] = Vector2(face_points[0].x, face_points[0].y) * 0.5 + Vector2(0.5, 0.5);
+ uvsw[face * 3 + 2] = Vector2(0.5, 0.5);
+
+ smoothw[face] = false;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+ face++;
+
+ if (!cone) {
+ //top face 1
+ facesw[face * 3 + 0] = face_points[3] * vertex_mul;
+ facesw[face * 3 + 1] = face_points[2] * vertex_mul;
+ facesw[face * 3 + 2] = Vector3(0, 1, 0) * vertex_mul;
+
+ uvsw[face * 3 + 0] = Vector2(face_points[1].x, face_points[1].y) * 0.5 + Vector2(0.5, 0.5);
+ uvsw[face * 3 + 1] = Vector2(face_points[0].x, face_points[0].y) * 0.5 + Vector2(0.5, 0.5);
+ uvsw[face * 3 + 2] = Vector2(0.5, 0.5);
+
+ smoothw[face] = false;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+ face++;
+ }
+ }
+ }
+
+ if (face != face_count) {
+ ERR_PRINT("Face mismatch bug! fix code");
+ }
+ }
+
+ brush->build_from_faces(faces, uvs, smooth, materials, invert);
+
+ return brush;
+}
+
+void CSGCylinder::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CSGCylinder::set_radius);
+ ClassDB::bind_method(D_METHOD("get_radius"), &CSGCylinder::get_radius);
+
+ ClassDB::bind_method(D_METHOD("set_height", "height"), &CSGCylinder::set_height);
+ ClassDB::bind_method(D_METHOD("get_height"), &CSGCylinder::get_height);
+
+ ClassDB::bind_method(D_METHOD("set_sides", "sides"), &CSGCylinder::set_sides);
+ ClassDB::bind_method(D_METHOD("get_sides"), &CSGCylinder::get_sides);
+
+ ClassDB::bind_method(D_METHOD("set_cone", "cone"), &CSGCylinder::set_cone);
+ ClassDB::bind_method(D_METHOD("is_cone"), &CSGCylinder::is_cone);
+
+ ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGCylinder::set_material);
+ ClassDB::bind_method(D_METHOD("get_material"), &CSGCylinder::get_material);
+
+ ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGCylinder::set_smooth_faces);
+ ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGCylinder::get_smooth_faces);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cone"), "set_cone", "is_cone");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+}
+
+void CSGCylinder::set_radius(const float p_radius) {
+ radius = p_radius;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGCylinder::get_radius() const {
+ return radius;
+}
+
+void CSGCylinder::set_height(const float p_height) {
+ height = p_height;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGCylinder::get_height() const {
+ return height;
+}
+
+void CSGCylinder::set_sides(const int p_sides) {
+ ERR_FAIL_COND(p_sides < 3);
+ sides = p_sides;
+ _make_dirty();
+ update_gizmo();
+}
+
+int CSGCylinder::get_sides() const {
+ return sides;
+}
+
+void CSGCylinder::set_cone(const bool p_cone) {
+ cone = p_cone;
+ _make_dirty();
+ update_gizmo();
+}
+
+bool CSGCylinder::is_cone() const {
+ return cone;
+}
+
+void CSGCylinder::set_smooth_faces(const bool p_smooth_faces) {
+ smooth_faces = p_smooth_faces;
+ _make_dirty();
+}
+
+bool CSGCylinder::get_smooth_faces() const {
+ return smooth_faces;
+}
+
+void CSGCylinder::set_material(const Ref<Material> &p_material) {
+
+ material = p_material;
+ _make_dirty();
+}
+
+Ref<Material> CSGCylinder::get_material() const {
+
+ return material;
+}
+
+CSGCylinder::CSGCylinder() {
+ // defaults
+ radius = 1.0;
+ height = 1.0;
+ sides = 8;
+ cone = false;
+ smooth_faces = true;
+}
+
+///////////////
+
+CSGBrush *CSGTorus::_build_brush() {
+
+ // set our bounding box
+
+ float min_radius = inner_radius;
+ float max_radius = outer_radius;
+
+ if (min_radius == max_radius)
+ return NULL; //sorry, can't
+
+ if (min_radius > max_radius) {
+ SWAP(min_radius, max_radius);
+ }
+
+ float radius = (max_radius - min_radius) * 0.5;
+
+ CSGBrush *brush = memnew(CSGBrush);
+
+ int face_count = ring_sides * sides * 2;
+
+ bool invert_val = is_inverting_faces();
+ Ref<Material> material = get_material();
+
+ PoolVector<Vector3> faces;
+ PoolVector<Vector2> uvs;
+ PoolVector<bool> smooth;
+ PoolVector<Ref<Material> > materials;
+ PoolVector<bool> invert;
+
+ faces.resize(face_count * 3);
+ uvs.resize(face_count * 3);
+
+ smooth.resize(face_count);
+ materials.resize(face_count);
+ invert.resize(face_count);
+
+ {
+
+ PoolVector<Vector3>::Write facesw = faces.write();
+ PoolVector<Vector2>::Write uvsw = uvs.write();
+ PoolVector<bool>::Write smoothw = smooth.write();
+ PoolVector<Ref<Material> >::Write materialsw = materials.write();
+ PoolVector<bool>::Write invertw = invert.write();
+
+ int face = 0;
+
+ {
+
+ for (int i = 0; i < sides; i++) {
+
+ float inci = float(i) / sides;
+ float inci_n = float((i + 1)) / sides;
+
+ float angi = inci * Math_PI * 2.0;
+ float angi_n = inci_n * Math_PI * 2.0;
+
+ Vector3 normali = Vector3(Math::cos(angi), 0, Math::sin(angi));
+ Vector3 normali_n = Vector3(Math::cos(angi_n), 0, Math::sin(angi_n));
+
+ for (int j = 0; j < ring_sides; j++) {
+
+ float incj = float(j) / ring_sides;
+ float incj_n = float((j + 1)) / ring_sides;
+
+ float angj = incj * Math_PI * 2.0;
+ float angj_n = incj_n * Math_PI * 2.0;
+
+ Vector2 normalj = Vector2(Math::cos(angj), Math::sin(angj)) * radius + Vector2(min_radius + radius, 0);
+ Vector2 normalj_n = Vector2(Math::cos(angj_n), Math::sin(angj_n)) * radius + Vector2(min_radius + radius, 0);
+
+ Vector3 face_points[4] = {
+ Vector3(normali.x * normalj.x, normalj.y, normali.z * normalj.x),
+ Vector3(normali.x * normalj_n.x, normalj_n.y, normali.z * normalj_n.x),
+ Vector3(normali_n.x * normalj_n.x, normalj_n.y, normali_n.z * normalj_n.x),
+ Vector3(normali_n.x * normalj.x, normalj.y, normali_n.z * normalj.x)
+ };
+
+ Vector2 u[4] = {
+ Vector2(inci, incj),
+ Vector2(inci, incj_n),
+ Vector2(inci_n, incj_n),
+ Vector2(inci_n, incj),
+ };
+
+ // face 1
+ facesw[face * 3 + 0] = face_points[0];
+ facesw[face * 3 + 1] = face_points[2];
+ facesw[face * 3 + 2] = face_points[1];
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[2];
+ uvsw[face * 3 + 2] = u[1];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+
+ //face 2
+ facesw[face * 3 + 0] = face_points[3];
+ facesw[face * 3 + 1] = face_points[2];
+ facesw[face * 3 + 2] = face_points[0];
+
+ uvsw[face * 3 + 0] = u[3];
+ uvsw[face * 3 + 1] = u[2];
+ uvsw[face * 3 + 2] = u[0];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+ face++;
+ }
+ }
+ }
+
+ if (face != face_count) {
+ ERR_PRINT("Face mismatch bug! fix code");
+ }
+ }
+
+ brush->build_from_faces(faces, uvs, smooth, materials, invert);
+
+ return brush;
+}
+
+void CSGTorus::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_inner_radius", "radius"), &CSGTorus::set_inner_radius);
+ ClassDB::bind_method(D_METHOD("get_inner_radius"), &CSGTorus::get_inner_radius);
+
+ ClassDB::bind_method(D_METHOD("set_outer_radius", "radius"), &CSGTorus::set_outer_radius);
+ ClassDB::bind_method(D_METHOD("get_outer_radius"), &CSGTorus::get_outer_radius);
+
+ ClassDB::bind_method(D_METHOD("set_sides", "sides"), &CSGTorus::set_sides);
+ ClassDB::bind_method(D_METHOD("get_sides"), &CSGTorus::get_sides);
+
+ ClassDB::bind_method(D_METHOD("set_ring_sides", "sides"), &CSGTorus::set_ring_sides);
+ ClassDB::bind_method(D_METHOD("get_ring_sides"), &CSGTorus::get_ring_sides);
+
+ ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGTorus::set_material);
+ ClassDB::bind_method(D_METHOD("get_material"), &CSGTorus::get_material);
+
+ ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGTorus::set_smooth_faces);
+ ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGTorus::get_smooth_faces);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "inner_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_inner_radius", "get_inner_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "outer_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_outer_radius", "get_outer_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "ring_sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_ring_sides", "get_ring_sides");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+}
+
+void CSGTorus::set_inner_radius(const float p_inner_radius) {
+ inner_radius = p_inner_radius;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGTorus::get_inner_radius() const {
+ return inner_radius;
+}
+
+void CSGTorus::set_outer_radius(const float p_outer_radius) {
+ outer_radius = p_outer_radius;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGTorus::get_outer_radius() const {
+ return outer_radius;
+}
+
+void CSGTorus::set_sides(const int p_sides) {
+ ERR_FAIL_COND(p_sides < 3);
+ sides = p_sides;
+ _make_dirty();
+ update_gizmo();
+}
+
+int CSGTorus::get_sides() const {
+ return sides;
+}
+
+void CSGTorus::set_ring_sides(const int p_ring_sides) {
+ ERR_FAIL_COND(p_ring_sides < 3);
+ ring_sides = p_ring_sides;
+ _make_dirty();
+ update_gizmo();
+}
+
+int CSGTorus::get_ring_sides() const {
+ return ring_sides;
+}
+
+void CSGTorus::set_smooth_faces(const bool p_smooth_faces) {
+ smooth_faces = p_smooth_faces;
+ _make_dirty();
+}
+
+bool CSGTorus::get_smooth_faces() const {
+ return smooth_faces;
+}
+
+void CSGTorus::set_material(const Ref<Material> &p_material) {
+
+ material = p_material;
+ _make_dirty();
+}
+
+Ref<Material> CSGTorus::get_material() const {
+
+ return material;
+}
+
+CSGTorus::CSGTorus() {
+ // defaults
+ inner_radius = 2.0;
+ outer_radius = 3.0;
+ sides = 8;
+ ring_sides = 6;
+ smooth_faces = true;
+}
+
+///////////////
+
+CSGBrush *CSGPolygon::_build_brush() {
+
+ // set our bounding box
+
+ if (polygon.size() < 3)
+ return NULL;
+
+ Vector<Point2> final_polygon = polygon;
+
+ if (Triangulate::get_area(final_polygon) > 0) {
+ final_polygon.invert();
+ }
+
+ Vector<int> triangles = Geometry::triangulate_polygon(final_polygon);
+
+ if (triangles.size() < 3)
+ return NULL;
+
+ Path *path = NULL;
+ Ref<Curve3D> curve;
+
+ if (mode == MODE_PATH) {
+ if (!has_node(path_node))
+ return NULL;
+ Node *n = get_node(path_node);
+ if (!n)
+ return NULL;
+ path = Object::cast_to<Path>(n);
+ if (!path)
+ return NULL;
+
+ if (path != path_cache) {
+ if (path_cache) {
+ path_cache->disconnect("tree_exited", this, "_path_exited");
+ path_cache->disconnect("curve_changed", this, "_path_changed");
+ path_cache = NULL;
+ }
+
+ path_cache = path;
+
+ if (path_cache) {
+ path_cache->connect("tree_exited", this, "_path_exited");
+ path_cache->connect("curve_changed", this, "_path_changed");
+ path_cache = NULL;
+ }
+ }
+ curve = path->get_curve();
+ if (curve.is_null())
+ return NULL;
+ if (curve->get_baked_length() <= 0)
+ return NULL;
+ }
+ CSGBrush *brush = memnew(CSGBrush);
+
+ int face_count;
+
+ switch (mode) {
+ case MODE_DEPTH: face_count = triangles.size() * 2 / 3 + (final_polygon.size()) * 2; break;
+ case MODE_SPIN: face_count = (spin_degrees < 360 ? triangles.size() * 2 / 3 : 0) + (final_polygon.size()) * 2 * spin_sides; break;
+ case MODE_PATH: {
+ float bl = curve->get_baked_length();
+ int splits = MAX(2, Math::ceil(bl / path_interval));
+ face_count = triangles.size() * 2 / 3 + splits * final_polygon.size() * 2;
+ } break;
+ }
+
+ bool invert_val = is_inverting_faces();
+ Ref<Material> material = get_material();
+
+ PoolVector<Vector3> faces;
+ PoolVector<Vector2> uvs;
+ PoolVector<bool> smooth;
+ PoolVector<Ref<Material> > materials;
+ PoolVector<bool> invert;
+
+ faces.resize(face_count * 3);
+ uvs.resize(face_count * 3);
+
+ smooth.resize(face_count);
+ materials.resize(face_count);
+ invert.resize(face_count);
+
+ AABB aabb; //must be computed
+ {
+
+ PoolVector<Vector3>::Write facesw = faces.write();
+ PoolVector<Vector2>::Write uvsw = uvs.write();
+ PoolVector<bool>::Write smoothw = smooth.write();
+ PoolVector<Ref<Material> >::Write materialsw = materials.write();
+ PoolVector<bool>::Write invertw = invert.write();
+
+ int face = 0;
+
+ switch (mode) {
+ case MODE_DEPTH: {
+
+ //add triangles, front and back
+ for (int i = 0; i < 2; i++) {
+
+ for (int j = 0; j < triangles.size(); j += 3) {
+ for (int k = 0; k < 3; k++) {
+ int src[3] = { 0, i == 0 ? 1 : 2, i == 0 ? 2 : 1 };
+ Vector2 p = final_polygon[triangles[j + src[k]]];
+ Vector3 v = Vector3(p.x, p.y, 0);
+ if (i == 0) {
+ v.z -= depth;
+ }
+ facesw[face * 3 + k] = v;
+ }
+
+ smoothw[face] = false;
+ materialsw[face] = material;
+ invertw[face] = invert_val;
+ face++;
+ }
+ }
+
+ //add triangles for depth
+ for (int i = 0; i < final_polygon.size(); i++) {
+
+ int i_n = (i + 1) % final_polygon.size();
+
+ Vector3 v[4] = {
+ Vector3(final_polygon[i].x, final_polygon[i].y, -depth),
+ Vector3(final_polygon[i_n].x, final_polygon[i_n].y, -depth),
+ Vector3(final_polygon[i_n].x, final_polygon[i_n].y, 0),
+ Vector3(final_polygon[i].x, final_polygon[i].y, 0),
+ };
+
+ Vector2 u[4] = {
+ Vector2(0, 0),
+ Vector2(0, 1),
+ Vector2(1, 1),
+ Vector2(1, 0)
+ };
+
+ // face 1
+ facesw[face * 3 + 0] = v[0];
+ facesw[face * 3 + 1] = v[1];
+ facesw[face * 3 + 2] = v[2];
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[1];
+ uvsw[face * 3 + 2] = u[2];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+
+ // face 2
+ facesw[face * 3 + 0] = v[2];
+ facesw[face * 3 + 1] = v[3];
+ facesw[face * 3 + 2] = v[0];
+
+ uvsw[face * 3 + 0] = u[2];
+ uvsw[face * 3 + 1] = u[3];
+ uvsw[face * 3 + 2] = u[0];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ }
+
+ } break;
+ case MODE_SPIN: {
+
+ for (int i = 0; i < spin_sides; i++) {
+
+ float inci = float(i) / spin_sides;
+ float inci_n = float((i + 1)) / spin_sides;
+
+ float angi = -(inci * spin_degrees / 360.0) * Math_PI * 2.0;
+ float angi_n = -(inci_n * spin_degrees / 360.0) * Math_PI * 2.0;
+
+ Vector3 normali = Vector3(Math::cos(angi), 0, Math::sin(angi));
+ Vector3 normali_n = Vector3(Math::cos(angi_n), 0, Math::sin(angi_n));
+
+ //add triangles for depth
+ for (int j = 0; j < final_polygon.size(); j++) {
+
+ int j_n = (j + 1) % final_polygon.size();
+
+ Vector3 v[4] = {
+ Vector3(normali.x * final_polygon[j].x, final_polygon[j].y, normali.z * final_polygon[j].x),
+ Vector3(normali.x * final_polygon[j_n].x, final_polygon[j_n].y, normali.z * final_polygon[j_n].x),
+ Vector3(normali_n.x * final_polygon[j_n].x, final_polygon[j_n].y, normali_n.z * final_polygon[j_n].x),
+ Vector3(normali_n.x * final_polygon[j].x, final_polygon[j].y, normali_n.z * final_polygon[j].x),
+ };
+
+ Vector2 u[4] = {
+ Vector2(0, 0),
+ Vector2(0, 1),
+ Vector2(1, 1),
+ Vector2(1, 0)
+ };
+
+ // face 1
+ facesw[face * 3 + 0] = v[0];
+ facesw[face * 3 + 1] = v[2];
+ facesw[face * 3 + 2] = v[1];
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[2];
+ uvsw[face * 3 + 2] = u[1];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+
+ // face 2
+ facesw[face * 3 + 0] = v[2];
+ facesw[face * 3 + 1] = v[0];
+ facesw[face * 3 + 2] = v[3];
+
+ uvsw[face * 3 + 0] = u[2];
+ uvsw[face * 3 + 1] = u[0];
+ uvsw[face * 3 + 2] = u[3];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ }
+
+ if (i == 0 && spin_degrees < 360) {
+
+ for (int j = 0; j < triangles.size(); j += 3) {
+ for (int k = 0; k < 3; k++) {
+ int src[3] = { 0, 2, 1 };
+ Vector2 p = final_polygon[triangles[j + src[k]]];
+ Vector3 v = Vector3(p.x, p.y, 0);
+ facesw[face * 3 + k] = v;
+ }
+
+ smoothw[face] = false;
+ materialsw[face] = material;
+ invertw[face] = invert_val;
+ face++;
+ }
+ }
+
+ if (i == spin_sides - 1 && spin_degrees < 360) {
+
+ for (int j = 0; j < triangles.size(); j += 3) {
+ for (int k = 0; k < 3; k++) {
+ int src[3] = { 0, 1, 2 };
+ Vector2 p = final_polygon[triangles[j + src[k]]];
+ Vector3 v = Vector3(normali_n.x * p.x, p.y, normali_n.z * p.x);
+ facesw[face * 3 + k] = v;
+ }
+
+ smoothw[face] = false;
+ materialsw[face] = material;
+ invertw[face] = invert_val;
+ face++;
+ }
+ }
+ }
+ } break;
+ case MODE_PATH: {
+
+ float bl = curve->get_baked_length();
+ int splits = MAX(2, Math::ceil(bl / path_interval));
+
+ Transform path_to_this = get_global_transform().affine_inverse() * path->get_global_transform();
+
+ Transform prev_xf;
+
+ Vector3 lookat_dir;
+
+ if (path_rotation == PATH_ROTATION_POLYGON) {
+ lookat_dir = (path->get_global_transform().affine_inverse() * get_global_transform()).xform(Vector3(0, 0, -1));
+ } else {
+ Vector3 p1, p2;
+ p1 = curve->interpolate_baked(0);
+ p2 = curve->interpolate_baked(0.1);
+ lookat_dir = (p2 - p1).normalized();
+ }
+
+ for (int i = 0; i <= splits; i++) {
+
+ float ofs = i * path_interval;
+
+ Transform xf;
+ xf.origin = curve->interpolate_baked(ofs);
+
+ Vector3 local_dir;
+
+ if (path_rotation == PATH_ROTATION_PATH_FOLLOW && ofs > 0) {
+ //before end
+ Vector3 p1 = curve->interpolate_baked(ofs - 0.1);
+ Vector3 p2 = curve->interpolate_baked(ofs);
+ local_dir = (p2 - p1).normalized();
+
+ } else {
+ local_dir = lookat_dir;
+ }
+
+ xf = xf.looking_at(xf.origin + local_dir, Vector3(0, 1, 0));
+ Basis rot(Vector3(0, 0, 1), curve->interpolate_baked_tilt(ofs));
+
+ xf = xf * rot; //post mult
+
+ xf = path_to_this * xf;
+
+ if (i > 0) {
+ //put triangles where they belong
+ //add triangles for depth
+ for (int j = 0; j < final_polygon.size(); j++) {
+
+ int j_n = (j + 1) % final_polygon.size();
+
+ Vector3 v[4] = {
+ prev_xf.xform(Vector3(final_polygon[j].x, final_polygon[j].y, 0)),
+ prev_xf.xform(Vector3(final_polygon[j_n].x, final_polygon[j_n].y, 0)),
+ xf.xform(Vector3(final_polygon[j_n].x, final_polygon[j_n].y, 0)),
+ xf.xform(Vector3(final_polygon[j].x, final_polygon[j].y, 0)),
+ };
+
+ Vector2 u[4] = {
+ Vector2(0, 0),
+ Vector2(0, 1),
+ Vector2(1, 1),
+ Vector2(1, 0)
+ };
+
+ // face 1
+ facesw[face * 3 + 0] = v[0];
+ facesw[face * 3 + 1] = v[1];
+ facesw[face * 3 + 2] = v[2];
+
+ uvsw[face * 3 + 0] = u[0];
+ uvsw[face * 3 + 1] = u[1];
+ uvsw[face * 3 + 2] = u[2];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+
+ // face 2
+ facesw[face * 3 + 0] = v[2];
+ facesw[face * 3 + 1] = v[3];
+ facesw[face * 3 + 2] = v[0];
+
+ uvsw[face * 3 + 0] = u[2];
+ uvsw[face * 3 + 1] = u[3];
+ uvsw[face * 3 + 2] = u[0];
+
+ smoothw[face] = smooth_faces;
+ invertw[face] = invert_val;
+ materialsw[face] = material;
+
+ face++;
+ }
+ }
+
+ if (i == 0) {
+
+ for (int j = 0; j < triangles.size(); j += 3) {
+ for (int k = 0; k < 3; k++) {
+ int src[3] = { 0, 1, 2 };
+ Vector2 p = final_polygon[triangles[j + src[k]]];
+ Vector3 v = Vector3(p.x, p.y, 0);
+ facesw[face * 3 + k] = xf.xform(v);
+ }
+
+ smoothw[face] = false;
+ materialsw[face] = material;
+ invertw[face] = invert_val;
+ face++;
+ }
+ }
+
+ if (i == splits) {
+
+ for (int j = 0; j < triangles.size(); j += 3) {
+ for (int k = 0; k < 3; k++) {
+ int src[3] = { 0, 2, 1 };
+ Vector2 p = final_polygon[triangles[j + src[k]]];
+ Vector3 v = Vector3(p.x, p.y, 0);
+ facesw[face * 3 + k] = xf.xform(v);
+ }
+
+ smoothw[face] = false;
+ materialsw[face] = material;
+ invertw[face] = invert_val;
+ face++;
+ }
+ }
+
+ prev_xf = xf;
+ }
+
+ } break;
+ }
+
+ if (face != face_count) {
+ ERR_PRINT("Face mismatch bug! fix code");
+ }
+ for (int i = 0; i < face_count * 3; i++) {
+ if (i == 0) {
+ aabb.position = facesw[i];
+ } else {
+ aabb.expand_to(facesw[i]);
+ }
+ }
+ }
+
+ brush->build_from_faces(faces, uvs, smooth, materials, invert);
+
+ return brush;
+}
+
+void CSGPolygon::_notification(int p_what) {
+ if (p_what == NOTIFICATION_EXIT_TREE) {
+ if (path_cache) {
+ path_cache->disconnect("tree_exited", this, "_path_exited");
+ path_cache->disconnect("curve_changed", this, "_path_changed");
+ path_cache = NULL;
+ }
+ }
+}
+
+void CSGPolygon::_validate_property(PropertyInfo &property) const {
+ if (property.name.begins_with("spin") && mode != MODE_SPIN) {
+ property.usage = 0;
+ }
+ if (property.name.begins_with("path") && mode != MODE_PATH) {
+ property.usage = 0;
+ }
+ if (property.name == "depth" && mode != MODE_DEPTH) {
+ property.usage = 0;
+ }
+
+ CSGShape::_validate_property(property);
+}
+
+void CSGPolygon::_path_changed() {
+ _make_dirty();
+ update_gizmo();
+}
+
+void CSGPolygon::_path_exited() {
+ path_cache = NULL;
+}
+
+void CSGPolygon::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_polygon", "polygon"), &CSGPolygon::set_polygon);
+ ClassDB::bind_method(D_METHOD("get_polygon"), &CSGPolygon::get_polygon);
+
+ ClassDB::bind_method(D_METHOD("set_mode", "mode"), &CSGPolygon::set_mode);
+ ClassDB::bind_method(D_METHOD("get_mode"), &CSGPolygon::get_mode);
+
+ ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CSGPolygon::set_depth);
+ ClassDB::bind_method(D_METHOD("get_depth"), &CSGPolygon::get_depth);
+
+ ClassDB::bind_method(D_METHOD("set_spin_degrees", "degrees"), &CSGPolygon::set_spin_degrees);
+ ClassDB::bind_method(D_METHOD("get_spin_degrees"), &CSGPolygon::get_spin_degrees);
+
+ ClassDB::bind_method(D_METHOD("set_spin_sides", "spin_sides"), &CSGPolygon::set_spin_sides);
+ ClassDB::bind_method(D_METHOD("get_spin_sides"), &CSGPolygon::get_spin_sides);
+
+ ClassDB::bind_method(D_METHOD("set_path_node", "path"), &CSGPolygon::set_path_node);
+ ClassDB::bind_method(D_METHOD("get_path_node"), &CSGPolygon::get_path_node);
+
+ ClassDB::bind_method(D_METHOD("set_path_interval", "distance"), &CSGPolygon::set_path_interval);
+ ClassDB::bind_method(D_METHOD("get_path_interval"), &CSGPolygon::get_path_interval);
+
+ ClassDB::bind_method(D_METHOD("set_path_rotation", "mode"), &CSGPolygon::set_path_rotation);
+ ClassDB::bind_method(D_METHOD("get_path_rotation"), &CSGPolygon::get_path_rotation);
+
+ ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGPolygon::set_material);
+ ClassDB::bind_method(D_METHOD("get_material"), &CSGPolygon::get_material);
+
+ ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGPolygon::set_smooth_faces);
+ ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGPolygon::get_smooth_faces);
+
+ ClassDB::bind_method(D_METHOD("_is_editable_3d_polygon"), &CSGPolygon::_is_editable_3d_polygon);
+ ClassDB::bind_method(D_METHOD("_has_editable_3d_polygon_no_depth"), &CSGPolygon::_has_editable_3d_polygon_no_depth);
+
+ ClassDB::bind_method(D_METHOD("_path_exited"), &CSGPolygon::_path_exited);
+ ClassDB::bind_method(D_METHOD("_path_changed"), &CSGPolygon::_path_changed);
+
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Depth,Spin,Path"), "set_mode", "get_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "spin_degrees", PROPERTY_HINT_RANGE, "1,360,0.1"), "set_spin_degrees", "get_spin_degrees");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "spin_sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_spin_sides", "get_spin_sides");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "path_node", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Path"), "set_path_node", "get_path_node");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_interval", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_path_interval", "get_path_interval");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "path_rotation", PROPERTY_HINT_ENUM, "Polygon,Path,PathFollow"), "set_path_rotation", "get_path_rotation");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+
+ BIND_ENUM_CONSTANT(MODE_DEPTH);
+ BIND_ENUM_CONSTANT(MODE_SPIN);
+ BIND_ENUM_CONSTANT(MODE_PATH);
+
+ BIND_ENUM_CONSTANT(PATH_ROTATION_POLYGON);
+ BIND_ENUM_CONSTANT(PATH_ROTATION_PATH);
+ BIND_ENUM_CONSTANT(PATH_ROTATION_PATH_FOLLOW);
+}
+
+void CSGPolygon::set_polygon(const Vector<Vector2> &p_polygon) {
+ polygon = p_polygon;
+ _make_dirty();
+ update_gizmo();
+}
+
+Vector<Vector2> CSGPolygon::get_polygon() const {
+ return polygon;
+}
+
+void CSGPolygon::set_mode(Mode p_mode) {
+ mode = p_mode;
+ _make_dirty();
+ update_gizmo();
+ _change_notify();
+}
+
+CSGPolygon::Mode CSGPolygon::get_mode() const {
+ return mode;
+}
+
+void CSGPolygon::set_depth(const float p_depth) {
+ ERR_FAIL_COND(p_depth < 0.001);
+ depth = p_depth;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGPolygon::get_depth() const {
+ return depth;
+}
+
+void CSGPolygon::set_spin_degrees(const float p_spin_degrees) {
+ ERR_FAIL_COND(p_spin_degrees < 0.01 || p_spin_degrees > 360);
+ spin_degrees = p_spin_degrees;
+ _make_dirty();
+ update_gizmo();
+}
+
+float CSGPolygon::get_spin_degrees() const {
+ return spin_degrees;
+}
+
+void CSGPolygon::set_spin_sides(const int p_spin_sides) {
+ ERR_FAIL_COND(p_spin_sides < 3);
+ spin_sides = p_spin_sides;
+ _make_dirty();
+ update_gizmo();
+}
+
+int CSGPolygon::get_spin_sides() const {
+ return spin_sides;
+}
+
+void CSGPolygon::set_path_node(const NodePath &p_path) {
+ path_node = p_path;
+ _make_dirty();
+ update_gizmo();
+}
+
+NodePath CSGPolygon::get_path_node() const {
+ return path_node;
+}
+
+void CSGPolygon::set_path_interval(float p_interval) {
+ ERR_FAIL_COND(p_interval < 0.001);
+ path_interval = p_interval;
+ _make_dirty();
+ update_gizmo();
+}
+float CSGPolygon::get_path_interval() const {
+ return path_interval;
+}
+
+void CSGPolygon::set_path_rotation(PathRotation p_rotation) {
+ path_rotation = p_rotation;
+ _make_dirty();
+ update_gizmo();
+}
+
+CSGPolygon::PathRotation CSGPolygon::get_path_rotation() const {
+ return path_rotation;
+}
+
+void CSGPolygon::set_smooth_faces(const bool p_smooth_faces) {
+ smooth_faces = p_smooth_faces;
+ _make_dirty();
+}
+
+bool CSGPolygon::get_smooth_faces() const {
+ return smooth_faces;
+}
+
+void CSGPolygon::set_material(const Ref<Material> &p_material) {
+
+ material = p_material;
+ _make_dirty();
+}
+
+Ref<Material> CSGPolygon::get_material() const {
+
+ return material;
+}
+
+bool CSGPolygon::_is_editable_3d_polygon() const {
+ return true;
+}
+
+bool CSGPolygon::_has_editable_3d_polygon_no_depth() const {
+ return true;
+}
+
+CSGPolygon::CSGPolygon() {
+ // defaults
+ mode = MODE_DEPTH;
+ polygon.push_back(Vector2(0, 0));
+ polygon.push_back(Vector2(0, 1));
+ polygon.push_back(Vector2(1, 1));
+ polygon.push_back(Vector2(1, 0));
+ depth = 1.0;
+ spin_degrees = 360;
+ spin_sides = 8;
+ smooth_faces = false;
+ path_interval = 1;
+ path_rotation = PATH_ROTATION_PATH;
+ path_cache = NULL;
+}
diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h
new file mode 100644
index 0000000000..cbb5c7e041
--- /dev/null
+++ b/modules/csg/csg_shape.h
@@ -0,0 +1,390 @@
+/*************************************************************************/
+/* csg_shape.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef CSG_SHAPE_H
+#define CSG_SHAPE_H
+
+#define CSGJS_HEADER_ONLY
+
+#include "csg.h"
+#include "scene/3d/visual_instance.h"
+#include "scene/resources/concave_polygon_shape.h"
+
+class CSGShape : public VisualInstance {
+ GDCLASS(CSGShape, VisualInstance);
+
+public:
+ enum Operation {
+ OPERATION_UNION,
+ OPERATION_INTERSECTION,
+ OPERATION_SUBTRACTION,
+
+ };
+
+private:
+ Operation operation;
+ CSGShape *parent;
+
+ CSGBrush *brush;
+
+ AABB node_aabb;
+
+ bool dirty;
+ float snap;
+
+ bool use_collision;
+ Ref<ConcavePolygonShape> root_collision_shape;
+ RID root_collision_instance;
+
+ Ref<ArrayMesh> root_mesh;
+
+ struct Vector3Hasher {
+ _ALWAYS_INLINE_ uint32_t hash(const Vector3 &p_vec3) const {
+ uint32_t h = hash_djb2_one_float(p_vec3.x);
+ h = hash_djb2_one_float(p_vec3.y, h);
+ h = hash_djb2_one_float(p_vec3.z, h);
+ return h;
+ }
+ };
+
+ struct ShapeUpdateSurface {
+ PoolVector<Vector3> vertices;
+ PoolVector<Vector3> normals;
+ PoolVector<Vector2> uvs;
+ Ref<Material> material;
+ int last_added;
+
+ PoolVector<Vector3>::Write verticesw;
+ PoolVector<Vector3>::Write normalsw;
+ PoolVector<Vector2>::Write uvsw;
+ };
+
+ void _update_shape();
+
+protected:
+ void _notification(int p_what);
+ virtual CSGBrush *_build_brush() = 0;
+ void _make_dirty();
+
+ static void _bind_methods();
+
+ friend class CSGCombiner;
+ CSGBrush *_get_brush();
+
+ virtual void _validate_property(PropertyInfo &property) const;
+
+public:
+ void set_operation(Operation p_operation);
+ Operation get_operation() const;
+
+ virtual PoolVector<Vector3> get_brush_faces();
+
+ virtual AABB get_aabb() const;
+ virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
+
+ void set_use_collision(bool p_enable);
+ bool is_using_collision() const;
+
+ void set_snap(float p_snap);
+ float get_snap() const;
+
+ bool is_root_shape() const;
+ CSGShape();
+ ~CSGShape();
+};
+
+VARIANT_ENUM_CAST(CSGShape::Operation)
+
+class CSGCombiner : public CSGShape {
+ GDCLASS(CSGCombiner, CSGShape)
+private:
+ virtual CSGBrush *_build_brush();
+
+public:
+ CSGCombiner();
+};
+
+class CSGPrimitive : public CSGShape {
+ GDCLASS(CSGPrimitive, CSGShape)
+
+private:
+ bool invert_faces;
+
+protected:
+ CSGBrush *_create_brush_from_arrays(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uv, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials);
+ static void _bind_methods();
+
+public:
+ void set_invert_faces(bool p_invert);
+ bool is_inverting_faces();
+
+ CSGPrimitive();
+};
+
+class CSGMesh : public CSGPrimitive {
+ GDCLASS(CSGMesh, CSGPrimitive)
+
+ virtual CSGBrush *_build_brush();
+
+ Ref<Mesh> mesh;
+
+ void _mesh_changed();
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_mesh(const Ref<Mesh> &p_mesh);
+ Ref<Mesh> get_mesh();
+};
+
+class CSGSphere : public CSGPrimitive {
+
+ GDCLASS(CSGSphere, CSGPrimitive)
+ virtual CSGBrush *_build_brush();
+
+ Ref<Material> material;
+ bool smooth_faces;
+ float radius;
+ int radial_segments;
+ int rings;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_radius(const float p_radius);
+ float get_radius() const;
+
+ void set_radial_segments(const int p_radial_segments);
+ int get_radial_segments() const;
+
+ void set_rings(const int p_rings);
+ int get_rings() const;
+
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+
+ void set_smooth_faces(bool p_smooth_faces);
+ bool get_smooth_faces() const;
+
+ CSGSphere();
+};
+
+class CSGBox : public CSGPrimitive {
+
+ GDCLASS(CSGBox, CSGPrimitive)
+ virtual CSGBrush *_build_brush();
+
+ Ref<Material> material;
+ float width;
+ float height;
+ float depth;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_width(const float p_width);
+ float get_width() const;
+
+ void set_height(const float p_height);
+ float get_height() const;
+
+ void set_depth(const float p_depth);
+ float get_depth() const;
+
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+
+ CSGBox();
+};
+
+class CSGCylinder : public CSGPrimitive {
+
+ GDCLASS(CSGCylinder, CSGPrimitive)
+ virtual CSGBrush *_build_brush();
+
+ Ref<Material> material;
+ float radius;
+ float height;
+ int sides;
+ bool cone;
+ bool smooth_faces;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_radius(const float p_radius);
+ float get_radius() const;
+
+ void set_height(const float p_height);
+ float get_height() const;
+
+ void set_sides(const int p_sides);
+ int get_sides() const;
+
+ void set_cone(const bool p_cone);
+ bool is_cone() const;
+
+ void set_smooth_faces(bool p_smooth_faces);
+ bool get_smooth_faces() const;
+
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+
+ CSGCylinder();
+};
+
+class CSGTorus : public CSGPrimitive {
+
+ GDCLASS(CSGTorus, CSGPrimitive)
+ virtual CSGBrush *_build_brush();
+
+ Ref<Material> material;
+ float inner_radius;
+ float outer_radius;
+ int sides;
+ int ring_sides;
+ bool smooth_faces;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_inner_radius(const float p_inner_radius);
+ float get_inner_radius() const;
+
+ void set_outer_radius(const float p_outer_radius);
+ float get_outer_radius() const;
+
+ void set_sides(const int p_sides);
+ int get_sides() const;
+
+ void set_ring_sides(const int p_ring_sides);
+ int get_ring_sides() const;
+
+ void set_smooth_faces(bool p_smooth_faces);
+ bool get_smooth_faces() const;
+
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+
+ CSGTorus();
+};
+
+class CSGPolygon : public CSGPrimitive {
+
+ GDCLASS(CSGPolygon, CSGPrimitive)
+
+public:
+ enum Mode {
+ MODE_DEPTH,
+ MODE_SPIN,
+ MODE_PATH
+ };
+
+ enum PathRotation {
+ PATH_ROTATION_POLYGON,
+ PATH_ROTATION_PATH,
+ PATH_ROTATION_PATH_FOLLOW,
+ };
+
+private:
+ virtual CSGBrush *_build_brush();
+
+ Vector<Vector2> polygon;
+ Ref<Material> material;
+
+ Mode mode;
+
+ float depth;
+
+ float spin_degrees;
+ int spin_sides;
+
+ NodePath path_node;
+ float path_interval;
+ PathRotation path_rotation;
+
+ Node *path_cache;
+
+ bool smooth_faces;
+
+ bool _is_editable_3d_polygon() const;
+ bool _has_editable_3d_polygon_no_depth() const;
+
+ void _path_changed();
+ void _path_exited();
+
+protected:
+ static void _bind_methods();
+ virtual void _validate_property(PropertyInfo &property) const;
+ void _notification(int p_what);
+
+public:
+ void set_polygon(const Vector<Vector2> &p_polygon);
+ Vector<Vector2> get_polygon() const;
+
+ void set_mode(Mode p_mode);
+ Mode get_mode() const;
+
+ void set_depth(float p_depth);
+ float get_depth() const;
+
+ void set_spin_degrees(float p_spin_degrees);
+ float get_spin_degrees() const;
+
+ void set_spin_sides(int p_sides);
+ int get_spin_sides() const;
+
+ void set_path_node(const NodePath &p_path);
+ NodePath get_path_node() const;
+
+ void set_path_interval(float p_interval);
+ float get_path_interval() const;
+
+ void set_path_rotation(PathRotation p_rotation);
+ PathRotation get_path_rotation() const;
+
+ void set_smooth_faces(bool p_smooth_faces);
+ bool get_smooth_faces() const;
+
+ void set_material(const Ref<Material> &p_material);
+ Ref<Material> get_material() const;
+
+ CSGPolygon();
+};
+
+VARIANT_ENUM_CAST(CSGPolygon::Mode)
+VARIANT_ENUM_CAST(CSGPolygon::PathRotation)
+
+#endif // CSG_SHAPE_H
diff --git a/modules/csg/doc_classes/CSGBox.xml b/modules/csg/doc_classes/CSGBox.xml
new file mode 100644
index 0000000000..80455fda80
--- /dev/null
+++ b/modules/csg/doc_classes/CSGBox.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGBox" inherits="CSGPrimitive" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="depth" type="float" setter="set_depth" getter="get_depth">
+ </member>
+ <member name="height" type="float" setter="set_height" getter="get_height">
+ </member>
+ <member name="material" type="Material" setter="set_material" getter="get_material">
+ </member>
+ <member name="width" type="float" setter="set_width" getter="get_width">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGCombiner.xml b/modules/csg/doc_classes/CSGCombiner.xml
new file mode 100644
index 0000000000..b2265d7703
--- /dev/null
+++ b/modules/csg/doc_classes/CSGCombiner.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGCombiner" inherits="CSGShape" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGCylinder.xml b/modules/csg/doc_classes/CSGCylinder.xml
new file mode 100644
index 0000000000..0cab26ad3d
--- /dev/null
+++ b/modules/csg/doc_classes/CSGCylinder.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGCylinder" inherits="CSGPrimitive" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="cone" type="bool" setter="set_cone" getter="is_cone">
+ </member>
+ <member name="height" type="float" setter="set_height" getter="get_height">
+ </member>
+ <member name="material" type="Material" setter="set_material" getter="get_material">
+ </member>
+ <member name="radius" type="float" setter="set_radius" getter="get_radius">
+ </member>
+ <member name="sides" type="int" setter="set_sides" getter="get_sides">
+ </member>
+ <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGMesh.xml b/modules/csg/doc_classes/CSGMesh.xml
new file mode 100644
index 0000000000..e5c3e5ccf3
--- /dev/null
+++ b/modules/csg/doc_classes/CSGMesh.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGMesh" inherits="CSGPrimitive" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGPolygon.xml b/modules/csg/doc_classes/CSGPolygon.xml
new file mode 100644
index 0000000000..379c512d6a
--- /dev/null
+++ b/modules/csg/doc_classes/CSGPolygon.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGPolygon" inherits="CSGPrimitive" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="depth" type="float" setter="set_depth" getter="get_depth">
+ </member>
+ <member name="material" type="Material" setter="set_material" getter="get_material">
+ </member>
+ <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="CSGPolygon.Mode">
+ </member>
+ <member name="path_interval" type="float" setter="set_path_interval" getter="get_path_interval">
+ </member>
+ <member name="path_node" type="NodePath" setter="set_path_node" getter="get_path_node">
+ </member>
+ <member name="path_rotation" type="int" setter="set_path_rotation" getter="get_path_rotation" enum="CSGPolygon.PathRotation">
+ </member>
+ <member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon">
+ </member>
+ <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces">
+ </member>
+ <member name="spin_degrees" type="float" setter="set_spin_degrees" getter="get_spin_degrees">
+ </member>
+ <member name="spin_sides" type="int" setter="set_spin_sides" getter="get_spin_sides">
+ </member>
+ </members>
+ <constants>
+ <constant name="MODE_DEPTH" value="0" enum="Mode">
+ </constant>
+ <constant name="MODE_SPIN" value="1" enum="Mode">
+ </constant>
+ <constant name="MODE_PATH" value="2" enum="Mode">
+ </constant>
+ <constant name="PATH_ROTATION_POLYGON" value="0" enum="PathRotation">
+ </constant>
+ <constant name="PATH_ROTATION_PATH" value="1" enum="PathRotation">
+ </constant>
+ <constant name="PATH_ROTATION_PATH_FOLLOW" value="2" enum="PathRotation">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGPrimitive.xml b/modules/csg/doc_classes/CSGPrimitive.xml
new file mode 100644
index 0000000000..bf41c40f22
--- /dev/null
+++ b/modules/csg/doc_classes/CSGPrimitive.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGPrimitive" inherits="CSGShape" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="invert_faces" type="bool" setter="set_invert_faces" getter="is_inverting_faces">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGShape.xml b/modules/csg/doc_classes/CSGShape.xml
new file mode 100644
index 0000000000..cf236a4207
--- /dev/null
+++ b/modules/csg/doc_classes/CSGShape.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGShape" inherits="VisualInstance" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="is_root_shape" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape.Operation">
+ </member>
+ <member name="snap" type="float" setter="set_snap" getter="get_snap">
+ </member>
+ <member name="use_collision" type="bool" setter="set_use_collision" getter="is_using_collision">
+ </member>
+ </members>
+ <constants>
+ <constant name="OPERATION_UNION" value="0" enum="Operation">
+ </constant>
+ <constant name="OPERATION_INTERSECTION" value="1" enum="Operation">
+ </constant>
+ <constant name="OPERATION_SUBTRACTION" value="2" enum="Operation">
+ </constant>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGSphere.xml b/modules/csg/doc_classes/CSGSphere.xml
new file mode 100644
index 0000000000..520368506e
--- /dev/null
+++ b/modules/csg/doc_classes/CSGSphere.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGSphere" inherits="CSGPrimitive" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="material" type="Material" setter="set_material" getter="get_material">
+ </member>
+ <member name="radial_segments" type="int" setter="set_radial_segments" getter="get_radial_segments">
+ </member>
+ <member name="radius" type="float" setter="set_radius" getter="get_radius">
+ </member>
+ <member name="rings" type="int" setter="set_rings" getter="get_rings">
+ </member>
+ <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGTorus.xml b/modules/csg/doc_classes/CSGTorus.xml
new file mode 100644
index 0000000000..58bbef2600
--- /dev/null
+++ b/modules/csg/doc_classes/CSGTorus.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGTorus" inherits="CSGPrimitive" category="Core" version="3.1">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ </methods>
+ <members>
+ <member name="inner_radius" type="float" setter="set_inner_radius" getter="get_inner_radius">
+ </member>
+ <member name="material" type="Material" setter="set_material" getter="get_material">
+ </member>
+ <member name="outer_radius" type="float" setter="set_outer_radius" getter="get_outer_radius">
+ </member>
+ <member name="ring_sides" type="int" setter="set_ring_sides" getter="get_ring_sides">
+ </member>
+ <member name="sides" type="int" setter="set_sides" getter="get_sides">
+ </member>
+ <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp
new file mode 100644
index 0000000000..0dea09808a
--- /dev/null
+++ b/modules/csg/register_types.cpp
@@ -0,0 +1,57 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "register_types.h"
+
+#include "csg_gizmos.h"
+#include "csg_shape.h"
+
+void register_csg_types() {
+
+#ifndef _3D_DISABLED
+
+ ClassDB::register_virtual_class<CSGShape>();
+ ClassDB::register_virtual_class<CSGPrimitive>();
+ ClassDB::register_class<CSGMesh>();
+ ClassDB::register_class<CSGSphere>();
+ ClassDB::register_class<CSGBox>();
+ ClassDB::register_class<CSGCylinder>();
+ ClassDB::register_class<CSGTorus>();
+ ClassDB::register_class<CSGPolygon>();
+ ClassDB::register_class<CSGCombiner>();
+
+#ifdef TOOLS_ENABLED
+ EditorPlugins::add_by_type<EditorPluginCSG>();
+#endif
+#endif
+}
+
+void unregister_csg_types() {
+}
diff --git a/modules/csg/register_types.h b/modules/csg/register_types.h
new file mode 100644
index 0000000000..49490d31d3
--- /dev/null
+++ b/modules/csg/register_types.h
@@ -0,0 +1,32 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+void register_csg_types();
+void unregister_csg_types();
diff --git a/modules/dds/config.py b/modules/dds/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/dds/config.py
+++ b/modules/dds/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/enet/config.py b/modules/enet/config.py
index 8031fbb4b6..3e30bbe778 100644
--- a/modules/enet/config.py
+++ b/modules/enet/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
index 55a7a1ac77..fab4b05da9 100644
--- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.1-dev">
+<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.1">
<brief_description>
PacketPeer implementation using the ENet library.
</brief_description>
<description>
- A connection (or a listening server) that should be passed to [method SceneTree.set_network_peer]. Socket events can be handled by connecting to [SceneTree] signals.
+ A PacketPeer implementation that should be passed to [method SceneTree.set_network_peer] after being initialized as either a client or server. Events can then be handled by connecting to [SceneTree] signals.
</description>
<tutorials>
+ <link>http://docs.godotengine.org/en/3.0/tutorials/networking/high_level_multiplayer.html</link>
+ <link>http://enet.bespin.org/usergroup0.html</link>
</tutorials>
<demos>
</demos>
@@ -14,13 +16,16 @@
<method name="close_connection">
<return type="void">
</return>
+ <argument index="0" name="wait_usec" type="int" default="100">
+ </argument>
<description>
+ Closes the connection. Ignored if no connection is currently established. If this is a server it tries to notify all clients before forcibly disconnecting them. If this is a client it simply closes the connection to the server.
</description>
</method>
<method name="create_client">
<return type="int" enum="Error">
</return>
- <argument index="0" name="ip" type="String">
+ <argument index="0" name="address" type="String">
</argument>
<argument index="1" name="port" type="int">
</argument>
@@ -28,8 +33,10 @@
</argument>
<argument index="3" name="out_bandwidth" type="int" default="0">
</argument>
+ <argument index="4" name="client_port" type="int" default="0">
+ </argument>
<description>
- Create client that connects to a server at address [code]ip[/code] using specified [code]port[/code].
+ Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain nome (e.g. [code]www.example.com[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]192.168.1.1[/code]). The [code]port[/code] is the port the server is listening on. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [code]OK[/code] if a client was created, [code]ERR_ALREADY_IN_USE[/code] if this NetworkedMultiplayerEnet instance already has an open connection (in which case you need to call [method close_connection] first) or [code]ERR_CANT_CREATE[/code] if the client could not be created. If [code]client_port[/code] is specified, the client will also listen to the given port, this is useful in some NAT traveral technique.
</description>
</method>
<method name="create_server">
@@ -44,7 +51,50 @@
<argument index="3" name="out_bandwidth" type="int" default="0">
</argument>
<description>
- Create server that listens to connections via [code]port[/code].
+ Create server that listens to connections via [code]port[/code]. The port needs to be an available, unused port between 0 and 65535. Note that ports below 1024 are privileged and may require elevated permissions depending on the platform. To change the interface the server listens on, use [method set_bind_ip]. The default IP is the wildcard [code]*[/code], which listens on all available interfaces. [code]max_clients[/code] is the maximum number of clients that are allowed at once, any number up to 4096 may be used, although the achievable number of simultaneous clients may be far lower and depends on the application. For additional details on the bandwidth parameters, see [method create_client]. Returns [code]OK[/code] if a server was created, [code]ERR_ALREADY_IN_USE[/code] if this NetworkedMultiplayerEnet instance already has an open connection (in which case you need to call [method close_connection] first) or [code]ERR_CANT_CREATE[/code] if the server could not be created.
+ </description>
+ </method>
+ <method name="disconnect_peer">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="now" type="bool" default="false">
+ </argument>
+ <description>
+ Disconnect the given peer. If "now" is set to true, the connection will be closed immediately without flushing queued messages.
+ </description>
+ </method>
+ <method name="get_last_packet_channel" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the channel of the last packet fetched via [method PacketPeer.get_packet]
+ </description>
+ </method>
+ <method name="get_packet_channel" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the channel of the next packet that will be retrieved via [method PacketPeer.get_packet_peer]
+ </description>
+ </method>
+ <method name="get_peer_address" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns the IP address of the given peer.
+ </description>
+ </method>
+ <method name="get_peer_port" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns the remote port of the given peer.
</description>
</method>
<method name="set_bind_ip">
@@ -53,23 +103,39 @@
<argument index="0" name="ip" type="String">
</argument>
<description>
+ The IP used when creating a server. This is set to the wildcard [code]*[/code] by default, which binds to all available interfaces. The given IP needs to be in IPv4 or IPv6 address format, for example: [code]192.168.1.1[/code].
</description>
</method>
</methods>
<members>
+ <member name="always_ordered" type="bool" setter="set_always_ordered" getter="is_always_ordered">
+ Always use [code]TRANSFER_MODE_ORDERED[/code] in place of [code]TRANSFER_MODE_UNRELIABLE[/code]. This is the only way to use ordering with the RPC system.
+ </member>
+ <member name="channel_count" type="int" setter="set_channel_count" getter="get_channel_count">
+ The number of channels to be used by ENet. Default: [code]3[/code]. Channels are used to separate different kinds of data. In realiable or ordered mode, for example, the packet delivery order is ensured on a per channel basis.
+ </member>
<member name="compression_mode" type="int" setter="set_compression_mode" getter="get_compression_mode" enum="NetworkedMultiplayerENet.CompressionMode">
+ The compression method used for network packets. Default is no compression. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all.
+ </member>
+ <member name="transfer_channel" type="int" setter="set_transfer_channel" getter="get_transfer_channel">
+ Set the default channel to be used to transfer data. By default this value is [code]-1[/code] which means that ENet will only use 2 channels, one for reliable and one for unreliable packets. Channel [code]0[/code] is reserved, and cannot be used. Setting this member to any value between [code]0[/code] and [member channel_count] (excluded) will force ENet to use that channel for sending data.
</member>
</members>
<constants>
<constant name="COMPRESS_NONE" value="0" enum="CompressionMode">
+ No compression.
</constant>
<constant name="COMPRESS_RANGE_CODER" value="1" enum="CompressionMode">
+ ENet's buildin range encoding.
</constant>
<constant name="COMPRESS_FASTLZ" value="2" enum="CompressionMode">
+ FastLZ compression.
</constant>
<constant name="COMPRESS_ZLIB" value="3" enum="CompressionMode">
+ zlib compression.
</constant>
<constant name="COMPRESS_ZSTD" value="4" enum="CompressionMode">
+ ZStandard compression.
</constant>
</constants>
</class>
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index f3f4acd768..88768829d7 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "networked_multiplayer_enet.h"
+#include "io/ip.h"
#include "io/marshalls.h"
#include "os/os.h"
@@ -54,9 +55,29 @@ int NetworkedMultiplayerENet::get_packet_peer() const {
return incoming_packets.front()->get().from;
}
+int NetworkedMultiplayerENet::get_packet_channel() const {
+
+ ERR_FAIL_COND_V(!active, -1);
+ ERR_FAIL_COND_V(incoming_packets.size() == 0, -1);
+
+ return incoming_packets.front()->get().channel;
+}
+
+int NetworkedMultiplayerENet::get_last_packet_channel() const {
+
+ ERR_FAIL_COND_V(!active, -1);
+ ERR_FAIL_COND_V(!current_packet.packet, -1);
+
+ return current_packet.channel;
+}
+
Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int p_in_bandwidth, int p_out_bandwidth) {
ERR_FAIL_COND_V(active, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_max_clients < 0, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_in_bandwidth < 0, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_out_bandwidth < 0, ERR_INVALID_PARAMETER);
ENetAddress address;
@@ -78,9 +99,9 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
host = enet_host_create(&address /* the address to bind the server host to */,
p_max_clients /* allow up to 32 clients and/or outgoing connections */,
- SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */,
- p_in_bandwidth /* assume any amount of incoming bandwidth */,
- p_out_bandwidth /* assume any amount of outgoing bandwidth */);
+ channel_count /* allow up to channel_count to be used */,
+ p_in_bandwidth /* limit incoming bandwith if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwith if > 0 */);
ERR_FAIL_COND_V(!host, ERR_CANT_CREATE);
@@ -92,43 +113,84 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
connection_status = CONNECTION_CONNECTED;
return OK;
}
-Error NetworkedMultiplayerENet::create_client(const IP_Address &p_ip, int p_port, int p_in_bandwidth, int p_out_bandwidth) {
+Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_port, int p_in_bandwidth, int p_out_bandwidth, int p_client_port) {
ERR_FAIL_COND_V(active, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_client_port < 0 || p_client_port > 65535, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_in_bandwidth < 0, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_out_bandwidth < 0, ERR_INVALID_PARAMETER);
+
+ if (p_client_port != 0) {
+ ENetAddress c_client;
+
+#ifdef GODOT_ENET
+ if (bind_ip.is_wildcard()) {
+ c_client.wildcard = 1;
+ } else {
+ enet_address_set_ip(&c_client, bind_ip.get_ipv6(), 16);
+ }
+#else
+ if (bind_ip.is_wildcard()) {
+ c_client.host = 0;
+ } else {
+ ERR_FAIL_COND_V(!bind_ip.is_ipv4(), ERR_INVALID_PARAMETER);
+ c_client.host = *(uint32_t *)bind_ip.get_ipv4();
+ }
+#endif
+
+ c_client.port = p_client_port;
- host = enet_host_create(NULL /* create a client host */,
- 1 /* only allow 1 outgoing connection */,
- SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */,
- p_in_bandwidth /* 56K modem with 56 Kbps downstream bandwidth */,
- p_out_bandwidth /* 56K modem with 14 Kbps upstream bandwidth */);
+ host = enet_host_create(&c_client /* create a client host */,
+ 1 /* only allow 1 outgoing connection */,
+ channel_count /* allow up to channel_count to be used */,
+ p_in_bandwidth /* limit incoming bandwith if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ } else {
+ host = enet_host_create(NULL /* create a client host */,
+ 1 /* only allow 1 outgoing connection */,
+ channel_count /* allow up to channel_count to be used */,
+ p_in_bandwidth /* limit incoming bandwith if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ }
ERR_FAIL_COND_V(!host, ERR_CANT_CREATE);
_setup_compressor();
+ IP_Address ip;
+ if (p_address.is_valid_ip_address()) {
+ ip = p_address;
+ } else {
+#ifdef GODOT_ENET
+ ip = IP::get_singleton()->resolve_hostname(p_address);
+#else
+ ip = IP::get_singleton()->resolve_hostname(p_address, IP::TYPE_IPV4);
+#endif
+
+ ERR_FAIL_COND_V(!ip.is_valid(), ERR_CANT_RESOLVE);
+ }
+
ENetAddress address;
#ifdef GODOT_ENET
- enet_address_set_ip(&address, p_ip.get_ipv6(), 16);
+ enet_address_set_ip(&address, ip.get_ipv6(), 16);
#else
- ERR_FAIL_COND_V(!p_ip.is_ipv4(), ERR_INVALID_PARAMETER);
- address.host = *(uint32_t *)p_ip.get_ipv4();
+ ERR_FAIL_COND_V(!ip.is_ipv4(), ERR_INVALID_PARAMETER);
+ address.host = *(uint32_t *)ip.get_ipv4();
#endif
address.port = p_port;
- //enet_address_set_host (& address, "localhost");
- //address.port = p_port;
-
unique_id = _gen_unique_id();
- /* Initiate the connection, allocating the enough channels */
- ENetPeer *peer = enet_host_connect(host, &address, SYSCH_MAX, unique_id);
+ // Initiate connection, allocating enough channels
+ ENetPeer *peer = enet_host_connect(host, &address, channel_count, unique_id);
if (peer == NULL) {
enet_host_destroy(host);
ERR_FAIL_COND_V(!peer, ERR_CANT_CREATE);
}
- //technically safe to ignore the peer or anything else.
+ // Technically safe to ignore the peer or anything else.
connection_status = CONNECTION_CONNECTING;
active = true;
@@ -148,13 +210,13 @@ void NetworkedMultiplayerENet::poll() {
/* Wait up to 1000 milliseconds for an event. */
while (true) {
- if (!host || !active) //might have been disconnected while emitting a notification
+ if (!host || !active) // Might have been disconnected while emitting a notification
return;
int ret = enet_host_service(host, &event, 1);
if (ret < 0) {
- //error, do something?
+ // Error, do something?
break;
} else if (ret == 0) {
break;
@@ -162,7 +224,7 @@ void NetworkedMultiplayerENet::poll() {
switch (event.type) {
case ENET_EVENT_TYPE_CONNECT: {
- /* Store any relevant client information here. */
+ // Store any relevant client information here.
if (server && refuse_connections) {
enet_peer_reset(event.peer);
@@ -172,7 +234,7 @@ void NetworkedMultiplayerENet::poll() {
int *new_id = memnew(int);
*new_id = event.data;
- if (*new_id == 0) { //data zero is sent by server (enet won't let you configure this). Server is always 1
+ if (*new_id == 0) { // Data zero is sent by server (enet won't let you configure this). Server is always 1.
*new_id = 1;
}
@@ -180,22 +242,22 @@ void NetworkedMultiplayerENet::poll() {
peer_map[*new_id] = event.peer;
- connection_status = CONNECTION_CONNECTED; //if connecting, this means it connected t something!
+ connection_status = CONNECTION_CONNECTED; // If connecting, this means it connected to something!
emit_signal("peer_connected", *new_id);
if (server) {
- //someone connected, let it know of all the peers available
+ // Someone connected, notify all the peers available
for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) {
if (E->key() == *new_id)
continue;
- //send existing peers to new peer
+ // Send existing peers to new peer
ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]);
encode_uint32(E->key(), &packet->data[4]);
enet_peer_send(event.peer, SYSCH_CONFIG, packet);
- //send the new peer to existing peers
+ // Send the new peer to existing peers
packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]);
encode_uint32(*new_id, &packet->data[4]);
@@ -209,7 +271,7 @@ void NetworkedMultiplayerENet::poll() {
} break;
case ENET_EVENT_TYPE_DISCONNECT: {
- /* Reset the peer's client information. */
+ // Reset the peer's client information.
int *id = (int *)event.peer->data;
@@ -220,12 +282,12 @@ void NetworkedMultiplayerENet::poll() {
} else {
if (server) {
- //someone disconnected, let it know to everyone else
+ // Someone disconnected, notify everyone else
for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) {
if (E->key() == *id)
continue;
- //send the new peer to existing peers
+
ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]);
encode_uint32(*id, &packet->data[4]);
@@ -246,7 +308,7 @@ void NetworkedMultiplayerENet::poll() {
case ENET_EVENT_TYPE_RECEIVE: {
if (event.channelID == SYSCH_CONFIG) {
- //some config message
+ // Some config message
ERR_CONTINUE(event.packet->dataLength < 8);
// Only server can send config messages
@@ -270,7 +332,7 @@ void NetworkedMultiplayerENet::poll() {
}
enet_packet_destroy(event.packet);
- } else if (event.channelID < SYSCH_MAX) {
+ } else if (event.channelID < channel_count) {
Packet packet;
packet.packet = event.packet;
@@ -284,6 +346,7 @@ void NetworkedMultiplayerENet::poll() {
uint32_t flags = decode_uint32(&event.packet->data[8]);
packet.from = source;
+ packet.channel = event.channelID;
if (server) {
// Someone is cheating and trying to fake the source!
@@ -292,13 +355,13 @@ void NetworkedMultiplayerENet::poll() {
packet.from = *id;
if (target == 0) {
- //re-send the everyone but sender :|
+ // Re-send to everyone but sender :|
incoming_packets.push_back(packet);
- //and make copies for sending
+ // And make copies for sending
for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) {
- if (uint32_t(E->key()) == source) //do not resend to self
+ if (uint32_t(E->key()) == source) // Do not resend to self
continue;
ENetPacket *packet2 = enet_packet_create(packet.packet->data, packet.packet->dataLength, flags);
@@ -307,12 +370,12 @@ void NetworkedMultiplayerENet::poll() {
}
} else if (target < 0) {
- //to all but one
+ // To all but one
- //and make copies for sending
+ // And make copies for sending
for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) {
- if (uint32_t(E->key()) == source || E->key() == -target) //do not resend to self, also do not send to excluded
+ if (uint32_t(E->key()) == source || E->key() == -target) // Do not resend to self, also do not send to excluded
continue;
ENetPacket *packet2 = enet_packet_create(packet.packet->data, packet.packet->dataLength, flags);
@@ -321,18 +384,18 @@ void NetworkedMultiplayerENet::poll() {
}
if (-target != 1) {
- //server is not excluded
+ // Server is not excluded
incoming_packets.push_back(packet);
} else {
- //server is excluded, erase packet
+ // Server is excluded, erase packet
enet_packet_destroy(packet.packet);
}
} else if (target == 1) {
- //to myself and only myself
+ // To myself and only myself
incoming_packets.push_back(packet);
} else {
- //to someone else, specifically
+ // To someone else, specifically
ERR_CONTINUE(!peer_map.has(target));
enet_peer_send(peer_map[target], event.channelID, packet.packet);
}
@@ -341,14 +404,14 @@ void NetworkedMultiplayerENet::poll() {
incoming_packets.push_back(packet);
}
- //destroy packet later..
+ // Destroy packet later
} else {
ERR_CONTINUE(true);
}
} break;
case ENET_EVENT_TYPE_NONE: {
- //do nothing
+ // Do nothing
} break;
}
}
@@ -360,10 +423,10 @@ bool NetworkedMultiplayerENet::is_server() const {
return server;
}
-void NetworkedMultiplayerENet::close_connection() {
+void NetworkedMultiplayerENet::close_connection(uint32_t wait_usec) {
- if (!active)
- return;
+ ERR_FAIL_COND(!active);
+ ERR_FAIL_COND(wait_usec < 0);
_pop_current_packet();
@@ -377,20 +440,54 @@ void NetworkedMultiplayerENet::close_connection() {
if (peers_disconnected) {
enet_host_flush(host);
- OS::get_singleton()->delay_usec(100); //wait 100ms for disconnection packets to send
+
+ if (wait_usec > 0) {
+ OS::get_singleton()->delay_usec(wait_usec); // Wait for disconnection packets to send
+ }
}
enet_host_destroy(host);
active = false;
incoming_packets.clear();
- unique_id = 1; //server is 1
+ unique_id = 1; // Server is 1
connection_status = CONNECTION_DISCONNECTED;
}
+void NetworkedMultiplayerENet::disconnect_peer(int p_peer, bool now) {
+
+ ERR_FAIL_COND(!active);
+ ERR_FAIL_COND(!is_server());
+ ERR_FAIL_COND(!peer_map.has(p_peer))
+
+ if (now) {
+ enet_peer_disconnect_now(peer_map[p_peer], 0);
+
+ // enet_peer_disconnect_now doesn't generate ENET_EVENT_TYPE_DISCONNECT,
+ // notify everyone else, send disconnect signal & remove from peer_map like in poll()
+
+ for (Map<int, ENetPeer *>::Element *E = peer_map.front(); E; E = E->next()) {
+
+ if (E->key() == p_peer)
+ continue;
+
+ ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
+ encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]);
+ encode_uint32(p_peer, &packet->data[4]);
+ enet_peer_send(E->get(), SYSCH_CONFIG, packet);
+ }
+
+ emit_signal("peer_disconnected", p_peer);
+ peer_map.erase(p_peer);
+ } else {
+ enet_peer_disconnect_later(peer_map[p_peer], 0);
+ }
+}
+
int NetworkedMultiplayerENet::get_available_packet_count() const {
return incoming_packets.size();
}
+
Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE);
@@ -405,6 +502,7 @@ Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buff
return OK;
}
+
Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
ERR_FAIL_COND_V(!active, ERR_UNCONFIGURED);
@@ -415,7 +513,10 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
switch (transfer_mode) {
case TRANSFER_MODE_UNRELIABLE: {
- packet_flags = ENET_PACKET_FLAG_UNSEQUENCED;
+ if (always_ordered)
+ packet_flags = 0;
+ else
+ packet_flags = ENET_PACKET_FLAG_UNSEQUENCED;
channel = SYSCH_UNRELIABLE;
} break;
case TRANSFER_MODE_UNRELIABLE_ORDERED: {
@@ -428,6 +529,9 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
} break;
}
+ if (transfer_channel > SYSCH_CONFIG)
+ channel = transfer_channel;
+
Map<int, ENetPeer *>::Element *E = NULL;
if (target_peer != 0) {
@@ -440,9 +544,9 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
}
ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 12, packet_flags);
- encode_uint32(unique_id, &packet->data[0]); //source ID
- encode_uint32(target_peer, &packet->data[4]); //dest ID
- encode_uint32(packet_flags, &packet->data[8]); //dest ID
+ encode_uint32(unique_id, &packet->data[0]); // Source ID
+ encode_uint32(target_peer, &packet->data[4]); // Dest ID
+ encode_uint32(packet_flags, &packet->data[8]); // Dest ID
copymem(&packet->data[12], p_buffer, p_buffer_size);
if (server) {
@@ -450,14 +554,14 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
if (target_peer == 0) {
enet_host_broadcast(host, channel, packet);
} else if (target_peer < 0) {
- //send to all but one
- //and make copies for sending
+ // Send to all but one
+ // and make copies for sending
int exclude = -target_peer;
for (Map<int, ENetPeer *>::Element *F = peer_map.front(); F; F = F->next()) {
- if (F->key() == exclude) // exclude packet
+ if (F->key() == exclude) // Exclude packet
continue;
ENetPacket *packet2 = enet_packet_create(packet->data, packet->dataLength, packet_flags);
@@ -465,14 +569,14 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
enet_peer_send(F->get(), channel, packet2);
}
- enet_packet_destroy(packet); //original packet no longer needed
+ enet_packet_destroy(packet); // Original packet no longer needed
} else {
enet_peer_send(E->get(), channel, packet);
}
} else {
ERR_FAIL_COND_V(!peer_map.has(1), ERR_BUG);
- enet_peer_send(peer_map[1], channel, packet); //send to server for broadcast..
+ enet_peer_send(peer_map[1], channel, packet); // Send to server for broadcast
}
enet_host_flush(host);
@@ -482,7 +586,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
int NetworkedMultiplayerENet::get_max_packet_size() const {
- return 1 << 24; //anything is good
+ return 1 << 24; // Anything is good
}
void NetworkedMultiplayerENet::_pop_current_packet() {
@@ -491,6 +595,7 @@ void NetworkedMultiplayerENet::_pop_current_packet() {
enet_packet_destroy(current_packet.packet);
current_packet.packet = NULL;
current_packet.from = 0;
+ current_packet.channel = -1;
}
}
@@ -511,16 +616,12 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const {
(uint32_t)OS::get_singleton()->get_unix_time(), hash);
hash = hash_djb2_one_32(
(uint32_t)OS::get_singleton()->get_user_data_dir().hash64(), hash);
- /*
hash = hash_djb2_one_32(
- (uint32_t)OS::get_singleton()->get_unique_id().hash64(), hash );
- */
+ (uint32_t)((uint64_t)this), hash); // Rely on ASLR heap
hash = hash_djb2_one_32(
- (uint32_t)((uint64_t)this), hash); //rely on aslr heap
- hash = hash_djb2_one_32(
- (uint32_t)((uint64_t)&hash), hash); //rely on aslr stack
+ (uint32_t)((uint64_t)&hash), hash); // Rely on ASLR stack
- hash = hash & 0x7FFFFFFF; // make it compatible with unsigned, since negatie id is used for exclusion
+ hash = hash & 0x7FFFFFFF; // Make it compatible with unsigned, since negative ID is used for exclusion
}
return hash;
@@ -596,7 +697,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
return 0;
if (ret > int(outLimit))
- return 0; //do not bother
+ return 0; // Do not bother
copymem(outData, enet->dst_compressor_mem.ptr(), ret);
@@ -651,19 +752,96 @@ void NetworkedMultiplayerENet::_setup_compressor() {
void NetworkedMultiplayerENet::enet_compressor_destroy(void *context) {
- //do none
+ // Nothing to do
+}
+
+IP_Address NetworkedMultiplayerENet::get_peer_address(int p_peer_id) const {
+
+ ERR_FAIL_COND_V(!peer_map.has(p_peer_id), IP_Address());
+ ERR_FAIL_COND_V(!is_server() && p_peer_id != 1, IP_Address());
+ ERR_FAIL_COND_V(peer_map[p_peer_id] == NULL, IP_Address());
+
+ IP_Address out;
+#ifdef GODOT_ENET
+ out.set_ipv6((uint8_t *)&(peer_map[p_peer_id]->address.host));
+#else
+ out.set_ipv4((uint8_t *)&(peer_map[p_peer_id]->address.host));
+#endif
+
+ return out;
+}
+
+int NetworkedMultiplayerENet::get_peer_port(int p_peer_id) const {
+
+ ERR_FAIL_COND_V(!peer_map.has(p_peer_id), 0);
+ ERR_FAIL_COND_V(!is_server() && p_peer_id != 1, 0);
+ ERR_FAIL_COND_V(peer_map[p_peer_id] == NULL, 0);
+#ifdef GODOT_ENET
+ return peer_map[p_peer_id]->address.port;
+#else
+ return peer_map[p_peer_id]->address.port;
+#endif
+}
+
+void NetworkedMultiplayerENet::set_transfer_channel(int p_channel) {
+
+ ERR_FAIL_COND(p_channel < -1 || p_channel >= channel_count);
+
+ if (p_channel == SYSCH_CONFIG) {
+ ERR_EXPLAIN("Channel " + itos(SYSCH_CONFIG) + " is reserved");
+ ERR_FAIL();
+ }
+ transfer_channel = p_channel;
+}
+
+int NetworkedMultiplayerENet::get_transfer_channel() const {
+ return transfer_channel;
+}
+
+void NetworkedMultiplayerENet::set_channel_count(int p_channel) {
+
+ ERR_FAIL_COND(active);
+ ERR_FAIL_COND(p_channel < SYSCH_MAX);
+ channel_count = p_channel;
+}
+
+int NetworkedMultiplayerENet::get_channel_count() const {
+ return channel_count;
+}
+
+void NetworkedMultiplayerENet::set_always_ordered(bool p_ordered) {
+ always_ordered = p_ordered;
+}
+
+bool NetworkedMultiplayerENet::is_always_ordered() const {
+ return always_ordered;
}
void NetworkedMultiplayerENet::_bind_methods() {
ClassDB::bind_method(D_METHOD("create_server", "port", "max_clients", "in_bandwidth", "out_bandwidth"), &NetworkedMultiplayerENet::create_server, DEFVAL(32), DEFVAL(0), DEFVAL(0));
- ClassDB::bind_method(D_METHOD("create_client", "ip", "port", "in_bandwidth", "out_bandwidth"), &NetworkedMultiplayerENet::create_client, DEFVAL(0), DEFVAL(0));
- ClassDB::bind_method(D_METHOD("close_connection"), &NetworkedMultiplayerENet::close_connection);
+ ClassDB::bind_method(D_METHOD("create_client", "address", "port", "in_bandwidth", "out_bandwidth", "client_port"), &NetworkedMultiplayerENet::create_client, DEFVAL(0), DEFVAL(0), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("close_connection", "wait_usec"), &NetworkedMultiplayerENet::close_connection, DEFVAL(100));
+ ClassDB::bind_method(D_METHOD("disconnect_peer", "id", "now"), &NetworkedMultiplayerENet::disconnect_peer, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_compression_mode", "mode"), &NetworkedMultiplayerENet::set_compression_mode);
ClassDB::bind_method(D_METHOD("get_compression_mode"), &NetworkedMultiplayerENet::get_compression_mode);
ClassDB::bind_method(D_METHOD("set_bind_ip", "ip"), &NetworkedMultiplayerENet::set_bind_ip);
+ ClassDB::bind_method(D_METHOD("get_peer_address", "id"), &NetworkedMultiplayerENet::get_peer_address);
+ ClassDB::bind_method(D_METHOD("get_peer_port", "id"), &NetworkedMultiplayerENet::get_peer_port);
+
+ ClassDB::bind_method(D_METHOD("get_packet_channel"), &NetworkedMultiplayerENet::get_packet_channel);
+ ClassDB::bind_method(D_METHOD("get_last_packet_channel"), &NetworkedMultiplayerENet::get_last_packet_channel);
+ ClassDB::bind_method(D_METHOD("set_transfer_channel", "channel"), &NetworkedMultiplayerENet::set_transfer_channel);
+ ClassDB::bind_method(D_METHOD("get_transfer_channel"), &NetworkedMultiplayerENet::get_transfer_channel);
+ ClassDB::bind_method(D_METHOD("set_channel_count", "channels"), &NetworkedMultiplayerENet::set_channel_count);
+ ClassDB::bind_method(D_METHOD("get_channel_count"), &NetworkedMultiplayerENet::get_channel_count);
+ ClassDB::bind_method(D_METHOD("set_always_ordered", "ordered"), &NetworkedMultiplayerENet::set_always_ordered);
+ ClassDB::bind_method(D_METHOD("is_always_ordered"), &NetworkedMultiplayerENet::is_always_ordered);
ADD_PROPERTY(PropertyInfo(Variant::INT, "compression_mode", PROPERTY_HINT_ENUM, "None,Range Coder,FastLZ,ZLib,ZStd"), "set_compression_mode", "get_compression_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_channel"), "set_transfer_channel", "get_transfer_channel");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "channel_count"), "set_channel_count", "get_channel_count");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "always_ordered"), "set_always_ordered", "is_always_ordered");
BIND_ENUM_CONSTANT(COMPRESS_NONE);
BIND_ENUM_CONSTANT(COMPRESS_RANGE_CODER);
@@ -681,6 +859,9 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
target_peer = 0;
current_packet.packet = NULL;
transfer_mode = TRANSFER_MODE_RELIABLE;
+ channel_count = SYSCH_MAX;
+ transfer_channel = -1;
+ always_ordered = false;
connection_status = CONNECTION_DISCONNECTED;
compression_mode = COMPRESS_NONE;
enet_compressor.context = this;
@@ -696,7 +877,7 @@ NetworkedMultiplayerENet::~NetworkedMultiplayerENet() {
close_connection();
}
-// sets IP for ENet to bind when using create_server
+// Sets IP for ENet to bind when using create_server or create_client
// if no IP is set, then ENet bind to ENET_HOST_ANY
void NetworkedMultiplayerENet::set_bind_ip(const IP_Address &p_ip) {
ERR_FAIL_COND(!p_ip.is_valid() && !p_ip.is_wildcard());
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 440e9b5400..705807d429 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -68,6 +68,9 @@ private:
int target_peer;
TransferMode transfer_mode;
+ int transfer_channel;
+ int channel_count;
+ bool always_ordered;
ENetEvent event;
ENetPeer *peer;
@@ -83,6 +86,7 @@ private:
ENetPacket *packet;
int from;
+ int channel;
};
CompressionMode compression_mode;
@@ -115,10 +119,15 @@ public:
virtual int get_packet_peer() const;
+ virtual IP_Address get_peer_address(int p_peer_id) const;
+ virtual int get_peer_port(int p_peer_id) const;
+
Error create_server(int p_port, int p_max_clients = 32, int p_in_bandwidth = 0, int p_out_bandwidth = 0);
- Error create_client(const IP_Address &p_ip, int p_port, int p_in_bandwidth = 0, int p_out_bandwidth = 0);
+ Error create_client(const String &p_address, int p_port, int p_in_bandwidth = 0, int p_out_bandwidth = 0, int p_client_port = 0);
+
+ void close_connection(uint32_t wait_usec = 100);
- void close_connection();
+ void disconnect_peer(int p_peer, bool now = false);
virtual void poll();
@@ -140,6 +149,15 @@ public:
void set_compression_mode(CompressionMode p_mode);
CompressionMode get_compression_mode() const;
+ int get_packet_channel() const;
+ int get_last_packet_channel() const;
+ void set_transfer_channel(int p_channel);
+ int get_transfer_channel() const;
+ void set_channel_count(int p_channel);
+ int get_channel_count() const;
+ void set_always_ordered(bool p_ordered);
+ bool is_always_ordered() const;
+
NetworkedMultiplayerENet();
~NetworkedMultiplayerENet();
diff --git a/modules/etc/config.py b/modules/etc/config.py
index 395fc1bb02..098f1eafa9 100644
--- a/modules/etc/config.py
+++ b/modules/etc/config.py
@@ -1,9 +1,5 @@
-def can_build(platform):
- return True
+def can_build(env, platform):
+ return env['tools']
def configure(env):
- # Tools only, disabled for non-tools
- # TODO: Find a cleaner way to achieve that
- if not env['tools']:
- env['module_etc_enabled'] = False
- env.disabled_modules.append("etc")
+ pass
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index a34a650a4d..301f218361 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -17,18 +17,15 @@ if env['builtin_freetype']:
"src/base/ftbitmap.c",
"src/base/ftcid.c",
"src/base/ftdebug.c",
- "src/base/ftfntfmt.c",
"src/base/ftfstype.c",
"src/base/ftgasp.c",
"src/base/ftglyph.c",
"src/base/ftgxval.c",
"src/base/ftinit.c",
- "src/base/ftlcdfil.c",
"src/base/ftmm.c",
"src/base/ftotval.c",
"src/base/ftpatent.c",
"src/base/ftpfr.c",
- "src/base/ftpic.c",
"src/base/ftstroke.c",
"src/base/ftsynth.c",
"src/base/ftsystem.c",
@@ -49,7 +46,6 @@ if env['builtin_freetype']:
"src/pshinter/pshinter.c",
"src/psnames/psnames.c",
"src/raster/raster.c",
- "src/sfnt/sfnt.c",
"src/smooth/smooth.c",
"src/truetype/truetype.c",
"src/type1/type1.c",
@@ -58,9 +54,18 @@ if env['builtin_freetype']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- # Include header for UWP to fix build issues
- if "platform" in env and env["platform"] == "uwp":
- env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
+ sfnt = thirdparty_dir + 'src/sfnt/sfnt.c'
+
+ if 'platform' in env:
+ if env['platform'] == 'uwp':
+ # Include header for UWP to fix build issues
+ env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
+ elif env['platform'] == 'javascript':
+ # Forcibly undefine this macro so SIMD is not used in this file,
+ # since currently unsuported in WASM
+ sfnt = env.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
+
+ thirdparty_sources += [sfnt]
env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
diff --git a/modules/freetype/config.py b/modules/freetype/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/freetype/config.py
+++ b/modules/freetype/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index acfb83bc10..116a86b27b 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -5,6 +5,7 @@ Import('env')
gdn_env = env.Clone()
gdn_env.add_source_files(env.modules_sources, "gdnative.cpp")
gdn_env.add_source_files(env.modules_sources, "register_types.cpp")
+gdn_env.add_source_files(env.modules_sources, "android/*.cpp")
gdn_env.add_source_files(env.modules_sources, "gdnative/*.cpp")
gdn_env.add_source_files(env.modules_sources, "nativescript/*.cpp")
gdn_env.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
@@ -12,6 +13,7 @@ gdn_env.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cp
gdn_env.Append(CPPPATH=['#modules/gdnative/include/'])
+SConscript("net/SCsub")
SConscript("arvr/SCsub")
SConscript("pluginscript/SCsub")
@@ -23,7 +25,8 @@ def _build_gdnative_api_struct_header(api):
'\textern const godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct;'
]
- for name in api['extensions']:
+ for ext in api['extensions']:
+ name = ext['name']
gdnative_api_init_macro.append(
'\textern const godot_gdnative_ext_{0}_api_struct *_gdnative_wrapper_{0}_api_struct;'.format(name))
@@ -31,9 +34,10 @@ def _build_gdnative_api_struct_header(api):
gdnative_api_init_macro.append('\tfor (unsigned int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { ')
gdnative_api_init_macro.append('\t\tswitch (_gdnative_wrapper_api_struct->extensions[i]->type) {')
- for name in api['extensions']:
+ for ext in api['extensions']:
+ name = ext['name']
gdnative_api_init_macro.append(
- '\t\t\tcase GDNATIVE_EXT_%s:' % api['extensions'][name]['type'])
+ '\t\t\tcase GDNATIVE_EXT_%s:' % ext['type'])
gdnative_api_init_macro.append(
'\t\t\t\t_gdnative_wrapper_{0}_api_struct = (godot_gdnative_ext_{0}_api_struct *)'
' _gdnative_wrapper_api_struct->extensions[i];'.format(name))
@@ -47,6 +51,7 @@ def _build_gdnative_api_struct_header(api):
'#define GODOT_GDNATIVE_API_STRUCT_H',
'',
'#include <gdnative/gdnative.h>',
+ '#include <android/godot_android.h>',
'#include <arvr/godot_arvr.h>',
'#include <nativescript/godot_nativescript.h>',
'#include <pluginscript/godot_pluginscript.h>',
@@ -61,8 +66,8 @@ def _build_gdnative_api_struct_header(api):
'\tGDNATIVE_' + api['core']['type'] + ','
]
- for name in api['extensions']:
- out += ['\tGDNATIVE_EXT_' + api['extensions'][name]['type'] + ',']
+ for ext in api['extensions']:
+ out += ['\tGDNATIVE_EXT_' + ext['type'] + ',']
out += ['};', '']
@@ -88,8 +93,9 @@ def _build_gdnative_api_struct_header(api):
return ret_val
- for name in api['extensions']:
- out += generate_extension_struct(name, api['extensions'][name], False)
+ for ext in api['extensions']:
+ name = ext['name']
+ out += generate_extension_struct(name, ext, False)
out += [
'typedef struct godot_gdnative_core_api_struct {',
@@ -151,12 +157,14 @@ def _build_gdnative_api_struct_source(api):
return ret_val
- for name in api['extensions']:
- out += get_extension_struct_definition(name, api['extensions'][name], False)
+ for ext in api['extensions']:
+ name = ext['name']
+ out += get_extension_struct_definition(name, ext, False)
out += ['', 'const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {']
- for name in api['extensions']:
+ for ext in api['extensions']:
+ name = ext['name']
out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,']
out += ['};\n']
@@ -189,7 +197,7 @@ def build_gdnative_api_struct(target, source, env):
with open(source.path, 'w') as fd:
fd.write(_build_gdnative_api_struct_source(api))
-_, gensource = gdn_env.Command(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'],
+_, gensource = gdn_env.CommandNoCache(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'],
'gdnative_api.json', build_gdnative_api_struct)
gdn_env.add_source_files(env.modules_sources, [gensource])
@@ -214,7 +222,8 @@ def _build_gdnative_wrapper_code(api):
'godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct = 0;',
]
- for name in api['extensions']:
+ for ext in api['extensions']:
+ name = ext['name']
out.append('godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct = 0;')
out += ['']
@@ -232,8 +241,9 @@ def _build_gdnative_wrapper_code(api):
out.append('}')
out.append('')
- for name in api['extensions']:
- for funcdef in api['extensions'][name]['api']:
+ for ext in api['extensions']:
+ name = ext['name']
+ for funcdef in ext['api']:
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args))
@@ -267,16 +277,16 @@ def build_gdnative_wrapper_code(target, source, env):
if ARGUMENTS.get('gdnative_wrapper', False):
- #build wrapper code
- gensource, = gdn_env.Command('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code)
+#build wrapper code
+ gensource, = gdn_env.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code)
gd_wrapper_env = env.Clone()
gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
if gd_wrapper_env['use_lto']:
if not env.msvc:
- gd_wrapper_env.Append(CCFLAGS=['--no-lto'])
- gd_wrapper_env.Append(LINKFLAGS=['--no-lto'])
+ gd_wrapper_env.Append(CCFLAGS=['-fno-lto'])
+ gd_wrapper_env.Append(LINKFLAGS=['-fno-lto'])
else:
gd_wrapper_env.Append(CCFLAGS=['/GL-'])
gd_wrapper_env.Append(LINKFLAGS=['/LTCG:OFF'])
diff --git a/modules/gdnative/android/android_gdn.cpp b/modules/gdnative/android/android_gdn.cpp
new file mode 100644
index 0000000000..edc948e086
--- /dev/null
+++ b/modules/gdnative/android/android_gdn.cpp
@@ -0,0 +1,73 @@
+/*************************************************************************/
+/* android_gdn.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "modules/gdnative/gdnative.h"
+
+// Code by Paritosh97 with minor tweaks by Mux213
+// These entry points are only for the android platform and are simple stubs in all others.
+
+#ifdef __ANDROID__
+#include "platform/android/thread_jandroid.h"
+#else
+#define JNIEnv void
+#define jobject void *
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEnv *GDAPI godot_android_get_env() {
+#ifdef __ANDROID__
+ return ThreadAndroid::get_env();
+#else
+ return NULL;
+#endif
+}
+
+jobject GDAPI godot_android_get_activity() {
+#ifdef __ANDROID__
+ JNIEnv *env = ThreadAndroid::get_env();
+
+ jclass activityThread = env->FindClass("android/app/ActivityThread");
+ jmethodID currentActivityThread = env->GetStaticMethodID(activityThread, "currentActivityThread", "()Landroid/app/ActivityThread;");
+ jobject at = env->CallStaticObjectMethod(activityThread, currentActivityThread);
+ jmethodID getApplication = env->GetMethodID(activityThread, "getApplication", "()Landroid/app/Application;");
+ jobject context = env->CallObjectMethod(at, getApplication);
+
+ return env->NewGlobalRef(context);
+#else
+ return NULL;
+#endif
+}
+
+#ifdef __cplusplus
+}
+#endif \ No newline at end of file
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
index 49e0a19d9e..385c020a78 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
@@ -217,6 +217,10 @@ void ARVRInterfaceGDNative::process() {
extern "C" {
void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) {
+ // If our major version is 0 or bigger then 10, we're likely looking at our constructor pointer from an older plugin
+ ERR_EXPLAINC("GDNative ARVR interfaces build for Godot 3.0 are not supported");
+ ERR_FAIL_COND((p_interface->version.major == 0) || (p_interface->version.major > 10));
+
Ref<ARVRInterfaceGDNative> new_interface;
new_interface.instance();
new_interface->set_interface((godot_arvr_interface_gdnative *const)p_interface);
diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py
index 68148c4d87..c5b37d35b4 100644
--- a/modules/gdnative/config.py
+++ b/modules/gdnative/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
@@ -10,6 +10,7 @@ def get_doc_classes():
"GDNative",
"GDNativeLibrary",
"NativeScript",
+ "PacketPeerGDNative",
"PluginScript",
]
diff --git a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
index 998460eee1..be86ff0541 100644
--- a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
+++ b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.1-dev">
+<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.1">
<brief_description>
GDNative wrapper for an ARVR interface
</brief_description>
diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml
index 4e87cbf450..ca0457623f 100644
--- a/modules/gdnative/doc_classes/GDNative.xml
+++ b/modules/gdnative/doc_classes/GDNative.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNative" inherits="Reference" category="Core" version="3.1-dev">
+<class name="GDNative" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml
index ca1bae0598..754a6d2514 100644
--- a/modules/gdnative/doc_classes/GDNativeLibrary.xml
+++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.1-dev">
+<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
@@ -9,12 +9,6 @@
<demos>
</demos>
<methods>
- <method name="get_config_file">
- <return type="ConfigFile">
- </return>
- <description>
- </description>
- </method>
<method name="get_current_dependencies" qualifiers="const">
<return type="PoolStringArray">
</return>
@@ -29,6 +23,8 @@
</method>
</methods>
<members>
+ <member name="config_file" type="ConfigFile" setter="set_config_file" getter="get_config_file">
+ </member>
<member name="load_once" type="bool" setter="set_load_once" getter="should_load_once">
</member>
<member name="reloadable" type="bool" setter="set_reloadable" getter="is_reloadable">
diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml
index 6a71cd8d4d..1d3053244b 100644
--- a/modules/gdnative/doc_classes/NativeScript.xml
+++ b/modules/gdnative/doc_classes/NativeScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NativeScript" inherits="Script" category="Core" version="3.1-dev">
+<class name="NativeScript" inherits="Script" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/doc_classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml
index 3783d9d0a4..27c6adae3f 100644
--- a/modules/gdnative/doc_classes/PluginScript.xml
+++ b/modules/gdnative/doc_classes/PluginScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PluginScript" inherits="Script" category="Core" version="3.1-dev">
+<class name="PluginScript" inherits="Script" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 42c3028f2c..e7ebcc73af 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -66,8 +66,169 @@ GDNativeLibrary::GDNativeLibrary() {
GDNativeLibrary::~GDNativeLibrary() {
}
+bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_property) {
+
+ String name = p_name;
+
+ if (name.begins_with("entry/")) {
+ String key = name.substr(6, name.length() - 6);
+
+ config_file->set_value("entry", key, p_property);
+
+ set_config_file(config_file);
+
+ return true;
+ }
+
+ if (name.begins_with("dependency/")) {
+ String key = name.substr(11, name.length() - 11);
+
+ config_file->set_value("dependencies", key, p_property);
+
+ set_config_file(config_file);
+
+ return true;
+ }
+
+ return false;
+}
+
+bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_property) const {
+ String name = p_name;
+
+ if (name.begins_with("entry/")) {
+ String key = name.substr(6, name.length() - 6);
+
+ r_property = config_file->get_value("entry", key);
+
+ return true;
+ }
+
+ if (name.begins_with("dependency/")) {
+ String key = name.substr(11, name.length() - 11);
+
+ r_property = config_file->get_value("dependencies", key);
+
+ return true;
+ }
+
+ return false;
+}
+
+void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
+ // set entries
+ List<String> entry_key_list;
+
+ if (config_file->has_section("entry"))
+ config_file->get_section_keys("entry", &entry_key_list);
+
+ for (List<String>::Element *E = entry_key_list.front(); E; E = E->next()) {
+ String key = E->get();
+
+ PropertyInfo prop;
+
+ prop.type = Variant::STRING;
+ prop.name = "entry/" + key;
+
+ p_list->push_back(prop);
+ }
+
+ // set dependencies
+ List<String> dependency_key_list;
+
+ if (config_file->has_section("dependencies"))
+ config_file->get_section_keys("dependencies", &dependency_key_list);
+
+ for (List<String>::Element *E = dependency_key_list.front(); E; E = E->next()) {
+ String key = E->get();
+
+ PropertyInfo prop;
+
+ prop.type = Variant::STRING;
+ prop.name = "dependency/" + key;
+
+ p_list->push_back(prop);
+ }
+}
+
+void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) {
+
+ set_singleton(p_config_file->get_value("general", "singleton", default_singleton));
+ set_load_once(p_config_file->get_value("general", "load_once", default_load_once));
+ set_symbol_prefix(p_config_file->get_value("general", "symbol_prefix", default_symbol_prefix));
+ set_reloadable(p_config_file->get_value("general", "reloadable", default_reloadable));
+
+ String entry_lib_path;
+ {
+
+ List<String> entry_keys;
+
+ if (p_config_file->has_section("entry"))
+ p_config_file->get_section_keys("entry", &entry_keys);
+
+ for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = OS::get_singleton()->has_feature(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ entry_lib_path = p_config_file->get_value("entry", key);
+ break;
+ }
+ }
+
+ Vector<String> dependency_paths;
+ {
+
+ List<String> dependency_keys;
+
+ if (p_config_file->has_section("dependencies"))
+ p_config_file->get_section_keys("dependencies", &dependency_keys);
+
+ for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) {
+ String key = E->get();
+
+ Vector<String> tags = key.split(".");
+
+ bool skip = false;
+ for (int i = 0; i < tags.size(); i++) {
+ bool has_feature = OS::get_singleton()->has_feature(tags[i]);
+
+ if (!has_feature) {
+ skip = true;
+ break;
+ }
+ }
+
+ if (skip) {
+ continue;
+ }
+
+ dependency_paths = p_config_file->get_value("dependencies", key);
+ break;
+ }
+ }
+
+ current_library_path = entry_lib_path;
+ current_dependencies = dependency_paths;
+}
+
void GDNativeLibrary::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_config_file"), &GDNativeLibrary::get_config_file);
+ ClassDB::bind_method(D_METHOD("set_config_file", "config_file"), &GDNativeLibrary::set_config_file);
ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path);
ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies);
@@ -82,6 +243,8 @@ void GDNativeLibrary::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix);
ClassDB::bind_method(D_METHOD("set_reloadable", "reloadable"), &GDNativeLibrary::set_reloadable);
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "config_file", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"), "set_config_file", "get_config_file");
+
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton");
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "symbol_prefix"), "set_symbol_prefix", "get_symbol_prefix");
@@ -306,7 +469,9 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced
godot_variant result = E->get()(procedure_handle, (godot_array *)&p_arguments);
- return *(Variant *)&result;
+ Variant res = *(Variant *)&result;
+ godot_variant_destroy(&result);
+ return res;
}
Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional) {
@@ -337,73 +502,7 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or
*r_error = err;
}
- lib->set_singleton(config->get_value("general", "singleton", default_singleton));
- lib->set_load_once(config->get_value("general", "load_once", default_load_once));
- lib->set_symbol_prefix(config->get_value("general", "symbol_prefix", default_symbol_prefix));
- lib->set_reloadable(config->get_value("general", "reloadable", default_reloadable));
-
- String entry_lib_path;
- {
-
- List<String> entry_keys;
- config->get_section_keys("entry", &entry_keys);
-
- for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) {
- String key = E->get();
-
- Vector<String> tags = key.split(".");
-
- bool skip = false;
- for (int i = 0; i < tags.size(); i++) {
- bool has_feature = OS::get_singleton()->has_feature(tags[i]);
-
- if (!has_feature) {
- skip = true;
- break;
- }
- }
-
- if (skip) {
- continue;
- }
-
- entry_lib_path = config->get_value("entry", key);
- break;
- }
- }
-
- Vector<String> dependency_paths;
- {
-
- List<String> dependency_keys;
- config->get_section_keys("dependencies", &dependency_keys);
-
- for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) {
- String key = E->get();
-
- Vector<String> tags = key.split(".");
-
- bool skip = false;
- for (int i = 0; i < tags.size(); i++) {
- bool has_feature = OS::get_singleton()->has_feature(tags[i]);
-
- if (!has_feature) {
- skip = true;
- break;
- }
- }
-
- if (skip) {
- continue;
- }
-
- dependency_paths = config->get_value("dependencies", key);
- break;
- }
- }
-
- lib->current_library_path = entry_lib_path;
- lib->current_dependencies = dependency_paths;
+ lib->set_config_file(config);
return lib;
}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 3298ea950f..b17bb94f1c 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -66,8 +66,14 @@ public:
GDNativeLibrary();
~GDNativeLibrary();
+ virtual bool _set(const StringName &p_name, const Variant &p_property);
+ virtual bool _get(const StringName &p_name, Variant &r_property) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+
_FORCE_INLINE_ Ref<ConfigFile> get_config_file() { return config_file; }
+ void set_config_file(Ref<ConfigFile> p_config_file);
+
// things that change per-platform
// so there are no setters for this
_FORCE_INLINE_ String get_current_library_path() const {
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index a8919f7130..217fd87c3e 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -5756,8 +5756,9 @@
}
]
},
- "extensions": {
- "nativescript": {
+ "extensions": [
+ {
+ "name": "nativescript",
"type": "NATIVESCRIPT",
"version": {
"major": 1,
@@ -5822,6 +5823,23 @@
]
},
{
+ "name": "godot_nativescript_set_global_type_tag",
+ "return_type": "void",
+ "arguments": [
+ ["int", "p_idx"],
+ ["const char *", "p_name"],
+ ["const void *", "p_type_tag"]
+ ]
+ },
+ {
+ "name": "godot_nativescript_get_global_type_tag",
+ "return_type": "const void *",
+ "arguments": [
+ ["int", "p_idx"],
+ ["const char *", "p_name"]
+ ]
+ },
+ {
"name": "godot_nativescript_set_type_tag",
"return_type": "void",
"arguments": [
@@ -5925,7 +5943,8 @@
}
]
},
- "pluginscript": {
+ {
+ "name": "pluginscript",
"type": "PLUGINSCRIPT",
"version": {
"major": 1,
@@ -5942,8 +5961,9 @@
}
]
},
- "arvr": {
- "type": "ARVR",
+ {
+ "name": "android",
+ "type": "ANDROID",
"version": {
"major": 1,
"minor": 0
@@ -5951,6 +5971,29 @@
"next": null,
"api": [
{
+ "name": "godot_android_get_env",
+ "return_type": "JNIEnv*",
+ "arguments": [
+ ]
+ },
+ {
+ "name": "godot_android_get_activity",
+ "return_type": "jobject",
+ "arguments": [
+ ]
+ }
+ ]
+ },
+ {
+ "name": "arvr",
+ "type": "ARVR",
+ "version": {
+ "major": 1,
+ "minor": 1
+ },
+ "next": null,
+ "api": [
+ {
"name": "godot_arvr_register_interface",
"return_type": "void",
"arguments": [
@@ -6038,5 +6081,5 @@
}
]
}
- }
+ ]
}
diff --git a/modules/gdnative/include/android/godot_android.h b/modules/gdnative/include/android/godot_android.h
new file mode 100644
index 0000000000..832dac9ac3
--- /dev/null
+++ b/modules/gdnative/include/android/godot_android.h
@@ -0,0 +1,54 @@
+/*************************************************************************/
+/* godot_android.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GODOT_ANDROID_GDN_H
+#define GODOT_ANDROID_GDN_H
+
+#include <gdnative/gdnative.h>
+
+#ifdef __ANDROID__
+#include <jni.h>
+#else
+#define JNIEnv void
+#define jobject void *
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEnv *GDAPI godot_android_get_env();
+jobject GDAPI godot_android_get_activity();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !GODOT_ANDROID_GDN_H */
diff --git a/modules/gdnative/include/arvr/godot_arvr.h b/modules/gdnative/include/arvr/godot_arvr.h
index b9aedc0bef..63de62b507 100644
--- a/modules/gdnative/include/arvr/godot_arvr.h
+++ b/modules/gdnative/include/arvr/godot_arvr.h
@@ -37,7 +37,15 @@
extern "C" {
#endif
+// For future versions of the API we should only add new functions at the end of the structure and use the
+// version info to detect whether a call is available
+
+// Use these to populate version in your plugin
+#define GODOTVR_API_MAJOR 1
+#define GODOTVR_API_MINOR 0
+
typedef struct {
+ godot_gdnative_api_version version; /* version of our API */
void *(*constructor)(godot_object *);
void (*destructor)(void *);
godot_string (*get_name)(const void *);
diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h
index 747328bc41..f28ba352ab 100644
--- a/modules/gdnative/include/nativescript/godot_nativescript.h
+++ b/modules/gdnative/include/nativescript/godot_nativescript.h
@@ -43,6 +43,9 @@ typedef enum {
GODOT_METHOD_RPC_MODE_SYNC,
GODOT_METHOD_RPC_MODE_MASTER,
GODOT_METHOD_RPC_MODE_SLAVE,
+ GODOT_METHOD_RPC_MODE_REMOTESYNC,
+ GODOT_METHOD_RPC_MODE_MASTERSYNC,
+ GODOT_METHOD_RPC_MODE_SLAVESYNC,
} godot_method_rpc_mode;
typedef enum {
@@ -214,16 +217,19 @@ void GDAPI godot_nativescript_set_signal_documentation(void *p_gdnative_handle,
// type tag API
+void GDAPI godot_nativescript_set_global_type_tag(int p_idx, const char *p_name, const void *p_type_tag);
+const void GDAPI *godot_nativescript_get_global_type_tag(int p_idx, const char *p_name);
+
void GDAPI godot_nativescript_set_type_tag(void *p_gdnative_handle, const char *p_name, const void *p_type_tag);
const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object);
// instance binding API
typedef struct {
- void *(*alloc_instance_binding_data)(void *, godot_object *);
- void (*free_instance_binding_data)(void *, void *);
+ GDCALLINGCONV void *(*alloc_instance_binding_data)(void *, const void *, godot_object *);
+ GDCALLINGCONV void (*free_instance_binding_data)(void *, void *);
void *data;
- void (*free_func)(void *);
+ GDCALLINGCONV void (*free_func)(void *);
} godot_instance_binding_functions;
int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions);
diff --git a/modules/gdnative/include/net/godot_net.h b/modules/gdnative/include/net/godot_net.h
new file mode 100644
index 0000000000..bfa688592d
--- /dev/null
+++ b/modules/gdnative/include/net/godot_net.h
@@ -0,0 +1,118 @@
+/*************************************************************************/
+/* godot_net.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GODOT_NATIVENET_H
+#define GODOT_NATIVENET_H
+
+#include <gdnative/gdnative.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// For future versions of the API we should only add new functions at the end of the structure and use the
+// version info to detect whether a call is available
+
+// Use these to populate version in your plugin
+#define GODOT_NET_API_MAJOR 3
+#define GODOT_NET_API_MINOR 1
+
+typedef struct {
+
+ godot_gdnative_api_version version; /* version of our API */
+ godot_object *data; /* User reference */
+
+ /* This is StreamPeer */
+ godot_error (*get_data)(void *user, uint8_t *p_buffer, int p_bytes);
+ godot_error (*get_partial_data)(void *user, uint8_t *p_buffer, int p_bytes, int &r_received);
+ godot_error (*put_data)(void *user, const uint8_t *p_data, int p_bytes);
+ godot_error (*put_partial_data)(void *user, const uint8_t *p_data, int p_bytes, int &r_sent);
+
+ int (*get_available_bytes)(const void *user);
+
+ void *next; /* For extension? */
+} godot_net_stream_peer;
+
+/* Binds a StreamPeerGDNative to the provided interface */
+void godot_net_bind_stream_peer(godot_object *p_obj, godot_net_stream_peer *p_interface);
+
+typedef struct {
+ godot_gdnative_api_version version; /* version of our API */
+
+ godot_object *data; /* User reference */
+
+ /* This is PacketPeer */
+ godot_error (*get_packet)(void *, const uint8_t **, int &);
+ godot_error (*put_packet)(void *, const uint8_t *, int);
+ godot_int (*get_available_packet_count)(const void *);
+ godot_int (*get_max_packet_size)(const void *);
+
+ void *next; /* For extension? */
+} godot_net_packet_peer;
+
+/* Binds a PacketPeerGDNative to the provided interface */
+void GDAPI godot_net_bind_packet_peer(godot_object *p_obj, const godot_net_packet_peer *);
+
+typedef struct {
+ godot_gdnative_api_version version; /* version of our API */
+
+ godot_object *data; /* User reference */
+
+ /* This is PacketPeer */
+ godot_error (*get_packet)(void *, const uint8_t **, int &);
+ godot_error (*put_packet)(void *, const uint8_t *, int);
+ godot_int (*get_available_packet_count)(const void *);
+ godot_int (*get_max_packet_size)(const void *);
+
+ /* This is NetworkedMultiplayerPeer */
+ void (*set_transfer_mode)(void *, godot_int);
+ godot_int (*get_transfer_mode)(const void *);
+ // 0 = broadcast, 1 = server, <0 = all but abs(value)
+ void (*set_target_peer)(void *, godot_int);
+ godot_int (*get_packet_peer)(const void *);
+ godot_bool (*is_server)(const void *);
+ void (*poll)(void *);
+ // Must be > 0, 1 is for server
+ int32_t (*get_unique_id)(const void *);
+ void (*set_refuse_new_connections)(void *, godot_bool);
+ godot_bool (*is_refusing_new_connections)(const void *);
+ godot_int (*get_connection_status)(const void *);
+
+ void *next; /* For extension? Or maybe not... */
+} godot_net_multiplayer_peer;
+
+/* Binds a MultiplayerPeerGDNative to the provided interface */
+void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_multiplayer_peer *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GODOT_NATIVENET_H */
diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp
index aea595d0f0..ace2ecac5c 100644
--- a/modules/gdnative/nativescript/godot_nativescript.cpp
+++ b/modules/gdnative/nativescript/godot_nativescript.cpp
@@ -313,6 +313,14 @@ void GDAPI godot_nativescript_set_signal_documentation(void *p_gdnative_handle,
signal->get().documentation = *(String *)&p_documentation;
}
+void GDAPI godot_nativescript_set_global_type_tag(int p_idx, const char *p_name, const void *p_type_tag) {
+ NativeScriptLanguage::get_singleton()->set_global_type_tag(p_idx, StringName(p_name), p_type_tag);
+}
+
+const void GDAPI *godot_nativescript_get_global_type_tag(int p_idx, const char *p_name) {
+ return NativeScriptLanguage::get_singleton()->get_global_type_tag(p_idx, StringName(p_name));
+}
+
void GDAPI godot_nativescript_set_type_tag(void *p_gdnative_handle, const char *p_name, const void *p_type_tag) {
String *s = (String *)p_gdnative_handle;
@@ -331,13 +339,11 @@ const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object)
const Object *o = (Object *)p_object;
if (!o->get_script_instance()) {
- ERR_EXPLAIN("Attempted to get type tag on an object without a script!");
- ERR_FAIL_V(NULL);
+ return NULL;
} else {
NativeScript *script = Object::cast_to<NativeScript>(o->get_script_instance()->get_script().ptr());
if (!script) {
- ERR_EXPLAIN("Attempted to get type tag on an object without a nativescript attached");
- ERR_FAIL_V(NULL);
+ return NULL;
}
if (script->get_script_desc())
@@ -347,10 +353,6 @@ const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object)
return NULL;
}
-#ifdef __cplusplus
-}
-#endif
-
int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions) {
return NativeScriptLanguage::get_singleton()->register_binding_functions(p_binding_functions);
}
@@ -362,3 +364,7 @@ void GDAPI godot_nativescript_unregister_instance_binding_data_functions(int p_i
void GDAPI *godot_nativescript_get_instance_binding_data(int p_idx, godot_object *p_object) {
return NativeScriptLanguage::get_singleton()->get_instance_binding_data(p_idx, (Object *)p_object);
}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index f2e9bef467..d6abbc1bcf 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -55,12 +55,6 @@
#include "editor/editor_node.h"
#endif
-//
-//
-// Script stuff
-//
-//
-
void NativeScript::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name);
ClassDB::bind_method(D_METHOD("get_class_name"), &NativeScript::get_class_name);
@@ -363,14 +357,13 @@ void NativeScript::get_script_property_list(List<PropertyInfo> *p_list) const {
NativeScriptDesc *script_data = get_script_desc();
Set<StringName> existing_properties;
+ List<PropertyInfo>::Element *original_back = p_list->back();
while (script_data) {
- List<PropertyInfo>::Element *insert_position = p_list->front();
- bool insert_before = true;
+ List<PropertyInfo>::Element *insert_position = original_back;
for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.front(); E; E = E.next()) {
if (!existing_properties.has(E.key())) {
- insert_position = insert_before ? p_list->insert_before(insert_position, E.get().info) : p_list->insert_after(insert_position, E.get().info);
- insert_before = false;
+ insert_position = p_list->insert_after(insert_position, E.get().info);
existing_properties.insert(E.key());
}
}
@@ -528,12 +521,6 @@ NativeScript::~NativeScript() {
#endif
}
- //
- //
- // ScriptInstance stuff
- //
- //
-
#define GET_SCRIPT_DESC() script->get_script_desc()
void NativeScriptInstance::_ml_call_reversed(NativeScriptDesc *script_data, const StringName &p_method, const Variant **p_args, int p_argcount) {
@@ -760,7 +747,7 @@ Ref<Script> NativeScriptInstance::get_script() const {
return script;
}
-NativeScriptInstance::RPCMode NativeScriptInstance::get_rpc_mode(const StringName &p_method) const {
+MultiplayerAPI::RPCMode NativeScriptInstance::get_rpc_mode(const StringName &p_method) const {
NativeScriptDesc *script_data = GET_SCRIPT_DESC();
@@ -770,27 +757,33 @@ NativeScriptInstance::RPCMode NativeScriptInstance::get_rpc_mode(const StringNam
if (E) {
switch (E->get().rpc_mode) {
case GODOT_METHOD_RPC_MODE_DISABLED:
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
case GODOT_METHOD_RPC_MODE_REMOTE:
- return RPC_MODE_REMOTE;
+ return MultiplayerAPI::RPC_MODE_REMOTE;
case GODOT_METHOD_RPC_MODE_SYNC:
- return RPC_MODE_SYNC;
+ return MultiplayerAPI::RPC_MODE_SYNC;
case GODOT_METHOD_RPC_MODE_MASTER:
- return RPC_MODE_MASTER;
+ return MultiplayerAPI::RPC_MODE_MASTER;
case GODOT_METHOD_RPC_MODE_SLAVE:
- return RPC_MODE_SLAVE;
+ return MultiplayerAPI::RPC_MODE_SLAVE;
+ case GODOT_METHOD_RPC_MODE_REMOTESYNC:
+ return MultiplayerAPI::RPC_MODE_REMOTESYNC;
+ case GODOT_METHOD_RPC_MODE_MASTERSYNC:
+ return MultiplayerAPI::RPC_MODE_MASTERSYNC;
+ case GODOT_METHOD_RPC_MODE_SLAVESYNC:
+ return MultiplayerAPI::RPC_MODE_SLAVESYNC;
default:
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
}
script_data = script_data->base_data;
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
-NativeScriptInstance::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_variable) const {
+MultiplayerAPI::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_variable) const {
NativeScriptDesc *script_data = GET_SCRIPT_DESC();
@@ -800,24 +793,24 @@ NativeScriptInstance::RPCMode NativeScriptInstance::get_rset_mode(const StringNa
if (E) {
switch (E.get().rset_mode) {
case GODOT_METHOD_RPC_MODE_DISABLED:
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
case GODOT_METHOD_RPC_MODE_REMOTE:
- return RPC_MODE_REMOTE;
+ return MultiplayerAPI::RPC_MODE_REMOTE;
case GODOT_METHOD_RPC_MODE_SYNC:
- return RPC_MODE_SYNC;
+ return MultiplayerAPI::RPC_MODE_SYNC;
case GODOT_METHOD_RPC_MODE_MASTER:
- return RPC_MODE_MASTER;
+ return MultiplayerAPI::RPC_MODE_MASTER;
case GODOT_METHOD_RPC_MODE_SLAVE:
- return RPC_MODE_SLAVE;
+ return MultiplayerAPI::RPC_MODE_SLAVE;
default:
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
}
script_data = script_data->base_data;
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
ScriptLanguage *NativeScriptInstance::get_language() {
@@ -872,15 +865,12 @@ NativeScriptInstance::~NativeScriptInstance() {
}
}
-//
-//
-// ScriptingLanguage stuff
-//
-//
-
NativeScriptLanguage *NativeScriptLanguage::singleton;
void NativeScriptLanguage::_unload_stuff(bool p_reload) {
+
+ Map<String, Ref<GDNative> > erase_and_unload;
+
for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) {
String lib_path = L->key();
@@ -916,18 +906,6 @@ void NativeScriptLanguage::_unload_stuff(bool p_reload) {
gdn = E->get();
}
- if (gdn.is_valid() && gdn->get_library().is_valid()) {
- Ref<GDNativeLibrary> lib = gdn->get_library();
- void *terminate_fn;
- Error err = gdn->get_symbol(lib->get_symbol_prefix() + _terminate_call_name, terminate_fn, true);
-
- if (err == OK) {
- void (*terminate)(void *) = (void (*)(void *))terminate_fn;
-
- terminate((void *)&lib_path);
- }
- }
-
for (Map<StringName, NativeScriptDesc>::Element *C = classes.front(); C; C = C->next()) {
// free property stuff first
@@ -952,12 +930,34 @@ void NativeScriptLanguage::_unload_stuff(bool p_reload) {
if (C->get().destroy_func.free_func)
C->get().destroy_func.free_func(C->get().destroy_func.method_data);
}
+
+ erase_and_unload.insert(lib_path, gdn);
+ }
+
+ for (Map<String, Ref<GDNative> >::Element *E = erase_and_unload.front(); E; E = E->next()) {
+ String lib_path = E->key();
+ Ref<GDNative> gdn = E->get();
+
+ library_classes.erase(lib_path);
+
+ if (gdn.is_valid() && gdn->get_library().is_valid()) {
+ Ref<GDNativeLibrary> lib = gdn->get_library();
+ void *terminate_fn;
+ Error err = gdn->get_symbol(lib->get_symbol_prefix() + _terminate_call_name, terminate_fn, true);
+
+ if (err == OK) {
+ void (*terminate)(void *) = (void (*)(void *))terminate_fn;
+
+ terminate((void *)&lib_path);
+ }
+ }
}
}
NativeScriptLanguage::NativeScriptLanguage() {
NativeScriptLanguage::singleton = this;
#ifndef NO_THREADS
+ has_objects_to_register = false;
mutex = Mutex::create();
#endif
}
@@ -1182,8 +1182,11 @@ void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_objec
}
if (!(*binding_data)[p_idx]) {
+
+ const void *global_type_tag = global_type_tags[p_idx].get(p_object->get_class_name());
+
// no binding data yet, soooooo alloc new one \o/
- (*binding_data)[p_idx] = binding_functions[p_idx].second.alloc_instance_binding_data(binding_functions[p_idx].second.data, (godot_object *)p_object);
+ (*binding_data)[p_idx] = binding_functions[p_idx].second.alloc_instance_binding_data(binding_functions[p_idx].second.data, global_type_tag, (godot_object *)p_object);
}
return (*binding_data)[p_idx];
@@ -1225,6 +1228,27 @@ void NativeScriptLanguage::free_instance_binding_data(void *p_data) {
delete &binding_data;
}
+void NativeScriptLanguage::set_global_type_tag(int p_idx, StringName p_class_name, const void *p_type_tag) {
+ if (!global_type_tags.has(p_idx)) {
+ global_type_tags.insert(p_idx, HashMap<StringName, const void *>());
+ }
+
+ HashMap<StringName, const void *> &tags = global_type_tags[p_idx];
+
+ tags.set(p_class_name, p_type_tag);
+}
+
+const void *NativeScriptLanguage::get_global_type_tag(int p_idx, StringName p_class_name) const {
+ if (!global_type_tags.has(p_idx))
+ return NULL;
+
+ const HashMap<StringName, const void *> &tags = global_type_tags[p_idx];
+
+ const void *tag = tags.get(p_class_name);
+
+ return tag;
+}
+
#ifndef NO_THREADS
void NativeScriptLanguage::defer_init_library(Ref<GDNativeLibrary> lib, NativeScript *script) {
MutexLock lock(mutex);
@@ -1362,6 +1386,7 @@ void NativeReloadNode::_notification(int p_what) {
MutexLock lock(NSL->mutex);
#endif
NSL->_unload_stuff(true);
+
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
Ref<GDNative> gdn = L->get();
@@ -1375,7 +1400,6 @@ void NativeReloadNode::_notification(int p_what) {
}
gdn->terminate();
- NSL->library_classes.erase(L->key());
}
unloaded = true;
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index 17b6ddc747..b47962dc37 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -36,6 +36,7 @@
#include "core/self_list.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
+#include "oa_hash_map.h"
#include "ordered_hash_map.h"
#include "os/thread_safe.h"
#include "scene/main/node.h"
@@ -195,8 +196,8 @@ public:
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
virtual void notification(int p_notification);
virtual Ref<Script> get_script() const;
- virtual RPCMode get_rpc_mode(const StringName &p_method) const;
- virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
virtual ScriptLanguage *get_language();
virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
@@ -240,6 +241,8 @@ private:
Vector<Pair<bool, godot_instance_binding_functions> > binding_functions;
Set<Vector<void *> *> binding_instances;
+ Map<int, HashMap<StringName, const void *> > global_type_tags;
+
public:
// These two maps must only be touched on the main thread
Map<String, Map<StringName, NativeScriptDesc> > library_classes;
@@ -323,6 +326,9 @@ public:
virtual void *alloc_instance_binding_data(Object *p_object);
virtual void free_instance_binding_data(void *p_data);
+
+ void set_global_type_tag(int p_idx, StringName p_class_name, const void *p_type_tag);
+ const void *get_global_type_tag(int p_idx, StringName p_class_name) const;
};
inline NativeScriptDesc *NativeScript::get_script_desc() const {
diff --git a/modules/gdnative/net/SCsub b/modules/gdnative/net/SCsub
new file mode 100644
index 0000000000..53f9271128
--- /dev/null
+++ b/modules/gdnative/net/SCsub
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+import os
+import methods
+
+Import('env')
+Import('env_modules')
+
+env_net_gdnative = env_modules.Clone()
+
+env_net_gdnative.Append(CPPPATH=['#modules/gdnative/include/'])
+env_net_gdnative.add_source_files(env.modules_sources, '*.cpp')
diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.cpp b/modules/gdnative/net/multiplayer_peer_gdnative.cpp
new file mode 100644
index 0000000000..e2d710b5ad
--- /dev/null
+++ b/modules/gdnative/net/multiplayer_peer_gdnative.cpp
@@ -0,0 +1,124 @@
+/*************************************************************************/
+/* multiplayer_peer_gdnative.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 "multiplayer_peer_gdnative.h"
+
+MultiplayerPeerGDNative::MultiplayerPeerGDNative() {
+ interface = NULL;
+}
+
+MultiplayerPeerGDNative::~MultiplayerPeerGDNative() {
+}
+
+void MultiplayerPeerGDNative::set_native_multiplayer_peer(const godot_net_multiplayer_peer *p_interface) {
+ interface = p_interface;
+}
+
+Error MultiplayerPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->get_packet(interface->data, r_buffer, r_buffer_size);
+}
+
+Error MultiplayerPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
+}
+
+int MultiplayerPeerGDNative::get_max_packet_size() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_max_packet_size(interface->data);
+}
+
+int MultiplayerPeerGDNative::get_available_packet_count() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_available_packet_count(interface->data);
+}
+
+/* NetworkedMultiplayerPeer */
+void MultiplayerPeerGDNative::set_transfer_mode(TransferMode p_mode) {
+ ERR_FAIL_COND(interface == NULL);
+ interface->set_transfer_mode(interface->data, (godot_int)p_mode);
+}
+
+NetworkedMultiplayerPeer::TransferMode MultiplayerPeerGDNative::get_transfer_mode() const {
+ ERR_FAIL_COND_V(interface == NULL, TRANSFER_MODE_UNRELIABLE);
+ return (TransferMode)interface->get_transfer_mode(interface->data);
+}
+
+void MultiplayerPeerGDNative::set_target_peer(int p_peer_id) {
+ ERR_FAIL_COND(interface == NULL);
+ interface->set_target_peer(interface->data, p_peer_id);
+}
+
+int MultiplayerPeerGDNative::get_packet_peer() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_packet_peer(interface->data);
+}
+
+bool MultiplayerPeerGDNative::is_server() const {
+ ERR_FAIL_COND_V(interface == NULL, false);
+ return interface->is_server(interface->data);
+}
+
+void MultiplayerPeerGDNative::poll() {
+ ERR_FAIL_COND(interface == NULL);
+ interface->poll(interface->data);
+}
+
+int MultiplayerPeerGDNative::get_unique_id() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_unique_id(interface->data);
+}
+
+void MultiplayerPeerGDNative::set_refuse_new_connections(bool p_enable) {
+ ERR_FAIL_COND(interface == NULL);
+ interface->set_refuse_new_connections(interface->data, p_enable);
+}
+
+bool MultiplayerPeerGDNative::is_refusing_new_connections() const {
+ ERR_FAIL_COND_V(interface == NULL, true);
+ return interface->is_refusing_new_connections(interface->data);
+}
+
+NetworkedMultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status() const {
+ ERR_FAIL_COND_V(interface == NULL, CONNECTION_DISCONNECTED);
+ return (ConnectionStatus)interface->get_connection_status(interface->data);
+}
+
+void MultiplayerPeerGDNative::_bind_methods() {
+}
+
+extern "C" {
+
+void GDAPI godot_net_bind_multiplayer_peer(godot_object *p_obj, const godot_net_multiplayer_peer *p_impl) {
+
+ ((MultiplayerPeerGDNative *)p_obj)->set_native_multiplayer_peer(p_impl);
+}
+}
diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.h b/modules/gdnative/net/multiplayer_peer_gdnative.h
new file mode 100644
index 0000000000..c8c95b3dd7
--- /dev/null
+++ b/modules/gdnative/net/multiplayer_peer_gdnative.h
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* multiplayer_peer_gdnative.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 MULTIPLAYER_PEER_GDNATIVE_H
+#define MULTIPLAYER_PEER_GDNATIVE_H
+
+#include "core/io/networked_multiplayer_peer.h"
+#include "modules/gdnative/gdnative.h"
+#include "modules/gdnative/include/net/godot_net.h"
+
+class MultiplayerPeerGDNative : public NetworkedMultiplayerPeer {
+ GDCLASS(MultiplayerPeerGDNative, NetworkedMultiplayerPeer)
+
+protected:
+ static void _bind_methods();
+ const godot_net_multiplayer_peer *interface;
+
+public:
+ MultiplayerPeerGDNative();
+ ~MultiplayerPeerGDNative();
+
+ /* Sets the interface implementation from GDNative */
+ void set_native_multiplayer_peer(const godot_net_multiplayer_peer *p_impl);
+
+ /* Specific to PacketPeer */
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
+ virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
+ virtual int get_max_packet_size() const;
+ virtual int get_available_packet_count() const;
+
+ /* Specific to NetworkedMultiplayerPeer */
+ virtual void set_transfer_mode(TransferMode p_mode);
+ virtual TransferMode get_transfer_mode() const;
+ virtual void set_target_peer(int p_peer_id);
+
+ virtual int get_packet_peer() const;
+
+ virtual bool is_server() const;
+
+ virtual void poll();
+
+ virtual int get_unique_id() const;
+
+ virtual void set_refuse_new_connections(bool p_enable);
+ virtual bool is_refusing_new_connections() const;
+
+ virtual ConnectionStatus get_connection_status() const;
+};
+
+#endif // MULTIPLAYER_PEER_GDNATIVE_H
diff --git a/modules/gdnative/net/packet_peer_gdnative.cpp b/modules/gdnative/net/packet_peer_gdnative.cpp
new file mode 100644
index 0000000000..ceae79edc0
--- /dev/null
+++ b/modules/gdnative/net/packet_peer_gdnative.cpp
@@ -0,0 +1,73 @@
+/*************************************************************************/
+/* packet_peer_gdnative.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 "packet_peer_gdnative.h"
+
+PacketPeerGDNative::PacketPeerGDNative() {
+ interface = NULL;
+}
+
+PacketPeerGDNative::~PacketPeerGDNative() {
+}
+
+void PacketPeerGDNative::set_native_packet_peer(const godot_net_packet_peer *p_impl) {
+ interface = p_impl;
+}
+
+void PacketPeerGDNative::_bind_methods() {
+}
+
+Error PacketPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->get_packet(interface->data, r_buffer, r_buffer_size);
+}
+
+Error PacketPeerGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
+}
+
+int PacketPeerGDNative::get_max_packet_size() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_max_packet_size(interface->data);
+}
+
+int PacketPeerGDNative::get_available_packet_count() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_available_packet_count(interface->data);
+}
+
+extern "C" {
+
+void GDAPI godot_net_bind_packet_peer(godot_object *p_obj, const godot_net_packet_peer *p_impl) {
+
+ ((PacketPeerGDNative *)p_obj)->set_native_packet_peer(p_impl);
+}
+}
diff --git a/modules/gdnative/net/packet_peer_gdnative.h b/modules/gdnative/net/packet_peer_gdnative.h
new file mode 100644
index 0000000000..71814177ed
--- /dev/null
+++ b/modules/gdnative/net/packet_peer_gdnative.h
@@ -0,0 +1,59 @@
+/*************************************************************************/
+/* packet_peer_gdnative.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 PACKET_PEER_GDNATIVE_H
+#define PACKET_PEER_GDNATIVE_H
+
+#include "core/io/packet_peer.h"
+#include "modules/gdnative/gdnative.h"
+#include "modules/gdnative/include/net/godot_net.h"
+
+class PacketPeerGDNative : public PacketPeer {
+ GDCLASS(PacketPeerGDNative, PacketPeer)
+
+protected:
+ static void _bind_methods();
+ const godot_net_packet_peer *interface;
+
+public:
+ PacketPeerGDNative();
+ ~PacketPeerGDNative();
+
+ /* Sets the interface implementation from GDNative */
+ void set_native_packet_peer(const godot_net_packet_peer *p_impl);
+
+ /* Specific to PacketPeer */
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
+ virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
+ virtual int get_max_packet_size() const;
+ virtual int get_available_packet_count() const;
+};
+
+#endif // PACKET_PEER_GDNATIVE_H
diff --git a/modules/gdnative/net/register_types.cpp b/modules/gdnative/net/register_types.cpp
new file mode 100644
index 0000000000..c3fb4d8008
--- /dev/null
+++ b/modules/gdnative/net/register_types.cpp
@@ -0,0 +1,43 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "register_types.h"
+#include "multiplayer_peer_gdnative.h"
+#include "packet_peer_gdnative.h"
+#include "stream_peer_gdnative.h"
+
+void register_net_types() {
+ ClassDB::register_class<MultiplayerPeerGDNative>();
+ ClassDB::register_class<PacketPeerGDNative>();
+ ClassDB::register_class<StreamPeerGDNative>();
+}
+
+void unregister_net_types() {
+}
diff --git a/modules/gdnative/net/register_types.h b/modules/gdnative/net/register_types.h
new file mode 100644
index 0000000000..9545a2ba8f
--- /dev/null
+++ b/modules/gdnative/net/register_types.h
@@ -0,0 +1,32 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+void register_net_types();
+void unregister_net_types();
diff --git a/modules/gdnative/net/stream_peer_gdnative.cpp b/modules/gdnative/net/stream_peer_gdnative.cpp
new file mode 100644
index 0000000000..4d1f2ec9a5
--- /dev/null
+++ b/modules/gdnative/net/stream_peer_gdnative.cpp
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* stream_peer_gdnative.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 "stream_peer_gdnative.h"
+
+StreamPeerGDNative::StreamPeerGDNative() {
+ interface = NULL;
+}
+
+StreamPeerGDNative::~StreamPeerGDNative() {
+}
+
+void StreamPeerGDNative::set_native_stream_peer(godot_net_stream_peer *p_interface) {
+ interface = p_interface;
+}
+
+void StreamPeerGDNative::_bind_methods() {
+}
+
+Error StreamPeerGDNative::put_data(const uint8_t *p_data, int p_bytes) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)(interface->put_data(interface->data, p_data, p_bytes));
+}
+
+Error StreamPeerGDNative::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)(interface->put_partial_data(interface->data, p_data, p_bytes, r_sent));
+}
+
+Error StreamPeerGDNative::get_data(uint8_t *p_buffer, int p_bytes) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)(interface->get_data(interface->data, p_buffer, p_bytes));
+}
+
+Error StreamPeerGDNative::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
+ ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ return (Error)(interface->get_partial_data(interface->data, p_buffer, p_bytes, r_received));
+}
+
+int StreamPeerGDNative::get_available_bytes() const {
+ ERR_FAIL_COND_V(interface == NULL, 0);
+ return interface->get_available_bytes(interface->data);
+}
+
+extern "C" {
+
+void GDAPI godot_net_bind_stream_peer(godot_object *p_obj, godot_net_stream_peer *p_interface) {
+ ((StreamPeerGDNative *)p_obj)->set_native_stream_peer(p_interface);
+}
+}
diff --git a/modules/gdnative/net/stream_peer_gdnative.h b/modules/gdnative/net/stream_peer_gdnative.h
new file mode 100644
index 0000000000..654234e6ab
--- /dev/null
+++ b/modules/gdnative/net/stream_peer_gdnative.h
@@ -0,0 +1,61 @@
+/*************************************************************************/
+/* stream_peer_gdnative.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 STREAM_PEER_GDNATIVE_H
+#define STREAM_PEER_GDNATIVE_H
+
+#include "core/io/stream_peer.h"
+#include "modules/gdnative/gdnative.h"
+#include "modules/gdnative/include/net/godot_net.h"
+
+class StreamPeerGDNative : public StreamPeer {
+
+ GDCLASS(StreamPeerGDNative, StreamPeer);
+
+protected:
+ static void _bind_methods();
+ godot_net_stream_peer *interface;
+
+public:
+ StreamPeerGDNative();
+ ~StreamPeerGDNative();
+
+ /* Sets the interface implementation from GDNative */
+ void set_native_stream_peer(godot_net_stream_peer *p_interface);
+
+ /* Specific to StreamPeer */
+ Error put_data(const uint8_t *p_data, int p_bytes);
+ Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent);
+ Error get_data(uint8_t *p_buffer, int p_bytes);
+ Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received);
+ int get_available_bytes() const;
+};
+
+#endif // STREAM_PEER_GDNATIVE_H
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp
index 931ab0bfe4..13026e8e7a 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp
@@ -138,11 +138,11 @@ void PluginScriptInstance::notification(int p_notification) {
_desc->notification(_data, p_notification);
}
-ScriptInstance::RPCMode PluginScriptInstance::get_rpc_mode(const StringName &p_method) const {
+MultiplayerAPI::RPCMode PluginScriptInstance::get_rpc_mode(const StringName &p_method) const {
return _script->get_rpc_mode(p_method);
}
-ScriptInstance::RPCMode PluginScriptInstance::get_rset_mode(const StringName &p_variable) const {
+MultiplayerAPI::RPCMode PluginScriptInstance::get_rset_mode(const StringName &p_variable) const {
return _script->get_rset_mode(p_variable);
}
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h
index 3c7b360ad9..8be6a4ccaa 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.h
+++ b/modules/gdnative/pluginscript/pluginscript_instance.h
@@ -76,8 +76,8 @@ public:
void set_path(const String &p_path);
- virtual RPCMode get_rpc_mode(const StringName &p_method) const;
- virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
virtual void refcount_incremented();
virtual bool refcount_decremented();
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 5ae7926f1b..c3a623e9a1 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -84,35 +84,20 @@ StringName PluginScript::get_instance_base_type() const {
}
void PluginScript::update_exports() {
-// TODO
#ifdef TOOLS_ENABLED
-#if 0
ASSERT_SCRIPT_VALID();
- if (/*changed &&*/ placeholders.size()) { //hm :(
+ if (placeholders.size()) {
//update placeholders if any
Map<StringName, Variant> propdefvalues;
List<PropertyInfo> propinfos;
- const String *props = (const String *)pybind_get_prop_list(_py_exposed_class);
- for (int i = 0; props[i] != ""; ++i) {
- const String propname = props[i];
- pybind_get_prop_default_value(_py_exposed_class, propname.c_str(), (godot_variant *)&propdefvalues[propname]);
- pybind_prop_info raw_info;
- pybind_get_prop_info(_py_exposed_class, propname.c_str(), &raw_info);
- PropertyInfo info;
- info.type = (Variant::Type)raw_info.type;
- info.name = propname;
- info.hint = (PropertyHint)raw_info.hint;
- info.hint_string = *(String *)&raw_info.hint_string;
- info.usage = raw_info.usage;
- propinfos.push_back(info);
- }
+
+ get_script_property_list(&propinfos);
for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) {
- E->get()->update(propinfos, propdefvalues);
+ E->get()->update(propinfos, _properties_default_values);
}
}
#endif
-#endif
}
// TODO: rename p_this "p_owner" ?
@@ -245,9 +230,9 @@ Error PluginScript::reload(bool p_keep_state) {
// rpc_mode is passed as an optional field and is not part of MethodInfo
Variant var = v["rpc_mode"];
if (var == Variant()) {
- _methods_rpc_mode[mi.name] = ScriptInstance::RPC_MODE_DISABLED;
+ _methods_rpc_mode[mi.name] = MultiplayerAPI::RPC_MODE_DISABLED;
} else {
- _methods_rpc_mode[mi.name] = ScriptInstance::RPCMode(int(var));
+ _methods_rpc_mode[mi.name] = MultiplayerAPI::RPCMode(int(var));
}
}
Array *signals = (Array *)&manifest.signals;
@@ -265,9 +250,9 @@ Error PluginScript::reload(bool p_keep_state) {
// rset_mode is passed as an optional field and is not part of PropertyInfo
Variant var = v["rset_mode"];
if (var == Variant()) {
- _methods_rpc_mode[pi.name] = ScriptInstance::RPC_MODE_DISABLED;
+ _methods_rpc_mode[pi.name] = MultiplayerAPI::RPC_MODE_DISABLED;
} else {
- _methods_rpc_mode[pi.name] = ScriptInstance::RPCMode(int(var));
+ _methods_rpc_mode[pi.name] = MultiplayerAPI::RPCMode(int(var));
}
}
// Manifest's attributes must be explicitly freed
@@ -402,23 +387,23 @@ int PluginScript::get_member_line(const StringName &p_member) const {
return -1;
}
-ScriptInstance::RPCMode PluginScript::get_rpc_mode(const StringName &p_method) const {
- ASSERT_SCRIPT_VALID_V(ScriptInstance::RPC_MODE_DISABLED);
- const Map<StringName, ScriptInstance::RPCMode>::Element *e = _methods_rpc_mode.find(p_method);
+MultiplayerAPI::RPCMode PluginScript::get_rpc_mode(const StringName &p_method) const {
+ ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED);
+ const Map<StringName, MultiplayerAPI::RPCMode>::Element *e = _methods_rpc_mode.find(p_method);
if (e != NULL) {
return e->get();
} else {
- return ScriptInstance::RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
}
-ScriptInstance::RPCMode PluginScript::get_rset_mode(const StringName &p_variable) const {
- ASSERT_SCRIPT_VALID_V(ScriptInstance::RPC_MODE_DISABLED);
- const Map<StringName, ScriptInstance::RPCMode>::Element *e = _variables_rset_mode.find(p_variable);
+MultiplayerAPI::RPCMode PluginScript::get_rset_mode(const StringName &p_variable) const {
+ ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED);
+ const Map<StringName, MultiplayerAPI::RPCMode>::Element *e = _variables_rset_mode.find(p_variable);
if (e != NULL) {
return e->get();
} else {
- return ScriptInstance::RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
}
diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h
index 1be9e907c2..31c6c4d67f 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.h
+++ b/modules/gdnative/pluginscript/pluginscript_script.h
@@ -62,8 +62,8 @@ private:
Map<StringName, PropertyInfo> _properties_info;
Map<StringName, MethodInfo> _signals_info;
Map<StringName, MethodInfo> _methods_info;
- Map<StringName, ScriptInstance::RPCMode> _variables_rset_mode;
- Map<StringName, ScriptInstance::RPCMode> _methods_rpc_mode;
+ Map<StringName, MultiplayerAPI::RPCMode> _variables_rset_mode;
+ Map<StringName, MultiplayerAPI::RPCMode> _methods_rpc_mode;
Set<Object *> _instances;
//exported members
@@ -116,8 +116,8 @@ public:
virtual int get_member_line(const StringName &p_member) const;
- ScriptInstance::RPCMode get_rpc_mode(const StringName &p_method) const;
- ScriptInstance::RPCMode get_rset_mode(const StringName &p_variable) const;
+ MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
+ MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
PluginScript();
void init(PluginScriptLanguage *language);
diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp
index 8888f9e157..924abf29df 100644
--- a/modules/gdnative/pluginscript/register_types.cpp
+++ b/modules/gdnative/pluginscript/register_types.cpp
@@ -64,7 +64,7 @@ static Error _check_language_desc(const godot_pluginscript_language_desc *desc)
// desc->make_function is not mandatory
// desc->complete_code is not mandatory
// desc->auto_indent_code is not mandatory
- // desc->add_global_constant is not mandatory
+ ERR_FAIL_COND_V(!desc->add_global_constant, ERR_BUG);
// desc->debug_get_error is not mandatory
// desc->debug_get_stack_level_count is not mandatory
// desc->debug_get_stack_level_line is not mandatory
@@ -78,7 +78,7 @@ static Error _check_language_desc(const godot_pluginscript_language_desc *desc)
// desc->profiling_stop is not mandatory
// desc->profiling_get_accumulated_data is not mandatory
// desc->profiling_get_frame_data is not mandatory
- // desc->frame is not mandatory
+ // desc->profiling_frame is not mandatory
ERR_FAIL_COND_V(!desc->script_desc.init, ERR_BUG);
ERR_FAIL_COND_V(!desc->script_desc.finish, ERR_BUG);
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index a0b6fbeb75..d18297f2f8 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -38,6 +38,7 @@
#include "arvr/register_types.h"
#include "nativescript/register_types.h"
+#include "net/register_types.h"
#include "pluginscript/register_types.h"
#include "core/engine.h"
@@ -321,6 +322,7 @@ void register_gdnative_types() {
GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall);
+ register_net_types();
register_arvr_types();
register_nativescript_types();
register_pluginscript_types();
@@ -379,6 +381,7 @@ void unregister_gdnative_types() {
unregister_pluginscript_types();
unregister_nativescript_types();
unregister_arvr_types();
+ unregister_net_types();
memdelete(GDNativeCallRegistry::singleton);
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 13870170a5..73f09f1659 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -7,4 +7,7 @@ env_gdscript = env_modules.Clone()
env_gdscript.add_source_files(env.modules_sources, "*.cpp")
+if env['tools']:
+ env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp")
+
Export('env')
diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py
index 6496b59d75..95b40d90af 100644
--- a/modules/gdscript/config.py
+++ b/modules/gdscript/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/gdscript/doc_classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml
index 0dc69c3688..632970f8c0 100644
--- a/modules/gdscript/doc_classes/GDScript.xml
+++ b/modules/gdscript/doc_classes/GDScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDScript" inherits="Script" category="Core" version="3.1-dev">
+<class name="GDScript" inherits="Script" category="Core" version="3.1">
<brief_description>
A script implemented in the GDScript programming language.
</brief_description>
@@ -8,7 +8,7 @@
[method new] creates a new instance of the script. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/scripting/gdscript/index.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/scripting/gdscript/index.html</link>
</tutorials>
<demos>
</demos>
diff --git a/modules/gdscript/doc_classes/GDScriptFunctionState.xml b/modules/gdscript/doc_classes/GDScriptFunctionState.xml
index 254d968e1b..c205cedef5 100644
--- a/modules/gdscript/doc_classes/GDScriptFunctionState.xml
+++ b/modules/gdscript/doc_classes/GDScriptFunctionState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.1-dev">
+<class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.1">
<brief_description>
State of a function call after yielding.
</brief_description>
diff --git a/modules/gdscript/doc_classes/GDScriptNativeClass.xml b/modules/gdscript/doc_classes/GDScriptNativeClass.xml
index 1abcc4762f..90935b5c22 100644
--- a/modules/gdscript/doc_classes/GDScriptNativeClass.xml
+++ b/modules/gdscript/doc_classes/GDScriptNativeClass.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDScriptNativeClass" inherits="Reference" category="Core" version="3.1-dev">
+<class name="GDScriptNativeClass" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
new file mode 100644
index 0000000000..fedc510f01
--- /dev/null
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -0,0 +1,337 @@
+/*************************************************************************/
+/* gdscript_highlighter.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "gdscript_highlighter.h"
+#include "../gdscript_tokenizer.h"
+#include "editor/editor_settings.h"
+#include "scene/gui/text_edit.h"
+
+inline bool _is_symbol(CharType c) {
+
+ return is_symbol(c);
+}
+
+static bool _is_text_char(CharType c) {
+
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
+}
+
+static bool _is_whitespace(CharType c) {
+ return c == '\t' || c == ' ';
+}
+
+static bool _is_char(CharType c) {
+
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
+}
+
+static bool _is_number(CharType c) {
+ return (c >= '0' && c <= '9');
+}
+
+static bool _is_hex_symbol(CharType c) {
+ return ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
+}
+
+Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_highlighting(int p_line) {
+ Map<int, TextEdit::HighlighterInfo> color_map;
+
+ Type next_type = NONE;
+ Type current_type = NONE;
+ Type previous_type = NONE;
+
+ String previous_text = "";
+ int previous_column = 0;
+
+ bool prev_is_char = false;
+ bool prev_is_number = false;
+ bool in_keyword = false;
+ bool in_word = false;
+ bool in_function_name = false;
+ bool in_member_variable = false;
+ bool in_node_path = false;
+ bool is_hex_notation = false;
+ Color keyword_color;
+ Color color;
+
+ int in_region = text_editor->_is_line_in_region(p_line);
+ int deregion = 0;
+
+ const Map<int, TextEdit::Text::ColorRegionInfo> cri_map = text_editor->_get_line_color_region_info(p_line);
+ const String &str = text_editor->get_line(p_line);
+ Color prev_color;
+ for (int j = 0; j < str.length(); j++) {
+ TextEdit::HighlighterInfo highlighter_info;
+
+ if (deregion > 0) {
+ deregion--;
+ if (deregion == 0) {
+ in_region = -1;
+ }
+ }
+
+ if (deregion != 0) {
+ if (color != prev_color) {
+ prev_color = color;
+ highlighter_info.color = color;
+ color_map[j] = highlighter_info;
+ }
+ continue;
+ }
+
+ color = font_color;
+
+ bool is_char = _is_text_char(str[j]);
+ bool is_symbol = _is_symbol(str[j]);
+ bool is_number = _is_number(str[j]);
+
+ // allow ABCDEF in hex notation
+ if (is_hex_notation && (_is_hex_symbol(str[j]) || is_number)) {
+ is_number = true;
+ } else {
+ is_hex_notation = false;
+ }
+
+ // check for dot or underscore or 'x' for hex notation in floating point number
+ if ((str[j] == '.' || str[j] == 'x' || str[j] == '_') && !in_word && prev_is_number && !is_number) {
+ is_number = true;
+ is_symbol = false;
+ is_char = false;
+
+ if (str[j] == 'x' && str[j - 1] == '0') {
+ is_hex_notation = true;
+ }
+ }
+
+ if (!in_word && _is_char(str[j]) && !is_number) {
+ in_word = true;
+ }
+
+ if ((in_keyword || in_word) && !is_hex_notation) {
+ is_number = false;
+ }
+
+ if (is_symbol && str[j] != '.' && in_word) {
+ in_word = false;
+ }
+
+ if (is_symbol && cri_map.has(j)) {
+ const TextEdit::Text::ColorRegionInfo &cri = cri_map[j];
+
+ if (in_region == -1) {
+ if (!cri.end) {
+ in_region = cri.region;
+ }
+ } else {
+ TextEdit::ColorRegion cr = text_editor->_get_color_region(cri.region);
+ if (in_region == cri.region && !cr.line_only) { //ignore otherwise
+ if (cri.end || cr.eq) {
+ deregion = cr.eq ? cr.begin_key.length() : cr.end_key.length();
+ }
+ }
+ }
+ }
+
+ if (!is_char) {
+ in_keyword = false;
+ }
+
+ if (in_region == -1 && !in_keyword && is_char && !prev_is_char) {
+
+ int to = j;
+ while (to < str.length() && _is_text_char(str[to]))
+ to++;
+
+ String word = str.substr(j, to - j);
+ Color col = Color();
+ if (text_editor->has_keyword_color(word)) {
+ col = text_editor->get_keyword_color(word);
+ } else if (text_editor->has_member_color(word)) {
+ col = text_editor->get_member_color(word);
+ for (int k = j - 1; k >= 0; k--) {
+ if (str[k] == '.') {
+ col = Color(); //member indexing not allowed
+ break;
+ } else if (str[k] > 32) {
+ break;
+ }
+ }
+ }
+
+ if (col != Color()) {
+ in_keyword = true;
+ keyword_color = col;
+ }
+ }
+
+ if (!in_function_name && in_word && !in_keyword) {
+
+ int k = j;
+ while (k < str.length() && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') {
+ k++;
+ }
+
+ // check for space between name and bracket
+ while (k < str.length() && (str[k] == '\t' || str[k] == ' ')) {
+ k++;
+ }
+
+ if (str[k] == '(') {
+ in_function_name = true;
+ }
+ }
+
+ if (!in_function_name && !in_member_variable && !in_keyword && !is_number && in_word) {
+ int k = j;
+ while (k > 0 && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') {
+ k--;
+ }
+
+ if (str[k] == '.') {
+ in_member_variable = true;
+ }
+ }
+
+ if (is_symbol) {
+ in_function_name = false;
+ in_member_variable = false;
+ }
+
+ if (!in_node_path && in_region == -1 && str[j] == '$') {
+ in_node_path = true;
+ } else if (in_region != -1 || (is_symbol && str[j] != '/')) {
+ in_node_path = false;
+ }
+
+ if (in_region >= 0) {
+ next_type = REGION;
+ color = text_editor->_get_color_region(in_region).color;
+ } else if (in_node_path) {
+ next_type = NODE_PATH;
+ color = node_path_color;
+ } else if (in_keyword) {
+ next_type = KEYWORD;
+ color = keyword_color;
+ } else if (in_member_variable) {
+ next_type = MEMBER;
+ color = member_color;
+ } else if (in_function_name) {
+ next_type = FUNCTION;
+
+ if (previous_text == GDScriptTokenizer::get_token_name(GDScriptTokenizer::TK_PR_FUNCTION)) {
+ color = function_definition_color;
+ } else {
+ color = function_color;
+ }
+ } else if (is_symbol) {
+ next_type = SYMBOL;
+ color = symbol_color;
+ } else if (is_number) {
+ next_type = NUMBER;
+ color = number_color;
+ } else {
+ next_type = IDENTIFIER;
+ }
+
+ if (next_type != current_type) {
+ if (current_type == NONE) {
+ current_type = next_type;
+ } else {
+ previous_type = current_type;
+ current_type = next_type;
+
+ // no need to store regions...
+ if (previous_type == REGION) {
+ previous_text = "";
+ previous_column = j;
+ } else {
+ String text = str.substr(previous_column, j - previous_column).strip_edges();
+ previous_column = j;
+
+ // ignore if just whitespace
+ if (text != "") {
+ previous_text = text;
+ }
+ }
+ }
+ }
+
+ prev_is_char = is_char;
+ prev_is_number = is_number;
+
+ if (color != prev_color) {
+ prev_color = color;
+ highlighter_info.color = color;
+ color_map[j] = highlighter_info;
+ }
+ }
+ return color_map;
+}
+
+String GDScriptSyntaxHighlighter::get_name() {
+ return "GDScript";
+}
+
+List<String> GDScriptSyntaxHighlighter::get_supported_languages() {
+ List<String> languages;
+ languages.push_back("GDScript");
+ return languages;
+}
+
+void GDScriptSyntaxHighlighter::_update_cache() {
+ font_color = text_editor->get_color("font_color");
+ symbol_color = text_editor->get_color("symbol_color");
+ function_color = text_editor->get_color("function_color");
+ number_color = text_editor->get_color("number_color");
+ member_color = text_editor->get_color("member_variable_color");
+
+ EditorSettings *settings = EditorSettings::get_singleton();
+ String text_editor_color_theme = settings->get("text_editor/theme/color_theme");
+
+ bool default_theme = text_editor_color_theme == "Default";
+ bool dark_theme = settings->is_dark_theme();
+
+ function_definition_color = Color::html(default_theme ? "#01e1ff" : dark_theme ? "#01e1ff" : "#00a5ba");
+ node_path_color = Color::html(default_theme ? "#64c15a" : dark_theme ? "64c15a" : "#518b4b");
+
+ EDITOR_DEF("text_editor/highlighting/gdscript/function_definition_color", function_definition_color);
+ EDITOR_DEF("text_editor/highlighting/gdscript/node_path_color", node_path_color);
+ if (text_editor_color_theme == "Adaptive" || default_theme) {
+ settings->set_initial_value("text_editor/highlighting/gdscript/function_definition_color", function_definition_color, true);
+ settings->set_initial_value("text_editor/highlighting/gdscript/node_path_color", node_path_color, true);
+ }
+
+ function_definition_color = EDITOR_GET("text_editor/highlighting/gdscript/function_definition_color");
+ node_path_color = EDITOR_GET("text_editor/highlighting/gdscript/node_path_color");
+}
+
+SyntaxHighlighter *GDScriptSyntaxHighlighter::create() {
+ return memnew(GDScriptSyntaxHighlighter);
+}
diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h
new file mode 100644
index 0000000000..0296ab7652
--- /dev/null
+++ b/modules/gdscript/editor/gdscript_highlighter.h
@@ -0,0 +1,70 @@
+/*************************************************************************/
+/* gdscript_highlighter.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GDSCRIPT_HIGHLIGHTER_H
+#define GDSCRIPT_HIGHLIGHTER_H
+
+#include "scene/gui/text_edit.h"
+
+class GDScriptSyntaxHighlighter : public SyntaxHighlighter {
+private:
+ enum Type {
+ NONE,
+ REGION,
+ NODE_PATH,
+ SYMBOL,
+ NUMBER,
+ FUNCTION,
+ KEYWORD,
+ MEMBER,
+ IDENTIFIER
+ };
+
+ // colours
+ Color font_color;
+ Color symbol_color;
+ Color function_color;
+ Color function_definition_color;
+ Color built_in_type_color;
+ Color number_color;
+ Color member_color;
+ Color node_path_color;
+
+public:
+ static SyntaxHighlighter *create();
+
+ virtual void _update_cache();
+ virtual Map<int, TextEdit::HighlighterInfo> _get_line_syntax_highlighting(int p_line);
+
+ virtual String get_name();
+ virtual List<String> get_supported_languages();
+};
+
+#endif // GDSCRIPT_HIGHLIGHTER_H
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 4e3ee4d22c..f23e7854a5 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -1220,7 +1220,7 @@ ScriptLanguage *GDScriptInstance::get_language() {
return GDScriptLanguage::get_singleton();
}
-GDScriptInstance::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_method) const {
+MultiplayerAPI::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_method) const {
const GDScript *cscript = script.ptr();
@@ -1228,17 +1228,17 @@ GDScriptInstance::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_met
const Map<StringName, GDScriptFunction *>::Element *E = cscript->member_functions.find(p_method);
if (E) {
- if (E->get()->get_rpc_mode() != RPC_MODE_DISABLED) {
+ if (E->get()->get_rpc_mode() != MultiplayerAPI::RPC_MODE_DISABLED) {
return E->get()->get_rpc_mode();
}
}
cscript = cscript->_base;
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
-GDScriptInstance::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_variable) const {
+MultiplayerAPI::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_variable) const {
const GDScript *cscript = script.ptr();
@@ -1253,7 +1253,7 @@ GDScriptInstance::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_va
cscript = cscript->_base;
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
void GDScriptInstance::reload_members() {
@@ -1333,6 +1333,15 @@ void GDScriptLanguage::add_global_constant(const StringName &p_variable, const V
_add_global(p_variable, p_value);
}
+void GDScriptLanguage::add_named_global_constant(const StringName &p_name, const Variant &p_value) {
+ named_globals[p_name] = p_value;
+}
+
+void GDScriptLanguage::remove_named_global_constant(const StringName &p_name) {
+ ERR_FAIL_COND(!named_globals.has(p_name));
+ named_globals.erase(p_name);
+}
+
void GDScriptLanguage::init() {
//populate global constants
@@ -1760,6 +1769,9 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"sync",
"master",
"slave",
+ "remotesync",
+ "mastersync",
+ "slavesync",
0
};
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 9566e3b32e..a35b0a10d5 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -63,7 +63,7 @@ class GDScript : public Script {
int index;
StringName setter;
StringName getter;
- ScriptInstance::RPCMode rpc_mode;
+ MultiplayerAPI::RPCMode rpc_mode;
};
friend class GDScriptInstance;
@@ -248,8 +248,8 @@ public:
void reload_members();
- virtual RPCMode get_rpc_mode(const StringName &p_method) const;
- virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
GDScriptInstance();
~GDScriptInstance();
@@ -262,6 +262,7 @@ class GDScriptLanguage : public ScriptLanguage {
Variant *_global_array;
Vector<Variant> global_array;
Map<StringName, int> globals;
+ Map<StringName, Variant> named_globals;
struct CallLevel {
@@ -369,7 +370,8 @@ public:
_FORCE_INLINE_ int get_global_array_size() const { return global_array.size(); }
_FORCE_INLINE_ Variant *get_global_array() { return _global_array; }
- _FORCE_INLINE_ const Map<StringName, int> &get_global_map() { return globals; }
+ _FORCE_INLINE_ const Map<StringName, int> &get_global_map() const { return globals; }
+ _FORCE_INLINE_ const Map<StringName, Variant> &get_named_globals_map() const { return named_globals; }
_FORCE_INLINE_ static GDScriptLanguage *get_singleton() { return singleton; }
@@ -403,6 +405,8 @@ public:
virtual String _get_indentation() const;
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
+ virtual void add_named_global_constant(const StringName &p_name, const Variant &p_value);
+ virtual void remove_named_global_constant(const StringName &p_name);
/* DEBUGGER FUNCTIONS */
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 048948dada..5c834966c5 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -278,6 +278,18 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
return idx | (GDScriptFunction::ADDR_TYPE_GLOBAL << GDScriptFunction::ADDR_BITS); //argument (stack root)
}
+#ifdef TOOLS_ENABLED
+ if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(identifier)) {
+
+ int idx = codegen.named_globals.find(identifier);
+ if (idx == -1) {
+ idx = codegen.named_globals.size();
+ codegen.named_globals.push_back(identifier);
+ }
+ return idx | (GDScriptFunction::ADDR_TYPE_NAMED_GLOBAL << GDScriptFunction::ADDR_BITS);
+ }
+#endif
+
//not found, error
_set_error("Identifier not found: " + String(identifier), p_expression);
@@ -726,6 +738,9 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
case GDScriptParser::OperatorNode::OP_NEG: {
if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level)) return -1;
} break;
+ case GDScriptParser::OperatorNode::OP_POS: {
+ if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level)) return -1;
+ } break;
case GDScriptParser::OperatorNode::OP_NOT: {
if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level)) return -1;
} break;
@@ -1511,6 +1526,18 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
gdfunc->_global_names_count = 0;
}
+#ifdef TOOLS_ENABLED
+ // Named globals
+ if (codegen.named_globals.size()) {
+ gdfunc->named_globals.resize(codegen.named_globals.size());
+ gdfunc->_named_globals_ptr = gdfunc->named_globals.ptr();
+ for (int i = 0; i < codegen.named_globals.size(); i++) {
+ gdfunc->named_globals[i] = codegen.named_globals[i];
+ }
+ gdfunc->_named_globals_count = gdfunc->named_globals.size();
+ }
+#endif
+
if (codegen.opcodes.size()) {
gdfunc->code = codegen.opcodes;
diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h
index 62aafdbe01..237b0de9e7 100644
--- a/modules/gdscript/gdscript_compiler.h
+++ b/modules/gdscript/gdscript_compiler.h
@@ -94,6 +94,9 @@ class GDScriptCompiler {
HashMap<Variant, int, VariantHasher, VariantComparator> constant_map;
Map<StringName, int> name_map;
+#ifdef TOOLS_ENABLED
+ Vector<StringName> named_globals;
+#endif
int get_name_map_pos(const StringName &p_identifier) {
int ret;
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 505562324f..c0c3bd7b06 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -54,18 +54,18 @@ void GDScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {
}
Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
- String _template = String() +
- "extends %BASE%\n\n" +
- "# class member variables go here, for example:\n" +
- "# var a = 2\n" +
- "# var b = \"textvar\"\n\n" +
- "func _ready():\n" +
- "%TS%# Called every time the node is added to the scene.\n" +
- "%TS%# Initialization here\n" +
- "%TS%pass\n\n" +
- "#func _process(delta):\n" +
- "#%TS%# Called every frame. Delta is time since last frame.\n" +
- "#%TS%# Update game logic here.\n" +
+ String _template = "extends %BASE%\n"
+ "\n"
+ "# Declare member variables here. Examples:\n"
+ "# var a = 2\n"
+ "# var b = \"text\"\n"
+ "\n"
+ "# Called when the node enters the scene tree for the first time.\n"
+ "func _ready():\n"
+ "%TS%pass # Replace with function body.\n"
+ "\n"
+ "# Called every frame. 'delta' is the elapsed time since the previous frame.\n"
+ "#func _process(delta):\n"
"#%TS%pass\n";
_template = _template.replace("%BASE%", p_base_class_name);
@@ -118,6 +118,13 @@ bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &
funcs[cl->static_functions[i]->line] = cl->static_functions[i]->name;
}
+ for (int i = 0; i < cl->subclasses.size(); i++) {
+ for (int j = 0; j < cl->subclasses[i]->functions.size(); j++) {
+
+ funcs[cl->subclasses[i]->functions[j]->line] = String(cl->subclasses[i]->name) + "." + String(cl->subclasses[i]->functions[j]->name);
+ }
+ }
+
for (Map<int, String>::Element *E = funcs.front(); E; E = E->next()) {
r_functions->push_back(E->get() + ":" + itos(E->key()));
@@ -410,15 +417,13 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na
String s = "func " + p_name + "(";
if (p_args.size()) {
- s += " ";
for (int i = 0; i < p_args.size(); i++) {
if (i > 0)
s += ", ";
s += p_args[i].get_slice(":", 0);
}
- s += " ";
}
- s += "):\n" + _get_indentation() + "pass # replace with function body\n";
+ s += "):\n" + _get_indentation() + "pass # Replace with function body.\n";
return s;
}
@@ -432,6 +437,9 @@ struct GDScriptCompletionIdentifier {
Ref<GDScript> script;
Variant::Type type;
Variant value; //im case there is a value, also return it
+
+ GDScriptCompletionIdentifier() :
+ type(Variant::NIL) {}
};
static GDScriptCompletionIdentifier _get_type_from_variant(const Variant &p_variant, bool p_allow_gdnative_class = false) {
@@ -553,9 +561,7 @@ static Ref<Reference> _get_parent_class(GDScriptCompletionContext &context) {
static GDScriptCompletionIdentifier _get_native_class(GDScriptCompletionContext &context) {
- //eeh...
GDScriptCompletionIdentifier id;
- id.type = Variant::NIL;
REF pc = _get_parent_class(context);
if (!pc.is_valid()) {
@@ -1335,13 +1341,23 @@ static void _find_identifiers_in_block(GDScriptCompletionContext &context, int p
for (int i = 0; i < context.block->statements.size(); i++) {
- if (context.block->statements[i]->line > p_line)
+ GDScriptParser::Node *statement = context.block->statements[i];
+ if (statement->line > p_line)
continue;
- if (context.block->statements[i]->type == GDScriptParser::BlockNode::TYPE_LOCAL_VAR) {
+ GDScriptParser::BlockNode::Type statementType = statement->type;
+ if (statementType == GDScriptParser::BlockNode::TYPE_LOCAL_VAR) {
- const GDScriptParser::LocalVarNode *lv = static_cast<const GDScriptParser::LocalVarNode *>(context.block->statements[i]);
+ const GDScriptParser::LocalVarNode *lv = static_cast<const GDScriptParser::LocalVarNode *>(statement);
result.insert(lv->name.operator String());
+ } else if (statementType == GDScriptParser::BlockNode::TYPE_CONTROL_FLOW) {
+
+ const GDScriptParser::ControlFlowNode *cf = static_cast<const GDScriptParser::ControlFlowNode *>(statement);
+ if (cf->cf_type == GDScriptParser::ControlFlowNode::CF_FOR) {
+
+ const GDScriptParser::IdentifierNode *id = static_cast<const GDScriptParser::IdentifierNode *>(cf->arguments[0]);
+ result.insert(id->name.operator String());
+ }
}
}
}
@@ -1513,6 +1529,13 @@ static void _find_identifiers(GDScriptCompletionContext &context, int p_line, bo
result.insert(_type_names[i]);
}
+ List<String> reserved_words;
+ GDScriptLanguage::get_singleton()->get_reserved_words(&reserved_words);
+
+ for (List<String>::Element *E = reserved_words.front(); E; E = E->next()) {
+ result.insert(E->get());
+ }
+
//autoload singletons
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
@@ -2620,6 +2643,13 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
}
+ if ("PI" == p_symbol || "TAU" == p_symbol || "INF" == p_symbol || "NAN" == p_symbol) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ r_result.class_name = "@GDScript";
+ r_result.class_member = p_symbol;
+ return OK;
+ }
+
GDScriptParser p;
p.parse(p_code, p_base_path, false, "", true);
@@ -2633,6 +2663,18 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
context.function = p.get_completion_function();
context.base = p_owner;
context.base_path = p_base_path;
+
+ if (context._class && context._class->extends_class.size() > 0) {
+ bool success = false;
+ ClassDB::get_integer_constant(context._class->extends_class[0], p_symbol, &success);
+ if (success) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ r_result.class_name = context._class->extends_class[0];
+ r_result.class_member = p_symbol;
+ return OK;
+ }
+ }
+
bool isfunction = false;
switch (p.get_completion_type()) {
@@ -2852,7 +2894,24 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
return OK;
}
} else {
- r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ /*
+ // Because get_integer_constant_enum and get_integer_constant dont work on @GlobalScope
+ // We cannot determine the exact nature of the identifier here
+ // Otherwise these codes would work
+ StringName enumName = ClassDB::get_integer_constant_enum("@GlobalScope", p_symbol, true);
+ if (enumName != NULL) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_ENUM;
+ r_result.class_name = "@GlobalScope";
+ r_result.class_member = enumName;
+ return OK;
+ }
+ else {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
+ r_result.class_name = "@GlobalScope";
+ r_result.class_member = p_symbol;
+ return OK;
+ }*/
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_TBD_GLOBALSCOPE;
r_result.class_name = "@GlobalScope";
r_result.class_member = p_symbol;
return OK;
@@ -2915,6 +2974,14 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
return OK;
}
+ StringName enumName = ClassDB::get_integer_constant_enum(t.obj_type, p_symbol, true);
+ if (enumName != StringName()) {
+ r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_ENUM;
+ r_result.class_name = t.obj_type;
+ r_result.class_member = enumName;
+ return OK;
+ }
+
bool success;
ClassDB::get_integer_constant(t.obj_type, p_symbol, &success);
if (success) {
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index a2f449909f..61130cb58f 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -86,7 +86,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
o = o->_owner;
}
- ERR_EXPLAIN("GDScriptCompiler bug..");
+ ERR_EXPLAIN("GDScriptCompiler bug...");
ERR_FAIL_V(NULL);
} break;
case ADDR_TYPE_LOCAL_CONSTANT: {
@@ -108,6 +108,21 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
#endif
return &GDScriptLanguage::get_singleton()->get_global_array()[address];
} break;
+#ifdef TOOLS_ENABLED
+ case ADDR_TYPE_NAMED_GLOBAL: {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_INDEX_V(address, _named_globals_count, NULL);
+#endif
+ StringName id = _named_globals_ptr[address];
+
+ if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(id)) {
+ return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id];
+ } else {
+ r_error = "Autoload singleton '" + String(id) + "' has been removed.";
+ return NULL;
+ }
+ } break;
+#endif
case ADDR_TYPE_NIL: {
return &nil;
} break;
@@ -1311,9 +1326,9 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GDScriptLanguage::get_singleton()->script_frame_time += time_taken - function_call_time;
}
-#endif
if (ScriptDebugger::get_singleton())
GDScriptLanguage::get_singleton()->exit_function();
+#endif
if (_stack_size) {
//free stack
@@ -1440,7 +1455,7 @@ GDScriptFunction::GDScriptFunction() :
_stack_size = 0;
_call_size = 0;
- rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
+ rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
name = "<anonymous>";
#ifdef DEBUG_ENABLED
_func_cname = NULL;
@@ -1535,15 +1550,21 @@ Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_ar
// then the function did yield again after resuming.
if (ret.is_ref()) {
GDScriptFunctionState *gdfs = Object::cast_to<GDScriptFunctionState>(ret);
- if (gdfs && gdfs->function == function)
+ if (gdfs && gdfs->function == function) {
completed = false;
+ gdfs->previous_state = Ref<GDScriptFunctionState>(this);
+ }
}
function = NULL; //cleaned up;
state.result = Variant();
if (completed) {
- emit_signal("completed", ret);
+ GDScriptFunctionState *state = this;
+ while (state != NULL) {
+ state->emit_signal("completed", ret);
+ state = *(state->previous_state);
+ }
}
return ret;
@@ -1591,15 +1612,21 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
// then the function did yield again after resuming.
if (ret.is_ref()) {
GDScriptFunctionState *gdfs = Object::cast_to<GDScriptFunctionState>(ret);
- if (gdfs && gdfs->function == function)
+ if (gdfs && gdfs->function == function) {
completed = false;
+ gdfs->previous_state = Ref<GDScriptFunctionState>(this);
+ }
}
function = NULL; //cleaned up;
state.result = Variant();
if (completed) {
- emit_signal("completed", ret);
+ GDScriptFunctionState *state = this;
+ while (state != NULL) {
+ state->emit_signal("completed", ret);
+ state = *(state->previous_state);
+ }
}
return ret;
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 9310444c7a..836325f0fe 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -92,15 +92,8 @@ public:
ADDR_TYPE_STACK = 5,
ADDR_TYPE_STACK_VARIABLE = 6,
ADDR_TYPE_GLOBAL = 7,
- ADDR_TYPE_NIL = 8
- };
-
- enum RPCMode {
- RPC_DISABLED,
- RPC_ENABLED,
- RPC_SYNC,
- RPC_SYNC_MASTER,
- RPC_SYNC_SLAVE
+ ADDR_TYPE_NAMED_GLOBAL = 8,
+ ADDR_TYPE_NIL = 9
};
struct StackDebug {
@@ -121,6 +114,10 @@ private:
int _constant_count;
const StringName *_global_names_ptr;
int _global_names_count;
+#ifdef TOOLS_ENABLED
+ const StringName *_named_globals_ptr;
+ int _named_globals_count;
+#endif
const int *_default_arg_ptr;
int _default_arg_count;
const int *_code_ptr;
@@ -130,13 +127,16 @@ private:
int _call_size;
int _initial_line;
bool _static;
- ScriptInstance::RPCMode rpc_mode;
+ MultiplayerAPI::RPCMode rpc_mode;
GDScript *_script;
StringName name;
Vector<Variant> constants;
Vector<StringName> global_names;
+#ifdef TOOLS_ENABLED
+ Vector<StringName> named_globals;
+#endif
Vector<int> default_arguments;
Vector<int> code;
@@ -222,7 +222,7 @@ public:
Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state = NULL);
- _FORCE_INLINE_ ScriptInstance::RPCMode get_rpc_mode() const { return rpc_mode; }
+ _FORCE_INLINE_ MultiplayerAPI::RPCMode get_rpc_mode() const { return rpc_mode; }
GDScriptFunction();
~GDScriptFunction();
};
@@ -234,6 +234,7 @@ class GDScriptFunctionState : public Reference {
GDScriptFunction *function;
GDScriptFunction::CallState state;
Variant _signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ Ref<GDScriptFunctionState> previous_state;
protected:
static void _bind_methods();
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 278585cb01..cccf09c58e 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -120,8 +120,10 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
"Color8",
"ColorN",
"print_stack",
+ "get_stack",
"instance_from_id",
"len",
+ "is_instance_valid",
};
return _names[p_func];
@@ -329,10 +331,24 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
} break;
case MATH_LERP: {
VALIDATE_ARG_COUNT(3);
- VALIDATE_ARG_NUM(0);
- VALIDATE_ARG_NUM(1);
VALIDATE_ARG_NUM(2);
- r_ret = Math::lerp((double)*p_args[0], (double)*p_args[1], (double)*p_args[2]);
+ const double t = (double)*p_args[2];
+ switch (p_args[0]->get_type() == p_args[1]->get_type() ? p_args[0]->get_type() : Variant::REAL) {
+ case Variant::VECTOR2: {
+ r_ret = ((Vector2)*p_args[0]).linear_interpolate((Vector2)*p_args[1], t);
+ } break;
+ case Variant::VECTOR3: {
+ r_ret = ((Vector3)*p_args[0]).linear_interpolate((Vector3)*p_args[1], t);
+ } break;
+ case Variant::COLOR: {
+ r_ret = ((Color)*p_args[0]).linear_interpolate((Color)*p_args[1], t);
+ } break;
+ default: {
+ VALIDATE_ARG_NUM(0);
+ VALIDATE_ARG_NUM(1);
+ r_ret = Math::lerp((double)*p_args[0], (double)*p_args[1], t);
+ } break;
+ }
} break;
case MATH_INVERSE_LERP: {
VALIDATE_ARG_COUNT(3);
@@ -1198,6 +1214,22 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
};
} break;
+ case GET_STACK: {
+ VALIDATE_ARG_COUNT(0);
+
+ ScriptLanguage *script = GDScriptLanguage::get_singleton();
+ Array ret;
+ for (int i = 0; i < script->debug_get_stack_level_count(); i++) {
+
+ Dictionary frame;
+ frame["source"] = script->debug_get_stack_level_source(i);
+ frame["function"] = script->debug_get_stack_level_function(i);
+ frame["line"] = script->debug_get_stack_level_line(i);
+ ret.push_back(frame);
+ };
+ r_ret = ret;
+ } break;
+
case INSTANCE_FROM_ID: {
VALIDATE_ARG_COUNT(1);
@@ -1277,6 +1309,17 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
} break;
+ case IS_INSTANCE_VALID: {
+
+ VALIDATE_ARG_COUNT(1);
+ if (p_args[0]->get_type() != Variant::OBJECT) {
+ r_ret = false;
+ } else {
+ Object *obj = *p_args[0];
+ r_ret = ObjectDB::instance_validate(obj);
+ }
+
+ } break;
case FUNC_MAX: {
ERR_FAIL();
@@ -1488,7 +1531,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
return mi;
} break;
case MATH_LERP: {
- MethodInfo mi("lerp", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "weight"));
+ MethodInfo mi("lerp", PropertyInfo(Variant::NIL, "from"), PropertyInfo(Variant::NIL, "to"), PropertyInfo(Variant::REAL, "weight"));
mi.return_val.type = Variant::REAL;
return mi;
} break;
@@ -1787,6 +1830,11 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::NIL;
return mi;
} break;
+ case GET_STACK: {
+ MethodInfo mi("get_stack");
+ mi.return_val.type = Variant::NIL;
+ return mi;
+ } break;
case INSTANCE_FROM_ID: {
MethodInfo mi("instance_from_id", PropertyInfo(Variant::INT, "instance_id"));
@@ -1798,7 +1846,11 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::INT;
return mi;
} break;
-
+ case IS_INSTANCE_VALID: {
+ MethodInfo mi("is_instance_valid", PropertyInfo(Variant::OBJECT, "instance"));
+ mi.return_val.type = Variant::BOOL;
+ return mi;
+ } break;
case FUNC_MAX: {
ERR_FAIL_V(MethodInfo());
diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h
index 1d54006084..899a7ebd25 100644
--- a/modules/gdscript/gdscript_functions.h
+++ b/modules/gdscript/gdscript_functions.h
@@ -111,8 +111,10 @@ public:
COLOR8,
COLORN,
PRINT_STACK,
+ GET_STACK,
INSTANCE_FROM_ID,
LEN,
+ IS_INSTANCE_VALID,
FUNC_MAX
};
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index ac7fd94141..9650563ee6 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -461,18 +461,21 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
} else if (!for_completion || FileAccess::exists(path)) {
res = ResourceLoader::load(path);
}
- if (!res.is_valid()) {
- _set_error("Can't preload resource at path: " + path);
- return NULL;
- }
} else {
if (!FileAccess::exists(path)) {
_set_error("Can't preload resource at path: " + path);
return NULL;
+ } else if (ScriptCodeCompletionCache::get_singleton()) {
+ res = ScriptCodeCompletionCache::get_singleton()->get_cached_resource(path);
}
}
+ if (!res.is_valid()) {
+ _set_error("Can't preload resource at path: " + path);
+ return NULL;
+ }
+
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' after 'preload' path");
return NULL;
@@ -713,6 +716,14 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
expr = constant;
bfn = true;
}
+
+ if (!bfn && GDScriptLanguage::get_singleton()->get_named_globals_map().has(identifier)) {
+ //check from singletons
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = GDScriptLanguage::get_singleton()->get_named_globals_map()[identifier];
+ expr = constant;
+ bfn = true;
+ }
}
if (!bfn) {
@@ -967,7 +978,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
if (!expr) {
- ERR_EXPLAIN("GDScriptParser bug, couldn't figure out what expression is..");
+ ERR_EXPLAIN("GDScriptParser bug, couldn't figure out what expression is...");
ERR_FAIL_COND_V(!expr, NULL);
}
@@ -1302,7 +1313,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
expr_pos++;
if (expr_pos == expression.size()) {
//can happen..
- _set_error("Unexpected end of expression..");
+ _set_error("Unexpected end of expression...");
return NULL;
}
}
@@ -1321,7 +1332,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
} else if (is_ternary) {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -1340,7 +1351,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expression[next_op - 1].is_op) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -1377,7 +1388,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
} else {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -1387,7 +1398,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expression[next_op - 1].is_op) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -3362,7 +3373,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
function->line = fnline;
function->rpc_mode = rpc_mode;
- rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
+ rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
if (_static)
p_class->static_functions.push_back(function);
@@ -3437,6 +3448,22 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
tokenizer->advance();
+
+ String hint_prefix = "";
+ bool is_arrayed = false;
+
+ while (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE &&
+ tokenizer->get_token_type() == Variant::ARRAY &&
+ tokenizer->get_token(1) == GDScriptTokenizer::TK_COMMA) {
+ tokenizer->advance(); // Array
+ tokenizer->advance(); // Comma
+ if (is_arrayed) {
+ hint_prefix += itos(Variant::ARRAY) + ":";
+ } else {
+ is_arrayed = true;
+ }
+ }
+
if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
Variant::Type type = tokenizer->get_token_type();
@@ -3452,28 +3479,6 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
- String hint_prefix = "";
-
- if (type == Variant::ARRAY && tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
- tokenizer->advance();
-
- while (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
- type = tokenizer->get_token_type();
-
- tokenizer->advance();
-
- if (type == Variant::ARRAY) {
- hint_prefix += itos(Variant::ARRAY) + ":";
- if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
- tokenizer->advance();
- }
- } else {
- hint_prefix += itos(type);
- break;
- }
- }
- }
-
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
// hint expected next!
tokenizer->advance();
@@ -3827,13 +3832,6 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
} break;
}
}
- if (current_export.type == Variant::ARRAY && !hint_prefix.empty()) {
- if (current_export.hint) {
- hint_prefix += "/" + itos(current_export.hint);
- }
- current_export.hint_string = hint_prefix + ":" + current_export.hint_string;
- current_export.hint = PROPERTY_HINT_NONE;
- }
} else {
@@ -3920,13 +3918,23 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
+ if (is_arrayed) {
+ hint_prefix += itos(current_export.type);
+ if (current_export.hint) {
+ hint_prefix += "/" + itos(current_export.hint);
+ }
+ current_export.hint_string = hint_prefix + ":" + current_export.hint_string;
+ current_export.hint = PROPERTY_HINT_TYPE_STRING;
+ current_export.type = Variant::ARRAY;
+ }
+
tokenizer->advance();
}
- if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_ONREADY && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTER && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SYNC) {
+ if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_ONREADY && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTER && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTESYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTERSYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVESYNC) {
current_export = PropertyInfo();
- _set_error("Expected 'var', 'onready', 'remote', 'master', 'slave' or 'sync'.");
+ _set_error("Expected 'var', 'onready', 'remote', 'master', 'slave', 'sync', 'remotesync', 'mastersync', 'slavesync'.");
return;
}
@@ -3959,7 +3967,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
}
- rpc_mode = ScriptInstance::RPC_MODE_REMOTE;
+ rpc_mode = MultiplayerAPI::RPC_MODE_REMOTE;
continue;
} break;
@@ -3980,7 +3988,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
}
- rpc_mode = ScriptInstance::RPC_MODE_MASTER;
+ rpc_mode = MultiplayerAPI::RPC_MODE_MASTER;
continue;
} break;
case GDScriptTokenizer::TK_PR_SLAVE: {
@@ -4000,9 +4008,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
}
- rpc_mode = ScriptInstance::RPC_MODE_SLAVE;
+ rpc_mode = MultiplayerAPI::RPC_MODE_SLAVE;
continue;
} break;
+ case GDScriptTokenizer::TK_PR_REMOTESYNC:
case GDScriptTokenizer::TK_PR_SYNC: {
//may be fallthrough from export, ignore if so
@@ -4015,7 +4024,37 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
- rpc_mode = ScriptInstance::RPC_MODE_SYNC;
+ rpc_mode = MultiplayerAPI::RPC_MODE_SYNC;
+ continue;
+ } break;
+ case GDScriptTokenizer::TK_PR_MASTERSYNC: {
+
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) {
+ if (current_export.type)
+ _set_error("Expected 'var'.");
+ else
+ _set_error("Expected 'var' or 'func'.");
+ return;
+ }
+
+ rpc_mode = MultiplayerAPI::RPC_MODE_MASTERSYNC;
+ continue;
+ } break;
+ case GDScriptTokenizer::TK_PR_SLAVESYNC: {
+
+ //may be fallthrough from export, ignore if so
+ tokenizer->advance();
+ if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) {
+ if (current_export.type)
+ _set_error("Expected 'var'.");
+ else
+ _set_error("Expected 'var' or 'func'.");
+ return;
+ }
+
+ rpc_mode = MultiplayerAPI::RPC_MODE_SLAVESYNC;
continue;
} break;
case GDScriptTokenizer::TK_PR_VAR: {
@@ -4045,7 +4084,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
tokenizer->advance();
- rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
+ rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
@@ -4054,7 +4093,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
#endif
tokenizer->advance();
- Node *subexpr = _parse_and_reduce_expression(p_class, false, autoexport);
+ Node *subexpr = _parse_and_reduce_expression(p_class, false, autoexport || member._export.type != Variant::NIL);
if (!subexpr) {
if (_recover_from_completion()) {
break;
@@ -4087,7 +4126,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
member._export.type=Variant::DICTIONARY;
- } else*/ {
+ } else*/
+ {
if (subexpr->type != Node::TYPE_CONSTANT) {
@@ -4469,7 +4509,7 @@ void GDScriptParser::clear() {
current_class = NULL;
completion_found = false;
- rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
+ rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
current_function = NULL;
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 485ba1263d..b88a59537c 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -89,7 +89,7 @@ public:
StringName getter;
int line;
Node *expression;
- ScriptInstance::RPCMode rpc_mode;
+ MultiplayerAPI::RPCMode rpc_mode;
};
struct Constant {
StringName identifier;
@@ -125,7 +125,7 @@ public:
struct FunctionNode : public Node {
bool _static;
- ScriptInstance::RPCMode rpc_mode;
+ MultiplayerAPI::RPCMode rpc_mode;
StringName name;
Vector<StringName> arguments;
Vector<Node *> default_values;
@@ -134,7 +134,7 @@ public:
FunctionNode() {
type = TYPE_FUNCTION;
_static = false;
- rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
+ rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
}
};
@@ -493,7 +493,7 @@ private:
PropertyInfo current_export;
- ScriptInstance::RPCMode rpc_mode;
+ MultiplayerAPI::RPCMode rpc_mode;
void _set_error(const String &p_error, int p_line = -1, int p_column = -1);
bool _recover_from_completion();
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 6a844cd651..3c8e1ddbe4 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -110,6 +110,9 @@ const char *GDScriptTokenizer::token_names[TK_MAX] = {
"sync",
"master",
"slave",
+ "remotesync",
+ "mastersync",
+ "slavesync",
"'['",
"']'",
"'{'",
@@ -201,6 +204,9 @@ static const _kws _keyword_list[] = {
{ GDScriptTokenizer::TK_PR_MASTER, "master" },
{ GDScriptTokenizer::TK_PR_SLAVE, "slave" },
{ GDScriptTokenizer::TK_PR_SYNC, "sync" },
+ { GDScriptTokenizer::TK_PR_REMOTESYNC, "remotesync" },
+ { GDScriptTokenizer::TK_PR_MASTERSYNC, "mastersync" },
+ { GDScriptTokenizer::TK_PR_SLAVESYNC, "slavesync" },
{ GDScriptTokenizer::TK_PR_CONST, "const" },
{ GDScriptTokenizer::TK_PR_ENUM, "enum" },
//controlflow
@@ -247,6 +253,9 @@ bool GDScriptTokenizer::is_token_literal(int p_offset, bool variable_safe) const
case TK_PR_MASTER:
case TK_PR_SLAVE:
case TK_PR_SYNC:
+ case TK_PR_REMOTESYNC:
+ case TK_PR_MASTERSYNC:
+ case TK_PR_SLAVESYNC:
return true;
// Literal for non-variables only:
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index b020c85199..c4f1f9fd94 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -115,6 +115,9 @@ public:
TK_PR_SYNC,
TK_PR_MASTER,
TK_PR_SLAVE,
+ TK_PR_REMOTESYNC,
+ TK_PR_MASTERSYNC,
+ TK_PR_SLAVESYNC,
TK_BRACKET_OPEN,
TK_BRACKET_CLOSE,
TK_CURLY_BRACKET_OPEN,
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 95efcda80f..422223370b 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -30,6 +30,7 @@
#include "register_types.h"
+#include "editor/gdscript_highlighter.h"
#include "gdscript.h"
#include "gdscript_tokenizer.h"
#include "io/file_access_encrypted.h"
@@ -92,6 +93,7 @@ void register_gdscript_types() {
ResourceSaver::add_resource_format_saver(resource_saver_gd);
#ifdef TOOLS_ENABLED
+ ScriptEditor::register_create_syntax_highlighter_function(GDScriptSyntaxHighlighter::create);
EditorNode::add_init_callback(_editor_init);
#endif
}
diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py
index a93f4edb81..5022116c9b 100644
--- a/modules/gridmap/config.py
+++ b/modules/gridmap/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index 36d4d7cb59..d5f9563600 100644
--- a/modules/gridmap/doc_classes/GridMap.xml
+++ b/modules/gridmap/doc_classes/GridMap.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GridMap" inherits="Spatial" category="Core" version="3.1-dev">
+<class name="GridMap" inherits="Spatial" category="Core" version="3.1">
<brief_description>
Node for 3D tile-based maps.
</brief_description>
@@ -10,7 +10,7 @@
A GridMap is split into a sparse collection of octants for efficient rendering and physics processing. Every octant has the same dimensions and can contain several cells.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/tutorials/3d/using_gridmaps.html
+ <link>http://docs.godotengine.org/en/3.0/tutorials/3d/using_gridmaps.html</link>
</tutorials>
<demos>
</demos>
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 90a4b65ed6..fc5972c810 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -101,8 +101,8 @@ void GridMapEditor::_menu_option(int p_option) {
}
if (edit_axis != new_axis) {
- int item1 = options->get_popup()->get_item_id(MENU_OPTION_NEXT_LEVEL);
- int item2 = options->get_popup()->get_item_id(MENU_OPTION_PREV_LEVEL);
+ int item1 = options->get_popup()->get_item_index(MENU_OPTION_NEXT_LEVEL);
+ int item2 = options->get_popup()->get_item_index(MENU_OPTION_PREV_LEVEL);
if (edit_axis == Vector3::AXIS_Y) {
options->get_popup()->set_item_text(item1, TTR("Next Plane"));
options->get_popup()->set_item_text(item2, TTR("Previous Plane"));
@@ -671,12 +671,21 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
- if (pan_gesture->get_command() || pan_gesture->get_shift()) {
- const real_t delta = pan_gesture->get_delta().y;
- floor->set_value(floor->get_value() + SGN(delta));
+ if (pan_gesture->get_alt() && (pan_gesture->get_command() || pan_gesture->get_shift())) {
+ const real_t delta = pan_gesture->get_delta().y * 0.5;
+ accumulated_floor_delta += delta;
+ int step = 0;
+ if (ABS(accumulated_floor_delta) > 1.0) {
+ step = SGN(accumulated_floor_delta);
+ accumulated_floor_delta -= step;
+ }
+ if (step) {
+ floor->set_value(floor->get_value() + step);
+ }
return true;
}
}
+ accumulated_floor_delta = 0.0;
return false;
}
@@ -800,7 +809,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
set_process(true);
- Vector3 edited_floor = p_gridmap->get_meta("_editor_floor_");
+ Vector3 edited_floor = p_gridmap->has_meta("_editor_floor_") ? p_gridmap->get_meta("_editor_floor_") : Variant();
clip_mode = p_gridmap->has_meta("_editor_clip_") ? ClipMode(p_gridmap->get_meta("_editor_clip_").operator int()) : CLIP_DISABLED;
for (int i = 0; i < 3; i++) {
@@ -1067,14 +1076,14 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
options->get_popup()->add_item(TTR("Previous Floor"), MENU_OPTION_PREV_LEVEL, KEY_Q);
options->get_popup()->add_item(TTR("Next Floor"), MENU_OPTION_NEXT_LEVEL, KEY_E);
options->get_popup()->add_separator();
- options->get_popup()->add_check_item(TTR("Clip Disabled"), MENU_OPTION_CLIP_DISABLED);
+ options->get_popup()->add_radio_check_item(TTR("Clip Disabled"), MENU_OPTION_CLIP_DISABLED);
options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_CLIP_DISABLED), true);
- options->get_popup()->add_check_item(TTR("Clip Above"), MENU_OPTION_CLIP_ABOVE);
- options->get_popup()->add_check_item(TTR("Clip Below"), MENU_OPTION_CLIP_BELOW);
+ options->get_popup()->add_radio_check_item(TTR("Clip Above"), MENU_OPTION_CLIP_ABOVE);
+ options->get_popup()->add_radio_check_item(TTR("Clip Below"), MENU_OPTION_CLIP_BELOW);
options->get_popup()->add_separator();
- options->get_popup()->add_check_item(TTR("Edit X Axis"), MENU_OPTION_X_AXIS, KEY_Z);
- options->get_popup()->add_check_item(TTR("Edit Y Axis"), MENU_OPTION_Y_AXIS, KEY_X);
- options->get_popup()->add_check_item(TTR("Edit Z Axis"), MENU_OPTION_Z_AXIS, KEY_C);
+ options->get_popup()->add_radio_check_item(TTR("Edit X Axis"), MENU_OPTION_X_AXIS, KEY_Z);
+ options->get_popup()->add_radio_check_item(TTR("Edit Y Axis"), MENU_OPTION_Y_AXIS, KEY_X);
+ options->get_popup()->add_radio_check_item(TTR("Edit Z Axis"), MENU_OPTION_Z_AXIS, KEY_C);
options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_Y_AXIS), true);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Cursor Rotate X"), MENU_OPTION_CURSOR_ROTATE_X, KEY_A);
@@ -1176,9 +1185,9 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
for (int k = 0; k < 3; k++) {
if (i < 3)
- face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[j][(i + k) % 3] = v[k];
else
- face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[3 - j][(i + k) % 3] = -v[k];
}
}
@@ -1278,6 +1287,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
selection.active = false;
updating = false;
+ accumulated_floor_delta = 0.0;
}
GridMapEditor::~GridMapEditor() {
@@ -1290,9 +1300,10 @@ GridMapEditor::~GridMapEditor() {
VisualServer::get_singleton()->free(grid_instance[i]);
if (cursor_instance.is_valid())
VisualServer::get_singleton()->free(cursor_instance);
- if (selection_level_instance[i].is_valid()) {
+ if (selection_level_instance[i].is_valid())
VisualServer::get_singleton()->free(selection_level_instance[i]);
- }
+ if (selection_level_mesh[i].is_valid())
+ VisualServer::get_singleton()->free(selection_level_mesh[i]);
}
VisualServer::get_singleton()->free(selection_mesh);
diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h
index 9b8db2daeb..7c5feda125 100644
--- a/modules/gridmap/grid_map_editor_plugin.h
+++ b/modules/gridmap/grid_map_editor_plugin.h
@@ -76,6 +76,7 @@ class GridMapEditor : public VBoxContainer {
Panel *panel;
MenuButton *options;
SpinBox *floor;
+ double accumulated_floor_delta;
ToolButton *mode_thumbnail;
ToolButton *mode_list;
HBoxContainer *spatial_editor_hb;
diff --git a/modules/hdr/config.py b/modules/hdr/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/hdr/config.py
+++ b/modules/hdr/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp
index 3cc362b5d6..d592c19b97 100644
--- a/modules/hdr/image_loader_hdr.cpp
+++ b/modules/hdr/image_loader_hdr.cpp
@@ -42,14 +42,18 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
ERR_FAIL_COND_V(header != "#?RADIANCE" && header != "#?RGBE", ERR_FILE_UNRECOGNIZED);
while (true) {
- String format = f->get_token();
+ String line = f->get_line();
ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_UNRECOGNIZED);
- if (format.begins_with("FORMAT=") && format != "FORMAT=32-bit_rle_rgbe") {
- ERR_EXPLAIN("Only 32-bit_rle_rgbe is supported for .hdr files.");
- return ERR_FILE_UNRECOGNIZED;
- }
- if (format == "FORMAT=32-bit_rle_rgbe")
+ if (line == "") // empty line indicates end of header
break;
+ if (line.begins_with("FORMAT=")) { // leave option to implement other commands
+ if (line != "FORMAT=32-bit_rle_rgbe") {
+ ERR_EXPLAIN("Only 32-bit_rle_rgbe is supported for HDR files.");
+ return ERR_FILE_UNRECOGNIZED;
+ }
+ } else if (!line.begins_with("#")) { // not comment
+ WARN_PRINTS("Ignoring unsupported header information in HDR : " + line);
+ }
}
String token = f->get_token();
diff --git a/modules/jpg/config.py b/modules/jpg/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/jpg/config.py
+++ b/modules/jpg/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/mbedtls/SCsub b/modules/mbedtls/SCsub
index b846ae38ad..38198c9105 100755
--- a/modules/mbedtls/SCsub
+++ b/modules/mbedtls/SCsub
@@ -85,7 +85,7 @@ if env['builtin_mbedtls']:
thirdparty_dir = "#thirdparty/mbedtls/library/"
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_mbed_tls.add_source_files(env.modules_sources, thirdparty_sources)
- env_mbed_tls.Append(CPPPATH=["#thirdparty/mbedtls/include/"])
+ env_mbed_tls.Prepend(CPPPATH=["#thirdparty/mbedtls/include/"])
# Module sources
env_mbed_tls.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/mbedtls/config.py b/modules/mbedtls/config.py
index 5f133eba90..1c8cd12a2d 100755
--- a/modules/mbedtls/config.py
+++ b/modules/mbedtls/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/mbedtls/stream_peer_mbed_tls.cpp b/modules/mbedtls/stream_peer_mbed_tls.cpp
index 4135eb40ff..a63e53ec1f 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.cpp
+++ b/modules/mbedtls/stream_peer_mbed_tls.cpp
@@ -293,28 +293,10 @@ void StreamPeerMbedTLS::initialize_ssl() {
mbedtls_debug_set_threshold(1);
#endif
- String certs_path = GLOBAL_DEF("network/ssl/certificates", "");
- ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificates", PropertyInfo(Variant::STRING, "network/ssl/certificates", PROPERTY_HINT_FILE, "*.crt"));
-
- if (certs_path != "") {
-
- FileAccess *f = FileAccess::open(certs_path, FileAccess::READ);
- if (f) {
- PoolByteArray arr;
- int flen = f->get_len();
- arr.resize(flen + 1);
- {
- PoolByteArray::Write w = arr.write();
- f->get_buffer(w.ptr(), flen);
- w[flen] = 0; //end f string
- }
-
- memdelete(f);
-
- _load_certs(arr);
- print_line("Loaded certs from '" + certs_path);
- }
- }
+ PoolByteArray cert_array = StreamPeerSSL::get_project_cert_array();
+
+ if (cert_array.size() > 0)
+ _load_certs(cert_array);
available = true;
}
diff --git a/modules/mbedtls/stream_peer_mbed_tls.h b/modules/mbedtls/stream_peer_mbed_tls.h
index ce17614d85..2b96a194a1 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.h
+++ b/modules/mbedtls/stream_peer_mbed_tls.h
@@ -32,8 +32,6 @@
#define STREAM_PEER_OPEN_SSL_H
#include "io/stream_peer_ssl.h"
-#include "os/file_access.h"
-#include "project_settings.h"
#include "mbedtls/config.h"
#include "mbedtls/ctr_drbg.h"
diff --git a/modules/mobile_vr/config.py b/modules/mobile_vr/config.py
index 4e1155f0c6..4912457e2b 100644
--- a/modules/mobile_vr/config.py
+++ b/modules/mobile_vr/config.py
@@ -1,6 +1,6 @@
-def can_build(platform):
+def can_build(env, platform):
# should probably change this to only be true on iOS and Android
- return True
+ return False
def configure(env):
pass
diff --git a/modules/mobile_vr/doc_classes/MobileVRInterface.xml b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
index d3f2548320..359d654433 100644
--- a/modules/mobile_vr/doc_classes/MobileVRInterface.xml
+++ b/modules/mobile_vr/doc_classes/MobileVRInterface.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.1-dev">
+<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.1">
<brief_description>
Generic mobile VR implementation
</brief_description>
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index aa8626e6da..03e187e5b0 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -31,11 +31,18 @@ def make_cs_files_header(src, dst):
if i > 0:
header.write(', ')
header.write(byte_to_str(buf[buf_idx]))
- inserted_files += '\tr_files.insert(\"' + file + '\", ' \
+ inserted_files += '\tr_files.insert("' + file + '", ' \
'CompressedFile(_cs_' + name + '_compressed_size, ' \
'_cs_' + name + '_uncompressed_size, ' \
'_cs_' + name + '_compressed));\n'
header.write(' };\n')
+ version_file = os.path.join(src, 'VERSION.txt')
+ with open(version_file, 'r') as content_file:
+ try:
+ glue_version = int(content_file.read()) # make sure the format is valid
+ header.write('\n#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n')
+ except ValueError:
+ raise ValueError('Invalid C# glue version in: ' + version_file)
header.write('\nstruct CompressedFile\n' '{\n'
'\tint compressed_size;\n' '\tint uncompressed_size;\n' '\tconst unsigned char* data;\n'
'\n\tCompressedFile(int p_comp_size, int p_uncomp_size, const unsigned char* p_data)\n'
@@ -80,23 +87,23 @@ def find_msbuild_unix(filename):
import sys
hint_dirs = ['/opt/novell/mono/bin']
- if sys.platform == "darwin":
+ if sys.platform == 'darwin':
hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current/bin'] + hint_dirs
for hint_dir in hint_dirs:
hint_path = os.path.join(hint_dir, filename)
if os.path.isfile(hint_path):
return hint_path
- elif os.path.isfile(hint_path + ".exe"):
- return hint_path + ".exe"
+ elif os.path.isfile(hint_path + '.exe'):
+ return hint_path + '.exe'
- for hint_dir in os.environ["PATH"].split(os.pathsep):
+ for hint_dir in os.environ['PATH'].split(os.pathsep):
hint_dir = hint_dir.strip('"')
hint_path = os.path.join(hint_dir, filename)
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
- if os.path.isfile(hint_path + ".exe") and os.access(hint_path + ".exe", os.X_OK):
- return hint_path + ".exe"
+ if os.path.isfile(hint_path + '.exe') and os.access(hint_path + '.exe', os.X_OK):
+ return hint_path + '.exe'
return None
@@ -120,15 +127,24 @@ def find_msbuild_windows():
if not mono_root:
raise RuntimeError('Cannot find mono root directory')
+ framework_path = os.path.join(mono_root, 'lib', 'mono', '4.5')
+
+ mono_bin_dir = os.path.join(mono_root, 'bin')
+
+ msbuild_mono = os.path.join(mono_bin_dir, 'msbuild.bat')
+
+ if os.path.isfile(msbuild_mono):
+ mono_msbuild_env = {
+ 'CscToolExe': os.path.join(mono_bin_dir, 'csc.bat'),
+ 'VbcToolExe': os.path.join(mono_bin_dir, 'vbc.bat'),
+ 'FscToolExe': os.path.join(mono_bin_dir, 'fsharpc.bat')
+ }
+ return (msbuild_mono, framework_path, mono_msbuild_env)
+
msbuild_tools_path = monoreg.find_msbuild_tools_path_reg()
if msbuild_tools_path:
- return (os.path.join(msbuild_tools_path, 'MSBuild.exe'), os.path.join(mono_root, 'lib', 'mono', '4.5'))
- else:
- msbuild_mono = os.path.join(mono_root, 'bin', 'msbuild.bat')
-
- if os.path.isfile(msbuild_mono):
- return (msbuild_mono, '')
+ return (os.path.join(msbuild_tools_path, 'MSBuild.exe'), framework_path, {})
return None
@@ -138,21 +154,28 @@ def mono_build_solution(source, target, env):
import mono_reg_utils as monoreg
from shutil import copyfile
- framework_path_override = ''
+ framework_path = ''
+
+ msbuild_env = os.environ.copy()
+
+ # Needed when running from Developer Command Prompt for VS
+ if 'PLATFORM' in msbuild_env:
+ del msbuild_env['PLATFORM']
if os.name == 'nt':
msbuild_info = find_msbuild_windows()
if msbuild_info is None:
raise RuntimeError('Cannot find MSBuild executable')
msbuild_path = msbuild_info[0]
- framework_path_override = msbuild_info[1]
+ framework_path = msbuild_info[1]
+ msbuild_env.update(msbuild_info[2])
else:
msbuild_path = find_msbuild_unix('msbuild')
if msbuild_path is None:
xbuild_fallback = env['xbuild_fallback']
if xbuild_fallback and os.name == 'nt':
- print("Option 'xbuild_fallback' not supported on Windows")
+ print('Option \'xbuild_fallback\' not supported on Windows')
xbuild_fallback = False
if xbuild_fallback:
@@ -176,14 +199,8 @@ def mono_build_solution(source, target, env):
'/p:Configuration=' + build_config,
]
- if framework_path_override:
- msbuild_args += ['/p:FrameworkPathOverride=' + framework_path_override]
-
- msbuild_env = os.environ.copy()
-
- # Needed when running from Developer Command Prompt for VS
- if 'PLATFORM' in msbuild_env:
- del msbuild_env['PLATFORM']
+ if framework_path:
+ msbuild_args += ['/p:FrameworkPathOverride=' + framework_path]
try:
subprocess.check_call(msbuild_args, env=msbuild_env)
@@ -202,10 +219,16 @@ def mono_build_solution(source, target, env):
copyfile(os.path.join(src_dir, asm_file), os.path.join(dst_dir, asm_file))
+output_dir = Dir('#bin').abspath
+assemblies_output_dir = Dir(env['mono_assemblies_output_dir']).abspath
-mono_sln_builder = Builder(action = mono_build_solution)
+mono_sln_builder = Builder(action=mono_build_solution)
env_mono.Append(BUILDERS={'MonoBuildSolution': mono_sln_builder})
env_mono.MonoBuildSolution(
- os.path.join(Dir('#bin').abspath, 'GodotSharpTools.dll'),
+ os.path.join(assemblies_output_dir, 'GodotSharpTools.dll'),
'editor/GodotSharpTools/GodotSharpTools.sln'
)
+
+if os.path.normpath(output_dir) != os.path.normpath(assemblies_output_dir):
+ rel_assemblies_output_dir = os.path.relpath(assemblies_output_dir, output_dir)
+ env_mono.Append(CPPDEFINES={'GD_MONO_EDITOR_ASSEMBLIES_DIR': rel_assemblies_output_dir})
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 7c1846dcc2..ebf8512fb6 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -2,8 +2,9 @@
import imp
import os
import sys
+import subprocess
-from SCons.Script import BoolVariable, Environment, Variables
+from SCons.Script import BoolVariable, Dir, Environment, File, PathVariable, SCons, Variables
monoreg = imp.load_source('mono_reg_utils', 'modules/mono/mono_reg_utils.py')
@@ -18,7 +19,7 @@ def find_file_in_dir(directory, files, prefix='', extension=''):
return ''
-def can_build(platform):
+def can_build(env, platform):
if platform in ["javascript"]:
return False # Not yet supported
return True
@@ -29,20 +30,27 @@ def is_enabled():
return False
-def copy_file_no_replace(src_dir, dst_dir, name):
+def copy_file(src_dir, dst_dir, name):
from shutil import copyfile
src_path = os.path.join(src_dir, name)
dst_path = os.path.join(dst_dir, name)
- need_copy = True
if not os.path.isdir(dst_dir):
os.mkdir(dst_dir)
- elif os.path.exists(dst_path):
- need_copy = False
- if need_copy:
- copyfile(src_path, dst_path)
+ copyfile(src_path, dst_path)
+
+
+def custom_path_is_dir_create(key, val, env):
+ """Validator to check if Path is a directory, creating it if it does not exist.
+ Similar to PathIsDirCreate, except it uses SCons.Script.Dir() and
+ SCons.Script.File() in order to support the '#' top level directory token.
+ """
+ # Dir constructor will throw an error if the path points to a file
+ fsDir = Dir(val)
+ if not fsDir.exists:
+ os.makedirs(fsDir.abspath)
def configure(env):
@@ -51,18 +59,17 @@ def configure(env):
envvars = Variables()
envvars.Add(BoolVariable('mono_static', 'Statically link mono', False))
+ envvars.Add(PathVariable('mono_assemblies_output_dir', 'Path to the assemblies output directory', '#bin', custom_path_is_dir_create))
envvars.Update(env)
bits = env['bits']
mono_static = env['mono_static']
+ assemblies_output_dir = Dir(env['mono_assemblies_output_dir']).abspath
mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0']
if env['platform'] == 'windows':
- if mono_static:
- raise RuntimeError('mono-static: Not supported on Windows')
-
if bits == '32':
if os.getenv('MONO32_PREFIX'):
mono_root = os.getenv('MONO32_PREFIX')
@@ -82,28 +89,55 @@ def configure(env):
env.Append(LIBPATH=mono_lib_path)
env.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
- mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension='.lib')
+ if mono_static:
+ lib_suffix = Environment()['LIBSUFFIX']
+
+ if env.msvc:
+ mono_static_lib_name = 'libmono-static-sgen'
+ else:
+ mono_static_lib_name = 'libmonosgen-2.0'
+
+ if not os.path.isfile(os.path.join(mono_lib_path, mono_static_lib_name + lib_suffix)):
+ raise RuntimeError('Could not find static mono library in: ' + mono_lib_path)
+
+ if env.msvc:
+ env.Append(LINKFLAGS=mono_static_lib_name + lib_suffix)
- if not mono_lib_name:
- raise RuntimeError('Could not find mono library in: ' + mono_lib_path)
+ env.Append(LINKFLAGS='Mincore' + lib_suffix)
+ env.Append(LINKFLAGS='msvcrt' + lib_suffix)
+ env.Append(LINKFLAGS='LIBCMT' + lib_suffix)
+ env.Append(LINKFLAGS='Psapi' + lib_suffix)
+ else:
+ env.Append(LINKFLAGS=os.path.join(mono_lib_path, mono_static_lib_name + lib_suffix))
- if os.getenv('VCINSTALLDIR'):
- env.Append(LINKFLAGS=mono_lib_name + Environment()['LIBSUFFIX'])
+ env.Append(LIBS='psapi')
+ env.Append(LIBS='version')
else:
- env.Append(LIBS=mono_lib_name)
+ mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension='.lib')
+
+ if not mono_lib_name:
+ raise RuntimeError('Could not find mono library in: ' + mono_lib_path)
+
+ if env.msvc:
+ env.Append(LINKFLAGS=mono_lib_name + Environment()['LIBSUFFIX'])
+ else:
+ env.Append(LIBS=mono_lib_name)
- mono_bin_path = os.path.join(mono_root, 'bin')
+ mono_bin_path = os.path.join(mono_root, 'bin')
- mono_dll_name = find_file_in_dir(mono_bin_path, mono_lib_names, extension='.dll')
+ mono_dll_name = find_file_in_dir(mono_bin_path, mono_lib_names, extension='.dll')
- if not mono_dll_name:
- raise RuntimeError('Could not find mono shared library in: ' + mono_bin_path)
+ if not mono_dll_name:
+ raise RuntimeError('Could not find mono shared library in: ' + mono_bin_path)
- copy_file_no_replace(mono_bin_path, 'bin', mono_dll_name + '.dll')
+ copy_file(mono_bin_path, 'bin', mono_dll_name + '.dll')
+
+ copy_file(os.path.join(mono_lib_path, 'mono', '4.5'), assemblies_output_dir, 'mscorlib.dll')
else:
sharedlib_ext = '.dylib' if sys.platform == 'darwin' else '.so'
mono_root = ''
+ mono_lib_path = ''
if bits == '32':
if os.getenv('MONO32_PREFIX'):
@@ -112,6 +146,22 @@ def configure(env):
if os.getenv('MONO64_PREFIX'):
mono_root = os.getenv('MONO64_PREFIX')
+ # We can't use pkg-config to link mono statically,
+ # but we can still use it to find the mono root directory
+ if not mono_root and mono_static:
+ def pkgconfig_try_find_mono_root():
+ tmpenv = Environment()
+ tmpenv.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
+ tmpenv.ParseConfig('pkg-config monosgen-2 --libs-only-L')
+ for hint_dir in tmpenv['LIBPATH']:
+ name_found = find_file_in_dir(hint_dir, mono_lib_names, prefix='lib', extension=sharedlib_ext)
+ if name_found and os.path.isdir(os.path.join(hint_dir, '..', 'include', 'mono-2.0')):
+ return os.path.join(hint_dir, '..')
+ return ''
+ mono_root = pkgconfig_try_find_mono_root()
+ if not mono_root:
+ raise RuntimeError('Building with mono_static=yes, but failed to find the mono prefix with pkg-config. Specify one manually')
+
if mono_root:
mono_lib_path = os.path.join(mono_root, 'lib')
@@ -148,15 +198,17 @@ def configure(env):
if not mono_so_name:
raise RuntimeError('Could not find mono shared library in: ' + mono_lib_path)
- copy_file_no_replace(mono_lib_path, 'bin', 'lib' + mono_so_name + sharedlib_ext)
+ copy_file(mono_lib_path, 'bin', 'lib' + mono_so_name + sharedlib_ext)
+
+ copy_file(os.path.join(mono_lib_path, 'mono', '4.5'), assemblies_output_dir, 'mscorlib.dll')
else:
- if mono_static:
- raise RuntimeError('mono-static: Not supported with pkg-config. Specify a mono prefix manually')
+ assert not mono_static
env.ParseConfig('pkg-config monosgen-2 --cflags --libs')
mono_lib_path = ''
mono_so_name = ''
+ mono_prefix = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()
tmpenv = Environment()
tmpenv.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
@@ -172,7 +224,8 @@ def configure(env):
if not mono_so_name:
raise RuntimeError('Could not find mono shared library in: ' + str(tmpenv['LIBPATH']))
- copy_file_no_replace(mono_lib_path, 'bin', 'lib' + mono_so_name + sharedlib_ext)
+ copy_file(mono_lib_path, 'bin', 'lib' + mono_so_name + sharedlib_ext)
+ copy_file(os.path.join(mono_prefix, 'lib', 'mono', '4.5'), assemblies_output_dir, 'mscorlib.dll')
env.Append(LINKFLAGS='-rdynamic')
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index fb45136575..2420cdb4af 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -118,6 +118,8 @@ void CSharpLanguage::init() {
#ifdef TOOLS_ENABLED
EditorNode::add_init_callback(&gdsharp_editor_init_callback);
+
+ GLOBAL_DEF("mono/export/include_scripts_content", true);
#endif
}
@@ -280,6 +282,15 @@ void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const {
p_delimiters->push_back("@\" \""); // verbatim string literal
}
+static String get_base_class_name(const String &p_base_class_name, const String p_class_name) {
+
+ String base_class = p_base_class_name;
+ if (p_class_name == base_class) {
+ base_class = "Godot." + base_class;
+ }
+ return base_class;
+}
+
Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
String script_template = "using " BINDINGS_NAMESPACE ";\n"
@@ -287,26 +298,25 @@ Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const Strin
"\n"
"public class %CLASS_NAME% : %BASE_CLASS_NAME%\n"
"{\n"
- " // Member variables here, example:\n"
+ " // Declare member variables here. Examples:\n"
" // private int a = 2;\n"
- " // private string b = \"textvar\";\n"
+ " // private string b = \"text\";\n"
"\n"
+ " // Called when the node enters the scene tree for the first time."
" public override void _Ready()\n"
" {\n"
- " // Called every time the node is added to the scene.\n"
- " // Initialization here\n"
- " \n"
+ " "
" }\n"
"\n"
+ "// // Called every frame. 'delta' is the elapsed time since the previous frame."
"// public override void _Process(float delta)\n"
"// {\n"
- "// // Called every frame. Delta is time since last frame.\n"
- "// // Update game logic here.\n"
- "// \n"
+ "// "
"// }\n"
"}\n";
- script_template = script_template.replace("%BASE_CLASS_NAME%", p_base_class_name)
+ String base_class_name = get_base_class_name(p_base_class_name, p_class_name);
+ script_template = script_template.replace("%BASE_CLASS_NAME%", base_class_name)
.replace("%CLASS_NAME%", p_class_name);
Ref<CSharpScript> script;
@@ -325,12 +335,24 @@ bool CSharpLanguage::is_using_templates() {
void CSharpLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {
String src = p_script->get_source_code();
- src = src.replace("%BASE%", p_base_class_name)
+ String base_class_name = get_base_class_name(p_base_class_name, p_class_name);
+ src = src.replace("%BASE%", base_class_name)
.replace("%CLASS%", p_class_name)
.replace("%TS%", _get_indentation());
p_script->set_source_code(src);
}
+String CSharpLanguage::validate_path(const String &p_path) const {
+
+ String class_name = p_path.get_file().get_basename();
+ List<String> keywords;
+ get_reserved_words(&keywords);
+ if (keywords.find(class_name)) {
+ return TTR("Class name can't be a reserved keyword");
+ }
+ return "";
+}
+
Script *CSharpLanguage::create_script() const {
return memnew(CSharpScript);
@@ -422,7 +444,7 @@ String CSharpLanguage::make_function(const String &p_class, const String &p_name
s += variant_type_to_managed_name(arg.get_slice(":", 1)) + " " + escape_csharp_keyword(arg.get_slice(":", 0));
}
- s += ")\n{\n // Replace with function body\n}\n";
+ s += ")\n{\n // Replace with function body.\n}\n";
return s;
#else
@@ -454,7 +476,7 @@ Vector<ScriptLanguage::StackInfo> CSharpLanguage::debug_get_current_stack_info()
#ifdef DEBUG_ENABLED
// Printing an error here will result in endless recursion, so we must be careful
- if (!gdmono->is_runtime_initialized() || !GDMono::get_singleton()->get_api_assembly() || !GDMonoUtils::mono_cache.corlib_cache_updated)
+ if (!gdmono->is_runtime_initialized() || !GDMono::get_singleton()->get_core_api_assembly() || !GDMonoUtils::mono_cache.corlib_cache_updated)
return Vector<StackInfo>();
MonoObject *stack_trace = mono_object_new(mono_domain_get(), CACHED_CLASS(System_Diagnostics_StackTrace)->get_mono_ptr());
@@ -758,7 +780,7 @@ void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) {
}
if (Engine::get_singleton()->is_editor_hint()) {
- EditorNode::get_singleton()->get_property_editor()->update_tree();
+ EditorNode::get_singleton()->get_inspector()->update_tree();
NodeDock::singleton->update_lists();
}
}
@@ -1286,21 +1308,27 @@ bool CSharpInstance::refcount_decremented() {
return ref_dying;
}
-ScriptInstance::RPCMode CSharpInstance::_member_get_rpc_mode(GDMonoClassMember *p_member) const {
+MultiplayerAPI::RPCMode CSharpInstance::_member_get_rpc_mode(GDMonoClassMember *p_member) const {
if (p_member->has_attribute(CACHED_CLASS(RemoteAttribute)))
- return RPC_MODE_REMOTE;
+ return MultiplayerAPI::RPC_MODE_REMOTE;
if (p_member->has_attribute(CACHED_CLASS(SyncAttribute)))
- return RPC_MODE_SYNC;
+ return MultiplayerAPI::RPC_MODE_SYNC;
if (p_member->has_attribute(CACHED_CLASS(MasterAttribute)))
- return RPC_MODE_MASTER;
+ return MultiplayerAPI::RPC_MODE_MASTER;
if (p_member->has_attribute(CACHED_CLASS(SlaveAttribute)))
- return RPC_MODE_SLAVE;
+ return MultiplayerAPI::RPC_MODE_SLAVE;
+ if (p_member->has_attribute(CACHED_CLASS(RemoteSyncAttribute)))
+ return MultiplayerAPI::RPC_MODE_REMOTESYNC;
+ if (p_member->has_attribute(CACHED_CLASS(MasterSyncAttribute)))
+ return MultiplayerAPI::RPC_MODE_MASTERSYNC;
+ if (p_member->has_attribute(CACHED_CLASS(SlaveSyncAttribute)))
+ return MultiplayerAPI::RPC_MODE_SLAVESYNC;
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
-ScriptInstance::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method) const {
+MultiplayerAPI::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method) const {
GDMonoClass *top = script->script_class;
@@ -1313,10 +1341,10 @@ ScriptInstance::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method)
top = top->get_parent_class();
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
-ScriptInstance::RPCMode CSharpInstance::get_rset_mode(const StringName &p_variable) const {
+MultiplayerAPI::RPCMode CSharpInstance::get_rset_mode(const StringName &p_variable) const {
GDMonoClass *top = script->script_class;
@@ -1334,7 +1362,7 @@ ScriptInstance::RPCMode CSharpInstance::get_rset_mode(const StringName &p_variab
top = top->get_parent_class();
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
void CSharpInstance::notification(int p_notification) {
@@ -1550,7 +1578,6 @@ bool CSharpScript::_update_exports() {
}
bool CSharpScript::_update_signals() {
-#ifdef TOOLS_ENABLED
if (!valid)
return false;
@@ -1581,8 +1608,6 @@ bool CSharpScript::_update_signals() {
}
return changed;
-#endif
- return false;
}
bool CSharpScript::_get_signal(GDMonoClass *p_class, GDMonoClass *p_delegate, Vector<Argument> &params) {
@@ -1705,6 +1730,12 @@ void CSharpScript::_clear() {
Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+ if (unlikely(GDMono::get_singleton() == NULL)) {
+ // Probably not the best error but eh.
+ r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;
+ return Variant();
+ }
+
GDMonoClass *top = script_class;
while (top && top != native) {
@@ -1933,8 +1964,7 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::Call
ScriptInstance *CSharpScript::instance_create(Object *p_this) {
- if (!valid)
- return NULL;
+ ERR_FAIL_COND_V(!valid, NULL);
if (!tool && !ScriptServer::is_scripting_enabled()) {
#ifdef TOOLS_ENABLED
@@ -1948,6 +1978,18 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
#endif
}
+ if (!script_class) {
+ if (GDMono::get_singleton()->get_project_assembly() == NULL) {
+ // The project assembly is not loaded
+ ERR_EXPLAIN("Cannot instance script because the project assembly is not loaded. Script: " + get_path());
+ ERR_FAIL_V(NULL);
+ }
+
+ // The project assembly is loaded, but the class could not found
+ ERR_EXPLAIN("Cannot instance script because the class '" + name + "' could not be found. Script: " + get_path());
+ ERR_FAIL_V(NULL);
+ }
+
update_signals();
if (native) {
@@ -2024,20 +2066,15 @@ Error CSharpScript::reload(bool p_keep_state) {
if (project_assembly) {
script_class = project_assembly->get_object_derived_class(name);
- if (!script_class) {
- ERR_PRINTS("Cannot find class " + name + " for script " + get_path());
- }
+ valid = script_class != NULL;
+
+ if (script_class) {
#ifdef DEBUG_ENABLED
- else if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print(String("Found class " + script_class->get_namespace() + "." +
script_class->get_name() + " for script " + get_path() + "\n")
.utf8());
- }
#endif
- valid = script_class != NULL;
-
- if (script_class) {
tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute));
native = GDMonoUtils::get_class_native_base(script_class);
@@ -2135,9 +2172,7 @@ void CSharpScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
}
void CSharpScript::update_signals() {
-#ifdef TOOLS_ENABLED
_update_signals();
-#endif
}
Ref<Script> CSharpScript::get_base_script() const {
@@ -2269,7 +2304,9 @@ RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p
CRASH_COND(mono_domain_get() == NULL);
#endif
-#else
+#endif
+
+#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint() && mono_domain_get() == NULL) {
CRASH_COND(Thread::get_caller_id() == Thread::get_main_id());
@@ -2278,14 +2315,20 @@ RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p
// because this may be called by one of the editor's worker threads.
// Attach this thread temporarily to reload the script.
- MonoThread *mono_thread = mono_thread_attach(SCRIPTS_DOMAIN);
- CRASH_COND(mono_thread == NULL);
+ if (SCRIPTS_DOMAIN) {
+ MonoThread *mono_thread = mono_thread_attach(SCRIPTS_DOMAIN);
+ CRASH_COND(mono_thread == NULL);
+ script->reload();
+ mono_thread_detach(mono_thread);
+ }
+
+ } else { // just reload it normally
+#endif
script->reload();
- mono_thread_detach(mono_thread);
- } else // just reload it normally
+#ifdef TOOLS_ENABLED
+ }
#endif
- script->reload();
if (r_error)
*r_error = OK;
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index ffb1d2e0f4..cae2bbf40a 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -90,15 +90,15 @@ class CSharpScript : public Script {
Variant::Type type;
};
+ Map<StringName, Vector<Argument> > _signals;
+ bool signals_invalidated;
+
#ifdef TOOLS_ENABLED
List<PropertyInfo> exported_members_cache; // members_cache
Map<StringName, Variant> exported_members_defval_cache; // member_default_values_cache
Set<PlaceHolderScriptInstance *> placeholders;
bool source_changed_cache;
bool exports_invalidated;
- Map<StringName, Vector<Argument> > _signals;
- bool signals_invalidated;
-
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
#endif
@@ -192,7 +192,7 @@ class CSharpInstance : public ScriptInstance {
void _call_multilevel(MonoObject *p_mono_object, const StringName &p_method, const Variant **p_args, int p_argcount);
- RPCMode _member_get_rpc_mode(GDMonoClassMember *p_member) const;
+ MultiplayerAPI::RPCMode _member_get_rpc_mode(GDMonoClassMember *p_member) const;
public:
MonoObject *get_mono_object() const;
@@ -213,8 +213,8 @@ public:
virtual void refcount_incremented();
virtual bool refcount_decremented();
- virtual RPCMode get_rpc_mode(const StringName &p_method) const;
- virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
virtual void notification(int p_notification);
void call_notification_no_check(MonoObject *p_mono_object, int p_notification);
@@ -294,6 +294,7 @@ public:
virtual bool is_using_templates();
virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
/* TODO */ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { return true; }
+ virtual String validate_path(const String &p_path) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
diff --git a/modules/mono/doc_classes/@C#.xml b/modules/mono/doc_classes/@C#.xml
index 0c2bb948ea..082bc30fd8 100644
--- a/modules/mono/doc_classes/@C#.xml
+++ b/modules/mono/doc_classes/@C#.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@C#" category="Core" version="3.1-dev">
+<class name="@C#" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/doc_classes/CSharpScript.xml b/modules/mono/doc_classes/CSharpScript.xml
index 9bd57f1d4d..a1f7399653 100644
--- a/modules/mono/doc_classes/CSharpScript.xml
+++ b/modules/mono/doc_classes/CSharpScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSharpScript" inherits="Script" category="Core" version="3.1-dev">
+<class name="CSharpScript" inherits="Script" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/doc_classes/GodotSharp.xml b/modules/mono/doc_classes/GodotSharp.xml
index 51f07523e7..985c66464b 100644
--- a/modules/mono/doc_classes/GodotSharp.xml
+++ b/modules/mono/doc_classes/GodotSharp.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GodotSharp" inherits="Object" category="Core" version="3.1-dev">
+<class name="GodotSharp" inherits="Object" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
index 04da0600cc..16beacb45c 100644
--- a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
@@ -16,24 +16,48 @@ namespace GodotSharpTools.Build
private extern static void godot_icall_BuildInstance_ExitCallback(string solution, string config, int exitCode);
[MethodImpl(MethodImplOptions.InternalCall)]
- private extern static void godot_icall_BuildInstance_get_MSBuildInfo(ref string msbuildPath, ref string frameworkPath);
+ private extern static string godot_icall_BuildInstance_get_MSBuildPath();
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern static string godot_icall_BuildInstance_get_FrameworkPath();
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern static string godot_icall_BuildInstance_get_MonoWindowsBinDir();
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern static bool godot_icall_BuildInstance_get_UsingMonoMSBuildOnWindows();
- private struct MSBuildInfo
+ private static string GetMSBuildPath()
{
- public string path;
- public string frameworkPathOverride;
+ string msbuildPath = godot_icall_BuildInstance_get_MSBuildPath();
+
+ if (msbuildPath == null)
+ throw new FileNotFoundException("Cannot find the MSBuild executable.");
+
+ return msbuildPath;
}
- private static MSBuildInfo GetMSBuildInfo()
+ private static string GetFrameworkPath()
{
- MSBuildInfo msbuildInfo = new MSBuildInfo();
+ return godot_icall_BuildInstance_get_FrameworkPath();
+ }
- godot_icall_BuildInstance_get_MSBuildInfo(ref msbuildInfo.path, ref msbuildInfo.frameworkPathOverride);
+ private static string MonoWindowsBinDir
+ {
+ get
+ {
+ string monoWinBinDir = godot_icall_BuildInstance_get_MonoWindowsBinDir();
- if (msbuildInfo.path == null)
- throw new FileNotFoundException("Cannot find the MSBuild executable.");
+ if (monoWinBinDir == null)
+ throw new FileNotFoundException("Cannot find the Windows Mono binaries directory.");
- return msbuildInfo;
+ return monoWinBinDir;
+ }
+ }
+
+ private static bool UsingMonoMSBuildOnWindows
+ {
+ get
+ {
+ return godot_icall_BuildInstance_get_UsingMonoMSBuildOnWindows();
+ }
}
private string solution;
@@ -54,25 +78,38 @@ namespace GodotSharpTools.Build
public bool Build(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
{
- MSBuildInfo msbuildInfo = GetMSBuildInfo();
+ bool debugMSBuild = IsDebugMSBuildRequested();
List<string> customPropertiesList = new List<string>();
if (customProperties != null)
customPropertiesList.AddRange(customProperties);
- if (msbuildInfo.frameworkPathOverride != null)
- customPropertiesList.Add("FrameworkPathOverride=" + msbuildInfo.frameworkPathOverride);
+ string frameworkPath = GetFrameworkPath();
+
+ if (!string.IsNullOrEmpty(frameworkPath))
+ customPropertiesList.Add("FrameworkPathOverride=" + frameworkPath);
string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customPropertiesList);
- ProcessStartInfo startInfo = new ProcessStartInfo(msbuildInfo.path, compilerArgs);
+ ProcessStartInfo startInfo = new ProcessStartInfo(GetMSBuildPath(), compilerArgs);
+
+ bool redirectOutput = !debugMSBuild;
- // No console output, thanks
- startInfo.RedirectStandardOutput = true;
- startInfo.RedirectStandardError = true;
+ startInfo.RedirectStandardOutput = redirectOutput;
+ startInfo.RedirectStandardError = redirectOutput;
startInfo.UseShellExecute = false;
+ if (UsingMonoMSBuildOnWindows)
+ {
+ // These environment variables are required for Mono's MSBuild to find the compilers.
+ // We use the batch files in Mono's bin directory to make sure the compilers are executed with mono.
+ string monoWinBinDir = MonoWindowsBinDir;
+ startInfo.EnvironmentVariables.Add("CscToolExe", Path.Combine(monoWinBinDir, "csc.bat"));
+ startInfo.EnvironmentVariables.Add("VbcToolExe", Path.Combine(monoWinBinDir, "vbc.bat"));
+ startInfo.EnvironmentVariables.Add("FscToolExe", Path.Combine(monoWinBinDir, "fsharpc.bat"));
+ }
+
// Needed when running from Developer Command Prompt for VS
RemovePlatformVariable(startInfo.EnvironmentVariables);
@@ -82,8 +119,11 @@ namespace GodotSharpTools.Build
process.Start();
- process.BeginOutputReadLine();
- process.BeginErrorReadLine();
+ if (redirectOutput)
+ {
+ process.BeginOutputReadLine();
+ process.BeginErrorReadLine();
+ }
process.WaitForExit();
@@ -95,28 +135,41 @@ namespace GodotSharpTools.Build
public bool BuildAsync(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
{
+ bool debugMSBuild = IsDebugMSBuildRequested();
+
if (process != null)
throw new InvalidOperationException("Already in use");
- MSBuildInfo msbuildInfo = GetMSBuildInfo();
-
List<string> customPropertiesList = new List<string>();
if (customProperties != null)
customPropertiesList.AddRange(customProperties);
- if (msbuildInfo.frameworkPathOverride.Length > 0)
- customPropertiesList.Add("FrameworkPathOverride=" + msbuildInfo.frameworkPathOverride);
+ string frameworkPath = GetFrameworkPath();
+
+ if (!string.IsNullOrEmpty(frameworkPath))
+ customPropertiesList.Add("FrameworkPathOverride=" + frameworkPath);
string compilerArgs = BuildArguments(loggerAssemblyPath, loggerOutputDir, customPropertiesList);
- ProcessStartInfo startInfo = new ProcessStartInfo(msbuildInfo.path, compilerArgs);
+ ProcessStartInfo startInfo = new ProcessStartInfo(GetMSBuildPath(), compilerArgs);
- // No console output, thanks
- startInfo.RedirectStandardOutput = true;
- startInfo.RedirectStandardError = true;
+ bool redirectOutput = !debugMSBuild;
+
+ startInfo.RedirectStandardOutput = redirectOutput;
+ startInfo.RedirectStandardError = redirectOutput;
startInfo.UseShellExecute = false;
+ if (UsingMonoMSBuildOnWindows)
+ {
+ // These environment variables are required for Mono's MSBuild to find the compilers.
+ // We use the batch files in Mono's bin directory to make sure the compilers are executed with mono.
+ string monoWinBinDir = MonoWindowsBinDir;
+ startInfo.EnvironmentVariables.Add("CscToolExe", Path.Combine(monoWinBinDir, "csc.bat"));
+ startInfo.EnvironmentVariables.Add("VbcToolExe", Path.Combine(monoWinBinDir, "vbc.bat"));
+ startInfo.EnvironmentVariables.Add("FscToolExe", Path.Combine(monoWinBinDir, "fsharpc.bat"));
+ }
+
// Needed when running from Developer Command Prompt for VS
RemovePlatformVariable(startInfo.EnvironmentVariables);
@@ -127,8 +180,11 @@ namespace GodotSharpTools.Build
process.Start();
- process.BeginOutputReadLine();
- process.BeginErrorReadLine();
+ if (redirectOutput)
+ {
+ process.BeginOutputReadLine();
+ process.BeginErrorReadLine();
+ }
return true;
}
@@ -176,6 +232,11 @@ namespace GodotSharpTools.Build
Dispose();
}
+ private static bool IsDebugMSBuildRequested()
+ {
+ return Environment.GetEnvironmentVariable("GODOT_DEBUG_MSBUILD")?.Trim() == "1";
+ }
+
public void Dispose()
{
if (process != null)
diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
index 981083a3c2..1c8714e31d 100644
--- a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
+++ b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
@@ -11,7 +11,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
+ <DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
@@ -20,7 +20,7 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>full</DebugType>
+ <DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
index 6bf54a0156..1d863e6f61 100644
--- a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
@@ -70,7 +70,7 @@ namespace GodotSharpTools.Project
var toolsGroup = root.AddPropertyGroup();
toolsGroup.Condition = " '$(Configuration)|$(Platform)' == 'Tools|AnyCPU' ";
toolsGroup.AddProperty("DebugSymbols", "true");
- toolsGroup.AddProperty("DebugType", "full");
+ toolsGroup.AddProperty("DebugType", "portable");
toolsGroup.AddProperty("Optimize", "false");
toolsGroup.AddProperty("DefineConstants", "DEBUG;TOOLS;");
toolsGroup.AddProperty("ErrorReport", "prompt");
@@ -148,7 +148,7 @@ namespace GodotSharpTools.Project
var debugGroup = root.AddPropertyGroup();
debugGroup.Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ";
debugGroup.AddProperty("DebugSymbols", "true");
- debugGroup.AddProperty("DebugType", "full");
+ debugGroup.AddProperty("DebugType", "portable");
debugGroup.AddProperty("Optimize", "false");
debugGroup.AddProperty("DefineConstants", "DEBUG;");
debugGroup.AddProperty("ErrorReport", "prompt");
@@ -157,7 +157,7 @@ namespace GodotSharpTools.Project
var releaseGroup = root.AddPropertyGroup();
releaseGroup.Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ";
- releaseGroup.AddProperty("DebugType", "full");
+ releaseGroup.AddProperty("DebugType", "portable");
releaseGroup.AddProperty("Optimize", "true");
releaseGroup.AddProperty("ErrorReport", "prompt");
releaseGroup.AddProperty("WarningLevel", "4");
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 952e033565..4c598d4f37 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -70,8 +70,6 @@
#define LOCAL_RET "ret"
-#define CS_CLASS_NATIVECALLS "NativeCalls"
-#define CS_CLASS_NATIVECALLS_EDITOR "EditorNativeCalls"
#define CS_FIELD_MEMORYOWN "memoryOwn"
#define CS_PARAM_METHODBIND "method"
#define CS_PARAM_INSTANCE "ptr"
@@ -105,6 +103,8 @@
#define C_METHOD_MANAGED_TO_DICT C_NS_MONOMARSHAL "::mono_object_to_Dictionary"
#define C_METHOD_MANAGED_FROM_DICT C_NS_MONOMARSHAL "::Dictionary_to_mono_object"
+#define BINDINGS_GENERATOR_VERSION UINT32_C(2)
+
const char *BindingsGenerator::TypeInterface::DEFAULT_VARARG_C_IN = "\t%0 %1_in = %1;\n";
bool BindingsGenerator::verbose_output = false;
@@ -248,14 +248,14 @@ void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
if (imethod.is_virtual)
continue;
- const TypeInterface *return_type = _get_type_by_name_or_placeholder(imethod.return_type);
+ const TypeInterface *return_type = _get_type_or_placeholder(imethod.return_type);
String im_sig;
String im_unique_sig;
if (p_itype.is_object_type) {
im_sig += "IntPtr " CS_PARAM_METHODBIND ", ";
- im_unique_sig += imethod.return_type.operator String() + ",IntPtr,IntPtr";
+ im_unique_sig += imethod.return_type.cname.operator String() + ",IntPtr,IntPtr";
}
im_sig += "IntPtr " CS_PARAM_INSTANCE;
@@ -263,7 +263,7 @@ void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) {
// Get arguments information
int i = 0;
for (const List<ArgumentInterface>::Element *F = imethod.arguments.front(); F; F = F->next()) {
- const TypeInterface *arg_type = _get_type_by_name_or_placeholder(F->get().type);
+ const TypeInterface *arg_type = _get_type_or_placeholder(F->get().type);
im_sig += ", ";
im_sig += arg_type->im_type_in;
@@ -529,7 +529,15 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
"using System.Collections.Generic;\n"
"\n");
cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
- cs_icalls_content.push_back(INDENT1 "internal static class " CS_CLASS_NATIVECALLS "\n" INDENT1 OPEN_BLOCK);
+ cs_icalls_content.push_back(INDENT1 "internal static class " BINDINGS_CLASS_NATIVECALLS "\n" INDENT1 OPEN_BLOCK);
+
+ cs_icalls_content.push_back(INDENT2 "internal static ulong godot_api_hash = ");
+ cs_icalls_content.push_back(String::num_uint64(GDMono::get_singleton()->get_api_core_hash()) + ";\n");
+ cs_icalls_content.push_back(INDENT2 "internal static uint bindings_version = ");
+ cs_icalls_content.push_back(String::num_uint64(BINDINGS_GENERATOR_VERSION) + ";\n");
+ cs_icalls_content.push_back(INDENT2 "internal static uint cs_glue_version = ");
+ cs_icalls_content.push_back(String::num_uint64(CS_GLUE_VERSION) + ";\n");
+ cs_icalls_content.push_back("\n");
#define ADD_INTERNAL_CALL(m_icall) \
if (!m_icall.editor_only) { \
@@ -551,7 +559,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo
cs_icalls_content.push_back(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
- String internal_methods_file = path_join(core_dir, CS_CLASS_NATIVECALLS ".cs");
+ String internal_methods_file = path_join(core_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
Error err = _save_file(internal_methods_file, cs_icalls_content);
if (err != OK)
@@ -626,7 +634,15 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
"using System.Collections.Generic;\n"
"\n");
cs_icalls_content.push_back("namespace " BINDINGS_NAMESPACE "\n" OPEN_BLOCK);
- cs_icalls_content.push_back(INDENT1 "internal static class " CS_CLASS_NATIVECALLS_EDITOR "\n" INDENT1 OPEN_BLOCK);
+ cs_icalls_content.push_back(INDENT1 "internal static class " BINDINGS_CLASS_NATIVECALLS_EDITOR "\n" INDENT1 OPEN_BLOCK);
+
+ cs_icalls_content.push_back(INDENT2 "internal static ulong godot_api_hash = ");
+ cs_icalls_content.push_back(String::num_uint64(GDMono::get_singleton()->get_api_editor_hash()) + ";\n");
+ cs_icalls_content.push_back(INDENT2 "internal static uint bindings_version = ");
+ cs_icalls_content.push_back(String::num_uint64(BINDINGS_GENERATOR_VERSION) + ";\n");
+ cs_icalls_content.push_back(INDENT2 "internal static uint cs_glue_version = ");
+ cs_icalls_content.push_back(String::num_uint64(CS_GLUE_VERSION) + ";\n");
+ cs_icalls_content.push_back("\n");
#define ADD_INTERNAL_CALL(m_icall) \
if (m_icall.editor_only) { \
@@ -648,7 +664,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_output_dir,
cs_icalls_content.push_back(INDENT1 CLOSE_BLOCK CLOSE_BLOCK);
- String internal_methods_file = path_join(core_dir, CS_CLASS_NATIVECALLS_EDITOR ".cs");
+ String internal_methods_file = path_join(core_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
Error err = _save_file(internal_methods_file, cs_icalls_content);
if (err != OK)
@@ -714,7 +730,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
}
output.push_back(INDENT1 "public ");
- output.push_back(itype.is_singleton ? "static class " : "class ");
+ bool is_abstract = itype.is_object_type && !ClassDB::can_instance(itype.name) && ClassDB::is_class_enabled(itype.name); // can_instance returns true if there's a constructor and the class is not 'disabled'
+ output.push_back(itype.is_singleton ? "static class " : (is_abstract ? "abstract class " : "class "));
output.push_back(itype.proxy_name);
if (itype.is_singleton) {
@@ -882,7 +899,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back("\";\n");
output.push_back(INDENT2 "internal static IntPtr " BINDINGS_PTR_FIELD " = ");
- output.push_back(itype.api_type == ClassDB::API_EDITOR ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS);
+ output.push_back(itype.api_type == ClassDB::API_EDITOR ? BINDINGS_CLASS_NATIVECALLS_EDITOR : BINDINGS_CLASS_NATIVECALLS);
output.push_back("." ICALL_PREFIX);
output.push_back(itype.name);
output.push_back(SINGLETON_ICALL_SUFFIX "();\n");
@@ -912,7 +929,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
// The engine will initialize the pointer field of the managed side before calling the constructor
// This is why we only allocate a new native object from the constructor if the pointer field is not set
output.push_back(")\n" OPEN_BLOCK_L2 "if (" BINDINGS_PTR_FIELD " == IntPtr.Zero)\n" INDENT4 BINDINGS_PTR_FIELD " = ");
- output.push_back(itype.api_type == ClassDB::API_EDITOR ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS);
+ output.push_back(itype.api_type == ClassDB::API_EDITOR ? BINDINGS_CLASS_NATIVECALLS_EDITOR : BINDINGS_CLASS_NATIVECALLS);
output.push_back("." + ctor_method);
output.push_back("(this);\n" CLOSE_BLOCK_L2);
} else {
@@ -956,7 +973,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
"if (disposed) return;\n" INDENT3
"if (" BINDINGS_PTR_FIELD " != IntPtr.Zero)\n" OPEN_BLOCK_L3
"if (" CS_FIELD_MEMORYOWN ")\n" OPEN_BLOCK_L4 CS_FIELD_MEMORYOWN
- " = false;\n" INDENT5 CS_CLASS_NATIVECALLS "." ICALL_OBJECT_DTOR
+ " = false;\n" INDENT5 BINDINGS_CLASS_NATIVECALLS "." ICALL_OBJECT_DTOR
"(this, " BINDINGS_PTR_FIELD ");\n" CLOSE_BLOCK_L4 CLOSE_BLOCK_L3 INDENT3
"this." BINDINGS_PTR_FIELD " = IntPtr.Zero;\n" INDENT3
"GC.SuppressFinalize(this);\n" INDENT3 "disposed = true;\n" CLOSE_BLOCK_L2);
@@ -1052,12 +1069,12 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
}
if (getter && setter) {
- ERR_FAIL_COND_V(getter->return_type != setter->arguments.back()->get().type, ERR_BUG);
+ ERR_FAIL_COND_V(getter->return_type.cname != setter->arguments.back()->get().type.cname, ERR_BUG);
}
- StringName proptype_name = getter ? getter->return_type : setter->arguments.back()->get().type;
+ const TypeReference &proptype_name = getter ? getter->return_type : setter->arguments.back()->get().type;
- const TypeInterface *prop_itype = _get_type_by_name_or_null(proptype_name);
+ const TypeInterface *prop_itype = _get_type_or_null(proptype_name);
ERR_FAIL_NULL_V(prop_itype, ERR_BUG); // Property type not found
String prop_proxy_name = escape_csharp_keyword(snake_to_pascal_case(p_iprop.cname));
@@ -1105,9 +1122,9 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
p_output.push_back(getter->proxy_name + "(");
if (p_iprop.index != -1) {
const ArgumentInterface &idx_arg = getter->arguments.front()->get();
- if (idx_arg.type != name_cache.type_int) {
+ if (idx_arg.type.cname != name_cache.type_int) {
// Assume the index parameter is an enum
- const TypeInterface *idx_arg_type = _get_type_by_name_or_null(idx_arg.type);
+ const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type);
CRASH_COND(idx_arg_type == NULL);
p_output.push_back("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index));
} else {
@@ -1122,9 +1139,9 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
p_output.push_back(setter->proxy_name + "(");
if (p_iprop.index != -1) {
const ArgumentInterface &idx_arg = setter->arguments.front()->get();
- if (idx_arg.type != name_cache.type_int) {
+ if (idx_arg.type.cname != name_cache.type_int) {
// Assume the index parameter is an enum
- const TypeInterface *idx_arg_type = _get_type_by_name_or_null(idx_arg.type);
+ const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type);
CRASH_COND(idx_arg_type == NULL);
p_output.push_back("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index) + ", ");
} else {
@@ -1141,7 +1158,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterface &p_itype, const BindingsGenerator::MethodInterface &p_imethod, int &p_method_bind_count, List<String> &p_output) {
- const TypeInterface *return_type = _get_type_by_name_or_placeholder(p_imethod.return_type);
+ const TypeInterface *return_type = _get_type_or_placeholder(p_imethod.return_type);
String method_bind_field = "method_bind_" + itos(p_method_bind_count);
@@ -1158,7 +1175,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
// Retrieve information from the arguments
for (const List<ArgumentInterface>::Element *F = p_imethod.arguments.front(); F; F = F->next()) {
const ArgumentInterface &iarg = F->get();
- const TypeInterface *arg_type = _get_type_by_name_or_placeholder(iarg.type);
+ const TypeInterface *arg_type = _get_type_or_placeholder(iarg.type);
// Add the current arguments to the signature
// If the argument has a default value which is not a constant, we will make it Nullable
@@ -1229,7 +1246,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
{
if (p_itype.is_object_type && !p_imethod.is_virtual && !p_imethod.requires_object_call) {
p_output.push_back(MEMBER_BEGIN "private static IntPtr ");
- p_output.push_back(method_bind_field + " = " CS_CLASS_NATIVECALLS "." ICALL_GET_METHODBIND "(" BINDINGS_NATIVE_NAME_FIELD ", \"");
+ p_output.push_back(method_bind_field + " = " BINDINGS_CLASS_NATIVECALLS "." ICALL_GET_METHODBIND "(" BINDINGS_NATIVE_NAME_FIELD ", \"");
p_output.push_back(p_imethod.name);
p_output.push_back("\");\n");
}
@@ -1310,22 +1327,20 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
const InternalCall *im_icall = match->value();
- String im_call = im_icall->editor_only ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS;
- im_call += "." + im_icall->name + "(" + icall_params + ");\n";
+ String im_call = im_icall->editor_only ? BINDINGS_CLASS_NATIVECALLS_EDITOR : BINDINGS_CLASS_NATIVECALLS;
+ im_call += "." + im_icall->name + "(" + icall_params + ")";
if (p_imethod.arguments.size())
p_output.push_back(cs_in_statements);
if (return_type->cname == name_cache.type_void) {
- p_output.push_back(im_call);
+ p_output.push_back(im_call + ";\n");
} else if (return_type->cs_out.empty()) {
- p_output.push_back("return " + im_call);
+ p_output.push_back("return " + im_call + ";\n");
} else {
- p_output.push_back(return_type->im_type_out);
- p_output.push_back(" " LOCAL_RET " = ");
- p_output.push_back(im_call);
p_output.push_back(INDENT3);
- p_output.push_back(sformat(return_type->cs_out, LOCAL_RET) + "\n");
+ p_output.push_back(sformat(return_type->cs_out, im_call, return_type->cs_type, return_type->im_type_out));
+ p_output.push_back("\n");
}
p_output.push_back(CLOSE_BLOCK_L2);
@@ -1400,25 +1415,33 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
}
output.push_back("namespace GodotSharpBindings\n" OPEN_BLOCK);
+
output.push_back("uint64_t get_core_api_hash() { return ");
- output.push_back(itos(GDMono::get_singleton()->get_api_core_hash()) + "; }\n");
+ output.push_back(String::num_uint64(GDMono::get_singleton()->get_api_core_hash()) + "; }\n");
+
output.push_back("#ifdef TOOLS_ENABLED\n"
"uint64_t get_editor_api_hash() { return ");
- output.push_back(itos(GDMono::get_singleton()->get_api_editor_hash()) +
+ output.push_back(String::num_uint64(GDMono::get_singleton()->get_api_editor_hash()) +
"; }\n#endif // TOOLS_ENABLED\n");
+
+ output.push_back("uint32_t get_bindings_version() { return ");
+ output.push_back(String::num_uint64(BINDINGS_GENERATOR_VERSION) + "; }\n");
+ output.push_back("uint32_t get_cs_glue_version() { return ");
+ output.push_back(String::num_uint64(CS_GLUE_VERSION) + "; }\n");
+
output.push_back("void register_generated_icalls() " OPEN_BLOCK);
output.push_back("\tgodot_register_header_icalls();");
-#define ADD_INTERNAL_CALL_REGISTRATION(m_icall) \
- { \
- output.push_back("\tmono_add_internal_call("); \
- output.push_back("\"" BINDINGS_NAMESPACE "."); \
- output.push_back(m_icall.editor_only ? CS_CLASS_NATIVECALLS_EDITOR : CS_CLASS_NATIVECALLS); \
- output.push_back("::"); \
- output.push_back(m_icall.name); \
- output.push_back("\", (void*)"); \
- output.push_back(m_icall.name); \
- output.push_back(");\n"); \
+#define ADD_INTERNAL_CALL_REGISTRATION(m_icall) \
+ { \
+ output.push_back("\tmono_add_internal_call("); \
+ output.push_back("\"" BINDINGS_NAMESPACE "."); \
+ output.push_back(m_icall.editor_only ? BINDINGS_CLASS_NATIVECALLS_EDITOR : BINDINGS_CLASS_NATIVECALLS); \
+ output.push_back("::"); \
+ output.push_back(m_icall.name); \
+ output.push_back("\", (void*)"); \
+ output.push_back(m_icall.name); \
+ output.push_back(");\n"); \
}
bool tools_sequence = false;
@@ -1486,6 +1509,14 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
return OK;
}
+uint32_t BindingsGenerator::get_version() {
+ return BINDINGS_GENERATOR_VERSION;
+}
+
+uint32_t BindingsGenerator::get_cs_glue_version() {
+ return CS_GLUE_VERSION;
+}
+
Error BindingsGenerator::_save_file(const String &p_path, const List<String> &p_content) {
FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
@@ -1507,9 +1538,9 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
if (p_imethod.is_virtual)
return OK; // Ignore
- bool ret_void = p_imethod.return_type == name_cache.type_void;
+ bool ret_void = p_imethod.return_type.cname == name_cache.type_void;
- const TypeInterface *return_type = _get_type_by_name_or_placeholder(p_imethod.return_type);
+ const TypeInterface *return_type = _get_type_or_placeholder(p_imethod.return_type);
String argc_str = itos(p_imethod.arguments.size());
@@ -1521,16 +1552,16 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
int i = 0;
for (const List<ArgumentInterface>::Element *F = p_imethod.arguments.front(); F; F = F->next()) {
const ArgumentInterface &iarg = F->get();
- const TypeInterface *arg_type = _get_type_by_name_or_placeholder(iarg.type);
+ const TypeInterface *arg_type = _get_type_or_placeholder(iarg.type);
String c_param_name = "arg" + itos(i + 1);
if (p_imethod.is_vararg) {
if (i < p_imethod.arguments.size() - 1) {
c_in_statements += sformat(arg_type->c_in.size() ? arg_type->c_in : TypeInterface::DEFAULT_VARARG_C_IN, "Variant", c_param_name);
- c_in_statements += "\t" C_LOCAL_PTRCALL_ARGS ".set(0, ";
- c_in_statements += sformat("&%s_in", c_param_name);
- c_in_statements += ");\n";
+ c_in_statements += "\t" C_LOCAL_PTRCALL_ARGS ".set(";
+ c_in_statements += itos(i);
+ c_in_statements += sformat(", &%s_in);\n", c_param_name);
}
} else {
if (i > 0)
@@ -1662,42 +1693,49 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
return OK;
}
-const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_by_name_or_null(const StringName &p_cname) {
+const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_null(const TypeReference &p_typeref) {
- const Map<StringName, TypeInterface>::Element *builtin_type_match = builtin_types.find(p_cname);
+ const Map<StringName, TypeInterface>::Element *builtin_type_match = builtin_types.find(p_typeref.cname);
if (builtin_type_match)
return &builtin_type_match->get();
- const OrderedHashMap<StringName, TypeInterface>::Element obj_type_match = obj_types.find(p_cname);
+ const OrderedHashMap<StringName, TypeInterface>::Element obj_type_match = obj_types.find(p_typeref.cname);
if (obj_type_match)
return &obj_type_match.get();
- const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(p_cname);
+ if (p_typeref.is_enum) {
+ const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(p_typeref.cname);
+
+ if (enum_match)
+ return &enum_match->get();
- if (enum_match)
- return &enum_match->get();
+ // Enum not found. Most likely because none of its constants were bound, so it's empty. That's fine. Use int instead.
+ const Map<StringName, TypeInterface>::Element *int_match = builtin_types.find(name_cache.type_int);
+ ERR_FAIL_NULL_V(int_match, NULL);
+ return &int_match->get();
+ }
return NULL;
}
-const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_by_name_or_placeholder(const StringName &p_cname) {
+const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placeholder(const TypeReference &p_typeref) {
- const TypeInterface *found = _get_type_by_name_or_null(p_cname);
+ const TypeInterface *found = _get_type_or_null(p_typeref);
if (found)
return found;
- ERR_PRINTS(String() + "Type not found. Creating placeholder: " + p_cname.operator String());
+ ERR_PRINTS(String() + "Type not found. Creating placeholder: " + p_typeref.cname.operator String());
- const Map<StringName, TypeInterface>::Element *match = placeholder_types.find(p_cname);
+ const Map<StringName, TypeInterface>::Element *match = placeholder_types.find(p_typeref.cname);
if (match)
return &match->get();
TypeInterface placeholder;
- TypeInterface::create_placeholder_type(placeholder, p_cname);
+ TypeInterface::create_placeholder_type(placeholder, p_typeref.cname);
return &placeholder_types.insert(placeholder.cname, placeholder)->get();
}
@@ -1841,7 +1879,7 @@ void BindingsGenerator::_populate_object_type_interfaces() {
// The method Object.free is registered as a virtual method, but without the virtual flag.
// This is because this method is not supposed to be overridden, but called.
// We assume the return type is void.
- imethod.return_type = name_cache.type_void;
+ imethod.return_type.cname = name_cache.type_void;
// Actually, more methods like this may be added in the future,
// which could actually will return something different.
@@ -1856,21 +1894,22 @@ void BindingsGenerator::_populate_object_type_interfaces() {
} else {
ERR_PRINTS("Missing MethodBind for non-virtual method: " + itype.name + "." + imethod.name);
}
- } else if (return_info.type == Variant::INT && return_info.usage & PROPERTY_USAGE_CLASS_IS_ENUM) { // TODO redundant?
- imethod.return_type = return_info.class_name;
+ } else if (return_info.type == Variant::INT && return_info.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ imethod.return_type.cname = return_info.class_name;
+ imethod.return_type.is_enum = true;
} else if (return_info.class_name != StringName()) {
- imethod.return_type = return_info.class_name;
+ imethod.return_type.cname = return_info.class_name;
} else if (return_info.hint == PROPERTY_HINT_RESOURCE_TYPE) {
- imethod.return_type = return_info.hint_string;
+ imethod.return_type.cname = return_info.hint_string;
} else if (return_info.type == Variant::NIL && return_info.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
- imethod.return_type = name_cache.type_Variant;
+ imethod.return_type.cname = name_cache.type_Variant;
} else if (return_info.type == Variant::NIL) {
- imethod.return_type = name_cache.type_void;
+ imethod.return_type.cname = name_cache.type_void;
} else {
- imethod.return_type = Variant::get_type_name(return_info.type);
+ imethod.return_type.cname = Variant::get_type_name(return_info.type);
}
- if (!itype.requires_collections && imethod.return_type == name_cache.type_Dictionary)
+ if (!itype.requires_collections && imethod.return_type.cname == name_cache.type_Dictionary)
itype.requires_collections = true;
for (int i = 0; i < argc; i++) {
@@ -1879,21 +1918,22 @@ void BindingsGenerator::_populate_object_type_interfaces() {
ArgumentInterface iarg;
iarg.name = arginfo.name;
- if (arginfo.type == Variant::INT && arginfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) { // TODO redundant?
- iarg.type = arginfo.class_name;
+ if (arginfo.type == Variant::INT && arginfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ iarg.type.cname = arginfo.class_name;
+ iarg.type.is_enum = true;
} else if (arginfo.class_name != StringName()) {
- iarg.type = arginfo.class_name;
+ iarg.type.cname = arginfo.class_name;
} else if (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
- iarg.type = arginfo.hint_string;
+ iarg.type.cname = arginfo.hint_string;
} else if (arginfo.type == Variant::NIL) {
- iarg.type = name_cache.type_Variant;
+ iarg.type.cname = name_cache.type_Variant;
} else {
- iarg.type = Variant::get_type_name(arginfo.type);
+ iarg.type.cname = Variant::get_type_name(arginfo.type);
}
iarg.name = escape_csharp_keyword(snake_to_camel_case(iarg.name));
- if (!itype.requires_collections && iarg.type == name_cache.type_Dictionary)
+ if (!itype.requires_collections && iarg.type.cname == name_cache.type_Dictionary)
itype.requires_collections = true;
if (m && m->has_default_argument(i)) {
@@ -1905,7 +1945,7 @@ void BindingsGenerator::_populate_object_type_interfaces() {
if (imethod.is_vararg) {
ArgumentInterface ivararg;
- ivararg.type = name_cache.type_VarArg;
+ ivararg.type.cname = name_cache.type_VarArg;
ivararg.name = "@args";
imethod.add_argument(ivararg);
}
@@ -1990,17 +2030,11 @@ void BindingsGenerator::_populate_object_type_interfaces() {
itype.enums.push_back(ienum);
TypeInterface enum_itype;
+ enum_itype.is_enum = true;
enum_itype.name = itype.name + "." + String(*k);
enum_itype.cname = StringName(enum_itype.name);
enum_itype.proxy_name = itype.proxy_name + "." + enum_proxy_name;
- enum_itype.c_arg_in = "&%s";
- enum_itype.c_type = "int";
- enum_itype.c_type_in = "int";
- enum_itype.c_type_out = "int";
- enum_itype.cs_type = enum_itype.proxy_name;
- enum_itype.im_type_in = enum_itype.proxy_name;
- enum_itype.im_type_out = enum_itype.proxy_name;
- enum_itype.class_doc = &EditorHelp::get_doc_data()->class_list[enum_itype.proxy_name];
+ TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype);
}
@@ -2035,7 +2069,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
switch (p_val.get_type()) {
case Variant::NIL:
- if (ClassDB::class_exists(r_iarg.type)) {
+ if (ClassDB::class_exists(r_iarg.type.cname)) {
// Object type
r_iarg.default_argument = "null";
} else {
@@ -2048,7 +2082,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
r_iarg.default_argument = bool(p_val) ? "true" : "false";
break;
case Variant::INT:
- if (r_iarg.type != name_cache.type_int) {
+ if (r_iarg.type.cname != name_cache.type_int) {
r_iarg.default_argument = "(%s)" + r_iarg.default_argument;
}
break;
@@ -2109,7 +2143,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
default: {}
}
- if (r_iarg.def_param_mode == ArgumentInterface::CONSTANT && r_iarg.type == name_cache.type_Variant && r_iarg.default_argument != "null")
+ if (r_iarg.def_param_mode == ArgumentInterface::CONSTANT && r_iarg.type.cname == name_cache.type_Variant && r_iarg.default_argument != "null")
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF;
}
@@ -2128,7 +2162,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype.c_arg_in = "&%s_in"; \
itype.c_type_in = m_type_in; \
itype.cs_in = "ref %s"; \
- itype.cs_out = "return (" #m_type ")%0;"; \
+ itype.cs_out = "return (%1)%0;"; \
itype.im_type_out = "object"; \
builtin_types.insert(itype.cname, itype); \
}
@@ -2223,7 +2257,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype.c_type_out = itype.c_type + "*";
itype.cs_type = itype.proxy_name;
itype.cs_in = "NodePath." CS_SMETHOD_GETINSTANCE "(%0)";
- itype.cs_out = "return new NodePath(%0);";
+ itype.cs_out = "return new %1(%0);";
itype.im_type_in = "IntPtr";
itype.im_type_out = "IntPtr";
_populate_builtin_type(itype, Variant::NODE_PATH);
@@ -2246,7 +2280,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
itype.c_type_out = itype.c_type + "*";
itype.cs_type = itype.proxy_name;
itype.cs_in = "RID." CS_SMETHOD_GETINSTANCE "(%0)";
- itype.cs_out = "return new RID(%0);";
+ itype.cs_out = "return new %1(%0);";
itype.im_type_in = "IntPtr";
itype.im_type_out = "IntPtr";
_populate_builtin_type(itype, Variant::_RID);
@@ -2375,11 +2409,11 @@ void BindingsGenerator::_populate_builtin_type(TypeInterface &r_itype, Variant::
iarg.name = pi.name;
if (pi.type == Variant::NIL)
- iarg.type = name_cache.type_Variant;
+ iarg.type.cname = name_cache.type_Variant;
else
- iarg.type = Variant::get_type_name(pi.type);
+ iarg.type.cname = Variant::get_type_name(pi.type);
- if (!r_itype.requires_collections && iarg.type == name_cache.type_Dictionary)
+ if (!r_itype.requires_collections && iarg.type.cname == name_cache.type_Dictionary)
r_itype.requires_collections = true;
if ((mi.default_arguments.size() - mi.arguments.size() + i) >= 0)
@@ -2390,12 +2424,12 @@ void BindingsGenerator::_populate_builtin_type(TypeInterface &r_itype, Variant::
if (mi.return_val.type == Variant::NIL) {
if (mi.return_val.name != "")
- imethod.return_type = name_cache.type_Variant;
+ imethod.return_type.cname = name_cache.type_Variant;
} else {
- imethod.return_type = Variant::get_type_name(mi.return_val.type);
+ imethod.return_type.cname = Variant::get_type_name(mi.return_val.type);
}
- if (!r_itype.requires_collections && imethod.return_type == name_cache.type_Dictionary)
+ if (!r_itype.requires_collections && imethod.return_type.cname == name_cache.type_Dictionary)
r_itype.requires_collections = true;
if (r_itype.class_doc) {
@@ -2461,13 +2495,11 @@ void BindingsGenerator::_populate_global_constants() {
EnumInterface &ienum = E->get();
TypeInterface enum_itype;
- enum_itype = TypeInterface::create_value_type(ienum.cname);
- enum_itype.c_arg_in = "&%s";
- enum_itype.c_type = "int";
- enum_itype.c_type_in = "int";
- enum_itype.c_type_out = "int";
- enum_itype.im_type_in = enum_itype.name;
- enum_itype.im_type_out = enum_itype.name;
+ enum_itype.is_enum = true;
+ enum_itype.name = ienum.cname.operator String();
+ enum_itype.cname = ienum.cname;
+ enum_itype.proxy_name = enum_itype.name;
+ TypeInterface::postsetup_enum_type(enum_itype);
enum_types.insert(enum_itype.cname, enum_itype);
ienum.prefix = _determine_enum_prefix(ienum);
@@ -2488,15 +2520,13 @@ void BindingsGenerator::_populate_global_constants() {
hardcoded_enums.push_back("Vector3.Axis");
for (List<StringName>::Element *E = hardcoded_enums.front(); E; E = E->next()) {
// These enums are not generated and must be written manually (e.g.: Vector3.Axis)
- // Here, we are assuming core types do not begin with underscore
+ // Here, we assume core types do not begin with underscore
TypeInterface enum_itype;
- enum_itype = TypeInterface::create_value_type(E->get());
- enum_itype.c_arg_in = "&%s";
- enum_itype.c_type = "int";
- enum_itype.c_type_in = "int";
- enum_itype.c_type_out = "int";
- enum_itype.im_type_in = enum_itype.name;
- enum_itype.im_type_out = enum_itype.name;
+ enum_itype.is_enum = true;
+ enum_itype.name = E->get().operator String();
+ enum_itype.cname = E->get();
+ enum_itype.proxy_name = 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 9b5a9cea88..5b33a0e53f 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -81,6 +81,15 @@ class BindingsGenerator {
const DocData::PropertyDoc *prop_doc;
};
+ struct TypeReference {
+ StringName cname;
+ bool is_enum;
+
+ TypeReference() {
+ is_enum = false;
+ }
+ };
+
struct ArgumentInterface {
enum DefaultParamMode {
CONSTANT,
@@ -88,7 +97,8 @@ class BindingsGenerator {
NULLABLE_REF
};
- StringName type;
+ TypeReference type;
+
String name;
String default_argument;
DefaultParamMode def_param_mode;
@@ -110,7 +120,7 @@ class BindingsGenerator {
/**
* [TypeInterface::name] of the return type
*/
- StringName return_type;
+ TypeReference return_type;
/**
* Determines if the method has a variable number of arguments (VarArg)
@@ -146,7 +156,7 @@ class BindingsGenerator {
}
MethodInterface() {
- return_type = BindingsGenerator::get_singleton()->name_cache.type_void;
+ return_type.cname = BindingsGenerator::get_singleton()->name_cache.type_void;
is_vararg = false;
is_virtual = false;
requires_object_call = false;
@@ -175,6 +185,7 @@ class BindingsGenerator {
ClassDB::APIType api_type;
+ bool is_enum;
bool is_object_type;
bool is_singleton;
bool is_reference;
@@ -276,7 +287,9 @@ class BindingsGenerator {
* One or more statements that determine how a variable of this type is returned from a method.
* It must contain the return statement(s).
* Formatting elements:
- * %0 or %s: name of the variable to be returned
+ * %0: internal method call statement
+ * %1: [cs_type] of the return type
+ * %2: [im_type_out] of the return type
*/
String cs_out;
@@ -293,8 +306,6 @@ class BindingsGenerator {
/**
* Type used for the return type of internal call methods.
- * If [cs_out] is not empty and the method return type is not void,
- * it is also used for the type of the return variable.
*/
String im_type_out;
@@ -379,10 +390,24 @@ class BindingsGenerator {
r_itype.im_type_out = r_itype.proxy_name;
}
+ static void postsetup_enum_type(TypeInterface &r_enum_itype) {
+ r_enum_itype.c_arg_in = "&%s";
+ r_enum_itype.c_type = "int";
+ r_enum_itype.c_type_in = "int";
+ r_enum_itype.c_type_out = "int";
+ r_enum_itype.cs_type = r_enum_itype.proxy_name;
+ r_enum_itype.cs_in = "(int)%s";
+ r_enum_itype.cs_out = "return (%1)%0;";
+ r_enum_itype.im_type_in = "int";
+ r_enum_itype.im_type_out = "int";
+ r_enum_itype.class_doc = &EditorHelp::get_doc_data()->class_list[r_enum_itype.proxy_name];
+ }
+
TypeInterface() {
api_type = ClassDB::API_NONE;
+ is_enum = false;
is_object_type = false;
is_singleton = false;
is_reference = false;
@@ -492,6 +517,8 @@ class BindingsGenerator {
return "Ref";
else if (p_type.is_object_type)
return "Obj";
+ else if (p_type.is_enum)
+ return "int";
return p_type.name;
}
@@ -501,8 +528,8 @@ class BindingsGenerator {
void _generate_header_icalls();
void _generate_method_icalls(const TypeInterface &p_itype);
- const TypeInterface *_get_type_by_name_or_null(const StringName &p_cname);
- const TypeInterface *_get_type_by_name_or_placeholder(const StringName &p_cname);
+ const TypeInterface *_get_type_or_null(const TypeReference &p_typeref);
+ const TypeInterface *_get_type_or_placeholder(const TypeReference &p_typeref);
void _default_argument_from_variant(const Variant &p_val, ArgumentInterface &r_iarg);
void _populate_builtin_type(TypeInterface &r_itype, Variant::Type vtype);
@@ -536,6 +563,9 @@ public:
Error generate_cs_editor_project(const String &p_output_dir, const String &p_core_dll_path, bool p_verbose_output = true);
Error generate_glue(const String &p_output_dir);
+ static uint32_t get_version();
+ static uint32_t get_cs_glue_version();
+
void initialize();
_FORCE_INLINE_ static BindingsGenerator *get_singleton() {
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index 6b41b10981..43d58caad2 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -33,13 +33,16 @@
#include "main/main.h"
#include "../godotsharp_dirs.h"
-#include "../mono_gd/gd_mono.h"
#include "../mono_gd/gd_mono_class.h"
#include "../mono_gd/gd_mono_marshal.h"
#include "../utils/path_utils.h"
#include "bindings_generator.h"
#include "godotsharp_editor.h"
+#define PROP_NAME_MSBUILD_MONO "MSBuild (Mono)"
+#define PROP_NAME_MSBUILD_VS "MSBuild (VS Build Tools)"
+#define PROP_NAME_XBUILD "xbuild (Deprecated)"
+
void godot_icall_BuildInstance_ExitCallback(MonoString *p_solution, MonoString *p_config, int p_exit_code) {
String solution = GDMonoMarshal::mono_string_to_godot(p_solution);
@@ -77,46 +80,42 @@ String _find_build_engine_on_unix(const String &p_name) {
}
#endif
-void godot_icall_BuildInstance_get_MSBuildInfo(MonoString **r_msbuild_path, MonoString **r_framework_path) {
+MonoString *godot_icall_BuildInstance_get_MSBuildPath() {
GodotSharpBuilds::BuildTool build_tool = GodotSharpBuilds::BuildTool(int(EditorSettings::get_singleton()->get("mono/builds/build_tool")));
#if defined(WINDOWS_ENABLED)
switch (build_tool) {
- case GodotSharpBuilds::MSBUILD: {
+ case GodotSharpBuilds::MSBUILD_VS: {
static String msbuild_tools_path = MonoRegUtils::find_msbuild_tools_path();
if (msbuild_tools_path.length()) {
if (!msbuild_tools_path.ends_with("\\"))
msbuild_tools_path += "\\";
- // FrameworkPathOverride
- const MonoRegInfo &mono_reg_info = GDMono::get_singleton()->get_mono_reg_info();
- if (mono_reg_info.assembly_dir.length()) {
- *r_msbuild_path = GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
-
- String framework_path = path_join(mono_reg_info.assembly_dir, "mono", "4.5");
- *r_framework_path = GDMonoMarshal::mono_string_from_godot(framework_path);
- } else {
- ERR_PRINT("Cannot find Mono's assemblies directory in the registry");
- }
-
- return;
+ return GDMonoMarshal::mono_string_from_godot(msbuild_tools_path + "MSBuild.exe");
}
if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print("Cannot find System's MSBuild. Trying with Mono's...\n");
- } // fall through
+ OS::get_singleton()->print("Cannot find executable for '" PROP_NAME_MSBUILD_VS "'. Trying with '" PROP_NAME_MSBUILD_MONO "'...\n");
+ } // FALL THROUGH
case GodotSharpBuilds::MSBUILD_MONO: {
String msbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("msbuild.bat");
if (!FileAccess::exists(msbuild_path)) {
- WARN_PRINTS("Cannot find msbuild ('mono/builds/build_tool'). Tried with path: " + msbuild_path);
+ WARN_PRINTS("Cannot find executable for '" PROP_NAME_MSBUILD_MONO "'. Tried with path: " + msbuild_path);
}
- *r_msbuild_path = GDMonoMarshal::mono_string_from_godot(msbuild_path);
+ return GDMonoMarshal::mono_string_from_godot(msbuild_path);
+ } break;
+ case GodotSharpBuilds::XBUILD: {
+ String xbuild_path = GDMono::get_singleton()->get_mono_reg_info().bin_dir.plus_file("xbuild.bat");
+
+ if (!FileAccess::exists(xbuild_path)) {
+ WARN_PRINTS("Cannot find executable for '" PROP_NAME_XBUILD "'. Tried with path: " + xbuild_path);
+ }
- return;
+ return GDMonoMarshal::mono_string_from_godot(xbuild_path);
} break;
default:
ERR_EXPLAIN("You don't deserve to live");
@@ -126,31 +125,74 @@ void godot_icall_BuildInstance_get_MSBuildInfo(MonoString **r_msbuild_path, Mono
static String msbuild_path = _find_build_engine_on_unix("msbuild");
static String xbuild_path = _find_build_engine_on_unix("xbuild");
- if (build_tool != GodotSharpBuilds::XBUILD) {
- if (msbuild_path.empty()) {
- WARN_PRINT("Cannot find msbuild ('mono/builds/build_tool').");
- return;
+ if (build_tool == GodotSharpBuilds::XBUILD) {
+ if (xbuild_path.empty()) {
+ WARN_PRINT("Cannot find binary for '" PROP_NAME_XBUILD "'");
+ return NULL;
}
} else {
- if (xbuild_path.empty()) {
- WARN_PRINT("Cannot find xbuild ('mono/builds/build_tool').");
- return;
+ if (msbuild_path.empty()) {
+ WARN_PRINT("Cannot find binary for '" PROP_NAME_MSBUILD_MONO "'");
+ return NULL;
}
}
- *r_msbuild_path = GDMonoMarshal::mono_string_from_godot(build_tool != GodotSharpBuilds::XBUILD ? msbuild_path : xbuild_path);
+ return GDMonoMarshal::mono_string_from_godot(build_tool != GodotSharpBuilds::XBUILD ? msbuild_path : xbuild_path);
+#else
+ (void)build_tool; // UNUSED
+
+ ERR_EXPLAIN("Not implemented on this platform");
+ ERR_FAIL_V(NULL);
+#endif
+}
+
+MonoString *godot_icall_BuildInstance_get_FrameworkPath() {
+
+#if defined(WINDOWS_ENABLED)
+ const MonoRegInfo &mono_reg_info = GDMono::get_singleton()->get_mono_reg_info();
+ if (mono_reg_info.assembly_dir.length()) {
+ String framework_path = path_join(mono_reg_info.assembly_dir, "mono", "4.5");
+ return GDMonoMarshal::mono_string_from_godot(framework_path);
+ }
- return;
+ ERR_EXPLAIN("Cannot find Mono's assemblies directory in the registry");
+ ERR_FAIL_V(NULL);
#else
- ERR_PRINT("Not implemented on this platform");
- return;
+ return NULL;
+#endif
+}
+
+MonoString *godot_icall_BuildInstance_get_MonoWindowsBinDir() {
+
+#if defined(WINDOWS_ENABLED)
+ const MonoRegInfo &mono_reg_info = GDMono::get_singleton()->get_mono_reg_info();
+ if (mono_reg_info.bin_dir.length()) {
+ return GDMonoMarshal::mono_string_from_godot(mono_reg_info.bin_dir);
+ }
+
+ ERR_EXPLAIN("Cannot find Mono's binaries directory in the registry");
+ ERR_FAIL_V(NULL);
+#else
+ return NULL;
+#endif
+}
+
+MonoBoolean godot_icall_BuildInstance_get_UsingMonoMSBuildOnWindows() {
+
+#if defined(WINDOWS_ENABLED)
+ return GodotSharpBuilds::BuildTool(int(EditorSettings::get_singleton()->get("mono/builds/build_tool"))) == GodotSharpBuilds::MSBUILD_MONO;
+#else
+ return false;
#endif
}
void GodotSharpBuilds::_register_internal_calls() {
mono_add_internal_call("GodotSharpTools.Build.BuildSystem::godot_icall_BuildInstance_ExitCallback", (void *)godot_icall_BuildInstance_ExitCallback);
- mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_MSBuildInfo", (void *)godot_icall_BuildInstance_get_MSBuildInfo);
+ mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_MSBuildPath", (void *)godot_icall_BuildInstance_get_MSBuildPath);
+ mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_FrameworkPath", (void *)godot_icall_BuildInstance_get_FrameworkPath);
+ mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_MonoWindowsBinDir", (void *)godot_icall_BuildInstance_get_MonoWindowsBinDir);
+ mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_UsingMonoMSBuildOnWindows", (void *)godot_icall_BuildInstance_get_UsingMonoMSBuildOnWindows);
}
void GodotSharpBuilds::show_build_error_dialog(const String &p_message) {
@@ -178,13 +220,15 @@ bool GodotSharpBuilds::build_api_sln(const String &p_name, const String &p_api_s
return true;
}
-bool GodotSharpBuilds::copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name) {
+bool GodotSharpBuilds::copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name, APIAssembly::Type p_api_type) {
String assembly_file = p_assembly_name + ".dll";
String assembly_src = p_src_dir.plus_file(assembly_file);
String assembly_dst = p_dst_dir.plus_file(assembly_file);
- if (!FileAccess::exists(assembly_dst) || FileAccess::get_modified_time(assembly_src) > FileAccess::get_modified_time(assembly_dst)) {
+ if (!FileAccess::exists(assembly_dst) ||
+ FileAccess::get_modified_time(assembly_src) > FileAccess::get_modified_time(assembly_dst) ||
+ GDMono::get_singleton()->metadata_is_api_assembly_invalidated(p_api_type)) {
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
String xml_file = p_assembly_name + ".xml";
@@ -200,36 +244,49 @@ bool GodotSharpBuilds::copy_api_assembly(const String &p_src_dir, const String &
memdelete(da);
if (err != OK) {
- show_build_error_dialog("Failed to copy " API_ASSEMBLY_NAME ".dll");
+ show_build_error_dialog("Failed to copy " + assembly_file);
return false;
}
+
+ GDMono::get_singleton()->metadata_set_api_assembly_invalidated(p_api_type, false);
}
return true;
}
-bool GodotSharpBuilds::make_api_sln(GodotSharpBuilds::APIType p_api_type) {
+String GodotSharpBuilds::_api_folder_name(APIAssembly::Type p_api_type) {
+
+ uint64_t api_hash = p_api_type == APIAssembly::API_CORE ?
+ GDMono::get_singleton()->get_api_core_hash() :
+ GDMono::get_singleton()->get_api_editor_hash();
+ return String::num_uint64(api_hash) +
+ "_" + String::num_uint64(BindingsGenerator::get_version()) +
+ "_" + String::num_uint64(BindingsGenerator::get_cs_glue_version());
+}
+
+bool GodotSharpBuilds::make_api_sln(APIAssembly::Type p_api_type) {
- String api_name = p_api_type == API_CORE ? API_ASSEMBLY_NAME : EDITOR_API_ASSEMBLY_NAME;
+ String api_name = p_api_type == APIAssembly::API_CORE ? API_ASSEMBLY_NAME : EDITOR_API_ASSEMBLY_NAME;
String api_build_config = "Release";
EditorProgress pr("mono_build_release_" + api_name, "Building " + api_name + " solution...", 4);
pr.step("Generating " + api_name + " solution");
- uint64_t core_hash = GDMono::get_singleton()->get_api_core_hash();
- uint64_t editor_hash = GDMono::get_singleton()->get_api_editor_hash();
+ String core_api_sln_dir = GodotSharpDirs::get_mono_solutions_dir()
+ .plus_file(_api_folder_name(APIAssembly::API_CORE))
+ .plus_file(API_ASSEMBLY_NAME);
+ String editor_api_sln_dir = GodotSharpDirs::get_mono_solutions_dir()
+ .plus_file(_api_folder_name(APIAssembly::API_EDITOR))
+ .plus_file(EDITOR_API_ASSEMBLY_NAME);
- String core_api_sln_dir = GodotSharpDirs::get_mono_solutions_dir().plus_file(API_ASSEMBLY_NAME "_" + itos(core_hash));
- String editor_api_sln_dir = GodotSharpDirs::get_mono_solutions_dir().plus_file(EDITOR_API_ASSEMBLY_NAME "_" + itos(editor_hash));
-
- String api_sln_dir = p_api_type == API_CORE ? core_api_sln_dir : editor_api_sln_dir;
+ String api_sln_dir = p_api_type == APIAssembly::API_CORE ? core_api_sln_dir : editor_api_sln_dir;
String api_sln_file = api_sln_dir.plus_file(api_name + ".sln");
if (!DirAccess::exists(api_sln_dir) || !FileAccess::exists(api_sln_file)) {
String core_api_assembly;
- if (p_api_type == API_EDITOR) {
+ if (p_api_type == APIAssembly::API_EDITOR) {
core_api_assembly = core_api_sln_dir.plus_file("bin")
.plus_file(api_build_config)
.plus_file(API_ASSEMBLY_NAME ".dll");
@@ -242,7 +299,7 @@ bool GodotSharpBuilds::make_api_sln(GodotSharpBuilds::APIType p_api_type) {
BindingsGenerator *gen = BindingsGenerator::get_singleton();
bool gen_verbose = OS::get_singleton()->is_stdout_verbose();
- Error err = p_api_type == API_CORE ?
+ Error err = p_api_type == APIAssembly::API_CORE ?
gen->generate_cs_core_project(api_sln_dir, gen_verbose) :
gen->generate_cs_editor_project(api_sln_dir, core_api_assembly, gen_verbose);
@@ -275,7 +332,7 @@ bool GodotSharpBuilds::make_api_sln(GodotSharpBuilds::APIType p_api_type) {
// Copy the built assembly to the assemblies directory
String api_assembly_dir = api_sln_dir.plus_file("bin").plus_file(api_build_config);
- if (!GodotSharpBuilds::copy_api_assembly(api_assembly_dir, res_assemblies_dir, api_name))
+ if (!GodotSharpBuilds::copy_api_assembly(api_assembly_dir, res_assemblies_dir, api_name, p_api_type))
return false;
pr.step("Done");
@@ -283,22 +340,22 @@ bool GodotSharpBuilds::make_api_sln(GodotSharpBuilds::APIType p_api_type) {
return true;
}
-bool GodotSharpBuilds::build_project_blocking() {
+bool GodotSharpBuilds::build_project_blocking(const String &p_config) {
if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path()))
return true; // No solution to build
- if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_CORE))
+ if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_CORE))
return false;
- if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_EDITOR))
+ if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_EDITOR))
return false;
EditorProgress pr("mono_project_debug_build", "Building project solution...", 2);
pr.step("Building project solution");
- MonoBuildInfo build_info(GodotSharpDirs::get_project_sln_path(), "Tools");
+ MonoBuildInfo build_info(GodotSharpDirs::get_project_sln_path(), p_config);
if (!GodotSharpBuilds::get_singleton()->build(build_info)) {
GodotSharpBuilds::show_build_error_dialog("Failed to build project solution");
return false;
@@ -309,6 +366,11 @@ bool GodotSharpBuilds::build_project_blocking() {
return true;
}
+bool GodotSharpBuilds::editor_build_callback() {
+
+ return build_project_blocking("Tools");
+}
+
GodotSharpBuilds *GodotSharpBuilds::singleton = NULL;
void GodotSharpBuilds::build_exit_callback(const MonoBuildInfo &p_build_info, int p_exit_code) {
@@ -362,25 +424,19 @@ GodotSharpBuilds::GodotSharpBuilds() {
singleton = this;
- EditorNode::get_singleton()->add_build_callback(&GodotSharpBuilds::build_project_blocking);
+ EditorNode::get_singleton()->add_build_callback(&GodotSharpBuilds::editor_build_callback);
// Build tool settings
EditorSettings *ed_settings = EditorSettings::get_singleton();
-#ifdef WINDOWS_ENABLED
- // TODO: Default to MSBUILD_MONO if its csc.exe issue is fixed in the installed mono version
- EDITOR_DEF("mono/builds/build_tool", MSBUILD);
-#else
EDITOR_DEF("mono/builds/build_tool", MSBUILD_MONO);
-#endif
ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/builds/build_tool", PROPERTY_HINT_ENUM,
+ PROP_NAME_MSBUILD_MONO
#ifdef WINDOWS_ENABLED
- "MSBuild (Mono),MSBuild (System)"
-#else
- "MSBuild (Mono),xbuild (Deprecated)"
+ "," PROP_NAME_MSBUILD_VS
#endif
- ));
+ "," PROP_NAME_XBUILD));
}
GodotSharpBuilds::~GodotSharpBuilds() {
@@ -405,12 +461,12 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
exit_code = -1;
- String logs_dir = GodotSharpDirs::get_build_logs_dir().plus_file(build_info.solution.md5_text() + "_" + build_info.configuration);
+ String log_dirpath = build_info.get_log_dirpath();
if (build_tab) {
build_tab->on_build_start();
} else {
- build_tab = memnew(MonoBuildTab(build_info, logs_dir));
+ build_tab = memnew(MonoBuildTab(build_info, log_dirpath));
MonoBottomPanel::get_singleton()->add_build_tab(build_tab);
}
@@ -432,12 +488,12 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
// Remove old issues file
String issues_file = "msbuild_issues.csv";
- DirAccessRef d = DirAccess::create_for_path(logs_dir);
+ DirAccessRef d = DirAccess::create_for_path(log_dirpath);
if (d->file_exists(issues_file)) {
Error err = d->remove(issues_file);
if (err != OK) {
exited = true;
- String file_path = ProjectSettings::get_singleton()->localize_path(logs_dir).plus_file(issues_file);
+ String file_path = ProjectSettings::get_singleton()->localize_path(log_dirpath).plus_file(issues_file);
String message = "Cannot remove issues file: " + file_path;
build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
@@ -462,6 +518,7 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) {
exited = true;
+ GDMonoUtils::print_unhandled_exception(ex);
String message = "The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex);
build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
@@ -470,8 +527,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
// Call Build
- Variant logger_assembly = OS::get_singleton()->get_executable_path().get_base_dir().plus_file(EDITOR_TOOLS_ASSEMBLY_NAME) + ".dll";
- Variant logger_output_dir = logs_dir;
+ String logger_assembly_path = GDMono::get_singleton()->get_editor_tools_assembly()->get_path();
+ Variant logger_assembly = ProjectSettings::get_singleton()->globalize_path(logger_assembly_path);
+ Variant logger_output_dir = log_dirpath;
Variant custom_props = build_info.custom_props;
const Variant *args[3] = { &logger_assembly, &logger_output_dir, &custom_props };
@@ -482,6 +540,7 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
if (ex) {
exited = true;
+ GDMonoUtils::print_unhandled_exception(ex);
String message = "The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex);
build_tab->on_build_exec_failed(message);
ERR_EXPLAIN(message);
@@ -504,11 +563,10 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
}
}
-GodotSharpBuilds::BuildProcess::BuildProcess(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback) {
-
- build_info = p_build_info;
- build_tab = NULL;
- exit_callback = p_callback;
- exited = true;
- exit_code = -1;
+GodotSharpBuilds::BuildProcess::BuildProcess(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback) :
+ build_info(p_build_info),
+ build_tab(NULL),
+ exit_callback(p_callback),
+ exited(true),
+ exit_code(-1) {
}
diff --git a/modules/mono/editor/godotsharp_builds.h b/modules/mono/editor/godotsharp_builds.h
index 5d2390ecd9..4afc284d45 100644
--- a/modules/mono/editor/godotsharp_builds.h
+++ b/modules/mono/editor/godotsharp_builds.h
@@ -31,6 +31,7 @@
#ifndef GODOTSHARP_BUILDS_H
#define GODOTSHARP_BUILDS_H
+#include "../mono_gd/gd_mono.h"
#include "mono_bottom_panel.h"
#include "mono_build_info.h"
@@ -56,24 +57,20 @@ private:
HashMap<MonoBuildInfo, BuildProcess, MonoBuildInfo::Hasher> builds;
+ static String _api_folder_name(APIAssembly::Type p_api_type);
+
static GodotSharpBuilds *singleton;
friend class GDMono;
static void _register_internal_calls();
public:
- enum APIType {
- API_CORE,
- API_EDITOR
- };
-
enum BuildTool {
MSBUILD_MONO,
#ifdef WINDOWS_ENABLED
- MSBUILD
-#else
- XBUILD // Deprecated
+ MSBUILD_VS,
#endif
+ XBUILD // Deprecated
};
_FORCE_INLINE_ static GodotSharpBuilds *get_singleton() { return singleton; }
@@ -89,11 +86,13 @@ public:
bool build_async(const MonoBuildInfo &p_build_info, GodotSharpBuild_ExitCallback p_callback = NULL);
static bool build_api_sln(const String &p_name, const String &p_api_sln_dir, const String &p_config);
- static bool copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name);
+ static bool copy_api_assembly(const String &p_src_dir, const String &p_dst_dir, const String &p_assembly_name, APIAssembly::Type p_api_type);
+
+ static bool make_api_sln(APIAssembly::Type p_api_type);
- static bool make_api_sln(APIType p_api_type);
+ static bool build_project_blocking(const String &p_config);
- static bool build_project_blocking();
+ static bool editor_build_callback();
GodotSharpBuilds();
~GodotSharpBuilds();
diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp
index 975cf0f030..998da8bda3 100644
--- a/modules/mono/editor/godotsharp_editor.cpp
+++ b/modules/mono/editor/godotsharp_editor.cpp
@@ -41,6 +41,7 @@
#include "../utils/path_utils.h"
#include "bindings_generator.h"
#include "csharp_project.h"
+#include "godotsharp_export.h"
#include "net_solution.h"
#ifdef WINDOWS_ENABLED
@@ -84,10 +85,10 @@ bool GodotSharpEditor::_create_project_solution() {
return false;
}
- if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_CORE))
+ if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_CORE))
return false;
- if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_EDITOR))
+ if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_EDITOR))
return false;
pr.step(TTR("Done"));
@@ -316,6 +317,11 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
EditorSettings *ed_settings = EditorSettings::get_singleton();
EDITOR_DEF("mono/editor/external_editor", EDITOR_NONE);
ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, "None,MonoDevelop,Visual Studio Code"));
+
+ // Export plugin
+ Ref<GodotSharpExport> godotsharp_export;
+ godotsharp_export.instance();
+ EditorExport::get_singleton()->add_export_plugin(godotsharp_export);
}
GodotSharpEditor::~GodotSharpEditor() {
diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h
index 81c49aec30..66da814c8b 100644
--- a/modules/mono/editor/godotsharp_editor.h
+++ b/modules/mono/editor/godotsharp_editor.h
@@ -32,7 +32,6 @@
#define GODOTSHARP_EDITOR_H
#include "godotsharp_builds.h"
-
#include "monodevelop_instance.h"
class GodotSharpEditor : public Node {
diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp
new file mode 100644
index 0000000000..cd09e6516a
--- /dev/null
+++ b/modules/mono/editor/godotsharp_export.cpp
@@ -0,0 +1,166 @@
+/*************************************************************************/
+/* godotsharp_export.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "godotsharp_export.h"
+
+#include "../csharp_script.h"
+#include "../godotsharp_defs.h"
+#include "../godotsharp_dirs.h"
+#include "godotsharp_builds.h"
+
+void GodotSharpExport::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
+
+ if (p_type != CSharpLanguage::get_singleton()->get_type())
+ return;
+
+ ERR_FAIL_COND(p_path.get_extension() != CSharpLanguage::get_singleton()->get_extension());
+
+ // TODO what if the source file is not part of the game's C# project
+
+ if (!GLOBAL_GET("mono/export/include_scripts_content")) {
+ // We don't want to include the source code on exported games
+ add_file(p_path, Vector<uint8_t>(), false);
+ skip();
+ }
+}
+
+void GodotSharpExport::_export_begin(const Set<String> &p_features, bool p_debug, const String &p_path, int p_flags) {
+
+ // TODO right now there is no way to stop the export process with an error
+
+ ERR_FAIL_COND(!GDMono::get_singleton()->is_runtime_initialized());
+ ERR_FAIL_NULL(GDMono::get_singleton()->get_tools_domain());
+
+ String build_config = p_debug ? "Debug" : "Release";
+
+ ERR_FAIL_COND(!GodotSharpBuilds::build_project_blocking(build_config));
+
+ // Add API assemblies
+
+ String core_api_dll_path = GodotSharpDirs::get_res_assemblies_dir().plus_file(API_ASSEMBLY_NAME ".dll");
+ ERR_FAIL_COND(!_add_assembly(core_api_dll_path, core_api_dll_path));
+
+ String editor_api_dll_path = GodotSharpDirs::get_res_assemblies_dir().plus_file(EDITOR_API_ASSEMBLY_NAME ".dll");
+ ERR_FAIL_COND(!_add_assembly(editor_api_dll_path, editor_api_dll_path));
+
+ // Add project assembly
+
+ String project_dll_name = ProjectSettings::get_singleton()->get("application/config/name");
+ if (project_dll_name.empty()) {
+ project_dll_name = "UnnamedProject";
+ }
+
+ String project_dll_src_path = GodotSharpDirs::get_res_temp_assemblies_base_dir().plus_file(build_config).plus_file(project_dll_name + ".dll");
+ String project_dll_dst_path = GodotSharpDirs::get_res_assemblies_dir().plus_file(project_dll_name + ".dll");
+ ERR_FAIL_COND(!_add_assembly(project_dll_src_path, project_dll_dst_path));
+
+ // Add dependencies
+
+ MonoDomain *prev_domain = mono_domain_get();
+ MonoDomain *export_domain = GDMonoUtils::create_domain("GodotEngine.ProjectExportDomain");
+
+ ERR_FAIL_COND(!export_domain);
+ ERR_FAIL_COND(!mono_domain_set(export_domain, false));
+
+ Map<String, String> dependencies;
+ dependencies.insert("mscorlib", GDMono::get_singleton()->get_corlib_assembly()->get_path());
+
+ GDMonoAssembly *scripts_assembly = GDMonoAssembly::load_from(project_dll_name, project_dll_src_path, /* refonly: */ true);
+
+ ERR_EXPLAIN("Cannot load refonly assembly: " + project_dll_name);
+ ERR_FAIL_COND(!scripts_assembly);
+
+ Error depend_error = _get_assembly_dependencies(scripts_assembly, dependencies);
+
+ GDMono::get_singleton()->finalize_and_unload_domain(export_domain);
+ mono_domain_set(prev_domain, false);
+
+ ERR_FAIL_COND(depend_error != OK);
+
+ for (Map<String, String>::Element *E = dependencies.front(); E; E = E->next()) {
+ String depend_src_path = E->value();
+ String depend_dst_path = GodotSharpDirs::get_res_assemblies_dir().plus_file(depend_src_path.get_file());
+ ERR_FAIL_COND(!_add_assembly(depend_src_path, depend_dst_path));
+ }
+}
+
+bool GodotSharpExport::_add_assembly(const String &p_src_path, const String &p_dst_path) {
+
+ FileAccessRef f = FileAccess::open(p_src_path, FileAccess::READ);
+ ERR_FAIL_COND_V(!f, false);
+
+ Vector<uint8_t> data;
+ data.resize(f->get_len());
+ f->get_buffer(data.ptrw(), data.size());
+
+ add_file(p_dst_path, data, false);
+
+ return true;
+}
+
+Error GodotSharpExport::_get_assembly_dependencies(GDMonoAssembly *p_assembly, Map<String, String> &r_dependencies) {
+
+ MonoImage *image = p_assembly->get_image();
+
+ for (int i = 0; i < mono_image_get_table_rows(image, MONO_TABLE_ASSEMBLYREF); i++) {
+ MonoAssemblyName *ref_aname = aname_prealloc;
+ mono_assembly_get_assemblyref(image, i, ref_aname);
+ String ref_name = mono_assembly_name_get_name(ref_aname);
+
+ if (ref_name == "mscorlib" || r_dependencies.find(ref_name))
+ continue;
+
+ GDMonoAssembly *ref_assembly = NULL;
+ if (!GDMono::get_singleton()->load_assembly(ref_name, ref_aname, &ref_assembly, /* refonly: */ true)) {
+ ERR_EXPLAIN("Cannot load refonly assembly: " + ref_name);
+ ERR_FAIL_V(ERR_CANT_RESOLVE);
+ }
+
+ r_dependencies.insert(ref_name, ref_assembly->get_path());
+
+ Error err = _get_assembly_dependencies(ref_assembly, r_dependencies);
+ if (err != OK)
+ return err;
+ }
+
+ return OK;
+}
+
+GodotSharpExport::GodotSharpExport() {
+ // MonoAssemblyName is an incomplete type (internal to mono), so we can't allocate it ourselves.
+ // There isn't any api to allocate an empty one either, so we need to do it this way.
+ aname_prealloc = mono_assembly_name_new("whatever");
+ mono_assembly_name_free(aname_prealloc); // "it does not frees the object itself, only the name members" (typo included)
+}
+
+GodotSharpExport::~GodotSharpExport() {
+ if (aname_prealloc)
+ mono_free(aname_prealloc);
+}
diff --git a/modules/mono/editor/godotsharp_export.h b/modules/mono/editor/godotsharp_export.h
new file mode 100644
index 0000000000..b38db9660c
--- /dev/null
+++ b/modules/mono/editor/godotsharp_export.h
@@ -0,0 +1,57 @@
+/*************************************************************************/
+/* godotsharp_export.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GODOTSHARP_EXPORT_H
+#define GODOTSHARP_EXPORT_H
+
+#include <mono/metadata/image.h>
+
+#include "editor/editor_export.h"
+
+#include "../mono_gd/gd_mono_header.h"
+
+class GodotSharpExport : public EditorExportPlugin {
+
+ MonoAssemblyName *aname_prealloc;
+
+ bool _add_assembly(const String &p_src_path, const String &p_dst_path);
+
+ Error _get_assembly_dependencies(GDMonoAssembly *p_assembly, Map<String, String> &r_dependencies);
+
+protected:
+ virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features);
+ virtual void _export_begin(const Set<String> &p_features, bool p_debug, const String &p_path, int p_flags);
+
+public:
+ GodotSharpExport();
+ ~GodotSharpExport();
+};
+
+#endif // GODOTSHARP_EXPORT_H
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index 20378a0162..9317550d28 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -73,7 +73,7 @@ void MonoBottomPanel::_update_build_tabs_list() {
if (no_current_tab || current_tab == i) {
build_tabs_list->select(i);
- _build_tab_item_selected(i);
+ _build_tabs_item_selected(i);
}
}
}
@@ -105,21 +105,27 @@ void MonoBottomPanel::show_build_tab() {
ERR_PRINT("Builds tab not found");
}
-void MonoBottomPanel::_build_tab_item_selected(int p_idx) {
+void MonoBottomPanel::_build_tabs_item_selected(int p_idx) {
ERR_FAIL_INDEX(p_idx, build_tabs->get_tab_count());
+
build_tabs->set_current_tab(p_idx);
+ if (!build_tabs->is_visible())
+ build_tabs->set_visible(true);
+
+ warnings_btn->set_visible(true);
+ errors_btn->set_visible(true);
+ view_log_btn->set_visible(true);
}
-void MonoBottomPanel::_build_tab_changed(int p_idx) {
+void MonoBottomPanel::_build_tabs_nothing_selected() {
- if (p_idx < 0 || p_idx >= build_tabs->get_tab_count()) {
- warnings_btn->set_visible(false);
- errors_btn->set_visible(false);
- } else {
- warnings_btn->set_visible(true);
- errors_btn->set_visible(true);
- }
+ if (build_tabs->get_tab_count() != 0) // just in case
+ build_tabs->set_visible(false);
+
+ warnings_btn->set_visible(false);
+ errors_btn->set_visible(false);
+ view_log_btn->set_visible(false);
}
void MonoBottomPanel::_warnings_toggled(bool p_pressed) {
@@ -142,12 +148,28 @@ void MonoBottomPanel::_errors_toggled(bool p_pressed) {
void MonoBottomPanel::_build_project_pressed() {
- GodotSharpBuilds::get_singleton()->build_project_blocking();
+ GodotSharpBuilds::get_singleton()->build_project_blocking("Tools");
MonoReloadNode::get_singleton()->restart_reload_timer();
CSharpLanguage::get_singleton()->reload_assemblies_if_needed(true);
}
+void MonoBottomPanel::_view_log_pressed() {
+
+ if (build_tabs_list->is_anything_selected()) {
+ Vector<int> selected_items = build_tabs_list->get_selected_items();
+ CRASH_COND(selected_items.size() != 1);
+ int selected_item = selected_items[0];
+
+ MonoBuildTab *build_tab = Object::cast_to<MonoBuildTab>(build_tabs->get_tab_control(selected_item));
+ ERR_FAIL_NULL(build_tab);
+
+ String log_dirpath = build_tab->get_build_info().get_log_dirpath();
+
+ OS::get_singleton()->shell_open(log_dirpath.plus_file("msbuild_log.txt"));
+ }
+}
+
void MonoBottomPanel::_notification(int p_what) {
switch (p_what) {
@@ -163,10 +185,11 @@ void MonoBottomPanel::_notification(int p_what) {
void MonoBottomPanel::_bind_methods() {
ClassDB::bind_method(D_METHOD("_build_project_pressed"), &MonoBottomPanel::_build_project_pressed);
+ ClassDB::bind_method(D_METHOD("_view_log_pressed"), &MonoBottomPanel::_view_log_pressed);
ClassDB::bind_method(D_METHOD("_warnings_toggled", "pressed"), &MonoBottomPanel::_warnings_toggled);
ClassDB::bind_method(D_METHOD("_errors_toggled", "pressed"), &MonoBottomPanel::_errors_toggled);
- ClassDB::bind_method(D_METHOD("_build_tab_item_selected", "idx"), &MonoBottomPanel::_build_tab_item_selected);
- ClassDB::bind_method(D_METHOD("_build_tab_changed", "idx"), &MonoBottomPanel::_build_tab_changed);
+ ClassDB::bind_method(D_METHOD("_build_tabs_item_selected", "idx"), &MonoBottomPanel::_build_tabs_item_selected);
+ ClassDB::bind_method(D_METHOD("_build_tabs_nothing_selected"), &MonoBottomPanel::_build_tabs_nothing_selected);
}
MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) {
@@ -223,6 +246,15 @@ MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) {
errors_btn->connect("toggled", this, "_errors_toggled");
toolbar_hbc->add_child(errors_btn);
+ toolbar_hbc->add_spacer();
+
+ view_log_btn = memnew(Button);
+ view_log_btn->set_text(TTR("View log"));
+ view_log_btn->set_focus_mode(FOCUS_NONE);
+ view_log_btn->set_visible(false);
+ view_log_btn->connect("pressed", this, "_view_log_pressed");
+ toolbar_hbc->add_child(view_log_btn);
+
HSplitContainer *hsc = memnew(HSplitContainer);
hsc->set_h_size_flags(SIZE_EXPAND_FILL);
hsc->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -230,14 +262,14 @@ MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) {
build_tabs_list = memnew(ItemList);
build_tabs_list->set_h_size_flags(SIZE_EXPAND_FILL);
- build_tabs_list->connect("item_selected", this, "_build_tab_item_selected");
+ build_tabs_list->connect("item_selected", this, "_build_tabs_item_selected");
+ build_tabs_list->connect("nothing_selected", this, "_build_tabs_nothing_selected");
hsc->add_child(build_tabs_list);
build_tabs = memnew(TabContainer);
build_tabs->set_tab_align(TabContainer::ALIGN_LEFT);
build_tabs->set_h_size_flags(SIZE_EXPAND_FILL);
build_tabs->set_tabs_visible(false);
- build_tabs->connect("tab_changed", this, "_build_tab_changed");
hsc->add_child(build_tabs);
}
}
@@ -407,9 +439,14 @@ void MonoBuildTab::stop_build() {
void MonoBuildTab::_issue_activated(int p_idx) {
- ERR_FAIL_INDEX(p_idx, issues.size());
+ ERR_FAIL_INDEX(p_idx, issues_list->get_item_count());
+
+ // Get correct issue idx from issue list
+ int issue_idx = this->issues_list->get_item_metadata(p_idx);
- const BuildIssue &issue = issues[p_idx];
+ ERR_FAIL_INDEX(issue_idx, issues.size());
+
+ const BuildIssue &issue = issues[issue_idx];
if (issue.project_file.empty() && issue.file.empty())
return;
@@ -437,21 +474,16 @@ void MonoBuildTab::_bind_methods() {
ClassDB::bind_method("_issue_activated", &MonoBuildTab::_issue_activated);
}
-MonoBuildTab::MonoBuildTab(const MonoBuildInfo &p_build_info, const String &p_logs_dir) {
-
- build_info = p_build_info;
- logs_dir = p_logs_dir;
-
- build_exited = false;
-
- issues_list = memnew(ItemList);
+MonoBuildTab::MonoBuildTab(const MonoBuildInfo &p_build_info, const String &p_logs_dir) :
+ build_info(p_build_info),
+ logs_dir(p_logs_dir),
+ build_exited(false),
+ issues_list(memnew(ItemList)),
+ error_count(0),
+ warning_count(0),
+ errors_visible(true),
+ warnings_visible(true) {
issues_list->set_v_size_flags(SIZE_EXPAND_FILL);
issues_list->connect("item_activated", this, "_issue_activated");
add_child(issues_list);
-
- error_count = 0;
- warning_count = 0;
-
- errors_visible = true;
- warnings_visible = true;
}
diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h
index a44d3a9af8..03240e9a13 100644
--- a/modules/mono/editor/mono_bottom_panel.h
+++ b/modules/mono/editor/mono_bottom_panel.h
@@ -53,16 +53,18 @@ class MonoBottomPanel : public VBoxContainer {
Button *warnings_btn;
Button *errors_btn;
+ Button *view_log_btn;
void _update_build_tabs_list();
- void _build_tab_item_selected(int p_idx);
- void _build_tab_changed(int p_idx);
+ void _build_tabs_item_selected(int p_idx);
+ void _build_tabs_nothing_selected();
void _warnings_toggled(bool p_pressed);
void _errors_toggled(bool p_pressed);
void _build_project_pressed();
+ void _view_log_pressed();
static MonoBottomPanel *singleton;
diff --git a/modules/mono/editor/mono_build_info.cpp b/modules/mono/editor/mono_build_info.cpp
new file mode 100644
index 0000000000..e4af2aac4f
--- /dev/null
+++ b/modules/mono/editor/mono_build_info.cpp
@@ -0,0 +1,62 @@
+/*************************************************************************/
+/* mono_build_info.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "mono_build_info.h"
+
+#include "../godotsharp_dirs.h"
+#include "../mono_gd/gd_mono_utils.h"
+
+uint32_t MonoBuildInfo::Hasher::hash(const MonoBuildInfo &p_key) {
+
+ uint32_t hash = 0;
+
+ GDMonoUtils::hash_combine(hash, p_key.solution.hash());
+ GDMonoUtils::hash_combine(hash, p_key.configuration.hash());
+
+ return hash;
+}
+
+bool MonoBuildInfo::operator==(const MonoBuildInfo &p_b) const {
+
+ return p_b.solution == solution && p_b.configuration == configuration;
+}
+
+String MonoBuildInfo::get_log_dirpath() {
+
+ return GodotSharpDirs::get_build_logs_dir().plus_file(solution.md5_text() + "_" + configuration);
+}
+
+MonoBuildInfo::MonoBuildInfo() {}
+
+MonoBuildInfo::MonoBuildInfo(const String &p_solution, const String &p_config) {
+
+ solution = p_solution;
+ configuration = p_config;
+}
diff --git a/modules/mono/editor/mono_build_info.h b/modules/mono/editor/mono_build_info.h
index 4806764a61..64ba0f4037 100644
--- a/modules/mono/editor/mono_build_info.h
+++ b/modules/mono/editor/mono_build_info.h
@@ -31,35 +31,25 @@
#ifndef MONO_BUILD_INFO_H
#define MONO_BUILD_INFO_H
-#include "../mono_gd/gd_mono_utils.h"
+#include "core/ustring.h"
+#include "core/vector.h"
struct MonoBuildInfo {
struct Hasher {
- static _FORCE_INLINE_ uint32_t hash(const MonoBuildInfo &p_key) {
- uint32_t hash = 0;
-
- GDMonoUtils::hash_combine(hash, p_key.solution.hash());
- GDMonoUtils::hash_combine(hash, p_key.configuration.hash());
-
- return hash;
- }
+ static uint32_t hash(const MonoBuildInfo &p_key);
};
String solution;
String configuration;
Vector<String> custom_props;
- MonoBuildInfo() {}
+ bool operator==(const MonoBuildInfo &p_b) const;
- MonoBuildInfo(const String &p_solution, const String &p_config) {
- solution = p_solution;
- configuration = p_config;
- }
+ String get_log_dirpath();
- bool operator==(const MonoBuildInfo &p_b) const {
- return p_b.solution == solution && p_b.configuration == configuration;
- }
+ MonoBuildInfo();
+ MonoBuildInfo(const String &p_solution, const String &p_config);
};
#endif // MONO_BUILD_INFO_H
diff --git a/modules/mono/glue/builtin_types_glue.h b/modules/mono/glue/builtin_types_glue.h
index 460de84b65..ef9f152682 100644
--- a/modules/mono/glue/builtin_types_glue.h
+++ b/modules/mono/glue/builtin_types_glue.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* builtin_types_glue.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef BUILTIN_TYPES_GLUE_H
#define BUILTIN_TYPES_GLUE_H
diff --git a/modules/mono/glue/cs_files/AABB.cs b/modules/mono/glue/cs_files/AABB.cs
index e6e12f7ba3..39f2d2ed51 100644
--- a/modules/mono/glue/cs_files/AABB.cs
+++ b/modules/mono/glue/cs_files/AABB.cs
@@ -1,11 +1,15 @@
-using System;
-
// file: core/math/aabb.h
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
// file: core/math/aabb.cpp
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
// file: core/variant_call.cpp
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
+using System;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -45,12 +49,12 @@ namespace Godot
Vector3 dst_min = with.position;
Vector3 dst_max = with.position + with.size;
- return ((src_min.x <= dst_min.x) &&
- (src_max.x > dst_max.x) &&
- (src_min.y <= dst_min.y) &&
- (src_max.y > dst_max.y) &&
- (src_min.z <= dst_min.z) &&
- (src_max.z > dst_max.z));
+ return src_min.x <= dst_min.x &&
+ src_max.x > dst_max.x &&
+ src_min.y <= dst_min.y &&
+ src_max.y > dst_max.y &&
+ src_min.z <= dst_min.z &&
+ src_max.z > dst_max.z;
}
public AABB Expand(Vector3 to_point)
@@ -75,7 +79,7 @@ namespace Godot
return new AABB(begin, end - begin);
}
- public float GetArea()
+ public real_t GetArea()
{
return size.x * size.y * size.z;
}
@@ -107,8 +111,8 @@ namespace Godot
public Vector3 GetLongestAxis()
{
- Vector3 axis = new Vector3(1f, 0f, 0f);
- float max_size = size.x;
+ var axis = new Vector3(1f, 0f, 0f);
+ real_t max_size = size.x;
if (size.y > max_size)
{
@@ -119,7 +123,6 @@ namespace Godot
if (size.z > max_size)
{
axis = new Vector3(0f, 0f, 1f);
- max_size = size.z;
}
return axis;
@@ -127,8 +130,8 @@ namespace Godot
public Vector3.Axis GetLongestAxisIndex()
{
- Vector3.Axis axis = Vector3.Axis.X;
- float max_size = size.x;
+ var axis = Vector3.Axis.X;
+ real_t max_size = size.x;
if (size.y > max_size)
{
@@ -139,15 +142,14 @@ namespace Godot
if (size.z > max_size)
{
axis = Vector3.Axis.Z;
- max_size = size.z;
}
return axis;
}
- public float GetLongestAxisSize()
+ public real_t GetLongestAxisSize()
{
- float max_size = size.x;
+ real_t max_size = size.x;
if (size.y > max_size)
max_size = size.y;
@@ -160,8 +162,8 @@ namespace Godot
public Vector3 GetShortestAxis()
{
- Vector3 axis = new Vector3(1f, 0f, 0f);
- float max_size = size.x;
+ var axis = new Vector3(1f, 0f, 0f);
+ real_t max_size = size.x;
if (size.y < max_size)
{
@@ -172,7 +174,6 @@ namespace Godot
if (size.z < max_size)
{
axis = new Vector3(0f, 0f, 1f);
- max_size = size.z;
}
return axis;
@@ -180,8 +181,8 @@ namespace Godot
public Vector3.Axis GetShortestAxisIndex()
{
- Vector3.Axis axis = Vector3.Axis.X;
- float max_size = size.x;
+ var axis = Vector3.Axis.X;
+ real_t max_size = size.x;
if (size.y < max_size)
{
@@ -192,15 +193,14 @@ namespace Godot
if (size.z < max_size)
{
axis = Vector3.Axis.Z;
- max_size = size.z;
}
return axis;
}
- public float GetShortestAxisSize()
+ public real_t GetShortestAxisSize()
{
- float max_size = size.x;
+ real_t max_size = size.x;
if (size.y < max_size)
max_size = size.y;
@@ -217,14 +217,14 @@ namespace Godot
Vector3 ofs = position + half_extents;
return ofs + new Vector3(
- (dir.x > 0f) ? -half_extents.x : half_extents.x,
- (dir.y > 0f) ? -half_extents.y : half_extents.y,
- (dir.z > 0f) ? -half_extents.z : half_extents.z);
+ dir.x > 0f ? -half_extents.x : half_extents.x,
+ dir.y > 0f ? -half_extents.y : half_extents.y,
+ dir.z > 0f ? -half_extents.z : half_extents.z);
}
- public AABB Grow(float by)
+ public AABB Grow(real_t by)
{
- AABB res = this;
+ var res = this;
res.position.x -= by;
res.position.y -= by;
@@ -277,48 +277,42 @@ namespace Godot
{
return new AABB();
}
- else
- {
- min.x = (src_min.x > dst_min.x) ? src_min.x : dst_min.x;
- max.x = (src_max.x < dst_max.x) ? src_max.x : dst_max.x;
- }
+
+ min.x = src_min.x > dst_min.x ? src_min.x : dst_min.x;
+ max.x = src_max.x < dst_max.x ? src_max.x : dst_max.x;
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
{
return new AABB();
}
- else
- {
- min.y = (src_min.y > dst_min.y) ? src_min.y : dst_min.y;
- max.y = (src_max.y < dst_max.y) ? src_max.y : dst_max.y;
- }
+
+ min.y = src_min.y > dst_min.y ? src_min.y : dst_min.y;
+ max.y = src_max.y < dst_max.y ? src_max.y : dst_max.y;
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
{
return new AABB();
}
- else
- {
- min.z = (src_min.z > dst_min.z) ? src_min.z : dst_min.z;
- max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
- }
+
+ min.z = src_min.z > dst_min.z ? src_min.z : dst_min.z;
+ max.z = src_max.z < dst_max.z ? src_max.z : dst_max.z;
return new AABB(min, max - min);
}
public 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;
@@ -335,7 +329,7 @@ namespace Godot
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 + size.x, position.y + size.y, position.z + size.z)
};
bool over = false;
@@ -354,23 +348,23 @@ namespace Godot
public bool IntersectsSegment(Vector3 from, Vector3 to)
{
- float min = 0f;
- float max = 1f;
+ real_t min = 0f;
+ real_t max = 1f;
for (int i = 0; i < 3; i++)
{
- float seg_from = from[i];
- float seg_to = to[i];
- float box_begin = position[i];
- float box_end = box_begin + size[i];
- float cmin, cmax;
+ real_t seg_from = from[i];
+ real_t seg_to = to[i];
+ real_t box_begin = position[i];
+ real_t box_end = box_begin + size[i];
+ real_t cmin, cmax;
if (seg_from < seg_to)
{
if (seg_from > box_end || seg_to < box_begin)
return false;
- float length = seg_to - seg_from;
+ real_t length = seg_to - seg_from;
cmin = seg_from < box_begin ? (box_begin - seg_from) / length : 0f;
cmax = seg_to > box_end ? (box_end - seg_from) / length : 1f;
}
@@ -379,7 +373,7 @@ namespace Godot
if (seg_to > box_end || seg_from < box_begin)
return false;
- float length = seg_to - seg_from;
+ real_t length = seg_to - seg_from;
cmin = seg_from > box_end ? (box_end - seg_from) / length : 0f;
cmax = seg_to < box_begin ? (box_begin - seg_from) / length : 1f;
}
@@ -402,24 +396,25 @@ namespace Godot
{
Vector3 beg_1 = position;
Vector3 beg_2 = with.position;
- Vector3 end_1 = new Vector3(size.x, size.y, size.z) + beg_1;
- Vector3 end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2;
+ var end_1 = new Vector3(size.x, size.y, size.z) + beg_1;
+ var end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2;
- Vector3 min = new Vector3(
- (beg_1.x < beg_2.x) ? beg_1.x : beg_2.x,
- (beg_1.y < beg_2.y) ? beg_1.y : beg_2.y,
- (beg_1.z < beg_2.z) ? beg_1.z : beg_2.z
+ var min = new Vector3(
+ beg_1.x < beg_2.x ? beg_1.x : beg_2.x,
+ beg_1.y < beg_2.y ? beg_1.y : beg_2.y,
+ beg_1.z < beg_2.z ? beg_1.z : beg_2.z
);
- Vector3 max = new Vector3(
- (end_1.x > end_2.x) ? end_1.x : end_2.x,
- (end_1.y > end_2.y) ? end_1.y : end_2.y,
- (end_1.z > end_2.z) ? end_1.z : end_2.z
+ var max = new Vector3(
+ end_1.x > end_2.x ? end_1.x : end_2.x,
+ end_1.y > end_2.y ? end_1.y : end_2.y,
+ end_1.z > end_2.z ? end_1.z : end_2.z
);
return new AABB(min, max - min);
}
-
+
+ // Constructors
public AABB(Vector3 position, Vector3 size)
{
this.position = position;
@@ -460,8 +455,8 @@ namespace Godot
{
return String.Format("{0} - {1}", new object[]
{
- this.position.ToString(),
- this.size.ToString()
+ position.ToString(),
+ size.ToString()
});
}
@@ -469,8 +464,8 @@ namespace Godot
{
return String.Format("{0} - {1}", new object[]
{
- this.position.ToString(format),
- this.size.ToString(format)
+ position.ToString(format),
+ size.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs
index c6cdc069ef..aa49a5e04f 100644
--- a/modules/mono/glue/cs_files/Basis.cs
+++ b/modules/mono/glue/cs_files/Basis.cs
@@ -1,5 +1,10 @@
using System;
using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -13,8 +18,7 @@ namespace Godot
new Vector3(0f, 0f, 1f)
);
- private static readonly Basis[] orthoBases = new Basis[24]
- {
+ private static readonly Basis[] orthoBases = {
new Basis(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f),
new Basis(0f, -1f, 0f, 1f, 0f, 0f, 0f, 0f, 1f),
new Basis(-1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, 1f),
@@ -41,9 +45,27 @@ namespace Godot
new Basis(0f, -1f, 0f, 0f, 0f, -1f, 1f, 0f, 0f)
};
- public Vector3 x;
- public Vector3 y;
- public Vector3 z;
+ public Vector3 x
+ {
+ get { return GetAxis(0); }
+ set { SetAxis(0, value); }
+ }
+
+ public Vector3 y
+ {
+ get { return GetAxis(1); }
+ set { SetAxis(1, value); }
+ }
+
+ public Vector3 z
+ {
+ get { return GetAxis(2); }
+ set { SetAxis(2, value); }
+ }
+
+ private Vector3 _x;
+ private Vector3 _y;
+ private Vector3 _z;
public static Basis Identity
{
@@ -70,11 +92,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 IndexOutOfRangeException();
}
@@ -84,13 +106,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 IndexOutOfRangeException();
@@ -98,18 +120,18 @@ namespace Godot
}
}
- public float this[int index, int axis]
+ public real_t this[int index, int axis]
{
get
{
switch (index)
{
case 0:
- return x[axis];
+ return _x[axis];
case 1:
- return y[axis];
+ return _y[axis];
case 2:
- return z[axis];
+ return _z[axis];
default:
throw new IndexOutOfRangeException();
}
@@ -119,13 +141,13 @@ namespace Godot
switch (index)
{
case 0:
- x[axis] = value;
+ _x[axis] = value;
return;
case 1:
- y[axis] = value;
+ _y[axis] = value;
return;
case 2:
- z[axis] = value;
+ _z[axis] = value;
return;
default:
throw new IndexOutOfRangeException();
@@ -143,7 +165,7 @@ namespace Godot
);
}
- public float Determinant()
+ public real_t Determinant()
{
return this[0, 0] * (this[1, 1] * this[2, 2] - this[2, 1] * this[1, 2]) -
this[1, 0] * (this[0, 1] * this[2, 2] - this[2, 1] * this[0, 2]) +
@@ -155,14 +177,21 @@ namespace Godot
return new Vector3(this[0, axis], this[1, axis], this[2, axis]);
}
+ public void SetAxis(int axis, Vector3 value)
+ {
+ this[0, axis] = value.x;
+ this[1, axis] = value.y;
+ this[2, axis] = value.z;
+ }
+
public Vector3 GetEuler()
{
- Basis m = this.Orthonormalized();
+ Basis m = Orthonormalized();
Vector3 euler;
euler.z = 0.0f;
- float mxy = m.y[2];
+ real_t mxy = m[1, 2];
if (mxy < 1.0f)
@@ -170,19 +199,19 @@ namespace Godot
if (mxy > -1.0f)
{
euler.x = Mathf.Asin(-mxy);
- euler.y = Mathf.Atan2(m.x[2], m.z[2]);
- euler.z = Mathf.Atan2(m.y[0], m.y[1]);
+ euler.y = Mathf.Atan2(m[0, 2], m[2, 2]);
+ euler.z = Mathf.Atan2(m[1, 0], m[1, 1]);
}
else
{
- euler.x = Mathf.PI * 0.5f;
- euler.y = -Mathf.Atan2(-m.x[1], m.x[0]);
+ euler.x = Mathf.Pi * 0.5f;
+ euler.y = -Mathf.Atan2(-m[0, 1], m[0, 0]);
}
}
else
{
- euler.x = -Mathf.PI * 0.5f;
- euler.y = -Mathf.Atan2(m.x[1], m.x[0]);
+ euler.x = -Mathf.Pi * 0.5f;
+ euler.y = -Mathf.Atan2(-m[0, 1], m[0, 0]);
}
return euler;
@@ -190,13 +219,13 @@ namespace Godot
public int GetOrthogonalIndex()
{
- Basis orth = this;
+ var orth = this;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
- float v = orth[i, j];
+ real_t v = orth[i, j];
if (v > 0.5f)
v = 1.0f;
@@ -220,28 +249,27 @@ namespace Godot
public Basis Inverse()
{
- Basis inv = this;
+ var inv = this;
- float[] co = new float[3]
- {
+ real_t[] co = {
inv[1, 1] * inv[2, 2] - inv[1, 2] * inv[2, 1],
inv[1, 2] * inv[2, 0] - inv[1, 0] * inv[2, 2],
inv[1, 0] * inv[2, 1] - inv[1, 1] * inv[2, 0]
};
- float det = inv[0, 0] * co[0] + inv[0, 1] * co[1] + inv[0, 2] * co[2];
+ real_t det = inv[0, 0] * co[0] + inv[0, 1] * co[1] + inv[0, 2] * co[2];
if (det == 0)
{
return new Basis
(
- float.NaN, float.NaN, float.NaN,
- float.NaN, float.NaN, float.NaN,
- float.NaN, float.NaN, float.NaN
+ real_t.NaN, real_t.NaN, real_t.NaN,
+ real_t.NaN, real_t.NaN, real_t.NaN,
+ real_t.NaN, real_t.NaN, real_t.NaN
);
}
- float s = 1.0f / det;
+ real_t s = 1.0f / det;
inv = new Basis
(
@@ -266,22 +294,22 @@ namespace Godot
Vector3 zAxis = GetAxis(2);
xAxis.Normalize();
- yAxis = (yAxis - xAxis * (xAxis.Dot(yAxis)));
+ yAxis = yAxis - xAxis * xAxis.Dot(yAxis);
yAxis.Normalize();
- zAxis = (zAxis - xAxis * (xAxis.Dot(zAxis)) - yAxis * (yAxis.Dot(zAxis)));
+ zAxis = zAxis - xAxis * xAxis.Dot(zAxis) - yAxis * yAxis.Dot(zAxis);
zAxis.Normalize();
- return Basis.CreateFromAxes(xAxis, yAxis, zAxis);
+ return CreateFromAxes(xAxis, yAxis, zAxis);
}
- public Basis Rotated(Vector3 axis, float phi)
+ public Basis Rotated(Vector3 axis, real_t phi)
{
return new Basis(axis, phi) * this;
}
public Basis Scaled(Vector3 scale)
{
- Basis m = this;
+ var m = this;
m[0, 0] *= scale.x;
m[0, 1] *= scale.x;
@@ -296,26 +324,26 @@ namespace Godot
return m;
}
- public float Tdotx(Vector3 with)
+ public real_t Tdotx(Vector3 with)
{
return this[0, 0] * with[0] + this[1, 0] * with[1] + this[2, 0] * with[2];
}
- public float Tdoty(Vector3 with)
+ public real_t Tdoty(Vector3 with)
{
return this[0, 1] * with[0] + this[1, 1] * with[1] + this[2, 1] * with[2];
}
- public float Tdotz(Vector3 with)
+ public real_t Tdotz(Vector3 with)
{
return this[0, 2] * with[0] + this[1, 2] * with[1] + this[2, 2] * with[2];
}
public Basis Transposed()
{
- Basis tr = this;
+ var tr = this;
- float temp = this[0, 1];
+ real_t temp = this[0, 1];
this[0, 1] = this[1, 0];
this[1, 0] = temp;
@@ -344,98 +372,122 @@ namespace Godot
{
return new Vector3
(
- (this[0, 0] * v.x) + (this[1, 0] * v.y) + (this[2, 0] * v.z),
- (this[0, 1] * v.x) + (this[1, 1] * v.y) + (this[2, 1] * v.z),
- (this[0, 2] * v.x) + (this[1, 2] * v.y) + (this[2, 2] * v.z)
+ this[0, 0] * v.x + this[1, 0] * v.y + this[2, 0] * v.z,
+ this[0, 1] * v.x + this[1, 1] * v.y + this[2, 1] * v.z,
+ this[0, 2] * v.x + this[1, 2] * v.y + this[2, 2] * v.z
);
}
public Quat Quat() {
- float trace = x[0] + y[1] + z[2];
+ real_t trace = _x[0] + _y[1] + _z[2];
if (trace > 0.0f) {
- float s = Mathf.Sqrt(trace + 1.0f) * 2f;
- float inv_s = 1f / s;
+ real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
return new Quat(
- (z[1] - y[2]) * inv_s,
- (x[2] - z[0]) * inv_s,
- (y[0] - x[1]) * inv_s,
+ (_z[1] - _y[2]) * inv_s,
+ (_x[2] - _z[0]) * inv_s,
+ (_y[0] - _x[1]) * inv_s,
s * 0.25f
);
- } else if (x[0] > y[1] && x[0] > z[2]) {
- float s = Mathf.Sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f;
- float inv_s = 1f / s;
- return new Quat(
- s * 0.25f,
- (x[1] + y[0]) * inv_s,
- (x[2] + z[0]) * inv_s,
- (z[1] - y[2]) * inv_s
- );
- } else if (y[1] > z[2]) {
- float s = Mathf.Sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f;
- float inv_s = 1f / s;
- return new Quat(
- (x[1] + y[0]) * inv_s,
- s * 0.25f,
- (y[2] + z[1]) * inv_s,
- (x[2] - z[0]) * inv_s
- );
- } else {
- float s = Mathf.Sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f;
- float inv_s = 1f / s;
- return new Quat(
- (x[2] + z[0]) * inv_s,
- (y[2] + z[1]) * inv_s,
- s * 0.25f,
- (y[0] - x[1]) * inv_s
- );
}
+
+ if (_x[0] > _y[1] && _x[0] > _z[2]) {
+ real_t s = Mathf.Sqrt(_x[0] - _y[1] - _z[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ s * 0.25f,
+ (_x[1] + _y[0]) * inv_s,
+ (_x[2] + _z[0]) * inv_s,
+ (_z[1] - _y[2]) * inv_s
+ );
+ }
+
+ if (_y[1] > _z[2]) {
+ real_t s = Mathf.Sqrt(-_x[0] + _y[1] - _z[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ (_x[1] + _y[0]) * inv_s,
+ s * 0.25f,
+ (_y[2] + _z[1]) * inv_s,
+ (_x[2] - _z[0]) * inv_s
+ );
+ } else {
+ real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quat(
+ (_x[2] + _z[0]) * inv_s,
+ (_y[2] + _z[1]) * inv_s,
+ s * 0.25f,
+ (_y[0] - _x[1]) * inv_s
+ );
+ }
}
public Basis(Quat quat)
{
- float s = 2.0f / quat.LengthSquared();
+ real_t s = 2.0f / quat.LengthSquared();
+
+ real_t xs = quat.x * s;
+ real_t ys = quat.y * s;
+ real_t zs = quat.z * s;
+ real_t wx = quat.w * xs;
+ real_t wy = quat.w * ys;
+ real_t wz = quat.w * zs;
+ real_t xx = quat.x * xs;
+ real_t xy = quat.x * ys;
+ real_t xz = quat.x * zs;
+ real_t yy = quat.y * ys;
+ real_t yz = quat.y * zs;
+ real_t zz = quat.z * zs;
+
+ _x = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
+ _y = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
+ _z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
+ }
+
+ public Basis(Vector3 euler)
+ {
+ real_t c;
+ real_t s;
+
+ c = Mathf.Cos(euler.x);
+ s = Mathf.Sin(euler.x);
+ var xmat = new Basis(1, 0, 0, 0, c, -s, 0, s, c);
+
+ c = Mathf.Cos(euler.y);
+ s = Mathf.Sin(euler.y);
+ var ymat = new Basis(c, 0, s, 0, 1, 0, -s, 0, c);
- float xs = quat.x * s;
- float ys = quat.y * s;
- float zs = quat.z * s;
- float wx = quat.w * xs;
- float wy = quat.w * ys;
- float wz = quat.w * zs;
- float xx = quat.x * xs;
- float xy = quat.x * ys;
- float xz = quat.x * zs;
- float yy = quat.y * ys;
- float yz = quat.y * zs;
- float zz = quat.z * zs;
+ c = Mathf.Cos(euler.z);
+ s = Mathf.Sin(euler.z);
+ var zmat = new Basis(c, -s, 0, s, c, 0, 0, 0, 1);
- this.x = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
- this.y = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
- this.z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
+ this = ymat * xmat * zmat;
}
- public Basis(Vector3 axis, float phi)
+ public Basis(Vector3 axis, real_t phi)
{
- Vector3 axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
+ var axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
- float cosine = Mathf.Cos(phi);
- float sine = Mathf.Sin(phi);
+ real_t cosine = Mathf.Cos( phi);
+ real_t sine = Mathf.Sin( phi);
- this.x = new Vector3
+ _x = new Vector3
(
axis_sq.x + cosine * (1.0f - axis_sq.x),
axis.x * axis.y * (1.0f - cosine) - axis.z * sine,
axis.z * axis.x * (1.0f - cosine) + axis.y * sine
);
- this.y = new Vector3
+ _y = new Vector3
(
axis.x * axis.y * (1.0f - cosine) + axis.z * sine,
axis_sq.y + cosine * (1.0f - axis_sq.y),
axis.y * axis.z * (1.0f - cosine) - axis.x * sine
);
- this.z = new Vector3
+ _z = new Vector3
(
axis.z * axis.x * (1.0f - cosine) - axis.y * sine,
axis.y * axis.z * (1.0f - cosine) + axis.x * sine,
@@ -445,16 +497,16 @@ namespace Godot
public Basis(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
{
- this.x = xAxis;
- this.y = yAxis;
- this.z = zAxis;
+ _x = xAxis;
+ _y = yAxis;
+ _z = zAxis;
}
- public Basis(float xx, float xy, float xz, float yx, float yy, float yz, float zx, float zy, float zz)
+ public Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz)
{
- this.x = new Vector3(xx, yx, zx);
- this.y = new Vector3(xy, yy, zy);
- this.z = new Vector3(xz, yz, zz);
+ _x = new Vector3(xx, xy, xz);
+ _y = new Vector3(yx, yy, yz);
+ _z = new Vector3(zx, zy, zz);
}
public static Basis operator *(Basis left, Basis right)
@@ -489,21 +541,21 @@ namespace Godot
public bool Equals(Basis other)
{
- return x.Equals(other.x) && y.Equals(other.y) && z.Equals(other.z);
+ return _x.Equals(other[0]) && _y.Equals(other[1]) && _z.Equals(other[2]);
}
public override int GetHashCode()
{
- return x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode();
+ return _x.GetHashCode() ^ _y.GetHashCode() ^ _z.GetHashCode();
}
public override string ToString()
{
return String.Format("({0}, {1}, {2})", new object[]
{
- this.x.ToString(),
- this.y.ToString(),
- this.z.ToString()
+ _x.ToString(),
+ _y.ToString(),
+ _z.ToString()
});
}
@@ -511,9 +563,9 @@ namespace Godot
{
return String.Format("({0}, {1}, {2})", new object[]
{
- this.x.ToString(format),
- this.y.ToString(format),
- this.z.ToString(format)
+ _x.ToString(format),
+ _y.ToString(format),
+ _z.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs
index f9e31e9703..e0d6d27840 100644
--- a/modules/mono/glue/cs_files/Color.cs
+++ b/modules/mono/glue/cs_files/Color.cs
@@ -45,8 +45,8 @@ namespace Godot
{
get
{
- float max = Mathf.Max(r, Mathf.Max(g, b));
- float min = Mathf.Min(r, Mathf.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;
@@ -79,8 +79,8 @@ namespace Godot
{
get
{
- float max = Mathf.Max(r, Mathf.Max(g, b));
- float min = Mathf.Min(r, Mathf.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;
@@ -96,7 +96,7 @@ namespace Godot
{
get
{
- return Mathf.Max(r, Mathf.Max(g, b));
+ return Math.Max(r, Math.Max(g, b));
}
set
{
@@ -104,7 +104,7 @@ namespace Godot
}
}
- private static readonly Color black = new Color(0f, 0f, 0f, 1.0f);
+ private static readonly Color black = new Color(0f, 0f, 0f);
public Color Black
{
@@ -180,7 +180,7 @@ namespace Godot
hue += 1.0f;
}
- saturation = (max == 0) ? 0 : 1f - (1f * min / max);
+ saturation = max == 0 ? 0 : 1f - 1f * min / max;
value = max / 255f;
}
@@ -232,12 +232,10 @@ namespace Godot
{
return new Color(0, 0, 0, 0);
}
- else
- {
- 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;
}
@@ -251,6 +249,15 @@ namespace Godot
);
}
+ public Color Darkened(float amount)
+ {
+ Color res = this;
+ res.r = res.r * (1.0f - amount);
+ res.g = res.g * (1.0f - amount);
+ res.b = res.b * (1.0f - amount);
+ return res;
+ }
+
public float Gray()
{
return (r + g + b) / 3.0f;
@@ -265,27 +272,36 @@ namespace Godot
);
}
- public Color LinearInterpolate(Color b, float t)
+ public Color Lightened(float amount)
{
Color res = this;
+ res.r = res.r + (1.0f - res.r) * amount;
+ res.g = res.g + (1.0f - res.g) * amount;
+ res.b = res.b + (1.0f - res.b) * amount;
+ return res;
+ }
- res.r += (t * (b.r - this.r));
- res.g += (t * (b.g - this.g));
- res.b += (t * (b.b - this.b));
- res.a += (t * (b.a - this.a));
+ public Color LinearInterpolate(Color c, float t)
+ {
+ var res = this;
+
+ res.r += t * (c.r - r);
+ res.g += t * (c.g - g);
+ res.b += t * (c.b - b);
+ res.a += t * (c.a - a);
return res;
}
- public int To32()
+ public int ToRgba32()
{
- int c = (byte)(a * 255);
- c <<= 8;
- c |= (byte)(r * 255);
+ int c = (byte)(r * 255);
c <<= 8;
c |= (byte)(g * 255);
c <<= 8;
c |= (byte)(b * 255);
+ c <<= 8;
+ c |= (byte)(a * 255);
return c;
}
@@ -305,7 +321,7 @@ namespace Godot
public string ToHtml(bool include_alpha = true)
{
- String txt = string.Empty;
+ var txt = string.Empty;
txt += _to_hex(r);
txt += _to_hex(g);
@@ -316,7 +332,8 @@ namespace Godot
return txt;
}
-
+
+ // Constructors
public Color(float r, float g, float b, float a = 1.0f)
{
this.r = r;
@@ -327,13 +344,13 @@ namespace Godot
public Color(int rgba)
{
- this.a = (rgba & 0xFF) / 255.0f;
+ a = (rgba & 0xFF) / 255.0f;
rgba >>= 8;
- this.b = (rgba & 0xFF) / 255.0f;
+ b = (rgba & 0xFF) / 255.0f;
rgba >>= 8;
- this.g = (rgba & 0xFF) / 255.0f;
+ g = (rgba & 0xFF) / 255.0f;
rgba >>= 8;
- this.r = (rgba & 0xFF) / 255.0f;
+ r = (rgba & 0xFF) / 255.0f;
}
private static int _parse_col(string str, int ofs)
@@ -343,7 +360,7 @@ namespace Godot
for (int i = 0; i < 2; i++)
{
int c = str[i + ofs];
- int v = 0;
+ int v;
if (c >= '0' && c <= '9')
{
@@ -375,9 +392,9 @@ namespace Godot
private String _to_hex(float val)
{
- int v = (int)Mathf.Clamp(val * 255.0f, 0, 255);
+ var v = (int) Mathf.Clamp(val * 255.0f, 0, 255);
- string ret = string.Empty;
+ var ret = string.Empty;
for (int i = 0; i < 2; i++)
{
@@ -404,7 +421,7 @@ namespace Godot
if (color[0] == '#')
color = color.Substring(1, color.Length - 1);
- bool alpha = false;
+ bool alpha;
if (color.Length == 8)
alpha = true;
@@ -433,7 +450,7 @@ namespace Godot
public static Color Color8(byte r8, byte g8, byte b8, byte a8)
{
- return new Color((float)r8 / 255f, (float)g8 / 255f, (float)b8 / 255f, (float)a8 / 255f);
+ return new Color(r8 / 255f, g8 / 255f, b8 / 255f, a8 / 255f);
}
public Color(string rgba)
@@ -450,7 +467,7 @@ namespace Godot
if (rgba[0] == '#')
rgba = rgba.Substring(1);
- bool alpha = false;
+ bool alpha;
if (rgba.Length == 8)
{
@@ -512,14 +529,11 @@ namespace Godot
if (left.g == right.g)
{
if (left.b == right.b)
- return (left.a < right.a);
- else
- return (left.b < right.b);
- }
- else
- {
- return left.g < right.g;
+ return left.a < right.a;
+ return left.b < right.b;
}
+
+ return left.g < right.g;
}
return left.r < right.r;
@@ -532,14 +546,11 @@ namespace Godot
if (left.g == right.g)
{
if (left.b == right.b)
- return (left.a > right.a);
- else
- return (left.b > right.b);
- }
- else
- {
- return left.g > right.g;
+ return left.a > right.a;
+ return left.b > right.b;
}
+
+ return left.g > right.g;
}
return left.r > right.r;
@@ -567,24 +578,12 @@ namespace Godot
public override string ToString()
{
- return String.Format("{0},{1},{2},{3}", new object[]
- {
- this.r.ToString(),
- this.g.ToString(),
- this.b.ToString(),
- this.a.ToString()
- });
+ return String.Format("{0},{1},{2},{3}", r.ToString(), g.ToString(), b.ToString(), a.ToString());
}
public string ToString(string format)
{
- return String.Format("{0},{1},{2},{3}", new object[]
- {
- this.r.ToString(format),
- this.g.ToString(format),
- this.b.ToString(format),
- this.a.ToString(format)
- });
+ return String.Format("{0},{1},{2},{3}", r.ToString(format), g.ToString(format), b.ToString(format), a.ToString(format));
}
}
}
diff --git a/modules/mono/glue/cs_files/DebuggingUtils.cs b/modules/mono/glue/cs_files/DebuggingUtils.cs
index ffaaf00837..b27816084e 100644
--- a/modules/mono/glue/cs_files/DebuggingUtils.cs
+++ b/modules/mono/glue/cs_files/DebuggingUtils.cs
@@ -14,7 +14,7 @@ namespace Godot
else if (type == typeof(void))
sb.Append("void");
else
- sb.Append(type.ToString());
+ sb.Append(type);
sb.Append(" ");
}
@@ -32,7 +32,7 @@ namespace Godot
return;
}
- StringBuilder sb = new StringBuilder();
+ var sb = new StringBuilder();
if (methodBase is MethodInfo)
sb.AppendTypeName(((MethodInfo)methodBase).ReturnType);
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs
index b335ef55e4..ec1534cb9a 100644
--- a/modules/mono/glue/cs_files/GD.cs
+++ b/modules/mono/glue/cs_files/GD.cs
@@ -1,5 +1,7 @@
using System;
+// TODO: Add comments describing what this class does. It is not obvious.
+
namespace Godot
{
public static partial class GD
@@ -89,7 +91,7 @@ namespace Godot
public static int[] Range(int length)
{
- int[] ret = new int[length];
+ var ret = new int[length];
for (int i = 0; i < length; i++)
{
@@ -104,7 +106,7 @@ namespace Godot
if (to < from)
return new int[0];
- int[] ret = new int[to - from];
+ var ret = new int[to - from];
for (int i = from; i < to; i++)
{
@@ -122,14 +124,14 @@ namespace Godot
return new int[0];
// Calculate count
- int count = 0;
+ int count;
if (increment > 0)
- count = ((to - from - 1) / increment) + 1;
+ count = (to - from - 1) / increment + 1;
else
- count = ((from - to - 1) / -increment) + 1;
+ count = (from - to - 1) / -increment + 1;
- int[] ret = new int[count];
+ var ret = new int[count];
if (increment > 0)
{
diff --git a/modules/mono/glue/cs_files/GodotMethodAttribute.cs b/modules/mono/glue/cs_files/GodotMethodAttribute.cs
index 21333c8dab..55848769d5 100644
--- a/modules/mono/glue/cs_files/GodotMethodAttribute.cs
+++ b/modules/mono/glue/cs_files/GodotMethodAttribute.cs
@@ -2,7 +2,7 @@ using System;
namespace Godot
{
- [AttributeUsage(AttributeTargets.Method, Inherited = true)]
+ [AttributeUsage(AttributeTargets.Method)]
internal class GodotMethodAttribute : Attribute
{
private string methodName;
diff --git a/modules/mono/glue/cs_files/GodotSynchronizationContext.cs b/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
index eb4d0bed1c..da3c7bac83 100644
--- a/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
+++ b/modules/mono/glue/cs_files/GodotSynchronizationContext.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
diff --git a/modules/mono/glue/cs_files/GodotTaskScheduler.cs b/modules/mono/glue/cs_files/GodotTaskScheduler.cs
index f587645a49..3d23ec10f1 100644
--- a/modules/mono/glue/cs_files/GodotTaskScheduler.cs
+++ b/modules/mono/glue/cs_files/GodotTaskScheduler.cs
@@ -14,6 +14,7 @@ namespace Godot
public GodotTaskScheduler()
{
Context = new GodotSynchronizationContext();
+ SynchronizationContext.SetSynchronizationContext(Context);
}
protected sealed override void QueueTask(Task task)
@@ -36,7 +37,7 @@ namespace Godot
TryDequeue(task);
}
- return base.TryExecuteTask(task);
+ return TryExecuteTask(task);
}
protected sealed override bool TryDequeue(Task task)
@@ -57,7 +58,6 @@ namespace Godot
public void Activate()
{
- SynchronizationContext.SetSynchronizationContext(Context);
ExecuteQueuedTasks();
Context.ExecutePendingContinuations();
}
diff --git a/modules/mono/glue/cs_files/IAwaiter.cs b/modules/mono/glue/cs_files/IAwaiter.cs
index 73c71b5634..b5aa1a5389 100644
--- a/modules/mono/glue/cs_files/IAwaiter.cs
+++ b/modules/mono/glue/cs_files/IAwaiter.cs
@@ -1,4 +1,3 @@
-using System;
using System.Runtime.CompilerServices;
namespace Godot
diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs
index 2bdfb95c51..ff4477cc6c 100644
--- a/modules/mono/glue/cs_files/MarshalUtils.cs
+++ b/modules/mono/glue/cs_files/MarshalUtils.cs
@@ -7,7 +7,7 @@ namespace Godot
{
private static Dictionary<object, object> ArraysToDictionary(object[] keys, object[] values)
{
- Dictionary<object, object> ret = new Dictionary<object, object>();
+ var ret = new Dictionary<object, object>();
for (int i = 0; i < keys.Length; i++)
{
@@ -19,11 +19,11 @@ namespace Godot
private static void DictionaryToArrays(Dictionary<object, object> from, out object[] keysTo, out object[] valuesTo)
{
- Dictionary<object, object>.KeyCollection keys = from.Keys;
+ var keys = from.Keys;
keysTo = new object[keys.Count];
keys.CopyTo(keysTo, 0);
- Dictionary<object, object>.ValueCollection values = from.Values;
+ var values = from.Values;
valuesTo = new object[values.Count];
values.CopyTo(valuesTo, 0);
}
diff --git a/modules/mono/glue/cs_files/Mathf.cs b/modules/mono/glue/cs_files/Mathf.cs
index 476396e9a3..0d20a12563 100644
--- a/modules/mono/glue/cs_files/Mathf.cs
+++ b/modules/mono/glue/cs_files/Mathf.cs
@@ -1,75 +1,85 @@
using System;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
- public static class Mathf
+ public static partial class Mathf
{
- public const float PI = 3.14159274f;
- public const float Epsilon = 1e-06f;
+ // Define constants with Decimal precision and cast down to double or float.
- private const float Deg2RadConst = 0.0174532924f;
- private const float Rad2DegConst = 57.29578f;
+ public const real_t Tau = (real_t) 6.2831853071795864769252867666M; // 6.2831855f and 6.28318530717959
+ public const real_t Pi = (real_t) 3.1415926535897932384626433833M; // 3.1415927f and 3.14159265358979
+ public const real_t Inf = real_t.PositiveInfinity;
+ public const real_t NaN = real_t.NaN;
- public static float Abs(float s)
+ private const real_t Deg2RadConst = (real_t) 0.0174532925199432957692369077M; // 0.0174532924f and 0.0174532925199433
+ private const real_t Rad2DegConst = (real_t) 57.295779513082320876798154814M; // 57.29578f and 57.2957795130823
+
+ public static real_t Abs(real_t s)
{
return Math.Abs(s);
}
- public static float Acos(float s)
+ public static int Abs(int s)
{
- return (float)Math.Acos(s);
+ return Math.Abs(s);
}
- public static float Asin(float s)
+ public static real_t Acos(real_t s)
{
- return (float)Math.Asin(s);
+ return (real_t)Math.Acos(s);
}
- public static float Atan(float s)
+ public static real_t Asin(real_t s)
{
- return (float)Math.Atan(s);
+ return (real_t)Math.Asin(s);
}
- public static float Atan2(float x, float y)
+ public static real_t Atan(real_t s)
{
- return (float)Math.Atan2(x, y);
+ return (real_t)Math.Atan(s);
}
- public static Vector2 Cartesian2Polar(float x, float y)
- {
- return new Vector2(Sqrt(x * x + y * y), Atan2(y, x));
- }
+ public static real_t Atan2(real_t x, real_t y)
+ {
+ return (real_t)Math.Atan2(x, y);
+ }
- public static float Ceil(float s)
+ public static Vector2 Cartesian2Polar(real_t x, real_t y)
{
- return (float)Math.Ceiling(s);
+ return new Vector2(Sqrt(x * x + y * y), Atan2(y, x));
}
- public static float Clamp(float val, float min, float max)
+ public static real_t Ceil(real_t s)
{
- if (val < min)
- {
- return min;
- }
- else if (val > max)
- {
- return max;
- }
+ return (real_t)Math.Ceiling(s);
+ }
- return val;
+ public static int Clamp(int value, int min, int max)
+ {
+ return value < min ? min : value > max ? max : value;
}
- public static float Cos(float s)
+ public static real_t Clamp(real_t value, real_t min, real_t max)
{
- return (float)Math.Cos(s);
+ return value < min ? min : value > max ? max : value;
}
- public static float Cosh(float s)
+ public static real_t Cos(real_t s)
{
- return (float)Math.Cosh(s);
+ return (real_t)Math.Cos(s);
}
- public static int Decimals(float step)
+ public static real_t Cosh(real_t s)
+ {
+ return (real_t)Math.Cosh(s);
+ }
+
+ public static int Decimals(real_t step)
{
return Decimals((decimal)step);
}
@@ -79,12 +89,12 @@ namespace Godot
return BitConverter.GetBytes(decimal.GetBits(step)[3])[2];
}
- public static float Deg2Rad(float deg)
+ public static real_t Deg2Rad(real_t deg)
{
return deg * Deg2RadConst;
}
- public static float Ease(float s, float curve)
+ public static real_t Ease(real_t s, real_t curve)
{
if (s < 0f)
{
@@ -104,7 +114,8 @@ namespace Godot
return Pow(s, curve);
}
- else if (curve < 0f)
+
+ if (curve < 0f)
{
if (s < 0.5f)
{
@@ -117,111 +128,129 @@ namespace Godot
return 0f;
}
- public static float Exp(float s)
+ public static real_t Exp(real_t s)
{
- return (float)Math.Exp(s);
+ return (real_t)Math.Exp(s);
}
- public static float Floor(float s)
+ public static real_t Floor(real_t s)
{
- return (float)Math.Floor(s);
+ return (real_t)Math.Floor(s);
}
- public static float Fposmod(float x, float y)
+ public static real_t Fposmod(real_t x, real_t y)
{
if (x >= 0f)
{
return x % y;
}
- else
- {
- return y - (-x % y);
- }
+
+ return y - -x % y;
}
- public static float Lerp(float from, float to, float weight)
+ public static real_t InverseLerp(real_t from, real_t to, real_t weight)
+ {
+ return (Clamp(weight, 0f, 1f) - from) / (to - from);
+ }
+
+ public static bool IsInf(real_t s)
+ {
+ return real_t.IsInfinity(s);
+ }
+
+ public static bool IsNaN(real_t s)
+ {
+ return real_t.IsNaN(s);
+ }
+
+ public static real_t Lerp(real_t from, real_t to, real_t weight)
{
return from + (to - from) * Clamp(weight, 0f, 1f);
}
- public static float Log(float s)
+ public static real_t Log(real_t s)
{
- return (float)Math.Log(s);
+ return (real_t)Math.Log(s);
}
public static int Max(int a, int b)
{
- return (a > b) ? a : b;
+ return a > b ? a : b;
}
- public static float Max(float a, float b)
+ public static real_t Max(real_t a, real_t b)
{
- return (a > b) ? a : b;
+ return a > b ? a : b;
}
public static int Min(int a, int b)
{
- return (a < b) ? a : b;
+ return a < b ? a : b;
}
- public static float Min(float a, float b)
+ public static real_t Min(real_t a, real_t b)
{
- return (a < b) ? a : b;
+ return a < b ? a : b;
}
- public static int NearestPo2(int val)
+ public static int NearestPo2(int value)
{
- val--;
- val |= val >> 1;
- val |= val >> 2;
- val |= val >> 4;
- val |= val >> 8;
- val |= val >> 16;
- val++;
- return val;
+ value--;
+ value |= value >> 1;
+ value |= value >> 2;
+ value |= value >> 4;
+ value |= value >> 8;
+ value |= value >> 16;
+ value++;
+ return value;
}
- public static Vector2 Polar2Cartesian(float r, float th)
- {
- return new Vector2(r * Cos(th), r * Sin(th));
- }
+ public static Vector2 Polar2Cartesian(real_t r, real_t th)
+ {
+ return new Vector2(r * Cos(th), r * Sin(th));
+ }
- public static float Pow(float x, float y)
+ public static real_t Pow(real_t x, real_t y)
{
- return (float)Math.Pow(x, y);
+ return (real_t)Math.Pow(x, y);
}
- public static float Rad2Deg(float rad)
+ public static real_t Rad2Deg(real_t rad)
{
return rad * Rad2DegConst;
}
- public static float Round(float s)
+ public static real_t Round(real_t s)
{
- return (float)Math.Round(s);
+ return (real_t)Math.Round(s);
}
- public static float Sign(float s)
+ public static int Sign(int s)
{
- return (s < 0f) ? -1f : 1f;
+ return s < 0 ? -1 : 1;
}
- public static float Sin(float s)
+ public static real_t Sign(real_t s)
{
- return (float)Math.Sin(s);
+ return s < 0f ? -1f : 1f;
}
- public static float Sinh(float s)
+ public static real_t Sin(real_t s)
{
- return (float)Math.Sinh(s);
+ return (real_t)Math.Sin(s);
}
- public static float Sqrt(float s)
+ public static real_t Sinh(real_t s)
{
- return (float)Math.Sqrt(s);
+ return (real_t)Math.Sinh(s);
}
- public static float Stepify(float s, float step)
+ public static real_t Sqrt(real_t s)
+ {
+ return (real_t)Math.Sqrt(s);
+ }
+
+ public static real_t Stepify(real_t s, real_t step)
{
if (step != 0f)
{
@@ -231,14 +260,26 @@ namespace Godot
return s;
}
- public static float Tan(float s)
+ public static real_t Tan(real_t s)
+ {
+ return (real_t)Math.Tan(s);
+ }
+
+ public static real_t Tanh(real_t s)
+ {
+ return (real_t)Math.Tanh(s);
+ }
+
+ public static int Wrap(int value, int min, int max)
{
- return (float)Math.Tan(s);
+ int rng = max - min;
+ return min + ((value - min) % rng + rng) % rng;
}
- public static float Tanh(float s)
+ public static real_t Wrap(real_t value, real_t min, real_t max)
{
- return (float)Math.Tanh(s);
+ real_t rng = max - min;
+ return min + ((value - min) % rng + rng) % rng;
}
}
}
diff --git a/modules/mono/glue/cs_files/MathfEx.cs b/modules/mono/glue/cs_files/MathfEx.cs
new file mode 100644
index 0000000000..739b7fb568
--- /dev/null
+++ b/modules/mono/glue/cs_files/MathfEx.cs
@@ -0,0 +1,39 @@
+using System;
+
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
+
+namespace Godot
+{
+ public static partial class Mathf
+ {
+ // Define constants with Decimal precision and cast down to double or float.
+
+ public const real_t E = (real_t) 2.7182818284590452353602874714M; // 2.7182817f and 2.718281828459045
+ public const real_t Sqrt2 = (real_t) 1.4142135623730950488016887242M; // 1.4142136f and 1.414213562373095
+
+#if REAL_T_IS_DOUBLE
+ public const real_t Epsilon = 1e-14; // Epsilon size should depend on the precision used.
+#else
+ public const real_t Epsilon = 1e-06f;
+#endif
+
+ public static int CeilToInt(real_t s)
+ {
+ return (int)Math.Ceiling(s);
+ }
+
+ public static int FloorToInt(real_t s)
+ {
+ return (int)Math.Floor(s);
+ }
+
+ public static int RoundToInt(real_t s)
+ {
+ return (int)Math.Round(s);
+ }
+ }
+} \ No newline at end of file
diff --git a/modules/mono/glue/cs_files/Plane.cs b/modules/mono/glue/cs_files/Plane.cs
index b347c0835a..1020f06bf5 100644
--- a/modules/mono/glue/cs_files/Plane.cs
+++ b/modules/mono/glue/cs_files/Plane.cs
@@ -1,95 +1,106 @@
using System;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
public struct Plane : IEquatable<Plane>
{
- Vector3 normal;
+ private Vector3 _normal;
- public float x
+ public Vector3 Normal
+ {
+ get { return _normal; }
+ set { _normal = value; }
+ }
+
+ public real_t x
{
get
{
- return normal.x;
+ return _normal.x;
}
set
{
- normal.x = value;
+ _normal.x = value;
}
}
- public float y
+ public real_t y
{
get
{
- return normal.y;
+ return _normal.y;
}
set
{
- normal.y = value;
+ _normal.y = value;
}
}
- public float z
+ public real_t z
{
get
{
- return normal.z;
+ return _normal.z;
}
set
{
- normal.z = value;
+ _normal.z = value;
}
}
- float d;
+ public real_t D { get; set; }
public Vector3 Center
{
get
{
- return normal * d;
+ return _normal * D;
}
}
- public float DistanceTo(Vector3 point)
+ public real_t DistanceTo(Vector3 point)
{
- return normal.Dot(point) - d;
+ return _normal.Dot(point) - D;
}
public Vector3 GetAnyPoint()
{
- return normal * d;
+ return _normal * D;
}
- public bool HasPoint(Vector3 point, float epsilon = Mathf.Epsilon)
+ public bool HasPoint(Vector3 point, real_t epsilon = Mathf.Epsilon)
{
- float dist = normal.Dot(point) - d;
+ real_t dist = _normal.Dot(point) - D;
return Mathf.Abs(dist) <= epsilon;
}
public Vector3 Intersect3(Plane b, Plane c)
{
- float denom = normal.Cross(b.normal).Dot(c.normal);
+ real_t denom = _normal.Cross(b._normal).Dot(c._normal);
if (Mathf.Abs(denom) <= Mathf.Epsilon)
return new Vector3();
- Vector3 result = (b.normal.Cross(c.normal) * this.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;
}
public Vector3 IntersectRay(Vector3 from, Vector3 dir)
{
- float den = normal.Dot(dir);
+ real_t den = _normal.Dot(dir);
if (Mathf.Abs(den) <= Mathf.Epsilon)
return new Vector3();
- float 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)
@@ -101,14 +112,14 @@ namespace Godot
public Vector3 IntersectSegment(Vector3 begin, Vector3 end)
{
Vector3 segment = begin - end;
- float den = normal.Dot(segment);
+ real_t den = _normal.Dot(segment);
if (Mathf.Abs(den) <= Mathf.Epsilon)
return new Vector3();
- float dist = (normal.Dot(begin) - d) / den;
+ real_t dist = (_normal.Dot(begin) - D) / den;
- if (dist < -Mathf.Epsilon || dist > (1.0f + Mathf.Epsilon))
+ if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon)
return new Vector3();
return begin + segment * -dist;
@@ -116,46 +127,46 @@ namespace Godot
public bool IsPointOver(Vector3 point)
{
- return normal.Dot(point) > d;
+ return _normal.Dot(point) > D;
}
public Plane Normalized()
{
- float len = normal.Length();
+ real_t len = _normal.Length();
if (len == 0)
return new Plane(0, 0, 0, 0);
- return new Plane(normal / len, d / len);
+ return new Plane(_normal / len, D / len);
}
public Vector3 Project(Vector3 point)
{
- return point - normal * DistanceTo(point);
+ return point - _normal * DistanceTo(point);
}
-
- public Plane(float a, float b, float c, float d)
+
+ // Constructors
+ public Plane(real_t a, real_t b, real_t c, real_t d)
{
- normal = new Vector3(a, b, c);
- this.d = d;
+ _normal = new Vector3(a, b, c);
+ this.D = d;
}
-
- public Plane(Vector3 normal, float d)
+ public Plane(Vector3 normal, real_t d)
{
- this.normal = normal;
- this.d = d;
+ this._normal = normal;
+ this.D = d;
}
public Plane(Vector3 v1, Vector3 v2, Vector3 v3)
{
- normal = (v1 - v3).Cross(v1 - v2);
- normal.Normalize();
- d = normal.Dot(v1);
+ _normal = (v1 - v3).Cross(v1 - v2);
+ _normal.Normalize();
+ D = _normal.Dot(v1);
}
public static Plane operator -(Plane plane)
{
- return new Plane(-plane.normal, -plane.d);
+ return new Plane(-plane._normal, -plane.D);
}
public static bool operator ==(Plane left, Plane right)
@@ -180,20 +191,20 @@ namespace Godot
public bool Equals(Plane other)
{
- return normal == other.normal && d == other.d;
+ return _normal == other._normal && D == other.D;
}
public override int GetHashCode()
{
- return normal.GetHashCode() ^ d.GetHashCode();
+ return _normal.GetHashCode() ^ D.GetHashCode();
}
public override string ToString()
{
return String.Format("({0}, {1})", new object[]
{
- this.normal.ToString(),
- this.d.ToString()
+ _normal.ToString(),
+ D.ToString()
});
}
@@ -201,8 +212,8 @@ namespace Godot
{
return String.Format("({0}, {1})", new object[]
{
- this.normal.ToString(format),
- this.d.ToString(format)
+ _normal.ToString(format),
+ D.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs
index c0ac41c5d7..c69c55d997 100644
--- a/modules/mono/glue/cs_files/Quat.cs
+++ b/modules/mono/glue/cs_files/Quat.cs
@@ -1,5 +1,10 @@
using System;
using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -8,17 +13,17 @@ namespace Godot
{
private static readonly Quat identity = new Quat(0f, 0f, 0f, 1f);
- public float x;
- public float y;
- public float z;
- public float w;
+ public real_t x;
+ public real_t y;
+ public real_t z;
+ public real_t w;
public static Quat Identity
{
get { return identity; }
}
- public float this[int index]
+ public real_t this[int index]
{
get
{
@@ -58,15 +63,15 @@ namespace Godot
}
}
- public Quat CubicSlerp(Quat b, Quat preA, Quat postB, float t)
+ public Quat CubicSlerp(Quat b, Quat preA, Quat postB, real_t t)
{
- float t2 = (1.0f - t) * t * 2f;
+ real_t t2 = (1.0f - t) * t * 2f;
Quat sp = Slerp(b, t);
Quat sq = preA.Slerpni(postB, t);
return sp.Slerpni(sq, t2);
}
- public float Dot(Quat b)
+ public real_t Dot(Quat b)
{
return x * b.x + y * b.y + z * b.z + w * b.w;
}
@@ -76,12 +81,12 @@ namespace Godot
return new Quat(-x, -y, -z, w);
}
- public float Length()
+ public real_t Length()
{
return Mathf.Sqrt(LengthSquared());
}
- public float LengthSquared()
+ public real_t LengthSquared()
{
return Dot(this);
}
@@ -91,20 +96,27 @@ namespace Godot
return this / Length();
}
- public void Set(float x, float y, float z, float w)
+ public void Set(real_t x, real_t y, real_t z, real_t w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
+ public void Set(Quat q)
+ {
+ x = q.x;
+ y = q.y;
+ z = q.z;
+ w = q.w;
+ }
- public Quat Slerp(Quat b, float t)
+ public Quat Slerp(Quat b, real_t t)
{
// Calculate cosine
- float cosom = x * b.x + y * b.y + z * b.z + w * b.w;
+ real_t cosom = x * b.x + y * b.y + z * b.z + w * b.w;
- float[] to1 = new float[4];
+ var to1 = new real_t[4];
// Adjust signs if necessary
if (cosom < 0.0)
@@ -122,13 +134,13 @@ namespace Godot
to1[3] = b.w;
}
- float sinom, scale0, scale1;
+ real_t sinom, scale0, scale1;
// Calculate coefficients
- if ((1.0 - cosom) > Mathf.Epsilon)
+ if (1.0 - cosom > Mathf.Epsilon)
{
// Standard case (Slerp)
- float omega = Mathf.Acos(cosom);
+ real_t omega = Mathf.Acos(cosom);
sinom = Mathf.Sin(omega);
scale0 = Mathf.Sin((1.0f - t) * omega) / sinom;
scale1 = Mathf.Sin(t * omega) / sinom;
@@ -150,47 +162,56 @@ namespace Godot
);
}
- public Quat Slerpni(Quat b, float t)
+ public Quat Slerpni(Quat b, real_t t)
{
- float dot = this.Dot(b);
+ real_t dot = Dot(b);
if (Mathf.Abs(dot) > 0.9999f)
{
return this;
}
- float theta = Mathf.Acos(dot);
- float sinT = 1.0f / Mathf.Sin(theta);
- float newFactor = Mathf.Sin(t * theta) * sinT;
- float invFactor = Mathf.Sin((1.0f - t) * theta) * sinT;
+ real_t theta = Mathf.Acos(dot);
+ real_t sinT = 1.0f / Mathf.Sin(theta);
+ real_t newFactor = Mathf.Sin(t * theta) * sinT;
+ real_t invFactor = Mathf.Sin((1.0f - t) * theta) * sinT;
return new Quat
(
- invFactor * this.x + newFactor * b.x,
- invFactor * this.y + newFactor * b.y,
- invFactor * this.z + newFactor * b.z,
- invFactor * this.w + newFactor * b.w
+ invFactor * x + newFactor * b.x,
+ invFactor * y + newFactor * b.y,
+ invFactor * z + newFactor * b.z,
+ invFactor * w + newFactor * b.w
);
}
public Vector3 Xform(Vector3 v)
{
Quat q = this * v;
- q *= this.Inverse();
+ q *= Inverse();
return new Vector3(q.x, q.y, q.z);
}
- public Quat(float x, float y, float z, float w)
+ // Constructors
+ public Quat(real_t x, real_t y, real_t z, real_t w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
+ }
+ public Quat(Quat q)
+ {
+ x = q.x;
+ y = q.y;
+ z = q.z;
+ w = q.w;
}
-
- public Quat(Vector3 axis, float angle)
+
+ public Quat(Vector3 axis, real_t angle)
{
- float d = axis.Length();
+ real_t d = axis.Length();
+ real_t angle_t = angle;
if (d == 0f)
{
@@ -201,12 +222,12 @@ namespace Godot
}
else
{
- float s = Mathf.Sin(angle * 0.5f) / d;
+ real_t s = Mathf.Sin(angle_t * 0.5f) / d;
x = axis.x * s;
y = axis.y * s;
z = axis.z * s;
- w = Mathf.Cos(angle * 0.5f);
+ w = Mathf.Cos(angle_t * 0.5f);
}
}
@@ -258,17 +279,17 @@ namespace Godot
);
}
- public static Quat operator *(Quat left, float right)
+ public static Quat operator *(Quat left, real_t right)
{
return new Quat(left.x * right, left.y * right, left.z * right, left.w * right);
}
- public static Quat operator *(float left, Quat right)
+ public static Quat operator *(real_t left, Quat right)
{
return new Quat(right.x * left, right.y * left, right.z * left, right.w * left);
}
- public static Quat operator /(Quat left, float right)
+ public static Quat operator /(Quat left, real_t right)
{
return left * (1.0f / right);
}
@@ -305,24 +326,12 @@ namespace Godot
public override string ToString()
{
- return String.Format("({0}, {1}, {2}, {3})", new object[]
- {
- this.x.ToString(),
- this.y.ToString(),
- this.z.ToString(),
- this.w.ToString()
- });
+ return String.Format("({0}, {1}, {2}, {3})", x.ToString(), y.ToString(), z.ToString(), w.ToString());
}
public string ToString(string format)
{
- return String.Format("({0}, {1}, {2}, {3})", new object[]
- {
- this.x.ToString(format),
- this.y.ToString(format),
- this.z.ToString(format),
- this.w.ToString(format)
- });
+ return String.Format("({0}, {1}, {2}, {3})", x.ToString(format), y.ToString(format), z.ToString(format), w.ToString(format));
}
}
}
diff --git a/modules/mono/glue/cs_files/RPCAttributes.cs b/modules/mono/glue/cs_files/RPCAttributes.cs
index 08841ffd76..6bf9560bfa 100644
--- a/modules/mono/glue/cs_files/RPCAttributes.cs
+++ b/modules/mono/glue/cs_files/RPCAttributes.cs
@@ -13,4 +13,13 @@ namespace Godot
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
public class SlaveAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class RemoteSyncAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class MasterSyncAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class SlaveSyncAttribute : Attribute {}
}
diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/cs_files/Rect2.cs
index e1fbb65da5..6f16656573 100644
--- a/modules/mono/glue/cs_files/Rect2.cs
+++ b/modules/mono/glue/cs_files/Rect2.cs
@@ -1,5 +1,10 @@
using System;
using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -26,14 +31,14 @@ namespace Godot
get { return position + size; }
}
- public float Area
+ public real_t Area
{
get { return GetArea(); }
}
public Rect2 Clip(Rect2 b)
{
- Rect2 newRect = b;
+ var newRect = b;
if (!Intersects(newRect))
return new Rect2();
@@ -52,14 +57,14 @@ namespace Godot
public 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;
}
public Rect2 Expand(Vector2 to)
{
- Rect2 expanded = this;
+ var expanded = this;
Vector2 begin = expanded.position;
Vector2 end = expanded.position + expanded.size;
@@ -80,14 +85,14 @@ namespace Godot
return expanded;
}
- public float GetArea()
+ public real_t GetArea()
{
return size.x * size.y;
}
- public Rect2 Grow(float by)
+ public Rect2 Grow(real_t by)
{
- Rect2 g = this;
+ var g = this;
g.position.x -= by;
g.position.y -= by;
@@ -97,9 +102,9 @@ namespace Godot
return g;
}
- public Rect2 GrowIndividual(float left, float top, float right, float bottom)
+ public Rect2 GrowIndividual(real_t left, real_t top, real_t right, real_t bottom)
{
- Rect2 g = this;
+ var g = this;
g.position.x -= left;
g.position.y -= top;
@@ -109,14 +114,14 @@ namespace Godot
return g;
}
- public Rect2 GrowMargin(Margin margin, float by)
+ public Rect2 GrowMargin(Margin margin, real_t by)
{
- Rect2 g = this;
+ var g = this;
- g.GrowIndividual((Margin.Left == margin) ? by : 0,
- (Margin.Top == margin) ? by : 0,
- (Margin.Right == margin) ? by : 0,
- (Margin.Bottom == margin) ? by : 0);
+ g.GrowIndividual(Margin.Left == margin ? by : 0,
+ Margin.Top == margin ? by : 0,
+ Margin.Right == margin ? by : 0,
+ Margin.Bottom == margin ? by : 0);
return g;
}
@@ -133,9 +138,9 @@ namespace Godot
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;
@@ -143,13 +148,13 @@ namespace Godot
public bool Intersects(Rect2 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;
@@ -169,17 +174,27 @@ namespace Godot
return newRect;
}
-
+
+ // Constructors
public Rect2(Vector2 position, Vector2 size)
{
this.position = position;
this.size = size;
}
-
- public Rect2(float x, float y, float width, float height)
+ public Rect2(Vector2 position, real_t width, real_t height)
+ {
+ this.position = position;
+ size = new Vector2(width, height);
+ }
+ public Rect2(real_t x, real_t y, Vector2 size)
+ {
+ position = new Vector2(x, y);
+ this.size = size;
+ }
+ public Rect2(real_t x, real_t y, real_t width, real_t height)
{
- this.position = new Vector2(x, y);
- this.size = new Vector2(width, height);
+ position = new Vector2(x, y);
+ size = new Vector2(width, height);
}
public static bool operator ==(Rect2 left, Rect2 right)
@@ -216,8 +231,8 @@ namespace Godot
{
return String.Format("({0}, {1})", new object[]
{
- this.position.ToString(),
- this.size.ToString()
+ position.ToString(),
+ size.ToString()
});
}
@@ -225,8 +240,8 @@ namespace Godot
{
return String.Format("({0}, {1})", new object[]
{
- this.position.ToString(format),
- this.size.ToString(format)
+ position.ToString(format),
+ size.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/SignalAttribute.cs b/modules/mono/glue/cs_files/SignalAttribute.cs
index d8a6cabb83..3957387be9 100644
--- a/modules/mono/glue/cs_files/SignalAttribute.cs
+++ b/modules/mono/glue/cs_files/SignalAttribute.cs
@@ -5,8 +5,5 @@ namespace Godot
[AttributeUsage(AttributeTargets.Delegate)]
public class SignalAttribute : Attribute
{
- public SignalAttribute()
- {
- }
}
}
diff --git a/modules/mono/glue/cs_files/SignalAwaiter.cs b/modules/mono/glue/cs_files/SignalAwaiter.cs
index 19ccc26e79..c06f6b05c9 100644
--- a/modules/mono/glue/cs_files/SignalAwaiter.cs
+++ b/modules/mono/glue/cs_files/SignalAwaiter.cs
@@ -4,15 +4,15 @@ namespace Godot
{
public class SignalAwaiter : IAwaiter<object[]>, IAwaitable<object[]>
{
- private bool completed = false;
- private object[] result = null;
- private Action action = null;
+ private bool completed;
+ private object[] result;
+ private Action action;
- public SignalAwaiter(Godot.Object source, string signal, Godot.Object target)
+ public SignalAwaiter(Object source, string signal, Object target)
{
NativeCalls.godot_icall_Object_connect_signal_awaiter(
- Godot.Object.GetPtr(source),
- signal, Godot.Object.GetPtr(target), this
+ Object.GetPtr(source),
+ signal, Object.GetPtr(target), this
);
}
diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs
index 5c3ceff97d..eaeed7b37b 100644
--- a/modules/mono/glue/cs_files/StringExtensions.cs
+++ b/modules/mono/glue/cs_files/StringExtensions.cs
@@ -1,4 +1,5 @@
//using System;
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -43,11 +44,9 @@ namespace Godot
{
return instance.Substring(prev, i - prev);
}
- else
- {
- count++;
- prev = i + 1;
- }
+
+ count++;
+ prev = i + 1;
}
i++;
@@ -83,7 +82,7 @@ namespace Godot
// </summary>
public static string[] Bigrams(this string instance)
{
- string[] b = new string[instance.Length - 1];
+ var b = new string[instance.Length - 1];
for (int i = 0; i < b.Length; i++)
{
@@ -98,7 +97,7 @@ namespace Godot
// </summary>
public static string CEscape(this string instance)
{
- StringBuilder sb = new StringBuilder(string.Copy(instance));
+ var sb = new StringBuilder(string.Copy(instance));
sb.Replace("\\", "\\\\");
sb.Replace("\a", "\\a");
@@ -120,7 +119,7 @@ namespace Godot
// </summary>
public static string CUnescape(this string instance)
{
- StringBuilder sb = new StringBuilder(string.Copy(instance));
+ var sb = new StringBuilder(string.Copy(instance));
sb.Replace("\\a", "\a");
sb.Replace("\\b", "\b");
@@ -143,7 +142,7 @@ namespace Godot
public static string Capitalize(this string instance)
{
string aux = instance.Replace("_", " ").ToLower();
- string cap = string.Empty;
+ var cap = string.Empty;
for (int i = 0; i < aux.GetSliceCount(" "); i++)
{
@@ -178,13 +177,13 @@ namespace Godot
{
if (to[to_idx] == 0 && instance[instance_idx] == 0)
return 0; // We're equal
- else if (instance[instance_idx] == 0)
+ if (instance[instance_idx] == 0)
return -1; // If this is empty, and the other one is not, then we're less... I think?
- else if (to[to_idx] == 0)
+ if (to[to_idx] == 0)
return 1; // Otherwise the other one is smaller...
- else if (instance[instance_idx] < to[to_idx]) // More than
+ if (instance[instance_idx] < to[to_idx]) // More than
return -1;
- else if (instance[instance_idx] > to[to_idx]) // Less than
+ if (instance[instance_idx] > to[to_idx]) // Less than
return 1;
instance_idx++;
@@ -226,7 +225,7 @@ namespace Godot
if (pos < 0)
return instance;
- return instance.Substring(pos + 1, instance.Length);
+ return instance.Substring(pos + 1);
}
// <summary>
@@ -260,12 +259,12 @@ namespace Godot
{
int basepos = instance.Find("://");
- string rs = string.Empty;
- string @base = string.Empty;
+ string rs;
+ var @base = string.Empty;
if (basepos != -1)
{
- int end = basepos + 3;
+ var end = basepos + 3;
rs = instance.Substring(end, instance.Length);
@base = instance.Substring(0, end);
}
@@ -287,7 +286,7 @@ namespace Godot
if (sep == -1)
return @base;
- return @base + rs.substr(0, sep);
+ return @base + rs.Substr(0, sep);
}
// <summary>
@@ -312,8 +311,8 @@ namespace Godot
int hashv = 5381;
int c;
- while ((c = (int)instance[index++]) != 0)
- hashv = ((hashv << 5) + hashv) + c; // hash * 33 + c
+ while ((c = instance[index++]) != 0)
+ hashv = (hashv << 5) + hashv + c; // hash * 33 + c
return hashv;
}
@@ -379,7 +378,7 @@ namespace Godot
while (instance[src] != 0 && text[tgt] != 0)
{
- bool match = false;
+ bool match;
if (case_insensitive)
{
@@ -455,7 +454,10 @@ namespace Godot
return false; // Don't start with number plz
}
- bool valid_char = (instance[i] >= '0' && instance[i] <= '9') || (instance[i] >= 'a' && instance[i] <= 'z') || (instance[i] >= 'A' && instance[i] <= 'Z') || instance[i] == '_';
+ bool valid_char = instance[i] >= '0' &&
+ instance[i] <= '9' || instance[i] >= 'a' &&
+ instance[i] <= 'z' || instance[i] >= 'A' &&
+ instance[i] <= 'Z' || instance[i] == '_';
if (!valid_char)
return false;
@@ -478,7 +480,7 @@ namespace Godot
// </summary>
public static bool IsValidIpAddress(this string instance)
{
- string[] ip = instance.split(".");
+ string[] ip = instance.Split(".");
if (ip.Length != 4)
return false;
@@ -489,7 +491,7 @@ namespace Godot
if (!n.IsValidInteger())
return false;
- int val = n.to_int();
+ int val = n.ToInt();
if (val < 0 || val > 255)
return false;
}
@@ -502,7 +504,7 @@ namespace Godot
// </summary>
public static string JsonEscape(this string instance)
{
- StringBuilder sb = new StringBuilder(string.Copy(instance));
+ var sb = new StringBuilder(string.Copy(instance));
sb.Replace("\\", "\\\\");
sb.Replace("\b", "\\b");
@@ -551,7 +553,7 @@ namespace Godot
case '\0':
return instance[0] == 0;
case '*':
- return ExprMatch(expr + 1, instance, caseSensitive) || (instance[0] != 0 && ExprMatch(expr, instance + 1, caseSensitive));
+ return ExprMatch(expr + 1, instance, caseSensitive) || instance[0] != 0 && ExprMatch(expr, instance + 1, caseSensitive);
case '?':
return instance[0] != 0 && instance[0] != '.' && ExprMatch(expr + 1, instance + 1, caseSensitive);
default:
@@ -571,7 +573,7 @@ namespace Godot
// <summary>
// Do a simple case insensitive expression match, using ? and * wildcards (see [method expr_match]).
// </summary>
- public static bool matchn(this string instance, string expr)
+ public static bool Matchn(this string instance, string expr)
{
return instance.ExprMatch(expr, false);
}
@@ -610,13 +612,13 @@ namespace Godot
{
if (to[to_idx] == 0 && instance[instance_idx] == 0)
return 0; // We're equal
- else if (instance[instance_idx] == 0)
+ if (instance[instance_idx] == 0)
return -1; // If this is empty, and the other one is not, then we're less... I think?
- else if (to[to_idx] == 0)
+ if (to[to_idx] == 0)
return 1; // Otherwise the other one is smaller..
- else if (char.ToUpper(instance[instance_idx]) < char.ToUpper(to[to_idx])) // More than
+ if (char.ToUpper(instance[instance_idx]) < char.ToUpper(to[to_idx])) // More than
return -1;
- else if (char.ToUpper(instance[instance_idx]) > char.ToUpper(to[to_idx])) // Less than
+ if (char.ToUpper(instance[instance_idx]) > char.ToUpper(to[to_idx])) // Less than
return 1;
instance_idx++;
@@ -724,8 +726,7 @@ namespace Godot
{
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
return instance + file;
- else
- return instance + "/" + file;
+ return instance + "/" + file;
}
// <summary>
@@ -771,7 +772,7 @@ namespace Godot
if (pos < 0)
return string.Empty;
- return instance.Substring(pos, (instance.Length - pos));
+ return instance.Substring(pos, instance.Length - pos);
}
public static byte[] Sha256Buffer(this string instance)
@@ -824,23 +825,23 @@ namespace Godot
}
}
- return (2.0f * inter) / sum;
+ return 2.0f * inter / sum;
}
// <summary>
// Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".
// </summary>
- public static string[] split(this string instance, string divisor, bool allow_empty = true)
+ public static string[] Split(this string instance, string divisor, bool allow_empty = true)
{
- return instance.Split(new string[] { divisor }, StringSplitOptions.RemoveEmptyEntries);
+ return instance.Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);
}
// <summary>
// Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",".
// </summary>
- public static float[] split_floats(this string instance, string divisor, bool allow_empty = true)
+ public static float[] SplitFloats(this string instance, string divisor, bool allow_empty = true)
{
- List<float> ret = new List<float>();
+ var ret = new List<float>();
int from = 0;
int len = instance.Length;
@@ -849,7 +850,7 @@ namespace Godot
int end = instance.Find(divisor, from);
if (end < 0)
end = len;
- if (allow_empty || (end > from))
+ if (allow_empty || end > from)
ret.Add(float.Parse(instance.Substring(from)));
if (end == len)
break;
@@ -872,25 +873,22 @@ namespace Godot
// <summary>
// Return a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively.
// </summary>
- public static string strip_edges(this string instance, bool left = true, bool right = true)
+ public static string StripEdges(this string instance, bool left = true, bool right = true)
{
if (left)
{
if (right)
return instance.Trim(non_printable);
- else
- return instance.TrimStart(non_printable);
- }
- else
- {
- return instance.TrimEnd(non_printable);
+ return instance.TrimStart(non_printable);
}
+
+ return instance.TrimEnd(non_printable);
}
// <summary>
// Return part of the string from the position [code]from[/code], with length [code]len[/code].
// </summary>
- public static string substr(this string instance, int from, int len)
+ public static string Substr(this string instance, int from, int len)
{
return instance.Substring(from, len);
}
@@ -898,7 +896,7 @@ namespace Godot
// <summary>
// Convert the String (which is a character array) to PoolByteArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters.
// </summary>
- public static byte[] to_ascii(this string instance)
+ public static byte[] ToAscii(this string instance)
{
return Encoding.ASCII.GetBytes(instance);
}
@@ -906,7 +904,7 @@ namespace Godot
// <summary>
// Convert a string, containing a decimal number, into a [code]float[/code].
// </summary>
- public static float to_float(this string instance)
+ public static float ToFloat(this string instance)
{
return float.Parse(instance);
}
@@ -914,7 +912,7 @@ namespace Godot
// <summary>
// Convert a string, containing an integer number, into an [code]int[/code].
// </summary>
- public static int to_int(this string instance)
+ public static int ToInt(this string instance)
{
return int.Parse(instance);
}
@@ -922,7 +920,7 @@ namespace Godot
// <summary>
// Return the string converted to lowercase.
// </summary>
- public static string to_lower(this string instance)
+ public static string ToLower(this string instance)
{
return instance.ToLower();
}
@@ -930,7 +928,7 @@ namespace Godot
// <summary>
// Return the string converted to uppercase.
// </summary>
- public static string to_upper(this string instance)
+ public static string ToUpper(this string instance)
{
return instance.ToUpper();
}
@@ -938,7 +936,7 @@ namespace Godot
// <summary>
// Convert the String (which is an array of characters) to PoolByteArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii().
// </summary>
- public static byte[] to_utf8(this string instance)
+ public static byte[] ToUtf8(this string instance)
{
return Encoding.UTF8.GetBytes(instance);
}
@@ -946,7 +944,7 @@ namespace Godot
// <summary>
// Return a copy of the string with special characters escaped using the XML standard.
// </summary>
- public static string xml_escape(this string instance)
+ public static string XmlEscape(this string instance)
{
return SecurityElement.Escape(instance);
}
@@ -954,7 +952,7 @@ namespace Godot
// <summary>
// Return a copy of the string with escaped characters replaced by their meanings according to the XML standard.
// </summary>
- public static string xml_unescape(this string instance)
+ public static string XmlUnescape(this string instance)
{
return SecurityElement.FromString(instance).Text;
}
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs
index 5214100d36..d1b247a552 100644
--- a/modules/mono/glue/cs_files/Transform.cs
+++ b/modules/mono/glue/cs_files/Transform.cs
@@ -1,5 +1,10 @@
using System;
using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -23,8 +28,8 @@ namespace Godot
public Transform LookingAt(Vector3 target, Vector3 up)
{
- Transform t = this;
- t.set_look_at(origin, target, up);
+ var t = this;
+ t.SetLookAt(origin, target, up);
return t;
}
@@ -33,7 +38,7 @@ namespace Godot
return new Transform(basis.Orthonormalized(), origin);
}
- public Transform Rotated(Vector3 axis, float phi)
+ public Transform Rotated(Vector3 axis, real_t phi)
{
return new Transform(new Basis(axis, phi), new Vector3()) * this;
}
@@ -43,7 +48,7 @@ namespace Godot
return new Transform(basis.Scaled(scale), origin * scale);
}
- public void set_look_at(Vector3 eye, Vector3 target, Vector3 up)
+ public void SetLookAt(Vector3 eye, Vector3 target, Vector3 up)
{
// Make rotation matrix
// Z vector
@@ -92,21 +97,22 @@ namespace Godot
return new Vector3
(
- (basis[0, 0] * vInv.x) + (basis[1, 0] * vInv.y) + (basis[2, 0] * vInv.z),
- (basis[0, 1] * vInv.x) + (basis[1, 1] * vInv.y) + (basis[2, 1] * vInv.z),
- (basis[0, 2] * vInv.x) + (basis[1, 2] * vInv.y) + (basis[2, 2] * vInv.z)
+ basis[0, 0] * vInv.x + basis[1, 0] * vInv.y + basis[2, 0] * vInv.z,
+ basis[0, 1] * vInv.x + basis[1, 1] * vInv.y + basis[2, 1] * vInv.z,
+ basis[0, 2] * vInv.x + basis[1, 2] * vInv.y + basis[2, 2] * vInv.z
);
}
-
+
+ // Constructors
public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
{
- this.basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
+ basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
this.origin = origin;
}
public Transform(Quat quat, Vector3 origin)
{
- this.basis = new Basis(quat);
+ basis = new Basis(quat);
this.origin = origin;
}
@@ -157,8 +163,8 @@ namespace Godot
{
return String.Format("{0} - {1}", new object[]
{
- this.basis.ToString(),
- this.origin.ToString()
+ basis.ToString(),
+ origin.ToString()
});
}
@@ -166,8 +172,8 @@ namespace Godot
{
return String.Format("{0} - {1}", new object[]
{
- this.basis.ToString(format),
- this.origin.ToString(format)
+ basis.ToString(format),
+ origin.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/cs_files/Transform2D.cs
index fe7c5b5706..ff5259178b 100644
--- a/modules/mono/glue/cs_files/Transform2D.cs
+++ b/modules/mono/glue/cs_files/Transform2D.cs
@@ -1,5 +1,10 @@
using System;
using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -27,7 +32,7 @@ namespace Godot
get { return o; }
}
- public float Rotation
+ public real_t Rotation
{
get { return Mathf.Atan2(y.x, o.y); }
}
@@ -73,7 +78,7 @@ namespace Godot
}
- public float this[int index, int axis]
+ public real_t this[int index, int axis]
{
get
{
@@ -105,9 +110,9 @@ namespace Godot
public Transform2D AffineInverse()
{
- Transform2D inv = this;
+ var inv = this;
- float det = this[0, 0] * this[1, 1] - this[1, 0] * this[0, 1];
+ real_t det = this[0, 0] * this[1, 1] - this[1, 0] * this[0, 1];
if (det == 0)
{
@@ -119,9 +124,9 @@ namespace Godot
);
}
- float idet = 1.0f / det;
+ real_t idet = 1.0f / det;
- float temp = this[0, 0];
+ real_t temp = this[0, 0];
this[0, 0] = this[1, 1];
this[1, 1] = temp;
@@ -143,24 +148,24 @@ namespace Godot
return new Vector2(x.Dot(v), y.Dot(v));
}
- public Transform2D InterpolateWith(Transform2D m, float c)
+ public Transform2D InterpolateWith(Transform2D m, real_t c)
{
- float r1 = Rotation;
- float r2 = m.Rotation;
+ real_t r1 = Rotation;
+ real_t r2 = m.Rotation;
Vector2 s1 = Scale;
Vector2 s2 = m.Scale;
// Slerp rotation
- Vector2 v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1));
- Vector2 v2 = new Vector2(Mathf.Cos(r2), Mathf.Sin(r2));
+ var v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1));
+ var v2 = new Vector2(Mathf.Cos(r2), Mathf.Sin(r2));
- float dot = v1.Dot(v2);
+ real_t dot = v1.Dot(v2);
// Clamp dot to [-1, 1]
- dot = (dot < -1.0f) ? -1.0f : ((dot > 1.0f) ? 1.0f : dot);
+ dot = dot < -1.0f ? -1.0f : (dot > 1.0f ? 1.0f : dot);
- Vector2 v = new Vector2();
+ Vector2 v;
if (dot > 0.9995f)
{
@@ -169,7 +174,7 @@ namespace Godot
}
else
{
- float angle = c * Mathf.Acos(dot);
+ real_t angle = c * Mathf.Acos(dot);
Vector2 v3 = (v2 - v1 * dot).Normalized();
v = v1 * Mathf.Cos(angle) + v3 * Mathf.Sin(angle);
}
@@ -179,7 +184,7 @@ namespace Godot
Vector2 p2 = m.Origin;
// Construct matrix
- Transform2D res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.LinearInterpolate(p2, c));
+ var res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.LinearInterpolate(p2, c));
Vector2 scale = s1.LinearInterpolate(s2, c);
res.x *= scale;
res.y *= scale;
@@ -189,10 +194,10 @@ namespace Godot
public Transform2D Inverse()
{
- Transform2D inv = this;
+ var inv = this;
// Swap
- float temp = inv.x.y;
+ real_t temp = inv.x.y;
inv.x.y = inv.y.x;
inv.y.x = temp;
@@ -203,13 +208,13 @@ namespace Godot
public Transform2D Orthonormalized()
{
- Transform2D on = this;
+ var on = this;
Vector2 onX = on.x;
Vector2 onY = on.y;
onX.Normalize();
- onY = onY - onX * (onX.Dot(onY));
+ onY = onY - onX * onX.Dot(onY);
onY.Normalize();
on.x = onX;
@@ -218,33 +223,33 @@ namespace Godot
return on;
}
- public Transform2D Rotated(float phi)
+ public Transform2D Rotated(real_t phi)
{
return this * new Transform2D(phi, new Vector2());
}
public Transform2D Scaled(Vector2 scale)
{
- Transform2D copy = this;
+ var copy = this;
copy.x *= scale;
copy.y *= scale;
copy.o *= scale;
return copy;
}
- private float Tdotx(Vector2 with)
+ private real_t Tdotx(Vector2 with)
{
return this[0, 0] * with[0] + this[1, 0] * with[1];
}
- private float Tdoty(Vector2 with)
+ private real_t Tdoty(Vector2 with)
{
return this[0, 1] * with[0] + this[1, 1] * with[1];
}
public Transform2D Translated(Vector2 offset)
{
- Transform2D copy = this;
+ var copy = this;
copy.o += copy.BasisXform(offset);
return copy;
}
@@ -259,24 +264,26 @@ namespace Godot
Vector2 vInv = v - o;
return new Vector2(x.Dot(vInv), y.Dot(vInv));
}
-
+
+ // Constructors
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 origin)
{
- this.x = xAxis;
- this.y = yAxis;
- this.o = origin;
+ x = xAxis;
+ y = yAxis;
+ o = origin;
}
- public Transform2D(float xx, float xy, float yx, float yy, float ox, float oy)
+
+ public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
{
- this.x = new Vector2(xx, xy);
- this.y = new Vector2(yx, yy);
- this.o = new Vector2(ox, oy);
+ x = new Vector2(xx, xy);
+ y = new Vector2(yx, yy);
+ o = new Vector2(ox, oy);
}
- public Transform2D(float rot, Vector2 pos)
+ public Transform2D(real_t rot, Vector2 pos)
{
- float cr = Mathf.Cos(rot);
- float sr = Mathf.Sin(rot);
+ real_t cr = Mathf.Cos(rot);
+ real_t sr = Mathf.Sin(rot);
x.x = cr;
y.y = cr;
x.y = -sr;
@@ -288,7 +295,7 @@ namespace Godot
{
left.o = left.Xform(right.o);
- float x0, x1, y0, y1;
+ real_t x0, x1, y0, y1;
x0 = left.Tdotx(right.x);
x1 = left.Tdoty(right.x);
@@ -337,9 +344,9 @@ namespace Godot
{
return String.Format("({0}, {1}, {2})", new object[]
{
- this.x.ToString(),
- this.y.ToString(),
- this.o.ToString()
+ x.ToString(),
+ y.ToString(),
+ o.ToString()
});
}
@@ -347,9 +354,9 @@ namespace Godot
{
return String.Format("({0}, {1}, {2})", new object[]
{
- this.x.ToString(format),
- this.y.ToString(format),
- this.o.ToString(format)
+ x.ToString(format),
+ y.ToString(format),
+ o.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/VERSION.txt b/modules/mono/glue/cs_files/VERSION.txt
new file mode 100755
index 0000000000..00750edc07
--- /dev/null
+++ b/modules/mono/glue/cs_files/VERSION.txt
@@ -0,0 +1 @@
+3
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs
index 238775bda2..c274364895 100644
--- a/modules/mono/glue/cs_files/Vector2.cs
+++ b/modules/mono/glue/cs_files/Vector2.cs
@@ -1,22 +1,26 @@
-using System;
-using System.Runtime.InteropServices;
-
// file: core/math/math_2d.h
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
// file: core/math/math_2d.cpp
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
// file: core/variant_call.cpp
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
+using System;
+using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
[StructLayout(LayoutKind.Sequential)]
public struct Vector2 : IEquatable<Vector2>
{
- public float x;
- public float y;
+ public real_t x;
+ public real_t y;
- public float this[int index]
+ public real_t this[int index]
{
get
{
@@ -48,7 +52,7 @@ namespace Godot
internal void Normalize()
{
- float length = x * x + y * y;
+ real_t length = x * x + y * y;
if (length != 0f)
{
@@ -58,7 +62,7 @@ namespace Godot
}
}
- private float Cross(Vector2 b)
+ public real_t Cross(Vector2 b)
{
return x * b.y - y * b.x;
}
@@ -68,22 +72,22 @@ namespace Godot
return new Vector2(Mathf.Abs(x), Mathf.Abs(y));
}
- public float Angle()
+ public real_t Angle()
{
return Mathf.Atan2(y, x);
}
- public float AngleTo(Vector2 to)
+ public real_t AngleTo(Vector2 to)
{
return Mathf.Atan2(Cross(to), Dot(to));
}
- public float AngleToPoint(Vector2 to)
+ public real_t AngleToPoint(Vector2 to)
{
return Mathf.Atan2(x - to.x, y - to.y);
}
- public float Aspect()
+ public real_t Aspect()
{
return x / y;
}
@@ -93,10 +97,15 @@ namespace Godot
return -Reflect(n);
}
- public Vector2 Clamped(float length)
+ public Vector2 Ceil()
{
- Vector2 v = this;
- float l = this.Length();
+ return new Vector2(Mathf.Ceil(x), Mathf.Ceil(y));
+ }
+
+ public Vector2 Clamped(real_t length)
+ {
+ var v = this;
+ real_t l = Length();
if (l > 0 && length < l)
{
@@ -107,33 +116,33 @@ namespace Godot
return v;
}
- public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
+ public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, real_t t)
{
- Vector2 p0 = preA;
- Vector2 p1 = this;
- Vector2 p2 = b;
- Vector2 p3 = postB;
+ var p0 = preA;
+ var p1 = this;
+ var p2 = b;
+ var p3 = postB;
- float t2 = t * t;
- float t3 = t2 * t;
+ real_t t2 = t * t;
+ real_t t3 = t2 * t;
- return 0.5f * ((p1 * 2.0f) +
+ return 0.5f * (p1 * 2.0f +
(-p0 + p2) * t +
(2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 +
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
}
- public float DistanceSquaredTo(Vector2 to)
+ public real_t DistanceSquaredTo(Vector2 to)
{
return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y);
}
- public float DistanceTo(Vector2 to)
+ public real_t DistanceTo(Vector2 to)
{
return Mathf.Sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
}
- public float Dot(Vector2 with)
+ public real_t Dot(Vector2 with)
{
return x * with.x + y * with.y;
}
@@ -148,29 +157,29 @@ namespace Godot
return Mathf.Abs(LengthSquared() - 1.0f) < Mathf.Epsilon;
}
- public float Length()
+ public real_t Length()
{
return Mathf.Sqrt(x * x + y * y);
}
- public float LengthSquared()
+ public real_t LengthSquared()
{
return x * x + y * y;
}
- public Vector2 LinearInterpolate(Vector2 b, float t)
+ public Vector2 LinearInterpolate(Vector2 b, real_t t)
{
- Vector2 res = this;
+ var res = this;
- res.x += (t * (b.x - x));
- res.y += (t * (b.y - y));
+ res.x += t * (b.x - x);
+ res.y += t * (b.y - y);
return res;
}
public Vector2 Normalized()
{
- Vector2 result = this;
+ var result = this;
result.Normalize();
return result;
}
@@ -180,12 +189,34 @@ namespace Godot
return 2.0f * n * Dot(n) - this;
}
- public Vector2 Rotated(float phi)
+ public Vector2 Rotated(real_t phi)
{
- float rads = Angle() + phi;
+ real_t rads = Angle() + phi;
return new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * Length();
}
+ public Vector2 Round()
+ {
+ return new Vector2(Mathf.Round(x), Mathf.Round(y));
+ }
+
+ public void Set(real_t x, real_t y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+ public void Set(Vector2 v)
+ {
+ x = v.x;
+ y = v.y;
+ }
+
+ public Vector2 Slerp(Vector2 b, real_t t)
+ {
+ real_t theta = AngleTo(b);
+ return Rotated(theta * t);
+ }
+
public Vector2 Slide(Vector2 n)
{
return this - n * Dot(n);
@@ -200,12 +231,36 @@ namespace Godot
{
return new Vector2(y, -x);
}
-
- public Vector2(float x, float y)
+
+ private static readonly Vector2 zero = new Vector2 (0, 0);
+ private static readonly Vector2 one = new Vector2 (1, 1);
+ private static readonly Vector2 negOne = new Vector2 (-1, -1);
+
+ private static readonly Vector2 up = new Vector2 (0, 1);
+ private static readonly Vector2 down = new Vector2 (0, -1);
+ private static readonly Vector2 right = new Vector2 (1, 0);
+ private static readonly Vector2 left = new Vector2 (-1, 0);
+
+ public static Vector2 Zero { get { return zero; } }
+ public static Vector2 One { get { return one; } }
+ public static Vector2 NegOne { get { return negOne; } }
+
+ public static Vector2 Up { get { return up; } }
+ public static Vector2 Down { get { return down; } }
+ public static Vector2 Right { get { return right; } }
+ public static Vector2 Left { get { return left; } }
+
+ // Constructors
+ public Vector2(real_t x, real_t y)
{
this.x = x;
this.y = y;
}
+ public Vector2(Vector2 v)
+ {
+ x = v.x;
+ y = v.y;
+ }
public static Vector2 operator +(Vector2 left, Vector2 right)
{
@@ -228,14 +283,14 @@ namespace Godot
return vec;
}
- public static Vector2 operator *(Vector2 vec, float scale)
+ public static Vector2 operator *(Vector2 vec, real_t scale)
{
vec.x *= scale;
vec.y *= scale;
return vec;
}
- public static Vector2 operator *(float scale, Vector2 vec)
+ public static Vector2 operator *(real_t scale, Vector2 vec)
{
vec.x *= scale;
vec.y *= scale;
@@ -249,7 +304,7 @@ namespace Godot
return left;
}
- public static Vector2 operator /(Vector2 vec, float scale)
+ public static Vector2 operator /(Vector2 vec, real_t scale)
{
vec.x /= scale;
vec.y /= scale;
@@ -279,10 +334,8 @@ namespace Godot
{
return left.y < right.y;
}
- else
- {
- return left.x < right.x;
- }
+
+ return left.x < right.x;
}
public static bool operator >(Vector2 left, Vector2 right)
@@ -291,10 +344,8 @@ namespace Godot
{
return left.y > right.y;
}
- else
- {
- return left.x > right.x;
- }
+
+ return left.x > right.x;
}
public static bool operator <=(Vector2 left, Vector2 right)
@@ -303,10 +354,8 @@ namespace Godot
{
return left.y <= right.y;
}
- else
- {
- return left.x <= right.x;
- }
+
+ return left.x <= right.x;
}
public static bool operator >=(Vector2 left, Vector2 right)
@@ -315,10 +364,8 @@ namespace Godot
{
return left.y >= right.y;
}
- else
- {
- return left.x >= right.x;
- }
+
+ return left.x >= right.x;
}
public override bool Equals(object obj)
@@ -345,8 +392,8 @@ namespace Godot
{
return String.Format("({0}, {1})", new object[]
{
- this.x.ToString(),
- this.y.ToString()
+ x.ToString(),
+ y.ToString()
});
}
@@ -354,8 +401,8 @@ namespace Godot
{
return String.Format("({0}, {1})", new object[]
{
- this.x.ToString(format),
- this.y.ToString(format)
+ x.ToString(format),
+ y.ToString(format)
});
}
}
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs
index 190caa4b53..085a4f0043 100644
--- a/modules/mono/glue/cs_files/Vector3.cs
+++ b/modules/mono/glue/cs_files/Vector3.cs
@@ -1,12 +1,16 @@
-using System;
-using System.Runtime.InteropServices;
-
// file: core/math/vector3.h
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
// file: core/math/vector3.cpp
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
// file: core/variant_call.cpp
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
+using System;
+using System.Runtime.InteropServices;
+#if REAL_T_IS_DOUBLE
+using real_t = System.Double;
+#else
+using real_t = System.Single;
+#endif
namespace Godot
{
@@ -20,11 +24,11 @@ namespace Godot
Z
}
- public float x;
- public float y;
- public float z;
+ public real_t x;
+ public real_t y;
+ public real_t z;
- public float this[int index]
+ public real_t this[int index]
{
get
{
@@ -61,7 +65,7 @@ namespace Godot
internal void Normalize()
{
- float length = this.Length();
+ real_t length = Length();
if (length == 0f)
{
@@ -80,7 +84,7 @@ namespace Godot
return new Vector3(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z));
}
- public float AngleTo(Vector3 to)
+ public real_t AngleTo(Vector3 to)
{
return Mathf.Atan2(Cross(to).Length(), Dot(to));
}
@@ -99,40 +103,40 @@ namespace Godot
{
return new Vector3
(
- (y * b.z) - (z * b.y),
- (z * b.x) - (x * b.z),
- (x * b.y) - (y * b.x)
+ y * b.z - z * b.y,
+ z * b.x - x * b.z,
+ x * b.y - y * b.x
);
}
- public Vector3 CubicInterpolate(Vector3 b, Vector3 preA, Vector3 postB, float t)
+ public Vector3 CubicInterpolate(Vector3 b, Vector3 preA, Vector3 postB, real_t t)
{
- Vector3 p0 = preA;
- Vector3 p1 = this;
- Vector3 p2 = b;
- Vector3 p3 = postB;
+ var p0 = preA;
+ var p1 = this;
+ var p2 = b;
+ var p3 = postB;
- float t2 = t * t;
- float t3 = t2 * t;
+ real_t t2 = t * t;
+ real_t t3 = t2 * t;
return 0.5f * (
- (p1 * 2.0f) + (-p0 + p2) * t +
+ p1 * 2.0f + (-p0 + p2) * t +
(2.0f * p0 - 5.0f * p1 + 4f * p2 - p3) * t2 +
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3
);
}
- public float DistanceSquaredTo(Vector3 b)
+ public real_t DistanceSquaredTo(Vector3 b)
{
return (b - this).LengthSquared();
}
- public float DistanceTo(Vector3 b)
+ public real_t DistanceTo(Vector3 b)
{
return (b - this).Length();
}
- public float Dot(Vector3 b)
+ public real_t Dot(Vector3 b)
{
return x * b.x + y * b.y + z * b.z;
}
@@ -152,31 +156,31 @@ namespace Godot
return Mathf.Abs(LengthSquared() - 1.0f) < Mathf.Epsilon;
}
- public float Length()
+ public real_t Length()
{
- float x2 = x * x;
- float y2 = y * y;
- float z2 = z * z;
+ real_t x2 = x * x;
+ real_t y2 = y * y;
+ real_t z2 = z * z;
return Mathf.Sqrt(x2 + y2 + z2);
}
- public float LengthSquared()
+ public real_t LengthSquared()
{
- float x2 = x * x;
- float y2 = y * y;
- float z2 = z * z;
+ real_t x2 = x * x;
+ real_t y2 = y * y;
+ real_t z2 = z * z;
return x2 + y2 + z2;
}
- public Vector3 LinearInterpolate(Vector3 b, float t)
+ public Vector3 LinearInterpolate(Vector3 b, real_t t)
{
return new Vector3
(
- x + (t * (b.x - x)),
- y + (t * (b.y - y)),
- z + (t * (b.z - z))
+ x + t * (b.x - x),
+ y + t * (b.y - y),
+ z + t * (b.z - z)
);
}
@@ -192,7 +196,7 @@ namespace Godot
public Vector3 Normalized()
{
- Vector3 v = this;
+ var v = this;
v.Normalize();
return v;
}
@@ -215,11 +219,35 @@ namespace Godot
return 2.0f * n * Dot(n) - this;
}
- public Vector3 Rotated(Vector3 axis, float phi)
+ public Vector3 Round()
+ {
+ return new Vector3(Mathf.Round(x), Mathf.Round(y), Mathf.Round(z));
+ }
+
+ public Vector3 Rotated(Vector3 axis, real_t phi)
{
return new Basis(axis, phi).Xform(this);
}
+ public void Set(real_t x, real_t y, real_t z)
+ {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+ public void Set(Vector3 v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
+ }
+
+ public Vector3 Slerp(Vector3 b, real_t t)
+ {
+ real_t theta = AngleTo(b);
+ return Rotated(Cross(b), theta * t);
+ }
+
public Vector3 Slide(Vector3 n)
{
return this - n * Dot(n);
@@ -243,13 +271,42 @@ namespace Godot
0f, 0f, z
);
}
-
- public Vector3(float x, float y, float z)
+
+ private static readonly Vector3 zero = new Vector3 (0, 0, 0);
+ private static readonly Vector3 one = new Vector3 (1, 1, 1);
+ private static readonly Vector3 negOne = new Vector3 (-1, -1, -1);
+
+ private static readonly Vector3 up = new Vector3 (0, 1, 0);
+ private static readonly Vector3 down = new Vector3 (0, -1, 0);
+ private static readonly Vector3 right = new Vector3 (1, 0, 0);
+ private static readonly Vector3 left = new Vector3 (-1, 0, 0);
+ private static readonly Vector3 forward = new Vector3 (0, 0, -1);
+ private static readonly Vector3 back = new Vector3 (0, 0, 1);
+
+ public static Vector3 Zero { get { return zero; } }
+ public static Vector3 One { get { return one; } }
+ public static Vector3 NegOne { get { return negOne; } }
+
+ public static Vector3 Up { get { return up; } }
+ public static Vector3 Down { get { return down; } }
+ public static Vector3 Right { get { return right; } }
+ public static Vector3 Left { get { return left; } }
+ public static Vector3 Forward { get { return forward; } }
+ public static Vector3 Back { get { return back; } }
+
+ // Constructors
+ public Vector3(real_t x, real_t y, real_t z)
{
this.x = x;
this.y = y;
this.z = z;
}
+ public Vector3(Vector3 v)
+ {
+ x = v.x;
+ y = v.y;
+ z = v.z;
+ }
public static Vector3 operator +(Vector3 left, Vector3 right)
{
@@ -275,7 +332,7 @@ namespace Godot
return vec;
}
- public static Vector3 operator *(Vector3 vec, float scale)
+ public static Vector3 operator *(Vector3 vec, real_t scale)
{
vec.x *= scale;
vec.y *= scale;
@@ -283,7 +340,7 @@ namespace Godot
return vec;
}
- public static Vector3 operator *(float scale, Vector3 vec)
+ public static Vector3 operator *(real_t scale, Vector3 vec)
{
vec.x *= scale;
vec.y *= scale;
@@ -299,7 +356,7 @@ namespace Godot
return left;
}
- public static Vector3 operator /(Vector3 vec, float scale)
+ public static Vector3 operator /(Vector3 vec, real_t scale)
{
vec.x /= scale;
vec.y /= scale;
@@ -331,8 +388,7 @@ namespace Godot
{
if (left.y == right.y)
return left.z < right.z;
- else
- return left.y < right.y;
+ return left.y < right.y;
}
return left.x < right.x;
@@ -344,8 +400,7 @@ namespace Godot
{
if (left.y == right.y)
return left.z > right.z;
- else
- return left.y > right.y;
+ return left.y > right.y;
}
return left.x > right.x;
@@ -357,8 +412,7 @@ namespace Godot
{
if (left.y == right.y)
return left.z <= right.z;
- else
- return left.y < right.y;
+ return left.y < right.y;
}
return left.x < right.x;
@@ -370,8 +424,7 @@ namespace Godot
{
if (left.y == right.y)
return left.z >= right.z;
- else
- return left.y > right.y;
+ return left.y > right.y;
}
return left.x > right.x;
@@ -401,9 +454,9 @@ namespace Godot
{
return String.Format("({0}, {1}, {2})", new object[]
{
- this.x.ToString(),
- this.y.ToString(),
- this.z.ToString()
+ x.ToString(),
+ y.ToString(),
+ z.ToString()
});
}
@@ -411,9 +464,9 @@ namespace Godot
{
return String.Format("({0}, {1}, {2})", new object[]
{
- this.x.ToString(format),
- this.y.ToString(format),
- this.z.ToString(format)
+ x.ToString(format),
+ y.ToString(format),
+ z.ToString(format)
});
}
}
diff --git a/modules/mono/godotsharp_defs.h b/modules/mono/godotsharp_defs.h
index 4c26c3e6bd..f604464e8f 100644
--- a/modules/mono/godotsharp_defs.h
+++ b/modules/mono/godotsharp_defs.h
@@ -39,4 +39,7 @@
#define EDITOR_API_ASSEMBLY_NAME "GodotSharpEditor"
#define EDITOR_TOOLS_ASSEMBLY_NAME "GodotSharpTools"
+#define BINDINGS_CLASS_NATIVECALLS "NativeCalls"
+#define BINDINGS_CLASS_NATIVECALLS_EDITOR "EditorNativeCalls"
+
#endif // GODOTSHARP_DEFS_H
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index 39474f8cbc..0646580eaa 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -42,7 +42,10 @@
#include "project_settings.h"
#include "../csharp_script.h"
+#include "../godotsharp_dirs.h"
#include "../utils/path_utils.h"
+#include "gd_mono_class.h"
+#include "gd_mono_marshal.h"
#include "gd_mono_utils.h"
#ifdef TOOLS_ENABLED
@@ -71,7 +74,31 @@ void gdmono_MonoPrintCallback(const char *string, mono_bool is_stdout) {
GDMono *GDMono::singleton = NULL;
+namespace {
+
+void setup_runtime_main_args() {
+ CharString execpath = OS::get_singleton()->get_executable_path().utf8();
+
+ List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
+
+ List<CharString> cmdline_args_utf8;
+ Vector<char *> main_args;
+ main_args.resize(cmdline_args.size() + 1);
+
+ main_args[0] = execpath.ptrw();
+
+ int i = 1;
+ for (List<String>::Element *E = cmdline_args.front(); E; E = E->next()) {
+ CharString &stored = cmdline_args_utf8.push_back(E->get().utf8())->get();
+ main_args[i] = stored.ptrw();
+ i++;
+ }
+
+ mono_runtime_set_main_args(main_args.size(), main_args.ptrw());
+}
+
#ifdef DEBUG_ENABLED
+
static bool _wait_for_debugger_msecs(uint32_t p_msecs) {
do {
@@ -93,9 +120,7 @@ static bool _wait_for_debugger_msecs(uint32_t p_msecs) {
return mono_is_debugger_attached();
}
-#endif
-#ifdef DEBUG_ENABLED
void gdmono_debug_init() {
mono_debug_init(MONO_DEBUG_FORMAT_MONO);
@@ -122,8 +147,11 @@ void gdmono_debug_init() {
};
mono_jit_parse_options(2, (char **)options);
}
+
#endif
+} // namespace
+
void GDMono::initialize() {
ERR_FAIL_NULL(Engine::get_singleton());
@@ -176,6 +204,8 @@ void GDMono::initialize() {
GDMonoUtils::set_main_thread(GDMonoUtils::get_current_thread());
+ setup_runtime_main_args(); // Required for System.Environment.GetCommandLineArgs
+
runtime_initialized = true;
OS::get_singleton()->print("Mono: Runtime initialized\n");
@@ -208,7 +238,46 @@ void GDMono::initialize() {
_register_internal_calls();
// The following assemblies are not required at initialization
- _load_all_script_assemblies();
+#ifndef MONO_GLUE_DISABLED
+ if (_load_api_assemblies()) {
+ if (!core_api_assembly_out_of_sync && !editor_api_assembly_out_of_sync && GDMonoUtils::mono_cache.godot_api_cache_updated) {
+ // Everything is fine with the api assemblies, load the project assembly
+ _load_project_assembly();
+ } else {
+#ifdef TOOLS_ENABLED
+ // The assembly was successfuly loaded, but the full api could not be cached.
+ // This is most likely an outdated assembly loaded because of an invalid version in the metadata,
+ // so we invalidate the version in the metadata and unload the script domain.
+
+ if (core_api_assembly_out_of_sync) {
+ ERR_PRINT("The loaded Core API assembly is out of sync");
+ metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
+ } else if (!GDMonoUtils::mono_cache.godot_api_cache_updated) {
+ ERR_PRINT("The loaded Core API assembly is in sync, but the cache update failed");
+ metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
+ }
+
+ if (editor_api_assembly_out_of_sync) {
+ ERR_PRINT("The loaded Editor API assembly is out of sync");
+ metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
+ }
+
+ OS::get_singleton()->print("Mono: Proceeding to unload scripts domain because of invalid API assemblies\n");
+
+ Error err = _unload_scripts_domain();
+ if (err != OK) {
+ WARN_PRINT("Mono: Failed to unload scripts domain");
+ }
+#else
+ ERR_PRINT("The loaded API assembly is invalid");
+ CRASH_NOW();
+#endif
+ }
+ }
+#else
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n");
+#endif
mono_install_unhandled_exception_hook(gdmono_unhandled_exception_hook, NULL);
@@ -219,7 +288,11 @@ void GDMono::initialize() {
namespace GodotSharpBindings {
uint64_t get_core_api_hash();
+#ifdef TOOLS_ENABLED
uint64_t get_editor_api_hash();
+#endif // TOOLS_ENABLED
+uint32_t get_bindings_version();
+uint32_t get_cs_glue_version();
void register_generated_icalls();
} // namespace GodotSharpBindings
@@ -271,43 +344,84 @@ GDMonoAssembly **GDMono::get_loaded_assembly(const String &p_name) {
return assemblies[domain_id].getptr(p_name);
}
-bool GDMono::_load_assembly(const String &p_name, GDMonoAssembly **r_assembly) {
+bool GDMono::load_assembly(const String &p_name, GDMonoAssembly **r_assembly, bool p_refonly) {
+
+ CRASH_COND(!r_assembly);
+
+ MonoAssemblyName *aname = mono_assembly_name_new(p_name.utf8());
+ bool result = load_assembly(p_name, aname, r_assembly, p_refonly);
+ mono_assembly_name_free(aname);
+ mono_free(aname);
+
+ return result;
+}
+
+bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMonoAssembly **r_assembly, bool p_refonly) {
CRASH_COND(!r_assembly);
if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + "...\n").utf8());
+ OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...\n").utf8());
MonoImageOpenStatus status = MONO_IMAGE_OK;
- MonoAssemblyName *aname = mono_assembly_name_new(p_name.utf8());
- MonoAssembly *assembly = mono_assembly_load_full(aname, NULL, &status, false);
- mono_assembly_name_free(aname);
+ MonoAssembly *assembly = mono_assembly_load_full(p_aname, NULL, &status, p_refonly);
if (!assembly)
return false;
+ ERR_FAIL_COND_V(status != MONO_IMAGE_OK, false);
+
uint32_t domain_id = mono_domain_get_id(mono_domain_get());
GDMonoAssembly **stored_assembly = assemblies[domain_id].getptr(p_name);
- ERR_FAIL_COND_V(status != MONO_IMAGE_OK, false);
ERR_FAIL_COND_V(stored_assembly == NULL, false);
-
ERR_FAIL_COND_V((*stored_assembly)->get_assembly() != assembly, false);
+
*r_assembly = *stored_assembly;
if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print(String("Mono: Assembly " + p_name + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8());
+ OS::get_singleton()->print(String("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path() + "\n").utf8());
return true;
}
+APIAssembly::Version APIAssembly::Version::get_from_loaded_assembly(GDMonoAssembly *p_api_assembly, APIAssembly::Type p_api_type) {
+ APIAssembly::Version api_assembly_version;
+
+ const char *nativecalls_name = p_api_type == APIAssembly::API_CORE ?
+ BINDINGS_CLASS_NATIVECALLS :
+ BINDINGS_CLASS_NATIVECALLS_EDITOR;
+
+ GDMonoClass *nativecalls_klass = p_api_assembly->get_class(BINDINGS_NAMESPACE, nativecalls_name);
+
+ if (nativecalls_klass) {
+ GDMonoField *api_hash_field = nativecalls_klass->get_field("godot_api_hash");
+ if (api_hash_field)
+ api_assembly_version.godot_api_hash = GDMonoMarshal::unbox<uint64_t>(api_hash_field->get_value(NULL));
+
+ GDMonoField *binds_ver_field = nativecalls_klass->get_field("bindings_version");
+ if (binds_ver_field)
+ api_assembly_version.bindings_version = GDMonoMarshal::unbox<uint32_t>(binds_ver_field->get_value(NULL));
+
+ GDMonoField *cs_glue_ver_field = nativecalls_klass->get_field("cs_glue_version");
+ if (cs_glue_ver_field)
+ api_assembly_version.cs_glue_version = GDMonoMarshal::unbox<uint32_t>(cs_glue_ver_field->get_value(NULL));
+ }
+
+ return api_assembly_version;
+}
+
+String APIAssembly::to_string(APIAssembly::Type p_type) {
+ return p_type == APIAssembly::API_CORE ? "API_CORE" : "API_EDITOR";
+}
+
bool GDMono::_load_corlib_assembly() {
if (corlib_assembly)
return true;
- bool success = _load_assembly("mscorlib", &corlib_assembly);
+ bool success = load_assembly("mscorlib", &corlib_assembly);
if (success)
GDMonoUtils::update_corlib_cache();
@@ -317,13 +431,25 @@ bool GDMono::_load_corlib_assembly() {
bool GDMono::_load_core_api_assembly() {
- if (api_assembly)
+ if (core_api_assembly)
return true;
- bool success = _load_assembly(API_ASSEMBLY_NAME, &api_assembly);
+#ifdef TOOLS_ENABLED
+ if (metadata_is_api_assembly_invalidated(APIAssembly::API_CORE))
+ return false;
+#endif
- if (success)
+ bool success = load_assembly(API_ASSEMBLY_NAME, &core_api_assembly);
+
+ if (success) {
+#ifndef MONO_GLUE_DISABLED
+ APIAssembly::Version api_assembly_ver = APIAssembly::Version::get_from_loaded_assembly(core_api_assembly, APIAssembly::API_CORE);
+ core_api_assembly_out_of_sync = GodotSharpBindings::get_core_api_hash() != api_assembly_ver.godot_api_hash ||
+ GodotSharpBindings::get_bindings_version() != api_assembly_ver.bindings_version ||
+ GodotSharpBindings::get_cs_glue_version() != api_assembly_ver.cs_glue_version;
+#endif
GDMonoUtils::update_godot_api_cache();
+ }
return success;
}
@@ -334,7 +460,23 @@ bool GDMono::_load_editor_api_assembly() {
if (editor_api_assembly)
return true;
- return _load_assembly(EDITOR_API_ASSEMBLY_NAME, &editor_api_assembly);
+#ifdef TOOLS_ENABLED
+ if (metadata_is_api_assembly_invalidated(APIAssembly::API_EDITOR))
+ return false;
+#endif
+
+ bool success = load_assembly(EDITOR_API_ASSEMBLY_NAME, &editor_api_assembly);
+
+ if (success) {
+#ifndef MONO_GLUE_DISABLED
+ APIAssembly::Version api_assembly_ver = APIAssembly::Version::get_from_loaded_assembly(editor_api_assembly, APIAssembly::API_EDITOR);
+ editor_api_assembly_out_of_sync = GodotSharpBindings::get_editor_api_hash() != api_assembly_ver.godot_api_hash ||
+ GodotSharpBindings::get_bindings_version() != api_assembly_ver.bindings_version ||
+ GodotSharpBindings::get_cs_glue_version() != api_assembly_ver.cs_glue_version;
+#endif
+ }
+
+ return success;
}
#endif
@@ -346,7 +488,7 @@ bool GDMono::_load_editor_tools_assembly() {
_GDMONO_SCOPE_DOMAIN_(tools_domain)
- return _load_assembly(EDITOR_TOOLS_ASSEMBLY_NAME, &editor_tools_assembly);
+ return load_assembly(EDITOR_TOOLS_ASSEMBLY_NAME, &editor_tools_assembly);
}
#endif
@@ -360,17 +502,20 @@ bool GDMono::_load_project_assembly() {
name = "UnnamedProject";
}
- bool success = _load_assembly(name, &project_assembly);
+ bool success = load_assembly(name, &project_assembly);
- if (success)
+ if (success) {
mono_assembly_set_main(project_assembly->get_assembly());
+ } else {
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->printerr("Mono: Failed to load project assembly\n");
+ }
return success;
}
-bool GDMono::_load_all_script_assemblies() {
+bool GDMono::_load_api_assemblies() {
-#ifndef MONO_GLUE_DISABLED
if (!_load_core_api_assembly()) {
if (OS::get_singleton()->is_stdout_verbose())
OS::get_singleton()->printerr("Mono: Failed to load Core API assembly\n");
@@ -385,20 +530,72 @@ bool GDMono::_load_all_script_assemblies() {
#endif
}
- if (!_load_project_assembly()) {
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->printerr("Mono: Failed to load project assembly\n");
- return false;
+ return true;
+}
+
+#ifdef TOOLS_ENABLED
+String GDMono::_get_api_assembly_metadata_path() {
+
+ return GodotSharpDirs::get_res_metadata_dir().plus_file("api_assemblies.cfg");
+}
+
+void GDMono::metadata_set_api_assembly_invalidated(APIAssembly::Type p_api_type, bool p_invalidated) {
+
+ String section = APIAssembly::to_string(p_api_type);
+ String path = _get_api_assembly_metadata_path();
+
+ Ref<ConfigFile> metadata;
+ metadata.instance();
+ metadata->load(path);
+
+ metadata->set_value(section, "invalidated", p_invalidated);
+
+ String assembly_path = GodotSharpDirs::get_res_assemblies_dir()
+ .plus_file(p_api_type == APIAssembly::API_CORE ?
+ API_ASSEMBLY_NAME ".dll" :
+ EDITOR_API_ASSEMBLY_NAME ".dll");
+
+ ERR_FAIL_COND(!FileAccess::exists(assembly_path));
+
+ uint64_t modified_time = FileAccess::get_modified_time(assembly_path);
+
+ metadata->set_value(section, "invalidated_asm_modified_time", String::num_uint64(modified_time));
+
+ String dir = path.get_base_dir();
+ if (!DirAccess::exists(dir)) {
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ ERR_FAIL_COND(!da);
+ Error err = da->make_dir_recursive(ProjectSettings::get_singleton()->globalize_path(dir));
+ ERR_FAIL_COND(err != OK);
}
- return true;
-#else
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->print("Mono: Glue disbled, ignoring script assemblies\n");
+ Error save_err = metadata->save(path);
+ ERR_FAIL_COND(save_err != OK);
+}
- return true;
-#endif
+bool GDMono::metadata_is_api_assembly_invalidated(APIAssembly::Type p_api_type) {
+
+ String section = APIAssembly::to_string(p_api_type);
+
+ Ref<ConfigFile> metadata;
+ metadata.instance();
+ metadata->load(_get_api_assembly_metadata_path());
+
+ String assembly_path = GodotSharpDirs::get_res_assemblies_dir()
+ .plus_file(p_api_type == APIAssembly::API_CORE ?
+ API_ASSEMBLY_NAME ".dll" :
+ EDITOR_API_ASSEMBLY_NAME ".dll");
+
+ if (!FileAccess::exists(assembly_path))
+ return false;
+
+ uint64_t modified_time = FileAccess::get_modified_time(assembly_path);
+
+ uint64_t stored_modified_time = metadata->get_value(section, "invalidated_asm_modified_time", 0);
+
+ return metadata->get_value(section, "invalidated", false) && modified_time <= stored_modified_time;
}
+#endif
Error GDMono::_load_scripts_domain() {
@@ -441,12 +638,15 @@ Error GDMono::_unload_scripts_domain() {
_domain_assemblies_cleanup(mono_domain_get_id(scripts_domain));
- api_assembly = NULL;
+ core_api_assembly = NULL;
project_assembly = NULL;
#ifdef TOOLS_ENABLED
editor_api_assembly = NULL;
#endif
+ core_api_assembly_out_of_sync = false;
+ editor_api_assembly_out_of_sync = false;
+
MonoDomain *domain = scripts_domain;
scripts_domain = NULL;
@@ -501,16 +701,80 @@ Error GDMono::reload_scripts_domain() {
return err;
}
- if (!_load_all_script_assemblies()) {
- if (OS::get_singleton()->is_stdout_verbose())
- OS::get_singleton()->printerr("Mono: Failed to load script assemblies\n");
+#ifndef MONO_GLUE_DISABLED
+ if (!_load_api_assemblies()) {
return ERR_CANT_OPEN;
}
+ if (!core_api_assembly_out_of_sync && !editor_api_assembly_out_of_sync && GDMonoUtils::mono_cache.godot_api_cache_updated) {
+ // Everything is fine with the api assemblies, load the project assembly
+ _load_project_assembly();
+ } else {
+ // The assembly was successfuly loaded, but the full api could not be cached.
+ // This is most likely an outdated assembly loaded because of an invalid version in the metadata,
+ // so we invalidate the version in the metadata and unload the script domain.
+
+ if (core_api_assembly_out_of_sync) {
+ metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
+ } else if (!GDMonoUtils::mono_cache.godot_api_cache_updated) {
+ ERR_PRINT("Core API assembly is in sync, but the cache update failed");
+ metadata_set_api_assembly_invalidated(APIAssembly::API_CORE, true);
+ }
+
+ if (editor_api_assembly_out_of_sync) {
+ metadata_set_api_assembly_invalidated(APIAssembly::API_EDITOR, true);
+ }
+
+ Error err = _unload_scripts_domain();
+ if (err != OK) {
+ WARN_PRINT("Mono: Failed to unload scripts domain");
+ }
+
+ return ERR_CANT_RESOLVE;
+ }
+
+ if (!_load_project_assembly())
+ return ERR_CANT_OPEN;
+#else
+ if (OS::get_singleton()->is_stdout_verbose())
+ OS::get_singleton()->print("Mono: Glue disabled, ignoring script assemblies\n");
+#endif
+
return OK;
}
#endif
+Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {
+
+ CRASH_COND(p_domain == NULL);
+
+ String domain_name = mono_domain_get_friendly_name(p_domain);
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ OS::get_singleton()->print(String("Mono: Unloading domain `" + domain_name + "`...\n").utf8());
+ }
+
+ if (mono_domain_get() != root_domain)
+ mono_domain_set(root_domain, true);
+
+ mono_gc_collect(mono_gc_max_generation());
+ mono_domain_finalize(p_domain, 2000);
+ mono_gc_collect(mono_gc_max_generation());
+
+ _domain_assemblies_cleanup(mono_domain_get_id(p_domain));
+
+ MonoObject *ex = NULL;
+ mono_domain_try_unload(p_domain, &ex);
+
+ if (ex) {
+ ERR_PRINTS("Exception thrown when unloading domain `" + domain_name + "`:");
+ mono_print_unhandled_exception(ex);
+ return FAILED;
+ }
+
+ return OK;
+}
+
GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) {
MonoImage *image = mono_class_get_image(p_raw_class);
@@ -562,8 +826,11 @@ GDMono::GDMono() {
tools_domain = NULL;
#endif
+ core_api_assembly_out_of_sync = false;
+ editor_api_assembly_out_of_sync = false;
+
corlib_assembly = NULL;
- api_assembly = NULL;
+ core_api_assembly = NULL;
project_assembly = NULL;
#ifdef TOOLS_ENABLED
editor_api_assembly = NULL;
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
index 67251778c6..5e01152870 100644
--- a/modules/mono/mono_gd/gd_mono.h
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -31,6 +31,8 @@
#ifndef GD_MONO_H
#define GD_MONO_H
+#include "core/io/config_file.h"
+
#include "../godotsharp_defs.h"
#include "gd_mono_assembly.h"
#include "gd_mono_log.h"
@@ -39,6 +41,43 @@
#include "../utils/mono_reg_utils.h"
#endif
+namespace APIAssembly {
+enum Type {
+ API_CORE,
+ API_EDITOR
+};
+
+struct Version {
+ uint64_t godot_api_hash;
+ uint32_t bindings_version;
+ uint32_t cs_glue_version;
+
+ bool operator==(const Version &p_other) const {
+ return godot_api_hash == p_other.godot_api_hash &&
+ bindings_version == p_other.bindings_version &&
+ cs_glue_version == p_other.cs_glue_version;
+ }
+
+ Version() :
+ godot_api_hash(0),
+ bindings_version(0),
+ cs_glue_version(0) {
+ }
+
+ Version(uint64_t p_godot_api_hash,
+ uint32_t p_bindings_version,
+ uint32_t p_cs_glue_version) :
+ godot_api_hash(p_godot_api_hash),
+ bindings_version(p_bindings_version),
+ cs_glue_version(p_cs_glue_version) {
+ }
+
+ static Version get_from_loaded_assembly(GDMonoAssembly *p_api_assembly, Type p_api_type);
+};
+
+String to_string(Type p_type);
+} // namespace APIAssembly
+
#define SCRIPTS_DOMAIN GDMono::get_singleton()->get_scripts_domain()
#ifdef TOOLS_ENABLED
#define TOOLS_DOMAIN GDMono::get_singleton()->get_tools_domain()
@@ -55,8 +94,11 @@ class GDMono {
MonoDomain *tools_domain;
#endif
+ bool core_api_assembly_out_of_sync;
+ bool editor_api_assembly_out_of_sync;
+
GDMonoAssembly *corlib_assembly;
- GDMonoAssembly *api_assembly;
+ GDMonoAssembly *core_api_assembly;
GDMonoAssembly *project_assembly;
#ifdef TOOLS_ENABLED
GDMonoAssembly *editor_api_assembly;
@@ -75,7 +117,11 @@ class GDMono {
#endif
bool _load_project_assembly();
- bool _load_all_script_assemblies();
+ bool _load_api_assemblies();
+
+#ifdef TOOLS_ENABLED
+ String _get_api_assembly_metadata_path();
+#endif
void _register_internal_calls();
@@ -94,8 +140,6 @@ class GDMono {
void _initialize_and_check_api_hashes();
#endif
- bool _load_assembly(const String &p_name, GDMonoAssembly **r_assembly);
-
GDMonoLog *gdmono_log;
#ifdef WINDOWS_ENABLED
@@ -113,6 +157,11 @@ public:
#endif
#endif
+#ifdef TOOLS_ENABLED
+ void metadata_set_api_assembly_invalidated(APIAssembly::Type p_api_type, bool p_invalidated);
+ bool metadata_is_api_assembly_invalidated(APIAssembly::Type p_api_type);
+#endif
+
static GDMono *get_singleton() { return singleton; }
// Do not use these, unless you know what you're doing
@@ -128,7 +177,7 @@ public:
#endif
_FORCE_INLINE_ GDMonoAssembly *get_corlib_assembly() const { return corlib_assembly; }
- _FORCE_INLINE_ GDMonoAssembly *get_api_assembly() const { return api_assembly; }
+ _FORCE_INLINE_ GDMonoAssembly *get_core_api_assembly() const { return core_api_assembly; }
_FORCE_INLINE_ GDMonoAssembly *get_project_assembly() const { return project_assembly; }
#ifdef TOOLS_ENABLED
_FORCE_INLINE_ GDMonoAssembly *get_editor_api_assembly() const { return editor_api_assembly; }
@@ -145,6 +194,10 @@ public:
Error reload_scripts_domain();
#endif
+ bool load_assembly(const String &p_name, GDMonoAssembly **r_assembly, bool p_refonly = false);
+ bool load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMonoAssembly **r_assembly, bool p_refonly = false);
+ Error finalize_and_unload_domain(MonoDomain *p_domain);
+
void initialize();
GDMono();
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
index ef39b8549d..9d3bee2176 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.cpp
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -33,9 +33,10 @@
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/tokentype.h>
-#include "list.h"
-#include "os/file_access.h"
-#include "os/os.h"
+#include "core/list.h"
+#include "core/os/file_access.h"
+#include "core/os/os.h"
+#include "core/project_settings.h"
#include "../godotsharp_dirs.h"
#include "gd_mono_class.h"
@@ -43,7 +44,23 @@
bool GDMonoAssembly::no_search = false;
Vector<String> GDMonoAssembly::search_dirs;
-MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_data) {
+MonoAssembly *GDMonoAssembly::assembly_search_hook(MonoAssemblyName *aname, void *user_data) {
+ return GDMonoAssembly::_search_hook(aname, user_data, false);
+}
+
+MonoAssembly *GDMonoAssembly::assembly_refonly_search_hook(MonoAssemblyName *aname, void *user_data) {
+ return GDMonoAssembly::_search_hook(aname, user_data, true);
+}
+
+MonoAssembly *GDMonoAssembly::assembly_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data) {
+ return GDMonoAssembly::_preload_hook(aname, assemblies_path, user_data, false);
+}
+
+MonoAssembly *GDMonoAssembly::assembly_refonly_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data) {
+ return GDMonoAssembly::_preload_hook(aname, assemblies_path, user_data, true);
+}
+
+MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_data, bool refonly) {
(void)user_data; // UNUSED
@@ -60,7 +77,7 @@ MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_d
no_search = true; // Avoid the recursion madness
String path;
- MonoAssembly *res = NULL;
+ GDMonoAssembly *res = NULL;
for (int i = 0; i < search_dirs.size(); i++) {
const String &search_dir = search_dirs[i];
@@ -68,44 +85,49 @@ MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_d
if (has_extension) {
path = search_dir.plus_file(name);
if (FileAccess::exists(path)) {
- res = _load_assembly_from(name.get_basename(), path);
- break;
+ res = _load_assembly_from(name.get_basename(), path, refonly);
+ if (res != NULL)
+ break;
}
} else {
path = search_dir.plus_file(name + ".dll");
if (FileAccess::exists(path)) {
- res = _load_assembly_from(name, path);
- break;
+ res = _load_assembly_from(name, path, refonly);
+ if (res != NULL)
+ break;
}
path = search_dir.plus_file(name + ".exe");
if (FileAccess::exists(path)) {
- res = _load_assembly_from(name, path);
- break;
+ res = _load_assembly_from(name, path, refonly);
+ if (res != NULL)
+ break;
}
}
}
no_search = false;
- return res;
+ return res ? res->get_assembly() : NULL;
}
-MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data) {
+MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data, bool refonly) {
(void)user_data; // UNUSED
if (search_dirs.empty()) {
-#ifdef TOOLS_DOMAIN
search_dirs.push_back(GodotSharpDirs::get_res_temp_assemblies_dir());
-#endif
search_dirs.push_back(GodotSharpDirs::get_res_assemblies_dir());
search_dirs.push_back(OS::get_singleton()->get_resource_dir());
search_dirs.push_back(OS::get_singleton()->get_executable_path().get_base_dir());
+#ifdef GD_MONO_EDITOR_ASSEMBLIES_DIR
+ search_dirs.push_back(OS::get_singleton()->get_executable_path().get_base_dir().plus_file(_MKSTR(GD_MONO_EDITOR_ASSEMBLIES_DIR)).simplify_path());
+#endif
const char *rootdir = mono_assembly_getrootdir();
if (rootdir) {
search_dirs.push_back(String(rootdir).plus_file("mono").plus_file("4.5"));
+ search_dirs.push_back(String(rootdir).plus_file("mono").plus_file("4.5").plus_file("Facades"));
}
if (assemblies_path) {
@@ -121,10 +143,11 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse
if (has_extension ? name == "mscorlib.dll" : name == "mscorlib") {
GDMonoAssembly **stored_assembly = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name);
- if (stored_assembly) return (*stored_assembly)->get_assembly();
+ if (stored_assembly)
+ return (*stored_assembly)->get_assembly();
String path;
- MonoAssembly *res = NULL;
+ GDMonoAssembly *res = NULL;
for (int i = 0; i < search_dirs.size(); i++) {
const String &search_dir = search_dirs[i];
@@ -132,68 +155,73 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse
if (has_extension) {
path = search_dir.plus_file(name);
if (FileAccess::exists(path)) {
- res = _load_assembly_from(name.get_basename(), path);
- break;
+ res = _load_assembly_from(name.get_basename(), path, refonly);
+ if (res != NULL)
+ break;
}
} else {
path = search_dir.plus_file(name + ".dll");
if (FileAccess::exists(path)) {
- res = _load_assembly_from(name, path);
- break;
+ res = _load_assembly_from(name, path, refonly);
+ if (res != NULL)
+ break;
}
}
}
- if (res) return res;
+ return res ? res->get_assembly() : NULL;
}
return NULL;
}
-MonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path) {
+GDMonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path, bool p_refonly) {
GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path));
- MonoDomain *domain = mono_domain_get();
-
- Error err = assembly->load(domain);
+ Error err = assembly->load(p_refonly);
if (err != OK) {
memdelete(assembly);
ERR_FAIL_V(NULL);
}
+ MonoDomain *domain = mono_domain_get();
GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, assembly);
- return assembly->get_assembly();
+ return assembly;
}
void GDMonoAssembly::initialize() {
- // TODO refonly as well?
- mono_install_assembly_preload_hook(&GDMonoAssembly::_preload_hook, NULL);
- mono_install_assembly_search_hook(&GDMonoAssembly::_search_hook, NULL);
+ mono_install_assembly_search_hook(&assembly_search_hook, NULL);
+ mono_install_assembly_refonly_search_hook(&assembly_refonly_search_hook, NULL);
+ mono_install_assembly_preload_hook(&assembly_preload_hook, NULL);
+ mono_install_assembly_refonly_preload_hook(&assembly_refonly_preload_hook, NULL);
}
-Error GDMonoAssembly::load(MonoDomain *p_domain) {
+Error GDMonoAssembly::load(bool p_refonly) {
ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE);
+ refonly = p_refonly;
+
uint64_t last_modified_time = FileAccess::get_modified_time(path);
Vector<uint8_t> data = FileAccess::get_file_as_array(path);
ERR_FAIL_COND_V(data.empty(), ERR_FILE_CANT_READ);
- String image_filename(path);
+ String image_filename = ProjectSettings::get_singleton()->globalize_path(path);
- MonoImageOpenStatus status;
+ MonoImageOpenStatus status = MONO_IMAGE_OK;
image = mono_image_open_from_data_with_name(
(char *)&data[0], data.size(),
- true, &status, false,
+ true, &status, refonly,
image_filename.utf8().get_data());
- ERR_FAIL_COND_V(status != MONO_IMAGE_OK || image == NULL, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V(status != MONO_IMAGE_OK, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_NULL_V(image, ERR_FILE_CANT_OPEN);
#ifdef DEBUG_ENABLED
String pdb_path(path + ".pdb");
@@ -213,15 +241,10 @@ no_pdb:
#endif
- assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, false);
+ assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, refonly);
ERR_FAIL_COND_V(status != MONO_IMAGE_OK || assembly == NULL, ERR_FILE_CANT_OPEN);
- if (p_domain && mono_image_get_entry_point(image)) {
- // TODO should this be removed? do we want to call main? what other effects does this have?
- mono_jit_exec(p_domain, assembly, 0, NULL);
- }
-
loaded = true;
modified_time = last_modified_time;
@@ -373,12 +396,26 @@ GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class)
return match;
}
+GDMonoAssembly *GDMonoAssembly::load_from(const String &p_name, const String &p_path, bool p_refonly) {
+
+ GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(p_name);
+ if (loaded_asm)
+ return *loaded_asm;
+
+ no_search = true;
+ GDMonoAssembly *res = _load_assembly_from(p_name, p_path, p_refonly);
+ no_search = false;
+
+ return res;
+}
+
GDMonoAssembly::GDMonoAssembly(const String &p_name, const String &p_path) {
loaded = false;
gdobject_class_cache_updated = false;
name = p_name;
path = p_path;
+ refonly = false;
modified_time = 0;
assembly = NULL;
image = NULL;
diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h
index 8a5fa19626..5cf744a5a2 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.h
+++ b/modules/mono/mono_gd/gd_mono_assembly.h
@@ -71,6 +71,7 @@ class GDMonoAssembly {
MonoAssembly *assembly;
MonoImage *image;
+ bool refonly;
bool loaded;
String name;
@@ -90,19 +91,25 @@ class GDMonoAssembly {
static bool no_search;
static Vector<String> search_dirs;
- static MonoAssembly *_search_hook(MonoAssemblyName *aname, void *user_data);
- static MonoAssembly *_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
+ static MonoAssembly *assembly_search_hook(MonoAssemblyName *aname, void *user_data);
+ static MonoAssembly *assembly_refonly_search_hook(MonoAssemblyName *aname, void *user_data);
+ static MonoAssembly *assembly_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
+ static MonoAssembly *assembly_refonly_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
- static MonoAssembly *_load_assembly_from(const String &p_name, const String &p_path);
+ static MonoAssembly *_search_hook(MonoAssemblyName *aname, void *user_data, bool refonly);
+ static MonoAssembly *_preload_hook(MonoAssemblyName *aname, char **assemblies_path, void *user_data, bool refonly);
+
+ static GDMonoAssembly *_load_assembly_from(const String &p_name, const String &p_path, bool p_refonly);
friend class GDMono;
static void initialize();
public:
- Error load(MonoDomain *p_domain);
+ Error load(bool p_refonly);
Error wrapper_for_image(MonoImage *p_image);
void unload();
+ _FORCE_INLINE_ bool is_refonly() const { return refonly; }
_FORCE_INLINE_ bool is_loaded() const { return loaded; }
_FORCE_INLINE_ MonoImage *get_image() const { return image; }
_FORCE_INLINE_ MonoAssembly *get_assembly() const { return assembly; }
@@ -115,6 +122,8 @@ public:
GDMonoClass *get_object_derived_class(const StringName &p_class);
+ static GDMonoAssembly *load_from(const String &p_name, const String &p_path, bool p_refonly);
+
GDMonoAssembly(const String &p_name, const String &p_path = String());
~GDMonoAssembly();
};
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index aa1a8e39c7..c04fcca962 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -606,11 +606,14 @@ MonoArray *Array_to_mono_array(const Array &p_array) {
Array mono_array_to_Array(MonoArray *p_array) {
Array ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
MonoObject *elem = mono_array_get(p_array, MonoObject *, i);
- ret.push_back(mono_object_to_variant(elem));
+ ret[i] = mono_object_to_variant(elem);
}
return ret;
@@ -630,11 +633,13 @@ MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array) {
PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array) {
PoolIntArray ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
-
+ ret.resize(length);
for (int i = 0; i < length; i++) {
int32_t elem = mono_array_get(p_array, int32_t, i);
- ret.push_back(elem);
+ ret.set(i, elem);
}
return ret;
@@ -652,11 +657,14 @@ MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array) {
PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array) {
PoolByteArray ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
uint8_t elem = mono_array_get(p_array, uint8_t, i);
- ret.push_back(elem);
+ ret.set(i, elem);
}
return ret;
@@ -674,11 +682,14 @@ MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array) {
PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array) {
PoolRealArray ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
real_t elem = mono_array_get(p_array, real_t, i);
- ret.push_back(elem);
+ ret.set(i, elem);
}
return ret;
@@ -697,11 +708,14 @@ MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array) {
PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array) {
PoolStringArray ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
MonoString *elem = mono_array_get(p_array, MonoString *, i);
- ret.push_back(mono_string_to_godot(elem));
+ ret.set(i, mono_string_to_godot(elem));
}
return ret;
@@ -728,12 +742,15 @@ MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) {
PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array) {
PoolColorArray ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
real_t *raw_elem = (real_t *)mono_array_addr_with_size(p_array, sizeof(real_t) * 4, i);
MARSHALLED_IN(Color, raw_elem, elem);
- ret.push_back(elem);
+ ret.set(i, elem);
}
return ret;
@@ -758,12 +775,15 @@ MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) {
PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array) {
PoolVector2Array ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
real_t *raw_elem = (real_t *)mono_array_addr_with_size(p_array, sizeof(real_t) * 2, i);
MARSHALLED_IN(Vector2, raw_elem, elem);
- ret.push_back(elem);
+ ret.set(i, elem);
}
return ret;
@@ -789,12 +809,15 @@ MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) {
PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array) {
PoolVector3Array ret;
+ if (!p_array)
+ return ret;
int length = mono_array_length(p_array);
+ ret.resize(length);
for (int i = 0; i < length; i++) {
real_t *raw_elem = (real_t *)mono_array_addr_with_size(p_array, sizeof(real_t) * 3, i);
MARSHALLED_IN(Vector3, raw_elem, elem);
- ret.push_back(elem);
+ ret.set(i, elem);
}
return ret;
@@ -828,6 +851,9 @@ MonoObject *Dictionary_to_mono_object(const Dictionary &p_dict) {
Dictionary mono_object_to_Dictionary(MonoObject *p_dict) {
Dictionary ret;
+ if (!p_dict)
+ return ret;
+
GDMonoUtils::MarshalUtils_DictToArrays dict_to_arrays = CACHED_METHOD_THUNK(MarshalUtils, DictionaryToArrays);
MonoArray *keys = NULL;
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 8fd437223f..6572408ab5 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -195,9 +195,9 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
// Transform
#define MARSHALLED_OUT_Transform(m_in, m_out) real_t m_out[12] = { \
- m_in.basis[0].x, m_in.basis[1].x, m_in.basis[2].x, \
- m_in.basis[0].y, m_in.basis[1].y, m_in.basis[2].y, \
- m_in.basis[0].z, m_in.basis[1].z, m_in.basis[2].z, \
+ m_in.basis[0].x, m_in.basis[0].y, m_in.basis[0].z, \
+ m_in.basis[1].x, m_in.basis[1].y, m_in.basis[1].z, \
+ m_in.basis[2].x, m_in.basis[2].y, m_in.basis[2].z, \
m_in.origin.x, m_in.origin.y, m_in.origin.z \
};
#define MARSHALLED_IN_Transform(m_in, m_out) Transform m_out( \
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 42e307cf08..fbdbeaa3f7 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -120,6 +120,9 @@ void MonoCache::clear_members() {
class_SyncAttribute = NULL;
class_MasterAttribute = NULL;
class_SlaveAttribute = NULL;
+ class_RemoteSyncAttribute = NULL;
+ class_MasterSyncAttribute = NULL;
+ class_SlaveSyncAttribute = NULL;
class_GodotMethodAttribute = NULL;
field_GodotMethodAttribute_methodName = NULL;
@@ -143,7 +146,7 @@ void MonoCache::cleanup() {
godot_api_cache_updated = false;
}
-#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
+#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
void update_corlib_cache() {
@@ -208,6 +211,9 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(SyncAttribute, GODOT_API_CLASS(SyncAttribute));
CACHE_CLASS_AND_CHECK(MasterAttribute, GODOT_API_CLASS(MasterAttribute));
CACHE_CLASS_AND_CHECK(SlaveAttribute, GODOT_API_CLASS(SlaveAttribute));
+ CACHE_CLASS_AND_CHECK(RemoteSyncAttribute, GODOT_API_CLASS(RemoteSyncAttribute));
+ CACHE_CLASS_AND_CHECK(MasterSyncAttribute, GODOT_API_CLASS(MasterSyncAttribute));
+ CACHE_CLASS_AND_CHECK(SlaveSyncAttribute, GODOT_API_CLASS(SlaveSyncAttribute));
CACHE_CLASS_AND_CHECK(GodotMethodAttribute, GODOT_API_CLASS(GodotMethodAttribute));
CACHE_FIELD_AND_CHECK(GodotMethodAttribute, methodName, CACHED_CLASS(GodotMethodAttribute)->get_field("methodName"));
@@ -245,7 +251,7 @@ void update_godot_api_cache() {
mono_runtime_object_init(task_scheduler);
mono_cache.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
- mono_cache.corlib_cache_updated = true;
+ mono_cache.godot_api_cache_updated = true;
}
void clear_cache() {
@@ -305,7 +311,7 @@ GDMonoClass *type_get_proxy_class(const StringName &p_type) {
if (class_name[0] == '_')
class_name = class_name.substr(1, class_name.length());
- GDMonoClass *klass = GDMono::get_singleton()->get_api_assembly()->get_class(BINDINGS_NAMESPACE, class_name);
+ GDMonoClass *klass = GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, class_name);
#ifdef TOOLS_ENABLED
if (!klass) {
@@ -321,7 +327,7 @@ GDMonoClass *get_class_native_base(GDMonoClass *p_class) {
do {
const GDMonoAssembly *assembly = klass->get_assembly();
- if (assembly == GDMono::get_singleton()->get_api_assembly())
+ if (assembly == GDMono::get_singleton()->get_core_api_assembly())
return klass;
#ifdef TOOLS_ENABLED
if (assembly == GDMono::get_singleton()->get_editor_api_assembly())
@@ -420,37 +426,56 @@ void print_unhandled_exception(MonoObject *p_exc, bool p_recursion_caution) {
if (!ScriptDebugger::get_singleton())
return;
- GDMonoClass *st_klass = CACHED_CLASS(System_Diagnostics_StackTrace);
- MonoObject *stack_trace = mono_object_new(mono_domain_get(), st_klass->get_mono_ptr());
+ ScriptLanguage::StackInfo separator;
+ separator.file = "";
+ separator.func = "--- " + RTR("End of inner exception stack trace") + " ---";
+ separator.line = 0;
+
+ Vector<ScriptLanguage::StackInfo> si;
+ String exc_msg = "";
+
+ while (p_exc != NULL) {
+ GDMonoClass *st_klass = CACHED_CLASS(System_Diagnostics_StackTrace);
+ MonoObject *stack_trace = mono_object_new(mono_domain_get(), st_klass->get_mono_ptr());
- MonoBoolean need_file_info = true;
- void *ctor_args[2] = { p_exc, &need_file_info };
+ MonoBoolean need_file_info = true;
+ void *ctor_args[2] = { p_exc, &need_file_info };
- MonoObject *unexpected_exc = NULL;
- CACHED_METHOD(System_Diagnostics_StackTrace, ctor_Exception_bool)->invoke_raw(stack_trace, ctor_args, &unexpected_exc);
+ MonoObject *unexpected_exc = NULL;
+ CACHED_METHOD(System_Diagnostics_StackTrace, ctor_Exception_bool)->invoke_raw(stack_trace, ctor_args, &unexpected_exc);
- if (unexpected_exc != NULL) {
- mono_print_unhandled_exception(unexpected_exc);
+ if (unexpected_exc != NULL) {
+ mono_print_unhandled_exception(unexpected_exc);
- if (p_recursion_caution) {
- // Called from CSharpLanguage::get_current_stack_info,
- // so printing an error here could result in endless recursion
- OS::get_singleton()->printerr("Mono: Method GDMonoUtils::print_unhandled_exception failed");
- return;
- } else {
- ERR_FAIL();
+ if (p_recursion_caution) {
+ // Called from CSharpLanguage::get_current_stack_info,
+ // so printing an error here could result in endless recursion
+ OS::get_singleton()->printerr("Mono: Method GDMonoUtils::print_unhandled_exception failed");
+ return;
+ } else {
+ ERR_FAIL();
+ }
}
- }
- Vector<ScriptLanguage::StackInfo> si;
- if (stack_trace != NULL && !p_recursion_caution)
- si = CSharpLanguage::get_singleton()->stack_trace_get_info(stack_trace);
+ Vector<ScriptLanguage::StackInfo> _si;
+ if (stack_trace != NULL && !p_recursion_caution) {
+ _si = CSharpLanguage::get_singleton()->stack_trace_get_info(stack_trace);
+ for (int i = _si.size() - 1; i >= 0; i--)
+ si.insert(0, _si[i]);
+ }
+
+ exc_msg += (exc_msg.length() > 0 ? " ---> " : "") + GDMonoUtils::get_exception_name_and_message(p_exc);
+
+ GDMonoProperty *p_prop = GDMono::get_singleton()->get_class(mono_object_get_class(p_exc))->get_property("InnerException");
+ p_exc = p_prop != NULL ? p_prop->get_value(p_exc) : NULL;
+ if (p_exc != NULL)
+ si.insert(0, separator);
+ }
String file = si.size() ? si[0].file : __FILE__;
String func = si.size() ? si[0].func : FUNCTION_STR;
int line = si.size() ? si[0].line : __LINE__;
String error_msg = "Unhandled exception";
- String exc_msg = GDMonoUtils::get_exception_name_and_message(p_exc);
ScriptDebugger::get_singleton()->send_error(func, file, line, error_msg, exc_msg, ERR_HANDLER_ERROR, si);
#endif
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 1a34180d15..fc13a00e85 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -112,6 +112,9 @@ struct MonoCache {
GDMonoClass *class_ToolAttribute;
GDMonoClass *class_RemoteAttribute;
GDMonoClass *class_SyncAttribute;
+ GDMonoClass *class_RemoteSyncAttribute;
+ GDMonoClass *class_MasterSyncAttribute;
+ GDMonoClass *class_SlaveSyncAttribute;
GDMonoClass *class_MasterAttribute;
GDMonoClass *class_SlaveAttribute;
GDMonoClass *class_GodotMethodAttribute;
diff --git a/modules/mono/mono_reg_utils.py b/modules/mono/mono_reg_utils.py
index 8ddddb3a24..c8ebb54ded 100644
--- a/modules/mono/mono_reg_utils.py
+++ b/modules/mono/mono_reg_utils.py
@@ -60,10 +60,10 @@ def _find_mono_in_reg_old(subkey, bits):
def find_mono_root_dir(bits):
root_dir = _find_mono_in_reg(r'SOFTWARE\Mono', bits)
if root_dir is not None:
- return root_dir
+ return str(root_dir)
root_dir = _find_mono_in_reg_old(r'SOFTWARE\Novell\Mono', bits)
if root_dir is not None:
- return root_dir
+ return str(root_dir)
return ''
@@ -75,7 +75,7 @@ def find_msbuild_tools_path_reg():
vswhere = os.getenv('PROGRAMFILES')
vswhere += r'\Microsoft Visual Studio\Installer\vswhere.exe'
- vswhere_args = ['-latest', '-requires', 'Microsoft.Component.MSBuild']
+ vswhere_args = ['-latest', '-products', '*', '-requires', 'Microsoft.Component.MSBuild']
try:
lines = subprocess.check_output([vswhere] + vswhere_args).splitlines()
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
index 9bb8da8ac0..7b23cd7579 100644
--- a/modules/mono/utils/mono_reg_utils.cpp
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -174,6 +174,8 @@ String find_msbuild_tools_path() {
List<String> vswhere_args;
vswhere_args.push_back("-latest");
+ vswhere_args.push_back("-products");
+ vswhere_args.push_back("*");
vswhere_args.push_back("-requires");
vswhere_args.push_back("Microsoft.Component.MSBuild");
diff --git a/modules/ogg/config.py b/modules/ogg/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/ogg/config.py
+++ b/modules/ogg/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/opus/config.py b/modules/opus/config.py
index 60f8d838d6..a1cde10ea0 100644
--- a/modules/opus/config.py
+++ b/modules/opus/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/pvr/config.py b/modules/pvr/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/pvr/config.py
+++ b/modules/pvr/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 76c0b969d8..8174bccdb7 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -536,8 +536,8 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
int p_x, p_y;
- int p_modulation[8][16];
- int p_modulation_modes[8][16];
+ int p_modulation[8][16] = { { 0 } };
+ int p_modulation_modes[8][16] = { { 0 } };
int Mod, DoPT;
diff --git a/modules/recast/SCsub b/modules/recast/SCsub
index 530df9a37c..f56be72b24 100644
--- a/modules/recast/SCsub
+++ b/modules/recast/SCsub
@@ -1,8 +1,9 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-# Not building in a separate env as core needs it
+env_recast = env_modules.Clone()
# Thirdparty source files
if env['builtin_recast']:
@@ -22,13 +23,10 @@ if env['builtin_recast']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"])
-
- lib = env.add_library("recast_builtin", thirdparty_sources)
- env.Append(LIBS=[lib])
+ env_recast.add_source_files(env.modules_sources, thirdparty_sources)
+ env_recast.Append(CPPPATH=[thirdparty_dir + "/Include"])
# Godot source files
-env.add_source_files(env.modules_sources, "*.cpp")
-env.Append(CCFLAGS=['-DRECAST_ENABLED'])
+env_recast.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/recast/config.py b/modules/recast/config.py
index fc074cf661..098f1eafa9 100644
--- a/modules/recast/config.py
+++ b/modules/recast/config.py
@@ -1,5 +1,5 @@
-def can_build(platform):
- return platform != "android"
+def can_build(env, platform):
+ return env['tools']
def configure(env):
pass
diff --git a/editor/plugins/navigation_mesh_editor_plugin.cpp b/modules/recast/navigation_mesh_editor_plugin.cpp
index da3c744324..8556b7aa0a 100644
--- a/editor/plugins/navigation_mesh_editor_plugin.cpp
+++ b/modules/recast/navigation_mesh_editor_plugin.cpp
@@ -29,13 +29,12 @@
/*************************************************************************/
#include "navigation_mesh_editor_plugin.h"
+
#include "io/marshalls.h"
#include "io/resource_saver.h"
#include "scene/3d/mesh_instance.h"
#include "scene/gui/box_container.h"
-#ifdef RECAST_ENABLED
-
void NavigationMeshEditor::_node_removed(Node *p_node) {
if (p_node == node) {
@@ -162,5 +161,3 @@ NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) {
NavigationMeshEditorPlugin::~NavigationMeshEditorPlugin() {
}
-
-#endif // RECAST_ENABLED
diff --git a/editor/plugins/navigation_mesh_editor_plugin.h b/modules/recast/navigation_mesh_editor_plugin.h
index 9382467d85..4f3e222002 100644
--- a/editor/plugins/navigation_mesh_editor_plugin.h
+++ b/modules/recast/navigation_mesh_editor_plugin.h
@@ -31,8 +31,6 @@
#ifndef NAVIGATION_MESH_GENERATOR_PLUGIN_H
#define NAVIGATION_MESH_GENERATOR_PLUGIN_H
-#ifdef RECAST_ENABLED
-
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "navigation_mesh_generator.h"
@@ -83,5 +81,4 @@ public:
~NavigationMeshEditorPlugin();
};
-#endif // RECAST_ENABLED
#endif // NAVIGATION_MESH_GENERATOR_PLUGIN_H
diff --git a/editor/plugins/navigation_mesh_generator.cpp b/modules/recast/navigation_mesh_generator.cpp
index 5d4e5520f4..64c4b85269 100644
--- a/editor/plugins/navigation_mesh_generator.cpp
+++ b/modules/recast/navigation_mesh_generator.cpp
@@ -30,8 +30,6 @@
#include "navigation_mesh_generator.h"
-#ifdef RECAST_ENABLED
-
void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) {
p_verticies.push_back(p_vec3.x);
p_verticies.push_back(p_vec3.y);
@@ -280,26 +278,20 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
_build_recast_navigation_mesh(p_nav_mesh, &ep, hf, chf, cset, poly_mesh, detail_mesh, vertices, indices);
- if (hf) {
- rcFreeHeightField(hf);
- hf = 0;
- }
- if (chf) {
- rcFreeCompactHeightfield(chf);
- chf = 0;
- }
- if (cset) {
- rcFreeContourSet(cset);
- cset = 0;
- }
- if (poly_mesh) {
- rcFreePolyMesh(poly_mesh);
- poly_mesh = 0;
- }
- if (detail_mesh) {
- rcFreePolyMeshDetail(detail_mesh);
- detail_mesh = 0;
- }
+ rcFreeHeightField(hf);
+ hf = 0;
+
+ rcFreeCompactHeightfield(chf);
+ chf = 0;
+
+ rcFreeContourSet(cset);
+ cset = 0;
+
+ rcFreePolyMesh(poly_mesh);
+ poly_mesh = 0;
+
+ rcFreePolyMeshDetail(detail_mesh);
+ detail_mesh = 0;
}
ep.step(TTR("Done!"), 11);
}
@@ -310,5 +302,3 @@ void NavigationMeshGenerator::clear(Ref<NavigationMesh> p_nav_mesh) {
p_nav_mesh->set_vertices(PoolVector<Vector3>());
}
}
-
-#endif //RECAST_ENABLED
diff --git a/editor/plugins/navigation_mesh_generator.h b/modules/recast/navigation_mesh_generator.h
index d26f541b8d..3588539ef1 100644
--- a/editor/plugins/navigation_mesh_generator.h
+++ b/modules/recast/navigation_mesh_generator.h
@@ -31,16 +31,11 @@
#ifndef NAVIGATION_MESH_GENERATOR_H
#define NAVIGATION_MESH_GENERATOR_H
-#ifdef RECAST_ENABLED
-
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
-
+#include "os/thread.h"
#include "scene/3d/mesh_instance.h"
-
#include "scene/3d/navigation_mesh.h"
-
-#include "os/thread.h"
#include "scene/resources/shape.h"
#include <Recast.h>
@@ -61,6 +56,4 @@ public:
static void clear(Ref<NavigationMesh> p_nav_mesh);
};
-#endif // RECAST_ENABLED
-
#endif // NAVIGATION_MESH_GENERATOR_H
diff --git a/modules/recast/register_types.cpp b/modules/recast/register_types.cpp
index 913857c591..f2f18fc86f 100644
--- a/modules/recast/register_types.cpp
+++ b/modules/recast/register_types.cpp
@@ -30,5 +30,10 @@
#include "register_types.h"
-void register_recast_types() {}
+#include "navigation_mesh_editor_plugin.h"
+
+void register_recast_types() {
+ EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
+}
+
void unregister_recast_types() {}
diff --git a/modules/regex/SCsub b/modules/regex/SCsub
index 18b4051afe..4b8d5e9283 100644
--- a/modules/regex/SCsub
+++ b/modules/regex/SCsub
@@ -19,10 +19,13 @@ if env['builtin_pcre2']:
"pcre2_compile.c",
"pcre2_config.c",
"pcre2_context.c",
+ "pcre2_convert.c",
"pcre2_dfa_match.c",
"pcre2_error.c",
+ "pcre2_extuni.c",
"pcre2_find_bracket.c",
"pcre2_jit_compile.c",
+ #"pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c.
"pcre2_maketables.c",
"pcre2_match.c",
"pcre2_match_data.c",
diff --git a/modules/regex/config.py b/modules/regex/config.py
index cb2da26738..42cfe3b43c 100644
--- a/modules/regex/config.py
+++ b/modules/regex/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml
index 26f0501df3..75e8903ff8 100644
--- a/modules/regex/doc_classes/RegEx.xml
+++ b/modules/regex/doc_classes/RegEx.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RegEx" inherits="Reference" category="Core" version="3.1-dev">
+<class name="RegEx" inherits="Reference" category="Core" version="3.1">
<brief_description>
Class for searching text for patterns using regular expressions.
</brief_description>
diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml
index 550411d3e0..3d070d2786 100644
--- a/modules/regex/doc_classes/RegExMatch.xml
+++ b/modules/regex/doc_classes/RegExMatch.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RegExMatch" inherits="Reference" category="Core" version="3.1-dev">
+<class name="RegExMatch" inherits="Reference" category="Core" version="3.1">
<brief_description>
Contains the results of a regex search.
</brief_description>
diff --git a/modules/squish/config.py b/modules/squish/config.py
index 97c95999c8..098f1eafa9 100644
--- a/modules/squish/config.py
+++ b/modules/squish/config.py
@@ -1,9 +1,5 @@
-def can_build(platform):
- return True
+def can_build(env, platform):
+ return env['tools']
def configure(env):
- # Tools only, disabled for non-tools
- # TODO: Find a cleaner way to achieve that
- if not env['tools']:
- env['module_squish_enabled'] = False
- env.disabled_modules.append("squish")
+ pass
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index 18ab616826..c95a8ac2dd 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -263,8 +263,8 @@ float AudioStreamOGGVorbis::get_length() const {
void AudioStreamOGGVorbis::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_set_data", "data"), &AudioStreamOGGVorbis::set_data);
- ClassDB::bind_method(D_METHOD("_get_data"), &AudioStreamOGGVorbis::get_data);
+ ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamOGGVorbis::set_data);
+ ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamOGGVorbis::get_data);
ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOGGVorbis::set_loop);
ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOGGVorbis::has_loop);
@@ -272,7 +272,7 @@ void AudioStreamOGGVorbis::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset);
ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset);
- ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop", "has_loop");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop_offset", "get_loop_offset");
}
diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py
index defe8d0c94..d75e41797a 100644
--- a/modules/stb_vorbis/config.py
+++ b/modules/stb_vorbis/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
index 8d311ae1b8..e2281babf7 100644
--- a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
+++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.1-dev">
+<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.1">
<brief_description>
OGG Vorbis audio stream driver.
</brief_description>
@@ -13,6 +13,9 @@
<methods>
</methods>
<members>
+ <member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
+ Contains the audio data in bytes.
+ </member>
<member name="loop" type="bool" setter="set_loop" getter="has_loop">
</member>
<member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset">
diff --git a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
index 5872dd35ff..018f4734ec 100644
--- a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
+++ b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.1-dev">
+<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
index 16ebfa2832..c8acdb689a 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
@@ -100,6 +100,7 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
ogg_stream.instance();
ogg_stream->set_data(data);
+ ERR_FAIL_COND_V(!ogg_stream->get_data().size(), ERR_FILE_CORRUPT);
ogg_stream->set_loop(loop);
ogg_stream->set_loop_offset(loop_offset);
diff --git a/modules/svg/SCsub b/modules/svg/SCsub
index e12abac8c1..a41e0703bd 100644
--- a/modules/svg/SCsub
+++ b/modules/svg/SCsub
@@ -1,7 +1,6 @@
#!/usr/bin/env python
Import('env')
-from compat import isbasestring
# Thirdparty source files
thirdparty_dir = "#thirdparty/nanosvg/"
@@ -10,23 +9,7 @@ thirdparty_sources = [
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-# env.add_source_files(env.modules_sources, thirdparty_sources)
-
-lib = env.add_library("svg_builtin", thirdparty_sources)
-
-# Needs to be appended to arrive after libscene in the linker call,
-# but we don't want it to arrive *after* system libs, so manual hack
-# LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
-# and then plain strings for system library. We insert between the two.
-inserted = False
-for idx, linklib in enumerate(env["LIBS"]):
- if isbasestring(linklib): # first system lib such as "X11", otherwise SCons lib object
- env["LIBS"].insert(idx, lib)
- inserted = True
- break
-if not inserted:
- env.Append(LIBS=[lib])
-
+env.add_source_files(env.modules_sources, thirdparty_sources)
env.Append(CPPPATH=[thirdparty_dir])
env.Append(CCFLAGS=["-DSVG_ENABLED"])
diff --git a/modules/svg/config.py b/modules/svg/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/svg/config.py
+++ b/modules/svg/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/tga/config.py b/modules/tga/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/tga/config.py
+++ b/modules/tga/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/thekla_unwrap/config.py b/modules/thekla_unwrap/config.py
index b1ce7d4b91..bd092bdc16 100644
--- a/modules/thekla_unwrap/config.py
+++ b/modules/thekla_unwrap/config.py
@@ -1,7 +1,5 @@
-def can_build(platform):
- return platform != "android" and platform != "ios"
+def can_build(env, platform):
+ return (env['tools'] and platform not in ["android", "ios"])
def configure(env):
- if not env['tools']:
- env['builtin_thekla_atlas'] = False
- env.disabled_modules.append("thekla_unwrap")
+ pass
diff --git a/modules/theora/config.py b/modules/theora/config.py
index 34d34f8be2..7504166237 100644
--- a/modules/theora/config.py
+++ b/modules/theora/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/theora/doc_classes/ResourceImporterTheora.xml b/modules/theora/doc_classes/ResourceImporterTheora.xml
index 6d2de4a9ad..5fc40a6eba 100644
--- a/modules/theora/doc_classes/ResourceImporterTheora.xml
+++ b/modules/theora/doc_classes/ResourceImporterTheora.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterTheora" inherits="ResourceImporter" category="Core" version="3.1-dev">
+<class name="ResourceImporterTheora" inherits="ResourceImporter" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml
index 550844128d..e7c4727332 100644
--- a/modules/theora/doc_classes/VideoStreamTheora.xml
+++ b/modules/theora/doc_classes/VideoStreamTheora.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoStreamTheora" inherits="VideoStream" category="Core" version="3.1-dev">
+<class name="VideoStreamTheora" inherits="VideoStream" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 58c6d73ab2..9e6307c0bf 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -261,14 +261,12 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
/* look for further theora headers */
while (theora_p && (theora_p < 3) && (ret = ogg_stream_packetout(&to, &op))) {
if (ret < 0) {
- fprintf(stderr, "Error parsing Theora stream headers; "
- "corrupt stream?\n");
+ fprintf(stderr, "Error parsing Theora stream headers; corrupt stream?\n");
clear();
return;
}
if (!th_decode_headerin(&ti, &tc, &ts, &op)) {
- fprintf(stderr, "Error parsing Theora stream headers; "
- "corrupt stream?\n");
+ fprintf(stderr, "Error parsing Theora stream headers; corrupt stream?\n");
clear();
return;
}
@@ -312,9 +310,15 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
td = th_decode_alloc(&ti, ts);
px_fmt = ti.pixel_fmt;
switch (ti.pixel_fmt) {
- case TH_PF_420: printf(" 4:2:0 video\n"); break;
- case TH_PF_422: printf(" 4:2:2 video\n"); break;
- case TH_PF_444: printf(" 4:4:4 video\n"); break;
+ case TH_PF_420:
+ //printf(" 4:2:0 video\n");
+ break;
+ case TH_PF_422:
+ //printf(" 4:2:2 video\n");
+ break;
+ case TH_PF_444:
+ //printf(" 4:4:4 video\n");
+ break;
case TH_PF_RSVD:
default:
printf(" video\n (UNKNOWN Chroma sampling!)\n");
@@ -519,7 +523,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
#else
if (file && /*!videobuf_ready && */ no_theora && theora_eos) {
#endif
- printf("video done, stopping\n");
+ //printf("video done, stopping\n");
stop();
return;
};
diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py
index e12bb398ce..098f1eafa9 100644
--- a/modules/tinyexr/config.py
+++ b/modules/tinyexr/config.py
@@ -1,9 +1,5 @@
-def can_build(platform):
- return True
+def can_build(env, platform):
+ return env['tools']
def configure(env):
- # Tools only, disabled for non-tools
- # TODO: Find a cleaner way to achieve that
- if not env['tools']:
- env['module_tinyexr_enabled'] = False
- env.disabled_modules.append("tinyexr")
+ pass
diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub
new file mode 100644
index 0000000000..cde231867f
--- /dev/null
+++ b/modules/upnp/SCsub
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_upnp = env_modules.Clone()
+
+# Thirdparty source files
+
+if env['builtin_miniupnpc']:
+ thirdparty_dir = "#thirdparty/miniupnpc/"
+ thirdparty_sources = [
+ "miniupnpc.c",
+ "upnpcommands.c",
+ "miniwget.c",
+ "upnpdev.c",
+ "igd_desc_parse.c",
+ "minissdpc.c",
+ "minisoap.c",
+ "minixml.c",
+ "connecthostport.c",
+ "receivedata.c",
+ "portlistingparse.c",
+ "upnpreplyparse.c",
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_upnp.add_source_files(env.modules_sources, thirdparty_sources)
+ env_upnp.Append(CPPPATH=[thirdparty_dir])
+ env_upnp.Append(CPPFLAGS=["-DMINIUPNP_STATICLIB"])
+
+env_upnp.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/upnp/config.py b/modules/upnp/config.py
new file mode 100644
index 0000000000..8724ff1a51
--- /dev/null
+++ b/modules/upnp/config.py
@@ -0,0 +1,14 @@
+def can_build(env, platform):
+ return True
+
+def configure(env):
+ pass
+
+def get_doc_classes():
+ return [
+ "UPNP",
+ "UPNPDevice"
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml
new file mode 100644
index 0000000000..30be9c836b
--- /dev/null
+++ b/modules/upnp/doc_classes/UPNP.xml
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="UPNP" inherits="Reference" category="Core" version="3.1">
+ <brief_description>
+ UPNP network functions.
+ </brief_description>
+ <description>
+ Provides UPNP functionality to discover [UPNPDevice]s on the local network and execute commands on them, like managing port mappings (port forwarding) and querying the local and remote network IP address. Note that methods on this class are synchronous and block the calling thread.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="add_device">
+ <return type="void">
+ </return>
+ <argument index="0" name="device" type="UPNPDevice">
+ </argument>
+ <description>
+ Adds the given [UPNPDevice] to the list of discovered devices.
+ </description>
+ </method>
+ <method name="add_port_mapping" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="port" type="int">
+ </argument>
+ <argument index="1" name="port_internal" type="int" default="0">
+ </argument>
+ <argument index="2" name="desc" type="String" default="&quot;&quot;">
+ </argument>
+ <argument index="3" name="proto" type="String" default="&quot;UDP&quot;">
+ </argument>
+ <argument index="4" name="duration" type="int" default="0">
+ </argument>
+ <description>
+ Adds a mapping to forward the external [code]port[/code] (between 1 and 65535) on the default gateway (see [method get_gateway]) to the [code]internal_port[/code] on the local machine for the given protocol [code]proto[/code] (either [code]TCP[/code] or [code]UDP[/code], with UDP being the default). If a port mapping for the given port and protocol combination already exists on that gateway device, this method tries to overwrite it. If that is not desired, you can retrieve the gateway manually with [method get_gateway] and call [method add_port_mapping] on it, if any.
+ If [code]internal_port[/code] is [code]0[/code] (the default), the same port number is used for both the external and the internal port (the [code]port[/code] value).
+ The description ([code]desc[/code]) is shown in some router UIs and can be used to point out which application added the mapping, and the lifetime of the mapping can be limited by [code]duration[/code]. However, some routers are incompatible with one or both of these, so use with caution and add fallback logic in case of errors to retry without them if in doubt.
+ See [enum UPNPResult] for possible return values.
+ </description>
+ </method>
+ <method name="clear_devices">
+ <return type="void">
+ </return>
+ <description>
+ Clears the list of discovered devices.
+ </description>
+ </method>
+ <method name="delete_port_mapping" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="port" type="int">
+ </argument>
+ <argument index="1" name="proto" type="String" default="&quot;UDP&quot;">
+ </argument>
+ <description>
+ Deletes the port mapping for the given port and protocol combination on the default gateway (see [method get_gateway]) if one exists. [code]port[/code] must be a valid port between 1 and 65535, [code]proto[/code] can be either [code]TCP[/code] or [code]UDP[/code]. See [enum UPNPResult] for possible return values.
+ </description>
+ </method>
+ <method name="discover">
+ <return type="int">
+ </return>
+ <argument index="0" name="timeout" type="int" default="2000">
+ </argument>
+ <argument index="1" name="ttl" type="int" default="2">
+ </argument>
+ <argument index="2" name="device_filter" type="String" default="&quot;InternetGatewayDevice&quot;">
+ </argument>
+ <description>
+ Discovers local [UPNPDevice]s. Clears the list of previously discovered devices.
+ Filters for IGD (InternetGatewayDevice) type devices by default, as those manage port forwarding. [code]timeout[/code] is the time to wait for responses in miliseconds. [code]ttl[/code] is the time-to-live; only touch this if you know what you're doing.
+ See [enum UPNPResult] for possible return values.
+ </description>
+ </method>
+ <method name="get_device" qualifiers="const">
+ <return type="UPNPDevice">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ Returns the [UPNPDevice] at the given [code]index[/code].
+ </description>
+ </method>
+ <method name="get_device_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the number of discovered [UPNPDevice]s.
+ </description>
+ </method>
+ <method name="get_gateway" qualifiers="const">
+ <return type="UPNPDevice">
+ </return>
+ <description>
+ Returns the default gateway. That is the first discovered [UPNPDevice] that is also a valid IGD (InternetGatewayDevice).
+ </description>
+ </method>
+ <method name="query_external_address" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the external [IP] address of the default gateway (see [method get_gateway]) as string. Returns an empty string on error.
+ </description>
+ </method>
+ <method name="remove_device">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ Removes the device at [code]index[/code] from the list of discovered devices.
+ </description>
+ </method>
+ <method name="set_device">
+ <return type="void">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <argument index="1" name="device" type="UPNPDevice">
+ </argument>
+ <description>
+ Sets the device at [code]index[/code] from the list of discovered devices to [code]device[/code].
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="discover_ipv6" type="bool" setter="set_discover_ipv6" getter="is_discover_ipv6">
+ If [code]true[/code], IPv6 is used for [UPNPDevice] discovery.
+ </member>
+ <member name="discover_local_port" type="int" setter="set_discover_local_port" getter="get_discover_local_port">
+ If [code]0[/code], the local port to use for discovery is chosen automatically by the system. If [code]1[/code], discovery will be done from the source port 1900 (same as destination port). Otherwise, the value will be used as the port.
+ </member>
+ <member name="discover_multicast_if" type="String" setter="set_discover_multicast_if" getter="get_discover_multicast_if">
+ Multicast interface to use for discovery. Uses the default multicast interface if empty.
+ </member>
+ </members>
+ <constants>
+ <constant name="UPNP_RESULT_SUCCESS" value="0" enum="UPNPResult">
+ UPNP command or discovery was successful.
+ </constant>
+ <constant name="UPNP_RESULT_NOT_AUTHORIZED" value="1" enum="UPNPResult">
+ Not authorized to use the command on the [UPNPDevice]. May be returned when the user disabled UPNP on their router.
+ </constant>
+ <constant name="UPNP_RESULT_PORT_MAPPING_NOT_FOUND" value="2" enum="UPNPResult">
+ No port mapping was found for the given port, protocol combination on the given [UPNPDevice].
+ </constant>
+ <constant name="UPNP_RESULT_INCONSISTENT_PARAMETERS" value="3" enum="UPNPResult">
+ Inconsistent parameters.
+ </constant>
+ <constant name="UPNP_RESULT_NO_SUCH_ENTRY_IN_ARRAY" value="4" enum="UPNPResult">
+ No such entry in array. May be returned if a given port, protocol combination is not found on an [UPNPDevice].
+ </constant>
+ <constant name="UPNP_RESULT_ACTION_FAILED" value="5" enum="UPNPResult">
+ The action failed.
+ </constant>
+ <constant name="UPNP_RESULT_SRC_IP_WILDCARD_NOT_PERMITTED" value="6" enum="UPNPResult">
+ The [UPNPDevice] does not allow wildcard values for the source IP address.
+ </constant>
+ <constant name="UPNP_RESULT_EXT_PORT_WILDCARD_NOT_PERMITTED" value="7" enum="UPNPResult">
+ The [UPNPDevice] does not allow wildcard values for the external port.
+ </constant>
+ <constant name="UPNP_RESULT_INT_PORT_WILDCARD_NOT_PERMITTED" value="8" enum="UPNPResult">
+ The [UPNPDevice] does not allow wildcard values for the internal port.
+ </constant>
+ <constant name="UPNP_RESULT_REMOTE_HOST_MUST_BE_WILDCARD" value="9" enum="UPNPResult">
+ The remote host value must be a wildcard.
+ </constant>
+ <constant name="UPNP_RESULT_EXT_PORT_MUST_BE_WILDCARD" value="10" enum="UPNPResult">
+ The external port value must be a wildcard.
+ </constant>
+ <constant name="UPNP_RESULT_NO_PORT_MAPS_AVAILABLE" value="11" enum="UPNPResult">
+ No port maps are available. May also be returned if port mapping functionality is not available.
+ </constant>
+ <constant name="UPNP_RESULT_CONFLICT_WITH_OTHER_MECHANISM" value="12" enum="UPNPResult">
+ Conflict with other mechanism. May be returned instead of [code]UPNP_RESULT_CONFLICT_WITH_OTHER_MAPPING[/code] if a port mapping conflicts with an existing one.
+ </constant>
+ <constant name="UPNP_RESULT_CONFLICT_WITH_OTHER_MAPPING" value="13" enum="UPNPResult">
+ Conflict with an existing port mapping.
+ </constant>
+ <constant name="UPNP_RESULT_SAME_PORT_VALUES_REQUIRED" value="14" enum="UPNPResult">
+ External and internal port values must be the same.
+ </constant>
+ <constant name="UPNP_RESULT_ONLY_PERMANENT_LEASE_SUPPORTED" value="15" enum="UPNPResult">
+ Only permanent leases are supported. Do not use the [code]duration[/code] parameter when adding port mappings.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_GATEWAY" value="16" enum="UPNPResult">
+ Invalid gateway.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_PORT" value="17" enum="UPNPResult">
+ Invalid port.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_PROTOCOL" value="18" enum="UPNPResult">
+ Invalid protocol.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_DURATION" value="19" enum="UPNPResult">
+ Invalid duration.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_ARGS" value="20" enum="UPNPResult">
+ Invalid arguments.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_RESPONSE" value="21" enum="UPNPResult">
+ Invalid response.
+ </constant>
+ <constant name="UPNP_RESULT_INVALID_PARAM" value="22" enum="UPNPResult">
+ Invalid parameter.
+ </constant>
+ <constant name="UPNP_RESULT_HTTP_ERROR" value="23" enum="UPNPResult">
+ HTTP error.
+ </constant>
+ <constant name="UPNP_RESULT_SOCKET_ERROR" value="24" enum="UPNPResult">
+ Socket error.
+ </constant>
+ <constant name="UPNP_RESULT_MEM_ALLOC_ERROR" value="25" enum="UPNPResult">
+ Error allocating memory.
+ </constant>
+ <constant name="UPNP_RESULT_NO_GATEWAY" value="26" enum="UPNPResult">
+ No gateway available. You may need to call [method discover] first, or discovery didn't detect any valid IGDs (InternetGatewayDevices).
+ </constant>
+ <constant name="UPNP_RESULT_NO_DEVICES" value="27" enum="UPNPResult">
+ No devices available. You may need to call [method discover] first, or discovery didn't detect any valid [UPNPDevice]s.
+ </constant>
+ <constant name="UPNP_RESULT_UNKNOWN_ERROR" value="28" enum="UPNPResult">
+ Unknown error.
+ </constant>
+ </constants>
+</class>
diff --git a/modules/upnp/doc_classes/UPNPDevice.xml b/modules/upnp/doc_classes/UPNPDevice.xml
new file mode 100644
index 0000000000..9de8042daf
--- /dev/null
+++ b/modules/upnp/doc_classes/UPNPDevice.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="UPNPDevice" inherits="Reference" category="Core" version="3.1">
+ <brief_description>
+ UPNP device.
+ </brief_description>
+ <description>
+ UPNP device. See [UPNP] for UPNP discovery and utility functions. Provides low-level access to UPNP control commands. Allows to manage port mappings (port forwarding) and to query network information of the device (like local and external IP address and status). Note that methods on this class are synchronous and block the calling thread.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="add_port_mapping" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="port" type="int">
+ </argument>
+ <argument index="1" name="port_internal" type="int" default="0">
+ </argument>
+ <argument index="2" name="desc" type="String" default="&quot;&quot;">
+ </argument>
+ <argument index="3" name="proto" type="String" default="&quot;UDP&quot;">
+ </argument>
+ <argument index="4" name="duration" type="int" default="0">
+ </argument>
+ <description>
+ Adds a port mapping to forward the given external port on this [UPNPDevice] for the given protocol to the local machine. See [method UPNP.add_port_mapping].
+ </description>
+ </method>
+ <method name="delete_port_mapping" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="port" type="int">
+ </argument>
+ <argument index="1" name="proto" type="String" default="&quot;UDP&quot;">
+ </argument>
+ <description>
+ Deletes the port mapping identified by the given port and protocol combination on this device. See [method UPNP.delete_port_mapping].
+ </description>
+ </method>
+ <method name="is_valid_gateway" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.
+ </description>
+ </method>
+ <method name="query_external_address" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the external IP address of this [UPNPDevice] or an empty string.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="description_url" type="String" setter="set_description_url" getter="get_description_url">
+ URL to the device description.
+ </member>
+ <member name="igd_control_url" type="String" setter="set_igd_control_url" getter="get_igd_control_url">
+ IDG control URL.
+ </member>
+ <member name="igd_our_addr" type="String" setter="set_igd_our_addr" getter="get_igd_our_addr">
+ Address of the local machine in the network connecting it to this [UPNPDevice].
+ </member>
+ <member name="igd_service_type" type="String" setter="set_igd_service_type" getter="get_igd_service_type">
+ IGD service type.
+ </member>
+ <member name="igd_status" type="int" setter="set_igd_status" getter="get_igd_status" enum="UPNPDevice.IGDStatus">
+ IGD status. See [enum IGDStatus].
+ </member>
+ <member name="service_type" type="String" setter="set_service_type" getter="get_service_type">
+ Service type.
+ </member>
+ </members>
+ <constants>
+ <constant name="IGD_STATUS_OK" value="0" enum="IGDStatus">
+ OK.
+ </constant>
+ <constant name="IGD_STATUS_HTTP_ERROR" value="1" enum="IGDStatus">
+ HTTP error.
+ </constant>
+ <constant name="IGD_STATUS_HTTP_EMPTY" value="2" enum="IGDStatus">
+ Empty HTTP response.
+ </constant>
+ <constant name="IGD_STATUS_NO_URLS" value="3" enum="IGDStatus">
+ Returned response contained no URLs.
+ </constant>
+ <constant name="IGD_STATUS_NO_IGD" value="4" enum="IGDStatus">
+ Not a valid IGD.
+ </constant>
+ <constant name="IGD_STATUS_DISCONNECTED" value="5" enum="IGDStatus">
+ Disconnected.
+ </constant>
+ <constant name="IGD_STATUS_UNKNOWN_DEVICE" value="6" enum="IGDStatus">
+ Unknown device.
+ </constant>
+ <constant name="IGD_STATUS_INVALID_CONTROL" value="7" enum="IGDStatus">
+ Invalid control.
+ </constant>
+ <constant name="IGD_STATUS_MALLOC_ERROR" value="8" enum="IGDStatus">
+ Memory allocation error.
+ </constant>
+ <constant name="IGD_STATUS_UNKNOWN_ERROR" value="9" enum="IGDStatus">
+ Unknown error.
+ </constant>
+ </constants>
+</class>
diff --git a/platform/javascript/power_javascript.cpp b/modules/upnp/register_types.cpp
index 5241644dbc..c79155c4d2 100644
--- a/platform/javascript/power_javascript.cpp
+++ b/modules/upnp/register_types.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* power_javascript.cpp */
+/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,46 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "power_javascript.h"
+#include "register_types.h"
#include "error_macros.h"
+#include "upnp.h"
+#include "upnpdevice.h"
-bool PowerJavascript::UpdatePowerInfo() {
- // TODO Javascript implementation
- return false;
-}
-
-OS::PowerState PowerJavascript::get_power_state() {
- if (UpdatePowerInfo()) {
- return power_state;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
- return OS::POWERSTATE_UNKNOWN;
- }
-}
-
-int PowerJavascript::get_power_seconds_left() {
- if (UpdatePowerInfo()) {
- return nsecs_left;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
- return -1;
- }
-}
-
-int PowerJavascript::get_power_percent_left() {
- if (UpdatePowerInfo()) {
- return percent_left;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
- return -1;
- }
-}
+void register_upnp_types() {
-PowerJavascript::PowerJavascript() :
- nsecs_left(-1),
- percent_left(-1),
- power_state(OS::POWERSTATE_UNKNOWN) {
+ ClassDB::register_class<UPNP>();
+ ClassDB::register_class<UPNPDevice>();
}
-PowerJavascript::~PowerJavascript() {
+void unregister_upnp_types() {
}
diff --git a/modules/upnp/register_types.h b/modules/upnp/register_types.h
new file mode 100644
index 0000000000..2aeb06abc7
--- /dev/null
+++ b/modules/upnp/register_types.h
@@ -0,0 +1,32 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+void register_upnp_types();
+void unregister_upnp_types();
diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp
new file mode 100644
index 0000000000..32fdfe22f8
--- /dev/null
+++ b/modules/upnp/upnp.cpp
@@ -0,0 +1,401 @@
+/*************************************************************************/
+/* upnp.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "upnp.h"
+#include "miniupnpc/miniwget.h"
+#include "upnpcommands.h"
+#include <stdlib.h>
+
+bool UPNP::is_common_device(const String &dev) const {
+ return dev.empty() ||
+ dev.find("InternetGatewayDevice") >= 0 ||
+ dev.find("WANIPConnection") >= 0 ||
+ dev.find("WANPPPConnection") >= 0 ||
+ dev.find("rootdevice") >= 0;
+}
+
+int UPNP::discover(int timeout, int ttl, const String &device_filter) {
+ ERR_FAIL_COND_V(timeout < 0, UPNP_RESULT_INVALID_PARAM);
+ ERR_FAIL_COND_V(ttl < 0, UPNP_RESULT_INVALID_PARAM);
+ ERR_FAIL_COND_V(ttl > 255, UPNP_RESULT_INVALID_PARAM);
+
+ devices.clear();
+
+ int error = 0;
+ struct UPNPDev *devlist;
+
+ if (is_common_device(device_filter)) {
+ devlist = upnpDiscover(timeout, discover_multicast_if.utf8().get_data(), NULL, discover_local_port, discover_ipv6, ttl, &error);
+ } else {
+ devlist = upnpDiscoverAll(timeout, discover_multicast_if.utf8().get_data(), NULL, discover_local_port, discover_ipv6, ttl, &error);
+ }
+
+ if (error != UPNPDISCOVER_SUCCESS) {
+ switch (error) {
+ case UPNPDISCOVER_SOCKET_ERROR:
+ return UPNP_RESULT_SOCKET_ERROR;
+ case UPNPDISCOVER_MEMORY_ERROR:
+ return UPNP_RESULT_MEM_ALLOC_ERROR;
+ default:
+ return UPNP_RESULT_UNKNOWN_ERROR;
+ }
+ }
+
+ if (!devlist) {
+ return UPNP_RESULT_NO_DEVICES;
+ }
+
+ struct UPNPDev *dev = devlist;
+
+ while (dev) {
+ if (device_filter.empty() || strstr(dev->st, device_filter.utf8().get_data())) {
+ add_device_to_list(dev, devlist);
+ }
+
+ dev = dev->pNext;
+ }
+
+ freeUPNPDevlist(devlist);
+
+ return UPNP_RESULT_SUCCESS;
+}
+
+void UPNP::add_device_to_list(UPNPDev *dev, UPNPDev *devlist) {
+ Ref<UPNPDevice> new_device;
+ new_device.instance();
+
+ new_device->set_description_url(dev->descURL);
+ new_device->set_service_type(dev->st);
+
+ parse_igd(new_device, devlist);
+
+ devices.push_back(new_device);
+}
+
+char *UPNP::load_description(const String &url, int *size, int *status_code) const {
+ return (char *)miniwget(url.utf8().get_data(), size, 0, status_code);
+}
+
+void UPNP::parse_igd(Ref<UPNPDevice> dev, UPNPDev *devlist) {
+ int size = 0;
+ int status_code = -1;
+ char *xml = load_description(dev->get_description_url(), &size, &status_code);
+
+ if (status_code != 200) {
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_HTTP_ERROR);
+ return;
+ }
+
+ if (!xml || size < 1) {
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_HTTP_EMPTY);
+ return;
+ }
+
+ struct UPNPUrls *urls = (UPNPUrls *)malloc(sizeof(struct UPNPUrls));
+
+ if (!urls) {
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_MALLOC_ERROR);
+ return;
+ }
+
+ struct IGDdatas data;
+
+ memset(urls, 0, sizeof(struct UPNPUrls));
+
+ parserootdesc(xml, size, &data);
+ free(xml);
+ xml = 0;
+
+ GetUPNPUrls(urls, &data, dev->get_description_url().utf8().get_data(), 0);
+
+ if (!urls) {
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_NO_URLS);
+ return;
+ }
+
+ char addr[16];
+ int i = UPNP_GetValidIGD(devlist, urls, &data, (char *)&addr, 16);
+
+ if (i != 1) {
+ FreeUPNPUrls(urls);
+
+ switch (i) {
+ case 0:
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_NO_IGD);
+ return;
+ case 2:
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_DISCONNECTED);
+ return;
+ case 3:
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_UNKNOWN_DEVICE);
+ return;
+ default:
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_UNKNOWN_ERROR);
+ return;
+ }
+ }
+
+ if (urls->controlURL[0] == '\0') {
+ FreeUPNPUrls(urls);
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_INVALID_CONTROL);
+ return;
+ }
+
+ dev->set_igd_control_url(urls->controlURL);
+ dev->set_igd_service_type(data.first.servicetype);
+ dev->set_igd_our_addr(addr);
+ dev->set_igd_status(UPNPDevice::IGD_STATUS_OK);
+
+ FreeUPNPUrls(urls);
+}
+
+int UPNP::upnp_result(int in) {
+ switch (in) {
+ case UPNPCOMMAND_SUCCESS:
+ return UPNP_RESULT_SUCCESS;
+ case UPNPCOMMAND_UNKNOWN_ERROR:
+ return UPNP_RESULT_UNKNOWN_ERROR;
+ case UPNPCOMMAND_INVALID_ARGS:
+ return UPNP_RESULT_INVALID_ARGS;
+ case UPNPCOMMAND_HTTP_ERROR:
+ return UPNP_RESULT_HTTP_ERROR;
+ case UPNPCOMMAND_INVALID_RESPONSE:
+ return UPNP_RESULT_INVALID_RESPONSE;
+ case UPNPCOMMAND_MEM_ALLOC_ERROR:
+ return UPNP_RESULT_MEM_ALLOC_ERROR;
+
+ case 402:
+ return UPNP_RESULT_INVALID_ARGS;
+ case 403:
+ return UPNP_RESULT_NOT_AUTHORIZED;
+ case 501:
+ return UPNP_RESULT_ACTION_FAILED;
+ case 606:
+ return UPNP_RESULT_NOT_AUTHORIZED;
+ case 714:
+ return UPNP_RESULT_NO_SUCH_ENTRY_IN_ARRAY;
+ case 715:
+ return UPNP_RESULT_SRC_IP_WILDCARD_NOT_PERMITTED;
+ case 716:
+ return UPNP_RESULT_EXT_PORT_WILDCARD_NOT_PERMITTED;
+ case 718:
+ return UPNP_RESULT_CONFLICT_WITH_OTHER_MAPPING;
+ case 724:
+ return UPNP_RESULT_SAME_PORT_VALUES_REQUIRED;
+ case 725:
+ return UPNP_RESULT_ONLY_PERMANENT_LEASE_SUPPORTED;
+ case 726:
+ return UPNP_RESULT_REMOTE_HOST_MUST_BE_WILDCARD;
+ case 727:
+ return UPNP_RESULT_EXT_PORT_MUST_BE_WILDCARD;
+ case 728:
+ return UPNP_RESULT_NO_PORT_MAPS_AVAILABLE;
+ case 729:
+ return UPNP_RESULT_CONFLICT_WITH_OTHER_MECHANISM;
+ case 732:
+ return UPNP_RESULT_INT_PORT_WILDCARD_NOT_PERMITTED;
+ case 733:
+ return UPNP_RESULT_INCONSISTENT_PARAMETERS;
+ }
+
+ return UPNP_RESULT_UNKNOWN_ERROR;
+}
+
+int UPNP::get_device_count() const {
+ return devices.size();
+}
+
+Ref<UPNPDevice> UPNP::get_device(int index) const {
+ ERR_FAIL_INDEX_V(index, devices.size(), NULL);
+
+ return devices.get(index);
+}
+
+void UPNP::add_device(Ref<UPNPDevice> device) {
+ ERR_FAIL_COND(device == NULL);
+
+ devices.push_back(device);
+}
+
+void UPNP::set_device(int index, Ref<UPNPDevice> device) {
+ ERR_FAIL_INDEX(index, devices.size());
+ ERR_FAIL_COND(device == NULL);
+
+ devices.set(index, device);
+}
+
+void UPNP::remove_device(int index) {
+ ERR_FAIL_INDEX(index, devices.size());
+
+ devices.remove(index);
+}
+
+void UPNP::clear_devices() {
+ devices.clear();
+}
+
+Ref<UPNPDevice> UPNP::get_gateway() const {
+ ERR_FAIL_COND_V(devices.size() < 1, NULL);
+
+ for (int i = 0; i < devices.size(); i++) {
+ Ref<UPNPDevice> dev = get_device(i);
+
+ if (dev != NULL && dev->is_valid_gateway()) {
+ return dev;
+ }
+ }
+
+ return NULL;
+}
+
+void UPNP::set_discover_multicast_if(const String &m_if) {
+ discover_multicast_if = m_if;
+}
+
+String UPNP::get_discover_multicast_if() const {
+ return discover_multicast_if;
+}
+
+void UPNP::set_discover_local_port(int port) {
+ discover_local_port = port;
+}
+
+int UPNP::get_discover_local_port() const {
+ return discover_local_port;
+}
+
+void UPNP::set_discover_ipv6(bool ipv6) {
+ discover_ipv6 = ipv6;
+}
+
+bool UPNP::is_discover_ipv6() const {
+ return discover_ipv6;
+}
+
+String UPNP::query_external_address() const {
+ Ref<UPNPDevice> dev = get_gateway();
+
+ if (dev == NULL) {
+ return "";
+ }
+
+ return dev->query_external_address();
+}
+
+int UPNP::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const {
+ Ref<UPNPDevice> dev = get_gateway();
+
+ if (dev == NULL) {
+ return UPNP_RESULT_NO_GATEWAY;
+ }
+
+ dev->delete_port_mapping(port, proto);
+
+ return dev->add_port_mapping(port, port_internal, desc, proto, duration);
+}
+
+int UPNP::delete_port_mapping(int port, String proto) const {
+ Ref<UPNPDevice> dev = get_gateway();
+
+ if (dev == NULL) {
+ return UPNP_RESULT_NO_GATEWAY;
+ }
+
+ return dev->delete_port_mapping(port, proto);
+}
+
+void UPNP::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_device_count"), &UPNP::get_device_count);
+ ClassDB::bind_method(D_METHOD("get_device", "index"), &UPNP::get_device);
+ ClassDB::bind_method(D_METHOD("add_device", "device"), &UPNP::add_device);
+ ClassDB::bind_method(D_METHOD("set_device", "index", "device"), &UPNP::set_device);
+ ClassDB::bind_method(D_METHOD("remove_device", "index"), &UPNP::remove_device);
+ ClassDB::bind_method(D_METHOD("clear_devices"), &UPNP::clear_devices);
+
+ ClassDB::bind_method(D_METHOD("get_gateway"), &UPNP::get_gateway);
+
+ ClassDB::bind_method(D_METHOD("discover", "timeout", "ttl", "device_filter"), &UPNP::discover, DEFVAL(2000), DEFVAL(2), DEFVAL("InternetGatewayDevice"));
+
+ ClassDB::bind_method(D_METHOD("query_external_address"), &UPNP::query_external_address);
+
+ ClassDB::bind_method(D_METHOD("add_port_mapping", "port", "port_internal", "desc", "proto", "duration"), &UPNP::add_port_mapping, DEFVAL(0), DEFVAL(""), DEFVAL("UDP"), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("delete_port_mapping", "port", "proto"), &UPNP::delete_port_mapping, DEFVAL("UDP"));
+
+ ClassDB::bind_method(D_METHOD("set_discover_multicast_if", "m_if"), &UPNP::set_discover_multicast_if);
+ ClassDB::bind_method(D_METHOD("get_discover_multicast_if"), &UPNP::get_discover_multicast_if);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "discover_multicast_if"), "set_discover_multicast_if", "get_discover_multicast_if");
+
+ ClassDB::bind_method(D_METHOD("set_discover_local_port", "port"), &UPNP::set_discover_local_port);
+ ClassDB::bind_method(D_METHOD("get_discover_local_port"), &UPNP::get_discover_local_port);
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "discover_local_port", PROPERTY_HINT_RANGE, "0,65535"), "set_discover_local_port", "get_discover_local_port");
+
+ ClassDB::bind_method(D_METHOD("set_discover_ipv6", "ipv6"), &UPNP::set_discover_ipv6);
+ ClassDB::bind_method(D_METHOD("is_discover_ipv6"), &UPNP::is_discover_ipv6);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "discover_ipv6"), "set_discover_ipv6", "is_discover_ipv6");
+
+ BIND_ENUM_CONSTANT(UPNP_RESULT_SUCCESS);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_NOT_AUTHORIZED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_PORT_MAPPING_NOT_FOUND);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INCONSISTENT_PARAMETERS);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_NO_SUCH_ENTRY_IN_ARRAY);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_ACTION_FAILED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_SRC_IP_WILDCARD_NOT_PERMITTED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_EXT_PORT_WILDCARD_NOT_PERMITTED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INT_PORT_WILDCARD_NOT_PERMITTED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_REMOTE_HOST_MUST_BE_WILDCARD);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_EXT_PORT_MUST_BE_WILDCARD);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_NO_PORT_MAPS_AVAILABLE);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_CONFLICT_WITH_OTHER_MECHANISM);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_CONFLICT_WITH_OTHER_MAPPING);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_SAME_PORT_VALUES_REQUIRED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_ONLY_PERMANENT_LEASE_SUPPORTED);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_GATEWAY);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_PORT);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_PROTOCOL);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_DURATION);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_ARGS);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_RESPONSE);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_INVALID_PARAM);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_HTTP_ERROR);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_SOCKET_ERROR);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_MEM_ALLOC_ERROR);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_NO_GATEWAY);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_NO_DEVICES);
+ BIND_ENUM_CONSTANT(UPNP_RESULT_UNKNOWN_ERROR);
+}
+
+UPNP::UPNP() {
+ discover_multicast_if = "";
+ discover_local_port = 0;
+ discover_ipv6 = false;
+}
+
+UPNP::~UPNP() {
+}
diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h
new file mode 100644
index 0000000000..fb0c0f30a0
--- /dev/null
+++ b/modules/upnp/upnp.h
@@ -0,0 +1,124 @@
+/*************************************************************************/
+/* upnp.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GODOT_UPNP_H
+#define GODOT_UPNP_H
+
+#include "miniupnpc/miniupnpc.h"
+#include "upnpdevice.h"
+#include <reference.h>
+
+class UPNP : public Reference {
+
+ GDCLASS(UPNP, Reference);
+
+private:
+ String discover_multicast_if;
+ int discover_local_port;
+ bool discover_ipv6;
+
+ Vector<Ref<UPNPDevice> > devices;
+
+ bool is_common_device(const String &dev) const;
+ void add_device_to_list(UPNPDev *dev, UPNPDev *devlist);
+ void parse_igd(Ref<UPNPDevice> dev, UPNPDev *devlist);
+ char *load_description(const String &url, int *size, int *status_code) const;
+
+protected:
+ static void _bind_methods();
+
+public:
+ enum UPNPResult {
+
+ UPNP_RESULT_SUCCESS,
+ UPNP_RESULT_NOT_AUTHORIZED,
+ UPNP_RESULT_PORT_MAPPING_NOT_FOUND,
+ UPNP_RESULT_INCONSISTENT_PARAMETERS,
+ UPNP_RESULT_NO_SUCH_ENTRY_IN_ARRAY,
+ UPNP_RESULT_ACTION_FAILED,
+ UPNP_RESULT_SRC_IP_WILDCARD_NOT_PERMITTED,
+ UPNP_RESULT_EXT_PORT_WILDCARD_NOT_PERMITTED,
+ UPNP_RESULT_INT_PORT_WILDCARD_NOT_PERMITTED,
+ UPNP_RESULT_REMOTE_HOST_MUST_BE_WILDCARD,
+ UPNP_RESULT_EXT_PORT_MUST_BE_WILDCARD,
+ UPNP_RESULT_NO_PORT_MAPS_AVAILABLE,
+ UPNP_RESULT_CONFLICT_WITH_OTHER_MECHANISM,
+ UPNP_RESULT_CONFLICT_WITH_OTHER_MAPPING,
+ UPNP_RESULT_SAME_PORT_VALUES_REQUIRED,
+ UPNP_RESULT_ONLY_PERMANENT_LEASE_SUPPORTED,
+ UPNP_RESULT_INVALID_GATEWAY,
+ UPNP_RESULT_INVALID_PORT,
+ UPNP_RESULT_INVALID_PROTOCOL,
+ UPNP_RESULT_INVALID_DURATION,
+ UPNP_RESULT_INVALID_ARGS,
+ UPNP_RESULT_INVALID_RESPONSE,
+ UPNP_RESULT_INVALID_PARAM,
+ UPNP_RESULT_HTTP_ERROR,
+ UPNP_RESULT_SOCKET_ERROR,
+ UPNP_RESULT_MEM_ALLOC_ERROR,
+ UPNP_RESULT_NO_GATEWAY,
+ UPNP_RESULT_NO_DEVICES,
+ UPNP_RESULT_UNKNOWN_ERROR,
+ };
+
+ static int upnp_result(int in);
+
+ int get_device_count() const;
+ Ref<UPNPDevice> get_device(int index) const;
+ void add_device(Ref<UPNPDevice> device);
+ void set_device(int index, Ref<UPNPDevice> device);
+ void remove_device(int index);
+ void clear_devices();
+
+ Ref<UPNPDevice> get_gateway() const;
+
+ int discover(int timeout = 2000, int ttl = 2, const String &device_filter = "InternetGatewayDevice");
+
+ String query_external_address() const;
+
+ int add_port_mapping(int port, int port_internal = 0, String desc = "", String proto = "UDP", int duration = 0) const;
+ int delete_port_mapping(int port, String proto = "UDP") const;
+
+ void set_discover_multicast_if(const String &m_if);
+ String get_discover_multicast_if() const;
+
+ void set_discover_local_port(int port);
+ int get_discover_local_port() const;
+
+ void set_discover_ipv6(bool ipv6);
+ bool is_discover_ipv6() const;
+
+ UPNP();
+ ~UPNP();
+};
+
+VARIANT_ENUM_CAST(UPNP::UPNPResult)
+
+#endif // GODOT_UPNP_H
diff --git a/modules/upnp/upnpdevice.cpp b/modules/upnp/upnpdevice.cpp
new file mode 100644
index 0000000000..a5959cf649
--- /dev/null
+++ b/modules/upnp/upnpdevice.cpp
@@ -0,0 +1,197 @@
+/*************************************************************************/
+/* upnpdevice.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "upnpdevice.h"
+#include "upnp.h"
+#include "upnpcommands.h"
+
+String UPNPDevice::query_external_address() const {
+ ERR_FAIL_COND_V(!is_valid_gateway(), "");
+
+ char addr[16];
+ int i = UPNP_GetExternalIPAddress(
+ igd_control_url.utf8().get_data(),
+ igd_service_type.utf8().get_data(),
+ (char *)&addr);
+
+ ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, "");
+
+ return String(addr);
+}
+
+int UPNPDevice::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const {
+ ERR_FAIL_COND_V(!is_valid_gateway(), UPNP::UPNP_RESULT_INVALID_GATEWAY);
+ ERR_FAIL_COND_V(port < 1 || port > 65535, UPNP::UPNP_RESULT_INVALID_PORT);
+ ERR_FAIL_COND_V(port_internal < 0 || port_internal > 65535, UPNP::UPNP_RESULT_INVALID_PORT); // Needs to allow 0 because 0 signifies "use external port as internal port"
+ ERR_FAIL_COND_V(proto != "UDP" && proto != "TCP", UPNP::UPNP_RESULT_INVALID_PROTOCOL);
+ ERR_FAIL_COND_V(duration < 0, UPNP::UPNP_RESULT_INVALID_DURATION);
+
+ if (port_internal < 1) {
+ port_internal = port;
+ }
+
+ int i = UPNP_AddPortMapping(
+ igd_control_url.utf8().get_data(),
+ igd_service_type.utf8().get_data(),
+ itos(port).utf8().get_data(),
+ itos(port_internal).utf8().get_data(),
+ igd_our_addr.utf8().get_data(),
+ desc.empty() ? 0 : desc.utf8().get_data(),
+ proto.utf8().get_data(),
+ NULL, // Remote host, always NULL as IGDs don't support it
+ duration > 0 ? itos(duration).utf8().get_data() : 0);
+
+ ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, UPNP::upnp_result(i));
+
+ return UPNP::UPNP_RESULT_SUCCESS;
+}
+
+int UPNPDevice::delete_port_mapping(int port, String proto) const {
+ ERR_FAIL_COND_V(port < 1 || port > 65535, UPNP::UPNP_RESULT_INVALID_PORT);
+ ERR_FAIL_COND_V(proto != "UDP" && proto != "TCP", UPNP::UPNP_RESULT_INVALID_PROTOCOL);
+
+ int i = UPNP_DeletePortMapping(
+ igd_control_url.utf8().get_data(),
+ igd_service_type.utf8().get_data(),
+ itos(port).utf8().get_data(),
+ proto.utf8().get_data(),
+ NULL // Remote host, always NULL as IGDs don't support it
+ );
+
+ ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, UPNP::upnp_result(i));
+
+ return UPNP::UPNP_RESULT_SUCCESS;
+}
+
+void UPNPDevice::set_description_url(const String &url) {
+ description_url = url;
+}
+
+String UPNPDevice::get_description_url() const {
+ return description_url;
+}
+
+void UPNPDevice::set_service_type(const String &type) {
+ service_type = type;
+}
+
+String UPNPDevice::get_service_type() const {
+ return service_type;
+}
+
+void UPNPDevice::set_igd_control_url(const String &url) {
+ igd_control_url = url;
+}
+
+String UPNPDevice::get_igd_control_url() const {
+ return igd_control_url;
+}
+
+void UPNPDevice::set_igd_service_type(const String &type) {
+ igd_service_type = type;
+}
+
+String UPNPDevice::get_igd_service_type() const {
+ return igd_service_type;
+}
+
+void UPNPDevice::set_igd_our_addr(const String &addr) {
+ igd_our_addr = addr;
+}
+
+String UPNPDevice::get_igd_our_addr() const {
+ return igd_our_addr;
+}
+
+void UPNPDevice::set_igd_status(IGDStatus status) {
+ igd_status = status;
+}
+
+UPNPDevice::IGDStatus UPNPDevice::get_igd_status() const {
+ return igd_status;
+}
+
+bool UPNPDevice::is_valid_gateway() const {
+ return igd_status == IGD_STATUS_OK;
+}
+
+void UPNPDevice::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("is_valid_gateway"), &UPNPDevice::is_valid_gateway);
+ ClassDB::bind_method(D_METHOD("query_external_address"), &UPNPDevice::query_external_address);
+ ClassDB::bind_method(D_METHOD("add_port_mapping", "port", "port_internal", "desc", "proto", "duration"), &UPNPDevice::add_port_mapping, DEFVAL(0), DEFVAL(""), DEFVAL("UDP"), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("delete_port_mapping", "port", "proto"), &UPNPDevice::delete_port_mapping, DEFVAL("UDP"));
+
+ ClassDB::bind_method(D_METHOD("set_description_url", "url"), &UPNPDevice::set_description_url);
+ ClassDB::bind_method(D_METHOD("get_description_url"), &UPNPDevice::get_description_url);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "description_url"), "set_description_url", "get_description_url");
+
+ ClassDB::bind_method(D_METHOD("set_service_type", "type"), &UPNPDevice::set_service_type);
+ ClassDB::bind_method(D_METHOD("get_service_type"), &UPNPDevice::get_service_type);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "service_type"), "set_service_type", "get_service_type");
+
+ ClassDB::bind_method(D_METHOD("set_igd_control_url", "url"), &UPNPDevice::set_igd_control_url);
+ ClassDB::bind_method(D_METHOD("get_igd_control_url"), &UPNPDevice::get_igd_control_url);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "igd_control_url"), "set_igd_control_url", "get_igd_control_url");
+
+ ClassDB::bind_method(D_METHOD("set_igd_service_type", "type"), &UPNPDevice::set_igd_service_type);
+ ClassDB::bind_method(D_METHOD("get_igd_service_type"), &UPNPDevice::get_igd_service_type);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "igd_service_type"), "set_igd_service_type", "get_igd_service_type");
+
+ ClassDB::bind_method(D_METHOD("set_igd_our_addr", "addr"), &UPNPDevice::set_igd_our_addr);
+ ClassDB::bind_method(D_METHOD("get_igd_our_addr"), &UPNPDevice::get_igd_our_addr);
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "igd_our_addr"), "set_igd_our_addr", "get_igd_our_addr");
+
+ ClassDB::bind_method(D_METHOD("set_igd_status", "status"), &UPNPDevice::set_igd_status);
+ ClassDB::bind_method(D_METHOD("get_igd_status"), &UPNPDevice::get_igd_status);
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "igd_status", PROPERTY_HINT_ENUM), "set_igd_status", "get_igd_status");
+
+ BIND_ENUM_CONSTANT(IGD_STATUS_OK);
+ BIND_ENUM_CONSTANT(IGD_STATUS_HTTP_ERROR);
+ BIND_ENUM_CONSTANT(IGD_STATUS_HTTP_EMPTY);
+ BIND_ENUM_CONSTANT(IGD_STATUS_NO_URLS);
+ BIND_ENUM_CONSTANT(IGD_STATUS_NO_IGD);
+ BIND_ENUM_CONSTANT(IGD_STATUS_DISCONNECTED);
+ BIND_ENUM_CONSTANT(IGD_STATUS_UNKNOWN_DEVICE);
+ BIND_ENUM_CONSTANT(IGD_STATUS_INVALID_CONTROL);
+ BIND_ENUM_CONSTANT(IGD_STATUS_MALLOC_ERROR);
+ BIND_ENUM_CONSTANT(IGD_STATUS_UNKNOWN_ERROR);
+}
+
+UPNPDevice::UPNPDevice() {
+ description_url = "";
+ service_type = "";
+ igd_control_url = "";
+ igd_service_type = "";
+ igd_our_addr = "";
+ igd_status = IGD_STATUS_UNKNOWN_ERROR;
+}
+
+UPNPDevice::~UPNPDevice() {
+}
diff --git a/modules/upnp/upnpdevice.h b/modules/upnp/upnpdevice.h
new file mode 100644
index 0000000000..25c9fe1ba3
--- /dev/null
+++ b/modules/upnp/upnpdevice.h
@@ -0,0 +1,95 @@
+/*************************************************************************/
+/* upnpdevice.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef GODOT_UPNPDEVICE_H
+#define GODOT_UPNPDEVICE_H
+
+#include <reference.h>
+
+class UPNPDevice : public Reference {
+
+ GDCLASS(UPNPDevice, Reference);
+
+public:
+ enum IGDStatus {
+
+ IGD_STATUS_OK,
+ IGD_STATUS_HTTP_ERROR,
+ IGD_STATUS_HTTP_EMPTY,
+ IGD_STATUS_NO_URLS,
+ IGD_STATUS_NO_IGD,
+ IGD_STATUS_DISCONNECTED,
+ IGD_STATUS_UNKNOWN_DEVICE,
+ IGD_STATUS_INVALID_CONTROL,
+ IGD_STATUS_MALLOC_ERROR,
+ IGD_STATUS_UNKNOWN_ERROR,
+ };
+
+ void set_description_url(const String &url);
+ String get_description_url() const;
+
+ void set_service_type(const String &type);
+ String get_service_type() const;
+
+ void set_igd_control_url(const String &url);
+ String get_igd_control_url() const;
+
+ void set_igd_service_type(const String &type);
+ String get_igd_service_type() const;
+
+ void set_igd_our_addr(const String &addr);
+ String get_igd_our_addr() const;
+
+ void set_igd_status(IGDStatus status);
+ IGDStatus get_igd_status() const;
+
+ bool is_valid_gateway() const;
+ String query_external_address() const;
+ int add_port_mapping(int port, int port_internal = 0, String desc = "", String proto = "UDP", int duration = 0) const;
+ int delete_port_mapping(int port, String proto = "UDP") const;
+
+ UPNPDevice();
+ ~UPNPDevice();
+
+protected:
+ static void _bind_methods();
+
+private:
+ String description_url;
+ String service_type;
+ String igd_control_url;
+ String igd_service_type;
+ String igd_our_addr;
+ IGDStatus igd_status;
+};
+
+VARIANT_ENUM_CAST(UPNPDevice::IGDStatus)
+
+#endif // GODOT_UPNPDEVICE_H
diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py
index 6b1ce41014..07a0450734 100644
--- a/modules/visual_script/config.py
+++ b/modules/visual_script/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/visual_script/doc_classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml
index 975b294f30..28764aca40 100644
--- a/modules/visual_script/doc_classes/VisualScript.xml
+++ b/modules/visual_script/doc_classes/VisualScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScript" inherits="Script" category="Core" version="3.1-dev">
+<class name="VisualScript" inherits="Script" category="Core" version="3.1">
<brief_description>
A script implemented in the Visual Script programming environment.
</brief_description>
@@ -9,7 +9,7 @@
You are most likely to use this class via the Visual Script editor or when writing plugins for it.
</description>
<tutorials>
- http://docs.godotengine.org/en/3.0/getting_started/scripting/visual_script/index.html
+ <link>http://docs.godotengine.org/en/3.0/getting_started/scripting/visual_script/index.html</link>
</tutorials>
<demos>
</demos>
diff --git a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
index b529589b98..793291eca2 100644
--- a/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node representing a constant from the base types.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
index 9c2ec3b849..399ba8ef5d 100644
--- a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
+++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node used to call built-in functions.
</brief_description>
@@ -80,7 +80,7 @@
Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
</constant>
<constant name="MATH_EXP" value="20" enum="BuiltinFunc">
- Return [b]e[/b] raised to the power of the input. [b]e[/b] sometimes called "Euler's number" is a mathematical constant whose value is approximately 2.71828.
+ Return the mathematical constant [b]e[/b] raised to the specified power of the input. [b]e[/b] has an approximate value of 2.71828.
</constant>
<constant name="MATH_ISNAN" value="21" enum="BuiltinFunc">
Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
diff --git a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
index dc946cfcbd..2e3a5b33c0 100644
--- a/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Gets a constant from a given class.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptComment.xml b/modules/visual_script/doc_classes/VisualScriptComment.xml
index 5c20f27ec2..a4a890ea8a 100644
--- a/modules/visual_script/doc_classes/VisualScriptComment.xml
+++ b/modules/visual_script/doc_classes/VisualScriptComment.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node used to annotate the script.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptCondition.xml b/modules/visual_script/doc_classes/VisualScriptCondition.xml
index a3313a43d9..353898c93a 100644
--- a/modules/visual_script/doc_classes/VisualScriptCondition.xml
+++ b/modules/visual_script/doc_classes/VisualScriptCondition.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node which branches the flow.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptConstant.xml b/modules/visual_script/doc_classes/VisualScriptConstant.xml
index 274adb5423..ed633c4135 100644
--- a/modules/visual_script/doc_classes/VisualScriptConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Gets a contant's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
index 2efe8d9bd6..14c44c6970 100644
--- a/modules/visual_script/doc_classes/VisualScriptConstructor.xml
+++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node which calls a base type constructor.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
index 2165c403d4..b8e77a1b0f 100644
--- a/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A scripted Visual Script node.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
index f076c70715..d3158df357 100644
--- a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
+++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node which deconstructs a base type instance into its parts.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml
index 1c4542336f..fc49cfc07b 100644
--- a/modules/visual_script/doc_classes/VisualScriptEditor.xml
+++ b/modules/visual_script/doc_classes/VisualScriptEditor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.1-dev">
+<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
index 7eea609db4..4bb05525bd 100644
--- a/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
+++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Emits a specified signal.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
index 26196f278e..93d7ce3516 100644
--- a/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
+++ b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
A Visual Script node returning a singleton from [@GlobalScope]
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptExpression.xml b/modules/visual_script/doc_classes/VisualScriptExpression.xml
index 0b93c3092c..343e83cb55 100644
--- a/modules/visual_script/doc_classes/VisualScriptExpression.xml
+++ b/modules/visual_script/doc_classes/VisualScriptExpression.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunction.xml b/modules/visual_script/doc_classes/VisualScriptFunction.xml
index 18daa42797..ec8e955cf7 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunction.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunction.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
index dc025cfb27..f6116cf539 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
index 05e9a6cb81..c75dd0cdbc 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.1-dev">
+<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
index d0db8cbab3..9d43204f02 100644
--- a/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
index 983d8882a7..73c1f47e1a 100644
--- a/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
index bc876900f3..652c29a9ac 100644
--- a/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
index 4316bf146d..ab4c23012b 100644
--- a/modules/visual_script/doc_classes/VisualScriptInputAction.xml
+++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptIterator.xml b/modules/visual_script/doc_classes/VisualScriptIterator.xml
index d815476e2c..7090621bd7 100644
--- a/modules/visual_script/doc_classes/VisualScriptIterator.xml
+++ b/modules/visual_script/doc_classes/VisualScriptIterator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Steps through items in a given input.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
index 038fd8c9cd..5c8ee6453c 100644
--- a/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Gets a local variable's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
index fa65a89c4a..f2e6c48907 100644
--- a/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Changes a local variable's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
index 243ab03b49..d456e880b7 100644
--- a/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
+++ b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Commonly used mathematical constants.
</brief_description>
<description>
- Provides common math constants, such as Pi or Euler's constant, on an output Data port.
+ Provides common math constants, such as Pi, on an output Data port.
[b]Input Ports:[/b]
none
[b]Output Ports:[/b]
@@ -35,7 +35,7 @@
Tau: [code]6.283185[/code]
</constant>
<constant name="MATH_CONSTANT_E" value="4" enum="MathConstant">
- Natural log: [code]2.718282[/code]
+ Mathematical constant [code]e[/code], the natural log base: [code]2.718282[/code]
</constant>
<constant name="MATH_CONSTANT_SQRT2" value="5" enum="MathConstant">
Square root of two: [code]1.414214[/code]
diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml
index c2c5464047..941a0cd91a 100644
--- a/modules/visual_script/doc_classes/VisualScriptNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.1-dev">
+<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.1">
<brief_description>
A node which is part of a [VisualScript].
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptOperator.xml b/modules/visual_script/doc_classes/VisualScriptOperator.xml
index 68a57191de..e60d50c977 100644
--- a/modules/visual_script/doc_classes/VisualScriptOperator.xml
+++ b/modules/visual_script/doc_classes/VisualScriptOperator.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptPreload.xml b/modules/visual_script/doc_classes/VisualScriptPreload.xml
index 19abc27053..5a2886ccac 100644
--- a/modules/visual_script/doc_classes/VisualScriptPreload.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPreload.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Creates a new [Resource] or loads one from the filesystem.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
index 88aac85f59..60cc8fdd4f 100644
--- a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
index ac962a071d..8f29e9d152 100644
--- a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
index a3144582cb..f6300e03f0 100644
--- a/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
+++ b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptReturn.xml b/modules/visual_script/doc_classes/VisualScriptReturn.xml
index ca50f811c3..6095520eff 100644
--- a/modules/visual_script/doc_classes/VisualScriptReturn.xml
+++ b/modules/visual_script/doc_classes/VisualScriptReturn.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Exits a function and returns an optional value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
index 3d4bdcfd0a..7704eaba04 100644
--- a/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Node reference.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
index c77b674b64..2c2af9262d 100644
--- a/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSelect.xml b/modules/visual_script/doc_classes/VisualScriptSelect.xml
index f1aad841ca..0731fc77e1 100644
--- a/modules/visual_script/doc_classes/VisualScriptSelect.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSelect.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Chooses between two input values.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSelf.xml b/modules/visual_script/doc_classes/VisualScriptSelf.xml
index c2847fcada..61a73e104c 100644
--- a/modules/visual_script/doc_classes/VisualScriptSelf.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSelf.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Outputs a reference to the current instance.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSequence.xml b/modules/visual_script/doc_classes/VisualScriptSequence.xml
index 0180f34c72..c71e068045 100644
--- a/modules/visual_script/doc_classes/VisualScriptSequence.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSequence.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Executes a series of Sequence ports.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
index d34d0b7127..46aeebab9c 100644
--- a/modules/visual_script/doc_classes/VisualScriptSubCall.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSubCall.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptSwitch.xml b/modules/visual_script/doc_classes/VisualScriptSwitch.xml
index ea9e6438cf..a00811a29b 100644
--- a/modules/visual_script/doc_classes/VisualScriptSwitch.xml
+++ b/modules/visual_script/doc_classes/VisualScriptSwitch.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Branches program flow based on a given input's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
index 4bdfeab35b..0bdc4ce89d 100644
--- a/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
+++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
index 76c218294e..06178a399d 100644
--- a/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Gets a variable's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
index 0262ad5dfb..5969f25060 100644
--- a/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Changes a variable's value.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptWhile.xml b/modules/visual_script/doc_classes/VisualScriptWhile.xml
index 46a6ea7a30..b9e7f6a553 100644
--- a/modules/visual_script/doc_classes/VisualScriptWhile.xml
+++ b/modules/visual_script/doc_classes/VisualScriptWhile.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
Conditional loop.
</brief_description>
diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml
index a1129ffbd7..c4698f746a 100644
--- a/modules/visual_script/doc_classes/VisualScriptYield.xml
+++ b/modules/visual_script/doc_classes/VisualScriptYield.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
index ad3a016c0d..b67e4ab1b8 100644
--- a/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
+++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.1-dev">
+<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index 2809cff362..11401c0460 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -112,7 +112,9 @@ void register_visual_script_types() {
register_visual_script_expression_node();
#ifdef TOOLS_ENABLED
+ ClassDB::set_current_api(ClassDB::API_EDITOR);
ClassDB::register_class<_VisualScriptEditor>();
+ ClassDB::set_current_api(ClassDB::API_CORE);
vs_editor_singleton = memnew(_VisualScriptEditor);
Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton()));
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index ef680547ca..9331092171 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -121,6 +121,10 @@ Array VisualScriptNode::_get_default_input_values() const {
return default_input_values;
}
+String VisualScriptNode::get_text() const {
+ return "";
+}
+
void VisualScriptNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script);
@@ -1967,11 +1971,11 @@ Ref<Script> VisualScriptInstance::get_script() const {
return script;
}
-ScriptInstance::RPCMode VisualScriptInstance::get_rpc_mode(const StringName &p_method) const {
+MultiplayerAPI::RPCMode VisualScriptInstance::get_rpc_mode(const StringName &p_method) const {
const Map<StringName, VisualScript::Function>::Element *E = script->functions.find(p_method);
if (!E) {
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
if (E->get().function_id >= 0 && E->get().nodes.has(E->get().function_id)) {
@@ -1983,12 +1987,12 @@ ScriptInstance::RPCMode VisualScriptInstance::get_rpc_mode(const StringName &p_m
}
}
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
-ScriptInstance::RPCMode VisualScriptInstance::get_rset_mode(const StringName &p_variable) const {
+MultiplayerAPI::RPCMode VisualScriptInstance::get_rset_mode(const StringName &p_variable) const {
- return RPC_MODE_DISABLED;
+ return MultiplayerAPI::RPC_MODE_DISABLED;
}
void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_owner) {
@@ -2028,6 +2032,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
function.flow_stack_size = 0;
function.pass_stack_size = 0;
function.node_count = 0;
+
Map<StringName, int> local_var_indices;
if (function.node < 0) {
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 69bb522173..aaa6dfea11 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -78,7 +78,7 @@ public:
Variant get_default_input_value(int p_port) const;
virtual String get_caption() const = 0;
- virtual String get_text() const = 0;
+ virtual String get_text() const;
virtual String get_category() const = 0;
//used by editor, this is not really saved
@@ -374,12 +374,10 @@ class VisualScriptInstance : public ScriptInstance {
int node;
int max_stack;
int trash_pos;
- int return_pos;
int flow_stack_size;
int pass_stack_size;
int node_count;
int argument_count;
- bool valid;
};
Map<StringName, Function> functions;
@@ -435,8 +433,8 @@ public:
virtual ScriptLanguage *get_language();
- virtual RPCMode get_rpc_mode(const StringName &p_method) const;
- virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+ virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
+ virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
VisualScriptInstance();
~VisualScriptInstance();
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 7f0a42da82..73b6d702c1 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -666,12 +666,14 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons
return PropertyInfo(t, "");
}
+/*
String VisualScriptBuiltinFunc::get_caption() const {
return "BuiltinFunc";
}
+*/
-String VisualScriptBuiltinFunc::get_text() const {
+String VisualScriptBuiltinFunc::get_caption() const {
return func_name[func];
}
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index f862d5c26f..3345762b9f 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -129,7 +129,7 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
+ //virtual String get_text() const;
virtual String get_category() const { return "functions"; }
void set_func(BuiltinFunc p_which);
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 69503e631c..0618064ea6 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -268,7 +268,7 @@ protected:
if (String(p_name) == "export") {
script->set_variable_export(var, p_value);
- EditorNode::get_singleton()->get_property_editor()->update_tree();
+ EditorNode::get_singleton()->get_inspector()->update_tree();
return true;
}
@@ -527,6 +527,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
GraphNode *gnode = memnew(GraphNode);
gnode->set_title(node->get_caption());
+ gnode->set_offset(pos * EDSCALE);
if (error_line == E->get()) {
gnode->set_overlay(GraphNode::OVERLAY_POSITION);
} else if (node->is_breakpoint()) {
@@ -543,8 +544,10 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->set_show_close_button(true);
}
- if (Object::cast_to<VisualScriptExpression>(node.ptr())) {
+ bool has_gnode_text = false;
+ if (Object::cast_to<VisualScriptExpression>(node.ptr())) {
+ has_gnode_text = true;
LineEdit *line_edit = memnew(LineEdit);
line_edit->set_text(node->get_text());
line_edit->set_expand_to_text_length(true);
@@ -552,9 +555,13 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
gnode->add_child(line_edit);
line_edit->connect("text_changed", this, "_expression_text_changed", varray(E->get()));
} else {
- Label *text = memnew(Label);
- text->set_text(node->get_text());
- gnode->add_child(text);
+ String text = node->get_text();
+ if (!text.empty()) {
+ has_gnode_text = true;
+ Label *label = memnew(Label);
+ label->set_text(text);
+ gnode->add_child(label);
+ }
}
if (Object::cast_to<VisualScriptComment>(node.ptr())) {
@@ -589,9 +596,21 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
int slot_idx = 0;
bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String();
- gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, mono_color, single_seq_output, TYPE_SEQUENCE, mono_color, seq_port, seq_port);
- gnode->set_offset(pos * EDSCALE);
- slot_idx++;
+ if ((node->has_input_sequence_port() || single_seq_output) || has_gnode_text) {
+ // IF has_gnode_text is true BUT we have no sequence ports to draw (in here),
+ // we still draw the disabled default ones to shift up the slots by one,
+ // so the slots DON'T start with the content text.
+
+ // IF has_gnode_text is false, but we DO want to draw default sequence ports,
+ // we draw a dummy text to take up the position of the sequence nodes, so all the other ports are still aligned correctly.
+ if (!has_gnode_text) {
+ Label *dummy = memnew(Label);
+ dummy->set_text(" ");
+ gnode->add_child(dummy);
+ }
+ gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, mono_color, single_seq_output, TYPE_SEQUENCE, mono_color, seq_port, seq_port);
+ slot_idx++;
+ }
int mixed_seq_ports = 0;
@@ -3236,6 +3255,12 @@ void VisualScriptEditor::_member_option(int p_option) {
}
}
+void VisualScriptEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
+}
+
+void VisualScriptEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
+}
+
void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_member_button", &VisualScriptEditor::_member_button);
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 80bbf142d9..0bd64d6a1d 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -137,7 +137,7 @@ class VisualScriptEditor : public ScriptEditorBase {
Vector<Pair<Variant::Type, String> > args;
};
- HashMap<StringName, Ref<StyleBox>, StringNameHasher> node_styles;
+ HashMap<StringName, Ref<StyleBox> > node_styles;
StringName edited_func;
void _update_graph_connections();
@@ -246,6 +246,9 @@ protected:
static void _bind_methods();
public:
+ virtual void add_syntax_highlighter(SyntaxHighlighter *p_highlighter);
+ virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter);
+
virtual void apply_code();
virtual Ref<Script> get_edited_script() const;
virtual Vector<String> get_functions();
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index 16de04e4cf..d5f9d21348 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -455,7 +455,7 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
break;
}
- if (cchar == '-' || (cchar >= '0' && cchar <= '9')) {
+ if (cchar >= '0' && cchar <= '9') {
//a number
String num;
@@ -466,11 +466,6 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
#define READING_DONE 4
int reading = READING_INT;
- if (cchar == '-') {
- num += '-';
- cchar = GET_CHAR();
- }
-
CharType c = cchar;
bool exp_sign = false;
bool exp_beg = false;
@@ -1146,7 +1141,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
expr_pos++;
if (expr_pos == expression.size()) {
//can happen..
- _set_error("Unexpected end of expression..");
+ _set_error("Unexpected end of expression...");
return NULL;
}
}
@@ -1166,7 +1161,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
} else {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -1175,7 +1170,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
if (expression[next_op - 1].is_op) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 5c097dfa76..ea23ab1b2a 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -772,7 +772,7 @@ PropertyInfo VisualScriptTypeCast::get_output_value_port_info(int p_idx) const {
String VisualScriptTypeCast::get_caption() const {
- return "TypeCast";
+ return "Type Cast";
}
String VisualScriptTypeCast::get_text() const {
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 187c9b0b9e..bdf5705ecd 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -262,26 +262,6 @@ PropertyInfo VisualScriptFunctionCall::get_output_value_port_info(int p_idx) con
}
String VisualScriptFunctionCall::get_caption() const {
-
- static const char *cname[5] = {
- "CallSelf",
- "CallNode",
- "CallInstance",
- "CallBasic",
- "CallSingleton"
- };
-
- String caption = cname[call_mode];
-
- if (rpc_call_mode) {
- caption += " (RPC)";
- }
-
- return caption;
-}
-
-String VisualScriptFunctionCall::get_text() const {
-
if (call_mode == CALL_MODE_SELF)
return " " + String(function) + "()";
if (call_mode == CALL_MODE_SINGLETON)
@@ -294,6 +274,14 @@ String VisualScriptFunctionCall::get_text() const {
return " " + base_type + "." + String(function) + "()";
}
+String VisualScriptFunctionCall::get_text() const {
+
+ if (rpc_call_mode) {
+ return "RPC";
+ }
+ return "";
+}
+
void VisualScriptFunctionCall::set_basic_type(Variant::Type p_type) {
if (basic_type == p_type)
@@ -1075,36 +1063,31 @@ PropertyInfo VisualScriptPropertySet::get_output_value_port_info(int p_idx) cons
String VisualScriptPropertySet::get_caption() const {
- static const char *cname[4] = {
- "Self",
- "Node",
- "Instance",
- "Basic"
- };
-
static const char *opname[ASSIGN_OP_MAX] = {
- "Set", "Add", "Sub", "Mul", "Div", "Mod", "ShiftLeft", "ShiftRight", "BitAnd", "BitOr", "BitXor"
+ "Set", "Add", "Subtract", "Multiply", "Divide", "Mod", "ShiftLeft", "ShiftRight", "BitAnd", "BitOr", "BitXor"
};
- return String(cname[call_mode]) + opname[assign_op];
+
+ String prop = String(opname[assign_op]) + " " + property;
+ if (index != StringName()) {
+ prop += "." + String(index);
+ }
+
+ return prop;
}
String VisualScriptPropertySet::get_text() const {
- String prop;
+ if (call_mode == CALL_MODE_BASIC_TYPE) {
+ return String("On ") + Variant::get_type_name(basic_type);
+ }
- if (call_mode == CALL_MODE_BASIC_TYPE)
- prop = Variant::get_type_name(basic_type) + "." + property;
- else if (call_mode == CALL_MODE_NODE_PATH)
- prop = String(base_path) + ":" + property;
- else if (call_mode == CALL_MODE_SELF)
- prop = property;
- else if (call_mode == CALL_MODE_INSTANCE)
- prop = String(base_type) + ":" + property;
+ static const char *cname[3] = {
+ "Self",
+ "Scene Node",
+ "Instance"
+ };
- if (index != StringName()) {
- prop += "." + String(index);
- }
- return prop;
+ return String("On ") + cname[call_mode];
}
void VisualScriptPropertySet::_update_base_type() {
@@ -1838,30 +1821,22 @@ PropertyInfo VisualScriptPropertyGet::get_output_value_port_info(int p_idx) cons
String VisualScriptPropertyGet::get_caption() const {
- static const char *cname[4] = {
- "SelfGet",
- "NodeGet",
- "InstanceGet",
- "BasicGet"
- };
-
- return cname[call_mode];
+ return String("Get ") + property;
}
String VisualScriptPropertyGet::get_text() const {
- String prop;
+ if (call_mode == CALL_MODE_BASIC_TYPE) {
+ return String("On ") + Variant::get_type_name(basic_type);
+ }
- if (call_mode == CALL_MODE_BASIC_TYPE)
- prop = Variant::get_type_name(basic_type) + "." + property;
- else if (call_mode == CALL_MODE_NODE_PATH)
- prop = String(base_path) + ":" + property;
- else if (call_mode == CALL_MODE_SELF)
- prop = property;
- else if (call_mode == CALL_MODE_INSTANCE)
- prop = String(base_type) + ":" + property;
+ static const char *cname[3] = {
+ "Self",
+ "Scene Node",
+ "Instance"
+ };
- return prop;
+ return String("On ") + cname[call_mode];
}
void VisualScriptPropertyGet::set_base_type(const StringName &p_type) {
@@ -2399,12 +2374,7 @@ PropertyInfo VisualScriptEmitSignal::get_output_value_port_info(int p_idx) const
String VisualScriptEmitSignal::get_caption() const {
- return "EmitSignal";
-}
-
-String VisualScriptEmitSignal::get_text() const {
-
- return "emit " + String(name);
+ return "Emit " + String(name);
}
void VisualScriptEmitSignal::set_signal(const StringName &p_type) {
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 0b30eae65a..3b522564d4 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -346,7 +346,7 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
+ //virtual String get_text() const;
virtual String get_category() const { return "functions"; }
void set_signal(const StringName &p_type);
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index c5654a5a20..8b7b809ec0 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -93,7 +93,7 @@ bool VisualScriptFunction::_set(const StringName &p_name, const Variant &p_value
}
if (p_name == "rpc/mode") {
- rpc_mode = ScriptInstance::RPCMode(int(p_value));
+ rpc_mode = MultiplayerAPI::RPCMode(int(p_value));
return true;
}
@@ -267,11 +267,11 @@ int VisualScriptFunction::get_argument_count() const {
return arguments.size();
}
-void VisualScriptFunction::set_rpc_mode(ScriptInstance::RPCMode p_mode) {
+void VisualScriptFunction::set_rpc_mode(MultiplayerAPI::RPCMode p_mode) {
rpc_mode = p_mode;
}
-ScriptInstance::RPCMode VisualScriptFunction::get_rpc_mode() const {
+MultiplayerAPI::RPCMode VisualScriptFunction::get_rpc_mode() const {
return rpc_mode;
}
@@ -319,7 +319,7 @@ VisualScriptFunction::VisualScriptFunction() {
stack_size = 256;
stack_less = false;
sequenced = true;
- rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
+ rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
}
void VisualScriptFunction::set_stack_less(bool p_enable) {
@@ -467,12 +467,12 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
static const char *op_names[] = {
//comparison
- "Equal", //OP_EQUAL,
- "NotEqual", //OP_NOT_EQUAL,
- "Less", //OP_LESS,
- "LessEqual", //OP_LESS_EQUAL,
- "Greater", //OP_GREATER,
- "GreaterEq", //OP_GREATER_EQUAL,
+ "Are Equal", //OP_EQUAL,
+ "Are Not Equal", //OP_NOT_EQUAL,
+ "Less Than", //OP_LESS,
+ "Less Than or Equal", //OP_LESS_EQUAL,
+ "Greater Than", //OP_GREATER,
+ "Greater Than or Equal", //OP_GREATER_EQUAL,
//mathematic
"Add", //OP_ADD,
"Subtract", //OP_SUBTRACT,
@@ -481,14 +481,14 @@ static const char *op_names[] = {
"Negate", //OP_NEGATE,
"Positive", //OP_POSITIVE,
"Remainder", //OP_MODULE,
- "Concat", //OP_STRING_CONCAT,
+ "Concatenate", //OP_STRING_CONCAT,
//bitwise
- "ShiftLeft", //OP_SHIFT_LEFT,
- "ShiftRight", //OP_SHIFT_RIGHT,
- "BitAnd", //OP_BIT_AND,
- "BitOr", //OP_BIT_OR,
- "BitXor", //OP_BIT_XOR,
- "BitNeg", //OP_BIT_NEGATE,
+ "Bit Shift Left", //OP_SHIFT_LEFT,
+ "Bit Shift Right", //OP_SHIFT_RIGHT,
+ "Bit And", //OP_BIT_AND,
+ "Bit Or", //OP_BIT_OR,
+ "Bit Xor", //OP_BIT_XOR,
+ "Bit Negate", //OP_BIT_NEGATE,
//logic
"And", //OP_AND,
"Or", //OP_OR,
@@ -500,11 +500,6 @@ static const char *op_names[] = {
String VisualScriptOperator::get_caption() const {
- return op_names[op];
-}
-
-String VisualScriptOperator::get_text() const {
-
static const wchar_t *op_names[] = {
//comparison
L"A = B", //OP_EQUAL,
@@ -803,14 +798,8 @@ PropertyInfo VisualScriptVariableGet::get_output_value_port_info(int p_idx) cons
String VisualScriptVariableGet::get_caption() const {
- return "Variable";
+ return "Get " + variable;
}
-
-String VisualScriptVariableGet::get_text() const {
-
- return variable;
-}
-
void VisualScriptVariableGet::set_variable(StringName p_variable) {
if (variable == p_variable)
@@ -928,12 +917,7 @@ PropertyInfo VisualScriptVariableSet::get_output_value_port_info(int p_idx) cons
String VisualScriptVariableSet::get_caption() const {
- return "VariableSet";
-}
-
-String VisualScriptVariableSet::get_text() const {
-
- return variable;
+ return "Set " + variable;
}
void VisualScriptVariableSet::set_variable(StringName p_variable) {
@@ -1044,7 +1028,7 @@ PropertyInfo VisualScriptConstant::get_input_value_port_info(int p_idx) const {
PropertyInfo VisualScriptConstant::get_output_value_port_info(int p_idx) const {
PropertyInfo pinfo;
- pinfo.name = "get";
+ pinfo.name = String(value);
pinfo.type = type;
return pinfo;
}
@@ -1054,11 +1038,6 @@ String VisualScriptConstant::get_caption() const {
return "Constant";
}
-String VisualScriptConstant::get_text() const {
-
- return String(value);
-}
-
void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
if (type == p_type)
@@ -1174,10 +1153,20 @@ PropertyInfo VisualScriptPreload::get_input_value_port_info(int p_idx) const {
PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const {
- PropertyInfo pinfo = PropertyInfo(Variant::OBJECT, "res");
+ PropertyInfo pinfo;
+ pinfo.type = Variant::OBJECT;
if (preload.is_valid()) {
pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE;
pinfo.hint_string = preload->get_class();
+ if (preload->get_path().is_resource_file()) {
+ pinfo.name = preload->get_path();
+ } else if (preload->get_name() != String()) {
+ pinfo.name = preload->get_name();
+ } else {
+ pinfo.name = preload->get_class();
+ }
+ } else {
+ pinfo.name = "<empty>";
}
return pinfo;
@@ -1188,21 +1177,6 @@ String VisualScriptPreload::get_caption() const {
return "Preload";
}
-String VisualScriptPreload::get_text() const {
-
- if (preload.is_valid()) {
- if (preload->get_path().is_resource_file()) {
- return preload->get_path();
- } else if (preload->get_name() != String()) {
- return preload->get_name();
- } else {
- return preload->get_class();
- }
- } else {
- return "<empty>";
- }
-}
-
void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) {
if (preload == p_preload)
@@ -1291,12 +1265,7 @@ PropertyInfo VisualScriptIndexGet::get_output_value_port_info(int p_idx) const {
String VisualScriptIndexGet::get_caption() const {
- return "IndexGet";
-}
-
-String VisualScriptIndexGet::get_text() const {
-
- return String("get");
+ return "Get Index";
}
class VisualScriptNodeInstanceIndexGet : public VisualScriptNodeInstance {
@@ -1371,12 +1340,7 @@ PropertyInfo VisualScriptIndexSet::get_output_value_port_info(int p_idx) const {
String VisualScriptIndexSet::get_caption() const {
- return "IndexSet";
-}
-
-String VisualScriptIndexSet::get_text() const {
-
- return String("set");
+ return "Set Index";
}
class VisualScriptNodeInstanceIndexSet : public VisualScriptNodeInstance {
@@ -1439,18 +1403,13 @@ PropertyInfo VisualScriptGlobalConstant::get_input_value_port_info(int p_idx) co
}
PropertyInfo VisualScriptGlobalConstant::get_output_value_port_info(int p_idx) const {
-
- return PropertyInfo(Variant::REAL, "value");
+ String name = GlobalConstants::get_global_constant_name(index);
+ return PropertyInfo(Variant::REAL, name);
}
String VisualScriptGlobalConstant::get_caption() const {
- return "GlobalConst";
-}
-
-String VisualScriptGlobalConstant::get_text() const {
-
- return GlobalConstants::get_global_constant_name(index);
+ return "Global Constant";
}
void VisualScriptGlobalConstant::set_global_constant(int p_which) {
@@ -1539,17 +1498,12 @@ PropertyInfo VisualScriptClassConstant::get_input_value_port_info(int p_idx) con
PropertyInfo VisualScriptClassConstant::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::INT, "value");
+ return PropertyInfo(Variant::INT, String(base_type) + "." + String(name));
}
String VisualScriptClassConstant::get_caption() const {
- return "ClassConst";
-}
-
-String VisualScriptClassConstant::get_text() const {
-
- return String(base_type) + "." + String(name);
+ return "Class Constant";
}
void VisualScriptClassConstant::set_class_constant(const StringName &p_which) {
@@ -1673,7 +1627,7 @@ PropertyInfo VisualScriptBasicTypeConstant::get_output_value_port_info(int p_idx
String VisualScriptBasicTypeConstant::get_caption() const {
- return "BasicConst";
+ return "Basic Constant";
}
String VisualScriptBasicTypeConstant::get_text() const {
@@ -1828,17 +1782,12 @@ PropertyInfo VisualScriptMathConstant::get_input_value_port_info(int p_idx) cons
PropertyInfo VisualScriptMathConstant::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::REAL, "value");
+ return PropertyInfo(Variant::REAL, const_name[constant]);
}
String VisualScriptMathConstant::get_caption() const {
- return "MathConst";
-}
-
-String VisualScriptMathConstant::get_text() const {
-
- return const_name[constant];
+ return "Math Constant";
}
void VisualScriptMathConstant::set_math_constant(MathConstant p_which) {
@@ -1903,7 +1852,7 @@ VisualScriptMathConstant::VisualScriptMathConstant() {
}
//////////////////////////////////////////
-////////////////GLOBALSINGLETON///////////
+////////////////ENGINESINGLETON///////////
//////////////////////////////////////////
int VisualScriptEngineSingleton::get_output_sequence_port_count() const {
@@ -1937,17 +1886,12 @@ PropertyInfo VisualScriptEngineSingleton::get_input_value_port_info(int p_idx) c
PropertyInfo VisualScriptEngineSingleton::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::OBJECT, "instance");
+ return PropertyInfo(Variant::OBJECT, singleton);
}
String VisualScriptEngineSingleton::get_caption() const {
- return "EngineSingleton";
-}
-
-String VisualScriptEngineSingleton::get_text() const {
-
- return singleton;
+ return "Get Engine Singleton";
}
void VisualScriptEngineSingleton::set_singleton(const String &p_string) {
@@ -2058,17 +2002,12 @@ PropertyInfo VisualScriptSceneNode::get_input_value_port_info(int p_idx) const {
PropertyInfo VisualScriptSceneNode::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::OBJECT, "node");
+ return PropertyInfo(Variant::OBJECT, path.simplified());
}
String VisualScriptSceneNode::get_caption() const {
- return "SceneNode";
-}
-
-String VisualScriptSceneNode::get_text() const {
-
- return path.simplified();
+ return "Get Scene Node";
}
void VisualScriptSceneNode::set_node_path(const NodePath &p_path) {
@@ -2259,17 +2198,12 @@ PropertyInfo VisualScriptSceneTree::get_input_value_port_info(int p_idx) const {
PropertyInfo VisualScriptSceneTree::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::OBJECT, "instance");
+ return PropertyInfo(Variant::OBJECT, "Scene Tree");
}
String VisualScriptSceneTree::get_caption() const {
- return "SceneTree";
-}
-
-String VisualScriptSceneTree::get_text() const {
-
- return "";
+ return "Get Scene Tree";
}
class VisualScriptNodeInstanceSceneTree : public VisualScriptNodeInstance {
@@ -2361,17 +2295,12 @@ PropertyInfo VisualScriptResourcePath::get_input_value_port_info(int p_idx) cons
PropertyInfo VisualScriptResourcePath::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::STRING, "path");
+ return PropertyInfo(Variant::STRING, path);
}
String VisualScriptResourcePath::get_caption() const {
- return "ResourcePath";
-}
-
-String VisualScriptResourcePath::get_text() const {
-
- return path;
+ return "Resource Path";
}
void VisualScriptResourcePath::set_resource_path(const String &p_path) {
@@ -2453,20 +2382,18 @@ PropertyInfo VisualScriptSelf::get_input_value_port_info(int p_idx) const {
PropertyInfo VisualScriptSelf::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(Variant::OBJECT, "instance");
-}
-
-String VisualScriptSelf::get_caption() const {
+ String type_name;
+ if (get_visual_script().is_valid())
+ type_name = get_visual_script()->get_instance_base_type();
+ else
+ type_name = "instance";
- return "Self";
+ return PropertyInfo(Variant::OBJECT, type_name);
}
-String VisualScriptSelf::get_text() const {
+String VisualScriptSelf::get_caption() const {
- if (get_visual_script().is_valid())
- return get_visual_script()->get_instance_base_type();
- else
- return "";
+ return "Get Self";
}
class VisualScriptNodeInstanceSelf : public VisualScriptNodeInstance {
@@ -3032,12 +2959,7 @@ PropertyInfo VisualScriptConstructor::get_output_value_port_info(int p_idx) cons
String VisualScriptConstructor::get_caption() const {
- return "Construct";
-}
-
-String VisualScriptConstructor::get_text() const {
-
- return "new " + Variant::get_type_name(type) + "()";
+ return "Construct " + Variant::get_type_name(type);
}
String VisualScriptConstructor::get_category() const {
@@ -3163,17 +3085,12 @@ PropertyInfo VisualScriptLocalVar::get_input_value_port_info(int p_idx) const {
}
PropertyInfo VisualScriptLocalVar::get_output_value_port_info(int p_idx) const {
- return PropertyInfo(type, "get");
+ return PropertyInfo(type, name);
}
String VisualScriptLocalVar::get_caption() const {
- return "LocalVarGet";
-}
-
-String VisualScriptLocalVar::get_text() const {
-
- return name;
+ return "Get Local Var";
}
String VisualScriptLocalVar::get_category() const {
@@ -3289,7 +3206,7 @@ PropertyInfo VisualScriptLocalVarSet::get_output_value_port_info(int p_idx) cons
String VisualScriptLocalVarSet::get_caption() const {
- return "LocalVarSet";
+ return "Set Local Var";
}
String VisualScriptLocalVarSet::get_text() const {
@@ -3427,12 +3344,7 @@ PropertyInfo VisualScriptInputAction::get_output_value_port_info(int p_idx) cons
String VisualScriptInputAction::get_caption() const {
- return "Action";
-}
-
-String VisualScriptInputAction::get_text() const {
-
- return name;
+ return "Action " + name;
}
String VisualScriptInputAction::get_category() const {
@@ -3600,12 +3512,7 @@ PropertyInfo VisualScriptDeconstruct::get_output_value_port_info(int p_idx) cons
String VisualScriptDeconstruct::get_caption() const {
- return "Deconstruct";
-}
-
-String VisualScriptDeconstruct::get_text() const {
-
- return "from " + Variant::get_type_name(type) + ":";
+ return "Deconstruct " + Variant::get_type_name(type);
}
String VisualScriptDeconstruct::get_category() const {
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index a581e81c8c..9bfbd46e47 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -46,7 +46,7 @@ class VisualScriptFunction : public VisualScriptNode {
bool stack_less;
int stack_size;
- ScriptInstance::RPCMode rpc_mode;
+ MultiplayerAPI::RPCMode rpc_mode;
bool sequenced;
protected:
@@ -93,8 +93,8 @@ public:
void set_return_type(Variant::Type p_type);
Variant::Type get_return_type() const;
- void set_rpc_mode(ScriptInstance::RPCMode p_mode);
- ScriptInstance::RPCMode get_rpc_mode() const;
+ void set_rpc_mode(MultiplayerAPI::RPCMode p_mode);
+ MultiplayerAPI::RPCMode get_rpc_mode() const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -124,7 +124,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "operators"; }
void set_operator(Variant::Operator p_op);
@@ -194,7 +193,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
void set_variable(StringName p_variable);
@@ -228,7 +226,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
void set_variable(StringName p_variable);
@@ -263,7 +260,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "constants"; }
void set_constant_type(Variant::Type p_type);
@@ -299,7 +295,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
void set_preload(const Ref<Resource> &p_preload);
@@ -327,7 +322,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "operators"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -352,7 +346,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "operators"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -381,7 +374,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "constants"; }
void set_global_constant(int p_which);
@@ -416,7 +408,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "constants"; }
void set_class_constant(const StringName &p_which);
@@ -505,7 +496,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "constants"; }
void set_math_constant(MathConstant p_which);
@@ -539,7 +529,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
void set_singleton(const String &p_string);
@@ -575,7 +564,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
void set_node_path(const NodePath &p_path);
@@ -609,7 +597,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -641,7 +628,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
void set_resource_path(const String &p_path);
@@ -672,7 +658,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const { return "data"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
@@ -822,7 +807,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const;
void set_constructor_type(Variant::Type p_type);
@@ -859,7 +843,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const;
void set_var_name(const StringName &p_name);
@@ -942,7 +925,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const;
void set_action_name(const StringName &p_name);
@@ -993,7 +975,6 @@ public:
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
- virtual String get_text() const;
virtual String get_category() const;
void set_deconstruct_type(Variant::Type p_type);
diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/vorbis/config.py
+++ b/modules/vorbis/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index 2f1a28a54c..33561da098 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -18,6 +18,10 @@ thirdparty_libsimplewebm_sources = [thirdparty_libsimplewebm_dir + file for file
env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
+# upstream uses c++11
+if (not env_webm.msvc):
+ env_webm.Append(CCFLAGS="-std=c++11")
+
# also requires libogg, libvorbis and libopus
if env['builtin_libogg']:
env_webm.Append(CPPPATH=["#thirdparty/libogg"])
diff --git a/modules/webm/config.py b/modules/webm/config.py
index dcae4447d5..72a4073423 100644
--- a/modules/webm/config.py
+++ b/modules/webm/config.py
@@ -1,5 +1,5 @@
-def can_build(platform):
- return platform != 'iphone'
+def can_build(env, platform):
+ return platform not in ['iphone']
def configure(env):
pass
diff --git a/modules/webm/doc_classes/ResourceImporterWebm.xml b/modules/webm/doc_classes/ResourceImporterWebm.xml
index 7c8e1a46b1..0cfab1baf0 100644
--- a/modules/webm/doc_classes/ResourceImporterWebm.xml
+++ b/modules/webm/doc_classes/ResourceImporterWebm.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterWebm" inherits="ResourceImporter" category="Core" version="3.1-dev">
+<class name="ResourceImporterWebm" inherits="ResourceImporter" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml
index d52e2324a1..c02a7a8016 100644
--- a/modules/webm/doc_classes/VideoStreamWebm.xml
+++ b/modules/webm/doc_classes/VideoStreamWebm.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VideoStreamWebm" inherits="VideoStream" category="Core" version="3.1-dev">
+<class name="VideoStreamWebm" inherits="VideoStream" category="Core" version="3.1">
<brief_description>
</brief_description>
<description>
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 0ebafa022d..c681e2b34f 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -263,7 +263,7 @@ if env["platform"] == 'uwp':
webm_cpu_x86 = True
else:
import platform
- is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm'))
+ is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and (platform.machine().startswith('arm') or platform.machine().startswith('aarch')))
is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"])
is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
if is_android_x86:
@@ -337,10 +337,9 @@ if webm_cpu_arm:
if webm_simd_optimizations == False:
print("WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!")
-
env_libvpx.add_source_files(env.modules_sources, libvpx_sources)
if webm_cpu_x86:
- is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"])
+ is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"]) or ("OSXCROSS_ROOT" in os.environ)
env_libvpx_mmx = env_libvpx.Clone()
if cpu_bits == '32' and is_clang_or_gcc:
@@ -379,5 +378,5 @@ elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
elif env["platform"] == 'iphone':
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
- elif not env["android_arch"] == 'arm64v8':
+ elif (is_x11_or_server_arm and cpu_bits == '32') or (env["platform"] == 'android' and not env["android_arch"] == 'arm64v8'):
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas)
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index ea7af1bf9e..21ae0ce7c2 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -78,10 +78,12 @@ if env['builtin_libwebp']:
"dsp/upsampling_msa.c",
"dsp/upsampling_neon.c",
"dsp/upsampling_sse2.c",
+ "dsp/upsampling_sse41.c",
"dsp/yuv.c",
"dsp/yuv_mips32.c",
"dsp/yuv_mips_dsp_r2.c",
"dsp/yuv_sse2.c",
+ "dsp/yuv_sse41.c",
"enc/alpha_enc.c",
"enc/analysis_enc.c",
"enc/backward_references_cost_enc.c",
diff --git a/modules/webp/config.py b/modules/webp/config.py
index 5f133eba90..1c8cd12a2d 100644
--- a/modules/webp/config.py
+++ b/modules/webp/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub
index 1a36e05863..15a88773e7 100644
--- a/modules/websocket/SCsub
+++ b/modules/websocket/SCsub
@@ -7,48 +7,57 @@ Import('env_modules')
env_lws = env_modules.Clone()
-thirdparty_dir = "#thirdparty/lws/"
+thirdparty_dir = "#thirdparty/libwebsockets/"
helper_dir = "win32helpers/"
thirdparty_sources = [
- "client/client.c",
- "client/client-handshake.c",
- "client/client-parser.c",
- "client/ssl-client.c",
-
- "ext/extension.c",
- "ext/extension-permessage-deflate.c",
-
- "server/fops-zip.c",
- "server/lejp-conf.c",
- "server/parsers.c",
- "server/ranges.c",
- "server/server.c",
- "server/server-handshake.c",
- "server/ssl-server.c",
+
+ "core/alloc.c",
+ "core/context.c",
+ "core/libwebsockets.c",
+ "core/output.c",
+ "core/pollfd.c",
+ "core/service.c",
+
+ "event-libs/poll/poll.c",
"misc/base64-decode.c",
"misc/lejp.c",
"misc/sha-1.c",
- "alloc.c",
- "context.c",
- "handshake.c",
- "header.c",
- "libwebsockets.c",
- "minilex.c",
- "output.c",
- "pollfd.c",
- "service.c",
- "ssl.c",
-
- "mbedtls_wrapper/library/ssl_cert.c",
- "mbedtls_wrapper/library/ssl_pkey.c",
- "mbedtls_wrapper/library/ssl_stack.c",
- "mbedtls_wrapper/library/ssl_methods.c",
- "mbedtls_wrapper/library/ssl_lib.c",
- "mbedtls_wrapper/library/ssl_x509.c",
- "mbedtls_wrapper/platform/ssl_port.c",
- "mbedtls_wrapper/platform/ssl_pm.c",
+ "roles/h1/ops-h1.c",
+ "roles/http/header.c",
+ "roles/http/client/client.c",
+ "roles/http/client/client-handshake.c",
+ "roles/http/server/fops-zip.c",
+ "roles/http/server/lejp-conf.c",
+ "roles/http/server/parsers.c",
+ "roles/http/server/server.c",
+ "roles/listen/ops-listen.c",
+ "roles/pipe/ops-pipe.c",
+ "roles/raw/ops-raw.c",
+
+ "roles/ws/client-ws.c",
+ "roles/ws/client-parser-ws.c",
+ "roles/ws/ops-ws.c",
+ "roles/ws/server-ws.c",
+
+ "tls/tls.c",
+ "tls/tls-client.c",
+ "tls/tls-server.c",
+
+ "tls/mbedtls/wrapper/library/ssl_cert.c",
+ "tls/mbedtls/wrapper/library/ssl_pkey.c",
+ "tls/mbedtls/wrapper/library/ssl_stack.c",
+ "tls/mbedtls/wrapper/library/ssl_methods.c",
+ "tls/mbedtls/wrapper/library/ssl_lib.c",
+ "tls/mbedtls/wrapper/library/ssl_x509.c",
+ "tls/mbedtls/wrapper/platform/ssl_port.c",
+ "tls/mbedtls/wrapper/platform/ssl_pm.c",
+ "tls/mbedtls/lws-genhash.c",
+ "tls/mbedtls/mbedtls-client.c",
+ "tls/mbedtls/lws-genrsa.c",
+ "tls/mbedtls/ssl.c",
+ "tls/mbedtls/mbedtls-server.c"
]
if env_lws["platform"] == "android": # Builtin getifaddrs
@@ -68,12 +77,12 @@ else:
env_lws.add_source_files(env.modules_sources, thirdparty_sources)
env_lws.Append(CPPPATH=[thirdparty_dir])
- wrapper_includes = ["#thirdparty/lws/mbedtls_wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
- env_lws.Append(CPPPATH=wrapper_includes)
+ wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
+ env_lws.Prepend(CPPPATH=wrapper_includes)
if env['builtin_mbedtls']:
mbedtls_includes = "#thirdparty/mbedtls/include"
- env_lws.Append(CPPPATH=[mbedtls_includes])
+ env_lws.Prepend(CPPPATH=[mbedtls_includes])
if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp":
env_lws.Append(CPPPATH=[thirdparty_dir + helper_dir])
diff --git a/modules/websocket/config.py b/modules/websocket/config.py
index fb920482f5..f59ef432b4 100644
--- a/modules/websocket/config.py
+++ b/modules/websocket/config.py
@@ -1,7 +1,16 @@
-
-def can_build(platform):
+def can_build(env, platform):
return True
-
def configure(env):
pass
+
+def get_doc_classes():
+ return [
+ "WebSocketClient",
+ "WebSocketMultiplayerPeer",
+ "WebSocketPeer",
+ "WebSocketServer"
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml
new file mode 100644
index 0000000000..2e11e1a44c
--- /dev/null
+++ b/modules/websocket/doc_classes/WebSocketClient.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="WebSocketClient" inherits="WebSocketMultiplayerPeer" category="Core" version="3.1">
+ <brief_description>
+ A WebSocket client implementation
+ </brief_description>
+ <description>
+ This class implements a WebSocket client compatible with any RFC 6455 complaint WebSocket server.
+ This client can be optionally used as a network peer for the [MultiplayerAPI].
+ After starting the client ([method connect_to_url]), you will need to [method NetworkedMultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]).
+ You will received appropriate signals when connecting, disconnecting, or when new data is available.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="connect_to_url">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="url" type="String">
+ </argument>
+ <argument index="1" name="protocols" type="PoolStringArray" default="PoolStringArray( )">
+ </argument>
+ <argument index="2" name="gd_mp_api" type="bool" default="false">
+ </argument>
+ <description>
+ Connect to the given URL requesting one of the given [code]protocols[/code] as sub-protocol.
+ If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connnections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true.
+ </description>
+ </method>
+ <method name="disconnect_from_host">
+ <return type="void">
+ </return>
+ <description>
+ Disconnect from the server if currently connected.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="verify_ssl" type="bool" setter="set_verify_ssl_enabled" getter="is_verify_ssl_enabled">
+ Enable or disable SSL certificate verification. Note: You must specify the certificates to be used in the project settings for it to work when exported.
+ </member>
+ </members>
+ <signals>
+ <signal name="connection_closed">
+ <description>
+ Emitted when the connection to the server is closed.
+ </description>
+ </signal>
+ <signal name="connection_error">
+ <description>
+ Emitted when the connection to the server fails.
+ </description>
+ </signal>
+ <signal name="connection_established">
+ <argument index="0" name="protocol" type="String">
+ </argument>
+ <description>
+ Emitted when a connection with the server is established, [code]protocol[/code] will contain the sub-protocol agreed with the server.
+ </description>
+ </signal>
+ <signal name="data_received">
+ <description>
+ Emitted when a WebSocket message is received. Note: This signal is NOT emitted when used as high level multiplayer peer.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/WebSocketMultiplayerPeer.xml b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml
index b49d4c48e0..1a841f85ed 100644
--- a/doc/classes/WebSocketMultiplayerPeer.xml
+++ b/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WebSocketMultiplayerPeer" inherits="NetworkedMultiplayerPeer" category="Core" version="3.1-dev">
+<class name="WebSocketMultiplayerPeer" inherits="NetworkedMultiplayerPeer" category="Core" version="3.1">
<brief_description>
+ Base class for WebSocket server and client.
</brief_description>
<description>
+ Base class for WebSocket server and client, allowing them to be used as network peer for the [MultiplayerAPI].
</description>
<tutorials>
</tutorials>
@@ -15,6 +17,7 @@
<argument index="0" name="peer_id" type="int">
</argument>
<description>
+ Returns the [WebSocketPeer] associated to the given [code]peer_id[/code].
</description>
</method>
</methods>
@@ -23,6 +26,7 @@
<argument index="0" name="peer_source" type="int">
</argument>
<description>
+ Emitted when a packet is received from a peer. Note: this signal is only emitted when the client or server is configured to use Godot multiplayer API.
</description>
</signal>
</signals>
diff --git a/modules/websocket/doc_classes/WebSocketPeer.xml b/modules/websocket/doc_classes/WebSocketPeer.xml
new file mode 100644
index 0000000000..85a08e0c0b
--- /dev/null
+++ b/modules/websocket/doc_classes/WebSocketPeer.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="WebSocketPeer" inherits="PacketPeer" category="Core" version="3.1">
+ <brief_description>
+ A class representing a specific WebSocket connection.
+ </brief_description>
+ <description>
+ This class represent a specific WebSocket connection, you can do lower level operations with it.
+ You can choose to write to the socket in binary or text mode, and you can recognize the mode used for writing by the other peer.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="close">
+ <return type="void">
+ </return>
+ <description>
+ Close this WebSocket connection, actively disconnecting the peer.
+ </description>
+ </method>
+ <method name="get_connected_host" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ Returns the IP Address of the connected peer. (Not available in HTML5 export)
+ </description>
+ </method>
+ <method name="get_connected_port" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the remote port of the connected peer. (Not available in HTML5 export)
+ </description>
+ </method>
+ <method name="get_write_mode" qualifiers="const">
+ <return type="int" enum="WebSocketPeer.WriteMode">
+ </return>
+ <description>
+ Get the current selected write mode. See [enum WriteMode].
+ </description>
+ </method>
+ <method name="is_connected_to_host" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if this peer is currently connected.
+ </description>
+ </method>
+ <method name="set_write_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="WebSocketPeer.WriteMode">
+ </argument>
+ <description>
+ Sets the socket to use the given [enum WriteMode].
+ </description>
+ </method>
+ <method name="was_string_packet" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if the last received packet was sent as a text payload. See [enum WriteMode]
+ </description>
+ </method>
+ </methods>
+ <constants>
+ <constant name="WRITE_MODE_TEXT" value="0" enum="WriteMode">
+ Specify that WebSockets messages should be transferred as text payload (only valid UTF-8 is allowed).
+ </constant>
+ <constant name="WRITE_MODE_BINARY" value="1" enum="WriteMode">
+ Specify that WebSockets messages should be transferred as binary payload (any byte combination is allowed).
+ </constant>
+ </constants>
+</class>
diff --git a/modules/websocket/doc_classes/WebSocketServer.xml b/modules/websocket/doc_classes/WebSocketServer.xml
new file mode 100644
index 0000000000..a1061e446b
--- /dev/null
+++ b/modules/websocket/doc_classes/WebSocketServer.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="WebSocketServer" inherits="WebSocketMultiplayerPeer" category="Core" version="3.1">
+ <brief_description>
+ A WebSocket server implementation
+ </brief_description>
+ <description>
+ This class implements a WebSocket server that can also support the high level multiplayer API.
+ After starting the server ([method listen]), you will need to [method NetworkedMultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]). When clients connect, disconnect, or send data, you will receive the appropriate signal.
+ Note: This class will not work in HTML5 exports due to browser restrictions.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="disconnect_peer">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Disconnects the given peer.
+ </description>
+ </method>
+ <method name="get_peer_address" qualifiers="const">
+ <return type="String">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns the IP address of the given peer.
+ </description>
+ </method>
+ <method name="get_peer_port" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns the remote port of the given peer.
+ </description>
+ </method>
+ <method name="has_peer" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns [code]true[/code] if a peer with the given ID is connected.
+ </description>
+ </method>
+ <method name="is_listening" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if the server is actively listening on a port.
+ </description>
+ </method>
+ <method name="listen">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="port" type="int">
+ </argument>
+ <argument index="1" name="protocols" type="PoolStringArray" default="PoolStringArray( )">
+ </argument>
+ <argument index="2" name="gd_mp_api" type="bool" default="false">
+ </argument>
+ <description>
+ Start listening on the given port.
+ You can specify the desired subprotocols via the "protocols" array. If the list empty (default), "binary" will be used.
+ You can use this server as a network peer for [MultiplayerAPI] by passing true as "gd_mp_api". Note: [signal data_received] will not be fired and clients other than Godot will not work in this case.
+ </description>
+ </method>
+ <method name="stop">
+ <return type="void">
+ </return>
+ <description>
+ Stop the server and clear its state.
+ </description>
+ </method>
+ </methods>
+ <signals>
+ <signal name="client_connected">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="protocol" type="String">
+ </argument>
+ <description>
+ Emitted when a new client connects. "protocol" will be the sub-protocol agreed with the client.
+ </description>
+ </signal>
+ <signal name="client_disconnected">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Emitted when a client disconnects.
+ </description>
+ </signal>
+ <signal name="data_received">
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Emitted when a new message is received. Note: This signal is NOT emitted when used as high level multiplayer peer.
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/websocket/emws_client.cpp b/modules/websocket/emws_client.cpp
index 38fe520fc1..1405fa98b0 100644
--- a/modules/websocket/emws_client.cpp
+++ b/modules/websocket/emws_client.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/emws_client.h b/modules/websocket/emws_client.h
index 8801f37007..6c2fa23b53 100644
--- a/modules/websocket/emws_client.h
+++ b/modules/websocket/emws_client.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index 93665e6428..e0b987b4d7 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -148,12 +148,14 @@ void EMWSPeer::close() {
IP_Address EMWSPeer::get_connected_host() const {
- return IP_Address();
+ ERR_EXPLAIN("Not supported in HTML5 export");
+ ERR_FAIL_V(IP_Address());
};
uint16_t EMWSPeer::get_connected_port() const {
- return 1025;
+ ERR_EXPLAIN("Not supported in HTML5 export");
+ ERR_FAIL_V(0);
};
EMWSPeer::EMWSPeer() {
diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h
index a50d1874ba..e06f725265 100644
--- a/modules/websocket/emws_peer.h
+++ b/modules/websocket/emws_peer.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/emws_server.cpp b/modules/websocket/emws_server.cpp
index 60e9133225..3eb93e4152 100644
--- a/modules/websocket/emws_server.cpp
+++ b/modules/websocket/emws_server.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -58,6 +58,19 @@ PoolVector<String> EMWSServer::get_protocols() const {
return out;
}
+IP_Address EMWSServer::get_peer_address(int p_peer_id) const {
+
+ return IP_Address();
+}
+
+int EMWSServer::get_peer_port(int p_peer_id) const {
+
+ return 0;
+}
+
+void EMWSServer::disconnect_peer(int p_peer_id) {
+}
+
EMWSServer::EMWSServer() {
}
diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h
index 59f1d76346..9ec4ce72c8 100644
--- a/modules/websocket/emws_server.h
+++ b/modules/websocket/emws_server.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -46,6 +46,9 @@ public:
bool is_listening() const;
bool has_peer(int p_id) const;
Ref<WebSocketPeer> get_peer(int p_id) const;
+ IP_Address get_peer_address(int p_peer_id) const;
+ int get_peer_port(int p_peer_id) const;
+ void disconnect_peer(int p_peer_id);
virtual void poll();
virtual PoolVector<String> get_protocols() const;
diff --git a/modules/websocket/lws_client.cpp b/modules/websocket/lws_client.cpp
index 604b1886ad..06f97aaf05 100644
--- a/modules/websocket/lws_client.cpp
+++ b/modules/websocket/lws_client.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,6 +31,8 @@
#include "lws_client.h"
#include "core/io/ip.h"
+#include "core/io/stream_peer_ssl.h"
+#include "tls/mbedtls/wrapper/include/openssl/ssl.h"
Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocols) {
@@ -64,6 +66,9 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
info.uid = -1;
//info.ws_ping_pong_interval = 5;
info.user = _lws_ref;
+#if defined(LWS_OPENSSL_SUPPORT)
+ info.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
+#endif
context = lws_create_context(&info);
if (context == NULL) {
@@ -87,7 +92,14 @@ Error LWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
i.host = hbuf;
i.path = pbuf;
i.port = p_port;
- i.ssl_connection = p_ssl;
+
+ if (p_ssl) {
+ i.ssl_connection = LCCSCF_USE_SSL;
+ if (!verify_ssl)
+ i.ssl_connection |= LCCSCF_ALLOW_SELFSIGNED;
+ } else {
+ i.ssl_connection = 0;
+ }
lws_client_connect_via_info(&i);
return OK;
@@ -104,6 +116,13 @@ int LWSClient::_handle_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
LWSPeer::PeerData *peer_data = (LWSPeer::PeerData *)user;
switch (reason) {
+ case LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS: {
+ PoolByteArray arr = StreamPeerSSL::get_project_cert_array();
+ if (arr.size() > 0)
+ SSL_CTX_add_client_CA((SSL_CTX *)user, d2i_X509(NULL, &arr.read()[0], arr.size()));
+ else if (verify_ssl)
+ WARN_PRINTS("No CA cert specified in project settings, SSL will not work");
+ } break;
case LWS_CALLBACK_CLIENT_ESTABLISHED:
peer->set_wsi(wsi);
@@ -122,7 +141,7 @@ int LWSClient::_handle_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
destroy_context();
return -1; // we should close the connection (would probably happen anyway)
- case LWS_CALLBACK_CLOSED:
+ case LWS_CALLBACK_CLIENT_CLOSED:
peer_data->in_count = 0;
peer_data->out_count = 0;
peer_data->rbw.resize(0);
diff --git a/modules/websocket/lws_client.h b/modules/websocket/lws_client.h
index 2e082175df..8850683cb5 100644
--- a/modules/websocket/lws_client.h
+++ b/modules/websocket/lws_client.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/lws_helper.h b/modules/websocket/lws_helper.h
index a832d458b6..a4920c3d54 100644
--- a/modules/websocket/lws_helper.h
+++ b/modules/websocket/lws_helper.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -30,6 +30,9 @@
#ifndef LWS_HELPER_H
#define LWS_HELPER_H
+#define LWS_BUF_SIZE 65536
+#define LWS_PACKET_SIZE LWS_BUF_SIZE
+
#include "core/io/stream_peer.h"
#include "core/os/os.h"
#include "core/reference.h"
@@ -124,6 +127,7 @@ static void _lws_make_protocols(void *p_obj, lws_callback_function *p_callback,
/* LWS protocol structs */
ref->lws_structs = (struct lws_protocols *)memalloc(sizeof(struct lws_protocols) * (len + 2));
+ memset(ref->lws_structs, 0, sizeof(struct lws_protocols) * (len + 2));
CharString strings = p_names.join(",").ascii();
int str_len = strings.length();
@@ -145,13 +149,15 @@ static void _lws_make_protocols(void *p_obj, lws_callback_function *p_callback,
structs_ptr[0].name = "http-only";
structs_ptr[0].callback = p_callback;
structs_ptr[0].per_session_data_size = data_size;
- structs_ptr[0].rx_buffer_size = 0;
+ structs_ptr[0].rx_buffer_size = LWS_BUF_SIZE;
+ structs_ptr[0].tx_packet_size = LWS_PACKET_SIZE;
/* add user defined protocols */
for (i = 0; i < len; i++) {
structs_ptr[i + 1].name = (const char *)&names_ptr[pos];
structs_ptr[i + 1].callback = p_callback;
structs_ptr[i + 1].per_session_data_size = data_size;
- structs_ptr[i + 1].rx_buffer_size = 0;
+ structs_ptr[i + 1].rx_buffer_size = LWS_BUF_SIZE;
+ structs_ptr[i + 1].tx_packet_size = LWS_PACKET_SIZE;
pos += pnr[i].ascii().length() + 1;
names_ptr[pos - 1] = '\0';
}
diff --git a/modules/websocket/lws_peer.cpp b/modules/websocket/lws_peer.cpp
index fdaa79f9d4..96acb99cc4 100644
--- a/modules/websocket/lws_peer.cpp
+++ b/modules/websocket/lws_peer.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -32,6 +32,14 @@
#include "lws_peer.h"
#include "core/io/ip.h"
+// Needed for socket_helpers on Android at least. UNIXes has it, just include if not windows
+#if !defined(WINDOWS_ENABLED)
+#include <netinet/in.h>
+#include <sys/socket.h>
+#endif
+
+#include "drivers/unix/socket_helpers.h"
+
void LWSPeer::set_wsi(struct lws *p_wsi) {
wsi = p_wsi;
};
@@ -178,12 +186,44 @@ void LWSPeer::close() {
IP_Address LWSPeer::get_connected_host() const {
- return IP_Address();
+ ERR_FAIL_COND_V(!is_connected_to_host(), IP_Address());
+
+ IP_Address ip;
+ int port = 0;
+
+ struct sockaddr_storage addr;
+ socklen_t len = sizeof(addr);
+
+ int fd = lws_get_socket_fd(wsi);
+ ERR_FAIL_COND_V(fd == -1, IP_Address());
+
+ int ret = getpeername(fd, (struct sockaddr *)&addr, &len);
+ ERR_FAIL_COND_V(ret != 0, IP_Address());
+
+ _set_ip_addr_port(ip, port, &addr);
+
+ return ip;
};
uint16_t LWSPeer::get_connected_port() const {
- return 1025;
+ ERR_FAIL_COND_V(!is_connected_to_host(), 0);
+
+ IP_Address ip;
+ int port = 0;
+
+ struct sockaddr_storage addr;
+ socklen_t len = sizeof(addr);
+
+ int fd = lws_get_socket_fd(wsi);
+ ERR_FAIL_COND_V(fd == -1, 0);
+
+ int ret = getpeername(fd, (struct sockaddr *)&addr, &len);
+ ERR_FAIL_COND_V(ret != 0, 0);
+
+ _set_ip_addr_port(ip, port, &addr);
+
+ return port;
};
LWSPeer::LWSPeer() {
diff --git a/modules/websocket/lws_peer.h b/modules/websocket/lws_peer.h
index 0a62b65d24..e96b38b168 100644
--- a/modules/websocket/lws_peer.h
+++ b/modules/websocket/lws_peer.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/lws_server.cpp b/modules/websocket/lws_server.cpp
index 8a47ba557d..8d13dc7a98 100644
--- a/modules/websocket/lws_server.cpp
+++ b/modules/websocket/lws_server.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -164,6 +164,24 @@ Ref<WebSocketPeer> LWSServer::get_peer(int p_id) const {
return _peer_map[p_id];
}
+IP_Address LWSServer::get_peer_address(int p_peer_id) const {
+ ERR_FAIL_COND_V(!has_peer(p_peer_id), IP_Address());
+
+ return _peer_map[p_peer_id]->get_connected_host();
+}
+
+int LWSServer::get_peer_port(int p_peer_id) const {
+ ERR_FAIL_COND_V(!has_peer(p_peer_id), 0);
+
+ return _peer_map[p_peer_id]->get_connected_port();
+}
+
+void LWSServer::disconnect_peer(int p_peer_id) {
+ ERR_FAIL_COND(!has_peer(p_peer_id));
+
+ get_peer(p_peer_id)->close();
+}
+
LWSServer::LWSServer() {
context = NULL;
_lws_ref = NULL;
diff --git a/modules/websocket/lws_server.h b/modules/websocket/lws_server.h
index 5f7ac4850a..9e3fb9b775 100644
--- a/modules/websocket/lws_server.h
+++ b/modules/websocket/lws_server.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -52,6 +52,9 @@ public:
bool is_listening() const;
bool has_peer(int p_id) const;
Ref<WebSocketPeer> get_peer(int p_id) const;
+ IP_Address get_peer_address(int p_peer_id) const;
+ int get_peer_port(int p_peer_id) const;
+ void disconnect_peer(int p_peer_id);
virtual void poll() { _lws_poll(); }
LWSServer();
diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp
index 39d03ff1f0..721f3cc330 100644
--- a/modules/websocket/register_types.cpp
+++ b/modules/websocket/register_types.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/register_types.h b/modules/websocket/register_types.h
index 010d88789b..89ce93e286 100644
--- a/modules/websocket/register_types.h
+++ b/modules/websocket/register_types.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/websocket_client.cpp b/modules/websocket/websocket_client.cpp
index f92a386988..7701163085 100644
--- a/modules/websocket/websocket_client.cpp
+++ b/modules/websocket/websocket_client.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -32,6 +32,8 @@
GDCINULL(WebSocketClient);
WebSocketClient::WebSocketClient() {
+
+ verify_ssl = true;
}
WebSocketClient::~WebSocketClient() {
@@ -72,6 +74,16 @@ Error WebSocketClient::connect_to_url(String p_url, PoolVector<String> p_protoco
return connect_to_host(host, path, port, ssl, p_protocols);
}
+void WebSocketClient::set_verify_ssl_enabled(bool p_verify_ssl) {
+
+ verify_ssl = p_verify_ssl;
+}
+
+bool WebSocketClient::is_verify_ssl_enabled() const {
+
+ return verify_ssl;
+}
+
bool WebSocketClient::is_server() const {
return false;
@@ -116,6 +128,10 @@ void WebSocketClient::_on_error() {
void WebSocketClient::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_to_url", "url", "protocols", "gd_mp_api"), &WebSocketClient::connect_to_url, DEFVAL(PoolVector<String>()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("disconnect_from_host"), &WebSocketClient::disconnect_from_host);
+ ClassDB::bind_method(D_METHOD("set_verify_ssl_enabled", "enabled"), &WebSocketClient::set_verify_ssl_enabled);
+ ClassDB::bind_method(D_METHOD("is_verify_ssl_enabled"), &WebSocketClient::is_verify_ssl_enabled);
+
+ ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "verify_ssl", PROPERTY_HINT_NONE, "", 0), "set_verify_ssl_enabled", "is_verify_ssl_enabled");
ADD_SIGNAL(MethodInfo("data_received"));
ADD_SIGNAL(MethodInfo("connection_established", PropertyInfo(Variant::STRING, "protocol")));
diff --git a/modules/websocket/websocket_client.h b/modules/websocket/websocket_client.h
index 0e87825222..6165f37d40 100644
--- a/modules/websocket/websocket_client.h
+++ b/modules/websocket/websocket_client.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -41,12 +41,16 @@ class WebSocketClient : public WebSocketMultiplayerPeer {
protected:
Ref<WebSocketPeer> _peer;
+ bool verify_ssl;
static void _bind_methods();
public:
Error connect_to_url(String p_url, PoolVector<String> p_protocols = PoolVector<String>(), bool gd_mp_api = false);
+ void set_verify_ssl_enabled(bool p_verify_ssl);
+ bool is_verify_ssl_enabled() const;
+
virtual void poll() = 0;
virtual Error connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocol = PoolVector<String>()) = 0;
virtual void disconnect_from_host() = 0;
diff --git a/modules/websocket/websocket_macros.h b/modules/websocket/websocket_macros.h
index b5c2159806..d27fb4d778 100644
--- a/modules/websocket/websocket_macros.h
+++ b/modules/websocket/websocket_macros.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/websocket_multiplayer.cpp b/modules/websocket/websocket_multiplayer.cpp
index 8cd4dff38b..b948c439df 100644
--- a/modules/websocket/websocket_multiplayer.cpp
+++ b/modules/websocket/websocket_multiplayer.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/websocket_multiplayer.h b/modules/websocket/websocket_multiplayer.h
index e8e795e97f..8edfc5296e 100644
--- a/modules/websocket/websocket_multiplayer.h
+++ b/modules/websocket/websocket_multiplayer.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/websocket_peer.cpp b/modules/websocket/websocket_peer.cpp
index a6fbb4481b..61f783e377 100644
--- a/modules/websocket/websocket_peer.cpp
+++ b/modules/websocket/websocket_peer.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -43,6 +43,8 @@ void WebSocketPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_connected_to_host"), &WebSocketPeer::is_connected_to_host);
ClassDB::bind_method(D_METHOD("was_string_packet"), &WebSocketPeer::was_string_packet);
ClassDB::bind_method(D_METHOD("close"), &WebSocketPeer::close);
+ ClassDB::bind_method(D_METHOD("get_connected_host"), &WebSocketPeer::get_connected_host);
+ ClassDB::bind_method(D_METHOD("get_connected_port"), &WebSocketPeer::get_connected_port);
BIND_ENUM_CONSTANT(WRITE_MODE_TEXT);
BIND_ENUM_CONSTANT(WRITE_MODE_BINARY);
diff --git a/modules/websocket/websocket_peer.h b/modules/websocket/websocket_peer.h
index f4d8ce3e38..ad451e9cc7 100644
--- a/modules/websocket/websocket_peer.h
+++ b/modules/websocket/websocket_peer.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/websocket/websocket_server.cpp b/modules/websocket/websocket_server.cpp
index ba77019f55..53dd7b51b7 100644
--- a/modules/websocket/websocket_server.cpp
+++ b/modules/websocket/websocket_server.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -44,6 +44,9 @@ void WebSocketServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("listen", "port", "protocols", "gd_mp_api"), &WebSocketServer::listen, DEFVAL(PoolVector<String>()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("stop"), &WebSocketServer::stop);
ClassDB::bind_method(D_METHOD("has_peer", "id"), &WebSocketServer::has_peer);
+ ClassDB::bind_method(D_METHOD("get_peer_address", "id"), &WebSocketServer::get_peer_address);
+ ClassDB::bind_method(D_METHOD("get_peer_port", "id"), &WebSocketServer::get_peer_port);
+ ClassDB::bind_method(D_METHOD("disconnect_peer", "id"), &WebSocketServer::disconnect_peer);
ADD_SIGNAL(MethodInfo("client_disconnected", PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("client_connected", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::STRING, "protocol")));
diff --git a/modules/websocket/websocket_server.h b/modules/websocket/websocket_server.h
index db188811fd..64935f8a58 100644
--- a/modules/websocket/websocket_server.h
+++ b/modules/websocket/websocket_server.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -52,6 +52,10 @@ public:
virtual bool is_server() const;
ConnectionStatus get_connection_status() const;
+ virtual IP_Address get_peer_address(int p_peer_id) const = 0;
+ virtual int get_peer_port(int p_peer_id) const = 0;
+ virtual void disconnect_peer(int p_peer_id) = 0;
+
void _on_peer_packet(int32_t p_peer_id);
void _on_connect(int32_t p_peer_id, String p_protocol);
void _on_disconnect(int32_t p_peer_id);
diff --git a/platform/SCsub b/platform/SCsub
index e624f8e90f..2019a30be7 100644
--- a/platform/SCsub
+++ b/platform/SCsub
@@ -18,11 +18,10 @@ for platform in env.platform_apis:
reg_apis_inc += '\n'
reg_apis += '}\n\n'
unreg_apis += '}\n'
-f = open_utf8('register_platform_apis.gen.cpp', 'w')
-f.write(reg_apis_inc)
-f.write(reg_apis)
-f.write(unreg_apis)
-f.close()
+with open_utf8('register_platform_apis.gen.cpp', 'w') as f:
+ f.write(reg_apis_inc)
+ f.write(reg_apis)
+ f.write(unreg_apis)
platform_sources.append('register_platform_apis.gen.cpp')
lib = env.add_library('platform', platform_sources)
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template
index 9d8eb951c4..21dfb87e1c 100644
--- a/platform/android/AndroidManifest.xml.template
+++ b/platform/android/AndroidManifest.xml.template
@@ -16,7 +16,8 @@
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:screenOrientation="landscape"
- android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize">
+ android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize"
+ android:resizeableActivity="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -31,7 +32,7 @@
$$ADD_APPLICATION_CHUNKS$$
</application>
- <uses-feature android:glEsVersion="0x00030000"/>
+ <uses-feature android:glEsVersion="0x00020000" android:required="true" />
$$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.ACCESS_CHECKIN_PROPERTIES"/>
@@ -200,6 +201,6 @@ $$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.custom.18"/>
<uses-permission android:name="godot.custom.19"/>
-<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="23"/>
+<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="27"/>
</manifest>
diff --git a/platform/android/SCsub b/platform/android/SCsub
index d2285a82dd..8c08289932 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -41,10 +41,8 @@ prog = None
abspath = env.Dir(".").abspath
-gradle_basein = open_utf8(abspath + "/build.gradle.template", "r")
-gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w")
-
-gradle_text = gradle_basein.read()
+with open_utf8(abspath + "/build.gradle.template", "r") as gradle_basein:
+ gradle_text = gradle_basein.read()
gradle_maven_flat_text = ""
if len(env.android_flat_dirs) > 0:
@@ -131,17 +129,19 @@ gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_co
gradle_text = gradle_text.replace("$$GRADLE_PLUGINS$$", gradle_plugins)
gradle_text = gradle_text.replace("$$GRADLE_CLASSPATH$$", gradle_classpath)
-gradle_baseout.write(gradle_text)
-gradle_baseout.close()
+with open_utf8(abspath + "/java/build.gradle", "w") as gradle_baseout:
+ gradle_baseout.write(gradle_text)
+
+with open_utf8(abspath + "/AndroidManifest.xml.template", "r") as pp_basein:
+ manifest = pp_basein.read()
-pp_basein = open_utf8(abspath + "/AndroidManifest.xml.template", "r")
-pp_baseout = open_utf8(abspath + "/java/AndroidManifest.xml", "w")
-manifest = pp_basein.read()
manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk)
manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk)
manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattributes_chunk)
-pp_baseout.write(manifest)
+
+with open_utf8(abspath + "/java/AndroidManifest.xml", "w") as pp_baseout:
+ pp_baseout.write(manifest)
lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index bc77a4e729..e6bd3ff253 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -271,4 +271,5 @@ AudioDriverOpenSL::AudioDriverOpenSL() {
s_ad = this;
mutex = Mutex::create(); //NULL;
pause = false;
+ active = false;
}
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 7269e658b4..cc45fee95f 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -21,7 +21,6 @@ allprojects {
}
dependencies {
- compile 'com.android.support:support-v4:27.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
$$GRADLE_DEPENDENCIES$$
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 6b4d0ff8c4..9e6377f4fe 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -301,8 +301,7 @@ class EditorExportAndroid : public EditorExportPlatform {
args.push_back("-s");
args.push_back(d.id);
args.push_back("shell");
- args.push_back("cat");
- args.push_back("/system/build.prop");
+ args.push_back("getprop");
int ec;
String dp;
@@ -315,7 +314,14 @@ class EditorExportAndroid : public EditorExportPlatform {
d.api_level = 0;
for (int j = 0; j < props.size(); j++) {
+ // got information by `shell cat /system/build.prop` before and its format is "property=value"
+ // it's now changed to use `shell getporp` because of permission issue with Android 8.0 and above
+ // its format is "[property]: [value]" so changed it as like build.prop
String p = props[j];
+ p = p.replace("]: ", "=");
+ p = p.replace("[", "");
+ p = p.replace("]", "");
+
if (p.begins_with("ro.product.model=")) {
device = p.get_slice("=", 1).strip_edges();
} else if (p.begins_with("ro.product.brand=")) {
@@ -1017,7 +1023,7 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "apk"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "version/code", PROPERTY_HINT_RANGE, "1,65535,1"), 1));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "version/code", PROPERTY_HINT_RANGE, "1,4096,1,or_greater"), 1));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "version/name"), "1.0"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/unique_name"), "org.godotengine.$genname"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/name"), ""));
@@ -1147,7 +1153,7 @@ public:
String package_name = p_preset->get("package/unique_name");
if (remove_prev) {
- ep.step("Uninstalling..", 1);
+ ep.step("Uninstalling...", 1);
print_line("Uninstalling previous version: " + devices[p_device].name);
@@ -1226,7 +1232,7 @@ public:
}
}
- ep.step("Running on Device..", 3);
+ ep.step("Running on Device...", 3);
args.clear();
args.push_back("-s");
args.push_back(devices[p_device].id);
@@ -1317,6 +1323,8 @@ public:
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+
String src_apk;
EditorProgress ep("export", "Exporting for Android", 105);
@@ -1484,7 +1492,7 @@ public:
ret = unzGoToNextFile(pkg);
}
- ep.step("Adding Files..", 1);
+ ep.step("Adding Files...", 1);
Error err = OK;
Vector<String> cl = cmdline.strip_edges().split(" ");
for (int i = 0; i < cl.size(); i++) {
@@ -1618,14 +1626,14 @@ public:
password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass");
user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
- ep.step("Signing Debug APK..", 103);
+ ep.step("Signing Debug APK...", 103);
} else {
keystore = release_keystore;
password = release_password;
user = release_username;
- ep.step("Signing Release APK..", 103);
+ ep.step("Signing Release APK...", 103);
}
if (!FileAccess::exists(keystore)) {
@@ -1635,9 +1643,9 @@ public:
List<String> args;
args.push_back("-digestalg");
- args.push_back("SHA1");
+ args.push_back("SHA-256");
args.push_back("-sigalg");
- args.push_back("MD5withRSA");
+ args.push_back("SHA256withRSA");
String tsa_url = EditorSettings::get_singleton()->get("export/android/timestamping_authority_url");
if (tsa_url != "") {
args.push_back("-tsa");
@@ -1657,7 +1665,7 @@ public:
return ERR_CANT_CREATE;
}
- ep.step("Verifying APK..", 104);
+ ep.step("Verifying APK...", 104);
args.clear();
args.push_back("-verify");
@@ -1677,7 +1685,7 @@ public:
static const int ZIP_ALIGNMENT = 4;
- ep.step("Aligning APK..", 105);
+ ep.step("Aligning APK...", 105);
unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
if (!tmp_unaligned) {
diff --git a/platform/android/java/res/drawable-hdpi/notify_panel_notification_icon_bg.png b/platform/android/java/res/drawable-hdpi/notify_panel_notification_icon_bg.png
index 94bc406416..372b763ec5 100644
--- a/platform/android/java/res/drawable-hdpi/notify_panel_notification_icon_bg.png
+++ b/platform/android/java/res/drawable-hdpi/notify_panel_notification_icon_bg.png
Binary files differ
diff --git a/platform/android/java/res/drawable-mdpi/notify_panel_notification_icon_bg.png b/platform/android/java/res/drawable-mdpi/notify_panel_notification_icon_bg.png
index ef6fe4e836..c61c440636 100644
--- a/platform/android/java/res/drawable-mdpi/notify_panel_notification_icon_bg.png
+++ b/platform/android/java/res/drawable-mdpi/notify_panel_notification_icon_bg.png
Binary files differ
diff --git a/platform/android/java/res/drawable/icon.png b/platform/android/java/res/drawable/icon.png
index 29c4a7b8fc..6ad9b43117 100644
--- a/platform/android/java/res/drawable/icon.png
+++ b/platform/android/java/res/drawable/icon.png
Binary files differ
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
index 73e6f83bec..a9f674803c 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
@@ -27,7 +27,6 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.os.Messenger;
-import android.support.v4.app.NotificationCompat;
/**
* This class handles displaying the notification associated with the download
@@ -49,9 +48,8 @@ public class DownloadNotification implements IDownloaderClient {
private IDownloaderClient mClientProxy;
final ICustomNotification mCustomNotification;
- // NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16.
- private NotificationCompat.Builder mNotificationBuilder;
- private NotificationCompat.Builder mCurrentNotificationBuilder;
+ private Notification.Builder mNotificationBuilder;
+ private Notification.Builder mCurrentNotificationBuilder;
private CharSequence mLabel;
private String mCurrentText;
private PendingIntent mContentIntent;
@@ -187,7 +185,7 @@ public class DownloadNotification implements IDownloaderClient {
void setTimeRemaining(long timeRemaining);
- NotificationCompat.Builder updateNotification(Context c);
+ Notification.Builder updateNotification(Context c);
}
/**
@@ -220,7 +218,7 @@ public class DownloadNotification implements IDownloaderClient {
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mCustomNotification = CustomNotificationFactory
.createCustomNotification();
- mNotificationBuilder = new NotificationCompat.Builder(ctx);
+ mNotificationBuilder = new Notification.Builder(ctx);
mCurrentNotificationBuilder = mNotificationBuilder;
}
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
index 390bde96e9..56b2331e31 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
@@ -22,7 +22,6 @@ import com.google.android.vending.expansion.downloader.Helpers;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
-import android.support.v4.app.NotificationCompat;
public class V14CustomNotification implements DownloadNotification.ICustomNotification {
@@ -54,14 +53,13 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi
mCurrentKB = currentBytes;
}
- void setProgress(NotificationCompat.Builder builder) {
+ void setProgress(Notification.Builder builder) {
}
@Override
- public NotificationCompat.Builder updateNotification(Context c) {
- // NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16.
- NotificationCompat.Builder builder = new NotificationCompat.Builder(c);
+ public Notification.Builder updateNotification(Context c) {
+ Notification.Builder builder = new Notification.Builder(c);
builder.setContentTitle(mTitle);
if (mTotalKB > 0 && -1 != mCurrentKB) {
builder.setProgress((int) (mTotalKB >> 8), (int) (mCurrentKB >> 8), false);
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index 90848e6a90..8a2d789dc5 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -32,6 +32,7 @@ package org.godotengine.godot;
import android.R;
import android.app.Activity;
+import android.content.pm.ConfigurationInfo;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
@@ -246,9 +247,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
};
- public void onVideoInit(boolean use_gl2) {
+ public void onVideoInit() {
- //mView = new GodotView(getApplication(),io,use_gl2);
+ boolean use_gl3 = getGLESVersionCode() >= 0x00030000;
+
+ //mView = new GodotView(getApplication(),io,use_gl3);
//setContentView(mView);
layout = new FrameLayout(this);
@@ -261,7 +264,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
// ...add to FrameLayout
layout.addView(edittext);
- mView = new GodotView(getApplication(), io, use_gl2, use_32_bits, this);
+ mView = new GodotView(getApplication(), io, use_gl3, use_32_bits, this);
layout.addView(mView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
edittext.setView(mView);
io.setEdit(edittext);
@@ -338,6 +341,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
return Godot._self;
}
+ public int getGLESVersionCode() {
+ ActivityManager am = (ActivityManager)Godot.getInstance().getSystemService(Context.ACTIVITY_SERVICE);
+ ConfigurationInfo deviceInfo = am.getDeviceConfigurationInfo();
+ return deviceInfo.reqGlEsVersion;
+ }
+
private String[] getCommandLine() {
InputStream is;
try {
diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
index d72c590378..bde4221644 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
@@ -101,12 +101,12 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
GodotLib.calldeferred(purchaseCallbackId, "consume_not_required", new Object[] {});
}
- public void callbackFailConsume() {
- GodotLib.calldeferred(purchaseCallbackId, "consume_fail", new Object[] {});
+ public void callbackFailConsume(String message) {
+ GodotLib.calldeferred(purchaseCallbackId, "consume_fail", new Object[] { message });
}
- public void callbackFail() {
- GodotLib.calldeferred(purchaseCallbackId, "purchase_fail", new Object[] {});
+ public void callbackFail(String message) {
+ GodotLib.calldeferred(purchaseCallbackId, "purchase_fail", new Object[] { message });
}
public void callbackCancel() {
@@ -165,11 +165,11 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
}
public void callbackDisconnected() {
- GodotLib.calldeferred(purchaseCallbackId, "iap_disconnected", new Object[]{});
+ GodotLib.calldeferred(purchaseCallbackId, "iap_disconnected", new Object[] {});
}
public void callbackConnected() {
- GodotLib.calldeferred(purchaseCallbackId, "iap_connected", new Object[]{});
+ GodotLib.calldeferred(purchaseCallbackId, "iap_connected", new Object[] {});
}
// true if connected, false otherwise
diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java
index 0222758c2b..23723c2696 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotView.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotView.java
@@ -261,7 +261,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
};
int source = event.getSource();
- if ((source & InputDevice.SOURCE_JOYSTICK) != 0 || (source & InputDevice.SOURCE_DPAD) != 0 || (source & InputDevice.SOURCE_GAMEPAD) != 0) {
+ if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
final int button = get_godot_button(keyCode);
final int device = find_joy_device(event.getDeviceId());
@@ -302,7 +302,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
int source = event.getSource();
//Log.e(TAG, String.format("Key down! source %d, device %d, joystick %d, %d, %d", event.getDeviceId(), source, (source & InputDevice.SOURCE_JOYSTICK), (source & InputDevice.SOURCE_DPAD), (source & InputDevice.SOURCE_GAMEPAD)));
- if ((source & InputDevice.SOURCE_JOYSTICK) != 0 || (source & InputDevice.SOURCE_DPAD) != 0 || (source & InputDevice.SOURCE_GAMEPAD) != 0) {
+ if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
if (event.getRepeatCount() > 0) // ignore key echo
return true;
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
index 441a311358..b7bf2362cc 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
@@ -116,7 +116,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
@Override
@@ -148,7 +148,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
Log.d("godot", "consumeUnconsumedPurchases :" + message);
- godotPaymentV3.callbackFailConsume();
+ godotPaymentV3.callbackFailConsume(message);
}
@Override
@@ -222,7 +222,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
}
.consume(sku);
@@ -231,7 +231,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
@Override
@@ -258,7 +258,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
}
.consume(sku);
@@ -266,7 +266,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFail();
+ godotPaymentV3.callbackFail(message);
}
@Override
@@ -291,7 +291,7 @@ public class PaymentsManager {
@Override
protected void error(String message) {
- godotPaymentV3.callbackFailConsume();
+ godotPaymentV3.callbackFailConsume(message);
}
}
.consume(sku);
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 9baf58c3eb..e6240ad9e9 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -614,6 +614,7 @@ static jmethodID _hideKeyboard = 0;
static jmethodID _setScreenOrientation = 0;
static jmethodID _getUniqueID = 0;
static jmethodID _getSystemDir = 0;
+static jmethodID _getGLESVersionCode = 0;
static jmethodID _playVideo = 0;
static jmethodID _isVideoPlaying = 0;
static jmethodID _pauseVideo = 0;
@@ -685,6 +686,11 @@ static String _get_system_dir(int p_dir) {
return String(env->GetStringUTFChars(s, NULL));
}
+static int _get_gles_version_code() {
+ JNIEnv *env = ThreadAndroid::get_env();
+ return env->CallIntMethod(_godot_instance, _getGLESVersionCode);
+}
+
static void _hide_vk() {
JNIEnv *env = ThreadAndroid::get_env();
@@ -764,9 +770,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
godot_io = gob;
- _on_video_init = env->GetMethodID(cls, "onVideoInit", "(Z)V");
+ _on_video_init = env->GetMethodID(cls, "onVideoInit", "()V");
_setKeepScreenOn = env->GetMethodID(cls, "setKeepScreenOn", "(Z)V");
_alertDialog = env->GetMethodID(cls, "alert", "(Ljava/lang/String;Ljava/lang/String;)V");
+ _getGLESVersionCode = env->GetMethodID(cls, "getGLESVersionCode", "()I");
jclass clsio = env->FindClass("org/godotengine/godot/Godot");
if (cls) {
@@ -800,16 +807,13 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
AudioDriverAndroid::setup(gob);
}
- os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
+ os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion);
os_android->set_need_reload_hooks(p_need_reload_hook);
char wd[500];
getcwd(wd, 500);
- //video driver is determined here, because once initialized, it can't be changed
- // String vd = ProjectSettings::get_singleton()->get("display/driver");
-
- env->CallVoidMethod(_godot_instance, _on_video_init, (jboolean) true);
+ env->CallVoidMethod(_godot_instance, _on_video_init);
}
static void _initialize_java_modules() {
@@ -936,6 +940,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *en
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, jobject obj) {
+ if (step == 0)
+ return;
+
os_android->main_loop_request_go_back();
}
@@ -976,6 +983,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jobject obj, jint ev, jint pointer, jint count, jintArray positions) {
+ if (step == 0)
+ return;
+
Vector<OS_Android::TouchPos> points;
for (int i = 0; i < count; i++) {
@@ -1250,6 +1260,8 @@ static unsigned int android_get_keysym(unsigned int p_code) {
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env, jobject obj, jint p_device, jint p_button, jboolean p_pressed) {
+ if (step == 0)
+ return;
OS_Android::JoypadEvent jevent;
jevent.device = p_device;
@@ -1261,6 +1273,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jobject obj, jint p_device, jint p_axis, jfloat p_value) {
+ if (step == 0)
+ return;
OS_Android::JoypadEvent jevent;
jevent.device = p_device;
@@ -1272,6 +1286,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) {
+ if (step == 0)
+ return;
+
OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_HAT;
@@ -1301,6 +1318,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed) {
+ if (step == 0)
+ return;
Ref<InputEventKey> ievent;
ievent.instance();
@@ -1344,14 +1363,18 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv *env
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv *env, jobject obj) {
- if (os_android && step > 0)
- os_android->main_loop_focusin();
+ if (step == 0)
+ return;
+
+ os_android->main_loop_focusin();
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, jobject obj) {
- if (os_android && step > 0)
- os_android->main_loop_focusout();
+ if (step == 0)
+ return;
+
+ os_android->main_loop_focusout();
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv *env, jobject obj) {
diff --git a/platform/android/logo.png b/platform/android/logo.png
index fcf684c026..ba2a0e366a 100644
--- a/platform/android/logo.png
+++ b/platform/android/logo.png
Binary files differ
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 67ce796279..9188f09f21 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -32,6 +32,7 @@
#include "core/io/file_access_buffered_fa.h"
#include "core/project_settings.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/unix/dir_access_unix.h"
#include "drivers/unix/file_access_unix.h"
@@ -125,15 +126,20 @@ void OS_Android::set_opengl_extensions(const char *p_gl_extensions) {
Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
- use_gl2 = p_video_driver != 1;
+ bool use_gl3 = get_gl_version_code_func() >= 0x00030000;
+ use_gl3 = use_gl3 && (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3");
+ use_gl2 = !use_gl3;
if (gfx_init_func)
gfx_init_func(gfx_init_ud, use_gl2);
- AudioDriverManager::add_driver(&audio_driver_android);
-
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
+ if (use_gl2) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } else {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ }
visual_server = memnew(VisualServerRaster);
/* if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
@@ -332,17 +338,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
if (touch.size()) {
//end all if exist
- {
- Ref<InputEventMouseButton> ev;
- ev.instance();
- ev->set_button_index(BUTTON_LEFT);
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_pressed(false);
- ev->set_position(touch[0].pos);
- ev->set_global_position(touch[0].pos);
- input->parse_input_event(ev);
- }
-
for (int i = 0; i < touch.size(); i++) {
Ref<InputEventScreenTouch> ev;
@@ -360,21 +355,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
touch[i].pos = p_points[i].pos;
}
- {
- //send mouse
- Ref<InputEventMouseButton> ev;
- ev.instance();
- // ev.type = Ref<InputEvent>::MOUSE_BUTTON;
- ev->set_button_index(BUTTON_LEFT);
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_pressed(true);
- ev->set_position(touch[0].pos);
- ev->set_global_position(touch[0].pos);
- input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
- last_mouse = touch[0].pos;
- input->parse_input_event(ev);
- }
-
//send touch
for (int i = 0; i < touch.size(); i++) {
@@ -389,19 +369,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
} break;
case 1: { //motion
- if (p_points.size()) {
- //send mouse, should look for point 0?
- Ref<InputEventMouseMotion> ev;
- ev.instance();
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_position(p_points[0].pos);
- input->set_mouse_position(Point2(ev->get_position().x, ev->get_position().y));
- ev->set_speed(input->get_last_mouse_speed());
- ev->set_relative(p_points[0].pos - last_mouse);
- last_mouse = p_points[0].pos;
- input->parse_input_event(ev);
- }
-
ERR_FAIL_COND(touch.size() != p_points.size());
for (int i = 0; i < touch.size(); i++) {
@@ -434,16 +401,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
if (touch.size()) {
//end all if exist
- Ref<InputEventMouseButton> ev;
- ev.instance();
- ev->set_button_index(BUTTON_LEFT);
- ev->set_button_mask(BUTTON_MASK_LEFT);
- ev->set_pressed(false);
- ev->set_position(touch[0].pos);
- ev->set_global_position(touch[0].pos);
- input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
- input->parse_input_event(ev);
-
for (int i = 0; i < touch.size(); i++) {
Ref<InputEventScreenTouch> ev;
@@ -735,7 +692,7 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) {
return false;
}
-OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) {
+OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) {
use_apk_expansion = p_use_apk_expansion;
default_videomode.width = 800;
@@ -757,6 +714,7 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
get_screen_dpi_func = p_get_screen_dpi_func;
get_unique_id_func = p_get_unique_id;
get_system_dir_func = p_get_sdir_func;
+ get_gl_version_code_func = p_get_gl_version_func;
video_play_func = p_video_play_func;
video_is_playing_func = p_video_is_playing_func;
@@ -775,6 +733,8 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
Vector<Logger *> loggers;
loggers.push_back(memnew(AndroidLogger));
_set_logger(memnew(CompositeLogger(loggers)));
+
+ AudioDriverManager::add_driver(&audio_driver_android);
}
OS_Android::~OS_Android() {
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 12181b3688..ac901d4832 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -58,6 +58,7 @@ typedef void (*ShowVirtualKeyboardFunc)(const String &);
typedef void (*HideVirtualKeyboardFunc)();
typedef void (*SetScreenOrientationFunc)(int);
typedef String (*GetSystemDirFunc)(int);
+typedef int (*GetGLVersionCodeFunc)();
typedef void (*VideoPlayFunc)(const String &);
typedef bool (*VideoIsPlayingFunc)();
@@ -93,7 +94,6 @@ public:
private:
Vector<TouchPos> touch;
- Point2 last_mouse;
GFXInitFunc gfx_init_func;
void *gfx_init_ud;
@@ -127,6 +127,7 @@ private:
SetScreenOrientationFunc set_screen_orientation_func;
GetUniqueIDFunc get_unique_id_func;
GetSystemDirFunc get_system_dir_func;
+ GetGLVersionCodeFunc get_gl_version_code_func;
VideoPlayFunc video_play_func;
VideoIsPlayingFunc video_is_playing_func;
@@ -240,7 +241,7 @@ public:
void joy_connection_changed(int p_device, bool p_connected, String p_name);
virtual bool _check_internal_feature_support(const String &p_feature);
- OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion);
+ OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion);
~OS_Android();
};
diff --git a/platform/android/run_icon.png b/platform/android/run_icon.png
index e53f8e9da5..b687c9ac31 100644
--- a/platform/android/run_icon.png
+++ b/platform/android/run_icon.png
Binary files differ
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 7c62654ef6..2959023204 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -22,7 +22,7 @@ def get_opts():
from SCons.Variables import EnumVariable
return [
- EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
+ EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
]
diff --git a/platform/haiku/logo.png b/platform/haiku/logo.png
index d5d98e4cc6..a2d8e242a6 100644
--- a/platform/haiku/logo.png
+++ b/platform/haiku/logo.png
Binary files differ
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 6b5f30dc41..b96bec16b4 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+import os
Import('env')
@@ -21,6 +22,10 @@ ios_lib = env_ios.add_library('iphone', iphone_lib)
def combine_libs(target=None, source=None, env=None):
lib_path = target[0].srcnode().abspath
- env.Execute('$IPHONEPATH/usr/bin/libtool -static -o "' + lib_path + '" ' + ' '.join([('"' + lib.srcnode().abspath + '"') for lib in source]))
+ if ("OSXCROSS_IOS" in os.environ):
+ libtool = '$IPHONEPATH/usr/bin/${ios_triple}libtool'
+ else:
+ libtool = "$IPHONEPATH/usr/bin/libtool"
+ env.Execute(libtool + ' -static -o "' + lib_path + '" ' + ' '.join([('"' + lib.srcnode().abspath + '"') for lib in source]))
combine_command = env_ios.Command('#bin/libgodot' + env_ios['LIBSUFFIX'], [ios_lib] + env_ios['LIBS'], combine_libs)
diff --git a/platform/iphone/app_delegate.h b/platform/iphone/app_delegate.h
index f14864b5b7..c34b5053d6 100644
--- a/platform/iphone/app_delegate.h
+++ b/platform/iphone/app_delegate.h
@@ -37,6 +37,7 @@
@interface AppDelegate : NSObject <UIApplicationDelegate, GLViewDelegate> {
//@property (strong, nonatomic) UIWindow *window;
ViewController *view_controller;
+ bool is_focus_out;
};
@property(strong, nonatomic) UIWindow *window;
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 5c3799ab09..dd5ce4ab10 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -79,6 +79,7 @@ static ViewController *mainViewController = nil;
}
NSMutableDictionary *ios_joysticks = nil;
+NSMutableArray *pending_ios_joysticks = nil;
- (GCControllerPlayerIndex)getFreePlayerIndex {
bool have_player_1 = false;
@@ -115,6 +116,66 @@ NSMutableDictionary *ios_joysticks = nil;
};
};
+void _ios_add_joystick(GCController *controller, AppDelegate *delegate) {
+ // get a new id for our controller
+ int joy_id = OSIPhone::get_singleton()->get_unused_joy_id();
+ if (joy_id != -1) {
+ // assign our player index
+ if (controller.playerIndex == GCControllerPlayerIndexUnset) {
+ controller.playerIndex = [delegate getFreePlayerIndex];
+ };
+
+ // tell Godot about our new controller
+ OSIPhone::get_singleton()->joy_connection_changed(
+ joy_id, true, [controller.vendorName UTF8String]);
+
+ // add it to our dictionary, this will retain our controllers
+ [ios_joysticks setObject:controller
+ forKey:[NSNumber numberWithInt:joy_id]];
+
+ // set our input handler
+ [delegate setControllerInputHandler:controller];
+ } else {
+ printf("Couldn't retrieve new joy id\n");
+ };
+}
+
+static void on_focus_out(ViewController *view_controller, bool *is_focus_out) {
+ if (!*is_focus_out) {
+ *is_focus_out = true;
+ if (OS::get_singleton()->get_main_loop())
+ OS::get_singleton()->get_main_loop()->notification(
+ MainLoop::NOTIFICATION_WM_FOCUS_OUT);
+
+ [view_controller.view stopAnimation];
+ if (OS::get_singleton()->native_video_is_playing()) {
+ OSIPhone::get_singleton()->native_video_focus_out();
+ }
+
+ AudioDriverCoreAudio *audio = dynamic_cast<AudioDriverCoreAudio *>(AudioDriverCoreAudio::get_singleton());
+ if (audio)
+ audio->stop();
+ }
+}
+
+static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
+ if (*is_focus_out) {
+ *is_focus_out = false;
+ if (OS::get_singleton()->get_main_loop())
+ OS::get_singleton()->get_main_loop()->notification(
+ MainLoop::NOTIFICATION_WM_FOCUS_IN);
+
+ [view_controller.view startAnimation];
+ if (OSIPhone::get_singleton()->native_video_is_playing()) {
+ OSIPhone::get_singleton()->native_video_unpause();
+ }
+
+ AudioDriverCoreAudio *audio = dynamic_cast<AudioDriverCoreAudio *>(AudioDriverCoreAudio::get_singleton());
+ if (audio)
+ audio->start();
+ }
+}
+
- (void)controllerWasConnected:(NSNotification *)notification {
// create our dictionary if we don't have one yet
if (ios_joysticks == nil) {
@@ -127,28 +188,12 @@ NSMutableDictionary *ios_joysticks = nil;
printf("Couldn't retrieve new controller\n");
} else if ([[ios_joysticks allKeysForObject:controller] count] != 0) {
printf("Controller is already registered\n");
+ } else if (frame_count > 1) {
+ _ios_add_joystick(controller, self);
} else {
- // get a new id for our controller
- int joy_id = OSIPhone::get_singleton()->get_unused_joy_id();
- if (joy_id != -1) {
- // assign our player index
- if (controller.playerIndex == GCControllerPlayerIndexUnset) {
- controller.playerIndex = [self getFreePlayerIndex];
- };
-
- // tell Godot about our new controller
- OSIPhone::get_singleton()->joy_connection_changed(
- joy_id, true, [controller.vendorName UTF8String]);
-
- // add it to our dictionary, this will retain our controllers
- [ios_joysticks setObject:controller
- forKey:[NSNumber numberWithInt:joy_id]];
-
- // set our input handler
- [self setControllerInputHandler:controller];
- } else {
- printf("Couldn't retrieve new joy id\n");
- };
+ if (pending_ios_joysticks == nil)
+ pending_ios_joysticks = [[NSMutableArray alloc] init];
+ [pending_ios_joysticks addObject:controller];
};
};
@@ -352,6 +397,27 @@ NSMutableDictionary *ios_joysticks = nil;
[ios_joysticks dealloc];
ios_joysticks = nil;
};
+
+ if (pending_ios_joysticks != nil) {
+ [pending_ios_joysticks dealloc];
+ pending_ios_joysticks = nil;
+ };
+};
+
+OS::VideoMode _get_video_mode() {
+ int backingWidth;
+ int backingHeight;
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
+ GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
+ GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+
+ OS::VideoMode vm;
+ vm.fullscreen = true;
+ vm.width = backingWidth;
+ vm.height = backingHeight;
+ vm.resizable = false;
+ return vm;
};
static int frame_count = 0;
@@ -360,19 +426,7 @@ static int frame_count = 0;
switch (frame_count) {
case 0: {
- int backingWidth;
- int backingHeight;
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
- GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
- GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
- OS::VideoMode vm;
- vm.fullscreen = true;
- vm.width = backingWidth;
- vm.height = backingHeight;
- vm.resizable = false;
- OS::get_singleton()->set_video_mode(vm);
+ OS::get_singleton()->set_video_mode(_get_video_mode());
if (!OS::get_singleton()) {
exit(0);
@@ -410,6 +464,14 @@ static int frame_count = 0;
Main::setup2();
++frame_count;
+ if (pending_ios_joysticks != nil) {
+ for (GCController *controller in pending_ios_joysticks) {
+ _ios_add_joystick(controller, self);
+ }
+ [pending_ios_joysticks dealloc];
+ pending_ios_joysticks = nil;
+ }
+
// this might be necessary before here
NSDictionary *dict = [[NSBundle mainBundle] infoDictionary];
for (NSString *key in dict) {
@@ -543,6 +605,8 @@ static int frame_count = 0;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CGRect rect = [[UIScreen mainScreen] bounds];
+ is_focus_out = false;
+
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
// disable idle timer
// application.idleTimerDisabled = YES;
@@ -562,18 +626,13 @@ static int frame_count = 0;
//[glView setAutoresizingMask:UIViewAutoresizingFlexibleWidth |
// UIViewAutoresizingFlexibleWidth];
- int backingWidth;
- int backingHeight;
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
- GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
- GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+ OS::VideoMode vm = _get_video_mode();
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
- int err = iphone_main(backingWidth, backingHeight, gargc, gargv, String::utf8([documentsDirectory UTF8String]));
+ int err = iphone_main(vm.width, vm.height, gargc, gargv, String::utf8([documentsDirectory UTF8String]));
if (err != 0) {
// bail, things did not go very well for us, should probably output a message on screen with our error code...
exit(0);
@@ -607,6 +666,12 @@ static int frame_count = 0;
[self initGameControllers];
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(onAudioInterruption:)
+ name:AVAudioSessionInterruptionNotification
+ object:[AVAudioSession sharedInstance]];
+
// OSIPhone::screen_width = rect.size.width - rect.origin.x;
// OSIPhone::screen_height = rect.size.height - rect.origin.y;
@@ -618,6 +683,18 @@ static int frame_count = 0;
return TRUE;
};
+- (void)onAudioInterruption:(NSNotification *)notification {
+ if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {
+ if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeBegan]]) {
+ NSLog(@"Audio interruption began");
+ on_focus_out(view_controller, &is_focus_out);
+ } else if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeEnded]]) {
+ NSLog(@"Audio interruption ended");
+ on_focus_in(view_controller, &is_focus_out);
+ }
+ }
+};
+
- (void)applicationWillTerminate:(UIApplication *)application {
[self deinitGameControllers];
@@ -632,44 +709,22 @@ static int frame_count = 0;
iphone_finish();
};
-- (void)applicationDidEnterBackground:(UIApplication *)application {
- ///@TODO maybe add pause motionManager? and where would we unpause it?
-
- if (OS::get_singleton()->get_main_loop())
- OS::get_singleton()->get_main_loop()->notification(
- MainLoop::NOTIFICATION_WM_FOCUS_OUT);
+// When application goes to background (e.g. user switches to another app or presses Home),
+// then applicationWillResignActive -> applicationDidEnterBackground are called.
+// When user opens the inactive app again,
+// applicationWillEnterForeground -> applicationDidBecomeActive are called.
- [view_controller.view stopAnimation];
- if (OS::get_singleton()->native_video_is_playing()) {
- OSIPhone::get_singleton()->native_video_focus_out();
- };
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application {
- // OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
- [view_controller.view startAnimation];
-}
+// There are cases when applicationWillResignActive -> applicationDidBecomeActive
+// sequence is called without the app going to background. For example, that happens
+// if you open the app list without switching to another app or open/close the
+// notification panel by swiping from the upper part of the screen.
- (void)applicationWillResignActive:(UIApplication *)application {
- // OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
- [view_controller.view
- stopAnimation]; // FIXME: pause seems to be recommended elsewhere
+ on_focus_out(view_controller, &is_focus_out);
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
- if (OS::get_singleton()->get_main_loop())
- OS::get_singleton()->get_main_loop()->notification(
- MainLoop::NOTIFICATION_WM_FOCUS_IN);
-
- [view_controller.view
- startAnimation]; // FIXME: resume seems to be recommended elsewhere
- if (OSIPhone::get_singleton()->native_video_is_playing()) {
- OSIPhone::get_singleton()->native_video_unpause();
- };
-
- // Fixed audio can not resume if it is interrupted cause by an incoming phone call
- if (AudioDriverCoreAudio::get_singleton() != NULL)
- AudioDriverCoreAudio::get_singleton()->start();
+ on_focus_in(view_controller, &is_focus_out);
}
- (void)dealloc {
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index e3119814f4..4c1e02baf7 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -147,6 +147,26 @@ Vector<EditorExportPlatformIOS::ExportArchitecture> EditorExportPlatformIOS::_ge
return archs;
}
+struct LoadingScreenInfo {
+ const char *preset_key;
+ const char *export_name;
+};
+
+static const LoadingScreenInfo loading_screen_infos[] = {
+ { "landscape_launch_screens/iphone_2436x1125", "Default-Landscape-X.png" },
+ { "landscape_launch_screens/iphone_2208x1242", "Default-Landscape-736h@3x.png" },
+ { "landscape_launch_screens/ipad_1024x768", "Default-Landscape.png" },
+ { "landscape_launch_screens/ipad_2048x1536", "Default-Landscape@2x.png" },
+
+ { "portrait_launch_screens/iphone_640x960", "Default-480h@2x.png" },
+ { "portrait_launch_screens/iphone_640x1136", "Default-568h@2x.png" },
+ { "portrait_launch_screens/iphone_750x1334", "Default-667h@2x.png" },
+ { "portrait_launch_screens/iphone_1125x2436", "Default-Portrait-X.png" },
+ { "portrait_launch_screens/ipad_768x1024", "Default-Portrait.png" },
+ { "portrait_launch_screens/ipad_1536x2048", "Default-Portrait@2x.png" },
+ { "portrait_launch_screens/iphone_1242x2208", "Default-Portrait-736h@3x.png" }
+};
+
void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), ""));
@@ -172,6 +192,7 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/iphone_120x120", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone/iPod Touch with retina display
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/ipad_76x76", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "required_icons/app_store_1024x1024", PROPERTY_HINT_FILE, "png"), "")); // App Store
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/iphone_180x180", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPhone with retina HD display
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/ipad_152x152", PROPERTY_HINT_FILE, "png"), "")); // Home screen on iPad with retina display
@@ -179,15 +200,9 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_40x40", PROPERTY_HINT_FILE, "png"), "")); // Spotlight
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "optional_icons/spotlight_80x80", PROPERTY_HINT_FILE, "png"), "")); // Spotlight on devices with retina display
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/iphone_2208x1242", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6 Plus, 6s Plus, 7 Plus
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/ipad_2732x2048", PROPERTY_HINT_FILE, "png"), "")); // 12.9-inch iPad Pro
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "landscape_launch_screens/ipad_2048x1536", PROPERTY_HINT_FILE, "png"), "")); // Other iPads
-
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_640x1136", PROPERTY_HINT_FILE, "png"), "")); // iPhone 5, 5s, SE
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_750x1334", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6, 6s, 7
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/iphone_1242x2208", PROPERTY_HINT_FILE, "png"), "")); // iPhone 6 Plus, 6s Plus, 7 Plus
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/ipad_2048x2732", PROPERTY_HINT_FILE, "png"), "")); // 12.9-inch iPad Pro
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "portrait_launch_screens/ipad_1536x2048", PROPERTY_HINT_FILE, "png"), "")); // Other iPads
+ for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "png"), ""));
+ }
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false));
@@ -313,6 +328,7 @@ static const IconInfo icon_infos[] = {
{ "required_icons/iphone_120x120", "iphone", "Icon-120.png", "120", "3x", "40x40", true },
{ "required_icons/ipad_76x76", "ipad", "Icon-76.png", "76", "1x", "76x76", false },
+ { "required_icons/app_store_1024x1024", "ios-marketing", "Icon-1024.png", "1024", "1x", "1024x1024", false },
{ "optional_icons/iphone_180x180", "iphone", "Icon-180.png", "180", "3x", "60x60", false },
@@ -380,23 +396,6 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr
return OK;
}
-struct LoadingScreenInfo {
- const char *preset_key;
- const char *export_name;
-};
-
-static const LoadingScreenInfo loading_screen_infos[] = {
- { "landscape_launch_screens/iphone_2208x1242", "Default-Landscape-736h@3x.png" },
- { "landscape_launch_screens/ipad_2732x2048", "Default-Landscape-1366h@2x.png" },
- { "landscape_launch_screens/ipad_2048x1536", "Default-Landscape@2x.png" },
-
- { "portrait_launch_screens/iphone_640x1136", "Default-568h@2x.png" },
- { "portrait_launch_screens/iphone_750x1334", "Default-667h@2x.png" },
- { "portrait_launch_screens/iphone_1242x2208", "Default-Portrait-736h@3x.png" },
- { "portrait_launch_screens/ipad_2048x2732", "Default-Portrait-1366h@2x.png" },
- { "portrait_launch_screens/ipad_1536x2048", "Default-Portrait@2x.png" }
-};
-
Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) {
DirAccess *da = DirAccess::open(p_dest_dir);
ERR_FAIL_COND_V(!da, ERR_CANT_OPEN);
@@ -404,12 +403,14 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre
for (int i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
LoadingScreenInfo info = loading_screen_infos[i];
String loading_screen_file = p_preset->get(info.preset_key);
- Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name);
- if (err) {
- memdelete(da);
- String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file;
- ERR_PRINT(err_str.utf8().get_data());
- return err;
+ if (loading_screen_file.size() > 0) {
+ Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name);
+ if (err) {
+ memdelete(da);
+ String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file;
+ ERR_PRINT(err_str.utf8().get_data());
+ return err;
+ }
}
}
memdelete(da);
@@ -887,7 +888,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
if (err)
return err;
- err = _export_loading_screens(p_preset, dest_dir + binary_name + "/");
+ err = _export_loading_screens(p_preset, dest_dir + binary_name + "/Images.xcassets/LaunchImage.launchimage/");
if (err)
return err;
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index 85376ebc08..0d101eb696 100644
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -83,6 +83,8 @@
@property(strong, nonatomic) MPMoviePlayerController *moviePlayerController;
@property(strong, nonatomic) UIWindow *backgroundWindow;
+@property(nonatomic) UITextAutocorrectionType autocorrectionType;
+
- (void)startAnimation;
- (void)stopAnimation;
- (void)drawView;
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 69116c64c6..478a3125af 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -78,6 +78,16 @@ void _hide_keyboard() {
keyboard_text = "";
};
+Rect2 _get_ios_window_safe_area(float p_window_width, float p_window_height) {
+ UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0);
+ if (_instance != nil && [_instance respondsToSelector:@selector(safeAreaInsets)]) {
+ insets = [_instance safeAreaInsets];
+ }
+ ERR_FAIL_COND_V(insets.left < 0 || insets.top < 0 || insets.right < 0 || insets.bottom < 0,
+ Rect2(0, 0, p_window_width, p_window_height));
+ return Rect2(insets.left, insets.top, p_window_width - insets.right - insets.left, p_window_height - insets.bottom - insets.top);
+}
+
bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
p_path = ProjectSettings::get_singleton()->globalize_path(p_path);
@@ -326,9 +336,7 @@ static void clear_touches() {
// Generate IDs for a framebuffer object and a color renderbuffer
UIScreen *mainscr = [UIScreen mainScreen];
printf("******** screen size %i, %i\n", (int)mainscr.currentMode.size.width, (int)mainscr.currentMode.size.height);
- float minPointSize = MIN(mainscr.bounds.size.width, mainscr.bounds.size.height);
- float minScreenSize = MIN(mainscr.currentMode.size.width, mainscr.currentMode.size.height);
- self.contentScaleFactor = minScreenSize / minPointSize;
+ self.contentScaleFactor = mainscr.nativeScale;
glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);
@@ -489,7 +497,7 @@ static void clear_touches() {
int tid = get_touch_id(touch);
ERR_FAIL_COND(tid == -1);
CGPoint touchPoint = [touch locationInView:self];
- OSIPhone::get_singleton()->mouse_button(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1, tid == 0);
+ OSIPhone::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, true, touch.tapCount > 1);
};
};
}
@@ -506,10 +514,9 @@ static void clear_touches() {
continue;
int tid = get_touch_id(touch);
ERR_FAIL_COND(tid == -1);
- int first = get_first_id(touch);
CGPoint touchPoint = [touch locationInView:self];
CGPoint prev_point = [touch previousLocationInView:self];
- OSIPhone::get_singleton()->mouse_move(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, first == tid);
+ OSIPhone::get_singleton()->touch_drag(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor);
};
};
}
@@ -525,9 +532,9 @@ static void clear_touches() {
continue;
int tid = get_touch_id(touch);
ERR_FAIL_COND(tid == -1);
- int rem = remove_touch(touch);
+ remove_touch(touch);
CGPoint touchPoint = [touch locationInView:self];
- OSIPhone::get_singleton()->mouse_button(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false, rem == 0);
+ OSIPhone::get_singleton()->touch_press(tid, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, false, false);
};
};
}
@@ -627,6 +634,7 @@ static void clear_touches() {
}
init_touches();
self.multipleTouchEnabled = YES;
+ self.autocorrectionType = UITextAutocorrectionTypeNo;
printf("******** adding observer for sound routing changes\n");
[[NSNotificationCenter defaultCenter]
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 7508a480ce..a9748bf562 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -131,6 +131,8 @@ Variant nsobject_to_variant(NSObject *object) {
return Variant([num floatValue]);
} else if (strcmp([num objCType], @encode(double)) == 0) {
return Variant((float)[num doubleValue]);
+ } else {
+ return Variant();
}
} else if ([object isKindOfClass:[NSDate class]]) {
//this is a type that icloud supports...but how did you submit it in the first place?
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index 7d53eaae20..353438676d 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.h
@@ -46,6 +46,7 @@ class InAppStore : public Object {
public:
Error request_product_info(Variant p_params);
+ Error restore_purchases();
Error purchase(Variant p_params);
int get_pending_event_count();
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 9bb3d7d3fa..2cdd477ed1 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -63,6 +63,7 @@ InAppStore *InAppStore::instance = NULL;
void InAppStore::_bind_methods() {
ClassDB::bind_method(D_METHOD("request_product_info"), &InAppStore::request_product_info);
+ ClassDB::bind_method(D_METHOD("restore_purchases"), &InAppStore::restore_purchases);
ClassDB::bind_method(D_METHOD("purchase"), &InAppStore::purchase);
ClassDB::bind_method(D_METHOD("get_pending_event_count"), &InAppStore::get_pending_event_count);
@@ -153,6 +154,14 @@ Error InAppStore::request_product_info(Variant p_params) {
return OK;
};
+Error InAppStore::restore_purchases() {
+
+ printf("restoring purchases!\n");
+ [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
+
+ return OK;
+};
+
@interface TransObserver : NSObject <SKPaymentTransactionObserver> {
};
@end
@@ -229,6 +238,7 @@ Error InAppStore::request_product_info(Variant p_params) {
ret["type"] = "purchase";
ret["result"] = "error";
ret["product_id"] = pid;
+ ret["error"] = String::utf8([transaction.error.localizedDescription UTF8String]);
InAppStore::get_singleton()->_post_event(ret);
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
} break;
@@ -236,6 +246,11 @@ Error InAppStore::request_product_info(Variant p_params) {
printf("status transaction restored!\n");
String pid = String::utf8([transaction.originalTransaction.payment.productIdentifier UTF8String]);
InAppStore::get_singleton()->_record_purchase(pid);
+ Dictionary ret;
+ ret["type"] = "restore";
+ ret["result"] = "ok";
+ ret["product_id"] = pid;
+ InAppStore::get_singleton()->_post_event(ret);
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
} break;
default: {
diff --git a/platform/iphone/logo.png b/platform/iphone/logo.png
index 8dd718524c..405b6f93ca 100644
--- a/platform/iphone/logo.png
+++ b/platform/iphone/logo.png
Binary files differ
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index c284ab6905..f618c80a77 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -123,7 +123,6 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
RasterizerStorageGLES3::system_fbo = gl_view_base_fb;
- AudioDriverManager::add_driver(&audio_driver);
AudioDriverManager::initialize(p_audio_driver);
input = memnew(InputDefault);
@@ -191,7 +190,7 @@ void OSIPhone::key(uint32_t p_key, bool p_pressed) {
queue_event(ev);
};
-void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {
+void OSIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick) {
if (!GLOBAL_DEF("debug/disable_touch", false)) {
Ref<InputEventScreenTouch> ev;
@@ -203,28 +202,10 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
queue_event(ev);
};
- mouse_list.pressed[p_idx] = p_pressed;
-
- if (p_use_as_mouse) {
-
- Ref<InputEventMouseButton> ev;
- ev.instance();
-
- ev->set_position(Vector2(p_x, p_y));
- ev->set_global_position(Vector2(p_x, p_y));
-
- //mouse_list.pressed[p_idx] = p_pressed;
-
- input->set_mouse_position(ev->get_position());
- ev->set_button_index(BUTTON_LEFT);
- ev->set_doubleclick(p_doubleclick);
- ev->set_pressed(p_pressed);
-
- queue_event(ev);
- };
+ touch_list.pressed[p_idx] = p_pressed;
};
-void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse) {
+void OSIPhone::touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y) {
if (!GLOBAL_DEF("debug/disable_touch", false)) {
@@ -235,21 +216,6 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
queue_event(ev);
};
-
- if (p_use_as_mouse) {
- Ref<InputEventMouseMotion> ev;
- ev.instance();
-
- ev->set_position(Vector2(p_x, p_y));
- ev->set_global_position(Vector2(p_x, p_y));
- ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
-
- input->set_mouse_position(ev->get_position());
- ev->set_speed(input->get_last_mouse_speed());
- ev->set_button_mask(BUTTON_LEFT); // pressed
-
- queue_event(ev);
- };
};
void OSIPhone::queue_event(const Ref<InputEvent> &p_event) {
@@ -263,10 +229,10 @@ void OSIPhone::touches_cancelled() {
for (int i = 0; i < MAX_MOUSE_COUNT; i++) {
- if (mouse_list.pressed[i]) {
+ if (touch_list.pressed[i]) {
// send a mouse_up outside the screen
- mouse_button(i, -1, -1, false, false, false);
+ touch_press(i, -1, -1, false, false);
};
};
};
@@ -377,7 +343,7 @@ Point2 OSIPhone::get_mouse_position() const {
int OSIPhone::get_mouse_button_state() const {
- return mouse_list.pressed[0];
+ return 0;
};
void OSIPhone::set_window_title(const String &p_title){};
@@ -505,6 +471,12 @@ Size2 OSIPhone::get_window_size() const {
return Vector2(video_mode.width, video_mode.height);
}
+extern Rect2 _get_ios_window_safe_area(float p_window_width, float p_window_height);
+
+Rect2 OSIPhone::get_window_safe_area() const {
+ return _get_ios_window_safe_area(video_mode.width, video_mode.height);
+}
+
bool OSIPhone::has_touchscreen_ui_hint() const {
return true;
@@ -632,6 +604,8 @@ OSIPhone::OSIPhone(int width, int height, String p_data_dir) {
loggers.push_back(memnew(StdLogger));
#endif
_set_logger(memnew(CompositeLogger(loggers)));
+
+ AudioDriverManager::add_driver(&audio_driver);
};
OSIPhone::~OSIPhone() {
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 2e4458aeed..7d73a6fe5c 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -106,7 +106,7 @@ private:
};
};
- MouseList mouse_list;
+ MouseList touch_list;
Vector3 last_accel;
@@ -127,8 +127,8 @@ public:
uint8_t get_orientations() const;
- void mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse);
- void mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse);
+ void touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick);
+ void touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y);
void touches_cancelled();
void key(uint32_t p_key, bool p_pressed);
void set_virtual_keyboard_height(int p_height);
@@ -177,6 +177,7 @@ public:
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
virtual Size2 get_window_size() const;
+ virtual Rect2 get_window_safe_area() const;
virtual bool has_touchscreen_ui_hint() const;
diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h
index d205c7da83..d9fd61fb6e 100644
--- a/platform/iphone/platform_config.h
+++ b/platform/iphone/platform_config.h
@@ -30,6 +30,7 @@
#include <alloca.h>
+#define GLES2_INCLUDE_H <ES2/gl.h>
#define GLES3_INCLUDE_H <ES3/gl.h>
#define PLATFORM_REFCOUNT
diff --git a/platform/iphone/power_iphone.cpp b/platform/iphone/power_iphone.cpp
index 95a9aa9705..7f9dadc363 100644
--- a/platform/iphone/power_iphone.cpp
+++ b/platform/iphone/power_iphone.cpp
@@ -30,7 +30,7 @@
#include "power_iphone.h"
-bool OS::PowerState::UpdatePowerInfo() {
+bool PowerIphone::UpdatePowerInfo() {
return false;
}
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index 66a8a8d93c..98988d97fd 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -3,38 +3,35 @@
Import('env')
javascript_files = [
- "os_javascript.cpp",
- "audio_driver_javascript.cpp",
- "javascript_main.cpp",
- "power_javascript.cpp",
- "http_client_javascript.cpp",
- "javascript_eval.cpp",
+ 'audio_driver_javascript.cpp',
+ 'http_client_javascript.cpp',
+ 'javascript_eval.cpp',
+ 'javascript_main.cpp',
+ 'os_javascript.cpp',
]
-env_javascript = env.Clone()
-if env['target'] == "profile":
- env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
-
-javascript_objects = []
-for x in javascript_files:
- javascript_objects.append(env_javascript.Object(x))
-
-env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_main_after_fs_sync','_send_notification']\""])
-
-target_dir = env.Dir("#bin")
-build = env.add_program(['#bin/godot', target_dir.File('godot' + env['PROGSUFFIX'] + '.wasm')], javascript_objects, PROGSUFFIX=env['PROGSUFFIX'] + '.js');
+build = env.add_program(['#bin/godot${PROGSUFFIX}.js', '#bin/godot${PROGSUFFIX}.wasm'], javascript_files);
js, wasm = build
-js_libraries = []
-js_libraries.append(env.File('http_request.js'))
+js_libraries = [
+ 'http_request.js',
+]
for lib in js_libraries:
- env.Append(LINKFLAGS=['--js-library', lib.path])
+ env.Append(LINKFLAGS=['--js-library', env.File(lib).path])
env.Depends(build, js_libraries)
wrapper_start = env.File('pre.js')
wrapper_end = env.File('engine.js')
-js_final = env.Textfile('#bin/godot', [wrapper_start, js, wrapper_end], TEXTFILESUFFIX=env['PROGSUFFIX'] + '.wrapped.js')
-
-zip_dir = target_dir.Dir('.javascript_zip')
-zip_files = env.InstallAs([zip_dir.File('godot.js'), zip_dir.File('godot.wasm'), zip_dir.File('godot.html')], [js_final, wasm, '#misc/dist/html/default.html'])
-Zip('#bin/godot', zip_files, ZIPSUFFIX=env['PROGSUFFIX'] + env['ZIPSUFFIX'], ZIPROOT=zip_dir, ZIPCOMSTR="Archving $SOURCES as $TARGET")
+js_wrapped = env.Textfile('#bin/godot', [wrapper_start, js, wrapper_end], TEXTFILESUFFIX='${PROGSUFFIX}.wrapped.js')
+
+zip_dir = env.Dir('#bin/.javascript_zip')
+zip_files = env.InstallAs([
+ zip_dir.File('godot.js'),
+ zip_dir.File('godot.wasm'),
+ zip_dir.File('godot.html')
+], [
+ js_wrapped,
+ wasm,
+ '#misc/dist/html/default.html'
+])
+env.Zip('#bin/godot', zip_files, ZIPROOT=zip_dir, ZIPSUFFIX='${PROGSUFFIX}${ZIPSUFFIX}', ZIPCOMSTR='Archving $SOURCES as $TARGET')
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 5bf345e6cd..7a6613bb32 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -32,113 +32,134 @@
#include <emscripten.h>
-AudioDriverJavaScript *AudioDriverJavaScript::singleton_js = NULL;
+AudioDriverJavaScript *AudioDriverJavaScript::singleton = NULL;
const char *AudioDriverJavaScript::get_name() const {
return "JavaScript";
}
-extern "C" EMSCRIPTEN_KEEPALIVE void js_audio_driver_mix_function(int p_frames) {
+extern "C" EMSCRIPTEN_KEEPALIVE void audio_driver_js_mix() {
- //print_line("MIXI! "+itos(p_frames));
- AudioDriverJavaScript::singleton_js->mix_to_js(p_frames);
+ AudioDriverJavaScript::singleton->mix_to_js();
}
-void AudioDriverJavaScript::mix_to_js(int p_frames) {
+void AudioDriverJavaScript::mix_to_js() {
- int todo = p_frames;
- int offset = 0;
+ int channel_count = get_total_channels_by_speaker_mode(get_speaker_mode());
+ int sample_count = memarr_len(internal_buffer) / channel_count;
+ int32_t *stream_buffer = reinterpret_cast<int32_t *>(internal_buffer);
+ audio_server_process(sample_count, stream_buffer);
+ for (int i = 0; i < sample_count * channel_count; i++) {
+ internal_buffer[i] = float(stream_buffer[i] >> 16) / 32768.0;
+ }
+}
- while (todo) {
+Error AudioDriverJavaScript::init() {
- int tomix = MIN(todo, INTERNAL_BUFFER_SIZE);
+ /* clang-format off */
+ EM_ASM({
+ _audioDriver_audioContext = new (window.AudioContext || window.webkitAudioContext);
+ _audioDriver_scriptNode = null;
+ });
+ /* clang-format on */
- audio_server_process(p_frames, stream_buffer);
- for (int i = 0; i < tomix * internal_buffer_channels; i++) {
- internal_buffer[i] = float(stream_buffer[i] >> 16) / 32768.0;
+ int channel_count = get_total_channels_by_speaker_mode(get_speaker_mode());
+ /* clang-format off */
+ int buffer_length = EM_ASM_INT({
+ var CHANNEL_COUNT = $0;
+
+ var channelCount = _audioDriver_audioContext.destination.channelCount;
+ try {
+ // Try letting the browser recommend a buffer length.
+ _audioDriver_scriptNode = _audioDriver_audioContext.createScriptProcessor(0, 0, channelCount);
+ } catch (e) {
+ // ...otherwise, default to 4096.
+ _audioDriver_scriptNode = _audioDriver_audioContext.createScriptProcessor(4096, 0, channelCount);
}
+ _audioDriver_scriptNode.connect(_audioDriver_audioContext.destination);
- /* clang-format off */
- EM_ASM_ARGS({
- var data = HEAPF32.subarray($0 / 4, $0 / 4 + $2 * 2);
-
- for (var channel = 0; channel < _as_output_buffer.numberOfChannels; channel++) {
- var outputData = _as_output_buffer.getChannelData(channel);
- // Loop through samples
- for (var sample = 0; sample < $2; sample++) {
- // make output equal to the same as the input
- outputData[sample + $1] = data[sample * 2 + channel];
- }
- }
- }, internal_buffer, offset, tomix);
- /* clang-format on */
-
- todo -= tomix;
- offset += tomix;
+ return _audioDriver_scriptNode.bufferSize;
+ }, channel_count);
+ /* clang-format on */
+ if (!buffer_length) {
+ return FAILED;
}
-}
-
-Error AudioDriverJavaScript::init() {
- return OK;
+ if (!internal_buffer || memarr_len(internal_buffer) != buffer_length * channel_count) {
+ if (internal_buffer)
+ memdelete_arr(internal_buffer);
+ internal_buffer = memnew_arr(float, buffer_length *channel_count);
+ }
+ return internal_buffer ? OK : ERR_OUT_OF_MEMORY;
}
void AudioDriverJavaScript::start() {
- internal_buffer = memnew_arr(float, INTERNAL_BUFFER_SIZE *internal_buffer_channels);
- stream_buffer = memnew_arr(int32_t, INTERNAL_BUFFER_SIZE * 4); //max 4 channels
-
/* clang-format off */
- mix_rate = EM_ASM_INT({
- _as_audioctx = new (window.AudioContext || window.webkitAudioContext);
- _as_script_node = _as_audioctx.createScriptProcessor($0, 0, $1);
- _as_script_node.connect(_as_audioctx.destination);
- console.log(_as_script_node.bufferSize);
- var jsAudioDriverMixFunction = cwrap('js_audio_driver_mix_function', null, ['number']);
-
- _as_script_node.onaudioprocess = function(audioProcessingEvent) {
- // The output buffer contains the samples that will be modified and played
- _as_output_buffer = audioProcessingEvent.outputBuffer;
- jsAudioDriverMixFunction([_as_output_buffer.getChannelData(0).length]);
+ EM_ASM({
+ var INTERNAL_BUFFER_PTR = $0;
+
+ var audioDriverMixFunction = cwrap('audio_driver_js_mix');
+ _audioDriver_scriptNode.onaudioprocess = function(audioProcessingEvent) {
+ audioDriverMixFunction();
+ // The output buffer contains the samples that will be modified and played.
+ var output = audioProcessingEvent.outputBuffer;
+ var input = HEAPF32.subarray(
+ INTERNAL_BUFFER_PTR / HEAPF32.BYTES_PER_ELEMENT,
+ INTERNAL_BUFFER_PTR / HEAPF32.BYTES_PER_ELEMENT + output.length * output.numberOfChannels);
+
+ for (var channel = 0; channel < output.numberOfChannels; channel++) {
+ var outputData = output.getChannelData(channel);
+ // Loop through samples.
+ for (var sample = 0; sample < outputData.length; sample++) {
+ // Set output equal to input.
+ outputData[sample] = input[sample * output.numberOfChannels + channel];
+ }
+ }
};
- return _as_audioctx.sampleRate;
- }, INTERNAL_BUFFER_SIZE, internal_buffer_channels);
+ }, internal_buffer);
/* clang-format on */
}
int AudioDriverJavaScript::get_mix_rate() const {
- return mix_rate;
+ /* clang-format off */
+ return EM_ASM_INT_V({
+ return _audioDriver_audioContext.sampleRate;
+ });
+ /* clang-format on */
}
AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const {
- return SPEAKER_MODE_STEREO;
+ /* clang-format off */
+ return get_speaker_mode_by_total_channels(EM_ASM_INT_V({
+ return _audioDriver_audioContext.destination.channelCount;
+ }));
+ /* clang-format on */
}
+// No locking, as threads are not supported.
void AudioDriverJavaScript::lock() {
-
- /*no locking, as threads are not supported
- if (active && mutex)
- mutex->lock();
- */
}
void AudioDriverJavaScript::unlock() {
-
- /*no locking, as threads are not supported
- if (active && mutex)
- mutex->unlock();
- */
}
void AudioDriverJavaScript::finish() {
+
+ /* clang-format off */
+ EM_ASM({
+ _audioDriver_audioContext = null;
+ _audioDriver_scriptNode = null;
+ });
+ /* clang-format on */
+ memdelete_arr(internal_buffer);
+ internal_buffer = NULL;
}
AudioDriverJavaScript::AudioDriverJavaScript() {
- internal_buffer_channels = 2;
- mix_rate = DEFAULT_MIX_RATE;
- singleton_js = this;
+ singleton = this;
}
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index d78ab8eea4..a65a8ec29f 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -35,18 +35,11 @@
class AudioDriverJavaScript : public AudioDriver {
- enum {
- INTERNAL_BUFFER_SIZE = 4096,
- };
-
- int mix_rate;
float *internal_buffer;
- int internal_buffer_channels;
- int32_t *stream_buffer;
public:
- void mix_to_js(int p_frames);
- static AudioDriverJavaScript *singleton_js;
+ void mix_to_js();
+ static AudioDriverJavaScript *singleton;
virtual const char *get_name() const;
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 7e6a1518ed..fc909f6619 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -1,5 +1,4 @@
import os
-import string
import sys
@@ -8,23 +7,22 @@ def is_active():
def get_name():
- return "JavaScript"
+ return 'JavaScript'
def can_build():
-
- return ("EMSCRIPTEN_ROOT" in os.environ or "EMSCRIPTEN" in os.environ)
+ return 'EM_CONFIG' in os.environ or os.path.exists(os.path.expanduser('~/.emscripten'))
def get_opts():
from SCons.Variables import BoolVariable
return [
+ # eval() can be a security concern, so it can be disabled.
BoolVariable('javascript_eval', 'Enable JavaScript eval interface', True),
]
def get_flags():
-
return [
('tools', False),
('module_theora_enabled', False),
@@ -36,24 +34,11 @@ def get_flags():
]
-def create(env):
-
- # remove Windows' .exe suffix
- return env.Clone(tools=['textfile', 'zip'], PROGSUFFIX='')
-
-
-def escape_sources_backslashes(target, source, env, for_signature):
- return [path.replace('\\','\\\\') for path in env.GetBuildPath(source)]
-
-def escape_target_backslashes(target, source, env, for_signature):
- return env.GetBuildPath(target[0]).replace('\\','\\\\')
-
-
def configure(env):
## Build type
- if (env["target"] == "release"):
+ if env['target'] != 'debug':
# Use -Os to prioritize optimizing for reduced file size. This is
# particularly valuable for the web platform because it directly
# decreases download time.
@@ -62,65 +47,96 @@ def configure(env):
# run-time performance.
env.Append(CCFLAGS=['-Os'])
env.Append(LINKFLAGS=['-Os'])
-
- elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
- env.Append(LINKFLAGS=['-O2', '-s', 'ASSERTIONS=1'])
- # retain function names at the cost of file size, for backtraces and profiling
- env.Append(LINKFLAGS=['--profiling-funcs'])
-
- elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-O1', '-D_DEBUG', '-g', '-DDEBUG_ENABLED'])
+ if env['target'] == 'release_debug':
+ env.Append(CPPDEFINES=['DEBUG_ENABLED'])
+ # Retain function names for backtraces at the cost of file size.
+ env.Append(LINKFLAGS=['--profiling-funcs'])
+ else:
+ env.Append(CPPDEFINES=['DEBUG_ENABLED'])
+ env.Append(CCFLAGS=['-O1', '-g'])
env.Append(LINKFLAGS=['-O1', '-g'])
+ env.Append(LINKFLAGS=['-s', 'ASSERTIONS=1'])
## Compiler configuration
env['ENV'] = os.environ
- if ("EMSCRIPTEN_ROOT" in os.environ):
- env.PrependENVPath('PATH', os.environ['EMSCRIPTEN_ROOT'])
- elif ("EMSCRIPTEN" in os.environ):
- env.PrependENVPath('PATH', os.environ['EMSCRIPTEN'])
- env['CC'] = 'emcc'
- env['CXX'] = 'em++'
- env['LINK'] = 'emcc'
- env['RANLIB'] = 'emranlib'
- # Emscripten's ar has issues with duplicate file names, so use cc
- env['AR'] = 'emcc'
- env['ARFLAGS'] = '-o'
-
- if (os.name == 'nt'):
- # use TempFileMunge on Windows since some commands get too long for
- # cmd.exe even with spawn_fix
- # need to escape backslashes for this
- env['ESCAPED_SOURCES'] = escape_sources_backslashes
- env['ESCAPED_TARGET'] = escape_target_backslashes
- env['ARCOM'] = '${TEMPFILE("%s")}' % env['ARCOM'].replace('$SOURCES', '$ESCAPED_SOURCES').replace('$TARGET', '$ESCAPED_TARGET')
+ em_config_file = os.getenv('EM_CONFIG') or os.path.expanduser('~/.emscripten')
+ if not os.path.exists(em_config_file):
+ raise RuntimeError("Emscripten configuration file '%s' does not exist" % em_config_file)
+ with open(em_config_file) as f:
+ em_config = {}
+ try:
+ # Emscripten configuration file is a Python file with simple assignments.
+ exec(f.read(), em_config)
+ except StandardError as e:
+ raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e))
+ if 'EMSCRIPTEN_ROOT' not in em_config:
+ raise RuntimeError("'EMSCRIPTEN_ROOT' missing in Emscripten configuration file '%s'" % em_config_file)
+ env.PrependENVPath('PATH', em_config['EMSCRIPTEN_ROOT'])
+
+ env['CC'] = 'emcc'
+ env['CXX'] = 'em++'
+ env['LINK'] = 'emcc'
+
+ # Emscripten's ar has issues with duplicate file names, so use cc.
+ env['AR'] = 'emcc'
+ env['ARFLAGS'] = '-o'
+ # emranlib is a noop, so it's safe to use with AR=emcc.
+ env['RANLIB'] = 'emranlib'
+
+ # Use TempFileMunge since some AR invocations are too long for cmd.exe.
+ # Use POSIX-style paths, required with TempFileMunge.
+ env['ARCOM_POSIX'] = env['ARCOM'].replace(
+ '$TARGET', '$TARGET.posix').replace(
+ '$SOURCES', '$SOURCES.posix')
+ env['ARCOM'] = '${TEMPFILE(ARCOM_POSIX)}'
+
+ # All intermediate files are just LLVM bitcode.
+ env['OBJPREFIX'] = ''
env['OBJSUFFIX'] = '.bc'
+ env['PROGPREFIX'] = ''
+ # Program() output consists of multiple files, so specify suffixes manually at builder.
+ env['PROGSUFFIX'] = ''
+ env['LIBPREFIX'] = 'lib'
env['LIBSUFFIX'] = '.bc'
+ env['LIBPREFIXES'] = ['$LIBPREFIX']
+ env['LIBSUFFIXES'] = ['$LIBSUFFIX']
## Compile flags
env.Append(CPPPATH=['#platform/javascript'])
- env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
- env.Append(CPPFLAGS=['-DGLES3_ENABLED'])
+ env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED'])
- # These flags help keep the file size down
- env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
+ # No multi-threading (SharedArrayBuffer) available yet,
+ # once feasible also consider memory buffer size issues.
+ env.Append(CPPDEFINES=['NO_THREADS'])
+
+ # These flags help keep the file size down.
+ env.Append(CCFLAGS=['-fno-exceptions', '-fno-rtti'])
+ # Don't use dynamic_cast, necessary with no-rtti.
+ env.Append(CPPDEFINES=['NO_SAFE_CAST'])
if env['javascript_eval']:
- env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
+ env.Append(CPPDEFINES=['JAVASCRIPT_EVAL_ENABLED'])
## Link flags
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
+
+ # Allow increasing memory buffer size during runtime. This is efficient
+ # when using WebAssembly (in comparison to asm.js) and works well for
+ # us since we don't know requirements at compile-time.
env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1'])
+
+ # This setting just makes WebGL 2 APIs available, it does NOT disable WebGL 1.
env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1'])
- env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"'])
env.Append(LINKFLAGS=['-s', 'INVOKE_RUN=0'])
+
+ # TODO: Reevaluate usage of this setting now that engine.js manages engine runtime.
env.Append(LINKFLAGS=['-s', 'NO_EXIT_RUNTIME=1'])
- # TODO: Move that to opus module's config
+ # TODO: Move that to opus module's config.
if 'module_opus_enabled' in env and env['module_opus_enabled']:
- env.opus_fixed_point = "yes"
+ env.opus_fixed_point = 'yes'
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index bca1851f40..c3ef5bbbb5 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -1,3 +1,5 @@
+ exposedLibs['PATH'] = PATH;
+ exposedLibs['FS'] = FS;
return Module;
},
};
@@ -8,10 +10,18 @@
var DOWNLOAD_ATTEMPTS_MAX = 4;
var basePath = null;
+ var wasmFilenameExtensionOverride = null;
var engineLoadPromise = null;
var loadingFiles = {};
+ function getPathLeaf(path) {
+
+ while (path.endsWith('/'))
+ path = path.slice(0, -1);
+ return path.slice(path.lastIndexOf('/') + 1);
+ }
+
function getBasePath(path) {
if (path.endsWith('/'))
@@ -23,14 +33,15 @@
function getBaseName(path) {
- path = getBasePath(path);
- return path.slice(path.lastIndexOf('/') + 1);
+ return getPathLeaf(getBasePath(path));
}
Engine = function Engine() {
this.rtenv = null;
+ var LIBS = {};
+
var initPromise = null;
var unloadAfterInit = true;
@@ -80,11 +91,11 @@
return new Promise(function(resolve, reject) {
rtenvProps.onRuntimeInitialized = resolve;
rtenvProps.onAbort = reject;
- rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps);
+ rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps, LIBS);
});
}
- this.preloadFile = function(pathOrBuffer, bufferFilename) {
+ this.preloadFile = function(pathOrBuffer, destPath) {
if (pathOrBuffer instanceof ArrayBuffer) {
pathOrBuffer = new Uint8Array(pathOrBuffer);
@@ -93,14 +104,14 @@
}
if (pathOrBuffer instanceof Uint8Array) {
preloadedFiles.push({
- name: bufferFilename,
+ path: destPath,
buffer: pathOrBuffer
});
return Promise.resolve();
} else if (typeof pathOrBuffer === 'string') {
return loadPromise(pathOrBuffer, preloadProgressTracker).then(function(xhr) {
preloadedFiles.push({
- name: pathOrBuffer,
+ path: destPath || pathOrBuffer,
buffer: xhr.response
});
});
@@ -119,8 +130,17 @@
this.startGame = function(mainPack) {
executableName = getBaseName(mainPack);
- return Promise.all([this.init(getBasePath(mainPack)), this.preloadFile(mainPack)]).then(
- Function.prototype.apply.bind(synchronousStart, this, [])
+ var mainArgs = [];
+ if (!getPathLeaf(mainPack).endsWith('.pck')) {
+ mainArgs = ['--main-pack', getPathLeaf(mainPack)];
+ }
+ return Promise.all([
+ // Load from directory,
+ this.init(getBasePath(mainPack)),
+ // ...but write to root where the engine expects it.
+ this.preloadFile(mainPack, getPathLeaf(mainPack))
+ ]).then(
+ Function.prototype.apply.bind(synchronousStart, this, mainArgs)
);
};
@@ -138,18 +158,6 @@
}
var actualCanvas = this.rtenv.canvas;
- var testContext = false;
- var testCanvas;
- try {
- testCanvas = document.createElement('canvas');
- testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2');
- } catch (e) {}
- if (!testContext) {
- throw new Error("WebGL 2 not available");
- }
- testCanvas = null;
- testContext = null;
-
// canvas can grab focus on click
if (actualCanvas.tabIndex < 0) {
actualCanvas.tabIndex = 0;
@@ -158,6 +166,10 @@
actualCanvas.style.padding = 0;
actualCanvas.style.borderWidth = 0;
actualCanvas.style.borderStyle = 'none';
+ // disable right-click context menu
+ actualCanvas.addEventListener('contextmenu', function(ev) {
+ ev.preventDefault();
+ }, false);
// until context restoration is implemented
actualCanvas.addEventListener('webglcontextlost', function(ev) {
alert("WebGL context lost, please reload the page");
@@ -175,7 +187,16 @@
this.rtenv.thisProgram = executableName || getBaseName(basePath);
preloadedFiles.forEach(function(file) {
- this.rtenv.FS.createDataFile('/', file.name, new Uint8Array(file.buffer), true, true, true);
+ var dir = LIBS.PATH.dirname(file.path);
+ try {
+ LIBS.FS.stat(dir);
+ } catch (e) {
+ if (e.code !== 'ENOENT') {
+ throw e;
+ }
+ LIBS.FS.mkdirTree(dir);
+ }
+ LIBS.FS.createDataFile('/', file.path, new Uint8Array(file.buffer), true, true, true);
}, this);
preloadedFiles = null;
@@ -273,6 +294,28 @@
Engine.RuntimeEnvironment = engine.RuntimeEnvironment;
+ Engine.isWebGLAvailable = function(majorVersion = 1) {
+
+ var testContext = false;
+ try {
+ var testCanvas = document.createElement('canvas');
+ if (majorVersion === 1) {
+ testContext = testCanvas.getContext('webgl') || testCanvas.getContext('experimental-webgl');
+ } else if (majorVersion === 2) {
+ testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2');
+ }
+ } catch (e) {}
+ return !!testContext;
+ };
+
+ Engine.setWebAssemblyFilenameExtension = function(override) {
+
+ if (String(override).length === 0) {
+ throw new Error('Invalid WebAssembly filename extension override');
+ }
+ wasmFilenameExtensionOverride = String(override);
+ }
+
Engine.load = function(newBasePath) {
if (newBasePath !== undefined) basePath = getBasePath(newBasePath);
@@ -280,7 +323,7 @@
if (typeof WebAssembly !== 'object')
return Promise.reject(new Error("Browser doesn't support WebAssembly"));
// TODO cache/retrieve module to/from idb
- engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) {
+ engineLoadPromise = loadPromise(basePath + '.' + (wasmFilenameExtensionOverride || 'wasm')).then(function(xhr) {
return xhr.response;
});
engineLoadPromise = engineLoadPromise.catch(function(err) {
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index d81aa25c32..9591850662 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -117,7 +117,7 @@ void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_op
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"), true));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_GLOBAL_FILE, "html"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_FILE, "html"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/head_include", PROPERTY_HINT_MULTILINE_TEXT), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "zip"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), ""));
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 118a77835e..8d90e01ae1 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -88,7 +88,7 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve
ERR_FAIL_COND_V(port < 0, ERR_UNCONFIGURED);
ERR_FAIL_COND_V(!p_url.begins_with("/"), ERR_INVALID_PARAMETER);
- String url = (use_tls ? "https://" : "http://") + host + ":" + itos(port) + "/" + p_url;
+ String url = (use_tls ? "https://" : "http://") + host + ":" + itos(port) + p_url;
godot_xhr_reset(xhr_id);
godot_xhr_open(xhr_id, _methods[p_method], url.utf8().get_data(),
username.empty() ? NULL : username.utf8().get_data(),
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index e85fe0800f..68a2d72464 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -40,7 +40,7 @@ static void main_loop() {
os->main_loop_iterate();
}
-extern "C" void main_after_fs_sync(char *p_idbfs_err) {
+extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) {
String idbfs_err = String::utf8(p_idbfs_err);
if (!idbfs_err.empty()) {
@@ -56,8 +56,6 @@ extern "C" void main_after_fs_sync(char *p_idbfs_err) {
int main(int argc, char *argv[]) {
- printf("let it go dude!\n");
-
// sync from persistent state into memory and then
// run the 'main_after_fs_sync' function
/* clang-format off */
diff --git a/platform/javascript/logo.png b/platform/javascript/logo.png
index ce911180ac..36832d93ba 100644
--- a/platform/javascript/logo.png
+++ b/platform/javascript/logo.png
Binary files differ
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index e226ab6332..6c6e4d2d1c 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -33,6 +33,7 @@
#include "core/engine.h"
#include "core/io/file_access_buffered_fa.h"
#include "dom_keys.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/unix/dir_access_unix.h"
#include "drivers/unix/file_access_unix.h"
@@ -57,12 +58,19 @@ static void dom2godot_mod(T emscripten_event_ptr, Ref<InputEventWithModifiers> g
int OS_JavaScript::get_video_driver_count() const {
- return 1;
+ return VIDEO_DRIVER_MAX;
}
const char *OS_JavaScript::get_video_driver_name(int p_driver) const {
- return "GLES3";
+ switch (p_driver) {
+ case VIDEO_DRIVER_GLES3:
+ return "GLES3";
+ case VIDEO_DRIVER_GLES2:
+ return "GLES2";
+ }
+ ERR_EXPLAIN("Invalid video driver index " + itos(p_driver));
+ ERR_FAIL_V(NULL);
}
int OS_JavaScript::get_audio_driver_count() const {
@@ -159,10 +167,9 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
int mask = _input->get_mouse_button_mask();
int button_flag = 1 << (ev->get_button_index() - 1);
if (ev->is_pressed()) {
- // since the event is consumed, focus manually
- if (!is_canvas_focused()) {
- focus_canvas();
- }
+ // Since the event is consumed, focus manually. The containing iframe,
+ // if used, may not have focus yet, so focus even if already focused.
+ focus_canvas();
mask |= button_flag;
} else if (mask & button_flag) {
mask &= ~button_flag;
@@ -173,7 +180,8 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
ev->set_button_mask(mask);
_input->parse_input_event(ev);
- // prevent selection dragging
+ // Prevent multi-click text selection and wheel-click scrolling anchor.
+ // Context menu is prevented through contextmenu event.
return true;
}
@@ -196,7 +204,7 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m
ev->set_position(pos);
ev->set_global_position(ev->get_position());
- ev->set_relative(ev->get_position() - _input->get_mouse_position());
+ ev->set_relative(Vector2(mouse_event->movementX, mouse_event->movementY));
_input->set_mouse_position(ev->get_position());
ev->set_speed(_input->get_last_mouse_speed());
@@ -277,23 +285,6 @@ static EM_BOOL _touchpress_callback(int event_type, const EmscriptenTouchEvent *
_input->parse_input_event(ev);
}
-
- if (touch_event->touches[lowest_id_index].isChanged) {
-
- Ref<InputEventMouseButton> ev_mouse;
- ev_mouse.instance();
- ev_mouse->set_button_mask(_input->get_mouse_button_mask());
- dom2godot_mod(touch_event, ev_mouse);
-
- const EmscriptenTouchPoint &first_touch = touch_event->touches[lowest_id_index];
- ev_mouse->set_position(Point2(first_touch.canvasX, first_touch.canvasY));
- ev_mouse->set_global_position(ev_mouse->get_position());
-
- ev_mouse->set_button_index(BUTTON_LEFT);
- ev_mouse->set_pressed(event_type == EMSCRIPTEN_EVENT_TOUCHSTART);
-
- _input->parse_input_event(ev_mouse);
- }
return true;
}
@@ -319,24 +310,6 @@ static EM_BOOL _touchmove_callback(int event_type, const EmscriptenTouchEvent *t
_input->parse_input_event(ev);
}
-
- if (touch_event->touches[lowest_id_index].isChanged) {
-
- Ref<InputEventMouseMotion> ev_mouse;
- ev_mouse.instance();
- dom2godot_mod(touch_event, ev_mouse);
- ev_mouse->set_button_mask(_input->get_mouse_button_mask());
-
- const EmscriptenTouchPoint &first_touch = touch_event->touches[lowest_id_index];
- ev_mouse->set_position(Point2(first_touch.canvasX, first_touch.canvasY));
- ev_mouse->set_global_position(ev_mouse->get_position());
-
- ev_mouse->set_relative(ev_mouse->get_position() - _input->get_mouse_position());
- _input->set_mouse_position(ev_mouse->get_position());
- ev_mouse->set_speed(_input->get_last_mouse_speed());
-
- _input->parse_input_event(ev_mouse);
- }
return true;
}
@@ -405,14 +378,13 @@ static EM_BOOL joy_callback_func(int p_type, const EmscriptenGamepadEvent *p_eve
return false;
}
-extern "C" {
-void send_notification(int notif) {
+extern "C" EMSCRIPTEN_KEEPALIVE void send_notification(int notif) {
+
if (notif == MainLoop::NOTIFICATION_WM_MOUSE_ENTER || notif == MainLoop::NOTIFICATION_WM_MOUSE_EXIT) {
_cursor_inside_canvas = notif == MainLoop::NOTIFICATION_WM_MOUSE_ENTER;
}
OS_JavaScript::get_singleton()->get_main_loop()->notification(notif);
}
-}
Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
@@ -422,8 +394,21 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
emscripten_webgl_init_context_attributes(&attributes);
attributes.alpha = false;
attributes.antialias = false;
- attributes.majorVersion = 2;
+ ERR_FAIL_INDEX_V(p_video_driver, VIDEO_DRIVER_MAX, ERR_INVALID_PARAMETER);
+ switch (p_video_driver) {
+ case VIDEO_DRIVER_GLES3:
+ attributes.majorVersion = 2;
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ break;
+ case VIDEO_DRIVER_GLES2:
+ attributes.majorVersion = 1;
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ break;
+ }
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
+ ERR_EXPLAIN("WebGL " + itos(attributes.majorVersion) + ".0 not available");
ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
video_mode = p_desired;
@@ -447,12 +432,8 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
print_line("Init Audio");
- AudioDriverManager::add_driver(&audio_driver_javascript);
AudioDriverManager::initialize(p_audio_driver);
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
-
print_line("Init VS");
visual_server = memnew(VisualServerRaster());
@@ -463,8 +444,6 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
input = memnew(InputDefault);
_input = input;
- power_manager = memnew(PowerJavascript);
-
#define EM_CHECK(ev) \
if (result != EMSCRIPTEN_RESULT_SUCCESS) \
ERR_PRINTS("Error while setting " #ev " callback: Code " + itos(result))
@@ -951,15 +930,21 @@ String OS_JavaScript::get_joy_guid(int p_device) const {
}
OS::PowerState OS_JavaScript::get_power_state() {
- return power_manager->get_power_state();
+
+ WARN_PRINT("Power management is not supported for the HTML5 platform, defaulting to POWERSTATE_UNKNOWN");
+ return OS::POWERSTATE_UNKNOWN;
}
int OS_JavaScript::get_power_seconds_left() {
- return power_manager->get_power_seconds_left();
+
+ WARN_PRINT("Power management is not supported for the HTML5 platform, defaulting to -1");
+ return -1;
}
int OS_JavaScript::get_power_percent_left() {
- return power_manager->get_power_percent_left();
+
+ WARN_PRINT("Power management is not supported for the HTML5 platform, defaulting to -1");
+ return -1;
}
bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) {
@@ -1012,6 +997,8 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us
Vector<Logger *> loggers;
loggers.push_back(memnew(StdLogger));
_set_logger(memnew(CompositeLogger(loggers)));
+
+ AudioDriverManager::add_driver(&audio_driver_javascript);
}
OS_JavaScript::~OS_JavaScript() {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index f0ba9422e8..46eb1b3f13 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -36,7 +36,6 @@
#include "main/input_default.h"
#include "os/input.h"
#include "os/main_loop.h"
-#include "power_javascript.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
@@ -64,8 +63,6 @@ class OS_JavaScript : public OS_Unix {
GetUserDataDirFunc get_user_data_dir_func;
- PowerJavascript *power_manager;
-
static void _close_notification_funcs(const String &p_file, int p_flags);
void process_joypads();
diff --git a/platform/javascript/pre.js b/platform/javascript/pre.js
index 311aa44fda..02194bc75e 100644
--- a/platform/javascript/pre.js
+++ b/platform/javascript/pre.js
@@ -1,2 +1,2 @@
var Engine = {
- RuntimeEnvironment: function(Module) {
+ RuntimeEnvironment: function(Module, exposedLibs) {
diff --git a/platform/javascript/run_icon.png b/platform/javascript/run_icon.png
index dedee6f479..574abb0150 100644
--- a/platform/javascript/run_icon.png
+++ b/platform/javascript/run_icon.png
Binary files differ
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 6a9fd6b134..72b8aa99f8 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -23,8 +23,8 @@ def get_opts():
return [
('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
- EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
- BoolVariable('separate_debug_symbols', 'Create a separate file with the debug symbols', False),
+ EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
+ BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
]
@@ -59,7 +59,7 @@ def configure(env):
# Mac OS X no longer runs on 32-bit since 10.7 which is unsupported since 2014
# As such, we only support 64-bit
- env["bits"] = 64
+ env["bits"] = "64"
## Compiler configuration
@@ -93,6 +93,7 @@ def configure(env):
env['AR'] = basecmd + "ar"
env['RANLIB'] = basecmd + "ranlib"
env['AS'] = basecmd + "as"
+ env.Append(CCFLAGS=['-D__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define
if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 7985a241e4..db265812fa 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -496,7 +496,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
if (use_dmg()) {
String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck";
Vector<SharedObject> shared_objects;
- Error err = save_pack(p_preset, pack_path, &shared_objects);
+ err = save_pack(p_preset, pack_path, &shared_objects);
// see if we can code sign our new package
String identity = p_preset->get("codesign/identity");
@@ -504,7 +504,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
if (err == OK) {
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
for (int i = 0; i < shared_objects.size(); i++) {
- da->copy(shared_objects[i].path, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file());
+ err = da->copy(shared_objects[i].path, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file());
if (err == OK && identity != "") {
err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file());
}
@@ -549,7 +549,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
String pack_path = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".pck");
Vector<SharedObject> shared_objects;
- Error err = save_pack(p_preset, pack_path, &shared_objects);
+ err = save_pack(p_preset, pack_path, &shared_objects);
if (err == OK) {
zipOpenNewFileInZip(dst_pkg_zip,
@@ -581,7 +581,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
} else {
err = ERR_CANT_OPEN;
}
+ }
+ if (err == OK) {
//add shared objects
for (int i = 0; i < shared_objects.size(); i++) {
Vector<uint8_t> file = FileAccess::get_file_as_array(shared_objects[i].path);
@@ -609,26 +611,32 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
zipClose(dst_pkg_zip, NULL);
}
- return OK;
+ return err;
}
bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
- bool valid = true;
+ bool valid = false;
String err;
- if (!exists_export_template("osx.zip", &err)) {
- valid = false;
+ if (exists_export_template("osx.zip", &err)) {
+ valid = true;
}
- if (p_preset->get("custom_package/debug") != "" && !FileAccess::exists(p_preset->get("custom_package/debug"))) {
- valid = false;
- err += "Custom debug package not found.\n";
+ if (p_preset->get("custom_package/debug") != "") {
+ if (FileAccess::exists(p_preset->get("custom_package/debug"))) {
+ valid = true;
+ } else {
+ err += "Custom debug package not found.\n";
+ }
}
- if (p_preset->get("custom_package/release") != "" && !FileAccess::exists(p_preset->get("custom_package/release"))) {
- valid = false;
- err += "Custom release package not found.\n";
+ if (p_preset->get("custom_package/release") != "") {
+ if (FileAccess::exists(p_preset->get("custom_package/release"))) {
+ valid = true;
+ } else {
+ err += "Custom release package not found.\n";
+ }
}
if (!err.empty())
diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index 6ccbaf896b..64116fa1e0 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -101,5 +101,5 @@ int main(int argc, char **argv) {
Main::cleanup();
- return 0;
+ return os.get_exit_code();
};
diff --git a/platform/osx/logo.png b/platform/osx/logo.png
index 93c6890e85..62086fc415 100644
--- a/platform/osx/logo.png
+++ b/platform/osx/logo.png
Binary files differ
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index aa8db8f300..7bd5b16f36 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -99,14 +99,17 @@ public:
id pixelFormat;
id context;
+ bool layered_window;
+
CursorShape cursor_shape;
- NSCursor *cursors[CURSOR_MAX] = { NULL };
+ NSCursor *cursors[CURSOR_MAX];
MouseMode mouse_mode;
String title;
bool minimized;
bool maximized;
bool zoomed;
+ bool resizable;
Size2 window_size;
Rect2 restore_rect;
@@ -114,6 +117,7 @@ public:
String open_with_filename;
Point2 im_position;
+ bool im_active;
ImeCallback im_callback;
void *im_target;
@@ -134,9 +138,6 @@ public:
void _update_window();
protected:
- virtual int get_video_driver_count() const;
- virtual const char *get_video_driver_name(int p_driver) const;
-
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void finalize();
@@ -229,6 +230,11 @@ public:
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window();
+
+ virtual bool get_window_per_pixel_transparency_enabled() const;
+ virtual void set_window_per_pixel_transparency_enabled(bool p_enabled);
+
+ virtual void set_ime_active(const bool p_active);
virtual void set_ime_position(const Point2 &p_pos);
virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6e42eb58bd..4ece1e0325 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -31,6 +31,7 @@
#include "os_osx.h"
#include "dir_access_osx.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "main/main.h"
#include "os/keyboard.h"
@@ -149,14 +150,49 @@ static Vector2 get_mouse_pos(NSEvent *event) {
@end
@interface GodotApplicationDelegate : NSObject
+- (void)forceUnbundledWindowActivationHackStep1;
+- (void)forceUnbundledWindowActivationHackStep2;
+- (void)forceUnbundledWindowActivationHackStep3;
@end
@implementation GodotApplicationDelegate
+- (void)forceUnbundledWindowActivationHackStep1 {
+ // Step1: Switch focus to macOS Dock.
+ // Required to perform step 2, TransformProcessType will fail if app is already the in focus.
+ for (NSRunningApplication *app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) {
+ [app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
+ break;
+ }
+ [self performSelector:@selector(forceUnbundledWindowActivationHackStep2) withObject:nil afterDelay:0.02];
+}
+
+- (void)forceUnbundledWindowActivationHackStep2 {
+ // Step 2: Register app as foreground process.
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ (void)TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+
+ [self performSelector:@selector(forceUnbundledWindowActivationHackStep3) withObject:nil afterDelay:0.02];
+}
+
+- (void)forceUnbundledWindowActivationHackStep3 {
+ // Step 3: Switch focus back to app window.
+ [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
+}
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notice {
+ NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
+ if (nsappname == nil) {
+ // If executable is not a bundled, macOS WindowServer won't register and activate app window correctly (menu and title bar are grayed out and input ignored).
+ [self performSelector:@selector(forceUnbundledWindowActivationHackStep1) withObject:nil afterDelay:0.02];
+ }
+}
+
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename {
// Note: called before main loop init!
char *utfs = strdup([filename UTF8String]);
OS_OSX::singleton->open_with_filename.parse_utf8(utfs);
+ free(utfs);
return YES;
}
@@ -228,6 +264,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {
NSWindow *window = (NSWindow *)[notification object];
CGFloat newBackingScaleFactor = [window backingScaleFactor];
CGFloat oldBackingScaleFactor = [[[notification userInfo] objectForKey:@"NSBackingPropertyOldScaleFactorKey"] doubleValue];
+ [OS_OSX::singleton->window_view setWantsBestResolutionOpenGLSurface:YES];
if (newBackingScaleFactor != oldBackingScaleFactor) {
//Set new display scale and window size
@@ -504,7 +541,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
}
- (void)cursorUpdate:(NSEvent *)event {
- //setModeCursor(window, window->cursorMode);
+ OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape;
+ OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX;
+ OS_OSX::singleton->set_cursor_shape(p_shape);
}
static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
@@ -619,11 +658,12 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
return;
if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED)
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
- if (OS_OSX::singleton->input) {
+ if (OS_OSX::singleton->input)
OS_OSX::singleton->input->set_mouse_in_window(true);
- OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX;
- OS_OSX::singleton->set_cursor_shape(OS::CURSOR_ARROW);
- }
+
+ OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape;
+ OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX;
+ OS_OSX::singleton->set_cursor_shape(p_shape);
}
- (void)magnifyWithEvent:(NSEvent *)event {
@@ -802,6 +842,108 @@ static int translateKey(unsigned int key) {
return table[key];
}
+struct _KeyCodeMap {
+ UniChar kchar;
+ int kcode;
+};
+
+static const _KeyCodeMap _keycodes[55] = {
+ { '`', KEY_QUOTELEFT },
+ { '~', KEY_ASCIITILDE },
+ { '0', KEY_0 },
+ { '1', KEY_1 },
+ { '2', KEY_2 },
+ { '3', KEY_3 },
+ { '4', KEY_4 },
+ { '5', KEY_5 },
+ { '6', KEY_6 },
+ { '7', KEY_7 },
+ { '8', KEY_8 },
+ { '9', 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_BRACERIGHT },
+ { ']', KEY_BRACELEFT },
+ { '{', KEY_BRACERIGHT },
+ { '}', KEY_BRACELEFT },
+ { '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 }
+};
+
+static int remapKey(unsigned int key) {
+
+ TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
+ if (!currentKeyboard)
+ return translateKey(key);
+
+ CFDataRef layoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
+ if (!layoutData)
+ return 0;
+
+ const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData);
+
+ UInt32 keysDown = 0;
+ UniChar chars[4];
+ UniCharCount realLength;
+
+ OSStatus err = UCKeyTranslate(keyboardLayout,
+ key,
+ kUCKeyActionDisplay,
+ 0,
+ LMGetKbdType(),
+ kUCKeyTranslateNoDeadKeysBit,
+ &keysDown,
+ sizeof(chars) / sizeof(chars[0]),
+ &realLength,
+ chars);
+
+ if (err != noErr) {
+ return translateKey(key);
+ }
+
+ for (unsigned int i = 0; i < 55; i++) {
+ if (_keycodes[i].kchar == chars[0]) {
+ return _keycodes[i].kcode;
+ }
+ }
+ return translateKey(key);
+}
+
- (void)keyDown:(NSEvent *)event {
//disable raw input in IME mode
@@ -811,13 +953,13 @@ static int translateKey(unsigned int key) {
ke.osx_state = [event modifierFlags];
ke.pressed = true;
ke.echo = [event isARepeat];
- ke.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode]));
+ ke.scancode = remapKey([event keyCode]);
ke.unicode = 0;
push_to_key_event_buffer(ke);
}
- if ((OS_OSX::singleton->im_position.x != 0) && (OS_OSX::singleton->im_position.y != 0))
+ if (OS_OSX::singleton->im_active == true)
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
@@ -864,7 +1006,7 @@ static int translateKey(unsigned int key) {
}
ke.osx_state = mod;
- ke.scancode = latin_keyboard_keycode_convert(translateKey(key));
+ ke.scancode = remapKey(key);
ke.unicode = 0;
push_to_key_event_buffer(ke);
@@ -880,7 +1022,7 @@ static int translateKey(unsigned int key) {
ke.osx_state = [event modifierFlags];
ke.pressed = false;
ke.echo = false;
- ke.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode]));
+ ke.scancode = remapKey([event keyCode]);
ke.unicode = 0;
push_to_key_event_buffer(ke);
@@ -987,17 +1129,12 @@ String OS_OSX::get_unique_id() const {
return serial_number;
}
-void OS_OSX::set_ime_position(const Point2 &p_pos) {
- im_position = p_pos;
-}
-
-int OS_OSX::get_video_driver_count() const {
- return 1;
+void OS_OSX::set_ime_active(const bool p_active) {
+ im_active = p_active;
}
-const char *OS_OSX::get_video_driver_name(int p_driver) const {
-
- return "GLES3";
+void OS_OSX::set_ime_position(const Point2 &p_pos) {
+ im_position = p_pos;
}
void OS_OSX::initialize_core() {
@@ -1051,6 +1188,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (p_desired.borderless_window) {
styleMask = NSWindowStyleMaskBorderless;
} else {
+ resizable = p_desired.resizable;
styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (p_desired.resizable ? NSWindowStyleMaskResizable : 0);
}
@@ -1111,8 +1249,12 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
ADD_ATTR(NSOpenGLPFADoubleBuffer);
ADD_ATTR(NSOpenGLPFAClosestPolicy);
- //we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
- ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy);
+ } else {
+ //we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
+ }
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
@@ -1169,13 +1311,14 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
/*** END OSX INITIALIZATION ***/
- bool use_gl2 = p_video_driver != 1;
-
- AudioDriverManager::add_driver(&audio_driver);
-
// only opengl support here...
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } else {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ }
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
@@ -1195,6 +1338,9 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
restore_rect = Rect2(get_window_position(), get_window_size());
+ if (p_desired.layered_splash) {
+ set_window_per_pixel_transparency_enabled(true);
+ }
return OK;
}
@@ -1339,6 +1485,11 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
if (cursor_shape == p_shape)
return;
+ if (mouse_mode != MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {
+ cursor_shape = p_shape;
+ return;
+ }
+
if (cursors[p_shape] != NULL) {
[cursors[p_shape] set];
} else {
@@ -1370,50 +1521,98 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
if (p_cursor.is_valid()) {
Ref<Texture> texture = p_cursor;
- Ref<Image> image = texture->get_data();
+ Ref<AtlasTexture> atlas_texture = p_cursor;
+ Ref<Image> image;
+ Size2 texture_size;
+ Rect2 atlas_rect;
+
+ if (texture.is_valid()) {
+ image = texture->get_data();
+ }
- int image_size = 32 * 32;
+ if (!image.is_valid() && atlas_texture.is_valid()) {
+ texture = atlas_texture->get_atlas();
- ERR_FAIL_COND(texture->get_width() != 32 || texture->get_height() != 32);
+ atlas_rect.size.width = texture->get_width();
+ atlas_rect.size.height = texture->get_height();
+ atlas_rect.position.x = atlas_texture->get_region().position.x;
+ atlas_rect.position.y = atlas_texture->get_region().position.y;
- NSBitmapImageRep *imgrep = [[[NSBitmapImageRep alloc]
+ texture_size.width = atlas_texture->get_region().size.x;
+ texture_size.height = atlas_texture->get_region().size.y;
+ } else if (image.is_valid()) {
+ texture_size.width = texture->get_width();
+ texture_size.height = texture->get_height();
+ }
+
+ ERR_FAIL_COND(!texture.is_valid());
+ ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
+
+ image = texture->get_data();
+
+ ERR_FAIL_COND(!image.is_valid());
+
+ NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
- pixelsWide:image->get_width()
- pixelsHigh:image->get_height()
+ pixelsWide:int(texture_size.width)
+ pixelsHigh:int(texture_size.height)
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
- bytesPerRow:image->get_width() * 4
- bitsPerPixel:32] autorelease];
+ bytesPerRow:int(texture_size.width) * 4
+ bitsPerPixel:32];
ERR_FAIL_COND(imgrep == nil);
uint8_t *pixels = [imgrep bitmapData];
- int len = image->get_width() * image->get_height();
+ int len = int(texture_size.width * texture_size.height);
PoolVector<uint8_t> data = image->get_data();
PoolVector<uint8_t>::Read r = data.read();
+ image->lock();
+
/* Premultiply the alpha channel */
for (int i = 0; i < len; i++) {
- uint8_t alpha = r[i * 4 + 3];
- pixels[i * 4 + 0] = (uint8_t)(((uint16_t)r[i * 4 + 0] * alpha) / 255);
- pixels[i * 4 + 1] = (uint8_t)(((uint16_t)r[i * 4 + 1] * alpha) / 255);
- pixels[i * 4 + 2] = (uint8_t)(((uint16_t)r[i * 4 + 2] * alpha) / 255);
+ int row_index = floor(i / texture_size.width) + atlas_rect.position.y;
+ int column_index = (i % int(texture_size.width)) + atlas_rect.position.x;
+
+ if (atlas_texture.is_valid()) {
+ column_index = MIN(column_index, atlas_rect.size.width - 1);
+ row_index = MIN(row_index, atlas_rect.size.height - 1);
+ }
+
+ uint32_t color = image->get_pixel(column_index, row_index).to_argb32();
+
+ uint8_t alpha = (color >> 24) & 0xFF;
+ pixels[i * 4 + 0] = ((color >> 16) & 0xFF) * alpha / 255;
+ pixels[i * 4 + 1] = ((color >> 8) & 0xFF) * alpha / 255;
+ pixels[i * 4 + 2] = ((color)&0xFF) * alpha / 255;
pixels[i * 4 + 3] = alpha;
}
- NSImage *nsimage = [[[NSImage alloc] initWithSize:NSMakeSize(image->get_width(), image->get_height())] autorelease];
+ image->unlock();
+
+ NSImage *nsimage = [[NSImage alloc] initWithSize:NSMakeSize(texture_size.width, texture_size.height)];
[nsimage addRepresentation:imgrep];
NSCursor *cursor = [[NSCursor alloc] initWithImage:nsimage hotSpot:NSMakePoint(p_hotspot.x, p_hotspot.y)];
+ [cursors[p_shape] release];
cursors[p_shape] = cursor;
if (p_shape == CURSOR_ARROW) {
[cursor set];
}
+
+ [imgrep release];
+ [nsimage release];
+ } else {
+ // Reset to default system cursor
+ cursors[p_shape] = NULL;
+ cursor_shape = CURSOR_MAX;
+ set_cursor_shape(p_shape);
}
}
@@ -1552,7 +1751,8 @@ String OS_OSX::get_godot_dir_name() const {
String OS_OSX::get_system_dir(SystemDir p_dir) const {
- NSSearchPathDirectory id = 0;
+ NSSearchPathDirectory id;
+ bool found = true;
switch (p_dir) {
case SYSTEM_DIR_DESKTOP: {
@@ -1573,10 +1773,13 @@ String OS_OSX::get_system_dir(SystemDir p_dir) const {
case SYSTEM_DIR_PICTURES: {
id = NSPicturesDirectory;
} break;
+ default: {
+ found = false;
+ }
}
String ret;
- if (id) {
+ if (found) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES);
if (paths && [paths count] >= 1) {
@@ -1904,6 +2107,8 @@ void OS_OSX::set_window_size(const Size2 p_size) {
void OS_OSX::set_window_fullscreen(bool p_enabled) {
if (zoomed != p_enabled) {
+ if (layered_window)
+ set_window_per_pixel_transparency_enabled(false);
[window_object toggleFullScreen:nil];
}
zoomed = p_enabled;
@@ -1920,6 +2125,8 @@ void OS_OSX::set_window_resizable(bool p_enabled) {
[window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];
else
[window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable];
+
+ resizable = p_enabled;
};
bool OS_OSX::is_window_resizable() const {
@@ -1985,6 +2192,39 @@ void OS_OSX::request_attention() {
[NSApp requestUserAttention:NSCriticalRequest];
}
+bool OS_OSX::get_window_per_pixel_transparency_enabled() const {
+
+ if (!is_layered_allowed()) return false;
+ return layered_window;
+}
+
+void OS_OSX::set_window_per_pixel_transparency_enabled(bool p_enabled) {
+
+ if (!is_layered_allowed()) return;
+ if (layered_window != p_enabled) {
+ if (p_enabled) {
+ set_borderless_window(true);
+ GLint opacity = 0;
+ [window_object setBackgroundColor:[NSColor clearColor]];
+ [window_object setOpaque:NO];
+ [window_object setHasShadow:NO];
+ [context setValues:&opacity forParameter:NSOpenGLCPSurfaceOpacity];
+ layered_window = true;
+ } else {
+ GLint opacity = 1;
+ [window_object setBackgroundColor:[NSColor colorWithCalibratedWhite:1 alpha:1]];
+ [window_object setOpaque:YES];
+ [window_object setHasShadow:YES];
+ [context setValues:&opacity forParameter:NSOpenGLCPSurfaceOpacity];
+ layered_window = false;
+ }
+ [context update];
+ NSRect frame = [window_object frame];
+ [window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, 1, 1) display:YES];
+ [window_object setFrame:frame display:YES];
+ }
+}
+
void OS_OSX::set_borderless_window(bool p_borderless) {
// OrderOut prevents a lose focus bug with the window
@@ -1993,7 +2233,10 @@ void OS_OSX::set_borderless_window(bool p_borderless) {
if (p_borderless) {
[window_object setStyleMask:NSWindowStyleMaskBorderless];
} else {
- [window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable];
+ if (layered_window)
+ set_window_per_pixel_transparency_enabled(false);
+
+ [window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (resizable ? NSWindowStyleMaskResizable : 0)];
// Force update of the window styles
NSRect frameRect = [window_object frame];
@@ -2201,12 +2444,21 @@ void OS_OSX::run() {
//int frames=0;
//uint64_t frame=0;
- while (!force_quit) {
+ bool quit = false;
- process_events(); // get rid of pending events
- joypad_osx->process_joypads();
- if (Main::iteration() == true)
- break;
+ while (!force_quit && !quit) {
+
+ @try {
+
+ process_events(); // get rid of pending events
+ joypad_osx->process_joypads();
+
+ if (Main::iteration() == true) {
+ quit = true;
+ }
+ } @catch (NSException *exception) {
+ ERR_PRINTS("NSException: " + String([exception reason].UTF8String));
+ }
};
main_loop->finish();
@@ -2289,13 +2541,16 @@ OS_OSX *OS_OSX::singleton = NULL;
OS_OSX::OS_OSX() {
+ memset(cursors, 0, sizeof(cursors));
key_event_pos = 0;
mouse_mode = OS::MOUSE_MODE_VISIBLE;
main_loop = NULL;
singleton = this;
+ im_active = false;
im_position = Point2();
im_callback = NULL;
im_target = NULL;
+ layered_window = false;
autoreleasePool = [[NSAutoreleasePool alloc] init];
eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
@@ -2325,7 +2580,7 @@ OS_OSX::OS_OSX() {
NSMenuItem *menu_item;
NSString *title;
- NSString *nsappname = [[[NSBundle mainBundle] performSelector:@selector(localizedInfoDictionary)] objectForKey:@"CFBundleName"];
+ NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
if (nsappname == nil)
nsappname = [[NSProcessInfo processInfo] processName];
@@ -2378,6 +2633,7 @@ OS_OSX::OS_OSX() {
minimized = false;
window_size = Vector2(1024, 600);
zoomed = false;
+ resizable = false;
Vector<Logger *> loggers;
loggers.push_back(memnew(OSXTerminalLogger));
@@ -2396,6 +2652,8 @@ OS_OSX::OS_OSX() {
[NSApp sendEvent:event];
}
+
+ AudioDriverManager::add_driver(&audio_driver);
}
bool OS_OSX::_check_internal_feature_support(const String &p_feature) {
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index 1b497cebef..3f72831d77 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -31,4 +31,5 @@
#include <alloca.h>
#define GLES3_INCLUDE_H "glad/glad.h"
+#define GLES2_INCLUDE_H "glad/glad.h"
#define PTHREAD_RENAME_SELF
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 43aad4ad26..266b0c5cc9 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -1,4 +1,5 @@
import os
+import platform
import sys
@@ -66,9 +67,6 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
- if not env['builtin_libwebp']:
- env.ParseConfig('pkg-config libwebp --cflags --libs')
-
# freetype depends on libpng and zlib, so bundling one of them while keeping others
# as shared libraries leads to weird issues
if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
@@ -123,6 +121,26 @@ def configure(env):
if not env['builtin_libogg']:
env.ParseConfig('pkg-config ogg --cflags --libs')
+ if not env['builtin_libwebp']:
+ env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+ if not env['builtin_mbedtls']:
+ # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
+ env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
+
+ if not env['builtin_libwebsockets']:
+ env.ParseConfig('pkg-config libwebsockets --cflags --libs')
+
+ if not env['builtin_miniupnpc']:
+ # No pkgconfig file so far, hardcode default paths.
+ env.Append(CPPPATH=["/usr/include/miniupnpc"])
+ env.Append(LIBS=["miniupnpc"])
+
+ # On Linux wchar_t should be 32-bits
+ # 16-bit library shouldn't be required due to compiler optimisations
+ if not env['builtin_pcre2']:
+ env.ParseConfig('pkg-config libpcre2-32 --cflags --libs')
+
## Flags
# Linkflags below this line should typically stay the last ones
@@ -132,7 +150,12 @@ def configure(env):
env.Append(CPPPATH=['#platform/server'])
env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
env.Append(LIBS=['pthread'])
- env.Append(LIBS=['dl'])
+
+ if (platform.system() == "Linux"):
+ env.Append(LIBS=['dl'])
+
+ if (platform.system().find("BSD") >= 0):
+ env.Append(LIBS=['execinfo'])
# Link those statically for portability
if env['use_static_cpp']:
diff --git a/platform/server/logo.png b/platform/server/logo.png
index 5e98ac26ec..8666ada9ca 100644
--- a/platform/server/logo.png
+++ b/platform/server/logo.png
Binary files differ
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index a8be4fbc35..3b1be780d4 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -30,6 +30,7 @@
#include "os_server.h"
#include "drivers/dummy/audio_driver_dummy.h"
#include "drivers/dummy/rasterizer_dummy.h"
+#include "drivers/dummy/texture_loader_dummy.h"
#include "print_string.h"
#include "servers/visual/visual_server_raster.h"
#include <stdio.h>
@@ -83,6 +84,9 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int
_ensure_user_data_dir();
+ resource_loader_dummy = memnew(ResourceFormatDummyTexture);
+ ResourceLoader::add_resource_format_loader(resource_loader_dummy);
+
return OK;
}
@@ -99,6 +103,8 @@ void OS_Server::finalize() {
memdelete(power_manager);
+ memdelete(resource_loader_dummy);
+
args.clear();
}
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 2cc6f0c47e..f1a880ecc2 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -32,6 +32,7 @@
#include "../x11/crash_handler_x11.h"
#include "../x11/power_x11.h"
+#include "drivers/dummy/texture_loader_dummy.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
@@ -65,6 +66,8 @@ class OS_Server : public OS_Unix {
CrashHandler crash_handler;
+ ResourceFormatDummyTexture *resource_loader_dummy;
+
protected:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h
index af4cf07393..2fa8eda337 100644
--- a/platform/server/platform_config.h
+++ b/platform/server/platform_config.h
@@ -28,4 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifdef __linux__
#include <alloca.h>
+#endif
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#include <stdlib.h>
+#define PTHREAD_BSD_SET_NAME
+#endif
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index 5ff62b38f9..c18aa36402 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -85,8 +85,7 @@ App::App() :
mWindowHeight(0),
mEglDisplay(EGL_NO_DISPLAY),
mEglContext(EGL_NO_CONTEXT),
- mEglSurface(EGL_NO_SURFACE),
- number_of_contacts(0) {
+ mEglSurface(EGL_NO_SURFACE) {
}
// The first method called when the IFrameworkView is being created.
@@ -271,48 +270,44 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor
last_touch_y[screen_touch->get_index()] = pos.Y;
os->input_event(screen_touch);
- if (number_of_contacts > 1)
- return;
+ } else {
- }; // fallthrought of sorts
-
- Ref<InputEventMouseButton> mouse_button;
- mouse_button.instance();
- mouse_button->set_device(0);
- mouse_button->set_pressed(p_pressed);
- mouse_button->set_button_index(but);
- mouse_button->set_position(Vector2(pos.X, pos.Y));
- mouse_button->set_global_position(Vector2(pos.X, pos.Y));
-
- if (p_is_wheel) {
- if (point->Properties->MouseWheelDelta > 0) {
- mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP);
- } else if (point->Properties->MouseWheelDelta < 0) {
- mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN);
+ Ref<InputEventMouseButton> mouse_button;
+ mouse_button.instance();
+ mouse_button->set_device(0);
+ mouse_button->set_pressed(p_pressed);
+ mouse_button->set_button_index(but);
+ mouse_button->set_position(Vector2(pos.X, pos.Y));
+ mouse_button->set_global_position(Vector2(pos.X, pos.Y));
+
+ if (p_is_wheel) {
+ if (point->Properties->MouseWheelDelta > 0) {
+ mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP);
+ } else if (point->Properties->MouseWheelDelta < 0) {
+ mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN);
+ }
}
- }
- last_touch_x[31] = pos.X;
- last_touch_y[31] = pos.Y;
+ last_touch_x[31] = pos.X;
+ last_touch_y[31] = pos.Y;
- os->input_event(mouse_button);
-
- if (p_is_wheel) {
- // Send release for mouse wheel
- mouse_button->set_pressed(false);
os->input_event(mouse_button);
+
+ if (p_is_wheel) {
+ // Send release for mouse wheel
+ mouse_button->set_pressed(false);
+ os->input_event(mouse_button);
+ }
}
};
void App::OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
- number_of_contacts++;
pointer_event(sender, args, true);
};
void App::OnPointerReleased(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
- number_of_contacts--;
pointer_event(sender, args, false);
};
@@ -351,7 +346,7 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
Windows::UI::Input::PointerPoint ^ point = args->CurrentPoint;
Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os);
- if (point->IsInContact && _is_touch(point)) {
+ if (_is_touch(point)) {
Ref<InputEventScreenDrag> screen_drag;
screen_drag.instance();
@@ -361,25 +356,23 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
screen_drag->set_relative(Vector2(screen_drag->get_position().x - last_touch_x[screen_drag->get_index()], screen_drag->get_position().y - last_touch_y[screen_drag->get_index()]));
os->input_event(screen_drag);
- if (number_of_contacts > 1)
- return;
-
- }; // fallthrought of sorts
+ } else {
- // In case the mouse grabbed, MouseMoved will handle this
- if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED)
- return;
+ // In case the mouse grabbed, MouseMoved will handle this
+ if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED)
+ return;
- Ref<InputEventMouseMotion> mouse_motion;
- mouse_motion.instance();
- mouse_motion->set_device(0);
- mouse_motion->set_position(Vector2(pos.X, pos.Y));
- mouse_motion->set_global_position(Vector2(pos.X, pos.Y));
- mouse_motion->set_relative(Vector2(pos.X - last_touch_x[31], pos.Y - last_touch_y[31]));
+ Ref<InputEventMouseMotion> mouse_motion;
+ mouse_motion.instance();
+ mouse_motion->set_device(0);
+ mouse_motion->set_position(Vector2(pos.X, pos.Y));
+ mouse_motion->set_global_position(Vector2(pos.X, pos.Y));
+ mouse_motion->set_relative(Vector2(pos.X - last_touch_x[31], pos.Y - last_touch_y[31]));
- last_mouse_pos = pos;
+ last_mouse_pos = pos;
- os->input_event(mouse_motion);
+ os->input_event(mouse_motion);
+ }
}
void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
diff --git a/platform/uwp/app.h b/platform/uwp/app.h
index c23270b8ba..5f69f2cb0e 100644
--- a/platform/uwp/app.h
+++ b/platform/uwp/app.h
@@ -107,7 +107,6 @@ namespace GodotUWP
int last_touch_x[32]; // 20 fingers, index 31 reserved for the mouse
int last_touch_y[32];
- int number_of_contacts;
Windows::Foundation::Point last_mouse_pos;
};
}
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index f2c5c5d42e..559f23ca5b 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -25,8 +25,11 @@ def can_build():
def get_opts():
+ from SCons.Variables import BoolVariable
return [
+ ('msvc_version', 'MSVC version to use (ignored if the VCINSTALLDIR environment variable is set)', None),
+ BoolVariable('use_mingw', 'Use the MinGW compiler even if MSVC is installed (only used on Windows)', False),
]
@@ -40,6 +43,8 @@ def get_flags():
def configure(env):
+ env.msvc = True
+
if (env["bits"] != "default"):
print("Error: bits argument is disabled for MSVC")
print("""
@@ -107,7 +112,7 @@ def configure(env):
env["bits"] = "32"
print("Compiled program architecture will be a x86 executable. (forcing bits=32).")
else:
- print("Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup.")
+ print("Failed to detect MSVC compiler architecture version... Defaulting to 32-bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup.")
env["bits"] = "32"
if (env["bits"] == "32"):
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 7d7bee9227..35c0b30ce4 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -122,6 +122,14 @@ class AppxPackager {
Vector<BlockHash> hashes;
uLong file_crc32;
ZPOS64_T zip_offset;
+
+ FileMeta() :
+ lfh_size(0),
+ compressed(false),
+ compressed_size(0),
+ uncompressed_size(0),
+ file_crc32(0),
+ zip_offset(0) {}
};
String progress_task;
@@ -769,7 +777,7 @@ class EditorExportUWP : public EditorExportPlatform {
result = result.replace("$version_string$", version);
Platform arch = (Platform)(int)p_preset->get("architecture/target");
- String architecture = arch == ARM ? "ARM" : arch == X86 ? "x86" : "x64";
+ String architecture = arch == ARM ? "arm" : arch == X86 ? "x86" : "x64";
result = result.replace("$architecture$", architecture);
result = result.replace("$display_name$", String(p_preset->get("package/display_name")).empty() ? (String)ProjectSettings::get_singleton()->get("application/config/name") : String(p_preset->get("package/display_name")));
@@ -1038,7 +1046,7 @@ public:
}
virtual void get_export_options(List<ExportOption> *r_options) {
- r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "ARM,x86,x64"), 1));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "arm,x86,x64"), 1));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), ""));
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index 8b57fdd9ce..d312fbcb12 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -38,6 +38,8 @@
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *);
@@ -153,6 +155,7 @@ Error ContextGL_Win::initialize() {
WGL_CONTEXT_MAJOR_VERSION_ARB, 3, //we want a 3.3 context
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
//and it shall be forward compatible so that we can only use up to date functionality
+ WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /*| _WGL_CONTEXT_DEBUG_BIT_ARB*/,
0
}; //zero indicates the end of the array
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index b8ee2cd19f..05806d2fe8 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -12,23 +12,17 @@ def get_name():
def can_build():
-
if (os.name == "nt"):
# Building natively on Windows
- if (os.getenv("VCINSTALLDIR")): # MSVC
+ # If VCINSTALLDIR is set in the OS environ, use traditional Godot logic to set up MSVC
+ if (os.getenv("VCINSTALLDIR")): # MSVC, manual setup
return True
- print("MSVC not detected (no VCINSTALLDIR environment variable), attempting MinGW.")
- mingw32 = ""
- mingw64 = ""
- if (os.getenv("MINGW32_PREFIX")):
- mingw32 = os.getenv("MINGW32_PREFIX")
- if (os.getenv("MINGW64_PREFIX")):
- mingw64 = os.getenv("MINGW64_PREFIX")
-
- test = "gcc --version > NUL 2>&1"
- if (os.system(test) == 0 or os.system(mingw32 + test) == 0 or os.system(mingw64 + test) == 0):
- return True
+ # Otherwise, let SCons find MSVC if installed, or else Mingw.
+ # Since we're just returning True here, if there's no compiler
+ # installed, we'll get errors when it tries to build with the
+ # null compiler.
+ return True
if (os.name == "posix"):
# Cross-compiling with MinGW-w64 (old MinGW32 is not supported)
@@ -68,8 +62,10 @@ def get_opts():
# XP support dropped after EOL due to missing API for IPv6 and other issues
# Vista support dropped after EOL due to GH-10243
('target_win_version', 'Targeted Windows version, >= 0x0601 (Windows 7)', '0x0601'),
- EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
- BoolVariable('separate_debug_symbols', 'Create a separate file with the debug symbols', False),
+ EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
+ BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
+ ('msvc_version', 'MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.', None),
+ BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False),
]
@@ -98,192 +94,259 @@ def build_res_file(target, source, env):
return 0
-def configure(env):
-
- env.Append(CPPPATH=['#platform/windows'])
+def setup_msvc_manual(env):
+ """Set up env to use MSVC manually, using VCINSTALLDIR"""
+ if (env["bits"] != "default"):
+ print("""
+ Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console
+ (or Visual Studio settings) that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits
+ argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
+ """)
+ raise SCons.Errors.UserError("Bits argument should not be used when using VCINSTALLDIR")
+
+ # Force bits arg
+ # (Actually msys2 mingw can support 64-bit, we could detect that)
+ env["bits"] = "32"
+ env["x86_libtheora_opt_vc"] = True
+
+ # find compiler manually
+ compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+ print("Found MSVC compiler: " + compiler_version_str)
+
+ # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writing)... vc compiler for 64bit can not compile _asm
+ if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+ env["bits"] = "64"
+ env["x86_libtheora_opt_vc"] = False
+ print("Compiled program architecture will be a 64 bit executable (forcing bits=64).")
+ elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+ print("Compiled program architecture will be a 32 bit executable. (forcing bits=32).")
+ else:
+ print("Failed to manually detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup, or avoid setting VCINSTALLDIR.")
+
+def setup_msvc_auto(env):
+ """Set up MSVC using SCons's auto-detection logic"""
+
+ # If MSVC_VERSION is set by SCons, we know MSVC is installed.
+ # But we may want a different version or target arch.
+
+ # The env may have already been set up with default MSVC tools, so
+ # reset a few things so we can set it up with the tools we want.
+ # (Ideally we'd decide on the tool config before configuring any
+ # environment, and just set the env up once, but this function runs
+ # on an existing env so this is the simplest way.)
+ env['MSVC_SETUP_RUN'] = False # Need to set this to re-run the tool
+ env['MSVS_VERSION'] = None
+ env['MSVC_VERSION'] = None
+ env['TARGET_ARCH'] = None
+ if env['bits'] != 'default':
+ env['TARGET_ARCH'] = {'32': 'x86', '64': 'x86_64'}[env['bits']]
+ if env.has_key('msvc_version'):
+ env['MSVC_VERSION'] = env['msvc_version']
+ env.Tool('msvc')
+ env.Tool('mssdk') # we want the MS SDK
+ # Note: actual compiler version can be found in env['MSVC_VERSION'], e.g. "14.1" for VS2015
+ # Get actual target arch into bits (it may be "default" at this point):
+ if env['TARGET_ARCH'] in ('amd64', 'x86_64'):
+ env['bits'] = 64
+ else:
+ env['bits'] = 32
+ print(" Found MSVC version %s, arch %s, bits=%s" % (env['MSVC_VERSION'], env['TARGET_ARCH'], env['bits']))
+ if env['TARGET_ARCH'] in ('amd64', 'x86_64'):
+ env["x86_libtheora_opt_vc"] = False
+
+def setup_mingw(env):
+ """Set up env for use with mingw"""
+ # Nothing to do here
+ print("Using Mingw")
+ pass
+
+def configure_msvc(env, manual_msvc_config):
+ """Configure env to work with MSVC"""
+
+ # Build type
+
+ if (env["target"] == "release"):
+ env.Append(CCFLAGS=['/O2'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
+ env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
+
+ elif (env["target"] == "release_debug"):
+ env.Append(CCFLAGS=['/O2'])
+ env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+
+ elif (env["target"] == "debug_release"):
+ env.Append(CCFLAGS=['/Z7', '/Od'])
+ env.Append(LINKFLAGS=['/DEBUG'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
+ env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
+
+ elif (env["target"] == "debug"):
+ env.AppendUnique(CCFLAGS=['/Z7', '/Od', '/EHsc'])
+ env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED',
+ 'D3D_DEBUG_INFO'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+ env.Append(LINKFLAGS=['/DEBUG'])
+
+ ## Compile/link flags
+
+ env.AppendUnique(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
+ env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++
+ if manual_msvc_config: # should be automatic if SCons found it
+ if os.getenv("WindowsSdkDir") is not None:
+ env.Append(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
+ else:
+ print("Missing environment variable: WindowsSdkDir")
+
+ env.AppendUnique(CPPDEFINES = ['WINDOWS_ENABLED', 'OPENGL_ENABLED',
+ 'RTAUDIO_ENABLED', 'WASAPI_ENABLED',
+ 'TYPED_METHOD_BIND', 'WIN32', 'MSVC',
+ {'WINVER' : '$target_win_version',
+ '_WIN32_WINNT': '$target_win_version'}])
+ if env["bits"] == "64":
+ env.AppendUnique(CPPDEFINES=['_WIN64'])
+
+ ## Libs
+
+ LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32',
+ 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32',
+ 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32', 'bcrypt']
+ env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
+
+ if manual_msvc_config:
+ if os.getenv("WindowsSdkDir") is not None:
+ env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
+ else:
+ print("Missing environment variable: WindowsSdkDir")
- if (os.name == "nt" and os.getenv("VCINSTALLDIR")): # MSVC
+ ## LTO
- env['ENV']['TMP'] = os.environ['TMP']
-
- ## Build type
-
- if (env["target"] == "release"):
- env.Append(CCFLAGS=['/O2'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
- env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
-
- elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
-
- elif (env["target"] == "debug_release"):
- env.Append(CCFLAGS=['/Z7', '/Od'])
- env.Append(LINKFLAGS=['/DEBUG'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
- env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
-
- elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od', '/EHsc'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- env.Append(LINKFLAGS=['/DEBUG'])
-
- ## Architecture
-
- # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
- if (env["bits"] != "default"):
- print("Error: bits argument is disabled for MSVC")
- print("""
- Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console
- (or Visual Studio settings) that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits
- argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
- """)
- sys.exit()
-
- # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the proper command prompt
- # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
- env["bits"] = "32"
- env["x86_libtheora_opt_vc"] = True
-
- ## Compiler configuration
-
- env['ENV'] = os.environ
- # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far below in the code
- compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
-
- print("Detected MSVC compiler: " + compiler_version_str)
- # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writing)... vc compiler for 64bit can not compile _asm
- if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
- env["bits"] = "64"
- env["x86_libtheora_opt_vc"] = False
- print("Compiled program architecture will be a 64 bit executable (forcing bits=64).")
- elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
- print("Compiled program architecture will be a 32 bit executable. (forcing bits=32).")
+ if (env["use_lto"]):
+ env.AppendUnique(CCFLAGS=['/GL'])
+ env.AppendUnique(ARFLAGS=['/LTCG'])
+ if env["progress"]:
+ env.AppendUnique(LINKFLAGS=['/LTCG:STATUS'])
else:
- print("Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup.")
+ env.AppendUnique(LINKFLAGS=['/LTCG'])
- ## Compile flags
+ if manual_msvc_config:
+ env.Append(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
+ env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
- env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
- env.Append(CXXFLAGS=['/TP'])
- env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
- env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
+ # Incremental linking fix
+ env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
+ env['BUILDERS']['Program'] = methods.precious_program
- env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
- env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
- env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
- env.Append(CCFLAGS=['/DWASAPI_ENABLED'])
- env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
- env.Append(CCFLAGS=['/DWIN32'])
- env.Append(CCFLAGS=['/DWINVER=%s' % env['target_win_version'], '/D_WIN32_WINNT=%s' % env['target_win_version']])
- if env["bits"] == "64":
- env.Append(CCFLAGS=['/D_WIN64'])
+def configure_mingw(env):
+ # Workaround for MinGW. See:
+ # http://www.scons.org/wiki/LongCmdLinesOnWin32
+ env.use_windows_spawn_fix()
- LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32', 'bcrypt']
- env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
+ ## Build type
- env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
+ if (env["target"] == "release"):
+ env.Append(CCFLAGS=['-msse2'])
- if (os.getenv("VCINSTALLDIR")):
- VC_PATH = os.getenv("VCINSTALLDIR")
+ if (env["bits"] == "64"):
+ env.Append(CCFLAGS=['-O3'])
else:
- VC_PATH = ""
+ env.Append(CCFLAGS=['-O2'])
- if (env["use_lto"]):
- env.Append(CCFLAGS=['/GL'])
- env.Append(ARFLAGS=['/LTCG'])
- if env["progress"]:
- env.Append(LINKFLAGS=['/LTCG:STATUS'])
- else:
- env.Append(LINKFLAGS=['/LTCG'])
+ env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
- env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
- env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
- # Incremental linking fix
- env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
- env['BUILDERS']['Program'] = methods.precious_program
+ elif (env["target"] == "release_debug"):
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ if (env["debug_symbols"] == "yes"):
+ env.Prepend(CCFLAGS=['-g1'])
+ if (env["debug_symbols"] == "full"):
+ env.Prepend(CCFLAGS=['-g2'])
- else: # MinGW
-
- # Workaround for MinGW. See:
- # http://www.scons.org/wiki/LongCmdLinesOnWin32
- env.use_windows_spawn_fix()
-
- ## Build type
+ elif (env["target"] == "debug"):
+ env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
- if (env["target"] == "release"):
- env.Append(CCFLAGS=['-msse2'])
+ ## Compiler configuration
- if (env["bits"] == "64"):
- env.Append(CCFLAGS=['-O3'])
- else:
- env.Append(CCFLAGS=['-O2'])
+ if (os.name == "nt"):
+ env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes
+ else:
+ env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
- env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+ if (env["bits"] == "default"):
+ if (os.name == "nt"):
+ env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"
+ else: # default to 64-bit on Linux
+ env["bits"] = "64"
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
+ mingw_prefix = ""
- elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
+ if (env["bits"] == "32"):
+ env.Append(LINKFLAGS=['-static'])
+ env.Append(LINKFLAGS=['-static-libgcc'])
+ env.Append(LINKFLAGS=['-static-libstdc++'])
+ mingw_prefix = env["mingw_prefix_32"]
+ else:
+ env.Append(LINKFLAGS=['-static'])
+ mingw_prefix = env["mingw_prefix_64"]
- elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ env["CC"] = mingw_prefix + "gcc"
+ env['AS'] = mingw_prefix + "as"
+ env['CXX'] = mingw_prefix + "g++"
+ env['AR'] = mingw_prefix + "gcc-ar"
+ env['RANLIB'] = mingw_prefix + "gcc-ranlib"
+ env['LINK'] = mingw_prefix + "g++"
+ env["x86_libtheora_opt_gcc"] = True
- ## Compiler configuration
+ if env['use_lto']:
+ env.Append(CCFLAGS=['-flto'])
+ env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
- if (os.name == "nt"):
- env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes
- else:
- env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
- if (env["bits"] == "default"):
- if (os.name == "nt"):
- env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"
- else: # default to 64-bit on Linux
- env["bits"] = "64"
+ ## Compile flags
- mingw_prefix = ""
+ env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
+ env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
+ env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
+ env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']])
+ env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt'])
- if (env["bits"] == "32"):
- env.Append(LINKFLAGS=['-static'])
- env.Append(LINKFLAGS=['-static-libgcc'])
- env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix = env["mingw_prefix_32"]
- else:
- env.Append(LINKFLAGS=['-static'])
- mingw_prefix = env["mingw_prefix_64"]
+ env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
- env["CC"] = mingw_prefix + "gcc"
- env['AS'] = mingw_prefix + "as"
- env['CXX'] = mingw_prefix + "g++"
- env['AR'] = mingw_prefix + "gcc-ar"
- env['RANLIB'] = mingw_prefix + "gcc-ranlib"
- env['LINK'] = mingw_prefix + "g++"
- env["x86_libtheora_opt_gcc"] = True
+ # resrc
+ env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
- if env['use_lto']:
- env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+def configure(env):
+ # At this point the env has been set up with basic tools/compilers.
+ env.Append(CPPPATH=['#platform/windows'])
+ print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
- ## Compile flags
+ if (os.name == "nt"):
+ env['ENV'] = os.environ # this makes build less repeatable, but simplifies some things
+ env['ENV']['TMP'] = os.environ['TMP']
- env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
- env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
- env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
- env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
- env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']])
- env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt'])
+ # First figure out which compiler, version, and target arch we're using
+ if os.getenv("VCINSTALLDIR"):
+ # Manual setup of MSVC
+ setup_msvc_manual(env)
+ env.msvc = True
+ manual_msvc_config = True
+ elif env.get('MSVC_VERSION', ''):
+ setup_msvc_auto(env)
+ env.msvc = True
+ manual_msvc_config = False
+ else:
+ setup_mingw(env)
+ env.msvc = False
- env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
+ # Now set compiler/linker flags
+ if env.msvc:
+ configure_msvc(env, manual_msvc_config)
- # resrc
- env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
+ else: # MinGW
+ configure_mingw(env)
diff --git a/platform/windows/godot_res.rc b/platform/windows/godot_res.rc
index c535a749c0..f2dca10d55 100644
--- a/platform/windows/godot_res.rc
+++ b/platform/windows/godot_res.rc
@@ -3,11 +3,9 @@
#define _STR(m_x) #m_x
#define _MKSTR(m_x) _STR(m_x)
#endif
+
#ifndef VERSION_PATCH
#define VERSION_PATCH 0
-#define PATCH_STRING
-#else
-#define PATCH_STRING "." _MKSTR(VERSION_PATCH)
#endif
GODOT_ICON ICON platform/windows/godot.ico
@@ -24,12 +22,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Godot Engine"
VALUE "FileDescription", VERSION_NAME " Editor"
- VALUE "FileVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) "." _MKSTR(VERSION_PATCH)
+ VALUE "FileVersion", VERSION_NUMBER
VALUE "ProductName", VERSION_NAME
VALUE "Licence", "MIT"
- VALUE "LegalCopyright", "Copyright (c) 2007-" _MKSTR(VERSION_YEAR) " Juan Linietsky, Ariel Manzur"
+ VALUE "LegalCopyright", "Copyright (c) 2007-" _MKSTR(VERSION_YEAR) " Juan Linietsky, Ariel Manzur and contributors"
VALUE "Info", "https://godotengine.org"
- VALUE "ProductVersion", _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) PATCH_STRING "." VERSION_BUILD
+ VALUE "ProductVersion", VERSION_FULL_BUILD
END
END
BLOCK "VarFileInfo"
diff --git a/platform/windows/logo.png b/platform/windows/logo.png
index 4376abd563..f06b463850 100644
--- a/platform/windows/logo.png
+++ b/platform/windows/logo.png
Binary files differ
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 20129299a1..f52c8881d4 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -30,6 +30,7 @@
#include "os_windows.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
@@ -151,24 +152,23 @@ void RedirectIOToConsole() {
// point to console as well
}
-int OS_Windows::get_video_driver_count() const {
+BOOL WINAPI HandlerRoutine(_In_ DWORD dwCtrlType) {
+ if (ScriptDebugger::get_singleton() == NULL)
+ return FALSE;
- return 1;
-}
-const char *OS_Windows::get_video_driver_name(int p_driver) const {
-
- return "GLES3";
+ switch (dwCtrlType) {
+ case CTRL_C_EVENT:
+ ScriptDebugger::get_singleton()->set_depth(-1);
+ ScriptDebugger::get_singleton()->set_lines_left(1);
+ return TRUE;
+ default:
+ return FALSE;
+ }
}
-int OS_Windows::get_audio_driver_count() const {
+void OS_Windows::initialize_debugging() {
- return AudioDriverManager::get_driver_count();
-}
-const char *OS_Windows::get_audio_driver_name(int p_driver) const {
-
- AudioDriver *driver = AudioDriverManager::get_driver(p_driver);
- ERR_FAIL_COND_V(!driver, "");
- return AudioDriverManager::get_driver(p_driver)->get_name();
+ SetConsoleCtrlHandler(HandlerRoutine, TRUE);
}
void OS_Windows::initialize_core() {
@@ -207,6 +207,10 @@ void OS_Windows::initialize_core() {
ticks_start = 0;
ticks_start = get_ticks_usec();
+ // set minimum resolution for periodic timers, otherwise Sleep(n) may wait at least as
+ // long as the windows scheduler resolution (~16-30ms) even for calls like Sleep(1)
+ timeBeginPeriod(1);
+
process_map = memnew((Map<ProcessID, ProcessInfo>));
IP_Unix::make_default();
@@ -361,6 +365,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} break;
case WM_MOUSEMOVE: {
+ if (input->is_emulating_mouse_from_touch()) {
+ // Universal translation enabled; ignore OS translation
+ LPARAM extra = GetMessageExtraInfo();
+ if (IsPenEvent(extra)) {
+ break;
+ }
+ }
+
if (outside) {
//mouse enter
@@ -386,18 +398,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
if (!window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED)
break;
- /*
- LPARAM extra = GetMessageExtraInfo();
- if (IsPenEvent(extra)) {
-
- int idx = extra & 0x7f;
- _drag_event(idx, uMsg, wParam, lParam);
- if (idx != 0) {
- return 0;
- };
- // fallthrough for mouse event
- };
- */
Ref<InputEventMouseMotion> mm;
mm.instance();
@@ -455,6 +455,13 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} break;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
+ if (input->is_emulating_mouse_from_touch()) {
+ // Universal translation enabled; ignore OS translations for left button
+ LPARAM extra = GetMessageExtraInfo();
+ if (IsPenEvent(extra)) {
+ break;
+ }
+ }
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
@@ -467,19 +474,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/*case WM_XBUTTONDOWN:
case WM_XBUTTONUP: */ {
- /*
- LPARAM extra = GetMessageExtraInfo();
- if (IsPenEvent(extra)) {
-
- int idx = extra & 0x7f;
- _touch_event(idx, uMsg, wParam, lParam);
- if (idx != 0) {
- return 0;
- };
- // fallthrough for mouse event
- };
- */
-
Ref<InputEventMouseButton> mb;
mb.instance();
@@ -628,9 +622,43 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SIZE: {
int window_w = LOWORD(lParam);
int window_h = HIWORD(lParam);
- if (window_w > 0 && window_h > 0) {
+ if (window_w > 0 && window_h > 0 && !preserve_window_size) {
video_mode.width = window_w;
video_mode.height = window_h;
+ } else {
+ preserve_window_size = false;
+ set_window_size(Size2(video_mode.width, video_mode.height));
+ }
+ if (wParam == SIZE_MAXIMIZED) {
+ maximized = true;
+ minimized = false;
+ } else if (wParam == SIZE_MINIMIZED) {
+ maximized = false;
+ minimized = true;
+ } else if (wParam == SIZE_RESTORED) {
+ maximized = false;
+ minimized = false;
+ }
+ if (is_layered_allowed() && layered_window) {
+ DeleteObject(hBitmap);
+
+ RECT r;
+ GetWindowRect(hWnd, &r);
+ dib_size = Size2(r.right - r.left, r.bottom - r.top);
+
+ BITMAPINFO bmi;
+ ZeroMemory(&bmi, sizeof(BITMAPINFO));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = dib_size.x;
+ bmi.bmiHeader.biHeight = dib_size.y;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = 32;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.bmiHeader.biSizeImage = dib_size.x, dib_size.y * 4;
+ hBitmap = CreateDIBSection(hDC_dib, &bmi, DIB_RGB_COLORS, (void **)&dib_data, NULL, 0x0);
+ SelectObject(hDC_dib, hBitmap);
+
+ ZeroMemory(dib_data, dib_size.x * dib_size.y * 4);
}
//return 0; // Jump Back
} break;
@@ -713,13 +741,18 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))) {
for (UINT i = 0; i < cInputs; i++) {
TOUCHINPUT ti = pInputs[i];
+ POINT touch_pos = {
+ TOUCH_COORD_TO_PIXEL(ti.x),
+ TOUCH_COORD_TO_PIXEL(ti.y),
+ };
+ ScreenToClient(hWnd, &touch_pos);
//do something with each touch input entry
if (ti.dwFlags & TOUCHEVENTF_MOVE) {
- _drag_event(ti.x / 100.0f, ti.y / 100.0f, ti.dwID);
+ _drag_event(touch_pos.x, touch_pos.y, ti.dwID);
} else if (ti.dwFlags & (TOUCHEVENTF_UP | TOUCHEVENTF_DOWN)) {
- _touch_event(ti.dwFlags & TOUCHEVENTF_DOWN, ti.x / 100.0f, ti.y / 100.0f, ti.dwID);
+ _touch_event(ti.dwFlags & TOUCHEVENTF_DOWN, touch_pos.x, touch_pos.y, ti.dwID);
};
}
bHandled = TRUE;
@@ -751,7 +784,9 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetCursor(NULL);
} else {
if (hCursor != NULL) {
- SetCursor(hCursor);
+ CursorShape c = cursor_shape;
+ cursor_shape = CURSOR_MAX;
+ set_cursor_shape(c);
hCursor = NULL;
}
}
@@ -1080,12 +1115,19 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
}
#if defined(OPENGL_ENABLED)
- gl_context = memnew(ContextGL_Win(hWnd, true));
- gl_context->initialize();
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ gl_context = memnew(ContextGL_Win(hWnd, false));
+ gl_context->initialize();
- RasterizerGLES3::register_config();
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } else {
+ gl_context = memnew(ContextGL_Win(hWnd, true));
+ gl_context->initialize();
- RasterizerGLES3::make_current();
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ }
gl_context->set_use_vsync(video_mode.use_vsync);
#endif
@@ -1140,6 +1182,18 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
SetFocus(hWnd); // Sets Keyboard Focus To
}
+ if (p_desired.layered_splash) {
+ set_window_per_pixel_transparency_enabled(true);
+ }
+
+ // IME
+ im_himc = ImmGetContext(hWnd);
+ ImmReleaseContext(hWnd, im_himc);
+
+ im_position = Vector2();
+
+ set_ime_active(false);
+
return OK;
}
@@ -1264,6 +1318,8 @@ void OS_Windows::finalize() {
void OS_Windows::finalize_core() {
+ timeEndPeriod(1);
+
memdelete(process_map);
TCPServerWinsock::cleanup();
@@ -1302,7 +1358,9 @@ void OS_Windows::set_mouse_mode(MouseMode p_mode) {
if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_HIDDEN) {
hCursor = SetCursor(NULL);
} else {
- SetCursor(hCursor);
+ CursorShape c = cursor_shape;
+ cursor_shape = CURSOR_MAX;
+ set_cursor_shape(c);
}
}
@@ -1521,12 +1579,24 @@ void OS_Windows::set_window_size(const Size2 p_size) {
}
MoveWindow(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) {
+ RECT rect;
+ GetClientRect(hWnd, &rect);
+ ClientToScreen(hWnd, (POINT *)&rect.left);
+ ClientToScreen(hWnd, (POINT *)&rect.right);
+ ClipCursor(&rect);
+ }
}
void OS_Windows::set_window_fullscreen(bool p_enabled) {
if (video_mode.fullscreen == p_enabled)
return;
+ if (layered_window)
+ set_window_per_pixel_transparency_enabled(false);
+
if (p_enabled) {
if (pre_fs_valid) {
@@ -1631,12 +1701,100 @@ bool OS_Windows::is_window_always_on_top() const {
return video_mode.always_on_top;
}
+bool OS_Windows::get_window_per_pixel_transparency_enabled() const {
+
+ if (!is_layered_allowed()) return false;
+ return layered_window;
+}
+
+void OS_Windows::set_window_per_pixel_transparency_enabled(bool p_enabled) {
+
+ if (!is_layered_allowed()) return;
+ if (layered_window != p_enabled) {
+ if (p_enabled) {
+ set_borderless_window(true);
+ //enable per-pixel alpha
+ hDC_dib = CreateCompatibleDC(GetDC(hWnd));
+
+ SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
+
+ RECT r;
+ GetWindowRect(hWnd, &r);
+ dib_size = Size2(r.right - r.left, r.bottom - r.top);
+
+ BITMAPINFO bmi;
+ ZeroMemory(&bmi, sizeof(BITMAPINFO));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = dib_size.x;
+ bmi.bmiHeader.biHeight = dib_size.y;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = 32;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.bmiHeader.biSizeImage = dib_size.x * dib_size.y * 4;
+ hBitmap = CreateDIBSection(hDC_dib, &bmi, DIB_RGB_COLORS, (void **)&dib_data, NULL, 0x0);
+ SelectObject(hDC_dib, hBitmap);
+
+ ZeroMemory(dib_data, dib_size.x * dib_size.y * 4);
+
+ layered_window = true;
+ } else {
+ //disable per-pixel alpha
+ layered_window = false;
+
+ SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
+
+ //cleanup
+ DeleteObject(hBitmap);
+ DeleteDC(hDC_dib);
+ }
+ }
+}
+
+uint8_t *OS_Windows::get_layered_buffer_data() {
+
+ return (is_layered_allowed() && layered_window) ? dib_data : NULL;
+}
+
+Size2 OS_Windows::get_layered_buffer_size() {
+
+ return (is_layered_allowed() && layered_window) ? dib_size : Size2();
+}
+
+void OS_Windows::swap_layered_buffer() {
+
+ if (is_layered_allowed() && layered_window) {
+
+ //premultiply alpha
+ for (int y = 0; y < dib_size.y; y++) {
+ for (int x = 0; x < dib_size.x; x++) {
+ float alpha = (float)dib_data[y * (int)dib_size.x * 4 + x * 4 + 3] / (float)0xFF;
+ dib_data[y * (int)dib_size.x * 4 + x * 4 + 0] *= alpha;
+ dib_data[y * (int)dib_size.x * 4 + x * 4 + 1] *= alpha;
+ dib_data[y * (int)dib_size.x * 4 + x * 4 + 2] *= alpha;
+ }
+ }
+ //swap layered window buffer
+ POINT ptSrc = { 0, 0 };
+ SIZE sizeWnd = { (long)dib_size.x, (long)dib_size.y };
+ BLENDFUNCTION bf;
+ bf.BlendOp = AC_SRC_OVER;
+ bf.BlendFlags = 0;
+ bf.AlphaFormat = AC_SRC_ALPHA;
+ bf.SourceConstantAlpha = 0xFF;
+ UpdateLayeredWindow(hWnd, NULL, NULL, &sizeWnd, hDC_dib, &ptSrc, 0, &bf, ULW_ALPHA);
+ }
+}
+
void OS_Windows::set_borderless_window(bool p_borderless) {
if (video_mode.borderless_window == p_borderless)
return;
+ if (!p_borderless && layered_window)
+ set_window_per_pixel_transparency_enabled(false);
+
video_mode.borderless_window = p_borderless;
+ preserve_window_size = true;
_update_window_style();
}
@@ -1655,7 +1813,7 @@ void OS_Windows::_update_window_style(bool repaint) {
}
}
- SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
if (repaint) {
RECT rect;
@@ -1866,6 +2024,11 @@ void OS_Windows::set_cursor_shape(CursorShape p_shape) {
if (cursor_shape == p_shape)
return;
+ if (mouse_mode != MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {
+ cursor_shape = p_shape;
+ return;
+ }
+
static const LPCTSTR win_cursors[CURSOR_MAX] = {
IDC_ARROW,
IDC_IBEAM,
@@ -1891,34 +2054,66 @@ void OS_Windows::set_cursor_shape(CursorShape p_shape) {
} else {
SetCursor(LoadCursor(hInstance, win_cursors[p_shape]));
}
+
cursor_shape = p_shape;
}
void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
if (p_cursor.is_valid()) {
Ref<Texture> texture = p_cursor;
- Ref<Image> image = texture->get_data();
+ Ref<AtlasTexture> atlas_texture = p_cursor;
+ Ref<Image> image;
+ Size2 texture_size;
+ Rect2 atlas_rect;
- UINT image_size = 32 * 32;
- UINT size = sizeof(UINT) * image_size;
+ if (texture.is_valid()) {
+ image = texture->get_data();
+ }
- ERR_FAIL_COND(texture->get_width() != 32 || texture->get_height() != 32);
+ if (!image.is_valid() && atlas_texture.is_valid()) {
+ texture = atlas_texture->get_atlas();
+
+ atlas_rect.size.width = texture->get_width();
+ atlas_rect.size.height = texture->get_height();
+ atlas_rect.position.x = atlas_texture->get_region().position.x;
+ atlas_rect.position.y = atlas_texture->get_region().position.y;
+
+ texture_size.width = atlas_texture->get_region().size.x;
+ texture_size.height = atlas_texture->get_region().size.y;
+ } else if (image.is_valid()) {
+ texture_size.width = texture->get_width();
+ texture_size.height = texture->get_height();
+ }
+
+ ERR_FAIL_COND(!texture.is_valid());
+ ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
+
+ image = texture->get_data();
+
+ ERR_FAIL_COND(!image.is_valid());
+
+ UINT image_size = texture_size.width * texture_size.height;
+ UINT size = sizeof(UINT) * image_size;
// Create the BITMAP with alpha channel
- COLORREF *buffer = (COLORREF *)malloc(sizeof(COLORREF) * image_size);
+ COLORREF *buffer = (COLORREF *)memalloc(sizeof(COLORREF) * image_size);
image->lock();
for (UINT index = 0; index < image_size; index++) {
- int column_index = floor(index / 32);
- int row_index = index % 32;
+ int row_index = floor(index / texture_size.width) + atlas_rect.position.y;
+ int column_index = (index % int(texture_size.width)) + atlas_rect.position.x;
+
+ if (atlas_texture.is_valid()) {
+ column_index = MIN(column_index, atlas_rect.size.width - 1);
+ row_index = MIN(row_index, atlas_rect.size.height - 1);
+ }
- Color pcColor = image->get_pixel(row_index, column_index);
- *(buffer + index) = image->get_pixel(row_index, column_index).to_argb32();
+ *(buffer + index) = image->get_pixel(column_index, row_index).to_argb32();
}
image->unlock();
// Using 4 channels, so 4 * 8 bits
- HBITMAP bitmap = CreateBitmap(32, 32, 1, 4 * 8, buffer);
+ HBITMAP bitmap = CreateBitmap(texture_size.width, texture_size.height, 1, 4 * 8, buffer);
COLORREF clrTransparent = -1;
// Create the AND and XOR masks for the bitmap
@@ -1928,6 +2123,8 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
GetMaskBitmaps(bitmap, clrTransparent, hAndMask, hXorMask);
if (NULL == hAndMask || NULL == hXorMask) {
+ memfree(buffer);
+ DeleteObject(bitmap);
return;
}
@@ -1952,6 +2149,14 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
if (hXorMask != NULL) {
DeleteObject(hXorMask);
}
+
+ memfree(buffer);
+ DeleteObject(bitmap);
+ } else {
+ // Reset to default system cursor
+ cursors[p_shape] = NULL;
+ cursor_shape = CURSOR_MAX;
+ set_cursor_shape(p_shape);
}
}
@@ -2017,10 +2222,6 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
argss += String(" \"") + E->get() + "\"";
}
- //print_line("ARGS: "+argss);
- //argss+"\"";
- //argss+=" 2>nul";
-
FILE *f = _wpopen(argss.c_str(), L"r");
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
@@ -2047,15 +2248,12 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
I = I->next();
};
- //cmdline+="\"";
-
ProcessInfo pi;
ZeroMemory(&pi.si, sizeof(pi.si));
pi.si.cb = sizeof(pi.si);
ZeroMemory(&pi.pi, sizeof(pi.pi));
LPSTARTUPINFOW si_w = (LPSTARTUPINFOW)&pi.si;
- print_line("running cmdline: " + cmdline);
Vector<CharType> modstr; //windows wants to change this no idea why
modstr.resize(cmdline.size());
for (int i = 0; i < cmdline.size(); i++)
@@ -2474,13 +2672,29 @@ String OS_Windows::get_unique_id() const {
return String(HwProfInfo.szHwProfileGuid);
}
+void OS_Windows::set_ime_active(const bool p_active) {
+
+ if (p_active) {
+ ImmAssociateContext(hWnd, im_himc);
+
+ set_ime_position(im_position);
+ } else {
+ ImmAssociateContext(hWnd, (HIMC)0);
+ }
+}
+
void OS_Windows::set_ime_position(const Point2 &p_pos) {
+ im_position = p_pos;
+
HIMC himc = ImmGetContext(hWnd);
+ if (himc == (HIMC)0)
+ return;
+
COMPOSITIONFORM cps;
cps.dwStyle = CFS_FORCE_POSITION;
- cps.ptCurrentPos.x = p_pos.x;
- cps.ptCurrentPos.y = p_pos.y;
+ cps.ptCurrentPos.x = im_position.x;
+ cps.ptCurrentPos.y = im_position.y;
ImmSetCompositionWindow(himc, &cps);
ImmReleaseContext(hWnd, himc);
}
@@ -2562,6 +2776,8 @@ Error OS_Windows::move_to_trash(const String &p_path) {
OS_Windows::OS_Windows(HINSTANCE _hInstance) {
key_event_pos = 0;
+ layered_window = false;
+ hBitmap = NULL;
force_quit = false;
alt_mem = false;
gr_mem = false;
@@ -2595,6 +2811,10 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
}
OS_Windows::~OS_Windows() {
+ if (is_layered_allowed() && layered_window) {
+ DeleteObject(hBitmap);
+ DeleteDC(hDC_dib);
+ }
#ifdef STDOUT_FILE
fclose(stdo);
#endif
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 4c4fbcf8f0..19af63bae0 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -93,17 +93,28 @@ class OS_Windows : public OS {
HINSTANCE hInstance; // Holds The Instance Of The Application
HWND hWnd;
+ HBITMAP hBitmap; //DIB section for layered window
+ uint8_t *dib_data;
+ Size2 dib_size;
+ HDC hDC_dib;
+ bool layered_window;
+
uint32_t move_timer_id;
HCURSOR hCursor;
Size2 window_rect;
VideoMode video_mode;
+ bool preserve_window_size = false;
MainLoop *main_loop;
WNDPROC user_proc;
+ // IME
+ HIMC im_himc;
+ Vector2 im_position;
+
MouseMode mouse_mode;
bool alt_mem;
bool gr_mem;
@@ -142,12 +153,6 @@ class OS_Windows : public OS {
// functions used by main to initialize/deintialize the OS
protected:
- virtual int get_video_driver_count() const;
- virtual const char *get_video_driver_name(int p_driver) const;
-
- virtual int get_audio_driver_count() const;
- virtual const char *get_audio_driver_name(int p_driver) const;
-
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -218,6 +223,13 @@ public:
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window();
+ virtual bool get_window_per_pixel_transparency_enabled() const;
+ virtual void set_window_per_pixel_transparency_enabled(bool p_enabled);
+
+ virtual uint8_t *get_layered_buffer_data();
+ virtual Size2 get_layered_buffer_size();
+ virtual void swap_layered_buffer();
+
virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false);
virtual Error close_dynamic_library(void *p_library_handle);
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
@@ -274,6 +286,7 @@ public:
virtual String get_unique_id() const;
+ virtual void set_ime_active(const bool p_active);
virtual void set_ime_position(const Point2 &p_pos);
virtual void release_rendering_thread();
@@ -300,6 +313,7 @@ public:
void disable_crash_handler();
bool is_disable_crash_handler() const;
+ virtual void initialize_debugging();
void force_process_input();
diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h
index 10ec9110d1..d100385e80 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/platform_config.h
@@ -33,3 +33,4 @@
//#include <alloca.h>
//#endif
#define GLES3_INCLUDE_H "glad/glad.h"
+#define GLES2_INCLUDE_H "glad/glad.h"
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index 20f2212861..cd76667c64 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -116,50 +116,113 @@ Error ContextGL_X11::initialize() {
None
};
+ static int visual_attribs_layered[] = {
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
+ GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+ GLX_DOUBLEBUFFER, true,
+ GLX_RED_SIZE, 8,
+ GLX_GREEN_SIZE, 8,
+ GLX_BLUE_SIZE, 8,
+ GLX_ALPHA_SIZE, 8,
+ GLX_DEPTH_SIZE, 24,
+ None
+ };
+
int fbcount;
- GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount);
- ERR_FAIL_COND_V(!fbc, ERR_UNCONFIGURED);
+ GLXFBConfig fbconfig;
+ XVisualInfo *vi = NULL;
+
+ if (OS::get_singleton()->is_layered_allowed()) {
+ GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs_layered, &fbcount);
+ ERR_FAIL_COND_V(!fbc, ERR_UNCONFIGURED);
+
+ for (int i = 0; i < fbcount; i++) {
+ vi = (XVisualInfo *)glXGetVisualFromFBConfig(x11_display, fbc[i]);
+ if (!vi)
+ continue;
+
+ XRenderPictFormat *pict_format = XRenderFindVisualFormat(x11_display, vi->visual);
+ if (!pict_format) {
+ XFree(vi);
+ vi = NULL;
+ continue;
+ }
+
+ fbconfig = fbc[i];
+ if (pict_format->direct.alphaMask > 0) {
+ break;
+ }
+ }
+ ERR_FAIL_COND_V(!fbconfig, ERR_UNCONFIGURED);
+
+ XSetWindowAttributes swa;
+
+ swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
+ swa.border_pixel = 0;
+ swa.background_pixmap = None;
+ swa.background_pixel = 0;
+ swa.border_pixmap = None;
+ swa.event_mask = StructureNotifyMask;
+
+ x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask | CWBackPixel, &swa);
- XVisualInfo *vi = glXGetVisualFromFBConfig(x11_display, fbc[0]);
+ } else {
+ GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount);
+ ERR_FAIL_COND_V(!fbc, ERR_UNCONFIGURED);
- XSetWindowAttributes swa;
+ vi = glXGetVisualFromFBConfig(x11_display, fbc[0]);
- swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
- swa.border_pixel = 0;
- swa.event_mask = StructureNotifyMask;
+ fbconfig = fbc[0];
- /*
- char* windowid = getenv("GODOT_WINDOWID");
- if (windowid) {
+ XSetWindowAttributes swa;
+
+ swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
+ swa.border_pixel = 0;
+ swa.event_mask = StructureNotifyMask;
+
+ x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);
+ }
- //freopen("/home/punto/stdout", "w", stdout);
- //reopen("/home/punto/stderr", "w", stderr);
- x11_window = atol(windowid);
- } else {
- */
- x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);
ERR_FAIL_COND_V(!x11_window, ERR_UNCONFIGURED);
set_class_hint(x11_display, x11_window);
XMapWindow(x11_display, x11_window);
- //};
int (*oldHandler)(Display *, XErrorEvent *) =
XSetErrorHandler(&ctxErrorHandler);
- if (!opengl_3_context) {
- //oldstyle context:
- p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE);
- } else {
- static int context_attribs[] = {
- GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
- GLX_CONTEXT_MINOR_VERSION_ARB, 3,
- GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /*|GLX_CONTEXT_DEBUG_BIT_ARB*/,
- None
- };
-
- p->glx_context = glXCreateContextAttribsARB(x11_display, fbc[0], NULL, true, context_attribs);
- ERR_EXPLAIN("Could not obtain an OpenGL 3.3 context!");
- ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context, ERR_UNCONFIGURED);
+ switch (context_type) {
+ case GLES_2_0_COMPATIBLE:
+ case OLDSTYLE: {
+ p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE);
+ } break;
+ /*
+ case ContextType::GLES_2_0_COMPATIBLE: {
+
+ static int context_attribs[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 0,
+ None
+ };
+
+ p->glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs);
+ ERR_EXPLAIN("Could not obtain an OpenGL 3.0 context!");
+ ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED);
+ } break;
+ */
+ case GLES_3_0_COMPATIBLE: {
+
+ static int context_attribs[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 3,
+ GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
+ GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB /*|GLX_CONTEXT_DEBUG_BIT_ARB*/,
+ None
+ };
+
+ p->glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs);
+ ERR_EXPLAIN("Could not obtain an OpenGL 3.3 context!");
+ ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context, ERR_UNCONFIGURED);
+ } break;
}
XSync(x11_display, False);
@@ -176,7 +239,6 @@ Error ContextGL_X11::initialize() {
//glXMakeCurrent(x11_display, None, NULL);
XFree(vi);
- XFree(fbc);
return OK;
}
@@ -229,13 +291,13 @@ bool ContextGL_X11::is_using_vsync() const {
return use_vsync;
}
-ContextGL_X11::ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, bool p_opengl_3_context) :
+ContextGL_X11::ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type) :
x11_window(p_x11_window) {
default_video_mode = p_default_video_mode;
x11_display = p_x11_display;
- opengl_3_context = p_opengl_3_context;
+ context_type = p_context_type;
double_buffer = false;
direct_render = false;
diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h
index c969f0044d..b8f3eb95d4 100644
--- a/platform/x11/context_gl_x11.h
+++ b/platform/x11/context_gl_x11.h
@@ -41,11 +41,20 @@
#include "drivers/gl_context/context_gl.h"
#include "os/os.h"
#include <X11/Xlib.h>
+#include <X11/extensions/Xrender.h>
struct ContextGL_X11_Private;
class ContextGL_X11 : public ContextGL {
+public:
+ enum ContextType {
+ OLDSTYLE,
+ GLES_2_0_COMPATIBLE,
+ GLES_3_0_COMPATIBLE
+ };
+
+private:
ContextGL_X11_Private *p;
OS::VideoMode default_video_mode;
//::Colormap x11_colormap;
@@ -54,8 +63,8 @@ class ContextGL_X11 : public ContextGL {
bool double_buffer;
bool direct_render;
int glx_minor, glx_major;
- bool opengl_3_context;
bool use_vsync;
+ ContextType context_type;
public:
virtual void release_current();
@@ -69,7 +78,7 @@ public:
virtual void set_use_vsync(bool p_use);
virtual bool is_using_vsync() const;
- ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, bool p_opengl_3_context);
+ ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type);
~ContextGL_X11();
};
diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp
index 43b9051ea7..d39fc33f81 100644
--- a/platform/x11/crash_handler_x11.cpp
+++ b/platform/x11/crash_handler_x11.cpp
@@ -32,8 +32,9 @@
#define CRASH_HANDLER_ENABLED 1
#endif
+#include "crash_handler_x11.h"
#include "main/main.h"
-#include "os_x11.h"
+#include "os/os.h"
#include "project_settings.h"
#ifdef CRASH_HANDLER_ENABLED
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index da2b0701b6..09e16ad078 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -42,6 +42,11 @@ def can_build():
print("xrandr not found.. x11 disabled.")
return False
+ x11_error = os.system("pkg-config xrender --modversion > /dev/null ")
+ if (x11_error):
+ print("xrender not found.. x11 disabled.")
+ return False
+
return True
def get_opts():
@@ -54,8 +59,8 @@ def get_opts():
BoolVariable('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', False),
BoolVariable('pulseaudio', 'Detect & use pulseaudio', True),
BoolVariable('udev', 'Use udev for gamepad connection callbacks', False),
- EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
- BoolVariable('separate_debug_symbols', 'Create a separate file with the debug symbols', False),
+ EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
+ BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
BoolVariable('touch', 'Enable touch events', True),
]
@@ -141,6 +146,7 @@ def configure(env):
env.ParseConfig('pkg-config xcursor --cflags --libs')
env.ParseConfig('pkg-config xinerama --cflags --libs')
env.ParseConfig('pkg-config xrandr --cflags --libs')
+ env.ParseConfig('pkg-config xrender --cflags --libs')
if (env['touch']):
x11_error = os.system("pkg-config xi --modversion > /dev/null ")
@@ -152,14 +158,6 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
- if not env['builtin_mbedtls']:
- # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
- env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
-
- if not env['builtin_libwebp']:
- env.ParseConfig('pkg-config libwebp --cflags --libs')
-
-
# freetype depends on libpng and zlib, so bundling one of them while keeping others
# as shared libraries leads to weird issues
if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
@@ -199,6 +197,10 @@ def configure(env):
env['builtin_libogg'] = False # Needed to link against system libtheora
env['builtin_libvorbis'] = False # Needed to link against system libtheora
env.ParseConfig('pkg-config theora theoradec --cflags --libs')
+ else:
+ list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
+ if any(platform.machine() in s for s in list_of_x86):
+ env["x86_libtheora_opt_gcc"] = True
if not env['builtin_libvpx']:
env.ParseConfig('pkg-config vpx --cflags --libs')
@@ -214,10 +216,20 @@ def configure(env):
if not env['builtin_libogg']:
env.ParseConfig('pkg-config ogg --cflags --libs')
- if env['builtin_libtheora']:
- list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
- if any(platform.machine() in s for s in list_of_x86):
- env["x86_libtheora_opt_gcc"] = True
+ if not env['builtin_libwebp']:
+ env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+ if not env['builtin_mbedtls']:
+ # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
+ env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
+
+ if not env['builtin_libwebsockets']:
+ env.ParseConfig('pkg-config libwebsockets --cflags --libs')
+
+ if not env['builtin_miniupnpc']:
+ # No pkgconfig file so far, hardcode default paths.
+ env.Append(CPPPATH=["/usr/include/miniupnpc"])
+ env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
# 16-bit library shouldn't be required due to compiler optimisations
@@ -234,10 +246,10 @@ def configure(env):
print("ALSA libraries not found, disabling driver")
if env['pulseaudio']:
- if (os.system("pkg-config --exists libpulse-simple") == 0): # 0 means found
+ if (os.system("pkg-config --exists libpulse") == 0): # 0 means found
print("Enabling PulseAudio")
env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
- env.ParseConfig('pkg-config --cflags --libs libpulse-simple')
+ env.ParseConfig('pkg-config --cflags --libs libpulse')
else:
print("PulseAudio development libraries not found, disabling driver")
diff --git a/platform/x11/logo.png b/platform/x11/logo.png
index 1cc93b46ac..078654b757 100644
--- a/platform/x11/logo.png
+++ b/platform/x11/logo.png
Binary files differ
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 66c02561b5..2bc85f76c9 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "os_x11.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "errno.h"
#include "key_mapping_x11.h"
@@ -76,25 +77,6 @@
#include <X11/XKBlib.h>
-int OS_X11::get_video_driver_count() const {
- return 1;
-}
-
-const char *OS_X11::get_video_driver_name(int p_driver) const {
- return "GLES3";
-}
-
-int OS_X11::get_audio_driver_count() const {
- return AudioDriverManager::get_driver_count();
-}
-
-const char *OS_X11::get_audio_driver_name(int p_driver) const {
-
- AudioDriver *driver = AudioDriverManager::get_driver(p_driver);
- ERR_FAIL_COND_V(!driver, "");
- return AudioDriverManager::get_driver(p_driver)->get_name();
-}
-
void OS_X11::initialize_core() {
crash_handler.initialize();
@@ -283,12 +265,25 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
//print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height));
#if defined(OPENGL_ENABLED)
- context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, true));
- context_gl->initialize();
+ ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
- RasterizerGLES3::register_config();
+ if (p_video_driver == VIDEO_DRIVER_GLES2) {
+ opengl_api_type = ContextGL_X11::GLES_2_0_COMPATIBLE;
+ }
- RasterizerGLES3::make_current();
+ context_gl = memnew(ContextGL_X11(x11_display, x11_window, current_videomode, opengl_api_type));
+ context_gl->initialize();
+
+ switch (opengl_api_type) {
+ case ContextGL_X11::GLES_2_0_COMPATIBLE: {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } break;
+ case ContextGL_X11::GLES_3_0_COMPATIBLE: {
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ } break;
+ }
context_gl->set_use_vsync(current_videomode.use_vsync);
@@ -396,6 +391,9 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
XSetWMProtocols(x11_display, x11_window, &wm_delete, 1);
+ im_active = false;
+ im_position = Vector2();
+
if (xim && xim_style) {
xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, x11_window, XNFocusWindow, x11_window, (char *)NULL);
@@ -405,7 +403,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
xic = NULL;
}
if (xic) {
- XSetICFocus(xic);
+ XUnsetICFocus(xic);
} else {
WARN_PRINT("XCreateIC couldn't create xic");
}
@@ -522,6 +520,10 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
power_manager = memnew(PowerX11);
+ if (p_desired.layered_splash) {
+ set_window_per_pixel_transparency_enabled(true);
+ }
+
XEvent xevent;
while (XPending(x11_display) > 0) {
XNextEvent(x11_display, &xevent);
@@ -542,8 +544,25 @@ void OS_X11::xim_destroy_callback(::XIM im, ::XPointer client_data,
os->xic = NULL;
}
+void OS_X11::set_ime_active(const bool p_active) {
+
+ im_active = p_active;
+
+ if (!xic)
+ return;
+
+ if (p_active) {
+ XSetICFocus(xic);
+ set_ime_position(im_position);
+ } else {
+ XUnsetICFocus(xic);
+ }
+}
+
void OS_X11::set_ime_position(const Point2 &p_pos) {
+ im_position = p_pos;
+
if (!xic)
return;
@@ -639,7 +658,7 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
bool showCursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED);
if (showCursor) {
- XUndefineCursor(x11_display, x11_window); // show cursor
+ XDefineCursor(x11_display, x11_window, cursors[current_cursor]); // show cursor
} else {
XDefineCursor(x11_display, x11_window, null_cursor); // hide cursor
}
@@ -712,6 +731,25 @@ Point2 OS_X11::get_mouse_position() const {
return last_mouse_pos;
}
+bool OS_X11::get_window_per_pixel_transparency_enabled() const {
+
+ if (!is_layered_allowed()) return false;
+ return layered_window;
+}
+
+void OS_X11::set_window_per_pixel_transparency_enabled(bool p_enabled) {
+
+ if (!is_layered_allowed()) return;
+ if (layered_window != p_enabled) {
+ if (p_enabled) {
+ set_borderless_window(true);
+ layered_window = true;
+ } else {
+ layered_window = false;
+ }
+ }
+}
+
void OS_X11::set_window_title(const String &p_title) {
XStoreName(x11_display, x11_window, p_title.utf8().get_data());
@@ -1011,9 +1049,13 @@ void OS_X11::set_window_size(const Size2 p_size) {
}
void OS_X11::set_window_fullscreen(bool p_enabled) {
+
if (current_videomode.fullscreen == p_enabled)
return;
+ if (layered_window)
+ set_window_per_pixel_transparency_enabled(false);
+
if (p_enabled && current_videomode.always_on_top) {
// Fullscreen + Always-on-top requires a maximized window on some window managers (Metacity)
set_window_maximized(true);
@@ -1193,6 +1235,7 @@ bool OS_X11::is_window_maximized() const {
unsigned long len;
unsigned long remaining;
unsigned char *data = NULL;
+ bool retval = false;
int result = XGetWindowProperty(
x11_display,
@@ -1221,13 +1264,15 @@ bool OS_X11::is_window_maximized() const {
if (atoms[i] == wm_max_vert)
found_wm_max_vert = true;
- if (found_wm_max_horz && found_wm_max_vert)
- return true;
+ if (found_wm_max_horz && found_wm_max_vert) {
+ retval = true;
+ break;
+ }
}
- XFree(atoms);
}
- return false;
+ XFree(data);
+ return retval;
}
void OS_X11::set_window_always_on_top(bool p_enabled) {
@@ -1256,6 +1301,9 @@ void OS_X11::set_borderless_window(bool p_borderless) {
if (current_videomode.borderless_window == p_borderless)
return;
+ if (!p_borderless && layered_window)
+ set_window_per_pixel_transparency_enabled(false);
+
current_videomode.borderless_window = p_borderless;
Hints hints;
@@ -1264,6 +1312,9 @@ void OS_X11::set_borderless_window(bool p_borderless) {
hints.decorations = current_videomode.borderless_window ? 0 : 1;
property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5);
+
+ // Preserve window size
+ set_window_size(Size2(current_videomode.width, current_videomode.height));
}
bool OS_X11::get_borderless_window() {
@@ -1692,6 +1743,11 @@ void OS_X11::process_xevents() {
if (touch.state.has(index)) // Defensive
break;
touch.state[index] = pos;
+ if (touch.state.size() == 1) {
+ // X11 may send a motion event when a touch gesture begins, that would result
+ // in a spurious mouse motion event being sent to Godot; remember it to be able to filter it out
+ touch.mouse_pos_to_filter = pos;
+ }
input->parse_input_event(st);
} else {
if (!touch.state.has(index)) // Defensive
@@ -1898,6 +1954,20 @@ void OS_X11::process_xevents() {
// to be able to send relative motion events.
Point2i pos(event.xmotion.x, event.xmotion.y);
+#ifdef TOUCH_ENABLED
+ // Avoidance of spurious mouse motion (see handling of touch)
+ bool filter = false;
+ // Adding some tolerance to match better Point2i to Vector2
+ if (touch.state.size() && Vector2(pos).distance_squared_to(touch.mouse_pos_to_filter) < 2) {
+ filter = true;
+ }
+ // Invalidate to avoid filtering a possible legitimate similar event coming later
+ touch.mouse_pos_to_filter = Vector2(1e10, 1e10);
+ if (filter) {
+ break;
+ }
+#endif
+
if (mouse_mode == MOUSE_MODE_CAPTURED) {
if (pos == Point2i(current_videomode.width / 2, current_videomode.height / 2)) {
@@ -2362,7 +2432,7 @@ void OS_X11::set_cursor_shape(CursorShape p_shape) {
if (p_shape == current_cursor)
return;
- if (mouse_mode == MOUSE_MODE_VISIBLE) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {
if (cursors[p_shape] != None)
XDefineCursor(x11_display, x11_window, cursors[p_shape]);
else if (cursors[CURSOR_ARROW] != None)
@@ -2375,13 +2445,40 @@ void OS_X11::set_cursor_shape(CursorShape p_shape) {
void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
if (p_cursor.is_valid()) {
Ref<Texture> texture = p_cursor;
- Ref<Image> image = texture->get_data();
+ Ref<AtlasTexture> atlas_texture = p_cursor;
+ Ref<Image> image;
+ Size2 texture_size;
+ Rect2 atlas_rect;
- ERR_FAIL_COND(texture->get_width() != 32 || texture->get_height() != 32);
+ if (texture.is_valid()) {
+ image = texture->get_data();
+ }
+
+ if (!image.is_valid() && atlas_texture.is_valid()) {
+ texture = atlas_texture->get_atlas();
+
+ atlas_rect.size.width = texture->get_width();
+ atlas_rect.size.height = texture->get_height();
+ atlas_rect.position.x = atlas_texture->get_region().position.x;
+ atlas_rect.position.y = atlas_texture->get_region().position.y;
+
+ texture_size.width = atlas_texture->get_region().size.x;
+ texture_size.height = atlas_texture->get_region().size.y;
+ } else if (image.is_valid()) {
+ texture_size.width = texture->get_width();
+ texture_size.height = texture->get_height();
+ }
+
+ ERR_FAIL_COND(!texture.is_valid());
+ ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
+
+ image = texture->get_data();
+
+ ERR_FAIL_COND(!image.is_valid());
// Create the cursor structure
- XcursorImage *cursor_image = XcursorImageCreate(texture->get_width(), texture->get_height());
- XcursorUInt image_size = 32 * 32;
+ XcursorImage *cursor_image = XcursorImageCreate(texture_size.width, texture_size.height);
+ XcursorUInt image_size = texture_size.width * texture_size.height;
XcursorDim size = sizeof(XcursorPixel) * image_size;
cursor_image->version = 1;
@@ -2390,15 +2487,20 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
cursor_image->yhot = p_hotspot.y;
// allocate memory to contain the whole file
- cursor_image->pixels = (XcursorPixel *)malloc(size);
+ cursor_image->pixels = (XcursorPixel *)memalloc(size);
image->lock();
for (XcursorPixel index = 0; index < image_size; index++) {
- int column_index = floor(index / 32);
- int row_index = index % 32;
+ int row_index = floor(index / texture_size.width) + atlas_rect.position.y;
+ int column_index = (index % int(texture_size.width)) + atlas_rect.position.x;
- *(cursor_image->pixels + index) = image->get_pixel(row_index, column_index).to_argb32();
+ if (atlas_texture.is_valid()) {
+ column_index = MIN(column_index, atlas_rect.size.width - 1);
+ row_index = MIN(row_index, atlas_rect.size.height - 1);
+ }
+
+ *(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32();
}
image->unlock();
@@ -2411,22 +2513,39 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
if (p_shape == CURSOR_ARROW) {
XDefineCursor(x11_display, x11_window, cursors[p_shape]);
}
+
+ memfree(cursor_image->pixels);
+ XcursorImageDestroy(cursor_image);
+ } else {
+ // Reset to default system cursor
+ if (img[p_shape]) {
+ cursors[p_shape] = XcursorImageLoadCursor(x11_display, img[p_shape]);
+ }
+
+ current_cursor = CURSOR_MAX;
+ set_cursor_shape(p_shape);
}
}
void OS_X11::release_rendering_thread() {
+#if defined(OPENGL_ENABLED)
context_gl->release_current();
+#endif
}
void OS_X11::make_rendering_thread() {
+#if defined(OPENGL_ENABLED)
context_gl->make_current();
+#endif
}
void OS_X11::swap_buffers() {
+#if defined(OPENGL_ENABLED)
context_gl->swap_buffers();
+#endif
}
void OS_X11::alert(const String &p_alert, const String &p_title) {
@@ -2520,8 +2639,10 @@ String OS_X11::get_joy_guid(int p_device) const {
}
void OS_X11::_set_use_vsync(bool p_enable) {
+#if defined(OPENGL_ENABLED)
if (context_gl)
- return context_gl->set_use_vsync(p_enable);
+ context_gl->set_use_vsync(p_enable);
+#endif
}
/*
bool OS_X11::is_vsync_enabled() const {
@@ -2700,6 +2821,7 @@ OS_X11::OS_X11() {
AudioDriverManager::add_driver(&driver_alsa);
#endif
+ layered_window = false;
minimized = false;
xim_style = 0L;
mouse_mode = MOUSE_MODE_VISIBLE;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 494845bc56..8cab23fe63 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -116,6 +116,10 @@ class OS_X11 : public OS_Unix {
static void xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data);
+ // IME
+ bool im_active;
+ Vector2 im_position;
+
Point2i last_mouse_pos;
bool last_mouse_pos_valid;
Point2i last_click_pos;
@@ -127,6 +131,7 @@ class OS_X11 : public OS_Unix {
Vector<int> devices;
XIEventMask event_mask;
Map<int, Vector2> state;
+ Vector2 mouse_pos_to_filter;
} touch;
#endif
@@ -171,6 +176,8 @@ class OS_X11 : public OS_Unix {
PowerX11 *power_manager;
+ bool layered_window;
+
CrashHandler crash_handler;
int audio_driver_index;
@@ -188,12 +195,6 @@ class OS_X11 : public OS_Unix {
Bool xrandr_ext_ok;
protected:
- virtual int get_video_driver_count() const;
- virtual const char *get_video_driver_name(int p_driver) const;
-
- virtual int get_audio_driver_count() const;
- virtual const char *get_audio_driver_name(int p_driver) const;
-
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void finalize();
@@ -268,6 +269,11 @@ public:
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window();
+
+ virtual bool get_window_per_pixel_transparency_enabled() const;
+ virtual void set_window_per_pixel_transparency_enabled(bool p_enabled);
+
+ virtual void set_ime_active(const bool p_active);
virtual void set_ime_position(const Point2 &p_pos);
virtual String get_unique_id() const;
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index 58d6b210ee..b757be49c3 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -37,3 +37,4 @@
#endif
#define GLES3_INCLUDE_H "glad/glad.h"
+#define GLES2_INCLUDE_H "glad/glad.h"
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 824f50495b..e3d1592be0 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -59,15 +59,36 @@ bool AnimatedSprite::_edit_use_pivot() const {
}
Rect2 AnimatedSprite::_edit_get_rect() const {
+ return _get_rect();
+}
+
+bool AnimatedSprite::_edit_use_rect() const {
+ if (!frames.is_valid() || !frames->has_animation(animation) || frame < 0 || frame >= frames->get_frame_count(animation)) {
+ return false;
+ }
+ Ref<Texture> t;
+ if (animation)
+ t = frames->get_frame(animation, frame);
+ if (t.is_null())
+ return false;
+
+ return true;
+}
+
+Rect2 AnimatedSprite::get_anchorable_rect() const {
+ return _get_rect();
+}
+
+Rect2 AnimatedSprite::_get_rect() const {
if (!frames.is_valid() || !frames->has_animation(animation) || frame < 0 || frame >= frames->get_frame_count(animation)) {
- return Node2D::_edit_get_rect();
+ return Rect2();
}
Ref<Texture> t;
if (animation)
t = frames->get_frame(animation, frame);
if (t.is_null())
- return Node2D::_edit_get_rect();
+ return Rect2();
Size2 s = t->get_size();
Point2 ofs = offset;
@@ -347,7 +368,7 @@ void AnimatedSprite::_notification(int p_what) {
if (frame < 0)
return;
- float speed = frames->get_animation_speed(animation);
+ float speed = frames->get_animation_speed(animation) * speed_scale;
if (speed == 0)
return; //do nothing
@@ -357,7 +378,7 @@ void AnimatedSprite::_notification(int p_what) {
if (timeout <= 0) {
- timeout = 1.0 / speed;
+ timeout = _get_frame_duration();
int fc = frames->get_frame_count(animation);
if (frame >= fc - 1) {
@@ -477,6 +498,22 @@ int AnimatedSprite::get_frame() const {
return frame;
}
+void AnimatedSprite::set_speed_scale(float p_speed_scale) {
+
+ float elapsed = _get_frame_duration() - timeout;
+
+ speed_scale = MAX(p_speed_scale, 0.0f);
+
+ // We adapt the timeout so that the animation speed adapts as soon as the speed scale is changed
+ _reset_timeout();
+ timeout -= elapsed;
+}
+
+float AnimatedSprite::get_speed_scale() const {
+
+ return speed_scale;
+}
+
void AnimatedSprite::set_centered(bool p_center) {
centered = p_center;
@@ -560,21 +597,22 @@ bool AnimatedSprite::is_playing() const {
return playing;
}
+float AnimatedSprite::_get_frame_duration() {
+ if (frames.is_valid() && frames->has_animation(animation)) {
+ float speed = frames->get_animation_speed(animation) * speed_scale;
+ if (speed > 0) {
+ return 1.0 / speed;
+ }
+ }
+ return 0.0;
+}
+
void AnimatedSprite::_reset_timeout() {
if (!playing)
return;
- if (frames.is_valid() && frames->has_animation(animation)) {
- float speed = frames->get_animation_speed(animation);
- if (speed > 0) {
- timeout = 1.0 / speed;
- } else {
- timeout = 0;
- }
- } else {
- timeout = 0;
- }
+ timeout = _get_frame_duration();
}
void AnimatedSprite::set_animation(const StringName &p_animation) {
@@ -632,6 +670,9 @@ void AnimatedSprite::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_frame", "frame"), &AnimatedSprite::set_frame);
ClassDB::bind_method(D_METHOD("get_frame"), &AnimatedSprite::get_frame);
+ ClassDB::bind_method(D_METHOD("set_speed_scale", "speed_scale"), &AnimatedSprite::set_speed_scale);
+ ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimatedSprite::get_speed_scale);
+
ClassDB::bind_method(D_METHOD("_res_changed"), &AnimatedSprite::_res_changed);
ADD_SIGNAL(MethodInfo("frame_changed"));
@@ -640,6 +681,7 @@ void AnimatedSprite::_bind_methods() {
ADD_PROPERTYNZ(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_PROPERTYNZ(PropertyInfo(Variant::INT, "frame", PROPERTY_HINT_SPRITE_FRAME), "set_frame", "get_frame");
+ ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "speed_scale"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "playing"), "_set_playing", "_is_playing");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "centered"), "set_centered", "is_centered");
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
@@ -654,6 +696,7 @@ AnimatedSprite::AnimatedSprite() {
vflip = false;
frame = 0;
+ speed_scale = 1.0f;
playing = false;
animation = "default";
timeout = 0;
diff --git a/scene/2d/animated_sprite.h b/scene/2d/animated_sprite.h
index a38adf792c..806052a696 100644
--- a/scene/2d/animated_sprite.h
+++ b/scene/2d/animated_sprite.h
@@ -129,6 +129,7 @@ class AnimatedSprite : public Node2D {
bool playing;
StringName animation;
int frame;
+ float speed_scale;
bool centered;
Point2 offset;
@@ -140,9 +141,11 @@ class AnimatedSprite : public Node2D {
void _res_changed();
+ float _get_frame_duration();
void _reset_timeout();
void _set_playing(bool p_playing);
bool _is_playing() const;
+ Rect2 _get_rect() const;
protected:
static void _bind_methods();
@@ -157,6 +160,9 @@ public:
virtual Point2 _edit_get_pivot() const;
virtual bool _edit_use_pivot() const;
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
+
+ virtual Rect2 get_anchorable_rect() const;
void set_sprite_frames(const Ref<SpriteFrames> &p_frames);
Ref<SpriteFrames> get_sprite_frames() const;
@@ -171,6 +177,9 @@ public:
void set_frame(int p_frame);
int get_frame() const;
+ void set_speed_scale(float p_speed_scale);
+ float get_speed_scale() 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 bb914b90fc..c375374dce 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -666,11 +666,11 @@ void Area2D::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "space_override", PROPERTY_HINT_ENUM, "Disabled,Combine,Combine-Replace,Replace,Replace-Combine"), "set_space_override_mode", "get_space_override_mode");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "gravity_point"), "set_gravity_is_point", "is_gravity_a_point");
- ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "gravity_distance_scale", PROPERTY_HINT_RANGE, "0,1024,0.001"), "set_gravity_distance_scale", "get_gravity_distance_scale");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "gravity_distance_scale", PROPERTY_HINT_EXP_RANGE, "0,1024,0.001,or_greater"), "set_gravity_distance_scale", "get_gravity_distance_scale");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "gravity_vec"), "set_gravity_vector", "get_gravity_vector");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "gravity", PROPERTY_HINT_RANGE, "-1024,1024,0.001"), "set_gravity", "get_gravity");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "linear_damp", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_linear_damp", "get_linear_damp");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_damp", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_angular_damp", "get_angular_damp");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "linear_damp", PROPERTY_HINT_RANGE, "0,100,0.01,or_greater"), "set_linear_damp", "get_linear_damp");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_damp", PROPERTY_HINT_RANGE, "0,100,0.01,or_greater"), "set_angular_damp", "get_angular_damp");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "priority", PROPERTY_HINT_RANGE, "0,128,1"), "set_priority", "get_priority");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitoring"), "set_monitoring", "is_monitoring");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "monitorable"), "set_monitorable", "is_monitorable");
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index f998f23d3b..6e77369d65 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -36,11 +36,8 @@
void AudioStreamPlayer2D::_mix_audio() {
- if (!stream_playback.is_valid()) {
- return;
- }
-
- if (!active) {
+ if (!stream_playback.is_valid() || !active ||
+ (stream_paused && stream_paused_fade <= 0.f)) {
return;
}
@@ -53,8 +50,10 @@ void AudioStreamPlayer2D::_mix_audio() {
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
- //mix
- stream_playback->mix(buffer, pitch_scale, buffer_size);
+ // Mix if we're not paused or we're fading out
+ if (!stream_paused || stream_paused_fade > 0.f) {
+ stream_playback->mix(buffer, pitch_scale, buffer_size);
+ }
//write all outputs
for (int i = 0; i < output_count; i++) {
@@ -86,6 +85,13 @@ void AudioStreamPlayer2D::_mix_audio() {
AudioFrame vol_inc = (current.vol - prev_outputs[i].vol) / float(buffer_size);
AudioFrame vol = current.vol;
+ if (stream_paused) {
+ vol = vol * stream_paused_fade;
+ if (stream_paused_fade > 0.f) {
+ stream_paused_fade -= 0.1f;
+ }
+ }
+
int cc = AudioServer::get_singleton()->get_channel_count();
if (cc == 1) {
@@ -142,6 +148,17 @@ void AudioStreamPlayer2D::_notification(int p_what) {
AudioServer::get_singleton()->remove_callback(_mix_audios, this);
}
+ if (p_what == NOTIFICATION_PAUSED) {
+ if (!can_process()) {
+ // Node can't process so we start fading out to silence
+ set_stream_paused(true);
+ }
+ }
+
+ if (p_what == NOTIFICATION_UNPAUSED) {
+ set_stream_paused(false);
+ }
+
if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
//update anything related to position first, if possible of course
@@ -418,6 +435,19 @@ uint32_t AudioStreamPlayer2D::get_area_mask() const {
return area_mask;
}
+void AudioStreamPlayer2D::set_stream_paused(bool p_pause) {
+
+ if (p_pause != stream_paused) {
+ stream_paused = p_pause;
+ stream_paused_fade = stream_paused ? 1.f : 0.f;
+ }
+}
+
+bool AudioStreamPlayer2D::get_stream_paused() const {
+
+ return stream_paused;
+}
+
void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer2D::set_stream);
@@ -454,6 +484,9 @@ void AudioStreamPlayer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_area_mask", "mask"), &AudioStreamPlayer2D::set_area_mask);
ClassDB::bind_method(D_METHOD("get_area_mask"), &AudioStreamPlayer2D::get_area_mask);
+ ClassDB::bind_method(D_METHOD("set_stream_paused", "pause"), &AudioStreamPlayer2D::set_stream_paused);
+ ClassDB::bind_method(D_METHOD("get_stream_paused"), &AudioStreamPlayer2D::get_stream_paused);
+
ClassDB::bind_method(D_METHOD("_bus_layout_changed"), &AudioStreamPlayer2D::_bus_layout_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
@@ -461,8 +494,9 @@ void AudioStreamPlayer2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "1,65536,1"), "set_max_distance", "get_max_distance");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "attenuation", PROPERTY_HINT_EXP_EASING), "set_attenuation", "get_attenuation");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stream_paused", PROPERTY_HINT_NONE, ""), "set_stream_paused", "get_stream_paused");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_EXP_RANGE, "1,4096,1,or_greater"), "set_max_distance", "get_max_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), "set_attenuation", "get_attenuation");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
ADD_PROPERTY(PropertyInfo(Variant::INT, "area_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_area_mask", "get_area_mask");
@@ -483,6 +517,8 @@ AudioStreamPlayer2D::AudioStreamPlayer2D() {
setplay = -1;
output_ready = false;
area_mask = 1;
+ stream_paused = false;
+ stream_paused_fade = 0.f;
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
}
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index 9ae8e3a518..b508de3171 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -71,7 +71,9 @@ private:
float volume_db;
float pitch_scale;
+ float stream_paused_fade;
bool autoplay;
+ bool stream_paused;
StringName bus;
void _mix_audio();
@@ -123,6 +125,9 @@ public:
void set_area_mask(uint32_t p_mask);
uint32_t get_area_mask() const;
+ void set_stream_paused(bool p_pause);
+ bool get_stream_paused() const;
+
AudioStreamPlayer2D();
~AudioStreamPlayer2D();
};
diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp
index 446b367be0..e06c30ec6b 100644
--- a/scene/2d/back_buffer_copy.cpp
+++ b/scene/2d/back_buffer_copy.cpp
@@ -55,6 +55,15 @@ Rect2 BackBufferCopy::_edit_get_rect() const {
return rect;
}
+bool BackBufferCopy::_edit_use_rect() const {
+ return true;
+}
+
+Rect2 BackBufferCopy::get_anchorable_rect() const {
+
+ return rect;
+}
+
void BackBufferCopy::set_rect(const Rect2 &p_rect) {
rect = p_rect;
diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h
index b786c2b828..b1ee12544b 100644
--- a/scene/2d/back_buffer_copy.h
+++ b/scene/2d/back_buffer_copy.h
@@ -54,9 +54,11 @@ protected:
public:
Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
void set_rect(const Rect2 &p_rect);
Rect2 get_rect() const;
+ Rect2 get_anchorable_rect() const;
void set_copy_mode(CopyMode p_mode);
CopyMode get_copy_mode() const;
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index d172da5bd9..3b86ca76ea 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -91,8 +91,8 @@ Transform2D Camera2D::get_camera_transform() {
if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) {
if (h_drag_enabled && !Engine::get_singleton()->is_editor_hint()) {
- camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * drag_margin[MARGIN_LEFT]));
- camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * drag_margin[MARGIN_RIGHT]));
+ camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * zoom.x * drag_margin[MARGIN_LEFT]));
+ camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * zoom.x * drag_margin[MARGIN_RIGHT]));
} else {
if (h_ofs < 0) {
@@ -104,8 +104,8 @@ Transform2D Camera2D::get_camera_transform() {
if (v_drag_enabled && !Engine::get_singleton()->is_editor_hint()) {
- camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_TOP]));
- camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * drag_margin[MARGIN_BOTTOM]));
+ camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * zoom.y * drag_margin[MARGIN_TOP]));
+ camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * zoom.y * drag_margin[MARGIN_BOTTOM]));
} else {
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 5cca5705a0..47326b9be2 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -94,6 +94,7 @@ void CanvasItemMaterial::_update_shader() {
case BLEND_MODE_SUB: code += "blend_sub"; break;
case BLEND_MODE_MUL: code += "blend_mul"; break;
case BLEND_MODE_PREMULT_ALPHA: code += "blend_premul_alpha"; break;
+ case BLEND_MODE_DISABLED: code += "blend_disabled"; break;
}
switch (light_mode) {
@@ -245,6 +246,14 @@ CanvasItemMaterial::~CanvasItemMaterial() {
///////////////////////////////////////////////////////////////////
+bool CanvasItem::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
+ if (_edit_use_rect()) {
+ return _edit_get_rect().has_point(p_point);
+ } else {
+ return p_point.length() < p_tolerance;
+ }
+}
+
bool CanvasItem::is_visible_in_tree() const {
if (!is_inside_tree())
@@ -312,11 +321,6 @@ void CanvasItem::hide() {
_change_notify("visible");
}
-Size2 CanvasItem::_edit_get_minimum_size() const {
-
- return Size2(-1, -1); //no limit
-}
-
void CanvasItem::_update_callback() {
if (!is_inside_tree()) {
@@ -412,7 +416,7 @@ void CanvasItem::_enter_canvas() {
RID canvas;
if (canvas_layer)
- canvas = canvas_layer->get_world_2d()->get_canvas();
+ canvas = canvas_layer->get_canvas();
else
canvas = get_viewport()->find_world_2d()->get_canvas();
@@ -821,6 +825,12 @@ float CanvasItem::draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const
void CanvasItem::_notify_transform(CanvasItem *p_node) {
+ /* This check exists to avoid re-propagating the transform
+ * notification down the tree on dirty nodes. It provides
+ * optimization by avoiding redundancy (nodes are dirty, will get the
+ * notification anyway).
+ */
+
if (/*p_node->xform_change.in_list() &&*/ p_node->global_invalid) {
return; //nothing to do
}
@@ -854,7 +864,7 @@ RID CanvasItem::get_canvas() const {
ERR_FAIL_COND_V(!is_inside_tree(), RID());
if (canvas_layer)
- return canvas_layer->get_world_2d()->get_canvas();
+ return canvas_layer->get_canvas();
else
return get_viewport()->find_world_2d()->get_canvas();
}
@@ -875,9 +885,7 @@ Ref<World2D> CanvasItem::get_world_2d() const {
CanvasItem *tl = get_toplevel();
- if (tl->canvas_layer) {
- return tl->canvas_layer->get_world_2d();
- } else if (tl->get_viewport()) {
+ if (tl->get_viewport()) {
return tl->get_viewport()->find_world_2d();
} else {
return Ref<World2D>();
@@ -976,11 +984,11 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("_edit_set_position", "position"), &CanvasItem::_edit_set_position);
ClassDB::bind_method(D_METHOD("_edit_get_position"), &CanvasItem::_edit_get_position);
- ClassDB::bind_method(D_METHOD("_edit_use_position"), &CanvasItem::_edit_use_position);
+ ClassDB::bind_method(D_METHOD("_edit_set_scale", "scale"), &CanvasItem::_edit_set_scale);
+ ClassDB::bind_method(D_METHOD("_edit_get_scale"), &CanvasItem::_edit_get_scale);
ClassDB::bind_method(D_METHOD("_edit_set_rect", "rect"), &CanvasItem::_edit_set_rect);
ClassDB::bind_method(D_METHOD("_edit_get_rect"), &CanvasItem::_edit_get_rect);
ClassDB::bind_method(D_METHOD("_edit_use_rect"), &CanvasItem::_edit_use_rect);
- ClassDB::bind_method(D_METHOD("_edit_get_item_and_children_rect"), &CanvasItem::_edit_get_item_and_children_rect);
ClassDB::bind_method(D_METHOD("_edit_set_rotation", "degrees"), &CanvasItem::_edit_set_rotation);
ClassDB::bind_method(D_METHOD("_edit_get_rotation"), &CanvasItem::_edit_get_rotation);
ClassDB::bind_method(D_METHOD("_edit_use_rotation"), &CanvasItem::_edit_use_rotation);
@@ -1091,6 +1099,7 @@ void CanvasItem::_bind_methods() {
BIND_ENUM_CONSTANT(BLEND_MODE_SUB);
BIND_ENUM_CONSTANT(BLEND_MODE_MUL);
BIND_ENUM_CONSTANT(BLEND_MODE_PREMULT_ALPHA);
+ BIND_ENUM_CONSTANT(BLEND_MODE_DISABLED);
BIND_CONSTANT(NOTIFICATION_TRANSFORM_CHANGED);
BIND_CONSTANT(NOTIFICATION_DRAW);
@@ -1160,21 +1169,6 @@ int CanvasItem::get_canvas_layer() const {
return 0;
}
-Rect2 CanvasItem::_edit_get_item_and_children_rect() const {
-
- Rect2 rect = _edit_get_rect();
-
- for (int i = 0; i < get_child_count(); i++) {
- CanvasItem *c = Object::cast_to<CanvasItem>(get_child(i));
- if (c) {
- Rect2 sir = c->get_transform().xform(c->_edit_get_item_and_children_rect());
- rect = rect.merge(sir);
- }
- }
-
- return rect;
-}
-
CanvasItem::CanvasItem() :
xform_change(this) {
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 980fcb4109..1e6a251c9c 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -54,7 +54,8 @@ public:
BLEND_MODE_ADD,
BLEND_MODE_SUB,
BLEND_MODE_MUL,
- BLEND_MODE_PREMULT_ALPHA
+ BLEND_MODE_PREMULT_ALPHA,
+ BLEND_MODE_DISABLED
};
enum LightMode {
@@ -145,7 +146,8 @@ public:
BLEND_MODE_ADD,
BLEND_MODE_SUB,
BLEND_MODE_MUL,
- BLEND_MODE_PREMULT_ALPHA
+ BLEND_MODE_PREMULT_ALPHA,
+ BLEND_MODE_DISABLED
};
private:
@@ -220,32 +222,36 @@ public:
/* EDITOR */
+ // Select the node
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
+
+ // Save and restore a CanvasItem state
virtual void _edit_set_state(const Dictionary &p_state){};
virtual Dictionary _edit_get_state() const { return Dictionary(); };
- // Used to move/select the node
- virtual void _edit_set_position(const Point2 &p_position){};
- virtual Point2 _edit_get_position() const { return Point2(); };
- virtual bool _edit_use_position() const { return false; };
+ // Used to move the node
+ virtual void _edit_set_position(const Point2 &p_position) = 0;
+ virtual Point2 _edit_get_position() const = 0;
- // Used to resize/move/select the node
- virtual void _edit_set_rect(const Rect2 &p_rect){};
- virtual Rect2 _edit_get_rect() const { return Rect2(-32, -32, 64, 64); };
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return _edit_get_rect().has_point(p_point); }
- Rect2 _edit_get_item_and_children_rect() const;
- virtual bool _edit_use_rect() const { return false; };
+ // Used to scale the node
+ virtual void _edit_set_scale(const Size2 &p_scale) = 0;
+ virtual Size2 _edit_get_scale() const = 0;
// Used to rotate the node
+ virtual bool _edit_use_rotation() const { return false; };
virtual void _edit_set_rotation(float p_rotation){};
virtual float _edit_get_rotation() const { return 0.0; };
- virtual bool _edit_use_rotation() const { return false; };
+
+ // Used to resize/move the node
+ virtual bool _edit_use_rect() const { return false; }; // MAYBE REPLACE BY A _edit_get_editmode()
+ virtual void _edit_set_rect(const Rect2 &p_rect){};
+ virtual Rect2 _edit_get_rect() const { return Rect2(0, 0, 0, 0); };
+ virtual Size2 _edit_get_minimum_size() const { return Size2(-1, -1); }; // LOOKS WEIRD
// Used to set a pivot
+ virtual bool _edit_use_pivot() const { return false; };
virtual void _edit_set_pivot(const Point2 &p_pivot){};
virtual Point2 _edit_get_pivot() const { return Point2(); };
- virtual bool _edit_use_pivot() const { return false; };
-
- virtual Size2 _edit_get_minimum_size() const;
/* VISIBILITY */
@@ -308,7 +314,9 @@ public:
virtual Transform2D get_global_transform_with_canvas() const;
CanvasItem *get_toplevel() const;
- _FORCE_INLINE_ RID get_canvas_item() const { return canvas_item; }
+ _FORCE_INLINE_ RID get_canvas_item() const {
+ return canvas_item;
+ }
void set_block_transform_notify(bool p_enable);
bool is_block_transform_notify_enabled() const;
@@ -338,6 +346,9 @@ public:
void set_notify_transform(bool p_enable);
bool is_transform_notification_enabled() const;
+ // Used by control nodes to retreive the parent's anchorable area
+ virtual Rect2 get_anchorable_rect() const { return Rect2(0, 0, 0, 0); };
+
int get_canvas_layer() const;
CanvasItem();
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 978fb379ac..9d2a83fda7 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -175,7 +175,8 @@ void CollisionPolygon2D::_notification(int p_what) {
Vector2 p = polygon[i];
Vector2 n = polygon[(i + 1) % polygon.size()];
- draw_line(p, n, Color(0.9, 0.2, 0.0, 0.8), 3);
+ // 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);
}
#define DEBUG_DECOMPOSE
#if defined(TOOLS_ENABLED) && defined(DEBUG_DECOMPOSE)
@@ -263,6 +264,10 @@ Rect2 CollisionPolygon2D::_edit_get_rect() const {
return aabb;
}
+bool CollisionPolygon2D::_edit_use_rect() const {
+ return true;
+}
+
bool CollisionPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
return Geometry::is_point_in_polygon(p_point, Variant(polygon));
diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h
index 4dafe7d1da..412a923292 100644
--- a/scene/2d/collision_polygon_2d.h
+++ b/scene/2d/collision_polygon_2d.h
@@ -73,6 +73,7 @@ public:
Vector<Point2> get_polygon() const;
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
virtual String get_configuration_warning() const;
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index 0eeb6dafe5..83ef4df8f4 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -173,11 +173,6 @@ Ref<Shape2D> CollisionShape2D::get_shape() const {
return shape;
}
-Rect2 CollisionShape2D::_edit_get_rect() const {
-
- return rect;
-}
-
bool CollisionShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
if (!shape.is_valid())
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index cdff595828..ed2c09d53d 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -54,7 +54,6 @@ protected:
static void _bind_methods();
public:
- virtual Rect2 _edit_get_rect() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
void set_shape(const Ref<Shape2D> &p_shape);
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 329382c034..7d5360c0e4 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -158,8 +158,8 @@ void Joint2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_exclude_nodes_from_collision", "enable"), &Joint2D::set_exclude_nodes_from_collision);
ClassDB::bind_method(D_METHOD("get_exclude_nodes_from_collision"), &Joint2D::get_exclude_nodes_from_collision);
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_a"), "set_node_a", "get_node_a");
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_b"), "set_node_b", "get_node_b");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_a", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "CollisionObject2D"), "set_node_a", "get_node_a");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "node_b", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "CollisionObject2D"), "set_node_b", "get_node_b");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bias", PROPERTY_HINT_RANGE, "0,0.9,0.001"), "set_bias", "get_bias");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_collision"), "set_exclude_nodes_from_collision", "get_exclude_nodes_from_collision");
}
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 1220ff299c..f93c7d1f79 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -59,7 +59,19 @@ bool Light2D::_edit_use_pivot() const {
Rect2 Light2D::_edit_get_rect() const {
if (texture.is_null())
- return Node2D::_edit_get_rect();
+ return Rect2();
+
+ Size2 s = texture->get_size() * _scale;
+ return Rect2(texture_offset - s / 2.0, s);
+}
+
+bool Light2D::_edit_use_rect() const {
+ return !texture.is_null();
+}
+
+Rect2 Light2D::get_anchorable_rect() const {
+ if (texture.is_null())
+ return Rect2();
Size2 s = texture->get_size() * _scale;
return Rect2(texture_offset - s / 2.0, s);
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index 16d8c485d4..40469cfbc8 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -92,6 +92,9 @@ public:
virtual Point2 _edit_get_pivot() const;
virtual bool _edit_use_pivot() const;
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
+
+ virtual Rect2 get_anchorable_rect() const;
void set_enabled(bool p_enabled);
bool is_enabled() const;
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index d4481583fb..c9e5d0f1bc 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -107,12 +107,12 @@ OccluderPolygon2D::~OccluderPolygon2D() {
VS::get_singleton()->free(occ_polygon);
}
-#ifdef DEBUG_ENABLED
void LightOccluder2D::_poly_changed() {
+#ifdef DEBUG_ENABLED
update();
-}
#endif
+}
void LightOccluder2D::_notification(int p_what) {
@@ -221,9 +221,7 @@ void LightOccluder2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &LightOccluder2D::set_occluder_light_mask);
ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &LightOccluder2D::get_occluder_light_mask);
-#ifdef DEBUG_ENABLED
ClassDB::bind_method("_poly_changed", &LightOccluder2D::_poly_changed);
-#endif
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D"), "set_occluder_polygon", "get_occluder_polygon");
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_occluder_light_mask", "get_occluder_light_mask");
diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h
index 5e16351a6f..d59c9100b0 100644
--- a/scene/2d/light_occluder_2d.h
+++ b/scene/2d/light_occluder_2d.h
@@ -78,9 +78,7 @@ class LightOccluder2D : public Node2D {
int mask;
Ref<OccluderPolygon2D> occluder_polygon;
-#ifdef DEBUG_ENABLED
void _poly_changed();
-#endif
protected:
void _notification(int p_what);
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index f0ab9652b4..3e61dd05f4 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -62,6 +62,10 @@ Rect2 Line2D::_edit_get_rect() const {
return aabb;
}
+bool Line2D::_edit_use_rect() const {
+ return true;
+}
+
bool Line2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
const real_t d = _width / 2 + p_tolerance;
@@ -252,18 +256,22 @@ void Line2D::_draw() {
lb.sharp_limit = _sharp_limit;
lb.width = _width;
- lb.build();
-
RID texture_rid;
- if (_texture.is_valid())
+ if (_texture.is_valid()) {
texture_rid = (**_texture).get_rid();
+ lb.tile_aspect = _texture->get_size().aspect();
+ }
+
+ lb.build();
+
VS::get_singleton()->canvas_item_add_triangle_array(
get_canvas_item(),
lb.indices,
lb.vertices,
lb.colors,
- lb.uvs,
+ lb.uvs, Vector<int>(), Vector<float>(),
+
texture_rid);
// DEBUG
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index 0eba024555..24c48982cd 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -59,6 +59,7 @@ public:
Line2D();
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
void set_points(const PoolVector<Vector2> &p_points);
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index b1a072729f..845788bada 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -101,6 +101,7 @@ LineBuilder::LineBuilder() {
round_precision = 8;
begin_cap_mode = Line2D::LINE_CAP_NONE;
end_cap_mode = Line2D::LINE_CAP_NONE;
+ tile_aspect = 1.f;
_interpolate_color = false;
_last_index[0] = 0;
@@ -111,6 +112,7 @@ void LineBuilder::clear_output() {
vertices.clear();
colors.clear();
indices.clear();
+ uvs.clear();
}
void LineBuilder::build() {
@@ -121,6 +123,8 @@ void LineBuilder::build() {
return;
}
+ ERR_FAIL_COND(tile_aspect <= 0.f);
+
const float hw = width / 2.f;
const float hw_sq = hw * hw;
const float sharp_limit_sq = sharp_limit * sharp_limit;
@@ -164,7 +168,7 @@ void LineBuilder::build() {
current_distance1 = current_distance0;
} else if (begin_cap_mode == Line2D::LINE_CAP_ROUND) {
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
- uvx0 = 0.5f;
+ uvx0 = 0.5f / tile_aspect;
}
new_arc(pos0, pos_up0 - pos0, -Math_PI, color0, Rect2(0.f, 0.f, 1.f, 1.f));
total_distance += width;
@@ -286,8 +290,8 @@ void LineBuilder::build() {
color1 = gradient->get_color_at_offset(current_distance1 / total_distance);
}
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
- uvx0 = current_distance0 / width;
- uvx1 = current_distance1 / width;
+ uvx0 = current_distance0 / (width * tile_aspect);
+ uvx1 = current_distance1 / (width * tile_aspect);
}
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
@@ -373,7 +377,7 @@ void LineBuilder::build() {
color1 = gradient->get_color(gradient->get_points_count() - 1);
}
if (texture_mode == Line2D::LINE_TEXTURE_TILE) {
- uvx1 = current_distance1 / width;
+ uvx1 = current_distance1 / (width * tile_aspect);
}
strip_add_quad(pos_up1, pos_down1, color1, uvx1);
diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h
index daa2ed7c24..b1c62f84e2 100644
--- a/scene/2d/line_builder.h
+++ b/scene/2d/line_builder.h
@@ -50,6 +50,7 @@ public:
Line2D::LineTextureMode texture_mode;
float sharp_limit;
int round_precision;
+ float tile_aspect; // w/h
// TODO offset_joints option (offers alternative implementation of round joints)
// TODO Move in a struct and reference it
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp
index adbb227d0c..9f21fe1a1f 100644
--- a/scene/2d/mesh_instance_2d.cpp
+++ b/scene/2d/mesh_instance_2d.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* mesh_instance_2d.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "mesh_instance_2d.h"
void MeshInstance2D::_notification(int p_what) {
diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h
index d1d1ade0ae..c9889c1c03 100644
--- a/scene/2d/mesh_instance_2d.h
+++ b/scene/2d/mesh_instance_2d.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* mesh_instance_2d.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef MESH_INSTANCE_2D_H
#define MESH_INSTANCE_2D_H
diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp
index 4737e14111..16e0386952 100644
--- a/scene/2d/navigation2d.cpp
+++ b/scene/2d/navigation2d.cpp
@@ -671,7 +671,7 @@ Object *Navigation2D::get_closest_point_owner(const Vector2 &p_point) {
if (Geometry::is_point_in_triangle(p_point, _get_vertex(p.edges[0].point), _get_vertex(p.edges[i - 1].point), _get_vertex(p.edges[i].point))) {
- E->get().owner;
+ return E->get().owner;
}
}
}
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 95e24505be..3813bd96fe 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -58,16 +58,39 @@ void Node2D::_edit_set_state(const Dictionary &p_state) {
}
void Node2D::_edit_set_position(const Point2 &p_position) {
- pos = p_position;
- _update_transform();
- _change_notify("position");
+ set_position(p_position);
}
Point2 Node2D::_edit_get_position() const {
return pos;
}
+void Node2D::_edit_set_scale(const Size2 &p_scale) {
+ set_scale(p_scale);
+}
+
+Size2 Node2D::_edit_get_scale() const {
+ return _scale;
+}
+
+void Node2D::_edit_set_rotation(float p_rotation) {
+ angle = p_rotation;
+ _update_transform();
+ _change_notify("rotation");
+ _change_notify("rotation_degrees");
+}
+
+float Node2D::_edit_get_rotation() const {
+ return angle;
+}
+
+bool Node2D::_edit_use_rotation() const {
+ return true;
+}
+
void Node2D::_edit_set_rect(const Rect2 &p_edit_rect) {
+ ERR_FAIL_COND(!_edit_use_rect());
+
Rect2 r = _edit_get_rect();
Vector2 zero_offset;
@@ -83,7 +106,7 @@ void Node2D::_edit_set_rect(const Rect2 &p_edit_rect) {
if (r.size.y != 0)
new_scale.y = p_edit_rect.size.y / r.size.y;
- Point2 new_pos = p_edit_rect.position + p_edit_rect.size * zero_offset; //p_edit_rect.pos - r.pos;
+ Point2 new_pos = p_edit_rect.position + p_edit_rect.size * zero_offset;
Transform2D postxf;
postxf.set_rotation_and_scale(angle, _scale);
@@ -97,25 +120,6 @@ void Node2D::_edit_set_rect(const Rect2 &p_edit_rect) {
_change_notify("position");
}
-bool Node2D::_edit_use_rect() const {
- return true;
-}
-
-void Node2D::_edit_set_rotation(float p_rotation) {
- angle = p_rotation;
- _update_transform();
- _change_notify("rotation");
- _change_notify("rotation_degrees");
-}
-
-float Node2D::_edit_get_rotation() const {
- return angle;
-}
-
-bool Node2D::_edit_use_rotation() const {
- return true;
-}
-
void Node2D::_update_xform_values() {
pos = _mat.elements[2];
@@ -444,10 +448,10 @@ void Node2D::_bind_methods() {
ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2, "scale"), "set_scale", "get_scale");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform", PROPERTY_HINT_NONE, "", 0), "set_transform", "get_transform");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "global_position", PROPERTY_HINT_NONE, "", 0), "set_global_position", "get_global_position");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position", PROPERTY_HINT_NONE, "", 0), "set_global_position", "get_global_position");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "global_rotation", PROPERTY_HINT_NONE, "", 0), "set_global_rotation", "get_global_rotation");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "global_rotation_degrees", PROPERTY_HINT_NONE, "", 0), "set_global_rotation_degrees", "get_global_rotation_degrees");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "global_scale", PROPERTY_HINT_NONE, "", 0), "set_global_scale", "get_global_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_scale", PROPERTY_HINT_NONE, "", 0), "set_global_scale", "get_global_scale");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_transform", PROPERTY_HINT_NONE, "", 0), "set_global_transform", "get_global_transform");
ADD_GROUP("Z Index", "");
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index f817b214f8..725686cdf8 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -62,12 +62,16 @@ public:
virtual void _edit_set_position(const Point2 &p_position);
virtual Point2 _edit_get_position() const;
- virtual void _edit_set_rect(const Rect2 &p_edit_rect);
- virtual bool _edit_use_rect() const;
+
+ virtual void _edit_set_scale(const Size2 &p_scale);
+ virtual Size2 _edit_get_scale() const;
+
virtual void _edit_set_rotation(float p_rotation);
virtual float _edit_get_rotation() const;
virtual bool _edit_use_rotation() const;
+ virtual void _edit_set_rect(const Rect2 &p_edit_rect);
+
void set_position(const Point2 &p_pos);
void set_rotation(float p_radians);
void set_rotation_degrees(float p_degrees);
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index 050f98b02b..2ac6c76032 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -72,7 +72,7 @@ void ParallaxLayer::_update_mirroring() {
ParallaxBackground *pb = Object::cast_to<ParallaxBackground>(get_parent());
if (pb) {
- RID c = pb->get_world_2d()->get_canvas();
+ RID c = pb->get_canvas();
RID ci = get_canvas_item();
Point2 mirrorScale = mirroring * get_scale();
VisualServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirrorScale);
@@ -120,7 +120,6 @@ void ParallaxLayer::set_base_offset_and_scale(const Point2 &p_offset, float p_sc
if (mirroring.x) {
double den = mirroring.x * p_scale;
- double before = new_ofs.x;
new_ofs.x -= den * ceil(new_ofs.x / den);
}
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 7eaa5bb88c..1da1d44b17 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -367,9 +367,9 @@ void Particles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("restart"), &Particles2D::restart);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,100000,1"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
ADD_GROUP("Time", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01,or_greater"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale");
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 052a0ac026..658b998d17 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -57,6 +57,10 @@ Rect2 Path2D::_edit_get_rect() const {
return aabb;
}
+bool Path2D::_edit_use_rect() const {
+ return true;
+}
+
bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
for (int i = 0; i < curve->get_point_count(); i++) {
@@ -92,7 +96,7 @@ void Path2D::_notification(int p_what) {
#else
const float line_width = 2;
#endif
- const Color color = Color(0.5, 0.6, 1.0, 0.7);
+ const Color color = Color(1.0, 1.0, 1.0, 1.0);
for (int i = 0; i < curve->get_point_count(); i++) {
@@ -147,6 +151,7 @@ void Path2D::_bind_methods() {
Path2D::Path2D() {
set_curve(Ref<Curve2D>(memnew(Curve2D))); //create one by default
+ set_self_modulate(Color(0.5, 0.6, 1.0, 0.7));
}
/////////////////////////////////////////////////////////////////////////////////
@@ -294,7 +299,7 @@ void PathFollow2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lookahead", "lookahead"), &PathFollow2D::set_lookahead);
ClassDB::bind_method(D_METHOD("get_lookahead"), &PathFollow2D::get_lookahead);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01"), "set_offset", "get_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_EXP_RANGE, "0,10000,0.01,or_greater"), "set_offset", "get_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset");
diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h
index 735d289d74..64696442c3 100644
--- a/scene/2d/path_2d.h
+++ b/scene/2d/path_2d.h
@@ -48,6 +48,7 @@ protected:
public:
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
void set_curve(const Ref<Curve2D> &p_curve);
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index e63dc4e515..81ed3c63c3 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -30,7 +30,7 @@
#include "polygon_2d.h"
#include "core/math/geometry.h"
-
+#include "skeleton_2d.h"
Dictionary Polygon2D::_edit_get_state() const {
Dictionary state = Node2D::_edit_get_state();
state["offset"] = offset;
@@ -73,6 +73,10 @@ Rect2 Polygon2D::_edit_get_rect() const {
return item_rect;
}
+bool Polygon2D::_edit_use_rect() const {
+ return true;
+}
+
bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
return Geometry::is_point_in_polygon(p_point - get_offset(), Variant(polygon));
@@ -87,8 +91,20 @@ void Polygon2D::_notification(int p_what) {
if (polygon.size() < 3)
return;
+ Skeleton2D *skeleton_node = NULL;
+ if (has_node(skeleton)) {
+ skeleton_node = Object::cast_to<Skeleton2D>(get_node(skeleton));
+ }
+
+ if (skeleton_node)
+ VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), skeleton_node->get_skeleton());
+ else
+ VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID());
+
Vector<Vector2> points;
Vector<Vector2> uvs;
+ Vector<int> bones;
+ Vector<float> weights;
points.resize(polygon.size());
@@ -176,6 +192,70 @@ void Polygon2D::_notification(int p_what) {
}
}
+ if (!invert && bone_weights.size()) {
+ //a skeleton is set! fill indices and weights
+ int vc = points.size();
+ bones.resize(vc * 4);
+ weights.resize(vc * 4);
+
+ int *bonesw = bones.ptrw();
+ float *weightsw = weights.ptrw();
+
+ for (int i = 0; i < vc * 4; i++) {
+ bonesw[i] = 0;
+ weightsw[i] = 0;
+ }
+
+ for (int i = 0; i < bone_weights.size(); i++) {
+ if (bone_weights[i].weights.size() != points.size()) {
+ continue; //different number of vertices, sorry not using.
+ }
+ if (!skeleton_node->has_node(bone_weights[i].path)) {
+ continue; //node does not exist
+ }
+ Bone2D *bone = Object::cast_to<Bone2D>(skeleton_node->get_node(bone_weights[i].path));
+ if (!bone) {
+ continue;
+ }
+
+ int bone_index = bone->get_index_in_skeleton();
+ PoolVector<float>::Read r = bone_weights[i].weights.read();
+ for (int j = 0; j < vc; j++) {
+ if (r[j] == 0.0)
+ continue; //weight is unpainted, skip
+ //find an index with a weight
+ for (int k = 0; k < 4; k++) {
+ if (weightsw[j * 4 + k] < r[j]) {
+ //this is less than this weight, insert weight!
+ for (int l = 3; l > k; l--) {
+ weightsw[j * 4 + l] = weightsw[j * 4 + l - 1];
+ bonesw[j * 4 + l] = bonesw[j * 4 + l - 1];
+ }
+ weightsw[j * 4 + k] = r[j];
+ bonesw[j * 4 + k] = bone_index;
+ break;
+ }
+ }
+ }
+ }
+
+ //normalize the weights
+ for (int i = 0; i < vc; i++) {
+ float tw = 0;
+ for (int j = 0; j < 4; j++) {
+ tw += weightsw[i * 4 + j];
+ }
+ if (tw == 0)
+ continue; //unpainted, do nothing
+
+ //normalize
+ for (int j = 0; j < 4; j++) {
+ weightsw[i * 4 + j] /= tw;
+ // print_line("point " + itos(i) + " idx " + itos(j) + " index: " + itos(bonesw[i * 4 + j]) + " weight: " + rtos(weightsw[i * 4 + j]));
+ }
+ }
+ }
+
Vector<Color> colors;
int color_len = vertex_colors.size();
colors.resize(len);
@@ -192,7 +272,81 @@ void Polygon2D::_notification(int p_what) {
// Vector<int> indices = Geometry::triangulate_polygon(points);
// VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID());
- VS::get_singleton()->canvas_item_add_polygon(get_canvas_item(), points, colors, uvs, texture.is_valid() ? texture->get_rid() : RID(), RID(), antialiased);
+ if (invert || splits.size() == 0) {
+ Vector<int> indices = Geometry::triangulate_polygon(points);
+ VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());
+ } else {
+ //use splits
+ Vector<int> loop;
+ int sc = splits.size();
+ PoolVector<int>::Read r = splits.read();
+ int last = points.size();
+
+ Vector<Vector<int> > loops;
+
+ for (int i = 0; i < last; i++) {
+
+ int split;
+ int min_end = -1;
+
+ do {
+
+ loop.push_back(i);
+
+ split = -1;
+ int end = -1;
+
+ for (int j = 0; j < sc; j += 2) {
+ if (r[j + 1] >= last)
+ continue; //no longer valid
+ if (min_end != -1 && r[j + 1] >= min_end)
+ continue;
+ if (r[j] == i) {
+ if (split == -1 || r[j + 1] > end) {
+ split = r[j];
+ end = r[j + 1];
+ }
+ }
+ }
+
+ if (split != -1) {
+ for (int j = end; j < last; j++) {
+ loop.push_back(j);
+ }
+ loops.push_back(loop);
+ last = end + 1;
+ loop.clear();
+ min_end = end; //avoid this split from repeating
+ }
+
+ } while (split != -1);
+ }
+
+ if (loop.size()) {
+ loops.push_back(loop);
+ }
+
+ Vector<int> indices;
+
+ for (int i = 0; i < loops.size(); i++) {
+ Vector<int> loop = loops[i];
+ Vector<Vector2> vertices;
+ vertices.resize(loop.size());
+ for (int j = 0; j < vertices.size(); j++) {
+ vertices[j] = points[loop[j]];
+ }
+ Vector<int> sub_indices = Geometry::triangulate_polygon(vertices);
+ int from = indices.size();
+ indices.resize(from + sub_indices.size());
+ for (int j = 0; j < sub_indices.size(); j++) {
+ indices[from + j] = loop[sub_indices[j]];
+ }
+ }
+
+ //print_line("loops: " + itos(loops.size()) + " indices: " + itos(indices.size()));
+
+ VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());
+ }
} break;
}
@@ -220,6 +374,18 @@ PoolVector<Vector2> Polygon2D::get_uv() const {
return uv;
}
+void Polygon2D::set_splits(const PoolVector<int> &p_splits) {
+
+ ERR_FAIL_COND(p_splits.size() & 1); //splits should be multiple of 2
+ splits = p_splits;
+ update();
+}
+
+PoolVector<int> Polygon2D::get_splits() const {
+
+ return splits;
+}
+
void Polygon2D::set_color(const Color &p_color) {
color = p_color;
@@ -341,6 +507,74 @@ Vector2 Polygon2D::get_offset() const {
return offset;
}
+void Polygon2D::add_bone(const NodePath &p_path, const PoolVector<float> &p_weights) {
+
+ Bone bone;
+ bone.path = p_path;
+ bone.weights = p_weights;
+ bone_weights.push_back(bone);
+}
+int Polygon2D::get_bone_count() const {
+ return bone_weights.size();
+}
+NodePath Polygon2D::get_bone_path(int p_index) const {
+ ERR_FAIL_INDEX_V(p_index, bone_weights.size(), NodePath());
+ return bone_weights[p_index].path;
+}
+PoolVector<float> Polygon2D::get_bone_weights(int p_index) const {
+
+ ERR_FAIL_INDEX_V(p_index, bone_weights.size(), PoolVector<float>());
+ return bone_weights[p_index].weights;
+}
+void Polygon2D::erase_bone(int p_idx) {
+
+ ERR_FAIL_INDEX(p_idx, bone_weights.size());
+ bone_weights.remove(p_idx);
+}
+
+void Polygon2D::clear_bones() {
+ bone_weights.clear();
+}
+
+void Polygon2D::set_bone_weights(int p_index, const PoolVector<float> &p_weights) {
+ ERR_FAIL_INDEX(p_index, bone_weights.size());
+ bone_weights[p_index].weights = p_weights;
+ update();
+}
+void Polygon2D::set_bone_path(int p_index, const NodePath &p_path) {
+ ERR_FAIL_INDEX(p_index, bone_weights.size());
+ bone_weights[p_index].path = p_path;
+ update();
+}
+
+Array Polygon2D::_get_bones() const {
+ Array bones;
+ for (int i = 0; i < get_bone_count(); i++) {
+ bones.push_back(get_bone_path(i));
+ bones.push_back(get_bone_weights(i));
+ }
+ return bones;
+}
+void Polygon2D::_set_bones(const Array &p_bones) {
+
+ ERR_FAIL_COND(p_bones.size() & 1);
+ clear_bones();
+ for (int i = 0; i < p_bones.size(); i += 2) {
+ add_bone(p_bones[i], p_bones[i + 1]);
+ }
+}
+
+void Polygon2D::set_skeleton(const NodePath &p_skeleton) {
+ if (skeleton == p_skeleton)
+ return;
+ skeleton = p_skeleton;
+ update();
+}
+
+NodePath Polygon2D::get_skeleton() const {
+ return skeleton;
+}
+
void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_polygon", "polygon"), &Polygon2D::set_polygon);
@@ -352,6 +586,9 @@ void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &Polygon2D::set_color);
ClassDB::bind_method(D_METHOD("get_color"), &Polygon2D::get_color);
+ ClassDB::bind_method(D_METHOD("set_splits", "splits"), &Polygon2D::set_splits);
+ ClassDB::bind_method(D_METHOD("get_splits"), &Polygon2D::get_splits);
+
ClassDB::bind_method(D_METHOD("set_vertex_colors", "vertex_colors"), &Polygon2D::set_vertex_colors);
ClassDB::bind_method(D_METHOD("get_vertex_colors"), &Polygon2D::get_vertex_colors);
@@ -382,8 +619,24 @@ void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_offset", "offset"), &Polygon2D::set_offset);
ClassDB::bind_method(D_METHOD("get_offset"), &Polygon2D::get_offset);
+ ClassDB::bind_method(D_METHOD("add_bone", "path", "weights"), &Polygon2D::add_bone);
+ ClassDB::bind_method(D_METHOD("get_bone_count"), &Polygon2D::get_bone_count);
+ ClassDB::bind_method(D_METHOD("get_bone_path", "index"), &Polygon2D::get_bone_path);
+ ClassDB::bind_method(D_METHOD("get_bone_weights", "index"), &Polygon2D::get_bone_weights);
+ ClassDB::bind_method(D_METHOD("erase_bone", "index"), &Polygon2D::erase_bone);
+ ClassDB::bind_method(D_METHOD("clear_bones"), &Polygon2D::clear_bones);
+ ClassDB::bind_method(D_METHOD("set_bone_path", "index", "path"), &Polygon2D::set_bone_path);
+ ClassDB::bind_method(D_METHOD("set_bone_weights", "index", "weights"), &Polygon2D::set_bone_weights);
+
+ ClassDB::bind_method(D_METHOD("set_skeleton", "skeleton"), &Polygon2D::set_skeleton);
+ ClassDB::bind_method(D_METHOD("get_skeleton"), &Polygon2D::get_skeleton);
+
+ ClassDB::bind_method(D_METHOD("_set_bones", "bones"), &Polygon2D::_set_bones);
+ ClassDB::bind_method(D_METHOD("_get_bones"), &Polygon2D::_get_bones);
+
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "uv"), "set_uv", "get_uv");
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "splits"), "set_splits", "get_splits");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
@@ -395,10 +648,14 @@ void Polygon2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "texture_scale"), "set_texture_scale", "get_texture_scale");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation_degrees", PROPERTY_HINT_RANGE, "-1440,1440,0.1"), "set_texture_rotation_degrees", "get_texture_rotation_degrees");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_rotation", PROPERTY_HINT_NONE, "", 0), "set_texture_rotation", "get_texture_rotation");
+ ADD_GROUP("Skeleton", "");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "skeleton", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Skeleton2D"), "set_skeleton", "get_skeleton");
ADD_GROUP("Invert", "invert_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "invert_enable"), "set_invert", "get_invert");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "invert_border", PROPERTY_HINT_RANGE, "0.1,16384,0.1"), "set_invert_border", "get_invert_border");
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_bones", "_get_bones");
}
Polygon2D::Polygon2D() {
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index 66f44cb3f1..575f71d74a 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -40,6 +40,15 @@ class Polygon2D : public Node2D {
PoolVector<Vector2> polygon;
PoolVector<Vector2> uv;
PoolVector<Color> vertex_colors;
+ PoolVector<int> splits;
+
+ struct Bone {
+ NodePath path;
+ PoolVector<float> weights;
+ };
+
+ Vector<Bone> bone_weights;
+
Color color;
Ref<Texture> texture;
Size2 tex_scale;
@@ -54,6 +63,11 @@ class Polygon2D : public Node2D {
mutable bool rect_cache_dirty;
mutable Rect2 item_rect;
+ NodePath skeleton;
+
+ Array _get_bones() const;
+ void _set_bones(const Array &p_bones);
+
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -66,6 +80,7 @@ public:
virtual Point2 _edit_get_pivot() const;
virtual bool _edit_use_pivot() const;
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
@@ -75,6 +90,9 @@ public:
void set_uv(const PoolVector<Vector2> &p_uv);
PoolVector<Vector2> get_uv() const;
+ void set_splits(const PoolVector<int> &p_uv);
+ PoolVector<int> get_splits() const;
+
void set_color(const Color &p_color);
Color get_color() const;
@@ -108,6 +126,18 @@ public:
void set_offset(const Vector2 &p_offset);
Vector2 get_offset() const;
+ void add_bone(const NodePath &p_path = NodePath(), const PoolVector<float> &p_weights = PoolVector<float>());
+ int get_bone_count() const;
+ NodePath get_bone_path(int p_index) const;
+ PoolVector<float> get_bone_weights(int p_index) const;
+ void erase_bone(int p_idx);
+ void clear_bones();
+ void set_bone_weights(int p_index, const PoolVector<float> &p_weights);
+ void set_bone_path(int p_index, const NodePath &p_path);
+
+ void set_skeleton(const NodePath &p_skeleton);
+ NodePath get_skeleton() const;
+
Polygon2D();
};
diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp
index 37f6aaa2d6..64d23719e7 100644
--- a/scene/2d/position_2d.cpp
+++ b/scene/2d/position_2d.cpp
@@ -44,6 +44,10 @@ Rect2 Position2D::_edit_get_rect() const {
return Rect2(Point2(-10, -10), Size2(20, 20));
}
+bool Position2D::_edit_use_rect() const {
+ return false;
+}
+
void Position2D::_notification(int p_what) {
switch (p_what) {
diff --git a/scene/2d/position_2d.h b/scene/2d/position_2d.h
index 6f6a34c452..bff474cccd 100644
--- a/scene/2d/position_2d.h
+++ b/scene/2d/position_2d.h
@@ -44,6 +44,7 @@ protected:
public:
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
Position2D();
};
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 5a563143ad..255d2d38d5 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -101,7 +101,7 @@ void RayCast2D::set_enabled(bool p_enabled) {
enabled = p_enabled;
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
- set_physics_process(p_enabled);
+ set_physics_process_internal(p_enabled);
if (!p_enabled)
collided = false;
}
@@ -141,9 +141,9 @@ void RayCast2D::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (enabled && !Engine::get_singleton()->is_editor_hint())
- set_physics_process(true);
+ set_physics_process_internal(true);
else
- set_physics_process(false);
+ set_physics_process_internal(false);
if (Object::cast_to<CollisionObject2D>(get_parent())) {
if (exclude_parent_body)
@@ -155,7 +155,7 @@ void RayCast2D::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
if (enabled)
- set_physics_process(false);
+ set_physics_process_internal(false);
} break;
@@ -183,7 +183,7 @@ void RayCast2D::_notification(int p_what) {
} break;
- case NOTIFICATION_PHYSICS_PROCESS: {
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (!enabled)
break;
diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp
index da764e032b..63c3d78dfd 100644
--- a/scene/2d/remote_transform_2d.cpp
+++ b/scene/2d/remote_transform_2d.cpp
@@ -201,7 +201,7 @@ void RemoteTransform2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_update_scale", "update_remote_scale"), &RemoteTransform2D::set_update_scale);
ClassDB::bind_method(D_METHOD("get_update_scale"), &RemoteTransform2D::get_update_scale);
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "remote_path"), "set_remote_node", "get_remote_node");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "remote_path", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Node2D"), "set_remote_node", "get_remote_node");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_global_coordinates"), "set_use_global_coordinates", "get_use_global_coordinates");
ADD_GROUP("Update", "update_");
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index b6cb734cee..45f63fd5bf 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -324,13 +324,19 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
}
Rect2 TouchScreenButton::_edit_get_rect() const {
-
- if (texture.is_null())
- return Rect2(0, 0, 1, 1);
- /*
if (texture.is_null())
return CanvasItem::_edit_get_rect();
- */
+
+ return Rect2(Size2(), texture->get_size());
+}
+
+bool TouchScreenButton::_edit_use_rect() const {
+ return !texture.is_null();
+}
+
+Rect2 TouchScreenButton::get_anchorable_rect() const {
+ if (texture.is_null())
+ return CanvasItem::get_anchorable_rect();
return Rect2(Size2(), texture->get_size());
}
diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h
index e6f2a2f3cd..3e8adc2e5e 100644
--- a/scene/2d/screen_button.h
+++ b/scene/2d/screen_button.h
@@ -103,7 +103,9 @@ public:
bool is_pressed() const;
- Rect2 _edit_get_rect() const;
+ virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
+ virtual Rect2 get_anchorable_rect() const;
TouchScreenButton();
};
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 705e82bcbb..8ceffb3c27 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* skeleton_2d.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "skeleton_2d.h"
void Bone2D::_notification(int p_what) {
@@ -12,6 +42,8 @@ void Bone2D::_notification(int p_what) {
break;
if (!Object::cast_to<Bone2D>(parent))
break; //skeletons must be chained to Bone2Ds.
+
+ parent = parent->get_parent();
}
if (skeleton) {
@@ -26,6 +58,11 @@ void Bone2D::_notification(int p_what) {
skeleton->_make_transform_dirty();
}
}
+ if (p_what == NOTIFICATION_MOVED_IN_PARENT) {
+ if (skeleton) {
+ skeleton->_make_bone_setup_dirty();
+ }
+ }
if (p_what == NOTIFICATION_EXIT_TREE) {
if (skeleton) {
@@ -46,12 +83,22 @@ void Bone2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rest", "rest"), &Bone2D::set_rest);
ClassDB::bind_method(D_METHOD("get_rest"), &Bone2D::get_rest);
ClassDB::bind_method(D_METHOD("apply_rest"), &Bone2D::apply_rest);
+ ClassDB::bind_method(D_METHOD("get_skeleton_rest"), &Bone2D::get_skeleton_rest);
+ ClassDB::bind_method(D_METHOD("get_index_in_skeleton"), &Bone2D::get_index_in_skeleton);
+
+ ClassDB::bind_method(D_METHOD("set_default_length", "default_length"), &Bone2D::set_default_length);
+ ClassDB::bind_method(D_METHOD("get_default_length"), &Bone2D::get_default_length);
+
+ ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "rest"), "set_rest", "get_rest");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "default_length", PROPERTY_HINT_RANGE, "1,1024,1"), "set_default_length", "get_default_length");
}
void Bone2D::set_rest(const Transform2D &p_rest) {
rest = p_rest;
if (skeleton)
skeleton->_make_bone_setup_dirty();
+
+ update_configuration_warning();
}
Transform2D Bone2D::get_rest() const {
@@ -71,22 +118,54 @@ void Bone2D::apply_rest() {
set_transform(rest);
}
+void Bone2D::set_default_length(float p_length) {
+
+ default_length = p_length;
+}
+
+float Bone2D::get_default_length() const {
+ return default_length;
+}
+
+int Bone2D::get_index_in_skeleton() const {
+ ERR_FAIL_COND_V(!skeleton, -1);
+ skeleton->_update_bone_setup();
+ return skeleton_index;
+}
String Bone2D::get_configuration_warning() const {
+
+ String warning = Node2D::get_configuration_warning();
if (!skeleton) {
+ if (warning != String()) {
+ warning += "\n";
+ }
if (parent_bone) {
- return TTR("This Bone2D chain should end at a Skeleton2D node.");
+ warning += TTR("This Bone2D chain should end at a Skeleton2D node.");
} else {
- return TTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node.");
+ warning += TTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node.");
+ }
+ }
+
+ if (rest == Transform2D(0, 0, 0, 0, 0, 0)) {
+ if (warning != String()) {
+ warning += "\n";
}
+ warning += TTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one.");
}
- return Node2D::get_configuration_warning();
+ return warning;
}
Bone2D::Bone2D() {
skeleton = NULL;
parent_bone = NULL;
+ skeleton_index = -1;
+ default_length = 16;
set_notify_local_transform(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);
+ }
}
//////////////////////////////////////
@@ -112,7 +191,14 @@ void Skeleton2D::_update_bone_setup() {
bones.sort(); //sorty so they are always in the same order/index
for (int i = 0; i < bones.size(); i++) {
- bones[i].rest_inverse = bones[i].bone->get_skeleton_rest(); //bind pose
+ bones[i].rest_inverse = bones[i].bone->get_skeleton_rest().affine_inverse(); //bind pose
+ bones[i].bone->skeleton_index = i;
+ Bone2D *parent_bone = Object::cast_to<Bone2D>(bones[i].bone->get_parent());
+ if (parent_bone) {
+ bones[i].parent_index = parent_bone->skeleton_index;
+ } else {
+ bones[i].parent_index = -1;
+ }
}
transform_dirty = true;
@@ -140,13 +226,20 @@ void Skeleton2D::_update_transform() {
transform_dirty = false;
- Transform2D global_xform = get_global_transform();
- Transform2D global_xform_inverse = global_xform.affine_inverse();
+ for (int i = 0; i < bones.size(); i++) {
+
+ ERR_CONTINUE(bones[i].parent_index >= i);
+ if (bones[i].parent_index >= 0) {
+ bones[i].accum_transform = bones[bones[i].parent_index].accum_transform * bones[i].bone->get_transform();
+ } else {
+ bones[i].accum_transform = bones[i].bone->get_transform();
+ }
+ }
for (int i = 0; i < bones.size(); i++) {
- Transform2D final_xform = bones[i].rest_inverse * bones[i].bone->get_relative_transform_to_parent(this);
- VS::get_singleton()->skeleton_bone_set_transform_2d(skeleton, i, global_xform * (final_xform * global_xform_inverse));
+ Transform2D final_xform = bones[i].accum_transform * bones[i].rest_inverse;
+ VS::get_singleton()->skeleton_bone_set_transform_2d(skeleton, i, final_xform);
}
}
@@ -177,10 +270,12 @@ void Skeleton2D::_notification(int p_what) {
_update_bone_setup();
if (transform_dirty)
_update_transform();
+
+ request_ready();
}
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
- _make_transform_dirty();
+ VS::get_singleton()->skeleton_set_base_transform_2d(skeleton, get_global_transform());
}
}
@@ -201,6 +296,7 @@ void Skeleton2D::_bind_methods() {
Skeleton2D::Skeleton2D() {
bone_setup_dirty = true;
transform_dirty = true;
+
skeleton = VS::get_singleton()->skeleton_create();
}
diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h
index 49199f684f..9d0a061457 100644
--- a/scene/2d/skeleton_2d.h
+++ b/scene/2d/skeleton_2d.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* skeleton_2d.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef SKELETON_2D_H
#define SKELETON_2D_H
@@ -8,9 +38,14 @@ class Skeleton2D;
class Bone2D : public Node2D {
GDCLASS(Bone2D, Node2D)
+ friend class Skeleton2D;
+
Bone2D *parent_bone;
Skeleton2D *skeleton;
Transform2D rest;
+ float default_length;
+
+ int skeleton_index;
protected:
void _notification(int p_what);
@@ -24,6 +59,11 @@ public:
String get_configuration_warning() const;
+ void set_default_length(float p_length);
+ float get_default_length() const;
+
+ int get_index_in_skeleton() const;
+
Bone2D();
};
@@ -37,6 +77,8 @@ class Skeleton2D : public Node2D {
return p_bone.bone->is_greater_than(bone);
}
Bone2D *bone;
+ int parent_index;
+ Transform2D accum_transform;
Transform2D rest_inverse;
};
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp
index 796969be1e..ebe0e81f6e 100644
--- a/scene/2d/sprite.cpp
+++ b/scene/2d/sprite.cpp
@@ -58,33 +58,48 @@ bool Sprite::_edit_use_pivot() const {
return true;
}
+Rect2 Sprite::_edit_get_rect() const {
+ return get_rect();
+}
+
+bool Sprite::_edit_use_rect() const {
+ if (texture.is_null())
+ return false;
+
+ return true;
+}
+
+Rect2 Sprite::get_anchorable_rect() const {
+ return get_rect();
+}
+
void Sprite::_get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_clip) const {
- Size2 s;
- r_filter_clip = false;
+ Rect2 base_rect;
if (region) {
-
- s = region_rect.size;
- r_src_rect = region_rect;
r_filter_clip = region_filter_clip;
+ base_rect = region_rect;
} else {
- s = Size2(texture->get_size());
- s = s / Size2(hframes, vframes);
-
- r_src_rect.size = s;
- r_src_rect.position.x += float(frame % hframes) * s.x;
- r_src_rect.position.y += float(frame / hframes) * s.y;
+ r_filter_clip = false;
+ base_rect = Rect2(0, 0, texture->get_width(), texture->get_height());
}
- Point2 ofs = offset;
+ Size2 frame_size = base_rect.size / Size2(hframes, vframes);
+ Point2 frame_offset = Point2(frame % hframes, frame / hframes);
+ frame_offset *= frame_size;
+
+ r_src_rect.size = frame_size;
+ r_src_rect.position = base_rect.position + frame_offset;
+
+ Point2 dest_offset = offset;
if (centered)
- ofs -= s / 2;
+ dest_offset -= frame_size / 2;
if (Engine::get_singleton()->get_use_pixel_snap()) {
- ofs = ofs.floor();
+ dest_offset = dest_offset.floor();
}
- r_dst_rect = Rect2(ofs, s);
+ r_dst_rect = Rect2(dest_offset, frame_size);
if (hflip)
r_dst_rect.size.x = -r_dst_rect.size.x;
@@ -121,7 +136,15 @@ void Sprite::set_texture(const Ref<Texture> &p_texture) {
if (p_texture == texture)
return;
+
+ if (texture.is_valid())
+ texture->remove_change_receptor(this);
+
texture = p_texture;
+
+ if (texture.is_valid())
+ texture->add_change_receptor(this);
+
update();
emit_signal("texture_changed");
item_rect_changed();
@@ -281,15 +304,65 @@ bool Sprite::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc
Rect2 src_rect, dst_rect;
bool filter_clip;
_get_rects(src_rect, dst_rect, filter_clip);
+ dst_rect.size = dst_rect.size.abs();
if (!dst_rect.has_point(p_point))
return false;
- Vector2 q = ((p_point - dst_rect.position) / dst_rect.size) * src_rect.size + src_rect.position;
+ Vector2 q = (p_point - dst_rect.position) / dst_rect.size;
+ if (hflip)
+ q.x = 1.0f - q.x;
+ if (vflip)
+ q.y = 1.0f - q.y;
+ q = q * src_rect.size + src_rect.position;
+
+ Ref<Image> image;
+ Ref<AtlasTexture> atlasTexture = texture;
+ if (atlasTexture.is_null()) {
+ image = texture->get_data();
+ } else {
+ ERR_FAIL_COND_V(atlasTexture->get_atlas().is_null(), false);
+
+ image = atlasTexture->get_atlas()->get_data();
+
+ Rect2 region = atlasTexture->get_region();
+ Rect2 margin = atlasTexture->get_margin();
+
+ q -= margin.position;
+
+ if ((q.x > region.size.width) || (q.y > region.size.height)) {
+ return false;
+ }
+
+ q += region.position;
+ }
- Ref<Image> image = texture->get_data();
ERR_FAIL_COND_V(image.is_null(), false);
+ if (image->is_compressed()) {
+ return dst_rect.has_point(p_point);
+ }
+ bool is_repeat = texture->get_flags() & Texture::FLAG_REPEAT;
+ bool is_mirrored_repeat = texture->get_flags() & Texture::FLAG_MIRRORED_REPEAT;
+ if (is_repeat) {
+ int mirror_x = 0;
+ int mirror_y = 0;
+ if (is_mirrored_repeat) {
+ mirror_x = (int)(q.x / texture->get_size().width);
+ mirror_y = (int)(q.y / texture->get_size().height);
+ }
+ q.x = Math::fmod(q.x, texture->get_size().width);
+ q.y = Math::fmod(q.y, texture->get_size().height);
+ if (mirror_x % 2 == 1) {
+ q.x = texture->get_size().width - q.x - 1;
+ }
+ if (mirror_y % 2 == 1) {
+ q.y = texture->get_size().height - q.y - 1;
+ }
+ } else {
+ q.x = MIN(q.x, texture->get_size().width - 1);
+ q.y = MIN(q.y, texture->get_size().height - 1);
+ }
image->lock();
const Color c = image->get_pixel((int)q.x, (int)q.y);
image->unlock();
@@ -301,21 +374,17 @@ Rect2 Sprite::get_rect() const {
if (texture.is_null())
return Rect2(0, 0, 1, 1);
- /*
- if (texture.is_null())
- return CanvasItem::_edit_get_rect();
- */
Size2i s;
if (region) {
-
s = region_rect.size;
} else {
s = texture->get_size();
- s = s / Point2(hframes, vframes);
}
+ s = s / Point2(hframes, vframes);
+
Point2 ofs = offset;
if (centered)
ofs -= s / 2;
@@ -336,6 +405,15 @@ void Sprite::_validate_property(PropertyInfo &property) const {
}
}
+void Sprite::_changed_callback(Object *p_changed, const char *p_prop) {
+
+ // Changes to the texture need to trigger an update to make
+ // the editor redraw the sprite with the updated texture.
+ if (texture.is_valid() && texture.ptr() == p_changed) {
+ update();
+ }
+}
+
void Sprite::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Sprite::set_texture);
@@ -410,3 +488,8 @@ Sprite::Sprite() {
vframes = 1;
hframes = 1;
}
+
+Sprite::~Sprite() {
+ if (texture.is_valid())
+ texture->remove_change_receptor(this);
+}
diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h
index dd3719099f..0a5ff002cd 100644
--- a/scene/2d/sprite.h
+++ b/scene/2d/sprite.h
@@ -64,6 +64,8 @@ protected:
virtual void _validate_property(PropertyInfo &property) const;
+ virtual void _changed_callback(Object *p_changed, const char *p_prop);
+
public:
virtual Dictionary _edit_get_state() const;
virtual void _edit_set_state(const Dictionary &p_state);
@@ -72,7 +74,9 @@ public:
virtual Point2 _edit_get_pivot() const;
virtual bool _edit_use_pivot() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
- virtual Rect2 _edit_get_rect() const { return get_rect(); }
+
+ virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
void set_texture(const Ref<Texture> &p_texture);
Ref<Texture> get_texture() const;
@@ -111,8 +115,10 @@ public:
int get_hframes() const;
Rect2 get_rect() const;
+ virtual Rect2 get_anchorable_rect() const;
Sprite();
+ ~Sprite();
};
#endif // SPRITE_H
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 2aa55e2825..9a343ca0f0 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -61,6 +61,7 @@ void TileMap::_notification(int p_what) {
}
pending_update = true;
+ _recreate_quadrants();
_update_dirty_quadrants();
RID space = get_world_2d()->get_space();
_update_quadrant_transform();
@@ -142,16 +143,20 @@ void TileMap::_update_quadrant_transform() {
void TileMap::set_tileset(const Ref<TileSet> &p_tileset) {
- if (tile_set.is_valid())
+ if (tile_set.is_valid()) {
tile_set->disconnect("changed", this, "_recreate_quadrants");
+ tile_set->remove_change_receptor(this);
+ }
_clear_quadrants();
tile_set = p_tileset;
- if (tile_set.is_valid())
+ if (tile_set.is_valid()) {
tile_set->connect("changed", this, "_recreate_quadrants");
- else
+ tile_set->add_change_receptor(this);
+ } else {
clear();
+ }
_recreate_quadrants();
emit_signal("settings_changed");
@@ -261,12 +266,18 @@ void TileMap::_update_dirty_quadrants() {
SceneTree *st = SceneTree::get_singleton();
Color debug_collision_color;
+ Color debug_navigation_color;
bool debug_shapes = st && st->is_debugging_collisions_hint();
if (debug_shapes) {
debug_collision_color = st->get_debug_collisions_color();
}
+ bool debug_navigation = st && st->is_debugging_navigation_hint();
+ if (debug_navigation) {
+ debug_navigation_color = st->get_debug_navigation_color();
+ }
+
while (dirty_quadrant_list.first()) {
Quadrant &q = *dirty_quadrant_list.first()->self();
@@ -294,6 +305,7 @@ void TileMap::_update_dirty_quadrants() {
}
q.occluder_instances.clear();
Ref<ShaderMaterial> prev_material;
+ int prev_z_index;
RID prev_canvas_item;
RID prev_debug_canvas_item;
@@ -314,11 +326,12 @@ void TileMap::_update_dirty_quadrants() {
continue;
Ref<ShaderMaterial> mat = tile_set->tile_get_material(c.id);
+ int z_index = tile_set->tile_get_z_index(c.id);
RID canvas_item;
RID debug_canvas_item;
- if (prev_canvas_item == RID() || prev_material != mat) {
+ if (prev_canvas_item == RID() || prev_material != mat || prev_z_index != z_index) {
canvas_item = vs->canvas_item_create();
if (mat.is_valid())
@@ -329,6 +342,7 @@ void TileMap::_update_dirty_quadrants() {
xform.set_origin(q.pos);
vs->canvas_item_set_transform(canvas_item, xform);
vs->canvas_item_set_light_mask(canvas_item, get_light_mask());
+ vs->canvas_item_set_z_index(canvas_item, z_index);
q.canvas_items.push_back(canvas_item);
@@ -344,6 +358,7 @@ void TileMap::_update_dirty_quadrants() {
prev_canvas_item = canvas_item;
prev_material = mat;
+ prev_z_index = z_index;
} else {
canvas_item = prev_canvas_item;
@@ -451,10 +466,12 @@ void TileMap::_update_dirty_quadrants() {
Transform2D xform;
xform.set_origin(offset.floor());
- Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id, i);
+ Vector2 shape_ofs = shapes[i].shape_transform.get_origin();
_fix_cell_transform(xform, c, shape_ofs + center_ofs, s);
+ xform *= shapes[i].shape_transform.untranslated();
+
if (debug_canvas_item.is_valid()) {
vs->canvas_item_add_set_transform(debug_canvas_item, xform);
shape->draw(debug_canvas_item, debug_collision_color);
@@ -493,6 +510,55 @@ void TileMap::_update_dirty_quadrants() {
np.id = pid;
np.xform = xform;
q.navpoly_ids[E->key()] = np;
+
+ if (debug_navigation) {
+ RID debug_navigation_item = vs->canvas_item_create();
+ vs->canvas_item_set_parent(debug_navigation_item, canvas_item);
+ vs->canvas_item_set_z_as_relative_to_parent(debug_navigation_item, false);
+ vs->canvas_item_set_z_index(debug_navigation_item, VS::CANVAS_ITEM_Z_MAX - 2); // Display one below collision debug
+
+ if (debug_navigation_item.is_valid()) {
+ PoolVector<Vector2> navigation_polygon_vertices = navpoly->get_vertices();
+ int vsize = navigation_polygon_vertices.size();
+
+ if (vsize > 2) {
+ Vector<Color> colors;
+ Vector<Vector2> vertices;
+ vertices.resize(vsize);
+ colors.resize(vsize);
+ {
+ PoolVector<Vector2>::Read vr = navigation_polygon_vertices.read();
+ for (int i = 0; i < vsize; i++) {
+ vertices[i] = vr[i];
+ colors[i] = debug_navigation_color;
+ }
+ }
+
+ Vector<int> indices;
+
+ for (int i = 0; i < navpoly->get_polygon_count(); i++) {
+ Vector<int> polygon = navpoly->get_polygon(i);
+
+ for (int j = 2; j < polygon.size(); j++) {
+
+ int kofs[3] = { 0, j - 1, j };
+ for (int k = 0; k < 3; k++) {
+
+ int idx = polygon[kofs[k]];
+ ERR_FAIL_INDEX(idx, vsize);
+ indices.push_back(idx);
+ }
+ }
+ }
+ Transform2D navxform;
+ navxform.set_origin(offset.floor());
+ _fix_cell_transform(navxform, c, npoly_ofs + center_ofs, s);
+
+ vs->canvas_item_set_transform(debug_navigation_item, navxform);
+ vs->canvas_item_add_triangle_array(debug_navigation_item, indices, vertices, colors);
+ }
+ }
+ }
}
}
@@ -642,7 +708,7 @@ void TileMap::_erase_quadrant(Map<PosKey, Quadrant>::Element *Q) {
rect_cache_dirty = true;
}
-void TileMap::_make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q) {
+void TileMap::_make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q, bool update) {
Quadrant &q = Q->get();
if (!q.dirty_list.in_list())
@@ -653,7 +719,10 @@ void TileMap::_make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q) {
pending_update = true;
if (!is_inside_tree())
return;
- call_deferred("_update_dirty_quadrants");
+
+ if (update) {
+ _update_dirty_quadrants();
+ }
}
void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose) {
@@ -661,6 +730,11 @@ void TileMap::set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x, bool p_
set_cell(p_pos.x, p_pos.y, p_tile, p_flip_x, p_flip_y, p_transpose);
}
+void TileMap::set_celld(const Vector2 &p_pos, const Dictionary &p_data) {
+
+ set_cell(p_pos.x, p_pos.y, p_data["id"], p_data["flip_h"], p_data["flip_y"], p_data["transpose"], p_data["auto_coord"]);
+}
+
void TileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_y, bool p_transpose, Vector2 p_autotile_coord) {
PosKey pk(p_x, p_y);
@@ -781,16 +855,37 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
mask |= TileSet::BIND_BOTTOMRIGHT;
}
- } else if (tile_set->autotile_get_bitmask_mode(id) == TileSet::BITMASK_3X3) {
- if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
- mask |= TileSet::BIND_TOPLEFT;
+ } else {
+ if (tile_set->autotile_get_bitmask_mode(id) == TileSet::BITMASK_3X3_MINIMAL) {
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
+ mask |= TileSet::BIND_TOPLEFT;
+ }
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
+ mask |= TileSet::BIND_TOPRIGHT;
+ }
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
+ mask |= TileSet::BIND_BOTTOMLEFT;
+ }
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
+ mask |= TileSet::BIND_BOTTOMRIGHT;
+ }
+ } else {
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1))) {
+ mask |= TileSet::BIND_TOPLEFT;
+ }
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1))) {
+ mask |= TileSet::BIND_TOPRIGHT;
+ }
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1))) {
+ mask |= TileSet::BIND_BOTTOMLEFT;
+ }
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1))) {
+ mask |= TileSet::BIND_BOTTOMRIGHT;
+ }
}
if (tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1))) {
mask |= TileSet::BIND_TOP;
}
- if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
- mask |= TileSet::BIND_TOPRIGHT;
- }
if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
mask |= TileSet::BIND_LEFT;
}
@@ -798,15 +893,9 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
mask |= TileSet::BIND_RIGHT;
}
- if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
- mask |= TileSet::BIND_BOTTOMLEFT;
- }
if (tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1))) {
mask |= TileSet::BIND_BOTTOM;
}
- if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
- mask |= TileSet::BIND_BOTTOMRIGHT;
- }
}
Vector2 coord = tile_set->autotile_get_subtile_for_bitmask(id, mask, this, Vector2(p_x, p_y));
E->get().autotile_coord_x = (int)coord.x;
@@ -830,6 +919,16 @@ void TileMap::update_dirty_bitmask() {
}
}
+void TileMap::fix_invalid_tiles() {
+
+ for (Map<PosKey, Cell>::Element *E = tile_map.front(); E; E = E->next()) {
+
+ if (!tile_set->has_tile(get_cell(E->key().x, E->key().y))) {
+ set_cell(E->key().x, E->key().y, INVALID_CELL);
+ }
+ }
+}
+
int TileMap::get_cell(int p_x, int p_y) const {
PosKey pk(p_x, p_y);
@@ -888,6 +987,14 @@ void TileMap::set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord)
c.autotile_coord_x = p_coord.x;
c.autotile_coord_y = p_coord.y;
tile_map[pk] = c;
+
+ PosKey qk(p_x / _get_quadrant_size(), p_y / _get_quadrant_size());
+ Map<PosKey, Quadrant>::Element *Q = quadrant_map.find(qk);
+
+ if (!Q)
+ return;
+
+ _make_quadrant_dirty(Q);
}
Vector2 TileMap::get_cell_autotile_coord(int p_x, int p_y) const {
@@ -917,8 +1024,9 @@ void TileMap::_recreate_quadrants() {
}
Q->get().cells.insert(E->key());
- _make_quadrant_dirty(Q);
+ _make_quadrant_dirty(Q, false);
}
+ _update_dirty_quadrants();
}
void TileMap::_clear_quadrants() {
@@ -1044,12 +1152,6 @@ PoolVector<int> TileMap::_get_tile_data() const {
return data;
}
-Rect2 TileMap::_edit_get_rect() const {
-
- const_cast<TileMap *>(this)->_update_dirty_quadrants();
- return rect_cache;
-}
-
void TileMap::set_collision_layer(uint32_t p_layer) {
collision_layer = p_layer;
@@ -1509,12 +1611,14 @@ void TileMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_cell", "x", "y", "tile", "flip_x", "flip_y", "transpose", "autotile_coord"), &TileMap::set_cell, DEFVAL(false), DEFVAL(false), DEFVAL(false), DEFVAL(Vector2()));
ClassDB::bind_method(D_METHOD("set_cellv", "position", "tile", "flip_x", "flip_y", "transpose"), &TileMap::set_cellv, DEFVAL(false), DEFVAL(false), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("set_celld", "data"), &TileMap::set_celld);
ClassDB::bind_method(D_METHOD("get_cell", "x", "y"), &TileMap::get_cell);
ClassDB::bind_method(D_METHOD("get_cellv", "position"), &TileMap::get_cellv);
ClassDB::bind_method(D_METHOD("is_cell_x_flipped", "x", "y"), &TileMap::is_cell_x_flipped);
ClassDB::bind_method(D_METHOD("is_cell_y_flipped", "x", "y"), &TileMap::is_cell_y_flipped);
ClassDB::bind_method(D_METHOD("is_cell_transposed", "x", "y"), &TileMap::is_cell_transposed);
+ ClassDB::bind_method(D_METHOD("fix_invalid_tiles"), &TileMap::fix_invalid_tiles);
ClassDB::bind_method(D_METHOD("clear"), &TileMap::clear);
ClassDB::bind_method(D_METHOD("get_used_cells"), &TileMap::get_used_cells);
@@ -1573,6 +1677,12 @@ void TileMap::_bind_methods() {
BIND_ENUM_CONSTANT(TILE_ORIGIN_BOTTOM_LEFT);
}
+void TileMap::_changed_callback(Object *p_changed, const char *p_prop) {
+ if (tile_set.is_valid() && tile_set.ptr() == p_changed) {
+ emit_signal("settings_changed");
+ }
+}
+
TileMap::TileMap() {
rect_cache_dirty = true;
@@ -1601,5 +1711,8 @@ TileMap::TileMap() {
TileMap::~TileMap() {
+ if (tile_set.is_valid())
+ tile_set->remove_change_receptor(this);
+
clear();
}
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 973e527b42..79d79ca59f 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -188,7 +188,7 @@ private:
Map<PosKey, Quadrant>::Element *_create_quadrant(const PosKey &p_qk);
void _erase_quadrant(Map<PosKey, Quadrant>::Element *Q);
- void _make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q);
+ void _make_quadrant_dirty(Map<PosKey, Quadrant>::Element *Q, bool update = true);
void _recreate_quadrants();
void _clear_quadrants();
void _update_dirty_quadrants();
@@ -217,6 +217,8 @@ protected:
void _notification(int p_what);
static void _bind_methods();
+ virtual void _changed_callback(Object *p_changed, const char *p_prop);
+
public:
enum {
INVALID_CELL = -1
@@ -239,11 +241,10 @@ public:
void set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord);
Vector2 get_cell_autotile_coord(int p_x, int p_y) const;
+ void set_celld(const Vector2 &p_pos, const Dictionary &p_data);
void set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false);
int get_cellv(const Vector2 &p_pos) const;
- Rect2 _edit_get_rect() const;
-
void make_bitmask_area_dirty(const Vector2 &p_pos);
void update_bitmask_area(const Vector2 &p_pos);
void update_bitmask_region(const Vector2 &p_start = Vector2(), const Vector2 &p_end = Vector2());
@@ -308,6 +309,7 @@ public:
void set_clip_uv(bool p_enable);
bool get_clip_uv() const;
+ void fix_invalid_tiles();
void clear();
TileMap();
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index 4b38534d97..ddca97e60a 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -89,6 +89,10 @@ Rect2 VisibilityNotifier2D::_edit_get_rect() const {
return rect;
}
+bool VisibilityNotifier2D::_edit_use_rect() const {
+ return true;
+}
+
Rect2 VisibilityNotifier2D::get_rect() const {
return rect;
diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h
index 93a35a709e..c4e12dfa22 100644
--- a/scene/2d/visibility_notifier_2d.h
+++ b/scene/2d/visibility_notifier_2d.h
@@ -56,6 +56,7 @@ protected:
public:
virtual Rect2 _edit_get_rect() const;
+ virtual bool _edit_use_rect() const;
void set_rect(const Rect2 &p_rect);
Rect2 get_rect() const;
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index 21f471039f..6ea980ec97 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -711,7 +711,7 @@ void Area::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "space_override", PROPERTY_HINT_ENUM, "Disabled,Combine,Combine-Replace,Replace,Replace-Combine"), "set_space_override_mode", "get_space_override_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gravity_point"), "set_gravity_is_point", "is_gravity_a_point");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "gravity_distance_scale", PROPERTY_HINT_RANGE, "0,1024,0.001"), "set_gravity_distance_scale", "get_gravity_distance_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "gravity_distance_scale", PROPERTY_HINT_EXP_RANGE, "0,1024,0.001,or_greater"), "set_gravity_distance_scale", "get_gravity_distance_scale");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity_vec"), "set_gravity_vector", "get_gravity_vector");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "gravity", PROPERTY_HINT_RANGE, "-1024,1024,0.01"), "set_gravity", "get_gravity");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "linear_damp", PROPERTY_HINT_RANGE, "0,1024,0.001"), "set_linear_damp", "get_linear_damp");
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index 001c58ea76..4bff26a200 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -73,7 +73,10 @@ Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const {
ERR_FAIL_NULL_V(arvr_server, Vector3());
Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3());
+ if (arvr_interface.is_null()) {
+ // we might be in the editor or have VR turned off, just call superclass
+ return Camera::project_local_ray_normal(p_pos);
+ }
if (!is_inside_tree()) {
ERR_EXPLAIN("Camera is not inside scene.");
@@ -98,7 +101,10 @@ Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const {
ERR_FAIL_NULL_V(arvr_server, Vector2());
Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- ERR_FAIL_COND_V(arvr_interface.is_null(), Vector2());
+ if (arvr_interface.is_null()) {
+ // we might be in the editor or have VR turned off, just call superclass
+ return Camera::unproject_position(p_pos);
+ }
if (!is_inside_tree()) {
ERR_EXPLAIN("Camera is not inside scene.");
@@ -127,7 +133,10 @@ Vector3 ARVRCamera::project_position(const Point2 &p_point) const {
ERR_FAIL_NULL_V(arvr_server, Vector3());
Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3());
+ if (arvr_interface.is_null()) {
+ // we might be in the editor or have VR turned off, just call superclass
+ return Camera::project_position(p_point);
+ }
if (!is_inside_tree()) {
ERR_EXPLAIN("Camera is not inside scene.");
@@ -157,7 +166,10 @@ Vector<Plane> ARVRCamera::get_frustum() const {
ERR_FAIL_NULL_V(arvr_server, Vector<Plane>());
Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- ERR_FAIL_COND_V(arvr_interface.is_null(), Vector<Plane>());
+ if (arvr_interface.is_null()) {
+ // we might be in the editor or have VR turned off, just call superclass
+ return Camera::get_frustum();
+ }
ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>());
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index c2a50ec7bb..f1da375451 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -35,11 +35,8 @@
#include "scene/main/viewport.h"
void AudioStreamPlayer3D::_mix_audio() {
- if (!stream_playback.is_valid()) {
- return;
- }
-
- if (!active) {
+ if (!stream_playback.is_valid() || !active ||
+ (stream_paused && stream_paused_fade <= 0.f)) {
return;
}
@@ -54,8 +51,9 @@ void AudioStreamPlayer3D::_mix_audio() {
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
- //mix
- if (output_count > 0 || out_of_range_mode == OUT_OF_RANGE_MIX) {
+ // Mix if we're not paused or we're fading out
+ if ((output_count > 0 || out_of_range_mode == OUT_OF_RANGE_MIX) &&
+ (!stream_paused || stream_paused_fade > 0.f)) {
float output_pitch_scale = 0.0;
if (output_count) {
@@ -108,6 +106,13 @@ void AudioStreamPlayer3D::_mix_audio() {
AudioFrame vol_inc = (current.vol[k] - prev_outputs[i].vol[k]) / float(buffer_size);
AudioFrame vol = current.vol[k];
+ if (stream_paused) {
+ vol = vol * stream_paused_fade;
+ if (stream_paused_fade > 0.f) {
+ stream_paused_fade -= 0.1f;
+ }
+ }
+
AudioFrame *target = AudioServer::get_singleton()->thread_get_channel_mix_buffer(current.bus_index, k);
current.filter.set_mode(AudioFilterSW::HIGHSHELF);
@@ -237,6 +242,18 @@ void AudioStreamPlayer3D::_notification(int p_what) {
AudioServer::get_singleton()->remove_callback(_mix_audios, this);
}
+
+ if (p_what == NOTIFICATION_PAUSED) {
+ if (!can_process()) {
+ // Node can't process so we start fading out to silence
+ set_stream_paused(true);
+ }
+ }
+
+ if (p_what == NOTIFICATION_UNPAUSED) {
+ set_stream_paused(false);
+ }
+
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
if (doppler_tracking != DOPPLER_TRACKING_DISABLED) {
@@ -825,6 +842,19 @@ AudioStreamPlayer3D::DopplerTracking AudioStreamPlayer3D::get_doppler_tracking()
return doppler_tracking;
}
+void AudioStreamPlayer3D::set_stream_paused(bool p_pause) {
+
+ if (p_pause != stream_paused) {
+ stream_paused = p_pause;
+ stream_paused_fade = stream_paused ? 1.f : 0.f;
+ }
+}
+
+bool AudioStreamPlayer3D::get_stream_paused() const {
+
+ return stream_paused;
+}
+
void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_stream", "stream"), &AudioStreamPlayer3D::set_stream);
@@ -888,6 +918,9 @@ void AudioStreamPlayer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_doppler_tracking", "mode"), &AudioStreamPlayer3D::set_doppler_tracking);
ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &AudioStreamPlayer3D::get_doppler_tracking);
+ ClassDB::bind_method(D_METHOD("set_stream_paused", "pause"), &AudioStreamPlayer3D::set_stream_paused);
+ ClassDB::bind_method(D_METHOD("get_stream_paused"), &AudioStreamPlayer3D::get_stream_paused);
+
ClassDB::bind_method(D_METHOD("_bus_layout_changed"), &AudioStreamPlayer3D::_bus_layout_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
@@ -898,7 +931,8 @@ void AudioStreamPlayer3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "0,65536,1"), "set_max_distance", "get_max_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stream_paused", PROPERTY_HINT_NONE, ""), "set_stream_paused", "get_stream_paused");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_EXP_RANGE, "0,4096,1,or_greater"), "set_max_distance", "get_max_distance");
ADD_PROPERTY(PropertyInfo(Variant::INT, "out_of_range_mode", PROPERTY_HINT_ENUM, "Mix,Pause"), "set_out_of_range_mode", "get_out_of_range_mode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
ADD_PROPERTY(PropertyInfo(Variant::INT, "area_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_area_mask", "get_area_mask");
@@ -949,6 +983,8 @@ AudioStreamPlayer3D::AudioStreamPlayer3D() {
attenuation_filter_db = -24;
out_of_range_mode = OUT_OF_RANGE_MIX;
doppler_tracking = DOPPLER_TRACKING_DISABLED;
+ stream_paused = false;
+ stream_paused_fade = 0.f;
velocity_tracker.instance();
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 1fcb83cf21..cab1ff121a 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -107,7 +107,9 @@ private:
float unit_size;
float max_db;
float pitch_scale;
+ float stream_paused_fade;
bool autoplay;
+ bool stream_paused;
StringName bus;
void _mix_audio();
@@ -199,6 +201,9 @@ public:
void set_doppler_tracking(DopplerTracking p_tracking);
DopplerTracking get_doppler_tracking() const;
+ void set_stream_paused(bool p_pause);
+ bool get_stream_paused() const;
+
AudioStreamPlayer3D();
~AudioStreamPlayer3D();
};
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 6998b34cfd..e11e8abe5b 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -201,7 +201,7 @@ void Camera::make_current() {
//get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,camera_group,"_camera_make_current",this);
}
-void Camera::clear_current() {
+void Camera::clear_current(bool p_enable_next) {
current = false;
if (!is_inside_tree())
@@ -209,7 +209,10 @@ void Camera::clear_current() {
if (get_viewport()->get_camera() == this) {
get_viewport()->_camera_set(NULL);
- get_viewport()->_camera_make_next_current(this);
+
+ if (p_enable_next) {
+ get_viewport()->_camera_make_next_current(this);
+ }
}
}
@@ -439,7 +442,7 @@ void Camera::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_perspective", "fov", "z_near", "z_far"), &Camera::set_perspective);
ClassDB::bind_method(D_METHOD("set_orthogonal", "size", "z_near", "z_far"), &Camera::set_orthogonal);
ClassDB::bind_method(D_METHOD("make_current"), &Camera::make_current);
- ClassDB::bind_method(D_METHOD("clear_current"), &Camera::clear_current);
+ ClassDB::bind_method(D_METHOD("clear_current", "enable_next"), &Camera::clear_current, DEFVAL(true));
ClassDB::bind_method(D_METHOD("set_current"), &Camera::set_current);
ClassDB::bind_method(D_METHOD("is_current"), &Camera::is_current);
ClassDB::bind_method(D_METHOD("get_camera_transform"), &Camera::get_camera_transform);
@@ -477,8 +480,8 @@ void Camera::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "current"), "set_current", "is_current");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "fov", PROPERTY_HINT_RANGE, "1,179,0.1"), "set_fov", "get_fov");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "size", PROPERTY_HINT_RANGE, "0.1,16384,0.01"), "set_size", "get_size");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "near"), "set_znear", "get_znear");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "far"), "set_zfar", "get_zfar");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "near", PROPERTY_HINT_EXP_RANGE, "0.1,8192,0.1,or_greater"), "set_znear", "get_znear");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "far", PROPERTY_HINT_EXP_RANGE, "0.1,8192,0.1,or_greater"), "set_zfar", "get_zfar");
BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE);
BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL);
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index e2679870de..1b506e0c4f 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -113,7 +113,7 @@ public:
void set_projection(Camera::Projection p_mode);
void make_current();
- void clear_current();
+ void clear_current(bool p_enable_next = true);
void set_current(bool p_current);
bool is_current() const;
@@ -132,9 +132,9 @@ public:
virtual Transform get_camera_transform() const;
- Vector3 project_ray_normal(const Point2 &p_pos) const;
+ virtual Vector3 project_ray_normal(const Point2 &p_pos) const;
virtual Vector3 project_ray_origin(const Point2 &p_pos) const;
- Vector3 project_local_ray_normal(const Point2 &p_pos) const;
+ virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
virtual Point2 unproject_position(const Vector3 &p_pos) const;
bool is_position_behind(const Vector3 &p_pos) const;
virtual Vector3 project_position(const Point2 &p_point) const;
diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp
index 3a77360bc2..379dd21c39 100644
--- a/scene/3d/collision_polygon.cpp
+++ b/scene/3d/collision_polygon.cpp
@@ -173,6 +173,9 @@ String CollisionPolygon::get_configuration_warning() const {
return String();
}
+bool CollisionPolygon::_is_editable_3d_polygon() const {
+ return true;
+}
void CollisionPolygon::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_depth", "depth"), &CollisionPolygon::set_depth);
@@ -184,6 +187,8 @@ void CollisionPolygon::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_disabled", "disabled"), &CollisionPolygon::set_disabled);
ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionPolygon::is_disabled);
+ ClassDB::bind_method(D_METHOD("_is_editable_3d_polygon"), &CollisionPolygon::_is_editable_3d_polygon);
+
ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth"), "set_depth", "get_depth");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon");
diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h
index 971c67f1ad..f1f137c9c5 100644
--- a/scene/3d/collision_polygon.h
+++ b/scene/3d/collision_polygon.h
@@ -53,6 +53,8 @@ protected:
void _update_in_shape_owner(bool p_xform_only = false);
+ bool _is_editable_3d_polygon() const;
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 9865fe156a..ffa283f634 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -38,10 +38,10 @@ void InterpolatedCamera::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (Engine::get_singleton()->is_editor_hint() && enabled)
- set_physics_process(false);
+ set_process_internal(false);
} break;
- case NOTIFICATION_PROCESS: {
+ case NOTIFICATION_INTERNAL_PROCESS: {
if (!enabled)
break;
@@ -111,9 +111,9 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) {
if (p_enable) {
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
return;
- set_process(true);
+ set_process_internal(true);
} else
- set_process(false);
+ set_process_internal(false);
}
bool InterpolatedCamera::is_interpolation_enabled() const {
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 240bd631a1..7c42638107 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -375,7 +375,7 @@ void DirectionalLight::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_bias_split_scale", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS_SPLIT_SCALE);
ADD_PROPERTY(PropertyInfo(Variant::INT, "directional_shadow_depth_range", PROPERTY_HINT_ENUM, "Stable,Optimized"), "set_shadow_depth_range", "get_shadow_depth_range");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_max_distance", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_max_distance", PROPERTY_HINT_EXP_RANGE, "0,8192,0.1,or_greater"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
BIND_ENUM_CONSTANT(SHADOW_ORTHOGONAL);
BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
@@ -428,8 +428,8 @@ void OmniLight::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_shadow_detail"), &OmniLight::get_shadow_detail);
ADD_GROUP("Omni", "omni_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_range", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_RANGE);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_ATTENUATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_range", PROPERTY_HINT_EXP_RANGE, "0,4096,0.1,or_greater"), "set_param", "get_param", PARAM_RANGE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "omni_attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), "set_param", "get_param", PARAM_ATTENUATION);
ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_mode", PROPERTY_HINT_ENUM, "Dual Paraboloid,Cube"), "set_shadow_mode", "get_shadow_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "omni_shadow_detail", PROPERTY_HINT_ENUM, "Vertical,Horizontal"), "set_shadow_detail", "get_shadow_detail");
@@ -450,8 +450,8 @@ OmniLight::OmniLight() :
void SpotLight::_bind_methods() {
ADD_GROUP("Spot", "spot_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_range", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_RANGE);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_ATTENUATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_range", PROPERTY_HINT_EXP_RANGE, "0,4096,0.1,or_greater"), "set_param", "get_param", PARAM_RANGE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), "set_param", "get_param", PARAM_ATTENUATION);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_angle", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_param", "get_param", PARAM_SPOT_ANGLE);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_angle_attenuation", PROPERTY_HINT_EXP_EASING), "set_param", "get_param", PARAM_SPOT_ATTENUATION);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "spot_angle_attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), "set_param", "get_param", PARAM_SPOT_ATTENUATION);
}
diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp
index 80bae911d4..e836a6154a 100644
--- a/scene/3d/mesh_instance.cpp
+++ b/scene/3d/mesh_instance.cpp
@@ -371,7 +371,7 @@ void MeshInstance::_bind_methods() {
ClassDB::set_method_flags("MeshInstance", "create_debug_tangents", METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "skeleton"), "set_skeleton_path", "get_skeleton_path");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "skeleton", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Skeleton"), "set_skeleton_path", "get_skeleton_path");
}
MeshInstance::MeshInstance() {
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index e7ab6cde8a..77bf703706 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -35,6 +35,7 @@ void Navigation::_navmesh_link(int p_id) {
ERR_FAIL_COND(!navmesh_map.has(p_id));
NavMesh &nm = navmesh_map[p_id];
ERR_FAIL_COND(nm.linked);
+ ERR_FAIL_COND(nm.navmesh.is_null());
PoolVector<Vector3> vertices = nm.navmesh->get_vertices();
int len = vertices.size();
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 8617bbc2f6..2b3a62fcdc 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -324,11 +324,11 @@ void Particles::_bind_methods() {
ClassDB::bind_method(D_METHOD("capture_aabb"), &Particles::capture_aabb);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,100000,1"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
ADD_GROUP("Time", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_EXP_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "get_one_shot");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_EXP_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio");
@@ -849,9 +849,9 @@ void ParticlesMaterial::_update_shader() {
code += " vec4(1.250, -1.050, -0.203, 0.0),\n";
code += " vec4(0.000, 0.000, 0.000, 0.0)) * hue_rot_s;\n";
if (color_ramp.is_valid()) {
- code += " COLOR = textureLod(color_ramp,vec2(CUSTOM.y,0.0),0.0) * hue_rot_mat;\n";
+ code += " COLOR = hue_rot_mat * textureLod(color_ramp,vec2(CUSTOM.y,0.0),0.0);\n";
} else {
- code += " COLOR = color_value * hue_rot_mat;\n";
+ code += " COLOR = hue_rot_mat * color_value;\n";
}
if (emission_color_texture.is_valid() && emission_shape >= EMISSION_SHAPE_POINTS) {
code += " COLOR*= texelFetch(emission_texture_color,emission_tex_ofs,0);\n";
@@ -1028,8 +1028,6 @@ void ParticlesMaterial::set_param(Parameter p_param, float p_value) {
case PARAM_ANIM_OFFSET: {
VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value);
} break;
- case PARAM_MAX: {
- };
}
}
float ParticlesMaterial::get_param(Parameter p_param) const {
@@ -1082,8 +1080,6 @@ void ParticlesMaterial::set_param_randomness(Parameter p_param, float p_value) {
case PARAM_ANIM_OFFSET: {
VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value);
} break;
- case PARAM_MAX: {
- };
}
}
float ParticlesMaterial::get_param_randomness(Parameter p_param) const {
@@ -1160,8 +1156,6 @@ void ParticlesMaterial::set_param_texture(Parameter p_param, const Ref<Texture>
case PARAM_ANIM_OFFSET: {
VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture);
} break;
- case PARAM_MAX: {
- };
}
_queue_shader_change();
@@ -1233,28 +1227,19 @@ void ParticlesMaterial::set_emission_box_extents(Vector3 p_extents) {
void ParticlesMaterial::set_emission_point_texture(const Ref<Texture> &p_points) {
emission_point_texture = p_points;
- RID texture;
- if (p_points.is_valid())
- texture = p_points->get_rid();
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, texture);
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, p_points);
}
void ParticlesMaterial::set_emission_normal_texture(const Ref<Texture> &p_normals) {
emission_normal_texture = p_normals;
- RID texture;
- if (p_normals.is_valid())
- texture = p_normals->get_rid();
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, texture);
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, p_normals);
}
void ParticlesMaterial::set_emission_color_texture(const Ref<Texture> &p_colors) {
emission_color_texture = p_colors;
- RID texture;
- if (p_colors.is_valid())
- texture = p_colors->get_rid();
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, texture);
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, p_colors);
_queue_shader_change();
}
@@ -1316,10 +1301,7 @@ void ParticlesMaterial::set_trail_size_modifier(const Ref<CurveTexture> &p_trail
curve->ensure_default_setup();
}
- RID texture;
- if (p_trail_size_modifier.is_valid())
- texture = p_trail_size_modifier->get_rid();
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, texture);
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, curve);
_queue_shader_change();
}
@@ -1331,10 +1313,7 @@ Ref<CurveTexture> ParticlesMaterial::get_trail_size_modifier() const {
void ParticlesMaterial::set_trail_color_modifier(const Ref<GradientTexture> &p_trail_color_modifier) {
trail_color_modifier = p_trail_color_modifier;
- RID texture;
- if (p_trail_color_modifier.is_valid())
- texture = p_trail_color_modifier->get_rid();
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, texture);
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, p_trail_color_modifier);
_queue_shader_change();
}
@@ -1465,7 +1444,7 @@ void ParticlesMaterial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "trail_color_modifier", PROPERTY_HINT_RESOURCE_TYPE, "GradientTexture"), "set_trail_color_modifier", "get_trail_color_modifier");
ADD_GROUP("Emission Shape", "emission_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_shape", PROPERTY_HINT_ENUM, "Point,Sphere,Box,Points,Directed Points"), "set_emission_shape", "get_emission_shape");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01"), "set_emission_sphere_radius", "get_emission_sphere_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01,or_greater"), "set_emission_sphere_radius", "get_emission_sphere_radius");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "emission_box_extents"), "set_emission_box_extents", "get_emission_box_extents");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "emission_point_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_emission_point_texture", "get_emission_point_texture");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "emission_normal_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_emission_normal_texture", "get_emission_normal_texture");
@@ -1481,38 +1460,38 @@ void ParticlesMaterial::_bind_methods() {
ADD_GROUP("Gravity", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity"), "set_gravity", "get_gravity");
ADD_GROUP("Initial Velocity", "initial_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_INITIAL_LINEAR_VELOCITY);
ADD_GROUP("Angular Velocity", "angular_");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity", PROPERTY_HINT_RANGE, "-360,360,0.01"), "set_param", "get_param", PARAM_ANGULAR_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGULAR_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angular_velocity_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANGULAR_VELOCITY);
ADD_GROUP("Orbit Velocity", "orbit_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity", PROPERTY_HINT_RANGE, "-1000,1000,0.01"), "set_param", "get_param", PARAM_ORBIT_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity", PROPERTY_HINT_RANGE, "-1000,1000,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_ORBIT_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "orbit_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ORBIT_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "orbit_velocity_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ORBIT_VELOCITY);
ADD_GROUP("Linear Accel", "linear_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel", PROPERTY_HINT_RANGE, "-100,100,0.01"), "set_param", "get_param", PARAM_LINEAR_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_LINEAR_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_LINEAR_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "linear_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_LINEAR_ACCEL);
ADD_GROUP("Radial Accel", "radial_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel", PROPERTY_HINT_RANGE, "-100,100,0.01"), "set_param", "get_param", PARAM_RADIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_RADIAL_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "radial_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_RADIAL_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "radial_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_RADIAL_ACCEL);
ADD_GROUP("Tangential Accel", "tangential_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel", PROPERTY_HINT_RANGE, "-100,100,0.01"), "set_param", "get_param", PARAM_TANGENTIAL_ACCEL);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel", PROPERTY_HINT_RANGE, "-100,100,0.01,or_lesser,or_greater"), "set_param", "get_param", PARAM_TANGENTIAL_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "tangential_accel_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_TANGENTIAL_ACCEL);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "tangential_accel_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_TANGENTIAL_ACCEL);
ADD_GROUP("Damping", "");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_param", "get_param", PARAM_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping", PROPERTY_HINT_RANGE, "0,100,0.01,or_greater"), "set_param", "get_param", PARAM_DAMPING);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "damping_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_DAMPING);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "damping_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_DAMPING);
ADD_GROUP("Angle", "");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle", PROPERTY_HINT_RANGE, "-720,720,0.1"), "set_param", "get_param", PARAM_ANGLE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle", PROPERTY_HINT_RANGE, "-720,720,0.1,or_lesser,or_greater"), "set_param", "get_param", PARAM_ANGLE);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angle_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANGLE);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "angle_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANGLE);
ADD_GROUP("Scale", "");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0,1000,0.01"), "set_param", "get_param", PARAM_SCALE);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0,1000,0.01,or_greater"), "set_param", "get_param", PARAM_SCALE);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "scale_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_SCALE);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "scale_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_SCALE);
ADD_GROUP("Color", "");
@@ -1524,7 +1503,7 @@ void ParticlesMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "hue_variation_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_HUE_VARIATION);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "hue_variation_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_HUE_VARIATION);
ADD_GROUP("Animation", "anim_");
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed", PROPERTY_HINT_RANGE, "0,128,0.01"), "set_param", "get_param", PARAM_ANIM_SPEED);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed", PROPERTY_HINT_RANGE, "0,128,0.01,or_greater"), "set_param", "get_param", PARAM_ANIM_SPEED);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_speed_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_ANIM_SPEED);
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_speed_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_SPEED);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anim_offset", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_ANIM_OFFSET);
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index 7ac7f74bb0..9acaa15641 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -40,6 +40,9 @@ void Path::_curve_changed() {
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
update_gizmo();
+ if (is_inside_tree()) {
+ emit_signal("curve_changed");
+ }
}
void Path::set_curve(const Ref<Curve3D> &p_curve) {
@@ -68,6 +71,8 @@ void Path::_bind_methods() {
ClassDB::bind_method(D_METHOD("_curve_changed"), &Path::_curve_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D"), "set_curve", "get_curve");
+
+ ADD_SIGNAL(MethodInfo("curve_changed"));
}
Path::Path() {
@@ -225,7 +230,7 @@ void PathFollow::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow::set_loop);
ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow::has_loop);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01"), "set_offset", "get_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_EXP_RANGE, "0,10000,0.01,or_greater"), "set_offset", "get_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset");
@@ -324,3 +329,219 @@ PathFollow::PathFollow() {
cubic = true;
loop = true;
}
+
+//////////////
+
+void OrientedPathFollow::_update_transform() {
+
+ if (!path)
+ return;
+
+ Ref<Curve3D> c = path->get_curve();
+ if (!c.is_valid())
+ return;
+
+ int count = c->get_point_count();
+ if (count < 2)
+ return;
+
+ if (delta_offset == 0) {
+ return;
+ }
+
+ float offset = get_offset();
+ float bl = c->get_baked_length();
+ float bi = c->get_bake_interval();
+ float o = offset;
+ float o_next = offset + bi;
+
+ if (has_loop()) {
+ o = Math::fposmod(o, bl);
+ o_next = Math::fposmod(o_next, bl);
+ } else if (o_next >= bl) {
+ o = bl - bi;
+ o_next = bl;
+ }
+
+ bool cubic = get_cubic_interpolation();
+ Vector3 pos = c->interpolate_baked(o, cubic);
+ Vector3 forward = c->interpolate_baked(o_next, cubic) - pos;
+
+ if (forward.length_squared() < CMP_EPSILON2)
+ forward = Vector3(0, 0, 1);
+ else
+ forward.normalize();
+
+ Vector3 up = c->interpolate_baked_up_vector(o, true);
+
+ if (o_next < o) {
+ Vector3 up1 = c->interpolate_baked_up_vector(o_next, true);
+ Vector3 axis = up.cross(up1);
+
+ if (axis.length_squared() < CMP_EPSILON2)
+ axis = forward;
+ else
+ axis.normalize();
+
+ up.rotate(axis, up.angle_to(up1) * 0.5f);
+ }
+
+ Transform t = get_transform();
+ Vector3 scale = t.basis.get_scale();
+
+ Vector3 sideways = up.cross(forward).normalized();
+ up = forward.cross(sideways).normalized();
+
+ t.basis.set(sideways, up, forward);
+ t.basis.scale_local(scale);
+
+ t.origin = pos + sideways * get_h_offset() + up * get_v_offset();
+
+ set_transform(t);
+}
+
+void OrientedPathFollow::_notification(int p_what) {
+
+ switch (p_what) {
+
+ case NOTIFICATION_ENTER_TREE: {
+
+ Node *parent = get_parent();
+ if (parent) {
+ path = Object::cast_to<Path>(parent);
+ if (path) {
+ _update_transform();
+ }
+ }
+
+ } break;
+ case NOTIFICATION_EXIT_TREE: {
+
+ path = NULL;
+ } break;
+ }
+}
+
+void OrientedPathFollow::set_cubic_interpolation(bool p_enable) {
+
+ cubic = p_enable;
+}
+
+bool OrientedPathFollow::get_cubic_interpolation() const {
+
+ return cubic;
+}
+
+void OrientedPathFollow::_validate_property(PropertyInfo &property) const {
+
+ if (property.name == "offset") {
+
+ float max = 10000;
+ if (path && path->get_curve().is_valid())
+ max = path->get_curve()->get_baked_length();
+
+ property.hint_string = "0," + rtos(max) + ",0.01";
+ }
+}
+
+void OrientedPathFollow::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_offset", "offset"), &OrientedPathFollow::set_offset);
+ ClassDB::bind_method(D_METHOD("get_offset"), &OrientedPathFollow::get_offset);
+
+ ClassDB::bind_method(D_METHOD("set_h_offset", "h_offset"), &OrientedPathFollow::set_h_offset);
+ ClassDB::bind_method(D_METHOD("get_h_offset"), &OrientedPathFollow::get_h_offset);
+
+ ClassDB::bind_method(D_METHOD("set_v_offset", "v_offset"), &OrientedPathFollow::set_v_offset);
+ ClassDB::bind_method(D_METHOD("get_v_offset"), &OrientedPathFollow::get_v_offset);
+
+ ClassDB::bind_method(D_METHOD("set_unit_offset", "unit_offset"), &OrientedPathFollow::set_unit_offset);
+ ClassDB::bind_method(D_METHOD("get_unit_offset"), &OrientedPathFollow::get_unit_offset);
+
+ ClassDB::bind_method(D_METHOD("set_cubic_interpolation", "enable"), &OrientedPathFollow::set_cubic_interpolation);
+ ClassDB::bind_method(D_METHOD("get_cubic_interpolation"), &OrientedPathFollow::get_cubic_interpolation);
+
+ ClassDB::bind_method(D_METHOD("set_loop", "loop"), &OrientedPathFollow::set_loop);
+ ClassDB::bind_method(D_METHOD("has_loop"), &OrientedPathFollow::has_loop);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "offset", PROPERTY_HINT_RANGE, "0,10000,0.01"), "set_offset", "get_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "h_offset"), "set_h_offset", "get_h_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_offset"), "set_v_offset", "get_v_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cubic_interp"), "set_cubic_interpolation", "get_cubic_interpolation");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
+}
+
+void OrientedPathFollow::set_offset(float p_offset) {
+ delta_offset = p_offset - offset;
+ offset = p_offset;
+
+ if (path)
+ _update_transform();
+ _change_notify("offset");
+ _change_notify("unit_offset");
+}
+
+void OrientedPathFollow::set_h_offset(float p_h_offset) {
+
+ h_offset = p_h_offset;
+ if (path)
+ _update_transform();
+}
+
+float OrientedPathFollow::get_h_offset() const {
+
+ return h_offset;
+}
+
+void OrientedPathFollow::set_v_offset(float p_v_offset) {
+
+ v_offset = p_v_offset;
+ if (path)
+ _update_transform();
+}
+
+float OrientedPathFollow::get_v_offset() const {
+
+ return v_offset;
+}
+
+float OrientedPathFollow::get_offset() const {
+
+ return offset;
+}
+
+void OrientedPathFollow::set_unit_offset(float p_unit_offset) {
+
+ if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
+ set_offset(p_unit_offset * path->get_curve()->get_baked_length());
+}
+
+float OrientedPathFollow::get_unit_offset() const {
+
+ if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length())
+ return get_offset() / path->get_curve()->get_baked_length();
+ else
+ return 0;
+}
+
+void OrientedPathFollow::set_loop(bool p_loop) {
+
+ loop = p_loop;
+}
+
+bool OrientedPathFollow::has_loop() const {
+
+ return loop;
+}
+
+OrientedPathFollow::OrientedPathFollow() {
+
+ offset = 0;
+ delta_offset = 0;
+ h_offset = 0;
+ v_offset = 0;
+ path = NULL;
+ cubic = true;
+ loop = true;
+}
diff --git a/scene/3d/path.h b/scene/3d/path.h
index 2ed686ac3c..f73bf17dfe 100644
--- a/scene/3d/path.h
+++ b/scene/3d/path.h
@@ -111,4 +111,47 @@ public:
VARIANT_ENUM_CAST(PathFollow::RotationMode);
+class OrientedPathFollow : public Spatial {
+
+ GDCLASS(OrientedPathFollow, Spatial);
+
+private:
+ Path *path;
+ real_t delta_offset; // change in offset since last _update_transform
+ real_t offset;
+ real_t h_offset;
+ real_t v_offset;
+ bool cubic;
+ bool loop;
+
+ void _update_transform();
+
+protected:
+ virtual void _validate_property(PropertyInfo &property) const;
+
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void set_offset(float p_offset);
+ float get_offset() const;
+
+ void set_h_offset(float p_h_offset);
+ float get_h_offset() const;
+
+ void set_v_offset(float p_v_offset);
+ float get_v_offset() const;
+
+ void set_unit_offset(float p_unit_offset);
+ float get_unit_offset() const;
+
+ void set_loop(bool p_loop);
+ bool has_loop() const;
+
+ void set_cubic_interpolation(bool p_enable);
+ bool get_cubic_interpolation() const;
+
+ OrientedPathFollow();
+};
+
#endif // PATH_H
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index ff4a807de0..e851c8d643 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -34,6 +34,10 @@
#include "method_bind_ext.gen.inc"
#include "scene/scene_string_names.h"
+#ifdef TOOLS_ENABLED
+#include "editor/plugins/spatial_editor_plugin.h"
+#endif
+
void PhysicsBody::_notification(int p_what) {
/*
@@ -781,7 +785,7 @@ String RigidBody::get_configuration_warning() const {
String warning = CollisionObject::get_configuration_warning();
- if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(0).length() - 1.0) > 0.05)) {
+ if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(2).length() - 1.0) > 0.05)) {
if (warning != String()) {
warning += "\n";
}
@@ -975,7 +979,7 @@ bool KinematicBody::move_and_collide(const Vector3 &p_motion, bool p_infinite_in
return colliding;
}
-Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction, bool p_infinite_inertia, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) {
+Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle, bool p_infinite_inertia) {
Vector3 lv = p_linear_velocity;
@@ -1124,7 +1128,7 @@ Ref<KinematicCollision> KinematicBody::_get_slide_collision(int p_bounce) {
void KinematicBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("move_and_collide", "rel_vec", "infinite_inertia"), &KinematicBody::_move, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "infinite_inertia", "slope_stop_min_velocity", "max_slides", "floor_max_angle"), &KinematicBody::move_and_slide, DEFVAL(Vector3(0, 0, 0)), DEFVAL(true), DEFVAL(0.05), DEFVAL(4), DEFVAL(Math::deg2rad((float)45)));
+ ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "slope_stop_min_velocity", "max_slides", "floor_max_angle", "infinite_inertia"), &KinematicBody::move_and_slide, DEFVAL(Vector3(0, 0, 0)), DEFVAL(0.05), DEFVAL(4), DEFVAL(Math::deg2rad((float)45)), DEFVAL(true));
ClassDB::bind_method(D_METHOD("test_move", "from", "rel_vec", "infinite_inertia"), &KinematicBody::test_move);
@@ -1266,3 +1270,1112 @@ KinematicCollision::KinematicCollision() {
collision.local_shape = 0;
owner = NULL;
}
+
+///////////////////////////////////////
+
+bool PhysicalBone::JointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
+ return false;
+}
+
+bool PhysicalBone::JointData::_get(const StringName &p_name, Variant &r_ret) const {
+ return false;
+}
+
+void PhysicalBone::JointData::_get_property_list(List<PropertyInfo> *p_list) const {
+}
+
+bool PhysicalBone::PinJointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
+ if (JointData::_set(p_name, p_value, j)) {
+ return true;
+ }
+
+ if ("joint_constraints/bias" == p_name) {
+ bias = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PIN_JOINT_BIAS, bias);
+
+ } else if ("joint_constraints/damping" == p_name) {
+ damping = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PIN_JOINT_DAMPING, damping);
+
+ } else if ("joint_constraints/impulse_clamp" == p_name) {
+ impulse_clamp = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PIN_JOINT_IMPULSE_CLAMP, impulse_clamp);
+
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool PhysicalBone::PinJointData::_get(const StringName &p_name, Variant &r_ret) const {
+ if (JointData::_get(p_name, r_ret)) {
+ return true;
+ }
+
+ if ("joint_constraints/bias" == p_name) {
+ r_ret = bias;
+ } else if ("joint_constraints/damping" == p_name) {
+ r_ret = damping;
+ } else if ("joint_constraints/impulse_clamp" == p_name) {
+ r_ret = impulse_clamp;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+void PhysicalBone::PinJointData::_get_property_list(List<PropertyInfo> *p_list) const {
+ JointData::_get_property_list(p_list);
+
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/bias", PROPERTY_HINT_RANGE, "0.01,0.99,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/damping", PROPERTY_HINT_RANGE, "0.01,8.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/impulse_clamp", PROPERTY_HINT_RANGE, "0.0,64.0,0.01"));
+}
+
+bool PhysicalBone::ConeJointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
+ if (JointData::_set(p_name, p_value, j)) {
+ return true;
+ }
+
+ if ("joint_constraints/swing_span" == p_name) {
+ swing_span = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN, swing_span);
+
+ } else if ("joint_constraints/twist_span" == p_name) {
+ twist_span = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN, twist_span);
+
+ } else if ("joint_constraints/bias" == p_name) {
+ bias = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_BIAS, bias);
+
+ } else if ("joint_constraints/softness" == p_name) {
+ softness = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_SOFTNESS, softness);
+
+ } else if ("joint_constraints/relaxation" == p_name) {
+ relaxation = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_RELAXATION, relaxation);
+
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool PhysicalBone::ConeJointData::_get(const StringName &p_name, Variant &r_ret) const {
+ if (JointData::_get(p_name, r_ret)) {
+ return true;
+ }
+
+ if ("joint_constraints/swing_span" == p_name) {
+ r_ret = Math::rad2deg(swing_span);
+ } else if ("joint_constraints/twist_span" == p_name) {
+ r_ret = Math::rad2deg(twist_span);
+ } else if ("joint_constraints/bias" == p_name) {
+ r_ret = bias;
+ } else if ("joint_constraints/softness" == p_name) {
+ r_ret = softness;
+ } else if ("joint_constraints/relaxation" == p_name) {
+ r_ret = relaxation;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+void PhysicalBone::ConeJointData::_get_property_list(List<PropertyInfo> *p_list) const {
+ JointData::_get_property_list(p_list);
+
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/swing_span", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/twist_span", PROPERTY_HINT_RANGE, "-40000,40000,0.1,or_lesser,or_greater"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/bias", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/relaxation", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+}
+
+bool PhysicalBone::HingeJointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
+ if (JointData::_set(p_name, p_value, j)) {
+ return true;
+ }
+
+ if ("joint_constraints/angular_limit_enabled" == p_name) {
+ angular_limit_enabled = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->hinge_joint_set_flag(j, PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT, angular_limit_enabled);
+
+ } else if ("joint_constraints/angular_limit_upper" == p_name) {
+ angular_limit_upper = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_UPPER, angular_limit_upper);
+
+ } else if ("joint_constraints/angular_limit_lower" == p_name) {
+ angular_limit_lower = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_LOWER, angular_limit_lower);
+
+ } else if ("joint_constraints/angular_limit_bias" == p_name) {
+ angular_limit_bias = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_BIAS, angular_limit_bias);
+
+ } else if ("joint_constraints/angular_limit_softness" == p_name) {
+ angular_limit_softness = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS, angular_limit_softness);
+
+ } else if ("joint_constraints/angular_limit_relaxation" == p_name) {
+ angular_limit_relaxation = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION, angular_limit_relaxation);
+
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool PhysicalBone::HingeJointData::_get(const StringName &p_name, Variant &r_ret) const {
+ if (JointData::_get(p_name, r_ret)) {
+ return true;
+ }
+
+ if ("joint_constraints/angular_limit_enabled" == p_name) {
+ r_ret = angular_limit_enabled;
+ } else if ("joint_constraints/angular_limit_upper" == p_name) {
+ r_ret = Math::rad2deg(angular_limit_upper);
+ } else if ("joint_constraints/angular_limit_lower" == p_name) {
+ r_ret = Math::rad2deg(angular_limit_lower);
+ } else if ("joint_constraints/angular_limit_bias" == p_name) {
+ r_ret = angular_limit_bias;
+ } else if ("joint_constraints/angular_limit_softness" == p_name) {
+ r_ret = angular_limit_softness;
+ } else if ("joint_constraints/angular_limit_relaxation" == p_name) {
+ r_ret = angular_limit_relaxation;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+void PhysicalBone::HingeJointData::_get_property_list(List<PropertyInfo> *p_list) const {
+ JointData::_get_property_list(p_list);
+
+ p_list->push_back(PropertyInfo(Variant::BOOL, "joint_constraints/angular_limit_enabled"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_upper", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_lower", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_bias", PROPERTY_HINT_RANGE, "0.01,0.99,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_softness", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_relaxation", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+}
+
+bool PhysicalBone::SliderJointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
+ if (JointData::_set(p_name, p_value, j)) {
+ return true;
+ }
+
+ if ("joint_constraints/linear_limit_upper" == p_name) {
+ linear_limit_upper = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER, linear_limit_upper);
+
+ } else if ("joint_constraints/linear_limit_lower" == p_name) {
+ linear_limit_lower = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER, linear_limit_lower);
+
+ } else if ("joint_constraints/linear_limit_softness" == p_name) {
+ linear_limit_softness = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS, linear_limit_softness);
+
+ } else if ("joint_constraints/linear_limit_restitution" == p_name) {
+ linear_limit_restitution = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION, linear_limit_restitution);
+
+ } else if ("joint_constraints/linear_limit_damping" == p_name) {
+ linear_limit_damping = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING, linear_limit_restitution);
+
+ } else if ("joint_constraints/angular_limit_upper" == p_name) {
+ angular_limit_upper = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, angular_limit_upper);
+
+ } else if ("joint_constraints/angular_limit_lower" == p_name) {
+ angular_limit_lower = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, angular_limit_lower);
+
+ } else if ("joint_constraints/angular_limit_softness" == p_name) {
+ angular_limit_softness = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, angular_limit_softness);
+
+ } else if ("joint_constraints/angular_limit_restitution" == p_name) {
+ angular_limit_restitution = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, angular_limit_softness);
+
+ } else if ("joint_constraints/angular_limit_damping" == p_name) {
+ angular_limit_damping = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING, angular_limit_damping);
+
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool PhysicalBone::SliderJointData::_get(const StringName &p_name, Variant &r_ret) const {
+ if (JointData::_get(p_name, r_ret)) {
+ return true;
+ }
+
+ if ("joint_constraints/linear_limit_upper" == p_name) {
+ r_ret = linear_limit_upper;
+ } else if ("joint_constraints/linear_limit_lower" == p_name) {
+ r_ret = linear_limit_lower;
+ } else if ("joint_constraints/linear_limit_softness" == p_name) {
+ r_ret = linear_limit_softness;
+ } else if ("joint_constraints/linear_limit_restitution" == p_name) {
+ r_ret = linear_limit_restitution;
+ } else if ("joint_constraints/linear_limit_damping" == p_name) {
+ r_ret = linear_limit_damping;
+ } else if ("joint_constraints/angular_limit_upper" == p_name) {
+ r_ret = Math::rad2deg(angular_limit_upper);
+ } else if ("joint_constraints/angular_limit_lower" == p_name) {
+ r_ret = Math::rad2deg(angular_limit_lower);
+ } else if ("joint_constraints/angular_limit_softness" == p_name) {
+ r_ret = angular_limit_softness;
+ } else if ("joint_constraints/angular_limit_restitution" == p_name) {
+ r_ret = angular_limit_restitution;
+ } else if ("joint_constraints/angular_limit_damping" == p_name) {
+ r_ret = angular_limit_damping;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+void PhysicalBone::SliderJointData::_get_property_list(List<PropertyInfo> *p_list) const {
+ JointData::_get_property_list(p_list);
+
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/linear_limit_upper"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/linear_limit_lower"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/linear_limit_softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/linear_limit_restitution", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/linear_limit_damping", PROPERTY_HINT_RANGE, "0,16.0,0.01"));
+
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_upper", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_lower", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_restitution", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/angular_limit_damping", PROPERTY_HINT_RANGE, "0,16.0,0.01"));
+}
+
+bool PhysicalBone::SixDOFJointData::_set(const StringName &p_name, const Variant &p_value, RID j) {
+ if (JointData::_set(p_name, p_value, j)) {
+ return true;
+ }
+
+ String path = p_name;
+
+ Vector3::Axis axis;
+ {
+ const String axis_s = path.get_slicec('/', 1);
+ if ("x" == axis_s) {
+ axis = Vector3::AXIS_X;
+ } else if ("y" == axis_s) {
+ axis = Vector3::AXIS_Y;
+ } else if ("z" == axis_s) {
+ axis = Vector3::AXIS_Z;
+ } else {
+ return false;
+ }
+ }
+
+ String var_name = path.get_slicec('/', 2);
+
+ if ("linear_limit_enabled" == var_name) {
+ axis_data[axis].linear_limit_enabled = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, axis_data[axis].linear_limit_enabled);
+
+ } else if ("linear_limit_upper" == var_name) {
+ axis_data[axis].linear_limit_upper = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT, axis_data[axis].linear_limit_upper);
+
+ } else if ("linear_limit_lower" == var_name) {
+ axis_data[axis].linear_limit_lower = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT, axis_data[axis].linear_limit_lower);
+
+ } else if ("linear_limit_softness" == var_name) {
+ axis_data[axis].linear_limit_softness = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, axis_data[axis].linear_limit_softness);
+
+ } else if ("linear_restitution" == var_name) {
+ axis_data[axis].linear_restitution = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION, axis_data[axis].linear_restitution);
+
+ } else if ("linear_damping" == var_name) {
+ axis_data[axis].linear_damping = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING, axis_data[axis].linear_damping);
+
+ } else if ("angular_limit_enabled" == var_name) {
+ axis_data[axis].angular_limit_enabled = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, axis_data[axis].angular_limit_enabled);
+
+ } else if ("angular_limit_upper" == var_name) {
+ axis_data[axis].angular_limit_upper = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, axis_data[axis].angular_limit_upper);
+
+ } else if ("angular_limit_lower" == var_name) {
+ axis_data[axis].angular_limit_lower = Math::deg2rad(real_t(p_value));
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, axis_data[axis].angular_limit_lower);
+
+ } else if ("angular_limit_softness" == var_name) {
+ axis_data[axis].angular_limit_softness = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, axis_data[axis].angular_limit_softness);
+
+ } else if ("angular_restitution" == var_name) {
+ axis_data[axis].angular_restitution = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION, axis_data[axis].angular_restitution);
+
+ } else if ("angular_damping" == var_name) {
+ axis_data[axis].angular_damping = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING, axis_data[axis].angular_damping);
+
+ } else if ("erp" == var_name) {
+ axis_data[axis].erp = p_value;
+ if (j.is_valid())
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_ERP, axis_data[axis].erp);
+
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+bool PhysicalBone::SixDOFJointData::_get(const StringName &p_name, Variant &r_ret) const {
+ if (JointData::_get(p_name, r_ret)) {
+ return true;
+ }
+
+ String path = p_name;
+
+ int axis;
+ {
+ const String axis_s = path.get_slicec('/', 1);
+ if ("x" == axis_s) {
+ axis = 0;
+ } else if ("y" == axis_s) {
+ axis = 1;
+ } else if ("z" == axis_s) {
+ axis = 2;
+ } else {
+ return false;
+ }
+ }
+
+ String var_name = path.get_slicec('/', 2);
+
+ if ("linear_limit_enabled" == var_name) {
+ r_ret = axis_data[axis].linear_limit_enabled;
+ } else if ("linear_limit_upper" == var_name) {
+ r_ret = axis_data[axis].linear_limit_upper;
+ } else if ("linear_limit_lower" == var_name) {
+ r_ret = axis_data[axis].linear_limit_lower;
+ } else if ("linear_limit_softness" == var_name) {
+ r_ret = axis_data[axis].linear_limit_softness;
+ } else if ("linear_restitution" == var_name) {
+ r_ret = axis_data[axis].linear_restitution;
+ } else if ("linear_damping" == var_name) {
+ r_ret = axis_data[axis].linear_damping;
+ } else if ("angular_limit_enabled" == var_name) {
+ r_ret = axis_data[axis].angular_limit_enabled;
+ } else if ("angular_limit_upper" == var_name) {
+ r_ret = Math::rad2deg(axis_data[axis].angular_limit_upper);
+ } else if ("angular_limit_lower" == var_name) {
+ r_ret = Math::rad2deg(axis_data[axis].angular_limit_lower);
+ } else if ("angular_limit_softness" == var_name) {
+ r_ret = axis_data[axis].angular_limit_softness;
+ } else if ("angular_restitution" == var_name) {
+ r_ret = axis_data[axis].angular_restitution;
+ } else if ("angular_damping" == var_name) {
+ r_ret = axis_data[axis].angular_damping;
+ } else if ("erp" == var_name) {
+ r_ret = axis_data[axis].erp;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
+void PhysicalBone::SixDOFJointData::_get_property_list(List<PropertyInfo> *p_list) const {
+ const StringName axis_names[] = { "x", "y", "z" };
+ for (int i = 0; i < 3; ++i) {
+ p_list->push_back(PropertyInfo(Variant::BOOL, "joint_constraints/" + axis_names[i] + "/linear_limit_enabled"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_limit_upper"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_limit_lower"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_limit_softness", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/linear_damping", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::BOOL, "joint_constraints/" + axis_names[i] + "/angular_limit_enabled"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_limit_upper", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_limit_lower", PROPERTY_HINT_RANGE, "-180,180,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_limit_softness", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/angular_damping", PROPERTY_HINT_RANGE, "0.01,16,0.01"));
+ p_list->push_back(PropertyInfo(Variant::REAL, "joint_constraints/" + axis_names[i] + "/erp"));
+ }
+}
+
+bool PhysicalBone::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "bone_name") {
+ set_bone_name(p_value);
+ return true;
+ }
+
+ if (joint_data) {
+ if (joint_data->_set(p_name, p_value)) {
+#ifdef TOOLS_ENABLED
+ if (get_gizmo().is_valid())
+ get_gizmo()->redraw();
+#endif
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool PhysicalBone::_get(const StringName &p_name, Variant &r_ret) const {
+ if (p_name == "bone_name") {
+ r_ret = get_bone_name();
+ return true;
+ }
+
+ if (joint_data) {
+ return joint_data->_get(p_name, r_ret);
+ }
+
+ return false;
+}
+
+void PhysicalBone::_get_property_list(List<PropertyInfo> *p_list) const {
+
+ Skeleton *parent = find_skeleton_parent(get_parent());
+
+ if (parent) {
+
+ String names;
+ for (int i = 0; i < parent->get_bone_count(); i++) {
+ if (i > 0)
+ names += ",";
+ names += parent->get_bone_name(i);
+ }
+
+ p_list->push_back(PropertyInfo(Variant::STRING, "bone_name", PROPERTY_HINT_ENUM, names));
+ } else {
+
+ p_list->push_back(PropertyInfo(Variant::STRING, "bone_name"));
+ }
+
+ if (joint_data) {
+ joint_data->_get_property_list(p_list);
+ }
+}
+
+void PhysicalBone::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ parent_skeleton = find_skeleton_parent(get_parent());
+ update_bone_id();
+ reset_to_rest_position();
+ _reset_physics_simulation_state();
+ break;
+ case NOTIFICATION_EXIT_TREE:
+ if (parent_skeleton) {
+ if (-1 != bone_id) {
+ parent_skeleton->unbind_physical_bone_from_bone(bone_id);
+ }
+ }
+ parent_skeleton = NULL;
+ update_bone_id();
+ break;
+ case NOTIFICATION_TRANSFORM_CHANGED:
+ if (Engine::get_singleton()->is_editor_hint()) {
+
+ update_offset();
+ }
+ break;
+ }
+}
+
+void PhysicalBone::_direct_state_changed(Object *p_state) {
+
+ if (!simulate_physics) {
+ return;
+ }
+
+ /// Update bone transform
+
+ PhysicsDirectBodyState *state;
+
+#ifdef DEBUG_ENABLED
+ state = Object::cast_to<PhysicsDirectBodyState>(p_state);
+#else
+ state = (PhysicsDirectBodyState *)p_state; //trust it
+#endif
+
+ Transform global_transform(state->get_transform());
+
+ set_ignore_transform_notification(true);
+ set_global_transform(global_transform);
+ set_ignore_transform_notification(false);
+
+ // Update skeleton
+ if (parent_skeleton) {
+ if (-1 != bone_id) {
+ parent_skeleton->set_bone_global_pose(bone_id, parent_skeleton->get_global_transform().affine_inverse() * (global_transform * body_offset_inverse));
+ }
+ }
+}
+
+void PhysicalBone::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_direct_state_changed"), &PhysicalBone::_direct_state_changed);
+
+ ClassDB::bind_method(D_METHOD("set_joint_type", "joint_type"), &PhysicalBone::set_joint_type);
+ ClassDB::bind_method(D_METHOD("get_joint_type"), &PhysicalBone::get_joint_type);
+
+ ClassDB::bind_method(D_METHOD("set_joint_offset", "offset"), &PhysicalBone::set_joint_offset);
+ ClassDB::bind_method(D_METHOD("get_joint_offset"), &PhysicalBone::get_joint_offset);
+
+ ClassDB::bind_method(D_METHOD("set_body_offset", "offset"), &PhysicalBone::set_body_offset);
+ ClassDB::bind_method(D_METHOD("get_body_offset"), &PhysicalBone::get_body_offset);
+
+ ClassDB::bind_method(D_METHOD("is_static_body"), &PhysicalBone::is_static_body);
+
+ ClassDB::bind_method(D_METHOD("get_simulate_physics"), &PhysicalBone::get_simulate_physics);
+
+ ClassDB::bind_method(D_METHOD("is_simulating_physics"), &PhysicalBone::is_simulating_physics);
+
+ ClassDB::bind_method(D_METHOD("set_mass", "mass"), &PhysicalBone::set_mass);
+ ClassDB::bind_method(D_METHOD("get_mass"), &PhysicalBone::get_mass);
+
+ ClassDB::bind_method(D_METHOD("set_weight", "weight"), &PhysicalBone::set_weight);
+ ClassDB::bind_method(D_METHOD("get_weight"), &PhysicalBone::get_weight);
+
+ ClassDB::bind_method(D_METHOD("set_friction", "friction"), &PhysicalBone::set_friction);
+ ClassDB::bind_method(D_METHOD("get_friction"), &PhysicalBone::get_friction);
+
+ ClassDB::bind_method(D_METHOD("set_bounce", "bounce"), &PhysicalBone::set_bounce);
+ ClassDB::bind_method(D_METHOD("get_bounce"), &PhysicalBone::get_bounce);
+
+ ClassDB::bind_method(D_METHOD("set_gravity_scale", "gravity_scale"), &PhysicalBone::set_gravity_scale);
+ ClassDB::bind_method(D_METHOD("get_gravity_scale"), &PhysicalBone::get_gravity_scale);
+
+ ADD_GROUP("Joint", "joint_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "joint_type", PROPERTY_HINT_ENUM, "None,PinJoint,ConeJoint,HingeJoint,SliderJoint,6DOFJoint"), "set_joint_type", "get_joint_type");
+ ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "joint_offset"), "set_joint_offset", "get_joint_offset");
+
+ ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "body_offset"), "set_body_offset", "get_body_offset");
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "weight", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_weight", "get_weight");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_bounce", "get_bounce");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "gravity_scale", PROPERTY_HINT_RANGE, "-10,10,0.01"), "set_gravity_scale", "get_gravity_scale");
+
+ BIND_ENUM_CONSTANT(JOINT_TYPE_NONE);
+ BIND_ENUM_CONSTANT(JOINT_TYPE_PIN);
+ BIND_ENUM_CONSTANT(JOINT_TYPE_CONE);
+ BIND_ENUM_CONSTANT(JOINT_TYPE_HINGE);
+ BIND_ENUM_CONSTANT(JOINT_TYPE_SLIDER);
+ BIND_ENUM_CONSTANT(JOINT_TYPE_6DOF);
+}
+
+Skeleton *PhysicalBone::find_skeleton_parent(Node *p_parent) {
+ if (!p_parent) {
+ return NULL;
+ }
+ Skeleton *s = Object::cast_to<Skeleton>(p_parent);
+ return s ? s : find_skeleton_parent(p_parent->get_parent());
+}
+
+void PhysicalBone::_fix_joint_offset() {
+ // Clamp joint origin to bone origin
+ if (parent_skeleton) {
+ joint_offset.origin = body_offset.affine_inverse().origin;
+ }
+}
+
+void PhysicalBone::_reload_joint() {
+
+ if (joint.is_valid()) {
+ PhysicsServer::get_singleton()->free(joint);
+ joint = RID();
+ }
+
+ if (!parent_skeleton) {
+ return;
+ }
+
+ PhysicalBone *body_a = parent_skeleton->get_physical_bone_parent(bone_id);
+ if (!body_a) {
+ return;
+ }
+
+ Transform joint_transf = get_global_transform() * joint_offset;
+ Transform local_a = body_a->get_global_transform().affine_inverse() * joint_transf;
+ local_a.orthonormalize();
+
+ switch (get_joint_type()) {
+ case JOINT_TYPE_PIN: {
+
+ joint = PhysicsServer::get_singleton()->joint_create_pin(body_a->get_rid(), local_a.origin, get_rid(), joint_offset.origin);
+ const PinJointData *pjd(static_cast<const PinJointData *>(joint_data));
+ PhysicsServer::get_singleton()->pin_joint_set_param(joint, PhysicsServer::PIN_JOINT_BIAS, pjd->bias);
+ PhysicsServer::get_singleton()->pin_joint_set_param(joint, PhysicsServer::PIN_JOINT_DAMPING, pjd->damping);
+ PhysicsServer::get_singleton()->pin_joint_set_param(joint, PhysicsServer::PIN_JOINT_IMPULSE_CLAMP, pjd->impulse_clamp);
+
+ } break;
+ case JOINT_TYPE_CONE: {
+
+ joint = PhysicsServer::get_singleton()->joint_create_cone_twist(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ const ConeJointData *cjd(static_cast<const ConeJointData *>(joint_data));
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN, cjd->swing_span);
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN, cjd->twist_span);
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_BIAS, cjd->bias);
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_SOFTNESS, cjd->softness);
+ PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_RELAXATION, cjd->relaxation);
+
+ } break;
+ case JOINT_TYPE_HINGE: {
+
+ joint = PhysicsServer::get_singleton()->joint_create_hinge(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ const HingeJointData *hjd(static_cast<const HingeJointData *>(joint_data));
+ PhysicsServer::get_singleton()->hinge_joint_set_flag(joint, PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT, hjd->angular_limit_enabled);
+ PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_UPPER, hjd->angular_limit_upper);
+ PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_LOWER, hjd->angular_limit_lower);
+ PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_BIAS, hjd->angular_limit_bias);
+ PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS, hjd->angular_limit_softness);
+ PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION, hjd->angular_limit_relaxation);
+
+ } break;
+ case JOINT_TYPE_SLIDER: {
+
+ joint = PhysicsServer::get_singleton()->joint_create_slider(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ const SliderJointData *sjd(static_cast<const SliderJointData *>(joint_data));
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER, sjd->linear_limit_upper);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER, sjd->linear_limit_lower);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS, sjd->linear_limit_softness);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION, sjd->linear_limit_restitution);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING, sjd->linear_limit_restitution);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, sjd->angular_limit_upper);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, sjd->angular_limit_lower);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, sjd->angular_limit_softness);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, sjd->angular_limit_softness);
+ PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING, sjd->angular_limit_damping);
+
+ } break;
+ case JOINT_TYPE_6DOF: {
+
+ joint = PhysicsServer::get_singleton()->joint_create_generic_6dof(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ const SixDOFJointData *g6dofjd(static_cast<const SixDOFJointData *>(joint_data));
+ for (int axis = 0; axis < 3; ++axis) {
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, g6dofjd->axis_data[axis].linear_limit_enabled);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT, g6dofjd->axis_data[axis].linear_limit_upper);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT, g6dofjd->axis_data[axis].linear_limit_lower);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].linear_limit_softness);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION, g6dofjd->axis_data[axis].linear_restitution);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING, g6dofjd->axis_data[axis].linear_damping);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, g6dofjd->axis_data[axis].angular_limit_enabled);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, g6dofjd->axis_data[axis].angular_limit_upper);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, g6dofjd->axis_data[axis].angular_limit_lower);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].angular_limit_softness);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION, g6dofjd->axis_data[axis].angular_restitution);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING, g6dofjd->axis_data[axis].angular_damping);
+ PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_ERP, g6dofjd->axis_data[axis].erp);
+ }
+
+ } break;
+ }
+}
+
+void PhysicalBone::_on_bone_parent_changed() {
+ _reload_joint();
+}
+
+void PhysicalBone::_set_gizmo_move_joint(bool p_move_joint) {
+#ifdef TOOLS_ENABLED
+ gizmo_move_joint = p_move_joint;
+ SpatialEditor::get_singleton()->update_transform_gizmo();
+#endif
+}
+
+#ifdef TOOLS_ENABLED
+Transform PhysicalBone::get_global_gizmo_transform() const {
+ return gizmo_move_joint ? get_global_transform() * joint_offset : get_global_transform();
+}
+
+Transform PhysicalBone::get_local_gizmo_transform() const {
+ return gizmo_move_joint ? get_transform() * joint_offset : get_transform();
+}
+#endif
+
+const PhysicalBone::JointData *PhysicalBone::get_joint_data() const {
+ return joint_data;
+}
+
+Skeleton *PhysicalBone::find_skeleton_parent() {
+ return find_skeleton_parent(this);
+}
+
+void PhysicalBone::set_joint_type(JointType p_joint_type) {
+
+ if (p_joint_type == get_joint_type())
+ return;
+
+ memdelete(joint_data);
+ joint_data = NULL;
+ switch (p_joint_type) {
+ case JOINT_TYPE_PIN:
+ joint_data = memnew(PinJointData);
+ break;
+ case JOINT_TYPE_CONE:
+ joint_data = memnew(ConeJointData);
+ break;
+ case JOINT_TYPE_HINGE:
+ joint_data = memnew(HingeJointData);
+ break;
+ case JOINT_TYPE_SLIDER:
+ joint_data = memnew(SliderJointData);
+ break;
+ case JOINT_TYPE_6DOF:
+ joint_data = memnew(SixDOFJointData);
+ break;
+ }
+
+ _reload_joint();
+
+#ifdef TOOLS_ENABLED
+ _change_notify();
+ if (get_gizmo().is_valid())
+ get_gizmo()->redraw();
+#endif
+}
+
+PhysicalBone::JointType PhysicalBone::get_joint_type() const {
+ return joint_data ? joint_data->get_joint_type() : JOINT_TYPE_NONE;
+}
+
+void PhysicalBone::set_joint_offset(const Transform &p_offset) {
+ joint_offset = p_offset;
+
+ _fix_joint_offset();
+
+ set_ignore_transform_notification(true);
+ reset_to_rest_position();
+ set_ignore_transform_notification(false);
+
+#ifdef TOOLS_ENABLED
+ if (get_gizmo().is_valid())
+ get_gizmo()->redraw();
+#endif
+}
+
+const Transform &PhysicalBone::get_body_offset() const {
+ return body_offset;
+}
+
+void PhysicalBone::set_body_offset(const Transform &p_offset) {
+ body_offset = p_offset;
+ body_offset_inverse = body_offset.affine_inverse();
+
+ _fix_joint_offset();
+
+ set_ignore_transform_notification(true);
+ reset_to_rest_position();
+ set_ignore_transform_notification(false);
+
+#ifdef TOOLS_ENABLED
+ if (get_gizmo().is_valid())
+ get_gizmo()->redraw();
+#endif
+}
+
+const Transform &PhysicalBone::get_joint_offset() const {
+ return joint_offset;
+}
+
+void PhysicalBone::set_static_body(bool p_static) {
+
+ static_body = p_static;
+
+ set_as_toplevel(!static_body);
+
+ _reset_physics_simulation_state();
+}
+
+bool PhysicalBone::is_static_body() {
+ return static_body;
+}
+
+void PhysicalBone::set_simulate_physics(bool p_simulate) {
+ if (simulate_physics == p_simulate) {
+ return;
+ }
+
+ simulate_physics = p_simulate;
+ _reset_physics_simulation_state();
+}
+
+bool PhysicalBone::get_simulate_physics() {
+ return simulate_physics;
+}
+
+bool PhysicalBone::is_simulating_physics() {
+ return _internal_simulate_physics && !_internal_static_body;
+}
+
+void PhysicalBone::set_bone_name(const String &p_name) {
+
+ bone_name = p_name;
+ bone_id = -1;
+
+ update_bone_id();
+ reset_to_rest_position();
+}
+
+const String &PhysicalBone::get_bone_name() const {
+
+ return bone_name;
+}
+
+void PhysicalBone::set_mass(real_t p_mass) {
+
+ ERR_FAIL_COND(p_mass <= 0);
+ mass = p_mass;
+ PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_MASS, mass);
+}
+
+real_t PhysicalBone::get_mass() const {
+
+ return mass;
+}
+
+void PhysicalBone::set_weight(real_t p_weight) {
+
+ set_mass(p_weight / real_t(GLOBAL_DEF("physics/3d/default_gravity", 9.8)));
+}
+
+real_t PhysicalBone::get_weight() const {
+
+ return mass * real_t(GLOBAL_DEF("physics/3d/default_gravity", 9.8));
+}
+
+void PhysicalBone::set_friction(real_t p_friction) {
+
+ ERR_FAIL_COND(p_friction < 0 || p_friction > 1);
+
+ friction = p_friction;
+ PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, friction);
+}
+
+real_t PhysicalBone::get_friction() const {
+
+ return friction;
+}
+
+void PhysicalBone::set_bounce(real_t p_bounce) {
+
+ ERR_FAIL_COND(p_bounce < 0 || p_bounce > 1);
+
+ bounce = p_bounce;
+ PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_BOUNCE, bounce);
+}
+real_t PhysicalBone::get_bounce() const {
+
+ return bounce;
+}
+
+void PhysicalBone::set_gravity_scale(real_t p_gravity_scale) {
+
+ gravity_scale = p_gravity_scale;
+ PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_GRAVITY_SCALE, gravity_scale);
+}
+
+real_t PhysicalBone::get_gravity_scale() const {
+
+ return gravity_scale;
+}
+
+PhysicalBone::PhysicalBone() :
+ PhysicsBody(PhysicsServer::BODY_MODE_STATIC),
+#ifdef TOOLS_ENABLED
+ gizmo_move_joint(false),
+#endif
+ joint_data(NULL),
+ static_body(false),
+ simulate_physics(false),
+ _internal_static_body(false),
+ _internal_simulate_physics(false),
+ bone_id(-1),
+ parent_skeleton(NULL),
+ bone_name(""),
+ bounce(0),
+ mass(1),
+ friction(1),
+ gravity_scale(1) {
+
+ set_static_body(static_body);
+ _reset_physics_simulation_state();
+}
+
+PhysicalBone::~PhysicalBone() {
+ memdelete(joint_data);
+}
+
+void PhysicalBone::update_bone_id() {
+ if (!parent_skeleton) {
+ return;
+ }
+
+ const int new_bone_id = parent_skeleton->find_bone(bone_name);
+
+ if (new_bone_id != bone_id) {
+ if (-1 != bone_id) {
+ // Assert the unbind from old node
+ parent_skeleton->unbind_physical_bone_from_bone(bone_id);
+ parent_skeleton->unbind_child_node_from_bone(bone_id, this);
+ }
+
+ bone_id = new_bone_id;
+
+ parent_skeleton->bind_physical_bone_to_bone(bone_id, this);
+
+ _fix_joint_offset();
+ _internal_static_body = !static_body; // Force staticness reset
+ _reset_staticness_state();
+ }
+}
+
+void PhysicalBone::update_offset() {
+#ifdef TOOLS_ENABLED
+ if (parent_skeleton) {
+
+ Transform bone_transform(parent_skeleton->get_global_transform());
+ if (-1 != bone_id)
+ bone_transform *= parent_skeleton->get_bone_global_pose(bone_id);
+
+ if (gizmo_move_joint) {
+ bone_transform *= body_offset;
+ set_joint_offset(bone_transform.affine_inverse() * get_global_transform());
+ } else {
+ set_body_offset(bone_transform.affine_inverse() * get_global_transform());
+ }
+ }
+#endif
+}
+
+void PhysicalBone::reset_to_rest_position() {
+ if (parent_skeleton) {
+ if (-1 == bone_id) {
+ set_global_transform(parent_skeleton->get_global_transform() * body_offset);
+ } else {
+ set_global_transform(parent_skeleton->get_global_transform() * parent_skeleton->get_bone_global_pose(bone_id) * body_offset);
+ }
+ }
+}
+
+void PhysicalBone::_reset_physics_simulation_state() {
+ if (simulate_physics && !static_body) {
+ _start_physics_simulation();
+ } else {
+ _stop_physics_simulation();
+ }
+
+ _reset_staticness_state();
+}
+
+void PhysicalBone::_reset_staticness_state() {
+
+ if (parent_skeleton && -1 != bone_id) {
+ if (static_body && simulate_physics) { // With this check I'm sure the position of this body is updated only when it's necessary
+
+ if (_internal_static_body) {
+ return;
+ }
+
+ parent_skeleton->bind_child_node_to_bone(bone_id, this);
+ _internal_static_body = true;
+ } else {
+
+ if (!_internal_static_body) {
+ return;
+ }
+
+ parent_skeleton->unbind_child_node_from_bone(bone_id, this);
+ _internal_static_body = false;
+ }
+ }
+}
+
+void PhysicalBone::_start_physics_simulation() {
+ if (_internal_simulate_physics || !parent_skeleton) {
+ return;
+ }
+ reset_to_rest_position();
+ PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_RIGID);
+ PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer());
+ PhysicsServer::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask());
+ PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
+ parent_skeleton->set_bone_ignore_animation(bone_id, true);
+ _internal_simulate_physics = true;
+}
+
+void PhysicalBone::_stop_physics_simulation() {
+ if (!_internal_simulate_physics || !parent_skeleton) {
+ return;
+ }
+ PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_STATIC);
+ PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), 0);
+ PhysicsServer::get_singleton()->body_set_collision_mask(get_rid(), 0);
+ PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, "");
+ parent_skeleton->set_bone_ignore_animation(bone_id, false);
+ _internal_simulate_physics = false;
+}
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index ffdc9ab309..0190dcbfc3 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -33,6 +33,7 @@
#include "scene/3d/collision_object.h"
#include "servers/physics_server.h"
+#include "skeleton.h"
#include "vset.h"
class PhysicsBody : public CollisionObject {
@@ -302,7 +303,7 @@ public:
void set_safe_margin(float p_margin);
float get_safe_margin() const;
- Vector3 move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction = Vector3(0, 0, 0), bool p_infinite_inertia = true, float p_slope_stop_min_velocity = 0.05, int p_max_slides = 4, float p_floor_max_angle = Math::deg2rad((float)45));
+ Vector3 move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction = Vector3(0, 0, 0), float p_slope_stop_min_velocity = 0.05, int p_max_slides = 4, float p_floor_max_angle = Math::deg2rad((float)45), bool p_infinite_inertia = true);
bool is_on_floor() const;
bool is_on_wall() const;
bool is_on_ceiling() const;
@@ -342,4 +343,267 @@ public:
KinematicCollision();
};
+class PhysicalBone : public PhysicsBody {
+
+ GDCLASS(PhysicalBone, PhysicsBody);
+
+public:
+ enum JointType {
+ JOINT_TYPE_NONE,
+ JOINT_TYPE_PIN,
+ JOINT_TYPE_CONE,
+ JOINT_TYPE_HINGE,
+ JOINT_TYPE_SLIDER,
+ JOINT_TYPE_6DOF
+ };
+
+ struct JointData {
+ virtual JointType get_joint_type() { return JOINT_TYPE_NONE; }
+
+ /// "j" is used to set the parameter inside the PhysicsServer
+ virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
+ virtual bool _get(const StringName &p_name, Variant &r_ret) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+ };
+
+ struct PinJointData : public JointData {
+ virtual JointType get_joint_type() { return JOINT_TYPE_PIN; }
+
+ virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
+ virtual bool _get(const StringName &p_name, Variant &r_ret) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ real_t bias;
+ real_t damping;
+ real_t impulse_clamp;
+
+ PinJointData() :
+ bias(0.3),
+ damping(1.),
+ impulse_clamp(0) {}
+ };
+
+ struct ConeJointData : public JointData {
+ virtual JointType get_joint_type() { return JOINT_TYPE_CONE; }
+
+ virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
+ virtual bool _get(const StringName &p_name, Variant &r_ret) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ real_t swing_span;
+ real_t twist_span;
+ real_t bias;
+ real_t softness;
+ real_t relaxation;
+
+ ConeJointData() :
+ swing_span(Math_PI * 0.25),
+ twist_span(Math_PI),
+ bias(0.3),
+ softness(0.8),
+ relaxation(1.) {}
+ };
+
+ struct HingeJointData : public JointData {
+ virtual JointType get_joint_type() { return JOINT_TYPE_HINGE; }
+
+ virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
+ virtual bool _get(const StringName &p_name, Variant &r_ret) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ bool angular_limit_enabled;
+ real_t angular_limit_upper;
+ real_t angular_limit_lower;
+ real_t angular_limit_bias;
+ real_t angular_limit_softness;
+ real_t angular_limit_relaxation;
+
+ HingeJointData() :
+ angular_limit_enabled(false),
+ angular_limit_upper(Math_PI * 0.5),
+ angular_limit_lower(-Math_PI * 0.5),
+ angular_limit_bias(0.3),
+ angular_limit_softness(0.9),
+ angular_limit_relaxation(1.) {}
+ };
+
+ struct SliderJointData : public JointData {
+ virtual JointType get_joint_type() { return JOINT_TYPE_SLIDER; }
+
+ virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
+ virtual bool _get(const StringName &p_name, Variant &r_ret) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ real_t linear_limit_upper;
+ real_t linear_limit_lower;
+ real_t linear_limit_softness;
+ real_t linear_limit_restitution;
+ real_t linear_limit_damping;
+ real_t angular_limit_upper;
+ real_t angular_limit_lower;
+ real_t angular_limit_softness;
+ real_t angular_limit_restitution;
+ real_t angular_limit_damping;
+
+ SliderJointData() :
+ linear_limit_upper(1.),
+ linear_limit_lower(-1.),
+ linear_limit_softness(1.),
+ linear_limit_restitution(0.7),
+ linear_limit_damping(1.),
+ angular_limit_upper(0),
+ angular_limit_lower(0),
+ angular_limit_softness(1.),
+ angular_limit_restitution(0.7),
+ angular_limit_damping(1.) {}
+ };
+
+ struct SixDOFJointData : public JointData {
+ struct SixDOFAxisData {
+ bool linear_limit_enabled;
+ real_t linear_limit_upper;
+ real_t linear_limit_lower;
+ real_t linear_limit_softness;
+ real_t linear_restitution;
+ real_t linear_damping;
+ bool angular_limit_enabled;
+ real_t angular_limit_upper;
+ real_t angular_limit_lower;
+ real_t angular_limit_softness;
+ real_t angular_restitution;
+ real_t angular_damping;
+ real_t erp;
+
+ SixDOFAxisData() :
+ linear_limit_enabled(true),
+ linear_limit_upper(0),
+ linear_limit_lower(0),
+ linear_limit_softness(0.7),
+ linear_restitution(0.5),
+ linear_damping(1.),
+ angular_limit_enabled(true),
+ angular_limit_upper(0),
+ angular_limit_lower(0),
+ angular_limit_softness(0.5),
+ angular_restitution(0),
+ angular_damping(1.),
+ erp(0.5) {}
+ };
+
+ virtual JointType get_joint_type() { return JOINT_TYPE_6DOF; }
+
+ virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
+ virtual bool _get(const StringName &p_name, Variant &r_ret) const;
+ virtual void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ SixDOFAxisData axis_data[3];
+
+ SixDOFJointData() {}
+ };
+
+private:
+#ifdef TOOLS_ENABLED
+ // if false gizmo move body
+ bool gizmo_move_joint;
+#endif
+
+ JointData *joint_data;
+ Transform joint_offset;
+ RID joint;
+
+ Skeleton *parent_skeleton;
+ Transform body_offset;
+ Transform body_offset_inverse;
+ bool static_body;
+ bool _internal_static_body;
+ bool simulate_physics;
+ bool _internal_simulate_physics;
+ int bone_id;
+
+ String bone_name;
+ real_t bounce;
+ real_t mass;
+ real_t friction;
+ real_t gravity_scale;
+
+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 _notification(int p_what);
+ void _direct_state_changed(Object *p_state);
+
+ static void _bind_methods();
+
+private:
+ static Skeleton *find_skeleton_parent(Node *p_parent);
+ void _fix_joint_offset();
+ void _reload_joint();
+
+public:
+ void _on_bone_parent_changed();
+ void _set_gizmo_move_joint(bool p_move_joint);
+
+public:
+#ifdef TOOLS_ENABLED
+ virtual Transform get_global_gizmo_transform() const;
+ virtual Transform get_local_gizmo_transform() const;
+#endif
+
+ const JointData *get_joint_data() const;
+ Skeleton *find_skeleton_parent();
+
+ int get_bone_id() const { return bone_id; }
+
+ void set_joint_type(JointType p_joint_type);
+ JointType get_joint_type() const;
+
+ void set_joint_offset(const Transform &p_offset);
+ const Transform &get_joint_offset() const;
+
+ void set_body_offset(const Transform &p_offset);
+ const Transform &get_body_offset() const;
+
+ void set_static_body(bool p_static);
+ bool is_static_body();
+
+ void set_simulate_physics(bool p_simulate);
+ bool get_simulate_physics();
+ bool is_simulating_physics();
+
+ void set_bone_name(const String &p_name);
+ const String &get_bone_name() const;
+
+ void set_mass(real_t p_mass);
+ real_t get_mass() const;
+
+ void set_weight(real_t p_weight);
+ real_t get_weight() const;
+
+ void set_friction(real_t p_friction);
+ real_t get_friction() const;
+
+ void set_bounce(real_t p_bounce);
+ real_t get_bounce() const;
+
+ void set_gravity_scale(real_t p_gravity_scale);
+ real_t get_gravity_scale() const;
+
+ PhysicalBone();
+ ~PhysicalBone();
+
+private:
+ void update_bone_id();
+ void update_offset();
+ void reset_to_rest_position();
+
+ void _reset_physics_simulation_state();
+ void _reset_staticness_state();
+
+ void _start_physics_simulation();
+ void _stop_physics_simulation();
+};
+
+VARIANT_ENUM_CAST(PhysicalBone::JointType);
+
#endif // PHYSICS_BODY__H
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index 2e9f1a241a..7988c43eab 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -154,8 +154,8 @@ void Joint::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_exclude_nodes_from_collision", "enable"), &Joint::set_exclude_nodes_from_collision);
ClassDB::bind_method(D_METHOD("get_exclude_nodes_from_collision"), &Joint::get_exclude_nodes_from_collision);
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "nodes/node_a"), "set_node_a", "get_node_a");
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "nodes/node_b"), "set_node_b", "get_node_b");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "nodes/node_a", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "CollisionObject"), "set_node_a", "get_node_a");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "nodes/node_b", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "CollisionObject"), "set_node_b", "get_node_b");
ADD_PROPERTY(PropertyInfo(Variant::INT, "solver/priority", PROPERTY_HINT_RANGE, "1,8,1"), "set_solver_priority", "get_solver_priority");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collision/exclude_nodes"), "set_exclude_nodes_from_collision", "get_exclude_nodes_from_collision");
@@ -260,7 +260,7 @@ void HingeJoint::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_lower_limit", "lower_limit"), &HingeJoint::_set_lower_limit);
ClassDB::bind_method(D_METHOD("_get_lower_limit"), &HingeJoint::_get_lower_limit);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/bias", PROPERTY_HINT_RANGE, "0.01,0.99,0.01"), "set_param", "get_param", PARAM_BIAS);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/bias", PROPERTY_HINT_RANGE, "0.00,0.99,0.01"), "set_param", "get_param", PARAM_BIAS);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "angular_limit/enable"), "set_flag", "get_flag", FLAG_USE_LIMIT);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit/upper", PROPERTY_HINT_RANGE, "-180,180,0.1"), "_set_upper_limit", "_get_upper_limit");
@@ -270,7 +270,7 @@ void HingeJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_limit/relaxation", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param", "get_param", PARAM_LIMIT_RELAXATION);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "motor/enable"), "set_flag", "get_flag", FLAG_ENABLE_MOTOR);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/target_velocity", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_param", "get_param", PARAM_MOTOR_TARGET_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/target_velocity", PROPERTY_HINT_RANGE, "-200,200,0.01,or_greater,or_lesser"), "set_param", "get_param", PARAM_MOTOR_TARGET_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/max_impulse", PROPERTY_HINT_RANGE, "0.01,1024,0.01"), "set_param", "get_param", PARAM_MOTOR_MAX_IMPULSE);
BIND_ENUM_CONSTANT(PARAM_BIAS);
@@ -716,6 +716,9 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_x/softness", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_x", "get_param_x", PARAM_LINEAR_LIMIT_SOFTNESS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_x/restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_x", "get_param_x", PARAM_LINEAR_RESTITUTION);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_x/damping", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_x", "get_param_x", PARAM_LINEAR_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "linear_motor_x/enabled"), "set_flag_x", "get_flag_x", FLAG_ENABLE_LINEAR_MOTOR);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_x/target_velocity"), "set_param_x", "get_param_x", PARAM_LINEAR_MOTOR_TARGET_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_x/force_limit"), "set_param_x", "get_param_x", PARAM_LINEAR_MOTOR_FORCE_LIMIT);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "angular_limit_x/enabled"), "set_flag_x", "get_flag_x", FLAG_ENABLE_ANGULAR_LIMIT);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit_x/upper_angle", PROPERTY_HINT_RANGE, "-180,180,0.01"), "_set_angular_hi_limit_x", "_get_angular_hi_limit_x");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit_x/lower_angle", PROPERTY_HINT_RANGE, "-180,180,0.01"), "_set_angular_lo_limit_x", "_get_angular_lo_limit_x");
@@ -734,6 +737,9 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_y/softness", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_y", "get_param_y", PARAM_LINEAR_LIMIT_SOFTNESS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_y/restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_y", "get_param_y", PARAM_LINEAR_RESTITUTION);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_y/damping", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_y", "get_param_y", PARAM_LINEAR_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "linear_motor_y/enabled"), "set_flag_y", "get_flag_y", FLAG_ENABLE_LINEAR_MOTOR);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_y/target_velocity"), "set_param_y", "get_param_y", PARAM_LINEAR_MOTOR_TARGET_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_y/force_limit"), "set_param_y", "get_param_y", PARAM_LINEAR_MOTOR_FORCE_LIMIT);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "angular_limit_y/enabled"), "set_flag_y", "get_flag_y", FLAG_ENABLE_ANGULAR_LIMIT);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit_y/upper_angle", PROPERTY_HINT_RANGE, "-180,180,0.01"), "_set_angular_hi_limit_y", "_get_angular_hi_limit_y");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit_y/lower_angle", PROPERTY_HINT_RANGE, "-180,180,0.01"), "_set_angular_lo_limit_y", "_get_angular_lo_limit_y");
@@ -752,6 +758,9 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_z/softness", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_z", "get_param_z", PARAM_LINEAR_LIMIT_SOFTNESS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_z/restitution", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_z", "get_param_z", PARAM_LINEAR_RESTITUTION);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_limit_z/damping", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_param_z", "get_param_z", PARAM_LINEAR_DAMPING);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "linear_motor_z/enabled"), "set_flag_z", "get_flag_z", FLAG_ENABLE_LINEAR_MOTOR);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_z/target_velocity"), "set_param_z", "get_param_z", PARAM_LINEAR_MOTOR_TARGET_VELOCITY);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "linear_motor_z/force_limit"), "set_param_z", "get_param_z", PARAM_LINEAR_MOTOR_FORCE_LIMIT);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "angular_limit_z/enabled"), "set_flag_z", "get_flag_z", FLAG_ENABLE_ANGULAR_LIMIT);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit_z/upper_angle", PROPERTY_HINT_RANGE, "-180,180,0.01"), "_set_angular_hi_limit_z", "_get_angular_hi_limit_z");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "angular_limit_z/lower_angle", PROPERTY_HINT_RANGE, "-180,180,0.01"), "_set_angular_lo_limit_z", "_get_angular_lo_limit_z");
@@ -769,6 +778,8 @@ void Generic6DOFJoint::_bind_methods() {
BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
BIND_ENUM_CONSTANT(PARAM_LINEAR_RESTITUTION);
BIND_ENUM_CONSTANT(PARAM_LINEAR_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTOR_TARGET_VELOCITY);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTOR_FORCE_LIMIT);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT);
BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS);
@@ -783,6 +794,7 @@ void Generic6DOFJoint::_bind_methods() {
BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT);
BIND_ENUM_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT);
BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR);
+ BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_MOTOR);
BIND_ENUM_CONSTANT(FLAG_MAX);
}
@@ -912,6 +924,8 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_param_x(PARAM_LINEAR_LIMIT_SOFTNESS, 0.7);
set_param_x(PARAM_LINEAR_RESTITUTION, 0.5);
set_param_x(PARAM_LINEAR_DAMPING, 1.0);
+ set_param_x(PARAM_LINEAR_MOTOR_TARGET_VELOCITY, 0);
+ set_param_x(PARAM_LINEAR_MOTOR_FORCE_LIMIT, 0);
set_param_x(PARAM_ANGULAR_LOWER_LIMIT, 0);
set_param_x(PARAM_ANGULAR_UPPER_LIMIT, 0);
set_param_x(PARAM_ANGULAR_LIMIT_SOFTNESS, 0.5f);
@@ -925,12 +939,15 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_x(FLAG_ENABLE_ANGULAR_LIMIT, true);
set_flag_x(FLAG_ENABLE_LINEAR_LIMIT, true);
set_flag_x(FLAG_ENABLE_MOTOR, false);
+ set_flag_x(FLAG_ENABLE_LINEAR_MOTOR, false);
set_param_y(PARAM_LINEAR_LOWER_LIMIT, 0);
set_param_y(PARAM_LINEAR_UPPER_LIMIT, 0);
set_param_y(PARAM_LINEAR_LIMIT_SOFTNESS, 0.7);
set_param_y(PARAM_LINEAR_RESTITUTION, 0.5);
set_param_y(PARAM_LINEAR_DAMPING, 1.0);
+ set_param_y(PARAM_LINEAR_MOTOR_TARGET_VELOCITY, 0);
+ set_param_y(PARAM_LINEAR_MOTOR_FORCE_LIMIT, 0);
set_param_y(PARAM_ANGULAR_LOWER_LIMIT, 0);
set_param_y(PARAM_ANGULAR_UPPER_LIMIT, 0);
set_param_y(PARAM_ANGULAR_LIMIT_SOFTNESS, 0.5f);
@@ -944,12 +961,15 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_y(FLAG_ENABLE_ANGULAR_LIMIT, true);
set_flag_y(FLAG_ENABLE_LINEAR_LIMIT, true);
set_flag_y(FLAG_ENABLE_MOTOR, false);
+ set_flag_y(FLAG_ENABLE_LINEAR_MOTOR, false);
set_param_z(PARAM_LINEAR_LOWER_LIMIT, 0);
set_param_z(PARAM_LINEAR_UPPER_LIMIT, 0);
set_param_z(PARAM_LINEAR_LIMIT_SOFTNESS, 0.7);
set_param_z(PARAM_LINEAR_RESTITUTION, 0.5);
set_param_z(PARAM_LINEAR_DAMPING, 1.0);
+ set_param_z(PARAM_LINEAR_MOTOR_TARGET_VELOCITY, 0);
+ set_param_z(PARAM_LINEAR_MOTOR_FORCE_LIMIT, 0);
set_param_z(PARAM_ANGULAR_LOWER_LIMIT, 0);
set_param_z(PARAM_ANGULAR_UPPER_LIMIT, 0);
set_param_z(PARAM_ANGULAR_LIMIT_SOFTNESS, 0.5f);
@@ -963,4 +983,5 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_z(FLAG_ENABLE_ANGULAR_LIMIT, true);
set_flag_z(FLAG_ENABLE_LINEAR_LIMIT, true);
set_flag_z(FLAG_ENABLE_MOTOR, false);
+ set_flag_z(FLAG_ENABLE_LINEAR_MOTOR, false);
}
diff --git a/scene/3d/physics_joint.h b/scene/3d/physics_joint.h
index 000109ac55..37870d6f30 100644
--- a/scene/3d/physics_joint.h
+++ b/scene/3d/physics_joint.h
@@ -249,6 +249,8 @@ public:
PARAM_LINEAR_LIMIT_SOFTNESS = PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS,
PARAM_LINEAR_RESTITUTION = PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION,
PARAM_LINEAR_DAMPING = PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING,
+ PARAM_LINEAR_MOTOR_TARGET_VELOCITY = PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY,
+ PARAM_LINEAR_MOTOR_FORCE_LIMIT = PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT,
PARAM_ANGULAR_LOWER_LIMIT = PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT,
PARAM_ANGULAR_UPPER_LIMIT = PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT,
PARAM_ANGULAR_LIMIT_SOFTNESS = PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS,
@@ -265,6 +267,7 @@ public:
FLAG_ENABLE_LINEAR_LIMIT = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT,
FLAG_ENABLE_ANGULAR_LIMIT = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT,
FLAG_ENABLE_MOTOR = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR,
+ FLAG_ENABLE_LINEAR_MOTOR = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR,
FLAG_MAX = PhysicsServer::G6DOF_JOINT_FLAG_MAX
};
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index dd5ae8a999..7f83e2c3ea 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -103,7 +103,7 @@ void RayCast::set_enabled(bool p_enabled) {
enabled = p_enabled;
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
- set_physics_process(p_enabled);
+ set_physics_process_internal(p_enabled);
if (!p_enabled)
collided = false;
@@ -150,12 +150,12 @@ void RayCast::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
if (enabled && !Engine::get_singleton()->is_editor_hint()) {
- set_physics_process(true);
+ set_physics_process_internal(true);
if (get_tree()->is_debugging_collisions_hint())
_update_debug_shape();
} else
- set_physics_process(false);
+ set_physics_process_internal(false);
if (Object::cast_to<CollisionObject>(get_parent())) {
if (exclude_parent_body)
@@ -168,14 +168,14 @@ void RayCast::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
if (enabled) {
- set_physics_process(false);
+ set_physics_process_internal(false);
}
if (debug_shape)
_clear_debug_shape();
} break;
- case NOTIFICATION_PHYSICS_PROCESS: {
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (!enabled)
break;
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 2178da02b5..4d50945062 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -240,9 +240,9 @@ void ReflectionProbe::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "Once,Always"), "set_update_mode", "get_update_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "intensity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_intensity", "get_intensity");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_RANGE, "0,16384,0.1"), "set_max_distance", "get_max_distance");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "extents"), "set_extents", "get_extents");
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "origin_offset"), "set_origin_offset", "get_origin_offset");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_distance", PROPERTY_HINT_EXP_RANGE, "0,16384,0.1,or_greater"), "set_max_distance", "get_max_distance");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents"), "set_extents", "get_extents");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "origin_offset"), "set_origin_offset", "get_origin_offset");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "box_projection"), "set_enable_box_projection", "is_box_projection_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enable_shadows"), "set_enable_shadows", "are_shadows_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_cull_mask", "get_cull_mask");
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp
index afb85f7314..2156e24cd0 100644
--- a/scene/3d/remote_transform.cpp
+++ b/scene/3d/remote_transform.cpp
@@ -194,7 +194,7 @@ void RemoteTransform::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_update_scale", "update_remote_scale"), &RemoteTransform::set_update_scale);
ClassDB::bind_method(D_METHOD("get_update_scale"), &RemoteTransform::get_update_scale);
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "remote_path"), "set_remote_node", "get_remote_node");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "remote_path", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Spatial"), "set_remote_node", "get_remote_node");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_global_coordinates"), "set_use_global_coordinates", "get_use_global_coordinates");
ADD_GROUP("Update", "update_");
diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp
index 02768ac91f..26cbfc0b11 100644
--- a/scene/3d/scenario_fx.cpp
+++ b/scene/3d/scenario_fx.cpp
@@ -79,7 +79,11 @@ Ref<Environment> WorldEnvironment::get_environment() const {
String WorldEnvironment::get_configuration_warning() const {
- if (/*!is_visible_in_tree() ||*/ !is_inside_tree() || !environment.is_valid())
+ if (!environment.is_valid()) {
+ return TTR("WorldEnvironment needs an Environment resource.");
+ }
+
+ if (/*!is_visible_in_tree() ||*/ !is_inside_tree())
return String();
List<Node *> nodes;
@@ -89,6 +93,11 @@ String WorldEnvironment::get_configuration_warning() const {
return TTR("Only one WorldEnvironment is allowed per scene (or set of instanced scenes).");
}
+ // Commenting this warning for now, I think it makes no sense. If anyone can figure out what its supposed to do, feedback welcome. Else it should be deprecated.
+ //if (environment.is_valid() && get_viewport() && !get_viewport()->get_camera() && environment->get_background() != Environment::BG_CANVAS) {
+ // return TTR("This WorldEnvironment is ignored. Either add a Camera (for 3D scenes) or set this environment's Background Mode to Canvas (for 2D scenes).");
+ //}
+
return String();
}
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index d3a13c741e..8d91b6f09f 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -33,6 +33,7 @@
#include "message_queue.h"
#include "core/project_settings.h"
+#include "scene/3d/physics_body.h"
#include "scene/resources/surface_tool.h"
bool Skeleton::_set(const StringName &p_path, const Variant &p_value) {
@@ -329,7 +330,7 @@ void Skeleton::add_bone(const String &p_name) {
_make_dirty();
update_gizmo();
}
-int Skeleton::find_bone(String p_name) const {
+int Skeleton::find_bone(const String &p_name) const {
for (int i = 0; i < bones.size(); i++) {
@@ -346,6 +347,19 @@ String Skeleton::get_bone_name(int p_bone) const {
return bones[p_bone].name;
}
+bool Skeleton::is_bone_parent_of(int p_bone, int p_parent_bone_id) const {
+
+ int parent_of_bone = get_bone_parent(p_bone);
+
+ if (-1 == parent_of_bone)
+ return false;
+
+ if (parent_of_bone == p_parent_bone_id)
+ return true;
+
+ return is_bone_parent_of(parent_of_bone, p_parent_bone_id);
+}
+
int Skeleton::get_bone_count() const {
return bones.size();
@@ -377,6 +391,17 @@ void Skeleton::unparent_bone_and_rest(int p_bone) {
_make_dirty();
}
+void Skeleton::set_bone_ignore_animation(int p_bone, bool p_ignore) {
+ ERR_FAIL_INDEX(p_bone, bones.size());
+ bones[p_bone].ignore_animation = p_ignore;
+}
+
+bool Skeleton::is_bone_ignore_animation(int p_bone) const {
+
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), false);
+ return bones[p_bone].ignore_animation;
+}
+
void Skeleton::set_bone_disable_rest(int p_bone, bool p_disable) {
ERR_FAIL_INDEX(p_bone, bones.size());
@@ -522,6 +547,154 @@ void Skeleton::localize_rests() {
}
}
+#ifndef _3D_DISABLED
+
+void Skeleton::bind_physical_bone_to_bone(int p_bone, PhysicalBone *p_physical_bone) {
+ ERR_FAIL_INDEX(p_bone, bones.size());
+ ERR_FAIL_COND(bones[p_bone].physical_bone);
+ ERR_FAIL_COND(!p_physical_bone);
+ bones[p_bone].physical_bone = p_physical_bone;
+
+ _rebuild_physical_bones_cache();
+}
+
+void Skeleton::unbind_physical_bone_from_bone(int p_bone) {
+ ERR_FAIL_INDEX(p_bone, bones.size());
+ bones[p_bone].physical_bone = NULL;
+
+ _rebuild_physical_bones_cache();
+}
+
+PhysicalBone *Skeleton::get_physical_bone(int p_bone) {
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+
+ return bones[p_bone].physical_bone;
+}
+
+PhysicalBone *Skeleton::get_physical_bone_parent(int p_bone) {
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+
+ if (bones[p_bone].cache_parent_physical_bone) {
+ return bones[p_bone].cache_parent_physical_bone;
+ }
+
+ return _get_physical_bone_parent(p_bone);
+}
+
+PhysicalBone *Skeleton::_get_physical_bone_parent(int p_bone) {
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+
+ const int parent_bone = bones[p_bone].parent;
+ if (0 > parent_bone) {
+ return NULL;
+ }
+
+ PhysicalBone *pb = bones[parent_bone].physical_bone;
+ if (pb) {
+ return pb;
+ } else {
+ return get_physical_bone_parent(parent_bone);
+ }
+}
+
+void Skeleton::_rebuild_physical_bones_cache() {
+ const int b_size = bones.size();
+ for (int i = 0; i < b_size; ++i) {
+ bones[i].cache_parent_physical_bone = _get_physical_bone_parent(i);
+ if (bones[i].physical_bone)
+ bones[i].physical_bone->_on_bone_parent_changed();
+ }
+}
+
+void _pb_stop_simulation(Node *p_node) {
+
+ for (int i = p_node->get_child_count() - 1; 0 <= i; --i) {
+ _pb_stop_simulation(p_node->get_child(i));
+ }
+
+ PhysicalBone *pb = Object::cast_to<PhysicalBone>(p_node);
+ if (pb) {
+ pb->set_simulate_physics(false);
+ pb->set_static_body(false);
+ }
+}
+
+void Skeleton::physical_bones_stop_simulation() {
+ _pb_stop_simulation(this);
+}
+
+void _pb_start_simulation(const Skeleton *p_skeleton, Node *p_node, const Vector<int> &p_sim_bones) {
+
+ for (int i = p_node->get_child_count() - 1; 0 <= i; --i) {
+ _pb_start_simulation(p_skeleton, p_node->get_child(i), p_sim_bones);
+ }
+
+ PhysicalBone *pb = Object::cast_to<PhysicalBone>(p_node);
+ if (pb) {
+ bool sim = false;
+ for (int i = p_sim_bones.size() - 1; 0 <= i; --i) {
+ if (p_sim_bones[i] == pb->get_bone_id() || p_skeleton->is_bone_parent_of(pb->get_bone_id(), p_sim_bones[i])) {
+ sim = true;
+ break;
+ }
+ }
+
+ pb->set_simulate_physics(true);
+ if (sim) {
+ pb->set_static_body(false);
+ } else {
+ pb->set_static_body(true);
+ }
+ }
+}
+
+void Skeleton::physical_bones_start_simulation_on(const Array &p_bones) {
+
+ Vector<int> sim_bones;
+ if (p_bones.size() <= 0) {
+ sim_bones.push_back(0); // if no bones is specified, activate ragdoll on full body
+ } else {
+ sim_bones.resize(p_bones.size());
+ int c = 0;
+ for (int i = sim_bones.size() - 1; 0 <= i; --i) {
+ if (Variant::STRING == p_bones.get(i).get_type()) {
+ int bone_id = find_bone(p_bones.get(i));
+ if (bone_id != -1)
+ sim_bones[c++] = bone_id;
+ }
+ }
+ sim_bones.resize(c);
+ }
+
+ _pb_start_simulation(this, this, sim_bones);
+}
+
+void _physical_bones_add_remove_collision_exception(bool p_add, Node *p_node, RID p_exception) {
+
+ for (int i = p_node->get_child_count() - 1; 0 <= i; --i) {
+ _physical_bones_add_remove_collision_exception(p_add, p_node->get_child(i), p_exception);
+ }
+
+ CollisionObject *co = Object::cast_to<CollisionObject>(p_node);
+ if (co) {
+ if (p_add) {
+ PhysicsServer::get_singleton()->body_add_collision_exception(co->get_rid(), p_exception);
+ } else {
+ PhysicsServer::get_singleton()->body_remove_collision_exception(co->get_rid(), p_exception);
+ }
+ }
+}
+
+void Skeleton::physical_bones_add_collision_exception(RID p_exception) {
+ _physical_bones_add_remove_collision_exception(true, this, p_exception);
+}
+
+void Skeleton::physical_bones_remove_collision_exception(RID p_exception) {
+ _physical_bones_add_remove_collision_exception(false, this, p_exception);
+}
+
+#endif // _3D_DISABLED
+
void Skeleton::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_bone", "name"), &Skeleton::add_bone);
@@ -558,6 +731,15 @@ void Skeleton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bone_transform", "bone_idx"), &Skeleton::get_bone_transform);
+#ifndef _3D_DISABLED
+
+ ClassDB::bind_method(D_METHOD("physical_bones_stop_simulation"), &Skeleton::physical_bones_stop_simulation);
+ ClassDB::bind_method(D_METHOD("physical_bones_start_simulation", "bones"), &Skeleton::physical_bones_start_simulation_on, DEFVAL(Array()));
+ ClassDB::bind_method(D_METHOD("physical_bones_add_collision_exception", "exception"), &Skeleton::physical_bones_add_collision_exception);
+ ClassDB::bind_method(D_METHOD("physical_bones_remove_collision_exception", "exception"), &Skeleton::physical_bones_remove_collision_exception);
+
+#endif // _3D_DISABLED
+
BIND_CONSTANT(NOTIFICATION_UPDATE_SKELETON);
}
@@ -570,6 +752,5 @@ Skeleton::Skeleton() {
}
Skeleton::~Skeleton() {
-
VisualServer::get_singleton()->free(skeleton);
}
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index d693670055..9672acb57a 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -37,6 +37,11 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
+#ifndef _3D_DISABLED
+class PhysicalBone;
+#endif // _3D_DISABLED
+
class Skeleton : public Spatial {
GDCLASS(Skeleton, Spatial);
@@ -48,6 +53,8 @@ class Skeleton : public Spatial {
bool enabled;
int parent;
+ bool ignore_animation;
+
bool disable_rest;
Transform rest;
Transform rest_global_inverse;
@@ -60,13 +67,23 @@ class Skeleton : public Spatial {
Transform transform_final;
+#ifndef _3D_DISABLED
+ PhysicalBone *physical_bone;
+ PhysicalBone *cache_parent_physical_bone;
+#endif // _3D_DISABLED
+
List<uint32_t> nodes_bound;
Bone() {
parent = -1;
enabled = true;
+ ignore_animation = false;
custom_pose_enable = false;
disable_rest = false;
+#ifndef _3D_DISABLED
+ physical_bone = NULL;
+ cache_parent_physical_bone = NULL;
+#endif // _3D_DISABLED
}
};
@@ -110,14 +127,19 @@ public:
// skeleton creation api
void add_bone(const String &p_name);
- int find_bone(String p_name) const;
+ int find_bone(const String &p_name) const;
String get_bone_name(int p_bone) const;
+ bool is_bone_parent_of(int p_bone_id, int p_parent_bone_id) const;
+
void set_bone_parent(int p_bone, int p_parent);
int get_bone_parent(int p_bone) const;
void unparent_bone_and_rest(int p_bone);
+ void set_bone_ignore_animation(int p_bone, bool p_ignore);
+ bool is_bone_ignore_animation(int p_bone) const;
+
void set_bone_disable_rest(int p_bone, bool p_disable);
bool is_bone_rest_disabled(int p_bone) const;
@@ -149,6 +171,28 @@ public:
void localize_rests(); // used for loaders and tools
+#ifndef _3D_DISABLED
+ // Physical bone API
+
+ void bind_physical_bone_to_bone(int p_bone, PhysicalBone *p_physical_bone);
+ void unbind_physical_bone_from_bone(int p_bone);
+
+ PhysicalBone *get_physical_bone(int p_bone);
+ PhysicalBone *get_physical_bone_parent(int p_bone);
+
+private:
+ /// This is a slow API os it's cached
+ PhysicalBone *_get_physical_bone_parent(int p_bone);
+ void _rebuild_physical_bones_cache();
+
+public:
+ void physical_bones_stop_simulation();
+ void physical_bones_start_simulation_on(const Array &p_bones);
+ void physical_bones_add_collision_exception(RID p_exception);
+ void physical_bones_remove_collision_exception(RID p_exception);
+#endif // _3D_DISABLED
+
+public:
Skeleton();
~Skeleton();
};
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 721641e09b..748aa8aad4 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -85,9 +85,7 @@ void Spatial::_notify_dirty() {
}
void Spatial::_update_local_transform() const {
- data.local_transform.basis = Basis();
- data.local_transform.basis.scale(data.scale);
- data.local_transform.basis.rotate(data.rotation);
+ data.local_transform.basis.set_euler_scale(data.rotation, data.scale);
data.dirty &= ~DIRTY_LOCAL;
}
@@ -188,7 +186,9 @@ void Spatial::_notification(int p_what) {
if (data.gizmo.is_valid()) {
data.gizmo->create();
if (data.gizmo->can_draw()) {
- data.gizmo->redraw();
+ if (is_visible_in_tree()) {
+ data.gizmo->redraw();
+ }
}
data.gizmo->transform();
}
@@ -286,6 +286,16 @@ Transform Spatial::get_global_transform() const {
return data.global_transform;
}
+#ifdef TOOLS_ENABLED
+Transform Spatial::get_global_gizmo_transform() const {
+ return get_global_transform();
+}
+
+Transform Spatial::get_local_gizmo_transform() const {
+ return get_transform();
+}
+#endif
+
Spatial *Spatial::get_parent_spatial() const {
return data.parent;
@@ -409,7 +419,9 @@ void Spatial::set_gizmo(const Ref<SpatialGizmo> &p_gizmo) {
data.gizmo->create();
if (data.gizmo->can_draw()) {
- data.gizmo->redraw();
+ if (is_visible_in_tree()) {
+ data.gizmo->redraw();
+ }
}
data.gizmo->transform();
}
@@ -428,10 +440,9 @@ Ref<SpatialGizmo> Spatial::get_gizmo() const {
#endif
}
-#ifdef TOOLS_ENABLED
-
void Spatial::_update_gizmo() {
+#ifdef TOOLS_ENABLED
if (!is_inside_world())
return;
data.gizmo_dirty = false;
@@ -443,8 +454,10 @@ void Spatial::_update_gizmo() {
data.gizmo->clear();
}
}
+#endif
}
+#ifdef TOOLS_ENABLED
void Spatial::set_disable_gizmo(bool p_enabled) {
data.gizmo_disabled = p_enabled;
@@ -724,9 +737,7 @@ void Spatial::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel);
ClassDB::bind_method(D_METHOD("get_world"), &Spatial::get_world);
-#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("_update_gizmo"), &Spatial::_update_gizmo);
-#endif
ClassDB::bind_method(D_METHOD("update_gizmo"), &Spatial::update_gizmo);
ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo"), &Spatial::set_gizmo);
@@ -788,9 +799,7 @@ void Spatial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale");
ADD_GROUP("Visibility", "");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible");
-#ifdef TOOLS_ENABLED
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "SpatialGizmo", 0), "set_gizmo", "get_gizmo");
-#endif
ADD_SIGNAL(MethodInfo("visibility_changed"));
}
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index 518bba9a51..a43bed3e4a 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -100,10 +100,8 @@ class Spatial : public Node {
#endif
} data;
-#ifdef TOOLS_ENABLED
void _update_gizmo();
-#endif
void _notify_dirty();
void _propagate_transform_changed(Spatial *p_origin);
@@ -147,6 +145,11 @@ public:
Transform get_transform() const;
Transform get_global_transform() const;
+#ifdef TOOLS_ENABLED
+ virtual Transform get_global_gizmo_transform() const;
+ virtual Transform get_local_gizmo_transform() const;
+#endif
+
void set_as_toplevel(bool p_enabled);
bool is_set_as_toplevel() const;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 232855c978..036a748c83 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -185,6 +185,9 @@ void SpriteBase3D::_queue_update() {
if (pending_update)
return;
+ triangle_mesh.unref();
+ update_gizmo();
+
pending_update = true;
call_deferred(SceneStringNames::get_singleton()->_im_update);
}
@@ -198,6 +201,66 @@ PoolVector<Face3> SpriteBase3D::get_faces(uint32_t p_usage_flags) const {
return PoolVector<Face3>();
}
+Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const {
+ if (triangle_mesh.is_valid())
+ return triangle_mesh;
+
+ PoolVector<Vector3> faces;
+ faces.resize(6);
+ PoolVector<Vector3>::Write facesw = faces.write();
+
+ Rect2 final_rect = get_item_rect();
+
+ if (final_rect.size.x == 0 || final_rect.size.y == 0)
+ return Ref<TriangleMesh>();
+
+ float pixel_size = get_pixel_size();
+
+ Vector2 vertices[4] = {
+
+ (final_rect.position + Vector2(0, final_rect.size.y)) * pixel_size,
+ (final_rect.position + final_rect.size) * pixel_size,
+ (final_rect.position + Vector2(final_rect.size.x, 0)) * pixel_size,
+ final_rect.position * pixel_size,
+
+ };
+
+ int x_axis = ((axis + 1) % 3);
+ int y_axis = ((axis + 2) % 3);
+
+ if (axis != Vector3::AXIS_Z) {
+ SWAP(x_axis, y_axis);
+
+ for (int i = 0; i < 4; i++) {
+ if (axis == Vector3::AXIS_Y) {
+ vertices[i].y = -vertices[i].y;
+ } else if (axis == Vector3::AXIS_X) {
+ vertices[i].x = -vertices[i].x;
+ }
+ }
+ }
+
+ static const int indices[6] = {
+ 0, 1, 2,
+ 0, 2, 3
+ };
+
+ for (int j = 0; j < 6; j++) {
+ int i = indices[j];
+ Vector3 vtx;
+ vtx[x_axis] = vertices[i][0];
+ vtx[y_axis] = vertices[i][1];
+ facesw[j] = vtx;
+ }
+
+ facesw = PoolVector<Vector3>::Write();
+
+ triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
+ triangle_mesh->create(faces);
+
+ return triangle_mesh;
+}
+
void SpriteBase3D::set_draw_flag(DrawFlags p_flag, bool p_enable) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
@@ -255,6 +318,7 @@ void SpriteBase3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_alpha_cut_mode"), &SpriteBase3D::get_alpha_cut_mode);
ClassDB::bind_method(D_METHOD("get_item_rect"), &SpriteBase3D::get_item_rect);
+ ClassDB::bind_method(D_METHOD("generate_triangle_mesh"), &SpriteBase3D::generate_triangle_mesh);
ClassDB::bind_method(D_METHOD("_queue_update"), &SpriteBase3D::_queue_update);
ClassDB::bind_method(D_METHOD("_im_update"), &SpriteBase3D::_im_update);
@@ -366,6 +430,16 @@ void Sprite3D::_draw() {
final_rect.position * pixel_size,
};
+
+ Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height());
+
+ // Properly setup UVs for impostor textures (AtlasTexture).
+ Ref<AtlasTexture> atlas_tex = texture;
+ if (atlas_tex != NULL) {
+ src_tsize[0] = atlas_tex->get_atlas()->get_width();
+ src_tsize[1] = atlas_tex->get_atlas()->get_height();
+ }
+
Vector2 uvs[4] = {
final_src_rect.position / tsize,
(final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize,
@@ -656,6 +730,16 @@ void AnimatedSprite3D::_draw() {
final_rect.position * pixel_size,
};
+
+ Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height());
+
+ // Properly setup UVs for impostor textures (AtlasTexture).
+ Ref<AtlasTexture> atlas_tex = texture;
+ if (atlas_tex != NULL) {
+ src_tsize[0] = atlas_tex->get_atlas()->get_width();
+ src_tsize[1] = atlas_tex->get_atlas()->get_height();
+ }
+
Vector2 uvs[4] = {
final_src_rect.position / tsize,
(final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize,
@@ -881,7 +965,7 @@ Rect2 AnimatedSprite3D::get_item_rect() const {
return Rect2(0, 0, 1, 1);
Size2i s = t->get_size();
- Point2 ofs = offset;
+ Point2 ofs = get_offset();
if (centered)
ofs -= s / 2;
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index 23e1d96b4b..a4705a8970 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -38,6 +38,8 @@ class SpriteBase3D : public GeometryInstance {
GDCLASS(SpriteBase3D, GeometryInstance);
+ mutable Ref<TriangleMesh> triangle_mesh; //cached
+
public:
enum DrawFlags {
FLAG_TRANSPARENT,
@@ -133,6 +135,7 @@ public:
virtual AABB get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
+ Ref<TriangleMesh> generate_triangle_mesh() const;
SpriteBase3D();
~SpriteBase3D();
@@ -192,7 +195,6 @@ class AnimatedSprite3D : public SpriteBase3D {
int frame;
bool centered;
- Point2 offset;
float timeout;
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index ed3bde9504..385956dc16 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -524,7 +524,7 @@ void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) {
//bilateral constraint between two dynamic objects
void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1,
- PhysicsBody *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse) {
+ PhysicsBody *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, real_t p_rollInfluence) {
real_t normalLenSqr = normal.length_squared();
//ERR_FAIL_COND( normalLenSqr < real_t(1.1));
@@ -582,8 +582,15 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
rel_vel = normal.dot(vel);
- //TODO: move this into proper structure
- real_t contactDamping = real_t(0.4);
+ // !BAS! We had this set to 0.4, in bullet its 0.2
+ real_t contactDamping = real_t(0.2);
+
+ if (p_rollInfluence > 0.0) {
+ // !BAS! But seeing we apply this frame by frame, makes more sense to me to make this time based
+ // keeping in mind our anti roll factor if it is set
+ contactDamping = s->get_step() / p_rollInfluence;
+ }
+
#define ONLY_USE_LINEAR_MASS
#ifdef ONLY_USE_LINEAR_MASS
real_t massTerm = real_t(1.) / ((1.0 / mass) + b2invmass);
@@ -668,13 +675,8 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
m_forwardImpulse.resize(numWheel);
m_sideImpulse.resize(numWheel);
- int numWheelsOnGround = 0;
-
//collapse all those loops into one!
for (int i = 0; i < wheels.size(); i++) {
- VehicleWheel &wheelInfo = *wheels[i];
- if (wheelInfo.m_raycastInfo.m_isInContact)
- numWheelsOnGround++;
m_sideImpulse[i] = real_t(0.);
m_forwardImpulse[i] = real_t(0.);
}
@@ -704,7 +706,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
_resolve_single_bilateral(s, wheelInfo.m_raycastInfo.m_contactPointWS,
wheelInfo.m_raycastInfo.m_groundObject, wheelInfo.m_raycastInfo.m_contactPointWS,
- m_axle[i], m_sideImpulse[i]);
+ m_axle[i], m_sideImpulse[i], wheelInfo.m_rollInfluence);
m_sideImpulse[i] *= sideFrictionStiffness2;
}
@@ -925,7 +927,7 @@ void VehicleBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody::get_steering);
ADD_GROUP("Motion", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01"), "set_engine_force", "get_engine_force");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "brake", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_brake", "get_brake");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
}
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index 7810a42e8a..1ac3693cc4 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -168,7 +168,7 @@ class VehicleBody : public RigidBody {
btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse);
};
- void _resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1, PhysicsBody *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse);
+ void _resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1, PhysicsBody *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, real_t p_rollInfluence);
real_t _calc_rolling_friction(btVehicleWheelContactPoint &contactPoint);
void _update_friction(PhysicsDirectBodyState *s);
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index d389b69ef3..670df5cc7f 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -2316,13 +2316,10 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) {
PoolVector<Vector3> vertices;
PoolVector<Color> colors;
-
- int vtx_idx = 0;
#define ADD_VTX(m_idx) \
; \
vertices.push_back(face_points[m_idx]); \
- colors.push_back(Color(1, 1, 1, 1)); \
- vtx_idx++;
+ colors.push_back(Color(1, 1, 1, 1));
for (int i = 0; i < 6; i++) {
@@ -2338,9 +2335,9 @@ Ref<MultiMesh> VoxelLightBaker::create_debug_multimesh(DebugMode p_mode) {
for (int k = 0; k < 3; k++) {
if (i < 3)
- face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[j][(i + k) % 3] = v[k];
else
- face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[3 - j][(i + k) % 3] = -v[k];
}
}
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
new file mode 100644
index 0000000000..d3d2870c3f
--- /dev/null
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -0,0 +1,294 @@
+#include "animation_blend_space_1d.h"
+
+void AnimationNodeBlendSpace1D::set_tree(AnimationTree *p_player) {
+
+ AnimationRootNode::set_tree(p_player);
+
+ for(int i=0;i<blend_points_used;i++) {
+ blend_points[i].node->set_tree(p_player);
+ }
+
+}
+
+void AnimationNodeBlendSpace1D::_validate_property(PropertyInfo &property) const {
+ if (property.name.begins_with("blend_point_")) {
+ String left = property.name.get_slicec('/', 0);
+ int idx = left.get_slicec('_', 2).to_int();
+ if (idx >= blend_points_used) {
+ property.usage = 0;
+ }
+ }
+ AnimationRootNode::_validate_property(property);
+}
+
+void AnimationNodeBlendSpace1D::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("add_blend_point", "node", "pos", "at_index"), &AnimationNodeBlendSpace1D::add_blend_point, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("set_blend_point_position", "point", "pos"), &AnimationNodeBlendSpace1D::set_blend_point_position);
+ ClassDB::bind_method(D_METHOD("get_blend_point_position", "point"), &AnimationNodeBlendSpace1D::get_blend_point_position);
+ ClassDB::bind_method(D_METHOD("set_blend_point_node", "point", "node"), &AnimationNodeBlendSpace1D::set_blend_point_node);
+ ClassDB::bind_method(D_METHOD("get_blend_point_node", "point"), &AnimationNodeBlendSpace1D::get_blend_point_node);
+ ClassDB::bind_method(D_METHOD("remove_blend_point", "point"), &AnimationNodeBlendSpace1D::remove_blend_point);
+ ClassDB::bind_method(D_METHOD("get_blend_point_count"), &AnimationNodeBlendSpace1D::get_blend_point_count);
+
+ ClassDB::bind_method(D_METHOD("set_min_space", "min_space"), &AnimationNodeBlendSpace1D::set_min_space);
+ ClassDB::bind_method(D_METHOD("get_min_space"), &AnimationNodeBlendSpace1D::get_min_space);
+
+ ClassDB::bind_method(D_METHOD("set_max_space", "max_space"), &AnimationNodeBlendSpace1D::set_max_space);
+ ClassDB::bind_method(D_METHOD("get_max_space"), &AnimationNodeBlendSpace1D::get_max_space);
+
+ ClassDB::bind_method(D_METHOD("set_snap", "snap"), &AnimationNodeBlendSpace1D::set_snap);
+ ClassDB::bind_method(D_METHOD("get_snap"), &AnimationNodeBlendSpace1D::get_snap);
+
+ ClassDB::bind_method(D_METHOD("set_blend_pos", "pos"), &AnimationNodeBlendSpace1D::set_blend_pos);
+ ClassDB::bind_method(D_METHOD("get_blend_pos"), &AnimationNodeBlendSpace1D::get_blend_pos);
+
+ 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("_add_blend_point", "index", "node"), &AnimationNodeBlendSpace1D::_add_blend_point);
+
+ for (int i = 0; i < MAX_BLEND_POINTS; i++) {
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "blend_point_" + itos(i) + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "_add_blend_point", "get_blend_point_node", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "blend_point_" + itos(i) + "/pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_blend_point_position", "get_blend_point_position", i);
+ }
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "min_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_min_space", "get_min_space");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_max_space", "get_max_space");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "snap", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_snap", "get_snap");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "blend_pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_blend_pos", "get_blend_pos");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "value_label", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_value_label", "get_value_label");
+}
+
+void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &p_node, float p_position, int p_at_index) {
+ ERR_FAIL_COND(blend_points_used >= MAX_BLEND_POINTS);
+ ERR_FAIL_COND(p_node.is_null());
+ ERR_FAIL_COND(p_node->get_parent().is_valid());
+ ERR_FAIL_COND(p_at_index < -1 || p_at_index > blend_points_used);
+
+ if (p_at_index == -1 || p_at_index == blend_points_used) {
+ p_at_index = blend_points_used;
+ } else {
+ for (int i = blend_points_used - 1; i > p_at_index; i++) {
+ blend_points[i] = blend_points[i - 1];
+ }
+ }
+
+ blend_points[p_at_index].node = p_node;
+ blend_points[p_at_index].position = p_position;
+
+ blend_points[p_at_index].node->set_parent(this);
+ blend_points[p_at_index].node->set_tree(get_tree());
+
+ blend_points_used++;
+}
+
+void AnimationNodeBlendSpace1D::set_blend_point_position(int p_point, float p_position) {
+ ERR_FAIL_INDEX(p_point, blend_points_used);
+
+ blend_points[p_point].position = p_position;
+}
+
+void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Ref<AnimationRootNode> &p_node) {
+ ERR_FAIL_INDEX(p_point, blend_points_used);
+ ERR_FAIL_COND(p_node.is_null());
+
+ if (blend_points[p_point].node.is_valid()) {
+ blend_points[p_point].node->set_parent(NULL);
+ blend_points[p_point].node->set_tree(NULL);
+ }
+
+ blend_points[p_point].node = p_node;
+ blend_points[p_point].node->set_parent(this);
+ blend_points[p_point].node->set_tree(get_tree());
+}
+
+float AnimationNodeBlendSpace1D::get_blend_point_position(int p_point) const {
+ ERR_FAIL_INDEX_V(p_point, blend_points_used, 0);
+ return blend_points[p_point].position;
+}
+
+Ref<AnimationRootNode> AnimationNodeBlendSpace1D::get_blend_point_node(int p_point) const {
+ ERR_FAIL_INDEX_V(p_point, blend_points_used, Ref<AnimationRootNode>());
+ return blend_points[p_point].node;
+}
+
+void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) {
+ ERR_FAIL_INDEX(p_point, blend_points_used);
+
+ blend_points[p_point].node->set_parent(NULL);
+ blend_points[p_point].node->set_tree(NULL);
+
+ for (int i = p_point; i < blend_points_used - 1; i++) {
+ blend_points[i] = blend_points[i + 1];
+ }
+
+ blend_points_used--;
+}
+
+int AnimationNodeBlendSpace1D::get_blend_point_count() const {
+
+ return blend_points_used;
+}
+
+void AnimationNodeBlendSpace1D::set_min_space(float p_min) {
+ min_space = p_min;
+
+ if (min_space >= max_space) {
+ min_space = max_space - 1;
+ }
+}
+
+float AnimationNodeBlendSpace1D::get_min_space() const {
+ return min_space;
+}
+
+void AnimationNodeBlendSpace1D::set_max_space(float p_max) {
+ max_space = p_max;
+
+ if (max_space <= min_space) {
+ max_space = min_space + 1;
+ }
+}
+
+float AnimationNodeBlendSpace1D::get_max_space() const {
+ return max_space;
+}
+
+void AnimationNodeBlendSpace1D::set_snap(float p_snap) {
+ snap = p_snap;
+}
+
+float AnimationNodeBlendSpace1D::get_snap() const {
+ return snap;
+}
+
+void AnimationNodeBlendSpace1D::set_blend_pos(float p_pos) {
+ blend_pos = p_pos;
+}
+
+float AnimationNodeBlendSpace1D::get_blend_pos() const {
+ return blend_pos;
+}
+
+void AnimationNodeBlendSpace1D::set_value_label(const String &p_label) {
+ value_label = p_label;
+}
+
+String AnimationNodeBlendSpace1D::get_value_label() const {
+ return value_label;
+}
+
+void AnimationNodeBlendSpace1D::_add_blend_point(int p_index, const Ref<AnimationRootNode> &p_node) {
+ if (p_index == blend_points_used) {
+ add_blend_point(p_node, 0);
+ } else {
+ set_blend_point_node(p_index, p_node);
+ }
+}
+
+float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) {
+
+ if (blend_points_used == 0) {
+ return 0.0;
+ }
+
+ if (blend_points_used == 1) {
+ // only one point available, just play that animation
+ return blend_node(blend_points[0].node, p_time, p_seek, 1.0, FILTER_IGNORE, false);
+ }
+
+ 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;
+ }
+ }
+ }
+
+ // fill in weights
+
+ if (point_lower == -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 {
+
+ // we are between two points.
+ // figure out weights, then blend the animations
+
+ float distance_between_points = pos_higher - pos_lower;
+
+ float current_pos_inbetween = blend_pos - pos_lower;
+
+ float blend_percentage = current_pos_inbetween / distance_between_points;
+
+ float blend_lower = 1.0 - blend_percentage;
+ float blend_higher = blend_percentage;
+
+ weights[point_lower] = blend_lower;
+ weights[point_higher] = blend_higher;
+ }
+
+ // actually blend the animations now
+
+ float max_time_remaining = 0.0;
+
+ for (int i = 0; i < blend_points_used; i++) {
+ float remaining = blend_node(blend_points[i].node, p_time, p_seek, weights[i], FILTER_IGNORE, false);
+
+ max_time_remaining = MAX(max_time_remaining, remaining);
+ }
+
+ return max_time_remaining;
+}
+
+String AnimationNodeBlendSpace1D::get_caption() const {
+ return "BlendSpace1D";
+}
+
+AnimationNodeBlendSpace1D::AnimationNodeBlendSpace1D() {
+
+ blend_points_used = 0;
+ max_space = 1;
+ min_space = -1;
+
+ snap = 0.1;
+ value_label = "value";
+}
+
+AnimationNodeBlendSpace1D::~AnimationNodeBlendSpace1D() {
+
+ for (int i = 0; i < blend_points_used; i++) {
+ blend_points[i].node->set_parent(this);
+ blend_points[i].node->set_tree(get_tree());
+ }
+}
diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h
new file mode 100644
index 0000000000..774894ef4b
--- /dev/null
+++ b/scene/animation/animation_blend_space_1d.h
@@ -0,0 +1,71 @@
+#ifndef ANIMATION_BLEND_SPACE_1D_H
+#define ANIMATION_BLEND_SPACE_1D_H
+
+#include "scene/animation/animation_tree.h"
+
+class AnimationNodeBlendSpace1D : public AnimationRootNode {
+ GDCLASS(AnimationNodeBlendSpace1D, AnimationRootNode)
+
+ enum {
+ MAX_BLEND_POINTS = 64
+ };
+
+ struct BlendPoint {
+ Ref<AnimationRootNode> node;
+ float position;
+ };
+
+ BlendPoint blend_points[MAX_BLEND_POINTS];
+ int blend_points_used;
+
+ float blend_pos;
+
+ float max_space;
+ float min_space;
+
+ float snap;
+
+ String value_label;
+
+ void _add_blend_point(int p_index, const Ref<AnimationRootNode> &p_node);
+
+protected:
+ virtual void _validate_property(PropertyInfo &property) const;
+ static void _bind_methods();
+
+public:
+
+ virtual void set_tree(AnimationTree *p_player);
+
+ void add_blend_point(const Ref<AnimationRootNode> &p_node, float p_position, int p_at_index = -1);
+ void set_blend_point_position(int p_point, float p_position);
+ void set_blend_point_node(int p_point, const Ref<AnimationRootNode> &p_node);
+
+ float get_blend_point_position(int p_point) const;
+ Ref<AnimationRootNode> get_blend_point_node(int p_point) const;
+ void remove_blend_point(int p_point);
+ int get_blend_point_count() const;
+
+ void set_min_space(float p_min);
+ float get_min_space() const;
+
+ void set_max_space(float p_max);
+ float get_max_space() const;
+
+ void set_snap(float p_snap);
+ float get_snap() const;
+
+ void set_blend_pos(float p_pos);
+ float get_blend_pos() const;
+
+ void set_value_label(const String &p_label);
+ String get_value_label() const;
+
+ float process(float p_time, bool p_seek);
+ String get_caption() const;
+
+ AnimationNodeBlendSpace1D();
+ ~AnimationNodeBlendSpace1D();
+};
+
+#endif // ANIMATION_BLEND_SPACE_1D_H
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
new file mode 100644
index 0000000000..82db647124
--- /dev/null
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -0,0 +1,567 @@
+#include "animation_blend_space_2d.h"
+#include "math/delaunay.h"
+
+void AnimationNodeBlendSpace2D::set_tree(AnimationTree *p_player) {
+ AnimationRootNode::set_tree(p_player);
+
+ for(int i=0;i<blend_points_used;i++) {
+ blend_points[i].node->set_tree(p_player);
+ }
+}
+
+
+void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &p_node, const Vector2 &p_position, int p_at_index) {
+ ERR_FAIL_COND(blend_points_used >= MAX_BLEND_POINTS);
+ ERR_FAIL_COND(p_node.is_null());
+ ERR_FAIL_COND(p_node->get_parent().is_valid());
+ ERR_FAIL_COND(p_at_index < -1 || p_at_index > blend_points_used);
+
+ if (p_at_index == -1 || p_at_index == blend_points_used) {
+ p_at_index = blend_points_used;
+ } else {
+ for (int i = blend_points_used - 1; i > p_at_index; i--) {
+ blend_points[i] = blend_points[i - 1];
+ }
+ for (int i = 0; i < triangles.size(); i++) {
+ for (int j = 0; j < 3; j++) {
+ if (triangles[i].points[j] >= p_at_index) {
+ triangles[i].points[j]++;
+ }
+ }
+ }
+ }
+ blend_points[p_at_index].node = p_node;
+ blend_points[p_at_index].position = p_position;
+
+ blend_points[p_at_index].node->set_parent(this);
+ blend_points[p_at_index].node->set_tree(get_tree());
+ blend_points_used++;
+
+ if (auto_triangles) {
+ trianges_dirty = true;
+ }
+}
+
+void AnimationNodeBlendSpace2D::set_blend_point_position(int p_point, const Vector2 &p_position) {
+ ERR_FAIL_INDEX(p_point, blend_points_used);
+ blend_points[p_point].position = p_position;
+ if (auto_triangles) {
+ trianges_dirty = true;
+ }
+}
+void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Ref<AnimationRootNode> &p_node) {
+ ERR_FAIL_INDEX(p_point, blend_points_used);
+ ERR_FAIL_COND(p_node.is_null());
+
+ if (blend_points[p_point].node.is_valid()) {
+ blend_points[p_point].node->set_parent(NULL);
+ blend_points[p_point].node->set_tree(NULL);
+ }
+ blend_points[p_point].node = p_node;
+ blend_points[p_point].node->set_parent(this);
+ blend_points[p_point].node->set_tree(get_tree());
+}
+Vector2 AnimationNodeBlendSpace2D::get_blend_point_position(int p_point) const {
+ ERR_FAIL_INDEX_V(p_point, blend_points_used, Vector2());
+ return blend_points[p_point].position;
+}
+Ref<AnimationRootNode> AnimationNodeBlendSpace2D::get_blend_point_node(int p_point) const {
+ ERR_FAIL_INDEX_V(p_point, blend_points_used, Ref<AnimationRootNode>());
+ return blend_points[p_point].node;
+}
+void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) {
+ ERR_FAIL_INDEX(p_point, blend_points_used);
+
+ blend_points[p_point].node->set_parent(NULL);
+ blend_points[p_point].node->set_tree(NULL);
+
+ for (int i = 0; i < triangles.size(); i++) {
+ bool erase = false;
+ for (int j = 0; j < 3; j++) {
+ if (triangles[i].points[j] == p_point) {
+ erase = true;
+ break;
+ } else if (triangles[i].points[j] > p_point) {
+ triangles[i].points[j]--;
+ }
+ }
+ if (erase) {
+ triangles.remove(i);
+
+ i--;
+ }
+ }
+
+ for (int i = p_point; i < blend_points_used - 1; i++) {
+ blend_points[i] = blend_points[i + 1];
+ }
+ blend_points_used--;
+}
+
+int AnimationNodeBlendSpace2D::get_blend_point_count() const {
+
+ return blend_points_used;
+}
+
+bool AnimationNodeBlendSpace2D::has_triangle(int p_x, int p_y, int p_z) const {
+
+ ERR_FAIL_INDEX_V(p_x, blend_points_used, false);
+ ERR_FAIL_INDEX_V(p_y, blend_points_used, false);
+ ERR_FAIL_INDEX_V(p_z, blend_points_used, false);
+
+ BlendTriangle t;
+ t.points[0] = p_x;
+ t.points[1] = p_y;
+ t.points[2] = p_z;
+
+ SortArray<int> sort;
+ sort.sort(t.points, 3);
+
+ for (int i = 0; i < triangles.size(); i++) {
+ bool all_equal = true;
+ for (int j = 0; j < 3; j++) {
+ if (triangles[i].points[j] != t.points[j]) {
+ all_equal = false;
+ break;
+ }
+ }
+ if (all_equal)
+ return true;
+ }
+
+ return false;
+}
+
+void AnimationNodeBlendSpace2D::add_triangle(int p_x, int p_y, int p_z, int p_at_index) {
+
+ ERR_FAIL_INDEX(p_x, blend_points_used);
+ ERR_FAIL_INDEX(p_y, blend_points_used);
+ ERR_FAIL_INDEX(p_z, blend_points_used);
+
+ _update_triangles();
+
+ BlendTriangle t;
+ t.points[0] = p_x;
+ t.points[1] = p_y;
+ t.points[2] = p_z;
+
+ SortArray<int> sort;
+ sort.sort(t.points, 3);
+
+ for (int i = 0; i < triangles.size(); i++) {
+ bool all_equal = true;
+ for (int j = 0; j < 3; j++) {
+ if (triangles[i].points[j] != t.points[j]) {
+ all_equal = false;
+ break;
+ }
+ }
+ ERR_FAIL_COND(all_equal);
+ }
+
+ if (p_at_index == -1 || p_at_index == triangles.size()) {
+ triangles.push_back(t);
+ } else {
+ triangles.insert(p_at_index, t);
+ }
+}
+int AnimationNodeBlendSpace2D::get_triangle_point(int p_triangle, int p_point) {
+
+ _update_triangles();
+
+ ERR_FAIL_INDEX_V(p_point, 3, -1);
+ ERR_FAIL_INDEX_V(p_triangle, triangles.size(), -1);
+ return triangles[p_triangle].points[p_point];
+}
+void AnimationNodeBlendSpace2D::remove_triangle(int p_triangle) {
+ ERR_FAIL_INDEX(p_triangle, triangles.size());
+
+ triangles.remove(p_triangle);
+}
+
+int AnimationNodeBlendSpace2D::get_triangle_count() const {
+ return triangles.size();
+}
+
+void AnimationNodeBlendSpace2D::set_min_space(const Vector2 &p_min) {
+
+ min_space = p_min;
+ if (min_space.x >= max_space.x) {
+ min_space.x = max_space.x - 1;
+ }
+ if (min_space.y >= max_space.y) {
+ min_space.y = max_space.y - 1;
+ }
+}
+Vector2 AnimationNodeBlendSpace2D::get_min_space() const {
+ return min_space;
+}
+
+void AnimationNodeBlendSpace2D::set_max_space(const Vector2 &p_max) {
+
+ max_space = p_max;
+ if (max_space.x <= min_space.x) {
+ max_space.x = min_space.x + 1;
+ }
+ if (max_space.y <= min_space.y) {
+ max_space.y = min_space.y + 1;
+ }
+}
+Vector2 AnimationNodeBlendSpace2D::get_max_space() const {
+ return max_space;
+}
+
+void AnimationNodeBlendSpace2D::set_snap(const Vector2 &p_snap) {
+ snap = p_snap;
+}
+Vector2 AnimationNodeBlendSpace2D::get_snap() const {
+ return snap;
+}
+
+void AnimationNodeBlendSpace2D::set_blend_position(const Vector2 &p_pos) {
+ blend_pos = p_pos;
+}
+Vector2 AnimationNodeBlendSpace2D::get_blend_position() const {
+ return blend_pos;
+}
+
+void AnimationNodeBlendSpace2D::set_x_label(const String &p_label) {
+ x_label = p_label;
+}
+String AnimationNodeBlendSpace2D::get_x_label() const {
+ return x_label;
+}
+
+void AnimationNodeBlendSpace2D::set_y_label(const String &p_label) {
+ y_label = p_label;
+}
+String AnimationNodeBlendSpace2D::get_y_label() const {
+ return y_label;
+}
+
+void AnimationNodeBlendSpace2D::_add_blend_point(int p_index, const Ref<AnimationRootNode> &p_node) {
+ if (p_index == blend_points_used) {
+ add_blend_point(p_node, Vector2());
+ } else {
+ set_blend_point_node(p_index, p_node);
+ }
+}
+
+void AnimationNodeBlendSpace2D::_set_triangles(const Vector<int> &p_triangles) {
+
+ if (auto_triangles)
+ return;
+ ERR_FAIL_COND(p_triangles.size() % 3 != 0);
+ for (int i = 0; i < p_triangles.size(); i += 3) {
+ add_triangle(p_triangles[i + 0], p_triangles[i + 1], p_triangles[i + 2]);
+ }
+}
+
+Vector<int> AnimationNodeBlendSpace2D::_get_triangles() const {
+
+ Vector<int> t;
+ if (auto_triangles && trianges_dirty)
+ return t;
+
+ t.resize(triangles.size() * 3);
+ for (int i = 0; i < triangles.size(); i++) {
+ t[i * 3 + 0] = triangles[i].points[0];
+ t[i * 3 + 1] = triangles[i].points[1];
+ t[i * 3 + 2] = triangles[i].points[2];
+ }
+ return t;
+}
+
+void AnimationNodeBlendSpace2D::_update_triangles() {
+
+ if (!auto_triangles || !trianges_dirty)
+ return;
+
+ trianges_dirty = false;
+ triangles.clear();
+ if (blend_points_used < 3)
+ return;
+
+ Vector<Vector2> points;
+ points.resize(blend_points_used);
+ for (int i = 0; i < blend_points_used; i++) {
+ points[i] = blend_points[i].position;
+ }
+
+ Vector<Delaunay2D::Triangle> triangles = Delaunay2D::triangulate(points);
+
+ for (int i = 0; i < triangles.size(); i++) {
+ add_triangle(triangles[i].points[0], triangles[i].points[1], triangles[i].points[2]);
+ }
+}
+
+Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
+
+ _update_triangles();
+
+ if (triangles.size() == 0)
+ return Vector2();
+
+ Vector2 best_point;
+ bool first = true;
+
+ for (int i = 0; i < triangles.size(); i++) {
+ Vector2 points[3];
+ for (int j = 0; j < 3; j++) {
+ points[j] = get_blend_point_position(get_triangle_point(i, j));
+ }
+
+ if (Geometry::is_point_in_triangle(p_point, points[0], points[1], points[2])) {
+
+ return p_point;
+ }
+
+ for (int j = 0; j < 3; j++) {
+ Vector2 s[2] = {
+ points[j],
+ points[(j + 1) % 3]
+ };
+ Vector2 closest = Geometry::get_closest_point_to_segment_2d(p_point, s);
+ if (first || closest.distance_to(p_point) < best_point.distance_to(p_point)) {
+ best_point = closest;
+ first = false;
+ }
+ }
+ }
+
+ return best_point;
+}
+
+void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vector2 *p_points, float *r_weights) {
+
+ if (p_pos.distance_squared_to(p_points[0]) < CMP_EPSILON2) {
+ r_weights[0] = 1;
+ r_weights[1] = 0;
+ r_weights[2] = 0;
+ return;
+ }
+ if (p_pos.distance_squared_to(p_points[1]) < CMP_EPSILON2) {
+ r_weights[0] = 0;
+ r_weights[1] = 1;
+ r_weights[2] = 0;
+ return;
+ }
+ if (p_pos.distance_squared_to(p_points[2]) < CMP_EPSILON2) {
+ r_weights[0] = 0;
+ r_weights[1] = 0;
+ r_weights[2] = 1;
+ return;
+ }
+
+ Vector2 v0 = p_points[1] - p_points[0];
+ Vector2 v1 = p_points[2] - p_points[0];
+ Vector2 v2 = p_pos - p_points[0];
+
+ float d00 = v0.dot(v0);
+ float d01 = v0.dot(v1);
+ float d11 = v1.dot(v1);
+ float d20 = v2.dot(v0);
+ float d21 = v2.dot(v1);
+ float denom = (d00 * d11 - d01 * d01);
+ if (denom == 0) {
+ r_weights[0] = 1;
+ r_weights[1] = 0;
+ r_weights[2] = 0;
+ return;
+ }
+ float v = (d11 * d20 - d01 * d21) / denom;
+ float w = (d00 * d21 - d01 * d20) / denom;
+ float u = 1.0f - v - w;
+
+ r_weights[0] = u;
+ r_weights[1] = v;
+ r_weights[2] = w;
+}
+
+float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
+
+ _update_triangles();
+
+ if (triangles.size() == 0)
+ return 0;
+
+ Vector2 best_point;
+ bool first = true;
+ int blend_triangle = -1;
+ float blend_weights[3] = { 0, 0, 0 };
+
+ for (int i = 0; i < triangles.size(); i++) {
+ Vector2 points[3];
+ for (int j = 0; j < 3; j++) {
+ points[j] = get_blend_point_position(get_triangle_point(i, j));
+ }
+
+ if (Geometry::is_point_in_triangle(blend_pos, points[0], points[1], points[2])) {
+
+ blend_triangle = i;
+ _blend_triangle(blend_pos, points, blend_weights);
+ break;
+ }
+
+ for (int j = 0; j < 3; j++) {
+ Vector2 s[2] = {
+ points[j],
+ points[(j + 1) % 3]
+ };
+ Vector2 closest = Geometry::get_closest_point_to_segment_2d(blend_pos, s);
+ if (first || closest.distance_to(blend_pos) < best_point.distance_to(blend_pos)) {
+ best_point = closest;
+ blend_triangle = i;
+ first = false;
+ float d = s[0].distance_to(s[1]);
+ if (d == 0.0) {
+ blend_weights[j] = 1.0;
+ blend_weights[(j + 1) % 3] = 0.0;
+ blend_weights[(j + 2) % 3] = 0.0;
+ } else {
+ float c = s[0].distance_to(closest) / d;
+
+ blend_weights[j] = 1.0 - c;
+ blend_weights[(j + 1) % 3] = c;
+ blend_weights[(j + 2) % 3] = 0.0;
+ }
+ }
+ }
+ }
+
+ ERR_FAIL_COND_V(blend_triangle == -1, 0); //should never reach here
+
+ int triangle_points[3];
+ for (int j = 0; j < 3; j++) {
+ triangle_points[j] = get_triangle_point(blend_triangle, j);
+ }
+
+ first = true;
+ float mind;
+ for (int i = 0; i < blend_points_used; i++) {
+
+ bool found = false;
+ for (int j = 0; j < 3; j++) {
+ if (i == triangle_points[j]) {
+ //blend with the given weight
+ float t = blend_node(blend_points[i].node, p_time, p_seek, blend_weights[j], FILTER_IGNORE, false);
+ if (first || t < mind) {
+ mind = t;
+ first = false;
+ }
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ //ignore
+ blend_node(blend_points[i].node, p_time, p_seek, 0, FILTER_IGNORE, false);
+ }
+ }
+ return mind;
+}
+
+String AnimationNodeBlendSpace2D::get_caption() const {
+ return "BlendSpace2D";
+}
+
+void AnimationNodeBlendSpace2D::_validate_property(PropertyInfo &property) const {
+ if (property.name.begins_with("blend_point_")) {
+ String left = property.name.get_slicec('/', 0);
+ int idx = left.get_slicec('_', 2).to_int();
+ if (idx >= blend_points_used) {
+ property.usage = 0;
+ }
+ }
+ AnimationRootNode::_validate_property(property);
+}
+
+void AnimationNodeBlendSpace2D::set_auto_triangles(bool p_enable) {
+ auto_triangles = p_enable;
+ if (auto_triangles) {
+ trianges_dirty = true;
+ }
+}
+
+bool AnimationNodeBlendSpace2D::get_auto_triangles() const {
+ return auto_triangles;
+}
+
+void AnimationNodeBlendSpace2D::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("add_blend_point", "node", "pos", "at_index"), &AnimationNodeBlendSpace2D::add_blend_point, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("set_blend_point_position", "point", "pos"), &AnimationNodeBlendSpace2D::set_blend_point_position);
+ ClassDB::bind_method(D_METHOD("get_blend_point_position", "point"), &AnimationNodeBlendSpace2D::get_blend_point_position);
+ ClassDB::bind_method(D_METHOD("set_blend_point_node", "point", "node"), &AnimationNodeBlendSpace2D::set_blend_point_node);
+ ClassDB::bind_method(D_METHOD("get_blend_point_node", "point"), &AnimationNodeBlendSpace2D::get_blend_point_node);
+ ClassDB::bind_method(D_METHOD("remove_blend_point", "point"), &AnimationNodeBlendSpace2D::remove_blend_point);
+ ClassDB::bind_method(D_METHOD("get_blend_point_count"), &AnimationNodeBlendSpace2D::get_blend_point_count);
+
+ ClassDB::bind_method(D_METHOD("add_triangle", "x", "y", "z", "at_index"), &AnimationNodeBlendSpace2D::add_triangle, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("get_triangle_point", "triangle", "point"), &AnimationNodeBlendSpace2D::get_triangle_point);
+ ClassDB::bind_method(D_METHOD("remove_triangle", "triangle"), &AnimationNodeBlendSpace2D::remove_triangle);
+ ClassDB::bind_method(D_METHOD("get_triangle_count"), &AnimationNodeBlendSpace2D::get_triangle_count);
+
+ ClassDB::bind_method(D_METHOD("set_min_space", "min_space"), &AnimationNodeBlendSpace2D::set_min_space);
+ ClassDB::bind_method(D_METHOD("get_min_space"), &AnimationNodeBlendSpace2D::get_min_space);
+
+ ClassDB::bind_method(D_METHOD("set_max_space", "max_space"), &AnimationNodeBlendSpace2D::set_max_space);
+ ClassDB::bind_method(D_METHOD("get_max_space"), &AnimationNodeBlendSpace2D::get_max_space);
+
+ ClassDB::bind_method(D_METHOD("set_snap", "snap"), &AnimationNodeBlendSpace2D::set_snap);
+ ClassDB::bind_method(D_METHOD("get_snap"), &AnimationNodeBlendSpace2D::get_snap);
+
+ ClassDB::bind_method(D_METHOD("set_blend_position", "pos"), &AnimationNodeBlendSpace2D::set_blend_position);
+ ClassDB::bind_method(D_METHOD("get_blend_position"), &AnimationNodeBlendSpace2D::get_blend_position);
+
+ ClassDB::bind_method(D_METHOD("set_x_label", "text"), &AnimationNodeBlendSpace2D::set_x_label);
+ ClassDB::bind_method(D_METHOD("get_x_label"), &AnimationNodeBlendSpace2D::get_x_label);
+
+ ClassDB::bind_method(D_METHOD("set_y_label", "text"), &AnimationNodeBlendSpace2D::set_y_label);
+ ClassDB::bind_method(D_METHOD("get_y_label"), &AnimationNodeBlendSpace2D::get_y_label);
+
+ ClassDB::bind_method(D_METHOD("_add_blend_point", "index", "node"), &AnimationNodeBlendSpace2D::_add_blend_point);
+
+ ClassDB::bind_method(D_METHOD("_set_triangles", "triangles"), &AnimationNodeBlendSpace2D::_set_triangles);
+ ClassDB::bind_method(D_METHOD("_get_triangles"), &AnimationNodeBlendSpace2D::_get_triangles);
+
+ ClassDB::bind_method(D_METHOD("set_auto_triangles", "enable"), &AnimationNodeBlendSpace2D::set_auto_triangles);
+ ClassDB::bind_method(D_METHOD("get_auto_triangles"), &AnimationNodeBlendSpace2D::get_auto_triangles);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_triangles", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_auto_triangles", "get_auto_triangles");
+
+ for (int i = 0; i < MAX_BLEND_POINTS; i++) {
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "blend_point_" + itos(i) + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "_add_blend_point", "get_blend_point_node", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::VECTOR2, "blend_point_" + itos(i) + "/pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_blend_point_position", "get_blend_point_position", i);
+ }
+
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "triangles", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_triangles", "_get_triangles");
+
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "min_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_min_space", "get_min_space");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "max_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_max_space", "get_max_space");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "snap", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_snap", "get_snap");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "blend_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_blend_position", "get_blend_position");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "x_label", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_x_label", "get_x_label");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "y_label", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_y_label", "get_y_label");
+}
+
+AnimationNodeBlendSpace2D::AnimationNodeBlendSpace2D() {
+
+ auto_triangles = true;
+ blend_points_used = 0;
+ max_space = Vector2(1, 1);
+ min_space = Vector2(-1, -1);
+ snap = Vector2(0.1, 0.1);
+ x_label = "x";
+ y_label = "y";
+ trianges_dirty = false;
+}
+
+AnimationNodeBlendSpace2D::~AnimationNodeBlendSpace2D() {
+
+ for (int i = 0; i < blend_points_used; i++) {
+ blend_points[i].node->set_parent(this);
+ blend_points[i].node->set_tree(get_tree());
+ }
+}
diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h
new file mode 100644
index 0000000000..4778299df1
--- /dev/null
+++ b/scene/animation/animation_blend_space_2d.h
@@ -0,0 +1,97 @@
+#ifndef ANIMATION_BLEND_SPACE_2D_H
+#define ANIMATION_BLEND_SPACE_2D_H
+
+#include "scene/animation/animation_tree.h"
+
+class AnimationNodeBlendSpace2D : public AnimationRootNode {
+ GDCLASS(AnimationNodeBlendSpace2D, AnimationRootNode)
+
+ enum {
+ MAX_BLEND_POINTS = 64
+ };
+
+ struct BlendPoint {
+ Ref<AnimationRootNode> node;
+ Vector2 position;
+ };
+
+ BlendPoint blend_points[MAX_BLEND_POINTS];
+ int blend_points_used;
+
+ struct BlendTriangle {
+ int points[3];
+ };
+
+ Vector<BlendTriangle> triangles;
+
+ Vector2 blend_pos;
+ Vector2 max_space;
+ Vector2 min_space;
+ Vector2 snap;
+ String x_label;
+ String y_label;
+
+ void _add_blend_point(int p_index, const Ref<AnimationRootNode> &p_node);
+ void _set_triangles(const Vector<int> &p_triangles);
+ Vector<int> _get_triangles() const;
+
+ void _blend_triangle(const Vector2 &p_pos, const Vector2 *p_points, float *r_weights);
+
+ bool auto_triangles;
+ bool trianges_dirty;
+
+ void _update_triangles();
+
+protected:
+ virtual void _validate_property(PropertyInfo &property) const;
+ static void _bind_methods();
+
+public:
+
+ virtual void set_tree(AnimationTree *p_player);
+
+ void add_blend_point(const Ref<AnimationRootNode> &p_node, const Vector2 &p_position, int p_at_index = -1);
+ void set_blend_point_position(int p_point, const Vector2 &p_position);
+ void set_blend_point_node(int p_point, const Ref<AnimationRootNode> &p_node);
+ Vector2 get_blend_point_position(int p_point) const;
+ Ref<AnimationRootNode> get_blend_point_node(int p_point) const;
+ void remove_blend_point(int p_point);
+ int get_blend_point_count() const;
+
+ bool has_triangle(int p_x, int p_y, int p_z) const;
+ void add_triangle(int p_x, int p_y, int p_z, int p_at_index = -1);
+ int get_triangle_point(int p_triangle, int p_point);
+ void remove_triangle(int p_triangle);
+ int get_triangle_count() const;
+
+ void set_min_space(const Vector2 &p_min);
+ Vector2 get_min_space() const;
+
+ void set_max_space(const Vector2 &p_max);
+ Vector2 get_max_space() const;
+
+ void set_snap(const Vector2 &p_snap);
+ Vector2 get_snap() const;
+
+ void set_blend_position(const Vector2 &p_pos);
+ Vector2 get_blend_position() const;
+
+ void set_x_label(const String &p_label);
+ String get_x_label() const;
+
+ void set_y_label(const String &p_label);
+ String get_y_label() const;
+
+ virtual float process(float p_time, bool p_seek);
+ virtual String get_caption() const;
+
+ Vector2 get_closest_point(const Vector2 &p_point);
+
+ void set_auto_triangles(bool p_enable);
+ bool get_auto_triangles() const;
+
+ AnimationNodeBlendSpace2D();
+ ~AnimationNodeBlendSpace2D();
+};
+
+#endif // ANIMATION_BLEND_SPACE_2D_H
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
new file mode 100644
index 0000000000..6dcd5ca8ea
--- /dev/null
+++ b/scene/animation/animation_blend_tree.cpp
@@ -0,0 +1,1170 @@
+#include "animation_blend_tree.h"
+#include "scene/scene_string_names.h"
+
+void AnimationNodeAnimation::set_animation(const StringName &p_name) {
+ animation = p_name;
+}
+
+StringName AnimationNodeAnimation::get_animation() const {
+ return animation;
+}
+
+float AnimationNodeAnimation::get_playback_time() const {
+ return time;
+}
+
+void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const {
+
+ if (property.name == "animation") {
+ AnimationTree *gp = get_tree();
+ if (gp && gp->has_node(gp->get_animation_player())) {
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(gp->get_node(gp->get_animation_player()));
+ if (ap) {
+ List<StringName> names;
+ ap->get_animation_list(&names);
+ String anims;
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ if (E != names.front()) {
+ anims += ",";
+ }
+ anims += String(E->get());
+ }
+ if (anims != String()) {
+ property.hint = PROPERTY_HINT_ENUM;
+ property.hint_string = anims;
+ }
+ }
+ }
+ }
+
+ AnimationRootNode::_validate_property(property);
+}
+
+float AnimationNodeAnimation::process(float p_time, bool p_seek) {
+
+ AnimationPlayer *ap = get_player();
+ ERR_FAIL_COND_V(!ap, 0);
+
+ Ref<Animation> anim = ap->get_animation(animation);
+ if (!anim.is_valid()) {
+
+ Ref<AnimationNodeBlendTree> tree = get_parent();
+ if (tree.is_valid()) {
+ String name = tree->get_node_name(Ref<AnimationNodeAnimation>(this));
+ make_invalid(vformat(RTR("On BlendTree node '%s', animation not found: '%s'"), name, animation));
+
+ } else {
+ make_invalid(vformat(RTR("Animation not found: '%s'"), animation));
+ }
+
+ return 0;
+ }
+
+ if (p_seek) {
+ time = p_time;
+ step = 0;
+ } else {
+ time = MAX(0, time + p_time);
+ step = p_time;
+ }
+
+ float anim_size = anim->get_length();
+
+ if (anim->has_loop()) {
+
+ if (anim_size) {
+ time = Math::fposmod(time, anim_size);
+ }
+
+ } else if (time > anim_size) {
+
+ time = anim_size;
+ }
+
+ blend_animation(animation, time, step, p_seek, 1.0);
+
+ return anim_size - time;
+}
+
+String AnimationNodeAnimation::get_caption() const {
+ return "Animation";
+}
+
+void AnimationNodeAnimation::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_animation", "name"), &AnimationNodeAnimation::set_animation);
+ ClassDB::bind_method(D_METHOD("get_animation"), &AnimationNodeAnimation::get_animation);
+
+ ClassDB::bind_method(D_METHOD("get_playback_time"), &AnimationNodeAnimation::get_playback_time);
+
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "animation"), "set_animation", "get_animation");
+}
+
+AnimationNodeAnimation::AnimationNodeAnimation() {
+ last_version = 0;
+ skip = false;
+ time = 0;
+ step = 0;
+}
+
+////////////////////////////////////////////////////////
+
+void AnimationNodeOneShot::set_fadein_time(float p_time) {
+
+ fade_in = p_time;
+}
+
+void AnimationNodeOneShot::set_fadeout_time(float p_time) {
+
+ fade_out = p_time;
+}
+
+float AnimationNodeOneShot::get_fadein_time() const {
+
+ return fade_in;
+}
+float AnimationNodeOneShot::get_fadeout_time() const {
+
+ return fade_out;
+}
+
+void AnimationNodeOneShot::set_autorestart(bool p_active) {
+
+ autorestart = p_active;
+}
+void AnimationNodeOneShot::set_autorestart_delay(float p_time) {
+
+ autorestart_delay = p_time;
+}
+void AnimationNodeOneShot::set_autorestart_random_delay(float p_time) {
+
+ autorestart_random_delay = p_time;
+}
+
+bool AnimationNodeOneShot::has_autorestart() const {
+
+ return autorestart;
+}
+float AnimationNodeOneShot::get_autorestart_delay() const {
+
+ return autorestart_delay;
+}
+float AnimationNodeOneShot::get_autorestart_random_delay() const {
+
+ return autorestart_random_delay;
+}
+
+void AnimationNodeOneShot::set_mix_mode(MixMode p_mix) {
+
+ mix = p_mix;
+}
+AnimationNodeOneShot::MixMode AnimationNodeOneShot::get_mix_mode() const {
+
+ return mix;
+}
+
+void AnimationNodeOneShot::start() {
+ active = true;
+ do_start = true;
+}
+void AnimationNodeOneShot::stop() {
+ active = false;
+}
+bool AnimationNodeOneShot::is_active() const {
+
+ return active;
+}
+
+String AnimationNodeOneShot::get_caption() const {
+ return "OneShot";
+}
+
+bool AnimationNodeOneShot::has_filter() const {
+ return true;
+}
+
+float AnimationNodeOneShot::process(float p_time, bool p_seek) {
+
+ if (!active) {
+ //make it as if this node doesn't exist, pass input 0 by.
+ return blend_input(0, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
+ }
+
+ bool os_seek = p_seek;
+
+ if (p_seek)
+ time = p_time;
+ if (do_start) {
+ time = 0;
+ os_seek = true;
+ }
+
+ float blend;
+
+ if (time < fade_in) {
+
+ if (fade_in > 0)
+ blend = time / fade_in;
+ else
+ blend = 0; //wtf
+
+ } else if (!do_start && remaining < fade_out) {
+
+ if (fade_out)
+ blend = (remaining / fade_out);
+ else
+ blend = 1.0;
+ } else
+ blend = 1.0;
+
+ float main_rem;
+ if (mix == MIX_MODE_ADD) {
+ main_rem = blend_input(0, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
+ } else {
+ main_rem = blend_input(0, p_time, p_seek, 1.0 - blend, FILTER_BLEND, !sync);
+ }
+
+ float os_rem = blend_input(1, os_seek ? time : p_time, os_seek, blend, FILTER_PASS, false);
+
+ if (do_start) {
+ remaining = os_rem;
+ do_start = false;
+ }
+
+ if (!p_seek) {
+ time += p_time;
+ remaining = os_rem;
+ if (remaining <= 0)
+ active = false;
+ }
+
+ return MAX(main_rem, remaining);
+}
+void AnimationNodeOneShot::set_use_sync(bool p_sync) {
+
+ sync = p_sync;
+}
+
+bool AnimationNodeOneShot::is_using_sync() const {
+
+ return sync;
+}
+
+void AnimationNodeOneShot::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_fadein_time", "time"), &AnimationNodeOneShot::set_fadein_time);
+ ClassDB::bind_method(D_METHOD("get_fadein_time"), &AnimationNodeOneShot::get_fadein_time);
+
+ ClassDB::bind_method(D_METHOD("set_fadeout_time", "time"), &AnimationNodeOneShot::set_fadeout_time);
+ ClassDB::bind_method(D_METHOD("get_fadeout_time"), &AnimationNodeOneShot::get_fadeout_time);
+
+ ClassDB::bind_method(D_METHOD("set_autorestart", "enable"), &AnimationNodeOneShot::set_autorestart);
+ ClassDB::bind_method(D_METHOD("has_autorestart"), &AnimationNodeOneShot::has_autorestart);
+
+ ClassDB::bind_method(D_METHOD("set_autorestart_delay", "enable"), &AnimationNodeOneShot::set_autorestart_delay);
+ ClassDB::bind_method(D_METHOD("get_autorestart_delay"), &AnimationNodeOneShot::get_autorestart_delay);
+
+ ClassDB::bind_method(D_METHOD("set_autorestart_random_delay", "enable"), &AnimationNodeOneShot::set_autorestart_random_delay);
+ ClassDB::bind_method(D_METHOD("get_autorestart_random_delay"), &AnimationNodeOneShot::get_autorestart_random_delay);
+
+ ClassDB::bind_method(D_METHOD("set_mix_mode", "mode"), &AnimationNodeOneShot::set_mix_mode);
+ ClassDB::bind_method(D_METHOD("get_mix_mode"), &AnimationNodeOneShot::get_mix_mode);
+
+ ClassDB::bind_method(D_METHOD("start"), &AnimationNodeOneShot::start);
+ ClassDB::bind_method(D_METHOD("stop"), &AnimationNodeOneShot::stop);
+ ClassDB::bind_method(D_METHOD("is_active"), &AnimationNodeOneShot::is_active);
+
+ ClassDB::bind_method(D_METHOD("set_use_sync", "enable"), &AnimationNodeOneShot::set_use_sync);
+ ClassDB::bind_method(D_METHOD("is_using_sync"), &AnimationNodeOneShot::is_using_sync);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "fadein_time", PROPERTY_HINT_RANGE, "0,60,0.01,or_greater"), "set_fadein_time", "get_fadein_time");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "fadeout_time", PROPERTY_HINT_RANGE, "0,60,0.01,or_greater"), "set_fadeout_time", "get_fadeout_time");
+
+ ADD_GROUP("autorestart_", "Auto Restart");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autorestart"), "set_autorestart", "has_autorestart");
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "autorestart_delay", PROPERTY_HINT_RANGE, "0,60,0.01,or_greater"), "set_autorestart_delay", "get_autorestart_delay");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "autorestart_random_delay", PROPERTY_HINT_RANGE, "0,60,0.01,or_greater"), "set_autorestart_random_delay", "get_autorestart_random_delay");
+
+ ADD_GROUP("", "");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync"), "set_use_sync", "is_using_sync");
+
+ BIND_CONSTANT(MIX_MODE_BLEND)
+ BIND_CONSTANT(MIX_MODE_ADD)
+}
+
+AnimationNodeOneShot::AnimationNodeOneShot() {
+
+ add_input("in");
+ add_input("shot");
+
+ time = 0;
+ fade_in = 0.1;
+ fade_out = 0.1;
+ autorestart = false;
+ autorestart_delay = 1;
+ autorestart_remaining = 0;
+ mix = MIX_MODE_BLEND;
+ active = false;
+ do_start = false;
+ sync = false;
+}
+
+////////////////////////////////////////////////
+
+void AnimationNodeAdd2::set_amount(float p_amount) {
+ amount = p_amount;
+}
+
+float AnimationNodeAdd2::get_amount() const {
+ return amount;
+}
+
+String AnimationNodeAdd2::get_caption() const {
+ return "Add2";
+}
+void AnimationNodeAdd2::set_use_sync(bool p_sync) {
+
+ sync = p_sync;
+}
+
+bool AnimationNodeAdd2::is_using_sync() const {
+
+ return sync;
+}
+
+bool AnimationNodeAdd2::has_filter() const {
+
+ return true;
+}
+
+float AnimationNodeAdd2::process(float p_time, bool p_seek) {
+
+ float rem0 = blend_input(0, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
+ blend_input(1, p_time, p_seek, amount, FILTER_PASS, !sync);
+
+ return rem0;
+}
+
+void AnimationNodeAdd2::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_amount", "amount"), &AnimationNodeAdd2::set_amount);
+ ClassDB::bind_method(D_METHOD("get_amount"), &AnimationNodeAdd2::get_amount);
+
+ ClassDB::bind_method(D_METHOD("set_use_sync", "enable"), &AnimationNodeAdd2::set_use_sync);
+ ClassDB::bind_method(D_METHOD("is_using_sync"), &AnimationNodeAdd2::is_using_sync);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync"), "set_use_sync", "is_using_sync");
+}
+
+AnimationNodeAdd2::AnimationNodeAdd2() {
+
+ add_input("in");
+ add_input("add");
+ amount = 0;
+ sync = false;
+}
+
+////////////////////////////////////////////////
+
+void AnimationNodeAdd3::set_amount(float p_amount) {
+ amount = p_amount;
+}
+
+float AnimationNodeAdd3::get_amount() const {
+ return amount;
+}
+
+String AnimationNodeAdd3::get_caption() const {
+ return "Add3";
+}
+void AnimationNodeAdd3::set_use_sync(bool p_sync) {
+
+ sync = p_sync;
+}
+
+bool AnimationNodeAdd3::is_using_sync() const {
+
+ return sync;
+}
+
+bool AnimationNodeAdd3::has_filter() const {
+
+ return true;
+}
+
+float AnimationNodeAdd3::process(float p_time, bool p_seek) {
+
+ blend_input(0, p_time, p_seek, MAX(0, -amount), FILTER_PASS, !sync);
+ float rem0 = blend_input(1, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
+ blend_input(2, p_time, p_seek, MAX(0, amount), FILTER_PASS, !sync);
+
+ return rem0;
+}
+
+void AnimationNodeAdd3::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_amount", "amount"), &AnimationNodeAdd3::set_amount);
+ ClassDB::bind_method(D_METHOD("get_amount"), &AnimationNodeAdd3::get_amount);
+
+ ClassDB::bind_method(D_METHOD("set_use_sync", "enable"), &AnimationNodeAdd3::set_use_sync);
+ ClassDB::bind_method(D_METHOD("is_using_sync"), &AnimationNodeAdd3::is_using_sync);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "amount", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync"), "set_use_sync", "is_using_sync");
+}
+
+AnimationNodeAdd3::AnimationNodeAdd3() {
+
+ add_input("-add");
+ add_input("in");
+ add_input("+add");
+ amount = 0;
+ sync = false;
+}
+/////////////////////////////////////////////
+
+void AnimationNodeBlend2::set_amount(float p_amount) {
+ amount = p_amount;
+}
+
+float AnimationNodeBlend2::get_amount() const {
+ return amount;
+}
+String AnimationNodeBlend2::get_caption() const {
+ return "Blend2";
+}
+
+float AnimationNodeBlend2::process(float p_time, bool p_seek) {
+
+ float rem0 = blend_input(0, p_time, p_seek, 1.0 - amount, FILTER_BLEND, !sync);
+ float rem1 = blend_input(1, p_time, p_seek, amount, FILTER_PASS, !sync);
+
+ return amount > 0.5 ? rem1 : rem0; //hacky but good enough
+}
+
+void AnimationNodeBlend2::set_use_sync(bool p_sync) {
+
+ sync = p_sync;
+}
+
+bool AnimationNodeBlend2::is_using_sync() const {
+
+ return sync;
+}
+
+bool AnimationNodeBlend2::has_filter() const {
+
+ return true;
+}
+void AnimationNodeBlend2::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_amount", "amount"), &AnimationNodeBlend2::set_amount);
+ ClassDB::bind_method(D_METHOD("get_amount"), &AnimationNodeBlend2::get_amount);
+
+ ClassDB::bind_method(D_METHOD("set_use_sync", "enable"), &AnimationNodeBlend2::set_use_sync);
+ ClassDB::bind_method(D_METHOD("is_using_sync"), &AnimationNodeBlend2::is_using_sync);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "amount", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync"), "set_use_sync", "is_using_sync");
+}
+AnimationNodeBlend2::AnimationNodeBlend2() {
+ add_input("in");
+ add_input("blend");
+ sync = false;
+
+ amount = 0;
+}
+
+//////////////////////////////////////
+
+void AnimationNodeBlend3::set_amount(float p_amount) {
+ amount = p_amount;
+}
+
+float AnimationNodeBlend3::get_amount() const {
+ return amount;
+}
+
+String AnimationNodeBlend3::get_caption() const {
+ return "Blend3";
+}
+
+void AnimationNodeBlend3::set_use_sync(bool p_sync) {
+
+ sync = p_sync;
+}
+
+bool AnimationNodeBlend3::is_using_sync() const {
+
+ return sync;
+}
+
+float AnimationNodeBlend3::process(float p_time, bool p_seek) {
+
+ float rem0 = blend_input(0, p_time, p_seek, MAX(0, -amount), FILTER_IGNORE, !sync);
+ float rem1 = blend_input(1, p_time, p_seek, 1.0 - ABS(amount), FILTER_IGNORE, !sync);
+ float rem2 = blend_input(2, p_time, p_seek, MAX(0, amount), FILTER_IGNORE, !sync);
+
+ return amount > 0.5 ? rem2 : (amount < -0.5 ? rem0 : rem1); //hacky but good enough
+}
+
+void AnimationNodeBlend3::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_amount", "amount"), &AnimationNodeBlend3::set_amount);
+ ClassDB::bind_method(D_METHOD("get_amount"), &AnimationNodeBlend3::get_amount);
+
+ ClassDB::bind_method(D_METHOD("set_use_sync", "enable"), &AnimationNodeBlend3::set_use_sync);
+ ClassDB::bind_method(D_METHOD("is_using_sync"), &AnimationNodeBlend3::is_using_sync);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "amount", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_amount", "get_amount");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sync"), "set_use_sync", "is_using_sync");
+}
+AnimationNodeBlend3::AnimationNodeBlend3() {
+ add_input("-blend");
+ add_input("in");
+ add_input("+blend");
+ sync = false;
+ amount = 0;
+}
+
+/////////////////////////////////
+
+void AnimationNodeTimeScale::set_scale(float p_scale) {
+ scale = p_scale;
+}
+
+float AnimationNodeTimeScale::get_scale() const {
+ return scale;
+}
+
+String AnimationNodeTimeScale::get_caption() const {
+ return "TimeScale";
+}
+
+float AnimationNodeTimeScale::process(float p_time, bool p_seek) {
+
+ if (p_seek) {
+ return blend_input(0, p_time, true, 1.0, FILTER_IGNORE, false);
+ } else {
+ return blend_input(0, p_time * scale, false, 1.0, FILTER_IGNORE, false);
+ }
+}
+
+void AnimationNodeTimeScale::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_scale", "scale"), &AnimationNodeTimeScale::set_scale);
+ ClassDB::bind_method(D_METHOD("get_scale"), &AnimationNodeTimeScale::get_scale);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale", PROPERTY_HINT_RANGE, "0,32,0.01,or_greater"), "set_scale", "get_scale");
+}
+AnimationNodeTimeScale::AnimationNodeTimeScale() {
+ add_input("in");
+ scale = 1.0;
+}
+
+////////////////////////////////////
+
+void AnimationNodeTimeSeek::set_seek_pos(float p_seek_pos) {
+ seek_pos = p_seek_pos;
+}
+
+float AnimationNodeTimeSeek::get_seek_pos() const {
+ return seek_pos;
+}
+
+String AnimationNodeTimeSeek::get_caption() const {
+ return "Seek";
+}
+
+float AnimationNodeTimeSeek::process(float p_time, bool p_seek) {
+
+ if (p_seek) {
+ return blend_input(0, p_time, true, 1.0, FILTER_IGNORE, false);
+ } else if (seek_pos >= 0) {
+ float ret = blend_input(0, seek_pos, true, 1.0, FILTER_IGNORE, false);
+ seek_pos = -1;
+ _change_notify("seek_pos");
+ return ret;
+ } else {
+ return blend_input(0, p_time, false, 1.0, FILTER_IGNORE, false);
+ }
+}
+
+void AnimationNodeTimeSeek::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_seek_pos", "seek_pos"), &AnimationNodeTimeSeek::set_seek_pos);
+ ClassDB::bind_method(D_METHOD("get_seek_pos"), &AnimationNodeTimeSeek::get_seek_pos);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "seek_pos", PROPERTY_HINT_RANGE, "-1,3600,0.01,or_greater"), "set_seek_pos", "get_seek_pos");
+}
+AnimationNodeTimeSeek::AnimationNodeTimeSeek() {
+ add_input("in");
+ seek_pos = -1;
+}
+
+/////////////////////////////////////////////////
+
+String AnimationNodeTransition::get_caption() const {
+ return "Transition";
+}
+
+void AnimationNodeTransition::_update_inputs() {
+ while (get_input_count() < enabled_inputs) {
+ add_input(inputs[get_input_count()].name);
+ }
+
+ while (get_input_count() > enabled_inputs) {
+ remove_input(get_input_count() - 1);
+ }
+}
+
+void AnimationNodeTransition::set_enabled_inputs(int p_inputs) {
+ ERR_FAIL_INDEX(p_inputs, MAX_INPUTS);
+ enabled_inputs = p_inputs;
+ _update_inputs();
+}
+
+int AnimationNodeTransition::get_enabled_inputs() {
+ return enabled_inputs;
+}
+
+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;
+}
+
+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;
+}
+
+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);
+}
+
+String AnimationNodeTransition::get_input_caption(int p_input) const {
+ ERR_FAIL_INDEX_V(p_input, MAX_INPUTS, String());
+ return inputs[p_input].name;
+}
+
+void AnimationNodeTransition::set_current(int p_current) {
+
+ if (current == p_current)
+ return;
+ ERR_FAIL_INDEX(p_current, enabled_inputs);
+
+ Ref<AnimationNodeBlendTree> tree = get_parent();
+
+ if (tree.is_valid() && current >= 0) {
+ prev = current;
+ prev_xfading = xfade;
+ prev_time = time;
+ time = 0;
+ current = p_current;
+ switched = true;
+ _change_notify("current");
+ } else {
+ current = p_current;
+ }
+}
+
+int AnimationNodeTransition::get_current() const {
+ return current;
+}
+void AnimationNodeTransition::set_cross_fade_time(float p_fade) {
+ xfade = p_fade;
+}
+
+float AnimationNodeTransition::get_cross_fade_time() const {
+ return xfade;
+}
+
+float AnimationNodeTransition::process(float p_time, bool p_seek) {
+
+ if (prev < 0) { // process current animation, check for transition
+
+ float rem = blend_input(current, p_time, p_seek, 1.0, FILTER_IGNORE, false);
+
+ if (p_seek)
+ time = p_time;
+ else
+ time += p_time;
+
+ if (inputs[current].auto_advance && rem <= xfade) {
+
+ set_current((current + 1) % enabled_inputs);
+ }
+
+ return rem;
+ } else { // cross-fading from prev to current
+
+ float blend = xfade ? (prev_xfading / xfade) : 1;
+
+ float rem;
+
+ if (!p_seek && switched) { //just switched, seek to start of current
+
+ rem = blend_input(current, 0, true, 1.0 - blend, FILTER_IGNORE, false);
+ } else {
+
+ rem = blend_input(current, p_time, p_seek, 1.0 - blend, FILTER_IGNORE, false);
+ }
+
+ switched = false;
+
+ if (p_seek) { // don't seek prev animation
+ blend_input(prev, 0, false, blend, FILTER_IGNORE, false);
+ time = p_time;
+ } else {
+ blend_input(prev, p_time, false, blend, FILTER_IGNORE, false);
+ time += p_time;
+ prev_xfading -= p_time;
+ if (prev_xfading < 0) {
+ prev = -1;
+ }
+ }
+
+ return rem;
+ }
+}
+
+void AnimationNodeTransition::_validate_property(PropertyInfo &property) const {
+
+ if (property.name == "current" && enabled_inputs > 0) {
+ property.hint = PROPERTY_HINT_ENUM;
+ String anims;
+ for (int i = 0; i < enabled_inputs; i++) {
+ if (i > 0) {
+ anims += ",";
+ }
+ anims += inputs[i].name;
+ }
+ property.hint_string = anims;
+ }
+
+ if (property.name.begins_with("input_")) {
+ String n = property.name.get_slicec('/', 0).get_slicec('_', 1);
+ if (n != "count") {
+ int idx = n.to_int();
+ if (idx >= enabled_inputs) {
+ property.usage = 0;
+ }
+ }
+ }
+
+ AnimationNode::_validate_property(property);
+}
+
+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_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_current", "index"), &AnimationNodeTransition::set_current);
+ ClassDB::bind_method(D_METHOD("get_current"), &AnimationNodeTransition::get_current);
+
+ ClassDB::bind_method(D_METHOD("set_cross_fade_time", "time"), &AnimationNodeTransition::set_cross_fade_time);
+ ClassDB::bind_method(D_METHOD("get_cross_fade_time"), &AnimationNodeTransition::get_cross_fade_time);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "input_count", 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::INT, "current", PROPERTY_HINT_RANGE, "0,64,1"), "set_current", "get_current");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "xfade_time", PROPERTY_HINT_RANGE, "0,120,0.01"), "set_cross_fade_time", "get_cross_fade_time");
+
+ for (int i = 0; i < MAX_INPUTS; i++) {
+ ADD_PROPERTYI(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name"), "set_input_caption", "get_input_caption", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance"), "set_input_as_auto_advance", "is_input_set_as_auto_advance", i);
+ }
+}
+
+AnimationNodeTransition::AnimationNodeTransition() {
+ enabled_inputs = 0;
+ xfade = 0;
+ current = -1;
+ prev = -1;
+ prev_time = 0;
+ prev_xfading = 0;
+ switched = false;
+ for (int i = 0; i < MAX_INPUTS; i++) {
+ inputs[i].auto_advance = false;
+ inputs[i].name = itos(i + 1);
+ }
+}
+
+/////////////////////
+
+String AnimationNodeOutput::get_caption() const {
+ return "Output";
+}
+
+float AnimationNodeOutput::process(float p_time, bool p_seek) {
+ return blend_input(0, p_time, p_seek, 1.0);
+}
+
+AnimationNodeOutput::AnimationNodeOutput() {
+ add_input("output");
+}
+
+///////////////////////////////////////////////////////
+void AnimationNodeBlendTree::add_node(const StringName &p_name, Ref<AnimationNode> p_node) {
+
+ ERR_FAIL_COND(nodes.has(p_name));
+ ERR_FAIL_COND(p_node.is_null());
+ ERR_FAIL_COND(p_node->get_parent().is_valid());
+ ERR_FAIL_COND(p_node->get_tree() != NULL);
+ ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output);
+ ERR_FAIL_COND(String(p_name).find("/") != -1);
+ nodes[p_name] = p_node;
+
+ p_node->set_parent(this);
+ p_node->set_tree(get_tree());
+
+ emit_changed();
+}
+
+Ref<AnimationNode> AnimationNodeBlendTree::get_node(const StringName &p_name) const {
+
+ ERR_FAIL_COND_V(!nodes.has(p_name), Ref<AnimationNode>());
+
+ return nodes[p_name];
+}
+
+StringName AnimationNodeBlendTree::get_node_name(const Ref<AnimationNode> &p_node) const {
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ if (E->get() == p_node) {
+ return E->key();
+ }
+ }
+
+ ERR_FAIL_V(StringName());
+}
+bool AnimationNodeBlendTree::has_node(const StringName &p_name) const {
+ return nodes.has(p_name);
+}
+void AnimationNodeBlendTree::remove_node(const StringName &p_name) {
+
+ ERR_FAIL_COND(!nodes.has(p_name));
+ ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output); //can't delete output
+
+ {
+ //erase node connections
+ Ref<AnimationNode> node = nodes[p_name];
+ for (int i = 0; i < node->get_input_count(); i++) {
+ node->set_input_connection(i, StringName());
+ }
+ node->set_parent(NULL);
+ node->set_tree(NULL);
+ }
+
+ nodes.erase(p_name);
+
+ //erase connections to name
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ Ref<AnimationNode> node = E->get();
+ for (int i = 0; i < node->get_input_count(); i++) {
+ if (node->get_input_connection(i) == p_name) {
+ node->set_input_connection(i, StringName());
+ }
+ }
+ }
+
+ emit_changed();
+}
+
+void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringName &p_new_name) {
+
+ ERR_FAIL_COND(!nodes.has(p_name));
+ ERR_FAIL_COND(nodes.has(p_new_name));
+ ERR_FAIL_COND(p_name == SceneStringNames::get_singleton()->output);
+ ERR_FAIL_COND(p_new_name == SceneStringNames::get_singleton()->output);
+
+ nodes[p_new_name] = nodes[p_name];
+ nodes.erase(p_name);
+
+ //rename connections
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ Ref<AnimationNode> node = E->get();
+ for (int i = 0; i < node->get_input_count(); i++) {
+ if (node->get_input_connection(i) == p_name) {
+ node->set_input_connection(i, p_new_name);
+ }
+ }
+ }
+}
+
+void AnimationNodeBlendTree::connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) {
+
+ ERR_FAIL_COND(!nodes.has(p_output_node));
+ ERR_FAIL_COND(!nodes.has(p_input_node));
+ ERR_FAIL_COND(p_output_node == SceneStringNames::get_singleton()->output);
+ ERR_FAIL_COND(p_input_node == p_output_node);
+
+ Ref<AnimationNode> input = nodes[p_input_node];
+ ERR_FAIL_INDEX(p_input_index, input->get_input_count());
+
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ Ref<AnimationNode> node = E->get();
+ for (int i = 0; i < node->get_input_count(); i++) {
+ StringName output = node->get_input_connection(i);
+ ERR_FAIL_COND(output == p_output_node);
+ }
+ }
+
+ input->set_input_connection(p_input_index, p_output_node);
+ emit_changed();
+}
+
+void AnimationNodeBlendTree::disconnect_node(const StringName &p_node, int p_input_index) {
+
+ ERR_FAIL_COND(!nodes.has(p_node));
+
+ Ref<AnimationNode> input = nodes[p_node];
+ ERR_FAIL_INDEX(p_input_index, input->get_input_count());
+
+ input->set_input_connection(p_input_index, StringName());
+}
+
+float AnimationNodeBlendTree::get_connection_activity(const StringName &p_input_node, int p_input_index) const {
+
+ ERR_FAIL_COND_V(!nodes.has(p_input_node), 0);
+
+ Ref<AnimationNode> input = nodes[p_input_node];
+ ERR_FAIL_INDEX_V(p_input_index, input->get_input_count(), 0);
+
+ return input->get_input_activity(p_input_index);
+}
+
+AnimationNodeBlendTree::ConnectionError AnimationNodeBlendTree::can_connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) const {
+
+ if (!nodes.has(p_output_node) || p_output_node == SceneStringNames::get_singleton()->output) {
+ return CONNECTION_ERROR_NO_OUTPUT;
+ }
+
+ if (!nodes.has(p_input_node)) {
+ return CONNECTION_ERROR_NO_INPUT;
+ }
+
+ if (!nodes.has(p_input_node)) {
+ return CONNECTION_ERROR_SAME_NODE;
+ }
+
+ Ref<AnimationNode> input = nodes[p_input_node];
+
+ if (p_input_index < 0 || p_input_index >= input->get_input_count()) {
+ return CONNECTION_ERROR_NO_INPUT_INDEX;
+ }
+
+ if (input->get_input_connection(p_input_index) != StringName()) {
+ return CONNECTION_ERROR_CONNECTION_EXISTS;
+ }
+
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ Ref<AnimationNode> node = E->get();
+ for (int i = 0; i < node->get_input_count(); i++) {
+ StringName output = node->get_input_connection(i);
+ if (output == p_output_node) {
+ return CONNECTION_ERROR_CONNECTION_EXISTS;
+ }
+ }
+ }
+ return CONNECTION_OK;
+}
+
+void AnimationNodeBlendTree::get_node_connections(List<NodeConnection> *r_connections) const {
+
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ Ref<AnimationNode> node = E->get();
+ for (int i = 0; i < node->get_input_count(); i++) {
+ StringName output = node->get_input_connection(i);
+ if (output != StringName()) {
+ NodeConnection nc;
+ nc.input_node = E->key();
+ nc.input_index = i;
+ nc.output_node = output;
+ r_connections->push_back(nc);
+ }
+ }
+ }
+}
+
+String AnimationNodeBlendTree::get_caption() const {
+ return "BlendTree";
+}
+
+float AnimationNodeBlendTree::process(float p_time, bool p_seek) {
+
+ Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output];
+ return blend_node(output, p_time, p_seek, 1.0);
+}
+
+void AnimationNodeBlendTree::get_node_list(List<StringName> *r_list) {
+
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ r_list->push_back(E->key());
+ }
+}
+
+void AnimationNodeBlendTree::set_graph_offset(const Vector2 &p_graph_offset) {
+
+ graph_offset = p_graph_offset;
+}
+
+Vector2 AnimationNodeBlendTree::get_graph_offset() const {
+
+ return graph_offset;
+}
+
+void AnimationNodeBlendTree::set_tree(AnimationTree *p_player) {
+
+ AnimationNode::set_tree(p_player);
+
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ Ref<AnimationNode> node = E->get();
+ node->set_tree(p_player);
+ }
+}
+
+bool AnimationNodeBlendTree::_set(const StringName &p_name, const Variant &p_value) {
+
+ String name = p_name;
+ if (name.begins_with("nodes/")) {
+
+ String node_name = name.get_slicec('/', 1);
+ String what = name.get_slicec('/', 2);
+
+ if (what == "node") {
+ Ref<AnimationNode> anode = p_value;
+ if (anode.is_valid()) {
+ add_node(node_name, p_value);
+ }
+ return true;
+ }
+
+ if (what == "position") {
+
+ if (nodes.has(node_name)) {
+ nodes[node_name]->set_position(p_value);
+ }
+ return true;
+ }
+ } else if (name == "node_connections") {
+
+ Array conns = p_value;
+ ERR_FAIL_COND_V(conns.size() % 3 != 0, false);
+
+ for (int i = 0; i < conns.size(); i += 3) {
+ connect_node(conns[i], conns[i + 1], conns[i + 2]);
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool AnimationNodeBlendTree::_get(const StringName &p_name, Variant &r_ret) const {
+
+ String name = p_name;
+ if (name.begins_with("nodes/")) {
+ String node_name = name.get_slicec('/', 1);
+ String what = name.get_slicec('/', 2);
+
+ if (what == "node") {
+ if (nodes.has(node_name)) {
+ r_ret = nodes[node_name];
+ return true;
+ }
+ }
+
+ if (what == "position") {
+
+ if (nodes.has(node_name)) {
+ r_ret = nodes[node_name]->get_position();
+ return true;
+ }
+ }
+ } else if (name == "node_connections") {
+ List<NodeConnection> nc;
+ get_node_connections(&nc);
+ Array conns;
+ conns.resize(nc.size() * 3);
+
+ int idx = 0;
+ for (List<NodeConnection>::Element *E = nc.front(); E; E = E->next()) {
+ conns[idx * 3 + 0] = E->get().input_node;
+ conns[idx * 3 + 1] = E->get().input_index;
+ conns[idx * 3 + 2] = E->get().output_node;
+ idx++;
+ }
+
+ r_ret = conns;
+ return true;
+ }
+
+ return false;
+}
+void AnimationNodeBlendTree::_get_property_list(List<PropertyInfo> *p_list) const {
+
+ List<StringName> names;
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ names.push_back(E->key());
+ }
+ names.sort_custom<StringName::AlphCompare>();
+
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ String name = E->get();
+ if (name != "output") {
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "nodes/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ }
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "nodes/" + name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ }
+
+ p_list->push_back(PropertyInfo(Variant::ARRAY, "node_connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+}
+
+void AnimationNodeBlendTree::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("add_node", "name", "node"), &AnimationNodeBlendTree::add_node);
+ ClassDB::bind_method(D_METHOD("get_node", "name"), &AnimationNodeBlendTree::get_node);
+ ClassDB::bind_method(D_METHOD("remove_node", "name"), &AnimationNodeBlendTree::remove_node);
+ ClassDB::bind_method(D_METHOD("rename_node", "name", "new_name"), &AnimationNodeBlendTree::rename_node);
+ ClassDB::bind_method(D_METHOD("has_node", "name"), &AnimationNodeBlendTree::has_node);
+ ClassDB::bind_method(D_METHOD("connect_node", "input_node", "input_index", "output_node"), &AnimationNodeBlendTree::connect_node);
+ ClassDB::bind_method(D_METHOD("disconnect_node", "input_node", "input_index"), &AnimationNodeBlendTree::disconnect_node);
+
+ ClassDB::bind_method(D_METHOD("set_graph_offset", "offset"), &AnimationNodeBlendTree::set_graph_offset);
+ ClassDB::bind_method(D_METHOD("get_graph_offset"), &AnimationNodeBlendTree::get_graph_offset);
+
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "graph_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_graph_offset", "get_graph_offset");
+
+ BIND_CONSTANT(CONNECTION_OK);
+ BIND_CONSTANT(CONNECTION_ERROR_NO_INPUT);
+ BIND_CONSTANT(CONNECTION_ERROR_NO_INPUT_INDEX);
+ BIND_CONSTANT(CONNECTION_ERROR_NO_OUTPUT);
+ BIND_CONSTANT(CONNECTION_ERROR_SAME_NODE);
+ BIND_CONSTANT(CONNECTION_ERROR_CONNECTION_EXISTS);
+}
+
+AnimationNodeBlendTree::AnimationNodeBlendTree() {
+
+ Ref<AnimationNodeOutput> output;
+ output.instance();
+ output->set_position(Vector2(300, 150));
+ output->set_parent(this);
+ nodes["output"] = output;
+}
+
+AnimationNodeBlendTree::~AnimationNodeBlendTree() {
+
+ for (Map<StringName, Ref<AnimationNode> >::Element *E = nodes.front(); E; E = E->next()) {
+ E->get()->set_parent(NULL);
+ E->get()->set_tree(NULL);
+ }
+}
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
new file mode 100644
index 0000000000..e86cc2e823
--- /dev/null
+++ b/scene/animation/animation_blend_tree.h
@@ -0,0 +1,352 @@
+#ifndef ANIMATION_BLEND_TREE_H
+#define ANIMATION_BLEND_TREE_H
+
+#include "scene/animation/animation_tree.h"
+
+class AnimationNodeAnimation : public AnimationRootNode {
+
+ GDCLASS(AnimationNodeAnimation, AnimationRootNode);
+
+ StringName animation;
+
+ uint64_t last_version;
+ float time;
+ float step;
+ bool skip;
+
+protected:
+ void _validate_property(PropertyInfo &property) const;
+
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+ virtual float process(float p_time, bool p_seek);
+
+ void set_animation(const StringName &p_name);
+ StringName get_animation() const;
+
+ float get_playback_time() const;
+
+ AnimationNodeAnimation();
+};
+
+class AnimationNodeOneShot : public AnimationNode {
+ GDCLASS(AnimationNodeOneShot, AnimationNode);
+
+public:
+ enum MixMode {
+ MIX_MODE_BLEND,
+ MIX_MODE_ADD
+ };
+
+private:
+ bool active;
+ bool do_start;
+ float fade_in;
+ float fade_out;
+
+ bool autorestart;
+ float autorestart_delay;
+ float autorestart_random_delay;
+ MixMode mix;
+
+ float time;
+ float remaining;
+ float autorestart_remaining;
+ bool sync;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_fadein_time(float p_time);
+ void set_fadeout_time(float p_time);
+
+ float get_fadein_time() const;
+ float get_fadeout_time() const;
+
+ void set_autorestart(bool p_active);
+ void set_autorestart_delay(float p_time);
+ void set_autorestart_random_delay(float p_time);
+
+ bool has_autorestart() const;
+ float get_autorestart_delay() const;
+ float get_autorestart_random_delay() const;
+
+ void set_mix_mode(MixMode p_mix);
+ MixMode get_mix_mode() const;
+
+ void start();
+ void stop();
+ bool is_active() const;
+
+ void set_use_sync(bool p_sync);
+ bool is_using_sync() const;
+
+ virtual bool has_filter() const;
+ virtual float process(float p_time, bool p_seek);
+
+ AnimationNodeOneShot();
+};
+
+VARIANT_ENUM_CAST(AnimationNodeOneShot::MixMode)
+
+class AnimationNodeAdd2 : public AnimationNode {
+ GDCLASS(AnimationNodeAdd2, AnimationNode);
+
+ float amount;
+ bool sync;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_amount(float p_amount);
+ float get_amount() const;
+
+ void set_use_sync(bool p_sync);
+ bool is_using_sync() const;
+
+ virtual bool has_filter() const;
+ virtual float process(float p_time, bool p_seek);
+
+ AnimationNodeAdd2();
+};
+
+class AnimationNodeAdd3 : public AnimationNode {
+ GDCLASS(AnimationNodeAdd3, AnimationNode);
+
+ float amount;
+ bool sync;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_amount(float p_amount);
+ float get_amount() const;
+
+ void set_use_sync(bool p_sync);
+ bool is_using_sync() const;
+
+ virtual bool has_filter() const;
+ virtual float process(float p_time, bool p_seek);
+
+ AnimationNodeAdd3();
+};
+
+class AnimationNodeBlend2 : public AnimationNode {
+ GDCLASS(AnimationNodeBlend2, AnimationNode);
+
+ float amount;
+ bool sync;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+ virtual float process(float p_time, bool p_seek);
+
+ void set_amount(float p_amount);
+ float get_amount() const;
+
+ void set_use_sync(bool p_sync);
+ bool is_using_sync() const;
+
+ virtual bool has_filter() const;
+ AnimationNodeBlend2();
+};
+
+class AnimationNodeBlend3 : public AnimationNode {
+ GDCLASS(AnimationNodeBlend3, AnimationNode);
+
+ float amount;
+ bool sync;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_amount(float p_amount);
+ float get_amount() const;
+
+ void set_use_sync(bool p_sync);
+ bool is_using_sync() const;
+
+ float process(float p_time, bool p_seek);
+ AnimationNodeBlend3();
+};
+
+class AnimationNodeTimeScale : public AnimationNode {
+ GDCLASS(AnimationNodeTimeScale, AnimationNode);
+
+ float scale;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_scale(float p_scale);
+ float get_scale() const;
+
+ float process(float p_time, bool p_seek);
+
+ AnimationNodeTimeScale();
+};
+
+class AnimationNodeTimeSeek : public AnimationNode {
+ GDCLASS(AnimationNodeTimeSeek, AnimationNode);
+
+ float seek_pos;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual String get_caption() const;
+
+ void set_seek_pos(float p_sec);
+ float get_seek_pos() const;
+
+ float process(float p_time, bool p_seek);
+
+ AnimationNodeTimeSeek();
+};
+
+class AnimationNodeTransition : public AnimationNode {
+ GDCLASS(AnimationNodeTransition, AnimationNode);
+
+ enum {
+ MAX_INPUTS = 32
+ };
+ struct InputData {
+
+ String name;
+ bool auto_advance;
+ InputData() { auto_advance = false; }
+ };
+
+ InputData inputs[MAX_INPUTS];
+ int enabled_inputs;
+
+ float prev_time;
+ float prev_xfading;
+ int prev;
+ bool switched;
+
+ float time;
+ int current;
+
+ float xfade;
+
+ void _update_inputs();
+
+protected:
+ static void _bind_methods();
+ void _validate_property(PropertyInfo &property) const;
+
+public:
+ virtual String get_caption() const;
+
+ void set_enabled_inputs(int p_inputs);
+ int get_enabled_inputs();
+
+ 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_current(int p_current);
+ int get_current() const;
+
+ void set_cross_fade_time(float p_fade);
+ float get_cross_fade_time() const;
+
+ float process(float p_time, bool p_seek);
+
+ AnimationNodeTransition();
+};
+
+class AnimationNodeOutput : public AnimationNode {
+ GDCLASS(AnimationNodeOutput, AnimationNode)
+public:
+ virtual String get_caption() const;
+ virtual float process(float p_time, bool p_seek);
+ AnimationNodeOutput();
+};
+
+/////
+
+class AnimationNodeBlendTree : public AnimationRootNode {
+ GDCLASS(AnimationNodeBlendTree, AnimationRootNode)
+
+ Map<StringName, Ref<AnimationNode> > nodes;
+
+ Vector2 graph_offset;
+
+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:
+ enum ConnectionError {
+ CONNECTION_OK,
+ CONNECTION_ERROR_NO_INPUT,
+ CONNECTION_ERROR_NO_INPUT_INDEX,
+ CONNECTION_ERROR_NO_OUTPUT,
+ CONNECTION_ERROR_SAME_NODE,
+ CONNECTION_ERROR_CONNECTION_EXISTS,
+ //no need to check for cycles due to tree topology
+ };
+
+ void add_node(const StringName &p_name, Ref<AnimationNode> p_node);
+ Ref<AnimationNode> get_node(const StringName &p_name) const;
+ void remove_node(const StringName &p_name);
+ void rename_node(const StringName &p_name, const StringName &p_new_name);
+ bool has_node(const StringName &p_name) const;
+ StringName get_node_name(const Ref<AnimationNode> &p_node) const;
+
+ void connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node);
+ void disconnect_node(const StringName &p_node, int p_input_index);
+ float get_connection_activity(const StringName &p_input_node, int p_input_index) const;
+
+ struct NodeConnection {
+ StringName input_node;
+ int input_index;
+ StringName output_node;
+ };
+
+ ConnectionError can_connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) const;
+ void get_node_connections(List<NodeConnection> *r_connections) const;
+
+ virtual String get_caption() const;
+ virtual float process(float p_time, bool p_seek);
+
+ void get_node_list(List<StringName> *r_list);
+
+ void set_graph_offset(const Vector2 &p_graph_offset);
+ Vector2 get_graph_offset() const;
+
+ virtual void set_tree(AnimationTree *p_player);
+ AnimationNodeBlendTree();
+ ~AnimationNodeBlendTree();
+};
+
+VARIANT_ENUM_CAST(AnimationNodeBlendTree::ConnectionError)
+
+#endif // ANIMATION_BLEND_TREE_H
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
new file mode 100644
index 0000000000..c5ad980806
--- /dev/null
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -0,0 +1,790 @@
+#include "animation_node_state_machine.h"
+
+/////////////////////////////////////////////////
+
+void AnimationNodeStateMachineTransition::set_switch_mode(SwitchMode p_mode) {
+
+ switch_mode = p_mode;
+}
+
+AnimationNodeStateMachineTransition::SwitchMode AnimationNodeStateMachineTransition::get_switch_mode() const {
+
+ return switch_mode;
+}
+
+void AnimationNodeStateMachineTransition::set_auto_advance(bool p_enable) {
+ auto_advance = p_enable;
+}
+
+bool AnimationNodeStateMachineTransition::has_auto_advance() const {
+ return auto_advance;
+}
+
+void AnimationNodeStateMachineTransition::set_xfade_time(float p_xfade) {
+
+ ERR_FAIL_COND(p_xfade < 0);
+ xfade = p_xfade;
+ emit_changed();
+}
+
+float AnimationNodeStateMachineTransition::get_xfade_time() const {
+ return xfade;
+}
+
+void AnimationNodeStateMachineTransition::set_disabled(bool p_disabled) {
+ disabled = p_disabled;
+ emit_changed();
+}
+
+bool AnimationNodeStateMachineTransition::is_disabled() const {
+ return disabled;
+}
+
+void AnimationNodeStateMachineTransition::set_priority(int p_priority) {
+ priority = p_priority;
+ emit_changed();
+}
+
+int AnimationNodeStateMachineTransition::get_priority() const {
+ return priority;
+}
+
+void AnimationNodeStateMachineTransition::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_switch_mode", "mode"), &AnimationNodeStateMachineTransition::set_switch_mode);
+ ClassDB::bind_method(D_METHOD("get_switch_mode"), &AnimationNodeStateMachineTransition::get_switch_mode);
+
+ ClassDB::bind_method(D_METHOD("set_auto_advance", "auto_advance"), &AnimationNodeStateMachineTransition::set_auto_advance);
+ ClassDB::bind_method(D_METHOD("has_auto_advance"), &AnimationNodeStateMachineTransition::has_auto_advance);
+
+ ClassDB::bind_method(D_METHOD("set_xfade_time", "secs"), &AnimationNodeStateMachineTransition::set_xfade_time);
+ ClassDB::bind_method(D_METHOD("get_xfade_time"), &AnimationNodeStateMachineTransition::get_xfade_time);
+
+ ClassDB::bind_method(D_METHOD("set_disabled", "disabled"), &AnimationNodeStateMachineTransition::set_disabled);
+ ClassDB::bind_method(D_METHOD("is_disabled"), &AnimationNodeStateMachineTransition::is_disabled);
+
+ ClassDB::bind_method(D_METHOD("set_priority", "priority"), &AnimationNodeStateMachineTransition::set_priority);
+ ClassDB::bind_method(D_METHOD("get_priority"), &AnimationNodeStateMachineTransition::get_priority);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "switch_mode", PROPERTY_HINT_ENUM, "Immediate,Sync,AtEnd"), "set_switch_mode", "get_switch_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_advance"), "set_auto_advance", "has_auto_advance");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "xfade_time", PROPERTY_HINT_RANGE, "0,240,0.01"), "set_xfade_time", "get_xfade_time");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "priority", PROPERTY_HINT_RANGE, "0,32,1"), "set_priority", "get_priority");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
+
+ BIND_CONSTANT(SWITCH_MODE_IMMEDIATE);
+ BIND_CONSTANT(SWITCH_MODE_SYNC);
+ BIND_CONSTANT(SWITCH_MODE_AT_END);
+}
+
+AnimationNodeStateMachineTransition::AnimationNodeStateMachineTransition() {
+
+ switch_mode = SWITCH_MODE_IMMEDIATE;
+ auto_advance = false;
+ xfade = 0;
+ disabled = false;
+ priority = 1;
+}
+
+///////////////////////////////////////////////////////
+void AnimationNodeStateMachine::add_node(const StringName &p_name, Ref<AnimationNode> p_node) {
+
+ ERR_FAIL_COND(states.has(p_name));
+ ERR_FAIL_COND(p_node.is_null());
+ ERR_FAIL_COND(p_node->get_parent().is_valid());
+ ERR_FAIL_COND(p_node->get_tree() != NULL);
+ ERR_FAIL_COND(String(p_name).find("/") != -1);
+ states[p_name] = p_node;
+
+ p_node->set_parent(this);
+ p_node->set_tree(get_tree());
+
+ emit_changed();
+}
+
+Ref<AnimationNode> AnimationNodeStateMachine::get_node(const StringName &p_name) const {
+
+ ERR_FAIL_COND_V(!states.has(p_name), Ref<AnimationNode>());
+
+ return states[p_name];
+}
+
+StringName AnimationNodeStateMachine::get_node_name(const Ref<AnimationNode> &p_node) const {
+ for (Map<StringName, Ref<AnimationRootNode> >::Element *E = states.front(); E; E = E->next()) {
+ if (E->get() == p_node) {
+ return E->key();
+ }
+ }
+
+ ERR_FAIL_V(StringName());
+}
+
+bool AnimationNodeStateMachine::has_node(const StringName &p_name) const {
+ return states.has(p_name);
+}
+void AnimationNodeStateMachine::remove_node(const StringName &p_name) {
+
+ ERR_FAIL_COND(!states.has(p_name));
+
+ {
+ //erase node connections
+ Ref<AnimationNode> node = states[p_name];
+ for (int i = 0; i < node->get_input_count(); i++) {
+ node->set_input_connection(i, StringName());
+ }
+ node->set_parent(NULL);
+ node->set_tree(NULL);
+ }
+
+ states.erase(p_name);
+ path.erase(p_name);
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == p_name || transitions[i].to == p_name) {
+ transitions.remove(i);
+ i--;
+ }
+ }
+
+ if (start_node == p_name) {
+ start_node = StringName();
+ }
+
+ if (end_node == p_name) {
+ end_node = StringName();
+ }
+
+ if (playing && current == p_name) {
+ stop();
+ }
+ emit_changed();
+}
+
+void AnimationNodeStateMachine::rename_node(const StringName &p_name, const StringName &p_new_name) {
+
+ ERR_FAIL_COND(!states.has(p_name));
+ ERR_FAIL_COND(states.has(p_new_name));
+
+ states[p_new_name] = states[p_name];
+ states.erase(p_name);
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == p_name) {
+ transitions[i].from = p_new_name;
+ }
+
+ if (transitions[i].to == p_name) {
+ transitions[i].to = p_new_name;
+ }
+ }
+
+ if (start_node == p_name) {
+ start_node = p_new_name;
+ }
+
+ if (end_node == p_name) {
+ end_node = p_new_name;
+ }
+
+ if (playing && current == p_name) {
+ current = p_new_name;
+ }
+
+ path.clear(); //clear path
+}
+
+void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const {
+
+ List<StringName> nodes;
+ for (Map<StringName, Ref<AnimationRootNode> >::Element *E = states.front(); E; E = E->next()) {
+ nodes.push_back(E->key());
+ }
+ nodes.sort_custom<StringName::AlphCompare>();
+
+ for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
+ r_nodes->push_back(E->get());
+ }
+}
+
+bool AnimationNodeStateMachine::has_transition(const StringName &p_from, const StringName &p_to) const {
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == p_from && transitions[i].to == p_to)
+ return true;
+ }
+ return false;
+}
+
+int AnimationNodeStateMachine::find_transition(const StringName &p_from, const StringName &p_to) const {
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == p_from && transitions[i].to == p_to)
+ return i;
+ }
+ return -1;
+}
+
+void AnimationNodeStateMachine::add_transition(const StringName &p_from, const StringName &p_to, const Ref<AnimationNodeStateMachineTransition> &p_transition) {
+
+ ERR_FAIL_COND(p_from == p_to);
+ ERR_FAIL_COND(!states.has(p_from));
+ ERR_FAIL_COND(!states.has(p_to));
+ ERR_FAIL_COND(p_transition.is_null());
+
+ for (int i = 0; i < transitions.size(); i++) {
+ ERR_FAIL_COND(transitions[i].from == p_from && transitions[i].to == p_to);
+ }
+
+ Transition tr;
+ tr.from = p_from;
+ tr.to = p_to;
+ tr.transition = p_transition;
+
+ transitions.push_back(tr);
+}
+
+Ref<AnimationNodeStateMachineTransition> AnimationNodeStateMachine::get_transition(int p_transition) const {
+ ERR_FAIL_INDEX_V(p_transition, transitions.size(), Ref<AnimationNodeStateMachineTransition>());
+ return transitions[p_transition].transition;
+}
+StringName AnimationNodeStateMachine::get_transition_from(int p_transition) const {
+
+ ERR_FAIL_INDEX_V(p_transition, transitions.size(), StringName());
+ return transitions[p_transition].from;
+}
+StringName AnimationNodeStateMachine::get_transition_to(int p_transition) const {
+
+ ERR_FAIL_INDEX_V(p_transition, transitions.size(), StringName());
+ return transitions[p_transition].to;
+}
+
+int AnimationNodeStateMachine::get_transition_count() const {
+
+ return transitions.size();
+}
+void AnimationNodeStateMachine::remove_transition(const StringName &p_from, const StringName &p_to) {
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == p_from && transitions[i].to == p_to) {
+ transitions.remove(i);
+ return;
+ }
+ }
+
+ if (playing) {
+ path.clear();
+ }
+}
+
+void AnimationNodeStateMachine::remove_transition_by_index(int p_transition) {
+
+ transitions.remove(p_transition);
+ if (playing) {
+ path.clear();
+ }
+}
+
+void AnimationNodeStateMachine::set_start_node(const StringName &p_node) {
+
+ ERR_FAIL_COND(p_node != StringName() && !states.has(p_node));
+ start_node = p_node;
+}
+
+String AnimationNodeStateMachine::get_start_node() const {
+
+ return start_node;
+}
+
+void AnimationNodeStateMachine::set_end_node(const StringName &p_node) {
+
+ ERR_FAIL_COND(p_node != StringName() && !states.has(p_node));
+ end_node = p_node;
+}
+
+String AnimationNodeStateMachine::get_end_node() const {
+
+ return end_node;
+}
+
+void AnimationNodeStateMachine::set_graph_offset(const Vector2 &p_offset) {
+ graph_offset = p_offset;
+}
+
+Vector2 AnimationNodeStateMachine::get_graph_offset() const {
+ return graph_offset;
+}
+
+float AnimationNodeStateMachine::process(float p_time, bool p_seek) {
+
+ //if not playing and it can restart, then restart
+ if (!playing) {
+ if (start_node) {
+ start(start_node);
+ } else {
+ return 0;
+ }
+ }
+
+ bool do_start = (p_seek && p_time == 0) || play_start || current == StringName();
+
+ if (do_start) {
+
+ if (start_node != StringName() && p_seek && p_time == 0) {
+ current = start_node;
+ }
+
+ len_current = blend_node(states[current], 0, true, 1.0, FILTER_IGNORE, false);
+ pos_current = 0;
+ loops_current = 0;
+ play_start = false;
+ }
+
+ float fade_blend = 1.0;
+
+ if (fading_from != StringName()) {
+
+ if (!p_seek) {
+ fading_pos += p_time;
+ }
+ fade_blend = MIN(1.0, fading_pos / fading_time);
+ if (fade_blend >= 1.0) {
+ fading_from = StringName();
+ }
+ }
+
+ float rem = blend_node(states[current], p_time, p_seek, fade_blend, FILTER_IGNORE, false);
+
+ if (fading_from != StringName()) {
+
+ blend_node(states[fading_from], p_time, p_seek, 1.0 - fade_blend, FILTER_IGNORE, false);
+ }
+
+ //guess playback position
+ if (rem > len_current) { // weird but ok
+ len_current = rem;
+ }
+
+ { //advance and loop check
+
+ float next_pos = len_current - rem;
+
+ if (next_pos < pos_current) {
+ loops_current++;
+ }
+ pos_current = next_pos; //looped
+ }
+
+ //find next
+ StringName next;
+ float next_xfade = 0;
+ AnimationNodeStateMachineTransition::SwitchMode switch_mode = AnimationNodeStateMachineTransition::SWITCH_MODE_IMMEDIATE;
+
+ if (path.size()) {
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == current && transitions[i].to == path[0]) {
+ next_xfade = transitions[i].transition->get_xfade_time();
+ switch_mode = transitions[i].transition->get_switch_mode();
+ next = path[0];
+ }
+ }
+ } else {
+ float priority_best = 1e20;
+ int auto_advance_to = -1;
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == current && transitions[i].transition->has_auto_advance()) {
+
+ if (transitions[i].transition->get_priority() < priority_best) {
+ auto_advance_to = i;
+ }
+ }
+ }
+
+ if (auto_advance_to != -1) {
+ next = transitions[auto_advance_to].to;
+ next_xfade = transitions[auto_advance_to].transition->get_xfade_time();
+ switch_mode = transitions[auto_advance_to].transition->get_switch_mode();
+ }
+ }
+
+ //if next, see when to transition
+ if (next != StringName()) {
+
+ bool goto_next = false;
+
+ if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_IMMEDIATE) {
+ goto_next = fading_from == StringName();
+ } else {
+ goto_next = next_xfade >= (len_current - pos_current) || loops_current > 0;
+ if (loops_current > 0) {
+ next_xfade = 0;
+ }
+ }
+
+ if (goto_next) { //loops 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;
+ fading_time = next_xfade;
+ fading_pos = 0;
+ } else {
+ fading_from = StringName();
+ fading_pos = 0;
+ }
+
+ if (path.size()) { //if it came from path, remove path
+ path.remove(0);
+ }
+ current = next;
+ if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_SYNC) {
+ len_current = blend_node(states[current], 0, true, 0, FILTER_IGNORE, false);
+ pos_current = MIN(pos_current, len_current);
+ blend_node(states[current], pos_current, true, 0, FILTER_IGNORE, false);
+
+ } else {
+ len_current = blend_node(states[current], 0, true, 0, FILTER_IGNORE, false);
+ pos_current = 0;
+ }
+
+ rem = len_current; //so it does not show 0 on transition
+ loops_current = 0;
+ }
+ }
+
+ //compute time left for transitions by using the end node
+
+ if (end_node != StringName() && end_node != current) {
+
+ rem = blend_node(states[end_node], 0, true, 0, FILTER_IGNORE, false);
+ }
+
+ return rem;
+}
+
+bool AnimationNodeStateMachine::travel(const StringName &p_state) {
+ ERR_FAIL_COND_V(!playing, false);
+ ERR_FAIL_COND_V(!states.has(p_state), false);
+ ERR_FAIL_COND_V(!states.has(current), false);
+
+ path.clear(); //a new one will be needed
+
+ if (current == p_state)
+ return true; //nothing to do
+
+ loops_current = 0; // reset loops, so fade does not happen immediately
+
+ Vector2 current_pos = states[current]->get_position();
+ Vector2 target_pos = states[p_state]->get_position();
+
+ Map<StringName, AStarCost> cost_map;
+
+ List<int> open_list;
+
+ //build open list
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from == current) {
+ open_list.push_back(i);
+ float cost = states[transitions[i].to]->get_position().distance_to(current_pos);
+ cost *= transitions[i].transition->get_priority();
+ AStarCost ap;
+ ap.prev = current;
+ ap.distance = cost;
+ cost_map[transitions[i].to] = ap;
+
+ if (transitions[i].to == p_state) { //prematurely found it! :D
+ path.push_back(p_state);
+ return true;
+ }
+ }
+ }
+
+ //begin astar
+ bool found_route = false;
+ while (!found_route) {
+
+ if (open_list.size() == 0) {
+ return false; //no path found
+ }
+
+ //find the last cost transition
+ List<int>::Element *least_cost_transition = NULL;
+ float least_cost = 1e20;
+
+ for (List<int>::Element *E = open_list.front(); E; E = E->next()) {
+
+ float cost = cost_map[transitions[E->get()].to].distance;
+ cost += states[transitions[E->get()].to]->get_position().distance_to(target_pos);
+
+ if (cost < least_cost) {
+ least_cost_transition = E;
+ }
+ }
+
+ StringName transition_prev = transitions[least_cost_transition->get()].from;
+ StringName transition = transitions[least_cost_transition->get()].to;
+
+ for (int i = 0; i < transitions.size(); i++) {
+ if (transitions[i].from != transition || transitions[i].to == transition_prev) {
+ continue; //not interested on those
+ }
+
+ float distance = states[transitions[i].from]->get_position().distance_to(states[transitions[i].to]->get_position());
+ distance *= transitions[i].transition->get_priority();
+ distance += cost_map[transitions[i].from].distance;
+
+ if (cost_map.has(transitions[i].to)) {
+ //oh this was visited already, can we win the cost?
+ if (distance < cost_map[transitions[i].to].distance) {
+ cost_map[transitions[i].to].distance = distance;
+ cost_map[transitions[i].to].prev = transitions[i].from;
+ }
+ } else {
+ //add to open list
+ AStarCost ac;
+ ac.prev = transitions[i].from;
+ ac.distance = distance;
+ cost_map[transitions[i].to] = ac;
+
+ open_list.push_back(i);
+
+ if (transitions[i].to == p_state) {
+ found_route = true;
+ break;
+ }
+ }
+ }
+
+ if (found_route) {
+ break;
+ }
+
+ open_list.erase(least_cost_transition);
+ }
+
+ //make path
+ StringName at = p_state;
+ while (at != current) {
+ path.push_back(at);
+ at = cost_map[at].prev;
+ }
+
+ path.invert();
+
+ return true;
+}
+
+void AnimationNodeStateMachine::start(const StringName &p_state) {
+
+ ERR_FAIL_COND(!states.has(p_state));
+ path.clear();
+ current = p_state;
+ playing = true;
+ play_start = true;
+}
+void AnimationNodeStateMachine::stop() {
+ playing = false;
+ play_start = false;
+ current = StringName();
+}
+bool AnimationNodeStateMachine::is_playing() const {
+
+ return playing;
+}
+StringName AnimationNodeStateMachine::get_current_node() const {
+ if (!playing) {
+ return StringName();
+ }
+
+ return current;
+}
+
+StringName AnimationNodeStateMachine::get_blend_from_node() const {
+ if (!playing) {
+ return StringName();
+ }
+
+ return fading_from;
+}
+
+float AnimationNodeStateMachine::get_current_play_pos() const {
+ return pos_current;
+}
+float AnimationNodeStateMachine::get_current_length() const {
+ return len_current;
+}
+
+Vector<StringName> AnimationNodeStateMachine::get_travel_path() const {
+ return path;
+}
+String AnimationNodeStateMachine::get_caption() const {
+ return "StateMachine";
+}
+
+void AnimationNodeStateMachine::_notification(int p_what) {
+}
+
+void AnimationNodeStateMachine::set_tree(AnimationTree *p_player) {
+
+ AnimationNode::set_tree(p_player);
+
+ for (Map<StringName, Ref<AnimationRootNode> >::Element *E = states.front(); E; E = E->next()) {
+ Ref<AnimationRootNode> node = E->get();
+ node->set_tree(p_player);
+ }
+}
+
+bool AnimationNodeStateMachine::_set(const StringName &p_name, const Variant &p_value) {
+
+ String name = p_name;
+ if (name.begins_with("states/")) {
+ String node_name = name.get_slicec('/', 1);
+ String what = name.get_slicec('/', 2);
+
+ if (what == "node") {
+ Ref<AnimationNode> anode = p_value;
+ if (anode.is_valid()) {
+ add_node(node_name, p_value);
+ }
+ return true;
+ }
+
+ if (what == "position") {
+
+ if (states.has(node_name)) {
+ states[node_name]->set_position(p_value);
+ }
+ return true;
+ }
+ } else if (name == "transitions") {
+
+ Array trans = p_value;
+ ERR_FAIL_COND_V(trans.size() % 3 != 0, false);
+
+ for (int i = 0; i < trans.size(); i += 3) {
+ add_transition(trans[i], trans[i + 1], trans[i + 2]);
+ }
+ return true;
+ } else if (name == "start_node") {
+ set_start_node(p_value);
+ return true;
+ } else if (name == "end_node") {
+ set_end_node(p_value);
+ return true;
+ } else if (name == "graph_offset") {
+ set_graph_offset(p_value);
+ return true;
+ }
+
+ return false;
+}
+
+bool AnimationNodeStateMachine::_get(const StringName &p_name, Variant &r_ret) const {
+
+ String name = p_name;
+ if (name.begins_with("states/")) {
+ String node_name = name.get_slicec('/', 1);
+ String what = name.get_slicec('/', 2);
+
+ if (what == "node") {
+ if (states.has(node_name)) {
+ r_ret = states[node_name];
+ return true;
+ }
+ }
+
+ if (what == "position") {
+
+ if (states.has(node_name)) {
+ r_ret = states[node_name]->get_position();
+ return true;
+ }
+ }
+ } else if (name == "transitions") {
+ Array trans;
+ trans.resize(transitions.size() * 3);
+
+ for (int i = 0; i < transitions.size(); i++) {
+ trans[i * 3 + 0] = transitions[i].from;
+ trans[i * 3 + 1] = transitions[i].to;
+ trans[i * 3 + 2] = transitions[i].transition;
+ }
+
+ r_ret = trans;
+ return true;
+ } else if (name == "start_node") {
+ r_ret = get_start_node();
+ return true;
+ } else if (name == "end_node") {
+ r_ret = get_end_node();
+ return true;
+ } else if (name == "graph_offset") {
+ r_ret = get_graph_offset();
+ return true;
+ }
+
+ return false;
+}
+void AnimationNodeStateMachine::_get_property_list(List<PropertyInfo> *p_list) const {
+
+ List<StringName> names;
+ for (Map<StringName, Ref<AnimationRootNode> >::Element *E = states.front(); E; E = E->next()) {
+ names.push_back(E->key());
+ }
+ names.sort_custom<StringName::AlphCompare>();
+
+ for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
+ String name = E->get();
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "states/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "states/" + name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ }
+
+ p_list->push_back(PropertyInfo(Variant::ARRAY, "transitions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::STRING, "start_node", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::STRING, "end_node", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "graph_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+}
+
+void AnimationNodeStateMachine::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("add_node", "name", "node"), &AnimationNodeStateMachine::add_node);
+ ClassDB::bind_method(D_METHOD("get_node", "name"), &AnimationNodeStateMachine::get_node);
+ ClassDB::bind_method(D_METHOD("remove_node", "name"), &AnimationNodeStateMachine::remove_node);
+ ClassDB::bind_method(D_METHOD("rename_node", "name", "new_name"), &AnimationNodeStateMachine::rename_node);
+ ClassDB::bind_method(D_METHOD("has_node", "name"), &AnimationNodeStateMachine::has_node);
+ ClassDB::bind_method(D_METHOD("get_node_name", "node"), &AnimationNodeStateMachine::get_node_name);
+
+ ClassDB::bind_method(D_METHOD("has_transition", "from", "to"), &AnimationNodeStateMachine::add_transition);
+ ClassDB::bind_method(D_METHOD("add_transition", "from", "to", "transition"), &AnimationNodeStateMachine::add_transition);
+ ClassDB::bind_method(D_METHOD("get_transition", "idx"), &AnimationNodeStateMachine::get_transition);
+ ClassDB::bind_method(D_METHOD("get_transition_from", "idx"), &AnimationNodeStateMachine::get_transition_from);
+ ClassDB::bind_method(D_METHOD("get_transition_to", "idx"), &AnimationNodeStateMachine::get_transition_to);
+ ClassDB::bind_method(D_METHOD("get_transition_count"), &AnimationNodeStateMachine::get_transition_count);
+ ClassDB::bind_method(D_METHOD("remove_transition_by_index", "idx"), &AnimationNodeStateMachine::remove_transition_by_index);
+ ClassDB::bind_method(D_METHOD("remove_transition", "from", "to"), &AnimationNodeStateMachine::remove_transition);
+
+ ClassDB::bind_method(D_METHOD("set_start_node", "name"), &AnimationNodeStateMachine::set_start_node);
+ ClassDB::bind_method(D_METHOD("get_start_node"), &AnimationNodeStateMachine::get_start_node);
+
+ ClassDB::bind_method(D_METHOD("set_end_node", "name"), &AnimationNodeStateMachine::set_end_node);
+ ClassDB::bind_method(D_METHOD("get_end_node"), &AnimationNodeStateMachine::get_end_node);
+
+ ClassDB::bind_method(D_METHOD("set_graph_offset", "name"), &AnimationNodeStateMachine::set_graph_offset);
+ ClassDB::bind_method(D_METHOD("get_graph_offset"), &AnimationNodeStateMachine::get_graph_offset);
+
+ ClassDB::bind_method(D_METHOD("travel", "to_node"), &AnimationNodeStateMachine::travel);
+ ClassDB::bind_method(D_METHOD("start", "node"), &AnimationNodeStateMachine::start);
+ ClassDB::bind_method(D_METHOD("stop"), &AnimationNodeStateMachine::stop);
+ ClassDB::bind_method(D_METHOD("is_playing"), &AnimationNodeStateMachine::is_playing);
+ ClassDB::bind_method(D_METHOD("get_current_node"), &AnimationNodeStateMachine::get_current_node);
+ ClassDB::bind_method(D_METHOD("get_travel_path"), &AnimationNodeStateMachine::get_travel_path);
+}
+
+AnimationNodeStateMachine::AnimationNodeStateMachine() {
+
+ play_start = false;
+
+ playing = false;
+ len_current = 0;
+
+ fading_time = 0;
+}
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
new file mode 100644
index 0000000000..e7357e09ea
--- /dev/null
+++ b/scene/animation/animation_node_state_machine.h
@@ -0,0 +1,142 @@
+#ifndef ANIMATION_NODE_STATE_MACHINE_H
+#define ANIMATION_NODE_STATE_MACHINE_H
+
+#include "scene/animation/animation_tree.h"
+
+class AnimationNodeStateMachineTransition : public Resource {
+ GDCLASS(AnimationNodeStateMachineTransition, Resource)
+public:
+ enum SwitchMode {
+ SWITCH_MODE_IMMEDIATE,
+ SWITCH_MODE_SYNC,
+ SWITCH_MODE_AT_END,
+ };
+
+private:
+ SwitchMode switch_mode;
+ bool auto_advance;
+ float xfade;
+ bool disabled;
+ int priority;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_switch_mode(SwitchMode p_mode);
+ SwitchMode get_switch_mode() const;
+
+ void set_auto_advance(bool p_enable);
+ bool has_auto_advance() const;
+
+ void set_xfade_time(float p_xfade);
+ float get_xfade_time() const;
+
+ void set_disabled(bool p_disabled);
+ bool is_disabled() const;
+
+ void set_priority(int p_priority);
+ int get_priority() const;
+
+ AnimationNodeStateMachineTransition();
+};
+
+VARIANT_ENUM_CAST(AnimationNodeStateMachineTransition::SwitchMode)
+
+class AnimationNodeStateMachine : public AnimationRootNode {
+
+ GDCLASS(AnimationNodeStateMachine, AnimationRootNode);
+
+private:
+ Map<StringName, Ref<AnimationRootNode> > states;
+
+ struct Transition {
+
+ StringName from;
+ StringName to;
+ Ref<AnimationNodeStateMachineTransition> transition;
+ };
+
+ struct AStarCost {
+ float distance;
+ StringName prev;
+ };
+
+ Vector<Transition> transitions;
+
+ float len_total;
+
+ float len_current;
+ float pos_current;
+ int loops_current;
+
+ bool play_start;
+ StringName start_node;
+ StringName end_node;
+
+ Vector2 graph_offset;
+
+ StringName current;
+
+ StringName fading_from;
+ float fading_time;
+ float fading_pos;
+
+ Vector<StringName> path;
+ bool playing;
+
+protected:
+ void _notification(int p_what);
+ 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 add_node(const StringName &p_name, Ref<AnimationNode> p_node);
+ Ref<AnimationNode> get_node(const StringName &p_name) const;
+ void remove_node(const StringName &p_name);
+ void rename_node(const StringName &p_name, const StringName &p_new_name);
+ bool has_node(const StringName &p_name) const;
+ StringName get_node_name(const Ref<AnimationNode> &p_node) const;
+ void get_node_list(List<StringName> *r_nodes) const;
+
+ bool has_transition(const StringName &p_from, const StringName &p_to) const;
+ int find_transition(const StringName &p_from, const StringName &p_to) const;
+ void add_transition(const StringName &p_from, const StringName &p_to, const Ref<AnimationNodeStateMachineTransition> &p_transition);
+ Ref<AnimationNodeStateMachineTransition> get_transition(int p_transition) const;
+ StringName get_transition_from(int p_transition) const;
+ StringName get_transition_to(int p_transition) const;
+ int get_transition_count() const;
+ void remove_transition_by_index(int p_transition);
+ void remove_transition(const StringName &p_from, const StringName &p_to);
+
+ void set_start_node(const StringName &p_node);
+ String get_start_node() const;
+
+ void set_end_node(const StringName &p_node);
+ String get_end_node() const;
+
+ void set_graph_offset(const Vector2 &p_offset);
+ Vector2 get_graph_offset() const;
+
+ virtual float process(float p_time, bool p_seek);
+ virtual String get_caption() const;
+
+ bool travel(const StringName &p_state);
+ void start(const StringName &p_state);
+ void stop();
+ bool is_playing() const;
+ StringName get_current_node() const;
+ StringName get_blend_from_node() const;
+ Vector<StringName> get_travel_path() const;
+ float get_current_play_pos() const;
+ float get_current_length() const;
+
+ virtual void set_tree(AnimationTree *p_player);
+
+ AnimationNodeStateMachine();
+};
+
+#endif // ANIMATION_NODE_STATE_MACHINE_H
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 9db4a5fb04..eac2c8d0c1 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -33,7 +33,7 @@
#include "engine.h"
#include "message_queue.h"
#include "scene/scene_string_names.h"
-
+#include "servers/audio/audio_stream.h"
#ifdef TOOLS_ENABLED
void AnimatedValuesBackup::update_skeletons() {
@@ -182,8 +182,8 @@ void AnimationPlayer::_notification(int p_what) {
if (!processing) {
//make sure that a previous process state was not saved
//only process if "processing" is set
- set_physics_process(false);
- set_process(false);
+ set_physics_process_internal(false);
+ set_process_internal(false);
}
//_set_process(false);
clear_caches();
@@ -246,8 +246,9 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
if (a->track_get_path(i).get_subname_count() == 1 && Object::cast_to<Skeleton>(child)) {
- bone_idx = Object::cast_to<Skeleton>(child)->find_bone(a->track_get_path(i).get_subname(0));
- if (bone_idx == -1) {
+ Skeleton *sk = Object::cast_to<Skeleton>(child);
+ bone_idx = sk->find_bone(a->track_get_path(i).get_subname(0));
+ if (bone_idx == -1 || sk->is_bone_ignore_animation(bone_idx)) {
continue;
}
@@ -324,10 +325,27 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
p_anim->node_cache[i]->property_anim[a->track_get_path(i).get_concatenated_subnames()] = pa;
}
}
+
+ if (a->track_get_type(i) == Animation::TYPE_BEZIER && leftover_path.size()) {
+
+ if (!p_anim->node_cache[i]->bezier_anim.has(a->track_get_path(i).get_concatenated_subnames())) {
+
+ TrackNodeCache::BezierAnim ba;
+ String path = leftover_path[leftover_path.size() - 1];
+ Vector<String> index = path.split(".");
+ for (int j = 0; j < index.size(); j++) {
+ ba.bezier_property.push_back(index[j]);
+ }
+ ba.object = resource.is_valid() ? (Object *)resource.ptr() : (Object *)child;
+ ba.owner = p_anim->node_cache[i];
+
+ p_anim->node_cache[i]->bezier_anim[a->track_get_path(i).get_concatenated_subnames()] = ba;
+ }
+ }
}
}
-void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_allow_discrete) {
+void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_is_current, bool p_seeked, bool p_started) {
_ensure_node_caches(p_anim);
ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count());
@@ -393,7 +411,51 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
TrackNodeCache::PropertyAnim *pa = &E->get();
- if (a->value_track_get_update_mode(i) == Animation::UPDATE_CONTINUOUS || (p_delta == 0 && a->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE)) { //delta == 0 means seek
+ Animation::UpdateMode update_mode = a->value_track_get_update_mode(i);
+
+ if (update_mode == Animation::UPDATE_CAPTURE) {
+
+ if (p_started) {
+ pa->capture = pa->object->get_indexed(pa->subpath);
+ }
+
+ int key_count = a->track_get_key_count(i);
+ if (key_count == 0)
+ continue; //eeh not worth it
+
+ float first_key_time = a->track_get_key_time(i, 0);
+ float transition = 1.0;
+ int first_key = 0;
+
+ if (first_key_time == 0.0) {
+ //ignore, use for transition
+ if (key_count == 1)
+ continue; //with one key we cant do anything
+ transition = a->track_get_key_transition(i, 0);
+ first_key_time = a->track_get_key_time(i, 1);
+ first_key = 1;
+ }
+
+ if (p_time < first_key_time) {
+ float c = Math::ease(p_time / first_key_time, transition);
+ Variant first_value = a->track_get_key_value(i, first_key);
+ Variant interp_value;
+ Variant::interpolate(pa->capture, first_value, c, interp_value);
+
+ if (pa->accum_pass != accum_pass) {
+ ERR_CONTINUE(cache_update_prop_size >= NODE_CACHE_UPDATE_MAX);
+ cache_update_prop[cache_update_prop_size++] = pa;
+ pa->value_accum = interp_value;
+ pa->accum_pass = accum_pass;
+ } else {
+ Variant::interpolate(pa->value_accum, interp_value, p_interp, pa->value_accum);
+ }
+
+ continue; //handled
+ }
+ }
+
+ if (update_mode == Animation::UPDATE_CONTINUOUS || update_mode == Animation::UPDATE_CAPTURE || (p_delta == 0 && update_mode == Animation::UPDATE_DISCRETE)) { //delta == 0 means seek
Variant value = a->value_track_interpolate(i, p_time);
@@ -414,7 +476,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
Variant::interpolate(pa->value_accum, value, p_interp, pa->value_accum);
}
- } else if (p_allow_discrete && p_delta != 0) {
+ } else if (p_is_current && p_delta != 0) {
List<int> indices;
a->value_track_get_key_indices(i, p_time, p_delta, &indices);
@@ -469,9 +531,10 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
if (!nc->node)
continue;
- if (p_delta == 0)
+ if (p_delta == 0) {
continue;
- if (!p_allow_discrete)
+ }
+ if (!p_is_current)
break;
List<int> indices;
@@ -499,14 +562,197 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
}
} break;
+ case Animation::TYPE_BEZIER: {
+
+ if (!nc->node)
+ continue;
+
+ Map<StringName, TrackNodeCache::BezierAnim>::Element *E = nc->bezier_anim.find(a->track_get_path(i).get_concatenated_subnames());
+ ERR_CONTINUE(!E); //should it continue, or create a new one?
+
+ TrackNodeCache::BezierAnim *ba = &E->get();
+
+ float bezier = a->bezier_track_interpolate(i, p_time);
+ if (ba->accum_pass != accum_pass) {
+ ERR_CONTINUE(cache_update_bezier_size >= NODE_CACHE_UPDATE_MAX);
+ cache_update_bezier[cache_update_bezier_size++] = ba;
+ ba->bezier_accum = bezier;
+ ba->accum_pass = accum_pass;
+ } else {
+ ba->bezier_accum = Math::lerp(ba->bezier_accum, bezier, p_interp);
+ }
+
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ if (!nc->node)
+ continue;
+ if (p_delta == 0) {
+ continue;
+ }
+
+ if (p_seeked) {
+ //find whathever 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("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("stop");
+ nc->audio_playing = false;
+ playing_caches.erase(nc);
+ continue;
+ }
+
+ nc->node->call("set_stream", stream);
+ nc->node->call("play", start_ofs);
+
+ nc->audio_playing = true;
+ playing_caches.insert(nc);
+ if (len && end_ofs > 0) { //force a end at a time
+ nc->audio_len = len - start_ofs - end_ofs;
+ } else {
+ nc->audio_len = 0;
+ }
+
+ nc->audio_start = p_time;
+ }
+
+ } else {
+ //find stuff to play
+ List<int> to_play;
+ a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play);
+ 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("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("set_stream", stream);
+ nc->node->call("play", start_ofs);
+
+ nc->audio_playing = true;
+ playing_caches.insert(nc);
+ if (len && end_ofs > 0) { //force a 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->has_loop();
+
+ bool stop = false;
+
+ if (!loop && p_time < nc->audio_start) {
+ 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;
+
+ if (len > nc->audio_len) {
+ stop = true;
+ }
+ }
+
+ if (stop) {
+ //time to stop
+ nc->node->call("stop");
+ nc->audio_playing = false;
+ playing_caches.erase(nc);
+ }
+ }
+ }
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(nc->node);
+ if (!player)
+ continue;
+
+ if (p_delta == 0 || p_seeked) {
+ //seek
+ int idx = a->track_find_key(i, p_time);
+ if (idx < 0)
+ continue;
+
+ float pos = a->track_get_key_time(i, idx);
+
+ StringName anim_name = a->animation_track_get_key_animation(i, idx);
+ if (String(anim_name) == "[stop]" || !player->has_animation(anim_name))
+ continue;
+
+ Ref<Animation> anim = player->get_animation(anim_name);
+
+ float at_anim_pos;
+
+ if (anim->has_loop()) {
+ at_anim_pos = Math::fposmod(p_time - pos, anim->get_length()); //seek to loop
+ } else {
+ at_anim_pos = MAX(anim->get_length(), p_time - pos); //seek to end
+ }
+
+ if (player->is_playing() || p_seeked) {
+ player->play(anim_name);
+ player->seek(at_anim_pos);
+ nc->animation_playing = true;
+ playing_caches.insert(nc);
+ } else {
+ player->set_assigned_animation(anim_name);
+ player->seek(at_anim_pos, true);
+ }
+ } else {
+ //find stuff to play
+ List<int> to_play;
+ a->track_get_key_indices_in_range(i, p_time, p_delta, &to_play);
+ if (to_play.size()) {
+ int idx = to_play.back()->get();
+
+ StringName anim_name = a->animation_track_get_key_animation(i, idx);
+ if (String(anim_name) == "[stop]" || !player->has_animation(anim_name)) {
+
+ if (playing_caches.has(nc)) {
+ playing_caches.erase(nc);
+ player->stop();
+ nc->animation_playing = false;
+ }
+ } else {
+ player->play(anim_name);
+ nc->animation_playing = true;
+ playing_caches.insert(nc);
+ }
+ }
+ }
+
+ } break;
}
}
}
-void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend) {
+void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend, bool p_seeked, bool p_started) {
float delta = p_delta * speed_scale * cd.speed_scale;
- bool backwards = delta < 0;
float next_pos = cd.pos + delta;
float len = cd.from->animation->get_length();
@@ -524,6 +770,8 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
if (&cd == &playback.current) {
+ bool backwards = delta < 0;
+
if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) {
//playback finished
end_reached = true;
@@ -551,22 +799,25 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
cd.pos = next_pos;
- _animation_process_animation(cd.from, cd.pos, delta, p_blend, &cd == &playback.current);
+ _animation_process_animation(cd.from, cd.pos, delta, p_blend, &cd == &playback.current, p_seeked, p_started);
}
-void AnimationPlayer::_animation_process2(float p_delta) {
+void AnimationPlayer::_animation_process2(float p_delta, bool p_started) {
Playback &c = playback;
accum_pass++;
- _animation_process_data(c.current, p_delta, 1.0f);
+ _animation_process_data(c.current, p_delta, 1.0f, c.seeked && p_delta != 0, p_started);
+ if (p_delta != 0) {
+ c.seeked = false;
+ }
List<Blend>::Element *prev = NULL;
for (List<Blend>::Element *E = c.blend.back(); E; E = prev) {
Blend &b = E->get();
float blend = b.blend_left / b.blend_time;
- _animation_process_data(b.data, p_delta, blend);
+ _animation_process_data(b.data, p_delta, blend, false, false);
b.blend_left -= Math::absf(speed_scale * p_delta);
@@ -579,20 +830,16 @@ void AnimationPlayer::_animation_process2(float p_delta) {
}
void AnimationPlayer::_animation_update_transforms() {
+ {
+ Transform t;
+ for (int i = 0; i < cache_update_size; i++) {
- for (int i = 0; i < cache_update_size; i++) {
-
- TrackNodeCache *nc = cache_update[i];
+ TrackNodeCache *nc = cache_update[i];
- ERR_CONTINUE(nc->accum_pass != accum_pass);
+ ERR_CONTINUE(nc->accum_pass != accum_pass);
- if (nc->spatial) {
-
- Transform t;
t.origin = nc->loc_accum;
- t.basis = nc->rot_accum;
- t.basis.scale(nc->scale_accum);
-
+ t.basis.set_quat_scale(nc->rot_accum, nc->scale_accum);
if (nc->skeleton && nc->bone_idx >= 0) {
nc->skeleton->set_bone_pose(nc->bone_idx, t);
@@ -654,6 +901,16 @@ void AnimationPlayer::_animation_update_transforms() {
}
cache_update_prop_size = 0;
+
+ for (int i = 0; i < cache_update_bezier_size; i++) {
+
+ TrackNodeCache::BezierAnim *ba = cache_update_bezier[i];
+
+ ERR_CONTINUE(ba->accum_pass != accum_pass);
+ ba->object->set_indexed(ba->bezier_property, ba->bezier_accum);
+ }
+
+ cache_update_bezier_size = 0;
}
void AnimationPlayer::_animation_process(float p_delta) {
@@ -662,7 +919,12 @@ void AnimationPlayer::_animation_process(float p_delta) {
end_reached = false;
end_notify = false;
- _animation_process2(p_delta);
+ _animation_process2(p_delta, playback.started);
+
+ if (playback.started) {
+ playback.started = false;
+ }
+
_animation_update_transforms();
if (end_reached) {
if (queued.size()) {
@@ -867,7 +1129,7 @@ void AnimationPlayer::queue(const StringName &p_name) {
void AnimationPlayer::clear_queue() {
queued.clear();
-};
+}
void AnimationPlayer::play_backwards(const StringName &p_name, float p_custom_blend) {
@@ -932,10 +1194,14 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
}
}
+ _stop_playing_caches();
+
c.current.from = &animation_set[name];
c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0;
c.current.speed_scale = p_custom_scale;
c.assigned = p_name;
+ c.seeked = false;
+ c.started = true;
if (!end_reached)
queued.clear();
@@ -1006,10 +1272,12 @@ String AnimationPlayer::get_assigned_animation() const {
void AnimationPlayer::stop(bool p_reset) {
+ _stop_playing_caches();
Playback &c = playback;
c.blend.clear();
if (p_reset) {
c.current.from = NULL;
+ c.current.speed_scale = 1;
}
_set_process(false);
queued.clear();
@@ -1024,6 +1292,13 @@ float AnimationPlayer::get_speed_scale() const {
return speed_scale;
}
+float AnimationPlayer::get_playing_speed() const {
+
+ if (!playing) {
+ return 0;
+ }
+ return speed_scale * playback.current.speed_scale;
+}
void AnimationPlayer::seek(float p_time, bool p_update) {
@@ -1036,6 +1311,7 @@ void AnimationPlayer::seek(float p_time, bool p_update) {
}
playback.current.pos = p_time;
+ playback.seeked = true;
if (p_update) {
_animation_process(0);
}
@@ -1078,6 +1354,25 @@ float AnimationPlayer::get_current_animation_length() const {
void AnimationPlayer::_animation_changed() {
clear_caches();
+ emit_signal("caches_cleared");
+}
+
+void AnimationPlayer::_stop_playing_caches() {
+
+ for (Set<TrackNodeCache *>::Element *E = playing_caches.front(); E; E = E->next()) {
+
+ if (E->get()->node && E->get()->audio_playing) {
+ E->get()->node->call("stop");
+ }
+ if (E->get()->node && E->get()->animation_playing) {
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(E->get()->node);
+ if (!player)
+ continue;
+ player->stop();
+ }
+ }
+
+ playing_caches.clear();
}
void AnimationPlayer::_node_removed(Node *p_node) {
@@ -1087,6 +1382,8 @@ void AnimationPlayer::_node_removed(Node *p_node) {
void AnimationPlayer::clear_caches() {
+ _stop_playing_caches();
+
node_cache_map.clear();
for (Map<StringName, AnimationData>::Element *E = animation_set.front(); E; E = E->next()) {
@@ -1096,6 +1393,7 @@ void AnimationPlayer::clear_caches() {
cache_update_size = 0;
cache_update_prop_size = 0;
+ cache_update_bezier_size = 0;
}
void AnimationPlayer::set_active(bool p_active) {
@@ -1202,7 +1500,7 @@ NodePath AnimationPlayer::get_root() const {
void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
String pf = p_function;
- if (p_function == "play" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") {
+ if (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") {
List<StringName> al;
get_animation_list(&al);
for (List<StringName>::Element *E = al.front(); E; E = E->next()) {
@@ -1315,6 +1613,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed"), &AnimationPlayer::set_speed_scale);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimationPlayer::get_speed_scale);
+ ClassDB::bind_method(D_METHOD("get_playing_speed"), &AnimationPlayer::get_playing_speed);
ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimationPlayer::set_autoplay);
ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimationPlayer::get_autoplay);
@@ -1351,6 +1650,7 @@ void AnimationPlayer::_bind_methods() {
ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "anim_name")));
ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name")));
ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "anim_name")));
+ ADD_SIGNAL(MethodInfo("caches_cleared"));
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
@@ -1361,6 +1661,7 @@ AnimationPlayer::AnimationPlayer() {
accum_pass = 1;
cache_update_size = 0;
cache_update_prop_size = 0;
+ cache_update_bezier_size = 0;
speed_scale = 1;
end_reached = false;
end_notify = false;
@@ -1370,6 +1671,8 @@ AnimationPlayer::AnimationPlayer() {
root = SceneStringNames::get_singleton()->path_pp;
playing = false;
active = true;
+ playback.seeked = false;
+ playback.started = false;
}
AnimationPlayer::~AnimationPlayer() {
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index ef758bac44..49c73e54ad 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -98,6 +98,12 @@ private:
Vector3 scale_accum;
uint64_t accum_pass;
+ bool audio_playing;
+ float audio_start;
+ float audio_len;
+
+ bool animation_playing;
+
struct PropertyAnim {
TrackNodeCache *owner;
@@ -106,6 +112,7 @@ private:
Object *object;
Variant value_accum;
uint64_t accum_pass;
+ Variant capture;
PropertyAnim() {
accum_pass = 0;
object = NULL;
@@ -114,6 +121,22 @@ private:
Map<StringName, PropertyAnim> property_anim;
+ struct BezierAnim {
+
+ Vector<StringName> bezier_property;
+ TrackNodeCache *owner;
+ float bezier_accum;
+ Object *object;
+ uint64_t accum_pass;
+ BezierAnim() {
+ accum_pass = 0;
+ bezier_accum = 0;
+ object = NULL;
+ }
+ };
+
+ Map<StringName, BezierAnim> bezier_anim;
+
TrackNodeCache() {
skeleton = NULL;
spatial = NULL;
@@ -121,6 +144,8 @@ private:
accum_pass = 0;
bone_idx = -1;
node_2d = NULL;
+ audio_playing = false;
+ animation_playing = false;
}
};
@@ -146,6 +171,10 @@ private:
int cache_update_size;
TrackNodeCache::PropertyAnim *cache_update_prop[NODE_CACHE_UPDATE_MAX];
int cache_update_prop_size;
+ TrackNodeCache::BezierAnim *cache_update_bezier[NODE_CACHE_UPDATE_MAX];
+ int cache_update_bezier_size;
+ Set<TrackNodeCache *> playing_caches;
+
Map<Ref<Animation>, int> used_anims;
uint64_t accum_pass;
@@ -202,6 +231,8 @@ private:
List<Blend> blend;
PlaybackData current;
StringName assigned;
+ bool seeked;
+ bool started;
} playback;
List<StringName> queued;
@@ -216,15 +247,16 @@ private:
NodePath root;
- void _animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_allow_discrete = true);
+ void _animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_is_current = true, bool p_seeked = false, bool p_started = false);
void _ensure_node_caches(AnimationData *p_anim);
- void _animation_process_data(PlaybackData &cd, float p_delta, float p_blend);
- void _animation_process2(float p_delta);
+ void _animation_process_data(PlaybackData &cd, float p_delta, float p_blend, bool p_seeked, bool p_started);
+ void _animation_process2(float p_delta, bool p_started);
void _animation_update_transforms();
void _animation_process(float p_delta);
void _node_removed(Node *p_node);
+ void _stop_playing_caches();
// bind helpers
PoolVector<String> _get_animation_list() const {
@@ -293,6 +325,7 @@ public:
void set_speed_scale(float p_speed);
float get_speed_scale() const;
+ float get_playing_speed() const;
void set_autoplay(const String &p_name);
String get_autoplay() const;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
new file mode 100644
index 0000000000..83ec9f819b
--- /dev/null
+++ b/scene/animation/animation_tree.cpp
@@ -0,0 +1,1338 @@
+#include "animation_tree.h"
+#include "animation_blend_tree.h"
+#include "core/method_bind_ext.gen.inc"
+#include "engine.h"
+#include "scene/scene_string_names.h"
+#include "servers/audio/audio_stream.h"
+
+void AnimationNode::blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend) {
+
+ ERR_FAIL_COND(!state);
+ ERR_FAIL_COND(!state->player->has_animation(p_animation));
+
+ Ref<Animation> animation = state->player->get_animation(p_animation);
+
+ if (animation.is_null()) {
+
+ Ref<AnimationNodeBlendTree> btree = get_parent();
+ if (btree.is_valid()) {
+ String name = btree->get_node_name(Ref<AnimationNodeAnimation>(this));
+ make_invalid(vformat(RTR("In node '%s', invalid animation: '%s'."), name, p_animation));
+ } else {
+ make_invalid(vformat(RTR("Invalid animation: '%s'."), p_animation));
+ }
+ return;
+ }
+
+ ERR_FAIL_COND(!animation.is_valid());
+
+ AnimationState anim_state;
+ anim_state.blend = p_blend;
+ anim_state.track_blends = &blends;
+ anim_state.delta = p_delta;
+ anim_state.time = p_time;
+ anim_state.animation = animation;
+ anim_state.seeked = p_seeked;
+
+ state->animation_states.push_back(anim_state);
+}
+
+float AnimationNode::_pre_process(State *p_state, float p_time, bool p_seek) {
+ state = p_state;
+ float t = process(p_time, p_seek);
+ state = NULL;
+ return t;
+}
+
+void AnimationNode::make_invalid(const String &p_reason) {
+ ERR_FAIL_COND(!state);
+ state->valid = false;
+ if (state->invalid_reasons != String()) {
+ state->invalid_reasons += "\n";
+ }
+ state->invalid_reasons += "- " + p_reason;
+}
+
+float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
+ ERR_FAIL_INDEX_V(p_input, inputs.size(), 0);
+ ERR_FAIL_COND_V(!state, 0);
+ ERR_FAIL_COND_V(!get_tree(), 0); //should not happen, but used to catch bugs
+
+ Ref<AnimationNodeBlendTree> tree = get_parent();
+
+ if (!tree.is_valid() && get_tree()->get_tree_root().ptr() != this) {
+ make_invalid(RTR("Can't blend input because node is not in a tree"));
+ return 0;
+ }
+
+ ERR_FAIL_COND_V(!tree.is_valid(), 0); //should not happen
+
+ StringName anim_name = inputs[p_input].connected_to;
+
+ Ref<AnimationNode> node = tree->get_node(anim_name);
+
+ if (node.is_null()) {
+
+ String name = tree->get_node_name(Ref<AnimationNodeAnimation>(this));
+ make_invalid(vformat(RTR("Nothing connected to input '%s' of node '%s'."), get_input_name(p_input), name));
+ return 0;
+ }
+
+ inputs[p_input].last_pass = state->last_pass;
+
+ return _blend_node(node, p_time, p_seek, p_blend, p_filter, p_optimize, &inputs[p_input].activity);
+}
+
+float AnimationNode::blend_node(Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
+
+ return _blend_node(p_node, p_time, p_seek, p_blend, p_filter, p_optimize);
+}
+
+float AnimationNode::_blend_node(Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize, float *r_max) {
+
+ ERR_FAIL_COND_V(!p_node.is_valid(), 0);
+ ERR_FAIL_COND_V(!state, 0);
+
+ int blend_count = blends.size();
+
+ if (p_node->blends.size() != blend_count) {
+ p_node->blends.resize(blend_count);
+ }
+
+ float *blendw = p_node->blends.ptrw();
+ const float *blendr = blends.ptr();
+
+ bool any_valid = false;
+
+ if (has_filter() && is_filter_enabled() && p_filter != FILTER_IGNORE) {
+
+ for (int i = 0; i < blend_count; i++) {
+ blendw[i] = 0.0; //all to zero by default
+ }
+
+ const NodePath *K = NULL;
+ while ((K = filter.next(K))) {
+ if (!state->track_map.has(*K)) {
+ continue;
+ }
+ int idx = state->track_map[*K];
+ blendw[idx] = 1.0; //filtered goes to one
+ }
+
+ switch (p_filter) {
+ case FILTER_IGNORE:
+ break; //will not happen anyway
+ case FILTER_PASS: {
+ //values filtered pass, the rest dont
+ for (int i = 0; i < blend_count; i++) {
+ if (blendw[i] == 0) //not filtered, does not pass
+ continue;
+
+ blendw[i] = blendr[i] * p_blend;
+ if (blendw[i] > CMP_EPSILON) {
+ any_valid = true;
+ }
+ }
+
+ } break;
+ case FILTER_STOP: {
+
+ //values filtered dont pass, the rest are blended
+
+ for (int i = 0; i < blend_count; i++) {
+ if (blendw[i] > 0) //filtered, does not pass
+ continue;
+
+ blendw[i] = blendr[i] * p_blend;
+ if (blendw[i] > CMP_EPSILON) {
+ any_valid = true;
+ }
+ }
+
+ } break;
+ case FILTER_BLEND: {
+
+ //filtered values are blended, the rest are passed without blending
+
+ for (int i = 0; i < blend_count; i++) {
+ if (blendw[i] == 1.0) {
+ blendw[i] = blendr[i] * p_blend; //filtered, blend
+ } else {
+ blendw[i] = blendr[i]; //not filtered, do not blend
+ }
+
+ if (blendw[i] > CMP_EPSILON) {
+ any_valid = true;
+ }
+ }
+
+ } break;
+ }
+ } else {
+ for (int i = 0; i < blend_count; i++) {
+
+ //regular blend
+ blendw[i] = blendr[i] * p_blend;
+ if (blendw[i] > CMP_EPSILON) {
+ any_valid = true;
+ }
+ }
+ }
+
+ if (r_max) {
+ *r_max = 0;
+ for (int i = 0; i < blend_count; i++) {
+ *r_max = MAX(*r_max, blendw[i]);
+ }
+ }
+
+ if (!p_seek && p_optimize && !any_valid) //pointless to go on, all are zero
+ return 0;
+
+ return p_node->_pre_process(state, p_time, p_seek);
+}
+
+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;
+}
+
+float AnimationNode::get_input_activity(int p_input) const {
+
+ ERR_FAIL_INDEX_V(p_input, inputs.size(), 0);
+ if (!get_tree())
+ return 0;
+
+ if (get_tree()->get_last_process_pass() != inputs[p_input].last_pass) {
+ return 0;
+ }
+ return inputs[p_input].activity;
+}
+StringName AnimationNode::get_input_connection(int p_input) {
+
+ ERR_FAIL_INDEX_V(p_input, inputs.size(), StringName());
+ return inputs[p_input].connected_to;
+}
+
+void AnimationNode::set_input_connection(int p_input, const StringName &p_connection) {
+
+ ERR_FAIL_INDEX(p_input, inputs.size());
+ inputs[p_input].connected_to = p_connection;
+}
+
+String AnimationNode::get_caption() const {
+
+ if (get_script_instance()) {
+ return get_script_instance()->call("get_caption");
+ }
+
+ return "Node";
+}
+
+void AnimationNode::add_input(const String &p_name) {
+ //root nodes cant add inputs
+ ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != NULL)
+ Input input;
+ ERR_FAIL_COND(p_name.find(".") != -1 || p_name.find("/") != -1);
+ input.name = p_name;
+ input.activity = 0;
+ input.last_pass = 0;
+ 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.find(".") != -1 || p_name.find("/") != -1);
+ inputs[p_input].name = p_name;
+ emit_changed();
+}
+
+void AnimationNode::remove_input(int p_index) {
+ ERR_FAIL_INDEX(p_index, inputs.size());
+ inputs.remove(p_index);
+ emit_changed();
+}
+
+void AnimationNode::_set_parent(Object *p_parent) {
+ set_parent(Object::cast_to<AnimationNode>(p_parent));
+}
+
+void AnimationNode::set_parent(AnimationNode *p_parent) {
+ parent = p_parent; //do not use ref because parent contains children
+ if (get_script_instance()) {
+ get_script_instance()->call("_parent_set", p_parent);
+ }
+}
+
+Ref<AnimationNode> AnimationNode::get_parent() const {
+ if (parent) {
+ return Ref<AnimationNode>(parent);
+ }
+
+ return Ref<AnimationNode>();
+}
+
+AnimationTree *AnimationNode::get_tree() const {
+
+ return player;
+}
+
+AnimationPlayer *AnimationNode::get_player() const {
+ ERR_FAIL_COND_V(!state, NULL);
+ return state->player;
+}
+
+float AnimationNode::process(float p_time, bool p_seek) {
+
+ if (get_script_instance()) {
+ return get_script_instance()->call("process", p_time, p_seek);
+ }
+
+ return 0;
+}
+
+void AnimationNode::set_filter_path(const NodePath &p_path, bool p_enable) {
+ if (p_enable) {
+ filter[p_path] = true;
+ } else {
+ filter.erase(p_path);
+ }
+}
+
+void AnimationNode::set_filter_enabled(bool p_enable) {
+ filter_enabled = p_enable;
+}
+
+bool AnimationNode::is_filter_enabled() const {
+ return filter_enabled;
+}
+
+bool AnimationNode::is_path_filtered(const NodePath &p_path) const {
+ return filter.has(p_path);
+}
+
+bool AnimationNode::has_filter() const {
+ return false;
+}
+
+void AnimationNode::set_position(const Vector2 &p_position) {
+ position = p_position;
+}
+
+Vector2 AnimationNode::get_position() const {
+ return position;
+}
+
+void AnimationNode::set_tree(AnimationTree *p_player) {
+
+ if (player != NULL && p_player == NULL) {
+ emit_signal("removed_from_graph");
+ }
+ player = p_player;
+}
+
+Array AnimationNode::_get_filters() const {
+
+ Array paths;
+
+ const NodePath *K = NULL;
+ while ((K = filter.next(K))) {
+ paths.push_back(String(*K)); //use strings, so sorting is possible
+ }
+ paths.sort(); //done so every time the scene is saved, it does not change
+
+ return paths;
+}
+void AnimationNode::_set_filters(const Array &p_filters) {
+ filter.clear();
+ for (int i = 0; i < p_filters.size(); i++) {
+ set_filter_path(p_filters[i], true);
+ }
+}
+
+void AnimationNode::_validate_property(PropertyInfo &property) const {
+ if (!has_filter() && (property.name == "filter_enabled" || property.name == "filters")) {
+ property.usage = 0;
+ }
+}
+
+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("get_input_connection", "input"), &AnimationNode::get_input_connection);
+ ClassDB::bind_method(D_METHOD("get_input_activity", "input"), &AnimationNode::get_input_activity);
+
+ 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_filter_path", "path", "enable"), &AnimationNode::set_filter_path);
+ ClassDB::bind_method(D_METHOD("is_path_filtered", "path"), &AnimationNode::is_path_filtered);
+
+ ClassDB::bind_method(D_METHOD("set_filter_enabled", "enable"), &AnimationNode::set_filter_enabled);
+ ClassDB::bind_method(D_METHOD("is_filter_enabled"), &AnimationNode::is_filter_enabled);
+
+ ClassDB::bind_method(D_METHOD("set_position", "position"), &AnimationNode::set_position);
+ ClassDB::bind_method(D_METHOD("get_position"), &AnimationNode::get_position);
+
+ ClassDB::bind_method(D_METHOD("_set_filters", "filters"), &AnimationNode::_set_filters);
+ ClassDB::bind_method(D_METHOD("_get_filters"), &AnimationNode::_get_filters);
+
+ ClassDB::bind_method(D_METHOD("blend_animation", "animation", "time", "delta", "seeked", "blend"), &AnimationNode::blend_animation);
+ ClassDB::bind_method(D_METHOD("blend_node", "node", "time", "seek", "blend", "filter", "optimize"), &AnimationNode::blend_node, DEFVAL(FILTER_IGNORE), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("blend_input", "input_index", "time", "seek", "blend", "filter", "optimize"), &AnimationNode::blend_input, DEFVAL(FILTER_IGNORE), DEFVAL(true));
+
+ ClassDB::bind_method(D_METHOD("set_parent", "parent"), &AnimationNode::_set_parent);
+ ClassDB::bind_method(D_METHOD("get_parent"), &AnimationNode::get_parent);
+ ClassDB::bind_method(D_METHOD("get_tree"), &AnimationNode::get_tree);
+
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_filter_enabled", "is_filter_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "filters", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_filters", "_get_filters");
+
+ BIND_VMETHOD(MethodInfo("process", PropertyInfo(Variant::REAL, "time"), PropertyInfo(Variant::BOOL, "seek")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "get_caption"));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "has_filter"));
+ BIND_VMETHOD(MethodInfo("_parent_set", PropertyInfo(Variant::OBJECT, "parent")));
+
+ ADD_SIGNAL(MethodInfo("removed_from_graph"));
+ BIND_ENUM_CONSTANT(FILTER_IGNORE);
+ BIND_ENUM_CONSTANT(FILTER_PASS);
+ BIND_ENUM_CONSTANT(FILTER_STOP);
+ BIND_ENUM_CONSTANT(FILTER_BLEND);
+}
+
+AnimationNode::AnimationNode() {
+
+ state = NULL;
+ parent = NULL;
+ player = NULL;
+ set_local_to_scene(true);
+ filter_enabled = false;
+}
+
+////////////////////
+
+void AnimationTree::set_tree_root(const Ref<AnimationNode> &p_root) {
+
+ if (root.is_valid()) {
+ root->set_tree(NULL);
+ }
+ if (p_root.is_valid()) {
+ ERR_EXPLAIN("root node already set to another player");
+ ERR_FAIL_COND(p_root->player);
+ }
+ root = p_root;
+
+ if (root.is_valid()) {
+ root->set_tree(this);
+ }
+
+ update_configuration_warning();
+}
+
+Ref<AnimationNode> AnimationTree::get_tree_root() const {
+ return root;
+}
+
+void AnimationTree::set_active(bool p_active) {
+
+ if (active == p_active)
+ return;
+
+ active = p_active;
+ started = active;
+
+ if (process_mode == ANIMATION_PROCESS_IDLE) {
+ set_process_internal(active);
+ } else {
+
+ set_physics_process_internal(active);
+ }
+
+ if (!active && is_inside_tree()) {
+ for (Set<TrackCache *>::Element *E = playing_caches.front(); E; E = E->next()) {
+
+ if (ObjectDB::get_instance(E->get()->object_id)) {
+ E->get()->object->call("stop");
+ }
+ }
+
+ playing_caches.clear();
+ }
+}
+
+bool AnimationTree::is_active() const {
+
+ return active;
+}
+
+void AnimationTree::set_process_mode(AnimationProcessMode p_mode) {
+
+ if (process_mode == p_mode)
+ return;
+
+ bool was_active = is_active();
+ if (was_active) {
+ set_active(false);
+ }
+
+ process_mode = p_mode;
+
+ if (was_active) {
+ set_active(true);
+ }
+}
+
+AnimationTree::AnimationProcessMode AnimationTree::get_process_mode() const {
+ return process_mode;
+}
+
+void AnimationTree::_node_removed(Node *p_node) {
+ cache_valid = false;
+}
+
+bool AnimationTree::_update_caches(AnimationPlayer *player) {
+
+ setup_pass++;
+
+ if (!player->has_node(player->get_root())) {
+ ERR_PRINT("AnimationTree: AnimationPlayer root is invalid.");
+ set_active(false);
+ return false;
+ }
+ Node *parent = player->get_node(player->get_root());
+
+ List<StringName> sname;
+ player->get_animation_list(&sname);
+
+ for (List<StringName>::Element *E = sname.front(); E; E = E->next()) {
+ Ref<Animation> anim = player->get_animation(E->get());
+ for (int i = 0; i < anim->get_track_count(); i++) {
+ NodePath path = anim->track_get_path(i);
+ Animation::TrackType track_type = anim->track_get_type(i);
+
+ TrackCache *track = NULL;
+ if (track_cache.has(path)) {
+ track = track_cache.get(path);
+ }
+
+ //if not valid, delete track
+ if (track && (track->type != track_type || ObjectDB::get_instance(track->object_id) == NULL)) {
+ playing_caches.erase(track);
+ memdelete(track);
+ track_cache.erase(path);
+ track = NULL;
+ }
+
+ if (!track) {
+
+ RES resource;
+ Vector<StringName> leftover_path;
+ Node *child = parent->get_node_and_resource(path, resource, leftover_path);
+
+ if (!child) {
+ ERR_PRINTS("AnimationTree: '" + String(E->get()) + "', couldn't resolve track: '" + String(path) + "'");
+ continue;
+ }
+
+ if (!child->is_connected("tree_exited", this, "_node_removed")) {
+ child->connect("tree_exited", this, "_node_removed", varray(child));
+ }
+
+ switch (track_type) {
+ case Animation::TYPE_VALUE: {
+
+ TrackCacheValue *track_value = memnew(TrackCacheValue);
+
+ if (resource.is_valid()) {
+ track_value->object = resource.ptr();
+ } else {
+ track_value->object = child;
+ }
+
+ track_value->subpath = leftover_path;
+ track_value->object_id = track_value->object->get_instance_id();
+
+ track = track_value;
+
+ } break;
+ case Animation::TYPE_TRANSFORM: {
+
+ Spatial *spatial = Object::cast_to<Spatial>(child);
+
+ if (!spatial) {
+ ERR_PRINTS("AnimationTree: '" + String(E->get()) + "', transform track does not point to spatial: '" + String(path) + "'");
+ continue;
+ }
+
+ TrackCacheTransform *track_xform = memnew(TrackCacheTransform);
+
+ track_xform->spatial = spatial;
+ track_xform->skeleton = NULL;
+ track_xform->bone_idx = -1;
+
+ if (path.get_subname_count() == 1 && Object::cast_to<Skeleton>(spatial)) {
+
+ Skeleton *sk = Object::cast_to<Skeleton>(spatial);
+ int bone_idx = sk->find_bone(path.get_subname(0));
+ if (bone_idx != -1 && !sk->is_bone_ignore_animation(bone_idx)) {
+
+ track_xform->skeleton = sk;
+ track_xform->bone_idx = bone_idx;
+ }
+ }
+
+ track_xform->object = spatial;
+ track_xform->object_id = track_xform->object->get_instance_id();
+
+ track = track_xform;
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ TrackCacheMethod *track_method = memnew(TrackCacheMethod);
+
+ if (resource.is_valid()) {
+ track_method->object = resource.ptr();
+ } else {
+ track_method->object = child;
+ }
+
+ track_method->object_id = track_method->object->get_instance_id();
+
+ track = track_method;
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ TrackCacheBezier *track_bezier = memnew(TrackCacheBezier);
+
+ if (resource.is_valid()) {
+ track_bezier->object = resource.ptr();
+ } else {
+ track_bezier->object = child;
+ }
+
+ track_bezier->subpath = leftover_path;
+ track_bezier->object_id = track_bezier->object->get_instance_id();
+
+ track = track_bezier;
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ TrackCacheAudio *track_audio = memnew(TrackCacheAudio);
+
+ track_audio->object = child;
+ track_audio->object_id = track_audio->object->get_instance_id();
+
+ track = track_audio;
+
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ TrackCacheAnimation *track_animation = memnew(TrackCacheAnimation);
+
+ track_animation->object = child;
+ track_animation->object_id = track_animation->object->get_instance_id();
+
+ track = track_animation;
+
+ } break;
+ }
+
+ track_cache[path] = track;
+ }
+
+ track->setup_pass = setup_pass;
+ }
+ }
+
+ List<NodePath> to_delete;
+
+ const NodePath *K = NULL;
+ while ((K = track_cache.next(K))) {
+ TrackCache *tc = track_cache[*K];
+ if (tc->setup_pass != setup_pass) {
+ to_delete.push_back(*K);
+ }
+ }
+
+ while (to_delete.front()) {
+ NodePath np = to_delete.front()->get();
+ memdelete(track_cache[np]);
+ track_cache.erase(np);
+ to_delete.pop_front();
+ }
+
+ state.track_map.clear();
+
+ K = NULL;
+ int idx = 0;
+ while ((K = track_cache.next(K))) {
+ state.track_map[*K] = idx;
+ idx++;
+ }
+
+ state.track_count = idx;
+
+ cache_valid = true;
+
+ return true;
+}
+
+void AnimationTree::_clear_caches() {
+
+ const NodePath *K = NULL;
+ while ((K = track_cache.next(K))) {
+ memdelete(track_cache[*K]);
+ }
+ playing_caches.clear();
+
+ track_cache.clear();
+ cache_valid = false;
+}
+
+void AnimationTree::_process_graph(float p_delta) {
+
+ //check all tracks, see if they need modification
+ root_motion_transform = Transform();
+
+ if (!root.is_valid()) {
+ ERR_PRINT("AnimationTree: root AnimationNode is not set, disabling playback.");
+ set_active(false);
+ cache_valid = false;
+ return;
+ }
+
+ if (!has_node(animation_player)) {
+ ERR_PRINT("AnimationTree: no valid AnimationPlayer path set, disabling playback");
+ set_active(false);
+ cache_valid = false;
+ return;
+ }
+
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));
+
+ if (!player) {
+ ERR_PRINT("AnimationTree: path points to a node not an AnimationPlayer, disabling playback");
+ set_active(false);
+ cache_valid = false;
+ return;
+ }
+
+ if (!cache_valid) {
+ if (!_update_caches(player)) {
+ return;
+ }
+ }
+
+ { //setup
+
+ process_pass++;
+
+ state.valid = true;
+ state.invalid_reasons = "";
+ state.animation_states.clear(); //will need to be re-created
+ state.valid = true;
+ state.player = player;
+ state.last_pass = process_pass;
+
+ // root source blends
+
+ root->blends.resize(state.track_count);
+ float *src_blendsw = root->blends.ptrw();
+ for (int i = 0; i < state.track_count; i++) {
+ src_blendsw[i] = 1.0; //by default all go to 1 for the root input
+ }
+ }
+
+ //process
+
+ {
+
+ if (started) {
+ //if started, seek
+ root->_pre_process(&state, 0, true);
+ started = false;
+ }
+
+ root->_pre_process(&state, p_delta, false);
+ }
+
+ if (!state.valid) {
+ return; //state is not valid. do nothing.
+ }
+ //apply value/transform/bezier blends to track caches and execute method/audio/animation tracks
+
+ {
+
+ bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint();
+
+ for (List<AnimationNode::AnimationState>::Element *E = state.animation_states.front(); E; E = E->next()) {
+
+ const AnimationNode::AnimationState &as = E->get();
+
+ Ref<Animation> a = as.animation;
+ float time = as.time;
+ float delta = as.delta;
+ bool seeked = as.seeked;
+
+ for (int i = 0; i < a->get_track_count(); i++) {
+
+ NodePath path = a->track_get_path(i);
+ TrackCache *track = track_cache[path];
+ if (track->type != a->track_get_type(i)) {
+ continue; //may happen should not
+ }
+
+ track->root_motion = root_motion_track == path;
+
+ ERR_CONTINUE(!state.track_map.has(path));
+ int blend_idx = state.track_map[path];
+
+ ERR_CONTINUE(blend_idx < 0 || blend_idx >= state.track_count);
+
+ float blend = (*as.track_blends)[blend_idx];
+
+ if (blend < CMP_EPSILON)
+ continue; //nothing to blend
+
+ switch (track->type) {
+
+ case Animation::TYPE_TRANSFORM: {
+
+ TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
+
+ if (t->process_pass != process_pass) {
+
+ t->process_pass = process_pass;
+ t->loc = Vector3();
+ t->rot = Quat();
+ t->rot_blend_accum = 0;
+ t->scale = Vector3();
+ }
+
+ if (track->root_motion) {
+
+ float prev_time = time - delta;
+ if (prev_time < 0) {
+ if (!a->has_loop()) {
+ prev_time = 0;
+ } else {
+ prev_time = a->get_length() + prev_time;
+ }
+ }
+
+ Vector3 loc[2];
+ Quat rot[2];
+ Vector3 scale[2];
+
+ if (prev_time > time) {
+
+ Error err = a->transform_track_interpolate(i, prev_time, &loc[0], &rot[0], &scale[0]);
+ if (err != OK) {
+ continue;
+ }
+
+ a->transform_track_interpolate(i, a->get_length(), &loc[1], &rot[1], &scale[1]);
+
+ t->loc += (loc[1] - loc[0]) * blend;
+ t->scale += (scale[1] - scale[0]) * blend;
+ Quat q = Quat().slerp(rot[0].normalized().inverse() * rot[1].normalized(), blend).normalized();
+ t->rot = (t->rot * q).normalized();
+
+ prev_time = 0;
+ }
+
+ Error err = a->transform_track_interpolate(i, prev_time, &loc[0], &rot[0], &scale[0]);
+ if (err != OK) {
+ continue;
+ }
+
+ a->transform_track_interpolate(i, time, &loc[1], &rot[1], &scale[1]);
+
+ t->loc += (loc[1] - loc[0]) * blend;
+ t->scale += (scale[1] - scale[0]) * blend;
+ Quat q = Quat().slerp(rot[0].normalized().inverse() * rot[1].normalized(), blend).normalized();
+ t->rot = (t->rot * q).normalized();
+
+ prev_time = 0;
+
+ } else {
+ Vector3 loc;
+ Quat rot;
+ Vector3 scale;
+
+ Error err = a->transform_track_interpolate(i, time, &loc, &rot, &scale);
+ //ERR_CONTINUE(err!=OK); //used for testing, should be removed
+
+ scale -= Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes
+
+ if (err != OK)
+ continue;
+
+ t->loc = t->loc.linear_interpolate(loc, blend);
+ if (t->rot_blend_accum==0) {
+ t->rot = rot;
+ t->rot_blend_accum = blend;
+ } else {
+ float rot_total = t->rot_blend_accum + blend;
+ t->rot = rot.slerp(t->rot, t->rot_blend_accum / rot_total).normalized();
+ t->rot_blend_accum = rot_total;
+ }
+ t->scale = t->scale.linear_interpolate(scale, blend);
+ }
+
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ 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) { //delta == 0 means seek
+
+ Variant value = a->value_track_interpolate(i, time);
+
+ if (value == Variant())
+ continue;
+
+ if (t->process_pass != process_pass) {
+ Variant::CallError ce;
+ t->value = Variant::construct(value.get_type(), NULL, 0, ce); //reset
+ t->process_pass = process_pass;
+ }
+
+ Variant::interpolate(t->value, value, blend, t->value);
+
+ } else if (delta != 0) {
+
+ List<int> indices;
+ a->value_track_get_key_indices(i, time, delta, &indices);
+
+ for (List<int>::Element *F = indices.front(); F; F = F->next()) {
+
+ Variant value = a->track_get_key_value(i, F->get());
+ t->object->set_indexed(t->subpath, value);
+ }
+ }
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ if (delta == 0) {
+ continue;
+ }
+ TrackCacheMethod *t = static_cast<TrackCacheMethod *>(track);
+
+ List<int> indices;
+
+ a->method_track_get_key_indices(i, time, delta, &indices);
+
+ for (List<int>::Element *E = indices.front(); E; E = E->next()) {
+
+ StringName method = a->method_track_get_name(i, E->get());
+ Vector<Variant> params = a->method_track_get_params(i, E->get());
+
+ int s = params.size();
+
+ ERR_CONTINUE(s > VARIANT_ARG_MAX);
+ if (can_call) {
+ t->object->call_deferred(
+ method,
+ s >= 1 ? params[0] : Variant(),
+ s >= 2 ? params[1] : Variant(),
+ s >= 3 ? params[2] : Variant(),
+ s >= 4 ? params[3] : Variant(),
+ s >= 5 ? params[4] : Variant());
+ }
+ }
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ TrackCacheBezier *t = static_cast<TrackCacheBezier *>(track);
+
+ float bezier = a->bezier_track_interpolate(i, time);
+
+ if (t->process_pass != process_pass) {
+ t->value = 0;
+ t->process_pass = process_pass;
+ }
+
+ t->value = Math::lerp(t->value, bezier, blend);
+
+ } break;
+ case Animation::TYPE_AUDIO: {
+
+ TrackCacheAudio *t = static_cast<TrackCacheAudio *>(track);
+
+ if (seeked) {
+ //find whathever should be playing
+ int idx = a->track_find_key(i, time);
+ if (idx < 0)
+ continue;
+
+ Ref<AudioStream> stream = a->audio_track_get_key_stream(i, idx);
+ if (!stream.is_valid()) {
+ t->object->call("stop");
+ t->playing = false;
+ playing_caches.erase(t);
+ } else {
+ float start_ofs = a->audio_track_get_key_start_offset(i, idx);
+ start_ofs += 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) {
+ t->object->call("stop");
+ t->playing = false;
+ playing_caches.erase(t);
+ continue;
+ }
+
+ t->object->call("set_stream", stream);
+ t->object->call("play", start_ofs);
+
+ t->playing = true;
+ playing_caches.insert(t);
+ if (len && end_ofs > 0) { //force a end at a time
+ t->len = len - start_ofs - end_ofs;
+ } else {
+ t->len = 0;
+ }
+
+ t->start = time;
+ }
+
+ } else {
+ //find stuff to play
+ List<int> to_play;
+ a->track_get_key_indices_in_range(i, time, delta, &to_play);
+ 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("stop");
+ t->playing = false;
+ playing_caches.erase(t);
+ } 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();
+
+ t->object->call("set_stream", stream);
+ t->object->call("play", start_ofs);
+
+ t->playing = true;
+ playing_caches.insert(t);
+ if (len && end_ofs > 0) { //force a 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->has_loop();
+
+ bool stop = false;
+
+ if (!loop && time < t->start) {
+ stop = true;
+ } else if (t->len > 0) {
+ float len = t->start > time ? (a->get_length() - t->start) + time : time - t->start;
+
+ if (len > t->len) {
+ stop=true;
+ }
+ }
+
+ if (stop) {
+ //time to stop
+ t->object->call("stop");
+ t->playing = false;
+ playing_caches.erase(t);
+ }
+ }
+ }
+
+ float db = Math::linear2db(MAX(blend,0.00001));
+ if (t->object->has_method("set_unit_db")) {
+ t->object->call("set_unit_db", db);
+ } else {
+ t->object->call("set_volume_db", db);
+ }
+ } break;
+ case Animation::TYPE_ANIMATION: {
+
+ TrackCacheAnimation *t = static_cast<TrackCacheAnimation *>(track);
+
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(t->object);
+
+ if (!player)
+ continue;
+
+ if (delta == 0 || seeked) {
+ //seek
+ int idx = a->track_find_key(i, time);
+ if (idx < 0)
+ continue;
+
+ float pos = a->track_get_key_time(i, idx);
+
+ StringName anim_name = a->animation_track_get_key_animation(i, idx);
+ if (String(anim_name) == "[stop]" || !player->has_animation(anim_name))
+ continue;
+
+ Ref<Animation> anim = player->get_animation(anim_name);
+
+ float at_anim_pos;
+
+ if (anim->has_loop()) {
+ at_anim_pos = Math::fposmod(time - pos, anim->get_length()); //seek to loop
+ } else {
+ at_anim_pos = MAX(anim->get_length(), time - pos); //seek to end
+ }
+
+ if (player->is_playing() || seeked) {
+ player->play(anim_name);
+ player->seek(at_anim_pos);
+ t->playing = true;
+ playing_caches.insert(t);
+ } else {
+ player->set_assigned_animation(anim_name);
+ player->seek(at_anim_pos, true);
+ }
+ } else {
+ //find stuff to play
+ List<int> to_play;
+ a->track_get_key_indices_in_range(i, time, delta, &to_play);
+ if (to_play.size()) {
+ int idx = to_play.back()->get();
+
+ StringName anim_name = a->animation_track_get_key_animation(i, idx);
+ if (String(anim_name) == "[stop]" || !player->has_animation(anim_name)) {
+
+ if (playing_caches.has(t)) {
+ playing_caches.erase(t);
+ player->stop();
+ t->playing = false;
+ }
+ } else {
+ player->play(anim_name);
+ t->playing = true;
+ playing_caches.insert(t);
+ }
+ }
+ }
+
+ } break;
+ }
+ }
+ }
+ }
+
+ {
+ // finally, set the tracks
+ const NodePath *K = NULL;
+ while ((K = track_cache.next(K))) {
+ TrackCache *track = track_cache[*K];
+ if (track->process_pass != process_pass)
+ continue; //not processed, ignore
+
+ switch (track->type) {
+
+ case Animation::TYPE_TRANSFORM: {
+
+ TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
+
+ Transform xform;
+ xform.origin = t->loc;
+
+ t->scale += Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes and root motion
+
+ xform.basis.set_quat_scale(t->rot, t->scale);
+
+ if (t->root_motion) {
+
+ root_motion_transform = xform;
+
+ if (t->skeleton && t->bone_idx >= 0) {
+ root_motion_transform = (t->skeleton->get_bone_rest(t->bone_idx) * root_motion_transform) * t->skeleton->get_bone_rest(t->bone_idx).affine_inverse();
+ }
+ } else if (t->skeleton && t->bone_idx >= 0) {
+
+ t->skeleton->set_bone_pose(t->bone_idx, xform);
+
+ } else {
+
+ t->spatial->set_transform(xform);
+ }
+
+ } break;
+ case Animation::TYPE_VALUE: {
+
+ TrackCacheValue *t = static_cast<TrackCacheValue *>(track);
+
+ t->object->set_indexed(t->subpath, t->value);
+
+ } break;
+ case Animation::TYPE_BEZIER: {
+
+ TrackCacheBezier *t = static_cast<TrackCacheBezier *>(track);
+
+ t->object->set_indexed(t->subpath, t->value);
+
+ } break;
+ default: {} //the rest dont matter
+ }
+ }
+ }
+}
+
+void AnimationTree::_notification(int p_what) {
+
+ if (active && p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS && process_mode == ANIMATION_PROCESS_PHYSICS) {
+ _process_graph(get_physics_process_delta_time());
+ }
+
+ if (active && p_what == NOTIFICATION_INTERNAL_PROCESS && process_mode == ANIMATION_PROCESS_IDLE) {
+ _process_graph(get_process_delta_time());
+ }
+
+ if (p_what == NOTIFICATION_EXIT_TREE) {
+ _clear_caches();
+ }
+}
+
+void AnimationTree::set_animation_player(const NodePath &p_player) {
+ animation_player = p_player;
+ update_configuration_warning();
+}
+
+NodePath AnimationTree::get_animation_player() const {
+ return animation_player;
+}
+
+bool AnimationTree::is_state_invalid() const {
+
+ return !state.valid;
+}
+String AnimationTree::get_invalid_state_reason() const {
+
+ return state.invalid_reasons;
+}
+
+uint64_t AnimationTree::get_last_process_pass() const {
+ return process_pass;
+}
+
+String AnimationTree::get_configuration_warning() const {
+
+ String warning = Node::get_configuration_warning();
+
+ if (!root.is_valid()) {
+ if (warning != String()) {
+ warning += "\n";
+ }
+ warning += TTR("A root AnimationNode for the graph is not set.");
+ }
+
+ if (!has_node(animation_player)) {
+
+ if (warning != String()) {
+ warning += "\n";
+ }
+
+ warning += TTR("Path to an AnimationPlayer node containing animations is not set.");
+ return warning;
+ }
+
+ AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));
+
+ if (!player) {
+ if (warning != String()) {
+ warning += "\n";
+ }
+
+ warning += TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node.");
+ return warning;
+ }
+
+ if (!player->has_node(player->get_root())) {
+ if (warning != String()) {
+ warning += "\n";
+ }
+
+ warning += TTR("AnimationPlayer root is not a valid node.");
+ return warning;
+ }
+
+ return warning;
+}
+
+void AnimationTree::set_root_motion_track(const NodePath &p_track) {
+ root_motion_track = p_track;
+}
+
+NodePath AnimationTree::get_root_motion_track() const {
+ return root_motion_track;
+}
+
+Transform AnimationTree::get_root_motion_transform() const {
+ return root_motion_transform;
+}
+
+void AnimationTree::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active);
+ ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active);
+
+ ClassDB::bind_method(D_METHOD("set_tree_root", "root"), &AnimationTree::set_tree_root);
+ ClassDB::bind_method(D_METHOD("get_tree_root"), &AnimationTree::get_tree_root);
+
+ ClassDB::bind_method(D_METHOD("set_process_mode", "mode"), &AnimationTree::set_process_mode);
+ ClassDB::bind_method(D_METHOD("get_process_mode"), &AnimationTree::get_process_mode);
+
+ ClassDB::bind_method(D_METHOD("set_animation_player", "root"), &AnimationTree::set_animation_player);
+ ClassDB::bind_method(D_METHOD("get_animation_player"), &AnimationTree::get_animation_player);
+
+ 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("get_root_motion_transform"), &AnimationTree::get_root_motion_transform);
+
+
+
+ ClassDB::bind_method(D_METHOD("_node_removed"), &AnimationTree::_node_removed);
+
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tree_root", PROPERTY_HINT_RESOURCE_TYPE, "AnimationRootNode", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "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::BOOL, "active"), "set_active", "is_active");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_process_mode", "get_process_mode");
+ ADD_GROUP("Root Motion", "root_motion_");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "root_motion_track"), "set_root_motion_track", "get_root_motion_track");
+}
+
+AnimationTree::AnimationTree() {
+
+ process_mode = ANIMATION_PROCESS_IDLE;
+ active = false;
+ cache_valid = false;
+ setup_pass = 1;
+ started = true;
+}
+
+AnimationTree::~AnimationTree() {
+ if (root.is_valid()) {
+ root->player = NULL;
+ }
+}
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
new file mode 100644
index 0000000000..540c36437a
--- /dev/null
+++ b/scene/animation/animation_tree.h
@@ -0,0 +1,281 @@
+#ifndef ANIMATION_GRAPH_PLAYER_H
+#define ANIMATION_GRAPH_PLAYER_H
+
+#include "animation_player.h"
+#include "scene/3d/skeleton.h"
+#include "scene/3d/spatial.h"
+#include "scene/resources/animation.h"
+
+class AnimationNodeBlendTree;
+class AnimationPlayer;
+class AnimationTree;
+
+class AnimationNode : public Resource {
+ GDCLASS(AnimationNode, Resource)
+public:
+ enum FilterAction {
+ FILTER_IGNORE,
+ FILTER_PASS,
+ FILTER_STOP,
+ FILTER_BLEND
+ };
+
+ struct Input {
+
+ String name;
+ StringName connected_to;
+ float activity;
+ uint64_t last_pass;
+ };
+
+ Vector<Input> inputs;
+
+ float process_input(int p_input, float p_time, bool p_seek, float p_blend);
+
+ friend class AnimationTree;
+
+ struct AnimationState {
+
+ Ref<Animation> animation;
+ float time;
+ float delta;
+ const Vector<float> *track_blends;
+ float blend;
+ bool seeked;
+ };
+
+ struct State {
+
+ int track_count;
+ HashMap<NodePath, int> track_map;
+ List<AnimationState> animation_states;
+ bool valid;
+ AnimationPlayer *player;
+ String invalid_reasons;
+ uint64_t last_pass;
+ };
+
+ Vector<float> blends;
+ State *state;
+ float _pre_process(State *p_state, float p_time, bool p_seek);
+ void _pre_update_animations(HashMap<NodePath, int> *track_map);
+ Vector2 position;
+
+ AnimationNode *parent;
+ AnimationTree *player;
+
+ float _blend_node(Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true, float *r_max = NULL);
+
+ HashMap<NodePath, bool> filter;
+ bool filter_enabled;
+
+ Array _get_filters() const;
+ void _set_filters(const Array &p_filters);
+
+protected:
+ void blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend);
+ float blend_node(Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true);
+ float blend_input(int p_input, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true);
+ void make_invalid(const String &p_reason);
+
+ static void _bind_methods();
+
+ void _validate_property(PropertyInfo &property) const;
+
+ void _set_parent(Object *p_parent);
+
+public:
+ void set_parent(AnimationNode *p_parent);
+ Ref<AnimationNode> get_parent() const;
+ virtual void set_tree(AnimationTree *p_player);
+ AnimationTree *get_tree() const;
+ AnimationPlayer *get_player() const;
+
+ virtual float process(float p_time, bool p_seek);
+ virtual String get_caption() const;
+
+ int get_input_count() const;
+ String get_input_name(int p_input);
+ StringName get_input_connection(int p_input);
+ void set_input_connection(int p_input, const StringName &p_connection);
+ float get_input_activity(int p_input) const;
+
+ void add_input(const String &p_name);
+ void set_input_name(int p_input, const String &p_name);
+ void remove_input(int p_index);
+
+ void set_filter_path(const NodePath &p_path, bool p_enable);
+ bool is_path_filtered(const NodePath &p_path) const;
+
+ void set_filter_enabled(bool p_enable);
+ bool is_filter_enabled() const;
+
+ virtual bool has_filter() const;
+
+ void set_position(const Vector2 &p_position);
+ Vector2 get_position() const;
+
+ AnimationNode();
+};
+
+VARIANT_ENUM_CAST(AnimationNode::FilterAction)
+
+//root node does not allow inputs
+class AnimationRootNode : public AnimationNode {
+ GDCLASS(AnimationRootNode, AnimationNode)
+public:
+ AnimationRootNode() {}
+};
+
+class AnimationTree : public Node {
+ GDCLASS(AnimationTree, Node)
+public:
+ enum AnimationProcessMode {
+ ANIMATION_PROCESS_PHYSICS,
+ ANIMATION_PROCESS_IDLE,
+ };
+
+private:
+ struct TrackCache {
+
+ bool root_motion;
+ uint64_t setup_pass;
+ uint64_t process_pass;
+ Animation::TrackType type;
+ Object *object;
+ ObjectID object_id;
+
+ TrackCache() {
+ root_motion = false;
+ setup_pass = 0;
+ process_pass = 0;
+ object = NULL;
+ object_id = 0;
+ }
+ virtual ~TrackCache() {}
+ };
+
+ struct TrackCacheTransform : public TrackCache {
+ Spatial *spatial;
+ Skeleton *skeleton;
+ int bone_idx;
+ Vector3 loc;
+ Quat rot;
+ float rot_blend_accum;
+ Vector3 scale;
+
+ TrackCacheTransform() {
+ type = Animation::TYPE_TRANSFORM;
+ spatial = NULL;
+ bone_idx = -1;
+ skeleton = NULL;
+ }
+ };
+
+ struct TrackCacheValue : public TrackCache {
+
+ Variant value;
+ Vector<StringName> subpath;
+ TrackCacheValue() { type = Animation::TYPE_VALUE; }
+ };
+
+ struct TrackCacheMethod : public TrackCache {
+
+ TrackCacheMethod() { type = Animation::TYPE_METHOD; }
+ };
+
+ struct TrackCacheBezier : public TrackCache {
+
+ float value;
+ Vector<StringName> subpath;
+ TrackCacheBezier() {
+ type = Animation::TYPE_BEZIER;
+ value = 0;
+ }
+ };
+
+ struct TrackCacheAudio : public TrackCache {
+
+ bool playing;
+ float start;
+ float len;
+
+ TrackCacheAudio() {
+ type = Animation::TYPE_AUDIO;
+ playing = false;
+ start = 0;
+ len = 0;
+ }
+ };
+
+ struct TrackCacheAnimation : public TrackCache {
+
+ bool playing;
+
+ TrackCacheAnimation() {
+ type = Animation::TYPE_ANIMATION;
+ playing = false;
+ }
+ };
+
+ HashMap<NodePath, TrackCache *> track_cache;
+ Set<TrackCache *> playing_caches;
+
+ Ref<AnimationNode> root;
+
+ AnimationProcessMode process_mode;
+ bool active;
+ NodePath animation_player;
+
+ AnimationNode::State state;
+ bool cache_valid;
+ void _node_removed(Node *p_node);
+ void _caches_cleared();
+
+ void _clear_caches();
+ bool _update_caches(AnimationPlayer *player);
+ void _process_graph(float p_delta);
+
+ uint64_t setup_pass;
+ uint64_t process_pass;
+
+ bool started;
+
+ NodePath root_motion_track;
+ Transform root_motion_transform;
+
+protected:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void set_tree_root(const Ref<AnimationNode> &p_root);
+ Ref<AnimationNode> get_tree_root() const;
+
+ void set_active(bool p_active);
+ bool is_active() const;
+
+ void set_process_mode(AnimationProcessMode p_mode);
+ AnimationProcessMode get_process_mode() const;
+
+ void set_animation_player(const NodePath &p_player);
+ NodePath get_animation_player() const;
+
+ virtual String get_configuration_warning() const;
+
+ bool is_state_invalid() const;
+ String get_invalid_state_reason() const;
+
+ void set_root_motion_track(const NodePath &p_track);
+ NodePath get_root_motion_track() const;
+
+ Transform get_root_motion_transform() const;
+
+ uint64_t get_last_process_pass() const;
+ AnimationTree();
+ ~AnimationTree();
+};
+
+VARIANT_ENUM_CAST(AnimationTree::AnimationProcessMode)
+
+#endif // ANIMATION_GRAPH_PLAYER_H
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 89f0e43a86..026215508b 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -813,7 +813,11 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
t.value = t.object->get_indexed(t.subpath);
t.value.zero();
- t.skip = false;
+ if (t.skeleton) {
+ t.skip = t.skeleton->is_bone_ignore_animation(t.bone_idx);
+ } else {
+ t.skip = false;
+ }
}
/* STEP 2 PROCESS ANIMATIONS */
@@ -895,13 +899,12 @@ void AnimationTreePlayer::_process_animation(float p_delta) {
}
Transform xform;
- xform.basis = t.rot;
xform.origin = t.loc;
t.scale.x += 1.0;
t.scale.y += 1.0;
t.scale.z += 1.0;
- xform.basis.scale(t.scale);
+ xform.basis.set_quat_scale(t.rot, t.scale);
if (t.bone_idx >= 0) {
if (t.skeleton)
@@ -1213,6 +1216,12 @@ String AnimationTreePlayer::animation_node_get_master_animation(const StringName
return n->from;
}
+float AnimationTreePlayer::animation_node_get_position(const StringName &p_node) const {
+
+ GET_NODE_V(NODE_ANIMATION, AnimationNode, 0);
+ return n->time;
+}
+
bool AnimationTreePlayer::animation_node_is_path_filtered(const StringName &p_node, const NodePath &p_path) const {
GET_NODE_V(NODE_ANIMATION, AnimationNode, 0);
@@ -1721,6 +1730,7 @@ void AnimationTreePlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("animation_node_set_master_animation", "id", "source"), &AnimationTreePlayer::animation_node_set_master_animation);
ClassDB::bind_method(D_METHOD("animation_node_get_master_animation", "id"), &AnimationTreePlayer::animation_node_get_master_animation);
+ ClassDB::bind_method(D_METHOD("animation_node_get_position", "id"), &AnimationTreePlayer::animation_node_get_position);
ClassDB::bind_method(D_METHOD("animation_node_set_filter_path", "id", "path", "enable"), &AnimationTreePlayer::animation_node_set_filter_path);
ClassDB::bind_method(D_METHOD("oneshot_node_set_fadein_time", "id", "time_sec"), &AnimationTreePlayer::oneshot_node_set_fadein_time);
@@ -1804,7 +1814,7 @@ void AnimationTreePlayer::_bind_methods() {
ADD_GROUP("Playback", "playback_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_animation_process_mode", "get_animation_process_mode");
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "master_player"), "set_master_player", "get_master_player");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "master_player", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "AnimationPlayer"), "set_master_player", "get_master_player");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "base_path"), "set_base_path", "get_base_path");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active");
diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h
index 09d6f6fcb4..d2d7b1c9ec 100644
--- a/scene/animation/animation_tree_player.h
+++ b/scene/animation/animation_tree_player.h
@@ -348,6 +348,7 @@ public:
Ref<Animation> animation_node_get_animation(const StringName &p_node) const;
void animation_node_set_master_animation(const StringName &p_node, const String &p_master_animation);
String animation_node_get_master_animation(const StringName &p_node) const;
+ float animation_node_get_position(const StringName &p_node) const;
void animation_node_set_filter_path(const StringName &p_node, const NodePath &p_track_path, bool p_filter);
void animation_node_set_get_filtered_paths(const StringName &p_node, List<NodePath> *r_paths) const;
diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp
new file mode 100644
index 0000000000..a28c63064a
--- /dev/null
+++ b/scene/animation/root_motion_view.cpp
@@ -0,0 +1,178 @@
+#include "root_motion_view.h"
+#include "scene/animation/animation_tree.h"
+#include "scene/resources/material.h"
+void RootMotionView::set_animation_path(const NodePath &p_path) {
+ path = p_path;
+ first = true;
+}
+
+NodePath RootMotionView::get_animation_path() const {
+ return path;
+}
+
+void RootMotionView::set_color(const Color &p_color) {
+ color = p_color;
+ first = true;
+}
+
+Color RootMotionView::get_color() const {
+ return color;
+}
+
+void RootMotionView::set_cell_size(float p_size) {
+ cell_size = p_size;
+ first = true;
+}
+
+float RootMotionView::get_cell_size() const {
+ return cell_size;
+}
+
+void RootMotionView::set_radius(float p_radius) {
+ radius = p_radius;
+ first = true;
+}
+
+float RootMotionView::get_radius() const {
+ return radius;
+}
+
+void RootMotionView::set_zero_y(bool p_zero_y) {
+ zero_y = p_zero_y;
+}
+
+bool RootMotionView::get_zero_y() const {
+ return zero_y;
+}
+
+void RootMotionView::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+
+ VS::get_singleton()->immediate_set_material(immediate, SpatialMaterial::get_material_rid_for_2d(false, true, false, false, false));
+ first = true;
+ }
+
+ if (p_what == NOTIFICATION_INTERNAL_PROCESS || p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
+ Transform transform;
+
+ if (has_node(path)) {
+
+ Node *node = get_node(path);
+
+ AnimationTree *tree = Object::cast_to<AnimationTree>(node);
+ if (tree && tree->is_active() && tree->get_root_motion_track() != NodePath()) {
+ if (is_processing_internal() && tree->get_process_mode() == AnimationTree::ANIMATION_PROCESS_PHYSICS) {
+ set_process_internal(false);
+ set_physics_process_internal(true);
+ }
+
+ if (is_physics_processing_internal() && tree->get_process_mode() == AnimationTree::ANIMATION_PROCESS_IDLE) {
+ set_process_internal(true);
+ set_physics_process_internal(false);
+ }
+
+ transform = tree->get_root_motion_transform();
+ }
+ }
+
+ if (!first && transform == Transform()) {
+ return;
+ }
+
+ first = false;
+
+ transform.orthonormalize(); //dont want scale, too imprecise
+ transform.affine_invert();
+
+ accumulated = transform * accumulated;
+ accumulated.origin.x = Math::fposmod(accumulated.origin.x, cell_size);
+ if (zero_y) {
+ accumulated.origin.y = 0;
+ }
+ accumulated.origin.z = Math::fposmod(accumulated.origin.z, cell_size);
+
+ VS::get_singleton()->immediate_clear(immediate);
+
+ int cells_in_radius = int((radius / cell_size) + 1.0);
+
+ VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_LINES);
+ for (int i = -cells_in_radius; i < cells_in_radius; i++) {
+ for (int j = -cells_in_radius; j < cells_in_radius; j++) {
+
+ Vector3 from(i * cell_size, 0, j * cell_size);
+ Vector3 from_i((i + 1) * cell_size, 0, j * cell_size);
+ Vector3 from_j(i * cell_size, 0, (j + 1) * cell_size);
+ from = accumulated.xform(from);
+ from_i = accumulated.xform(from_i);
+ from_j = accumulated.xform(from_j);
+
+ Color c = color, c_i = color, c_j = color;
+ c.a *= MAX(0, 1.0 - from.length() / radius);
+ c_i.a *= MAX(0, 1.0 - from_i.length() / radius);
+ c_j.a *= MAX(0, 1.0 - from_j.length() / radius);
+
+ VS::get_singleton()->immediate_color(immediate, c);
+ VS::get_singleton()->immediate_vertex(immediate, from);
+
+ VS::get_singleton()->immediate_color(immediate, c_i);
+ VS::get_singleton()->immediate_vertex(immediate, from_i);
+
+ VS::get_singleton()->immediate_color(immediate, c);
+ VS::get_singleton()->immediate_vertex(immediate, from);
+
+ VS::get_singleton()->immediate_color(immediate, c_j);
+ VS::get_singleton()->immediate_vertex(immediate, from_j);
+ }
+ }
+
+ VS::get_singleton()->immediate_end(immediate);
+ }
+}
+
+AABB RootMotionView::get_aabb() const {
+
+ return AABB(Vector3(-radius, 0, -radius), Vector3(radius * 2, 0.001, radius * 2));
+}
+PoolVector<Face3> RootMotionView::get_faces(uint32_t p_usage_flags) const {
+ return PoolVector<Face3>();
+}
+
+void RootMotionView::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_animation_path", "path"), &RootMotionView::set_animation_path);
+ ClassDB::bind_method(D_METHOD("get_animation_path"), &RootMotionView::get_animation_path);
+
+ ClassDB::bind_method(D_METHOD("set_color", "color"), &RootMotionView::set_color);
+ ClassDB::bind_method(D_METHOD("get_color"), &RootMotionView::get_color);
+
+ ClassDB::bind_method(D_METHOD("set_cell_size", "size"), &RootMotionView::set_cell_size);
+ ClassDB::bind_method(D_METHOD("get_cell_size"), &RootMotionView::get_cell_size);
+
+ ClassDB::bind_method(D_METHOD("set_radius", "size"), &RootMotionView::set_radius);
+ ClassDB::bind_method(D_METHOD("get_radius"), &RootMotionView::get_radius);
+
+ ClassDB::bind_method(D_METHOD("set_zero_y", "enable"), &RootMotionView::set_zero_y);
+ ClassDB::bind_method(D_METHOD("get_zero_y"), &RootMotionView::get_zero_y);
+
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "animation_path", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "AnimationTree"), "set_animation_path", "get_animation_path");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_RANGE, "0.1,16,0.01,or_greater"), "set_cell_size", "get_cell_size");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.1,16,0.01,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "zero_y"), "set_zero_y", "get_zero_y");
+}
+
+RootMotionView::RootMotionView() {
+ zero_y = true;
+ radius = 10;
+ cell_size = 1;
+ set_process_internal(true);
+ immediate = VisualServer::get_singleton()->immediate_create();
+ set_base(immediate);
+ color = Color(0.5, 0.5, 1.0);
+}
+
+RootMotionView::~RootMotionView() {
+ set_base(RID());
+ VisualServer::get_singleton()->free(immediate);
+}
diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h
new file mode 100644
index 0000000000..611183d364
--- /dev/null
+++ b/scene/animation/root_motion_view.h
@@ -0,0 +1,47 @@
+#ifndef ROOT_MOTION_VIEW_H
+#define ROOT_MOTION_VIEW_H
+
+#include "scene/3d/visual_instance.h"
+
+class RootMotionView : public VisualInstance {
+ GDCLASS(RootMotionView, VisualInstance)
+public:
+ RID immediate;
+ NodePath path;
+ float cell_size;
+ float radius;
+ bool use_in_game;
+ Color color;
+ bool first;
+ bool zero_y;
+
+ Transform accumulated;
+
+private:
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ void set_animation_path(const NodePath &p_path);
+ NodePath get_animation_path() const;
+
+ void set_color(const Color &p_path);
+ Color get_color() const;
+
+ void set_cell_size(float p_size);
+ float get_cell_size() const;
+
+ void set_radius(float p_radius);
+ float get_radius() const;
+
+ void set_zero_y(bool p_zero_y);
+ bool get_zero_y() const;
+
+ virtual AABB get_aabb() const;
+ virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
+
+ RootMotionView();
+ ~RootMotionView();
+};
+
+#endif // ROOT_MOTION_VIEW_H
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 49013b160a..9f7503577b 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -201,6 +201,7 @@ void Tween::_bind_methods() {
ClassDB::bind_method(D_METHOD("reset_all"), &Tween::reset_all);
ClassDB::bind_method(D_METHOD("stop", "object", "key"), &Tween::stop, DEFVAL(""));
ClassDB::bind_method(D_METHOD("stop_all"), &Tween::stop_all);
+ ClassDB::bind_method(D_METHOD("is_stopped"), &Tween::is_stopped);
ClassDB::bind_method(D_METHOD("resume", "object", "key"), &Tween::resume, DEFVAL(""));
ClassDB::bind_method(D_METHOD("resume_all"), &Tween::resume_all);
ClassDB::bind_method(D_METHOD("remove", "object", "key"), &Tween::remove, DEFVAL(""));
@@ -743,6 +744,10 @@ bool Tween::stop(Object *p_object, StringName p_key) {
return true;
}
+bool Tween::is_stopped() const {
+ return tell() >= get_runtime();
+}
+
bool Tween::stop_all() {
set_active(false);
@@ -886,6 +891,10 @@ real_t Tween::tell() const {
real_t Tween::get_runtime() const {
+ if (speed_scale == 0) {
+ return INFINITY;
+ }
+
pending_update++;
real_t runtime = 0;
for (const List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {
@@ -896,7 +905,8 @@ real_t Tween::get_runtime() const {
runtime = t;
}
pending_update--;
- return runtime;
+
+ return runtime / speed_scale;
}
bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final_val, Variant &p_delta_val) {
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index 757d80e90a..36094bf294 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -162,6 +162,7 @@ public:
bool reset_all();
bool stop(Object *p_object, StringName p_key);
bool stop_all();
+ bool is_stopped() const;
bool resume(Object *p_object, StringName p_key);
bool resume_all();
bool remove(Object *p_object, StringName p_key);
diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp
index 408c00334a..b5c232c33c 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -44,14 +44,23 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
buffer_size = MIN(buffer_size, 16); //short fadeout ramp
}
- //mix
- stream_playback->mix(buffer, pitch_scale, buffer_size);
+ // Mix if we're not paused or we're fading out
+ if (!stream_paused || stream_paused_fade > 0.f) {
+ stream_playback->mix(buffer, pitch_scale, buffer_size);
+ }
//multiply volume interpolating to avoid clicks if this changes
float target_volume = p_fadeout ? -80.0 : volume_db;
float vol = Math::db2linear(mix_volume_db);
float vol_inc = (Math::db2linear(target_volume) - vol) / float(buffer_size);
+ if (stream_paused) {
+ vol = vol * stream_paused_fade;
+ if (stream_paused_fade > 0.f) {
+ stream_paused_fade -= 0.1f;
+ }
+ }
+
for (int i = 0; i < buffer_size; i++) {
buffer[i] *= vol;
vol += vol_inc;
@@ -90,11 +99,8 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
void AudioStreamPlayer::_mix_audio() {
- if (!stream_playback.is_valid()) {
- return;
- }
-
- if (!active) {
+ if (!stream_playback.is_valid() || !active ||
+ (stream_paused && stream_paused_fade <= 0.f)) {
return;
}
@@ -135,6 +141,17 @@ void AudioStreamPlayer::_notification(int p_what) {
AudioServer::get_singleton()->remove_callback(_mix_audios, this);
}
+
+ if (p_what == NOTIFICATION_PAUSED) {
+ if (!can_process()) {
+ // Node can't process so we start fading out to silence
+ set_stream_paused(true);
+ }
+ }
+
+ if (p_what == NOTIFICATION_UNPAUSED) {
+ set_stream_paused(false);
+ }
}
void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
@@ -275,6 +292,19 @@ bool AudioStreamPlayer::_is_active() const {
return active;
}
+void AudioStreamPlayer::set_stream_paused(bool p_pause) {
+
+ if (p_pause != stream_paused) {
+ stream_paused = p_pause;
+ stream_paused_fade = stream_paused ? 1.f : 0.f;
+ }
+}
+
+bool AudioStreamPlayer::get_stream_paused() const {
+
+ return stream_paused;
+}
+
void AudioStreamPlayer::_validate_property(PropertyInfo &property) const {
if (property.name == "bus") {
@@ -328,11 +358,15 @@ void AudioStreamPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("_bus_layout_changed"), &AudioStreamPlayer::_bus_layout_changed);
+ ClassDB::bind_method(D_METHOD("set_stream_paused", "pause"), &AudioStreamPlayer::set_stream_paused);
+ ClassDB::bind_method(D_METHOD("get_stream_paused"), &AudioStreamPlayer::get_stream_paused);
+
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream"), "set_stream", "get_stream");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "volume_db", PROPERTY_HINT_RANGE, "-80,24"), "set_volume_db", "get_volume_db");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,32,0.01"), "set_pitch_scale", "get_pitch_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "_set_playing", "is_playing");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autoplay"), "set_autoplay", "is_autoplay_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stream_paused", PROPERTY_HINT_NONE, ""), "set_stream_paused", "get_stream_paused");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_target", PROPERTY_HINT_ENUM, "Stereo,Surround,Center"), "set_mix_target", "get_mix_target");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bus", PROPERTY_HINT_ENUM, ""), "set_bus", "get_bus");
@@ -351,6 +385,8 @@ AudioStreamPlayer::AudioStreamPlayer() {
autoplay = false;
setseek = -1;
active = false;
+ stream_paused = false;
+ stream_paused_fade = 0.f;
mix_target = MIX_TARGET_STEREO;
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
diff --git a/scene/audio/audio_player.h b/scene/audio/audio_player.h
index 21189aea6d..c42f191589 100644
--- a/scene/audio/audio_player.h
+++ b/scene/audio/audio_player.h
@@ -56,7 +56,9 @@ private:
float mix_volume_db;
float pitch_scale;
float volume_db;
+ float stream_paused_fade;
bool autoplay;
+ bool stream_paused;
StringName bus;
MixTarget mix_target;
@@ -100,6 +102,9 @@ public:
void set_mix_target(MixTarget p_target);
MixTarget get_mix_target() const;
+ void set_stream_paused(bool p_pause);
+ bool get_stream_paused() const;
+
AudioStreamPlayer();
~AudioStreamPlayer();
};
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 5f541ea16a..acdbd9de08 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -60,7 +60,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
- if (status.disabled || b->get_button_index() != 1)
+ if (status.disabled || ((1 << (b->get_button_index() - 1)) & button_mask) == 0)
return;
if (status.pressing_button)
@@ -211,6 +211,11 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
if (!toggle_mode) { //mouse press attempt
pressed();
+ if (get_script_instance()) {
+ Variant::CallError ce;
+ get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
+ }
+
emit_signal("pressed");
} else {
@@ -247,7 +252,7 @@ void BaseButton::_notification(int p_what) {
status.hovering = false;
update();
}
- if (p_what == NOTIFICATION_DRAG_BEGIN) {
+ if (p_what == NOTIFICATION_DRAG_BEGIN || p_what == NOTIFICATION_SCROLL_BEGIN) {
if (status.press_attempt) {
status.press_attempt = false;
@@ -403,6 +408,16 @@ BaseButton::ActionMode BaseButton::get_action_mode() const {
return action_mode;
}
+void BaseButton::set_button_mask(int p_mask) {
+
+ button_mask = p_mask;
+}
+
+int BaseButton::get_button_mask() const {
+
+ return button_mask;
+}
+
void BaseButton::set_enabled_focus_mode(FocusMode p_mode) {
enabled_focus_mode = p_mode;
@@ -491,6 +506,8 @@ void BaseButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_disabled"), &BaseButton::is_disabled);
ClassDB::bind_method(D_METHOD("set_action_mode", "mode"), &BaseButton::set_action_mode);
ClassDB::bind_method(D_METHOD("get_action_mode"), &BaseButton::get_action_mode);
+ ClassDB::bind_method(D_METHOD("set_button_mask", "mask"), &BaseButton::set_button_mask);
+ ClassDB::bind_method(D_METHOD("get_button_mask"), &BaseButton::get_button_mask);
ClassDB::bind_method(D_METHOD("get_draw_mode"), &BaseButton::get_draw_mode);
ClassDB::bind_method(D_METHOD("set_enabled_focus_mode", "mode"), &BaseButton::set_enabled_focus_mode);
ClassDB::bind_method(D_METHOD("get_enabled_focus_mode"), &BaseButton::get_enabled_focus_mode);
@@ -512,6 +529,7 @@ void BaseButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toggle_mode"), "set_toggle_mode", "is_toggle_mode");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
ADD_PROPERTYNO(PropertyInfo(Variant::INT, "action_mode", PROPERTY_HINT_ENUM, "Button Press,Button Release"), "set_action_mode", "get_action_mode");
+ ADD_PROPERTYNO(PropertyInfo(Variant::INT, "button_mask", PROPERTY_HINT_FLAGS, "Mouse Left, Mouse Right, Mouse Middle"), "set_button_mask", "get_button_mask");
ADD_PROPERTY(PropertyInfo(Variant::INT, "enabled_focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_enabled_focus_mode", "get_enabled_focus_mode");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_shortcut", "get_shortcut");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
@@ -537,6 +555,7 @@ BaseButton::BaseButton() {
set_focus_mode(FOCUS_ALL);
enabled_focus_mode = FOCUS_ALL;
action_mode = ACTION_MODE_BUTTON_RELEASE;
+ button_mask = BUTTON_MASK_LEFT;
}
BaseButton::~BaseButton() {
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index 6917e112ab..79638bbcce 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -49,6 +49,7 @@ public:
};
private:
+ int button_mask;
bool toggle_mode;
FocusMode enabled_focus_mode;
Ref<ShortCut> shortcut;
@@ -104,6 +105,9 @@ public:
void set_action_mode(ActionMode p_mode);
ActionMode get_action_mode() const;
+ void set_button_mask(int p_mask);
+ int get_button_mask() const;
+
void set_enabled_focus_mode(FocusMode p_mode);
FocusMode get_enabled_focus_mode() const;
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 30bcc48149..f8c188d33d 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -77,8 +77,7 @@ void ColorPicker::_notification(int p_what) {
void ColorPicker::set_focus_on_line_edit() {
- c_text->grab_focus();
- c_text->select();
+ c_text->call_deferred("grab_focus");
}
void ColorPicker::_update_controls() {
@@ -159,14 +158,16 @@ void ColorPicker::_update_color() {
updating = true;
for (int i = 0; i < 4; i++) {
- scroll[i]->set_max(255);
scroll[i]->set_step(0.01);
if (raw_mode_enabled) {
+ scroll[i]->set_max(100);
if (i == 3)
scroll[i]->set_max(1);
scroll[i]->set_value(color.components[i]);
} else {
- scroll[i]->set_value(color.components[i] * 255);
+ const int byte_value = color.components[i] * 255;
+ scroll[i]->set_max(next_power_of_2(MAX(255, byte_value)) - 1);
+ scroll[i]->set_value(byte_value);
}
}
@@ -241,7 +242,16 @@ bool ColorPicker::is_raw_mode() const {
return raw_mode_enabled;
}
+void ColorPicker::set_deferred_mode(bool p_enabled) {
+ deferred_mode_enabled = p_enabled;
+}
+
+bool ColorPicker::is_deferred_mode() const {
+ return deferred_mode_enabled;
+}
+
void ColorPicker::_update_text_value() {
+ bool visible = true;
if (text_is_constructor) {
String t = "Color(" + String::num(color.r) + "," + String::num(color.g) + "," + String::num(color.b);
if (edit_alpha && color.a < 1)
@@ -250,8 +260,13 @@ void ColorPicker::_update_text_value() {
t += ")";
c_text->set_text(t);
} else {
- c_text->set_text(color.to_html(edit_alpha && color.a < 1));
+ if (color.r > 1 || color.g > 1 || color.b > 1 || color.r < 0 || color.g < 0 || color.b < 0) {
+ visible = false;
+ } else {
+ c_text->set_text(color.to_html(edit_alpha && color.a < 1));
+ }
}
+ c_text->set_visible(visible);
}
void ColorPicker::_sample_draw() {
@@ -321,7 +336,11 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) {
last_hsv = color;
set_pick_color(color);
_update_color();
+ if (!deferred_mode_enabled)
+ emit_signal("color_changed", color);
+ } else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
emit_signal("color_changed", color);
+ changing_color = false;
} else {
changing_color = false;
}
@@ -340,7 +359,8 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) {
last_hsv = color;
set_pick_color(color);
_update_color();
- emit_signal("color_changed", color);
+ if (!deferred_mode_enabled)
+ emit_signal("color_changed", color);
}
}
@@ -361,7 +381,10 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
last_hsv = color;
set_pick_color(color);
_update_color();
- emit_signal("color_changed", color);
+ if (!deferred_mode_enabled)
+ emit_signal("color_changed", color);
+ else if (!bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT)
+ emit_signal("color_changed", color);
}
Ref<InputEventMouseMotion> mev = p_event;
@@ -376,7 +399,8 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
last_hsv = color;
set_pick_color(color);
_update_color();
- emit_signal("color_changed", color);
+ if (!deferred_mode_enabled)
+ emit_signal("color_changed", color);
}
}
@@ -462,12 +486,39 @@ void ColorPicker::_screen_pick_pressed() {
screen->show_modal();
}
+void ColorPicker::_focus_enter() {
+ if (c_text->has_focus()) {
+ c_text->select_all();
+ return;
+ }
+ for (int i = 0; i < 4; i++) {
+ if (values[i]->get_line_edit()->has_focus()) {
+ values[i]->get_line_edit()->select_all();
+ break;
+ }
+ }
+}
+
+void ColorPicker::_focus_exit() {
+ for (int i = 0; i < 4; i++) {
+ values[i]->get_line_edit()->select(0, 0);
+ }
+ c_text->select(0, 0);
+}
+
+void ColorPicker::_html_focus_exit() {
+ _html_entered(c_text->get_text());
+ _focus_exit();
+}
+
void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPicker::set_pick_color);
ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPicker::get_pick_color);
ClassDB::bind_method(D_METHOD("set_raw_mode", "mode"), &ColorPicker::set_raw_mode);
ClassDB::bind_method(D_METHOD("is_raw_mode"), &ColorPicker::is_raw_mode);
+ ClassDB::bind_method(D_METHOD("set_deferred_mode", "mode"), &ColorPicker::set_deferred_mode);
+ ClassDB::bind_method(D_METHOD("is_deferred_mode"), &ColorPicker::is_deferred_mode);
ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPicker::set_edit_alpha);
ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPicker::is_editing_alpha);
ClassDB::bind_method(D_METHOD("add_preset", "color"), &ColorPicker::add_preset);
@@ -483,10 +534,14 @@ void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("_w_input"), &ColorPicker::_w_input);
ClassDB::bind_method(D_METHOD("_preset_input"), &ColorPicker::_preset_input);
ClassDB::bind_method(D_METHOD("_screen_input"), &ColorPicker::_screen_input);
+ ClassDB::bind_method(D_METHOD("_focus_enter"), &ColorPicker::_focus_enter);
+ ClassDB::bind_method(D_METHOD("_focus_exit"), &ColorPicker::_focus_exit);
+ ClassDB::bind_method(D_METHOD("_html_focus_exit"), &ColorPicker::_html_focus_exit);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "raw_mode"), "set_raw_mode", "is_raw_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deferred_mode"), "set_deferred_mode", "is_deferred_mode");
ADD_SIGNAL(MethodInfo("color_changed", PropertyInfo(Variant::COLOR, "color")));
}
@@ -498,6 +553,7 @@ ColorPicker::ColorPicker() :
edit_alpha = true;
text_is_constructor = false;
raw_mode_enabled = false;
+ deferred_mode_enabled = false;
changing_color = false;
screen = NULL;
@@ -559,11 +615,14 @@ ColorPicker::ColorPicker() :
scroll[i] = memnew(HSlider);
scroll[i]->set_v_size_flags(SIZE_SHRINK_CENTER);
+ scroll[i]->set_focus_mode(FOCUS_NONE);
hbc->add_child(scroll[i]);
values[i] = memnew(SpinBox);
scroll[i]->share(values[i]);
hbc->add_child(values[i]);
+ values[i]->get_line_edit()->connect("focus_entered", this, "_focus_enter");
+ values[i]->get_line_edit()->connect("focus_exited", this, "_focus_exit");
scroll[i]->set_min(0);
scroll[i]->set_page(0);
@@ -589,6 +648,9 @@ ColorPicker::ColorPicker() :
c_text = memnew(LineEdit);
hhb->add_child(c_text);
c_text->connect("text_entered", this, "_html_entered");
+ c_text->connect("focus_entered", this, "_focus_enter");
+ c_text->connect("focus_exited", this, "_html_focus_exit");
+
text_type->set_text("#");
c_text->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -615,12 +677,19 @@ ColorPicker::ColorPicker() :
void ColorPickerButton::_color_changed(const Color &p_color) {
+ color = p_color;
update();
- emit_signal("color_changed", p_color);
+ emit_signal("color_changed", color);
+}
+
+void ColorPickerButton::_modal_closed() {
+
+ emit_signal("popup_closed");
}
void ColorPickerButton::pressed() {
+ _update_picker();
popup->set_position(get_global_position() - picker->get_combined_minimum_size());
popup->popup();
picker->set_focus_on_line_edit();
@@ -633,37 +702,44 @@ void ColorPickerButton::_notification(int p_what) {
Ref<StyleBox> normal = get_stylebox("normal");
Rect2 r = Rect2(normal->get_offset(), get_size() - normal->get_minimum_size());
draw_texture_rect(Control::get_icon("bg", "ColorPickerButton"), r, true);
- draw_rect(r, picker->get_pick_color());
+ draw_rect(r, color);
}
- if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST) {
+ if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST && popup) {
popup->hide();
}
}
void ColorPickerButton::set_pick_color(const Color &p_color) {
- picker->set_pick_color(p_color);
+ color = p_color;
+ if (picker) {
+ picker->set_pick_color(p_color);
+ }
+
update();
- emit_signal("color_changed", p_color);
}
Color ColorPickerButton::get_pick_color() const {
- return picker->get_pick_color();
+ return color;
}
void ColorPickerButton::set_edit_alpha(bool p_show) {
- picker->set_edit_alpha(p_show);
+ edit_alpha = p_show;
+ if (picker) {
+ picker->set_edit_alpha(p_show);
+ }
}
bool ColorPickerButton::is_editing_alpha() const {
- return picker->is_editing_alpha();
+ return edit_alpha;
}
-ColorPicker *ColorPickerButton::get_picker() const {
+ColorPicker *ColorPickerButton::get_picker() {
+ _update_picker();
return picker;
}
@@ -672,6 +748,19 @@ PopupPanel *ColorPickerButton::get_popup() const {
return popup;
}
+void ColorPickerButton::_update_picker() {
+ if (!picker) {
+ popup = memnew(PopupPanel);
+ picker = memnew(ColorPicker);
+ popup->add_child(picker);
+ add_child(popup);
+ picker->connect("color_changed", this, "_color_changed");
+ popup->connect("modal_closed", this, "_modal_closed");
+ picker->set_pick_color(color);
+ picker->set_edit_alpha(edit_alpha);
+ }
+}
+
void ColorPickerButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPickerButton::set_pick_color);
@@ -681,18 +770,20 @@ void ColorPickerButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPickerButton::set_edit_alpha);
ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPickerButton::is_editing_alpha);
ClassDB::bind_method(D_METHOD("_color_changed"), &ColorPickerButton::_color_changed);
+ ClassDB::bind_method(D_METHOD("_modal_closed"), &ColorPickerButton::_modal_closed);
ADD_SIGNAL(MethodInfo("color_changed", PropertyInfo(Variant::COLOR, "color")));
+ ADD_SIGNAL(MethodInfo("popup_closed"));
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha");
}
ColorPickerButton::ColorPickerButton() {
- popup = memnew(PopupPanel);
- picker = memnew(ColorPicker);
- popup->add_child(picker);
-
- picker->connect("color_changed", this, "_color_changed");
- add_child(popup);
+ //Initialization is now done deferred
+ //this improves performance in the inspector as the color picker
+ //can be expensive to initialize
+ picker = NULL;
+ popup = NULL;
+ edit_alpha = true;
}
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 01ae1cc464..c8d8e1aa8a 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -67,6 +67,7 @@ private:
Color color;
bool raw_mode_enabled;
+ bool deferred_mode_enabled;
bool updating;
bool changing_color;
float h, s, v;
@@ -88,6 +89,9 @@ private:
void _screen_input(const Ref<InputEvent> &p_event);
void _add_preset_pressed();
void _screen_pick_pressed();
+ void _focus_enter();
+ void _focus_exit();
+ void _html_focus_exit();
protected:
void _notification(int);
@@ -104,6 +108,9 @@ public:
void set_raw_mode(bool p_enabled);
bool is_raw_mode() const;
+ void set_deferred_mode(bool p_enabled);
+ bool is_deferred_mode() const;
+
void set_focus_on_line_edit();
ColorPicker();
@@ -115,10 +122,16 @@ class ColorPickerButton : public Button {
PopupPanel *popup;
ColorPicker *picker;
+ Color color;
+ bool edit_alpha;
void _color_changed(const Color &p_color);
+ void _modal_closed();
+
virtual void pressed();
+ void _update_picker();
+
protected:
void _notification(int);
static void _bind_methods();
@@ -130,7 +143,7 @@ public:
void set_edit_alpha(bool p_show);
bool is_editing_alpha() const;
- ColorPicker *get_picker() const;
+ ColorPicker *get_picker();
PopupPanel *get_popup() const;
ColorPickerButton();
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 7cb0ad5707..7df03bf7c6 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -34,9 +34,9 @@
void Container::_child_minsize_changed() {
- Size2 ms = get_combined_minimum_size();
- if (ms.width > get_size().width || ms.height > get_size().height)
- minimum_size_changed();
+ //Size2 ms = get_combined_minimum_size();
+ //if (ms.width > get_size().width || ms.height > get_size().height) {
+ minimum_size_changed();
queue_sort();
}
@@ -51,6 +51,8 @@ void Container::add_child_notify(Node *p_child) {
control->connect("size_flags_changed", this, "queue_sort");
control->connect("minimum_size_changed", this, "_child_minsize_changed");
control->connect("visibility_changed", this, "_child_minsize_changed");
+
+ minimum_size_changed();
queue_sort();
}
@@ -61,6 +63,7 @@ void Container::move_child_notify(Node *p_child) {
if (!Object::cast_to<Control>(p_child))
return;
+ minimum_size_changed();
queue_sort();
}
@@ -75,6 +78,8 @@ void Container::remove_child_notify(Node *p_child) {
control->disconnect("size_flags_changed", this, "queue_sort");
control->disconnect("minimum_size_changed", this, "_child_minsize_changed");
control->disconnect("visibility_changed", this, "_child_minsize_changed");
+
+ minimum_size_changed();
queue_sort();
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index a5883863cd..289924976d 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -94,6 +94,14 @@ Point2 Control::_edit_get_position() const {
return get_position();
};
+void Control::_edit_set_scale(const Size2 &p_scale) {
+ set_scale(p_scale);
+}
+
+Size2 Control::_edit_get_scale() const {
+ return data.scale;
+}
+
void Control::_edit_set_rect(const Rect2 &p_edit_rect) {
set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snapped(Vector2(1, 1)));
set_size(p_edit_rect.size.snapped(Vector2(1, 1)));
@@ -147,12 +155,29 @@ Size2 Control::get_custom_minimum_size() const {
return data.custom_minimum_size;
}
-Size2 Control::get_combined_minimum_size() const {
+void Control::_update_minimum_size_cache() {
Size2 minsize = get_minimum_size();
minsize.x = MAX(minsize.x, data.custom_minimum_size.x);
minsize.y = MAX(minsize.y, data.custom_minimum_size.y);
- return minsize;
+
+ bool size_changed = false;
+ if (data.minimum_size_cache != minsize)
+ size_changed = true;
+
+ data.minimum_size_cache = minsize;
+ data.minimum_size_valid = true;
+
+ if (size_changed)
+ minimum_size_changed();
+}
+
+Size2 Control::get_combined_minimum_size() const {
+
+ if (!data.minimum_size_valid) {
+ const_cast<Control *>(this)->_update_minimum_size_cache();
+ }
+ return data.minimum_size_cache;
}
Size2 Control::_edit_get_minimum_size() const {
@@ -251,14 +276,18 @@ void Control::_update_minimum_size() {
if (!is_inside_tree())
return;
- data.pending_min_size_update = false;
Size2 minsize = get_combined_minimum_size();
if (minsize.x > data.size_cache.x ||
minsize.y > data.size_cache.y) {
_size_changed();
}
- emit_signal(SceneStringNames::get_singleton()->minimum_size_changed);
+ data.updating_last_minimum_size = false;
+
+ if (minsize != data.last_minimum_size) {
+ data.last_minimum_size = minsize;
+ emit_signal(SceneStringNames::get_singleton()->minimum_size_changed);
+ }
}
bool Control::_get(const StringName &p_name, Variant &r_ret) const {
@@ -429,8 +458,10 @@ void Control::_notification(int p_notification) {
case NOTIFICATION_ENTER_TREE: {
+ } break;
+ case NOTIFICATION_POST_ENTER_TREE: {
+ data.minimum_size_valid = false;
_size_changed();
-
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -612,13 +643,12 @@ void Control::_notification(int p_notification) {
if (is_inside_tree()) {
_modal_stack_remove();
- minimum_size_changed();
}
//remove key focus
//remove modalness
} else {
-
+ data.minimum_size_valid = false;
_size_changed();
}
@@ -1244,21 +1274,23 @@ bool Control::has_constant(const StringName &p_name, const StringName &p_type) c
return Theme::get_default()->has_constant(p_name, type);
}
-Size2 Control::get_parent_area_size() const {
-
- ERR_FAIL_COND_V(!is_inside_tree(), Size2());
-
- Size2 parent_size;
+Rect2 Control::get_parent_anchorable_rect() const {
+ if (!is_inside_tree())
+ return Rect2();
+ Rect2 parent_rect;
if (data.parent_canvas_item) {
-
- parent_size = data.parent_canvas_item->_edit_get_rect().size;
+ parent_rect = data.parent_canvas_item->get_anchorable_rect();
} else {
-
- parent_size = get_viewport()->get_visible_rect().size;
+ parent_rect = get_viewport()->get_visible_rect();
}
- return parent_size;
+ return parent_rect;
+}
+
+Size2 Control::get_parent_area_size() const {
+
+ return get_parent_anchorable_rect().size;
}
void Control::_size_changed() {
@@ -1266,13 +1298,13 @@ void Control::_size_changed() {
if (!is_inside_tree())
return;
- Size2 parent_size = get_parent_area_size();
+ Rect2 parent_rect = get_parent_anchorable_rect();
float margin_pos[4];
for (int i = 0; i < 4; i++) {
- float area = parent_size[i & 1];
+ float area = parent_rect.size[i & 1];
margin_pos[i] = data.margin[i] + (data.anchor[i] * area);
}
@@ -1281,22 +1313,24 @@ void Control::_size_changed() {
Size2 minimum_size = get_combined_minimum_size();
- if (data.h_grow == GROW_DIRECTION_BEGIN) {
- if (minimum_size.width > new_size_cache.width) {
- new_pos_cache.x = new_pos_cache.x + new_size_cache.width - minimum_size.width;
- new_size_cache.width = minimum_size.width;
+ if (minimum_size.width > new_size_cache.width) {
+ if (data.h_grow == GROW_DIRECTION_BEGIN) {
+ new_pos_cache.x += new_size_cache.width - minimum_size.width;
+ } else if (data.h_grow == GROW_DIRECTION_BOTH) {
+ new_pos_cache.x += 0.5 * (new_size_cache.width - minimum_size.width);
}
- } else {
- new_size_cache.width = MAX(minimum_size.width, new_size_cache.width);
+
+ new_size_cache.width = minimum_size.width;
}
- if (data.v_grow == GROW_DIRECTION_BEGIN) {
- if (minimum_size.height > new_size_cache.height) {
- new_pos_cache.y = new_pos_cache.y + new_size_cache.height - minimum_size.height;
- new_size_cache.height = minimum_size.height;
+ if (minimum_size.height > new_size_cache.height) {
+ if (data.v_grow == GROW_DIRECTION_BEGIN) {
+ new_pos_cache.y += new_size_cache.height - minimum_size.height;
+ } else if (data.v_grow == GROW_DIRECTION_BOTH) {
+ new_pos_cache.y += 0.5 * (new_size_cache.height - minimum_size.height);
}
- } else {
- new_size_cache.height = MAX(minimum_size.height, new_size_cache.height);
+
+ new_size_cache.height = minimum_size.height;
}
// We use a little workaround to avoid flickering when moving the pivot with _edit_set_pivot()
@@ -1324,43 +1358,9 @@ void Control::_size_changed() {
}
}
-float Control::_get_parent_range(int p_idx) const {
-
- if (!is_inside_tree()) {
-
- return 0;
- }
- if (data.parent_canvas_item) {
-
- return data.parent_canvas_item->_edit_get_rect().size[p_idx & 1];
- } else {
- return get_viewport()->get_visible_rect().size[p_idx & 1];
- }
-
- return 0;
-}
-
-float Control::_get_range(int p_idx) const {
-
- p_idx &= 1;
-
- float parent_range = _get_parent_range(p_idx);
- float from = _a2s(data.margin[p_idx], data.anchor[p_idx], parent_range);
- float to = _a2s(data.margin[p_idx + 2], data.anchor[p_idx + 2], parent_range);
-
- return to - from;
-}
-
-float Control::_s2a(float p_val, float p_anchor, float p_range) const {
- return p_val - (p_anchor * p_range);
-}
-
-float Control::_a2s(float p_val, float p_anchor, float p_range) const {
- return Math::floor(p_val + (p_anchor * p_range));
-}
-
void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) {
- float parent_range = _get_parent_range((p_margin == MARGIN_LEFT || p_margin == MARGIN_RIGHT) ? 0 : 1);
+ Rect2 parent_rect = get_parent_anchorable_rect();
+ float parent_range = (p_margin == MARGIN_LEFT || p_margin == MARGIN_RIGHT) ? parent_rect.size.x : parent_rect.size.y;
float previous_margin_pos = data.margin[p_margin] + data.anchor[p_margin] * parent_range;
float previous_opposite_margin_pos = data.margin[(p_margin + 2) % 4] + data.anchor[(p_margin + 2) % 4] * parent_range;
@@ -1376,9 +1376,9 @@ void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bo
}
if (!p_keep_margin) {
- data.margin[p_margin] = _s2a(previous_margin_pos, data.anchor[p_margin], parent_range);
+ data.margin[p_margin] = previous_margin_pos - data.anchor[p_margin] * parent_range;
if (p_push_opposite_anchor) {
- data.margin[(p_margin + 2) % 4] = _s2a(previous_opposite_margin_pos, data.anchor[(p_margin + 2) % 4], parent_range);
+ data.margin[(p_margin + 2) % 4] = previous_opposite_margin_pos - data.anchor[(p_margin + 2) % 4] * parent_range;
}
}
if (is_inside_tree()) {
@@ -1532,8 +1532,7 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
new_size.y = min_size.y;
}
- float pw = _get_parent_range(0);
- float ph = _get_parent_range(1);
+ Rect2 parent_rect = get_parent_anchorable_rect();
//Left
switch (p_preset) {
@@ -1545,21 +1544,21 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
case PRESET_LEFT_WIDE:
case PRESET_HCENTER_WIDE:
case PRESET_WIDE:
- data.margin[0] = pw * (0.0 - data.anchor[0]) + p_margin;
+ data.margin[0] = parent_rect.size.x * (0.0 - data.anchor[0]) + p_margin + parent_rect.position.x;
break;
case PRESET_CENTER_TOP:
case PRESET_CENTER_BOTTOM:
case PRESET_CENTER:
case PRESET_VCENTER_WIDE:
- data.margin[0] = pw * (0.5 - data.anchor[0]) - new_size.x / 2;
+ data.margin[0] = parent_rect.size.x * (0.5 - data.anchor[0]) - new_size.x / 2 + parent_rect.position.x;
break;
case PRESET_TOP_RIGHT:
case PRESET_BOTTOM_RIGHT:
case PRESET_CENTER_RIGHT:
case PRESET_RIGHT_WIDE:
- data.margin[0] = pw * (1.0 - data.anchor[0]) - new_size.x - p_margin;
+ data.margin[0] = parent_rect.size.x * (1.0 - data.anchor[0]) - new_size.x - p_margin + parent_rect.position.x;
break;
}
@@ -1573,21 +1572,21 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
case PRESET_TOP_WIDE:
case PRESET_VCENTER_WIDE:
case PRESET_WIDE:
- data.margin[1] = ph * (0.0 - data.anchor[1]) + p_margin;
+ data.margin[1] = parent_rect.size.y * (0.0 - data.anchor[1]) + p_margin + parent_rect.position.y;
break;
case PRESET_CENTER_LEFT:
case PRESET_CENTER_RIGHT:
case PRESET_CENTER:
case PRESET_HCENTER_WIDE:
- data.margin[1] = ph * (0.5 - data.anchor[1]) - new_size.y / 2;
+ data.margin[1] = parent_rect.size.y * (0.5 - data.anchor[1]) - new_size.y / 2 + parent_rect.position.y;
break;
case PRESET_BOTTOM_LEFT:
case PRESET_BOTTOM_RIGHT:
case PRESET_CENTER_BOTTOM:
case PRESET_BOTTOM_WIDE:
- data.margin[1] = ph * (1.0 - data.anchor[1]) - new_size.y - p_margin;
+ data.margin[1] = parent_rect.size.y * (1.0 - data.anchor[1]) - new_size.y - p_margin + parent_rect.position.y;
break;
}
@@ -1597,14 +1596,14 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
case PRESET_BOTTOM_LEFT:
case PRESET_CENTER_LEFT:
case PRESET_LEFT_WIDE:
- data.margin[2] = pw * (0.0 - data.anchor[2]) + new_size.x + p_margin;
+ data.margin[2] = parent_rect.size.x * (0.0 - data.anchor[2]) + new_size.x + p_margin + parent_rect.position.x;
break;
case PRESET_CENTER_TOP:
case PRESET_CENTER_BOTTOM:
case PRESET_CENTER:
case PRESET_VCENTER_WIDE:
- data.margin[2] = pw * (0.5 - data.anchor[2]) + new_size.x / 2;
+ data.margin[2] = parent_rect.size.x * (0.5 - data.anchor[2]) + new_size.x / 2 + parent_rect.position.x;
break;
case PRESET_TOP_RIGHT:
@@ -1615,7 +1614,7 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
case PRESET_BOTTOM_WIDE:
case PRESET_HCENTER_WIDE:
case PRESET_WIDE:
- data.margin[2] = pw * (1.0 - data.anchor[2]) - p_margin;
+ data.margin[2] = parent_rect.size.x * (1.0 - data.anchor[2]) - p_margin + parent_rect.position.x;
break;
}
@@ -1625,14 +1624,14 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
case PRESET_TOP_RIGHT:
case PRESET_CENTER_TOP:
case PRESET_TOP_WIDE:
- data.margin[3] = ph * (0.0 - data.anchor[3]) + new_size.y + p_margin;
+ data.margin[3] = parent_rect.size.y * (0.0 - data.anchor[3]) + new_size.y + p_margin + parent_rect.position.y;
break;
case PRESET_CENTER_LEFT:
case PRESET_CENTER_RIGHT:
case PRESET_CENTER:
case PRESET_HCENTER_WIDE:
- data.margin[3] = ph * (0.5 - data.anchor[3]) + new_size.y / 2;
+ data.margin[3] = parent_rect.size.y * (0.5 - data.anchor[3]) + new_size.y / 2 + parent_rect.position.y;
break;
case PRESET_BOTTOM_LEFT:
@@ -1643,7 +1642,7 @@ void Control::set_margins_preset(LayoutPreset p_preset, LayoutPresetMode p_resiz
case PRESET_BOTTOM_WIDE:
case PRESET_VCENTER_WIDE:
case PRESET_WIDE:
- data.margin[3] = ph * (1.0 - data.anchor[3]) - p_margin;
+ data.margin[3] = parent_rect.size.y * (1.0 - data.anchor[3]) - p_margin + parent_rect.position.y;
break;
}
@@ -1722,31 +1721,29 @@ void Control::set_global_position(const Point2 &p_point) {
set_position(inv.xform(p_point));
}
-void Control::set_position(const Size2 &p_point) {
-
- float pw = _get_parent_range(0);
- float ph = _get_parent_range(1);
+Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margins[4]) const {
- float x = _a2s(data.margin[0], data.anchor[0], pw);
- float y = _a2s(data.margin[1], data.anchor[1], ph);
- float x2 = _a2s(data.margin[2], data.anchor[2], pw);
- float y2 = _a2s(data.margin[3], data.anchor[3], ph);
+ Rect2 anchorable = get_parent_anchorable_rect();
+ Rect2 result = anchorable;
+ for (int i = 0; i < 4; i++) {
+ result.grow_margin((Margin)i, p_anchors[i] * anchorable.get_size()[i % 2] + p_margins[i]);
+ }
- Size2 ret = Size2(x2 - x, y2 - y);
- Size2 min = get_combined_minimum_size();
+ return result;
+}
- Size2 size = Size2(MAX(min.width, ret.width), MAX(min.height, ret.height));
- float w = size.x;
- float h = size.y;
+void Control::_compute_margins(Rect2 p_rect, const float p_anchors[4], float (&r_margins)[4]) {
- x = p_point.x;
- y = p_point.y;
+ Size2 parent_rect_size = get_parent_anchorable_rect().size;
+ r_margins[0] = Math::floor(p_rect.position.x - (p_anchors[0] * parent_rect_size.x));
+ r_margins[1] = Math::floor(p_rect.position.y - (p_anchors[1] * parent_rect_size.y));
+ r_margins[2] = Math::floor(p_rect.position.x + p_rect.size.x - (p_anchors[2] * parent_rect_size.x));
+ r_margins[3] = Math::floor(p_rect.position.y + p_rect.size.y - (p_anchors[3] * parent_rect_size.y));
+}
- data.margin[0] = _s2a(x, data.anchor[0], pw);
- data.margin[1] = _s2a(y, data.anchor[1], ph);
- data.margin[2] = _s2a(x + w, data.anchor[2], pw);
- data.margin[3] = _s2a(y + h, data.anchor[3], ph);
+void Control::set_position(const Size2 &p_point) {
+ _compute_margins(Rect2(p_point, data.size_cache), data.anchor, data.margin);
_size_changed();
}
@@ -1759,18 +1756,7 @@ void Control::set_size(const Size2 &p_size) {
if (new_size.y < min.y)
new_size.y = min.y;
- float pw = _get_parent_range(0);
- float ph = _get_parent_range(1);
-
- float x = _a2s(data.margin[0], data.anchor[0], pw);
- float y = _a2s(data.margin[1], data.anchor[1], ph);
-
- float w = new_size.width;
- float h = new_size.height;
-
- data.margin[2] = _s2a(x + w, data.anchor[2], pw);
- data.margin[3] = _s2a(y + h, data.anchor[3], ph);
-
+ _compute_margins(Rect2(data.pos_cache, new_size), data.anchor, data.margin);
_size_changed();
}
@@ -1801,6 +1787,11 @@ Rect2 Control::get_rect() const {
return Rect2(get_position(), get_size());
}
+Rect2 Control::get_anchorable_rect() const {
+
+ return Rect2(Point2(), get_size());
+}
+
void Control::add_icon_override(const StringName &p_name, const Ref<Texture> &p_icon) {
ERR_FAIL_COND(p_icon.is_null());
@@ -2300,12 +2291,11 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
Point2 points[4];
Transform2D xform = get_global_transform();
- Rect2 rect = _edit_get_rect();
- points[0] = xform.xform(rect.position);
- points[1] = xform.xform(rect.position + Point2(rect.size.x, 0));
- points[2] = xform.xform(rect.position + rect.size);
- points[3] = xform.xform(rect.position + Point2(0, rect.size.y));
+ points[0] = xform.xform(Point2());
+ points[1] = xform.xform(Point2(get_size().x, 0));
+ points[2] = xform.xform(get_size());
+ points[3] = xform.xform(Point2(0, get_size().y));
const Vector2 dir[4] = {
Vector2(-1, 0),
@@ -2359,12 +2349,11 @@ void Control::_window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, con
Point2 points[4];
Transform2D xform = c->get_global_transform();
- Rect2 rect = c->_edit_get_rect();
- points[0] = xform.xform(rect.position);
- points[1] = xform.xform(rect.position + Point2(rect.size.x, 0));
- points[2] = xform.xform(rect.position + rect.size);
- points[3] = xform.xform(rect.position + Point2(0, rect.size.y));
+ points[0] = xform.xform(Point2());
+ points[1] = xform.xform(Point2(get_size().x, 0));
+ points[2] = xform.xform(get_size());
+ points[3] = xform.xform(Point2(0, get_size().y));
float min = 1e7;
@@ -2454,17 +2443,25 @@ void Control::minimum_size_changed() {
if (!is_inside_tree() || data.block_minimum_size_adjust)
return;
- if (data.pending_min_size_update)
+ Control *invalidate = this;
+
+ //invalidate cache upwards
+ while (invalidate && invalidate->data.minimum_size_valid) {
+ invalidate->data.minimum_size_valid = false;
+ if (invalidate->is_set_as_toplevel())
+ break; // do not go further up
+ invalidate = invalidate->data.parent;
+ }
+
+ if (!is_visible_in_tree())
return;
- data.pending_min_size_update = true;
- MessageQueue::get_singleton()->push_call(this, "_update_minimum_size");
+ if (data.updating_last_minimum_size)
+ return;
- if (!is_toplevel_control()) {
- Control *pc = get_parent_control();
- if (pc)
- pc->minimum_size_changed();
- }
+ data.updating_last_minimum_size = true;
+
+ MessageQueue::get_singleton()->push_call(this, "_update_minimum_size");
}
int Control::get_v_size_flags() const {
@@ -2838,8 +2835,8 @@ void Control::_bind_methods() {
ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_bottom", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_BOTTOM);
ADD_GROUP("Grow Direction", "grow_");
- ADD_PROPERTYNO(PropertyInfo(Variant::INT, "grow_horizontal", PROPERTY_HINT_ENUM, "Begin,End"), "set_h_grow_direction", "get_h_grow_direction");
- ADD_PROPERTYNO(PropertyInfo(Variant::INT, "grow_vertical", PROPERTY_HINT_ENUM, "Begin,End"), "set_v_grow_direction", "get_v_grow_direction");
+ ADD_PROPERTYNO(PropertyInfo(Variant::INT, "grow_horizontal", PROPERTY_HINT_ENUM, "Begin,End,Both"), "set_h_grow_direction", "get_h_grow_direction");
+ ADD_PROPERTYNO(PropertyInfo(Variant::INT, "grow_vertical", PROPERTY_HINT_ENUM, "Begin,End,Both"), "set_v_grow_direction", "get_v_grow_direction");
ADD_GROUP("Rect", "rect_");
ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position");
@@ -2855,12 +2852,12 @@ void Control::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "hint_tooltip", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip", "_get_tooltip");
ADD_GROUP("Focus", "focus_");
- ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_left"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_LEFT);
- ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_top"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_TOP);
- ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_right"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_RIGHT);
- ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_bottom"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_BOTTOM);
- ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_next"), "set_focus_next", "get_focus_next");
- ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_previous"), "set_focus_previous", "get_focus_previous");
+ ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_left", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_LEFT);
+ ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_top", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_TOP);
+ ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_right", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_RIGHT);
+ ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_bottom", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_BOTTOM);
+ ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_next", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_next", "get_focus_next");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_previous", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_previous", "get_focus_previous");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode");
ADD_GROUP("Mouse", "mouse_");
@@ -2886,6 +2883,8 @@ void Control::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_FOCUS_EXIT);
BIND_CONSTANT(NOTIFICATION_THEME_CHANGED);
BIND_CONSTANT(NOTIFICATION_MODAL_CLOSE);
+ BIND_CONSTANT(NOTIFICATION_SCROLL_BEGIN);
+ BIND_CONSTANT(NOTIFICATION_SCROLL_END);
BIND_ENUM_CONSTANT(CURSOR_ARROW);
BIND_ENUM_CONSTANT(CURSOR_IBEAM);
@@ -2939,6 +2938,7 @@ void Control::_bind_methods() {
BIND_ENUM_CONSTANT(GROW_DIRECTION_BEGIN);
BIND_ENUM_CONSTANT(GROW_DIRECTION_END);
+ BIND_ENUM_CONSTANT(GROW_DIRECTION_BOTH);
BIND_ENUM_CONSTANT(ANCHOR_BEGIN);
BIND_ENUM_CONSTANT(ANCHOR_END);
@@ -2972,7 +2972,6 @@ Control::Control() {
data.h_size_flags = SIZE_FILL;
data.v_size_flags = SIZE_FILL;
data.expand = 1;
- data.pending_min_size_update = false;
data.rotation = 0;
data.parent_canvas_item = NULL;
data.scale = Vector2(1, 1);
@@ -2982,6 +2981,8 @@ Control::Control() {
data.disable_visibility_clip = false;
data.h_grow = GROW_DIRECTION_END;
data.v_grow = GROW_DIRECTION_END;
+ data.minimum_size_valid = false;
+ data.updating_last_minimum_size = false;
data.clip_contents = false;
for (int i = 0; i < 4; i++) {
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 51325f27b5..fa5274d854 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -60,7 +60,8 @@ public:
enum GrowDirection {
GROW_DIRECTION_BEGIN,
- GROW_DIRECTION_END
+ GROW_DIRECTION_END,
+ GROW_DIRECTION_BOTH
};
enum FocusMode {
@@ -147,6 +148,11 @@ private:
Point2 pos_cache;
Size2 size_cache;
+ Size2 minimum_size_cache;
+ bool minimum_size_valid;
+
+ Size2 last_minimum_size;
+ bool updating_last_minimum_size;
float margin[4];
float anchor[4];
@@ -163,7 +169,6 @@ private:
int h_size_flags;
int v_size_flags;
float expand;
- bool pending_min_size_update;
Point2 custom_minimum_size;
bool pass_on_modal_close_click;
@@ -197,12 +202,12 @@ private:
NodePath focus_next;
NodePath focus_prev;
- HashMap<StringName, Ref<Texture>, StringNameHasher> icon_override;
- HashMap<StringName, Ref<Shader>, StringNameHasher> shader_override;
- HashMap<StringName, Ref<StyleBox>, StringNameHasher> style_override;
- HashMap<StringName, Ref<Font>, StringNameHasher> font_override;
- HashMap<StringName, Color, StringNameHasher> color_override;
- HashMap<StringName, int, StringNameHasher> constant_override;
+ HashMap<StringName, Ref<Texture> > icon_override;
+ HashMap<StringName, Ref<Shader> > shader_override;
+ HashMap<StringName, Ref<StyleBox> > style_override;
+ HashMap<StringName, Ref<Font> > font_override;
+ HashMap<StringName, Color> color_override;
+ HashMap<StringName, int> constant_override;
Map<Ref<Font>, int> font_refcount;
} data;
@@ -215,10 +220,6 @@ private:
void _set_anchor(Margin p_margin, float p_anchor);
- float _get_parent_range(int p_idx) const;
- float _get_range(int p_idx) const;
- float _s2a(float p_val, float p_anchor, float p_range) const;
- float _a2s(float p_val, float p_anchor, float p_range) const;
void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true);
void _theme_changed();
@@ -228,6 +229,9 @@ private:
void _update_scroll();
void _resize(const Size2 &p_size);
+ Rect2 _compute_child_rect(const float p_anchors[4], const float p_margins[4]) const;
+ void _compute_margins(Rect2 p_rect, const float p_anchors[4], float (&r_margins)[4]);
+
void _size_changed();
String _get_tooltip() const;
@@ -243,6 +247,8 @@ private:
void _modal_stack_remove();
void _modal_set_prev_focus_owner(ObjectID p_prev);
+ void _update_minimum_size_cache();
+
protected:
virtual void add_child_notify(Node *p_child);
virtual void remove_child_notify(Node *p_child);
@@ -271,15 +277,21 @@ public:
NOTIFICATION_FOCUS_EXIT = 44,
NOTIFICATION_THEME_CHANGED = 45,
NOTIFICATION_MODAL_CLOSE = 46,
+ NOTIFICATION_SCROLL_BEGIN = 47,
+ NOTIFICATION_SCROLL_END = 48,
};
+ /* EDITOR */
virtual Dictionary _edit_get_state() const;
virtual void _edit_set_state(const Dictionary &p_state);
virtual void _edit_set_position(const Point2 &p_position);
virtual Point2 _edit_get_position() const;
+ virtual void _edit_set_scale(const Size2 &p_scale);
+ virtual Size2 _edit_get_scale() const;
+
virtual void _edit_set_rect(const Rect2 &p_edit_rect);
virtual Rect2 _edit_get_rect() const;
virtual bool _edit_use_rect() const;
@@ -346,6 +358,7 @@ public:
Rect2 get_rect() const;
Rect2 get_global_rect() const;
Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the visual server
+ Rect2 get_anchorable_rect() const;
void set_rotation(float p_radians);
void set_rotation_degrees(float p_degrees);
@@ -453,6 +466,7 @@ public:
bool is_toplevel_control() const;
Size2 get_parent_area_size() const;
+ Rect2 get_parent_anchorable_rect() const;
void grab_click_focus();
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 4bd92d888d..25cb74a494 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -777,6 +777,7 @@ void FileDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_mode", "mode"), &FileDialog::set_mode);
ClassDB::bind_method(D_METHOD("get_mode"), &FileDialog::get_mode);
ClassDB::bind_method(D_METHOD("get_vbox"), &FileDialog::get_vbox);
+ ClassDB::bind_method(D_METHOD("get_line_edit"), &FileDialog::get_line_edit);
ClassDB::bind_method(D_METHOD("set_access", "access"), &FileDialog::set_access);
ClassDB::bind_method(D_METHOD("get_access"), &FileDialog::get_access);
ClassDB::bind_method(D_METHOD("set_show_hidden_files", "show"), &FileDialog::set_show_hidden_files);
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 3985039716..b5622604e2 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -147,6 +147,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
grabbed = _get_point_from_pos(x);
//grab or select
if (grabbed != -1) {
+ grabbed = false;
return;
}
@@ -367,6 +368,13 @@ void GradientEdit::_notification(int p_what) {
draw_line(Vector2(-1, -1), Vector2(-1, h + 1), Color(1, 1, 1, 0.6));
}
}
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+
+ if (!is_visible()) {
+ grabbing = false;
+ }
+ }
}
void GradientEdit::_draw_checker(int x, int y, int w, int h) {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 38ce91a4df..e2c730a56e 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -58,6 +58,7 @@ Error GraphEdit::connect_node(const StringName &p_from, int p_from_port, const S
c.from_port = p_from_port;
c.to = p_to;
c.to_port = p_to_port;
+ c.activity = 0;
connections.push_back(c);
top_layer->update();
update();
@@ -624,6 +625,7 @@ void GraphEdit::_draw_cos_line(CanvasItem *p_where, const Vector2 &p_from, const
void GraphEdit::_connections_layer_draw() {
+ Color activity_color = get_color("activity");
//draw connections
List<List<Connection>::Element *> to_erase;
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
@@ -661,6 +663,11 @@ void GraphEdit::_connections_layer_draw() {
Color color = gfrom->get_connection_output_color(E->get().from_port);
Vector2 topos = gto->get_connection_input_position(E->get().to_port) + gto->get_offset() * zoom;
Color tocolor = gto->get_connection_input_color(E->get().to_port);
+
+ if (E->get().activity > 0) {
+ color = color.linear_interpolate(activity_color, E->get().activity);
+ tocolor = tocolor.linear_interpolate(activity_color, E->get().activity);
+ }
_draw_cos_line(connections_layer, frompos, topos, color, tocolor);
}
@@ -980,6 +987,23 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
}
+void GraphEdit::set_connection_activity(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port, float p_activity) {
+
+ for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
+
+ if (E->get().from == p_from && E->get().from_port == p_from_port && E->get().to == p_to && E->get().to_port == p_to_port) {
+
+ if (ABS(E->get().activity != p_activity)) {
+ //update only if changed
+ top_layer->update();
+ connections_layer->update();
+ }
+ E->get().activity = p_activity;
+ return;
+ }
+ }
+}
+
void GraphEdit::clear_connections() {
connections.clear();
@@ -1141,11 +1165,16 @@ void GraphEdit::_snap_value_changed(double) {
update();
}
+HBoxContainer *GraphEdit::get_zoom_hbox() {
+ return zoom_hb;
+}
+
void GraphEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_node", "from", "from_port", "to", "to_port"), &GraphEdit::connect_node);
ClassDB::bind_method(D_METHOD("is_node_connected", "from", "from_port", "to", "to_port"), &GraphEdit::is_node_connected);
ClassDB::bind_method(D_METHOD("disconnect_node", "from", "from_port", "to", "to_port"), &GraphEdit::disconnect_node);
+ ClassDB::bind_method(D_METHOD("set_connection_activity", "from", "from_port", "to", "to_port", "amount"), &GraphEdit::set_connection_activity);
ClassDB::bind_method(D_METHOD("get_connection_list"), &GraphEdit::_get_connection_list);
ClassDB::bind_method(D_METHOD("clear_connections"), &GraphEdit::clear_connections);
ClassDB::bind_method(D_METHOD("get_scroll_ofs"), &GraphEdit::get_scroll_ofs);
@@ -1187,6 +1216,8 @@ void GraphEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_scroll_offset"), &GraphEdit::_update_scroll_offset);
ClassDB::bind_method(D_METHOD("_connections_layer_draw"), &GraphEdit::_connections_layer_draw);
+ ClassDB::bind_method(D_METHOD("get_zoom_hbox"), &GraphEdit::get_zoom_hbox);
+
ClassDB::bind_method(D_METHOD("set_selected", "node"), &GraphEdit::set_selected);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "right_disconnects"), "set_right_disconnects", "is_right_disconnects_enabled");
@@ -1253,7 +1284,7 @@ GraphEdit::GraphEdit() {
zoom = 1;
- HBoxContainer *zoom_hb = memnew(HBoxContainer);
+ zoom_hb = memnew(HBoxContainer);
top_layer->add_child(zoom_hb);
zoom_hb->set_position(Vector2(10, 10));
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 3bfde44854..14789001e4 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -31,6 +31,7 @@
#ifndef GRAPH_EDIT_H
#define GRAPH_EDIT_H
+#include "scene/gui/box_container.h"
#include "scene/gui/graph_node.h"
#include "scene/gui/scroll_bar.h"
#include "scene/gui/slider.h"
@@ -62,6 +63,7 @@ public:
StringName to;
int from_port;
int to_port;
+ float activity;
};
private:
@@ -157,6 +159,8 @@ private:
Set<int> valid_left_disconnect_types;
Set<int> valid_right_disconnect_types;
+ HBoxContainer *zoom_hb;
+
friend class GraphEditFilter;
bool _filter_input(const Point2 &p_point);
void _snap_toggled();
@@ -175,6 +179,8 @@ public:
void disconnect_node(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port);
void clear_connections();
+ void set_connection_activity(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port, float p_activity);
+
void add_valid_connection_type(int p_type, int p_with_type);
void remove_valid_connection_type(int p_type, int p_with_type);
bool is_valid_connection_type(int p_type, int p_with_type) const;
@@ -206,6 +212,8 @@ public:
int get_snap() const;
void set_snap(int p_snap);
+ HBoxContainer *get_zoom_hbox();
+
GraphEdit();
};
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index c2b8a7dfab..278e4123d7 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -36,10 +36,12 @@ void GridContainer::_notification(int p_what) {
case NOTIFICATION_SORT_CHILDREN: {
- Map<int, int> col_minw;
- Map<int, int> row_minh;
- Set<int> col_expanded;
- Set<int> row_expanded;
+ int valid_controls_index;
+
+ Map<int, int> col_minw; // max of min_width of all controls in each col (indexed by col)
+ Map<int, int> row_minh; // max of min_height of all controls in each row (indexed by row)
+ Set<int> col_expanded; // columns which have the SIZE_EXPAND flag set
+ Set<int> row_expanded; // rows which have the SIZE_EXPAND flag set
int hsep = get_constant("hseparation");
int vsep = get_constant("vseparation");
@@ -47,13 +49,15 @@ void GridContainer::_notification(int p_what) {
int max_row = get_child_count() / columns;
// Compute the per-column/per-row data
+ valid_controls_index = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
if (!c || !c->is_visible_in_tree())
continue;
- int row = i / columns;
- int col = i % columns;
+ int row = valid_controls_index / columns;
+ int col = valid_controls_index % columns;
+ valid_controls_index++;
Size2i ms = c->get_combined_minimum_size();
if (col_minw.has(col))
@@ -84,17 +88,17 @@ void GridContainer::_notification(int p_what) {
if (!row_expanded.has(E->key()))
remaining_space.height -= E->get();
}
- remaining_space.height -= vsep * (max_row - 1);
- remaining_space.width -= hsep * (max_col - 1);
+ remaining_space.height -= vsep * MAX(max_row - 1, 0);
+ remaining_space.width -= hsep * MAX(max_col - 1, 0);
bool can_fit = false;
- while (!can_fit) {
+ while (!can_fit && col_expanded.size() > 0) {
// Check if all minwidth constraints are ok if we use the remaining space
can_fit = true;
- int max_index = 0;
+ int max_index = col_expanded.front()->get();
for (Set<int>::Element *E = col_expanded.front(); E; E = E->next()) {
if (col_minw[E->get()] > col_minw[max_index]) {
- max_index = col_minw[E->get()];
+ max_index = E->get();
}
if (can_fit && (remaining_space.width / col_expanded.size()) < col_minw[E->get()]) {
can_fit = false;
@@ -109,13 +113,13 @@ void GridContainer::_notification(int p_what) {
}
can_fit = false;
- while (!can_fit) {
+ while (!can_fit && row_expanded.size() > 0) {
// Check if all minwidth constraints are ok if we use the remaining space
can_fit = true;
- int max_index = 0;
+ int max_index = row_expanded.front()->get();
for (Set<int>::Element *E = row_expanded.front(); E; E = E->next()) {
if (row_minh[E->get()] > row_minh[max_index]) {
- max_index = row_minh[E->get()];
+ max_index = E->get();
}
if (can_fit && (remaining_space.height / row_expanded.size()) < row_minh[E->get()]) {
can_fit = false;
@@ -130,18 +134,20 @@ void GridContainer::_notification(int p_what) {
}
// Finally, fit the nodes
- int col_expand = remaining_space.width / col_expanded.size();
- int row_expand = remaining_space.height / row_expanded.size();
+ int col_expand = col_expanded.size() > 0 ? remaining_space.width / col_expanded.size() : 0;
+ int row_expand = row_expanded.size() > 0 ? remaining_space.height / row_expanded.size() : 0;
int col_ofs = 0;
int row_ofs = 0;
+ valid_controls_index = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
if (!c || !c->is_visible_in_tree())
continue;
- int row = i / columns;
- int col = i % columns;
+ int row = valid_controls_index / columns;
+ int col = valid_controls_index % columns;
+ valid_controls_index++;
if (col == 0) {
col_ofs = 0;
@@ -178,6 +184,8 @@ void GridContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_columns", "columns"), &GridContainer::set_columns);
ClassDB::bind_method(D_METHOD("get_columns"), &GridContainer::get_columns);
+ ClassDB::bind_method(D_METHOD("get_child_control_at_cell", "row", "column"),
+ &GridContainer::get_child_control_at_cell);
ADD_PROPERTY(PropertyInfo(Variant::INT, "columns", PROPERTY_HINT_RANGE, "1,1024,1"), "set_columns", "get_columns");
}
@@ -190,17 +198,19 @@ Size2 GridContainer::get_minimum_size() const {
int hsep = get_constant("hseparation");
int vsep = get_constant("vseparation");
- int idx = 0;
int max_row = 0;
int max_col = 0;
+ int valid_controls_index = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = Object::cast_to<Control>(get_child(i));
if (!c || !c->is_visible_in_tree())
continue;
- int row = idx / columns;
- int col = idx % columns;
+ int row = valid_controls_index / columns;
+ int col = valid_controls_index % columns;
+ valid_controls_index++;
+
Size2i ms = c->get_combined_minimum_size();
if (col_minw.has(col))
col_minw[col] = MAX(col_minw[col], ms.width);
@@ -213,7 +223,6 @@ Size2 GridContainer::get_minimum_size() const {
row_minh[row] = ms.height;
max_col = MAX(col, max_col);
max_row = MAX(row, max_row);
- idx++;
}
Size2 ms;
@@ -232,6 +241,21 @@ Size2 GridContainer::get_minimum_size() const {
return ms;
}
+Control *GridContainer::get_child_control_at_cell(int row, int column) {
+ Control *c;
+ int grid_index = row * columns + column;
+ for (int i = 0; i < get_child_count(); i++) {
+ c = Object::cast_to<Control>(get_child(i));
+ if (!c || !c->is_visible_in_tree())
+ continue;
+
+ if (grid_index == i) {
+ break;
+ }
+ }
+ return c;
+}
+
GridContainer::GridContainer() {
set_mouse_filter(MOUSE_FILTER_PASS);
diff --git a/scene/gui/grid_container.h b/scene/gui/grid_container.h
index 243d06f034..7e3470dc89 100644
--- a/scene/gui/grid_container.h
+++ b/scene/gui/grid_container.h
@@ -47,6 +47,7 @@ public:
void set_columns(int p_columns);
int get_columns() const;
virtual Size2 get_minimum_size() const;
+ Control *get_child_control_at_cell(int row, int column);
GridContainer();
};
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index f7574ca2cd..72ed0e9b81 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -37,6 +37,7 @@ void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, boo
Item item;
item.icon = p_texture;
item.icon_region = Rect2i();
+ item.icon_modulate = Color(1, 1, 1, 1);
item.text = p_item;
item.selectable = p_selectable;
item.selected = false;
@@ -54,6 +55,7 @@ void ItemList::add_icon_item(const Ref<Texture> &p_item, bool p_selectable) {
Item item;
item.icon = p_item;
item.icon_region = Rect2i();
+ item.icon_modulate = Color(1, 1, 1, 1);
//item.text=p_item;
item.selectable = p_selectable;
item.selected = false;
@@ -138,6 +140,21 @@ Rect2 ItemList::get_item_icon_region(int p_idx) const {
return items[p_idx].icon_region;
}
+void ItemList::set_item_icon_modulate(int p_idx, const Color &p_modulate) {
+
+ ERR_FAIL_INDEX(p_idx, items.size());
+
+ items[p_idx].icon_modulate = p_modulate;
+ update();
+}
+
+Color ItemList::get_item_icon_modulate(int p_idx) const {
+
+ ERR_FAIL_INDEX_V(p_idx, items.size(), Color());
+
+ return items[p_idx].icon_modulate;
+}
+
void ItemList::set_item_custom_bg_color(int p_idx, const Color &p_custom_bg_color) {
ERR_FAIL_INDEX(p_idx, items.size());
@@ -295,35 +312,21 @@ int ItemList::get_current() const {
return current;
}
-void ItemList::move_item(int p_item, int p_to_pos) {
+void ItemList::move_item(int p_from_idx, int p_to_idx) {
- ERR_FAIL_INDEX(p_item, items.size());
- ERR_FAIL_INDEX(p_to_pos, items.size() + 1);
+ ERR_FAIL_INDEX(p_from_idx, items.size());
+ ERR_FAIL_INDEX(p_to_idx, items.size());
- Item it = items[p_item];
- items.remove(p_item);
-
- if (p_to_pos > p_item) {
- p_to_pos--;
+ if (is_anything_selected() && get_selected_items()[0] == p_from_idx) {
+ current = p_to_idx;
}
- if (p_to_pos >= items.size()) {
- items.push_back(it);
- } else {
- items.insert(p_to_pos, it);
- }
-
- if (current < 0) {
- //do none
- } else if (p_item == current) {
- current = p_to_pos;
- } else if (p_to_pos > p_item && current > p_item && current < p_to_pos) {
- current--;
- } else if (p_to_pos < p_item && current < p_item && current > p_to_pos) {
- current++;
- }
+ Item item = items[p_from_idx];
+ items.remove(p_from_idx);
+ items.insert(p_to_idx, item);
update();
+ shape_changed = true;
}
int ItemList::get_item_count() const {
@@ -675,7 +678,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
search_string = ""; //any mousepress cancels
- if (current % current_columns != (current_columns - 1)) {
+ if (current % current_columns != (current_columns - 1) && current + 1 < items.size()) {
set_current(current + 1);
ensure_current_is_visible();
if (select_mode == SELECT_SINGLE) {
@@ -939,6 +942,7 @@ void ItemList::_notification(int p_what) {
}
}
+ minimum_size_changed();
shape_changed = false;
}
@@ -1059,7 +1063,7 @@ void ItemList::_notification(int p_what) {
draw_rect.size = adj.size;
}
- Color modulate = Color(1, 1, 1, 1);
+ Color modulate = items[i].icon_modulate;
if (items[i].disabled)
modulate.a *= 0.5;
@@ -1118,6 +1122,7 @@ void ItemList::_notification(int p_what) {
text_ofs += base_ofs;
text_ofs += items[i].rect_cache.position;
+ FontDrawer drawer(font, Color(1, 1, 1));
for (int j = 0; j < ss; j++) {
if (j == line_limit_cache[line]) {
@@ -1126,7 +1131,7 @@ void ItemList::_notification(int p_what) {
if (line >= max_text_lines)
break;
}
- ofs += font->draw_char(get_canvas_item(), text_ofs + Vector2(ofs + (max_len - line_size_cache[line]) / 2, line * (font_height + line_separation)).floor(), items[i].text[j], items[i].text[j + 1], modulate);
+ ofs += drawer.draw_char(get_canvas_item(), text_ofs + Vector2(ofs + (max_len - line_size_cache[line]) / 2, line * (font_height + line_separation)).floor(), items[i].text[j], items[i].text[j + 1], modulate);
}
//special multiline mode
@@ -1240,7 +1245,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const {
String ItemList::get_tooltip(const Point2 &p_pos) const {
- int closest = get_item_at_position(p_pos);
+ int closest = get_item_at_position(p_pos, true);
if (closest != -1) {
if (!items[closest].tooltip_enabled) {
@@ -1403,6 +1408,9 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_item_icon_region", "idx", "rect"), &ItemList::set_item_icon_region);
ClassDB::bind_method(D_METHOD("get_item_icon_region", "idx"), &ItemList::get_item_icon_region);
+ ClassDB::bind_method(D_METHOD("set_item_icon_modulate", "idx", "modulate"), &ItemList::set_item_icon_modulate);
+ ClassDB::bind_method(D_METHOD("get_item_icon_modulate", "idx"), &ItemList::get_item_icon_modulate);
+
ClassDB::bind_method(D_METHOD("set_item_selectable", "idx", "selectable"), &ItemList::set_item_selectable);
ClassDB::bind_method(D_METHOD("is_item_selectable", "idx"), &ItemList::is_item_selectable);
@@ -1423,9 +1431,13 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("select", "idx", "single"), &ItemList::select, DEFVAL(true));
ClassDB::bind_method(D_METHOD("unselect", "idx"), &ItemList::unselect);
+ ClassDB::bind_method(D_METHOD("unselect_all"), &ItemList::unselect_all);
+
ClassDB::bind_method(D_METHOD("is_selected", "idx"), &ItemList::is_selected);
ClassDB::bind_method(D_METHOD("get_selected_items"), &ItemList::get_selected_items);
+ ClassDB::bind_method(D_METHOD("move_item", "from_idx", "to_idx"), &ItemList::move_item);
+
ClassDB::bind_method(D_METHOD("get_item_count"), &ItemList::get_item_count);
ClassDB::bind_method(D_METHOD("remove_item", "idx"), &ItemList::remove_item);
@@ -1465,6 +1477,8 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
+ ClassDB::bind_method(D_METHOD("is_anything_selected"), &ItemList::is_anything_selected);
+
ClassDB::bind_method(D_METHOD("get_item_at_position", "position", "exact"), &ItemList::get_item_at_position, DEFVAL(false));
ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible);
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 7f34a250bd..58771c1777 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -54,6 +54,7 @@ private:
Ref<Texture> icon;
Rect2i icon_region;
+ Color icon_modulate;
Ref<Texture> tag_icon;
String text;
bool selectable;
@@ -135,6 +136,9 @@ public:
void set_item_icon_region(int p_idx, const Rect2 &p_region);
Rect2 get_item_icon_region(int p_idx) const;
+ void set_item_icon_modulate(int p_idx, const Color &p_modulate);
+ Color get_item_icon_modulate(int p_idx) const;
+
void set_item_selectable(int p_idx, bool p_selectable);
bool is_item_selectable(int p_idx) const;
@@ -169,7 +173,7 @@ public:
void set_current(int p_current);
int get_current() const;
- void move_item(int p_item, int p_to_pos);
+ void move_item(int p_from_idx, int p_to_idx);
int get_item_count() const;
void remove_item(int p_idx);
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 830f724b3c..9af479c1cc 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -93,6 +93,7 @@ void Label::_notification(int p_what) {
bool use_outline = get_constant("shadow_as_outline");
Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
int line_spacing = get_constant("line_spacing");
+ Color font_outline_modulate = get_color("font_outline_modulate");
style->draw(ci, Rect2(Point2(0, 0), get_size()));
@@ -102,7 +103,8 @@ void Label::_notification(int p_what) {
int lines_visible = (size.y + line_spacing) / font_h;
- int space_w = font->get_char_size(' ').width;
+ // ceiling to ensure autowrapping does not cut text
+ int space_w = Math::ceil(font->get_char_size(' ').width);
int chars_total = 0;
int vbegin = 0, vsep = 0;
@@ -150,6 +152,7 @@ void Label::_notification(int p_what) {
int line = 0;
int line_to = lines_skipped + (lines_visible > 0 ? lines_visible : 1);
+ FontDrawer drawer(font, font_outline_modulate);
while (wc) {
/* handle lines not meant to be drawn quickly */
if (line >= line_to)
@@ -244,11 +247,11 @@ void Label::_notification(int p_what) {
n = String::char_uppercase(c);
}
- float move = font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + shadow_ofs, c, n, font_color_shadow);
+ float move = font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + shadow_ofs, c, n, font_color_shadow, false);
if (use_outline) {
- font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(-shadow_ofs.x, shadow_ofs.y), c, n, font_color_shadow);
- font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(shadow_ofs.x, -shadow_ofs.y), c, n, font_color_shadow);
- font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(-shadow_ofs.x, -shadow_ofs.y), c, n, font_color_shadow);
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(-shadow_ofs.x, shadow_ofs.y), c, n, font_color_shadow, false);
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(shadow_ofs.x, -shadow_ofs.y), c, n, font_color_shadow, false);
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs) + Vector2(-shadow_ofs.x, -shadow_ofs.y), c, n, font_color_shadow, false);
}
x_ofs_shadow += move;
chars_total_shadow++;
@@ -265,7 +268,7 @@ void Label::_notification(int p_what) {
n = String::char_uppercase(c);
}
- x_ofs += font->draw_char(ci, Point2(x_ofs, y_ofs), c, n, font_color);
+ x_ofs += drawer.draw_char(ci, Point2(x_ofs, y_ofs), c, n, font_color);
chars_total++;
}
}
@@ -329,7 +332,8 @@ int Label::get_longest_line_width() const {
}
} else {
- int char_width = font->get_char_size(current, xl_text[i + 1]).width;
+ // ceiling to ensure autowrapping does not cut text
+ int char_width = Math::ceil(font->get_char_size(current, xl_text[i + 1]).width);
line_width += char_width;
}
}
@@ -382,7 +386,8 @@ void Label::regenerate_word_cache() {
int word_pos = 0;
int line_width = 0;
int space_count = 0;
- int space_width = font->get_char_size(' ').width;
+ // ceiling to ensure autowrapping does not cut text
+ int space_width = Math::ceil(font->get_char_size(' ').width);
int line_spacing = get_constant("line_spacing");
line_count = 1;
total_char_cache = 0;
@@ -444,8 +449,8 @@ void Label::regenerate_word_cache() {
if (current_word_size == 0) {
word_pos = i;
}
-
- char_width = font->get_char_size(current, xl_text[i + 1]).width;
+ // ceiling to ensure autowrapping does not cut text
+ char_width = Math::ceil(font->get_char_size(current, xl_text[i + 1]).width);
current_word_size += char_width;
line_width += char_width;
total_char_cache++;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 03dc6686b8..0cd5219f8f 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -215,6 +215,14 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case (KEY_A): { //Select All
select();
} break;
+#ifdef APPLE_STYLE_KEYS
+ case (KEY_LEFT): { // Go to start of text - like HOME key
+ set_cursor_position(0);
+ } break;
+ case (KEY_RIGHT): { // Go to end of text - like END key
+ set_cursor_position(text.length());
+ } break;
+#endif
default: { handled = false; }
}
@@ -373,12 +381,14 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_UP: {
shift_selection_check_pre(k->get_shift());
+ if (get_cursor_position() == 0) handled = false;
set_cursor_position(0);
shift_selection_check_post(k->get_shift());
} break;
case KEY_DOWN: {
shift_selection_check_pre(k->get_shift());
+ if (get_cursor_position() == text.length()) handled = false;
set_cursor_position(text.length());
shift_selection_check_post(k->get_shift());
} break;
@@ -555,6 +565,9 @@ void LineEdit::_notification(int p_what) {
#endif
case NOTIFICATION_RESIZED: {
+ if (expand_to_text_length) {
+ window_pos = 0; //force scroll back since it's expanding to text length
+ }
set_cursor_position(get_cursor_position());
} break;
@@ -600,6 +613,8 @@ void LineEdit::_notification(int p_what) {
}
int x_ofs = 0;
+ bool using_placeholder = text.empty();
+ int cached_text_width = using_placeholder ? cached_placeholder_width : cached_width;
switch (align) {
@@ -613,15 +628,15 @@ void LineEdit::_notification(int p_what) {
if (window_pos != 0)
x_ofs = style->get_offset().x;
else
- x_ofs = int(size.width - (cached_width)) / 2;
+ x_ofs = MAX(style->get_margin(MARGIN_LEFT), int(size.width - (cached_text_width)) / 2);
} break;
case ALIGN_RIGHT: {
- x_ofs = int(size.width - style->get_offset().x - (cached_width));
+ x_ofs = MAX(style->get_margin(MARGIN_LEFT), int(size.width - style->get_margin(MARGIN_RIGHT) - (cached_text_width)));
} break;
}
- int ofs_max = width - style->get_minimum_size().width;
+ int ofs_max = width - style->get_margin(MARGIN_RIGHT);
int char_ofs = window_pos;
int y_area = height - style->get_minimum_size().height;
@@ -634,9 +649,9 @@ void LineEdit::_notification(int p_what) {
Color font_color_selected = get_color("font_color_selected");
Color cursor_color = get_color("cursor_color");
- const String &t = text.empty() ? placeholder : text;
+ const String &t = using_placeholder ? placeholder : text;
// draw placeholder color
- if (text.empty())
+ if (using_placeholder)
font_color.a *= placeholder_alpha;
font_color.a *= disabled_alpha;
@@ -647,6 +662,7 @@ void LineEdit::_notification(int p_what) {
}
int caret_height = font->get_height() > y_area ? y_area : font->get_height();
+ FontDrawer drawer(font, Color(1, 1, 1));
while (true) {
//end of string, break!
@@ -660,8 +676,8 @@ void LineEdit::_notification(int p_what) {
if (ofs >= ime_text.length())
break;
- CharType cchar = (pass && !text.empty()) ? '*' : ime_text[ofs];
- CharType next = (pass && !text.empty()) ? '*' : ime_text[ofs + 1];
+ CharType cchar = (pass && !text.empty()) ? secret_character[0] : ime_text[ofs];
+ CharType next = (pass && !text.empty()) ? secret_character[0] : ime_text[ofs + 1];
int im_char_width = font->get_char_size(cchar, next).width;
if ((x_ofs + im_char_width) > ofs_max)
@@ -674,7 +690,7 @@ void LineEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color);
}
- font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color);
+ drawer.draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color);
x_ofs += im_char_width;
ofs++;
@@ -682,8 +698,8 @@ void LineEdit::_notification(int p_what) {
}
}
- CharType cchar = (pass && !text.empty()) ? '*' : t[char_ofs];
- CharType next = (pass && !text.empty()) ? '*' : t[char_ofs + 1];
+ CharType cchar = (pass && !text.empty()) ? secret_character[0] : t[char_ofs];
+ CharType next = (pass && !text.empty()) ? secret_character[0] : t[char_ofs + 1];
int char_width = font->get_char_size(cchar, next).width;
// end of widget, break!
@@ -695,7 +711,7 @@ void LineEdit::_notification(int p_what) {
if (selected)
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, caret_height)), selection_color);
- font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color);
+ drawer.draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color);
if (char_ofs == cursor_pos && draw_caret) {
if (ime_text.length() == 0) {
@@ -714,8 +730,8 @@ void LineEdit::_notification(int p_what) {
if (ofs >= ime_text.length())
break;
- CharType cchar = (pass && !text.empty()) ? '*' : ime_text[ofs];
- CharType next = (pass && !text.empty()) ? '*' : ime_text[ofs + 1];
+ CharType cchar = (pass && !text.empty()) ? secret_character[0] : ime_text[ofs];
+ CharType next = (pass && !text.empty()) ? secret_character[0] : ime_text[ofs + 1];
int im_char_width = font->get_char_size(cchar, next).width;
if ((x_ofs + im_char_width) > ofs_max)
@@ -728,7 +744,7 @@ void LineEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color);
}
- font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color);
+ drawer.draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color);
x_ofs += im_char_width;
ofs++;
@@ -744,7 +760,8 @@ void LineEdit::_notification(int p_what) {
if (has_focus()) {
- OS::get_singleton()->set_ime_position(get_global_position() + Point2(x_ofs, y_ofs + caret_height));
+ OS::get_singleton()->set_ime_active(true);
+ OS::get_singleton()->set_ime_position(get_global_position() + Point2(using_placeholder ? 0 : x_ofs, y_ofs + caret_height));
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
}
} break;
@@ -754,6 +771,7 @@ void LineEdit::_notification(int p_what) {
draw_caret = true;
}
+ OS::get_singleton()->set_ime_active(true);
Point2 cursor_pos = Point2(get_cursor_position(), 1) * get_minimum_size().height;
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
@@ -766,6 +784,7 @@ void LineEdit::_notification(int p_what) {
OS::get_singleton()->set_ime_position(Point2());
OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL);
+ OS::get_singleton()->set_ime_active(false);
ime_text = "";
ime_selection = Point2();
@@ -879,7 +898,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
} break;
case ALIGN_RIGHT: {
- pixel_ofs = int(size.width - style->get_offset().x - (cached_width));
+ pixel_ofs = int(size.width - style->get_margin(MARGIN_RIGHT) - (cached_width));
} break;
}
@@ -995,7 +1014,6 @@ void LineEdit::set_text(String p_text) {
update();
cursor_pos = 0;
window_pos = 0;
- _text_changed();
}
void LineEdit::clear() {
@@ -1012,6 +1030,15 @@ String LineEdit::get_text() const {
void LineEdit::set_placeholder(String p_text) {
placeholder = tr(p_text);
+ if ((max_length <= 0) || (placeholder.length() <= max_length)) {
+ Ref<Font> font = get_font("font");
+ cached_placeholder_width = 0;
+ if (font != NULL) {
+ for (int i = 0; i < placeholder.length(); i++) {
+ cached_placeholder_width += font->get_char_size(placeholder[i]).width;
+ }
+ }
+ }
update();
}
@@ -1074,11 +1101,12 @@ void LineEdit::set_cursor_position(int p_pos) {
for (int i = cursor_pos; i >= window_pos; i--) {
if (i >= text.length()) {
- accum_width = font->get_char_size(' ').width; //anything should do
+ //do not do this, because if the cursor is at the end, its just fine that it takes no space
+ //accum_width = font->get_char_size(' ').width; //anything should do
} else {
accum_width += font->get_char_size(text[i], i + 1 < text.length() ? text[i + 1] : 0).width; //anything should do
}
- if (accum_width >= window_width)
+ if (accum_width > window_width)
break;
wp = i;
@@ -1145,7 +1173,7 @@ Size2 LineEdit::get_minimum_size() const {
int mstext = get_constant("minimum_spaces") * space_size;
if (expand_to_text_length) {
- mstext = MAX(mstext, font->get_string_size(text).x + space_size); //add a spce because some fonts are too exact
+ mstext = MAX(mstext, font->get_string_size(text).x + space_size); //add a spce because some fonts are too exact, and because cursor needs a bit more when at the end
}
min.width += mstext;
@@ -1212,6 +1240,7 @@ void LineEdit::select_all() {
selection.enabled = true;
update();
}
+
void LineEdit::set_editable(bool p_editable) {
editable = p_editable;
@@ -1228,11 +1257,27 @@ void LineEdit::set_secret(bool p_secret) {
pass = p_secret;
update();
}
+
bool LineEdit::is_secret() const {
return pass;
}
+void LineEdit::set_secret_character(const String &p_string) {
+
+ // An empty string as the secret character would crash the engine
+ // It also wouldn't make sense to use multiple characters as the secret character
+ ERR_EXPLAIN("Secret character must be exactly one character long (" + itos(p_string.length()) + " characters given)");
+ ERR_FAIL_COND(p_string.length() != 1);
+
+ secret_character = p_string;
+ update();
+}
+
+String LineEdit::get_secret_character() const {
+ return secret_character;
+}
+
void LineEdit::select(int p_from, int p_to) {
if (p_from == 0 && p_to == 0) {
@@ -1314,12 +1359,12 @@ PopupMenu *LineEdit::get_menu() const {
return menu;
}
-#ifdef TOOLS_ENABLED
void LineEdit::_editor_settings_changed() {
+#ifdef TOOLS_ENABLED
cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false));
cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65));
-}
#endif
+}
void LineEdit::set_expand_to_text_length(bool p_enabled) {
@@ -1388,9 +1433,7 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed);
ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &LineEdit::_toggle_draw_caret);
-#ifdef TOOLS_ENABLED
ClassDB::bind_method("_editor_settings_changed", &LineEdit::_editor_settings_changed);
-#endif
ClassDB::bind_method(D_METHOD("set_align", "align"), &LineEdit::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &LineEdit::get_align);
@@ -1421,6 +1464,8 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable);
ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret);
ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret);
+ ClassDB::bind_method(D_METHOD("set_secret_character", "character"), &LineEdit::set_secret_character);
+ ClassDB::bind_method(D_METHOD("get_secret_character"), &LineEdit::get_secret_character);
ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option);
ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu);
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
@@ -1448,6 +1493,7 @@ void LineEdit::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "max_length"), "set_max_length", "get_max_length");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "secret"), "set_secret", "is_secret");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "secret_character"), "set_secret_character", "get_secret_character");
ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "expand_to_text_length"), "set_expand_to_text_length", "get_expand_to_text_length");
ADD_PROPERTY(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled");
@@ -1456,7 +1502,7 @@ void LineEdit::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "placeholder_alpha", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_placeholder_alpha", "get_placeholder_alpha");
ADD_GROUP("Caret", "caret_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_blink"), "cursor_set_blink_enabled", "cursor_get_blink_enabled");
- ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret_blink_speed", PROPERTY_HINT_RANGE, "0.1,10,0.1"), "cursor_set_blink_speed", "cursor_get_blink_speed");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret_blink_speed", PROPERTY_HINT_RANGE, "0.1,10,0.01"), "cursor_set_blink_speed", "cursor_get_blink_speed");
ADD_PROPERTY(PropertyInfo(Variant::INT, "caret_position"), "set_cursor_position", "get_cursor_position");
}
@@ -1466,11 +1512,13 @@ LineEdit::LineEdit() {
_create_undo_state();
align = ALIGN_LEFT;
cached_width = 0;
+ cached_placeholder_width = 0;
cursor_pos = 0;
window_pos = 0;
window_has_focus = true;
max_length = 0;
pass = false;
+ secret_character = "*";
text_changed_dirty = false;
placeholder_alpha = 0.6;
@@ -1491,15 +1539,15 @@ LineEdit::LineEdit() {
context_menu_enabled = true;
menu = memnew(PopupMenu);
add_child(menu);
- menu->add_item(TTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
- menu->add_item(TTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
- menu->add_item(TTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
+ menu->add_item(RTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
+ menu->add_item(RTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
+ menu->add_item(RTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
menu->add_separator();
- menu->add_item(TTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
- menu->add_item(TTR("Clear"), MENU_CLEAR);
+ menu->add_item(RTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
+ menu->add_item(RTR("Clear"), MENU_CLEAR);
menu->add_separator();
- menu->add_item(TTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
- menu->add_item(TTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z);
+ menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
+ menu->add_item(RTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z);
menu->connect("id_pressed", this, "menu_option");
expand_to_text_length = false;
}
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index e3ad3b17f1..e9314ba8dd 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -72,6 +72,7 @@ private:
String undo_text;
String text;
String placeholder;
+ String secret_character;
float placeholder_alpha;
String ime_text;
Point2 ime_selection;
@@ -84,6 +85,7 @@ private:
int max_length; // 0 for no maximum
int cached_width;
+ int cached_placeholder_width;
struct Selection {
@@ -122,7 +124,6 @@ private:
void shift_selection_check_post(bool);
void selection_fill_at_cursor();
- void selection_delete();
void set_window_pos(int p_pos);
void set_cursor_at_pixel_pos(int p_x);
@@ -133,9 +134,7 @@ private:
void clear_internal();
void changed_internal();
-#ifdef TOOLS_ENABLED
void _editor_settings_changed();
-#endif
void _gui_input(Ref<InputEvent> p_event);
void _notification(int p_what);
@@ -158,6 +157,7 @@ public:
void select(int p_from = 0, int p_to = -1);
void select_all();
+ void selection_delete();
void deselect();
void delete_char();
@@ -193,6 +193,9 @@ public:
void set_secret(bool p_secret);
bool is_secret() const;
+ void set_secret_character(const String &p_string);
+ String get_secret_character() const;
+
virtual Size2 get_minimum_size() const;
void set_expand_to_text_length(bool p_enabled);
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index 2e74faa61d..87cf4dc334 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -59,7 +59,6 @@ void MenuButton::pressed() {
popup->set_size(Size2(size.width, 0));
popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
popup->popup();
- popup->set_invalidate_click_until_motion();
}
void MenuButton::_gui_input(Ref<InputEvent> p_event) {
@@ -109,7 +108,6 @@ MenuButton::MenuButton() {
add_child(popup);
popup->set_as_toplevel(true);
popup->set_pass_on_modal_close_click(false);
- connect("button_up", popup, "call_deferred", make_binds("grab_click_focus"));
set_process_unhandled_key_input(true);
set_action_mode(ACTION_MODE_BUTTON_PRESS);
}
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 71c14810f6..c5e4149782 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -75,6 +75,10 @@ void OptionButton::_notification(int p_what) {
}
}
+void OptionButton::_focused(int p_which) {
+ emit_signal("item_focused", p_which);
+}
+
void OptionButton::_selected(int p_which) {
int selid = -1;
@@ -108,13 +112,13 @@ void OptionButton::pressed() {
void OptionButton::add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID) {
- popup->add_icon_check_item(p_icon, p_label, p_ID);
+ popup->add_icon_radio_check_item(p_icon, p_label, p_ID);
if (popup->get_item_count() == 1)
select(0);
}
void OptionButton::add_item(const String &p_label, int p_ID) {
- popup->add_check_item(p_label, p_ID);
+ popup->add_radio_check_item(p_label, p_ID);
if (popup->get_item_count() == 1)
select(0);
}
@@ -290,9 +294,10 @@ void OptionButton::get_translatable_strings(List<String> *p_strings) const {
void OptionButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("_selected"), &OptionButton::_selected);
+ ClassDB::bind_method(D_METHOD("_focused"), &OptionButton::_focused);
ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1));
- ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item);
+ ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &OptionButton::set_item_text);
ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "texture"), &OptionButton::set_item_icon);
ClassDB::bind_method(D_METHOD("set_item_disabled", "idx", "disabled"), &OptionButton::set_item_disabled);
@@ -322,6 +327,7 @@ void OptionButton::_bind_methods() {
// "selected" property must come after "items", otherwise GH-10213 occurs
ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected");
ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "ID")));
+ ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "ID")));
}
OptionButton::OptionButton() {
@@ -336,6 +342,7 @@ OptionButton::OptionButton() {
popup->set_as_toplevel(true);
popup->set_pass_on_modal_close_click(false);
popup->connect("id_pressed", this, "_selected");
+ popup->connect("id_focused", this, "_focused");
}
OptionButton::~OptionButton() {
diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h
index f65fa1b631..d5f866d806 100644
--- a/scene/gui/option_button.h
+++ b/scene/gui/option_button.h
@@ -43,6 +43,7 @@ class OptionButton : public Button {
PopupMenu *popup;
int current;
+ void _focused(int p_which);
void _selected(int p_which);
void _select(int p_which, bool p_emit = false);
void _select_int(int p_which);
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index d18a3a3f2f..26d01ecc09 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -113,37 +113,9 @@ void Popup::set_as_minsize() {
void Popup::popup_centered_minsize(const Size2 &p_minsize) {
- Size2 total_minsize = p_minsize;
-
- for (int i = 0; i < get_child_count(); i++) {
-
- Control *c = Object::cast_to<Control>(get_child(i));
- if (!c)
- continue;
- if (!c->is_visible())
- continue;
-
- Size2 minsize = c->get_combined_minimum_size();
-
- for (int j = 0; j < 2; j++) {
-
- Margin m_beg = Margin(0 + j);
- Margin m_end = Margin(2 + j);
-
- float margin_begin = c->get_margin(m_beg);
- float margin_end = c->get_margin(m_end);
- float anchor_begin = c->get_anchor(m_beg);
- float anchor_end = c->get_anchor(m_end);
-
- minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
- }
-
- total_minsize.width = MAX(total_minsize.width, minsize.width);
- total_minsize.height = MAX(total_minsize.height, minsize.height);
- }
-
- popup_centered(total_minsize);
- popped_up = true;
+ set_custom_minimum_size(p_minsize);
+ _fix_size();
+ popup_centered();
}
void Popup::popup_centered(const Size2 &p_size) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 89000fcde1..18e609c798 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -55,7 +55,7 @@ Size2 PopupMenu::get_minimum_size() const {
float max_w = 0;
int font_h = font->get_height();
- int check_w = get_icon("checked")->get_width();
+ int check_w = MAX(get_icon("checked")->get_width(), get_icon("radio_checked")->get_width());
int accel_max_w = 0;
for (int i = 0; i < items.size(); i++) {
@@ -74,7 +74,7 @@ Size2 PopupMenu::get_minimum_size() const {
size.width += items[i].h_ofs;
- if (items[i].checkable) {
+ if (items[i].checkable_type) {
size.width += check_w + hseparation;
}
@@ -211,86 +211,69 @@ void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventKey> k = p_event;
-
- if (k.is_valid()) {
-
- if (!k->is_pressed())
- return;
-
- switch (k->get_scancode()) {
+ if (p_event->is_action("ui_down") && p_event->is_pressed()) {
- case KEY_DOWN: {
+ int search_from = mouse_over + 1;
+ if (search_from >= items.size())
+ search_from = 0;
- int search_from = mouse_over + 1;
- if (search_from >= items.size())
- search_from = 0;
+ for (int i = search_from; i < items.size(); i++) {
- for (int i = search_from; i < items.size(); i++) {
-
- if (i < 0 || i >= items.size())
- continue;
-
- if (!items[i].separator && !items[i].disabled) {
-
- mouse_over = i;
- update();
- break;
- }
- }
- } break;
- case KEY_UP: {
-
- int search_from = mouse_over - 1;
- if (search_from < 0)
- search_from = items.size() - 1;
-
- for (int i = search_from; i >= 0; i--) {
-
- if (i < 0 || i >= items.size())
- continue;
+ if (i < 0 || i >= items.size())
+ continue;
- if (!items[i].separator && !items[i].disabled) {
+ if (!items[i].separator && !items[i].disabled) {
- mouse_over = i;
- update();
- break;
- }
- }
- } break;
-
- case KEY_LEFT: {
+ mouse_over = i;
+ emit_signal("id_focused", i);
+ update();
+ accept_event();
+ break;
+ }
+ }
+ } else if (p_event->is_action("ui_up") && p_event->is_pressed()) {
- Node *n = get_parent();
- if (!n)
- break;
+ int search_from = mouse_over - 1;
+ if (search_from < 0)
+ search_from = items.size() - 1;
- PopupMenu *pm = Object::cast_to<PopupMenu>(n);
- if (!pm)
- break;
+ for (int i = search_from; i >= 0; i--) {
- hide();
- } break;
+ if (i < 0 || i >= items.size())
+ continue;
- case KEY_RIGHT: {
+ if (!items[i].separator && !items[i].disabled) {
- if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator && items[mouse_over].submenu != "" && submenu_over != mouse_over)
- _activate_submenu(mouse_over);
- } break;
+ mouse_over = i;
+ emit_signal("id_focused", i);
+ update();
+ accept_event();
+ break;
+ }
+ }
+ } else if (p_event->is_action("ui_left") && p_event->is_pressed()) {
- case KEY_ENTER:
- case KEY_KP_ENTER: {
+ Node *n = get_parent();
+ if (n && Object::cast_to<PopupMenu>(n)) {
+ hide();
+ accept_event();
+ }
+ } else if (p_event->is_action("ui_right") && p_event->is_pressed()) {
- if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator) {
+ if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator && items[mouse_over].submenu != "" && submenu_over != mouse_over) {
+ _activate_submenu(mouse_over);
+ accept_event();
+ }
+ } else if (p_event->is_action("ui_accept") && p_event->is_pressed()) {
- if (items[mouse_over].submenu != "" && submenu_over != mouse_over) {
- _activate_submenu(mouse_over);
- break;
- }
+ if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator) {
- activate_item(mouse_over);
- }
- } break;
+ if (items[mouse_over].submenu != "" && submenu_over != mouse_over) {
+ _activate_submenu(mouse_over);
+ } else {
+ activate_item(mouse_over);
+ }
+ accept_event();
}
}
@@ -301,7 +284,8 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
if (b->is_pressed())
return;
- switch (b->get_button_index()) {
+ int button_idx = b->get_button_index();
+ switch (button_idx) {
case BUTTON_WHEEL_DOWN: {
@@ -315,30 +299,37 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
_scroll(b->get_factor(), b->get_position());
}
} break;
- case BUTTON_LEFT: {
+ default: {
+ // Allow activating item by releasing the LMB or any that was down when the popup appeared
+ if (button_idx == BUTTON_LEFT || (initial_button_mask & (1 << (button_idx - 1)))) {
- int over = _get_mouse_over(b->get_position());
+ bool was_during_grabbed_click = during_grabbed_click;
+ during_grabbed_click = false;
- if (invalidated_click) {
- invalidated_click = false;
- break;
- }
- if (over < 0) {
- hide();
- break; //non-activable
- }
+ int over = _get_mouse_over(b->get_position());
+
+ if (invalidated_click) {
+ invalidated_click = false;
+ break;
+ }
+ if (over < 0) {
+ if (!was_during_grabbed_click) {
+ hide();
+ }
+ break; //non-activable
+ }
- if (items[over].separator || items[over].disabled)
- break;
+ if (items[over].separator || items[over].disabled)
+ break;
- if (items[over].submenu != "") {
+ if (items[over].submenu != "") {
- _activate_submenu(over);
- return;
+ _activate_submenu(over);
+ return;
+ }
+ activate_item(over);
}
- activate_item(over);
-
- } break;
+ }
}
//update();
@@ -425,8 +416,9 @@ void PopupMenu::_notification(int p_what) {
Ref<StyleBox> style = get_stylebox("panel");
Ref<StyleBox> hover = get_stylebox("hover");
Ref<Font> font = get_font("font");
- Ref<Texture> check = get_icon("checked");
- Ref<Texture> uncheck = get_icon("unchecked");
+ // In Item::checkable_type enum order (less the non-checkable member)
+ Ref<Texture> check[] = { get_icon("checked"), get_icon("radio_checked") };
+ Ref<Texture> uncheck[] = { get_icon("unchecked"), get_icon("radio_unchecked") };
Ref<Texture> submenu = get_icon("submenu");
Ref<StyleBox> separator = get_stylebox("separator");
@@ -448,6 +440,8 @@ void PopupMenu::_notification(int p_what) {
float h;
Size2 icon_size;
+ Color icon_color(1, 1, 1, items[i].disabled ? 0.5 : 1);
+
item_ofs.x += items[i].h_ofs;
if (!items[i].icon.is_null()) {
@@ -469,24 +463,20 @@ void PopupMenu::_notification(int p_what) {
separator->draw(ci, Rect2(item_ofs + Point2(0, Math::floor((h - sep_h) / 2.0)), Size2(get_size().width - style->get_minimum_size().width, sep_h)));
}
- if (items[i].checkable) {
-
- if (items[i].checked)
- check->draw(ci, item_ofs + Point2(0, Math::floor((h - check->get_height()) / 2.0)));
- else
- uncheck->draw(ci, item_ofs + Point2(0, Math::floor((h - check->get_height()) / 2.0)));
-
- item_ofs.x += check->get_width() + hseparation;
+ if (items[i].checkable_type) {
+ Texture *icon = (items[i].checked ? check[items[i].checkable_type - 1] : uncheck[items[i].checkable_type - 1]).ptr();
+ icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon->get_height()) / 2.0)), icon_color);
+ item_ofs.x += icon->get_width() + hseparation;
}
if (!items[i].icon.is_null()) {
- items[i].icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon_size.height) / 2.0)));
+ items[i].icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon_size.height) / 2.0)), icon_color);
item_ofs.x += items[i].icon->get_width();
item_ofs.x += hseparation;
}
if (items[i].submenu != "") {
- submenu->draw(ci, Point2(size.width - style->get_margin(MARGIN_RIGHT) - submenu->get_width(), item_ofs.y + Math::floor(h - submenu->get_height()) / 2));
+ submenu->draw(ci, Point2(size.width - style->get_margin(MARGIN_RIGHT) - submenu->get_width(), item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color);
}
item_ofs.y += font->get_ascent();
@@ -520,6 +510,11 @@ void PopupMenu::_notification(int p_what) {
update();
}
} break;
+ case NOTIFICATION_POST_POPUP: {
+
+ initial_button_mask = Input::get_singleton()->get_mouse_button_mask();
+ during_grabbed_click = (bool)initial_button_mask;
+ } break;
case NOTIFICATION_POPUP_HIDE: {
if (mouse_over >= 0) {
@@ -540,6 +535,7 @@ void PopupMenu::add_icon_item(const Ref<Texture> &p_icon, const String &p_label,
item.ID = p_ID;
items.push_back(item);
update();
+ minimum_size_changed();
}
void PopupMenu::add_item(const String &p_label, int p_ID, uint32_t p_accel) {
@@ -550,6 +546,7 @@ void PopupMenu::add_item(const String &p_label, int p_ID, uint32_t p_accel) {
item.ID = p_ID;
items.push_back(item);
update();
+ minimum_size_changed();
}
void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, int p_ID) {
@@ -561,6 +558,7 @@ void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu,
item.submenu = p_submenu;
items.push_back(item);
update();
+ minimum_size_changed();
}
void PopupMenu::add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID, uint32_t p_accel) {
@@ -571,10 +569,12 @@ void PopupMenu::add_icon_check_item(const Ref<Texture> &p_icon, const String &p_
item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
- item.checkable = true;
+ item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
update();
+ minimum_size_changed();
}
+
void PopupMenu::add_check_item(const String &p_label, int p_ID, uint32_t p_accel) {
Item item;
@@ -582,9 +582,26 @@ void PopupMenu::add_check_item(const String &p_label, int p_ID, uint32_t p_accel
item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
- item.checkable = true;
+ item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
update();
+ minimum_size_changed();
+}
+
+void PopupMenu::add_radio_check_item(const String &p_label, int p_ID, uint32_t p_accel) {
+
+ add_check_item(p_label, p_ID, p_accel);
+ items[items.size() - 1].checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
+ update();
+ minimum_size_changed();
+}
+
+void PopupMenu::add_icon_radio_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID, uint32_t p_accel) {
+
+ add_icon_check_item(p_icon, p_label, p_ID, p_accel);
+ items[items.size() - 1].checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
+ update();
+ minimum_size_changed();
}
void PopupMenu::add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
@@ -600,6 +617,7 @@ void PopupMenu::add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut
item.shortcut_is_global = p_global;
items.push_back(item);
update();
+ minimum_size_changed();
}
void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
@@ -614,7 +632,9 @@ void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_g
item.shortcut_is_global = p_global;
items.push_back(item);
update();
+ minimum_size_changed();
}
+
void PopupMenu::add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
ERR_FAIL_COND(p_shortcut.is_null());
@@ -624,11 +644,12 @@ void PopupMenu::add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<Sh
Item item;
item.ID = p_ID;
item.shortcut = p_shortcut;
- item.checkable = true;
+ item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
item.icon = p_icon;
item.shortcut_is_global = p_global;
items.push_back(item);
update();
+ minimum_size_changed();
}
void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
@@ -641,9 +662,18 @@ void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bo
item.ID = p_ID;
item.shortcut = p_shortcut;
item.shortcut_is_global = p_global;
- item.checkable = true;
+ item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
update();
+ minimum_size_changed();
+}
+
+void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID, bool p_global) {
+
+ add_check_shortcut(p_shortcut, p_ID, p_global);
+ items[items.size() - 1].checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
+ update();
+ minimum_size_changed();
}
void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_ID, uint32_t p_accel) {
@@ -653,11 +683,11 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int
item.xl_text = tr(p_label);
item.accel = p_accel;
item.ID = p_ID;
- item.checkable = false;
item.max_states = p_max_states;
item.state = p_default_state;
items.push_back(item);
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_text(int p_idx, const String &p_text) {
@@ -667,6 +697,7 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) {
items[p_idx].xl_text = tr(p_text);
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_icon(int p_idx, const Ref<Texture> &p_icon) {
@@ -674,6 +705,7 @@ void PopupMenu::set_item_icon(int p_idx, const Ref<Texture> &p_icon) {
items[p_idx].icon = p_icon;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_checked(int p_idx, bool p_checked) {
@@ -682,6 +714,7 @@ void PopupMenu::set_item_checked(int p_idx, bool p_checked) {
items[p_idx].checked = p_checked;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_id(int p_idx, int p_ID) {
@@ -689,6 +722,7 @@ void PopupMenu::set_item_id(int p_idx, int p_ID) {
items[p_idx].ID = p_ID;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_accelerator(int p_idx, uint32_t p_accel) {
@@ -697,6 +731,7 @@ void PopupMenu::set_item_accelerator(int p_idx, uint32_t p_accel) {
items[p_idx].accel = p_accel;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_metadata(int p_idx, const Variant &p_meta) {
@@ -704,6 +739,7 @@ void PopupMenu::set_item_metadata(int p_idx, const Variant &p_meta) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].metadata = p_meta;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_disabled(int p_idx, bool p_disabled) {
@@ -711,6 +747,7 @@ void PopupMenu::set_item_disabled(int p_idx, bool p_disabled) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].disabled = p_disabled;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_submenu(int p_idx, const String &p_submenu) {
@@ -718,6 +755,7 @@ void PopupMenu::set_item_submenu(int p_idx, const String &p_submenu) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].submenu = p_submenu;
update();
+ minimum_size_changed();
}
void PopupMenu::toggle_item_checked(int p_idx) {
@@ -725,6 +763,7 @@ void PopupMenu::toggle_item_checked(int p_idx) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].checked = !items[p_idx].checked;
update();
+ minimum_size_changed();
}
String PopupMenu::get_item_text(int p_idx) const {
@@ -828,7 +867,14 @@ bool PopupMenu::is_item_separator(int p_idx) const {
void PopupMenu::set_item_as_checkable(int p_idx, bool p_checkable) {
ERR_FAIL_INDEX(p_idx, items.size());
- items[p_idx].checkable = p_checkable;
+ items[p_idx].checkable_type = p_checkable ? Item::CHECKABLE_TYPE_CHECK_BOX : Item::CHECKABLE_TYPE_NONE;
+ update();
+}
+
+void PopupMenu::set_item_as_radio_checkable(int p_idx, bool p_radio_checkable) {
+
+ ERR_FAIL_INDEX(p_idx, items.size());
+ items[p_idx].checkable_type = p_radio_checkable ? Item::CHECKABLE_TYPE_RADIO_BUTTON : Item::CHECKABLE_TYPE_NONE;
update();
}
@@ -859,6 +905,7 @@ void PopupMenu::set_item_h_offset(int p_idx, int p_offset) {
ERR_FAIL_INDEX(p_idx, items.size());
items[p_idx].h_ofs = p_offset;
update();
+ minimum_size_changed();
}
void PopupMenu::set_item_multistate(int p_idx, int p_state) {
@@ -868,6 +915,13 @@ void PopupMenu::set_item_multistate(int p_idx, int p_state) {
update();
}
+void PopupMenu::set_item_shortcut_disabled(int p_idx, bool p_disabled) {
+
+ ERR_FAIL_INDEX(p_idx, items.size());
+ items[p_idx].shortcut_is_disabled = p_disabled;
+ update();
+}
+
void PopupMenu::toggle_item_multistate(int p_idx) {
ERR_FAIL_INDEX(p_idx, items.size());
@@ -884,7 +938,18 @@ void PopupMenu::toggle_item_multistate(int p_idx) {
bool PopupMenu::is_item_checkable(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, items.size(), false);
- return items[p_idx].checkable;
+ return items[p_idx].checkable_type;
+}
+
+bool PopupMenu::is_item_radio_checkable(int p_idx) const {
+ ERR_FAIL_INDEX_V(p_idx, items.size(), false);
+ return items[p_idx].checkable_type == Item::CHECKABLE_TYPE_RADIO_BUTTON;
+}
+
+bool PopupMenu::is_item_shortcut_disabled(int p_idx) const {
+
+ ERR_FAIL_INDEX_V(p_idx, items.size(), false);
+ return items[p_idx].shortcut_is_disabled;
}
int PopupMenu::get_item_count() const {
@@ -913,7 +978,7 @@ bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_fo
int il = items.size();
for (int i = 0; i < il; i++) {
- if (is_item_disabled(i))
+ if (is_item_disabled(i) || items[i].shortcut_is_disabled)
continue;
if (items[i].shortcut.is_valid() && items[i].shortcut->is_shortcut(p_event) && (items[i].shortcut_is_global || !p_for_global_only)) {
@@ -958,7 +1023,7 @@ void PopupMenu::activate_item(int p_item) {
// We close all parents that are chained together,
// with hide_on_item_selection enabled
- if (items[p_item].checkable) {
+ if (items[p_item].checkable_type) {
if (!hide_on_checkable_item_selection || !pop->is_hide_on_checkable_item_selection())
break;
} else if (0 < items[p_item].max_states) {
@@ -975,7 +1040,7 @@ void PopupMenu::activate_item(int p_item) {
// Hides popup by default; unless otherwise specified
// by using set_hide_on_item_selection and set_hide_on_checkable_item_selection
- if (items[p_item].checkable) {
+ if (items[p_item].checkable_type) {
if (!hide_on_checkable_item_selection)
return;
} else if (0 < items[p_item].max_states) {
@@ -1018,6 +1083,7 @@ void PopupMenu::clear() {
items.clear();
mouse_over = -1;
update();
+ minimum_size_changed();
}
Array PopupMenu::_get_items() const {
@@ -1027,7 +1093,9 @@ Array PopupMenu::_get_items() const {
items.push_back(get_item_text(i));
items.push_back(get_item_icon(i));
- items.push_back(is_item_checkable(i));
+ // For compatibility, use false/true for no/checkbox and integers for other values
+ int ct = this->items[i].checkable_type;
+ items.push_back(Variant(ct <= Item::CHECKABLE_TYPE_CHECK_BOX ? is_item_checkable(i) : ct));
items.push_back(is_item_checked(i));
items.push_back(is_item_disabled(i));
@@ -1070,7 +1138,9 @@ void PopupMenu::_set_items(const Array &p_items) {
String text = p_items[i + 0];
Ref<Texture> icon = p_items[i + 1];
+ // For compatibility, use false/true for no/checkbox and integers for other values
bool checkable = p_items[i + 2];
+ bool radio_checkable = (int)p_items[i + 2] == Item::CHECKABLE_TYPE_RADIO_BUTTON;
bool checked = p_items[i + 3];
bool disabled = p_items[i + 4];
@@ -1083,7 +1153,13 @@ void PopupMenu::_set_items(const Array &p_items) {
int idx = get_item_count();
add_item(text, id);
set_item_icon(idx, icon);
- set_item_as_checkable(idx, checkable);
+ if (checkable) {
+ if (radio_checkable) {
+ set_item_as_radio_checkable(idx, true);
+ } else {
+ set_item_as_checkable(idx, true);
+ }
+ }
set_item_checked(idx, checked);
set_item_disabled(idx, disabled);
set_item_id(idx, id);
@@ -1164,12 +1240,14 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_item", "label", "id", "accel"), &PopupMenu::add_item, DEFVAL(-1), DEFVAL(0));
ClassDB::bind_method(D_METHOD("add_icon_check_item", "texture", "label", "id", "accel"), &PopupMenu::add_icon_check_item, DEFVAL(-1), DEFVAL(0));
ClassDB::bind_method(D_METHOD("add_check_item", "label", "id", "accel"), &PopupMenu::add_check_item, DEFVAL(-1), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("add_radio_check_item", "label", "id", "accel"), &PopupMenu::add_radio_check_item, DEFVAL(-1), DEFVAL(0));
ClassDB::bind_method(D_METHOD("add_submenu_item", "label", "submenu", "id"), &PopupMenu::add_submenu_item, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("add_icon_shortcut", "texture", "shortcut", "id", "global"), &PopupMenu::add_icon_shortcut, DEFVAL(-1), DEFVAL(false));
ClassDB::bind_method(D_METHOD("add_shortcut", "shortcut", "id", "global"), &PopupMenu::add_shortcut, DEFVAL(-1), DEFVAL(false));
ClassDB::bind_method(D_METHOD("add_icon_check_shortcut", "texture", "shortcut", "id", "global"), &PopupMenu::add_icon_check_shortcut, DEFVAL(-1), DEFVAL(false));
ClassDB::bind_method(D_METHOD("add_check_shortcut", "shortcut", "id", "global"), &PopupMenu::add_check_shortcut, DEFVAL(-1), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("add_radio_check_shortcut", "shortcut", "id", "global"), &PopupMenu::add_radio_check_shortcut, DEFVAL(-1), DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_item_text", "idx", "text"), &PopupMenu::set_item_text);
ClassDB::bind_method(D_METHOD("set_item_icon", "idx", "icon"), &PopupMenu::set_item_icon);
@@ -1181,9 +1259,11 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_item_submenu", "idx", "submenu"), &PopupMenu::set_item_submenu);
ClassDB::bind_method(D_METHOD("set_item_as_separator", "idx", "enable"), &PopupMenu::set_item_as_separator);
ClassDB::bind_method(D_METHOD("set_item_as_checkable", "idx", "enable"), &PopupMenu::set_item_as_checkable);
+ ClassDB::bind_method(D_METHOD("set_item_as_radio_checkable", "idx", "enable"), &PopupMenu::set_item_as_radio_checkable);
ClassDB::bind_method(D_METHOD("set_item_tooltip", "idx", "tooltip"), &PopupMenu::set_item_tooltip);
ClassDB::bind_method(D_METHOD("set_item_shortcut", "idx", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_item_multistate", "idx", "state"), &PopupMenu::set_item_multistate);
+ ClassDB::bind_method(D_METHOD("set_item_shortcut_disabled", "idx", "disabled"), &PopupMenu::set_item_shortcut_disabled);
ClassDB::bind_method(D_METHOD("toggle_item_checked", "idx"), &PopupMenu::toggle_item_checked);
ClassDB::bind_method(D_METHOD("toggle_item_multistate", "idx"), &PopupMenu::toggle_item_multistate);
@@ -1199,6 +1279,8 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item_submenu", "idx"), &PopupMenu::get_item_submenu);
ClassDB::bind_method(D_METHOD("is_item_separator", "idx"), &PopupMenu::is_item_separator);
ClassDB::bind_method(D_METHOD("is_item_checkable", "idx"), &PopupMenu::is_item_checkable);
+ ClassDB::bind_method(D_METHOD("is_item_radio_checkable", "idx"), &PopupMenu::is_item_radio_checkable);
+ ClassDB::bind_method(D_METHOD("is_item_shortcut_disabled", "idx"), &PopupMenu::is_item_shortcut_disabled);
ClassDB::bind_method(D_METHOD("get_item_tooltip", "idx"), &PopupMenu::get_item_tooltip);
ClassDB::bind_method(D_METHOD("get_item_shortcut", "idx"), &PopupMenu::get_item_shortcut);
@@ -1229,18 +1311,24 @@ void PopupMenu::_bind_methods() {
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "hide_on_state_item_selection"), "set_hide_on_state_item_selection", "is_hide_on_state_item_selection");
ADD_SIGNAL(MethodInfo("id_pressed", PropertyInfo(Variant::INT, "ID")));
+ ADD_SIGNAL(MethodInfo("id_focused", PropertyInfo(Variant::INT, "ID")));
ADD_SIGNAL(MethodInfo("index_pressed", PropertyInfo(Variant::INT, "index")));
}
-void PopupMenu::set_invalidate_click_until_motion() {
+void PopupMenu::popup(const Rect2 &p_bounds) {
+
+ grab_click_focus();
moved = Vector2();
invalidated_click = true;
+ Popup::popup(p_bounds);
}
PopupMenu::PopupMenu() {
mouse_over = -1;
submenu_over = -1;
+ initial_button_mask = 0;
+ during_grabbed_click = false;
set_focus_mode(FOCUS_ALL);
set_as_toplevel(true);
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 60f36e95ec..d3ee9be1c0 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -46,7 +46,11 @@ class PopupMenu : public Popup {
String text;
String xl_text;
bool checked;
- bool checkable;
+ enum {
+ CHECKABLE_TYPE_NONE,
+ CHECKABLE_TYPE_CHECK_BOX,
+ CHECKABLE_TYPE_RADIO_BUTTON,
+ } checkable_type;
int max_states;
int state;
bool separator;
@@ -60,10 +64,11 @@ class PopupMenu : public Popup {
int h_ofs;
Ref<ShortCut> shortcut;
bool shortcut_is_global;
+ bool shortcut_is_disabled;
Item() {
checked = false;
- checkable = false;
+ checkable_type = CHECKABLE_TYPE_NONE;
separator = false;
max_states = 0;
state = 0;
@@ -72,12 +77,15 @@ class PopupMenu : public Popup {
_ofs_cache = 0;
h_ofs = 0;
shortcut_is_global = false;
+ shortcut_is_disabled = false;
}
};
Timer *submenu_timer;
List<Rect2> autohide_areas;
Vector<Item> items;
+ int initial_button_mask;
+ bool during_grabbed_click;
int mouse_over;
int submenu_over;
Rect2 parent_rect;
@@ -115,12 +123,15 @@ public:
void add_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
void add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
void add_check_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
+ void add_radio_check_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
+ void add_icon_radio_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0);
void add_submenu_item(const String &p_label, const String &p_submenu, int p_ID = -1);
void add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
void add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
void add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
void add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
+ void add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false);
void add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_ID = -1, uint32_t p_accel = 0);
@@ -134,11 +145,13 @@ public:
void set_item_submenu(int p_idx, const String &p_submenu);
void set_item_as_separator(int p_idx, bool p_separator);
void set_item_as_checkable(int p_idx, bool p_checkable);
+ void set_item_as_radio_checkable(int p_idx, bool p_radio_checkable);
void set_item_tooltip(int p_idx, const String &p_tooltip);
void set_item_shortcut(int p_idx, const Ref<ShortCut> &p_shortcut, bool p_global = false);
void set_item_h_offset(int p_idx, int p_offset);
void set_item_multistate(int p_idx, int p_state);
void toggle_item_multistate(int p_idx);
+ void set_item_shortcut_disabled(int p_idx, bool p_disabled);
void toggle_item_checked(int p_idx);
@@ -154,6 +167,8 @@ public:
String get_item_submenu(int p_idx) const;
bool is_item_separator(int p_idx) const;
bool is_item_checkable(int p_idx) const;
+ bool is_item_radio_checkable(int p_idx) const;
+ bool is_item_shortcut_disabled(int p_idx) const;
String get_item_tooltip(int p_idx) const;
Ref<ShortCut> get_item_shortcut(int p_idx) const;
int get_item_state(int p_idx) const;
@@ -178,7 +193,6 @@ public:
void add_autohide_area(const Rect2 &p_area);
void clear_autohide_areas();
- void set_invalidate_click_until_motion();
void set_hide_on_item_selection(bool p_enabled);
bool is_hide_on_item_selection() const;
@@ -188,6 +202,8 @@ public:
void set_hide_on_multistate_item_selection(bool p_enabled);
bool is_hide_on_multistate_item_selection() const;
+ virtual void popup(const Rect2 &p_bounds = Rect2());
+
PopupMenu();
~PopupMenu();
};
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index c85bed0451..fc5d56237a 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -33,13 +33,16 @@
Size2 ProgressBar::get_minimum_size() const {
Ref<StyleBox> bg = get_stylebox("bg");
+ Ref<StyleBox> fg = get_stylebox("fg");
Ref<Font> font = get_font("font");
- Size2 ms = bg->get_minimum_size() + bg->get_center_size();
- if (percent_visible) {
- ms.height = MAX(ms.height, bg->get_minimum_size().height + font->get_height());
- }
- return ms;
+ Size2 minimum_size = bg->get_minimum_size();
+ minimum_size.height = MAX(minimum_size.height, fg->get_minimum_size().height);
+ minimum_size.width = MAX(minimum_size.width, fg->get_minimum_size().width);
+ //if (percent_visible) { this is needed, else the progressbar will collapse
+ minimum_size.height = MAX(minimum_size.height, bg->get_minimum_size().height + font->get_height());
+ //}
+ return minimum_size;
}
void ProgressBar::_notification(int p_what) {
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index cd6c6bb65c..4062e48640 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -71,10 +71,10 @@ void Range::set_value(double p_val) {
p_val = Math::round(p_val);
}
- if (p_val > shared->max - shared->page)
+ if (!shared->allow_greater && p_val > shared->max - shared->page)
p_val = shared->max - shared->page;
- if (p_val < shared->min)
+ if (!shared->allow_lesser && p_val < shared->min)
p_val = shared->min;
if (shared->val == p_val)
@@ -136,9 +136,9 @@ void Range::set_as_ratio(double p_value) {
double v;
- if (shared->exp_ratio && get_min() > 0) {
+ if (shared->exp_ratio && get_min() >= 0) {
- double exp_min = Math::log(get_min()) / Math::log((double)2);
+ double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
double exp_max = Math::log(get_max()) / Math::log((double)2);
v = Math::pow(2, exp_min + (exp_max - exp_min) * p_value);
} else {
@@ -151,21 +151,24 @@ void Range::set_as_ratio(double p_value) {
v = percent + get_min();
}
}
+ v = CLAMP(v, get_min(), get_max());
set_value(v);
}
double Range::get_as_ratio() const {
- if (shared->exp_ratio && get_min() > 0) {
+ if (shared->exp_ratio && get_min() >= 0) {
- double exp_min = Math::log(get_min()) / Math::log((double)2);
+ double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
double exp_max = Math::log(get_max()) / Math::log((double)2);
- double v = Math::log(get_value()) / Math::log((double)2);
+ float value = CLAMP(get_value(), shared->min, shared->max);
+ double v = Math::log(value) / Math::log((double)2);
return (v - exp_min) / (exp_max - exp_min);
} else {
- return (get_value() - get_min()) / (get_max() - get_min());
+ float value = CLAMP(get_value(), shared->min, shared->max);
+ return (value - get_min()) / (get_max() - get_min());
}
}
@@ -193,6 +196,8 @@ void Range::unshare() {
nshared->val = shared->val;
nshared->step = shared->step;
nshared->page = shared->page;
+ nshared->allow_greater = shared->allow_greater;
+ nshared->allow_lesser = shared->allow_lesser;
_unref_shared();
_ref_shared(nshared);
}
@@ -236,6 +241,10 @@ void Range::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_using_rounded_values"), &Range::is_using_rounded_values);
ClassDB::bind_method(D_METHOD("set_exp_ratio", "enabled"), &Range::set_exp_ratio);
ClassDB::bind_method(D_METHOD("is_ratio_exp"), &Range::is_ratio_exp);
+ ClassDB::bind_method(D_METHOD("set_allow_greater", "allow"), &Range::set_allow_greater);
+ ClassDB::bind_method(D_METHOD("is_greater_allowed"), &Range::is_greater_allowed);
+ ClassDB::bind_method(D_METHOD("set_allow_lesser", "allow"), &Range::set_allow_lesser);
+ ClassDB::bind_method(D_METHOD("is_lesser_allowed"), &Range::is_lesser_allowed);
ClassDB::bind_method(D_METHOD("share", "with"), &Range::_share);
ClassDB::bind_method(D_METHOD("unshare"), &Range::unshare);
@@ -251,6 +260,8 @@ void Range::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ratio", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_as_ratio", "get_as_ratio");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exp_edit"), "set_exp_ratio", "is_ratio_exp");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rounded"), "set_use_rounded_values", "is_using_rounded_values");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "allow_greater"), "set_allow_greater", "is_greater_allowed");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "allow_lesser"), "set_allow_lesser", "is_lesser_allowed");
}
void Range::set_use_rounded_values(bool p_enable) {
@@ -273,6 +284,22 @@ bool Range::is_ratio_exp() const {
return shared->exp_ratio;
}
+void Range::set_allow_greater(bool p_allow) {
+ shared->allow_greater = p_allow;
+}
+
+bool Range::is_greater_allowed() const {
+ return shared->allow_greater;
+}
+
+void Range::set_allow_lesser(bool p_allow) {
+ shared->allow_lesser = p_allow;
+}
+
+bool Range::is_lesser_allowed() const {
+ return shared->allow_lesser;
+}
+
Range::Range() {
shared = memnew(Shared);
shared->min = 0;
@@ -282,6 +309,8 @@ Range::Range() {
shared->page = 0;
shared->owners.insert(this);
shared->exp_ratio = false;
+ shared->allow_greater = false;
+ shared->allow_lesser = false;
_rounded_values = false;
}
diff --git a/scene/gui/range.h b/scene/gui/range.h
index de9383afd8..125f559248 100644
--- a/scene/gui/range.h
+++ b/scene/gui/range.h
@@ -43,6 +43,8 @@ class Range : public Control {
double val, min, max;
double step, page;
bool exp_ratio;
+ bool allow_greater;
+ bool allow_lesser;
Set<Range *> owners;
void emit_value_changed();
void emit_changed(const char *p_what = "");
@@ -86,6 +88,12 @@ public:
void set_exp_ratio(bool p_enable);
bool is_ratio_exp() const;
+ void set_allow_greater(bool p_allow);
+ bool is_greater_allowed() const;
+
+ void set_allow_lesser(bool p_allow);
+ bool is_lesser_allowed() const;
+
void share(Range *p_range);
void unshare();
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 381c6c75a5..ce2e3538da 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -86,11 +86,59 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
return NULL;
}
+RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
+ if (p_free) {
+
+ if (p_item->subitems.size()) {
+
+ return p_item->subitems.back()->get();
+ } else if (!p_item->parent) {
+ return NULL;
+ } else if (p_item->E->prev()) {
+
+ return p_item->E->prev()->get();
+ } else {
+ //go back until something with a prev is found
+ while (p_item->parent && !p_item->E->prev()) {
+ p_item = p_item->parent;
+ }
+
+ if (p_item->parent)
+ return p_item->E->prev()->get();
+ else
+ return NULL;
+ }
+
+ } else {
+ if (p_item->subitems.size() && p_item->type != ITEM_TABLE) {
+
+ return p_item->subitems.back()->get();
+ } else if (p_item->type == ITEM_FRAME) {
+ return NULL;
+ } else if (p_item->E->prev()) {
+
+ return p_item->E->prev()->get();
+ } else {
+ //go back until something with a prev is found
+ while (p_item->type != ITEM_FRAME && !p_item->E->prev()) {
+ p_item = p_item->parent;
+ }
+
+ if (p_item->type != ITEM_FRAME)
+ return p_item->E->prev()->get();
+ else
+ return NULL;
+ }
+ }
+
+ return NULL;
+}
+
Rect2 RichTextLabel::_get_text_rect() {
Ref<StyleBox> style = get_stylebox("normal");
return Rect2(style->get_offset(), get_size() - style->get_minimum_size());
}
-int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos, Item **r_click_item, int *r_click_char, bool *r_outside, int p_char_count) {
+int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Color &p_font_color_shadow, bool p_shadow_as_outline, const Point2 &shadow_ofs, const Point2i &p_click_pos, Item **r_click_item, int *r_click_char, bool *r_outside, int p_char_count) {
RID ci;
if (r_outside)
@@ -125,6 +173,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
l.descent_caches.clear();
l.char_count = 0;
l.minimum_width = 0;
+ l.maximum_width = 0;
}
int wofs = margin;
@@ -200,7 +249,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
#define ENSURE_WIDTH(m_width) \
if (p_mode == PROCESS_CACHE) { \
- l.minimum_width = MAX(l.minimum_width, wofs + m_width); \
+ l.maximum_width = MAX(l.maximum_width, MIN(p_width, wofs + m_width)); \
+ l.minimum_width = MAX(l.minimum_width, m_width); \
} \
if (wofs + m_width > p_width) { \
if (p_mode == PROCESS_CACHE) { \
@@ -247,6 +297,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
int rchar = 0;
int lh = 0;
bool line_is_blank = true;
+ int fh = 0;
while (it) {
@@ -262,21 +313,18 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
const CharType *c = text->text.c_str();
const CharType *cf = c;
- int fh = font->get_height();
int ascent = font->get_ascent();
int descent = font->get_descent();
- line_ascent = MAX(line_ascent, ascent);
- line_descent = MAX(line_descent, descent);
- fh = MAX(fh, line_ascent + line_descent); // various fonts!
-
Color color;
+ Color font_color_shadow;
bool underline = false;
if (p_mode == PROCESS_DRAW) {
color = _find_color(text, p_base_color);
+ font_color_shadow = _find_color(text, p_font_color_shadow);
underline = _find_underline(text);
- if (_find_meta(text, &meta)) {
+ if (_find_meta(text, &meta) && underline_meta) {
underline = true;
}
@@ -286,7 +334,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
}
rchar = 0;
-
+ FontDrawer drawer(font, Color(1, 1, 1));
while (*c) {
int end = 0;
@@ -299,7 +347,6 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
line_ascent = line < l.ascent_caches.size() ? l.ascent_caches[line] : 1;
line_descent = line < l.descent_caches.size() ? l.descent_caches[line] : 1;
}
-
while (c[end] != 0 && !(end && c[end - 1] == ' ' && c[end] != ' ')) {
int cw = font->get_char_size(c[end], c[end + 1]).width;
@@ -316,9 +363,13 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
end++;
}
-
+ CHECK_HEIGHT(fh);
ENSURE_WIDTH(w);
+ line_ascent = MAX(line_ascent, ascent);
+ line_descent = MAX(line_descent, descent);
+ fh = line_ascent + line_descent;
+
if (end && c[end - 1] == ' ') {
if (p_mode == PROCESS_CACHE) {
spaces_size += font->get_char_size(' ').width;
@@ -373,16 +424,30 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (c[i] == '\t')
visible = false;
- if (selected) {
+ if (visible) {
+ if (selected) {
+ cw = font->get_char_size(c[i], c[i + 1]).x;
+ draw_rect(Rect2(p_ofs.x + pofs, p_ofs.y + y, cw, lh), selection_bg);
+ }
- cw = font->get_char_size(c[i], c[i + 1]).x;
- draw_rect(Rect2(p_ofs.x + pofs, p_ofs.y + y, cw, lh), selection_bg);
- if (visible)
- font->draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), c[i], c[i + 1], override_selected_font_color ? selection_fg : color);
+ if (p_font_color_shadow.a > 0) {
+ float x_ofs_shadow = align_ofs + pofs;
+ float y_ofs_shadow = y + lh - line_descent;
+ float move = font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + shadow_ofs, c[i], c[i + 1], p_font_color_shadow);
+
+ if (p_shadow_as_outline) {
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + Vector2(-shadow_ofs.x, shadow_ofs.y), c[i], c[i + 1], p_font_color_shadow);
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + Vector2(shadow_ofs.x, -shadow_ofs.y), c[i], c[i + 1], p_font_color_shadow);
+ font->draw_char(ci, Point2(x_ofs_shadow, y_ofs_shadow) + Vector2(-shadow_ofs.x, -shadow_ofs.y), c[i], c[i + 1], p_font_color_shadow);
+ }
+ x_ofs_shadow += move;
+ }
- } else {
- if (visible)
- cw = font->draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), c[i], c[i + 1], color);
+ if (selected) {
+ drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), c[i], c[i + 1], override_selected_font_color ? selection_fg : color);
+ } else {
+ cw = drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent), c[i], c[i + 1], color);
+ }
}
p_char_count++;
@@ -461,6 +526,9 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
int vseparation = get_constant("table_vseparation");
Color ccolor = _find_color(table, p_base_color);
Vector2 draw_ofs = Point2(wofs, y);
+ Color font_color_shadow = get_color("font_color_shadow");
+ bool use_outline = get_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
if (p_mode == PROCESS_CACHE) {
@@ -468,6 +536,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
//set minimums to zero
for (int i = 0; i < table->columns.size(); i++) {
table->columns[i].min_width = 0;
+ table->columns[i].max_width = 0;
table->columns[i].width = 0;
}
//compute minimum width for each cell
@@ -483,8 +552,9 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
for (int i = 0; i < frame->lines.size(); i++) {
- _process_line(frame, Point2(), ly, available_width, i, PROCESS_CACHE, cfont, Color());
+ _process_line(frame, Point2(), ly, available_width, i, PROCESS_CACHE, cfont, Color(), font_color_shadow, use_outline, shadow_ofs);
table->columns[column].min_width = MAX(table->columns[column].min_width, frame->lines[i].minimum_width);
+ table->columns[column].max_width = MAX(table->columns[column].max_width, frame->lines[i].maximum_width);
}
idx++;
}
@@ -497,12 +567,13 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
for (int i = 0; i < table->columns.size(); i++) {
remaining_width -= table->columns[i].min_width;
+ if (table->columns[i].max_width > table->columns[i].min_width)
+ table->columns[i].expand = true;
if (table->columns[i].expand)
total_ratio += table->columns[i].expand_ratio;
}
//assign actual widths
-
for (int i = 0; i < table->columns.size(); i++) {
table->columns[i].width = table->columns[i].min_width;
if (table->columns[i].expand)
@@ -510,6 +581,39 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
table->total_width += table->columns[i].width + hseparation;
}
+ //resize to max_width if needed and distribute the remaining space
+ bool table_need_fit = true;
+ while (table_need_fit) {
+ table_need_fit = false;
+ //fit slim
+ for (int i = 0; i < table->columns.size(); i++) {
+ if (!table->columns[i].expand)
+ continue;
+ int dif = table->columns[i].width - table->columns[i].max_width;
+ if (dif > 0) {
+ table_need_fit = true;
+ table->columns[i].width = table->columns[i].max_width;
+ table->total_width -= dif;
+ total_ratio -= table->columns[i].expand_ratio;
+ }
+ }
+ //grow
+ remaining_width = available_width - table->total_width;
+ if (remaining_width > 0 && total_ratio > 0) {
+ for (int i = 0; i < table->columns.size(); i++) {
+ if (table->columns[i].expand) {
+ int dif = table->columns[i].max_width - table->columns[i].width;
+ if (dif > 0) {
+ int slice = table->columns[i].expand_ratio * remaining_width / total_ratio;
+ int incr = MIN(dif, slice);
+ table->columns[i].width += incr;
+ table->total_width += incr;
+ }
+ }
+ }
+ }
+ }
+
//compute caches properly again with the right width
idx = 0;
for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) {
@@ -521,7 +625,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
for (int i = 0; i < frame->lines.size(); i++) {
int ly = 0;
- _process_line(frame, Point2(), ly, table->columns[column].width, i, PROCESS_CACHE, cfont, Color());
+ _process_line(frame, Point2(), ly, table->columns[column].width, i, PROCESS_CACHE, cfont, Color(), font_color_shadow, use_outline, shadow_ofs);
frame->lines[i].height_cache = ly; //actual height
frame->lines[i].height_accum_cache = ly; //actual height
}
@@ -554,9 +658,9 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
if (visible) {
if (p_mode == PROCESS_DRAW) {
- nonblank_line_count += _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_DRAW, cfont, ccolor);
+ nonblank_line_count += _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_DRAW, cfont, ccolor, font_color_shadow, use_outline, shadow_ofs);
} else if (p_mode == PROCESS_POINTER) {
- _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_POINTER, cfont, ccolor, p_click_pos, r_click_item, r_click_char, r_outside);
+ _process_line(frame, p_ofs + offset + draw_ofs + Vector2(0, yofs), ly, table->columns[column].width, i, PROCESS_POINTER, cfont, ccolor, font_color_shadow, use_outline, shadow_ofs, p_click_pos, r_click_item, r_click_char, r_outside);
if (r_click_item && *r_click_item) {
RETURN; // exit early
}
@@ -637,9 +741,7 @@ void RichTextLabel::_scroll_changed(double) {
void RichTextLabel::_update_scroll() {
- int total_height = 0;
- if (main->lines.size())
- total_height = main->lines[main->lines.size() - 1].height_accum_cache + get_stylebox("normal")->get_minimum_size().height;
+ int total_height = get_content_height();
bool exceeds = total_height > get_size().height && scroll_active;
@@ -728,12 +830,18 @@ void RichTextLabel::_notification(int p_what) {
int y = (main->lines[from_line].height_accum_cache - main->lines[from_line].height_cache) - ofs;
Ref<Font> base_font = get_font("normal_font");
Color base_color = get_color("default_color");
+ Color font_color_shadow = get_color("font_color_shadow");
+ bool use_outline = get_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
+
+ float x_ofs = 0;
visible_line_count = 0;
while (y < size.height && from_line < main->lines.size()) {
- visible_line_count += _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, Point2i(), NULL, NULL, NULL, total_chars);
+ visible_line_count += _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, font_color_shadow, use_outline, shadow_ofs, Point2i(), NULL, NULL, NULL, total_chars);
total_chars += main->lines[from_line].char_count;
+
from_line++;
}
}
@@ -748,6 +856,9 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
int ofs = vscroll->get_value();
+ Color font_color_shadow = get_color("font_color_shadow");
+ bool use_outline = get_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
//todo, change to binary search
int from_line = 0;
@@ -768,7 +879,7 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
while (y < text_rect.get_size().height && from_line < p_frame->lines.size()) {
- _process_line(p_frame, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_POINTER, base_font, base_color, p_click, r_click_item, r_click_char, r_outside);
+ _process_line(p_frame, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_POINTER, base_font, base_color, font_color_shadow, use_outline, shadow_ofs, p_click, r_click_item, r_click_char, r_outside);
if (r_click_item && *r_click_item)
return;
from_line++;
@@ -828,9 +939,9 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
// Erase previous selection.
if (selection.active) {
selection.from = NULL;
- selection.from_char = NULL;
+ selection.from_char = '\0';
selection.to = NULL;
- selection.to_char = NULL;
+ selection.to_char = '\0';
selection.active = false;
update();
@@ -1143,13 +1254,16 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) {
//validate invalid lines
Size2 size = get_size();
Rect2 text_rect = _get_text_rect();
+ Color font_color_shadow = get_color("font_color_shadow");
+ bool use_outline = get_constant("shadow_as_outline");
+ Point2 shadow_ofs(get_constant("shadow_offset_x"), get_constant("shadow_offset_y"));
Ref<Font> base_font = get_font("normal_font");
for (int i = p_frame->first_invalid_line; i < p_frame->lines.size(); i++) {
int y = 0;
- _process_line(p_frame, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, i, PROCESS_CACHE, base_font, Color());
+ _process_line(p_frame, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, i, PROCESS_CACHE, base_font, Color(), font_color_shadow, use_outline, shadow_ofs);
p_frame->lines[i].height_cache = y;
p_frame->lines[i].height_accum_cache = y;
@@ -1632,7 +1746,7 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
tag_stack.push_front(tag);
} else if (tag.begins_with("cell=")) {
- int ratio = tag.substr(6, tag.length()).to_int();
+ int ratio = tag.substr(5, tag.length()).to_int();
if (ratio < 1)
ratio = 1;
//use monospace font
@@ -1823,7 +1937,7 @@ void RichTextLabel::set_selection_enabled(bool p_enabled) {
}
}
-bool RichTextLabel::search(const String &p_string, bool p_from_selection) {
+bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p_search_previous) {
ERR_FAIL_COND_V(!selection.enabled, false);
Item *it = main;
@@ -1872,7 +1986,10 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection) {
}
}
- it = _get_next_item(it, true);
+ if (p_search_previous)
+ it = _get_prev_item(it, true);
+ else
+ it = _get_next_item(it, true);
charidx = 0;
}
@@ -1991,6 +2108,13 @@ float RichTextLabel::get_percent_visible() const {
return percent_visible;
}
+int RichTextLabel::get_content_height() {
+ int total_height = 0;
+ if (main->lines.size())
+ total_height = main->lines[main->lines.size() - 1].height_accum_cache + get_stylebox("normal")->get_minimum_size().height;
+ return total_height;
+}
+
void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &RichTextLabel::_gui_input);
@@ -2057,6 +2181,8 @@ void RichTextLabel::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_line_count"), &RichTextLabel::get_line_count);
ClassDB::bind_method(D_METHOD("get_visible_line_count"), &RichTextLabel::get_visible_line_count);
+ ClassDB::bind_method(D_METHOD("get_content_height"), &RichTextLabel::get_content_height);
+
ADD_GROUP("BBCode", "bbcode_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bbcode_text", PROPERTY_HINT_MULTILINE_TEXT), "set_bbcode", "get_bbcode");
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index e7d5e6bb1b..af368af46a 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -87,6 +87,7 @@ private:
int height_accum_cache;
int char_count;
int minimum_width;
+ int maximum_width;
Line() {
from = NULL;
@@ -189,7 +190,6 @@ private:
struct ItemNewline : public Item {
- int line; // FIXME: Overriding base's line ?
ItemNewline() { type = ITEM_NEWLINE; }
};
@@ -199,6 +199,7 @@ private:
bool expand;
int expand_ratio;
int min_width;
+ int max_width;
int width;
};
@@ -268,7 +269,7 @@ private:
int visible_characters;
float percent_visible;
- int _process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Point2i &p_click_pos = Point2i(), Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL, int p_char_count = 0);
+ int _process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &y, int p_width, int p_line, ProcessMode p_mode, const Ref<Font> &p_base_font, const Color &p_base_color, const Color &p_font_color_shadow, bool p_shadow_as_outline, const Point2 &shadow_ofs, const Point2i &p_click_pos = Point2i(), Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL, int p_char_count = 0);
void _find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item = NULL, int *r_click_char = NULL, bool *r_outside = NULL);
Ref<Font> _find_font(Item *p_item);
@@ -283,6 +284,7 @@ private:
void _gui_input(Ref<InputEvent> p_event);
Item *_get_next_item(Item *p_item, bool p_free = false);
+ Item *_get_prev_item(Item *p_item, bool p_free = false);
Rect2 _get_text_rect();
@@ -332,12 +334,14 @@ public:
void set_tab_size(int p_spaces);
int get_tab_size() const;
- bool search(const String &p_string, bool p_from_selection = false);
+ bool search(const String &p_string, bool p_from_selection = false, bool p_search_previous = false);
void scroll_to_line(int p_line);
int get_line_count() const;
int get_visible_line_count() const;
+ int get_content_height();
+
VScrollBar *get_v_scroll() { return vscroll; }
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const;
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 95fcda2db3..6ec67aca6b 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -114,7 +114,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (smooth_scroll_enabled) {
scrolling = true;
- set_physics_process(true);
+ set_physics_process_internal(true);
} else {
set_value(target_scroll);
}
@@ -138,7 +138,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (smooth_scroll_enabled) {
scrolling = true;
- set_physics_process(true);
+ set_physics_process_internal(true);
} else {
set_value(target_scroll);
}
@@ -199,54 +199,40 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
}
}
- Ref<InputEventKey> k = p_event;
+ if (p_event->is_pressed()) {
- if (k.is_valid()) {
+ if (p_event->is_action("ui_left")) {
- if (!k->is_pressed())
- return;
-
- switch (k->get_scancode()) {
-
- case KEY_LEFT: {
-
- if (orientation != HORIZONTAL)
- return;
- set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
+ if (orientation != HORIZONTAL)
+ return;
+ set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
- } break;
- case KEY_RIGHT: {
+ } else if (p_event->is_action("ui_right")) {
- if (orientation != HORIZONTAL)
- return;
- set_value(get_value() + (custom_step >= 0 ? custom_step : get_step()));
-
- } break;
- case KEY_UP: {
+ if (orientation != HORIZONTAL)
+ return;
+ set_value(get_value() + (custom_step >= 0 ? custom_step : get_step()));
- if (orientation != VERTICAL)
- return;
+ } else if (p_event->is_action("ui_up")) {
- set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
+ if (orientation != VERTICAL)
+ return;
- } break;
- case KEY_DOWN: {
+ set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
- if (orientation != VERTICAL)
- return;
- set_value(get_value() + (custom_step >= 0 ? custom_step : get_step()));
+ } else if (p_event->is_action("ui_down")) {
- } break;
- case KEY_HOME: {
+ if (orientation != VERTICAL)
+ return;
+ set_value(get_value() + (custom_step >= 0 ? custom_step : get_step()));
- set_value(get_min());
+ } else if (p_event->is_action("ui_home")) {
- } break;
- case KEY_END: {
+ set_value(get_min());
- set_value(get_max());
+ } else if (p_event->is_action("ui_end")) {
- } break;
+ set_value(get_max());
}
}
}
@@ -336,7 +322,7 @@ void ScrollBar::_notification(int p_what) {
drag_slave = NULL;
}
- if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
+ if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
if (scrolling) {
if (get_value() != target_scroll) {
@@ -351,7 +337,7 @@ void ScrollBar::_notification(int p_what) {
}
} else {
scrolling = false;
- set_physics_process(false);
+ set_physics_process_internal(false);
}
} else if (drag_slave_touching) {
@@ -411,7 +397,7 @@ void ScrollBar::_notification(int p_what) {
}
if (turnoff) {
- set_physics_process(false);
+ set_physics_process_internal(false);
drag_slave_touching = false;
drag_slave_touching_deaccel = false;
}
@@ -580,7 +566,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
if (mb->is_pressed()) {
if (drag_slave_touching) {
- set_physics_process(false);
+ set_physics_process_internal(false);
drag_slave_touching_deaccel = false;
drag_slave_touching = false;
drag_slave_speed = Vector2();
@@ -600,7 +586,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
drag_slave_touching_deaccel = false;
time_since_motion = 0;
if (drag_slave_touching) {
- set_physics_process(true);
+ set_physics_process_internal(true);
time_since_motion = 0;
}
}
@@ -612,7 +598,7 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
if (drag_slave_speed == Vector2()) {
drag_slave_touching_deaccel = false;
drag_slave_touching = false;
- set_physics_process(false);
+ set_physics_process_internal(false);
} else {
drag_slave_touching_deaccel = true;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index 33b3d46486..495d618930 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -37,6 +37,7 @@ bool ScrollContainer::clips_input() const {
Size2 ScrollContainer::get_minimum_size() const {
+ Ref<StyleBox> sb = get_stylebox("bg");
Size2 min_size;
for (int i = 0; i < get_child_count(); i++) {
@@ -64,17 +65,24 @@ Size2 ScrollContainer::get_minimum_size() const {
if (v_scroll->is_visible_in_tree()) {
min_size.x += v_scroll->get_minimum_size().x;
}
+ min_size += sb->get_minimum_size();
return min_size;
-};
+}
void ScrollContainer::_cancel_drag() {
- set_physics_process(false);
+ set_physics_process_internal(false);
drag_touching_deaccel = false;
drag_touching = false;
drag_speed = Vector2();
drag_accum = Vector2();
last_drag_accum = Vector2();
drag_from = Vector2();
+
+ if (beyond_deadzone) {
+ emit_signal("scroll_ended");
+ propagate_notification(NOTIFICATION_SCROLL_END);
+ beyond_deadzone = false;
+ }
}
void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
@@ -122,13 +130,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->is_pressed()) {
if (drag_touching) {
- set_physics_process(false);
- drag_touching_deaccel = false;
- drag_touching = false;
- drag_speed = Vector2();
- drag_accum = Vector2();
- last_drag_accum = Vector2();
- drag_from = Vector2();
+ _cancel_drag();
}
if (true) {
@@ -138,9 +140,10 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
drag_from = Vector2(h_scroll->get_value(), v_scroll->get_value());
drag_touching = OS::get_singleton()->has_touchscreen_ui_hint();
drag_touching_deaccel = false;
+ beyond_deadzone = false;
time_since_motion = 0;
if (drag_touching) {
- set_physics_process(true);
+ set_physics_process_internal(true);
time_since_motion = 0;
}
}
@@ -149,9 +152,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (drag_touching) {
if (drag_speed == Vector2()) {
- drag_touching_deaccel = false;
- drag_touching = false;
- set_physics_process(false);
+ _cancel_drag();
} else {
drag_touching_deaccel = true;
@@ -168,17 +169,27 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
Vector2 motion = Vector2(mm->get_relative().x, mm->get_relative().y);
drag_accum -= motion;
- Vector2 diff = drag_from + drag_accum;
-
- if (scroll_h)
- h_scroll->set_value(diff.x);
- else
- drag_accum.x = 0;
- if (scroll_v)
- v_scroll->set_value(diff.y);
- else
- drag_accum.y = 0;
- time_since_motion = 0;
+
+ if (beyond_deadzone || scroll_h && Math::abs(drag_accum.x) > deadzone || scroll_v && Math::abs(drag_accum.y) > deadzone) {
+ if (!beyond_deadzone) {
+ propagate_notification(NOTIFICATION_SCROLL_BEGIN);
+ emit_signal("scroll_started");
+
+ beyond_deadzone = true;
+ // resetting drag_accum here ensures smooth scrolling after reaching deadzone
+ drag_accum = -motion;
+ }
+ Vector2 diff = drag_from + drag_accum;
+ if (scroll_h)
+ h_scroll->set_value(diff.x);
+ else
+ drag_accum.x = 0;
+ if (scroll_v)
+ v_scroll->set_value(diff.y);
+ else
+ drag_accum.y = 0;
+ time_since_motion = 0;
+ }
}
}
@@ -224,10 +235,16 @@ void ScrollContainer::_notification(int p_what) {
child_max_size = Size2(0, 0);
Size2 size = get_size();
- if (h_scroll->is_visible_in_tree())
+ Point2 ofs;
+
+ Ref<StyleBox> sb = get_stylebox("bg");
+ size -= sb->get_minimum_size();
+ ofs += sb->get_offset();
+
+ if (h_scroll->is_visible_in_tree() && h_scroll->get_parent() == this) //scrolls may have been moved out for reasons
size.y -= h_scroll->get_minimum_size().y;
- if (v_scroll->is_visible_in_tree())
+ if (v_scroll->is_visible_in_tree() && v_scroll->get_parent() == this) //scrolls may have been moved out for reasons
size.x -= h_scroll->get_minimum_size().x;
for (int i = 0; i < get_child_count(); i++) {
@@ -259,6 +276,7 @@ void ScrollContainer::_notification(int p_what) {
else
r.size.height = minsize.height;
}
+ r.position += ofs;
fit_child_in_rect(c, r);
}
update();
@@ -266,10 +284,13 @@ void ScrollContainer::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
+ Ref<StyleBox> sb = get_stylebox("bg");
+ draw_style_box(sb, Rect2(Vector2(), get_size()));
+
update_scrollbars();
}
- if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
+ if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
if (drag_touching) {
@@ -323,9 +344,7 @@ void ScrollContainer::_notification(int p_what) {
drag_speed = Vector2(sgn_x * val_x, sgn_y * val_y);
if (turnoff_h && turnoff_v) {
- set_physics_process(false);
- drag_touching = false;
- drag_touching_deaccel = false;
+ _cancel_drag();
}
} else {
@@ -346,6 +365,8 @@ void ScrollContainer::_notification(int p_what) {
void ScrollContainer::update_scrollbars() {
Size2 size = get_size();
+ Ref<StyleBox> sb = get_stylebox("bg");
+ size -= sb->get_minimum_size();
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
@@ -430,6 +451,14 @@ void ScrollContainer::set_h_scroll(int p_pos) {
_cancel_drag();
}
+int ScrollContainer::get_deadzone() const {
+ return deadzone;
+}
+
+void ScrollContainer::set_deadzone(int p_deadzone) {
+ deadzone = p_deadzone;
+}
+
String ScrollContainer::get_configuration_warning() const {
int found = 0;
@@ -453,6 +482,16 @@ String ScrollContainer::get_configuration_warning() const {
return "";
}
+HScrollBar *ScrollContainer::get_h_scrollbar() {
+
+ return h_scroll;
+}
+
+VScrollBar *ScrollContainer::get_v_scrollbar() {
+
+ return v_scroll;
+}
+
void ScrollContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("_scroll_moved"), &ScrollContainer::_scroll_moved);
@@ -466,12 +505,23 @@ void ScrollContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_h_scroll"), &ScrollContainer::get_h_scroll);
ClassDB::bind_method(D_METHOD("set_v_scroll", "value"), &ScrollContainer::set_v_scroll);
ClassDB::bind_method(D_METHOD("get_v_scroll"), &ScrollContainer::get_v_scroll);
+ ClassDB::bind_method(D_METHOD("set_deadzone", "deadzone"), &ScrollContainer::set_deadzone);
+ ClassDB::bind_method(D_METHOD("get_deadzone"), &ScrollContainer::get_deadzone);
+
+ ClassDB::bind_method(D_METHOD("get_h_scrollbar"), &ScrollContainer::get_h_scrollbar);
+ ClassDB::bind_method(D_METHOD("get_v_scrollbar"), &ScrollContainer::get_v_scrollbar);
+
+ ADD_SIGNAL(MethodInfo("scroll_started"));
+ ADD_SIGNAL(MethodInfo("scroll_ended"));
ADD_GROUP("Scroll", "scroll_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_horizontal_enabled"), "set_enable_h_scroll", "is_h_scroll_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "scroll_horizontal"), "set_h_scroll", "get_h_scroll");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_vertical_enabled"), "set_enable_v_scroll", "is_v_scroll_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "scroll_vertical"), "set_v_scroll", "get_v_scroll");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "scroll_deadzone"), "set_deadzone", "get_deadzone");
+
+ GLOBAL_DEF("gui/common/default_scroll_deadzone", 0);
};
ScrollContainer::ScrollContainer() {
@@ -490,8 +540,11 @@ ScrollContainer::ScrollContainer() {
drag_speed = Vector2();
drag_touching = false;
drag_touching_deaccel = false;
+ beyond_deadzone = false;
scroll_h = true;
scroll_v = true;
+ deadzone = GLOBAL_GET("gui/common/default_scroll_deadzone");
+
set_clip_contents(true);
};
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 6e3387918b..abef80294a 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -56,10 +56,13 @@ class ScrollContainer : public Container {
bool drag_touching;
bool drag_touching_deaccel;
bool click_handled;
+ bool beyond_deadzone;
bool scroll_h;
bool scroll_v;
+ int deadzone;
+
void _cancel_drag();
protected:
@@ -86,6 +89,12 @@ public:
void set_enable_v_scroll(bool p_enable);
bool is_v_scroll_enabled() const;
+ int get_deadzone() const;
+ void set_deadzone(int p_deadzone);
+
+ HScrollBar *get_h_scrollbar();
+ VScrollBar *get_v_scrollbar();
+
virtual bool clips_input() const;
virtual String get_configuration_warning() const;
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index a7a1b499c3..46215c9277 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -118,28 +118,14 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
return;
set_value(get_value() - (custom_step >= 0 ? custom_step : get_step()));
accept_event();
+ } else if (p_event->is_action("ui_home") && p_event->is_pressed()) {
- } else {
-
- Ref<InputEventKey> k = p_event;
-
- if (!k.is_valid() || !k->is_pressed())
- return;
-
- switch (k->get_scancode()) {
-
- case KEY_HOME: {
-
- set_value(get_min());
- accept_event();
- } break;
- case KEY_END: {
-
- set_value(get_max());
- accept_event();
+ set_value(get_min());
+ accept_event();
+ } else if (p_event->is_action("ui_end") && p_event->is_pressed()) {
- } break;
- }
+ set_value(get_max());
+ accept_event();
}
}
}
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index bf7033e8ba..c38c411333 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -33,13 +33,6 @@
#include "label.h"
#include "margin_container.h"
-struct _MinSizeCache {
-
- int min_size;
- bool will_stretch;
- int final_size;
-};
-
Control *SplitContainer::_getch(int p_idx) const {
int idx = 0;
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 6e85ce5eb4..4f72b5c6ed 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -31,6 +31,9 @@
#include "tab_container.h"
#include "message_queue.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/label.h"
+#include "scene/gui/texture_rect.h"
int TabContainer::_get_top_margin() const {
@@ -140,6 +143,42 @@ void TabContainer::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_RESIZED: {
+
+ Vector<Control *> tabs = _get_tabs();
+ int side_margin = get_constant("side_margin");
+ Ref<Texture> menu = get_icon("menu");
+ Ref<Texture> increment = get_icon("increment");
+ Ref<Texture> decrement = get_icon("decrement");
+ int header_width = get_size().width - side_margin * 2;
+
+ // Find the width of the header area.
+ if (popup)
+ header_width -= menu->get_width();
+ if (buttons_visible_cache)
+ header_width -= increment->get_width() + decrement->get_width();
+ if (popup || buttons_visible_cache)
+ header_width += side_margin;
+
+ // Find the width of all tabs after first_tab_cache.
+ int all_tabs_width = 0;
+ for (int i = first_tab_cache; i < tabs.size(); i++) {
+ int tab_width = _get_tab_width(i);
+ all_tabs_width += tab_width;
+ }
+
+ // Check if tabs before first_tab_cache would fit into the header area.
+ for (int i = first_tab_cache - 1; i >= 0; i--) {
+ int tab_width = _get_tab_width(i);
+
+ if (all_tabs_width + tab_width > header_width)
+ break;
+
+ all_tabs_width += tab_width;
+ first_tab_cache--;
+ }
+ } break;
+
case NOTIFICATION_DRAW: {
RID canvas = get_canvas_item();
@@ -194,6 +233,10 @@ void TabContainer::_notification(int p_what) {
header_width += side_margin;
}
+ if (!buttons_visible_cache) {
+ first_tab_cache = 0;
+ }
+
// Go through the visible tabs to find the width they occupy.
all_tabs_width = 0;
Vector<int> tab_widths;
@@ -492,6 +535,141 @@ void TabContainer::_update_current_tab() {
set_current_tab(current);
}
+Variant TabContainer::get_drag_data(const Point2 &p_point) {
+
+ if (!drag_to_rearrange_enabled)
+ return Variant();
+
+ int tab_over = get_tab_idx_at_point(p_point);
+
+ if (tab_over < 0)
+ return Variant();
+
+ HBoxContainer *drag_preview = memnew(HBoxContainer);
+
+ Ref<Texture> icon = get_tab_icon(tab_over);
+ if (!icon.is_null()) {
+ TextureRect *tf = memnew(TextureRect);
+ tf->set_texture(icon);
+ drag_preview->add_child(tf);
+ }
+ Label *label = memnew(Label(get_tab_title(tab_over)));
+ drag_preview->add_child(label);
+ set_drag_preview(drag_preview);
+
+ Dictionary drag_data;
+ drag_data["type"] = "tabc_element";
+ drag_data["tabc_element"] = tab_over;
+ drag_data["from_path"] = get_path();
+ return drag_data;
+}
+
+bool TabContainer::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
+
+ if (!drag_to_rearrange_enabled)
+ return false;
+
+ Dictionary d = p_data;
+ if (!d.has("type"))
+ return false;
+
+ if (String(d["type"]) == "tabc_element") {
+
+ NodePath from_path = d["from_path"];
+ NodePath to_path = get_path();
+ if (from_path == to_path) {
+ return true;
+ } else if (get_tabs_rearrange_group() != -1) {
+ // drag and drop between other TabContainers
+ Node *from_node = get_node(from_path);
+ TabContainer *from_tabc = Object::cast_to<TabContainer>(from_node);
+ if (from_tabc && from_tabc->get_tabs_rearrange_group() == get_tabs_rearrange_group()) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void TabContainer::drop_data(const Point2 &p_point, const Variant &p_data) {
+
+ if (!drag_to_rearrange_enabled)
+ return;
+
+ int hover_now = get_tab_idx_at_point(p_point);
+
+ Dictionary d = p_data;
+ if (!d.has("type"))
+ return;
+
+ if (String(d["type"]) == "tabc_element") {
+
+ int tab_from_id = d["tabc_element"];
+ NodePath from_path = d["from_path"];
+ NodePath to_path = get_path();
+ if (from_path == to_path) {
+ if (hover_now < 0)
+ hover_now = get_tab_count() - 1;
+ move_child(get_tab_control(tab_from_id), hover_now);
+ set_current_tab(hover_now);
+ } else if (get_tabs_rearrange_group() != -1) {
+ // drag and drop between TabContainers
+ Node *from_node = get_node(from_path);
+ TabContainer *from_tabc = Object::cast_to<TabContainer>(from_node);
+ if (from_tabc && from_tabc->get_tabs_rearrange_group() == get_tabs_rearrange_group()) {
+ Control *moving_tabc = from_tabc->get_tab_control(tab_from_id);
+ from_tabc->remove_child(moving_tabc);
+ add_child(moving_tabc);
+ if (hover_now < 0)
+ hover_now = get_tab_count() - 1;
+ move_child(moving_tabc, hover_now);
+ set_current_tab(hover_now);
+ emit_signal("tab_changed", hover_now);
+ }
+ }
+ }
+ update();
+}
+
+int TabContainer::get_tab_idx_at_point(const Point2 &p_point) const {
+
+ if (get_tab_count() == 0)
+ return -1;
+
+ // must be on tabs in the tab header area.
+ if (p_point.x < tabs_ofs_cache || p_point.y > _get_top_margin())
+ return -1;
+
+ Size2 size = get_size();
+ int right_ofs = 0;
+
+ if (popup) {
+ Ref<Texture> menu = get_icon("menu");
+ right_ofs += menu->get_width();
+ }
+ if (buttons_visible_cache) {
+ Ref<Texture> increment = get_icon("increment");
+ Ref<Texture> decrement = get_icon("decrement");
+ right_ofs += increment->get_width() + decrement->get_width();
+ }
+ if (p_point.x > size.width - right_ofs) {
+ return -1;
+ }
+
+ // get the tab at the point
+ Vector<Control *> tabs = _get_tabs();
+ int px = p_point.x;
+ px -= tabs_ofs_cache;
+ for (int i = first_tab_cache; i <= last_tab_cache; i++) {
+ int tab_width = _get_tab_width(i);
+ if (px < tab_width) {
+ return i;
+ }
+ px -= tab_width;
+ }
+ return -1;
+}
+
void TabContainer::set_tab_align(TabAlign p_align) {
ERR_FAIL_INDEX(p_align, 3);
@@ -500,6 +678,7 @@ void TabContainer::set_tab_align(TabAlign p_align) {
_change_notify("tab_align");
}
+
TabContainer::TabAlign TabContainer::get_tab_align() const {
return align;
@@ -643,6 +822,21 @@ Popup *TabContainer::get_popup() const {
return popup;
}
+void TabContainer::set_drag_to_rearrange_enabled(bool p_enabled) {
+ drag_to_rearrange_enabled = p_enabled;
+}
+
+bool TabContainer::get_drag_to_rearrange_enabled() const {
+ return drag_to_rearrange_enabled;
+}
+void TabContainer::set_tabs_rearrange_group(int p_group_id) {
+ tabs_rearrange_group = p_group_id;
+}
+
+int TabContainer::get_tabs_rearrange_group() const {
+ return tabs_rearrange_group;
+}
+
void TabContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &TabContainer::_gui_input);
@@ -664,6 +858,10 @@ void TabContainer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &TabContainer::get_tab_disabled);
ClassDB::bind_method(D_METHOD("set_popup", "popup"), &TabContainer::set_popup);
ClassDB::bind_method(D_METHOD("get_popup"), &TabContainer::get_popup);
+ ClassDB::bind_method(D_METHOD("set_drag_to_rearrange_enabled", "enabled"), &TabContainer::set_drag_to_rearrange_enabled);
+ ClassDB::bind_method(D_METHOD("get_drag_to_rearrange_enabled"), &TabContainer::get_drag_to_rearrange_enabled);
+ ClassDB::bind_method(D_METHOD("set_tabs_rearrange_group", "group_id"), &TabContainer::set_tabs_rearrange_group);
+ ClassDB::bind_method(D_METHOD("get_tabs_rearrange_group"), &TabContainer::get_tabs_rearrange_group);
ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
ClassDB::bind_method(D_METHOD("_on_theme_changed"), &TabContainer::_on_theme_changed);
@@ -676,6 +874,7 @@ void TabContainer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled");
BIND_ENUM_CONSTANT(ALIGN_LEFT);
BIND_ENUM_CONSTANT(ALIGN_CENTER);
@@ -694,4 +893,6 @@ TabContainer::TabContainer() {
align = ALIGN_CENTER;
tabs_visible = true;
popup = NULL;
+ drag_to_rearrange_enabled = false;
+ tabs_rearrange_group = -1;
}
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 4bc6e00145..1afe5f7541 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -58,6 +58,8 @@ private:
Control *_get_tab(int p_idx) const;
int _get_top_margin() const;
Popup *popup;
+ bool drag_to_rearrange_enabled;
+ int tabs_rearrange_group;
Vector<Control *> _get_tabs() const;
int _get_tab_width(int p_index) const;
@@ -71,6 +73,11 @@ protected:
virtual void add_child_notify(Node *p_child);
virtual void remove_child_notify(Node *p_child);
+ Variant get_drag_data(const Point2 &p_point);
+ bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
+ void drop_data(const Point2 &p_point, const Variant &p_data);
+ int get_tab_idx_at_point(const Point2 &p_point) const;
+
static void _bind_methods();
public:
@@ -104,6 +111,11 @@ public:
void set_popup(Node *p_popup);
Popup *get_popup() const;
+ void set_drag_to_rearrange_enabled(bool p_enabled);
+ bool get_drag_to_rearrange_enabled() const;
+ void set_tabs_rearrange_group(int p_group_id);
+ int get_tabs_rearrange_group() const;
+
TabContainer();
};
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index f0e89877cd..b114264de1 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -31,6 +31,9 @@
#include "tabs.h"
#include "message_queue.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/label.h"
+#include "scene/gui/texture_rect.h"
Size2 Tabs::get_minimum_size() const {
@@ -624,20 +627,105 @@ void Tabs::remove_tab(int p_idx) {
Variant Tabs::get_drag_data(const Point2 &p_point) {
- return get_tab_idx_at_point(p_point);
+ if (!drag_to_rearrange_enabled)
+ return Variant();
+
+ int tab_over = get_tab_idx_at_point(p_point);
+
+ if (tab_over < 0)
+ return Variant();
+
+ HBoxContainer *drag_preview = memnew(HBoxContainer);
+
+ if (!tabs[tab_over].icon.is_null()) {
+ TextureRect *tf = memnew(TextureRect);
+ tf->set_texture(tabs[tab_over].icon);
+ drag_preview->add_child(tf);
+ }
+ Label *label = memnew(Label(tabs[tab_over].text));
+ drag_preview->add_child(label);
+ if (!tabs[tab_over].right_button.is_null()) {
+ TextureRect *tf = memnew(TextureRect);
+ tf->set_texture(tabs[tab_over].right_button);
+ drag_preview->add_child(tf);
+ }
+ set_drag_preview(drag_preview);
+
+ Dictionary drag_data;
+ drag_data["type"] = "tab_element";
+ drag_data["tab_element"] = tab_over;
+ drag_data["from_path"] = get_path();
+ return drag_data;
}
bool Tabs::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
- return get_tab_idx_at_point(p_point) > -1;
+ if (!drag_to_rearrange_enabled)
+ return false;
+
+ Dictionary d = p_data;
+ if (!d.has("type"))
+ return false;
+
+ if (String(d["type"]) == "tab_element") {
+
+ NodePath from_path = d["from_path"];
+ NodePath to_path = get_path();
+ if (from_path == to_path) {
+ return true;
+ } else if (get_tabs_rearrange_group() != -1) {
+ // drag and drop between other Tabs
+ Node *from_node = get_node(from_path);
+ Tabs *from_tabs = Object::cast_to<Tabs>(from_node);
+ if (from_tabs && from_tabs->get_tabs_rearrange_group() == get_tabs_rearrange_group()) {
+ return true;
+ }
+ }
+ }
+ return false;
}
void Tabs::drop_data(const Point2 &p_point, const Variant &p_data) {
+ if (!drag_to_rearrange_enabled)
+ return;
+
int hover_now = get_tab_idx_at_point(p_point);
- ERR_FAIL_INDEX(hover_now, tabs.size());
- emit_signal("reposition_active_tab_request", hover_now);
+ Dictionary d = p_data;
+ if (!d.has("type"))
+ return;
+
+ if (String(d["type"]) == "tab_element") {
+
+ int tab_from_id = d["tab_element"];
+ NodePath from_path = d["from_path"];
+ NodePath to_path = get_path();
+ if (from_path == to_path) {
+ if (hover_now < 0)
+ hover_now = get_tab_count() - 1;
+ move_tab(tab_from_id, hover_now);
+ emit_signal("reposition_active_tab_request", hover_now);
+ set_current_tab(hover_now);
+ } else if (get_tabs_rearrange_group() != -1) {
+ // drag and drop between Tabs
+ Node *from_node = get_node(from_path);
+ Tabs *from_tabs = Object::cast_to<Tabs>(from_node);
+ if (from_tabs && from_tabs->get_tabs_rearrange_group() == get_tabs_rearrange_group()) {
+ if (tab_from_id >= from_tabs->get_tab_count())
+ return;
+ Tab moving_tab = from_tabs->tabs[tab_from_id];
+ if (hover_now < 0)
+ hover_now = get_tab_count();
+ tabs.insert(hover_now, moving_tab);
+ from_tabs->remove_tab(tab_from_id);
+ set_current_tab(hover_now);
+ emit_signal("tab_changed", hover_now);
+ _update_cache();
+ }
+ }
+ }
+ update();
}
int Tabs::get_tab_idx_at_point(const Point2 &p_point) const {
@@ -817,6 +905,21 @@ bool Tabs::get_scrolling_enabled() const {
return scrolling_enabled;
}
+void Tabs::set_drag_to_rearrange_enabled(bool p_enabled) {
+ drag_to_rearrange_enabled = p_enabled;
+}
+
+bool Tabs::get_drag_to_rearrange_enabled() const {
+ return drag_to_rearrange_enabled;
+}
+void Tabs::set_tabs_rearrange_group(int p_group_id) {
+ tabs_rearrange_group = p_group_id;
+}
+
+int Tabs::get_tabs_rearrange_group() const {
+ return tabs_rearrange_group;
+}
+
void Tabs::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &Tabs::_gui_input);
@@ -842,6 +945,10 @@ void Tabs::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tab_close_display_policy"), &Tabs::get_tab_close_display_policy);
ClassDB::bind_method(D_METHOD("set_scrolling_enabled", "enabled"), &Tabs::set_scrolling_enabled);
ClassDB::bind_method(D_METHOD("get_scrolling_enabled"), &Tabs::get_scrolling_enabled);
+ ClassDB::bind_method(D_METHOD("set_drag_to_rearrange_enabled", "enabled"), &Tabs::set_drag_to_rearrange_enabled);
+ ClassDB::bind_method(D_METHOD("get_drag_to_rearrange_enabled"), &Tabs::get_drag_to_rearrange_enabled);
+ ClassDB::bind_method(D_METHOD("set_tabs_rearrange_group", "group_id"), &Tabs::set_tabs_rearrange_group);
+ ClassDB::bind_method(D_METHOD("get_tabs_rearrange_group"), &Tabs::get_tabs_rearrange_group);
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
ADD_SIGNAL(MethodInfo("right_button_pressed", PropertyInfo(Variant::INT, "tab")));
@@ -854,6 +961,7 @@ void Tabs::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "tab_close_display_policy", PROPERTY_HINT_ENUM, "Show Never,Show Active Only,Show Always"), "set_tab_close_display_policy", "get_tab_close_display_policy");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scrolling_enabled"), "set_scrolling_enabled", "get_scrolling_enabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled");
BIND_ENUM_CONSTANT(ALIGN_LEFT);
BIND_ENUM_CONSTANT(ALIGN_CENTER);
@@ -882,4 +990,8 @@ Tabs::Tabs() {
min_width = 0;
scrolling_enabled = true;
+ buttons_visible = false;
+ hover = -1;
+ drag_to_rearrange_enabled = false;
+ tabs_rearrange_group = -1;
}
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 246b3cba67..3b38e7f2cb 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -90,6 +90,8 @@ private:
int hover; // hovered tab
int min_width;
bool scrolling_enabled;
+ bool drag_to_rearrange_enabled;
+ int tabs_rearrange_group;
int get_tab_width(int p_idx) const;
void _ensure_no_over_offset();
@@ -143,6 +145,11 @@ public:
void set_scrolling_enabled(bool p_enabled);
bool get_scrolling_enabled() const;
+ void set_drag_to_rearrange_enabled(bool p_enabled);
+ bool get_drag_to_rearrange_enabled() const;
+ void set_tabs_rearrange_group(int p_group_id);
+ int get_tabs_rearrange_group() const;
+
void ensure_tab_visible(int p_idx);
void set_min_width(int p_width);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 95d9173d39..327c236f8c 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -117,7 +117,6 @@ void TextEdit::Text::set_indent_size(int p_indent_size) {
void TextEdit::Text::_update_line_cache(int p_line) const {
int w = 0;
- int tab_w = font->get_char_size(' ').width * indent_size;
int len = text[p_line].data.length();
const CharType *str = text[p_line].data.c_str();
@@ -125,22 +124,13 @@ void TextEdit::Text::_update_line_cache(int p_line) const {
//update width
for (int i = 0; i < len; i++) {
- if (str[i] == '\t') {
-
- int left = w % tab_w;
- if (left == 0)
- w += tab_w;
- else
- w += tab_w - w % tab_w; // is right...
-
- } else {
-
- w += font->get_char_size(str[i], str[i + 1]).width;
- }
+ w += get_char_width(str[i], str[i + 1], w);
}
text[p_line].width_cache = w;
+ text[p_line].wrap_amount_cache = -1;
+
//update regions
text[p_line].region_info.clear();
@@ -184,6 +174,7 @@ void TextEdit::Text::_update_line_cache(int p_line) const {
cri.region = j;
text[p_line].region_info[i] = cri;
i += lr - 1;
+
break;
}
@@ -211,6 +202,7 @@ void TextEdit::Text::_update_line_cache(int p_line) const {
cri.region = j;
text[p_line].region_info[i] = cri;
i += lr - 1;
+
break;
}
}
@@ -240,10 +232,32 @@ int TextEdit::Text::get_line_width(int p_line) const {
return text[p_line].width_cache;
}
-void TextEdit::Text::clear_caches() {
+void TextEdit::Text::set_line_wrap_amount(int p_line, int p_wrap_amount) const {
+
+ ERR_FAIL_INDEX(p_line, text.size());
+
+ text[p_line].wrap_amount_cache = p_wrap_amount;
+}
+
+int TextEdit::Text::get_line_wrap_amount(int p_line) const {
+
+ ERR_FAIL_INDEX_V(p_line, text.size(), -1);
- for (int i = 0; i < text.size(); i++)
+ return text[p_line].wrap_amount_cache;
+}
+
+void TextEdit::Text::clear_width_cache() {
+
+ for (int i = 0; i < text.size(); i++) {
text[i].width_cache = -1;
+ }
+}
+
+void TextEdit::Text::clear_wrap_cache() {
+
+ for (int i = 0; i < text.size(); i++) {
+ text[i].wrap_amount_cache = -1;
+ }
}
void TextEdit::Text::clear() {
@@ -268,6 +282,7 @@ void TextEdit::Text::set(int p_line, const String &p_text) {
ERR_FAIL_INDEX(p_line, text.size());
text[p_line].width_cache = -1;
+ text[p_line].wrap_amount_cache = -1;
text[p_line].data = p_text;
}
@@ -278,6 +293,7 @@ void TextEdit::Text::insert(int p_at, const String &p_text) {
line.breakpoint = false;
line.hidden = false;
line.width_cache = -1;
+ line.wrap_amount_cache = -1;
line.data = p_text;
text.insert(p_at, line);
}
@@ -286,6 +302,25 @@ void TextEdit::Text::remove(int p_at) {
text.remove(p_at);
}
+int TextEdit::Text::get_char_width(CharType c, CharType next_c, int px) const {
+
+ int tab_w = font->get_char_size(' ').width * indent_size;
+ int w = 0;
+
+ if (c == '\t') {
+
+ int left = px % tab_w;
+ if (left == 0)
+ w = tab_w;
+ else
+ w = tab_w - px % tab_w; // is right...
+ } else {
+
+ w = font->get_char_size(c, next_c).width;
+ }
+ return w;
+}
+
void TextEdit::_update_scrollbars() {
Size2 size = get_size();
@@ -300,9 +335,12 @@ void TextEdit::_update_scrollbars() {
int hscroll_rows = ((hmin.height - 1) / get_row_height()) + 1;
int visible_rows = get_visible_rows();
- int num_rows = MAX(visible_rows, num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(visible_rows, text.size() - 1 - cursor.line_ofs)));
- int total_rows = (is_hiding_enabled() ? get_total_unhidden_rows() : text.size());
+ int first_vis_line = get_first_visible_line();
+ int wi;
+ int num_rows = MAX(visible_rows, num_lines_from_rows(first_vis_line, cursor.wrap_ofs, visible_rows, wi));
+
+ int total_rows = get_total_visible_rows();
if (scroll_past_end_of_file_enabled) {
total_rows += visible_rows - 1;
}
@@ -348,28 +386,24 @@ void TextEdit::_update_scrollbars() {
if (use_vscroll) {
v_scroll->show();
- v_scroll->set_max(total_rows);
- v_scroll->set_page(visible_rows);
+ v_scroll->set_max(total_rows + get_visible_rows_offset());
+ v_scroll->set_page(visible_rows + get_visible_rows_offset());
if (smooth_scroll_enabled) {
v_scroll->set_step(0.25);
} else {
v_scroll->set_step(1);
}
-
- update_line_scroll_pos();
- if (fabs(v_scroll->get_value() - get_line_scroll_pos()) >= 1) {
- cursor.line_ofs += v_scroll->get_value() - get_line_scroll_pos();
- }
+ set_v_scroll(get_v_scroll());
} else {
cursor.line_ofs = 0;
- line_scroll_pos = 0;
+ cursor.wrap_ofs = 0;
v_scroll->set_value(0);
v_scroll->hide();
}
- if (use_hscroll) {
+ if (use_hscroll && !is_wrap_enabled()) {
h_scroll->show();
h_scroll->set_max(total_width);
@@ -392,6 +426,9 @@ void TextEdit::_update_scrollbars() {
void TextEdit::_click_selection_held() {
+ // Warning: is_mouse_button_pressed(BUTTON_LEFT) returns false for double+ clicks, so this doesn't work for MODE_WORD
+ // and MODE_LINE. However, moving the mouse triggers _gui_input, which calls these functions too, so that's not a huge problem.
+ // I'm unsure if there's an actual fix that doesn't have a ton of side effects.
if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != Selection::MODE_NONE) {
switch (selection.selecting_mode) {
case Selection::MODE_POINTER: {
@@ -413,14 +450,14 @@ void TextEdit::_click_selection_held() {
}
void TextEdit::_update_selection_mode_pointer() {
- Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position();
+ Point2 mp = get_local_mouse_position();
int row, col;
_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
select(selection.selecting_line, selection.selecting_column, row, col);
- cursor_set_line(row);
+ cursor_set_line(row, false);
cursor_set_column(col);
update();
@@ -428,7 +465,7 @@ void TextEdit::_update_selection_mode_pointer() {
}
void TextEdit::_update_selection_mode_word() {
- Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position();
+ Point2 mp = get_local_mouse_position();
int row, col;
_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
@@ -462,26 +499,29 @@ void TextEdit::_update_selection_mode_word() {
selection.selected_word_beg = beg;
selection.selected_word_end = end;
selection.selected_word_origin = beg;
+ cursor_set_line(selection.to_line, false);
cursor_set_column(selection.to_column);
} else {
if ((col <= selection.selected_word_origin && row == selection.selecting_line) || row < selection.selecting_line) {
selection.selecting_column = selection.selected_word_end;
select(row, beg, selection.selecting_line, selection.selected_word_end);
+ cursor_set_line(selection.from_line, false);
cursor_set_column(selection.from_column);
} else {
selection.selecting_column = selection.selected_word_beg;
select(selection.selecting_line, selection.selected_word_beg, row, end);
+ cursor_set_line(selection.to_line, false);
cursor_set_column(selection.to_column);
}
}
- cursor_set_line(row);
update();
+
click_select_held->start();
}
void TextEdit::_update_selection_mode_line() {
- Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position();
+ Point2 mp = get_local_mouse_position();
int row, col;
_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
@@ -489,11 +529,11 @@ void TextEdit::_update_selection_mode_line() {
col = 0;
if (row < selection.selecting_line) {
// cursor is above us
- cursor_set_line(row - 1);
+ cursor_set_line(row - 1, false);
selection.selecting_column = text[selection.selecting_line].length();
} else {
// cursor is below us
- cursor_set_line(row + 1);
+ cursor_set_line(row + 1, false);
selection.selecting_column = 0;
col = text[row].length();
}
@@ -515,13 +555,13 @@ void TextEdit::_notification(int p_what) {
MessageQueue::get_singleton()->push_call(this, "_cursor_changed_emit");
if (text_changed_dirty)
MessageQueue::get_singleton()->push_call(this, "_text_changed_emit");
-
+ update_wrap_at();
} break;
case NOTIFICATION_RESIZED: {
cache.size = get_size();
- adjust_viewport_to_cursor();
-
+ _update_scrollbars();
+ update_wrap_at();
} break;
case NOTIFICATION_THEME_CHANGED: {
@@ -537,26 +577,25 @@ void TextEdit::_notification(int p_what) {
draw_caret = false;
update();
} break;
- case NOTIFICATION_PHYSICS_PROCESS: {
- if (scrolling && v_scroll->get_value() != target_v_scroll) {
- double target_y = target_v_scroll - v_scroll->get_value();
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
+ if (scrolling && get_v_scroll() != target_v_scroll) {
+ double target_y = target_v_scroll - get_v_scroll();
double dist = sqrt(target_y * target_y);
double vel = ((target_y / dist) * v_scroll_speed) * get_physics_process_delta_time();
if (Math::abs(vel) >= dist) {
- v_scroll->set_value(target_v_scroll);
+ set_v_scroll(target_v_scroll);
scrolling = false;
- set_physics_process(false);
+ set_physics_process_internal(false);
} else {
- v_scroll->set_value(v_scroll->get_value() + vel);
+ set_v_scroll(get_v_scroll() + vel);
}
} else {
scrolling = false;
- set_physics_process(false);
+ set_physics_process_internal(false);
}
} break;
case NOTIFICATION_DRAW: {
-
if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
draw_caret = false;
}
@@ -619,44 +658,10 @@ void TextEdit::_notification(int p_what) {
Color color = cache.font_color;
color.a *= readonly_alpha;
- int in_region = -1;
-
if (syntax_coloring) {
-
if (cache.background_color.a > 0.01) {
-
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(), get_size()), cache.background_color);
}
- //compute actual region to start (may be inside say, a comment).
- //slow in very large documents :( but ok for source!
-
- for (int i = 0; i < cursor.line_ofs; i++) {
-
- const Map<int, Text::ColorRegionInfo> &cri_map = text.get_color_region_info(i);
-
- if (in_region >= 0 && color_regions[in_region].line_only) {
- in_region = -1; //reset regions that end at end of line
- }
-
- for (const Map<int, Text::ColorRegionInfo>::Element *E = cri_map.front(); E; E = E->next()) {
-
- const Text::ColorRegionInfo &cri = E->get();
-
- if (in_region == -1) {
-
- if (!cri.end) {
-
- in_region = cri.region;
- }
- } else if (in_region == cri.region && !color_regions[cri.region].line_only) { //ignore otherwise
-
- if (cri.end || color_regions[cri.region].eq) {
-
- in_region = -1;
- }
- }
- }
- }
}
int brace_open_match_line = -1;
@@ -804,18 +809,20 @@ void TextEdit::_notification(int p_what) {
}
}
- int deregion = 0; //force it to clear inrgion
Point2 cursor_pos;
// get the highlighted words
String highlighted_text = get_selection_text();
String line_num_padding = line_numbers_zero_padded ? "0" : " ";
- update_line_scroll_pos();
- int line = cursor.line_ofs - 1;
- // another row may be visible during smooth scrolling
+ int cursor_wrap_index = get_cursor_wrap_index();
+
+ FontDrawer drawer(cache.font, Color(1, 1, 1));
+
+ int line = get_first_visible_line() - 1;
int draw_amount = visible_rows + (smooth_scroll_enabled ? 1 : 0);
+ draw_amount += times_line_wraps(line + 1);
for (int i = 0; i < draw_amount; i++) {
line++;
@@ -833,407 +840,360 @@ void TextEdit::_notification(int p_what) {
if (line < 0 || line >= (int)text.size())
continue;
- const String &str = text[line];
-
- int char_margin = xmargin_beg - cursor.x_ofs;
- int char_ofs = 0;
+ const String &fullstr = text[line];
- int ofs_readonly = 0;
- int ofs_x = 0;
+ Map<int, HighlighterInfo> color_map;
+ if (syntax_coloring) {
+ color_map = _get_line_syntax_highlighting(line);
+ }
+ // ensure we at least use the font color
+ Color current_color = cache.font_color;
if (readonly) {
- ofs_readonly = cache.style_readonly->get_offset().y / 2;
- ofs_x = cache.style_readonly->get_offset().x / 2;
+ current_color.a *= readonly_alpha;
}
- int ofs_y = (i * get_row_height() + cache.line_spacing / 2) + ofs_readonly;
- if (smooth_scroll_enabled)
- ofs_y -= ((v_scroll->get_value() - get_line_scroll_pos()) * get_row_height());
- bool prev_is_char = false;
- bool prev_is_number = false;
- bool in_keyword = false;
bool underlined = false;
- bool in_word = false;
- bool in_function_name = false;
- bool in_member_variable = false;
- bool is_hex_notation = false;
- Color keyword_color;
-
- // check if line contains highlighted word
- int highlighted_text_col = -1;
- int search_text_col = -1;
- if (!search_text.empty())
- search_text_col = _get_column_pos_of_word(search_text, str, search_flags, 0);
+ int line_wrap_amount = times_line_wraps(line);
+ int last_wrap_column = 0;
+ Vector<String> wrap_rows = get_wrap_rows_text(line);
- if (highlighted_text.length() != 0 && highlighted_text != search_text)
- highlighted_text_col = _get_column_pos_of_word(highlighted_text, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, 0);
+ for (int line_wrap_index = 0; line_wrap_index < line_wrap_amount + 1; line_wrap_index++) {
+ if (line_wrap_index != 0) {
+ i++;
+ if (i >= draw_amount)
+ break;
+ }
- const Map<int, Text::ColorRegionInfo> &cri_map = text.get_color_region_info(line);
+ const String &str = wrap_rows[line_wrap_index];
+ int indent_px = line_wrap_index != 0 ? get_indent_level(line) * cache.font->get_char_size(' ').width : 0;
- if (text.is_marked(line)) {
+ if (line_wrap_index > 0)
+ last_wrap_column += wrap_rows[line_wrap_index - 1].length();
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.mark_color);
- }
+ int char_margin = xmargin_beg - cursor.x_ofs;
+ char_margin += indent_px;
+ int char_ofs = 0;
- if (str.length() == 0) {
- // draw line background if empty as we won't loop at at all
- if (line == cursor.line && highlight_current_line) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(ofs_x, ofs_y, xmargin_end, get_row_height()), cache.current_line_color);
+ int ofs_readonly = 0;
+ int ofs_x = 0;
+ if (readonly) {
+ ofs_readonly = cache.style_readonly->get_offset().y / 2;
+ ofs_x = cache.style_readonly->get_offset().x / 2;
}
- // give visual indication of empty selected line
- if (selection.active && line >= selection.from_line && line <= selection.to_line && char_margin >= xmargin_beg) {
- int char_w = cache.font->get_char_size(' ').width;
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, char_w, get_row_height()), cache.selection_color);
- }
- } else {
- // if it has text, then draw current line marker in the margin, as line number etc will draw over it, draw the rest of line marker later.
- if (line == cursor.line && highlight_current_line) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg + ofs_x, get_row_height()), cache.current_line_color);
- }
- }
+ int ofs_y = (i * get_row_height() + cache.line_spacing / 2) + ofs_readonly;
+ ofs_y -= cursor.wrap_ofs * get_row_height();
+ if (smooth_scroll_enabled)
+ ofs_y += (-get_v_scroll_offset()) * get_row_height();
- if (text.is_breakpoint(line) && !draw_breakpoint_gutter) {
-#ifdef TOOLS_ENABLED
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.breakpoint_color);
-#else
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color);
-#endif
- }
+ // check if line contains highlighted word
+ int highlighted_text_col = -1;
+ int search_text_col = -1;
+ int highlighted_word_col = -1;
- // draw breakpoint marker
- if (text.is_breakpoint(line)) {
- if (draw_breakpoint_gutter) {
- int vertical_gap = (get_row_height() * 40) / 100;
- int horizontal_gap = (cache.breakpoint_gutter_width * 30) / 100;
- int marker_height = get_row_height() - (vertical_gap * 2);
- int marker_width = cache.breakpoint_gutter_width - (horizontal_gap * 2);
- // no transparency on marker
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2, ofs_y + vertical_gap, marker_width, marker_height), Color(cache.breakpoint_color.r, cache.breakpoint_color.g, cache.breakpoint_color.b));
- }
- }
+ if (!search_text.empty())
+ search_text_col = _get_column_pos_of_word(search_text, str, search_flags, 0);
- // draw fold markers
- if (draw_fold_gutter) {
- int horizontal_gap = (cache.fold_gutter_width * 30) / 100;
- int gutter_left = cache.style_normal->get_margin(MARGIN_LEFT) + cache.breakpoint_gutter_width + cache.line_number_w;
- if (is_folded(line)) {
- int xofs = horizontal_gap - (cache.can_fold_icon->get_width()) / 2;
- int yofs = (get_row_height() - cache.folded_icon->get_height()) / 2;
- cache.folded_icon->draw(ci, Point2(gutter_left + xofs + ofs_x, ofs_y + yofs), cache.code_folding_color);
- } else if (can_fold(line)) {
- int xofs = -cache.can_fold_icon->get_width() / 2 - horizontal_gap + 3;
- int yofs = (get_row_height() - cache.can_fold_icon->get_height()) / 2;
- cache.can_fold_icon->draw(ci, Point2(gutter_left + xofs + ofs_x, ofs_y + yofs), cache.code_folding_color);
- }
- }
+ if (highlighted_text.length() != 0 && highlighted_text != search_text)
+ highlighted_text_col = _get_column_pos_of_word(highlighted_text, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, 0);
- if (cache.line_number_w) {
- String fc = String::num(line + 1);
- while (fc.length() < line_number_char_count) {
- fc = line_num_padding + fc;
+ if (select_identifiers_enabled && highlighted_word.length() != 0) {
+ if (_is_char(highlighted_word[0])) {
+ highlighted_word_col = _get_column_pos_of_word(highlighted_word, fullstr, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, 0);
+ }
}
- cache.font->draw(ci, Point2(cache.style_normal->get_margin(MARGIN_LEFT) + cache.breakpoint_gutter_width + ofs_x, ofs_y + cache.font->get_ascent()), fc, cache.line_number_color);
- }
- //loop through characters in one line
- for (int j = 0; j < str.length(); j++) {
-
- //look for keyword
-
- if (deregion > 0) {
- deregion--;
- if (deregion == 0)
- in_region = -1;
+ if (text.is_marked(line)) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.mark_color);
}
- if (syntax_coloring && deregion == 0) {
-
- color = cache.font_color; //reset
- color.a *= readonly_alpha;
- //find keyword
- bool is_char = _is_text_char(str[j]);
- bool is_symbol = _is_symbol(str[j]);
- bool is_number = _is_number(str[j]);
- if (j == 0 && in_region >= 0 && color_regions[in_region].line_only) {
- in_region = -1; //reset regions that end at end of line
+ if (str.length() == 0) {
+ // draw line background if empty as we won't loop at at all
+ if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(ofs_x, ofs_y, xmargin_end, get_row_height()), cache.current_line_color);
}
- // allow ABCDEF in hex notation
- if (is_hex_notation && (_is_hex_symbol(str[j]) || is_number)) {
- is_number = true;
- } else {
- is_hex_notation = false;
+ // give visual indication of empty selected line
+ if (selection.active && line >= selection.from_line && line <= selection.to_line && char_margin >= xmargin_beg) {
+ int char_w = cache.font->get_char_size(' ').width;
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, char_w, get_row_height()), cache.selection_color);
}
-
- // check for dot or underscore or 'x' for hex notation in floating point number
- if ((str[j] == '.' || str[j] == 'x' || str[j] == '_') && !in_word && prev_is_number && !is_number) {
- is_number = true;
- is_symbol = false;
- is_char = false;
-
- if (str[j] == 'x' && str[j - 1] == '0') {
- is_hex_notation = true;
- }
+ } else {
+ // if it has text, then draw current line marker in the margin, as line number etc will draw over it, draw the rest of line marker later.
+ if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg, get_row_height()), cache.current_line_color);
}
+ }
- if (!in_word && _is_char(str[j]) && !is_number) {
- in_word = true;
- }
+ if (line_wrap_index == 0) {
+ // only do these if we are on the first wrapped part of a line
- if ((in_keyword || in_word) && !is_hex_notation) {
- is_number = false;
+ if (text.is_breakpoint(line) && !draw_breakpoint_gutter) {
+#ifdef TOOLS_ENABLED
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.breakpoint_color);
+#else
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color);
+#endif
}
- if (is_symbol && str[j] != '.' && in_word) {
- in_word = false;
+ // draw breakpoint marker
+ if (text.is_breakpoint(line)) {
+ if (draw_breakpoint_gutter) {
+ int vertical_gap = (get_row_height() * 40) / 100;
+ int horizontal_gap = (cache.breakpoint_gutter_width * 30) / 100;
+ int marker_height = get_row_height() - (vertical_gap * 2);
+ int marker_width = cache.breakpoint_gutter_width - (horizontal_gap * 2);
+ // no transparency on marker
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2, ofs_y + vertical_gap, marker_width, marker_height), Color(cache.breakpoint_color.r, cache.breakpoint_color.g, cache.breakpoint_color.b));
+ }
}
- if (is_symbol && cri_map.has(j)) {
-
- const Text::ColorRegionInfo &cri = cri_map[j];
-
- if (in_region == -1) {
+ // draw fold markers
+ if (draw_fold_gutter) {
+ int horizontal_gap = (cache.fold_gutter_width * 30) / 100;
+ int gutter_left = cache.style_normal->get_margin(MARGIN_LEFT) + cache.breakpoint_gutter_width + cache.line_number_w;
+ if (is_folded(line)) {
+ int xofs = horizontal_gap - (cache.can_fold_icon->get_width()) / 2;
+ int yofs = (get_row_height() - cache.folded_icon->get_height()) / 2;
+ cache.folded_icon->draw(ci, Point2(gutter_left + xofs + ofs_x, ofs_y + yofs), cache.code_folding_color);
+ } else if (can_fold(line)) {
+ int xofs = -cache.can_fold_icon->get_width() / 2 - horizontal_gap + 3;
+ int yofs = (get_row_height() - cache.can_fold_icon->get_height()) / 2;
+ cache.can_fold_icon->draw(ci, Point2(gutter_left + xofs + ofs_x, ofs_y + yofs), cache.code_folding_color);
+ }
+ }
- if (!cri.end) {
+ // draw line numbers
+ if (cache.line_number_w) {
+ String fc = String::num(line + 1);
+ while (fc.length() < line_number_char_count) {
+ fc = line_num_padding + fc;
+ }
- in_region = cri.region;
- }
- } else if (in_region == cri.region && !color_regions[cri.region].line_only) { //ignore otherwise
+ cache.font->draw(ci, Point2(cache.style_normal->get_margin(MARGIN_LEFT) + cache.breakpoint_gutter_width + ofs_x, ofs_y + cache.font->get_ascent()), fc, cache.line_number_color);
+ }
+ }
- if (cri.end || color_regions[cri.region].eq) {
+ //loop through characters in one line
+ for (int j = 0; j < str.length(); j++) {
- deregion = color_regions[cri.region].eq ? color_regions[cri.region].begin_key.length() : color_regions[cri.region].end_key.length();
+ if (syntax_coloring) {
+ if (color_map.has(last_wrap_column + j)) {
+ current_color = color_map[last_wrap_column + j].color;
+ if (readonly) {
+ current_color.a *= readonly_alpha;
}
}
+ color = current_color;
}
- if (!is_char) {
- in_keyword = false;
- underlined = false;
- }
-
- if (in_region == -1 && !in_keyword && is_char && !prev_is_char) {
-
- int to = j;
- while (to < str.length() && _is_text_char(str[to]))
- to++;
+ int char_w;
- uint32_t hash = String::hash(&str[j], to - j);
- StrRange range(&str[j], to - j);
+ //handle tabulator
+ char_w = text.get_char_width(str[j], str[j + 1], char_ofs);
- const Color *col = keywords.custom_getptr(range, hash);
+ if ((char_ofs + char_margin) < xmargin_beg) {
+ char_ofs += char_w;
- if (!col) {
- col = member_keywords.custom_getptr(range, hash);
+ // line highlighting handle horizontal clipping
+ if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) {
- if (col) {
- for (int k = j - 1; k >= 0; k--) {
- if (str[k] == '.') {
- col = NULL; //member indexing not allowed
- break;
- } else if (str[k] > 32) {
- break;
- }
- }
+ if (j == str.length() - 1) {
+ // end of line when last char is skipped
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color);
+ } else if ((char_ofs + char_margin) > xmargin_beg) {
+ // char next to margin is skipped
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color);
}
}
+ continue;
+ }
- if (col) {
-
- in_keyword = true;
- keyword_color = *col;
- }
-
- if (select_identifiers_enabled && highlighted_word != String()) {
- if (highlighted_word == range) {
- underlined = true;
- }
- }
+ if ((char_ofs + char_margin + char_w) >= xmargin_end) {
+ if (syntax_coloring)
+ continue;
+ else
+ break;
}
- if (!in_function_name && in_word && !in_keyword) {
+ bool in_search_result = false;
- int k = j;
- while (k < str.length() && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') {
- k++;
- }
+ if (search_text_col != -1) {
+ // if we are at the end check for new search result on same line
+ if (j >= search_text_col + search_text.length())
+ search_text_col = _get_column_pos_of_word(search_text, str, search_flags, j);
- // check for space between name and bracket
- while (k < str.length() && (str[k] == '\t' || str[k] == ' ')) {
- k++;
- }
+ in_search_result = j >= search_text_col && j < search_text_col + search_text.length();
- if (str[k] == '(') {
- in_function_name = true;
+ if (in_search_result) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin, ofs_y), Size2i(char_w, get_row_height())), cache.search_result_color);
}
}
- if (!in_function_name && !in_member_variable && !in_keyword && !is_number && in_word) {
- int k = j;
- while (k > 0 && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') {
- k--;
- }
+ //current line highlighting
+ bool in_selection = (selection.active && line >= selection.from_line && line <= selection.to_line && (line > selection.from_line || last_wrap_column + j >= selection.from_column) && (line < selection.to_line || last_wrap_column + j < selection.to_column));
- if (str[k] == '.') {
- in_member_variable = true;
+ if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) {
+ // draw the wrap indent offset highlight
+ if (line_wrap_index != 0 && j == 0) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin - indent_px, ofs_y, (char_ofs + char_margin), get_row_height()), cache.current_line_color);
+ }
+ // if its the last char draw to end of the line
+ if (j == str.length() - 1) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin + char_w, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color);
+ }
+ // actual text
+ if (!in_selection) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.current_line_color);
}
}
- if (is_symbol) {
- in_function_name = false;
- in_member_variable = false;
+ if (in_selection) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.selection_color);
}
- if (in_region >= 0)
- color = color_regions[in_region].color;
- else if (in_keyword)
- color = keyword_color;
- else if (in_member_variable)
- color = cache.member_variable_color;
- else if (in_function_name)
- color = cache.function_color;
- else if (is_symbol)
- color = cache.symbol_color;
- else if (is_number)
- color = cache.number_color;
-
- prev_is_char = is_char;
- prev_is_number = is_number;
- }
- int char_w;
+ if (in_search_result) {
+ Color border_color = (line == search_result_line && j >= search_result_col && j < search_result_col + search_text.length()) ? cache.font_color : cache.search_result_border_color;
- //handle tabulator
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, 1)), border_color);
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y + get_row_height() - 1), Size2i(char_w, 1)), border_color);
- if (str[j] == '\t') {
- int left = char_ofs % tab_w;
- if (left == 0)
- char_w = tab_w;
- else
- char_w = tab_w - char_ofs % tab_w; // is right...
+ if (j == search_text_col)
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(1, get_row_height())), border_color);
+ if (j == search_text_col + search_text.length() - 1)
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color);
+ }
- } else {
- char_w = cache.font->get_char_size(str[j], str[j + 1]).width;
- }
+ if (highlight_all_occurrences) {
+ if (highlighted_text_col != -1) {
- if ((char_ofs + char_margin) < xmargin_beg) {
- char_ofs += char_w;
+ // if we are at the end check for new word on same line
+ if (j > highlighted_text_col + highlighted_text.length()) {
+ highlighted_text_col = _get_column_pos_of_word(highlighted_text, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, j);
+ }
- // line highlighting handle horizontal clipping
- if (line == cursor.line && highlight_current_line) {
+ bool in_highlighted_word = (j >= highlighted_text_col && j < highlighted_text_col + highlighted_text.length());
- if (j == str.length() - 1) {
- // end of line when last char is skipped
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color);
+ // if this is the original highlighted text we don't want to highlight it again
+ if (cursor.line == line && cursor_wrap_index == line_wrap_index && (cursor.column >= highlighted_text_col && cursor.column <= highlighted_text_col + highlighted_text.length())) {
+ in_highlighted_word = false;
+ }
- } else if ((char_ofs + char_margin) > xmargin_beg) {
- // char next to margin is skipped
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - xmargin_beg, get_row_height()), cache.current_line_color);
+ if (in_highlighted_word) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.word_highlighted_color);
+ }
}
}
- continue;
- }
- if ((char_ofs + char_margin + char_w) >= xmargin_end) {
- if (syntax_coloring)
- continue;
- else
- break;
- }
+ if (highlighted_word_col != -1) {
+ if (j + last_wrap_column > highlighted_word_col + highlighted_word.length()) {
+ highlighted_word_col = _get_column_pos_of_word(highlighted_word, fullstr, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, j + last_wrap_column);
+ }
+ underlined = (j + last_wrap_column >= highlighted_word_col && j + last_wrap_column < highlighted_word_col + highlighted_word.length());
+ }
- bool in_search_result = false;
+ if (brace_matching_enabled) {
+ if ((brace_open_match_line == line && brace_open_match_column == last_wrap_column + j) ||
+ (cursor.column == last_wrap_column + j && cursor.line == line && cursor_wrap_index == line_wrap_index && (brace_open_matching || brace_open_mismatch))) {
- if (search_text_col != -1) {
- // if we are at the end check for new search result on same line
- if (j >= search_text_col + search_text.length())
- search_text_col = _get_column_pos_of_word(search_text, str, search_flags, j);
+ if (brace_open_mismatch)
+ color = cache.brace_mismatch_color;
+ drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, ofs_y + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ }
- in_search_result = j >= search_text_col && j < search_text_col + search_text.length();
+ if ((brace_close_match_line == line && brace_close_match_column == last_wrap_column + j) ||
+ (cursor.column == last_wrap_column + j + 1 && cursor.line == line && cursor_wrap_index == line_wrap_index && (brace_close_matching || brace_close_mismatch))) {
- if (in_search_result) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin, ofs_y), Size2i(char_w, get_row_height())), cache.search_result_color);
+ if (brace_close_mismatch)
+ color = cache.brace_mismatch_color;
+ drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, ofs_y + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ }
}
- }
- //current line highlighting
- bool in_selection = (selection.active && line >= selection.from_line && line <= selection.to_line && (line > selection.from_line || j >= selection.from_column) && (line < selection.to_line || j < selection.to_column));
+ if (cursor.column == last_wrap_column + j && cursor.line == line && cursor_wrap_index == line_wrap_index) {
- if (line == cursor.line && highlight_current_line) {
- // if its the last char draw to end of the line
- if (j == str.length() - 1) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin + char_w, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color);
- }
- // actual text
- if (!in_selection) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.current_line_color);
- }
- }
+ cursor_pos = Point2i(char_ofs + char_margin + ofs_x, ofs_y);
- if (in_selection) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.selection_color);
- }
+ if (insert_mode) {
+ cursor_pos.y += (get_row_height() - 3);
+ }
- if (in_search_result) {
- Color border_color = (line == search_result_line && j >= search_result_col && j < search_result_col + search_text.length()) ? cache.font_color : cache.search_result_border_color;
+ int caret_w = (str[j] == '\t') ? cache.font->get_char_size(' ').width : char_w;
+ if (ime_text.length() > 0) {
+ int ofs = 0;
+ while (true) {
+ if (ofs >= ime_text.length())
+ break;
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, 1)), border_color);
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y + get_row_height() - 1), Size2i(char_w, 1)), border_color);
+ CharType cchar = ime_text[ofs];
+ CharType next = ime_text[ofs + 1];
+ int im_char_width = cache.font->get_char_size(cchar, next).width;
- if (j == search_text_col)
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(1, get_row_height())), border_color);
- if (j == search_text_col + search_text.length() - 1)
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color);
- }
-
- if (highlight_all_occurrences) {
- if (highlighted_text_col != -1) {
+ if ((char_ofs + char_margin + im_char_width) >= xmargin_end)
+ break;
- // if we are at the end check for new word on same line
- if (j > highlighted_text_col + highlighted_text.length()) {
- highlighted_text_col = _get_column_pos_of_word(highlighted_text, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, j);
- }
+ bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y;
+ if (selected) {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color);
+ } else {
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color);
+ }
- bool in_highlighted_word = (j >= highlighted_text_col && j < highlighted_text_col + highlighted_text.length());
+ drawer.draw_char(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + ascent), cchar, next, color);
- /* if this is the original highlighted text we don't want to highlight it again */
- if (cursor.line == line && (cursor.column >= highlighted_text_col && cursor.column <= highlighted_text_col + highlighted_text.length())) {
- in_highlighted_word = false;
+ char_ofs += im_char_width;
+ ofs++;
+ }
}
-
- if (in_highlighted_word) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.word_highlighted_color);
+ if (ime_text.length() == 0) {
+ if (draw_caret) {
+ if (insert_mode) {
+ int caret_h = (block_caret) ? 4 : 1;
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, caret_h)), cache.caret_color);
+ } else {
+ caret_w = (block_caret) ? caret_w : 1;
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color);
+ }
+ }
}
}
- }
- if (brace_matching_enabled) {
- if ((brace_open_match_line == line && brace_open_match_column == j) ||
- (cursor.column == j && cursor.line == line && (brace_open_matching || brace_open_mismatch))) {
+ if (cursor.column == last_wrap_column + j && cursor.line == line && cursor_wrap_index == line_wrap_index && block_caret && draw_caret && !insert_mode) {
+ color = cache.caret_background_color;
+ } else if (!syntax_coloring && block_caret) {
+ color = cache.font_color;
+ color.a *= readonly_alpha;
+ }
- if (brace_open_mismatch)
- color = cache.brace_mismatch_color;
- cache.font->draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, ofs_y + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ if (str[j] >= 32) {
+ int w = drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, ofs_y + ascent), str[j], str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ if (underlined) {
+ draw_rect(Rect2(char_ofs + char_margin + ofs_x, ofs_y + ascent + 2, w, 1), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ }
+ } else if (draw_tabs && str[j] == '\t') {
+ int yofs = (get_row_height() - cache.tab_icon->get_height()) / 2;
+ cache.tab_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_selected_color : color);
}
- if (
- (brace_close_match_line == line && brace_close_match_column == j) ||
- (cursor.column == j + 1 && cursor.line == line && (brace_close_matching || brace_close_mismatch))) {
+ char_ofs += char_w;
- if (brace_close_mismatch)
- color = cache.brace_mismatch_color;
- cache.font->draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, ofs_y + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ if (line_wrap_index == line_wrap_amount && j == str.length() - 1 && is_folded(line)) {
+ int yofs = (get_row_height() - cache.folded_eol_icon->get_height()) / 2;
+ int xofs = cache.folded_eol_icon->get_width() / 2;
+ Color eol_color = cache.code_folding_color;
+ eol_color.a = 1;
+ cache.folded_eol_icon->draw(ci, Point2(char_ofs + char_margin + xofs + ofs_x, ofs_y + yofs), eol_color);
}
}
- if (cursor.column == j && cursor.line == line) {
+ if (cursor.column == last_wrap_column + str.length() && cursor.line == line && cursor_wrap_index == line_wrap_index && (char_ofs + char_margin) >= xmargin_beg) {
cursor_pos = Point2i(char_ofs + char_margin + ofs_x, ofs_y);
if (insert_mode) {
cursor_pos.y += (get_row_height() - 3);
}
-
- int caret_w = (str[j] == '\t') ? cache.font->get_char_size(' ').width : char_w;
if (ime_text.length() > 0) {
int ofs = 0;
while (true) {
@@ -1254,7 +1214,7 @@ void TextEdit::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color);
}
- cache.font->draw_char(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + ascent), cchar, next, color);
+ drawer.draw_char(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + ascent), cchar, next, color);
char_ofs += im_char_width;
ofs++;
@@ -1263,92 +1223,17 @@ void TextEdit::_notification(int p_what) {
if (ime_text.length() == 0) {
if (draw_caret) {
if (insert_mode) {
+ int char_w = cache.font->get_char_size(' ').width;
int caret_h = (block_caret) ? 4 : 1;
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, caret_h)), cache.caret_color);
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(char_w, caret_h)), cache.caret_color);
} else {
- caret_w = (block_caret) ? caret_w : 1;
+ int char_w = cache.font->get_char_size(' ').width;
+ int caret_w = (block_caret) ? char_w : 1;
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color);
}
}
}
}
-
- if (cursor.column == j && cursor.line == line && block_caret && draw_caret && !insert_mode) {
- color = cache.caret_background_color;
- } else if (!syntax_coloring && block_caret) {
- color = cache.font_color;
- color.a *= readonly_alpha;
- }
-
- if (str[j] >= 32) {
- int w = cache.font->draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, ofs_y + ascent), str[j], str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
- if (underlined) {
- draw_rect(Rect2(char_ofs + char_margin + ofs_x, ofs_y + ascent + 2, w, 1), in_selection && override_selected_font_color ? cache.font_selected_color : color);
- }
- }
-
- else if (draw_tabs && str[j] == '\t') {
- int yofs = (get_row_height() - cache.tab_icon->get_height()) / 2;
- cache.tab_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_selected_color : color);
- }
-
- char_ofs += char_w;
-
- if (j == str.length() - 1 && is_folded(line)) {
- int yofs = (get_row_height() - cache.folded_eol_icon->get_height()) / 2;
- int xofs = cache.folded_eol_icon->get_width() / 2;
- Color eol_color = cache.code_folding_color;
- eol_color.a = 1;
- cache.folded_eol_icon->draw(ci, Point2(char_ofs + char_margin + xofs + ofs_x, ofs_y + yofs), eol_color);
- }
- }
-
- if (cursor.column == str.length() && cursor.line == line && (char_ofs + char_margin) >= xmargin_beg) {
-
- cursor_pos = Point2i(char_ofs + char_margin + ofs_x, ofs_y);
-
- if (insert_mode) {
- cursor_pos.y += (get_row_height() - 3);
- }
- if (ime_text.length() > 0) {
- int ofs = 0;
- while (true) {
- if (ofs >= ime_text.length())
- break;
-
- CharType cchar = ime_text[ofs];
- CharType next = ime_text[ofs + 1];
- int im_char_width = cache.font->get_char_size(cchar, next).width;
-
- if ((char_ofs + char_margin + im_char_width) >= xmargin_end)
- break;
-
- bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y;
- if (selected) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color);
- } else {
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color);
- }
-
- cache.font->draw_char(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + ascent), cchar, next, color);
-
- char_ofs += im_char_width;
- ofs++;
- }
- }
- if (ime_text.length() == 0) {
- if (draw_caret) {
- if (insert_mode) {
- int char_w = cache.font->get_char_size(' ').width;
- int caret_h = (block_caret) ? 4 : 1;
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(char_w, caret_h)), cache.caret_color);
- } else {
- int char_w = cache.font->get_char_size(' ').width;
- int caret_w = (block_caret) ? char_w : 1;
- VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, get_row_height())), cache.caret_color);
- }
- }
- }
}
}
@@ -1509,9 +1394,11 @@ void TextEdit::_notification(int p_what) {
}
if (has_focus()) {
+ OS::get_singleton()->set_ime_active(true);
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos + Point2(0, get_row_height()));
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
}
+
} break;
case NOTIFICATION_FOCUS_ENTER: {
@@ -1519,6 +1406,7 @@ void TextEdit::_notification(int p_what) {
draw_caret = true;
}
+ OS::get_singleton()->set_ime_active(true);
Point2 cursor_pos = Point2(cursor_get_column(), cursor_get_line()) * get_row_height();
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
OS::get_singleton()->set_ime_intermediate_text_callback(_ime_text_callback, this);
@@ -1528,12 +1416,12 @@ void TextEdit::_notification(int p_what) {
if (raised_from_completion) {
VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1);
}
-
} break;
case NOTIFICATION_FOCUS_EXIT: {
OS::get_singleton()->set_ime_position(Point2());
OS::get_singleton()->set_ime_intermediate_text_callback(NULL, NULL);
+ OS::get_singleton()->set_ime_active(false);
ime_text = "";
ime_selection = Point2();
@@ -1775,16 +1663,20 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co
float rows = p_mouse.y;
rows -= cache.style_normal->get_margin(MARGIN_TOP);
- rows += (CLAMP(v_scroll->get_value() - get_line_scroll_pos(true), 0, 1) * get_row_height());
rows /= get_row_height();
- int first_vis_line = CLAMP(cursor.line_ofs, 0, text.size() - 1);
+ rows += get_v_scroll_offset();
+ int first_vis_line = get_first_visible_line();
+ int last_vis_line = get_last_visible_line();
int row = first_vis_line + Math::floor(rows);
+ int wrap_index = 0;
- if (is_hiding_enabled()) {
- // row will be offset by the hidden rows
- int f_ofs = num_lines_from(first_vis_line, rows + 1) - 1;
- row = first_vis_line + f_ofs;
- row = CLAMP(row, 0, text.size() - num_lines_from(text.size() - 1, -1));
+ if (is_wrap_enabled() || is_hiding_enabled()) {
+
+ int f_ofs = num_lines_from_rows(first_vis_line, cursor.wrap_ofs, rows + (1 * SGN(rows)), wrap_index) - 1;
+ if (rows < 0)
+ row = first_vis_line - f_ofs;
+ else
+ row = first_vis_line + f_ofs;
}
if (row < 0)
@@ -1798,9 +1690,19 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co
col = text[row].size();
} else {
- col = p_mouse.x - (cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width);
- col += cursor.x_ofs;
- col = get_char_pos_for(col, get_line(row));
+ int colx = p_mouse.x - (cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width);
+ colx += cursor.x_ofs;
+ col = get_char_pos_for_line(colx, row, wrap_index);
+ if (is_wrap_enabled() && wrap_index < times_line_wraps(row)) {
+ // move back one if we are at the end of the row
+ Vector<String> rows = get_wrap_rows_text(row);
+ int row_end_col = 0;
+ for (int i = 0; i < wrap_index + 1; i++) {
+ row_end_col += rows[i].length();
+ }
+ if (col >= row_end_col)
+ col -= 1;
+ }
}
r_row = row;
@@ -1875,7 +1777,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_reset_caret_blink_timer();
int row, col;
- update_line_scroll_pos();
_get_mouse_pos(Point2i(mb->get_position().x, mb->get_position().y), row, col);
if (mb->get_command() && highlighted_word != String()) {
@@ -2007,7 +1908,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_reset_caret_blink_timer();
int row, col;
- update_line_scroll_pos();
_get_mouse_pos(Point2i(mb->get_position().x, mb->get_position().y), row, col);
if (is_right_click_moving_caret()) {
@@ -2141,9 +2041,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (completion_index > 0) {
completion_index--;
- completion_current = completion_options[completion_index];
- update();
+ } else {
+ completion_index = completion_options.size() - 1;
}
+ completion_current = completion_options[completion_index];
+ update();
+
accept_event();
return;
}
@@ -2152,9 +2055,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (completion_index < completion_options.size() - 1) {
completion_index++;
- completion_current = completion_options[completion_index];
- update();
+ } else {
+ completion_index = 0;
}
+ completion_current = completion_options[completion_index];
+ update();
+
accept_event();
return;
}
@@ -2576,6 +2482,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
cursor_set_line(line);
cursor_set_column(column);
+#ifdef APPLE_STYLE_KEYS
+ } else if (k->get_command()) {
+ int cursor_current_column = cursor.column;
+ cursor.column = 0;
+ _remove_text(cursor.line, 0, cursor.line, cursor_current_column);
+#endif
} else {
if (cursor.line > 0 && is_line_hidden(cursor.line - 1))
unfold_line(cursor.line - 1);
@@ -2612,13 +2524,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
break;
} else if (k->get_command()) {
#endif
- bool prev_char = false;
int cc = cursor.column;
if (cc == 0 && cursor.line > 0) {
cursor_set_line(cursor.line - 1);
cursor_set_column(text[cursor.line].length());
} else {
+ bool prev_char = false;
+
while (cc > 0) {
bool ischar = _is_text_char(text[cursor.line][cc - 1]);
@@ -2673,13 +2586,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
break;
} else if (k->get_command()) {
#endif
- bool prev_char = false;
int cc = cursor.column;
if (cc == text[cursor.line].length() && cursor.line < text.size() - 1) {
cursor_set_line(cursor.line + 1);
cursor_set_column(0);
} else {
+ bool prev_char = false;
+
while (cc < text[cursor.line].length()) {
bool ischar = _is_text_char(text[cursor.line][cc]);
@@ -2731,11 +2645,25 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
break;
}
- if (k->get_command())
+ if (k->get_command()) {
cursor_set_line(0);
- else
+ } else
#endif
- cursor_set_line(cursor_get_line() - num_lines_from(CLAMP(cursor.line - 1, 0, text.size() - 1), -1));
+ {
+ int cur_wrap_index = get_cursor_wrap_index();
+ if (cur_wrap_index > 0) {
+ cursor_set_line(cursor.line, true, false, cur_wrap_index - 1);
+ } else if (cursor.line == 0) {
+ cursor_set_column(0);
+ } else {
+ int new_line = cursor.line - num_lines_from(cursor.line - 1, -1);
+ if (line_wraps(new_line)) {
+ cursor_set_line(new_line, true, false, times_line_wraps(new_line));
+ } else {
+ cursor_set_line(new_line, true, false);
+ }
+ }
+ }
if (k->get_shift())
_post_shift_selection();
@@ -2763,22 +2691,25 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
break;
}
- {
#else
if (k->get_command() && k->get_alt()) {
_scroll_lines_down();
break;
}
- if (k->get_command())
- cursor_set_line(text.size() - 1, true, false);
- else {
+ if (k->get_command()) {
+ cursor_set_line(get_last_unhidden_line(), true, false, 9999);
+ } else
#endif
- if (!is_last_visible_line(cursor.line)) {
- cursor_set_line(cursor_get_line() + num_lines_from(CLAMP(cursor.line + 1, 0, text.size() - 1), 1), true, false);
+ {
+ int cur_wrap_index = get_cursor_wrap_index();
+ if (cur_wrap_index < times_line_wraps(cursor.line)) {
+ cursor_set_line(cursor.line, true, false, cur_wrap_index + 1);
+ } else if (cursor.line == get_last_unhidden_line()) {
+ cursor_set_column(text[cursor.line].length());
} else {
- cursor_set_line(text.size() - 1);
- cursor_set_column(get_line(cursor.line).length(), true);
+ int new_line = cursor.line + num_lines_from(CLAMP(cursor.line + 1, 0, text.size() - 1), 1);
+ cursor_set_line(new_line, true, false, 0);
}
}
@@ -2787,7 +2718,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_cancel_code_hint();
} break;
-
case KEY_DELETE: {
if (readonly)
@@ -2850,7 +2780,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
next_line = line;
next_column = column;
-
+#ifdef APPLE_STYLE_KEYS
+ } else if (k->get_command()) {
+ next_column = curline_len;
+ next_line = cursor.line;
+#endif
} else {
next_column = cursor.column < curline_len ? (cursor.column + 1) : 0;
}
@@ -2890,19 +2824,31 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
cursor_set_line(0);
cursor_set_column(0);
} else {
- // compute whitespace symbols seq length
- int current_line_whitespace_len = 0;
- while (current_line_whitespace_len < text[cursor.line].length()) {
- CharType c = text[cursor.line][current_line_whitespace_len];
- if (c != '\t' && c != ' ')
- break;
- current_line_whitespace_len++;
+
+ // move cursor column to start of wrapped row and then to start of text
+ Vector<String> rows = get_wrap_rows_text(cursor.line);
+ int wi = get_cursor_wrap_index();
+ int row_start_col = 0;
+ for (int i = 0; i < wi; i++) {
+ row_start_col += rows[i].length();
}
+ if (cursor.column == row_start_col || wi == 0) {
+ // compute whitespace symbols seq length
+ int current_line_whitespace_len = 0;
+ while (current_line_whitespace_len < text[cursor.line].length()) {
+ CharType c = text[cursor.line][current_line_whitespace_len];
+ if (c != '\t' && c != ' ')
+ break;
+ current_line_whitespace_len++;
+ }
- if (cursor_get_column() == current_line_whitespace_len)
- cursor_set_column(0);
- else
- cursor_set_column(current_line_whitespace_len);
+ if (cursor_get_column() == current_line_whitespace_len)
+ cursor_set_column(0);
+ else
+ cursor_set_column(current_line_whitespace_len);
+ } else {
+ cursor_set_column(row_start_col);
+ }
}
if (k->get_shift())
@@ -2927,7 +2873,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (k->get_shift())
_pre_shift_selection();
- cursor_set_line(text.size() - 1, true, false);
+ cursor_set_line(get_last_unhidden_line(), true, false, 9999);
if (k->get_shift())
_post_shift_selection();
@@ -2942,8 +2888,20 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_pre_shift_selection();
if (k->get_command())
- cursor_set_line(text.size() - 1, true, false);
- cursor_set_column(text[cursor.line].length());
+ cursor_set_line(get_last_unhidden_line(), true, false, 9999);
+
+ // move cursor column to end of wrapped row and then to end of text
+ Vector<String> rows = get_wrap_rows_text(cursor.line);
+ int wi = get_cursor_wrap_index();
+ int row_end_col = -1;
+ for (int i = 0; i < wi + 1; i++) {
+ row_end_col += rows[i].length();
+ }
+ if (wi == rows.size() - 1 || cursor.column == row_end_col) {
+ cursor_set_column(text[cursor.line].length());
+ } else {
+ cursor_set_column(row_end_col);
+ }
if (k->get_shift())
_post_shift_selection();
@@ -2967,7 +2925,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (k->get_shift())
_pre_shift_selection();
- cursor_set_line(cursor_get_line() - num_lines_from(cursor.line, -get_visible_rows()), true, false);
+ int wi;
+ int n_line = cursor.line - num_lines_from_rows(cursor.line, get_cursor_wrap_index(), -get_visible_rows(), wi) + 1;
+ cursor_set_line(n_line, true, false, wi);
if (k->get_shift())
_post_shift_selection();
@@ -2981,14 +2941,16 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
scancode_handled = false;
break;
}
- // numlock disabled. fallthrough to key_pageup
+ // numlock disabled. fallthrough to key_pagedown
}
case KEY_PAGEDOWN: {
if (k->get_shift())
_pre_shift_selection();
- cursor_set_line(cursor_get_line() + num_lines_from(cursor.line, get_visible_rows()), true, false);
+ int wi;
+ int n_line = cursor.line + num_lines_from_rows(cursor.line, get_cursor_wrap_index(), get_visible_rows(), wi) - 1;
+ cursor_set_line(n_line, true, false, wi);
if (k->get_shift())
_post_shift_selection();
@@ -2999,13 +2961,64 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
} break;
case KEY_A: {
- if (!k->get_command() || k->get_shift() || k->get_alt()) {
+#ifndef APPLE_STYLE_KEYS
+ if (!k->get_control() || k->get_shift() || k->get_alt()) {
scancode_handled = false;
break;
}
-
select_all();
+#else
+ if ((!k->get_command() && !k->get_control())) {
+ scancode_handled = false;
+ break;
+ }
+ if (!k->get_shift() && k->get_command())
+ select_all();
+ else if (k->get_control()) {
+ if (k->get_shift())
+ _pre_shift_selection();
+ int current_line_whitespace_len = 0;
+ while (current_line_whitespace_len < text[cursor.line].length()) {
+ CharType c = text[cursor.line][current_line_whitespace_len];
+ if (c != '\t' && c != ' ')
+ break;
+ current_line_whitespace_len++;
+ }
+
+ if (cursor_get_column() == current_line_whitespace_len)
+ cursor_set_column(0);
+ else
+ cursor_set_column(current_line_whitespace_len);
+
+ if (k->get_shift())
+ _post_shift_selection();
+ else if (k->get_command() || k->get_control())
+ deselect();
+ }
+ } break;
+ case KEY_E: {
+
+ if (!k->get_control() || k->get_command() || k->get_alt()) {
+ scancode_handled = false;
+ break;
+ }
+
+ if (k->get_shift())
+ _pre_shift_selection();
+
+ if (k->get_command())
+ cursor_set_line(text.size() - 1, true, false);
+ cursor_set_column(text[cursor.line].length());
+
+ if (k->get_shift())
+ _post_shift_selection();
+ else if (k->get_command() || k->get_control())
+ deselect();
+
+ _cancel_completion();
+ completion_hint = "";
+#endif
} break;
case KEY_X: {
if (readonly) {
@@ -3182,7 +3195,7 @@ void TextEdit::_scroll_up(real_t p_delta) {
if (scrolling) {
target_v_scroll = (target_v_scroll - p_delta);
} else {
- target_v_scroll = (v_scroll->get_value() - p_delta);
+ target_v_scroll = (get_v_scroll() - p_delta);
}
if (smooth_scroll_enabled) {
@@ -3193,10 +3206,10 @@ void TextEdit::_scroll_up(real_t p_delta) {
v_scroll->set_value(target_v_scroll);
} else {
scrolling = true;
- set_physics_process(true);
+ set_physics_process_internal(true);
}
} else {
- v_scroll->set_value(target_v_scroll);
+ set_v_scroll(target_v_scroll);
}
}
@@ -3208,28 +3221,23 @@ void TextEdit::_scroll_down(real_t p_delta) {
if (scrolling) {
target_v_scroll = (target_v_scroll + p_delta);
} else {
- target_v_scroll = (v_scroll->get_value() + p_delta);
+ target_v_scroll = (get_v_scroll() + p_delta);
}
if (smooth_scroll_enabled) {
- int max_v_scroll = get_total_unhidden_rows();
- if (!scroll_past_end_of_file_enabled) {
- max_v_scroll -= get_visible_rows();
- max_v_scroll = CLAMP(max_v_scroll, 0, get_total_unhidden_rows());
- }
-
+ int max_v_scroll = v_scroll->get_max() - v_scroll->get_page();
if (target_v_scroll > max_v_scroll) {
target_v_scroll = max_v_scroll;
+ v_scroll->set_value(target_v_scroll);
}
-
if (Math::abs(target_v_scroll - v_scroll->get_value()) < 1.0) {
v_scroll->set_value(target_v_scroll);
} else {
scrolling = true;
- set_physics_process(true);
+ set_physics_process_internal(true);
}
} else {
- v_scroll->set_value(target_v_scroll);
+ set_v_scroll(target_v_scroll);
}
}
@@ -3260,35 +3268,37 @@ void TextEdit::_scroll_lines_up() {
scrolling = false;
// adjust the vertical scroll
- if (get_v_scroll() >= 0) {
- set_v_scroll(get_v_scroll() - 1);
- }
+ set_v_scroll(get_v_scroll() - 1);
- // adjust the cursor
- int num_lines = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), get_visible_rows());
- if (cursor.line >= cursor.line_ofs + num_lines && !selection.active) {
- cursor_set_line(cursor.line_ofs + num_lines, false, false);
+ // adjust the cursor to viewport
+ if (!selection.active) {
+ int cur_line = cursor.line;
+ int cur_wrap = get_cursor_wrap_index();
+ int last_vis_line = get_last_visible_line();
+ int last_vis_wrap = get_last_visible_line_wrap_index();
+
+ if (cur_line > last_vis_line || (cur_line == last_vis_line && cur_wrap > last_vis_wrap)) {
+ cursor_set_line(last_vis_line, false, false, last_vis_wrap);
+ }
}
}
void TextEdit::_scroll_lines_down() {
scrolling = false;
- // calculate the maximum vertical scroll position
- int max_v_scroll = get_total_unhidden_rows();
- if (!scroll_past_end_of_file_enabled) {
- max_v_scroll -= get_visible_rows();
- max_v_scroll = CLAMP(max_v_scroll, 0, get_total_unhidden_rows());
- }
-
// adjust the vertical scroll
- if (get_v_scroll() < max_v_scroll) {
- set_v_scroll(get_v_scroll() + 1);
- }
+ set_v_scroll(get_v_scroll() + 1);
- // adjust the cursor
- if (cursor.line <= cursor.line_ofs - 1 && !selection.active) {
- cursor_set_line(cursor.line_ofs, false, false);
+ // adjust the cursor to viewport
+ if (!selection.active) {
+ int cur_line = cursor.line;
+ int cur_wrap = get_cursor_wrap_index();
+ int first_vis_line = get_first_visible_line();
+ int first_vis_wrap = cursor.wrap_ofs;
+
+ if (cur_line < first_vis_line || (cur_line == first_vis_line && cur_wrap < first_vis_wrap)) {
+ cursor_set_line(first_vis_line, false, false, first_vis_wrap);
+ }
}
}
@@ -3342,6 +3352,8 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
text.set_hidden(p_line, false);
}
+ text.set_line_wrap_amount(p_line, -1);
+
r_end_line = p_line + substrings.size() - 1;
r_end_column = text[r_end_line].length() - postinsert_text.length();
@@ -3350,6 +3362,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
MessageQueue::get_singleton()->push_call(this, "_text_changed_emit");
text_changed_dirty = true;
}
+ _line_edited_from(p_line);
}
String TextEdit::_base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const {
@@ -3395,11 +3408,14 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li
text.set(p_from_line, pre_text + post_text);
+ text.set_line_wrap_amount(p_from_line, -1);
+
if (!text_changed_dirty && !setting_text) {
if (is_inside_tree())
MessageQueue::get_singleton()->push_call(this, "_text_changed_emit");
text_changed_dirty = true;
}
+ _line_edited_from(p_from_line);
}
void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) {
@@ -3522,6 +3538,13 @@ void TextEdit::_insert_text_at_cursor(const String &p_text) {
update();
}
+void TextEdit::_line_edited_from(int p_line) {
+ int cache_size = color_region_cache.size();
+ for (int i = p_line; i < cache_size; i++) {
+ color_region_cache.erase(i);
+ }
+}
+
int TextEdit::get_char_count() {
int totalsize = 0;
@@ -3545,61 +3568,63 @@ int TextEdit::get_visible_rows() const {
int total = cache.size.height;
total -= cache.style_normal->get_minimum_size().height;
+ if (h_scroll->is_visible_in_tree())
+ total -= h_scroll->get_size().height;
total /= get_row_height();
return total;
}
-int TextEdit::get_total_unhidden_rows() const {
- if (!is_hiding_enabled())
+int TextEdit::get_total_visible_rows() const {
+
+ // returns the total amount of rows we need in the editor.
+ // This skips hidden lines and counts each wrapping of a line.
+ if (!is_hiding_enabled() && !is_wrap_enabled())
return text.size();
- int total_unhidden = 0;
+ int total_rows = 0;
for (int i = 0; i < text.size(); i++) {
- if (!text.is_hidden(i))
- total_unhidden++;
+ if (!text.is_hidden(i)) {
+ total_rows++;
+ total_rows += times_line_wraps(i);
+ }
}
- return total_unhidden;
+ return total_rows;
}
-double TextEdit::get_line_scroll_pos(bool p_recalculate) const {
+void TextEdit::update_wrap_at() {
- if (!is_hiding_enabled())
- return cursor.line_ofs;
- if (!p_recalculate)
- return line_scroll_pos;
+ wrap_at = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width - wrap_right_offset;
+ update_cursor_wrap_offset();
+ text.clear_wrap_cache();
- // count num unhidden lines to the cursor line ofs
- double new_line_scroll_pos = 0;
- int to = CLAMP(cursor.line_ofs, 0, text.size() - 1);
- for (int i = 0; i < to; i++) {
- if (!text.is_hidden(i))
- new_line_scroll_pos++;
+ for (int i = 0; i < text.size(); i++) {
+ // update all values that wrap
+ if (!line_wraps(i))
+ continue;
+ Vector<String> rows = get_wrap_rows_text(i);
+ text.set_line_wrap_amount(i, rows.size() - 1);
}
- return new_line_scroll_pos;
}
-void TextEdit::update_line_scroll_pos() {
+void TextEdit::adjust_viewport_to_cursor() {
- if (!is_hiding_enabled()) {
- line_scroll_pos = cursor.line_ofs;
- return;
- }
+ // make sure cursor is visible on the screen
+ scrolling = false;
- // count num unhidden lines to the cursor line ofs
- double new_line_scroll_pos = 0;
- int to = CLAMP(cursor.line_ofs, 0, text.size() - 1);
- for (int i = 0; i < to; i++) {
- if (!text.is_hidden(i))
- new_line_scroll_pos++;
- }
- line_scroll_pos = new_line_scroll_pos;
-}
+ int cur_line = cursor.line;
+ int cur_wrap = get_cursor_wrap_index();
-void TextEdit::adjust_viewport_to_cursor() {
- scrolling = false;
+ int first_vis_line = get_first_visible_line();
+ int first_vis_wrap = cursor.wrap_ofs;
+ int last_vis_line = get_last_visible_line();
+ int last_vis_wrap = get_last_visible_line_wrap_index();
- if (cursor.line_ofs > cursor.line) {
- cursor.line_ofs = cursor.line;
+ if (cur_line < first_vis_line || (cur_line == first_vis_line && cur_wrap < first_vis_wrap)) {
+ // cursor is above screen
+ set_line_as_first_visible(cur_line, cur_wrap);
+ } else if (cur_line > last_vis_line || (cur_line == last_vis_line && cur_wrap > last_vis_wrap)) {
+ // cursor is below screen
+ set_line_as_last_visible(cur_line, cur_wrap);
}
int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
@@ -3607,91 +3632,174 @@ void TextEdit::adjust_viewport_to_cursor() {
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
- int visible_rows = get_visible_rows();
- if (h_scroll->is_visible_in_tree() && !scroll_past_end_of_file_enabled)
- visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height());
- int num_rows = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(visible_rows, text.size() - 1 - cursor.line_ofs));
-
- // make sure the cursor is on the screen
- // above the caret
- if (cursor.line > (cursor.line_ofs + MAX(num_rows, visible_rows))) {
- cursor.line_ofs = cursor.line - num_lines_from(cursor.line, -visible_rows) + 1;
- }
- // below the caret
- if (cursor.line_ofs == cursor.line) {
- cursor.line_ofs = cursor.line - 2;
- }
- int line_ofs_max = text.size() - 1;
- if (!scroll_past_end_of_file_enabled) {
- line_ofs_max -= num_lines_from(text.size() - 1, -visible_rows) - 1;
- line_ofs_max += (h_scroll->is_visible_in_tree() ? 1 : 0);
- line_ofs_max += (cursor.line == text.size() - 1 ? 1 : 0);
- }
- line_ofs_max = MAX(line_ofs_max, 0);
- cursor.line_ofs = CLAMP(cursor.line_ofs, 0, line_ofs_max);
-
- // adjust x offset
- int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
-
- if (cursor_x > (cursor.x_ofs + visible_width))
- cursor.x_ofs = cursor_x - visible_width + 1;
+ if (!is_wrap_enabled()) {
+ // adjust x offset
+ int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
- if (cursor_x < cursor.x_ofs)
- cursor.x_ofs = cursor_x;
+ if (cursor_x > (cursor.x_ofs + visible_width))
+ cursor.x_ofs = cursor_x - visible_width + 1;
- updating_scrolls = true;
- h_scroll->set_value(cursor.x_ofs);
- update_line_scroll_pos();
- double new_v_scroll = get_line_scroll_pos();
- // keep offset if smooth scroll is enabled
- if (smooth_scroll_enabled) {
- new_v_scroll += fmod(v_scroll->get_value(), 1.0);
+ if (cursor_x < cursor.x_ofs)
+ cursor.x_ofs = cursor_x;
+ } else {
+ cursor.x_ofs = 0;
}
- v_scroll->set_value(new_v_scroll);
- updating_scrolls = false;
+ h_scroll->set_value(cursor.x_ofs);
+
update();
}
void TextEdit::center_viewport_to_cursor() {
- scrolling = false;
- if (cursor.line_ofs > cursor.line)
- cursor.line_ofs = cursor.line;
+ // move viewport so the cursor is in the center of the screen
+ scrolling = false;
if (is_line_hidden(cursor.line))
unfold_line(cursor.line);
+ set_line_as_center_visible(cursor.line, get_cursor_wrap_index());
int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width;
if (v_scroll->is_visible_in_tree())
visible_width -= v_scroll->get_combined_minimum_size().width;
visible_width -= 20; // give it a little more space
- int visible_rows = get_visible_rows();
- if (h_scroll->is_visible_in_tree())
- visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height());
- if (text.size() >= visible_rows) {
- int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : MAX(num_lines_from(text.size() - 1, -visible_rows), 0));
- cursor.line_ofs = CLAMP(cursor.line - num_lines_from(MAX(cursor.line - visible_rows / 2, 0), -visible_rows / 2), 0, max_ofs);
+ if (is_wrap_enabled()) {
+ // center x offset
+ int cursor_x = get_column_x_offset_for_line(cursor.column, cursor.line);
+
+ if (cursor_x > (cursor.x_ofs + visible_width))
+ cursor.x_ofs = cursor_x - visible_width + 1;
+
+ if (cursor_x < cursor.x_ofs)
+ cursor.x_ofs = cursor_x;
+ } else {
+ cursor.x_ofs = 0;
+ }
+ h_scroll->set_value(cursor.x_ofs);
+
+ update();
+}
+
+void TextEdit::update_cursor_wrap_offset() {
+ int first_vis_line = get_first_visible_line();
+ if (line_wraps(first_vis_line)) {
+ cursor.wrap_ofs = MIN(cursor.wrap_ofs, times_line_wraps(first_vis_line));
+ } else {
+ cursor.wrap_ofs = 0;
}
- int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
+ set_line_as_first_visible(cursor.line_ofs, cursor.wrap_ofs);
+}
- if (cursor_x > (cursor.x_ofs + visible_width))
- cursor.x_ofs = cursor_x - visible_width + 1;
+bool TextEdit::line_wraps(int line) const {
- if (cursor_x < cursor.x_ofs)
- cursor.x_ofs = cursor_x;
+ ERR_FAIL_INDEX_V(line, text.size(), 0);
+ if (!is_wrap_enabled())
+ return false;
+ return text.get_line_width(line) > wrap_at;
+}
- updating_scrolls = true;
- h_scroll->set_value(cursor.x_ofs);
- update_line_scroll_pos();
- double new_v_scroll = get_line_scroll_pos();
- // keep offset if smooth scroll is enabled
- if (smooth_scroll_enabled) {
- new_v_scroll += fmod(v_scroll->get_value(), 1.0);
+int TextEdit::times_line_wraps(int line) const {
+
+ ERR_FAIL_INDEX_V(line, text.size(), 0);
+ if (!line_wraps(line))
+ return 0;
+
+ int wrap_amount = text.get_line_wrap_amount(line);
+ if (wrap_amount == -1) {
+ // update the value
+ Vector<String> rows = get_wrap_rows_text(line);
+ wrap_amount = rows.size() - 1;
+ text.set_line_wrap_amount(line, wrap_amount);
}
- v_scroll->set_value(new_v_scroll);
- updating_scrolls = false;
- update();
+
+ return wrap_amount;
+}
+
+Vector<String> TextEdit::get_wrap_rows_text(int p_line) const {
+
+ ERR_FAIL_INDEX_V(p_line, text.size(), Vector<String>());
+
+ Vector<String> lines;
+ if (!line_wraps(p_line)) {
+ lines.push_back(text[p_line]);
+ return lines;
+ }
+
+ int px = 0;
+ int col = 0;
+ String line_text = text[p_line];
+ String wrap_substring = "";
+
+ int word_px = 0;
+ String word_str = "";
+ int cur_wrap_index = 0;
+
+ int tab_offset_px = get_indent_level(p_line) * cache.font->get_char_size(' ').width;
+
+ while (col < line_text.length()) {
+ char c = line_text[col];
+ int w = text.get_char_width(c, line_text[col + 1], px + word_px);
+
+ int indent_ofs = (cur_wrap_index != 0 ? tab_offset_px : 0);
+
+ word_str += c;
+ word_px += w;
+ if (c == ' ') {
+ // end of a word; add this word to the substring
+ wrap_substring += word_str;
+ px += word_px;
+ word_str = "";
+ word_px = 0;
+ }
+
+ if ((indent_ofs + px + word_px) > wrap_at) {
+ // do not want to add this word
+ if (indent_ofs + word_px > wrap_at) {
+ // not enough space; add it anyway
+ wrap_substring += word_str;
+ px += word_px;
+ word_str = "";
+ word_px = 0;
+ }
+ lines.push_back(wrap_substring);
+ // reset for next wrap
+ cur_wrap_index++;
+ wrap_substring = "";
+ px = 0;
+ }
+ col++;
+ }
+ // line ends before hit wrap_at; add this word to the substring
+ wrap_substring += word_str;
+ px += word_px;
+ lines.push_back(wrap_substring);
+ return lines;
+}
+
+int TextEdit::get_cursor_wrap_index() const {
+
+ return get_line_wrap_index_at_col(cursor.line, cursor.column);
+}
+
+int TextEdit::get_line_wrap_index_at_col(int p_line, int p_column) const {
+
+ ERR_FAIL_INDEX_V(p_line, text.size(), 0);
+
+ if (!line_wraps(p_line))
+ return 0;
+
+ // loop through wraps in the line text until we get to the column
+ int wrap_index = 0;
+ int col = 0;
+ Vector<String> rows = get_wrap_rows_text(p_line);
+ for (int i = 0; i < rows.size(); i++) {
+ wrap_index = i;
+ String s = rows[wrap_index];
+ col += s.length();
+ if (col > p_column)
+ break;
+ }
+ return wrap_index;
}
void TextEdit::cursor_set_column(int p_col, bool p_adjust_viewport) {
@@ -3703,7 +3811,7 @@ void TextEdit::cursor_set_column(int p_col, bool p_adjust_viewport) {
if (cursor.column > get_line(cursor.line).length())
cursor.column = get_line(cursor.line).length();
- cursor.last_fit_x = get_column_x_offset(cursor.column, get_line(cursor.line));
+ cursor.last_fit_x = get_column_x_offset_for_line(cursor.column, cursor.line);
if (p_adjust_viewport)
adjust_viewport_to_cursor();
@@ -3715,7 +3823,7 @@ void TextEdit::cursor_set_column(int p_col, bool p_adjust_viewport) {
}
}
-void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport, bool p_can_be_hidden) {
+void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport, bool p_can_be_hidden, int p_wrap_index) {
if (setting_row)
return;
@@ -3724,8 +3832,8 @@ void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport, bool p_can_be_
if (p_row < 0)
p_row = 0;
- if (p_row >= (int)text.size())
- p_row = (int)text.size() - 1;
+ if (p_row >= text.size())
+ p_row = text.size() - 1;
if (!p_can_be_hidden) {
if (is_line_hidden(CLAMP(p_row, 0, text.size() - 1))) {
@@ -3743,7 +3851,18 @@ void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport, bool p_can_be_
}
}
cursor.line = p_row;
- cursor.column = get_char_pos_for(cursor.last_fit_x, get_line(cursor.line));
+
+ int n_col = get_char_pos_for_line(cursor.last_fit_x, p_row, p_wrap_index);
+ if (is_wrap_enabled() && p_wrap_index < times_line_wraps(p_row)) {
+ Vector<String> rows = get_wrap_rows_text(p_row);
+ int row_end_col = 0;
+ for (int i = 0; i < p_wrap_index + 1; i++) {
+ row_end_col += rows[i].length();
+ }
+ if (n_col >= row_end_col)
+ n_col -= 1;
+ }
+ cursor.column = n_col;
if (p_adjust_viewport)
adjust_viewport_to_cursor();
@@ -3820,9 +3939,25 @@ void TextEdit::_scroll_moved(double p_to_val) {
if (h_scroll->is_visible_in_tree())
cursor.x_ofs = h_scroll->get_value();
if (v_scroll->is_visible_in_tree()) {
- double val = v_scroll->get_value();
- cursor.line_ofs = num_lines_from(0, (int)floor(val));
- line_scroll_pos = (int)floor(val);
+
+ // set line ofs and wrap ofs
+ int v_scroll_i = floor(get_v_scroll());
+ int sc = 0;
+ int n_line;
+ for (n_line = 0; n_line < text.size(); n_line++) {
+ if (!is_line_hidden(n_line)) {
+ sc++;
+ sc += times_line_wraps(n_line);
+ if (sc > v_scroll_i)
+ break;
+ }
+ }
+ int line_wrap_amount = times_line_wraps(n_line);
+ int wi = line_wrap_amount - (sc - v_scroll_i - 1);
+ wi = CLAMP(wi, 0, line_wrap_amount);
+
+ cursor.line_ofs = n_line;
+ cursor.wrap_ofs = wi;
}
update();
}
@@ -3832,29 +3967,73 @@ int TextEdit::get_row_height() const {
return cache.font->get_height() + cache.line_spacing;
}
-int TextEdit::get_char_pos_for(int p_px, String p_str) const {
+int TextEdit::get_char_pos_for_line(int p_px, int p_line, int p_wrap_index) const {
- int px = 0;
- int c = 0;
+ ERR_FAIL_INDEX_V(p_line, text.size(), 0);
- int tab_w = cache.font->get_char_size(' ').width * indent_size;
+ if (line_wraps(p_line)) {
- while (c < p_str.length()) {
+ int line_wrap_amount = times_line_wraps(p_line);
+ int wrap_offset_px = get_indent_level(p_line) * cache.font->get_char_size(' ').width;
+ if (p_wrap_index > line_wrap_amount)
+ p_wrap_index = line_wrap_amount;
+ if (p_wrap_index > 0)
+ p_px -= wrap_offset_px;
+ else
+ p_wrap_index = 0;
+ Vector<String> rows = get_wrap_rows_text(p_line);
+ int c_pos = get_char_pos_for(p_px, rows[p_wrap_index]);
+ for (int i = 0; i < p_wrap_index; i++) {
+ String s = rows[i];
+ c_pos += s.length();
+ }
- int w = 0;
+ return c_pos;
+ } else {
- if (p_str[c] == '\t') {
+ return get_char_pos_for(p_px, text[p_line]);
+ }
+}
- int left = px % tab_w;
- if (left == 0)
- w = tab_w;
- else
- w = tab_w - px % tab_w; // is right...
+int TextEdit::get_column_x_offset_for_line(int p_char, int p_line) const {
- } else {
+ ERR_FAIL_INDEX_V(p_line, text.size(), 0);
- w = cache.font->get_char_size(p_str[c], p_str[c + 1]).width;
+ if (line_wraps(p_line)) {
+
+ int n_char = p_char;
+ int col = 0;
+ Vector<String> rows = get_wrap_rows_text(p_line);
+ int wrap_index = 0;
+ for (int i = 0; i < rows.size(); i++) {
+ wrap_index = i;
+ String s = rows[wrap_index];
+ col += s.length();
+ if (col > p_char)
+ break;
+ n_char -= s.length();
}
+ int px = get_column_x_offset(n_char, rows[wrap_index]);
+
+ int wrap_offset_px = get_indent_level(p_line) * cache.font->get_char_size(' ').width;
+ if (wrap_index != 0)
+ px += wrap_offset_px;
+
+ return px;
+ } else {
+
+ return get_column_x_offset(p_char, text[p_line]);
+ }
+}
+
+int TextEdit::get_char_pos_for(int p_px, String p_str) const {
+
+ int px = 0;
+ int c = 0;
+
+ while (c < p_str.length()) {
+
+ int w = text.get_char_width(p_str[c], p_str[c + 1], px);
if (p_px < (px + w / 2))
break;
@@ -3865,28 +4044,16 @@ int TextEdit::get_char_pos_for(int p_px, String p_str) const {
return c;
}
-int TextEdit::get_column_x_offset(int p_char, String p_str) {
+int TextEdit::get_column_x_offset(int p_char, String p_str) const {
int px = 0;
- int tab_w = cache.font->get_char_size(' ').width * indent_size;
-
for (int i = 0; i < p_char; i++) {
if (i >= p_str.length())
break;
- if (p_str[i] == '\t') {
-
- int left = px % tab_w;
- if (left == 0)
- px += tab_w;
- else
- px += tab_w - px % tab_w; // is right...
-
- } else {
- px += cache.font->get_char_size(p_str[i], p_str[i + 1]).width;
- }
+ px += text.get_char_width(p_str[i], p_str[i + 1], px);
}
return px;
@@ -3955,20 +4122,20 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const {
void TextEdit::set_text(String p_text) {
setting_text = true;
- clear();
+ _clear();
_insert_text_at_cursor(p_text);
clear_undo_history();
cursor.column = 0;
cursor.line = 0;
cursor.x_ofs = 0;
cursor.line_ofs = 0;
- line_scroll_pos = 0;
+ cursor.wrap_ofs = 0;
cursor.last_fit_x = 0;
cursor_set_line(0);
cursor_set_column(0);
update();
setting_text = false;
- _text_changed_emit();
+
//get_range()->set(0);
};
@@ -4048,7 +4215,7 @@ void TextEdit::_clear() {
cursor.line = 0;
cursor.x_ofs = 0;
cursor.line_ofs = 0;
- line_scroll_pos = 0;
+ cursor.wrap_ofs = 0;
cursor.last_fit_x = 0;
}
@@ -4070,14 +4237,14 @@ bool TextEdit::is_readonly() const {
return readonly;
}
-void TextEdit::set_wrap(bool p_wrap) {
+void TextEdit::set_wrap_enabled(bool p_wrap_enabled) {
- wrap = p_wrap;
+ wrap_enabled = p_wrap_enabled;
}
-bool TextEdit::is_wrapping() const {
+bool TextEdit::is_wrap_enabled() const {
- return wrap;
+ return wrap_enabled;
}
void TextEdit::set_max_chars(int p_max_chars) {
@@ -4144,13 +4311,89 @@ void TextEdit::_update_caches() {
cache.can_fold_icon = get_icon("GuiTreeArrowDown", "EditorIcons");
cache.folded_eol_icon = get_icon("GuiEllipsis", "EditorIcons");
text.set_font(cache.font);
+
+ if (syntax_highlighter) {
+ syntax_highlighter->_update_cache();
+ }
+}
+
+SyntaxHighlighter *TextEdit::_get_syntax_highlighting() {
+ return syntax_highlighter;
+}
+
+void TextEdit::_set_syntax_highlighting(SyntaxHighlighter *p_syntax_highlighter) {
+ syntax_highlighter = p_syntax_highlighter;
+ if (syntax_highlighter) {
+ syntax_highlighter->set_text_editor(this);
+ syntax_highlighter->_update_cache();
+ }
+ update();
+}
+
+int TextEdit::_is_line_in_region(int p_line) {
+
+ // do we have in cache?
+ if (color_region_cache.has(p_line)) {
+ return color_region_cache[p_line];
+ }
+
+ // if not find the closest line we have
+ int previous_line = p_line - 1;
+ for (previous_line; previous_line > -1; previous_line--) {
+ if (color_region_cache.has(p_line)) {
+ break;
+ }
+ }
+
+ // calculate up to line we need and update the cache along the way.
+ int in_region = color_region_cache[previous_line];
+ if (previous_line == -1) {
+ in_region = -1;
+ }
+ for (int i = previous_line; i < p_line; i++) {
+ const Map<int, Text::ColorRegionInfo> &cri_map = _get_line_color_region_info(i);
+ for (const Map<int, Text::ColorRegionInfo>::Element *E = cri_map.front(); E; E = E->next()) {
+ const Text::ColorRegionInfo &cri = E->get();
+ if (in_region == -1) {
+ if (!cri.end) {
+ in_region = cri.region;
+ }
+ } else if (in_region == cri.region && !_get_color_region(cri.region).line_only) {
+ if (cri.end || _get_color_region(cri.region).eq) {
+ in_region = -1;
+ }
+ }
+ }
+
+ if (in_region >= 0 && _get_color_region(in_region).line_only) {
+ in_region = -1;
+ }
+
+ color_region_cache[i + 1] = in_region;
+ }
+ return in_region;
+}
+
+TextEdit::ColorRegion TextEdit::_get_color_region(int p_region) const {
+ if (p_region < 0 || p_region >= color_regions.size()) {
+ return ColorRegion();
+ }
+ return color_regions[p_region];
+}
+
+Map<int, TextEdit::Text::ColorRegionInfo> TextEdit::_get_line_color_region_info(int p_line) const {
+ if (p_line < 0 || p_line > text.size() - 1) {
+ return Map<int, Text::ColorRegionInfo>();
+ }
+ return text.get_color_region_info(p_line);
}
void TextEdit::clear_colors() {
keywords.clear();
color_regions.clear();
- text.clear_caches();
+ color_region_cache.clear();
+ text.clear_width_cache();
}
void TextEdit::add_keyword_color(const String &p_keyword, const Color &p_color) {
@@ -4159,10 +4402,18 @@ void TextEdit::add_keyword_color(const String &p_keyword, const Color &p_color)
update();
}
+bool TextEdit::has_keyword_color(String p_keyword) const {
+ return keywords.has(p_keyword);
+}
+
+Color TextEdit::get_keyword_color(String p_keyword) const {
+ return keywords[p_keyword];
+}
+
void TextEdit::add_color_region(const String &p_begin_key, const String &p_end_key, const Color &p_color, bool p_line_only) {
color_regions.push_back(ColorRegion(p_begin_key, p_end_key, p_color, p_line_only));
- text.clear_caches();
+ text.clear_width_cache();
update();
}
@@ -4171,6 +4422,14 @@ void TextEdit::add_member_keyword(const String &p_keyword, const Color &p_color)
update();
}
+bool TextEdit::has_member_color(String p_member) const {
+ return member_keywords.has(p_member);
+}
+
+Color TextEdit::get_member_color(String p_member) const {
+ return member_keywords[p_member];
+}
+
void TextEdit::clear_member_keywords() {
member_keywords.clear();
update();
@@ -4239,6 +4498,7 @@ void TextEdit::paste() {
String clipboard = OS::get_singleton()->get_clipboard();
+ begin_complex_operation();
if (selection.active) {
selection.active = false;
@@ -4255,6 +4515,8 @@ void TextEdit::paste() {
}
_insert_text_at_cursor(clipboard);
+ end_complex_operation();
+
update();
}
@@ -4648,52 +4910,99 @@ void TextEdit::unhide_all_lines() {
update();
}
-int TextEdit::num_lines_from(int p_line_from, int unhidden_amount) const {
+int TextEdit::num_lines_from(int p_line_from, int visible_amount) const {
- // returns the number of hidden and unhidden lines from p_line_from to p_line_from + amount of visible lines
- ERR_FAIL_INDEX_V(p_line_from, text.size(), ABS(unhidden_amount));
+ // returns the number of lines (hidden and unhidden) from p_line_from to (p_line_from + visible_amount of unhidden lines)
+ ERR_FAIL_INDEX_V(p_line_from, text.size(), ABS(visible_amount));
if (!is_hiding_enabled())
- return ABS(unhidden_amount);
+ return ABS(visible_amount);
+
int num_visible = 0;
int num_total = 0;
- if (unhidden_amount >= 0) {
+ if (visible_amount >= 0) {
for (int i = p_line_from; i < text.size(); i++) {
num_total++;
- if (!is_line_hidden(i))
+ if (!is_line_hidden(i)) {
num_visible++;
- if (num_visible >= unhidden_amount)
+ }
+ if (num_visible >= visible_amount)
break;
}
} else {
- unhidden_amount = ABS(unhidden_amount);
+ visible_amount = ABS(visible_amount);
for (int i = p_line_from; i >= 0; i--) {
num_total++;
- if (!is_line_hidden(i))
+ if (!is_line_hidden(i)) {
num_visible++;
- if (num_visible >= unhidden_amount)
+ }
+ if (num_visible >= visible_amount)
break;
}
}
return num_total;
}
-bool TextEdit::is_last_visible_line(int p_line) const {
+int TextEdit::num_lines_from_rows(int p_line_from, int p_wrap_index_from, int visible_amount, int &wrap_index) const {
- ERR_FAIL_INDEX_V(p_line, text.size(), false);
+ // returns the number of lines (hidden and unhidden) from (p_line_from + p_wrap_index_from) row to (p_line_from + visible_amount of unhidden and wrapped rows)
+ // wrap index is set to the wrap index of the last line
+ wrap_index = 0;
+ ERR_FAIL_INDEX_V(p_line_from, text.size(), ABS(visible_amount));
- if (p_line == text.size() - 1)
- return true;
+ if (!is_hiding_enabled() && !is_wrap_enabled())
+ return ABS(visible_amount);
+ int num_visible = 0;
+ int num_total = 0;
+ if (visible_amount == 0) {
+ num_total = 0;
+ wrap_index = 0;
+ } else if (visible_amount > 0) {
+ int i;
+ num_visible -= p_wrap_index_from;
+ for (i = p_line_from; i < text.size(); i++) {
+ num_total++;
+ if (!is_line_hidden(i)) {
+ num_visible++;
+ num_visible += times_line_wraps(i);
+ }
+ if (num_visible >= visible_amount)
+ break;
+ }
+ wrap_index = times_line_wraps(MIN(i, text.size() - 1)) - (num_visible - visible_amount);
+ } else {
+ visible_amount = ABS(visible_amount);
+ int i;
+ num_visible -= times_line_wraps(p_line_from) - p_wrap_index_from;
+ for (i = p_line_from; i >= 0; i--) {
+ num_total++;
+ if (!is_line_hidden(i)) {
+ num_visible++;
+ num_visible += times_line_wraps(i);
+ }
+ if (num_visible >= visible_amount)
+ break;
+ }
+ wrap_index = (num_visible - visible_amount);
+ }
+ wrap_index = MAX(wrap_index, 0);
+ return num_total;
+}
+
+int TextEdit::get_last_unhidden_line() const {
+
+ // returns the last line in the text that is not hidden
if (!is_hiding_enabled())
- return false;
+ return text.size() - 1;
- for (int i = p_line + 1; i < text.size(); i++) {
- if (!is_line_hidden(i))
- return false;
+ int last_line;
+ for (last_line = text.size() - 1; last_line > 0; last_line--) {
+ if (!is_line_hidden(last_line)) {
+ break;
+ }
}
-
- return true;
+ return last_line;
}
int TextEdit::get_indent_level(int p_line) const {
@@ -4713,7 +5022,7 @@ int TextEdit::get_indent_level(int p_line) const {
break;
}
}
- return tab_count + whitespace_count / indent_size;
+ return tab_count * indent_size + whitespace_count;
}
bool TextEdit::is_line_comment(int p_line) const {
@@ -5043,6 +5352,11 @@ void TextEdit::set_indent_size(const int p_size) {
update();
}
+int TextEdit::get_indent_size() {
+
+ return indent_size;
+}
+
void TextEdit::set_draw_tabs(bool p_draw) {
draw_tabs = p_draw;
@@ -5056,6 +5370,7 @@ bool TextEdit::is_drawing_tabs() const {
void TextEdit::set_override_selected_font_color(bool p_override_selected_font_color) {
override_selected_font_color = p_override_selected_font_color;
}
+
bool TextEdit::is_overriding_selected_font_color() const {
return override_selected_font_color;
}
@@ -5076,58 +5391,143 @@ bool TextEdit::is_insert_text_operation() {
uint32_t TextEdit::get_version() const {
return current_op.version;
}
+
uint32_t TextEdit::get_saved_version() const {
return saved_version;
}
+
void TextEdit::tag_saved_version() {
saved_version = get_version();
}
-int TextEdit::get_v_scroll() const {
+double TextEdit::get_scroll_pos_for_line(int p_line, int p_wrap_index) const {
- return v_scroll->get_value();
-}
-void TextEdit::set_v_scroll(int p_scroll) {
+ if (!is_wrap_enabled() && !is_hiding_enabled())
+ return p_line;
- if (p_scroll < 0) {
- p_scroll = 0;
- }
- if (!scroll_past_end_of_file_enabled) {
- if (p_scroll + get_visible_rows() > get_total_unhidden_rows()) {
- int num_rows = num_lines_from(CLAMP(p_scroll, 0, text.size() - 1), MIN(get_visible_rows(), text.size() - 1 - p_scroll));
- p_scroll = text.size() - num_rows;
+ // count the number of visible lines up to this line
+ double new_line_scroll_pos = 0;
+ int to = CLAMP(p_line, 0, text.size() - 1);
+ for (int i = 0; i < to; i++) {
+ if (!text.is_hidden(i)) {
+ new_line_scroll_pos++;
+ new_line_scroll_pos += times_line_wraps(i);
}
}
+ new_line_scroll_pos += p_wrap_index;
+ return new_line_scroll_pos;
+}
+
+void TextEdit::set_line_as_first_visible(int p_line, int p_wrap_index) {
+
+ set_v_scroll(get_scroll_pos_for_line(p_line, p_wrap_index));
+}
+
+void TextEdit::set_line_as_center_visible(int p_line, int p_wrap_index) {
+
+ int visible_rows = get_visible_rows();
+ int wi;
+ int first_line = p_line - num_lines_from_rows(p_line, p_wrap_index, -visible_rows / 2, wi) + 1;
+
+ set_v_scroll(get_scroll_pos_for_line(first_line, wi));
+}
+
+void TextEdit::set_line_as_last_visible(int p_line, int p_wrap_index) {
+
+ int wi;
+ int first_line = p_line - num_lines_from_rows(p_line, p_wrap_index, -get_visible_rows() - 1, wi) + 1;
+
+ set_v_scroll(get_scroll_pos_for_line(first_line, wi) + get_visible_rows_offset());
+}
+
+int TextEdit::get_first_visible_line() const {
+
+ return CLAMP(cursor.line_ofs, 0, text.size() - 1);
+}
+
+int TextEdit::get_last_visible_line() const {
+
+ int first_vis_line = get_first_visible_line();
+ int last_vis_line = 0;
+ int wi;
+ last_vis_line = first_vis_line + num_lines_from_rows(first_vis_line, cursor.wrap_ofs, get_visible_rows() + 1, wi) - 1;
+ last_vis_line = CLAMP(last_vis_line, 0, text.size() - 1);
+ return last_vis_line;
+}
+
+int TextEdit::get_last_visible_line_wrap_index() const {
+
+ int first_vis_line = get_first_visible_line();
+ int last_vis_line = 0;
+ int wi;
+ last_vis_line = first_vis_line + num_lines_from_rows(first_vis_line, cursor.wrap_ofs, get_visible_rows() + 1, wi) - 1;
+ return wi;
+}
+
+double TextEdit::get_visible_rows_offset() const {
+
+ double total = cache.size.height;
+ total -= cache.style_normal->get_minimum_size().height;
+ if (h_scroll->is_visible_in_tree())
+ total -= h_scroll->get_size().height;
+ total /= (double)get_row_height();
+ total = total - floor(total);
+ total = -CLAMP(total, 0.001, 1) + 1;
+ return total;
+}
+
+double TextEdit::get_v_scroll_offset() const {
+
+ double val = get_v_scroll() - floor(get_v_scroll());
+ return CLAMP(val, 0, 1);
+}
+
+double TextEdit::get_v_scroll() const {
+
+ return v_scroll->get_value();
+}
+
+void TextEdit::set_v_scroll(double p_scroll) {
+
v_scroll->set_value(p_scroll);
- cursor.line_ofs = num_lines_from(0, p_scroll);
- line_scroll_pos = p_scroll;
+ int max_v_scroll = v_scroll->get_max() - v_scroll->get_page();
+ if (p_scroll >= max_v_scroll - 1.0)
+ _scroll_moved(v_scroll->get_value());
}
int TextEdit::get_h_scroll() const {
return h_scroll->get_value();
}
+
void TextEdit::set_h_scroll(int p_scroll) {
+ if (p_scroll < 0) {
+ p_scroll = 0;
+ }
h_scroll->set_value(p_scroll);
}
void TextEdit::set_smooth_scroll_enabled(bool p_enable) {
+
v_scroll->set_smooth_scroll_enabled(p_enable);
smooth_scroll_enabled = p_enable;
}
bool TextEdit::is_smooth_scroll_enabled() const {
+
return smooth_scroll_enabled;
}
void TextEdit::set_v_scroll_speed(float p_speed) {
+
v_scroll_speed = p_speed;
}
float TextEdit::get_v_scroll_speed() const {
+
return v_scroll_speed;
}
@@ -5232,7 +5632,7 @@ void TextEdit::_update_completion_candidates() {
} else {
- while (cofs > 0 && l[cofs - 1] > 32 && _is_completable(l[cofs - 1])) {
+ while (cofs > 0 && l[cofs - 1] > 32 && (l[cofs - 1] == '/' || _is_completable(l[cofs - 1]))) {
s = String::chr(l[cofs - 1]) + s;
if (l[cofs - 1] == '\'' || l[cofs - 1] == '"' || l[cofs - 1] == '$')
break;
@@ -5374,18 +5774,23 @@ String TextEdit::get_word_at_pos(const Vector2 &p_pos) const {
if (select_word(s, col, beg, end)) {
bool inside_quotes = false;
+ char selected_quote = '\0';
int qbegin = 0, qend = 0;
for (int i = 0; i < s.length(); i++) {
- if (s[i] == '"') {
- if (inside_quotes) {
- qend = i;
- inside_quotes = false;
- if (col >= qbegin && col <= qend) {
- return s.substr(qbegin, qend - qbegin);
+ if (s[i] == '"' || s[i] == '\'') {
+ if (i == 0 || s[i - 1] != '\\') {
+ if (inside_quotes && selected_quote == s[i]) {
+ qend = i;
+ inside_quotes = false;
+ selected_quote = '\0';
+ if (col >= qbegin && col <= qend) {
+ return s.substr(qbegin, qend - qbegin);
+ }
+ } else if (!inside_quotes) {
+ qbegin = i + 1;
+ inside_quotes = true;
+ selected_quote = s[i];
}
- } else {
- qbegin = i + 1;
- inside_quotes = true;
}
}
}
@@ -5607,7 +6012,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport", "can_be_hidden"), &TextEdit::cursor_set_line, DEFVAL(true), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport", "can_be_hidden", "wrap_index"), &TextEdit::cursor_set_line, DEFVAL(true), DEFVAL(true), DEFVAL(0));
ClassDB::bind_method(D_METHOD("cursor_get_column"), &TextEdit::cursor_get_column);
ClassDB::bind_method(D_METHOD("cursor_get_line"), &TextEdit::cursor_get_line);
@@ -5624,8 +6029,8 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_readonly", "enable"), &TextEdit::set_readonly);
ClassDB::bind_method(D_METHOD("is_readonly"), &TextEdit::is_readonly);
- ClassDB::bind_method(D_METHOD("set_wrap", "enable"), &TextEdit::set_wrap);
- ClassDB::bind_method(D_METHOD("is_wrapping"), &TextEdit::is_wrapping);
+ ClassDB::bind_method(D_METHOD("set_wrap_enabled", "enable"), &TextEdit::set_wrap_enabled);
+ ClassDB::bind_method(D_METHOD("is_wrap_enabled"), &TextEdit::is_wrap_enabled);
// ClassDB::bind_method(D_METHOD("set_max_chars", "amount"), &TextEdit::set_max_chars);
// ClassDB::bind_method(D_METHOD("get_max_char"), &TextEdit::get_max_chars);
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &TextEdit::set_context_menu_enabled);
@@ -5685,6 +6090,8 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_v_scroll_speed"), &TextEdit::get_v_scroll_speed);
ClassDB::bind_method(D_METHOD("add_keyword_color", "keyword", "color"), &TextEdit::add_keyword_color);
+ ClassDB::bind_method(D_METHOD("has_keyword_color", "keyword"), &TextEdit::has_keyword_color);
+ ClassDB::bind_method(D_METHOD("get_keyword_color", "keyword"), &TextEdit::get_keyword_color);
ClassDB::bind_method(D_METHOD("add_color_region", "begin_key", "end_key", "color", "line_only"), &TextEdit::add_color_region, DEFVAL(false));
ClassDB::bind_method(D_METHOD("clear_colors"), &TextEdit::clear_colors);
ClassDB::bind_method(D_METHOD("menu_option", "option"), &TextEdit::menu_option);
@@ -5701,13 +6108,13 @@ void TextEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hiding_enabled"), "set_hiding_enabled", "is_hiding_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "wrap_lines"), "set_wrap", "is_wrapping");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "wrap_enabled"), "set_wrap_enabled", "is_wrap_enabled");
// ADD_PROPERTY(PropertyInfo(Variant::BOOL, "max_chars"), "set_max_chars", "get_max_chars");
ADD_GROUP("Caret", "caret_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_block_mode"), "cursor_set_block_mode", "cursor_is_block_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_blink"), "cursor_set_blink_enabled", "cursor_get_blink_enabled");
- ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret_blink_speed", PROPERTY_HINT_RANGE, "0.1,10,0.1"), "cursor_set_blink_speed", "cursor_get_blink_speed");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret_blink_speed", PROPERTY_HINT_RANGE, "0.1,10,0.01"), "cursor_set_blink_speed", "cursor_get_blink_speed");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_moving_by_right_click"), "set_right_click_moves_caret", "is_right_click_moving_caret");
ADD_SIGNAL(MethodInfo("cursor_changed"));
@@ -5736,8 +6143,10 @@ TextEdit::TextEdit() {
draw_caret = true;
max_chars = 0;
clear();
- wrap = false;
+ wrap_enabled = false;
+ wrap_right_offset = 10;
set_focus_mode(FOCUS_ALL);
+ syntax_highlighter = NULL;
_update_caches();
cache.size = Size2(1, 1);
cache.row_height = 1;
@@ -5751,7 +6160,7 @@ TextEdit::TextEdit() {
indent_size = 4;
text.set_indent_size(indent_size);
text.clear();
- //text.insert(1,"Mongolia..");
+ //text.insert(1,"Mongolia...");
//text.insert(2,"PAIS GENEROSO!!");
text.set_color_regions(&color_regions);
@@ -5841,16 +6250,213 @@ TextEdit::TextEdit() {
context_menu_enabled = true;
menu = memnew(PopupMenu);
add_child(menu);
- menu->add_item(TTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
- menu->add_item(TTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
- menu->add_item(TTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
+ menu->add_item(RTR("Cut"), MENU_CUT, KEY_MASK_CMD | KEY_X);
+ menu->add_item(RTR("Copy"), MENU_COPY, KEY_MASK_CMD | KEY_C);
+ menu->add_item(RTR("Paste"), MENU_PASTE, KEY_MASK_CMD | KEY_V);
menu->add_separator();
- menu->add_item(TTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
- menu->add_item(TTR("Clear"), MENU_CLEAR);
+ menu->add_item(RTR("Select All"), MENU_SELECT_ALL, KEY_MASK_CMD | KEY_A);
+ menu->add_item(RTR("Clear"), MENU_CLEAR);
menu->add_separator();
- menu->add_item(TTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
+ menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z);
menu->connect("id_pressed", this, "menu_option");
}
TextEdit::~TextEdit() {
}
+
+///////////////////////////////////////////////////////////////////////////////
+
+Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int p_line) {
+ if (syntax_highlighter != NULL) {
+ return syntax_highlighter->_get_line_syntax_highlighting(p_line);
+ }
+
+ Map<int, HighlighterInfo> color_map;
+
+ bool prev_is_char = false;
+ bool prev_is_number = false;
+ bool in_keyword = false;
+ bool in_word = false;
+ bool in_function_name = false;
+ bool in_member_variable = false;
+ bool is_hex_notation = false;
+ Color keyword_color;
+ Color color;
+
+ int in_region = _is_line_in_region(p_line);
+ int deregion = 0;
+
+ const Map<int, TextEdit::Text::ColorRegionInfo> cri_map = text.get_color_region_info(p_line);
+ const String &str = text[p_line];
+ Color prev_color;
+ for (int j = 0; j < str.length(); j++) {
+ HighlighterInfo highlighter_info;
+
+ if (deregion > 0) {
+ deregion--;
+ if (deregion == 0) {
+ in_region = -1;
+ }
+ }
+
+ if (deregion != 0) {
+ if (color != prev_color) {
+ prev_color = color;
+ highlighter_info.color = color;
+ color_map[j] = highlighter_info;
+ }
+ continue;
+ }
+
+ color = cache.font_color;
+
+ bool is_char = _is_text_char(str[j]);
+ bool is_symbol = _is_symbol(str[j]);
+ bool is_number = _is_number(str[j]);
+
+ // allow ABCDEF in hex notation
+ if (is_hex_notation && (_is_hex_symbol(str[j]) || is_number)) {
+ is_number = true;
+ } else {
+ is_hex_notation = false;
+ }
+
+ // check for dot or underscore or 'x' for hex notation in floating point number
+ if ((str[j] == '.' || str[j] == 'x' || str[j] == '_') && !in_word && prev_is_number && !is_number) {
+ is_number = true;
+ is_symbol = false;
+ is_char = false;
+
+ if (str[j] == 'x' && str[j - 1] == '0') {
+ is_hex_notation = true;
+ }
+ }
+
+ if (!in_word && _is_char(str[j]) && !is_number) {
+ in_word = true;
+ }
+
+ if ((in_keyword || in_word) && !is_hex_notation) {
+ is_number = false;
+ }
+
+ if (is_symbol && str[j] != '.' && in_word) {
+ in_word = false;
+ }
+
+ if (is_symbol && cri_map.has(j)) {
+ const TextEdit::Text::ColorRegionInfo &cri = cri_map[j];
+
+ if (in_region == -1) {
+ if (!cri.end) {
+ in_region = cri.region;
+ }
+ } else if (in_region == cri.region && !color_regions[cri.region].line_only) { //ignore otherwise
+ if (cri.end || color_regions[cri.region].eq) {
+ deregion = color_regions[cri.region].eq ? color_regions[cri.region].begin_key.length() : color_regions[cri.region].end_key.length();
+ }
+ }
+ }
+
+ if (!is_char) {
+ in_keyword = false;
+ }
+
+ if (in_region == -1 && !in_keyword && is_char && !prev_is_char) {
+
+ int to = j;
+ while (to < str.length() && _is_text_char(str[to]))
+ to++;
+
+ uint32_t hash = String::hash(&str[j], to - j);
+ StrRange range(&str[j], to - j);
+
+ const Color *col = keywords.custom_getptr(range, hash);
+
+ if (!col) {
+ col = member_keywords.custom_getptr(range, hash);
+
+ if (col) {
+ for (int k = j - 1; k >= 0; k--) {
+ if (str[k] == '.') {
+ col = NULL; //member indexing not allowed
+ break;
+ } else if (str[k] > 32) {
+ break;
+ }
+ }
+ }
+ }
+
+ if (col) {
+ in_keyword = true;
+ keyword_color = *col;
+ }
+ }
+
+ if (!in_function_name && in_word && !in_keyword) {
+
+ int k = j;
+ while (k < str.length() && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') {
+ k++;
+ }
+
+ // check for space between name and bracket
+ while (k < str.length() && (str[k] == '\t' || str[k] == ' ')) {
+ k++;
+ }
+
+ if (str[k] == '(') {
+ in_function_name = true;
+ }
+ }
+
+ if (!in_function_name && !in_member_variable && !in_keyword && !is_number && in_word) {
+ int k = j;
+ while (k > 0 && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') {
+ k--;
+ }
+
+ if (str[k] == '.') {
+ in_member_variable = true;
+ }
+ }
+
+ if (is_symbol) {
+ in_function_name = false;
+ in_member_variable = false;
+ }
+
+ if (in_region >= 0)
+ color = color_regions[in_region].color;
+ else if (in_keyword)
+ color = keyword_color;
+ else if (in_member_variable)
+ color = cache.member_variable_color;
+ else if (in_function_name)
+ color = cache.function_color;
+ else if (is_symbol)
+ color = cache.symbol_color;
+ else if (is_number)
+ color = cache.number_color;
+
+ prev_is_char = is_char;
+ prev_is_number = is_number;
+
+ if (color != prev_color) {
+ prev_color = color;
+ highlighter_info.color = color;
+ color_map[j] = highlighter_info;
+ }
+ }
+
+ return color_map;
+}
+
+void SyntaxHighlighter::set_text_editor(TextEdit *p_text_editor) {
+ text_editor = p_text_editor;
+}
+
+TextEdit *SyntaxHighlighter::get_text_editor() {
+ return text_editor;
+}
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 8ac3b9fce6..5c82d1ac20 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -36,14 +36,91 @@
#include "scene/gui/scroll_bar.h"
#include "scene/main/timer.h"
+class SyntaxHighlighter;
+
class TextEdit : public Control {
- GDCLASS(TextEdit, Control);
+ GDCLASS(TextEdit, Control)
+
+public:
+ struct HighlighterInfo {
+ Color color;
+ };
+
+ struct ColorRegion {
+ Color color;
+ String begin_key;
+ String end_key;
+ bool line_only;
+ bool eq;
+ ColorRegion(const String &p_begin_key = "", const String &p_end_key = "", const Color &p_color = Color(), bool p_line_only = false) {
+ begin_key = p_begin_key;
+ end_key = p_end_key;
+ color = p_color;
+ line_only = p_line_only || p_end_key == "";
+ eq = begin_key == end_key;
+ }
+ };
+
+ class Text {
+ public:
+ struct ColorRegionInfo {
+
+ int region;
+ bool end;
+ };
+
+ struct Line {
+ int width_cache : 24;
+ bool marked : 1;
+ bool breakpoint : 1;
+ bool hidden : 1;
+ int wrap_amount_cache : 24;
+ Map<int, ColorRegionInfo> region_info;
+ String data;
+ };
+
+ private:
+ const Vector<ColorRegion> *color_regions;
+ mutable Vector<Line> text;
+ Ref<Font> font;
+ int indent_size;
+
+ void _update_line_cache(int p_line) const;
+
+ public:
+ void set_indent_size(int p_indent_size);
+ void set_font(const Ref<Font> &p_font);
+ void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; }
+ int get_line_width(int p_line) const;
+ int get_max_width(bool p_exclude_hidden = false) const;
+ int get_char_width(CharType c, CharType next_c, int px) const;
+ void set_line_wrap_amount(int p_line, int p_wrap_amount) const;
+ int get_line_wrap_amount(int p_line) const;
+ const Map<int, ColorRegionInfo> &get_color_region_info(int p_line) const;
+ void set(int p_line, const String &p_text);
+ void set_marked(int p_line, bool p_marked) { text[p_line].marked = p_marked; }
+ bool is_marked(int p_line) const { return text[p_line].marked; }
+ void set_breakpoint(int p_line, bool p_breakpoint) { text[p_line].breakpoint = p_breakpoint; }
+ bool is_breakpoint(int p_line) const { return text[p_line].breakpoint; }
+ void set_hidden(int p_line, bool p_hidden) { text[p_line].hidden = p_hidden; }
+ bool is_hidden(int p_line) const { return text[p_line].hidden; }
+ void insert(int p_at, const String &p_text);
+ void remove(int p_at);
+ int size() const { return text.size(); }
+ void clear();
+ void clear_width_cache();
+ void clear_wrap_cache();
+ _FORCE_INLINE_ const String &operator[](int p_line) const { return text[p_line].data; }
+ Text() { indent_size = 4; }
+ };
+
+private:
struct Cursor {
int last_fit_x;
int line, column; ///< cursor
- int x_ofs, line_ofs;
+ int x_ofs, line_ofs, wrap_ofs;
} cursor;
struct Selection {
@@ -115,69 +192,7 @@ class TextEdit : public Control {
Size2 size;
} cache;
- struct ColorRegion {
-
- Color color;
- String begin_key;
- String end_key;
- bool line_only;
- bool eq;
- ColorRegion(const String &p_begin_key = "", const String &p_end_key = "", const Color &p_color = Color(), bool p_line_only = false) {
- begin_key = p_begin_key;
- end_key = p_end_key;
- color = p_color;
- line_only = p_line_only || p_end_key == "";
- eq = begin_key == end_key;
- }
- };
-
- class Text {
- public:
- struct ColorRegionInfo {
-
- int region;
- bool end;
- };
-
- struct Line {
- int width_cache : 24;
- bool marked : 1;
- bool breakpoint : 1;
- bool hidden : 1;
- Map<int, ColorRegionInfo> region_info;
- String data;
- };
-
- private:
- const Vector<ColorRegion> *color_regions;
- mutable Vector<Line> text;
- Ref<Font> font;
- int indent_size;
-
- void _update_line_cache(int p_line) const;
-
- public:
- void set_indent_size(int p_indent_size);
- void set_font(const Ref<Font> &p_font);
- void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; }
- int get_line_width(int p_line) const;
- int get_max_width(bool p_exclude_hidden = false) const;
- const Map<int, ColorRegionInfo> &get_color_region_info(int p_line) const;
- void set(int p_line, const String &p_text);
- void set_marked(int p_line, bool p_marked) { text[p_line].marked = p_marked; }
- bool is_marked(int p_line) const { return text[p_line].marked; }
- void set_breakpoint(int p_line, bool p_breakpoint) { text[p_line].breakpoint = p_breakpoint; }
- bool is_breakpoint(int p_line) const { return text[p_line].breakpoint; }
- void set_hidden(int p_line, bool p_hidden) { text[p_line].hidden = p_hidden; }
- bool is_hidden(int p_line) const { return text[p_line].hidden; }
- void insert(int p_at, const String &p_text);
- void remove(int p_at);
- int size() const { return text.size(); }
- void clear();
- void clear_caches();
- _FORCE_INLINE_ const String &operator[](int p_line) const { return text[p_line].data; }
- Text() { indent_size = 4; }
- };
+ Map<int, int> color_region_cache;
struct TextOperation {
@@ -209,9 +224,12 @@ class TextEdit : public Control {
void _do_text_op(const TextOperation &p_op, bool p_reverse);
//syntax coloring
+ SyntaxHighlighter *syntax_highlighter;
HashMap<String, Color> keywords;
HashMap<String, Color> member_keywords;
+ Map<int, HighlighterInfo> _get_line_syntax_highlighting(int p_line);
+
Vector<ColorRegion> color_regions;
Set<String> completion_prefixes;
@@ -250,8 +268,11 @@ class TextEdit : public Control {
bool block_caret;
bool right_click_moves_caret;
+ bool wrap_enabled;
+ int wrap_at;
+ int wrap_right_offset;
+
bool setting_row;
- bool wrap;
bool draw_tabs;
bool override_selected_font_color;
bool cursor_changed_dirty;
@@ -308,19 +329,34 @@ class TextEdit : public Control {
int search_result_line;
int search_result_col;
- double line_scroll_pos;
-
bool context_menu_enabled;
int get_visible_rows() const;
- int get_total_unhidden_rows() const;
- double get_line_scroll_pos(bool p_recalculate = false) const;
- void update_line_scroll_pos();
-
+ int get_total_visible_rows() const;
+
+ void update_cursor_wrap_offset();
+ void update_wrap_at();
+ bool line_wraps(int line) const;
+ int times_line_wraps(int line) const;
+ Vector<String> get_wrap_rows_text(int p_line) const;
+ int get_cursor_wrap_index() const;
+ int get_line_wrap_index_at_col(int p_line, int p_column) const;
int get_char_count();
+ double get_scroll_pos_for_line(int p_line, int p_wrap_index = 0) const;
+ void set_line_as_first_visible(int p_line, int p_wrap_index = 0);
+ void set_line_as_center_visible(int p_line, int p_wrap_index = 0);
+ void set_line_as_last_visible(int p_line, int p_wrap_index = 0);
+ int get_first_visible_line() const;
+ int get_last_visible_line() const;
+ int get_last_visible_line_wrap_index() const;
+ double get_visible_rows_offset() const;
+ double get_v_scroll_offset() const;
+
+ int get_char_pos_for_line(int p_px, int p_line, int p_wrap_index = 0) const;
+ int get_column_x_offset_for_line(int p_char, int p_line) const;
int get_char_pos_for(int p_px, String p_str) const;
- int get_column_x_offset(int p_char, String p_str);
+ int get_column_x_offset(int p_char, String p_str) const;
void adjust_viewport_to_cursor();
double get_scroll_line_diff() const;
@@ -355,6 +391,7 @@ class TextEdit : public Control {
void _update_caches();
void _cursor_changed_emit();
void _text_changed_emit();
+ void _line_edited_from(int p_line);
void _push_current_op();
@@ -391,6 +428,13 @@ protected:
static void _bind_methods();
public:
+ SyntaxHighlighter *_get_syntax_highlighting();
+ void _set_syntax_highlighting(SyntaxHighlighter *p_syntax_highlighter);
+
+ int _is_line_in_region(int p_line);
+ ColorRegion _get_color_region(int p_region) const;
+ Map<int, Text::ColorRegionInfo> _get_line_color_region_info(int p_line) const;
+
enum MenuItems {
MENU_CUT,
MENU_COPY,
@@ -434,8 +478,10 @@ public:
bool is_line_hidden(int p_line) const;
void fold_all_lines();
void unhide_all_lines();
- int num_lines_from(int p_line_from, int unhidden_amount) const;
- bool is_last_visible_line(int p_line) const;
+ int num_lines_from(int p_line_from, int visible_amount) const;
+ int num_lines_from_rows(int p_line_from, int p_wrap_index_from, int visible_amount, int &wrap_index) const;
+ int get_last_unhidden_line() const;
+
bool can_fold(int p_line) const;
bool is_folded(int p_line) const;
void fold_line(int p_line);
@@ -472,7 +518,7 @@ public:
void center_viewport_to_cursor();
void cursor_set_column(int p_col, bool p_adjust_viewport = true);
- void cursor_set_line(int p_row, bool p_adjust_viewport = true, bool p_can_be_hidden = true);
+ void cursor_set_line(int p_row, bool p_adjust_viewport = true, bool p_can_be_hidden = true, int p_wrap_index = 0);
int cursor_get_column() const;
int cursor_get_line() const;
@@ -495,8 +541,8 @@ public:
void set_max_chars(int p_max_chars);
int get_max_chars() const;
- void set_wrap(bool p_wrap);
- bool is_wrapping() const;
+ void set_wrap_enabled(bool p_wrap_enabled);
+ bool is_wrap_enabled() const;
void clear();
@@ -536,6 +582,7 @@ public:
void set_indent_using_spaces(const bool p_use_spaces);
bool is_indent_using_spaces() const;
void set_indent_size(const int p_size);
+ int get_indent_size();
void set_draw_tabs(bool p_draw);
bool is_drawing_tabs() const;
void set_override_selected_font_color(bool p_override_selected_font_color);
@@ -545,14 +592,19 @@ public:
bool is_insert_mode() const;
void add_keyword_color(const String &p_keyword, const Color &p_color);
+ bool has_keyword_color(String p_keyword) const;
+ Color get_keyword_color(String p_keyword) const;
+
void add_color_region(const String &p_begin_key = String(), const String &p_end_key = String(), const Color &p_color = Color(), bool p_line_only = false);
void clear_colors();
void add_member_keyword(const String &p_keyword, const Color &p_color);
+ bool has_member_color(String p_member) const;
+ Color get_member_color(String p_member) const;
void clear_member_keywords();
- int get_v_scroll() const;
- void set_v_scroll(int p_scroll);
+ double get_v_scroll() const;
+ void set_v_scroll(double p_scroll);
int get_h_scroll() const;
void set_h_scroll(int p_scroll);
@@ -621,4 +673,19 @@ public:
VARIANT_ENUM_CAST(TextEdit::MenuItems);
VARIANT_ENUM_CAST(TextEdit::SearchFlags);
+class SyntaxHighlighter {
+protected:
+ TextEdit *text_editor;
+
+public:
+ virtual void _update_cache() = 0;
+ virtual Map<int, TextEdit::HighlighterInfo> _get_line_syntax_highlighting(int p_line) = 0;
+
+ virtual String get_name() = 0;
+ virtual List<String> get_supported_languages() = 0;
+
+ void set_text_editor(TextEdit *p_text_editor);
+ TextEdit *get_text_editor();
+};
+
#endif // TEXT_EDIT_H
diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp
index 4a419098a0..82d983184b 100644
--- a/scene/gui/texture_progress.cpp
+++ b/scene/gui/texture_progress.cpp
@@ -106,6 +106,33 @@ Ref<Texture> TextureProgress::get_progress_texture() const {
return progress;
}
+void TextureProgress::set_tint_under(const Color &p_tint) {
+ tint_under = p_tint;
+ update();
+}
+
+Color TextureProgress::get_tint_under() const {
+ return tint_under;
+}
+
+void TextureProgress::set_tint_progress(const Color &p_tint) {
+ tint_progress = p_tint;
+ update();
+}
+
+Color TextureProgress::get_tint_progress() const {
+ return tint_progress;
+}
+
+void TextureProgress::set_tint_over(const Color &p_tint) {
+ tint_over = p_tint;
+ update();
+}
+
+Color TextureProgress::get_tint_over() const {
+ return tint_over;
+}
+
Point2 TextureProgress::unit_val_to_uv(float val) {
if (progress.is_null())
return Point2();
@@ -117,22 +144,45 @@ Point2 TextureProgress::unit_val_to_uv(float val) {
Point2 p = get_relative_center();
- if (val < 0.125)
- return Point2(p.x + (1 - p.x) * val * 8, 0);
- if (val < 0.25)
- return Point2(1, p.y * (val - 0.125) * 8);
- if (val < 0.375)
- return Point2(1, p.y + (1 - p.y) * (val - 0.25) * 8);
- if (val < 0.5)
- return Point2(1 - (1 - p.x) * (val - 0.375) * 8, 1);
- if (val < 0.625)
- return Point2(p.x * (1 - (val - 0.5) * 8), 1);
- if (val < 0.75)
- return Point2(0, 1 - ((1 - p.y) * (val - 0.625) * 8));
- if (val < 0.875)
- return Point2(0, p.y - p.y * (val - 0.75) * 8);
- else
- return Point2(p.x * (val - 0.875) * 8, 0);
+ // Minimal version of Liang-Barsky clipping algorithm
+ float angle = (val * Math_TAU) - Math_PI * 0.5;
+ Point2 dir = Vector2(Math::cos(angle), Math::sin(angle));
+ float t1 = 1.0;
+ float cp;
+ float cq;
+ float cr;
+ float edgeLeft = 0.0;
+ float edgeRight = 1.0;
+ float edgeBottom = 0.0;
+ float edgeTop = 1.0;
+
+ for (int edge = 0; edge < 4; edge++) {
+ if (edge == 0) {
+ if (dir.x > 0)
+ continue;
+ cp = -dir.x;
+ cq = -(edgeLeft - p.x);
+ } else if (edge == 1) {
+ if (dir.x < 0)
+ continue;
+ cp = dir.x;
+ cq = (edgeRight - p.x);
+ } else if (edge == 2) {
+ if (dir.y > 0)
+ continue;
+ cp = -dir.y;
+ cq = -(edgeBottom - p.y);
+ } else if (edge == 3) {
+ if (dir.y < 0)
+ continue;
+ cp = dir.y;
+ cq = (edgeTop - p.y);
+ }
+ cr = cq / cp;
+ if (cr >= 0 && cr < t1)
+ t1 = cr;
+ }
+ return (p + t1 * dir);
}
Point2 TextureProgress::get_relative_center() {
@@ -147,7 +197,7 @@ Point2 TextureProgress::get_relative_center() {
return p;
}
-void TextureProgress::draw_nine_patch_stretched(const Ref<Texture> &p_texture, FillMode p_mode, double p_ratio) {
+void TextureProgress::draw_nine_patch_stretched(const Ref<Texture> &p_texture, FillMode p_mode, double p_ratio, const Color &p_modulate) {
Vector2 texture_size = p_texture->get_size();
Vector2 topleft = Vector2(stretch_margin[MARGIN_LEFT], stretch_margin[MARGIN_TOP]);
Vector2 bottomright = Vector2(stretch_margin[MARGIN_RIGHT], stretch_margin[MARGIN_BOTTOM]);
@@ -217,7 +267,7 @@ void TextureProgress::draw_nine_patch_stretched(const Ref<Texture> &p_texture, F
}
RID ci = get_canvas_item();
- VS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright);
+ VS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright, VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, true, p_modulate);
}
void TextureProgress::_notification(int p_what) {
@@ -228,42 +278,42 @@ void TextureProgress::_notification(int p_what) {
if (nine_patch_stretch && (mode == FILL_LEFT_TO_RIGHT || mode == FILL_RIGHT_TO_LEFT || mode == FILL_TOP_TO_BOTTOM || mode == FILL_BOTTOM_TO_TOP)) {
if (under.is_valid()) {
- draw_nine_patch_stretched(under, FILL_LEFT_TO_RIGHT, 1.0);
+ draw_nine_patch_stretched(under, FILL_LEFT_TO_RIGHT, 1.0, tint_under);
}
if (progress.is_valid()) {
- draw_nine_patch_stretched(progress, mode, get_as_ratio());
+ draw_nine_patch_stretched(progress, mode, get_as_ratio(), tint_progress);
}
if (over.is_valid()) {
- draw_nine_patch_stretched(over, FILL_LEFT_TO_RIGHT, 1.0);
+ draw_nine_patch_stretched(over, FILL_LEFT_TO_RIGHT, 1.0, tint_over);
}
} else {
if (under.is_valid())
- draw_texture(under, Point2());
+ draw_texture(under, Point2(), tint_under);
if (progress.is_valid()) {
Size2 s = progress->get_size();
switch (mode) {
case FILL_LEFT_TO_RIGHT: {
Rect2 region = Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y));
- draw_texture_rect_region(progress, region, region);
+ draw_texture_rect_region(progress, region, region, tint_progress);
} break;
case FILL_RIGHT_TO_LEFT: {
Rect2 region = Rect2(Point2(s.x - s.x * get_as_ratio(), 0), Size2(s.x * get_as_ratio(), s.y));
- draw_texture_rect_region(progress, region, region);
+ draw_texture_rect_region(progress, region, region, tint_progress);
} break;
case FILL_TOP_TO_BOTTOM: {
Rect2 region = Rect2(Point2(), Size2(s.x, s.y * get_as_ratio()));
- draw_texture_rect_region(progress, region, region);
+ draw_texture_rect_region(progress, region, region, tint_progress);
} break;
case FILL_BOTTOM_TO_TOP: {
Rect2 region = Rect2(Point2(0, s.y - s.y * get_as_ratio()), Size2(s.x, s.y * get_as_ratio()));
- draw_texture_rect_region(progress, region, region);
+ draw_texture_rect_region(progress, region, region, tint_progress);
} break;
case FILL_CLOCKWISE:
case FILL_COUNTER_CLOCKWISE: {
float val = get_as_ratio() * rad_max_degrees / 360;
if (val == 1) {
Rect2 region = Rect2(Point2(), s);
- draw_texture_rect_region(progress, region, region);
+ draw_texture_rect_region(progress, region, region, tint_progress);
} else if (val != 0) {
Array pts;
float direction = mode == FILL_CLOCKWISE ? 1 : -1;
@@ -288,7 +338,9 @@ void TextureProgress::_notification(int p_what) {
uvs.push_back(uv);
points.push_back(Point2(uv.x * s.x, uv.y * s.y));
}
- draw_polygon(points, Vector<Color>(), uvs, progress);
+ Vector<Color> colors;
+ colors.push_back(tint_progress);
+ draw_polygon(points, colors, uvs, progress);
}
if (Engine::get_singleton()->is_editor_hint()) {
Point2 p = progress->get_size();
@@ -300,11 +352,11 @@ void TextureProgress::_notification(int p_what) {
}
} break;
default:
- draw_texture_rect_region(progress, Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y)), Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y)));
+ draw_texture_rect_region(progress, Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y)), Rect2(Point2(), Size2(s.x * get_as_ratio(), s.y)), tint_progress);
}
}
if (over.is_valid())
- draw_texture(over, Point2());
+ draw_texture(over, Point2(), tint_over);
}
} break;
@@ -366,6 +418,15 @@ void TextureProgress::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_fill_mode", "mode"), &TextureProgress::set_fill_mode);
ClassDB::bind_method(D_METHOD("get_fill_mode"), &TextureProgress::get_fill_mode);
+ ClassDB::bind_method(D_METHOD("set_tint_under", "tint"), &TextureProgress::set_tint_under);
+ ClassDB::bind_method(D_METHOD("get_tint_under"), &TextureProgress::get_tint_under);
+
+ ClassDB::bind_method(D_METHOD("set_tint_progress", "tint"), &TextureProgress::set_tint_progress);
+ ClassDB::bind_method(D_METHOD("get_tint_progress"), &TextureProgress::get_tint_progress);
+
+ ClassDB::bind_method(D_METHOD("set_tint_over", "tint"), &TextureProgress::set_tint_over);
+ ClassDB::bind_method(D_METHOD("get_tint_over"), &TextureProgress::get_tint_over);
+
ClassDB::bind_method(D_METHOD("set_radial_initial_angle", "mode"), &TextureProgress::set_radial_initial_angle);
ClassDB::bind_method(D_METHOD("get_radial_initial_angle"), &TextureProgress::get_radial_initial_angle);
@@ -386,6 +447,10 @@ void TextureProgress::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_over", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_over_texture", "get_over_texture");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_progress", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_progress_texture", "get_progress_texture");
ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "fill_mode", PROPERTY_HINT_ENUM, "Left to Right,Right to Left,Top to Bottom,Bottom to Top,Clockwise,Counter Clockwise"), "set_fill_mode", "get_fill_mode");
+ ADD_GROUP("Tint", "tint_");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_under", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_under", "get_tint_under");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_over", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_over", "get_tint_over");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "tint_progress", PROPERTY_HINT_COLOR_NO_ALPHA), "set_tint_progress", "get_tint_progress");
ADD_GROUP("Radial Fill", "radial_");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_initial_angle", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_radial_initial_angle", "get_radial_initial_angle");
ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "radial_fill_degrees", PROPERTY_HINT_RANGE, "0.0,360.0,0.1,slider"), "set_fill_degrees", "get_fill_degrees");
@@ -417,4 +482,6 @@ TextureProgress::TextureProgress() {
stretch_margin[MARGIN_RIGHT] = 0;
stretch_margin[MARGIN_BOTTOM] = 0;
stretch_margin[MARGIN_TOP] = 0;
+
+ tint_under = tint_progress = tint_over = Color(1, 1, 1);
}
diff --git a/scene/gui/texture_progress.h b/scene/gui/texture_progress.h
index 77c3980e29..34158b5db5 100644
--- a/scene/gui/texture_progress.h
+++ b/scene/gui/texture_progress.h
@@ -82,6 +82,15 @@ public:
void set_nine_patch_stretch(bool p_stretch);
bool get_nine_patch_stretch() const;
+ void set_tint_under(const Color &p_tint);
+ Color get_tint_under() const;
+
+ void set_tint_progress(const Color &p_tint);
+ Color get_tint_progress() const;
+
+ void set_tint_over(const Color &p_tint);
+ Color get_tint_over() const;
+
Size2 get_minimum_size() const;
TextureProgress();
@@ -93,10 +102,11 @@ private:
Point2 rad_center_off;
bool nine_patch_stretch;
int stretch_margin[4];
+ Color tint_under, tint_progress, tint_over;
Point2 unit_val_to_uv(float val);
Point2 get_relative_center();
- void draw_nine_patch_stretched(const Ref<Texture> &p_texture, FillMode p_mode, double p_ratio);
+ void draw_nine_patch_stretched(const Ref<Texture> &p_texture, FillMode p_mode, double p_ratio, const Color &p_modulate);
};
VARIANT_ENUM_CAST(TextureProgress::FillMode);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index cdbdc9b0d7..1d27612766 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2061,322 +2061,318 @@ void Tree::popup_select(int p_option) {
item_edited(popup_edited_item_col, popup_edited_item);
}
-void Tree::_gui_input(Ref<InputEvent> p_event) {
-
- Ref<InputEventKey> k = p_event;
+void Tree::_go_left() {
+ if (selected_col == 0) {
+ if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) {
+ selected_item->set_collapsed(true);
+ } else {
+ if (columns.size() == 1) { // goto parent with one column
+ TreeItem *parent = selected_item->get_parent();
+ if (selected_item != get_root() && parent && parent->is_selectable(selected_col) && !(hide_root && parent == get_root())) {
+ select_single_item(parent, get_root(), selected_col);
+ }
+ } else if (selected_item->get_prev_visible()) {
+ selected_col = columns.size() - 1;
+ _go_up(); // go to upper column if possible
+ }
+ }
+ } else {
+ if (select_mode == SELECT_MULTI) {
+ selected_col--;
+ emit_signal("cell_selected");
+ } else {
- if (k.is_valid()) {
+ selected_item->select(selected_col - 1);
+ }
+ }
+ update();
+ accept_event();
+ ensure_cursor_is_visible();
+}
- if (!k->is_pressed())
- return;
- if (k->get_command() || (k->get_shift() && k->get_unicode() == 0) || k->get_metakey())
- return;
- if (!root)
+void Tree::_go_right() {
+ if (selected_col == (columns.size() - 1)) {
+ if (selected_item->get_children() != NULL && selected_item->is_collapsed()) {
+ selected_item->set_collapsed(false);
+ } else if (selected_item->get_next_visible()) {
+ selected_item->select(0);
+ _go_down();
return;
+ }
+ } else {
+ if (select_mode == SELECT_MULTI) {
+ selected_col++;
+ emit_signal("cell_selected");
+ } else {
- if (hide_root && !root->get_next_visible())
+ selected_item->select(selected_col + 1);
+ }
+ }
+ update();
+ ensure_cursor_is_visible();
+ accept_event();
+}
+
+void Tree::_go_up() {
+ TreeItem *prev = NULL;
+ if (!selected_item) {
+ prev = get_last_item();
+ selected_col = 0;
+ } else {
+
+ prev = selected_item->get_prev_visible();
+ if (last_keypress != 0) {
+ //incr search next
+ int col;
+ prev = _search_item_text(prev, incr_search, &col, true, true);
+ if (!prev) {
+ accept_event();
+ return;
+ }
+ }
+ }
+
+ if (select_mode == SELECT_MULTI) {
+
+ if (!prev)
return;
+ selected_item = prev;
+ emit_signal("cell_selected");
+ update();
+ } else {
- switch (k->get_scancode()) {
-#define EXIT_BREAK \
- { \
- if (!cursor_can_exit_tree) accept_event(); \
- break; \
+ int col = selected_col < 0 ? 0 : selected_col;
+ while (prev && !prev->cells[col].selectable)
+ prev = prev->get_prev_visible();
+ if (!prev)
+ return; // do nothing..
+ prev->select(col);
}
- case KEY_RIGHT: {
- bool dobreak = true;
- //TreeItem *next = NULL;
- if (!selected_item)
- break;
- if (select_mode == SELECT_ROW) {
- EXIT_BREAK;
- }
- if (selected_col > (columns.size() - 1)) {
- EXIT_BREAK;
- }
- if (k->get_alt()) {
- selected_item->set_collapsed(false);
- TreeItem *next = selected_item->get_children();
- while (next && next != selected_item->next) {
- next->set_collapsed(false);
- next = next->get_next_visible();
- }
- } else if (selected_col == (columns.size() - 1)) {
- if (selected_item->get_children() != NULL && selected_item->is_collapsed()) {
- selected_item->set_collapsed(false);
- } else {
- selected_col = 0;
- dobreak = false; // fall through to key_down
- }
- } else {
- if (select_mode == SELECT_MULTI) {
- selected_col++;
- emit_signal("cell_selected");
- } else {
+ ensure_cursor_is_visible();
+ accept_event();
+}
- selected_item->select(selected_col + 1);
- }
- }
- update();
- ensure_cursor_is_visible();
+void Tree::_go_down() {
+ TreeItem *next = NULL;
+ if (!selected_item) {
+
+ next = hide_root ? root->get_next_visible() : root;
+ selected_item = 0;
+ } else {
+
+ next = selected_item->get_next_visible();
+
+ if (last_keypress != 0) {
+ //incr search next
+ int col;
+ next = _search_item_text(next, incr_search, &col, true);
+ if (!next) {
accept_event();
- if (dobreak) {
- break;
- }
+ return;
}
- case KEY_DOWN: {
+ }
+ }
- TreeItem *next = NULL;
- if (!selected_item) {
+ if (select_mode == SELECT_MULTI) {
- next = hide_root ? root->get_next_visible() : root;
- selected_item = 0;
- } else {
+ if (!next) {
+ return;
+ }
- next = selected_item->get_next_visible();
+ selected_item = next;
+ emit_signal("cell_selected");
+ update();
+ } else {
- //if (diff < uint64_t(GLOBAL_DEF("gui/incr_search_max_interval_msec",2000))) {
- if (last_keypress != 0) {
- //incr search next
- int col;
- next = _search_item_text(next, incr_search, &col, true);
- if (!next) {
- accept_event();
- return;
- }
- }
- }
+ int col = selected_col < 0 ? 0 : selected_col;
- if (select_mode == SELECT_MULTI) {
+ while (next && !next->cells[col].selectable)
+ next = next->get_next_visible();
+ if (!next) {
+ return; // do nothing..
+ }
+ next->select(col);
+ }
- if (!next)
- EXIT_BREAK;
+ ensure_cursor_is_visible();
+ accept_event();
+}
- selected_item = next;
- emit_signal("cell_selected");
- update();
- } else {
+void Tree::_gui_input(Ref<InputEvent> p_event) {
- int col = selected_col < 0 ? 0 : selected_col;
+ Ref<InputEventKey> k = p_event;
- while (next && !next->cells[col].selectable)
- next = next->get_next_visible();
- if (!next)
- EXIT_BREAK; // do nothing..
- next->select(col);
- }
+ if (p_event->is_action("ui_right") && p_event->is_pressed()) {
- ensure_cursor_is_visible();
- accept_event();
+ if (!cursor_can_exit_tree) accept_event();
- } break;
- case KEY_LEFT: {
- bool dobreak = true;
+ if (!selected_item || select_mode == SELECT_ROW || selected_col > (columns.size() - 1)) {
+ return;
+ }
+ if (k.is_valid() && k->get_alt()) {
+ selected_item->set_collapsed(false);
+ TreeItem *next = selected_item->get_children();
+ while (next && next != selected_item->next) {
+ next->set_collapsed(false);
+ next = next->get_next_visible();
+ }
+ } else {
+ _go_right();
+ }
+ } else if (p_event->is_action("ui_left") && p_event->is_pressed()) {
- //TreeItem *next = NULL;
- if (!selected_item)
- break;
- if (select_mode == SELECT_ROW) {
- EXIT_BREAK;
- }
- if (selected_col < 0) {
- EXIT_BREAK;
- }
- if (k->get_alt()) {
- selected_item->set_collapsed(true);
- TreeItem *next = selected_item->get_children();
- while (next && next != selected_item->next) {
- next->set_collapsed(true);
- next = next->get_next_visible();
- }
- } else if (selected_col == 0) {
- if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) {
- selected_item->set_collapsed(true);
- } else {
- if (columns.size() == 1) { // goto parent with one column
- TreeItem *parent = selected_item->get_parent();
- if (selected_item != get_root() && parent && parent->is_selectable(selected_col) && !(hide_root && parent == get_root())) {
- select_single_item(parent, get_root(), selected_col);
- }
- } else {
- selected_col = columns.size() - 1;
- dobreak = false; // fall through to key_up
- }
- }
- } else {
- if (select_mode == SELECT_MULTI) {
- selected_col--;
- emit_signal("cell_selected");
- } else {
+ if (!cursor_can_exit_tree) accept_event();
- selected_item->select(selected_col - 1);
- }
- }
- update();
- accept_event();
- ensure_cursor_is_visible();
+ if (!selected_item || select_mode == SELECT_ROW || selected_col < 0) {
+ return;
+ }
- if (dobreak) {
- break;
- }
+ if (k.is_valid() && k->get_alt()) {
+ selected_item->set_collapsed(true);
+ TreeItem *next = selected_item->get_children();
+ while (next && next != selected_item->next) {
+ next->set_collapsed(true);
+ next = next->get_next_visible();
}
- case KEY_UP: {
+ } else {
+ _go_left();
+ }
- TreeItem *prev = NULL;
- if (!selected_item) {
- prev = get_last_item();
- selected_col = 0;
- } else {
+ } else if (p_event->is_action("ui_up") && p_event->is_pressed()) {
- prev = selected_item->get_prev_visible();
- if (last_keypress != 0) {
- //incr search next
- int col;
- prev = _search_item_text(prev, incr_search, &col, true, true);
- if (!prev) {
- accept_event();
- return;
- }
- }
- }
+ if (!cursor_can_exit_tree) accept_event();
- if (select_mode == SELECT_MULTI) {
+ _go_up();
- if (!prev)
- break;
- selected_item = prev;
- emit_signal("cell_selected");
- update();
- } else {
+ } else if (p_event->is_action("ui_down") && p_event->is_pressed()) {
- int col = selected_col < 0 ? 0 : selected_col;
- while (prev && !prev->cells[col].selectable)
- prev = prev->get_prev_visible();
- if (!prev)
- break; // do nothing..
- prev->select(col);
- }
+ if (!cursor_can_exit_tree) accept_event();
- ensure_cursor_is_visible();
- accept_event();
+ _go_down();
- } break;
- case KEY_PAGEDOWN: {
+ } else if (p_event->is_action("ui_page_down") && p_event->is_pressed()) {
- TreeItem *next = NULL;
- if (!selected_item)
- break;
- next = selected_item;
+ if (!cursor_can_exit_tree) accept_event();
- for (int i = 0; i < 10; i++) {
+ TreeItem *next = NULL;
+ if (!selected_item)
+ return;
+ next = selected_item;
- TreeItem *_n = next->get_next_visible();
- if (_n) {
- next = _n;
- } else {
+ for (int i = 0; i < 10; i++) {
- break;
- }
- }
- if (next == selected_item)
- break;
+ TreeItem *_n = next->get_next_visible();
+ if (_n) {
+ next = _n;
+ } else {
- if (select_mode == SELECT_MULTI) {
+ return;
+ }
+ }
+ if (next == selected_item)
+ return;
- selected_item = next;
- emit_signal("cell_selected");
- update();
- } else {
+ if (select_mode == SELECT_MULTI) {
- while (next && !next->cells[selected_col].selectable)
- next = next->get_next_visible();
- if (!next)
- EXIT_BREAK; // do nothing..
- next->select(selected_col);
- }
+ selected_item = next;
+ emit_signal("cell_selected");
+ update();
+ } else {
- ensure_cursor_is_visible();
- } break;
- case KEY_PAGEUP: {
+ while (next && !next->cells[selected_col].selectable)
+ next = next->get_next_visible();
+ if (!next) {
+ return; // do nothing..
+ }
+ next->select(selected_col);
+ }
- TreeItem *prev = NULL;
- if (!selected_item)
- break;
- prev = selected_item;
+ ensure_cursor_is_visible();
+ } else if (p_event->is_action("ui_page_up") && p_event->is_pressed()) {
- for (int i = 0; i < 10; i++) {
+ if (!cursor_can_exit_tree) accept_event();
- TreeItem *_n = prev->get_prev_visible();
- if (_n) {
- prev = _n;
- } else {
+ TreeItem *prev = NULL;
+ if (!selected_item)
+ return;
+ prev = selected_item;
- break;
- }
- }
- if (prev == selected_item)
- break;
+ for (int i = 0; i < 10; i++) {
- if (select_mode == SELECT_MULTI) {
+ TreeItem *_n = prev->get_prev_visible();
+ if (_n) {
+ prev = _n;
+ } else {
- selected_item = prev;
- emit_signal("cell_selected");
- update();
- } else {
+ return;
+ }
+ }
+ if (prev == selected_item)
+ return;
- while (prev && !prev->cells[selected_col].selectable)
- prev = prev->get_prev_visible();
- if (!prev)
- EXIT_BREAK; // do nothing..
- prev->select(selected_col);
- }
+ if (select_mode == SELECT_MULTI) {
- ensure_cursor_is_visible();
+ selected_item = prev;
+ emit_signal("cell_selected");
+ update();
+ } else {
- } break;
- case KEY_F2:
- case KEY_ENTER:
- case KEY_KP_ENTER: {
-
- if (selected_item) {
- //bring up editor if possible
- if (!edit_selected()) {
- emit_signal("item_activated");
- incr_search.clear();
- }
- }
- accept_event();
+ while (prev && !prev->cells[selected_col].selectable)
+ prev = prev->get_prev_visible();
+ if (!prev) {
+ return; // do nothing..
+ }
+ prev->select(selected_col);
+ }
+ ensure_cursor_is_visible();
+ } else if (p_event->is_action("ui_accept") && p_event->is_pressed()) {
- } break;
- case KEY_SPACE: {
- if (select_mode == SELECT_MULTI) {
- if (!selected_item)
- break;
- if (selected_item->is_selected(selected_col)) {
- selected_item->deselect(selected_col);
- emit_signal("multi_selected", selected_item, selected_col, false);
- } else if (selected_item->is_selectable(selected_col)) {
- selected_item->select(selected_col);
- emit_signal("multi_selected", selected_item, selected_col, true);
- }
- }
- accept_event();
+ if (selected_item) {
+ //bring up editor if possible
+ if (!edit_selected()) {
+ emit_signal("item_activated");
+ incr_search.clear();
+ }
+ }
+ accept_event();
+ } else if (p_event->is_action("ui_select") && p_event->is_pressed()) {
- } break;
- default: {
+ if (select_mode == SELECT_MULTI) {
+ if (!selected_item)
+ return;
+ if (selected_item->is_selected(selected_col)) {
+ selected_item->deselect(selected_col);
+ emit_signal("multi_selected", selected_item, selected_col, false);
+ } else if (selected_item->is_selectable(selected_col)) {
+ selected_item->select(selected_col);
+ emit_signal("multi_selected", selected_item, selected_col, true);
+ }
+ }
+ accept_event();
+ }
+
+ if (k.is_valid()) { // Incremental search
+
+ if (!k->is_pressed())
+ return;
+ if (k->get_command() || (k->get_shift() && k->get_unicode() == 0) || k->get_metakey())
+ return;
+ if (!root)
+ return;
- if (k->get_unicode() > 0) {
+ if (hide_root && !root->get_next_visible())
+ return;
- _do_incr_search(String::chr(k->get_unicode()));
- accept_event();
+ if (k->get_unicode() > 0) {
- return;
- } else {
- if (k->get_scancode() != KEY_SHIFT)
- last_keypress = 0;
- }
- } break;
+ _do_incr_search(String::chr(k->get_unicode()));
+ accept_event();
+
+ return;
+ } else {
+ if (k->get_scancode() != KEY_SHIFT)
+ last_keypress = 0;
}
}
@@ -2549,7 +2545,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (drag_speed == 0) {
drag_touching_deaccel = false;
drag_touching = false;
- set_physics_process(false);
+ set_physics_process_internal(false);
} else {
drag_touching_deaccel = true;
@@ -2615,7 +2611,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
break;
if (drag_touching) {
- set_physics_process(false);
+ set_physics_process_internal(false);
drag_touching_deaccel = false;
drag_touching = false;
drag_speed = 0;
@@ -2630,7 +2626,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
drag_touching = OS::get_singleton()->has_touchscreen_ui_hint();
drag_touching_deaccel = false;
if (drag_touching) {
- set_physics_process(true);
+ set_physics_process_internal(true);
}
if (b->get_button_index() == BUTTON_LEFT) {
@@ -2833,7 +2829,7 @@ void Tree::_notification(int p_what) {
drop_mode_flags = 0;
scrolling = false;
- set_physics_process(false);
+ set_physics_process_internal(false);
update();
}
if (p_what == NOTIFICATION_DRAG_BEGIN) {
@@ -2841,10 +2837,10 @@ void Tree::_notification(int p_what) {
single_select_defer = NULL;
if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) {
scrolling = true;
- set_physics_process(true);
+ set_physics_process_internal(true);
}
}
- if (p_what == NOTIFICATION_PHYSICS_PROCESS) {
+ if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
if (drag_touching) {
@@ -2857,7 +2853,7 @@ void Tree::_notification(int p_what) {
if (pos < 0) {
pos = 0;
turnoff = true;
- set_physics_process(false);
+ set_physics_process_internal(false);
drag_touching = false;
drag_touching_deaccel = false;
}
@@ -2877,7 +2873,7 @@ void Tree::_notification(int p_what) {
drag_speed = sgn * val;
if (turnoff) {
- set_physics_process(false);
+ set_physics_process_internal(false);
drag_touching = false;
drag_touching_deaccel = false;
}
@@ -3911,6 +3907,8 @@ Tree::Tree() {
cache.click_id = -1;
cache.click_item = NULL;
cache.click_column = 0;
+ cache.hover_cell = -1;
+ cache.hover_index = -1;
last_keypress = 0;
focus_in_id = 0;
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 2a8546a743..5af66c5faa 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -507,6 +507,10 @@ private:
ValueEvaluator *evaluator;
int _count_selected_items(TreeItem *p_from) const;
+ void _go_left();
+ void _go_right();
+ void _go_down();
+ void _go_up();
protected:
static void _bind_methods();
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 4eee0126d8..88e1847533 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "video_player.h"
+#include "scene/scene_string_names.h"
#include "os/os.h"
#include "servers/audio_server.h"
@@ -159,11 +160,7 @@ void VideoPlayer::_notification(int p_notification) {
bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
- if (stream.is_null())
- return;
- if (paused)
- return;
- if (!playback->is_playing())
+ if (stream.is_null() || paused || !playback->is_playing())
return;
double audio_time = USEC_TO_SEC(OS::get_singleton()->get_ticks_usec());
@@ -174,7 +171,11 @@ void VideoPlayer::_notification(int p_notification) {
if (delta == 0)
return;
- playback->update(delta);
+ playback->update(delta); // playback->is_playing() returns false in the last video frame
+
+ if (!playback->is_playing()) {
+ emit_signal(SceneStringNames::get_singleton()->finished);
+ }
} break;
@@ -467,6 +468,8 @@ void VideoPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_video_texture"), &VideoPlayer::get_video_texture);
+ ADD_SIGNAL(MethodInfo("finished"));
+
ADD_PROPERTY(PropertyInfo(Variant::INT, "audio_track", PROPERTY_HINT_RANGE, "0,128,1"), "set_audio_track", "get_audio_track");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "VideoStream"), "set_stream", "get_stream");
//ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/loop"), "set_loop", "has_loop") ;
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index 31d45d8e4c..8414210952 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -35,7 +35,7 @@ void CanvasLayer::set_layer(int p_xform) {
layer = p_xform;
if (viewport.is_valid())
- VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas->get_canvas(), layer);
+ VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas, layer);
}
int CanvasLayer::get_layer() const {
@@ -48,7 +48,7 @@ void CanvasLayer::set_transform(const Transform2D &p_xform) {
transform = p_xform;
locrotscale_dirty = true;
if (viewport.is_valid())
- VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas->get_canvas(), transform);
+ VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
}
Transform2D CanvasLayer::get_transform() const {
@@ -61,7 +61,7 @@ void CanvasLayer::_update_xform() {
transform.set_rotation_and_scale(rot, scale);
transform.set_origin(ofs);
if (viewport.is_valid())
- VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas->get_canvas(), transform);
+ VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
}
void CanvasLayer::_update_locrotscale() {
@@ -133,11 +133,6 @@ Vector2 CanvasLayer::get_scale() const {
return scale;
}
-Ref<World2D> CanvasLayer::get_world_2d() const {
-
- return canvas;
-}
-
void CanvasLayer::_notification(int p_what) {
switch (p_what) {
@@ -153,14 +148,14 @@ void CanvasLayer::_notification(int p_what) {
ERR_FAIL_COND(!vp);
viewport = vp->get_viewport_rid();
- VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas->get_canvas());
- VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas->get_canvas(), layer);
- VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas->get_canvas(), transform);
+ VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas);
+ VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas, layer);
+ VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
} break;
case NOTIFICATION_EXIT_TREE: {
- VisualServer::get_singleton()->viewport_remove_canvas(viewport, canvas->get_canvas());
+ VisualServer::get_singleton()->viewport_remove_canvas(viewport, canvas);
viewport = RID();
} break;
@@ -184,7 +179,7 @@ RID CanvasLayer::get_viewport() const {
void CanvasLayer::set_custom_viewport(Node *p_viewport) {
ERR_FAIL_NULL(p_viewport);
if (is_inside_tree()) {
- VisualServer::get_singleton()->viewport_remove_canvas(viewport, canvas->get_canvas());
+ VisualServer::get_singleton()->viewport_remove_canvas(viewport, canvas);
viewport = RID();
}
@@ -205,9 +200,9 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) {
viewport = vp->get_viewport_rid();
- VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas->get_canvas());
- VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas->get_canvas(), layer);
- VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas->get_canvas(), transform);
+ VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas);
+ VisualServer::get_singleton()->viewport_set_canvas_layer(viewport, canvas, layer);
+ VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform);
}
}
@@ -225,6 +220,10 @@ int CanvasLayer::get_sort_index() {
return sort_index++;
}
+RID CanvasLayer::get_canvas() const {
+
+ return canvas;
+}
void CanvasLayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_layer", "layer"), &CanvasLayer::set_layer);
@@ -248,7 +247,7 @@ void CanvasLayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_custom_viewport", "viewport"), &CanvasLayer::set_custom_viewport);
ClassDB::bind_method(D_METHOD("get_custom_viewport"), &CanvasLayer::get_custom_viewport);
- ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasLayer::get_world_2d);
+ ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasLayer::get_canvas);
//ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasLayer::get_viewport);
ADD_PROPERTY(PropertyInfo(Variant::INT, "layer", PROPERTY_HINT_RANGE, "-128,128,1"), "set_layer", "get_layer");
@@ -268,8 +267,13 @@ CanvasLayer::CanvasLayer() {
rot = 0;
locrotscale_dirty = false;
layer = 1;
- canvas = Ref<World2D>(memnew(World2D));
+ canvas = VS::get_singleton()->canvas_create();
custom_viewport = NULL;
custom_viewport_id = 0;
sort_index = 0;
}
+
+CanvasLayer::~CanvasLayer() {
+
+ VS::get_singleton()->free(canvas);
+}
diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h
index c3352a6dba..aae23fbb12 100644
--- a/scene/main/canvas_layer.h
+++ b/scene/main/canvas_layer.h
@@ -45,7 +45,7 @@ class CanvasLayer : public Node {
real_t rot;
int layer;
Transform2D transform;
- Ref<World2D> canvas;
+ RID canvas;
ObjectID custom_viewport_id; // to check validity
Viewport *custom_viewport;
@@ -81,8 +81,6 @@ public:
void set_scale(const Size2 &p_scale);
Size2 get_scale() const;
- Ref<World2D> get_world_2d() const;
-
Size2 get_viewport_size() const;
RID get_viewport() const;
@@ -93,7 +91,10 @@ public:
void reset_sort_index();
int get_sort_index();
+ RID get_canvas() const;
+
CanvasLayer();
+ ~CanvasLayer();
};
#endif // CANVAS_LAYER_H
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 3d58aa65f8..ae21775c55 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -121,7 +121,7 @@ Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_h
}
if (!has_user_agent) {
- headers.push_back("User-Agent: GodotEngine/" + String(VERSION_MKSTRING) + " (" + OS::get_singleton()->get_name() + ")");
+ headers.push_back("User-Agent: GodotEngine/" + String(VERSION_FULL_BUILD) + " (" + OS::get_singleton()->get_name() + ")");
}
if (!has_accept) {
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index 24b04c0c4a..1443d5efbf 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -52,6 +52,7 @@ bool InstancePlaceholder::_get(const StringName &p_name, Variant &r_ret) const {
}
return false;
}
+
void InstancePlaceholder::_get_property_list(List<PropertyInfo> *p_list) const {
for (const List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) {
@@ -73,13 +74,14 @@ String InstancePlaceholder::get_instance_path() const {
return path;
}
-void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_scene) {
- ERR_FAIL_COND(!is_inside_tree());
+Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene> &p_custom_scene) {
+
+ ERR_FAIL_COND_V(!is_inside_tree(), NULL);
Node *base = get_parent();
if (!base)
- return;
+ return NULL;
Ref<PackedScene> ps;
if (p_custom_scene.is_valid())
@@ -88,7 +90,7 @@ void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_s
ps = ResourceLoader::load(path, "PackedScene");
if (!ps.is_valid())
- return;
+ return NULL;
Node *scene = ps->instance();
scene->set_name(get_name());
int pos = get_position_in_parent();
@@ -97,11 +99,20 @@ void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_s
scene->set(E->get().name, E->get().value);
}
- queue_delete();
+ if (p_replace) {
+ queue_delete();
+ base->remove_child(this);
+ }
- base->remove_child(this);
base->add_child(scene);
base->move_child(scene, pos);
+
+ return scene;
+}
+
+void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_scene) {
+ //Deprecated by
+ create_instance(true, p_custom_scene);
}
Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) {
@@ -124,6 +135,7 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) {
void InstancePlaceholder::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_stored_values", "with_order"), &InstancePlaceholder::get_stored_values, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("create_instance", "replace", "custom_scene"), &InstancePlaceholder::create_instance, DEFVAL(false), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("replace_by_instance", "custom_scene"), &InstancePlaceholder::replace_by_instance, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("get_instance_path"), &InstancePlaceholder::get_instance_path);
}
diff --git a/scene/main/instance_placeholder.h b/scene/main/instance_placeholder.h
index d70f1318ea..2158257c93 100644
--- a/scene/main/instance_placeholder.h
+++ b/scene/main/instance_placeholder.h
@@ -60,6 +60,7 @@ public:
Dictionary get_stored_values(bool p_with_order = false);
+ Node *create_instance(bool p_replace = false, const Ref<PackedScene> &p_custom_scene = Ref<PackedScene>());
void replace_by_instance(const Ref<PackedScene> &p_custom_scene = Ref<PackedScene>());
InstancePlaceholder();
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index cf22383e36..6199f52ec5 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -40,7 +40,6 @@
#include "viewport.h"
VARIANT_ENUM_CAST(Node::PauseMode);
-VARIANT_ENUM_CAST(Node::RPCMode);
void Node::_notification(int p_notification) {
@@ -136,7 +135,6 @@ void Node::_notification(int p_notification) {
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
}
- //emit_signal(SceneStringNames::get_singleton()->enter_tree);
} break;
case NOTIFICATION_POSTINITIALIZE: {
@@ -177,9 +175,13 @@ void Node::_propagate_ready() {
data.children[i]->_propagate_ready();
}
data.blocked--;
+
+ notification(NOTIFICATION_POST_ENTER_TREE);
+
if (data.ready_first) {
data.ready_first = false;
notification(NOTIFICATION_READY);
+ emit_signal(SceneStringNames::get_singleton()->ready);
}
}
@@ -477,23 +479,23 @@ bool Node::is_network_master() const {
ERR_FAIL_COND_V(!is_inside_tree(), false);
- return get_tree()->get_network_unique_id() == data.network_master;
+ return get_multiplayer()->get_network_unique_id() == data.network_master;
}
/***** RPC CONFIG ********/
-void Node::rpc_config(const StringName &p_method, RPCMode p_mode) {
+void Node::rpc_config(const StringName &p_method, MultiplayerAPI::RPCMode p_mode) {
- if (p_mode == RPC_MODE_DISABLED) {
+ if (p_mode == MultiplayerAPI::RPC_MODE_DISABLED) {
data.rpc_methods.erase(p_method);
} else {
data.rpc_methods[p_method] = p_mode;
};
}
-void Node::rset_config(const StringName &p_property, RPCMode p_mode) {
+void Node::rset_config(const StringName &p_property, MultiplayerAPI::RPCMode p_mode) {
- if (p_mode == RPC_MODE_DISABLED) {
+ if (p_mode == MultiplayerAPI::RPC_MODE_DISABLED) {
data.rpc_properties.erase(p_property);
} else {
data.rpc_properties[p_property] = p_mode;
@@ -667,200 +669,16 @@ Variant Node::_rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Va
}
void Node::rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount) {
-
ERR_FAIL_COND(!is_inside_tree());
-
- bool skip_rpc = false;
- bool call_local_native = false;
- bool call_local_script = false;
-
- if (p_peer_id == 0 || p_peer_id == get_tree()->get_network_unique_id() || (p_peer_id < 0 && p_peer_id != -get_tree()->get_network_unique_id())) {
- //check that send mode can use local call
-
- Map<StringName, RPCMode>::Element *E = data.rpc_methods.find(p_method);
- if (E) {
-
- switch (E->get()) {
-
- case RPC_MODE_DISABLED: {
- //do nothing
- } break;
- case RPC_MODE_REMOTE: {
- //do nothing also, no need to call local
- } break;
- case RPC_MODE_SYNC: {
- //call it, sync always results in call
- call_local_native = true;
- } break;
- case RPC_MODE_MASTER: {
- call_local_native = is_network_master();
- if (call_local_native) {
- skip_rpc = true; //no other master so..
- }
- } break;
- case RPC_MODE_SLAVE: {
- call_local_native = !is_network_master();
- } break;
- }
- }
-
- if (call_local_native) {
- // done below
- } else if (get_script_instance()) {
- //attempt with script
- ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rpc_mode(p_method);
-
- switch (rpc_mode) {
-
- case ScriptInstance::RPC_MODE_DISABLED: {
- //do nothing
- } break;
- case ScriptInstance::RPC_MODE_REMOTE: {
- //do nothing also, no need to call local
- } break;
- case ScriptInstance::RPC_MODE_SYNC: {
- //call it, sync always results in call
- call_local_script = true;
- } break;
- case ScriptInstance::RPC_MODE_MASTER: {
- call_local_script = is_network_master();
- if (call_local_script) {
- skip_rpc = true; //no other master so..
- }
- } break;
- case ScriptInstance::RPC_MODE_SLAVE: {
- call_local_script = !is_network_master();
- } break;
- }
- }
- }
-
- if (!skip_rpc) {
- get_tree()->_rpc(this, p_peer_id, p_unreliable, false, p_method, p_arg, p_argcount);
- }
-
- if (call_local_native) {
- Variant::CallError ce;
- call(p_method, p_arg, p_argcount, ce);
- if (ce.error != Variant::CallError::CALL_OK) {
- String error = Variant::get_call_error_text(this, p_method, p_arg, p_argcount, ce);
- error = "rpc() aborted in local call: - " + error;
- ERR_PRINTS(error);
- return;
- }
- }
-
- if (call_local_script) {
- Variant::CallError ce;
- ce.error = Variant::CallError::CALL_OK;
- get_script_instance()->call(p_method, p_arg, p_argcount, ce);
- if (ce.error != Variant::CallError::CALL_OK) {
- String error = Variant::get_call_error_text(this, p_method, p_arg, p_argcount, ce);
- error = "rpc() aborted in script local call: - " + error;
- ERR_PRINTS(error);
- return;
- }
- }
+ get_multiplayer()->rpcp(this, p_peer_id, p_unreliable, p_method, p_arg, p_argcount);
}
-/******** RSET *********/
-
void Node::rsetp(int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) {
-
ERR_FAIL_COND(!is_inside_tree());
-
- bool skip_rset = false;
-
- if (p_peer_id == 0 || p_peer_id == get_tree()->get_network_unique_id() || (p_peer_id < 0 && p_peer_id != -get_tree()->get_network_unique_id())) {
- //check that send mode can use local call
-
- bool set_local = false;
-
- Map<StringName, RPCMode>::Element *E = data.rpc_properties.find(p_property);
- if (E) {
-
- switch (E->get()) {
-
- case RPC_MODE_DISABLED: {
- //do nothing
- } break;
- case RPC_MODE_REMOTE: {
- //do nothing also, no need to call local
- } break;
- case RPC_MODE_SYNC: {
- //call it, sync always results in call
- set_local = true;
- } break;
- case RPC_MODE_MASTER: {
- set_local = is_network_master();
- if (set_local) {
- skip_rset = true;
- }
-
- } break;
- case RPC_MODE_SLAVE: {
- set_local = !is_network_master();
- } break;
- }
- }
-
- if (set_local) {
- bool valid;
- set(p_property, p_value, &valid);
-
- if (!valid) {
- String error = "rset() aborted in local set, property not found: - " + String(p_property);
- ERR_PRINTS(error);
- return;
- }
- } else if (get_script_instance()) {
- //attempt with script
- ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rset_mode(p_property);
-
- switch (rpc_mode) {
-
- case ScriptInstance::RPC_MODE_DISABLED: {
- //do nothing
- } break;
- case ScriptInstance::RPC_MODE_REMOTE: {
- //do nothing also, no need to call local
- } break;
- case ScriptInstance::RPC_MODE_SYNC: {
- //call it, sync always results in call
- set_local = true;
- } break;
- case ScriptInstance::RPC_MODE_MASTER: {
- set_local = is_network_master();
- if (set_local) {
- skip_rset = true;
- }
- } break;
- case ScriptInstance::RPC_MODE_SLAVE: {
- set_local = !is_network_master();
- } break;
- }
-
- if (set_local) {
-
- bool valid = get_script_instance()->set(p_property, p_value);
-
- if (!valid) {
- String error = "rset() aborted in local script set, property not found: - " + String(p_property);
- ERR_PRINTS(error);
- return;
- }
- }
- }
- }
-
- if (skip_rset)
- return;
-
- const Variant *vptr = &p_value;
-
- get_tree()->_rpc(this, p_peer_id, p_unreliable, true, p_property, &vptr, 1);
+ get_multiplayer()->rsetp(this, p_peer_id, p_unreliable, p_property, p_value);
}
+/******** RSET *********/
void Node::rset(const StringName &p_property, const Variant &p_value) {
rsetp(0, false, p_property, p_value);
@@ -882,112 +700,29 @@ void Node::rset_unreliable_id(int p_peer_id, const StringName &p_property, const
}
//////////// end of rpc
-
-bool Node::can_call_rpc(const StringName &p_method, int p_from) const {
-
- const Map<StringName, RPCMode>::Element *E = data.rpc_methods.find(p_method);
- if (E) {
-
- switch (E->get()) {
-
- case RPC_MODE_DISABLED: {
- return false;
- } break;
- case RPC_MODE_REMOTE: {
- return true;
- } break;
- case RPC_MODE_SYNC: {
- return true;
- } break;
- case RPC_MODE_MASTER: {
- return is_network_master();
- } break;
- case RPC_MODE_SLAVE: {
- return !is_network_master() && p_from == get_network_master();
- } break;
- }
- }
-
- if (get_script_instance()) {
- //attempt with script
- ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rpc_mode(p_method);
-
- switch (rpc_mode) {
-
- case ScriptInstance::RPC_MODE_DISABLED: {
- return false;
- } break;
- case ScriptInstance::RPC_MODE_REMOTE: {
- return true;
- } break;
- case ScriptInstance::RPC_MODE_SYNC: {
- return true;
- } break;
- case ScriptInstance::RPC_MODE_MASTER: {
- return is_network_master();
- } break;
- case ScriptInstance::RPC_MODE_SLAVE: {
- return !is_network_master() && p_from == get_network_master();
- } break;
- }
- }
-
- ERR_PRINTS("RPC from " + itos(p_from) + " on unauthorized method attempted: " + String(p_method) + " on base: " + String(Variant(this)));
- return false;
+Ref<MultiplayerAPI> Node::get_multiplayer() const {
+ if (multiplayer.is_valid())
+ return multiplayer;
+ if (!is_inside_tree())
+ return Ref<MultiplayerAPI>();
+ return get_tree()->get_multiplayer();
}
-bool Node::can_call_rset(const StringName &p_property, int p_from) const {
-
- const Map<StringName, RPCMode>::Element *E = data.rpc_properties.find(p_property);
- if (E) {
-
- switch (E->get()) {
-
- case RPC_MODE_DISABLED: {
- return false;
- } break;
- case RPC_MODE_REMOTE: {
- return true;
- } break;
- case RPC_MODE_SYNC: {
- return true;
- } break;
- case RPC_MODE_MASTER: {
- return is_network_master();
- } break;
- case RPC_MODE_SLAVE: {
- return !is_network_master() && p_from == get_network_master();
- } break;
- }
- }
-
- if (get_script_instance()) {
- //attempt with script
- ScriptInstance::RPCMode rpc_mode = get_script_instance()->get_rset_mode(p_property);
+Ref<MultiplayerAPI> Node::get_custom_multiplayer() const {
+ return multiplayer;
+}
- switch (rpc_mode) {
+void Node::set_custom_multiplayer(Ref<MultiplayerAPI> p_multiplayer) {
- case ScriptInstance::RPC_MODE_DISABLED: {
- return false;
- } break;
- case ScriptInstance::RPC_MODE_REMOTE: {
- return true;
- } break;
- case ScriptInstance::RPC_MODE_SYNC: {
- return true;
- } break;
- case ScriptInstance::RPC_MODE_MASTER: {
- return is_network_master();
- } break;
- case ScriptInstance::RPC_MODE_SLAVE: {
- return !is_network_master() && p_from == get_network_master();
- } break;
- }
- }
+ multiplayer = p_multiplayer;
+}
- ERR_PRINTS("RSET from " + itos(p_from) + " on unauthorized property attempted: " + String(p_property) + " on base: " + String(Variant(this)));
+const Map<StringName, MultiplayerAPI::RPCMode>::Element *Node::get_node_rpc_mode(const StringName &p_method) {
+ return data.rpc_methods.find(p_method);
+}
- return false;
+const Map<StringName, MultiplayerAPI::RPCMode>::Element *Node::get_node_rset_mode(const StringName &p_property) {
+ return data.rpc_properties.find(p_property);
}
bool Node::can_process() const {
@@ -1139,9 +874,23 @@ void Node::_set_name_nocheck(const StringName &p_name) {
data.name = p_name;
}
+String Node::invalid_character = ". : @ / \"";
+
+bool Node::_validate_node_name(String &p_name) {
+ String name = p_name;
+ Vector<String> chars = Node::invalid_character.split(" ");
+ for (int i = 0; i < chars.size(); i++) {
+ name = name.replace(chars[i], "");
+ }
+ bool is_valid = name == p_name;
+ p_name = name;
+ return is_valid;
+}
+
void Node::set_name(const String &p_name) {
- String name = p_name.replace(":", "").replace("/", "").replace("@", "");
+ String name = p_name;
+ _validate_node_name(name);
ERR_FAIL_COND(name == "");
data.name = name;
@@ -1346,6 +1095,10 @@ void Node::add_child(Node *p_child, bool p_legible_unique_name) {
}
void Node::add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name) {
+
+ ERR_FAIL_NULL(p_node);
+ ERR_FAIL_NULL(p_child);
+
add_child(p_child, p_legible_unique_name);
if (is_a_parent_of(p_node)) {
@@ -1868,11 +1621,18 @@ bool Node::has_persistent_groups() const {
return false;
}
-void Node::_print_tree(const Node *p_node) {
+void Node::_print_tree_pretty(const String prefix, const bool last) {
- print_line(String(p_node->get_path_to(this)));
- for (int i = 0; i < data.children.size(); i++)
- data.children[i]->_print_tree(p_node);
+ String new_prefix = last ? String::utf8(" â”–â•´") : String::utf8(" â” â•´");
+ print_line(prefix + new_prefix + String(get_name()));
+ for (int i = 0; i < data.children.size(); i++) {
+ new_prefix = last ? String::utf8(" ") : String::utf8(" ┃ ");
+ data.children[i]->_print_tree_pretty(prefix + new_prefix, i == data.children.size() - 1);
+ }
+}
+
+void Node::print_tree_pretty() {
+ _print_tree_pretty("", true);
}
void Node::print_tree() {
@@ -1880,6 +1640,12 @@ void Node::print_tree() {
_print_tree(this);
}
+void Node::_print_tree(const Node *p_node) {
+ print_line(String(p_node->get_path_to(this)));
+ for (int i = 0; i < data.children.size(); i++)
+ data.children[i]->_print_tree(p_node);
+}
+
void Node::_propagate_reverse_notification(int p_notification) {
data.blocked++;
@@ -2163,19 +1929,14 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
if (name == script_property_name)
continue;
- Variant value = N->get()->get(name);
- // Duplicate dictionaries and arrays, mainly needed for __meta__
- if (value.get_type() == Variant::DICTIONARY) {
- value = Dictionary(value).duplicate();
- } else if (value.get_type() == Variant::ARRAY) {
- value = Array(value).duplicate();
- }
+ Variant value = N->get()->get(name).duplicate(true);
if (E->get().usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
Resource *res = Object::cast_to<Resource>(value);
- if (res) // Duplicate only if it's a resource
+ if (res) { // Duplicate only if it's a resource
current_node->set(name, res->duplicate());
+ }
} else {
@@ -2313,13 +2074,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
continue;
String name = E->get().name;
- Variant value = get(name);
- // Duplicate dictionaries and arrays, mainly needed for __meta__
- if (value.get_type() == Variant::DICTIONARY) {
- value = Dictionary(value).duplicate();
- } else if (value.get_type() == Variant::ARRAY) {
- value = Array(value).duplicate();
- }
+ Variant value = get(name).duplicate(true);
node->set(name, value);
}
@@ -2502,7 +2257,10 @@ void Node::replace_by(Node *p_node, bool p_keep_data) {
Node *child = get_child(0);
remove_child(child);
- p_node->add_child(child);
+ if (!child->is_owned_by_parent()) {
+ // add the custom children to the p_node
+ p_node->add_child(child);
+ }
}
p_node->set_owner(owner);
@@ -2723,18 +2481,21 @@ Array Node::_get_children() const {
return arr;
}
-#ifdef TOOLS_ENABLED
void Node::set_import_path(const NodePath &p_import_path) {
+#ifdef TOOLS_ENABLED
data.import_path = p_import_path;
+#endif
}
NodePath Node::get_import_path() const {
+#ifdef TOOLS_ENABLED
return data.import_path;
-}
-
+#else
+ return NodePath();
#endif
+}
static void _add_nodes_to_options(const Node *p_base, const Node *p_node, List<String> *r_options) {
@@ -2837,6 +2598,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_and_skip"), &Node::remove_and_skip);
ClassDB::bind_method(D_METHOD("get_index"), &Node::get_index);
ClassDB::bind_method(D_METHOD("print_tree"), &Node::print_tree);
+ ClassDB::bind_method(D_METHOD("print_tree_pretty"), &Node::print_tree_pretty);
ClassDB::bind_method(D_METHOD("set_filename", "filename"), &Node::set_filename);
ClassDB::bind_method(D_METHOD("get_filename"), &Node::get_filename);
ClassDB::bind_method(D_METHOD("propagate_notification", "what"), &Node::propagate_notification);
@@ -2886,16 +2648,16 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_network_master"), &Node::is_network_master);
+ ClassDB::bind_method(D_METHOD("get_multiplayer"), &Node::get_multiplayer);
+ ClassDB::bind_method(D_METHOD("get_custom_multiplayer"), &Node::get_custom_multiplayer);
+ ClassDB::bind_method(D_METHOD("set_custom_multiplayer", "api"), &Node::set_custom_multiplayer);
ClassDB::bind_method(D_METHOD("rpc_config", "method", "mode"), &Node::rpc_config);
ClassDB::bind_method(D_METHOD("rset_config", "property", "mode"), &Node::rset_config);
-#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("_set_import_path", "import_path"), &Node::set_import_path);
ClassDB::bind_method(D_METHOD("_get_import_path"), &Node::get_import_path);
ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "_import_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_import_path", "_get_import_path");
-#endif
-
{
MethodInfo mi;
@@ -2937,12 +2699,6 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_INTERNAL_PROCESS);
BIND_CONSTANT(NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
- BIND_ENUM_CONSTANT(RPC_MODE_DISABLED);
- BIND_ENUM_CONSTANT(RPC_MODE_REMOTE);
- BIND_ENUM_CONSTANT(RPC_MODE_SYNC);
- BIND_ENUM_CONSTANT(RPC_MODE_MASTER);
- BIND_ENUM_CONSTANT(RPC_MODE_SLAVE);
-
BIND_ENUM_CONSTANT(PAUSE_MODE_INHERIT);
BIND_ENUM_CONSTANT(PAUSE_MODE_STOP);
BIND_ENUM_CONSTANT(PAUSE_MODE_PROCESS);
@@ -2952,6 +2708,7 @@ void Node::_bind_methods() {
BIND_ENUM_CONSTANT(DUPLICATE_SCRIPTS);
BIND_ENUM_CONSTANT(DUPLICATE_USE_INSTANCING);
+ ADD_SIGNAL(MethodInfo("ready"));
ADD_SIGNAL(MethodInfo("renamed"));
ADD_SIGNAL(MethodInfo("tree_entered"));
ADD_SIGNAL(MethodInfo("tree_exiting"));
@@ -2967,6 +2724,8 @@ void Node::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "name", PROPERTY_HINT_NONE, "", 0), "set_name", "get_name");
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "filename", PROPERTY_HINT_NONE, "", 0), "set_filename", "get_filename");
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_owner", "get_owner");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "", "get_multiplayer");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "custom_multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_custom_multiplayer", "get_custom_multiplayer");
BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::REAL, "delta")));
BIND_VMETHOD(MethodInfo("_physics_process", PropertyInfo(Variant::REAL, "delta")));
diff --git a/scene/main/node.h b/scene/main/node.h
index 341869f7ba..341349de79 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -65,15 +65,6 @@ public:
#endif
};
- enum RPCMode {
-
- RPC_MODE_DISABLED, //no rpc for this method, calls to this will be blocked (default)
- RPC_MODE_REMOTE, // using rpc() on it will call method / set property in all other peers
- RPC_MODE_SYNC, // using rpc() on it will call method / set property in all other peers and locally
- RPC_MODE_MASTER, // usinc rpc() on it will call method on wherever the master is, be it local or remote
- RPC_MODE_SLAVE, // usinc rpc() on it will call method for all slaves, be it local or remote
- };
-
struct Comparator {
bool operator()(const Node *p_a, const Node *p_b) const { return p_b->is_greater_than(p_a); }
@@ -120,8 +111,8 @@ private:
Node *pause_owner;
int network_master;
- Map<StringName, RPCMode> rpc_methods;
- Map<StringName, RPCMode> rpc_properties;
+ Map<StringName, MultiplayerAPI::RPCMode> rpc_methods;
+ Map<StringName, MultiplayerAPI::RPCMode> rpc_properties;
// variables used to properly sort the node when processing, ignored otherwise
//should move all the stuff below to bits
@@ -151,6 +142,9 @@ private:
NAME_CASING_SNAKE_CASE
};
+ Ref<MultiplayerAPI> multiplayer;
+
+ void _print_tree_pretty(const String prefix, const bool last);
void _print_tree(const Node *p_node);
Node *_get_node(const NodePath &p_path) const;
@@ -187,6 +181,12 @@ private:
void _set_tree(SceneTree *p_tree);
+#ifdef TOOLS_ENABLED
+ friend class SceneTreeEditor;
+#endif
+ static String invalid_character;
+ static bool _validate_node_name(String &p_name);
+
protected:
void _block() { data.blocked++; }
void _unblock() { data.blocked--; }
@@ -228,6 +228,7 @@ public:
NOTIFICATION_TRANSLATION_CHANGED = 24,
NOTIFICATION_INTERNAL_PROCESS = 25,
NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26,
+ NOTIFICATION_POST_ENTER_TREE = 27,
};
@@ -287,6 +288,7 @@ public:
int get_index() const;
void print_tree();
+ void print_tree_pretty();
void set_filename(const String &p_filename);
String get_filename() const;
@@ -370,10 +372,8 @@ public:
void force_parent_owned() { data.parent_owned = true; } //hack to avoid duplicate nodes
-#ifdef TOOLS_ENABLED
void set_import_path(const NodePath &p_import_path); //path used when imported, used by scene editors to keep tracking
NodePath get_import_path() const;
-#endif
bool is_owned_by_parent() const;
@@ -395,25 +395,27 @@ public:
int get_network_master() const;
bool is_network_master() const;
- void rpc_config(const StringName &p_method, RPCMode p_mode); // config a local method for RPC
- void rset_config(const StringName &p_property, RPCMode p_mode); // config a local property for RPC
+ void rpc_config(const StringName &p_method, MultiplayerAPI::RPCMode p_mode); // config a local method for RPC
+ void rset_config(const StringName &p_property, MultiplayerAPI::RPCMode p_mode); // config a local property for RPC
void rpc(const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
void rpc_unreliable(const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
void rpc_id(int p_peer_id, const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
void rpc_unreliable_id(int p_peer_id, const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
- void rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount);
-
void rset(const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
void rset_unreliable(const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
void rset_id(int p_peer_id, const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
void rset_unreliable_id(int p_peer_id, const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
+ void rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount);
void rsetp(int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value);
- bool can_call_rpc(const StringName &p_method, int p_from) const;
- bool can_call_rset(const StringName &p_property, int p_from) const;
+ Ref<MultiplayerAPI> get_multiplayer() const;
+ Ref<MultiplayerAPI> get_custom_multiplayer() const;
+ void set_custom_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
+ const Map<StringName, MultiplayerAPI::RPCMode>::Element *get_node_rpc_mode(const StringName &p_method);
+ const Map<StringName, MultiplayerAPI::RPCMode>::Element *get_node_rset_mode(const StringName &p_property);
Node();
~Node();
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 136fd4cfd1..8d6e57b335 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -33,6 +33,7 @@
#include "editor/editor_node.h"
#include "io/marshalls.h"
#include "io/resource_loader.h"
+#include "main/input_default.h"
#include "message_queue.h"
#include "node.h"
#include "os/keyboard.h"
@@ -484,7 +485,9 @@ bool SceneTree::idle(float p_time) {
idle_process_time = p_time;
- _network_poll();
+ if (multiplayer_poll) {
+ multiplayer->poll();
+ }
emit_signal("idle_frame");
@@ -498,14 +501,14 @@ bool SceneTree::idle(float p_time) {
Size2 win_size = Size2(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height);
if (win_size != last_screen_size) {
+ last_screen_size = win_size;
+ _update_root_rect();
+
if (use_font_oversampling) {
DynamicFontAtSize::font_oversampling = OS::get_singleton()->get_window_size().width / root->get_visible_rect().size.width;
DynamicFont::update_oversampling();
}
- last_screen_size = win_size;
- _update_root_rect();
-
emit_signal("screen_resized");
}
@@ -615,9 +618,18 @@ void SceneTree::_notification(int p_notification) {
}
} break;
case NOTIFICATION_OS_MEMORY_WARNING:
+ case NOTIFICATION_WM_MOUSE_ENTER:
+ case NOTIFICATION_WM_MOUSE_EXIT:
case NOTIFICATION_WM_FOCUS_IN:
case NOTIFICATION_WM_FOCUS_OUT: {
+ if (p_notification == NOTIFICATION_WM_FOCUS_IN) {
+ InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
+ if (id) {
+ id->ensure_touch_mouse_raised();
+ }
+ }
+
get_root()->propagate_notification(p_notification);
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
@@ -1195,16 +1207,20 @@ void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, c
_update_root_rect();
}
-#ifdef TOOLS_ENABLED
void SceneTree::set_edited_scene_root(Node *p_node) {
+#ifdef TOOLS_ENABLED
edited_scene_root = p_node;
+#endif
}
Node *SceneTree::get_edited_scene_root() const {
+#ifdef TOOLS_ENABLED
return edited_scene_root;
-}
+#else
+ return NULL;
#endif
+}
void SceneTree::set_current_scene(Node *p_scene) {
@@ -1631,16 +1647,11 @@ Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_pa
void SceneTree::_network_peer_connected(int p_id) {
- connected_peers.insert(p_id);
- path_get_cache.insert(p_id, PathGetCache());
-
emit_signal("network_peer_connected", p_id);
}
void SceneTree::_network_peer_disconnected(int p_id) {
- connected_peers.erase(p_id);
- path_get_cache.erase(p_id); //I no longer need your cache, sorry
emit_signal("network_peer_disconnected", p_id);
}
@@ -1659,471 +1670,78 @@ void SceneTree::_server_disconnected() {
emit_signal("server_disconnected");
}
-void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer) {
- if (network_peer.is_valid()) {
- network_peer->disconnect("peer_connected", this, "_network_peer_connected");
- network_peer->disconnect("peer_disconnected", this, "_network_peer_disconnected");
- network_peer->disconnect("connection_succeeded", this, "_connected_to_server");
- network_peer->disconnect("connection_failed", this, "_connection_failed");
- network_peer->disconnect("server_disconnected", this, "_server_disconnected");
- connected_peers.clear();
- path_get_cache.clear();
- path_send_cache.clear();
- last_send_cache_id = 1;
- }
+Ref<MultiplayerAPI> SceneTree::get_multiplayer() const {
+ return multiplayer;
+}
+
+void SceneTree::set_multiplayer_poll_enabled(bool p_enabled) {
+ multiplayer_poll = p_enabled;
+}
- ERR_EXPLAIN("Supplied NetworkedNetworkPeer must be connecting or connected.");
- ERR_FAIL_COND(p_network_peer.is_valid() && p_network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED);
+bool SceneTree::is_multiplayer_poll_enabled() const {
+ return multiplayer_poll;
+}
- network_peer = p_network_peer;
+void SceneTree::set_multiplayer(Ref<MultiplayerAPI> p_multiplayer) {
+ ERR_FAIL_COND(!p_multiplayer.is_valid());
- if (network_peer.is_valid()) {
- network_peer->connect("peer_connected", this, "_network_peer_connected");
- network_peer->connect("peer_disconnected", this, "_network_peer_disconnected");
- network_peer->connect("connection_succeeded", this, "_connected_to_server");
- network_peer->connect("connection_failed", this, "_connection_failed");
- network_peer->connect("server_disconnected", this, "_server_disconnected");
+ if (multiplayer.is_valid()) {
+ multiplayer->disconnect("network_peer_connected", this, "_network_peer_connected");
+ multiplayer->disconnect("network_peer_disconnected", this, "_network_peer_disconnected");
+ multiplayer->disconnect("connected_to_server", this, "_connected_to_server");
+ multiplayer->disconnect("connection_failed", this, "_connection_failed");
+ multiplayer->disconnect("server_disconnected", this, "_server_disconnected");
}
+
+ multiplayer = p_multiplayer;
+ multiplayer->set_root_node(root);
+
+ multiplayer->connect("network_peer_connected", this, "_network_peer_connected");
+ multiplayer->connect("network_peer_disconnected", this, "_network_peer_disconnected");
+ multiplayer->connect("connected_to_server", this, "_connected_to_server");
+ multiplayer->connect("connection_failed", this, "_connection_failed");
+ multiplayer->connect("server_disconnected", this, "_server_disconnected");
+}
+
+void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer) {
+
+ multiplayer->set_network_peer(p_network_peer);
}
Ref<NetworkedMultiplayerPeer> SceneTree::get_network_peer() const {
- return network_peer;
+ return multiplayer->get_network_peer();
}
bool SceneTree::is_network_server() const {
- ERR_FAIL_COND_V(!network_peer.is_valid(), false);
- return network_peer->is_server();
+ return multiplayer->is_network_server();
}
bool SceneTree::has_network_peer() const {
- return network_peer.is_valid();
+ return multiplayer->has_network_peer();
}
int SceneTree::get_network_unique_id() const {
- ERR_FAIL_COND_V(!network_peer.is_valid(), 0);
- return network_peer->get_unique_id();
+ return multiplayer->get_network_unique_id();
}
Vector<int> SceneTree::get_network_connected_peers() const {
- ERR_FAIL_COND_V(!network_peer.is_valid(), Vector<int>());
-
- Vector<int> ret;
- for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
- ret.push_back(E->get());
- }
- return ret;
+ return multiplayer->get_network_connected_peers();
}
int SceneTree::get_rpc_sender_id() const {
- return rpc_sender_id;
+ return multiplayer->get_rpc_sender_id();
}
void SceneTree::set_refuse_new_network_connections(bool p_refuse) {
- ERR_FAIL_COND(!network_peer.is_valid());
- network_peer->set_refuse_new_connections(p_refuse);
+ multiplayer->set_refuse_new_network_connections(p_refuse);
}
bool SceneTree::is_refusing_new_network_connections() const {
-
- ERR_FAIL_COND_V(!network_peer.is_valid(), false);
-
- return network_peer->is_refusing_new_connections();
-}
-
-void SceneTree::_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount) {
-
- if (network_peer.is_null()) {
- ERR_EXPLAIN("Attempt to remote call/set when networking is not active in SceneTree.");
- ERR_FAIL();
- }
-
- if (network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_CONNECTING) {
- ERR_EXPLAIN("Attempt to remote call/set when networking is not connected yet in SceneTree.");
- ERR_FAIL();
- }
-
- if (network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED) {
- ERR_EXPLAIN("Attempt to remote call/set when networking is disconnected.");
- ERR_FAIL();
- }
-
- if (p_argcount > 255) {
- ERR_EXPLAIN("Too many arguments >255.");
- ERR_FAIL();
- }
-
- if (p_to != 0 && !connected_peers.has(ABS(p_to))) {
- if (p_to == get_network_unique_id()) {
- ERR_EXPLAIN("Attempt to remote call/set yourself! unique ID: " + itos(get_network_unique_id()));
- } else {
- ERR_EXPLAIN("Attempt to remote call unexisting ID: " + itos(p_to));
- }
-
- ERR_FAIL();
- }
-
- NodePath from_path = p_from->get_path();
- ERR_FAIL_COND(from_path.is_empty());
-
- //see if the path is cached
- PathSentCache *psc = path_send_cache.getptr(from_path);
- if (!psc) {
- //path is not cached, create
- path_send_cache[from_path] = PathSentCache();
- psc = path_send_cache.getptr(from_path);
- psc->id = last_send_cache_id++;
- }
-
- //create base packet, lots of hardcode because it must be tight
-
- int ofs = 0;
-
-#define MAKE_ROOM(m_amount) \
- if (packet_cache.size() < m_amount) packet_cache.resize(m_amount);
-
- //encode type
- MAKE_ROOM(1);
- packet_cache[0] = p_set ? NETWORK_COMMAND_REMOTE_SET : NETWORK_COMMAND_REMOTE_CALL;
- ofs += 1;
-
- //encode ID
- MAKE_ROOM(ofs + 4);
- encode_uint32(psc->id, &packet_cache[ofs]);
- ofs += 4;
-
- //encode function name
- CharString name = String(p_name).utf8();
- int len = encode_cstring(name.get_data(), NULL);
- MAKE_ROOM(ofs + len);
- encode_cstring(name.get_data(), &packet_cache[ofs]);
- ofs += len;
-
- if (p_set) {
- //set argument
- Error err = encode_variant(*p_arg[0], NULL, len);
- ERR_FAIL_COND(err != OK);
- MAKE_ROOM(ofs + len);
- encode_variant(*p_arg[0], &packet_cache[ofs], len);
- ofs += len;
-
- } else {
- //call arguments
- MAKE_ROOM(ofs + 1);
- packet_cache[ofs] = p_argcount;
- ofs += 1;
- for (int i = 0; i < p_argcount; i++) {
- Error err = encode_variant(*p_arg[i], NULL, len);
- ERR_FAIL_COND(err != OK);
- MAKE_ROOM(ofs + len);
- encode_variant(*p_arg[i], &packet_cache[ofs], len);
- ofs += len;
- }
- }
-
- //see if all peers have cached path (is so, call can be fast)
- bool has_all_peers = true;
-
- List<int> peers_to_add; //if one is missing, take note to add it
-
- for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
-
- if (p_to < 0 && E->get() == -p_to)
- continue; //continue, excluded
-
- if (p_to > 0 && E->get() != p_to)
- continue; //continue, not for this peer
-
- Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
-
- if (!F || F->get() == false) {
- //path was not cached, or was cached but is unconfirmed
- if (!F) {
- //not cached at all, take note
- peers_to_add.push_back(E->get());
- }
-
- has_all_peers = false;
- }
- }
-
- //those that need to be added, send a message for this
-
- for (List<int>::Element *E = peers_to_add.front(); E; E = E->next()) {
-
- //encode function name
- CharString pname = String(from_path).utf8();
- int len = encode_cstring(pname.get_data(), NULL);
-
- Vector<uint8_t> packet;
-
- packet.resize(1 + 4 + len);
- packet[0] = NETWORK_COMMAND_SIMPLIFY_PATH;
- encode_uint32(psc->id, &packet[1]);
- encode_cstring(pname.get_data(), &packet[5]);
-
- network_peer->set_target_peer(E->get()); //to all of you
- network_peer->set_transfer_mode(NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
- network_peer->put_packet(packet.ptr(), packet.size());
-
- psc->confirmed_peers.insert(E->get(), false); //insert into confirmed, but as false since it was not confirmed
- }
-
- //take chance and set transfer mode, since all send methods will use it
- network_peer->set_transfer_mode(p_unreliable ? NetworkedMultiplayerPeer::TRANSFER_MODE_UNRELIABLE : NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
-
- if (has_all_peers) {
-
- //they all have verified paths, so send fast
- network_peer->set_target_peer(p_to); //to all of you
- network_peer->put_packet(packet_cache.ptr(), ofs); //a message with love
- } else {
- //not all verified path, so send one by one
-
- //apend path at the end, since we will need it for some packets
- CharString pname = String(from_path).utf8();
- int path_len = encode_cstring(pname.get_data(), NULL);
- MAKE_ROOM(ofs + path_len);
- encode_cstring(pname.get_data(), &packet_cache[ofs]);
-
- for (Set<int>::Element *E = connected_peers.front(); E; E = E->next()) {
-
- if (p_to < 0 && E->get() == -p_to)
- continue; //continue, excluded
-
- if (p_to > 0 && E->get() != p_to)
- continue; //continue, not for this peer
-
- Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
- ERR_CONTINUE(!F); //should never happen
-
- network_peer->set_target_peer(E->get()); //to this one specifically
-
- if (F->get() == true) {
- //this one confirmed path, so use id
- encode_uint32(psc->id, &packet_cache[1]);
- network_peer->put_packet(packet_cache.ptr(), ofs);
- } else {
- //this one did not confirm path yet, so use entire path (sorry!)
- encode_uint32(0x80000000 | ofs, &packet_cache[1]); //offset to path and flag
- network_peer->put_packet(packet_cache.ptr(), ofs + path_len);
- }
- }
- }
-}
-
-void SceneTree::_network_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) {
-
- ERR_FAIL_COND(p_packet_len < 5);
-
- uint8_t packet_type = p_packet[0];
-
- switch (packet_type) {
-
- case NETWORK_COMMAND_REMOTE_CALL:
- case NETWORK_COMMAND_REMOTE_SET: {
-
- ERR_FAIL_COND(p_packet_len < 5);
- uint32_t target = decode_uint32(&p_packet[1]);
-
- Node *node = NULL;
-
- if (target & 0x80000000) {
- //use full path (not cached yet)
-
- int ofs = target & 0x7FFFFFFF;
- ERR_FAIL_COND(ofs >= p_packet_len);
-
- String paths;
- paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);
-
- NodePath np = paths;
-
- node = get_root()->get_node(np);
- if (node == NULL) {
- ERR_EXPLAIN("Failed to get path from RPC: " + String(np));
- ERR_FAIL_COND(node == NULL);
- }
- } else {
- //use cached path
- int id = target;
-
- Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
- ERR_FAIL_COND(!E);
-
- Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
- ERR_FAIL_COND(!F);
-
- PathGetCache::NodeInfo *ni = &F->get();
- //do proper caching later
-
- node = get_root()->get_node(ni->path);
- if (node == NULL) {
- ERR_EXPLAIN("Failed to get cached path from RPC: " + String(ni->path));
- ERR_FAIL_COND(node == NULL);
- }
- }
-
- ERR_FAIL_COND(p_packet_len < 6);
-
- //detect cstring end
- int len_end = 5;
- for (; len_end < p_packet_len; len_end++) {
- if (p_packet[len_end] == 0) {
- break;
- }
- }
-
- ERR_FAIL_COND(len_end >= p_packet_len);
-
- StringName name = String::utf8((const char *)&p_packet[5]);
-
- if (packet_type == NETWORK_COMMAND_REMOTE_CALL) {
-
- if (!node->can_call_rpc(name, p_from))
- return;
-
- int ofs = len_end + 1;
-
- ERR_FAIL_COND(ofs >= p_packet_len);
-
- int argc = p_packet[ofs];
- Vector<Variant> args;
- Vector<const Variant *> argp;
- args.resize(argc);
- argp.resize(argc);
-
- ofs++;
-
- for (int i = 0; i < argc; i++) {
-
- ERR_FAIL_COND(ofs >= p_packet_len);
- int vlen;
- Error err = decode_variant(args[i], &p_packet[ofs], p_packet_len - ofs, &vlen);
- ERR_FAIL_COND(err != OK);
- //args[i]=p_packet[3+i];
- argp[i] = &args[i];
- ofs += vlen;
- }
-
- Variant::CallError ce;
-
- node->call(name, (const Variant **)argp.ptr(), argc, ce);
- if (ce.error != Variant::CallError::CALL_OK) {
- String error = Variant::get_call_error_text(node, name, (const Variant **)argp.ptr(), argc, ce);
- error = "RPC - " + error;
- ERR_PRINTS(error);
- }
-
- } else {
-
- if (!node->can_call_rset(name, p_from))
- return;
-
- int ofs = len_end + 1;
-
- ERR_FAIL_COND(ofs >= p_packet_len);
-
- Variant value;
- decode_variant(value, &p_packet[ofs], p_packet_len - ofs);
-
- bool valid;
-
- node->set(name, value, &valid);
- if (!valid) {
- String error = "Error setting remote property '" + String(name) + "', not found in object of type " + node->get_class();
- ERR_PRINTS(error);
- }
- }
-
- } break;
- case NETWORK_COMMAND_SIMPLIFY_PATH: {
-
- ERR_FAIL_COND(p_packet_len < 5);
- int id = decode_uint32(&p_packet[1]);
-
- String paths;
- paths.parse_utf8((const char *)&p_packet[5], p_packet_len - 5);
-
- NodePath path = paths;
-
- if (!path_get_cache.has(p_from)) {
- path_get_cache[p_from] = PathGetCache();
- }
-
- PathGetCache::NodeInfo ni;
- ni.path = path;
- ni.instance = 0;
-
- path_get_cache[p_from].nodes[id] = ni;
-
- {
- //send ack
-
- //encode path
- CharString pname = String(path).utf8();
- int len = encode_cstring(pname.get_data(), NULL);
-
- Vector<uint8_t> packet;
-
- packet.resize(1 + len);
- packet[0] = NETWORK_COMMAND_CONFIRM_PATH;
- encode_cstring(pname.get_data(), &packet[1]);
-
- network_peer->set_transfer_mode(NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE);
- network_peer->set_target_peer(p_from);
- network_peer->put_packet(packet.ptr(), packet.size());
- }
- } break;
- case NETWORK_COMMAND_CONFIRM_PATH: {
-
- String paths;
- paths.parse_utf8((const char *)&p_packet[1], p_packet_len - 1);
-
- NodePath path = paths;
-
- PathSentCache *psc = path_send_cache.getptr(path);
- ERR_FAIL_COND(!psc);
-
- Map<int, bool>::Element *E = psc->confirmed_peers.find(p_from);
- ERR_FAIL_COND(!E);
- E->get() = true;
- } break;
- }
-}
-
-void SceneTree::_network_poll() {
-
- if (!network_peer.is_valid() || network_peer->get_connection_status() == NetworkedMultiplayerPeer::CONNECTION_DISCONNECTED)
- return;
-
- network_peer->poll();
-
- if (!network_peer.is_valid()) //it's possible that polling might have resulted in a disconnection, so check here
- return;
-
- while (network_peer->get_available_packet_count()) {
-
- int sender = network_peer->get_packet_peer();
- const uint8_t *packet;
- int len;
-
- Error err = network_peer->get_packet(&packet, len);
- if (err != OK) {
- ERR_PRINT("Error getting packet!");
- }
-
- rpc_sender_id = sender;
- _network_process_packet(sender, packet, len);
- rpc_sender_id = 0;
-
- if (!network_peer.is_valid()) {
- break; //it's also possible that a packet or RPC caused a disconnection, so also check here
- }
- }
+ return multiplayer->is_refusing_new_network_connections();
}
void SceneTree::_bind_methods() {
@@ -2141,10 +1759,8 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_debug_navigation_hint", "enable"), &SceneTree::set_debug_navigation_hint);
ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint);
-#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene"), &SceneTree::set_edited_scene_root);
ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &SceneTree::get_edited_scene_root);
-#endif
ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause);
ClassDB::bind_method(D_METHOD("is_paused"), &SceneTree::is_paused);
@@ -2194,6 +1810,10 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("_change_scene"), &SceneTree::_change_scene);
+ ClassDB::bind_method(D_METHOD("set_multiplayer", "multiplayer"), &SceneTree::set_multiplayer);
+ ClassDB::bind_method(D_METHOD("get_multiplayer"), &SceneTree::get_multiplayer);
+ ClassDB::bind_method(D_METHOD("set_multiplayer_poll_enabled", "enabled"), &SceneTree::set_multiplayer_poll_enabled);
+ ClassDB::bind_method(D_METHOD("is_multiplayer_poll_enabled"), &SceneTree::is_multiplayer_poll_enabled);
ClassDB::bind_method(D_METHOD("set_network_peer", "peer"), &SceneTree::set_network_peer);
ClassDB::bind_method(D_METHOD("get_network_peer"), &SceneTree::get_network_peer);
ClassDB::bind_method(D_METHOD("is_network_server"), &SceneTree::is_network_server);
@@ -2217,12 +1837,12 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_font_oversampling"), "set_use_font_oversampling", "is_using_font_oversampling");
-#ifdef TOOLS_ENABLED
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_edited_scene_root", "get_edited_scene_root");
-#endif
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "", "get_root");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", 0), "set_multiplayer", "get_multiplayer");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "multiplayer_poll"), "set_multiplayer_poll_enabled", "is_multiplayer_poll_enabled");
ADD_SIGNAL(MethodInfo("tree_changed"));
ADD_SIGNAL(MethodInfo("node_added", PropertyInfo(Variant::OBJECT, "node")));
@@ -2318,7 +1938,6 @@ SceneTree::SceneTree() {
call_lock = 0;
root_lock = 0;
node_count = 0;
- rpc_sender_id = 0;
//create with mainloop
@@ -2327,6 +1946,10 @@ SceneTree::SceneTree() {
if (!root->get_world().is_valid())
root->set_world(Ref<World>(memnew(World)));
+ // Initialize network state
+ multiplayer_poll = true;
+ set_multiplayer(Ref<MultiplayerAPI>(memnew(MultiplayerAPI)));
+
//root->set_world_2d( Ref<World2D>( memnew( World2D )));
root->set_as_audio_listener(true);
root->set_as_audio_listener_2d(true);
@@ -2421,8 +2044,6 @@ SceneTree::SceneTree() {
live_edit_root = NodePath("/root");
- last_send_cache_id = 1;
-
#endif
use_font_oversampling = false;
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index c5357762ec..aa8d78b1e1 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -31,7 +31,7 @@
#ifndef SCENE_MAIN_LOOP_H
#define SCENE_MAIN_LOOP_H
-#include "io/networked_multiplayer_peer.h"
+#include "io/multiplayer_api.h"
#include "os/main_loop.h"
#include "os/thread_safe.h"
#include "scene/resources/mesh.h"
@@ -185,16 +185,9 @@ private:
///network///
- enum NetworkCommands {
- NETWORK_COMMAND_REMOTE_CALL,
- NETWORK_COMMAND_REMOTE_SET,
- NETWORK_COMMAND_SIMPLIFY_PATH,
- NETWORK_COMMAND_CONFIRM_PATH,
- };
-
- Ref<NetworkedMultiplayerPeer> network_peer;
+ Ref<MultiplayerAPI> multiplayer;
+ bool multiplayer_poll;
- Set<int> connected_peers;
void _network_peer_connected(int p_id);
void _network_peer_disconnected(int p_id);
@@ -202,39 +195,9 @@ private:
void _connection_failed();
void _server_disconnected();
- int rpc_sender_id;
-
- //path sent caches
- struct PathSentCache {
- Map<int, bool> confirmed_peers;
- int id;
- };
-
- HashMap<NodePath, PathSentCache> path_send_cache;
- int last_send_cache_id;
-
- //path get caches
- struct PathGetCache {
- struct NodeInfo {
- NodePath path;
- ObjectID instance;
- };
-
- Map<int, NodeInfo> nodes;
- };
-
- Map<int, PathGetCache> path_get_cache;
-
- Vector<uint8_t> packet_cache;
-
- void _network_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len);
- void _network_poll();
-
static SceneTree *singleton;
friend class Node;
- void _rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount);
-
void tree_changed();
void node_added(Node *p_node);
void node_removed(Node *p_node);
@@ -428,10 +391,8 @@ public:
//void change_scene(const String& p_path);
//Node *get_loaded_scene();
-#ifdef TOOLS_ENABLED
void set_edited_scene_root(Node *p_node);
Node *get_edited_scene_root() const;
-#endif
void set_current_scene(Node *p_scene);
Node *get_current_scene() const;
@@ -450,6 +411,10 @@ public:
//network API
+ Ref<MultiplayerAPI> get_multiplayer() const;
+ void set_multiplayer_poll_enabled(bool p_enabled);
+ bool is_multiplayer_poll_enabled() const;
+ void set_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer);
Ref<NetworkedMultiplayerPeer> get_network_peer() const;
bool is_network_server() const;
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index ad2cdbfd0f..c285694dfa 100755
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -107,7 +107,10 @@ bool Timer::has_autostart() const {
return autostart;
}
-void Timer::start() {
+void Timer::start(float p_time) {
+ if (p_time > 0) {
+ set_wait_time(p_time);
+ }
time_left = wait_time;
_set_process(true);
}
@@ -185,7 +188,7 @@ void Timer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_autostart", "enable"), &Timer::set_autostart);
ClassDB::bind_method(D_METHOD("has_autostart"), &Timer::has_autostart);
- ClassDB::bind_method(D_METHOD("start"), &Timer::start);
+ ClassDB::bind_method(D_METHOD("start", "time_sec"), &Timer::start, DEFVAL(-1));
ClassDB::bind_method(D_METHOD("stop"), &Timer::stop);
ClassDB::bind_method(D_METHOD("set_paused", "paused"), &Timer::set_paused);
diff --git a/scene/main/timer.h b/scene/main/timer.h
index 410d985407..2f42252a7e 100755
--- a/scene/main/timer.h
+++ b/scene/main/timer.h
@@ -64,7 +64,7 @@ public:
void set_autostart(bool p_start);
bool has_autostart() const;
- void start();
+ void start(float p_time = -1);
void stop();
void set_paused(bool p_paused);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 1ff1f4b6d8..a894b82a94 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -72,6 +72,9 @@ void ViewportTexture::setup_local_to_scene() {
vp->viewport_textures.insert(this);
VS::get_singleton()->texture_set_proxy(proxy, vp->texture_rid);
+
+ vp->texture_flags = flags;
+ VS::get_singleton()->texture_set_flags(vp->texture_rid, flags);
}
void ViewportTexture::set_viewport_path_in_scene(const NodePath &p_path) {
@@ -122,20 +125,18 @@ Ref<Image> ViewportTexture::get_data() const {
return VS::get_singleton()->texture_get_data(vp->texture_rid);
}
void ViewportTexture::set_flags(uint32_t p_flags) {
+ flags = p_flags;
if (!vp)
return;
- vp->texture_flags = p_flags;
- VS::get_singleton()->texture_set_flags(vp->texture_rid, p_flags);
+ vp->texture_flags = flags;
+ VS::get_singleton()->texture_set_flags(vp->texture_rid, flags);
}
uint32_t ViewportTexture::get_flags() const {
- if (!vp)
- return 0;
-
- return vp->texture_flags;
+ return flags;
}
void ViewportTexture::_bind_methods() {
@@ -143,12 +144,13 @@ void ViewportTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_viewport_path_in_scene", "path"), &ViewportTexture::set_viewport_path_in_scene);
ClassDB::bind_method(D_METHOD("get_viewport_path_in_scene"), &ViewportTexture::get_viewport_path_in_scene);
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "viewport_path"), "set_viewport_path_in_scene", "get_viewport_path_in_scene");
+ ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "viewport_path", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Viewport"), "set_viewport_path_in_scene", "get_viewport_path_in_scene");
}
ViewportTexture::ViewportTexture() {
vp = NULL;
+ flags = 0;
set_local_to_scene(true);
proxy = VS::get_singleton()->texture_create();
}
@@ -181,6 +183,7 @@ public:
Viewport::GUI::GUI() {
mouse_focus = NULL;
+ mouse_click_grabber = NULL;
mouse_focus_button = -1;
key_focus = NULL;
mouse_over = NULL;
@@ -188,10 +191,12 @@ Viewport::GUI::GUI() {
tooltip = NULL;
tooltip_popup = NULL;
tooltip_label = NULL;
+ subwindow_visibility_dirty = false;
subwindow_order_dirty = false;
}
/////////////////////////////////////
+
void Viewport::_update_stretch_transform() {
if (size_override_stretch && size_override) {
@@ -318,6 +323,11 @@ void Viewport::_notification(int p_what) {
first->make_current();
}
#endif
+
+ // Enable processing for tooltips, collision debugging, physics object picking, etc.
+ set_process_internal(true);
+ set_physics_process_internal(true);
+
} break;
case NOTIFICATION_EXIT_TREE: {
@@ -345,15 +355,18 @@ void Viewport::_notification(int p_what) {
VS::get_singleton()->viewport_set_active(viewport, false);
} break;
- case NOTIFICATION_PHYSICS_PROCESS: {
+ case NOTIFICATION_INTERNAL_PROCESS: {
if (gui.tooltip_timer >= 0) {
- gui.tooltip_timer -= get_physics_process_delta_time();
+ gui.tooltip_timer -= get_process_delta_time();
if (gui.tooltip_timer < 0) {
_gui_show_tooltip();
}
}
+ } break;
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
+
if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) {
VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug);
@@ -1241,6 +1254,24 @@ void Viewport::warp_mouse(const Vector2 &p_pos) {
Input::get_singleton()->warp_mouse_position(gpos);
}
+void Viewport::_gui_prepare_subwindows() {
+
+ if (gui.subwindow_visibility_dirty) {
+
+ gui.subwindows.clear();
+ for (List<Control *>::Element *E = gui.all_known_subwindows.front(); E; E = E->next()) {
+ if (E->get()->is_visible_in_tree()) {
+ gui.subwindows.push_back(E->get());
+ }
+ }
+
+ gui.subwindow_visibility_dirty = false;
+ gui.subwindow_order_dirty = true;
+ }
+
+ _gui_sort_subwindows();
+}
+
void Viewport::_gui_sort_subwindows() {
if (!gui.subwindow_order_dirty)
@@ -1277,13 +1308,37 @@ void Viewport::_gui_cancel_tooltip() {
}
}
+String Viewport::_gui_get_tooltip(Control *p_control, const Vector2 &p_pos) {
+
+ Vector2 pos = p_pos;
+ String tooltip;
+
+ while (p_control) {
+
+ tooltip = p_control->get_tooltip(pos);
+
+ if (tooltip != String())
+ break;
+ pos = p_control->get_transform().xform(pos);
+
+ if (p_control->data.mouse_filter == Control::MOUSE_FILTER_STOP)
+ break;
+ if (p_control->is_set_as_toplevel())
+ break;
+
+ p_control = p_control->get_parent_control();
+ }
+
+ return tooltip;
+}
+
void Viewport::_gui_show_tooltip() {
if (!gui.tooltip) {
return;
}
- String tooltip = gui.tooltip->get_tooltip(gui.tooltip->get_global_transform().xform_inv(gui.tooltip_pos));
+ String tooltip = _gui_get_tooltip(gui.tooltip, gui.tooltip->get_global_transform().xform_inv(gui.tooltip_pos));
if (tooltip.length() == 0)
return; // bye
@@ -1316,7 +1371,7 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT));
gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM));
gui.tooltip_label->set_text(tooltip.strip_edges());
- Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_combined_minimum_size() + ttp->get_minimum_size());
+ Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_minimum_size() + ttp->get_minimum_size());
Rect2 vr = gui.tooltip_label->get_viewport_rect();
if (r.size.x + r.position.x > vr.size.x)
r.position.x = vr.size.x - r.size.x;
@@ -1357,12 +1412,14 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu
Control *control = Object::cast_to<Control>(ci);
if (control) {
- control->call_multilevel(SceneStringNames::get_singleton()->_gui_input, ev);
+
+ control->emit_signal(SceneStringNames::get_singleton()->gui_input, ev); //signal should be first, so it's possible to override an event (and then accept it)
if (gui.key_event_accepted)
break;
if (!control->is_inside_tree())
break;
- control->emit_signal(SceneStringNames::get_singleton()->gui_input, ev);
+ control->call_multilevel(SceneStringNames::get_singleton()->_gui_input, ev);
+
if (!control->is_inside_tree() || control->is_set_as_toplevel())
break;
if (gui.key_event_accepted)
@@ -1383,7 +1440,7 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu
Control *Viewport::_gui_find_control(const Point2 &p_global) {
- _gui_sort_subwindows();
+ _gui_prepare_subwindows();
for (List<Control *>::Element *E = gui.subwindows.back(); E; E = E->prev()) {
@@ -1531,7 +1588,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (mb->is_pressed()) {
Size2 pos = mpos;
- if (gui.mouse_focus && mb->get_button_index() != gui.mouse_focus_button && mb->get_button_index() == BUTTON_LEFT) {
+ if (gui.mouse_focus && mb->get_button_index() != gui.mouse_focus_button) {
//do not steal mouse focus and stuff
@@ -1804,7 +1861,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
}
if (!over) {
- OS::get_singleton()->set_cursor_shape(OS::CURSOR_ARROW);
+ OS::get_singleton()->set_cursor_shape((OS::CursorShape)Input::get_singleton()->get_default_cursor_shape());
return;
}
@@ -1833,7 +1890,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (gui.tooltip_popup) {
if (can_tooltip) {
- String tooltip = over->get_tooltip(gui.tooltip->get_global_transform().xform_inv(mpos));
+ String tooltip = _gui_get_tooltip(over, gui.tooltip->get_global_transform().xform_inv(mpos));
if (tooltip.length() == 0)
_gui_cancel_tooltip();
@@ -1855,7 +1912,23 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
mm->set_position(pos);
- Control::CursorShape cursor_shape = over->get_cursor_shape(pos);
+ Control::CursorShape cursor_shape = Control::CURSOR_ARROW;
+ {
+ Control *c = over;
+ Vector2 cpos = pos;
+ while (c) {
+ cursor_shape = c->get_cursor_shape(cpos);
+ cpos = c->get_transform().xform(cpos);
+ if (cursor_shape != Control::CURSOR_ARROW)
+ break;
+ if (c->data.mouse_filter == Control::MOUSE_FILTER_STOP)
+ break;
+ if (c->is_set_as_toplevel())
+ break;
+ c = c->get_parent_control();
+ }
+ }
+
OS::get_singleton()->set_cursor_shape((OS::CursorShape)cursor_shape);
if (over->can_process()) {
@@ -1925,6 +1998,8 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Ref<InputEventGesture> gesture_event = p_event;
if (gesture_event.is_valid()) {
+ gui.key_event_accepted = false;
+
_gui_cancel_tooltip();
Size2 pos = gesture_event->get_position();
@@ -2017,6 +2092,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
top->notification(Control::NOTIFICATION_MODAL_CLOSE);
top->_modal_stack_remove();
top->hide();
+ // Close modal, set input as handled
+ get_tree()->set_input_as_handled();
+ return;
}
}
@@ -2078,8 +2156,14 @@ List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) {
List<Control *>::Element *Viewport::_gui_add_subwindow_control(Control *p_control) {
- gui.subwindow_order_dirty = true;
- return gui.subwindows.push_back(p_control);
+ p_control->connect("visibility_changed", this, "_subwindow_visibility_changed");
+
+ if (p_control->is_visible_in_tree()) {
+ gui.subwindow_order_dirty = true;
+ gui.subwindows.push_back(p_control);
+ }
+
+ return gui.all_known_subwindows.push_back(p_control);
}
void Viewport::_gui_set_subwindow_order_dirty() {
@@ -2153,9 +2237,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {
p_control->set_position(gui.last_mouse_pos);
p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport
p_control->raise();
- if (gui.drag_preview) {
- memdelete(gui.drag_preview);
- }
+
gui.drag_preview = p_control;
}
@@ -2166,7 +2248,17 @@ void Viewport::_gui_remove_root_control(List<Control *>::Element *RI) {
void Viewport::_gui_remove_subwindow_control(List<Control *>::Element *SI) {
- gui.subwindows.erase(SI);
+ ERR_FAIL_COND(!SI);
+
+ Control *control = SI->get();
+
+ control->disconnect("visibility_changed", this, "_subwindow_visibility_changed");
+
+ List<Control *>::Element *E = gui.subwindows.find(control);
+ if (E)
+ gui.subwindows.erase(E);
+
+ gui.all_known_subwindows.erase(SI);
}
void Viewport::_gui_unfocus_control(Control *p_control) {
@@ -2193,7 +2285,7 @@ void Viewport::_gui_hid_control(Control *p_control) {
*/
if (gui.key_focus == p_control)
- gui.key_focus = NULL;
+ _gui_remove_focus();
if (gui.mouse_over == p_control)
gui.mouse_over = NULL;
if (gui.tooltip == p_control)
@@ -2264,7 +2356,7 @@ List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
else
p_control->_modal_set_prev_focus_owner(0);
- if (gui.mouse_focus && !p_control->is_a_parent_of(gui.mouse_focus)) {
+ if (gui.mouse_focus && !p_control->is_a_parent_of(gui.mouse_focus) && !gui.mouse_click_grabber) {
Ref<InputEventMouseButton> mb;
mb.instance();
mb->set_position(gui.mouse_focus->get_local_mouse_position());
@@ -2286,9 +2378,22 @@ Control *Viewport::_gui_get_focus_owner() {
void Viewport::_gui_grab_click_focus(Control *p_control) {
+ gui.mouse_click_grabber = p_control;
+ call_deferred("_post_gui_grab_click_focus");
+}
+
+void Viewport::_post_gui_grab_click_focus() {
+
+ Control *focus_grabber = gui.mouse_click_grabber;
+ if (!focus_grabber) {
+ // Redundant grab requests were made
+ return;
+ }
+ gui.mouse_click_grabber = NULL;
+
if (gui.mouse_focus) {
- if (gui.mouse_focus == p_control)
+ if (gui.mouse_focus == focus_grabber)
return;
Ref<InputEventMouseButton> mb;
mb.instance();
@@ -2299,9 +2404,9 @@ void Viewport::_gui_grab_click_focus(Control *p_control) {
mb->set_position(click);
mb->set_button_index(gui.mouse_focus_button);
mb->set_pressed(false);
- gui.mouse_focus->call_deferred(SceneStringNames::get_singleton()->_gui_input, mb);
+ gui.mouse_focus->call_multilevel(SceneStringNames::get_singleton()->_gui_input, mb);
- gui.mouse_focus = p_control;
+ gui.mouse_focus = focus_grabber;
gui.focus_inv_xform = gui.mouse_focus->get_global_transform_with_canvas().affine_inverse();
click = gui.mouse_focus->get_global_transform_with_canvas().affine_inverse().xform(gui.last_mouse_pos);
mb->set_position(click);
@@ -2404,9 +2509,14 @@ Rect2 Viewport::get_attach_to_screen_rect() const {
void Viewport::set_physics_object_picking(bool p_enable) {
physics_object_picking = p_enable;
- set_physics_process(physics_object_picking);
- if (!physics_object_picking)
+ if (!physics_object_picking) {
physics_picking_events.clear();
+ }
+}
+
+bool Viewport::get_physics_object_picking() {
+
+ return physics_object_picking;
}
Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const {
@@ -2420,11 +2530,6 @@ Vector2 Viewport::get_camera_rect_size() const {
return size;
}
-bool Viewport::get_physics_object_picking() {
-
- return physics_object_picking;
-}
-
bool Viewport::gui_has_modal_stack() const {
return gui.modal_stack.size();
@@ -2449,6 +2554,16 @@ bool Viewport::is_3d_disabled() const {
return disable_3d;
}
+void Viewport::set_keep_3d_linear(bool p_keep_3d_linear) {
+ keep_3d_linear = p_keep_3d_linear;
+ VS::get_singleton()->viewport_set_keep_3d_linear(viewport, keep_3d_linear);
+}
+
+bool Viewport::get_keep_3d_linear() const {
+
+ return keep_3d_linear;
+}
+
Variant Viewport::gui_get_drag_data() const {
return gui.drag_data;
}
@@ -2632,8 +2747,12 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_disable_3d", "disable"), &Viewport::set_disable_3d);
ClassDB::bind_method(D_METHOD("is_3d_disabled"), &Viewport::is_3d_disabled);
+ ClassDB::bind_method(D_METHOD("set_keep_3d_linear", "keep_3d_linear"), &Viewport::set_keep_3d_linear);
+ ClassDB::bind_method(D_METHOD("get_keep_3d_linear"), &Viewport::get_keep_3d_linear);
+
ClassDB::bind_method(D_METHOD("_gui_show_tooltip"), &Viewport::_gui_show_tooltip);
ClassDB::bind_method(D_METHOD("_gui_remove_focus"), &Viewport::_gui_remove_focus);
+ ClassDB::bind_method(D_METHOD("_post_gui_grab_click_focus"), &Viewport::_post_gui_grab_click_focus);
ClassDB::bind_method(D_METHOD("set_shadow_atlas_size", "size"), &Viewport::set_shadow_atlas_size);
ClassDB::bind_method(D_METHOD("get_shadow_atlas_size"), &Viewport::get_shadow_atlas_size);
@@ -2644,6 +2763,8 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shadow_atlas_quadrant_subdiv", "quadrant", "subdiv"), &Viewport::set_shadow_atlas_quadrant_subdiv);
ClassDB::bind_method(D_METHOD("get_shadow_atlas_quadrant_subdiv", "quadrant"), &Viewport::get_shadow_atlas_quadrant_subdiv);
+ ClassDB::bind_method(D_METHOD("_subwindow_visibility_changed"), &Viewport::_subwindow_visibility_changed);
+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "arvr"), "set_use_arvr", "use_arvr");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
@@ -2655,6 +2776,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x"), "set_msaa", "get_msaa");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hdr"), "set_hdr", "get_hdr");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_3d_linear"), "set_keep_3d_linear", "get_keep_3d_linear");
ADD_PROPERTY(PropertyInfo(Variant::INT, "usage", PROPERTY_HINT_ENUM, "2D,2D No-Sampling,3D,3D No-Effects"), "set_usage", "get_usage");
ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
ADD_GROUP("Render Target", "render_target_");
@@ -2723,6 +2845,13 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(CLEAR_MODE_ONLY_NEXT_FRAME);
}
+void Viewport::_subwindow_visibility_changed() {
+
+ // unfortunately, we don't know the sender, i.e. which subwindow changed;
+ // so we have to check them all.
+ gui.subwindow_visibility_dirty = true;
+}
+
Viewport::Viewport() {
world_2d = Ref<World2D>(memnew(World2D));
@@ -2777,6 +2906,7 @@ Viewport::Viewport() {
disable_input = false;
disable_3d = false;
+ keep_3d_linear = false;
//window tooltip
gui.tooltip_timer = -1;
@@ -2789,6 +2919,7 @@ Viewport::Viewport() {
gui.drag_preview = NULL;
gui.drag_attempted = false;
gui.canvas_sort_index = 0;
+ gui.roots_order_dirty = false;
msaa = MSAA_DISABLED;
hdr = true;
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 07bbd3f1fa..3000398540 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -58,6 +58,7 @@ class ViewportTexture : public Texture {
friend class Viewport;
Viewport *vp;
+ uint32_t flags;
RID proxy;
@@ -226,6 +227,7 @@ private:
void _update_global_transform();
bool disable_3d;
+ bool keep_3d_linear;
UpdateMode update_mode;
RID texture_rid;
uint32_t texture_flags;
@@ -248,6 +250,7 @@ private:
bool key_event_accepted;
Control *mouse_focus;
+ Control *mouse_click_grabber;
int mouse_focus_button;
Control *key_focus;
Control *mouse_over;
@@ -265,7 +268,9 @@ private:
List<Control *> modal_stack;
Transform2D focus_inv_xform;
bool subwindow_order_dirty;
- List<Control *> subwindows;
+ bool subwindow_visibility_dirty;
+ List<Control *> subwindows; // visible subwindows
+ List<Control *> all_known_subwindows;
bool roots_order_dirty;
List<Control *> roots;
int canvas_sort_index; //for sorting items with canvas as root
@@ -276,6 +281,7 @@ private:
bool disable_input;
void _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input);
+ void _gui_prepare_subwindows();
void _gui_sort_subwindows();
void _gui_sort_roots();
void _gui_sort_modal_stack();
@@ -306,6 +312,7 @@ private:
void _gui_remove_root_control(List<Control *>::Element *RI);
void _gui_remove_subwindow_control(List<Control *>::Element *SI);
+ String _gui_get_tooltip(Control *p_control, const Vector2 &p_pos);
void _gui_cancel_tooltip();
void _gui_show_tooltip();
@@ -323,6 +330,7 @@ private:
bool _gui_control_has_focus(const Control *p_control);
void _gui_control_grab_focus(Control *p_control);
void _gui_grab_click_focus(Control *p_control);
+ void _post_gui_grab_click_focus();
void _gui_accept_event();
Control *_gui_get_focus_owner();
@@ -431,6 +439,9 @@ public:
void set_disable_3d(bool p_disable);
bool is_3d_disabled() const;
+ void set_keep_3d_linear(bool p_keep_3d_linear);
+ bool get_keep_3d_linear() const;
+
void set_attach_to_screen_rect(const Rect2 &p_rect);
Rect2 get_attach_to_screen_rect() const;
@@ -461,6 +472,8 @@ public:
void set_snap_controls_to_pixels(bool p_enable);
bool is_snap_controls_to_pixels_enabled() const;
+ void _subwindow_visibility_changed();
+
Viewport();
~Viewport();
};
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 19d8f09ebe..55aa0024c8 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -58,12 +58,19 @@
#include "scene/2d/ray_cast_2d.h"
#include "scene/2d/remote_transform_2d.h"
#include "scene/2d/screen_button.h"
+#include "scene/2d/skeleton_2d.h"
#include "scene/2d/sprite.h"
#include "scene/2d/tile_map.h"
#include "scene/2d/visibility_notifier_2d.h"
#include "scene/2d/y_sort.h"
+#include "scene/animation/animation_blend_space_1d.h"
+#include "scene/animation/animation_blend_space_2d.h"
+#include "scene/animation/animation_blend_tree.h"
+#include "scene/animation/animation_node_state_machine.h"
#include "scene/animation/animation_player.h"
+#include "scene/animation/animation_tree.h"
#include "scene/animation/animation_tree_player.h"
+#include "scene/animation/root_motion_view.h"
#include "scene/animation/tween.h"
#include "scene/audio/audio_player.h"
#include "scene/gui/box_container.h"
@@ -381,6 +388,28 @@ void register_scene_types() {
ClassDB::register_class<NavigationMesh>();
ClassDB::register_class<Navigation>();
+ ClassDB::register_class<RootMotionView>();
+ ClassDB::set_class_enabled("RootMotionView", false); //disabled by default, enabled by editor
+
+ ClassDB::register_class<AnimationTree>();
+ ClassDB::register_class<AnimationNode>();
+ ClassDB::register_class<AnimationRootNode>();
+ ClassDB::register_class<AnimationNodeBlendTree>();
+ ClassDB::register_class<AnimationNodeBlendSpace1D>();
+ ClassDB::register_class<AnimationNodeBlendSpace2D>();
+ ClassDB::register_class<AnimationNodeStateMachine>();
+ ClassDB::register_class<AnimationNodeStateMachineTransition>();
+ ClassDB::register_class<AnimationNodeOutput>();
+ ClassDB::register_class<AnimationNodeOneShot>();
+ ClassDB::register_class<AnimationNodeAnimation>();
+ ClassDB::register_class<AnimationNodeAdd2>();
+ ClassDB::register_class<AnimationNodeAdd3>();
+ ClassDB::register_class<AnimationNodeBlend2>();
+ ClassDB::register_class<AnimationNodeBlend3>();
+ ClassDB::register_class<AnimationNodeTimeScale>();
+ ClassDB::register_class<AnimationNodeTimeSeek>();
+ ClassDB::register_class<AnimationNodeTransition>();
+
OS::get_singleton()->yield(); //may take time to init
ClassDB::register_virtual_class<CollisionObject>();
@@ -389,6 +418,7 @@ void register_scene_types() {
ClassDB::register_class<RigidBody>();
ClassDB::register_class<KinematicCollision>();
ClassDB::register_class<KinematicBody>();
+ ClassDB::register_class<PhysicalBone>();
ClassDB::register_class<VehicleBody>();
ClassDB::register_class<VehicleWheel>();
@@ -402,6 +432,7 @@ void register_scene_types() {
ClassDB::register_class<Curve3D>();
ClassDB::register_class<Path>();
ClassDB::register_class<PathFollow>();
+ ClassDB::register_class<OrientedPathFollow>();
ClassDB::register_class<VisibilityNotifier>();
ClassDB::register_class<VisibilityEnabler>();
ClassDB::register_class<WorldEnvironment>();
@@ -449,6 +480,8 @@ void register_scene_types() {
ClassDB::register_class<VisibilityNotifier2D>();
ClassDB::register_class<VisibilityEnabler2D>();
ClassDB::register_class<Polygon2D>();
+ ClassDB::register_class<Skeleton2D>();
+ ClassDB::register_class<Bone2D>();
ClassDB::register_class<Light2D>();
ClassDB::register_class<LightOccluder2D>();
ClassDB::register_class<OccluderPolygon2D>();
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 7a1fffaa26..3185fb6768 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -32,6 +32,8 @@
#include "geometry.h"
+#define ANIM_MIN_LENGTH 0.001
+
bool Animation::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
@@ -54,6 +56,15 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
} else if (type == "method") {
add_track(TYPE_METHOD);
+ } else if (type == "bezier") {
+
+ add_track(TYPE_BEZIER);
+ } else if (type == "audio") {
+
+ add_track(TYPE_AUDIO);
+ } else if (type == "animation") {
+
+ add_track(TYPE_ANIMATION);
} else {
return false;
@@ -123,8 +134,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
int um = d["update"];
if (um < 0)
um = 0;
- else if (um > 2)
- um = 2;
+ else if (um > 3)
+ um = 3;
vt->update_mode = UpdateMode(um);
}
@@ -163,7 +174,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
return true;
- } else {
+ } else if (track_get_type(track) == TYPE_METHOD) {
while (track_get_key_count(track))
track_remove_key(track, 0); //well shouldn't be set anyway
@@ -201,6 +212,114 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
}
}
}
+ } else if (track_get_type(track) == TYPE_BEZIER) {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(tracks[track]);
+ Dictionary d = p_value;
+ ERR_FAIL_COND_V(!d.has("times"), false);
+ ERR_FAIL_COND_V(!d.has("points"), false);
+
+ PoolVector<float> times = d["times"];
+ PoolRealArray values = d["points"];
+
+ ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);
+
+ if (times.size()) {
+
+ int valcount = times.size();
+
+ PoolVector<float>::Read rt = times.read();
+ PoolVector<float>::Read rv = values.read();
+
+ bt->values.resize(valcount);
+
+ for (int i = 0; i < valcount; i++) {
+
+ bt->values[i].time = rt[i];
+ bt->values[i].transition = 0; //unused in bezier
+ bt->values[i].value.value = rv[i * 5 + 0];
+ bt->values[i].value.in_handle.x = rv[i * 5 + 1];
+ bt->values[i].value.in_handle.y = rv[i * 5 + 2];
+ bt->values[i].value.out_handle.x = rv[i * 5 + 3];
+ bt->values[i].value.out_handle.y = rv[i * 5 + 4];
+ }
+ }
+
+ return true;
+ } else if (track_get_type(track) == TYPE_AUDIO) {
+
+ AudioTrack *ad = static_cast<AudioTrack *>(tracks[track]);
+ Dictionary d = p_value;
+ ERR_FAIL_COND_V(!d.has("times"), false);
+ ERR_FAIL_COND_V(!d.has("clips"), false);
+
+ PoolVector<float> times = d["times"];
+ Array clips = d["clips"];
+
+ ERR_FAIL_COND_V(clips.size() != times.size(), false);
+
+ if (times.size()) {
+
+ int valcount = times.size();
+
+ PoolVector<float>::Read rt = times.read();
+
+ ad->values.clear();
+
+ for (int i = 0; i < valcount; i++) {
+
+ Dictionary d = clips[i];
+ if (!d.has("start_offset"))
+ continue;
+ if (!d.has("end_offset"))
+ continue;
+ if (!d.has("stream"))
+ continue;
+
+ TKey<AudioKey> ak;
+ ak.time = rt[i];
+ ak.value.start_offset = d["start_offset"];
+ ak.value.end_offset = d["end_offset"];
+ ak.value.stream = d["stream"];
+
+ ad->values.push_back(ak);
+ }
+ }
+
+ return true;
+ } else if (track_get_type(track) == TYPE_ANIMATION) {
+
+ AnimationTrack *an = static_cast<AnimationTrack *>(tracks[track]);
+ Dictionary d = p_value;
+ ERR_FAIL_COND_V(!d.has("times"), false);
+ ERR_FAIL_COND_V(!d.has("clips"), false);
+
+ PoolVector<float> times = d["times"];
+ PoolVector<String> clips = d["clips"];
+
+ ERR_FAIL_COND_V(clips.size() != times.size(), false);
+
+ if (times.size()) {
+
+ int valcount = times.size();
+
+ PoolVector<float>::Read rt = times.read();
+ PoolVector<String>::Read rc = clips.read();
+
+ an->values.resize(valcount);
+
+ for (int i = 0; i < valcount; i++) {
+
+ TKey<StringName> ak;
+ ak.time = rt[i];
+ ak.value = rc[i];
+ an->values[i] = ak;
+ }
+ }
+
+ return true;
+ } else {
+ return false;
}
} else
return false;
@@ -232,6 +351,9 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
case TYPE_TRANSFORM: r_ret = "transform"; break;
case TYPE_VALUE: r_ret = "value"; break;
case TYPE_METHOD: r_ret = "method"; break;
+ case TYPE_BEZIER: r_ret = "bezier"; break;
+ case TYPE_AUDIO: r_ret = "audio"; break;
+ case TYPE_ANIMATION: r_ret = "animation"; break;
}
return true;
@@ -329,7 +451,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
return true;
- } else {
+ } else if (track_get_type(track) == TYPE_METHOD) {
Dictionary d;
@@ -368,6 +490,119 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = d;
return true;
+ } else if (track_get_type(track) == TYPE_BEZIER) {
+
+ const BezierTrack *bt = static_cast<const BezierTrack *>(tracks[track]);
+
+ Dictionary d;
+
+ PoolVector<float> key_times;
+ PoolVector<float> key_points;
+
+ int kk = bt->values.size();
+
+ key_times.resize(kk);
+ key_points.resize(kk * 5);
+
+ PoolVector<float>::Write wti = key_times.write();
+ PoolVector<float>::Write wpo = key_points.write();
+
+ int idx = 0;
+
+ const TKey<BezierKey> *vls = bt->values.ptr();
+
+ for (int i = 0; i < kk; i++) {
+
+ wti[idx] = vls[i].time;
+ wpo[idx * 5 + 0] = vls[i].value.value;
+ wpo[idx * 5 + 1] = vls[i].value.in_handle.x;
+ wpo[idx * 5 + 2] = vls[i].value.in_handle.y;
+ wpo[idx * 5 + 3] = vls[i].value.out_handle.x;
+ wpo[idx * 5 + 4] = vls[i].value.out_handle.y;
+ idx++;
+ }
+
+ wti = PoolVector<float>::Write();
+ wpo = PoolVector<float>::Write();
+
+ d["times"] = key_times;
+ d["points"] = key_points;
+
+ r_ret = d;
+
+ return true;
+ } else if (track_get_type(track) == TYPE_AUDIO) {
+
+ const AudioTrack *ad = static_cast<const AudioTrack *>(tracks[track]);
+
+ Dictionary d;
+
+ PoolVector<float> key_times;
+ Array clips;
+
+ int kk = ad->values.size();
+
+ key_times.resize(kk);
+
+ PoolVector<float>::Write wti = key_times.write();
+
+ int idx = 0;
+
+ const TKey<AudioKey> *vls = ad->values.ptr();
+
+ for (int i = 0; i < kk; i++) {
+
+ wti[idx] = vls[i].time;
+ Dictionary clip;
+ clip["start_offset"] = vls[i].value.start_offset;
+ clip["end_offset"] = vls[i].value.end_offset;
+ clip["stream"] = vls[i].value.stream;
+ clips.push_back(clip);
+ idx++;
+ }
+
+ wti = PoolVector<float>::Write();
+
+ d["times"] = key_times;
+ d["clips"] = clips;
+
+ r_ret = d;
+
+ return true;
+ } else if (track_get_type(track) == TYPE_ANIMATION) {
+
+ const AnimationTrack *an = static_cast<const AnimationTrack *>(tracks[track]);
+
+ Dictionary d;
+
+ PoolVector<float> key_times;
+ PoolVector<String> clips;
+
+ int kk = an->values.size();
+
+ key_times.resize(kk);
+ clips.resize(kk);
+
+ PoolVector<float>::Write wti = key_times.write();
+ PoolVector<String>::Write wcl = clips.write();
+
+ const TKey<StringName> *vls = an->values.ptr();
+
+ for (int i = 0; i < kk; i++) {
+
+ wti[i] = vls[i].time;
+ wcl[i] = vls[i].value;
+ }
+
+ wti = PoolVector<float>::Write();
+ wcl = PoolVector<String>::Write();
+
+ d["times"] = key_times;
+ d["clips"] = clips;
+
+ r_ret = d;
+
+ return true;
}
} else
return false;
@@ -412,6 +647,21 @@ int Animation::add_track(TrackType p_type, int p_at_pos) {
tracks.insert(p_at_pos, memnew(MethodTrack));
} break;
+ case TYPE_BEZIER: {
+
+ tracks.insert(p_at_pos, memnew(BezierTrack));
+
+ } break;
+ case TYPE_AUDIO: {
+
+ tracks.insert(p_at_pos, memnew(AudioTrack));
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ tracks.insert(p_at_pos, memnew(AnimationTrack));
+
+ } break;
default: {
ERR_PRINT("Unknown track type");
@@ -446,6 +696,24 @@ void Animation::remove_track(int p_track) {
_clear(mt->methods);
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bz = static_cast<BezierTrack *>(t);
+ _clear(bz->values);
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *ad = static_cast<AudioTrack *>(t);
+ _clear(ad->values);
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *an = static_cast<AnimationTrack *>(t);
+ _clear(an->values);
+
+ } break;
}
memdelete(t);
@@ -642,6 +910,27 @@ void Animation::track_remove_key(int p_track, int p_idx) {
mt->methods.remove(p_idx);
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bz = static_cast<BezierTrack *>(t);
+ ERR_FAIL_INDEX(p_idx, bz->values.size());
+ bz->values.remove(p_idx);
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *ad = static_cast<AudioTrack *>(t);
+ ERR_FAIL_INDEX(p_idx, ad->values.size());
+ ad->values.remove(p_idx);
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *an = static_cast<AnimationTrack *>(t);
+ ERR_FAIL_INDEX(p_idx, an->values.size());
+ an->values.remove(p_idx);
+
+ } break;
}
emit_changed();
@@ -686,6 +975,39 @@ int Animation::track_find_key(int p_track, float p_time, bool p_exact) const {
return k;
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+ int k = _find(bt->values, p_time);
+ if (k < 0 || k >= bt->values.size())
+ return -1;
+ if (bt->values[k].time != p_time && p_exact)
+ return -1;
+ return k;
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+ int k = _find(at->values, p_time);
+ if (k < 0 || k >= at->values.size())
+ return -1;
+ if (at->values[k].time != p_time && p_exact)
+ return -1;
+ return k;
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+ int k = _find(at->values, p_time);
+ if (k < 0 || k >= at->values.size())
+ return -1;
+ if (at->values[k].time != p_time && p_exact)
+ return -1;
+ return k;
+
+ } break;
}
return -1;
@@ -748,6 +1070,51 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key
_insert(p_time, mt->methods, k);
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ Array arr = p_key;
+ ERR_FAIL_COND(arr.size() != 5);
+
+ TKey<BezierKey> k;
+ k.time = p_time;
+ k.value.value = arr[0];
+ k.value.in_handle.x = arr[1];
+ k.value.in_handle.y = arr[2];
+ k.value.out_handle.x = arr[3];
+ k.value.out_handle.y = arr[4];
+ _insert(p_time, bt->values, k);
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+
+ Dictionary k = p_key;
+ ERR_FAIL_COND(!k.has("start_offset"));
+ ERR_FAIL_COND(!k.has("end_offset"));
+ ERR_FAIL_COND(!k.has("stream"));
+
+ TKey<AudioKey> ak;
+ ak.time = p_time;
+ ak.value.start_offset = k["start_offset"];
+ ak.value.end_offset = k["end_offset"];
+ ak.value.stream = k["stream"];
+ _insert(p_time, at->values, ak);
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+
+ TKey<StringName> ak;
+ ak.time = p_time;
+ ak.value = p_key;
+
+ _insert(p_time, at->values, ak);
+
+ } break;
}
emit_changed();
@@ -776,6 +1143,21 @@ int Animation::track_get_key_count(int p_track) const {
MethodTrack *mt = static_cast<MethodTrack *>(t);
return mt->methods.size();
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+ return bt->values.size();
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+ return at->values.size();
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+ return at->values.size();
+ } break;
}
ERR_FAIL_V(-1);
@@ -817,6 +1199,41 @@ Variant Animation::track_get_key_value(int p_track, int p_key_idx) const {
return d;
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+ ERR_FAIL_INDEX_V(p_key_idx, bt->values.size(), Variant());
+
+ Array arr;
+ arr.resize(5);
+ arr[0] = bt->values[p_key_idx].value.value;
+ arr[1] = bt->values[p_key_idx].value.in_handle.x;
+ arr[2] = bt->values[p_key_idx].value.in_handle.y;
+ arr[3] = bt->values[p_key_idx].value.out_handle.x;
+ arr[4] = bt->values[p_key_idx].value.out_handle.y;
+ return arr;
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+ ERR_FAIL_INDEX_V(p_key_idx, at->values.size(), Variant());
+
+ Dictionary k;
+ k["start_offset"] = at->values[p_key_idx].value.start_offset;
+ k["end_offset"] = at->values[p_key_idx].value.end_offset;
+ k["stream"] = at->values[p_key_idx].value.stream;
+ return k;
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+ ERR_FAIL_INDEX_V(p_key_idx, at->values.size(), Variant());
+
+ return at->values[p_key_idx].value;
+
+ } break;
}
ERR_FAIL_V(Variant());
@@ -849,6 +1266,27 @@ float Animation::track_get_key_time(int p_track, int p_key_idx) const {
return mt->methods[p_key_idx].time;
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+ ERR_FAIL_INDEX_V(p_key_idx, bt->values.size(), -1);
+ return bt->values[p_key_idx].time;
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+ ERR_FAIL_INDEX_V(p_key_idx, at->values.size(), -1);
+ return at->values[p_key_idx].time;
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+ ERR_FAIL_INDEX_V(p_key_idx, at->values.size(), -1);
+ return at->values[p_key_idx].time;
+
+ } break;
}
ERR_FAIL_V(-1);
@@ -881,6 +1319,18 @@ float Animation::track_get_key_transition(int p_track, int p_key_idx) const {
return mt->methods[p_key_idx].transition;
} break;
+ case TYPE_BEZIER: {
+
+ return 1; //bezier does not really use transitions
+ } break;
+ case TYPE_AUDIO: {
+
+ return 1; //audio does not really use transitions
+ } break;
+ case TYPE_ANIMATION: {
+
+ return 1; //animation does not really use transitions
+ } break;
}
ERR_FAIL_V(0);
@@ -923,6 +1373,42 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
if (d.has("args"))
mt->methods[p_key_idx].params = d["args"];
} break;
+ case TYPE_BEZIER: {
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+ ERR_FAIL_INDEX(p_key_idx, bt->values.size());
+
+ Array arr = p_value;
+ ERR_FAIL_COND(arr.size() != 5);
+
+ bt->values[p_key_idx].value.value = arr[0];
+ bt->values[p_key_idx].value.in_handle.x = arr[1];
+ bt->values[p_key_idx].value.in_handle.y = arr[2];
+ bt->values[p_key_idx].value.out_handle.x = arr[3];
+ bt->values[p_key_idx].value.out_handle.y = arr[4];
+
+ } break;
+ case TYPE_AUDIO: {
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+
+ Dictionary k = p_value;
+ ERR_FAIL_COND(!k.has("start_offset"));
+ ERR_FAIL_COND(!k.has("end_offset"));
+ ERR_FAIL_COND(!k.has("stream"));
+
+ at->values[p_key_idx].value.start_offset = k["start_offset"];
+ at->values[p_key_idx].value.end_offset = k["end_offset"];
+ at->values[p_key_idx].value.stream = k["stream"];
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+
+ at->values[p_key_idx].value = p_value;
+
+ } break;
}
}
@@ -953,6 +1439,11 @@ void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_tra
mt->methods[p_key_idx].transition = p_transition;
} break;
+ case TYPE_BEZIER:
+ case TYPE_AUDIO:
+ case TYPE_ANIMATION: {
+ // they dont use transition
+ } break;
}
}
@@ -1410,7 +1901,7 @@ void Animation::value_track_set_update_mode(int p_track, UpdateMode p_mode) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_VALUE);
- ERR_FAIL_INDEX(p_mode, 3);
+ ERR_FAIL_INDEX(p_mode, 4);
ValueTrack *vt = static_cast<ValueTrack *>(t);
vt->update_mode = p_mode;
@@ -1426,6 +1917,161 @@ Animation::UpdateMode Animation::value_track_get_update_mode(int p_track) const
return vt->update_mode;
}
+template <class T>
+void Animation::_track_get_key_indices_in_range(const Vector<T> &p_array, float from_time, float to_time, List<int> *p_indices) const {
+
+ if (from_time != length && to_time == length)
+ to_time = length * 1.01; //include a little more if at the end
+
+ int to = _find(p_array, to_time);
+
+ // can't really send the events == time, will be sent in the next frame.
+ // if event>=len then it will probably never be requested by the anim player.
+
+ if (to >= 0 && p_array[to].time >= to_time)
+ to--;
+
+ if (to < 0)
+ return; // not bother
+
+ int from = _find(p_array, from_time);
+
+ // position in the right first event.+
+ if (from < 0 || p_array[from].time < from_time)
+ from++;
+
+ int max = p_array.size();
+
+ for (int i = from; i <= to; i++) {
+
+ ERR_CONTINUE(i < 0 || i >= max); // shouldn't happen
+ p_indices->push_back(i);
+ }
+}
+
+void Animation::track_get_key_indices_in_range(int p_track, float p_time, float p_delta, List<int> *p_indices) const {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ const Track *t = tracks[p_track];
+
+ float from_time = p_time - p_delta;
+ float to_time = p_time;
+
+ if (from_time > to_time)
+ SWAP(from_time, to_time);
+
+ if (loop) {
+
+ if (from_time > length || from_time < 0)
+ from_time = Math::fposmod(from_time, length);
+
+ if (to_time > length || to_time < 0)
+ to_time = Math::fposmod(to_time, length);
+
+ if (from_time > to_time) {
+ // handle loop by splitting
+
+ switch (t->type) {
+
+ case TYPE_TRANSFORM: {
+
+ const TransformTrack *tt = static_cast<const TransformTrack *>(t);
+ _track_get_key_indices_in_range(tt->transforms, from_time, length, p_indices);
+ _track_get_key_indices_in_range(tt->transforms, 0, to_time, p_indices);
+
+ } break;
+ case TYPE_VALUE: {
+
+ const ValueTrack *vt = static_cast<const ValueTrack *>(t);
+ _track_get_key_indices_in_range(vt->values, from_time, length, p_indices);
+ _track_get_key_indices_in_range(vt->values, 0, to_time, p_indices);
+
+ } break;
+ case TYPE_METHOD: {
+
+ const MethodTrack *mt = static_cast<const MethodTrack *>(t);
+ _track_get_key_indices_in_range(mt->methods, from_time, length, p_indices);
+ _track_get_key_indices_in_range(mt->methods, 0, to_time, p_indices);
+
+ } break;
+ case TYPE_BEZIER: {
+
+ const BezierTrack *bz = static_cast<const BezierTrack *>(t);
+ _track_get_key_indices_in_range(bz->values, from_time, length, p_indices);
+ _track_get_key_indices_in_range(bz->values, 0, to_time, p_indices);
+
+ } break;
+ case TYPE_AUDIO: {
+
+ const AudioTrack *ad = static_cast<const AudioTrack *>(t);
+ _track_get_key_indices_in_range(ad->values, from_time, length, p_indices);
+ _track_get_key_indices_in_range(ad->values, 0, to_time, p_indices);
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ const AnimationTrack *an = static_cast<const AnimationTrack *>(t);
+ _track_get_key_indices_in_range(an->values, from_time, length, p_indices);
+ _track_get_key_indices_in_range(an->values, 0, to_time, p_indices);
+
+ } break;
+ }
+ return;
+ }
+ } else {
+
+ if (from_time < 0)
+ from_time = 0;
+ if (from_time > length)
+ from_time = length;
+
+ if (to_time < 0)
+ to_time = 0;
+ if (to_time > length)
+ to_time = length;
+ }
+
+ switch (t->type) {
+
+ case TYPE_TRANSFORM: {
+
+ const TransformTrack *tt = static_cast<const TransformTrack *>(t);
+ _track_get_key_indices_in_range(tt->transforms, from_time, to_time, p_indices);
+
+ } break;
+ case TYPE_VALUE: {
+
+ const ValueTrack *vt = static_cast<const ValueTrack *>(t);
+ _track_get_key_indices_in_range(vt->values, from_time, to_time, p_indices);
+
+ } break;
+ case TYPE_METHOD: {
+
+ const MethodTrack *mt = static_cast<const MethodTrack *>(t);
+ _track_get_key_indices_in_range(mt->methods, from_time, to_time, p_indices);
+
+ } break;
+ case TYPE_BEZIER: {
+
+ const BezierTrack *bz = static_cast<const BezierTrack *>(t);
+ _track_get_key_indices_in_range(bz->values, from_time, to_time, p_indices);
+
+ } break;
+ case TYPE_AUDIO: {
+
+ const AudioTrack *ad = static_cast<const AudioTrack *>(t);
+ _track_get_key_indices_in_range(ad->values, from_time, to_time, p_indices);
+
+ } break;
+ case TYPE_ANIMATION: {
+
+ const AnimationTrack *an = static_cast<const AnimationTrack *>(t);
+ _track_get_key_indices_in_range(an->values, from_time, to_time, p_indices);
+
+ } break;
+ }
+}
+
void Animation::_method_track_get_key_indices_in_range(const MethodTrack *mt, float from_time, float to_time, List<int> *p_indices) const {
if (from_time != length && to_time == length)
@@ -1527,9 +2173,362 @@ StringName Animation::method_track_get_name(int p_track, int p_key_idx) const {
return pm->methods[p_key_idx].method;
}
+int Animation::bezier_track_insert_key(int p_track, float p_time, float p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle) {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_BEZIER, -1);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ TKey<BezierKey> k;
+ k.time = p_time;
+ k.value.value = p_value;
+ k.value.in_handle = p_in_handle;
+ if (k.value.in_handle.x > 0) {
+ k.value.in_handle.x = 0;
+ }
+ k.value.out_handle = p_out_handle;
+ if (k.value.out_handle.x < 0) {
+ k.value.out_handle.x = 0;
+ }
+
+ int key = _insert(p_time, bt->values, k);
+
+ emit_changed();
+
+ return key;
+}
+
+void Animation::bezier_track_set_key_value(int p_track, int p_index, float p_value) {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND(t->type != TYPE_BEZIER);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX(p_index, bt->values.size());
+
+ bt->values[p_index].value.value = p_value;
+ emit_changed();
+}
+
+void Animation::bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle) {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND(t->type != TYPE_BEZIER);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX(p_index, bt->values.size());
+
+ bt->values[p_index].value.in_handle = p_handle;
+ if (bt->values[p_index].value.in_handle.x > 0) {
+ bt->values[p_index].value.in_handle.x = 0;
+ }
+ emit_changed();
+}
+void Animation::bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle) {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND(t->type != TYPE_BEZIER);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX(p_index, bt->values.size());
+
+ bt->values[p_index].value.out_handle = p_handle;
+ if (bt->values[p_index].value.out_handle.x < 0) {
+ bt->values[p_index].value.out_handle.x = 0;
+ }
+ emit_changed();
+}
+float Animation::bezier_track_get_key_value(int p_track, int p_index) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_BEZIER, 0);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_index, bt->values.size(), 0);
+
+ return bt->values[p_index].value.value;
+}
+Vector2 Animation::bezier_track_get_key_in_handle(int p_track, int p_index) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), Vector2());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_BEZIER, Vector2());
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_index, bt->values.size(), Vector2());
+
+ return bt->values[p_index].value.in_handle;
+}
+Vector2 Animation::bezier_track_get_key_out_handle(int p_track, int p_index) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), Vector2());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_BEZIER, Vector2());
+
+ BezierTrack *bt = static_cast<BezierTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_index, bt->values.size(), Vector2());
+
+ return bt->values[p_index].value.out_handle;
+}
+
+static _FORCE_INLINE_ Vector2 _bezier_interp(real_t t, const Vector2 &start, const Vector2 &control_1, const Vector2 &control_2, const Vector2 &end) {
+ /* Formula from Wikipedia article on Bezier curves. */
+ real_t omt = (1.0 - t);
+ real_t omt2 = omt * omt;
+ real_t omt3 = omt2 * omt;
+ real_t t2 = t * t;
+ real_t t3 = t2 * t;
+
+ return start * omt3 + control_1 * omt2 * t * 3.0 + control_2 * omt * t2 * 3.0 + end * t3;
+}
+
+float Animation::bezier_track_interpolate(int p_track, float p_time) const {
+ //this uses a different interpolation scheme
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
+ Track *track = tracks[p_track];
+ ERR_FAIL_COND_V(track->type != TYPE_BEZIER, 0);
+
+ BezierTrack *bt = static_cast<BezierTrack *>(track);
+
+ int len = _find(bt->values, length) + 1; // try to find last key (there may be more past the end)
+
+ if (len <= 0) {
+ // (-1 or -2 returned originally) (plus one above)
+ return 0;
+ } else if (len == 1) { // one key found (0+1), return it
+ return bt->values[0].value.value;
+ }
+
+ int idx = _find(bt->values, p_time);
+
+ ERR_FAIL_COND_V(idx == -2, 0);
+
+ //there really is no looping interpolation on bezier
+
+ if (idx < 0) {
+ return bt->values[0].value.value;
+ }
+
+ if (idx >= bt->values.size() - 1) {
+ return bt->values[bt->values.size() - 1].value.value;
+ }
+
+ float t = p_time - bt->values[idx].time;
+
+ int iterations = 10;
+
+ float low = 0;
+ float high = bt->values[idx + 1].time - bt->values[idx].time;
+ float middle = 0;
+
+ Vector2 start(0, bt->values[idx].value.value);
+ Vector2 start_out = start + bt->values[idx].value.out_handle;
+ Vector2 end(high, bt->values[idx + 1].value.value);
+ Vector2 end_in = end + bt->values[idx + 1].value.in_handle;
+
+ //narrow high and low as much as possible
+ for (int i = 0; i < iterations; i++) {
+
+ middle = (low + high) / 2;
+
+ Vector2 interp = _bezier_interp(middle, start, start_out, end_in, end);
+
+ if (interp.x < t) {
+ low = middle;
+ } else {
+ high = middle;
+ }
+ }
+
+ //interpolate the result:
+ Vector2 low_pos = _bezier_interp(low, start, start_out, end_in, end);
+ Vector2 high_pos = _bezier_interp(high, start, start_out, end_in, end);
+
+ float c = (t - low_pos.x) / (high_pos.x - low_pos.x);
+
+ return low_pos.linear_interpolate(high_pos, c).y;
+}
+
+int Animation::audio_track_insert_key(int p_track, float p_time, const RES &p_stream, float p_start_offset, float p_end_offset) {
+
+ print_line("really insert key? ");
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_AUDIO, -1);
+
+ AudioTrack *at = static_cast<AudioTrack *>(t);
+
+ TKey<AudioKey> k;
+ k.time = p_time;
+ k.value.stream = p_stream;
+ k.value.start_offset = p_start_offset;
+ if (k.value.start_offset < 0)
+ k.value.start_offset = 0;
+ k.value.end_offset = p_end_offset;
+ if (k.value.end_offset < 0)
+ k.value.end_offset = 0;
+
+ int key = _insert(p_time, at->values, k);
+
+ emit_changed();
+
+ return key;
+}
+
+void Animation::audio_track_set_key_stream(int p_track, int p_key, const RES &p_stream) {
+
+ 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);
+
+ ERR_FAIL_INDEX(p_key, at->values.size());
+
+ at->values[p_key].value.stream = p_stream;
+
+ emit_changed();
+}
+
+void Animation::audio_track_set_key_start_offset(int p_track, int p_key, float p_offset) {
+
+ 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);
+
+ ERR_FAIL_INDEX(p_key, at->values.size());
+
+ if (p_offset < 0)
+ p_offset = 0;
+
+ at->values[p_key].value.start_offset = p_offset;
+
+ emit_changed();
+}
+
+void Animation::audio_track_set_key_end_offset(int p_track, int p_key, float p_offset) {
+
+ 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);
+
+ ERR_FAIL_INDEX(p_key, at->values.size());
+
+ if (p_offset < 0)
+ p_offset = 0;
+
+ at->values[p_key].value.end_offset = p_offset;
+
+ emit_changed();
+}
+
+RES Animation::audio_track_get_key_stream(int p_track, int p_key) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), RES());
+ const Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_AUDIO, RES());
+
+ const AudioTrack *at = static_cast<const AudioTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_key, at->values.size(), RES());
+
+ return at->values[p_key].value.stream;
+}
+float Animation::audio_track_get_key_start_offset(int p_track, int p_key) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
+ const Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_AUDIO, 0);
+
+ const AudioTrack *at = static_cast<const AudioTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_key, at->values.size(), 0);
+
+ return at->values[p_key].value.start_offset;
+}
+float Animation::audio_track_get_key_end_offset(int p_track, int p_key) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
+ const Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_AUDIO, 0);
+
+ const AudioTrack *at = static_cast<const AudioTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_key, at->values.size(), 0);
+
+ return at->values[p_key].value.end_offset;
+}
+
+//
+
+int Animation::animation_track_insert_key(int p_track, float p_time, const StringName &p_animation) {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_ANIMATION, -1);
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+
+ TKey<StringName> k;
+ k.time = p_time;
+ k.value = p_animation;
+
+ int key = _insert(p_time, at->values, k);
+
+ emit_changed();
+
+ return key;
+}
+
+void Animation::animation_track_set_key_animation(int p_track, int p_key, const StringName &p_animation) {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ Track *t = tracks[p_track];
+ ERR_FAIL_COND(t->type != TYPE_ANIMATION);
+
+ AnimationTrack *at = static_cast<AnimationTrack *>(t);
+
+ ERR_FAIL_INDEX(p_key, at->values.size());
+
+ at->values[p_key].value = p_animation;
+
+ emit_changed();
+}
+
+StringName Animation::animation_track_get_key_animation(int p_track, int p_key) const {
+
+ ERR_FAIL_INDEX_V(p_track, tracks.size(), StringName());
+ const Track *t = tracks[p_track];
+ ERR_FAIL_COND_V(t->type != TYPE_ANIMATION, StringName());
+
+ const AnimationTrack *at = static_cast<const AnimationTrack *>(t);
+
+ ERR_FAIL_INDEX_V(p_key, at->values.size(), StringName());
+
+ return at->values[p_key].value;
+}
+
void Animation::set_length(float p_length) {
- ERR_FAIL_COND(length < 0);
+ if (p_length < ANIM_MIN_LENGTH) {
+ p_length = ANIM_MIN_LENGTH;
+ }
length = p_length;
emit_changed();
}
@@ -1592,6 +2591,16 @@ void Animation::track_move_down(int p_track) {
emit_changed();
}
+void Animation::track_swap(int p_track, int p_with_track) {
+
+ ERR_FAIL_INDEX(p_track, tracks.size());
+ ERR_FAIL_INDEX(p_with_track, tracks.size());
+ if (p_track == p_with_track)
+ return;
+ SWAP(tracks[p_track], tracks[p_with_track]);
+ emit_changed();
+}
+
void Animation::set_step(float p_step) {
step = p_step;
@@ -1631,6 +2640,7 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("track_move_up", "idx"), &Animation::track_move_up);
ClassDB::bind_method(D_METHOD("track_move_down", "idx"), &Animation::track_move_down);
+ ClassDB::bind_method(D_METHOD("track_swap", "idx", "with_idx"), &Animation::track_swap);
ClassDB::bind_method(D_METHOD("track_set_imported", "idx", "imported"), &Animation::track_set_imported);
ClassDB::bind_method(D_METHOD("track_is_imported", "idx"), &Animation::track_is_imported);
@@ -1667,6 +2677,30 @@ void Animation::_bind_methods() {
ClassDB::bind_method(D_METHOD("method_track_get_name", "idx", "key_idx"), &Animation::method_track_get_name);
ClassDB::bind_method(D_METHOD("method_track_get_params", "idx", "key_idx"), &Animation::method_track_get_params);
+ ClassDB::bind_method(D_METHOD("bezier_track_insert_key", "track", "time", "value", "in_handle", "out_handle"), &Animation::bezier_track_insert_key, DEFVAL(Vector2()), DEFVAL(Vector2()));
+
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_value", "idx", "key_idx", "value"), &Animation::bezier_track_set_key_value);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_in_handle", "idx", "key_idx", "in_handle"), &Animation::bezier_track_set_key_in_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_set_key_out_handle", "idx", "key_idx", "out_handle"), &Animation::bezier_track_set_key_out_handle);
+
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_value", "idx", "key_idx"), &Animation::bezier_track_get_key_value);
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_in_handle", "idx", "key_idx"), &Animation::bezier_track_get_key_in_handle);
+ ClassDB::bind_method(D_METHOD("bezier_track_get_key_out_handle", "idx", "key_idx"), &Animation::bezier_track_get_key_out_handle);
+
+ ClassDB::bind_method(D_METHOD("bezier_track_interpolate", "track", "time"), &Animation::bezier_track_interpolate);
+
+ ClassDB::bind_method(D_METHOD("audio_track_insert_key", "track", "time", "stream", "start_offset", "end_offset"), &Animation::audio_track_insert_key, DEFVAL(0), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("audio_track_set_key_stream", "idx", "key_idx", "stream"), &Animation::audio_track_set_key_stream);
+ ClassDB::bind_method(D_METHOD("audio_track_set_key_start_offset", "idx", "key_idx", "offset"), &Animation::audio_track_set_key_start_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_set_key_end_offset", "idx", "key_idx", "offset"), &Animation::audio_track_set_key_end_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_get_key_stream", "idx", "key_idx"), &Animation::audio_track_get_key_stream);
+ ClassDB::bind_method(D_METHOD("audio_track_get_key_start_offset", "idx", "key_idx"), &Animation::audio_track_get_key_start_offset);
+ ClassDB::bind_method(D_METHOD("audio_track_get_key_end_offset", "idx", "key_idx"), &Animation::audio_track_get_key_end_offset);
+
+ ClassDB::bind_method(D_METHOD("animation_track_insert_key", "track", "time", "animation"), &Animation::animation_track_insert_key);
+ ClassDB::bind_method(D_METHOD("animation_track_set_key_animation", "idx", "key_idx", "animation"), &Animation::animation_track_set_key_animation);
+ ClassDB::bind_method(D_METHOD("animation_track_get_key_animation", "idx", "key_idx"), &Animation::animation_track_get_key_animation);
+
ClassDB::bind_method(D_METHOD("set_length", "time_sec"), &Animation::set_length);
ClassDB::bind_method(D_METHOD("get_length"), &Animation::get_length);
@@ -1686,6 +2720,9 @@ void Animation::_bind_methods() {
BIND_ENUM_CONSTANT(TYPE_VALUE);
BIND_ENUM_CONSTANT(TYPE_TRANSFORM);
BIND_ENUM_CONSTANT(TYPE_METHOD);
+ BIND_ENUM_CONSTANT(TYPE_BEZIER);
+ BIND_ENUM_CONSTANT(TYPE_AUDIO);
+ BIND_ENUM_CONSTANT(TYPE_ANIMATION);
BIND_ENUM_CONSTANT(INTERPOLATION_NEAREST);
BIND_ENUM_CONSTANT(INTERPOLATION_LINEAR);
@@ -1694,6 +2731,7 @@ void Animation::_bind_methods() {
BIND_ENUM_CONSTANT(UPDATE_CONTINUOUS);
BIND_ENUM_CONSTANT(UPDATE_DISCRETE);
BIND_ENUM_CONSTANT(UPDATE_TRIGGER);
+ BIND_ENUM_CONSTANT(UPDATE_CAPTURE);
}
void Animation::clear() {
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 73691a69f2..a41e6ea5d7 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -45,6 +45,9 @@ public:
TYPE_VALUE, ///< Set a value in a property, can be interpolated.
TYPE_TRANSFORM, ///< Transform a node or a bone.
TYPE_METHOD, ///< Call any method on a specific node.
+ TYPE_BEZIER, ///< Bezier curve
+ TYPE_AUDIO,
+ TYPE_ANIMATION,
};
enum InterpolationType {
@@ -57,6 +60,7 @@ public:
UPDATE_CONTINUOUS,
UPDATE_DISCRETE,
UPDATE_TRIGGER,
+ UPDATE_CAPTURE,
};
@@ -137,6 +141,55 @@ private:
MethodTrack() { type = TYPE_METHOD; }
};
+ /* BEZIER TRACK */
+
+ struct BezierKey {
+ Vector2 in_handle; //relative (x always <0)
+ Vector2 out_handle; //relative (x always >0)
+ float value;
+ };
+
+ struct BezierTrack : public Track {
+
+ Vector<TKey<BezierKey> > values;
+
+ BezierTrack() {
+ type = TYPE_BEZIER;
+ }
+ };
+
+ /* AUDIO TRACK */
+
+ struct AudioKey {
+ RES stream;
+ float start_offset; //offset from start
+ float end_offset; //offset from end, if 0 then full length or infinite
+ AudioKey() {
+ start_offset = 0;
+ end_offset = 0;
+ }
+ };
+
+ struct AudioTrack : public Track {
+
+ Vector<TKey<AudioKey> > values;
+
+ AudioTrack() {
+ type = TYPE_AUDIO;
+ }
+ };
+
+ /* AUDIO TRACK */
+
+ struct AnimationTrack : public Track {
+
+ Vector<TKey<StringName> > values;
+
+ AnimationTrack() {
+ type = TYPE_ANIMATION;
+ }
+ };
+
Vector<Track *> tracks;
/*
@@ -168,6 +221,9 @@ private:
template <class T>
_FORCE_INLINE_ T _interpolate(const Vector<TKey<T> > &p_keys, float p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok) const;
+ template <class T>
+ _FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, float from_time, float to_time, List<int> *p_indices) const;
+
_FORCE_INLINE_ void _value_track_get_key_indices_in_range(const ValueTrack *vt, float from_time, float to_time, List<int> *p_indices) const;
_FORCE_INLINE_ void _method_track_get_key_indices_in_range(const MethodTrack *mt, float from_time, float to_time, List<int> *p_indices) const;
@@ -238,6 +294,7 @@ public:
void track_move_up(int p_track);
void track_move_down(int p_track);
+ void track_swap(int p_track, int p_with_track);
void track_set_imported(int p_track, bool p_imported);
bool track_is_imported(int p_track) const;
@@ -245,7 +302,6 @@ public:
void track_set_enabled(int p_track, bool p_enabled);
bool track_is_enabled(int p_track) const;
- int transform_track_insert_key(int p_track, float p_time, const Vector3 p_loc, const Quat &p_rot = Quat(), const Vector3 &p_scale = Vector3());
void track_insert_key(int p_track, float p_time, const Variant &p_key, float p_transition = 1);
void track_set_key_transition(int p_track, int p_key_idx, float p_transition);
void track_set_key_value(int p_track, int p_key_idx, const Variant &p_value);
@@ -257,10 +313,33 @@ public:
float track_get_key_time(int p_track, int p_key_idx) const;
float track_get_key_transition(int p_track, int p_key_idx) const;
+ int transform_track_insert_key(int p_track, float p_time, const Vector3 p_loc, const Quat &p_rot = Quat(), const Vector3 &p_scale = Vector3());
Error transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quat *r_rot, Vector3 *r_scale) const;
void track_set_interpolation_type(int p_track, InterpolationType p_interp);
InterpolationType track_get_interpolation_type(int p_track) const;
+ int bezier_track_insert_key(int p_track, float p_time, float p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle);
+ void bezier_track_set_key_value(int p_track, int p_index, float p_value);
+ void bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle);
+ void bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle);
+ float bezier_track_get_key_value(int p_track, int p_index) const;
+ Vector2 bezier_track_get_key_in_handle(int p_track, int p_index) const;
+ Vector2 bezier_track_get_key_out_handle(int p_track, int p_index) const;
+
+ float bezier_track_interpolate(int p_track, float p_time) const;
+
+ int audio_track_insert_key(int p_track, float p_time, const RES &p_stream, float p_start_offset = 0, float p_end_offset = 0);
+ void audio_track_set_key_stream(int p_track, int p_key, const RES &p_stream);
+ void audio_track_set_key_start_offset(int p_track, int p_key, float p_offset);
+ void audio_track_set_key_end_offset(int p_track, int p_key, float p_offset);
+ RES audio_track_get_key_stream(int p_track, int p_key) const;
+ float audio_track_get_key_start_offset(int p_track, int p_key) const;
+ float audio_track_get_key_end_offset(int p_track, int p_key) const;
+
+ int animation_track_insert_key(int p_track, float p_time, const StringName &p_animation);
+ void animation_track_set_key_animation(int p_track, int p_key, const StringName &p_animation);
+ StringName animation_track_get_key_animation(int p_track, int p_key) const;
+
void track_set_interpolation_loop_wrap(int p_track, bool p_enable);
bool track_get_interpolation_loop_wrap(int p_track) const;
@@ -277,6 +356,8 @@ public:
void copy_track(int p_track, Ref<Animation> p_to_animation);
+ void track_get_key_indices_in_range(int p_track, float p_time, float p_delta, List<int> *p_indices) const;
+
void set_length(float p_length);
float get_length() const;
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index b77143cd9d..02a9e4d69b 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -524,6 +524,9 @@ String AudioStreamSample::get_stream_name() const {
void AudioStreamSample::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamSample::set_data);
+ ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamSample::get_data);
+
ClassDB::bind_method(D_METHOD("set_format", "format"), &AudioStreamSample::set_format);
ClassDB::bind_method(D_METHOD("get_format"), &AudioStreamSample::get_format);
@@ -542,16 +545,13 @@ void AudioStreamSample::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_stereo", "stereo"), &AudioStreamSample::set_stereo);
ClassDB::bind_method(D_METHOD("is_stereo"), &AudioStreamSample::is_stereo);
- ClassDB::bind_method(D_METHOD("_set_data", "data"), &AudioStreamSample::set_data);
- ClassDB::bind_method(D_METHOD("_get_data"), &AudioStreamSample::get_data);
-
+ ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data");
ADD_PROPERTY(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_ENUM, "8-Bit,16-Bit,IMA-ADPCM"), "set_format", "get_format");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong"), "set_loop_mode", "get_loop_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_begin"), "set_loop_begin", "get_loop_begin");
ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_end"), "set_loop_end", "get_loop_end");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stereo"), "set_stereo", "is_stereo");
- ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
BIND_ENUM_CONSTANT(FORMAT_8_BITS);
BIND_ENUM_CONSTANT(FORMAT_16_BITS);
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 5fd6f6c74d..7f902fc982 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -806,6 +806,87 @@ float Curve2D::get_bake_interval() const {
return bake_interval;
}
+Vector2 Curve2D::get_closest_point(const Vector2 &p_to_point) const {
+ // Brute force method
+
+ if (baked_cache_dirty)
+ _bake();
+
+ //validate//
+ int pc = baked_point_cache.size();
+ if (pc == 0) {
+ ERR_EXPLAIN("No points in Curve2D");
+ ERR_FAIL_COND_V(pc == 0, Vector2());
+ }
+
+ if (pc == 1)
+ return baked_point_cache.get(0);
+
+ PoolVector2Array::Read r = baked_point_cache.read();
+
+ Vector2 nearest;
+ float nearest_dist = -1.0f;
+
+ for (int i = 0; i < pc - 1; i++) {
+ Vector2 origin = r[i];
+ Vector2 direction = (r[i + 1] - origin) / bake_interval;
+
+ float d = CLAMP((p_to_point - origin).dot(direction), 0.0f, bake_interval);
+ Vector2 proj = origin + direction * d;
+
+ float dist = proj.distance_squared_to(p_to_point);
+
+ if (nearest_dist < 0.0f || dist < nearest_dist) {
+ nearest = proj;
+ nearest_dist = dist;
+ }
+ }
+
+ return nearest;
+}
+
+float Curve2D::get_closest_offset(const Vector2 &p_to_point) const {
+ // Brute force method
+
+ if (baked_cache_dirty)
+ _bake();
+
+ //validate//
+ int pc = baked_point_cache.size();
+ if (pc == 0) {
+ ERR_EXPLAIN("No points in Curve2D");
+ ERR_FAIL_COND_V(pc == 0, 0.0f);
+ }
+
+ if (pc == 1)
+ return 0.0f;
+
+ PoolVector2Array::Read r = baked_point_cache.read();
+
+ float nearest = 0.0f;
+ float nearest_dist = -1.0f;
+ float offset = 0.0f;
+
+ for (int i = 0; i < pc - 1; i++) {
+ Vector2 origin = r[i];
+ Vector2 direction = (r[i + 1] - origin) / bake_interval;
+
+ float d = CLAMP((p_to_point - origin).dot(direction), 0.0f, bake_interval);
+ Vector2 proj = origin + direction * d;
+
+ float dist = proj.distance_squared_to(p_to_point);
+
+ if (nearest_dist < 0.0f || dist < nearest_dist) {
+ nearest = offset + d;
+ nearest_dist = dist;
+ }
+
+ offset += bake_interval;
+ }
+
+ return nearest;
+}
+
Dictionary Curve2D::_get_data() const {
Dictionary dc;
@@ -909,6 +990,8 @@ void Curve2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_baked_length"), &Curve2D::get_baked_length);
ClassDB::bind_method(D_METHOD("interpolate_baked", "offset", "cubic"), &Curve2D::interpolate_baked, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_baked_points"), &Curve2D::get_baked_points);
+ ClassDB::bind_method(D_METHOD("get_closest_point", "to_point"), &Curve2D::get_closest_point);
+ ClassDB::bind_method(D_METHOD("get_closest_offset", "to_point"), &Curve2D::get_closest_offset);
ClassDB::bind_method(D_METHOD("tessellate", "max_stages", "tolerance_degrees"), &Curve2D::tessellate, DEFVAL(5), DEFVAL(4));
ClassDB::bind_method(D_METHOD("_get_data"), &Curve2D::_get_data);
@@ -1086,6 +1169,7 @@ void Curve3D::_bake() const {
if (points.size() == 0) {
baked_point_cache.resize(0);
baked_tilt_cache.resize(0);
+ baked_up_vector_cache.resize(0);
return;
}
@@ -1095,6 +1179,14 @@ void Curve3D::_bake() const {
baked_point_cache.set(0, points[0].pos);
baked_tilt_cache.resize(1);
baked_tilt_cache.set(0, points[0].tilt);
+
+ if (up_vector_enabled) {
+
+ baked_up_vector_cache.resize(1);
+ baked_up_vector_cache.set(0, Vector3(0, 1, 0));
+ } else
+ baked_up_vector_cache.resize(0);
+
return;
}
@@ -1164,10 +1256,51 @@ void Curve3D::_bake() const {
baked_tilt_cache.resize(pointlist.size());
PoolRealArray::Write wt = baked_tilt_cache.write();
+ baked_up_vector_cache.resize(up_vector_enabled ? pointlist.size() : 0);
+ PoolVector3Array::Write up_write = baked_up_vector_cache.write();
+
+ Vector3 sideways;
+ Vector3 up;
+ Vector3 forward;
+
+ Vector3 prev_sideways = Vector3(1, 0, 0);
+ Vector3 prev_up = Vector3(0, 1, 0);
+ Vector3 prev_forward = Vector3(0, 0, 1);
+
for (List<Plane>::Element *E = pointlist.front(); E; E = E->next()) {
w[idx] = E->get().normal;
wt[idx] = E->get().d;
+
+ if (!up_vector_enabled) {
+ idx++;
+ continue;
+ }
+
+ forward = idx > 0 ? (w[idx] - w[idx - 1]).normalized() : prev_forward;
+
+ float y_dot = prev_up.dot(forward);
+
+ if (y_dot > (1.0f - CMP_EPSILON)) {
+ sideways = prev_sideways;
+ up = -prev_forward;
+ } else if (y_dot < -(1.0f - CMP_EPSILON)) {
+ sideways = prev_sideways;
+ up = prev_forward;
+ } else {
+ sideways = prev_up.cross(forward).normalized();
+ up = forward.cross(sideways).normalized();
+ }
+
+ if (idx == 1)
+ up_write[0] = up;
+
+ up_write[idx] = up;
+
+ prev_sideways = sideways;
+ prev_up = up;
+ prev_forward = forward;
+
idx++;
}
}
@@ -1260,6 +1393,53 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const {
return Math::lerp(r[idx], r[idx + 1], frac);
}
+Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt) const {
+
+ if (baked_cache_dirty)
+ _bake();
+
+ //validate//
+ // curve may not have baked up vectors
+ int count = baked_up_vector_cache.size();
+ if (count == 0) {
+ ERR_EXPLAIN("No up vectors in Curve3D");
+ ERR_FAIL_COND_V(count == 0, Vector3(0, 1, 0));
+ }
+
+ if (count == 1)
+ return baked_up_vector_cache.get(0);
+
+ PoolVector3Array::Read r = baked_up_vector_cache.read();
+ PoolVector3Array::Read rp = baked_point_cache.read();
+ PoolRealArray::Read rt = baked_tilt_cache.read();
+
+ float offset = CLAMP(p_offset, 0.0f, baked_max_ofs);
+
+ int idx = Math::floor((double)offset / (double)bake_interval);
+ float frac = Math::fmod(offset, bake_interval) / bake_interval;
+
+ if (idx == count - 1)
+ return p_apply_tilt ? r[idx].rotated((rp[idx] - rp[idx - 1]).normalized(), rt[idx]) : r[idx];
+
+ Vector3 forward = (rp[idx + 1] - rp[idx]).normalized();
+ Vector3 up = r[idx];
+ Vector3 up1 = r[idx + 1];
+
+ if (p_apply_tilt) {
+ up.rotate(forward, rt[idx]);
+ up1.rotate(idx + 2 >= count ? forward : (rp[idx + 2] - rp[idx + 1]).normalized(), rt[idx + 1]);
+ }
+
+ Vector3 axis = up.cross(up1);
+
+ if (axis.length_squared() < CMP_EPSILON2)
+ axis = forward;
+ else
+ axis.normalize();
+
+ return up.rotated(axis, up.angle_to(up1) * frac);
+}
+
PoolVector3Array Curve3D::get_baked_points() const {
if (baked_cache_dirty)
@@ -1276,6 +1456,95 @@ PoolRealArray Curve3D::get_baked_tilts() const {
return baked_tilt_cache;
}
+PoolVector3Array Curve3D::get_baked_up_vectors() const {
+
+ if (baked_cache_dirty)
+ _bake();
+
+ return baked_up_vector_cache;
+}
+
+Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const {
+ // Brute force method
+
+ if (baked_cache_dirty)
+ _bake();
+
+ //validate//
+ int pc = baked_point_cache.size();
+ if (pc == 0) {
+ ERR_EXPLAIN("No points in Curve3D");
+ ERR_FAIL_COND_V(pc == 0, Vector3());
+ }
+
+ if (pc == 1)
+ return baked_point_cache.get(0);
+
+ PoolVector3Array::Read r = baked_point_cache.read();
+
+ Vector3 nearest;
+ float nearest_dist = -1.0f;
+
+ for (int i = 0; i < pc - 1; i++) {
+ Vector3 origin = r[i];
+ Vector3 direction = (r[i + 1] - origin) / bake_interval;
+
+ float d = CLAMP((p_to_point - origin).dot(direction), 0.0f, bake_interval);
+ Vector3 proj = origin + direction * d;
+
+ float dist = proj.distance_squared_to(p_to_point);
+
+ if (nearest_dist < 0.0f || dist < nearest_dist) {
+ nearest = proj;
+ nearest_dist = dist;
+ }
+ }
+
+ return nearest;
+}
+
+float Curve3D::get_closest_offset(const Vector3 &p_to_point) const {
+ // Brute force method
+
+ if (baked_cache_dirty)
+ _bake();
+
+ //validate//
+ int pc = baked_point_cache.size();
+ if (pc == 0) {
+ ERR_EXPLAIN("No points in Curve3D");
+ ERR_FAIL_COND_V(pc == 0, 0.0f);
+ }
+
+ if (pc == 1)
+ return 0.0f;
+
+ PoolVector3Array::Read r = baked_point_cache.read();
+
+ float nearest = 0.0f;
+ float nearest_dist = -1.0f;
+ float offset = 0.0f;
+
+ for (int i = 0; i < pc - 1; i++) {
+ Vector3 origin = r[i];
+ Vector3 direction = (r[i + 1] - origin) / bake_interval;
+
+ float d = CLAMP((p_to_point - origin).dot(direction), 0.0f, bake_interval);
+ Vector3 proj = origin + direction * d;
+
+ float dist = proj.distance_squared_to(p_to_point);
+
+ if (nearest_dist < 0.0f || dist < nearest_dist) {
+ nearest = offset + d;
+ nearest_dist = dist;
+ }
+
+ offset += bake_interval;
+ }
+
+ return nearest;
+}
+
void Curve3D::set_bake_interval(float p_tolerance) {
bake_interval = p_tolerance;
@@ -1288,6 +1557,18 @@ float Curve3D::get_bake_interval() const {
return bake_interval;
}
+void Curve3D::set_up_vector_enabled(bool p_enable) {
+
+ up_vector_enabled = p_enable;
+ baked_cache_dirty = true;
+ emit_signal(CoreStringNames::get_singleton()->changed);
+}
+
+bool Curve3D::is_up_vector_enabled() const {
+
+ return up_vector_enabled;
+}
+
Dictionary Curve3D::_get_data() const {
Dictionary dc;
@@ -1399,11 +1680,17 @@ void Curve3D::_bind_methods() {
//ClassDB::bind_method(D_METHOD("bake","subdivs"),&Curve3D::bake,DEFVAL(10));
ClassDB::bind_method(D_METHOD("set_bake_interval", "distance"), &Curve3D::set_bake_interval);
ClassDB::bind_method(D_METHOD("get_bake_interval"), &Curve3D::get_bake_interval);
+ ClassDB::bind_method(D_METHOD("set_up_vector_enabled", "enable"), &Curve3D::set_up_vector_enabled);
+ ClassDB::bind_method(D_METHOD("is_up_vector_enabled"), &Curve3D::is_up_vector_enabled);
ClassDB::bind_method(D_METHOD("get_baked_length"), &Curve3D::get_baked_length);
ClassDB::bind_method(D_METHOD("interpolate_baked", "offset", "cubic"), &Curve3D::interpolate_baked, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("interpolate_baked_up_vector", "offset", "apply_tilt"), &Curve3D::interpolate_baked_up_vector, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_baked_points"), &Curve3D::get_baked_points);
ClassDB::bind_method(D_METHOD("get_baked_tilts"), &Curve3D::get_baked_tilts);
+ ClassDB::bind_method(D_METHOD("get_baked_up_vectors"), &Curve3D::get_baked_up_vectors);
+ ClassDB::bind_method(D_METHOD("get_closest_point", "to_point"), &Curve3D::get_closest_point);
+ ClassDB::bind_method(D_METHOD("get_closest_offset", "to_point"), &Curve3D::get_closest_offset);
ClassDB::bind_method(D_METHOD("tessellate", "max_stages", "tolerance_degrees"), &Curve3D::tessellate, DEFVAL(5), DEFVAL(4));
ClassDB::bind_method(D_METHOD("_get_data"), &Curve3D::_get_data);
@@ -1411,6 +1698,9 @@ void Curve3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bake_interval", PROPERTY_HINT_RANGE, "0.01,512,0.01"), "set_bake_interval", "get_bake_interval");
ADD_PROPERTY(PropertyInfo(Variant::INT, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
+
+ ADD_GROUP("Up Vector", "up_vector_");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "up_vector_enabled"), "set_up_vector_enabled", "is_up_vector_enabled");
}
Curve3D::Curve3D() {
@@ -1420,4 +1710,5 @@ Curve3D::Curve3D() {
add_point(Vector3(0,2,0));
add_point(Vector3(0,3,5));*/
bake_interval = 0.2;
+ up_vector_enabled = true;
}
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 4f55e4055c..9cb12a4345 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -199,6 +199,8 @@ public:
float get_baked_length() const;
Vector2 interpolate_baked(float p_offset, bool p_cubic = false) const;
PoolVector2Array get_baked_points() const; //useful for going through
+ Vector2 get_closest_point(const Vector2 &p_to_point) const;
+ float get_closest_offset(const Vector2 &p_to_point) const;
PoolVector2Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
@@ -230,11 +232,13 @@ class Curve3D : public Resource {
mutable bool baked_cache_dirty;
mutable PoolVector3Array baked_point_cache;
mutable PoolRealArray baked_tilt_cache;
+ mutable PoolVector3Array baked_up_vector_cache;
mutable float baked_max_ofs;
void _bake() const;
float bake_interval;
+ bool up_vector_enabled;
void _bake_segment3d(Map<float, Vector3> &r_bake, float p_begin, float p_end, const Vector3 &p_a, const Vector3 &p_out, const Vector3 &p_b, const Vector3 &p_in, int p_depth, int p_max_depth, float p_tol) const;
Dictionary _get_data() const;
@@ -262,12 +266,18 @@ public:
void set_bake_interval(float p_tolerance);
float get_bake_interval() const;
+ void set_up_vector_enabled(bool p_enable);
+ bool is_up_vector_enabled() const;
float get_baked_length() const;
Vector3 interpolate_baked(float p_offset, bool p_cubic = false) const;
float interpolate_baked_tilt(float p_offset) const;
+ Vector3 interpolate_baked_up_vector(float p_offset, bool p_apply_tilt = false) const;
PoolVector3Array get_baked_points() const; //useful for going through
PoolRealArray get_baked_tilts() const; //useful for going through
+ PoolVector3Array get_baked_up_vectors() const;
+ Vector3 get_closest_point(const Vector3 &p_to_point) const;
+ float get_closest_offset(const Vector3 &p_to_point) const;
PoolVector3Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display
diff --git a/scene/resources/default_theme/arrow_down.png b/scene/resources/default_theme/arrow_down.png
index fc837d120a..bfb87a4761 100644
--- a/scene/resources/default_theme/arrow_down.png
+++ b/scene/resources/default_theme/arrow_down.png
Binary files differ
diff --git a/scene/resources/default_theme/arrow_right.png b/scene/resources/default_theme/arrow_right.png
index ebe6e26ace..1e4c8e5529 100644
--- a/scene/resources/default_theme/arrow_right.png
+++ b/scene/resources/default_theme/arrow_right.png
Binary files differ
diff --git a/scene/resources/default_theme/background.png b/scene/resources/default_theme/background.png
index 03cfab1de3..6c5f43e3ce 100644
--- a/scene/resources/default_theme/background.png
+++ b/scene/resources/default_theme/background.png
Binary files differ
diff --git a/scene/resources/default_theme/base_green.png b/scene/resources/default_theme/base_green.png
index d03d6f08d8..03a5b313d7 100644
--- a/scene/resources/default_theme/base_green.png
+++ b/scene/resources/default_theme/base_green.png
Binary files differ
diff --git a/scene/resources/default_theme/button_disabled.png b/scene/resources/default_theme/button_disabled.png
index d75e76989d..708748dfe9 100644
--- a/scene/resources/default_theme/button_disabled.png
+++ b/scene/resources/default_theme/button_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/button_focus.png b/scene/resources/default_theme/button_focus.png
index 44e354be95..70e16b953b 100644
--- a/scene/resources/default_theme/button_focus.png
+++ b/scene/resources/default_theme/button_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/button_hover.png b/scene/resources/default_theme/button_hover.png
index 6e609f435f..ef226e3caf 100644
--- a/scene/resources/default_theme/button_hover.png
+++ b/scene/resources/default_theme/button_hover.png
Binary files differ
diff --git a/scene/resources/default_theme/button_normal.png b/scene/resources/default_theme/button_normal.png
index 92482aaf28..7d0bd16221 100644
--- a/scene/resources/default_theme/button_normal.png
+++ b/scene/resources/default_theme/button_normal.png
Binary files differ
diff --git a/scene/resources/default_theme/checked.png b/scene/resources/default_theme/checked.png
index 93e291a29e..bde031b6a2 100644
--- a/scene/resources/default_theme/checked.png
+++ b/scene/resources/default_theme/checked.png
Binary files differ
diff --git a/scene/resources/default_theme/checker_bg.png b/scene/resources/default_theme/checker_bg.png
index f58dfed29c..3eff2f0e08 100644
--- a/scene/resources/default_theme/checker_bg.png
+++ b/scene/resources/default_theme/checker_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/close.png b/scene/resources/default_theme/close.png
index 5ac6357dcd..4d4ac4a551 100644
--- a/scene/resources/default_theme/close.png
+++ b/scene/resources/default_theme/close.png
Binary files differ
diff --git a/scene/resources/default_theme/close_hl.png b/scene/resources/default_theme/close_hl.png
index 5ac6357dcd..4d4ac4a551 100644
--- a/scene/resources/default_theme/close_hl.png
+++ b/scene/resources/default_theme/close_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/color_picker_sample.png b/scene/resources/default_theme/color_picker_sample.png
index b145a3e384..e6ec28d307 100644
--- a/scene/resources/default_theme/color_picker_sample.png
+++ b/scene/resources/default_theme/color_picker_sample.png
Binary files differ
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 3e244aa8f8..702953fa40 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -415,6 +415,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_color", "Label", Color(1, 1, 1));
theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0));
+ theme->set_color("font_outline_modulate", "Label", Color(1, 1, 1));
theme->set_constant("shadow_offset_x", "Label", 1 * scale);
theme->set_constant("shadow_offset_y", "Label", 1 * scale);
@@ -543,6 +544,11 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("updown", "SpinBox", make_icon(spinbox_updown_png));
+ //scroll container
+ Ref<StyleBoxEmpty> empty;
+ empty.instance();
+ theme->set_stylebox("bg", "ScrollContainer", empty);
+
// WindowDialog
theme->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6));
@@ -582,6 +588,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("checked", "PopupMenu", make_icon(checked_png));
theme->set_icon("unchecked", "PopupMenu", make_icon(unchecked_png));
+ theme->set_icon("radio_checked", "PopupMenu", make_icon(radio_checked_png));
+ theme->set_icon("radio_unchecked", "PopupMenu", make_icon(radio_unchecked_png));
theme->set_icon("submenu", "PopupMenu", make_icon(submenu_png));
theme->set_font("font", "PopupMenu", default_font);
@@ -816,6 +824,12 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_color_selected", "RichTextLabel", font_color_selection);
theme->set_color("selection_color", "RichTextLabel", Color(0.1, 0.1, 1, 0.8));
+ theme->set_color("font_color_shadow", "RichTextLabel", Color(0, 0, 0, 0));
+
+ theme->set_constant("shadow_offset_x", "RichTextLabel", 1 * scale);
+ theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * scale);
+ theme->set_constant("shadow_as_outline", "RichTextLabel", 0 * scale);
+
theme->set_constant("line_separation", "RichTextLabel", 1 * scale);
theme->set_constant("table_hseparation", "RichTextLabel", 3 * scale);
theme->set_constant("table_vseparation", "RichTextLabel", 3 * scale);
@@ -830,7 +844,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("separation", "HBoxContainer", 4 * scale);
theme->set_constant("separation", "VBoxContainer", 4 * scale);
- theme->set_constant("margin_left", "MarginContainer", 8 * scale);
+ theme->set_constant("margin_left", "MarginContainer", 0 * scale);
theme->set_constant("margin_top", "MarginContainer", 0 * scale);
theme->set_constant("margin_right", "MarginContainer", 0 * scale);
theme->set_constant("margin_bottom", "MarginContainer", 0 * scale);
@@ -860,6 +874,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5));
theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05));
theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2));
+ theme->set_color("activity", "GraphEdit", Color(1, 1, 1));
theme->set_constant("bezier_len_pos", "GraphEdit", 80 * scale);
theme->set_constant("bezier_len_neg", "GraphEdit", 160 * scale);
diff --git a/scene/resources/default_theme/dosfont.png b/scene/resources/default_theme/dosfont.png
index 814d2e9060..e2739b94ea 100644
--- a/scene/resources/default_theme/dosfont.png
+++ b/scene/resources/default_theme/dosfont.png
Binary files differ
diff --git a/scene/resources/default_theme/dropdown.png b/scene/resources/default_theme/dropdown.png
index 3a6a2ed778..b5d9ffbbb4 100644
--- a/scene/resources/default_theme/dropdown.png
+++ b/scene/resources/default_theme/dropdown.png
Binary files differ
diff --git a/scene/resources/default_theme/error_icon.png b/scene/resources/default_theme/error_icon.png
index f291362350..7741d00749 100644
--- a/scene/resources/default_theme/error_icon.png
+++ b/scene/resources/default_theme/error_icon.png
Binary files differ
diff --git a/scene/resources/default_theme/focus.png b/scene/resources/default_theme/focus.png
index 5d37028f2d..f51ea89e8f 100644
--- a/scene/resources/default_theme/focus.png
+++ b/scene/resources/default_theme/focus.png
Binary files differ
diff --git a/scene/resources/default_theme/frame_focus.png b/scene/resources/default_theme/frame_focus.png
index 9170db38ed..1b24ba47d8 100644
--- a/scene/resources/default_theme/frame_focus.png
+++ b/scene/resources/default_theme/frame_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/full_panel_bg.png b/scene/resources/default_theme/full_panel_bg.png
index 7f02dc7259..85f753cc13 100644
--- a/scene/resources/default_theme/full_panel_bg.png
+++ b/scene/resources/default_theme/full_panel_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_breakpoint.png b/scene/resources/default_theme/graph_node_breakpoint.png
index 0e36f31bd4..e18c6f42e1 100644
--- a/scene/resources/default_theme/graph_node_breakpoint.png
+++ b/scene/resources/default_theme/graph_node_breakpoint.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_close.png b/scene/resources/default_theme/graph_node_close.png
index 144a8b9c4c..5c962ae1c6 100644
--- a/scene/resources/default_theme/graph_node_close.png
+++ b/scene/resources/default_theme/graph_node_close.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_comment.png b/scene/resources/default_theme/graph_node_comment.png
index f2d6daa259..cdec1d1eac 100644
--- a/scene/resources/default_theme/graph_node_comment.png
+++ b/scene/resources/default_theme/graph_node_comment.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_comment_focus.png b/scene/resources/default_theme/graph_node_comment_focus.png
index a4b7b5a618..472a6b6f53 100644
--- a/scene/resources/default_theme/graph_node_comment_focus.png
+++ b/scene/resources/default_theme/graph_node_comment_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_default.png b/scene/resources/default_theme/graph_node_default.png
index e3a220301f..359bbdc205 100644
--- a/scene/resources/default_theme/graph_node_default.png
+++ b/scene/resources/default_theme/graph_node_default.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_default_focus.png b/scene/resources/default_theme/graph_node_default_focus.png
index 9972b07593..204dd16ac0 100644
--- a/scene/resources/default_theme/graph_node_default_focus.png
+++ b/scene/resources/default_theme/graph_node_default_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_position.png b/scene/resources/default_theme/graph_node_position.png
index 7ec15e2ff4..24c2759be6 100644
--- a/scene/resources/default_theme/graph_node_position.png
+++ b/scene/resources/default_theme/graph_node_position.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_node_selected.png b/scene/resources/default_theme/graph_node_selected.png
index f76c9703dd..cc4eb7f753 100644
--- a/scene/resources/default_theme/graph_node_selected.png
+++ b/scene/resources/default_theme/graph_node_selected.png
Binary files differ
diff --git a/scene/resources/default_theme/graph_port.png b/scene/resources/default_theme/graph_port.png
index 9d5082cfdb..f33ae3baf3 100644
--- a/scene/resources/default_theme/graph_port.png
+++ b/scene/resources/default_theme/graph_port.png
Binary files differ
diff --git a/scene/resources/default_theme/hseparator.png b/scene/resources/default_theme/hseparator.png
index 99609ac118..d4fd71ace5 100644
--- a/scene/resources/default_theme/hseparator.png
+++ b/scene/resources/default_theme/hseparator.png
Binary files differ
diff --git a/scene/resources/default_theme/hslider_bg.png b/scene/resources/default_theme/hslider_bg.png
index 9c2a2df62a..b402bd370d 100644
--- a/scene/resources/default_theme/hslider_bg.png
+++ b/scene/resources/default_theme/hslider_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/hslider_grabber.png b/scene/resources/default_theme/hslider_grabber.png
index 2acd33879a..d273b491ee 100644
--- a/scene/resources/default_theme/hslider_grabber.png
+++ b/scene/resources/default_theme/hslider_grabber.png
Binary files differ
diff --git a/scene/resources/default_theme/hslider_grabber_disabled.png b/scene/resources/default_theme/hslider_grabber_disabled.png
index 0d75182b8f..dddd1a468e 100644
--- a/scene/resources/default_theme/hslider_grabber_disabled.png
+++ b/scene/resources/default_theme/hslider_grabber_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/hslider_grabber_hl.png b/scene/resources/default_theme/hslider_grabber_hl.png
index f8a011e64b..e3defb3610 100644
--- a/scene/resources/default_theme/hslider_grabber_hl.png
+++ b/scene/resources/default_theme/hslider_grabber_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/hslider_tick.png b/scene/resources/default_theme/hslider_tick.png
index f7afd78529..1ba19c37a1 100644
--- a/scene/resources/default_theme/hslider_tick.png
+++ b/scene/resources/default_theme/hslider_tick.png
Binary files differ
diff --git a/scene/resources/default_theme/hsplit_bg.png b/scene/resources/default_theme/hsplit_bg.png
index 7dd1d48b29..a5749f6d5c 100644
--- a/scene/resources/default_theme/hsplit_bg.png
+++ b/scene/resources/default_theme/hsplit_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/hsplitter.png b/scene/resources/default_theme/hsplitter.png
index 71a3914d7e..2287753c9d 100644
--- a/scene/resources/default_theme/hsplitter.png
+++ b/scene/resources/default_theme/hsplitter.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_add.png b/scene/resources/default_theme/icon_add.png
index fa675045bc..eccb69b363 100644
--- a/scene/resources/default_theme/icon_add.png
+++ b/scene/resources/default_theme/icon_add.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_close.png b/scene/resources/default_theme/icon_close.png
index 5ac6357dcd..4d4ac4a551 100644
--- a/scene/resources/default_theme/icon_close.png
+++ b/scene/resources/default_theme/icon_close.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_color_pick.png b/scene/resources/default_theme/icon_color_pick.png
index 15679a9558..46953febb8 100644
--- a/scene/resources/default_theme/icon_color_pick.png
+++ b/scene/resources/default_theme/icon_color_pick.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_folder.png b/scene/resources/default_theme/icon_folder.png
index cc05e98ebb..d1b308e88d 100644
--- a/scene/resources/default_theme/icon_folder.png
+++ b/scene/resources/default_theme/icon_folder.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_parent_folder.png b/scene/resources/default_theme/icon_parent_folder.png
index 47fee1ad81..35d218722e 100644
--- a/scene/resources/default_theme/icon_parent_folder.png
+++ b/scene/resources/default_theme/icon_parent_folder.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_play.png b/scene/resources/default_theme/icon_play.png
index 864e4e4fb9..b9ed6e6d5b 100644
--- a/scene/resources/default_theme/icon_play.png
+++ b/scene/resources/default_theme/icon_play.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_reload.png b/scene/resources/default_theme/icon_reload.png
index 9303fabb9c..bec5f3f4f9 100644
--- a/scene/resources/default_theme/icon_reload.png
+++ b/scene/resources/default_theme/icon_reload.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_snap_grid.png b/scene/resources/default_theme/icon_snap_grid.png
index 44db9bdfdc..0680317d86 100644
--- a/scene/resources/default_theme/icon_snap_grid.png
+++ b/scene/resources/default_theme/icon_snap_grid.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_stop.png b/scene/resources/default_theme/icon_stop.png
index 1f194d0e14..0c1371ceb9 100644
--- a/scene/resources/default_theme/icon_stop.png
+++ b/scene/resources/default_theme/icon_stop.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_zoom_less.png b/scene/resources/default_theme/icon_zoom_less.png
index 888ddc995d..03119c60ca 100644
--- a/scene/resources/default_theme/icon_zoom_less.png
+++ b/scene/resources/default_theme/icon_zoom_less.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_zoom_more.png b/scene/resources/default_theme/icon_zoom_more.png
index fa675045bc..31467ec3de 100644
--- a/scene/resources/default_theme/icon_zoom_more.png
+++ b/scene/resources/default_theme/icon_zoom_more.png
Binary files differ
diff --git a/scene/resources/default_theme/icon_zoom_reset.png b/scene/resources/default_theme/icon_zoom_reset.png
index 953ae47d24..cac68c09fa 100644
--- a/scene/resources/default_theme/icon_zoom_reset.png
+++ b/scene/resources/default_theme/icon_zoom_reset.png
Binary files differ
diff --git a/scene/resources/default_theme/line_edit.png b/scene/resources/default_theme/line_edit.png
index bf2b91f1be..2b0c506f34 100644
--- a/scene/resources/default_theme/line_edit.png
+++ b/scene/resources/default_theme/line_edit.png
Binary files differ
diff --git a/scene/resources/default_theme/line_edit_disabled.png b/scene/resources/default_theme/line_edit_disabled.png
index a0fa505e4c..69d78febd9 100644
--- a/scene/resources/default_theme/line_edit_disabled.png
+++ b/scene/resources/default_theme/line_edit_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/line_edit_focus.png b/scene/resources/default_theme/line_edit_focus.png
index e66d7b60e3..1d74b74068 100644
--- a/scene/resources/default_theme/line_edit_focus.png
+++ b/scene/resources/default_theme/line_edit_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/logo.png b/scene/resources/default_theme/logo.png
index 2161402438..d0ef9d8aa7 100644
--- a/scene/resources/default_theme/logo.png
+++ b/scene/resources/default_theme/logo.png
Binary files differ
diff --git a/scene/resources/default_theme/mini_checkerboard.png b/scene/resources/default_theme/mini_checkerboard.png
index 3e53183847..d8279bda80 100644
--- a/scene/resources/default_theme/mini_checkerboard.png
+++ b/scene/resources/default_theme/mini_checkerboard.png
Binary files differ
diff --git a/scene/resources/default_theme/option_arrow.png b/scene/resources/default_theme/option_arrow.png
index 007de16bfa..40590fd60a 100644
--- a/scene/resources/default_theme/option_arrow.png
+++ b/scene/resources/default_theme/option_arrow.png
Binary files differ
diff --git a/scene/resources/default_theme/option_button_disabled.png b/scene/resources/default_theme/option_button_disabled.png
index ce727d56e1..1961b673cd 100644
--- a/scene/resources/default_theme/option_button_disabled.png
+++ b/scene/resources/default_theme/option_button_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/option_button_focus.png b/scene/resources/default_theme/option_button_focus.png
index c76d91287e..402670f9a2 100644
--- a/scene/resources/default_theme/option_button_focus.png
+++ b/scene/resources/default_theme/option_button_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/option_button_hover.png b/scene/resources/default_theme/option_button_hover.png
index fd1e987ceb..826fe1c9ca 100644
--- a/scene/resources/default_theme/option_button_hover.png
+++ b/scene/resources/default_theme/option_button_hover.png
Binary files differ
diff --git a/scene/resources/default_theme/option_button_normal.png b/scene/resources/default_theme/option_button_normal.png
index 9d7fb98d1c..2dadb40338 100644
--- a/scene/resources/default_theme/option_button_normal.png
+++ b/scene/resources/default_theme/option_button_normal.png
Binary files differ
diff --git a/scene/resources/default_theme/option_button_pressed.png b/scene/resources/default_theme/option_button_pressed.png
index 28b1d93468..68796f9d85 100644
--- a/scene/resources/default_theme/option_button_pressed.png
+++ b/scene/resources/default_theme/option_button_pressed.png
Binary files differ
diff --git a/scene/resources/default_theme/panel_bg.png b/scene/resources/default_theme/panel_bg.png
index 320819ad6d..b496e2177e 100644
--- a/scene/resources/default_theme/panel_bg.png
+++ b/scene/resources/default_theme/panel_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_bg.png b/scene/resources/default_theme/popup_bg.png
index 63f5994441..023029f936 100644
--- a/scene/resources/default_theme/popup_bg.png
+++ b/scene/resources/default_theme/popup_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_bg_disabled.png b/scene/resources/default_theme/popup_bg_disabled.png
index 611d949380..8eab5f27bc 100644
--- a/scene/resources/default_theme/popup_bg_disabled.png
+++ b/scene/resources/default_theme/popup_bg_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_checked.png b/scene/resources/default_theme/popup_checked.png
index a24e0543c0..b7b05640e1 100644
--- a/scene/resources/default_theme/popup_checked.png
+++ b/scene/resources/default_theme/popup_checked.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_hover.png b/scene/resources/default_theme/popup_hover.png
index 85d4e48475..bdb6ae8bd0 100644
--- a/scene/resources/default_theme/popup_hover.png
+++ b/scene/resources/default_theme/popup_hover.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_unchecked.png b/scene/resources/default_theme/popup_unchecked.png
index c1137e6fbf..ff922335c3 100644
--- a/scene/resources/default_theme/popup_unchecked.png
+++ b/scene/resources/default_theme/popup_unchecked.png
Binary files differ
diff --git a/scene/resources/default_theme/popup_window.png b/scene/resources/default_theme/popup_window.png
index 59362a8ffd..174a29ef45 100644
--- a/scene/resources/default_theme/popup_window.png
+++ b/scene/resources/default_theme/popup_window.png
Binary files differ
diff --git a/scene/resources/default_theme/progress_bar.png b/scene/resources/default_theme/progress_bar.png
index bf81e3adea..057557e567 100644
--- a/scene/resources/default_theme/progress_bar.png
+++ b/scene/resources/default_theme/progress_bar.png
Binary files differ
diff --git a/scene/resources/default_theme/progress_fill.png b/scene/resources/default_theme/progress_fill.png
index 3a34dfdda6..e39bb2a021 100644
--- a/scene/resources/default_theme/progress_fill.png
+++ b/scene/resources/default_theme/progress_fill.png
Binary files differ
diff --git a/scene/resources/default_theme/radio_checked.png b/scene/resources/default_theme/radio_checked.png
index 95d472022f..0ce575c15f 100644
--- a/scene/resources/default_theme/radio_checked.png
+++ b/scene/resources/default_theme/radio_checked.png
Binary files differ
diff --git a/scene/resources/default_theme/radio_unchecked.png b/scene/resources/default_theme/radio_unchecked.png
index 7f0535c3a4..fe5bcf6ab1 100644
--- a/scene/resources/default_theme/radio_unchecked.png
+++ b/scene/resources/default_theme/radio_unchecked.png
Binary files differ
diff --git a/scene/resources/default_theme/reference_border.png b/scene/resources/default_theme/reference_border.png
index 96219676bf..6a680f393c 100644
--- a/scene/resources/default_theme/reference_border.png
+++ b/scene/resources/default_theme/reference_border.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_bg.png b/scene/resources/default_theme/scroll_bg.png
index cefadb2c08..fb151a48b1 100644
--- a/scene/resources/default_theme/scroll_bg.png
+++ b/scene/resources/default_theme/scroll_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_down.png b/scene/resources/default_theme/scroll_button_down.png
index caeac9b286..1df4ef5b6b 100644
--- a/scene/resources/default_theme/scroll_button_down.png
+++ b/scene/resources/default_theme/scroll_button_down.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_down_hl.png b/scene/resources/default_theme/scroll_button_down_hl.png
index 48036e0297..ba79087393 100644
--- a/scene/resources/default_theme/scroll_button_down_hl.png
+++ b/scene/resources/default_theme/scroll_button_down_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_left.png b/scene/resources/default_theme/scroll_button_left.png
index 3b50938d97..e430cb4673 100644
--- a/scene/resources/default_theme/scroll_button_left.png
+++ b/scene/resources/default_theme/scroll_button_left.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_left_hl.png b/scene/resources/default_theme/scroll_button_left_hl.png
index b3d348c24f..2a6ef17a34 100644
--- a/scene/resources/default_theme/scroll_button_left_hl.png
+++ b/scene/resources/default_theme/scroll_button_left_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_right.png b/scene/resources/default_theme/scroll_button_right.png
index 1c622a41ad..4f61687aa4 100644
--- a/scene/resources/default_theme/scroll_button_right.png
+++ b/scene/resources/default_theme/scroll_button_right.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_right_hl.png b/scene/resources/default_theme/scroll_button_right_hl.png
index 108796ca02..10e2722509 100644
--- a/scene/resources/default_theme/scroll_button_right_hl.png
+++ b/scene/resources/default_theme/scroll_button_right_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_up.png b/scene/resources/default_theme/scroll_button_up.png
index 2c8238ae4c..f425412f50 100644
--- a/scene/resources/default_theme/scroll_button_up.png
+++ b/scene/resources/default_theme/scroll_button_up.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_button_up_hl.png b/scene/resources/default_theme/scroll_button_up_hl.png
index 4283bd114a..615a236c52 100644
--- a/scene/resources/default_theme/scroll_button_up_hl.png
+++ b/scene/resources/default_theme/scroll_button_up_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_grabber.png b/scene/resources/default_theme/scroll_grabber.png
index 1d625a9b7b..732725a28f 100644
--- a/scene/resources/default_theme/scroll_grabber.png
+++ b/scene/resources/default_theme/scroll_grabber.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_grabber_hl.png b/scene/resources/default_theme/scroll_grabber_hl.png
index 99eb24b7e7..006cfa3361 100644
--- a/scene/resources/default_theme/scroll_grabber_hl.png
+++ b/scene/resources/default_theme/scroll_grabber_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/scroll_grabber_pressed.png b/scene/resources/default_theme/scroll_grabber_pressed.png
index a46d242ddd..f4886158fa 100644
--- a/scene/resources/default_theme/scroll_grabber_pressed.png
+++ b/scene/resources/default_theme/scroll_grabber_pressed.png
Binary files differ
diff --git a/scene/resources/default_theme/selection.png b/scene/resources/default_theme/selection.png
index 501877a8b4..7d1c985b35 100644
--- a/scene/resources/default_theme/selection.png
+++ b/scene/resources/default_theme/selection.png
Binary files differ
diff --git a/scene/resources/default_theme/selection_oof.png b/scene/resources/default_theme/selection_oof.png
index 9594fe0913..2da0538389 100644
--- a/scene/resources/default_theme/selection_oof.png
+++ b/scene/resources/default_theme/selection_oof.png
Binary files differ
diff --git a/scene/resources/default_theme/spinbox_updown.png b/scene/resources/default_theme/spinbox_updown.png
index b40b1e9fd2..74fab19f34 100644
--- a/scene/resources/default_theme/spinbox_updown.png
+++ b/scene/resources/default_theme/spinbox_updown.png
Binary files differ
diff --git a/scene/resources/default_theme/submenu.png b/scene/resources/default_theme/submenu.png
index ec727eecf1..8f7de446d4 100644
--- a/scene/resources/default_theme/submenu.png
+++ b/scene/resources/default_theme/submenu.png
Binary files differ
diff --git a/scene/resources/default_theme/tab.png b/scene/resources/default_theme/tab.png
index 3e4d792a48..895daa65e2 100644
--- a/scene/resources/default_theme/tab.png
+++ b/scene/resources/default_theme/tab.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_behind.png b/scene/resources/default_theme/tab_behind.png
index 12f07c3a91..2803d9db65 100644
--- a/scene/resources/default_theme/tab_behind.png
+++ b/scene/resources/default_theme/tab_behind.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_close.png b/scene/resources/default_theme/tab_close.png
index 20d9b5c810..af2775a132 100644
--- a/scene/resources/default_theme/tab_close.png
+++ b/scene/resources/default_theme/tab_close.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_container_bg.png b/scene/resources/default_theme/tab_container_bg.png
index 92482aaf28..7d0bd16221 100644
--- a/scene/resources/default_theme/tab_container_bg.png
+++ b/scene/resources/default_theme/tab_container_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_current.png b/scene/resources/default_theme/tab_current.png
index 7289e032da..520d147217 100644
--- a/scene/resources/default_theme/tab_current.png
+++ b/scene/resources/default_theme/tab_current.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_menu.png b/scene/resources/default_theme/tab_menu.png
index 148b64b8aa..fa4421a28a 100644
--- a/scene/resources/default_theme/tab_menu.png
+++ b/scene/resources/default_theme/tab_menu.png
Binary files differ
diff --git a/scene/resources/default_theme/tab_menu_hl.png b/scene/resources/default_theme/tab_menu_hl.png
index 148b64b8aa..fa4421a28a 100644
--- a/scene/resources/default_theme/tab_menu_hl.png
+++ b/scene/resources/default_theme/tab_menu_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/toggle_off.png b/scene/resources/default_theme/toggle_off.png
index 71cd64b001..64b51c8c9d 100644
--- a/scene/resources/default_theme/toggle_off.png
+++ b/scene/resources/default_theme/toggle_off.png
Binary files differ
diff --git a/scene/resources/default_theme/toggle_on.png b/scene/resources/default_theme/toggle_on.png
index 6ea1b589c7..f0c699c181 100644
--- a/scene/resources/default_theme/toggle_on.png
+++ b/scene/resources/default_theme/toggle_on.png
Binary files differ
diff --git a/scene/resources/default_theme/tool_button_pressed.png b/scene/resources/default_theme/tool_button_pressed.png
index bcf70b486d..5494475792 100644
--- a/scene/resources/default_theme/tool_button_pressed.png
+++ b/scene/resources/default_theme/tool_button_pressed.png
Binary files differ
diff --git a/scene/resources/default_theme/tooltip_bg.png b/scene/resources/default_theme/tooltip_bg.png
index eca0675a98..07b7d942ca 100644
--- a/scene/resources/default_theme/tooltip_bg.png
+++ b/scene/resources/default_theme/tooltip_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_bg.png b/scene/resources/default_theme/tree_bg.png
index 839a6a272a..2b0c506f34 100644
--- a/scene/resources/default_theme/tree_bg.png
+++ b/scene/resources/default_theme/tree_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_bg_disabled.png b/scene/resources/default_theme/tree_bg_disabled.png
index a0fa505e4c..69d78febd9 100644
--- a/scene/resources/default_theme/tree_bg_disabled.png
+++ b/scene/resources/default_theme/tree_bg_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_bg_focus.png b/scene/resources/default_theme/tree_bg_focus.png
index 692cf71926..aadc6b0db4 100644
--- a/scene/resources/default_theme/tree_bg_focus.png
+++ b/scene/resources/default_theme/tree_bg_focus.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_cursor.png b/scene/resources/default_theme/tree_cursor.png
index 94d2a08818..2b8722d066 100644
--- a/scene/resources/default_theme/tree_cursor.png
+++ b/scene/resources/default_theme/tree_cursor.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_cursor_unfocus.png b/scene/resources/default_theme/tree_cursor_unfocus.png
index 3f023bbabe..bfaebbea85 100644
--- a/scene/resources/default_theme/tree_cursor_unfocus.png
+++ b/scene/resources/default_theme/tree_cursor_unfocus.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_title.png b/scene/resources/default_theme/tree_title.png
index b0ddcffbbe..e5f3f49695 100644
--- a/scene/resources/default_theme/tree_title.png
+++ b/scene/resources/default_theme/tree_title.png
Binary files differ
diff --git a/scene/resources/default_theme/tree_title_pressed.png b/scene/resources/default_theme/tree_title_pressed.png
index 746d10039e..35e2bb3008 100644
--- a/scene/resources/default_theme/tree_title_pressed.png
+++ b/scene/resources/default_theme/tree_title_pressed.png
Binary files differ
diff --git a/scene/resources/default_theme/unchecked.png b/scene/resources/default_theme/unchecked.png
index d6f790cbc2..8c818af755 100644
--- a/scene/resources/default_theme/unchecked.png
+++ b/scene/resources/default_theme/unchecked.png
Binary files differ
diff --git a/scene/resources/default_theme/updown.png b/scene/resources/default_theme/updown.png
index 916284a3cf..56f81921e8 100644
--- a/scene/resources/default_theme/updown.png
+++ b/scene/resources/default_theme/updown.png
Binary files differ
diff --git a/scene/resources/default_theme/vseparator.png b/scene/resources/default_theme/vseparator.png
index 498768c05b..51e79f3ac5 100644
--- a/scene/resources/default_theme/vseparator.png
+++ b/scene/resources/default_theme/vseparator.png
Binary files differ
diff --git a/scene/resources/default_theme/vslider_bg.png b/scene/resources/default_theme/vslider_bg.png
index 8d9ead3c5a..ba3244e3e5 100644
--- a/scene/resources/default_theme/vslider_bg.png
+++ b/scene/resources/default_theme/vslider_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/vslider_grabber.png b/scene/resources/default_theme/vslider_grabber.png
index afc490be45..6c6bf93e68 100644
--- a/scene/resources/default_theme/vslider_grabber.png
+++ b/scene/resources/default_theme/vslider_grabber.png
Binary files differ
diff --git a/scene/resources/default_theme/vslider_grabber_disabled.png b/scene/resources/default_theme/vslider_grabber_disabled.png
index c830359f45..49cced5055 100644
--- a/scene/resources/default_theme/vslider_grabber_disabled.png
+++ b/scene/resources/default_theme/vslider_grabber_disabled.png
Binary files differ
diff --git a/scene/resources/default_theme/vslider_grabber_hl.png b/scene/resources/default_theme/vslider_grabber_hl.png
index 548972e115..28774fdbf8 100644
--- a/scene/resources/default_theme/vslider_grabber_hl.png
+++ b/scene/resources/default_theme/vslider_grabber_hl.png
Binary files differ
diff --git a/scene/resources/default_theme/vslider_tick.png b/scene/resources/default_theme/vslider_tick.png
index 873ebb00d8..bde788b563 100644
--- a/scene/resources/default_theme/vslider_tick.png
+++ b/scene/resources/default_theme/vslider_tick.png
Binary files differ
diff --git a/scene/resources/default_theme/vsplit_bg.png b/scene/resources/default_theme/vsplit_bg.png
index 7dd1d48b29..a5749f6d5c 100644
--- a/scene/resources/default_theme/vsplit_bg.png
+++ b/scene/resources/default_theme/vsplit_bg.png
Binary files differ
diff --git a/scene/resources/default_theme/vsplitter.png b/scene/resources/default_theme/vsplitter.png
index ec5542bf69..dde1f390df 100644
--- a/scene/resources/default_theme/vsplitter.png
+++ b/scene/resources/default_theme/vsplitter.png
Binary files differ
diff --git a/scene/resources/default_theme/window_resizer.png b/scene/resources/default_theme/window_resizer.png
index ed51968c4e..b06e6f5366 100644
--- a/scene/resources/default_theme/window_resizer.png
+++ b/scene/resources/default_theme/window_resizer.png
Binary files differ
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 23c6dc200b..e5d463d391 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -33,8 +33,12 @@
#include "os/file_access.h"
#include "os/os.h"
-bool DynamicFontData::CacheID::operator<(CacheID right) const {
+#include FT_STROKER_H
+
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+bool DynamicFontData::CacheID::operator<(CacheID right) const {
return key < right.key;
}
@@ -80,6 +84,14 @@ void DynamicFontData::set_force_autohinter(bool p_force) {
void DynamicFontData::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_font_path", "path"), &DynamicFontData::set_font_path);
ClassDB::bind_method(D_METHOD("get_font_path"), &DynamicFontData::get_font_path);
+ ClassDB::bind_method(D_METHOD("set_hinting", "mode"), &DynamicFontData::set_hinting);
+ ClassDB::bind_method(D_METHOD("get_hinting"), &DynamicFontData::get_hinting);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal"), "set_hinting", "get_hinting");
+
+ BIND_ENUM_CONSTANT(HINTING_NONE);
+ BIND_ENUM_CONSTANT(HINTING_LIGHT);
+ BIND_ENUM_CONSTANT(HINTING_NORMAL);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "font_path", PROPERTY_HINT_FILE, "*.ttf,*.otf"), "set_font_path", "get_font_path");
}
@@ -87,6 +99,7 @@ void DynamicFontData::_bind_methods() {
DynamicFontData::DynamicFontData() {
force_autohinter = false;
+ hinting = DynamicFontData::HINTING_NORMAL;
font_mem = NULL;
font_mem_size = 0;
}
@@ -203,8 +216,8 @@ Error DynamicFontAtSize::_load() {
error = FT_Set_Pixel_Sizes(face, 0, id.size * oversampling);
}
- ascent = (face->size->metrics.ascender >> 6) / oversampling * scale_color_font;
- descent = (-face->size->metrics.descender >> 6) / oversampling * scale_color_font;
+ ascent = (face->size->metrics.ascender / 64.0) / oversampling * scale_color_font;
+ descent = (-face->size->metrics.descender / 64.0) / oversampling * scale_color_font;
linegap = 0;
texture_flags = 0;
if (id.mipmaps)
@@ -212,8 +225,6 @@ Error DynamicFontAtSize::_load() {
if (id.filter)
texture_flags |= Texture::FLAG_FILTER;
- //print_line("ASCENT: "+itos(ascent)+" descent "+itos(descent)+" hinted: "+itos(face->face_flags&FT_FACE_FLAG_HINTER));
-
valid = true;
return OK;
}
@@ -234,18 +245,11 @@ float DynamicFontAtSize::get_descent() const {
return descent;
}
-Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const {
-
- if (!valid)
- return Size2(1, 1);
- const_cast<DynamicFontAtSize *>(this)->_update_char(p_char);
-
- const Character *c = char_map.getptr(p_char);
- ERR_FAIL_COND_V(!c, Size2());
+const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFontAtSize::_find_char_with_font(CharType p_char, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const {
+ const Character *chr = char_map.getptr(p_char);
+ ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(NULL, NULL)));
- Size2 ret(0, get_height());
-
- if (!c->found) {
+ if (!chr->found) {
//not found, try in fallbacks
for (int i = 0; i < p_fallbacks.size(); i++) {
@@ -255,52 +259,54 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const V
continue;
fb->_update_char(p_char);
- const Character *ch = fb->char_map.getptr(p_char);
- ERR_CONTINUE(!ch);
+ const Character *fallback_chr = fb->char_map.getptr(p_char);
+ ERR_CONTINUE(!fallback_chr);
- if (!ch->found)
+ if (!fallback_chr->found)
continue;
- c = ch;
- break;
+ return Pair<const Character *, DynamicFontAtSize *>(fallback_chr, fb);
}
- //not found, try 0xFFFD to display 'not found'.
-
- if (!c->found) {
- const_cast<DynamicFontAtSize *>(this)->_update_char(0xFFFD);
- c = char_map.getptr(0xFFFD);
- ERR_FAIL_COND_V(!c, Size2());
- }
+ //not found, try 0xFFFD to display 'not found'.
+ const_cast<DynamicFontAtSize *>(this)->_update_char(0xFFFD);
+ chr = char_map.getptr(0xFFFD);
+ ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(NULL, NULL)));
}
- if (c->found) {
- ret.x = c->advance;
- }
+ return Pair<const Character *, DynamicFontAtSize *>(chr, const_cast<DynamicFontAtSize *>(this));
+}
+
+float DynamicFontAtSize::_get_kerning_advance(const DynamicFontAtSize *font, CharType p_char, CharType p_next) const {
+ float advance = 0.0;
if (p_next) {
FT_Vector delta;
- FT_Get_Kerning(face, p_char, p_next, FT_KERNING_DEFAULT, &delta);
+ FT_Get_Kerning(font->face, p_char, p_next, FT_KERNING_DEFAULT, &delta);
+ advance = (delta.x / 64.0) / oversampling;
+ }
- if (delta.x == 0) {
- for (int i = 0; i < p_fallbacks.size(); i++) {
+ return advance;
+}
- DynamicFontAtSize *fb = const_cast<DynamicFontAtSize *>(p_fallbacks[i].ptr());
- if (!fb->valid)
- continue;
+Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const {
- FT_Get_Kerning(fb->face, p_char, p_next, FT_KERNING_DEFAULT, &delta);
+ if (!valid)
+ return Size2(1, 1);
+ const_cast<DynamicFontAtSize *>(this)->_update_char(p_char);
- if (delta.x == 0)
- continue;
+ Pair<const Character *, DynamicFontAtSize *> char_pair_with_font = _find_char_with_font(p_char, p_fallbacks);
+ const Character *ch = char_pair_with_font.first;
+ DynamicFontAtSize *font = char_pair_with_font.second;
+ ERR_FAIL_COND_V(!ch, Size2());
- ret.x += (delta.x >> 6) / oversampling;
- break;
- }
- } else {
- ret.x += (delta.x >> 6) / oversampling;
- }
+ Size2 ret(0, get_height());
+
+ if (ch->found) {
+ ret.x = ch->advance;
}
+ ret.x += _get_kerning_advance(font, p_char, p_next);
+
return ret;
}
@@ -314,102 +320,42 @@ void DynamicFontAtSize::set_texture_flags(uint32_t p_flags) {
}
}
-float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const {
+float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks, bool p_advance_only) const {
if (!valid)
return 0;
const_cast<DynamicFontAtSize *>(this)->_update_char(p_char);
- const Character *c = char_map.getptr(p_char);
+ Pair<const Character *, DynamicFontAtSize *> char_pair_with_font = _find_char_with_font(p_char, p_fallbacks);
+ const Character *ch = char_pair_with_font.first;
+ DynamicFontAtSize *font = char_pair_with_font.second;
- float advance = 0;
+ ERR_FAIL_COND_V(!ch, 0.0);
- if (!c->found) {
+ float advance = 0.0;
- //not found, try in fallbacks
- bool used_fallback = false;
+ if (ch->found) {
+ ERR_FAIL_COND_V(ch->texture_idx < -1 || ch->texture_idx >= font->textures.size(), 0);
- for (int i = 0; i < p_fallbacks.size(); i++) {
-
- DynamicFontAtSize *fb = const_cast<DynamicFontAtSize *>(p_fallbacks[i].ptr());
- if (!fb->valid)
- continue;
-
- fb->_update_char(p_char);
- const Character *ch = fb->char_map.getptr(p_char);
- ERR_CONTINUE(!ch);
-
- if (!ch->found)
- continue;
+ if (!p_advance_only && ch->texture_idx != -1) {
Point2 cpos = p_pos;
cpos.x += ch->h_align;
- cpos.y -= fb->get_ascent();
+ cpos.y -= font->get_ascent();
cpos.y += ch->v_align;
- ERR_FAIL_COND_V(ch->texture_idx < -1 || ch->texture_idx >= fb->textures.size(), 0);
- if (ch->texture_idx != -1) {
- Color modulate = p_modulate;
- if (FT_HAS_COLOR(fb->face)) {
- modulate.r = modulate.g = modulate.b = 1;
- }
- VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size * Vector2(fb->scale_color_font, fb->scale_color_font)), fb->textures[ch->texture_idx].texture->get_rid(), ch->rect_uv, modulate, false, RID(), false);
- }
- advance = ch->advance;
- used_fallback = true;
- break;
- }
- //not found, try 0xFFFD to display 'not found'.
-
- if (!used_fallback) {
-
- const_cast<DynamicFontAtSize *>(this)->_update_char(0xFFFD);
- c = char_map.getptr(0xFFFD);
- }
- }
-
- if (c->found) {
-
- Point2 cpos = p_pos;
- cpos.x += c->h_align;
- cpos.y -= get_ascent();
- cpos.y += c->v_align;
- ERR_FAIL_COND_V(c->texture_idx < -1 || c->texture_idx >= textures.size(), 0);
- if (c->texture_idx != -1) {
Color modulate = p_modulate;
if (FT_HAS_COLOR(face)) {
- modulate.r = modulate.g = modulate.b = 1;
+ modulate.r = modulate.g = modulate.b = 1.0;
}
- VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size * Vector2(scale_color_font, scale_color_font)), textures[c->texture_idx].texture->get_rid(), c->rect_uv, modulate, false, RID(), false);
+ RID texture = font->textures[ch->texture_idx].texture->get_rid();
+ VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size * Vector2(font->scale_color_font, font->scale_color_font)), texture, ch->rect_uv, modulate, false, RID(), false);
}
- advance = c->advance;
- //textures[c->texture_idx].texture->draw(p_canvas_item,Vector2());
- }
-
- if (p_next) {
- FT_Vector delta;
- FT_Get_Kerning(face, p_char, p_next, FT_KERNING_DEFAULT, &delta);
-
- if (delta.x == 0) {
- for (int i = 0; i < p_fallbacks.size(); i++) {
-
- DynamicFontAtSize *fb = const_cast<DynamicFontAtSize *>(p_fallbacks[i].ptr());
- if (!fb->valid)
- continue;
-
- FT_Get_Kerning(fb->face, p_char, p_next, FT_KERNING_DEFAULT, &delta);
-
- if (delta.x == 0)
- continue;
-
- advance += (delta.x >> 6) / oversampling;
- break;
- }
- } else {
- advance += (delta.x >> 6) / oversampling;
- }
+ advance = ch->advance;
}
+ advance += _get_kerning_advance(font, p_char, p_next);
+
return advance;
}
@@ -433,84 +379,37 @@ void DynamicFontAtSize::_ft_stream_close(FT_Stream stream) {
memdelete(f);
}
-void DynamicFontAtSize::_update_char(CharType p_char) {
-
- if (char_map.has(p_char))
- return;
-
- _THREAD_SAFE_METHOD_
-
- FT_GlyphSlot slot = face->glyph;
-
- if (FT_Get_Char_Index(face, p_char) == 0) {
- //not found
- Character ch;
- ch.texture_idx = -1;
- ch.advance = 0;
- ch.h_align = 0;
- ch.v_align = 0;
- ch.found = false;
-
- char_map[p_char] = ch;
- return;
- }
- int error = FT_Load_Char(face, p_char, FT_HAS_COLOR(face) ? FT_LOAD_COLOR : FT_LOAD_DEFAULT | (font->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0));
- if (!error) {
- error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);
- }
- if (error) {
-
- int advance = 0;
- //stbtt_GetCodepointHMetrics(&font->info, p_char, &advance, 0);
- //print_line("char has no bitmap: "+itos(p_char)+" but advance is "+itos(advance*scale));
- Character ch;
- ch.texture_idx = -1;
- ch.advance = advance;
- ch.h_align = 0;
- ch.v_align = 0;
- ch.found = false;
-
- char_map[p_char] = ch;
-
- return;
- }
-
- int w = slot->bitmap.width;
- int h = slot->bitmap.rows;
- //int p = slot->bitmap.pitch;
- int yofs = slot->bitmap_top;
- int xofs = slot->bitmap_left;
- int advance = slot->advance.x >> 6;
-
- int mw = w + rect_margin * 2;
- int mh = h + rect_margin * 2;
-
- if (mw > 4096 || mh > 4096) {
-
- ERR_FAIL_COND(mw > 4096);
- ERR_FAIL_COND(mh > 4096);
- }
+DynamicFontAtSize::Character DynamicFontAtSize::Character::not_found() {
+ Character ch;
+ ch.texture_idx = -1;
+ ch.advance = 0;
+ ch.h_align = 0;
+ ch.v_align = 0;
+ ch.found = false;
+ return ch;
+}
- //find a texture to fit this...
+DynamicFontAtSize::TexturePosition DynamicFontAtSize::_find_texture_pos_for_glyph(int p_color_size, Image::Format p_image_format, int p_width, int p_height) {
+ TexturePosition ret;
+ ret.index = -1;
+ ret.x = 0;
+ ret.y = 0;
- int color_size = slot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA ? 4 : 2;
- Image::Format require_format = color_size == 4 ? Image::FORMAT_RGBA8 : Image::FORMAT_LA8;
- int tex_index = -1;
- int tex_x = 0;
- int tex_y = 0;
+ int mw = p_width;
+ int mh = p_height;
for (int i = 0; i < textures.size(); i++) {
CharTexture &ct = textures[i];
- if (ct.texture->get_format() != require_format)
+ if (ct.texture->get_format() != p_image_format)
continue;
if (mw > ct.texture_size || mh > ct.texture_size) //too big for this texture
continue;
- tex_y = 0x7FFFFFFF;
- tex_x = 0;
+ ret.y = 0x7FFFFFFF;
+ ret.x = 0;
for (int j = 0; j < ct.texture_size - mw; j++) {
@@ -523,27 +422,27 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
max_y = y;
}
- if (max_y < tex_y) {
- tex_y = max_y;
- tex_x = j;
+ if (max_y < ret.y) {
+ ret.y = max_y;
+ ret.x = j;
}
}
- if (tex_y == 0x7FFFFFFF || tex_y + mh > ct.texture_size)
+ if (ret.y == 0x7FFFFFFF || ret.y + mh > ct.texture_size)
continue; //fail, could not fit it here
- tex_index = i;
+ ret.index = i;
break;
}
//print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" X: "+itos(tex_x)+" Y: "+itos(tex_y));
- if (tex_index == -1) {
+ if (ret.index == -1) {
//could not find texture to fit, create one
- tex_x = 0;
- tex_y = 0;
+ ret.x = 0;
+ ret.y = 0;
- int texsize = MAX(id.size * 8, 256);
+ int texsize = MAX(id.size * oversampling * 8, 256);
if (mw > texsize)
texsize = mw; //special case, adapt to it?
if (mh > texsize)
@@ -555,13 +454,13 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
CharTexture tex;
tex.texture_size = texsize;
- tex.imgdata.resize(texsize * texsize * color_size);
+ tex.imgdata.resize(texsize * texsize * p_color_size); //grayscale alpha
{
//zero texture
PoolVector<uint8_t>::Write w = tex.imgdata.write();
- ERR_FAIL_COND(texsize * texsize * color_size > tex.imgdata.size());
- for (int i = 0; i < texsize * texsize * color_size; i++) {
+ ERR_FAIL_COND_V(texsize * texsize * p_color_size > tex.imgdata.size(), ret);
+ for (int i = 0; i < texsize * texsize * p_color_size; i++) {
w[i] = 0;
}
}
@@ -570,12 +469,31 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
tex.offsets[i] = 0;
textures.push_back(tex);
- tex_index = textures.size() - 1;
+ ret.index = textures.size() - 1;
}
+ return ret;
+}
+
+DynamicFontAtSize::Character DynamicFontAtSize::_bitmap_to_character(FT_Bitmap bitmap, int yofs, int xofs, float advance) {
+ int w = bitmap.width;
+ int h = bitmap.rows;
+
+ int mw = w + rect_margin * 2;
+ int mh = h + rect_margin * 2;
+
+ ERR_FAIL_COND_V(mw > 4096, Character::not_found());
+ ERR_FAIL_COND_V(mh > 4096, Character::not_found());
+
+ int color_size = bitmap.pixel_mode == FT_PIXEL_MODE_BGRA ? 4 : 2;
+ Image::Format require_format = color_size == 4 ? Image::FORMAT_RGBA8 : Image::FORMAT_LA8;
+
+ TexturePosition tex_pos = _find_texture_pos_for_glyph(color_size, require_format, mw, mh);
+ ERR_FAIL_COND_V(tex_pos.index < 0, Character::not_found());
+
//fit character in char texture
- CharTexture &tex = textures[tex_index];
+ CharTexture &tex = textures[tex_pos.index];
{
PoolVector<uint8_t>::Write wr = tex.imgdata.write();
@@ -583,30 +501,30 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
- int ofs = ((i + tex_y + rect_margin) * tex.texture_size + j + tex_x + rect_margin) * color_size;
- ERR_FAIL_COND(ofs >= tex.imgdata.size());
- switch (slot->bitmap.pixel_mode) {
+ int ofs = ((i + tex_pos.y + rect_margin) * tex.texture_size + j + tex_pos.x + rect_margin) * color_size;
+ ERR_FAIL_COND_V(ofs >= tex.imgdata.size(), Character::not_found());
+ switch (bitmap.pixel_mode) {
case FT_PIXEL_MODE_MONO: {
- int byte = i * slot->bitmap.pitch + (j >> 3);
+ int byte = i * bitmap.pitch + (j >> 3);
int bit = 1 << (7 - (j % 8));
wr[ofs + 0] = 255; //grayscale as 1
- wr[ofs + 1] = slot->bitmap.buffer[byte] & bit ? 255 : 0;
+ wr[ofs + 1] = bitmap.buffer[byte] & bit ? 255 : 0;
} break;
case FT_PIXEL_MODE_GRAY:
wr[ofs + 0] = 255; //grayscale as 1
- wr[ofs + 1] = slot->bitmap.buffer[i * slot->bitmap.pitch + j];
+ wr[ofs + 1] = bitmap.buffer[i * bitmap.pitch + j];
break;
case FT_PIXEL_MODE_BGRA: {
- int ofs_color = i * slot->bitmap.pitch + (j << 2);
- wr[ofs + 2] = slot->bitmap.buffer[ofs_color + 0];
- wr[ofs + 1] = slot->bitmap.buffer[ofs_color + 1];
- wr[ofs + 0] = slot->bitmap.buffer[ofs_color + 2];
- wr[ofs + 3] = slot->bitmap.buffer[ofs_color + 3];
+ int ofs_color = i * bitmap.pitch + (j << 2);
+ wr[ofs + 2] = bitmap.buffer[ofs_color + 0];
+ wr[ofs + 1] = bitmap.buffer[ofs_color + 1];
+ wr[ofs + 0] = bitmap.buffer[ofs_color + 2];
+ wr[ofs + 3] = bitmap.buffer[ofs_color + 3];
} break;
// TODO: FT_PIXEL_MODE_LCD
default:
- ERR_EXPLAIN("Font uses unsupported pixel format: " + itos(slot->bitmap.pixel_mode));
- ERR_FAIL();
+ ERR_EXPLAIN("Font uses unsupported pixel format: " + itos(bitmap.pixel_mode));
+ ERR_FAIL_V(Character::not_found());
break;
}
}
@@ -628,33 +546,105 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
// update height array
- for (int k = tex_x; k < tex_x + mw; k++) {
-
- tex.offsets[k] = tex_y + mh;
+ for (int k = tex_pos.x; k < tex_pos.x + mw; k++) {
+ tex.offsets[k] = tex_pos.y + mh;
}
Character chr;
chr.h_align = xofs * scale_color_font / oversampling;
chr.v_align = ascent - (yofs * scale_color_font / oversampling); // + ascent - descent;
chr.advance = advance * scale_color_font / oversampling;
- chr.texture_idx = tex_index;
+ chr.texture_idx = tex_pos.index;
chr.found = true;
- chr.rect_uv = Rect2(tex_x + rect_margin, tex_y + rect_margin, w, h);
+ chr.rect_uv = Rect2(tex_pos.x + rect_margin, tex_pos.y + rect_margin, w, h);
chr.rect = chr.rect_uv;
chr.rect.position /= oversampling;
- chr.rect.size /= oversampling;
+ chr.rect.size = chr.rect.size * scale_color_font / oversampling;
+ return chr;
+}
+
+DynamicFontAtSize::Character DynamicFontAtSize::_make_outline_char(CharType p_char) {
+ Character ret = Character::not_found();
+
+ if (FT_Load_Char(face, p_char, FT_LOAD_NO_BITMAP | (font->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0)) != 0)
+ return ret;
+
+ FT_Stroker stroker;
+ if (FT_Stroker_New(library, &stroker) != 0)
+ return ret;
+
+ FT_Stroker_Set(stroker, (int)(id.outline_size * oversampling * 64.0), FT_STROKER_LINECAP_BUTT, FT_STROKER_LINEJOIN_ROUND, 0);
+ FT_Glyph glyph;
+ FT_BitmapGlyph glyph_bitmap;
+
+ if (FT_Get_Glyph(face->glyph, &glyph) != 0)
+ goto cleanup_stroker;
+ if (FT_Glyph_Stroke(&glyph, stroker, 1) != 0)
+ goto cleanup_glyph;
+ if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1) != 0)
+ goto cleanup_glyph;
- //print_line("CHAR: "+String::chr(p_char)+" TEX INDEX: "+itos(tex_index)+" RECT: "+chr.rect+" X OFS: "+itos(xofs)+" Y OFS: "+itos(yofs));
+ glyph_bitmap = (FT_BitmapGlyph)glyph;
+ ret = _bitmap_to_character(glyph_bitmap->bitmap, glyph_bitmap->top, glyph_bitmap->left, glyph->advance.x / 65536.0);
- char_map[p_char] = chr;
+cleanup_glyph:
+ FT_Done_Glyph(glyph);
+cleanup_stroker:
+ FT_Stroker_Done(stroker);
+ return ret;
}
-bool DynamicFontAtSize::update_oversampling() {
- if (oversampling == font_oversampling)
- return false;
- if (!valid)
- return false;
+void DynamicFontAtSize::_update_char(CharType p_char) {
+
+ if (char_map.has(p_char))
+ return;
+
+ _THREAD_SAFE_METHOD_
+
+ Character character = Character::not_found();
+
+ FT_GlyphSlot slot = face->glyph;
+
+ if (FT_Get_Char_Index(face, p_char) == 0) {
+ char_map[p_char] = character;
+ return;
+ }
+
+ int ft_hinting;
+
+ switch (font->hinting) {
+ case DynamicFontData::HINTING_NONE:
+ ft_hinting = FT_LOAD_NO_HINTING;
+ break;
+ case DynamicFontData::HINTING_LIGHT:
+ ft_hinting = FT_LOAD_TARGET_LIGHT;
+ break;
+ default:
+ ft_hinting = FT_LOAD_TARGET_NORMAL;
+ break;
+ }
+
+ int error = FT_Load_Char(face, p_char, FT_HAS_COLOR(face) ? FT_LOAD_COLOR : FT_LOAD_DEFAULT | (font->force_autohinter ? FT_LOAD_FORCE_AUTOHINT : 0) | ft_hinting);
+ if (error) {
+ char_map[p_char] = character;
+ return;
+ }
+
+ if (id.outline_size > 0) {
+ character = _make_outline_char(p_char);
+ } else {
+ error = FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);
+ if (!error)
+ character = _bitmap_to_character(slot->bitmap, slot->bitmap_top, slot->bitmap_left, slot->advance.x / 64.0);
+ }
+
+ char_map[p_char] = character;
+}
+
+void DynamicFontAtSize::update_oversampling() {
+ if (oversampling == font_oversampling || !valid)
+ return;
FT_Done_FreeType(library);
textures.clear();
@@ -662,8 +652,6 @@ bool DynamicFontAtSize::update_oversampling() {
oversampling = font_oversampling;
valid = false;
_load();
-
- return true;
}
DynamicFontAtSize::DynamicFontAtSize() {
@@ -692,11 +680,27 @@ DynamicFontAtSize::~DynamicFontAtSize() {
void DynamicFont::_reload_cache() {
ERR_FAIL_COND(cache_id.size < 1);
- if (!data.is_valid())
+ if (!data.is_valid()) {
+ data_at_size.unref();
+ outline_data_at_size.unref();
+ fallback_data_at_size.resize(0);
+ fallback_outline_data_at_size.resize(0);
return;
+ }
+
data_at_size = data->_get_dynamic_font_at_size(cache_id);
+ if (outline_cache_id.outline_size > 0) {
+ outline_data_at_size = data->_get_dynamic_font_at_size(outline_cache_id);
+ fallback_outline_data_at_size.resize(fallback_data_at_size.size());
+ } else {
+ outline_data_at_size.unref();
+ fallback_outline_data_at_size.resize(0);
+ }
+
for (int i = 0; i < fallbacks.size(); i++) {
fallback_data_at_size[i] = fallbacks[i]->_get_dynamic_font_at_size(cache_id);
+ if (outline_cache_id.outline_size > 0)
+ fallback_outline_data_at_size[i] = fallbacks[i]->_get_dynamic_font_at_size(outline_cache_id);
}
emit_changed();
@@ -706,12 +710,10 @@ void DynamicFont::_reload_cache() {
void DynamicFont::set_font_data(const Ref<DynamicFontData> &p_data) {
data = p_data;
- if (data.is_valid())
- data_at_size = data->_get_dynamic_font_at_size(cache_id);
- else
- data_at_size = Ref<DynamicFontAtSize>();
+ _reload_cache();
emit_changed();
+ _change_notify();
}
Ref<DynamicFontData> DynamicFont::get_font_data() const {
@@ -724,6 +726,7 @@ void DynamicFont::set_size(int p_size) {
if (cache_id.size == p_size)
return;
cache_id.size = p_size;
+ outline_cache_id.size = p_size;
_reload_cache();
}
@@ -732,6 +735,30 @@ int DynamicFont::get_size() const {
return cache_id.size;
}
+void DynamicFont::set_outline_size(int p_size) {
+ if (outline_cache_id.outline_size == p_size)
+ return;
+ ERR_FAIL_COND(p_size < 0 || p_size > UINT8_MAX);
+ outline_cache_id.outline_size = p_size;
+ _reload_cache();
+}
+
+int DynamicFont::get_outline_size() const {
+ return outline_cache_id.outline_size;
+}
+
+void DynamicFont::set_outline_color(Color p_color) {
+ if (p_color != outline_color) {
+ outline_color = p_color;
+ emit_changed();
+ _change_notify();
+ }
+}
+
+Color DynamicFont::get_outline_color() const {
+ return outline_color;
+}
+
bool DynamicFont::get_use_mipmaps() const {
return cache_id.mipmaps;
@@ -742,6 +769,7 @@ void DynamicFont::set_use_mipmaps(bool p_enable) {
if (cache_id.mipmaps == p_enable)
return;
cache_id.mipmaps = p_enable;
+ outline_cache_id.mipmaps = p_enable;
_reload_cache();
}
@@ -755,9 +783,22 @@ void DynamicFont::set_use_filter(bool p_enable) {
if (cache_id.filter == p_enable)
return;
cache_id.filter = p_enable;
+ outline_cache_id.filter = p_enable;
_reload_cache();
}
+DynamicFontData::Hinting DynamicFontData::get_hinting() const {
+
+ return hinting;
+}
+
+void DynamicFontData::set_hinting(Hinting p_hinting) {
+
+ if (hinting == p_hinting)
+ return;
+ hinting = p_hinting;
+}
+
int DynamicFont::get_spacing(int p_type) const {
if (p_type == SPACING_TOP) {
@@ -832,13 +873,24 @@ bool DynamicFont::is_distance_field_hint() const {
return false;
}
-float DynamicFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate) const {
+bool DynamicFont::has_outline() const {
+ return outline_cache_id.outline_size > 0;
+}
- if (!data_at_size.is_valid())
+float DynamicFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, bool p_outline) const {
+ const Ref<DynamicFontAtSize> &font_at_size = p_outline && outline_cache_id.outline_size > 0 ? outline_data_at_size : data_at_size;
+
+ if (!font_at_size.is_valid())
return 0;
- return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, fallback_data_at_size) + spacing_char;
+ const Vector<Ref<DynamicFontAtSize> > &fallbacks = p_outline && outline_cache_id.outline_size > 0 ? fallback_outline_data_at_size : fallback_data_at_size;
+ Color color = p_outline && outline_cache_id.outline_size > 0 ? p_modulate * outline_color : p_modulate;
+
+ // If requested outline draw, but no outline is present, simply return advance without drawing anything
+ bool advance_only = p_outline && outline_cache_id.outline_size == 0;
+ return font_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, color, fallbacks, advance_only) + spacing_char;
}
+
void DynamicFont::set_fallback(int p_idx, const Ref<DynamicFontData> &p_data) {
ERR_FAIL_COND(p_data.is_null());
@@ -852,6 +904,8 @@ void DynamicFont::add_fallback(const Ref<DynamicFontData> &p_data) {
ERR_FAIL_COND(p_data.is_null());
fallbacks.push_back(p_data);
fallback_data_at_size.push_back(fallbacks[fallbacks.size() - 1]->_get_dynamic_font_at_size(cache_id)); //const..
+ if (outline_cache_id.outline_size > 0)
+ fallback_outline_data_at_size.push_back(fallbacks[fallbacks.size() - 1]->_get_dynamic_font_at_size(outline_cache_id));
_change_notify();
emit_changed();
@@ -936,6 +990,12 @@ void DynamicFont::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size);
ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size);
+ ClassDB::bind_method(D_METHOD("set_outline_size", "size"), &DynamicFont::set_outline_size);
+ ClassDB::bind_method(D_METHOD("get_outline_size"), &DynamicFont::get_outline_size);
+
+ ClassDB::bind_method(D_METHOD("set_outline_color", "color"), &DynamicFont::set_outline_color);
+ ClassDB::bind_method(D_METHOD("get_outline_color"), &DynamicFont::get_outline_color);
+
ClassDB::bind_method(D_METHOD("set_use_mipmaps", "enable"), &DynamicFont::set_use_mipmaps);
ClassDB::bind_method(D_METHOD("get_use_mipmaps"), &DynamicFont::get_use_mipmaps);
ClassDB::bind_method(D_METHOD("set_use_filter", "enable"), &DynamicFont::set_use_filter);
@@ -951,6 +1011,8 @@ void DynamicFont::_bind_methods() {
ADD_GROUP("Settings", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_size"), "set_outline_size", "get_outline_size");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "outline_color"), "set_outline_color", "get_outline_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_mipmaps"), "set_use_mipmaps", "get_use_mipmaps");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_filter"), "set_use_filter", "get_use_filter");
ADD_GROUP("Extra Spacing", "extra_spacing");
@@ -978,6 +1040,7 @@ DynamicFont::DynamicFont() :
spacing_bottom = 0;
spacing_char = 0;
spacing_space = 0;
+ outline_color = Color(1, 1, 1);
if (dynamic_font_mutex)
dynamic_font_mutex->lock();
dynamic_fonts.add(&font_list);
@@ -1013,7 +1076,13 @@ void DynamicFont::update_oversampling() {
SelfList<DynamicFont> *E = dynamic_fonts.first();
while (E) {
- if (E->self()->data_at_size.is_valid() && E->self()->data_at_size->update_oversampling()) {
+ if (E->self()->data_at_size.is_valid()) {
+ E->self()->data_at_size->update_oversampling();
+
+ if (E->self()->outline_data_at_size.is_valid()) {
+ E->self()->outline_data_at_size->update_oversampling();
+ }
+
changed.push_back(Ref<DynamicFont>(E->self()));
}
E = E->next();
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index d8adf35b6b..f460bca2d4 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -35,6 +35,7 @@
#include "io/resource_loader.h"
#include "os/mutex.h"
#include "os/thread_safe.h"
+#include "pair.h"
#include "scene/resources/font.h"
#include <ft2build.h>
@@ -49,10 +50,10 @@ class DynamicFontData : public Resource {
public:
struct CacheID {
-
union {
struct {
uint32_t size : 16;
+ uint32_t outline_size : 8;
bool mipmaps : 1;
bool filter : 1;
};
@@ -64,10 +65,20 @@ public:
}
};
+ enum Hinting {
+ HINTING_NONE,
+ HINTING_LIGHT,
+ HINTING_NORMAL
+ };
+
+ Hinting get_hinting() const;
+ void set_hinting(Hinting p_hinting);
+
private:
const uint8_t *font_mem;
int font_mem_size;
bool force_autohinter;
+ Hinting hinting;
String font_path;
Map<CacheID, DynamicFontAtSize *> size_cache;
@@ -91,6 +102,8 @@ public:
~DynamicFontData();
};
+VARIANT_ENUM_CAST(DynamicFontData::Hinting);
+
class DynamicFontAtSize : public Reference {
GDCLASS(DynamicFontAtSize, Reference)
@@ -136,8 +149,22 @@ class DynamicFontAtSize : public Reference {
texture_idx = 0;
v_align = 0;
}
+
+ static Character not_found();
+ };
+
+ struct TexturePosition {
+ int index;
+ int x;
+ int y;
};
+ const Pair<const Character *, DynamicFontAtSize *> _find_char_with_font(CharType p_char, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const;
+ Character _make_outline_char(CharType p_char);
+ float _get_kerning_advance(const DynamicFontAtSize *font, CharType p_char, CharType p_next) const;
+ TexturePosition _find_texture_pos_for_glyph(int p_color_size, Image::Format p_image_format, int p_width, int p_height);
+ Character _bitmap_to_character(FT_Bitmap bitmap, int yofs, int xofs, float advance);
+
static unsigned long _ft_stream_io(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count);
static void _ft_stream_close(FT_Stream stream);
@@ -162,10 +189,10 @@ public:
Size2 get_char_size(CharType p_char, CharType p_next, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const;
- float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks) const;
+ float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize> > &p_fallbacks, bool p_advance_only = false) const;
void set_texture_flags(uint32_t p_flags);
- bool update_oversampling();
+ void update_oversampling();
DynamicFontAtSize();
~DynamicFontAtSize();
@@ -188,17 +215,23 @@ public:
private:
Ref<DynamicFontData> data;
Ref<DynamicFontAtSize> data_at_size;
+ Ref<DynamicFontAtSize> outline_data_at_size;
Vector<Ref<DynamicFontData> > fallbacks;
Vector<Ref<DynamicFontAtSize> > fallback_data_at_size;
+ Vector<Ref<DynamicFontAtSize> > fallback_outline_data_at_size;
DynamicFontData::CacheID cache_id;
+ DynamicFontData::CacheID outline_cache_id;
+
bool valid;
int spacing_top;
int spacing_bottom;
int spacing_char;
int spacing_space;
+ Color outline_color;
+
protected:
void _reload_cache();
@@ -215,6 +248,12 @@ public:
void set_size(int p_size);
int get_size() const;
+ void set_outline_size(int p_size);
+ int get_outline_size() const;
+
+ void set_outline_color(Color p_color);
+ Color get_outline_color() const;
+
bool get_use_mipmaps() const;
void set_use_mipmaps(bool p_enable);
@@ -239,7 +278,9 @@ public:
virtual bool is_distance_field_hint() const;
- virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1)) const;
+ virtual bool has_outline() const;
+
+ virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const;
SelfList<DynamicFont> font_list;
diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp
index 098b794a95..29f1106d16 100644
--- a/scene/resources/dynamic_font_stb.cpp
+++ b/scene/resources/dynamic_font_stb.cpp
@@ -162,7 +162,7 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next) const {
return ret;
}
-float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate) const {
+float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, bool p_outline) const {
const_cast<DynamicFontAtSize *>(this)->_update_char(p_char);
@@ -172,13 +172,15 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharT
return 0;
}
- Point2 cpos = p_pos;
- cpos.x += c->h_align;
- cpos.y -= get_ascent();
- cpos.y += c->v_align;
- ERR_FAIL_COND_V(c->texture_idx < -1 || c->texture_idx >= textures.size(), 0);
- if (c->texture_idx != -1)
- VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx].texture->get_rid(), c->rect, p_modulate);
+ if (!p_outline) {
+ Point2 cpos = p_pos;
+ cpos.x += c->h_align;
+ cpos.y -= get_ascent();
+ cpos.y += c->v_align;
+ ERR_FAIL_COND_V(c->texture_idx < -1 || c->texture_idx >= textures.size(), 0);
+ if (c->texture_idx != -1)
+ VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx].texture->get_rid(), c->rect, p_modulate);
+ }
//textures[c->texture_idx].texture->draw(p_canvas_item,Vector2());
@@ -459,12 +461,12 @@ bool DynamicFont::is_distance_field_hint() const {
return false;
}
-float DynamicFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate) const {
+float DynamicFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, bool p_outline) const {
if (!data_at_size.is_valid())
return 0;
- return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate);
+ return data_at_size->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, p_outline);
}
DynamicFont::DynamicFont() {
diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h
index 4c1097d28b..feae29c0c2 100644
--- a/scene/resources/dynamic_font_stb.h
+++ b/scene/resources/dynamic_font_stb.h
@@ -136,7 +136,7 @@ public:
Size2 get_char_size(CharType p_char, CharType p_next = 0) const;
- float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1)) const;
+ float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const;
DynamicFontAtSize();
~DynamicFontAtSize();
@@ -171,7 +171,7 @@ public:
virtual bool is_distance_field_hint() const;
- virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1)) const;
+ virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const;
DynamicFont();
~DynamicFont();
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 3fab4d3cfc..d3da842b79 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -378,7 +378,7 @@ bool Environment::is_ssr_rough() const {
void Environment::set_ssao_enabled(bool p_enable) {
ssao_enabled = p_enable;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
_change_notify();
}
@@ -390,7 +390,7 @@ bool Environment::is_ssao_enabled() const {
void Environment::set_ssao_radius(float p_radius) {
ssao_radius = p_radius;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_radius() const {
@@ -400,7 +400,7 @@ float Environment::get_ssao_radius() const {
void Environment::set_ssao_intensity(float p_intensity) {
ssao_intensity = p_intensity;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_intensity() const {
@@ -411,7 +411,7 @@ float Environment::get_ssao_intensity() const {
void Environment::set_ssao_radius2(float p_radius) {
ssao_radius2 = p_radius;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_radius2() const {
@@ -421,7 +421,7 @@ float Environment::get_ssao_radius2() const {
void Environment::set_ssao_intensity2(float p_intensity) {
ssao_intensity2 = p_intensity;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_intensity2() const {
@@ -431,7 +431,7 @@ float Environment::get_ssao_intensity2() const {
void Environment::set_ssao_bias(float p_bias) {
ssao_bias = p_bias;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_bias() const {
@@ -441,17 +441,27 @@ float Environment::get_ssao_bias() const {
void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) {
ssao_direct_light_affect = p_direct_light_affect;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_direct_light_affect() const {
return ssao_direct_light_affect;
}
+void Environment::set_ssao_ao_channel_affect(float p_ao_channel_affect) {
+
+ ssao_ao_channel_affect = p_ao_channel_affect;
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+}
+float Environment::get_ssao_ao_channel_affect() const {
+
+ return ssao_ao_channel_affect;
+}
+
void Environment::set_ssao_color(const Color &p_color) {
ssao_color = p_color;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
Color Environment::get_ssao_color() const {
@@ -462,7 +472,7 @@ Color Environment::get_ssao_color() const {
void Environment::set_ssao_blur(SSAOBlur p_blur) {
ssao_blur = p_blur;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
Environment::SSAOBlur Environment::get_ssao_blur() const {
@@ -472,7 +482,7 @@ Environment::SSAOBlur Environment::get_ssao_blur() const {
void Environment::set_ssao_quality(SSAOQuality p_quality) {
ssao_quality = p_quality;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
Environment::SSAOQuality Environment::get_ssao_quality() const {
@@ -483,7 +493,7 @@ Environment::SSAOQuality Environment::get_ssao_quality() const {
void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) {
ssao_edge_sharpness = p_edge_sharpness;
- VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
+ VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness);
}
float Environment::get_ssao_edge_sharpness() const {
@@ -1008,6 +1018,9 @@ void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_ssao_direct_light_affect", "amount"), &Environment::set_ssao_direct_light_affect);
ClassDB::bind_method(D_METHOD("get_ssao_direct_light_affect"), &Environment::get_ssao_direct_light_affect);
+ ClassDB::bind_method(D_METHOD("set_ssao_ao_channel_affect", "amount"), &Environment::set_ssao_ao_channel_affect);
+ ClassDB::bind_method(D_METHOD("get_ssao_ao_channel_affect"), &Environment::get_ssao_ao_channel_affect);
+
ClassDB::bind_method(D_METHOD("set_ssao_color", "color"), &Environment::set_ssao_color);
ClassDB::bind_method(D_METHOD("get_ssao_color"), &Environment::get_ssao_color);
@@ -1028,6 +1041,7 @@ void Environment::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity2", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_intensity2", "get_ssao_intensity2");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_ao_channel_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_ao_channel_affect", "get_ssao_ao_channel_affect");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ssao_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ssao_color", "get_ssao_color");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_ssao_quality", "get_ssao_quality");
ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_blur", PROPERTY_HINT_ENUM, "Disabled,1x1,2x2,3x3"), "set_ssao_blur", "get_ssao_blur");
@@ -1220,6 +1234,7 @@ Environment::Environment() {
ssao_intensity2 = 1;
ssao_bias = 0.01;
ssao_direct_light_affect = 0.0;
+ ssao_ao_channel_affect = 0.0;
ssao_blur = SSAO_BLUR_3x3;
set_ssao_edge_sharpness(4);
set_ssao_quality(SSAO_QUALITY_LOW);
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 27fd57aa09..7d66c7e60b 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -127,6 +127,7 @@ private:
float ssao_intensity2;
float ssao_bias;
float ssao_direct_light_affect;
+ float ssao_ao_channel_affect;
Color ssao_color;
SSAOBlur ssao_blur;
float ssao_edge_sharpness;
@@ -274,6 +275,9 @@ public:
void set_ssao_direct_light_affect(float p_direct_light_affect);
float get_ssao_direct_light_affect() const;
+ void set_ssao_ao_channel_affect(float p_ao_channel_affect);
+ float get_ssao_ao_channel_affect() const;
+
void set_ssao_color(const Color &p_color);
Color get_ssao_color() const;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 6fc5778dd8..0bae9d9b2d 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -32,12 +32,12 @@
#include "core/io/resource_loader.h"
#include "core/os/file_access.h"
+#include "method_bind_ext.gen.inc"
-void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate) const {
-
+void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate, const Color &p_outline_modulate) const {
float length = get_string_size(p_text).width;
if (length >= p_width) {
- draw(p_canvas_item, p_pos, p_text, p_modulate, p_width);
+ draw(p_canvas_item, p_pos, p_text, p_modulate, p_width, p_outline_modulate);
return;
}
@@ -56,13 +56,14 @@ void Font::draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, f
ERR_PRINT("Unknown halignment type");
} break;
}
- draw(p_canvas_item, p_pos + Point2(ofs, 0), p_text, p_modulate, p_width);
+ draw(p_canvas_item, p_pos + Point2(ofs, 0), p_text, p_modulate, p_width, p_outline_modulate);
}
-void Font::draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w) const {
-
+void Font::draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w, const Color &p_outline_modulate) const {
Vector2 ofs;
+ int chars_drawn = 0;
+ bool with_outline = has_outline();
for (int i = 0; i < p_text.length(); i++) {
int width = get_char_size(p_text[i]).width;
@@ -70,7 +71,15 @@ void Font::draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, co
if (p_clip_w >= 0 && (ofs.x + width) > p_clip_w)
break; //clip
- ofs.x += draw_char(p_canvas_item, p_pos + ofs, p_text[i], p_text[i + 1], p_modulate);
+ ofs.x += draw_char(p_canvas_item, p_pos + ofs, p_text[i], p_text[i + 1], with_outline ? p_outline_modulate : p_modulate, with_outline);
+ ++chars_drawn;
+ }
+
+ if (has_outline()) {
+ ofs = Vector2(0, 0);
+ for (int i = 0; i < chars_drawn; i++) {
+ ofs.x += draw_char(p_canvas_item, p_pos + ofs, p_text[i], p_text[i + 1], p_modulate, false);
+ }
}
}
@@ -81,13 +90,14 @@ void Font::update_changes() {
void Font::_bind_methods() {
- ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "string", "modulate", "clip_w"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "string", "modulate", "clip_w", "outline_modulate"), &Font::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(-1), DEFVAL(Color(1, 1, 1)));
ClassDB::bind_method(D_METHOD("get_ascent"), &Font::get_ascent);
ClassDB::bind_method(D_METHOD("get_descent"), &Font::get_descent);
ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height);
ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint);
ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size);
- ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("has_outline"), &Font::has_outline);
+ ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate", "outline"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(false));
ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes);
}
@@ -494,23 +504,24 @@ Ref<BitmapFont> BitmapFont::get_fallback() const {
return fallback;
}
-float BitmapFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate) const {
+float BitmapFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, bool p_outline) const {
const Character *c = char_map.getptr(p_char);
if (!c) {
if (fallback.is_valid())
- return fallback->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate);
+ return fallback->draw_char(p_canvas_item, p_pos, p_char, p_next, p_modulate, p_outline);
return 0;
}
- Point2 cpos = p_pos;
- cpos.x += c->h_align;
- cpos.y -= ascent;
- cpos.y += c->v_align;
ERR_FAIL_COND_V(c->texture_idx < -1 || c->texture_idx >= textures.size(), 0);
- if (c->texture_idx != -1)
+ if (!p_outline && c->texture_idx != -1) {
+ Point2 cpos = p_pos;
+ cpos.x += c->h_align;
+ cpos.y -= ascent;
+ cpos.y += c->v_align;
VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx]->get_rid(), c->rect, p_modulate, false, RID(), false);
+ }
return get_char_size(p_char, p_next).width;
}
diff --git a/scene/resources/font.h b/scene/resources/font.h
index ae08890be3..4e295b6035 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -56,14 +56,55 @@ public:
virtual bool is_distance_field_hint() const = 0;
- void draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1) const;
- void draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate = Color(1, 1, 1)) const;
- virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1)) const = 0;
+ void draw(RID p_canvas_item, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1, const Color &p_outline_modulate = Color(1, 1, 1)) const;
+ void draw_halign(RID p_canvas_item, const Point2 &p_pos, HAlign p_align, float p_width, const String &p_text, const Color &p_modulate = Color(1, 1, 1), const Color &p_outline_modulate = Color(1, 1, 1)) const;
+
+ virtual bool has_outline() const { return false; }
+ virtual float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const = 0;
void update_changes();
Font();
};
+// Helper class to that draws outlines immediately and draws characters in its destructor.
+class FontDrawer {
+ const Ref<Font> &font;
+ Color outline_color;
+ bool has_outline;
+
+ struct PendingDraw {
+ RID canvas_item;
+ Point2 pos;
+ CharType chr;
+ CharType next;
+ Color modulate;
+ };
+
+ Vector<PendingDraw> pending_draws;
+
+public:
+ FontDrawer(const Ref<Font> &p_font, const Color &p_outline_color) :
+ font(p_font),
+ outline_color(p_outline_color) {
+ has_outline = p_font->has_outline();
+ }
+
+ float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1)) {
+ if (has_outline) {
+ PendingDraw draw = { p_canvas_item, p_pos, p_char, p_next, p_modulate };
+ pending_draws.push_back(draw);
+ }
+ return font->draw_char(p_canvas_item, p_pos, p_char, p_next, has_outline ? outline_color : p_modulate, has_outline);
+ }
+
+ ~FontDrawer() {
+ for (int i = 0; i < pending_draws.size(); ++i) {
+ const PendingDraw &draw = pending_draws[i];
+ font->draw_char(draw.canvas_item, draw.pos, draw.chr, draw.next, draw.modulate, false);
+ }
+ }
+};
+
class BitmapFont : public Font {
GDCLASS(BitmapFont, Font);
@@ -153,7 +194,7 @@ public:
void set_distance_field_hint(bool p_distance_field);
bool is_distance_field_hint() const;
- float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1)) const;
+ float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next = 0, const Color &p_modulate = Color(1, 1, 1), bool p_outline = false) const;
BitmapFont();
~BitmapFont();
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index a83ef198fb..5e7569586a 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -387,10 +387,12 @@ void SpatialMaterial::_update_shader() {
if (flags[FLAG_USE_VERTEX_LIGHTING]) {
code += ",vertex_lighting";
}
-
if (flags[FLAG_TRIPLANAR_USE_WORLD] && (flags[FLAG_UV1_USE_TRIPLANAR] || flags[FLAG_UV2_USE_TRIPLANAR])) {
code += ",world_vertex_coords";
}
+ if (flags[FLAG_DONT_RECEIVE_SHADOWS]) {
+ code += ",shadows_disabled";
+ }
code += ";\n";
code += "uniform vec4 albedo : hint_color;\n";
@@ -550,7 +552,7 @@ void SpatialMaterial::_update_shader() {
//handle animation
code += "\tint particle_total_frames = particles_anim_h_frames * particles_anim_v_frames;\n";
- code += "\tint particle_frame = int(INSTANCE_CUSTOM.y * float(particle_total_frames));\n";
+ code += "\tint particle_frame = int(INSTANCE_CUSTOM.z * float(particle_total_frames));\n";
code += "\tif (particles_anim_loop) particle_frame=clamp(particle_frame,0,particle_total_frames-1); else particle_frame=abs(particle_frame)%particle_total_frames;\n";
code += "\tUV /= vec2(float(particles_anim_h_frames),float(particles_anim_v_frames));\n";
code += "\tUV += vec2(float(particle_frame % particles_anim_h_frames) / float(particles_anim_h_frames),float(particle_frame / particles_anim_h_frames) / float(particles_anim_v_frames));\n";
@@ -1849,6 +1851,7 @@ void SpatialMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_world_triplanar"), "set_flag", "get_flag", FLAG_TRIPLANAR_USE_WORLD);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_fixed_size"), "set_flag", "get_flag", FLAG_FIXED_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_albedo_tex_force_srgb"), "set_flag", "get_flag", FLAG_ALBEDO_TEXTURE_FORCE_SRGB);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flags_do_not_receive_shadows"), "set_flag", "get_flag", FLAG_DONT_RECEIVE_SHADOWS);
ADD_GROUP("Vertex Color", "vertex_color");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_use_as_albedo"), "set_flag", "get_flag", FLAG_ALBEDO_FROM_VERTEX_COLOR);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR);
@@ -2038,6 +2041,7 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(FLAG_USE_ALPHA_SCISSOR);
BIND_ENUM_CONSTANT(FLAG_TRIPLANAR_USE_WORLD);
BIND_ENUM_CONSTANT(FLAG_ALBEDO_TEXTURE_FORCE_SRGB);
+ BIND_ENUM_CONSTANT(FLAG_DONT_RECEIVE_SHADOWS);
BIND_ENUM_CONSTANT(FLAG_MAX);
BIND_ENUM_CONSTANT(DIFFUSE_BURLEY);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 2c297cda41..ce733bfb8d 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -188,6 +188,7 @@ public:
FLAG_EMISSION_ON_UV2,
FLAG_USE_ALPHA_SCISSOR,
FLAG_ALBEDO_TEXTURE_FORCE_SRGB,
+ FLAG_DONT_RECEIVE_SHADOWS,
FLAG_MAX
};
@@ -236,7 +237,7 @@ private:
uint64_t blend_mode : 2;
uint64_t depth_draw_mode : 2;
uint64_t cull_mode : 2;
- uint64_t flags : 14;
+ uint64_t flags : 15;
uint64_t detail_blend_mode : 2;
uint64_t diffuse_mode : 3;
uint64_t specular_mode : 2;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 949ba12a4c..b0620d3363 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -222,7 +222,6 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
continue;
Array a = surface_get_arrays(i);
- int vcount = 0;
if (i == 0) {
arrays = a;
@@ -230,6 +229,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
index_accum += v.size();
} else {
+ int vcount = 0;
for (int j = 0; j < arrays.size(); j++) {
if (arrays[j].get_type() == Variant::NIL || a[j].get_type() == Variant::NIL) {
@@ -315,6 +315,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
}
}
+ ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>());
+
{
PoolVector<int>::Write ir;
PoolVector<int> indices = arrays[ARRAY_INDEX];
@@ -910,6 +912,7 @@ void ArrayMesh::surface_set_material(int p_idx, const Ref<Material> &p_material)
VisualServer::get_singleton()->mesh_surface_set_material(mesh, p_idx, p_material.is_null() ? RID() : p_material->get_rid());
_change_notify("material");
+ emit_changed();
}
void ArrayMesh::surface_set_name(int p_idx, const String &p_name) {
@@ -917,6 +920,7 @@ void ArrayMesh::surface_set_name(int p_idx, const String &p_name) {
ERR_FAIL_INDEX(p_idx, surfaces.size());
surfaces[p_idx].name = p_name;
+ emit_changed();
}
String ArrayMesh::surface_get_name(int p_idx) const {
@@ -929,6 +933,7 @@ void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVec
ERR_FAIL_INDEX(p_surface, surfaces.size());
VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data);
+ emit_changed();
}
void ArrayMesh::surface_set_custom_aabb(int p_idx, const AABB &p_aabb) {
@@ -936,6 +941,7 @@ void ArrayMesh::surface_set_custom_aabb(int p_idx, const AABB &p_aabb) {
ERR_FAIL_INDEX(p_idx, surfaces.size());
surfaces[p_idx].aabb = p_aabb;
// set custom aabb too?
+ emit_changed();
}
Ref<Material> ArrayMesh::surface_get_material(int p_idx) const {
@@ -984,6 +990,7 @@ void ArrayMesh::set_custom_aabb(const AABB &p_custom) {
custom_aabb = p_custom;
VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb);
+ emit_changed();
}
AABB ArrayMesh::get_custom_aabb() const {
@@ -1187,8 +1194,6 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
for (int j = 0; j < 3; j++) {
- int vertex_idx = gen_vertices[gen_indices[i + j]];
-
SurfaceTool::Vertex v = surfaces[surface].vertices[uv_index[gen_vertices[gen_indices[i + j]]].second];
if (surfaces[surface].format & ARRAY_FORMAT_COLOR) {
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index e8b7ecaf9a..a3fb068569 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -100,7 +100,7 @@ public:
ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3,
- ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
+ ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
};
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 3df9285bb6..846f6e356e 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -249,6 +249,8 @@ Node *SceneState::instance(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) {
+ value = value.duplicate(true); // Duplicate arrays and dictionaries for the editor
}
node->set(snames[nprops[j].name], value, &valid);
}
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 94c54c91d3..28aa6f1aa7 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -57,6 +57,31 @@ void PrimitiveMesh::_update() const {
}
}
+ if (flip_faces) {
+ PoolVector<Vector3> normals = arr[VS::ARRAY_NORMAL];
+ PoolVector<int> indices = arr[VS::ARRAY_INDEX];
+ if (normals.size() && indices.size()) {
+
+ {
+ int nc = normals.size();
+ PoolVector<Vector3>::Write w = normals.write();
+ for (int i = 0; i < nc; i++) {
+ w[i] = -w[i];
+ }
+ }
+
+ {
+ int ic = indices.size();
+ PoolVector<int>::Write w = indices.write();
+ for (int i = 0; i < ic; i += 3) {
+ SWAP(w[i + 0], w[i + 1]);
+ }
+ }
+ arr[VS::ARRAY_NORMAL] = normals;
+ arr[VS::ARRAY_INDEX] = indices;
+ }
+ }
+
// in with the new
VisualServer::get_singleton()->mesh_clear(mesh);
VisualServer::get_singleton()->mesh_add_surface_from_arrays(mesh, (VisualServer::PrimitiveType)primitive_type, arr);
@@ -65,6 +90,8 @@ void PrimitiveMesh::_update() const {
pending_request = false;
_clear_triangle_mesh();
+
+ const_cast<PrimitiveMesh *>(this)->emit_changed();
}
void PrimitiveMesh::_request_update() {
@@ -164,7 +191,15 @@ void PrimitiveMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mesh_arrays"), &PrimitiveMesh::get_mesh_arrays);
+ ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &PrimitiveMesh::set_custom_aabb);
+ ClassDB::bind_method(D_METHOD("get_custom_aabb"), &PrimitiveMesh::get_custom_aabb);
+
+ ClassDB::bind_method(D_METHOD("set_flip_faces", "flip_faces"), &PrimitiveMesh::set_flip_faces);
+ ClassDB::bind_method(D_METHOD("get_flip_faces"), &PrimitiveMesh::get_flip_faces);
+
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "SpatialMaterial,ShaderMaterial"), "set_material", "get_material");
+ ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, ""), "set_custom_aabb", "get_custom_aabb");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_faces"), "set_flip_faces", "get_flip_faces");
}
void PrimitiveMesh::set_material(const Ref<Material> &p_material) {
@@ -185,7 +220,30 @@ Array PrimitiveMesh::get_mesh_arrays() const {
return surface_get_arrays(0);
}
+void PrimitiveMesh::set_custom_aabb(const AABB &p_custom) {
+
+ custom_aabb = p_custom;
+ VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb);
+ emit_changed();
+}
+
+AABB PrimitiveMesh::get_custom_aabb() const {
+
+ return custom_aabb;
+}
+
+void PrimitiveMesh::set_flip_faces(bool p_enable) {
+ flip_faces = p_enable;
+ _request_update();
+}
+
+bool PrimitiveMesh::get_flip_faces() const {
+ return flip_faces;
+}
+
PrimitiveMesh::PrimitiveMesh() {
+
+ flip_faces = false;
// defaults
mesh = VisualServer::get_singleton()->mesh_create();
@@ -361,10 +419,10 @@ void CapsuleMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CapsuleMesh::set_rings);
ClassDB::bind_method(D_METHOD("get_rings"), &CapsuleMesh::get_rings);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "mid_height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_mid_height", "get_mid_height");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "mid_height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_mid_height", "get_mid_height");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings");
}
void CapsuleMesh::set_radius(const float p_radius) {
@@ -618,10 +676,10 @@ void CubeMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_subdivide_depth", "divisions"), &CubeMesh::set_subdivide_depth);
ClassDB::bind_method(D_METHOD("get_subdivide_depth"), &CubeMesh::get_subdivide_depth);
- ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_width", "get_subdivide_width");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_height", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_height", "get_subdivide_height");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_depth", "get_subdivide_depth");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "size"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_width", "get_subdivide_width");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_height", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_height", "get_subdivide_height");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_depth", "get_subdivide_depth");
}
void CubeMesh::set_size(const Vector3 &p_size) {
@@ -823,11 +881,11 @@ void CylinderMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rings", "rings"), &CylinderMesh::set_rings);
ClassDB::bind_method(D_METHOD("get_rings"), &CylinderMesh::get_rings);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "top_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_top_radius", "get_top_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "bottom_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_bottom_radius", "get_bottom_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_height", "get_height");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "top_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_top_radius", "get_top_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "bottom_radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_bottom_radius", "get_bottom_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings");
}
void CylinderMesh::set_top_radius(const float p_radius) {
@@ -959,8 +1017,8 @@ void PlaneMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_subdivide_depth"), &PlaneMesh::get_subdivide_depth);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_width", "get_subdivide_width");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_depth", "get_subdivide_depth");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_width", "get_subdivide_width");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_depth", "get_subdivide_depth");
}
void PlaneMesh::set_size(const Size2 &p_size) {
@@ -1225,9 +1283,9 @@ void PrismMesh::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "left_to_right", PROPERTY_HINT_RANGE, "-2.0,2.0,0.1"), "set_left_to_right", "get_left_to_right");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_width", "get_subdivide_width");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_height", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_height", "get_subdivide_height");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1"), "set_subdivide_depth", "get_subdivide_depth");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_width", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_width", "get_subdivide_width");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_height", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_height", "get_subdivide_height");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "subdivide_depth", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_subdivide_depth", "get_subdivide_depth");
}
void PrismMesh::set_left_to_right(const float p_left_to_right) {
@@ -1294,10 +1352,10 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
PoolVector<float> tangents;
PoolVector<Vector2> uvs;
- faces.resize(4);
- normals.resize(4);
- tangents.resize(4 * 4);
- uvs.resize(4);
+ faces.resize(6);
+ normals.resize(6);
+ tangents.resize(6 * 4);
+ uvs.resize(6);
Vector2 _size = Vector2(size.x / 2.0f, size.y / 2.0f);
@@ -1308,9 +1366,15 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
Vector3(_size.x, -_size.y, 0),
};
- for (int i = 0; i < 4; i++) {
+ static const int indices[6] = {
+ 0, 1, 2,
+ 0, 2, 3
+ };
- faces.set(i, quad_faces[i]);
+ for (int i = 0; i < 6; i++) {
+
+ int j = indices[i];
+ faces.set(i, quad_faces[j]);
normals.set(i, Vector3(0, 0, 1));
tangents.set(i * 4 + 0, 1.0);
tangents.set(i * 4 + 1, 0.0);
@@ -1324,14 +1388,14 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
Vector2(1, 1),
};
- uvs.set(i, quad_uv[i]);
+ uvs.set(i, quad_uv[j]);
}
p_arr[VS::ARRAY_VERTEX] = faces;
p_arr[VS::ARRAY_NORMAL] = normals;
p_arr[VS::ARRAY_TANGENT] = tangents;
p_arr[VS::ARRAY_TEX_UV] = uvs;
-};
+}
void QuadMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_size", "size"), &QuadMesh::set_size);
@@ -1340,7 +1404,7 @@ void QuadMesh::_bind_methods() {
}
QuadMesh::QuadMesh() {
- primitive_type = PRIMITIVE_TRIANGLE_FAN;
+ primitive_type = PRIMITIVE_TRIANGLES;
size = Size2(1.0, 1.0);
}
@@ -1441,10 +1505,10 @@ void SphereMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_is_hemisphere", "is_hemisphere"), &SphereMesh::set_is_hemisphere);
ClassDB::bind_method(D_METHOD("get_is_hemisphere"), &SphereMesh::get_is_hemisphere);
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_height", "get_height");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_radius", "get_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "0.001,100.0,0.001,or_greater"), "set_height", "get_height");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_radial_segments", "get_radial_segments");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1,or_greater"), "set_rings", "get_rings");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_hemisphere"), "set_is_hemisphere", "get_is_hemisphere");
}
diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h
index 94a7a055a3..a91aa09ffe 100644
--- a/scene/resources/primitive_meshes.h
+++ b/scene/resources/primitive_meshes.h
@@ -48,8 +48,10 @@ class PrimitiveMesh : public Mesh {
private:
RID mesh;
mutable AABB aabb;
+ AABB custom_aabb;
Ref<Material> material;
+ bool flip_faces;
mutable bool pending_request;
void _update() const;
@@ -81,6 +83,12 @@ public:
Array get_mesh_arrays() const;
+ void set_custom_aabb(const AABB &p_custom);
+ AABB get_custom_aabb() const;
+
+ void set_flip_faces(bool p_enable);
+ bool get_flip_faces() const;
+
PrimitiveMesh();
~PrimitiveMesh();
};
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 91c801c016..597866eb74 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -1445,8 +1445,15 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
static String _valprop(const String &p_name) {
- if (p_name.find("\"") != -1 || p_name.find("=") != -1 || p_name.find(" ") != -1)
- return "\"" + p_name.c_escape_multiline() + "\"";
+ // Escape and quote strings with extended ASCII or further Unicode characters
+ // as well as '"', '=' or ' ' (32)
+ const CharType *cstr = p_name.c_str();
+ for (int i = 0; cstr[i]; i++) {
+ if (cstr[i] == '=' || cstr[i] == '"' || cstr[i] < 33 || cstr[i] > 126) {
+ return "\"" + p_name.c_escape_multiline() + "\"";
+ }
+ }
+ // Keep as is
return p_name;
}
@@ -1506,7 +1513,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
title += "load_steps=" + itos(load_steps) + " ";
}
title += "format=" + itos(FORMAT_VERSION) + "";
- //title+="engine_version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\"";
f->store_string(title);
f->store_line("]\n"); //one empty line
@@ -1666,7 +1672,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
f->store_string(vars);
}
- f->store_line("]\n");
+ f->store_line("]");
for (int j = 0; j < state->get_node_property_count(i); j++) {
@@ -1676,10 +1682,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
f->store_string(_valprop(String(state->get_node_property_name(i, j))) + " = " + vars + "\n");
}
- if (state->get_node_property_count(i)) {
- //add space
- f->store_line(String());
- }
+ f->store_line(String());
}
for (int i = 0; i < state->get_connection_count(); i++) {
@@ -1702,14 +1705,12 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
f->store_string(" binds= " + vars);
}
- f->store_line("]\n");
+ f->store_line("]");
}
- f->store_line(String());
-
Vector<NodePath> editable_instances = state->get_editable_instances();
for (int i = 0; i < editable_instances.size(); i++) {
- f->store_line("[editable path=\"" + editable_instances[i].operator String() + "\"]");
+ f->store_line("\n[editable path=\"" + editable_instances[i].operator String() + "\"]");
}
}
diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h
index ed655b8a93..7eb0406bd8 100644
--- a/scene/resources/shape_2d.h
+++ b/scene/resources/shape_2d.h
@@ -45,7 +45,7 @@ protected:
Shape2D(const RID &p_rid);
public:
- virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return true; }
+ virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return get_rect().has_point(p_point); }
void set_custom_solver_bias(real_t p_bias);
real_t get_custom_solver_bias() const;
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index f256e0397d..ebad00b068 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -101,23 +101,27 @@ StyleBox::StyleBox() {
}
}
-void StyleBoxTexture::set_texture(RES p_texture) {
+void StyleBoxTexture::set_texture(Ref<Texture> p_texture) {
if (texture == p_texture)
return;
texture = p_texture;
- region_rect = Rect2(Point2(), texture->get_size());
+ if (p_texture.is_null()) {
+ region_rect = Rect2(0, 0, 0, 0);
+ } else {
+ region_rect = Rect2(Point2(), texture->get_size());
+ }
emit_signal("texture_changed");
emit_changed();
_change_notify("texture");
}
-RES StyleBoxTexture::get_texture() const {
+Ref<Texture> StyleBoxTexture::get_texture() const {
return texture;
}
-void StyleBoxTexture::set_normal_map(RES p_normal_map) {
+void StyleBoxTexture::set_normal_map(Ref<Texture> p_normal_map) {
if (normal_map == p_normal_map)
return;
@@ -125,15 +129,24 @@ void StyleBoxTexture::set_normal_map(RES p_normal_map) {
emit_changed();
}
-RES StyleBoxTexture::get_normal_map() const {
+Ref<Texture> StyleBoxTexture::get_normal_map() const {
return normal_map;
}
void StyleBoxTexture::set_margin_size(Margin p_margin, float p_size) {
+ ERR_FAIL_INDEX(p_margin, 4);
+
margin[p_margin] = p_size;
emit_changed();
+ static const char *margin_prop[4] = {
+ "content_margin_left",
+ "content_margin_top",
+ "content_margin_right",
+ "content_margin_bottom",
+ };
+ _change_notify(margin_prop[p_margin]);
}
float StyleBoxTexture::get_margin_size(Margin p_margin) const {
@@ -182,7 +195,7 @@ Size2 StyleBoxTexture::get_center_size() const {
if (texture.is_null())
return Size2();
- return texture->get_size() - get_minimum_size();
+ return region_rect.size - get_minimum_size();
}
void StyleBoxTexture::set_expand_margin_size(Margin p_expand_margin, float p_size) {
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index fb79aa360e..c1d84fe19f 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -112,11 +112,11 @@ public:
void set_region_rect(const Rect2 &p_region_rect);
Rect2 get_region_rect() const;
- void set_texture(RES p_texture);
- RES get_texture() const;
+ void set_texture(Ref<Texture> p_texture);
+ Ref<Texture> get_texture() const;
- void set_normal_map(RES p_normal_map);
- RES get_normal_map() const;
+ void set_normal_map(Ref<Texture> p_normal_map);
+ Ref<Texture> get_normal_map() const;
void set_draw_center(bool p_enabled);
bool is_draw_center_enabled() const;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 07c1036a10..5a42873d79 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -861,7 +861,7 @@ void SurfaceTool::generate_tangents() {
}
}
-void SurfaceTool::generate_normals() {
+void SurfaceTool::generate_normals(bool p_flip) {
ERR_FAIL_COND(primitive != Mesh::PRIMITIVE_TRIANGLES);
@@ -887,7 +887,11 @@ void SurfaceTool::generate_normals() {
ERR_FAIL_COND(!v[2]);
E = v[2]->next();
- Vector3 normal = Plane(v[0]->get().vertex, v[1]->get().vertex, v[2]->get().vertex).normal;
+ Vector3 normal;
+ if (!p_flip)
+ normal = Plane(v[0]->get().vertex, v[1]->get().vertex, v[2]->get().vertex).normal;
+ else
+ normal = Plane(v[2]->get().vertex, v[1]->get().vertex, v[0]->get().vertex).normal;
if (smooth) {
@@ -980,7 +984,7 @@ void SurfaceTool::_bind_methods() {
ClassDB::bind_method(D_METHOD("index"), &SurfaceTool::index);
ClassDB::bind_method(D_METHOD("deindex"), &SurfaceTool::deindex);
- ClassDB::bind_method(D_METHOD("generate_normals"), &SurfaceTool::generate_normals);
+ ClassDB::bind_method(D_METHOD("generate_normals", "flip"), &SurfaceTool::generate_normals, DEFVAL(false));
ClassDB::bind_method(D_METHOD("generate_tangents"), &SurfaceTool::generate_tangents);
ClassDB::bind_method(D_METHOD("add_to_format", "flags"), &SurfaceTool::add_to_format);
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index 7a9aa349bb..459d399380 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -116,7 +116,7 @@ public:
void index();
void deindex();
- void generate_normals();
+ void generate_normals(bool p_flip = false);
void generate_tangents();
void add_to_format(int p_flags) { format |= p_flags; }
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index c0f6756fd1..54f5aea160 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -76,7 +76,9 @@ void Texture::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &Texture::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_data"), &Texture::get_data);
+ ADD_GROUP("Flags", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_flags", "get_flags");
+ ADD_GROUP("", "");
BIND_ENUM_CONSTANT(FLAGS_DEFAULT);
BIND_ENUM_CONSTANT(FLAG_MIPMAPS);
@@ -220,12 +222,15 @@ Image::Format ImageTexture::get_format() const {
return format;
}
-void ImageTexture::load(const String &p_path) {
+Error ImageTexture::load(const String &p_path) {
Ref<Image> img;
img.instance();
- img->load(p_path);
- create_from_image(img);
+ Error err = img->load(p_path);
+ if (err == OK) {
+ create_from_image(img);
+ }
+ return err;
}
void ImageTexture::set_data(const Ref<Image> &p_image) {
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 93d7ec4ef9..d81fd3b19b 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -124,7 +124,7 @@ public:
void set_flags(uint32_t p_flags);
uint32_t get_flags() const;
Image::Format get_format() const;
- void load(const String &p_path);
+ Error load(const String &p_path);
void set_data(const Ref<Image> &p_image);
Ref<Image> get_data() const;
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index c23f237c75..e0d4038e7e 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -55,12 +55,12 @@ class Theme : public Resource {
void _unref_font(Ref<Font> p_sc);
void _emit_theme_changed();
- HashMap<StringName, HashMap<StringName, Ref<Texture>, StringNameHasher>, StringNameHasher> icon_map;
- HashMap<StringName, HashMap<StringName, Ref<StyleBox>, StringNameHasher>, StringNameHasher> style_map;
- HashMap<StringName, HashMap<StringName, Ref<Font>, StringNameHasher>, StringNameHasher> font_map;
- HashMap<StringName, HashMap<StringName, Ref<Shader>, StringNameHasher>, StringNameHasher> shader_map;
- HashMap<StringName, HashMap<StringName, Color, StringNameHasher>, StringNameHasher> color_map;
- HashMap<StringName, HashMap<StringName, int, StringNameHasher>, StringNameHasher> constant_map;
+ HashMap<StringName, HashMap<StringName, Ref<Texture> > > icon_map;
+ HashMap<StringName, HashMap<StringName, Ref<StyleBox> > > style_map;
+ HashMap<StringName, HashMap<StringName, Ref<Font> > > font_map;
+ HashMap<StringName, HashMap<StringName, Ref<Shader> > > shader_map;
+ HashMap<StringName, HashMap<StringName, Color> > color_map;
+ HashMap<StringName, HashMap<StringName, int> > constant_map;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 4463f98b07..58057cda0c 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -142,6 +142,8 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
tile_set_navigation_polygon(id, p_value);
else if (what == "navigation_offset")
tile_set_navigation_polygon_offset(id, p_value);
+ else if (what == "z_index")
+ tile_set_z_index(id, p_value);
else
return false;
@@ -239,6 +241,8 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = tile_get_navigation_polygon(id);
else if (what == "navigation_offset")
r_ret = tile_get_navigation_polygon_offset(id);
+ else if (what == "z_index")
+ r_ret = tile_get_z_index(id);
else
return false;
@@ -260,7 +264,7 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::RECT2, pre + "region"));
p_list->push_back(PropertyInfo(Variant::INT, pre + "tile_mode", PROPERTY_HINT_ENUM, "SINGLE_TILE,AUTO_TILE"));
if (tile_get_tile_mode(id) == AUTO_TILE) {
- p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/bitmask_mode", PROPERTY_HINT_ENUM, "2X2,3X3", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
+ p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/bitmask_mode", PROPERTY_HINT_ENUM, "2X2,3X3 (minimal),3X3", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/bitmask_flags", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/icon_coordinate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));
@@ -278,6 +282,7 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_EDITOR));
p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::INT, pre + "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"));
}
}
@@ -347,6 +352,7 @@ void TileSet::tile_set_modulate(int p_id, const Color &p_modulate) {
ERR_FAIL_COND(!tile_map.has(p_id));
tile_map[p_id].modulate = p_modulate;
emit_changed();
+ _change_notify("modulate");
}
Color TileSet::tile_get_modulate(int p_id) const {
@@ -747,6 +753,19 @@ Vector<TileSet::ShapeData> TileSet::tile_get_shapes(int p_id) const {
return tile_map[p_id].shapes_data;
}
+int TileSet::tile_get_z_index(int p_id) const {
+
+ ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
+ return tile_map[p_id].z_index;
+}
+
+void TileSet::tile_set_z_index(int p_id, int p_z_index) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
+ tile_map[p_id].z_index = p_z_index;
+ emit_changed();
+}
+
void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
ERR_FAIL_COND(!tile_map.has(p_id));
@@ -918,6 +937,8 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("tile_get_shape_count", "id"), &TileSet::tile_get_shape_count);
ClassDB::bind_method(D_METHOD("tile_set_shapes", "id", "shapes"), &TileSet::_tile_set_shapes);
ClassDB::bind_method(D_METHOD("tile_get_shapes", "id"), &TileSet::_tile_get_shapes);
+ ClassDB::bind_method(D_METHOD("tile_set_tile_mode", "id", "tilemode"), &TileSet::tile_set_tile_mode);
+ ClassDB::bind_method(D_METHOD("tile_get_tile_mode", "id"), &TileSet::tile_get_tile_mode);
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon", "id", "navigation_polygon"), &TileSet::tile_set_navigation_polygon);
ClassDB::bind_method(D_METHOD("tile_get_navigation_polygon", "id"), &TileSet::tile_get_navigation_polygon);
ClassDB::bind_method(D_METHOD("tile_set_navigation_polygon_offset", "id", "navigation_polygon_offset"), &TileSet::tile_set_navigation_polygon_offset);
@@ -926,6 +947,8 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("tile_get_light_occluder", "id"), &TileSet::tile_get_light_occluder);
ClassDB::bind_method(D_METHOD("tile_set_occluder_offset", "id", "occluder_offset"), &TileSet::tile_set_occluder_offset);
ClassDB::bind_method(D_METHOD("tile_get_occluder_offset", "id"), &TileSet::tile_get_occluder_offset);
+ ClassDB::bind_method(D_METHOD("tile_set_z_index", "id", "z_index"), &TileSet::tile_set_z_index);
+ ClassDB::bind_method(D_METHOD("tile_get_z_index", "id"), &TileSet::tile_get_z_index);
ClassDB::bind_method(D_METHOD("remove_tile", "id"), &TileSet::remove_tile);
ClassDB::bind_method(D_METHOD("clear"), &TileSet::clear);
@@ -937,6 +960,7 @@ void TileSet::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
BIND_ENUM_CONSTANT(BITMASK_2X2);
+ BIND_ENUM_CONSTANT(BITMASK_3X3_MINIMAL);
BIND_ENUM_CONSTANT(BITMASK_3X3);
BIND_ENUM_CONSTANT(BIND_TOPLEFT);
@@ -947,6 +971,10 @@ void TileSet::_bind_methods() {
BIND_ENUM_CONSTANT(BIND_BOTTOMLEFT);
BIND_ENUM_CONSTANT(BIND_BOTTOM);
BIND_ENUM_CONSTANT(BIND_BOTTOMRIGHT);
+
+ BIND_ENUM_CONSTANT(SINGLE_TILE);
+ BIND_ENUM_CONSTANT(AUTO_TILE);
+ BIND_ENUM_CONSTANT(ANIMATED_TILE);
}
TileSet::TileSet() {
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 46f34b6252..ec635ee5cc 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -56,6 +56,7 @@ public:
enum BitmaskMode {
BITMASK_2X2,
+ BITMASK_3X3_MINIMAL,
BITMASK_3X3
};
@@ -113,11 +114,13 @@ private:
Color modulate;
TileMode tile_mode;
AutotileData autotile_data;
+ int z_index;
// Default modulate for back-compat
explicit TileData() :
tile_mode(SINGLE_TILE),
- modulate(1, 1, 1) {}
+ modulate(1, 1, 1),
+ z_index(0) {}
};
Map<int, TileData> tile_map;
@@ -220,6 +223,9 @@ public:
Ref<NavigationPolygon> autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const;
const Map<Vector2, Ref<NavigationPolygon> > &autotile_get_navigation_map(int p_id) const;
+ void tile_set_z_index(int p_id, int p_z_index);
+ int tile_get_z_index(int p_id) const;
+
void remove_tile(int p_id);
bool has_tile(int p_id) const;
@@ -238,5 +244,6 @@ public:
VARIANT_ENUM_CAST(TileSet::AutotileBindings);
VARIANT_ENUM_CAST(TileSet::BitmaskMode);
+VARIANT_ENUM_CAST(TileSet::TileMode);
#endif // TILE_SET_H
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index fdce0eb2b6..bf765385d0 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -51,6 +51,7 @@ SceneStringNames::SceneStringNames() {
tree_entered = StaticCString::create("tree_entered");
tree_exiting = StaticCString::create("tree_exiting");
tree_exited = StaticCString::create("tree_exited");
+ ready = StaticCString::create("ready");
item_rect_changed = StaticCString::create("item_rect_changed");
size_flags_changed = StaticCString::create("size_flags_changed");
minimum_size_changed = StaticCString::create("minimum_size_changed");
@@ -186,6 +187,8 @@ SceneStringNames::SceneStringNames() {
node_configuration_warning_changed = StaticCString::create("node_configuration_warning_changed");
+ output = StaticCString::create("output");
+
path_pp = NodePath("..");
_default = StaticCString::create("default");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 63a9a5db4d..b88cf7d8d7 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -71,6 +71,7 @@ public:
StringName tree_entered;
StringName tree_exiting;
StringName tree_exited;
+ StringName ready;
StringName size_flags_changed;
StringName minimum_size_changed;
StringName sleeping_state_changed;
@@ -198,6 +199,8 @@ public:
StringName node_configuration_warning_changed;
+ StringName output;
+
enum {
MAX_MATERIALS = 32
};
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index 8620b182df..f48bedbdac 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -44,6 +44,7 @@ void ARVRServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_world_scale"), &ARVRServer::set_world_scale);
ClassDB::bind_method(D_METHOD("get_reference_frame"), &ARVRServer::get_reference_frame);
ClassDB::bind_method(D_METHOD("center_on_hmd", "rotation_mode", "keep_height"), &ARVRServer::center_on_hmd);
+ ClassDB::bind_method(D_METHOD("get_hmd_transform"), &ARVRServer::get_hmd_transform);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "world_scale"), "set_world_scale", "get_world_scale");
@@ -54,8 +55,15 @@ void ARVRServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tracker_count"), &ARVRServer::get_tracker_count);
ClassDB::bind_method(D_METHOD("get_tracker", "idx"), &ARVRServer::get_tracker);
+ ClassDB::bind_method(D_METHOD("get_primary_interface"), &ARVRServer::get_primary_interface);
ClassDB::bind_method(D_METHOD("set_primary_interface", "interface"), &ARVRServer::set_primary_interface);
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "primary_interface"), "set_primary_interface", "get_primary_interface");
+
+ ClassDB::bind_method(D_METHOD("get_last_process_usec"), &ARVRServer::get_last_process_usec);
+ ClassDB::bind_method(D_METHOD("get_last_commit_usec"), &ARVRServer::get_last_commit_usec);
+ ClassDB::bind_method(D_METHOD("get_last_frame_usec"), &ARVRServer::get_last_frame_usec);
+
BIND_ENUM_CONSTANT(TRACKER_CONTROLLER);
BIND_ENUM_CONSTANT(TRACKER_BASESTATION);
BIND_ENUM_CONSTANT(TRACKER_ANCHOR);
@@ -132,6 +140,14 @@ void ARVRServer::center_on_hmd(RotationMode p_rotation_mode, bool p_keep_height)
};
};
+Transform ARVRServer::get_hmd_transform() {
+ Transform hmd_transform;
+ if (primary_interface != NULL) {
+ hmd_transform = primary_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, hmd_transform);
+ };
+ return hmd_transform;
+};
+
void ARVRServer::add_interface(const Ref<ARVRInterface> &p_interface) {
ERR_FAIL_COND(p_interface.is_null());
@@ -314,6 +330,42 @@ void ARVRServer::clear_primary_interface_if(const Ref<ARVRInterface> &p_primary_
};
};
+uint64_t ARVRServer::get_last_process_usec() {
+ return last_process_usec;
+};
+
+uint64_t ARVRServer::get_last_commit_usec() {
+ return last_commit_usec;
+};
+
+uint64_t ARVRServer::get_last_frame_usec() {
+ return last_frame_usec;
+};
+
+void ARVRServer::_process() {
+ /* called from visual_server_viewport.draw_viewports right before we start drawing our viewports */
+
+ /* mark for our frame timing */
+ last_process_usec = OS::get_singleton()->get_ticks_usec();
+
+ /* process all active interfaces */
+ for (int i = 0; i < interfaces.size(); i++) {
+ if (!interfaces[i].is_valid()) {
+ // ignore, not a valid reference
+ } else if (interfaces[i]->is_initialized()) {
+ interfaces[i]->process();
+ };
+ };
+};
+
+void ARVRServer::_mark_commit() {
+ /* time this */
+ last_commit_usec = OS::get_singleton()->get_ticks_usec();
+
+ /* now store our difference as we may overwrite last_process_usec before this is accessed */
+ last_frame_usec = last_commit_usec - last_process_usec;
+};
+
ARVRServer::ARVRServer() {
singleton = this;
world_scale = 1.0;
diff --git a/servers/arvr_server.h b/servers/arvr_server.h
index 63b7edc73b..1f4d84fe19 100644
--- a/servers/arvr_server.h
+++ b/servers/arvr_server.h
@@ -31,6 +31,7 @@
#ifndef ARVR_SERVER_H
#define ARVR_SERVER_H
+#include "os/os.h"
#include "os/thread_safe.h"
#include "reference.h"
#include "rid.h"
@@ -84,6 +85,10 @@ private:
Transform world_origin; /* our world origin point, maps a location in our virtual world to the origin point in our real world tracking volume */
Transform reference_frame; /* our reference frame */
+ uint64_t last_process_usec; /* for frame timing, usec when we did our processing */
+ uint64_t last_commit_usec; /* for frame timing, usec when we finished committing both eyes */
+ uint64_t last_frame_usec; /* time it took between process and commiting, we should probably average this over the last x frames */
+
protected:
static ARVRServer *singleton;
@@ -134,6 +139,11 @@ public:
void center_on_hmd(RotationMode p_rotation_mode, bool p_keep_height);
/*
+ get_hmd_transform gets our hmd transform (centered between eyes) with most up to date tracking, relative to the origin
+ */
+ Transform get_hmd_transform();
+
+ /*
Interfaces are objects that 'glue' Godot to an AR or VR SDK such as the Oculus SDK, OpenVR, OpenHMD, etc.
*/
void add_interface(const Ref<ARVRInterface> &p_interface);
@@ -163,6 +173,13 @@ public:
ARVRPositionalTracker *get_tracker(int p_index) const;
ARVRPositionalTracker *find_by_type_and_id(TrackerType p_tracker_type, int p_tracker_id) const;
+ uint64_t get_last_process_usec();
+ uint64_t get_last_commit_usec();
+ uint64_t get_last_frame_usec();
+
+ void _process();
+ void _mark_commit();
+
ARVRServer();
~ARVRServer();
};
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 0ad30987e7..113f23f8f2 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -89,6 +89,7 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale,
}
}
}
+
////////////////////////////////
void AudioStream::_bind_methods() {
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index fda4fc2ccc..3312ce1ff6 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -31,6 +31,7 @@
#ifndef AUDIO_STREAM_H
#define AUDIO_STREAM_H
+#include "image.h"
#include "resource.h"
#include "servers/audio/audio_filter_sw.h"
#include "servers/audio_server.h"
diff --git a/servers/audio/effects/audio_effect_compressor.cpp b/servers/audio/effects/audio_effect_compressor.cpp
index 0252b2f341..8c70b51f8d 100644
--- a/servers/audio/effects/audio_effect_compressor.cpp
+++ b/servers/audio/effects/audio_effect_compressor.cpp
@@ -236,7 +236,7 @@ void AudioEffectCompressor::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "attack_us", PROPERTY_HINT_RANGE, "20,2000,1"), "set_attack_us", "get_attack_us");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "release_ms", PROPERTY_HINT_RANGE, "20,2000,1"), "set_release_ms", "get_release_ms");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "mix", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_mix", "get_mix");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "sidechain", PROPERTY_HINT_ENUM), "set_sidechain", "get_sidechain");
+ ADD_PROPERTY(PropertyInfo(Variant::STRING, "sidechain", PROPERTY_HINT_ENUM), "set_sidechain", "get_sidechain");
}
AudioEffectCompressor::AudioEffectCompressor() {
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 783788a6a1..f2df7119e7 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -101,6 +101,18 @@ int AudioDriver::get_total_channels_by_speaker_mode(AudioDriver::SpeakerMode p_m
ERR_FAIL_V(2);
}
+Array AudioDriver::get_device_list() {
+ Array list;
+
+ list.push_back("Default");
+
+ return list;
+}
+
+String AudioDriver::get_device() {
+ return "Default";
+}
+
AudioDriver::AudioDriver() {
_last_mix_time = 0;
@@ -172,6 +184,12 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
int todo = p_frames;
+ if (channel_count != get_channel_count()) {
+ // Amount of channels changed due to a device change
+ // reinitialize the buses channels and buffers
+ init_channels_and_buffers();
+ }
+
while (todo) {
if (to_mix == 0) {
@@ -216,29 +234,6 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
todo -= to_copy;
to_mix -= to_copy;
}
-
-#ifdef DEBUG_ENABLED
- if (OS::get_singleton() && OS::get_singleton()->is_stdout_verbose()) {
- static uint64_t first_ticks = 0;
- static uint64_t last_ticks = 0;
- static uint64_t ticks = 0;
- static int count = 0;
- static int total = 0;
-
- ticks = OS::get_singleton()->get_ticks_msec();
- if ((ticks - first_ticks) > 10 * 1000 && count > 0) {
- print_line("Audio Driver " + String(AudioDriver::get_singleton()->get_name()) + " average latency: " + itos(total / count) + "ms (frame=" + itos(p_frames) + ")");
- first_ticks = ticks;
- total = 0;
- count = 0;
- }
-
- total += ticks - last_ticks;
- count++;
-
- last_ticks = ticks;
- }
-#endif
}
void AudioServer::_mix_step() {
@@ -485,8 +480,8 @@ void AudioServer::set_bus_count(int p_count) {
}
buses[i] = memnew(Bus);
- buses[i]->channels.resize(get_channel_count());
- for (int j = 0; j < get_channel_count(); j++) {
+ buses[i]->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
buses[i]->channels[j].buffer.resize(buffer_size);
}
buses[i]->name = attempt;
@@ -518,6 +513,8 @@ void AudioServer::remove_bus(int p_index) {
memdelete(buses[p_index]);
buses.remove(p_index);
unlock();
+
+ emit_signal("bus_layout_changed");
}
void AudioServer::add_bus(int p_at_pos) {
@@ -555,8 +552,8 @@ void AudioServer::add_bus(int p_at_pos) {
}
Bus *bus = memnew(Bus);
- bus->channels.resize(get_channel_count());
- for (int j = 0; j < get_channel_count(); j++) {
+ bus->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
bus->channels[j].buffer.resize(buffer_size);
}
bus->name = attempt;
@@ -571,6 +568,8 @@ void AudioServer::add_bus(int p_at_pos) {
buses.push_back(bus);
else
buses.insert(p_at_pos, bus);
+
+ emit_signal("bus_layout_changed");
}
void AudioServer::move_bus(int p_bus, int p_to_pos) {
@@ -593,6 +592,8 @@ void AudioServer::move_bus(int p_bus, int p_to_pos) {
} else {
buses.insert(p_to_pos - 1, bus);
}
+
+ emit_signal("bus_layout_changed");
}
int AudioServer::get_bus_count() const {
@@ -854,17 +855,29 @@ bool AudioServer::is_bus_channel_active(int p_bus, int p_channel) const {
return buses[p_bus]->channels[p_channel].active;
}
+void AudioServer::init_channels_and_buffers() {
+ channel_count = get_channel_count();
+ temp_buffer.resize(channel_count);
+
+ for (int i = 0; i < temp_buffer.size(); i++) {
+ temp_buffer[i].resize(buffer_size);
+ }
+
+ for (int i = 0; i < buses.size(); i++) {
+ buses[i]->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
+ buses[i]->channels[j].buffer.resize(buffer_size);
+ }
+ }
+}
+
void AudioServer::init() {
channel_disable_threshold_db = GLOBAL_DEF("audio/channel_disable_threshold_db", -60.0);
channel_disable_frames = float(GLOBAL_DEF("audio/channel_disable_time", 2.0)) * get_mix_rate();
buffer_size = 1024; //hardcoded for now
- temp_buffer.resize(get_channel_count());
-
- for (int i = 0; i < temp_buffer.size(); i++) {
- temp_buffer[i].resize(buffer_size);
- }
+ init_channels_and_buffers();
mix_count = 0;
set_bus_count(1);
@@ -903,9 +916,6 @@ void AudioServer::finish() {
buses.clear();
}
-void AudioServer::update() {
-}
-
/* MISC config */
void AudioServer::lock() {
@@ -1046,8 +1056,8 @@ void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout) {
bus_map[bus->name] = bus;
buses[i] = bus;
- buses[i]->channels.resize(get_channel_count());
- for (int j = 0; j < get_channel_count(); j++) {
+ buses[i]->channels.resize(channel_count);
+ for (int j = 0; j < channel_count; j++) {
buses[i]->channels[j].buffer.resize(buffer_size);
}
_update_bus_effects(i);
@@ -1084,6 +1094,21 @@ Ref<AudioBusLayout> AudioServer::generate_bus_layout() const {
return state;
}
+Array AudioServer::get_device_list() {
+
+ return AudioDriver::get_singleton()->get_device_list();
+}
+
+String AudioServer::get_device() {
+
+ return AudioDriver::get_singleton()->get_device();
+}
+
+void AudioServer::set_device(String device) {
+
+ AudioDriver::get_singleton()->set_device(device);
+}
+
void AudioServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bus_count", "amount"), &AudioServer::set_bus_count);
@@ -1130,6 +1155,9 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_speaker_mode"), &AudioServer::get_speaker_mode);
ClassDB::bind_method(D_METHOD("get_mix_rate"), &AudioServer::get_mix_rate);
+ ClassDB::bind_method(D_METHOD("get_device_list"), &AudioServer::get_device_list);
+ ClassDB::bind_method(D_METHOD("get_device"), &AudioServer::get_device);
+ ClassDB::bind_method(D_METHOD("set_device"), &AudioServer::set_device);
ClassDB::bind_method(D_METHOD("set_bus_layout", "bus_layout"), &AudioServer::set_bus_layout);
ClassDB::bind_method(D_METHOD("generate_bus_layout"), &AudioServer::generate_bus_layout);
@@ -1148,6 +1176,7 @@ AudioServer::AudioServer() {
audio_data_max_mem = 0;
audio_data_lock = Mutex::create();
mix_frames = 0;
+ channel_count = 0;
to_mix = 0;
}
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 188d38db94..b7fcd9c093 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -70,6 +70,9 @@ public:
virtual void start() = 0;
virtual int get_mix_rate() const = 0;
virtual SpeakerMode get_speaker_mode() const = 0;
+ virtual Array get_device_list();
+ virtual String get_device();
+ virtual void set_device(String device) {}
virtual void lock() = 0;
virtual void unlock() = 0;
virtual void finish() = 0;
@@ -130,6 +133,7 @@ private:
float channel_disable_threshold_db;
uint32_t channel_disable_frames;
+ int channel_count;
int to_mix;
struct Bus {
@@ -186,6 +190,8 @@ private:
Mutex *audio_data_lock;
+ void init_channels_and_buffers();
+
void _mix_step();
struct CallbackItem {
@@ -267,7 +273,6 @@ public:
virtual void init();
virtual void finish();
- virtual void update();
virtual void load_default_bus_layout();
/* MISC config */
@@ -297,6 +302,10 @@ public:
void set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout);
Ref<AudioBusLayout> generate_bus_layout() const;
+ Array get_device_list();
+ String get_device();
+ void set_device(String device);
+
AudioServer();
virtual ~AudioServer();
};
diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp
index 882d201f61..2a6a9e08ae 100644
--- a/servers/physics/body_pair_sw.cpp
+++ b/servers/physics/body_pair_sw.cpp
@@ -78,6 +78,7 @@ void BodyPairSW::contact_added_callback(const Vector3 &p_point_A, const Vector3
contact.local_A = local_A;
contact.local_B = local_B;
contact.normal = (p_point_A - p_point_B).normalized();
+ contact.mass_normal = 0; // will be computed in setup()
// attempt to determine if the contact will be reused
real_t contact_recycle_radius = space->get_contact_recycle_radius();
diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h
index f5d32e56a0..dee28bb6df 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics/collision_object_sw.h
@@ -37,7 +37,8 @@
#include "shape_sw.h"
#ifdef DEBUG_ENABLED
-#define MAX_OBJECT_DISTANCE 10000000.0
+#define MAX_OBJECT_DISTANCE 3.1622776601683791e+18
+
#define MAX_OBJECT_DISTANCE_X2 (MAX_OBJECT_DISTANCE * MAX_OBJECT_DISTANCE)
#endif
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp
index eefb0f0396..e587485fcb 100644
--- a/servers/physics/collision_solver_sat.cpp
+++ b/servers/physics/collision_solver_sat.cpp
@@ -341,26 +341,26 @@ public:
min_B -= (max_A - min_A) * 0.5;
max_B += (max_A - min_A) * 0.5;
- real_t dmin = min_B - (min_A + max_A) * 0.5;
- real_t dmax = max_B - (min_A + max_A) * 0.5;
+ min_B -= (min_A + max_A) * 0.5;
+ max_B -= (min_A + max_A) * 0.5;
- if (dmin > 0.0 || dmax < 0.0) {
+ if (min_B > 0.0 || max_B < 0.0) {
separator_axis = axis;
return false; // doesn't contain 0
}
//use the smallest depth
- dmin = Math::abs(dmin);
+ min_B = -min_B;
- if (dmax < dmin) {
- if (dmax < best_depth) {
- best_depth = dmax;
+ if (max_B < min_B) {
+ if (max_B < best_depth) {
+ best_depth = max_B;
best_axis = axis;
}
} else {
- if (dmin < best_depth) {
- best_depth = dmin;
+ if (min_B < best_depth) {
+ best_depth = min_B;
best_axis = -axis; // keep it as A axis
}
}
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index 7f7f9f4f98..7be818b23c 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -240,7 +240,7 @@ public:
_FORCE_INLINE_ real_t get_height() const { return height; }
_FORCE_INLINE_ real_t get_radius() const { return radius; }
- virtual real_t get_area() { return 4.0 / 3.0 * Math_PI * radius * radius * radius + height * Math_PI * radius * radius; }
+ virtual real_t get_area() const { return 4.0 / 3.0 * Math_PI * radius * radius * radius + height * Math_PI * radius * radius; }
virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CAPSULE; }
diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp
index f51882b5ee..61c0e0063f 100644
--- a/servers/physics_2d/body_pair_2d_sw.cpp
+++ b/servers/physics_2d/body_pair_2d_sw.cpp
@@ -62,6 +62,7 @@ void BodyPair2DSW::_contact_added_callback(const Vector2 &p_point_A, const Vecto
contact.local_B = local_B;
contact.reused = true;
contact.normal = (p_point_A - p_point_B).normalized();
+ contact.mass_normal = 0; // will be computed in setup()
// attempt to determine if the contact will be reused
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index ce06aa9a2b..23084a4241 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -73,6 +73,27 @@ void CollisionObject2DSW::set_shape_transform(int p_index, const Transform2D &p_
_shapes_changed();
}
+void CollisionObject2DSW::set_shape_as_disabled(int p_idx, bool p_disabled) {
+ ERR_FAIL_INDEX(p_idx, shapes.size());
+
+ CollisionObject2DSW::Shape &shape = shapes[p_idx];
+ if (shape.disabled == p_disabled)
+ return;
+
+ shape.disabled = p_disabled;
+
+ if (!space)
+ return;
+
+ if (p_disabled && shape.bpid != 0) {
+ space->get_broadphase()->remove(shape.bpid);
+ shape.bpid = 0;
+ _update_shapes();
+ } else if (!p_disabled && shape.bpid == 0) {
+ _update_shapes(); // automatically adds shape with bpid == 0
+ }
+}
+
void CollisionObject2DSW::remove_shape(Shape2DSW *p_shape) {
//remove a shape, all the times it appears
@@ -139,6 +160,10 @@ void CollisionObject2DSW::_update_shapes() {
for (int i = 0; i < shapes.size(); i++) {
Shape &s = shapes[i];
+
+ if (s.disabled)
+ continue;
+
if (s.bpid == 0) {
s.bpid = space->get_broadphase()->create(this, i);
space->get_broadphase()->set_static(s.bpid, _static);
@@ -163,6 +188,9 @@ void CollisionObject2DSW::_update_shapes_with_motion(const Vector2 &p_motion) {
for (int i = 0; i < shapes.size(); i++) {
Shape &s = shapes[i];
+ if (s.disabled)
+ continue;
+
if (s.bpid == 0) {
s.bpid = space->get_broadphase()->create(this, i);
space->get_broadphase()->set_static(s.bpid, _static);
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 5f25c27158..ab3e219ac0 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -136,10 +136,7 @@ public:
_FORCE_INLINE_ Transform2D get_inv_transform() const { return inv_transform; }
_FORCE_INLINE_ Space2DSW *get_space() const { return space; }
- _FORCE_INLINE_ void set_shape_as_disabled(int p_idx, bool p_disabled) {
- ERR_FAIL_INDEX(p_idx, shapes.size());
- shapes[p_idx].disabled = p_disabled;
- }
+ void set_shape_as_disabled(int p_idx, bool p_disabled);
_FORCE_INLINE_ bool is_shape_set_as_disabled(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, shapes.size(), false);
return shapes[p_idx].disabled;
diff --git a/servers/physics_2d/joints_2d_sw.cpp b/servers/physics_2d/joints_2d_sw.cpp
index 7fba8acebd..d49c1b8376 100644
--- a/servers/physics_2d/joints_2d_sw.cpp
+++ b/servers/physics_2d/joints_2d_sw.cpp
@@ -146,14 +146,19 @@ bool PinJoint2DSW::setup(real_t p_step) {
return true;
}
+inline Vector2 custom_cross(const Vector2 &p_vec, real_t p_other) {
+
+ return Vector2(p_other * p_vec.y, -p_other * p_vec.x);
+}
+
void PinJoint2DSW::solve(real_t p_step) {
// compute relative velocity
- Vector2 vA = A->get_linear_velocity() - rA.cross(A->get_angular_velocity());
+ Vector2 vA = A->get_linear_velocity() - custom_cross(rA, A->get_angular_velocity());
Vector2 rel_vel;
if (B)
- rel_vel = B->get_linear_velocity() - rB.cross(B->get_angular_velocity()) - vA;
+ rel_vel = B->get_linear_velocity() - custom_cross(rB, B->get_angular_velocity()) - vA;
else
rel_vel = -vA;
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 433942708e..2b0eab5999 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -1011,6 +1011,10 @@ void ConcavePolygonShape2DSW::cull(const Rect2 &p_local_aabb, Callback p_callbac
stack[i]=0;
*/
+ if (segments.size() == 0 || points.size() == 0 || bvh.size() == 0) {
+ return;
+ }
+
int level = 0;
const Segment *segmentptr = &segments[0];
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index c29093d1af..0e1f74d8d0 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -33,6 +33,7 @@
#include "collision_solver_2d_sw.h"
#include "pair.h"
#include "physics_2d_server_sw.h"
+
_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask) {
return p_object->get_collision_layer() & p_collision_mask;
@@ -180,12 +181,15 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
Rect2 aabb = p_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, p_result_max, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
int cc = 0;
for (int i = 0; i < amount; i++) {
+ if (cc >= p_result_max)
+ break;
+
if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask))
continue;
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index fafc239c7f..cb7669ec24 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -540,6 +540,8 @@ void Physics2DServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &Physics2DServer::area_get_object_instance_id);
ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_area_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &Physics2DServer::area_set_monitorable);
ClassDB::bind_method(D_METHOD("body_create"), &Physics2DServer::body_create);
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index db5e14043c..82c4eb2e13 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -96,7 +96,7 @@ void PhysicsDirectBodyState::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &PhysicsDirectBodyState::add_force);
ClassDB::bind_method(D_METHOD("add_torque", "torque"), &PhysicsDirectBodyState::add_torque);
ClassDB::bind_method(D_METHOD("apply_impulse", "position", "j"), &PhysicsDirectBodyState::apply_impulse);
- ClassDB::bind_method(D_METHOD("apply_torqe_impulse", "j"), &PhysicsDirectBodyState::apply_torque_impulse);
+ ClassDB::bind_method(D_METHOD("apply_torque_impulse", "j"), &PhysicsDirectBodyState::apply_torque_impulse);
ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &PhysicsDirectBodyState::set_sleep_state);
ClassDB::bind_method(D_METHOD("is_sleeping"), &PhysicsDirectBodyState::is_sleeping);
@@ -444,6 +444,8 @@ void PhysicsServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &PhysicsServer::area_get_object_instance_id);
ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_area_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &PhysicsServer::area_set_monitorable);
ClassDB::bind_method(D_METHOD("area_set_ray_pickable", "area", "enable"), &PhysicsServer::area_set_ray_pickable);
ClassDB::bind_method(D_METHOD("area_is_ray_pickable", "area"), &PhysicsServer::area_is_ray_pickable);
@@ -603,6 +605,8 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_RESTITUTION);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING);
+ BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY);
+ BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS);
@@ -616,6 +620,7 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR);
+ BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR);
ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer::joint_get_type);
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 6a342b36d4..6712bee8dc 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -594,6 +594,8 @@ public:
G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS,
G6DOF_JOINT_LINEAR_RESTITUTION,
G6DOF_JOINT_LINEAR_DAMPING,
+ G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY,
+ G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT,
G6DOF_JOINT_ANGULAR_LOWER_LIMIT,
G6DOF_JOINT_ANGULAR_UPPER_LIMIT,
G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS,
@@ -611,6 +613,7 @@ public:
G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT,
G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT,
G6DOF_JOINT_FLAG_ENABLE_MOTOR,
+ G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR,
G6DOF_JOINT_FLAG_MAX
};
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index aaac32a4f2..1bad7e652b 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -80,6 +80,7 @@ static void _debugger_get_resource_usage(List<ScriptDebuggerRemote::ResourceUsag
ShaderTypes *shader_types = NULL;
PhysicsServer *_createGodotPhysicsCallback() {
+ WARN_PRINT("The GodotPhysics 3D physics engine is deprecated and will be removed in Godot 3.2. You should use the Bullet physics engine instead (configurable in your project settings).");
return memnew(PhysicsServerSW);
}
@@ -163,8 +164,8 @@ void register_server_types() {
GLOBAL_DEF(PhysicsServerManager::setting_property_name, "DEFAULT");
ProjectSettings::get_singleton()->set_custom_property_info(PhysicsServerManager::setting_property_name, PropertyInfo(Variant::STRING, PhysicsServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
- PhysicsServerManager::register_server("GodotPhysics", &_createGodotPhysicsCallback);
- PhysicsServerManager::set_default_server("GodotPhysics");
+ PhysicsServerManager::register_server("GodotPhysics - deprecated", &_createGodotPhysicsCallback);
+ PhysicsServerManager::set_default_server("GodotPhysics - deprecated");
}
void unregister_server_types() {
diff --git a/servers/server_wrap_mt_common.h b/servers/server_wrap_mt_common.h
index 4681dd46f0..611e25af2a 100644
--- a/servers/server_wrap_mt_common.h
+++ b/servers/server_wrap_mt_common.h
@@ -810,3 +810,12 @@
server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \
} \
}
+
+#define FUNC13(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13) \
+ virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13) { \
+ if (Thread::get_caller_id() != server_thread) { \
+ command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
+ } else { \
+ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
+ } \
+ }
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 8bf112b0de..f07adf6d0e 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -66,7 +66,7 @@ public:
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0;
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0;
- virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
+ virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) = 0;
@@ -175,6 +175,7 @@ public:
virtual RID texture_create() = 0;
virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT) = 0;
virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) = 0;
+ virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) = 0;
virtual Ref<Image> texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) const = 0;
virtual void texture_set_flags(RID p_texture, uint32_t p_flags) = 0;
virtual uint32_t texture_get_flags(RID p_texture) const = 0;
@@ -325,6 +326,7 @@ public:
virtual Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const = 0;
virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) = 0;
virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const = 0;
+ virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) = 0;
/* Light API */
@@ -513,6 +515,7 @@ public:
RENDER_TARGET_NO_3D,
RENDER_TARGET_NO_SAMPLING,
RENDER_TARGET_HDR,
+ RENDER_TARGET_KEEP_3D_LINEAR,
RENDER_TARGET_FLAG_MAX
};
@@ -735,6 +738,8 @@ public:
Vector<Point2> points;
Vector<Point2> uvs;
Vector<Color> colors;
+ Vector<int> bones;
+ Vector<float> weights;
RID texture;
RID normal_map;
int count;
@@ -812,6 +817,8 @@ public:
mutable bool rect_dirty;
mutable Rect2 rect;
RID material;
+ RID skeleton;
+
Item *next;
struct CopyBackBuffer {
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index d9f2c949e9..2069e64c43 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -124,6 +124,9 @@ const char *ShaderLanguage::token_names[TK_MAX] = {
"TYPE_ISAMPLER2D",
"TYPE_USAMPLER2D",
"TYPE_SAMPLERCUBE",
+ "INTERPOLATION_FLAT",
+ "INTERPOLATION_NO_PERSPECTIVE",
+ "INTERPOLATION_SMOOTH",
"PRECISION_LOW",
"PRECISION_MID",
"PRECISION_HIGH",
@@ -1489,11 +1492,6 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "abs", TYPE_IVEC3, { TYPE_IVEC3, TYPE_VOID } },
{ "abs", TYPE_IVEC4, { TYPE_IVEC4, TYPE_VOID } },
- { "abs", TYPE_UINT, { TYPE_UINT, TYPE_VOID } },
- { "abs", TYPE_UVEC2, { TYPE_UVEC2, TYPE_VOID } },
- { "abs", TYPE_UVEC3, { TYPE_UVEC3, TYPE_VOID } },
- { "abs", TYPE_UVEC4, { TYPE_UVEC4, TYPE_VOID } },
-
{ "sign", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } },
{ "sign", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } },
{ "sign", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } },
@@ -1608,7 +1606,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "mix", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID } },
{ "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_FLOAT, TYPE_VOID } },
{ "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_BOOL, TYPE_VOID } },
- { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_BVEC3, TYPE_VOID } },
+ { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_BVEC4, TYPE_VOID } },
{ "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_VEC4, TYPE_VOID } },
{ "step", TYPE_FLOAT, { TYPE_FLOAT, TYPE_FLOAT, TYPE_VOID } },
@@ -1627,24 +1625,24 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
{ "smoothstep", TYPE_VEC4, { TYPE_FLOAT, TYPE_FLOAT, TYPE_VEC4, TYPE_VOID } },
{ "isnan", TYPE_BOOL, { TYPE_FLOAT, TYPE_VOID } },
- { "isnan", TYPE_BOOL, { TYPE_VEC2, TYPE_VOID } },
- { "isnan", TYPE_BOOL, { TYPE_VEC3, TYPE_VOID } },
- { "isnan", TYPE_BOOL, { TYPE_VEC4, TYPE_VOID } },
+ { "isnan", TYPE_BVEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "isnan", TYPE_BVEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "isnan", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } },
{ "isinf", TYPE_BOOL, { TYPE_FLOAT, TYPE_VOID } },
- { "isinf", TYPE_BOOL, { TYPE_VEC2, TYPE_VOID } },
- { "isinf", TYPE_BOOL, { TYPE_VEC3, TYPE_VOID } },
- { "isinf", TYPE_BOOL, { TYPE_VEC4, TYPE_VOID } },
+ { "isinf", TYPE_BVEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "isinf", TYPE_BVEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "isinf", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } },
{ "floatBitsToInt", TYPE_INT, { TYPE_FLOAT, TYPE_VOID } },
{ "floatBitsToInt", TYPE_IVEC2, { TYPE_VEC2, TYPE_VOID } },
{ "floatBitsToInt", TYPE_IVEC3, { TYPE_VEC3, TYPE_VOID } },
{ "floatBitsToInt", TYPE_IVEC4, { TYPE_VEC4, TYPE_VOID } },
- { "floatBitsToUInt", TYPE_UINT, { TYPE_FLOAT, TYPE_VOID } },
- { "floatBitsToUInt", TYPE_UVEC2, { TYPE_VEC2, TYPE_VOID } },
- { "floatBitsToUInt", TYPE_UVEC3, { TYPE_VEC3, TYPE_VOID } },
- { "floatBitsToUInt", TYPE_UVEC4, { TYPE_VEC4, TYPE_VOID } },
+ { "floatBitsToUint", TYPE_UINT, { TYPE_FLOAT, TYPE_VOID } },
+ { "floatBitsToUint", TYPE_UVEC2, { TYPE_VEC2, TYPE_VOID } },
+ { "floatBitsToUint", TYPE_UVEC3, { TYPE_VEC3, TYPE_VOID } },
+ { "floatBitsToUint", TYPE_UVEC4, { TYPE_VEC4, TYPE_VOID } },
{ "intBitsToFloat", TYPE_FLOAT, { TYPE_INT, TYPE_VOID } },
{ "intBitsToFloat", TYPE_VEC2, { TYPE_IVEC2, TYPE_VOID } },
@@ -2209,6 +2207,37 @@ ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) {
return scalar_types[p_type];
}
+int ShaderLanguage::get_cardinality(DataType p_type) {
+ static const int cardinality_table[] = {
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 1,
+ 2,
+ 3,
+ 4,
+ 1,
+ 2,
+ 3,
+ 4,
+ 1,
+ 2,
+ 3,
+ 4,
+ 2,
+ 3,
+ 4,
+ 1,
+ 1,
+ 1,
+ 1,
+ };
+
+ return cardinality_table[p_type];
+}
+
bool ShaderLanguage::_get_completable_identifier(BlockNode *p_block, CompletionType p_type, StringName &identifier) {
identifier = StringName();
@@ -2271,7 +2300,7 @@ bool ShaderLanguage::_validate_assign(Node *p_node, const Map<StringName, BuiltI
if (p_node->type == Node::TYPE_OPERATOR) {
OperatorNode *op = static_cast<OperatorNode *>(p_node);
- if (op->type == OP_INDEX) {
+ if (op->op == OP_INDEX) {
return _validate_assign(op->arguments[0], p_builtin_types);
}
}
@@ -2679,7 +2708,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
return NULL;
}
- bool index_valid = false;
DataType member_type = TYPE_VOID;
switch (expr->get_datatype()) {
@@ -2698,7 +2726,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
_set_error("Only integer constants are allowed as index at the moment");
return NULL;
}
- index_valid = true;
+
switch (expr->get_datatype()) {
case TYPE_BVEC2: member_type = TYPE_BOOL; break;
case TYPE_VEC2: member_type = TYPE_FLOAT; break;
@@ -2723,7 +2751,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
_set_error("Only integer constants are allowed as index at the moment");
return NULL;
}
- index_valid = true;
+
switch (expr->get_datatype()) {
case TYPE_BVEC3: member_type = TYPE_BOOL; break;
case TYPE_VEC3: member_type = TYPE_FLOAT; break;
@@ -2747,7 +2775,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
_set_error("Only integer constants are allowed as index at the moment");
return NULL;
}
- index_valid = true;
+
switch (expr->get_datatype()) {
case TYPE_BVEC4: member_type = TYPE_BOOL; break;
case TYPE_VEC4: member_type = TYPE_FLOAT; break;
@@ -2762,11 +2790,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
}
- if (!index_valid) {
- _set_error("Invalid index");
- return NULL;
- }
-
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OP_INDEX;
op->return_cache = member_type;
@@ -2968,7 +2991,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
expr_pos++;
if (expr_pos == expression.size()) {
//can happen..
- _set_error("Unexpected end of expression..");
+ _set_error("Unexpected end of expression...");
return NULL;
}
}
@@ -3005,12 +3028,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
} else if (is_ternary) {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
if (next_op + 2 >= expression.size() || !expression[next_op + 2].is_op || expression[next_op + 2].op != OP_SELECT_ELSE) {
- _set_error("Mising matching ':' for select operator");
+ _set_error("Missing matching ':' for select operator");
return NULL;
}
@@ -3041,7 +3064,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
} else {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -3050,7 +3073,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (expression[next_op - 1].is_op) {
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
ERR_FAIL_V(NULL);
}
@@ -3066,7 +3089,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
// can be followed by a unary op in a valid combination,
// due to how precedence works, unaries will always disappear first
- _set_error("Parser bug..");
+ _set_error("Parser bug...");
}
op->arguments.push_back(expression[next_op - 1].node); //expression goes as left
@@ -3119,9 +3142,18 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
if (get_scalar_type(cn->datatype) == base) {
- for (int j = 0; j < cn->values.size(); j++) {
- values.push_back(cn->values[j]);
- }
+ int cardinality = get_cardinality(op->arguments[i]->get_datatype());
+ if (cn->values.size() == cardinality) {
+
+ for (int j = 0; j < cn->values.size(); j++) {
+ values.push_back(cn->values[j]);
+ }
+ } else if (cn->values.size() == 1) {
+
+ for (int j = 0; j < cardinality; j++) {
+ values.push_back(cn->values[0]);
+ }
+ } // else: should be filtered by the parser as it's an invalid constructor
} else if (get_scalar_type(cn->datatype) == cn->datatype) {
ConstantNode::Value v;
@@ -3215,7 +3247,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
precision = get_token_precision(tk.type);
tk = _get_token();
if (!is_token_nonvoid_datatype(tk.type)) {
- _set_error("Expected datatype after precission");
+ _set_error("Expected datatype after precision");
return ERR_PARSE_ERROR;
}
}
@@ -3513,7 +3545,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
if (!p_can_break) {
//all is good
- _set_error("Contiuning is not allowed here");
+ _set_error("Continuing is not allowed here");
}
ControlFlowNode *flow = alloc_node<ControlFlowNode>();
@@ -3664,7 +3696,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
_set_error("void datatype not allowed here");
return ERR_PARSE_ERROR;
}
- if (!uniform && type < TYPE_FLOAT && type > TYPE_VEC4) { // FIXME: always false! should it be || instead?
+
+ if (!uniform && (type < TYPE_FLOAT || type > TYPE_VEC4)) {
_set_error("Invalid type for varying, only float,vec2,vec3,vec4 allowed.");
return ERR_PARSE_ERROR;
}
@@ -3699,26 +3732,6 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
//todo parse default value
tk = _get_token();
- if (tk.type == TK_OP_ASSIGN) {
-
- Node *expr = _parse_and_reduce_expression(NULL, Map<StringName, BuiltInInfo>());
- if (!expr)
- return ERR_PARSE_ERROR;
- if (expr->type != Node::TYPE_CONSTANT) {
- _set_error("Expected constant expression after '='");
- return ERR_PARSE_ERROR;
- }
-
- ConstantNode *cn = static_cast<ConstantNode *>(expr);
-
- uniform.default_value.resize(cn->values.size());
-
- if (!convert_constant(cn, uniform.type, uniform.default_value.ptrw())) {
- _set_error("Can't convert constant to " + get_datatype_name(uniform.type));
- return ERR_PARSE_ERROR;
- }
- tk = _get_token();
- }
if (tk.type == TK_COLON) {
//hint
@@ -3834,6 +3847,27 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
tk = _get_token();
}
+ if (tk.type == TK_OP_ASSIGN) {
+
+ Node *expr = _parse_and_reduce_expression(NULL, Map<StringName, BuiltInInfo>());
+ if (!expr)
+ return ERR_PARSE_ERROR;
+ if (expr->type != Node::TYPE_CONSTANT) {
+ _set_error("Expected constant expression after '='");
+ return ERR_PARSE_ERROR;
+ }
+
+ ConstantNode *cn = static_cast<ConstantNode *>(expr);
+
+ uniform.default_value.resize(cn->values.size());
+
+ if (!convert_constant(cn, uniform.type, uniform.default_value.ptrw())) {
+ _set_error("Can't convert constant to " + get_datatype_name(uniform.type));
+ return ERR_PARSE_ERROR;
+ }
+ tk = _get_token();
+ }
+
shader->uniforms[name] = uniform;
if (tk.type != TK_SEMICOLON) {
diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h
index e8cdf1f897..720511e18d 100644
--- a/servers/visual/shader_language.h
+++ b/servers/visual/shader_language.h
@@ -425,6 +425,7 @@ public:
FunctionNode() {
type = TYPE_FUNCTION;
+ return_type = TYPE_VOID;
return_precision = PRECISION_DEFAULT;
can_discard = false;
}
@@ -532,6 +533,7 @@ public:
static bool convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value = NULL);
static DataType get_scalar_type(DataType p_type);
+ static int get_cardinality(DataType p_type);
static bool is_scalar_type(DataType p_type);
static bool is_sampler_type(DataType p_type);
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index 9042649337..95193f7a8f 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -173,6 +173,8 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].modes.insert("skip_vertex_transform");
shader_modes[VS::SHADER_SPATIAL].modes.insert("world_vertex_coords");
+ shader_modes[VS::SHADER_SPATIAL].modes.insert("shadows_disabled");
+
shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_lighting");
/************ CANVAS ITEM **************************/
@@ -207,7 +209,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].can_discard = true;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
@@ -218,9 +220,8 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_HEIGHT"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_UV"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_SHADOW"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_COLOR"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].can_discard = true;
@@ -232,6 +233,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_sub");
shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_mul");
shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_premul_alpha");
+ shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_disabled");
shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("unshaded");
shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("light_only");
@@ -254,7 +256,6 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["RANDOM_SEED"] = constt(ShaderLanguage::TYPE_UINT);
shader_modes[VS::SHADER_PARTICLES].functions["vertex"].can_discard = false;
- shader_modes[VS::SHADER_PARTICLES].modes.insert("billboard");
shader_modes[VS::SHADER_PARTICLES].modes.insert("disable_force");
shader_modes[VS::SHADER_PARTICLES].modes.insert("disable_velocity");
shader_modes[VS::SHADER_PARTICLES].modes.insert("keep_data");
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index 3e6e524117..6439ba8509 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -440,13 +440,17 @@ void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point
if (p_antialiased) {
pline->line_colors.push_back(Color(1, 1, 1, 1));
}
- }
- if (p_colors.size() == 1) {
+ } else if (p_colors.size() == 1) {
pline->triangle_colors = p_colors;
pline->line_colors = p_colors;
} else {
- pline->triangle_colors.resize(pline->triangles.size());
- pline->line_colors.resize(pline->lines.size());
+ if (p_colors.size() != p_points.size()) {
+ pline->triangle_colors.push_back(p_colors[0]);
+ pline->line_colors.push_back(p_colors[0]);
+ } else {
+ pline->triangle_colors.resize(pline->triangles.size());
+ pline->line_colors.resize(pline->lines.size());
+ }
}
for (int i = 0; i < p_points.size(); i++) {
@@ -690,7 +694,7 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2
canvas_item->commands.push_back(polygon);
}
-void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, int p_count, RID p_normal_map) {
+void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count, RID p_normal_map) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -698,6 +702,8 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector
int ps = p_points.size();
ERR_FAIL_COND(!p_colors.empty() && p_colors.size() != ps && p_colors.size() != 1);
ERR_FAIL_COND(!p_uvs.empty() && p_uvs.size() != ps);
+ ERR_FAIL_COND(!p_bones.empty() && p_bones.size() != ps * 4);
+ ERR_FAIL_COND(!p_weights.empty() && p_weights.size() != ps * 4);
Vector<int> indices = p_indices;
@@ -722,6 +728,8 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector
polygon->points = p_points;
polygon->uvs = p_uvs;
polygon->colors = p_colors;
+ polygon->bones = p_bones;
+ polygon->weights = p_weights;
polygon->indices = indices;
polygon->count = count;
polygon->antialiased = false;
diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h
index 6a5a7623b6..4d9398a17e 100644
--- a/servers/visual/visual_server_canvas.h
+++ b/servers/visual/visual_server_canvas.h
@@ -51,8 +51,6 @@ public:
Vector<Item *> child_items;
- RID skeleton;
-
Item() {
children_order_dirty = true;
E = NULL;
@@ -183,7 +181,7 @@ public:
void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, VS::NinePatchAxisMode p_x_axis_mode = VS::NINE_PATCH_STRETCH, VS::NinePatchAxisMode p_y_axis_mode = VS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID());
void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID());
void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false);
- void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID());
+ void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID());
void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_texture = RID(), RID p_normal_map = RID());
void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID());
void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal, int p_h_frames, int p_v_frames);
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 64a3502e40..fca3126604 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -205,4 +205,5 @@ VisualServerRaster::~VisualServerRaster() {
memdelete(VSG::canvas);
memdelete(VSG::viewport);
memdelete(VSG::rasterizer);
+ memdelete(VSG::scene);
}
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index a94e110b5d..f7151e54f9 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -139,6 +139,8 @@ public:
void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); }
#define BIND12(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); }
+#define BIND13(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12, m_type13) \
+ void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12, m_type13 arg13) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); }
//from now on, calls forwarded to this singleton
#define BINDBASE VSG::storage
@@ -148,6 +150,7 @@ public:
BIND0R(RID, texture_create)
BIND5(texture_allocate, RID, int, int, Image::Format, uint32_t)
BIND3(texture_set_data, RID, const Ref<Image> &, CubeMapSide)
+ BIND10(texture_set_data_partial, RID, const Ref<Image> &, int, int, int, int, int, int, int, CubeMapSide)
BIND2RC(Ref<Image>, texture_get_data, RID, CubeMapSide)
BIND2(texture_set_flags, RID, uint32_t)
BIND1RC(uint32_t, texture_get_flags, RID)
@@ -285,6 +288,7 @@ public:
BIND2RC(Transform, skeleton_bone_get_transform, RID, int)
BIND3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
BIND2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
+ BIND2(skeleton_set_base_transform_2d, RID, const Transform2D &)
/* Light API */
@@ -450,6 +454,7 @@ public:
BIND2(viewport_set_hide_canvas, RID, bool)
BIND2(viewport_set_disable_environment, RID, bool)
BIND2(viewport_set_disable_3d, RID, bool)
+ BIND2(viewport_set_keep_3d_linear, RID, bool)
BIND2(viewport_attach_camera, RID, RID)
BIND2(viewport_set_scenario, RID, RID)
@@ -486,7 +491,7 @@ public:
BIND2(environment_set_canvas_max_layer, RID, int)
BIND4(environment_set_ambient_light, RID, const Color &, float, float)
BIND7(environment_set_ssr, RID, bool, int, float, float, float, bool)
- BIND12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
+ BIND13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
BIND6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
BIND6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
@@ -580,7 +585,7 @@ public:
BIND11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
BIND7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
BIND7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
- BIND8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
+ BIND10(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID)
BIND4(canvas_item_add_mesh, RID, const RID &, RID, RID)
BIND4(canvas_item_add_multimesh, RID, RID, RID, RID)
BIND6(canvas_item_add_particles, RID, RID, RID, RID, int, int)
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 0920fa748b..697c890c9a 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -730,6 +730,11 @@ void VisualServerScene::instance_set_exterior(RID p_instance, bool p_enabled) {
}
void VisualServerScene::instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) {
+ Instance *instance = instance_owner.get(p_instance);
+ ERR_FAIL_COND(!instance);
+
+ instance->extra_margin = p_margin;
+ _instance_queue_update(instance, true, false);
}
Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID p_scenario) const {
@@ -1252,6 +1257,9 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
InstanceLightData *light = static_cast<InstanceLightData *>(p_instance->base_data);
+ Transform light_transform = p_instance->transform;
+ light_transform.orthonormalize(); //scale does not count on lights
+
switch (VSG::storage->light_get_type(p_instance->base)) {
case VS::LIGHT_DIRECTIONAL: {
@@ -1354,7 +1362,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
// obtain the light frustm ranges (given endpoints)
- Transform transform = p_instance->transform.orthonormalized(); //discard scale and stabilize light
+ Transform transform = light_transform; //discard scale and stabilize light
Vector3 x_vec = transform.basis.get_axis(Vector3::AXIS_X).normalized();
Vector3 y_vec = transform.basis.get_axis(Vector3::AXIS_Y).normalized();
@@ -1464,7 +1472,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
// a pre pass will need to be needed to determine the actual z-near to be used
- Plane near_plane(p_instance->transform.origin, -p_instance->transform.basis.get_axis(2));
+ Plane near_plane(light_transform.origin, -light_transform.basis.get_axis(2));
for (int j = 0; j < cull_count; j++) {
@@ -1519,14 +1527,14 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
float z = i == 0 ? -1 : 1;
Vector<Plane> planes;
planes.resize(5);
- planes[0] = p_instance->transform.xform(Plane(Vector3(0, 0, z), radius));
- planes[1] = p_instance->transform.xform(Plane(Vector3(1, 0, z).normalized(), radius));
- planes[2] = p_instance->transform.xform(Plane(Vector3(-1, 0, z).normalized(), radius));
- planes[3] = p_instance->transform.xform(Plane(Vector3(0, 1, z).normalized(), radius));
- planes[4] = p_instance->transform.xform(Plane(Vector3(0, -1, z).normalized(), radius));
+ planes[0] = light_transform.xform(Plane(Vector3(0, 0, z), radius));
+ planes[1] = light_transform.xform(Plane(Vector3(1, 0, z).normalized(), radius));
+ planes[2] = light_transform.xform(Plane(Vector3(-1, 0, z).normalized(), radius));
+ planes[3] = light_transform.xform(Plane(Vector3(0, 1, z).normalized(), radius));
+ planes[4] = light_transform.xform(Plane(Vector3(0, -1, z).normalized(), radius));
int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
- Plane near_plane(p_instance->transform.origin, p_instance->transform.basis.get_axis(2) * z);
+ Plane near_plane(light_transform.origin, light_transform.basis.get_axis(2) * z);
for (int j = 0; j < cull_count; j++) {
@@ -1541,7 +1549,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
}
}
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), p_instance->transform, radius, 0, i);
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, i);
VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
}
} break;
@@ -1572,7 +1580,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
Vector3(0, -1, 0)
};
- Transform xform = p_instance->transform * Transform().looking_at(view_normals[i], view_up[i]);
+ Transform xform = light_transform * Transform().looking_at(view_normals[i], view_up[i]);
Vector<Plane> planes = cm.get_projection_planes(xform);
@@ -1597,7 +1605,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
}
//restore the regular DP matrix
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), p_instance->transform, radius, 0, 0);
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, 0);
} break;
}
@@ -1611,10 +1619,10 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
CameraMatrix cm;
cm.set_perspective(angle * 2.0, 1.0, 0.01, radius);
- Vector<Plane> planes = cm.get_projection_planes(p_instance->transform);
+ Vector<Plane> planes = cm.get_projection_planes(light_transform);
int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
- Plane near_plane(p_instance->transform.origin, -p_instance->transform.basis.get_axis(2));
+ Plane near_plane(light_transform.origin, -light_transform.basis.get_axis(2));
for (int j = 0; j < cull_count; j++) {
Instance *instance = instance_shadow_cull_result[j];
@@ -1628,7 +1636,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
}
}
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, p_instance->transform, radius, 0, 0);
+ VSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, light_transform, radius, 0, 0);
VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, 0, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
} break;
@@ -1669,7 +1677,8 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_view
} break;
}
- _render_scene(camera->transform, camera_matrix, ortho, camera->env, camera->visible_layers, p_scenario, p_shadow_atlas, RID(), -1);
+ _prepare_scene(camera->transform, camera_matrix, ortho, camera->env, camera->visible_layers, p_scenario, p_shadow_atlas, RID());
+ _render_scene(camera->transform, camera_matrix, ortho, camera->env, p_scenario, p_shadow_atlas, RID(), -1);
}
void VisualServerScene::render_camera(Ref<ARVRInterface> &p_interface, ARVRInterface::Eyes p_eye, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
@@ -1679,7 +1688,6 @@ void VisualServerScene::render_camera(Ref<ARVRInterface> &p_interface, ARVRInter
ERR_FAIL_COND(!camera);
/* SETUP CAMERA, we are ignoring type and FOV here */
- bool ortho = false;
float aspect = p_viewport_size.width / (float)p_viewport_size.height;
CameraMatrix camera_matrix = p_interface->get_projection_for_eye(p_eye, aspect, camera->znear, camera->zfar);
@@ -1688,10 +1696,79 @@ void VisualServerScene::render_camera(Ref<ARVRInterface> &p_interface, ARVRInter
Transform world_origin = ARVRServer::get_singleton()->get_world_origin();
Transform cam_transform = p_interface->get_transform_for_eye(p_eye, world_origin);
- _render_scene(cam_transform, camera_matrix, ortho, camera->env, camera->visible_layers, p_scenario, p_shadow_atlas, RID(), -1);
+ // For stereo render we only prepare for our left eye and then reuse the outcome for our right eye
+ if (p_eye == ARVRInterface::EYE_LEFT) {
+ ///@TODO possibly move responsibility for this into our ARVRServer or ARVRInterface?
+
+ // Center our transform, we assume basis is equal.
+ Transform mono_transform = cam_transform;
+ Transform right_transform = p_interface->get_transform_for_eye(ARVRInterface::EYE_RIGHT, world_origin);
+ mono_transform.origin += right_transform.origin;
+ mono_transform.origin *= 0.5;
+
+ // We need to combine our projection frustums for culling.
+ // Ideally we should use our clipping planes for this and combine them,
+ // however our shadow map logic uses our projection matrix.
+ // Note: as our left and right frustums should be mirrored, we don't need our right projection matrix.
+
+ // - get some base values we need
+ float eye_dist = (mono_transform.origin - cam_transform.origin).length();
+ float z_near = camera_matrix.get_z_near(); // get our near plane
+ float z_far = camera_matrix.get_z_far(); // get our far plane
+ float width = (2.0 * z_near) / camera_matrix.matrix[0][0];
+ float x_shift = width * camera_matrix.matrix[2][0];
+ float height = (2.0 * z_near) / camera_matrix.matrix[1][1];
+ float y_shift = height * camera_matrix.matrix[2][1];
+
+ // printf("Eye_dist = %f, Near = %f, Far = %f, Width = %f, Shift = %f\n", eye_dist, z_near, z_far, width, x_shift);
+
+ // - calculate our near plane size (horizontal only, right_near is mirrored)
+ float left_near = -eye_dist - ((width - x_shift) * 0.5);
+
+ // - calculate our far plane size (horizontal only, right_far is mirrored)
+ float left_far = -eye_dist - (z_far * (width - x_shift) * 0.5 / z_near);
+ float left_far_right_eye = eye_dist - (z_far * (width + x_shift) * 0.5 / z_near);
+ if (left_far > left_far_right_eye) {
+ // on displays smaller then double our iod, the right eye far frustrum can overtake the left eyes.
+ left_far = left_far_right_eye;
+ }
+
+ // - figure out required z-shift
+ float slope = (left_far - left_near) / (z_far - z_near);
+ float z_shift = (left_near / slope) - z_near;
+
+ // - figure out new vertical near plane size (this will be slightly oversized thanks to our z-shift)
+ float top_near = (height - y_shift) * 0.5;
+ top_near += (top_near / z_near) * z_shift;
+ float bottom_near = -(height + y_shift) * 0.5;
+ bottom_near += (bottom_near / z_near) * z_shift;
+
+ // printf("Left_near = %f, Left_far = %f, Top_near = %f, Bottom_near = %f, Z_shift = %f\n", left_near, left_far, top_near, bottom_near, z_shift);
+
+ // - generate our frustum
+ CameraMatrix combined_matrix;
+ combined_matrix.set_frustum(left_near, -left_near, bottom_near, top_near, z_near + z_shift, z_far + z_shift);
+
+ // and finally move our camera back
+ Transform apply_z_shift;
+ apply_z_shift.origin = Vector3(0.0, 0.0, z_shift); // z negative is forward so this moves it backwards
+ mono_transform *= apply_z_shift;
+
+ // now prepare our scene with our adjusted transform projection matrix
+ _prepare_scene(mono_transform, combined_matrix, false, camera->env, camera->visible_layers, p_scenario, p_shadow_atlas, RID());
+ } else if (p_eye == ARVRInterface::EYE_MONO) {
+ // For mono render, prepare as per usual
+ _prepare_scene(cam_transform, camera_matrix, false, camera->env, camera->visible_layers, p_scenario, p_shadow_atlas, RID());
+ }
+
+ // And render our scene...
+ _render_scene(cam_transform, camera_matrix, false, camera->env, p_scenario, p_shadow_atlas, RID(), -1);
};
-void VisualServerScene::_render_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {
+void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe) {
+ // Note, in stereo rendering:
+ // - p_cam_transform will be a transform in the middle of our two eyes
+ // - p_cam_projection is a wider frustrum that encompasses both eyes
Scenario *scenario = scenario_owner.getornull(p_scenario);
@@ -1708,7 +1785,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
float z_far = p_cam_projection.get_z_far();
/* STEP 2 - CULL */
- int cull_count = scenario->octree.cull_convex(planes, instance_cull_result, MAX_INSTANCE_CULL);
+ instance_cull_count = scenario->octree.cull_convex(planes, instance_cull_result, MAX_INSTANCE_CULL);
light_cull_count = 0;
reflection_probe_cull_count = 0;
@@ -1726,7 +1803,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
/* STEP 4 - REMOVE FURTHER CULLED OBJECTS, ADD LIGHTS */
- for (int i = 0; i < cull_count; i++) {
+ for (int i = 0; i < instance_cull_count; i++) {
Instance *ins = instance_cull_result[i];
@@ -1852,8 +1929,8 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
if (!keep) {
// remove, no reason to keep
- cull_count--;
- SWAP(instance_cull_result[i], instance_cull_result[cull_count]);
+ instance_cull_count--;
+ SWAP(instance_cull_result[i], instance_cull_result[instance_cull_count]);
i--;
ins->last_render_pass = 0; // make invalid
} else {
@@ -1865,7 +1942,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
/* STEP 5 - PROCESS LIGHTS */
RID *directional_light_ptr = &light_instance_cull_result[light_cull_count];
- int directional_light_count = 0;
+ directional_light_count = 0;
// directional lights
{
@@ -2002,6 +2079,11 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
}
}
}
+}
+
+void VisualServerScene::_render_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {
+
+ Scenario *scenario = scenario_owner.getornull(p_scenario);
/* ENVIRONMENT */
@@ -2013,9 +2095,9 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam
else
environment = scenario->fallback_environment;
- /* STEP 6 - PROCESS GEOMETRY AND DRAW SCENE*/
+ /* PROCESS GEOMETRY AND DRAW SCENE */
- VSG::scene_render->render_scene(p_cam_transform, p_cam_projection, p_cam_orthogonal, (RasterizerScene::InstanceBase **)instance_cull_result, cull_count, light_instance_cull_result, light_cull_count + directional_light_count, reflection_probe_instance_cull_result, reflection_probe_cull_count, environment, p_shadow_atlas, scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass);
+ VSG::scene_render->render_scene(p_cam_transform, p_cam_projection, p_cam_orthogonal, (RasterizerScene::InstanceBase **)instance_cull_result, instance_cull_count, light_instance_cull_result, light_cull_count + directional_light_count, reflection_probe_instance_cull_result, reflection_probe_cull_count, environment, p_shadow_atlas, scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass);
}
void VisualServerScene::render_empty_scene(RID p_scenario, RID p_shadow_atlas) {
@@ -2088,7 +2170,8 @@ bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int
shadow_atlas = scenario->reflection_probe_shadow_atlas;
}
- _render_scene(xform, cm, false, RID(), VSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, p_step);
+ _prepare_scene(xform, cm, false, RID(), VSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, shadow_atlas, reflection_probe->instance);
+ _render_scene(xform, cm, false, RID(), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, p_step);
} else {
//do roughness postprocess step until it believes it's done
@@ -3333,6 +3416,7 @@ VisualServerScene::~VisualServerScene() {
#ifndef NO_THREADS
probe_bake_thread_exit = true;
+ probe_bake_sem->post();
Thread::wait_to_finish(probe_bake_thread);
memdelete(probe_bake_thread);
memdelete(probe_bake_sem);
diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h
index 109cdf711c..12d732724a 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/visual/visual_server_scene.h
@@ -434,11 +434,13 @@ public:
}
};
+ int instance_cull_count;
Instance *instance_cull_result[MAX_INSTANCE_CULL];
Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps
Instance *light_cull_result[MAX_LIGHTS_CULLED];
RID light_instance_cull_result[MAX_LIGHTS_CULLED];
int light_cull_count;
+ int directional_light_count;
RID reflection_probe_instance_cull_result[MAX_REFLECTION_PROBES_CULLED];
int reflection_probe_cull_count;
@@ -483,7 +485,8 @@ public:
_FORCE_INLINE_ void _light_instance_update_shadow(Instance *p_instance, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_shadow_atlas, Scenario *p_scenario);
- void _render_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass);
+ void _prepare_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe);
+ void _render_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass);
void render_empty_scene(RID p_scenario, RID p_shadow_atlas);
void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas);
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index 3eb8953c1f..dcc270ca5e 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -178,11 +178,14 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
VSG::rasterizer->restore_render_target();
if (scenario_draw_canvas_bg && canvas_map.front() && canvas_map.front()->key().layer > scenario_canvas_max_layer) {
+ Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface();
- if (can_draw_3d) {
- VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
- } else {
+ if (!can_draw_3d) {
VSG::scene->render_empty_scene(p_viewport->scenario, p_viewport->shadow_atlas);
+ } else if (p_viewport->use_arvr && arvr_interface.is_valid()) {
+ VSG::scene->render_camera(arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
+ } else {
+ VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
}
scenario_draw_canvas_bg = false;
}
@@ -210,11 +213,14 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
i++;
if (scenario_draw_canvas_bg && E->key().layer >= scenario_canvas_max_layer) {
+ Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface();
- if (can_draw_3d) {
- VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
- } else {
+ if (!can_draw_3d) {
VSG::scene->render_empty_scene(p_viewport->scenario, p_viewport->shadow_atlas);
+ } else if (p_viewport->use_arvr && arvr_interface.is_valid()) {
+ VSG::scene->render_camera(arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
+ } else {
+ VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
}
scenario_draw_canvas_bg = false;
@@ -222,11 +228,14 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
}
if (scenario_draw_canvas_bg) {
+ Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface();
- if (can_draw_3d) {
- VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
- } else {
+ if (!can_draw_3d) {
VSG::scene->render_empty_scene(p_viewport->scenario, p_viewport->shadow_atlas);
+ } else if (p_viewport->use_arvr && arvr_interface.is_valid()) {
+ VSG::scene->render_camera(arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
+ } else {
+ VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
}
scenario_draw_canvas_bg = false;
@@ -239,10 +248,9 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
void VisualServerViewport::draw_viewports() {
// get our arvr interface in case we need it
Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface();
- if (arvr_interface.is_valid()) {
- // update our positioning information as late as possible...
- arvr_interface->process();
- }
+
+ // process all our active interfaces
+ ARVRServer::get_singleton()->_process();
clear_color = GLOBAL_GET("rendering/environment/default_clear_color");
@@ -286,6 +294,9 @@ void VisualServerViewport::draw_viewports() {
_draw_viewport(vp, ARVRInterface::EYE_RIGHT);
arvr_interface->commit_for_eye(ARVRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect);
}
+
+ // and for our frame timing, mark when we've finished commiting our eyes
+ ARVRServer::get_singleton()->_mark_commit();
} else {
VSG::rasterizer->set_current_render_target(vp->render_target);
@@ -451,6 +462,15 @@ void VisualServerViewport::viewport_set_disable_3d(RID p_viewport, bool p_disabl
//this should be just for disabling rendering of 3D, to actually disable it, set usage
}
+void VisualServerViewport::viewport_set_keep_3d_linear(RID p_viewport, bool p_keep_3d_linear) {
+
+ Viewport *viewport = viewport_owner.getornull(p_viewport);
+ ERR_FAIL_COND(!viewport);
+
+ viewport->keep_3d_linear = p_keep_3d_linear;
+ VSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_KEEP_3D_LINEAR, p_keep_3d_linear);
+}
+
void VisualServerViewport::viewport_attach_camera(RID p_viewport, RID p_camera) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h
index 1d28cf22a3..c0c83c0450 100644
--- a/servers/visual/visual_server_viewport.h
+++ b/servers/visual/visual_server_viewport.h
@@ -64,6 +64,7 @@ public:
bool disable_environment;
bool disable_3d;
bool disable_3d_by_usage;
+ bool keep_3d_linear;
RID shadow_atlas;
int shadow_atlas_size;
@@ -110,6 +111,7 @@ public:
shadow_atlas_size = 0;
disable_3d = false;
disable_3d_by_usage = false;
+ keep_3d_linear = false;
debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED;
for (int i = 0; i < VS::VIEWPORT_RENDER_INFO_MAX; i++) {
render_info[i] = 0;
@@ -164,6 +166,7 @@ public:
void viewport_set_hide_canvas(RID p_viewport, bool p_hide);
void viewport_set_disable_environment(RID p_viewport, bool p_disable);
void viewport_set_disable_3d(RID p_viewport, bool p_disable);
+ void viewport_set_keep_3d_linear(RID p_viewport, bool p_keep_3d_linear);
void viewport_attach_camera(RID p_viewport, RID p_camera);
void viewport_set_scenario(RID p_viewport, RID p_scenario);
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index b91f80d137..8b5a334341 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -84,6 +84,7 @@ public:
FUNCRID(texture)
FUNC5(texture_allocate, RID, int, int, Image::Format, uint32_t)
FUNC3(texture_set_data, RID, const Ref<Image> &, CubeMapSide)
+ FUNC10(texture_set_data_partial, RID, const Ref<Image> &, int, int, int, int, int, int, int, CubeMapSide)
FUNC2RC(Ref<Image>, texture_get_data, RID, CubeMapSide)
FUNC2(texture_set_flags, RID, uint32_t)
FUNC1RC(uint32_t, texture_get_flags, RID)
@@ -221,6 +222,7 @@ public:
FUNC2RC(Transform, skeleton_bone_get_transform, RID, int)
FUNC3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
FUNC2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
+ FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &)
/* Light API */
@@ -377,6 +379,7 @@ public:
FUNC2(viewport_set_hide_canvas, RID, bool)
FUNC2(viewport_set_disable_environment, RID, bool)
FUNC2(viewport_set_disable_3d, RID, bool)
+ FUNC2(viewport_set_keep_3d_linear, RID, bool)
FUNC2(viewport_attach_camera, RID, RID)
FUNC2(viewport_set_scenario, RID, RID)
@@ -413,7 +416,7 @@ public:
FUNC2(environment_set_canvas_max_layer, RID, int)
FUNC4(environment_set_ambient_light, RID, const Color &, float, float)
FUNC7(environment_set_ssr, RID, bool, int, float, float, float, bool)
- FUNC12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
+ FUNC13(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float)
FUNC6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
FUNC6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality)
@@ -498,7 +501,7 @@ public:
FUNC11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID)
FUNC7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID)
FUNC7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool)
- FUNC8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
+ FUNC10(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID)
FUNC4(canvas_item_add_mesh, RID, const RID &, RID, RID)
FUNC4(canvas_item_add_multimesh, RID, RID, RID, RID)
FUNC6(canvas_item_add_particles, RID, RID, RID, RID, int, int)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 47577a3359..21745e87a8 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -214,9 +214,9 @@ RID VisualServer::_make_test_cube() {
for (int k = 0; k < 3; k++) {
if (i < 3)
- face_points[j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[j][(i + k) % 3] = v[k];
else
- face_points[3 - j][(i + k) % 3] = v[k] * (i >= 3 ? -1 : 1);
+ face_points[3 - j][(i + k) % 3] = -v[k];
}
normal_points[j] = Vector3();
normal_points[j][i % 3] = (i >= 3 ? -1 : 1);
@@ -1528,6 +1528,7 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("texture_create_from_image", "image", "flags"), &VisualServer::texture_create_from_image, DEFVAL(TEXTURE_FLAGS_DEFAULT));
ClassDB::bind_method(D_METHOD("texture_allocate", "texture", "width", "height", "format", "flags"), &VisualServer::texture_allocate, DEFVAL(TEXTURE_FLAGS_DEFAULT));
ClassDB::bind_method(D_METHOD("texture_set_data", "texture", "image", "cube_side"), &VisualServer::texture_set_data, DEFVAL(CUBEMAP_LEFT));
+ ClassDB::bind_method(D_METHOD("texture_set_data_partial", "texture", "image", "src_x", "src_y", "src_w", "src_h", "dst_x", "dst_y", "dst_mip", "cube_side"), &VisualServer::texture_set_data_partial, DEFVAL(CUBEMAP_LEFT));
ClassDB::bind_method(D_METHOD("texture_get_data", "texture", "cube_side"), &VisualServer::texture_get_data, DEFVAL(CUBEMAP_LEFT));
ClassDB::bind_method(D_METHOD("texture_set_flags", "texture", "flags"), &VisualServer::texture_set_flags);
ClassDB::bind_method(D_METHOD("texture_get_flags", "texture"), &VisualServer::texture_get_flags);
@@ -1827,9 +1828,9 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("canvas_item_add_nine_patch", "item", "rect", "source", "texture", "topleft", "bottomright", "x_axis_mode", "y_axis_mode", "draw_center", "modulate", "normal_map"), &VisualServer::canvas_item_add_nine_patch, DEFVAL(NINE_PATCH_STRETCH), DEFVAL(NINE_PATCH_STRETCH), DEFVAL(true), DEFVAL(Color(1, 1, 1)), DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("canvas_item_add_primitive", "item", "points", "colors", "uvs", "texture", "width", "normal_map"), &VisualServer::canvas_item_add_primitive, DEFVAL(1.0), DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("canvas_item_add_polygon", "item", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &VisualServer::canvas_item_add_polygon, DEFVAL(Vector<Point2>()), DEFVAL(RID()), DEFVAL(RID()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("canvas_item_add_triangle_array", "item", "indices", "points", "colors", "uvs", "texture", "count", "normal_map"), &VisualServer::canvas_item_add_triangle_array, DEFVAL(Vector<Point2>()), DEFVAL(RID()), DEFVAL(-1), DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_mesh", "item", "mesh", "skeleton"), &VisualServer::canvas_item_add_mesh, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_multimesh", "item", "mesh", "skeleton"), &VisualServer::canvas_item_add_multimesh, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_triangle_array", "item", "indices", "points", "colors", "uvs", "bones", "weights", "texture", "count", "normal_map"), &VisualServer::canvas_item_add_triangle_array, DEFVAL(Vector<Point2>()), DEFVAL(Vector<int>()), DEFVAL(Vector<float>()), DEFVAL(RID()), DEFVAL(-1), DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_mesh", "item", "mesh", "texture", "normal_map"), &VisualServer::canvas_item_add_mesh, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_multimesh", "item", "mesh", "texture", "normal_map"), &VisualServer::canvas_item_add_multimesh, DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("canvas_item_add_particles", "item", "particles", "texture", "normal_map", "h_frames", "v_frames"), &VisualServer::canvas_item_add_particles);
ClassDB::bind_method(D_METHOD("canvas_item_add_set_transform", "item", "transform"), &VisualServer::canvas_item_add_set_transform);
ClassDB::bind_method(D_METHOD("canvas_item_add_clip_ignore", "item", "ignore"), &VisualServer::canvas_item_add_clip_ignore);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 537588fd6f..73d96d60f7 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -109,6 +109,7 @@ public:
RID texture_create_from_image(const Ref<Image> &p_image, uint32_t p_flags = TEXTURE_FLAGS_DEFAULT); // helper
virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = TEXTURE_FLAGS_DEFAULT) = 0;
virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, CubeMapSide p_cube_side = CUBEMAP_LEFT) = 0;
+ virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, CubeMapSide p_cube_side = CUBEMAP_LEFT) = 0;
virtual Ref<Image> texture_get_data(RID p_texture, CubeMapSide p_cube_side = CUBEMAP_LEFT) const = 0;
virtual void texture_set_flags(RID p_texture, uint32_t p_flags) = 0;
virtual uint32_t texture_get_flags(RID p_texture) const = 0;
@@ -232,7 +233,7 @@ public:
ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3,
- ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
+ ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
};
@@ -351,6 +352,7 @@ public:
virtual Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const = 0;
virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) = 0;
virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const = 0;
+ virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) = 0;
/* Light API */
@@ -591,6 +593,7 @@ public:
virtual void viewport_set_hide_canvas(RID p_viewport, bool p_hide) = 0;
virtual void viewport_set_disable_environment(RID p_viewport, bool p_disable) = 0;
virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
+ virtual void viewport_set_keep_3d_linear(RID p_viewport, bool p_disable) = 0;
virtual void viewport_attach_camera(RID p_viewport, RID p_camera) = 0;
virtual void viewport_set_scenario(RID p_viewport, RID p_scenario) = 0;
@@ -716,7 +719,7 @@ public:
ENV_SSAO_BLUR_3x3,
};
- virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
+ virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0;
virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0;
@@ -845,7 +848,7 @@ public:
virtual void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false) = 0;
- virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID()) = 0;
+ virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_texture = RID(), RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID()) = 0;
virtual void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, int p_h_frames, int p_v_frames) = 0;
diff --git a/thirdparty/README.md b/thirdparty/README.md
index ff05f3d084..ea2a996812 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -11,6 +11,10 @@ The files were adapted to Godot by removing the dependency on b2Math (replacing
it by b2Glue.h) and commenting out some verbose printf calls.
Upstream code has not changed in 10 years, no need to keep track of changes.
+Important: Some files have Godot-made changes.
+They are marked with `// -- GODOT start --` and `// -- GODOT end --`
+comments.
+
## bullet
@@ -69,6 +73,10 @@ Files extracted from upstream source:
- all .cpp and .h files in EtcLib/
- README.md, LICENSE, AUTHORS
+Important: Some files have Godot-made changes.
+They are marked with `// -- GODOT start --` and `// -- GODOT end --`
+comments.
+
## fonts
@@ -83,7 +91,7 @@ Use UI font variant if available, because it has tight vertical metrics and good
### Hack Regular
- Upstream: https://github.com/source-foundry/Hack
-- Version: 3.000
+- Version: 3.003
- License: MIT + Bitstream Vera License
### DroidSans*.ttf
@@ -96,7 +104,7 @@ Use UI font variant if available, because it has tight vertical metrics and good
## freetype
- Upstream: https://www.freetype.org
-- Version: 2.8.1
+- Version: 2.9.1
- License: FreeType License (BSD-like)
Files extracted from upstream source:
@@ -109,7 +117,7 @@ Files extracted from upstream source:
## glad
- Upstream: https://github.com/Dav1dde/glad
-- Version: 0.1.16a0
+- Version: 0.1.20a0
- License: MIT
The files we package are automatically generated.
@@ -165,6 +173,10 @@ Files extracted from upstream source:
TODO.
+Important: Some files have Godot-made changes.
+They are marked with `// -- GODOT start --` and `// -- GODOT end --`
+comments.
+
## libtheora
@@ -182,7 +194,7 @@ Files extracted from upstream source:
## libvorbis
- Upstream: https://www.xiph.org/vorbis
-- Version: 1.3.5
+- Version: 1.3.6
- License: BSD-3-Clause
Files extracted from upstream source:
@@ -209,7 +221,7 @@ Godot-made change marked with `// -- GODOT --` comments.
## libwebp
- Upstream: https://chromium.googlesource.com/webm/libwebp/
-- Version: 0.6.1
+- Version: 1.0.0
- License: BSD-3-Clause
Files extracted from upstream source:
@@ -225,36 +237,55 @@ changes are marked with `// -- GODOT --` comments.
## libwebsockets
- Upstream: https://github.com/warmcat/libwebsockets
-- Version: 2.4.1
+- Version: 3.0.0
- License: LGPLv2.1 + static linking exception
File extracted from upstream source:
-- Everything in `lib/` except `http2/`, `event-libs/`.
- - From `misc/` exclude `lws-genhash.c`, `lws-ring.c`, `romfs.{c,h}`, `smtp.c`.
- - From `plat/` exclude `lws-plat-{esp*,optee}.c`.
- - From `server/` exclude `access-log.c`, `cgi.c`, `daemonize.c`, `lws-spa.c`,
-`peer-limits.c`, `rewrite.c`
-- Also copy `win32helpers/` from `win32port/`
-- `mbedtls_wrapper/include/platform/ssl_port.h` has a small change to check for OSX (missing `malloc.h`).
- The bug is fixed in upstream master via `LWS_HAVE_MALLOC_H`, but not in the 2.4.1 branch (as the file structure has changed).
-
-Important: `lws_config.h` and `lws_config_private.h` contains custom
+- From `lib/` into `thirdparty/libwebsockets`:
+ - Everything from `core`
+ - From `event-libs` only the `poll` subfolder
+ - From `misc` only `base64-decode.c`, `getifaddrs.c`, `getifaddrs.h`, `lejp.c`, and `sha-1.c`
+ - From `plat` only `lws-plat-unix.c` and `lws-plat-win.c`
+ - From `roles` only `private.h`, `h1`, `http`, `listen`, `pipe`, `raw`, `ws`
+ - From `roles/http` exclude `minilex.c`
+ - From `roles/http/server` exclude `access-log.c`, `lws-spa.c`, `ranges.c`, and `rewrite.c`
+ - From `roles/ws` exclude `ext` folder.
+ - From `tls` exclude `openssl` folder.
+- Also copy `win32helpers/` from `win32port/` inside `thirdparty/libwebsockets`
+- A small fix has been added in `libwebsockets/libwebsockets.h` to `#include <sys/socket.h>` for the BSD family.
+ This change has been PRed upstream, and should be merged before the next update. Remember to check and remove this line.
+
+Important: `lws_config.h` and `lws_config_private.h` contains custom
Godot build configurations, check them out when updating.
-## mbedTLS
+
+## mbedtls
- Upstream: https://tls.mbed.org/
-- Version: 2.7.0
+- Version: 2.8.0
- License: Apache 2.0
-File extracted from upstream release tarball `mbedtls-2.7.0-apache.tgz`:
-- All `*.h` from `include/mbedtls/` to `thirdparty/include/mbedtls/`
-- All `*.c` from `library/` to `thirdparty/library/`
+File extracted from upstream release tarball `mbedtls-2.8.0-apache.tgz`:
+- All `*.h` from `include/mbedtls/` to `thirdparty/mbedtls/include/mbedtls/`
+- All `*.c` from `library/` to `thirdparty/mbedtls/library/`
+- In file `thirdparty/mbedtls/library/net_sockets.c` mbedTLS overrides the `_WIN32_WINNT` define.
+ Be sure to check the Godot addition to only redfine it when undefined or `< 0x0501` (PRed upstream).
+- Applied the patch in `thirdparty/mbedtls/1453.diff` (PR 1453). Soon to be merged upstream. Check it out at next update.
+
+
+## miniupnpc
+
+- Upstream: https://github.com/miniupnp/miniupnp/tree/master/miniupnpc
+- Version: 2.1 (git 25615e0, 2018-05-08) with modifications
+- License: BSD-3-Clause
+
+The only modified file is miniupnpcstrings.h, which was created for Godot (is usually autogenerated by cmake).
+
## minizip
- Upstream: http://www.zlib.net
-- Version: 1.2.4 (zlib contrib)
+- Version: 1.2.11 (zlib contrib)
- License: zlib
Files extracted from the upstream source:
@@ -280,6 +311,10 @@ Collection of single-file libraries used in Godot components.
* Upstream: http://episec.com/people/edelkind/c.html
* Version: latest, as of April 2017
* License: Public Domain
+ - `clipper.{cpp,hpp}`
+ * Upstream: https://sourceforge.net/projects/polyclipping
+ * Version: 6.4.2
+ * License: BSL-1.0
- `fastlz.{c,h}`
* Upstream: https://github.com/ariya/FastLZ
* Version: git (f121734, 2007)
@@ -329,11 +364,11 @@ Collection of single-file libraries used in Godot components.
* License: zlib
- `stb_truetype.h`
* Upstream: https://github.com/nothings/stb
- * Version: 1.17
+ * Version: 1.19
* License: Public Domain (Unlicense) or MIT
- `stb_vorbis.c`
* Upstream: https://github.com/nothings/stb
- * Version: 1.11
+ * Version: 1.14
* License: Public Domain (Unlicense) or MIT
@@ -348,6 +383,7 @@ Files extracted from the upstream source:
- All .h files in `src/`
- LICENSE.txt
+
## opus
- Upstream: https://opus-codec.org
@@ -366,15 +402,18 @@ Files extracted from upstream source:
## pcre2
- Upstream: http://www.pcre.org/
-- Version: 10.23
+- Version: 10.31
- License: BSD-3-Clause
Files extracted from upstream source:
-- Files listed in NON-AUTOTOOLS-BUILD steps 1-4
+- Files listed in the file NON-AUTOTOOLS-BUILD steps 1-4
- All .h files in src/
-- src/pcre2_jit_*.c and src/sljit/*
-- AUTHORS and COPYING
+- src/pcre2_jit_match.c
+- src/pcre2_jit_misc.c
+- src/pcre2_jit_maketables.c
+- src/sljit/*
+- AUTHORS and LICENCE
## pvrtccompressor
@@ -467,7 +506,7 @@ Files extracted from upstream source:
## zstd
- Upstream: https://github.com/facebook/zstd
-- Version: 1.3.3
+- Version: 1.3.4
- License: BSD-3-Clause
Files extracted from upstream source:
diff --git a/thirdparty/b2d_convexdecomp/b2Polygon.cpp b/thirdparty/b2d_convexdecomp/b2Polygon.cpp
index b6ead62c63..c80204ae21 100644
--- a/thirdparty/b2d_convexdecomp/b2Polygon.cpp
+++ b/thirdparty/b2d_convexdecomp/b2Polygon.cpp
@@ -1342,7 +1342,12 @@ b2Polygon TraceEdge(b2Polygon* p){
if (nodes[j].nConnected == 0) continue;
b2Vec2 diff = nodes[i].position - nodes[j].position;
if (diff.LengthSquared() <= COLLAPSE_DIST_SQR){
- if (nActive <= 3) return b2Polygon();
+ if (nActive <= 3) {
+ // -- GODOT start --
+ delete[] nodes;
+ // -- GODOT end --
+ return b2Polygon();
+ }
//printf("Found dupe, %d left\n",nActive);
--nActive;
foundDupe = true;
diff --git a/thirdparty/etc2comp/EtcFilter.cpp b/thirdparty/etc2comp/EtcFilter.cpp
index bc899a533e..1ec8acdf3f 100644
--- a/thirdparty/etc2comp/EtcFilter.cpp
+++ b/thirdparty/etc2comp/EtcFilter.cpp
@@ -228,6 +228,9 @@ int FilterTwoPass( RGBCOLOR *pSrcImage, int srcWidth, int srcHeight,
pTempImage = (RGBCOLOR *)malloc( destWidth * srcHeight * sizeof(RGBCOLOR) );
if ( pTempImage == NULL )
{
+ // -- GODOT start --
+ free( contrib );
+ // -- GODOT end --
return 0;
}
diff --git a/thirdparty/fonts/Hack_Regular.ttf b/thirdparty/fonts/Hack_Regular.ttf
index f342700811..92a90cb06e 100644
--- a/thirdparty/fonts/Hack_Regular.ttf
+++ b/thirdparty/fonts/Hack_Regular.ttf
Binary files differ
diff --git a/thirdparty/fonts/LICENSE_Hack.md b/thirdparty/fonts/LICENSE_Hack.md
index ddd23a2b81..08927e504f 100644
--- a/thirdparty/fonts/LICENSE_Hack.md
+++ b/thirdparty/fonts/LICENSE_Hack.md
@@ -1,4 +1,4 @@
-The work in the Hack project is Copyright 2017 Source Foundry Authors and licensed under the MIT License
+The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License
The work in the DejaVu project was committed to the public domain.
@@ -6,7 +6,7 @@ Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bi
### MIT License
-Copyright (c) 2017 Source Foundry Authors
+Copyright (c) 2018 Source Foundry Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/fonts/NotoSansUI_Bold.ttf b/thirdparty/fonts/NotoSansUI_Bold.ttf
new file mode 100644
index 0000000000..810450aa81
--- /dev/null
+++ b/thirdparty/fonts/NotoSansUI_Bold.ttf
Binary files differ
diff --git a/thirdparty/freetype/FTL.TXT b/thirdparty/freetype/FTL.TXT
index 433ab060e3..c406d150fa 100644
--- a/thirdparty/freetype/FTL.TXT
+++ b/thirdparty/freetype/FTL.TXT
@@ -163,7 +163,7 @@ Legal Terms
Our home page can be found at
- http://www.freetype.org
+ https://www.freetype.org
--- end of FTL.TXT ---
diff --git a/thirdparty/freetype/include/freetype/config/ftconfig.h b/thirdparty/freetype/include/freetype/config/ftconfig.h
index 889aebf5ab..eedebf4082 100644
--- a/thirdparty/freetype/include/freetype/config/ftconfig.h
+++ b/thirdparty/freetype/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
/* */
/* ANSI-specific configuration file (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -73,11 +73,11 @@ FT_BEGIN_HEADER
/* The size of an `int' type. */
#if FT_UINT_MAX == 0xFFFFUL
-#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
+#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT )
#elif FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
+#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT )
#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
+#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT )
#else
#error "Unsupported size of `int' type!"
#endif
@@ -85,11 +85,11 @@ FT_BEGIN_HEADER
/* The size of a `long' type. A five-byte `long' (as used e.g. on the */
/* DM642) is recognized but avoided. */
#if FT_ULONG_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
+#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
-#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
+#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
+#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT )
#else
#error "Unsupported size of `long' type!"
#endif
@@ -236,12 +236,12 @@ FT_BEGIN_HEADER
#endif
-#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
+#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
typedef signed int FT_Int32;
typedef unsigned int FT_UInt32;
-#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
+#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
typedef signed long FT_Int32;
typedef unsigned long FT_UInt32;
@@ -252,12 +252,12 @@ FT_BEGIN_HEADER
/* look up an integer type that is at least 32 bits */
-#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
+#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
typedef int FT_Fast;
typedef unsigned int FT_UFast;
-#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
+#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
typedef long FT_Fast;
typedef unsigned long FT_UFast;
@@ -267,7 +267,7 @@ FT_BEGIN_HEADER
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
-#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
+#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
@@ -365,6 +365,14 @@ FT_BEGIN_HEADER
#endif
+ /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */
+ /* a function that gets used only within the scope of a module. */
+ /* Normally, both the header and source code files for such a */
+ /* function are within a single module directory. */
+ /* */
+ /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */
+ /* FT_LOCAL_ARRAY_DEF. */
+ /* */
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL( x ) static x
@@ -386,6 +394,12 @@ FT_BEGIN_HEADER
#define FT_LOCAL_ARRAY_DEF( x ) const x
+ /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */
+ /* functions that are used in more than a single module. In the */
+ /* current setup this implies that the declaration is in a header */
+ /* file in the `include/freetype/internal' directory, and the */
+ /* function body is in a file in `src/base'. */
+ /* */
#ifndef FT_BASE
#ifdef __cplusplus
@@ -408,14 +422,63 @@ FT_BEGIN_HEADER
#endif /* !FT_BASE_DEF */
+ /* When compiling FreeType as a DLL or DSO with hidden visibility */
+ /* some systems/compilers need a special attribute in front OR after */
+ /* the return type of function declarations. */
+ /* */
+ /* Two macros are used within the FreeType source code to define */
+ /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
+ /* */
+ /* FT_EXPORT( return_type ) */
+ /* */
+ /* is used in a function declaration, as in */
+ /* */
+ /* FT_EXPORT( FT_Error ) */
+ /* FT_Init_FreeType( FT_Library* alibrary ); */
+ /* */
+ /* */
+ /* FT_EXPORT_DEF( return_type ) */
+ /* */
+ /* is used in a function definition, as in */
+ /* */
+ /* FT_EXPORT_DEF( FT_Error ) */
+ /* FT_Init_FreeType( FT_Library* alibrary ) */
+ /* { */
+ /* ... some code ... */
+ /* return FT_Err_Ok; */
+ /* } */
+ /* */
+ /* You can provide your own implementation of FT_EXPORT and */
+ /* FT_EXPORT_DEF here if you want. */
+ /* */
+ /* To export a variable, use FT_EXPORT_VAR. */
+ /* */
#ifndef FT_EXPORT
-#ifdef __cplusplus
+#ifdef FT2_BUILD_LIBRARY
+
+#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
+#define FT_EXPORT( x ) __declspec( dllexport ) x
+#elif defined( __GNUC__ ) && __GNUC__ >= 4
+#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
+#elif defined( __cplusplus )
+#define FT_EXPORT( x ) extern "C" x
+#else
+#define FT_EXPORT( x ) extern x
+#endif
+
+#else
+
+#if defined( FT2_DLLIMPORT )
+#define FT_EXPORT( x ) __declspec( dllimport ) x
+#elif defined( __cplusplus )
#define FT_EXPORT( x ) extern "C" x
#else
#define FT_EXPORT( x ) extern x
#endif
+#endif
+
#endif /* !FT_EXPORT */
@@ -440,6 +503,7 @@ FT_BEGIN_HEADER
#endif /* !FT_EXPORT_VAR */
+
/* The following macros are needed to compile the library with a */
/* C++ compiler and with 16bit compilers. */
/* */
@@ -451,7 +515,13 @@ FT_BEGIN_HEADER
/* functions which are accessed by (global) function pointers. */
/* */
/* */
- /* FT_CALLBACK_DEF is used to _define_ a callback function. */
+ /* FT_CALLBACK_DEF is used to _define_ a callback function, */
+ /* located in the same source code file as the structure that uses */
+ /* it. */
+ /* */
+ /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */
+ /* and define a callback function, respectively, in a similar way */
+ /* as FT_BASE and FT_BASE_DEF work. */
/* */
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
/* contains pointers to callback functions. */
@@ -471,6 +541,16 @@ FT_BEGIN_HEADER
#endif
#endif /* FT_CALLBACK_DEF */
+#ifndef FT_BASE_CALLBACK
+#ifdef __cplusplus
+#define FT_BASE_CALLBACK( x ) extern "C" x
+#define FT_BASE_CALLBACK_DEF( x ) extern "C" x
+#else
+#define FT_BASE_CALLBACK( x ) extern x
+#define FT_BASE_CALLBACK_DEF( x ) x
+#endif
+#endif /* FT_BASE_CALLBACK */
+
#ifndef FT_CALLBACK_TABLE
#ifdef __cplusplus
#define FT_CALLBACK_TABLE extern "C"
diff --git a/thirdparty/freetype/include/freetype/config/ftheader.h b/thirdparty/freetype/include/freetype/config/ftheader.h
index d491af57c3..702f77cc42 100644
--- a/thirdparty/freetype/include/freetype/config/ftheader.h
+++ b/thirdparty/freetype/include/freetype/config/ftheader.h
@@ -4,7 +4,7 @@
/* */
/* Build macros of the FreeType 2 library. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -318,14 +318,29 @@
/*************************************************************************
*
* @macro:
+ * FT_DRIVER_H
+ *
+ * @description:
+ * A macro used in #include statements to name the file containing
+ * structures and macros related to the driver modules.
+ *
+ */
+#define FT_DRIVER_H <freetype/ftdriver.h>
+
+
+ /*************************************************************************
+ *
+ * @macro:
* FT_AUTOHINTER_H
*
* @description:
* A macro used in #include statements to name the file containing
* structures and macros related to the auto-hinting module.
*
+ * Deprecated since version 2.9; use @FT_DRIVER_H instead.
+ *
*/
-#define FT_AUTOHINTER_H <freetype/ftautoh.h>
+#define FT_AUTOHINTER_H FT_DRIVER_H
/*************************************************************************
@@ -337,8 +352,10 @@
* A macro used in #include statements to name the file containing
* structures and macros related to the CFF driver module.
*
+ * Deprecated since version 2.9; use @FT_DRIVER_H instead.
+ *
*/
-#define FT_CFF_DRIVER_H <freetype/ftcffdrv.h>
+#define FT_CFF_DRIVER_H FT_DRIVER_H
/*************************************************************************
@@ -350,8 +367,10 @@
* A macro used in #include statements to name the file containing
* structures and macros related to the TrueType driver module.
*
+ * Deprecated since version 2.9; use @FT_DRIVER_H instead.
+ *
*/
-#define FT_TRUETYPE_DRIVER_H <freetype/ftttdrv.h>
+#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H
/*************************************************************************
@@ -363,8 +382,10 @@
* A macro used in #include statements to name the file containing
* structures and macros related to the PCF driver module.
*
+ * Deprecated since version 2.9; use @FT_DRIVER_H instead.
+ *
*/
-#define FT_PCF_DRIVER_H <freetype/ftpcfdrv.h>
+#define FT_PCF_DRIVER_H FT_DRIVER_H
/*************************************************************************
@@ -557,63 +578,6 @@
/*************************************************************************
*
* @macro:
- * FT_CACHE_IMAGE_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * `glyph image' API of the FreeType~2 cache sub-system.
- *
- * It is used to define a cache for @FT_Glyph elements. You can also
- * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
- * store small glyph bitmaps, as it will use less memory.
- *
- * This macro is deprecated. Simply include @FT_CACHE_H to have all
- * glyph image-related cache declarations.
- *
- */
-#define FT_CACHE_IMAGE_H FT_CACHE_H
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CACHE_SMALL_BITMAPS_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * `small bitmaps' API of the FreeType~2 cache sub-system.
- *
- * It is used to define a cache for small glyph bitmaps in a relatively
- * memory-efficient way. You can also use the API defined in
- * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,
- * including scalable outlines.
- *
- * This macro is deprecated. Simply include @FT_CACHE_H to have all
- * small bitmaps-related cache declarations.
- *
- */
-#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
-
-
- /*************************************************************************
- *
- * @macro:
- * FT_CACHE_CHARMAP_H
- *
- * @description:
- * A macro used in #include statements to name the file containing the
- * `charmap' API of the FreeType~2 cache sub-system.
- *
- * This macro is deprecated. Simply include @FT_CACHE_H to have all
- * charmap-based cache declarations.
- *
- */
-#define FT_CACHE_CHARMAP_H FT_CACHE_H
-
-
- /*************************************************************************
- *
- * @macro:
* FT_MAC_H
*
* @description:
@@ -763,17 +727,6 @@
/*************************************************************************
*
* @macro:
- * FT_UNPATENTED_HINTING_H
- *
- * @description:
- * Deprecated.
- */
-#define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h>
-
-
- /*************************************************************************
- *
- * @macro:
* FT_INCREMENTAL_H
*
* @description:
@@ -809,25 +762,30 @@
/* */
+ /* These header files don't need to be included by the user. */
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
+#define FT_PARAMETER_TAGS_H <freetype/ftparams.h>
+ /* Deprecated macros. */
+#define FT_UNPATENTED_HINTING_H <freetype/ftparams.h>
+#define FT_TRUETYPE_UNPATENTED_H <freetype/ftparams.h>
+
+ /* FT_CACHE_H is the only header file needed for the cache subsystem. */
+#define FT_CACHE_IMAGE_H FT_CACHE_H
+#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
+#define FT_CACHE_CHARMAP_H FT_CACHE_H
/* The internals of the cache sub-system are no longer exposed. We */
/* default to FT_CACHE_H at the moment just in case, but we know of */
/* no rogue client that uses them. */
/* */
-#define FT_CACHE_MANAGER_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h>
-#define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h>
-
-
-#define FT_INCREMENTAL_H <freetype/ftincrem.h>
-
-#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
+#define FT_CACHE_MANAGER_H FT_CACHE_H
+#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H
+#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H
+#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H
+#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H
+#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H
+#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H
/*
diff --git a/thirdparty/freetype/include/freetype/config/ftoption.h b/thirdparty/freetype/include/freetype/config/ftoption.h
index 2fbe80b9b4..4bcab2af5c 100644
--- a/thirdparty/freetype/include/freetype/config/ftoption.h
+++ b/thirdparty/freetype/include/freetype/config/ftoption.h
@@ -4,7 +4,7 @@
/* */
/* User-selectable configuration macros (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -75,19 +75,21 @@ FT_BEGIN_HEADER
/*************************************************************************/
- /*************************************************************************/
+ /*#***********************************************************************/
/* */
/* If you enable this configuration option, FreeType recognizes an */
/* environment variable called `FREETYPE_PROPERTIES', which can be used */
/* to control the various font drivers and modules. The controllable */
- /* properties are listed in the section `Controlling FreeType Modules' */
- /* in the reference's table of contents; currently there are properties */
- /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */
- /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */
+ /* properties are listed in the section @properties. */
+ /* */
+ /* You have to undefine this configuration option on platforms that lack */
+ /* the concept of environment variables (and thus don't have the */
+ /* `getenv' function), for example Windows CE. */
/* */
/* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */
/* multiple lines for better readability). */
/* */
+ /* { */
/* <optional whitespace> */
/* <module-name1> ':' */
/* <property-name1> '=' <property-value1> */
@@ -95,6 +97,7 @@ FT_BEGIN_HEADER
/* <module-name2> ':' */
/* <property-name2> '=' <property-value2> */
/* ... */
+ /* } */
/* */
/* Example: */
/* */
@@ -211,6 +214,10 @@ FT_BEGIN_HEADER
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
+ /* If you use a build system like cmake or the `configure' script, */
+ /* options set by those programs have precendence, overwriting the */
+ /* value here with the configured one. */
+ /* */
/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
@@ -227,6 +234,10 @@ FT_BEGIN_HEADER
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
+ /* If you use a build system like cmake or the `configure' script, */
+ /* options set by those programs have precendence, overwriting the */
+ /* value here with the configured one. */
+ /* */
/* #define FT_CONFIG_OPTION_USE_BZIP2 */
@@ -252,6 +263,10 @@ FT_BEGIN_HEADER
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
+ /* If you use a build system like cmake or the `configure' script, */
+ /* options set by those programs have precendence, overwriting the */
+ /* value here with the configured one. */
+ /* */
/* #define FT_CONFIG_OPTION_USE_PNG */
@@ -265,49 +280,11 @@ FT_BEGIN_HEADER
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
-/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */
-
-
- /*************************************************************************/
- /* */
- /* DLL export compilation */
- /* */
- /* When compiling FreeType as a DLL, some systems/compilers need a */
- /* special keyword in front OR after the return type of function */
- /* declarations. */
- /* */
- /* Two macros are used within the FreeType source code to define */
- /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
- /* */
- /* FT_EXPORT( return_type ) */
- /* */
- /* is used in a function declaration, as in */
- /* */
- /* FT_EXPORT( FT_Error ) */
- /* FT_Init_FreeType( FT_Library* alibrary ); */
- /* */
+ /* If you use a build system like cmake or the `configure' script, */
+ /* options set by those programs have precendence, overwriting the */
+ /* value here with the configured one. */
/* */
- /* FT_EXPORT_DEF( return_type ) */
- /* */
- /* is used in a function definition, as in */
- /* */
- /* FT_EXPORT_DEF( FT_Error ) */
- /* FT_Init_FreeType( FT_Library* alibrary ) */
- /* { */
- /* ... some code ... */
- /* return FT_Err_Ok; */
- /* } */
- /* */
- /* You can provide your own implementation of FT_EXPORT and */
- /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
- /* will be later automatically defined as `extern return_type' to */
- /* allow normal compilation. */
- /* */
- /* Do not #undef these macros here since the build system might define */
- /* them for certain configurations only. */
- /* */
-/* #define FT_EXPORT(x) extern x */
-/* #define FT_EXPORT_DEF(x) x */
+/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */
/*************************************************************************/
@@ -678,7 +655,7 @@ FT_BEGIN_HEADER
/* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */
/* defined. */
/* */
- /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
+ /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
/* */
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
@@ -698,7 +675,7 @@ FT_BEGIN_HEADER
/* composite flags array which can be used to disambiguate, but old */
/* fonts will not have them. */
/* */
- /* http://www.microsoft.com/typography/otspec/glyf.htm */
+ /* https://www.microsoft.com/typography/otspec/glyf.htm */
/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html */
/* */
#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
@@ -796,6 +773,16 @@ FT_BEGIN_HEADER
/*************************************************************************/
+ /* */
+ /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */
+ /* engine gets compiled into FreeType. If defined, it is possible to */
+ /* switch between the two engines using the `hinting-engine' property of */
+ /* the type1 driver module. */
+ /* */
+/* #define T1_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
/*************************************************************************/
/**** ****/
/**** C F F D R I V E R C O N F I G U R A T I O N ****/
@@ -810,8 +797,8 @@ FT_BEGIN_HEADER
/* possible to set up the default values of the four control points that */
/* define the stem darkening behaviour of the (new) CFF engine. For */
/* more details please read the documentation of the */
- /* `darkening-parameters' property of the cff driver module (file */
- /* `ftcffdrv.h'), which allows the control at run-time. */
+ /* `darkening-parameters' property (file `ftdriver.h'), which allows the */
+ /* control at run-time. */
/* */
/* Do *not* undefine these macros! */
/* */
@@ -899,7 +886,7 @@ FT_BEGIN_HEADER
/* */
/* This experimental option is active only if the rendering mode is */
/* FT_RENDER_MODE_LIGHT; you can switch warping on and off with the */
- /* `warping' property of the auto-hinter (see file `ftautoh.h' for more */
+ /* `warping' property of the auto-hinter (see file `ftdriver.h' for more */
/* information; by default it is switched off). */
/* */
#define AF_CONFIG_OPTION_USE_WARPER
diff --git a/thirdparty/freetype/include/freetype/config/ftstdlib.h b/thirdparty/freetype/include/freetype/config/ftstdlib.h
index 05a4845fd5..42f9a06e43 100644
--- a/thirdparty/freetype/include/freetype/config/ftstdlib.h
+++ b/thirdparty/freetype/include/freetype/config/ftstdlib.h
@@ -5,7 +5,7 @@
/* ANSI-specific library and header configuration file (specification */
/* only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/freetype.h b/thirdparty/freetype/include/freetype/freetype.h
index b0c261799a..96644046e4 100644
--- a/thirdparty/freetype/include/freetype/freetype.h
+++ b/thirdparty/freetype/include/freetype/freetype.h
@@ -4,7 +4,7 @@
/* */
/* FreeType high-level API and common types (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -138,6 +138,7 @@ FT_BEGIN_HEADER
/* FT_FACE_FLAG_TRICKY */
/* FT_FACE_FLAG_KERNING */
/* FT_FACE_FLAG_MULTIPLE_MASTERS */
+ /* FT_FACE_FLAG_VARIATION */
/* FT_FACE_FLAG_GLYPH_NAMES */
/* FT_FACE_FLAG_EXTERNAL_STREAM */
/* FT_FACE_FLAG_HINTER */
@@ -147,14 +148,16 @@ FT_BEGIN_HEADER
/* FT_HAS_KERNING */
/* FT_HAS_FIXED_SIZES */
/* FT_HAS_GLYPH_NAMES */
- /* FT_HAS_MULTIPLE_MASTERS */
/* FT_HAS_COLOR */
+ /* FT_HAS_MULTIPLE_MASTERS */
/* */
/* FT_IS_SFNT */
/* FT_IS_SCALABLE */
/* FT_IS_FIXED_WIDTH */
/* FT_IS_CID_KEYED */
/* FT_IS_TRICKY */
+ /* FT_IS_NAMED_INSTANCE */
+ /* FT_IS_VARIATION */
/* */
/* FT_STYLE_FLAG_BOLD */
/* FT_STYLE_FLAG_ITALIC */
@@ -648,7 +651,7 @@ FT_BEGIN_HEADER
/* FT_ENCODING_MS_SYMBOL :: */
/* Microsoft Symbol encoding, used to encode mathematical symbols */
/* and wingdings. For more information, see */
- /* `http://www.microsoft.com/typography/otspec/recom.htm', */
+ /* `https://www.microsoft.com/typography/otspec/recom.htm', */
/* `http://www.kostis.net/charsets/symbol.htm', and */
/* `http://www.kostis.net/charsets/wingding.htm'. */
/* */
@@ -657,7 +660,7 @@ FT_BEGIN_HEADER
/* */
/* FT_ENCODING_SJIS :: */
/* Shift JIS encoding for Japanese. More info at */
- /* `http://en.wikipedia.org/wiki/Shift_JIS'. See note on */
+ /* `https://en.wikipedia.org/wiki/Shift_JIS'. See note on */
/* multi-byte encodings below. */
/* */
/* FT_ENCODING_PRC :: */
@@ -673,7 +676,7 @@ FT_BEGIN_HEADER
/* Corresponds to the Korean encoding system known as Extended */
/* Wansung (MS Windows code page 949). */
/* For more information see */
- /* `http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */
+ /* `https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'. */
/* */
/* FT_ENCODING_JOHAB :: */
/* The Korean standard character set (KS~C 5601-1992), which */
@@ -721,11 +724,12 @@ FT_BEGIN_HEADER
/* Same as FT_ENCODING_JOHAB. Deprecated. */
/* */
/* <Note> */
- /* By default, FreeType automatically synthesizes a Unicode charmap */
- /* for PostScript fonts, using their glyph name dictionaries. */
- /* However, it also reports the encodings defined explicitly in the */
- /* font file, for the cases when they are needed, with the Adobe */
- /* values as well. */
+ /* By default, FreeType enables a Unicode charmap and tags it with */
+ /* FT_ENCODING_UNICODE when it is either provided or can be generated */
+ /* from PostScript glyph name dictionaries in the font file. */
+ /* All other encodings are considered legacy and tagged only if */
+ /* explicitly defined in the font file. Otherwise, FT_ENCODING_NONE */
+ /* is used. */
/* */
/* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
/* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
@@ -749,7 +753,7 @@ FT_BEGIN_HEADER
/* @FT_Get_CMap_Language_ID to query the Mac language ID that may */
/* be needed to be able to distinguish Apple encoding variants. See */
/* */
- /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
+ /* https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt */
/* */
/* to get an idea how to do that. Basically, if the language ID */
/* is~0, don't use it, otherwise subtract 1 from the language ID. */
@@ -888,34 +892,41 @@ FT_BEGIN_HEADER
/* are set to~0 if there is only one face in */
/* the font file. */
/* */
- /* Bits 16-30 are relevant to GX and OpenType */
- /* variation fonts only, holding the named */
- /* instance index for the current face index */
- /* (starting with value~1; value~0 indicates */
- /* font access without a named instance). For */
- /* non-variation fonts, bits 16-30 are */
- /* ignored. If we have the third named */
- /* instance of face~4, say, `face_index' is */
- /* set to 0x00030004. */
+ /* [Since 2.6.1] Bits 16-30 are relevant to GX */
+ /* and OpenType variation fonts only, holding */
+ /* the named instance index for the current */
+ /* face index (starting with value~1; value~0 */
+ /* indicates font access without a named */
+ /* instance). For non-variation fonts, bits */
+ /* 16-30 are ignored. If we have the third */
+ /* named instance of face~4, say, `face_index' */
+ /* is set to 0x00030004. */
/* */
/* Bit 31 is always zero (this is, */
/* `face_index' is always a positive value). */
/* */
+ /* [Since 2.9] Changing the design coordinates */
+ /* with @FT_Set_Var_Design_Coordinates or */
+ /* @FT_Set_Var_Blend_Coordinates does not */
+ /* influence the named instance index value */
+ /* (only @FT_Set_Named_Instance does that). */
+ /* */
/* face_flags :: A set of bit flags that give important */
/* information about the face; see */
/* @FT_FACE_FLAG_XXX for the details. */
/* */
/* style_flags :: The lower 16~bits contain a set of bit */
/* flags indicating the style of the face; see */
- /* @FT_STYLE_FLAG_XXX for the details. Bits */
- /* 16-30 hold the number of named instances */
- /* available for the current face if we have a */
- /* GX or OpenType variation (sub)font. Bit 31 */
- /* is always zero (this is, `style_flags' is */
- /* always a positive value). Note that a */
- /* variation font has always at least one */
- /* named instance, namely the default */
- /* instance. */
+ /* @FT_STYLE_FLAG_XXX for the details. */
+ /* */
+ /* [Since 2.6.1] Bits 16-30 hold the number */
+ /* of named instances available for the */
+ /* current face if we have a GX or OpenType */
+ /* variation (sub)font. Bit 31 is always zero */
+ /* (this is, `style_flags' is always a */
+ /* positive value). Note that a variation */
+ /* font has always at least one named */
+ /* instance, namely the default instance. */
/* */
/* num_glyphs :: The number of glyphs in the face. If the */
/* face is scalable and has sbits (see */
@@ -1052,6 +1063,9 @@ FT_BEGIN_HEADER
/* `descender', `height', `underline_position', and */
/* `underline_thickness'. */
/* */
+ /* Especially for TrueType fonts see also the documentation for */
+ /* @FT_Size_Metrics. */
+ /* */
typedef struct FT_FaceRec_
{
FT_Long num_faces;
@@ -1162,7 +1176,7 @@ FT_BEGIN_HEADER
/* interpolating between them. Supported formats are Adobe MM, */
/* TrueType GX, and OpenType variation fonts. */
/* */
- /* See the multiple-masters specific API for details. */
+ /* See section @multiple_masters for API details. */
/* */
/* FT_FACE_FLAG_GLYPH_NAMES :: */
/* The face contains glyph names, which can be retrieved using */
@@ -1212,8 +1226,15 @@ FT_BEGIN_HEADER
/* tricky fonts; they are hard-coded in file `ttobjs.c'. */
/* */
/* FT_FACE_FLAG_COLOR :: */
- /* The face has color glyph tables. To access color glyphs use */
- /* @FT_LOAD_COLOR. */
+ /* [Since 2.5.1] The face has color glyph tables. To access color */
+ /* glyphs use @FT_LOAD_COLOR. */
+ /* */
+ /* FT_FACE_FLAG_VARIATION :: */
+ /* [Since 2.9] Set if the current face (or named instance) has been */
+ /* altered with @FT_Set_MM_Design_Coordinates, */
+ /* @FT_Set_Var_Design_Coordinates, or */
+ /* @FT_Set_Var_Blend_Coordinates. This flag is unset by a call to */
+ /* @FT_Set_Named_Instance. */
/* */
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
@@ -1230,6 +1251,7 @@ FT_BEGIN_HEADER
#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
#define FT_FACE_FLAG_COLOR ( 1L << 14 )
+#define FT_FACE_FLAG_VARIATION ( 1L << 15 )
/*************************************************************************
@@ -1391,6 +1413,14 @@ FT_BEGIN_HEADER
* A macro that returns true whenever a face object is a named instance
* of a GX or OpenType variation font.
*
+ * [Since 2.9] Changing the design coordinates with
+ * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
+ * not influence the return value of this macro (only
+ * @FT_Set_Named_Instance does that).
+ *
+ * @since:
+ * 2.7
+ *
*/
#define FT_IS_NAMED_INSTANCE( face ) \
( (face)->face_index & 0x7FFF0000L )
@@ -1399,6 +1429,24 @@ FT_BEGIN_HEADER
/*************************************************************************
*
* @macro:
+ * FT_IS_VARIATION( face )
+ *
+ * @description:
+ * A macro that returns true whenever a face object has been altered
+ * by @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or
+ * @FT_Set_Var_Blend_Coordinates.
+ *
+ * @since:
+ * 2.9
+ *
+ */
+#define FT_IS_VARIATION( face ) \
+ ( (face)->face_flags & FT_FACE_FLAG_VARIATION )
+
+
+ /*************************************************************************
+ *
+ * @macro:
* FT_IS_CID_KEYED( face )
*
* @description:
@@ -1437,6 +1485,9 @@ FT_BEGIN_HEADER
* A macro that returns true whenever a face object contains
* tables for color glyphs.
*
+ * @since:
+ * 2.5.1
+ *
*/
#define FT_HAS_COLOR( face ) \
( (face)->face_flags & FT_FACE_FLAG_COLOR )
@@ -1534,7 +1585,7 @@ FT_BEGIN_HEADER
/* to the following. */
/* */
/* { */
- /* scaled_ascender = FT_MulFix( face->root.ascender, */
+ /* scaled_ascender = FT_MulFix( face->ascender, */
/* size_metrics->y_scale ); */
/* } */
/* */
@@ -1548,6 +1599,43 @@ FT_BEGIN_HEADER
/* */
/* The `FT_Size_Metrics' structure is valid for bitmap fonts also. */
/* */
+ /* */
+ /* *TrueType* *fonts* *with* *native* *bytecode* *hinting* */
+ /* */
+ /* All applications that handle TrueType fonts with native hinting */
+ /* must be aware that TTFs expect different rounding of vertical font */
+ /* dimensions. The application has to cater for this, especially if */
+ /* it wants to rely on a TTF's vertical data (for example, to */
+ /* properly align box characters vertically). */
+ /* */
+ /* Only the application knows _in_ _advance_ that it is going to use */
+ /* native hinting for TTFs! FreeType, on the other hand, selects the */
+ /* hinting mode not at the time of creating an @FT_Size object but */
+ /* much later, namely while calling @FT_Load_Glyph. */
+ /* */
+ /* Here is some pseudo code that illustrates a possible solution. */
+ /* */
+ /* { */
+ /* font_format = FT_Get_Font_Format( face ); */
+ /* */
+ /* if ( !strcmp( font_format, "TrueType" ) && */
+ /* do_native_bytecode_hinting ) */
+ /* { */
+ /* ascender = ROUND( FT_MulFix( face->ascender, */
+ /* size_metrics->y_scale ) ); */
+ /* descender = ROUND( FT_MulFix( face->descender, */
+ /* size_metrics->y_scale ) ); */
+ /* } */
+ /* else */
+ /* { */
+ /* ascender = size_metrics->ascender; */
+ /* descender = size_metrics->descender; */
+ /* } */
+ /* */
+ /* height = size_metrics->height; */
+ /* max_advance = size_metrics->max_advance; */
+ /* } */
+ /* */
typedef struct FT_Size_Metrics_
{
FT_UShort x_ppem; /* horizontal pixels per EM */
@@ -1689,17 +1777,13 @@ FT_BEGIN_HEADER
/* @FT_GLYPH_FORMAT_COMPOSITE, but other values */
/* are possible. */
/* */
- /* bitmap :: This field is used as a bitmap descriptor */
- /* when the slot format is */
- /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
- /* address and content of the bitmap buffer can */
- /* change between calls of @FT_Load_Glyph and a */
- /* few other functions. */
+ /* bitmap :: This field is used as a bitmap descriptor. */
+ /* Note that the address and content of the */
+ /* bitmap buffer can change between calls of */
+ /* @FT_Load_Glyph and a few other functions. */
/* */
/* bitmap_left :: The bitmap's left bearing expressed in */
- /* integer pixels. Only valid if the format is */
- /* @FT_GLYPH_FORMAT_BITMAP, this is, if the */
- /* glyph slot contains a bitmap. */
+ /* integer pixels. */
/* */
/* bitmap_top :: The bitmap's top bearing expressed in integer */
/* pixels. This is the distance from the */
@@ -1746,7 +1830,9 @@ FT_BEGIN_HEADER
/* If @FT_Load_Glyph is called with default flags (see */
/* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
/* its native format (e.g., an outline glyph for TrueType and Type~1 */
- /* formats). */
+ /* formats). [Since 2.9] The prospective bitmap metrics are */
+ /* calculated according to @FT_LOAD_TARGET_XXX and other flags even */
+ /* for the outline glyph, even if @FT_LOAD_RENDER is not set. */
/* */
/* This image can later be converted into a bitmap by calling */
/* @FT_Render_Glyph. This function searches the current renderer for */
@@ -1895,8 +1981,8 @@ FT_BEGIN_HEADER
/* */
/* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */
/* set, this function reads the `FREETYPE_PROPERTIES' environment */
- /* variable to control driver properties. See sections @auto_hinter, */
- /* @cff_driver, @pcf_driver, and @tt_driver for more. */
+ /* variable to control driver properties. See section @properties */
+ /* for more. */
/* */
FT_EXPORT( FT_Error )
FT_Init_FreeType( FT_Library *alibrary );
@@ -1977,8 +2063,8 @@ FT_BEGIN_HEADER
/* data :: A pointer to the parameter data. */
/* */
/* <Note> */
- /* The ID and function of parameters are driver-specific. See the */
- /* various FT_PARAM_TAG_XXX flags for more information. */
+ /* The ID and function of parameters are driver-specific. See */
+ /* section @parameter_tags for more information. */
/* */
typedef struct FT_Parameter_
{
@@ -2155,14 +2241,14 @@ FT_BEGIN_HEADER
/* with value~0). Set it to~0 if there is only one */
/* face in the font file. */
/* */
- /* Bits 16-30 are relevant to GX and OpenType variation */
- /* fonts only, specifying the named instance index for */
- /* the current face index (starting with value~1; */
- /* value~0 makes FreeType ignore named instances). For */
- /* non-variation fonts, bits 16-30 are ignored. */
- /* Assuming that you want to access the third named */
- /* instance in face~4, `face_index' should be set to */
- /* 0x00030004. If you want to access face~4 without */
+ /* [Since 2.6.1] Bits 16-30 are relevant to GX and */
+ /* OpenType variation fonts only, specifying the named */
+ /* instance index for the current face index (starting */
+ /* with value~1; value~0 makes FreeType ignore named */
+ /* instances). For non-variation fonts, bits 16-30 are */
+ /* ignored. Assuming that you want to access the third */
+ /* named instance in face~4, `face_index' should be set */
+ /* to 0x00030004. If you want to access face~4 without */
/* variation handling, simply set `face_index' to */
/* value~4. */
/* */
@@ -2748,6 +2834,10 @@ FT_BEGIN_HEADER
/* since its glyph indices are not listed in any of the font's */
/* charmaps. */
/* */
+ /* If no active cmap is set up (i.e., `face->charmap' is zero), the */
+ /* call to @FT_Get_Char_Index is omitted, and the function behaves */
+ /* identically to @FT_Load_Glyph. */
+ /* */
FT_EXPORT( FT_Error )
FT_Load_Char( FT_Face face,
FT_ULong char_code,
@@ -2869,26 +2959,26 @@ FT_BEGIN_HEADER
* Disable the auto-hinter. See also the note below.
*
* FT_LOAD_COLOR ::
- * Load embedded color bitmap images. The resulting color bitmaps,
- * if available, will have the @FT_PIXEL_MODE_BGRA format. If the
- * flag is not set and color bitmaps are found, they are converted
- * to 256-level gray bitmaps transparently, using the
+ * [Since 2.5] Load embedded color bitmap images. The resulting color
+ * bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format.
+ * If the flag is not set and color bitmaps are found, they are
+ * converted to 256-level gray bitmaps transparently, using the
* @FT_PIXEL_MODE_GRAY format.
*
* FT_LOAD_COMPUTE_METRICS ::
- * Compute glyph metrics from the glyph data, without the use of
- * bundled metrics tables (for example, the `hdmx' table in TrueType
- * fonts). This flag is mainly used by font validating or font
- * editing applications, which need to ignore, verify, or edit those
- * tables.
+ * [Since 2.6.1] Compute glyph metrics from the glyph data, without
+ * the use of bundled metrics tables (for example, the `hdmx' table in
+ * TrueType fonts). This flag is mainly used by font validating or
+ * font editing applications, which need to ignore, verify, or edit
+ * those tables.
*
* Currently, this flag is only implemented for TrueType fonts.
*
* FT_LOAD_BITMAP_METRICS_ONLY ::
- * Request loading of the metrics and bitmap image information of a
- * (possibly embedded) bitmap glyph without allocating or copying
- * the bitmap image data itself. No effect if the target glyph is
- * not a bitmap image.
+ * [Since 2.7.1] Request loading of the metrics and bitmap image
+ * information of a (possibly embedded) bitmap glyph without
+ * allocating or copying the bitmap image data itself. No effect if
+ * the target glyph is not a bitmap image.
*
* This flag unsets @FT_LOAD_RENDER.
*
@@ -2980,7 +3070,7 @@ FT_BEGIN_HEADER
*
* Advance widths are rounded to integer values; however, using the
* `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is
- * possible to get fractional advance widths for sub-pixel positioning
+ * possible to get fractional advance widths for subpixel positioning
* (which is recommended to use).
*
* If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active,
@@ -3119,13 +3209,13 @@ FT_BEGIN_HEADER
/* opacity). */
/* */
/* FT_RENDER_MODE_LCD :: */
- /* This mode corresponds to horizontal RGB and BGR sub-pixel */
+ /* This mode corresponds to horizontal RGB and BGR subpixel */
/* displays like LCD screens. It produces 8-bit bitmaps that are */
/* 3~times the width of the original glyph outline in pixels, and */
/* which use the @FT_PIXEL_MODE_LCD mode. */
/* */
/* FT_RENDER_MODE_LCD_V :: */
- /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
+ /* This mode corresponds to vertical RGB and BGR subpixel displays */
/* (like PDA screens, rotated LCD displays, etc.). It produces */
/* 8-bit bitmaps that are 3~times the height of the original */
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
@@ -3471,7 +3561,14 @@ FT_BEGIN_HEADER
/* retrieve it. FreeType follows Adobe TechNote #5902, `Generating */
/* PostScript Names for Fonts Using OpenType Font Variations'. */
/* */
- /* http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5902.AdobePSNameGeneration.html */
+ /* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html */
+ /* */
+ /* [Since 2.9] Special PostScript names for named instances are only */
+ /* returned if the named instance is set with @FT_Set_Named_Instance */
+ /* (and the font has corresponding entries in its `fvar' table). If */
+ /* @FT_IS_VARIATION returns true, the algorithmically derived */
+ /* PostScript name is provided, not looking up special entries for */
+ /* named instances. */
/* */
FT_EXPORT( const char* )
FT_Get_Postscript_Name( FT_Face face );
@@ -3702,17 +3799,17 @@ FT_BEGIN_HEADER
* Note that only a subset of the available properties can be
* controlled.
*
- * * Stem darkening (@FT_PARAM_TAG_STEM_DARKENING, corresponding to the
- * property `no-stem-darkening' provided by the `autofit' and `cff'
- * modules; see @no-stem-darkening[autofit] and
- * @no-stem-darkening[cff]).
+ * * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the
+ * property `no-stem-darkening' provided by the `autofit', `cff',
+ * `type1', and `t1cid' modules; see @no-stem-darkening).
*
- * * LCD filter weights (@FT_PARAM_TAG_LCD_FILTER_WEIGHTS, corresponding
+ * * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding
* to function @FT_Library_SetLcdFilterWeights).
*
- * * Seed value for the CFF `random' operator
- * (@FT_PARAM_TAG_RANDOM_SEED, corresponding to the `random-seed'
- * property provided by the `cff' module; see @random-seed).
+ * * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID
+ * `random' operator, corresponding to the `random-seed' property
+ * provided by the `cff', `type1', and `t1cid' modules; see
+ * @random-seed).
*
* Pass NULL as `data' in @FT_Parameter for a given tag to reset the
* option and use the library or module default again.
@@ -3775,6 +3872,9 @@ FT_BEGIN_HEADER
* FT_Face_Properties( face, 1, &property );
* }
*
+ * @since:
+ * 2.8
+ *
*/
FT_EXPORT( FT_Error )
FT_Face_Properties( FT_Face face,
@@ -3899,7 +3999,7 @@ FT_BEGIN_HEADER
/* and subsetting restrictions associated with a font. */
/* */
/* See */
- /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
+ /* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */
/* for more details. */
/* */
/* <Values> */
@@ -3999,9 +4099,9 @@ FT_BEGIN_HEADER
/* Sequences' (IVS), collected in the `Ideographic Variation */
/* Database' (IVD). */
/* */
- /* http://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */
- /* http://unicode.org/reports/tr37/ */
- /* http://unicode.org/ivd/ */
+ /* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt */
+ /* https://unicode.org/reports/tr37/ */
+ /* https://unicode.org/ivd/ */
/* */
/* To date (January 2017), the character with the most ideographic */
/* variations is U+9089, having 32 such IVS. */
@@ -4456,7 +4556,7 @@ FT_BEGIN_HEADER
*
*/
#define FREETYPE_MAJOR 2
-#define FREETYPE_MINOR 8
+#define FREETYPE_MINOR 9
#define FREETYPE_PATCH 1
diff --git a/thirdparty/freetype/include/freetype/ftadvanc.h b/thirdparty/freetype/include/freetype/ftadvanc.h
index dea96e0db4..f78e8b1a9d 100644
--- a/thirdparty/freetype/include/freetype/ftadvanc.h
+++ b/thirdparty/freetype/include/freetype/ftadvanc.h
@@ -4,7 +4,7 @@
/* */
/* Quick computation of advance widths (specification only). */
/* */
-/* Copyright 2008-2017 by */
+/* Copyright 2008-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftbbox.h b/thirdparty/freetype/include/freetype/ftbbox.h
index f03bdc1e1e..f9eb70b137 100644
--- a/thirdparty/freetype/include/freetype/ftbbox.h
+++ b/thirdparty/freetype/include/freetype/ftbbox.h
@@ -4,7 +4,7 @@
/* */
/* FreeType exact bbox computation (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -61,7 +61,7 @@ FT_BEGIN_HEADER
/* Compute the exact bounding box of an outline. This is slower */
/* than computing the control box. However, it uses an advanced */
/* algorithm that returns _very_ quickly when the two boxes */
- /* coincide. Otherwise, the outline Bézier arcs are traversed to */
+ /* coincide. Otherwise, the outline Bezier arcs are traversed to */
/* extract their extrema. */
/* */
/* <Input> */
diff --git a/thirdparty/freetype/include/freetype/ftbdf.h b/thirdparty/freetype/include/freetype/ftbdf.h
index 3d3106bad0..1b6dea6586 100644
--- a/thirdparty/freetype/include/freetype/ftbdf.h
+++ b/thirdparty/freetype/include/freetype/ftbdf.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing BDF-specific strings (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftbitmap.h b/thirdparty/freetype/include/freetype/ftbitmap.h
index 04b2402ad0..a43187cad4 100644
--- a/thirdparty/freetype/include/freetype/ftbitmap.h
+++ b/thirdparty/freetype/include/freetype/ftbitmap.h
@@ -4,7 +4,7 @@
/* */
/* FreeType utility functions for bitmaps (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -97,7 +97,7 @@ FT_BEGIN_HEADER
FT_EXPORT( FT_Error )
FT_Bitmap_Copy( FT_Library library,
const FT_Bitmap *source,
- FT_Bitmap *target);
+ FT_Bitmap *target );
/*************************************************************************/
diff --git a/thirdparty/freetype/include/freetype/ftbzip2.h b/thirdparty/freetype/include/freetype/ftbzip2.h
index 9147a790a4..6edfa031b5 100644
--- a/thirdparty/freetype/include/freetype/ftbzip2.h
+++ b/thirdparty/freetype/include/freetype/ftbzip2.h
@@ -4,7 +4,7 @@
/* */
/* Bzip2-compressed stream support. */
/* */
-/* Copyright 2010-2017 by */
+/* Copyright 2010-2018 by */
/* Joel Klinghed. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftcache.h b/thirdparty/freetype/include/freetype/ftcache.h
index 5ff3ccf404..52d5f00e06 100644
--- a/thirdparty/freetype/include/freetype/ftcache.h
+++ b/thirdparty/freetype/include/freetype/ftcache.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache subsystem (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -540,13 +540,6 @@ FT_BEGIN_HEADER
FTC_FaceID face_id );
- /*************************************************************************/
- /* */
- /* <Section> */
- /* cache_subsystem */
- /* */
- /*************************************************************************/
-
/*************************************************************************
*
* @type:
@@ -624,14 +617,6 @@ FT_BEGIN_HEADER
/*************************************************************************/
- /* */
- /* <Section> */
- /* cache_subsystem */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
diff --git a/thirdparty/freetype/include/freetype/ftchapters.h b/thirdparty/freetype/include/freetype/ftchapters.h
index a0a121b0a1..51257bb7ca 100644
--- a/thirdparty/freetype/include/freetype/ftchapters.h
+++ b/thirdparty/freetype/include/freetype/ftchapters.h
@@ -76,8 +76,11 @@
/* <Sections> */
/* auto_hinter */
/* cff_driver */
+/* t1_cid_driver */
/* tt_driver */
/* pcf_driver */
+/* properties */
+/* parameter_tags */
/* */
/***************************************************************************/
diff --git a/thirdparty/freetype/include/freetype/ftcid.h b/thirdparty/freetype/include/freetype/ftcid.h
index 4adcbeeda9..5e9100a67c 100644
--- a/thirdparty/freetype/include/freetype/ftcid.h
+++ b/thirdparty/freetype/include/freetype/ftcid.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing CID font information (specification). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* Dereg Clegg and Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -87,7 +87,7 @@ FT_BEGIN_HEADER
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
const char* *registry,
const char* *ordering,
- FT_Int *supplement);
+ FT_Int *supplement );
/**********************************************************************
diff --git a/thirdparty/freetype/include/freetype/ftdriver.h b/thirdparty/freetype/include/freetype/ftdriver.h
new file mode 100644
index 0000000000..e90475b2af
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/ftdriver.h
@@ -0,0 +1,1225 @@
+/***************************************************************************/
+/* */
+/* ftdriver.h */
+/* */
+/* FreeType API for controlling driver modules (specification only). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef FTDRIVER_H_
+#define FTDRIVER_H_
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_PARAMETER_TAGS_H
+
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
+FT_BEGIN_HEADER
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * auto_hinter
+ *
+ * @title:
+ * The auto-hinter
+ *
+ * @abstract:
+ * Controlling the auto-hinting module.
+ *
+ * @description:
+ * While FreeType's auto-hinter doesn't expose API functions by itself,
+ * it is possible to control its behaviour with @FT_Property_Set and
+ * @FT_Property_Get. The following lists the available properties
+ * together with the necessary macros and structures.
+ *
+ * Note that the auto-hinter's module name is `autofitter' for
+ * historical reasons.
+ *
+ * Available properties are @increase-x-height, @no-stem-darkening
+ * (experimental), @darkening-parameters (experimental), @warping
+ * (experimental), @glyph-to-script-map (experimental), @fallback-script
+ * (experimental), and @default-script (experimental), as documented in
+ * the @properties section.
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * cff_driver
+ *
+ * @title:
+ * The CFF driver
+ *
+ * @abstract:
+ * Controlling the CFF driver module.
+ *
+ * @description:
+ * While FreeType's CFF driver doesn't expose API functions by itself,
+ * it is possible to control its behaviour with @FT_Property_Set and
+ * @FT_Property_Get.
+ *
+ * The CFF driver's module name is `cff'.
+ *
+ * Available properties are @hinting-engine, @no-stem-darkening,
+ * @darkening-parameters, and @random-seed, as documented in the
+ * @properties section.
+ *
+ *
+ * *Hinting* *and* *antialiasing* *principles* *of* *the* *new* *engine*
+ *
+ * The rasterizer is positioning horizontal features (e.g., ascender
+ * height & x-height, or crossbars) on the pixel grid and minimizing the
+ * amount of antialiasing applied to them, while placing vertical
+ * features (vertical stems) on the pixel grid without hinting, thus
+ * representing the stem position and weight accurately. Sometimes the
+ * vertical stems may be only partially black. In this context,
+ * `antialiasing' means that stems are not positioned exactly on pixel
+ * borders, causing a fuzzy appearance.
+ *
+ * There are two principles behind this approach.
+ *
+ * 1) No hinting in the horizontal direction: Unlike `superhinted'
+ * TrueType, which changes glyph widths to accommodate regular
+ * inter-glyph spacing, Adobe's approach is `faithful to the design' in
+ * representing both the glyph width and the inter-glyph spacing
+ * designed for the font. This makes the screen display as close as it
+ * can be to the result one would get with infinite resolution, while
+ * preserving what is considered the key characteristics of each glyph.
+ * Note that the distances between unhinted and grid-fitted positions at
+ * small sizes are comparable to kerning values and thus would be
+ * noticeable (and distracting) while reading if hinting were applied.
+ *
+ * One of the reasons to not hint horizontally is antialiasing for LCD
+ * screens: The pixel geometry of modern displays supplies three
+ * vertical subpixels as the eye moves horizontally across each visible
+ * pixel. On devices where we can be certain this characteristic is
+ * present a rasterizer can take advantage of the subpixels to add
+ * increments of weight. In Western writing systems this turns out to
+ * be the more critical direction anyway; the weights and spacing of
+ * vertical stems (see above) are central to Armenian, Cyrillic, Greek,
+ * and Latin type designs. Even when the rasterizer uses greyscale
+ * antialiasing instead of color (a necessary compromise when one
+ * doesn't know the screen characteristics), the unhinted vertical
+ * features preserve the design's weight and spacing much better than
+ * aliased type would.
+ *
+ * 2) Alignment in the vertical direction: Weights and spacing along the
+ * y~axis are less critical; what is much more important is the visual
+ * alignment of related features (like cap-height and x-height). The
+ * sense of alignment for these is enhanced by the sharpness of grid-fit
+ * edges, while the cruder vertical resolution (full pixels instead of
+ * 1/3 pixels) is less of a problem.
+ *
+ * On the technical side, horizontal alignment zones for ascender,
+ * x-height, and other important height values (traditionally called
+ * `blue zones') as defined in the font are positioned independently,
+ * each being rounded to the nearest pixel edge, taking care of
+ * overshoot suppression at small sizes, stem darkening, and scaling.
+ *
+ * Hstems (this is, hint values defined in the font to help align
+ * horizontal features) that fall within a blue zone are said to be
+ * `captured' and are aligned to that zone. Uncaptured stems are moved
+ * in one of four ways, top edge up or down, bottom edge up or down.
+ * Unless there are conflicting hstems, the smallest movement is taken
+ * to minimize distortion.
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * pcf_driver
+ *
+ * @title:
+ * The PCF driver
+ *
+ * @abstract:
+ * Controlling the PCF driver module.
+ *
+ * @description:
+ * While FreeType's PCF driver doesn't expose API functions by itself,
+ * it is possible to control its behaviour with @FT_Property_Set and
+ * @FT_Property_Get. Right now, there is a single property
+ * @no-long-family-names available if FreeType is compiled with
+ * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.
+ *
+ * The PCF driver's module name is `pcf'.
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * t1_cid_driver
+ *
+ * @title:
+ * The Type 1 and CID drivers
+ *
+ * @abstract:
+ * Controlling the Type~1 and CID driver modules.
+ *
+ * @description:
+ * It is possible to control the behaviour of FreeType's Type~1 and
+ * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get.
+ *
+ * Behind the scenes, both drivers use the Adobe CFF engine for hinting;
+ * however, the used properties must be specified separately.
+ *
+ * The Type~1 driver's module name is `type1'; the CID driver's module
+ * name is `t1cid'.
+ *
+ * Available properties are @hinting-engine, @no-stem-darkening,
+ * @darkening-parameters, and @random-seed, as documented in the
+ * @properties section.
+ *
+ * Please see the @cff_driver section for more details on the new
+ * hinting engine.
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * tt_driver
+ *
+ * @title:
+ * The TrueType driver
+ *
+ * @abstract:
+ * Controlling the TrueType driver module.
+ *
+ * @description:
+ * While FreeType's TrueType driver doesn't expose API functions by
+ * itself, it is possible to control its behaviour with @FT_Property_Set
+ * and @FT_Property_Get. The following lists the available properties
+ * together with the necessary macros and structures.
+ *
+ * The TrueType driver's module name is `truetype'.
+ *
+ * A single property @interpreter-version is available, as documented in
+ * the @properties section.
+ *
+ * We start with a list of definitions, kindly provided by Greg
+ * Hitchcock.
+ *
+ * _Bi-Level_ _Rendering_
+ *
+ * Monochromatic rendering, exclusively used in the early days of
+ * TrueType by both Apple and Microsoft. Microsoft's GDI interface
+ * supported hinting of the right-side bearing point, such that the
+ * advance width could be non-linear. Most often this was done to
+ * achieve some level of glyph symmetry. To enable reasonable
+ * performance (e.g., not having to run hinting on all glyphs just to
+ * get the widths) there was a bit in the head table indicating if the
+ * side bearing was hinted, and additional tables, `hdmx' and `LTSH', to
+ * cache hinting widths across multiple sizes and device aspect ratios.
+ *
+ * _Font_ _Smoothing_
+ *
+ * Microsoft's GDI implementation of anti-aliasing. Not traditional
+ * anti-aliasing as the outlines were hinted before the sampling. The
+ * widths matched the bi-level rendering.
+ *
+ * _ClearType_ _Rendering_
+ *
+ * Technique that uses physical subpixels to improve rendering on LCD
+ * (and other) displays. Because of the higher resolution, many methods
+ * of improving symmetry in glyphs through hinting the right-side
+ * bearing were no longer necessary. This lead to what GDI calls
+ * `natural widths' ClearType, see
+ * http://www.beatstamm.com/typography/RTRCh4.htm#Sec21. Since hinting
+ * has extra resolution, most non-linearity went away, but it is still
+ * possible for hints to change the advance widths in this mode.
+ *
+ * _ClearType_ _Compatible_ _Widths_
+ *
+ * One of the earliest challenges with ClearType was allowing the
+ * implementation in GDI to be selected without requiring all UI and
+ * documents to reflow. To address this, a compatible method of
+ * rendering ClearType was added where the font hints are executed once
+ * to determine the width in bi-level rendering, and then re-run in
+ * ClearType, with the difference in widths being absorbed in the font
+ * hints for ClearType (mostly in the white space of hints); see
+ * http://www.beatstamm.com/typography/RTRCh4.htm#Sec20. Somewhat by
+ * definition, compatible width ClearType allows for non-linear widths,
+ * but only when the bi-level version has non-linear widths.
+ *
+ * _ClearType_ _Subpixel_ _Positioning_
+ *
+ * One of the nice benefits of ClearType is the ability to more crisply
+ * display fractional widths; unfortunately, the GDI model of integer
+ * bitmaps did not support this. However, the WPF and Direct Write
+ * frameworks do support fractional widths. DWrite calls this `natural
+ * mode', not to be confused with GDI's `natural widths'. Subpixel
+ * positioning, in the current implementation of Direct Write,
+ * unfortunately does not support hinted advance widths, see
+ * http://www.beatstamm.com/typography/RTRCh4.htm#Sec22. Note that the
+ * TrueType interpreter fully allows the advance width to be adjusted in
+ * this mode, just the DWrite client will ignore those changes.
+ *
+ * _ClearType_ _Backward_ _Compatibility_
+ *
+ * This is a set of exceptions made in the TrueType interpreter to
+ * minimize hinting techniques that were problematic with the extra
+ * resolution of ClearType; see
+ * http://www.beatstamm.com/typography/RTRCh4.htm#Sec1 and
+ * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx.
+ * This technique is not to be confused with ClearType compatible
+ * widths. ClearType backward compatibility has no direct impact on
+ * changing advance widths, but there might be an indirect impact on
+ * disabling some deltas. This could be worked around in backward
+ * compatibility mode.
+ *
+ * _Native_ _ClearType_ _Mode_
+ *
+ * (Not to be confused with `natural widths'.) This mode removes all
+ * the exceptions in the TrueType interpreter when running with
+ * ClearType. Any issues on widths would still apply, though.
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * properties
+ *
+ * @title:
+ * Driver properties
+ *
+ * @abstract:
+ * Controlling driver modules.
+ *
+ * @description:
+ * Driver modules can be controlled by setting and unsetting properties,
+ * using the functions @FT_Property_Set and @FT_Property_Get. This
+ * section documents the available properties, together with auxiliary
+ * macros and structures.
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @enum:
+ * FT_HINTING_XXX
+ *
+ * @description:
+ * A list of constants used for the @hinting-engine property to
+ * select the hinting engine for CFF, Type~1, and CID fonts.
+ *
+ * @values:
+ * FT_HINTING_FREETYPE ::
+ * Use the old FreeType hinting engine.
+ *
+ * FT_HINTING_ADOBE ::
+ * Use the hinting engine contributed by Adobe.
+ *
+ * @since:
+ * 2.9
+ *
+ */
+#define FT_HINTING_FREETYPE 0
+#define FT_HINTING_ADOBE 1
+
+ /* these constants (introduced in 2.4.12) are deprecated */
+#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE
+#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * hinting-engine
+ *
+ * @description:
+ * Thanks to Adobe, which contributed a new hinting (and parsing)
+ * engine, an application can select between `freetype' and `adobe' if
+ * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration
+ * macro isn't defined, `hinting-engine' does nothing.
+ *
+ * The same holds for the Type~1 and CID modules if compiled with
+ * T1_CONFIG_OPTION_OLD_ENGINE.
+ *
+ * For the `cff' module, the default engine is `freetype' if
+ * CFF_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe' otherwise.
+ *
+ * For both the `type1' and `t1cid' modules, the default engine is
+ * `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is defined, and `adobe'
+ * otherwise.
+ *
+ * The following example code demonstrates how to select Adobe's hinting
+ * engine for the `cff' module (omitting the error handling).
+ *
+ * {
+ * FT_Library library;
+ * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "cff",
+ * "hinting-engine", &hinting_engine );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable (using values `adobe' or `freetype').
+ *
+ * @since:
+ * 2.4.12 (for `cff' module)
+ *
+ * 2.9 (for `type1' and `t1cid' modules)
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * no-stem-darkening
+ *
+ * @description:
+ * All glyphs that pass through the auto-hinter will be emboldened
+ * unless this property is set to TRUE. The same is true for the CFF,
+ * Type~1, and CID font modules if the `Adobe' engine is selected (which
+ * is the default).
+ *
+ * Stem darkening emboldens glyphs at smaller sizes to make them more
+ * readable on common low-DPI screens when using linear alpha blending
+ * and gamma correction, see @FT_Render_Glyph. When not using linear
+ * alpha blending and gamma correction, glyphs will appear heavy and
+ * fuzzy!
+ *
+ * Gamma correction essentially lightens fonts since shades of grey are
+ * shifted to higher pixel values (=~higher brightness) to match the
+ * original intention to the reality of our screens. The side-effect is
+ * that glyphs `thin out'. Mac OS~X and Adobe's proprietary font
+ * rendering library implement a counter-measure: stem darkening at
+ * smaller sizes where shades of gray dominate. By emboldening a glyph
+ * slightly in relation to its pixel size, individual pixels get higher
+ * coverage of filled-in outlines and are therefore `blacker'. This
+ * counteracts the `thinning out' of glyphs, making text remain readable
+ * at smaller sizes.
+ *
+ * By default, the Adobe engines for CFF, Type~1, and CID fonts darken
+ * stems at smaller sizes, regardless of hinting, to enhance contrast.
+ * Setting this property, stem darkening gets switched off.
+ *
+ * For the auto-hinter, stem-darkening is experimental currently and
+ * thus switched off by default (this is, `no-stem-darkening' is set to
+ * TRUE by default). Total consistency with the CFF driver is not
+ * achieved right now because the emboldening method differs and glyphs
+ * must be scaled down on the Y-axis to keep outline points inside their
+ * precomputed blue zones. The smaller the size (especially 9ppem and
+ * down), the higher the loss of emboldening versus the CFF driver.
+ *
+ * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is
+ * set.
+ *
+ * {
+ * FT_Library library;
+ * FT_Bool no_stem_darkening = TRUE;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "cff",
+ * "no-stem-darkening", &no_stem_darkening );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable (using values 1 and 0 for `on' and `off', respectively).
+ * It can also be set per face using @FT_Face_Properties with
+ * @FT_PARAM_TAG_STEM_DARKENING.
+ *
+ * @since:
+ * 2.4.12 (for `cff' module)
+ *
+ * 2.6.2 (for `autofitter' module)
+ *
+ * 2.9 (for `type1' and `t1cid' modules)
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * darkening-parameters
+ *
+ * @description:
+ * By default, the Adobe hinting engine, as used by the CFF, Type~1, and
+ * CID font drivers, darkens stems as follows (if the
+ * `no-stem-darkening' property isn't set):
+ *
+ * {
+ * stem width <= 0.5px: darkening amount = 0.4px
+ * stem width = 1px: darkening amount = 0.275px
+ * stem width = 1.667px: darkening amount = 0.275px
+ * stem width >= 2.333px: darkening amount = 0px
+ * }
+ *
+ * and piecewise linear in-between. At configuration time, these four
+ * control points can be set with the macro
+ * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS'; the CFF, Type~1, and CID
+ * drivers share these values. At runtime, the control points can be
+ * changed using the `darkening-parameters' property, as the following
+ * example demonstrates for the Type~1 driver.
+ *
+ * {
+ * FT_Library library;
+ * FT_Int darken_params[8] = { 500, 300, // x1, y1
+ * 1000, 200, // x2, y2
+ * 1500, 100, // x3, y3
+ * 2000, 0 }; // x4, y4
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "type1",
+ * "darkening-parameters", darken_params );
+ * }
+ *
+ * The x~values give the stem width, and the y~values the darkening
+ * amount. The unit is 1000th of pixels. All coordinate values must be
+ * positive; the x~values must be monotonically increasing; the
+ * y~values must be monotonically decreasing and smaller than or
+ * equal to 500 (corresponding to half a pixel); the slope of each
+ * linear piece must be shallower than -1 (e.g., -.4).
+ *
+ * The auto-hinter provides this property, too, as an experimental
+ * feature. See @no-stem-darkening for more.
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable, using eight comma-separated integers without spaces. Here
+ * the above example, using `\' to break the line for readability.
+ *
+ * {
+ * FREETYPE_PROPERTIES=\
+ * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0
+ * }
+ *
+ * @since:
+ * 2.5.1 (for `cff' module)
+ *
+ * 2.6.2 (for `autofitter' module)
+ *
+ * 2.9 (for `type1' and `t1cid' modules)
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * random-seed
+ *
+ * @description:
+ * By default, the seed value for the CFF `random' operator and the
+ * similar `0 28 callothersubr pop' command for the Type~1 and CID
+ * drivers is set to a random value. However, mainly for debugging
+ * purposes, it is often necessary to use a known value as a seed so
+ * that the pseudo-random number sequences generated by `random' are
+ * repeatable.
+ *
+ * The `random-seed' property does that. Its argument is a signed 32bit
+ * integer; if the value is zero or negative, the seed given by the
+ * `intitialRandomSeed' private DICT operator in a CFF file gets used
+ * (or a default value if there is no such operator). If the value is
+ * positive, use it instead of `initialRandomSeed', which is
+ * consequently ignored.
+ *
+ * @note:
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable. It can also be set per face using @FT_Face_Properties with
+ * @FT_PARAM_TAG_RANDOM_SEED.
+ *
+ * @since:
+ * 2.8 (for `cff' module)
+ *
+ * 2.9 (for `type1' and `t1cid' modules)
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * no-long-family-names
+ *
+ * @description:
+ * If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling
+ * FreeType, the PCF driver constructs long family names.
+ *
+ * There are many PCF fonts just called `Fixed' which look completely
+ * different, and which have nothing to do with each other. When
+ * selecting `Fixed' in KDE or Gnome one gets results that appear rather
+ * random, the style changes often if one changes the size and one
+ * cannot select some fonts at all. The improve this situation, the PCF
+ * module prepends the foundry name (plus a space) to the family name.
+ * It also checks whether there are `wide' characters; all put together,
+ * family names like `Sony Fixed' or `Misc Fixed Wide' are constructed.
+ *
+ * If `no-long-family-names' is set, this feature gets switched off.
+ *
+ * {
+ * FT_Library library;
+ * FT_Bool no_long_family_names = TRUE;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "pcf",
+ * "no-long-family-names",
+ * &no_long_family_names );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable (using values 1 and 0 for `on' and `off', respectively).
+ *
+ * @since:
+ * 2.8
+ */
+
+
+ /**************************************************************************
+ *
+ * @enum:
+ * TT_INTERPRETER_VERSION_XXX
+ *
+ * @description:
+ * A list of constants used for the @interpreter-version property to
+ * select the hinting engine for Truetype fonts.
+ *
+ * The numeric value in the constant names represents the version
+ * number as returned by the `GETINFO' bytecode instruction.
+ *
+ * @values:
+ * TT_INTERPRETER_VERSION_35 ::
+ * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in
+ * Windows~98; only grayscale and B/W rasterizing is supported.
+ *
+ * TT_INTERPRETER_VERSION_38 ::
+ * Version~38 corresponds to MS rasterizer v.1.9; it is roughly
+ * equivalent to the hinting provided by DirectWrite ClearType (as can
+ * be found, for example, in the Internet Explorer~9 running on
+ * Windows~7). It is used in FreeType to select the `Infinality'
+ * subpixel hinting code. The code may be removed in a future
+ * version.
+ *
+ * TT_INTERPRETER_VERSION_40 ::
+ * Version~40 corresponds to MS rasterizer v.2.1; it is roughly
+ * equivalent to the hinting provided by DirectWrite ClearType (as can
+ * be found, for example, in Microsoft's Edge Browser on Windows~10).
+ * It is used in FreeType to select the `minimal' subpixel hinting
+ * code, a stripped-down and higher performance version of the
+ * `Infinality' code.
+ *
+ * @note:
+ * This property controls the behaviour of the bytecode interpreter
+ * and thus how outlines get hinted. It does *not* control how glyph
+ * get rasterized! In particular, it does not control subpixel color
+ * filtering.
+ *
+ * If FreeType has not been compiled with the configuration option
+ * TT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 or~40 causes
+ * an `FT_Err_Unimplemented_Feature' error.
+ *
+ * Depending on the graphics framework, Microsoft uses different
+ * bytecode and rendering engines. As a consequence, the version
+ * numbers returned by a call to the `GETINFO' bytecode instruction are
+ * more convoluted than desired.
+ *
+ * Here are two tables that try to shed some light on the possible
+ * values for the MS rasterizer engine, together with the additional
+ * features introduced by it.
+ *
+ * {
+ * GETINFO framework version feature
+ * -------------------------------------------------------------------
+ * 3 GDI (Win 3.1), v1.0 16-bit, first version
+ * TrueImage
+ * 33 GDI (Win NT 3.1), v1.5 32-bit
+ * HP Laserjet
+ * 34 GDI (Win 95) v1.6 font smoothing,
+ * new SCANTYPE opcode
+ * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET
+ * bits in composite glyphs
+ * 36 MGDI (Win CE 2) v1.6+ classic ClearType
+ * 37 GDI (XP and later), v1.8 ClearType
+ * GDI+ old (before Vista)
+ * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType,
+ * WPF Y-direction ClearType,
+ * additional error checking
+ * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags
+ * in GETINFO opcode,
+ * bug fixes
+ * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag
+ * DWrite (Win 8) in GETINFO opcode,
+ * Gray ClearType
+ * }
+ *
+ * The `version' field gives a rough orientation only, since some
+ * applications provided certain features much earlier (as an example,
+ * Microsoft Reader used subpixel and Y-direction ClearType already in
+ * Windows 2000). Similarly, updates to a given framework might include
+ * improved hinting support.
+ *
+ * {
+ * version sampling rendering comment
+ * x y x y
+ * --------------------------------------------------------------
+ * v1.0 normal normal B/W B/W bi-level
+ * v1.6 high high gray gray grayscale
+ * v1.8 high normal color-filter B/W (GDI) ClearType
+ * v1.9 high high color-filter gray Color ClearType
+ * v2.1 high normal gray B/W Gray ClearType
+ * v2.1 high high gray gray Gray ClearType
+ * }
+ *
+ * Color and Gray ClearType are the two available variants of
+ * `Y-direction ClearType', meaning grayscale rasterization along the
+ * Y-direction; the name used in the TrueType specification for this
+ * feature is `symmetric smoothing'. `Classic ClearType' is the
+ * original algorithm used before introducing a modified version in
+ * Win~XP. Another name for v1.6's grayscale rendering is `font
+ * smoothing', and `Color ClearType' is sometimes also called `DWrite
+ * ClearType'. To differentiate between today's Color ClearType and the
+ * earlier ClearType variant with B/W rendering along the vertical axis,
+ * the latter is sometimes called `GDI ClearType'.
+ *
+ * `Normal' and `high' sampling describe the (virtual) resolution to
+ * access the rasterized outline after the hinting process. `Normal'
+ * means 1 sample per grid line (i.e., B/W). In the current Microsoft
+ * implementation, `high' means an extra virtual resolution of 16x16 (or
+ * 16x1) grid lines per pixel for bytecode instructions like `MIRP'.
+ * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid
+ * lines for color filtering if Color ClearType is activated.
+ *
+ * Note that `Gray ClearType' is essentially the same as v1.6's
+ * grayscale rendering. However, the GETINFO instruction handles it
+ * differently: v1.6 returns bit~12 (hinting for grayscale), while v2.1
+ * returns bits~13 (hinting for ClearType), 18 (symmetrical smoothing),
+ * and~19 (Gray ClearType). Also, this mode respects bits 2 and~3 for
+ * the version~1 gasp table exclusively (like Color ClearType), while
+ * v1.6 only respects the values of version~0 (bits 0 and~1).
+ *
+ * Keep in mind that the features of the above interpreter versions
+ * might not map exactly to FreeType features or behavior because it is
+ * a fundamentally different library with different internals.
+ *
+ */
+#define TT_INTERPRETER_VERSION_35 35
+#define TT_INTERPRETER_VERSION_38 38
+#define TT_INTERPRETER_VERSION_40 40
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * interpreter-version
+ *
+ * @description:
+ * Currently, three versions are available, two representing the
+ * bytecode interpreter with subpixel hinting support (old `Infinality'
+ * code and new stripped-down and higher performance `minimal' code) and
+ * one without, respectively. The default is subpixel support if
+ * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support
+ * otherwise (since it isn't available then).
+ *
+ * If subpixel hinting is on, many TrueType bytecode instructions behave
+ * differently compared to B/W or grayscale rendering (except if `native
+ * ClearType' is selected by the font). Microsoft's main idea is to
+ * render at a much increased horizontal resolution, then sampling down
+ * the created output to subpixel precision. However, many older fonts
+ * are not suited to this and must be specially taken care of by
+ * applying (hardcoded) tweaks in Microsoft's interpreter.
+ *
+ * Details on subpixel hinting and some of the necessary tweaks can be
+ * found in Greg Hitchcock's whitepaper at
+ * `https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.
+ * Note that FreeType currently doesn't really `subpixel hint' (6x1, 6x2,
+ * or 6x5 supersampling) like discussed in the paper. Depending on the
+ * chosen interpreter, it simply ignores instructions on vertical stems
+ * to arrive at very similar results.
+ *
+ * The following example code demonstrates how to deactivate subpixel
+ * hinting (omitting the error handling).
+ *
+ * {
+ * FT_Library library;
+ * FT_Face face;
+ * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "truetype",
+ * "interpreter-version",
+ * &interpreter_version );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable (using values `35', `38', or `40').
+ *
+ * @since:
+ * 2.5
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * glyph-to-script-map
+ *
+ * @description:
+ * *Experimental* *only*
+ *
+ * The auto-hinter provides various script modules to hint glyphs.
+ * Examples of supported scripts are Latin or CJK. Before a glyph is
+ * auto-hinted, the Unicode character map of the font gets examined, and
+ * the script is then determined based on Unicode character ranges, see
+ * below.
+ *
+ * OpenType fonts, however, often provide much more glyphs than
+ * character codes (small caps, superscripts, ligatures, swashes, etc.),
+ * to be controlled by so-called `features'. Handling OpenType features
+ * can be quite complicated and thus needs a separate library on top of
+ * FreeType.
+ *
+ * The mapping between glyph indices and scripts (in the auto-hinter
+ * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an
+ * array with `num_glyphs' elements, as found in the font's @FT_Face
+ * structure. The `glyph-to-script-map' property returns a pointer to
+ * this array, which can be modified as needed. Note that the
+ * modification should happen before the first glyph gets processed by
+ * the auto-hinter so that the global analysis of the font shapes
+ * actually uses the modified mapping.
+ *
+ * The following example code demonstrates how to access it (omitting
+ * the error handling).
+ *
+ * {
+ * FT_Library library;
+ * FT_Face face;
+ * FT_Prop_GlyphToScriptMap prop;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ * FT_New_Face( library, "foo.ttf", 0, &face );
+ *
+ * prop.face = face;
+ *
+ * FT_Property_Get( library, "autofitter",
+ * "glyph-to-script-map", &prop );
+ *
+ * // adjust `prop.map' as needed right here
+ *
+ * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );
+ * }
+ *
+ * @since:
+ * 2.4.11
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @enum:
+ * FT_AUTOHINTER_SCRIPT_XXX
+ *
+ * @description:
+ * *Experimental* *only*
+ *
+ * A list of constants used for the @glyph-to-script-map property to
+ * specify the script submodule the auto-hinter should use for hinting a
+ * particular glyph.
+ *
+ * @values:
+ * FT_AUTOHINTER_SCRIPT_NONE ::
+ * Don't auto-hint this glyph.
+ *
+ * FT_AUTOHINTER_SCRIPT_LATIN ::
+ * Apply the latin auto-hinter. For the auto-hinter, `latin' is a
+ * very broad term, including Cyrillic and Greek also since characters
+ * from those scripts share the same design constraints.
+ *
+ * By default, characters from the following Unicode ranges are
+ * assigned to this submodule.
+ *
+ * {
+ * U+0020 - U+007F // Basic Latin (no control characters)
+ * U+00A0 - U+00FF // Latin-1 Supplement (no control characters)
+ * U+0100 - U+017F // Latin Extended-A
+ * U+0180 - U+024F // Latin Extended-B
+ * U+0250 - U+02AF // IPA Extensions
+ * U+02B0 - U+02FF // Spacing Modifier Letters
+ * U+0300 - U+036F // Combining Diacritical Marks
+ * U+0370 - U+03FF // Greek and Coptic
+ * U+0400 - U+04FF // Cyrillic
+ * U+0500 - U+052F // Cyrillic Supplement
+ * U+1D00 - U+1D7F // Phonetic Extensions
+ * U+1D80 - U+1DBF // Phonetic Extensions Supplement
+ * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement
+ * U+1E00 - U+1EFF // Latin Extended Additional
+ * U+1F00 - U+1FFF // Greek Extended
+ * U+2000 - U+206F // General Punctuation
+ * U+2070 - U+209F // Superscripts and Subscripts
+ * U+20A0 - U+20CF // Currency Symbols
+ * U+2150 - U+218F // Number Forms
+ * U+2460 - U+24FF // Enclosed Alphanumerics
+ * U+2C60 - U+2C7F // Latin Extended-C
+ * U+2DE0 - U+2DFF // Cyrillic Extended-A
+ * U+2E00 - U+2E7F // Supplemental Punctuation
+ * U+A640 - U+A69F // Cyrillic Extended-B
+ * U+A720 - U+A7FF // Latin Extended-D
+ * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures)
+ * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols
+ * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement
+ * }
+ *
+ * FT_AUTOHINTER_SCRIPT_CJK ::
+ * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old
+ * Vietnamese, and some other scripts.
+ *
+ * By default, characters from the following Unicode ranges are
+ * assigned to this submodule.
+ *
+ * {
+ * U+1100 - U+11FF // Hangul Jamo
+ * U+2E80 - U+2EFF // CJK Radicals Supplement
+ * U+2F00 - U+2FDF // Kangxi Radicals
+ * U+2FF0 - U+2FFF // Ideographic Description Characters
+ * U+3000 - U+303F // CJK Symbols and Punctuation
+ * U+3040 - U+309F // Hiragana
+ * U+30A0 - U+30FF // Katakana
+ * U+3100 - U+312F // Bopomofo
+ * U+3130 - U+318F // Hangul Compatibility Jamo
+ * U+3190 - U+319F // Kanbun
+ * U+31A0 - U+31BF // Bopomofo Extended
+ * U+31C0 - U+31EF // CJK Strokes
+ * U+31F0 - U+31FF // Katakana Phonetic Extensions
+ * U+3200 - U+32FF // Enclosed CJK Letters and Months
+ * U+3300 - U+33FF // CJK Compatibility
+ * U+3400 - U+4DBF // CJK Unified Ideographs Extension A
+ * U+4DC0 - U+4DFF // Yijing Hexagram Symbols
+ * U+4E00 - U+9FFF // CJK Unified Ideographs
+ * U+A960 - U+A97F // Hangul Jamo Extended-A
+ * U+AC00 - U+D7AF // Hangul Syllables
+ * U+D7B0 - U+D7FF // Hangul Jamo Extended-B
+ * U+F900 - U+FAFF // CJK Compatibility Ideographs
+ * U+FE10 - U+FE1F // Vertical forms
+ * U+FE30 - U+FE4F // CJK Compatibility Forms
+ * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms
+ * U+1B000 - U+1B0FF // Kana Supplement
+ * U+1D300 - U+1D35F // Tai Xuan Hing Symbols
+ * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement
+ * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B
+ * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C
+ * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D
+ * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement
+ * }
+ *
+ * FT_AUTOHINTER_SCRIPT_INDIC ::
+ * Apply the indic auto-hinter, covering all major scripts from the
+ * Indian sub-continent and some other related scripts like Thai, Lao,
+ * or Tibetan.
+ *
+ * By default, characters from the following Unicode ranges are
+ * assigned to this submodule.
+ *
+ * {
+ * U+0900 - U+0DFF // Indic Range
+ * U+0F00 - U+0FFF // Tibetan
+ * U+1900 - U+194F // Limbu
+ * U+1B80 - U+1BBF // Sundanese
+ * U+A800 - U+A82F // Syloti Nagri
+ * U+ABC0 - U+ABFF // Meetei Mayek
+ * U+11800 - U+118DF // Sharada
+ * }
+ *
+ * Note that currently Indic support is rudimentary only, missing blue
+ * zone support.
+ *
+ * @since:
+ * 2.4.11
+ *
+ */
+#define FT_AUTOHINTER_SCRIPT_NONE 0
+#define FT_AUTOHINTER_SCRIPT_LATIN 1
+#define FT_AUTOHINTER_SCRIPT_CJK 2
+#define FT_AUTOHINTER_SCRIPT_INDIC 3
+
+
+ /**************************************************************************
+ *
+ * @struct:
+ * FT_Prop_GlyphToScriptMap
+ *
+ * @description:
+ * *Experimental* *only*
+ *
+ * The data exchange structure for the @glyph-to-script-map property.
+ *
+ * @since:
+ * 2.4.11
+ *
+ */
+ typedef struct FT_Prop_GlyphToScriptMap_
+ {
+ FT_Face face;
+ FT_UShort* map;
+
+ } FT_Prop_GlyphToScriptMap;
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * fallback-script
+ *
+ * @description:
+ * *Experimental* *only*
+ *
+ * If no auto-hinter script module can be assigned to a glyph, a
+ * fallback script gets assigned to it (see also the
+ * @glyph-to-script-map property). By default, this is
+ * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property,
+ * this fallback value can be changed.
+ *
+ * {
+ * FT_Library library;
+ * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "autofitter",
+ * "fallback-script", &fallback_script );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * It's important to use the right timing for changing this value: The
+ * creation of the glyph-to-script map that eventually uses the
+ * fallback script value gets triggered either by setting or reading a
+ * face-specific property like @glyph-to-script-map, or by auto-hinting
+ * any glyph from that face. In particular, if you have already created
+ * an @FT_Face structure but not loaded any glyph (using the
+ * auto-hinter), a change of the fallback script will affect this face.
+ *
+ * @since:
+ * 2.4.11
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * default-script
+ *
+ * @description:
+ * *Experimental* *only*
+ *
+ * If FreeType gets compiled with FT_CONFIG_OPTION_USE_HARFBUZZ to make
+ * the HarfBuzz library access OpenType features for getting better
+ * glyph coverages, this property sets the (auto-fitter) script to be
+ * used for the default (OpenType) script data of a font's GSUB table.
+ * Features for the default script are intended for all scripts not
+ * explicitly handled in GSUB; an example is a `dlig' feature,
+ * containing the combination of the characters `T', `E', and `L' to
+ * form a `TEL' ligature.
+ *
+ * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the
+ * `default-script' property, this default value can be changed.
+ *
+ * {
+ * FT_Library library;
+ * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "autofitter",
+ * "default-script", &default_script );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * It's important to use the right timing for changing this value: The
+ * creation of the glyph-to-script map that eventually uses the
+ * default script value gets triggered either by setting or reading a
+ * face-specific property like @glyph-to-script-map, or by auto-hinting
+ * any glyph from that face. In particular, if you have already created
+ * an @FT_Face structure but not loaded any glyph (using the
+ * auto-hinter), a change of the default script will affect this face.
+ *
+ * @since:
+ * 2.5.3
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * increase-x-height
+ *
+ * @description:
+ * For ppem values in the range 6~<= ppem <= `increase-x-height', round
+ * up the font's x~height much more often than normally. If the value
+ * is set to~0, which is the default, this feature is switched off. Use
+ * this property to improve the legibility of small font sizes if
+ * necessary.
+ *
+ * {
+ * FT_Library library;
+ * FT_Face face;
+ * FT_Prop_IncreaseXHeight prop;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ * FT_New_Face( library, "foo.ttf", 0, &face );
+ * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );
+ *
+ * prop.face = face;
+ * prop.limit = 14;
+ *
+ * FT_Property_Set( library, "autofitter",
+ * "increase-x-height", &prop );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * Set this value right after calling @FT_Set_Char_Size, but before
+ * loading any glyph (using the auto-hinter).
+ *
+ * @since:
+ * 2.4.11
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @struct:
+ * FT_Prop_IncreaseXHeight
+ *
+ * @description:
+ * The data exchange structure for the @increase-x-height property.
+ *
+ */
+ typedef struct FT_Prop_IncreaseXHeight_
+ {
+ FT_Face face;
+ FT_UInt limit;
+
+ } FT_Prop_IncreaseXHeight;
+
+
+ /**************************************************************************
+ *
+ * @property:
+ * warping
+ *
+ * @description:
+ * *Experimental* *only*
+ *
+ * If FreeType gets compiled with option AF_CONFIG_OPTION_USE_WARPER to
+ * activate the warp hinting code in the auto-hinter, this property
+ * switches warping on and off.
+ *
+ * Warping only works in `normal' auto-hinting mode replacing it.
+ * The idea of the code is to slightly scale and shift a glyph along
+ * the non-hinted dimension (which is usually the horizontal axis) so
+ * that as much of its segments are aligned (more or less) to the grid.
+ * To find out a glyph's optimal scaling and shifting value, various
+ * parameter combinations are tried and scored.
+ *
+ * By default, warping is off. The example below shows how to switch on
+ * warping (omitting the error handling).
+ *
+ * {
+ * FT_Library library;
+ * FT_Bool warping = 1;
+ *
+ *
+ * FT_Init_FreeType( &library );
+ *
+ * FT_Property_Set( library, "autofitter",
+ * "warping", &warping );
+ * }
+ *
+ * @note:
+ * This property can be used with @FT_Property_Get also.
+ *
+ * This property can be set via the `FREETYPE_PROPERTIES' environment
+ * variable (using values 1 and 0 for `on' and `off', respectively).
+ *
+ * The warping code can also change advance widths. Have a look at the
+ * `lsb_delta' and `rsb_delta' fields in the @FT_GlyphSlotRec structure
+ * for details on improving inter-glyph distances while rendering.
+ *
+ * Since warping is a global property of the auto-hinter it is best to
+ * change its value before rendering any face. Otherwise, you should
+ * reload all faces that get auto-hinted in `normal' hinting mode.
+ *
+ * @since:
+ * 2.6
+ *
+ */
+
+
+ /* */
+
+
+FT_END_HEADER
+
+
+#endif /* FTDRIVER_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/fterrdef.h b/thirdparty/freetype/include/freetype/fterrdef.h
index 6a6dc85b87..8ffd346ca8 100644
--- a/thirdparty/freetype/include/freetype/fterrdef.h
+++ b/thirdparty/freetype/include/freetype/fterrdef.h
@@ -4,7 +4,7 @@
/* */
/* FreeType error codes (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/fterrors.h b/thirdparty/freetype/include/freetype/fterrors.h
index ae382c419f..f6ee5c24e2 100644
--- a/thirdparty/freetype/include/freetype/fterrors.h
+++ b/thirdparty/freetype/include/freetype/fterrors.h
@@ -4,7 +4,7 @@
/* */
/* FreeType error code handling (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftfntfmt.h b/thirdparty/freetype/include/freetype/ftfntfmt.h
index 337758328a..cc86efac23 100644
--- a/thirdparty/freetype/include/freetype/ftfntfmt.h
+++ b/thirdparty/freetype/include/freetype/ftfntfmt.h
@@ -4,7 +4,7 @@
/* */
/* Support functions for font formats. */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftgasp.h b/thirdparty/freetype/include/freetype/ftgasp.h
index ce18d64784..fc1248ff48 100644
--- a/thirdparty/freetype/include/freetype/ftgasp.h
+++ b/thirdparty/freetype/include/freetype/ftgasp.h
@@ -4,7 +4,7 @@
/* */
/* Access of TrueType's `gasp' table (specification). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -29,6 +29,9 @@
#endif
+FT_BEGIN_HEADER
+
+
/***************************************************************************
*
* @section:
@@ -131,6 +134,8 @@
/* */
+FT_END_HEADER
+
#endif /* FTGASP_H_ */
diff --git a/thirdparty/freetype/include/freetype/ftglyph.h b/thirdparty/freetype/include/freetype/ftglyph.h
index db1a2c8ba5..5f3fc009cd 100644
--- a/thirdparty/freetype/include/freetype/ftglyph.h
+++ b/thirdparty/freetype/include/freetype/ftglyph.h
@@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -347,10 +347,10 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Return a glyph's `control box'. The control box encloses all the */
- /* outline's points, including Bézier control points. Though it */
+ /* outline's points, including Bezier control points. Though it */
/* coincides with the exact bounding box for most glyphs, it can be */
/* slightly larger in some situations (like when rotating an outline */
- /* that contains Bézier outside arcs). */
+ /* that contains Bezier outside arcs). */
/* */
/* Computing the control box is very fast, while getting the bounding */
/* box can take much more time as it needs to walk over all segments */
diff --git a/thirdparty/freetype/include/freetype/ftgxval.h b/thirdparty/freetype/include/freetype/ftgxval.h
index f239c71eb1..8382d59954 100644
--- a/thirdparty/freetype/include/freetype/ftgxval.h
+++ b/thirdparty/freetype/include/freetype/ftgxval.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Masatake YAMATO, Redhat K.K, */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
@@ -101,15 +101,15 @@ FT_BEGIN_HEADER
* The number of tables checked in this module. Use it as a parameter
* for the `table-length' argument of function @FT_TrueTypeGX_Validate.
*/
-#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1)
+#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 )
/* */
/* Up to 0x1000 is used by otvalid.
Ox2xxx is reserved for feature OT extension. */
-#define FT_VALIDATE_GX_START 0x4000
-#define FT_VALIDATE_GX_BITFIELD( tag ) \
- ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
+#define FT_VALIDATE_GX_START 0x4000
+#define FT_VALIDATE_GX_BITFIELD( tag ) \
+ ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )
/**********************************************************************
diff --git a/thirdparty/freetype/include/freetype/ftgzip.h b/thirdparty/freetype/include/freetype/ftgzip.h
index bd5ceaab9f..db033da0ed 100644
--- a/thirdparty/freetype/include/freetype/ftgzip.h
+++ b/thirdparty/freetype/include/freetype/ftgzip.h
@@ -4,7 +4,7 @@
/* */
/* Gzip-compressed stream support. */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -129,6 +129,9 @@ FT_BEGIN_HEADER
* @note:
* This function may return `FT_Err_Unimplemented_Feature' if your build
* of FreeType was not compiled with zlib support.
+ *
+ * @since:
+ * 2.5.1
*/
FT_EXPORT( FT_Error )
FT_Gzip_Uncompress( FT_Memory memory,
diff --git a/thirdparty/freetype/include/freetype/ftimage.h b/thirdparty/freetype/include/freetype/ftimage.h
index 1c789e5a44..79ede1959d 100644
--- a/thirdparty/freetype/include/freetype/ftimage.h
+++ b/thirdparty/freetype/include/freetype/ftimage.h
@@ -5,7 +5,7 @@
/* FreeType glyph image formats and default raster interface */
/* (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -169,13 +169,13 @@ FT_BEGIN_HEADER
/* @FT_RENDER_MODE_LCD_V. */
/* */
/* FT_PIXEL_MODE_BGRA :: */
- /* An image with four 8-bit channels per pixel, representing a */
- /* color image (such as emoticons) with alpha channel. For each */
- /* pixel, the format is BGRA, which means, the blue channel comes */
- /* first in memory. The color channels are pre-multiplied and in */
- /* the sRGB colorspace. For example, full red at half-translucent */
- /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */
- /* See also @FT_LOAD_COLOR. */
+ /* [Since 2.5] An image with four 8-bit channels per pixel, */
+ /* representing a color image (such as emoticons) with alpha */
+ /* channel. For each pixel, the format is BGRA, which means, the */
+ /* blue channel comes first in memory. The color channels are */
+ /* pre-multiplied and in the sRGB colorspace. For example, full */
+ /* red at half-translucent opacity will be represented as */
+ /* `00,00,80,80', not `00,00,FF,80'. See also @FT_LOAD_COLOR. */
/* */
typedef enum FT_Pixel_Mode_
{
@@ -301,11 +301,11 @@ FT_BEGIN_HEADER
/* each outline point's type. */
/* */
/* If bit~0 is unset, the point is `off' the curve, */
- /* i.e., a Bézier control point, while it is `on' if */
+ /* i.e., a Bezier control point, while it is `on' if */
/* set. */
/* */
/* Bit~1 is meaningful for `off' points only. If set, */
- /* it indicates a third-order Bézier arc control point; */
+ /* it indicates a third-order Bezier arc control point; */
/* and a second-order control point if unset. */
/* */
/* If bit~2 is set, bits 5-7 contain the drop-out mode */
@@ -532,7 +532,7 @@ FT_BEGIN_HEADER
/* A function pointer type used to describe the signature of a `conic */
/* to' function during outline walking or decomposition. */
/* */
- /* A `conic to' is emitted to indicate a second-order Bézier arc in */
+ /* A `conic to' is emitted to indicate a second-order Bezier arc in */
/* the outline. */
/* */
/* <Input> */
@@ -564,12 +564,12 @@ FT_BEGIN_HEADER
/* A function pointer type used to describe the signature of a `cubic */
/* to' function during outline walking or decomposition. */
/* */
- /* A `cubic to' is emitted to indicate a third-order Bézier arc. */
+ /* A `cubic to' is emitted to indicate a third-order Bezier arc. */
/* */
/* <Input> */
- /* control1 :: A pointer to the first Bézier control point. */
+ /* control1 :: A pointer to the first Bezier control point. */
/* */
- /* control2 :: A pointer to the second Bézier control point. */
+ /* control2 :: A pointer to the second Bezier control point. */
/* */
/* to :: A pointer to the target end point. */
/* */
@@ -595,16 +595,16 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A structure to hold various function pointers used during outline */
- /* decomposition in order to emit segments, conic, and cubic Béziers. */
+ /* decomposition in order to emit segments, conic, and cubic Beziers. */
/* */
/* <Fields> */
/* move_to :: The `move to' emitter. */
/* */
/* line_to :: The segment emitter. */
/* */
- /* conic_to :: The second-order Bézier arc emitter. */
+ /* conic_to :: The second-order Bezier arc emitter. */
/* */
- /* cubic_to :: The third-order Bézier arc emitter. */
+ /* cubic_to :: The third-order Bezier arc emitter. */
/* */
/* shift :: The shift that is applied to coordinates before they */
/* are sent to the emitter. */
@@ -701,7 +701,7 @@ FT_BEGIN_HEADER
/* */
/* FT_GLYPH_FORMAT_OUTLINE :: */
/* The glyph image is a vectorial outline made of line segments */
- /* and Bézier arcs; it can be described as an @FT_Outline; you */
+ /* and Bezier arcs; it can be described as an @FT_Outline; you */
/* generally want to access the `outline' field of the */
/* @FT_GlyphSlotRec structure to read it. */
/* */
diff --git a/thirdparty/freetype/include/freetype/ftincrem.h b/thirdparty/freetype/include/freetype/ftincrem.h
index f6ae2baed6..44619f941e 100644
--- a/thirdparty/freetype/include/freetype/ftincrem.h
+++ b/thirdparty/freetype/include/freetype/ftincrem.h
@@ -4,7 +4,7 @@
/* */
/* FreeType incremental loading (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,6 +21,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -331,18 +332,6 @@ FT_BEGIN_HEADER
typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface;
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_INCREMENTAL
- *
- * @description:
- * A constant used as the tag of @FT_Parameter structures to indicate
- * an incremental loading object to be used by FreeType.
- *
- */
-#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
-
/* */
diff --git a/thirdparty/freetype/include/freetype/ftlcdfil.h b/thirdparty/freetype/include/freetype/ftlcdfil.h
index bdaf9af906..2a27196cbb 100644
--- a/thirdparty/freetype/include/freetype/ftlcdfil.h
+++ b/thirdparty/freetype/include/freetype/ftlcdfil.h
@@ -5,7 +5,7 @@
/* FreeType API for color filtering of subpixel bitmap glyphs */
/* (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -280,23 +281,6 @@ FT_BEGIN_HEADER
unsigned char *weights );
- /**************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_LCD_FILTER_WEIGHTS
- *
- * @description:
- * An @FT_Parameter tag to be used with @FT_Face_Properties. The
- * corresponding argument specifies the five LCD filter weights for a
- * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding
- * the global default values or the values set up with
- * @FT_Library_SetLcdFilterWeights.
- *
- */
-#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \
- FT_MAKE_TAG( 'l', 'c', 'd', 'f' )
-
-
/*
* @type:
* FT_LcdFiveTapFilter
@@ -305,6 +289,9 @@ FT_BEGIN_HEADER
* A typedef for passing the five LCD filter weights to
* @FT_Face_Properties within an @FT_Parameter structure.
*
+ * @since:
+ * 2.8
+ *
*/
#define FT_LCD_FILTER_FIVE_TAPS 5
diff --git a/thirdparty/freetype/include/freetype/ftlist.h b/thirdparty/freetype/include/freetype/ftlist.h
index 5309cb18ba..117473b96a 100644
--- a/thirdparty/freetype/include/freetype/ftlist.h
+++ b/thirdparty/freetype/include/freetype/ftlist.h
@@ -4,7 +4,7 @@
/* */
/* Generic list support for FreeType (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftlzw.h b/thirdparty/freetype/include/freetype/ftlzw.h
index a82c95e7c9..1615912d62 100644
--- a/thirdparty/freetype/include/freetype/ftlzw.h
+++ b/thirdparty/freetype/include/freetype/ftlzw.h
@@ -4,7 +4,7 @@
/* */
/* LZW-compressed stream support. */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftmac.h b/thirdparty/freetype/include/freetype/ftmac.h
index a1656eec0e..c1e497ca2d 100644
--- a/thirdparty/freetype/include/freetype/ftmac.h
+++ b/thirdparty/freetype/include/freetype/ftmac.h
@@ -4,7 +4,7 @@
/* */
/* Additional Mac-specific API. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftmm.h b/thirdparty/freetype/include/freetype/ftmm.h
index 80ac98d612..9948102c14 100644
--- a/thirdparty/freetype/include/freetype/ftmm.h
+++ b/thirdparty/freetype/include/freetype/ftmm.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Multiple Master font interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -286,7 +286,7 @@ FT_BEGIN_HEADER
/* <Output> */
/* amaster :: The variation descriptor. */
/* Allocates a data structure, which the user must */
- /* deallocate with `free' after use. */
+ /* deallocate with a call to @FT_Done_MM_Var after use. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
@@ -299,6 +299,26 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
+ /* FT_Done_MM_Var */
+ /* */
+ /* <Description> */
+ /* Free the memory allocated by @FT_Get_MM_Var. */
+ /* */
+ /* <Input> */
+ /* library :: A handle of the face's parent library object that was */
+ /* used in the call to @FT_Get_MM_Var to create `amaster'. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0~means success. */
+ /* */
+ FT_EXPORT( FT_Error )
+ FT_Done_MM_Var( FT_Library library,
+ FT_MM_Var *amaster );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* FT_Set_MM_Design_Coordinates */
/* */
/* <Description> */
@@ -323,9 +343,13 @@ FT_BEGIN_HEADER
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
- /* To reset all axes to the default values, call the function with */
- /* `num_coords' set to zero and `coords' set to NULL (new feature in */
- /* FreeType version 2.8.1). */
+ /* [Since 2.8.1] To reset all axes to the default values, call the */
+ /* function with `num_coords' set to zero and `coords' set to NULL. */
+ /* */
+ /* [Since 2.9] If `num_coords' is larger than zero, this function */
+ /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */
+ /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */
+ /* is zero, this bit flag gets unset. */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
@@ -358,9 +382,15 @@ FT_BEGIN_HEADER
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
- /* To reset all axes to the default values, call the function with */
- /* `num_coords' set to zero and `coords' set to NULL (new feature in */
- /* FreeType version 2.8.1). */
+ /* [Since 2.8.1] To reset all axes to the default values, call the */
+ /* function with `num_coords' set to zero and `coords' set to NULL. */
+ /* [Since 2.9] `Default values' means the currently selected named */
+ /* instance (or the base font if no named instance is selected). */
+ /* */
+ /* [Since 2.9] If `num_coords' is larger than zero, this function */
+ /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */
+ /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */
+ /* is zero, this bit flag gets unset. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Var_Design_Coordinates( FT_Face face,
@@ -392,6 +422,9 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Since> */
+ /* 2.7.1 */
+ /* */
FT_EXPORT( FT_Error )
FT_Get_Var_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
@@ -427,9 +460,15 @@ FT_BEGIN_HEADER
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
- /* To reset all axes to the default values, call the function with */
- /* `num_coords' set to zero and `coords' set to NULL (new feature in */
- /* FreeType version 2.8.1). */
+ /* [Since 2.8.1] To reset all axes to the default values, call the */
+ /* function with `num_coords' set to zero and `coords' set to NULL. */
+ /* [Since 2.9] `Default values' means the currently selected named */
+ /* instance (or the base font if no named instance is selected). */
+ /* */
+ /* [Since 2.9] If `num_coords' is larger than zero, this function */
+ /* sets the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags' */
+ /* field (i.e., @FT_IS_VARIATION will return true). If `num_coords' */
+ /* is zero, this bit flag gets unset. */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Blend_Coordinates( FT_Face face,
@@ -462,6 +501,9 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Since> */
+ /* 2.7.1 */
+ /* */
FT_EXPORT( FT_Error )
FT_Get_MM_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
@@ -490,6 +532,9 @@ FT_BEGIN_HEADER
/* <Description> */
/* This is another name of @FT_Get_MM_Blend_Coordinates. */
/* */
+ /* <Since> */
+ /* 2.7.1 */
+ /* */
FT_EXPORT( FT_Error )
FT_Get_Var_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
@@ -509,6 +554,9 @@ FT_BEGIN_HEADER
/* FT_VAR_AXIS_FLAG_HIDDEN :: */
/* The variation axis should not be exposed to user interfaces. */
/* */
+ /* <Since> */
+ /* 2.8.1 */
+ /* */
#define FT_VAR_AXIS_FLAG_HIDDEN 1
@@ -534,11 +582,51 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
+ /* <Since> */
+ /* 2.8.1 */
+ /* */
FT_EXPORT( FT_Error )
FT_Get_Var_Axis_Flags( FT_MM_Var* master,
FT_UInt axis_index,
FT_UInt* flags );
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Set_Named_Instance */
+ /* */
+ /* <Description> */
+ /* Set or change the current named instance. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the source face. */
+ /* */
+ /* instance_index :: The index of the requested instance, starting */
+ /* with value 1. If set to value 0, FreeType */
+ /* switches to font access without a named */
+ /* instance. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0~means success. */
+ /* */
+ /* <Note> */
+ /* The function uses the value of `instance_index' to set bits 16-30 */
+ /* of the face's `face_index' field. It also resets any variation */
+ /* applied to the font, and the @FT_FACE_FLAG_VARIATION bit of the */
+ /* face's `face_flags' field gets reset to zero (i.e., */
+ /* @FT_IS_VARIATION will return false). */
+ /* */
+ /* For Adobe MM fonts (which don't have named instances) this */
+ /* function simply resets the current face to the default instance. */
+ /* */
+ /* <Since> */
+ /* 2.9 */
+ /* */
+ FT_EXPORT( FT_Error )
+ FT_Set_Named_Instance( FT_Face face,
+ FT_UInt instance_index );
+
/* */
diff --git a/thirdparty/freetype/include/freetype/ftmodapi.h b/thirdparty/freetype/include/freetype/ftmodapi.h
index 4147aadf8b..a6eb876ebe 100644
--- a/thirdparty/freetype/include/freetype/ftmodapi.h
+++ b/thirdparty/freetype/include/freetype/ftmodapi.h
@@ -4,7 +4,7 @@
/* */
/* FreeType modules public interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -323,16 +323,15 @@ FT_BEGIN_HEADER
* The module name.
*
* property_name ::
- * The property name. Properties are described in the `Synopsis'
- * subsection of the module's documentation.
+ * The property name. Properties are described in section
+ * @properties.
*
* Note that only a few modules have properties.
*
* value ::
* A generic pointer to a variable or structure that gives the new
* value of the property. The exact definition of `value' is
- * dependent on the property; see the `Synopsis' subsection of the
- * module's documentation.
+ * dependent on the property; see section @properties.
*
* @return:
* FreeType error code. 0~means success.
@@ -390,15 +389,14 @@ FT_BEGIN_HEADER
* The module name.
*
* property_name ::
- * The property name. Properties are described in the `Synopsis'
- * subsection of the module's documentation.
+ * The property name. Properties are described in section
+ * @properties.
*
* @inout:
* value ::
* A generic pointer to a variable or structure that gives the
* value of the property. The exact definition of `value' is
- * dependent on the property; see the `Synopsis' subsection of the
- * module's documentation.
+ * dependent on the property; see section @properties.
*
* @return:
* FreeType error code. 0~means success.
@@ -446,8 +444,8 @@ FT_BEGIN_HEADER
/* <Description> */
/* If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is */
/* set, this function reads the `FREETYPE_PROPERTIES' environment */
- /* variable to control driver properties. See sections @auto_hinter, */
- /* @cff_driver, @pcf_driver, and @tt_driver for more. */
+ /* variable to control driver properties. See section @properties */
+ /* for more. */
/* */
/* If the compilation option is not set, this function does nothing. */
/* */
@@ -475,6 +473,9 @@ FT_BEGIN_HEADER
/* <InOut> */
/* library :: A handle to a new library object. */
/* */
+ /* <Since> */
+ /* 2.8 */
+ /* */
FT_EXPORT( void )
FT_Set_Default_Properties( FT_Library library );
diff --git a/thirdparty/freetype/include/freetype/ftmoderr.h b/thirdparty/freetype/include/freetype/ftmoderr.h
index 7f608375e8..e0fc1312bd 100644
--- a/thirdparty/freetype/include/freetype/ftmoderr.h
+++ b/thirdparty/freetype/include/freetype/ftmoderr.h
@@ -4,7 +4,7 @@
/* */
/* FreeType module error offsets (specification). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftotval.h b/thirdparty/freetype/include/freetype/ftotval.h
index b5d27cfe74..26731c2b9f 100644
--- a/thirdparty/freetype/include/freetype/ftotval.h
+++ b/thirdparty/freetype/include/freetype/ftotval.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for validating OpenType tables (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftoutln.h b/thirdparty/freetype/include/freetype/ftoutln.h
index 56f56a9603..89389a49b7 100644
--- a/thirdparty/freetype/include/freetype/ftoutln.h
+++ b/thirdparty/freetype/include/freetype/ftoutln.h
@@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -89,7 +89,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Walk over an outline's structure to decompose it into individual */
- /* segments and Bézier arcs. This function also emits `move to' */
+ /* segments and Bezier arcs. This function also emits `move to' */
/* operations to indicate the start of new contours in the outline. */
/* */
/* <Input> */
@@ -190,9 +190,6 @@ FT_BEGIN_HEADER
/* If the outline's `owner' field is not set, only the outline */
/* descriptor will be released. */
/* */
- /* The reason why this function takes an `library' parameter is */
- /* simply to use ft_mem_free(). */
- /* */
FT_EXPORT( FT_Error )
FT_Outline_Done( FT_Library library,
FT_Outline* outline );
@@ -232,10 +229,10 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Return an outline's `control box'. The control box encloses all */
- /* the outline's points, including Bézier control points. Though it */
+ /* the outline's points, including Bezier control points. Though it */
/* coincides with the exact bounding box for most glyphs, it can be */
/* slightly larger in some situations (like when rotating an outline */
- /* that contains Bézier outside arcs). */
+ /* that contains Bezier outside arcs). */
/* */
/* Computing the control box is very fast, while getting the bounding */
/* box can take much more time as it needs to walk over all segments */
diff --git a/thirdparty/freetype/include/freetype/ftparams.h b/thirdparty/freetype/include/freetype/ftparams.h
new file mode 100644
index 0000000000..5a9006c505
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/ftparams.h
@@ -0,0 +1,205 @@
+/***************************************************************************/
+/* */
+/* ftparams.h */
+/* */
+/* FreeType API for possible FT_Parameter tags (specification only). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef FTPARAMS_H_
+#define FTPARAMS_H_
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
+FT_BEGIN_HEADER
+
+
+ /**************************************************************************
+ *
+ * @section:
+ * parameter_tags
+ *
+ * @title:
+ * Parameter Tags
+ *
+ * @abstract:
+ * Macros for driver property and font loading parameter tags.
+ *
+ * @description:
+ * This section contains macros for the @FT_Parameter structure that are
+ * used with various functions to activate some special functionality or
+ * different behaviour of various components of FreeType.
+ *
+ */
+
+
+ /***************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
+ *
+ * @description:
+ * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
+ * family names in the `name' table (introduced in OpenType version
+ * 1.4). Use this for backward compatibility with legacy systems that
+ * have a four-faces-per-family restriction.
+ *
+ * @since:
+ * 2.8
+ *
+ */
+#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \
+ FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
+
+
+ /* this constant is deprecated */
+#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \
+ FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
+
+
+ /***************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
+ *
+ * @description:
+ * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
+ * subfamily names in the `name' table (introduced in OpenType version
+ * 1.4). Use this for backward compatibility with legacy systems that
+ * have a four-faces-per-family restriction.
+ *
+ * @since:
+ * 2.8
+ *
+ */
+#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \
+ FT_MAKE_TAG( 'i', 'g', 'p', 's' )
+
+
+ /* this constant is deprecated */
+#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \
+ FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
+
+
+ /***************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_INCREMENTAL
+ *
+ * @description:
+ * An @FT_Parameter tag to be used with @FT_Open_Face to indicate
+ * incremental glyph loading.
+ *
+ */
+#define FT_PARAM_TAG_INCREMENTAL \
+ FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
+
+
+ /**************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_LCD_FILTER_WEIGHTS
+ *
+ * @description:
+ * An @FT_Parameter tag to be used with @FT_Face_Properties. The
+ * corresponding argument specifies the five LCD filter weights for a
+ * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding
+ * the global default values or the values set up with
+ * @FT_Library_SetLcdFilterWeights.
+ *
+ * @since:
+ * 2.8
+ *
+ */
+#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \
+ FT_MAKE_TAG( 'l', 'c', 'd', 'f' )
+
+
+ /**************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_RANDOM_SEED
+ *
+ * @description:
+ * An @FT_Parameter tag to be used with @FT_Face_Properties. The
+ * corresponding 32bit signed integer argument overrides the font
+ * driver's random seed value with a face-specific one; see
+ * @random-seed.
+ *
+ * @since:
+ * 2.8
+ *
+ */
+#define FT_PARAM_TAG_RANDOM_SEED \
+ FT_MAKE_TAG( 's', 'e', 'e', 'd' )
+
+
+ /**************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_STEM_DARKENING
+ *
+ * @description:
+ * An @FT_Parameter tag to be used with @FT_Face_Properties. The
+ * corresponding Boolean argument specifies whether to apply stem
+ * darkening, overriding the global default values or the values set up
+ * with @FT_Property_Set (see @no-stem-darkening).
+ *
+ * This is a passive setting that only takes effect if the font driver
+ * or autohinter honors it, which the CFF, Type~1, and CID drivers
+ * always do, but the autohinter only in `light' hinting mode (as of
+ * version 2.9).
+ *
+ * @since:
+ * 2.8
+ *
+ */
+#define FT_PARAM_TAG_STEM_DARKENING \
+ FT_MAKE_TAG( 'd', 'a', 'r', 'k' )
+
+
+ /***************************************************************************
+ *
+ * @constant:
+ * FT_PARAM_TAG_UNPATENTED_HINTING
+ *
+ * @description:
+ * Deprecated, no effect.
+ *
+ * Previously: A constant used as the tag of an @FT_Parameter structure to
+ * indicate that unpatented methods only should be used by the TrueType
+ * bytecode interpreter for a typeface opened by @FT_Open_Face.
+ *
+ */
+#define FT_PARAM_TAG_UNPATENTED_HINTING \
+ FT_MAKE_TAG( 'u', 'n', 'p', 'a' )
+
+
+ /* */
+
+
+FT_END_HEADER
+
+
+#endif /* FTPARAMS_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/ftpfr.h b/thirdparty/freetype/include/freetype/ftpfr.h
index f2a6ae9349..a69cc482dc 100644
--- a/thirdparty/freetype/include/freetype/ftpfr.h
+++ b/thirdparty/freetype/include/freetype/ftpfr.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing PFR-specific data (specification only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -71,7 +71,7 @@ FT_BEGIN_HEADER
*
* ametrics_x_scale ::
* A 16.16 fixed-point number used to scale distance expressed
- * in metrics units to device sub-pixels. This is equivalent to
+ * in metrics units to device subpixels. This is equivalent to
* `face->size->x_scale', but for metrics only. Optional (parameter
* can be NULL).
*
@@ -123,7 +123,7 @@ FT_BEGIN_HEADER
* mode, which always returns distances converted to outline units.
*
* You can use the value of the `x_scale' and `y_scale' parameters
- * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels.
+ * returned by @FT_Get_PFR_Metrics to scale these to device subpixels.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Kerning( FT_Face face,
@@ -154,7 +154,7 @@ FT_BEGIN_HEADER
*
* @note:
* You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
- * to convert the advance to device sub-pixels (i.e., 1/64th of pixels).
+ * to convert the advance to device subpixels (i.e., 1/64th of pixels).
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Advance( FT_Face face,
diff --git a/thirdparty/freetype/include/freetype/ftrender.h b/thirdparty/freetype/include/freetype/ftrender.h
index 960837580a..fa8ad22b98 100644
--- a/thirdparty/freetype/include/freetype/ftrender.h
+++ b/thirdparty/freetype/include/freetype/ftrender.h
@@ -4,7 +4,7 @@
/* */
/* FreeType renderer modules public interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -88,7 +88,7 @@ FT_BEGIN_HEADER
typedef FT_Error
(*FT_Renderer_RenderFunc)( FT_Renderer renderer,
FT_GlyphSlot slot,
- FT_UInt mode,
+ FT_Render_Mode mode,
const FT_Vector* origin );
typedef FT_Error
diff --git a/thirdparty/freetype/include/freetype/ftsizes.h b/thirdparty/freetype/include/freetype/ftsizes.h
index 2f3958a857..72cb08bf2a 100644
--- a/thirdparty/freetype/include/freetype/ftsizes.h
+++ b/thirdparty/freetype/include/freetype/ftsizes.h
@@ -4,7 +4,7 @@
/* */
/* FreeType size objects management (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftsnames.h b/thirdparty/freetype/include/freetype/ftsnames.h
index a316540576..8eb8d70ff7 100644
--- a/thirdparty/freetype/include/freetype/ftsnames.h
+++ b/thirdparty/freetype/include/freetype/ftsnames.h
@@ -7,7 +7,7 @@
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,6 +25,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
+#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -189,6 +190,9 @@ FT_BEGIN_HEADER
/* Please refer to the TrueType or OpenType specification for more */
/* details. */
/* */
+ /* <Since> */
+ /* 2.8 */
+ /* */
typedef struct FT_SfntLangTag_
{
FT_Byte* string; /* this string is *not* null-terminated! */
@@ -229,53 +233,15 @@ FT_BEGIN_HEADER
/* invalid format~1 language ID values, FT_Err_Invalid_Argument is */
/* returned. */
/* */
+ /* <Since> */
+ /* 2.8 */
+ /* */
FT_EXPORT( FT_Error )
FT_Get_Sfnt_LangTag( FT_Face face,
FT_UInt langID,
FT_SfntLangTag *alangTag );
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
- *
- * @description:
- * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
- * family names in the `name' table (introduced in OpenType version
- * 1.4). Use this for backward compatibility with legacy systems that
- * have a four-faces-per-family restriction.
- *
- */
-#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \
- FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
-
-
- /* this constant is deprecated */
-#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \
- FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
-
-
- /***************************************************************************
- *
- * @constant:
- * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
- *
- * @description:
- * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
- * subfamily names in the `name' table (introduced in OpenType version
- * 1.4). Use this for backward compatibility with legacy systems that
- * have a four-faces-per-family restriction.
- *
- */
-#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \
- FT_MAKE_TAG( 'i', 'g', 'p', 's' )
-
-
- /* this constant is deprecated */
-#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \
- FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
-
/* */
diff --git a/thirdparty/freetype/include/freetype/ftstroke.h b/thirdparty/freetype/include/freetype/ftstroke.h
index 4a20667c5e..44b6fbe19f 100644
--- a/thirdparty/freetype/include/freetype/ftstroke.h
+++ b/thirdparty/freetype/include/freetype/ftstroke.h
@@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -466,7 +466,7 @@ FT_BEGIN_HEADER
* FT_Stroker_ConicTo
*
* @description:
- * `Draw' a single quadratic Bézier in the stroker's current sub-path,
+ * `Draw' a single quadratic Bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
@@ -474,7 +474,7 @@ FT_BEGIN_HEADER
* The target stroker handle.
*
* control ::
- * A pointer to a Bézier control point.
+ * A pointer to a Bezier control point.
*
* to ::
* A pointer to the destination point.
@@ -498,7 +498,7 @@ FT_BEGIN_HEADER
* FT_Stroker_CubicTo
*
* @description:
- * `Draw' a single cubic Bézier in the stroker's current sub-path,
+ * `Draw' a single cubic Bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
@@ -506,10 +506,10 @@ FT_BEGIN_HEADER
* The target stroker handle.
*
* control1 ::
- * A pointer to the first Bézier control point.
+ * A pointer to the first Bezier control point.
*
* control2 ::
- * A pointer to second Bézier control point.
+ * A pointer to second Bezier control point.
*
* to ::
* A pointer to the destination point.
diff --git a/thirdparty/freetype/include/freetype/ftsynth.h b/thirdparty/freetype/include/freetype/ftsynth.h
index 1863fa2383..ff9fb43d96 100644
--- a/thirdparty/freetype/include/freetype/ftsynth.h
+++ b/thirdparty/freetype/include/freetype/ftsynth.h
@@ -5,7 +5,7 @@
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/ftsystem.h b/thirdparty/freetype/include/freetype/ftsystem.h
index 1aa4762ad6..f6b1629ef2 100644
--- a/thirdparty/freetype/include/freetype/ftsystem.h
+++ b/thirdparty/freetype/include/freetype/ftsystem.h
@@ -4,7 +4,7 @@
/* */
/* FreeType low-level system interface definition (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/fttrigon.h b/thirdparty/freetype/include/freetype/fttrigon.h
index 89f0350675..2e3f3f1f73 100644
--- a/thirdparty/freetype/include/freetype/fttrigon.h
+++ b/thirdparty/freetype/include/freetype/fttrigon.h
@@ -4,7 +4,7 @@
/* */
/* FreeType trigonometric functions (specification). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/fttypes.h b/thirdparty/freetype/include/freetype/fttypes.h
index eab8adaad4..f638c2e54f 100644
--- a/thirdparty/freetype/include/freetype/fttypes.h
+++ b/thirdparty/freetype/include/freetype/fttypes.h
@@ -4,7 +4,7 @@
/* */
/* FreeType simple types definitions (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -425,7 +425,7 @@ FT_BEGIN_HEADER
/* The address of the FreeType object that is under finalization. */
/* Its client data is accessed through its `generic' field. */
/* */
- typedef void (*FT_Generic_Finalizer)(void* object);
+ typedef void (*FT_Generic_Finalizer)( void* object );
/*************************************************************************/
diff --git a/thirdparty/freetype/include/freetype/ftwinfnt.h b/thirdparty/freetype/include/freetype/ftwinfnt.h
index 1eeef6c8ba..461c65b779 100644
--- a/thirdparty/freetype/include/freetype/ftwinfnt.h
+++ b/thirdparty/freetype/include/freetype/ftwinfnt.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing Windows fnt-specific data. */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -78,7 +78,7 @@ FT_BEGIN_HEADER
* Mac Roman encoding.
*
* FT_WinFNT_ID_OEM ::
- * From Michael Pöttgen <michael@poettgen.de>:
+ * From Michael Poettgen <michael@poettgen.de>:
*
* The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM
* is used for the charset of vector fonts, like `modern.fon',
diff --git a/thirdparty/freetype/include/freetype/internal/autohint.h b/thirdparty/freetype/include/freetype/internal/autohint.h
index bae83e7384..f4d308f68c 100644
--- a/thirdparty/freetype/include/freetype/internal/autohint.h
+++ b/thirdparty/freetype/include/freetype/internal/autohint.h
@@ -4,7 +4,7 @@
/* */
/* High-level `autohint' module-specific interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/cffotypes.h b/thirdparty/freetype/include/freetype/internal/cffotypes.h
new file mode 100644
index 0000000000..57e7591d41
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/internal/cffotypes.h
@@ -0,0 +1,108 @@
+/***************************************************************************/
+/* */
+/* cffotypes.h */
+/* */
+/* Basic OpenType/CFF object type definitions (specification). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef CFFOTYPES_H_
+#define CFFOTYPES_H_
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_CFF_TYPES_H
+#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef TT_Face CFF_Face;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Type> */
+ /* CFF_Size */
+ /* */
+ /* <Description> */
+ /* A handle to an OpenType size object. */
+ /* */
+ typedef struct CFF_SizeRec_
+ {
+ FT_SizeRec root;
+ FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
+
+ } CFF_SizeRec, *CFF_Size;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Type> */
+ /* CFF_GlyphSlot */
+ /* */
+ /* <Description> */
+ /* A handle to an OpenType glyph slot object. */
+ /* */
+ typedef struct CFF_GlyphSlotRec_
+ {
+ FT_GlyphSlotRec root;
+
+ FT_Bool hint;
+ FT_Bool scaled;
+
+ FT_Fixed x_scale;
+ FT_Fixed y_scale;
+
+ } CFF_GlyphSlotRec, *CFF_GlyphSlot;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Type> */
+ /* CFF_Internal */
+ /* */
+ /* <Description> */
+ /* The interface to the `internal' field of `FT_Size'. */
+ /* */
+ typedef struct CFF_InternalRec_
+ {
+ PSH_Globals topfont;
+ PSH_Globals subfonts[CFF_MAX_CID_FONTS];
+
+ } CFF_InternalRec, *CFF_Internal;
+
+
+ /*************************************************************************/
+ /* */
+ /* Subglyph transformation record. */
+ /* */
+ typedef struct CFF_Transform_
+ {
+ FT_Fixed xx, xy; /* transformation matrix coefficients */
+ FT_Fixed yx, yy;
+ FT_F26Dot6 ox, oy; /* offsets */
+
+ } CFF_Transform;
+
+
+FT_END_HEADER
+
+
+#endif /* CFFOTYPES_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/internal/cfftypes.h b/thirdparty/freetype/include/freetype/internal/cfftypes.h
new file mode 100644
index 0000000000..7c07e1a376
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/internal/cfftypes.h
@@ -0,0 +1,412 @@
+/***************************************************************************/
+/* */
+/* cfftypes.h */
+/* */
+/* Basic OpenType/CFF type definitions and interface (specification */
+/* only). */
+/* */
+/* Copyright 1996-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef CFFTYPES_H_
+#define CFFTYPES_H_
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TYPE1_TABLES_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include FT_INTERNAL_TYPE1_TYPES_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* CFF_IndexRec */
+ /* */
+ /* <Description> */
+ /* A structure used to model a CFF Index table. */
+ /* */
+ /* <Fields> */
+ /* stream :: The source input stream. */
+ /* */
+ /* start :: The position of the first index byte in the */
+ /* input stream. */
+ /* */
+ /* count :: The number of elements in the index. */
+ /* */
+ /* off_size :: The size in bytes of object offsets in index. */
+ /* */
+ /* data_offset :: The position of first data byte in the index's */
+ /* bytes. */
+ /* */
+ /* data_size :: The size of the data table in this index. */
+ /* */
+ /* offsets :: A table of element offsets in the index. Must be */
+ /* loaded explicitly. */
+ /* */
+ /* bytes :: If the index is loaded in memory, its bytes. */
+ /* */
+ typedef struct CFF_IndexRec_
+ {
+ FT_Stream stream;
+ FT_ULong start;
+ FT_UInt hdr_size;
+ FT_UInt count;
+ FT_Byte off_size;
+ FT_ULong data_offset;
+ FT_ULong data_size;
+
+ FT_ULong* offsets;
+ FT_Byte* bytes;
+
+ } CFF_IndexRec, *CFF_Index;
+
+
+ typedef struct CFF_EncodingRec_
+ {
+ FT_UInt format;
+ FT_ULong offset;
+
+ FT_UInt count;
+ FT_UShort sids [256]; /* avoid dynamic allocations */
+ FT_UShort codes[256];
+
+ } CFF_EncodingRec, *CFF_Encoding;
+
+
+ typedef struct CFF_CharsetRec_
+ {
+
+ FT_UInt format;
+ FT_ULong offset;
+
+ FT_UShort* sids;
+ FT_UShort* cids; /* the inverse mapping of `sids'; only needed */
+ /* for CID-keyed fonts */
+ FT_UInt max_cid;
+ FT_UInt num_glyphs;
+
+ } CFF_CharsetRec, *CFF_Charset;
+
+
+ /* cf. similar fields in file `ttgxvar.h' from the `truetype' module */
+
+ typedef struct CFF_VarData_
+ {
+#if 0
+ FT_UInt itemCount; /* not used; always zero */
+ FT_UInt shortDeltaCount; /* not used; always zero */
+#endif
+
+ FT_UInt regionIdxCount; /* number of region indexes */
+ FT_UInt* regionIndices; /* array of `regionIdxCount' indices; */
+ /* these index `varRegionList' */
+ } CFF_VarData;
+
+
+ /* contribution of one axis to a region */
+ typedef struct CFF_AxisCoords_
+ {
+ FT_Fixed startCoord;
+ FT_Fixed peakCoord; /* zero peak means no effect (factor = 1) */
+ FT_Fixed endCoord;
+
+ } CFF_AxisCoords;
+
+
+ typedef struct CFF_VarRegion_
+ {
+ CFF_AxisCoords* axisList; /* array of axisCount records */
+
+ } CFF_VarRegion;
+
+
+ typedef struct CFF_VStoreRec_
+ {
+ FT_UInt dataCount;
+ CFF_VarData* varData; /* array of dataCount records */
+ /* vsindex indexes this array */
+ FT_UShort axisCount;
+ FT_UInt regionCount; /* total number of regions defined */
+ CFF_VarRegion* varRegionList;
+
+ } CFF_VStoreRec, *CFF_VStore;
+
+
+ /* forward reference */
+ typedef struct CFF_FontRec_* CFF_Font;
+
+
+ /* This object manages one cached blend vector. */
+ /* */
+ /* There is a BlendRec for Private DICT parsing in each subfont */
+ /* and a BlendRec for charstrings in CF2_Font instance data. */
+ /* A cached BV may be used across DICTs or Charstrings if inputs */
+ /* have not changed. */
+ /* */
+ /* `usedBV' is reset at the start of each parse or charstring. */
+ /* vsindex cannot be changed after a BV is used. */
+ /* */
+ /* Note: NDV is long (32/64 bit), while BV is 16.16 (FT_Int32). */
+ typedef struct CFF_BlendRec_
+ {
+ FT_Bool builtBV; /* blendV has been built */
+ FT_Bool usedBV; /* blendV has been used */
+ CFF_Font font; /* top level font struct */
+ FT_UInt lastVsindex; /* last vsindex used */
+ FT_UInt lenNDV; /* normDV length (aka numAxes) */
+ FT_Fixed* lastNDV; /* last NDV used */
+ FT_UInt lenBV; /* BlendV length (aka numMasters) */
+ FT_Int32* BV; /* current blendV (per DICT/glyph) */
+
+ } CFF_BlendRec, *CFF_Blend;
+
+
+ typedef struct CFF_FontRecDictRec_
+ {
+ FT_UInt version;
+ FT_UInt notice;
+ FT_UInt copyright;
+ FT_UInt full_name;
+ FT_UInt family_name;
+ FT_UInt weight;
+ FT_Bool is_fixed_pitch;
+ FT_Fixed italic_angle;
+ FT_Fixed underline_position;
+ FT_Fixed underline_thickness;
+ FT_Int paint_type;
+ FT_Int charstring_type;
+ FT_Matrix font_matrix;
+ FT_Bool has_font_matrix;
+ FT_ULong units_per_em; /* temporarily used as scaling value also */
+ FT_Vector font_offset;
+ FT_ULong unique_id;
+ FT_BBox font_bbox;
+ FT_Pos stroke_width;
+ FT_ULong charset_offset;
+ FT_ULong encoding_offset;
+ FT_ULong charstrings_offset;
+ FT_ULong private_offset;
+ FT_ULong private_size;
+ FT_Long synthetic_base;
+ FT_UInt embedded_postscript;
+
+ /* these should only be used for the top-level font dictionary */
+ FT_UInt cid_registry;
+ FT_UInt cid_ordering;
+ FT_Long cid_supplement;
+
+ FT_Long cid_font_version;
+ FT_Long cid_font_revision;
+ FT_Long cid_font_type;
+ FT_ULong cid_count;
+ FT_ULong cid_uid_base;
+ FT_ULong cid_fd_array_offset;
+ FT_ULong cid_fd_select_offset;
+ FT_UInt cid_font_name;
+
+ /* the next fields come from the data of the deprecated */
+ /* `MultipleMaster' operator; they are needed to parse the (also */
+ /* deprecated) `blend' operator in Type 2 charstrings */
+ FT_UShort num_designs;
+ FT_UShort num_axes;
+
+ /* fields for CFF2 */
+ FT_ULong vstore_offset;
+ FT_UInt maxstack;
+
+ } CFF_FontRecDictRec, *CFF_FontRecDict;
+
+
+ /* forward reference */
+ typedef struct CFF_SubFontRec_* CFF_SubFont;
+
+
+ typedef struct CFF_PrivateRec_
+ {
+ FT_Byte num_blue_values;
+ FT_Byte num_other_blues;
+ FT_Byte num_family_blues;
+ FT_Byte num_family_other_blues;
+
+ FT_Pos blue_values[14];
+ FT_Pos other_blues[10];
+ FT_Pos family_blues[14];
+ FT_Pos family_other_blues[10];
+
+ FT_Fixed blue_scale;
+ FT_Pos blue_shift;
+ FT_Pos blue_fuzz;
+ FT_Pos standard_width;
+ FT_Pos standard_height;
+
+ FT_Byte num_snap_widths;
+ FT_Byte num_snap_heights;
+ FT_Pos snap_widths[13];
+ FT_Pos snap_heights[13];
+ FT_Bool force_bold;
+ FT_Fixed force_bold_threshold;
+ FT_Int lenIV;
+ FT_Int language_group;
+ FT_Fixed expansion_factor;
+ FT_Long initial_random_seed;
+ FT_ULong local_subrs_offset;
+ FT_Pos default_width;
+ FT_Pos nominal_width;
+
+ /* fields for CFF2 */
+ FT_UInt vsindex;
+ CFF_SubFont subfont;
+
+ } CFF_PrivateRec, *CFF_Private;
+
+
+ typedef struct CFF_FDSelectRec_
+ {
+ FT_Byte format;
+ FT_UInt range_count;
+
+ /* that's the table, taken from the file `as is' */
+ FT_Byte* data;
+ FT_UInt data_size;
+
+ /* small cache for format 3 only */
+ FT_UInt cache_first;
+ FT_UInt cache_count;
+ FT_Byte cache_fd;
+
+ } CFF_FDSelectRec, *CFF_FDSelect;
+
+
+ /* A SubFont packs a font dict and a private dict together. They are */
+ /* needed to support CID-keyed CFF fonts. */
+ typedef struct CFF_SubFontRec_
+ {
+ CFF_FontRecDictRec font_dict;
+ CFF_PrivateRec private_dict;
+
+ /* fields for CFF2 */
+ CFF_BlendRec blend; /* current blend vector */
+ FT_UInt lenNDV; /* current length NDV or zero */
+ FT_Fixed* NDV; /* ptr to current NDV or NULL */
+
+ /* `blend_stack' is a writable buffer to hold blend results. */
+ /* This buffer is to the side of the normal cff parser stack; */
+ /* `cff_parse_blend' and `cff_blend_doBlend' push blend results here. */
+ /* The normal stack then points to these values instead of the DICT */
+ /* because all other operators in Private DICT clear the stack. */
+ /* `blend_stack' could be cleared at each operator other than blend. */
+ /* Blended values are stored as 5-byte fixed point values. */
+
+ FT_Byte* blend_stack; /* base of stack allocation */
+ FT_Byte* blend_top; /* first empty slot */
+ FT_UInt blend_used; /* number of bytes in use */
+ FT_UInt blend_alloc; /* number of bytes allocated */
+
+ CFF_IndexRec local_subrs_index;
+ FT_Byte** local_subrs; /* array of pointers */
+ /* into Local Subrs INDEX data */
+
+ FT_UInt32 random;
+
+ } CFF_SubFontRec;
+
+
+#define CFF_MAX_CID_FONTS 256
+
+
+ typedef struct CFF_FontRec_
+ {
+ FT_Library library;
+ FT_Stream stream;
+ FT_Memory memory; /* TODO: take this from stream->memory? */
+ FT_ULong base_offset; /* offset to start of CFF */
+ FT_UInt num_faces;
+ FT_UInt num_glyphs;
+
+ FT_Byte version_major;
+ FT_Byte version_minor;
+ FT_Byte header_size;
+
+ FT_UInt top_dict_length; /* cff2 only */
+
+ FT_Bool cff2;
+
+ CFF_IndexRec name_index;
+ CFF_IndexRec top_dict_index;
+ CFF_IndexRec global_subrs_index;
+
+ CFF_EncodingRec encoding;
+ CFF_CharsetRec charset;
+
+ CFF_IndexRec charstrings_index;
+ CFF_IndexRec font_dict_index;
+ CFF_IndexRec private_index;
+ CFF_IndexRec local_subrs_index;
+
+ FT_String* font_name;
+
+ /* array of pointers into Global Subrs INDEX data */
+ FT_Byte** global_subrs;
+
+ /* array of pointers into String INDEX data stored at string_pool */
+ FT_UInt num_strings;
+ FT_Byte** strings;
+ FT_Byte* string_pool;
+ FT_ULong string_pool_size;
+
+ CFF_SubFontRec top_font;
+ FT_UInt num_subfonts;
+ CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
+
+ CFF_FDSelectRec fd_select;
+
+ /* interface to PostScript hinter */
+ PSHinter_Service pshinter;
+
+ /* interface to Postscript Names service */
+ FT_Service_PsCMaps psnames;
+
+ /* interface to CFFLoad service */
+ const void* cffload;
+
+ /* since version 2.3.0 */
+ PS_FontInfoRec* font_info; /* font info dictionary */
+
+ /* since version 2.3.6 */
+ FT_String* registry;
+ FT_String* ordering;
+
+ /* since version 2.4.12 */
+ FT_Generic cf2_instance;
+
+ /* since version 2.7.1 */
+ CFF_VStoreRec vstore; /* parsed vstore structure */
+
+ /* since version 2.9 */
+ PS_FontExtraRec* font_extra;
+
+ } CFF_FontRec;
+
+
+FT_END_HEADER
+
+#endif /* CFFTYPES_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/internal/ftcalc.h b/thirdparty/freetype/include/freetype/internal/ftcalc.h
index 8b35f03d88..818a812359 100644
--- a/thirdparty/freetype/include/freetype/internal/ftcalc.h
+++ b/thirdparty/freetype/include/freetype/internal/ftcalc.h
@@ -4,7 +4,7 @@
/* */
/* Arithmetic computations (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/ftdebug.h b/thirdparty/freetype/include/freetype/internal/ftdebug.h
index 5dcd2b1740..292a4eedb8 100644
--- a/thirdparty/freetype/include/freetype/internal/ftdebug.h
+++ b/thirdparty/freetype/include/freetype/internal/ftdebug.h
@@ -4,7 +4,7 @@
/* */
/* Debugging and logging component (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/ftdrv.h b/thirdparty/freetype/include/freetype/internal/ftdrv.h
new file mode 100644
index 0000000000..58dd35a933
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/internal/ftdrv.h
@@ -0,0 +1,400 @@
+/***************************************************************************/
+/* */
+/* ftdrv.h */
+/* */
+/* FreeType internal font driver interface (specification). */
+/* */
+/* Copyright 1996-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef FTDRV_H_
+#define FTDRV_H_
+
+
+#include <ft2build.h>
+#include FT_MODULE_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef FT_Error
+ (*FT_Face_InitFunc)( FT_Stream stream,
+ FT_Face face,
+ FT_Int typeface_index,
+ FT_Int num_params,
+ FT_Parameter* parameters );
+
+ typedef void
+ (*FT_Face_DoneFunc)( FT_Face face );
+
+
+ typedef FT_Error
+ (*FT_Size_InitFunc)( FT_Size size );
+
+ typedef void
+ (*FT_Size_DoneFunc)( FT_Size size );
+
+
+ typedef FT_Error
+ (*FT_Slot_InitFunc)( FT_GlyphSlot slot );
+
+ typedef void
+ (*FT_Slot_DoneFunc)( FT_GlyphSlot slot );
+
+
+ typedef FT_Error
+ (*FT_Size_RequestFunc)( FT_Size size,
+ FT_Size_Request req );
+
+ typedef FT_Error
+ (*FT_Size_SelectFunc)( FT_Size size,
+ FT_ULong size_index );
+
+ typedef FT_Error
+ (*FT_Slot_LoadFunc)( FT_GlyphSlot slot,
+ FT_Size size,
+ FT_UInt glyph_index,
+ FT_Int32 load_flags );
+
+
+ typedef FT_Error
+ (*FT_Face_GetKerningFunc)( FT_Face face,
+ FT_UInt left_glyph,
+ FT_UInt right_glyph,
+ FT_Vector* kerning );
+
+
+ typedef FT_Error
+ (*FT_Face_AttachFunc)( FT_Face face,
+ FT_Stream stream );
+
+
+ typedef FT_Error
+ (*FT_Face_GetAdvancesFunc)( FT_Face face,
+ FT_UInt first,
+ FT_UInt count,
+ FT_Int32 flags,
+ FT_Fixed* advances );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_Driver_ClassRec */
+ /* */
+ /* <Description> */
+ /* The font driver class. This structure mostly contains pointers to */
+ /* driver methods. */
+ /* */
+ /* <Fields> */
+ /* root :: The parent module. */
+ /* */
+ /* face_object_size :: The size of a face object in bytes. */
+ /* */
+ /* size_object_size :: The size of a size object in bytes. */
+ /* */
+ /* slot_object_size :: The size of a glyph object in bytes. */
+ /* */
+ /* init_face :: The format-specific face constructor. */
+ /* */
+ /* done_face :: The format-specific face destructor. */
+ /* */
+ /* init_size :: The format-specific size constructor. */
+ /* */
+ /* done_size :: The format-specific size destructor. */
+ /* */
+ /* init_slot :: The format-specific slot constructor. */
+ /* */
+ /* done_slot :: The format-specific slot destructor. */
+ /* */
+ /* */
+ /* load_glyph :: A function handle to load a glyph to a slot. */
+ /* This field is mandatory! */
+ /* */
+ /* get_kerning :: A function handle to return the unscaled */
+ /* kerning for a given pair of glyphs. Can be */
+ /* set to 0 if the format doesn't support */
+ /* kerning. */
+ /* */
+ /* attach_file :: This function handle is used to read */
+ /* additional data for a face from another */
+ /* file/stream. For example, this can be used to */
+ /* add data from AFM or PFM files on a Type 1 */
+ /* face, or a CIDMap on a CID-keyed face. */
+ /* */
+ /* get_advances :: A function handle used to return advance */
+ /* widths of `count' glyphs (in font units), */
+ /* starting at `first'. The `vertical' flag must */
+ /* be set to get vertical advance heights. The */
+ /* `advances' buffer is caller-allocated. */
+ /* The idea of this function is to be able to */
+ /* perform device-independent text layout without */
+ /* loading a single glyph image. */
+ /* */
+ /* request_size :: A handle to a function used to request the new */
+ /* character size. Can be set to 0 if the */
+ /* scaling done in the base layer suffices. */
+ /* */
+ /* select_size :: A handle to a function used to select a new */
+ /* fixed size. It is used only if */
+ /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */
+ /* to 0 if the scaling done in the base layer */
+ /* suffices. */
+ /* <Note> */
+ /* Most function pointers, with the exception of `load_glyph', can be */
+ /* set to 0 to indicate a default behaviour. */
+ /* */
+ typedef struct FT_Driver_ClassRec_
+ {
+ FT_Module_Class root;
+
+ FT_Long face_object_size;
+ FT_Long size_object_size;
+ FT_Long slot_object_size;
+
+ FT_Face_InitFunc init_face;
+ FT_Face_DoneFunc done_face;
+
+ FT_Size_InitFunc init_size;
+ FT_Size_DoneFunc done_size;
+
+ FT_Slot_InitFunc init_slot;
+ FT_Slot_DoneFunc done_slot;
+
+ FT_Slot_LoadFunc load_glyph;
+
+ FT_Face_GetKerningFunc get_kerning;
+ FT_Face_AttachFunc attach_file;
+ FT_Face_GetAdvancesFunc get_advances;
+
+ /* since version 2.2 */
+ FT_Size_RequestFunc request_size;
+ FT_Size_SelectFunc select_size;
+
+ } FT_Driver_ClassRec, *FT_Driver_Class;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_DECLARE_DRIVER */
+ /* */
+ /* <Description> */
+ /* Used to create a forward declaration of an FT_Driver_ClassRec */
+ /* struct instance. */
+ /* */
+ /* <Macro> */
+ /* FT_DEFINE_DRIVER */
+ /* */
+ /* <Description> */
+ /* Used to initialize an instance of FT_Driver_ClassRec struct. */
+ /* */
+ /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
+ /* called with a pointer where the allocated structure is returned. */
+ /* And when it is no longer needed a `destroy' function needs to be */
+ /* called to release that allocation. */
+ /* */
+ /* `ftinit.c' (ft_create_default_module_classes) already contains a */
+ /* mechanism to call these functions for the default modules */
+ /* described in `ftmodule.h'. */
+ /* */
+ /* Notice that the created `create' and `destroy' functions call */
+ /* `pic_init' and `pic_free' to allow you to manually allocate and */
+ /* initialize any additional global data, like a module specific */
+ /* interface, and put them in the global pic container defined in */
+ /* `ftpic.h'. If you don't need them just implement the functions as */
+ /* empty to resolve the link error. Also the `pic_init' and */
+ /* `pic_free' functions should be declared in `pic.h', to be referred */
+ /* by driver definition calling `FT_DEFINE_DRIVER' in following. */
+ /* */
+ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
+ /* allocated in the global scope (or the scope where the macro is */
+ /* used). */
+ /* */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DECLARE_DRIVER( class_ ) \
+ FT_CALLBACK_TABLE \
+ const FT_Driver_ClassRec class_;
+
+#define FT_DEFINE_DRIVER( \
+ class_, \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_, \
+ face_object_size_, \
+ size_object_size_, \
+ slot_object_size_, \
+ init_face_, \
+ done_face_, \
+ init_size_, \
+ done_size_, \
+ init_slot_, \
+ done_slot_, \
+ load_glyph_, \
+ get_kerning_, \
+ attach_file_, \
+ get_advances_, \
+ request_size_, \
+ select_size_ ) \
+ FT_CALLBACK_TABLE_DEF \
+ const FT_Driver_ClassRec class_ = \
+ { \
+ FT_DEFINE_ROOT_MODULE( flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ \
+ face_object_size_, \
+ size_object_size_, \
+ slot_object_size_, \
+ \
+ init_face_, \
+ done_face_, \
+ \
+ init_size_, \
+ done_size_, \
+ \
+ init_slot_, \
+ done_slot_, \
+ \
+ load_glyph_, \
+ \
+ get_kerning_, \
+ attach_file_, \
+ get_advances_, \
+ \
+ request_size_, \
+ select_size_ \
+ };
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ )
+
+#define FT_DEFINE_DRIVER( \
+ class_, \
+ flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_, \
+ face_object_size_, \
+ size_object_size_, \
+ slot_object_size_, \
+ init_face_, \
+ done_face_, \
+ init_size_, \
+ done_size_, \
+ init_slot_, \
+ done_slot_, \
+ load_glyph_, \
+ get_kerning_, \
+ attach_file_, \
+ get_advances_, \
+ request_size_, \
+ select_size_ ) \
+ void \
+ FT_Destroy_Class_ ## class_( FT_Library library, \
+ FT_Module_Class* clazz ) \
+ { \
+ FT_Memory memory = library->memory; \
+ FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \
+ \
+ \
+ class_ ## _pic_free( library ); \
+ if ( dclazz ) \
+ FT_FREE( dclazz ); \
+ } \
+ \
+ \
+ FT_Error \
+ FT_Create_Class_ ## class_( FT_Library library, \
+ FT_Module_Class** output_class ) \
+ { \
+ FT_Driver_Class clazz = NULL; \
+ FT_Error error; \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
+ return error; \
+ \
+ error = class_ ## _pic_init( library ); \
+ if ( error ) \
+ { \
+ FT_FREE( clazz ); \
+ return error; \
+ } \
+ \
+ FT_DEFINE_ROOT_MODULE( flags_, \
+ size_, \
+ name_, \
+ version_, \
+ requires_, \
+ interface_, \
+ init_, \
+ done_, \
+ get_interface_ ) \
+ \
+ clazz->face_object_size = face_object_size_; \
+ clazz->size_object_size = size_object_size_; \
+ clazz->slot_object_size = slot_object_size_; \
+ \
+ clazz->init_face = init_face_; \
+ clazz->done_face = done_face_; \
+ \
+ clazz->init_size = init_size_; \
+ clazz->done_size = done_size_; \
+ \
+ clazz->init_slot = init_slot_; \
+ clazz->done_slot = done_slot_; \
+ \
+ clazz->load_glyph = load_glyph_; \
+ \
+ clazz->get_kerning = get_kerning_; \
+ clazz->attach_file = attach_file_; \
+ clazz->get_advances = get_advances_; \
+ \
+ clazz->request_size = request_size_; \
+ clazz->select_size = select_size_; \
+ \
+ *output_class = (FT_Module_Class*)clazz; \
+ \
+ return FT_Err_Ok; \
+ }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+FT_END_HEADER
+
+#endif /* FTDRV_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/internal/ftgloadr.h b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
index f41c3df554..a002fdbfca 100644
--- a/thirdparty/freetype/include/freetype/internal/ftgloadr.h
+++ b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph loader (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/ftmemory.h b/thirdparty/freetype/include/freetype/internal/ftmemory.h
index 59e5b58a57..054eaec31f 100644
--- a/thirdparty/freetype/include/freetype/internal/ftmemory.h
+++ b/thirdparty/freetype/include/freetype/internal/ftmemory.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType memory management macros (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -210,7 +210,7 @@ extern "C++"
NULL, \
&error ) )
-#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
+#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
(FT_Long)(itmsz), \
(FT_Long)(oldcnt), \
diff --git a/thirdparty/freetype/include/freetype/internal/ftobjs.h b/thirdparty/freetype/include/freetype/internal/ftobjs.h
index 4231be238a..1c3c6ad456 100644
--- a/thirdparty/freetype/include/freetype/internal/ftobjs.h
+++ b/thirdparty/freetype/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -85,9 +85,9 @@ FT_BEGIN_HEADER
: y + ( 3 * x >> 3 ) )
/* we use FT_TYPEOF to suppress signedness compilation warnings */
-#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) )
-#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n )
-#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n )
+#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )
+#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n )
+#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n )
#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
@@ -155,8 +155,8 @@ FT_BEGIN_HEADER
} FT_CMapRec;
- /* typecase any pointer to a charmap handle */
-#define FT_CMAP( x ) ((FT_CMap)( x ))
+ /* typecast any pointer to a charmap handle */
+#define FT_CMAP( x ) ( (FT_CMap)( x ) )
/* obvious macros */
#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
@@ -312,6 +312,27 @@ FT_BEGIN_HEADER
FT_CMap_Done( FT_CMap cmap );
+ /* adds LCD padding to Min and Max boundaries */
+ FT_BASE( void )
+ ft_lcd_padding( FT_Pos* Min,
+ FT_Pos* Max,
+ FT_GlyphSlot slot );
+
+#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+ typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
+ FT_Render_Mode render_mode,
+ FT_Byte* weights );
+
+
+ /* This is the default LCD filter, an in-place, 5-tap FIR filter. */
+ FT_BASE( void )
+ ft_lcd_filter_fir( FT_Bitmap* bitmap,
+ FT_Render_Mode mode,
+ FT_LcdFiveTapFilter weights );
+
+#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
/*************************************************************************/
/* */
/* <Struct> */
@@ -369,9 +390,10 @@ FT_BEGIN_HEADER
/* operator. Value~0 means to use the font's value. Value~-1 */
/* means to use the CFF driver's default. */
/* */
- /* lcd_weights :: */
- /* Overrides the library default with custom weights for the 5-tap */
- /* FIR filter. `{0, 0, 0, 0, 0}' means to use the library default. */
+ /* lcd_weights :: */
+ /* lcd_filter_func :: */
+ /* If subpixel rendering is activated, the LCD filtering weights */
+ /* and callback function. */
/* */
/* refcount :: */
/* A counter initialized to~1 at the time an @FT_Face structure is */
@@ -393,8 +415,10 @@ FT_BEGIN_HEADER
FT_Char no_stem_darkening;
FT_Int32 random_seed;
+
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- FT_LcdFiveTapFilter lcd_weights; /* preset or custom filter weights */
+ FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
+ FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#endif
FT_Int refcount;
@@ -516,7 +540,8 @@ FT_BEGIN_HEADER
/* typecast an object to an FT_Module */
-#define FT_MODULE( x ) ((FT_Module)( x ))
+#define FT_MODULE( x ) ( (FT_Module)(x) )
+
#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
@@ -602,9 +627,9 @@ FT_BEGIN_HEADER
/* a few macros used to perform easy typecasts with minimal brain damage */
-#define FT_FACE( x ) ((FT_Face)(x))
-#define FT_SIZE( x ) ((FT_Size)(x))
-#define FT_SLOT( x ) ((FT_GlyphSlot)(x))
+#define FT_FACE( x ) ( (FT_Face)(x) )
+#define FT_SIZE( x ) ( (FT_Size)(x) )
+#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )
#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
@@ -705,6 +730,12 @@ FT_BEGIN_HEADER
ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
+ /* Preset bitmap metrics of an outline glyphslot prior to rendering. */
+ FT_BASE( void )
+ ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,
+ FT_Render_Mode mode,
+ const FT_Vector* origin );
+
/* Allocate a new bitmap buffer in a glyph slot. */
FT_BASE( FT_Error )
ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
@@ -731,10 +762,10 @@ FT_BEGIN_HEADER
/*************************************************************************/
-#define FT_RENDERER( x ) ((FT_Renderer)( x ))
-#define FT_GLYPH( x ) ((FT_Glyph)( x ))
-#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x ))
-#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
+#define FT_RENDERER( x ) ( (FT_Renderer)(x) )
+#define FT_GLYPH( x ) ( (FT_Glyph)(x) )
+#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) )
+#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) )
typedef struct FT_RendererRec_
@@ -765,7 +796,7 @@ FT_BEGIN_HEADER
/* typecast a module into a driver easily */
-#define FT_DRIVER( x ) ((FT_Driver)(x))
+#define FT_DRIVER( x ) ( (FT_Driver)(x) )
/* typecast a module as a driver, and get its driver class */
#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
@@ -821,18 +852,6 @@ FT_BEGIN_HEADER
#define FT_DEBUG_HOOK_TRUETYPE 0
- typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
- FT_Render_Mode render_mode,
- FT_Byte* weights );
-
-
- /* This is the default LCD filter, an in-place, 5-tap FIR filter. */
- FT_BASE( void )
- ft_lcd_filter_fir( FT_Bitmap* bitmap,
- FT_Render_Mode mode,
- FT_LcdFiveTapFilter weights );
-
-
/*************************************************************************/
/* */
/* <Struct> */
@@ -878,9 +897,6 @@ FT_BEGIN_HEADER
/* interpreter. Currently, only the TrueType */
/* bytecode debugger uses this. */
/* */
- /* lcd_filter :: If subpixel rendering is activated, the */
- /* selected LCD filter mode. */
- /* */
/* lcd_weights :: If subpixel rendering is activated, the LCD */
/* filter weights, if any. */
/* */
@@ -915,7 +931,6 @@ FT_BEGIN_HEADER
FT_DebugHook_Func debug_hooks[4];
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- FT_LcdFilter lcd_filter;
FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#endif
diff --git a/thirdparty/freetype/include/freetype/internal/ftpic.h b/thirdparty/freetype/include/freetype/internal/ftpic.h
index 0d43ed20f7..5214f05989 100644
--- a/thirdparty/freetype/include/freetype/internal/ftpic.h
+++ b/thirdparty/freetype/include/freetype/internal/ftpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services (declaration). */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/ftpsprop.h b/thirdparty/freetype/include/freetype/internal/ftpsprop.h
new file mode 100644
index 0000000000..abbb62862b
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/internal/ftpsprop.h
@@ -0,0 +1,48 @@
+/***************************************************************************/
+/* */
+/* ftpsprop.h */
+/* */
+/* Get and set properties of PostScript drivers (specification). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef FTPSPROP_H_
+#define FTPSPROP_H_
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ FT_BASE_CALLBACK( FT_Error )
+ ps_property_set( FT_Module module, /* PS_Driver */
+ const char* property_name,
+ const void* value,
+ FT_Bool value_is_string );
+
+ FT_BASE_CALLBACK( FT_Error )
+ ps_property_get( FT_Module module, /* PS_Driver */
+ const char* property_name,
+ void* value );
+
+
+FT_END_HEADER
+
+
+#endif /* FTPSPROP_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/internal/ftrfork.h b/thirdparty/freetype/include/freetype/internal/ftrfork.h
index 25a44a4487..1aca48a0e7 100644
--- a/thirdparty/freetype/include/freetype/internal/ftrfork.h
+++ b/thirdparty/freetype/include/freetype/internal/ftrfork.h
@@ -4,7 +4,7 @@
/* */
/* Embedded resource forks accessor (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/ftserv.h b/thirdparty/freetype/include/freetype/internal/ftserv.h
index 71ef9cac3a..e01c1679b5 100644
--- a/thirdparty/freetype/include/freetype/internal/ftserv.h
+++ b/thirdparty/freetype/include/freetype/internal/ftserv.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType services (specification only). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -330,6 +330,32 @@ FT_BEGIN_HEADER
{ NULL, NULL } \
};
+#define FT_DEFINE_SERVICEDESCREC10( class_, \
+ serv_id_1, serv_data_1, \
+ serv_id_2, serv_data_2, \
+ serv_id_3, serv_data_3, \
+ serv_id_4, serv_data_4, \
+ serv_id_5, serv_data_5, \
+ serv_id_6, serv_data_6, \
+ serv_id_7, serv_data_7, \
+ serv_id_8, serv_data_8, \
+ serv_id_9, serv_data_9, \
+ serv_id_10, serv_data_10 ) \
+ static const FT_ServiceDescRec class_[] = \
+ { \
+ { serv_id_1, serv_data_1 }, \
+ { serv_id_2, serv_data_2 }, \
+ { serv_id_3, serv_data_3 }, \
+ { serv_id_4, serv_data_4 }, \
+ { serv_id_5, serv_data_5 }, \
+ { serv_id_6, serv_data_6 }, \
+ { serv_id_7, serv_data_7 }, \
+ { serv_id_8, serv_data_8 }, \
+ { serv_id_9, serv_data_9 }, \
+ { serv_id_10, serv_data_10 }, \
+ { NULL, NULL } \
+ };
+
#else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICEDESCREC1( class_, \
@@ -557,7 +583,7 @@ FT_BEGIN_HEADER
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class) \
+ FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
@@ -608,7 +634,7 @@ FT_BEGIN_HEADER
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class) \
+ FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
@@ -662,7 +688,7 @@ FT_BEGIN_HEADER
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class) \
+ FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
@@ -719,7 +745,7 @@ FT_BEGIN_HEADER
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
- FT_ServiceDescRec** output_class) \
+ FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
@@ -755,6 +781,68 @@ FT_BEGIN_HEADER
return FT_Err_Ok; \
}
+#define FT_DEFINE_SERVICEDESCREC10( class_, \
+ serv_id_1, serv_data_1, \
+ serv_id_2, serv_data_2, \
+ serv_id_3, serv_data_3, \
+ serv_id_4, serv_data_4, \
+ serv_id_5, serv_data_5, \
+ serv_id_6, serv_data_6, \
+ serv_id_7, serv_data_7, \
+ serv_id_8, serv_data_8, \
+ serv_id_9, serv_data_9, \
+ serv_id_10, serv_data_10 ) \
+ void \
+ FT_Destroy_Class_ ## class_( FT_Library library, \
+ FT_ServiceDescRec* clazz ) \
+ { \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ if ( clazz ) \
+ FT_FREE( clazz ); \
+ } \
+ \
+ FT_Error \
+ FT_Create_Class_ ## class_( FT_Library library, \
+ FT_ServiceDescRec** output_class ) \
+ { \
+ FT_ServiceDescRec* clazz = NULL; \
+ FT_Error error; \
+ FT_Memory memory = library->memory; \
+ \
+ \
+ if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \
+ return error; \
+ \
+ clazz[ 0].serv_id = serv_id_1; \
+ clazz[ 0].serv_data = serv_data_1; \
+ clazz[ 1].serv_id = serv_id_2; \
+ clazz[ 1].serv_data = serv_data_2; \
+ clazz[ 2].serv_id = serv_id_3; \
+ clazz[ 2].serv_data = serv_data_3; \
+ clazz[ 3].serv_id = serv_id_4; \
+ clazz[ 3].serv_data = serv_data_4; \
+ clazz[ 4].serv_id = serv_id_5; \
+ clazz[ 4].serv_data = serv_data_5; \
+ clazz[ 5].serv_id = serv_id_6; \
+ clazz[ 5].serv_data = serv_data_6; \
+ clazz[ 6].serv_id = serv_id_7; \
+ clazz[ 6].serv_data = serv_data_7; \
+ clazz[ 7].serv_id = serv_id_8; \
+ clazz[ 7].serv_data = serv_data_8; \
+ clazz[ 8].serv_id = serv_id_9; \
+ clazz[ 8].serv_data = serv_data_9; \
+ clazz[ 9].serv_id = serv_id_10; \
+ clazz[ 9].serv_data = serv_data_10; \
+ clazz[10].serv_id = NULL; \
+ clazz[10].serv_data = NULL; \
+ \
+ *output_class = clazz; \
+ \
+ return FT_Err_Ok; \
+ }
+
#endif /* FT_CONFIG_OPTION_PIC */
@@ -898,7 +986,9 @@ FT_BEGIN_HEADER
*/
#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
+#define FT_SERVICE_CFF_TABLE_LOAD_H <freetype/internal/services/svcfftl.h>
#define FT_SERVICE_CID_H <freetype/internal/services/svcid.h>
+#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h>
#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
#define FT_SERVICE_GX_VALIDATE_H <freetype/internal/services/svgxval.h>
#define FT_SERVICE_KERNING_H <freetype/internal/services/svkern.h>
@@ -912,10 +1002,9 @@ FT_BEGIN_HEADER
#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h>
#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
#define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h>
+#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
-#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h>
-#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
/* */
diff --git a/thirdparty/freetype/include/freetype/internal/ftstream.h b/thirdparty/freetype/include/freetype/internal/ftstream.h
index 3e2c07b269..f90002fe77 100644
--- a/thirdparty/freetype/include/freetype/internal/ftstream.h
+++ b/thirdparty/freetype/include/freetype/internal/ftstream.h
@@ -4,7 +4,7 @@
/* */
/* Stream handling (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -165,8 +165,8 @@ FT_BEGIN_HEADER
#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
-#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \
- FT_BYTE_U16( p, 1, 0) )
+#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \
+ FT_BYTE_U16( p, 1, 0 ) )
#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
FT_BYTE_U16( p, 1, 0 ) )
diff --git a/thirdparty/freetype/include/freetype/internal/fttrace.h b/thirdparty/freetype/include/freetype/internal/fttrace.h
index caf5fc9460..8092e41fd7 100644
--- a/thirdparty/freetype/include/freetype/internal/fttrace.h
+++ b/thirdparty/freetype/include/freetype/internal/fttrace.h
@@ -4,7 +4,7 @@
/* */
/* Tracing handling (specification only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -39,6 +39,7 @@ FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */
FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */
FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */
+FT_TRACE_DEF( psprops ) /* PS driver properties (ftpsprop.c) */
/* Cache sub-system */
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
@@ -66,20 +67,19 @@ FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */
FT_TRACE_DEF( t1afm )
FT_TRACE_DEF( t1driver )
FT_TRACE_DEF( t1gload )
-FT_TRACE_DEF( t1hint )
FT_TRACE_DEF( t1load )
FT_TRACE_DEF( t1objs )
FT_TRACE_DEF( t1parse )
/* PostScript helper module `psaux' */
FT_TRACE_DEF( t1decode )
+FT_TRACE_DEF( cffdecode )
FT_TRACE_DEF( psobjs )
FT_TRACE_DEF( psconv )
/* PostScript hinting module `pshinter' */
FT_TRACE_DEF( pshrec )
-FT_TRACE_DEF( pshalgo1 )
-FT_TRACE_DEF( pshalgo2 )
+FT_TRACE_DEF( pshalgo )
/* Type 2 driver components */
FT_TRACE_DEF( cffdriver )
@@ -96,7 +96,6 @@ FT_TRACE_DEF( cf2interp )
FT_TRACE_DEF( t42 )
/* CID driver components */
-FT_TRACE_DEF( cidafm )
FT_TRACE_DEF( ciddriver )
FT_TRACE_DEF( cidgload )
FT_TRACE_DEF( cidload )
diff --git a/thirdparty/freetype/include/freetype/internal/ftvalid.h b/thirdparty/freetype/include/freetype/internal/ftvalid.h
index df6f7c5778..cad47a556d 100644
--- a/thirdparty/freetype/include/freetype/internal/ftvalid.h
+++ b/thirdparty/freetype/include/freetype/internal/ftvalid.h
@@ -4,7 +4,7 @@
/* */
/* FreeType validation support (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/internal.h b/thirdparty/freetype/include/freetype/internal/internal.h
index 02046813a3..8f546e443b 100644
--- a/thirdparty/freetype/include/freetype/internal/internal.h
+++ b/thirdparty/freetype/include/freetype/internal/internal.h
@@ -4,7 +4,7 @@
/* */
/* Internal header files (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,7 +31,7 @@
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
#define FT_INTERNAL_HASH_H <freetype/internal/fthash.h>
-#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
+#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdrv.h>
#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
@@ -44,9 +44,13 @@
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
+#define FT_INTERNAL_POSTSCRIPT_PROPS_H <freetype/internal/ftpsprop.h>
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
+#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
+#define FT_INTERNAL_CFF_OBJECTS_TYPES_H <freetype/internal/cffotypes.h>
+
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
diff --git a/thirdparty/freetype/include/freetype/internal/psaux.h b/thirdparty/freetype/include/freetype/internal/psaux.h
index 935eb1a9c7..f77380d25f 100644
--- a/thirdparty/freetype/include/freetype/internal/psaux.h
+++ b/thirdparty/freetype/include/freetype/internal/psaux.h
@@ -5,7 +5,7 @@
/* Auxiliary functions and data structures related to PostScript fonts */
/* (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,12 +25,32 @@
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TYPE1_TYPES_H
#include FT_INTERNAL_HASH_H
+#include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include FT_INTERNAL_CFF_TYPES_H
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+
FT_BEGIN_HEADER
+ /***********************************************************************/
+ /* */
+ /* PostScript modules driver class. */
+ /* */
+ typedef struct PS_DriverRec_
+ {
+ FT_DriverRec root;
+
+ FT_UInt hinting_engine;
+ FT_Bool no_stem_darkening;
+ FT_Int darken_params[8];
+ FT_Int32 random_seed;
+
+ } PS_DriverRec, *PS_Driver;
+
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -442,6 +462,202 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/***** *****/
+ /***** PS BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ typedef struct PS_Builder_ PS_Builder;
+ typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs;
+
+ typedef struct PS_Builder_FuncsRec_
+ {
+ void
+ (*init)( PS_Builder* ps_builder,
+ void* builder,
+ FT_Bool is_t1 );
+
+ void
+ (*done)( PS_Builder* builder );
+
+ } PS_Builder_FuncsRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Structure> */
+ /* PS_Builder */
+ /* */
+ /* <Description> */
+ /* A structure used during glyph loading to store its outline. */
+ /* */
+ /* <Fields> */
+ /* memory :: The current memory object. */
+ /* */
+ /* face :: The current face object. */
+ /* */
+ /* glyph :: The current glyph slot. */
+ /* */
+ /* loader :: XXX */
+ /* */
+ /* base :: The base glyph outline. */
+ /* */
+ /* current :: The current glyph outline. */
+ /* */
+ /* pos_x :: The horizontal translation (if composite glyph). */
+ /* */
+ /* pos_y :: The vertical translation (if composite glyph). */
+ /* */
+ /* left_bearing :: The left side bearing point. */
+ /* */
+ /* advance :: The horizontal advance vector. */
+ /* */
+ /* bbox :: Unused. */
+ /* */
+ /* path_begun :: A flag which indicates that a new path has begun. */
+ /* */
+ /* load_points :: If this flag is not set, no points are loaded. */
+ /* */
+ /* no_recurse :: Set but not used. */
+ /* */
+ /* metrics_only :: A boolean indicating that we only want to compute */
+ /* the metrics of a given glyph, not load all of its */
+ /* points. */
+ /* */
+ /* is_t1 :: Set if current font type is Type 1. */
+ /* */
+ /* funcs :: An array of function pointers for the builder. */
+ /* */
+ struct PS_Builder_
+ {
+ FT_Memory memory;
+ FT_Face face;
+ CFF_GlyphSlot glyph;
+ FT_GlyphLoader loader;
+ FT_Outline* base;
+ FT_Outline* current;
+
+ FT_Pos* pos_x;
+ FT_Pos* pos_y;
+
+ FT_Vector* left_bearing;
+ FT_Vector* advance;
+
+ FT_BBox* bbox; /* bounding box */
+ FT_Bool path_begun;
+ FT_Bool load_points;
+ FT_Bool no_recurse;
+
+ FT_Bool metrics_only;
+ FT_Bool is_t1;
+
+ PS_Builder_FuncsRec funcs;
+
+ };
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** PS DECODER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+#define PS_MAX_OPERANDS 48
+#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
+ /* only 10 are allowed but there exist */
+ /* fonts like `HiraKakuProN-W3.ttf' */
+ /* (Hiragino Kaku Gothic ProN W3; */
+ /* 8.2d6e1; 2014-12-19) that exceed */
+ /* this limit */
+
+ /* execution context charstring zone */
+
+ typedef struct PS_Decoder_Zone_
+ {
+ FT_Byte* base;
+ FT_Byte* limit;
+ FT_Byte* cursor;
+
+ } PS_Decoder_Zone;
+
+
+ typedef FT_Error
+ (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face,
+ FT_UInt glyph_index,
+ FT_Byte** pointer,
+ FT_ULong* length );
+
+ typedef void
+ (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face,
+ FT_Byte** pointer,
+ FT_ULong length );
+
+
+ typedef struct PS_Decoder_
+ {
+ PS_Builder builder;
+
+ FT_Fixed stack[PS_MAX_OPERANDS + 1];
+ FT_Fixed* top;
+
+ PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1];
+ PS_Decoder_Zone* zone;
+
+ FT_Int flex_state;
+ FT_Int num_flex_vectors;
+ FT_Vector flex_vectors[7];
+
+ CFF_Font cff;
+ CFF_SubFont current_subfont; /* for current glyph_index */
+ FT_Generic* cf2_instance;
+
+ FT_Pos* glyph_width;
+ FT_Bool width_only;
+ FT_Int num_hints;
+
+ FT_UInt num_locals;
+ FT_UInt num_globals;
+
+ FT_Int locals_bias;
+ FT_Int globals_bias;
+
+ FT_Byte** locals;
+ FT_Byte** globals;
+
+ FT_Byte** glyph_names; /* for pure CFF fonts only */
+ FT_UInt num_glyphs; /* number of glyphs in font */
+
+ FT_Render_Mode hint_mode;
+
+ FT_Bool seac;
+
+ CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
+ CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
+
+ /* Type 1 stuff */
+ FT_Service_PsCMaps psnames; /* for seac */
+
+ FT_Int lenIV; /* internal for sub routine calls */
+ FT_UInt* locals_len; /* array of subrs length (optional) */
+ FT_Hash locals_hash; /* used if `num_subrs' was massaged */
+
+ FT_Matrix font_matrix;
+ FT_Vector font_offset;
+
+ PS_Blend blend; /* for multiple master support */
+
+ FT_Long* buildchar;
+ FT_UInt len_buildchar;
+
+ } PS_Decoder;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
/***** T1 BUILDER *****/
/***** *****/
/*************************************************************************/
@@ -653,10 +869,23 @@ FT_BEGIN_HEADER
void
(*done)( T1_Decoder decoder );
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ FT_Error
+ (*parse_charstrings_old)( T1_Decoder decoder,
+ FT_Byte* base,
+ FT_UInt len );
+#else
+ FT_Error
+ (*parse_metrics)( T1_Decoder decoder,
+ FT_Byte* base,
+ FT_UInt len );
+#endif
+
FT_Error
- (*parse_charstrings)( T1_Decoder decoder,
- FT_Byte* base,
- FT_UInt len );
+ (*parse_charstrings)( PS_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len );
+
} T1_Decoder_FuncsRec;
@@ -700,12 +929,261 @@ FT_BEGIN_HEADER
FT_Bool seac;
+ FT_Generic cf2_instance;
+
} T1_DecoderRec;
/*************************************************************************/
/*************************************************************************/
/***** *****/
+ /***** CFF BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ typedef struct CFF_Builder_ CFF_Builder;
+
+
+ typedef FT_Error
+ (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder,
+ FT_Int count );
+
+ typedef void
+ (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag );
+ typedef FT_Error
+ (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y );
+ typedef FT_Error
+ (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y );
+ typedef void
+ (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder );
+
+ typedef FT_Error
+ (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder );
+
+ typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs;
+
+ typedef struct CFF_Builder_FuncsRec_
+ {
+ void
+ (*init)( CFF_Builder* builder,
+ TT_Face face,
+ CFF_Size size,
+ CFF_GlyphSlot glyph,
+ FT_Bool hinting );
+
+ void
+ (*done)( CFF_Builder* builder );
+
+ CFF_Builder_Check_Points_Func check_points;
+ CFF_Builder_Add_Point_Func add_point;
+ CFF_Builder_Add_Point1_Func add_point1;
+ CFF_Builder_Add_Contour_Func add_contour;
+ CFF_Builder_Start_Point_Func start_point;
+ CFF_Builder_Close_Contour_Func close_contour;
+
+ } CFF_Builder_FuncsRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Structure> */
+ /* CFF_Builder */
+ /* */
+ /* <Description> */
+ /* A structure used during glyph loading to store its outline. */
+ /* */
+ /* <Fields> */
+ /* memory :: The current memory object. */
+ /* */
+ /* face :: The current face object. */
+ /* */
+ /* glyph :: The current glyph slot. */
+ /* */
+ /* loader :: The current glyph loader. */
+ /* */
+ /* base :: The base glyph outline. */
+ /* */
+ /* current :: The current glyph outline. */
+ /* */
+ /* pos_x :: The horizontal translation (if composite glyph). */
+ /* */
+ /* pos_y :: The vertical translation (if composite glyph). */
+ /* */
+ /* left_bearing :: The left side bearing point. */
+ /* */
+ /* advance :: The horizontal advance vector. */
+ /* */
+ /* bbox :: Unused. */
+ /* */
+ /* path_begun :: A flag which indicates that a new path has begun. */
+ /* */
+ /* load_points :: If this flag is not set, no points are loaded. */
+ /* */
+ /* no_recurse :: Set but not used. */
+ /* */
+ /* metrics_only :: A boolean indicating that we only want to compute */
+ /* the metrics of a given glyph, not load all of its */
+ /* points. */
+ /* */
+ /* hints_funcs :: Auxiliary pointer for hinting. */
+ /* */
+ /* hints_globals :: Auxiliary pointer for hinting. */
+ /* */
+ /* funcs :: A table of method pointers for this object. */
+ /* */
+ struct CFF_Builder_
+ {
+ FT_Memory memory;
+ TT_Face face;
+ CFF_GlyphSlot glyph;
+ FT_GlyphLoader loader;
+ FT_Outline* base;
+ FT_Outline* current;
+
+ FT_Pos pos_x;
+ FT_Pos pos_y;
+
+ FT_Vector left_bearing;
+ FT_Vector advance;
+
+ FT_BBox bbox; /* bounding box */
+
+ FT_Bool path_begun;
+ FT_Bool load_points;
+ FT_Bool no_recurse;
+
+ FT_Bool metrics_only;
+
+ void* hints_funcs; /* hinter-specific */
+ void* hints_globals; /* hinter-specific */
+
+ CFF_Builder_FuncsRec funcs;
+ };
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** CFF DECODER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+#define CFF_MAX_OPERANDS 48
+#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
+ /* only 10 are allowed but there exist */
+ /* fonts like `HiraKakuProN-W3.ttf' */
+ /* (Hiragino Kaku Gothic ProN W3; */
+ /* 8.2d6e1; 2014-12-19) that exceed */
+ /* this limit */
+#define CFF_MAX_TRANS_ELEMENTS 32
+
+ /* execution context charstring zone */
+
+ typedef struct CFF_Decoder_Zone_
+ {
+ FT_Byte* base;
+ FT_Byte* limit;
+ FT_Byte* cursor;
+
+ } CFF_Decoder_Zone;
+
+
+ typedef struct CFF_Decoder_
+ {
+ CFF_Builder builder;
+ CFF_Font cff;
+
+ FT_Fixed stack[CFF_MAX_OPERANDS + 1];
+ FT_Fixed* top;
+
+ CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
+ CFF_Decoder_Zone* zone;
+
+ FT_Int flex_state;
+ FT_Int num_flex_vectors;
+ FT_Vector flex_vectors[7];
+
+ FT_Pos glyph_width;
+ FT_Pos nominal_width;
+
+ FT_Bool read_width;
+ FT_Bool width_only;
+ FT_Int num_hints;
+ FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
+
+ FT_UInt num_locals;
+ FT_UInt num_globals;
+
+ FT_Int locals_bias;
+ FT_Int globals_bias;
+
+ FT_Byte** locals;
+ FT_Byte** globals;
+
+ FT_Byte** glyph_names; /* for pure CFF fonts only */
+ FT_UInt num_glyphs; /* number of glyphs in font */
+
+ FT_Render_Mode hint_mode;
+
+ FT_Bool seac;
+
+ CFF_SubFont current_subfont; /* for current glyph_index */
+
+ CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
+ CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
+
+ } CFF_Decoder;
+
+
+ typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs;
+
+ typedef struct CFF_Decoder_FuncsRec_
+ {
+ void
+ (*init)( CFF_Decoder* decoder,
+ TT_Face face,
+ CFF_Size size,
+ CFF_GlyphSlot slot,
+ FT_Bool hinting,
+ FT_Render_Mode hint_mode,
+ CFF_Decoder_Get_Glyph_Callback get_callback,
+ CFF_Decoder_Free_Glyph_Callback free_callback );
+
+ FT_Error
+ (*prepare)( CFF_Decoder* decoder,
+ CFF_Size size,
+ FT_UInt glyph_index );
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ FT_Error
+ (*parse_charstrings_old)( CFF_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len,
+ FT_Bool in_dict );
+#endif
+
+ FT_Error
+ (*parse_charstrings)( PS_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len );
+
+ } CFF_Decoder_FuncsRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
/***** AFM PARSER *****/
/***** *****/
/*************************************************************************/
@@ -810,11 +1288,26 @@ FT_BEGIN_HEADER
FT_Offset length,
FT_UShort seed );
+ FT_UInt32
+ (*cff_random)( FT_UInt32 r );
+
+ void
+ (*ps_decoder_init)( PS_Decoder* ps_decoder,
+ void* decoder,
+ FT_Bool is_t1 );
+
+ void
+ (*t1_make_subfont)( FT_Face face,
+ PS_Private priv,
+ CFF_SubFont subfont );
+
T1_CMap_Classes t1_cmap_classes;
/* fields after this comment line were added after version 2.1.10 */
const AFM_Parser_FuncsRec* afm_parser_funcs;
+ const CFF_Decoder_FuncsRec* cff_decoder_funcs;
+
} PSAux_ServiceRec, *PSAux_Service;
/* backward compatible type definition */
diff --git a/thirdparty/freetype/include/freetype/internal/pshints.h b/thirdparty/freetype/include/freetype/internal/pshints.h
index 49116eb443..d29314ec2e 100644
--- a/thirdparty/freetype/include/freetype/internal/pshints.h
+++ b/thirdparty/freetype/include/freetype/internal/pshints.h
@@ -6,7 +6,7 @@
/* recorders (specification only). These are used to support native */
/* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svbdf.h b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
index eeebf67da1..4a9ec20075 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svbdf.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType BDF services (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svcfftl.h b/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
new file mode 100644
index 0000000000..db623e6840
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
@@ -0,0 +1,112 @@
+/***************************************************************************/
+/* */
+/* svcfftl.h */
+/* */
+/* The FreeType CFF tables loader service (specification). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef SVCFFTL_H_
+#define SVCFFTL_H_
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_INTERNAL_CFF_TYPES_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_CFF_LOAD "cff-load"
+
+
+ typedef FT_UShort
+ (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode );
+
+ typedef FT_Error
+ (*FT_Load_Private_Dict_Func)( CFF_Font font,
+ CFF_SubFont subfont,
+ FT_UInt lenNDV,
+ FT_Fixed* NDV );
+
+ typedef FT_Byte
+ (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect,
+ FT_UInt glyph_index );
+
+ typedef FT_Bool
+ (*FT_Blend_Check_Vector_Func)( CFF_Blend blend,
+ FT_UInt vsindex,
+ FT_UInt lenNDV,
+ FT_Fixed* NDV );
+
+ typedef FT_Error
+ (*FT_Blend_Build_Vector_Func)( CFF_Blend blend,
+ FT_UInt vsindex,
+ FT_UInt lenNDV,
+ FT_Fixed* NDV );
+
+
+ FT_DEFINE_SERVICE( CFFLoad )
+ {
+ FT_Get_Standard_Encoding_Func get_standard_encoding;
+ FT_Load_Private_Dict_Func load_private_dict;
+ FT_FD_Select_Get_Func fd_select_get;
+ FT_Blend_Check_Vector_Func blend_check_vector;
+ FT_Blend_Build_Vector_Func blend_build_vector;
+ };
+
+
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \
+ get_standard_encoding_, \
+ load_private_dict_, \
+ fd_select_get_, \
+ blend_check_vector_, \
+ blend_build_vector_ ) \
+ static const FT_Service_CFFLoadRec class_ = \
+ { \
+ get_standard_encoding_, \
+ load_private_dict_, \
+ fd_select_get_, \
+ blend_check_vector_, \
+ blend_build_vector_ \
+ };
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \
+ get_standard_encoding_, \
+ load_private_dict_, \
+ fd_select_get_, \
+ blend_check_vector_, \
+ blend_build_vector_ ) \
+ void \
+ FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \
+ { \
+ clazz->get_standard_encoding = get_standard_encoding_; \
+ clazz->load_private_dict = load_private_dict_; \
+ clazz->fd_select_get = fd_select_get_; \
+ clazz->blend_check_vector = blend_check_vector_; \
+ clazz->blend_build_vector = blend_build_vector_; \
+ }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+FT_END_HEADER
+
+
+#endif
+
+
+/* END */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svcid.h b/thirdparty/freetype/include/freetype/internal/services/svcid.h
index cce94d8df6..cb59ac6a29 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svcid.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svcid.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType CID font services (specification). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* Derek Clegg and Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
index 376d9255bb..3b732be1a1 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType font format service (specification only). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svgldict.h b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
index 0cd13618d8..f1a68e3110 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svgldict.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph dictionary services (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -56,7 +56,7 @@ FT_BEGIN_HEADER
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
get_name_, \
- name_index_) \
+ name_index_ ) \
static const FT_Service_GlyphDictRec class_ = \
{ \
get_name_, name_index_ \
@@ -66,7 +66,7 @@ FT_BEGIN_HEADER
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
get_name_, \
- name_index_) \
+ name_index_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_GlyphDictRec* clazz ) \
diff --git a/thirdparty/freetype/include/freetype/internal/services/svgxval.h b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
index 71bfa97af8..ed79ebeaa8 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svgxval.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
@@ -4,7 +4,7 @@
/* */
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svkern.h b/thirdparty/freetype/include/freetype/internal/services/svkern.h
index b8344e96e9..c7e8f6ef27 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svkern.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svkern.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType Kerning service (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svmetric.h b/thirdparty/freetype/include/freetype/internal/services/svmetric.h
index 1f7d5ddd0c..abaacddbbe 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svmetric.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svmetric.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType services for metrics variations (specification). */
/* */
-/* Copyright 2016-2017 by */
+/* Copyright 2016-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svmm.h b/thirdparty/freetype/include/freetype/internal/services/svmm.h
index 1d51cd9090..bcbb38e2ce 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svmm.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svmm.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType Multiple Masters and GX var services (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -48,11 +48,15 @@ FT_BEGIN_HEADER
FT_UInt num_coords,
FT_Long* coords );
+ /* use return value -1 to indicate that the new coordinates */
+ /* are equal to the current ones; no changes are thus needed */
typedef FT_Error
(*FT_Set_Var_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
+ /* use return value -1 to indicate that the new coordinates */
+ /* are equal to the current ones; no changes are thus needed */
typedef FT_Error
(*FT_Set_MM_Blend_Func)( FT_Face face,
FT_UInt num_coords,
@@ -64,6 +68,10 @@ FT_BEGIN_HEADER
FT_Fixed* coords );
typedef FT_Error
+ (*FT_Set_Instance_Func)( FT_Face face,
+ FT_UInt instance_index );
+
+ typedef FT_Error
(*FT_Get_MM_Blend_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
@@ -88,6 +96,7 @@ FT_BEGIN_HEADER
FT_Get_MM_Var_Func get_mm_var;
FT_Set_Var_Design_Func set_var_design;
FT_Get_Var_Design_Func get_var_design;
+ FT_Set_Instance_Func set_instance;
/* for internal use; only needed for code sharing between modules */
FT_Get_Var_Blend_Func get_var_blend;
@@ -97,27 +106,29 @@ FT_BEGIN_HEADER
#ifndef FT_CONFIG_OPTION_PIC
-#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
- get_mm_, \
- set_mm_design_, \
- set_mm_blend_, \
- get_mm_blend_, \
- get_mm_var_, \
- set_var_design_, \
- get_var_design_, \
- get_var_blend_, \
- done_blend_ ) \
- static const FT_Service_MultiMastersRec class_ = \
- { \
- get_mm_, \
- set_mm_design_, \
- set_mm_blend_, \
- get_mm_blend_, \
- get_mm_var_, \
- set_var_design_, \
- get_var_design_, \
- get_var_blend_, \
- done_blend_ \
+#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
+ get_mm_, \
+ set_mm_design_, \
+ set_mm_blend_, \
+ get_mm_blend_, \
+ get_mm_var_, \
+ set_var_design_, \
+ get_var_design_, \
+ set_instance_, \
+ get_var_blend_, \
+ done_blend_ ) \
+ static const FT_Service_MultiMastersRec class_ = \
+ { \
+ get_mm_, \
+ set_mm_design_, \
+ set_mm_blend_, \
+ get_mm_blend_, \
+ get_mm_var_, \
+ set_var_design_, \
+ get_var_design_, \
+ set_instance_, \
+ get_var_blend_, \
+ done_blend_ \
};
#else /* FT_CONFIG_OPTION_PIC */
@@ -130,6 +141,7 @@ FT_BEGIN_HEADER
get_mm_var_, \
set_var_design_, \
get_var_design_, \
+ set_instance_, \
get_var_blend_, \
done_blend_ ) \
void \
@@ -142,6 +154,7 @@ FT_BEGIN_HEADER
clazz->get_mm_var = get_mm_var_; \
clazz->set_var_design = set_var_design_; \
clazz->get_var_design = get_var_design_; \
+ clazz->set_instance = set_instance_; \
clazz->get_var_blend = get_var_blend_; \
clazz->done_blend = done_blend_; \
}
diff --git a/thirdparty/freetype/include/freetype/internal/services/svotval.h b/thirdparty/freetype/include/freetype/internal/services/svotval.h
index ac84abee46..31294296a6 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svotval.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svotval.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType OpenType validation service (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpfr.h b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
index c9a182fe39..e65d57e91b 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpfr.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
@@ -4,7 +4,7 @@
/* */
/* Internal PFR service functions (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpostnm.h b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
index 022cdec195..4a49d8b053 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType PostScript name services (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svprop.h b/thirdparty/freetype/include/freetype/internal/services/svprop.h
index eb2d4eed15..adc0bcf439 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svprop.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svprop.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType property service (specification). */
/* */
-/* Copyright 2012-2017 by */
+/* Copyright 2012-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpscmap.h b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
index b32122e5d6..5589575b92 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType PostScript charmap service (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
index 0220ce529c..408f406dfa 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType PostScript info service (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svsfnt.h b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
index 49d18e43e0..e8b37bc47f 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType SFNT table loading service (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svttcmap.h b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
index 30f7feec71..cd0e6fda6f 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType TrueType/sfnt cmap extra information service. */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* Masatake YAMATO, Redhat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svtteng.h b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
index e4b368ad40..92e3c541f5 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svtteng.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType TrueType engine query service (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svttglyf.h b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
index b7793059fd..16fac1ca18 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType TrueType glyph service. */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
index c94b7e1073..80d481cbd1 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType Windows FNT/FONT service (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/sfnt.h b/thirdparty/freetype/include/freetype/internal/sfnt.h
index b8667a003a..fb1e327aeb 100644
--- a/thirdparty/freetype/include/freetype/internal/sfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/sfnt.h
@@ -4,7 +4,7 @@
/* */
/* High-level `sfnt' driver interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/t1types.h b/thirdparty/freetype/include/freetype/internal/t1types.h
index b2e35d42d1..2118e33674 100644
--- a/thirdparty/freetype/include/freetype/internal/t1types.h
+++ b/thirdparty/freetype/include/freetype/internal/t1types.h
@@ -5,7 +5,7 @@
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/internal/tttypes.h b/thirdparty/freetype/include/freetype/internal/tttypes.h
index c0758e25fc..10dd336a89 100644
--- a/thirdparty/freetype/include/freetype/internal/tttypes.h
+++ b/thirdparty/freetype/include/freetype/internal/tttypes.h
@@ -5,7 +5,7 @@
/* Basic SFNT/TrueType type definitions and interface (specification */
/* only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -148,7 +148,7 @@ FT_BEGIN_HEADER
/* <Fields> */
/* See */
/* */
- /* http://www.w3.org/TR/WOFF/#WOFFHeader */
+ /* https://www.w3.org/TR/WOFF/#WOFFHeader */
/* */
typedef struct WOFF_HeaderRec_
{
@@ -1299,10 +1299,6 @@ FT_BEGIN_HEADER
/* variation tables (rather like Multiple */
/* Master data). */
/* */
- /* is_default_instance :: Set if the glyph outlines can be used */
- /* unmodified (i.e., without applying glyph */
- /* variation deltas). */
- /* */
/* variation_support :: Flags that indicate which OpenType */
/* functionality related to font variation */
/* support is present, valid, and usable. */
@@ -1445,6 +1441,9 @@ FT_BEGIN_HEADER
void* var;
#endif
+ /* a typeless pointer to the PostScript Aux service */
+ void* psaux;
+
/***********************************************************************/
/* */
@@ -1509,7 +1508,6 @@ FT_BEGIN_HEADER
FT_Bool doblend;
GX_Blend blend;
- FT_Bool is_default_instance; /* since 2.7.1 */
FT_UInt32 variation_support; /* since 2.7.1 */
const char* var_postscript_prefix; /* since 2.7.2 */
diff --git a/thirdparty/freetype/include/freetype/t1tables.h b/thirdparty/freetype/include/freetype/t1tables.h
index 3f6b36e108..3503c2616b 100644
--- a/thirdparty/freetype/include/freetype/t1tables.h
+++ b/thirdparty/freetype/include/freetype/t1tables.h
@@ -5,7 +5,7 @@
/* Basic Type 1/Type 2 tables definitions and interface (specification */
/* only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -554,6 +554,9 @@ FT_BEGIN_HEADER
/* T1_ENCODING_TYPE_ISOLATIN1 :: */
/* T1_ENCODING_TYPE_EXPERT :: */
/* */
+ /* <Since> */
+ /* 2.4.8 */
+ /* */
typedef enum T1_EncodingType_
{
T1_ENCODING_TYPE_NONE = 0,
@@ -622,6 +625,9 @@ FT_BEGIN_HEADER
/* PS_DICT_FS_TYPE :: */
/* PS_DICT_ITALIC_ANGLE :: */
/* */
+ /* <Since> */
+ /* 2.4.8 */
+ /* */
typedef enum PS_Dict_Keys_
{
/* conventionally in the font dictionary */
@@ -743,6 +749,9 @@ FT_BEGIN_HEADER
* If the font's format is not PostScript-based, this function returns
* the `FT_Err_Invalid_Argument' error code.
*
+ * @since:
+ * 2.4.8
+ *
*/
FT_EXPORT( FT_Long )
FT_Get_PS_Font_Value( FT_Face face,
diff --git a/thirdparty/freetype/include/freetype/ttnameid.h b/thirdparty/freetype/include/freetype/ttnameid.h
index 494d677186..8605183dc7 100644
--- a/thirdparty/freetype/include/freetype/ttnameid.h
+++ b/thirdparty/freetype/include/freetype/ttnameid.h
@@ -4,7 +4,7 @@
/* */
/* TrueType name ID definitions (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -437,7 +437,7 @@ FT_BEGIN_HEADER
*
* The canonical source for Microsoft's IDs is
*
- * http://www.microsoft.com/globaldev/reference/lcid-all.mspx ,
+ * https://www.microsoft.com/globaldev/reference/lcid-all.mspx ,
*
* however, we only provide macros for language identifiers present in
* the OpenType specification: Microsoft has abandoned the concept of
diff --git a/thirdparty/freetype/include/freetype/tttables.h b/thirdparty/freetype/include/freetype/tttables.h
index 58312044ca..ce6a61779c 100644
--- a/thirdparty/freetype/include/freetype/tttables.h
+++ b/thirdparty/freetype/include/freetype/tttables.h
@@ -5,7 +5,7 @@
/* Basic SFNT/TrueType tables definitions and interface */
/* (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/freetype/tttags.h b/thirdparty/freetype/include/freetype/tttags.h
index b7d3bac0f1..e5cee68a15 100644
--- a/thirdparty/freetype/include/freetype/tttags.h
+++ b/thirdparty/freetype/include/freetype/tttags.h
@@ -4,7 +4,7 @@
/* */
/* Tags for TrueType and OpenType tables (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/include/ft2build.h b/thirdparty/freetype/include/ft2build.h
index e7d808f3f4..e7ce99bc94 100644
--- a/thirdparty/freetype/include/ft2build.h
+++ b/thirdparty/freetype/include/ft2build.h
@@ -4,7 +4,7 @@
/* */
/* FreeType 2 build and setup macros. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afangles.c b/thirdparty/freetype/src/autofit/afangles.c
index ccdae84136..c65a3ae23e 100644
--- a/thirdparty/freetype/src/autofit/afangles.c
+++ b/thirdparty/freetype/src/autofit/afangles.c
@@ -5,7 +5,7 @@
/* Routines used to compute vector angles with limited accuracy */
/* and very high speed. It also contains sorting routines (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afblue.c b/thirdparty/freetype/src/autofit/afblue.c
index fedeacf797..e4078fd044 100644
--- a/thirdparty/freetype/src/autofit/afblue.c
+++ b/thirdparty/freetype/src/autofit/afblue.c
@@ -7,7 +7,7 @@
/* */
/* Auto-fitter data for blue strings (body). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -166,6 +166,10 @@
'\0',
'\xE2', '\xB4', '\x84', ' ', '\xE2', '\xB4', '\x85', ' ', '\xE2', '\xB4', '\x94', ' ', '\xE2', '\xB4', '\x95', ' ', '\xE2', '\xB4', '\x81', ' ', '\xE2', '\xB4', '\x82', ' ', '\xE2', '\xB4', '\x98', ' ', '\xE2', '\xB4', '\x9D', /* â´„ â´… â´” â´• â´ â´‚ â´˜ â´ */
'\0',
+ '\xE1', '\xB2', '\x9C', ' ', '\xE1', '\xB2', '\x9F', ' ', '\xE1', '\xB2', '\xB3', ' ', '\xE1', '\xB2', '\xB8', ' ', '\xE1', '\xB2', '\x92', ' ', '\xE1', '\xB2', '\x94', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xB4', /* Ნ Ჟ Ჳ Ჸ Გ Ე ᲠᲴ */
+ '\0',
+ '\xE1', '\xB2', '\x98', ' ', '\xE1', '\xB2', '\xB2', ' ', '\xE1', '\xB2', '\x9D', ' ', '\xE1', '\xB2', '\xA9', ' ', '\xE1', '\xB2', '\x9B', ' ', '\xE1', '\xB2', '\xA8', ' ', '\xE1', '\xB2', '\xAF', ' ', '\xE1', '\xB2', '\xBD', /* Ი Ჲ ᲠᲩ Მ Შ Ჯ Ჽ */
+ '\0',
'\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x94', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\xAB', ' ', '\xE2', '\xB0', '\x8B', /* â°… â°” â°ª â°„ â°‚ â°Š â°« â°‹ */
'\0',
'\xE2', '\xB0', '\x85', ' ', '\xE2', '\xB0', '\x84', ' ', '\xE2', '\xB0', '\x82', ' ', '\xE2', '\xB0', '\xAA', ' ', '\xE2', '\xB0', '\x9E', ' ', '\xE2', '\xB0', '\xA1', ' ', '\xE2', '\xB0', '\x8A', ' ', '\xE2', '\xB0', '\x94', /* â°… â°„ â°‚ â°ª â°ž â°¡ â°Š â°” */
@@ -539,6 +543,8 @@
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 },
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 },
+ { AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM, 0 },
diff --git a/thirdparty/freetype/src/autofit/afblue.cin b/thirdparty/freetype/src/autofit/afblue.cin
index f9080c54d4..4913e2eb6f 100644
--- a/thirdparty/freetype/src/autofit/afblue.cin
+++ b/thirdparty/freetype/src/autofit/afblue.cin
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter data for blue strings (body). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afblue.dat b/thirdparty/freetype/src/autofit/afblue.dat
index f62eb82a1a..bc2f0d2754 100644
--- a/thirdparty/freetype/src/autofit/afblue.dat
+++ b/thirdparty/freetype/src/autofit/afblue.dat
@@ -2,7 +2,7 @@
//
// Auto-fitter data for blue strings.
//
-// Copyright 2013-2017 by
+// Copyright 2013-2018 by
// David Turner, Robert Wilhelm, and Werner Lemberg.
//
// This file is part of the FreeType project, and may only be used,
@@ -242,6 +242,11 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER
"â´„ â´… â´” â´• â´ â´‚ â´˜ â´"
+ AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP
+ "Ნ Ჟ Ჳ Ჸ Გ Ე ᲠᲴ"
+ AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM
+ "Ი Ჲ ᲠᲩ Მ Შ Ჯ Ჽ"
+
AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP
"â°… â°” â°ª â°„ â°‚ â°Š â°« â°‹"
AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM
@@ -795,13 +800,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_ETHIOPIC_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
- // blue zones for Mtavruli are missing (not yet defined in Unicode)
AF_BLUE_STRINGSET_GEOR
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM, 0 }
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER, AF_BLUE_PROPERTY_LATIN_TOP }
{ AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER, 0 }
+ { AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
AF_BLUE_STRINGSET_GEOK
diff --git a/thirdparty/freetype/src/autofit/afblue.h b/thirdparty/freetype/src/autofit/afblue.h
index 99ef51cd4a..de31e259c3 100644
--- a/thirdparty/freetype/src/autofit/afblue.h
+++ b/thirdparty/freetype/src/autofit/afblue.h
@@ -7,7 +7,7 @@
/* */
/* Auto-fitter data for blue strings (specification). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -147,119 +147,121 @@ FT_BEGIN_HEADER
AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 1813,
AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 1845,
AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 1877,
- AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1909,
- AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 1941,
- AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 1973,
- AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 2005,
- AF_BLUE_STRING_GOTHIC_TOP = 2037,
- AF_BLUE_STRING_GOTHIC_BOTTOM = 2077,
- AF_BLUE_STRING_GREEK_CAPITAL_TOP = 2097,
- AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 2118,
- AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 2136,
- AF_BLUE_STRING_GREEK_SMALL = 2154,
- AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 2178,
- AF_BLUE_STRING_GUJARATI_TOP = 2202,
- AF_BLUE_STRING_GUJARATI_BOTTOM = 2234,
- AF_BLUE_STRING_GUJARATI_ASCENDER = 2266,
- AF_BLUE_STRING_GUJARATI_DESCENDER = 2316,
- AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 2349,
- AF_BLUE_STRING_GURMUKHI_BASE = 2369,
- AF_BLUE_STRING_GURMUKHI_HEAD = 2401,
- AF_BLUE_STRING_GURMUKHI_TOP = 2433,
- AF_BLUE_STRING_GURMUKHI_BOTTOM = 2465,
- AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2497,
- AF_BLUE_STRING_HEBREW_TOP = 2517,
- AF_BLUE_STRING_HEBREW_BOTTOM = 2541,
- AF_BLUE_STRING_HEBREW_DESCENDER = 2559,
- AF_BLUE_STRING_KANNADA_TOP = 2574,
- AF_BLUE_STRING_KANNADA_BOTTOM = 2618,
- AF_BLUE_STRING_KAYAH_LI_TOP = 2650,
- AF_BLUE_STRING_KAYAH_LI_BOTTOM = 2674,
- AF_BLUE_STRING_KAYAH_LI_ASCENDER = 2694,
- AF_BLUE_STRING_KAYAH_LI_DESCENDER = 2702,
- AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER = 2714,
- AF_BLUE_STRING_KHMER_TOP = 2735,
- AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2759,
- AF_BLUE_STRING_KHMER_BOTTOM = 2799,
- AF_BLUE_STRING_KHMER_DESCENDER = 2831,
- AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2865,
- AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 2952,
- AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 2960,
- AF_BLUE_STRING_LAO_TOP = 2968,
- AF_BLUE_STRING_LAO_BOTTOM = 3000,
- AF_BLUE_STRING_LAO_ASCENDER = 3032,
- AF_BLUE_STRING_LAO_LARGE_ASCENDER = 3048,
- AF_BLUE_STRING_LAO_DESCENDER = 3060,
- AF_BLUE_STRING_LATIN_CAPITAL_TOP = 3084,
- AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 3100,
- AF_BLUE_STRING_LATIN_SMALL_F_TOP = 3116,
- AF_BLUE_STRING_LATIN_SMALL_TOP = 3130,
- AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 3146,
- AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 3162,
- AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 3172,
- AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 3192,
- AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 3212,
- AF_BLUE_STRING_LATIN_SUBS_SMALL = 3232,
- AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 3268,
- AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 3288,
- AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 3319,
- AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 3348,
- AF_BLUE_STRING_LATIN_SUPS_SMALL = 3374,
- AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 3399,
- AF_BLUE_STRING_LISU_TOP = 3410,
- AF_BLUE_STRING_LISU_BOTTOM = 3442,
- AF_BLUE_STRING_MALAYALAM_TOP = 3474,
- AF_BLUE_STRING_MALAYALAM_BOTTOM = 3518,
- AF_BLUE_STRING_MYANMAR_TOP = 3550,
- AF_BLUE_STRING_MYANMAR_BOTTOM = 3582,
- AF_BLUE_STRING_MYANMAR_ASCENDER = 3614,
- AF_BLUE_STRING_MYANMAR_DESCENDER = 3642,
- AF_BLUE_STRING_NKO_TOP = 3674,
- AF_BLUE_STRING_NKO_BOTTOM = 3698,
- AF_BLUE_STRING_NKO_SMALL_TOP = 3713,
- AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3722,
- AF_BLUE_STRING_OL_CHIKI = 3734,
- AF_BLUE_STRING_OLD_TURKIC_TOP = 3758,
- AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3773,
- AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3793,
- AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3833,
- AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3863,
- AF_BLUE_STRING_OSAGE_SMALL_TOP = 3878,
- AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3918,
- AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 3958,
- AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 3983,
- AF_BLUE_STRING_OSMANYA_TOP = 3998,
- AF_BLUE_STRING_OSMANYA_BOTTOM = 4038,
- AF_BLUE_STRING_SAURASHTRA_TOP = 4078,
- AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4110,
- AF_BLUE_STRING_SHAVIAN_TOP = 4130,
- AF_BLUE_STRING_SHAVIAN_BOTTOM = 4140,
- AF_BLUE_STRING_SHAVIAN_DESCENDER = 4165,
- AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4175,
- AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4210,
- AF_BLUE_STRING_SINHALA_TOP = 4225,
- AF_BLUE_STRING_SINHALA_BOTTOM = 4257,
- AF_BLUE_STRING_SINHALA_DESCENDER = 4289,
- AF_BLUE_STRING_SUNDANESE_TOP = 4333,
- AF_BLUE_STRING_SUNDANESE_BOTTOM = 4357,
- AF_BLUE_STRING_SUNDANESE_DESCENDER = 4389,
- AF_BLUE_STRING_TAI_VIET_TOP = 4397,
- AF_BLUE_STRING_TAI_VIET_BOTTOM = 4417,
- AF_BLUE_STRING_TAMIL_TOP = 4429,
- AF_BLUE_STRING_TAMIL_BOTTOM = 4461,
- AF_BLUE_STRING_TELUGU_TOP = 4493,
- AF_BLUE_STRING_TELUGU_BOTTOM = 4521,
- AF_BLUE_STRING_THAI_TOP = 4549,
- AF_BLUE_STRING_THAI_BOTTOM = 4573,
- AF_BLUE_STRING_THAI_ASCENDER = 4601,
- AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4613,
- AF_BLUE_STRING_THAI_DESCENDER = 4625,
- AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4641,
- AF_BLUE_STRING_THAI_DIGIT_TOP = 4649,
- AF_BLUE_STRING_TIFINAGH = 4661,
- AF_BLUE_STRING_VAI_TOP = 4693,
- AF_BLUE_STRING_VAI_BOTTOM = 4725,
- af_blue_1_1 = 4756,
+ AF_BLUE_STRING_GEORGIAN_MTAVRULI_TOP = 1909,
+ AF_BLUE_STRING_GEORGIAN_MTAVRULI_BOTTOM = 1941,
+ AF_BLUE_STRING_GLAGOLITIC_CAPITAL_TOP = 1973,
+ AF_BLUE_STRING_GLAGOLITIC_CAPITAL_BOTTOM = 2005,
+ AF_BLUE_STRING_GLAGOLITIC_SMALL_TOP = 2037,
+ AF_BLUE_STRING_GLAGOLITIC_SMALL_BOTTOM = 2069,
+ AF_BLUE_STRING_GOTHIC_TOP = 2101,
+ AF_BLUE_STRING_GOTHIC_BOTTOM = 2141,
+ AF_BLUE_STRING_GREEK_CAPITAL_TOP = 2161,
+ AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 2182,
+ AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 2200,
+ AF_BLUE_STRING_GREEK_SMALL = 2218,
+ AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 2242,
+ AF_BLUE_STRING_GUJARATI_TOP = 2266,
+ AF_BLUE_STRING_GUJARATI_BOTTOM = 2298,
+ AF_BLUE_STRING_GUJARATI_ASCENDER = 2330,
+ AF_BLUE_STRING_GUJARATI_DESCENDER = 2380,
+ AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 2413,
+ AF_BLUE_STRING_GURMUKHI_BASE = 2433,
+ AF_BLUE_STRING_GURMUKHI_HEAD = 2465,
+ AF_BLUE_STRING_GURMUKHI_TOP = 2497,
+ AF_BLUE_STRING_GURMUKHI_BOTTOM = 2529,
+ AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 2561,
+ AF_BLUE_STRING_HEBREW_TOP = 2581,
+ AF_BLUE_STRING_HEBREW_BOTTOM = 2605,
+ AF_BLUE_STRING_HEBREW_DESCENDER = 2623,
+ AF_BLUE_STRING_KANNADA_TOP = 2638,
+ AF_BLUE_STRING_KANNADA_BOTTOM = 2682,
+ AF_BLUE_STRING_KAYAH_LI_TOP = 2714,
+ AF_BLUE_STRING_KAYAH_LI_BOTTOM = 2738,
+ AF_BLUE_STRING_KAYAH_LI_ASCENDER = 2758,
+ AF_BLUE_STRING_KAYAH_LI_DESCENDER = 2766,
+ AF_BLUE_STRING_KAYAH_LI_LARGE_DESCENDER = 2778,
+ AF_BLUE_STRING_KHMER_TOP = 2799,
+ AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 2823,
+ AF_BLUE_STRING_KHMER_BOTTOM = 2863,
+ AF_BLUE_STRING_KHMER_DESCENDER = 2895,
+ AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 2929,
+ AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 3016,
+ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 3024,
+ AF_BLUE_STRING_LAO_TOP = 3032,
+ AF_BLUE_STRING_LAO_BOTTOM = 3064,
+ AF_BLUE_STRING_LAO_ASCENDER = 3096,
+ AF_BLUE_STRING_LAO_LARGE_ASCENDER = 3112,
+ AF_BLUE_STRING_LAO_DESCENDER = 3124,
+ AF_BLUE_STRING_LATIN_CAPITAL_TOP = 3148,
+ AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 3164,
+ AF_BLUE_STRING_LATIN_SMALL_F_TOP = 3180,
+ AF_BLUE_STRING_LATIN_SMALL_TOP = 3194,
+ AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 3210,
+ AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 3226,
+ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 3236,
+ AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 3256,
+ AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 3276,
+ AF_BLUE_STRING_LATIN_SUBS_SMALL = 3296,
+ AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 3332,
+ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 3352,
+ AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 3383,
+ AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 3412,
+ AF_BLUE_STRING_LATIN_SUPS_SMALL = 3438,
+ AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 3463,
+ AF_BLUE_STRING_LISU_TOP = 3474,
+ AF_BLUE_STRING_LISU_BOTTOM = 3506,
+ AF_BLUE_STRING_MALAYALAM_TOP = 3538,
+ AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582,
+ AF_BLUE_STRING_MYANMAR_TOP = 3614,
+ AF_BLUE_STRING_MYANMAR_BOTTOM = 3646,
+ AF_BLUE_STRING_MYANMAR_ASCENDER = 3678,
+ AF_BLUE_STRING_MYANMAR_DESCENDER = 3706,
+ AF_BLUE_STRING_NKO_TOP = 3738,
+ AF_BLUE_STRING_NKO_BOTTOM = 3762,
+ AF_BLUE_STRING_NKO_SMALL_TOP = 3777,
+ AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3786,
+ AF_BLUE_STRING_OL_CHIKI = 3798,
+ AF_BLUE_STRING_OLD_TURKIC_TOP = 3822,
+ AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3837,
+ AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3857,
+ AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3897,
+ AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3927,
+ AF_BLUE_STRING_OSAGE_SMALL_TOP = 3942,
+ AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 3982,
+ AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4022,
+ AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4047,
+ AF_BLUE_STRING_OSMANYA_TOP = 4062,
+ AF_BLUE_STRING_OSMANYA_BOTTOM = 4102,
+ AF_BLUE_STRING_SAURASHTRA_TOP = 4142,
+ AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4174,
+ AF_BLUE_STRING_SHAVIAN_TOP = 4194,
+ AF_BLUE_STRING_SHAVIAN_BOTTOM = 4204,
+ AF_BLUE_STRING_SHAVIAN_DESCENDER = 4229,
+ AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4239,
+ AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4274,
+ AF_BLUE_STRING_SINHALA_TOP = 4289,
+ AF_BLUE_STRING_SINHALA_BOTTOM = 4321,
+ AF_BLUE_STRING_SINHALA_DESCENDER = 4353,
+ AF_BLUE_STRING_SUNDANESE_TOP = 4397,
+ AF_BLUE_STRING_SUNDANESE_BOTTOM = 4421,
+ AF_BLUE_STRING_SUNDANESE_DESCENDER = 4453,
+ AF_BLUE_STRING_TAI_VIET_TOP = 4461,
+ AF_BLUE_STRING_TAI_VIET_BOTTOM = 4481,
+ AF_BLUE_STRING_TAMIL_TOP = 4493,
+ AF_BLUE_STRING_TAMIL_BOTTOM = 4525,
+ AF_BLUE_STRING_TELUGU_TOP = 4557,
+ AF_BLUE_STRING_TELUGU_BOTTOM = 4585,
+ AF_BLUE_STRING_THAI_TOP = 4613,
+ AF_BLUE_STRING_THAI_BOTTOM = 4637,
+ AF_BLUE_STRING_THAI_ASCENDER = 4665,
+ AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4677,
+ AF_BLUE_STRING_THAI_DESCENDER = 4689,
+ AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4705,
+ AF_BLUE_STRING_THAI_DIGIT_TOP = 4713,
+ AF_BLUE_STRING_TIFINAGH = 4725,
+ AF_BLUE_STRING_VAI_TOP = 4757,
+ AF_BLUE_STRING_VAI_BOTTOM = 4789,
+ af_blue_1_1 = 4820,
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203,
@@ -336,41 +338,41 @@ FT_BEGIN_HEADER
AF_BLUE_STRINGSET_DSRT = 75,
AF_BLUE_STRINGSET_ETHI = 80,
AF_BLUE_STRINGSET_GEOR = 83,
- AF_BLUE_STRINGSET_GEOK = 88,
- AF_BLUE_STRINGSET_GLAG = 95,
- AF_BLUE_STRINGSET_GOTH = 100,
- AF_BLUE_STRINGSET_GREK = 103,
- AF_BLUE_STRINGSET_GUJR = 110,
- AF_BLUE_STRINGSET_GURU = 116,
- AF_BLUE_STRINGSET_HEBR = 122,
- AF_BLUE_STRINGSET_KALI = 126,
- AF_BLUE_STRINGSET_KHMR = 132,
- AF_BLUE_STRINGSET_KHMS = 138,
- AF_BLUE_STRINGSET_KNDA = 141,
- AF_BLUE_STRINGSET_LAO = 144,
- AF_BLUE_STRINGSET_LATN = 150,
- AF_BLUE_STRINGSET_LATB = 157,
- AF_BLUE_STRINGSET_LATP = 164,
- AF_BLUE_STRINGSET_LISU = 171,
- AF_BLUE_STRINGSET_MLYM = 174,
- AF_BLUE_STRINGSET_MYMR = 177,
- AF_BLUE_STRINGSET_NKOO = 182,
- AF_BLUE_STRINGSET_NONE = 187,
- AF_BLUE_STRINGSET_OLCK = 188,
- AF_BLUE_STRINGSET_ORKH = 191,
- AF_BLUE_STRINGSET_OSGE = 194,
- AF_BLUE_STRINGSET_OSMA = 202,
- AF_BLUE_STRINGSET_SAUR = 205,
- AF_BLUE_STRINGSET_SHAW = 208,
- AF_BLUE_STRINGSET_SINH = 214,
- AF_BLUE_STRINGSET_SUND = 218,
- AF_BLUE_STRINGSET_TAML = 222,
- AF_BLUE_STRINGSET_TAVT = 225,
- AF_BLUE_STRINGSET_TELU = 228,
- AF_BLUE_STRINGSET_TFNG = 231,
- AF_BLUE_STRINGSET_THAI = 234,
- AF_BLUE_STRINGSET_VAII = 242,
- af_blue_2_1 = 245,
+ AF_BLUE_STRINGSET_GEOK = 90,
+ AF_BLUE_STRINGSET_GLAG = 97,
+ AF_BLUE_STRINGSET_GOTH = 102,
+ AF_BLUE_STRINGSET_GREK = 105,
+ AF_BLUE_STRINGSET_GUJR = 112,
+ AF_BLUE_STRINGSET_GURU = 118,
+ AF_BLUE_STRINGSET_HEBR = 124,
+ AF_BLUE_STRINGSET_KALI = 128,
+ AF_BLUE_STRINGSET_KHMR = 134,
+ AF_BLUE_STRINGSET_KHMS = 140,
+ AF_BLUE_STRINGSET_KNDA = 143,
+ AF_BLUE_STRINGSET_LAO = 146,
+ AF_BLUE_STRINGSET_LATN = 152,
+ AF_BLUE_STRINGSET_LATB = 159,
+ AF_BLUE_STRINGSET_LATP = 166,
+ AF_BLUE_STRINGSET_LISU = 173,
+ AF_BLUE_STRINGSET_MLYM = 176,
+ AF_BLUE_STRINGSET_MYMR = 179,
+ AF_BLUE_STRINGSET_NKOO = 184,
+ AF_BLUE_STRINGSET_NONE = 189,
+ AF_BLUE_STRINGSET_OLCK = 190,
+ AF_BLUE_STRINGSET_ORKH = 193,
+ AF_BLUE_STRINGSET_OSGE = 196,
+ AF_BLUE_STRINGSET_OSMA = 204,
+ AF_BLUE_STRINGSET_SAUR = 207,
+ AF_BLUE_STRINGSET_SHAW = 210,
+ AF_BLUE_STRINGSET_SINH = 216,
+ AF_BLUE_STRINGSET_SUND = 220,
+ AF_BLUE_STRINGSET_TAML = 224,
+ AF_BLUE_STRINGSET_TAVT = 227,
+ AF_BLUE_STRINGSET_TELU = 230,
+ AF_BLUE_STRINGSET_TFNG = 233,
+ AF_BLUE_STRINGSET_THAI = 236,
+ AF_BLUE_STRINGSET_VAII = 244,
+ af_blue_2_1 = 247,
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
af_blue_2_1_1 = af_blue_2_1 + 2,
diff --git a/thirdparty/freetype/src/autofit/afblue.hin b/thirdparty/freetype/src/autofit/afblue.hin
index 268bcbc531..682147cb30 100644
--- a/thirdparty/freetype/src/autofit/afblue.hin
+++ b/thirdparty/freetype/src/autofit/afblue.hin
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter data for blue strings (specification). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afcjk.c b/thirdparty/freetype/src/autofit/afcjk.c
index 897533d148..21b6bffa33 100644
--- a/thirdparty/freetype/src/autofit/afcjk.c
+++ b/thirdparty/freetype/src/autofit/afcjk.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for CJK writing system (body). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,9 +16,9 @@
/***************************************************************************/
/*
- * The algorithm is based on akito's autohint patch, available here:
+ * The algorithm is based on akito's autohint patch, archived at
*
- * http://www.kde.gr.jp/~akito/patch/freetype2/
+ * https://web.archive.org/web/20051219160454/http://www.kde.gr.jp:80/~akito/patch/freetype2/2.1.7/
*
*/
diff --git a/thirdparty/freetype/src/autofit/afcjk.h b/thirdparty/freetype/src/autofit/afcjk.h
index 84f892f909..d229c0c9cf 100644
--- a/thirdparty/freetype/src/autofit/afcjk.h
+++ b/thirdparty/freetype/src/autofit/afcjk.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for CJK writing system (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afcover.h b/thirdparty/freetype/src/autofit/afcover.h
index 1b18c666ab..6eeb8fc9fb 100644
--- a/thirdparty/freetype/src/autofit/afcover.h
+++ b/thirdparty/freetype/src/autofit/afcover.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter coverages (specification only). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afdummy.c b/thirdparty/freetype/src/autofit/afdummy.c
index 61c32db5bf..f30c517cbb 100644
--- a/thirdparty/freetype/src/autofit/afdummy.c
+++ b/thirdparty/freetype/src/autofit/afdummy.c
@@ -5,7 +5,7 @@
/* Auto-fitter dummy routines to be used if no hinting should be */
/* performed (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afdummy.h b/thirdparty/freetype/src/autofit/afdummy.h
index ebaa7d76ea..b382acd92a 100644
--- a/thirdparty/freetype/src/autofit/afdummy.h
+++ b/thirdparty/freetype/src/autofit/afdummy.h
@@ -5,7 +5,7 @@
/* Auto-fitter dummy routines to be used if no hinting should be */
/* performed (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/aferrors.h b/thirdparty/freetype/src/autofit/aferrors.h
index dde182f3c8..e5de54360f 100644
--- a/thirdparty/freetype/src/autofit/aferrors.h
+++ b/thirdparty/freetype/src/autofit/aferrors.h
@@ -4,7 +4,7 @@
/* */
/* Autofitter error codes (specification only). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afglobal.c b/thirdparty/freetype/src/autofit/afglobal.c
index 85bef001f7..3d09c53e8a 100644
--- a/thirdparty/freetype/src/autofit/afglobal.c
+++ b/thirdparty/freetype/src/autofit/afglobal.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter routines to compute global hinting values (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afglobal.h b/thirdparty/freetype/src/autofit/afglobal.h
index de6142ea26..489ed46d9e 100644
--- a/thirdparty/freetype/src/autofit/afglobal.h
+++ b/thirdparty/freetype/src/autofit/afglobal.h
@@ -5,7 +5,7 @@
/* Auto-fitter routines to compute global hinting values */
/* (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afhints.c b/thirdparty/freetype/src/autofit/afhints.c
index 1b21c06c2c..0666dbc8e2 100644
--- a/thirdparty/freetype/src/autofit/afhints.c
+++ b/thirdparty/freetype/src/autofit/afhints.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -314,8 +314,12 @@
AF_DUMP(( "Table of points:\n" ));
if ( hints->num_points )
+ {
AF_DUMP(( " index hedge hseg vedge vseg flags "
+ /* " XXXXX XXXXX XXXXX XXXXX XXXXX XXXXXX" */
" xorg yorg xscale yscale xfit yfit" ));
+ /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */
+ }
else
AF_DUMP(( " (none)\n" ));
@@ -420,9 +424,14 @@
dimension == AF_DIMENSION_HORZ ? "vertical"
: "horizontal" ));
if ( axis->num_segments )
+ {
AF_DUMP(( " index pos delta dir from to "
+ /* " XXXXX XXXXX XXXXX XXXXX XXXX XXXX" */
" link serif edge"
+ /* " XXXX XXXXX XXXX" */
" height extra flags\n" ));
+ /* " XXXXXX XXXXX XXXXXXXXXXX" */
+ }
else
AF_DUMP(( " (none)\n" ));
@@ -564,8 +573,12 @@
10.0 * hints->y_scale / 65536.0 / 64.0 ));
if ( axis->num_edges )
+ {
AF_DUMP(( " index pos dir link serif"
+ /* " XXXXX XXXX.XX XXXXX XXXX XXXXX" */
" blue opos pos flags\n" ));
+ /* " X XXXX.XX XXXX.XX XXXXXXXXXXX" */
+ }
else
AF_DUMP(( " (none)\n" ));
diff --git a/thirdparty/freetype/src/autofit/afhints.h b/thirdparty/freetype/src/autofit/afhints.h
index 16638b1030..3326ebc44e 100644
--- a/thirdparty/freetype/src/autofit/afhints.h
+++ b/thirdparty/freetype/src/autofit/afhints.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -62,7 +62,7 @@ FT_BEGIN_HEADER
*
* by David Turner and Werner Lemberg
*
- * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf
+ * https://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf
*
* with appropriate updates.
*
diff --git a/thirdparty/freetype/src/autofit/afindic.c b/thirdparty/freetype/src/autofit/afindic.c
index 23be46ed51..dfbea5f34c 100644
--- a/thirdparty/freetype/src/autofit/afindic.c
+++ b/thirdparty/freetype/src/autofit/afindic.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for Indic writing system (body). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afindic.h b/thirdparty/freetype/src/autofit/afindic.h
index ec9e263161..5688738e6e 100644
--- a/thirdparty/freetype/src/autofit/afindic.h
+++ b/thirdparty/freetype/src/autofit/afindic.h
@@ -5,7 +5,7 @@
/* Auto-fitter hinting routines for Indic writing system */
/* (specification). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/aflatin.c b/thirdparty/freetype/src/autofit/aflatin.c
index 02b3b8bbd3..9f1b54056f 100644
--- a/thirdparty/freetype/src/autofit/aflatin.c
+++ b/thirdparty/freetype/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin writing system (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/aflatin.h b/thirdparty/freetype/src/autofit/aflatin.h
index d80e125ddc..432cccce4e 100644
--- a/thirdparty/freetype/src/autofit/aflatin.h
+++ b/thirdparty/freetype/src/autofit/aflatin.h
@@ -5,7 +5,7 @@
/* Auto-fitter hinting routines for latin writing system */
/* (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/aflatin2.c b/thirdparty/freetype/src/autofit/aflatin2.c
index fb42445116..5c71378118 100644
--- a/thirdparty/freetype/src/autofit/aflatin2.c
+++ b/thirdparty/freetype/src/autofit/aflatin2.c
@@ -9,7 +9,7 @@
/* */
/* Auto-fitter hinting routines for latin writing system (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/aflatin2.h b/thirdparty/freetype/src/autofit/aflatin2.h
index 2d0b154f58..0129dc707e 100644
--- a/thirdparty/freetype/src/autofit/aflatin2.h
+++ b/thirdparty/freetype/src/autofit/aflatin2.h
@@ -10,7 +10,7 @@
/* Auto-fitter hinting routines for latin writing system */
/* (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afloader.c b/thirdparty/freetype/src/autofit/afloader.c
index 067ebd17f6..a55550b338 100644
--- a/thirdparty/freetype/src/autofit/afloader.c
+++ b/thirdparty/freetype/src/autofit/afloader.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter glyph loading routines (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afloader.h b/thirdparty/freetype/src/autofit/afloader.h
index 2578abed16..d4d72d1583 100644
--- a/thirdparty/freetype/src/autofit/afloader.h
+++ b/thirdparty/freetype/src/autofit/afloader.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter glyph loading routines (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afmodule.c b/thirdparty/freetype/src/autofit/afmodule.c
index 9d7ba224da..dcaa17a27e 100644
--- a/thirdparty/freetype/src/autofit/afmodule.c
+++ b/thirdparty/freetype/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter module implementation (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -56,7 +56,7 @@
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
-#include FT_AUTOHINTER_H
+#include FT_DRIVER_H
#include FT_SERVICE_PROPERTIES_H
diff --git a/thirdparty/freetype/src/autofit/afmodule.h b/thirdparty/freetype/src/autofit/afmodule.h
index 0571d14d59..56f64eaf23 100644
--- a/thirdparty/freetype/src/autofit/afmodule.h
+++ b/thirdparty/freetype/src/autofit/afmodule.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter module implementation (specification). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afpic.c b/thirdparty/freetype/src/autofit/afpic.c
index 3125e03e27..d48d016a0e 100644
--- a/thirdparty/freetype/src/autofit/afpic.c
+++ b/thirdparty/freetype/src/autofit/afpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for autofit module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afpic.h b/thirdparty/freetype/src/autofit/afpic.h
index 8cd3392123..0c73456785 100644
--- a/thirdparty/freetype/src/autofit/afpic.h
+++ b/thirdparty/freetype/src/autofit/afpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for autofit module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afranges.c b/thirdparty/freetype/src/autofit/afranges.c
index 7f37eea1e0..cf67fafb11 100644
--- a/thirdparty/freetype/src/autofit/afranges.c
+++ b/thirdparty/freetype/src/autofit/afranges.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter Unicode script ranges (body). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -91,7 +91,7 @@
AF_UNIRANGE_REC( 0x06E7, 0x06E8 ),
AF_UNIRANGE_REC( 0x06EA, 0x06ED ),
AF_UNIRANGE_REC( 0x08D4, 0x08E1 ),
- AF_UNIRANGE_REC( 0x08E3, 0x08FF ),
+ AF_UNIRANGE_REC( 0x08D3, 0x08FF ),
AF_UNIRANGE_REC( 0xFBB2, 0xFBC1 ),
AF_UNIRANGE_REC( 0xFE70, 0xFE70 ),
AF_UNIRANGE_REC( 0xFE72, 0xFE72 ),
@@ -163,6 +163,7 @@
AF_UNIRANGE_REC( 0x09C1, 0x09C4 ),
AF_UNIRANGE_REC( 0x09CD, 0x09CD ),
AF_UNIRANGE_REC( 0x09E2, 0x09E3 ),
+ AF_UNIRANGE_REC( 0x09FE, 0x09FE ),
AF_UNIRANGE_REC( 0, 0 )
};
@@ -190,6 +191,7 @@
{
AF_UNIRANGE_REC( 0x11100, 0x11102 ),
AF_UNIRANGE_REC( 0x11127, 0x11134 ),
+ AF_UNIRANGE_REC( 0x11146, 0x11146 ),
AF_UNIRANGE_REC( 0, 0 )
};
@@ -304,6 +306,7 @@
AF_UNIRANGE_REC( 0x0953, 0x0957 ),
AF_UNIRANGE_REC( 0x0962, 0x0963 ),
AF_UNIRANGE_REC( 0xA8E0, 0xA8F1 ),
+ AF_UNIRANGE_REC( 0xA8FF, 0xA8FF ),
AF_UNIRANGE_REC( 0, 0 )
};
@@ -338,11 +341,8 @@
const AF_Script_UniRangeRec af_geor_uniranges[] =
{
- AF_UNIRANGE_REC( 0x10D0, 0x10FF ), /* Georgian (Mkhedruli) */
-#if 0
- /* the following range is proposed for inclusion in Unicode */
- AF_UNIRANGE_REC( 0x1C90, 0x1CBF ), /* Georgian (Mtavruli) */
-#endif
+ AF_UNIRANGE_REC( 0x10D0, 0x10FF ), /* Georgian (Mkhedruli) */
+ AF_UNIRANGE_REC( 0x1C90, 0x1CBF ), /* Georgian Extended (Mtavruli) */
AF_UNIRANGE_REC( 0, 0 )
};
@@ -355,8 +355,8 @@
const AF_Script_UniRangeRec af_geok_uniranges[] =
{
/* Khutsuri */
- AF_UNIRANGE_REC( 0x10A0, 0x10CD ), /* Georgian (Asomtavruli) */
- AF_UNIRANGE_REC( 0x2D00, 0x2D2D ), /* Georgian (Nuskhuri) */
+ AF_UNIRANGE_REC( 0x10A0, 0x10CD ), /* Georgian (Asomtavruli) */
+ AF_UNIRANGE_REC( 0x2D00, 0x2D2D ), /* Georgian Supplement (Nuskhuri) */
AF_UNIRANGE_REC( 0, 0 )
};
@@ -425,6 +425,7 @@
AF_UNIRANGE_REC( 0x0AC1, 0x0AC8 ),
AF_UNIRANGE_REC( 0x0ACD, 0x0ACD ),
AF_UNIRANGE_REC( 0x0AE2, 0x0AE3 ),
+ AF_UNIRANGE_REC( 0x0AFA, 0x0AFF ),
AF_UNIRANGE_REC( 0, 0 )
};
@@ -655,7 +656,8 @@
const AF_Script_UniRangeRec af_mlym_nonbase_uniranges[] =
{
- AF_UNIRANGE_REC( 0x0D01, 0x0D01 ),
+ AF_UNIRANGE_REC( 0x0D00, 0x0D01 ),
+ AF_UNIRANGE_REC( 0x0D3B, 0x0D3C ),
AF_UNIRANGE_REC( 0x0D4D, 0x0D4E ),
AF_UNIRANGE_REC( 0x0D62, 0x0D63 ),
AF_UNIRANGE_REC( 0, 0 )
@@ -697,6 +699,7 @@
const AF_Script_UniRangeRec af_nkoo_nonbase_uniranges[] =
{
AF_UNIRANGE_REC( 0x07EB, 0x07F5 ),
+ AF_UNIRANGE_REC( 0x07FD, 0x07FD ),
AF_UNIRANGE_REC( 0, 0 )
};
@@ -856,6 +859,7 @@
const AF_Script_UniRangeRec af_telu_nonbase_uniranges[] =
{
AF_UNIRANGE_REC( 0x0C00, 0x0C00 ),
+ AF_UNIRANGE_REC( 0x0C04, 0x0C04 ),
AF_UNIRANGE_REC( 0x0C3E, 0x0C40 ),
AF_UNIRANGE_REC( 0x0C46, 0x0C56 ),
AF_UNIRANGE_REC( 0x0C62, 0x0C63 ),
@@ -1006,10 +1010,13 @@
AF_UNIRANGE_REC( 0xFE30, 0xFE4F ), /* CJK Compatibility Forms */
AF_UNIRANGE_REC( 0xFF00, 0xFFEF ), /* Halfwidth and Fullwidth Forms */
AF_UNIRANGE_REC( 0x1B000, 0x1B0FF ), /* Kana Supplement */
+ AF_UNIRANGE_REC( 0x1B100, 0x1B12F ), /* Kana Extended-A */
AF_UNIRANGE_REC( 0x1D300, 0x1D35F ), /* Tai Xuan Hing Symbols */
AF_UNIRANGE_REC( 0x20000, 0x2A6DF ), /* CJK Unified Ideographs Extension B */
AF_UNIRANGE_REC( 0x2A700, 0x2B73F ), /* CJK Unified Ideographs Extension C */
AF_UNIRANGE_REC( 0x2B740, 0x2B81F ), /* CJK Unified Ideographs Extension D */
+ AF_UNIRANGE_REC( 0x2B820, 0x2CEAF ), /* CJK Unified Ideographs Extension E */
+ AF_UNIRANGE_REC( 0x2CEB0, 0x2EBEF ), /* CJK Unified Ideographs Extension F */
AF_UNIRANGE_REC( 0x2F800, 0x2FA1F ), /* CJK Compatibility Ideographs Supplement */
AF_UNIRANGE_REC( 0, 0 )
};
diff --git a/thirdparty/freetype/src/autofit/afranges.h b/thirdparty/freetype/src/autofit/afranges.h
index 72d9eaad2c..ba3b5e7ccb 100644
--- a/thirdparty/freetype/src/autofit/afranges.h
+++ b/thirdparty/freetype/src/autofit/afranges.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter Unicode script ranges (specification). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afscript.h b/thirdparty/freetype/src/autofit/afscript.h
index cb815dbb40..623a1734a6 100644
--- a/thirdparty/freetype/src/autofit/afscript.h
+++ b/thirdparty/freetype/src/autofit/afscript.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter scripts (specification only). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -137,7 +137,7 @@
"Georgian (Mkhedruli)",
HB_SCRIPT_GEORGIAN,
HINTING_BOTTOM_TO_TOP,
- "\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90" ) /* ი ე რ*/
+ "\xE1\x83\x98 \xE1\x83\x94 \xE1\x83\x90 \xE1\xB2\xBF" ) /* ი ე რᲘ */
SCRIPT( geok, GEOK,
"Georgian (Khutsuri)",
diff --git a/thirdparty/freetype/src/autofit/afshaper.c b/thirdparty/freetype/src/autofit/afshaper.c
index d259964217..f30828173c 100644
--- a/thirdparty/freetype/src/autofit/afshaper.c
+++ b/thirdparty/freetype/src/autofit/afshaper.c
@@ -4,7 +4,7 @@
/* */
/* HarfBuzz interface for accessing OpenType features (body). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -104,10 +104,10 @@
{
hb_face_t* face;
- hb_set_t* gsub_lookups; /* GSUB lookups for a given script */
- hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */
- hb_set_t* gpos_lookups; /* GPOS lookups for a given script */
- hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */
+ hb_set_t* gsub_lookups = NULL; /* GSUB lookups for a given script */
+ hb_set_t* gsub_glyphs = NULL; /* glyphs covered by GSUB lookups */
+ hb_set_t* gpos_lookups = NULL; /* GPOS lookups for a given script */
+ hb_set_t* gpos_glyphs = NULL; /* glyphs covered by GPOS lookups */
hb_script_t script;
const hb_tag_t* coverage_tags;
@@ -127,11 +127,6 @@
face = hb_font_get_face( globals->hb_font );
- gsub_lookups = hb_set_create();
- gsub_glyphs = hb_set_create();
- gpos_lookups = hb_set_create();
- gpos_glyphs = hb_set_create();
-
coverage_tags = coverages[style_class->coverage];
script = scripts[style_class->script];
@@ -168,6 +163,7 @@
script_tags[1] = HB_TAG_NONE;
}
+ gsub_lookups = hb_set_create();
hb_ot_layout_collect_lookups( face,
HB_OT_TAG_GSUB,
script_tags,
@@ -178,13 +174,6 @@
if ( hb_set_is_empty( gsub_lookups ) )
goto Exit; /* nothing to do */
- hb_ot_layout_collect_lookups( face,
- HB_OT_TAG_GPOS,
- script_tags,
- NULL,
- coverage_tags,
- gpos_lookups );
-
FT_TRACE4(( "GSUB lookups (style `%s'):\n"
" ",
af_style_names[style_class->style] ));
@@ -193,6 +182,7 @@
count = 0;
#endif
+ gsub_glyphs = hb_set_create();
for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); )
{
#ifdef FT_DEBUG_LEVEL_TRACE
@@ -220,10 +210,19 @@
" ",
af_style_names[style_class->style] ));
+ gpos_lookups = hb_set_create();
+ hb_ot_layout_collect_lookups( face,
+ HB_OT_TAG_GPOS,
+ script_tags,
+ NULL,
+ coverage_tags,
+ gpos_lookups );
+
#ifdef FT_DEBUG_LEVEL_TRACE
count = 0;
#endif
+ gpos_glyphs = hb_set_create();
for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); )
{
#ifdef FT_DEBUG_LEVEL_TRACE
diff --git a/thirdparty/freetype/src/autofit/afshaper.h b/thirdparty/freetype/src/autofit/afshaper.h
index 9185d19003..7efd9f6a4e 100644
--- a/thirdparty/freetype/src/autofit/afshaper.h
+++ b/thirdparty/freetype/src/autofit/afshaper.h
@@ -4,7 +4,7 @@
/* */
/* HarfBuzz interface for accessing OpenType features (specification). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afstyles.h b/thirdparty/freetype/src/autofit/afstyles.h
index 281559eea2..e2688b3fc2 100644
--- a/thirdparty/freetype/src/autofit/afstyles.h
+++ b/thirdparty/freetype/src/autofit/afstyles.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter styles (specification only). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/aftypes.h b/thirdparty/freetype/src/autofit/aftypes.h
index 718dab70b6..6bd8c895b2 100644
--- a/thirdparty/freetype/src/autofit/aftypes.h
+++ b/thirdparty/freetype/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter types (specification only). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -76,9 +76,9 @@ extern void* _af_debug_hints;
typedef struct AF_WidthRec_
{
- FT_Pos org; /* original position/width in font units */
- FT_Pos cur; /* current/scaled position/width in device sub-pixels */
- FT_Pos fit; /* current/fitted position/width in device sub-pixels */
+ FT_Pos org; /* original position/width in font units */
+ FT_Pos cur; /* current/scaled position/width in device subpixels */
+ FT_Pos fit; /* current/fitted position/width in device subpixels */
} AF_WidthRec, *AF_Width;
diff --git a/thirdparty/freetype/src/autofit/afwarp.c b/thirdparty/freetype/src/autofit/afwarp.c
index f99aa6d987..2a75ea7b35 100644
--- a/thirdparty/freetype/src/autofit/afwarp.c
+++ b/thirdparty/freetype/src/autofit/afwarp.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter warping algorithm (body). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afwarp.h b/thirdparty/freetype/src/autofit/afwarp.h
index 2e85cbd851..520b1be907 100644
--- a/thirdparty/freetype/src/autofit/afwarp.h
+++ b/thirdparty/freetype/src/autofit/afwarp.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter warping algorithm (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/afwrtsys.h b/thirdparty/freetype/src/autofit/afwrtsys.h
index 86749a2a83..4675f3242d 100644
--- a/thirdparty/freetype/src/autofit/afwrtsys.h
+++ b/thirdparty/freetype/src/autofit/afwrtsys.h
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter writing systems (specification only). */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/autofit.c b/thirdparty/freetype/src/autofit/autofit.c
index bbedad7b5f..c1605160a1 100644
--- a/thirdparty/freetype/src/autofit/autofit.c
+++ b/thirdparty/freetype/src/autofit/autofit.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter module (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/autofit/module.mk b/thirdparty/freetype/src/autofit/module.mk
index c4e249b6f1..ff05f83e7e 100644
--- a/thirdparty/freetype/src/autofit/module.mk
+++ b/thirdparty/freetype/src/autofit/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2003-2017 by
+# Copyright 2003-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/autofit/rules.mk b/thirdparty/freetype/src/autofit/rules.mk
index ec4e1302d1..75171b412c 100644
--- a/thirdparty/freetype/src/autofit/rules.mk
+++ b/thirdparty/freetype/src/autofit/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2003-2017 by
+# Copyright 2003-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/base/basepic.c b/thirdparty/freetype/src/base/basepic.c
index 57fb8169ad..bc80406441 100644
--- a/thirdparty/freetype/src/base/basepic.c
+++ b/thirdparty/freetype/src/base/basepic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for base. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/basepic.h b/thirdparty/freetype/src/base/basepic.h
index 258d4ce2ba..492d1ede56 100644
--- a/thirdparty/freetype/src/base/basepic.h
+++ b/thirdparty/freetype/src/base/basepic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for base. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftadvanc.c b/thirdparty/freetype/src/base/ftadvanc.c
index 1557607fc5..230c84d6ad 100644
--- a/thirdparty/freetype/src/base/ftadvanc.c
+++ b/thirdparty/freetype/src/base/ftadvanc.c
@@ -4,7 +4,7 @@
/* */
/* Quick computation of advance widths (body). */
/* */
-/* Copyright 2008-2017 by */
+/* Copyright 2008-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -116,9 +116,12 @@
FT_Int32 flags,
FT_Fixed *padvances )
{
+ FT_Error error = FT_Err_Ok;
+
FT_Face_GetAdvancesFunc func;
- FT_UInt num, end, nn;
- FT_Error error = FT_Err_Ok;
+
+ FT_UInt num, end, nn;
+ FT_Int factor;
if ( !face )
@@ -152,16 +155,17 @@
return FT_THROW( Unimplemented_Feature );
flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
+ factor = ( flags & FT_LOAD_NO_SCALE ) ? 1 : 1024;
for ( nn = 0; nn < count; nn++ )
{
error = FT_Load_Glyph( face, start + nn, flags );
if ( error )
break;
- /* scale from 26.6 to 16.16 */
+ /* scale from 26.6 to 16.16, unless NO_SCALE was requested */
padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
- ? face->glyph->advance.y * 1024
- : face->glyph->advance.x * 1024;
+ ? face->glyph->advance.y * factor
+ : face->glyph->advance.x * factor;
}
return error;
diff --git a/thirdparty/freetype/src/base/ftapi.c b/thirdparty/freetype/src/base/ftapi.c
index 4262d37e39..32d6e95d19 100644
--- a/thirdparty/freetype/src/base/ftapi.c
+++ b/thirdparty/freetype/src/base/ftapi.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType compatibility functions (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftbase.c b/thirdparty/freetype/src/base/ftbase.c
index 55f7359942..f914b9b247 100644
--- a/thirdparty/freetype/src/base/ftbase.c
+++ b/thirdparty/freetype/src/base/ftbase.c
@@ -4,7 +4,7 @@
/* */
/* Single object library component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,12 +23,15 @@
#include "ftadvanc.c"
#include "ftcalc.c"
#include "ftdbgmem.c"
+#include "ftfntfmt.c"
#include "ftgloadr.c"
#include "fthash.c"
+#include "ftlcdfil.c"
#include "ftmac.c"
#include "ftobjs.c"
#include "ftoutln.c"
#include "ftpic.c"
+#include "ftpsprop.c"
#include "ftrfork.c"
#include "ftsnames.c"
#include "ftstream.c"
diff --git a/thirdparty/freetype/src/base/ftbase.h b/thirdparty/freetype/src/base/ftbase.h
index 2072284f06..7e8cfad959 100644
--- a/thirdparty/freetype/src/base/ftbase.h
+++ b/thirdparty/freetype/src/base/ftbase.h
@@ -2,9 +2,9 @@
/* */
/* ftbase.h */
/* */
-/* The FreeType private functions used in base module (specification). */
+/* Private functions used in the `base' module (specification). */
/* */
-/* Copyright 2008-2017 by */
+/* Copyright 2008-2018 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -27,6 +27,8 @@
FT_BEGIN_HEADER
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+
/* MacOS resource fork cannot exceed 16MB at least for Carbon code; */
/* see https://support.microsoft.com/en-us/kb/130437 */
#define FT_MAC_RFORK_MAX_LEN 0x00FFFFFFUL
@@ -65,6 +67,8 @@ FT_BEGIN_HEADER
ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index );
#endif
+#endif /* FT_CONFIG_OPTION_MAC_FONTS */
+
FT_END_HEADER
diff --git a/thirdparty/freetype/src/base/ftbbox.c b/thirdparty/freetype/src/base/ftbbox.c
index 6e19da63cb..151e85c97a 100644
--- a/thirdparty/freetype/src/base/ftbbox.c
+++ b/thirdparty/freetype/src/base/ftbbox.c
@@ -4,7 +4,7 @@
/* */
/* FreeType bbox computation (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
diff --git a/thirdparty/freetype/src/base/ftbdf.c b/thirdparty/freetype/src/base/ftbdf.c
index 40f0ca2bb8..c4ea502fbc 100644
--- a/thirdparty/freetype/src/base/ftbdf.c
+++ b/thirdparty/freetype/src/base/ftbdf.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing BDF-specific strings (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftbitmap.c b/thirdparty/freetype/src/base/ftbitmap.c
index e567a0453e..a9746663fa 100644
--- a/thirdparty/freetype/src/base/ftbitmap.c
+++ b/thirdparty/freetype/src/base/ftbitmap.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility functions for bitmaps (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -153,38 +153,36 @@
FT_UInt ypixels )
{
FT_Error error;
- int pitch;
- int new_pitch;
+ unsigned int pitch;
+ unsigned int new_pitch;
FT_UInt bpp;
- FT_UInt i, width, height;
+ FT_UInt width, height;
unsigned char* buffer = NULL;
width = bitmap->width;
height = bitmap->rows;
- pitch = bitmap->pitch;
- if ( pitch < 0 )
- pitch = -pitch;
+ pitch = (unsigned int)FT_ABS( bitmap->pitch );
switch ( bitmap->pixel_mode )
{
case FT_PIXEL_MODE_MONO:
bpp = 1;
- new_pitch = (int)( ( width + xpixels + 7 ) >> 3 );
+ new_pitch = ( width + xpixels + 7 ) >> 3;
break;
case FT_PIXEL_MODE_GRAY2:
bpp = 2;
- new_pitch = (int)( ( width + xpixels + 3 ) >> 2 );
+ new_pitch = ( width + xpixels + 3 ) >> 2;
break;
case FT_PIXEL_MODE_GRAY4:
bpp = 4;
- new_pitch = (int)( ( width + xpixels + 1 ) >> 1 );
+ new_pitch = ( width + xpixels + 1 ) >> 1;
break;
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
bpp = 8;
- new_pitch = (int)( width + xpixels );
+ new_pitch = width + xpixels;
break;
default:
return FT_THROW( Invalid_Glyph_Format );
@@ -194,7 +192,7 @@
if ( ypixels == 0 && new_pitch <= pitch )
{
/* zero the padding */
- FT_UInt bit_width = (FT_UInt)pitch * 8;
+ FT_UInt bit_width = pitch * 8;
FT_UInt bit_last = ( width + xpixels ) * bpp;
@@ -235,31 +233,60 @@
{
FT_UInt len = ( width * bpp + 7 ) >> 3;
+ unsigned char* in = bitmap->buffer;
+ unsigned char* out = buffer;
+
+ unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
+ unsigned int delta = new_pitch - len;
+
+
+ FT_MEM_ZERO( out, new_pitch * ypixels );
+ out += new_pitch * ypixels;
- for ( i = 0; i < bitmap->rows; i++ )
- FT_MEM_COPY( buffer + (FT_UInt)new_pitch * ( ypixels + i ),
- bitmap->buffer + (FT_UInt)pitch * i,
- len );
+ while ( in < limit )
+ {
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += len;
+
+ /* we use FT_QALLOC_MULT, which doesn't zero out the buffer; */
+ /* consequently, we have to manually zero out the remaining bytes */
+ FT_MEM_ZERO( out, delta );
+ out += delta;
+ }
}
else
{
FT_UInt len = ( width * bpp + 7 ) >> 3;
+ unsigned char* in = bitmap->buffer;
+ unsigned char* out = buffer;
+
+ unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
+ unsigned int delta = new_pitch - len;
+
- for ( i = 0; i < bitmap->rows; i++ )
- FT_MEM_COPY( buffer + (FT_UInt)new_pitch * i,
- bitmap->buffer + (FT_UInt)pitch * i,
- len );
+ while ( in < limit )
+ {
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += len;
+
+ FT_MEM_ZERO( out, delta );
+ out += delta;
+ }
+
+ FT_MEM_ZERO( out, new_pitch * ypixels );
}
FT_FREE( bitmap->buffer );
bitmap->buffer = buffer;
- if ( bitmap->pitch < 0 )
- new_pitch = -new_pitch;
-
/* set pitch only, width and height are left untouched */
- bitmap->pitch = new_pitch;
+ if ( bitmap->pitch < 0 )
+ bitmap->pitch = -(int)new_pitch;
+ else
+ bitmap->pitch = (int)new_pitch;
return FT_Err_Ok;
}
@@ -444,7 +471,7 @@
* A gamma of 2.2 is fair to assume. And then, we need to
* undo the premultiplication too.
*
- * http://accessibility.kde.org/hsl-adjusted.php
+ * https://accessibility.kde.org/hsl-adjusted.php
*
* We do the computation with integers only, applying a gamma of 2.0.
* We guarantee 32-bit arithmetic to avoid overflow but the resulting
diff --git a/thirdparty/freetype/src/base/ftcalc.c b/thirdparty/freetype/src/base/ftcalc.c
index 00d63c6e6b..f4ff45f8ef 100644
--- a/thirdparty/freetype/src/base/ftcalc.c
+++ b/thirdparty/freetype/src/base/ftcalc.c
@@ -4,7 +4,7 @@
/* */
/* Arithmetic computations (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftcid.c b/thirdparty/freetype/src/base/ftcid.c
index 398396b845..f5184649bf 100644
--- a/thirdparty/freetype/src/base/ftcid.c
+++ b/thirdparty/freetype/src/base/ftcid.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing CID font information. */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* Derek Clegg and Michael Toftdal. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftdbgmem.c b/thirdparty/freetype/src/base/ftdbgmem.c
index 242246bfd1..c33d8acb4e 100644
--- a/thirdparty/freetype/src/base/ftdbgmem.c
+++ b/thirdparty/freetype/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
/* */
/* Memory debugger (body). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -826,7 +826,7 @@
FT_Int result = 0;
- if ( getenv( "FT2_DEBUG_MEMORY" ) )
+ if ( ft_getenv( "FT2_DEBUG_MEMORY" ) )
{
table = ft_mem_table_new( memory );
if ( table )
@@ -839,7 +839,7 @@
memory->realloc = ft_mem_debug_realloc;
memory->free = ft_mem_debug_free;
- p = getenv( "FT2_ALLOC_TOTAL_MAX" );
+ p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" );
if ( p )
{
FT_Long total_max = ft_strtol( p, NULL, 10 );
@@ -852,7 +852,7 @@
}
}
- p = getenv( "FT2_ALLOC_COUNT_MAX" );
+ p = ft_getenv( "FT2_ALLOC_COUNT_MAX" );
if ( p )
{
FT_Long total_count = ft_strtol( p, NULL, 10 );
@@ -865,7 +865,7 @@
}
}
- p = getenv( "FT2_KEEP_ALIVE" );
+ p = ft_getenv( "FT2_KEEP_ALIVE" );
if ( p )
{
FT_Long keep_alive = ft_strtol( p, NULL, 10 );
diff --git a/thirdparty/freetype/src/base/ftdebug.c b/thirdparty/freetype/src/base/ftdebug.c
index 20c617089f..fe26309101 100644
--- a/thirdparty/freetype/src/base/ftdebug.c
+++ b/thirdparty/freetype/src/base/ftdebug.c
@@ -4,7 +4,7 @@
/* */
/* Debugging and logging component (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -161,7 +161,7 @@
FT_BASE_DEF( void )
ft_debug_init( void )
{
- const char* ft2_debug = getenv( "FT2_DEBUG" );
+ const char* ft2_debug = ft_getenv( "FT2_DEBUG" );
if ( ft2_debug )
diff --git a/thirdparty/freetype/src/base/ftfntfmt.c b/thirdparty/freetype/src/base/ftfntfmt.c
index dcbeba0053..a2900ceb09 100644
--- a/thirdparty/freetype/src/base/ftfntfmt.c
+++ b/thirdparty/freetype/src/base/ftfntfmt.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility file for font formats (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftfstype.c b/thirdparty/freetype/src/base/ftfstype.c
index cec4fb3025..e6cdf6e2ec 100644
--- a/thirdparty/freetype/src/base/ftfstype.c
+++ b/thirdparty/freetype/src/base/ftfstype.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility file to access FSType data (body). */
/* */
-/* Copyright 2008-2017 by */
+/* Copyright 2008-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftgasp.c b/thirdparty/freetype/src/base/ftgasp.c
index 477b72558c..4f80bba630 100644
--- a/thirdparty/freetype/src/base/ftgasp.c
+++ b/thirdparty/freetype/src/base/ftgasp.c
@@ -4,7 +4,7 @@
/* */
/* Access of TrueType's `gasp' table (body). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftgloadr.c b/thirdparty/freetype/src/base/ftgloadr.c
index 8134003b4b..47202496b9 100644
--- a/thirdparty/freetype/src/base/ftgloadr.c
+++ b/thirdparty/freetype/src/base/ftgloadr.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph loader (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftglyph.c b/thirdparty/freetype/src/base/ftglyph.c
index 3f78a8c36b..6759aa25d0 100644
--- a/thirdparty/freetype/src/base/ftglyph.c
+++ b/thirdparty/freetype/src/base/ftglyph.c
@@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftgxval.c b/thirdparty/freetype/src/base/ftgxval.c
index ff24d336df..19e2d6acb5 100644
--- a/thirdparty/freetype/src/base/ftgxval.c
+++ b/thirdparty/freetype/src/base/ftgxval.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for validating TrueTypeGX/AAT tables (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Masatake YAMATO, Redhat K.K, */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/base/ftinit.c b/thirdparty/freetype/src/base/ftinit.c
index b3b08fa541..1fa4721094 100644
--- a/thirdparty/freetype/src/base/ftinit.c
+++ b/thirdparty/freetype/src/base/ftinit.c
@@ -4,7 +4,7 @@
/* */
/* FreeType initialization layer (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftlcdfil.c b/thirdparty/freetype/src/base/ftlcdfil.c
index 60c813fd9e..8d314df080 100644
--- a/thirdparty/freetype/src/base/ftlcdfil.c
+++ b/thirdparty/freetype/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,8 +31,41 @@
#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) )
+
+ /* add padding according to filter weights */
+ FT_BASE_DEF (void)
+ ft_lcd_padding( FT_Pos* Min,
+ FT_Pos* Max,
+ FT_GlyphSlot slot )
+ {
+ FT_Byte* lcd_weights;
+ FT_Bitmap_LcdFilterFunc lcd_filter_func;
+
+
+ /* Per-face LCD filtering takes priority if set up. */
+ if ( slot->face && slot->face->internal->lcd_filter_func )
+ {
+ lcd_weights = slot->face->internal->lcd_weights;
+ lcd_filter_func = slot->face->internal->lcd_filter_func;
+ }
+ else
+ {
+ lcd_weights = slot->library->lcd_weights;
+ lcd_filter_func = slot->library->lcd_filter_func;
+ }
+
+ if ( lcd_filter_func == ft_lcd_filter_fir )
+ {
+ *Min -= lcd_weights[0] ? 43 :
+ lcd_weights[1] ? 22 : 0;
+ *Max += lcd_weights[4] ? 43 :
+ lcd_weights[3] ? 22 : 0;
+ }
+ }
+
+
/* FIR filter used by the default and light filters */
- FT_BASE( void )
+ FT_BASE_DEF( void )
ft_lcd_filter_fir( FT_Bitmap* bitmap,
FT_Render_Mode mode,
FT_LcdFiveTapFilter weights )
@@ -44,7 +77,7 @@
/* take care of bitmap flow */
- if ( pitch > 0 )
+ if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place FIR filter */
@@ -159,7 +192,7 @@
/* take care of bitmap flow */
- if ( pitch > 0 )
+ if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place intra-pixel filter */
@@ -305,21 +338,21 @@
return FT_THROW( Invalid_Argument );
}
- library->lcd_filter = filter;
-
return FT_Err_Ok;
}
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
- FT_BASE( void )
- ft_lcd_filter_fir( FT_Bitmap* bitmap,
- FT_Render_Mode mode,
- FT_LcdFiveTapFilter weights )
+ /* add padding according to accommodate outline shifts */
+ FT_BASE_DEF (void)
+ ft_lcd_padding( FT_Pos* Min,
+ FT_Pos* Max,
+ FT_GlyphSlot slot )
{
- FT_UNUSED( bitmap );
- FT_UNUSED( mode );
- FT_UNUSED( weights );
+ FT_UNUSED( slot );
+
+ *Min -= 21;
+ *Max += 21;
}
diff --git a/thirdparty/freetype/src/base/ftmac.c b/thirdparty/freetype/src/base/ftmac.c
index 4e76585e5f..fd4c0cc274 100644
--- a/thirdparty/freetype/src/base/ftmac.c
+++ b/thirdparty/freetype/src/base/ftmac.c
@@ -8,7 +8,7 @@
/* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */
/* classic platforms built by MPW. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftmm.c b/thirdparty/freetype/src/base/ftmm.c
index 43877ece45..800441bcac 100644
--- a/thirdparty/freetype/src/base/ftmm.c
+++ b/thirdparty/freetype/src/base/ftmm.c
@@ -4,7 +4,7 @@
/* */
/* Multiple Master font support (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -148,6 +148,25 @@
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
+ FT_Done_MM_Var( FT_Library library,
+ FT_MM_Var* amaster )
+ {
+ FT_Memory memory;
+
+
+ if ( !library )
+ return FT_THROW( Invalid_Library_Handle );
+
+ memory = library->memory;
+ FT_FREE( amaster );
+
+ return FT_Err_Ok;
+ }
+
+
+ /* documentation is in ftmm.h */
+
+ FT_EXPORT_DEF( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Long* coords )
@@ -203,6 +222,10 @@
error = FT_ERR( Invalid_Argument );
if ( service_mm->set_var_design )
error = service_mm->set_var_design( face, num_coords, coords );
+
+ /* internal error code -1 means `no change'; we can exit immediately */
+ if ( error == -1 )
+ return FT_Err_Ok;
}
if ( !error )
@@ -275,6 +298,10 @@
error = FT_ERR( Invalid_Argument );
if ( service_mm->set_mm_blend )
error = service_mm->set_mm_blend( face, num_coords, coords );
+
+ /* internal error code -1 means `no change'; we can exit immediately */
+ if ( error == -1 )
+ return FT_Err_Ok;
}
if ( !error )
@@ -322,6 +349,10 @@
error = FT_ERR( Invalid_Argument );
if ( service_mm->set_mm_blend )
error = service_mm->set_mm_blend( face, num_coords, coords );
+
+ /* internal error code -1 means `no change'; we can exit immediately */
+ if ( error == -1 )
+ return FT_Err_Ok;
}
if ( !error )
@@ -426,4 +457,52 @@
}
+ /* documentation is in ftmm.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Set_Named_Instance( FT_Face face,
+ FT_UInt instance_index )
+ {
+ FT_Error error;
+
+ FT_Service_MultiMasters service_mm = NULL;
+ FT_Service_MetricsVariations service_mvar = NULL;
+
+
+ /* check of `face' delayed to `ft_face_get_mm_service' */
+
+ error = ft_face_get_mm_service( face, &service_mm );
+ if ( !error )
+ {
+ error = FT_ERR( Invalid_Argument );
+ if ( service_mm->set_instance )
+ error = service_mm->set_instance( face, instance_index );
+ }
+
+ if ( !error )
+ {
+ (void)ft_face_get_mvar_service( face, &service_mvar );
+
+ if ( service_mvar && service_mvar->metrics_adjust )
+ service_mvar->metrics_adjust( face );
+ }
+
+ /* enforce recomputation of auto-hinting data */
+ if ( !error && face->autohint.finalizer )
+ {
+ face->autohint.finalizer( face->autohint.data );
+ face->autohint.data = NULL;
+ }
+
+ if ( !error )
+ {
+ face->face_index = ( instance_index << 16 ) |
+ ( face->face_index & 0xFFFFL );
+ face->face_flags &= ~FT_FACE_FLAG_VARIATION;
+ }
+
+ return error;
+ }
+
+
/* END */
diff --git a/thirdparty/freetype/src/base/ftobjs.c b/thirdparty/freetype/src/base/ftobjs.c
index 6db8136cfc..8d07e35ae3 100644
--- a/thirdparty/freetype/src/base/ftobjs.c
+++ b/thirdparty/freetype/src/base/ftobjs.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -19,12 +19,16 @@
#include <ft2build.h>
#include FT_LIST_H
#include FT_OUTLINE_H
+#include FT_FONT_FORMATS_H
+
#include FT_INTERNAL_VALIDATE_H
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_RFORK_H
#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */
+#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */
+#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Driver */
+
#include FT_TRUETYPE_TABLES_H
#include FT_TRUETYPE_TAGS_H
#include FT_TRUETYPE_IDS_H
@@ -37,8 +41,7 @@
#include FT_SERVICE_KERNING_H
#include FT_SERVICE_TRUETYPE_ENGINE_H
-#include FT_AUTOHINTER_H
-#include FT_CFF_DRIVER_H
+#include FT_DRIVER_H
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#include "ftbase.h"
@@ -328,6 +331,138 @@
FT_BASE_DEF( void )
+ ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,
+ FT_Render_Mode mode,
+ const FT_Vector* origin )
+ {
+ FT_Outline* outline = &slot->outline;
+ FT_Bitmap* bitmap = &slot->bitmap;
+
+ FT_Pixel_Mode pixel_mode;
+
+ FT_BBox cbox;
+ FT_Pos x_shift = 0;
+ FT_Pos y_shift = 0;
+ FT_Pos x_left, y_top;
+ FT_Pos width, height, pitch;
+
+
+ if ( slot->internal && ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+ return;
+
+ if ( origin )
+ {
+ x_shift = origin->x;
+ y_shift = origin->y;
+ }
+
+ /* compute the control box, and grid-fit it, */
+ /* taking into account the origin shift */
+ FT_Outline_Get_CBox( outline, &cbox );
+
+ cbox.xMin += x_shift;
+ cbox.yMin += y_shift;
+ cbox.xMax += x_shift;
+ cbox.yMax += y_shift;
+
+ switch ( mode )
+ {
+ case FT_RENDER_MODE_MONO:
+ pixel_mode = FT_PIXEL_MODE_MONO;
+#if 1
+ /* undocumented but confirmed: bbox values get rounded */
+ /* unless the rounded box can collapse for a narrow glyph */
+ if ( cbox.xMax - cbox.xMin < 64 )
+ {
+ cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+ cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
+ }
+ else
+ {
+ cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin );
+ cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax );
+ }
+
+ if ( cbox.yMax - cbox.yMin < 64 )
+ {
+ cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+ cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
+ }
+ else
+ {
+ cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin );
+ cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax );
+ }
+#else
+ cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+ cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+ cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
+ cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
+#endif
+ break;
+
+ case FT_RENDER_MODE_LCD:
+ pixel_mode = FT_PIXEL_MODE_LCD;
+ ft_lcd_padding( &cbox.xMin, &cbox.xMax, slot );
+ goto Round;
+
+ case FT_RENDER_MODE_LCD_V:
+ pixel_mode = FT_PIXEL_MODE_LCD_V;
+ ft_lcd_padding( &cbox.yMin, &cbox.yMax, slot );
+ goto Round;
+
+ case FT_RENDER_MODE_NORMAL:
+ case FT_RENDER_MODE_LIGHT:
+ default:
+ pixel_mode = FT_PIXEL_MODE_GRAY;
+ Round:
+ cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
+ cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
+ cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
+ cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
+ }
+
+ x_shift = SUB_LONG( x_shift, cbox.xMin );
+ y_shift = SUB_LONG( y_shift, cbox.yMin );
+
+ x_left = cbox.xMin >> 6;
+ y_top = cbox.yMax >> 6;
+
+ width = ( (FT_ULong)cbox.xMax - (FT_ULong)cbox.xMin ) >> 6;
+ height = ( (FT_ULong)cbox.yMax - (FT_ULong)cbox.yMin ) >> 6;
+
+ switch ( pixel_mode )
+ {
+ case FT_PIXEL_MODE_MONO:
+ pitch = ( ( width + 15 ) >> 4 ) << 1;
+ break;
+
+ case FT_PIXEL_MODE_LCD:
+ width *= 3;
+ pitch = FT_PAD_CEIL( width, 4 );
+ break;
+
+ case FT_PIXEL_MODE_LCD_V:
+ height *= 3;
+ /* fall through */
+
+ case FT_PIXEL_MODE_GRAY:
+ default:
+ pitch = width;
+ }
+
+ slot->bitmap_left = (FT_Int)x_left;
+ slot->bitmap_top = (FT_Int)y_top;
+
+ bitmap->pixel_mode = (unsigned char)pixel_mode;
+ bitmap->num_grays = 256;
+ bitmap->width = (unsigned int)width;
+ bitmap->rows = (unsigned int)height;
+ bitmap->pitch = pitch;
+ }
+
+
+ FT_BASE_DEF( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Byte* buffer )
{
@@ -669,9 +804,13 @@
* Determine whether we need to auto-hint or not.
* The general rules are:
*
- * - Do only auto-hinting if we have a hinter module, a scalable font
- * format dealing with outlines, and no transforms except simple
- * slants and/or rotations by integer multiples of 90 degrees.
+ * - Do only auto-hinting if we have
+ *
+ * - a hinter module,
+ * - a scalable font format dealing with outlines,
+ * - not a tricky font, and
+ * - no transforms except simple slants and/or rotations by
+ * integer multiples of 90 degrees.
*
* - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't
* have a native font hinter.
@@ -701,8 +840,15 @@
else
{
FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
+ FT_Bool is_light_type1;
+ /* only the new Adobe engine (for both CFF and Type 1) is `light'; */
+ /* we use `strstr' to catch both `Type 1' and `CID Type 1' */
+ is_light_type1 =
+ ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL &&
+ ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE;
+
/* the check for `num_locations' assures that we actually */
/* test for instructions in a TTF and not in a CFF-based OTF */
/* */
@@ -710,8 +856,9 @@
/* check the size of the `fpgm' and `prep' tables, too -- */
/* the assumption is that there don't exist real TTFs where */
/* both `fpgm' and `prep' tables are missing */
- if ( ( mode == FT_RENDER_MODE_LIGHT &&
- !FT_DRIVER_HINTS_LIGHTLY( driver ) ) ||
+ if ( ( mode == FT_RENDER_MODE_LIGHT &&
+ ( !FT_DRIVER_HINTS_LIGHTLY( driver ) &&
+ !is_light_type1 ) ) ||
( FT_IS_SFNT( face ) &&
ttface->num_locations &&
ttface->max_profile.maxSizeOfInstructions == 0 &&
@@ -731,8 +878,8 @@
/* XXX: This is really a temporary hack that should disappear */
/* promptly with FreeType 2.1! */
/* */
- if ( FT_HAS_FIXED_SIZES( face ) &&
- ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
+ if ( FT_HAS_FIXED_SIZES( face ) &&
+ ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
{
error = driver->clazz->load_glyph( slot, face->size,
glyph_index,
@@ -800,7 +947,7 @@
/* compute the linear advance in 16.16 pixels */
if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 &&
- ( FT_IS_SCALABLE( face ) ) )
+ FT_IS_SCALABLE( face ) )
{
FT_Size_Metrics* metrics = &face->size->metrics;
@@ -848,28 +995,37 @@
}
}
- FT_TRACE5(( " x advance: %d\n" , slot->advance.x ));
- FT_TRACE5(( " y advance: %d\n" , slot->advance.y ));
-
- FT_TRACE5(( " linear x advance: %d\n" , slot->linearHoriAdvance ));
- FT_TRACE5(( " linear y advance: %d\n" , slot->linearVertAdvance ));
-
- /* do we need to render the image now? */
+ /* do we need to render the image or preset the bitmap now? */
if ( !error &&
+ ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
slot->format != FT_GLYPH_FORMAT_BITMAP &&
- slot->format != FT_GLYPH_FORMAT_COMPOSITE &&
- load_flags & FT_LOAD_RENDER )
+ slot->format != FT_GLYPH_FORMAT_COMPOSITE )
{
FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
- if ( mode == FT_RENDER_MODE_NORMAL &&
- (load_flags & FT_LOAD_MONOCHROME ) )
+ if ( mode == FT_RENDER_MODE_NORMAL &&
+ load_flags & FT_LOAD_MONOCHROME )
mode = FT_RENDER_MODE_MONO;
- error = FT_Render_Glyph( slot, mode );
+ if ( load_flags & FT_LOAD_RENDER )
+ error = FT_Render_Glyph( slot, mode );
+ else
+ ft_glyphslot_preset_bitmap( slot, mode, NULL );
}
+ FT_TRACE5(( "FT_Load_Glyph: index %d, flags %x\n",
+ glyph_index, load_flags ));
+ FT_TRACE5(( " x advance: %f\n", slot->advance.x / 64.0 ));
+ FT_TRACE5(( " y advance: %f\n", slot->advance.y / 64.0 ));
+ FT_TRACE5(( " linear x advance: %f\n",
+ slot->linearHoriAdvance / 65536.0 ));
+ FT_TRACE5(( " linear y advance: %f\n",
+ slot->linearVertAdvance / 65536.0 ));
+ FT_TRACE5(( " bitmap %dx%d, mode %d\n",
+ slot->bitmap.width, slot->bitmap.rows,
+ slot->bitmap.pixel_mode ));
+
Exit:
return error;
}
@@ -2441,7 +2597,8 @@
internal->no_stem_darkening = -1;
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- ft_memset( internal->lcd_weights, 0, FT_LCD_FILTER_FIVE_TAPS );
+ /* Per-face filtering can only be set up by FT_Face_Properties */
+ internal->lcd_filter_func = NULL;
#endif
}
@@ -2864,18 +3021,6 @@
metrics->height = bsize->height << 6;
metrics->max_advance = bsize->x_ppem;
}
-
- FT_TRACE5(( "FT_Select_Metrics:\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
}
@@ -2984,18 +3129,6 @@
metrics->x_scale = 1L << 16;
metrics->y_scale = 1L << 16;
}
-
- FT_TRACE5(( "FT_Request_Metrics:\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
}
@@ -3005,6 +3138,7 @@
FT_Select_Size( FT_Face face,
FT_Int strike_index )
{
+ FT_Error error = FT_Err_Ok;
FT_Driver_Class clazz;
@@ -3018,36 +3152,37 @@
if ( clazz->select_size )
{
- FT_Error error;
+ error = clazz->select_size( face->size, (FT_ULong)strike_index );
+ FT_TRACE5(( "FT_Select_Size (%s driver):\n",
+ face->driver->root.clazz->module_name ));
+ }
+ else
+ {
+ FT_Select_Metrics( face, (FT_ULong)strike_index );
- error = clazz->select_size( face->size, (FT_ULong)strike_index );
+ FT_TRACE5(( "FT_Select_Size:\n" ));
+ }
#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_Size_Metrics* metrics = &face->size->metrics;
-
-
- FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
- }
-#endif
+ {
+ FT_Size_Metrics* metrics = &face->size->metrics;
- return error;
- }
- FT_Select_Metrics( face, (FT_ULong)strike_index );
+ FT_TRACE5(( " x scale: %d (%f)\n",
+ metrics->x_scale, metrics->x_scale / 65536.0 ));
+ FT_TRACE5(( " y scale: %d (%f)\n",
+ metrics->y_scale, metrics->y_scale / 65536.0 ));
+ FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
+ FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
+ FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
+ FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
+ FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
+ FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
+ }
+#endif
- return FT_Err_Ok;
+ return error;
}
@@ -3057,6 +3192,7 @@
FT_Request_Size( FT_Face face,
FT_Size_Request req )
{
+ FT_Error error = FT_Err_Ok;
FT_Driver_Class clazz;
FT_ULong strike_index;
@@ -3076,55 +3212,52 @@
if ( clazz->request_size )
{
- FT_Error error;
-
-
error = clazz->request_size( face->size, req );
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_Size_Metrics* metrics = &face->size->metrics;
-
-
- FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" ));
- FT_TRACE5(( " x scale: %d (%f)\n",
- metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
- metrics->y_scale, metrics->y_scale / 65536.0 ));
- FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
- FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
- FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
- FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
- FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
- FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
- }
-#endif
-
- return error;
+ FT_TRACE5(( "FT_Request_Size (%s driver):\n",
+ face->driver->root.clazz->module_name ));
}
-
- /*
- * The reason that a driver doesn't have `request_size' defined is
- * either that the scaling here suffices or that the supported formats
- * are bitmap-only and size matching is not implemented.
- *
- * In the latter case, a simple size matching is done.
- */
- if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) )
+ else if ( !FT_IS_SCALABLE( face ) && FT_HAS_FIXED_SIZES( face ) )
{
- FT_Error error;
-
-
+ /*
+ * The reason that a driver doesn't have `request_size' defined is
+ * either that the scaling here suffices or that the supported formats
+ * are bitmap-only and size matching is not implemented.
+ *
+ * In the latter case, a simple size matching is done.
+ */
error = FT_Match_Size( face, req, 0, &strike_index );
if ( error )
return error;
return FT_Select_Size( face, (FT_Int)strike_index );
}
+ else
+ {
+ FT_Request_Metrics( face, req );
- FT_Request_Metrics( face, req );
+ FT_TRACE5(( "FT_Request_Size:\n" ));
+ }
- return FT_Err_Ok;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ {
+ FT_Size_Metrics* metrics = &face->size->metrics;
+
+
+ FT_TRACE5(( " x scale: %d (%f)\n",
+ metrics->x_scale, metrics->x_scale / 65536.0 ));
+ FT_TRACE5(( " y scale: %d (%f)\n",
+ metrics->y_scale, metrics->y_scale / 65536.0 ));
+ FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
+ FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
+ FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
+ FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 ));
+ FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem ));
+ FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem ));
+ }
+#endif
+
+ return error;
}
@@ -3653,16 +3786,11 @@
{
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
if ( properties->data )
+ {
ft_memcpy( face->internal->lcd_weights,
properties->data,
FT_LCD_FILTER_FIVE_TAPS );
- else
- {
- /* Value NULL indicates `no custom weights, use library */
- /* defaults', signaled by filling the weight field with zeros. */
- ft_memset( face->internal->lcd_weights,
- 0,
- FT_LCD_FILTER_FIVE_TAPS );
+ face->internal->lcd_filter_func = ft_lcd_filter_fir;
}
#else
error = FT_THROW( Unimplemented_Feature );
@@ -4414,43 +4542,97 @@
*/
/* we use FT_TRACE3 in this block */
- if ( ft_trace_levels[trace_bitmap] >= 3 )
+ if ( !error &&
+ ft_trace_levels[trace_bitmap] >= 3 &&
+ slot->bitmap.buffer )
{
+ FT_Bitmap bitmap;
+ FT_Error err;
+
+
+ FT_Bitmap_Init( &bitmap );
+
/* we convert to a single bitmap format for computing the checksum */
- if ( !error && slot->bitmap.buffer )
+ /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */
+ err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 );
+ if ( !err )
{
- FT_Bitmap bitmap;
- FT_Error err;
+ MD5_CTX ctx;
+ unsigned char md5[16];
+ unsigned long coverage = 0;
+ int i, j;
+ int rows = (int)bitmap.rows;
+ int pitch = bitmap.pitch;
+
+
+ FT_TRACE3(( "FT_Render_Glyph: bitmap %dx%d, mode %d\n",
+ rows, pitch, slot->bitmap.pixel_mode ));
+
+ for ( i = 0; i < rows; i++ )
+ for ( j = 0; j < pitch; j++ )
+ coverage += bitmap.buffer[i * pitch + j];
+ FT_TRACE3(( " Total coverage: %lu\n", coverage ));
- FT_Bitmap_Init( &bitmap );
+ MD5_Init( &ctx );
+ if ( bitmap.buffer )
+ MD5_Update( &ctx, bitmap.buffer,
+ (unsigned long)rows * (unsigned long)pitch );
+ MD5_Final( md5, &ctx );
- /* this also converts the bitmap flow to `down' (i.e., pitch > 0) */
- err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 );
- if ( !err )
+ FT_TRACE3(( " MD5 checksum: " ));
+ for ( i = 0; i < 16; i++ )
+ FT_TRACE3(( "%02X", md5[i] ));
+ FT_TRACE3(( "\n" ));
+ }
+
+ FT_Bitmap_Done( library, &bitmap );
+ }
+
+ /*
+ * Dump bitmap in Netpbm format (PBM or PGM).
+ */
+
+ /* we use FT_TRACE7 in this block */
+ if ( !error &&
+ ft_trace_levels[trace_bitmap] >= 7 &&
+ slot->bitmap.rows < 128U &&
+ slot->bitmap.width < 128U &&
+ slot->bitmap.buffer )
+ {
+ int rows = (int)slot->bitmap.rows;
+ int width = (int)slot->bitmap.width;
+ int pitch = slot->bitmap.pitch;
+ int i, j, m;
+ unsigned char* topleft = slot->bitmap.buffer;
+
+ if ( pitch < 0 )
+ topleft -= pitch * ( rows - 1 );
+
+ FT_TRACE7(( "Netpbm image: start\n" ));
+ switch ( slot->bitmap.pixel_mode )
+ {
+ case FT_PIXEL_MODE_MONO:
+ FT_TRACE7(( "P1 %d %d\n", width, rows ));
+ for ( i = 0; i < rows; i++ )
{
- MD5_CTX ctx;
- unsigned char md5[16];
- int i;
- unsigned int rows = bitmap.rows;
- unsigned int pitch = (unsigned int)bitmap.pitch;
-
-
- MD5_Init( &ctx );
- if ( bitmap.buffer )
- MD5_Update( &ctx, bitmap.buffer, rows * pitch );
- MD5_Final( md5, &ctx );
-
- FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n"
- " ",
- rows, pitch ));
- for ( i = 0; i < 16; i++ )
- FT_TRACE3(( "%02X", md5[i] ));
- FT_TRACE3(( "\n" ));
+ for ( j = 0; j < width; )
+ for ( m = 128; m > 0 && j < width; m >>= 1, j++ )
+ FT_TRACE7(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 ));
+ FT_TRACE7(( "\n" ));
}
+ break;
- FT_Bitmap_Done( library, &bitmap );
+ default:
+ FT_TRACE7(( "P2 %d %d 255\n", width, rows ));
+ for ( i = 0; i < rows; i++ )
+ {
+ for ( j = 0; j < width; j += 1 )
+ FT_TRACE7(( " %3u", topleft[i * pitch + j] ));
+ FT_TRACE7(( "\n" ));
+ }
}
+ FT_TRACE7(( "Netpbm image: end\n" ));
}
#undef FT_COMPONENT
@@ -4995,9 +5177,9 @@
#ifdef FT_CONFIG_OPTION_PIC
Fail:
ft_pic_container_destroy( library );
-#endif
FT_FREE( library );
return error;
+#endif
}
diff --git a/thirdparty/freetype/src/base/ftotval.c b/thirdparty/freetype/src/base/ftotval.c
index 5fa098691e..a2944a7950 100644
--- a/thirdparty/freetype/src/base/ftotval.c
+++ b/thirdparty/freetype/src/base/ftotval.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for validating OpenType tables (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftoutln.c b/thirdparty/freetype/src/base/ftoutln.c
index 9ceb9cf1ba..cb91321deb 100644
--- a/thirdparty/freetype/src/base/ftoutln.c
+++ b/thirdparty/freetype/src/base/ftoutln.c
@@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -286,12 +286,13 @@
FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
return FT_Err_Ok;
+ Invalid_Outline:
+ error = FT_THROW( Invalid_Outline );
+ /* fall through */
+
Exit:
FT_TRACE5(( "FT_Outline_Decompose: Error 0x%x\n", error ));
return error;
-
- Invalid_Outline:
- return FT_THROW( Invalid_Outline );
}
@@ -540,8 +541,8 @@
for ( n = 0; n < outline->n_points; n++ )
{
- vec->x += xOffset;
- vec->y += yOffset;
+ vec->x = ADD_LONG( vec->x, xOffset );
+ vec->y = ADD_LONG( vec->y, yOffset );
vec++;
}
}
diff --git a/thirdparty/freetype/src/base/ftpatent.c b/thirdparty/freetype/src/base/ftpatent.c
index 9900f99bfc..e23ee2e3f4 100644
--- a/thirdparty/freetype/src/base/ftpatent.c
+++ b/thirdparty/freetype/src/base/ftpatent.c
@@ -5,7 +5,7 @@
/* FreeType API for checking patented TrueType bytecode instructions */
/* (body). Obsolete, retained for backward compatibility. */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftpfr.c b/thirdparty/freetype/src/base/ftpfr.c
index 5cc0b70726..bfe13520eb 100644
--- a/thirdparty/freetype/src/base/ftpfr.c
+++ b/thirdparty/freetype/src/base/ftpfr.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing PFR-specific data (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftpic.c b/thirdparty/freetype/src/base/ftpic.c
index 0f84fddc98..1492e1809a 100644
--- a/thirdparty/freetype/src/base/ftpic.c
+++ b/thirdparty/freetype/src/base/ftpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services (body). */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftpsprop.c b/thirdparty/freetype/src/base/ftpsprop.c
new file mode 100644
index 0000000000..459b5e6054
--- /dev/null
+++ b/thirdparty/freetype/src/base/ftpsprop.c
@@ -0,0 +1,285 @@
+/***************************************************************************/
+/* */
+/* ftpsprop.c */
+/* */
+/* Get and set properties of PostScript drivers (body). */
+/* See `ftdriver.h' for available properties. */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_DRIVER_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_POSTSCRIPT_PROPS_H
+
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_psprops
+
+
+ FT_BASE_CALLBACK_DEF( FT_Error )
+ ps_property_set( FT_Module module, /* PS_Driver */
+ const char* property_name,
+ const void* value,
+ FT_Bool value_is_string )
+ {
+ FT_Error error = FT_Err_Ok;
+ PS_Driver driver = (PS_Driver)module;
+
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ FT_UNUSED( value_is_string );
+#endif
+
+
+ if ( !ft_strcmp( property_name, "darkening-parameters" ) )
+ {
+ FT_Int* darken_params;
+ FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ FT_Int dp[8];
+
+
+ if ( value_is_string )
+ {
+ const char* s = (const char*)value;
+ char* ep;
+ int i;
+
+
+ /* eight comma-separated numbers */
+ for ( i = 0; i < 7; i++ )
+ {
+ dp[i] = (FT_Int)ft_strtol( s, &ep, 10 );
+ if ( *ep != ',' || s == ep )
+ return FT_THROW( Invalid_Argument );
+
+ s = ep + 1;
+ }
+
+ dp[7] = (FT_Int)ft_strtol( s, &ep, 10 );
+ if ( !( *ep == '\0' || *ep == ' ' ) || s == ep )
+ return FT_THROW( Invalid_Argument );
+
+ darken_params = dp;
+ }
+ else
+#endif
+ darken_params = (FT_Int*)value;
+
+ x1 = darken_params[0];
+ y1 = darken_params[1];
+ x2 = darken_params[2];
+ y2 = darken_params[3];
+ x3 = darken_params[4];
+ y3 = darken_params[5];
+ x4 = darken_params[6];
+ y4 = darken_params[7];
+
+ if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
+ y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
+ x1 > x2 || x2 > x3 || x3 > x4 ||
+ y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
+ return FT_THROW( Invalid_Argument );
+
+ driver->darken_params[0] = x1;
+ driver->darken_params[1] = y1;
+ driver->darken_params[2] = x2;
+ driver->darken_params[3] = y2;
+ driver->darken_params[4] = x3;
+ driver->darken_params[5] = y3;
+ driver->darken_params[6] = x4;
+ driver->darken_params[7] = y4;
+
+ return error;
+ }
+
+ else if ( !ft_strcmp( property_name, "hinting-engine" ) )
+ {
+#if defined( CFF_CONFIG_OPTION_OLD_ENGINE ) || \
+ defined( T1_CONFIG_OPTION_OLD_ENGINE )
+ const char* module_name = module->clazz->module_name;
+#endif
+
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ if ( value_is_string )
+ {
+ const char* s = (const char*)value;
+
+
+ if ( !ft_strcmp( s, "adobe" ) )
+ driver->hinting_engine = FT_HINTING_ADOBE;
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ else if ( !ft_strcmp( module_name, "cff" ) &&
+ !ft_strcmp( s, "freetype" ) )
+ driver->hinting_engine = FT_HINTING_FREETYPE;
+#endif
+
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ else if ( ( !ft_strcmp( module_name, "type1" ) ||
+ !ft_strcmp( module_name, "t1cid" ) ) &&
+ !ft_strcmp( s, "freetype" ) )
+ driver->hinting_engine = FT_HINTING_FREETYPE;
+#endif
+
+ else
+ return FT_THROW( Invalid_Argument );
+ }
+ else
+#endif /* FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES */
+ {
+ FT_UInt* hinting_engine = (FT_UInt*)value;
+
+
+ if ( *hinting_engine == FT_HINTING_ADOBE
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ || ( *hinting_engine == FT_HINTING_FREETYPE &&
+ !ft_strcmp( module_name, "cff" ) )
+#endif
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ || ( *hinting_engine == FT_HINTING_FREETYPE &&
+ ( !ft_strcmp( module_name, "type1" ) ||
+ !ft_strcmp( module_name, "t1cid" ) ) )
+#endif
+ )
+ driver->hinting_engine = *hinting_engine;
+ else
+ error = FT_ERR( Unimplemented_Feature );
+
+ return error;
+ }
+ }
+
+ else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
+ {
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ if ( value_is_string )
+ {
+ const char* s = (const char*)value;
+ long nsd = ft_strtol( s, NULL, 10 );
+
+
+ if ( !nsd )
+ driver->no_stem_darkening = FALSE;
+ else
+ driver->no_stem_darkening = TRUE;
+ }
+ else
+#endif
+ {
+ FT_Bool* no_stem_darkening = (FT_Bool*)value;
+
+
+ driver->no_stem_darkening = *no_stem_darkening;
+ }
+
+ return error;
+ }
+
+ else if ( !ft_strcmp( property_name, "random-seed" ) )
+ {
+ FT_Int32 random_seed;
+
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+ if ( value_is_string )
+ {
+ const char* s = (const char*)value;
+
+
+ random_seed = (FT_Int32)ft_strtol( s, NULL, 10 );
+ }
+ else
+#endif
+ random_seed = *(FT_Int32*)value;
+
+ if ( random_seed < 0 )
+ random_seed = 0;
+
+ driver->random_seed = random_seed;
+
+ return error;
+ }
+
+ FT_TRACE0(( "ps_property_set: missing property `%s'\n",
+ property_name ));
+ return FT_THROW( Missing_Property );
+ }
+
+
+ FT_BASE_CALLBACK_DEF( FT_Error )
+ ps_property_get( FT_Module module, /* PS_Driver */
+ const char* property_name,
+ void* value )
+ {
+ FT_Error error = FT_Err_Ok;
+ PS_Driver driver = (PS_Driver)module;
+
+
+ if ( !ft_strcmp( property_name, "darkening-parameters" ) )
+ {
+ FT_Int* darken_params = driver->darken_params;
+ FT_Int* val = (FT_Int*)value;
+
+
+ val[0] = darken_params[0];
+ val[1] = darken_params[1];
+ val[2] = darken_params[2];
+ val[3] = darken_params[3];
+ val[4] = darken_params[4];
+ val[5] = darken_params[5];
+ val[6] = darken_params[6];
+ val[7] = darken_params[7];
+
+ return error;
+ }
+
+ else if ( !ft_strcmp( property_name, "hinting-engine" ) )
+ {
+ FT_UInt hinting_engine = driver->hinting_engine;
+ FT_UInt* val = (FT_UInt*)value;
+
+
+ *val = hinting_engine;
+
+ return error;
+ }
+
+ else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
+ {
+ FT_Bool no_stem_darkening = driver->no_stem_darkening;
+ FT_Bool* val = (FT_Bool*)value;
+
+
+ *val = no_stem_darkening;
+
+ return error;
+ }
+
+ FT_TRACE0(( "ps_property_get: missing property `%s'\n",
+ property_name ));
+ return FT_THROW( Missing_Property );
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/base/ftrfork.c b/thirdparty/freetype/src/base/ftrfork.c
index f5ad2874d8..c3a2b9151a 100644
--- a/thirdparty/freetype/src/base/ftrfork.c
+++ b/thirdparty/freetype/src/base/ftrfork.c
@@ -4,7 +4,7 @@
/* */
/* Embedded resource forks accessor (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */
@@ -478,7 +478,7 @@
}
-#ifndef FT_MACINTOSH
+#if defined( FT_CONFIG_OPTION_MAC_FONTS ) && !defined( FT_MACINTOSH )
static FT_RFork_Rule
raccess_get_rule_type_from_rule_index( FT_Library library,
FT_UInt rule_index )
diff --git a/thirdparty/freetype/src/base/ftsnames.c b/thirdparty/freetype/src/base/ftsnames.c
index 3609450088..90ea1e2be7 100644
--- a/thirdparty/freetype/src/base/ftsnames.c
+++ b/thirdparty/freetype/src/base/ftsnames.c
@@ -7,7 +7,7 @@
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftstream.c b/thirdparty/freetype/src/base/ftstream.c
index a3f8c8b3c9..18df7dcfef 100644
--- a/thirdparty/freetype/src/base/ftstream.c
+++ b/thirdparty/freetype/src/base/ftstream.c
@@ -4,7 +4,7 @@
/* */
/* I/O stream support (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftstroke.c b/thirdparty/freetype/src/base/ftstroke.c
index d32de0d62b..6ae1819067 100644
--- a/thirdparty/freetype/src/base/ftstroke.c
+++ b/thirdparty/freetype/src/base/ftstroke.c
@@ -4,7 +4,7 @@
/* */
/* FreeType path stroker (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftsynth.c b/thirdparty/freetype/src/base/ftsynth.c
index 5cf386f48d..c28346707b 100644
--- a/thirdparty/freetype/src/base/ftsynth.c
+++ b/thirdparty/freetype/src/base/ftsynth.c
@@ -4,7 +4,7 @@
/* */
/* FreeType synthesizing code for emboldening and slanting (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftsystem.c b/thirdparty/freetype/src/base/ftsystem.c
index 324f949a49..6adebdb938 100644
--- a/thirdparty/freetype/src/base/ftsystem.c
+++ b/thirdparty/freetype/src/base/ftsystem.c
@@ -4,7 +4,7 @@
/* */
/* ANSI-specific FreeType low-level system interface (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/fttrigon.c b/thirdparty/freetype/src/base/fttrigon.c
index 7a4d17c829..d6dd098c42 100644
--- a/thirdparty/freetype/src/base/fttrigon.c
+++ b/thirdparty/freetype/src/base/fttrigon.c
@@ -4,7 +4,7 @@
/* */
/* FreeType trigonometric functions (body). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/fttype1.c b/thirdparty/freetype/src/base/fttype1.c
index 4d16a6371a..aa8f8ccbbb 100644
--- a/thirdparty/freetype/src/base/fttype1.c
+++ b/thirdparty/freetype/src/base/fttype1.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility file for PS names support (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftutil.c b/thirdparty/freetype/src/base/ftutil.c
index 7bd5bee87c..4de5f2c145 100644
--- a/thirdparty/freetype/src/base/ftutil.c
+++ b/thirdparty/freetype/src/base/ftutil.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility file for memory and list management (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/ftver.rc b/thirdparty/freetype/src/base/ftver.rc
new file mode 100644
index 0000000000..a2903d5883
--- /dev/null
+++ b/thirdparty/freetype/src/base/ftver.rc
@@ -0,0 +1,61 @@
+/***************************************************************************/
+/* */
+/* ftver.rc */
+/* */
+/* FreeType VERSIONINFO resource for Windows DLLs. */
+/* */
+/* Copyright 2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#include<windows.h>
+
+#define FT_VERSION 2,9,1,0
+#define FT_VERSION_STR "2.9.1"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION FT_VERSION
+PRODUCTVERSION FT_VERSION
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+FILEFLAGS VS_FF_DEBUG
+#endif
+#ifdef _DLL
+FILETYPE VFT_DLL
+#define FT_FILENAME "freetype.dll"
+#else
+FILETYPE VFT_STATIC_LIB
+#define FT_FILENAME "freetype.lib"
+#endif
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "CompanyName", "The FreeType Project"
+ VALUE "FileDescription", "Font Rendering Library"
+ VALUE "FileVersion", FT_VERSION_STR
+ VALUE "ProductName", "FreeType"
+ VALUE "ProductVersion", FT_VERSION_STR
+ VALUE "LegalCopyright", "\251 2018 The FreeType Project www.freetype.org. All rights reserved."
+ VALUE "InternalName", "freetype"
+ VALUE "OriginalFilename", FT_FILENAME
+ END
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN
+ /* The following line should only be modified for localized versions. */
+ /* It consists of any number of WORD,WORD pairs, with each pair */
+ /* describing a "language,codepage" combination supported by the file. */
+ VALUE "Translation", 0x409, 1252
+ END
+END
diff --git a/thirdparty/freetype/src/base/ftwinfnt.c b/thirdparty/freetype/src/base/ftwinfnt.c
index 05baa02da6..11bd28afb7 100644
--- a/thirdparty/freetype/src/base/ftwinfnt.c
+++ b/thirdparty/freetype/src/base/ftwinfnt.c
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing Windows FNT specific info (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/base/rules.mk b/thirdparty/freetype/src/base/rules.mk
index 2a1e93cb00..e9805bd068 100644
--- a/thirdparty/freetype/src/base/rules.mk
+++ b/thirdparty/freetype/src/base/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -40,11 +40,14 @@ BASE_SRC := $(BASE_DIR)/basepic.c \
$(BASE_DIR)/ftadvanc.c \
$(BASE_DIR)/ftcalc.c \
$(BASE_DIR)/ftdbgmem.c \
+ $(BASE_DIR)/ftfntfmt.c \
$(BASE_DIR)/ftgloadr.c \
$(BASE_DIR)/fthash.c \
+ $(BASE_DIR)/ftlcdfil.c \
$(BASE_DIR)/ftobjs.c \
$(BASE_DIR)/ftoutln.c \
$(BASE_DIR)/ftpic.c \
+ $(BASE_DIR)/ftpsprop.c \
$(BASE_DIR)/ftrfork.c \
$(BASE_DIR)/ftsnames.c \
$(BASE_DIR)/ftstream.c \
diff --git a/thirdparty/freetype/src/bdf/README b/thirdparty/freetype/src/bdf/README
index b761aba2b2..996ac2d2aa 100644
--- a/thirdparty/freetype/src/bdf/README
+++ b/thirdparty/freetype/src/bdf/README
@@ -13,7 +13,7 @@ This code implements a BDF driver for the FreeType library, following the
Adobe Specification V 2.2. The specification of the BDF font format is
available from Adobe's web site:
- http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf
+ https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf
Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org).
They do not define vertical metrics, because the X Consortium BDF
diff --git a/thirdparty/freetype/src/bdf/bdfdrivr.c b/thirdparty/freetype/src/bdf/bdfdrivr.c
index fb77810007..ca937f89ce 100644
--- a/thirdparty/freetype/src/bdf/bdfdrivr.c
+++ b/thirdparty/freetype/src/bdf/bdfdrivr.c
@@ -813,7 +813,7 @@ THE SOFTWARE.
bitmap->rows = glyph.bbx.height;
bitmap->width = glyph.bbx.width;
- if ( glyph.bpr > INT_MAX )
+ if ( glyph.bpr > FT_INT_MAX )
FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
glyph.bpr ));
bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
diff --git a/thirdparty/freetype/src/bdf/bdflib.c b/thirdparty/freetype/src/bdf/bdflib.c
index bf10887fd4..2f5c99d544 100644
--- a/thirdparty/freetype/src/bdf/bdflib.c
+++ b/thirdparty/freetype/src/bdf/bdflib.c
@@ -705,11 +705,11 @@
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
- if ( v < ( ULONG_MAX - 9 ) / 10 )
+ if ( v < ( FT_ULONG_MAX - 9 ) / 10 )
v = v * 10 + a2i[(int)*s];
else
{
- v = ULONG_MAX;
+ v = FT_ULONG_MAX;
break;
}
}
@@ -738,11 +738,11 @@
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
- if ( v < ( LONG_MAX - 9 ) / 10 )
+ if ( v < ( FT_LONG_MAX - 9 ) / 10 )
v = v * 10 + a2i[(int)*s];
else
{
- v = LONG_MAX;
+ v = FT_LONG_MAX;
break;
}
}
@@ -763,11 +763,11 @@
for ( v = 0; sbitset( ddigits, *s ); s++ )
{
- if ( v < ( USHRT_MAX - 9 ) / 10 )
+ if ( v < ( FT_USHORT_MAX - 9 ) / 10 )
v = (unsigned short)( v * 10 + a2i[(int)*s] );
else
{
- v = USHRT_MAX;
+ v = FT_USHORT_MAX;
break;
}
}
diff --git a/thirdparty/freetype/src/bzip2/ftbzip2.c b/thirdparty/freetype/src/bzip2/ftbzip2.c
index 7fc71e7079..16019485a9 100644
--- a/thirdparty/freetype/src/bzip2/ftbzip2.c
+++ b/thirdparty/freetype/src/bzip2/ftbzip2.c
@@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2010-2017 by */
+/* Copyright 2010-2018 by */
/* Joel Klinghed. */
/* */
/* based on `src/gzip/ftgzip.c' */
diff --git a/thirdparty/freetype/src/bzip2/rules.mk b/thirdparty/freetype/src/bzip2/rules.mk
index f63ddc4d34..95954d7520 100644
--- a/thirdparty/freetype/src/bzip2/rules.mk
+++ b/thirdparty/freetype/src/bzip2/rules.mk
@@ -2,7 +2,7 @@
# FreeType 2 BZIP2 support configuration rules
#
-# Copyright 2010-2017 by
+# Copyright 2010-2018 by
# Joel Klinghed.
#
# based on `src/lzw/rules.mk'
diff --git a/thirdparty/freetype/src/cache/ftcache.c b/thirdparty/freetype/src/cache/ftcache.c
index 8226188314..1b425af911 100644
--- a/thirdparty/freetype/src/cache/ftcache.c
+++ b/thirdparty/freetype/src/cache/ftcache.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType Caching sub-system (body only). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcbasic.c b/thirdparty/freetype/src/cache/ftcbasic.c
index e804776ab4..994aa12286 100644
--- a/thirdparty/freetype/src/cache/ftcbasic.c
+++ b/thirdparty/freetype/src/cache/ftcbasic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType basic cache interface (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftccache.c b/thirdparty/freetype/src/cache/ftccache.c
index 37dc3abb1d..12ec585a25 100644
--- a/thirdparty/freetype/src/cache/ftccache.c
+++ b/thirdparty/freetype/src/cache/ftccache.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType internal cache interface (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftccache.h b/thirdparty/freetype/src/cache/ftccache.h
index d3c11ce082..859c547e46 100644
--- a/thirdparty/freetype/src/cache/ftccache.h
+++ b/thirdparty/freetype/src/cache/ftccache.h
@@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftccback.h b/thirdparty/freetype/src/cache/ftccback.h
index 2681e8c022..e51d8d6e55 100644
--- a/thirdparty/freetype/src/cache/ftccback.h
+++ b/thirdparty/freetype/src/cache/ftccback.h
@@ -4,7 +4,7 @@
/* */
/* Callback functions of the caching sub-system (specification only). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftccmap.c b/thirdparty/freetype/src/cache/ftccmap.c
index 2fa84979c8..d20b0f48fe 100644
--- a/thirdparty/freetype/src/cache/ftccmap.c
+++ b/thirdparty/freetype/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
/* */
/* FreeType CharMap cache (body) */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcerror.h b/thirdparty/freetype/src/cache/ftcerror.h
index 84fe52f546..a26cd5935b 100644
--- a/thirdparty/freetype/src/cache/ftcerror.h
+++ b/thirdparty/freetype/src/cache/ftcerror.h
@@ -4,7 +4,7 @@
/* */
/* Caching sub-system error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcglyph.c b/thirdparty/freetype/src/cache/ftcglyph.c
index d2468f2f43..782cc0ed09 100644
--- a/thirdparty/freetype/src/cache/ftcglyph.c
+++ b/thirdparty/freetype/src/cache/ftcglyph.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Glyph Image (FT_Glyph) cache (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcglyph.h b/thirdparty/freetype/src/cache/ftcglyph.h
index cab58ed311..23c24d223f 100644
--- a/thirdparty/freetype/src/cache/ftcglyph.h
+++ b/thirdparty/freetype/src/cache/ftcglyph.h
@@ -4,7 +4,7 @@
/* */
/* FreeType abstract glyph cache (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcimage.c b/thirdparty/freetype/src/cache/ftcimage.c
index 359f818cce..77a100153e 100644
--- a/thirdparty/freetype/src/cache/ftcimage.c
+++ b/thirdparty/freetype/src/cache/ftcimage.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Image cache (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcimage.h b/thirdparty/freetype/src/cache/ftcimage.h
index 14049af9d2..24a221053b 100644
--- a/thirdparty/freetype/src/cache/ftcimage.h
+++ b/thirdparty/freetype/src/cache/ftcimage.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Generic Image cache (specification) */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcmanag.c b/thirdparty/freetype/src/cache/ftcmanag.c
index edec2b6b5b..2bcd9df502 100644
--- a/thirdparty/freetype/src/cache/ftcmanag.c
+++ b/thirdparty/freetype/src/cache/ftcmanag.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcmanag.h b/thirdparty/freetype/src/cache/ftcmanag.h
index 556842e131..b4b4755356 100644
--- a/thirdparty/freetype/src/cache/ftcmanag.h
+++ b/thirdparty/freetype/src/cache/ftcmanag.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcmru.c b/thirdparty/freetype/src/cache/ftcmru.c
index e293269f2f..1087be4d89 100644
--- a/thirdparty/freetype/src/cache/ftcmru.c
+++ b/thirdparty/freetype/src/cache/ftcmru.c
@@ -4,7 +4,7 @@
/* */
/* FreeType MRU support (body). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcmru.h b/thirdparty/freetype/src/cache/ftcmru.h
index c4c330d558..82396b917d 100644
--- a/thirdparty/freetype/src/cache/ftcmru.h
+++ b/thirdparty/freetype/src/cache/ftcmru.h
@@ -4,7 +4,7 @@
/* */
/* Simple MRU list-cache (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcsbits.c b/thirdparty/freetype/src/cache/ftcsbits.c
index 2f9336decd..018f1ecdb7 100644
--- a/thirdparty/freetype/src/cache/ftcsbits.c
+++ b/thirdparty/freetype/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
/* */
/* FreeType sbits manager (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/ftcsbits.h b/thirdparty/freetype/src/cache/ftcsbits.h
index 1e15ce9764..206a1bb3fc 100644
--- a/thirdparty/freetype/src/cache/ftcsbits.h
+++ b/thirdparty/freetype/src/cache/ftcsbits.h
@@ -4,7 +4,7 @@
/* */
/* A small-bitmap cache (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cache/rules.mk b/thirdparty/freetype/src/cache/rules.mk
index 6204689505..558935976d 100644
--- a/thirdparty/freetype/src/cache/rules.mk
+++ b/thirdparty/freetype/src/cache/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2000-2017 by
+# Copyright 2000-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/cff/cff.c b/thirdparty/freetype/src/cff/cff.c
index 397f6dfafe..1a755d5dad 100644
--- a/thirdparty/freetype/src/cff/cff.c
+++ b/thirdparty/freetype/src/cff/cff.c
@@ -4,7 +4,7 @@
/* */
/* FreeType OpenType driver component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -27,15 +27,4 @@
#include "cffload.c"
#include "cffobjs.c"
-#include "cf2arrst.c"
-#include "cf2blues.c"
-#include "cf2error.c"
-#include "cf2font.c"
-#include "cf2ft.c"
-#include "cf2hints.c"
-#include "cf2intrp.c"
-#include "cf2read.c"
-#include "cf2stack.c"
-
-
/* END */
diff --git a/thirdparty/freetype/src/cff/cffcmap.c b/thirdparty/freetype/src/cff/cffcmap.c
index 4adce7a54d..e45ae1127b 100644
--- a/thirdparty/freetype/src/cff/cffcmap.c
+++ b/thirdparty/freetype/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
/* */
/* CFF character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cff/cffcmap.h b/thirdparty/freetype/src/cff/cffcmap.h
index 7792e04248..856a43dd1b 100644
--- a/thirdparty/freetype/src/cff/cffcmap.h
+++ b/thirdparty/freetype/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
/* */
/* CFF character mapping table (cmap) support (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -19,7 +19,7 @@
#ifndef CFFCMAP_H_
#define CFFCMAP_H_
-#include "cffobjs.h"
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cff/cffdrivr.c b/thirdparty/freetype/src/cff/cffdrivr.c
index 38bfc2ca3d..df896848da 100644
--- a/thirdparty/freetype/src/cff/cffdrivr.c
+++ b/thirdparty/freetype/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
/* */
/* OpenType font driver implementation (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,16 +21,20 @@
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_POSTSCRIPT_PROPS_H
#include FT_SERVICE_CID_H
#include FT_SERVICE_POSTSCRIPT_INFO_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_TT_CMAP_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
#include "cffdrivr.h"
#include "cffgload.h"
#include "cffload.h"
#include "cffcmap.h"
#include "cffparse.h"
+#include "cffobjs.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include FT_SERVICE_MULTIPLE_MASTERS_H
@@ -43,7 +47,7 @@
#include FT_SERVICE_FONT_FORMAT_H
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_PROPERTIES_H
-#include FT_CFF_DRIVER_H
+#include FT_DRIVER_H
/*************************************************************************/
@@ -214,8 +218,8 @@
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without VVAR table */
- if ( !ttface->is_default_instance &&
- !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
+ if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
+ !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
@@ -237,8 +241,10 @@
&dummy,
&ah );
- FT_TRACE5(( " idx %d: advance height %d font units\n",
- start + nn, ah ));
+ FT_TRACE5(( " idx %d: advance height %d font unit%s\n",
+ start + nn,
+ ah,
+ ah == 1 ? "" : "s" ));
advances[nn] = ah;
}
}
@@ -246,8 +252,8 @@
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without HVAR table */
- if ( !ttface->is_default_instance &&
- !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
+ if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
+ !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
@@ -266,8 +272,10 @@
&dummy,
&aw );
- FT_TRACE5(( " idx %d: advance width %d font units\n",
- start + nn, aw ));
+ FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
+ start + nn,
+ aw,
+ aw == 1 ? "" : "s" ));
advances[nn] = aw;
}
}
@@ -493,11 +501,89 @@
}
+ static FT_Error
+ cff_ps_get_font_extra( CFF_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ CFF_Font cff = (CFF_Font)face->extra.data;
+ FT_Error error = FT_Err_Ok;
+
+
+ if ( cff && cff->font_extra == NULL )
+ {
+ CFF_FontRecDict dict = &cff->top_font.font_dict;
+ PS_FontExtraRec* font_extra = NULL;
+ FT_Memory memory = face->root.memory;
+ FT_String* embedded_postscript;
+
+
+ if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) )
+ goto Fail;
+
+ font_extra->fs_type = 0U;
+
+ embedded_postscript = cff_index_get_sid_string(
+ cff,
+ dict->embedded_postscript );
+ if ( embedded_postscript )
+ {
+ FT_String* start_fstype;
+ FT_String* start_def;
+
+
+ /* Identify the XYZ integer in `/FSType XYZ def' substring. */
+ if ( ( start_fstype = ft_strstr( embedded_postscript,
+ "/FSType" ) ) != NULL &&
+ ( start_def = ft_strstr( start_fstype +
+ sizeof ( "/FSType" ) - 1,
+ "def" ) ) != NULL )
+ {
+ FT_String* s;
+
+
+ for ( s = start_fstype + sizeof ( "/FSType" ) - 1;
+ s != start_def;
+ s++ )
+ {
+ if ( *s >= '0' && *s <= '9' )
+ {
+ if ( font_extra->fs_type >= ( FT_USHORT_MAX - 9 ) / 10 )
+ {
+ /* Overflow - ignore the FSType value. */
+ font_extra->fs_type = 0U;
+ break;
+ }
+
+ font_extra->fs_type *= 10;
+ font_extra->fs_type += (FT_UShort)( *s - '0' );
+ }
+ else if ( *s != ' ' && *s != '\n' && *s != '\r' )
+ {
+ /* Non-whitespace character between `/FSType' and next `def' */
+ /* - ignore the FSType value. */
+ font_extra->fs_type = 0U;
+ break;
+ }
+ }
+ }
+ }
+
+ cff->font_extra = font_extra;
+ }
+
+ if ( cff )
+ *afont_extra = *cff->font_extra;
+
+ Fail:
+ return error;
+ }
+
+
FT_DEFINE_SERVICE_PSINFOREC(
cff_service_ps_info,
(PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */
- (PS_GetFontExtraFunc) NULL, /* ps_get_font_extra */
+ (PS_GetFontExtraFunc) cff_ps_get_font_extra, /* ps_get_font_extra */
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */
/* unsupported with CFF fonts */
(PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
@@ -735,231 +821,12 @@
* PROPERTY SERVICE
*
*/
- static FT_Error
- cff_property_set( FT_Module module, /* CFF_Driver */
- const char* property_name,
- const void* value,
- FT_Bool value_is_string )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Driver driver = (CFF_Driver)module;
-
-#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
- FT_UNUSED( value_is_string );
-#endif
-
-
- if ( !ft_strcmp( property_name, "darkening-parameters" ) )
- {
- FT_Int* darken_params;
- FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
-
-#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
- FT_Int dp[8];
-
-
- if ( value_is_string )
- {
- const char* s = (const char*)value;
- char* ep;
- int i;
-
-
- /* eight comma-separated numbers */
- for ( i = 0; i < 7; i++ )
- {
- dp[i] = (FT_Int)ft_strtol( s, &ep, 10 );
- if ( *ep != ',' || s == ep )
- return FT_THROW( Invalid_Argument );
-
- s = ep + 1;
- }
-
- dp[7] = (FT_Int)ft_strtol( s, &ep, 10 );
- if ( !( *ep == '\0' || *ep == ' ' ) || s == ep )
- return FT_THROW( Invalid_Argument );
-
- darken_params = dp;
- }
- else
-#endif
- darken_params = (FT_Int*)value;
-
- x1 = darken_params[0];
- y1 = darken_params[1];
- x2 = darken_params[2];
- y2 = darken_params[3];
- x3 = darken_params[4];
- y3 = darken_params[5];
- x4 = darken_params[6];
- y4 = darken_params[7];
-
- if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
- y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
- x1 > x2 || x2 > x3 || x3 > x4 ||
- y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
- return FT_THROW( Invalid_Argument );
-
- driver->darken_params[0] = x1;
- driver->darken_params[1] = y1;
- driver->darken_params[2] = x2;
- driver->darken_params[3] = y2;
- driver->darken_params[4] = x3;
- driver->darken_params[5] = y3;
- driver->darken_params[6] = x4;
- driver->darken_params[7] = y4;
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "hinting-engine" ) )
- {
-#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
- if ( value_is_string )
- {
- const char* s = (const char*)value;
-
-
- if ( !ft_strcmp( s, "adobe" ) )
- driver->hinting_engine = FT_CFF_HINTING_ADOBE;
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- else if ( !ft_strcmp( s, "freetype" ) )
- driver->hinting_engine = FT_CFF_HINTING_FREETYPE;
-#endif
- else
- return FT_THROW( Invalid_Argument );
- }
- else
-#endif
- {
- FT_UInt* hinting_engine = (FT_UInt*)value;
-
-
- if ( *hinting_engine == FT_CFF_HINTING_ADOBE
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- || *hinting_engine == FT_CFF_HINTING_FREETYPE
-#endif
- )
- driver->hinting_engine = *hinting_engine;
- else
- error = FT_ERR( Unimplemented_Feature );
-
- return error;
- }
- }
- else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
- {
-#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
- if ( value_is_string )
- {
- const char* s = (const char*)value;
- long nsd = ft_strtol( s, NULL, 10 );
-
-
- if ( !nsd )
- driver->no_stem_darkening = FALSE;
- else
- driver->no_stem_darkening = TRUE;
- }
- else
-#endif
- {
- FT_Bool* no_stem_darkening = (FT_Bool*)value;
-
-
- driver->no_stem_darkening = *no_stem_darkening;
- }
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "random-seed" ) )
- {
- FT_Int32 random_seed;
-
-
-#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
- if ( value_is_string )
- {
- const char* s = (const char*)value;
-
-
- random_seed = (FT_Int32)ft_strtol( s, NULL, 10 );
- }
- else
-#endif
- random_seed = *(FT_Int32*)value;
-
- if ( random_seed < 0 )
- random_seed = 0;
-
- driver->random_seed = random_seed;
-
- return error;
- }
-
- FT_TRACE0(( "cff_property_set: missing property `%s'\n",
- property_name ));
- return FT_THROW( Missing_Property );
- }
-
-
- static FT_Error
- cff_property_get( FT_Module module, /* CFF_Driver */
- const char* property_name,
- const void* value )
- {
- FT_Error error = FT_Err_Ok;
- CFF_Driver driver = (CFF_Driver)module;
-
-
- if ( !ft_strcmp( property_name, "darkening-parameters" ) )
- {
- FT_Int* darken_params = driver->darken_params;
- FT_Int* val = (FT_Int*)value;
-
-
- val[0] = darken_params[0];
- val[1] = darken_params[1];
- val[2] = darken_params[2];
- val[3] = darken_params[3];
- val[4] = darken_params[4];
- val[5] = darken_params[5];
- val[6] = darken_params[6];
- val[7] = darken_params[7];
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "hinting-engine" ) )
- {
- FT_UInt hinting_engine = driver->hinting_engine;
- FT_UInt* val = (FT_UInt*)value;
-
-
- *val = hinting_engine;
-
- return error;
- }
- else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
- {
- FT_Bool no_stem_darkening = driver->no_stem_darkening;
- FT_Bool* val = (FT_Bool*)value;
-
-
- *val = no_stem_darkening;
-
- return error;
- }
-
- FT_TRACE0(( "cff_property_get: missing property `%s'\n",
- property_name ));
- return FT_THROW( Missing_Property );
- }
-
FT_DEFINE_SERVICE_PROPERTIESREC(
cff_service_properties,
- (FT_Properties_SetFunc)cff_property_set, /* set_property */
- (FT_Properties_GetFunc)cff_property_get ) /* get_property */
+ (FT_Properties_SetFunc)ps_property_set, /* set_property */
+ (FT_Properties_GetFunc)ps_property_get ) /* get_property */
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1028,6 +895,17 @@
}
+ static FT_Error
+ cff_set_instance( CFF_Face face,
+ FT_UInt instance_index )
+ {
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+
+
+ return mm->set_instance( FT_FACE( face ), instance_index );
+ }
+
+
FT_DEFINE_SERVICE_MULTIMASTERSREC(
cff_service_multi_masters,
@@ -1038,6 +916,7 @@
(FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
(FT_Set_Var_Design_Func)cff_set_var_design, /* set_var_design */
(FT_Get_Var_Design_Func)cff_get_var_design, /* get_var_design */
+ (FT_Set_Instance_Func) cff_set_instance, /* set_instance */
(FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
(FT_Done_Blend_Func) cff_done_blend /* done_blend */
@@ -1088,6 +967,22 @@
#endif
+ /*
+ * CFFLOAD SERVICE
+ *
+ */
+
+ FT_DEFINE_SERVICE_CFFLOADREC(
+ cff_service_cff_load,
+
+ (FT_Get_Standard_Encoding_Func)cff_get_standard_encoding,
+ (FT_Load_Private_Dict_Func) cff_load_private_dict,
+ (FT_FD_Select_Get_Func) cff_fd_select_get,
+ (FT_Blend_Check_Vector_Func) cff_blend_check_vector,
+ (FT_Blend_Build_Vector_Func) cff_blend_build_vector
+ )
+
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -1102,7 +997,7 @@
#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_DEFINE_SERVICEDESCREC9(
+ FT_DEFINE_SERVICEDESCREC10(
cff_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
@@ -1113,10 +1008,11 @@
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
- FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
+ FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
+ FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
)
#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
- FT_DEFINE_SERVICEDESCREC7(
+ FT_DEFINE_SERVICEDESCREC8(
cff_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
@@ -1125,10 +1021,11 @@
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
- FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
+ FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
+ FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
)
#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_DEFINE_SERVICEDESCREC8(
+ FT_DEFINE_SERVICEDESCREC9(
cff_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
@@ -1138,10 +1035,11 @@
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
- FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
+ FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
+ FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
)
#else
- FT_DEFINE_SERVICEDESCREC6(
+ FT_DEFINE_SERVICEDESCREC7(
cff_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
@@ -1149,7 +1047,8 @@
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
- FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
+ FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
+ FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
)
#endif
@@ -1208,7 +1107,7 @@
FT_MODULE_DRIVER_HAS_HINTER |
FT_MODULE_DRIVER_HINTS_LIGHTLY,
- sizeof ( CFF_DriverRec ),
+ sizeof ( PS_DriverRec ),
"cff",
0x10000L,
0x20000L,
diff --git a/thirdparty/freetype/src/cff/cffdrivr.h b/thirdparty/freetype/src/cff/cffdrivr.h
index 05381e66db..ad7c3ad70a 100644
--- a/thirdparty/freetype/src/cff/cffdrivr.h
+++ b/thirdparty/freetype/src/cff/cffdrivr.h
@@ -4,7 +4,7 @@
/* */
/* High-level OpenType driver interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cff/cfferrs.h b/thirdparty/freetype/src/cff/cfferrs.h
index 40808c1051..b2e1bfaf9d 100644
--- a/thirdparty/freetype/src/cff/cfferrs.h
+++ b/thirdparty/freetype/src/cff/cfferrs.h
@@ -4,7 +4,7 @@
/* */
/* CFF error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cff/cffgload.c b/thirdparty/freetype/src/cff/cffgload.c
index 20f3a2c28e..c58471ce86 100644
--- a/thirdparty/freetype/src/cff/cffgload.c
+++ b/thirdparty/freetype/src/cff/cffgload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,13 +21,12 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
#include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_OUTLINE_H
-#include FT_CFF_DRIVER_H
+#include FT_DRIVER_H
-#include "cffobjs.h"
#include "cffload.h"
#include "cffgload.h"
-#include "cf2ft.h" /* for cf2_decoder_parse_charstrings */
#include "cfferrs.h"
@@ -42,623 +41,6 @@
#define FT_COMPONENT trace_cffgload
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
-
- typedef enum CFF_Operator_
- {
- cff_op_unknown = 0,
-
- cff_op_rmoveto,
- cff_op_hmoveto,
- cff_op_vmoveto,
-
- cff_op_rlineto,
- cff_op_hlineto,
- cff_op_vlineto,
-
- cff_op_rrcurveto,
- cff_op_hhcurveto,
- cff_op_hvcurveto,
- cff_op_rcurveline,
- cff_op_rlinecurve,
- cff_op_vhcurveto,
- cff_op_vvcurveto,
-
- cff_op_flex,
- cff_op_hflex,
- cff_op_hflex1,
- cff_op_flex1,
-
- cff_op_endchar,
-
- cff_op_hstem,
- cff_op_vstem,
- cff_op_hstemhm,
- cff_op_vstemhm,
-
- cff_op_hintmask,
- cff_op_cntrmask,
- cff_op_dotsection, /* deprecated, acts as no-op */
-
- cff_op_abs,
- cff_op_add,
- cff_op_sub,
- cff_op_div,
- cff_op_neg,
- cff_op_random,
- cff_op_mul,
- cff_op_sqrt,
-
- cff_op_blend,
-
- cff_op_drop,
- cff_op_exch,
- cff_op_index,
- cff_op_roll,
- cff_op_dup,
-
- cff_op_put,
- cff_op_get,
- cff_op_store,
- cff_op_load,
-
- cff_op_and,
- cff_op_or,
- cff_op_not,
- cff_op_eq,
- cff_op_ifelse,
-
- cff_op_callsubr,
- cff_op_callgsubr,
- cff_op_return,
-
- /* Type 1 opcodes: invalid but seen in real life */
- cff_op_hsbw,
- cff_op_closepath,
- cff_op_callothersubr,
- cff_op_pop,
- cff_op_seac,
- cff_op_sbw,
- cff_op_setcurrentpoint,
-
- /* do not remove */
- cff_op_max
-
- } CFF_Operator;
-
-
-#define CFF_COUNT_CHECK_WIDTH 0x80
-#define CFF_COUNT_EXACT 0x40
-#define CFF_COUNT_CLEAR_STACK 0x20
-
- /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */
- /* used for checking the width and requested numbers of arguments */
- /* only; they are set to zero afterwards */
-
- /* the other two flags are informative only and unused currently */
-
- static const FT_Byte cff_argument_counts[] =
- {
- 0, /* unknown */
-
- 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */
- 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,
- 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,
-
- 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
-
- 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
- 0 | CFF_COUNT_CLEAR_STACK,
-
- 13, /* flex */
- 7,
- 9,
- 11,
-
- 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */
-
- 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */
- 2 | CFF_COUNT_CHECK_WIDTH,
- 2 | CFF_COUNT_CHECK_WIDTH,
- 2 | CFF_COUNT_CHECK_WIDTH,
-
- 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */
- 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */
- 0, /* dotsection */
-
- 1, /* abs */
- 2,
- 2,
- 2,
- 1,
- 0,
- 2,
- 1,
-
- 1, /* blend */
-
- 1, /* drop */
- 2,
- 1,
- 2,
- 1,
-
- 2, /* put */
- 1,
- 4,
- 3,
-
- 2, /* and */
- 2,
- 1,
- 2,
- 4,
-
- 1, /* callsubr */
- 1,
- 0,
-
- 2, /* hsbw */
- 0,
- 0,
- 0,
- 5, /* seac */
- 4, /* sbw */
- 2 /* setcurrentpoint */
- };
-
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** *********/
- /********** GENERIC CHARSTRING PARSING *********/
- /********** *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_builder_init */
- /* */
- /* <Description> */
- /* Initializes a given glyph builder. */
- /* */
- /* <InOut> */
- /* builder :: A pointer to the glyph builder to initialize. */
- /* */
- /* <Input> */
- /* face :: The current face object. */
- /* */
- /* size :: The current size object. */
- /* */
- /* glyph :: The current glyph object. */
- /* */
- /* hinting :: Whether hinting is active. */
- /* */
- static void
- cff_builder_init( CFF_Builder* builder,
- TT_Face face,
- CFF_Size size,
- CFF_GlyphSlot glyph,
- FT_Bool hinting )
- {
- builder->path_begun = 0;
- builder->load_points = 1;
-
- builder->face = face;
- builder->glyph = glyph;
- builder->memory = face->root.memory;
-
- if ( glyph )
- {
- FT_GlyphLoader loader = glyph->root.internal->loader;
-
-
- builder->loader = loader;
- builder->base = &loader->base.outline;
- builder->current = &loader->current.outline;
- FT_GlyphLoader_Rewind( loader );
-
- builder->hints_globals = NULL;
- builder->hints_funcs = NULL;
-
- if ( hinting && size )
- {
- FT_Size ftsize = FT_SIZE( size );
- CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
-
-
- if ( internal )
- {
- builder->hints_globals = (void *)internal->topfont;
- builder->hints_funcs = glyph->root.internal->glyph_hints;
- }
- }
- }
-
- builder->pos_x = 0;
- builder->pos_y = 0;
-
- builder->left_bearing.x = 0;
- builder->left_bearing.y = 0;
- builder->advance.x = 0;
- builder->advance.y = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_builder_done */
- /* */
- /* <Description> */
- /* Finalizes a given glyph builder. Its contents can still be used */
- /* after the call, but the function saves important information */
- /* within the corresponding glyph slot. */
- /* */
- /* <Input> */
- /* builder :: A pointer to the glyph builder to finalize. */
- /* */
- static void
- cff_builder_done( CFF_Builder* builder )
- {
- CFF_GlyphSlot glyph = builder->glyph;
-
-
- if ( glyph )
- glyph->root.outline = *builder->base;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_compute_bias */
- /* */
- /* <Description> */
- /* Computes the bias value in dependence of the number of glyph */
- /* subroutines. */
- /* */
- /* <Input> */
- /* in_charstring_type :: The `CharstringType' value of the top DICT */
- /* dictionary. */
- /* */
- /* num_subrs :: The number of glyph subroutines. */
- /* */
- /* <Return> */
- /* The bias value. */
- static FT_Int
- cff_compute_bias( FT_Int in_charstring_type,
- FT_UInt num_subrs )
- {
- FT_Int result;
-
-
- if ( in_charstring_type == 1 )
- result = 0;
- else if ( num_subrs < 1240 )
- result = 107;
- else if ( num_subrs < 33900U )
- result = 1131;
- else
- result = 32768U;
-
- return result;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_decoder_init */
- /* */
- /* <Description> */
- /* Initializes a given glyph decoder. */
- /* */
- /* <InOut> */
- /* decoder :: A pointer to the glyph builder to initialize. */
- /* */
- /* <Input> */
- /* face :: The current face object. */
- /* */
- /* size :: The current size object. */
- /* */
- /* slot :: The current glyph object. */
- /* */
- /* hinting :: Whether hinting is active. */
- /* */
- /* hint_mode :: The hinting mode. */
- /* */
- FT_LOCAL_DEF( void )
- cff_decoder_init( CFF_Decoder* decoder,
- TT_Face face,
- CFF_Size size,
- CFF_GlyphSlot slot,
- FT_Bool hinting,
- FT_Render_Mode hint_mode )
- {
- CFF_Font cff = (CFF_Font)face->extra.data;
-
-
- /* clear everything */
- FT_ZERO( decoder );
-
- /* initialize builder */
- cff_builder_init( &decoder->builder, face, size, slot, hinting );
-
- /* initialize Type2 decoder */
- decoder->cff = cff;
- decoder->num_globals = cff->global_subrs_index.count;
- decoder->globals = cff->global_subrs;
- decoder->globals_bias = cff_compute_bias(
- cff->top_font.font_dict.charstring_type,
- decoder->num_globals );
-
- decoder->hint_mode = hint_mode;
- }
-
-
- /* this function is used to select the subfont */
- /* and the locals subrs array */
- FT_LOCAL_DEF( FT_Error )
- cff_decoder_prepare( CFF_Decoder* decoder,
- CFF_Size size,
- FT_UInt glyph_index )
- {
- CFF_Builder *builder = &decoder->builder;
- CFF_Font cff = (CFF_Font)builder->face->extra.data;
- CFF_SubFont sub = &cff->top_font;
- FT_Error error = FT_Err_Ok;
-
-
- /* manage CID fonts */
- if ( cff->num_subfonts )
- {
- FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index );
-
-
- if ( fd_index >= cff->num_subfonts )
- {
- FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- FT_TRACE3(( " in subfont %d:\n", fd_index ));
-
- sub = cff->subfonts[fd_index];
-
- if ( builder->hints_funcs && size )
- {
- FT_Size ftsize = FT_SIZE( size );
- CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
-
-
- /* for CFFs without subfonts, this value has already been set */
- builder->hints_globals = (void *)internal->subfonts[fd_index];
- }
- }
-
- decoder->num_locals = sub->local_subrs_index.count;
- decoder->locals = sub->local_subrs;
- decoder->locals_bias = cff_compute_bias(
- decoder->cff->top_font.font_dict.charstring_type,
- decoder->num_locals );
-
- decoder->glyph_width = sub->private_dict.default_width;
- decoder->nominal_width = sub->private_dict.nominal_width;
-
- decoder->current_subfont = sub;
-
- Exit:
- return error;
- }
-
-
- /* check that there is enough space for `count' more points */
- FT_LOCAL_DEF( FT_Error )
- cff_check_points( CFF_Builder* builder,
- FT_Int count )
- {
- return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
- }
-
-
- /* add a new point, do not check space */
- FT_LOCAL_DEF( void )
- cff_builder_add_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag )
- {
- FT_Outline* outline = builder->current;
-
-
- if ( builder->load_points )
- {
- FT_Vector* point = outline->points + outline->n_points;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
-
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
-
-
- if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
- {
- point->x = x >> 16;
- point->y = y >> 16;
- }
- else
-#endif
- {
- /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
- point->x = x >> 10;
- point->y = y >> 10;
- }
- *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
- }
-
- outline->n_points++;
- }
-
-
- /* check space for a new on-curve point, then add it */
- FT_LOCAL_DEF( FT_Error )
- cff_builder_add_point1( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y )
- {
- FT_Error error;
-
-
- error = cff_check_points( builder, 1 );
- if ( !error )
- cff_builder_add_point( builder, x, y, 1 );
-
- return error;
- }
-
-
- /* check space for a new contour, then add it */
- static FT_Error
- cff_builder_add_contour( CFF_Builder* builder )
- {
- FT_Outline* outline = builder->current;
- FT_Error error;
-
-
- if ( !builder->load_points )
- {
- outline->n_contours++;
- return FT_Err_Ok;
- }
-
- error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
- if ( !error )
- {
- if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
-
- outline->n_contours++;
- }
-
- return error;
- }
-
-
- /* if a path was begun, add its first on-curve point */
- FT_LOCAL_DEF( FT_Error )
- cff_builder_start_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y )
- {
- FT_Error error = FT_Err_Ok;
-
-
- /* test whether we are building a new contour */
- if ( !builder->path_begun )
- {
- builder->path_begun = 1;
- error = cff_builder_add_contour( builder );
- if ( !error )
- error = cff_builder_add_point1( builder, x, y );
- }
-
- return error;
- }
-
-
- /* close the current contour */
- FT_LOCAL_DEF( void )
- cff_builder_close_contour( CFF_Builder* builder )
- {
- FT_Outline* outline = builder->current;
- FT_Int first;
-
-
- if ( !outline )
- return;
-
- first = outline->n_contours <= 1
- ? 0 : outline->contours[outline->n_contours - 2] + 1;
-
- /* We must not include the last point in the path if it */
- /* is located on the first point. */
- if ( outline->n_points > 1 )
- {
- FT_Vector* p1 = outline->points + first;
- FT_Vector* p2 = outline->points + outline->n_points - 1;
- FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
-
-
- /* `delete' last point only if it coincides with the first */
- /* point and if it is not a control point (which can happen). */
- if ( p1->x == p2->x && p1->y == p2->y )
- if ( *control == FT_CURVE_TAG_ON )
- outline->n_points--;
- }
-
- if ( outline->n_contours > 0 )
- {
- /* Don't add contours only consisting of one point, i.e., */
- /* check whether begin point and last point are the same. */
- if ( first == outline->n_points - 1 )
- {
- outline->n_contours--;
- outline->n_points--;
- }
- else
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
- }
- }
-
-
- FT_LOCAL_DEF( FT_Int )
- cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
- FT_Int charcode )
- {
- FT_UInt n;
- FT_UShort glyph_sid;
-
-
- /* CID-keyed fonts don't have glyph names */
- if ( !cff->charset.sids )
- return -1;
-
- /* check range of standard char code */
- if ( charcode < 0 || charcode > 255 )
- return -1;
-
- /* Get code to SID mapping from `cff_standard_encoding'. */
- glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode );
-
- for ( n = 0; n < cff->num_glyphs; n++ )
- {
- if ( cff->charset.sids[n] == glyph_sid )
- return (FT_Int)n;
- }
-
- return -1;
- }
-
-
FT_LOCAL_DEF( FT_Error )
cff_get_glyph_data( TT_Face face,
FT_UInt glyph_index,
@@ -730,1950 +112,6 @@
}
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
-
- static FT_Error
- cff_operator_seac( CFF_Decoder* decoder,
- FT_Pos asb,
- FT_Pos adx,
- FT_Pos ady,
- FT_Int bchar,
- FT_Int achar )
- {
- FT_Error error;
- CFF_Builder* builder = &decoder->builder;
- FT_Int bchar_index, achar_index;
- TT_Face face = decoder->builder.face;
- FT_Vector left_bearing, advance;
- FT_Byte* charstring;
- FT_ULong charstring_len;
- FT_Pos glyph_width;
-
-
- if ( decoder->seac )
- {
- FT_ERROR(( "cff_operator_seac: invalid nested seac\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- adx += decoder->builder.left_bearing.x;
- ady += decoder->builder.left_bearing.y;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* Incremental fonts don't necessarily have valid charsets. */
- /* They use the character code, not the glyph index, in this case. */
- if ( face->root.internal->incremental_interface )
- {
- bchar_index = bchar;
- achar_index = achar;
- }
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- CFF_Font cff = (CFF_Font)(face->extra.data);
-
-
- bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar );
- achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar );
- }
-
- if ( bchar_index < 0 || achar_index < 0 )
- {
- FT_ERROR(( "cff_operator_seac:"
- " invalid seac character code arguments\n" ));
- return FT_THROW( Syntax_Error );
- }
-
- /* If we are trying to load a composite glyph, do not load the */
- /* accent character and return the array of subglyphs. */
- if ( builder->no_recurse )
- {
- FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph;
- FT_GlyphLoader loader = glyph->internal->loader;
- FT_SubGlyph subg;
-
-
- /* reallocate subglyph array if necessary */
- error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
- if ( error )
- goto Exit;
-
- subg = loader->current.subglyphs;
-
- /* subglyph 0 = base character */
- subg->index = bchar_index;
- subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
- FT_SUBGLYPH_FLAG_USE_MY_METRICS;
- subg->arg1 = 0;
- subg->arg2 = 0;
- subg++;
-
- /* subglyph 1 = accent character */
- subg->index = achar_index;
- subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
- subg->arg1 = (FT_Int)( adx >> 16 );
- subg->arg2 = (FT_Int)( ady >> 16 );
-
- /* set up remaining glyph fields */
- glyph->num_subglyphs = 2;
- glyph->subglyphs = loader->base.subglyphs;
- glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
-
- loader->current.num_subglyphs = 2;
- }
-
- FT_GlyphLoader_Prepare( builder->loader );
-
- /* First load `bchar' in builder */
- error = cff_get_glyph_data( face, (FT_UInt)bchar_index,
- &charstring, &charstring_len );
- if ( !error )
- {
- /* the seac operator must not be nested */
- decoder->seac = TRUE;
- error = cff_decoder_parse_charstrings( decoder, charstring,
- charstring_len, 0 );
- decoder->seac = FALSE;
-
- cff_free_glyph_data( face, &charstring, charstring_len );
-
- if ( error )
- goto Exit;
- }
-
- /* Save the left bearing, advance and glyph width of the base */
- /* character as they will be erased by the next load. */
-
- left_bearing = builder->left_bearing;
- advance = builder->advance;
- glyph_width = decoder->glyph_width;
-
- builder->left_bearing.x = 0;
- builder->left_bearing.y = 0;
-
- builder->pos_x = adx - asb;
- builder->pos_y = ady;
-
- /* Now load `achar' on top of the base outline. */
- error = cff_get_glyph_data( face, (FT_UInt)achar_index,
- &charstring, &charstring_len );
- if ( !error )
- {
- /* the seac operator must not be nested */
- decoder->seac = TRUE;
- error = cff_decoder_parse_charstrings( decoder, charstring,
- charstring_len, 0 );
- decoder->seac = FALSE;
-
- cff_free_glyph_data( face, &charstring, charstring_len );
-
- if ( error )
- goto Exit;
- }
-
- /* Restore the left side bearing, advance and glyph width */
- /* of the base character. */
- builder->left_bearing = left_bearing;
- builder->advance = advance;
- decoder->glyph_width = glyph_width;
-
- builder->pos_x = 0;
- builder->pos_y = 0;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cff_decoder_parse_charstrings */
- /* */
- /* <Description> */
- /* Parses a given Type 2 charstrings program. */
- /* */
- /* <InOut> */
- /* decoder :: The current Type 1 decoder. */
- /* */
- /* <Input> */
- /* charstring_base :: The base of the charstring stream. */
- /* */
- /* charstring_len :: The length in bytes of the charstring stream. */
- /* */
- /* in_dict :: Set to 1 if function is called from top or */
- /* private DICT (needed for Multiple Master CFFs). */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- cff_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len,
- FT_Bool in_dict )
- {
- FT_Error error;
- CFF_Decoder_Zone* zone;
- FT_Byte* ip;
- FT_Byte* limit;
- CFF_Builder* builder = &decoder->builder;
- FT_Pos x, y;
- FT_Fixed* stack;
- FT_Int charstring_type =
- decoder->cff->top_font.font_dict.charstring_type;
- FT_UShort num_designs =
- decoder->cff->top_font.font_dict.num_designs;
- FT_UShort num_axes =
- decoder->cff->top_font.font_dict.num_axes;
-
- T2_Hints_Funcs hinter;
-
-
- /* set default width */
- decoder->num_hints = 0;
- decoder->read_width = 1;
-
- /* initialize the decoder */
- decoder->top = decoder->stack;
- decoder->zone = decoder->zones;
- zone = decoder->zones;
- stack = decoder->top;
-
- hinter = (T2_Hints_Funcs)builder->hints_funcs;
-
- builder->path_begun = 0;
-
- zone->base = charstring_base;
- limit = zone->limit = charstring_base + charstring_len;
- ip = zone->cursor = zone->base;
-
- error = FT_Err_Ok;
-
- x = builder->pos_x;
- y = builder->pos_y;
-
- /* begin hints recording session, if any */
- if ( hinter )
- hinter->open( hinter->hints );
-
- /* now execute loop */
- while ( ip < limit )
- {
- CFF_Operator op;
- FT_Byte v;
-
-
- /********************************************************************/
- /* */
- /* Decode operator or operand */
- /* */
- v = *ip++;
- if ( v >= 32 || v == 28 )
- {
- FT_Int shift = 16;
- FT_Int32 val;
-
-
- /* this is an operand, push it on the stack */
-
- /* if we use shifts, all computations are done with unsigned */
- /* values; the conversion to a signed value is the last step */
- if ( v == 28 )
- {
- if ( ip + 1 >= limit )
- goto Syntax_Error;
- val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] );
- ip += 2;
- }
- else if ( v < 247 )
- val = (FT_Int32)v - 139;
- else if ( v < 251 )
- {
- if ( ip >= limit )
- goto Syntax_Error;
- val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
- }
- else if ( v < 255 )
- {
- if ( ip >= limit )
- goto Syntax_Error;
- val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
- }
- else
- {
- if ( ip + 3 >= limit )
- goto Syntax_Error;
- val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
- ( (FT_UInt32)ip[1] << 16 ) |
- ( (FT_UInt32)ip[2] << 8 ) |
- (FT_UInt32)ip[3] );
- ip += 4;
- if ( charstring_type == 2 )
- shift = 0;
- }
- if ( decoder->top - stack >= CFF_MAX_OPERANDS )
- goto Stack_Overflow;
-
- val = (FT_Int32)( (FT_UInt32)val << shift );
- *decoder->top++ = val;
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- if ( !( val & 0xFFFFL ) )
- FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) ));
- else
- FT_TRACE4(( " %.5f", val / 65536.0 ));
-#endif
-
- }
- else
- {
- /* The specification says that normally arguments are to be taken */
- /* from the bottom of the stack. However, this seems not to be */
- /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */
- /* arguments similar to a PS interpreter. */
-
- FT_Fixed* args = decoder->top;
- FT_Int num_args = (FT_Int)( args - decoder->stack );
- FT_Int req_args;
-
-
- /* find operator */
- op = cff_op_unknown;
-
- switch ( v )
- {
- case 1:
- op = cff_op_hstem;
- break;
- case 3:
- op = cff_op_vstem;
- break;
- case 4:
- op = cff_op_vmoveto;
- break;
- case 5:
- op = cff_op_rlineto;
- break;
- case 6:
- op = cff_op_hlineto;
- break;
- case 7:
- op = cff_op_vlineto;
- break;
- case 8:
- op = cff_op_rrcurveto;
- break;
- case 9:
- op = cff_op_closepath;
- break;
- case 10:
- op = cff_op_callsubr;
- break;
- case 11:
- op = cff_op_return;
- break;
- case 12:
- {
- if ( ip >= limit )
- goto Syntax_Error;
- v = *ip++;
-
- switch ( v )
- {
- case 0:
- op = cff_op_dotsection;
- break;
- case 1: /* this is actually the Type1 vstem3 operator */
- op = cff_op_vstem;
- break;
- case 2: /* this is actually the Type1 hstem3 operator */
- op = cff_op_hstem;
- break;
- case 3:
- op = cff_op_and;
- break;
- case 4:
- op = cff_op_or;
- break;
- case 5:
- op = cff_op_not;
- break;
- case 6:
- op = cff_op_seac;
- break;
- case 7:
- op = cff_op_sbw;
- break;
- case 8:
- op = cff_op_store;
- break;
- case 9:
- op = cff_op_abs;
- break;
- case 10:
- op = cff_op_add;
- break;
- case 11:
- op = cff_op_sub;
- break;
- case 12:
- op = cff_op_div;
- break;
- case 13:
- op = cff_op_load;
- break;
- case 14:
- op = cff_op_neg;
- break;
- case 15:
- op = cff_op_eq;
- break;
- case 16:
- op = cff_op_callothersubr;
- break;
- case 17:
- op = cff_op_pop;
- break;
- case 18:
- op = cff_op_drop;
- break;
- case 20:
- op = cff_op_put;
- break;
- case 21:
- op = cff_op_get;
- break;
- case 22:
- op = cff_op_ifelse;
- break;
- case 23:
- op = cff_op_random;
- break;
- case 24:
- op = cff_op_mul;
- break;
- case 26:
- op = cff_op_sqrt;
- break;
- case 27:
- op = cff_op_dup;
- break;
- case 28:
- op = cff_op_exch;
- break;
- case 29:
- op = cff_op_index;
- break;
- case 30:
- op = cff_op_roll;
- break;
- case 33:
- op = cff_op_setcurrentpoint;
- break;
- case 34:
- op = cff_op_hflex;
- break;
- case 35:
- op = cff_op_flex;
- break;
- case 36:
- op = cff_op_hflex1;
- break;
- case 37:
- op = cff_op_flex1;
- break;
- default:
- FT_TRACE4(( " unknown op (12, %d)\n", v ));
- break;
- }
- }
- break;
- case 13:
- op = cff_op_hsbw;
- break;
- case 14:
- op = cff_op_endchar;
- break;
- case 16:
- op = cff_op_blend;
- break;
- case 18:
- op = cff_op_hstemhm;
- break;
- case 19:
- op = cff_op_hintmask;
- break;
- case 20:
- op = cff_op_cntrmask;
- break;
- case 21:
- op = cff_op_rmoveto;
- break;
- case 22:
- op = cff_op_hmoveto;
- break;
- case 23:
- op = cff_op_vstemhm;
- break;
- case 24:
- op = cff_op_rcurveline;
- break;
- case 25:
- op = cff_op_rlinecurve;
- break;
- case 26:
- op = cff_op_vvcurveto;
- break;
- case 27:
- op = cff_op_hhcurveto;
- break;
- case 29:
- op = cff_op_callgsubr;
- break;
- case 30:
- op = cff_op_vhcurveto;
- break;
- case 31:
- op = cff_op_hvcurveto;
- break;
- default:
- FT_TRACE4(( " unknown op (%d)\n", v ));
- break;
- }
-
- if ( op == cff_op_unknown )
- continue;
-
- /* in Multiple Master CFFs, T2 charstrings can appear in */
- /* dictionaries, but some operators are prohibited */
- if ( in_dict )
- {
- switch ( op )
- {
- case cff_op_hstem:
- case cff_op_vstem:
- case cff_op_vmoveto:
- case cff_op_rlineto:
- case cff_op_hlineto:
- case cff_op_vlineto:
- case cff_op_rrcurveto:
- case cff_op_hstemhm:
- case cff_op_hintmask:
- case cff_op_cntrmask:
- case cff_op_rmoveto:
- case cff_op_hmoveto:
- case cff_op_vstemhm:
- case cff_op_rcurveline:
- case cff_op_rlinecurve:
- case cff_op_vvcurveto:
- case cff_op_hhcurveto:
- case cff_op_vhcurveto:
- case cff_op_hvcurveto:
- case cff_op_hflex:
- case cff_op_flex:
- case cff_op_hflex1:
- case cff_op_flex1:
- case cff_op_callsubr:
- case cff_op_callgsubr:
- goto MM_Error;
-
- default:
- break;
- }
- }
-
- /* check arguments */
- req_args = cff_argument_counts[op];
- if ( req_args & CFF_COUNT_CHECK_WIDTH )
- {
- if ( num_args > 0 && decoder->read_width )
- {
- /* If `nominal_width' is non-zero, the number is really a */
- /* difference against `nominal_width'. Else, the number here */
- /* is truly a width, not a difference against `nominal_width'. */
- /* If the font does not set `nominal_width', then */
- /* `nominal_width' defaults to zero, and so we can set */
- /* `glyph_width' to `nominal_width' plus number on the stack */
- /* -- for either case. */
-
- FT_Int set_width_ok;
-
-
- switch ( op )
- {
- case cff_op_hmoveto:
- case cff_op_vmoveto:
- set_width_ok = num_args & 2;
- break;
-
- case cff_op_hstem:
- case cff_op_vstem:
- case cff_op_hstemhm:
- case cff_op_vstemhm:
- case cff_op_rmoveto:
- case cff_op_hintmask:
- case cff_op_cntrmask:
- set_width_ok = num_args & 1;
- break;
-
- case cff_op_endchar:
- /* If there is a width specified for endchar, we either have */
- /* 1 argument or 5 arguments. We like to argue. */
- set_width_ok = in_dict
- ? 0
- : ( ( num_args == 5 ) || ( num_args == 1 ) );
- break;
-
- default:
- set_width_ok = 0;
- break;
- }
-
- if ( set_width_ok )
- {
- decoder->glyph_width = decoder->nominal_width +
- ( stack[0] >> 16 );
-
- if ( decoder->width_only )
- {
- /* we only want the advance width; stop here */
- break;
- }
-
- /* Consumed an argument. */
- num_args--;
- }
- }
-
- decoder->read_width = 0;
- req_args = 0;
- }
-
- req_args &= 0x000F;
- if ( num_args < req_args )
- goto Stack_Underflow;
- args -= req_args;
- num_args -= req_args;
-
- /* At this point, `args' points to the first argument of the */
- /* operand in case `req_args' isn't zero. Otherwise, we have */
- /* to adjust `args' manually. */
-
- /* Note that we only pop arguments from the stack which we */
- /* really need and can digest so that we can continue in case */
- /* of superfluous stack elements. */
-
- switch ( op )
- {
- case cff_op_hstem:
- case cff_op_vstem:
- case cff_op_hstemhm:
- case cff_op_vstemhm:
- /* the number of arguments is always even here */
- FT_TRACE4((
- op == cff_op_hstem ? " hstem\n" :
- ( op == cff_op_vstem ? " vstem\n" :
- ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) ));
-
- if ( hinter )
- hinter->stems( hinter->hints,
- ( op == cff_op_hstem || op == cff_op_hstemhm ),
- num_args / 2,
- args - ( num_args & ~1 ) );
-
- decoder->num_hints += num_args / 2;
- args = stack;
- break;
-
- case cff_op_hintmask:
- case cff_op_cntrmask:
- FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" ));
-
- /* implement vstem when needed -- */
- /* the specification doesn't say it, but this also works */
- /* with the 'cntrmask' operator */
- /* */
- if ( num_args > 0 )
- {
- if ( hinter )
- hinter->stems( hinter->hints,
- 0,
- num_args / 2,
- args - ( num_args & ~1 ) );
-
- decoder->num_hints += num_args / 2;
- }
-
- /* In a valid charstring there must be at least one byte */
- /* after `hintmask' or `cntrmask' (e.g., for a `return' */
- /* instruction). Additionally, there must be space for */
- /* `num_hints' bits. */
-
- if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit )
- goto Syntax_Error;
-
- if ( hinter )
- {
- if ( op == cff_op_hintmask )
- hinter->hintmask( hinter->hints,
- (FT_UInt)builder->current->n_points,
- (FT_UInt)decoder->num_hints,
- ip );
- else
- hinter->counter( hinter->hints,
- (FT_UInt)decoder->num_hints,
- ip );
- }
-
-#ifdef FT_DEBUG_LEVEL_TRACE
- {
- FT_UInt maskbyte;
-
-
- FT_TRACE4(( " (maskbytes:" ));
-
- for ( maskbyte = 0;
- maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 );
- maskbyte++, ip++ )
- FT_TRACE4(( " 0x%02X", *ip ));
-
- FT_TRACE4(( ")\n" ));
- }
-#else
- ip += ( decoder->num_hints + 7 ) >> 3;
-#endif
- args = stack;
- break;
-
- case cff_op_rmoveto:
- FT_TRACE4(( " rmoveto\n" ));
-
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- x = ADD_LONG( x, args[-2] );
- y = ADD_LONG( y, args[-1] );
- args = stack;
- break;
-
- case cff_op_vmoveto:
- FT_TRACE4(( " vmoveto\n" ));
-
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- y = ADD_LONG( y, args[-1] );
- args = stack;
- break;
-
- case cff_op_hmoveto:
- FT_TRACE4(( " hmoveto\n" ));
-
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- x = ADD_LONG( x, args[-1] );
- args = stack;
- break;
-
- case cff_op_rlineto:
- FT_TRACE4(( " rlineto\n" ));
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_args / 2 ) )
- goto Fail;
-
- if ( num_args < 2 )
- goto Stack_Underflow;
-
- args -= num_args & ~1;
- while ( args < decoder->top )
- {
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 1 );
- args += 2;
- }
- args = stack;
- break;
-
- case cff_op_hlineto:
- case cff_op_vlineto:
- {
- FT_Int phase = ( op == cff_op_hlineto );
-
-
- FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
- : " vlineto\n" ));
-
- if ( num_args < 0 )
- goto Stack_Underflow;
-
- /* there exist subsetted fonts (found in PDFs) */
- /* which call `hlineto' without arguments */
- if ( num_args == 0 )
- break;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_args ) )
- goto Fail;
-
- args = stack;
- while ( args < decoder->top )
- {
- if ( phase )
- x = ADD_LONG( x, args[0] );
- else
- y = ADD_LONG( y, args[0] );
-
- if ( cff_builder_add_point1( builder, x, y ) )
- goto Fail;
-
- args++;
- phase ^= 1;
- }
- args = stack;
- }
- break;
-
- case cff_op_rrcurveto:
- {
- FT_Int nargs;
-
-
- FT_TRACE4(( " rrcurveto\n" ));
-
- if ( num_args < 6 )
- goto Stack_Underflow;
-
- nargs = num_args - num_args % 6;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, nargs / 2 ) )
- goto Fail;
-
- args -= nargs;
- while ( args < decoder->top )
- {
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[2] );
- y = ADD_LONG( y, args[3] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[4] );
- y = ADD_LONG( y, args[5] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args += 6;
- }
- args = stack;
- }
- break;
-
- case cff_op_vvcurveto:
- {
- FT_Int nargs;
-
-
- FT_TRACE4(( " vvcurveto\n" ));
-
- if ( num_args < 4 )
- goto Stack_Underflow;
-
- /* if num_args isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
-
- nargs = num_args & ~2;
-
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
-
- args -= nargs;
-
- if ( nargs & 1 )
- {
- x = ADD_LONG( x, args[0] );
- args++;
- nargs--;
- }
-
- if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) )
- goto Fail;
-
- while ( args < decoder->top )
- {
- y = ADD_LONG( y, args[0] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[1] );
- y = ADD_LONG( y, args[2] );
- cff_builder_add_point( builder, x, y, 0 );
-
- y = ADD_LONG( y, args[3] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args += 4;
- }
- args = stack;
- }
- break;
-
- case cff_op_hhcurveto:
- {
- FT_Int nargs;
-
-
- FT_TRACE4(( " hhcurveto\n" ));
-
- if ( num_args < 4 )
- goto Stack_Underflow;
-
- /* if num_args isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
-
- nargs = num_args & ~2;
-
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
-
- args -= nargs;
- if ( nargs & 1 )
- {
- y = ADD_LONG( y, args[0] );
- args++;
- nargs--;
- }
-
- if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) )
- goto Fail;
-
- while ( args < decoder->top )
- {
- x = ADD_LONG( x, args[0] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[1] );
- y = ADD_LONG( y, args[2] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[3] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args += 4;
- }
- args = stack;
- }
- break;
-
- case cff_op_vhcurveto:
- case cff_op_hvcurveto:
- {
- FT_Int phase;
- FT_Int nargs;
-
-
- FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n"
- : " hvcurveto\n" ));
-
- if ( cff_builder_start_point( builder, x, y ) )
- goto Fail;
-
- if ( num_args < 4 )
- goto Stack_Underflow;
-
- /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
- /* we enforce it by clearing the second bit */
-
- nargs = num_args & ~2;
-
- args -= nargs;
- if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) )
- goto Stack_Underflow;
-
- phase = ( op == cff_op_hvcurveto );
-
- while ( nargs >= 4 )
- {
- nargs -= 4;
- if ( phase )
- {
- x = ADD_LONG( x, args[0] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[1] );
- y = ADD_LONG( y, args[2] );
- cff_builder_add_point( builder, x, y, 0 );
-
- y = ADD_LONG( y, args[3] );
- if ( nargs == 1 )
- x = ADD_LONG( x, args[4] );
- cff_builder_add_point( builder, x, y, 1 );
- }
- else
- {
- y = ADD_LONG( y, args[0] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[1] );
- y = ADD_LONG( y, args[2] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[3] );
- if ( nargs == 1 )
- y = ADD_LONG( y, args[4] );
- cff_builder_add_point( builder, x, y, 1 );
- }
- args += 4;
- phase ^= 1;
- }
- args = stack;
- }
- break;
-
- case cff_op_rlinecurve:
- {
- FT_Int num_lines;
- FT_Int nargs;
-
-
- FT_TRACE4(( " rlinecurve\n" ));
-
- if ( num_args < 8 )
- goto Stack_Underflow;
-
- nargs = num_args & ~1;
- num_lines = ( nargs - 6 ) / 2;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_lines + 3 ) )
- goto Fail;
-
- args -= nargs;
-
- /* first, add the line segments */
- while ( num_lines > 0 )
- {
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args += 2;
- num_lines--;
- }
-
- /* then the curve */
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[2] );
- y = ADD_LONG( y, args[3] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[4] );
- y = ADD_LONG( y, args[5] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- }
- break;
-
- case cff_op_rcurveline:
- {
- FT_Int num_curves;
- FT_Int nargs;
-
-
- FT_TRACE4(( " rcurveline\n" ));
-
- if ( num_args < 8 )
- goto Stack_Underflow;
-
- nargs = num_args - 2;
- nargs = nargs - nargs % 6 + 2;
- num_curves = ( nargs - 2 ) / 6;
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, num_curves * 3 + 2 ) )
- goto Fail;
-
- args -= nargs;
-
- /* first, add the curves */
- while ( num_curves > 0 )
- {
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[2] );
- y = ADD_LONG( y, args[3] );
- cff_builder_add_point( builder, x, y, 0 );
-
- x = ADD_LONG( x, args[4] );
- y = ADD_LONG( y, args[5] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args += 6;
- num_curves--;
- }
-
- /* then the final line */
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- }
- break;
-
- case cff_op_hflex1:
- {
- FT_Pos start_y;
-
-
- FT_TRACE4(( " hflex1\n" ));
-
- /* adding five more points: 4 control points, 1 on-curve point */
- /* -- make sure we have enough space for the start point if it */
- /* needs to be added */
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- /* record the starting point's y position for later use */
- start_y = y;
-
- /* first control point */
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* second control point */
- x = ADD_LONG( x, args[2] );
- y = ADD_LONG( y, args[3] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* join point; on curve, with y-value the same as the last */
- /* control point's y-value */
- x = ADD_LONG( x, args[4] );
- cff_builder_add_point( builder, x, y, 1 );
-
- /* third control point, with y-value the same as the join */
- /* point's y-value */
- x = ADD_LONG( x, args[5] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* fourth control point */
- x = ADD_LONG( x, args[6] );
- y = ADD_LONG( y, args[7] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* ending point, with y-value the same as the start */
- x = ADD_LONG( x, args[8] );
- y = start_y;
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- break;
- }
-
- case cff_op_hflex:
- {
- FT_Pos start_y;
-
-
- FT_TRACE4(( " hflex\n" ));
-
- /* adding six more points; 4 control points, 2 on-curve points */
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- /* record the starting point's y-position for later use */
- start_y = y;
-
- /* first control point */
- x = ADD_LONG( x, args[0] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* second control point */
- x = ADD_LONG( x, args[1] );
- y = ADD_LONG( y, args[2] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* join point; on curve, with y-value the same as the last */
- /* control point's y-value */
- x = ADD_LONG( x, args[3] );
- cff_builder_add_point( builder, x, y, 1 );
-
- /* third control point, with y-value the same as the join */
- /* point's y-value */
- x = ADD_LONG( x, args[4] );
- cff_builder_add_point( builder, x, y, 0 );
-
- /* fourth control point */
- x = ADD_LONG( x, args[5] );
- y = start_y;
- cff_builder_add_point( builder, x, y, 0 );
-
- /* ending point, with y-value the same as the start point's */
- /* y-value -- we don't add this point, though */
- x = ADD_LONG( x, args[6] );
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- break;
- }
-
- case cff_op_flex1:
- {
- FT_Pos start_x, start_y; /* record start x, y values for */
- /* alter use */
- FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
- /* algorithm below */
- FT_Int horizontal, count;
- FT_Fixed* temp;
-
-
- FT_TRACE4(( " flex1\n" ));
-
- /* adding six more points; 4 control points, 2 on-curve points */
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- /* record the starting point's x, y position for later use */
- start_x = x;
- start_y = y;
-
- /* XXX: figure out whether this is supposed to be a horizontal */
- /* or vertical flex; the Type 2 specification is vague... */
-
- temp = args;
-
- /* grab up to the last argument */
- for ( count = 5; count > 0; count-- )
- {
- dx = ADD_LONG( dx, temp[0] );
- dy = ADD_LONG( dy, temp[1] );
- temp += 2;
- }
-
- if ( dx < 0 )
- dx = -dx;
- if ( dy < 0 )
- dy = -dy;
-
- /* strange test, but here it is... */
- horizontal = ( dx > dy );
-
- for ( count = 5; count > 0; count-- )
- {
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y,
- (FT_Bool)( count == 3 ) );
- args += 2;
- }
-
- /* is last operand an x- or y-delta? */
- if ( horizontal )
- {
- x = ADD_LONG( x, args[0] );
- y = start_y;
- }
- else
- {
- x = start_x;
- y = ADD_LONG( y, args[0] );
- }
-
- cff_builder_add_point( builder, x, y, 1 );
-
- args = stack;
- break;
- }
-
- case cff_op_flex:
- {
- FT_UInt count;
-
-
- FT_TRACE4(( " flex\n" ));
-
- if ( cff_builder_start_point( builder, x, y ) ||
- cff_check_points( builder, 6 ) )
- goto Fail;
-
- for ( count = 6; count > 0; count-- )
- {
- x = ADD_LONG( x, args[0] );
- y = ADD_LONG( y, args[1] );
- cff_builder_add_point( builder, x, y,
- (FT_Bool)( count == 4 || count == 1 ) );
- args += 2;
- }
-
- args = stack;
- }
- break;
-
- case cff_op_seac:
- FT_TRACE4(( " seac\n" ));
-
- error = cff_operator_seac( decoder,
- args[0], args[1], args[2],
- (FT_Int)( args[3] >> 16 ),
- (FT_Int)( args[4] >> 16 ) );
-
- /* add current outline to the glyph slot */
- FT_GlyphLoader_Add( builder->loader );
-
- /* return now! */
- FT_TRACE4(( "\n" ));
- return error;
-
- case cff_op_endchar:
- /* in dictionaries, `endchar' simply indicates end of data */
- if ( in_dict )
- return error;
-
- FT_TRACE4(( " endchar\n" ));
-
- /* We are going to emulate the seac operator. */
- if ( num_args >= 4 )
- {
- /* Save glyph width so that the subglyphs don't overwrite it. */
- FT_Pos glyph_width = decoder->glyph_width;
-
-
- error = cff_operator_seac( decoder,
- 0L, args[-4], args[-3],
- (FT_Int)( args[-2] >> 16 ),
- (FT_Int)( args[-1] >> 16 ) );
-
- decoder->glyph_width = glyph_width;
- }
- else
- {
- cff_builder_close_contour( builder );
-
- /* close hints recording session */
- if ( hinter )
- {
- if ( hinter->close( hinter->hints,
- (FT_UInt)builder->current->n_points ) )
- goto Syntax_Error;
-
- /* apply hints to the loaded glyph outline now */
- error = hinter->apply( hinter->hints,
- builder->current,
- (PSH_Globals)builder->hints_globals,
- decoder->hint_mode );
- if ( error )
- goto Fail;
- }
-
- /* add current outline to the glyph slot */
- FT_GlyphLoader_Add( builder->loader );
- }
-
- /* return now! */
- FT_TRACE4(( "\n" ));
- return error;
-
- case cff_op_abs:
- FT_TRACE4(( " abs\n" ));
-
- if ( args[0] < 0 )
- {
- if ( args[0] == FT_LONG_MIN )
- args[0] = FT_LONG_MAX;
- else
- args[0] = -args[0];
- }
- args++;
- break;
-
- case cff_op_add:
- FT_TRACE4(( " add\n" ));
-
- args[0] = ADD_LONG( args[0], args[1] );
- args++;
- break;
-
- case cff_op_sub:
- FT_TRACE4(( " sub\n" ));
-
- args[0] = SUB_LONG( args[0], args[1] );
- args++;
- break;
-
- case cff_op_div:
- FT_TRACE4(( " div\n" ));
-
- args[0] = FT_DivFix( args[0], args[1] );
- args++;
- break;
-
- case cff_op_neg:
- FT_TRACE4(( " neg\n" ));
-
- if ( args[0] == FT_LONG_MIN )
- args[0] = FT_LONG_MAX;
- args[0] = -args[0];
- args++;
- break;
-
- case cff_op_random:
- FT_TRACE4(( " random\n" ));
-
- /* only use the lower 16 bits of `random' */
- /* to generate a number in the range (0;1] */
- args[0] = (FT_Fixed)
- ( ( decoder->current_subfont->random & 0xFFFF ) + 1 );
- args++;
-
- decoder->current_subfont->random =
- cff_random( decoder->current_subfont->random );
- break;
-
- case cff_op_mul:
- FT_TRACE4(( " mul\n" ));
-
- args[0] = FT_MulFix( args[0], args[1] );
- args++;
- break;
-
- case cff_op_sqrt:
- FT_TRACE4(( " sqrt\n" ));
-
- if ( args[0] > 0 )
- {
- FT_Fixed root = args[0];
- FT_Fixed new_root;
-
-
- for (;;)
- {
- new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1;
- if ( new_root == root )
- break;
- root = new_root;
- }
- args[0] = new_root;
- }
- else
- args[0] = 0;
- args++;
- break;
-
- case cff_op_drop:
- /* nothing */
- FT_TRACE4(( " drop\n" ));
-
- break;
-
- case cff_op_exch:
- {
- FT_Fixed tmp;
-
-
- FT_TRACE4(( " exch\n" ));
-
- tmp = args[0];
- args[0] = args[1];
- args[1] = tmp;
- args += 2;
- }
- break;
-
- case cff_op_index:
- {
- FT_Int idx = (FT_Int)( args[0] >> 16 );
-
-
- FT_TRACE4(( " index\n" ));
-
- if ( idx < 0 )
- idx = 0;
- else if ( idx > num_args - 2 )
- idx = num_args - 2;
- args[0] = args[-( idx + 1 )];
- args++;
- }
- break;
-
- case cff_op_roll:
- {
- FT_Int count = (FT_Int)( args[0] >> 16 );
- FT_Int idx = (FT_Int)( args[1] >> 16 );
-
-
- FT_TRACE4(( " roll\n" ));
-
- if ( count <= 0 )
- count = 1;
-
- args -= count;
- if ( args < stack )
- goto Stack_Underflow;
-
- if ( idx >= 0 )
- {
- while ( idx > 0 )
- {
- FT_Fixed tmp = args[count - 1];
- FT_Int i;
-
-
- for ( i = count - 2; i >= 0; i-- )
- args[i + 1] = args[i];
- args[0] = tmp;
- idx--;
- }
- }
- else
- {
- while ( idx < 0 )
- {
- FT_Fixed tmp = args[0];
- FT_Int i;
-
-
- for ( i = 0; i < count - 1; i++ )
- args[i] = args[i + 1];
- args[count - 1] = tmp;
- idx++;
- }
- }
- args += count;
- }
- break;
-
- case cff_op_dup:
- FT_TRACE4(( " dup\n" ));
-
- args[1] = args[0];
- args += 2;
- break;
-
- case cff_op_put:
- {
- FT_Fixed val = args[0];
- FT_Int idx = (FT_Int)( args[1] >> 16 );
-
-
- FT_TRACE4(( " put\n" ));
-
- /* the Type2 specification before version 16-March-2000 */
- /* didn't give a hard-coded size limit of the temporary */
- /* storage array; instead, an argument of the */
- /* `MultipleMaster' operator set the size */
- if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
- decoder->buildchar[idx] = val;
- }
- break;
-
- case cff_op_get:
- {
- FT_Int idx = (FT_Int)( args[0] >> 16 );
- FT_Fixed val = 0;
-
-
- FT_TRACE4(( " get\n" ));
-
- if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
- val = decoder->buildchar[idx];
-
- args[0] = val;
- args++;
- }
- break;
-
- case cff_op_store:
- /* this operator was removed from the Type2 specification */
- /* in version 16-March-2000 */
-
- /* since we currently don't handle interpolation of multiple */
- /* master fonts, this is a no-op */
- FT_TRACE4(( " store\n"));
- break;
-
- case cff_op_load:
- /* this operator was removed from the Type2 specification */
- /* in version 16-March-2000 */
- {
- FT_Int reg_idx = (FT_Int)args[0];
- FT_Int idx = (FT_Int)args[1];
- FT_Int count = (FT_Int)args[2];
-
-
- FT_TRACE4(( " load\n" ));
-
- /* since we currently don't handle interpolation of multiple */
- /* master fonts, we store a vector [1 0 0 ...] in the */
- /* temporary storage array regardless of the Registry index */
- if ( reg_idx >= 0 && reg_idx <= 2 &&
- idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS &&
- count >= 0 && count <= num_axes )
- {
- FT_Int end, i;
-
-
- end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS );
-
- if ( idx < end )
- decoder->buildchar[idx] = 1 << 16;
-
- for ( i = idx + 1; i < end; i++ )
- decoder->buildchar[i] = 0;
- }
- }
- break;
-
- case cff_op_blend:
- /* this operator was removed from the Type2 specification */
- /* in version 16-March-2000 */
- {
- FT_Int num_results = (FT_Int)( args[0] >> 16 );
-
-
- FT_TRACE4(( " blend\n" ));
-
- if ( num_results < 0 )
- goto Syntax_Error;
-
- if ( num_results * (FT_Int)num_designs > num_args )
- goto Stack_Underflow;
-
- /* since we currently don't handle interpolation of multiple */
- /* master fonts, return the `num_results' values of the */
- /* first master */
- args -= num_results * ( num_designs - 1 );
- num_args -= num_results * ( num_designs - 1 );
- }
- break;
-
- case cff_op_dotsection:
- /* this operator is deprecated and ignored by the parser */
- FT_TRACE4(( " dotsection\n" ));
- break;
-
- case cff_op_closepath:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " closepath (invalid op)\n" ));
-
- args = stack;
- break;
-
- case cff_op_hsbw:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " hsbw (invalid op)\n" ));
-
- decoder->glyph_width =
- ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) );
-
- decoder->builder.left_bearing.x = args[0];
- decoder->builder.left_bearing.y = 0;
-
- x = ADD_LONG( decoder->builder.pos_x, args[0] );
- y = decoder->builder.pos_y;
- args = stack;
- break;
-
- case cff_op_sbw:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " sbw (invalid op)\n" ));
-
- decoder->glyph_width =
- ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) );
-
- decoder->builder.left_bearing.x = args[0];
- decoder->builder.left_bearing.y = args[1];
-
- x = ADD_LONG( decoder->builder.pos_x, args[0] );
- y = ADD_LONG( decoder->builder.pos_y, args[1] );
- args = stack;
- break;
-
- case cff_op_setcurrentpoint:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " setcurrentpoint (invalid op)\n" ));
-
- x = ADD_LONG( decoder->builder.pos_x, args[0] );
- y = ADD_LONG( decoder->builder.pos_y, args[1] );
- args = stack;
- break;
-
- case cff_op_callothersubr:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " callothersubr (invalid op)\n" ));
-
- /* subsequent `pop' operands should add the arguments, */
- /* this is the implementation described for `unknown' other */
- /* subroutines in the Type1 spec. */
- /* */
- /* XXX Fix return arguments (see discussion below). */
- args -= 2 + ( args[-2] >> 16 );
- if ( args < stack )
- goto Stack_Underflow;
- break;
-
- case cff_op_pop:
- /* this is an invalid Type 2 operator; however, there */
- /* exist fonts which are incorrectly converted from probably */
- /* Type 1 to CFF, and some parsers seem to accept it */
-
- FT_TRACE4(( " pop (invalid op)\n" ));
-
- /* XXX Increasing `args' is wrong: After a certain number of */
- /* `pop's we get a stack overflow. Reason for doing it is */
- /* code like this (actually found in a CFF font): */
- /* */
- /* 17 1 3 callothersubr */
- /* pop */
- /* callsubr */
- /* */
- /* Since we handle `callothersubr' as a no-op, and */
- /* `callsubr' needs at least one argument, `pop' can't be a */
- /* no-op too as it basically should be. */
- /* */
- /* The right solution would be to provide real support for */
- /* `callothersubr' as done in `t1decode.c', however, given */
- /* the fact that CFF fonts with `pop' are invalid, it is */
- /* questionable whether it is worth the time. */
- args++;
- break;
-
- case cff_op_and:
- {
- FT_Fixed cond = ( args[0] && args[1] );
-
-
- FT_TRACE4(( " and\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_or:
- {
- FT_Fixed cond = ( args[0] || args[1] );
-
-
- FT_TRACE4(( " or\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_not:
- {
- FT_Fixed cond = !args[0];
-
-
- FT_TRACE4(( " not\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_eq:
- {
- FT_Fixed cond = ( args[0] == args[1] );
-
-
- FT_TRACE4(( " eq\n" ));
-
- args[0] = cond ? 0x10000L : 0;
- args++;
- }
- break;
-
- case cff_op_ifelse:
- {
- FT_Fixed cond = ( args[2] <= args[3] );
-
-
- FT_TRACE4(( " ifelse\n" ));
-
- if ( !cond )
- args[0] = args[1];
- args++;
- }
- break;
-
- case cff_op_callsubr:
- {
- FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
- decoder->locals_bias );
-
-
- FT_TRACE4(( " callsubr (idx %d, entering level %d)\n",
- idx,
- zone - decoder->zones + 1 ));
-
- if ( idx >= decoder->num_locals )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invalid local subr index\n" ));
- goto Syntax_Error;
- }
-
- if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " too many nested subrs\n" ));
- goto Syntax_Error;
- }
-
- zone->cursor = ip; /* save current instruction pointer */
-
- zone++;
- zone->base = decoder->locals[idx];
- zone->limit = decoder->locals[idx + 1];
- zone->cursor = zone->base;
-
- if ( !zone->base || zone->limit == zone->base )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invoking empty subrs\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone = zone;
- ip = zone->base;
- limit = zone->limit;
- }
- break;
-
- case cff_op_callgsubr:
- {
- FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
- decoder->globals_bias );
-
-
- FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n",
- idx,
- zone - decoder->zones + 1 ));
-
- if ( idx >= decoder->num_globals )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invalid global subr index\n" ));
- goto Syntax_Error;
- }
-
- if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " too many nested subrs\n" ));
- goto Syntax_Error;
- }
-
- zone->cursor = ip; /* save current instruction pointer */
-
- zone++;
- zone->base = decoder->globals[idx];
- zone->limit = decoder->globals[idx + 1];
- zone->cursor = zone->base;
-
- if ( !zone->base || zone->limit == zone->base )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invoking empty subrs\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone = zone;
- ip = zone->base;
- limit = zone->limit;
- }
- break;
-
- case cff_op_return:
- FT_TRACE4(( " return (leaving level %d)\n",
- decoder->zone - decoder->zones ));
-
- if ( decoder->zone <= decoder->zones )
- {
- FT_ERROR(( "cff_decoder_parse_charstrings:"
- " unexpected return\n" ));
- goto Syntax_Error;
- }
-
- decoder->zone--;
- zone = decoder->zone;
- ip = zone->cursor;
- limit = zone->limit;
- break;
-
- default:
- FT_ERROR(( "Unimplemented opcode: %d", ip[-1] ));
-
- if ( ip[-1] == 12 )
- FT_ERROR(( " %d", ip[0] ));
- FT_ERROR(( "\n" ));
-
- return FT_THROW( Unimplemented_Feature );
- }
-
- decoder->top = args;
-
- if ( decoder->top - stack >= CFF_MAX_OPERANDS )
- goto Stack_Overflow;
-
- } /* general operator processing */
-
- } /* while ip < limit */
-
- FT_TRACE4(( "..end..\n\n" ));
-
- Fail:
- return error;
-
- MM_Error:
- FT_TRACE4(( "cff_decoder_parse_charstrings:"
- " invalid opcode found in top DICT charstring\n"));
- return FT_THROW( Invalid_File_Format );
-
- Syntax_Error:
- FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" ));
- return FT_THROW( Invalid_File_Format );
-
- Stack_Underflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" ));
- return FT_THROW( Too_Few_Arguments );
-
- Stack_Overflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" ));
- return FT_THROW( Stack_Overflow );
- }
-
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
-
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -2704,11 +142,14 @@
FT_Int glyph_index;
CFF_Font cff = (CFF_Font)face->other;
+ PSAux_Service psaux = (PSAux_Service)face->psaux;
+ const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs;
+
*max_advance = 0;
/* Initialize load decoder */
- cff_decoder_init( &decoder, face, 0, 0, 0, 0 );
+ decoder_funcs->init( &decoder, face, 0, 0, 0, 0, 0, 0 );
decoder.builder.metrics_only = 1;
decoder.builder.load_points = 0;
@@ -2727,12 +168,12 @@
&charstring, &charstring_len );
if ( !error )
{
- error = cff_decoder_prepare( &decoder, size, glyph_index );
+ error = decoder_funcs->prepare( &decoder, size, glyph_index );
if ( !error )
- error = cff_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len,
- 0 );
+ error = decoder_funcs->parse_charstrings_old( &decoder,
+ charstring,
+ charstring_len,
+ 0 );
cff_free_glyph_data( face, &charstring, &charstring_len );
}
@@ -2758,10 +199,14 @@
{
FT_Error error;
CFF_Decoder decoder;
+ PS_Decoder psdecoder;
TT_Face face = (TT_Face)glyph->root.face;
FT_Bool hinting, scaled, force_scaling;
CFF_Font cff = (CFF_Font)face->extra.data;
+ PSAux_Service psaux = (PSAux_Service)face->psaux;
+ const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs;
+
FT_Matrix font_matrix;
FT_Vector font_offset;
@@ -2951,7 +396,7 @@
{
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face );
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
#endif
@@ -2959,8 +404,10 @@
FT_ULong charstring_len;
- cff_decoder_init( &decoder, face, size, glyph, hinting,
- FT_LOAD_TARGET_MODE( load_flags ) );
+ decoder_funcs->init( &decoder, face, size, glyph, hinting,
+ FT_LOAD_TARGET_MODE( load_flags ),
+ cff_get_glyph_data,
+ cff_free_glyph_data );
/* this is for pure CFFs */
if ( load_flags & FT_LOAD_ADVANCE_ONLY )
@@ -2975,23 +422,25 @@
if ( error )
goto Glyph_Build_Finished;
- error = cff_decoder_prepare( &decoder, size, glyph_index );
+ error = decoder_funcs->prepare( &decoder, size, glyph_index );
if ( error )
goto Glyph_Build_Finished;
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
/* choose which CFF renderer to use */
- if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
- error = cff_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len,
- 0 );
+ if ( driver->hinting_engine == FT_HINTING_FREETYPE )
+ error = decoder_funcs->parse_charstrings_old( &decoder,
+ charstring,
+ charstring_len,
+ 0 );
else
#endif
{
- error = cf2_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len );
+ psaux->ps_decoder_init( &psdecoder, &decoder, FALSE );
+
+ error = decoder_funcs->parse_charstrings( &psdecoder,
+ charstring,
+ charstring_len );
/* Adobe's engine uses 16.16 numbers everywhere; */
/* as a consequence, glyphs larger than 2000ppem get rejected */
@@ -3004,9 +453,9 @@
force_scaling = TRUE;
glyph->hint = hinting;
- error = cf2_decoder_parse_charstrings( &decoder,
- charstring,
- charstring_len );
+ error = decoder_funcs->parse_charstrings( &psdecoder,
+ charstring,
+ charstring_len );
}
}
@@ -3044,7 +493,7 @@
Glyph_Build_Finished:
/* save new glyph tables, if no error */
if ( !error )
- cff_builder_done( &decoder.builder );
+ decoder.builder.funcs.done( &decoder.builder );
/* XXX: anything to do for broken glyph entry? */
}
diff --git a/thirdparty/freetype/src/cff/cffgload.h b/thirdparty/freetype/src/cff/cffgload.h
index 0fa93b4398..803f3974fc 100644
--- a/thirdparty/freetype/src/cff/cffgload.h
+++ b/thirdparty/freetype/src/cff/cffgload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,119 +22,11 @@
#include <ft2build.h>
#include FT_FREETYPE_H
-#include "cffobjs.h"
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
FT_BEGIN_HEADER
-
-#define CFF_MAX_OPERANDS 48
-#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
- /* only 10 are allowed but there exist */
- /* fonts like `HiraKakuProN-W3.ttf' */
- /* (Hiragino Kaku Gothic ProN W3; */
- /* 8.2d6e1; 2014-12-19) that exceed */
- /* this limit */
-#define CFF_MAX_TRANS_ELEMENTS 32
-
-
- /*************************************************************************/
- /* */
- /* <Structure> */
- /* CFF_Builder */
- /* */
- /* <Description> */
- /* A structure used during glyph loading to store its outline. */
- /* */
- /* <Fields> */
- /* memory :: The current memory object. */
- /* */
- /* face :: The current face object. */
- /* */
- /* glyph :: The current glyph slot. */
- /* */
- /* loader :: The current glyph loader. */
- /* */
- /* base :: The base glyph outline. */
- /* */
- /* current :: The current glyph outline. */
- /* */
- /* pos_x :: The horizontal translation (if composite glyph). */
- /* */
- /* pos_y :: The vertical translation (if composite glyph). */
- /* */
- /* left_bearing :: The left side bearing point. */
- /* */
- /* advance :: The horizontal advance vector. */
- /* */
- /* bbox :: Unused. */
- /* */
- /* path_begun :: A flag which indicates that a new path has begun. */
- /* */
- /* load_points :: If this flag is not set, no points are loaded. */
- /* */
- /* no_recurse :: Set but not used. */
- /* */
- /* metrics_only :: A boolean indicating that we only want to compute */
- /* the metrics of a given glyph, not load all of its */
- /* points. */
- /* */
- /* hints_funcs :: Auxiliary pointer for hinting. */
- /* */
- /* hints_globals :: Auxiliary pointer for hinting. */
- /* */
- typedef struct CFF_Builder_
- {
- FT_Memory memory;
- TT_Face face;
- CFF_GlyphSlot glyph;
- FT_GlyphLoader loader;
- FT_Outline* base;
- FT_Outline* current;
-
- FT_Pos pos_x;
- FT_Pos pos_y;
-
- FT_Vector left_bearing;
- FT_Vector advance;
-
- FT_BBox bbox; /* bounding box */
- FT_Bool path_begun;
- FT_Bool load_points;
- FT_Bool no_recurse;
-
- FT_Bool metrics_only;
-
- void* hints_funcs; /* hinter-specific */
- void* hints_globals; /* hinter-specific */
-
- } CFF_Builder;
-
-
- FT_LOCAL( FT_Error )
- cff_check_points( CFF_Builder* builder,
- FT_Int count );
-
- FT_LOCAL( void )
- cff_builder_add_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y,
- FT_Byte flag );
- FT_LOCAL( FT_Error )
- cff_builder_add_point1( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y );
- FT_LOCAL( FT_Error )
- cff_builder_start_point( CFF_Builder* builder,
- FT_Pos x,
- FT_Pos y );
- FT_LOCAL( void )
- cff_builder_close_contour( CFF_Builder* builder );
-
-
- FT_LOCAL( FT_Int )
- cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
- FT_Int charcode );
FT_LOCAL( FT_Error )
cff_get_glyph_data( TT_Face face,
FT_UInt glyph_index,
@@ -146,74 +38,6 @@ FT_BEGIN_HEADER
FT_ULong length );
- /* execution context charstring zone */
-
- typedef struct CFF_Decoder_Zone_
- {
- FT_Byte* base;
- FT_Byte* limit;
- FT_Byte* cursor;
-
- } CFF_Decoder_Zone;
-
-
- typedef struct CFF_Decoder_
- {
- CFF_Builder builder;
- CFF_Font cff;
-
- FT_Fixed stack[CFF_MAX_OPERANDS + 1];
- FT_Fixed* top;
-
- CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
- CFF_Decoder_Zone* zone;
-
- FT_Int flex_state;
- FT_Int num_flex_vectors;
- FT_Vector flex_vectors[7];
-
- FT_Pos glyph_width;
- FT_Pos nominal_width;
-
- FT_Bool read_width;
- FT_Bool width_only;
- FT_Int num_hints;
- FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
-
- FT_UInt num_locals;
- FT_UInt num_globals;
-
- FT_Int locals_bias;
- FT_Int globals_bias;
-
- FT_Byte** locals;
- FT_Byte** globals;
-
- FT_Byte** glyph_names; /* for pure CFF fonts only */
- FT_UInt num_glyphs; /* number of glyphs in font */
-
- FT_Render_Mode hint_mode;
-
- FT_Bool seac;
-
- CFF_SubFont current_subfont; /* for current glyph_index */
-
- } CFF_Decoder;
-
-
- FT_LOCAL( void )
- cff_decoder_init( CFF_Decoder* decoder,
- TT_Face face,
- CFF_Size size,
- CFF_GlyphSlot slot,
- FT_Bool hinting,
- FT_Render_Mode hint_mode );
-
- FT_LOCAL( FT_Error )
- cff_decoder_prepare( CFF_Decoder* decoder,
- CFF_Size size,
- FT_UInt glyph_index );
-
#if 0 /* unused until we support pure CFF fonts */
/* Compute the maximum advance width of a font through quick parsing */
@@ -223,13 +47,6 @@ FT_BEGIN_HEADER
#endif /* 0 */
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- FT_LOCAL( FT_Error )
- cff_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len,
- FT_Bool in_dict );
-#endif
FT_LOCAL( FT_Error )
cff_slot_load( CFF_GlyphSlot glyph,
diff --git a/thirdparty/freetype/src/cff/cffload.c b/thirdparty/freetype/src/cff/cffload.c
index 12420384af..1c6fe51566 100644
--- a/thirdparty/freetype/src/cff/cffload.c
+++ b/thirdparty/freetype/src/cff/cffload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H
#include FT_TYPE1_TABLES_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include FT_MULTIPLE_MASTERS_H
@@ -1297,7 +1298,9 @@
if ( numOperands > count )
{
- FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d args\n", count ));
+ FT_TRACE4(( " cff_blend_doBlend: Stack underflow %d argument%s\n",
+ count,
+ count == 1 ? "" : "s" ));
error = FT_THROW( Stack_Underflow );
goto Exit;
@@ -1345,19 +1348,14 @@
for ( i = 0; i < numBlends; i++ )
{
const FT_Int32* weight = &blend->BV[1];
- FT_Int32 sum;
+ FT_UInt32 sum;
/* convert inputs to 16.16 fixed point */
- sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536;
+ sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000;
for ( j = 1; j < blend->lenBV; j++ )
- sum = ADD_INT32(
- sum,
- FT_MulFix(
- *weight++,
- cff_parse_num( parser,
- &parser->stack[delta++] ) * 65536 ) );
+ sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++;
/* point parser stack to new value on blend_stack */
parser->stack[i + base] = subFont->blend_top;
@@ -1367,10 +1365,10 @@
/* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */
/* decode of this, which rounds to an integer. */
*subFont->blend_top++ = 255;
- *subFont->blend_top++ = ( (FT_UInt32)sum & 0xFF000000U ) >> 24;
- *subFont->blend_top++ = ( (FT_UInt32)sum & 0x00FF0000U ) >> 16;
- *subFont->blend_top++ = ( (FT_UInt32)sum & 0x0000FF00U ) >> 8;
- *subFont->blend_top++ = (FT_UInt32)sum & 0x000000FFU;
+ *subFont->blend_top++ = (FT_Byte)( sum >> 24 );
+ *subFont->blend_top++ = (FT_Byte)( sum >> 16 );
+ *subFont->blend_top++ = (FT_Byte)( sum >> 8 );
+ *subFont->blend_top++ = (FT_Byte)sum;
}
/* leave only numBlends results on parser stack */
@@ -1558,13 +1556,13 @@
FT_UInt lenNDV,
FT_Fixed* NDV )
{
- if ( !blend->builtBV ||
- blend->lastVsindex != vsindex ||
- blend->lenNDV != lenNDV ||
- ( lenNDV &&
- memcmp( NDV,
- blend->lastNDV,
- lenNDV * sizeof ( *NDV ) ) != 0 ) )
+ if ( !blend->builtBV ||
+ blend->lastVsindex != vsindex ||
+ blend->lenNDV != lenNDV ||
+ ( lenNDV &&
+ ft_memcmp( NDV,
+ blend->lastNDV,
+ lenNDV * sizeof ( *NDV ) ) != 0 ) )
{
/* need to build blend vector */
return TRUE;
@@ -1600,7 +1598,8 @@
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
- mm->done_blend( FT_FACE( face ) );
+ if (mm)
+ mm->done_blend( FT_FACE( face ) );
}
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
@@ -1934,6 +1933,24 @@
else if ( priv->initial_random_seed == 0 )
priv->initial_random_seed = 987654321;
+ /* some sanitizing to avoid overflows later on; */
+ /* the upper limits are ad-hoc values */
+ if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
+ {
+ FT_TRACE2(( "cff_load_private_dict:"
+ " setting unlikely BlueShift value %d to default (7)\n",
+ priv->blue_shift ));
+ priv->blue_shift = 7;
+ }
+
+ if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
+ {
+ FT_TRACE2(( "cff_load_private_dict:"
+ " setting unlikely BlueFuzz value %d to default (1)\n",
+ priv->blue_fuzz ));
+ priv->blue_fuzz = 1;
+ }
+
Exit:
/* clean up */
cff_blend_clear( subfont ); /* clear blend stack */
@@ -1945,18 +1962,6 @@
}
- FT_LOCAL_DEF( FT_UInt32 )
- cff_random( FT_UInt32 r )
- {
- /* a 32bit version of the `xorshift' algorithm */
- r ^= r << 13;
- r ^= r >> 17;
- r ^= r << 5;
-
- return r;
- }
-
-
/* There are 3 ways to call this function, distinguished by code. */
/* */
/* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */
@@ -1980,6 +1985,8 @@
CFF_FontRecDict top = &subfont->font_dict;
CFF_Private priv = &subfont->private_dict;
+ PSAux_Service psaux = (PSAux_Service)face->psaux;
+
FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT ||
code == CFF2_CODE_FONTDICT );
FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK
@@ -2085,7 +2092,7 @@
*/
if ( face->root.internal->random_seed == -1 )
{
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face );
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
subfont->random = (FT_UInt32)driver->random_seed;
@@ -2094,7 +2101,7 @@
do
{
driver->random_seed =
- (FT_Int32)cff_random( (FT_UInt32)driver->random_seed );
+ (FT_Int32)psaux->cff_random( (FT_UInt32)driver->random_seed );
} while ( driver->random_seed < 0 );
}
@@ -2107,7 +2114,8 @@
do
{
face->root.internal->random_seed =
- (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed );
+ (FT_Int32)psaux->cff_random(
+ (FT_UInt32)face->root.internal->random_seed );
} while ( face->root.internal->random_seed < 0 );
}
@@ -2548,6 +2556,8 @@
font->cf2_instance.finalizer( font->cf2_instance.data );
FT_FREE( font->cf2_instance.data );
}
+
+ FT_FREE( font->font_extra );
}
diff --git a/thirdparty/freetype/src/cff/cffload.h b/thirdparty/freetype/src/cff/cffload.h
index c745e8127b..14d14e2112 100644
--- a/thirdparty/freetype/src/cff/cffload.h
+++ b/thirdparty/freetype/src/cff/cffload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType & CFF data/program tables loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,9 +21,9 @@
#include <ft2build.h>
-#include "cfftypes.h"
+#include FT_INTERNAL_CFF_TYPES_H
#include "cffparse.h"
-#include "cffobjs.h" /* for CFF_Face */
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */
FT_BEGIN_HEADER
@@ -61,9 +61,6 @@ FT_BEGIN_HEADER
FT_UInt cid );
- FT_LOCAL( FT_UInt32 )
- cff_random( FT_UInt32 r );
-
FT_LOCAL( FT_Error )
cff_font_load( FT_Library library,
FT_Stream stream,
diff --git a/thirdparty/freetype/src/cff/cffobjs.c b/thirdparty/freetype/src/cff/cffobjs.c
index 61613933ff..a2d7aec65e 100644
--- a/thirdparty/freetype/src/cff/cffobjs.c
+++ b/thirdparty/freetype/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
/* */
/* OpenType objects manager (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,13 +25,15 @@
#include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_SFNT_H
-#include FT_CFF_DRIVER_H
+#include FT_DRIVER_H
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include FT_MULTIPLE_MASTERS_H
#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include FT_SERVICE_METRICS_VARIATIONS_H
#endif
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
#include "cffobjs.h"
#include "cffload.h"
#include "cffcmap.h"
@@ -39,6 +41,9 @@
#include "cfferrs.h"
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
+
/*************************************************************************/
/* */
@@ -408,7 +413,7 @@
remove_subset_prefix( FT_String* name )
{
FT_Int32 idx = 0;
- FT_Int32 length = (FT_Int32)strlen( name ) + 1;
+ FT_Int32 length = (FT_Int32)ft_strlen( name ) + 1;
FT_Bool continue_search = 1;
@@ -445,8 +450,8 @@
FT_Int32 family_name_length, style_name_length;
- family_name_length = (FT_Int32)strlen( family_name );
- style_name_length = (FT_Int32)strlen( style_name );
+ family_name_length = (FT_Int32)ft_strlen( family_name );
+ style_name_length = (FT_Int32)ft_strlen( style_name );
if ( family_name_length > style_name_length )
{
@@ -493,14 +498,16 @@
SFNT_Service sfnt;
FT_Service_PsCMaps psnames;
PSHinter_Service pshinter;
+ PSAux_Service psaux;
+ FT_Service_CFFLoad cffload;
FT_Bool pure_cff = 1;
FT_Bool cff2 = 0;
FT_Bool sfnt_format = 0;
FT_Library library = cffface->driver->root.library;
- sfnt = (SFNT_Service)FT_Get_Module_Interface(
- library, "sfnt" );
+ sfnt = (SFNT_Service)FT_Get_Module_Interface( library,
+ "sfnt" );
if ( !sfnt )
{
FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" ));
@@ -510,8 +517,20 @@
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
- pshinter = (PSHinter_Service)FT_Get_Module_Interface(
- library, "pshinter" );
+ pshinter = (PSHinter_Service)FT_Get_Module_Interface( library,
+ "pshinter" );
+
+ psaux = (PSAux_Service)FT_Get_Module_Interface( library,
+ "psaux" );
+ if ( !psaux )
+ {
+ FT_ERROR(( "cff_face_init: cannot access `psaux' module\n" ));
+ error = FT_THROW( Missing_Module );
+ goto Exit;
+ }
+ face->psaux = psaux;
+
+ FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
FT_TRACE2(( "CFF driver\n" ));
@@ -614,6 +633,7 @@
cff->pshinter = pshinter;
cff->psnames = psnames;
+ cff->cffload = cffload;
cffface->face_index = face_index & 0xFFFF;
@@ -690,50 +710,22 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var;
- FT_Int instance_index = face_index >> 16;
+ FT_UInt instance_index = (FT_UInt)face_index >> 16;
if ( FT_HAS_MULTIPLE_MASTERS( cffface ) &&
mm &&
instance_index > 0 )
{
- FT_MM_Var* mm_var;
-
-
- error = mm->get_mm_var( cffface, NULL );
+ error = mm->set_instance( cffface, instance_index );
if ( error )
goto Exit;
- mm->get_var_blend( cffface, NULL, NULL, NULL, &mm_var );
-
- if ( mm_var->namedstyle )
- {
- FT_Var_Named_Style* named_style;
- FT_String* style_name;
-
-
- /* in `face_index', the instance index starts with value 1 */
- named_style = mm_var->namedstyle + instance_index - 1;
- error = sfnt->get_name( face,
- (FT_UShort)named_style->strid,
- &style_name );
- if ( error )
- goto Exit;
-
- /* set style name; if already set, replace it */
- if ( face->root.style_name )
- FT_FREE( face->root.style_name );
- face->root.style_name = style_name;
-
- /* finally, select the named instance */
- error = mm->set_var_design( cffface,
- mm_var->num_axis,
- named_style->coords );
- if ( error )
- goto Exit;
- }
+ if ( var )
+ var->metrics_adjust( cffface );
}
}
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
@@ -876,7 +868,8 @@
cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 );
if ( cffface->height < cffface->ascender - cffface->descender )
- cffface->height = (FT_Short)( cffface->ascender - cffface->descender );
+ cffface->height = (FT_Short)( cffface->ascender -
+ cffface->descender );
cffface->underline_position =
(FT_Short)( dict->underline_position >> 16 );
@@ -884,27 +877,32 @@
(FT_Short)( dict->underline_thickness >> 16 );
/* retrieve font family & style name */
- cffface->family_name = cff_index_get_name(
- cff,
- (FT_UInt)( face_index & 0xFFFF ) );
+ if ( dict->family_name )
+ {
+ char* family_name;
+
+
+ family_name = cff_index_get_sid_string( cff, dict->family_name );
+ if ( family_name )
+ cffface->family_name = cff_strcpy( memory, family_name );
+ }
+
+ if ( !cffface->family_name )
+ {
+ cffface->family_name = cff_index_get_name(
+ cff,
+ (FT_UInt)( face_index & 0xFFFF ) );
+ if ( cffface->family_name )
+ remove_subset_prefix( cffface->family_name );
+ }
+
if ( cffface->family_name )
{
char* full = cff_index_get_sid_string( cff,
dict->full_name );
char* fullp = full;
char* family = cffface->family_name;
- char* family_name = NULL;
-
- remove_subset_prefix( cffface->family_name );
-
- if ( dict->family_name )
- {
- family_name = cff_index_get_sid_string( cff,
- dict->family_name );
- if ( family_name )
- family = family_name;
- }
/* We try to extract the style name from the full name. */
/* We need to ignore spaces and dashes during the search. */
@@ -1159,16 +1157,16 @@
FT_LOCAL_DEF( FT_Error )
cff_driver_init( FT_Module module ) /* CFF_Driver */
{
- CFF_Driver driver = (CFF_Driver)module;
+ PS_Driver driver = (PS_Driver)module;
FT_UInt32 seed;
/* set default property values, cf. `ftcffdrv.h' */
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- driver->hinting_engine = FT_CFF_HINTING_FREETYPE;
+ driver->hinting_engine = FT_HINTING_FREETYPE;
#else
- driver->hinting_engine = FT_CFF_HINTING_ADOBE;
+ driver->hinting_engine = FT_HINTING_ADOBE;
#endif
driver->no_stem_darkening = TRUE;
diff --git a/thirdparty/freetype/src/cff/cffobjs.h b/thirdparty/freetype/src/cff/cffobjs.h
index 1dba694c53..616a25b3b5 100644
--- a/thirdparty/freetype/src/cff/cffobjs.h
+++ b/thirdparty/freetype/src/cff/cffobjs.h
@@ -4,7 +4,7 @@
/* */
/* OpenType objects manager (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,111 +21,11 @@
#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include "cfftypes.h"
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
FT_BEGIN_HEADER
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_Driver */
- /* */
- /* <Description> */
- /* A handle to an OpenType driver object. */
- /* */
- typedef struct CFF_DriverRec_* CFF_Driver;
-
- typedef TT_Face CFF_Face;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_Size */
- /* */
- /* <Description> */
- /* A handle to an OpenType size object. */
- /* */
- typedef struct CFF_SizeRec_
- {
- FT_SizeRec root;
- FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
-
- } CFF_SizeRec, *CFF_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to an OpenType glyph slot object. */
- /* */
- typedef struct CFF_GlyphSlotRec_
- {
- FT_GlyphSlotRec root;
-
- FT_Bool hint;
- FT_Bool scaled;
-
- FT_Fixed x_scale;
- FT_Fixed y_scale;
-
- } CFF_GlyphSlotRec, *CFF_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CFF_Internal */
- /* */
- /* <Description> */
- /* The interface to the `internal' field of `FT_Size'. */
- /* */
- typedef struct CFF_InternalRec_
- {
- PSH_Globals topfont;
- PSH_Globals subfonts[CFF_MAX_CID_FONTS];
-
- } CFF_InternalRec, *CFF_Internal;
-
-
- /*************************************************************************/
- /* */
- /* Subglyph transformation record. */
- /* */
- typedef struct CFF_Transform_
- {
- FT_Fixed xx, xy; /* transformation matrix coefficients */
- FT_Fixed yx, yy;
- FT_F26Dot6 ox, oy; /* offsets */
-
- } CFF_Transform;
-
-
- /***********************************************************************/
- /* */
- /* CFF driver class. */
- /* */
- typedef struct CFF_DriverRec_
- {
- FT_DriverRec root;
-
- FT_UInt hinting_engine;
- FT_Bool no_stem_darkening;
- FT_Int darken_params[8];
- FT_Int32 random_seed;
-
- } CFF_DriverRec;
-
-
FT_LOCAL( FT_Error )
cff_size_init( FT_Size size ); /* CFF_Size */
@@ -171,10 +71,10 @@ FT_BEGIN_HEADER
/* Driver functions */
/* */
FT_LOCAL( FT_Error )
- cff_driver_init( FT_Module module ); /* CFF_Driver */
+ cff_driver_init( FT_Module module ); /* PS_Driver */
FT_LOCAL( void )
- cff_driver_done( FT_Module module ); /* CFF_Driver */
+ cff_driver_done( FT_Module module ); /* PS_Driver */
FT_END_HEADER
diff --git a/thirdparty/freetype/src/cff/cffparse.c b/thirdparty/freetype/src/cff/cffparse.c
index 9d7bf6d22c..b9611cf548 100644
--- a/thirdparty/freetype/src/cff/cffparse.c
+++ b/thirdparty/freetype/src/cff/cffparse.c
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (body) */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,10 +21,10 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include "cfferrs.h"
#include "cffpic.h"
-#include "cffgload.h"
#include "cffload.h"
@@ -949,7 +949,9 @@
goto Exit;
}
- FT_TRACE4(( " %d values blended\n", numBlends ));
+ FT_TRACE4(( " %d value%s blended\n",
+ numBlends,
+ numBlends == 1 ? "" : "s" ));
error = cff_blend_doBlend( subFont, parser, numBlends );
@@ -1299,9 +1301,14 @@
FT_Byte* start,
FT_Byte* limit )
{
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ PSAux_Service psaux;
+#endif
+
FT_Byte* p = start;
FT_Error error = FT_Err_Ok;
FT_Library library = parser->library;
+
FT_UNUSED( library );
@@ -1388,10 +1395,16 @@
cff_rec.top_font.font_dict.num_axes = parser->num_axes;
decoder.cff = &cff_rec;
- error = cff_decoder_parse_charstrings( &decoder,
- charstring_base,
- charstring_len,
- 1 );
+ psaux = (PSAux_Service)FT_Get_Module_Interface( library, "psaux" );
+ if ( !psaux )
+ {
+ FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" ));
+ error = FT_THROW( Missing_Module );
+ goto Exit;
+ }
+
+ error = psaux->cff_decoder_funcs->parse_charstrings_old(
+ &decoder, charstring_base, charstring_len, 1 );
/* Now copy the stack data in the temporary decoder object, */
/* converting it back to charstring number representations */
diff --git a/thirdparty/freetype/src/cff/cffparse.h b/thirdparty/freetype/src/cff/cffparse.h
index 83d1bba45f..8a8caeca44 100644
--- a/thirdparty/freetype/src/cff/cffparse.h
+++ b/thirdparty/freetype/src/cff/cffparse.h
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (specification) */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,7 +21,7 @@
#include <ft2build.h>
-#include "cfftypes.h"
+#include FT_INTERNAL_CFF_TYPES_H
#include FT_INTERNAL_OBJECTS_H
diff --git a/thirdparty/freetype/src/cff/cffpic.c b/thirdparty/freetype/src/cff/cffpic.c
index 4e9ba12b3f..08b74c7cf2 100644
--- a/thirdparty/freetype/src/cff/cffpic.c
+++ b/thirdparty/freetype/src/cff/cffpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for cff module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cff/cffpic.h b/thirdparty/freetype/src/cff/cffpic.h
index 5db39cd627..8ba4203a8d 100644
--- a/thirdparty/freetype/src/cff/cffpic.h
+++ b/thirdparty/freetype/src/cff/cffpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for cff module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,7 +22,6 @@
#include FT_INTERNAL_PIC_H
-
#ifndef FT_CONFIG_OPTION_PIC
#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info
@@ -34,6 +33,7 @@
#define CFF_SERVICES_GET cff_services
#define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters
#define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations
+#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load
#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
#define CFF_FIELD_HANDLERS_GET cff_field_handlers
@@ -65,6 +65,7 @@ FT_BEGIN_HEADER
FT_Service_PropertiesRec cff_service_properties;
FT_Service_MultiMastersRec cff_service_multi_masters;
FT_Service_MetricsVariationsRec cff_service_metrics_variations;
+ FT_Service_CFFLoadRec cff_service_cff_load;
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
@@ -92,6 +93,8 @@ FT_BEGIN_HEADER
( GET_PIC( library )->cff_service_multi_masters )
#define CFF_SERVICE_METRICS_VAR_GET \
( GET_PIC( library )->cff_service_metrics_variations )
+#define CFF_SERVICE_CFF_LOAD_GET \
+ ( GET_PIC( library )->cff_service_cff_load )
#define CFF_CMAP_ENCODING_CLASS_REC_GET \
( GET_PIC( library )->cff_cmap_encoding_class_rec )
#define CFF_CMAP_UNICODE_CLASS_REC_GET \
diff --git a/thirdparty/freetype/src/cff/cfftoken.h b/thirdparty/freetype/src/cff/cfftoken.h
index 3222e933f1..fec1ca20bd 100644
--- a/thirdparty/freetype/src/cff/cfftoken.h
+++ b/thirdparty/freetype/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
/* */
/* CFF token definitions (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cff/module.mk b/thirdparty/freetype/src/cff/module.mk
index 2975aeed8c..8013d5dcab 100644
--- a/thirdparty/freetype/src/cff/module.mk
+++ b/thirdparty/freetype/src/cff/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/cff/rules.mk b/thirdparty/freetype/src/cff/rules.mk
index 86840bfe3c..bce672927e 100644
--- a/thirdparty/freetype/src/cff/rules.mk
+++ b/thirdparty/freetype/src/cff/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -32,27 +32,14 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \
$(CFF_DIR)/cffload.c \
$(CFF_DIR)/cffobjs.c \
$(CFF_DIR)/cffparse.c \
- $(CFF_DIR)/cffpic.c \
- $(CFF_DIR)/cf2arrst.c \
- $(CFF_DIR)/cf2blues.c \
- $(CFF_DIR)/cf2error.c \
- $(CFF_DIR)/cf2font.c \
- $(CFF_DIR)/cf2ft.c \
- $(CFF_DIR)/cf2hints.c \
- $(CFF_DIR)/cf2intrp.c \
- $(CFF_DIR)/cf2read.c \
- $(CFF_DIR)/cf2stack.c
+ $(CFF_DIR)/cffpic.c
# CFF driver headers
#
CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
$(CFF_DIR)/cfferrs.h \
- $(CFF_DIR)/cfftoken.h \
- $(CFF_DIR)/cfftypes.h \
- $(CFF_DIR)/cf2fixed.h \
- $(CFF_DIR)/cf2glue.h \
- $(CFF_DIR)/cf2types.h
+ $(CFF_DIR)/cfftoken.h
# CFF driver object(s)
diff --git a/thirdparty/freetype/src/cid/ciderrs.h b/thirdparty/freetype/src/cid/ciderrs.h
index 709dc8cd1e..a5a86e3fc6 100644
--- a/thirdparty/freetype/src/cid/ciderrs.h
+++ b/thirdparty/freetype/src/cid/ciderrs.h
@@ -4,7 +4,7 @@
/* */
/* CID error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidgload.c b/thirdparty/freetype/src/cid/cidgload.c
index b96c33334d..d14f9a2cc9 100644
--- a/thirdparty/freetype/src/cid/cidgload.c
+++ b/thirdparty/freetype/src/cid/cidgload.c
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 Glyph Loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,6 +24,10 @@
#include FT_OUTLINE_H
#include FT_INTERNAL_CALC_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_CFF_TYPES_H
+#include FT_DRIVER_H
+
#include "ciderrs.h"
@@ -52,9 +56,11 @@
FT_ULong glyph_length = 0;
PSAux_Service psaux = (PSAux_Service)face->psaux;
+ FT_Bool force_scaling = FALSE;
+
#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_Incremental_InterfaceRec *inc =
- face->root.internal->incremental_interface;
+ FT_Incremental_InterfaceRec *inc =
+ face->root.internal->incremental_interface;
#endif
@@ -169,9 +175,57 @@
if ( decoder->lenIV >= 0 )
psaux->t1_decrypt( charstring, glyph_length, 4330 );
- error = decoder->funcs.parse_charstrings(
- decoder, charstring + cs_offset,
- glyph_length - cs_offset );
+ /* choose which renderer to use */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine ==
+ FT_HINTING_FREETYPE ||
+ decoder->builder.metrics_only )
+ error = psaux->t1_decoder_funcs->parse_charstrings_old(
+ decoder,
+ charstring + cs_offset,
+ glyph_length - cs_offset );
+#else
+ if ( decoder->builder.metrics_only )
+ error = psaux->t1_decoder_funcs->parse_metrics(
+ decoder,
+ charstring + cs_offset,
+ glyph_length - cs_offset );
+#endif
+ else
+ {
+ PS_Decoder psdecoder;
+ CFF_SubFontRec subfont;
+
+
+ psaux->ps_decoder_init( &psdecoder, decoder, TRUE );
+
+ psaux->t1_make_subfont( FT_FACE( face ),
+ &dict->private_dict,
+ &subfont );
+ psdecoder.current_subfont = &subfont;
+
+ error = psaux->t1_decoder_funcs->parse_charstrings(
+ &psdecoder,
+ charstring + cs_offset,
+ glyph_length - cs_offset );
+
+ /* Adobe's engine uses 16.16 numbers everywhere; */
+ /* as a consequence, glyphs larger than 2000ppem get rejected */
+ if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
+ {
+ /* this time, we retry unhinted and scale up the glyph later on */
+ /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
+ /* 0x400 for both `x_scale' and `y_scale' in this case) */
+ ((CID_GlyphSlot)decoder->builder.glyph)->hint = FALSE;
+
+ force_scaling = TRUE;
+
+ error = psaux->t1_decoder_funcs->parse_charstrings(
+ &psdecoder,
+ charstring + cs_offset,
+ glyph_length - cs_offset );
+ }
+ }
}
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -200,6 +254,8 @@
Exit:
FT_FREE( charstring );
+ ((CID_GlyphSlot)decoder->builder.glyph)->scaled = force_scaling;
+
return error;
}
@@ -288,10 +344,12 @@
T1_DecoderRec decoder;
CID_Face face = (CID_Face)cidglyph->face;
FT_Bool hinting;
+ FT_Bool scaled;
PSAux_Service psaux = (PSAux_Service)face->psaux;
FT_Matrix font_matrix;
FT_Vector font_offset;
+ FT_Bool must_finish_decoder = FALSE;
if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
@@ -311,7 +369,10 @@
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
+ scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
+ glyph->hint = hinting;
+ glyph->scaled = scaled;
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
error = psaux->t1_decoder_funcs->init( &decoder,
@@ -329,6 +390,8 @@
/* TODO: initialize decoder.len_buildchar and decoder.buildchar */
/* if we ever support CID-keyed multiple master fonts */
+ must_finish_decoder = TRUE;
+
/* set up the decoder */
decoder.builder.no_recurse = FT_BOOL(
( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
@@ -337,12 +400,18 @@
if ( error )
goto Exit;
+ /* copy flags back for forced scaling */
+ hinting = glyph->hint;
+ scaled = glyph->scaled;
+
font_matrix = decoder.font_matrix;
font_offset = decoder.font_offset;
/* save new glyph tables */
psaux->t1_decoder_funcs->done( &decoder );
+ must_finish_decoder = FALSE;
+
/* now set the metrics -- this is rather simple, as */
/* the left side bearing is the xMin, and the top side */
/* bearing the yMax */
@@ -410,7 +479,7 @@
metrics->vertAdvance += font_offset.y;
}
- if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
+ if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || scaled )
{
/* scale the outline and the metrics */
FT_Int n;
@@ -451,6 +520,10 @@
}
Exit:
+
+ if ( must_finish_decoder )
+ psaux->t1_decoder_funcs->done( &decoder );
+
return error;
}
diff --git a/thirdparty/freetype/src/cid/cidgload.h b/thirdparty/freetype/src/cid/cidgload.h
index 7f816b5bc7..4811852ae4 100644
--- a/thirdparty/freetype/src/cid/cidgload.h
+++ b/thirdparty/freetype/src/cid/cidgload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidload.c b/thirdparty/freetype/src/cid/cidload.c
index ff0722110d..27cd09b3c3 100644
--- a/thirdparty/freetype/src/cid/cidload.c
+++ b/thirdparty/freetype/src/cid/cidload.c
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 font loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidload.h b/thirdparty/freetype/src/cid/cidload.h
index 45a0e6df25..3f8bd08620 100644
--- a/thirdparty/freetype/src/cid/cidload.h
+++ b/thirdparty/freetype/src/cid/cidload.h
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 font loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidobjs.c b/thirdparty/freetype/src/cid/cidobjs.c
index ceda8ff97f..77afe1c875 100644
--- a/thirdparty/freetype/src/cid/cidobjs.c
+++ b/thirdparty/freetype/src/cid/cidobjs.c
@@ -4,7 +4,7 @@
/* */
/* CID objects manager (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -26,6 +26,7 @@
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include FT_DRIVER_H
#include "ciderrs.h"
@@ -463,9 +464,42 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
- cid_driver_init( FT_Module driver )
+ cid_driver_init( FT_Module module )
{
- FT_UNUSED( driver );
+ PS_Driver driver = (PS_Driver)module;
+
+ FT_UInt32 seed;
+
+
+ /* set default property values, cf. `ftt1drv.h' */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ driver->hinting_engine = FT_HINTING_FREETYPE;
+#else
+ driver->hinting_engine = FT_HINTING_ADOBE;
+#endif
+
+ driver->no_stem_darkening = TRUE;
+
+ driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
+ driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
+ driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
+ driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
+ driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
+ driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
+ driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
+ driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
+
+ /* compute random seed from some memory addresses */
+ seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
+ (FT_Offset)(char*)&module ^
+ (FT_Offset)(char*)module->memory );
+ seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
+
+ driver->random_seed = (FT_Int32)seed;
+ if ( driver->random_seed < 0 )
+ driver->random_seed = -driver->random_seed;
+ else if ( driver->random_seed == 0 )
+ driver->random_seed = 123456789;
return FT_Err_Ok;
}
diff --git a/thirdparty/freetype/src/cid/cidobjs.h b/thirdparty/freetype/src/cid/cidobjs.h
index 8bcf886e10..0221f017dd 100644
--- a/thirdparty/freetype/src/cid/cidobjs.h
+++ b/thirdparty/freetype/src/cid/cidobjs.h
@@ -4,7 +4,7 @@
/* */
/* CID objects manager (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidparse.c b/thirdparty/freetype/src/cid/cidparse.c
index 007609bbdf..b1c7f3cb2c 100644
--- a/thirdparty/freetype/src/cid/cidparse.c
+++ b/thirdparty/freetype/src/cid/cidparse.c
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 parser (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidparse.h b/thirdparty/freetype/src/cid/cidparse.h
index 20bebb942b..61602f7674 100644
--- a/thirdparty/freetype/src/cid/cidparse.h
+++ b/thirdparty/freetype/src/cid/cidparse.h
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 parser (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidriver.c b/thirdparty/freetype/src/cid/cidriver.c
index bb611a961e..d9faf353ea 100644
--- a/thirdparty/freetype/src/cid/cidriver.c
+++ b/thirdparty/freetype/src/cid/cidriver.c
@@ -4,7 +4,7 @@
/* */
/* CID driver interface (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,6 +20,7 @@
#include "cidriver.h"
#include "cidgload.h"
#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_POSTSCRIPT_PROPS_H
#include "ciderrs.h"
@@ -27,6 +28,10 @@
#include FT_SERVICE_FONT_FORMAT_H
#include FT_SERVICE_POSTSCRIPT_INFO_H
#include FT_SERVICE_CID_H
+#include FT_SERVICE_PROPERTIES_H
+#include FT_DRIVER_H
+
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
/*************************************************************************/
@@ -168,6 +173,18 @@
/*
+ * PROPERTY SERVICE
+ *
+ */
+
+ FT_DEFINE_SERVICE_PROPERTIESREC(
+ cid_service_properties,
+
+ (FT_Properties_SetFunc)ps_property_set, /* set_property */
+ (FT_Properties_GetFunc)ps_property_get ) /* get_property */
+
+
+ /*
* SERVICE LIST
*
*/
@@ -178,6 +195,7 @@
{ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
{ FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info },
{ FT_SERVICE_ID_CID, &cid_service_cid_info },
+ { FT_SERVICE_ID_PROPERTIES, &cid_service_properties },
{ NULL, NULL }
};
@@ -200,7 +218,7 @@
FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_SCALABLE |
FT_MODULE_DRIVER_HAS_HINTER,
- sizeof ( FT_DriverRec ),
+ sizeof ( PS_DriverRec ),
"t1cid", /* module name */
0x10000L, /* version 1.0 of driver */
diff --git a/thirdparty/freetype/src/cid/cidriver.h b/thirdparty/freetype/src/cid/cidriver.h
index 76640c57ba..59d9ded901 100644
--- a/thirdparty/freetype/src/cid/cidriver.h
+++ b/thirdparty/freetype/src/cid/cidriver.h
@@ -4,7 +4,7 @@
/* */
/* High-level CID driver interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/cidtoken.h b/thirdparty/freetype/src/cid/cidtoken.h
index 653cc5586e..b0e2dac6aa 100644
--- a/thirdparty/freetype/src/cid/cidtoken.h
+++ b/thirdparty/freetype/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
/* */
/* CID token definitions (specification only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/cid/module.mk b/thirdparty/freetype/src/cid/module.mk
index b30b8679b9..9010e339a4 100644
--- a/thirdparty/freetype/src/cid/module.mk
+++ b/thirdparty/freetype/src/cid/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/cid/rules.mk b/thirdparty/freetype/src/cid/rules.mk
index fcddd92eca..94333bda06 100644
--- a/thirdparty/freetype/src/cid/rules.mk
+++ b/thirdparty/freetype/src/cid/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/cid/type1cid.c b/thirdparty/freetype/src/cid/type1cid.c
index 93e6f810db..61770e3f1e 100644
--- a/thirdparty/freetype/src/cid/type1cid.c
+++ b/thirdparty/freetype/src/cid/type1cid.c
@@ -4,7 +4,7 @@
/* */
/* FreeType OpenType driver component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/gxvalid/README b/thirdparty/freetype/src/gxvalid/README
index 200f66cb12..af8128e0e7 100644
--- a/thirdparty/freetype/src/gxvalid/README
+++ b/thirdparty/freetype/src/gxvalid/README
@@ -287,11 +287,11 @@ gxvalid: TrueType GX validator
4-5. invalid feature number (117/183)
-------------------------------------
- The GX/AAT extension can include 255 different layout features, but
- popular layout features are predefined (see
- http://developer.apple.com/fonts/Registry/index.html). Some fonts
- include feature numbers which are incompatible with the predefined
- feature registry.
+ The GX/AAT extension can include 255 different layout features,
+ but popular layout features are predefined (see
+ https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html).
+ Some fonts include feature numbers which are incompatible with the
+ predefined feature registry.
In our survey, there are 140 fonts including `feat' table.
@@ -518,7 +518,7 @@ gxvalid: TrueType GX validator
------------------------------------------------------------------------
-Copyright 2004-2017 by
+Copyright 2004-2018 by
suzuki toshiya, Masatake YAMATO, Red hat K.K.,
David Turner, Robert Wilhelm, and Werner Lemberg.
diff --git a/thirdparty/freetype/src/gxvalid/gxvalid.c b/thirdparty/freetype/src/gxvalid/gxvalid.c
index da485141d3..d0577a247e 100644
--- a/thirdparty/freetype/src/gxvalid/gxvalid.c
+++ b/thirdparty/freetype/src/gxvalid/gxvalid.c
@@ -4,7 +4,7 @@
/* */
/* FreeType validator for TrueTypeGX/AAT tables (body only). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvalid.h b/thirdparty/freetype/src/gxvalid/gxvalid.h
index 78116ef85a..19f0379982 100644
--- a/thirdparty/freetype/src/gxvalid/gxvalid.h
+++ b/thirdparty/freetype/src/gxvalid/gxvalid.h
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT table validation (specification only). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvbsln.c b/thirdparty/freetype/src/gxvalid/gxvbsln.c
index 81dff7304d..c367d38483 100644
--- a/thirdparty/freetype/src/gxvalid/gxvbsln.c
+++ b/thirdparty/freetype/src/gxvalid/gxvbsln.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT bsln table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvcommn.c b/thirdparty/freetype/src/gxvalid/gxvcommn.c
index db0a91ea74..b96601108b 100644
--- a/thirdparty/freetype/src/gxvalid/gxvcommn.c
+++ b/thirdparty/freetype/src/gxvalid/gxvcommn.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT common tables validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvcommn.h b/thirdparty/freetype/src/gxvalid/gxvcommn.h
index 10b1c800f0..8e4ff9cafc 100644
--- a/thirdparty/freetype/src/gxvalid/gxvcommn.h
+++ b/thirdparty/freetype/src/gxvalid/gxvcommn.h
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT common tables validation (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxverror.h b/thirdparty/freetype/src/gxvalid/gxverror.h
index 80a2b8a262..d1151258a9 100644
--- a/thirdparty/freetype/src/gxvalid/gxverror.h
+++ b/thirdparty/freetype/src/gxvalid/gxverror.h
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT validation module error codes (specification only). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvfeat.c b/thirdparty/freetype/src/gxvalid/gxvfeat.c
index 2e3ec6f9be..2c805d1d11 100644
--- a/thirdparty/freetype/src/gxvalid/gxvfeat.c
+++ b/thirdparty/freetype/src/gxvalid/gxvfeat.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT feat table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvfeat.h b/thirdparty/freetype/src/gxvalid/gxvfeat.h
index 8c0e847eb7..2d943806c1 100644
--- a/thirdparty/freetype/src/gxvalid/gxvfeat.h
+++ b/thirdparty/freetype/src/gxvalid/gxvfeat.h
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT feat table validation (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvfgen.c b/thirdparty/freetype/src/gxvalid/gxvfgen.c
index 8cc08cd9c3..840c0f3524 100644
--- a/thirdparty/freetype/src/gxvalid/gxvfgen.c
+++ b/thirdparty/freetype/src/gxvalid/gxvfgen.c
@@ -5,7 +5,7 @@
/* Generate feature registry data for gxv `feat' validator. */
/* This program is derived from gxfeatreg.c in gxlayout. */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* This file may only be used, */
@@ -21,7 +21,7 @@
/* gxfeatreg.c */
/* */
/* Database of font features pre-defined by Apple Computer, Inc. */
-/* http://developer.apple.com/fonts/Registry/ */
+/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html */
/* (body). */
/* */
/* Copyright 2003 by */
diff --git a/thirdparty/freetype/src/gxvalid/gxvjust.c b/thirdparty/freetype/src/gxvalid/gxvjust.c
index c8cfd83eac..00c4293195 100644
--- a/thirdparty/freetype/src/gxvalid/gxvjust.c
+++ b/thirdparty/freetype/src/gxvalid/gxvjust.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT just table validation (body). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvkern.c b/thirdparty/freetype/src/gxvalid/gxvkern.c
index 9f9037387d..9c0efd7a4f 100644
--- a/thirdparty/freetype/src/gxvalid/gxvkern.c
+++ b/thirdparty/freetype/src/gxvalid/gxvkern.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT kern table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvlcar.c b/thirdparty/freetype/src/gxvalid/gxvlcar.c
index 775d5229f2..0f261a9ace 100644
--- a/thirdparty/freetype/src/gxvalid/gxvlcar.c
+++ b/thirdparty/freetype/src/gxvalid/gxvlcar.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT lcar table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmod.c b/thirdparty/freetype/src/gxvalid/gxvmod.c
index 84e9275baf..1a3c862927 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmod.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType's TrueTypeGX/AAT validation module implementation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmod.h b/thirdparty/freetype/src/gxvalid/gxvmod.h
index df25e60cb2..745c62e105 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmod.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmod.h
@@ -5,7 +5,7 @@
/* FreeType's TrueTypeGX/AAT validation module implementation */
/* (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort.c b/thirdparty/freetype/src/gxvalid/gxvmort.c
index 184a6317c0..b361cb2b9d 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT mort table validation (body). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort.h b/thirdparty/freetype/src/gxvalid/gxvmort.h
index d0543adcc5..d8030645e9 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmort.h
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT common definition for mort table (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort0.c b/thirdparty/freetype/src/gxvalid/gxvmort0.c
index a75fad7768..95cf53d5eb 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort0.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort0.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT mort table validation */
/* body for type0 (Indic Script Rearrangement) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort1.c b/thirdparty/freetype/src/gxvalid/gxvmort1.c
index 361ef2262d..a7683a17b0 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort1.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort1.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT mort table validation */
/* body for type1 (Contextual Substitution) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort2.c b/thirdparty/freetype/src/gxvalid/gxvmort2.c
index c17e51e323..c23c2775a1 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort2.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort2.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT mort table validation */
/* body for type2 (Ligature Substitution) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort4.c b/thirdparty/freetype/src/gxvalid/gxvmort4.c
index 041bab369f..9d21a5fc29 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort4.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort4.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT mort table validation */
/* body for type4 (Non-Contextual Glyph Substitution) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort5.c b/thirdparty/freetype/src/gxvalid/gxvmort5.c
index 4751eceaa0..42cb428aa8 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort5.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmort5.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT mort table validation */
/* body for type5 (Contextual Glyph Insertion) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx.c b/thirdparty/freetype/src/gxvalid/gxvmorx.c
index 2bb4f3b8b1..9fd6e6b971 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT morx table validation (body). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx.h b/thirdparty/freetype/src/gxvalid/gxvmorx.h
index 20cec58672..6d9925e92b 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx.h
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT common definition for morx table (specification). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx0.c b/thirdparty/freetype/src/gxvalid/gxvmorx0.c
index e0a0a92438..302261b7fa 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx0.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx0.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT morx table validation */
/* body for type0 (Indic Script Rearrangement) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx1.c b/thirdparty/freetype/src/gxvalid/gxvmorx1.c
index 9afebdbfa8..890ca74b1d 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx1.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx1.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT morx table validation */
/* body for type1 (Contextual Substitution) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx2.c b/thirdparty/freetype/src/gxvalid/gxvmorx2.c
index 3a60cf68a4..3135031d45 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx2.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx2.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT morx table validation */
/* body for type2 (Ligature Substitution) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx4.c b/thirdparty/freetype/src/gxvalid/gxvmorx4.c
index 29555685af..1e2397b0c5 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx4.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx4.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT morx table validation */
/* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx5.c b/thirdparty/freetype/src/gxvalid/gxvmorx5.c
index 05c11417ef..db4f9290c8 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx5.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx5.c
@@ -5,7 +5,7 @@
/* TrueTypeGX/AAT morx table validation */
/* body for type5 (Contextual Glyph Insertion) subtable. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvopbd.c b/thirdparty/freetype/src/gxvalid/gxvopbd.c
index 11580d8b2a..e2c167ea59 100644
--- a/thirdparty/freetype/src/gxvalid/gxvopbd.c
+++ b/thirdparty/freetype/src/gxvalid/gxvopbd.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT opbd table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvprop.c b/thirdparty/freetype/src/gxvalid/gxvprop.c
index 7d398b7e66..a67b6bdd00 100644
--- a/thirdparty/freetype/src/gxvalid/gxvprop.c
+++ b/thirdparty/freetype/src/gxvalid/gxvprop.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT prop table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/gxvtrak.c b/thirdparty/freetype/src/gxvalid/gxvtrak.c
index dd49825565..d501b5014b 100644
--- a/thirdparty/freetype/src/gxvalid/gxvtrak.c
+++ b/thirdparty/freetype/src/gxvalid/gxvtrak.c
@@ -4,7 +4,7 @@
/* */
/* TrueTypeGX/AAT trak table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
diff --git a/thirdparty/freetype/src/gxvalid/module.mk b/thirdparty/freetype/src/gxvalid/module.mk
index 7f87e10812..b64879dcee 100644
--- a/thirdparty/freetype/src/gxvalid/module.mk
+++ b/thirdparty/freetype/src/gxvalid/module.mk
@@ -2,7 +2,7 @@
# FreeType 2 gxvalid module definition
#
-# Copyright 2004-2017 by
+# Copyright 2004-2018 by
# suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
diff --git a/thirdparty/freetype/src/gxvalid/rules.mk b/thirdparty/freetype/src/gxvalid/rules.mk
index 10ec08c5b0..3a17c030a6 100644
--- a/thirdparty/freetype/src/gxvalid/rules.mk
+++ b/thirdparty/freetype/src/gxvalid/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2004-2017 by
+# Copyright 2004-2018 by
# suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
diff --git a/thirdparty/freetype/src/gzip/ftgzip.c b/thirdparty/freetype/src/gzip/ftgzip.c
index c487786d99..f8011c2dd8 100644
--- a/thirdparty/freetype/src/gzip/ftgzip.c
+++ b/thirdparty/freetype/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/gzip/rules.mk b/thirdparty/freetype/src/gzip/rules.mk
index bc7d5fa631..1a2e48bebd 100644
--- a/thirdparty/freetype/src/gzip/rules.mk
+++ b/thirdparty/freetype/src/gzip/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2002-2017 by
+# Copyright 2002-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/lzw/ftlzw.c b/thirdparty/freetype/src/lzw/ftlzw.c
index 941f6cef4c..cb46f93c68 100644
--- a/thirdparty/freetype/src/lzw/ftlzw.c
+++ b/thirdparty/freetype/src/lzw/ftlzw.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* Albert Chin-A-Young. */
/* */
/* based on code in `src/gzip/ftgzip.c' */
diff --git a/thirdparty/freetype/src/lzw/ftzopen.c b/thirdparty/freetype/src/lzw/ftzopen.c
index 486c546c14..2b868ba9f2 100644
--- a/thirdparty/freetype/src/lzw/ftzopen.c
+++ b/thirdparty/freetype/src/lzw/ftzopen.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/lzw/ftzopen.h b/thirdparty/freetype/src/lzw/ftzopen.h
index a108862c0a..4fd267eb90 100644
--- a/thirdparty/freetype/src/lzw/ftzopen.h
+++ b/thirdparty/freetype/src/lzw/ftzopen.h
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/lzw/rules.mk b/thirdparty/freetype/src/lzw/rules.mk
index e7bf68a065..18933c41c2 100644
--- a/thirdparty/freetype/src/lzw/rules.mk
+++ b/thirdparty/freetype/src/lzw/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2004-2017 by
+# Copyright 2004-2018 by
# Albert Chin-A-Young.
#
# based on `src/lzw/rules.mk'
diff --git a/thirdparty/freetype/src/otvalid/module.mk b/thirdparty/freetype/src/otvalid/module.mk
index 5ee1265db8..34f3dab32f 100644
--- a/thirdparty/freetype/src/otvalid/module.mk
+++ b/thirdparty/freetype/src/otvalid/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2004-2017 by
+# Copyright 2004-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/otvalid/otvalid.c b/thirdparty/freetype/src/otvalid/otvalid.c
index 312751a1f4..4423ca1012 100644
--- a/thirdparty/freetype/src/otvalid/otvalid.c
+++ b/thirdparty/freetype/src/otvalid/otvalid.c
@@ -4,7 +4,7 @@
/* */
/* FreeType validator for OpenType tables (body only). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/otvalid.h b/thirdparty/freetype/src/otvalid/otvalid.h
index f2969ccccc..d7801abae5 100644
--- a/thirdparty/freetype/src/otvalid/otvalid.h
+++ b/thirdparty/freetype/src/otvalid/otvalid.h
@@ -4,7 +4,7 @@
/* */
/* OpenType table validation (specification only). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/otvbase.c b/thirdparty/freetype/src/otvalid/otvbase.c
index 3adad8439c..a01d45c707 100644
--- a/thirdparty/freetype/src/otvalid/otvbase.c
+++ b/thirdparty/freetype/src/otvalid/otvbase.c
@@ -4,7 +4,7 @@
/* */
/* OpenType BASE table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -284,22 +284,41 @@
OTV_Validator otvalid = &otvalidrec;
FT_Bytes p = table;
FT_UInt table_size;
+ FT_UShort version;
OTV_OPTIONAL_TABLE( HorizAxis );
OTV_OPTIONAL_TABLE( VertAxis );
+ OTV_OPTIONAL_TABLE32( itemVarStore );
+
otvalid->root = ftvalid;
FT_TRACE3(( "validating BASE table\n" ));
OTV_INIT;
- OTV_LIMIT_CHECK( 6 );
+ OTV_LIMIT_CHECK( 4 );
- if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
+ if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
FT_INVALID_FORMAT;
- table_size = 6;
+ version = FT_NEXT_USHORT( p ); /* minorVersion */
+
+ table_size = 8;
+ switch ( version )
+ {
+ case 0:
+ OTV_LIMIT_CHECK( 4 );
+ break;
+
+ case 1:
+ OTV_LIMIT_CHECK( 8 );
+ table_size += 4;
+ break;
+
+ default:
+ FT_INVALID_FORMAT;
+ }
OTV_OPTIONAL_OFFSET( HorizAxis );
OTV_SIZE_CHECK( HorizAxis );
@@ -311,6 +330,14 @@
if ( VertAxis )
otv_Axis_validate( table + VertAxis, otvalid );
+ if ( version > 0 )
+ {
+ OTV_OPTIONAL_OFFSET32( itemVarStore );
+ OTV_SIZE_CHECK32( itemVarStore );
+ if ( itemVarStore )
+ OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */
+ }
+
FT_TRACE4(( "\n" ));
}
diff --git a/thirdparty/freetype/src/otvalid/otvcommn.c b/thirdparty/freetype/src/otvalid/otvcommn.c
index 3407d2ad4a..0ccfb03c08 100644
--- a/thirdparty/freetype/src/otvalid/otvcommn.c
+++ b/thirdparty/freetype/src/otvalid/otvcommn.c
@@ -4,7 +4,7 @@
/* */
/* OpenType common tables validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -313,19 +313,26 @@
OTV_NAME_ENTER( "Device" );
- OTV_LIMIT_CHECK( 8 );
+ OTV_LIMIT_CHECK( 6 );
StartSize = FT_NEXT_USHORT( p );
EndSize = FT_NEXT_USHORT( p );
DeltaFormat = FT_NEXT_USHORT( p );
- if ( DeltaFormat < 1 || DeltaFormat > 3 )
- FT_INVALID_FORMAT;
+ if ( DeltaFormat == 0x8000U )
+ {
+ /* VariationIndex, nothing to do */
+ }
+ else
+ {
+ if ( DeltaFormat < 1 || DeltaFormat > 3 )
+ FT_INVALID_FORMAT;
- if ( EndSize < StartSize )
- FT_INVALID_DATA;
+ if ( EndSize < StartSize )
+ FT_INVALID_DATA;
- count = EndSize - StartSize + 1;
- OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */
+ count = EndSize - StartSize + 1;
+ OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */
+ }
OTV_EXIT;
}
@@ -347,7 +354,7 @@
OTV_Validator otvalid )
{
FT_Bytes p = table;
- FT_UInt LookupType, SubTableCount;
+ FT_UInt LookupType, LookupFlag, SubTableCount;
OTV_Validate_Func validate;
@@ -355,7 +362,7 @@
OTV_LIMIT_CHECK( 6 );
LookupType = FT_NEXT_USHORT( p );
- p += 2; /* skip LookupFlag */
+ LookupFlag = FT_NEXT_USHORT( p );
SubTableCount = FT_NEXT_USHORT( p );
OTV_TRACE(( " (type %d)\n", LookupType ));
@@ -373,6 +380,9 @@
for ( ; SubTableCount > 0; SubTableCount-- )
validate( table + FT_NEXT_USHORT( p ), otvalid );
+ if ( LookupFlag & 0x10 )
+ OTV_LIMIT_CHECK( 2 ); /* MarkFilteringSet */
+
OTV_EXIT;
}
diff --git a/thirdparty/freetype/src/otvalid/otvcommn.h b/thirdparty/freetype/src/otvalid/otvcommn.h
index 10a603ebb9..a392784cf1 100644
--- a/thirdparty/freetype/src/otvalid/otvcommn.h
+++ b/thirdparty/freetype/src/otvalid/otvcommn.h
@@ -4,7 +4,7 @@
/* */
/* OpenType common tables validation (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -67,29 +67,38 @@ FT_BEGIN_HEADER
#undef FT_INVALID_
-#define FT_INVALID_( _error ) \
+#define FT_INVALID_( _error ) \
ft_validator_error( otvalid->root, FT_THROW( _error ) )
#define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \
FT_Bytes _table ## _p
+#define OTV_OPTIONAL_TABLE32( _table ) FT_ULong _table; \
+ FT_Bytes _table ## _p
+
#define OTV_OPTIONAL_OFFSET( _offset ) \
FT_BEGIN_STMNT \
_offset ## _p = p; \
_offset = FT_NEXT_USHORT( p ); \
FT_END_STMNT
-#define OTV_LIMIT_CHECK( _count ) \
- FT_BEGIN_STMNT \
+#define OTV_OPTIONAL_OFFSET32( _offset ) \
+ FT_BEGIN_STMNT \
+ _offset ## _p = p; \
+ _offset = FT_NEXT_ULONG( p ); \
+ FT_END_STMNT
+
+#define OTV_LIMIT_CHECK( _count ) \
+ FT_BEGIN_STMNT \
if ( p + (_count) > otvalid->root->limit ) \
- FT_INVALID_TOO_SHORT; \
+ FT_INVALID_TOO_SHORT; \
FT_END_STMNT
#define OTV_SIZE_CHECK( _size ) \
FT_BEGIN_STMNT \
if ( _size > 0 && _size < table_size ) \
{ \
- if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \
+ if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \
FT_INVALID_OFFSET; \
else \
{ \
@@ -102,12 +111,33 @@ FT_BEGIN_HEADER
" set to zero.\n" \
"\n", #_size )); \
\
- /* always assume 16bit entities */ \
_size = pp[0] = pp[1] = 0; \
} \
} \
FT_END_STMNT
+#define OTV_SIZE_CHECK32( _size ) \
+ FT_BEGIN_STMNT \
+ if ( _size > 0 && _size < table_size ) \
+ { \
+ if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \
+ FT_INVALID_OFFSET; \
+ else \
+ { \
+ /* strip off `const' */ \
+ FT_Byte* pp = (FT_Byte*)_size ## _p; \
+ \
+ \
+ FT_TRACE3(( "\n" \
+ "Invalid offset to optional table `%s'" \
+ " set to zero.\n" \
+ "\n", #_size )); \
+ \
+ _size = pp[0] = pp[1] = pp[2] = pp[3] = 0; \
+ } \
+ } \
+ FT_END_STMNT
+
#define OTV_NAME_(x) #x
#define OTV_NAME(x) OTV_NAME_(x)
@@ -146,11 +176,11 @@ FT_BEGIN_HEADER
#define OTV_INIT otvalid->debug_indent = 0
-#define OTV_ENTER \
- FT_BEGIN_STMNT \
- otvalid->debug_indent += 2; \
- FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \
- FT_TRACE4(( "%s table\n", \
+#define OTV_ENTER \
+ FT_BEGIN_STMNT \
+ otvalid->debug_indent += 2; \
+ FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \
+ FT_TRACE4(( "%s table\n", \
otvalid->debug_function_name[otvalid->nesting_level] )); \
FT_END_STMNT
diff --git a/thirdparty/freetype/src/otvalid/otverror.h b/thirdparty/freetype/src/otvalid/otverror.h
index 699903987c..2fcf42e387 100644
--- a/thirdparty/freetype/src/otvalid/otverror.h
+++ b/thirdparty/freetype/src/otvalid/otverror.h
@@ -4,7 +4,7 @@
/* */
/* OpenType validation module error codes (specification only). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/otvgdef.c b/thirdparty/freetype/src/otvalid/otvgdef.c
index 27b9a69ca8..08f3171541 100644
--- a/thirdparty/freetype/src/otvalid/otvgdef.c
+++ b/thirdparty/freetype/src/otvalid/otvgdef.c
@@ -4,7 +4,7 @@
/* */
/* OpenType GDEF table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -68,7 +68,7 @@
OTV_LIMIT_CHECK( GlyphCount * 2 );
otvalid->nesting_level++;
- func = otvalid->func[otvalid->nesting_level];
+ func = otvalid->func[otvalid->nesting_level];
otvalid->extra1 = 0;
for ( ; GlyphCount > 0; GlyphCount-- )
@@ -136,6 +136,40 @@
/*************************************************************************/
/*************************************************************************/
/***** *****/
+ /***** MARK GLYPH SETS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ static void
+ otv_MarkGlyphSets_validate( FT_Bytes table,
+ OTV_Validator otvalid )
+ {
+ FT_Bytes p = table;
+ FT_UInt MarkGlyphSetCount;
+
+
+ OTV_NAME_ENTER( "MarkGlyphSets" );
+
+ p += 2; /* skip Format */
+
+ OTV_LIMIT_CHECK( 2 );
+ MarkGlyphSetCount = FT_NEXT_USHORT( p );
+
+ OTV_TRACE(( " (MarkGlyphSetCount = %d)\n", MarkGlyphSetCount ));
+
+ OTV_LIMIT_CHECK( MarkGlyphSetCount * 4 ); /* CoverageOffsets */
+
+ for ( ; MarkGlyphSetCount > 0; MarkGlyphSetCount-- )
+ otv_Coverage_validate( table + FT_NEXT_ULONG( p ), otvalid, -1 );
+
+ OTV_EXIT;
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
/***** GDEF TABLE *****/
/***** *****/
/*************************************************************************/
@@ -152,14 +186,18 @@
{
OTV_ValidatorRec otvalidrec;
OTV_Validator otvalid = &otvalidrec;
- FT_Bytes p = table;
+ FT_Bytes p = table;
FT_UInt table_size;
- FT_Bool need_MarkAttachClassDef;
+ FT_UShort version;
+ FT_Bool need_MarkAttachClassDef = 1;
OTV_OPTIONAL_TABLE( GlyphClassDef );
OTV_OPTIONAL_TABLE( AttachListOffset );
OTV_OPTIONAL_TABLE( LigCaretListOffset );
OTV_OPTIONAL_TABLE( MarkAttachClassDef );
+ OTV_OPTIONAL_TABLE( MarkGlyphSetsDef );
+
+ OTV_OPTIONAL_TABLE32( itemVarStore );
otvalid->root = ftvalid;
@@ -167,24 +205,49 @@
FT_TRACE3(( "validating GDEF table\n" ));
OTV_INIT;
- OTV_LIMIT_CHECK( 12 );
+ OTV_LIMIT_CHECK( 4 );
- if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
+ if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
FT_INVALID_FORMAT;
- /* MarkAttachClassDef has been added to the OpenType */
- /* specification without increasing GDEF's version, */
- /* so we use this ugly hack to find out whether the */
- /* table is needed actually. */
+ version = FT_NEXT_USHORT( p ); /* minorVersion */
- need_MarkAttachClassDef = FT_BOOL(
- otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) ||
- otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) );
+ table_size = 10;
+ switch ( version )
+ {
+ case 0:
+ /* MarkAttachClassDef has been added to the OpenType */
+ /* specification without increasing GDEF's version, */
+ /* so we use this ugly hack to find out whether the */
+ /* table is needed actually. */
+
+ need_MarkAttachClassDef = FT_BOOL(
+ otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) ||
+ otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) );
+
+ if ( need_MarkAttachClassDef )
+ {
+ OTV_LIMIT_CHECK( 8 );
+ table_size += 2;
+ }
+ else
+ OTV_LIMIT_CHECK( 6 ); /* OpenType < 1.2 */
- if ( need_MarkAttachClassDef )
- table_size = 12; /* OpenType >= 1.2 */
- else
- table_size = 10; /* OpenType < 1.2 */
+ break;
+
+ case 2:
+ OTV_LIMIT_CHECK( 10 );
+ table_size += 4;
+ break;
+
+ case 3:
+ OTV_LIMIT_CHECK( 14 );
+ table_size += 8;
+ break;
+
+ default:
+ FT_INVALID_FORMAT;
+ }
otvalid->glyph_count = glyph_count;
@@ -217,6 +280,22 @@
otv_ClassDef_validate( table + MarkAttachClassDef, otvalid );
}
+ if ( version > 0 )
+ {
+ OTV_OPTIONAL_OFFSET( MarkGlyphSetsDef );
+ OTV_SIZE_CHECK( MarkGlyphSetsDef );
+ if ( MarkGlyphSetsDef )
+ otv_MarkGlyphSets_validate( table + MarkGlyphSetsDef, otvalid );
+ }
+
+ if ( version > 2 )
+ {
+ OTV_OPTIONAL_OFFSET32( itemVarStore );
+ OTV_SIZE_CHECK32( itemVarStore );
+ if ( itemVarStore )
+ OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */
+ }
+
FT_TRACE4(( "\n" ));
}
diff --git a/thirdparty/freetype/src/otvalid/otvgpos.c b/thirdparty/freetype/src/otvalid/otvgpos.c
index 0fbcc2077c..696b35cae6 100644
--- a/thirdparty/freetype/src/otvalid/otvgpos.c
+++ b/thirdparty/freetype/src/otvalid/otvgpos.c
@@ -4,7 +4,7 @@
/* */
/* OpenType GPOS table validation (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -130,7 +130,7 @@
otv_MarkArray_validate( table + Array1, otvalid );
otvalid->nesting_level++;
- func = otvalid->func[otvalid->nesting_level];
+ func = otvalid->func[otvalid->nesting_level];
otvalid->extra1 = ClassCount;
func( table + Array2, otvalid );
@@ -218,10 +218,6 @@
OTV_LIMIT_CHECK( 2 );
OTV_OPTIONAL_OFFSET( device );
- /* XXX: this value is usually too small, especially if the current */
- /* ValueRecord is part of an array -- getting the correct table */
- /* size is probably not worth the trouble */
-
table_size = p - otvalid->extra3;
OTV_SIZE_CHECK( device );
@@ -271,7 +267,7 @@
case 3:
{
- FT_UInt table_size;
+ FT_UInt table_size;
OTV_OPTIONAL_TABLE( XDeviceTable );
OTV_OPTIONAL_TABLE( YDeviceTable );
@@ -426,6 +422,8 @@
/*************************************************************************/
/*************************************************************************/
+ /* sets otvalid->extra3 (pointer to base table) */
+
static void
otv_PairSet_validate( FT_Bytes table,
FT_UInt format1,
@@ -438,6 +436,8 @@
OTV_NAME_ENTER( "PairSet" );
+ otvalid->extra3 = table;
+
OTV_LIMIT_CHECK( 2 );
PairValueCount = FT_NEXT_USHORT( p );
@@ -483,8 +483,6 @@
OTV_TRACE(( " (format %d)\n", PosFormat ));
- otvalid->extra3 = table;
-
switch ( PosFormat )
{
case 1: /* PairPosFormat1 */
@@ -537,7 +535,9 @@
otv_ClassDef_validate( table + ClassDef2, otvalid );
OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 *
- ( len_value1 + len_value2 ) );
+ ( len_value1 + len_value2 ) );
+
+ otvalid->extra3 = table;
/* Class1Record */
for ( ; ClassCount1 > 0; ClassCount1-- )
@@ -985,20 +985,42 @@
{
OTV_ValidatorRec validrec;
OTV_Validator otvalid = &validrec;
- FT_Bytes p = table;
+ FT_Bytes p = table;
+ FT_UInt table_size;
+ FT_UShort version;
FT_UInt ScriptList, FeatureList, LookupList;
+ OTV_OPTIONAL_TABLE32( featureVariations );
+
otvalid->root = ftvalid;
FT_TRACE3(( "validating GPOS table\n" ));
OTV_INIT;
- OTV_LIMIT_CHECK( 10 );
+ OTV_LIMIT_CHECK( 4 );
- if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
+ if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
FT_INVALID_FORMAT;
+ version = FT_NEXT_USHORT( p ); /* minorVersion */
+
+ table_size = 10;
+ switch ( version )
+ {
+ case 0:
+ OTV_LIMIT_CHECK( 6 );
+ break;
+
+ case 1:
+ OTV_LIMIT_CHECK( 10 );
+ table_size += 4;
+ break;
+
+ default:
+ FT_INVALID_FORMAT;
+ }
+
ScriptList = FT_NEXT_USHORT( p );
FeatureList = FT_NEXT_USHORT( p );
LookupList = FT_NEXT_USHORT( p );
@@ -1014,6 +1036,14 @@
otv_ScriptList_validate( table + ScriptList, table + FeatureList,
otvalid );
+ if ( version > 0 )
+ {
+ OTV_OPTIONAL_OFFSET32( featureVariations );
+ OTV_SIZE_CHECK32( featureVariations );
+ if ( featureVariations )
+ OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */
+ }
+
FT_TRACE4(( "\n" ));
}
diff --git a/thirdparty/freetype/src/otvalid/otvgpos.h b/thirdparty/freetype/src/otvalid/otvgpos.h
index 99b0ad3915..95f9ac3ee8 100644
--- a/thirdparty/freetype/src/otvalid/otvgpos.h
+++ b/thirdparty/freetype/src/otvalid/otvgpos.h
@@ -4,7 +4,7 @@
/* */
/* OpenType GPOS table validator (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/otvgsub.c b/thirdparty/freetype/src/otvalid/otvgsub.c
index f9bd8dc5d8..d35ea67f30 100644
--- a/thirdparty/freetype/src/otvalid/otvgsub.c
+++ b/thirdparty/freetype/src/otvalid/otvgsub.c
@@ -4,7 +4,7 @@
/* */
/* OpenType GSUB table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -552,18 +552,40 @@
OTV_ValidatorRec otvalidrec;
OTV_Validator otvalid = &otvalidrec;
FT_Bytes p = table;
+ FT_UInt table_size;
+ FT_UShort version;
FT_UInt ScriptList, FeatureList, LookupList;
+ OTV_OPTIONAL_TABLE32( featureVariations );
+
otvalid->root = ftvalid;
FT_TRACE3(( "validating GSUB table\n" ));
OTV_INIT;
- OTV_LIMIT_CHECK( 10 );
+ OTV_LIMIT_CHECK( 4 );
+
+ if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
+ FT_INVALID_FORMAT;
+
+ version = FT_NEXT_USHORT( p ); /* minorVersion */
+
+ table_size = 10;
+ switch ( version )
+ {
+ case 0:
+ OTV_LIMIT_CHECK( 6 );
+ break;
+
+ case 1:
+ OTV_LIMIT_CHECK( 10 );
+ table_size += 4;
+ break;
- if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
+ default:
FT_INVALID_FORMAT;
+ }
ScriptList = FT_NEXT_USHORT( p );
FeatureList = FT_NEXT_USHORT( p );
@@ -580,6 +602,14 @@
otv_ScriptList_validate( table + ScriptList, table + FeatureList,
otvalid );
+ if ( version > 0 )
+ {
+ OTV_OPTIONAL_OFFSET32( featureVariations );
+ OTV_SIZE_CHECK32( featureVariations );
+ if ( featureVariations )
+ OTV_TRACE(( " [omitting featureVariations validation]\n" )); /* XXX */
+ }
+
FT_TRACE4(( "\n" ));
}
diff --git a/thirdparty/freetype/src/otvalid/otvjstf.c b/thirdparty/freetype/src/otvalid/otvjstf.c
index 57a38f95c9..94d4af90f6 100644
--- a/thirdparty/freetype/src/otvalid/otvjstf.c
+++ b/thirdparty/freetype/src/otvalid/otvjstf.c
@@ -4,7 +4,7 @@
/* */
/* OpenType JSTF table validation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/otvmath.c b/thirdparty/freetype/src/otvalid/otvmath.c
index a14d369700..b9800f60a2 100644
--- a/thirdparty/freetype/src/otvalid/otvmath.c
+++ b/thirdparty/freetype/src/otvalid/otvmath.c
@@ -4,7 +4,7 @@
/* */
/* OpenType MATH table validation (body). */
/* */
-/* Copyright 2007-2017 by */
+/* Copyright 2007-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* Written by George Williams. */
diff --git a/thirdparty/freetype/src/otvalid/otvmod.c b/thirdparty/freetype/src/otvalid/otvmod.c
index 35ffc43d3a..89ee449d16 100644
--- a/thirdparty/freetype/src/otvalid/otvmod.c
+++ b/thirdparty/freetype/src/otvalid/otvmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType's OpenType validation module implementation (body). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/otvmod.h b/thirdparty/freetype/src/otvalid/otvmod.h
index 30d401ddca..6917bccee5 100644
--- a/thirdparty/freetype/src/otvalid/otvmod.h
+++ b/thirdparty/freetype/src/otvalid/otvmod.h
@@ -5,7 +5,7 @@
/* FreeType's OpenType validation module implementation */
/* (specification). */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/otvalid/rules.mk b/thirdparty/freetype/src/otvalid/rules.mk
index 10329a96ea..d4fc723740 100644
--- a/thirdparty/freetype/src/otvalid/rules.mk
+++ b/thirdparty/freetype/src/otvalid/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2004-2017 by
+# Copyright 2004-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/pcf/pcfdrivr.c b/thirdparty/freetype/src/pcf/pcfdrivr.c
index 169f75e950..0119d94853 100644
--- a/thirdparty/freetype/src/pcf/pcfdrivr.c
+++ b/thirdparty/freetype/src/pcf/pcfdrivr.c
@@ -50,7 +50,7 @@ THE SOFTWARE.
#include FT_SERVICE_BDF_H
#include FT_SERVICE_FONT_FORMAT_H
#include FT_SERVICE_PROPERTIES_H
-#include FT_PCF_DRIVER_H
+#include FT_DRIVER_H
/*************************************************************************/
diff --git a/thirdparty/freetype/src/pcf/pcfread.c b/thirdparty/freetype/src/pcf/pcfread.c
index da216b05f4..537da0dc79 100644
--- a/thirdparty/freetype/src/pcf/pcfread.c
+++ b/thirdparty/freetype/src/pcf/pcfread.c
@@ -840,7 +840,7 @@ THE SOFTWARE.
FT_TRACE4(( "pcf_get_bitmaps:\n"
" format: 0x%lX\n"
" (%s, %s,\n"
- " padding=%d bits, scanning=%d bits)\n",
+ " padding=%d bit%s, scanning=%d bit%s)\n",
format,
PCF_BYTE_ORDER( format ) == MSBFirst
? "most significant byte first"
@@ -849,7 +849,9 @@ THE SOFTWARE.
? "most significant bit first"
: "least significant bit first",
8 << PCF_GLYPH_PAD_INDEX( format ),
- 8 << PCF_SCAN_UNIT_INDEX( format ) ));
+ ( 8 << PCF_GLYPH_PAD_INDEX( format ) ) == 1 ? "" : "s",
+ 8 << PCF_SCAN_UNIT_INDEX( format ),
+ ( 8 << PCF_SCAN_UNIT_INDEX( format ) ) == 1 ? "" : "s" ));
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
return FT_THROW( Invalid_File_Format );
diff --git a/thirdparty/freetype/src/pfr/module.mk b/thirdparty/freetype/src/pfr/module.mk
index 7b84da9708..27fec8e5f6 100644
--- a/thirdparty/freetype/src/pfr/module.mk
+++ b/thirdparty/freetype/src/pfr/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2002-2017 by
+# Copyright 2002-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/pfr/pfr.c b/thirdparty/freetype/src/pfr/pfr.c
index 4f31f5d9bc..1760882fcd 100644
--- a/thirdparty/freetype/src/pfr/pfr.c
+++ b/thirdparty/freetype/src/pfr/pfr.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR driver component. */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrcmap.c b/thirdparty/freetype/src/pfr/pfrcmap.c
index 1d6b15be48..60643780a1 100644
--- a/thirdparty/freetype/src/pfr/pfrcmap.c
+++ b/thirdparty/freetype/src/pfr/pfrcmap.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR cmap handling (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrcmap.h b/thirdparty/freetype/src/pfr/pfrcmap.h
index 957bf65b4c..c70a0c83c5 100644
--- a/thirdparty/freetype/src/pfr/pfrcmap.h
+++ b/thirdparty/freetype/src/pfr/pfrcmap.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR cmap handling (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrdrivr.c b/thirdparty/freetype/src/pfr/pfrdrivr.c
index 195cdb76ac..6c7e50128a 100644
--- a/thirdparty/freetype/src/pfr/pfrdrivr.c
+++ b/thirdparty/freetype/src/pfr/pfrdrivr.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR driver interface (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrdrivr.h b/thirdparty/freetype/src/pfr/pfrdrivr.h
index b81d56017e..cab852789b 100644
--- a/thirdparty/freetype/src/pfr/pfrdrivr.h
+++ b/thirdparty/freetype/src/pfr/pfrdrivr.h
@@ -4,7 +4,7 @@
/* */
/* High-level Type PFR driver interface (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrerror.h b/thirdparty/freetype/src/pfr/pfrerror.h
index ef044e32c9..7027c818e8 100644
--- a/thirdparty/freetype/src/pfr/pfrerror.h
+++ b/thirdparty/freetype/src/pfr/pfrerror.h
@@ -4,7 +4,7 @@
/* */
/* PFR error codes (specification only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrgload.c b/thirdparty/freetype/src/pfr/pfrgload.c
index 93f5fc7090..b7990196b6 100644
--- a/thirdparty/freetype/src/pfr/pfrgload.c
+++ b/thirdparty/freetype/src/pfr/pfrgload.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR glyph loader (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -756,8 +756,10 @@
count = glyph->num_subs - old_count;
- FT_TRACE4(( "compound glyph with %d elements (offset %lu):\n",
- count, offset ));
+ FT_TRACE4(( "compound glyph with %d element%s (offset %lu):\n",
+ count,
+ count == 1 ? "" : "s",
+ offset ));
/* now, load each individual glyph */
for ( n = 0; n < count; n++ )
@@ -810,7 +812,9 @@
/* proceed to next sub-glyph */
}
- FT_TRACE4(( "end compound glyph with %d elements\n", count ));
+ FT_TRACE4(( "end compound glyph with %d element%s\n",
+ count,
+ count == 1 ? "" : "s" ));
}
else
{
diff --git a/thirdparty/freetype/src/pfr/pfrgload.h b/thirdparty/freetype/src/pfr/pfrgload.h
index 6612323871..01f48d7706 100644
--- a/thirdparty/freetype/src/pfr/pfrgload.h
+++ b/thirdparty/freetype/src/pfr/pfrgload.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR glyph loader (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrload.c b/thirdparty/freetype/src/pfr/pfrload.c
index 4f84165828..2776da462a 100644
--- a/thirdparty/freetype/src/pfr/pfrload.c
+++ b/thirdparty/freetype/src/pfr/pfrload.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR loader (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrload.h b/thirdparty/freetype/src/pfr/pfrload.h
index f9475ae062..36e809a762 100644
--- a/thirdparty/freetype/src/pfr/pfrload.h
+++ b/thirdparty/freetype/src/pfr/pfrload.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR loader (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrobjs.c b/thirdparty/freetype/src/pfr/pfrobjs.c
index 514af8050d..737b97b5ff 100644
--- a/thirdparty/freetype/src/pfr/pfrobjs.c
+++ b/thirdparty/freetype/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR object methods (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrobjs.h b/thirdparty/freetype/src/pfr/pfrobjs.h
index d6ad6562df..59c709f58d 100644
--- a/thirdparty/freetype/src/pfr/pfrobjs.h
+++ b/thirdparty/freetype/src/pfr/pfrobjs.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR object methods (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrsbit.c b/thirdparty/freetype/src/pfr/pfrsbit.c
index 54e7d0e6cc..ba909ddca7 100644
--- a/thirdparty/freetype/src/pfr/pfrsbit.c
+++ b/thirdparty/freetype/src/pfr/pfrsbit.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR bitmap loader (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrsbit.h b/thirdparty/freetype/src/pfr/pfrsbit.h
index fc270f50a8..07b27bc06c 100644
--- a/thirdparty/freetype/src/pfr/pfrsbit.h
+++ b/thirdparty/freetype/src/pfr/pfrsbit.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR bitmap loader (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/pfrtypes.h b/thirdparty/freetype/src/pfr/pfrtypes.h
index c3d542c209..058d6aadc9 100644
--- a/thirdparty/freetype/src/pfr/pfrtypes.h
+++ b/thirdparty/freetype/src/pfr/pfrtypes.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR data structures (specification only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pfr/rules.mk b/thirdparty/freetype/src/pfr/rules.mk
index 9940f62286..3acb795696 100644
--- a/thirdparty/freetype/src/pfr/rules.mk
+++ b/thirdparty/freetype/src/pfr/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2002-2017 by
+# Copyright 2002-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/psaux/afmparse.c b/thirdparty/freetype/src/psaux/afmparse.c
index ff2cc8cf08..0c33d5949b 100644
--- a/thirdparty/freetype/src/psaux/afmparse.c
+++ b/thirdparty/freetype/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
/* */
/* AFM parser (body). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/afmparse.h b/thirdparty/freetype/src/psaux/afmparse.h
index cd2beb7804..86f852a247 100644
--- a/thirdparty/freetype/src/psaux/afmparse.h
+++ b/thirdparty/freetype/src/psaux/afmparse.h
@@ -4,7 +4,7 @@
/* */
/* AFM parser (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/cffdecode.c b/thirdparty/freetype/src/psaux/cffdecode.c
new file mode 100644
index 0000000000..80d622c0e1
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/cffdecode.c
@@ -0,0 +1,2370 @@
+/***************************************************************************/
+/* */
+/* cffdecode.c */
+/* */
+/* PostScript CFF (Type 2) decoding routines (body). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
+
+#include "cffdecode.h"
+#include "psobjs.h"
+
+#include "psauxerr.h"
+
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_cffdecode
+
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+
+ typedef enum CFF_Operator_
+ {
+ cff_op_unknown = 0,
+
+ cff_op_rmoveto,
+ cff_op_hmoveto,
+ cff_op_vmoveto,
+
+ cff_op_rlineto,
+ cff_op_hlineto,
+ cff_op_vlineto,
+
+ cff_op_rrcurveto,
+ cff_op_hhcurveto,
+ cff_op_hvcurveto,
+ cff_op_rcurveline,
+ cff_op_rlinecurve,
+ cff_op_vhcurveto,
+ cff_op_vvcurveto,
+
+ cff_op_flex,
+ cff_op_hflex,
+ cff_op_hflex1,
+ cff_op_flex1,
+
+ cff_op_endchar,
+
+ cff_op_hstem,
+ cff_op_vstem,
+ cff_op_hstemhm,
+ cff_op_vstemhm,
+
+ cff_op_hintmask,
+ cff_op_cntrmask,
+ cff_op_dotsection, /* deprecated, acts as no-op */
+
+ cff_op_abs,
+ cff_op_add,
+ cff_op_sub,
+ cff_op_div,
+ cff_op_neg,
+ cff_op_random,
+ cff_op_mul,
+ cff_op_sqrt,
+
+ cff_op_blend,
+
+ cff_op_drop,
+ cff_op_exch,
+ cff_op_index,
+ cff_op_roll,
+ cff_op_dup,
+
+ cff_op_put,
+ cff_op_get,
+ cff_op_store,
+ cff_op_load,
+
+ cff_op_and,
+ cff_op_or,
+ cff_op_not,
+ cff_op_eq,
+ cff_op_ifelse,
+
+ cff_op_callsubr,
+ cff_op_callgsubr,
+ cff_op_return,
+
+ /* Type 1 opcodes: invalid but seen in real life */
+ cff_op_hsbw,
+ cff_op_closepath,
+ cff_op_callothersubr,
+ cff_op_pop,
+ cff_op_seac,
+ cff_op_sbw,
+ cff_op_setcurrentpoint,
+
+ /* do not remove */
+ cff_op_max
+
+ } CFF_Operator;
+
+
+#define CFF_COUNT_CHECK_WIDTH 0x80
+#define CFF_COUNT_EXACT 0x40
+#define CFF_COUNT_CLEAR_STACK 0x20
+
+ /* count values which have the `CFF_COUNT_CHECK_WIDTH' flag set are */
+ /* used for checking the width and requested numbers of arguments */
+ /* only; they are set to zero afterwards */
+
+ /* the other two flags are informative only and unused currently */
+
+ static const FT_Byte cff_argument_counts[] =
+ {
+ 0, /* unknown */
+
+ 2 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT, /* rmoveto */
+ 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,
+ 1 | CFF_COUNT_CHECK_WIDTH | CFF_COUNT_EXACT,
+
+ 0 | CFF_COUNT_CLEAR_STACK, /* rlineto */
+ 0 | CFF_COUNT_CLEAR_STACK,
+ 0 | CFF_COUNT_CLEAR_STACK,
+
+ 0 | CFF_COUNT_CLEAR_STACK, /* rrcurveto */
+ 0 | CFF_COUNT_CLEAR_STACK,
+ 0 | CFF_COUNT_CLEAR_STACK,
+ 0 | CFF_COUNT_CLEAR_STACK,
+ 0 | CFF_COUNT_CLEAR_STACK,
+ 0 | CFF_COUNT_CLEAR_STACK,
+ 0 | CFF_COUNT_CLEAR_STACK,
+
+ 13, /* flex */
+ 7,
+ 9,
+ 11,
+
+ 0 | CFF_COUNT_CHECK_WIDTH, /* endchar */
+
+ 2 | CFF_COUNT_CHECK_WIDTH, /* hstem */
+ 2 | CFF_COUNT_CHECK_WIDTH,
+ 2 | CFF_COUNT_CHECK_WIDTH,
+ 2 | CFF_COUNT_CHECK_WIDTH,
+
+ 0 | CFF_COUNT_CHECK_WIDTH, /* hintmask */
+ 0 | CFF_COUNT_CHECK_WIDTH, /* cntrmask */
+ 0, /* dotsection */
+
+ 1, /* abs */
+ 2,
+ 2,
+ 2,
+ 1,
+ 0,
+ 2,
+ 1,
+
+ 1, /* blend */
+
+ 1, /* drop */
+ 2,
+ 1,
+ 2,
+ 1,
+
+ 2, /* put */
+ 1,
+ 4,
+ 3,
+
+ 2, /* and */
+ 2,
+ 1,
+ 2,
+ 4,
+
+ 1, /* callsubr */
+ 1,
+ 0,
+
+ 2, /* hsbw */
+ 0,
+ 0,
+ 0,
+ 5, /* seac */
+ 4, /* sbw */
+ 2 /* setcurrentpoint */
+ };
+
+
+ static FT_Error
+ cff_operator_seac( CFF_Decoder* decoder,
+ FT_Pos asb,
+ FT_Pos adx,
+ FT_Pos ady,
+ FT_Int bchar,
+ FT_Int achar )
+ {
+ FT_Error error;
+ CFF_Builder* builder = &decoder->builder;
+ FT_Int bchar_index, achar_index;
+ TT_Face face = decoder->builder.face;
+ FT_Vector left_bearing, advance;
+ FT_Byte* charstring;
+ FT_ULong charstring_len;
+ FT_Pos glyph_width;
+
+
+ if ( decoder->seac )
+ {
+ FT_ERROR(( "cff_operator_seac: invalid nested seac\n" ));
+ return FT_THROW( Syntax_Error );
+ }
+
+ adx += decoder->builder.left_bearing.x;
+ ady += decoder->builder.left_bearing.y;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ /* Incremental fonts don't necessarily have valid charsets. */
+ /* They use the character code, not the glyph index, in this case. */
+ if ( face->root.internal->incremental_interface )
+ {
+ bchar_index = bchar;
+ achar_index = achar;
+ }
+ else
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
+ {
+ CFF_Font cff = (CFF_Font)(face->extra.data);
+
+
+ bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar );
+ achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar );
+ }
+
+ if ( bchar_index < 0 || achar_index < 0 )
+ {
+ FT_ERROR(( "cff_operator_seac:"
+ " invalid seac character code arguments\n" ));
+ return FT_THROW( Syntax_Error );
+ }
+
+ /* If we are trying to load a composite glyph, do not load the */
+ /* accent character and return the array of subglyphs. */
+ if ( builder->no_recurse )
+ {
+ FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph;
+ FT_GlyphLoader loader = glyph->internal->loader;
+ FT_SubGlyph subg;
+
+
+ /* reallocate subglyph array if necessary */
+ error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
+ if ( error )
+ goto Exit;
+
+ subg = loader->current.subglyphs;
+
+ /* subglyph 0 = base character */
+ subg->index = bchar_index;
+ subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
+ FT_SUBGLYPH_FLAG_USE_MY_METRICS;
+ subg->arg1 = 0;
+ subg->arg2 = 0;
+ subg++;
+
+ /* subglyph 1 = accent character */
+ subg->index = achar_index;
+ subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
+ subg->arg1 = (FT_Int)( adx >> 16 );
+ subg->arg2 = (FT_Int)( ady >> 16 );
+
+ /* set up remaining glyph fields */
+ glyph->num_subglyphs = 2;
+ glyph->subglyphs = loader->base.subglyphs;
+ glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
+
+ loader->current.num_subglyphs = 2;
+ }
+
+ FT_GlyphLoader_Prepare( builder->loader );
+
+ /* First load `bchar' in builder */
+ error = decoder->get_glyph_callback( face, (FT_UInt)bchar_index,
+ &charstring, &charstring_len );
+ if ( !error )
+ {
+ /* the seac operator must not be nested */
+ decoder->seac = TRUE;
+ error = cff_decoder_parse_charstrings( decoder, charstring,
+ charstring_len, 0 );
+ decoder->seac = FALSE;
+
+ decoder->free_glyph_callback( face, &charstring, charstring_len );
+
+ if ( error )
+ goto Exit;
+ }
+
+ /* Save the left bearing, advance and glyph width of the base */
+ /* character as they will be erased by the next load. */
+
+ left_bearing = builder->left_bearing;
+ advance = builder->advance;
+ glyph_width = decoder->glyph_width;
+
+ builder->left_bearing.x = 0;
+ builder->left_bearing.y = 0;
+
+ builder->pos_x = adx - asb;
+ builder->pos_y = ady;
+
+ /* Now load `achar' on top of the base outline. */
+ error = decoder->get_glyph_callback( face, (FT_UInt)achar_index,
+ &charstring, &charstring_len );
+ if ( !error )
+ {
+ /* the seac operator must not be nested */
+ decoder->seac = TRUE;
+ error = cff_decoder_parse_charstrings( decoder, charstring,
+ charstring_len, 0 );
+ decoder->seac = FALSE;
+
+ decoder->free_glyph_callback( face, &charstring, charstring_len );
+
+ if ( error )
+ goto Exit;
+ }
+
+ /* Restore the left side bearing, advance and glyph width */
+ /* of the base character. */
+ builder->left_bearing = left_bearing;
+ builder->advance = advance;
+ decoder->glyph_width = glyph_width;
+
+ builder->pos_x = 0;
+ builder->pos_y = 0;
+
+ Exit:
+ return error;
+ }
+
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /********** *********/
+ /********** *********/
+ /********** GENERIC CHARSTRING PARSING *********/
+ /********** *********/
+ /********** *********/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* cff_compute_bias */
+ /* */
+ /* <Description> */
+ /* Computes the bias value in dependence of the number of glyph */
+ /* subroutines. */
+ /* */
+ /* <Input> */
+ /* in_charstring_type :: The `CharstringType' value of the top DICT */
+ /* dictionary. */
+ /* */
+ /* num_subrs :: The number of glyph subroutines. */
+ /* */
+ /* <Return> */
+ /* The bias value. */
+ static FT_Int
+ cff_compute_bias( FT_Int in_charstring_type,
+ FT_UInt num_subrs )
+ {
+ FT_Int result;
+
+
+ if ( in_charstring_type == 1 )
+ result = 0;
+ else if ( num_subrs < 1240 )
+ result = 107;
+ else if ( num_subrs < 33900U )
+ result = 1131;
+ else
+ result = 32768U;
+
+ return result;
+ }
+
+
+ FT_LOCAL_DEF( FT_Int )
+ cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
+ FT_Int charcode )
+ {
+ FT_UInt n;
+ FT_UShort glyph_sid;
+
+ FT_Service_CFFLoad cffload;
+
+
+ /* CID-keyed fonts don't have glyph names */
+ if ( !cff->charset.sids )
+ return -1;
+
+ /* check range of standard char code */
+ if ( charcode < 0 || charcode > 255 )
+ return -1;
+
+#if 0
+ /* retrieve cffload from list of current modules */
+ FT_Service_CFFLoad cffload;
+
+
+ FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
+ if ( !cffload )
+ {
+ FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:"
+ " the `cffload' module is not available\n" ));
+ return FT_THROW( Unimplemented_Feature );
+ }
+#endif
+
+ cffload = (FT_Service_CFFLoad)cff->cffload;
+
+ /* Get code to SID mapping from `cff_standard_encoding'. */
+ glyph_sid = cffload->get_standard_encoding( (FT_UInt)charcode );
+
+ for ( n = 0; n < cff->num_glyphs; n++ )
+ {
+ if ( cff->charset.sids[n] == glyph_sid )
+ return (FT_Int)n;
+ }
+
+ return -1;
+ }
+
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* cff_decoder_parse_charstrings */
+ /* */
+ /* <Description> */
+ /* Parses a given Type 2 charstrings program. */
+ /* */
+ /* <InOut> */
+ /* decoder :: The current Type 1 decoder. */
+ /* */
+ /* <Input> */
+ /* charstring_base :: The base of the charstring stream. */
+ /* */
+ /* charstring_len :: The length in bytes of the charstring stream. */
+ /* */
+ /* in_dict :: Set to 1 if function is called from top or */
+ /* private DICT (needed for Multiple Master CFFs). */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ FT_LOCAL_DEF( FT_Error )
+ cff_decoder_parse_charstrings( CFF_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len,
+ FT_Bool in_dict )
+ {
+ FT_Error error;
+ CFF_Decoder_Zone* zone;
+ FT_Byte* ip;
+ FT_Byte* limit;
+ CFF_Builder* builder = &decoder->builder;
+ FT_Pos x, y;
+ FT_Fixed* stack;
+ FT_Int charstring_type =
+ decoder->cff->top_font.font_dict.charstring_type;
+ FT_UShort num_designs =
+ decoder->cff->top_font.font_dict.num_designs;
+ FT_UShort num_axes =
+ decoder->cff->top_font.font_dict.num_axes;
+
+ T2_Hints_Funcs hinter;
+
+
+ /* set default width */
+ decoder->num_hints = 0;
+ decoder->read_width = 1;
+
+ /* initialize the decoder */
+ decoder->top = decoder->stack;
+ decoder->zone = decoder->zones;
+ zone = decoder->zones;
+ stack = decoder->top;
+
+ hinter = (T2_Hints_Funcs)builder->hints_funcs;
+
+ builder->path_begun = 0;
+
+ zone->base = charstring_base;
+ limit = zone->limit = charstring_base + charstring_len;
+ ip = zone->cursor = zone->base;
+
+ error = FT_Err_Ok;
+
+ x = builder->pos_x;
+ y = builder->pos_y;
+
+ /* begin hints recording session, if any */
+ if ( hinter )
+ hinter->open( hinter->hints );
+
+ /* now execute loop */
+ while ( ip < limit )
+ {
+ CFF_Operator op;
+ FT_Byte v;
+
+
+ /********************************************************************/
+ /* */
+ /* Decode operator or operand */
+ /* */
+ v = *ip++;
+ if ( v >= 32 || v == 28 )
+ {
+ FT_Int shift = 16;
+ FT_Int32 val;
+
+
+ /* this is an operand, push it on the stack */
+
+ /* if we use shifts, all computations are done with unsigned */
+ /* values; the conversion to a signed value is the last step */
+ if ( v == 28 )
+ {
+ if ( ip + 1 >= limit )
+ goto Syntax_Error;
+ val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] );
+ ip += 2;
+ }
+ else if ( v < 247 )
+ val = (FT_Int32)v - 139;
+ else if ( v < 251 )
+ {
+ if ( ip >= limit )
+ goto Syntax_Error;
+ val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
+ }
+ else if ( v < 255 )
+ {
+ if ( ip >= limit )
+ goto Syntax_Error;
+ val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
+ }
+ else
+ {
+ if ( ip + 3 >= limit )
+ goto Syntax_Error;
+ val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
+ ( (FT_UInt32)ip[1] << 16 ) |
+ ( (FT_UInt32)ip[2] << 8 ) |
+ (FT_UInt32)ip[3] );
+ ip += 4;
+ if ( charstring_type == 2 )
+ shift = 0;
+ }
+ if ( decoder->top - stack >= CFF_MAX_OPERANDS )
+ goto Stack_Overflow;
+
+ val = (FT_Int32)( (FT_UInt32)val << shift );
+ *decoder->top++ = val;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !( val & 0xFFFFL ) )
+ FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) ));
+ else
+ FT_TRACE4(( " %.5f", val / 65536.0 ));
+#endif
+
+ }
+ else
+ {
+ /* The specification says that normally arguments are to be taken */
+ /* from the bottom of the stack. However, this seems not to be */
+ /* correct, at least for Acroread 7.0.8 on GNU/Linux: It pops the */
+ /* arguments similar to a PS interpreter. */
+
+ FT_Fixed* args = decoder->top;
+ FT_Int num_args = (FT_Int)( args - decoder->stack );
+ FT_Int req_args;
+
+
+ /* find operator */
+ op = cff_op_unknown;
+
+ switch ( v )
+ {
+ case 1:
+ op = cff_op_hstem;
+ break;
+ case 3:
+ op = cff_op_vstem;
+ break;
+ case 4:
+ op = cff_op_vmoveto;
+ break;
+ case 5:
+ op = cff_op_rlineto;
+ break;
+ case 6:
+ op = cff_op_hlineto;
+ break;
+ case 7:
+ op = cff_op_vlineto;
+ break;
+ case 8:
+ op = cff_op_rrcurveto;
+ break;
+ case 9:
+ op = cff_op_closepath;
+ break;
+ case 10:
+ op = cff_op_callsubr;
+ break;
+ case 11:
+ op = cff_op_return;
+ break;
+ case 12:
+ if ( ip >= limit )
+ goto Syntax_Error;
+ v = *ip++;
+
+ switch ( v )
+ {
+ case 0:
+ op = cff_op_dotsection;
+ break;
+ case 1: /* this is actually the Type1 vstem3 operator */
+ op = cff_op_vstem;
+ break;
+ case 2: /* this is actually the Type1 hstem3 operator */
+ op = cff_op_hstem;
+ break;
+ case 3:
+ op = cff_op_and;
+ break;
+ case 4:
+ op = cff_op_or;
+ break;
+ case 5:
+ op = cff_op_not;
+ break;
+ case 6:
+ op = cff_op_seac;
+ break;
+ case 7:
+ op = cff_op_sbw;
+ break;
+ case 8:
+ op = cff_op_store;
+ break;
+ case 9:
+ op = cff_op_abs;
+ break;
+ case 10:
+ op = cff_op_add;
+ break;
+ case 11:
+ op = cff_op_sub;
+ break;
+ case 12:
+ op = cff_op_div;
+ break;
+ case 13:
+ op = cff_op_load;
+ break;
+ case 14:
+ op = cff_op_neg;
+ break;
+ case 15:
+ op = cff_op_eq;
+ break;
+ case 16:
+ op = cff_op_callothersubr;
+ break;
+ case 17:
+ op = cff_op_pop;
+ break;
+ case 18:
+ op = cff_op_drop;
+ break;
+ case 20:
+ op = cff_op_put;
+ break;
+ case 21:
+ op = cff_op_get;
+ break;
+ case 22:
+ op = cff_op_ifelse;
+ break;
+ case 23:
+ op = cff_op_random;
+ break;
+ case 24:
+ op = cff_op_mul;
+ break;
+ case 26:
+ op = cff_op_sqrt;
+ break;
+ case 27:
+ op = cff_op_dup;
+ break;
+ case 28:
+ op = cff_op_exch;
+ break;
+ case 29:
+ op = cff_op_index;
+ break;
+ case 30:
+ op = cff_op_roll;
+ break;
+ case 33:
+ op = cff_op_setcurrentpoint;
+ break;
+ case 34:
+ op = cff_op_hflex;
+ break;
+ case 35:
+ op = cff_op_flex;
+ break;
+ case 36:
+ op = cff_op_hflex1;
+ break;
+ case 37:
+ op = cff_op_flex1;
+ break;
+ default:
+ FT_TRACE4(( " unknown op (12, %d)\n", v ));
+ break;
+ }
+ break;
+ case 13:
+ op = cff_op_hsbw;
+ break;
+ case 14:
+ op = cff_op_endchar;
+ break;
+ case 16:
+ op = cff_op_blend;
+ break;
+ case 18:
+ op = cff_op_hstemhm;
+ break;
+ case 19:
+ op = cff_op_hintmask;
+ break;
+ case 20:
+ op = cff_op_cntrmask;
+ break;
+ case 21:
+ op = cff_op_rmoveto;
+ break;
+ case 22:
+ op = cff_op_hmoveto;
+ break;
+ case 23:
+ op = cff_op_vstemhm;
+ break;
+ case 24:
+ op = cff_op_rcurveline;
+ break;
+ case 25:
+ op = cff_op_rlinecurve;
+ break;
+ case 26:
+ op = cff_op_vvcurveto;
+ break;
+ case 27:
+ op = cff_op_hhcurveto;
+ break;
+ case 29:
+ op = cff_op_callgsubr;
+ break;
+ case 30:
+ op = cff_op_vhcurveto;
+ break;
+ case 31:
+ op = cff_op_hvcurveto;
+ break;
+ default:
+ FT_TRACE4(( " unknown op (%d)\n", v ));
+ break;
+ }
+
+ if ( op == cff_op_unknown )
+ continue;
+
+ /* in Multiple Master CFFs, T2 charstrings can appear in */
+ /* dictionaries, but some operators are prohibited */
+ if ( in_dict )
+ {
+ switch ( op )
+ {
+ case cff_op_hstem:
+ case cff_op_vstem:
+ case cff_op_vmoveto:
+ case cff_op_rlineto:
+ case cff_op_hlineto:
+ case cff_op_vlineto:
+ case cff_op_rrcurveto:
+ case cff_op_hstemhm:
+ case cff_op_hintmask:
+ case cff_op_cntrmask:
+ case cff_op_rmoveto:
+ case cff_op_hmoveto:
+ case cff_op_vstemhm:
+ case cff_op_rcurveline:
+ case cff_op_rlinecurve:
+ case cff_op_vvcurveto:
+ case cff_op_hhcurveto:
+ case cff_op_vhcurveto:
+ case cff_op_hvcurveto:
+ case cff_op_hflex:
+ case cff_op_flex:
+ case cff_op_hflex1:
+ case cff_op_flex1:
+ case cff_op_callsubr:
+ case cff_op_callgsubr:
+ goto MM_Error;
+
+ default:
+ break;
+ }
+ }
+
+ /* check arguments */
+ req_args = cff_argument_counts[op];
+ if ( req_args & CFF_COUNT_CHECK_WIDTH )
+ {
+ if ( num_args > 0 && decoder->read_width )
+ {
+ /* If `nominal_width' is non-zero, the number is really a */
+ /* difference against `nominal_width'. Else, the number here */
+ /* is truly a width, not a difference against `nominal_width'. */
+ /* If the font does not set `nominal_width', then */
+ /* `nominal_width' defaults to zero, and so we can set */
+ /* `glyph_width' to `nominal_width' plus number on the stack */
+ /* -- for either case. */
+
+ FT_Int set_width_ok;
+
+
+ switch ( op )
+ {
+ case cff_op_hmoveto:
+ case cff_op_vmoveto:
+ set_width_ok = num_args & 2;
+ break;
+
+ case cff_op_hstem:
+ case cff_op_vstem:
+ case cff_op_hstemhm:
+ case cff_op_vstemhm:
+ case cff_op_rmoveto:
+ case cff_op_hintmask:
+ case cff_op_cntrmask:
+ set_width_ok = num_args & 1;
+ break;
+
+ case cff_op_endchar:
+ /* If there is a width specified for endchar, we either have */
+ /* 1 argument or 5 arguments. We like to argue. */
+ set_width_ok = in_dict
+ ? 0
+ : ( ( num_args == 5 ) || ( num_args == 1 ) );
+ break;
+
+ default:
+ set_width_ok = 0;
+ break;
+ }
+
+ if ( set_width_ok )
+ {
+ decoder->glyph_width = decoder->nominal_width +
+ ( stack[0] >> 16 );
+
+ if ( decoder->width_only )
+ {
+ /* we only want the advance width; stop here */
+ break;
+ }
+
+ /* Consumed an argument. */
+ num_args--;
+ }
+ }
+
+ decoder->read_width = 0;
+ req_args = 0;
+ }
+
+ req_args &= 0x000F;
+ if ( num_args < req_args )
+ goto Stack_Underflow;
+ args -= req_args;
+ num_args -= req_args;
+
+ /* At this point, `args' points to the first argument of the */
+ /* operand in case `req_args' isn't zero. Otherwise, we have */
+ /* to adjust `args' manually. */
+
+ /* Note that we only pop arguments from the stack which we */
+ /* really need and can digest so that we can continue in case */
+ /* of superfluous stack elements. */
+
+ switch ( op )
+ {
+ case cff_op_hstem:
+ case cff_op_vstem:
+ case cff_op_hstemhm:
+ case cff_op_vstemhm:
+ /* the number of arguments is always even here */
+ FT_TRACE4((
+ op == cff_op_hstem ? " hstem\n" :
+ ( op == cff_op_vstem ? " vstem\n" :
+ ( op == cff_op_hstemhm ? " hstemhm\n" : " vstemhm\n" ) ) ));
+
+ if ( hinter )
+ hinter->stems( hinter->hints,
+ ( op == cff_op_hstem || op == cff_op_hstemhm ),
+ num_args / 2,
+ args - ( num_args & ~1 ) );
+
+ decoder->num_hints += num_args / 2;
+ args = stack;
+ break;
+
+ case cff_op_hintmask:
+ case cff_op_cntrmask:
+ FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" ));
+
+ /* implement vstem when needed -- */
+ /* the specification doesn't say it, but this also works */
+ /* with the 'cntrmask' operator */
+ /* */
+ if ( num_args > 0 )
+ {
+ if ( hinter )
+ hinter->stems( hinter->hints,
+ 0,
+ num_args / 2,
+ args - ( num_args & ~1 ) );
+
+ decoder->num_hints += num_args / 2;
+ }
+
+ /* In a valid charstring there must be at least one byte */
+ /* after `hintmask' or `cntrmask' (e.g., for a `return' */
+ /* instruction). Additionally, there must be space for */
+ /* `num_hints' bits. */
+
+ if ( ( ip + ( ( decoder->num_hints + 7 ) >> 3 ) ) >= limit )
+ goto Syntax_Error;
+
+ if ( hinter )
+ {
+ if ( op == cff_op_hintmask )
+ hinter->hintmask( hinter->hints,
+ (FT_UInt)builder->current->n_points,
+ (FT_UInt)decoder->num_hints,
+ ip );
+ else
+ hinter->counter( hinter->hints,
+ (FT_UInt)decoder->num_hints,
+ ip );
+ }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ {
+ FT_UInt maskbyte;
+
+
+ FT_TRACE4(( " (maskbytes:" ));
+
+ for ( maskbyte = 0;
+ maskbyte < (FT_UInt)( ( decoder->num_hints + 7 ) >> 3 );
+ maskbyte++, ip++ )
+ FT_TRACE4(( " 0x%02X", *ip ));
+
+ FT_TRACE4(( ")\n" ));
+ }
+#else
+ ip += ( decoder->num_hints + 7 ) >> 3;
+#endif
+ args = stack;
+ break;
+
+ case cff_op_rmoveto:
+ FT_TRACE4(( " rmoveto\n" ));
+
+ cff_builder_close_contour( builder );
+ builder->path_begun = 0;
+ x = ADD_LONG( x, args[-2] );
+ y = ADD_LONG( y, args[-1] );
+ args = stack;
+ break;
+
+ case cff_op_vmoveto:
+ FT_TRACE4(( " vmoveto\n" ));
+
+ cff_builder_close_contour( builder );
+ builder->path_begun = 0;
+ y = ADD_LONG( y, args[-1] );
+ args = stack;
+ break;
+
+ case cff_op_hmoveto:
+ FT_TRACE4(( " hmoveto\n" ));
+
+ cff_builder_close_contour( builder );
+ builder->path_begun = 0;
+ x = ADD_LONG( x, args[-1] );
+ args = stack;
+ break;
+
+ case cff_op_rlineto:
+ FT_TRACE4(( " rlineto\n" ));
+
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, num_args / 2 ) )
+ goto Fail;
+
+ if ( num_args < 2 )
+ goto Stack_Underflow;
+
+ args -= num_args & ~1;
+ while ( args < decoder->top )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 1 );
+ args += 2;
+ }
+ args = stack;
+ break;
+
+ case cff_op_hlineto:
+ case cff_op_vlineto:
+ {
+ FT_Int phase = ( op == cff_op_hlineto );
+
+
+ FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n"
+ : " vlineto\n" ));
+
+ if ( num_args < 0 )
+ goto Stack_Underflow;
+
+ /* there exist subsetted fonts (found in PDFs) */
+ /* which call `hlineto' without arguments */
+ if ( num_args == 0 )
+ break;
+
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, num_args ) )
+ goto Fail;
+
+ args = stack;
+ while ( args < decoder->top )
+ {
+ if ( phase )
+ x = ADD_LONG( x, args[0] );
+ else
+ y = ADD_LONG( y, args[0] );
+
+ if ( cff_builder_add_point1( builder, x, y ) )
+ goto Fail;
+
+ args++;
+ phase ^= 1;
+ }
+ args = stack;
+ }
+ break;
+
+ case cff_op_rrcurveto:
+ {
+ FT_Int nargs;
+
+
+ FT_TRACE4(( " rrcurveto\n" ));
+
+ if ( num_args < 6 )
+ goto Stack_Underflow;
+
+ nargs = num_args - num_args % 6;
+
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, nargs / 2 ) )
+ goto Fail;
+
+ args -= nargs;
+ while ( args < decoder->top )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[4] );
+ y = ADD_LONG( y, args[5] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args += 6;
+ }
+ args = stack;
+ }
+ break;
+
+ case cff_op_vvcurveto:
+ {
+ FT_Int nargs;
+
+
+ FT_TRACE4(( " vvcurveto\n" ));
+
+ if ( num_args < 4 )
+ goto Stack_Underflow;
+
+ /* if num_args isn't of the form 4n or 4n+1, */
+ /* we enforce it by clearing the second bit */
+
+ nargs = num_args & ~2;
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ args -= nargs;
+
+ if ( nargs & 1 )
+ {
+ x = ADD_LONG( x, args[0] );
+ args++;
+ nargs--;
+ }
+
+ if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) )
+ goto Fail;
+
+ while ( args < decoder->top )
+ {
+ y = ADD_LONG( y, args[0] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ y = ADD_LONG( y, args[3] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args += 4;
+ }
+ args = stack;
+ }
+ break;
+
+ case cff_op_hhcurveto:
+ {
+ FT_Int nargs;
+
+
+ FT_TRACE4(( " hhcurveto\n" ));
+
+ if ( num_args < 4 )
+ goto Stack_Underflow;
+
+ /* if num_args isn't of the form 4n or 4n+1, */
+ /* we enforce it by clearing the second bit */
+
+ nargs = num_args & ~2;
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ args -= nargs;
+ if ( nargs & 1 )
+ {
+ y = ADD_LONG( y, args[0] );
+ args++;
+ nargs--;
+ }
+
+ if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) )
+ goto Fail;
+
+ while ( args < decoder->top )
+ {
+ x = ADD_LONG( x, args[0] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[3] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args += 4;
+ }
+ args = stack;
+ }
+ break;
+
+ case cff_op_vhcurveto:
+ case cff_op_hvcurveto:
+ {
+ FT_Int phase;
+ FT_Int nargs;
+
+
+ FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n"
+ : " hvcurveto\n" ));
+
+ if ( cff_builder_start_point( builder, x, y ) )
+ goto Fail;
+
+ if ( num_args < 4 )
+ goto Stack_Underflow;
+
+ /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
+ /* we enforce it by clearing the second bit */
+
+ nargs = num_args & ~2;
+
+ args -= nargs;
+ if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) )
+ goto Stack_Underflow;
+
+ phase = ( op == cff_op_hvcurveto );
+
+ while ( nargs >= 4 )
+ {
+ nargs -= 4;
+ if ( phase )
+ {
+ x = ADD_LONG( x, args[0] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ y = ADD_LONG( y, args[3] );
+ if ( nargs == 1 )
+ x = ADD_LONG( x, args[4] );
+ cff_builder_add_point( builder, x, y, 1 );
+ }
+ else
+ {
+ y = ADD_LONG( y, args[0] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[3] );
+ if ( nargs == 1 )
+ y = ADD_LONG( y, args[4] );
+ cff_builder_add_point( builder, x, y, 1 );
+ }
+ args += 4;
+ phase ^= 1;
+ }
+ args = stack;
+ }
+ break;
+
+ case cff_op_rlinecurve:
+ {
+ FT_Int num_lines;
+ FT_Int nargs;
+
+
+ FT_TRACE4(( " rlinecurve\n" ));
+
+ if ( num_args < 8 )
+ goto Stack_Underflow;
+
+ nargs = num_args & ~1;
+ num_lines = ( nargs - 6 ) / 2;
+
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, num_lines + 3 ) )
+ goto Fail;
+
+ args -= nargs;
+
+ /* first, add the line segments */
+ while ( num_lines > 0 )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args += 2;
+ num_lines--;
+ }
+
+ /* then the curve */
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[4] );
+ y = ADD_LONG( y, args[5] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args = stack;
+ }
+ break;
+
+ case cff_op_rcurveline:
+ {
+ FT_Int num_curves;
+ FT_Int nargs;
+
+
+ FT_TRACE4(( " rcurveline\n" ));
+
+ if ( num_args < 8 )
+ goto Stack_Underflow;
+
+ nargs = num_args - 2;
+ nargs = nargs - nargs % 6 + 2;
+ num_curves = ( nargs - 2 ) / 6;
+
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, num_curves * 3 + 2 ) )
+ goto Fail;
+
+ args -= nargs;
+
+ /* first, add the curves */
+ while ( num_curves > 0 )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ x = ADD_LONG( x, args[4] );
+ y = ADD_LONG( y, args[5] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args += 6;
+ num_curves--;
+ }
+
+ /* then the final line */
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args = stack;
+ }
+ break;
+
+ case cff_op_hflex1:
+ {
+ FT_Pos start_y;
+
+
+ FT_TRACE4(( " hflex1\n" ));
+
+ /* adding five more points: 4 control points, 1 on-curve point */
+ /* -- make sure we have enough space for the start point if it */
+ /* needs to be added */
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, 6 ) )
+ goto Fail;
+
+ /* record the starting point's y position for later use */
+ start_y = y;
+
+ /* first control point */
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* second control point */
+ x = ADD_LONG( x, args[2] );
+ y = ADD_LONG( y, args[3] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* join point; on curve, with y-value the same as the last */
+ /* control point's y-value */
+ x = ADD_LONG( x, args[4] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ /* third control point, with y-value the same as the join */
+ /* point's y-value */
+ x = ADD_LONG( x, args[5] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* fourth control point */
+ x = ADD_LONG( x, args[6] );
+ y = ADD_LONG( y, args[7] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* ending point, with y-value the same as the start */
+ x = ADD_LONG( x, args[8] );
+ y = start_y;
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args = stack;
+ break;
+ }
+
+ case cff_op_hflex:
+ {
+ FT_Pos start_y;
+
+
+ FT_TRACE4(( " hflex\n" ));
+
+ /* adding six more points; 4 control points, 2 on-curve points */
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, 6 ) )
+ goto Fail;
+
+ /* record the starting point's y-position for later use */
+ start_y = y;
+
+ /* first control point */
+ x = ADD_LONG( x, args[0] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* second control point */
+ x = ADD_LONG( x, args[1] );
+ y = ADD_LONG( y, args[2] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* join point; on curve, with y-value the same as the last */
+ /* control point's y-value */
+ x = ADD_LONG( x, args[3] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ /* third control point, with y-value the same as the join */
+ /* point's y-value */
+ x = ADD_LONG( x, args[4] );
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* fourth control point */
+ x = ADD_LONG( x, args[5] );
+ y = start_y;
+ cff_builder_add_point( builder, x, y, 0 );
+
+ /* ending point, with y-value the same as the start point's */
+ /* y-value -- we don't add this point, though */
+ x = ADD_LONG( x, args[6] );
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args = stack;
+ break;
+ }
+
+ case cff_op_flex1:
+ {
+ FT_Pos start_x, start_y; /* record start x, y values for */
+ /* alter use */
+ FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */
+ /* algorithm below */
+ FT_Int horizontal, count;
+ FT_Fixed* temp;
+
+
+ FT_TRACE4(( " flex1\n" ));
+
+ /* adding six more points; 4 control points, 2 on-curve points */
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, 6 ) )
+ goto Fail;
+
+ /* record the starting point's x, y position for later use */
+ start_x = x;
+ start_y = y;
+
+ /* XXX: figure out whether this is supposed to be a horizontal */
+ /* or vertical flex; the Type 2 specification is vague... */
+
+ temp = args;
+
+ /* grab up to the last argument */
+ for ( count = 5; count > 0; count-- )
+ {
+ dx = ADD_LONG( dx, temp[0] );
+ dy = ADD_LONG( dy, temp[1] );
+ temp += 2;
+ }
+
+ if ( dx < 0 )
+ dx = -dx;
+ if ( dy < 0 )
+ dy = -dy;
+
+ /* strange test, but here it is... */
+ horizontal = ( dx > dy );
+
+ for ( count = 5; count > 0; count-- )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y,
+ (FT_Bool)( count == 3 ) );
+ args += 2;
+ }
+
+ /* is last operand an x- or y-delta? */
+ if ( horizontal )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = start_y;
+ }
+ else
+ {
+ x = start_x;
+ y = ADD_LONG( y, args[0] );
+ }
+
+ cff_builder_add_point( builder, x, y, 1 );
+
+ args = stack;
+ break;
+ }
+
+ case cff_op_flex:
+ {
+ FT_UInt count;
+
+
+ FT_TRACE4(( " flex\n" ));
+
+ if ( cff_builder_start_point( builder, x, y ) ||
+ cff_check_points( builder, 6 ) )
+ goto Fail;
+
+ for ( count = 6; count > 0; count-- )
+ {
+ x = ADD_LONG( x, args[0] );
+ y = ADD_LONG( y, args[1] );
+ cff_builder_add_point( builder, x, y,
+ (FT_Bool)( count == 4 || count == 1 ) );
+ args += 2;
+ }
+
+ args = stack;
+ }
+ break;
+
+ case cff_op_seac:
+ FT_TRACE4(( " seac\n" ));
+
+ error = cff_operator_seac( decoder,
+ args[0], args[1], args[2],
+ (FT_Int)( args[3] >> 16 ),
+ (FT_Int)( args[4] >> 16 ) );
+
+ /* add current outline to the glyph slot */
+ FT_GlyphLoader_Add( builder->loader );
+
+ /* return now! */
+ FT_TRACE4(( "\n" ));
+ return error;
+
+ case cff_op_endchar:
+ /* in dictionaries, `endchar' simply indicates end of data */
+ if ( in_dict )
+ return error;
+
+ FT_TRACE4(( " endchar\n" ));
+
+ /* We are going to emulate the seac operator. */
+ if ( num_args >= 4 )
+ {
+ /* Save glyph width so that the subglyphs don't overwrite it. */
+ FT_Pos glyph_width = decoder->glyph_width;
+
+
+ error = cff_operator_seac( decoder,
+ 0L, args[-4], args[-3],
+ (FT_Int)( args[-2] >> 16 ),
+ (FT_Int)( args[-1] >> 16 ) );
+
+ decoder->glyph_width = glyph_width;
+ }
+ else
+ {
+ cff_builder_close_contour( builder );
+
+ /* close hints recording session */
+ if ( hinter )
+ {
+ if ( hinter->close( hinter->hints,
+ (FT_UInt)builder->current->n_points ) )
+ goto Syntax_Error;
+
+ /* apply hints to the loaded glyph outline now */
+ error = hinter->apply( hinter->hints,
+ builder->current,
+ (PSH_Globals)builder->hints_globals,
+ decoder->hint_mode );
+ if ( error )
+ goto Fail;
+ }
+
+ /* add current outline to the glyph slot */
+ FT_GlyphLoader_Add( builder->loader );
+ }
+
+ /* return now! */
+ FT_TRACE4(( "\n" ));
+ return error;
+
+ case cff_op_abs:
+ FT_TRACE4(( " abs\n" ));
+
+ if ( args[0] < 0 )
+ {
+ if ( args[0] == FT_LONG_MIN )
+ args[0] = FT_LONG_MAX;
+ else
+ args[0] = -args[0];
+ }
+ args++;
+ break;
+
+ case cff_op_add:
+ FT_TRACE4(( " add\n" ));
+
+ args[0] = ADD_LONG( args[0], args[1] );
+ args++;
+ break;
+
+ case cff_op_sub:
+ FT_TRACE4(( " sub\n" ));
+
+ args[0] = SUB_LONG( args[0], args[1] );
+ args++;
+ break;
+
+ case cff_op_div:
+ FT_TRACE4(( " div\n" ));
+
+ args[0] = FT_DivFix( args[0], args[1] );
+ args++;
+ break;
+
+ case cff_op_neg:
+ FT_TRACE4(( " neg\n" ));
+
+ if ( args[0] == FT_LONG_MIN )
+ args[0] = FT_LONG_MAX;
+ args[0] = -args[0];
+ args++;
+ break;
+
+ case cff_op_random:
+ FT_TRACE4(( " random\n" ));
+
+ /* only use the lower 16 bits of `random' */
+ /* to generate a number in the range (0;1] */
+ args[0] = (FT_Fixed)
+ ( ( decoder->current_subfont->random & 0xFFFF ) + 1 );
+ args++;
+
+ decoder->current_subfont->random =
+ cff_random( decoder->current_subfont->random );
+ break;
+
+ case cff_op_mul:
+ FT_TRACE4(( " mul\n" ));
+
+ args[0] = FT_MulFix( args[0], args[1] );
+ args++;
+ break;
+
+ case cff_op_sqrt:
+ FT_TRACE4(( " sqrt\n" ));
+
+ if ( args[0] > 0 )
+ {
+ FT_Fixed root = args[0];
+ FT_Fixed new_root;
+
+
+ for (;;)
+ {
+ new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1;
+ if ( new_root == root )
+ break;
+ root = new_root;
+ }
+ args[0] = new_root;
+ }
+ else
+ args[0] = 0;
+ args++;
+ break;
+
+ case cff_op_drop:
+ /* nothing */
+ FT_TRACE4(( " drop\n" ));
+
+ break;
+
+ case cff_op_exch:
+ {
+ FT_Fixed tmp;
+
+
+ FT_TRACE4(( " exch\n" ));
+
+ tmp = args[0];
+ args[0] = args[1];
+ args[1] = tmp;
+ args += 2;
+ }
+ break;
+
+ case cff_op_index:
+ {
+ FT_Int idx = (FT_Int)( args[0] >> 16 );
+
+
+ FT_TRACE4(( " index\n" ));
+
+ if ( idx < 0 )
+ idx = 0;
+ else if ( idx > num_args - 2 )
+ idx = num_args - 2;
+ args[0] = args[-( idx + 1 )];
+ args++;
+ }
+ break;
+
+ case cff_op_roll:
+ {
+ FT_Int count = (FT_Int)( args[0] >> 16 );
+ FT_Int idx = (FT_Int)( args[1] >> 16 );
+
+
+ FT_TRACE4(( " roll\n" ));
+
+ if ( count <= 0 )
+ count = 1;
+
+ args -= count;
+ if ( args < stack )
+ goto Stack_Underflow;
+
+ if ( idx >= 0 )
+ {
+ while ( idx > 0 )
+ {
+ FT_Fixed tmp = args[count - 1];
+ FT_Int i;
+
+
+ for ( i = count - 2; i >= 0; i-- )
+ args[i + 1] = args[i];
+ args[0] = tmp;
+ idx--;
+ }
+ }
+ else
+ {
+ while ( idx < 0 )
+ {
+ FT_Fixed tmp = args[0];
+ FT_Int i;
+
+
+ for ( i = 0; i < count - 1; i++ )
+ args[i] = args[i + 1];
+ args[count - 1] = tmp;
+ idx++;
+ }
+ }
+ args += count;
+ }
+ break;
+
+ case cff_op_dup:
+ FT_TRACE4(( " dup\n" ));
+
+ args[1] = args[0];
+ args += 2;
+ break;
+
+ case cff_op_put:
+ {
+ FT_Fixed val = args[0];
+ FT_Int idx = (FT_Int)( args[1] >> 16 );
+
+
+ FT_TRACE4(( " put\n" ));
+
+ /* the Type2 specification before version 16-March-2000 */
+ /* didn't give a hard-coded size limit of the temporary */
+ /* storage array; instead, an argument of the */
+ /* `MultipleMaster' operator set the size */
+ if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
+ decoder->buildchar[idx] = val;
+ }
+ break;
+
+ case cff_op_get:
+ {
+ FT_Int idx = (FT_Int)( args[0] >> 16 );
+ FT_Fixed val = 0;
+
+
+ FT_TRACE4(( " get\n" ));
+
+ if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
+ val = decoder->buildchar[idx];
+
+ args[0] = val;
+ args++;
+ }
+ break;
+
+ case cff_op_store:
+ /* this operator was removed from the Type2 specification */
+ /* in version 16-March-2000 */
+
+ /* since we currently don't handle interpolation of multiple */
+ /* master fonts, this is a no-op */
+ FT_TRACE4(( " store\n" ));
+ break;
+
+ case cff_op_load:
+ /* this operator was removed from the Type2 specification */
+ /* in version 16-March-2000 */
+ {
+ FT_Int reg_idx = (FT_Int)args[0];
+ FT_Int idx = (FT_Int)args[1];
+ FT_Int count = (FT_Int)args[2];
+
+
+ FT_TRACE4(( " load\n" ));
+
+ /* since we currently don't handle interpolation of multiple */
+ /* master fonts, we store a vector [1 0 0 ...] in the */
+ /* temporary storage array regardless of the Registry index */
+ if ( reg_idx >= 0 && reg_idx <= 2 &&
+ idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS &&
+ count >= 0 && count <= num_axes )
+ {
+ FT_Int end, i;
+
+
+ end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS );
+
+ if ( idx < end )
+ decoder->buildchar[idx] = 1 << 16;
+
+ for ( i = idx + 1; i < end; i++ )
+ decoder->buildchar[i] = 0;
+ }
+ }
+ break;
+
+ case cff_op_blend:
+ /* this operator was removed from the Type2 specification */
+ /* in version 16-March-2000 */
+ {
+ FT_Int num_results = (FT_Int)( args[0] >> 16 );
+
+
+ FT_TRACE4(( " blend\n" ));
+
+ if ( num_results < 0 )
+ goto Syntax_Error;
+
+ if ( num_results * (FT_Int)num_designs > num_args )
+ goto Stack_Underflow;
+
+ /* since we currently don't handle interpolation of multiple */
+ /* master fonts, return the `num_results' values of the */
+ /* first master */
+ args -= num_results * ( num_designs - 1 );
+ num_args -= num_results * ( num_designs - 1 );
+ }
+ break;
+
+ case cff_op_dotsection:
+ /* this operator is deprecated and ignored by the parser */
+ FT_TRACE4(( " dotsection\n" ));
+ break;
+
+ case cff_op_closepath:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " closepath (invalid op)\n" ));
+
+ args = stack;
+ break;
+
+ case cff_op_hsbw:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " hsbw (invalid op)\n" ));
+
+ decoder->glyph_width =
+ ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) );
+
+ decoder->builder.left_bearing.x = args[0];
+ decoder->builder.left_bearing.y = 0;
+
+ x = ADD_LONG( decoder->builder.pos_x, args[0] );
+ y = decoder->builder.pos_y;
+ args = stack;
+ break;
+
+ case cff_op_sbw:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " sbw (invalid op)\n" ));
+
+ decoder->glyph_width =
+ ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) );
+
+ decoder->builder.left_bearing.x = args[0];
+ decoder->builder.left_bearing.y = args[1];
+
+ x = ADD_LONG( decoder->builder.pos_x, args[0] );
+ y = ADD_LONG( decoder->builder.pos_y, args[1] );
+ args = stack;
+ break;
+
+ case cff_op_setcurrentpoint:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " setcurrentpoint (invalid op)\n" ));
+
+ x = ADD_LONG( decoder->builder.pos_x, args[0] );
+ y = ADD_LONG( decoder->builder.pos_y, args[1] );
+ args = stack;
+ break;
+
+ case cff_op_callothersubr:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " callothersubr (invalid op)\n" ));
+
+ /* subsequent `pop' operands should add the arguments, */
+ /* this is the implementation described for `unknown' other */
+ /* subroutines in the Type1 spec. */
+ /* */
+ /* XXX Fix return arguments (see discussion below). */
+ args -= 2 + ( args[-2] >> 16 );
+ if ( args < stack )
+ goto Stack_Underflow;
+ break;
+
+ case cff_op_pop:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " pop (invalid op)\n" ));
+
+ /* XXX Increasing `args' is wrong: After a certain number of */
+ /* `pop's we get a stack overflow. Reason for doing it is */
+ /* code like this (actually found in a CFF font): */
+ /* */
+ /* 17 1 3 callothersubr */
+ /* pop */
+ /* callsubr */
+ /* */
+ /* Since we handle `callothersubr' as a no-op, and */
+ /* `callsubr' needs at least one argument, `pop' can't be a */
+ /* no-op too as it basically should be. */
+ /* */
+ /* The right solution would be to provide real support for */
+ /* `callothersubr' as done in `t1decode.c', however, given */
+ /* the fact that CFF fonts with `pop' are invalid, it is */
+ /* questionable whether it is worth the time. */
+ args++;
+ break;
+
+ case cff_op_and:
+ {
+ FT_Fixed cond = ( args[0] && args[1] );
+
+
+ FT_TRACE4(( " and\n" ));
+
+ args[0] = cond ? 0x10000L : 0;
+ args++;
+ }
+ break;
+
+ case cff_op_or:
+ {
+ FT_Fixed cond = ( args[0] || args[1] );
+
+
+ FT_TRACE4(( " or\n" ));
+
+ args[0] = cond ? 0x10000L : 0;
+ args++;
+ }
+ break;
+
+ case cff_op_not:
+ {
+ FT_Fixed cond = !args[0];
+
+
+ FT_TRACE4(( " not\n" ));
+
+ args[0] = cond ? 0x10000L : 0;
+ args++;
+ }
+ break;
+
+ case cff_op_eq:
+ {
+ FT_Fixed cond = ( args[0] == args[1] );
+
+
+ FT_TRACE4(( " eq\n" ));
+
+ args[0] = cond ? 0x10000L : 0;
+ args++;
+ }
+ break;
+
+ case cff_op_ifelse:
+ {
+ FT_Fixed cond = ( args[2] <= args[3] );
+
+
+ FT_TRACE4(( " ifelse\n" ));
+
+ if ( !cond )
+ args[0] = args[1];
+ args++;
+ }
+ break;
+
+ case cff_op_callsubr:
+ {
+ FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
+ decoder->locals_bias );
+
+
+ FT_TRACE4(( " callsubr (idx %d, entering level %d)\n",
+ idx,
+ zone - decoder->zones + 1 ));
+
+ if ( idx >= decoder->num_locals )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " invalid local subr index\n" ));
+ goto Syntax_Error;
+ }
+
+ if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " too many nested subrs\n" ));
+ goto Syntax_Error;
+ }
+
+ zone->cursor = ip; /* save current instruction pointer */
+
+ zone++;
+ zone->base = decoder->locals[idx];
+ zone->limit = decoder->locals[idx + 1];
+ zone->cursor = zone->base;
+
+ if ( !zone->base || zone->limit == zone->base )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " invoking empty subrs\n" ));
+ goto Syntax_Error;
+ }
+
+ decoder->zone = zone;
+ ip = zone->base;
+ limit = zone->limit;
+ }
+ break;
+
+ case cff_op_callgsubr:
+ {
+ FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) +
+ decoder->globals_bias );
+
+
+ FT_TRACE4(( " callgsubr (idx %d, entering level %d)\n",
+ idx,
+ zone - decoder->zones + 1 ));
+
+ if ( idx >= decoder->num_globals )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " invalid global subr index\n" ));
+ goto Syntax_Error;
+ }
+
+ if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " too many nested subrs\n" ));
+ goto Syntax_Error;
+ }
+
+ zone->cursor = ip; /* save current instruction pointer */
+
+ zone++;
+ zone->base = decoder->globals[idx];
+ zone->limit = decoder->globals[idx + 1];
+ zone->cursor = zone->base;
+
+ if ( !zone->base || zone->limit == zone->base )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " invoking empty subrs\n" ));
+ goto Syntax_Error;
+ }
+
+ decoder->zone = zone;
+ ip = zone->base;
+ limit = zone->limit;
+ }
+ break;
+
+ case cff_op_return:
+ FT_TRACE4(( " return (leaving level %d)\n",
+ decoder->zone - decoder->zones ));
+
+ if ( decoder->zone <= decoder->zones )
+ {
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " unexpected return\n" ));
+ goto Syntax_Error;
+ }
+
+ decoder->zone--;
+ zone = decoder->zone;
+ ip = zone->cursor;
+ limit = zone->limit;
+ break;
+
+ default:
+ FT_ERROR(( "Unimplemented opcode: %d", ip[-1] ));
+
+ if ( ip[-1] == 12 )
+ FT_ERROR(( " %d", ip[0] ));
+ FT_ERROR(( "\n" ));
+
+ return FT_THROW( Unimplemented_Feature );
+ }
+
+ decoder->top = args;
+
+ if ( decoder->top - stack >= CFF_MAX_OPERANDS )
+ goto Stack_Overflow;
+
+ } /* general operator processing */
+
+ } /* while ip < limit */
+
+ FT_TRACE4(( "..end..\n\n" ));
+
+ Fail:
+ return error;
+
+ MM_Error:
+ FT_TRACE4(( "cff_decoder_parse_charstrings:"
+ " invalid opcode found in top DICT charstring\n"));
+ return FT_THROW( Invalid_File_Format );
+
+ Syntax_Error:
+ FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" ));
+ return FT_THROW( Invalid_File_Format );
+
+ Stack_Underflow:
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" ));
+ return FT_THROW( Too_Few_Arguments );
+
+ Stack_Overflow:
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" ));
+ return FT_THROW( Stack_Overflow );
+ }
+
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* cff_decoder_init */
+ /* */
+ /* <Description> */
+ /* Initializes a given glyph decoder. */
+ /* */
+ /* <InOut> */
+ /* decoder :: A pointer to the glyph builder to initialize. */
+ /* */
+ /* <Input> */
+ /* face :: The current face object. */
+ /* */
+ /* size :: The current size object. */
+ /* */
+ /* slot :: The current glyph object. */
+ /* */
+ /* hinting :: Whether hinting is active. */
+ /* */
+ /* hint_mode :: The hinting mode. */
+ /* */
+ FT_LOCAL_DEF( void )
+ cff_decoder_init( CFF_Decoder* decoder,
+ TT_Face face,
+ CFF_Size size,
+ CFF_GlyphSlot slot,
+ FT_Bool hinting,
+ FT_Render_Mode hint_mode,
+ CFF_Decoder_Get_Glyph_Callback get_callback,
+ CFF_Decoder_Free_Glyph_Callback free_callback )
+ {
+ CFF_Font cff = (CFF_Font)face->extra.data;
+
+
+ /* clear everything */
+ FT_ZERO( decoder );
+
+ /* initialize builder */
+ cff_builder_init( &decoder->builder, face, size, slot, hinting );
+
+ /* initialize Type2 decoder */
+ decoder->cff = cff;
+ decoder->num_globals = cff->global_subrs_index.count;
+ decoder->globals = cff->global_subrs;
+ decoder->globals_bias = cff_compute_bias(
+ cff->top_font.font_dict.charstring_type,
+ decoder->num_globals );
+
+ decoder->hint_mode = hint_mode;
+
+ decoder->get_glyph_callback = get_callback;
+ decoder->free_glyph_callback = free_callback;
+ }
+
+
+ /* this function is used to select the subfont */
+ /* and the locals subrs array */
+ FT_LOCAL_DEF( FT_Error )
+ cff_decoder_prepare( CFF_Decoder* decoder,
+ CFF_Size size,
+ FT_UInt glyph_index )
+ {
+ CFF_Builder *builder = &decoder->builder;
+ CFF_Font cff = (CFF_Font)builder->face->extra.data;
+ CFF_SubFont sub = &cff->top_font;
+ FT_Error error = FT_Err_Ok;
+
+ FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload;
+
+
+ /* manage CID fonts */
+ if ( cff->num_subfonts )
+ {
+ FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select,
+ glyph_index );
+
+
+ if ( fd_index >= cff->num_subfonts )
+ {
+ FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" ));
+ error = FT_THROW( Invalid_File_Format );
+ goto Exit;
+ }
+
+ FT_TRACE3(( " in subfont %d:\n", fd_index ));
+
+ sub = cff->subfonts[fd_index];
+
+ if ( builder->hints_funcs && size )
+ {
+ FT_Size ftsize = FT_SIZE( size );
+ CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
+
+
+ /* for CFFs without subfonts, this value has already been set */
+ builder->hints_globals = (void *)internal->subfonts[fd_index];
+ }
+ }
+
+ decoder->num_locals = sub->local_subrs_index.count;
+ decoder->locals = sub->local_subrs;
+ decoder->locals_bias = cff_compute_bias(
+ decoder->cff->top_font.font_dict.charstring_type,
+ decoder->num_locals );
+
+ decoder->glyph_width = sub->private_dict.default_width;
+ decoder->nominal_width = sub->private_dict.nominal_width;
+
+ decoder->current_subfont = sub;
+
+ Exit:
+ return error;
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/cffdecode.h b/thirdparty/freetype/src/psaux/cffdecode.h
new file mode 100644
index 0000000000..0d4f5fef63
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/cffdecode.h
@@ -0,0 +1,64 @@
+/***************************************************************************/
+/* */
+/* cffdecode.h */
+/* */
+/* PostScript CFF (Type 2) decoding routines (specification). */
+/* */
+/* Copyright 2017-2018 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef CFFDECODE_H_
+#define CFFDECODE_H_
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+
+
+FT_BEGIN_HEADER
+
+ FT_LOCAL( void )
+ cff_decoder_init( CFF_Decoder* decoder,
+ TT_Face face,
+ CFF_Size size,
+ CFF_GlyphSlot slot,
+ FT_Bool hinting,
+ FT_Render_Mode hint_mode,
+ CFF_Decoder_Get_Glyph_Callback get_callback,
+ CFF_Decoder_Free_Glyph_Callback free_callback );
+
+ FT_LOCAL( FT_Error )
+ cff_decoder_prepare( CFF_Decoder* decoder,
+ CFF_Size size,
+ FT_UInt glyph_index );
+
+
+ FT_LOCAL( FT_Int )
+ cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
+ FT_Int charcode );
+
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ FT_LOCAL( FT_Error )
+ cff_decoder_parse_charstrings( CFF_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len,
+ FT_Bool in_dict );
+#endif
+
+
+FT_END_HEADER
+
+#endif
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/module.mk b/thirdparty/freetype/src/psaux/module.mk
index c70a227166..6584d075a2 100644
--- a/thirdparty/freetype/src/psaux/module.mk
+++ b/thirdparty/freetype/src/psaux/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/psaux/psarrst.c b/thirdparty/freetype/src/psaux/psarrst.c
new file mode 100644
index 0000000000..a8780947f9
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psarrst.c
@@ -0,0 +1,241 @@
+/***************************************************************************/
+/* */
+/* psarrst.c */
+/* */
+/* Adobe's code for Array Stacks (body). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+
+#include "psglue.h"
+#include "psarrst.h"
+
+#include "pserror.h"
+
+
+ /*
+ * CF2_ArrStack uses an error pointer, to enable shared errors.
+ * Shared errors are necessary when multiple objects allow the program
+ * to continue after detecting errors. Only the first error should be
+ * recorded.
+ */
+
+ FT_LOCAL_DEF( void )
+ cf2_arrstack_init( CF2_ArrStack arrstack,
+ FT_Memory memory,
+ FT_Error* error,
+ size_t sizeItem )
+ {
+ FT_ASSERT( arrstack );
+
+ /* initialize the structure */
+ arrstack->memory = memory;
+ arrstack->error = error;
+ arrstack->sizeItem = sizeItem;
+ arrstack->allocated = 0;
+ arrstack->chunk = 10; /* chunks of 10 items */
+ arrstack->count = 0;
+ arrstack->totalSize = 0;
+ arrstack->ptr = NULL;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_arrstack_finalize( CF2_ArrStack arrstack )
+ {
+ FT_Memory memory = arrstack->memory; /* for FT_FREE */
+
+
+ FT_ASSERT( arrstack );
+
+ arrstack->allocated = 0;
+ arrstack->count = 0;
+ arrstack->totalSize = 0;
+
+ /* free the data buffer */
+ FT_FREE( arrstack->ptr );
+ }
+
+
+ /* allocate or reallocate the buffer size; */
+ /* return false on memory error */
+ static FT_Bool
+ cf2_arrstack_setNumElements( CF2_ArrStack arrstack,
+ size_t numElements )
+ {
+ FT_ASSERT( arrstack );
+
+ {
+ FT_Error error = FT_Err_Ok; /* for FT_REALLOC */
+ FT_Memory memory = arrstack->memory; /* for FT_REALLOC */
+
+ size_t newSize = numElements * arrstack->sizeItem;
+
+
+ if ( numElements > FT_LONG_MAX / arrstack->sizeItem )
+ goto exit;
+
+
+ FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */
+
+ if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
+ {
+ arrstack->allocated = numElements;
+ arrstack->totalSize = newSize;
+
+ if ( arrstack->count > numElements )
+ {
+ /* we truncated the list! */
+ CF2_SET_ERROR( arrstack->error, Stack_Overflow );
+ arrstack->count = numElements;
+ return FALSE;
+ }
+
+ return TRUE; /* success */
+ }
+ }
+
+ exit:
+ /* if there's not already an error, store this one */
+ CF2_SET_ERROR( arrstack->error, Out_Of_Memory );
+
+ return FALSE;
+ }
+
+
+ /* set the count, ensuring allocation is sufficient */
+ FT_LOCAL_DEF( void )
+ cf2_arrstack_setCount( CF2_ArrStack arrstack,
+ size_t numElements )
+ {
+ FT_ASSERT( arrstack );
+
+ if ( numElements > arrstack->allocated )
+ {
+ /* expand the allocation first */
+ if ( !cf2_arrstack_setNumElements( arrstack, numElements ) )
+ return;
+ }
+
+ arrstack->count = numElements;
+ }
+
+
+ /* clear the count */
+ FT_LOCAL_DEF( void )
+ cf2_arrstack_clear( CF2_ArrStack arrstack )
+ {
+ FT_ASSERT( arrstack );
+
+ arrstack->count = 0;
+ }
+
+
+ /* current number of items */
+ FT_LOCAL_DEF( size_t )
+ cf2_arrstack_size( const CF2_ArrStack arrstack )
+ {
+ FT_ASSERT( arrstack );
+
+ return arrstack->count;
+ }
+
+
+ FT_LOCAL_DEF( void* )
+ cf2_arrstack_getBuffer( const CF2_ArrStack arrstack )
+ {
+ FT_ASSERT( arrstack );
+
+ return arrstack->ptr;
+ }
+
+
+ /* return pointer to the given element */
+ FT_LOCAL_DEF( void* )
+ cf2_arrstack_getPointer( const CF2_ArrStack arrstack,
+ size_t idx )
+ {
+ void* newPtr;
+
+
+ FT_ASSERT( arrstack );
+
+ if ( idx >= arrstack->count )
+ {
+ /* overflow */
+ CF2_SET_ERROR( arrstack->error, Stack_Overflow );
+ idx = 0; /* choose safe default */
+ }
+
+ newPtr = (FT_Byte*)arrstack->ptr + idx * arrstack->sizeItem;
+
+ return newPtr;
+ }
+
+
+ /* push (append) an element at the end of the list; */
+ /* return false on memory error */
+ /* TODO: should there be a length param for extra checking? */
+ FT_LOCAL_DEF( void )
+ cf2_arrstack_push( CF2_ArrStack arrstack,
+ const void* ptr )
+ {
+ FT_ASSERT( arrstack );
+
+ if ( arrstack->count == arrstack->allocated )
+ {
+ /* grow the buffer by one chunk */
+ if ( !cf2_arrstack_setNumElements(
+ arrstack, arrstack->allocated + arrstack->chunk ) )
+ {
+ /* on error, ignore the push */
+ return;
+ }
+ }
+
+ FT_ASSERT( ptr );
+
+ {
+ size_t offset = arrstack->count * arrstack->sizeItem;
+ void* newPtr = (FT_Byte*)arrstack->ptr + offset;
+
+
+ FT_MEM_COPY( newPtr, ptr, arrstack->sizeItem );
+ arrstack->count += 1;
+ }
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psarrst.h b/thirdparty/freetype/src/psaux/psarrst.h
new file mode 100644
index 0000000000..b3568eb61f
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psarrst.h
@@ -0,0 +1,100 @@
+/***************************************************************************/
+/* */
+/* psarrst.h */
+/* */
+/* Adobe's code for Array Stacks (specification). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSARRST_H_
+#define PSARRST_H_
+
+
+#include "pserror.h"
+
+
+FT_BEGIN_HEADER
+
+
+ /* need to define the struct here (not opaque) so it can be allocated by */
+ /* clients */
+ typedef struct CF2_ArrStackRec_
+ {
+ FT_Memory memory;
+ FT_Error* error;
+
+ size_t sizeItem; /* bytes per element */
+ size_t allocated; /* items allocated */
+ size_t chunk; /* allocation increment in items */
+ size_t count; /* number of elements allocated */
+ size_t totalSize; /* total bytes allocated */
+
+ void* ptr; /* ptr to data */
+
+ } CF2_ArrStackRec, *CF2_ArrStack;
+
+
+ FT_LOCAL( void )
+ cf2_arrstack_init( CF2_ArrStack arrstack,
+ FT_Memory memory,
+ FT_Error* error,
+ size_t sizeItem );
+ FT_LOCAL( void )
+ cf2_arrstack_finalize( CF2_ArrStack arrstack );
+
+ FT_LOCAL( void )
+ cf2_arrstack_setCount( CF2_ArrStack arrstack,
+ size_t numElements );
+ FT_LOCAL( void )
+ cf2_arrstack_clear( CF2_ArrStack arrstack );
+ FT_LOCAL( size_t )
+ cf2_arrstack_size( const CF2_ArrStack arrstack );
+
+ FT_LOCAL( void* )
+ cf2_arrstack_getBuffer( const CF2_ArrStack arrstack );
+ FT_LOCAL( void* )
+ cf2_arrstack_getPointer( const CF2_ArrStack arrstack,
+ size_t idx );
+
+ FT_LOCAL( void )
+ cf2_arrstack_push( CF2_ArrStack arrstack,
+ const void* ptr );
+
+
+FT_END_HEADER
+
+
+#endif /* PSARRST_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psaux.c b/thirdparty/freetype/src/psaux/psaux.c
index c373aa7d5b..fb447fcdbb 100644
--- a/thirdparty/freetype/src/psaux/psaux.c
+++ b/thirdparty/freetype/src/psaux/psaux.c
@@ -4,7 +4,7 @@
/* */
/* FreeType auxiliary PostScript driver component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,6 +25,17 @@
#include "psobjs.c"
#include "t1cmap.c"
#include "t1decode.c"
+#include "cffdecode.c"
+
+#include "psarrst.c"
+#include "psblues.c"
+#include "pserror.c"
+#include "psfont.c"
+#include "psft.c"
+#include "pshints.c"
+#include "psintrp.c"
+#include "psread.c"
+#include "psstack.c"
/* END */
diff --git a/thirdparty/freetype/src/psaux/psauxerr.h b/thirdparty/freetype/src/psaux/psauxerr.h
index 1d7ac6001b..cc33fd2eea 100644
--- a/thirdparty/freetype/src/psaux/psauxerr.h
+++ b/thirdparty/freetype/src/psaux/psauxerr.h
@@ -4,7 +4,7 @@
/* */
/* PS auxiliary module error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/psauxmod.c b/thirdparty/freetype/src/psaux/psauxmod.c
index 1f589cefc2..ee497085cc 100644
--- a/thirdparty/freetype/src/psaux/psauxmod.c
+++ b/thirdparty/freetype/src/psaux/psauxmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType auxiliary PostScript module implementation (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,6 +21,8 @@
#include "psobjs.h"
#include "t1decode.h"
#include "t1cmap.h"
+#include "psft.h"
+#include "cffdecode.h"
#ifndef T1_CONFIG_OPTION_NO_AFM
#include "afmparse.h"
@@ -60,6 +62,14 @@
FT_CALLBACK_TABLE_DEF
+ const PS_Builder_FuncsRec ps_builder_funcs =
+ {
+ ps_builder_init, /* init */
+ ps_builder_done /* done */
+ };
+
+
+ FT_CALLBACK_TABLE_DEF
const T1_Builder_FuncsRec t1_builder_funcs =
{
t1_builder_init, /* init */
@@ -77,9 +87,14 @@
FT_CALLBACK_TABLE_DEF
const T1_Decoder_FuncsRec t1_decoder_funcs =
{
- t1_decoder_init, /* init */
- t1_decoder_done, /* done */
- t1_decoder_parse_charstrings /* parse_charstrings */
+ t1_decoder_init, /* init */
+ t1_decoder_done, /* done */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ t1_decoder_parse_charstrings, /* parse_charstrings_old */
+#else
+ t1_decoder_parse_metrics, /* parse_metrics */
+#endif
+ cf2_decoder_parse_charstrings /* parse_charstrings */
};
@@ -104,6 +119,34 @@
};
+ FT_CALLBACK_TABLE_DEF
+ const CFF_Builder_FuncsRec cff_builder_funcs =
+ {
+ cff_builder_init, /* init */
+ cff_builder_done, /* done */
+
+ cff_check_points, /* check_points */
+ cff_builder_add_point, /* add_point */
+ cff_builder_add_point1, /* add_point1 */
+ cff_builder_add_contour, /* add_contour */
+ cff_builder_start_point, /* start_point */
+ cff_builder_close_contour /* close_contour */
+ };
+
+
+ FT_CALLBACK_TABLE_DEF
+ const CFF_Decoder_FuncsRec cff_decoder_funcs =
+ {
+ cff_decoder_init, /* init */
+ cff_decoder_prepare, /* prepare */
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ cff_decoder_parse_charstrings, /* parse_charstrings_old */
+#endif
+ cf2_decoder_parse_charstrings /* parse_charstrings */
+ };
+
+
static
const PSAux_Interface psaux_interface =
{
@@ -112,6 +155,9 @@
&t1_builder_funcs,
&t1_decoder_funcs,
t1_decrypt,
+ cff_random,
+ ps_decoder_init,
+ t1_make_subfont,
(const T1_CMap_ClassesRec*) &t1_cmap_classes,
@@ -120,6 +166,8 @@
#else
0,
#endif
+
+ &cff_decoder_funcs,
};
diff --git a/thirdparty/freetype/src/psaux/psauxmod.h b/thirdparty/freetype/src/psaux/psauxmod.h
index 926f37eba5..f30978f022 100644
--- a/thirdparty/freetype/src/psaux/psauxmod.h
+++ b/thirdparty/freetype/src/psaux/psauxmod.h
@@ -4,7 +4,7 @@
/* */
/* FreeType auxiliary PostScript module implementation (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,6 +23,8 @@
#include <ft2build.h>
#include FT_MODULE_H
+#include FT_INTERNAL_POSTSCRIPT_AUX_H
+
FT_BEGIN_HEADER
@@ -31,6 +33,13 @@ FT_BEGIN_HEADER
#endif
+ FT_CALLBACK_TABLE
+ const CFF_Builder_FuncsRec cff_builder_funcs;
+
+ FT_CALLBACK_TABLE
+ const PS_Builder_FuncsRec ps_builder_funcs;
+
+
FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class;
diff --git a/thirdparty/freetype/src/psaux/psblues.c b/thirdparty/freetype/src/psaux/psblues.c
new file mode 100644
index 0000000000..ae39d03c77
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psblues.c
@@ -0,0 +1,582 @@
+/***************************************************************************/
+/* */
+/* psblues.c */
+/* */
+/* Adobe's code for handling Blue Zones (body). */
+/* */
+/* Copyright 2009-2014 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+
+#include "psblues.h"
+#include "pshints.h"
+#include "psfont.h"
+
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_cf2blues
+
+
+ /*
+ * For blue values, the FreeType parser produces an array of integers,
+ * while the Adobe CFF engine produces an array of fixed.
+ * Define a macro to convert FreeType to fixed.
+ */
+#define cf2_blueToFixed( x ) cf2_intToFixed( x )
+
+
+ FT_LOCAL_DEF( void )
+ cf2_blues_init( CF2_Blues blues,
+ CF2_Font font )
+ {
+ /* pointer to parsed font object */
+ PS_Decoder* decoder = font->decoder;
+
+ CF2_Fixed zoneHeight;
+ CF2_Fixed maxZoneHeight = 0;
+ CF2_Fixed csUnitsPerPixel;
+
+ size_t numBlueValues;
+ size_t numOtherBlues;
+ size_t numFamilyBlues;
+ size_t numFamilyOtherBlues;
+
+ FT_Pos* blueValues;
+ FT_Pos* otherBlues;
+ FT_Pos* familyBlues;
+ FT_Pos* familyOtherBlues;
+
+ size_t i;
+ CF2_Fixed emBoxBottom, emBoxTop;
+
+#if 0
+ CF2_Int unitsPerEm = font->unitsPerEm;
+
+
+ if ( unitsPerEm == 0 )
+ unitsPerEm = 1000;
+#endif
+
+ FT_ZERO( blues );
+ blues->scale = font->innerTransform.d;
+
+ cf2_getBlueMetrics( decoder,
+ &blues->blueScale,
+ &blues->blueShift,
+ &blues->blueFuzz );
+
+ cf2_getBlueValues( decoder, &numBlueValues, &blueValues );
+ cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues );
+ cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues );
+ cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues );
+
+ /*
+ * synthetic em box hint heuristic
+ *
+ * Apply this when ideographic dictionary (LanguageGroup 1) has no
+ * real alignment zones. Adobe tools generate dummy zones at -250 and
+ * 1100 for a 1000 unit em. Fonts with ICF-based alignment zones
+ * should not enable the heuristic. When the heuristic is enabled,
+ * the font's blue zones are ignored.
+ *
+ */
+
+ /* get em box from OS/2 typoAscender/Descender */
+ /* TODO: FreeType does not parse these metrics. Skip them for now. */
+#if 0
+ FCM_getHorizontalLineMetrics( &e,
+ font->font,
+ &ascender,
+ &descender,
+ &linegap );
+ if ( ascender - descender == unitsPerEm )
+ {
+ emBoxBottom = cf2_intToFixed( descender );
+ emBoxTop = cf2_intToFixed( ascender );
+ }
+ else
+#endif
+ {
+ emBoxBottom = CF2_ICF_Bottom;
+ emBoxTop = CF2_ICF_Top;
+ }
+
+ if ( cf2_getLanguageGroup( decoder ) == 1 &&
+ ( numBlueValues == 0 ||
+ ( numBlueValues == 4 &&
+ cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&
+ cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&
+ cf2_blueToFixed( blueValues[2] ) > emBoxTop &&
+ cf2_blueToFixed( blueValues[3] ) > emBoxTop ) ) )
+ {
+ /*
+ * Construct hint edges suitable for synthetic ghost hints at top
+ * and bottom of em box. +-CF2_MIN_COUNTER allows for unhinted
+ * features above or below the last hinted edge. This also gives a
+ * net 1 pixel boost to the height of ideographic glyphs.
+ *
+ * Note: Adjust synthetic hints outward by epsilon (0x.0001) to
+ * avoid interference. E.g., some fonts have real hints at
+ * 880 and -120.
+ */
+
+ blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON;
+ blues->emBoxBottomEdge.dsCoord = cf2_fixedRound(
+ FT_MulFix(
+ blues->emBoxBottomEdge.csCoord,
+ blues->scale ) ) -
+ CF2_MIN_COUNTER;
+ blues->emBoxBottomEdge.scale = blues->scale;
+ blues->emBoxBottomEdge.flags = CF2_GhostBottom |
+ CF2_Locked |
+ CF2_Synthetic;
+
+ blues->emBoxTopEdge.csCoord = emBoxTop + CF2_FIXED_EPSILON +
+ 2 * font->darkenY;
+ blues->emBoxTopEdge.dsCoord = cf2_fixedRound(
+ FT_MulFix(
+ blues->emBoxTopEdge.csCoord,
+ blues->scale ) ) +
+ CF2_MIN_COUNTER;
+ blues->emBoxTopEdge.scale = blues->scale;
+ blues->emBoxTopEdge.flags = CF2_GhostTop |
+ CF2_Locked |
+ CF2_Synthetic;
+
+ blues->doEmBoxHints = TRUE; /* enable the heuristic */
+
+ return;
+ }
+
+ /* copy `BlueValues' and `OtherBlues' to a combined array of top and */
+ /* bottom zones */
+ for ( i = 0; i < numBlueValues; i += 2 )
+ {
+ blues->zone[blues->count].csBottomEdge =
+ cf2_blueToFixed( blueValues[i] );
+ blues->zone[blues->count].csTopEdge =
+ cf2_blueToFixed( blueValues[i + 1] );
+
+ zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
+ blues->zone[blues->count].csBottomEdge );
+
+ if ( zoneHeight < 0 )
+ {
+ FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" ));
+ continue; /* reject this zone */
+ }
+
+ if ( zoneHeight > maxZoneHeight )
+ {
+ /* take maximum before darkening adjustment */
+ /* so overshoot suppression point doesn't change */
+ maxZoneHeight = zoneHeight;
+ }
+
+ /* adjust both edges of top zone upward by twice darkening amount */
+ if ( i != 0 )
+ {
+ blues->zone[blues->count].csTopEdge += 2 * font->darkenY;
+ blues->zone[blues->count].csBottomEdge += 2 * font->darkenY;
+ }
+
+ /* first `BlueValue' is bottom zone; others are top */
+ if ( i == 0 )
+ {
+ blues->zone[blues->count].bottomZone =
+ TRUE;
+ blues->zone[blues->count].csFlatEdge =
+ blues->zone[blues->count].csTopEdge;
+ }
+ else
+ {
+ blues->zone[blues->count].bottomZone =
+ FALSE;
+ blues->zone[blues->count].csFlatEdge =
+ blues->zone[blues->count].csBottomEdge;
+ }
+
+ blues->count += 1;
+ }
+
+ for ( i = 0; i < numOtherBlues; i += 2 )
+ {
+ blues->zone[blues->count].csBottomEdge =
+ cf2_blueToFixed( otherBlues[i] );
+ blues->zone[blues->count].csTopEdge =
+ cf2_blueToFixed( otherBlues[i + 1] );
+
+ zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
+ blues->zone[blues->count].csBottomEdge );
+
+ if ( zoneHeight < 0 )
+ {
+ FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" ));
+ continue; /* reject this zone */
+ }
+
+ if ( zoneHeight > maxZoneHeight )
+ {
+ /* take maximum before darkening adjustment */
+ /* so overshoot suppression point doesn't change */
+ maxZoneHeight = zoneHeight;
+ }
+
+ /* Note: bottom zones are not adjusted for darkening amount */
+
+ /* all OtherBlues are bottom zone */
+ blues->zone[blues->count].bottomZone =
+ TRUE;
+ blues->zone[blues->count].csFlatEdge =
+ blues->zone[blues->count].csTopEdge;
+
+ blues->count += 1;
+ }
+
+ /* Adjust for FamilyBlues */
+
+ /* Search for the nearest flat edge in `FamilyBlues' or */
+ /* `FamilyOtherBlues'. According to the Black Book, any matching edge */
+ /* must be within one device pixel */
+
+ csUnitsPerPixel = FT_DivFix( cf2_intToFixed( 1 ), blues->scale );
+
+ /* loop on all zones in this font */
+ for ( i = 0; i < blues->count; i++ )
+ {
+ size_t j;
+ CF2_Fixed minDiff;
+ CF2_Fixed flatFamilyEdge, diff;
+ /* value for this font */
+ CF2_Fixed flatEdge = blues->zone[i].csFlatEdge;
+
+
+ if ( blues->zone[i].bottomZone )
+ {
+ /* In a bottom zone, the top edge is the flat edge. */
+ /* Search `FamilyOtherBlues' for bottom zones; look for closest */
+ /* Family edge that is within the one pixel threshold. */
+
+ minDiff = CF2_FIXED_MAX;
+
+ for ( j = 0; j < numFamilyOtherBlues; j += 2 )
+ {
+ /* top edge */
+ flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
+
+ diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
+
+ if ( diff < minDiff && diff < csUnitsPerPixel )
+ {
+ blues->zone[i].csFlatEdge = flatFamilyEdge;
+ minDiff = diff;
+
+ if ( diff == 0 )
+ break;
+ }
+ }
+
+ /* check the first member of FamilyBlues, which is a bottom zone */
+ if ( numFamilyBlues >= 2 )
+ {
+ /* top edge */
+ flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
+
+ diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
+
+ if ( diff < minDiff && diff < csUnitsPerPixel )
+ blues->zone[i].csFlatEdge = flatFamilyEdge;
+ }
+ }
+ else
+ {
+ /* In a top zone, the bottom edge is the flat edge. */
+ /* Search `FamilyBlues' for top zones; skip first zone, which is a */
+ /* bottom zone; look for closest Family edge that is within the */
+ /* one pixel threshold */
+
+ minDiff = CF2_FIXED_MAX;
+
+ for ( j = 2; j < numFamilyBlues; j += 2 )
+ {
+ /* bottom edge */
+ flatFamilyEdge = cf2_blueToFixed( familyBlues[j] );
+
+ /* adjust edges of top zone upward by twice darkening amount */
+ flatFamilyEdge += 2 * font->darkenY; /* bottom edge */
+
+ diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
+
+ if ( diff < minDiff && diff < csUnitsPerPixel )
+ {
+ blues->zone[i].csFlatEdge = flatFamilyEdge;
+ minDiff = diff;
+
+ if ( diff == 0 )
+ break;
+ }
+ }
+ }
+ }
+
+ /* TODO: enforce separation of zones, including BlueFuzz */
+
+ /* Adjust BlueScale; similar to AdjustBlueScale() in coretype */
+ /* `bcsetup.c'. */
+
+ if ( maxZoneHeight > 0 )
+ {
+ if ( blues->blueScale > FT_DivFix( cf2_intToFixed( 1 ),
+ maxZoneHeight ) )
+ {
+ /* clamp at maximum scale */
+ blues->blueScale = FT_DivFix( cf2_intToFixed( 1 ),
+ maxZoneHeight );
+ }
+
+ /*
+ * TODO: Revisit the bug fix for 613448. The minimum scale
+ * requirement catches a number of library fonts. For
+ * example, with default BlueScale (.039625) and 0.4 minimum,
+ * the test below catches any font with maxZoneHeight < 10.1.
+ * There are library fonts ranging from 2 to 10 that get
+ * caught, including e.g., Eurostile LT Std Medium with
+ * maxZoneHeight of 6.
+ *
+ */
+#if 0
+ if ( blueScale < .4 / maxZoneHeight )
+ {
+ tetraphilia_assert( 0 );
+ /* clamp at minimum scale, per bug 0613448 fix */
+ blueScale = .4 / maxZoneHeight;
+ }
+#endif
+
+ }
+
+ /*
+ * Suppress overshoot and boost blue zones at small sizes. Boost
+ * amount varies linearly from 0.5 pixel near 0 to 0 pixel at
+ * blueScale cutoff.
+ * Note: This boost amount is different from the coretype heuristic.
+ *
+ */
+
+ if ( blues->scale < blues->blueScale )
+ {
+ blues->suppressOvershoot = TRUE;
+
+ /* Change rounding threshold for `dsFlatEdge'. */
+ /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
+ /* 10ppem Arial */
+
+ blues->boost = cf2_doubleToFixed( .6 ) -
+ FT_MulDiv( cf2_doubleToFixed ( .6 ),
+ blues->scale,
+ blues->blueScale );
+ if ( blues->boost > 0x7FFF )
+ {
+ /* boost must remain less than 0.5, or baseline could go negative */
+ blues->boost = 0x7FFF;
+ }
+ }
+
+ /* boost and darkening have similar effects; don't do both */
+ if ( font->stemDarkened )
+ blues->boost = 0;
+
+ /* set device space alignment for each zone; */
+ /* apply boost amount before rounding flat edge */
+
+ for ( i = 0; i < blues->count; i++ )
+ {
+ if ( blues->zone[i].bottomZone )
+ blues->zone[i].dsFlatEdge = cf2_fixedRound(
+ FT_MulFix(
+ blues->zone[i].csFlatEdge,
+ blues->scale ) -
+ blues->boost );
+ else
+ blues->zone[i].dsFlatEdge = cf2_fixedRound(
+ FT_MulFix(
+ blues->zone[i].csFlatEdge,
+ blues->scale ) +
+ blues->boost );
+ }
+ }
+
+
+ /*
+ * Check whether `stemHint' is captured by one of the blue zones.
+ *
+ * Zero, one or both edges may be valid; only valid edges can be
+ * captured. For compatibility with CoolType, search top and bottom
+ * zones in the same pass (see `BlueLock'). If a hint is captured,
+ * return true and position the edge(s) in one of 3 ways:
+ *
+ * 1) If `BlueScale' suppresses overshoot, position the captured edge
+ * at the flat edge of the zone.
+ * 2) If overshoot is not suppressed and `BlueShift' requires
+ * overshoot, position the captured edge a minimum of 1 device pixel
+ * from the flat edge.
+ * 3) If overshoot is not suppressed or required, position the captured
+ * edge at the nearest device pixel.
+ *
+ */
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_blues_capture( const CF2_Blues blues,
+ CF2_Hint bottomHintEdge,
+ CF2_Hint topHintEdge )
+ {
+ /* TODO: validate? */
+ CF2_Fixed csFuzz = blues->blueFuzz;
+
+ /* new position of captured edge */
+ CF2_Fixed dsNew;
+
+ /* amount that hint is moved when positioned */
+ CF2_Fixed dsMove = 0;
+
+ FT_Bool captured = FALSE;
+ CF2_UInt i;
+
+
+ /* assert edge flags are consistent */
+ FT_ASSERT( !cf2_hint_isTop( bottomHintEdge ) &&
+ !cf2_hint_isBottom( topHintEdge ) );
+
+ /* TODO: search once without blue fuzz for compatibility with coretype? */
+ for ( i = 0; i < blues->count; i++ )
+ {
+ if ( blues->zone[i].bottomZone &&
+ cf2_hint_isBottom( bottomHintEdge ) )
+ {
+ if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <=
+ bottomHintEdge->csCoord &&
+ bottomHintEdge->csCoord <=
+ ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) )
+ {
+ /* bottom edge captured by bottom zone */
+
+ if ( blues->suppressOvershoot )
+ dsNew = blues->zone[i].dsFlatEdge;
+
+ else if ( SUB_INT32( blues->zone[i].csTopEdge,
+ bottomHintEdge->csCoord ) >=
+ blues->blueShift )
+ {
+ /* guarantee minimum of 1 pixel overshoot */
+ dsNew = FT_MIN(
+ cf2_fixedRound( bottomHintEdge->dsCoord ),
+ blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) );
+ }
+
+ else
+ {
+ /* simply round captured edge */
+ dsNew = cf2_fixedRound( bottomHintEdge->dsCoord );
+ }
+
+ dsMove = SUB_INT32( dsNew, bottomHintEdge->dsCoord );
+ captured = TRUE;
+
+ break;
+ }
+ }
+
+ if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) )
+ {
+ if ( SUB_INT32( blues->zone[i].csBottomEdge, csFuzz ) <=
+ topHintEdge->csCoord &&
+ topHintEdge->csCoord <=
+ ADD_INT32( blues->zone[i].csTopEdge, csFuzz ) )
+ {
+ /* top edge captured by top zone */
+
+ if ( blues->suppressOvershoot )
+ dsNew = blues->zone[i].dsFlatEdge;
+
+ else if ( SUB_INT32( topHintEdge->csCoord,
+ blues->zone[i].csBottomEdge ) >=
+ blues->blueShift )
+ {
+ /* guarantee minimum of 1 pixel overshoot */
+ dsNew = FT_MAX(
+ cf2_fixedRound( topHintEdge->dsCoord ),
+ blues->zone[i].dsFlatEdge + cf2_intToFixed( 1 ) );
+ }
+
+ else
+ {
+ /* simply round captured edge */
+ dsNew = cf2_fixedRound( topHintEdge->dsCoord );
+ }
+
+ dsMove = SUB_INT32( dsNew, topHintEdge->dsCoord );
+ captured = TRUE;
+
+ break;
+ }
+ }
+ }
+
+ if ( captured )
+ {
+ /* move both edges and flag them `locked' */
+ if ( cf2_hint_isValid( bottomHintEdge ) )
+ {
+ bottomHintEdge->dsCoord = ADD_INT32( bottomHintEdge->dsCoord,
+ dsMove );
+ cf2_hint_lock( bottomHintEdge );
+ }
+
+ if ( cf2_hint_isValid( topHintEdge ) )
+ {
+ topHintEdge->dsCoord = ADD_INT32( topHintEdge->dsCoord, dsMove );
+ cf2_hint_lock( topHintEdge );
+ }
+ }
+
+ return captured;
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psblues.h b/thirdparty/freetype/src/psaux/psblues.h
new file mode 100644
index 0000000000..25ef6849c7
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psblues.h
@@ -0,0 +1,185 @@
+/***************************************************************************/
+/* */
+/* psblues.h */
+/* */
+/* Adobe's code for handling Blue Zones (specification). */
+/* */
+/* Copyright 2009-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+ /*
+ * A `CF2_Blues' object stores the blue zones (horizontal alignment
+ * zones) of a font. These are specified in the CFF private dictionary
+ * by `BlueValues', `OtherBlues', `FamilyBlues', and `FamilyOtherBlues'.
+ * Each zone is defined by a top and bottom edge in character space.
+ * Further, each zone is either a top zone or a bottom zone, as recorded
+ * by `bottomZone'.
+ *
+ * The maximum number of `BlueValues' and `FamilyBlues' is 7 each.
+ * However, these are combined to produce a total of 7 zones.
+ * Similarly, the maximum number of `OtherBlues' and `FamilyOtherBlues'
+ * is 5 and these are combined to produce an additional 5 zones.
+ *
+ * Blue zones are used to `capture' hints and force them to a common
+ * alignment point. This alignment is recorded in device space in
+ * `dsFlatEdge'. Except for this value, a `CF2_Blues' object could be
+ * constructed independently of scaling. Construction may occur once
+ * the matrix is known. Other features implemented in the Capture
+ * method are overshoot suppression, overshoot enforcement, and Blue
+ * Boost.
+ *
+ * Capture is determined by `BlueValues' and `OtherBlues', but the
+ * alignment point may be adjusted to the scaled flat edge of
+ * `FamilyBlues' or `FamilyOtherBlues'. No alignment is done to the
+ * curved edge of a zone.
+ *
+ */
+
+
+#ifndef PSBLUES_H_
+#define PSBLUES_H_
+
+
+#include "psglue.h"
+
+
+FT_BEGIN_HEADER
+
+
+ /*
+ * `CF2_Hint' is shared by `cf2hints.h' and
+ * `cf2blues.h', but `cf2blues.h' depends on
+ * `cf2hints.h', so define it here. Note: The typedef is in
+ * `cf2glue.h'.
+ *
+ */
+ enum
+ {
+ CF2_GhostBottom = 0x1, /* a single bottom edge */
+ CF2_GhostTop = 0x2, /* a single top edge */
+ CF2_PairBottom = 0x4, /* the bottom edge of a stem hint */
+ CF2_PairTop = 0x8, /* the top edge of a stem hint */
+ CF2_Locked = 0x10, /* this edge has been aligned */
+ /* by a blue zone */
+ CF2_Synthetic = 0x20 /* this edge was synthesized */
+ };
+
+
+ /*
+ * Default value for OS/2 typoAscender/Descender when their difference
+ * is not equal to `unitsPerEm'. The default is based on -250 and 1100
+ * in `CF2_Blues', assuming 1000 units per em here.
+ *
+ */
+ enum
+ {
+ CF2_ICF_Top = cf2_intToFixed( 880 ),
+ CF2_ICF_Bottom = cf2_intToFixed( -120 )
+ };
+
+
+ /*
+ * Constant used for hint adjustment and for synthetic em box hint
+ * placement.
+ */
+#define CF2_MIN_COUNTER cf2_doubleToFixed( 0.5 )
+
+
+ /* shared typedef is in cf2glue.h */
+ struct CF2_HintRec_
+ {
+ CF2_UInt flags; /* attributes of the edge */
+ size_t index; /* index in original stem hint array */
+ /* (if not synthetic) */
+ CF2_Fixed csCoord;
+ CF2_Fixed dsCoord;
+ CF2_Fixed scale;
+ };
+
+
+ typedef struct CF2_BlueRec_
+ {
+ CF2_Fixed csBottomEdge;
+ CF2_Fixed csTopEdge;
+ CF2_Fixed csFlatEdge; /* may be from either local or Family zones */
+ CF2_Fixed dsFlatEdge; /* top edge of bottom zone or bottom edge */
+ /* of top zone (rounded) */
+ FT_Bool bottomZone;
+
+ } CF2_BlueRec;
+
+
+ /* max total blue zones is 12 */
+ enum
+ {
+ CF2_MAX_BLUES = 7,
+ CF2_MAX_OTHERBLUES = 5
+ };
+
+
+ typedef struct CF2_BluesRec_
+ {
+ CF2_Fixed scale;
+ CF2_UInt count;
+ FT_Bool suppressOvershoot;
+ FT_Bool doEmBoxHints;
+
+ CF2_Fixed blueScale;
+ CF2_Fixed blueShift;
+ CF2_Fixed blueFuzz;
+
+ CF2_Fixed boost;
+
+ CF2_HintRec emBoxTopEdge;
+ CF2_HintRec emBoxBottomEdge;
+
+ CF2_BlueRec zone[CF2_MAX_BLUES + CF2_MAX_OTHERBLUES];
+
+ } CF2_BluesRec, *CF2_Blues;
+
+
+ FT_LOCAL( void )
+ cf2_blues_init( CF2_Blues blues,
+ CF2_Font font );
+ FT_LOCAL( FT_Bool )
+ cf2_blues_capture( const CF2_Blues blues,
+ CF2_Hint bottomHintEdge,
+ CF2_Hint topHintEdge );
+
+
+FT_END_HEADER
+
+
+#endif /* PSBLUES_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psconv.c b/thirdparty/freetype/src/psaux/psconv.c
index d125b0834a..a03385000d 100644
--- a/thirdparty/freetype/src/psaux/psconv.c
+++ b/thirdparty/freetype/src/psaux/psconv.c
@@ -4,7 +4,7 @@
/* */
/* Some convenience conversions (body). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/psconv.h b/thirdparty/freetype/src/psaux/psconv.h
index cab254ac5a..d643ffcfc2 100644
--- a/thirdparty/freetype/src/psaux/psconv.h
+++ b/thirdparty/freetype/src/psaux/psconv.h
@@ -4,7 +4,7 @@
/* */
/* Some convenience conversions (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/pserror.c b/thirdparty/freetype/src/psaux/pserror.c
new file mode 100644
index 0000000000..9169e5222d
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/pserror.c
@@ -0,0 +1,52 @@
+/***************************************************************************/
+/* */
+/* pserror.c */
+/* */
+/* Adobe's code for error handling (body). */
+/* */
+/* Copyright 2006-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include "pserror.h"
+
+
+ FT_LOCAL_DEF( void )
+ cf2_setError( FT_Error* error,
+ FT_Error value )
+ {
+ if ( error && !*error )
+ *error = value;
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/pserror.h b/thirdparty/freetype/src/psaux/pserror.h
new file mode 100644
index 0000000000..13d52062bf
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/pserror.h
@@ -0,0 +1,119 @@
+/***************************************************************************/
+/* */
+/* pserror.h */
+/* */
+/* Adobe's code for error handling (specification). */
+/* */
+/* Copyright 2006-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSERROR_H_
+#define PSERROR_H_
+
+
+#include FT_MODULE_ERRORS_H
+
+#undef FTERRORS_H_
+
+#undef FT_ERR_PREFIX
+#define FT_ERR_PREFIX CF2_Err_
+#define FT_ERR_BASE FT_Mod_Err_CF2
+
+
+#include FT_ERRORS_H
+#include "psft.h"
+
+
+FT_BEGIN_HEADER
+
+
+ /*
+ * A poor-man error facility.
+ *
+ * This code being written in vanilla C, doesn't have the luxury of a
+ * language-supported exception mechanism such as the one available in
+ * Java. Instead, we are stuck with using error codes that must be
+ * carefully managed and preserved. However, it is convenient for us to
+ * model our error mechanism on a Java-like exception mechanism.
+ * When we assign an error code we are thus `throwing' an error.
+ *
+ * The preservation of an error code is done by coding convention.
+ * Upon a function call if the error code is anything other than
+ * `FT_Err_Ok', which is guaranteed to be zero, we
+ * will return without altering that error. This will allow the
+ * error to propagate and be handled at the appropriate location in
+ * the code.
+ *
+ * This allows a style of code where the error code is initialized
+ * up front and a block of calls are made with the error code only
+ * being checked after the block. If a new error occurs, the original
+ * error will be preserved and a functional no-op should result in any
+ * subsequent function that has an initial error code not equal to
+ * `FT_Err_Ok'.
+ *
+ * Errors are encoded by calling the `FT_THROW' macro. For example,
+ *
+ * {
+ * FT_Error e;
+ *
+ *
+ * ...
+ * e = FT_THROW( Out_Of_Memory );
+ * }
+ *
+ */
+
+
+ /* Set error code to a particular value. */
+ FT_LOCAL( void )
+ cf2_setError( FT_Error* error,
+ FT_Error value );
+
+
+ /*
+ * A macro that conditionally sets an error code.
+ *
+ * This macro will first check whether `error' is set;
+ * if not, it will set it to `e'.
+ *
+ */
+#define CF2_SET_ERROR( error, e ) \
+ cf2_setError( error, FT_THROW( e ) )
+
+
+FT_END_HEADER
+
+
+#endif /* PSERROR_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psfixed.h b/thirdparty/freetype/src/psaux/psfixed.h
new file mode 100644
index 0000000000..219589e7fc
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psfixed.h
@@ -0,0 +1,95 @@
+/***************************************************************************/
+/* */
+/* psfixed.h */
+/* */
+/* Adobe's code for Fixed Point Mathematics (specification only). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSFIXED_H_
+#define PSFIXED_H_
+
+
+FT_BEGIN_HEADER
+
+
+ /* rasterizer integer and fixed point arithmetic must be 32-bit */
+
+#define CF2_Fixed CF2_F16Dot16
+ typedef FT_Int32 CF2_Frac; /* 2.30 fixed point */
+
+
+#define CF2_FIXED_MAX ( (CF2_Fixed)0x7FFFFFFFL )
+#define CF2_FIXED_MIN ( (CF2_Fixed)0x80000000L )
+#define CF2_FIXED_ONE ( (CF2_Fixed)0x10000L )
+#define CF2_FIXED_EPSILON ( (CF2_Fixed)0x0001 )
+
+ /* in C 89, left and right shift of negative numbers is */
+ /* implementation specific behaviour in the general case */
+
+#define cf2_intToFixed( i ) \
+ ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) )
+#define cf2_fixedToInt( x ) \
+ ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
+#define cf2_fixedRound( x ) \
+ ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
+#define cf2_doubleToFixed( f ) \
+ ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
+#define cf2_fixedAbs( x ) \
+ ( (x) < 0 ? NEG_INT32( x ) : (x) )
+#define cf2_fixedFloor( x ) \
+ ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
+#define cf2_fixedFraction( x ) \
+ ( (x) - cf2_fixedFloor( x ) )
+#define cf2_fracToFixed( x ) \
+ ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \
+ : ( ( (x) + 0x2000 ) >> 14 ) )
+
+
+ /* signed numeric types */
+ typedef enum CF2_NumberType_
+ {
+ CF2_NumberFixed, /* 16.16 */
+ CF2_NumberFrac, /* 2.30 */
+ CF2_NumberInt /* 32.0 */
+
+ } CF2_NumberType;
+
+
+FT_END_HEADER
+
+
+#endif /* PSFIXED_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psfont.c b/thirdparty/freetype/src/psaux/psfont.c
new file mode 100644
index 0000000000..dde67a739d
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psfont.c
@@ -0,0 +1,567 @@
+/***************************************************************************/
+/* */
+/* psfont.c */
+/* */
+/* Adobe's code for font instances (body). */
+/* */
+/* Copyright 2007-2014 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_CALC_H
+
+#include "psft.h"
+
+#include "psglue.h"
+#include "psfont.h"
+#include "pserror.h"
+#include "psintrp.h"
+
+
+ /* Compute a stem darkening amount in character space. */
+ static void
+ cf2_computeDarkening( CF2_Fixed emRatio,
+ CF2_Fixed ppem,
+ CF2_Fixed stemWidth,
+ CF2_Fixed* darkenAmount,
+ CF2_Fixed boldenAmount,
+ FT_Bool stemDarkened,
+ FT_Int* darkenParams )
+ {
+ /*
+ * Total darkening amount is computed in 1000 unit character space
+ * using the modified 5 part curve as Adobe's Avalon rasterizer.
+ * The darkening amount is smaller for thicker stems.
+ * It becomes zero when the stem is thicker than 2.333 pixels.
+ *
+ * By default, we use
+ *
+ * darkenAmount = 0.4 pixels if scaledStem <= 0.5 pixels,
+ * darkenAmount = 0.275 pixels if 1 <= scaledStem <= 1.667 pixels,
+ * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels,
+ *
+ * and piecewise linear in-between:
+ *
+ *
+ * darkening
+ * ^
+ * |
+ * | (x1,y1)
+ * |--------+
+ * | \
+ * | \
+ * | \ (x3,y3)
+ * | +----------+
+ * | (x2,y2) \
+ * | \
+ * | \
+ * | +-----------------
+ * | (x4,y4)
+ * +---------------------------------------------> stem
+ * thickness
+ *
+ *
+ * This corresponds to the following values for the
+ * `darkening-parameters' property:
+ *
+ * (x1, y1) = (500, 400)
+ * (x2, y2) = (1000, 275)
+ * (x3, y3) = (1667, 275)
+ * (x4, y4) = (2333, 0)
+ *
+ */
+
+ /* Internal calculations are done in units per thousand for */
+ /* convenience. The x axis is scaled stem width in */
+ /* thousandths of a pixel. That is, 1000 is 1 pixel. */
+ /* The y axis is darkening amount in thousandths of a pixel.*/
+ /* In the code, below, dividing by ppem and */
+ /* adjusting for emRatio converts darkenAmount to character */
+ /* space (font units). */
+ CF2_Fixed stemWidthPer1000, scaledStem;
+ FT_Int logBase2;
+
+
+ *darkenAmount = 0;
+
+ if ( boldenAmount == 0 && !stemDarkened )
+ return;
+
+ /* protect against range problems and divide by zero */
+ if ( emRatio < cf2_doubleToFixed( .01 ) )
+ return;
+
+ if ( stemDarkened )
+ {
+ FT_Int x1 = darkenParams[0];
+ FT_Int y1 = darkenParams[1];
+ FT_Int x2 = darkenParams[2];
+ FT_Int y2 = darkenParams[3];
+ FT_Int x3 = darkenParams[4];
+ FT_Int y3 = darkenParams[5];
+ FT_Int x4 = darkenParams[6];
+ FT_Int y4 = darkenParams[7];
+
+
+ /* convert from true character space to 1000 unit character space; */
+ /* add synthetic emboldening effect */
+
+ /* `stemWidthPer1000' will not overflow for a legitimate font */
+
+ stemWidthPer1000 = FT_MulFix( stemWidth + boldenAmount, emRatio );
+
+ /* `scaledStem' can easily overflow, so we must clamp its maximum */
+ /* value; the test doesn't need to be precise, but must be */
+ /* conservative. The clamp value (default 2333) where */
+ /* `darkenAmount' is zero is well below the overflow value of */
+ /* 32767. */
+ /* */
+ /* FT_MSB computes the integer part of the base 2 logarithm. The */
+ /* number of bits for the product is 1 or 2 more than the sum of */
+ /* logarithms; remembering that the 16 lowest bits of the fraction */
+ /* are dropped this is correct to within a factor of almost 4. */
+ /* For example, 0x80.0000 * 0x80.0000 = 0x4000.0000 is 23+23 and */
+ /* is flagged as possible overflow because 0xFF.FFFF * 0xFF.FFFF = */
+ /* 0xFFFF.FE00 is also 23+23. */
+
+ logBase2 = FT_MSB( (FT_UInt32)stemWidthPer1000 ) +
+ FT_MSB( (FT_UInt32)ppem );
+
+ if ( logBase2 >= 46 )
+ /* possible overflow */
+ scaledStem = cf2_intToFixed( x4 );
+ else
+ scaledStem = FT_MulFix( stemWidthPer1000, ppem );
+
+ /* now apply the darkening parameters */
+
+ if ( scaledStem < cf2_intToFixed( x1 ) )
+ *darkenAmount = FT_DivFix( cf2_intToFixed( y1 ), ppem );
+
+ else if ( scaledStem < cf2_intToFixed( x2 ) )
+ {
+ FT_Int xdelta = x2 - x1;
+ FT_Int ydelta = y2 - y1;
+ FT_Int x = stemWidthPer1000 -
+ FT_DivFix( cf2_intToFixed( x1 ), ppem );
+
+
+ if ( !xdelta )
+ goto Try_x3;
+
+ *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
+ FT_DivFix( cf2_intToFixed( y1 ), ppem );
+ }
+
+ else if ( scaledStem < cf2_intToFixed( x3 ) )
+ {
+ Try_x3:
+ {
+ FT_Int xdelta = x3 - x2;
+ FT_Int ydelta = y3 - y2;
+ FT_Int x = stemWidthPer1000 -
+ FT_DivFix( cf2_intToFixed( x2 ), ppem );
+
+
+ if ( !xdelta )
+ goto Try_x4;
+
+ *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
+ FT_DivFix( cf2_intToFixed( y2 ), ppem );
+ }
+ }
+
+ else if ( scaledStem < cf2_intToFixed( x4 ) )
+ {
+ Try_x4:
+ {
+ FT_Int xdelta = x4 - x3;
+ FT_Int ydelta = y4 - y3;
+ FT_Int x = stemWidthPer1000 -
+ FT_DivFix( cf2_intToFixed( x3 ), ppem );
+
+
+ if ( !xdelta )
+ goto Use_y4;
+
+ *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
+ FT_DivFix( cf2_intToFixed( y3 ), ppem );
+ }
+ }
+
+ else
+ {
+ Use_y4:
+ *darkenAmount = FT_DivFix( cf2_intToFixed( y4 ), ppem );
+ }
+
+ /* use half the amount on each side and convert back to true */
+ /* character space */
+ *darkenAmount = FT_DivFix( *darkenAmount, 2 * emRatio );
+ }
+
+ /* add synthetic emboldening effect in character space */
+ *darkenAmount += boldenAmount / 2;
+ }
+
+
+ /* set up values for the current FontDict and matrix; */
+ /* called for each glyph to be rendered */
+
+ /* caller's transform is adjusted for subpixel positioning */
+ static void
+ cf2_font_setup( CF2_Font font,
+ const CF2_Matrix* transform )
+ {
+ /* pointer to parsed font object */
+ PS_Decoder* decoder = font->decoder;
+
+ FT_Bool needExtraSetup = FALSE;
+
+ CFF_VStoreRec* vstore;
+ FT_Bool hasVariations = FALSE;
+
+ /* character space units */
+ CF2_Fixed boldenX = font->syntheticEmboldeningAmountX;
+ CF2_Fixed boldenY = font->syntheticEmboldeningAmountY;
+
+ CFF_SubFont subFont;
+ CF2_Fixed ppem;
+
+ CF2_UInt lenNormalizedV = 0;
+ FT_Fixed* normalizedV = NULL;
+
+ /* clear previous error */
+ font->error = FT_Err_Ok;
+
+ /* if a CID fontDict has changed, we need to recompute some cached */
+ /* data */
+ subFont = cf2_getSubfont( decoder );
+ if ( font->lastSubfont != subFont )
+ {
+ font->lastSubfont = subFont;
+ needExtraSetup = TRUE;
+ }
+
+ if ( !font->isT1 )
+ {
+ FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload;
+
+
+ /* check for variation vectors */
+ vstore = cf2_getVStore( decoder );
+ hasVariations = ( vstore->dataCount != 0 );
+
+ if ( hasVariations )
+ {
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ /* check whether Private DICT in this subfont needs to be reparsed */
+ font->error = cf2_getNormalizedVector( decoder,
+ &lenNormalizedV,
+ &normalizedV );
+ if ( font->error )
+ return;
+
+ if ( cffload->blend_check_vector( &subFont->blend,
+ subFont->private_dict.vsindex,
+ lenNormalizedV,
+ normalizedV ) )
+ {
+ /* blend has changed, reparse */
+ cffload->load_private_dict( decoder->cff,
+ subFont,
+ lenNormalizedV,
+ normalizedV );
+ needExtraSetup = TRUE;
+ }
+#endif
+
+ /* copy from subfont */
+ font->blend.font = subFont->blend.font;
+
+ /* clear state of charstring blend */
+ font->blend.usedBV = FALSE;
+
+ /* initialize value for charstring */
+ font->vsindex = subFont->private_dict.vsindex;
+
+ /* store vector inputs for blends in charstring */
+ font->lenNDV = lenNormalizedV;
+ font->NDV = normalizedV;
+ }
+ }
+
+ /* if ppem has changed, we need to recompute some cached data */
+ /* note: because of CID font matrix concatenation, ppem and transform */
+ /* do not necessarily track. */
+ ppem = cf2_getPpemY( decoder );
+ if ( font->ppem != ppem )
+ {
+ font->ppem = ppem;
+ needExtraSetup = TRUE;
+ }
+
+ /* copy hinted flag on each call */
+ font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted );
+
+ /* determine if transform has changed; */
+ /* include Fontmatrix but ignore translation */
+ if ( ft_memcmp( transform,
+ &font->currentTransform,
+ 4 * sizeof ( CF2_Fixed ) ) != 0 )
+ {
+ /* save `key' information for `cache of one' matrix data; */
+ /* save client transform, without the translation */
+ font->currentTransform = *transform;
+ font->currentTransform.tx =
+ font->currentTransform.ty = cf2_intToFixed( 0 );
+
+ /* TODO: FreeType transform is simple scalar; for now, use identity */
+ /* for outer */
+ font->innerTransform = *transform;
+ font->outerTransform.a =
+ font->outerTransform.d = cf2_intToFixed( 1 );
+ font->outerTransform.b =
+ font->outerTransform.c = cf2_intToFixed( 0 );
+
+ needExtraSetup = TRUE;
+ }
+
+ /*
+ * font->darkened is set to true if there is a stem darkening request or
+ * the font is synthetic emboldened.
+ * font->darkened controls whether to adjust blue zones, winding order,
+ * and hinting.
+ *
+ */
+ if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) )
+ {
+ font->stemDarkened =
+ (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened );
+
+ /* blue zones depend on darkened flag */
+ needExtraSetup = TRUE;
+ }
+
+ /* recompute variables that are dependent on transform or FontDict or */
+ /* darken flag */
+ if ( needExtraSetup )
+ {
+ /* StdVW is found in the private dictionary; */
+ /* recompute darkening amounts whenever private dictionary or */
+ /* transform change */
+ /* Note: a rendering flag turns darkening on or off, so we want to */
+ /* store the `on' amounts; */
+ /* darkening amount is computed in character space */
+ /* TODO: testing size-dependent darkening here; */
+ /* what to do for rotations? */
+
+ CF2_Fixed emRatio;
+ CF2_Fixed stdHW;
+ CF2_Int unitsPerEm = font->unitsPerEm;
+
+
+ if ( unitsPerEm == 0 )
+ unitsPerEm = 1000;
+
+ ppem = FT_MAX( cf2_intToFixed( 4 ),
+ font->ppem ); /* use minimum ppem of 4 */
+
+#if 0
+ /* since vstem is measured in the x-direction, we use the `a' member */
+ /* of the fontMatrix */
+ emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->a );
+#endif
+
+ /* Freetype does not preserve the fontMatrix when parsing; use */
+ /* unitsPerEm instead. */
+ /* TODO: check precision of this */
+ emRatio = cf2_intToFixed( 1000 ) / unitsPerEm;
+ font->stdVW = cf2_getStdVW( decoder );
+
+ if ( font->stdVW <= 0 )
+ font->stdVW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
+
+ if ( boldenX > 0 )
+ {
+ /* Ensure that boldenX is at least 1 pixel for synthetic bold font */
+ /* (similar to what Avalon does) */
+ boldenX = FT_MAX( boldenX,
+ FT_DivFix( cf2_intToFixed( unitsPerEm ), ppem ) );
+
+ /* Synthetic emboldening adds at least 1 pixel to darkenX, while */
+ /* stem darkening adds at most half pixel. Since the purpose of */
+ /* stem darkening (readability at small sizes) is met with */
+ /* synthetic emboldening, no need to add stem darkening for a */
+ /* synthetic bold font. */
+ cf2_computeDarkening( emRatio,
+ ppem,
+ font->stdVW,
+ &font->darkenX,
+ boldenX,
+ FALSE,
+ font->darkenParams );
+ }
+ else
+ cf2_computeDarkening( emRatio,
+ ppem,
+ font->stdVW,
+ &font->darkenX,
+ 0,
+ font->stemDarkened,
+ font->darkenParams );
+
+#if 0
+ /* since hstem is measured in the y-direction, we use the `d' member */
+ /* of the fontMatrix */
+ /* TODO: use the same units per em as above; check this */
+ emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->d );
+#endif
+
+ /* set the default stem width, because it must be the same for all */
+ /* family members; */
+ /* choose a constant for StdHW that depends on font contrast */
+ stdHW = cf2_getStdHW( decoder );
+
+ if ( stdHW > 0 && font->stdVW > MUL_INT32( 2, stdHW ) )
+ font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
+ else
+ {
+ /* low contrast font gets less hstem darkening */
+ font->stdHW = FT_DivFix( cf2_intToFixed( 110 ), emRatio );
+ }
+
+ cf2_computeDarkening( emRatio,
+ ppem,
+ font->stdHW,
+ &font->darkenY,
+ boldenY,
+ font->stemDarkened,
+ font->darkenParams );
+
+ if ( font->darkenX != 0 || font->darkenY != 0 )
+ font->darkened = TRUE;
+ else
+ font->darkened = FALSE;
+
+ font->reverseWinding = FALSE; /* initial expectation is CCW */
+
+ /* compute blue zones for this instance */
+ cf2_blues_init( &font->blues, font );
+
+ } /* needExtraSetup */
+ }
+
+
+ /* equivalent to AdobeGetOutline */
+ FT_LOCAL_DEF( FT_Error )
+ cf2_getGlyphOutline( CF2_Font font,
+ CF2_Buffer charstring,
+ const CF2_Matrix* transform,
+ CF2_F16Dot16* glyphWidth )
+ {
+ FT_Error lastError = FT_Err_Ok;
+
+ FT_Vector translation;
+
+#if 0
+ FT_Vector advancePoint;
+#endif
+
+ CF2_Fixed advWidth = 0;
+ FT_Bool needWinding;
+
+
+ /* Note: use both integer and fraction for outlines. This allows bbox */
+ /* to come out directly. */
+
+ translation.x = transform->tx;
+ translation.y = transform->ty;
+
+ /* set up values based on transform */
+ cf2_font_setup( font, transform );
+ if ( font->error )
+ goto exit; /* setup encountered an error */
+
+ /* reset darken direction */
+ font->reverseWinding = FALSE;
+
+ /* winding order only affects darkening */
+ needWinding = font->darkened;
+
+ while ( 1 )
+ {
+ /* reset output buffer */
+ cf2_outline_reset( &font->outline );
+
+ /* build the outline, passing the full translation */
+ cf2_interpT2CharString( font,
+ charstring,
+ (CF2_OutlineCallbacks)&font->outline,
+ &translation,
+ FALSE,
+ 0,
+ 0,
+ &advWidth );
+
+ if ( font->error )
+ goto exit;
+
+ if ( !needWinding )
+ break;
+
+ /* check winding order */
+ if ( font->outline.root.windingMomentum >= 0 ) /* CFF is CCW */
+ break;
+
+ /* invert darkening and render again */
+ /* TODO: this should be a parameter to getOutline-computeOffset */
+ font->reverseWinding = TRUE;
+
+ needWinding = FALSE; /* exit after next iteration */
+ }
+
+ /* finish storing client outline */
+ cf2_outline_close( &font->outline );
+
+ exit:
+ /* FreeType just wants the advance width; there is no translation */
+ *glyphWidth = advWidth;
+
+ /* free resources and collect errors from objects we've used */
+ cf2_setError( &font->error, lastError );
+
+ return font->error;
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psfont.h b/thirdparty/freetype/src/psaux/psfont.h
new file mode 100644
index 0000000000..e611ac4bdc
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psfont.h
@@ -0,0 +1,134 @@
+/***************************************************************************/
+/* */
+/* psfont.h */
+/* */
+/* Adobe's code for font instances (specification). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSFONT_H_
+#define PSFONT_H_
+
+
+#include FT_SERVICE_CFF_TABLE_LOAD_H
+
+#include "psft.h"
+#include "psblues.h"
+
+
+FT_BEGIN_HEADER
+
+
+#define CF2_OPERAND_STACK_SIZE 48
+#define CF2_MAX_SUBR 16 /* maximum subroutine nesting; */
+ /* only 10 are allowed but there exist */
+ /* fonts like `HiraKakuProN-W3.ttf' */
+ /* (Hiragino Kaku Gothic ProN W3; */
+ /* 8.2d6e1; 2014-12-19) that exceed */
+ /* this limit */
+#define CF2_STORAGE_SIZE 32
+
+
+ /* typedef is in `cf2glue.h' */
+ struct CF2_FontRec_
+ {
+ FT_Memory memory;
+ FT_Error error; /* shared error for this instance */
+
+ FT_Bool isT1;
+ FT_Bool isCFF2;
+ CF2_RenderingFlags renderingFlags;
+
+ /* variables that depend on Transform: */
+ /* the following have zero translation; */
+ /* inner * outer = font * original */
+
+ CF2_Matrix currentTransform; /* original client matrix */
+ CF2_Matrix innerTransform; /* for hinting; erect, scaled */
+ CF2_Matrix outerTransform; /* post hinting; includes rotations */
+ CF2_Fixed ppem; /* transform-dependent */
+
+ /* variation data */
+ CFF_BlendRec blend; /* cached charstring blend vector */
+ CF2_UInt vsindex; /* current vsindex */
+ CF2_UInt lenNDV; /* current length NDV or zero */
+ FT_Fixed* NDV; /* ptr to current NDV or NULL */
+
+ CF2_Int unitsPerEm;
+
+ CF2_Fixed syntheticEmboldeningAmountX; /* character space units */
+ CF2_Fixed syntheticEmboldeningAmountY; /* character space units */
+
+ /* FreeType related members */
+ CF2_OutlineRec outline; /* freetype glyph outline functions */
+ PS_Decoder* decoder;
+ CFF_SubFont lastSubfont; /* FreeType parsed data; */
+ /* top font or subfont */
+
+ /* these flags can vary from one call to the next */
+ FT_Bool hinted;
+ FT_Bool darkened; /* true if stemDarkened or synthetic bold */
+ /* i.e. darkenX != 0 || darkenY != 0 */
+ FT_Bool stemDarkened;
+
+ FT_Int darkenParams[8]; /* 1000 unit character space */
+
+ /* variables that depend on both FontDict and Transform */
+ CF2_Fixed stdVW; /* in character space; depends on dict entry */
+ CF2_Fixed stdHW; /* in character space; depends on dict entry */
+ CF2_Fixed darkenX; /* character space units */
+ CF2_Fixed darkenY; /* depends on transform */
+ /* and private dict (StdVW) */
+ FT_Bool reverseWinding; /* darken assuming */
+ /* counterclockwise winding */
+
+ CF2_BluesRec blues; /* computed zone data */
+
+ FT_Service_CFFLoad cffload; /* pointer to cff functions */
+ };
+
+
+ FT_LOCAL( FT_Error )
+ cf2_getGlyphOutline( CF2_Font font,
+ CF2_Buffer charstring,
+ const CF2_Matrix* transform,
+ CF2_F16Dot16* glyphWidth );
+
+
+FT_END_HEADER
+
+
+#endif /* PSFONT_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psft.c b/thirdparty/freetype/src/psaux/psft.c
new file mode 100644
index 0000000000..1f750174a1
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psft.c
@@ -0,0 +1,890 @@
+/***************************************************************************/
+/* */
+/* psft.c */
+/* */
+/* FreeType Glue Component to Adobe's Interpreter (body). */
+/* */
+/* Copyright 2013-2014 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+
+#include "psfont.h"
+#include "pserror.h"
+#include "psobjs.h"
+#include "cffdecode.h"
+
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+#include FT_MULTIPLE_MASTERS_H
+#include FT_SERVICE_MULTIPLE_MASTERS_H
+#endif
+
+#include FT_SERVICE_CFF_TABLE_LOAD_H
+
+
+#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
+
+
+ /*
+ * This check should avoid most internal overflow cases. Clients should
+ * generally respond to `Glyph_Too_Big' by getting a glyph outline
+ * at EM size, scaling it and filling it as a graphics operation.
+ *
+ */
+ static FT_Error
+ cf2_checkTransform( const CF2_Matrix* transform,
+ CF2_Int unitsPerEm )
+ {
+ CF2_Fixed maxScale;
+
+
+ FT_ASSERT( unitsPerEm > 0 );
+
+ if ( transform->a <= 0 || transform->d <= 0 )
+ return FT_THROW( Invalid_Size_Handle );
+
+ FT_ASSERT( transform->b == 0 && transform->c == 0 );
+ FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
+
+ if ( unitsPerEm > 0x7FFF )
+ return FT_THROW( Glyph_Too_Big );
+
+ maxScale = FT_DivFix( CF2_MAX_SIZE, cf2_intToFixed( unitsPerEm ) );
+
+ if ( transform->a > maxScale || transform->d > maxScale )
+ return FT_THROW( Glyph_Too_Big );
+
+ return FT_Err_Ok;
+ }
+
+
+ static void
+ cf2_setGlyphWidth( CF2_Outline outline,
+ CF2_Fixed width )
+ {
+ PS_Decoder* decoder = outline->decoder;
+
+
+ FT_ASSERT( decoder );
+
+ if ( !decoder->builder.is_t1 )
+ *decoder->glyph_width = cf2_fixedToInt( width );
+ }
+
+
+ /* Clean up font instance. */
+ static void
+ cf2_free_instance( void* ptr )
+ {
+ CF2_Font font = (CF2_Font)ptr;
+
+
+ if ( font )
+ {
+ FT_Memory memory = font->memory;
+
+
+ FT_FREE( font->blend.lastNDV );
+ FT_FREE( font->blend.BV );
+ }
+ }
+
+
+ /********************************************/
+ /* */
+ /* functions for handling client outline; */
+ /* FreeType uses coordinates in 26.6 format */
+ /* */
+ /********************************************/
+
+ static void
+ cf2_builder_moveTo( CF2_OutlineCallbacks callbacks,
+ const CF2_CallbackParams params )
+ {
+ /* downcast the object pointer */
+ CF2_Outline outline = (CF2_Outline)callbacks;
+ PS_Builder* builder;
+
+ (void)params; /* only used in debug mode */
+
+
+ FT_ASSERT( outline && outline->decoder );
+ FT_ASSERT( params->op == CF2_PathOpMoveTo );
+
+ builder = &outline->decoder->builder;
+
+ /* note: two successive moves simply close the contour twice */
+ ps_builder_close_contour( builder );
+ builder->path_begun = 0;
+ }
+
+
+ static void
+ cf2_builder_lineTo( CF2_OutlineCallbacks callbacks,
+ const CF2_CallbackParams params )
+ {
+ FT_Error error;
+
+ /* downcast the object pointer */
+ CF2_Outline outline = (CF2_Outline)callbacks;
+ PS_Builder* builder;
+
+
+ FT_ASSERT( outline && outline->decoder );
+ FT_ASSERT( params->op == CF2_PathOpLineTo );
+
+ builder = &outline->decoder->builder;
+
+ if ( !builder->path_begun )
+ {
+ /* record the move before the line; also check points and set */
+ /* `path_begun' */
+ error = ps_builder_start_point( builder,
+ params->pt0.x,
+ params->pt0.y );
+ if ( error )
+ {
+ if ( !*callbacks->error )
+ *callbacks->error = error;
+ return;
+ }
+ }
+
+ /* `ps_builder_add_point1' includes a check_points call for one point */
+ error = ps_builder_add_point1( builder,
+ params->pt1.x,
+ params->pt1.y );
+ if ( error )
+ {
+ if ( !*callbacks->error )
+ *callbacks->error = error;
+ return;
+ }
+ }
+
+
+ static void
+ cf2_builder_cubeTo( CF2_OutlineCallbacks callbacks,
+ const CF2_CallbackParams params )
+ {
+ FT_Error error;
+
+ /* downcast the object pointer */
+ CF2_Outline outline = (CF2_Outline)callbacks;
+ PS_Builder* builder;
+
+
+ FT_ASSERT( outline && outline->decoder );
+ FT_ASSERT( params->op == CF2_PathOpCubeTo );
+
+ builder = &outline->decoder->builder;
+
+ if ( !builder->path_begun )
+ {
+ /* record the move before the line; also check points and set */
+ /* `path_begun' */
+ error = ps_builder_start_point( builder,
+ params->pt0.x,
+ params->pt0.y );
+ if ( error )
+ {
+ if ( !*callbacks->error )
+ *callbacks->error = error;
+ return;
+ }
+ }
+
+ /* prepare room for 3 points: 2 off-curve, 1 on-curve */
+ error = ps_builder_check_points( builder, 3 );
+ if ( error )
+ {
+ if ( !*callbacks->error )
+ *callbacks->error = error;
+ return;
+ }
+
+ ps_builder_add_point( builder,
+ params->pt1.x,
+ params->pt1.y, 0 );
+ ps_builder_add_point( builder,
+ params->pt2.x,
+ params->pt2.y, 0 );
+ ps_builder_add_point( builder,
+ params->pt3.x,
+ params->pt3.y, 1 );
+ }
+
+
+ static void
+ cf2_outline_init( CF2_Outline outline,
+ FT_Memory memory,
+ FT_Error* error )
+ {
+ FT_ZERO( outline );
+
+ outline->root.memory = memory;
+ outline->root.error = error;
+
+ outline->root.moveTo = cf2_builder_moveTo;
+ outline->root.lineTo = cf2_builder_lineTo;
+ outline->root.cubeTo = cf2_builder_cubeTo;
+ }
+
+
+ /* get scaling and hint flag from GlyphSlot */
+ static void
+ cf2_getScaleAndHintFlag( PS_Decoder* decoder,
+ CF2_Fixed* x_scale,
+ CF2_Fixed* y_scale,
+ FT_Bool* hinted,
+ FT_Bool* scaled )
+ {
+ FT_ASSERT( decoder && decoder->builder.glyph );
+
+ /* note: FreeType scale includes a factor of 64 */
+ *hinted = decoder->builder.glyph->hint;
+ *scaled = decoder->builder.glyph->scaled;
+
+ if ( *hinted )
+ {
+ *x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64;
+ *y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64;
+ }
+ else
+ {
+ /* for unhinted outlines, `cff_slot_load' does the scaling, */
+ /* thus render at `unity' scale */
+
+ *x_scale = 0x0400; /* 1/64 as 16.16 */
+ *y_scale = 0x0400;
+ }
+ }
+
+
+ /* get units per em from `FT_Face' */
+ /* TODO: should handle font matrix concatenation? */
+ static FT_UShort
+ cf2_getUnitsPerEm( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->builder.face );
+ FT_ASSERT( decoder->builder.face->units_per_EM );
+
+ return decoder->builder.face->units_per_EM;
+ }
+
+
+ /* Main entry point: Render one glyph. */
+ FT_LOCAL_DEF( FT_Error )
+ cf2_decoder_parse_charstrings( PS_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len )
+ {
+ FT_Memory memory;
+ FT_Error error = FT_Err_Ok;
+ CF2_Font font;
+
+ FT_Bool is_t1 = decoder->builder.is_t1;
+
+
+ FT_ASSERT( decoder &&
+ ( is_t1 || decoder->cff ) );
+
+ if ( is_t1 && !decoder->current_subfont )
+ {
+ FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): "
+ "SubFont missing. Use `t1_make_subfont' first\n" ));
+ return FT_THROW( Invalid_Table );
+ }
+
+ memory = decoder->builder.memory;
+
+ /* CF2 data is saved here across glyphs */
+ font = (CF2_Font)decoder->cf2_instance->data;
+
+ /* on first glyph, allocate instance structure */
+ if ( !decoder->cf2_instance->data )
+ {
+ decoder->cf2_instance->finalizer =
+ (FT_Generic_Finalizer)cf2_free_instance;
+
+ if ( FT_ALLOC( decoder->cf2_instance->data,
+ sizeof ( CF2_FontRec ) ) )
+ return FT_THROW( Out_Of_Memory );
+
+ font = (CF2_Font)decoder->cf2_instance->data;
+
+ font->memory = memory;
+
+ if ( !is_t1 )
+ font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload;
+
+ /* initialize a client outline, to be shared by each glyph rendered */
+ cf2_outline_init( &font->outline, font->memory, &font->error );
+ }
+
+ /* save decoder; it is a stack variable and will be different on each */
+ /* call */
+ font->decoder = decoder;
+ font->outline.decoder = decoder;
+
+ {
+ /* build parameters for Adobe engine */
+
+ PS_Builder* builder = &decoder->builder;
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
+
+ FT_Bool no_stem_darkening_driver =
+ driver->no_stem_darkening;
+ FT_Char no_stem_darkening_font =
+ builder->face->internal->no_stem_darkening;
+
+ /* local error */
+ FT_Error error2 = FT_Err_Ok;
+ CF2_BufferRec buf;
+ CF2_Matrix transform;
+ CF2_F16Dot16 glyphWidth;
+
+ FT_Bool hinted;
+ FT_Bool scaled;
+
+
+ /* FreeType has already looked up the GID; convert to */
+ /* `RegionBuffer', assuming that the input has been validated */
+ FT_ASSERT( charstring_base + charstring_len >= charstring_base );
+
+ FT_ZERO( &buf );
+ buf.start =
+ buf.ptr = charstring_base;
+ buf.end = charstring_base + charstring_len;
+
+ FT_ZERO( &transform );
+
+ cf2_getScaleAndHintFlag( decoder,
+ &transform.a,
+ &transform.d,
+ &hinted,
+ &scaled );
+
+ if ( is_t1 )
+ font->isCFF2 = FALSE;
+ else
+ {
+ /* copy isCFF2 boolean from TT_Face to CF2_Font */
+ font->isCFF2 = ((TT_Face)builder->face)->is_cff2;
+ }
+ font->isT1 = is_t1;
+
+ font->renderingFlags = 0;
+ if ( hinted )
+ font->renderingFlags |= CF2_FlagsHinted;
+ if ( scaled && ( !no_stem_darkening_font ||
+ ( no_stem_darkening_font < 0 &&
+ !no_stem_darkening_driver ) ) )
+ font->renderingFlags |= CF2_FlagsDarkened;
+
+ font->darkenParams[0] = driver->darken_params[0];
+ font->darkenParams[1] = driver->darken_params[1];
+ font->darkenParams[2] = driver->darken_params[2];
+ font->darkenParams[3] = driver->darken_params[3];
+ font->darkenParams[4] = driver->darken_params[4];
+ font->darkenParams[5] = driver->darken_params[5];
+ font->darkenParams[6] = driver->darken_params[6];
+ font->darkenParams[7] = driver->darken_params[7];
+
+ /* now get an outline for this glyph; */
+ /* also get units per em to validate scale */
+ font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
+
+ if ( scaled )
+ {
+ error2 = cf2_checkTransform( &transform, font->unitsPerEm );
+ if ( error2 )
+ return error2;
+ }
+
+ error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
+ if ( error2 )
+ return FT_ERR( Invalid_File_Format );
+
+ cf2_setGlyphWidth( &font->outline, glyphWidth );
+
+ return FT_Err_Ok;
+ }
+ }
+
+
+ /* get pointer to current FreeType subfont (based on current glyphID) */
+ FT_LOCAL_DEF( CFF_SubFont )
+ cf2_getSubfont( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ return decoder->current_subfont;
+ }
+
+
+ /* get pointer to VStore structure */
+ FT_LOCAL_DEF( CFF_VStore )
+ cf2_getVStore( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->cff );
+
+ return &decoder->cff->vstore;
+ }
+
+
+ /* get maxstack value from CFF2 Top DICT */
+ FT_LOCAL_DEF( FT_UInt )
+ cf2_getMaxstack( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->cff );
+
+ return decoder->cff->top_font.font_dict.maxstack;
+ }
+
+
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ /* Get normalized design vector for current render request; */
+ /* return pointer and length. */
+ /* */
+ /* Note: Uses FT_Fixed not CF2_Fixed for the vector. */
+ FT_LOCAL_DEF( FT_Error )
+ cf2_getNormalizedVector( PS_Decoder* decoder,
+ CF2_UInt *len,
+ FT_Fixed* *vec )
+ {
+ TT_Face face;
+ FT_Service_MultiMasters mm;
+
+
+ FT_ASSERT( decoder && decoder->builder.face );
+ FT_ASSERT( vec && len );
+ FT_ASSERT( !decoder->builder.is_t1 );
+
+ face = (TT_Face)decoder->builder.face;
+ mm = (FT_Service_MultiMasters)face->mm;
+
+ return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL );
+ }
+#endif
+
+
+ /* get `y_ppem' from `CFF_Size' */
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_getPpemY( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder &&
+ decoder->builder.face &&
+ decoder->builder.face->size );
+
+ /*
+ * Note that `y_ppem' can be zero if there wasn't a call to
+ * `FT_Set_Char_Size' or something similar. However, this isn't a
+ * problem since we come to this place in the code only if
+ * FT_LOAD_NO_SCALE is set (the other case gets caught by
+ * `cf2_checkTransform'). The ppem value is needed to compute the stem
+ * darkening, which is disabled for getting the unscaled outline.
+ *
+ */
+ return cf2_intToFixed(
+ decoder->builder.face->size->metrics.y_ppem );
+ }
+
+
+ /* get standard stem widths for the current subfont; */
+ /* FreeType stores these as integer font units */
+ /* (note: variable names seem swapped) */
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_getStdVW( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ return cf2_intToFixed(
+ decoder->current_subfont->private_dict.standard_height );
+ }
+
+
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_getStdHW( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ return cf2_intToFixed(
+ decoder->current_subfont->private_dict.standard_width );
+ }
+
+
+ /* note: FreeType stores 1000 times the actual value for `BlueScale' */
+ FT_LOCAL_DEF( void )
+ cf2_getBlueMetrics( PS_Decoder* decoder,
+ CF2_Fixed* blueScale,
+ CF2_Fixed* blueShift,
+ CF2_Fixed* blueFuzz )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ *blueScale = FT_DivFix(
+ decoder->current_subfont->private_dict.blue_scale,
+ cf2_intToFixed( 1000 ) );
+ *blueShift = cf2_intToFixed(
+ decoder->current_subfont->private_dict.blue_shift );
+ *blueFuzz = cf2_intToFixed(
+ decoder->current_subfont->private_dict.blue_fuzz );
+ }
+
+
+ /* get blue values counts and arrays; the FreeType parser has validated */
+ /* the counts and verified that each is an even number */
+ FT_LOCAL_DEF( void )
+ cf2_getBlueValues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ *count = decoder->current_subfont->private_dict.num_blue_values;
+ *data = (FT_Pos*)
+ &decoder->current_subfont->private_dict.blue_values;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_getOtherBlues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ *count = decoder->current_subfont->private_dict.num_other_blues;
+ *data = (FT_Pos*)
+ &decoder->current_subfont->private_dict.other_blues;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_getFamilyBlues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ *count = decoder->current_subfont->private_dict.num_family_blues;
+ *data = (FT_Pos*)
+ &decoder->current_subfont->private_dict.family_blues;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_getFamilyOtherBlues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ *count = decoder->current_subfont->private_dict.num_family_other_blues;
+ *data = (FT_Pos*)
+ &decoder->current_subfont->private_dict.family_other_blues;
+ }
+
+
+ FT_LOCAL_DEF( CF2_Int )
+ cf2_getLanguageGroup( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ return decoder->current_subfont->private_dict.language_group;
+ }
+
+
+ /* convert unbiased subroutine index to `CF2_Buffer' and */
+ /* return 0 on success */
+ FT_LOCAL_DEF( CF2_Int )
+ cf2_initGlobalRegionBuffer( PS_Decoder* decoder,
+ CF2_Int subrNum,
+ CF2_Buffer buf )
+ {
+ CF2_UInt idx;
+
+
+ FT_ASSERT( decoder );
+
+ FT_ZERO( buf );
+
+ idx = (CF2_UInt)( subrNum + decoder->globals_bias );
+ if ( idx >= decoder->num_globals )
+ return TRUE; /* error */
+
+ FT_ASSERT( decoder->globals );
+
+ buf->start =
+ buf->ptr = decoder->globals[idx];
+ buf->end = decoder->globals[idx + 1];
+
+ return FALSE; /* success */
+ }
+
+
+ /* convert AdobeStandardEncoding code to CF2_Buffer; */
+ /* used for seac component */
+ FT_LOCAL_DEF( FT_Error )
+ cf2_getSeacComponent( PS_Decoder* decoder,
+ CF2_Int code,
+ CF2_Buffer buf )
+ {
+ CF2_Int gid;
+ FT_Byte* charstring;
+ FT_ULong len;
+ FT_Error error;
+
+
+ FT_ASSERT( decoder );
+ FT_ASSERT( !decoder->builder.is_t1 );
+
+ FT_ZERO( buf );
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ /* Incremental fonts don't necessarily have valid charsets. */
+ /* They use the character code, not the glyph index, in this case. */
+ if ( decoder->builder.face->internal->incremental_interface )
+ gid = code;
+ else
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
+ {
+ gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );
+ if ( gid < 0 )
+ return FT_THROW( Invalid_Glyph_Format );
+ }
+
+ error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face,
+ (CF2_UInt)gid,
+ &charstring,
+ &len );
+ /* TODO: for now, just pass the FreeType error through */
+ if ( error )
+ return error;
+
+ /* assume input has been validated */
+ FT_ASSERT( charstring + len >= charstring );
+
+ buf->start = charstring;
+ buf->end = charstring + len;
+ buf->ptr = buf->start;
+
+ return FT_Err_Ok;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_freeSeacComponent( PS_Decoder* decoder,
+ CF2_Buffer buf )
+ {
+ FT_ASSERT( decoder );
+ FT_ASSERT( !decoder->builder.is_t1 );
+
+ decoder->free_glyph_callback( (TT_Face)decoder->builder.face,
+ (FT_Byte**)&buf->start,
+ (FT_ULong)( buf->end - buf->start ) );
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ cf2_getT1SeacComponent( PS_Decoder* decoder,
+ FT_UInt glyph_index,
+ CF2_Buffer buf )
+ {
+ FT_Data glyph_data;
+ FT_Error error = FT_Err_Ok;
+ T1_Face face = (T1_Face)decoder->builder.face;
+ T1_Font type1 = &face->type1;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ FT_Incremental_InterfaceRec *inc =
+ face->root.internal->incremental_interface;
+
+
+ /* For incremental fonts get the character data using the */
+ /* callback function. */
+ if ( inc )
+ error = inc->funcs->get_glyph_data( inc->object,
+ glyph_index, &glyph_data );
+ else
+#endif
+ /* For ordinary fonts get the character data stored in the face record. */
+ {
+ glyph_data.pointer = type1->charstrings[glyph_index];
+ glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index];
+ }
+
+ if ( !error )
+ {
+ FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer;
+ FT_ULong charstring_len = (FT_ULong)glyph_data.length;
+
+
+ FT_ASSERT( charstring_base + charstring_len >= charstring_base );
+
+ FT_ZERO( buf );
+ buf->start =
+ buf->ptr = charstring_base;
+ buf->end = charstring_base + charstring_len;
+ }
+
+ return error;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_freeT1SeacComponent( PS_Decoder* decoder,
+ CF2_Buffer buf )
+ {
+ T1_Face face;
+ FT_Data data;
+
+
+ FT_ASSERT( decoder );
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ face = (T1_Face)decoder->builder.face;
+
+ data.pointer = buf->start;
+ data.length = (FT_Int)( buf->end - buf->start );
+
+ if ( face->root.internal->incremental_interface )
+ face->root.internal->incremental_interface->funcs->free_glyph_data(
+ face->root.internal->incremental_interface->object,
+ &data );
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
+ }
+
+
+ FT_LOCAL_DEF( CF2_Int )
+ cf2_initLocalRegionBuffer( PS_Decoder* decoder,
+ CF2_Int subrNum,
+ CF2_Buffer buf )
+ {
+ CF2_UInt idx;
+
+
+ FT_ASSERT( decoder );
+
+ FT_ZERO( buf );
+
+ idx = (CF2_UInt)( subrNum + decoder->locals_bias );
+ if ( idx >= decoder->num_locals )
+ return TRUE; /* error */
+
+ FT_ASSERT( decoder->locals );
+
+ buf->start = decoder->locals[idx];
+
+ if ( decoder->builder.is_t1 )
+ {
+ /* The Type 1 driver stores subroutines without the seed bytes. */
+ /* The CID driver stores subroutines with seed bytes. This */
+ /* case is taken care of when decoder->subrs_len == 0. */
+ if ( decoder->locals_len )
+ buf->end = buf->start + decoder->locals_len[idx];
+ else
+ {
+ /* We are using subroutines from a CID font. We must adjust */
+ /* for the seed bytes. */
+ buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
+ buf->end = decoder->locals[idx + 1];
+ }
+
+ if ( !buf->start )
+ {
+ FT_ERROR(( "cf2_initLocalRegionBuffer (Type 1 mode):"
+ " invoking empty subrs\n" ));
+ }
+ }
+ else
+ {
+ buf->end = decoder->locals[idx + 1];
+ }
+
+ buf->ptr = buf->start;
+
+ return FALSE; /* success */
+ }
+
+
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_getDefaultWidthX( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ return cf2_intToFixed(
+ decoder->current_subfont->private_dict.default_width );
+ }
+
+
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_getNominalWidthX( PS_Decoder* decoder )
+ {
+ FT_ASSERT( decoder && decoder->current_subfont );
+
+ return cf2_intToFixed(
+ decoder->current_subfont->private_dict.nominal_width );
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_outline_reset( CF2_Outline outline )
+ {
+ PS_Decoder* decoder = outline->decoder;
+
+
+ FT_ASSERT( decoder );
+
+ outline->root.windingMomentum = 0;
+
+ FT_GlyphLoader_Rewind( decoder->builder.loader );
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_outline_close( CF2_Outline outline )
+ {
+ PS_Decoder* decoder = outline->decoder;
+
+
+ FT_ASSERT( decoder );
+
+ ps_builder_close_contour( &decoder->builder );
+
+ FT_GlyphLoader_Add( decoder->builder.loader );
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psft.h b/thirdparty/freetype/src/psaux/psft.h
new file mode 100644
index 0000000000..ab172110bb
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psft.h
@@ -0,0 +1,167 @@
+/***************************************************************************/
+/* */
+/* psft.h */
+/* */
+/* FreeType Glue Component to Adobe's Interpreter (specification). */
+/* */
+/* Copyright 2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSFT_H_
+#define PSFT_H_
+
+
+#include "pstypes.h"
+
+
+ /* TODO: disable asserts for now */
+#define CF2_NDEBUG
+
+
+#include FT_SYSTEM_H
+
+#include "psglue.h"
+#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */
+
+
+FT_BEGIN_HEADER
+
+
+ FT_LOCAL( FT_Error )
+ cf2_decoder_parse_charstrings( PS_Decoder* decoder,
+ FT_Byte* charstring_base,
+ FT_ULong charstring_len );
+
+ FT_LOCAL( CFF_SubFont )
+ cf2_getSubfont( PS_Decoder* decoder );
+
+ FT_LOCAL( CFF_VStore )
+ cf2_getVStore( PS_Decoder* decoder );
+
+ FT_LOCAL( FT_UInt )
+ cf2_getMaxstack( PS_Decoder* decoder );
+
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ FT_LOCAL( FT_Error )
+ cf2_getNormalizedVector( PS_Decoder* decoder,
+ CF2_UInt *len,
+ FT_Fixed* *vec );
+#endif
+
+ FT_LOCAL( CF2_Fixed )
+ cf2_getPpemY( PS_Decoder* decoder );
+ FT_LOCAL( CF2_Fixed )
+ cf2_getStdVW( PS_Decoder* decoder );
+ FT_LOCAL( CF2_Fixed )
+ cf2_getStdHW( PS_Decoder* decoder );
+
+ FT_LOCAL( void )
+ cf2_getBlueMetrics( PS_Decoder* decoder,
+ CF2_Fixed* blueScale,
+ CF2_Fixed* blueShift,
+ CF2_Fixed* blueFuzz );
+ FT_LOCAL( void )
+ cf2_getBlueValues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data );
+ FT_LOCAL( void )
+ cf2_getOtherBlues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data );
+ FT_LOCAL( void )
+ cf2_getFamilyBlues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data );
+ FT_LOCAL( void )
+ cf2_getFamilyOtherBlues( PS_Decoder* decoder,
+ size_t* count,
+ FT_Pos* *data );
+
+ FT_LOCAL( CF2_Int )
+ cf2_getLanguageGroup( PS_Decoder* decoder );
+
+ FT_LOCAL( CF2_Int )
+ cf2_initGlobalRegionBuffer( PS_Decoder* decoder,
+ CF2_Int subrNum,
+ CF2_Buffer buf );
+ FT_LOCAL( FT_Error )
+ cf2_getSeacComponent( PS_Decoder* decoder,
+ CF2_Int code,
+ CF2_Buffer buf );
+ FT_LOCAL( void )
+ cf2_freeSeacComponent( PS_Decoder* decoder,
+ CF2_Buffer buf );
+ FT_LOCAL( CF2_Int )
+ cf2_initLocalRegionBuffer( PS_Decoder* decoder,
+ CF2_Int subrNum,
+ CF2_Buffer buf );
+
+ FT_LOCAL( CF2_Fixed )
+ cf2_getDefaultWidthX( PS_Decoder* decoder );
+ FT_LOCAL( CF2_Fixed )
+ cf2_getNominalWidthX( PS_Decoder* decoder );
+
+
+ FT_LOCAL( FT_Error )
+ cf2_getT1SeacComponent( PS_Decoder* decoder,
+ FT_UInt glyph_index,
+ CF2_Buffer buf );
+ FT_LOCAL( void )
+ cf2_freeT1SeacComponent( PS_Decoder* decoder,
+ CF2_Buffer buf );
+
+ /*
+ * FreeType client outline
+ *
+ * process output from the charstring interpreter
+ */
+ typedef struct CF2_OutlineRec_
+ {
+ CF2_OutlineCallbacksRec root; /* base class must be first */
+ PS_Decoder* decoder;
+
+ } CF2_OutlineRec, *CF2_Outline;
+
+
+ FT_LOCAL( void )
+ cf2_outline_reset( CF2_Outline outline );
+ FT_LOCAL( void )
+ cf2_outline_close( CF2_Outline outline );
+
+
+FT_END_HEADER
+
+
+#endif /* PSFT_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psglue.h b/thirdparty/freetype/src/psaux/psglue.h
new file mode 100644
index 0000000000..5545e12a5b
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psglue.h
@@ -0,0 +1,144 @@
+/***************************************************************************/
+/* */
+/* psglue.h */
+/* */
+/* Adobe's code for shared stuff (specification only). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSGLUE_H_
+#define PSGLUE_H_
+
+
+/* common includes for other modules */
+#include "pserror.h"
+#include "psfixed.h"
+#include "psarrst.h"
+#include "psread.h"
+
+
+FT_BEGIN_HEADER
+
+
+ /* rendering parameters */
+
+ /* apply hints to rendered glyphs */
+#define CF2_FlagsHinted 1
+ /* for testing */
+#define CF2_FlagsDarkened 2
+
+ /* type for holding the flags */
+ typedef CF2_Int CF2_RenderingFlags;
+
+
+ /* elements of a glyph outline */
+ typedef enum CF2_PathOp_
+ {
+ CF2_PathOpMoveTo = 1, /* change the current point */
+ CF2_PathOpLineTo = 2, /* line */
+ CF2_PathOpQuadTo = 3, /* quadratic curve */
+ CF2_PathOpCubeTo = 4 /* cubic curve */
+
+ } CF2_PathOp;
+
+
+ /* a matrix of fixed point values */
+ typedef struct CF2_Matrix_
+ {
+ CF2_F16Dot16 a;
+ CF2_F16Dot16 b;
+ CF2_F16Dot16 c;
+ CF2_F16Dot16 d;
+ CF2_F16Dot16 tx;
+ CF2_F16Dot16 ty;
+
+ } CF2_Matrix;
+
+
+ /* these typedefs are needed by more than one header file */
+ /* and gcc compiler doesn't allow redefinition */
+ typedef struct CF2_FontRec_ CF2_FontRec, *CF2_Font;
+ typedef struct CF2_HintRec_ CF2_HintRec, *CF2_Hint;
+
+
+ /* A common structure for all callback parameters. */
+ /* */
+ /* Some members may be unused. For example, `pt0' is not used for */
+ /* `moveTo' and `pt3' is not used for `quadTo'. The initial point `pt0' */
+ /* is included for each path element for generality; curve conversions */
+ /* need it. The `op' parameter allows one function to handle multiple */
+ /* element types. */
+
+ typedef struct CF2_CallbackParamsRec_
+ {
+ FT_Vector pt0;
+ FT_Vector pt1;
+ FT_Vector pt2;
+ FT_Vector pt3;
+
+ CF2_Int op;
+
+ } CF2_CallbackParamsRec, *CF2_CallbackParams;
+
+
+ /* forward reference */
+ typedef struct CF2_OutlineCallbacksRec_ CF2_OutlineCallbacksRec,
+ *CF2_OutlineCallbacks;
+
+ /* callback function pointers */
+ typedef void
+ (*CF2_Callback_Type)( CF2_OutlineCallbacks callbacks,
+ const CF2_CallbackParams params );
+
+
+ struct CF2_OutlineCallbacksRec_
+ {
+ CF2_Callback_Type moveTo;
+ CF2_Callback_Type lineTo;
+ CF2_Callback_Type quadTo;
+ CF2_Callback_Type cubeTo;
+
+ CF2_Int windingMomentum; /* for winding order detection */
+
+ FT_Memory memory;
+ FT_Error* error;
+ };
+
+
+FT_END_HEADER
+
+
+#endif /* PSGLUE_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/pshints.c b/thirdparty/freetype/src/psaux/pshints.c
new file mode 100644
index 0000000000..3615196425
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/pshints.c
@@ -0,0 +1,1939 @@
+/***************************************************************************/
+/* */
+/* pshints.c */
+/* */
+/* Adobe's code for handling CFF hints (body). */
+/* */
+/* Copyright 2007-2014 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+
+#include "psglue.h"
+#include "psfont.h"
+#include "pshints.h"
+#include "psintrp.h"
+
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_cf2hints
+
+
+ typedef struct CF2_HintMoveRec_
+ {
+ size_t j; /* index of upper hint map edge */
+ CF2_Fixed moveUp; /* adjustment to optimum position */
+
+ } CF2_HintMoveRec, *CF2_HintMove;
+
+
+ /* Compute angular momentum for winding order detection. It is called */
+ /* for all lines and curves, but not necessarily in element order. */
+ static CF2_Int
+ cf2_getWindingMomentum( CF2_Fixed x1,
+ CF2_Fixed y1,
+ CF2_Fixed x2,
+ CF2_Fixed y2 )
+ {
+ /* cross product of pt1 position from origin with pt2 position from */
+ /* pt1; we reduce the precision so that the result fits into 32 bits */
+
+ return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) -
+ ( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 );
+ }
+
+
+ /*
+ * Construct from a StemHint; this is used as a parameter to
+ * `cf2_blues_capture'.
+ * `hintOrigin' is the character space displacement of a seac accent.
+ * Adjust stem hint for darkening here.
+ *
+ */
+ static void
+ cf2_hint_init( CF2_Hint hint,
+ const CF2_ArrStack stemHintArray,
+ size_t indexStemHint,
+ const CF2_Font font,
+ CF2_Fixed hintOrigin,
+ CF2_Fixed scale,
+ FT_Bool bottom )
+ {
+ CF2_Fixed width;
+ const CF2_StemHintRec* stemHint;
+
+
+ FT_ZERO( hint );
+
+ stemHint = (const CF2_StemHintRec*)cf2_arrstack_getPointer(
+ stemHintArray,
+ indexStemHint );
+
+ width = SUB_INT32( stemHint->max, stemHint->min );
+
+ if ( width == cf2_intToFixed( -21 ) )
+ {
+ /* ghost bottom */
+
+ if ( bottom )
+ {
+ hint->csCoord = stemHint->max;
+ hint->flags = CF2_GhostBottom;
+ }
+ else
+ hint->flags = 0;
+ }
+
+ else if ( width == cf2_intToFixed( -20 ) )
+ {
+ /* ghost top */
+
+ if ( bottom )
+ hint->flags = 0;
+ else
+ {
+ hint->csCoord = stemHint->min;
+ hint->flags = CF2_GhostTop;
+ }
+ }
+
+ else if ( width < 0 )
+ {
+ /* inverted pair */
+
+ /*
+ * Hints with negative widths were produced by an early version of a
+ * non-Adobe font tool. The Type 2 spec allows edge (ghost) hints
+ * with negative widths, but says
+ *
+ * All other negative widths have undefined meaning.
+ *
+ * CoolType has a silent workaround that negates the hint width; for
+ * permissive mode, we do the same here.
+ *
+ * Note: Such fonts cannot use ghost hints, but should otherwise work.
+ * Note: Some poor hints in our faux fonts can produce negative
+ * widths at some blends. For example, see a light weight of
+ * `u' in ASerifMM.
+ *
+ */
+ if ( bottom )
+ {
+ hint->csCoord = stemHint->max;
+ hint->flags = CF2_PairBottom;
+ }
+ else
+ {
+ hint->csCoord = stemHint->min;
+ hint->flags = CF2_PairTop;
+ }
+ }
+
+ else
+ {
+ /* normal pair */
+
+ if ( bottom )
+ {
+ hint->csCoord = stemHint->min;
+ hint->flags = CF2_PairBottom;
+ }
+ else
+ {
+ hint->csCoord = stemHint->max;
+ hint->flags = CF2_PairTop;
+ }
+ }
+
+ /* Now that ghost hints have been detected, adjust this edge for */
+ /* darkening. Bottoms are not changed; tops are incremented by twice */
+ /* `darkenY'. */
+ if ( cf2_hint_isTop( hint ) )
+ hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY );
+
+ hint->csCoord = ADD_INT32( hint->csCoord, hintOrigin );
+ hint->scale = scale;
+ hint->index = indexStemHint; /* index in original stem hint array */
+
+ /* if original stem hint has been used, use the same position */
+ if ( hint->flags != 0 && stemHint->used )
+ {
+ if ( cf2_hint_isTop( hint ) )
+ hint->dsCoord = stemHint->maxDS;
+ else
+ hint->dsCoord = stemHint->minDS;
+
+ cf2_hint_lock( hint );
+ }
+ else
+ hint->dsCoord = FT_MulFix( hint->csCoord, scale );
+ }
+
+
+ /* initialize an invalid hint map element */
+ static void
+ cf2_hint_initZero( CF2_Hint hint )
+ {
+ FT_ZERO( hint );
+ }
+
+
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_hint_isValid( const CF2_Hint hint )
+ {
+ return (FT_Bool)( hint->flags != 0 );
+ }
+
+
+ static FT_Bool
+ cf2_hint_isPair( const CF2_Hint hint )
+ {
+ return (FT_Bool)( ( hint->flags &
+ ( CF2_PairBottom | CF2_PairTop ) ) != 0 );
+ }
+
+
+ static FT_Bool
+ cf2_hint_isPairTop( const CF2_Hint hint )
+ {
+ return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 );
+ }
+
+
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_hint_isTop( const CF2_Hint hint )
+ {
+ return (FT_Bool)( ( hint->flags &
+ ( CF2_PairTop | CF2_GhostTop ) ) != 0 );
+ }
+
+
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_hint_isBottom( const CF2_Hint hint )
+ {
+ return (FT_Bool)( ( hint->flags &
+ ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 );
+ }
+
+
+ static FT_Bool
+ cf2_hint_isLocked( const CF2_Hint hint )
+ {
+ return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 );
+ }
+
+
+ static FT_Bool
+ cf2_hint_isSynthetic( const CF2_Hint hint )
+ {
+ return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 );
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_hint_lock( CF2_Hint hint )
+ {
+ hint->flags |= CF2_Locked;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_hintmap_init( CF2_HintMap hintmap,
+ CF2_Font font,
+ CF2_HintMap initialMap,
+ CF2_ArrStack hintMoves,
+ CF2_Fixed scale )
+ {
+ FT_ZERO( hintmap );
+
+ /* copy parameters from font instance */
+ hintmap->hinted = font->hinted;
+ hintmap->scale = scale;
+ hintmap->font = font;
+ hintmap->initialHintMap = initialMap;
+ /* will clear in `cf2_hintmap_adjustHints' */
+ hintmap->hintMoves = hintMoves;
+ }
+
+
+ static FT_Bool
+ cf2_hintmap_isValid( const CF2_HintMap hintmap )
+ {
+ return hintmap->isValid;
+ }
+
+
+ static void
+ cf2_hintmap_dump( CF2_HintMap hintmap )
+ {
+#ifdef FT_DEBUG_LEVEL_TRACE
+ CF2_UInt i;
+
+
+ FT_TRACE6(( " index csCoord dsCoord scale flags\n" ));
+
+ for ( i = 0; i < hintmap->count; i++ )
+ {
+ CF2_Hint hint = &hintmap->edge[i];
+
+
+ FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n",
+ hint->index,
+ hint->csCoord / 65536.0,
+ hint->dsCoord / ( hint->scale * 1.0 ),
+ hint->scale,
+ ( cf2_hint_isPair( hint ) ? "p" : "g" ),
+ ( cf2_hint_isTop( hint ) ? "t" : "b" ),
+ ( cf2_hint_isLocked( hint ) ? "L" : ""),
+ ( cf2_hint_isSynthetic( hint ) ? "S" : "" ) ));
+ }
+#else
+ FT_UNUSED( hintmap );
+#endif
+ }
+
+
+ /* transform character space coordinate to device space using hint map */
+ static CF2_Fixed
+ cf2_hintmap_map( CF2_HintMap hintmap,
+ CF2_Fixed csCoord )
+ {
+ if ( hintmap->count == 0 || ! hintmap->hinted )
+ {
+ /* there are no hints; use uniform scale and zero offset */
+ return FT_MulFix( csCoord, hintmap->scale );
+ }
+ else
+ {
+ /* start linear search from last hit */
+ CF2_UInt i = hintmap->lastIndex;
+
+
+ FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES );
+
+ /* search up */
+ while ( i < hintmap->count - 1 &&
+ csCoord >= hintmap->edge[i + 1].csCoord )
+ i += 1;
+
+ /* search down */
+ while ( i > 0 && csCoord < hintmap->edge[i].csCoord )
+ i -= 1;
+
+ hintmap->lastIndex = i;
+
+ if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
+ {
+ /* special case for points below first edge: use uniform scale */
+ return ADD_INT32( FT_MulFix( SUB_INT32( csCoord,
+ hintmap->edge[0].csCoord ),
+ hintmap->scale ),
+ hintmap->edge[0].dsCoord );
+ }
+ else
+ {
+ /*
+ * Note: entries with duplicate csCoord are allowed.
+ * Use edge[i], the highest entry where csCoord >= entry[i].csCoord
+ */
+ return ADD_INT32( FT_MulFix( SUB_INT32( csCoord,
+ hintmap->edge[i].csCoord ),
+ hintmap->edge[i].scale ),
+ hintmap->edge[i].dsCoord );
+ }
+ }
+ }
+
+
+ /*
+ * This hinting policy moves a hint pair in device space so that one of
+ * its two edges is on a device pixel boundary (its fractional part is
+ * zero). `cf2_hintmap_insertHint' guarantees no overlap in CS
+ * space. Ensure here that there is no overlap in DS.
+ *
+ * In the first pass, edges are adjusted relative to adjacent hints.
+ * Those that are below have already been adjusted. Those that are
+ * above have not yet been adjusted. If a hint above blocks an
+ * adjustment to an optimal position, we will try again in a second
+ * pass. The second pass is top-down.
+ *
+ */
+
+ static void
+ cf2_hintmap_adjustHints( CF2_HintMap hintmap )
+ {
+ size_t i, j;
+
+
+ cf2_arrstack_clear( hintmap->hintMoves ); /* working storage */
+
+ /*
+ * First pass is bottom-up (font hint order) without look-ahead.
+ * Locked edges are already adjusted.
+ * Unlocked edges begin with dsCoord from `initialHintMap'.
+ * Save edges that are not optimally adjusted in `hintMoves' array,
+ * and process them in second pass.
+ */
+
+ for ( i = 0; i < hintmap->count; i++ )
+ {
+ FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] );
+
+
+ /* index of upper edge (same value for ghost hint) */
+ j = isPair ? i + 1 : i;
+
+ FT_ASSERT( j < hintmap->count );
+ FT_ASSERT( cf2_hint_isValid( &hintmap->edge[i] ) );
+ FT_ASSERT( cf2_hint_isValid( &hintmap->edge[j] ) );
+ FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) ==
+ cf2_hint_isLocked( &hintmap->edge[j] ) );
+
+ if ( !cf2_hint_isLocked( &hintmap->edge[i] ) )
+ {
+ /* hint edge is not locked, we can adjust it */
+ CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord );
+ CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord );
+
+ /* calculate all four possibilities; moves down are negative */
+ CF2_Fixed downMoveDown = 0 - fracDown;
+ CF2_Fixed upMoveDown = 0 - fracUp;
+ CF2_Fixed downMoveUp = ( fracDown == 0 )
+ ? 0
+ : cf2_intToFixed( 1 ) - fracDown;
+ CF2_Fixed upMoveUp = ( fracUp == 0 )
+ ? 0
+ : cf2_intToFixed( 1 ) - fracUp;
+
+ /* smallest move up */
+ CF2_Fixed moveUp = FT_MIN( downMoveUp, upMoveUp );
+ /* smallest move down */
+ CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown );
+
+ /* final amount to move edge or edge pair */
+ CF2_Fixed move;
+
+ CF2_Fixed downMinCounter = CF2_MIN_COUNTER;
+ CF2_Fixed upMinCounter = CF2_MIN_COUNTER;
+ FT_Bool saveEdge = FALSE;
+
+
+ /* minimum counter constraint doesn't apply when adjacent edges */
+ /* are synthetic */
+ /* TODO: doesn't seem a big effect; for now, reduce the code */
+#if 0
+ if ( i == 0 ||
+ cf2_hint_isSynthetic( &hintmap->edge[i - 1] ) )
+ downMinCounter = 0;
+
+ if ( j >= hintmap->count - 1 ||
+ cf2_hint_isSynthetic( &hintmap->edge[j + 1] ) )
+ upMinCounter = 0;
+#endif
+
+ /* is there room to move up? */
+ /* there is if we are at top of array or the next edge is at or */
+ /* beyond proposed move up? */
+ if ( j >= hintmap->count - 1 ||
+ hintmap->edge[j + 1].dsCoord >=
+ ADD_INT32( hintmap->edge[j].dsCoord,
+ moveUp + upMinCounter ) )
+ {
+ /* there is room to move up; is there also room to move down? */
+ if ( i == 0 ||
+ hintmap->edge[i - 1].dsCoord <=
+ ADD_INT32( hintmap->edge[i].dsCoord,
+ moveDown - downMinCounter ) )
+ {
+ /* move smaller absolute amount */
+ move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */
+ }
+ else
+ move = moveUp;
+ }
+ else
+ {
+ /* is there room to move down? */
+ if ( i == 0 ||
+ hintmap->edge[i - 1].dsCoord <=
+ ADD_INT32( hintmap->edge[i].dsCoord,
+ moveDown - downMinCounter ) )
+ {
+ move = moveDown;
+ /* true if non-optimum move */
+ saveEdge = (FT_Bool)( moveUp < -moveDown );
+ }
+ else
+ {
+ /* no room to move either way without overlapping or reducing */
+ /* the counter too much */
+ move = 0;
+ saveEdge = TRUE;
+ }
+ }
+
+ /* Identify non-moves and moves down that aren't optimal, and save */
+ /* them for second pass. */
+ /* Do this only if there is an unlocked edge above (which could */
+ /* possibly move). */
+ if ( saveEdge &&
+ j < hintmap->count - 1 &&
+ !cf2_hint_isLocked( &hintmap->edge[j + 1] ) )
+ {
+ CF2_HintMoveRec savedMove;
+
+
+ savedMove.j = j;
+ /* desired adjustment in second pass */
+ savedMove.moveUp = moveUp - move;
+
+ cf2_arrstack_push( hintmap->hintMoves, &savedMove );
+ }
+
+ /* move the edge(s) */
+ hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord,
+ move );
+ if ( isPair )
+ hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord,
+ move );
+ }
+
+ /* assert there are no overlaps in device space */
+ FT_ASSERT( i == 0 ||
+ hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord );
+ FT_ASSERT( i < j ||
+ hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord );
+
+ /* adjust the scales, avoiding divide by zero */
+ if ( i > 0 )
+ {
+ if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord )
+ hintmap->edge[i - 1].scale =
+ FT_DivFix( SUB_INT32( hintmap->edge[i].dsCoord,
+ hintmap->edge[i - 1].dsCoord ),
+ SUB_INT32( hintmap->edge[i].csCoord,
+ hintmap->edge[i - 1].csCoord ) );
+ }
+
+ if ( isPair )
+ {
+ if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord )
+ hintmap->edge[j - 1].scale =
+ FT_DivFix( SUB_INT32( hintmap->edge[j].dsCoord,
+ hintmap->edge[j - 1].dsCoord ),
+ SUB_INT32( hintmap->edge[j].csCoord,
+ hintmap->edge[j - 1].csCoord ) );
+
+ i += 1; /* skip upper edge on next loop */
+ }
+ }
+
+ /* second pass tries to move non-optimal hints up, in case there is */
+ /* room now */
+ for ( i = cf2_arrstack_size( hintmap->hintMoves ); i > 0; i-- )
+ {
+ CF2_HintMove hintMove = (CF2_HintMove)
+ cf2_arrstack_getPointer( hintmap->hintMoves, i - 1 );
+
+
+ j = hintMove->j;
+
+ /* this was tested before the push, above */
+ FT_ASSERT( j < hintmap->count - 1 );
+
+ /* is there room to move up? */
+ if ( hintmap->edge[j + 1].dsCoord >=
+ ADD_INT32( hintmap->edge[j].dsCoord,
+ hintMove->moveUp + CF2_MIN_COUNTER ) )
+ {
+ /* there is more room now, move edge up */
+ hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord,
+ hintMove->moveUp );
+
+ if ( cf2_hint_isPair( &hintmap->edge[j] ) )
+ {
+ FT_ASSERT( j > 0 );
+ hintmap->edge[j - 1].dsCoord =
+ ADD_INT32( hintmap->edge[j - 1].dsCoord, hintMove->moveUp );
+ }
+ }
+ }
+ }
+
+
+ /* insert hint edges into map, sorted by csCoord */
+ static void
+ cf2_hintmap_insertHint( CF2_HintMap hintmap,
+ CF2_Hint bottomHintEdge,
+ CF2_Hint topHintEdge )
+ {
+ CF2_UInt indexInsert;
+
+ /* set default values, then check for edge hints */
+ FT_Bool isPair = TRUE;
+ CF2_Hint firstHintEdge = bottomHintEdge;
+ CF2_Hint secondHintEdge = topHintEdge;
+
+
+ /* one or none of the input params may be invalid when dealing with */
+ /* edge hints; at least one edge must be valid */
+ FT_ASSERT( cf2_hint_isValid( bottomHintEdge ) ||
+ cf2_hint_isValid( topHintEdge ) );
+
+ /* determine how many and which edges to insert */
+ if ( !cf2_hint_isValid( bottomHintEdge ) )
+ {
+ /* insert only the top edge */
+ firstHintEdge = topHintEdge;
+ isPair = FALSE;
+ }
+ else if ( !cf2_hint_isValid( topHintEdge ) )
+ {
+ /* insert only the bottom edge */
+ isPair = FALSE;
+ }
+
+ /* paired edges must be in proper order */
+ if ( isPair &&
+ topHintEdge->csCoord < bottomHintEdge->csCoord )
+ return;
+
+ /* linear search to find index value of insertion point */
+ indexInsert = 0;
+ for ( ; indexInsert < hintmap->count; indexInsert++ )
+ {
+ if ( hintmap->edge[indexInsert].csCoord >= firstHintEdge->csCoord )
+ break;
+ }
+
+ FT_TRACE7(( " Got hint at %.2f (%.2f)\n",
+ firstHintEdge->csCoord / 65536.0,
+ firstHintEdge->dsCoord / 65536.0 ));
+ if ( isPair )
+ FT_TRACE7(( " Got hint at %.2f (%.2f)\n",
+ secondHintEdge->csCoord / 65536.0,
+ secondHintEdge->dsCoord / 65536.0 ));
+
+ /*
+ * Discard any hints that overlap in character space. Most often, this
+ * is while building the initial map, where captured hints from all
+ * zones are combined. Define overlap to include hints that `touch'
+ * (overlap zero). Hiragino Sans/Gothic fonts have numerous hints that
+ * touch. Some fonts have non-ideographic glyphs that overlap our
+ * synthetic hints.
+ *
+ * Overlap also occurs when darkening stem hints that are close.
+ *
+ */
+ if ( indexInsert < hintmap->count )
+ {
+ /* we are inserting before an existing edge: */
+ /* verify that an existing edge is not the same */
+ if ( hintmap->edge[indexInsert].csCoord == firstHintEdge->csCoord )
+ return; /* ignore overlapping stem hint */
+
+ /* verify that a new pair does not straddle the next edge */
+ if ( isPair &&
+ hintmap->edge[indexInsert].csCoord <= secondHintEdge->csCoord )
+ return; /* ignore overlapping stem hint */
+
+ /* verify that we are not inserting between paired edges */
+ if ( cf2_hint_isPairTop( &hintmap->edge[indexInsert] ) )
+ return; /* ignore overlapping stem hint */
+ }
+
+ /* recompute device space locations using initial hint map */
+ if ( cf2_hintmap_isValid( hintmap->initialHintMap ) &&
+ !cf2_hint_isLocked( firstHintEdge ) )
+ {
+ if ( isPair )
+ {
+ /* Use hint map to position the center of stem, and nominal scale */
+ /* to position the two edges. This preserves the stem width. */
+ CF2_Fixed midpoint =
+ cf2_hintmap_map(
+ hintmap->initialHintMap,
+ ADD_INT32( secondHintEdge->csCoord,
+ firstHintEdge->csCoord ) / 2 );
+ CF2_Fixed halfWidth =
+ FT_MulFix( SUB_INT32( secondHintEdge->csCoord,
+ firstHintEdge->csCoord ) / 2,
+ hintmap->scale );
+
+
+ firstHintEdge->dsCoord = SUB_INT32( midpoint, halfWidth );
+ secondHintEdge->dsCoord = ADD_INT32( midpoint, halfWidth );
+ }
+ else
+ firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap,
+ firstHintEdge->csCoord );
+ }
+
+ /*
+ * Discard any hints that overlap in device space; this can occur
+ * because locked hints have been moved to align with blue zones.
+ *
+ * TODO: Although we might correct this later during adjustment, we
+ * don't currently have a way to delete a conflicting hint once it has
+ * been inserted. See v2.030 MinionPro-Regular, 12 ppem darkened,
+ * initial hint map for second path, glyph 945 (the perispomeni (tilde)
+ * in U+1F6E, Greek omega with psili and perispomeni). Darkening is
+ * 25. Pair 667,747 initially conflicts in design space with top edge
+ * 660. This is because 667 maps to 7.87, and the top edge was
+ * captured by a zone at 8.0. The pair is later successfully inserted
+ * in a zone without the top edge. In this zone it is adjusted to 8.0,
+ * and no longer conflicts with the top edge in design space. This
+ * means it can be included in yet a later zone which does have the top
+ * edge hint. This produces a small mismatch between the first and
+ * last points of this path, even though the hint masks are the same.
+ * The density map difference is tiny (1/256).
+ *
+ */
+
+ if ( indexInsert > 0 )
+ {
+ /* we are inserting after an existing edge */
+ if ( firstHintEdge->dsCoord < hintmap->edge[indexInsert - 1].dsCoord )
+ return;
+ }
+
+ if ( indexInsert < hintmap->count )
+ {
+ /* we are inserting before an existing edge */
+ if ( isPair )
+ {
+ if ( secondHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord )
+ return;
+ }
+ else
+ {
+ if ( firstHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord )
+ return;
+ }
+ }
+
+ /* make room to insert */
+ {
+ CF2_UInt iSrc = hintmap->count - 1;
+ CF2_UInt iDst = isPair ? hintmap->count + 1 : hintmap->count;
+
+ CF2_UInt count = hintmap->count - indexInsert;
+
+
+ if ( iDst >= CF2_MAX_HINT_EDGES )
+ {
+ FT_TRACE4(( "cf2_hintmap_insertHint: too many hintmaps\n" ));
+ return;
+ }
+
+ while ( count-- )
+ hintmap->edge[iDst--] = hintmap->edge[iSrc--];
+
+ /* insert first edge */
+ hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
+ hintmap->count += 1;
+
+ FT_TRACE7(( " Inserting hint %.2f (%.2f)\n",
+ firstHintEdge->csCoord / 65536.0,
+ firstHintEdge->dsCoord / 65536.0 ));
+
+ if ( isPair )
+ {
+ /* insert second edge */
+ hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */
+ hintmap->count += 1;
+
+ FT_TRACE7(( " Inserting hint %.2f (%.2f)\n",
+ secondHintEdge->csCoord / 65536.0,
+ secondHintEdge->dsCoord / 65536.0 ));
+
+ }
+ }
+
+ return;
+ }
+
+
+ /*
+ * Build a map from hints and mask.
+ *
+ * This function may recur one level if `hintmap->initialHintMap' is not yet
+ * valid.
+ * If `initialMap' is true, simply build initial map.
+ *
+ * Synthetic hints are used in two ways. A hint at zero is inserted, if
+ * needed, in the initial hint map, to prevent translations from
+ * propagating across the origin. If synthetic em box hints are enabled
+ * for ideographic dictionaries, then they are inserted in all hint
+ * maps, including the initial one.
+ *
+ */
+ FT_LOCAL_DEF( void )
+ cf2_hintmap_build( CF2_HintMap hintmap,
+ CF2_ArrStack hStemHintArray,
+ CF2_ArrStack vStemHintArray,
+ CF2_HintMask hintMask,
+ CF2_Fixed hintOrigin,
+ FT_Bool initialMap )
+ {
+ FT_Byte* maskPtr;
+
+ CF2_Font font = hintmap->font;
+ CF2_HintMaskRec tempHintMask;
+
+ size_t bitCount, i;
+ FT_Byte maskByte;
+
+
+ /* check whether initial map is constructed */
+ if ( !initialMap && !cf2_hintmap_isValid( hintmap->initialHintMap ) )
+ {
+ /* make recursive call with initialHintMap and temporary mask; */
+ /* temporary mask will get all bits set, below */
+ cf2_hintmask_init( &tempHintMask, hintMask->error );
+ cf2_hintmap_build( hintmap->initialHintMap,
+ hStemHintArray,
+ vStemHintArray,
+ &tempHintMask,
+ hintOrigin,
+ TRUE );
+ }
+
+ if ( !cf2_hintmask_isValid( hintMask ) )
+ {
+ /* without a hint mask, assume all hints are active */
+ cf2_hintmask_setAll( hintMask,
+ cf2_arrstack_size( hStemHintArray ) +
+ cf2_arrstack_size( vStemHintArray ) );
+ if ( !cf2_hintmask_isValid( hintMask ) )
+ {
+ if ( font->isT1 )
+ {
+ /* no error, just continue unhinted */
+ *hintMask->error = FT_Err_Ok;
+ hintmap->hinted = FALSE;
+ }
+ return; /* too many stem hints */
+ }
+ }
+
+ /* begin by clearing the map */
+ hintmap->count = 0;
+ hintmap->lastIndex = 0;
+
+ /* make a copy of the hint mask so we can modify it */
+ tempHintMask = *hintMask;
+ maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
+
+ /* use the hStem hints only, which are first in the mask */
+ bitCount = cf2_arrstack_size( hStemHintArray );
+
+ /* Defense-in-depth. Should never return here. */
+ if ( bitCount > hintMask->bitCount )
+ return;
+
+ /* synthetic embox hints get highest priority */
+ if ( font->blues.doEmBoxHints )
+ {
+ CF2_HintRec dummy;
+
+
+ cf2_hint_initZero( &dummy ); /* invalid hint map element */
+
+ /* ghost bottom */
+ cf2_hintmap_insertHint( hintmap,
+ &font->blues.emBoxBottomEdge,
+ &dummy );
+ /* ghost top */
+ cf2_hintmap_insertHint( hintmap,
+ &dummy,
+ &font->blues.emBoxTopEdge );
+ }
+
+ /* insert hints captured by a blue zone or already locked (higher */
+ /* priority) */
+ for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
+ {
+ if ( maskByte & *maskPtr )
+ {
+ /* expand StemHint into two `CF2_Hint' elements */
+ CF2_HintRec bottomHintEdge, topHintEdge;
+
+
+ cf2_hint_init( &bottomHintEdge,
+ hStemHintArray,
+ i,
+ font,
+ hintOrigin,
+ hintmap->scale,
+ TRUE /* bottom */ );
+ cf2_hint_init( &topHintEdge,
+ hStemHintArray,
+ i,
+ font,
+ hintOrigin,
+ hintmap->scale,
+ FALSE /* top */ );
+
+ if ( cf2_hint_isLocked( &bottomHintEdge ) ||
+ cf2_hint_isLocked( &topHintEdge ) ||
+ cf2_blues_capture( &font->blues,
+ &bottomHintEdge,
+ &topHintEdge ) )
+ {
+ /* insert captured hint into map */
+ cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
+
+ *maskPtr &= ~maskByte; /* turn off the bit for this hint */
+ }
+ }
+
+ if ( ( i & 7 ) == 7 )
+ {
+ /* move to next mask byte */
+ maskPtr++;
+ maskByte = 0x80;
+ }
+ else
+ maskByte >>= 1;
+ }
+
+ /* initial hint map includes only captured hints plus maybe one at 0 */
+
+ /*
+ * TODO: There is a problem here because we are trying to build a
+ * single hint map containing all captured hints. It is
+ * possible for there to be conflicts between captured hints,
+ * either because of darkening or because the hints are in
+ * separate hint zones (we are ignoring hint zones for the
+ * initial map). An example of the latter is MinionPro-Regular
+ * v2.030 glyph 883 (Greek Capital Alpha with Psili) at 15ppem.
+ * A stem hint for the psili conflicts with the top edge hint
+ * for the base character. The stem hint gets priority because
+ * of its sort order. In glyph 884 (Greek Capital Alpha with
+ * Psili and Oxia), the top of the base character gets a stem
+ * hint, and the psili does not. This creates different initial
+ * maps for the two glyphs resulting in different renderings of
+ * the base character. Will probably defer this either as not
+ * worth the cost or as a font bug. I don't think there is any
+ * good reason for an accent to be captured by an alignment
+ * zone. -darnold 2/12/10
+ */
+
+ if ( initialMap )
+ {
+ /* Apply a heuristic that inserts a point for (0,0), unless it's */
+ /* already covered by a mapping. This locks the baseline for glyphs */
+ /* that have no baseline hints. */
+
+ if ( hintmap->count == 0 ||
+ hintmap->edge[0].csCoord > 0 ||
+ hintmap->edge[hintmap->count - 1].csCoord < 0 )
+ {
+ /* all edges are above 0 or all edges are below 0; */
+ /* construct a locked edge hint at 0 */
+
+ CF2_HintRec edge, invalid;
+
+
+ cf2_hint_initZero( &edge );
+
+ edge.flags = CF2_GhostBottom |
+ CF2_Locked |
+ CF2_Synthetic;
+ edge.scale = hintmap->scale;
+
+ cf2_hint_initZero( &invalid );
+ cf2_hintmap_insertHint( hintmap, &edge, &invalid );
+ }
+ }
+ else
+ {
+ /* insert remaining hints */
+
+ maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
+
+ for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
+ {
+ if ( maskByte & *maskPtr )
+ {
+ CF2_HintRec bottomHintEdge, topHintEdge;
+
+
+ cf2_hint_init( &bottomHintEdge,
+ hStemHintArray,
+ i,
+ font,
+ hintOrigin,
+ hintmap->scale,
+ TRUE /* bottom */ );
+ cf2_hint_init( &topHintEdge,
+ hStemHintArray,
+ i,
+ font,
+ hintOrigin,
+ hintmap->scale,
+ FALSE /* top */ );
+
+ cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
+ }
+
+ if ( ( i & 7 ) == 7 )
+ {
+ /* move to next mask byte */
+ maskPtr++;
+ maskByte = 0x80;
+ }
+ else
+ maskByte >>= 1;
+ }
+ }
+
+ FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op "
+ "[b]ottom [L]ocked [S]ynthetic\n"
+ "Initial hintmap\n"
+ : "Hints:\n" ));
+ cf2_hintmap_dump( hintmap );
+
+ /*
+ * Note: The following line is a convenient place to break when
+ * debugging hinting. Examine `hintmap->edge' for the list of
+ * enabled hints, then step over the call to see the effect of
+ * adjustment. We stop here first on the recursive call that
+ * creates the initial map, and then on each counter group and
+ * hint zone.
+ */
+
+ /* adjust positions of hint edges that are not locked to blue zones */
+ cf2_hintmap_adjustHints( hintmap );
+
+ FT_TRACE6(( "(adjusted)\n" ));
+ cf2_hintmap_dump( hintmap );
+
+ /* save the position of all hints that were used in this hint map; */
+ /* if we use them again, we'll locate them in the same position */
+ if ( !initialMap )
+ {
+ for ( i = 0; i < hintmap->count; i++ )
+ {
+ if ( !cf2_hint_isSynthetic( &hintmap->edge[i] ) )
+ {
+ /* Note: include both valid and invalid edges */
+ /* Note: top and bottom edges are copied back separately */
+ CF2_StemHint stemhint = (CF2_StemHint)
+ cf2_arrstack_getPointer( hStemHintArray,
+ hintmap->edge[i].index );
+
+
+ if ( cf2_hint_isTop( &hintmap->edge[i] ) )
+ stemhint->maxDS = hintmap->edge[i].dsCoord;
+ else
+ stemhint->minDS = hintmap->edge[i].dsCoord;
+
+ stemhint->used = TRUE;
+ }
+ }
+ }
+
+ /* hint map is ready to use */
+ hintmap->isValid = TRUE;
+
+ /* remember this mask has been used */
+ cf2_hintmask_setNew( hintMask, FALSE );
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_glyphpath_init( CF2_GlyphPath glyphpath,
+ CF2_Font font,
+ CF2_OutlineCallbacks callbacks,
+ CF2_Fixed scaleY,
+ /* CF2_Fixed hShift, */
+ CF2_ArrStack hStemHintArray,
+ CF2_ArrStack vStemHintArray,
+ CF2_HintMask hintMask,
+ CF2_Fixed hintOriginY,
+ const CF2_Blues blues,
+ const FT_Vector* fractionalTranslation )
+ {
+ FT_ZERO( glyphpath );
+
+ glyphpath->font = font;
+ glyphpath->callbacks = callbacks;
+
+ cf2_arrstack_init( &glyphpath->hintMoves,
+ font->memory,
+ &font->error,
+ sizeof ( CF2_HintMoveRec ) );
+
+ cf2_hintmap_init( &glyphpath->initialHintMap,
+ font,
+ &glyphpath->initialHintMap,
+ &glyphpath->hintMoves,
+ scaleY );
+ cf2_hintmap_init( &glyphpath->firstHintMap,
+ font,
+ &glyphpath->initialHintMap,
+ &glyphpath->hintMoves,
+ scaleY );
+ cf2_hintmap_init( &glyphpath->hintMap,
+ font,
+ &glyphpath->initialHintMap,
+ &glyphpath->hintMoves,
+ scaleY );
+
+ glyphpath->scaleX = font->innerTransform.a;
+ glyphpath->scaleC = font->innerTransform.c;
+ glyphpath->scaleY = font->innerTransform.d;
+
+ glyphpath->fractionalTranslation = *fractionalTranslation;
+
+#if 0
+ glyphpath->hShift = hShift; /* for fauxing */
+#endif
+
+ glyphpath->hStemHintArray = hStemHintArray;
+ glyphpath->vStemHintArray = vStemHintArray;
+ glyphpath->hintMask = hintMask; /* ptr to current mask */
+ glyphpath->hintOriginY = hintOriginY;
+ glyphpath->blues = blues;
+ glyphpath->darken = font->darkened; /* TODO: should we make copies? */
+ glyphpath->xOffset = font->darkenX;
+ glyphpath->yOffset = font->darkenY;
+ glyphpath->miterLimit = 2 * FT_MAX(
+ cf2_fixedAbs( glyphpath->xOffset ),
+ cf2_fixedAbs( glyphpath->yOffset ) );
+
+ /* .1 character space unit */
+ glyphpath->snapThreshold = cf2_doubleToFixed( 0.1 );
+
+ glyphpath->moveIsPending = TRUE;
+ glyphpath->pathIsOpen = FALSE;
+ glyphpath->pathIsClosing = FALSE;
+ glyphpath->elemIsQueued = FALSE;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_glyphpath_finalize( CF2_GlyphPath glyphpath )
+ {
+ cf2_arrstack_finalize( &glyphpath->hintMoves );
+ }
+
+
+ /*
+ * Hint point in y-direction and apply outerTransform.
+ * Input `current' hint map (which is actually delayed by one element).
+ * Input x,y point in Character Space.
+ * Output x,y point in Device Space, including translation.
+ */
+ static void
+ cf2_glyphpath_hintPoint( CF2_GlyphPath glyphpath,
+ CF2_HintMap hintmap,
+ FT_Vector* ppt,
+ CF2_Fixed x,
+ CF2_Fixed y )
+ {
+ FT_Vector pt; /* hinted point in upright DS */
+
+
+ pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ),
+ FT_MulFix( glyphpath->scaleC, y ) );
+ pt.y = cf2_hintmap_map( hintmap, y );
+
+ ppt->x = ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.a, pt.x ),
+ ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.c, pt.y ),
+ glyphpath->fractionalTranslation.x ) );
+ ppt->y = ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.b, pt.x ),
+ ADD_INT32(
+ FT_MulFix( glyphpath->font->outerTransform.d, pt.y ),
+ glyphpath->fractionalTranslation.y ) );
+ }
+
+
+ /*
+ * From two line segments, (u1,u2) and (v1,v2), compute a point of
+ * intersection on the corresponding lines.
+ * Return false if no intersection is found, or if the intersection is
+ * too far away from the ends of the line segments, u2 and v1.
+ *
+ */
+ static FT_Bool
+ cf2_glyphpath_computeIntersection( CF2_GlyphPath glyphpath,
+ const FT_Vector* u1,
+ const FT_Vector* u2,
+ const FT_Vector* v1,
+ const FT_Vector* v2,
+ FT_Vector* intersection )
+ {
+ /*
+ * Let `u' be a zero-based vector from the first segment, `v' from the
+ * second segment.
+ * Let `w 'be the zero-based vector from `u1' to `v1'.
+ * `perp' is the `perpendicular dot product'; see
+ * https://mathworld.wolfram.com/PerpDotProduct.html.
+ * `s' is the parameter for the parametric line for the first segment
+ * (`u').
+ *
+ * See notation in
+ * http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm.
+ * Calculations are done in 16.16, but must handle the squaring of
+ * line lengths in character space. We scale all vectors by 1/32 to
+ * avoid overflow. This allows values up to 4095 to be squared. The
+ * scale factor cancels in the divide.
+ *
+ * TODO: the scale factor could be computed from UnitsPerEm.
+ *
+ */
+
+#define cf2_perp( a, b ) \
+ ( FT_MulFix( a.x, b.y ) - FT_MulFix( a.y, b.x ) )
+
+ /* round and divide by 32 */
+#define CF2_CS_SCALE( x ) \
+ ( ( (x) + 0x10 ) >> 5 )
+
+ FT_Vector u, v, w; /* scaled vectors */
+ CF2_Fixed denominator, s;
+
+
+ u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) );
+ u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) );
+ v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) );
+ v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) );
+ w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) );
+ w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) );
+
+ denominator = cf2_perp( u, v );
+
+ if ( denominator == 0 )
+ return FALSE; /* parallel or coincident lines */
+
+ s = FT_DivFix( cf2_perp( w, v ), denominator );
+
+ intersection->x = ADD_INT32( u1->x,
+ FT_MulFix( s, SUB_INT32( u2->x, u1->x ) ) );
+ intersection->y = ADD_INT32( u1->y,
+ FT_MulFix( s, SUB_INT32( u2->y, u1->y ) ) );
+
+
+ /*
+ * Special case snapping for horizontal and vertical lines.
+ * This cleans up intersections and reduces problems with winding
+ * order detection.
+ * Sample case is sbc cd KozGoPr6N-Medium.otf 20 16685.
+ * Note: these calculations are in character space.
+ *
+ */
+
+ if ( u1->x == u2->x &&
+ cf2_fixedAbs( SUB_INT32( intersection->x,
+ u1->x ) ) < glyphpath->snapThreshold )
+ intersection->x = u1->x;
+ if ( u1->y == u2->y &&
+ cf2_fixedAbs( SUB_INT32( intersection->y,
+ u1->y ) ) < glyphpath->snapThreshold )
+ intersection->y = u1->y;
+
+ if ( v1->x == v2->x &&
+ cf2_fixedAbs( SUB_INT32( intersection->x,
+ v1->x ) ) < glyphpath->snapThreshold )
+ intersection->x = v1->x;
+ if ( v1->y == v2->y &&
+ cf2_fixedAbs( SUB_INT32( intersection->y,
+ v1->y ) ) < glyphpath->snapThreshold )
+ intersection->y = v1->y;
+
+ /* limit the intersection distance from midpoint of u2 and v1 */
+ if ( cf2_fixedAbs( intersection->x - ADD_INT32( u2->x, v1->x ) / 2 ) >
+ glyphpath->miterLimit ||
+ cf2_fixedAbs( intersection->y - ADD_INT32( u2->y, v1->y ) / 2 ) >
+ glyphpath->miterLimit )
+ return FALSE;
+
+ return TRUE;
+ }
+
+
+ /*
+ * Push the cached element (glyphpath->prevElem*) to the outline
+ * consumer. When a darkening offset is used, the end point of the
+ * cached element may be adjusted to an intersection point or we may
+ * synthesize a connecting line to the current element. If we are
+ * closing a subpath, we may also generate a connecting line to the start
+ * point.
+ *
+ * This is where Character Space (CS) is converted to Device Space (DS)
+ * using a hint map. This calculation must use a HintMap that was valid
+ * at the time the element was saved. For the first point in a subpath,
+ * that is a saved HintMap. For most elements, it just means the caller
+ * has delayed building a HintMap from the current HintMask.
+ *
+ * Transform each point with outerTransform and call the outline
+ * callbacks. This is a general 3x3 transform:
+ *
+ * x' = a*x + c*y + tx, y' = b*x + d*y + ty
+ *
+ * but it uses 4 elements from CF2_Font and the translation part
+ * from CF2_GlyphPath.
+ *
+ */
+ static void
+ cf2_glyphpath_pushPrevElem( CF2_GlyphPath glyphpath,
+ CF2_HintMap hintmap,
+ FT_Vector* nextP0,
+ FT_Vector nextP1,
+ FT_Bool close )
+ {
+ CF2_CallbackParamsRec params;
+
+ FT_Vector* prevP0;
+ FT_Vector* prevP1;
+
+ FT_Vector intersection = { 0, 0 };
+ FT_Bool useIntersection = FALSE;
+
+
+ FT_ASSERT( glyphpath->prevElemOp == CF2_PathOpLineTo ||
+ glyphpath->prevElemOp == CF2_PathOpCubeTo );
+
+ if ( glyphpath->prevElemOp == CF2_PathOpLineTo )
+ {
+ prevP0 = &glyphpath->prevElemP0;
+ prevP1 = &glyphpath->prevElemP1;
+ }
+ else
+ {
+ prevP0 = &glyphpath->prevElemP2;
+ prevP1 = &glyphpath->prevElemP3;
+ }
+
+ /* optimization: if previous and next elements are offset by the same */
+ /* amount, then there will be no gap, and no need to compute an */
+ /* intersection. */
+ if ( prevP1->x != nextP0->x || prevP1->y != nextP0->y )
+ {
+ /* previous element does not join next element: */
+ /* adjust end point of previous element to the intersection */
+ useIntersection = cf2_glyphpath_computeIntersection( glyphpath,
+ prevP0,
+ prevP1,
+ nextP0,
+ &nextP1,
+ &intersection );
+ if ( useIntersection )
+ {
+ /* modify the last point of the cached element (either line or */
+ /* curve) */
+ *prevP1 = intersection;
+ }
+ }
+
+ params.pt0 = glyphpath->currentDS;
+
+ switch( glyphpath->prevElemOp )
+ {
+ case CF2_PathOpLineTo:
+ params.op = CF2_PathOpLineTo;
+
+ /* note: pt2 and pt3 are unused */
+
+ if ( close )
+ {
+ /* use first hint map if closing */
+ cf2_glyphpath_hintPoint( glyphpath,
+ &glyphpath->firstHintMap,
+ &params.pt1,
+ glyphpath->prevElemP1.x,
+ glyphpath->prevElemP1.y );
+ }
+ else
+ {
+ cf2_glyphpath_hintPoint( glyphpath,
+ hintmap,
+ &params.pt1,
+ glyphpath->prevElemP1.x,
+ glyphpath->prevElemP1.y );
+ }
+
+ /* output only non-zero length lines */
+ if ( params.pt0.x != params.pt1.x || params.pt0.y != params.pt1.y )
+ {
+ glyphpath->callbacks->lineTo( glyphpath->callbacks, &params );
+
+ glyphpath->currentDS = params.pt1;
+ }
+ break;
+
+ case CF2_PathOpCubeTo:
+ params.op = CF2_PathOpCubeTo;
+
+ /* TODO: should we intersect the interior joins (p1-p2 and p2-p3)? */
+ cf2_glyphpath_hintPoint( glyphpath,
+ hintmap,
+ &params.pt1,
+ glyphpath->prevElemP1.x,
+ glyphpath->prevElemP1.y );
+ cf2_glyphpath_hintPoint( glyphpath,
+ hintmap,
+ &params.pt2,
+ glyphpath->prevElemP2.x,
+ glyphpath->prevElemP2.y );
+ cf2_glyphpath_hintPoint( glyphpath,
+ hintmap,
+ &params.pt3,
+ glyphpath->prevElemP3.x,
+ glyphpath->prevElemP3.y );
+
+ glyphpath->callbacks->cubeTo( glyphpath->callbacks, &params );
+
+ glyphpath->currentDS = params.pt3;
+
+ break;
+ }
+
+ if ( !useIntersection || close )
+ {
+ /* insert connecting line between end of previous element and start */
+ /* of current one */
+ /* note: at the end of a subpath, we might do both, so use `nextP0' */
+ /* before we change it, below */
+
+ if ( close )
+ {
+ /* if we are closing the subpath, then nextP0 is in the first */
+ /* hint zone */
+ cf2_glyphpath_hintPoint( glyphpath,
+ &glyphpath->firstHintMap,
+ &params.pt1,
+ nextP0->x,
+ nextP0->y );
+ }
+ else
+ {
+ cf2_glyphpath_hintPoint( glyphpath,
+ hintmap,
+ &params.pt1,
+ nextP0->x,
+ nextP0->y );
+ }
+
+ if ( params.pt1.x != glyphpath->currentDS.x ||
+ params.pt1.y != glyphpath->currentDS.y )
+ {
+ /* length is nonzero */
+ params.op = CF2_PathOpLineTo;
+ params.pt0 = glyphpath->currentDS;
+
+ /* note: pt2 and pt3 are unused */
+ glyphpath->callbacks->lineTo( glyphpath->callbacks, &params );
+
+ glyphpath->currentDS = params.pt1;
+ }
+ }
+
+ if ( useIntersection )
+ {
+ /* return intersection point to caller */
+ *nextP0 = intersection;
+ }
+ }
+
+
+ /* push a MoveTo element based on current point and offset of current */
+ /* element */
+ static void
+ cf2_glyphpath_pushMove( CF2_GlyphPath glyphpath,
+ FT_Vector start )
+ {
+ CF2_CallbackParamsRec params;
+
+
+ params.op = CF2_PathOpMoveTo;
+ params.pt0 = glyphpath->currentDS;
+
+ /* Test if move has really happened yet; it would have called */
+ /* `cf2_hintmap_build' to set `isValid'. */
+ if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) )
+ {
+ /* we are here iff first subpath is missing a moveto operator: */
+ /* synthesize first moveTo to finish initialization of hintMap */
+ cf2_glyphpath_moveTo( glyphpath,
+ glyphpath->start.x,
+ glyphpath->start.y );
+ }
+
+ cf2_glyphpath_hintPoint( glyphpath,
+ &glyphpath->hintMap,
+ &params.pt1,
+ start.x,
+ start.y );
+
+ /* note: pt2 and pt3 are unused */
+ glyphpath->callbacks->moveTo( glyphpath->callbacks, &params );
+
+ glyphpath->currentDS = params.pt1;
+ glyphpath->offsetStart0 = start;
+ }
+
+
+ /*
+ * All coordinates are in character space.
+ * On input, (x1, y1) and (x2, y2) give line segment.
+ * On output, (x, y) give offset vector.
+ * We use a piecewise approximation to trig functions.
+ *
+ * TODO: Offset true perpendicular and proper length
+ * supply the y-translation for hinting here, too,
+ * that adds yOffset unconditionally to *y.
+ */
+ static void
+ cf2_glyphpath_computeOffset( CF2_GlyphPath glyphpath,
+ CF2_Fixed x1,
+ CF2_Fixed y1,
+ CF2_Fixed x2,
+ CF2_Fixed y2,
+ CF2_Fixed* x,
+ CF2_Fixed* y )
+ {
+ CF2_Fixed dx = SUB_INT32( x2, x1 );
+ CF2_Fixed dy = SUB_INT32( y2, y1 );
+
+
+ /* note: negative offsets don't work here; negate deltas to change */
+ /* quadrants, below */
+ if ( glyphpath->font->reverseWinding )
+ {
+ dx = NEG_INT32( dx );
+ dy = NEG_INT32( dy );
+ }
+
+ *x = *y = 0;
+
+ if ( !glyphpath->darken )
+ return;
+
+ /* add momentum for this path element */
+ glyphpath->callbacks->windingMomentum =
+ ADD_INT32( glyphpath->callbacks->windingMomentum,
+ cf2_getWindingMomentum( x1, y1, x2, y2 ) );
+
+ /* note: allow mixed integer and fixed multiplication here */
+ if ( dx >= 0 )
+ {
+ if ( dy >= 0 )
+ {
+ /* first quadrant, +x +y */
+
+ if ( dx > MUL_INT32( 2, dy ) )
+ {
+ /* +x */
+ *x = 0;
+ *y = 0;
+ }
+ else if ( dy > MUL_INT32( 2, dx ) )
+ {
+ /* +y */
+ *x = glyphpath->xOffset;
+ *y = glyphpath->yOffset;
+ }
+ else
+ {
+ /* +x +y */
+ *x = FT_MulFix( cf2_doubleToFixed( 0.7 ),
+ glyphpath->xOffset );
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ),
+ glyphpath->yOffset );
+ }
+ }
+ else
+ {
+ /* fourth quadrant, +x -y */
+
+ if ( dx > MUL_INT32( -2, dy ) )
+ {
+ /* +x */
+ *x = 0;
+ *y = 0;
+ }
+ else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) )
+ {
+ /* -y */
+ *x = NEG_INT32( glyphpath->xOffset );
+ *y = glyphpath->yOffset;
+ }
+ else
+ {
+ /* +x -y */
+ *x = FT_MulFix( cf2_doubleToFixed( -0.7 ),
+ glyphpath->xOffset );
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 - 0.7 ),
+ glyphpath->yOffset );
+ }
+ }
+ }
+ else
+ {
+ if ( dy >= 0 )
+ {
+ /* second quadrant, -x +y */
+
+ if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) )
+ {
+ /* -x */
+ *x = 0;
+ *y = MUL_INT32( 2, glyphpath->yOffset );
+ }
+ else if ( dy > MUL_INT32( -2, dx ) )
+ {
+ /* +y */
+ *x = glyphpath->xOffset;
+ *y = glyphpath->yOffset;
+ }
+ else
+ {
+ /* -x +y */
+ *x = FT_MulFix( cf2_doubleToFixed( 0.7 ),
+ glyphpath->xOffset );
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ),
+ glyphpath->yOffset );
+ }
+ }
+ else
+ {
+ /* third quadrant, -x -y */
+
+ if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) )
+ {
+ /* -x */
+ *x = 0;
+ *y = MUL_INT32( 2, glyphpath->yOffset );
+ }
+ else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) )
+ {
+ /* -y */
+ *x = NEG_INT32( glyphpath->xOffset );
+ *y = glyphpath->yOffset;
+ }
+ else
+ {
+ /* -x -y */
+ *x = FT_MulFix( cf2_doubleToFixed( -0.7 ),
+ glyphpath->xOffset );
+ *y = FT_MulFix( cf2_doubleToFixed( 1.0 + 0.7 ),
+ glyphpath->yOffset );
+ }
+ }
+ }
+ }
+
+
+ /*
+ * The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are
+ * called by the interpreter with Character Space (CS) coordinates. Each
+ * path element is placed into a queue of length one to await the
+ * calculation of the following element. At that time, the darkening
+ * offset of the following element is known and joins can be computed,
+ * including possible modification of this element, before mapping to
+ * Device Space (DS) and passing it on to the outline consumer.
+ *
+ */
+ FT_LOCAL_DEF( void )
+ cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
+ CF2_Fixed x,
+ CF2_Fixed y )
+ {
+ cf2_glyphpath_closeOpenPath( glyphpath );
+
+ /* save the parameters of the move for later, when we'll know how to */
+ /* offset it; */
+ /* also save last move point */
+ glyphpath->currentCS.x = glyphpath->start.x = x;
+ glyphpath->currentCS.y = glyphpath->start.y = y;
+
+ glyphpath->moveIsPending = TRUE;
+
+ /* ensure we have a valid map with current mask */
+ if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ||
+ cf2_hintmask_isNew( glyphpath->hintMask ) )
+ cf2_hintmap_build( &glyphpath->hintMap,
+ glyphpath->hStemHintArray,
+ glyphpath->vStemHintArray,
+ glyphpath->hintMask,
+ glyphpath->hintOriginY,
+ FALSE );
+
+ /* save a copy of current HintMap to use when drawing initial point */
+ glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath,
+ CF2_Fixed x,
+ CF2_Fixed y )
+ {
+ CF2_Fixed xOffset, yOffset;
+ FT_Vector P0, P1;
+ FT_Bool newHintMap;
+
+ /*
+ * New hints will be applied after cf2_glyphpath_pushPrevElem has run.
+ * In case this is a synthesized closing line, any new hints should be
+ * delayed until this path is closed (`cf2_hintmask_isNew' will be
+ * called again before the next line or curve).
+ */
+
+ /* true if new hint map not on close */
+ newHintMap = cf2_hintmask_isNew( glyphpath->hintMask ) &&
+ !glyphpath->pathIsClosing;
+
+ /*
+ * Zero-length lines may occur in the charstring. Because we cannot
+ * compute darkening offsets or intersections from zero-length lines,
+ * it is best to remove them and avoid artifacts. However, zero-length
+ * lines in CS at the start of a new hint map can generate non-zero
+ * lines in DS due to hint substitution. We detect a change in hint
+ * map here and pass those zero-length lines along.
+ */
+
+ /*
+ * Note: Find explicitly closed paths here with a conditional
+ * breakpoint using
+ *
+ * !gp->pathIsClosing && gp->start.x == x && gp->start.y == y
+ *
+ */
+
+ if ( glyphpath->currentCS.x == x &&
+ glyphpath->currentCS.y == y &&
+ !newHintMap )
+ /*
+ * Ignore zero-length lines in CS where the hint map is the same
+ * because the line in DS will also be zero length.
+ *
+ * Ignore zero-length lines when we synthesize a closing line because
+ * the close will be handled in cf2_glyphPath_pushPrevElem.
+ */
+ return;
+
+ cf2_glyphpath_computeOffset( glyphpath,
+ glyphpath->currentCS.x,
+ glyphpath->currentCS.y,
+ x,
+ y,
+ &xOffset,
+ &yOffset );
+
+ /* construct offset points */
+ P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset );
+ P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset );
+ P1.x = ADD_INT32( x, xOffset );
+ P1.y = ADD_INT32( y, yOffset );
+
+ if ( glyphpath->moveIsPending )
+ {
+ /* emit offset 1st point as MoveTo */
+ cf2_glyphpath_pushMove( glyphpath, P0 );
+
+ glyphpath->moveIsPending = FALSE; /* adjust state machine */
+ glyphpath->pathIsOpen = TRUE;
+
+ glyphpath->offsetStart1 = P1; /* record second point */
+ }
+
+ if ( glyphpath->elemIsQueued )
+ {
+ FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
+ glyphpath->hintMap.count == 0 );
+
+ cf2_glyphpath_pushPrevElem( glyphpath,
+ &glyphpath->hintMap,
+ &P0,
+ P1,
+ FALSE );
+ }
+
+ /* queue the current element with offset points */
+ glyphpath->elemIsQueued = TRUE;
+ glyphpath->prevElemOp = CF2_PathOpLineTo;
+ glyphpath->prevElemP0 = P0;
+ glyphpath->prevElemP1 = P1;
+
+ /* update current map */
+ if ( newHintMap )
+ cf2_hintmap_build( &glyphpath->hintMap,
+ glyphpath->hStemHintArray,
+ glyphpath->vStemHintArray,
+ glyphpath->hintMask,
+ glyphpath->hintOriginY,
+ FALSE );
+
+ glyphpath->currentCS.x = x; /* pre-offset current point */
+ glyphpath->currentCS.y = y;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath,
+ CF2_Fixed x1,
+ CF2_Fixed y1,
+ CF2_Fixed x2,
+ CF2_Fixed y2,
+ CF2_Fixed x3,
+ CF2_Fixed y3 )
+ {
+ CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3;
+ FT_Vector P0, P1, P2, P3;
+
+
+ /* TODO: ignore zero length portions of curve?? */
+ cf2_glyphpath_computeOffset( glyphpath,
+ glyphpath->currentCS.x,
+ glyphpath->currentCS.y,
+ x1,
+ y1,
+ &xOffset1,
+ &yOffset1 );
+ cf2_glyphpath_computeOffset( glyphpath,
+ x2,
+ y2,
+ x3,
+ y3,
+ &xOffset3,
+ &yOffset3 );
+
+ /* add momentum from the middle segment */
+ glyphpath->callbacks->windingMomentum =
+ ADD_INT32( glyphpath->callbacks->windingMomentum,
+ cf2_getWindingMomentum( x1, y1, x2, y2 ) );
+
+ /* construct offset points */
+ P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 );
+ P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 );
+ P1.x = ADD_INT32( x1, xOffset1 );
+ P1.y = ADD_INT32( y1, yOffset1 );
+ /* note: preserve angle of final segment by using offset3 at both ends */
+ P2.x = ADD_INT32( x2, xOffset3 );
+ P2.y = ADD_INT32( y2, yOffset3 );
+ P3.x = ADD_INT32( x3, xOffset3 );
+ P3.y = ADD_INT32( y3, yOffset3 );
+
+ if ( glyphpath->moveIsPending )
+ {
+ /* emit offset 1st point as MoveTo */
+ cf2_glyphpath_pushMove( glyphpath, P0 );
+
+ glyphpath->moveIsPending = FALSE;
+ glyphpath->pathIsOpen = TRUE;
+
+ glyphpath->offsetStart1 = P1; /* record second point */
+ }
+
+ if ( glyphpath->elemIsQueued )
+ {
+ FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
+ glyphpath->hintMap.count == 0 );
+
+ cf2_glyphpath_pushPrevElem( glyphpath,
+ &glyphpath->hintMap,
+ &P0,
+ P1,
+ FALSE );
+ }
+
+ /* queue the current element with offset points */
+ glyphpath->elemIsQueued = TRUE;
+ glyphpath->prevElemOp = CF2_PathOpCubeTo;
+ glyphpath->prevElemP0 = P0;
+ glyphpath->prevElemP1 = P1;
+ glyphpath->prevElemP2 = P2;
+ glyphpath->prevElemP3 = P3;
+
+ /* update current map */
+ if ( cf2_hintmask_isNew( glyphpath->hintMask ) )
+ cf2_hintmap_build( &glyphpath->hintMap,
+ glyphpath->hStemHintArray,
+ glyphpath->vStemHintArray,
+ glyphpath->hintMask,
+ glyphpath->hintOriginY,
+ FALSE );
+
+ glyphpath->currentCS.x = x3; /* pre-offset current point */
+ glyphpath->currentCS.y = y3;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath )
+ {
+ if ( glyphpath->pathIsOpen )
+ {
+ /*
+ * A closing line in Character Space line is always generated below
+ * with `cf2_glyphPath_lineTo'. It may be ignored later if it turns
+ * out to be zero length in Device Space.
+ */
+ glyphpath->pathIsClosing = TRUE;
+
+ cf2_glyphpath_lineTo( glyphpath,
+ glyphpath->start.x,
+ glyphpath->start.y );
+
+ /* empty the final element from the queue and close the path */
+ if ( glyphpath->elemIsQueued )
+ cf2_glyphpath_pushPrevElem( glyphpath,
+ &glyphpath->hintMap,
+ &glyphpath->offsetStart0,
+ glyphpath->offsetStart1,
+ TRUE );
+
+ /* reset state machine */
+ glyphpath->moveIsPending = TRUE;
+ glyphpath->pathIsOpen = FALSE;
+ glyphpath->pathIsClosing = FALSE;
+ glyphpath->elemIsQueued = FALSE;
+ }
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/pshints.h b/thirdparty/freetype/src/psaux/pshints.h
new file mode 100644
index 0000000000..92e37e98ae
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/pshints.h
@@ -0,0 +1,288 @@
+/***************************************************************************/
+/* */
+/* pshints.h */
+/* */
+/* Adobe's code for handling CFF hints (body). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSHINT_H_
+#define PSHINT_H_
+
+FT_BEGIN_HEADER
+
+
+ enum
+ {
+ CF2_MAX_HINTS = 96 /* maximum # of hints */
+ };
+
+
+ /*
+ * A HintMask object stores a bit mask that specifies which hints in the
+ * charstring are active at a given time. Hints in CFF must be declared
+ * at the start, before any drawing operators, with horizontal hints
+ * preceding vertical hints. The HintMask is ordered the same way, with
+ * horizontal hints immediately followed by vertical hints. Clients are
+ * responsible for knowing how many of each type are present.
+ *
+ * The maximum total number of hints is 96, as specified by the CFF
+ * specification.
+ *
+ * A HintMask is built 0 or more times while interpreting a charstring, by
+ * the HintMask operator. There is only one HintMask, but it is built or
+ * rebuilt each time there is a hint substitution (HintMask operator) in
+ * the charstring. A default HintMask with all bits set is built if there
+ * has been no HintMask operator prior to the first drawing operator.
+ *
+ */
+
+ typedef struct CF2_HintMaskRec_
+ {
+ FT_Error* error;
+
+ FT_Bool isValid;
+ FT_Bool isNew;
+
+ size_t bitCount;
+ size_t byteCount;
+
+ FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8];
+
+ } CF2_HintMaskRec, *CF2_HintMask;
+
+
+ typedef struct CF2_StemHintRec_
+ {
+ FT_Bool used; /* DS positions are valid */
+
+ CF2_Fixed min; /* original character space value */
+ CF2_Fixed max;
+
+ CF2_Fixed minDS; /* DS position after first use */
+ CF2_Fixed maxDS;
+
+ } CF2_StemHintRec, *CF2_StemHint;
+
+
+ /*
+ * A HintMap object stores a piecewise linear function for mapping
+ * y-coordinates from character space to device space, providing
+ * appropriate pixel alignment to stem edges.
+ *
+ * The map is implemented as an array of `CF2_Hint' elements, each
+ * representing an edge. When edges are paired, as from stem hints, the
+ * bottom edge must immediately precede the top edge in the array.
+ * Element character space AND device space positions must both increase
+ * monotonically in the array. `CF2_Hint' elements are also used as
+ * parameters to `cf2_blues_capture'.
+ *
+ * The `cf2_hintmap_build' method must be called before any drawing
+ * operation (beginning with a Move operator) and at each hint
+ * substitution (HintMask operator).
+ *
+ * The `cf2_hintmap_map' method is called to transform y-coordinates at
+ * each drawing operation (move, line, curve).
+ *
+ */
+
+ /* TODO: make this a CF2_ArrStack and add a deep copy method */
+ enum
+ {
+ CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2
+ };
+
+
+ typedef struct CF2_HintMapRec_
+ {
+ CF2_Font font;
+
+ /* initial map based on blue zones */
+ struct CF2_HintMapRec_* initialHintMap;
+
+ /* working storage for 2nd pass adjustHints */
+ CF2_ArrStack hintMoves;
+
+ FT_Bool isValid;
+ FT_Bool hinted;
+
+ CF2_Fixed scale;
+ CF2_UInt count;
+
+ /* start search from this index */
+ CF2_UInt lastIndex;
+
+ CF2_HintRec edge[CF2_MAX_HINT_EDGES]; /* 192 */
+
+ } CF2_HintMapRec, *CF2_HintMap;
+
+
+ FT_LOCAL( FT_Bool )
+ cf2_hint_isValid( const CF2_Hint hint );
+ FT_LOCAL( FT_Bool )
+ cf2_hint_isTop( const CF2_Hint hint );
+ FT_LOCAL( FT_Bool )
+ cf2_hint_isBottom( const CF2_Hint hint );
+ FT_LOCAL( void )
+ cf2_hint_lock( CF2_Hint hint );
+
+
+ FT_LOCAL( void )
+ cf2_hintmap_init( CF2_HintMap hintmap,
+ CF2_Font font,
+ CF2_HintMap initialMap,
+ CF2_ArrStack hintMoves,
+ CF2_Fixed scale );
+ FT_LOCAL( void )
+ cf2_hintmap_build( CF2_HintMap hintmap,
+ CF2_ArrStack hStemHintArray,
+ CF2_ArrStack vStemHintArray,
+ CF2_HintMask hintMask,
+ CF2_Fixed hintOrigin,
+ FT_Bool initialMap );
+
+
+ /*
+ * GlyphPath is a wrapper for drawing operations that scales the
+ * coordinates according to the render matrix and HintMap. It also tracks
+ * open paths to control ClosePath and to insert MoveTo for broken fonts.
+ *
+ */
+ typedef struct CF2_GlyphPathRec_
+ {
+ /* TODO: gather some of these into a hinting context */
+
+ CF2_Font font; /* font instance */
+ CF2_OutlineCallbacks callbacks; /* outline consumer */
+
+
+ CF2_HintMapRec hintMap; /* current hint map */
+ CF2_HintMapRec firstHintMap; /* saved copy */
+ CF2_HintMapRec initialHintMap; /* based on all captured hints */
+
+ CF2_ArrStackRec hintMoves; /* list of hint moves for 2nd pass */
+
+ CF2_Fixed scaleX; /* matrix a */
+ CF2_Fixed scaleC; /* matrix c */
+ CF2_Fixed scaleY; /* matrix d */
+
+ FT_Vector fractionalTranslation; /* including deviceXScale */
+#if 0
+ CF2_Fixed hShift; /* character space horizontal shift */
+ /* (for fauxing) */
+#endif
+
+ FT_Bool pathIsOpen; /* true after MoveTo */
+ FT_Bool pathIsClosing; /* true when synthesizing closepath line */
+ FT_Bool darken; /* true if stem darkening */
+ FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */
+
+ /* references used to call `cf2_hintmap_build', if necessary */
+ CF2_ArrStack hStemHintArray;
+ CF2_ArrStack vStemHintArray;
+ CF2_HintMask hintMask; /* ptr to the current mask */
+ CF2_Fixed hintOriginY; /* copy of current origin */
+ const CF2_BluesRec* blues;
+
+ CF2_Fixed xOffset; /* character space offsets */
+ CF2_Fixed yOffset;
+
+ /* character space miter limit threshold */
+ CF2_Fixed miterLimit;
+ /* vertical/horizontal snap distance in character space */
+ CF2_Fixed snapThreshold;
+
+ FT_Vector offsetStart0; /* first and second points of first */
+ FT_Vector offsetStart1; /* element with offset applied */
+
+ /* current point, character space, before offset */
+ FT_Vector currentCS;
+ /* current point, device space */
+ FT_Vector currentDS;
+ /* start point of subpath, character space */
+ FT_Vector start;
+
+ /* the following members constitute the `queue' of one element */
+ FT_Bool elemIsQueued;
+ CF2_Int prevElemOp;
+
+ FT_Vector prevElemP0;
+ FT_Vector prevElemP1;
+ FT_Vector prevElemP2;
+ FT_Vector prevElemP3;
+
+ } CF2_GlyphPathRec, *CF2_GlyphPath;
+
+
+ FT_LOCAL( void )
+ cf2_glyphpath_init( CF2_GlyphPath glyphpath,
+ CF2_Font font,
+ CF2_OutlineCallbacks callbacks,
+ CF2_Fixed scaleY,
+ /* CF2_Fixed hShift, */
+ CF2_ArrStack hStemHintArray,
+ CF2_ArrStack vStemHintArray,
+ CF2_HintMask hintMask,
+ CF2_Fixed hintOrigin,
+ const CF2_Blues blues,
+ const FT_Vector* fractionalTranslation );
+ FT_LOCAL( void )
+ cf2_glyphpath_finalize( CF2_GlyphPath glyphpath );
+
+ FT_LOCAL( void )
+ cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
+ CF2_Fixed x,
+ CF2_Fixed y );
+ FT_LOCAL( void )
+ cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath,
+ CF2_Fixed x,
+ CF2_Fixed y );
+ FT_LOCAL( void )
+ cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath,
+ CF2_Fixed x1,
+ CF2_Fixed y1,
+ CF2_Fixed x2,
+ CF2_Fixed y2,
+ CF2_Fixed x3,
+ CF2_Fixed y3 );
+ FT_LOCAL( void )
+ cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath );
+
+
+FT_END_HEADER
+
+
+#endif /* PSHINT_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psintrp.c b/thirdparty/freetype/src/psaux/psintrp.c
new file mode 100644
index 0000000000..da5a8dad1d
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psintrp.c
@@ -0,0 +1,3040 @@
+/***************************************************************************/
+/* */
+/* psintrp.c */
+/* */
+/* Adobe's CFF Interpreter (body). */
+/* */
+/* Copyright 2007-2014 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+#include FT_SERVICE_CFF_TABLE_LOAD_H
+
+#include "psglue.h"
+#include "psfont.h"
+#include "psstack.h"
+#include "pshints.h"
+#include "psintrp.h"
+
+#include "pserror.h"
+
+#include "psobjs.h" /* for cff_random */
+#include "t1decode.h" /* for t1 seac */
+
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_cf2interp
+
+
+ FT_LOCAL_DEF( void )
+ cf2_hintmask_init( CF2_HintMask hintmask,
+ FT_Error* error )
+ {
+ FT_ZERO( hintmask );
+
+ hintmask->error = error;
+ }
+
+
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_hintmask_isValid( const CF2_HintMask hintmask )
+ {
+ return hintmask->isValid;
+ }
+
+
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_hintmask_isNew( const CF2_HintMask hintmask )
+ {
+ return hintmask->isNew;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_hintmask_setNew( CF2_HintMask hintmask,
+ FT_Bool val )
+ {
+ hintmask->isNew = val;
+ }
+
+
+ /* clients call `getMaskPtr' in order to iterate */
+ /* through hint mask */
+
+ FT_LOCAL_DEF( FT_Byte* )
+ cf2_hintmask_getMaskPtr( CF2_HintMask hintmask )
+ {
+ return hintmask->mask;
+ }
+
+
+ static size_t
+ cf2_hintmask_setCounts( CF2_HintMask hintmask,
+ size_t bitCount )
+ {
+ if ( bitCount > CF2_MAX_HINTS )
+ {
+ /* total of h and v stems must be <= 96 */
+ CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format );
+ return 0;
+ }
+
+ hintmask->bitCount = bitCount;
+ hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8;
+
+ hintmask->isValid = TRUE;
+ hintmask->isNew = TRUE;
+
+ return bitCount;
+ }
+
+
+ /* consume the hintmask bytes from the charstring, advancing the src */
+ /* pointer */
+ static void
+ cf2_hintmask_read( CF2_HintMask hintmask,
+ CF2_Buffer charstring,
+ size_t bitCount )
+ {
+ size_t i;
+
+#ifndef CF2_NDEBUG
+ /* these are the bits in the final mask byte that should be zero */
+ /* Note: this variable is only used in an assert expression below */
+ /* and then only if CF2_NDEBUG is not defined */
+ CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
+#endif
+
+
+ /* initialize counts and isValid */
+ if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
+ return;
+
+ FT_ASSERT( hintmask->byteCount > 0 );
+
+ FT_TRACE4(( " (maskbytes:" ));
+
+ /* set mask and advance interpreter's charstring pointer */
+ for ( i = 0; i < hintmask->byteCount; i++ )
+ {
+ hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
+ FT_TRACE4(( " 0x%02X", hintmask->mask[i] ));
+ }
+
+ FT_TRACE4(( ")\n" ));
+
+ /* assert any unused bits in last byte are zero unless there's a prior */
+ /* error */
+ /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
+#ifndef CF2_NDEBUG
+ FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 ||
+ *hintmask->error );
+#endif
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_hintmask_setAll( CF2_HintMask hintmask,
+ size_t bitCount )
+ {
+ size_t i;
+ CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
+
+
+ /* initialize counts and isValid */
+ if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
+ return;
+
+ FT_ASSERT( hintmask->byteCount > 0 );
+ FT_ASSERT( hintmask->byteCount <=
+ sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) );
+
+ /* set mask to all ones */
+ for ( i = 0; i < hintmask->byteCount; i++ )
+ hintmask->mask[i] = 0xFF;
+
+ /* clear unused bits */
+ /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
+ hintmask->mask[hintmask->byteCount - 1] &= ~mask;
+ }
+
+
+ /* Type2 charstring opcodes */
+ enum
+ {
+ cf2_cmdRESERVED_0, /* 0 */
+ cf2_cmdHSTEM, /* 1 */
+ cf2_cmdRESERVED_2, /* 2 */
+ cf2_cmdVSTEM, /* 3 */
+ cf2_cmdVMOVETO, /* 4 */
+ cf2_cmdRLINETO, /* 5 */
+ cf2_cmdHLINETO, /* 6 */
+ cf2_cmdVLINETO, /* 7 */
+ cf2_cmdRRCURVETO, /* 8 */
+ cf2_cmdCLOSEPATH, /* 9 T1 only */
+ cf2_cmdCALLSUBR, /* 10 */
+ cf2_cmdRETURN, /* 11 */
+ cf2_cmdESC, /* 12 */
+ cf2_cmdHSBW, /* 13 T1 only */
+ cf2_cmdENDCHAR, /* 14 */
+ cf2_cmdVSINDEX, /* 15 */
+ cf2_cmdBLEND, /* 16 */
+ cf2_cmdRESERVED_17, /* 17 */
+ cf2_cmdHSTEMHM, /* 18 */
+ cf2_cmdHINTMASK, /* 19 */
+ cf2_cmdCNTRMASK, /* 20 */
+ cf2_cmdRMOVETO, /* 21 */
+ cf2_cmdHMOVETO, /* 22 */
+ cf2_cmdVSTEMHM, /* 23 */
+ cf2_cmdRCURVELINE, /* 24 */
+ cf2_cmdRLINECURVE, /* 25 */
+ cf2_cmdVVCURVETO, /* 26 */
+ cf2_cmdHHCURVETO, /* 27 */
+ cf2_cmdEXTENDEDNMBR, /* 28 */
+ cf2_cmdCALLGSUBR, /* 29 */
+ cf2_cmdVHCURVETO, /* 30 */
+ cf2_cmdHVCURVETO /* 31 */
+ };
+
+ enum
+ {
+ cf2_escDOTSECTION, /* 0 */
+ cf2_escVSTEM3, /* 1 T1 only */
+ cf2_escHSTEM3, /* 2 T1 only */
+ cf2_escAND, /* 3 */
+ cf2_escOR, /* 4 */
+ cf2_escNOT, /* 5 */
+ cf2_escSEAC, /* 6 T1 only */
+ cf2_escSBW, /* 7 T1 only */
+ cf2_escRESERVED_8, /* 8 */
+ cf2_escABS, /* 9 */
+ cf2_escADD, /* 10 like otherADD */
+ cf2_escSUB, /* 11 like otherSUB */
+ cf2_escDIV, /* 12 */
+ cf2_escRESERVED_13, /* 13 */
+ cf2_escNEG, /* 14 */
+ cf2_escEQ, /* 15 */
+ cf2_escCALLOTHERSUBR,/* 16 T1 only */
+ cf2_escPOP, /* 17 T1 only */
+ cf2_escDROP, /* 18 */
+ cf2_escRESERVED_19, /* 19 */
+ cf2_escPUT, /* 20 like otherPUT */
+ cf2_escGET, /* 21 like otherGET */
+ cf2_escIFELSE, /* 22 like otherIFELSE */
+ cf2_escRANDOM, /* 23 like otherRANDOM */
+ cf2_escMUL, /* 24 like otherMUL */
+ cf2_escRESERVED_25, /* 25 */
+ cf2_escSQRT, /* 26 */
+ cf2_escDUP, /* 27 like otherDUP */
+ cf2_escEXCH, /* 28 like otherEXCH */
+ cf2_escINDEX, /* 29 */
+ cf2_escROLL, /* 30 */
+ cf2_escRESERVED_31, /* 31 */
+ cf2_escRESERVED_32, /* 32 */
+ cf2_escSETCURRENTPT, /* 33 T1 only */
+ cf2_escHFLEX, /* 34 */
+ cf2_escFLEX, /* 35 */
+ cf2_escHFLEX1, /* 36 */
+ cf2_escFLEX1, /* 37 */
+ cf2_escRESERVED_38 /* 38 & all higher */
+ };
+
+
+ /* `stemHintArray' does not change once we start drawing the outline. */
+ static void
+ cf2_doStems( const CF2_Font font,
+ CF2_Stack opStack,
+ CF2_ArrStack stemHintArray,
+ CF2_Fixed* width,
+ FT_Bool* haveWidth,
+ CF2_Fixed hintOffset )
+ {
+ CF2_UInt i;
+ CF2_UInt count = cf2_stack_count( opStack );
+ FT_Bool hasWidthArg = (FT_Bool)( count & 1 );
+
+ /* variable accumulates delta values from operand stack */
+ CF2_Fixed position = hintOffset;
+
+ if ( font->isT1 && !font->decoder->flex_state && !*haveWidth )
+ FT_ERROR(( "cf2_doStems (Type 1 mode):"
+ " No width. Use hsbw/sbw as first op\n" ));
+
+ if ( !font->isT1 && hasWidthArg && !*haveWidth )
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ cf2_getNominalWidthX( font->decoder ) );
+
+ if ( font->decoder->width_only )
+ goto exit;
+
+ for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 )
+ {
+ /* construct a CF2_StemHint and push it onto the list */
+ CF2_StemHintRec stemhint;
+
+
+ stemhint.min =
+ position = ADD_INT32( position,
+ cf2_stack_getReal( opStack, i ) );
+ stemhint.max =
+ position = ADD_INT32( position,
+ cf2_stack_getReal( opStack, i + 1 ) );
+
+ stemhint.used = FALSE;
+ stemhint.maxDS =
+ stemhint.minDS = 0;
+
+ cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */
+ }
+
+ cf2_stack_clear( opStack );
+
+ exit:
+ /* cf2_doStems must define a width (may be default) */
+ *haveWidth = TRUE;
+ }
+
+
+ static void
+ cf2_doFlex( CF2_Stack opStack,
+ CF2_Fixed* curX,
+ CF2_Fixed* curY,
+ CF2_GlyphPath glyphPath,
+ const FT_Bool* readFromStack,
+ FT_Bool doConditionalLastRead )
+ {
+ CF2_Fixed vals[14];
+ CF2_UInt idx;
+ FT_Bool isHFlex;
+ CF2_Int top, i, j;
+
+
+ vals[0] = *curX;
+ vals[1] = *curY;
+ idx = 0;
+ isHFlex = FT_BOOL( readFromStack[9] == FALSE );
+ top = isHFlex ? 9 : 10;
+
+ for ( i = 0; i < top; i++ )
+ {
+ vals[i + 2] = vals[i];
+ if ( readFromStack[i] )
+ vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack,
+ idx++ ) );
+ }
+
+ if ( isHFlex )
+ vals[9 + 2] = *curY;
+
+ if ( doConditionalLastRead )
+ {
+ FT_Bool lastIsX = (FT_Bool)(
+ cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) >
+ cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) );
+ CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx );
+
+
+ if ( lastIsX )
+ {
+ vals[12] = ADD_INT32( vals[10], lastVal );
+ vals[13] = *curY;
+ }
+ else
+ {
+ vals[12] = *curX;
+ vals[13] = ADD_INT32( vals[11], lastVal );
+ }
+ }
+ else
+ {
+ if ( readFromStack[10] )
+ vals[12] = ADD_INT32( vals[10],
+ cf2_stack_getReal( opStack, idx++ ) );
+ else
+ vals[12] = *curX;
+
+ if ( readFromStack[11] )
+ vals[13] = ADD_INT32( vals[11],
+ cf2_stack_getReal( opStack, idx ) );
+ else
+ vals[13] = *curY;
+ }
+
+ for ( j = 0; j < 2; j++ )
+ cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2],
+ vals[j * 6 + 3],
+ vals[j * 6 + 4],
+ vals[j * 6 + 5],
+ vals[j * 6 + 6],
+ vals[j * 6 + 7] );
+
+ cf2_stack_clear( opStack );
+
+ *curX = vals[12];
+ *curY = vals[13];
+ }
+
+
+ /* Blend numOperands on the stack, */
+ /* store results into the first numBlends values, */
+ /* then pop remaining arguments. */
+ static void
+ cf2_doBlend( const CFF_Blend blend,
+ CF2_Stack opStack,
+ CF2_UInt numBlends )
+ {
+ CF2_UInt delta;
+ CF2_UInt base;
+ CF2_UInt i, j;
+ CF2_UInt numOperands = (CF2_UInt)( numBlends * blend->lenBV );
+
+
+ base = cf2_stack_count( opStack ) - numOperands;
+ delta = base + numBlends;
+
+ for ( i = 0; i < numBlends; i++ )
+ {
+ const CF2_Fixed* weight = &blend->BV[1];
+
+ /* start with first term */
+ CF2_Fixed sum = cf2_stack_getReal( opStack, i + base );
+
+
+ for ( j = 1; j < blend->lenBV; j++ )
+ sum = ADD_INT32( sum,
+ FT_MulFix( *weight++,
+ cf2_stack_getReal( opStack,
+ delta++ ) ) );
+
+ /* store blended result */
+ cf2_stack_setReal( opStack, i + base, sum );
+ }
+
+ /* leave only `numBlends' results on stack */
+ cf2_stack_pop( opStack, numOperands - numBlends );
+ }
+
+
+ /*
+ * `error' is a shared error code used by many objects in this
+ * routine. Before the code continues from an error, it must check and
+ * record the error in `*error'. The idea is that this shared
+ * error code will record the first error encountered. If testing
+ * for an error anyway, the cost of `goto exit' is small, so we do it,
+ * even if continuing would be safe. In this case, `lastError' is
+ * set, so the testing and storing can be done in one place, at `exit'.
+ *
+ * Continuing after an error is intended for objects which do their own
+ * testing of `*error', e.g., array stack functions. This allows us to
+ * avoid an extra test after the call.
+ *
+ * Unimplemented opcodes are ignored.
+ *
+ */
+ FT_LOCAL_DEF( void )
+ cf2_interpT2CharString( CF2_Font font,
+ CF2_Buffer buf,
+ CF2_OutlineCallbacks callbacks,
+ const FT_Vector* translation,
+ FT_Bool doingSeac,
+ CF2_Fixed curX,
+ CF2_Fixed curY,
+ CF2_Fixed* width )
+ {
+ /* lastError is used for errors that are immediately tested */
+ FT_Error lastError = FT_Err_Ok;
+
+ /* pointer to parsed font object */
+ PS_Decoder* decoder = font->decoder;
+
+ FT_Error* error = &font->error;
+ FT_Memory memory = font->memory;
+
+ CF2_Fixed scaleY = font->innerTransform.d;
+ CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder );
+
+ /* stuff for Type 1 */
+ FT_Int known_othersubr_result_cnt = 0;
+ FT_Bool large_int = FALSE;
+ FT_Bool initial_map_ready = FALSE;
+
+#define PS_STORAGE_SIZE 3
+ CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */
+ FT_Int result_cnt = 0;
+
+ /* save this for hinting seac accents */
+ CF2_Fixed hintOriginY = curY;
+
+ CF2_Stack opStack = NULL;
+ FT_UInt stackSize;
+ FT_Byte op1; /* first opcode byte */
+
+ CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */
+ CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */
+
+ /* instruction limit; 20,000,000 matches Avalon */
+ FT_UInt32 instructionLimit = 20000000UL;
+
+ CF2_ArrStackRec subrStack;
+
+ FT_Bool haveWidth;
+ CF2_Buffer charstring = NULL;
+
+ CF2_Int charstringIndex = -1; /* initialize to empty */
+
+ /* TODO: placeholders for hint structures */
+
+ /* objects used for hinting */
+ CF2_ArrStackRec hStemHintArray;
+ CF2_ArrStackRec vStemHintArray;
+
+ CF2_HintMaskRec hintMask;
+ CF2_GlyphPathRec glyphPath;
+
+
+ FT_ZERO( &storage );
+ FT_ZERO( &results );
+ FT_ZERO( &flexStore );
+
+ /* initialize the remaining objects */
+ cf2_arrstack_init( &subrStack,
+ memory,
+ error,
+ sizeof ( CF2_BufferRec ) );
+ cf2_arrstack_init( &hStemHintArray,
+ memory,
+ error,
+ sizeof ( CF2_StemHintRec ) );
+ cf2_arrstack_init( &vStemHintArray,
+ memory,
+ error,
+ sizeof ( CF2_StemHintRec ) );
+
+ /* initialize CF2_StemHint arrays */
+ cf2_hintmask_init( &hintMask, error );
+
+ /* initialize path map to manage drawing operations */
+
+ /* Note: last 4 params are used to handle `MoveToPermissive', which */
+ /* may need to call `hintMap.Build' */
+ /* TODO: MoveToPermissive is gone; are these still needed? */
+ cf2_glyphpath_init( &glyphPath,
+ font,
+ callbacks,
+ scaleY,
+ /* hShift, */
+ &hStemHintArray,
+ &vStemHintArray,
+ &hintMask,
+ hintOriginY,
+ &font->blues,
+ translation );
+
+ /*
+ * Initialize state for width parsing. From the CFF Spec:
+ *
+ * The first stack-clearing operator, which must be one of hstem,
+ * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto,
+ * rmoveto, or endchar, takes an additional argument - the width (as
+ * described earlier), which may be expressed as zero or one numeric
+ * argument.
+ *
+ * What we implement here uses the first validly specified width, but
+ * does not detect errors for specifying more than one width.
+ *
+ * If one of the above operators occurs without explicitly specifying
+ * a width, we assume the default width.
+ *
+ * CFF2 charstrings always return the default width (0).
+ *
+ */
+ haveWidth = font->isCFF2 ? TRUE : FALSE;
+ *width = cf2_getDefaultWidthX( decoder );
+
+ /*
+ * Note: At this point, all pointers to resources must be NULL
+ * and all local objects must be initialized.
+ * There must be no branches to `exit:' above this point.
+ *
+ */
+
+ /* allocate an operand stack */
+ stackSize = font->isCFF2 ? cf2_getMaxstack( decoder )
+ : CF2_OPERAND_STACK_SIZE;
+ opStack = cf2_stack_init( memory, error, stackSize );
+
+ if ( !opStack )
+ {
+ lastError = FT_THROW( Out_Of_Memory );
+ goto exit;
+ }
+
+ /* initialize subroutine stack by placing top level charstring as */
+ /* first element (max depth plus one for the charstring) */
+ /* Note: Caller owns and must finalize the first charstring. */
+ /* Our copy of it does not change that requirement. */
+ cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 );
+
+ charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack );
+ *charstring = *buf; /* structure copy */
+
+ charstringIndex = 0; /* entry is valid now */
+
+ /* catch errors so far */
+ if ( *error )
+ goto exit;
+
+ /* main interpreter loop */
+ while ( 1 )
+ {
+ if ( font->isT1 )
+ FT_ASSERT( known_othersubr_result_cnt == 0 ||
+ result_cnt == 0 );
+
+ if ( cf2_buf_isEnd( charstring ) )
+ {
+ /* If we've reached the end of the charstring, simulate a */
+ /* cf2_cmdRETURN or cf2_cmdENDCHAR. */
+ /* We do this for both CFF and CFF2. */
+ if ( charstringIndex )
+ op1 = cf2_cmdRETURN; /* end of buffer for subroutine */
+ else
+ op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */
+ }
+ else
+ {
+ op1 = (FT_Byte)cf2_buf_readByte( charstring );
+
+ /* Explicit RETURN and ENDCHAR in CFF2 should be ignored. */
+ /* Note: Trace message will report 0 instead of 11 or 14. */
+ if ( ( op1 == cf2_cmdRETURN || op1 == cf2_cmdENDCHAR ) &&
+ font->isCFF2 )
+ op1 = cf2_cmdRESERVED_0;
+ }
+
+ if ( font->isT1 )
+ {
+ if ( !initial_map_ready &&
+ !( op1 == cf2_cmdHSTEM ||
+ op1 == cf2_cmdVSTEM ||
+ op1 == cf2_cmdHSBW ||
+ op1 == cf2_cmdCALLSUBR ||
+ op1 == cf2_cmdRETURN ||
+ op1 == cf2_cmdESC ||
+ op1 == cf2_cmdENDCHAR ||
+ op1 >= 32 /* Numbers */ ) )
+ {
+ /* Skip outline commands first time round. */
+ /* `endchar' will trigger initial hintmap build */
+ /* and rewind the charstring. */
+ cf2_stack_clear( opStack );
+ continue;
+ }
+
+ if ( result_cnt > 0 &&
+ !( op1 == cf2_cmdCALLSUBR ||
+ op1 == cf2_cmdRETURN ||
+ op1 == cf2_cmdESC ||
+ op1 >= 32 /* Numbers */ ) )
+ {
+ /* all operands have been transferred by previous pops */
+ result_cnt = 0;
+ }
+
+ if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) )
+ {
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " no `div' after large integer\n" ));
+
+ large_int = FALSE;
+ }
+ }
+
+ /* check for errors once per loop */
+ if ( *error )
+ goto exit;
+
+ instructionLimit--;
+ if ( instructionLimit == 0 )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ switch( op1 )
+ {
+ case cf2_cmdRESERVED_0:
+ case cf2_cmdRESERVED_2:
+ case cf2_cmdRESERVED_17:
+ /* we may get here if we have a prior error */
+ FT_TRACE4(( " unknown op (%d)\n", op1 ));
+ break;
+
+ case cf2_cmdVSINDEX:
+ FT_TRACE4(( " vsindex\n" ));
+
+ if ( !font->isCFF2 )
+ break; /* clear stack & ignore */
+
+ if ( font->blend.usedBV )
+ {
+ /* vsindex not allowed after blend */
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ {
+ FT_Int temp = cf2_stack_popInt( opStack );
+
+
+ if ( temp >= 0 )
+ font->vsindex = (FT_UInt)temp;
+ }
+ break;
+
+ case cf2_cmdBLEND:
+ {
+ FT_UInt numBlends;
+
+
+ FT_TRACE4(( " blend\n" ));
+
+ if ( !font->isCFF2 )
+ break; /* clear stack & ignore */
+
+ /* do we have a `blend' op in a non-variant font? */
+ if ( !font->blend.font )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* check cached blend vector */
+ if ( font->cffload->blend_check_vector( &font->blend,
+ font->vsindex,
+ font->lenNDV,
+ font->NDV ) )
+ {
+ lastError = font->cffload->blend_build_vector( &font->blend,
+ font->vsindex,
+ font->lenNDV,
+ font->NDV );
+ if ( lastError )
+ goto exit;
+ }
+
+ /* do the blend */
+ numBlends = (FT_UInt)cf2_stack_popInt( opStack );
+ if ( numBlends > stackSize )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ cf2_doBlend( &font->blend, opStack, numBlends );
+
+ font->blend.usedBV = TRUE;
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_cmdHSTEMHM:
+ case cf2_cmdHSTEM:
+ FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" ));
+
+ if ( !font->isT1 )
+ {
+ /* never add hints after the mask is computed */
+ /* except if in Type 1 mode (no hintmask op) */
+ if ( cf2_hintmask_isValid( &hintMask ) )
+ {
+ FT_TRACE4(( "cf2_interpT2CharString:"
+ " invalid horizontal hint mask\n" ));
+ break;
+ }
+ }
+
+ /* add left-sidebearing correction in Type 1 mode */
+ cf2_doStems( font,
+ opStack,
+ &hStemHintArray,
+ width,
+ &haveWidth,
+ font->isT1 ? decoder->builder.left_bearing->y
+ : 0 );
+
+ if ( decoder->width_only )
+ goto exit;
+
+ break;
+
+ case cf2_cmdVSTEMHM:
+ case cf2_cmdVSTEM:
+ FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" ));
+
+ if ( !font->isT1 )
+ {
+ /* never add hints after the mask is computed */
+ /* except if in Type 1 mode (no hintmask op) */
+ if ( cf2_hintmask_isValid( &hintMask ) )
+ {
+ FT_TRACE4(( "cf2_interpT2CharString:"
+ " invalid vertical hint mask\n" ));
+ break;
+ }
+ }
+
+ /* add left-sidebearing correction in Type 1 mode */
+ cf2_doStems( font,
+ opStack,
+ &vStemHintArray,
+ width,
+ &haveWidth,
+ font->isT1 ? decoder->builder.left_bearing->x
+ : 0 );
+
+ if ( decoder->width_only )
+ goto exit;
+
+ break;
+
+ case cf2_cmdVMOVETO:
+ FT_TRACE4(( " vmoveto\n" ));
+
+ if ( font->isT1 && !decoder->flex_state && !haveWidth )
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " No width. Use hsbw/sbw as first op\n" ));
+
+ if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
+
+ /* width is defined or default after this */
+ haveWidth = TRUE;
+
+ if ( decoder->width_only )
+ goto exit;
+
+ curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
+
+ if ( !decoder->flex_state )
+ cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+
+ break;
+
+ case cf2_cmdRLINETO:
+ {
+ CF2_UInt idx;
+ CF2_UInt count = cf2_stack_count( opStack );
+
+
+ FT_TRACE4(( " rlineto\n" ));
+
+ for ( idx = 0; idx < count; idx += 2 )
+ {
+ curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
+ idx + 0 ) );
+ curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
+ idx + 1 ) );
+
+ cf2_glyphpath_lineTo( &glyphPath, curX, curY );
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue; /* no need to clear stack again */
+
+ case cf2_cmdHLINETO:
+ case cf2_cmdVLINETO:
+ {
+ CF2_UInt idx;
+ CF2_UInt count = cf2_stack_count( opStack );
+
+ FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO );
+
+
+ FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" ));
+
+ for ( idx = 0; idx < count; idx++ )
+ {
+ CF2_Fixed v = cf2_stack_getReal( opStack, idx );
+
+
+ if ( isX )
+ curX = ADD_INT32( curX, v );
+ else
+ curY = ADD_INT32( curY, v );
+
+ isX = !isX;
+
+ cf2_glyphpath_lineTo( &glyphPath, curX, curY );
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue;
+
+ case cf2_cmdRCURVELINE:
+ case cf2_cmdRRCURVETO:
+ {
+ CF2_UInt count = cf2_stack_count( opStack );
+ CF2_UInt idx = 0;
+
+
+ FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n"
+ : " rrcurveto\n" ));
+
+ while ( idx + 6 <= count )
+ {
+ CF2_Fixed x1, y1, x2, y2, x3, y3;
+
+
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
+
+ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
+
+ curX = x3;
+ curY = y3;
+ idx += 6;
+ }
+
+ if ( op1 == cf2_cmdRCURVELINE )
+ {
+ curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
+ idx + 0 ) );
+ curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
+ idx + 1 ) );
+
+ cf2_glyphpath_lineTo( &glyphPath, curX, curY );
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue; /* no need to clear stack again */
+
+ case cf2_cmdCLOSEPATH:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (%d)\n", op1 ));
+ else
+ {
+ FT_TRACE4(( " closepath" ));
+
+ /* if there is no path, `closepath' is a no-op */
+ ps_builder_close_contour( &decoder->builder );
+
+ haveWidth = TRUE;
+ }
+ break;
+
+ case cf2_cmdCALLGSUBR:
+ case cf2_cmdCALLSUBR:
+ {
+ CF2_Int subrNum;
+
+
+ FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr"
+ : " callsubr" ));
+
+ if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) ||
+ ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) )
+ {
+ /* max subr plus one for charstring */
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* overflow of stack */
+ }
+
+ /* push our current CFF charstring region on subrStack */
+ charstring = (CF2_Buffer)
+ cf2_arrstack_getPointer(
+ &subrStack,
+ (size_t)charstringIndex + 1 );
+
+ /* set up the new CFF region and pointer */
+ subrNum = cf2_stack_popInt( opStack );
+
+ if ( font->isT1 && decoder->locals_hash )
+ {
+ size_t* val = ft_hash_num_lookup( subrNum,
+ decoder->locals_hash );
+
+
+ if ( val )
+ subrNum = *val;
+ else
+ subrNum = -1;
+ }
+
+ switch ( op1 )
+ {
+ case cf2_cmdCALLGSUBR:
+ FT_TRACE4(( " (idx %d, entering level %d)\n",
+ subrNum + decoder->globals_bias,
+ charstringIndex + 1 ));
+
+ if ( cf2_initGlobalRegionBuffer( decoder,
+ subrNum,
+ charstring ) )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* subroutine lookup or stream error */
+ }
+ break;
+
+ default:
+ /* cf2_cmdCALLSUBR */
+ FT_TRACE4(( " (idx %d, entering level %d)\n",
+ subrNum + decoder->locals_bias,
+ charstringIndex + 1 ));
+
+ if ( cf2_initLocalRegionBuffer( decoder,
+ subrNum,
+ charstring ) )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* subroutine lookup or stream error */
+ }
+ }
+
+ charstringIndex += 1; /* entry is valid now */
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_cmdRETURN:
+ FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
+
+ if ( charstringIndex < 1 )
+ {
+ /* Note: cannot return from top charstring */
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* underflow of stack */
+ }
+
+ /* restore position in previous charstring */
+ charstring = (CF2_Buffer)
+ cf2_arrstack_getPointer(
+ &subrStack,
+ (CF2_UInt)--charstringIndex );
+ continue; /* do not clear the stack */
+
+ case cf2_cmdESC:
+ {
+ FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring );
+
+
+ /* first switch for 2-byte operators handles CFF2 */
+ /* and opcodes that are reserved for both CFF and CFF2 */
+ switch ( op2 )
+ {
+ case cf2_escHFLEX:
+ {
+ static const FT_Bool readFromStack[12] =
+ {
+ TRUE /* dx1 */, FALSE /* dy1 */,
+ TRUE /* dx2 */, TRUE /* dy2 */,
+ TRUE /* dx3 */, FALSE /* dy3 */,
+ TRUE /* dx4 */, FALSE /* dy4 */,
+ TRUE /* dx5 */, FALSE /* dy5 */,
+ TRUE /* dx6 */, FALSE /* dy6 */
+ };
+
+
+ FT_TRACE4(( " hflex\n" ));
+
+ cf2_doFlex( opStack,
+ &curX,
+ &curY,
+ &glyphPath,
+ readFromStack,
+ FALSE /* doConditionalLastRead */ );
+ }
+ continue;
+
+ case cf2_escFLEX:
+ {
+ static const FT_Bool readFromStack[12] =
+ {
+ TRUE /* dx1 */, TRUE /* dy1 */,
+ TRUE /* dx2 */, TRUE /* dy2 */,
+ TRUE /* dx3 */, TRUE /* dy3 */,
+ TRUE /* dx4 */, TRUE /* dy4 */,
+ TRUE /* dx5 */, TRUE /* dy5 */,
+ TRUE /* dx6 */, TRUE /* dy6 */
+ };
+
+
+ FT_TRACE4(( " flex\n" ));
+
+ cf2_doFlex( opStack,
+ &curX,
+ &curY,
+ &glyphPath,
+ readFromStack,
+ FALSE /* doConditionalLastRead */ );
+ }
+ break; /* TODO: why is this not a continue? */
+
+ case cf2_escHFLEX1:
+ {
+ static const FT_Bool readFromStack[12] =
+ {
+ TRUE /* dx1 */, TRUE /* dy1 */,
+ TRUE /* dx2 */, TRUE /* dy2 */,
+ TRUE /* dx3 */, FALSE /* dy3 */,
+ TRUE /* dx4 */, FALSE /* dy4 */,
+ TRUE /* dx5 */, TRUE /* dy5 */,
+ TRUE /* dx6 */, FALSE /* dy6 */
+ };
+
+
+ FT_TRACE4(( " hflex1\n" ));
+
+ cf2_doFlex( opStack,
+ &curX,
+ &curY,
+ &glyphPath,
+ readFromStack,
+ FALSE /* doConditionalLastRead */ );
+ }
+ continue;
+
+ case cf2_escFLEX1:
+ {
+ static const FT_Bool readFromStack[12] =
+ {
+ TRUE /* dx1 */, TRUE /* dy1 */,
+ TRUE /* dx2 */, TRUE /* dy2 */,
+ TRUE /* dx3 */, TRUE /* dy3 */,
+ TRUE /* dx4 */, TRUE /* dy4 */,
+ TRUE /* dx5 */, TRUE /* dy5 */,
+ FALSE /* dx6 */, FALSE /* dy6 */
+ };
+
+
+ FT_TRACE4(( " flex1\n" ));
+
+ cf2_doFlex( opStack,
+ &curX,
+ &curY,
+ &glyphPath,
+ readFromStack,
+ TRUE /* doConditionalLastRead */ );
+ }
+ continue;
+
+ /* these opcodes are always reserved */
+ case cf2_escRESERVED_8:
+ case cf2_escRESERVED_13:
+ case cf2_escRESERVED_19:
+ case cf2_escRESERVED_25:
+ case cf2_escRESERVED_31:
+ case cf2_escRESERVED_32:
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ break;
+
+ default:
+ {
+ if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP )
+ {
+ /* all operands have been transferred by previous pops */
+ result_cnt = 0;
+ }
+ else
+ {
+ /* second switch for 2-byte operators handles */
+ /* CFF and Type 1 */
+ switch ( op2 )
+ {
+
+ case cf2_escDOTSECTION:
+ /* something about `flip type of locking' -- ignore it */
+ FT_TRACE4(( " dotsection\n" ));
+
+ break;
+
+ case cf2_escVSTEM3:
+ case cf2_escHSTEM3:
+ /*
+ * Type 1: Type 2:
+ * x0 dx0 x1 dx1 x2 dx2 vstem3 x dx {dxa dxb}* vstem
+ * y0 dy0 y1 dy1 y2 dy2 hstem3 y dy {dya dyb}* hstem
+ * relative to lsb point relative to zero
+ *
+ */
+ {
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else
+ {
+ CF2_F16Dot16 v0, v1, v2;
+
+ FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 );
+
+
+ FT_TRACE4(( isV ? " vstem3\n"
+ : " hstem3\n" ));
+
+ FT_ASSERT( cf2_stack_count( opStack ) == 6 );
+
+ v0 = cf2_stack_getReal( opStack, 0 );
+ v1 = cf2_stack_getReal( opStack, 2 );
+ v2 = cf2_stack_getReal( opStack, 4 );
+
+ cf2_stack_setReal(
+ opStack, 2,
+ SUB_INT32( SUB_INT32( v1, v0 ),
+ cf2_stack_getReal( opStack, 1 ) ) );
+ cf2_stack_setReal(
+ opStack, 4,
+ SUB_INT32( SUB_INT32( v2, v1 ),
+ cf2_stack_getReal( opStack, 3 ) ) );
+
+ /* add left-sidebearing correction */
+ cf2_doStems( font,
+ opStack,
+ isV ? &vStemHintArray : &hStemHintArray,
+ width,
+ &haveWidth,
+ isV ? decoder->builder.left_bearing->x
+ : decoder->builder.left_bearing->y );
+
+ if ( decoder->width_only )
+ goto exit;
+ }
+ }
+ break;
+
+ case cf2_escAND:
+ {
+ CF2_F16Dot16 arg1;
+ CF2_F16Dot16 arg2;
+
+
+ FT_TRACE4(( " and\n" ));
+
+ arg2 = cf2_stack_popFixed( opStack );
+ arg1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushInt( opStack, arg1 && arg2 );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escOR:
+ {
+ CF2_F16Dot16 arg1;
+ CF2_F16Dot16 arg2;
+
+
+ FT_TRACE4(( " or\n" ));
+
+ arg2 = cf2_stack_popFixed( opStack );
+ arg1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushInt( opStack, arg1 || arg2 );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escNOT:
+ {
+ CF2_F16Dot16 arg;
+
+
+ FT_TRACE4(( " not\n" ));
+
+ arg = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushInt( opStack, !arg );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escSEAC:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else
+ {
+ FT_Error error2;
+ CF2_Int bchar_index, achar_index;
+ FT_Vector left_bearing, advance;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ T1_Face face = (T1_Face)decoder->builder.face;
+#endif
+ CF2_BufferRec component;
+ CF2_Fixed dummyWidth;
+
+ CF2_Int achar = cf2_stack_popInt( opStack );
+ CF2_Int bchar = cf2_stack_popInt( opStack );
+
+ FT_Pos ady = cf2_stack_popFixed ( opStack );
+ FT_Pos adx = cf2_stack_popFixed ( opStack );
+ FT_Pos asb = cf2_stack_popFixed ( opStack );
+
+
+ FT_TRACE4(( " seac\n" ));
+
+ if ( doingSeac )
+ {
+ FT_ERROR(( " nested seac\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* nested seac */
+ }
+
+ if ( decoder->builder.metrics_only )
+ {
+ FT_ERROR(( " unexpected seac\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* unexpected seac */
+ }
+
+ /* `glyph_names' is set to 0 for CID fonts which do */
+ /* not include an encoding. How can we deal with */
+ /* these? */
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ if ( decoder->glyph_names == 0 &&
+ !face->root.internal->incremental_interface )
+#else
+ if ( decoder->glyph_names == 0 )
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
+ {
+ FT_ERROR((
+ "cf2_interpT2CharString: (Type 1 seac)"
+ " glyph names table not available in this font\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* seac weirdness */
+ adx += decoder->builder.left_bearing->x;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ if ( face->root.internal->incremental_interface )
+ {
+ /* the caller must handle the font encoding also */
+ bchar_index = bchar;
+ achar_index = achar;
+ }
+ else
+#endif
+ {
+ bchar_index = t1_lookup_glyph_by_stdcharcode_ps(
+ decoder, bchar );
+ achar_index = t1_lookup_glyph_by_stdcharcode_ps(
+ decoder, achar );
+ }
+
+ if ( bchar_index < 0 || achar_index < 0 )
+ {
+ FT_ERROR((
+ "cf2_interpT2CharString: (Type 1 seac)"
+ " invalid seac character code arguments\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* if we are trying to load a composite glyph, */
+ /* do not load the accent character and return */
+ /* the array of subglyphs. */
+ if ( decoder->builder.no_recurse )
+ {
+ FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
+ FT_GlyphLoader loader = glyph->internal->loader;
+ FT_SubGlyph subg;
+
+
+ /* reallocate subglyph array if necessary */
+ error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
+ if ( error2 )
+ {
+ lastError = error2; /* pass FreeType error through */
+ goto exit;
+ }
+
+ subg = loader->current.subglyphs;
+
+ /* subglyph 0 = base character */
+ subg->index = bchar_index;
+ subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
+ FT_SUBGLYPH_FLAG_USE_MY_METRICS;
+ subg->arg1 = 0;
+ subg->arg2 = 0;
+ subg++;
+
+ /* subglyph 1 = accent character */
+ subg->index = achar_index;
+ subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
+ subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb );
+ subg->arg2 = (FT_Int)FIXED_TO_INT( ady );
+
+ /* set up remaining glyph fields */
+ glyph->num_subglyphs = 2;
+ glyph->subglyphs = loader->base.subglyphs;
+ glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
+
+ loader->current.num_subglyphs = 2;
+
+ goto exit;
+ }
+
+ /* First load `bchar' in builder */
+ /* now load the unscaled outline */
+
+ /* prepare loader */
+ FT_GlyphLoader_Prepare( decoder->builder.loader );
+
+ error2 = cf2_getT1SeacComponent( decoder,
+ (FT_UInt)bchar_index,
+ &component );
+ if ( error2 )
+ {
+ lastError = error2; /* pass FreeType error through */
+ goto exit;
+ }
+ cf2_interpT2CharString( font,
+ &component,
+ callbacks,
+ translation,
+ TRUE,
+ 0,
+ 0,
+ &dummyWidth );
+ cf2_freeT1SeacComponent( decoder, &component );
+
+ /* save the left bearing and width of the base */
+ /* character as they will be erased by the next load */
+
+ left_bearing = *decoder->builder.left_bearing;
+ advance = *decoder->builder.advance;
+
+ decoder->builder.left_bearing->x = 0;
+ decoder->builder.left_bearing->y = 0;
+
+ /* Now load `achar' on top of */
+ /* the base outline */
+
+ error2 = cf2_getT1SeacComponent( decoder,
+ (FT_UInt)achar_index,
+ &component );
+ if ( error2 )
+ {
+ lastError = error2; /* pass FreeType error through */
+ goto exit;
+ }
+ cf2_interpT2CharString( font,
+ &component,
+ callbacks,
+ translation,
+ TRUE,
+ adx - asb,
+ ady,
+ &dummyWidth );
+ cf2_freeT1SeacComponent( decoder, &component );
+
+ /* restore the left side bearing and */
+ /* advance width of the base character */
+
+ *decoder->builder.left_bearing = left_bearing;
+ *decoder->builder.advance = advance;
+
+ goto exit;
+ }
+ break;
+
+ case cf2_escSBW:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else
+ {
+ CF2_Fixed lsb_x, lsb_y;
+ PS_Builder* builder;
+
+
+ FT_TRACE4(( " sbw" ));
+
+ builder = &decoder->builder;
+
+ builder->advance->y = cf2_stack_popFixed( opStack );
+ builder->advance->x = cf2_stack_popFixed( opStack );
+
+ lsb_y = cf2_stack_popFixed( opStack );
+ lsb_x = cf2_stack_popFixed( opStack );
+
+ builder->left_bearing->x =
+ ADD_INT32( builder->left_bearing->x, lsb_x );
+ builder->left_bearing->y =
+ ADD_INT32( builder->left_bearing->y, lsb_y );
+
+ haveWidth = TRUE;
+
+ /* the `metrics_only' indicates that we only want */
+ /* to compute the glyph's metrics (lsb + advance */
+ /* width), not load the rest of it; so exit */
+ /* immediately */
+ if ( builder->metrics_only )
+ goto exit;
+
+ if ( initial_map_ready )
+ {
+ curX = ADD_INT32( curX, lsb_x );
+ curY = ADD_INT32( curY, lsb_y );
+ }
+ }
+ break;
+
+ case cf2_escABS:
+ {
+ CF2_F16Dot16 arg;
+
+
+ FT_TRACE4(( " abs\n" ));
+
+ arg = cf2_stack_popFixed( opStack );
+
+ if ( arg < -CF2_FIXED_MAX )
+ cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
+ else
+ cf2_stack_pushFixed( opStack, FT_ABS( arg ) );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escADD:
+ {
+ CF2_F16Dot16 summand1;
+ CF2_F16Dot16 summand2;
+
+
+ FT_TRACE4(( " add\n" ));
+
+ summand2 = cf2_stack_popFixed( opStack );
+ summand1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ ADD_INT32( summand1,
+ summand2 ) );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escSUB:
+ {
+ CF2_F16Dot16 minuend;
+ CF2_F16Dot16 subtrahend;
+
+
+ FT_TRACE4(( " sub\n" ));
+
+ subtrahend = cf2_stack_popFixed( opStack );
+ minuend = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ SUB_INT32( minuend, subtrahend ) );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escDIV:
+ {
+ CF2_F16Dot16 dividend;
+ CF2_F16Dot16 divisor;
+
+
+ FT_TRACE4(( " div\n" ));
+
+ if ( font->isT1 && large_int )
+ {
+ divisor = (CF2_F16Dot16)cf2_stack_popInt( opStack );
+ dividend = (CF2_F16Dot16)cf2_stack_popInt( opStack );
+
+ large_int = FALSE;
+ }
+ else
+ {
+ divisor = cf2_stack_popFixed( opStack );
+ dividend = cf2_stack_popFixed( opStack );
+ }
+
+ cf2_stack_pushFixed( opStack,
+ FT_DivFix( dividend, divisor ) );
+
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escNEG:
+ {
+ CF2_F16Dot16 arg;
+
+
+ FT_TRACE4(( " neg\n" ));
+
+ arg = cf2_stack_popFixed( opStack );
+
+ if ( arg < -CF2_FIXED_MAX )
+ cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
+ else
+ cf2_stack_pushFixed( opStack, -arg );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escEQ:
+ {
+ CF2_F16Dot16 arg1;
+ CF2_F16Dot16 arg2;
+
+
+ FT_TRACE4(( " eq\n" ));
+
+ arg2 = cf2_stack_popFixed( opStack );
+ arg1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushInt( opStack, arg1 == arg2 );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escCALLOTHERSUBR:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else
+ {
+ CF2_Int subr_no;
+ CF2_Int arg_cnt;
+ CF2_UInt count;
+ CF2_UInt opIdx = 0;
+
+
+ FT_TRACE4(( " callothersubr\n" ));
+
+ subr_no = cf2_stack_popInt( opStack );
+ arg_cnt = cf2_stack_popInt( opStack );
+
+ /*******************************************************/
+ /* */
+ /* remove all operands to callothersubr from the stack */
+ /* */
+ /* for handled othersubrs, where we know the number of */
+ /* arguments, we increase the stack by the value of */
+ /* known_othersubr_result_cnt */
+ /* */
+ /* for unhandled othersubrs the following pops adjust */
+ /* the stack pointer as necessary */
+
+ count = cf2_stack_count( opStack );
+ FT_ASSERT( (CF2_UInt)arg_cnt <= count );
+
+ opIdx += count - (CF2_UInt)arg_cnt;
+
+ known_othersubr_result_cnt = 0;
+ result_cnt = 0;
+
+ /* XXX TODO: The checks to `arg_count == <whatever>' */
+ /* might not be correct; an othersubr expects a */
+ /* certain number of operands on the PostScript stack */
+ /* (as opposed to the T1 stack) but it doesn't have to */
+ /* put them there by itself; previous othersubrs might */
+ /* have left the operands there if they were not */
+ /* followed by an appropriate number of pops */
+ /* */
+ /* On the other hand, Adobe Reader 7.0.8 for Linux */
+ /* doesn't accept a font that contains charstrings */
+ /* like */
+ /* */
+ /* 100 200 2 20 callothersubr */
+ /* 300 1 20 callothersubr pop */
+ /* */
+ /* Perhaps this is the reason why BuildCharArray */
+ /* exists. */
+
+ switch ( subr_no )
+ {
+ case 0: /* end flex feature */
+ if ( arg_cnt != 3 )
+ goto Unexpected_OtherSubr;
+
+ if ( initial_map_ready &&
+ ( !decoder->flex_state ||
+ decoder->num_flex_vectors != 7 ) )
+ {
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " unexpected flex end\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* the two `results' are popped */
+ /* by the following setcurrentpoint */
+ cf2_stack_pushFixed( opStack, curX );
+ cf2_stack_pushFixed( opStack, curY );
+ known_othersubr_result_cnt = 2;
+ break;
+
+ case 1: /* start flex feature */
+ if ( arg_cnt != 0 )
+ goto Unexpected_OtherSubr;
+
+ if ( !initial_map_ready )
+ break;
+
+ if ( ps_builder_check_points( &decoder->builder, 6 ) )
+ goto exit;
+
+ decoder->flex_state = 1;
+ decoder->num_flex_vectors = 0;
+ break;
+
+ case 2: /* add flex vectors */
+ {
+ FT_Int idx;
+ FT_Int idx2;
+
+
+ if ( arg_cnt != 0 )
+ goto Unexpected_OtherSubr;
+
+ if ( !initial_map_ready )
+ break;
+
+ if ( !decoder->flex_state )
+ {
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " missing flex start\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* note that we should not add a point for */
+ /* index 0; this will move our current position */
+ /* to the flex point without adding any point */
+ /* to the outline */
+ idx = decoder->num_flex_vectors++;
+ if ( idx > 0 && idx < 7 )
+ {
+ /* in malformed fonts it is possible to have */
+ /* other opcodes in the middle of a flex (which */
+ /* don't increase `num_flex_vectors'); we thus */
+ /* have to check whether we can add a point */
+
+ if ( ps_builder_check_points( &decoder->builder,
+ 1 ) )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */
+ idx2 = ( idx > 3 ? idx - 3 : idx ) * 2;
+
+ flexStore[idx2 - 2] = curX;
+ flexStore[idx2 - 1] = curY;
+
+ if ( idx == 3 || idx == 6 )
+ cf2_glyphpath_curveTo( &glyphPath,
+ flexStore[0],
+ flexStore[1],
+ flexStore[2],
+ flexStore[3],
+ flexStore[4],
+ flexStore[5] );
+ }
+ }
+ break;
+
+ case 3: /* change hints */
+ if ( arg_cnt != 1 )
+ goto Unexpected_OtherSubr;
+
+ if ( initial_map_ready )
+ {
+ /* do not clear hints if initial hintmap */
+ /* is not ready - we need to collate all */
+ cf2_arrstack_clear( &vStemHintArray );
+ cf2_arrstack_clear( &hStemHintArray );
+
+ cf2_hintmask_init( &hintMask, error );
+ hintMask.isValid = FALSE;
+ hintMask.isNew = TRUE;
+ }
+
+ known_othersubr_result_cnt = 1;
+ break;
+
+ case 12:
+ case 13:
+ /* counter control hints, clear stack */
+ cf2_stack_clear( opStack );
+ break;
+
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ case 18: /* multiple masters */
+ {
+ PS_Blend blend = decoder->blend;
+ FT_UInt num_points, nn, mm;
+ CF2_UInt delta;
+ CF2_UInt values;
+
+
+ if ( !blend )
+ {
+ FT_ERROR((
+ "cf2_interpT2CharString:"
+ " unexpected multiple masters operator\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ num_points = (FT_UInt)subr_no - 13 +
+ ( subr_no == 18 );
+ if ( arg_cnt != (FT_Int)( num_points *
+ blend->num_designs ) )
+ {
+ FT_ERROR((
+ "cf2_interpT2CharString:"
+ " incorrect number of multiple masters arguments\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ /* We want to compute */
+ /* */
+ /* a0*w0 + a1*w1 + ... + ak*wk */
+ /* */
+ /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */
+ /* */
+ /* However, given that w0 + w1 + ... + wk == 1, we */
+ /* can rewrite it easily as */
+ /* */
+ /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */
+ /* */
+ /* where k == num_designs-1. */
+ /* */
+ /* I guess that's why it's written in this `compact' */
+ /* form. */
+ /* */
+ delta = opIdx + num_points;
+ values = opIdx;
+ for ( nn = 0; nn < num_points; nn++ )
+ {
+ CF2_Fixed tmp = cf2_stack_getReal( opStack,
+ values );
+
+
+ for ( mm = 1; mm < blend->num_designs; mm++ )
+ tmp = ADD_INT32( tmp,
+ FT_MulFix(
+ cf2_stack_getReal( opStack,
+ delta++ ),
+ blend->weight_vector[mm] ) );
+
+ cf2_stack_setReal( opStack, values++, tmp );
+ }
+ cf2_stack_pop( opStack,
+ (CF2_UInt)arg_cnt - num_points );
+
+ known_othersubr_result_cnt = (FT_Int)num_points;
+ break;
+ }
+
+ case 19:
+ /* <idx> 1 19 callothersubr */
+ /* ==> replace elements starting from index */
+ /* cvi( <idx> ) of BuildCharArray with */
+ /* WeightVector */
+ {
+ FT_Int idx;
+ PS_Blend blend = decoder->blend;
+
+
+ if ( arg_cnt != 1 || !blend )
+ goto Unexpected_OtherSubr;
+
+ idx = cf2_stack_popInt( opStack );
+
+ if ( idx < 0 ||
+ (FT_UInt)idx + blend->num_designs >
+ decoder->len_buildchar )
+ goto Unexpected_OtherSubr;
+
+ ft_memcpy( &decoder->buildchar[idx],
+ blend->weight_vector,
+ blend->num_designs *
+ sizeof ( blend->weight_vector[0] ) );
+ }
+ break;
+
+ case 20:
+ /* <arg1> <arg2> 2 20 callothersubr pop */
+ /* ==> push <arg1> + <arg2> onto T1 stack */
+ {
+ CF2_F16Dot16 summand1;
+ CF2_F16Dot16 summand2;
+
+
+ if ( arg_cnt != 2 )
+ goto Unexpected_OtherSubr;
+
+ summand2 = cf2_stack_popFixed( opStack );
+ summand1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ ADD_INT32( summand1,
+ summand2 ) );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+ case 21:
+ /* <arg1> <arg2> 2 21 callothersubr pop */
+ /* ==> push <arg1> - <arg2> onto T1 stack */
+ {
+ CF2_F16Dot16 minuend;
+ CF2_F16Dot16 subtrahend;
+
+
+ if ( arg_cnt != 2 )
+ goto Unexpected_OtherSubr;
+
+ subtrahend = cf2_stack_popFixed( opStack );
+ minuend = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ SUB_INT32( minuend,
+ subtrahend ) );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+ case 22:
+ /* <arg1> <arg2> 2 22 callothersubr pop */
+ /* ==> push <arg1> * <arg2> onto T1 stack */
+ {
+ CF2_F16Dot16 factor1;
+ CF2_F16Dot16 factor2;
+
+
+ if ( arg_cnt != 2 )
+ goto Unexpected_OtherSubr;
+
+ factor2 = cf2_stack_popFixed( opStack );
+ factor1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ FT_MulFix( factor1, factor2 ) );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+ case 23:
+ /* <arg1> <arg2> 2 23 callothersubr pop */
+ /* ==> push <arg1> / <arg2> onto T1 stack */
+ {
+ CF2_F16Dot16 dividend;
+ CF2_F16Dot16 divisor;
+
+
+ if ( arg_cnt != 2 )
+ goto Unexpected_OtherSubr;
+
+ divisor = cf2_stack_popFixed( opStack );
+ dividend = cf2_stack_popFixed( opStack );
+
+ if ( divisor == 0 )
+ goto Unexpected_OtherSubr;
+
+ cf2_stack_pushFixed( opStack,
+ FT_DivFix( dividend,
+ divisor ) );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+ case 24:
+ /* <val> <idx> 2 24 callothersubr */
+ /* ==> set BuildCharArray[cvi( <idx> )] = <val> */
+ {
+ CF2_Int idx;
+ PS_Blend blend = decoder->blend;
+
+
+ if ( arg_cnt != 2 || !blend )
+ goto Unexpected_OtherSubr;
+
+ idx = cf2_stack_popInt( opStack );
+
+ if ( idx < 0 ||
+ (FT_UInt)idx >= decoder->len_buildchar )
+ goto Unexpected_OtherSubr;
+
+ decoder->buildchar[idx] =
+ cf2_stack_popFixed( opStack );
+ }
+ break;
+
+ case 25:
+ /* <idx> 1 25 callothersubr pop */
+ /* ==> push BuildCharArray[cvi( idx )] */
+ /* onto T1 stack */
+ {
+ CF2_Int idx;
+ PS_Blend blend = decoder->blend;
+
+
+ if ( arg_cnt != 1 || !blend )
+ goto Unexpected_OtherSubr;
+
+ idx = cf2_stack_popInt( opStack );
+
+ if ( idx < 0 ||
+ (FT_UInt)idx >= decoder->len_buildchar )
+ goto Unexpected_OtherSubr;
+
+ cf2_stack_pushFixed( opStack,
+ decoder->buildchar[idx] );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+#if 0
+ case 26:
+ /* <val> mark <idx> */
+ /* ==> set BuildCharArray[cvi( <idx> )] = <val>, */
+ /* leave mark on T1 stack */
+ /* <val> <idx> */
+ /* ==> set BuildCharArray[cvi( <idx> )] = <val> */
+ XXX which routine has left its mark on the
+ XXX (PostScript) stack?;
+ break;
+#endif
+
+ case 27:
+ /* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */
+ /* ==> push <res1> onto T1 stack if <val1> <= <val2>, */
+ /* otherwise push <res2> */
+ {
+ CF2_F16Dot16 arg1;
+ CF2_F16Dot16 arg2;
+ CF2_F16Dot16 cond1;
+ CF2_F16Dot16 cond2;
+
+
+ if ( arg_cnt != 4 )
+ goto Unexpected_OtherSubr;
+
+ cond2 = cf2_stack_popFixed( opStack );
+ cond1 = cf2_stack_popFixed( opStack );
+ arg2 = cf2_stack_popFixed( opStack );
+ arg1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ cond1 <= cond2 ? arg1 : arg2 );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+ case 28:
+ /* 0 28 callothersubr pop */
+ /* ==> push random value from interval [0, 1) */
+ /* onto stack */
+ {
+ CF2_F16Dot16 r;
+
+
+ if ( arg_cnt != 0 )
+ goto Unexpected_OtherSubr;
+
+ /* only use the lower 16 bits of `random' */
+ /* to generate a number in the range (0;1] */
+ r = (CF2_F16Dot16)
+ ( ( decoder->current_subfont->random & 0xFFFF ) + 1 );
+
+ decoder->current_subfont->random =
+ cff_random( decoder->current_subfont->random );
+
+ cf2_stack_pushFixed( opStack, r );
+ known_othersubr_result_cnt = 1;
+ }
+ break;
+
+ default:
+ if ( arg_cnt >= 0 && subr_no >= 0 )
+ {
+ FT_Int i;
+
+
+ FT_ERROR((
+ "cf2_interpT2CharString (Type 1 mode):"
+ " unknown othersubr [%d %d], wish me luck\n",
+ arg_cnt, subr_no ));
+
+ /* store the unused args */
+ /* for this unhandled OtherSubr */
+
+ if ( arg_cnt > PS_STORAGE_SIZE )
+ arg_cnt = PS_STORAGE_SIZE;
+ result_cnt = arg_cnt;
+
+ for ( i = 1; i <= arg_cnt; i++ )
+ results[result_cnt - i] =
+ cf2_stack_popFixed( opStack );
+
+ break;
+ }
+ /* fall through */
+
+ Unexpected_OtherSubr:
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " invalid othersubr [%d %d]\n",
+ arg_cnt, subr_no ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escPOP:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else
+ {
+ FT_TRACE4(( " pop" ));
+
+ if ( known_othersubr_result_cnt > 0 )
+ {
+ known_othersubr_result_cnt--;
+ /* ignore, we pushed the operands ourselves */
+ continue;
+ }
+
+ if ( result_cnt == 0 )
+ {
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " no more operands for othersubr\n" ));
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
+ result_cnt--;
+ cf2_stack_pushFixed( opStack, results[result_cnt] );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escDROP:
+ FT_TRACE4(( " drop\n" ));
+
+ (void)cf2_stack_popFixed( opStack );
+ continue; /* do not clear the stack */
+
+ case cf2_escPUT:
+ {
+ CF2_F16Dot16 val;
+ CF2_Int idx;
+
+
+ FT_TRACE4(( " put\n" ));
+
+ idx = cf2_stack_popInt( opStack );
+ val = cf2_stack_popFixed( opStack );
+
+ if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
+ storage[idx] = val;
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escGET:
+ {
+ CF2_Int idx;
+
+
+ FT_TRACE4(( " get\n" ));
+
+ idx = cf2_stack_popInt( opStack );
+
+ if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
+ cf2_stack_pushFixed( opStack, storage[idx] );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escIFELSE:
+ {
+ CF2_F16Dot16 arg1;
+ CF2_F16Dot16 arg2;
+ CF2_F16Dot16 cond1;
+ CF2_F16Dot16 cond2;
+
+
+ FT_TRACE4(( " ifelse\n" ));
+
+ cond2 = cf2_stack_popFixed( opStack );
+ cond1 = cf2_stack_popFixed( opStack );
+ arg2 = cf2_stack_popFixed( opStack );
+ arg1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ cond1 <= cond2 ? arg1 : arg2 );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escRANDOM: /* in spec */
+ {
+ CF2_F16Dot16 r;
+
+
+ FT_TRACE4(( " random\n" ));
+
+ /* only use the lower 16 bits of `random' */
+ /* to generate a number in the range (0;1] */
+ r = (CF2_F16Dot16)
+ ( ( decoder->current_subfont->random & 0xFFFF ) + 1 );
+
+ decoder->current_subfont->random =
+ cff_random( decoder->current_subfont->random );
+
+ cf2_stack_pushFixed( opStack, r );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escMUL:
+ {
+ CF2_F16Dot16 factor1;
+ CF2_F16Dot16 factor2;
+
+
+ FT_TRACE4(( " mul\n" ));
+
+ factor2 = cf2_stack_popFixed( opStack );
+ factor1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack,
+ FT_MulFix( factor1, factor2 ) );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escSQRT:
+ {
+ CF2_F16Dot16 arg;
+
+
+ FT_TRACE4(( " sqrt\n" ));
+
+ arg = cf2_stack_popFixed( opStack );
+ if ( arg > 0 )
+ {
+ /* use a start value that doesn't make */
+ /* the algorithm's addition overflow */
+ FT_Fixed root = arg < 10 ? arg : arg >> 1;
+ FT_Fixed new_root;
+
+
+ /* Babylonian method */
+ for (;;)
+ {
+ new_root = ( root + FT_DivFix( arg, root ) + 1 ) >> 1;
+ if ( new_root == root )
+ break;
+ root = new_root;
+ }
+ arg = new_root;
+ }
+ else
+ arg = 0;
+
+ cf2_stack_pushFixed( opStack, arg );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escDUP:
+ {
+ CF2_F16Dot16 arg;
+
+
+ FT_TRACE4(( " dup\n" ));
+
+ arg = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack, arg );
+ cf2_stack_pushFixed( opStack, arg );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escEXCH:
+ {
+ CF2_F16Dot16 arg1;
+ CF2_F16Dot16 arg2;
+
+
+ FT_TRACE4(( " exch\n" ));
+
+ arg2 = cf2_stack_popFixed( opStack );
+ arg1 = cf2_stack_popFixed( opStack );
+
+ cf2_stack_pushFixed( opStack, arg2 );
+ cf2_stack_pushFixed( opStack, arg1 );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escINDEX:
+ {
+ CF2_Int idx;
+ CF2_UInt size;
+
+
+ FT_TRACE4(( " index\n" ));
+
+ idx = cf2_stack_popInt( opStack );
+ size = cf2_stack_count( opStack );
+
+ if ( size > 0 )
+ {
+ /* for `cf2_stack_getReal', */
+ /* index 0 is bottom of stack */
+ CF2_UInt gr_idx;
+
+
+ if ( idx < 0 )
+ gr_idx = size - 1;
+ else if ( (CF2_UInt)idx >= size )
+ gr_idx = 0;
+ else
+ gr_idx = size - 1 - (CF2_UInt)idx;
+
+ cf2_stack_pushFixed( opStack,
+ cf2_stack_getReal( opStack,
+ gr_idx ) );
+ }
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escROLL:
+ {
+ CF2_Int idx;
+ CF2_Int count;
+
+
+ FT_TRACE4(( " roll\n" ));
+
+ idx = cf2_stack_popInt( opStack );
+ count = cf2_stack_popInt( opStack );
+
+ cf2_stack_roll( opStack, count, idx );
+ }
+ continue; /* do not clear the stack */
+
+ case cf2_escSETCURRENTPT:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
+ else
+ {
+ FT_TRACE4(( " setcurrentpoint" ));
+
+ if ( !initial_map_ready )
+ break;
+
+ /* From the T1 specification, section 6.4: */
+ /* */
+ /* The setcurrentpoint command is used only in */
+ /* conjunction with results from OtherSubrs */
+ /* procedures. */
+
+ /* known_othersubr_result_cnt != 0 is already handled */
+ /* above. */
+
+ /* Note, however, that both Ghostscript and Adobe */
+ /* Distiller handle this situation by silently */
+ /* ignoring the inappropriate `setcurrentpoint' */
+ /* instruction. So we do the same. */
+#if 0
+
+ if ( decoder->flex_state != 1 )
+ {
+ FT_ERROR(( "cf2_interpT2CharString:"
+ " unexpected `setcurrentpoint'\n" ));
+ goto Syntax_Error;
+ }
+ else
+ ...
+#endif
+
+ curY = cf2_stack_popFixed( opStack );
+ curX = cf2_stack_popFixed( opStack );
+
+ decoder->flex_state = 0;
+ }
+ break;
+
+ } /* end of 2nd switch checking op2 */
+ }
+ }
+ } /* end of 1st switch checking op2 */
+ } /* case cf2_cmdESC */
+
+ break;
+
+ case cf2_cmdHSBW:
+ if ( !font->isT1 )
+ FT_TRACE4(( " unknown op (%d)\n", op1 ));
+ else
+ {
+ CF2_Fixed lsb_x;
+ PS_Builder* builder;
+
+
+ FT_TRACE4(( " hsbw" ));
+
+ builder = &decoder->builder;
+
+ builder->advance->x = cf2_stack_popFixed( opStack );
+ builder->advance->y = 0;
+
+ lsb_x = cf2_stack_popFixed( opStack );
+
+ builder->left_bearing->x = ADD_INT32( builder->left_bearing->x,
+ lsb_x );
+
+ haveWidth = TRUE;
+
+ /* the `metrics_only' indicates that we only want to compute */
+ /* the glyph's metrics (lsb + advance width), not load the */
+ /* rest of it; so exit immediately */
+ if ( builder->metrics_only )
+ goto exit;
+
+ if ( initial_map_ready )
+ curX = ADD_INT32( curX, lsb_x );
+ }
+ break;
+
+ case cf2_cmdENDCHAR:
+ FT_TRACE4(( " endchar\n" ));
+
+ if ( font->isT1 && !initial_map_ready )
+ {
+ FT_TRACE5(( "cf2_interpT2CharString (Type 1 mode): "
+ "Build initial hintmap, rewinding...\n" ));
+
+ /* trigger initial hintmap build */
+ cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+
+ initial_map_ready = TRUE;
+
+ /* change hints routine - clear for rewind */
+ cf2_arrstack_clear( &vStemHintArray );
+ cf2_arrstack_clear( &hStemHintArray );
+
+ cf2_hintmask_init( &hintMask, error );
+ hintMask.isValid = FALSE;
+ hintMask.isNew = TRUE;
+
+ /* rewind charstring */
+ /* some charstrings use endchar from a final subroutine call */
+ /* without returning, detect these and exit to the top level */
+ /* charstring */
+ while ( charstringIndex > 0 )
+ {
+ FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
+
+ /* restore position in previous charstring */
+ charstring = (CF2_Buffer)
+ cf2_arrstack_getPointer(
+ &subrStack,
+ (CF2_UInt)--charstringIndex );
+ }
+ charstring->ptr = charstring->start;
+
+ break;
+ }
+
+ if ( cf2_stack_count( opStack ) == 1 ||
+ cf2_stack_count( opStack ) == 5 )
+ {
+ if ( !haveWidth )
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
+ }
+
+ /* width is defined or default after this */
+ haveWidth = TRUE;
+
+ if ( decoder->width_only )
+ goto exit;
+
+ /* close path if still open */
+ cf2_glyphpath_closeOpenPath( &glyphPath );
+
+ /* disable seac for CFF2 and Type1 */
+ /* (charstring ending with args on stack) */
+ if ( !font->isCFF2 && !font->isT1 && cf2_stack_count( opStack ) > 1 )
+ {
+ /* must be either 4 or 5 -- */
+ /* this is a (deprecated) implied `seac' operator */
+
+ CF2_Int achar;
+ CF2_Int bchar;
+ CF2_BufferRec component;
+ CF2_Fixed dummyWidth; /* ignore component width */
+ FT_Error error2;
+
+
+ if ( doingSeac )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit; /* nested seac */
+ }
+
+ achar = cf2_stack_popInt( opStack );
+ bchar = cf2_stack_popInt( opStack );
+
+ curY = cf2_stack_popFixed( opStack );
+ curX = cf2_stack_popFixed( opStack );
+
+ error2 = cf2_getSeacComponent( decoder, achar, &component );
+ if ( error2 )
+ {
+ lastError = error2; /* pass FreeType error through */
+ goto exit;
+ }
+ cf2_interpT2CharString( font,
+ &component,
+ callbacks,
+ translation,
+ TRUE,
+ curX,
+ curY,
+ &dummyWidth );
+ cf2_freeSeacComponent( decoder, &component );
+
+ error2 = cf2_getSeacComponent( decoder, bchar, &component );
+ if ( error2 )
+ {
+ lastError = error2; /* pass FreeType error through */
+ goto exit;
+ }
+ cf2_interpT2CharString( font,
+ &component,
+ callbacks,
+ translation,
+ TRUE,
+ 0,
+ 0,
+ &dummyWidth );
+ cf2_freeSeacComponent( decoder, &component );
+ }
+ goto exit;
+
+ case cf2_cmdCNTRMASK:
+ case cf2_cmdHINTMASK:
+ /* the final \n in the tracing message gets added in */
+ /* `cf2_hintmask_read' (which also traces the mask bytes) */
+ FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" ));
+
+ /* never add hints after the mask is computed */
+ if ( cf2_stack_count( opStack ) > 1 &&
+ cf2_hintmask_isValid( &hintMask ) )
+ {
+ FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" ));
+ break;
+ }
+
+ /* if there are arguments on the stack, there this is an */
+ /* implied cf2_cmdVSTEMHM */
+ cf2_doStems( font,
+ opStack,
+ &vStemHintArray,
+ width,
+ &haveWidth,
+ 0 );
+
+ if ( decoder->width_only )
+ goto exit;
+
+ if ( op1 == cf2_cmdHINTMASK )
+ {
+ /* consume the hint mask bytes which follow the operator */
+ cf2_hintmask_read( &hintMask,
+ charstring,
+ cf2_arrstack_size( &hStemHintArray ) +
+ cf2_arrstack_size( &vStemHintArray ) );
+ }
+ else
+ {
+ /*
+ * Consume the counter mask bytes which follow the operator:
+ * Build a temporary hint map, just to place and lock those
+ * stems participating in the counter mask. These are most
+ * likely the dominant hstems, and are grouped together in a
+ * few counter groups, not necessarily in correspondence
+ * with the hint groups. This reduces the chances of
+ * conflicts between hstems that are initially placed in
+ * separate hint groups and then brought together. The
+ * positions are copied back to `hStemHintArray', so we can
+ * discard `counterMask' and `counterHintMap'.
+ *
+ */
+ CF2_HintMapRec counterHintMap;
+ CF2_HintMaskRec counterMask;
+
+
+ cf2_hintmap_init( &counterHintMap,
+ font,
+ &glyphPath.initialHintMap,
+ &glyphPath.hintMoves,
+ scaleY );
+ cf2_hintmask_init( &counterMask, error );
+
+ cf2_hintmask_read( &counterMask,
+ charstring,
+ cf2_arrstack_size( &hStemHintArray ) +
+ cf2_arrstack_size( &vStemHintArray ) );
+ cf2_hintmap_build( &counterHintMap,
+ &hStemHintArray,
+ &vStemHintArray,
+ &counterMask,
+ 0,
+ FALSE );
+ }
+ break;
+
+ case cf2_cmdRMOVETO:
+ FT_TRACE4(( " rmoveto\n" ));
+
+ if ( font->isT1 && !decoder->flex_state && !haveWidth )
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " No width. Use hsbw/sbw as first op\n" ));
+
+ if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
+
+ /* width is defined or default after this */
+ haveWidth = TRUE;
+
+ if ( decoder->width_only )
+ goto exit;
+
+ curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
+ curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
+
+ if ( !decoder->flex_state )
+ cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+
+ break;
+
+ case cf2_cmdHMOVETO:
+ FT_TRACE4(( " hmoveto\n" ));
+
+ if ( font->isT1 && !decoder->flex_state && !haveWidth )
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " No width. Use hsbw/sbw as first op\n" ));
+
+ if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
+ *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
+ nominalWidthX );
+
+ /* width is defined or default after this */
+ haveWidth = TRUE;
+
+ if ( decoder->width_only )
+ goto exit;
+
+ curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
+
+ if ( !decoder->flex_state )
+ cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+
+ break;
+
+ case cf2_cmdRLINECURVE:
+ {
+ CF2_UInt count = cf2_stack_count( opStack );
+ CF2_UInt idx = 0;
+
+
+ FT_TRACE4(( " rlinecurve\n" ));
+
+ while ( idx + 6 < count )
+ {
+ curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
+ idx + 0 ) );
+ curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
+ idx + 1 ) );
+
+ cf2_glyphpath_lineTo( &glyphPath, curX, curY );
+ idx += 2;
+ }
+
+ while ( idx < count )
+ {
+ CF2_Fixed x1, y1, x2, y2, x3, y3;
+
+
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
+
+ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
+
+ curX = x3;
+ curY = y3;
+ idx += 6;
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue; /* no need to clear stack again */
+
+ case cf2_cmdVVCURVETO:
+ {
+ CF2_UInt count, count1 = cf2_stack_count( opStack );
+ CF2_UInt idx = 0;
+
+
+ /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
+ /* we enforce it by clearing the second bit */
+ /* (and sorting the stack indexing to suit) */
+ count = count1 & ~2U;
+ idx += count1 - count;
+
+ FT_TRACE4(( " vvcurveto\n" ));
+
+ while ( idx < count )
+ {
+ CF2_Fixed x1, y1, x2, y2, x3, y3;
+
+
+ if ( ( count - idx ) & 1 )
+ {
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX );
+
+ idx++;
+ }
+ else
+ x1 = curX;
+
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ x3 = x2;
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
+
+ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
+
+ curX = x3;
+ curY = y3;
+ idx += 4;
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue; /* no need to clear stack again */
+
+ case cf2_cmdHHCURVETO:
+ {
+ CF2_UInt count, count1 = cf2_stack_count( opStack );
+ CF2_UInt idx = 0;
+
+
+ /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
+ /* we enforce it by clearing the second bit */
+ /* (and sorting the stack indexing to suit) */
+ count = count1 & ~2U;
+ idx += count1 - count;
+
+ FT_TRACE4(( " hhcurveto\n" ));
+
+ while ( idx < count )
+ {
+ CF2_Fixed x1, y1, x2, y2, x3, y3;
+
+
+ if ( ( count - idx ) & 1 )
+ {
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY );
+
+ idx++;
+ }
+ else
+ y1 = curY;
+
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
+ y3 = y2;
+
+ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
+
+ curX = x3;
+ curY = y3;
+ idx += 4;
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue; /* no need to clear stack again */
+
+ case cf2_cmdVHCURVETO:
+ case cf2_cmdHVCURVETO:
+ {
+ CF2_UInt count, count1 = cf2_stack_count( opStack );
+ CF2_UInt idx = 0;
+
+ FT_Bool alternate = FT_BOOL( op1 == cf2_cmdHVCURVETO );
+
+
+ /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */
+ /* 8n+4, or 8n+5, we enforce it by clearing the */
+ /* second bit */
+ /* (and sorting the stack indexing to suit) */
+ count = count1 & ~2U;
+ idx += count1 - count;
+
+ FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
+
+ while ( idx < count )
+ {
+ CF2_Fixed x1, x2, x3, y1, y2, y3;
+
+
+ if ( alternate )
+ {
+ x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
+ y1 = curY;
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
+
+ if ( count - idx == 5 )
+ {
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
+
+ idx++;
+ }
+ else
+ x3 = x2;
+
+ alternate = FALSE;
+ }
+ else
+ {
+ x1 = curX;
+ y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
+ x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
+ y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
+ x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
+
+ if ( count - idx == 5 )
+ {
+ y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 );
+
+ idx++;
+ }
+ else
+ y3 = y2;
+
+ alternate = TRUE;
+ }
+
+ cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
+
+ curX = x3;
+ curY = y3;
+ idx += 4;
+ }
+
+ cf2_stack_clear( opStack );
+ }
+ continue; /* no need to clear stack again */
+
+ case cf2_cmdEXTENDEDNMBR:
+ {
+ CF2_Int v;
+
+ CF2_Int byte1 = cf2_buf_readByte( charstring );
+ CF2_Int byte2 = cf2_buf_readByte( charstring );
+
+
+ v = (FT_Short)( ( byte1 << 8 ) |
+ byte2 );
+
+ FT_TRACE4(( " %d", v ));
+
+ cf2_stack_pushInt( opStack, v );
+ }
+ continue;
+
+ default:
+ /* numbers */
+ {
+ if ( /* op1 >= 32 && */ op1 <= 246 )
+ {
+ CF2_Int v;
+
+
+ v = op1 - 139;
+
+ FT_TRACE4(( " %d", v ));
+
+ /* -107 .. 107 */
+ cf2_stack_pushInt( opStack, v );
+ }
+
+ else if ( /* op1 >= 247 && */ op1 <= 250 )
+ {
+ CF2_Int v;
+
+
+ v = op1;
+ v -= 247;
+ v *= 256;
+ v += cf2_buf_readByte( charstring );
+ v += 108;
+
+ FT_TRACE4(( " %d", v ));
+
+ /* 108 .. 1131 */
+ cf2_stack_pushInt( opStack, v );
+ }
+
+ else if ( /* op1 >= 251 && */ op1 <= 254 )
+ {
+ CF2_Int v;
+
+
+ v = op1;
+ v -= 251;
+ v *= 256;
+ v += cf2_buf_readByte( charstring );
+ v = -v - 108;
+
+ FT_TRACE4(( " %d", v ));
+
+ /* -1131 .. -108 */
+ cf2_stack_pushInt( opStack, v );
+ }
+
+ else /* op1 == 255 */
+ {
+ CF2_Fixed v;
+
+ FT_UInt32 byte1 = (FT_UInt32)cf2_buf_readByte( charstring );
+ FT_UInt32 byte2 = (FT_UInt32)cf2_buf_readByte( charstring );
+ FT_UInt32 byte3 = (FT_UInt32)cf2_buf_readByte( charstring );
+ FT_UInt32 byte4 = (FT_UInt32)cf2_buf_readByte( charstring );
+
+
+ v = (CF2_Fixed)( ( byte1 << 24 ) |
+ ( byte2 << 16 ) |
+ ( byte3 << 8 ) |
+ byte4 );
+
+ /*
+ * For Type 1:
+ *
+ * According to the specification, values > 32000 or < -32000
+ * must be followed by a `div' operator to make the result be
+ * in the range [-32000;32000]. We expect that the second
+ * argument of `div' is not a large number. Additionally, we
+ * don't handle stuff like `<large1> <large2> <num> div <num>
+ * div' or <large1> <large2> <num> div div'. This is probably
+ * not allowed anyway.
+ *
+ * <large> <num> <num>+ div is not checked but should not be
+ * allowed as the large value remains untouched.
+ *
+ */
+ if ( font->isT1 )
+ {
+ if ( v > 32000 || v < -32000 )
+ {
+ if ( large_int )
+ FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
+ " no `div' after large integer\n" ));
+ else
+ large_int = TRUE;
+ }
+
+ FT_TRACE4(( " %d", v ));
+
+ cf2_stack_pushInt( opStack, (CF2_Int)v );
+ }
+ else
+ {
+ FT_TRACE4(( " %.5fF", v / 65536.0 ));
+
+ cf2_stack_pushFixed( opStack, v );
+ }
+ }
+ }
+ continue; /* don't clear stack */
+
+ } /* end of switch statement checking `op1' */
+
+ cf2_stack_clear( opStack );
+
+ } /* end of main interpreter loop */
+
+ /* we get here if the charstring ends without cf2_cmdENDCHAR */
+ FT_TRACE4(( "cf2_interpT2CharString:"
+ " charstring ends without ENDCHAR\n" ));
+
+ exit:
+ /* check whether last error seen is also the first one */
+ cf2_setError( error, lastError );
+
+ if ( *error )
+ FT_TRACE4(( "charstring error %d\n", *error ));
+
+ /* free resources from objects we've used */
+ cf2_glyphpath_finalize( &glyphPath );
+ cf2_arrstack_finalize( &vStemHintArray );
+ cf2_arrstack_finalize( &hStemHintArray );
+ cf2_arrstack_finalize( &subrStack );
+ cf2_stack_free( opStack );
+
+ FT_TRACE4(( "\n" ));
+
+ return;
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psintrp.h b/thirdparty/freetype/src/psaux/psintrp.h
new file mode 100644
index 0000000000..4790aaa302
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psintrp.h
@@ -0,0 +1,83 @@
+/***************************************************************************/
+/* */
+/* psintrp.h */
+/* */
+/* Adobe's CFF Interpreter (specification). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSINTRP_H_
+#define PSINTRP_H_
+
+
+#include "psft.h"
+#include "pshints.h"
+
+
+FT_BEGIN_HEADER
+
+
+ FT_LOCAL( void )
+ cf2_hintmask_init( CF2_HintMask hintmask,
+ FT_Error* error );
+ FT_LOCAL( FT_Bool )
+ cf2_hintmask_isValid( const CF2_HintMask hintmask );
+ FT_LOCAL( FT_Bool )
+ cf2_hintmask_isNew( const CF2_HintMask hintmask );
+ FT_LOCAL( void )
+ cf2_hintmask_setNew( CF2_HintMask hintmask,
+ FT_Bool val );
+ FT_LOCAL( FT_Byte* )
+ cf2_hintmask_getMaskPtr( CF2_HintMask hintmask );
+ FT_LOCAL( void )
+ cf2_hintmask_setAll( CF2_HintMask hintmask,
+ size_t bitCount );
+
+ FT_LOCAL( void )
+ cf2_interpT2CharString( CF2_Font font,
+ CF2_Buffer charstring,
+ CF2_OutlineCallbacks callbacks,
+ const FT_Vector* translation,
+ FT_Bool doingSeac,
+ CF2_Fixed curX,
+ CF2_Fixed curY,
+ CF2_Fixed* width );
+
+
+FT_END_HEADER
+
+
+#endif /* PSINTRP_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psobjs.c b/thirdparty/freetype/src/psaux/psobjs.c
index f04edea411..f54bc7e416 100644
--- a/thirdparty/freetype/src/psaux/psobjs.c
+++ b/thirdparty/freetype/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,11 +20,13 @@
#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_CALC_H
+#include FT_DRIVER_H
#include "psobjs.h"
#include "psconv.h"
#include "psauxerr.h"
+#include "psauxmod.h"
/*************************************************************************/
@@ -1761,11 +1763,748 @@
/*************************************************************************/
/*************************************************************************/
/***** *****/
+ /***** CFF BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* cff_builder_init */
+ /* */
+ /* <Description> */
+ /* Initializes a given glyph builder. */
+ /* */
+ /* <InOut> */
+ /* builder :: A pointer to the glyph builder to initialize. */
+ /* */
+ /* <Input> */
+ /* face :: The current face object. */
+ /* */
+ /* size :: The current size object. */
+ /* */
+ /* glyph :: The current glyph object. */
+ /* */
+ /* hinting :: Whether hinting is active. */
+ /* */
+ FT_LOCAL_DEF( void )
+ cff_builder_init( CFF_Builder* builder,
+ TT_Face face,
+ CFF_Size size,
+ CFF_GlyphSlot glyph,
+ FT_Bool hinting )
+ {
+ builder->path_begun = 0;
+ builder->load_points = 1;
+
+ builder->face = face;
+ builder->glyph = glyph;
+ builder->memory = face->root.memory;
+
+ if ( glyph )
+ {
+ FT_GlyphLoader loader = glyph->root.internal->loader;
+
+
+ builder->loader = loader;
+ builder->base = &loader->base.outline;
+ builder->current = &loader->current.outline;
+ FT_GlyphLoader_Rewind( loader );
+
+ builder->hints_globals = NULL;
+ builder->hints_funcs = NULL;
+
+ if ( hinting && size )
+ {
+ FT_Size ftsize = FT_SIZE( size );
+ CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
+
+ if ( internal )
+ {
+ builder->hints_globals = (void *)internal->topfont;
+ builder->hints_funcs = glyph->root.internal->glyph_hints;
+ }
+ }
+ }
+
+ builder->pos_x = 0;
+ builder->pos_y = 0;
+
+ builder->left_bearing.x = 0;
+ builder->left_bearing.y = 0;
+ builder->advance.x = 0;
+ builder->advance.y = 0;
+
+ builder->funcs = cff_builder_funcs;
+ }
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* cff_builder_done */
+ /* */
+ /* <Description> */
+ /* Finalizes a given glyph builder. Its contents can still be used */
+ /* after the call, but the function saves important information */
+ /* within the corresponding glyph slot. */
+ /* */
+ /* <Input> */
+ /* builder :: A pointer to the glyph builder to finalize. */
+ /* */
+ FT_LOCAL_DEF( void )
+ cff_builder_done( CFF_Builder* builder )
+ {
+ CFF_GlyphSlot glyph = builder->glyph;
+
+
+ if ( glyph )
+ glyph->root.outline = *builder->base;
+ }
+
+
+ /* check that there is enough space for `count' more points */
+ FT_LOCAL_DEF( FT_Error )
+ cff_check_points( CFF_Builder* builder,
+ FT_Int count )
+ {
+ return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
+ }
+
+
+ /* add a new point, do not check space */
+ FT_LOCAL_DEF( void )
+ cff_builder_add_point( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag )
+ {
+ FT_Outline* outline = builder->current;
+
+
+ if ( builder->load_points )
+ {
+ FT_Vector* point = outline->points + outline->n_points;
+ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
+
+
+ if ( driver->hinting_engine == FT_HINTING_FREETYPE )
+ {
+ point->x = x >> 16;
+ point->y = y >> 16;
+ }
+ else
+#endif
+ {
+ /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
+ point->x = x >> 10;
+ point->y = y >> 10;
+ }
+ *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
+ }
+
+ outline->n_points++;
+ }
+
+
+ /* check space for a new on-curve point, then add it */
+ FT_LOCAL_DEF( FT_Error )
+ cff_builder_add_point1( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y )
+ {
+ FT_Error error;
+
+
+ error = cff_check_points( builder, 1 );
+ if ( !error )
+ cff_builder_add_point( builder, x, y, 1 );
+
+ return error;
+ }
+
+
+ /* check space for a new contour, then add it */
+ FT_LOCAL_DEF( FT_Error )
+ cff_builder_add_contour( CFF_Builder* builder )
+ {
+ FT_Outline* outline = builder->current;
+ FT_Error error;
+
+
+ if ( !builder->load_points )
+ {
+ outline->n_contours++;
+ return FT_Err_Ok;
+ }
+
+ error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
+ if ( !error )
+ {
+ if ( outline->n_contours > 0 )
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+
+ outline->n_contours++;
+ }
+
+ return error;
+ }
+
+
+ /* if a path was begun, add its first on-curve point */
+ FT_LOCAL_DEF( FT_Error )
+ cff_builder_start_point( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y )
+ {
+ FT_Error error = FT_Err_Ok;
+
+
+ /* test whether we are building a new contour */
+ if ( !builder->path_begun )
+ {
+ builder->path_begun = 1;
+ error = cff_builder_add_contour( builder );
+ if ( !error )
+ error = cff_builder_add_point1( builder, x, y );
+ }
+
+ return error;
+ }
+
+
+ /* close the current contour */
+ FT_LOCAL_DEF( void )
+ cff_builder_close_contour( CFF_Builder* builder )
+ {
+ FT_Outline* outline = builder->current;
+ FT_Int first;
+
+
+ if ( !outline )
+ return;
+
+ first = outline->n_contours <= 1
+ ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+ /* We must not include the last point in the path if it */
+ /* is located on the first point. */
+ if ( outline->n_points > 1 )
+ {
+ FT_Vector* p1 = outline->points + first;
+ FT_Vector* p2 = outline->points + outline->n_points - 1;
+ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
+
+
+ /* `delete' last point only if it coincides with the first */
+ /* point and if it is not a control point (which can happen). */
+ if ( p1->x == p2->x && p1->y == p2->y )
+ if ( *control == FT_CURVE_TAG_ON )
+ outline->n_points--;
+ }
+
+ if ( outline->n_contours > 0 )
+ {
+ /* Don't add contours only consisting of one point, i.e., */
+ /* check whether begin point and last point are the same. */
+ if ( first == outline->n_points - 1 )
+ {
+ outline->n_contours--;
+ outline->n_points--;
+ }
+ else
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+ }
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** PS BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* ps_builder_init */
+ /* */
+ /* <Description> */
+ /* Initializes a given glyph builder. */
+ /* */
+ /* <InOut> */
+ /* builder :: A pointer to the glyph builder to initialize. */
+ /* */
+ /* <Input> */
+ /* face :: The current face object. */
+ /* */
+ /* size :: The current size object. */
+ /* */
+ /* glyph :: The current glyph object. */
+ /* */
+ /* hinting :: Whether hinting should be applied. */
+ /* */
+ FT_LOCAL_DEF( void )
+ ps_builder_init( PS_Builder* ps_builder,
+ void* builder,
+ FT_Bool is_t1 )
+ {
+ FT_ZERO( ps_builder );
+
+ if ( is_t1 )
+ {
+ T1_Builder t1builder = (T1_Builder)builder;
+
+
+ ps_builder->memory = t1builder->memory;
+ ps_builder->face = (FT_Face)t1builder->face;
+ ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
+ ps_builder->loader = t1builder->loader;
+ ps_builder->base = t1builder->base;
+ ps_builder->current = t1builder->current;
+
+ ps_builder->pos_x = &t1builder->pos_x;
+ ps_builder->pos_y = &t1builder->pos_y;
+
+ ps_builder->left_bearing = &t1builder->left_bearing;
+ ps_builder->advance = &t1builder->advance;
+
+ ps_builder->bbox = &t1builder->bbox;
+ ps_builder->path_begun = 0;
+ ps_builder->load_points = t1builder->load_points;
+ ps_builder->no_recurse = t1builder->no_recurse;
+
+ ps_builder->metrics_only = t1builder->metrics_only;
+ }
+ else
+ {
+ CFF_Builder* cffbuilder = (CFF_Builder*)builder;
+
+
+ ps_builder->memory = cffbuilder->memory;
+ ps_builder->face = (FT_Face)cffbuilder->face;
+ ps_builder->glyph = cffbuilder->glyph;
+ ps_builder->loader = cffbuilder->loader;
+ ps_builder->base = cffbuilder->base;
+ ps_builder->current = cffbuilder->current;
+
+ ps_builder->pos_x = &cffbuilder->pos_x;
+ ps_builder->pos_y = &cffbuilder->pos_y;
+
+ ps_builder->left_bearing = &cffbuilder->left_bearing;
+ ps_builder->advance = &cffbuilder->advance;
+
+ ps_builder->bbox = &cffbuilder->bbox;
+ ps_builder->path_begun = cffbuilder->path_begun;
+ ps_builder->load_points = cffbuilder->load_points;
+ ps_builder->no_recurse = cffbuilder->no_recurse;
+
+ ps_builder->metrics_only = cffbuilder->metrics_only;
+ }
+
+ ps_builder->is_t1 = is_t1;
+ ps_builder->funcs = ps_builder_funcs;
+ }
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* ps_builder_done */
+ /* */
+ /* <Description> */
+ /* Finalizes a given glyph builder. Its contents can still be used */
+ /* after the call, but the function saves important information */
+ /* within the corresponding glyph slot. */
+ /* */
+ /* <Input> */
+ /* builder :: A pointer to the glyph builder to finalize. */
+ /* */
+ FT_LOCAL_DEF( void )
+ ps_builder_done( PS_Builder* builder )
+ {
+ CFF_GlyphSlot glyph = builder->glyph;
+
+
+ if ( glyph )
+ glyph->root.outline = *builder->base;
+ }
+
+
+ /* check that there is enough space for `count' more points */
+ FT_LOCAL_DEF( FT_Error )
+ ps_builder_check_points( PS_Builder* builder,
+ FT_Int count )
+ {
+ return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
+ }
+
+
+ /* add a new point, do not check space */
+ FT_LOCAL_DEF( void )
+ ps_builder_add_point( PS_Builder* builder,
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag )
+ {
+ FT_Outline* outline = builder->current;
+
+
+ if ( builder->load_points )
+ {
+ FT_Vector* point = outline->points + outline->n_points;
+ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
+
+
+ if ( !builder->is_t1 &&
+ driver->hinting_engine == FT_HINTING_FREETYPE )
+ {
+ point->x = x >> 16;
+ point->y = y >> 16;
+ }
+ else
+#endif
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
+#endif
+ if ( builder->is_t1 &&
+ driver->hinting_engine == FT_HINTING_FREETYPE )
+ {
+ point->x = FIXED_TO_INT( x );
+ point->y = FIXED_TO_INT( y );
+ }
+ else
+#endif
+ {
+ /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
+ point->x = x >> 10;
+ point->y = y >> 10;
+ }
+ *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
+ }
+ outline->n_points++;
+ }
+
+
+ /* check space for a new on-curve point, then add it */
+ FT_LOCAL_DEF( FT_Error )
+ ps_builder_add_point1( PS_Builder* builder,
+ FT_Pos x,
+ FT_Pos y )
+ {
+ FT_Error error;
+
+
+ error = ps_builder_check_points( builder, 1 );
+ if ( !error )
+ ps_builder_add_point( builder, x, y, 1 );
+
+ return error;
+ }
+
+
+ /* check space for a new contour, then add it */
+ FT_LOCAL_DEF( FT_Error )
+ ps_builder_add_contour( PS_Builder* builder )
+ {
+ FT_Outline* outline = builder->current;
+ FT_Error error;
+
+
+ /* this might happen in invalid fonts */
+ if ( !outline )
+ {
+ FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" ));
+ return FT_THROW( Invalid_File_Format );
+ }
+
+ if ( !builder->load_points )
+ {
+ outline->n_contours++;
+ return FT_Err_Ok;
+ }
+
+ error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
+ if ( !error )
+ {
+ if ( outline->n_contours > 0 )
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+
+ outline->n_contours++;
+ }
+
+ return error;
+ }
+
+
+ /* if a path was begun, add its first on-curve point */
+ FT_LOCAL_DEF( FT_Error )
+ ps_builder_start_point( PS_Builder* builder,
+ FT_Pos x,
+ FT_Pos y )
+ {
+ FT_Error error = FT_Err_Ok;
+
+
+ /* test whether we are building a new contour */
+ if ( !builder->path_begun )
+ {
+ builder->path_begun = 1;
+ error = ps_builder_add_contour( builder );
+ if ( !error )
+ error = ps_builder_add_point1( builder, x, y );
+ }
+
+ return error;
+ }
+
+
+ /* close the current contour */
+ FT_LOCAL_DEF( void )
+ ps_builder_close_contour( PS_Builder* builder )
+ {
+ FT_Outline* outline = builder->current;
+ FT_Int first;
+
+
+ if ( !outline )
+ return;
+
+ first = outline->n_contours <= 1
+ ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+ /* in malformed fonts it can happen that a contour was started */
+ /* but no points were added */
+ if ( outline->n_contours && first == outline->n_points )
+ {
+ outline->n_contours--;
+ return;
+ }
+
+ /* We must not include the last point in the path if it */
+ /* is located on the first point. */
+ if ( outline->n_points > 1 )
+ {
+ FT_Vector* p1 = outline->points + first;
+ FT_Vector* p2 = outline->points + outline->n_points - 1;
+ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
+
+
+ /* `delete' last point only if it coincides with the first */
+ /* point and it is not a control point (which can happen). */
+ if ( p1->x == p2->x && p1->y == p2->y )
+ if ( *control == FT_CURVE_TAG_ON )
+ outline->n_points--;
+ }
+
+ if ( outline->n_contours > 0 )
+ {
+ /* Don't add contours only consisting of one point, i.e., */
+ /* check whether the first and the last point is the same. */
+ if ( first == outline->n_points - 1 )
+ {
+ outline->n_contours--;
+ outline->n_points--;
+ }
+ else
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+ }
+ }
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
/***** OTHER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* ps_decoder_init */
+ /* */
+ /* <Description> */
+ /* Creates a wrapper decoder for use in the combined */
+ /* Type 1 / CFF interpreter. */
+ /* */
+ /* <InOut> */
+ /* ps_decoder :: A pointer to the decoder to initialize. */
+ /* */
+ /* <Input> */
+ /* decoder :: A pointer to the original decoder. */
+ /* */
+ /* is_t1 :: Flag indicating Type 1 or CFF */
+ /* */
+ FT_LOCAL_DEF( void )
+ ps_decoder_init( PS_Decoder* ps_decoder,
+ void* decoder,
+ FT_Bool is_t1 )
+ {
+ FT_ZERO( ps_decoder );
+
+ if ( is_t1 )
+ {
+ T1_Decoder t1_decoder = (T1_Decoder)decoder;
+
+
+ ps_builder_init( &ps_decoder->builder,
+ &t1_decoder->builder,
+ is_t1 );
+
+ ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
+ ps_decoder->psnames = t1_decoder->psnames;
+
+ ps_decoder->num_glyphs = t1_decoder->num_glyphs;
+ ps_decoder->glyph_names = t1_decoder->glyph_names;
+ ps_decoder->hint_mode = t1_decoder->hint_mode;
+ ps_decoder->blend = t1_decoder->blend;
+
+ ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs;
+ ps_decoder->locals = t1_decoder->subrs;
+ ps_decoder->locals_len = t1_decoder->subrs_len;
+ ps_decoder->locals_hash = t1_decoder->subrs_hash;
+
+ ps_decoder->buildchar = t1_decoder->buildchar;
+ ps_decoder->len_buildchar = t1_decoder->len_buildchar;
+
+ ps_decoder->lenIV = t1_decoder->lenIV;
+ }
+ else
+ {
+ CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder;
+
+
+ ps_builder_init( &ps_decoder->builder,
+ &cff_decoder->builder,
+ is_t1 );
+
+ ps_decoder->cff = cff_decoder->cff;
+ ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;
+ ps_decoder->current_subfont = cff_decoder->current_subfont;
+
+ ps_decoder->num_globals = cff_decoder->num_globals;
+ ps_decoder->globals = cff_decoder->globals;
+ ps_decoder->globals_bias = cff_decoder->globals_bias;
+ ps_decoder->num_locals = cff_decoder->num_locals;
+ ps_decoder->locals = cff_decoder->locals;
+ ps_decoder->locals_bias = cff_decoder->locals_bias;
+
+ ps_decoder->glyph_width = &cff_decoder->glyph_width;
+ ps_decoder->width_only = cff_decoder->width_only;
+
+ ps_decoder->hint_mode = cff_decoder->hint_mode;
+
+ ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback;
+ ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback;
+ }
+ }
+
+
+ /* Synthesize a SubFont object for Type 1 fonts, for use in the */
+ /* new interpreter to access Private dict data. */
+ FT_LOCAL_DEF( void )
+ t1_make_subfont( FT_Face face,
+ PS_Private priv,
+ CFF_SubFont subfont )
+ {
+ CFF_Private cpriv = &subfont->private_dict;
+ FT_UInt n, count;
+
+
+ FT_ZERO( subfont );
+ FT_ZERO( cpriv );
+
+ count = cpriv->num_blue_values = priv->num_blue_values;
+ for ( n = 0; n < count; n++ )
+ cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
+
+ count = cpriv->num_other_blues = priv->num_other_blues;
+ for ( n = 0; n < count; n++ )
+ cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
+
+ count = cpriv->num_family_blues = priv->num_family_blues;
+ for ( n = 0; n < count; n++ )
+ cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
+
+ count = cpriv->num_family_other_blues = priv->num_family_other_blues;
+ for ( n = 0; n < count; n++ )
+ cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
+
+ cpriv->blue_scale = priv->blue_scale;
+ cpriv->blue_shift = (FT_Pos)priv->blue_shift;
+ cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
+
+ cpriv->standard_width = (FT_Pos)priv->standard_width[0];
+ cpriv->standard_height = (FT_Pos)priv->standard_height[0];
+
+ count = cpriv->num_snap_widths = priv->num_snap_widths;
+ for ( n = 0; n < count; n++ )
+ cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n];
+
+ count = cpriv->num_snap_heights = priv->num_snap_heights;
+ for ( n = 0; n < count; n++ )
+ cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n];
+
+ cpriv->force_bold = priv->force_bold;
+ cpriv->lenIV = priv->lenIV;
+ cpriv->language_group = priv->language_group;
+ cpriv->expansion_factor = priv->expansion_factor;
+
+ cpriv->subfont = subfont;
+
+
+ /* Initialize the random number generator. */
+ if ( face->internal->random_seed != -1 )
+ {
+ /* If we have a face-specific seed, use it. */
+ /* If non-zero, update it to a positive value. */
+ subfont->random = (FT_UInt32)face->internal->random_seed;
+ if ( face->internal->random_seed )
+ {
+ do
+ {
+ face->internal->random_seed = (FT_Int32)cff_random(
+ (FT_UInt32)face->internal->random_seed );
+
+ } while ( face->internal->random_seed < 0 );
+ }
+ }
+ if ( !subfont->random )
+ {
+ FT_UInt32 seed;
+
+
+ /* compute random seed from some memory addresses */
+ seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
+ (FT_Offset)(char*)&face ^
+ (FT_Offset)(char*)&subfont );
+ seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
+ if ( seed == 0 )
+ seed = 0x7384;
+
+ subfont->random = seed;
+ }
+ }
+
+
FT_LOCAL_DEF( void )
t1_decrypt( FT_Byte* buffer,
FT_Offset length,
@@ -1779,4 +2518,16 @@
}
+ FT_LOCAL_DEF( FT_UInt32 )
+ cff_random( FT_UInt32 r )
+ {
+ /* a 32bit version of the `xorshift' algorithm */
+ r ^= r << 13;
+ r ^= r >> 17;
+ r ^= r << 5;
+
+ return r;
+ }
+
+
/* END */
diff --git a/thirdparty/freetype/src/psaux/psobjs.h b/thirdparty/freetype/src/psaux/psobjs.h
index 202e5b2416..8e0fe5fa4c 100644
--- a/thirdparty/freetype/src/psaux/psobjs.h
+++ b/thirdparty/freetype/src/psaux/psobjs.h
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,7 @@
#include <ft2build.h>
#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
FT_BEGIN_HEADER
@@ -193,17 +194,117 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/***** *****/
+ /***** CFF BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ FT_LOCAL( void )
+ cff_builder_init( CFF_Builder* builder,
+ TT_Face face,
+ CFF_Size size,
+ CFF_GlyphSlot glyph,
+ FT_Bool hinting );
+
+ FT_LOCAL( void )
+ cff_builder_done( CFF_Builder* builder );
+
+ FT_LOCAL( FT_Error )
+ cff_check_points( CFF_Builder* builder,
+ FT_Int count );
+
+ FT_LOCAL( void )
+ cff_builder_add_point( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag );
+ FT_LOCAL( FT_Error )
+ cff_builder_add_point1( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y );
+ FT_LOCAL( FT_Error )
+ cff_builder_start_point( CFF_Builder* builder,
+ FT_Pos x,
+ FT_Pos y );
+ FT_LOCAL( void )
+ cff_builder_close_contour( CFF_Builder* builder );
+
+ FT_LOCAL( FT_Error )
+ cff_builder_add_contour( CFF_Builder* builder );
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** PS BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ FT_LOCAL( void )
+ ps_builder_init( PS_Builder* ps_builder,
+ void* builder,
+ FT_Bool is_t1 );
+
+
+ FT_LOCAL( void )
+ ps_builder_done( PS_Builder* builder );
+
+ FT_LOCAL( FT_Error )
+ ps_builder_check_points( PS_Builder* builder,
+ FT_Int count );
+
+ FT_LOCAL( void )
+ ps_builder_add_point( PS_Builder* builder,
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag );
+
+ FT_LOCAL( FT_Error )
+ ps_builder_add_point1( PS_Builder* builder,
+ FT_Pos x,
+ FT_Pos y );
+
+ FT_LOCAL( FT_Error )
+ ps_builder_add_contour( PS_Builder* builder );
+
+ FT_LOCAL( FT_Error )
+ ps_builder_start_point( PS_Builder* builder,
+ FT_Pos x,
+ FT_Pos y );
+
+ FT_LOCAL( void )
+ ps_builder_close_contour( PS_Builder* builder );
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
/***** OTHER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
FT_LOCAL( void )
+ ps_decoder_init( PS_Decoder* ps_decoder,
+ void* decoder,
+ FT_Bool is_t1 );
+
+ FT_LOCAL( void )
+ t1_make_subfont( FT_Face face,
+ PS_Private priv,
+ CFF_SubFont subfont );
+
+ FT_LOCAL( void )
t1_decrypt( FT_Byte* buffer,
FT_Offset length,
FT_UShort seed );
+ FT_LOCAL( FT_UInt32 )
+ cff_random( FT_UInt32 r );
+
+
FT_END_HEADER
#endif /* PSOBJS_H_ */
diff --git a/thirdparty/freetype/src/psaux/psread.c b/thirdparty/freetype/src/psaux/psread.c
new file mode 100644
index 0000000000..719863ce17
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psread.c
@@ -0,0 +1,112 @@
+/***************************************************************************/
+/* */
+/* psread.c */
+/* */
+/* Adobe's code for stream handling (body). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+
+#include "psglue.h"
+
+#include "pserror.h"
+
+
+ /* Define CF2_IO_FAIL as 1 to enable random errors and random */
+ /* value errors in I/O. */
+#define CF2_IO_FAIL 0
+
+
+#if CF2_IO_FAIL
+
+ /* set the .00 value to a nonzero probability */
+ static int
+ randomError2( void )
+ {
+ /* for region buffer ReadByte (interp) function */
+ return (double)rand() / RAND_MAX < .00;
+ }
+
+ /* set the .00 value to a nonzero probability */
+ static CF2_Int
+ randomValue()
+ {
+ return (double)rand() / RAND_MAX < .00 ? rand() : 0;
+ }
+
+#endif /* CF2_IO_FAIL */
+
+
+ /* Region Buffer */
+ /* */
+ /* Can be constructed from a copied buffer managed by */
+ /* `FCM_getDatablock'. */
+ /* Reads bytes with check for end of buffer. */
+
+ /* reading past the end of the buffer sets error and returns zero */
+ FT_LOCAL_DEF( CF2_Int )
+ cf2_buf_readByte( CF2_Buffer buf )
+ {
+ if ( buf->ptr < buf->end )
+ {
+#if CF2_IO_FAIL
+ if ( randomError2() )
+ {
+ CF2_SET_ERROR( buf->error, Invalid_Stream_Operation );
+ return 0;
+ }
+
+ return *(buf->ptr)++ + randomValue();
+#else
+ return *(buf->ptr)++;
+#endif
+ }
+ else
+ {
+ CF2_SET_ERROR( buf->error, Invalid_Stream_Operation );
+ return 0;
+ }
+ }
+
+
+ /* note: end condition can occur without error */
+ FT_LOCAL_DEF( FT_Bool )
+ cf2_buf_isEnd( CF2_Buffer buf )
+ {
+ return (FT_Bool)( buf->ptr >= buf->end );
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psread.h b/thirdparty/freetype/src/psaux/psread.h
new file mode 100644
index 0000000000..464b29ba74
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psread.h
@@ -0,0 +1,68 @@
+/***************************************************************************/
+/* */
+/* psread.h */
+/* */
+/* Adobe's code for stream handling (specification). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSREAD_H_
+#define PSREAD_H_
+
+
+FT_BEGIN_HEADER
+
+
+ typedef struct CF2_BufferRec_
+ {
+ FT_Error* error;
+ const FT_Byte* start;
+ const FT_Byte* end;
+ const FT_Byte* ptr;
+
+ } CF2_BufferRec, *CF2_Buffer;
+
+
+ FT_LOCAL( CF2_Int )
+ cf2_buf_readByte( CF2_Buffer buf );
+ FT_LOCAL( FT_Bool )
+ cf2_buf_isEnd( CF2_Buffer buf );
+
+
+FT_END_HEADER
+
+
+#endif /* PSREAD_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psstack.c b/thirdparty/freetype/src/psaux/psstack.c
new file mode 100644
index 0000000000..69d063349a
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psstack.c
@@ -0,0 +1,328 @@
+/***************************************************************************/
+/* */
+/* psstack.c */
+/* */
+/* Adobe's code for emulating a CFF stack (body). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#include "psft.h"
+#include FT_INTERNAL_DEBUG_H
+
+#include "psglue.h"
+#include "psfont.h"
+#include "psstack.h"
+
+#include "pserror.h"
+
+
+ /* Allocate and initialize an instance of CF2_Stack. */
+ /* Note: This function returns NULL on error (does not set */
+ /* `error'). */
+ FT_LOCAL_DEF( CF2_Stack )
+ cf2_stack_init( FT_Memory memory,
+ FT_Error* e,
+ FT_UInt stackSize )
+ {
+ FT_Error error = FT_Err_Ok; /* for FT_NEW */
+
+ CF2_Stack stack = NULL;
+
+
+ if ( !FT_NEW( stack ) )
+ {
+ /* initialize the structure; FT_NEW zeroes it */
+ stack->memory = memory;
+ stack->error = e;
+ }
+
+ /* allocate the stack buffer */
+ if ( FT_NEW_ARRAY( stack->buffer, stackSize ) )
+ {
+ FT_FREE( stack );
+ return NULL;
+ }
+
+ stack->stackSize = stackSize;
+ stack->top = stack->buffer; /* empty stack */
+
+ return stack;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_stack_free( CF2_Stack stack )
+ {
+ if ( stack )
+ {
+ FT_Memory memory = stack->memory;
+
+ /* free the buffer */
+ FT_FREE( stack->buffer );
+
+ /* free the main structure */
+ FT_FREE( stack );
+ }
+ }
+
+
+ FT_LOCAL_DEF( CF2_UInt )
+ cf2_stack_count( CF2_Stack stack )
+ {
+ return (CF2_UInt)( stack->top - stack->buffer );
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_stack_pushInt( CF2_Stack stack,
+ CF2_Int val )
+ {
+ if ( stack->top == stack->buffer + stack->stackSize )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Overflow );
+ return; /* stack overflow */
+ }
+
+ stack->top->u.i = val;
+ stack->top->type = CF2_NumberInt;
+ stack->top++;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_stack_pushFixed( CF2_Stack stack,
+ CF2_Fixed val )
+ {
+ if ( stack->top == stack->buffer + stack->stackSize )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Overflow );
+ return; /* stack overflow */
+ }
+
+ stack->top->u.r = val;
+ stack->top->type = CF2_NumberFixed;
+ stack->top++;
+ }
+
+
+ /* this function is only allowed to pop an integer type */
+ FT_LOCAL_DEF( CF2_Int )
+ cf2_stack_popInt( CF2_Stack stack )
+ {
+ if ( stack->top == stack->buffer )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Underflow );
+ return 0; /* underflow */
+ }
+ if ( stack->top[-1].type != CF2_NumberInt )
+ {
+ CF2_SET_ERROR( stack->error, Syntax_Error );
+ return 0; /* type mismatch */
+ }
+
+ stack->top--;
+
+ return stack->top->u.i;
+ }
+
+
+ /* Note: type mismatch is silently cast */
+ /* TODO: check this */
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_stack_popFixed( CF2_Stack stack )
+ {
+ if ( stack->top == stack->buffer )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Underflow );
+ return cf2_intToFixed( 0 ); /* underflow */
+ }
+
+ stack->top--;
+
+ switch ( stack->top->type )
+ {
+ case CF2_NumberInt:
+ return cf2_intToFixed( stack->top->u.i );
+ case CF2_NumberFrac:
+ return cf2_fracToFixed( stack->top->u.f );
+ default:
+ return stack->top->u.r;
+ }
+ }
+
+
+ /* Note: type mismatch is silently cast */
+ /* TODO: check this */
+ FT_LOCAL_DEF( CF2_Fixed )
+ cf2_stack_getReal( CF2_Stack stack,
+ CF2_UInt idx )
+ {
+ FT_ASSERT( cf2_stack_count( stack ) <= stack->stackSize );
+
+ if ( idx >= cf2_stack_count( stack ) )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Overflow );
+ return cf2_intToFixed( 0 ); /* bounds error */
+ }
+
+ switch ( stack->buffer[idx].type )
+ {
+ case CF2_NumberInt:
+ return cf2_intToFixed( stack->buffer[idx].u.i );
+ case CF2_NumberFrac:
+ return cf2_fracToFixed( stack->buffer[idx].u.f );
+ default:
+ return stack->buffer[idx].u.r;
+ }
+ }
+
+
+ /* provide random access to stack */
+ FT_LOCAL_DEF( void )
+ cf2_stack_setReal( CF2_Stack stack,
+ CF2_UInt idx,
+ CF2_Fixed val )
+ {
+ if ( idx > cf2_stack_count( stack ) )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Overflow );
+ return;
+ }
+
+ stack->buffer[idx].u.r = val;
+ stack->buffer[idx].type = CF2_NumberFixed;
+ }
+
+
+ /* discard (pop) num values from stack */
+ FT_LOCAL_DEF( void )
+ cf2_stack_pop( CF2_Stack stack,
+ CF2_UInt num )
+ {
+ if ( num > cf2_stack_count( stack ) )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Underflow );
+ return;
+ }
+ stack->top -= num;
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_stack_roll( CF2_Stack stack,
+ CF2_Int count,
+ CF2_Int shift )
+ {
+ /* we initialize this variable to avoid compiler warnings */
+ CF2_StackNumber last = { { 0 }, CF2_NumberInt };
+
+ CF2_Int start_idx, idx, i;
+
+
+ if ( count < 2 )
+ return; /* nothing to do (values 0 and 1), or undefined value */
+
+ if ( (CF2_UInt)count > cf2_stack_count( stack ) )
+ {
+ CF2_SET_ERROR( stack->error, Stack_Overflow );
+ return;
+ }
+
+ if ( shift < 0 )
+ shift = -( ( -shift ) % count );
+ else
+ shift %= count;
+
+ if ( shift == 0 )
+ return; /* nothing to do */
+
+ /* We use the following algorithm to do the rolling, */
+ /* which needs two temporary variables only. */
+ /* */
+ /* Example: */
+ /* */
+ /* count = 8 */
+ /* shift = 2 */
+ /* */
+ /* stack indices before roll: 7 6 5 4 3 2 1 0 */
+ /* stack indices after roll: 1 0 7 6 5 4 3 2 */
+ /* */
+ /* The value of index 0 gets moved to index 2, while */
+ /* the old value of index 2 gets moved to index 4, */
+ /* and so on. We thus have the following copying */
+ /* chains for shift value 2. */
+ /* */
+ /* 0 -> 2 -> 4 -> 6 -> 0 */
+ /* 1 -> 3 -> 5 -> 7 -> 1 */
+ /* */
+ /* If `count' and `shift' are incommensurable, we */
+ /* have a single chain only. Otherwise, increase */
+ /* the start index by 1 after the first chain, then */
+ /* do the next chain until all elements in all */
+ /* chains are handled. */
+
+ start_idx = -1;
+ idx = -1;
+ for ( i = 0; i < count; i++ )
+ {
+ CF2_StackNumber tmp;
+
+
+ if ( start_idx == idx )
+ {
+ start_idx++;
+ idx = start_idx;
+ last = stack->buffer[idx];
+ }
+
+ idx += shift;
+ if ( idx >= count )
+ idx -= count;
+ else if ( idx < 0 )
+ idx += count;
+
+ tmp = stack->buffer[idx];
+ stack->buffer[idx] = last;
+ last = tmp;
+ }
+ }
+
+
+ FT_LOCAL_DEF( void )
+ cf2_stack_clear( CF2_Stack stack )
+ {
+ stack->top = stack->buffer;
+ }
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/psstack.h b/thirdparty/freetype/src/psaux/psstack.h
new file mode 100644
index 0000000000..38f7b41c68
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/psstack.h
@@ -0,0 +1,121 @@
+/***************************************************************************/
+/* */
+/* psstack.h */
+/* */
+/* Adobe's code for emulating a CFF stack (specification). */
+/* */
+/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSSTACK_H_
+#define PSSTACK_H_
+
+
+FT_BEGIN_HEADER
+
+
+ /* CFF operand stack; specified maximum of 48 or 192 values */
+ typedef struct CF2_StackNumber_
+ {
+ union
+ {
+ CF2_Fixed r; /* 16.16 fixed point */
+ CF2_Frac f; /* 2.30 fixed point (for font matrix) */
+ CF2_Int i;
+ } u;
+
+ CF2_NumberType type;
+
+ } CF2_StackNumber;
+
+
+ typedef struct CF2_StackRec_
+ {
+ FT_Memory memory;
+ FT_Error* error;
+ CF2_StackNumber* buffer;
+ CF2_StackNumber* top;
+ FT_UInt stackSize;
+
+ } CF2_StackRec, *CF2_Stack;
+
+
+ FT_LOCAL( CF2_Stack )
+ cf2_stack_init( FT_Memory memory,
+ FT_Error* error,
+ FT_UInt stackSize );
+ FT_LOCAL( void )
+ cf2_stack_free( CF2_Stack stack );
+
+ FT_LOCAL( CF2_UInt )
+ cf2_stack_count( CF2_Stack stack );
+
+ FT_LOCAL( void )
+ cf2_stack_pushInt( CF2_Stack stack,
+ CF2_Int val );
+ FT_LOCAL( void )
+ cf2_stack_pushFixed( CF2_Stack stack,
+ CF2_Fixed val );
+
+ FT_LOCAL( CF2_Int )
+ cf2_stack_popInt( CF2_Stack stack );
+ FT_LOCAL( CF2_Fixed )
+ cf2_stack_popFixed( CF2_Stack stack );
+
+ FT_LOCAL( CF2_Fixed )
+ cf2_stack_getReal( CF2_Stack stack,
+ CF2_UInt idx );
+ FT_LOCAL( void )
+ cf2_stack_setReal( CF2_Stack stack,
+ CF2_UInt idx,
+ CF2_Fixed val );
+
+ FT_LOCAL( void )
+ cf2_stack_pop( CF2_Stack stack,
+ CF2_UInt num );
+
+ FT_LOCAL( void )
+ cf2_stack_roll( CF2_Stack stack,
+ CF2_Int count,
+ CF2_Int idx );
+
+ FT_LOCAL( void )
+ cf2_stack_clear( CF2_Stack stack );
+
+
+FT_END_HEADER
+
+
+#endif /* PSSTACK_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/pstypes.h b/thirdparty/freetype/src/psaux/pstypes.h
new file mode 100644
index 0000000000..dfbaa3d475
--- /dev/null
+++ b/thirdparty/freetype/src/psaux/pstypes.h
@@ -0,0 +1,78 @@
+/***************************************************************************/
+/* */
+/* pstypes.h */
+/* */
+/* Adobe's code for defining data types (specification only). */
+/* */
+/* Copyright 2011-2013 Adobe Systems Incorporated. */
+/* */
+/* This software, and all works of authorship, whether in source or */
+/* object code form as indicated by the copyright notice(s) included */
+/* herein (collectively, the "Work") is made available, and may only be */
+/* used, modified, and distributed under the FreeType Project License, */
+/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
+/* FreeType Project License, each contributor to the Work hereby grants */
+/* to any individual or legal entity exercising permissions granted by */
+/* the FreeType Project License and this section (hereafter, "You" or */
+/* "Your") 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. */
+/* */
+/* By using, modifying, or distributing the Work you indicate that you */
+/* have read and understood the terms and conditions of the */
+/* FreeType Project License as well as those provided in this section, */
+/* and you accept them fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef PSTYPES_H_
+#define PSTYPES_H_
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*
+ * The data models that we expect to support are as follows:
+ *
+ * name char short int long long-long pointer example
+ * -----------------------------------------------------
+ * ILP32 8 16 32 32 64* 32 32-bit MacOS, x86
+ * LLP64 8 16 32 32 64 64 x64
+ * LP64 8 16 32 64 64 64 64-bit MacOS
+ *
+ * *) type may be supported by emulation on a 32-bit architecture
+ *
+ */
+
+
+ /* integers at least 32 bits wide */
+#define CF2_UInt FT_UFast
+#define CF2_Int FT_Fast
+
+
+ /* fixed-float numbers */
+ typedef FT_Int32 CF2_F16Dot16;
+
+
+FT_END_HEADER
+
+
+#endif /* PSTYPES_H_ */
+
+
+/* END */
diff --git a/thirdparty/freetype/src/psaux/rules.mk b/thirdparty/freetype/src/psaux/rules.mk
index 542ae12d2b..a87bfe9687 100644
--- a/thirdparty/freetype/src/psaux/rules.mk
+++ b/thirdparty/freetype/src/psaux/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -33,12 +33,25 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \
$(PSAUX_DIR)/t1cmap.c \
$(PSAUX_DIR)/afmparse.c \
$(PSAUX_DIR)/psconv.c \
- $(PSAUX_DIR)/psauxmod.c
+ $(PSAUX_DIR)/psauxmod.c \
+ $(PSAUX_DIR)/psarrst.c \
+ $(PSAUX_DIR)/psblues.c \
+ $(PSAUX_DIR)/pserror.c \
+ $(PSAUX_DIR)/psfont.c \
+ $(PSAUX_DIR)/psft.c \
+ $(PSAUX_DIR)/pshints.c \
+ $(PSAUX_DIR)/psintrp.c \
+ $(PSAUX_DIR)/psread.c \
+ $(PSAUX_DIR)/psstack.c \
+ $(PSAUX_DIR)/cffdecode.c
# PSAUX driver headers
#
PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \
- $(PSAUX_DIR)/psauxerr.h
+ $(PSAUX_DIR)/psauxerr.h \
+ $(PSAUX_DIR)/psfixed.h \
+ $(PSAUX_DIR)/psglue.h \
+ $(PSAUX_DIR)/pstypes.h
# PSAUX driver object(s)
diff --git a/thirdparty/freetype/src/psaux/t1cmap.c b/thirdparty/freetype/src/psaux/t1cmap.c
index 45b713eb7b..112a7892ba 100644
--- a/thirdparty/freetype/src/psaux/t1cmap.c
+++ b/thirdparty/freetype/src/psaux/t1cmap.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 character map support (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/t1cmap.h b/thirdparty/freetype/src/psaux/t1cmap.h
index 7870245a3a..4308e31d2d 100644
--- a/thirdparty/freetype/src/psaux/t1cmap.h
+++ b/thirdparty/freetype/src/psaux/t1cmap.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 character map support (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psaux/t1decode.c b/thirdparty/freetype/src/psaux/t1decode.c
index 1250b53f5d..6ad145661f 100644
--- a/thirdparty/freetype/src/psaux/t1decode.c
+++ b/thirdparty/freetype/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -112,6 +112,56 @@
/*************************************************************************/
/* */
/* <Function> */
+ /* t1_lookup_glyph_by_stdcharcode_ps */
+ /* */
+ /* <Description> */
+ /* Looks up a given glyph by its StandardEncoding charcode. Used to */
+ /* implement the SEAC Type 1 operator in the Adobe engine */
+ /* */
+ /* <Input> */
+ /* face :: The current face object. */
+ /* */
+ /* charcode :: The character code to look for. */
+ /* */
+ /* <Return> */
+ /* A glyph index in the font face. Returns -1 if the corresponding */
+ /* glyph wasn't found. */
+ /* */
+ FT_LOCAL_DEF( FT_Int )
+ t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder,
+ FT_Int charcode )
+ {
+ FT_UInt n;
+ const FT_String* glyph_name;
+ FT_Service_PsCMaps psnames = decoder->psnames;
+
+
+ /* check range of standard char code */
+ if ( charcode < 0 || charcode > 255 )
+ return -1;
+
+ glyph_name = psnames->adobe_std_strings(
+ psnames->adobe_std_encoding[charcode]);
+
+ for ( n = 0; n < decoder->num_glyphs; n++ )
+ {
+ FT_String* name = (FT_String*)decoder->glyph_names[n];
+
+
+ if ( name &&
+ name[0] == glyph_name[0] &&
+ ft_strcmp( name, glyph_name ) == 0 )
+ return (FT_Int)n;
+ }
+
+ return -1;
+ }
+
+
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ /*************************************************************************/
+ /* */
+ /* <Function> */
/* t1_lookup_glyph_by_stdcharcode */
/* */
/* <Description> */
@@ -158,6 +208,15 @@
}
+ /* parse a single Type 1 glyph */
+ FT_LOCAL_DEF( FT_Error )
+ t1_decoder_parse_glyph( T1_Decoder decoder,
+ FT_UInt glyph )
+ {
+ return decoder->parse_callback( decoder, glyph );
+ }
+
+
/*************************************************************************/
/* */
/* <Function> */
@@ -1579,14 +1638,286 @@
return FT_THROW( Stack_Underflow );
}
+#else /* T1_CONFIG_OPTION_OLD_ENGINE */
- /* parse a single Type 1 glyph */
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* t1_decoder_parse_metrics */
+ /* */
+ /* <Description> */
+ /* Parses a given Type 1 charstrings program to extract width */
+ /* */
+ /* <Input> */
+ /* decoder :: The current Type 1 decoder. */
+ /* */
+ /* charstring_base :: The base address of the charstring stream. */
+ /* */
+ /* charstring_len :: The length in bytes of the charstring stream. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
FT_LOCAL_DEF( FT_Error )
- t1_decoder_parse_glyph( T1_Decoder decoder,
- FT_UInt glyph )
+ t1_decoder_parse_metrics( T1_Decoder decoder,
+ FT_Byte* charstring_base,
+ FT_UInt charstring_len )
{
- return decoder->parse_callback( decoder, glyph );
+ T1_Decoder_Zone zone;
+ FT_Byte* ip;
+ FT_Byte* limit;
+ T1_Builder builder = &decoder->builder;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_Bool bol = TRUE;
+#endif
+
+
+ /* First of all, initialize the decoder */
+ decoder->top = decoder->stack;
+ decoder->zone = decoder->zones;
+ zone = decoder->zones;
+
+ builder->parse_state = T1_Parse_Start;
+
+ FT_TRACE4(( "\n"
+ "Start charstring: get width\n" ));
+
+ zone->base = charstring_base;
+ limit = zone->limit = charstring_base + charstring_len;
+ ip = zone->cursor = zone->base;
+
+ /* now, execute loop */
+ while ( ip < limit )
+ {
+ FT_Long* top = decoder->top;
+ T1_Operator op = op_none;
+ FT_Int32 value = 0;
+
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( bol )
+ {
+ FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+ bol = FALSE;
+ }
+#endif
+
+ /*********************************************************************/
+ /* */
+ /* Decode operator or operand */
+ /* */
+ /* */
+
+ /* first of all, decompress operator or value */
+ switch ( *ip++ )
+ {
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 14:
+ case 15:
+ case 21:
+ case 22:
+ case 30:
+ case 31:
+ goto No_Width;
+
+ case 13:
+ op = op_hsbw;
+ break;
+
+ case 12:
+ if ( ip >= limit )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " invalid escape (12+EOF)\n" ));
+ goto Syntax_Error;
+ }
+
+ switch ( *ip++ )
+ {
+ case 7:
+ op = op_sbw;
+ break;
+
+ default:
+ goto No_Width;
+ }
+ break;
+
+ case 255: /* four bytes integer */
+ if ( ip + 4 > limit )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " unexpected EOF in integer\n" ));
+ goto Syntax_Error;
+ }
+
+ value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
+ ( (FT_UInt32)ip[1] << 16 ) |
+ ( (FT_UInt32)ip[2] << 8 ) |
+ (FT_UInt32)ip[3] );
+ ip += 4;
+
+ /* According to the specification, values > 32000 or < -32000 must */
+ /* be followed by a `div' operator to make the result be in the */
+ /* range [-32000;32000]. We expect that the second argument of */
+ /* `div' is not a large number. Additionally, we don't handle */
+ /* stuff like `<large1> <large2> <num> div <num> div' or */
+ /* <large1> <large2> <num> div div'. This is probably not allowed */
+ /* anyway. */
+ if ( value > 32000 || value < -32000 )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " large integer found for width\n" ));
+ goto Syntax_Error;
+ }
+ else
+ {
+ value = (FT_Int32)( (FT_UInt32)value << 16 );
+ }
+
+ break;
+
+ default:
+ if ( ip[-1] >= 32 )
+ {
+ if ( ip[-1] < 247 )
+ value = (FT_Int32)ip[-1] - 139;
+ else
+ {
+ if ( ++ip > limit )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " unexpected EOF in integer\n" ));
+ goto Syntax_Error;
+ }
+
+ if ( ip[-2] < 251 )
+ value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108;
+ else
+ value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 );
+ }
+
+ value = (FT_Int32)( (FT_UInt32)value << 16 );
+ }
+ else
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " invalid byte (%d)\n", ip[-1] ));
+ goto Syntax_Error;
+ }
+ }
+
+ /*********************************************************************/
+ /* */
+ /* Push value on stack, or process operator */
+ /* */
+ /* */
+ if ( op == op_none )
+ {
+ if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics: stack overflow\n" ));
+ goto Syntax_Error;
+ }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE4(( " %d", value / 65536 ));
+#endif
+
+ *top++ = value;
+ decoder->top = top;
+ }
+ else /* general operator */
+ {
+ FT_Int num_args = t1_args_count[op];
+
+
+ FT_ASSERT( num_args >= 0 );
+
+ if ( top - decoder->stack < num_args )
+ goto Stack_Underflow;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+ if ( top - decoder->stack != num_args )
+ FT_TRACE0(( "t1_decoder_parse_metrics:"
+ " too much operands on the stack"
+ " (seen %d, expected %d)\n",
+ top - decoder->stack, num_args ));
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+ top -= num_args;
+
+ switch ( op )
+ {
+ case op_hsbw:
+ FT_TRACE4(( " hsbw" ));
+
+ builder->parse_state = T1_Parse_Have_Width;
+
+ builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
+ top[0] );
+
+ builder->advance.x = top[1];
+ builder->advance.y = 0;
+
+ /* we only want to compute the glyph's metrics */
+ /* (lsb + advance width), not load the rest of */
+ /* it; so exit immediately */
+ return FT_Err_Ok;
+
+ case op_sbw:
+ FT_TRACE4(( " sbw" ));
+
+ builder->parse_state = T1_Parse_Have_Width;
+
+ builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
+ top[0] );
+ builder->left_bearing.y = ADD_LONG( builder->left_bearing.y,
+ top[1] );
+
+ builder->advance.x = top[2];
+ builder->advance.y = top[3];
+
+ /* we only want to compute the glyph's metrics */
+ /* (lsb + advance width), not load the rest of */
+ /* it; so exit immediately */
+ return FT_Err_Ok;
+
+ default:
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " unhandled opcode %d\n", op ));
+ goto Syntax_Error;
+ }
+
+ } /* general operator processing */
+
+ } /* while ip < limit */
+
+ FT_TRACE4(( "..end..\n\n" ));
+
+ No_Width:
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " no width, found op %d instead\n",
+ ip[-1] ));
+ Syntax_Error:
+ return FT_THROW( Syntax_Error );
+
+ Stack_Underflow:
+ return FT_THROW( Stack_Underflow );
}
+#endif /* T1_CONFIG_OPTION_OLD_ENGINE */
/* initialize T1 decoder */
@@ -1641,7 +1972,16 @@
FT_LOCAL_DEF( void )
t1_decoder_done( T1_Decoder decoder )
{
+ FT_Memory memory = decoder->builder.memory;
+
+
t1_builder_done( &decoder->builder );
+
+ if ( decoder->cf2_instance.finalizer )
+ {
+ decoder->cf2_instance.finalizer( decoder->cf2_instance.data );
+ FT_FREE( decoder->cf2_instance.data );
+ }
}
diff --git a/thirdparty/freetype/src/psaux/t1decode.h b/thirdparty/freetype/src/psaux/t1decode.h
index 12c27de775..1d9718d678 100644
--- a/thirdparty/freetype/src/psaux/t1decode.h
+++ b/thirdparty/freetype/src/psaux/t1decode.h
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (specification). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,7 +31,11 @@ FT_BEGIN_HEADER
FT_CALLBACK_TABLE
const T1_Decoder_FuncsRec t1_decoder_funcs;
+ FT_LOCAL( FT_Int )
+ t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder,
+ FT_Int charcode );
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
FT_LOCAL( FT_Error )
t1_decoder_parse_glyph( T1_Decoder decoder,
FT_UInt glyph_index );
@@ -40,6 +44,12 @@ FT_BEGIN_HEADER
t1_decoder_parse_charstrings( T1_Decoder decoder,
FT_Byte* base,
FT_UInt len );
+#else
+ FT_LOCAL( FT_Error )
+ t1_decoder_parse_metrics( T1_Decoder decoder,
+ FT_Byte* charstring_base,
+ FT_UInt charstring_len );
+#endif
FT_LOCAL( FT_Error )
t1_decoder_init( T1_Decoder decoder,
diff --git a/thirdparty/freetype/src/pshinter/module.mk b/thirdparty/freetype/src/pshinter/module.mk
index 77e35c4c10..06707be3b4 100644
--- a/thirdparty/freetype/src/pshinter/module.mk
+++ b/thirdparty/freetype/src/pshinter/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/pshinter/pshalgo.c b/thirdparty/freetype/src/pshinter/pshalgo.c
index 9ad1a3a02a..b98077c62e 100644
--- a/thirdparty/freetype/src/pshinter/pshalgo.c
+++ b/thirdparty/freetype/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (body). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -26,7 +26,7 @@
#undef FT_COMPONENT
-#define FT_COMPONENT trace_pshalgo2
+#define FT_COMPONENT trace_pshalgo
#ifdef DEBUG_HINTER
diff --git a/thirdparty/freetype/src/pshinter/pshalgo.h b/thirdparty/freetype/src/pshinter/pshalgo.h
index 62e97d152b..c50683fbec 100644
--- a/thirdparty/freetype/src/pshinter/pshalgo.h
+++ b/thirdparty/freetype/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (specification). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshglob.c b/thirdparty/freetype/src/pshinter/pshglob.c
index c68770c73a..accc04921d 100644
--- a/thirdparty/freetype/src/pshinter/pshglob.c
+++ b/thirdparty/freetype/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
/* PostScript hinter global hinting management (body). */
/* Inspired by the new auto-hinter module. */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -227,8 +227,8 @@
}
- /* Re-read blue zones from the original fonts and store them into out */
- /* private structure. This function re-orders, sanitizes and */
+ /* Re-read blue zones from the original fonts and store them into our */
+ /* private structure. This function re-orders, sanitizes, and */
/* fuzz-expands the zones as well. */
static void
psh_blues_set_zones( PSH_Blues target,
diff --git a/thirdparty/freetype/src/pshinter/pshglob.h b/thirdparty/freetype/src/pshinter/pshglob.h
index 8801cbada4..cf80bf40e6 100644
--- a/thirdparty/freetype/src/pshinter/pshglob.h
+++ b/thirdparty/freetype/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinter global hinting management. */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshinter.c b/thirdparty/freetype/src/pshinter/pshinter.c
index 13e07e1485..0eedac452d 100644
--- a/thirdparty/freetype/src/pshinter/pshinter.c
+++ b/thirdparty/freetype/src/pshinter/pshinter.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PostScript Hinting module */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshmod.c b/thirdparty/freetype/src/pshinter/pshmod.c
index 860dc0ae82..0b8f6f99b8 100644
--- a/thirdparty/freetype/src/pshinter/pshmod.c
+++ b/thirdparty/freetype/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PostScript hinter module implementation (body). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshmod.h b/thirdparty/freetype/src/pshinter/pshmod.h
index 1d2b40fa13..556de2fbc0 100644
--- a/thirdparty/freetype/src/pshinter/pshmod.h
+++ b/thirdparty/freetype/src/pshinter/pshmod.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinter module interface (specification). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshnterr.h b/thirdparty/freetype/src/pshinter/pshnterr.h
index 73d144e34c..b9d02d2956 100644
--- a/thirdparty/freetype/src/pshinter/pshnterr.h
+++ b/thirdparty/freetype/src/pshinter/pshnterr.h
@@ -4,7 +4,7 @@
/* */
/* PS Hinter error codes (specification only). */
/* */
-/* Copyright 2003-2017 by */
+/* Copyright 2003-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshpic.c b/thirdparty/freetype/src/pshinter/pshpic.c
index c0d3a64f29..465ad31885 100644
--- a/thirdparty/freetype/src/pshinter/pshpic.c
+++ b/thirdparty/freetype/src/pshinter/pshpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for pshinter module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshpic.h b/thirdparty/freetype/src/pshinter/pshpic.h
index 8d9a01c9c5..4469ba87c8 100644
--- a/thirdparty/freetype/src/pshinter/pshpic.h
+++ b/thirdparty/freetype/src/pshinter/pshpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for pshinter module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshrec.c b/thirdparty/freetype/src/pshinter/pshrec.c
index fff6d34250..6648d13d60 100644
--- a/thirdparty/freetype/src/pshinter/pshrec.c
+++ b/thirdparty/freetype/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PostScript hints recorder (body). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/pshrec.h b/thirdparty/freetype/src/pshinter/pshrec.h
index e10bc2b120..7e3dfe0d53 100644
--- a/thirdparty/freetype/src/pshinter/pshrec.h
+++ b/thirdparty/freetype/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
/* */
/* Postscript (Type1/Type2) hints recorder (specification). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/pshinter/rules.mk b/thirdparty/freetype/src/pshinter/rules.mk
index 2be6404380..966690efc2 100644
--- a/thirdparty/freetype/src/pshinter/rules.mk
+++ b/thirdparty/freetype/src/pshinter/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2001-2017 by
+# Copyright 2001-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/psnames/module.mk b/thirdparty/freetype/src/psnames/module.mk
index ddd22960c1..410f48a191 100644
--- a/thirdparty/freetype/src/psnames/module.mk
+++ b/thirdparty/freetype/src/psnames/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/psnames/psmodule.c b/thirdparty/freetype/src/psnames/psmodule.c
index 44ba9ec6ab..8929ebe751 100644
--- a/thirdparty/freetype/src/psnames/psmodule.c
+++ b/thirdparty/freetype/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
/* */
/* PSNames module implementation (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/psmodule.h b/thirdparty/freetype/src/psnames/psmodule.h
index 6983b79234..3e94f8b437 100644
--- a/thirdparty/freetype/src/psnames/psmodule.h
+++ b/thirdparty/freetype/src/psnames/psmodule.h
@@ -4,7 +4,7 @@
/* */
/* High-level PSNames module interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/psnamerr.h b/thirdparty/freetype/src/psnames/psnamerr.h
index f90bf5ea43..14eb76c99c 100644
--- a/thirdparty/freetype/src/psnames/psnamerr.h
+++ b/thirdparty/freetype/src/psnames/psnamerr.h
@@ -4,7 +4,7 @@
/* */
/* PS names module error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/psnames.c b/thirdparty/freetype/src/psnames/psnames.c
index 22466d6230..febb80d594 100644
--- a/thirdparty/freetype/src/psnames/psnames.c
+++ b/thirdparty/freetype/src/psnames/psnames.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PSNames module component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/pspic.c b/thirdparty/freetype/src/psnames/pspic.c
index 8b9003439b..85a06f3603 100644
--- a/thirdparty/freetype/src/psnames/pspic.c
+++ b/thirdparty/freetype/src/psnames/pspic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for psnames module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/pspic.h b/thirdparty/freetype/src/psnames/pspic.h
index 14497e73fa..889780cc03 100644
--- a/thirdparty/freetype/src/psnames/pspic.h
+++ b/thirdparty/freetype/src/psnames/pspic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for psnames module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/pstables.h b/thirdparty/freetype/src/psnames/pstables.h
index 2a2b717d8f..79545ee039 100644
--- a/thirdparty/freetype/src/psnames/pstables.h
+++ b/thirdparty/freetype/src/psnames/pstables.h
@@ -4,7 +4,7 @@
/* */
/* PostScript glyph names. */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/psnames/rules.mk b/thirdparty/freetype/src/psnames/rules.mk
index 69fa732200..4d629d841c 100644
--- a/thirdparty/freetype/src/psnames/rules.mk
+++ b/thirdparty/freetype/src/psnames/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/raster/ftmisc.h b/thirdparty/freetype/src/raster/ftmisc.h
index d1e6627ab4..7e40119071 100644
--- a/thirdparty/freetype/src/raster/ftmisc.h
+++ b/thirdparty/freetype/src/raster/ftmisc.h
@@ -5,7 +5,7 @@
/* Miscellaneous macros for stand-alone rasterizer (specification */
/* only). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
diff --git a/thirdparty/freetype/src/raster/ftraster.c b/thirdparty/freetype/src/raster/ftraster.c
index c5643f6334..4354730d54 100644
--- a/thirdparty/freetype/src/raster/ftraster.c
+++ b/thirdparty/freetype/src/raster/ftraster.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/raster/ftraster.h b/thirdparty/freetype/src/raster/ftraster.h
index 6b3050cb3d..40b5d6d321 100644
--- a/thirdparty/freetype/src/raster/ftraster.h
+++ b/thirdparty/freetype/src/raster/ftraster.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
diff --git a/thirdparty/freetype/src/raster/ftrend1.c b/thirdparty/freetype/src/raster/ftrend1.c
index 185a7f6fc2..a7ce9731d7 100644
--- a/thirdparty/freetype/src/raster/ftrend1.c
+++ b/thirdparty/freetype/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer interface (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -97,12 +97,12 @@
FT_Render_Mode mode,
const FT_Vector* origin )
{
- FT_Error error;
- FT_Outline* outline;
- FT_BBox cbox, cbox0;
- FT_UInt width, height, pitch;
- FT_Bitmap* bitmap;
- FT_Memory memory;
+ FT_Error error = FT_Err_Ok;
+ FT_Outline* outline = &slot->outline;
+ FT_Bitmap* bitmap = &slot->bitmap;
+ FT_Memory memory = render->root.memory;
+ FT_Pos x_shift = 0;
+ FT_Pos y_shift = 0;
FT_Raster_Params params;
@@ -121,60 +121,6 @@
return FT_THROW( Cannot_Render_Glyph );
}
- outline = &slot->outline;
-
- /* translate the outline to the new origin if needed */
- if ( origin )
- FT_Outline_Translate( outline, origin->x, origin->y );
-
- /* compute the control box, and grid fit it */
- FT_Outline_Get_CBox( outline, &cbox0 );
-
- /* undocumented but confirmed: bbox values get rounded */
-#if 1
- cbox.xMin = FT_PIX_ROUND( cbox0.xMin );
- cbox.yMin = FT_PIX_ROUND( cbox0.yMin );
- cbox.xMax = FT_PIX_ROUND( cbox0.xMax );
- cbox.yMax = FT_PIX_ROUND( cbox0.yMax );
-#else
- cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
- cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
- cbox.xMax = FT_PIX_CEIL( cbox.xMax );
- cbox.yMax = FT_PIX_CEIL( cbox.yMax );
-#endif
-
- /* If either `width' or `height' round to 0, try */
- /* explicitly rounding up/down. In the case of */
- /* glyphs containing only one very narrow feature, */
- /* this gives the drop-out compensation in the scan */
- /* conversion code a chance to do its stuff. */
- width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
- if ( width == 0 )
- {
- cbox.xMin = FT_PIX_FLOOR( cbox0.xMin );
- cbox.xMax = FT_PIX_CEIL( cbox0.xMax );
-
- width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
- }
-
- height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
- if ( height == 0 )
- {
- cbox.yMin = FT_PIX_FLOOR( cbox0.yMin );
- cbox.yMax = FT_PIX_CEIL( cbox0.yMax );
-
- height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
- }
-
- if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- bitmap = &slot->bitmap;
- memory = render->root.memory;
-
/* release old bitmap buffer */
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{
@@ -182,39 +128,48 @@
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
}
- pitch = ( ( width + 15 ) >> 4 ) << 1;
- bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
-
- bitmap->width = width;
- bitmap->rows = height;
- bitmap->pitch = (int)pitch;
+ ft_glyphslot_preset_bitmap( slot, mode, origin );
- if ( FT_ALLOC_MULT( bitmap->buffer, height, pitch ) )
+ /* allocate new one */
+ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
goto Exit;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+ x_shift = -slot->bitmap_left * 64;
+ y_shift = ( (FT_Int)bitmap->rows - slot->bitmap_top ) * 64;
+
+ if ( origin )
+ {
+ x_shift += origin->x;
+ y_shift += origin->y;
+ }
+
/* translate outline to render it into the bitmap */
- FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );
+ if ( x_shift || y_shift )
+ FT_Outline_Translate( outline, x_shift, y_shift );
/* set up parameters */
params.target = bitmap;
params.source = outline;
- params.flags = 0;
+ params.flags = FT_RASTER_FLAG_DEFAULT;
/* render outline into the bitmap */
error = render->raster_render( render->raster, &params );
- FT_Outline_Translate( outline, cbox.xMin, cbox.yMin );
-
- if ( error )
- goto Exit;
+ Exit:
+ if ( !error )
+ /* everything is fine; the glyph is now officially a bitmap */
+ slot->format = FT_GLYPH_FORMAT_BITMAP;
+ else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+ {
+ FT_FREE( bitmap->buffer );
+ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+ }
- slot->format = FT_GLYPH_FORMAT_BITMAP;
- slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 );
- slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 );
+ if ( x_shift || y_shift )
+ FT_Outline_Translate( outline, -x_shift, -y_shift );
- Exit:
return error;
}
diff --git a/thirdparty/freetype/src/raster/ftrend1.h b/thirdparty/freetype/src/raster/ftrend1.h
index cff702d140..2abdf2d703 100644
--- a/thirdparty/freetype/src/raster/ftrend1.h
+++ b/thirdparty/freetype/src/raster/ftrend1.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/raster/module.mk b/thirdparty/freetype/src/raster/module.mk
index aad39cb56a..b115f416b2 100644
--- a/thirdparty/freetype/src/raster/module.mk
+++ b/thirdparty/freetype/src/raster/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/raster/raster.c b/thirdparty/freetype/src/raster/raster.c
index 46a6690b17..76edd21e1e 100644
--- a/thirdparty/freetype/src/raster/raster.c
+++ b/thirdparty/freetype/src/raster/raster.c
@@ -4,7 +4,7 @@
/* */
/* FreeType monochrome rasterer module component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/raster/rasterrs.h b/thirdparty/freetype/src/raster/rasterrs.h
index 0d646908ad..22a3e15340 100644
--- a/thirdparty/freetype/src/raster/rasterrs.h
+++ b/thirdparty/freetype/src/raster/rasterrs.h
@@ -4,7 +4,7 @@
/* */
/* monochrome renderer error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/raster/rastpic.c b/thirdparty/freetype/src/raster/rastpic.c
index 7085339b7b..1dc8981b8a 100644
--- a/thirdparty/freetype/src/raster/rastpic.c
+++ b/thirdparty/freetype/src/raster/rastpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for raster module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/raster/rastpic.h b/thirdparty/freetype/src/raster/rastpic.h
index dcd691310d..6d0877c423 100644
--- a/thirdparty/freetype/src/raster/rastpic.h
+++ b/thirdparty/freetype/src/raster/rastpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for raster module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/raster/rules.mk b/thirdparty/freetype/src/raster/rules.mk
index 0462c93177..9aef1f0bab 100644
--- a/thirdparty/freetype/src/raster/rules.mk
+++ b/thirdparty/freetype/src/raster/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/sfnt/module.mk b/thirdparty/freetype/src/sfnt/module.mk
index 81dea17de0..51ca67e784 100644
--- a/thirdparty/freetype/src/sfnt/module.mk
+++ b/thirdparty/freetype/src/sfnt/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/sfnt/pngshim.c b/thirdparty/freetype/src/sfnt/pngshim.c
index 560db4835a..16020266af 100644
--- a/thirdparty/freetype/src/sfnt/pngshim.c
+++ b/thirdparty/freetype/src/sfnt/pngshim.c
@@ -4,7 +4,7 @@
/* */
/* PNG Bitmap glyph support. */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* Google, Inc. */
/* Written by Stuart Gill and Behdad Esfahbod. */
/* */
@@ -82,42 +82,45 @@
typedef unsigned short v82 __attribute__(( vector_size( 16 ) ));
- /* process blocks of 16 bytes in one rush, which gives a nice speed-up */
- limit = row_info->rowbytes - 16 + 1;
- for ( ; i < limit; i += 16 )
+ if ( row_info->rowbytes > 15 )
{
- unsigned char* base = &data[i];
+ /* process blocks of 16 bytes in one rush, which gives a nice speed-up */
+ limit = row_info->rowbytes - 16 + 1;
+ for ( ; i < limit; i += 16 )
+ {
+ unsigned char* base = &data[i];
- v82 s, s0, s1, a;
+ v82 s, s0, s1, a;
- /* clang <= 3.9 can't apply scalar values to vectors */
- /* (or rather, it needs a different syntax) */
- v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
- v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
- v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 };
+ /* clang <= 3.9 can't apply scalar values to vectors */
+ /* (or rather, it needs a different syntax) */
+ v82 n0x80 = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
+ v82 n0xFF = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+ v82 n8 = { 8, 8, 8, 8, 8, 8, 8, 8 };
- v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 };
- v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF };
- v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 };
+ v82 ma = { 1, 1, 3, 3, 5, 5, 7, 7 };
+ v82 o1 = { 0, 0xFF, 0, 0xFF, 0, 0xFF, 0, 0xFF };
+ v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 };
- memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */
- s0 = s & n0xFF; /* R B R B R B R B */
- s1 = s >> n8; /* G A G A G A G A */
+ ft_memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */
+ s0 = s & n0xFF; /* R B R B R B R B */
+ s1 = s >> n8; /* G A G A G A G A */
- a = vector_shuffle( s1, ma ); /* A A A A A A A A */
- s1 |= o1; /* G 1 G 1 G 1 G 1 */
- s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */
+ a = vector_shuffle( s1, ma ); /* A A A A A A A A */
+ s1 |= o1; /* G 1 G 1 G 1 G 1 */
+ s0 = vector_shuffle( s0, m0 ); /* B R B R B R B R */
- s0 *= a;
- s1 *= a;
- s0 += n0x80;
- s1 += n0x80;
- s0 = ( s0 + ( s0 >> n8 ) ) >> n8;
- s1 = ( s1 + ( s1 >> n8 ) ) >> n8;
+ s0 *= a;
+ s1 *= a;
+ s0 += n0x80;
+ s1 += n0x80;
+ s0 = ( s0 + ( s0 >> n8 ) ) >> n8;
+ s1 = ( s1 + ( s1 >> n8 ) ) >> n8;
- s = s0 | ( s1 << n8 );
- memcpy( base, &s, 16 );
+ s = s0 | ( s1 << n8 );
+ ft_memcpy( base, &s, 16 );
+ }
}
#endif /* use `vector_size' */
@@ -234,7 +237,7 @@
return;
}
- memcpy( data, stream->cursor, length );
+ ft_memcpy( data, stream->cursor, length );
FT_FRAME_EXIT();
}
diff --git a/thirdparty/freetype/src/sfnt/pngshim.h b/thirdparty/freetype/src/sfnt/pngshim.h
index 344eceac12..194238c3a2 100644
--- a/thirdparty/freetype/src/sfnt/pngshim.h
+++ b/thirdparty/freetype/src/sfnt/pngshim.h
@@ -4,7 +4,7 @@
/* */
/* PNG Bitmap glyph support. */
/* */
-/* Copyright 2013-2017 by */
+/* Copyright 2013-2018 by */
/* Google, Inc. */
/* Written by Stuart Gill and Behdad Esfahbod. */
/* */
diff --git a/thirdparty/freetype/src/sfnt/rules.mk b/thirdparty/freetype/src/sfnt/rules.mk
index 230d56c946..83acc66a8f 100644
--- a/thirdparty/freetype/src/sfnt/rules.mk
+++ b/thirdparty/freetype/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/sfnt/sfdriver.c b/thirdparty/freetype/src/sfnt/sfdriver.c
index 991433ee4c..303e1ca9f1 100644
--- a/thirdparty/freetype/src/sfnt/sfdriver.c
+++ b/thirdparty/freetype/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -862,7 +862,8 @@
NULL,
&mm_var );
- if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) )
+ if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) &&
+ !FT_IS_VARIATION( FT_FACE( face ) ) )
{
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
@@ -1029,7 +1030,9 @@
return face->postscript_name;
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- if ( face->blend )
+ if ( face->blend &&
+ ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ||
+ FT_IS_VARIATION( FT_FACE( face ) ) ) )
{
face->postscript_name = sfnt_get_var_ps_name( face );
return face->postscript_name;
diff --git a/thirdparty/freetype/src/sfnt/sfdriver.h b/thirdparty/freetype/src/sfnt/sfdriver.h
index 38710b60f2..81c22d2887 100644
--- a/thirdparty/freetype/src/sfnt/sfdriver.h
+++ b/thirdparty/freetype/src/sfnt/sfdriver.h
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/sferrors.h b/thirdparty/freetype/src/sfnt/sferrors.h
index 3cf73d725d..74003d4b38 100644
--- a/thirdparty/freetype/src/sfnt/sferrors.h
+++ b/thirdparty/freetype/src/sfnt/sferrors.h
@@ -4,7 +4,7 @@
/* */
/* SFNT error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/sfnt.c b/thirdparty/freetype/src/sfnt/sfnt.c
index 6cf8c9ef30..8b9a6b345d 100644
--- a/thirdparty/freetype/src/sfnt/sfnt.c
+++ b/thirdparty/freetype/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
/* */
/* Single object library component. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/sfntpic.c b/thirdparty/freetype/src/sfnt/sfntpic.c
index 8eadd601fd..db2d816ce6 100644
--- a/thirdparty/freetype/src/sfnt/sfntpic.c
+++ b/thirdparty/freetype/src/sfnt/sfntpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for sfnt module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/sfntpic.h b/thirdparty/freetype/src/sfnt/sfntpic.h
index 3afb668db0..8f43122d81 100644
--- a/thirdparty/freetype/src/sfnt/sfntpic.h
+++ b/thirdparty/freetype/src/sfnt/sfntpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for sfnt module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/sfobjs.c b/thirdparty/freetype/src/sfnt/sfobjs.c
index 69bf0a5c3d..6ba8509f56 100644
--- a/thirdparty/freetype/src/sfnt/sfobjs.c
+++ b/thirdparty/freetype/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
/* */
/* SFNT object management (base). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -962,8 +962,6 @@
FT_Byte* instance_values = NULL;
- face->is_default_instance = 1;
-
instance_index = FT_ABS( face_instance_index ) >> 16;
/* test whether current face is a GX font with named instances */
@@ -1146,6 +1144,8 @@
FT_Bool has_outline;
FT_Bool is_apple_sbit;
FT_Bool is_apple_sbix;
+ FT_Bool has_CBLC;
+ FT_Bool has_CBDT;
FT_Bool ignore_typographic_family = FALSE;
FT_Bool ignore_typographic_subfamily = FALSE;
@@ -1226,6 +1226,13 @@
goto Exit;
}
+ has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 );
+ has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 );
+
+ /* Ignore outlines for CBLC/CBDT fonts. */
+ if ( has_CBLC || has_CBDT )
+ has_outline = FALSE;
+
/* OpenType 1.8.2 introduced limits to this value; */
/* however, they make sense for older SFNT fonts also */
if ( face->header.Units_Per_EM < 16 ||
@@ -1686,9 +1693,9 @@
(FT_Short)( face->vertical_info ? face->vertical.advance_Height_Max
: root->height );
- /* See http://www.microsoft.com/OpenType/OTSpec/post.htm -- */
- /* Adjust underline position from top edge to centre of */
- /* stroke to convert TrueType meaning to FreeType meaning. */
+ /* See https://www.microsoft.com/typography/otspec/post.htm -- */
+ /* Adjust underline position from top edge to centre of */
+ /* stroke to convert TrueType meaning to FreeType meaning. */
root->underline_position = face->postscript.underlinePosition -
face->postscript.underlineThickness / 2;
root->underline_thickness = face->postscript.underlineThickness;
diff --git a/thirdparty/freetype/src/sfnt/sfobjs.h b/thirdparty/freetype/src/sfnt/sfobjs.h
index 705381459a..1b8d1be5b1 100644
--- a/thirdparty/freetype/src/sfnt/sfobjs.h
+++ b/thirdparty/freetype/src/sfnt/sfobjs.h
@@ -4,7 +4,7 @@
/* */
/* SFNT object management (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttbdf.c b/thirdparty/freetype/src/sfnt/ttbdf.c
index 2196e3791e..534201f229 100644
--- a/thirdparty/freetype/src/sfnt/ttbdf.c
+++ b/thirdparty/freetype/src/sfnt/ttbdf.c
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded BDF properties (body). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttbdf.h b/thirdparty/freetype/src/sfnt/ttbdf.h
index 398b620600..809a663001 100644
--- a/thirdparty/freetype/src/sfnt/ttbdf.h
+++ b/thirdparty/freetype/src/sfnt/ttbdf.h
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded BDF properties (specification). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -28,6 +28,8 @@
FT_BEGIN_HEADER
+#ifdef TT_CONFIG_OPTION_BDF
+
FT_LOCAL( void )
tt_face_free_bdf_props( TT_Face face );
@@ -37,6 +39,8 @@ FT_BEGIN_HEADER
const char* property_name,
BDF_PropertyRec *aprop );
+#endif /* TT_CONFIG_OPTION_BDF */
+
FT_END_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttcmap.c b/thirdparty/freetype/src/sfnt/ttcmap.c
index b995e5c050..996e66485f 100644
--- a/thirdparty/freetype/src/sfnt/ttcmap.c
+++ b/thirdparty/freetype/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
/* */
/* TrueType character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -222,10 +222,10 @@
/***** The following charmap lookup and iteration functions all *****/
/***** assume that the value `charcode' fulfills the following. *****/
/***** *****/
- /***** - For one byte characters, `charcode' is simply the *****/
+ /***** - For one-byte characters, `charcode' is simply the *****/
/***** character code. *****/
/***** *****/
- /***** - For two byte characters, `charcode' is the 2-byte *****/
+ /***** - For two-byte characters, `charcode' is the 2-byte *****/
/***** character code in big endian format. More precisely: *****/
/***** *****/
/***** (charcode >> 8) is the first byte value *****/
@@ -252,11 +252,11 @@
/* subs 518 SUBHEAD[NSUBS] sub-headers array */
/* glyph_ids 518+NSUB*8 USHORT[] glyph ID array */
/* */
- /* The `keys' table is used to map charcode high-bytes to sub-headers. */
+ /* The `keys' table is used to map charcode high bytes to sub-headers. */
/* The value of `NSUBS' is the number of sub-headers defined in the */
/* table and is computed by finding the maximum of the `keys' table. */
/* */
- /* Note that for any n, `keys[n]' is a byte offset within the `subs' */
+ /* Note that for any `n', `keys[n]' is a byte offset within the `subs' */
/* table, i.e., it is the corresponding sub-header index multiplied */
/* by 8. */
/* */
@@ -269,8 +269,8 @@
/* delta 4 SHORT see below */
/* offset 6 USHORT see below */
/* */
- /* A sub-header defines, for each high-byte, the range of valid */
- /* low-bytes within the charmap. Note that the range defined by `first' */
+ /* A sub-header defines, for each high byte, the range of valid */
+ /* low bytes within the charmap. Note that the range defined by `first' */
/* and `count' must be completely included in the interval [0..255] */
/* according to the specification. */
/* */
@@ -360,7 +360,7 @@
/* check range within 0..255 */
if ( valid->level >= FT_VALIDATE_PARANOID )
{
- if ( first_code >= 256 || first_code + code_count > 256 )
+ if ( first_code >= 256 || code_count > 256 - first_code )
FT_INVALID_DATA;
}
@@ -412,7 +412,7 @@
{
FT_UInt char_lo = (FT_UInt)( char_code & 0xFF );
FT_UInt char_hi = (FT_UInt)( char_code >> 8 );
- FT_Byte* p = table + 6; /* keys table */
+ FT_Byte* p = table + 6; /* keys table */
FT_Byte* subs = table + 518; /* subheaders table */
FT_Byte* sub;
@@ -425,8 +425,8 @@
sub = subs; /* jump to first sub-header */
/* check that the sub-header for this byte is 0, which */
- /* indicates that it is really a valid one-byte value */
- /* Otherwise, return 0 */
+ /* indicates that it is really a valid one-byte value; */
+ /* otherwise, return 0 */
/* */
p += char_lo * 2;
if ( TT_PEEK_USHORT( p ) != 0 )
@@ -445,6 +445,7 @@
if ( sub == subs )
goto Exit;
}
+
result = sub;
}
@@ -517,8 +518,19 @@
FT_UInt pos, idx;
+ if ( char_lo >= start + count && charcode <= 0xFF )
+ {
+ /* this happens only for a malformed cmap */
+ charcode = 0x100;
+ continue;
+ }
+
if ( offset == 0 )
+ {
+ if ( charcode == 0x100 )
+ goto Exit; /* this happens only for a malformed cmap */
goto Next_SubHeader;
+ }
if ( char_lo < start )
{
@@ -545,11 +557,20 @@
}
}
}
+
+ /* if unsuccessful, avoid `charcode' leaving */
+ /* the current 256-character block */
+ if ( count )
+ charcode--;
}
- /* jump to next sub-header, i.e. higher byte value */
+ /* If `charcode' is <= 0xFF, retry with `charcode + 1'. */
+ /* Otherwise jump to the next 256-character block and retry. */
Next_SubHeader:
- charcode = FT_PAD_FLOOR( charcode, 256 ) + 256;
+ if ( charcode <= 0xFF )
+ charcode++;
+ else
+ charcode = FT_PAD_FLOOR( charcode, 0x100 ) + 0x100;
}
Exit:
diff --git a/thirdparty/freetype/src/sfnt/ttcmap.h b/thirdparty/freetype/src/sfnt/ttcmap.h
index f7de0437b0..d264d99d2c 100644
--- a/thirdparty/freetype/src/sfnt/ttcmap.h
+++ b/thirdparty/freetype/src/sfnt/ttcmap.h
@@ -4,7 +4,7 @@
/* */
/* TrueType character mapping table (cmap) support (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttcmapc.h b/thirdparty/freetype/src/sfnt/ttcmapc.h
index 9a5e70825e..4980e9dd3d 100644
--- a/thirdparty/freetype/src/sfnt/ttcmapc.h
+++ b/thirdparty/freetype/src/sfnt/ttcmapc.h
@@ -4,7 +4,7 @@
/* */
/* TT CMAP classes definitions (specification only). */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttkern.c b/thirdparty/freetype/src/sfnt/ttkern.c
index 53d2436ae5..68f15a2010 100644
--- a/thirdparty/freetype/src/sfnt/ttkern.c
+++ b/thirdparty/freetype/src/sfnt/ttkern.c
@@ -5,7 +5,7 @@
/* Load the basic TrueType kerning table. This doesn't handle */
/* kerning data within the GPOS table at the moment. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttkern.h b/thirdparty/freetype/src/sfnt/ttkern.h
index db1a30bdb0..4e45d0964b 100644
--- a/thirdparty/freetype/src/sfnt/ttkern.h
+++ b/thirdparty/freetype/src/sfnt/ttkern.h
@@ -5,7 +5,7 @@
/* Load the basic TrueType kerning table. This doesn't handle */
/* kerning data within the GPOS table at the moment. */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttload.c b/thirdparty/freetype/src/sfnt/ttload.c
index df99baa53e..a86a546c3d 100644
--- a/thirdparty/freetype/src/sfnt/ttload.c
+++ b/thirdparty/freetype/src/sfnt/ttload.c
@@ -5,7 +5,7 @@
/* Load the basic TrueType tables, i.e., tables that can be either in */
/* TTF or OTF fonts (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -338,7 +338,7 @@
SFNT_HeaderRec sfnt;
FT_Error error;
FT_Memory memory = stream->memory;
- FT_UShort nn, valid_entries;
+ FT_UShort nn, valid_entries = 0;
static const FT_Frame_Field offset_table_fields[] =
{
diff --git a/thirdparty/freetype/src/sfnt/ttload.h b/thirdparty/freetype/src/sfnt/ttload.h
index 296da86ed3..f94be8b7bd 100644
--- a/thirdparty/freetype/src/sfnt/ttload.h
+++ b/thirdparty/freetype/src/sfnt/ttload.h
@@ -5,7 +5,7 @@
/* Load the basic TrueType tables, i.e., tables that can be either in */
/* TTF or OTF fonts (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttmtx.c b/thirdparty/freetype/src/sfnt/ttmtx.c
index 394c6db85c..6ddda95b56 100644
--- a/thirdparty/freetype/src/sfnt/ttmtx.c
+++ b/thirdparty/freetype/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
/* */
/* Load the metrics tables common to TTF and OTF fonts (body). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttmtx.h b/thirdparty/freetype/src/sfnt/ttmtx.h
index 2b93ab2f0e..ab00acd795 100644
--- a/thirdparty/freetype/src/sfnt/ttmtx.h
+++ b/thirdparty/freetype/src/sfnt/ttmtx.h
@@ -4,7 +4,7 @@
/* */
/* Load the metrics tables common to TTF and OTF fonts (specification). */
/* */
-/* Copyright 2006-2017 by */
+/* Copyright 2006-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttpost.c b/thirdparty/freetype/src/sfnt/ttpost.c
index 69929c8d45..6de99ef977 100644
--- a/thirdparty/freetype/src/sfnt/ttpost.c
+++ b/thirdparty/freetype/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
/* PostScript name table processing for TrueType and OpenType fonts */
/* (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -473,8 +473,8 @@
/* idx :: The glyph index. */
/* */
/* <InOut> */
- /* PSname :: The address of a string pointer. Will be NULL in case */
- /* of error, otherwise it is a pointer to the glyph name. */
+ /* PSname :: The address of a string pointer. Undefined in case of */
+ /* error, otherwise it is a pointer to the glyph name. */
/* */
/* You must not modify the returned string! */
/* */
diff --git a/thirdparty/freetype/src/sfnt/ttpost.h b/thirdparty/freetype/src/sfnt/ttpost.h
index 722485e32d..3bec07e445 100644
--- a/thirdparty/freetype/src/sfnt/ttpost.h
+++ b/thirdparty/freetype/src/sfnt/ttpost.h
@@ -5,7 +5,7 @@
/* PostScript name table processing for TrueType and OpenType fonts */
/* (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/sfnt/ttsbit.c b/thirdparty/freetype/src/sfnt/ttsbit.c
index f41847b0af..33b8640bc3 100644
--- a/thirdparty/freetype/src/sfnt/ttsbit.c
+++ b/thirdparty/freetype/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (body). */
/* */
-/* Copyright 2005-2017 by */
+/* Copyright 2005-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* Copyright 2013 by Google, Inc. */
@@ -1007,8 +1007,9 @@
goto Fail;
}
- FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n",
- num_components ));
+ FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d component%s\n",
+ num_components,
+ num_components == 1 ? "" : "s" ));
for ( nn = 0; nn < num_components; nn++ )
{
@@ -1513,7 +1514,7 @@
FT_FRAME_EXIT();
if ( glyph_start == glyph_end )
- return FT_THROW( Invalid_Argument );
+ return FT_THROW( Missing_Bitmap );
if ( glyph_start > glyph_end ||
glyph_end - glyph_start < 8 ||
face->ebdt_size - strike_offset < glyph_end )
diff --git a/thirdparty/freetype/src/sfnt/ttsbit.h b/thirdparty/freetype/src/sfnt/ttsbit.h
index e859ddda45..ce2af3c162 100644
--- a/thirdparty/freetype/src/sfnt/ttsbit.h
+++ b/thirdparty/freetype/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
index df645e66c9..803a19e415 100644
--- a/thirdparty/freetype/src/smooth/ftgrays.c
+++ b/thirdparty/freetype/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
/* */
/* A new `perfect' anti-aliasing renderer (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -370,7 +370,7 @@ typedef ptrdiff_t FT_PtrDist;
/* optimize a division and modulo operation on the same parameters */
/* into a single call to `__aeabi_idivmod'. See */
/* */
- /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */
+ /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43721 */
#undef FT_DIV_MOD
#define FT_DIV_MOD( type, dividend, divisor, quotient, remainder ) \
FT_BEGIN_STMNT \
@@ -404,7 +404,7 @@ typedef ptrdiff_t FT_PtrDist;
/* need to define them to "float" or "double" when experimenting with */
/* new algorithms */
- typedef long TPos; /* sub-pixel coordinate */
+ typedef long TPos; /* subpixel coordinate */
typedef int TCoord; /* integer scanline/pixel coordinate */
typedef int TArea; /* cell areas, coordinate products */
@@ -582,8 +582,8 @@ typedef ptrdiff_t FT_PtrDist;
if ( ex < ras.min_ex )
ex = ras.min_ex - 1;
- /* record the current one if it is valid */
- if ( !ras.invalid )
+ /* record the current one if it is valid and substantial */
+ if ( !ras.invalid && ( ras.area || ras.cover ) )
gray_record_cell( RAS_VAR );
ras.area = 0;
@@ -1300,8 +1300,6 @@ typedef ptrdiff_t FT_PtrDist;
int y;
- FT_TRACE7(( "gray_sweep: start\n" ));
-
for ( y = ras.min_ey; y < ras.max_ey; y++ )
{
PCell cell = ras.ycells[y - ras.min_ey];
@@ -1327,8 +1325,6 @@ typedef ptrdiff_t FT_PtrDist;
if ( cover != 0 )
gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x );
}
-
- FT_TRACE7(( "gray_sweep: end\n" ));
}
@@ -1722,8 +1718,11 @@ typedef ptrdiff_t FT_PtrDist;
if ( !ras.invalid )
gray_record_cell( RAS_VAR );
- FT_TRACE7(( "band [%d..%d]: %d cells\n",
- ras.min_ey, ras.max_ey, ras.num_cells ));
+ FT_TRACE7(( "band [%d..%d]: %d cell%s\n",
+ ras.min_ey,
+ ras.max_ey,
+ ras.num_cells,
+ ras.num_cells == 1 ? "" : "s" ));
}
else
{
@@ -1740,35 +1739,43 @@ typedef ptrdiff_t FT_PtrDist;
static int
gray_convert_glyph( RAS_ARG )
{
+ const TCoord yMin = ras.min_ey;
+ const TCoord yMax = ras.max_ey;
+ const TCoord xMin = ras.min_ex;
+ const TCoord xMax = ras.max_ex;
+
TCell buffer[FT_MAX_GRAY_POOL];
- TCoord band_size = FT_MAX_GRAY_POOL / 8;
- TCoord count = ras.max_ey - ras.min_ey;
- int num_bands;
- TCoord min, max, max_y;
+ size_t height = (size_t)( yMax - yMin );
+ size_t n = FT_MAX_GRAY_POOL / 8;
+ TCoord y;
TCoord bands[32]; /* enough to accommodate bisections */
TCoord* band;
/* set up vertical bands */
- if ( count > band_size )
+ if ( height > n )
{
/* two divisions rounded up */
- num_bands = (int)( ( count + band_size - 1) / band_size );
- band_size = ( count + num_bands - 1 ) / num_bands;
+ n = ( height + n - 1 ) / n;
+ height = ( height + n - 1 ) / n;
}
- min = ras.min_ey;
- max_y = ras.max_ey;
+ /* memory management */
+ n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell );
- for ( ; min < max_y; min = max )
+ ras.cells = buffer + n;
+ ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n );
+ ras.ycells = (PCell*)buffer;
+
+ for ( y = yMin; y < yMax; )
{
- max = min + band_size;
- if ( max > max_y )
- max = max_y;
+ ras.min_ey = y;
+ y += height;
+ ras.max_ey = FT_MIN( y, yMax );
band = bands;
- band[1] = min;
- band[0] = max;
+ band[1] = xMin;
+ band[0] = xMax;
do
{
@@ -1776,27 +1783,12 @@ typedef ptrdiff_t FT_PtrDist;
int error;
- /* memory management */
- {
- size_t ycount = (size_t)width;
- size_t cell_start;
-
-
- cell_start = ( ycount * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
- sizeof ( TCell );
-
- ras.cells = buffer + cell_start;
- ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - cell_start );
- ras.num_cells = 0;
-
- ras.ycells = (PCell*)buffer;
- while ( ycount )
- ras.ycells[--ycount] = NULL;
- }
+ FT_MEM_ZERO( ras.ycells, height * sizeof ( PCell ) );
+ ras.num_cells = 0;
ras.invalid = 1;
- ras.min_ey = band[1];
- ras.max_ey = band[0];
+ ras.min_ex = band[1];
+ ras.max_ex = band[0];
error = gray_convert_glyph_inner( RAS_VAR );
@@ -1812,8 +1804,7 @@ typedef ptrdiff_t FT_PtrDist;
/* render pool overflow; we will reduce the render band by half */
width >>= 1;
- /* This is too complex for a single scanline; there must */
- /* be some problems. */
+ /* this should never happen even with tiny rendering pool */
if ( width == 0 )
{
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
diff --git a/thirdparty/freetype/src/smooth/ftgrays.h b/thirdparty/freetype/src/smooth/ftgrays.h
index a5447da1a9..9e11ca675e 100644
--- a/thirdparty/freetype/src/smooth/ftgrays.h
+++ b/thirdparty/freetype/src/smooth/ftgrays.h
@@ -4,7 +4,7 @@
/* */
/* FreeType smooth renderer declaration */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/smooth/ftsmerrs.h b/thirdparty/freetype/src/smooth/ftsmerrs.h
index a528c61832..226dc1b001 100644
--- a/thirdparty/freetype/src/smooth/ftsmerrs.h
+++ b/thirdparty/freetype/src/smooth/ftsmerrs.h
@@ -4,7 +4,7 @@
/* */
/* smooth renderer error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/smooth/ftsmooth.c b/thirdparty/freetype/src/smooth/ftsmooth.c
index 963435de15..ef176bdf1e 100644
--- a/thirdparty/freetype/src/smooth/ftsmooth.c
+++ b/thirdparty/freetype/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
/* */
/* Anti-aliasing renderer interface (body). */
/* */
-/* Copyright 2000-2017 by */
+/* Copyright 2000-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -97,74 +97,17 @@
const FT_Vector* origin,
FT_Render_Mode required_mode )
{
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
FT_Outline* outline = &slot->outline;
FT_Bitmap* bitmap = &slot->bitmap;
FT_Memory memory = render->root.memory;
- FT_BBox cbox;
FT_Pos x_shift = 0;
FT_Pos y_shift = 0;
- FT_Pos x_left, y_top;
- FT_Pos width, height, pitch;
FT_Int hmul = ( mode == FT_RENDER_MODE_LCD );
FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V );
FT_Raster_Params params;
- FT_Bool have_outline_shifted = FALSE;
- FT_Bool have_buffer = FALSE;
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
- FT_LcdFiveTapFilter lcd_weights = { 0 };
- FT_Bool have_custom_weight = FALSE;
- FT_Bitmap_LcdFilterFunc lcd_filter_func = NULL;
-
-
- if ( slot->face )
- {
- FT_Char i;
-
-
- for ( i = 0; i < FT_LCD_FILTER_FIVE_TAPS; i++ )
- if ( slot->face->internal->lcd_weights[i] != 0 )
- {
- have_custom_weight = TRUE;
- break;
- }
- }
-
- /*
- * The LCD filter can be set library-wide and per-face. Face overrides
- * library. If the face filter weights are all zero (the default), it
- * means that the library default should be used.
- */
- if ( have_custom_weight )
- {
- /*
- * A per-font filter is set. It always uses the default 5-tap
- * in-place FIR filter.
- */
- ft_memcpy( lcd_weights,
- slot->face->internal->lcd_weights,
- FT_LCD_FILTER_FIVE_TAPS );
- lcd_filter_func = ft_lcd_filter_fir;
- }
- else
- {
- /*
- * The face's lcd_weights is {0, 0, 0, 0, 0}, meaning `use library
- * default'. If the library is set to use no LCD filtering
- * (lcd_filter_func == NULL), `lcd_filter_func' here is also set to
- * NULL and the tests further below pass over the filtering process.
- */
- ft_memcpy( lcd_weights,
- slot->library->lcd_weights,
- FT_LCD_FILTER_FIVE_TAPS );
- lcd_filter_func = slot->library->lcd_filter_func;
- }
-
-#endif /*FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
/* check glyph image format */
if ( slot->format != render->glyph_format )
@@ -180,100 +123,6 @@
goto Exit;
}
- if ( origin )
- {
- x_shift = origin->x;
- y_shift = origin->y;
- }
-
- /* compute the control box, and grid fit it */
- /* taking into account the origin shift */
- FT_Outline_Get_CBox( outline, &cbox );
-
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
- /* add minimal padding for LCD rendering */
- if ( hmul )
- {
- cbox.xMax += 21;
- cbox.xMin -= 21;
- }
-
- if ( vmul )
- {
- cbox.yMax += 21;
- cbox.yMin -= 21;
- }
-
-#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
- /* add minimal padding for LCD filter depending on specific weights */
- if ( lcd_filter_func )
- {
- if ( hmul )
- {
- cbox.xMax += lcd_weights[4] ? 43
- : lcd_weights[3] ? 22 : 0;
- cbox.xMin -= lcd_weights[0] ? 43
- : lcd_weights[1] ? 22 : 0;
- }
-
- if ( vmul )
- {
- cbox.yMax += lcd_weights[4] ? 43
- : lcd_weights[3] ? 22 : 0;
- cbox.yMin -= lcd_weights[0] ? 43
- : lcd_weights[1] ? 22 : 0;
- }
- }
-
-#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
- cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift );
- cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift );
- cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift );
- cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift );
-
- x_shift -= cbox.xMin;
- y_shift -= cbox.yMin;
-
- x_left = cbox.xMin >> 6;
- y_top = cbox.yMax >> 6;
-
- width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6;
- height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6;
-
- pitch = width;
- if ( hmul )
- {
- width *= 3;
- pitch = FT_PAD_CEIL( width, 4 );
- }
-
- if ( vmul )
- height *= 3;
-
- /*
- * XXX: on 16bit system, we return an error for huge bitmap
- * to prevent an overflow.
- */
- if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX ||
- x_left < FT_INT_MIN || y_top < FT_INT_MIN )
- {
- error = FT_THROW( Invalid_Pixel_Size );
- goto Exit;
- }
-
- /* Required check is (pitch * height < FT_ULONG_MAX), */
- /* but we care realistic cases only. Always pitch <= width. */
- if ( width > 0x7FFF || height > 0x7FFF )
- {
- FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n",
- width, height ));
- error = FT_THROW( Raster_Overflow );
- goto Exit;
- }
-
/* release old bitmap buffer */
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{
@@ -281,30 +130,30 @@
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
}
+ ft_glyphslot_preset_bitmap( slot, mode, origin );
+
/* allocate new one */
- if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) )
+ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
goto Exit;
- else
- have_buffer = TRUE;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- slot->format = FT_GLYPH_FORMAT_BITMAP;
- slot->bitmap_left = (FT_Int)x_left;
- slot->bitmap_top = (FT_Int)y_top;
+ x_shift = 64 * -slot->bitmap_left;
+ y_shift = 64 * -slot->bitmap_top;
+ if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
+ y_shift += 64 * (FT_Int)bitmap->rows / 3;
+ else
+ y_shift += 64 * (FT_Int)bitmap->rows;
- bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
- bitmap->num_grays = 256;
- bitmap->width = (unsigned int)width;
- bitmap->rows = (unsigned int)height;
- bitmap->pitch = pitch;
+ if ( origin )
+ {
+ x_shift += origin->x;
+ y_shift += origin->y;
+ }
/* translate outline to render it into the bitmap */
if ( x_shift || y_shift )
- {
FT_Outline_Translate( outline, x_shift, y_shift );
- have_outline_shifted = TRUE;
- }
/* set up parameters */
params.target = bitmap;
@@ -351,45 +200,68 @@
if ( error )
goto Exit;
- if ( lcd_filter_func )
- lcd_filter_func( bitmap, mode, lcd_weights );
+ /* finally apply filtering */
+ if ( hmul || vmul )
+ {
+ FT_Byte* lcd_weights;
+ FT_Bitmap_LcdFilterFunc lcd_filter_func;
+
+
+ /* Per-face LCD filtering takes priority if set up. */
+ if ( slot->face && slot->face->internal->lcd_filter_func )
+ {
+ lcd_weights = slot->face->internal->lcd_weights;
+ lcd_filter_func = slot->face->internal->lcd_filter_func;
+ }
+ else
+ {
+ lcd_weights = slot->library->lcd_weights;
+ lcd_filter_func = slot->library->lcd_filter_func;
+ }
+
+ if ( lcd_filter_func )
+ lcd_filter_func( bitmap, mode, lcd_weights );
+ }
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
if ( hmul ) /* lcd */
{
FT_Byte* line;
- FT_Byte* temp;
- FT_Int i, j;
+ FT_Byte* temp = NULL;
+ FT_UInt i, j;
+
+ unsigned int height = bitmap->rows;
+ unsigned int width = bitmap->width;
+ int pitch = bitmap->pitch;
/* Render 3 separate monochrome bitmaps, shifting the outline */
/* by 1/3 pixel. */
width /= 3;
- FT_Outline_Translate( outline, 21, 0 );
+ bitmap->buffer += width;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
FT_Outline_Translate( outline, -21, 0 );
+ x_shift -= 21;
bitmap->buffer += width;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, -21, 0 );
- bitmap->buffer += width;
+ FT_Outline_Translate( outline, 42, 0 );
+ x_shift += 42;
+ bitmap->buffer -= 2 * width;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, 21, 0 );
- bitmap->buffer -= 2 * width;
-
/* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
/* XXX: It is more efficient to render every third byte above. */
@@ -398,7 +270,7 @@
for ( i = 0; i < height; i++ )
{
- line = bitmap->buffer + i * pitch;
+ line = bitmap->buffer + i * (FT_ULong)pitch;
for ( j = 0; j < width; j++ )
{
temp[3 * j ] = line[j];
@@ -412,60 +284,59 @@
}
else if ( vmul ) /* lcd_v */
{
+ int pitch = bitmap->pitch;
+
+
/* Render 3 separate monochrome bitmaps, shifting the outline */
/* by 1/3 pixel. Triple the pitch to render on each third row. */
bitmap->pitch *= 3;
bitmap->rows /= 3;
- FT_Outline_Translate( outline, 0, 21 );
- bitmap->buffer += 2 * pitch;
+ bitmap->buffer += pitch;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, 0, -21 );
- bitmap->buffer -= pitch;
+ FT_Outline_Translate( outline, 0, 21 );
+ y_shift += 21;
+ bitmap->buffer += pitch;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, 0, -21 );
- bitmap->buffer -= pitch;
+ FT_Outline_Translate( outline, 0, -42 );
+ y_shift -= 42;
+ bitmap->buffer -= 2 * pitch;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, 0, 21 );
-
bitmap->pitch /= 3;
bitmap->rows *= 3;
}
else /* grayscale */
- {
error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
- }
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
- /* everything is fine; don't deallocate buffer */
- have_buffer = FALSE;
-
- error = FT_Err_Ok;
-
Exit:
- if ( have_outline_shifted )
- FT_Outline_Translate( outline, -x_shift, -y_shift );
- if ( have_buffer )
+ if ( !error )
+ {
+ /* everything is fine; the glyph is now officially a bitmap */
+ slot->format = FT_GLYPH_FORMAT_BITMAP;
+ }
+ else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{
FT_FREE( bitmap->buffer );
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
}
+ if ( x_shift || y_shift )
+ FT_Outline_Translate( outline, -x_shift, -y_shift );
+
return error;
}
@@ -492,14 +363,8 @@
FT_Render_Mode mode,
const FT_Vector* origin )
{
- FT_Error error;
-
- error = ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_LCD );
- if ( !error )
- slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD;
-
- return error;
+ return ft_smooth_render_generic( render, slot, mode, origin,
+ FT_RENDER_MODE_LCD );
}
@@ -510,14 +375,8 @@
FT_Render_Mode mode,
const FT_Vector* origin )
{
- FT_Error error;
-
- error = ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_LCD_V );
- if ( !error )
- slot->bitmap.pixel_mode = FT_PIXEL_MODE_LCD_V;
-
- return error;
+ return ft_smooth_render_generic( render, slot, mode, origin,
+ FT_RENDER_MODE_LCD_V );
}
diff --git a/thirdparty/freetype/src/smooth/ftsmooth.h b/thirdparty/freetype/src/smooth/ftsmooth.h
index 6dfd65726c..c76ffc5034 100644
--- a/thirdparty/freetype/src/smooth/ftsmooth.h
+++ b/thirdparty/freetype/src/smooth/ftsmooth.h
@@ -4,7 +4,7 @@
/* */
/* Anti-aliasing renderer interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/smooth/ftspic.c b/thirdparty/freetype/src/smooth/ftspic.c
index fb89be3488..10f04cf4cc 100644
--- a/thirdparty/freetype/src/smooth/ftspic.c
+++ b/thirdparty/freetype/src/smooth/ftspic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for smooth module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/smooth/ftspic.h b/thirdparty/freetype/src/smooth/ftspic.h
index 9ddd1c7905..80fb64cff4 100644
--- a/thirdparty/freetype/src/smooth/ftspic.h
+++ b/thirdparty/freetype/src/smooth/ftspic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for smooth module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/smooth/module.mk b/thirdparty/freetype/src/smooth/module.mk
index 804e9b1386..5b8bc3be3b 100644
--- a/thirdparty/freetype/src/smooth/module.mk
+++ b/thirdparty/freetype/src/smooth/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/smooth/rules.mk b/thirdparty/freetype/src/smooth/rules.mk
index dfdc9bc30f..f30824a367 100644
--- a/thirdparty/freetype/src/smooth/rules.mk
+++ b/thirdparty/freetype/src/smooth/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/smooth/smooth.c b/thirdparty/freetype/src/smooth/smooth.c
index e0460d9d46..5249a8931e 100644
--- a/thirdparty/freetype/src/smooth/smooth.c
+++ b/thirdparty/freetype/src/smooth/smooth.c
@@ -4,7 +4,7 @@
/* */
/* FreeType anti-aliasing rasterer module component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/module.mk b/thirdparty/freetype/src/truetype/module.mk
index 563c584e2b..16bc9c8b20 100644
--- a/thirdparty/freetype/src/truetype/module.mk
+++ b/thirdparty/freetype/src/truetype/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/truetype/rules.mk b/thirdparty/freetype/src/truetype/rules.mk
index ad3d007455..e16113f128 100644
--- a/thirdparty/freetype/src/truetype/rules.mk
+++ b/thirdparty/freetype/src/truetype/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/truetype/truetype.c b/thirdparty/freetype/src/truetype/truetype.c
index 301b82ad1c..484370975c 100644
--- a/thirdparty/freetype/src/truetype/truetype.c
+++ b/thirdparty/freetype/src/truetype/truetype.c
@@ -4,7 +4,7 @@
/* */
/* FreeType TrueType driver component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttdriver.c b/thirdparty/freetype/src/truetype/ttdriver.c
index a1653b241c..820cafbb8d 100644
--- a/thirdparty/freetype/src/truetype/ttdriver.c
+++ b/thirdparty/freetype/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
/* */
/* TrueType font driver implementation (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,7 +31,7 @@
#include FT_SERVICE_TRUETYPE_ENGINE_H
#include FT_SERVICE_TRUETYPE_GLYF_H
#include FT_SERVICE_PROPERTIES_H
-#include FT_TRUETYPE_DRIVER_H
+#include FT_DRIVER_H
#include "ttdriver.h"
#include "ttgload.h"
@@ -233,8 +233,8 @@
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without VVAR table */
- if ( !face->is_default_instance &&
- !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
+ if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) &&
+ !( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
@@ -253,8 +253,8 @@
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without HVAR table */
- if ( !face->is_default_instance &&
- !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
+ if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) &&
+ !( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
@@ -498,6 +498,7 @@
(FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
(FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */
(FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */
+ (FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
(FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
(FT_Done_Blend_Func) tt_done_blend /* done_blend */
diff --git a/thirdparty/freetype/src/truetype/ttdriver.h b/thirdparty/freetype/src/truetype/ttdriver.h
index 3bcba7f745..707aa68edf 100644
--- a/thirdparty/freetype/src/truetype/ttdriver.h
+++ b/thirdparty/freetype/src/truetype/ttdriver.h
@@ -4,7 +4,7 @@
/* */
/* High-level TrueType driver interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/tterrors.h b/thirdparty/freetype/src/truetype/tterrors.h
index a49f205156..88bca3a04a 100644
--- a/thirdparty/freetype/src/truetype/tterrors.h
+++ b/thirdparty/freetype/src/truetype/tterrors.h
@@ -4,7 +4,7 @@
/* */
/* TrueType error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttgload.c b/thirdparty/freetype/src/truetype/ttgload.c
index 5e102c6151..39d9c3f736 100644
--- a/thirdparty/freetype/src/truetype/ttgload.c
+++ b/thirdparty/freetype/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
/* */
/* TrueType Glyph Loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,7 +24,7 @@
#include FT_INTERNAL_SFNT_H
#include FT_TRUETYPE_TAGS_H
#include FT_OUTLINE_H
-#include FT_TRUETYPE_DRIVER_H
+#include FT_DRIVER_H
#include FT_LIST_H
#include "ttgload.h"
@@ -664,7 +664,52 @@
} while ( subglyph->flags & MORE_COMPONENTS );
gloader->current.num_subglyphs = num_subglyphs;
- FT_TRACE5(( " %d components\n", num_subglyphs ));
+ FT_TRACE5(( " %d component%s\n",
+ num_subglyphs,
+ num_subglyphs > 1 ? "s" : "" ));
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ {
+ FT_UInt i;
+
+
+ subglyph = gloader->current.subglyphs;
+
+ for ( i = 0; i < num_subglyphs; i++ )
+ {
+ if ( num_subglyphs > 1 )
+ FT_TRACE7(( " subglyph %d:\n", i ));
+
+ FT_TRACE7(( " glyph index: %d\n", subglyph->index ));
+
+ if ( subglyph->flags & ARGS_ARE_XY_VALUES )
+ FT_TRACE7(( " offset: x=%d, y=%d\n",
+ subglyph->arg1,
+ subglyph->arg2 ));
+ else
+ FT_TRACE7(( " matching points: base=%d, component=%d\n",
+ subglyph->arg1,
+ subglyph->arg2 ));
+
+ if ( subglyph->flags & WE_HAVE_A_SCALE )
+ FT_TRACE7(( " scaling: %f\n",
+ subglyph->transform.xx / 65536.0 ));
+ else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
+ FT_TRACE7(( " scaling: x=%f, y=%f\n",
+ subglyph->transform.xx / 65536.0,
+ subglyph->transform.yy / 65536.0 ));
+ else if ( subglyph->flags & WE_HAVE_A_2X2 )
+ FT_TRACE7(( " scaling: xx=%f, yx=%f\n"
+ " xy=%f, yy=%f\n",
+ subglyph->transform.xx / 65536.0,
+ subglyph->transform.yx / 65536.0,
+ subglyph->transform.xy / 65536.0,
+ subglyph->transform.yy / 65536.0 ));
+
+ subglyph++;
+ }
+ }
+#endif /* FT_DEBUG_LEVEL_TRACE */
#ifdef TT_USE_BYTECODE_INTERPRETER
@@ -756,7 +801,7 @@
{
FT_TRACE1(( "TT_Hint_Glyph: too long instructions" ));
FT_TRACE1(( " (0x%lx byte) is truncated\n",
- loader->glyph->control_len ));
+ loader->glyph->control_len ));
}
n_ins = loader->glyph->control_len;
@@ -889,7 +934,8 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- if ( !loader->face->is_default_instance )
+ if ( FT_IS_NAMED_INSTANCE( FT_FACE( loader->face ) ) ||
+ FT_IS_VARIATION( FT_FACE( loader->face ) ) )
{
/* Deltas apply to the unscaled data. */
error = TT_Vary_Apply_Glyph_Deltas( loader->face,
@@ -991,9 +1037,24 @@
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
+ }
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */
+ if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ||
+ !IS_HINTED( loader->load_flags ) )
+#endif
+ {
loader->pp1 = outline->points[n_points - 4];
loader->pp2 = outline->points[n_points - 3];
+ }
+
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */
+ if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ||
+ !IS_HINTED( loader->load_flags ) )
+#endif
+ {
loader->pp3 = outline->points[n_points - 2];
loader->pp4 = outline->points[n_points - 1];
}
@@ -1145,8 +1206,28 @@
if ( subglyph->flags & ROUND_XY_TO_GRID )
{
- x = FT_PIX_ROUND( x );
- y = FT_PIX_ROUND( y );
+ TT_Face face = loader->face;
+ TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
+
+
+ if ( IS_HINTED( loader->load_flags ) )
+ {
+ /*
+ * We round the horizontal offset only if there is hinting along
+ * the x axis; this corresponds to integer advance width values.
+ *
+ * Theoretically, a glyph's bytecode can toggle ClearType's
+ * `backward compatibility' mode, which would allow modification
+ * of the advance width. In reality, however, applications
+ * neither allow nor expect modified advance widths if subpixel
+ * rendering is active.
+ *
+ */
+ if ( driver->interpreter_version == TT_INTERPRETER_VERSION_35 )
+ x = FT_PIX_ROUND( x );
+
+ y = FT_PIX_ROUND( y );
+ }
}
}
}
@@ -1359,6 +1440,7 @@
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
#endif
+
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
{
@@ -1577,7 +1659,8 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- if ( !loader->face->is_default_instance )
+ if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ||
+ FT_IS_VARIATION( FT_FACE( face ) ) )
{
/* a small outline structure with four elements for */
/* communication with `TT_Vary_Apply_Glyph_Deltas' */
@@ -1711,7 +1794,7 @@
/* clear the nodes filled by sibling chains */
node = ft_list_get_node_at( &loader->composites, recurse_count );
for ( node2 = node; node2; node2 = node2->next )
- node2->data = (void*)ULONG_MAX;
+ node2->data = (void*)FT_ULONG_MAX;
/* check whether we already have a composite glyph with this index */
if ( FT_List_Find( &loader->composites,
@@ -1751,7 +1834,8 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- if ( !face->is_default_instance )
+ if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ||
+ FT_IS_VARIATION( FT_FACE( face ) ) )
{
short i, limit;
FT_SubGlyph subglyph;
@@ -2609,7 +2693,8 @@
TT_LoaderRec loader;
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#define IS_DEFAULT_INSTANCE ( ( (TT_Face)glyph->face )->is_default_instance )
+#define IS_DEFAULT_INSTANCE ( !( FT_IS_NAMED_INSTANCE( glyph->face ) || \
+ FT_IS_VARIATION( glyph->face ) ) )
#else
#define IS_DEFAULT_INSTANCE 1
#endif
@@ -2624,6 +2709,10 @@
( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
IS_DEFAULT_INSTANCE )
{
+ FT_Fixed x_scale = size->root.metrics.x_scale;
+ FT_Fixed y_scale = size->root.metrics.y_scale;
+
+
error = load_sbit_image( size, glyph, glyph_index, load_flags );
if ( FT_ERR_EQ( error, Missing_Bitmap ) )
{
@@ -2631,9 +2720,13 @@
/* if we have a bitmap-only font, return an empty glyph */
if ( !FT_IS_SCALABLE( glyph->face ) )
{
- TT_Face face = (TT_Face)glyph->face;
- FT_Short left_bearing = 0, top_bearing = 0;
- FT_UShort advance_width = 0, advance_height = 0;
+ TT_Face face = (TT_Face)glyph->face;
+
+ FT_Short left_bearing = 0;
+ FT_Short top_bearing = 0;
+
+ FT_UShort advance_width = 0;
+ FT_UShort advance_height = 0;
/* to return an empty glyph, however, we need metrics data */
@@ -2659,13 +2752,13 @@
glyph->metrics.width = 0;
glyph->metrics.height = 0;
- glyph->metrics.horiBearingX = left_bearing;
+ glyph->metrics.horiBearingX = FT_MulFix( left_bearing, x_scale );
glyph->metrics.horiBearingY = 0;
- glyph->metrics.horiAdvance = advance_width;
+ glyph->metrics.horiAdvance = FT_MulFix( advance_width, x_scale );
glyph->metrics.vertBearingX = 0;
- glyph->metrics.vertBearingY = top_bearing;
- glyph->metrics.vertAdvance = advance_height;
+ glyph->metrics.vertBearingY = FT_MulFix( top_bearing, y_scale );
+ glyph->metrics.vertAdvance = FT_MulFix( advance_height, y_scale );
glyph->format = FT_GLYPH_FORMAT_BITMAP;
glyph->bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
@@ -2696,13 +2789,11 @@
/* sanity checks: if `xxxAdvance' in the sbit metric */
/* structure isn't set, use `linearXXXAdvance' */
if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
- glyph->metrics.horiAdvance =
- FT_MulFix( glyph->linearHoriAdvance,
- size->metrics->x_scale );
+ glyph->metrics.horiAdvance = FT_MulFix( glyph->linearHoriAdvance,
+ x_scale );
if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance )
- glyph->metrics.vertAdvance =
- FT_MulFix( glyph->linearVertAdvance,
- size->metrics->y_scale );
+ glyph->metrics.vertAdvance = FT_MulFix( glyph->linearVertAdvance,
+ y_scale );
}
return FT_Err_Ok;
diff --git a/thirdparty/freetype/src/truetype/ttgload.h b/thirdparty/freetype/src/truetype/ttgload.h
index 1dd6c841db..d237cfd284 100644
--- a/thirdparty/freetype/src/truetype/ttgload.h
+++ b/thirdparty/freetype/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
/* */
/* TrueType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttgxvar.c b/thirdparty/freetype/src/truetype/ttgxvar.c
index 49aa53a687..29ab2a4efd 100644
--- a/thirdparty/freetype/src/truetype/ttgxvar.c
+++ b/thirdparty/freetype/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -1043,10 +1043,11 @@
outerIndex,
innerIndex );
- FT_TRACE5(( "%s value %d adjusted by %d units (%s)\n",
+ FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n",
vertical ? "vertical height" : "horizontal width",
*avalue,
delta,
+ delta == 1 ? "" : "s",
vertical ? "VVAR" : "HVAR" ));
*avalue += delta;
@@ -1333,13 +1334,15 @@
if ( p )
{
- FT_TRACE5(( "value %c%c%c%c (%d units) adjusted by %d units (MVAR)\n",
+ FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n",
(FT_Char)( value->tag >> 24 ),
(FT_Char)( value->tag >> 16 ),
(FT_Char)( value->tag >> 8 ),
(FT_Char)( value->tag ),
value->unmodified,
- delta ));
+ value->unmodified == 1 ? "" : "s",
+ delta,
+ delta == 1 ? "" : "s" ));
/* since we handle both signed and unsigned values as FT_Short, */
/* ensure proper overflow arithmetic */
@@ -1499,8 +1502,10 @@
blend->gv_glyphcnt = gvar_head.glyphCount;
offsetToData = gvar_start + gvar_head.offsetToData;
- FT_TRACE5(( "gvar: there are %d shared coordinates:\n",
- blend->tuplecount ));
+ FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n",
+ blend->tuplecount == 1 ? "is" : "are",
+ blend->tuplecount,
+ blend->tuplecount == 1 ? "" : "s" ));
if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) )
goto Exit;
@@ -1728,15 +1733,13 @@
/* based on the [min,def,max] values for the axis to be [-1,0,1]. */
/* Then, if there's an `avar' table, we renormalize this range. */
- FT_TRACE5(( "design coordinates:\n" ));
-
a = mmvar->axis;
for ( i = 0; i < num_coords; i++, a++ )
{
FT_Fixed coord = coords[i];
- FT_TRACE5(( " %.5f\n", coord / 65536.0 ));
+ FT_TRACE5(( " %d: %.5f\n", i, coord / 65536.0 ));
if ( coord > a->maximum || coord < a->minimum )
{
FT_TRACE1((
@@ -1746,17 +1749,17 @@
a->minimum / 65536.0,
a->maximum / 65536.0 ));
- if ( coord > a->maximum)
+ if ( coord > a->maximum )
coord = a->maximum;
else
coord = a->minimum;
}
if ( coord < a->def )
- normalized[i] = -FT_DivFix( coords[i] - a->def,
+ normalized[i] = -FT_DivFix( coord - a->def,
a->minimum - a->def );
else if ( coord > a->def )
- normalized[i] = FT_DivFix( coords[i] - a->def,
+ normalized[i] = FT_DivFix( coord - a->def,
a->maximum - a->def );
else
normalized[i] = 0;
@@ -1822,16 +1825,8 @@
nc = blend->num_axis;
}
- if ( face->doblend )
- {
- for ( i = 0; i < nc; i++ )
- design[i] = coords[i];
- }
- else
- {
- for ( i = 0; i < nc; i++ )
- design[i] = 0;
- }
+ for ( i = 0; i < nc; i++ )
+ design[i] = coords[i];
for ( ; i < num_coords; i++ )
design[i] = 0;
@@ -1940,11 +1935,11 @@
TT_Get_MM_Var( TT_Face face,
FT_MM_Var* *master )
{
- FT_Stream stream = face->root.stream;
- FT_Memory memory = face->root.memory;
+ FT_Stream stream = face->root.stream;
+ FT_Memory memory = face->root.memory;
FT_ULong table_len;
- FT_Error error = FT_Err_Ok;
- FT_ULong fvar_start;
+ FT_Error error = FT_Err_Ok;
+ FT_ULong fvar_start = 0;
FT_UInt i, j;
FT_MM_Var* mmvar = NULL;
FT_Fixed* next_coords;
@@ -1954,10 +1949,20 @@
FT_Fixed* c;
FT_Var_Named_Style* ns;
GX_FVar_Head fvar_head;
- FT_Bool usePsName;
+ FT_Bool usePsName = 0;
FT_UInt num_instances;
+ FT_UInt num_axes;
FT_UShort* axis_flags;
+ FT_Offset mmvar_size;
+ FT_Offset axis_flags_size;
+ FT_Offset axis_size;
+ FT_Offset namedstyle_size;
+ FT_Offset next_coords_size;
+ FT_Offset next_name_size;
+
+ FT_Bool need_init;
+
static const FT_Frame_Field fvar_fields[] =
{
@@ -1995,7 +2000,9 @@
/* read the font data and set up the internal representation */
/* if not already done */
- if ( !face->blend )
+ need_init = !face->blend;
+
+ if ( need_init )
{
FT_TRACE2(( "FVAR " ));
@@ -2032,26 +2039,57 @@
FT_TRACE2(( "loaded\n" ));
- FT_TRACE5(( "number of GX style axes: %d\n", fvar_head.axisCount ));
+ FT_TRACE5(( "%d variation ax%s\n",
+ fvar_head.axisCount,
+ fvar_head.axisCount == 1 ? "is" : "es" ));
if ( FT_NEW( face->blend ) )
goto Exit;
- /* `num_instances' holds the number of all named instances, */
- /* including the default instance which might be missing */
- /* in fvar's table of named instances */
- num_instances = face->root.style_flags >> 16;
-
- /* prepare storage area for MM data; this cannot overflow */
- /* 32-bit arithmetic because of the size limits used in the */
- /* `fvar' table validity check in `sfnt_init_face' */
- face->blend->mmvar_len =
- sizeof ( FT_MM_Var ) +
- fvar_head.axisCount * sizeof ( FT_UShort ) +
- fvar_head.axisCount * sizeof ( FT_Var_Axis ) +
- num_instances * sizeof ( FT_Var_Named_Style ) +
- num_instances * fvar_head.axisCount * sizeof ( FT_Fixed ) +
- fvar_head.axisCount * 5;
+ num_axes = fvar_head.axisCount;
+ face->blend->num_axis = num_axes;
+ }
+ else
+ num_axes = face->blend->num_axis;
+
+ /* `num_instances' holds the number of all named instances, */
+ /* including the default instance which might be missing */
+ /* in fvar's table of named instances */
+ num_instances = (FT_UInt)face->root.style_flags >> 16;
+
+ /* prepare storage area for MM data; this cannot overflow */
+ /* 32-bit arithmetic because of the size limits used in the */
+ /* `fvar' table validity check in `sfnt_init_face' */
+
+ /* the various `*_size' variables, which we also use as */
+ /* offsets into the `mmlen' array, must be multiples of the */
+ /* pointer size (except the last one); without such an */
+ /* alignment there might be runtime errors due to */
+ /* misaligned addresses */
+#undef ALIGN_SIZE
+#define ALIGN_SIZE( n ) \
+ ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) )
+
+ mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) );
+ axis_flags_size = ALIGN_SIZE( num_axes *
+ sizeof ( FT_UShort ) );
+ axis_size = ALIGN_SIZE( num_axes *
+ sizeof ( FT_Var_Axis ) );
+ namedstyle_size = ALIGN_SIZE( num_instances *
+ sizeof ( FT_Var_Named_Style ) );
+ next_coords_size = ALIGN_SIZE( num_instances *
+ num_axes *
+ sizeof ( FT_Fixed ) );
+ next_name_size = num_axes * 5;
+
+ if ( need_init )
+ {
+ face->blend->mmvar_len = mmvar_size +
+ axis_flags_size +
+ axis_size +
+ namedstyle_size +
+ next_coords_size +
+ next_name_size;
if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) )
goto Exit;
@@ -2061,7 +2099,7 @@
/* the data gets filled in later on */
mmvar->num_axis =
- fvar_head.axisCount;
+ num_axes;
mmvar->num_designs =
~0U; /* meaningless in this context; each glyph */
/* may have a different number of designs */
@@ -2071,22 +2109,23 @@
/* alas, no public field in `FT_Var_Axis' for axis flags */
axis_flags =
- (FT_UShort*)&( mmvar[1] );
+ (FT_UShort*)( (char*)mmvar + mmvar_size );
mmvar->axis =
- (FT_Var_Axis*)&( axis_flags[fvar_head.axisCount] );
+ (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size );
mmvar->namedstyle =
- (FT_Var_Named_Style*)&( mmvar->axis[fvar_head.axisCount] );
+ (FT_Var_Named_Style*)( (char*)mmvar->axis + axis_size );
- next_coords =
- (FT_Fixed*)&( mmvar->namedstyle[num_instances] );
+ next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle +
+ namedstyle_size );
for ( i = 0; i < num_instances; i++ )
{
mmvar->namedstyle[i].coords = next_coords;
- next_coords += fvar_head.axisCount;
+ next_coords += num_axes;
}
- next_name = (FT_String*)next_coords;
- for ( i = 0; i < fvar_head.axisCount; i++ )
+ next_name = (FT_String*)( (char*)mmvar->namedstyle +
+ namedstyle_size + next_coords_size );
+ for ( i = 0; i < num_axes; i++ )
{
mmvar->axis[i].name = next_name;
next_name += 5;
@@ -2098,10 +2137,14 @@
goto Exit;
a = mmvar->axis;
- for ( i = 0; i < fvar_head.axisCount; i++ )
+ for ( i = 0; i < num_axes; i++ )
{
GX_FVar_Axis axis_rec;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ int invalid = 0;
+#endif
+
if ( FT_STREAM_READ_FIELDS( fvaraxis_fields, &axis_rec ) )
goto Exit;
@@ -2122,22 +2165,31 @@
if ( a->minimum > a->def ||
a->def > a->maximum )
{
- FT_TRACE2(( "TT_Get_MM_Var:"
- " invalid \"%s\" axis record; disabling\n",
- a->name ));
-
a->minimum = a->def;
a->maximum = a->def;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ invalid = 1;
+#endif
}
- FT_TRACE5(( " \"%s\":"
- " minimum=%.5f, default=%.5f, maximum=%.5f,"
- " flags=0x%04X\n",
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( i == 0 )
+ FT_TRACE5(( " idx tag "
+ /* " XXX `XXXX'" */
+ " minimum default maximum flags\n" ));
+ /* " XXXX.XXXXX XXXX.XXXXX XXXX.XXXXX 0xXXXX" */
+
+ FT_TRACE5(( " %3d `%s'"
+ " %10.5f %10.5f %10.5f 0x%04X%s\n",
+ i,
a->name,
a->minimum / 65536.0,
a->def / 65536.0,
a->maximum / 65536.0,
- *axis_flags ));
+ *axis_flags,
+ invalid ? " (invalid, disabled)" : "" ));
+#endif
a++;
axis_flags++;
@@ -2148,7 +2200,7 @@
/* named instance coordinates are stored as design coordinates; */
/* we have to convert them to normalized coordinates also */
if ( FT_NEW_ARRAY( face->blend->normalized_stylecoords,
- fvar_head.axisCount * num_instances ) )
+ num_axes * num_instances ) )
goto Exit;
if ( fvar_head.instanceCount && !face->blend->avar_loaded )
@@ -2162,20 +2214,24 @@
goto Exit;
}
+ FT_TRACE5(( "%d instance%s\n",
+ fvar_head.instanceCount,
+ fvar_head.instanceCount == 1 ? "" : "s" ));
+
ns = mmvar->namedstyle;
nsc = face->blend->normalized_stylecoords;
for ( i = 0; i < fvar_head.instanceCount; i++, ns++ )
{
/* PostScript names add 2 bytes to the instance record size */
if ( FT_FRAME_ENTER( ( usePsName ? 6L : 4L ) +
- 4L * fvar_head.axisCount ) )
+ 4L * num_axes ) )
goto Exit;
ns->strid = FT_GET_USHORT();
(void) /* flags = */ FT_GET_USHORT();
c = ns->coords;
- for ( j = 0; j < fvar_head.axisCount; j++, c++ )
+ for ( j = 0; j < num_axes; j++, c++ )
*c = FT_GET_LONG();
/* valid psid values are 6, [256;32767], and 0xFFFF */
@@ -2184,11 +2240,54 @@
else
ns->psid = 0xFFFF;
- ft_var_to_normalized( face,
- fvar_head.axisCount,
- ns->coords,
- nsc );
- nsc += fvar_head.axisCount;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ {
+ SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+
+ FT_String* strname = NULL;
+ FT_String* psname = NULL;
+
+ FT_ULong pos;
+
+
+ pos = FT_STREAM_POS();
+
+ if ( ns->strid != 0xFFFF )
+ {
+ (void)sfnt->get_name( face,
+ (FT_UShort)ns->strid,
+ &strname );
+ if ( strname && !ft_strcmp( strname, ".notdef" ) )
+ strname = NULL;
+ }
+
+ if ( ns->psid != 0xFFFF )
+ {
+ (void)sfnt->get_name( face,
+ (FT_UShort)ns->psid,
+ &psname );
+ if ( psname && !ft_strcmp( psname, ".notdef" ) )
+ psname = NULL;
+ }
+
+ (void)FT_STREAM_SEEK( pos );
+
+ FT_TRACE5(( " instance %d (%s%s%s, %s%s%s)\n",
+ i,
+ strname ? "name: `" : "",
+ strname ? strname : "unnamed",
+ strname ? "'" : "",
+ psname ? "PS name: `" : "",
+ psname ? psname : "no PS name",
+ psname ? "'" : "" ));
+
+ FT_FREE( strname );
+ FT_FREE( psname );
+ }
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+ ft_var_to_normalized( face, num_axes, ns->coords, nsc );
+ nsc += num_axes;
FT_FRAME_EXIT();
}
@@ -2237,7 +2336,7 @@
a = mmvar->axis;
c = ns->coords;
- for ( j = 0; j < fvar_head.axisCount; j++, a++, c++ )
+ for ( j = 0; j < num_axes; j++, a++, c++ )
*c = a->def;
}
}
@@ -2258,23 +2357,24 @@
FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len );
axis_flags =
- (FT_UShort*)&( mmvar[1] );
+ (FT_UShort*)( (char*)mmvar + mmvar_size );
mmvar->axis =
- (FT_Var_Axis*)&( axis_flags[mmvar->num_axis] );
+ (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size );
mmvar->namedstyle =
- (FT_Var_Named_Style*)&( mmvar->axis[mmvar->num_axis] );
+ (FT_Var_Named_Style*)( (char*)mmvar->axis+ axis_size );
- next_coords =
- (FT_Fixed*)&( mmvar->namedstyle[mmvar->num_namedstyles] );
+ next_coords = (FT_Fixed*)( (char*)mmvar->namedstyle +
+ namedstyle_size );
for ( n = 0; n < mmvar->num_namedstyles; n++ )
{
mmvar->namedstyle[n].coords = next_coords;
- next_coords += mmvar->num_axis;
+ next_coords += num_axes;
}
a = mmvar->axis;
- next_name = (FT_String*)next_coords;
- for ( n = 0; n < mmvar->num_axis; n++ )
+ next_name = (FT_String*)( (char*)mmvar->namedstyle +
+ namedstyle_size + next_coords_size );
+ for ( n = 0; n < num_axes; n++ )
{
a->name = next_name;
@@ -2309,10 +2409,9 @@
FT_Error error = FT_Err_Ok;
GX_Blend blend;
FT_MM_Var* mmvar;
- FT_UInt i, j;
+ FT_UInt i;
- FT_Bool is_default_instance = TRUE;
- FT_Bool all_design_coords = FALSE;
+ FT_Bool all_design_coords = FALSE;
FT_Memory memory = face->root.memory;
@@ -2344,11 +2443,12 @@
num_coords = mmvar->num_axis;
}
- FT_TRACE5(( "normalized design coordinates:\n" ));
+ FT_TRACE5(( "TT_Set_MM_Blend:\n"
+ " normalized design coordinates:\n" ));
for ( i = 0; i < num_coords; i++ )
{
- FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 ));
+ FT_TRACE5(( " %.5f\n", coords[i] / 65536.0 ));
if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L )
{
FT_TRACE1(( "TT_Set_MM_Blend: normalized design coordinate %.5f\n"
@@ -2357,9 +2457,6 @@
error = FT_THROW( Invalid_Argument );
goto Exit;
}
-
- if ( coords[i] != 0 )
- is_default_instance = FALSE;
}
FT_TRACE5(( "\n" ));
@@ -2390,6 +2487,12 @@
}
else
{
+ FT_Bool have_diff = 0;
+ FT_UInt j;
+ FT_Fixed* c;
+ FT_Fixed* n;
+
+
manageCvt = mcvt_retain;
for ( i = 0; i < num_coords; i++ )
@@ -2397,10 +2500,34 @@
if ( blend->normalizedcoords[i] != coords[i] )
{
manageCvt = mcvt_load;
+ have_diff = 1;
break;
}
}
+ if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) )
+ {
+ FT_UInt idx = (FT_UInt)face->root.face_index >> 16;
+
+
+ c = blend->normalizedcoords + i;
+ n = blend->normalized_stylecoords + idx * mmvar->num_axis + i;
+ for ( j = i; j < mmvar->num_axis; j++, n++, c++ )
+ if ( *c != *n )
+ have_diff = 1;
+ }
+ else
+ {
+ c = blend->normalizedcoords + i;
+ for ( j = i; j < mmvar->num_axis; j++, c++ )
+ if ( *c != 0 )
+ have_diff = 1;
+ }
+
+ /* return value -1 indicates `no change' */
+ if ( !have_diff )
+ return -1;
+
for ( ; i < mmvar->num_axis; i++ )
{
if ( blend->normalizedcoords[i] != 0 )
@@ -2454,32 +2581,6 @@
}
}
- /* check whether the current variation tuple coincides */
- /* with a named instance */
-
- for ( i = 0; i < blend->mmvar->num_namedstyles; i++ )
- {
- FT_Fixed* nsc = blend->normalized_stylecoords + i * blend->num_axis;
- FT_Fixed* ns = blend->normalizedcoords;
-
-
- for ( j = 0; j < blend->num_axis; j++, nsc++, ns++ )
- {
- if ( *nsc != *ns )
- break;
- }
-
- if ( j == blend->num_axis )
- break;
- }
-
- /* adjust named instance index */
- face->root.face_index &= 0xFFFF;
- if ( i < blend->mmvar->num_namedstyles )
- face->root.face_index |= ( i + 1 ) << 16;
-
- face->is_default_instance = is_default_instance;
-
/* enforce recomputation of the PostScript name; */
FT_FREE( face->postscript_name );
face->postscript_name = NULL;
@@ -2519,7 +2620,19 @@
FT_UInt num_coords,
FT_Fixed* coords )
{
- return tt_set_mm_blend( face, num_coords, coords, 1 );
+ FT_Error error;
+
+
+ error = tt_set_mm_blend( face, num_coords, coords, 1 );
+ if ( error )
+ return error;
+
+ if ( num_coords )
+ face->root.face_flags |= FT_FACE_FLAG_VARIATION;
+ else
+ face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
+
+ return FT_Err_Ok;
}
@@ -2635,11 +2748,12 @@
FT_UInt i;
FT_Memory memory = face->root.memory;
- FT_Var_Axis* a;
- FT_Fixed* c;
-
+ FT_Fixed* c;
+ FT_Fixed* n;
FT_Fixed* normalized = NULL;
+ FT_Bool have_diff = 0;
+
if ( !face->blend )
{
@@ -2664,14 +2778,56 @@
goto Exit;
}
- FT_MEM_COPY( blend->coords,
- coords,
- num_coords * sizeof ( FT_Fixed ) );
+ c = blend->coords;
+ n = coords;
+ for ( i = 0; i < num_coords; i++, n++, c++ )
+ {
+ if ( *c != *n )
+ {
+ *c = *n;
+ have_diff = 1;
+ }
+ }
+
+ if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) )
+ {
+ FT_UInt instance_index;
+ FT_Var_Named_Style* named_style;
+
+
+ instance_index = (FT_UInt)face->root.face_index >> 16;
+ named_style = mmvar->namedstyle + instance_index - 1;
+
+ n = named_style->coords + num_coords;
+ for ( ; i < mmvar->num_axis; i++, n++, c++ )
+ {
+ if ( *c != *n )
+ {
+ *c = *n;
+ have_diff = 1;
+ }
+ }
+ }
+ else
+ {
+ FT_Var_Axis* a;
- a = mmvar->axis + num_coords;
- c = blend->coords + num_coords;
- for ( i = num_coords; i < mmvar->num_axis; i++, a++, c++ )
- *c = a->def;
+
+ a = mmvar->axis + num_coords;
+ for ( ; i < mmvar->num_axis; i++, a++, c++ )
+ {
+ if ( *c != a->def )
+ {
+ *c = a->def;
+ have_diff = 1;
+ }
+ }
+ }
+
+ /* return value -1 indicates `no change'; */
+ /* we can exit early if `normalizedcoords' is already computed */
+ if ( blend->normalizedcoords && !have_diff )
+ return -1;
if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) )
goto Exit;
@@ -2679,9 +2835,18 @@
if ( !face->blend->avar_loaded )
ft_var_load_avar( face );
+ FT_TRACE5(( "TT_Set_Var_Design:\n"
+ " normalized design coordinates:\n" ));
ft_var_to_normalized( face, num_coords, blend->coords, normalized );
error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 );
+ if ( error )
+ goto Exit;
+
+ if ( num_coords )
+ face->root.face_flags |= FT_FACE_FLAG_VARIATION;
+ else
+ face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
Exit:
FT_FREE( normalized );
@@ -2765,6 +2930,90 @@
/*************************************************************************/
+ /* */
+ /* <Function> */
+ /* TT_Set_Named_Instance */
+ /* */
+ /* <Description> */
+ /* Set the given named instance, also resetting any further */
+ /* variation. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the source face. */
+ /* */
+ /* instance_index :: The instance index, starting with value 1. */
+ /* Value 0 indicates to not use an instance. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0~means success. */
+ /* */
+ FT_LOCAL_DEF( FT_Error )
+ TT_Set_Named_Instance( TT_Face face,
+ FT_UInt instance_index )
+ {
+ FT_Error error = FT_ERR( Invalid_Argument );
+ GX_Blend blend;
+ FT_MM_Var* mmvar;
+
+ FT_UInt num_instances;
+
+
+ if ( !face->blend )
+ {
+ if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) )
+ goto Exit;
+ }
+
+ blend = face->blend;
+ mmvar = blend->mmvar;
+
+ num_instances = (FT_UInt)face->root.style_flags >> 16;
+
+ /* `instance_index' starts with value 1, thus `>' */
+ if ( instance_index > num_instances )
+ goto Exit;
+
+ if ( instance_index > 0 && mmvar->namedstyle )
+ {
+ FT_Memory memory = face->root.memory;
+ SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+
+ FT_Var_Named_Style* named_style;
+ FT_String* style_name;
+
+
+ named_style = mmvar->namedstyle + instance_index - 1;
+
+ error = sfnt->get_name( face,
+ (FT_UShort)named_style->strid,
+ &style_name );
+ if ( error )
+ goto Exit;
+
+ /* set (or replace) style name */
+ FT_FREE( face->root.style_name );
+ face->root.style_name = style_name;
+
+ /* finally, select the named instance */
+ error = TT_Set_Var_Design( face,
+ mmvar->num_axis,
+ named_style->coords );
+ if ( error )
+ goto Exit;
+ }
+ else
+ error = TT_Set_Var_Design( face, 0, NULL );
+
+ face->root.face_index = ( instance_index << 16 ) |
+ ( face->root.face_index & 0xFFFFL );
+ face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
+
+ Exit:
+ return error;
+ }
+
+
+ /*************************************************************************/
/*************************************************************************/
/***** *****/
/***** GX VAR PARSING ROUTINES *****/
@@ -2810,8 +3059,10 @@
FT_Fixed* im_start_coords = NULL;
FT_Fixed* im_end_coords = NULL;
GX_Blend blend = face->blend;
- FT_UInt point_count;
- FT_UShort* localpoints;
+ FT_UInt point_count, spoint_count = 0;
+ FT_UShort* sharedpoints = NULL;
+ FT_UShort* localpoints = NULL;
+ FT_UShort* points;
FT_Short* deltas;
@@ -2880,11 +3131,24 @@
offsetToData += table_start;
- /* The documentation implies there are flags packed into */
- /* `tupleCount', but John Jenkins says that shared points don't apply */
- /* to `cvar', and no other flags are defined. */
+ if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS )
+ {
+ here = FT_Stream_FTell( stream );
+
+ FT_Stream_SeekSet( stream, offsetToData );
- FT_TRACE5(( "cvar: there are %d tuples:\n", tupleCount & 0xFFF ));
+ sharedpoints = ft_var_readpackedpoints( stream,
+ table_len,
+ &spoint_count );
+ offsetToData = FT_Stream_FTell( stream );
+
+ FT_Stream_SeekSet( stream, here );
+ }
+
+ FT_TRACE5(( "cvar: there %s %d tuple%s:\n",
+ ( tupleCount & 0xFFF ) == 1 ? "is" : "are",
+ tupleCount & 0xFFF,
+ ( tupleCount & 0xFFF ) == 1 ? "" : "s" ));
for ( i = 0; i < ( tupleCount & 0xFFF ); i++ )
{
@@ -2898,26 +3162,25 @@
tupleDataSize = FT_GET_USHORT();
tupleIndex = FT_GET_USHORT();
- /* There is no provision here for a global tuple coordinate section, */
- /* so John says. There are no tuple indices, just embedded tuples. */
-
if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
{
for ( j = 0; j < blend->num_axis; j++ )
tuple_coords[j] = FT_GET_SHORT() * 4; /* convert from */
/* short frac to fixed */
}
- else
+ else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
{
- /* skip this tuple; it makes no sense */
-
- if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
- for ( j = 0; j < 2 * blend->num_axis; j++ )
- (void)FT_GET_SHORT();
+ FT_TRACE2(( "tt_face_vary_cvt:"
+ " invalid tuple index\n" ));
- offsetToData += tupleDataSize;
- continue;
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
}
+ else
+ FT_MEM_COPY(
+ tuple_coords,
+ &blend->tuplecoords[( tupleIndex & 0xFFF ) * blend->num_axis],
+ blend->num_axis * sizeof ( FT_Fixed ) );
if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
{
@@ -2932,11 +3195,8 @@
tuple_coords,
im_start_coords,
im_end_coords );
- if ( /* tuple isn't active for our blend */
- apply == 0 ||
- /* global points not allowed, */
- /* if they aren't local, makes no sense */
- !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) )
+
+ if ( apply == 0 ) /* tuple isn't active for our blend */
{
offsetToData += tupleDataSize;
continue;
@@ -2946,14 +3206,27 @@
FT_Stream_SeekSet( stream, offsetToData );
- localpoints = ft_var_readpackedpoints( stream,
- table_len,
- &point_count );
- deltas = ft_var_readpackeddeltas( stream,
- table_len,
- point_count == 0 ? face->cvt_size
- : point_count );
- if ( !localpoints || !deltas )
+ if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
+ {
+ localpoints = ft_var_readpackedpoints( stream,
+ table_len,
+ &point_count );
+ points = localpoints;
+ }
+ else
+ {
+ points = sharedpoints;
+ point_count = spoint_count;
+ }
+
+ deltas = ft_var_readpackeddeltas( stream,
+ table_len,
+ point_count == 0 ? face->cvt_size
+ : point_count );
+
+ if ( !points ||
+ !deltas ||
+ ( localpoints == ALL_POINTS && point_count != face->cvt_size ) )
; /* failure, ignore it */
else if ( localpoints == ALL_POINTS )
@@ -3005,7 +3278,7 @@
FT_Long orig_cvt;
- pindex = localpoints[j];
+ pindex = points[j];
if ( (FT_ULong)pindex >= face->cvt_size )
continue;
@@ -3044,6 +3317,8 @@
FT_FRAME_EXIT();
Exit:
+ if ( sharedpoints != ALL_POINTS )
+ FT_FREE( sharedpoints );
FT_FREE( tuple_coords );
FT_FREE( im_start_coords );
FT_FREE( im_end_coords );
@@ -3330,7 +3605,6 @@
glyph_start = FT_Stream_FTell( stream );
/* each set of glyph variation data is formatted similarly to `cvar' */
- /* (except we get shared points and global tuples) */
if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) ||
FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
@@ -3367,8 +3641,10 @@
FT_Stream_SeekSet( stream, here );
}
- FT_TRACE5(( "gvar: there are %d tuples:\n",
- tupleCount & GX_TC_TUPLE_COUNT_MASK ));
+ FT_TRACE5(( "gvar: there %s %d tuple%s:\n",
+ ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "is" : "are",
+ tupleCount & GX_TC_TUPLE_COUNT_MASK,
+ ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" ));
for ( j = 0; j < n_points; j++ )
points_org[j] = outline->points[j];
@@ -3470,7 +3746,7 @@
FT_Pos delta_y = FT_MulFix( deltas_y[j], apply );
- if ( j < n_points - 3 )
+ if ( j < n_points - 4 )
{
outline->points[j].x += delta_x;
outline->points[j].y += delta_y;
@@ -3480,25 +3756,25 @@
/* To avoid double adjustment of advance width or height, */
/* adjust phantom points only if there is no HVAR or VVAR */
/* support, respectively. */
- if ( j == ( n_points - 3 ) &&
- !( face->variation_support &
- TT_FACE_FLAG_VAR_HADVANCE ) )
+ if ( j == ( n_points - 4 ) &&
+ !( face->variation_support &
+ TT_FACE_FLAG_VAR_LSB ) )
+ outline->points[j].x += delta_x;
+
+ else if ( j == ( n_points - 3 ) &&
+ !( face->variation_support &
+ TT_FACE_FLAG_VAR_HADVANCE ) )
outline->points[j].x += delta_x;
else if ( j == ( n_points - 2 ) &&
!( face->variation_support &
- TT_FACE_FLAG_VAR_LSB ) )
- outline->points[j].x += delta_x;
+ TT_FACE_FLAG_VAR_TSB ) )
+ outline->points[j].y += delta_y;
else if ( j == ( n_points - 1 ) &&
!( face->variation_support &
TT_FACE_FLAG_VAR_VADVANCE ) )
outline->points[j].y += delta_y;
-
- else if ( j == ( n_points - 0 ) &&
- !( face->variation_support &
- TT_FACE_FLAG_VAR_TSB ) )
- outline->points[j].y += delta_y;
}
#ifdef FT_DEBUG_LEVEL_TRACE
@@ -3565,8 +3841,36 @@
FT_Pos delta_y = points_out[j].y - points_org[j].y;
- outline->points[j].x += delta_x;
- outline->points[j].y += delta_y;
+ if ( j < n_points - 4 )
+ {
+ outline->points[j].x += delta_x;
+ outline->points[j].y += delta_y;
+ }
+ else
+ {
+ /* To avoid double adjustment of advance width or height, */
+ /* adjust phantom points only if there is no HVAR or VVAR */
+ /* support, respectively. */
+ if ( j == ( n_points - 4 ) &&
+ !( face->variation_support &
+ TT_FACE_FLAG_VAR_LSB ) )
+ outline->points[j].x += delta_x;
+
+ else if ( j == ( n_points - 3 ) &&
+ !( face->variation_support &
+ TT_FACE_FLAG_VAR_HADVANCE ) )
+ outline->points[j].x += delta_x;
+
+ else if ( j == ( n_points - 2 ) &&
+ !( face->variation_support &
+ TT_FACE_FLAG_VAR_TSB ) )
+ outline->points[j].y += delta_y;
+
+ else if ( j == ( n_points - 1 ) &&
+ !( face->variation_support &
+ TT_FACE_FLAG_VAR_VADVANCE ) )
+ outline->points[j].y += delta_y;
+ }
#ifdef FT_DEBUG_LEVEL_TRACE
if ( delta_x || delta_y )
diff --git a/thirdparty/freetype/src/truetype/ttgxvar.h b/thirdparty/freetype/src/truetype/ttgxvar.h
index 7e81719a3e..a37bb90266 100644
--- a/thirdparty/freetype/src/truetype/ttgxvar.h
+++ b/thirdparty/freetype/src/truetype/ttgxvar.h
@@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader (specification) */
/* */
-/* Copyright 2004-2017 by */
+/* Copyright 2004-2018 by */
/* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -27,6 +27,8 @@
FT_BEGIN_HEADER
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+
/*************************************************************************/
/* */
/* <Struct> */
@@ -402,6 +404,10 @@ FT_BEGIN_HEADER
FT_Fixed* coords );
FT_LOCAL( FT_Error )
+ TT_Set_Named_Instance( TT_Face face,
+ FT_UInt instance_index );
+
+ FT_LOCAL( FT_Error )
tt_face_vary_cvt( TT_Face face,
FT_Stream stream );
@@ -435,6 +441,8 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
tt_done_blend( TT_Face face );
+#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
+
FT_END_HEADER
diff --git a/thirdparty/freetype/src/truetype/ttinterp.c b/thirdparty/freetype/src/truetype/ttinterp.c
index ddcc839bb3..da9b595aba 100644
--- a/thirdparty/freetype/src/truetype/ttinterp.c
+++ b/thirdparty/freetype/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -25,7 +25,7 @@
#include FT_INTERNAL_CALC_H
#include FT_TRIGONOMETRY_H
#include FT_SYSTEM_H
-#include FT_TRUETYPE_DRIVER_H
+#include FT_DRIVER_H
#include FT_MULTIPLE_MASTERS_H
#include "ttinterp.h"
@@ -2165,7 +2165,7 @@
val = ADD_LONG( distance,
exc->threshold - exc->phase + compensation ) &
-exc->period;
- val += exc->phase;
+ val = ADD_LONG( val, exc->phase );
if ( val < 0 )
val = exc->phase;
}
@@ -2174,7 +2174,7 @@
val = NEG_LONG( SUB_LONG( exc->threshold - exc->phase + compensation,
distance ) &
-exc->period );
- val -= exc->phase;
+ val = SUB_LONG( val, exc->phase );
if ( val > 0 )
val = -exc->phase;
}
@@ -2216,7 +2216,7 @@
val = ( ADD_LONG( distance,
exc->threshold - exc->phase + compensation ) /
exc->period ) * exc->period;
- val += exc->phase;
+ val = ADD_LONG( val, exc->phase );
if ( val < 0 )
val = exc->phase;
}
@@ -2225,7 +2225,7 @@
val = NEG_LONG( ( SUB_LONG( exc->threshold - exc->phase + compensation,
distance ) /
exc->period ) * exc->period );
- val -= exc->phase;
+ val = SUB_LONG( val, exc->phase );
if ( val > 0 )
val = -exc->phase;
}
@@ -2954,7 +2954,7 @@
static void
Ins_CEILING( FT_Long* args )
{
- args[0] = FT_PIX_CEIL( args[0] );
+ args[0] = FT_PIX_CEIL_LONG( args[0] );
}
@@ -3289,7 +3289,10 @@
if ( args[0] < 0 )
exc->error = FT_THROW( Bad_Argument );
else
- exc->GS.loop = args[0];
+ {
+ /* we heuristically limit the number of loops to 16 bits */
+ exc->GS.loop = args[0] > 0xFFFFL ? 0xFFFFL : args[0];
+ }
}
@@ -5690,7 +5693,11 @@
( B1 & 63 ) != 0 &&
( B2 & 63 ) != 0 &&
B1 != B2 )
- Move_Zp2_Point( exc, point, -dx, -dy, TRUE );
+ Move_Zp2_Point( exc,
+ point,
+ NEG_LONG( dx ),
+ NEG_LONG( dy ),
+ TRUE );
}
}
else if ( exc->face->sph_compatibility_mode )
@@ -5722,7 +5729,7 @@
if ( ( B1 & 63 ) == 0 &&
( B2 & 63 ) != 0 &&
B1 != B2 )
- Move_Zp2_Point( exc, point, 0, -dy, TRUE );
+ Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE );
}
}
else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
@@ -5778,6 +5785,7 @@
FT_F26Dot6 distance;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
FT_F26Dot6 control_value_cutin = 0;
+ FT_F26Dot6 delta;
if ( SUBPIXEL_HINTING_INFINALITY )
@@ -5813,11 +5821,15 @@
distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+ delta = SUB_LONG( distance, args[1] );
+ if ( delta < 0 )
+ delta = NEG_LONG( delta );
+
/* subpixel hinting - make MSIRP respect CVT cut-in; */
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- FT_ABS( SUB_LONG( distance, args[1] ) ) >= control_value_cutin )
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.x != 0 &&
+ delta >= control_value_cutin )
distance = args[1];
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
@@ -5865,16 +5877,18 @@
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 )
- distance = Round_None(
- exc,
- cur_dist,
- exc->tt_metrics.compensations[0] ) - cur_dist;
+ distance = SUB_LONG(
+ Round_None( exc,
+ cur_dist,
+ exc->tt_metrics.compensations[0] ),
+ cur_dist );
else
#endif
- distance = exc->func_round(
- exc,
- cur_dist,
- exc->tt_metrics.compensations[0] ) - cur_dist;
+ distance = SUB_LONG(
+ exc->func_round( exc,
+ cur_dist,
+ exc->tt_metrics.compensations[0] ),
+ cur_dist );
}
else
distance = 0;
@@ -5974,7 +5988,14 @@
if ( ( exc->opcode & 1 ) != 0 ) /* rounding and control cut-in flag */
{
- if ( FT_ABS( distance - org_dist ) > control_value_cutin )
+ FT_F26Dot6 delta;
+
+
+ delta = SUB_LONG( distance, org_dist );
+ if ( delta < 0 )
+ delta = NEG_LONG( delta );
+
+ if ( delta > control_value_cutin )
distance = org_dist;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
@@ -5991,7 +6012,7 @@
exc->tt_metrics.compensations[0] );
}
- exc->func_move( exc, &exc->zp0, point, distance - org_dist );
+ exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) );
Fail:
exc->GS.rp0 = point;
@@ -6074,8 +6095,12 @@
/* single width cut-in test */
- if ( FT_ABS( org_dist - exc->GS.single_width_value ) <
- exc->GS.single_width_cutin )
+ /* |org_dist - single_width_value| < single_width_cutin */
+ if ( exc->GS.single_width_cutin > 0 &&
+ org_dist < exc->GS.single_width_value +
+ exc->GS.single_width_cutin &&
+ org_dist > exc->GS.single_width_value -
+ exc->GS.single_width_cutin )
{
if ( org_dist >= 0 )
org_dist = exc->GS.single_width_value;
@@ -6168,7 +6193,7 @@
minimum_distance = exc->GS.minimum_distance;
control_value_cutin = exc->GS.control_value_cutin;
point = (FT_UShort)args[0];
- cvtEntry = (FT_ULong)( args[1] + 1 );
+ cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) );
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( SUBPIXEL_HINTING_INFINALITY &&
@@ -6251,6 +6276,9 @@
if ( exc->GS.gep0 == exc->GS.gep1 )
{
+ FT_F26Dot6 delta;
+
+
/* XXX: According to Greg Hitchcock, the following wording is */
/* the right one: */
/* */
@@ -6263,7 +6291,11 @@
/* `ttinst2.doc', version 1.66, is thus incorrect since */
/* it implies `>=' instead of `>'. */
- if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin )
+ delta = SUB_LONG( cvt_dist, org_dist );
+ if ( delta < 0 )
+ delta = NEG_LONG( delta );
+
+ if ( delta > control_value_cutin )
cvt_dist = org_dist;
}
@@ -6281,7 +6313,14 @@
exc->ignore_x_mode &&
exc->GS.gep0 == exc->GS.gep1 )
{
- if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin )
+ FT_F26Dot6 delta;
+
+
+ delta = SUB_LONG( cvt_dist, org_dist );
+ if ( delta < 0 )
+ delta = NEG_LONG( delta );
+
+ if ( delta > control_value_cutin )
cvt_dist = org_dist;
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
@@ -7153,7 +7192,7 @@
SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) &&
( B1 & 63 ) != 0 &&
( B2 & 63 ) != 0 ) ) )
- exc->func_move( exc, &exc->zp0, A, -B );
+ exc->func_move( exc, &exc->zp0, A, NEG_LONG( B ) );
}
}
else
@@ -7524,8 +7563,16 @@
return;
}
- for ( i = 0; i < num_axes; i++ )
- args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */
+ if ( coords )
+ {
+ for ( i = 0; i < num_axes; i++ )
+ args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */
+ }
+ else
+ {
+ for ( i = 0; i < num_axes; i++ )
+ args[i] = 0;
+ }
}
@@ -8478,7 +8525,9 @@
} while ( !exc->instruction_trap );
LNo_Error_:
- FT_TRACE4(( " %d instructions executed\n", ins_counter ));
+ FT_TRACE4(( " %d instruction%s executed\n",
+ ins_counter,
+ ins_counter == 1 ? "" : "s" ));
return FT_Err_Ok;
LErrorCodeOverflow_:
diff --git a/thirdparty/freetype/src/truetype/ttinterp.h b/thirdparty/freetype/src/truetype/ttinterp.h
index abbecfcee3..2966439ea2 100644
--- a/thirdparty/freetype/src/truetype/ttinterp.h
+++ b/thirdparty/freetype/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttobjs.c b/thirdparty/freetype/src/truetype/ttobjs.c
index 081fa2f1a5..6685dc8196 100644
--- a/thirdparty/freetype/src/truetype/ttobjs.c
+++ b/thirdparty/freetype/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
/* */
/* Objects manager (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,7 +21,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_DRIVER_H
+#include FT_DRIVER_H
#include "ttgload.h"
#include "ttpload.h"
@@ -147,7 +147,7 @@
{
#define TRICK_NAMES_MAX_CHARACTERS 19
-#define TRICK_NAMES_COUNT 18
+#define TRICK_NAMES_COUNT 26
static const char trick_names[TRICK_NAMES_COUNT]
[TRICK_NAMES_MAX_CHARACTERS + 1] =
@@ -165,9 +165,17 @@
"cpop", /* dftt-p7.ttf; version 1.00, 1992 [DLJGyShoMedium] */
"DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */
+ "DFGothic-EB", /* DynaLab Inc. 1992-1995 */
+ "DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */
+ "DFHei-Md-HK-BF", /* maybe DynaLab Inc. */
+ "DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */
+ "DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */
+ "DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */
"DFKaiSho-SB", /* dfkaisb.ttf */
"DFKaiShu",
+ "DFKaiShu-Md-HK-BF", /* maybe DynaLab Inc. */
"DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */
+ "DFMing-Bd-HK-BF", /* maybe DynaLab Inc. */
"DLC", /* dftt-m7.ttf; version 1.00, 1993 [DLCMingBold] */
/* dftt-f5.ttf; version 1.00, 1993 [DLCFongSung] */
"DLCHayMedium", /* dftt-b5.ttf; version 1.00, 1993 */
@@ -265,7 +273,7 @@
tt_check_trickyness_sfnt_ids( TT_Face face )
{
#define TRICK_SFNT_IDS_PER_FACE 3
-#define TRICK_SFNT_IDS_NUM_FACES 19
+#define TRICK_SFNT_IDS_NUM_FACES 29
static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
[TRICK_SFNT_IDS_PER_FACE] = {
@@ -284,6 +292,36 @@
{ 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
{ 0xA344A1EBUL, 0x000001E1UL } /* prep */
},
+ { /* DFGothic-EB */
+ { 0x12C3EBB2UL, 0x00000350UL }, /* cvt */
+ { 0xB680EE64UL, 0x000087A7UL }, /* fpgm */
+ { 0xCE939563UL, 0x00000758UL } /* prep */
+ },
+ { /* DFGyoSho-Lt */
+ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
+ { 0xCE5956E9UL, 0x0000BC85UL }, /* fpgm */
+ { 0x8272F416UL, 0x00000045UL } /* prep */
+ },
+ { /* DFHei-Md-HK-BF */
+ { 0x1257EB46UL, 0x00000350UL }, /* cvt */
+ { 0xF699D160UL, 0x0000715FUL }, /* fpgm */
+ { 0xD222F568UL, 0x000003BCUL } /* prep */
+ },
+ { /* DFHSGothic-W5 */
+ { 0x1262EB4EUL, 0x00000350UL }, /* cvt */
+ { 0xE86A5D64UL, 0x00007940UL }, /* fpgm */
+ { 0x7850F729UL, 0x000005FFUL } /* prep */
+ },
+ { /* DFHSMincho-W3 */
+ { 0x122DEB0AUL, 0x00000350UL }, /* cvt */
+ { 0x3D16328AUL, 0x0000859BUL }, /* fpgm */
+ { 0xA93FC33BUL, 0x000002CBUL } /* prep */
+ },
+ { /* DFHSMincho-W7 */
+ { 0x125FEB26UL, 0x00000350UL }, /* cvt */
+ { 0xA5ACC982UL, 0x00007EE1UL }, /* fpgm */
+ { 0x90999196UL, 0x0000041FUL } /* prep */
+ },
{ /* DFKaiShu */
{ 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
{ 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */
@@ -294,6 +332,26 @@
{ 0xA6E78C01UL, 0x00008998UL }, /* fpgm */
{ 0x13A42602UL, 0x0000007EUL } /* prep */
},
+ { /* DFKaiShu-Md-HK-BF */
+ { 0x11E5EAD4UL, 0x00000360UL }, /* cvt */
+ { 0x9DB282B2UL, 0x0000C06EUL }, /* fpgm */
+ { 0x53E6D7CAUL, 0x00000082UL } /* prep */
+ },
+ { /* DFMing-Bd-HK-BF */
+ { 0x1243EB18UL, 0x00000350UL }, /* cvt */
+ { 0xBA0A8C30UL, 0x000074ADUL }, /* fpgm */
+ { 0xF3D83409UL, 0x0000037BUL } /* prep */
+ },
+ { /* DLCLiShu */
+ { 0x07DCF546UL, 0x00000308UL }, /* cvt */
+ { 0x40FE7C90UL, 0x00008E2AUL }, /* fpgm */
+ { 0x608174B5UL, 0x0000007AUL } /* prep */
+ },
+ { /* DLCHayBold */
+ { 0xEB891238UL, 0x00000308UL }, /* cvt */
+ { 0xD2E4DCD4UL, 0x0000676FUL }, /* fpgm */
+ { 0x8EA5F293UL, 0x000003B8UL } /* prep */
+ },
{ /* HuaTianKaiTi */
{ 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
{ 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */
@@ -657,46 +715,17 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
{
- FT_Int instance_index = face_index >> 16;
+ FT_UInt instance_index = (FT_UInt)face_index >> 16;
if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
instance_index > 0 )
{
- error = TT_Get_MM_Var( face, NULL );
+ error = TT_Set_Named_Instance( face, instance_index );
if ( error )
goto Exit;
- if ( face->blend->mmvar->namedstyle )
- {
- FT_Memory memory = ttface->memory;
-
- FT_Var_Named_Style* named_style;
- FT_String* style_name;
-
-
- /* in `face_index', the instance index starts with value 1 */
- named_style = face->blend->mmvar->namedstyle + instance_index - 1;
- error = sfnt->get_name( face,
- (FT_UShort)named_style->strid,
- &style_name );
- if ( error )
- goto Exit;
-
- /* set style name; if already set, replace it */
- if ( face->root.style_name )
- FT_FREE( face->root.style_name );
- face->root.style_name = style_name;
-
- /* finally, select the named instance */
- error = TT_Set_Var_Design( face,
- face->blend->mmvar->num_axis,
- named_style->coords );
- if ( error )
- goto Exit;
-
- tt_apply_mvar( face );
- }
+ tt_apply_mvar( face );
}
}
diff --git a/thirdparty/freetype/src/truetype/ttobjs.h b/thirdparty/freetype/src/truetype/ttobjs.h
index cdacee75e5..38fa30e4e9 100644
--- a/thirdparty/freetype/src/truetype/ttobjs.h
+++ b/thirdparty/freetype/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
/* */
/* Objects manager (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttpic.c b/thirdparty/freetype/src/truetype/ttpic.c
index 66bd7e1934..cdbb80639e 100644
--- a/thirdparty/freetype/src/truetype/ttpic.c
+++ b/thirdparty/freetype/src/truetype/ttpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for truetype module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttpic.h b/thirdparty/freetype/src/truetype/ttpic.h
index 1410cd73c3..df878ae6f1 100644
--- a/thirdparty/freetype/src/truetype/ttpic.h
+++ b/thirdparty/freetype/src/truetype/ttpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for truetype module. */
/* */
-/* Copyright 2009-2017 by */
+/* Copyright 2009-2018 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttpload.c b/thirdparty/freetype/src/truetype/ttpload.c
index bcf6b34f67..d9526ad082 100644
--- a/thirdparty/freetype/src/truetype/ttpload.c
+++ b/thirdparty/freetype/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
/* */
/* TrueType-specific tables loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttpload.h b/thirdparty/freetype/src/truetype/ttpload.h
index 79079f345a..fa12527247 100644
--- a/thirdparty/freetype/src/truetype/ttpload.h
+++ b/thirdparty/freetype/src/truetype/ttpload.h
@@ -4,7 +4,7 @@
/* */
/* TrueType-specific tables loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/truetype/ttsubpix.c b/thirdparty/freetype/src/truetype/ttsubpix.c
index 1c8cf01109..d94bcc8b50 100644
--- a/thirdparty/freetype/src/truetype/ttsubpix.c
+++ b/thirdparty/freetype/src/truetype/ttsubpix.c
@@ -4,7 +4,7 @@
/* */
/* TrueType Subpixel Hinting. */
/* */
-/* Copyright 2010-2017 by */
+/* Copyright 2010-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,7 +22,7 @@
#include FT_INTERNAL_SFNT_H
#include FT_TRUETYPE_TAGS_H
#include FT_OUTLINE_H
-#include FT_TRUETYPE_DRIVER_H
+#include FT_DRIVER_H
#include "ttsubpix.h"
@@ -753,24 +753,24 @@
/* Does font name match rule family? */
- if ( strcmp( detected_font_name, rule_font_name ) == 0 )
+ if ( ft_strcmp( detected_font_name, rule_font_name ) == 0 )
return TRUE;
/* Is font name a wildcard ""? */
- if ( strcmp( rule_font_name, "" ) == 0 )
+ if ( ft_strcmp( rule_font_name, "" ) == 0 )
return TRUE;
/* Is font name contained in a class list? */
for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ )
{
- if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 )
+ if ( ft_strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 )
{
for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ )
{
- if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 )
+ if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 )
continue;
- if ( strcmp( FAMILY_CLASS_Rules[i].member[j],
- detected_font_name ) == 0 )
+ if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j],
+ detected_font_name ) == 0 )
return TRUE;
}
}
@@ -788,24 +788,24 @@
/* Does font style match rule style? */
- if ( strcmp( detected_font_style, rule_font_style ) == 0 )
+ if ( ft_strcmp( detected_font_style, rule_font_style ) == 0 )
return TRUE;
/* Is font style a wildcard ""? */
- if ( strcmp( rule_font_style, "" ) == 0 )
+ if ( ft_strcmp( rule_font_style, "" ) == 0 )
return TRUE;
/* Is font style contained in a class list? */
for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ )
{
- if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 )
+ if ( ft_strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 )
{
for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ )
{
- if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 )
+ if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 )
continue;
- if ( strcmp( STYLE_CLASS_Rules[i].member[j],
- detected_font_style ) == 0 )
+ if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j],
+ detected_font_style ) == 0 )
return TRUE;
}
}
diff --git a/thirdparty/freetype/src/truetype/ttsubpix.h b/thirdparty/freetype/src/truetype/ttsubpix.h
index c68f97ff07..1070bb016f 100644
--- a/thirdparty/freetype/src/truetype/ttsubpix.h
+++ b/thirdparty/freetype/src/truetype/ttsubpix.h
@@ -4,7 +4,7 @@
/* */
/* TrueType Subpixel Hinting. */
/* */
-/* Copyright 2010-2017 by */
+/* Copyright 2010-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/module.mk b/thirdparty/freetype/src/type1/module.mk
index f299d6fe88..3fea5cc16f 100644
--- a/thirdparty/freetype/src/type1/module.mk
+++ b/thirdparty/freetype/src/type1/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/type1/rules.mk b/thirdparty/freetype/src/type1/rules.mk
index 97bef288f0..cb1a142860 100644
--- a/thirdparty/freetype/src/type1/rules.mk
+++ b/thirdparty/freetype/src/type1/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/type1/t1afm.c b/thirdparty/freetype/src/type1/t1afm.c
index 11a2646fc2..61053d9a64 100644
--- a/thirdparty/freetype/src/type1/t1afm.c
+++ b/thirdparty/freetype/src/type1/t1afm.c
@@ -4,7 +4,7 @@
/* */
/* AFM support for Type 1 fonts (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1afm.h b/thirdparty/freetype/src/type1/t1afm.h
index 9f62cd013d..cb8d302b4d 100644
--- a/thirdparty/freetype/src/type1/t1afm.h
+++ b/thirdparty/freetype/src/type1/t1afm.h
@@ -4,7 +4,7 @@
/* */
/* AFM support for Type 1 fonts (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1driver.c b/thirdparty/freetype/src/type1/t1driver.c
index c2089947f9..029b410b47 100644
--- a/thirdparty/freetype/src/type1/t1driver.c
+++ b/thirdparty/freetype/src/type1/t1driver.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 driver interface (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -30,6 +30,8 @@
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_HASH_H
+#include FT_INTERNAL_POSTSCRIPT_PROPS_H
+#include FT_DRIVER_H
#include FT_SERVICE_MULTIPLE_MASTERS_H
#include FT_SERVICE_GLYPH_DICT_H
@@ -37,6 +39,7 @@
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include FT_SERVICE_PROPERTIES_H
#include FT_SERVICE_KERNING_H
@@ -126,6 +129,7 @@
(FT_Get_MM_Var_Func) T1_Get_MM_Var, /* get_mm_var */
(FT_Set_Var_Design_Func)T1_Set_Var_Design, /* set_var_design */
(FT_Get_Var_Design_Func)T1_Get_Var_Design, /* get_var_design */
+ (FT_Set_Instance_Func) T1_Reset_MM_Blend, /* set_instance */
(FT_Get_Var_Blend_Func) NULL, /* get_var_blend */
(FT_Done_Blend_Func) T1_Done_Blend /* done_blend */
@@ -614,6 +618,18 @@
/*
+ * PROPERTY SERVICE
+ *
+ */
+
+ FT_DEFINE_SERVICE_PROPERTIESREC(
+ t1_service_properties,
+
+ (FT_Properties_SetFunc)ps_property_set, /* set_property */
+ (FT_Properties_GetFunc)ps_property_get ) /* get_property */
+
+
+ /*
* SERVICE LIST
*
*/
@@ -624,6 +640,7 @@
{ FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict },
{ FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TYPE_1 },
{ FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info },
+ { FT_SERVICE_ID_PROPERTIES, &t1_service_properties },
#ifndef T1_CONFIG_OPTION_NO_AFM
{ FT_SERVICE_ID_KERNING, &t1_service_kerning },
@@ -713,7 +730,7 @@
FT_MODULE_DRIVER_SCALABLE |
FT_MODULE_DRIVER_HAS_HINTER,
- sizeof ( FT_DriverRec ),
+ sizeof ( PS_DriverRec ),
"type1",
0x10000L,
diff --git a/thirdparty/freetype/src/type1/t1driver.h b/thirdparty/freetype/src/type1/t1driver.h
index 292786448d..2b1507233d 100644
--- a/thirdparty/freetype/src/type1/t1driver.h
+++ b/thirdparty/freetype/src/type1/t1driver.h
@@ -4,7 +4,7 @@
/* */
/* High-level Type 1 driver interface (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1errors.h b/thirdparty/freetype/src/type1/t1errors.h
index 492dbb4a42..9e0151b957 100644
--- a/thirdparty/freetype/src/type1/t1errors.h
+++ b/thirdparty/freetype/src/type1/t1errors.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1gload.c b/thirdparty/freetype/src/type1/t1gload.c
index aaf19b6dcc..87d40e7566 100644
--- a/thirdparty/freetype/src/type1/t1gload.c
+++ b/thirdparty/freetype/src/type1/t1gload.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 Glyph Loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,6 +23,8 @@
#include FT_INTERNAL_STREAM_H
#include FT_OUTLINE_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include FT_INTERNAL_CFF_TYPES_H
+#include FT_DRIVER_H
#include "t1errors.h"
@@ -37,37 +39,28 @@
#define FT_COMPONENT trace_t1gload
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
- /********** *********/
- /********** The following code is in charge of computing *********/
- /********** the maximum advance width of the font. It *********/
- /********** quickly processes each glyph charstring to *********/
- /********** extract the value from either a `sbw' or `seac' *********/
- /********** operator. *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
static FT_Error
T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
FT_UInt glyph_index,
- FT_Data* char_string )
+ FT_Data* char_string,
+ FT_Bool* force_scaling )
{
T1_Face face = (T1_Face)decoder->builder.face;
T1_Font type1 = &face->type1;
FT_Error error = FT_Err_Ok;
+ PSAux_Service psaux = (PSAux_Service)face->psaux;
+ const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
+ PS_Decoder psdecoder;
+
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec *inc =
face->root.internal->incremental_interface;
#endif
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
+#endif
decoder->font_matrix = type1->font_matrix;
decoder->font_offset = type1->font_offset;
@@ -90,9 +83,56 @@
}
if ( !error )
- error = decoder->funcs.parse_charstrings(
- decoder, (FT_Byte*)char_string->pointer,
- (FT_UInt)char_string->length );
+ {
+ /* choose which renderer to use */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ if ( driver->hinting_engine == FT_HINTING_FREETYPE ||
+ decoder->builder.metrics_only )
+ error = decoder_funcs->parse_charstrings_old(
+ decoder,
+ (FT_Byte*)char_string->pointer,
+ (FT_UInt)char_string->length );
+#else
+ if ( decoder->builder.metrics_only )
+ error = decoder_funcs->parse_metrics(
+ decoder,
+ (FT_Byte*)char_string->pointer,
+ (FT_UInt)char_string->length );
+#endif
+ else
+ {
+ CFF_SubFontRec subfont;
+
+
+ psaux->ps_decoder_init( &psdecoder, decoder, TRUE );
+
+ psaux->t1_make_subfont( FT_FACE( face ),
+ &face->type1.private_dict, &subfont );
+ psdecoder.current_subfont = &subfont;
+
+ error = decoder_funcs->parse_charstrings(
+ &psdecoder,
+ (FT_Byte*)char_string->pointer,
+ (FT_ULong)char_string->length );
+
+ /* Adobe's engine uses 16.16 numbers everywhere; */
+ /* as a consequence, glyphs larger than 2000ppem get rejected */
+ if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
+ {
+ /* this time, we retry unhinted and scale up the glyph later on */
+ /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
+ /* 0x400 for both `x_scale' and `y_scale' in this case) */
+ ((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE;
+
+ *force_scaling = TRUE;
+
+ error = decoder_funcs->parse_charstrings(
+ &psdecoder,
+ (FT_Byte*)char_string->pointer,
+ (FT_ULong)char_string->length );
+ }
+ }
+ }
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -126,8 +166,10 @@
FT_UInt glyph_index )
{
FT_Data glyph_data;
- FT_Error error = T1_Parse_Glyph_And_Get_Char_String(
- decoder, glyph_index, &glyph_data );
+ FT_Bool force_scaling = FALSE;
+ FT_Error error = T1_Parse_Glyph_And_Get_Char_String(
+ decoder, glyph_index, &glyph_data,
+ &force_scaling );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -149,6 +191,23 @@
}
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /********** *********/
+ /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
+ /********** *********/
+ /********** The following code is in charge of computing *********/
+ /********** the maximum advance width of the font. It *********/
+ /********** quickly processes each glyph charstring to *********/
+ /********** extract the value from either a `sbw' or `seac' *********/
+ /********** operator. *********/
+ /********** *********/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
FT_LOCAL_DEF( FT_Error )
T1_Compute_Max_Advance( T1_Face face,
FT_Pos* max_advance )
@@ -278,6 +337,8 @@
T1_DecoderRec decoder;
T1_Face face = (T1_Face)t1glyph->face;
FT_Bool hinting;
+ FT_Bool scaled;
+ FT_Bool force_scaling = FALSE;
T1_Font type1 = &face->type1;
PSAux_Service psaux = (PSAux_Service)face->psaux;
const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
@@ -325,7 +386,10 @@
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
+ scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
+ glyph->hint = hinting;
+ glyph->scaled = scaled;
t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
error = decoder_funcs->init( &decoder,
@@ -355,13 +419,15 @@
/* now load the unscaled outline */
error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,
- &glyph_data );
+ &glyph_data,
+ &force_scaling );
if ( error )
goto Exit;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
glyph_data_loaded = 1;
#endif
+ hinting = glyph->hint;
font_matrix = decoder.font_matrix;
font_offset = decoder.font_offset;
@@ -451,7 +517,7 @@
}
#endif
- if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
+ if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
{
/* scale the outline and the metrics */
FT_Int n;
diff --git a/thirdparty/freetype/src/type1/t1gload.h b/thirdparty/freetype/src/type1/t1gload.h
index cc4d5e734f..72ef76f6ae 100644
--- a/thirdparty/freetype/src/type1/t1gload.h
+++ b/thirdparty/freetype/src/type1/t1gload.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 Glyph Loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1load.c b/thirdparty/freetype/src/type1/t1load.c
index f569d6bec3..9dfa637a69 100644
--- a/thirdparty/freetype/src/type1/t1load.c
+++ b/thirdparty/freetype/src/type1/t1load.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 font loader (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -366,14 +366,16 @@
}
- FT_LOCAL_DEF( FT_Error )
- T1_Set_MM_Blend( T1_Face face,
+ static FT_Error
+ t1_set_mm_blend( T1_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
PS_Blend blend = face->blend;
FT_UInt n, m;
+ FT_Bool have_diff = 0;
+
if ( !blend )
return FT_THROW( Invalid_Argument );
@@ -405,9 +407,36 @@
result = FT_MulFix( result, factor );
}
- blend->weight_vector[n] = result;
+
+ if ( blend->weight_vector[n] != result )
+ {
+ blend->weight_vector[n] = result;
+ have_diff = 1;
+ }
}
+ /* return value -1 indicates `no change' */
+ return have_diff ? FT_Err_Ok : -1;
+ }
+
+
+ FT_LOCAL_DEF( FT_Error )
+ T1_Set_MM_Blend( T1_Face face,
+ FT_UInt num_coords,
+ FT_Fixed* coords )
+ {
+ FT_Error error;
+
+
+ error = t1_set_mm_blend( face, num_coords, coords );
+ if ( error )
+ return error;
+
+ if ( num_coords )
+ face->root.face_flags |= FT_FACE_FLAG_VARIATION;
+ else
+ face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
+
return FT_Err_Ok;
}
@@ -452,6 +481,7 @@
FT_UInt num_coords,
FT_Long* coords )
{
+ FT_Error error;
PS_Blend blend = face->blend;
FT_UInt n, p;
FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
@@ -518,7 +548,28 @@
final_blends[n] = the_blend;
}
- return T1_Set_MM_Blend( face, blend->num_axis, final_blends );
+ error = t1_set_mm_blend( face, blend->num_axis, final_blends );
+ if ( error )
+ return error;
+
+ if ( num_coords )
+ face->root.face_flags |= FT_FACE_FLAG_VARIATION;
+ else
+ face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
+
+ return FT_Err_Ok;
+ }
+
+
+ /* MM fonts don't have named instances, so only the design is reset */
+
+ FT_LOCAL_DEF( FT_Error )
+ T1_Reset_MM_Blend( T1_Face face,
+ FT_UInt instance_index )
+ {
+ FT_UNUSED( instance_index );
+
+ return T1_Set_MM_Blend( face, 0, NULL );
}
@@ -1266,7 +1317,7 @@
if ( ft_isdigit( *cur ) || *cur == '[' )
{
T1_Encoding encode = &face->type1.encoding;
- FT_Int count, n;
+ FT_Int count, array_size, n;
PS_Table char_table = &loader->encoding_table;
FT_Memory memory = parser->root.memory;
FT_Error error;
@@ -1283,13 +1334,12 @@
else
count = (FT_Int)T1_ToInt( parser );
- /* only composite fonts (which we don't support) */
- /* can have larger values */
+ array_size = count;
if ( count > 256 )
{
- FT_ERROR(( "parse_encoding: invalid encoding array size\n" ));
- parser->root.error = FT_THROW( Invalid_File_Format );
- return;
+ FT_TRACE2(( "parse_encoding:"
+ " only using first 256 encoding array entries\n" ));
+ array_size = 256;
}
T1_Skip_Spaces( parser );
@@ -1305,18 +1355,18 @@
}
/* we use a T1_Table to store our charnames */
- loader->num_chars = encode->num_chars = count;
- if ( FT_NEW_ARRAY( encode->char_index, count ) ||
- FT_NEW_ARRAY( encode->char_name, count ) ||
+ loader->num_chars = encode->num_chars = array_size;
+ if ( FT_NEW_ARRAY( encode->char_index, array_size ) ||
+ FT_NEW_ARRAY( encode->char_name, array_size ) ||
FT_SET_ERROR( psaux->ps_table_funcs->init(
- char_table, count, memory ) ) )
+ char_table, array_size, memory ) ) )
{
parser->root.error = error;
return;
}
/* We need to `zero' out encoding_table.elements */
- for ( n = 0; n < count; n++ )
+ for ( n = 0; n < array_size; n++ )
{
char* notdef = (char *)".notdef";
@@ -1409,11 +1459,14 @@
len = (FT_UInt)( parser->root.cursor - cur );
- parser->root.error = T1_Add_Table( char_table, charcode,
- cur, len + 1 );
- if ( parser->root.error )
- return;
- char_table->elements[charcode][len] = '\0';
+ if ( n < array_size )
+ {
+ parser->root.error = T1_Add_Table( char_table, charcode,
+ cur, len + 1 );
+ if ( parser->root.error )
+ return;
+ char_table->elements[charcode][len] = '\0';
+ }
n++;
}
@@ -2440,6 +2493,24 @@
type1->encoding.num_chars = loader.num_chars;
}
+ /* some sanitizing to avoid overflows later on; */
+ /* the upper limits are ad-hoc values */
+ if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
+ {
+ FT_TRACE2(( "T1_Open_Face:"
+ " setting unlikely BlueShift value %d to default (7)\n",
+ priv->blue_shift ));
+ priv->blue_shift = 7;
+ }
+
+ if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
+ {
+ FT_TRACE2(( "T1_Open_Face:"
+ " setting unlikely BlueFuzz value %d to default (1)\n",
+ priv->blue_fuzz ));
+ priv->blue_fuzz = 1;
+ }
+
Exit:
t1_done_loader( &loader );
return error;
diff --git a/thirdparty/freetype/src/type1/t1load.h b/thirdparty/freetype/src/type1/t1load.h
index 2d86984f0e..03be3f7f93 100644
--- a/thirdparty/freetype/src/type1/t1load.h
+++ b/thirdparty/freetype/src/type1/t1load.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 font loader (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -90,6 +90,10 @@ FT_BEGIN_HEADER
FT_Long* coords );
FT_LOCAL( FT_Error )
+ T1_Reset_MM_Blend( T1_Face face,
+ FT_UInt instance_index );
+
+ FT_LOCAL( FT_Error )
T1_Get_Var_Design( T1_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
diff --git a/thirdparty/freetype/src/type1/t1objs.c b/thirdparty/freetype/src/type1/t1objs.c
index 5ac1292ae0..7333c4c958 100644
--- a/thirdparty/freetype/src/type1/t1objs.c
+++ b/thirdparty/freetype/src/type1/t1objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,6 +21,7 @@
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_IDS_H
+#include FT_DRIVER_H
#include "t1gload.h"
#include "t1load.h"
@@ -379,7 +380,7 @@
/* simplistic and might get some things wrong. For a full-featured */
/* algorithm you might have a look at the whitepaper given at */
/* */
- /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */
+ /* https://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */
/* get style name -- be careful, some broken fonts only */
/* have a `/FontName' dictionary entry! */
@@ -578,9 +579,42 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
- T1_Driver_Init( FT_Module driver )
+ T1_Driver_Init( FT_Module module )
{
- FT_UNUSED( driver );
+ PS_Driver driver = (PS_Driver)module;
+
+ FT_UInt32 seed;
+
+
+ /* set default property values, cf. `ftt1drv.h' */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+ driver->hinting_engine = FT_HINTING_FREETYPE;
+#else
+ driver->hinting_engine = FT_HINTING_ADOBE;
+#endif
+
+ driver->no_stem_darkening = TRUE;
+
+ driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
+ driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
+ driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
+ driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
+ driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
+ driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
+ driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
+ driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
+
+ /* compute random seed from some memory addresses */
+ seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
+ (FT_Offset)(char*)&module ^
+ (FT_Offset)(char*)module->memory );
+ seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
+
+ driver->random_seed = (FT_Int32)seed;
+ if ( driver->random_seed < 0 )
+ driver->random_seed = -driver->random_seed;
+ else if ( driver->random_seed == 0 )
+ driver->random_seed = 123456789;
return FT_Err_Ok;
}
diff --git a/thirdparty/freetype/src/type1/t1objs.h b/thirdparty/freetype/src/type1/t1objs.h
index 39d26bf8b9..8298e036f4 100644
--- a/thirdparty/freetype/src/type1/t1objs.h
+++ b/thirdparty/freetype/src/type1/t1objs.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -120,12 +120,12 @@ FT_BEGIN_HEADER
FT_Bool hint;
FT_Bool scaled;
- FT_Int max_points;
- FT_Int max_contours;
-
FT_Fixed x_scale;
FT_Fixed y_scale;
+ FT_Int max_points;
+ FT_Int max_contours;
+
} T1_GlyphSlotRec;
diff --git a/thirdparty/freetype/src/type1/t1parse.c b/thirdparty/freetype/src/type1/t1parse.c
index 18dd26434c..8e201e5ef5 100644
--- a/thirdparty/freetype/src/type1/t1parse.c
+++ b/thirdparty/freetype/src/type1/t1parse.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 parser (body). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1parse.h b/thirdparty/freetype/src/type1/t1parse.h
index 3396680d1a..4ac82ae913 100644
--- a/thirdparty/freetype/src/type1/t1parse.h
+++ b/thirdparty/freetype/src/type1/t1parse.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 parser (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/t1tokens.h b/thirdparty/freetype/src/type1/t1tokens.h
index ca0c55f903..43a65d88ea 100644
--- a/thirdparty/freetype/src/type1/t1tokens.h
+++ b/thirdparty/freetype/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
/* */
/* Type 1 tokenizer (specification). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type1/type1.c b/thirdparty/freetype/src/type1/type1.c
index 81795376ef..72eff59bfe 100644
--- a/thirdparty/freetype/src/type1/type1.c
+++ b/thirdparty/freetype/src/type1/type1.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Type 1 driver component (body only). */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/module.mk b/thirdparty/freetype/src/type42/module.mk
index 2f52806808..3d4732bb6f 100644
--- a/thirdparty/freetype/src/type42/module.mk
+++ b/thirdparty/freetype/src/type42/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2002-2017 by
+# Copyright 2002-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/type42/rules.mk b/thirdparty/freetype/src/type42/rules.mk
index d7e8965015..9325d3898f 100644
--- a/thirdparty/freetype/src/type42/rules.mk
+++ b/thirdparty/freetype/src/type42/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2002-2017 by
+# Copyright 2002-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/type42/t42drivr.c b/thirdparty/freetype/src/type42/t42drivr.c
index 366cfb3a1d..f579b2708c 100644
--- a/thirdparty/freetype/src/type42/t42drivr.c
+++ b/thirdparty/freetype/src/type42/t42drivr.c
@@ -4,7 +4,7 @@
/* */
/* High-level Type 42 driver interface (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42drivr.h b/thirdparty/freetype/src/type42/t42drivr.h
index 1ac4a0a1a1..3667f3e066 100644
--- a/thirdparty/freetype/src/type42/t42drivr.h
+++ b/thirdparty/freetype/src/type42/t42drivr.h
@@ -4,7 +4,7 @@
/* */
/* High-level Type 42 driver interface (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42error.h b/thirdparty/freetype/src/type42/t42error.h
index fda92abf57..e3978a7607 100644
--- a/thirdparty/freetype/src/type42/t42error.h
+++ b/thirdparty/freetype/src/type42/t42error.h
@@ -4,7 +4,7 @@
/* */
/* Type 42 error codes (specification only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42objs.c b/thirdparty/freetype/src/type42/t42objs.c
index 1c4ebd768a..66e5c40382 100644
--- a/thirdparty/freetype/src/type42/t42objs.c
+++ b/thirdparty/freetype/src/type42/t42objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 42 objects manager (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42objs.h b/thirdparty/freetype/src/type42/t42objs.h
index eb4c5bf69f..3bad5135e0 100644
--- a/thirdparty/freetype/src/type42/t42objs.h
+++ b/thirdparty/freetype/src/type42/t42objs.h
@@ -4,7 +4,7 @@
/* */
/* Type 42 objects manager (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42parse.c b/thirdparty/freetype/src/type42/t42parse.c
index e7c6770bd2..4813d1f3f9 100644
--- a/thirdparty/freetype/src/type42/t42parse.c
+++ b/thirdparty/freetype/src/type42/t42parse.c
@@ -4,7 +4,7 @@
/* */
/* Type 42 font parser (body). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42parse.h b/thirdparty/freetype/src/type42/t42parse.h
index 7a68606f2e..f35d23de63 100644
--- a/thirdparty/freetype/src/type42/t42parse.h
+++ b/thirdparty/freetype/src/type42/t42parse.h
@@ -4,7 +4,7 @@
/* */
/* Type 42 font parser (specification). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/t42types.h b/thirdparty/freetype/src/type42/t42types.h
index 2306ab6c77..d0aa2de570 100644
--- a/thirdparty/freetype/src/type42/t42types.h
+++ b/thirdparty/freetype/src/type42/t42types.h
@@ -4,7 +4,7 @@
/* */
/* Type 42 font data types (specification only). */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/type42/type42.c b/thirdparty/freetype/src/type42/type42.c
index ae8ac26782..6a89cfbed1 100644
--- a/thirdparty/freetype/src/type42/type42.c
+++ b/thirdparty/freetype/src/type42/type42.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Type 42 driver component. */
/* */
-/* Copyright 2002-2017 by */
+/* Copyright 2002-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/winfonts/fnterrs.h b/thirdparty/freetype/src/winfonts/fnterrs.h
index 4251021a70..3a86af5aac 100644
--- a/thirdparty/freetype/src/winfonts/fnterrs.h
+++ b/thirdparty/freetype/src/winfonts/fnterrs.h
@@ -4,7 +4,7 @@
/* */
/* Win FNT/FON error codes (specification only). */
/* */
-/* Copyright 2001-2017 by */
+/* Copyright 2001-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/thirdparty/freetype/src/winfonts/module.mk b/thirdparty/freetype/src/winfonts/module.mk
index ffc53a19f9..13f9077cfc 100644
--- a/thirdparty/freetype/src/winfonts/module.mk
+++ b/thirdparty/freetype/src/winfonts/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/winfonts/rules.mk b/thirdparty/freetype/src/winfonts/rules.mk
index 73e825d9ae..d694d1a771 100644
--- a/thirdparty/freetype/src/winfonts/rules.mk
+++ b/thirdparty/freetype/src/winfonts/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2017 by
+# Copyright 1996-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/thirdparty/freetype/src/winfonts/winfnt.c b/thirdparty/freetype/src/winfonts/winfnt.c
index 4c47962319..36bd3148d5 100644
--- a/thirdparty/freetype/src/winfonts/winfnt.c
+++ b/thirdparty/freetype/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
/* */
/* FreeType font driver for Windows FNT/FON files */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* Copyright 2003 Huw D M Davies for Codeweavers */
/* Copyright 2007 Dmitry Timoshkov for Codeweavers */
diff --git a/thirdparty/freetype/src/winfonts/winfnt.h b/thirdparty/freetype/src/winfonts/winfnt.h
index 884b645a2d..4885c9d745 100644
--- a/thirdparty/freetype/src/winfonts/winfnt.h
+++ b/thirdparty/freetype/src/winfonts/winfnt.h
@@ -4,7 +4,7 @@
/* */
/* FreeType font driver for Windows FNT/FON files */
/* */
-/* Copyright 1996-2017 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* Copyright 2007 Dmitry Timoshkov for Codeweavers */
/* */
diff --git a/thirdparty/glad/KHR/khrplatform.h b/thirdparty/glad/KHR/khrplatform.h
index 1ad3554a76..975bbffed6 100644
--- a/thirdparty/glad/KHR/khrplatform.h
+++ b/thirdparty/glad/KHR/khrplatform.h
@@ -2,7 +2,7 @@
#define __khrplatform_h_
/*
-** Copyright (c) 2008-2009 The Khronos Group Inc.
+** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -26,18 +26,16 @@
/* Khronos platform-specific types and definitions.
*
- * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
+ * The master copy of khrplatform.h is maintained in the Khronos EGL
+ * Registry repository at https://github.com/KhronosGroup/EGL-Registry
+ * The last semantic modification to khrplatform.h was at commit ID:
+ * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
- * Please submit changes by sending them to the public Khronos Bugzilla
- * (http://khronos.org/bugzilla) by filing a bug against product
- * "Khronos (general)" component "Registry".
- *
- * A predefined template which fills in some of the bug fields can be
- * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
- * must create a Bugzilla login first.
+ * Please submit changes by filing pull requests or issues on
+ * the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c
index f87ec8cf93..8f8b2189ec 100644
--- a/thirdparty/glad/glad.c
+++ b/thirdparty/glad/glad.c
@@ -1,21 +1,23 @@
/*
- OpenGL loader generated by glad 0.1.16a0 on Thu Nov 30 06:21:28 2017.
+ OpenGL loader generated by glad 0.1.20a0 on Fri May 4 21:44:11 2018.
Language/Generator: C/C++
Specification: gl
APIs: gl=3.3
Profile: compatibility
Extensions:
- GL_ARB_debug_output
+ GL_ARB_debug_output,
+ GL_ARB_framebuffer_object,
+ GL_EXT_framebuffer_object
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
- --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output"
+ --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
Online:
- http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output
+ http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
*/
#include <stdio.h>
@@ -25,21 +27,40 @@
static void* get_proc(const char *namez);
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h>
static HMODULE libGL;
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
+#ifdef _MSC_VER
+#ifdef __has_include
+ #if __has_include(<winapifamily.h>)
+ #define HAVE_WINAPIFAMILY 1
+ #endif
+#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
+ #define HAVE_WINAPIFAMILY 1
+#endif
+#endif
+
+#ifdef HAVE_WINAPIFAMILY
+ #include <winapifamily.h>
+ #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+ #define IS_UWP 1
+ #endif
+#endif
+
static
int open_gl(void) {
+#ifndef IS_UWP
libGL = LoadLibraryW(L"opengl32.dll");
if(libGL != NULL) {
gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(
libGL, "wglGetProcAddress");
return gladGetProcAddressPtr != NULL;
}
+#endif
return 0;
}
@@ -47,7 +68,7 @@ int open_gl(void) {
static
void close_gl(void) {
if(libGL != NULL) {
- FreeLibrary(libGL);
+ FreeLibrary((HMODULE) libGL);
libGL = NULL;
}
}
@@ -111,8 +132,8 @@ void* get_proc(const char *namez) {
}
#endif
if(result == NULL) {
-#ifdef _WIN32
- result = (void*)GetProcAddress(libGL, namez);
+#if defined(_WIN32) || defined(__CYGWIN__)
+ result = (void*)GetProcAddress((HMODULE) libGL, namez);
#else
result = dlsym(libGL, namez);
#endif
@@ -168,7 +189,7 @@ static int get_exts(void) {
const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp);
- char *local_str = (char*)malloc((len+1) * sizeof(*exts_i));
+ char *local_str = (char*)malloc((len+1) * sizeof(char));
if(local_str != NULL) {
#if _MSC_VER >= 1400
strncpy_s(local_str, len+1, gl_str_tmp, len);
@@ -971,11 +992,30 @@ PFNGLCOLORPOINTERPROC glad_glColorPointer;
PFNGLFRONTFACEPROC glad_glFrontFace;
PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;
PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;
+int GLAD_GL_ARB_framebuffer_object;
+int GLAD_GL_EXT_framebuffer_object;
int GLAD_GL_ARB_debug_output;
PFNGLDEBUGMESSAGECONTROLARBPROC glad_glDebugMessageControlARB;
PFNGLDEBUGMESSAGEINSERTARBPROC glad_glDebugMessageInsertARB;
PFNGLDEBUGMESSAGECALLBACKARBPROC glad_glDebugMessageCallbackARB;
PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB;
+PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT;
+PFNGLBINDRENDERBUFFEREXTPROC glad_glBindRenderbufferEXT;
+PFNGLDELETERENDERBUFFERSEXTPROC glad_glDeleteRenderbuffersEXT;
+PFNGLGENRENDERBUFFERSEXTPROC glad_glGenRenderbuffersEXT;
+PFNGLRENDERBUFFERSTORAGEEXTPROC glad_glRenderbufferStorageEXT;
+PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glad_glGetRenderbufferParameterivEXT;
+PFNGLISFRAMEBUFFEREXTPROC glad_glIsFramebufferEXT;
+PFNGLBINDFRAMEBUFFEREXTPROC glad_glBindFramebufferEXT;
+PFNGLDELETEFRAMEBUFFERSEXTPROC glad_glDeleteFramebuffersEXT;
+PFNGLGENFRAMEBUFFERSEXTPROC glad_glGenFramebuffersEXT;
+PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glad_glCheckFramebufferStatusEXT;
+PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glad_glFramebufferTexture1DEXT;
+PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glad_glFramebufferTexture2DEXT;
+PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glad_glFramebufferTexture3DEXT;
+PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glad_glFramebufferRenderbufferEXT;
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glad_glGetFramebufferAttachmentParameterivEXT;
+PFNGLGENERATEMIPMAPEXTPROC glad_glGenerateMipmapEXT;
static void load_GL_VERSION_1_0(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_0) return;
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
@@ -1746,9 +1786,54 @@ static void load_GL_ARB_debug_output(GLADloadproc load) {
glad_glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)load("glDebugMessageCallbackARB");
glad_glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC)load("glGetDebugMessageLogARB");
}
+static void load_GL_ARB_framebuffer_object(GLADloadproc load) {
+ if(!GLAD_GL_ARB_framebuffer_object) return;
+ glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer");
+ glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer");
+ glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers");
+ glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers");
+ glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage");
+ glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv");
+ glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer");
+ glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer");
+ glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers");
+ glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers");
+ glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus");
+ glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D");
+ glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D");
+ glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D");
+ glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer");
+ glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv");
+ glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap");
+ glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer");
+ glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample");
+ glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer");
+}
+static void load_GL_EXT_framebuffer_object(GLADloadproc load) {
+ if(!GLAD_GL_EXT_framebuffer_object) return;
+ glad_glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)load("glIsRenderbufferEXT");
+ glad_glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)load("glBindRenderbufferEXT");
+ glad_glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)load("glDeleteRenderbuffersEXT");
+ glad_glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)load("glGenRenderbuffersEXT");
+ glad_glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)load("glRenderbufferStorageEXT");
+ glad_glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)load("glGetRenderbufferParameterivEXT");
+ glad_glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC)load("glIsFramebufferEXT");
+ glad_glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)load("glBindFramebufferEXT");
+ glad_glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)load("glDeleteFramebuffersEXT");
+ glad_glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)load("glGenFramebuffersEXT");
+ glad_glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)load("glCheckFramebufferStatusEXT");
+ glad_glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)load("glFramebufferTexture1DEXT");
+ glad_glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)load("glFramebufferTexture2DEXT");
+ glad_glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)load("glFramebufferTexture3DEXT");
+ glad_glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)load("glFramebufferRenderbufferEXT");
+ glad_glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)load("glGetFramebufferAttachmentParameterivEXT");
+ glad_glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)load("glGenerateMipmapEXT");
+}
static int find_extensionsGL(void) {
if (!get_exts()) return 0;
GLAD_GL_ARB_debug_output = has_ext("GL_ARB_debug_output");
+ GLAD_GL_ARB_framebuffer_object = has_ext("GL_ARB_framebuffer_object");
+ GLAD_GL_EXT_framebuffer_object = has_ext("GL_EXT_framebuffer_object");
free_exts();
return 1;
}
@@ -1828,6 +1913,8 @@ int gladLoadGLLoader(GLADloadproc load) {
if (!find_extensionsGL()) return 0;
load_GL_ARB_debug_output(load);
+ load_GL_ARB_framebuffer_object(load);
+ load_GL_EXT_framebuffer_object(load);
return GLVersion.major != 0 || GLVersion.minor != 0;
}
diff --git a/thirdparty/glad/glad/glad.h b/thirdparty/glad/glad/glad.h
index 69413ef65f..4eebad4f2f 100644
--- a/thirdparty/glad/glad/glad.h
+++ b/thirdparty/glad/glad/glad.h
@@ -1,21 +1,23 @@
/*
- OpenGL loader generated by glad 0.1.16a0 on Thu Nov 30 06:21:28 2017.
+ OpenGL loader generated by glad 0.1.20a0 on Fri May 4 21:44:11 2018.
Language/Generator: C/C++
Specification: gl
APIs: gl=3.3
Profile: compatibility
Extensions:
- GL_ARB_debug_output
+ GL_ARB_debug_output,
+ GL_ARB_framebuffer_object,
+ GL_EXT_framebuffer_object
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
- --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output"
+ --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions="GL_ARB_debug_output,GL_ARB_framebuffer_object,GL_EXT_framebuffer_object"
Online:
- http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output
+ http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3&extensions=GL_ARB_debug_output&extensions=GL_ARB_framebuffer_object&extensions=GL_EXT_framebuffer_object
*/
@@ -1579,7 +1581,7 @@ GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;
typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap);
GLAPI PFNGLISENABLEDPROC glad_glIsEnabled;
#define glIsEnabled glad_glIsEnabled
-typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near, GLdouble far);
+typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f);
GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange;
#define glDepthRange glad_glDepthRange
typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
@@ -3680,6 +3682,57 @@ GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv;
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
+#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
+#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
+#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
+#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
+#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
+#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
+#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
+#define GL_FRAMEBUFFER_EXT 0x8D40
+#define GL_RENDERBUFFER_EXT 0x8D41
+#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
+#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
+#define GL_STENCIL_INDEX1_EXT 0x8D46
+#define GL_STENCIL_INDEX4_EXT 0x8D47
+#define GL_STENCIL_INDEX8_EXT 0x8D48
+#define GL_STENCIL_INDEX16_EXT 0x8D49
+#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
#ifndef GL_ARB_debug_output
#define GL_ARB_debug_output 1
GLAPI int GLAD_GL_ARB_debug_output;
@@ -3696,6 +3749,65 @@ typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC)(GLuint count, GLsizei
GLAPI PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB;
#define glGetDebugMessageLogARB glad_glGetDebugMessageLogARB
#endif
+#ifndef GL_ARB_framebuffer_object
+#define GL_ARB_framebuffer_object 1
+GLAPI int GLAD_GL_ARB_framebuffer_object;
+#endif
+#ifndef GL_EXT_framebuffer_object
+#define GL_EXT_framebuffer_object 1
+GLAPI int GLAD_GL_EXT_framebuffer_object;
+typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC)(GLuint renderbuffer);
+GLAPI PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT;
+#define glIsRenderbufferEXT glad_glIsRenderbufferEXT
+typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC)(GLenum target, GLuint renderbuffer);
+GLAPI PFNGLBINDRENDERBUFFEREXTPROC glad_glBindRenderbufferEXT;
+#define glBindRenderbufferEXT glad_glBindRenderbufferEXT
+typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC)(GLsizei n, const GLuint *renderbuffers);
+GLAPI PFNGLDELETERENDERBUFFERSEXTPROC glad_glDeleteRenderbuffersEXT;
+#define glDeleteRenderbuffersEXT glad_glDeleteRenderbuffersEXT
+typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC)(GLsizei n, GLuint *renderbuffers);
+GLAPI PFNGLGENRENDERBUFFERSEXTPROC glad_glGenRenderbuffersEXT;
+#define glGenRenderbuffersEXT glad_glGenRenderbuffersEXT
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI PFNGLRENDERBUFFERSTORAGEEXTPROC glad_glRenderbufferStorageEXT;
+#define glRenderbufferStorageEXT glad_glRenderbufferStorageEXT
+typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)(GLenum target, GLenum pname, GLint *params);
+GLAPI PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glad_glGetRenderbufferParameterivEXT;
+#define glGetRenderbufferParameterivEXT glad_glGetRenderbufferParameterivEXT
+typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC)(GLuint framebuffer);
+GLAPI PFNGLISFRAMEBUFFEREXTPROC glad_glIsFramebufferEXT;
+#define glIsFramebufferEXT glad_glIsFramebufferEXT
+typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC)(GLenum target, GLuint framebuffer);
+GLAPI PFNGLBINDFRAMEBUFFEREXTPROC glad_glBindFramebufferEXT;
+#define glBindFramebufferEXT glad_glBindFramebufferEXT
+typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC)(GLsizei n, const GLuint *framebuffers);
+GLAPI PFNGLDELETEFRAMEBUFFERSEXTPROC glad_glDeleteFramebuffersEXT;
+#define glDeleteFramebuffersEXT glad_glDeleteFramebuffersEXT
+typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC)(GLsizei n, GLuint *framebuffers);
+GLAPI PFNGLGENFRAMEBUFFERSEXTPROC glad_glGenFramebuffersEXT;
+#define glGenFramebuffersEXT glad_glGenFramebuffersEXT
+typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)(GLenum target);
+GLAPI PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glad_glCheckFramebufferStatusEXT;
+#define glCheckFramebufferStatusEXT glad_glCheckFramebufferStatusEXT
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glad_glFramebufferTexture1DEXT;
+#define glFramebufferTexture1DEXT glad_glFramebufferTexture1DEXT
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glad_glFramebufferTexture2DEXT;
+#define glFramebufferTexture2DEXT glad_glFramebufferTexture2DEXT
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glad_glFramebufferTexture3DEXT;
+#define glFramebufferTexture3DEXT glad_glFramebufferTexture3DEXT
+typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glad_glFramebufferRenderbufferEXT;
+#define glFramebufferRenderbufferEXT glad_glFramebufferRenderbufferEXT
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glad_glGetFramebufferAttachmentParameterivEXT;
+#define glGetFramebufferAttachmentParameterivEXT glad_glGetFramebufferAttachmentParameterivEXT
+typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC)(GLenum target);
+GLAPI PFNGLGENERATEMIPMAPEXTPROC glad_glGenerateMipmapEXT;
+#define glGenerateMipmapEXT glad_glGenerateMipmapEXT
+#endif
#ifdef __cplusplus
}
diff --git a/thirdparty/libsimplewebm/libwebm/README.libvpx b/thirdparty/libsimplewebm/libwebm/README.libvpx
index ae62f36525..1aa93b75aa 100644
--- a/thirdparty/libsimplewebm/libwebm/README.libvpx
+++ b/thirdparty/libsimplewebm/libwebm/README.libvpx
@@ -1,5 +1,5 @@
URL: https://chromium.googlesource.com/webm/libwebm
-Version: 32d5ac49414a8914ec1e1f285f3f927c6e8ec29d
+Version: d7c62173ff6b4a5e0a2f86683a5b67db98cf09bf
License: BSD
License File: LICENSE.txt
diff --git a/thirdparty/libsimplewebm/libwebm/common/webmids.h b/thirdparty/libsimplewebm/libwebm/common/webmids.h
index 32a0c5fb91..89d722a71b 100644
--- a/thirdparty/libsimplewebm/libwebm/common/webmids.h
+++ b/thirdparty/libsimplewebm/libwebm/common/webmids.h
@@ -124,6 +124,14 @@ enum MkvId {
kMkvLuminanceMin = 0x55DA,
// end mastering metadata
// end colour
+ // projection
+ kMkvProjection = 0x7670,
+ kMkvProjectionType = 0x7671,
+ kMkvProjectionPrivate = 0x7672,
+ kMkvProjectionPoseYaw = 0x7673,
+ kMkvProjectionPosePitch = 0x7674,
+ kMkvProjectionPoseRoll = 0x7675,
+ // end projection
// audio
kMkvAudio = 0xE1,
kMkvSamplingFrequency = 0xB5,
diff --git a/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.cc b/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.cc
index bda67a5758..e7b76f7da1 100644
--- a/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.cc
+++ b/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.cc
@@ -12,51 +12,30 @@
#define MSC_COMPAT
#endif
-#include <assert.h>
-#include <float.h>
-#include <limits.h>
-#include <math.h>
-#include <string.h>
+#include <cassert>
+#include <cfloat>
+#include <climits>
+#include <cmath>
+#include <cstring>
+#include <memory>
+#include <new>
#include "common/webmids.h"
namespace mkvparser {
+const long long kStringElementSizeLimit = 20 * 1000 * 1000;
const float MasteringMetadata::kValueNotPresent = FLT_MAX;
const long long Colour::kValueNotPresent = LLONG_MAX;
+const float Projection::kValueNotPresent = FLT_MAX;
#ifdef MSC_COMPAT
inline bool isnan(double val) { return !!_isnan(val); }
inline bool isinf(double val) { return !_finite(val); }
+#else
+inline bool isnan(double val) { return std::isnan(val); }
+inline bool isinf(double val) { return std::isinf(val); }
#endif // MSC_COMPAT
-template<typename T>
-class my_auto_ptr {
- my_auto_ptr(const my_auto_ptr &);
- T *operator =(const my_auto_ptr &);
-
- T *m_ptr;
-public:
- my_auto_ptr(T *ptr) :
- m_ptr(ptr)
- {}
- my_auto_ptr() :
- m_ptr(NULL)
- {}
- ~my_auto_ptr() {
- delete m_ptr;
- }
-
- T *release() {
- T *ptr = m_ptr;
- m_ptr = NULL;
- return ptr;
- }
-
- T *operator ->() const {
- return m_ptr;
- }
-};
-
IMkvReader::~IMkvReader() {}
template <typename Type>
@@ -72,7 +51,7 @@ Type* SafeArrayAlloc(unsigned long long num_elements,
if (num_bytes != static_cast<size_t>(num_bytes))
return NULL;
- return new Type[static_cast<size_t>(num_bytes)];
+ return new (std::nothrow) Type[static_cast<size_t>(num_bytes)];
}
void GetVersion(int& major, int& minor, int& build, int& revision) {
@@ -304,7 +283,7 @@ long UnserializeFloat(IMkvReader* pReader, long long pos, long long size_,
result = d;
}
- if (isinf(result) || isnan(result))
+ if (mkvparser::isinf(result) || mkvparser::isnan(result))
return E_FILE_FORMAT_INVALID;
return 0;
@@ -347,7 +326,7 @@ long UnserializeString(IMkvReader* pReader, long long pos, long long size,
delete[] str;
str = NULL;
- if (size >= LONG_MAX || size < 0)
+ if (size >= LONG_MAX || size < 0 || size > kStringElementSizeLimit)
return E_FILE_FORMAT_INVALID;
// +1 for '\0' terminator
@@ -818,7 +797,9 @@ long long Segment::CreateInstance(IMkvReader* pReader, long long pos,
else if ((pos + size) > total)
size = -1;
- pSegment = new Segment(pReader, idpos, pos, size);
+ pSegment = new (std::nothrow) Segment(pReader, idpos, pos, size);
+ if (pSegment == NULL)
+ return E_PARSE_FAILED;
return 0; // success
}
@@ -954,7 +935,11 @@ long long Segment::ParseHeaders() {
if (m_pInfo)
return E_FILE_FORMAT_INVALID;
- m_pInfo = new SegmentInfo(this, pos, size, element_start, element_size);
+ m_pInfo = new (std::nothrow)
+ SegmentInfo(this, pos, size, element_start, element_size);
+
+ if (m_pInfo == NULL)
+ return -1;
const long status = m_pInfo->Parse();
@@ -964,7 +949,11 @@ long long Segment::ParseHeaders() {
if (m_pTracks)
return E_FILE_FORMAT_INVALID;
- m_pTracks = new Tracks(this, pos, size, element_start, element_size);
+ m_pTracks = new (std::nothrow)
+ Tracks(this, pos, size, element_start, element_size);
+
+ if (m_pTracks == NULL)
+ return -1;
const long status = m_pTracks->Parse();
@@ -972,11 +961,19 @@ long long Segment::ParseHeaders() {
return status;
} else if (id == libwebm::kMkvCues) {
if (m_pCues == NULL) {
- m_pCues = new Cues(this, pos, size, element_start, element_size);
+ m_pCues = new (std::nothrow)
+ Cues(this, pos, size, element_start, element_size);
+
+ if (m_pCues == NULL)
+ return -1;
}
} else if (id == libwebm::kMkvSeekHead) {
if (m_pSeekHead == NULL) {
- m_pSeekHead = new SeekHead(this, pos, size, element_start, element_size);
+ m_pSeekHead = new (std::nothrow)
+ SeekHead(this, pos, size, element_start, element_size);
+
+ if (m_pSeekHead == NULL)
+ return -1;
const long status = m_pSeekHead->Parse();
@@ -985,7 +982,11 @@ long long Segment::ParseHeaders() {
}
} else if (id == libwebm::kMkvChapters) {
if (m_pChapters == NULL) {
- m_pChapters = new Chapters(this, pos, size, element_start, element_size);
+ m_pChapters = new (std::nothrow)
+ Chapters(this, pos, size, element_start, element_size);
+
+ if (m_pChapters == NULL)
+ return -1;
const long status = m_pChapters->Parse();
@@ -994,7 +995,11 @@ long long Segment::ParseHeaders() {
}
} else if (id == libwebm::kMkvTags) {
if (m_pTags == NULL) {
- m_pTags = new Tags(this, pos, size, element_start, element_size);
+ m_pTags = new (std::nothrow)
+ Tags(this, pos, size, element_start, element_size);
+
+ if (m_pTags == NULL)
+ return -1;
const long status = m_pTags->Parse();
@@ -1136,7 +1141,9 @@ long Segment::DoLoadCluster(long long& pos, long& len) {
if (m_pCues == NULL) {
const long long element_size = (pos - idpos) + size;
- m_pCues = new Cues(this, pos, size, idpos, element_size);
+ m_pCues = new (std::nothrow) Cues(this, pos, size, idpos, element_size);
+ if (m_pCues == NULL)
+ return -1;
}
m_pos = pos + size; // consume payload
@@ -1342,7 +1349,9 @@ bool Segment::AppendCluster(Cluster* pCluster) {
if (count >= size) {
const long n = (size <= 0) ? 2048 : 2 * size;
- Cluster** const qq = new Cluster*[n];
+ Cluster** const qq = new (std::nothrow) Cluster*[n];
+ if (qq == NULL)
+ return false;
Cluster** q = qq;
Cluster** p = m_clusters;
@@ -1397,7 +1406,9 @@ bool Segment::PreloadCluster(Cluster* pCluster, ptrdiff_t idx) {
if (count >= size) {
const long n = (size <= 0) ? 2048 : 2 * size;
- Cluster** const qq = new Cluster*[n];
+ Cluster** const qq = new (std::nothrow) Cluster*[n];
+ if (qq == NULL)
+ return false;
Cluster** q = qq;
Cluster** p = m_clusters;
@@ -1466,6 +1477,8 @@ long Segment::Load() {
}
}
+SeekHead::Entry::Entry() : id(0), pos(0), element_start(0), element_size(0) {}
+
SeekHead::SeekHead(Segment* pSegment, long long start, long long size_,
long long element_start, long long element_size)
: m_pSegment(pSegment),
@@ -1516,9 +1529,19 @@ long SeekHead::Parse() {
if (pos != stop)
return E_FILE_FORMAT_INVALID;
- m_entries = new Entry[entry_count];
+ if (entry_count > 0) {
+ m_entries = new (std::nothrow) Entry[entry_count];
- m_void_elements = new VoidElement[void_element_count];
+ if (m_entries == NULL)
+ return -1;
+ }
+
+ if (void_element_count > 0) {
+ m_void_elements = new (std::nothrow) VoidElement[void_element_count];
+
+ if (m_void_elements == NULL)
+ return -1;
+ }
// now parse the entries and void elements
@@ -1537,14 +1560,14 @@ long SeekHead::Parse() {
if (status < 0) // error
return status;
- if (id == libwebm::kMkvSeek) {
+ if (id == libwebm::kMkvSeek && entry_count > 0) {
if (ParseEntry(pReader, pos, size, pEntry)) {
Entry& e = *pEntry++;
e.element_start = idpos;
e.element_size = (pos + size) - idpos;
}
- } else if (id == libwebm::kMkvVoid) {
+ } else if (id == libwebm::kMkvVoid && void_element_count > 0) {
VoidElement& e = *pVoidElement++;
e.element_start = idpos;
@@ -1706,7 +1729,10 @@ long Segment::ParseCues(long long off, long long& pos, long& len) {
const long long element_size = element_stop - element_start;
- m_pCues = new Cues(this, pos, size, element_start, element_size);
+ m_pCues =
+ new (std::nothrow) Cues(this, pos, size, element_start, element_size);
+ if (m_pCues == NULL)
+ return -1;
return 0; // success
}
@@ -1748,18 +1774,7 @@ bool SeekHead::ParseEntry(IMkvReader* pReader, long long start, long long size_,
if ((pos + seekIdSize) > stop)
return false;
- // Note that the SeekId payload really is serialized
- // as a "Matroska integer", not as a plain binary value.
- // In fact, Matroska requires that ID values in the
- // stream exactly match the binary representation as listed
- // in the Matroska specification.
- //
- // This parser is more liberal, and permits IDs to have
- // any width. (This could make the representation in the stream
- // different from what's in the spec, but it doesn't matter here,
- // since we always normalize "Matroska integer" values.)
-
- pEntry->id = ReadUInt(pReader, pos, len); // payload
+ pEntry->id = ReadID(pReader, pos, len); // payload
if (pEntry->id <= 0)
return false;
@@ -1898,7 +1913,9 @@ bool Cues::PreloadCuePoint(long& cue_points_size, long long pos) const {
if (m_preload_count >= cue_points_size) {
const long n = (cue_points_size <= 0) ? 2048 : 2 * cue_points_size;
- CuePoint** const qq = new CuePoint*[n];
+ CuePoint** const qq = new (std::nothrow) CuePoint*[n];
+ if (qq == NULL)
+ return false;
CuePoint** q = qq; // beginning of target
@@ -1914,7 +1931,9 @@ bool Cues::PreloadCuePoint(long& cue_points_size, long long pos) const {
cue_points_size = n;
}
- CuePoint* const pCP = new CuePoint(m_preload_count, pos);
+ CuePoint* const pCP = new (std::nothrow) CuePoint(m_preload_count, pos);
+ if (pCP == NULL)
+ return false;
m_cue_points[m_preload_count++] = pCP;
return true;
@@ -2320,7 +2339,9 @@ bool CuePoint::Load(IMkvReader* pReader) {
// << " timecode=" << m_timecode
// << endl;
- m_track_positions = new TrackPosition[m_track_positions_count];
+ m_track_positions = new (std::nothrow) TrackPosition[m_track_positions_count];
+ if (m_track_positions == NULL)
+ return false;
// Now parse track positions
@@ -2410,7 +2431,9 @@ bool CuePoint::TrackPosition::Parse(IMkvReader* pReader, long long start_,
}
const CuePoint::TrackPosition* CuePoint::Find(const Track* pTrack) const {
- assert(pTrack);
+ if (pTrack == NULL) {
+ return NULL;
+ }
const long long n = pTrack->GetNumber();
@@ -2915,7 +2938,10 @@ long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
const long long element_size = element_stop - element_start;
if (m_pCues == NULL) {
- m_pCues = new Cues(this, pos, size, element_start, element_size);
+ m_pCues = new (std::nothrow)
+ Cues(this, pos, size, element_start, element_size);
+ if (m_pCues == NULL)
+ return false;
}
pos += size; // consume payload
@@ -3266,7 +3292,10 @@ bool Chapters::ExpandEditionsArray() {
const int size = (m_editions_size == 0) ? 1 : 2 * m_editions_size;
- Edition* const editions = new Edition[size];
+ Edition* const editions = new (std::nothrow) Edition[size];
+
+ if (editions == NULL)
+ return false;
for (int idx = 0; idx < m_editions_count; ++idx) {
m_editions[idx].ShallowCopy(editions[idx]);
@@ -3378,7 +3407,10 @@ bool Chapters::Edition::ExpandAtomsArray() {
const int size = (m_atoms_size == 0) ? 1 : 2 * m_atoms_size;
- Atom* const atoms = new Atom[size];
+ Atom* const atoms = new (std::nothrow) Atom[size];
+
+ if (atoms == NULL)
+ return false;
for (int idx = 0; idx < m_atoms_count; ++idx) {
m_atoms[idx].ShallowCopy(atoms[idx]);
@@ -3563,7 +3595,10 @@ bool Chapters::Atom::ExpandDisplaysArray() {
const int size = (m_displays_size == 0) ? 1 : 2 * m_displays_size;
- Display* const displays = new Display[size];
+ Display* const displays = new (std::nothrow) Display[size];
+
+ if (displays == NULL)
+ return false;
for (int idx = 0; idx < m_displays_count; ++idx) {
m_displays[idx].ShallowCopy(displays[idx]);
@@ -3723,7 +3758,10 @@ bool Tags::ExpandTagsArray() {
const int size = (m_tags_size == 0) ? 1 : 2 * m_tags_size;
- Tag* const tags = new Tag[size];
+ Tag* const tags = new (std::nothrow) Tag[size];
+
+ if (tags == NULL)
+ return false;
for (int idx = 0; idx < m_tags_count; ++idx) {
m_tags[idx].ShallowCopy(tags[idx]);
@@ -3834,7 +3872,10 @@ bool Tags::Tag::ExpandSimpleTagsArray() {
const int size = (m_simple_tags_size == 0) ? 1 : 2 * m_simple_tags_size;
- SimpleTag* const displays = new SimpleTag[size];
+ SimpleTag* const displays = new (std::nothrow) SimpleTag[size];
+
+ if (displays == NULL)
+ return false;
for (int idx = 0; idx < m_simple_tags_count; ++idx) {
m_simple_tags[idx].ShallowCopy(displays[idx]);
@@ -3992,7 +4033,7 @@ long SegmentInfo::Parse() {
}
const double rollover_check = m_duration * m_timecodeScale;
- if (rollover_check > LLONG_MAX)
+ if (rollover_check > static_cast<double>(LLONG_MAX))
return E_FILE_FORMAT_INVALID;
if (pos != stop)
@@ -4083,7 +4124,7 @@ ContentEncoding::~ContentEncoding() {
}
const ContentEncoding::ContentCompression*
- ContentEncoding::GetCompressionByIndex(unsigned long idx) const {
+ContentEncoding::GetCompressionByIndex(unsigned long idx) const {
const ptrdiff_t count = compression_entries_end_ - compression_entries_;
assert(count >= 0);
@@ -4179,12 +4220,20 @@ long ContentEncoding::ParseContentEncodingEntry(long long start, long long size,
return -1;
if (compression_count > 0) {
- compression_entries_ = new ContentCompression*[compression_count];
+ compression_entries_ =
+ new (std::nothrow) ContentCompression*[compression_count];
+ if (!compression_entries_)
+ return -1;
compression_entries_end_ = compression_entries_;
}
if (encryption_count > 0) {
- encryption_entries_ = new ContentEncryption*[encryption_count];
+ encryption_entries_ =
+ new (std::nothrow) ContentEncryption*[encryption_count];
+ if (!encryption_entries_) {
+ delete[] compression_entries_;
+ return -1;
+ }
encryption_entries_end_ = encryption_entries_;
}
@@ -4204,7 +4253,10 @@ long ContentEncoding::ParseContentEncodingEntry(long long start, long long size,
} else if (id == libwebm::kMkvContentEncodingType) {
encoding_type_ = UnserializeUInt(pReader, pos, size);
} else if (id == libwebm::kMkvContentCompression) {
- ContentCompression* const compression = new ContentCompression();
+ ContentCompression* const compression =
+ new (std::nothrow) ContentCompression();
+ if (!compression)
+ return -1;
status = ParseCompressionEntry(pos, size, pReader, compression);
if (status) {
@@ -4213,7 +4265,10 @@ long ContentEncoding::ParseContentEncodingEntry(long long start, long long size,
}
*compression_entries_end_++ = compression;
} else if (id == libwebm::kMkvContentEncryption) {
- ContentEncryption* const encryption = new ContentEncryption();
+ ContentEncryption* const encryption =
+ new (std::nothrow) ContentEncryption();
+ if (!encryption)
+ return -1;
status = ParseEncryptionEntry(pos, size, pReader, encryption);
if (status) {
@@ -4419,7 +4474,11 @@ long Track::Create(Segment* pSegment, const Info& info, long long element_start,
if (pResult)
return -1;
- Track* const pTrack = new Track(pSegment, element_start, element_size);
+ Track* const pTrack =
+ new (std::nothrow) Track(pSegment, element_start, element_size);
+
+ if (pTrack == NULL)
+ return -1; // generic error
const int status = info.Copy(pTrack->m_info);
@@ -4871,7 +4930,10 @@ long Track::ParseContentEncodingsEntry(long long start, long long size) {
if (count <= 0)
return -1;
- content_encoding_entries_ = new ContentEncoding*[count];
+ content_encoding_entries_ = new (std::nothrow) ContentEncoding*[count];
+ if (!content_encoding_entries_)
+ return -1;
+
content_encoding_entries_end_ = content_encoding_entries_;
pos = start;
@@ -4883,7 +4945,10 @@ long Track::ParseContentEncodingsEntry(long long start, long long size) {
// pos now designates start of element
if (id == libwebm::kMkvContentEncoding) {
- ContentEncoding* const content_encoding = new ContentEncoding();
+ ContentEncoding* const content_encoding =
+ new (std::nothrow) ContentEncoding();
+ if (!content_encoding)
+ return -1;
status = content_encoding->ParseContentEncodingEntry(pos, size, pReader);
if (status) {
@@ -4917,20 +4982,27 @@ bool PrimaryChromaticity::Parse(IMkvReader* reader, long long read_pos,
if (!reader)
return false;
- my_auto_ptr<PrimaryChromaticity> chromaticity_ptr(*chromaticity ? *chromaticity : new PrimaryChromaticity());
+ if (!*chromaticity)
+ *chromaticity = new PrimaryChromaticity();
- float* value = is_x ? &chromaticity_ptr->x : &chromaticity_ptr->y;
+ if (!*chromaticity)
+ return false;
+
+ PrimaryChromaticity* pc = *chromaticity;
+ float* value = is_x ? &pc->x : &pc->y;
double parser_value = 0;
- const long long value_parse_status =
+ const long long parse_status =
UnserializeFloat(reader, read_pos, value_size, parser_value);
- *value = static_cast<float>(parser_value);
-
- if (value_parse_status < 0 || *value < 0.0 || *value > 1.0)
+ // Valid range is [0, 1]. Make sure the double is representable as a float
+ // before casting.
+ if (parse_status < 0 || parser_value < 0.0 || parser_value > 1.0 ||
+ (parser_value > 0.0 && parser_value < FLT_MIN))
return false;
- *chromaticity = chromaticity_ptr.release();
+ *value = static_cast<float>(parser_value);
+
return true;
}
@@ -4939,7 +5011,9 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start,
if (!reader || *mm)
return false;
- my_auto_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata());
+ std::unique_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata());
+ if (!mm_ptr.get())
+ return false;
const long long mm_end = mm_start + mm_size;
long long read_pos = mm_start;
@@ -4957,6 +5031,10 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start,
double value = 0;
const long long value_parse_status =
UnserializeFloat(reader, read_pos, child_size, value);
+ if (value < -FLT_MAX || value > FLT_MAX ||
+ (value > 0.0 && value < FLT_MIN)) {
+ return false;
+ }
mm_ptr->luminance_max = static_cast<float>(value);
if (value_parse_status < 0 || mm_ptr->luminance_max < 0.0 ||
mm_ptr->luminance_max > 9999.99) {
@@ -4966,6 +5044,10 @@ bool MasteringMetadata::Parse(IMkvReader* reader, long long mm_start,
double value = 0;
const long long value_parse_status =
UnserializeFloat(reader, read_pos, child_size, value);
+ if (value < -FLT_MAX || value > FLT_MAX ||
+ (value > 0.0 && value < FLT_MIN)) {
+ return false;
+ }
mm_ptr->luminance_min = static_cast<float>(value);
if (value_parse_status < 0 || mm_ptr->luminance_min < 0.0 ||
mm_ptr->luminance_min > 999.9999) {
@@ -5018,7 +5100,9 @@ bool Colour::Parse(IMkvReader* reader, long long colour_start,
if (!reader || *colour)
return false;
- my_auto_ptr<Colour> colour_ptr(new Colour());
+ std::unique_ptr<Colour> colour_ptr(new Colour());
+ if (!colour_ptr.get())
+ return false;
const long long colour_end = colour_start + colour_size;
long long read_pos = colour_start;
@@ -5109,11 +5193,94 @@ bool Colour::Parse(IMkvReader* reader, long long colour_start,
return true;
}
+bool Projection::Parse(IMkvReader* reader, long long start, long long size,
+ Projection** projection) {
+ if (!reader || *projection)
+ return false;
+
+ std::unique_ptr<Projection> projection_ptr(new Projection());
+ if (!projection_ptr.get())
+ return false;
+
+ const long long end = start + size;
+ long long read_pos = start;
+
+ while (read_pos < end) {
+ long long child_id = 0;
+ long long child_size = 0;
+
+ const long long status =
+ ParseElementHeader(reader, read_pos, end, child_id, child_size);
+ if (status < 0)
+ return false;
+
+ if (child_id == libwebm::kMkvProjectionType) {
+ long long projection_type = kTypeNotPresent;
+ projection_type = UnserializeUInt(reader, read_pos, child_size);
+ if (projection_type < 0)
+ return false;
+
+ projection_ptr->type = static_cast<ProjectionType>(projection_type);
+ } else if (child_id == libwebm::kMkvProjectionPrivate) {
+ unsigned char* data = SafeArrayAlloc<unsigned char>(1, child_size);
+
+ if (data == NULL)
+ return false;
+
+ const int status =
+ reader->Read(read_pos, static_cast<long>(child_size), data);
+
+ if (status) {
+ delete[] data;
+ return false;
+ }
+
+ projection_ptr->private_data = data;
+ projection_ptr->private_data_length = static_cast<size_t>(child_size);
+ } else {
+ double value = 0;
+ const long long value_parse_status =
+ UnserializeFloat(reader, read_pos, child_size, value);
+ // Make sure value is representable as a float before casting.
+ if (value_parse_status < 0 || value < -FLT_MAX || value > FLT_MAX ||
+ (value > 0.0 && value < FLT_MIN)) {
+ return false;
+ }
+
+ switch (child_id) {
+ case libwebm::kMkvProjectionPoseYaw:
+ projection_ptr->pose_yaw = static_cast<float>(value);
+ break;
+ case libwebm::kMkvProjectionPosePitch:
+ projection_ptr->pose_pitch = static_cast<float>(value);
+ break;
+ case libwebm::kMkvProjectionPoseRoll:
+ projection_ptr->pose_roll = static_cast<float>(value);
+ break;
+ default:
+ return false;
+ }
+ }
+
+ read_pos += child_size;
+ if (read_pos > end)
+ return false;
+ }
+
+ *projection = projection_ptr.release();
+ return true;
+}
+
VideoTrack::VideoTrack(Segment* pSegment, long long element_start,
long long element_size)
- : Track(pSegment, element_start, element_size), m_colour(NULL) {}
+ : Track(pSegment, element_start, element_size),
+ m_colour(NULL),
+ m_projection(NULL) {}
-VideoTrack::~VideoTrack() { delete m_colour; }
+VideoTrack::~VideoTrack() {
+ delete m_colour;
+ delete m_projection;
+}
long VideoTrack::Parse(Segment* pSegment, const Info& info,
long long element_start, long long element_size,
@@ -5145,6 +5312,7 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info,
const long long stop = pos + s.size;
Colour* colour = NULL;
+ Projection* projection = NULL;
while (pos < stop) {
long long id, size;
@@ -5195,6 +5363,9 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info,
} else if (id == libwebm::kMkvColour) {
if (!Colour::Parse(pReader, pos, size, &colour))
return E_FILE_FORMAT_INVALID;
+ } else if (id == libwebm::kMkvProjection) {
+ if (!Projection::Parse(pReader, pos, size, &projection))
+ return E_FILE_FORMAT_INVALID;
}
pos += size; // consume payload
@@ -5205,7 +5376,11 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info,
if (pos != stop)
return E_FILE_FORMAT_INVALID;
- VideoTrack* const pTrack = new VideoTrack(pSegment, element_start, element_size);
+ VideoTrack* const pTrack =
+ new (std::nothrow) VideoTrack(pSegment, element_start, element_size);
+
+ if (pTrack == NULL)
+ return -1; // generic error
const int status = info.Copy(pTrack->m_info);
@@ -5222,6 +5397,7 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info,
pTrack->m_stereo_mode = stereo_mode;
pTrack->m_rate = rate;
pTrack->m_colour = colour;
+ pTrack->m_projection = projection;
pResult = pTrack;
return 0; // success
@@ -5322,6 +5498,8 @@ long VideoTrack::Seek(long long time_ns, const BlockEntry*& pResult) const {
Colour* VideoTrack::GetColour() const { return m_colour; }
+Projection* VideoTrack::GetProjection() const { return m_projection; }
+
long long VideoTrack::GetWidth() const { return m_width; }
long long VideoTrack::GetHeight() const { return m_height; }
@@ -5404,7 +5582,11 @@ long AudioTrack::Parse(Segment* pSegment, const Info& info,
if (pos != stop)
return E_FILE_FORMAT_INVALID;
- AudioTrack* const pTrack = new AudioTrack(pSegment, element_start, element_size);
+ AudioTrack* const pTrack =
+ new (std::nothrow) AudioTrack(pSegment, element_start, element_size);
+
+ if (pTrack == NULL)
+ return -1; // generic error
const int status = info.Copy(pTrack->m_info);
@@ -5472,7 +5654,11 @@ long Tracks::Parse() {
if (count <= 0)
return 0; // success
- m_trackEntries = new Track*[count];
+ m_trackEntries = new (std::nothrow) Track*[count];
+
+ if (m_trackEntries == NULL)
+ return -1;
+
m_trackEntriesEnd = m_trackEntries;
pos = m_start;
@@ -6575,7 +6761,10 @@ Cluster* Cluster::Create(Segment* pSegment, long idx, long long off) {
const long long element_start = pSegment->m_start + off;
- return new Cluster(pSegment, idx, element_start);
+ Cluster* const pCluster =
+ new (std::nothrow) Cluster(pSegment, idx, element_start);
+
+ return pCluster;
}
Cluster::Cluster()
@@ -6604,8 +6793,10 @@ Cluster::Cluster(Segment* pSegment, long idx, long long element_start
{}
Cluster::~Cluster() {
- if (m_entries_count <= 0)
+ if (m_entries_count <= 0) {
+ delete[] m_entries;
return;
+ }
BlockEntry** i = m_entries;
BlockEntry** const j = m_entries + m_entries_count;
@@ -6918,7 +7109,9 @@ long Cluster::CreateBlock(long long id,
assert(m_entries_size == 0);
m_entries_size = 1024;
- m_entries = new BlockEntry*[m_entries_size];
+ m_entries = new (std::nothrow) BlockEntry*[m_entries_size];
+ if (m_entries == NULL)
+ return -1;
m_entries_count = 0;
} else {
@@ -6929,7 +7122,9 @@ long Cluster::CreateBlock(long long id,
if (m_entries_count >= m_entries_size) {
const long entries_size = 2 * m_entries_size;
- BlockEntry** const entries = new BlockEntry*[entries_size];
+ BlockEntry** const entries = new (std::nothrow) BlockEntry*[entries_size];
+ if (entries == NULL)
+ return -1;
BlockEntry** src = m_entries;
BlockEntry** const src_end = src + m_entries_count;
@@ -7038,7 +7233,11 @@ long Cluster::CreateBlockGroup(long long start_offset, long long size,
BlockEntry** const ppEntry = m_entries + idx;
BlockEntry*& pEntry = *ppEntry;
- pEntry = new BlockGroup(this, idx, bpos, bsize, prev, next, duration, discard_padding);
+ pEntry = new (std::nothrow)
+ BlockGroup(this, idx, bpos, bsize, prev, next, duration, discard_padding);
+
+ if (pEntry == NULL)
+ return -1; // generic error
BlockGroup* const p = static_cast<BlockGroup*>(pEntry);
@@ -7066,7 +7265,10 @@ long Cluster::CreateSimpleBlock(long long st, long long sz) {
BlockEntry** const ppEntry = m_entries + idx;
BlockEntry*& pEntry = *ppEntry;
- pEntry = new SimpleBlock(this, idx, st, sz);
+ pEntry = new (std::nothrow) SimpleBlock(this, idx, st, sz);
+
+ if (pEntry == NULL)
+ return -1; // generic error
SimpleBlock* const p = static_cast<SimpleBlock*>(pEntry);
@@ -7461,7 +7663,9 @@ long Block::Parse(const Cluster* pCluster) {
return E_FILE_FORMAT_INVALID;
m_frame_count = 1;
- m_frames = new Frame[m_frame_count];
+ m_frames = new (std::nothrow) Frame[m_frame_count];
+ if (m_frames == NULL)
+ return -1;
Frame& f = m_frames[0];
f.pos = pos;
@@ -7492,7 +7696,9 @@ long Block::Parse(const Cluster* pCluster) {
m_frame_count = int(biased_count) + 1;
- m_frames = new Frame[m_frame_count];
+ m_frames = new (std::nothrow) Frame[m_frame_count];
+ if (m_frames == NULL)
+ return -1;
if (!m_frames)
return E_FILE_FORMAT_INVALID;
@@ -7701,6 +7907,10 @@ long Block::Parse(const Cluster* pCluster) {
return E_FILE_FORMAT_INVALID;
curr.len = static_cast<long>(frame_size);
+ // Check if size + curr.len could overflow.
+ if (size > LLONG_MAX - curr.len) {
+ return E_FILE_FORMAT_INVALID;
+ }
size += curr.len; // contribution of this frame
--frame_count;
@@ -7741,7 +7951,6 @@ long Block::Parse(const Cluster* pCluster) {
pf = m_frames;
while (pf != pf_end) {
Frame& f = *pf++;
- assert((pos + f.len) <= stop);
if ((pos + f.len) > stop)
return E_FILE_FORMAT_INVALID;
@@ -7763,6 +7972,11 @@ long long Block::GetTimeCode(const Cluster* pCluster) const {
const long long tc0 = pCluster->GetTimeCode();
assert(tc0 >= 0);
+ // Check if tc0 + m_timecode would overflow.
+ if (tc0 < 0 || LLONG_MAX - tc0 < m_timecode) {
+ return -1;
+ }
+
const long long tc = tc0 + m_timecode;
return tc; // unscaled timecode units
@@ -7780,6 +7994,10 @@ long long Block::GetTime(const Cluster* pCluster) const {
const long long scale = pInfo->GetTimeCodeScale();
assert(scale >= 1);
+ // Check if tc * scale could overflow.
+ if (tc != 0 && scale > LLONG_MAX / tc) {
+ return -1;
+ }
const long long ns = tc * scale;
return ns;
diff --git a/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.h b/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.h
index 1ef274b162..6dce7e50ba 100644
--- a/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.h
+++ b/thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.h
@@ -8,7 +8,7 @@
#ifndef MKVPARSER_MKVPARSER_H_
#define MKVPARSER_MKVPARSER_H_
-#include <stddef.h>
+#include <cstddef>
namespace mkvparser {
@@ -21,6 +21,7 @@ class IMkvReader {
virtual int Read(long long pos, long len, unsigned char* buf) = 0;
virtual int Length(long long* total, long long* available) = 0;
+ public:
virtual ~IMkvReader();
};
@@ -472,6 +473,34 @@ struct Colour {
MasteringMetadata* mastering_metadata;
};
+struct Projection {
+ enum ProjectionType {
+ kTypeNotPresent = -1,
+ kRectangular = 0,
+ kEquirectangular = 1,
+ kCubeMap = 2,
+ kMesh = 3,
+ };
+ static const float kValueNotPresent;
+ Projection()
+ : type(kTypeNotPresent),
+ private_data(NULL),
+ private_data_length(0),
+ pose_yaw(kValueNotPresent),
+ pose_pitch(kValueNotPresent),
+ pose_roll(kValueNotPresent) {}
+ ~Projection() { delete[] private_data; }
+ static bool Parse(IMkvReader* reader, long long element_start,
+ long long element_size, Projection** projection);
+
+ ProjectionType type;
+ unsigned char* private_data;
+ size_t private_data_length;
+ float pose_yaw;
+ float pose_pitch;
+ float pose_roll;
+};
+
class VideoTrack : public Track {
VideoTrack(const VideoTrack&);
VideoTrack& operator=(const VideoTrack&);
@@ -496,6 +525,8 @@ class VideoTrack : public Track {
Colour* GetColour() const;
+ Projection* GetProjection() const;
+
private:
long long m_width;
long long m_height;
@@ -507,6 +538,7 @@ class VideoTrack : public Track {
double m_rate;
Colour* m_colour;
+ Projection* m_projection;
};
class AudioTrack : public Track {
@@ -812,6 +844,8 @@ class SeekHead {
long Parse();
struct Entry {
+ Entry();
+
// the SeekHead entry payload
long long id;
long long pos;
diff --git a/thirdparty/libvorbis/COPYING b/thirdparty/libvorbis/COPYING
index 8f1d18cc2b..153b926a15 100644
--- a/thirdparty/libvorbis/COPYING
+++ b/thirdparty/libvorbis/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2002-2015 Xiph.org Foundation
+Copyright (c) 2002-2018 Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/thirdparty/libvorbis/analysis.c b/thirdparty/libvorbis/analysis.c
index 01aa6f30db..0e11a167be 100644
--- a/thirdparty/libvorbis/analysis.c
+++ b/thirdparty/libvorbis/analysis.c
@@ -11,7 +11,6 @@
********************************************************************
function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/backends.h b/thirdparty/libvorbis/backends.h
index ff5bcc95fe..22809d46d5 100644
--- a/thirdparty/libvorbis/backends.h
+++ b/thirdparty/libvorbis/backends.h
@@ -12,7 +12,6 @@
function: libvorbis backend and mapping structures; needed for
static mode headers
- last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/barkmel.c b/thirdparty/libvorbis/barkmel.c
index 37b6c4c7ba..4b19935f30 100644
--- a/thirdparty/libvorbis/barkmel.c
+++ b/thirdparty/libvorbis/barkmel.c
@@ -11,7 +11,6 @@
********************************************************************
function: bark scale utility
- last mod: $Id: barkmel.c 19454 2015-03-02 22:39:28Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/bitrate.c b/thirdparty/libvorbis/bitrate.c
index 3a71b1dc23..96055140f7 100644
--- a/thirdparty/libvorbis/bitrate.c
+++ b/thirdparty/libvorbis/bitrate.c
@@ -11,7 +11,6 @@
********************************************************************
function: bitrate tracking and management
- last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/bitrate.h b/thirdparty/libvorbis/bitrate.h
index db48fcb645..655a68cc09 100644
--- a/thirdparty/libvorbis/bitrate.h
+++ b/thirdparty/libvorbis/bitrate.h
@@ -11,7 +11,6 @@
********************************************************************
function: bitrate tracking and management
- last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/block.c b/thirdparty/libvorbis/block.c
index 345c042769..db245b3e69 100644
--- a/thirdparty/libvorbis/block.c
+++ b/thirdparty/libvorbis/block.c
@@ -11,7 +11,6 @@
********************************************************************
function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c 19457 2015-03-03 00:15:29Z giles $
Handle windowing, overlap-add, etc of the PCM vectors. This is made
more amusing by Vorbis' current two allowed block sizes.
diff --git a/thirdparty/libvorbis/books/coupled/res_books_51.h b/thirdparty/libvorbis/books/coupled/res_books_51.h
index 93910ff481..47df4b221b 100644
--- a/thirdparty/libvorbis/books/coupled/res_books_51.h
+++ b/thirdparty/libvorbis/books/coupled/res_books_51.h
@@ -11,7 +11,6 @@
********************************************************************
*
* function: static codebooks for 5.1 surround
- * last modified: $Id: res_books_51.h 19057 2014-01-22 12:32:31Z xiphmont $
*
********************************************************************/
diff --git a/thirdparty/libvorbis/books/coupled/res_books_stereo.h b/thirdparty/libvorbis/books/coupled/res_books_stereo.h
index 9a9049f6ed..61d934046d 100644
--- a/thirdparty/libvorbis/books/coupled/res_books_stereo.h
+++ b/thirdparty/libvorbis/books/coupled/res_books_stereo.h
@@ -11,7 +11,6 @@
********************************************************************
function: static codebooks autogenerated by huff/huffbuld
- last modified: $Id: res_books_stereo.h 19057 2014-01-22 12:32:31Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/books/floor/floor_books.h b/thirdparty/libvorbis/books/floor/floor_books.h
index e925313f7b..67d5f31a3b 100644
--- a/thirdparty/libvorbis/books/floor/floor_books.h
+++ b/thirdparty/libvorbis/books/floor/floor_books.h
@@ -11,7 +11,6 @@
********************************************************************
function: static codebooks autogenerated by huff/huffbuld
- last modified: $Id: floor_books.h 19057 2014-01-22 12:32:31Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h
index 736353b675..3d658ec470 100644
--- a/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h
+++ b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h
@@ -11,7 +11,6 @@
********************************************************************
function: static codebooks autogenerated by huff/huffbuld
- last modified: $Id: res_books_uncoupled.h 19057 2014-01-22 12:32:31Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/codebook.c b/thirdparty/libvorbis/codebook.c
index 72f8a17a35..78672e222d 100644
--- a/thirdparty/libvorbis/codebook.c
+++ b/thirdparty/libvorbis/codebook.c
@@ -11,7 +11,6 @@
********************************************************************
function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
@@ -387,7 +386,7 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
t[i] = book->valuelist+entry[i]*book->dim;
}
for(i=0,o=0;i<book->dim;i++,o+=step)
- for (j=0;j<step;j++)
+ for (j=0;o+j<n && j<step;j++)
a[o+j]+=t[j][i];
}
return(0);
@@ -399,41 +398,12 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
int i,j,entry;
float *t;
- if(book->dim>8){
- for(i=0;i<n;){
- entry = decode_packed_entry_number(book,b);
- if(entry==-1)return(-1);
- t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;)
- a[i++]+=t[j++];
- }
- }else{
- for(i=0;i<n;){
- entry = decode_packed_entry_number(book,b);
- if(entry==-1)return(-1);
- t = book->valuelist+entry*book->dim;
- j=0;
- switch((int)book->dim){
- case 8:
- a[i++]+=t[j++];
- case 7:
- a[i++]+=t[j++];
- case 6:
- a[i++]+=t[j++];
- case 5:
- a[i++]+=t[j++];
- case 4:
- a[i++]+=t[j++];
- case 3:
- a[i++]+=t[j++];
- case 2:
- a[i++]+=t[j++];
- case 1:
- a[i++]+=t[j++];
- case 0:
- break;
- }
- }
+ for(i=0;i<n;){
+ entry = decode_packed_entry_number(book,b);
+ if(entry==-1)return(-1);
+ t = book->valuelist+entry*book->dim;
+ for(j=0;i<n && j<book->dim;)
+ a[i++]+=t[j++];
}
}
return(0);
@@ -471,12 +441,13 @@ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
long i,j,entry;
int chptr=0;
if(book->used_entries>0){
- for(i=offset/ch;i<(offset+n)/ch;){
+ int m=(offset+n)/ch;
+ for(i=offset/ch;i<m;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
{
const float *t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;j++){
+ for (j=0;i<m && j<book->dim;j++){
a[chptr++][i]+=t[j];
if(chptr==ch){
chptr=0;
diff --git a/thirdparty/libvorbis/codebook.h b/thirdparty/libvorbis/codebook.h
index 537d6c12d3..08440c6962 100644
--- a/thirdparty/libvorbis/codebook.h
+++ b/thirdparty/libvorbis/codebook.h
@@ -11,7 +11,6 @@
********************************************************************
function: basic shared codebook operations
- last mod: $Id: codebook.h 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/codec_internal.h b/thirdparty/libvorbis/codec_internal.h
index de1bccaedf..e522be18da 100644
--- a/thirdparty/libvorbis/codec_internal.h
+++ b/thirdparty/libvorbis/codec_internal.h
@@ -11,7 +11,6 @@
********************************************************************
function: libvorbis codec headers
- last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/envelope.c b/thirdparty/libvorbis/envelope.c
index 010c66e2d6..da75237542 100644
--- a/thirdparty/libvorbis/envelope.c
+++ b/thirdparty/libvorbis/envelope.c
@@ -11,7 +11,6 @@
********************************************************************
function: PCM data envelope analysis
- last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/envelope.h b/thirdparty/libvorbis/envelope.h
index fd15fb32a7..f466efde8a 100644
--- a/thirdparty/libvorbis/envelope.h
+++ b/thirdparty/libvorbis/envelope.h
@@ -11,7 +11,6 @@
********************************************************************
function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/floor0.c b/thirdparty/libvorbis/floor0.c
index 213cce4ec8..443c0e5a96 100644
--- a/thirdparty/libvorbis/floor0.c
+++ b/thirdparty/libvorbis/floor0.c
@@ -11,7 +11,6 @@
********************************************************************
function: floor backend 0 implementation
- last mod: $Id: floor0.c 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/floor1.c b/thirdparty/libvorbis/floor1.c
index d8bd4645c1..673e954c53 100644
--- a/thirdparty/libvorbis/floor1.c
+++ b/thirdparty/libvorbis/floor1.c
@@ -11,7 +11,6 @@
********************************************************************
function: floor backend 1 implementation
- last mod: $Id: floor1.c 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/highlevel.h b/thirdparty/libvorbis/highlevel.h
index e38f370fd6..337b75bfa4 100644
--- a/thirdparty/libvorbis/highlevel.h
+++ b/thirdparty/libvorbis/highlevel.h
@@ -11,7 +11,6 @@
********************************************************************
function: highlevel encoder setup struct separated out for vorbisenc clarity
- last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/info.c b/thirdparty/libvorbis/info.c
index 8a2a001f99..3fbb7c757a 100644
--- a/thirdparty/libvorbis/info.c
+++ b/thirdparty/libvorbis/info.c
@@ -11,7 +11,6 @@
********************************************************************
function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c 19441 2015-01-21 01:17:41Z xiphmont $
********************************************************************/
@@ -31,8 +30,8 @@
#include "misc.h"
#include "os.h"
-#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.5"
-#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20150105 (⛄⛄⛄⛄)"
+#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.6"
+#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20180316 (Now 100% fewer shells)"
/* helpers */
static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){
@@ -65,11 +64,13 @@ void vorbis_comment_add(vorbis_comment *vc,const char *comment){
}
void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){
- char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
+ /* Length for key and value +2 for = and \0 */
+ char *comment=_ogg_malloc(strlen(tag)+strlen(contents)+2);
strcpy(comment, tag);
strcat(comment, "=");
strcat(comment, contents);
vorbis_comment_add(vc, comment);
+ _ogg_free(comment);
}
/* This is more or less the same as strncasecmp - but that doesn't exist
@@ -88,27 +89,30 @@ char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
long i;
int found = 0;
int taglen = strlen(tag)+1; /* +1 for the = we append */
- char *fulltag = alloca(taglen+ 1);
+ char *fulltag = _ogg_malloc(taglen+1);
strcpy(fulltag, tag);
strcat(fulltag, "=");
for(i=0;i<vc->comments;i++){
if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
- if(count == found)
+ if(count == found) {
/* We return a pointer to the data, not a copy */
- return vc->user_comments[i] + taglen;
- else
+ _ogg_free(fulltag);
+ return vc->user_comments[i] + taglen;
+ } else {
found++;
+ }
}
}
+ _ogg_free(fulltag);
return NULL; /* didn't find anything */
}
int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
int i,count=0;
int taglen = strlen(tag)+1; /* +1 for the = we append */
- char *fulltag = alloca(taglen+1);
+ char *fulltag = _ogg_malloc(taglen+1);
strcpy(fulltag,tag);
strcat(fulltag, "=");
@@ -117,6 +121,7 @@ int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
count++;
}
+ _ogg_free(fulltag);
return count;
}
@@ -206,9 +211,9 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
vi->channels=oggpack_read(opb,8);
vi->rate=oggpack_read(opb,32);
- vi->bitrate_upper=oggpack_read(opb,32);
- vi->bitrate_nominal=oggpack_read(opb,32);
- vi->bitrate_lower=oggpack_read(opb,32);
+ vi->bitrate_upper=(ogg_int32_t)oggpack_read(opb,32);
+ vi->bitrate_nominal=(ogg_int32_t)oggpack_read(opb,32);
+ vi->bitrate_lower=(ogg_int32_t)oggpack_read(opb,32);
ci->blocksizes[0]=1<<oggpack_read(opb,4);
ci->blocksizes[1]=1<<oggpack_read(opb,4);
@@ -583,7 +588,8 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
oggpack_buffer opb;
private_state *b=v->backend_state;
- if(!b||vi->channels<=0){
+ if(!b||vi->channels<=0||vi->channels>256){
+ b = NULL;
ret=OV_EFAULT;
goto err_out;
}
@@ -642,7 +648,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
memset(op_code,0,sizeof(*op_code));
if(b){
- oggpack_writeclear(&opb);
+ if(vi->channels>0)oggpack_writeclear(&opb);
if(b->header)_ogg_free(b->header);
if(b->header1)_ogg_free(b->header1);
if(b->header2)_ogg_free(b->header2);
diff --git a/thirdparty/libvorbis/lookup.c b/thirdparty/libvorbis/lookup.c
index 3321ed3dbc..1cc1f88ee9 100644
--- a/thirdparty/libvorbis/lookup.c
+++ b/thirdparty/libvorbis/lookup.c
@@ -11,7 +11,6 @@
********************************************************************
function: lookup based functions
- last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/lookup.h b/thirdparty/libvorbis/lookup.h
index f8b5b82730..4bc0f3a206 100644
--- a/thirdparty/libvorbis/lookup.h
+++ b/thirdparty/libvorbis/lookup.h
@@ -11,7 +11,6 @@
********************************************************************
function: lookup based functions
- last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/lookup_data.h b/thirdparty/libvorbis/lookup_data.h
index 2424a1b386..5de3cfdc7e 100644
--- a/thirdparty/libvorbis/lookup_data.h
+++ b/thirdparty/libvorbis/lookup_data.h
@@ -11,7 +11,6 @@
********************************************************************
function: lookup data; generated by lookups.pl; edit there
- last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/lpc.c b/thirdparty/libvorbis/lpc.c
index f5199ec235..798f4cf076 100644
--- a/thirdparty/libvorbis/lpc.c
+++ b/thirdparty/libvorbis/lpc.c
@@ -11,7 +11,6 @@
********************************************************************
function: LPC low level routines
- last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/lpc.h b/thirdparty/libvorbis/lpc.h
index 39d237601b..9cc79451b6 100644
--- a/thirdparty/libvorbis/lpc.h
+++ b/thirdparty/libvorbis/lpc.h
@@ -11,7 +11,6 @@
********************************************************************
function: LPC low level routines
- last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/lsp.c b/thirdparty/libvorbis/lsp.c
index 6a619f7b0c..8588054515 100644
--- a/thirdparty/libvorbis/lsp.c
+++ b/thirdparty/libvorbis/lsp.c
@@ -11,7 +11,6 @@
********************************************************************
function: LSP (also called LSF) conversion routines
- last mod: $Id: lsp.c 19453 2015-03-02 22:35:34Z xiphmont $
The LSP generation code is taken (with minimal modification and a
few bugfixes) from "On the Computation of the LSP Frequencies" by
diff --git a/thirdparty/libvorbis/lsp.h b/thirdparty/libvorbis/lsp.h
index bacfb0971f..8a8d10e978 100644
--- a/thirdparty/libvorbis/lsp.h
+++ b/thirdparty/libvorbis/lsp.h
@@ -11,7 +11,6 @@
********************************************************************
function: LSP (also called LSF) conversion routines
- last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/mapping0.c b/thirdparty/libvorbis/mapping0.c
index 85c7d22d83..ccb4493d4c 100644
--- a/thirdparty/libvorbis/mapping0.c
+++ b/thirdparty/libvorbis/mapping0.c
@@ -11,7 +11,6 @@
********************************************************************
function: channel mapping 0 implementation
- last mod: $Id: mapping0.c 19441 2015-01-21 01:17:41Z xiphmont $
********************************************************************/
@@ -93,7 +92,6 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
int i,b;
vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));
codec_setup_info *ci=vi->codec_setup;
- memset(info,0,sizeof(*info));
if(vi->channels<=0)goto err_out;
b=oggpack_read(opb,1);
diff --git a/thirdparty/libvorbis/masking.h b/thirdparty/libvorbis/masking.h
index 3576ab7885..955e18c719 100644
--- a/thirdparty/libvorbis/masking.h
+++ b/thirdparty/libvorbis/masking.h
@@ -11,7 +11,6 @@
********************************************************************
function: masking curve data for psychoacoustics
- last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/mdct.c b/thirdparty/libvorbis/mdct.c
index 0816331805..f3f1ed805b 100644
--- a/thirdparty/libvorbis/mdct.c
+++ b/thirdparty/libvorbis/mdct.c
@@ -12,7 +12,6 @@
function: normalized modified discrete cosine transform
power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $
Original algorithm adapted long ago from _The use of multirate filter
banks for coding of high quality digital audio_, by T. Sporer,
diff --git a/thirdparty/libvorbis/mdct.h b/thirdparty/libvorbis/mdct.h
index 3ed94333c5..3b8c9ba4a2 100644
--- a/thirdparty/libvorbis/mdct.h
+++ b/thirdparty/libvorbis/mdct.h
@@ -11,7 +11,6 @@
********************************************************************
function: modified discrete cosine transform prototypes
- last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/misc.h b/thirdparty/libvorbis/misc.h
index 73b4519898..13788445a3 100644
--- a/thirdparty/libvorbis/misc.h
+++ b/thirdparty/libvorbis/misc.h
@@ -11,7 +11,6 @@
********************************************************************
function: miscellaneous prototypes
- last mod: $Id: misc.h 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/floor_all.h b/thirdparty/libvorbis/modes/floor_all.h
index 4292be326e..20928aac87 100644
--- a/thirdparty/libvorbis/modes/floor_all.h
+++ b/thirdparty/libvorbis/modes/floor_all.h
@@ -11,7 +11,6 @@
********************************************************************
function: key floor settings
- last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/psych_11.h b/thirdparty/libvorbis/modes/psych_11.h
index 844a8ed3cd..cc5eea2402 100644
--- a/thirdparty/libvorbis/modes/psych_11.h
+++ b/thirdparty/libvorbis/modes/psych_11.h
@@ -11,7 +11,6 @@
********************************************************************
function: 11kHz settings
- last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/psych_16.h b/thirdparty/libvorbis/modes/psych_16.h
index 1c10b3954e..477cb4d90f 100644
--- a/thirdparty/libvorbis/modes/psych_16.h
+++ b/thirdparty/libvorbis/modes/psych_16.h
@@ -11,7 +11,6 @@
********************************************************************
function: 16kHz settings
- last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/psych_44.h b/thirdparty/libvorbis/modes/psych_44.h
index f05c032653..6c9eaa4e5f 100644
--- a/thirdparty/libvorbis/modes/psych_44.h
+++ b/thirdparty/libvorbis/modes/psych_44.h
@@ -11,7 +11,6 @@
********************************************************************
function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/psych_8.h b/thirdparty/libvorbis/modes/psych_8.h
index 0e2dd57371..277db8436c 100644
--- a/thirdparty/libvorbis/modes/psych_8.h
+++ b/thirdparty/libvorbis/modes/psych_8.h
@@ -11,7 +11,6 @@
********************************************************************
function: 8kHz psychoacoustic settings
- last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/residue_16.h b/thirdparty/libvorbis/modes/residue_16.h
index dcaca5451e..3e05471cec 100644
--- a/thirdparty/libvorbis/modes/residue_16.h
+++ b/thirdparty/libvorbis/modes/residue_16.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel residue templates 16/22kHz
- last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/residue_44.h b/thirdparty/libvorbis/modes/residue_44.h
index 236c18341b..e89bc0e486 100644
--- a/thirdparty/libvorbis/modes/residue_44.h
+++ b/thirdparty/libvorbis/modes/residue_44.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel residue templates for 32/44.1/48kHz
- last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/residue_44p51.h b/thirdparty/libvorbis/modes/residue_44p51.h
index a52cc5245e..7f33e250e2 100644
--- a/thirdparty/libvorbis/modes/residue_44p51.h
+++ b/thirdparty/libvorbis/modes/residue_44p51.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel residue templates for 32/44.1/48kHz uncoupled
- last mod: $Id: residue_44p51.h 19013 2013-11-12 04:04:50Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/residue_44u.h b/thirdparty/libvorbis/modes/residue_44u.h
index 92c4a09ce3..e55ac12548 100644
--- a/thirdparty/libvorbis/modes/residue_44u.h
+++ b/thirdparty/libvorbis/modes/residue_44u.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel residue templates for 32/44.1/48kHz uncoupled
- last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/residue_8.h b/thirdparty/libvorbis/modes/residue_8.h
index 94c6d84c44..ae123a276a 100644
--- a/thirdparty/libvorbis/modes/residue_8.h
+++ b/thirdparty/libvorbis/modes/residue_8.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel residue templates 8/11kHz
- last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_11.h b/thirdparty/libvorbis/modes/setup_11.h
index 4c2d619ca2..0cbcaafcb2 100644
--- a/thirdparty/libvorbis/modes/setup_11.h
+++ b/thirdparty/libvorbis/modes/setup_11.h
@@ -11,7 +11,6 @@
********************************************************************
function: 11kHz settings
- last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_16.h b/thirdparty/libvorbis/modes/setup_16.h
index 336007f98e..d59ad70d2e 100644
--- a/thirdparty/libvorbis/modes/setup_16.h
+++ b/thirdparty/libvorbis/modes/setup_16.h
@@ -11,7 +11,6 @@
********************************************************************
function: 16kHz settings
- last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_22.h b/thirdparty/libvorbis/modes/setup_22.h
index 4fd5e57111..bc38af9630 100644
--- a/thirdparty/libvorbis/modes/setup_22.h
+++ b/thirdparty/libvorbis/modes/setup_22.h
@@ -11,7 +11,6 @@
********************************************************************
function: 22kHz settings
- last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_32.h b/thirdparty/libvorbis/modes/setup_32.h
index 2275ac9615..f66a0bcd00 100644
--- a/thirdparty/libvorbis/modes/setup_32.h
+++ b/thirdparty/libvorbis/modes/setup_32.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel settings for 32kHz
- last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_44.h b/thirdparty/libvorbis/modes/setup_44.h
index 3b88a89ac5..a189b5fb95 100644
--- a/thirdparty/libvorbis/modes/setup_44.h
+++ b/thirdparty/libvorbis/modes/setup_44.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel settings for 44.1/48kHz
- last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_44p51.h b/thirdparty/libvorbis/modes/setup_44p51.h
index 67d9979608..3bde7b340c 100644
--- a/thirdparty/libvorbis/modes/setup_44p51.h
+++ b/thirdparty/libvorbis/modes/setup_44p51.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel settings for 44.1/48kHz 5.1 surround modes
- last mod: $Id: setup_44p51.h 19013 2013-11-12 04:04:50Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_44u.h b/thirdparty/libvorbis/modes/setup_44u.h
index 568b5f8959..7ae3af6b2a 100644
--- a/thirdparty/libvorbis/modes/setup_44u.h
+++ b/thirdparty/libvorbis/modes/setup_44u.h
@@ -11,7 +11,6 @@
********************************************************************
function: toplevel settings for 44.1/48kHz uncoupled modes
- last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_8.h b/thirdparty/libvorbis/modes/setup_8.h
index 14c48374fa..7502556879 100644
--- a/thirdparty/libvorbis/modes/setup_8.h
+++ b/thirdparty/libvorbis/modes/setup_8.h
@@ -11,7 +11,6 @@
********************************************************************
function: 8kHz settings
- last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/modes/setup_X.h b/thirdparty/libvorbis/modes/setup_X.h
index a69f5d40a2..2229a5ef2f 100644
--- a/thirdparty/libvorbis/modes/setup_X.h
+++ b/thirdparty/libvorbis/modes/setup_X.h
@@ -11,7 +11,6 @@
********************************************************************
function: catch-all toplevel settings for q modes only
- last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/os.h b/thirdparty/libvorbis/os.h
index 8bc3e5fe9c..416a401dd1 100644
--- a/thirdparty/libvorbis/os.h
+++ b/thirdparty/libvorbis/os.h
@@ -13,7 +13,6 @@
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
@@ -31,7 +30,7 @@
# ifdef __GNUC__
# define STIN static __inline__
-# elif _WIN32
+# elif defined(_WIN32)
# define STIN static __inline
# else
# define STIN static
diff --git a/thirdparty/libvorbis/psy.c b/thirdparty/libvorbis/psy.c
index f7a44c6d00..422c6f1e41 100644
--- a/thirdparty/libvorbis/psy.c
+++ b/thirdparty/libvorbis/psy.c
@@ -11,7 +11,6 @@
********************************************************************
function: psychoacoustics not including preecho
- last mod: $Id: psy.c 18077 2011-09-02 02:49:00Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/psy.h b/thirdparty/libvorbis/psy.h
index c1ea824401..ab2534db3a 100644
--- a/thirdparty/libvorbis/psy.h
+++ b/thirdparty/libvorbis/psy.h
@@ -11,7 +11,6 @@
********************************************************************
function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/psytune.c b/thirdparty/libvorbis/psytune.c
index 64c13171f7..6952136c6b 100644
--- a/thirdparty/libvorbis/psytune.c
+++ b/thirdparty/libvorbis/psytune.c
@@ -12,7 +12,6 @@
function: simple utility that runs audio through the psychoacoustics
without encoding
- last mod: $Id: psytune.c 16037 2009-05-26 21:10:58Z xiphmont $
********************************************************************/
@@ -41,11 +40,11 @@
static vorbis_info_psy_global _psy_set0G={
0, /* decaydBpms */
8, /* lines per eighth octave */
-
+
/* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
- -6.f,
-
+ -6.f,
+
0,
0.,
@@ -68,7 +67,7 @@ static vp_couple _vp_couple0[]={
static vorbis_info_psy _psy_set0={
ATH_Bark_dB_lineaggressive,
-
+
-100.f,
-140.f,
6.f, /* floor master att */
@@ -148,7 +147,7 @@ static vorbis_info_psy _psy_set0={
.900f, 0.f, /*11500*/
.900f, 1.f, /*16000*/
},
-
+
95.f, /* even decade + 5 is important; saves an rint() later in a
tight loop) */
-44.,
@@ -159,7 +158,7 @@ static vorbis_info_psy _psy_set0={
static vorbis_info_floor1 _floor_set0={1,
{0},
-
+
{32},
{0},
{0},
@@ -171,12 +170,12 @@ static vorbis_info_floor1 _floor_set0={1,
88,31,243,
14,54,143,460,
-
- 6,3,10, 22,18,26, 41,36,47,
- 69,61,78, 112,99,126, 185,162,211,
+
+ 6,3,10, 22,18,26, 41,36,47,
+ 69,61,78, 112,99,126, 185,162,211,
329,282,387, 672,553,825
},
-
+
60,30,400,
20,8,1,18.,
20,600,
@@ -184,8 +183,8 @@ static vorbis_info_floor1 _floor_set0={1,
static vorbis_info_mapping0 mapping_info={1,{0,1},{0},{0},{0},0, 1, {0},{1}};
-static codec_setup_info codec_setup0={ {0,0},
- 1,1,1,1,1,0,1,
+static codec_setup_info codec_setup0={ {0,0},
+ 1,1,1,1,1,0,1,
{NULL},
{0},{&mapping_info},
{0},{NULL},
@@ -194,7 +193,7 @@ static codec_setup_info codec_setup0={ {0,0},
{NULL},
{&_psy_set0},
&_psy_set0G};
-
+
static int noisy=0;
void analysis(char *base,int i,float *v,int n,int bark,int dB){
if(noisy){
@@ -212,7 +211,7 @@ void analysis(char *base,int i,float *v,int n,int bark,int dB){
fprintf(of,"%g ",toBARK(22050.f*j/n));
else
fprintf(of,"%g ",(float)j);
-
+
if(dB){
fprintf(of,"%g\n",todB(v+j));
}else{
@@ -269,7 +268,7 @@ int main(int argc,char *argv[]){
framesize=atoi(argv[0]);
argv++;
}
-
+
vi.channels=2;
vi.codec_setup=&codec_setup0;
@@ -292,7 +291,7 @@ int main(int argc,char *argv[]){
/* we cheat on the WAV header; we just bypass 44 bytes and never
verify that it matches 16bit/stereo/44.1kHz. */
-
+
fread(buffer,1,44,stdin);
fwrite(buffer,1,44,stdout);
memset(buffer,0,framesize*2);
@@ -302,10 +301,10 @@ int main(int argc,char *argv[]){
fprintf(stderr,"Processing for frame size %d...\n",framesize);
while(!eos){
- long bytes=fread(buffer2,1,framesize*2,stdin);
+ long bytes=fread(buffer2,1,framesize*2,stdin);
if(bytes<framesize*2)
memset(buffer2+bytes,0,framesize*2-bytes);
-
+
if(bytes!=0){
int nonzero[2];
@@ -316,10 +315,10 @@ int main(int argc,char *argv[]){
pcm[1][i]=((buffer[i*4+3]<<8)|
(0x00ff&(int)buffer[i*4+2]))/32768.f;
}
-
+
{
float secs=framesize/44100.;
-
+
ampmax+=secs*ampmax_att_per_sec;
if(ampmax<-9999)ampmax=-9999;
}
@@ -331,11 +330,11 @@ int main(int argc,char *argv[]){
float *logmdct=mdct+framesize/2;
analysis("pre",frameno+i,pcm[i],framesize,0,0);
-
+
/* fft and mdct transforms */
for(j=0;j<framesize;j++)
fft[j]=pcm[i][j]*=window[j];
-
+
drft_forward(&f_look,fft);
local_ampmax[i]=-9999.f;
@@ -347,7 +346,7 @@ int main(int argc,char *argv[]){
if(temp>local_ampmax[i])local_ampmax[i]=temp;
}
if(local_ampmax[i]>ampmax)ampmax=local_ampmax[i];
-
+
mdct_forward(&m_look,pcm[i],mdct);
for(j=0;j<framesize/2;j++)
logmdct[j]=todB(mdct+j);
@@ -391,7 +390,7 @@ int main(int argc,char *argv[]){
logmdct,
mask,
logmax,
-
+
flr[i]);
}
@@ -406,7 +405,7 @@ int main(int argc,char *argv[]){
for(j=0;j<framesize/2;j++)
if(fabs(pcm[i][j])>1500)
fprintf(stderr,"%ld ",frameno+i);
-
+
analysis("res",frameno+i,pcm[i],framesize/2,1,0);
analysis("codedflr",frameno+i,flr[i],framesize/2,1,1);
}
@@ -416,7 +415,7 @@ int main(int argc,char *argv[]){
&vi,
pcm,
nonzero);
-
+
for(i=0;i<2;i++)
analysis("quant",frameno+i,pcm[i],framesize/2,1,0);
@@ -426,7 +425,7 @@ int main(int argc,char *argv[]){
&mapping_info,
pcm,
nonzero);
-
+
for(i=0;i<2;i++)
analysis("coupled",frameno+i,pcm[i],framesize/2,1,0);
@@ -434,11 +433,11 @@ int main(int argc,char *argv[]){
for(i=mapping_info.coupling_steps-1;i>=0;i--){
float *pcmM=pcm[mapping_info.coupling_mag[i]];
float *pcmA=pcm[mapping_info.coupling_ang[i]];
-
+
for(j=0;j<framesize/2;j++){
float mag=pcmM[j];
float ang=pcmA[j];
-
+
if(mag>0)
if(ang>0){
pcmM[j]=mag;
@@ -457,7 +456,7 @@ int main(int argc,char *argv[]){
}
}
}
-
+
for(i=0;i<2;i++)
analysis("decoupled",frameno+i,pcm[i],framesize/2,1,0);
@@ -479,7 +478,7 @@ int main(int argc,char *argv[]){
}
-
+
/* write data. Use the part of buffer we're about to shift out */
for(i=0;i<2;i++){
char *ptr=buffer+i*2;
@@ -503,7 +502,7 @@ int main(int argc,char *argv[]){
ptr+=4;
}
}
-
+
fprintf(stderr,"*");
fwrite(buffer,1,framesize*2,stdout);
memmove(buffer,buffer2,framesize*2);
diff --git a/thirdparty/libvorbis/registry.c b/thirdparty/libvorbis/registry.c
index 3961ed1403..74f7ef0396 100644
--- a/thirdparty/libvorbis/registry.c
+++ b/thirdparty/libvorbis/registry.c
@@ -11,7 +11,6 @@
********************************************************************
function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/registry.h b/thirdparty/libvorbis/registry.h
index 3ae04776d8..599d959942 100644
--- a/thirdparty/libvorbis/registry.h
+++ b/thirdparty/libvorbis/registry.h
@@ -11,7 +11,6 @@
********************************************************************
function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/res0.c b/thirdparty/libvorbis/res0.c
index ec11488c2f..6d623d730f 100644
--- a/thirdparty/libvorbis/res0.c
+++ b/thirdparty/libvorbis/res0.c
@@ -11,7 +11,6 @@
********************************************************************
function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c 19441 2015-01-21 01:17:41Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/scales.h b/thirdparty/libvorbis/scales.h
index 613f796e77..18bc4e7518 100644
--- a/thirdparty/libvorbis/scales.h
+++ b/thirdparty/libvorbis/scales.h
@@ -11,7 +11,6 @@
********************************************************************
function: linear scale -> dB, Bark and Mel scales
- last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/sharedbook.c b/thirdparty/libvorbis/sharedbook.c
index 6bfdf7311e..4545d4f459 100644
--- a/thirdparty/libvorbis/sharedbook.c
+++ b/thirdparty/libvorbis/sharedbook.c
@@ -11,11 +11,11 @@
********************************************************************
function: basic shared codebook operations
- last mod: $Id: sharedbook.c 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
#include <stdlib.h>
+#include <limits.h>
#include <math.h>
#include <string.h>
#include <ogg/ogg.h>
@@ -158,25 +158,34 @@ ogg_uint32_t *_make_words(char *l,long n,long sparsecount){
that's portable and totally safe against roundoff, but I haven't
thought of it. Therefore, we opt on the side of caution */
long _book_maptype1_quantvals(const static_codebook *b){
- long vals=floor(pow((float)b->entries,1.f/b->dim));
+ long vals;
+ if(b->entries<1){
+ return(0);
+ }
+ vals=floor(pow((float)b->entries,1.f/b->dim));
/* the above *should* be reliable, but we'll not assume that FP is
ever reliable when bitstream sync is at stake; verify via integer
means that vals really is the greatest value of dim for which
vals^b->bim <= b->entries */
/* treat the above as an initial guess */
+ if(vals<1){
+ vals=1;
+ }
while(1){
long acc=1;
long acc1=1;
int i;
for(i=0;i<b->dim;i++){
+ if(b->entries/vals<acc)break;
acc*=vals;
- acc1*=vals+1;
+ if(LONG_MAX/(vals+1)<acc1)acc1=LONG_MAX;
+ else acc1*=vals+1;
}
- if(acc<=b->entries && acc1>b->entries){
+ if(i>=b->dim && acc<=b->entries && acc1>b->entries){
return(vals);
}else{
- if(acc>b->entries){
+ if(i<b->dim || acc>b->entries){
vals--;
}else{
vals++;
diff --git a/thirdparty/libvorbis/smallft.c b/thirdparty/libvorbis/smallft.c
index ae2bc41b6b..6d528af423 100644
--- a/thirdparty/libvorbis/smallft.c
+++ b/thirdparty/libvorbis/smallft.c
@@ -11,7 +11,6 @@
********************************************************************
function: *unnormalized* fft transform
- last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/smallft.h b/thirdparty/libvorbis/smallft.h
index 456497326c..9e867c67d2 100644
--- a/thirdparty/libvorbis/smallft.h
+++ b/thirdparty/libvorbis/smallft.h
@@ -11,7 +11,6 @@
********************************************************************
function: fft transform
- last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/synthesis.c b/thirdparty/libvorbis/synthesis.c
index 932d271a63..5f6092c3d3 100644
--- a/thirdparty/libvorbis/synthesis.c
+++ b/thirdparty/libvorbis/synthesis.c
@@ -11,7 +11,6 @@
********************************************************************
function: single-block PCM synthesis
- last mod: $Id: synthesis.c 19441 2015-01-21 01:17:41Z xiphmont $
********************************************************************/
@@ -117,7 +116,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
if(!ci->mode_param[mode]){
return(OV_EBADPACKET);
}
-
+
vb->W=ci->mode_param[mode]->blockflag;
if(vb->W){
vb->lW=oggpack_read(opb,1);
diff --git a/thirdparty/libvorbis/tone.c b/thirdparty/libvorbis/tone.c
index 73afc67d4c..5b8b020604 100644
--- a/thirdparty/libvorbis/tone.c
+++ b/thirdparty/libvorbis/tone.c
@@ -12,7 +12,7 @@ int main (int argc,char *argv[]){
int i,j;
double *f;
double *amp;
-
+
if(argc<2)usage();
f=alloca(sizeof(*f)*(argc-1));
@@ -21,7 +21,7 @@ int main (int argc,char *argv[]){
i=0;
while(argv[i+1]){
char *pos=strchr(argv[i+1],',');
-
+
f[i]=atof(argv[i+1]);
if(pos)
amp[i]=atof(pos+1)*32767.f;
diff --git a/thirdparty/libvorbis/vorbis/codec.h b/thirdparty/libvorbis/vorbis/codec.h
index 999aa33510..42aa29138e 100644
--- a/thirdparty/libvorbis/vorbis/codec.h
+++ b/thirdparty/libvorbis/vorbis/codec.h
@@ -11,7 +11,6 @@
********************************************************************
function: libvorbis codec headers
- last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/vorbis/vorbisenc.h b/thirdparty/libvorbis/vorbis/vorbisenc.h
index 02332b50ca..55f3b4a667 100644
--- a/thirdparty/libvorbis/vorbis/vorbisenc.h
+++ b/thirdparty/libvorbis/vorbis/vorbisenc.h
@@ -11,7 +11,6 @@
********************************************************************
function: vorbis encode-engine setup
- last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/vorbis/vorbisfile.h b/thirdparty/libvorbis/vorbis/vorbisfile.h
index 9271331e72..56626119bb 100644
--- a/thirdparty/libvorbis/vorbis/vorbisfile.h
+++ b/thirdparty/libvorbis/vorbis/vorbisfile.h
@@ -11,7 +11,6 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
********************************************************************/
diff --git a/thirdparty/libvorbis/vorbisenc.c b/thirdparty/libvorbis/vorbisenc.c
index b5d621e900..4a4607cb41 100644
--- a/thirdparty/libvorbis/vorbisenc.c
+++ b/thirdparty/libvorbis/vorbisenc.c
@@ -11,7 +11,6 @@
********************************************************************
function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/vorbisfile.c b/thirdparty/libvorbis/vorbisfile.c
index fc0c86ff11..b570c3c5f6 100644
--- a/thirdparty/libvorbis/vorbisfile.c
+++ b/thirdparty/libvorbis/vorbisfile.c
@@ -11,7 +11,6 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c 19457 2015-03-03 00:15:29Z giles $
********************************************************************/
diff --git a/thirdparty/libvorbis/window.c b/thirdparty/libvorbis/window.c
index 0305b79297..b3b7ce0163 100644
--- a/thirdparty/libvorbis/window.c
+++ b/thirdparty/libvorbis/window.c
@@ -11,7 +11,6 @@
********************************************************************
function: window functions
- last mod: $Id: window.c 19028 2013-12-02 23:23:39Z tterribe $
********************************************************************/
diff --git a/thirdparty/libvorbis/window.h b/thirdparty/libvorbis/window.h
index 51f97599f5..6ac260749e 100644
--- a/thirdparty/libvorbis/window.h
+++ b/thirdparty/libvorbis/window.h
@@ -11,7 +11,6 @@
********************************************************************
function: window functions
- last mod: $Id: window.h 19028 2013-12-02 23:23:39Z tterribe $
********************************************************************/
diff --git a/thirdparty/libwebp/AUTHORS b/thirdparty/libwebp/AUTHORS
index 70423cb4dd..83c7b9c5eb 100644
--- a/thirdparty/libwebp/AUTHORS
+++ b/thirdparty/libwebp/AUTHORS
@@ -2,25 +2,38 @@ Contributors:
- Charles Munger (clm at google dot com)
- Christian Duvivier (cduvivier at google dot com)
- Djordje Pesut (djordje dot pesut at imgtec dot com)
+- Hui Su (huisu at google dot com)
- James Zern (jzern at google dot com)
- Jan Engelhardt (jengelh at medozas dot de)
+- Jehan (jehan at girinstud dot io)
- Johann (johann dot koenig at duck dot com)
- Jovan Zelincevic (jovan dot zelincevic at imgtec dot com)
- Jyrki Alakuijala (jyrki at google dot com)
-- levytamar82 (tamar dot levy at intel dot com)
+- Lode Vandevenne (lode at google dot com)
- Lou Quillio (louquillio at google dot com)
- Mans Rullgard (mans at mansr dot com)
+- Marcin Kowalczyk (qrczak at google dot com)
- Martin Olsson (mnemo at minimum dot se)
- Mikołaj Zalewski (mikolajz at google dot com)
+- Mislav Bradac (mislavm at google dot com)
+- Nico Weber (thakis at chromium dot org)
- Noel Chromium (noel at chromium dot org)
+- Owen Rodley (orodley at google dot com)
+- Parag Salasakar (img dot mips1 at gmail dot com)
- Pascal Massimino (pascal dot massimino at gmail dot com)
- Paweł Hajdan, Jr (phajdan dot jr at chromium dot org)
- Pierre Joye (pierre dot php at gmail dot com)
- Sam Clegg (sbc at chromium dot org)
+- Scott Hancher (seh at google dot com)
- Scott LaVarnway (slavarnway at google dot com)
- Scott Talbot (s at chikachow dot org)
- Slobodan Prijic (slobodan dot prijic at imgtec dot com)
- Somnath Banerjee (somnath dot banerjee at gmail dot com)
+- Sriraman Tallam (tmsriram at google dot com)
+- Tamar Levy (tamar dot levy at intel dot com)
- Timothy Gu (timothygu99 at gmail dot com)
- Urvang Joshi (urvang at google dot com)
- Vikas Arora (vikasa at google dot com)
+- Vincent Rabaud (vrabaud at google dot com)
+- Vlad Tsyrklevich (vtsyrklevich at chromium dot org)
+- Yang Zhang (yang dot zhang at arm dot com)
diff --git a/thirdparty/libwebp/src/dec/frame_dec.c b/thirdparty/libwebp/src/dec/frame_dec.c
index 517d0f5850..a9d5430d00 100644
--- a/thirdparty/libwebp/src/dec/frame_dec.c
+++ b/thirdparty/libwebp/src/dec/frame_dec.c
@@ -400,7 +400,9 @@ static void DitherRow(VP8Decoder* const dec) {
#define MACROBLOCK_VPOS(mb_y) ((mb_y) * 16) // vertical position of a MB
// Finalize and transmit a complete row. Return false in case of user-abort.
-static int FinishRow(VP8Decoder* const dec, VP8Io* const io) {
+static int FinishRow(void* arg1, void* arg2) {
+ VP8Decoder* const dec = (VP8Decoder*)arg1;
+ VP8Io* const io = (VP8Io*)arg2;
int ok = 1;
const VP8ThreadContext* const ctx = &dec->thread_ctx_;
const int cache_id = ctx->id_;
@@ -448,10 +450,9 @@ static int FinishRow(VP8Decoder* const dec, VP8Io* const io) {
if (y_end > io->crop_bottom) {
y_end = io->crop_bottom; // make sure we don't overflow on last row.
}
+ // If dec->alpha_data_ is not NULL, we have some alpha plane present.
io->a = NULL;
if (dec->alpha_data_ != NULL && y_start < y_end) {
- // TODO(skal): testing presence of alpha with dec->alpha_data_ is not a
- // good idea.
io->a = VP8DecompressAlphaRows(dec, io, y_start, y_end - y_start);
if (io->a == NULL) {
return VP8SetError(dec, VP8_STATUS_BITSTREAM_ERROR,
@@ -558,7 +559,6 @@ VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) {
if (io->bypass_filtering) {
dec->filter_type_ = 0;
}
- // TODO(skal): filter type / strength / sharpness forcing
// Define the area where we can skip in-loop filtering, in case of cropping.
//
@@ -569,8 +569,6 @@ VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) {
// Means: there's a dependency chain that goes all the way up to the
// top-left corner of the picture (MB #0). We must filter all the previous
// macroblocks.
- // TODO(skal): add an 'approximate_decoding' option, that won't produce
- // a 1:1 bit-exactness for complex filtering?
{
const int extra_pixels = kFilterExtraRows[dec->filter_type_];
if (dec->filter_type_ == 2) {
@@ -651,7 +649,7 @@ static int InitThreadContext(VP8Decoder* const dec) {
}
worker->data1 = dec;
worker->data2 = (void*)&dec->thread_ctx_.io_;
- worker->hook = (WebPWorkerHook)FinishRow;
+ worker->hook = FinishRow;
dec->num_caches_ =
(dec->filter_type_ > 0) ? MT_CACHE_LINES : MT_CACHE_LINES - 1;
} else {
diff --git a/thirdparty/libwebp/src/dec/vp8_dec.c b/thirdparty/libwebp/src/dec/vp8_dec.c
index 6212efd179..c904b529f6 100644
--- a/thirdparty/libwebp/src/dec/vp8_dec.c
+++ b/thirdparty/libwebp/src/dec/vp8_dec.c
@@ -491,7 +491,7 @@ static int GetCoeffsAlt(VP8BitReader* const br,
return 16;
}
-WEBP_TSAN_IGNORE_FUNCTION static void InitGetCoeffs(void) {
+static WEBP_TSAN_IGNORE_FUNCTION void InitGetCoeffs(void) {
if (GetCoeffs == NULL) {
if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) {
GetCoeffs = GetCoeffsAlt;
diff --git a/thirdparty/libwebp/src/dec/vp8i_dec.h b/thirdparty/libwebp/src/dec/vp8i_dec.h
index 28244d9d7a..c929933e1c 100644
--- a/thirdparty/libwebp/src/dec/vp8i_dec.h
+++ b/thirdparty/libwebp/src/dec/vp8i_dec.h
@@ -30,9 +30,9 @@ extern "C" {
// Various defines and enums
// version numbers
-#define DEC_MAJ_VERSION 0
-#define DEC_MIN_VERSION 6
-#define DEC_REV_VERSION 1
+#define DEC_MAJ_VERSION 1
+#define DEC_MIN_VERSION 0
+#define DEC_REV_VERSION 0
// YUV-cache parameters. Cache is 32-bytes wide (= one cacheline).
// Constraints are: We need to store one 16x16 block of luma samples (y),
diff --git a/thirdparty/libwebp/src/dec/vp8l_dec.c b/thirdparty/libwebp/src/dec/vp8l_dec.c
index 42ea3b5e4c..0570f53a77 100644
--- a/thirdparty/libwebp/src/dec/vp8l_dec.c
+++ b/thirdparty/libwebp/src/dec/vp8l_dec.c
@@ -1643,17 +1643,17 @@ int VP8LDecodeImage(VP8LDecoder* const dec) {
#if !defined(WEBP_REDUCE_SIZE)
if (io->use_scaling && !AllocateAndInitRescaler(dec, io)) goto Err;
-
- if (io->use_scaling || WebPIsPremultipliedMode(dec->output_->colorspace)) {
- // need the alpha-multiply functions for premultiplied output or rescaling
- WebPInitAlphaProcessing();
- }
#else
if (io->use_scaling) {
dec->status_ = VP8_STATUS_INVALID_PARAM;
goto Err;
}
#endif
+ if (io->use_scaling || WebPIsPremultipliedMode(dec->output_->colorspace)) {
+ // need the alpha-multiply functions for premultiplied output or rescaling
+ WebPInitAlphaProcessing();
+ }
+
if (!WebPIsRGBMode(dec->output_->colorspace)) {
WebPInitConvertARGBToYUV();
if (dec->output_->u.YUVA.a != NULL) WebPInitAlphaProcessing();
diff --git a/thirdparty/libwebp/src/demux/demux.c b/thirdparty/libwebp/src/demux/demux.c
index 79c24a5a7f..684215e3de 100644
--- a/thirdparty/libwebp/src/demux/demux.c
+++ b/thirdparty/libwebp/src/demux/demux.c
@@ -23,9 +23,9 @@
#include "src/webp/demux.h"
#include "src/webp/format_constants.h"
-#define DMUX_MAJ_VERSION 0
-#define DMUX_MIN_VERSION 3
-#define DMUX_REV_VERSION 3
+#define DMUX_MAJ_VERSION 1
+#define DMUX_MIN_VERSION 0
+#define DMUX_REV_VERSION 0
typedef struct {
size_t start_; // start location of the data
diff --git a/thirdparty/libwebp/src/dsp/alpha_processing.c b/thirdparty/libwebp/src/dsp/alpha_processing.c
index 590e3bc312..819d1391f2 100644
--- a/thirdparty/libwebp/src/dsp/alpha_processing.c
+++ b/thirdparty/libwebp/src/dsp/alpha_processing.c
@@ -366,6 +366,16 @@ static WEBP_INLINE uint32_t MakeARGB32(int a, int r, int g, int b) {
return (((uint32_t)a << 24) | (r << 16) | (g << 8) | b);
}
+#ifdef WORDS_BIGENDIAN
+static void PackARGB_C(const uint8_t* a, const uint8_t* r, const uint8_t* g,
+ const uint8_t* b, int len, uint32_t* out) {
+ int i;
+ for (i = 0; i < len; ++i) {
+ out[i] = MakeARGB32(a[4 * i], r[4 * i], g[4 * i], b[4 * i]);
+ }
+}
+#endif
+
static void PackRGB_C(const uint8_t* r, const uint8_t* g, const uint8_t* b,
int len, int step, uint32_t* out) {
int i, offset = 0;
@@ -381,6 +391,10 @@ int (*WebPDispatchAlpha)(const uint8_t*, int, int, int, uint8_t*, int);
void (*WebPDispatchAlphaToGreen)(const uint8_t*, int, int, int, uint32_t*, int);
int (*WebPExtractAlpha)(const uint8_t*, int, int, int, uint8_t*, int);
void (*WebPExtractGreen)(const uint32_t* argb, uint8_t* alpha, int size);
+#ifdef WORDS_BIGENDIAN
+void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r, const uint8_t* g,
+ const uint8_t* b, int, uint32_t*);
+#endif
void (*WebPPackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b,
int len, int step, uint32_t* out);
@@ -395,16 +409,14 @@ extern void WebPInitAlphaProcessingSSE2(void);
extern void WebPInitAlphaProcessingSSE41(void);
extern void WebPInitAlphaProcessingNEON(void);
-static volatile VP8CPUInfo alpha_processing_last_cpuinfo_used =
- (VP8CPUInfo)&alpha_processing_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void) {
- if (alpha_processing_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(WebPInitAlphaProcessing) {
WebPMultARGBRow = WebPMultARGBRow_C;
WebPMultRow = WebPMultRow_C;
WebPApplyAlphaMultiply4444 = ApplyAlphaMultiply_16b_C;
+#ifdef WORDS_BIGENDIAN
+ WebPPackARGB = PackARGB_C;
+#endif
WebPPackRGB = PackRGB_C;
#if !WEBP_NEON_OMIT_C_CODE
WebPApplyAlphaMultiply = ApplyAlphaMultiply_C;
@@ -451,9 +463,10 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void) {
assert(WebPDispatchAlphaToGreen != NULL);
assert(WebPExtractAlpha != NULL);
assert(WebPExtractGreen != NULL);
+#ifdef WORDS_BIGENDIAN
+ assert(WebPPackARGB != NULL);
+#endif
assert(WebPPackRGB != NULL);
assert(WebPHasAlpha8b != NULL);
assert(WebPHasAlpha32b != NULL);
-
- alpha_processing_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c b/thirdparty/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c
index e0dc91bab9..0090e87cd1 100644
--- a/thirdparty/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c
+++ b/thirdparty/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c
@@ -125,6 +125,49 @@ static void MultARGBRow_MIPSdspR2(uint32_t* const ptr, int width,
}
}
+#ifdef WORDS_BIGENDIAN
+static void PackARGB_MIPSdspR2(const uint8_t* a, const uint8_t* r,
+ const uint8_t* g, const uint8_t* b, int len,
+ uint32_t* out) {
+ int temp0, temp1, temp2, temp3, offset;
+ const int rest = len & 1;
+ const uint32_t* const loop_end = out + len - rest;
+ const int step = 4;
+ __asm__ volatile (
+ "xor %[offset], %[offset], %[offset] \n\t"
+ "beq %[loop_end], %[out], 0f \n\t"
+ "2: \n\t"
+ "lbux %[temp0], %[offset](%[a]) \n\t"
+ "lbux %[temp1], %[offset](%[r]) \n\t"
+ "lbux %[temp2], %[offset](%[g]) \n\t"
+ "lbux %[temp3], %[offset](%[b]) \n\t"
+ "ins %[temp1], %[temp0], 16, 16 \n\t"
+ "ins %[temp3], %[temp2], 16, 16 \n\t"
+ "addiu %[out], %[out], 4 \n\t"
+ "precr.qb.ph %[temp0], %[temp1], %[temp3] \n\t"
+ "sw %[temp0], -4(%[out]) \n\t"
+ "addu %[offset], %[offset], %[step] \n\t"
+ "bne %[loop_end], %[out], 2b \n\t"
+ "0: \n\t"
+ "beq %[rest], $zero, 1f \n\t"
+ "lbux %[temp0], %[offset](%[a]) \n\t"
+ "lbux %[temp1], %[offset](%[r]) \n\t"
+ "lbux %[temp2], %[offset](%[g]) \n\t"
+ "lbux %[temp3], %[offset](%[b]) \n\t"
+ "ins %[temp1], %[temp0], 16, 16 \n\t"
+ "ins %[temp3], %[temp2], 16, 16 \n\t"
+ "precr.qb.ph %[temp0], %[temp1], %[temp3] \n\t"
+ "sw %[temp0], 0(%[out]) \n\t"
+ "1: \n\t"
+ : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2),
+ [temp3]"=&r"(temp3), [offset]"=&r"(offset), [out]"+&r"(out)
+ : [a]"r"(a), [r]"r"(r), [g]"r"(g), [b]"r"(b), [step]"r"(step),
+ [loop_end]"r"(loop_end), [rest]"r"(rest)
+ : "memory"
+ );
+}
+#endif // WORDS_BIGENDIAN
+
static void PackRGB_MIPSdspR2(const uint8_t* r, const uint8_t* g,
const uint8_t* b, int len, int step,
uint32_t* out) {
@@ -172,6 +215,9 @@ extern void WebPInitAlphaProcessingMIPSdspR2(void);
WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessingMIPSdspR2(void) {
WebPDispatchAlpha = DispatchAlpha_MIPSdspR2;
WebPMultARGBRow = MultARGBRow_MIPSdspR2;
+#ifdef WORDS_BIGENDIAN
+ WebPPackARGB = PackARGB_MIPSdspR2;
+#endif
WebPPackRGB = PackRGB_MIPSdspR2;
}
diff --git a/thirdparty/libwebp/src/dsp/common_sse2.h b/thirdparty/libwebp/src/dsp/common_sse2.h
index 995d7cf4ea..e9f1ebff44 100644
--- a/thirdparty/libwebp/src/dsp/common_sse2.h
+++ b/thirdparty/libwebp/src/dsp/common_sse2.h
@@ -128,9 +128,9 @@ static WEBP_INLINE void VP8Transpose_2_4x4_16b(
// Pack the planar buffers
// rrrr... rrrr... gggg... gggg... bbbb... bbbb....
// triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ...
-static WEBP_INLINE void VP8PlanarTo24b(__m128i* const in0, __m128i* const in1,
- __m128i* const in2, __m128i* const in3,
- __m128i* const in4, __m128i* const in5) {
+static WEBP_INLINE void VP8PlanarTo24b_SSE2(
+ __m128i* const in0, __m128i* const in1, __m128i* const in2,
+ __m128i* const in3, __m128i* const in4, __m128i* const in5) {
// The input is 6 registers of sixteen 8b but for the sake of explanation,
// let's take 6 registers of four 8b values.
// To pack, we will keep taking one every two 8b integer and move it
@@ -159,10 +159,10 @@ static WEBP_INLINE void VP8PlanarTo24b(__m128i* const in0, __m128i* const in1,
// Convert four packed four-channel buffers like argbargbargbargb... into the
// split channels aaaaa ... rrrr ... gggg .... bbbbb ......
-static WEBP_INLINE void VP8L32bToPlanar(__m128i* const in0,
- __m128i* const in1,
- __m128i* const in2,
- __m128i* const in3) {
+static WEBP_INLINE void VP8L32bToPlanar_SSE2(__m128i* const in0,
+ __m128i* const in1,
+ __m128i* const in2,
+ __m128i* const in3) {
// Column-wise transpose.
const __m128i A0 = _mm_unpacklo_epi8(*in0, *in1);
const __m128i A1 = _mm_unpackhi_epi8(*in0, *in1);
diff --git a/thirdparty/libwebp/src/dsp/common_sse41.h b/thirdparty/libwebp/src/dsp/common_sse41.h
new file mode 100644
index 0000000000..2f173c024a
--- /dev/null
+++ b/thirdparty/libwebp/src/dsp/common_sse41.h
@@ -0,0 +1,132 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the COPYING file in the root of the source
+// tree. An additional intellectual property rights grant can be found
+// in the file PATENTS. All contributing project authors may
+// be found in the AUTHORS file in the root of the source tree.
+// -----------------------------------------------------------------------------
+//
+// SSE4 code common to several files.
+//
+// Author: Vincent Rabaud (vrabaud@google.com)
+
+#ifndef WEBP_DSP_COMMON_SSE41_H_
+#define WEBP_DSP_COMMON_SSE41_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(WEBP_USE_SSE41)
+#include <smmintrin.h>
+
+//------------------------------------------------------------------------------
+// Channel mixing.
+// Shuffles the input buffer as A0 0 0 A1 0 0 A2 ...
+#define WEBP_SSE41_SHUFF(OUT, IN0, IN1) \
+ OUT##0 = _mm_shuffle_epi8(*IN0, shuff0); \
+ OUT##1 = _mm_shuffle_epi8(*IN0, shuff1); \
+ OUT##2 = _mm_shuffle_epi8(*IN0, shuff2); \
+ OUT##3 = _mm_shuffle_epi8(*IN1, shuff0); \
+ OUT##4 = _mm_shuffle_epi8(*IN1, shuff1); \
+ OUT##5 = _mm_shuffle_epi8(*IN1, shuff2);
+
+// Pack the planar buffers
+// rrrr... rrrr... gggg... gggg... bbbb... bbbb....
+// triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ...
+static WEBP_INLINE void VP8PlanarTo24b_SSE41(
+ __m128i* const in0, __m128i* const in1, __m128i* const in2,
+ __m128i* const in3, __m128i* const in4, __m128i* const in5) {
+ __m128i R0, R1, R2, R3, R4, R5;
+ __m128i G0, G1, G2, G3, G4, G5;
+ __m128i B0, B1, B2, B3, B4, B5;
+
+ // Process R.
+ {
+ const __m128i shuff0 = _mm_set_epi8(
+ 5, -1, -1, 4, -1, -1, 3, -1, -1, 2, -1, -1, 1, -1, -1, 0);
+ const __m128i shuff1 = _mm_set_epi8(
+ -1, 10, -1, -1, 9, -1, -1, 8, -1, -1, 7, -1, -1, 6, -1, -1);
+ const __m128i shuff2 = _mm_set_epi8(
+ -1, -1, 15, -1, -1, 14, -1, -1, 13, -1, -1, 12, -1, -1, 11, -1);
+ WEBP_SSE41_SHUFF(R, in0, in1)
+ }
+
+ // Process G.
+ {
+ // Same as before, just shifted to the left by one and including the right
+ // padding.
+ const __m128i shuff0 = _mm_set_epi8(
+ -1, -1, 4, -1, -1, 3, -1, -1, 2, -1, -1, 1, -1, -1, 0, -1);
+ const __m128i shuff1 = _mm_set_epi8(
+ 10, -1, -1, 9, -1, -1, 8, -1, -1, 7, -1, -1, 6, -1, -1, 5);
+ const __m128i shuff2 = _mm_set_epi8(
+ -1, 15, -1, -1, 14, -1, -1, 13, -1, -1, 12, -1, -1, 11, -1, -1);
+ WEBP_SSE41_SHUFF(G, in2, in3)
+ }
+
+ // Process B.
+ {
+ const __m128i shuff0 = _mm_set_epi8(
+ -1, 4, -1, -1, 3, -1, -1, 2, -1, -1, 1, -1, -1, 0, -1, -1);
+ const __m128i shuff1 = _mm_set_epi8(
+ -1, -1, 9, -1, -1, 8, -1, -1, 7, -1, -1, 6, -1, -1, 5, -1);
+ const __m128i shuff2 = _mm_set_epi8(
+ 15, -1, -1, 14, -1, -1, 13, -1, -1, 12, -1, -1, 11, -1, -1, 10);
+ WEBP_SSE41_SHUFF(B, in4, in5)
+ }
+
+ // OR the different channels.
+ {
+ const __m128i RG0 = _mm_or_si128(R0, G0);
+ const __m128i RG1 = _mm_or_si128(R1, G1);
+ const __m128i RG2 = _mm_or_si128(R2, G2);
+ const __m128i RG3 = _mm_or_si128(R3, G3);
+ const __m128i RG4 = _mm_or_si128(R4, G4);
+ const __m128i RG5 = _mm_or_si128(R5, G5);
+ *in0 = _mm_or_si128(RG0, B0);
+ *in1 = _mm_or_si128(RG1, B1);
+ *in2 = _mm_or_si128(RG2, B2);
+ *in3 = _mm_or_si128(RG3, B3);
+ *in4 = _mm_or_si128(RG4, B4);
+ *in5 = _mm_or_si128(RG5, B5);
+ }
+}
+
+#undef WEBP_SSE41_SHUFF
+
+// Convert four packed four-channel buffers like argbargbargbargb... into the
+// split channels aaaaa ... rrrr ... gggg .... bbbbb ......
+static WEBP_INLINE void VP8L32bToPlanar_SSE41(__m128i* const in0,
+ __m128i* const in1,
+ __m128i* const in2,
+ __m128i* const in3) {
+ // aaaarrrrggggbbbb
+ const __m128i shuff0 =
+ _mm_set_epi8(15, 11, 7, 3, 14, 10, 6, 2, 13, 9, 5, 1, 12, 8, 4, 0);
+ const __m128i A0 = _mm_shuffle_epi8(*in0, shuff0);
+ const __m128i A1 = _mm_shuffle_epi8(*in1, shuff0);
+ const __m128i A2 = _mm_shuffle_epi8(*in2, shuff0);
+ const __m128i A3 = _mm_shuffle_epi8(*in3, shuff0);
+ // A0A1R0R1
+ // G0G1B0B1
+ // A2A3R2R3
+ // G0G1B0B1
+ const __m128i B0 = _mm_unpacklo_epi32(A0, A1);
+ const __m128i B1 = _mm_unpackhi_epi32(A0, A1);
+ const __m128i B2 = _mm_unpacklo_epi32(A2, A3);
+ const __m128i B3 = _mm_unpackhi_epi32(A2, A3);
+ *in3 = _mm_unpacklo_epi64(B0, B2);
+ *in2 = _mm_unpackhi_epi64(B0, B2);
+ *in1 = _mm_unpacklo_epi64(B1, B3);
+ *in0 = _mm_unpackhi_epi64(B1, B3);
+}
+
+#endif // WEBP_USE_SSE41
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // WEBP_DSP_COMMON_SSE41_H_
diff --git a/thirdparty/libwebp/src/dsp/cost.c b/thirdparty/libwebp/src/dsp/cost.c
index a732389d58..634ccc2085 100644
--- a/thirdparty/libwebp/src/dsp/cost.c
+++ b/thirdparty/libwebp/src/dsp/cost.c
@@ -378,12 +378,7 @@ extern void VP8EncDspCostInitMIPS32(void);
extern void VP8EncDspCostInitMIPSdspR2(void);
extern void VP8EncDspCostInitSSE2(void);
-static volatile VP8CPUInfo cost_last_cpuinfo_used =
- (VP8CPUInfo)&cost_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInit(void) {
- if (cost_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8EncDspCostInit) {
VP8GetResidualCost = GetResidualCost_C;
VP8SetResidualCoeffs = SetResidualCoeffs_C;
@@ -405,8 +400,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInit(void) {
}
#endif
}
-
- cost_last_cpuinfo_used = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------
diff --git a/thirdparty/libwebp/src/dsp/dec.c b/thirdparty/libwebp/src/dsp/dec.c
index 7e82407567..1119842dd3 100644
--- a/thirdparty/libwebp/src/dsp/dec.c
+++ b/thirdparty/libwebp/src/dsp/dec.c
@@ -741,12 +741,7 @@ extern void VP8DspInitMIPS32(void);
extern void VP8DspInitMIPSdspR2(void);
extern void VP8DspInitMSA(void);
-static volatile VP8CPUInfo dec_last_cpuinfo_used =
- (VP8CPUInfo)&dec_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) {
- if (dec_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8DspInit) {
VP8InitClipTables();
#if !WEBP_NEON_OMIT_C_CODE
@@ -889,6 +884,4 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) {
assert(VP8PredChroma8[5] != NULL);
assert(VP8PredChroma8[6] != NULL);
assert(VP8DitherCombine8x8 != NULL);
-
- dec_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/dsp.h b/thirdparty/libwebp/src/dsp/dsp.h
index 99eefe092f..4ab77a5130 100644
--- a/thirdparty/libwebp/src/dsp/dsp.h
+++ b/thirdparty/libwebp/src/dsp/dsp.h
@@ -141,6 +141,42 @@ extern "C" {
#endif
#endif
+#if defined(WEBP_USE_THREAD) && !defined(_WIN32)
+#include <pthread.h> // NOLINT
+
+#define WEBP_DSP_INIT(func) do { \
+ static volatile VP8CPUInfo func ## _last_cpuinfo_used = \
+ (VP8CPUInfo)&func ## _last_cpuinfo_used; \
+ static pthread_mutex_t func ## _lock = PTHREAD_MUTEX_INITIALIZER; \
+ if (pthread_mutex_lock(&func ## _lock)) break; \
+ if (func ## _last_cpuinfo_used != VP8GetCPUInfo) func(); \
+ func ## _last_cpuinfo_used = VP8GetCPUInfo; \
+ (void)pthread_mutex_unlock(&func ## _lock); \
+} while (0)
+#else // !(defined(WEBP_USE_THREAD) && !defined(_WIN32))
+#define WEBP_DSP_INIT(func) do { \
+ static volatile VP8CPUInfo func ## _last_cpuinfo_used = \
+ (VP8CPUInfo)&func ## _last_cpuinfo_used; \
+ if (func ## _last_cpuinfo_used == VP8GetCPUInfo) break; \
+ func(); \
+ func ## _last_cpuinfo_used = VP8GetCPUInfo; \
+} while (0)
+#endif // defined(WEBP_USE_THREAD) && !defined(_WIN32)
+
+// Defines an Init + helper function that control multiple initialization of
+// function pointers / tables.
+/* Usage:
+ WEBP_DSP_INIT_FUNC(InitFunc) {
+ ...function body
+ }
+*/
+#define WEBP_DSP_INIT_FUNC(name) \
+ static WEBP_TSAN_IGNORE_FUNCTION void name ## _body(void); \
+ WEBP_TSAN_IGNORE_FUNCTION void name(void) { \
+ WEBP_DSP_INIT(name ## _body); \
+ } \
+ static WEBP_TSAN_IGNORE_FUNCTION void name ## _body(void)
+
#define WEBP_UBSAN_IGNORE_UNDEF
#define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW
#if defined(__clang__) && defined(__has_attribute)
@@ -166,6 +202,13 @@ extern "C" {
#define WEBP_SWAP_16BIT_CSP 0
#endif
+// some endian fix (e.g.: mips-gcc doesn't define __BIG_ENDIAN__)
+#if !defined(WORDS_BIGENDIAN) && \
+ (defined(__BIG_ENDIAN__) || defined(_M_PPC) || \
+ (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)))
+#define WORDS_BIGENDIAN
+#endif
+
typedef enum {
kSSE2,
kSSE3,
@@ -189,7 +232,7 @@ WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
// avoiding a compiler warning.
#define WEBP_DSP_INIT_STUB(func) \
extern void func(void); \
- WEBP_TSAN_IGNORE_FUNCTION void func(void) {}
+ void func(void) {}
//------------------------------------------------------------------------------
// Encoding
@@ -578,6 +621,13 @@ void WebPMultRow_C(uint8_t* const ptr, const uint8_t* const alpha,
int width, int inverse);
void WebPMultARGBRow_C(uint32_t* const ptr, int width, int inverse);
+#ifdef WORDS_BIGENDIAN
+// ARGB packing function: a/r/g/b input is rgba or bgra order.
+extern void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r,
+ const uint8_t* g, const uint8_t* b, int len,
+ uint32_t* out);
+#endif
+
// RGB packing function. 'step' can be 3 or 4. r/g/b input is rgb or bgr order.
extern void (*WebPPackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b,
int len, int step, uint32_t* out);
diff --git a/thirdparty/libwebp/src/dsp/enc.c b/thirdparty/libwebp/src/dsp/enc.c
index 1c807f1df7..fa23b40a30 100644
--- a/thirdparty/libwebp/src/dsp/enc.c
+++ b/thirdparty/libwebp/src/dsp/enc.c
@@ -740,12 +740,7 @@ extern void VP8EncDspInitMIPS32(void);
extern void VP8EncDspInitMIPSdspR2(void);
extern void VP8EncDspInitMSA(void);
-static volatile VP8CPUInfo enc_last_cpuinfo_used =
- (VP8CPUInfo)&enc_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) {
- if (enc_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8EncDspInit) {
VP8DspInit(); // common inverse transforms
InitTables();
@@ -838,6 +833,4 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) {
assert(VP8EncQuantizeBlockWHT != NULL);
assert(VP8Copy4x4 != NULL);
assert(VP8Copy16x8 != NULL);
-
- enc_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/filters.c b/thirdparty/libwebp/src/dsp/filters.c
index ca5f877da7..069a22eaef 100644
--- a/thirdparty/libwebp/src/dsp/filters.c
+++ b/thirdparty/libwebp/src/dsp/filters.c
@@ -238,12 +238,7 @@ extern void VP8FiltersInitMSA(void);
extern void VP8FiltersInitNEON(void);
extern void VP8FiltersInitSSE2(void);
-static volatile VP8CPUInfo filters_last_cpuinfo_used =
- (VP8CPUInfo)&filters_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInit(void) {
- if (filters_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8FiltersInit) {
WebPUnfilters[WEBP_FILTER_NONE] = NULL;
#if !WEBP_NEON_OMIT_C_CODE
WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_C;
@@ -289,6 +284,4 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInit(void) {
assert(WebPFilters[WEBP_FILTER_HORIZONTAL] != NULL);
assert(WebPFilters[WEBP_FILTER_VERTICAL] != NULL);
assert(WebPFilters[WEBP_FILTER_GRADIENT] != NULL);
-
- filters_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/lossless.c b/thirdparty/libwebp/src/dsp/lossless.c
index 83f553d9ad..f9b3c182d3 100644
--- a/thirdparty/libwebp/src/dsp/lossless.c
+++ b/thirdparty/libwebp/src/dsp/lossless.c
@@ -577,9 +577,6 @@ extern void VP8LDspInitNEON(void);
extern void VP8LDspInitMIPSdspR2(void);
extern void VP8LDspInitMSA(void);
-static volatile VP8CPUInfo lossless_last_cpuinfo_used =
- (VP8CPUInfo)&lossless_last_cpuinfo_used;
-
#define COPY_PREDICTOR_ARRAY(IN, OUT) do { \
(OUT)[0] = IN##0_C; \
(OUT)[1] = IN##1_C; \
@@ -599,9 +596,7 @@ static volatile VP8CPUInfo lossless_last_cpuinfo_used =
(OUT)[15] = IN##0_C; \
} while (0);
-WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) {
- if (lossless_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8LDspInit) {
COPY_PREDICTOR_ARRAY(Predictor, VP8LPredictors)
COPY_PREDICTOR_ARRAY(Predictor, VP8LPredictors_C)
COPY_PREDICTOR_ARRAY(PredictorAdd, VP8LPredictorsAdd)
@@ -658,8 +653,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) {
assert(VP8LConvertBGRAToRGB565 != NULL);
assert(VP8LMapColor32b != NULL);
assert(VP8LMapColor8b != NULL);
-
- lossless_last_cpuinfo_used = VP8GetCPUInfo;
}
#undef COPY_PREDICTOR_ARRAY
diff --git a/thirdparty/libwebp/src/dsp/lossless.h b/thirdparty/libwebp/src/dsp/lossless.h
index a99dbda686..b2bbdfc93c 100644
--- a/thirdparty/libwebp/src/dsp/lossless.h
+++ b/thirdparty/libwebp/src/dsp/lossless.h
@@ -25,10 +25,6 @@
extern "C" {
#endif
-#ifdef WEBP_EXPERIMENTAL_FEATURES
-#include "src/enc/delta_palettization_enc.h"
-#endif // WEBP_EXPERIMENTAL_FEATURES
-
//------------------------------------------------------------------------------
// Decoding
diff --git a/thirdparty/libwebp/src/dsp/lossless_enc.c b/thirdparty/libwebp/src/dsp/lossless_enc.c
index 92ca3c0542..d608326fef 100644
--- a/thirdparty/libwebp/src/dsp/lossless_enc.c
+++ b/thirdparty/libwebp/src/dsp/lossless_enc.c
@@ -863,12 +863,7 @@ extern void VP8LEncDspInitMIPS32(void);
extern void VP8LEncDspInitMIPSdspR2(void);
extern void VP8LEncDspInitMSA(void);
-static volatile VP8CPUInfo lossless_enc_last_cpuinfo_used =
- (VP8CPUInfo)&lossless_enc_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInit(void) {
- if (lossless_enc_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8LEncDspInit) {
VP8LDspInit();
#if !WEBP_NEON_OMIT_C_CODE
@@ -1011,8 +1006,6 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInit(void) {
assert(VP8LPredictorsSub_C[13] != NULL);
assert(VP8LPredictorsSub_C[14] != NULL);
assert(VP8LPredictorsSub_C[15] != NULL);
-
- lossless_enc_last_cpuinfo_used = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------
diff --git a/thirdparty/libwebp/src/dsp/lossless_enc_sse2.c b/thirdparty/libwebp/src/dsp/lossless_enc_sse2.c
index 1eaf35ca8e..f84a9909e1 100644
--- a/thirdparty/libwebp/src/dsp/lossless_enc_sse2.c
+++ b/thirdparty/libwebp/src/dsp/lossless_enc_sse2.c
@@ -46,16 +46,14 @@ static void SubtractGreenFromBlueAndRed_SSE2(uint32_t* argb_data,
//------------------------------------------------------------------------------
// Color Transform
+#define MK_CST_16(HI, LO) \
+ _mm_set1_epi32((int)(((uint32_t)(HI) << 16) | ((LO) & 0xffff)))
+
static void TransformColor_SSE2(const VP8LMultipliers* const m,
uint32_t* argb_data, int num_pixels) {
- const __m128i mults_rb = _mm_set_epi16(
- CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_),
- CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_),
- CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_),
- CST_5b(m->green_to_red_), CST_5b(m->green_to_blue_));
- const __m128i mults_b2 = _mm_set_epi16(
- CST_5b(m->red_to_blue_), 0, CST_5b(m->red_to_blue_), 0,
- CST_5b(m->red_to_blue_), 0, CST_5b(m->red_to_blue_), 0);
+ const __m128i mults_rb = MK_CST_16(CST_5b(m->green_to_red_),
+ CST_5b(m->green_to_blue_));
+ const __m128i mults_b2 = MK_CST_16(CST_5b(m->red_to_blue_), 0);
const __m128i mask_ag = _mm_set1_epi32(0xff00ff00); // alpha-green masks
const __m128i mask_rb = _mm_set1_epi32(0x00ff00ff); // red-blue masks
int i;
@@ -85,12 +83,8 @@ static void CollectColorBlueTransforms_SSE2(const uint32_t* argb, int stride,
int tile_width, int tile_height,
int green_to_blue, int red_to_blue,
int histo[]) {
- const __m128i mults_r = _mm_set_epi16(
- CST_5b(red_to_blue), 0, CST_5b(red_to_blue), 0,
- CST_5b(red_to_blue), 0, CST_5b(red_to_blue), 0);
- const __m128i mults_g = _mm_set_epi16(
- 0, CST_5b(green_to_blue), 0, CST_5b(green_to_blue),
- 0, CST_5b(green_to_blue), 0, CST_5b(green_to_blue));
+ const __m128i mults_r = MK_CST_16(CST_5b(red_to_blue), 0);
+ const __m128i mults_g = MK_CST_16(0, CST_5b(green_to_blue));
const __m128i mask_g = _mm_set1_epi32(0x00ff00); // green mask
const __m128i mask_b = _mm_set1_epi32(0x0000ff); // blue mask
int y;
@@ -135,9 +129,7 @@ static void CollectColorBlueTransforms_SSE2(const uint32_t* argb, int stride,
static void CollectColorRedTransforms_SSE2(const uint32_t* argb, int stride,
int tile_width, int tile_height,
int green_to_red, int histo[]) {
- const __m128i mults_g = _mm_set_epi16(
- 0, CST_5b(green_to_red), 0, CST_5b(green_to_red),
- 0, CST_5b(green_to_red), 0, CST_5b(green_to_red));
+ const __m128i mults_g = MK_CST_16(0, CST_5b(green_to_red));
const __m128i mask_g = _mm_set1_epi32(0x00ff00); // green mask
const __m128i mask = _mm_set1_epi32(0xff);
@@ -174,6 +166,7 @@ static void CollectColorRedTransforms_SSE2(const uint32_t* argb, int stride,
}
}
#undef SPAN
+#undef MK_CST_16
//------------------------------------------------------------------------------
diff --git a/thirdparty/libwebp/src/dsp/lossless_enc_sse41.c b/thirdparty/libwebp/src/dsp/lossless_enc_sse41.c
index 3526a342d3..2e12a712eb 100644
--- a/thirdparty/libwebp/src/dsp/lossless_enc_sse41.c
+++ b/thirdparty/libwebp/src/dsp/lossless_enc_sse41.c
@@ -18,6 +18,9 @@
#include <smmintrin.h>
#include "src/dsp/lossless.h"
+// For sign-extended multiplying constants, pre-shifted by 5:
+#define CST_5b(X) (((int16_t)((uint16_t)(X) << 8)) >> 5)
+
//------------------------------------------------------------------------------
// Subtract-Green Transform
@@ -39,12 +42,103 @@ static void SubtractGreenFromBlueAndRed_SSE41(uint32_t* argb_data,
}
//------------------------------------------------------------------------------
+// Color Transform
+
+#define SPAN 8
+static void CollectColorBlueTransforms_SSE41(const uint32_t* argb, int stride,
+ int tile_width, int tile_height,
+ int green_to_blue, int red_to_blue,
+ int histo[]) {
+ const __m128i mults_r = _mm_set1_epi16(CST_5b(red_to_blue));
+ const __m128i mults_g = _mm_set1_epi16(CST_5b(green_to_blue));
+ const __m128i mask_g = _mm_set1_epi16(0xff00); // green mask
+ const __m128i mask_gb = _mm_set1_epi32(0xffff); // green/blue mask
+ const __m128i mask_b = _mm_set1_epi16(0x00ff); // blue mask
+ const __m128i shuffler_lo = _mm_setr_epi8(-1, 2, -1, 6, -1, 10, -1, 14, -1,
+ -1, -1, -1, -1, -1, -1, -1);
+ const __m128i shuffler_hi = _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 2, -1, 6, -1, 10, -1, 14);
+ int y;
+ for (y = 0; y < tile_height; ++y) {
+ const uint32_t* const src = argb + y * stride;
+ int i, x;
+ for (x = 0; x + SPAN <= tile_width; x += SPAN) {
+ uint16_t values[SPAN];
+ const __m128i in0 = _mm_loadu_si128((__m128i*)&src[x + 0]);
+ const __m128i in1 = _mm_loadu_si128((__m128i*)&src[x + SPAN / 2]);
+ const __m128i r0 = _mm_shuffle_epi8(in0, shuffler_lo);
+ const __m128i r1 = _mm_shuffle_epi8(in1, shuffler_hi);
+ const __m128i r = _mm_or_si128(r0, r1); // r 0
+ const __m128i gb0 = _mm_and_si128(in0, mask_gb);
+ const __m128i gb1 = _mm_and_si128(in1, mask_gb);
+ const __m128i gb = _mm_packus_epi32(gb0, gb1); // g b
+ const __m128i g = _mm_and_si128(gb, mask_g); // g 0
+ const __m128i A = _mm_mulhi_epi16(r, mults_r); // x dbr
+ const __m128i B = _mm_mulhi_epi16(g, mults_g); // x dbg
+ const __m128i C = _mm_sub_epi8(gb, B); // x b'
+ const __m128i D = _mm_sub_epi8(C, A); // x b''
+ const __m128i E = _mm_and_si128(D, mask_b); // 0 b''
+ _mm_storeu_si128((__m128i*)values, E);
+ for (i = 0; i < SPAN; ++i) ++histo[values[i]];
+ }
+ }
+ {
+ const int left_over = tile_width & (SPAN - 1);
+ if (left_over > 0) {
+ VP8LCollectColorBlueTransforms_C(argb + tile_width - left_over, stride,
+ left_over, tile_height,
+ green_to_blue, red_to_blue, histo);
+ }
+ }
+}
+
+static void CollectColorRedTransforms_SSE41(const uint32_t* argb, int stride,
+ int tile_width, int tile_height,
+ int green_to_red, int histo[]) {
+ const __m128i mults_g = _mm_set1_epi16(CST_5b(green_to_red));
+ const __m128i mask_g = _mm_set1_epi32(0x00ff00); // green mask
+ const __m128i mask = _mm_set1_epi16(0xff);
+
+ int y;
+ for (y = 0; y < tile_height; ++y) {
+ const uint32_t* const src = argb + y * stride;
+ int i, x;
+ for (x = 0; x + SPAN <= tile_width; x += SPAN) {
+ uint16_t values[SPAN];
+ const __m128i in0 = _mm_loadu_si128((__m128i*)&src[x + 0]);
+ const __m128i in1 = _mm_loadu_si128((__m128i*)&src[x + SPAN / 2]);
+ const __m128i g0 = _mm_and_si128(in0, mask_g); // 0 0 | g 0
+ const __m128i g1 = _mm_and_si128(in1, mask_g);
+ const __m128i g = _mm_packus_epi32(g0, g1); // g 0
+ const __m128i A0 = _mm_srli_epi32(in0, 16); // 0 0 | x r
+ const __m128i A1 = _mm_srli_epi32(in1, 16);
+ const __m128i A = _mm_packus_epi32(A0, A1); // x r
+ const __m128i B = _mm_mulhi_epi16(g, mults_g); // x dr
+ const __m128i C = _mm_sub_epi8(A, B); // x r'
+ const __m128i D = _mm_and_si128(C, mask); // 0 r'
+ _mm_storeu_si128((__m128i*)values, D);
+ for (i = 0; i < SPAN; ++i) ++histo[values[i]];
+ }
+ }
+ {
+ const int left_over = tile_width & (SPAN - 1);
+ if (left_over > 0) {
+ VP8LCollectColorRedTransforms_C(argb + tile_width - left_over, stride,
+ left_over, tile_height, green_to_red,
+ histo);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
// Entry point
extern void VP8LEncDspInitSSE41(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitSSE41(void) {
VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed_SSE41;
+ VP8LCollectColorBlueTransforms = CollectColorBlueTransforms_SSE41;
+ VP8LCollectColorRedTransforms = CollectColorRedTransforms_SSE41;
}
#else // !WEBP_USE_SSE41
diff --git a/thirdparty/libwebp/src/dsp/lossless_sse2.c b/thirdparty/libwebp/src/dsp/lossless_sse2.c
index 653b466cd6..17d7576419 100644
--- a/thirdparty/libwebp/src/dsp/lossless_sse2.c
+++ b/thirdparty/libwebp/src/dsp/lossless_sse2.c
@@ -453,14 +453,11 @@ static void TransformColorInverse_SSE2(const VP8LMultipliers* const m,
int num_pixels, uint32_t* dst) {
// sign-extended multiplying constants, pre-shifted by 5.
#define CST(X) (((int16_t)(m->X << 8)) >> 5) // sign-extend
- const __m128i mults_rb = _mm_set_epi16(
- CST(green_to_red_), CST(green_to_blue_),
- CST(green_to_red_), CST(green_to_blue_),
- CST(green_to_red_), CST(green_to_blue_),
- CST(green_to_red_), CST(green_to_blue_));
- const __m128i mults_b2 = _mm_set_epi16(
- CST(red_to_blue_), 0, CST(red_to_blue_), 0,
- CST(red_to_blue_), 0, CST(red_to_blue_), 0);
+#define MK_CST_16(HI, LO) \
+ _mm_set1_epi32((int)(((uint32_t)(HI) << 16) | ((LO) & 0xffff)))
+ const __m128i mults_rb = MK_CST_16(CST(green_to_red_), CST(green_to_blue_));
+ const __m128i mults_b2 = MK_CST_16(CST(red_to_blue_), 0);
+#undef MK_CST_16
#undef CST
const __m128i mask_ag = _mm_set1_epi32(0xff00ff00); // alpha-green masks
int i;
@@ -503,11 +500,11 @@ static void ConvertBGRAToRGB_SSE2(const uint32_t* src, int num_pixels,
__m128i in5 = _mm_loadu_si128(in + 5);
__m128i in6 = _mm_loadu_si128(in + 6);
__m128i in7 = _mm_loadu_si128(in + 7);
- VP8L32bToPlanar(&in0, &in1, &in2, &in3);
- VP8L32bToPlanar(&in4, &in5, &in6, &in7);
+ VP8L32bToPlanar_SSE2(&in0, &in1, &in2, &in3);
+ VP8L32bToPlanar_SSE2(&in4, &in5, &in6, &in7);
// At this points, in1/in5 contains red only, in2/in6 green only ...
// Pack the colors in 24b RGB.
- VP8PlanarTo24b(&in1, &in5, &in2, &in6, &in3, &in7);
+ VP8PlanarTo24b_SSE2(&in1, &in5, &in2, &in6, &in3, &in7);
_mm_storeu_si128(out + 0, in1);
_mm_storeu_si128(out + 1, in5);
_mm_storeu_si128(out + 2, in2);
diff --git a/thirdparty/libwebp/src/dsp/rescaler.c b/thirdparty/libwebp/src/dsp/rescaler.c
index 4b6b7834e5..f307d35056 100644
--- a/thirdparty/libwebp/src/dsp/rescaler.c
+++ b/thirdparty/libwebp/src/dsp/rescaler.c
@@ -204,11 +204,7 @@ extern void WebPRescalerDspInitMIPSdspR2(void);
extern void WebPRescalerDspInitMSA(void);
extern void WebPRescalerDspInitNEON(void);
-static volatile VP8CPUInfo rescaler_last_cpuinfo_used =
- (VP8CPUInfo)&rescaler_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) {
- if (rescaler_last_cpuinfo_used == VP8GetCPUInfo) return;
+WEBP_DSP_INIT_FUNC(WebPRescalerDspInit) {
#if !defined(WEBP_REDUCE_SIZE)
#if !WEBP_NEON_OMIT_C_CODE
WebPRescalerExportRowExpand = WebPRescalerExportRowExpand_C;
@@ -253,5 +249,4 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) {
assert(WebPRescalerImportRowExpand != NULL);
assert(WebPRescalerImportRowShrink != NULL);
#endif // WEBP_REDUCE_SIZE
- rescaler_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/rescaler_sse2.c b/thirdparty/libwebp/src/dsp/rescaler_sse2.c
index f93b204fe1..64c50deab5 100644
--- a/thirdparty/libwebp/src/dsp/rescaler_sse2.c
+++ b/thirdparty/libwebp/src/dsp/rescaler_sse2.c
@@ -36,7 +36,7 @@ static void LoadTwoPixels_SSE2(const uint8_t* const src, __m128i* out) {
}
// input: 8 bytes ABCDEFGH -> output: A0B0C0D0E0F0G0H0
-static void LoadHeightPixels_SSE2(const uint8_t* const src, __m128i* out) {
+static void LoadEightPixels_SSE2(const uint8_t* const src, __m128i* out) {
const __m128i zero = _mm_setzero_si128();
const __m128i A = _mm_loadl_epi64((const __m128i*)(src)); // ABCDEFGH
*out = _mm_unpacklo_epi8(A, zero);
@@ -50,13 +50,15 @@ static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk,
int accum = x_add;
__m128i cur_pixels;
+ // SSE2 implementation only works with 16b signed arithmetic at max.
+ if (wrk->src_width < 8 || accum >= (1 << 15)) {
+ WebPRescalerImportRowExpand_C(wrk, src);
+ return;
+ }
+
assert(!WebPRescalerInputDone(wrk));
assert(wrk->x_expand);
if (wrk->num_channels == 4) {
- if (wrk->src_width < 2) {
- WebPRescalerImportRowExpand_C(wrk, src);
- return;
- }
LoadTwoPixels_SSE2(src, &cur_pixels);
src += 4;
while (1) {
@@ -75,11 +77,7 @@ static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk,
} else {
int left;
const uint8_t* const src_limit = src + wrk->src_width - 8;
- if (wrk->src_width < 8) {
- WebPRescalerImportRowExpand_C(wrk, src);
- return;
- }
- LoadHeightPixels_SSE2(src, &cur_pixels);
+ LoadEightPixels_SSE2(src, &cur_pixels);
src += 7;
left = 7;
while (1) {
@@ -94,7 +92,7 @@ static void RescalerImportRowExpand_SSE2(WebPRescaler* const wrk,
if (--left) {
cur_pixels = _mm_srli_si128(cur_pixels, 2);
} else if (src <= src_limit) {
- LoadHeightPixels_SSE2(src, &cur_pixels);
+ LoadEightPixels_SSE2(src, &cur_pixels);
src += 7;
left = 7;
} else { // tail
diff --git a/thirdparty/libwebp/src/dsp/ssim.c b/thirdparty/libwebp/src/dsp/ssim.c
index dc1b518a33..989ce8254c 100644
--- a/thirdparty/libwebp/src/dsp/ssim.c
+++ b/thirdparty/libwebp/src/dsp/ssim.c
@@ -139,12 +139,7 @@ VP8AccumulateSSEFunc VP8AccumulateSSE;
extern void VP8SSIMDspInitSSE2(void);
-static volatile VP8CPUInfo ssim_last_cpuinfo_used =
- (VP8CPUInfo)&ssim_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInit(void) {
- if (ssim_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(VP8SSIMDspInit) {
#if !defined(WEBP_REDUCE_SIZE)
VP8SSIMGetClipped = SSIMGetClipped_C;
VP8SSIMGet = SSIMGet_C;
@@ -161,6 +156,4 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInit(void) {
}
#endif
}
-
- ssim_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/upsampling.c b/thirdparty/libwebp/src/dsp/upsampling.c
index e72626a82a..9b60da5bbb 100644
--- a/thirdparty/libwebp/src/dsp/upsampling.c
+++ b/thirdparty/libwebp/src/dsp/upsampling.c
@@ -217,13 +217,9 @@ WebPYUV444Converter WebPYUV444Converters[MODE_LAST];
extern void WebPInitYUV444ConvertersMIPSdspR2(void);
extern void WebPInitYUV444ConvertersSSE2(void);
+extern void WebPInitYUV444ConvertersSSE41(void);
-static volatile VP8CPUInfo upsampling_last_cpuinfo_used1 =
- (VP8CPUInfo)&upsampling_last_cpuinfo_used1;
-
-WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) {
- if (upsampling_last_cpuinfo_used1 == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(WebPInitYUV444Converters) {
WebPYUV444Converters[MODE_RGBA] = WebPYuv444ToRgba_C;
WebPYUV444Converters[MODE_BGRA] = WebPYuv444ToBgra_C;
WebPYUV444Converters[MODE_RGB] = WebPYuv444ToRgb_C;
@@ -242,29 +238,29 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) {
WebPInitYUV444ConvertersSSE2();
}
#endif
+#if defined(WEBP_USE_SSE41)
+ if (VP8GetCPUInfo(kSSE4_1)) {
+ WebPInitYUV444ConvertersSSE41();
+ }
+#endif
#if defined(WEBP_USE_MIPS_DSP_R2)
if (VP8GetCPUInfo(kMIPSdspR2)) {
WebPInitYUV444ConvertersMIPSdspR2();
}
#endif
}
- upsampling_last_cpuinfo_used1 = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------
// Main calls
extern void WebPInitUpsamplersSSE2(void);
+extern void WebPInitUpsamplersSSE41(void);
extern void WebPInitUpsamplersNEON(void);
extern void WebPInitUpsamplersMIPSdspR2(void);
extern void WebPInitUpsamplersMSA(void);
-static volatile VP8CPUInfo upsampling_last_cpuinfo_used2 =
- (VP8CPUInfo)&upsampling_last_cpuinfo_used2;
-
-WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) {
- if (upsampling_last_cpuinfo_used2 == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(WebPInitUpsamplers) {
#ifdef FANCY_UPSAMPLING
#if !WEBP_NEON_OMIT_C_CODE
WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair_C;
@@ -287,6 +283,11 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) {
WebPInitUpsamplersSSE2();
}
#endif
+#if defined(WEBP_USE_SSE41)
+ if (VP8GetCPUInfo(kSSE4_1)) {
+ WebPInitUpsamplersSSE41();
+ }
+#endif
#if defined(WEBP_USE_MIPS_DSP_R2)
if (VP8GetCPUInfo(kMIPSdspR2)) {
WebPInitUpsamplersMIPSdspR2();
@@ -310,6 +311,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) {
assert(WebPUpsamplers[MODE_BGRA] != NULL);
assert(WebPUpsamplers[MODE_rgbA] != NULL);
assert(WebPUpsamplers[MODE_bgrA] != NULL);
+#if !defined(WEBP_REDUCE_CSP) || !WEBP_NEON_OMIT_C_CODE
assert(WebPUpsamplers[MODE_RGB] != NULL);
assert(WebPUpsamplers[MODE_BGR] != NULL);
assert(WebPUpsamplers[MODE_ARGB] != NULL);
@@ -317,9 +319,9 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) {
assert(WebPUpsamplers[MODE_RGB_565] != NULL);
assert(WebPUpsamplers[MODE_Argb] != NULL);
assert(WebPUpsamplers[MODE_rgbA_4444] != NULL);
+#endif
#endif // FANCY_UPSAMPLING
- upsampling_last_cpuinfo_used2 = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------
diff --git a/thirdparty/libwebp/src/dsp/upsampling_msa.c b/thirdparty/libwebp/src/dsp/upsampling_msa.c
index 535ffb772c..99eea70e7d 100644
--- a/thirdparty/libwebp/src/dsp/upsampling_msa.c
+++ b/thirdparty/libwebp/src/dsp/upsampling_msa.c
@@ -264,6 +264,7 @@ static void YuvToBgr(int y, int u, int v, uint8_t* const bgr) {
bgr[2] = Clip8(r1 >> 6);
}
+#if !defined(WEBP_REDUCE_CSP)
static void YuvToRgb565(int y, int u, int v, uint8_t* const rgb) {
const int y1 = MultHi(y, 19077);
const int r1 = y1 + MultHi(v, 26149) - 14234;
@@ -306,6 +307,7 @@ static void YuvToArgb(uint8_t y, uint8_t u, uint8_t v, uint8_t* const argb) {
argb[0] = 0xff;
YuvToRgb(y, u, v, argb + 1);
}
+#endif // WEBP_REDUCE_CSP
static void YuvToBgra(uint8_t y, uint8_t u, uint8_t v, uint8_t* const bgra) {
YuvToBgr(y, u, v, bgra);
@@ -317,6 +319,7 @@ static void YuvToRgba(uint8_t y, uint8_t u, uint8_t v, uint8_t* const rgba) {
rgba[3] = 0xff;
}
+#if !defined(WEBP_REDUCE_CSP)
static void YuvToRgbLine(const uint8_t* y, const uint8_t* u,
const uint8_t* v, uint8_t* dst, int length) {
v16u8 R, G, B;
@@ -370,6 +373,7 @@ static void YuvToBgrLine(const uint8_t* y, const uint8_t* u,
memcpy(dst, temp, length * 3 * sizeof(*dst));
}
}
+#endif // WEBP_REDUCE_CSP
static void YuvToRgbaLine(const uint8_t* y, const uint8_t* u,
const uint8_t* v, uint8_t* dst, int length) {
@@ -427,6 +431,7 @@ static void YuvToBgraLine(const uint8_t* y, const uint8_t* u,
}
}
+#if !defined(WEBP_REDUCE_CSP)
static void YuvToArgbLine(const uint8_t* y, const uint8_t* u,
const uint8_t* v, uint8_t* dst, int length) {
v16u8 R, G, B;
@@ -526,6 +531,7 @@ static void YuvToRgb565Line(const uint8_t* y, const uint8_t* u,
memcpy(dst, temp, length * 2 * sizeof(*dst));
}
}
+#endif // WEBP_REDUCE_CSP
#define UPSAMPLE_32PIXELS(a, b, c, d) do { \
v16u8 s = __msa_aver_u_b(a, d); \
diff --git a/thirdparty/libwebp/src/dsp/upsampling_sse2.c b/thirdparty/libwebp/src/dsp/upsampling_sse2.c
index fd5d303982..340f1e2ac2 100644
--- a/thirdparty/libwebp/src/dsp/upsampling_sse2.c
+++ b/thirdparty/libwebp/src/dsp/upsampling_sse2.c
@@ -104,21 +104,6 @@ static void Upsample32Pixels_SSE2(const uint8_t r1[], const uint8_t r2[],
Upsample32Pixels_SSE2(r1, r2, out); \
}
-#define CONVERT2RGB(FUNC, XSTEP, top_y, bottom_y, \
- top_dst, bottom_dst, cur_x, num_pixels) { \
- int n; \
- for (n = 0; n < (num_pixels); ++n) { \
- FUNC((top_y)[(cur_x) + n], r_u[n], r_v[n], \
- (top_dst) + ((cur_x) + n) * (XSTEP)); \
- } \
- if ((bottom_y) != NULL) { \
- for (n = 0; n < (num_pixels); ++n) { \
- FUNC((bottom_y)[(cur_x) + n], r_u[64 + n], r_v[64 + n], \
- (bottom_dst) + ((cur_x) + n) * (XSTEP)); \
- } \
- } \
-}
-
#define CONVERT2RGB_32(FUNC, XSTEP, top_y, bottom_y, \
top_dst, bottom_dst, cur_x) do { \
FUNC##32_SSE2((top_y) + (cur_x), r_u, r_v, (top_dst) + (cur_x) * (XSTEP)); \
@@ -135,7 +120,7 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \
uint8_t* top_dst, uint8_t* bottom_dst, int len) { \
int uv_pos, pos; \
/* 16byte-aligned array to cache reconstructed u and v */ \
- uint8_t uv_buf[4 * 32 + 15]; \
+ uint8_t uv_buf[14 * 32 + 15] = { 0 }; \
uint8_t* const r_u = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \
uint8_t* const r_v = r_u + 32; \
\
@@ -160,11 +145,22 @@ static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \
} \
if (len > 1) { \
const int left_over = ((len + 1) >> 1) - (pos >> 1); \
+ uint8_t* const tmp_top_dst = r_u + 4 * 32; \
+ uint8_t* const tmp_bottom_dst = tmp_top_dst + 4 * 32; \
+ uint8_t* const tmp_top = tmp_bottom_dst + 4 * 32; \
+ uint8_t* const tmp_bottom = (bottom_y == NULL) ? NULL : tmp_top + 32; \
assert(left_over > 0); \
UPSAMPLE_LAST_BLOCK(top_u + uv_pos, cur_u + uv_pos, left_over, r_u); \
UPSAMPLE_LAST_BLOCK(top_v + uv_pos, cur_v + uv_pos, left_over, r_v); \
- CONVERT2RGB(FUNC, XSTEP, top_y, bottom_y, top_dst, bottom_dst, \
- pos, len - pos); \
+ memcpy(tmp_top, top_y + pos, len - pos); \
+ if (bottom_y != NULL) memcpy(tmp_bottom, bottom_y + pos, len - pos); \
+ CONVERT2RGB_32(FUNC, XSTEP, tmp_top, tmp_bottom, tmp_top_dst, \
+ tmp_bottom_dst, 0); \
+ memcpy(top_dst + pos * (XSTEP), tmp_top_dst, (len - pos) * (XSTEP)); \
+ if (bottom_y != NULL) { \
+ memcpy(bottom_dst + pos * (XSTEP), tmp_bottom_dst, \
+ (len - pos) * (XSTEP)); \
+ } \
} \
}
diff --git a/thirdparty/libwebp/src/dsp/upsampling_sse41.c b/thirdparty/libwebp/src/dsp/upsampling_sse41.c
new file mode 100644
index 0000000000..648d456027
--- /dev/null
+++ b/thirdparty/libwebp/src/dsp/upsampling_sse41.c
@@ -0,0 +1,239 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the COPYING file in the root of the source
+// tree. An additional intellectual property rights grant can be found
+// in the file PATENTS. All contributing project authors may
+// be found in the AUTHORS file in the root of the source tree.
+// -----------------------------------------------------------------------------
+//
+// SSE41 version of YUV to RGB upsampling functions.
+//
+// Author: somnath@google.com (Somnath Banerjee)
+
+#include "src/dsp/dsp.h"
+
+#if defined(WEBP_USE_SSE41)
+
+#include <assert.h>
+#include <smmintrin.h>
+#include <string.h>
+#include "src/dsp/yuv.h"
+
+#ifdef FANCY_UPSAMPLING
+
+#if !defined(WEBP_REDUCE_CSP)
+
+// We compute (9*a + 3*b + 3*c + d + 8) / 16 as follows
+// u = (9*a + 3*b + 3*c + d + 8) / 16
+// = (a + (a + 3*b + 3*c + d) / 8 + 1) / 2
+// = (a + m + 1) / 2
+// where m = (a + 3*b + 3*c + d) / 8
+// = ((a + b + c + d) / 2 + b + c) / 4
+//
+// Let's say k = (a + b + c + d) / 4.
+// We can compute k as
+// k = (s + t + 1) / 2 - ((a^d) | (b^c) | (s^t)) & 1
+// where s = (a + d + 1) / 2 and t = (b + c + 1) / 2
+//
+// Then m can be written as
+// m = (k + t + 1) / 2 - (((b^c) & (s^t)) | (k^t)) & 1
+
+// Computes out = (k + in + 1) / 2 - ((ij & (s^t)) | (k^in)) & 1
+#define GET_M(ij, in, out) do { \
+ const __m128i tmp0 = _mm_avg_epu8(k, (in)); /* (k + in + 1) / 2 */ \
+ const __m128i tmp1 = _mm_and_si128((ij), st); /* (ij) & (s^t) */ \
+ const __m128i tmp2 = _mm_xor_si128(k, (in)); /* (k^in) */ \
+ const __m128i tmp3 = _mm_or_si128(tmp1, tmp2); /* ((ij) & (s^t)) | (k^in) */\
+ const __m128i tmp4 = _mm_and_si128(tmp3, one); /* & 1 -> lsb_correction */ \
+ (out) = _mm_sub_epi8(tmp0, tmp4); /* (k + in + 1) / 2 - lsb_correction */ \
+} while (0)
+
+// pack and store two alternating pixel rows
+#define PACK_AND_STORE(a, b, da, db, out) do { \
+ const __m128i t_a = _mm_avg_epu8(a, da); /* (9a + 3b + 3c + d + 8) / 16 */ \
+ const __m128i t_b = _mm_avg_epu8(b, db); /* (3a + 9b + c + 3d + 8) / 16 */ \
+ const __m128i t_1 = _mm_unpacklo_epi8(t_a, t_b); \
+ const __m128i t_2 = _mm_unpackhi_epi8(t_a, t_b); \
+ _mm_store_si128(((__m128i*)(out)) + 0, t_1); \
+ _mm_store_si128(((__m128i*)(out)) + 1, t_2); \
+} while (0)
+
+// Loads 17 pixels each from rows r1 and r2 and generates 32 pixels.
+#define UPSAMPLE_32PIXELS(r1, r2, out) { \
+ const __m128i one = _mm_set1_epi8(1); \
+ const __m128i a = _mm_loadu_si128((const __m128i*)&(r1)[0]); \
+ const __m128i b = _mm_loadu_si128((const __m128i*)&(r1)[1]); \
+ const __m128i c = _mm_loadu_si128((const __m128i*)&(r2)[0]); \
+ const __m128i d = _mm_loadu_si128((const __m128i*)&(r2)[1]); \
+ \
+ const __m128i s = _mm_avg_epu8(a, d); /* s = (a + d + 1) / 2 */ \
+ const __m128i t = _mm_avg_epu8(b, c); /* t = (b + c + 1) / 2 */ \
+ const __m128i st = _mm_xor_si128(s, t); /* st = s^t */ \
+ \
+ const __m128i ad = _mm_xor_si128(a, d); /* ad = a^d */ \
+ const __m128i bc = _mm_xor_si128(b, c); /* bc = b^c */ \
+ \
+ const __m128i t1 = _mm_or_si128(ad, bc); /* (a^d) | (b^c) */ \
+ const __m128i t2 = _mm_or_si128(t1, st); /* (a^d) | (b^c) | (s^t) */ \
+ const __m128i t3 = _mm_and_si128(t2, one); /* (a^d) | (b^c) | (s^t) & 1 */ \
+ const __m128i t4 = _mm_avg_epu8(s, t); \
+ const __m128i k = _mm_sub_epi8(t4, t3); /* k = (a + b + c + d) / 4 */ \
+ __m128i diag1, diag2; \
+ \
+ GET_M(bc, t, diag1); /* diag1 = (a + 3b + 3c + d) / 8 */ \
+ GET_M(ad, s, diag2); /* diag2 = (3a + b + c + 3d) / 8 */ \
+ \
+ /* pack the alternate pixels */ \
+ PACK_AND_STORE(a, b, diag1, diag2, (out) + 0); /* store top */ \
+ PACK_AND_STORE(c, d, diag2, diag1, (out) + 2 * 32); /* store bottom */ \
+}
+
+// Turn the macro into a function for reducing code-size when non-critical
+static void Upsample32Pixels_SSE41(const uint8_t r1[], const uint8_t r2[],
+ uint8_t* const out) {
+ UPSAMPLE_32PIXELS(r1, r2, out);
+}
+
+#define UPSAMPLE_LAST_BLOCK(tb, bb, num_pixels, out) { \
+ uint8_t r1[17], r2[17]; \
+ memcpy(r1, (tb), (num_pixels)); \
+ memcpy(r2, (bb), (num_pixels)); \
+ /* replicate last byte */ \
+ memset(r1 + (num_pixels), r1[(num_pixels) - 1], 17 - (num_pixels)); \
+ memset(r2 + (num_pixels), r2[(num_pixels) - 1], 17 - (num_pixels)); \
+ /* using the shared function instead of the macro saves ~3k code size */ \
+ Upsample32Pixels_SSE41(r1, r2, out); \
+}
+
+#define CONVERT2RGB_32(FUNC, XSTEP, top_y, bottom_y, \
+ top_dst, bottom_dst, cur_x) do { \
+ FUNC##32_SSE41((top_y) + (cur_x), r_u, r_v, (top_dst) + (cur_x) * (XSTEP)); \
+ if ((bottom_y) != NULL) { \
+ FUNC##32_SSE41((bottom_y) + (cur_x), r_u + 64, r_v + 64, \
+ (bottom_dst) + (cur_x) * (XSTEP)); \
+ } \
+} while (0)
+
+#define SSE4_UPSAMPLE_FUNC(FUNC_NAME, FUNC, XSTEP) \
+static void FUNC_NAME(const uint8_t* top_y, const uint8_t* bottom_y, \
+ const uint8_t* top_u, const uint8_t* top_v, \
+ const uint8_t* cur_u, const uint8_t* cur_v, \
+ uint8_t* top_dst, uint8_t* bottom_dst, int len) { \
+ int uv_pos, pos; \
+ /* 16byte-aligned array to cache reconstructed u and v */ \
+ uint8_t uv_buf[14 * 32 + 15] = { 0 }; \
+ uint8_t* const r_u = (uint8_t*)((uintptr_t)(uv_buf + 15) & ~15); \
+ uint8_t* const r_v = r_u + 32; \
+ \
+ assert(top_y != NULL); \
+ { /* Treat the first pixel in regular way */ \
+ const int u_diag = ((top_u[0] + cur_u[0]) >> 1) + 1; \
+ const int v_diag = ((top_v[0] + cur_v[0]) >> 1) + 1; \
+ const int u0_t = (top_u[0] + u_diag) >> 1; \
+ const int v0_t = (top_v[0] + v_diag) >> 1; \
+ FUNC(top_y[0], u0_t, v0_t, top_dst); \
+ if (bottom_y != NULL) { \
+ const int u0_b = (cur_u[0] + u_diag) >> 1; \
+ const int v0_b = (cur_v[0] + v_diag) >> 1; \
+ FUNC(bottom_y[0], u0_b, v0_b, bottom_dst); \
+ } \
+ } \
+ /* For UPSAMPLE_32PIXELS, 17 u/v values must be read-able for each block */ \
+ for (pos = 1, uv_pos = 0; pos + 32 + 1 <= len; pos += 32, uv_pos += 16) { \
+ UPSAMPLE_32PIXELS(top_u + uv_pos, cur_u + uv_pos, r_u); \
+ UPSAMPLE_32PIXELS(top_v + uv_pos, cur_v + uv_pos, r_v); \
+ CONVERT2RGB_32(FUNC, XSTEP, top_y, bottom_y, top_dst, bottom_dst, pos); \
+ } \
+ if (len > 1) { \
+ const int left_over = ((len + 1) >> 1) - (pos >> 1); \
+ uint8_t* const tmp_top_dst = r_u + 4 * 32; \
+ uint8_t* const tmp_bottom_dst = tmp_top_dst + 4 * 32; \
+ uint8_t* const tmp_top = tmp_bottom_dst + 4 * 32; \
+ uint8_t* const tmp_bottom = (bottom_y == NULL) ? NULL : tmp_top + 32; \
+ assert(left_over > 0); \
+ UPSAMPLE_LAST_BLOCK(top_u + uv_pos, cur_u + uv_pos, left_over, r_u); \
+ UPSAMPLE_LAST_BLOCK(top_v + uv_pos, cur_v + uv_pos, left_over, r_v); \
+ memcpy(tmp_top, top_y + pos, len - pos); \
+ if (bottom_y != NULL) memcpy(tmp_bottom, bottom_y + pos, len - pos); \
+ CONVERT2RGB_32(FUNC, XSTEP, tmp_top, tmp_bottom, tmp_top_dst, \
+ tmp_bottom_dst, 0); \
+ memcpy(top_dst + pos * (XSTEP), tmp_top_dst, (len - pos) * (XSTEP)); \
+ if (bottom_y != NULL) { \
+ memcpy(bottom_dst + pos * (XSTEP), tmp_bottom_dst, \
+ (len - pos) * (XSTEP)); \
+ } \
+ } \
+}
+
+// SSE4 variants of the fancy upsampler.
+SSE4_UPSAMPLE_FUNC(UpsampleRgbLinePair_SSE41, VP8YuvToRgb, 3)
+SSE4_UPSAMPLE_FUNC(UpsampleBgrLinePair_SSE41, VP8YuvToBgr, 3)
+
+#undef GET_M
+#undef PACK_AND_STORE
+#undef UPSAMPLE_32PIXELS
+#undef UPSAMPLE_LAST_BLOCK
+#undef CONVERT2RGB
+#undef CONVERT2RGB_32
+#undef SSE4_UPSAMPLE_FUNC
+
+#endif // WEBP_REDUCE_CSP
+
+//------------------------------------------------------------------------------
+// Entry point
+
+extern WebPUpsampleLinePairFunc WebPUpsamplers[/* MODE_LAST */];
+
+extern void WebPInitUpsamplersSSE41(void);
+
+WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersSSE41(void) {
+#if !defined(WEBP_REDUCE_CSP)
+ WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair_SSE41;
+ WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair_SSE41;
+#endif // WEBP_REDUCE_CSP
+}
+
+#endif // FANCY_UPSAMPLING
+
+//------------------------------------------------------------------------------
+
+extern WebPYUV444Converter WebPYUV444Converters[/* MODE_LAST */];
+extern void WebPInitYUV444ConvertersSSE41(void);
+
+#define YUV444_FUNC(FUNC_NAME, CALL, CALL_C, XSTEP) \
+extern void CALL_C(const uint8_t* y, const uint8_t* u, const uint8_t* v, \
+ uint8_t* dst, int len); \
+static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \
+ uint8_t* dst, int len) { \
+ int i; \
+ const int max_len = len & ~31; \
+ for (i = 0; i < max_len; i += 32) { \
+ CALL(y + i, u + i, v + i, dst + i * (XSTEP)); \
+ } \
+ if (i < len) { /* C-fallback */ \
+ CALL_C(y + i, u + i, v + i, dst + i * (XSTEP), len - i); \
+ } \
+}
+
+#if !defined(WEBP_REDUCE_CSP)
+YUV444_FUNC(Yuv444ToRgb_SSE41, VP8YuvToRgb32_SSE41, WebPYuv444ToRgb_C, 3);
+YUV444_FUNC(Yuv444ToBgr_SSE41, VP8YuvToBgr32_SSE41, WebPYuv444ToBgr_C, 3);
+#endif // WEBP_REDUCE_CSP
+
+WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersSSE41(void) {
+#if !defined(WEBP_REDUCE_CSP)
+ WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb_SSE41;
+ WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr_SSE41;
+#endif // WEBP_REDUCE_CSP
+}
+
+#else
+
+WEBP_DSP_INIT_STUB(WebPInitYUV444ConvertersSSE41)
+
+#endif // WEBP_USE_SSE41
+
+#if !(defined(FANCY_UPSAMPLING) && defined(WEBP_USE_SSE41))
+WEBP_DSP_INIT_STUB(WebPInitUpsamplersSSE41)
+#endif
diff --git a/thirdparty/libwebp/src/dsp/yuv.c b/thirdparty/libwebp/src/dsp/yuv.c
index bddf81fe09..14e67fc28e 100644
--- a/thirdparty/libwebp/src/dsp/yuv.c
+++ b/thirdparty/libwebp/src/dsp/yuv.c
@@ -71,15 +71,11 @@ void WebPSamplerProcessPlane(const uint8_t* y, int y_stride,
WebPSamplerRowFunc WebPSamplers[MODE_LAST];
extern void WebPInitSamplersSSE2(void);
+extern void WebPInitSamplersSSE41(void);
extern void WebPInitSamplersMIPS32(void);
extern void WebPInitSamplersMIPSdspR2(void);
-static volatile VP8CPUInfo yuv_last_cpuinfo_used =
- (VP8CPUInfo)&yuv_last_cpuinfo_used;
-
-WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) {
- if (yuv_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(WebPInitSamplers) {
WebPSamplers[MODE_RGB] = YuvToRgbRow;
WebPSamplers[MODE_RGBA] = YuvToRgbaRow;
WebPSamplers[MODE_BGR] = YuvToBgrRow;
@@ -99,6 +95,11 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) {
WebPInitSamplersSSE2();
}
#endif // WEBP_USE_SSE2
+#if defined(WEBP_USE_SSE41)
+ if (VP8GetCPUInfo(kSSE4_1)) {
+ WebPInitSamplersSSE41();
+ }
+#endif // WEBP_USE_SSE41
#if defined(WEBP_USE_MIPS32)
if (VP8GetCPUInfo(kMIPS32)) {
WebPInitSamplersMIPS32();
@@ -110,7 +111,6 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) {
}
#endif // WEBP_USE_MIPS_DSP_R2
}
- yuv_last_cpuinfo_used = VP8GetCPUInfo;
}
//-----------------------------------------------------------------------------
@@ -254,17 +254,13 @@ void (*WebPSharpYUVUpdateRGB)(const int16_t* ref, const int16_t* src,
void (*WebPSharpYUVFilterRow)(const int16_t* A, const int16_t* B, int len,
const uint16_t* best_y, uint16_t* out);
-static volatile VP8CPUInfo rgba_to_yuv_last_cpuinfo_used =
- (VP8CPUInfo)&rgba_to_yuv_last_cpuinfo_used;
-
extern void WebPInitConvertARGBToYUVSSE2(void);
+extern void WebPInitConvertARGBToYUVSSE41(void);
extern void WebPInitConvertARGBToYUVNEON(void);
extern void WebPInitSharpYUVSSE2(void);
extern void WebPInitSharpYUVNEON(void);
-WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUV(void) {
- if (rgba_to_yuv_last_cpuinfo_used == VP8GetCPUInfo) return;
-
+WEBP_DSP_INIT_FUNC(WebPInitConvertARGBToYUV) {
WebPConvertARGBToY = ConvertARGBToY_C;
WebPConvertARGBToUV = WebPConvertARGBToUV_C;
@@ -286,6 +282,11 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUV(void) {
WebPInitSharpYUVSSE2();
}
#endif // WEBP_USE_SSE2
+#if defined(WEBP_USE_SSE41)
+ if (VP8GetCPUInfo(kSSE4_1)) {
+ WebPInitConvertARGBToYUVSSE41();
+ }
+#endif // WEBP_USE_SSE41
}
#if defined(WEBP_USE_NEON)
@@ -304,6 +305,4 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUV(void) {
assert(WebPSharpYUVUpdateY != NULL);
assert(WebPSharpYUVUpdateRGB != NULL);
assert(WebPSharpYUVFilterRow != NULL);
-
- rgba_to_yuv_last_cpuinfo_used = VP8GetCPUInfo;
}
diff --git a/thirdparty/libwebp/src/dsp/yuv.h b/thirdparty/libwebp/src/dsp/yuv.h
index c8a55832d4..eb787270d2 100644
--- a/thirdparty/libwebp/src/dsp/yuv.h
+++ b/thirdparty/libwebp/src/dsp/yuv.h
@@ -166,6 +166,19 @@ void VP8YuvToRgb56532_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
#endif // WEBP_USE_SSE2
+//-----------------------------------------------------------------------------
+// SSE41 extra functions (mostly for upsampling_sse41.c)
+
+#if defined(WEBP_USE_SSE41)
+
+// Process 32 pixels and store the result (16b, 24b or 32b per pixel) in *dst.
+void VP8YuvToRgb32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v,
+ uint8_t* dst);
+void VP8YuvToBgr32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v,
+ uint8_t* dst);
+
+#endif // WEBP_USE_SSE41
+
//------------------------------------------------------------------------------
// RGB -> YUV conversion
diff --git a/thirdparty/libwebp/src/dsp/yuv_sse2.c b/thirdparty/libwebp/src/dsp/yuv_sse2.c
index 6810bf8d15..baa48d5371 100644
--- a/thirdparty/libwebp/src/dsp/yuv_sse2.c
+++ b/thirdparty/libwebp/src/dsp/yuv_sse2.c
@@ -180,7 +180,7 @@ static WEBP_INLINE void PlanarTo24b_SSE2(__m128i* const in0, __m128i* const in1,
// Repeat the same permutations twice more:
// r0r4g0g4 | b0b4r1r5 | g1g5b1b5 | r2r6g2g6 | b2b6r3r7 | g3g7b3b7
// r0g0b0r1 | g1b1r2g2 | b2r3g3b3 | r4g4b4r5 | g5b5r6g6 | b6r7g7b7
- VP8PlanarTo24b(in0, in1, in2, in3, in4, in5);
+ VP8PlanarTo24b_SSE2(in0, in1, in2, in3, in4, in5);
_mm_storeu_si128((__m128i*)(rgb + 0), *in0);
_mm_storeu_si128((__m128i*)(rgb + 16), *in1);
@@ -492,7 +492,7 @@ static WEBP_INLINE void RGB32PackedToPlanar_SSE2(const uint32_t* const argb,
__m128i a1 = LOAD_16(argb + 4);
__m128i a2 = LOAD_16(argb + 8);
__m128i a3 = LOAD_16(argb + 12);
- VP8L32bToPlanar(&a0, &a1, &a2, &a3);
+ VP8L32bToPlanar_SSE2(&a0, &a1, &a2, &a3);
rgb[0] = _mm_unpacklo_epi8(a1, zero);
rgb[1] = _mm_unpackhi_epi8(a1, zero);
rgb[2] = _mm_unpacklo_epi8(a2, zero);
diff --git a/thirdparty/libwebp/src/dsp/yuv_sse41.c b/thirdparty/libwebp/src/dsp/yuv_sse41.c
new file mode 100644
index 0000000000..579d1f7402
--- /dev/null
+++ b/thirdparty/libwebp/src/dsp/yuv_sse41.c
@@ -0,0 +1,613 @@
+// Copyright 2014 Google Inc. All Rights Reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the COPYING file in the root of the source
+// tree. An additional intellectual property rights grant can be found
+// in the file PATENTS. All contributing project authors may
+// be found in the AUTHORS file in the root of the source tree.
+// -----------------------------------------------------------------------------
+//
+// YUV->RGB conversion functions
+//
+// Author: Skal (pascal.massimino@gmail.com)
+
+#include "src/dsp/yuv.h"
+
+#if defined(WEBP_USE_SSE41)
+
+#include "src/dsp/common_sse41.h"
+#include <stdlib.h>
+#include <smmintrin.h>
+
+//-----------------------------------------------------------------------------
+// Convert spans of 32 pixels to various RGB formats for the fancy upsampler.
+
+// These constants are 14b fixed-point version of ITU-R BT.601 constants.
+// R = (19077 * y + 26149 * v - 14234) >> 6
+// G = (19077 * y - 6419 * u - 13320 * v + 8708) >> 6
+// B = (19077 * y + 33050 * u - 17685) >> 6
+static void ConvertYUV444ToRGB_SSE41(const __m128i* const Y0,
+ const __m128i* const U0,
+ const __m128i* const V0,
+ __m128i* const R,
+ __m128i* const G,
+ __m128i* const B) {
+ const __m128i k19077 = _mm_set1_epi16(19077);
+ const __m128i k26149 = _mm_set1_epi16(26149);
+ const __m128i k14234 = _mm_set1_epi16(14234);
+ // 33050 doesn't fit in a signed short: only use this with unsigned arithmetic
+ const __m128i k33050 = _mm_set1_epi16((short)33050);
+ const __m128i k17685 = _mm_set1_epi16(17685);
+ const __m128i k6419 = _mm_set1_epi16(6419);
+ const __m128i k13320 = _mm_set1_epi16(13320);
+ const __m128i k8708 = _mm_set1_epi16(8708);
+
+ const __m128i Y1 = _mm_mulhi_epu16(*Y0, k19077);
+
+ const __m128i R0 = _mm_mulhi_epu16(*V0, k26149);
+ const __m128i R1 = _mm_sub_epi16(Y1, k14234);
+ const __m128i R2 = _mm_add_epi16(R1, R0);
+
+ const __m128i G0 = _mm_mulhi_epu16(*U0, k6419);
+ const __m128i G1 = _mm_mulhi_epu16(*V0, k13320);
+ const __m128i G2 = _mm_add_epi16(Y1, k8708);
+ const __m128i G3 = _mm_add_epi16(G0, G1);
+ const __m128i G4 = _mm_sub_epi16(G2, G3);
+
+ // be careful with the saturated *unsigned* arithmetic here!
+ const __m128i B0 = _mm_mulhi_epu16(*U0, k33050);
+ const __m128i B1 = _mm_adds_epu16(B0, Y1);
+ const __m128i B2 = _mm_subs_epu16(B1, k17685);
+
+ // use logical shift for B2, which can be larger than 32767
+ *R = _mm_srai_epi16(R2, 6); // range: [-14234, 30815]
+ *G = _mm_srai_epi16(G4, 6); // range: [-10953, 27710]
+ *B = _mm_srli_epi16(B2, 6); // range: [0, 34238]
+}
+
+// Load the bytes into the *upper* part of 16b words. That's "<< 8", basically.
+static WEBP_INLINE __m128i Load_HI_16_SSE41(const uint8_t* src) {
+ const __m128i zero = _mm_setzero_si128();
+ return _mm_unpacklo_epi8(zero, _mm_loadl_epi64((const __m128i*)src));
+}
+
+// Load and replicate the U/V samples
+static WEBP_INLINE __m128i Load_UV_HI_8_SSE41(const uint8_t* src) {
+ const __m128i zero = _mm_setzero_si128();
+ const __m128i tmp0 = _mm_cvtsi32_si128(*(const uint32_t*)src);
+ const __m128i tmp1 = _mm_unpacklo_epi8(zero, tmp0);
+ return _mm_unpacklo_epi16(tmp1, tmp1); // replicate samples
+}
+
+// Convert 32 samples of YUV444 to R/G/B
+static void YUV444ToRGB_SSE41(const uint8_t* const y,
+ const uint8_t* const u,
+ const uint8_t* const v,
+ __m128i* const R, __m128i* const G,
+ __m128i* const B) {
+ const __m128i Y0 = Load_HI_16_SSE41(y), U0 = Load_HI_16_SSE41(u),
+ V0 = Load_HI_16_SSE41(v);
+ ConvertYUV444ToRGB_SSE41(&Y0, &U0, &V0, R, G, B);
+}
+
+// Convert 32 samples of YUV420 to R/G/B
+static void YUV420ToRGB_SSE41(const uint8_t* const y,
+ const uint8_t* const u,
+ const uint8_t* const v,
+ __m128i* const R, __m128i* const G,
+ __m128i* const B) {
+ const __m128i Y0 = Load_HI_16_SSE41(y), U0 = Load_UV_HI_8_SSE41(u),
+ V0 = Load_UV_HI_8_SSE41(v);
+ ConvertYUV444ToRGB_SSE41(&Y0, &U0, &V0, R, G, B);
+}
+
+// Pack the planar buffers
+// rrrr... rrrr... gggg... gggg... bbbb... bbbb....
+// triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ...
+static WEBP_INLINE void PlanarTo24b_SSE41(
+ __m128i* const in0, __m128i* const in1, __m128i* const in2,
+ __m128i* const in3, __m128i* const in4, __m128i* const in5,
+ uint8_t* const rgb) {
+ // The input is 6 registers of sixteen 8b but for the sake of explanation,
+ // let's take 6 registers of four 8b values.
+ // To pack, we will keep taking one every two 8b integer and move it
+ // around as follows:
+ // Input:
+ // r0r1r2r3 | r4r5r6r7 | g0g1g2g3 | g4g5g6g7 | b0b1b2b3 | b4b5b6b7
+ // Split the 6 registers in two sets of 3 registers: the first set as the even
+ // 8b bytes, the second the odd ones:
+ // r0r2r4r6 | g0g2g4g6 | b0b2b4b6 | r1r3r5r7 | g1g3g5g7 | b1b3b5b7
+ // Repeat the same permutations twice more:
+ // r0r4g0g4 | b0b4r1r5 | g1g5b1b5 | r2r6g2g6 | b2b6r3r7 | g3g7b3b7
+ // r0g0b0r1 | g1b1r2g2 | b2r3g3b3 | r4g4b4r5 | g5b5r6g6 | b6r7g7b7
+ VP8PlanarTo24b_SSE41(in0, in1, in2, in3, in4, in5);
+
+ _mm_storeu_si128((__m128i*)(rgb + 0), *in0);
+ _mm_storeu_si128((__m128i*)(rgb + 16), *in1);
+ _mm_storeu_si128((__m128i*)(rgb + 32), *in2);
+ _mm_storeu_si128((__m128i*)(rgb + 48), *in3);
+ _mm_storeu_si128((__m128i*)(rgb + 64), *in4);
+ _mm_storeu_si128((__m128i*)(rgb + 80), *in5);
+}
+
+void VP8YuvToRgb32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v,
+ uint8_t* dst) {
+ __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3;
+ __m128i rgb0, rgb1, rgb2, rgb3, rgb4, rgb5;
+
+ YUV444ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0);
+ YUV444ToRGB_SSE41(y + 8, u + 8, v + 8, &R1, &G1, &B1);
+ YUV444ToRGB_SSE41(y + 16, u + 16, v + 16, &R2, &G2, &B2);
+ YUV444ToRGB_SSE41(y + 24, u + 24, v + 24, &R3, &G3, &B3);
+
+ // Cast to 8b and store as RRRRGGGGBBBB.
+ rgb0 = _mm_packus_epi16(R0, R1);
+ rgb1 = _mm_packus_epi16(R2, R3);
+ rgb2 = _mm_packus_epi16(G0, G1);
+ rgb3 = _mm_packus_epi16(G2, G3);
+ rgb4 = _mm_packus_epi16(B0, B1);
+ rgb5 = _mm_packus_epi16(B2, B3);
+
+ // Pack as RGBRGBRGBRGB.
+ PlanarTo24b_SSE41(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst);
+}
+
+void VP8YuvToBgr32_SSE41(const uint8_t* y, const uint8_t* u, const uint8_t* v,
+ uint8_t* dst) {
+ __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3;
+ __m128i bgr0, bgr1, bgr2, bgr3, bgr4, bgr5;
+
+ YUV444ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0);
+ YUV444ToRGB_SSE41(y + 8, u + 8, v + 8, &R1, &G1, &B1);
+ YUV444ToRGB_SSE41(y + 16, u + 16, v + 16, &R2, &G2, &B2);
+ YUV444ToRGB_SSE41(y + 24, u + 24, v + 24, &R3, &G3, &B3);
+
+ // Cast to 8b and store as BBBBGGGGRRRR.
+ bgr0 = _mm_packus_epi16(B0, B1);
+ bgr1 = _mm_packus_epi16(B2, B3);
+ bgr2 = _mm_packus_epi16(G0, G1);
+ bgr3 = _mm_packus_epi16(G2, G3);
+ bgr4 = _mm_packus_epi16(R0, R1);
+ bgr5= _mm_packus_epi16(R2, R3);
+
+ // Pack as BGRBGRBGRBGR.
+ PlanarTo24b_SSE41(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst);
+}
+
+//-----------------------------------------------------------------------------
+// Arbitrary-length row conversion functions
+
+static void YuvToRgbRow_SSE41(const uint8_t* y,
+ const uint8_t* u, const uint8_t* v,
+ uint8_t* dst, int len) {
+ int n;
+ for (n = 0; n + 32 <= len; n += 32, dst += 32 * 3) {
+ __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3;
+ __m128i rgb0, rgb1, rgb2, rgb3, rgb4, rgb5;
+
+ YUV420ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0);
+ YUV420ToRGB_SSE41(y + 8, u + 4, v + 4, &R1, &G1, &B1);
+ YUV420ToRGB_SSE41(y + 16, u + 8, v + 8, &R2, &G2, &B2);
+ YUV420ToRGB_SSE41(y + 24, u + 12, v + 12, &R3, &G3, &B3);
+
+ // Cast to 8b and store as RRRRGGGGBBBB.
+ rgb0 = _mm_packus_epi16(R0, R1);
+ rgb1 = _mm_packus_epi16(R2, R3);
+ rgb2 = _mm_packus_epi16(G0, G1);
+ rgb3 = _mm_packus_epi16(G2, G3);
+ rgb4 = _mm_packus_epi16(B0, B1);
+ rgb5 = _mm_packus_epi16(B2, B3);
+
+ // Pack as RGBRGBRGBRGB.
+ PlanarTo24b_SSE41(&rgb0, &rgb1, &rgb2, &rgb3, &rgb4, &rgb5, dst);
+
+ y += 32;
+ u += 16;
+ v += 16;
+ }
+ for (; n < len; ++n) { // Finish off
+ VP8YuvToRgb(y[0], u[0], v[0], dst);
+ dst += 3;
+ y += 1;
+ u += (n & 1);
+ v += (n & 1);
+ }
+}
+
+static void YuvToBgrRow_SSE41(const uint8_t* y,
+ const uint8_t* u, const uint8_t* v,
+ uint8_t* dst, int len) {
+ int n;
+ for (n = 0; n + 32 <= len; n += 32, dst += 32 * 3) {
+ __m128i R0, R1, R2, R3, G0, G1, G2, G3, B0, B1, B2, B3;
+ __m128i bgr0, bgr1, bgr2, bgr3, bgr4, bgr5;
+
+ YUV420ToRGB_SSE41(y + 0, u + 0, v + 0, &R0, &G0, &B0);
+ YUV420ToRGB_SSE41(y + 8, u + 4, v + 4, &R1, &G1, &B1);
+ YUV420ToRGB_SSE41(y + 16, u + 8, v + 8, &R2, &G2, &B2);
+ YUV420ToRGB_SSE41(y + 24, u + 12, v + 12, &R3, &G3, &B3);
+
+ // Cast to 8b and store as BBBBGGGGRRRR.
+ bgr0 = _mm_packus_epi16(B0, B1);
+ bgr1 = _mm_packus_epi16(B2, B3);
+ bgr2 = _mm_packus_epi16(G0, G1);
+ bgr3 = _mm_packus_epi16(G2, G3);
+ bgr4 = _mm_packus_epi16(R0, R1);
+ bgr5 = _mm_packus_epi16(R2, R3);
+
+ // Pack as BGRBGRBGRBGR.
+ PlanarTo24b_SSE41(&bgr0, &bgr1, &bgr2, &bgr3, &bgr4, &bgr5, dst);
+
+ y += 32;
+ u += 16;
+ v += 16;
+ }
+ for (; n < len; ++n) { // Finish off
+ VP8YuvToBgr(y[0], u[0], v[0], dst);
+ dst += 3;
+ y += 1;
+ u += (n & 1);
+ v += (n & 1);
+ }
+}
+
+//------------------------------------------------------------------------------
+// Entry point
+
+extern void WebPInitSamplersSSE41(void);
+
+WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersSSE41(void) {
+ WebPSamplers[MODE_RGB] = YuvToRgbRow_SSE41;
+ WebPSamplers[MODE_BGR] = YuvToBgrRow_SSE41;
+}
+
+//------------------------------------------------------------------------------
+// RGB24/32 -> YUV converters
+
+// Load eight 16b-words from *src.
+#define LOAD_16(src) _mm_loadu_si128((const __m128i*)(src))
+// Store either 16b-words into *dst
+#define STORE_16(V, dst) _mm_storeu_si128((__m128i*)(dst), (V))
+
+#define WEBP_SSE41_SHUFF(OUT) do { \
+ const __m128i tmp0 = _mm_shuffle_epi8(A0, shuff0); \
+ const __m128i tmp1 = _mm_shuffle_epi8(A1, shuff1); \
+ const __m128i tmp2 = _mm_shuffle_epi8(A2, shuff2); \
+ const __m128i tmp3 = _mm_shuffle_epi8(A3, shuff0); \
+ const __m128i tmp4 = _mm_shuffle_epi8(A4, shuff1); \
+ const __m128i tmp5 = _mm_shuffle_epi8(A5, shuff2); \
+ \
+ /* OR everything to get one channel */ \
+ const __m128i tmp6 = _mm_or_si128(tmp0, tmp1); \
+ const __m128i tmp7 = _mm_or_si128(tmp3, tmp4); \
+ out[OUT + 0] = _mm_or_si128(tmp6, tmp2); \
+ out[OUT + 1] = _mm_or_si128(tmp7, tmp5); \
+} while (0);
+
+// Unpack the 8b input rgbrgbrgbrgb ... as contiguous registers:
+// rrrr... rrrr... gggg... gggg... bbbb... bbbb....
+// Similar to PlanarTo24bHelper(), but in reverse order.
+static WEBP_INLINE void RGB24PackedToPlanar_SSE41(
+ const uint8_t* const rgb, __m128i* const out /*out[6]*/) {
+ const __m128i A0 = _mm_loadu_si128((const __m128i*)(rgb + 0));
+ const __m128i A1 = _mm_loadu_si128((const __m128i*)(rgb + 16));
+ const __m128i A2 = _mm_loadu_si128((const __m128i*)(rgb + 32));
+ const __m128i A3 = _mm_loadu_si128((const __m128i*)(rgb + 48));
+ const __m128i A4 = _mm_loadu_si128((const __m128i*)(rgb + 64));
+ const __m128i A5 = _mm_loadu_si128((const __m128i*)(rgb + 80));
+
+ // Compute RR.
+ {
+ const __m128i shuff0 = _mm_set_epi8(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 12, 9, 6, 3, 0);
+ const __m128i shuff1 = _mm_set_epi8(
+ -1, -1, -1, -1, -1, 14, 11, 8, 5, 2, -1, -1, -1, -1, -1, -1);
+ const __m128i shuff2 = _mm_set_epi8(
+ 13, 10, 7, 4, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ WEBP_SSE41_SHUFF(0)
+ }
+ // Compute GG.
+ {
+ const __m128i shuff0 = _mm_set_epi8(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, 10, 7, 4, 1);
+ const __m128i shuff1 = _mm_set_epi8(
+ -1, -1, -1, -1, -1, 15, 12, 9, 6, 3, 0, -1, -1, -1, -1, -1);
+ const __m128i shuff2 = _mm_set_epi8(
+ 14, 11, 8, 5, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ WEBP_SSE41_SHUFF(2)
+ }
+ // Compute BB.
+ {
+ const __m128i shuff0 = _mm_set_epi8(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, 11, 8, 5, 2);
+ const __m128i shuff1 = _mm_set_epi8(
+ -1, -1, -1, -1, -1, -1, 13, 10, 7, 4, 1, -1, -1, -1, -1, -1);
+ const __m128i shuff2 = _mm_set_epi8(
+ 15, 12, 9, 6, 3, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
+ WEBP_SSE41_SHUFF(4)
+ }
+}
+
+#undef WEBP_SSE41_SHUFF
+
+// Convert 8 packed ARGB to r[], g[], b[]
+static WEBP_INLINE void RGB32PackedToPlanar_SSE41(
+ const uint32_t* const argb, __m128i* const rgb /*in[6]*/) {
+ const __m128i zero = _mm_setzero_si128();
+ __m128i a0 = LOAD_16(argb + 0);
+ __m128i a1 = LOAD_16(argb + 4);
+ __m128i a2 = LOAD_16(argb + 8);
+ __m128i a3 = LOAD_16(argb + 12);
+ VP8L32bToPlanar_SSE41(&a0, &a1, &a2, &a3);
+ rgb[0] = _mm_unpacklo_epi8(a1, zero);
+ rgb[1] = _mm_unpackhi_epi8(a1, zero);
+ rgb[2] = _mm_unpacklo_epi8(a2, zero);
+ rgb[3] = _mm_unpackhi_epi8(a2, zero);
+ rgb[4] = _mm_unpacklo_epi8(a3, zero);
+ rgb[5] = _mm_unpackhi_epi8(a3, zero);
+}
+
+// This macro computes (RG * MULT_RG + GB * MULT_GB + ROUNDER) >> DESCALE_FIX
+// It's a macro and not a function because we need to use immediate values with
+// srai_epi32, e.g.
+#define TRANSFORM(RG_LO, RG_HI, GB_LO, GB_HI, MULT_RG, MULT_GB, \
+ ROUNDER, DESCALE_FIX, OUT) do { \
+ const __m128i V0_lo = _mm_madd_epi16(RG_LO, MULT_RG); \
+ const __m128i V0_hi = _mm_madd_epi16(RG_HI, MULT_RG); \
+ const __m128i V1_lo = _mm_madd_epi16(GB_LO, MULT_GB); \
+ const __m128i V1_hi = _mm_madd_epi16(GB_HI, MULT_GB); \
+ const __m128i V2_lo = _mm_add_epi32(V0_lo, V1_lo); \
+ const __m128i V2_hi = _mm_add_epi32(V0_hi, V1_hi); \
+ const __m128i V3_lo = _mm_add_epi32(V2_lo, ROUNDER); \
+ const __m128i V3_hi = _mm_add_epi32(V2_hi, ROUNDER); \
+ const __m128i V5_lo = _mm_srai_epi32(V3_lo, DESCALE_FIX); \
+ const __m128i V5_hi = _mm_srai_epi32(V3_hi, DESCALE_FIX); \
+ (OUT) = _mm_packs_epi32(V5_lo, V5_hi); \
+} while (0)
+
+#define MK_CST_16(A, B) _mm_set_epi16((B), (A), (B), (A), (B), (A), (B), (A))
+static WEBP_INLINE void ConvertRGBToY_SSE41(const __m128i* const R,
+ const __m128i* const G,
+ const __m128i* const B,
+ __m128i* const Y) {
+ const __m128i kRG_y = MK_CST_16(16839, 33059 - 16384);
+ const __m128i kGB_y = MK_CST_16(16384, 6420);
+ const __m128i kHALF_Y = _mm_set1_epi32((16 << YUV_FIX) + YUV_HALF);
+
+ const __m128i RG_lo = _mm_unpacklo_epi16(*R, *G);
+ const __m128i RG_hi = _mm_unpackhi_epi16(*R, *G);
+ const __m128i GB_lo = _mm_unpacklo_epi16(*G, *B);
+ const __m128i GB_hi = _mm_unpackhi_epi16(*G, *B);
+ TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_y, kGB_y, kHALF_Y, YUV_FIX, *Y);
+}
+
+static WEBP_INLINE void ConvertRGBToUV_SSE41(const __m128i* const R,
+ const __m128i* const G,
+ const __m128i* const B,
+ __m128i* const U,
+ __m128i* const V) {
+ const __m128i kRG_u = MK_CST_16(-9719, -19081);
+ const __m128i kGB_u = MK_CST_16(0, 28800);
+ const __m128i kRG_v = MK_CST_16(28800, 0);
+ const __m128i kGB_v = MK_CST_16(-24116, -4684);
+ const __m128i kHALF_UV = _mm_set1_epi32(((128 << YUV_FIX) + YUV_HALF) << 2);
+
+ const __m128i RG_lo = _mm_unpacklo_epi16(*R, *G);
+ const __m128i RG_hi = _mm_unpackhi_epi16(*R, *G);
+ const __m128i GB_lo = _mm_unpacklo_epi16(*G, *B);
+ const __m128i GB_hi = _mm_unpackhi_epi16(*G, *B);
+ TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_u, kGB_u,
+ kHALF_UV, YUV_FIX + 2, *U);
+ TRANSFORM(RG_lo, RG_hi, GB_lo, GB_hi, kRG_v, kGB_v,
+ kHALF_UV, YUV_FIX + 2, *V);
+}
+
+#undef MK_CST_16
+#undef TRANSFORM
+
+static void ConvertRGB24ToY_SSE41(const uint8_t* rgb, uint8_t* y, int width) {
+ const int max_width = width & ~31;
+ int i;
+ for (i = 0; i < max_width; rgb += 3 * 16 * 2) {
+ __m128i rgb_plane[6];
+ int j;
+
+ RGB24PackedToPlanar_SSE41(rgb, rgb_plane);
+
+ for (j = 0; j < 2; ++j, i += 16) {
+ const __m128i zero = _mm_setzero_si128();
+ __m128i r, g, b, Y0, Y1;
+
+ // Convert to 16-bit Y.
+ r = _mm_unpacklo_epi8(rgb_plane[0 + j], zero);
+ g = _mm_unpacklo_epi8(rgb_plane[2 + j], zero);
+ b = _mm_unpacklo_epi8(rgb_plane[4 + j], zero);
+ ConvertRGBToY_SSE41(&r, &g, &b, &Y0);
+
+ // Convert to 16-bit Y.
+ r = _mm_unpackhi_epi8(rgb_plane[0 + j], zero);
+ g = _mm_unpackhi_epi8(rgb_plane[2 + j], zero);
+ b = _mm_unpackhi_epi8(rgb_plane[4 + j], zero);
+ ConvertRGBToY_SSE41(&r, &g, &b, &Y1);
+
+ // Cast to 8-bit and store.
+ STORE_16(_mm_packus_epi16(Y0, Y1), y + i);
+ }
+ }
+ for (; i < width; ++i, rgb += 3) { // left-over
+ y[i] = VP8RGBToY(rgb[0], rgb[1], rgb[2], YUV_HALF);
+ }
+}
+
+static void ConvertBGR24ToY_SSE41(const uint8_t* bgr, uint8_t* y, int width) {
+ const int max_width = width & ~31;
+ int i;
+ for (i = 0; i < max_width; bgr += 3 * 16 * 2) {
+ __m128i bgr_plane[6];
+ int j;
+
+ RGB24PackedToPlanar_SSE41(bgr, bgr_plane);
+
+ for (j = 0; j < 2; ++j, i += 16) {
+ const __m128i zero = _mm_setzero_si128();
+ __m128i r, g, b, Y0, Y1;
+
+ // Convert to 16-bit Y.
+ b = _mm_unpacklo_epi8(bgr_plane[0 + j], zero);
+ g = _mm_unpacklo_epi8(bgr_plane[2 + j], zero);
+ r = _mm_unpacklo_epi8(bgr_plane[4 + j], zero);
+ ConvertRGBToY_SSE41(&r, &g, &b, &Y0);
+
+ // Convert to 16-bit Y.
+ b = _mm_unpackhi_epi8(bgr_plane[0 + j], zero);
+ g = _mm_unpackhi_epi8(bgr_plane[2 + j], zero);
+ r = _mm_unpackhi_epi8(bgr_plane[4 + j], zero);
+ ConvertRGBToY_SSE41(&r, &g, &b, &Y1);
+
+ // Cast to 8-bit and store.
+ STORE_16(_mm_packus_epi16(Y0, Y1), y + i);
+ }
+ }
+ for (; i < width; ++i, bgr += 3) { // left-over
+ y[i] = VP8RGBToY(bgr[2], bgr[1], bgr[0], YUV_HALF);
+ }
+}
+
+static void ConvertARGBToY_SSE41(const uint32_t* argb, uint8_t* y, int width) {
+ const int max_width = width & ~15;
+ int i;
+ for (i = 0; i < max_width; i += 16) {
+ __m128i Y0, Y1, rgb[6];
+ RGB32PackedToPlanar_SSE41(&argb[i], rgb);
+ ConvertRGBToY_SSE41(&rgb[0], &rgb[2], &rgb[4], &Y0);
+ ConvertRGBToY_SSE41(&rgb[1], &rgb[3], &rgb[5], &Y1);
+ STORE_16(_mm_packus_epi16(Y0, Y1), y + i);
+ }
+ for (; i < width; ++i) { // left-over
+ const uint32_t p = argb[i];
+ y[i] = VP8RGBToY((p >> 16) & 0xff, (p >> 8) & 0xff, (p >> 0) & 0xff,
+ YUV_HALF);
+ }
+}
+
+// Horizontal add (doubled) of two 16b values, result is 16b.
+// in: A | B | C | D | ... -> out: 2*(A+B) | 2*(C+D) | ...
+static void HorizontalAddPack_SSE41(const __m128i* const A,
+ const __m128i* const B,
+ __m128i* const out) {
+ const __m128i k2 = _mm_set1_epi16(2);
+ const __m128i C = _mm_madd_epi16(*A, k2);
+ const __m128i D = _mm_madd_epi16(*B, k2);
+ *out = _mm_packs_epi32(C, D);
+}
+
+static void ConvertARGBToUV_SSE41(const uint32_t* argb,
+ uint8_t* u, uint8_t* v,
+ int src_width, int do_store) {
+ const int max_width = src_width & ~31;
+ int i;
+ for (i = 0; i < max_width; i += 32, u += 16, v += 16) {
+ __m128i rgb[6], U0, V0, U1, V1;
+ RGB32PackedToPlanar_SSE41(&argb[i], rgb);
+ HorizontalAddPack_SSE41(&rgb[0], &rgb[1], &rgb[0]);
+ HorizontalAddPack_SSE41(&rgb[2], &rgb[3], &rgb[2]);
+ HorizontalAddPack_SSE41(&rgb[4], &rgb[5], &rgb[4]);
+ ConvertRGBToUV_SSE41(&rgb[0], &rgb[2], &rgb[4], &U0, &V0);
+
+ RGB32PackedToPlanar_SSE41(&argb[i + 16], rgb);
+ HorizontalAddPack_SSE41(&rgb[0], &rgb[1], &rgb[0]);
+ HorizontalAddPack_SSE41(&rgb[2], &rgb[3], &rgb[2]);
+ HorizontalAddPack_SSE41(&rgb[4], &rgb[5], &rgb[4]);
+ ConvertRGBToUV_SSE41(&rgb[0], &rgb[2], &rgb[4], &U1, &V1);
+
+ U0 = _mm_packus_epi16(U0, U1);
+ V0 = _mm_packus_epi16(V0, V1);
+ if (!do_store) {
+ const __m128i prev_u = LOAD_16(u);
+ const __m128i prev_v = LOAD_16(v);
+ U0 = _mm_avg_epu8(U0, prev_u);
+ V0 = _mm_avg_epu8(V0, prev_v);
+ }
+ STORE_16(U0, u);
+ STORE_16(V0, v);
+ }
+ if (i < src_width) { // left-over
+ WebPConvertARGBToUV_C(argb + i, u, v, src_width - i, do_store);
+ }
+}
+
+// Convert 16 packed ARGB 16b-values to r[], g[], b[]
+static WEBP_INLINE void RGBA32PackedToPlanar_16b_SSE41(
+ const uint16_t* const rgbx,
+ __m128i* const r, __m128i* const g, __m128i* const b) {
+ const __m128i in0 = LOAD_16(rgbx + 0); // r0 | g0 | b0 |x| r1 | g1 | b1 |x
+ const __m128i in1 = LOAD_16(rgbx + 8); // r2 | g2 | b2 |x| r3 | g3 | b3 |x
+ const __m128i in2 = LOAD_16(rgbx + 16); // r4 | ...
+ const __m128i in3 = LOAD_16(rgbx + 24); // r6 | ...
+ // aarrggbb as 16-bit.
+ const __m128i shuff0 =
+ _mm_set_epi8(-1, -1, -1, -1, 13, 12, 5, 4, 11, 10, 3, 2, 9, 8, 1, 0);
+ const __m128i shuff1 =
+ _mm_set_epi8(13, 12, 5, 4, -1, -1, -1, -1, 11, 10, 3, 2, 9, 8, 1, 0);
+ const __m128i A0 = _mm_shuffle_epi8(in0, shuff0);
+ const __m128i A1 = _mm_shuffle_epi8(in1, shuff1);
+ const __m128i A2 = _mm_shuffle_epi8(in2, shuff0);
+ const __m128i A3 = _mm_shuffle_epi8(in3, shuff1);
+ // R0R1G0G1
+ // B0B1****
+ // R2R3G2G3
+ // B2B3****
+ // (OR is used to free port 5 for the unpack)
+ const __m128i B0 = _mm_unpacklo_epi32(A0, A1);
+ const __m128i B1 = _mm_or_si128(A0, A1);
+ const __m128i B2 = _mm_unpacklo_epi32(A2, A3);
+ const __m128i B3 = _mm_or_si128(A2, A3);
+ // Gather the channels.
+ *r = _mm_unpacklo_epi64(B0, B2);
+ *g = _mm_unpackhi_epi64(B0, B2);
+ *b = _mm_unpackhi_epi64(B1, B3);
+}
+
+static void ConvertRGBA32ToUV_SSE41(const uint16_t* rgb,
+ uint8_t* u, uint8_t* v, int width) {
+ const int max_width = width & ~15;
+ const uint16_t* const last_rgb = rgb + 4 * max_width;
+ while (rgb < last_rgb) {
+ __m128i r, g, b, U0, V0, U1, V1;
+ RGBA32PackedToPlanar_16b_SSE41(rgb + 0, &r, &g, &b);
+ ConvertRGBToUV_SSE41(&r, &g, &b, &U0, &V0);
+ RGBA32PackedToPlanar_16b_SSE41(rgb + 32, &r, &g, &b);
+ ConvertRGBToUV_SSE41(&r, &g, &b, &U1, &V1);
+ STORE_16(_mm_packus_epi16(U0, U1), u);
+ STORE_16(_mm_packus_epi16(V0, V1), v);
+ u += 16;
+ v += 16;
+ rgb += 2 * 32;
+ }
+ if (max_width < width) { // left-over
+ WebPConvertRGBA32ToUV_C(rgb, u, v, width - max_width);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+extern void WebPInitConvertARGBToYUVSSE41(void);
+
+WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUVSSE41(void) {
+ WebPConvertARGBToY = ConvertARGBToY_SSE41;
+ WebPConvertARGBToUV = ConvertARGBToUV_SSE41;
+
+ WebPConvertRGB24ToY = ConvertRGB24ToY_SSE41;
+ WebPConvertBGR24ToY = ConvertBGR24ToY_SSE41;
+
+ WebPConvertRGBA32ToUV = ConvertRGBA32ToUV_SSE41;
+}
+
+//------------------------------------------------------------------------------
+
+#else // !WEBP_USE_SSE41
+
+WEBP_DSP_INIT_STUB(WebPInitSamplersSSE41)
+WEBP_DSP_INIT_STUB(WebPInitConvertARGBToYUVSSE41)
+
+#endif // WEBP_USE_SSE41
diff --git a/thirdparty/libwebp/src/enc/alpha_enc.c b/thirdparty/libwebp/src/enc/alpha_enc.c
index 7e8d87f22e..dce9ca957d 100644
--- a/thirdparty/libwebp/src/enc/alpha_enc.c
+++ b/thirdparty/libwebp/src/enc/alpha_enc.c
@@ -361,7 +361,8 @@ static int EncodeAlpha(VP8Encoder* const enc,
//------------------------------------------------------------------------------
// Main calls
-static int CompressAlphaJob(VP8Encoder* const enc, void* dummy) {
+static int CompressAlphaJob(void* arg1, void* dummy) {
+ VP8Encoder* const enc = (VP8Encoder*)arg1;
const WebPConfig* config = enc->config_;
uint8_t* alpha_data = NULL;
size_t alpha_size = 0;
@@ -394,7 +395,7 @@ void VP8EncInitAlpha(VP8Encoder* const enc) {
WebPGetWorkerInterface()->Init(worker);
worker->data1 = enc;
worker->data2 = NULL;
- worker->hook = (WebPWorkerHook)CompressAlphaJob;
+ worker->hook = CompressAlphaJob;
}
}
diff --git a/thirdparty/libwebp/src/enc/analysis_enc.c b/thirdparty/libwebp/src/enc/analysis_enc.c
index 08f471f5f8..a47ff7d4e8 100644
--- a/thirdparty/libwebp/src/enc/analysis_enc.c
+++ b/thirdparty/libwebp/src/enc/analysis_enc.c
@@ -434,7 +434,9 @@ typedef struct {
} SegmentJob;
// main work call
-static int DoSegmentsJob(SegmentJob* const job, VP8EncIterator* const it) {
+static int DoSegmentsJob(void* arg1, void* arg2) {
+ SegmentJob* const job = (SegmentJob*)arg1;
+ VP8EncIterator* const it = (VP8EncIterator*)arg2;
int ok = 1;
if (!VP8IteratorIsDone(it)) {
uint8_t tmp[32 + WEBP_ALIGN_CST];
@@ -462,7 +464,7 @@ static void InitSegmentJob(VP8Encoder* const enc, SegmentJob* const job,
WebPGetWorkerInterface()->Init(&job->worker);
job->worker.data1 = job;
job->worker.data2 = &job->it;
- job->worker.hook = (WebPWorkerHook)DoSegmentsJob;
+ job->worker.hook = DoSegmentsJob;
VP8IteratorInit(enc, &job->it);
VP8IteratorSetRow(&job->it, start_row);
VP8IteratorSetCountDown(&job->it, (end_row - start_row) * enc->mb_w_);
diff --git a/thirdparty/libwebp/src/enc/frame_enc.c b/thirdparty/libwebp/src/enc/frame_enc.c
index 2b0dc66410..1aec376e44 100644
--- a/thirdparty/libwebp/src/enc/frame_enc.c
+++ b/thirdparty/libwebp/src/enc/frame_enc.c
@@ -198,7 +198,7 @@ static void SetSegmentProbas(VP8Encoder* const enc) {
for (n = 0; n < enc->mb_w_ * enc->mb_h_; ++n) {
const VP8MBInfo* const mb = &enc->mb_info_[n];
- p[mb->segment_]++;
+ ++p[mb->segment_];
}
#if !defined(WEBP_DISABLE_STATS)
if (enc->pic_->stats != NULL) {
@@ -520,6 +520,14 @@ static void StoreSideInfo(const VP8EncIterator* const it) {
#endif
}
+static void ResetSideInfo(const VP8EncIterator* const it) {
+ VP8Encoder* const enc = it->enc_;
+ WebPPicture* const pic = enc->pic_;
+ if (pic->stats != NULL) {
+ memset(enc->block_count_, 0, sizeof(enc->block_count_));
+ }
+ ResetSSE(enc);
+}
#else // defined(WEBP_DISABLE_STATS)
static void ResetSSE(VP8Encoder* const enc) {
(void)enc;
@@ -528,10 +536,16 @@ static void StoreSideInfo(const VP8EncIterator* const it) {
VP8Encoder* const enc = it->enc_;
WebPPicture* const pic = enc->pic_;
if (pic->extra_info != NULL) {
- memset(pic->extra_info, 0,
- enc->mb_w_ * enc->mb_h_ * sizeof(*pic->extra_info));
+ if (it->x_ == 0 && it->y_ == 0) { // only do it once, at start
+ memset(pic->extra_info, 0,
+ enc->mb_w_ * enc->mb_h_ * sizeof(*pic->extra_info));
+ }
}
}
+
+static void ResetSideInfo(const VP8EncIterator* const it) {
+ (void)it;
+}
#endif // !defined(WEBP_DISABLE_STATS)
static double GetPSNR(uint64_t mse, uint64_t size) {
@@ -570,7 +584,7 @@ static uint64_t OneStatPass(VP8Encoder* const enc, VP8RDLevel rd_opt,
VP8IteratorImport(&it, NULL);
if (VP8Decimate(&it, &info, rd_opt)) {
// Just record the number of skips and act like skip_proba is not used.
- enc->proba_.nb_skip_++;
+ ++enc->proba_.nb_skip_;
}
RecordResiduals(&it, &info);
size += info.R + info.H;
@@ -841,6 +855,9 @@ int VP8EncTokenLoop(VP8Encoder* const enc) {
if (enc->max_i4_header_bits_ > 0 && size_p0 > PARTITION0_SIZE_LIMIT) {
++num_pass_left;
enc->max_i4_header_bits_ >>= 1; // strengthen header bit limitation...
+ if (is_last_pass) {
+ ResetSideInfo(&it);
+ }
continue; // ...and start over
}
if (is_last_pass) {
@@ -871,4 +888,3 @@ int VP8EncTokenLoop(VP8Encoder* const enc) {
#endif // DISABLE_TOKEN_BUFFER
//------------------------------------------------------------------------------
-
diff --git a/thirdparty/libwebp/src/enc/histogram_enc.c b/thirdparty/libwebp/src/enc/histogram_enc.c
index 056a972dda..9fdbc627a1 100644
--- a/thirdparty/libwebp/src/enc/histogram_enc.c
+++ b/thirdparty/libwebp/src/enc/histogram_enc.c
@@ -200,14 +200,9 @@ static WEBP_INLINE double BitsEntropyRefine(const VP8LBitEntropy* entropy) {
}
}
-double VP8LBitsEntropy(const uint32_t* const array, int n,
- uint32_t* const trivial_symbol) {
+double VP8LBitsEntropy(const uint32_t* const array, int n) {
VP8LBitEntropy entropy;
VP8LBitsEntropyUnrefined(array, n, &entropy);
- if (trivial_symbol != NULL) {
- *trivial_symbol =
- (entropy.nonzeros == 1) ? entropy.nonzero_code : VP8L_NON_TRIVIAL_SYM;
- }
return BitsEntropyRefine(&entropy);
}
@@ -605,7 +600,7 @@ static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo,
}
// Implement a Lehmer random number generator with a multiplicative constant of
-// 48271 and a modulo constant of 2^31 − 1.
+// 48271 and a modulo constant of 2^31 - 1.
static uint32_t MyRand(uint32_t* const seed) {
*seed = (uint32_t)(((uint64_t)(*seed) * 48271u) % 2147483647u);
assert(*seed > 0);
@@ -1031,7 +1026,7 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize,
}
}
- // TODO(vikasa): Optimize HistogramRemap for low-effort compression mode also.
+ // TODO(vrabaud): Optimize HistogramRemap for low-effort compression mode.
// Find the optimal map from original histograms to the final ones.
HistogramRemap(orig_histo, image_histo, histogram_symbols);
diff --git a/thirdparty/libwebp/src/enc/histogram_enc.h b/thirdparty/libwebp/src/enc/histogram_enc.h
index 15b1fbda34..e8c4c83f6f 100644
--- a/thirdparty/libwebp/src/enc/histogram_enc.h
+++ b/thirdparty/libwebp/src/enc/histogram_enc.h
@@ -109,10 +109,7 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize,
uint16_t* const histogram_symbols);
// Returns the entropy for the symbols in the input array.
-// Also sets trivial_symbol to the code value, if the array has only one code
-// value. Otherwise, set it to VP8L_NON_TRIVIAL_SYM.
-double VP8LBitsEntropy(const uint32_t* const array, int n,
- uint32_t* const trivial_symbol);
+double VP8LBitsEntropy(const uint32_t* const array, int n);
// Estimate how many bits the combined entropy of literals and distance
// approximately maps to.
diff --git a/thirdparty/libwebp/src/enc/iterator_enc.c b/thirdparty/libwebp/src/enc/iterator_enc.c
index cfacfd2401..7c47d51272 100644
--- a/thirdparty/libwebp/src/enc/iterator_enc.c
+++ b/thirdparty/libwebp/src/enc/iterator_enc.c
@@ -26,6 +26,9 @@ static void InitLeft(VP8EncIterator* const it) {
memset(it->u_left_, 129, 8);
memset(it->v_left_, 129, 8);
it->left_nz_[8] = 0;
+ if (it->top_derr_ != NULL) {
+ memset(&it->left_derr_, 0, sizeof(it->left_derr_));
+ }
}
static void InitTop(VP8EncIterator* const it) {
@@ -33,6 +36,9 @@ static void InitTop(VP8EncIterator* const it) {
const size_t top_size = enc->mb_w_ * 16;
memset(enc->y_top_, 127, 2 * top_size);
memset(enc->nz_, 0, enc->mb_w_ * sizeof(*enc->nz_));
+ if (enc->top_derr_ != NULL) {
+ memset(enc->top_derr_, 0, enc->mb_w_ * sizeof(*enc->top_derr_));
+ }
}
void VP8IteratorSetRow(VP8EncIterator* const it, int y) {
@@ -76,6 +82,7 @@ void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) {
it->y_left_ = (uint8_t*)WEBP_ALIGN(it->yuv_left_mem_ + 1);
it->u_left_ = it->y_left_ + 16 + 16;
it->v_left_ = it->u_left_ + 16;
+ it->top_derr_ = enc->top_derr_;
VP8IteratorReset(it);
}
@@ -450,4 +457,3 @@ int VP8IteratorRotateI4(VP8EncIterator* const it,
}
//------------------------------------------------------------------------------
-
diff --git a/thirdparty/libwebp/src/enc/near_lossless_enc.c b/thirdparty/libwebp/src/enc/near_lossless_enc.c
index cadd14c664..5517a7e271 100644
--- a/thirdparty/libwebp/src/enc/near_lossless_enc.c
+++ b/thirdparty/libwebp/src/enc/near_lossless_enc.c
@@ -146,6 +146,6 @@ int VP8ApplyNearLossless(const WebPPicture* const picture, int quality,
// Define a stub to suppress compiler warnings.
extern void VP8LNearLosslessStub(void);
-WEBP_TSAN_IGNORE_FUNCTION void VP8LNearLosslessStub(void) {}
+void VP8LNearLosslessStub(void) {}
#endif // (WEBP_NEAR_LOSSLESS == 1)
diff --git a/thirdparty/libwebp/src/enc/picture_csp_enc.c b/thirdparty/libwebp/src/enc/picture_csp_enc.c
index d531dd0282..02d9df76d5 100644
--- a/thirdparty/libwebp/src/enc/picture_csp_enc.c
+++ b/thirdparty/libwebp/src/enc/picture_csp_enc.c
@@ -28,11 +28,11 @@
// If defined, use table to compute x / alpha.
#define USE_INVERSE_ALPHA_TABLE
-static const union {
- uint32_t argb;
- uint8_t bytes[4];
-} test_endian = { 0xff000000u };
-#define ALPHA_IS_LAST (test_endian.bytes[3] == 0xff)
+#ifdef WORDS_BIGENDIAN
+#define ALPHA_OFFSET 0 // uint32_t 0xff000000 is 0xff,00,00,00 in memory
+#else
+#define ALPHA_OFFSET 3 // uint32_t 0xff000000 is 0x00,00,00,ff in memory
+#endif
//------------------------------------------------------------------------------
// Detection of non-trivial transparency
@@ -61,7 +61,7 @@ int WebPPictureHasTransparency(const WebPPicture* picture) {
return CheckNonOpaque(picture->a, picture->width, picture->height,
1, picture->a_stride);
} else {
- const int alpha_offset = ALPHA_IS_LAST ? 3 : 0;
+ const int alpha_offset = ALPHA_OFFSET;
return CheckNonOpaque((const uint8_t*)picture->argb + alpha_offset,
picture->width, picture->height,
4, picture->argb_stride * sizeof(*picture->argb));
@@ -126,7 +126,7 @@ static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) {
#else
-static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTables(void) {}
+static void InitGammaTables(void) {}
static WEBP_INLINE uint32_t GammaToLinear(uint8_t v) { return v; }
static WEBP_INLINE int LinearToGamma(uint32_t base_value, int shift) {
return (int)(base_value << shift);
@@ -170,29 +170,33 @@ typedef uint16_t fixed_y_t; // unsigned type with extra SFIX precision for W
#if defined(USE_GAMMA_COMPRESSION)
-// float variant of gamma-correction
// We use tables of different size and precision for the Rec709 / BT2020
// transfer function.
#define kGammaF (1./0.45)
-static float kGammaToLinearTabF[MAX_Y_T + 1]; // size scales with Y_FIX
-static float kLinearToGammaTabF[kGammaTabSize + 2];
-static volatile int kGammaTablesFOk = 0;
-
-static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {
- if (!kGammaTablesFOk) {
+static uint32_t kLinearToGammaTabS[kGammaTabSize + 2];
+#define GAMMA_TO_LINEAR_BITS 14
+static uint32_t kGammaToLinearTabS[MAX_Y_T + 1]; // size scales with Y_FIX
+static volatile int kGammaTablesSOk = 0;
+
+static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesS(void) {
+ assert(2 * GAMMA_TO_LINEAR_BITS < 32); // we use uint32_t intermediate values
+ if (!kGammaTablesSOk) {
int v;
const double norm = 1. / MAX_Y_T;
const double scale = 1. / kGammaTabSize;
const double a = 0.09929682680944;
const double thresh = 0.018053968510807;
+ const double final_scale = 1 << GAMMA_TO_LINEAR_BITS;
for (v = 0; v <= MAX_Y_T; ++v) {
const double g = norm * v;
+ double value;
if (g <= thresh * 4.5) {
- kGammaToLinearTabF[v] = (float)(g / 4.5);
+ value = g / 4.5;
} else {
const double a_rec = 1. / (1. + a);
- kGammaToLinearTabF[v] = (float)pow(a_rec * (g + a), kGammaF);
+ value = pow(a_rec * (g + a), kGammaF);
}
+ kGammaToLinearTabS[v] = (uint32_t)(value * final_scale + .5);
}
for (v = 0; v <= kGammaTabSize; ++v) {
const double g = scale * v;
@@ -202,37 +206,44 @@ static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {
} else {
value = (1. + a) * pow(g, 1. / kGammaF) - a;
}
- kLinearToGammaTabF[v] = (float)(MAX_Y_T * value);
+ // we already incorporate the 1/2 rounding constant here
+ kLinearToGammaTabS[v] =
+ (uint32_t)(MAX_Y_T * value) + (1 << GAMMA_TO_LINEAR_BITS >> 1);
}
// to prevent small rounding errors to cause read-overflow:
- kLinearToGammaTabF[kGammaTabSize + 1] = kLinearToGammaTabF[kGammaTabSize];
- kGammaTablesFOk = 1;
+ kLinearToGammaTabS[kGammaTabSize + 1] = kLinearToGammaTabS[kGammaTabSize];
+ kGammaTablesSOk = 1;
}
}
-static WEBP_INLINE float GammaToLinearF(int v) {
- return kGammaToLinearTabF[v];
+// return value has a fixed-point precision of GAMMA_TO_LINEAR_BITS
+static WEBP_INLINE uint32_t GammaToLinearS(int v) {
+ return kGammaToLinearTabS[v];
}
-static WEBP_INLINE int LinearToGammaF(float value) {
- const float v = value * kGammaTabSize;
- const int tab_pos = (int)v;
- const float x = v - (float)tab_pos; // fractional part
- const float v0 = kLinearToGammaTabF[tab_pos + 0];
- const float v1 = kLinearToGammaTabF[tab_pos + 1];
- const float y = v1 * x + v0 * (1.f - x); // interpolate
- return (int)(y + .5);
+static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) {
+ // 'value' is in GAMMA_TO_LINEAR_BITS fractional precision
+ const uint32_t v = value * kGammaTabSize;
+ const uint32_t tab_pos = v >> GAMMA_TO_LINEAR_BITS;
+ // fractional part, in GAMMA_TO_LINEAR_BITS fixed-point precision
+ const uint32_t x = v - (tab_pos << GAMMA_TO_LINEAR_BITS); // fractional part
+ // v0 / v1 are in GAMMA_TO_LINEAR_BITS fixed-point precision (range [0..1])
+ const uint32_t v0 = kLinearToGammaTabS[tab_pos + 0];
+ const uint32_t v1 = kLinearToGammaTabS[tab_pos + 1];
+ // Final interpolation. Note that rounding is already included.
+ const uint32_t v2 = (v1 - v0) * x; // note: v1 >= v0.
+ const uint32_t result = v0 + (v2 >> GAMMA_TO_LINEAR_BITS);
+ return result;
}
#else
-static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesF(void) {}
-static WEBP_INLINE float GammaToLinearF(int v) {
- const float norm = 1.f / MAX_Y_T;
- return norm * v;
+static void InitGammaTablesS(void) {}
+static WEBP_INLINE uint32_t GammaToLinearS(int v) {
+ return (v << GAMMA_TO_LINEAR_BITS) / MAX_Y_T;
}
-static WEBP_INLINE int LinearToGammaF(float value) {
- return (int)(MAX_Y_T * value + .5);
+static WEBP_INLINE uint32_t LinearToGammaS(uint32_t value) {
+ return (MAX_Y_T * value) >> GAMMA_TO_LINEAR_BITS;
}
#endif // USE_GAMMA_COMPRESSION
@@ -254,26 +265,22 @@ static int RGBToGray(int r, int g, int b) {
return (luma >> YUV_FIX);
}
-static float RGBToGrayF(float r, float g, float b) {
- return (float)(0.2126 * r + 0.7152 * g + 0.0722 * b);
-}
-
-static int ScaleDown(int a, int b, int c, int d) {
- const float A = GammaToLinearF(a);
- const float B = GammaToLinearF(b);
- const float C = GammaToLinearF(c);
- const float D = GammaToLinearF(d);
- return LinearToGammaF(0.25f * (A + B + C + D));
+static uint32_t ScaleDown(int a, int b, int c, int d) {
+ const uint32_t A = GammaToLinearS(a);
+ const uint32_t B = GammaToLinearS(b);
+ const uint32_t C = GammaToLinearS(c);
+ const uint32_t D = GammaToLinearS(d);
+ return LinearToGammaS((A + B + C + D + 2) >> 2);
}
static WEBP_INLINE void UpdateW(const fixed_y_t* src, fixed_y_t* dst, int w) {
int i;
for (i = 0; i < w; ++i) {
- const float R = GammaToLinearF(src[0 * w + i]);
- const float G = GammaToLinearF(src[1 * w + i]);
- const float B = GammaToLinearF(src[2 * w + i]);
- const float Y = RGBToGrayF(R, G, B);
- dst[i] = (fixed_y_t)LinearToGammaF(Y);
+ const uint32_t R = GammaToLinearS(src[0 * w + i]);
+ const uint32_t G = GammaToLinearS(src[1 * w + i]);
+ const uint32_t B = GammaToLinearS(src[2 * w + i]);
+ const uint32_t Y = RGBToGray(R, G, B);
+ dst[i] = (fixed_y_t)LinearToGammaS(Y);
}
}
@@ -863,7 +870,7 @@ static int ImportYUVAFromRGBA(const uint8_t* r_ptr,
}
if (use_iterative_conversion) {
- InitGammaTablesF();
+ InitGammaTablesS();
if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) {
return 0;
}
@@ -990,10 +997,10 @@ static int PictureARGBToYUVA(WebPPicture* picture, WebPEncCSP colorspace,
return WebPEncodingSetError(picture, VP8_ENC_ERROR_INVALID_CONFIGURATION);
} else {
const uint8_t* const argb = (const uint8_t*)picture->argb;
- const uint8_t* const r = ALPHA_IS_LAST ? argb + 2 : argb + 1;
- const uint8_t* const g = ALPHA_IS_LAST ? argb + 1 : argb + 2;
- const uint8_t* const b = ALPHA_IS_LAST ? argb + 0 : argb + 3;
- const uint8_t* const a = ALPHA_IS_LAST ? argb + 3 : argb + 0;
+ const uint8_t* const a = argb + (0 ^ ALPHA_OFFSET);
+ const uint8_t* const r = argb + (1 ^ ALPHA_OFFSET);
+ const uint8_t* const g = argb + (2 ^ ALPHA_OFFSET);
+ const uint8_t* const b = argb + (3 ^ ALPHA_OFFSET);
picture->colorspace = WEBP_YUV420;
return ImportYUVAFromRGBA(r, g, b, a, 4, 4 * picture->argb_stride,
@@ -1044,7 +1051,8 @@ int WebPPictureYUVAToARGB(WebPPicture* picture) {
const int argb_stride = 4 * picture->argb_stride;
uint8_t* dst = (uint8_t*)picture->argb;
const uint8_t *cur_u = picture->u, *cur_v = picture->v, *cur_y = picture->y;
- WebPUpsampleLinePairFunc upsample = WebPGetLinePairConverter(ALPHA_IS_LAST);
+ WebPUpsampleLinePairFunc upsample =
+ WebPGetLinePairConverter(ALPHA_OFFSET > 0);
// First row, with replicated top samples.
upsample(cur_y, NULL, cur_u, cur_v, cur_u, cur_v, dst, NULL, width);
@@ -1087,6 +1095,7 @@ static int Import(WebPPicture* const picture,
const uint8_t* rgb, int rgb_stride,
int step, int swap_rb, int import_alpha) {
int y;
+ // swap_rb -> b,g,r,a , !swap_rb -> r,g,b,a
const uint8_t* r_ptr = rgb + (swap_rb ? 2 : 0);
const uint8_t* g_ptr = rgb + 1;
const uint8_t* b_ptr = rgb + (swap_rb ? 0 : 2);
@@ -1104,19 +1113,32 @@ static int Import(WebPPicture* const picture,
WebPInitAlphaProcessing();
if (import_alpha) {
+ // dst[] byte order is {a,r,g,b} for big-endian, {b,g,r,a} for little endian
uint32_t* dst = picture->argb;
- const int do_copy =
- (!swap_rb && !ALPHA_IS_LAST) || (swap_rb && ALPHA_IS_LAST);
+ const int do_copy = (ALPHA_OFFSET == 3) && swap_rb;
assert(step == 4);
- for (y = 0; y < height; ++y) {
- if (do_copy) {
+ if (do_copy) {
+ for (y = 0; y < height; ++y) {
memcpy(dst, rgb, width * 4);
- } else {
+ rgb += rgb_stride;
+ dst += picture->argb_stride;
+ }
+ } else {
+ for (y = 0; y < height; ++y) {
+#ifdef WORDS_BIGENDIAN
+ // BGRA or RGBA input order.
+ const uint8_t* a_ptr = rgb + 3;
+ WebPPackARGB(a_ptr, r_ptr, g_ptr, b_ptr, width, dst);
+ r_ptr += rgb_stride;
+ g_ptr += rgb_stride;
+ b_ptr += rgb_stride;
+#else
// RGBA input order. Need to swap R and B.
VP8LConvertBGRAToRGBA((const uint32_t*)rgb, width, (uint8_t*)dst);
+#endif
+ rgb += rgb_stride;
+ dst += picture->argb_stride;
}
- rgb += rgb_stride;
- dst += picture->argb_stride;
}
} else {
uint32_t* dst = picture->argb;
diff --git a/thirdparty/libwebp/src/enc/picture_psnr_enc.c b/thirdparty/libwebp/src/enc/picture_psnr_enc.c
index 362a7c79be..1a2f0bef3e 100644
--- a/thirdparty/libwebp/src/enc/picture_psnr_enc.c
+++ b/thirdparty/libwebp/src/enc/picture_psnr_enc.c
@@ -18,6 +18,7 @@
#include <math.h>
#include <stdlib.h>
+#include "src/dsp/dsp.h"
#include "src/enc/vp8i_enc.h"
#include "src/utils/utils.h"
@@ -169,6 +170,12 @@ int WebPPlaneDistortion(const uint8_t* src, size_t src_stride,
return 1;
}
+#ifdef WORDS_BIGENDIAN
+#define BLUE_OFFSET 3 // uint32_t 0x000000ff is 0x00,00,00,ff in memory
+#else
+#define BLUE_OFFSET 0 // uint32_t 0x000000ff is 0xff,00,00,00 in memory
+#endif
+
int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
int type, float results[5]) {
int w, h, c;
@@ -195,8 +202,10 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
float distortion;
const size_t stride0 = 4 * (size_t)p0.argb_stride;
const size_t stride1 = 4 * (size_t)p1.argb_stride;
- if (!WebPPlaneDistortion((const uint8_t*)p0.argb + c, stride0,
- (const uint8_t*)p1.argb + c, stride1,
+ // results are reported as BGRA
+ const int offset = c ^ BLUE_OFFSET;
+ if (!WebPPlaneDistortion((const uint8_t*)p0.argb + offset, stride0,
+ (const uint8_t*)p1.argb + offset, stride1,
w, h, 4, type, &distortion, results + c)) {
goto Error;
}
@@ -214,6 +223,8 @@ int WebPPictureDistortion(const WebPPicture* src, const WebPPicture* ref,
return ok;
}
+#undef BLUE_OFFSET
+
#else // defined(WEBP_DISABLE_STATS)
int WebPPlaneDistortion(const uint8_t* src, size_t src_stride,
const uint8_t* ref, size_t ref_stride,
diff --git a/thirdparty/libwebp/src/enc/quant_enc.c b/thirdparty/libwebp/src/enc/quant_enc.c
index 3b1a3129b5..35bfaf21ef 100644
--- a/thirdparty/libwebp/src/enc/quant_enc.c
+++ b/thirdparty/libwebp/src/enc/quant_enc.c
@@ -826,6 +826,85 @@ static int ReconstructIntra4(VP8EncIterator* const it,
return nz;
}
+//------------------------------------------------------------------------------
+// DC-error diffusion
+
+// Diffusion weights. We under-correct a bit (15/16th of the error is actually
+// diffused) to avoid 'rainbow' chessboard pattern of blocks at q~=0.
+#define C1 7 // fraction of error sent to the 4x4 block below
+#define C2 8 // fraction of error sent to the 4x4 block on the right
+#define DSHIFT 4
+#define DSCALE 1 // storage descaling, needed to make the error fit int8_t
+
+// Quantize as usual, but also compute and return the quantization error.
+// Error is already divided by DSHIFT.
+static int QuantizeSingle(int16_t* const v, const VP8Matrix* const mtx) {
+ int V = *v;
+ const int sign = (V < 0);
+ if (sign) V = -V;
+ if (V > (int)mtx->zthresh_[0]) {
+ const int qV = QUANTDIV(V, mtx->iq_[0], mtx->bias_[0]) * mtx->q_[0];
+ const int err = (V - qV);
+ *v = sign ? -qV : qV;
+ return (sign ? -err : err) >> DSCALE;
+ }
+ *v = 0;
+ return (sign ? -V : V) >> DSCALE;
+}
+
+static void CorrectDCValues(const VP8EncIterator* const it,
+ const VP8Matrix* const mtx,
+ int16_t tmp[][16], VP8ModeScore* const rd) {
+ // | top[0] | top[1]
+ // --------+--------+---------
+ // left[0] | tmp[0] tmp[1] <-> err0 err1
+ // left[1] | tmp[2] tmp[3] err2 err3
+ //
+ // Final errors {err1,err2,err3} are preserved and later restored
+ // as top[]/left[] on the next block.
+ int ch;
+ for (ch = 0; ch <= 1; ++ch) {
+ const int8_t* const top = it->top_derr_[it->x_][ch];
+ const int8_t* const left = it->left_derr_[ch];
+ int16_t (* const c)[16] = &tmp[ch * 4];
+ int err0, err1, err2, err3;
+ c[0][0] += (C1 * top[0] + C2 * left[0]) >> (DSHIFT - DSCALE);
+ err0 = QuantizeSingle(&c[0][0], mtx);
+ c[1][0] += (C1 * top[1] + C2 * err0) >> (DSHIFT - DSCALE);
+ err1 = QuantizeSingle(&c[1][0], mtx);
+ c[2][0] += (C1 * err0 + C2 * left[1]) >> (DSHIFT - DSCALE);
+ err2 = QuantizeSingle(&c[2][0], mtx);
+ c[3][0] += (C1 * err1 + C2 * err2) >> (DSHIFT - DSCALE);
+ err3 = QuantizeSingle(&c[3][0], mtx);
+ // error 'err' is bounded by mtx->q_[0] which is 132 at max. Hence
+ // err >> DSCALE will fit in an int8_t type if DSCALE>=1.
+ assert(abs(err1) <= 127 && abs(err2) <= 127 && abs(err3) <= 127);
+ rd->derr[ch][0] = (int8_t)err1;
+ rd->derr[ch][1] = (int8_t)err2;
+ rd->derr[ch][2] = (int8_t)err3;
+ }
+}
+
+static void StoreDiffusionErrors(VP8EncIterator* const it,
+ const VP8ModeScore* const rd) {
+ int ch;
+ for (ch = 0; ch <= 1; ++ch) {
+ int8_t* const top = it->top_derr_[it->x_][ch];
+ int8_t* const left = it->left_derr_[ch];
+ left[0] = rd->derr[ch][0]; // restore err1
+ left[1] = 3 * rd->derr[ch][2] >> 2; // ... 3/4th of err3
+ top[0] = rd->derr[ch][1]; // ... err2
+ top[1] = rd->derr[ch][2] - left[1]; // ... 1/4th of err3.
+ }
+}
+
+#undef C1
+#undef C2
+#undef DSHIFT
+#undef DSCALE
+
+//------------------------------------------------------------------------------
+
static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd,
uint8_t* const yuv_out, int mode) {
const VP8Encoder* const enc = it->enc_;
@@ -839,6 +918,8 @@ static int ReconstructUV(VP8EncIterator* const it, VP8ModeScore* const rd,
for (n = 0; n < 8; n += 2) {
VP8FTransform2(src + VP8ScanUV[n], ref + VP8ScanUV[n], tmp[n]);
}
+ if (it->top_derr_ != NULL) CorrectDCValues(it, &dqm->uv_, tmp, rd);
+
if (DO_TRELLIS_UV && it->do_trellis_) {
int ch, x, y;
for (ch = 0, n = 0; ch <= 2; ch += 2) {
@@ -1101,6 +1182,9 @@ static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) {
CopyScore(&rd_best, &rd_uv);
rd->mode_uv = mode;
memcpy(rd->uv_levels, rd_uv.uv_levels, sizeof(rd->uv_levels));
+ if (it->top_derr_ != NULL) {
+ memcpy(rd->derr, rd_uv.derr, sizeof(rd_uv.derr));
+ }
SwapPtr(&dst, &tmp_dst);
}
}
@@ -1109,6 +1193,9 @@ static void PickBestUV(VP8EncIterator* const it, VP8ModeScore* const rd) {
if (dst != dst0) { // copy 16x8 block if needed
VP8Copy16x8(dst, dst0);
}
+ if (it->top_derr_ != NULL) { // store diffusion errors for next block
+ StoreDiffusionErrors(it, rd);
+ }
}
//------------------------------------------------------------------------------
diff --git a/thirdparty/libwebp/src/enc/vp8i_enc.h b/thirdparty/libwebp/src/enc/vp8i_enc.h
index 3463491e9d..624e8f8e66 100644
--- a/thirdparty/libwebp/src/enc/vp8i_enc.h
+++ b/thirdparty/libwebp/src/enc/vp8i_enc.h
@@ -30,9 +30,9 @@ extern "C" {
// Various defines and enums
// version numbers
-#define ENC_MAJ_VERSION 0
-#define ENC_MIN_VERSION 6
-#define ENC_REV_VERSION 1
+#define ENC_MAJ_VERSION 1
+#define ENC_MIN_VERSION 0
+#define ENC_REV_VERSION 0
enum { MAX_LF_LEVELS = 64, // Maximum loop filter level
MAX_VARIABLE_LEVEL = 67, // last (inclusive) level with variable cost
@@ -120,6 +120,9 @@ static WEBP_INLINE int QUANTDIV(uint32_t n, uint32_t iQ, uint32_t B) {
// Uncomment the following to remove token-buffer code:
// #define DISABLE_TOKEN_BUFFER
+// quality below which error-diffusion is enabled
+#define ERROR_DIFFUSION_QUALITY 98
+
//------------------------------------------------------------------------------
// Headers
@@ -201,6 +204,8 @@ typedef struct {
score_t i4_penalty_; // penalty for using Intra4
} VP8SegmentInfo;
+typedef int8_t DError[2 /* u/v */][2 /* top or left */];
+
// Handy transient struct to accumulate score and info during RD-optimization
// and mode evaluation.
typedef struct {
@@ -213,6 +218,7 @@ typedef struct {
uint8_t modes_i4[16]; // mode numbers for intra4 predictions
int mode_uv; // mode number of chroma prediction
uint32_t nz; // non-zero blocks
+ int8_t derr[2][3]; // DC diffusion errors for U/V for blocks #1/2/3
} VP8ModeScore;
// Iterator structure to iterate through macroblocks, pointing to the
@@ -242,6 +248,9 @@ typedef struct {
int count_down0_; // starting counter value (for progress)
int percent0_; // saved initial progress percent
+ DError left_derr_; // left error diffusion (u/v)
+ DError *top_derr_; // top diffusion error - NULL if disabled
+
uint8_t* y_left_; // left luma samples (addressable from index -1 to 15).
uint8_t* u_left_; // left u samples (addressable from index -1 to 7)
uint8_t* v_left_; // left v samples (addressable from index -1 to 7)
@@ -401,6 +410,7 @@ struct VP8Encoder {
uint8_t* uv_top_; // top u/v samples.
// U and V are packed into 16 bytes (8 U + 8 V)
LFStats* lf_stats_; // autofilter stats (if NULL, autofilter is off)
+ DError* top_derr_; // diffusion error (NULL if disabled)
};
//------------------------------------------------------------------------------
diff --git a/thirdparty/libwebp/src/enc/vp8l_enc.c b/thirdparty/libwebp/src/enc/vp8l_enc.c
index 312e521906..a89184eb08 100644
--- a/thirdparty/libwebp/src/enc/vp8l_enc.c
+++ b/thirdparty/libwebp/src/enc/vp8l_enc.c
@@ -26,8 +26,6 @@
#include "src/utils/utils.h"
#include "src/webp/format_constants.h"
-#include "src/enc/delta_palettization_enc.h"
-
// Maximum number of histogram images (sub-blocks).
#define MAX_HUFF_IMAGE_SIZE 2600
@@ -259,7 +257,7 @@ static int AnalyzeEntropy(const uint32_t* argb,
++histo[kHistoAlphaPred * 256];
for (j = 0; j < kHistoTotal; ++j) {
- entropy_comp[j] = VP8LBitsEntropy(&histo[j * 256], 256, NULL);
+ entropy_comp[j] = VP8LBitsEntropy(&histo[j * 256], 256);
}
entropy[kDirect] = entropy_comp[kHistoAlpha] +
entropy_comp[kHistoRed] +
@@ -384,8 +382,7 @@ static int EncoderAnalyze(VP8LEncoder* const enc,
AnalyzeAndCreatePalette(pic, low_effort,
enc->palette_, &enc->palette_size_);
- // TODO(jyrki): replace the decision to be based on an actual estimate
- // of entropy, or even spatial variance of entropy.
+ // Empirical bit sizes.
enc->histo_bits_ = GetHistoBits(method, use_palette,
pic->width, pic->height);
enc->transform_bits_ = GetTransformBits(method, enc->histo_bits_);
@@ -756,7 +753,6 @@ static WebPEncodingError StoreImageToBitMask(
// Don't write the distance with the extra bits code since
// the distance can be up to 18 bits of extra bits, and the prefix
// 15 bits, totaling to 33, and our PutBits only supports up to 32 bits.
- // TODO(jyrki): optimize this further.
VP8LPrefixEncode(distance, &code, &n_bits, &bits);
WriteHuffmanCode(bw, codes + 4, code);
VP8LPutBits(bw, bits, n_bits);
@@ -1464,49 +1460,6 @@ static WebPEncodingError EncodePalette(VP8LBitWriter* const bw, int low_effort,
20 /* quality */, low_effort);
}
-#ifdef WEBP_EXPERIMENTAL_FEATURES
-
-static WebPEncodingError EncodeDeltaPalettePredictorImage(
- VP8LBitWriter* const bw, VP8LEncoder* const enc, int quality,
- int low_effort) {
- const WebPPicture* const pic = enc->pic_;
- const int width = pic->width;
- const int height = pic->height;
-
- const int pred_bits = 5;
- const int transform_width = VP8LSubSampleSize(width, pred_bits);
- const int transform_height = VP8LSubSampleSize(height, pred_bits);
- const int pred = 7; // default is Predictor7 (Top/Left Average)
- const int tiles_per_row = VP8LSubSampleSize(width, pred_bits);
- const int tiles_per_col = VP8LSubSampleSize(height, pred_bits);
- uint32_t* predictors;
- int tile_x, tile_y;
- WebPEncodingError err = VP8_ENC_OK;
-
- predictors = (uint32_t*)WebPSafeMalloc(tiles_per_col * tiles_per_row,
- sizeof(*predictors));
- if (predictors == NULL) return VP8_ENC_ERROR_OUT_OF_MEMORY;
-
- for (tile_y = 0; tile_y < tiles_per_col; ++tile_y) {
- for (tile_x = 0; tile_x < tiles_per_row; ++tile_x) {
- predictors[tile_y * tiles_per_row + tile_x] = 0xff000000u | (pred << 8);
- }
- }
-
- VP8LPutBits(bw, TRANSFORM_PRESENT, 1);
- VP8LPutBits(bw, PREDICTOR_TRANSFORM, 2);
- VP8LPutBits(bw, pred_bits - 2, 3);
- err = EncodeImageNoHuffman(
- bw, predictors, &enc->hash_chain_,
- (VP8LBackwardRefs*)&enc->refs_[0], // cast const away
- (VP8LBackwardRefs*)&enc->refs_[1],
- transform_width, transform_height, quality, low_effort);
- WebPSafeFree(predictors);
- return err;
-}
-
-#endif // WEBP_EXPERIMENTAL_FEATURES
-
// -----------------------------------------------------------------------------
// VP8LEncoder
@@ -1568,7 +1521,7 @@ static int EncodeStreamHook(void* input, void* data2) {
WebPEncodingError err = VP8_ENC_OK;
const int quality = (int)config->quality;
const int low_effort = (config->method == 0);
-#if (WEBP_NEAR_LOSSLESS == 1) || defined(WEBP_EXPERIMENTAL_FEATURES)
+#if (WEBP_NEAR_LOSSLESS == 1)
const int width = picture->width;
#endif
const int height = picture->height;
@@ -1627,29 +1580,6 @@ static int EncodeStreamHook(void* input, void* data2) {
enc->argb_content_ = kEncoderNone;
#endif
-#ifdef WEBP_EXPERIMENTAL_FEATURES
- if (config->use_delta_palette) {
- enc->use_predict_ = 1;
- enc->use_cross_color_ = 0;
- enc->use_subtract_green_ = 0;
- enc->use_palette_ = 1;
- if (enc->argb_content_ != kEncoderNearLossless &&
- enc->argb_content_ != kEncoderPalette) {
- err = MakeInputImageCopy(enc);
- if (err != VP8_ENC_OK) goto Error;
- }
- err = WebPSearchOptimalDeltaPalette(enc);
- if (err != VP8_ENC_OK) goto Error;
- if (enc->use_palette_) {
- err = AllocateTransformBuffer(enc, width, height);
- if (err != VP8_ENC_OK) goto Error;
- err = EncodeDeltaPalettePredictorImage(bw, enc, quality, low_effort);
- if (err != VP8_ENC_OK) goto Error;
- use_delta_palette = 1;
- }
- }
-#endif // WEBP_EXPERIMENTAL_FEATURES
-
// Encode palette
if (enc->use_palette_) {
err = EncodePalette(bw, low_effort, enc);
@@ -1822,7 +1752,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
worker_interface->Init(worker);
worker->data1 = param;
worker->data2 = NULL;
- worker->hook = (WebPWorkerHook)EncodeStreamHook;
+ worker->hook = EncodeStreamHook;
}
}
@@ -1944,7 +1874,6 @@ int VP8LEncodeImage(const WebPConfig* const config,
err = VP8LEncodeStream(config, picture, &bw, 1 /*use_cache*/);
if (err != VP8_ENC_OK) goto Error;
- // TODO(skal): have a fine-grained progress report in VP8LEncodeStream().
if (!WebPReportProgress(picture, 90, &percent)) goto UserAbort;
// Finish the RIFF chunk.
diff --git a/thirdparty/libwebp/src/enc/webp_enc.c b/thirdparty/libwebp/src/enc/webp_enc.c
index 283cda8e7b..9f4b10c26c 100644
--- a/thirdparty/libwebp/src/enc/webp_enc.c
+++ b/thirdparty/libwebp/src/enc/webp_enc.c
@@ -159,12 +159,16 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config,
+ WEBP_ALIGN_CST; // align all
const size_t lf_stats_size =
config->autofilter ? sizeof(*enc->lf_stats_) + WEBP_ALIGN_CST : 0;
+ const size_t top_derr_size =
+ (config->quality <= ERROR_DIFFUSION_QUALITY || config->pass > 1) ?
+ mb_w * sizeof(*enc->top_derr_) : 0;
uint8_t* mem;
const uint64_t size = (uint64_t)sizeof(*enc) // main struct
+ WEBP_ALIGN_CST // cache alignment
+ info_size // modes info
+ preds_size // prediction modes
+ samples_size // top/left samples
+ + top_derr_size // top diffusion error
+ nz_size // coeff context bits
+ lf_stats_size; // autofilter stats
@@ -175,11 +179,12 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config,
" info: %ld\n"
" preds: %ld\n"
" top samples: %ld\n"
+ " top diffusion: %ld\n"
" non-zero: %ld\n"
" lf-stats: %ld\n"
" total: %ld\n",
sizeof(*enc) + WEBP_ALIGN_CST, info_size,
- preds_size, samples_size, nz_size, lf_stats_size, size);
+ preds_size, samples_size, top_derr_size, nz_size, lf_stats_size, size);
printf("Transient object sizes:\n"
" VP8EncIterator: %ld\n"
" VP8ModeScore: %ld\n"
@@ -219,6 +224,8 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config,
enc->y_top_ = mem;
enc->uv_top_ = enc->y_top_ + top_stride;
mem += 2 * top_stride;
+ enc->top_derr_ = top_derr_size ? (DError*)mem : NULL;
+ mem += top_derr_size;
assert(mem <= (uint8_t*)enc + size);
enc->config_ = config;
diff --git a/thirdparty/libwebp/src/mux/muxi.h b/thirdparty/libwebp/src/mux/muxi.h
index b73e3fbd7a..6b57eea30f 100644
--- a/thirdparty/libwebp/src/mux/muxi.h
+++ b/thirdparty/libwebp/src/mux/muxi.h
@@ -26,9 +26,9 @@ extern "C" {
//------------------------------------------------------------------------------
// Defines and constants.
-#define MUX_MAJ_VERSION 0
-#define MUX_MIN_VERSION 4
-#define MUX_REV_VERSION 1
+#define MUX_MAJ_VERSION 1
+#define MUX_MIN_VERSION 0
+#define MUX_REV_VERSION 0
// Chunk object.
typedef struct WebPChunk WebPChunk;
diff --git a/thirdparty/libwebp/src/utils/endian_inl_utils.h b/thirdparty/libwebp/src/utils/endian_inl_utils.h
index 4b2f91dfb8..3630a293bf 100644
--- a/thirdparty/libwebp/src/utils/endian_inl_utils.h
+++ b/thirdparty/libwebp/src/utils/endian_inl_utils.h
@@ -19,13 +19,6 @@
#include "src/dsp/dsp.h"
#include "src/webp/types.h"
-// some endian fix (e.g.: mips-gcc doesn't define __BIG_ENDIAN__)
-#if !defined(WORDS_BIGENDIAN) && \
- (defined(__BIG_ENDIAN__) || defined(_M_PPC) || \
- (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)))
-#define WORDS_BIGENDIAN
-#endif
-
#if defined(WORDS_BIGENDIAN)
#define HToLE32 BSwap32
#define HToLE16 BSwap16
diff --git a/thirdparty/lws/LICENSE.txt b/thirdparty/libwebsockets/LICENSE
index 34a42d5687..6c7cd90cdc 100644
--- a/thirdparty/lws/LICENSE.txt
+++ b/thirdparty/libwebsockets/LICENSE
@@ -33,19 +33,21 @@ to get original sources with the liberal terms.
Original liberal license retained
- - lib/sha-1.c - 3-clause BSD license retained, link to original
+ - lib/misc/sha-1.c - 3-clause BSD license retained, link to original
- win32port/zlib - ZLIB license (see zlib.h)
+ - lib/tls/mbedtls/wrapper - Apache 2.0 (only built if linked against mbedtls)
Relicensed to libwebsocket license
- - lib/base64-decode.c - relicensed to LGPL2.1+SLE, link to original
- - lib/daemonize.c - relicensed from Public Domain to LGPL2.1+SLE,
- link to original Public Domain version
+ - lib/misc/base64-decode.c - relicensed to LGPL2.1+SLE, link to original
+ - lib/misc/daemonize.c - relicensed from Public Domain to LGPL2.1+SLE,
+ link to original Public Domain version
Public Domain (CC-zero) to simplify reuse
- - test-server/*.c
- - test-server/*.h
+ - test-apps/*.c
+ - test-apps/*.h
+ - minimal-examples/*
- lwsws/*
------ end of exceptions
@@ -107,7 +109,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
-
+
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
@@ -163,7 +165,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
-
+
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -210,7 +212,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
-
+
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@@ -268,7 +270,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
-
+
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -319,7 +321,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
-
+
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@@ -381,7 +383,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
-
+
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -422,7 +424,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
-
+
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -474,7 +476,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
-
+
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -508,7 +510,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
-
+
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
@@ -552,4 +554,3 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice
That's all there is to it!
-
diff --git a/thirdparty/lws/alloc.c b/thirdparty/libwebsockets/core/alloc.c
index 898db12464..f169fc3767 100644
--- a/thirdparty/lws/alloc.c
+++ b/thirdparty/libwebsockets/core/alloc.c
@@ -1,4 +1,4 @@
-#include "private-libwebsockets.h"
+#include "core/private.h"
#if defined(LWS_PLAT_OPTEE)
@@ -51,10 +51,12 @@ void lws_set_allocator(void *(*cb)(void *ptr, size_t size, const char *reason))
static void *_realloc(void *ptr, size_t size, const char *reason)
{
if (size) {
-#if defined(LWS_PLAT_ESP32)
- lwsl_notice("%s: size %lu: %s\n", __func__, (unsigned long)size, reason);
+#if defined(LWS_WITH_ESP32)
+ lwsl_notice("%s: size %lu: %s (free heap %d)\n", __func__,
+ (unsigned long)size, reason, (unsigned int)esp_get_free_heap_size() - (int)size);
#else
- lwsl_debug("%s: size %lu: %s\n", __func__, (unsigned long)size, reason);
+ lwsl_debug("%s: size %lu: %s\n", __func__,
+ (unsigned long)size, reason);
#endif
#if defined(LWS_PLAT_OPTEE)
return (void *)TEE_Realloc(ptr, size);
diff --git a/thirdparty/lws/context.c b/thirdparty/libwebsockets/core/context.c
index f67476b1e3..db9151b95f 100644
--- a/thirdparty/lws/context.c
+++ b/thirdparty/libwebsockets/core/context.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,12 +19,41 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
#ifndef LWS_BUILD_HASH
#define LWS_BUILD_HASH "unknown-build-hash"
#endif
+const struct lws_role_ops *available_roles[] = {
+#if defined(LWS_ROLE_H2)
+ &role_ops_h2,
+#endif
+#if defined(LWS_ROLE_H1)
+ &role_ops_h1,
+#endif
+#if defined(LWS_ROLE_WS)
+ &role_ops_ws,
+#endif
+ NULL
+};
+
+const struct lws_event_loop_ops *available_event_libs[] = {
+#if defined(LWS_WITH_POLL)
+ &event_loop_ops_poll,
+#endif
+#if defined(LWS_WITH_LIBUV)
+ &event_loop_ops_uv,
+#endif
+#if defined(LWS_WITH_LIBEVENT)
+ &event_loop_ops_event,
+#endif
+#if defined(LWS_WITH_LIBEV)
+ &event_loop_ops_ev,
+#endif
+ NULL
+};
+
static const char *library_version = LWS_LIBRARY_VERSION " " LWS_BUILD_HASH;
/**
@@ -40,6 +69,23 @@ lws_get_library_version(void)
return library_version;
}
+int
+lws_role_call_alpn_negotiated(struct lws *wsi, const char *alpn)
+{
+#if defined(LWS_WITH_TLS)
+ if (!alpn)
+ return 0;
+
+ lwsl_info("%s: '%s'\n", __func__, alpn);
+
+ LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
+ if (ar->alpn && !strcmp(ar->alpn, alpn) && ar->alpn_negotiated)
+ return ar->alpn_negotiated(wsi, alpn);
+ LWS_FOR_EVERY_AVAILABLE_ROLE_END;
+#endif
+ return 0;
+}
+
static const char * const mount_protocols[] = {
"http://",
"https://",
@@ -50,66 +96,6 @@ static const char * const mount_protocols[] = {
"callback://"
};
-#if defined(LWS_WITH_HTTP2)
-/*
- * These are the standardized defaults.
- * Override what actually goes in the vhost settings in platform or user code.
- * Leave these alone because they are used to determine "what is different
- * from the protocol defaults".
- */
-const struct http2_settings lws_h2_defaults = { {
- 1,
- /* H2SET_HEADER_TABLE_SIZE */ 4096,
- /* *** This controls how many entries in the dynamic table ***
- * Allows the sender to inform the remote endpoint of the maximum
- * size of the header compression table used to decode header
- * blocks, in octets. The encoder can select any size equal to or
- * less than this value by using signaling specific to the header
- * compression format inside a header block (see [COMPRESSION]).
- * The initial value is 4,096 octets.
- */
- /* H2SET_ENABLE_PUSH */ 1,
- /* H2SET_MAX_CONCURRENT_STREAMS */ 0x7fffffff,
- /* H2SET_INITIAL_WINDOW_SIZE */ 65535,
- /* H2SET_MAX_FRAME_SIZE */ 16384,
- /* H2SET_MAX_HEADER_LIST_SIZE */ 0x7fffffff,
- /*< This advisory setting informs a peer of the maximum size of
- * header list that the sender is prepared to accept, in octets.
- * The value is based on the uncompressed size of header fields,
- * including the length of the name and value in octets plus an
- * overhead of 32 octets for each header field.
- */
-
-}};
-
-const struct http2_settings lws_h2_stock_settings = { {
- 1,
- /* H2SET_HEADER_TABLE_SIZE */ 4096,
- /* *** This controls how many entries in the dynamic table ***
- * Allows the sender to inform the remote endpoint of the maximum
- * size of the header compression table used to decode header
- * blocks, in octets. The encoder can select any size equal to or
- * less than this value by using signaling specific to the header
- * compression format inside a header block (see [COMPRESSION]).
- * The initial value is 4,096 octets.
- *
- * Can't pass h2spec with less than 4096 here...
- */
- /* H2SET_ENABLE_PUSH */ 1,
- /* H2SET_MAX_CONCURRENT_STREAMS */ 24,
- /* H2SET_INITIAL_WINDOW_SIZE */ 65535,
- /* H2SET_MAX_FRAME_SIZE */ 16384,
- /* H2SET_MAX_HEADER_LIST_SIZE */ 4096,
- /*< This advisory setting informs a peer of the maximum size of
- * header list that the sender is prepared to accept, in octets.
- * The value is based on the uncompressed size of header fields,
- * including the length of the name and value in octets plus an
- * overhead of 32 octets for each header field.
- */
-
-}};
-#endif
-
LWS_VISIBLE void *
lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost,
const struct lws_protocols *prot, int size)
@@ -119,7 +105,8 @@ lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost,
/* allocate the vh priv array only on demand */
if (!vhost->protocol_vh_privs) {
vhost->protocol_vh_privs = (void **)lws_zalloc(
- vhost->count_protocols * sizeof(void *), "protocol_vh_privs");
+ vhost->count_protocols * sizeof(void *),
+ "protocol_vh_privs");
if (!vhost->protocol_vh_privs)
return NULL;
}
@@ -195,7 +182,7 @@ lws_protocol_init(struct lws_context *context)
struct lws_vhost *vh = context->vhost_list;
const struct lws_protocol_vhost_options *pvo, *pvo1;
struct lws wsi;
- int n;
+ int n, any = 0;
if (context->doing_protocol_init)
return 0;
@@ -211,7 +198,8 @@ lws_protocol_init(struct lws_context *context)
wsi.vhost = vh;
/* only do the protocol init once for a given vhost */
- if (vh->created_vhost_protocols)
+ if (vh->created_vhost_protocols ||
+ (vh->options & LWS_SERVER_OPTION_SKIP_PROTOCOL_INIT))
goto next;
/* initialize supported protocols on this vhost */
@@ -231,21 +219,23 @@ lws_protocol_init(struct lws_context *context)
pvo = pvo1->options;
while (pvo) {
- lwsl_notice(
- " vhost \"%s\", protocol \"%s\", option \"%s\"\n",
+ lwsl_debug(
+ " vhost \"%s\", "
+ "protocol \"%s\", "
+ "option \"%s\"\n",
vh->name,
vh->protocols[n].name,
pvo->name);
if (!strcmp(pvo->name, "default")) {
- lwsl_notice("Setting default "
+ lwsl_info("Setting default "
"protocol for vh %s to %s\n",
vh->name,
vh->protocols[n].name);
vh->default_protocol_index = n;
}
if (!strcmp(pvo->name, "raw")) {
- lwsl_notice("Setting raw "
+ lwsl_info("Setting raw "
"protocol for vh %s to %s\n",
vh->name,
vh->protocols[n].name);
@@ -257,6 +247,10 @@ lws_protocol_init(struct lws_context *context)
pvo = pvo1->options;
}
+#if defined(LWS_WITH_TLS)
+ any |= !!vh->tls.ssl_ctx;
+#endif
+
/*
* inform all the protocols that they are doing their
* one-time initialization if they want to.
@@ -267,10 +261,10 @@ lws_protocol_init(struct lws_context *context)
if (vh->protocols[n].callback(&wsi,
LWS_CALLBACK_PROTOCOL_INIT, NULL,
(void *)pvo, 0)) {
- lwsl_err("%s: vhost %s failed init\n", __func__,
+ lws_free(vh->protocol_vh_privs[n]);
+ vh->protocol_vh_privs[n] = NULL;
+ lwsl_err("%s: protocol %s failed init\n", __func__,
vh->protocols[n].name);
- context->doing_protocol_init = 0;
- return 1;
}
}
@@ -286,6 +280,9 @@ next:
context->protocol_init_done = 1;
+ if (any)
+ lws_tls_check_all_cert_lifetimes(context);
+
return 0;
}
@@ -303,6 +300,7 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
#endif
switch (reason) {
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
case LWS_CALLBACK_HTTP:
#ifndef LWS_NO_SERVER
if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL))
@@ -325,14 +323,16 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
LWS_CB_REASON_AUX_BF__CGI)) {
n = lws_cgi_write_split_stdout_headers(wsi);
if (n < 0) {
- lwsl_debug("LWS_CB_REASON_AUX_BF__CGI forcing close\n");
+ lwsl_debug("AUX_BF__CGI forcing close\n");
return -1;
}
if (!n)
- lws_rx_flow_control(wsi->cgi->stdwsi[LWS_STDOUT], 1);
+ lws_rx_flow_control(
+ wsi->http.cgi->stdwsi[LWS_STDOUT], 1);
if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_HEADERS)
- wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__CGI_HEADERS;
+ wsi->reason_bf &=
+ ~LWS_CB_REASON_AUX_BF__CGI_HEADERS;
else
wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__CGI;
break;
@@ -341,12 +341,13 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_CHUNK_END) {
if (!wsi->http2_substream) {
memcpy(buf + LWS_PRE, "0\x0d\x0a\x0d\x0a", 5);
- lwsl_debug("writing chunk terminator and exiting\n");
- n = lws_write(wsi, (unsigned char *)buf + LWS_PRE,
- 5, LWS_WRITE_HTTP);
+ lwsl_debug("writing chunk term and exiting\n");
+ n = lws_write(wsi, (unsigned char *)buf +
+ LWS_PRE, 5, LWS_WRITE_HTTP);
} else
- n = lws_write(wsi, (unsigned char *)buf + LWS_PRE,
- 0, LWS_WRITE_HTTP_FINAL);
+ n = lws_write(wsi, (unsigned char *)buf +
+ LWS_PRE, 0,
+ LWS_WRITE_HTTP_FINAL);
/* always close after sending it */
return -1;
@@ -366,7 +367,8 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__PROXY;
if (!lws_get_child(wsi))
break;
- if (lws_http_client_read(lws_get_child(wsi), &px, &lenx) < 0)
+ if (lws_http_client_read(lws_get_child(wsi), &px,
+ &lenx) < 0)
return -1;
break;
}
@@ -467,10 +469,10 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
case LWS_CALLBACK_CGI_TERMINATED:
lwsl_debug("LWS_CALLBACK_CGI_TERMINATED: %d %" PRIu64 "\n",
- wsi->cgi->explicitly_chunked,
- (uint64_t)wsi->cgi->content_length);
- if (!wsi->cgi->explicitly_chunked &&
- !wsi->cgi->content_length) {
+ wsi->http.cgi->explicitly_chunked,
+ (uint64_t)wsi->http.cgi->content_length);
+ if (!wsi->http.cgi->explicitly_chunked &&
+ !wsi->http.cgi->content_length) {
/* send terminating chunk */
lwsl_debug("LWS_CALLBACK_CGI_TERMINATED: ending\n");
wsi->reason_bf |= LWS_CB_REASON_AUX_BF__CGI_CHUNK_END;
@@ -492,7 +494,7 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
"sent %d only %d went", n, args->len);
return n;
#endif
-
+#endif
case LWS_CALLBACK_SSL_INFO:
si = in;
@@ -514,11 +516,13 @@ static const struct lws_protocols protocols_dummy[] = {
/* first protocol must always be HTTP handler */
{
- "http-only", /* name */
- lws_callback_http_dummy, /* callback */
- 0, /* per_session_data_size */
- 0, /* max frame size / rx buffer */
- 0, NULL, 0
+ "http-only", /* name */
+ lws_callback_http_dummy, /* callback */
+ 0, /* per_session_data_size */
+ 0, /* rx_buffer_size */
+ 0, /* id */
+ NULL, /* user */
+ 0 /* tx_packet_size */
},
/*
* the other protocols are provided by lws plugins
@@ -530,20 +534,25 @@ static const struct lws_protocols protocols_dummy[] = {
#undef LWS_HAVE_GETENV
#endif
+static void
+lws_vhost_destroy2(struct lws_vhost *vh);
+
LWS_VISIBLE struct lws_vhost *
lws_create_vhost(struct lws_context *context,
- struct lws_context_creation_info *info)
+ const struct lws_context_creation_info *info)
{
struct lws_vhost *vh = lws_zalloc(sizeof(*vh), "create vhost"),
**vh1 = &context->vhost_list;
const struct lws_http_mount *mounts;
+ const struct lws_protocols *pcols = info->protocols;
const struct lws_protocol_vhost_options *pvo;
#ifdef LWS_WITH_PLUGINS
struct lws_plugin *plugin = context->plugin_list;
#endif
struct lws_protocols *lwsp;
int m, f = !info->pvo;
-#ifdef LWS_HAVE_GETENV
+ char buf[20];
+#if !defined(LWS_WITHOUT_CLIENT) && defined(LWS_HAVE_GETENV)
char *p;
#endif
int n;
@@ -551,8 +560,12 @@ lws_create_vhost(struct lws_context *context,
if (!vh)
return NULL;
- if (!info->protocols)
- info->protocols = &protocols_dummy[0];
+#if LWS_MAX_SMP > 1
+ pthread_mutex_init(&vh->lock, NULL);
+#endif
+
+ if (!pcols)
+ pcols = &protocols_dummy[0];
vh->context = context;
if (!info->vhost_name)
@@ -560,23 +573,21 @@ lws_create_vhost(struct lws_context *context,
else
vh->name = info->vhost_name;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ vh->http.error_document_404 = info->error_document_404;
+#endif
+
if (info->options & LWS_SERVER_OPTION_ONLY_RAW)
lwsl_info("%s set to only support RAW\n", vh->name);
-#if defined(LWS_WITH_HTTP2)
- vh->set = context->set;
- if (info->http2_settings[0])
- for (n = 1; n < LWS_H2_SETTINGS_LEN; n++)
- vh->set.s[n] = info->http2_settings[n];
-#endif
-
vh->iface = info->iface;
-#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32) && !defined(OPTEE_TA) && !defined(WIN32)
+#if !defined(LWS_WITH_ESP32) && \
+ !defined(OPTEE_TA) && !defined(WIN32)
vh->bind_iface = info->bind_iface;
#endif
for (vh->count_protocols = 0;
- info->protocols[vh->count_protocols].callback;
+ pcols[vh->count_protocols].callback;
vh->count_protocols++)
;
@@ -584,7 +595,14 @@ lws_create_vhost(struct lws_context *context,
vh->pvo = info->pvo;
vh->headers = info->headers;
vh->user = info->user;
- vh->ssl_info_event_mask = info->ssl_info_event_mask;
+
+ LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
+ if (ar->init_vhost)
+ if (ar->init_vhost(vh, info))
+ return NULL;
+ LWS_FOR_EVERY_AVAILABLE_ROLE_END;
+
+
if (info->keepalive_timeout)
vh->keepalive_timeout = info->keepalive_timeout;
else
@@ -595,20 +613,49 @@ lws_create_vhost(struct lws_context *context,
else
vh->timeout_secs_ah_idle = 10;
+#if defined(LWS_WITH_TLS)
+
+ vh->tls.alpn = info->alpn;
+ vh->tls.ssl_info_event_mask = info->ssl_info_event_mask;
+
+ if (info->ecdh_curve)
+ lws_strncpy(vh->tls.ecdh_curve, info->ecdh_curve,
+ sizeof(vh->tls.ecdh_curve));
+
+ /* carefully allocate and take a copy of cert + key paths if present */
+ n = 0;
+ if (info->ssl_cert_filepath)
+ n += (int)strlen(info->ssl_cert_filepath) + 1;
+ if (info->ssl_private_key_filepath)
+ n += (int)strlen(info->ssl_private_key_filepath) + 1;
+
+ if (n) {
+ vh->tls.key_path = vh->tls.alloc_cert_path = lws_malloc(n, "vh paths");
+ if (info->ssl_cert_filepath) {
+ n = (int)strlen(info->ssl_cert_filepath) + 1;
+ memcpy(vh->tls.alloc_cert_path, info->ssl_cert_filepath, n);
+ vh->tls.key_path += n;
+ }
+ if (info->ssl_private_key_filepath)
+ memcpy(vh->tls.key_path, info->ssl_private_key_filepath,
+ strlen(info->ssl_private_key_filepath) + 1);
+ }
+#endif
+
/*
* give the vhost a unified list of protocols including the
* ones that came from plugins
*/
- lwsp = lws_zalloc(sizeof(struct lws_protocols) *
- (vh->count_protocols +
- context->plugin_protocol_count + 1), "vhost-specific plugin table");
+ lwsp = lws_zalloc(sizeof(struct lws_protocols) * (vh->count_protocols +
+ context->plugin_protocol_count + 1),
+ "vhost-specific plugin table");
if (!lwsp) {
lwsl_err("OOM\n");
return NULL;
}
m = vh->count_protocols;
- memcpy(lwsp, info->protocols, sizeof(struct lws_protocols) * m);
+ memcpy(lwsp, pcols, sizeof(struct lws_protocols) * m);
/* for compatibility, all protocols enabled on vhost if only
* the default vhost exists. Otherwise only vhosts who ask
@@ -648,43 +695,58 @@ lws_create_vhost(struct lws_context *context,
context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS)
vh->protocols = lwsp;
else {
- vh->protocols = info->protocols;
+ vh->protocols = pcols;
lws_free(lwsp);
}
vh->same_vh_protocol_list = (struct lws **)
- lws_zalloc(sizeof(struct lws *) * vh->count_protocols, "same vh list");
-
- vh->mount_list = info->mounts;
+ lws_zalloc(sizeof(struct lws *) * vh->count_protocols,
+ "same vh list");
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ vh->http.mount_list = info->mounts;
+#endif
#ifdef LWS_WITH_UNIX_SOCK
if (LWS_UNIX_SOCK_ENABLED(context)) {
lwsl_notice("Creating Vhost '%s' path \"%s\", %d protocols\n",
- vh->name, info->iface, vh->count_protocols);
+ vh->name, vh->iface, vh->count_protocols);
} else
#endif
- lwsl_notice("Creating Vhost '%s' port %d, %d protocols, IPv6 %s\n",
- vh->name, info->port, vh->count_protocols,
- LWS_IPV6_ENABLED(vh) ? "on" : "off");
-
+ {
+ switch(info->port) {
+ case CONTEXT_PORT_NO_LISTEN:
+ strcpy(buf, "(serving disabled)");
+ break;
+ case CONTEXT_PORT_NO_LISTEN_SERVER:
+ strcpy(buf, "(no listener)");
+ break;
+ default:
+ lws_snprintf(buf, sizeof(buf), "port %u", info->port);
+ break;
+ }
+ lwsl_notice("Creating Vhost '%s' %s, %d protocols, IPv6 %s\n",
+ vh->name, buf, vh->count_protocols,
+ LWS_IPV6_ENABLED(vh) ? "on" : "off");
+ }
mounts = info->mounts;
while (mounts) {
(void)mount_protocols[0];
- lwsl_notice(" mounting %s%s to %s\n",
- mount_protocols[mounts->origin_protocol],
- mounts->origin, mounts->mountpoint);
+ lwsl_info(" mounting %s%s to %s\n",
+ mount_protocols[mounts->origin_protocol],
+ mounts->origin, mounts->mountpoint);
/* convert interpreter protocol names to pointers */
pvo = mounts->interpret;
while (pvo) {
- for (n = 0; n < vh->count_protocols; n++)
- if (!strcmp(pvo->value, vh->protocols[n].name)) {
- ((struct lws_protocol_vhost_options *)pvo)->value =
- (const char *)(lws_intptr_t)n;
- break;
- }
+ for (n = 0; n < vh->count_protocols; n++) {
+ if (strcmp(pvo->value, vh->protocols[n].name))
+ continue;
+ ((struct lws_protocol_vhost_options *)pvo)->
+ value = (const char *)(lws_intptr_t)n;
+ break;
+ }
if (n == vh->count_protocols)
- lwsl_err("ignoring unknown interpret protocol %s\n",
+ lwsl_err("ignoring unknown interp pr %s\n",
pvo->value);
pvo = pvo->next;
}
@@ -692,64 +754,35 @@ lws_create_vhost(struct lws_context *context,
mounts = mounts->mount_next;
}
-#ifndef LWS_NO_EXTENSIONS
-#ifdef LWS_WITH_PLUGINS
- if (context->plugin_extension_count) {
-
- m = 0;
- while (info->extensions && info->extensions[m].callback)
- m++;
-
- /*
- * give the vhost a unified list of extensions including the
- * ones that came from plugins
- */
- vh->extensions = lws_zalloc(sizeof(struct lws_extension) *
- (m +
- context->plugin_extension_count + 1), "extensions");
- if (!vh->extensions)
- return NULL;
-
- memcpy((struct lws_extension *)vh->extensions, info->extensions,
- sizeof(struct lws_extension) * m);
- plugin = context->plugin_list;
- while (plugin) {
- memcpy((struct lws_extension *)&vh->extensions[m],
- plugin->caps.extensions,
- sizeof(struct lws_extension) *
- plugin->caps.count_extensions);
- m += plugin->caps.count_extensions;
- plugin = plugin->list;
- }
- } else
-#endif
- vh->extensions = info->extensions;
-#endif
-
vh->listen_port = info->port;
-#if !defined(LWS_WITH_ESP8266)
- vh->http_proxy_port = 0;
- vh->http_proxy_address[0] = '\0';
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ vh->http.http_proxy_port = 0;
+ vh->http.http_proxy_address[0] = '\0';
+#endif
#if defined(LWS_WITH_SOCKS5)
vh->socks_proxy_port = 0;
vh->socks_proxy_address[0] = '\0';
#endif
+#if !defined(LWS_WITHOUT_CLIENT)
/* either use proxy from info, or try get it from env var */
-
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
/* http proxy */
if (info->http_proxy_address) {
/* override for backwards compatibility */
if (info->http_proxy_port)
- vh->http_proxy_port = info->http_proxy_port;
+ vh->http.http_proxy_port = info->http_proxy_port;
lws_set_proxy(vh, info->http_proxy_address);
- } else {
+ } else
+#endif
+ {
#ifdef LWS_HAVE_GETENV
p = getenv("http_proxy");
if (p)
lws_set_proxy(vh, p);
#endif
}
+#endif
#if defined(LWS_WITH_SOCKS5)
/* socks proxy */
if (info->socks_proxy_address) {
@@ -765,7 +798,6 @@ lws_create_vhost(struct lws_context *context,
#endif
}
#endif
-#endif
vh->ka_time = info->ka_time;
vh->ka_interval = info->ka_interval;
@@ -793,15 +825,23 @@ lws_create_vhost(struct lws_context *context,
} else
vh->log_fd = (int)LWS_INVALID_FILE;
#endif
- if (lws_context_init_server_ssl(info, vh))
- goto bail;
- if (lws_context_init_client_ssl(info, vh))
- goto bail;
- if (lws_context_init_server(info, vh)) {
+ if (lws_context_init_server_ssl(info, vh)) {
+ lwsl_err("%s: lws_context_init_server_ssl failed\n", __func__);
+ goto bail1;
+ }
+ if (lws_context_init_client_ssl(info, vh)) {
+ lwsl_err("%s: lws_context_init_client_ssl failed\n", __func__);
+ goto bail1;
+ }
+ lws_context_lock(context);
+ n = _lws_vhost_init_server(info, vh);
+ lws_context_unlock(context);
+ if (n < 0) {
lwsl_err("init server failed\n");
- goto bail;
+ goto bail1;
}
+
while (1) {
if (!(*vh1)) {
*vh1 = vh;
@@ -809,15 +849,27 @@ lws_create_vhost(struct lws_context *context,
}
vh1 = &(*vh1)->vhost_next;
};
+
/* for the case we are adding a vhost much later, after server init */
if (context->protocol_init_done)
- lws_protocol_init(context);
+ if (lws_protocol_init(context)) {
+ lwsl_err("%s: lws_protocol_init failed\n", __func__);
+ goto bail1;
+ }
return vh;
+bail1:
+ lws_vhost_destroy(vh);
+ lws_vhost_destroy2(vh);
+
+ return NULL;
+
+#ifdef LWS_WITH_ACCESS_LOG
bail:
lws_free(vh);
+#endif
return NULL;
}
@@ -834,8 +886,100 @@ lws_init_vhost_client_ssl(const struct lws_context_creation_info *info,
return lws_context_init_client_ssl(&i, vhost);
}
+LWS_VISIBLE void
+lws_cancel_service_pt(struct lws *wsi)
+{
+ lws_plat_pipe_signal(wsi);
+}
+
+LWS_VISIBLE void
+lws_cancel_service(struct lws_context *context)
+{
+ struct lws_context_per_thread *pt = &context->pt[0];
+ short m = context->count_threads;
+
+ if (context->being_destroyed1)
+ return;
+
+ lwsl_info("%s\n", __func__);
+
+ while (m--) {
+ if (pt->pipe_wsi)
+ lws_plat_pipe_signal(pt->pipe_wsi);
+ pt++;
+ }
+}
+
+int
+lws_create_event_pipes(struct lws_context *context)
+{
+ struct lws *wsi;
+ int n;
+
+ /*
+ * Create the pt event pipes... these are unique in that they are
+ * not bound to a vhost or protocol (both are NULL)
+ */
+
+ for (n = 0; n < context->count_threads; n++) {
+ if (context->pt[n].pipe_wsi)
+ continue;
+
+ wsi = lws_zalloc(sizeof(*wsi), "event pipe wsi");
+ if (!wsi) {
+ lwsl_err("Out of mem\n");
+ return 1;
+ }
+ wsi->context = context;
+ lws_role_transition(wsi, 0, LRS_UNCONNECTED, &role_ops_pipe);
+ wsi->protocol = NULL;
+ wsi->tsi = n;
+ wsi->vhost = NULL;
+ wsi->event_pipe = 1;
+
+ if (lws_plat_pipe_create(wsi)) {
+ lws_free(wsi);
+ continue;
+ }
+ wsi->desc.sockfd = context->pt[n].dummy_pipe_fds[0];
+ lwsl_debug("event pipe fd %d\n", wsi->desc.sockfd);
+
+ context->pt[n].pipe_wsi = wsi;
+
+ if (context->event_loop_ops->accept)
+ context->event_loop_ops->accept(wsi);
+
+ if (__insert_wsi_socket_into_fds(context, wsi))
+ return 1;
+
+ //lws_change_pollfd(context->pt[n].pipe_wsi, 0, LWS_POLLIN);
+ context->count_wsi_allocated++;
+ }
+
+ return 0;
+}
+
+void
+lws_destroy_event_pipe(struct lws *wsi)
+{
+ lwsl_info("%s\n", __func__);
+ __remove_wsi_socket_from_fds(wsi);
+
+ if (wsi->context->event_loop_ops->wsi_logical_close) {
+ wsi->context->event_loop_ops->wsi_logical_close(wsi);
+ lws_plat_pipe_close(wsi);
+ return;
+ }
+
+ if (wsi->context->event_loop_ops->destroy_wsi)
+ wsi->context->event_loop_ops->destroy_wsi(wsi);
+ lws_plat_pipe_close(wsi);
+ wsi->context->count_wsi_allocated--;
+ lws_free(wsi);
+}
+
LWS_VISIBLE struct lws_context *
-lws_create_context(struct lws_context_creation_info *info)
+lws_create_context(const struct lws_context_creation_info *info)
{
struct lws_context *context = NULL;
struct lws_plat_file_ops *prev;
@@ -847,12 +991,14 @@ lws_create_context(struct lws_context_creation_info *info)
struct rlimit rt;
#endif
+
+
lwsl_info("Initial logging level %d\n", log_level);
lwsl_info("Libwebsockets version: %s\n", library_version);
#if defined(GCC_VER)
lwsl_info("Compiled with %s\n", GCC_VER);
#endif
-#if LWS_POSIX
+
#ifdef LWS_WITH_IPV6
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DISABLE_IPV6))
lwsl_info("IPV6 compiled in and enabled\n");
@@ -861,11 +1007,7 @@ lws_create_context(struct lws_context_creation_info *info)
#else
lwsl_info("IPV6 not compiled in\n");
#endif
-#if !defined(LWS_PLAT_OPTEE) && !defined(LWS_PLAT_ESP32)
- lws_feature_status_libev(info);
- lws_feature_status_libuv(info);
-#endif
-#endif
+
lwsl_info(" LWS_DEF_HEADER_LEN : %u\n", LWS_DEF_HEADER_LEN);
lwsl_info(" LWS_MAX_PROTOCOLS : %u\n", LWS_MAX_PROTOCOLS);
lwsl_info(" LWS_MAX_SMP : %u\n", LWS_MAX_SMP);
@@ -873,13 +1015,11 @@ lws_create_context(struct lws_context_creation_info *info)
#if defined(LWS_WITH_STATS)
lwsl_info(" LWS_WITH_STATS : on\n");
#endif
-#if LWS_POSIX
lwsl_info(" SYSTEM_RANDOM_FILEPATH: '%s'\n", SYSTEM_RANDOM_FILEPATH);
-#endif
#if defined(LWS_WITH_HTTP2)
lwsl_info(" HTTP2 support : available\n");
#else
- lwsl_info(" HTTP2 support : not configured");
+ lwsl_info(" HTTP2 support : not configured\n");
#endif
if (lws_plat_context_early_init())
return NULL;
@@ -889,13 +1029,22 @@ lws_create_context(struct lws_context_creation_info *info)
lwsl_err("No memory for websocket context\n");
return NULL;
}
+
+#if defined(LWS_WITH_TLS)
+#if defined(LWS_WITH_MBEDTLS)
+ context->tls_ops = &tls_ops_mbedtls;
+#else
+ context->tls_ops = &tls_ops_openssl;
+#endif
+#endif
+
if (info->pt_serv_buf_size)
context->pt_serv_buf_size = info->pt_serv_buf_size;
else
context->pt_serv_buf_size = 4096;
-#if defined(LWS_WITH_HTTP2)
- context->set = lws_h2_stock_settings;
+#if defined(LWS_ROLE_H2)
+ role_ops_h2.init_context(context, info);
#endif
#if LWS_MAX_SMP > 1
@@ -943,8 +1092,10 @@ lws_create_context(struct lws_context_creation_info *info)
info->external_baggage_free_on_destroy;
context->time_up = time(NULL);
+ context->pcontext_finalize = info->pcontext;
- context->simultaneous_ssl_restriction = info->simultaneous_ssl_restriction;
+ context->simultaneous_ssl_restriction =
+ info->simultaneous_ssl_restriction;
#ifndef LWS_NO_DAEMONIZE
if (pid_daemon) {
@@ -975,6 +1126,67 @@ lws_create_context(struct lws_context_creation_info *info)
context->options = info->options;
+ /*
+ * set the context event loops ops struct
+ *
+ * after this, all event_loop actions use the generic ops
+ */
+
+#if defined(LWS_WITH_POLL)
+ context->event_loop_ops = &event_loop_ops_poll;
+#endif
+
+ if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV))
+#if defined(LWS_WITH_LIBUV)
+ context->event_loop_ops = &event_loop_ops_uv;
+#else
+ goto fail_event_libs;
+#endif
+
+ if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBEV))
+#if defined(LWS_WITH_LIBEV)
+ context->event_loop_ops = &event_loop_ops_ev;
+#else
+ goto fail_event_libs;
+#endif
+
+ if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBEVENT))
+#if defined(LWS_WITH_LIBEVENT)
+ context->event_loop_ops = &event_loop_ops_event;
+#else
+ goto fail_event_libs;
+#endif
+
+ if (!context->event_loop_ops)
+ goto fail_event_libs;
+
+ lwsl_info("Using event loop: %s\n", context->event_loop_ops->name);
+
+#if defined(LWS_WITH_TLS)
+ time(&context->tls.last_cert_check_s);
+ if (info->alpn)
+ context->tls.alpn_default = info->alpn;
+ else {
+ char *p = context->tls.alpn_discovered, first = 1;
+
+ LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar) {
+ if (ar->alpn) {
+ if (!first)
+ *p++ = ',';
+ p += lws_snprintf(p,
+ context->tls.alpn_discovered +
+ sizeof(context->tls.alpn_discovered) -
+ 2 - p, "%s", ar->alpn);
+ first = 0;
+ }
+ } LWS_FOR_EVERY_AVAILABLE_ROLE_END;
+
+ context->tls.alpn_default = context->tls.alpn_discovered;
+ }
+
+ lwsl_info("Default ALPN advertisment: %s\n", context->tls.alpn_default);
+#endif
+
if (info->timeout_secs)
context->timeout_secs = info->timeout_secs;
else
@@ -992,10 +1204,17 @@ lws_create_context(struct lws_context_creation_info *info)
info->max_http_header_data2;
else
context->max_http_header_data = LWS_DEF_HEADER_LEN;
+
if (info->max_http_header_pool)
context->max_http_header_pool = info->max_http_header_pool;
else
- context->max_http_header_pool = LWS_DEF_HEADER_POOL;
+ context->max_http_header_pool = context->max_fds;
+
+ if (info->fd_limit_per_thread)
+ context->fd_limit_per_thread = info->fd_limit_per_thread;
+ else
+ context->fd_limit_per_thread = context->max_fds /
+ context->count_threads;
/*
* Allocate the per-thread storage for scratchpad buffers,
@@ -1009,22 +1228,16 @@ lws_create_context(struct lws_context_creation_info *info)
return NULL;
}
-#ifdef LWS_WITH_LIBUV
context->pt[n].context = context;
-#endif
context->pt[n].tid = n;
- context->pt[n].ah_list = NULL;
- context->pt[n].ah_pool_length = 0;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ context->pt[n].http.ah_list = NULL;
+ context->pt[n].http.ah_pool_length = 0;
+#endif
lws_pt_mutex_init(&context->pt[n]);
}
- if (info->fd_limit_per_thread)
- context->fd_limit_per_thread = info->fd_limit_per_thread;
- else
- context->fd_limit_per_thread = context->max_fds /
- context->count_threads;
-
lwsl_info(" Threads: %d each %d fds\n", context->count_threads,
context->fd_limit_per_thread);
@@ -1033,36 +1246,6 @@ lws_create_context(struct lws_context_creation_info *info)
return NULL;
}
-#ifdef LWS_WITH_LIBEV
- /* (Issue #264) In order to *avoid breaking backwards compatibility*, we
- * enable libev mediated SIGINT handling with a default handler of
- * lws_sigint_cb. The handler can be overridden or disabled
- * by invoking lws_sigint_cfg after creating the context, but
- * before invoking lws_initloop:
- */
- context->use_ev_sigint = 1;
- context->lws_ev_sigint_cb = &lws_ev_sigint_cb;
-#endif /* LWS_WITH_LIBEV */
-#ifdef LWS_WITH_LIBUV
- /* (Issue #264) In order to *avoid breaking backwards compatibility*, we
- * enable libev mediated SIGINT handling with a default handler of
- * lws_sigint_cb. The handler can be overridden or disabled
- * by invoking lws_sigint_cfg after creating the context, but
- * before invoking lws_initloop:
- */
- context->use_ev_sigint = 1;
- context->lws_uv_sigint_cb = &lws_uv_sigint_cb;
-#endif
-#ifdef LWS_WITH_LIBEVENT
- /* (Issue #264) In order to *avoid breaking backwards compatibility*, we
- * enable libev mediated SIGINT handling with a default handler of
- * lws_sigint_cb. The handler can be overridden or disabled
- * by invoking lws_sigint_cfg after creating the context, but
- * before invoking lws_initloop:
- */
- context->use_ev_sigint = 1;
- context->lws_event_sigint_cb = &lws_event_sigint_cb;
-#endif /* LWS_WITH_LIBEVENT */
#if defined(LWS_WITH_PEER_LIMITS)
/* scale the peer hash table according to the max fds for the process,
@@ -1077,14 +1260,14 @@ lws_create_context(struct lws_context_creation_info *info)
context->ip_limit_wsi = info->ip_limit_wsi;
#endif
- lwsl_info(" mem: context: %5lu bytes (%ld ctx + (%ld thr x %d))\n",
+ lwsl_info(" mem: context: %5lu B (%ld ctx + (%ld thr x %d))\n",
(long)sizeof(struct lws_context) +
(context->count_threads * context->pt_serv_buf_size),
(long)sizeof(struct lws_context),
(long)context->count_threads,
context->pt_serv_buf_size);
-
- lwsl_info(" mem: http hdr rsvd: %5lu bytes (%u thr x (%u + %lu) x %u))\n",
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ lwsl_info(" mem: http hdr rsvd: %5lu B (%u thr x (%u + %lu) x %u))\n",
(long)(context->max_http_header_data +
sizeof(struct allocated_headers)) *
context->max_http_header_pool * context->count_threads,
@@ -1092,6 +1275,7 @@ lws_create_context(struct lws_context_creation_info *info)
context->max_http_header_data,
(long)sizeof(struct allocated_headers),
context->max_http_header_pool);
+#endif
n = sizeof(struct lws_pollfd) * context->count_threads *
context->fd_limit_per_thread;
context->pt[0].fds = lws_zalloc(n, "fds table");
@@ -1117,14 +1301,24 @@ lws_create_context(struct lws_context_creation_info *info)
if (lws_plat_init(context, info))
goto bail;
-#if defined(LWS_WITH_HTTP2)
- /*
- * let the user code see what the platform default SETTINGS were, he
- * can modify them when he creates the vhosts.
- */
- for (n = 1; n < LWS_H2_SETTINGS_LEN; n++)
- info->http2_settings[n] = context->set.s[n];
-#endif
+ if (context->event_loop_ops->init_context)
+ if (context->event_loop_ops->init_context(context, info))
+ goto bail;
+
+
+ if (context->event_loop_ops->init_pt)
+ for (n = 0; n < context->count_threads; n++) {
+ void *lp = NULL;
+
+ if (info->foreign_loops)
+ lp = info->foreign_loops[n];
+
+ if (context->event_loop_ops->init_pt(context, lp, n))
+ goto bail;
+ }
+
+ if (lws_create_event_pipes(context))
+ goto bail;
lws_context_init_ssl_library(info);
@@ -1137,6 +1331,14 @@ lws_create_context(struct lws_context_creation_info *info)
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_EXPLICIT_VHOSTS))
if (!lws_create_vhost(context, info)) {
lwsl_err("Failed to create default vhost\n");
+ for (n = 0; n < context->count_threads; n++)
+ lws_free_set_NULL(context->pt[n].serv_buf);
+#if defined(LWS_WITH_PEER_LIMITS)
+ lws_free_set_NULL(context->pl_hash_table);
+#endif
+ lws_free_set_NULL(context->pt[0].fds);
+ lws_plat_context_late_destroy(context);
+ lws_free_set_NULL(context);
return NULL;
}
@@ -1164,23 +1366,32 @@ lws_create_context(struct lws_context_creation_info *info)
if (!lws_check_opt(info->options, LWS_SERVER_OPTION_EXPLICIT_VHOSTS))
lws_plat_drop_app_privileges(info);
- /*
- * give all extensions a chance to create any per-context
- * allocations they need
- */
- if (info->port != CONTEXT_PORT_NO_LISTEN) {
- if (lws_ext_cb_all_exts(context, NULL,
- LWS_EXT_CB_SERVER_CONTEXT_CONSTRUCT, NULL, 0) < 0)
- goto bail;
- } else
- if (lws_ext_cb_all_exts(context, NULL,
- LWS_EXT_CB_CLIENT_CONTEXT_CONSTRUCT, NULL, 0) < 0)
- goto bail;
+ /* expedite post-context init (eg, protocols) */
+ lws_cancel_service(context);
+
+#if defined(LWS_WITH_SELFTESTS)
+ lws_jws_selftest();
+#endif
return context;
bail:
lws_context_destroy(context);
+
+ return NULL;
+
+fail_event_libs:
+ lwsl_err("Requested event library support not configured, available:\n");
+ {
+ const struct lws_event_loop_ops **elops = available_event_libs;
+
+ while (*elops) {
+ lwsl_err(" - %s\n", (*elops)->name);
+ elops++;
+ }
+ }
+ lws_free(context);
+
return NULL;
}
@@ -1205,7 +1416,7 @@ lws_context_deprecate(struct lws_context *context, lws_reload_func cb)
wsi = vh->lserv_wsi;
if (wsi) {
wsi->socket_is_permanently_unusable = 1;
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "ctx deprecate");
wsi->context->deprecation_pending_listen_close_count++;
/*
* other vhosts can share the listen port, they
@@ -1231,11 +1442,7 @@ lws_context_is_deprecated(struct lws_context *context)
return context->deprecated;
}
-LWS_VISIBLE void
-lws_context_destroy2(struct lws_context *context);
-
-
-static void
+void
lws_vhost_destroy1(struct lws_vhost *vh)
{
const struct lws_protocols *protocol = NULL;
@@ -1259,7 +1466,8 @@ lws_vhost_destroy1(struct lws_vhost *vh)
*/
if (vh->lserv_wsi)
- lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
+ lws_start_foreach_ll(struct lws_vhost *, v,
+ context->vhost_list) {
if (v != vh &&
!v->being_destroyed &&
v->listen_port == vh->listen_port &&
@@ -1302,13 +1510,21 @@ lws_vhost_destroy1(struct lws_vhost *vh)
continue;
lws_close_free_wsi(wsi,
- LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY
+ LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY,
+ "vh destroy"
/* no protocol close */);
n--;
}
}
/*
+ * destroy any pending timed events
+ */
+
+ while (vh->timed_vh_protocol_list)
+ lws_timed_callback_remove(vh, vh->timed_vh_protocol_list);
+
+ /*
* let the protocols destroy the per-vhost protocol objects
*/
@@ -1316,7 +1532,7 @@ lws_vhost_destroy1(struct lws_vhost *vh)
wsi.context = vh->context;
wsi.vhost = vh;
protocol = vh->protocols;
- if (protocol) {
+ if (protocol && vh->created_vhost_protocols) {
n = 0;
while (n < vh->count_protocols) {
wsi.protocol = protocol;
@@ -1397,28 +1613,37 @@ lws_vhost_destroy2(struct lws_vhost *vh)
lws_free(vh->protocol_vh_privs);
lws_ssl_SSL_CTX_destroy(vh);
lws_free(vh->same_vh_protocol_list);
-#ifdef LWS_WITH_PLUGINS
- if (LWS_LIBUV_ENABLED(context)) {
- if (context->plugin_list)
- lws_free((void *)vh->protocols);
- } else
-#endif
- {
- if (context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS)
- lws_free((void *)vh->protocols);
- }
-#ifdef LWS_WITH_PLUGINS
-#ifndef LWS_NO_EXTENSIONS
- if (context->plugin_extension_count)
- lws_free((void *)vh->extensions);
-#endif
-#endif
+ if (context->plugin_list ||
+ (context->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS))
+ lws_free((void *)vh->protocols);
+
+ LWS_FOR_EVERY_AVAILABLE_ROLE_START(ar)
+ if (ar->destroy_vhost)
+ ar->destroy_vhost(vh);
+ LWS_FOR_EVERY_AVAILABLE_ROLE_END;
+
#ifdef LWS_WITH_ACCESS_LOG
if (vh->log_fd != (int)LWS_INVALID_FILE)
close(vh->log_fd);
#endif
+#if defined (LWS_WITH_TLS)
+ lws_free_set_NULL(vh->tls.alloc_cert_path);
+#endif
+
+#if LWS_MAX_SMP > 1
+ pthread_mutex_destroy(&vh->lock);
+#endif
+
+#if defined(LWS_WITH_UNIX_SOCK)
+ if (LWS_UNIX_SOCK_ENABLED(context)) {
+ n = unlink(vh->iface);
+ if (n)
+ lwsl_info("Closing unix socket %s: errno %d\n",
+ vh->iface, errno);
+ }
+#endif
/*
* although async event callbacks may still come for wsi handles with
* pending close in the case of asycn event library like libuv,
@@ -1439,7 +1664,8 @@ lws_check_deferred_free(struct lws_context *context, int force)
lws_start_foreach_llp(struct lws_deferred_free **, pdf,
context->deferred_free_list) {
- if (now > (*pdf)->deadline || force) {
+ if (force ||
+ lws_compare_time_t(context, now, (*pdf)->deadline) > 5) {
df = *pdf;
*pdf = df->next;
/* finalize vh destruction */
@@ -1466,119 +1692,86 @@ lws_vhost_destroy(struct lws_vhost *vh)
/* part 2 is deferred to allow all the handle closes to complete */
df->next = vh->context->deferred_free_list;
- df->deadline = lws_now_secs() + 5;
+ df->deadline = lws_now_secs();
df->payload = vh;
vh->context->deferred_free_list = df;
}
-LWS_VISIBLE void
-lws_context_destroy(struct lws_context *context)
-{
- struct lws_context_per_thread *pt;
- struct lws_vhost *vh = NULL;
- struct lws wsi;
- int n, m;
-
- if (!context) {
- lwsl_notice("%s: ctx %p\n", __func__, context);
- return;
- }
- if (context->being_destroyed1) {
- lwsl_notice("%s: ctx %p: already being destroyed\n",
- __func__, context);
- return;
- }
-
- lwsl_info("%s: ctx %p\n", __func__, context);
-
- m = context->count_threads;
- context->being_destroyed = 1;
- context->being_destroyed1 = 1;
-
- memset(&wsi, 0, sizeof(wsi));
- wsi.context = context;
-
-#ifdef LWS_LATENCY
- if (context->worst_latency_info[0])
- lwsl_notice("Worst latency: %s\n", context->worst_latency_info);
-#endif
-
- while (m--) {
- pt = &context->pt[m];
-
- for (n = 0; (unsigned int)n < context->pt[m].fds_count; n++) {
- struct lws *wsi = wsi_from_fd(context, pt->fds[n].fd);
- if (!wsi)
- continue;
-
- lws_close_free_wsi(wsi,
- LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY
- /* no protocol close */);
- n--;
- }
- lws_pt_mutex_destroy(pt);
- }
-
- /*
- * give all extensions a chance to clean up any per-context
- * allocations they might have made
- */
-
- n = lws_ext_cb_all_exts(context, NULL,
- LWS_EXT_CB_SERVER_CONTEXT_DESTRUCT, NULL, 0);
+/*
+ * When using an event loop, the context destruction is in three separate
+ * parts. This is to cover both internal and foreign event loops cleanly.
+ *
+ * - lws_context_destroy() simply starts a soft close of all wsi and
+ * related allocations. The event loop continues.
+ *
+ * As the closes complete in the event loop, reference counting is used
+ * to determine when everything is closed. It then calls
+ * lws_context_destroy2().
+ *
+ * - lws_context_destroy2() cleans up the rest of the higher-level logical
+ * lws pieces like vhosts. If the loop was foreign, it then proceeds to
+ * lws_context_destroy3(). If it the loop is internal, it stops the
+ * internal loops and waits for lws_context_destroy() to be called again
+ * outside the event loop (since we cannot destroy the loop from
+ * within the loop). That will cause lws_context_destroy3() to run
+ * directly.
+ *
+ * - lws_context_destroy3() destroys any internal event loops and then
+ * destroys the context itself, setting what was info.pcontext to NULL.
+ */
- n = lws_ext_cb_all_exts(context, NULL,
- LWS_EXT_CB_CLIENT_CONTEXT_DESTRUCT, NULL, 0);
+/*
+ * destroy the actual context itself
+ */
- /*
- * inform all the protocols that they are done and will have no more
- * callbacks.
- *
- * We can't free things until after the event loop shuts down.
- */
- if (context->protocol_init_done)
- vh = context->vhost_list;
- while (vh) {
- struct lws_vhost *vhn = vh->vhost_next;
- lws_vhost_destroy1(vh);
- vh = vhn;
- }
+static void
+lws_context_destroy3(struct lws_context *context)
+{
+ struct lws_context **pcontext_finalize = context->pcontext_finalize;
+ struct lws_context_per_thread *pt;
+ int n;
for (n = 0; n < context->count_threads; n++) {
pt = &context->pt[n];
- lws_libev_destroyloop(context, n);
- lws_libuv_destroyloop(context, n);
- lws_libevent_destroyloop(context, n);
+ if (context->event_loop_ops->destroy_pt)
+ context->event_loop_ops->destroy_pt(context, n);
lws_free_set_NULL(context->pt[n].serv_buf);
- while (pt->ah_list)
- _lws_destroy_ah(pt, pt->ah_list);
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ while (pt->http.ah_list)
+ _lws_destroy_ah(pt, pt->http.ah_list);
+#endif
}
- lws_plat_context_early_destroy(context);
- if (context->pt[0].fds)
- lws_free_set_NULL(context->pt[0].fds);
+ lws_free(context);
+ lwsl_info("%s: ctx %p freed\n", __func__, context);
- if (!LWS_LIBUV_ENABLED(context))
- lws_context_destroy2(context);
+ if (pcontext_finalize)
+ *pcontext_finalize = NULL;
}
/*
- * call the second one after the event loop has been shut down cleanly
+ * really start destroying things
*/
-LWS_VISIBLE void
+void
lws_context_destroy2(struct lws_context *context)
{
struct lws_vhost *vh = NULL, *vh1;
#if defined(LWS_WITH_PEER_LIMITS)
- uint32_t n;
+ uint32_t nu;
#endif
+ int n;
lwsl_info("%s: ctx %p\n", __func__, context);
+ context->being_destroyed2 = 1;
+
+ if (context->pt[0].fds)
+ lws_free_set_NULL(context->pt[0].fds);
+
/*
* free all the per-vhost allocations
*/
@@ -1603,9 +1796,9 @@ lws_context_destroy2(struct lws_context *context)
lws_plat_context_late_destroy(context);
#if defined(LWS_WITH_PEER_LIMITS)
- for (n = 0; n < context->pl_hash_elements; n++) {
+ for (nu = 0; nu < context->pl_hash_elements; nu++) {
lws_start_foreach_llp(struct lws_peer **, peer,
- context->pl_hash_table[n]) {
+ context->pl_hash_table[nu]) {
struct lws_peer *df = *peer;
*peer = df->next;
lws_free(df);
@@ -1621,8 +1814,144 @@ lws_context_destroy2(struct lws_context *context)
lws_check_deferred_free(context, 1);
#if LWS_MAX_SMP > 1
- pthread_mutex_destroy(&context->lock, NULL);
+ pthread_mutex_destroy(&context->lock);
#endif
- lws_free(context);
+ if (context->event_loop_ops->destroy_context2)
+ if (context->event_loop_ops->destroy_context2(context)) {
+ context->finalize_destroy_after_internal_loops_stopped = 1;
+ return;
+ }
+
+ if (!context->pt[0].event_loop_foreign)
+ for (n = 0; n < context->count_threads; n++)
+ if (context->pt[n].inside_service)
+ return;
+
+ lws_context_destroy3(context);
+}
+
+/*
+ * Begin the context takedown
+ */
+
+LWS_VISIBLE void
+lws_context_destroy(struct lws_context *context)
+{
+ volatile struct lws_foreign_thread_pollfd *ftp, *next;
+ volatile struct lws_context_per_thread *vpt;
+ struct lws_context_per_thread *pt;
+ struct lws_vhost *vh = NULL;
+ struct lws wsi;
+ int n, m;
+
+ if (!context)
+ return;
+
+ if (context->finalize_destroy_after_internal_loops_stopped) {
+ if (context->event_loop_ops->destroy_context2)
+ context->event_loop_ops->destroy_context2(context);
+
+ lws_context_destroy3(context);
+
+ return;
+ }
+
+ if (context->being_destroyed1) {
+ if (!context->being_destroyed2) {
+ lws_context_destroy2(context);
+
+ return;
+ }
+ lwsl_info("%s: ctx %p: already being destroyed\n",
+ __func__, context);
+
+ lws_context_destroy3(context);
+ return;
+ }
+
+ lwsl_info("%s: ctx %p\n", __func__, context);
+
+ m = context->count_threads;
+ context->being_destroyed = 1;
+ context->being_destroyed1 = 1;
+ context->requested_kill = 1;
+
+ memset(&wsi, 0, sizeof(wsi));
+ wsi.context = context;
+
+#ifdef LWS_LATENCY
+ if (context->worst_latency_info[0])
+ lwsl_notice("Worst latency: %s\n", context->worst_latency_info);
+#endif
+
+ while (m--) {
+ pt = &context->pt[m];
+ vpt = (volatile struct lws_context_per_thread *)pt;
+
+ ftp = vpt->foreign_pfd_list;
+ while (ftp) {
+ next = ftp->next;
+ lws_free((void *)ftp);
+ ftp = next;
+ }
+ vpt->foreign_pfd_list = NULL;
+
+ for (n = 0; (unsigned int)n < context->pt[m].fds_count; n++) {
+ struct lws *wsi = wsi_from_fd(context, pt->fds[n].fd);
+ if (!wsi)
+ continue;
+
+ if (wsi->event_pipe)
+ lws_destroy_event_pipe(wsi);
+ else
+ lws_close_free_wsi(wsi,
+ LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY,
+ "ctx destroy"
+ /* no protocol close */);
+ n--;
+ }
+ lws_pt_mutex_destroy(pt);
+ }
+
+ /*
+ * inform all the protocols that they are done and will have no more
+ * callbacks.
+ *
+ * We can't free things until after the event loop shuts down.
+ */
+ if (context->protocol_init_done)
+ vh = context->vhost_list;
+ while (vh) {
+ struct lws_vhost *vhn = vh->vhost_next;
+ lws_vhost_destroy1(vh);
+ vh = vhn;
+ }
+
+ lws_plat_context_early_destroy(context);
+
+ /*
+ * We face two different needs depending if foreign loop or not.
+ *
+ * 1) If foreign loop, we really want to advance the destroy_context()
+ * past here, and block only for libuv-style async close completion.
+ *
+ * 2a) If poll, and we exited by ourselves and are calling a final
+ * destroy_context() outside of any service already, we want to
+ * advance all the way in one step.
+ *
+ * 2b) If poll, and we are reacting to a SIGINT, service thread(s) may
+ * be in poll wait or servicing. We can't advance the
+ * destroy_context() to the point it's freeing things; we have to
+ * leave that for the final destroy_context() after the service
+ * thread(s) are finished calling for service.
+ */
+
+ if (context->event_loop_ops->destroy_context1) {
+ context->event_loop_ops->destroy_context1(context);
+
+ return;
+ }
+
+ lws_context_destroy2(context);
}
diff --git a/thirdparty/lws/libwebsockets.c b/thirdparty/libwebsockets/core/libwebsockets.c
index 50f975d21e..0da02b17e4 100644
--- a/thirdparty/lws/libwebsockets.c
+++ b/thirdparty/libwebsockets/core/libwebsockets.c
@@ -19,7 +19,7 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
#ifdef LWS_HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -27,6 +27,7 @@
#ifdef LWS_WITH_IPV6
#if defined(WIN32) || defined(_WIN32)
+#include <wincrypt.h>
#include <Iphlpapi.h>
#else
#include <net/if.h>
@@ -57,16 +58,41 @@ static const char * const log_level_names[] = {
};
#endif
-void
-lws_free_wsi(struct lws *wsi)
+#if defined (_DEBUG)
+void lwsi_set_role(struct lws *wsi, lws_wsi_state_t role)
{
- struct lws_context_per_thread *pt;
- struct allocated_headers *ah;
+ wsi->wsistate = (wsi->wsistate & (~LWSI_ROLE_MASK)) | role;
+
+ lwsl_debug("lwsi_set_role(%p, 0x%x)\n", wsi, wsi->wsistate);
+}
+
+void lwsi_set_state(struct lws *wsi, lws_wsi_state_t lrs)
+{
+ wsi->wsistate = (wsi->wsistate & (~LRS_MASK)) | lrs;
+ lwsl_debug("lwsi_set_state(%p, 0x%x)\n", wsi, wsi->wsistate);
+}
+#endif
+
+signed char char_to_hex(const char c)
+{
+ if (c >= '0' && c <= '9')
+ return c - '0';
+
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+
+ return -1;
+}
+
+void
+__lws_free_wsi(struct lws *wsi)
+{
if (!wsi)
return;
-
- pt = &wsi->context->pt[(int)wsi->tsi];
/*
* Protocol user data may be allocated either internally by lws
@@ -76,51 +102,32 @@ lws_free_wsi(struct lws *wsi)
wsi->user_space && !wsi->user_space_externally_allocated)
lws_free(wsi->user_space);
- lws_free_set_NULL(wsi->rxflow_buffer);
+ lws_buflist_destroy_all_segments(&wsi->buflist);
lws_free_set_NULL(wsi->trunc_alloc);
+ lws_free_set_NULL(wsi->udp);
- /* we may not have an ah, but may be on the waiting list... */
- lwsl_info("ah det due to close\n");
- /* we're closing, losing some rx is OK */
- lws_header_table_force_to_detachable_state(wsi);
- lws_header_table_detach(wsi, 0);
-
- if (wsi->vhost->lserv_wsi == wsi)
+ if (wsi->vhost && wsi->vhost->lserv_wsi == wsi)
wsi->vhost->lserv_wsi = NULL;
- lws_pt_lock(pt);
- ah = pt->ah_list;
- while (ah) {
- if (ah->in_use && ah->wsi == wsi) {
- lwsl_err("%s: ah leak: wsi %p\n", __func__, wsi);
- ah->in_use = 0;
- ah->wsi = NULL;
- pt->ah_count_in_use--;
- break;
- }
- ah = ah->next;
- }
+ // lws_peer_dump_from_wsi(wsi);
+
+ if (wsi->role_ops->destroy_role)
+ wsi->role_ops->destroy_role(wsi);
#if defined(LWS_WITH_PEER_LIMITS)
lws_peer_track_wsi_close(wsi->context, wsi->peer);
wsi->peer = NULL;
#endif
-#if defined(LWS_WITH_HTTP2)
- if (wsi->upgraded_to_http2 || wsi->http2_substream) {
- lws_hpack_destroy_dynamic_header(wsi);
+ /* since we will destroy the wsi, make absolutely sure now */
- if (wsi->u.h2.h2n)
- lws_free_set_NULL(wsi->u.h2.h2n);
- }
+#if defined(LWS_WITH_OPENSSL)
+ __lws_ssl_remove_wsi_from_buffered_list(wsi);
#endif
+ __lws_remove_from_timeout_list(wsi);
- lws_pt_unlock(pt);
-
- /* since we will destroy the wsi, make absolutely sure now */
-
- lws_ssl_remove_wsi_from_buffered_list(wsi);
- lws_remove_from_timeout_list(wsi);
+ if (wsi->context->event_loop_ops->destroy_wsi)
+ wsi->context->event_loop_ops->destroy_wsi(wsi);
wsi->context->count_wsi_allocated--;
lwsl_debug("%s: %p, remaining wsi %d\n", __func__, wsi,
@@ -130,63 +137,301 @@ lws_free_wsi(struct lws *wsi)
}
void
-lws_remove_from_timeout_list(struct lws *wsi)
+lws_dll_add_front(struct lws_dll *d, struct lws_dll *phead)
{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ if (d->prev)
+ return;
- if (!wsi->timeout_list_prev) /* ie, not part of the list */
+ /* our next guy is current first guy */
+ d->next = phead->next;
+ /* if there is a next guy, set his prev ptr to our next ptr */
+ if (d->next)
+ d->next->prev = d;
+ /* our prev ptr is first ptr */
+ d->prev = phead;
+ /* set the first guy to be us */
+ phead->next = d;
+}
+
+/* situation is:
+ *
+ * HEAD: struct lws_dll * = &entry1
+ *
+ * Entry 1: struct lws_dll .pprev = &HEAD , .next = Entry 2
+ * Entry 2: struct lws_dll .pprev = &entry1 , .next = &entry2
+ * Entry 3: struct lws_dll .pprev = &entry2 , .next = NULL
+ *
+ * Delete Entry1:
+ *
+ * - HEAD = &entry2
+ * - Entry2: .pprev = &HEAD, .next = &entry3
+ * - Entry3: .pprev = &entry2, .next = NULL
+ *
+ * Delete Entry2:
+ *
+ * - HEAD = &entry1
+ * - Entry1: .pprev = &HEAD, .next = &entry3
+ * - Entry3: .pprev = &entry1, .next = NULL
+ *
+ * Delete Entry3:
+ *
+ * - HEAD = &entry1
+ * - Entry1: .pprev = &HEAD, .next = &entry2
+ * - Entry2: .pprev = &entry1, .next = NULL
+ *
+ */
+
+void
+lws_dll_remove(struct lws_dll *d)
+{
+ if (!d->prev) /* ie, not part of the list */
return;
- lws_pt_lock(pt);
+ /*
+ * remove us
+ *
+ * USp <-> us <-> USn --> USp <-> USn
+ */
+
/* if we have a next guy, set his prev to our prev */
- if (wsi->timeout_list)
- wsi->timeout_list->timeout_list_prev = wsi->timeout_list_prev;
+ if (d->next)
+ d->next->prev = d->prev;
+
/* set our prev guy to our next guy instead of us */
- *wsi->timeout_list_prev = wsi->timeout_list;
+ if (d->prev)
+ d->prev->next = d->next;
/* we're out of the list, we should not point anywhere any more */
- wsi->timeout_list_prev = NULL;
- wsi->timeout_list = NULL;
+ d->prev = NULL;
+ d->next = NULL;
+}
+
+void
+__lws_remove_from_timeout_list(struct lws *wsi)
+{
+ lws_dll_lws_remove(&wsi->dll_timeout);
+}
+
+void
+lws_remove_from_timeout_list(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ lws_pt_lock(pt, __func__);
+ __lws_remove_from_timeout_list(wsi);
lws_pt_unlock(pt);
}
+void
+lws_dll_dump(struct lws_dll_lws *head, const char *title)
+{
+ int n = 0;
+
+ (void)n;
+ lwsl_notice("%s: %s (head.next %p)\n", __func__, title, head->next);
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1, head->next) {
+ struct lws *wsi = lws_container_of(d, struct lws, dll_hrtimer);
+
+ (void)wsi;
+
+ lwsl_notice(" %d: wsi %p: %llu\n", n++, wsi,
+ (unsigned long long)wsi->pending_timer);
+ } lws_end_foreach_dll_safe(d, d1);
+}
+
+void
+__lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ struct lws_dll_lws *dd = &pt->dll_head_hrtimer;
+ struct timeval now;
+ struct lws *wsi1;
+ int bef = 0;
+
+ lws_dll_lws_remove(&wsi->dll_hrtimer);
+
+ if (usecs == LWS_SET_TIMER_USEC_CANCEL)
+ return;
+
+ gettimeofday(&now, NULL);
+ wsi->pending_timer = ((now.tv_sec * 1000000ll) + now.tv_usec) + usecs;
+
+ /*
+ * we sort the hrtimer list with the earliest timeout first
+ */
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ pt->dll_head_hrtimer.next) {
+ dd = d;
+ wsi1 = lws_container_of(d, struct lws, dll_hrtimer);
+
+ if (wsi1->pending_timer >= wsi->pending_timer) {
+ /* d, dprev's next, is >= our time */
+ bef = 1;
+ break;
+ }
+ } lws_end_foreach_dll_safe(d, d1);
+
+ if (bef) {
+ /*
+ * we go before dd
+ * DDp <-> DD <-> DDn --> DDp <-> us <-> DD <-> DDn
+ */
+ /* we point forward to dd */
+ wsi->dll_hrtimer.next = dd;
+ /* we point back to what dd used to point back to */
+ wsi->dll_hrtimer.prev = dd->prev;
+ /* DDp points forward to us now */
+ dd->prev->next = &wsi->dll_hrtimer;
+ /* DD points back to us now */
+ dd->prev = &wsi->dll_hrtimer;
+ } else {
+ /*
+ * we go after dd
+ * DDp <-> DD <-> DDn --> DDp <-> DD <-> us <-> DDn
+ */
+ /* we point forward to what dd used to point forward to */
+ wsi->dll_hrtimer.next = dd->next;
+ /* we point back to dd */
+ wsi->dll_hrtimer.prev = dd;
+ /* DDn points back to us */
+ if (dd->next)
+ dd->next->prev = &wsi->dll_hrtimer;
+ /* DD points forward to us */
+ dd->next = &wsi->dll_hrtimer;
+ }
+
+// lws_dll_dump(&pt->dll_head_hrtimer, "after set_timer_usec");
+}
+
LWS_VISIBLE void
-lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
+lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs)
+{
+ __lws_set_timer_usecs(wsi, usecs);
+}
+
+lws_usec_t
+__lws_hrtimer_service(struct lws_context_per_thread *pt)
+{
+ struct timeval now;
+ struct lws *wsi;
+ lws_usec_t t;
+
+ gettimeofday(&now, NULL);
+ t = (now.tv_sec * 1000000ll) + now.tv_usec;
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ pt->dll_head_hrtimer.next) {
+ wsi = lws_container_of(d, struct lws, dll_hrtimer);
+
+ /*
+ * if we met one in the future, we are done, because the list
+ * is sorted by time in the future.
+ */
+ if (wsi->pending_timer > t)
+ break;
+
+ lws_set_timer_usecs(wsi, LWS_SET_TIMER_USEC_CANCEL);
+
+ /* it's time for the timer to be serviced */
+
+ if (wsi->protocol &&
+ wsi->protocol->callback(wsi, LWS_CALLBACK_TIMER,
+ wsi->user_space, NULL, 0))
+ __lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "timer cb errored");
+ } lws_end_foreach_dll_safe(d, d1);
+
+ /* return an estimate how many us until next timer hit */
+
+ if (!pt->dll_head_hrtimer.next)
+ return LWS_HRTIMER_NOWAIT;
+
+ wsi = lws_container_of(pt->dll_head_hrtimer.next, struct lws, dll_hrtimer);
+
+ gettimeofday(&now, NULL);
+ t = (now.tv_sec * 1000000ll) + now.tv_usec;
+
+ if (wsi->pending_timer < t)
+ return 0;
+
+ return wsi->pending_timer - t;
+}
+
+void
+__lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
{
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
time_t now;
+ time(&now);
+
+ lwsl_debug("%s: %p: %d secs\n", __func__, wsi, secs);
+ wsi->pending_timeout_limit = secs;
+ wsi->pending_timeout_set = now;
+ wsi->pending_timeout = reason;
+
+ if (!reason)
+ lws_dll_lws_remove(&wsi->dll_timeout);
+ else
+ lws_dll_lws_add_front(&wsi->dll_timeout, &pt->dll_head_timeout);
+}
+
+LWS_VISIBLE void
+lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
if (secs == LWS_TO_KILL_SYNC) {
lws_remove_from_timeout_list(wsi);
lwsl_debug("synchronously killing %p\n", wsi);
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "to sync kill");
return;
}
- lws_pt_lock(pt);
+ if (secs == LWS_TO_KILL_ASYNC)
+ secs = 0;
- time(&now);
+ lws_pt_lock(pt, __func__);
+ __lws_set_timeout(wsi, reason, secs);
+ lws_pt_unlock(pt);
+}
- if (reason && !wsi->timeout_list_prev) {
- /* our next guy is current first guy */
- wsi->timeout_list = pt->timeout_list;
- /* if there is a next guy, set his prev ptr to our next ptr */
- if (wsi->timeout_list)
- wsi->timeout_list->timeout_list_prev = &wsi->timeout_list;
- /* our prev ptr is first ptr */
- wsi->timeout_list_prev = &pt->timeout_list;
- /* set the first guy to be us */
- *wsi->timeout_list_prev = wsi;
- }
+int
+lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p)
+{
+ lws_start_foreach_llp(struct lws_timed_vh_protocol **, pt,
+ vh->timed_vh_protocol_list) {
+ if (*pt == p) {
+ *pt = p->next;
+ lws_free(p);
- lwsl_debug("%s: %p: %d secs\n", __func__, wsi, secs);
- wsi->pending_timeout_limit = now + secs;
- wsi->pending_timeout = reason;
+ return 0;
+ }
+ } lws_end_foreach_llp(pt, next);
- lws_pt_unlock(pt);
+ return 1;
+}
- if (!reason)
- lws_remove_from_timeout_list(wsi);
+LWS_VISIBLE LWS_EXTERN int
+lws_timed_callback_vh_protocol(struct lws_vhost *vh, const struct lws_protocols *prot,
+ int reason, int secs)
+{
+ struct lws_timed_vh_protocol *p = (struct lws_timed_vh_protocol *)
+ lws_malloc(sizeof(*p), "timed_vh");
+
+ if (!p)
+ return 1;
+
+ p->protocol = prot;
+ p->reason = reason;
+ p->time = lws_now_secs() + secs;
+ p->next = vh->timed_vh_protocol_list;
+
+ vh->timed_vh_protocol_list = p;
+
+ return 0;
}
static void
@@ -229,9 +474,11 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p)
// return 0;
const struct lws_protocols *vp = wsi->vhost->protocols, *vpo;
- if (wsi->protocol)
+ if (wsi->protocol && wsi->protocol_bind_balance) {
wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_DROP_PROTOCOL,
wsi->user_space, NULL, 0);
+ wsi->protocol_bind_balance = 0;
+ }
if (!wsi->user_space_externally_allocated)
lws_free_set_NULL(wsi->user_space);
@@ -245,7 +492,7 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p)
return 1;
if (p > vp && p < &vp[wsi->vhost->count_protocols])
- lws_same_vh_protocol_insert(wsi, p - vp);
+ lws_same_vh_protocol_insert(wsi, (int)(p - vp));
else {
int n = wsi->vhost->count_protocols;
int hit = 0;
@@ -255,7 +502,7 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p)
while (n--) {
if (p->name && vp->name && !strcmp(p->name, vp->name)) {
hit = 1;
- lws_same_vh_protocol_insert(wsi, vp - vpo);
+ lws_same_vh_protocol_insert(wsi, (int)(vp - vpo));
break;
}
vp++;
@@ -269,42 +516,65 @@ lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p)
wsi->user_space, NULL, 0))
return 1;
+ wsi->protocol_bind_balance = 1;
+
return 0;
}
void
-lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
+__lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason, const char *caller)
{
struct lws_context_per_thread *pt;
struct lws *wsi1, *wsi2;
struct lws_context *context;
- struct lws_tokens eff_buf;
- int n, m, ret;
+ int n;
- lwsl_debug("%s: %p\n", __func__, wsi);
+ lwsl_info("%s: %p: caller: %s\n", __func__, wsi, caller);
if (!wsi)
return;
lws_access_log(wsi);
-#if defined(LWS_WITH_ESP8266)
- if (wsi->premature_rx)
- lws_free(wsi->premature_rx);
-
- if (wsi->pending_send_completion && !wsi->close_is_pending_send_completion) {
- lwsl_notice("delaying close\n");
- wsi->close_is_pending_send_completion = 1;
- return;
- }
-#endif
-
- /* we're closing, losing some rx is OK */
- lws_header_table_force_to_detachable_state(wsi);
context = wsi->context;
pt = &context->pt[(int)wsi->tsi];
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_CLOSE, 1);
+#if !defined(LWS_NO_CLIENT)
+
+ lws_free_set_NULL(wsi->client_hostname_copy);
+ /* we are no longer an active client connection that can piggyback */
+ lws_dll_lws_remove(&wsi->dll_active_client_conns);
+
+ /*
+ * if we have wsi in our transaction queue, if we are closing we
+ * must go through and close all those first
+ */
+ if (wsi->vhost) {
+ if ((int)reason != -1)
+ lws_vhost_lock(wsi->vhost);
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ wsi->dll_client_transaction_queue_head.next) {
+ struct lws *w = lws_container_of(d, struct lws,
+ dll_client_transaction_queue);
+
+ __lws_close_free_wsi(w, -1, "trans q leader closing");
+ } lws_end_foreach_dll_safe(d, d1);
+
+ /*
+ * !!! If we are closing, but we have pending pipelined transaction
+ * results we already sent headers for, that's going to destroy sync
+ * for HTTP/1 and leave H2 stream with no live swsi.
+ *
+ * However this is normal if we are being closed because the transaction
+ * queue leader is closing.
+ */
+ lws_dll_lws_remove(&wsi->dll_client_transaction_queue);
+ if ((int)reason !=-1)
+ lws_vhost_unlock(wsi->vhost);
+ }
+#endif
+
/* if we have children, close them first */
if (wsi->child_list) {
wsi2 = wsi->child_list;
@@ -313,301 +583,146 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
wsi2->parent = NULL;
/* stop it doing shutdown processing */
wsi2->socket_is_permanently_unusable = 1;
- lws_close_free_wsi(wsi2, reason);
+ __lws_close_free_wsi(wsi2, reason, "general child recurse");
wsi2 = wsi1;
}
wsi->child_list = NULL;
}
-#if defined(LWS_WITH_HTTP2)
-
- if (wsi->u.h2.parent_wsi) {
- lwsl_info(" wsi: %p, his parent %p: siblings:\n", wsi, wsi->u.h2.parent_wsi);
- lws_start_foreach_llp(struct lws **, w, wsi->u.h2.parent_wsi->u.h2.child_list) {
- lwsl_info(" \\---- child %p\n", *w);
- } lws_end_foreach_llp(w, u.h2.sibling_list);
- }
-
- if (wsi->upgraded_to_http2 || wsi->http2_substream) {
- lwsl_info("closing %p: parent %p\n", wsi, wsi->u.h2.parent_wsi);
-
- if (wsi->u.h2.child_list) {
- lwsl_info(" parent %p: closing children: list:\n", wsi);
- lws_start_foreach_llp(struct lws **, w, wsi->u.h2.child_list) {
- lwsl_info(" \\---- child %p\n", *w);
- } lws_end_foreach_llp(w, u.h2.sibling_list);
- /* trigger closing of all of our http2 children first */
- lws_start_foreach_llp(struct lws **, w, wsi->u.h2.child_list) {
- lwsl_info(" closing child %p\n", *w);
- /* disconnect from siblings */
- wsi2 = (*w)->u.h2.sibling_list;
- (*w)->u.h2.sibling_list = NULL;
- (*w)->socket_is_permanently_unusable = 1;
- lws_close_free_wsi(*w, reason);
- *w = wsi2;
- continue;
- } lws_end_foreach_llp(w, u.h2.sibling_list);
- }
- }
-
- if (wsi->upgraded_to_http2) {
- /* remove pps */
- struct lws_h2_protocol_send *w = wsi->u.h2.h2n->pps, *w1;
- while (w) {
- w1 = wsi->u.h2.h2n->pps->next;
- free(w);
- w = w1;
- }
- wsi->u.h2.h2n->pps = NULL;
- }
-
- if (wsi->http2_substream && wsi->u.h2.parent_wsi) {
- lwsl_info(" %p: disentangling from siblings\n", wsi);
- lws_start_foreach_llp(struct lws **, w,
- wsi->u.h2.parent_wsi->u.h2.child_list) {
- /* disconnect from siblings */
- if (*w == wsi) {
- wsi2 = (*w)->u.h2.sibling_list;
- (*w)->u.h2.sibling_list = NULL;
- *w = wsi2;
- lwsl_info(" %p disentangled from sibling %p\n", wsi, wsi2);
- break;
- }
- } lws_end_foreach_llp(w, u.h2.sibling_list);
- wsi->u.h2.parent_wsi->u.h2.child_count--;
- wsi->u.h2.parent_wsi = NULL;
- if (wsi->u.h2.pending_status_body)
- lws_free_set_NULL(wsi->u.h2.pending_status_body);
- }
-
- if (wsi->upgraded_to_http2 && wsi->u.h2.h2n &&
- wsi->u.h2.h2n->rx_scratch)
- lws_free_set_NULL(wsi->u.h2.h2n->rx_scratch);
-#endif
-
- if (wsi->mode == LWSCM_RAW_FILEDESC) {
+ if (wsi->role_ops == &role_ops_raw_file) {
lws_remove_child_from_any_parent(wsi);
- remove_wsi_socket_from_fds(wsi);
- wsi->protocol->callback(wsi,
- LWS_CALLBACK_RAW_CLOSE_FILE,
+ __remove_wsi_socket_from_fds(wsi);
+ wsi->protocol->callback(wsi, wsi->role_ops->close_cb[0],
wsi->user_space, NULL, 0);
goto async_close;
}
+ wsi->wsistate_pre_close = wsi->wsistate;
+
#ifdef LWS_WITH_CGI
- if (wsi->mode == LWSCM_CGI) {
+ if (wsi->role_ops == &role_ops_cgi) {
/* we are not a network connection, but a handler for CGI io */
- if (wsi->parent && wsi->parent->cgi) {
+ if (wsi->parent && wsi->parent->http.cgi) {
if (wsi->cgi_channel == LWS_STDOUT)
lws_cgi_remove_and_kill(wsi->parent);
/* end the binding between us and master */
- wsi->parent->cgi->stdwsi[(int)wsi->cgi_channel] = NULL;
+ wsi->parent->http.cgi->stdwsi[(int)wsi->cgi_channel] = NULL;
}
wsi->socket_is_permanently_unusable = 1;
goto just_kill_connection;
}
- if (wsi->cgi)
+ if (wsi->http.cgi)
lws_cgi_remove_and_kill(wsi);
#endif
#if !defined(LWS_NO_CLIENT)
- if (wsi->mode == LWSCM_HTTP_CLIENT ||
- wsi->mode == LWSCM_WSCL_WAITING_CONNECT ||
- wsi->mode == LWSCM_WSCL_WAITING_PROXY_REPLY ||
- wsi->mode == LWSCM_WSCL_ISSUE_HANDSHAKE ||
- wsi->mode == LWSCM_WSCL_ISSUE_HANDSHAKE2 ||
- wsi->mode == LWSCM_WSCL_WAITING_SSL ||
- wsi->mode == LWSCM_WSCL_WAITING_SERVER_REPLY ||
- wsi->mode == LWSCM_WSCL_WAITING_EXTENSION_CONNECT ||
- wsi->mode == LWSCM_WSCL_WAITING_SOCKS_GREETING_REPLY ||
- wsi->mode == LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY ||
- wsi->mode == LWSCM_WSCL_WAITING_SOCKS_AUTH_REPLY)
- if (wsi->u.hdr.stash)
- lws_free_set_NULL(wsi->u.hdr.stash);
-#endif
-
- if (wsi->mode == LWSCM_RAW) {
- wsi->protocol->callback(wsi,
- LWS_CALLBACK_RAW_CLOSE, wsi->user_space, NULL, 0);
+ lws_client_stash_destroy(wsi);
+#endif
+
+ if (wsi->role_ops == &role_ops_raw_skt) {
wsi->socket_is_permanently_unusable = 1;
goto just_kill_connection;
}
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ if (lwsi_role_http(wsi) && lwsi_role_server(wsi) &&
+ wsi->http.fop_fd != NULL)
+ lws_vfs_file_close(&wsi->http.fop_fd);
+#endif
+
+ if (lwsi_state(wsi) == LRS_DEAD_SOCKET)
+ return;
- if ((wsi->mode == LWSCM_HTTP_SERVING_ACCEPTED ||
- wsi->mode == LWSCM_HTTP2_SERVING) &&
- wsi->u.http.fop_fd != NULL) {
- lws_vfs_file_close(&wsi->u.http.fop_fd);
- wsi->vhost->protocols->callback(wsi,
- LWS_CALLBACK_CLOSED_HTTP, wsi->user_space, NULL, 0);
- wsi->told_user_closed = 1;
- }
if (wsi->socket_is_permanently_unusable ||
reason == LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY ||
- wsi->state == LWSS_SHUTDOWN)
+ lwsi_state(wsi) == LRS_SHUTDOWN)
goto just_kill_connection;
- wsi->state_pre_close = wsi->state;
-
- switch (wsi->state_pre_close) {
- case LWSS_DEAD_SOCKET:
+ switch (lwsi_state_PRE_CLOSE(wsi)) {
+ case LRS_DEAD_SOCKET:
return;
/* we tried the polite way... */
- case LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION:
- case LWSS_AWAITING_CLOSE_ACK:
+ case LRS_WAITING_TO_SEND_CLOSE:
+ case LRS_AWAITING_CLOSE_ACK:
+ case LRS_RETURNED_CLOSE:
goto just_kill_connection;
- case LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE:
+ case LRS_FLUSHING_BEFORE_CLOSE:
if (wsi->trunc_len) {
lws_callback_on_writable(wsi);
return;
}
- lwsl_info("%p: end FLUSHING_STORED_SEND_BEFORE_CLOSE\n", wsi);
+ lwsl_info("%p: end LRS_FLUSHING_BEFORE_CLOSE\n", wsi);
goto just_kill_connection;
default:
if (wsi->trunc_len) {
- lwsl_info("%p: start FLUSHING_STORED_SEND_BEFORE_CLOSE\n", wsi);
- wsi->state = LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE;
- lws_set_timeout(wsi, PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE, 5);
+ lwsl_info("%p: LRS_FLUSHING_BEFORE_CLOSE\n", wsi);
+ lwsi_set_state(wsi, LRS_FLUSHING_BEFORE_CLOSE);
+ __lws_set_timeout(wsi,
+ PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE, 5);
return;
}
break;
}
- if (wsi->mode == LWSCM_WSCL_WAITING_CONNECT ||
- wsi->mode == LWSCM_WSCL_ISSUE_HANDSHAKE)
+ if (lwsi_state(wsi) == LRS_WAITING_CONNECT ||
+ lwsi_state(wsi) == LRS_H1C_ISSUE_HANDSHAKE)
goto just_kill_connection;
- if (wsi->mode == LWSCM_HTTP_SERVING ||
- wsi->mode == LWSCM_HTTP2_SERVING) {
- if (wsi->user_space)
- wsi->vhost->protocols->callback(wsi,
+ if (!wsi->told_user_closed && lwsi_role_http(wsi) &&
+ lwsi_role_server(wsi)) {
+ if (wsi->user_space && wsi->protocol &&
+ wsi->protocol_bind_balance) {
+ wsi->protocol->callback(wsi,
LWS_CALLBACK_HTTP_DROP_PROTOCOL,
wsi->user_space, NULL, 0);
- wsi->vhost->protocols->callback(wsi, LWS_CALLBACK_CLOSED_HTTP,
- wsi->user_space, NULL, 0);
- wsi->told_user_closed = 1;
- }
-
- /*
- * are his extensions okay with him closing? Eg he might be a mux
- * parent and just his ch1 aspect is closing?
- */
-
- if (lws_ext_cb_active(wsi, LWS_EXT_CB_CHECK_OK_TO_REALLY_CLOSE, NULL, 0) > 0) {
- lwsl_ext("extension vetoed close\n");
- return;
- }
-
- /*
- * flush any tx pending from extensions, since we may send close packet
- * if there are problems with send, just nuke the connection
- */
- do {
- ret = 0;
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
-
- /* show every extension the new incoming data */
-
- m = lws_ext_cb_active(wsi,
- LWS_EXT_CB_FLUSH_PENDING_TX, &eff_buf, 0);
- if (m < 0) {
- lwsl_ext("Extension reports fatal error\n");
- goto just_kill_connection;
+ wsi->protocol_bind_balance = 0;
}
- if (m)
- /*
- * at least one extension told us he has more
- * to spill, so we will go around again after
- */
- ret = 1;
-
- /* assuming they left us something to send, send it */
-
- if (eff_buf.token_len)
- if (lws_issue_raw(wsi, (unsigned char *)eff_buf.token,
- eff_buf.token_len) !=
- eff_buf.token_len) {
- lwsl_debug("close: ext spill failed\n");
- goto just_kill_connection;
- }
- } while (ret);
+ }
/*
* signal we are closing, lws_write will
* add any necessary version-specific stuff. If the write fails,
* no worries we are closing anyway. If we didn't initiate this
* close, then our state has been changed to
- * LWSS_RETURNED_CLOSE_ALREADY and we will skip this.
+ * LRS_RETURNED_CLOSE and we will skip this.
*
* Likewise if it's a second call to close this connection after we
* sent the close indication to the peer already, we are in state
- * LWSS_AWAITING_CLOSE_ACK and will skip doing this a second time.
+ * LRS_AWAITING_CLOSE_ACK and will skip doing this a second time.
*/
- if (wsi->state_pre_close == LWSS_ESTABLISHED &&
- (wsi->u.ws.close_in_ping_buffer_len || /* already a reason */
- (reason != LWS_CLOSE_STATUS_NOSTATUS &&
- (reason != LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY)))) {
- lwsl_debug("sending close indication...\n");
-
- /* if no prepared close reason, use 1000 and no aux data */
- if (!wsi->u.ws.close_in_ping_buffer_len) {
- wsi->u.ws.close_in_ping_buffer_len = 2;
- wsi->u.ws.ping_payload_buf[LWS_PRE] =
- (reason >> 8) & 0xff;
- wsi->u.ws.ping_payload_buf[LWS_PRE + 1] =
- reason & 0xff;
- }
-
-#if defined (LWS_WITH_ESP8266)
- wsi->close_is_pending_send_completion = 1;
-#endif
-
- lwsl_debug("waiting for chance to send close\n");
- wsi->waiting_to_send_close_frame = 1;
- wsi->state = LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION;
- lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_SEND, 2);
- lws_callback_on_writable(wsi);
-
+ if (wsi->role_ops->close_via_role_protocol &&
+ wsi->role_ops->close_via_role_protocol(wsi, reason))
return;
- }
just_kill_connection:
+ if (wsi->role_ops->close_kill_connection)
+ wsi->role_ops->close_kill_connection(wsi, reason);
+
lws_remove_child_from_any_parent(wsi);
n = 0;
- if (wsi->user_space) {
- lwsl_debug("%s: %p: DROP_PROTOCOL %s\n", __func__, wsi,
+ if (!wsi->told_user_closed && wsi->user_space &&
+ wsi->protocol_bind_balance) {
+ lwsl_debug("%s: %p: DROP_PROTOCOL %s\n", __func__, wsi,
wsi->protocol->name);
- wsi->protocol->callback(wsi,
- LWS_CALLBACK_HTTP_DROP_PROTOCOL,
+ wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_DROP_PROTOCOL,
wsi->user_space, NULL, 0);
+ wsi->protocol_bind_balance = 0;
}
- if ((wsi->mode == LWSCM_WSCL_WAITING_SERVER_REPLY ||
- wsi->mode == LWSCM_WSCL_WAITING_CONNECT) &&
- !wsi->already_did_cce) {
- wsi->vhost->protocols[0].callback(wsi,
- LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
+ if ((lwsi_state(wsi) == LRS_WAITING_SERVER_REPLY ||
+ lwsi_state(wsi) == LRS_WAITING_CONNECT) && !wsi->already_did_cce)
+ wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space, NULL, 0);
- }
- if (wsi->mode & LWSCM_FLAG_IMPLIES_CALLBACK_CLOSED_CLIENT_HTTP) {
- wsi->vhost->protocols[0].callback(wsi,
- LWS_CALLBACK_CLOSED_CLIENT_HTTP,
- wsi->user_space, NULL, 0);
- wsi->told_user_closed = 1;
- }
-
-
-#if LWS_POSIX
/*
* Testing with ab shows that we have to stage the socket close when
* the system is under stress... shutdown any further TX, change the
@@ -615,53 +730,38 @@ just_kill_connection:
* for the POLLIN to show a zero-size rx before coming back and doing
* the actual close.
*/
- if (wsi->mode != LWSCM_RAW &&
- !(wsi->mode & LWSCM_FLAG_IMPLIES_CALLBACK_CLOSED_CLIENT_HTTP) &&
- wsi->state != LWSS_SHUTDOWN &&
- wsi->state != LWSS_CLIENT_UNCONNECTED &&
+ if (wsi->role_ops != &role_ops_raw_skt && !lwsi_role_client(wsi) &&
+ lwsi_state(wsi) != LRS_SHUTDOWN &&
+ lwsi_state(wsi) != LRS_UNCONNECTED &&
reason != LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY &&
!wsi->socket_is_permanently_unusable) {
-#ifdef LWS_OPENSSL_SUPPORT
- if (lws_is_ssl(wsi) && wsi->ssl) {
- n = SSL_shutdown(wsi->ssl);
- /*
- * If finished the SSL shutdown, then do socket
- * shutdown, else need to retry SSL shutdown
- */
- switch (n) {
- case 0:
- lws_change_pollfd(wsi, LWS_POLLOUT, LWS_POLLIN);
- break;
- case 1:
- n = shutdown(wsi->desc.sockfd, SHUT_WR);
- break;
- default:
- if (SSL_want_read(wsi->ssl)) {
- lws_change_pollfd(wsi, 0, LWS_POLLIN);
- n = 0;
- break;
- }
- if (SSL_want_write(wsi->ssl)) {
- lws_change_pollfd(wsi, 0, LWS_POLLOUT);
- n = 0;
- break;
- }
- n = shutdown(wsi->desc.sockfd, SHUT_WR);
- break;
- }
- } else
+
+#if defined(LWS_WITH_TLS)
+ if (lws_is_ssl(wsi) && wsi->tls.ssl) {
+ n = 0;
+ switch (__lws_tls_shutdown(wsi)) {
+ case LWS_SSL_CAPABLE_DONE:
+ case LWS_SSL_CAPABLE_ERROR:
+ case LWS_SSL_CAPABLE_MORE_SERVICE_READ:
+ case LWS_SSL_CAPABLE_MORE_SERVICE_WRITE:
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ break;
+ }
+ } else
#endif
{
- lwsl_info("%s: shutdown conn: %p (sock %d, state %d)\n",
+ lwsl_info("%s: shutdown conn: %p (sock %d, state 0x%x)\n",
__func__, wsi, (int)(long)wsi->desc.sockfd,
- wsi->state);
+ lwsi_state(wsi));
if (!wsi->socket_is_permanently_unusable &&
- lws_sockfd_valid(wsi->desc.sockfd))
+ lws_socket_is_valid(wsi->desc.sockfd)) {
+ wsi->socket_is_permanently_unusable = 1;
n = shutdown(wsi->desc.sockfd, SHUT_WR);
+ }
}
if (n)
- lwsl_debug("closing: shutdown (state %d) ret %d\n",
- wsi->state, LWS_ERRNO);
+ lwsl_debug("closing: shutdown (state 0x%x) ret %d\n",
+ lwsi_state(wsi), LWS_ERRNO);
/*
* This causes problems on WINCE / ESP32 with disconnection
@@ -670,199 +770,272 @@ just_kill_connection:
#if !defined(_WIN32_WCE) && !defined(LWS_WITH_ESP32)
/* libuv: no event available to guarantee completion */
if (!wsi->socket_is_permanently_unusable &&
- lws_sockfd_valid(wsi->desc.sockfd) &&
- !LWS_LIBUV_ENABLED(context)) {
- lws_change_pollfd(wsi, LWS_POLLOUT, LWS_POLLIN);
- wsi->state = LWSS_SHUTDOWN;
- lws_set_timeout(wsi, PENDING_TIMEOUT_SHUTDOWN_FLUSH,
- context->timeout_secs);
+ lws_socket_is_valid(wsi->desc.sockfd) &&
+ lwsi_state(wsi) != LRS_SHUTDOWN &&
+ context->event_loop_ops->periodic_events_available) {
+ __lws_change_pollfd(wsi, LWS_POLLOUT, LWS_POLLIN);
+ lwsi_set_state(wsi, LRS_SHUTDOWN);
+ __lws_set_timeout(wsi, PENDING_TIMEOUT_SHUTDOWN_FLUSH,
+ context->timeout_secs);
return;
}
#endif
}
-#endif
lwsl_debug("%s: real just_kill_connection: %p (sockfd %d)\n", __func__,
wsi, wsi->desc.sockfd);
#ifdef LWS_WITH_HTTP_PROXY
- if (wsi->rw) {
- lws_rewrite_destroy(wsi->rw);
- wsi->rw = NULL;
+ if (wsi->http.rw) {
+ lws_rewrite_destroy(wsi->http.rw);
+ wsi->http.rw = NULL;
}
#endif
/*
* we won't be servicing or receiving anything further from this guy
* delete socket from the internal poll list if still present
*/
- lws_ssl_remove_wsi_from_buffered_list(wsi);
- lws_remove_from_timeout_list(wsi);
+ __lws_ssl_remove_wsi_from_buffered_list(wsi);
+ __lws_remove_from_timeout_list(wsi);
+ lws_dll_lws_remove(&wsi->dll_hrtimer);
+
+ /* don't repeat event loop stuff */
+ if (wsi->told_event_loop_closed)
+ return;
/* checking return redundant since we anyway close */
if (wsi->desc.sockfd != LWS_SOCK_INVALID)
- remove_wsi_socket_from_fds(wsi);
+ __remove_wsi_socket_from_fds(wsi);
else
lws_same_vh_protocol_remove(wsi);
-#if defined(LWS_WITH_ESP8266)
- espconn_disconnect(wsi->desc.sockfd);
-#endif
-
- wsi->state = LWSS_DEAD_SOCKET;
-
- lws_free_set_NULL(wsi->rxflow_buffer);
- if (wsi->state_pre_close == LWSS_ESTABLISHED ||
- wsi->mode == LWSCM_WS_SERVING ||
- wsi->mode == LWSCM_WS_CLIENT) {
-
- if (wsi->u.ws.rx_draining_ext) {
- struct lws **w = &pt->rx_draining_ext_list;
-
- wsi->u.ws.rx_draining_ext = 0;
- /* remove us from context draining ext list */
- while (*w) {
- if (*w == wsi) {
- *w = wsi->u.ws.rx_draining_ext_list;
- break;
- }
- w = &((*w)->u.ws.rx_draining_ext_list);
- }
- wsi->u.ws.rx_draining_ext_list = NULL;
- }
-
- if (wsi->u.ws.tx_draining_ext) {
- struct lws **w = &pt->tx_draining_ext_list;
-
- wsi->u.ws.tx_draining_ext = 0;
- /* remove us from context draining ext list */
- while (*w) {
- if (*w == wsi) {
- *w = wsi->u.ws.tx_draining_ext_list;
- break;
- }
- w = &((*w)->u.ws.tx_draining_ext_list);
- }
- wsi->u.ws.tx_draining_ext_list = NULL;
- }
- lws_free_set_NULL(wsi->u.ws.rx_ubuf);
+ lwsi_set_state(wsi, LRS_DEAD_SOCKET);
+ lws_buflist_destroy_all_segments(&wsi->buflist);
+ lws_dll_lws_remove(&wsi->dll_buflist);
- if (wsi->trunc_alloc)
- /* not going to be completed... nuke it */
- lws_free_set_NULL(wsi->trunc_alloc);
-
- wsi->u.ws.ping_payload_len = 0;
- wsi->u.ws.ping_pending_flag = 0;
- }
+ if (wsi->role_ops->close_role)
+ wsi->role_ops->close_role(pt, wsi);
/* tell the user it's all over for this guy */
- if (!wsi->told_user_closed &&
- wsi->mode != LWSCM_RAW && wsi->protocol &&
- wsi->protocol->callback &&
- (wsi->state_pre_close == LWSS_ESTABLISHED ||
- wsi->state_pre_close == LWSS_HTTP2_ESTABLISHED ||
- wsi->state_pre_close == LWSS_HTTP_BODY ||
- wsi->state_pre_close == LWSS_HTTP ||
- wsi->state_pre_close == LWSS_RETURNED_CLOSE_ALREADY ||
- wsi->state_pre_close == LWSS_AWAITING_CLOSE_ACK ||
- wsi->state_pre_close == LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION ||
- wsi->state_pre_close == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE ||
- (wsi->mode == LWSCM_WS_CLIENT && wsi->state_pre_close == LWSS_HTTP) ||
- (wsi->mode == LWSCM_WS_SERVING && wsi->state_pre_close == LWSS_HTTP))) {
- lwsl_debug("calling back CLOSED %d %d\n", wsi->mode, wsi->state);
- wsi->protocol->callback(wsi, LWS_CALLBACK_CLOSED,
- wsi->user_space, NULL, 0);
- } else if (wsi->mode == LWSCM_HTTP_SERVING_ACCEPTED) {
- lwsl_debug("calling back CLOSED_HTTP\n");
- wsi->vhost->protocols->callback(wsi, LWS_CALLBACK_CLOSED_HTTP,
- wsi->user_space, NULL, 0 );
- } else
- lwsl_debug("not calling back closed mode=%d state=%d\n",
- wsi->mode, wsi->state_pre_close);
+ if (lwsi_state_est_PRE_CLOSE(wsi) && !wsi->told_user_closed &&
+ wsi->role_ops->close_cb[lwsi_role_server(wsi)]) {
+ const struct lws_protocols *pro = wsi->protocol;
- /* deallocate any active extension contexts */
+ if (!wsi->protocol)
+ pro = &wsi->vhost->protocols[0];
- if (lws_ext_cb_active(wsi, LWS_EXT_CB_DESTROY, NULL, 0) < 0)
- lwsl_warn("extension destruction failed\n");
- /*
- * inform all extensions in case they tracked this guy out of band
- * even though not active on him specifically
- */
- if (lws_ext_cb_all_exts(context, wsi,
- LWS_EXT_CB_DESTROY_ANY_WSI_CLOSING, NULL, 0) < 0)
- lwsl_warn("ext destroy wsi failed\n");
+ pro->callback(wsi,
+ wsi->role_ops->close_cb[lwsi_role_server(wsi)],
+ wsi->user_space, NULL, 0);
+ wsi->told_user_closed = 1;
+ }
async_close:
wsi->socket_is_permanently_unusable = 1;
-#ifdef LWS_WITH_LIBUV
- if (!wsi->parent_carries_io &&
- lws_sockfd_valid(wsi->desc.sockfd))
- if (LWS_LIBUV_ENABLED(context)) {
- if (wsi->listener) {
- lwsl_debug("%s: stop listener poll\n", __func__);
- uv_poll_stop(&wsi->w_read.uv_watcher);
- }
- lwsl_debug("%s: lws_libuv_closehandle: wsi %p\n",
- __func__, wsi);
- /*
- * libuv has to do his own close handle processing
- * asynchronously
- */
- lws_libuv_closehandle(wsi);
-
+ if (wsi->context->event_loop_ops->wsi_logical_close)
+ if (wsi->context->event_loop_ops->wsi_logical_close(wsi))
return;
- }
-#endif
- lws_close_free_wsi_final(wsi);
+ __lws_close_free_wsi_final(wsi);
}
void
-lws_close_free_wsi_final(struct lws *wsi)
+__lws_close_free_wsi_final(struct lws *wsi)
{
int n;
if (lws_socket_is_valid(wsi->desc.sockfd) && !lws_ssl_close(wsi)) {
-#if LWS_POSIX
n = compatible_close(wsi->desc.sockfd);
if (n)
lwsl_debug("closing: close ret %d\n", LWS_ERRNO);
-#else
- compatible_close(wsi->desc.sockfd);
- (void)n;
-#endif
wsi->desc.sockfd = LWS_SOCK_INVALID;
}
/* outermost destroy notification for wsi (user_space still intact) */
- wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_WSI_DESTROY,
- wsi->user_space, NULL, 0);
+ if (wsi->vhost)
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_WSI_DESTROY,
+ wsi->user_space, NULL, 0);
#ifdef LWS_WITH_CGI
- if (wsi->cgi) {
+ if (wsi->http.cgi) {
for (n = 0; n < 3; n++) {
- if (wsi->cgi->pipe_fds[n][!!(n == 0)] == 0)
+ if (wsi->http.cgi->pipe_fds[n][!!(n == 0)] == 0)
lwsl_err("ZERO FD IN CGI CLOSE");
- if (wsi->cgi->pipe_fds[n][!!(n == 0)] >= 0)
- close(wsi->cgi->pipe_fds[n][!!(n == 0)]);
+ if (wsi->http.cgi->pipe_fds[n][!!(n == 0)] >= 0)
+ close(wsi->http.cgi->pipe_fds[n][!!(n == 0)]);
}
- lws_free(wsi->cgi);
+ lws_free(wsi->http.cgi);
}
#endif
- lws_free_wsi(wsi);
+ __lws_free_wsi(wsi);
+}
+
+
+void
+lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason, const char *caller)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ lws_pt_lock(pt, __func__);
+ __lws_close_free_wsi(wsi, reason, caller);
+ lws_pt_unlock(pt);
}
+/* lws_buflist */
+
+int
+lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
+ size_t len)
+{
+ struct lws_buflist *nbuf;
+ int first = !*head;
+ void *p = *head;
+ int sanity = 1024;
+
+ assert(buf);
+ assert(len);
+
+ /* append at the tail */
+ while (*head) {
+ if (!--sanity || head == &((*head)->next)) {
+ lwsl_err("%s: corrupt list points to self\n", __func__);
+ return -1;
+ }
+ head = &((*head)->next);
+ }
+
+ lwsl_info("%s: len %u first %d %p\n", __func__, (uint32_t)len, first, p);
+
+ nbuf = (struct lws_buflist *)
+ lws_malloc(sizeof(**head) + len, __func__);
+ if (!nbuf) {
+ lwsl_err("%s: OOM\n", __func__);
+ return -1;
+ }
+
+ nbuf->len = len;
+ nbuf->pos = 0;
+ nbuf->next = NULL;
+
+ p = (void *)nbuf->buf;
+ memcpy(p, buf, len);
+
+ *head = nbuf;
+
+ return first; /* returns 1 if first segment just created */
+}
+
+static int
+lws_buflist_destroy_segment(struct lws_buflist **head)
+{
+ struct lws_buflist *old = *head;
+
+ assert(*head);
+ *head = (*head)->next;
+ old->next = NULL;
+ lws_free(old);
+
+ return !*head; /* returns 1 if last segment just destroyed */
+}
+
+void
+lws_buflist_destroy_all_segments(struct lws_buflist **head)
+{
+ struct lws_buflist *p = *head, *p1;
+
+ while (p) {
+ p1 = p->next;
+ p->next = NULL;
+ lws_free(p);
+ p = p1;
+ }
+
+ *head = NULL;
+}
+
+size_t
+lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf)
+{
+ if (!*head) {
+ if (buf)
+ *buf = NULL;
+
+ return 0;
+ }
+
+ if (!(*head)->len && (*head)->next)
+ lws_buflist_destroy_segment(head);
+
+ if (!*head) {
+ if (buf)
+ *buf = NULL;
+
+ return 0;
+ }
+
+ assert((*head)->pos < (*head)->len);
+
+ if (buf)
+ *buf = (*head)->buf + (*head)->pos;
+
+ return (*head)->len - (*head)->pos;
+}
+
+int
+lws_buflist_use_segment(struct lws_buflist **head, size_t len)
+{
+ assert(*head);
+ assert(len);
+ assert((*head)->pos + len <= (*head)->len);
+
+ (*head)->pos += len;
+ if ((*head)->pos == (*head)->len)
+ lws_buflist_destroy_segment(head);
+
+ if (!*head)
+ return 0;
+
+ return (int)((*head)->len - (*head)->pos);
+}
+
+void
+lws_buflist_describe(struct lws_buflist **head, void *id)
+{
+ struct lws_buflist *old;
+ int n = 0;
+
+ if (*head == NULL)
+ lwsl_notice("%p: buflist empty\n", id);
+
+ while (*head) {
+ lwsl_notice("%p: %d: %llu / %llu (%llu left)\n", id, n,
+ (unsigned long long)(*head)->pos,
+ (unsigned long long)(*head)->len,
+ (unsigned long long)(*head)->len - (*head)->pos);
+ old = *head;
+ head = &((*head)->next);
+ if (*head == old) {
+ lwsl_err("%s: next points to self\n", __func__);
+ break;
+ }
+ n++;
+ }
+}
+
+/* ... */
+
LWS_VISIBLE LWS_EXTERN const char *
lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len)
{
- int n = 0, sl = strlen(name);
+ int n = 0, sl = (int)strlen(name);
while (lws_hdr_copy_fragment(wsi, buf, len,
WSI_TOKEN_HTTP_URI_ARGS, n) >= 0) {
@@ -876,7 +1049,7 @@ lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len)
return NULL;
}
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
+#if !defined(LWS_WITH_ESP32)
LWS_VISIBLE int
interface_to_sa(struct lws_vhost *vh, const char *ifname,
struct sockaddr_in *addr, size_t addrlen)
@@ -892,12 +1065,10 @@ interface_to_sa(struct lws_vhost *vh, const char *ifname,
#endif
#ifndef LWS_PLAT_OPTEE
-#if LWS_POSIX
static int
lws_get_addresses(struct lws_vhost *vh, void *ads, char *name,
int name_len, char *rip, int rip_len)
{
-#if LWS_POSIX
struct addrinfo ai, *res;
struct sockaddr_in addr4;
@@ -918,8 +1089,8 @@ lws_get_addresses(struct lws_vhost *vh, void *ads, char *name,
if (strncmp(rip, "::ffff:", 7) == 0)
memmove(rip, rip + 7, strlen(rip) - 6);
- getnameinfo((struct sockaddr *)ads,
- sizeof(struct sockaddr_in6), name, name_len, NULL, 0, 0);
+ getnameinfo((struct sockaddr *)ads, sizeof(struct sockaddr_in6),
+ name, name_len, NULL, 0, 0);
return 0;
} else
@@ -930,7 +1101,6 @@ lws_get_addresses(struct lws_vhost *vh, void *ads, char *name,
memset(&ai, 0, sizeof ai);
ai.ai_family = PF_UNSPEC;
ai.ai_socktype = SOCK_STREAM;
- ai.ai_flags = AI_CANONNAME;
#if !defined(LWS_WITH_ESP32)
if (getnameinfo((struct sockaddr *)ads,
sizeof(struct sockaddr_in),
@@ -963,24 +1133,12 @@ lws_get_addresses(struct lws_vhost *vh, void *ads, char *name,
return -1;
return 0;
-#else
- (void)vh;
- (void)ads;
- (void)name;
- (void)name_len;
- (void)rip;
- (void)rip_len;
-
- return -1;
-#endif
}
-#endif
LWS_VISIBLE const char *
lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
{
-#if LWS_POSIX
socklen_t len, olen;
#ifdef LWS_WITH_IPV6
struct sockaddr_in6 sin6;
@@ -989,10 +1147,7 @@ lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
int af = AF_INET;
void *p, *q;
-#if defined(LWS_WITH_HTTP2)
- if (wsi->http2_substream)
- wsi = wsi->u.h2.parent_wsi;
-#endif
+ wsi = lws_get_network_wsi(wsi);
if (wsi->parent_carries_io)
wsi = wsi->parent;
@@ -1018,13 +1173,6 @@ lws_get_peer_simple(struct lws *wsi, char *name, int namelen)
}
return lws_plat_inet_ntop(af, q, name, namelen);
-#else
-#if defined(LWS_WITH_ESP8266)
- return lws_plat_get_peer_simple(wsi, name, namelen);
-#else
- return NULL;
-#endif
-#endif
}
#endif
@@ -1033,7 +1181,6 @@ lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
int name_len, char *rip, int rip_len)
{
#ifndef LWS_PLAT_OPTEE
-#if LWS_POSIX
socklen_t len;
#ifdef LWS_WITH_IPV6
struct sockaddr_in6 sin6;
@@ -1069,7 +1216,6 @@ lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
bail:
lws_latency(context, wsi, "lws_get_peer_addresses", ret, 1);
#endif
-#endif
(void)wsi;
(void)fd;
(void)name;
@@ -1109,6 +1255,12 @@ lws_protocol_get(struct lws *wsi)
return wsi->protocol;
}
+LWS_VISIBLE const struct lws_udp *
+lws_get_udp(const struct lws *wsi)
+{
+ return wsi->udp;
+}
+
LWS_VISIBLE struct lws *
lws_get_network_wsi(struct lws *wsi)
{
@@ -1116,11 +1268,11 @@ lws_get_network_wsi(struct lws *wsi)
return NULL;
#if defined(LWS_WITH_HTTP2)
- if (!wsi->http2_substream)
+ if (!wsi->http2_substream && !wsi->client_h2_substream)
return wsi;
- while (wsi->u.h2.parent_wsi)
- wsi = wsi->u.h2.parent_wsi;
+ while (wsi->h2.parent_wsi)
+ wsi = wsi->h2.parent_wsi;
#endif
return wsi;
@@ -1206,6 +1358,29 @@ lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len)
return 0;
}
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_vhost_protocols_vhost(struct lws_vhost *vh, int reason, void *in,
+ size_t len)
+{
+ int n;
+ struct lws *wsi = lws_zalloc(sizeof(*wsi), "fake wsi");
+
+ wsi->context = vh->context;
+ wsi->vhost = vh;
+
+ for (n = 0; n < wsi->vhost->count_protocols; n++) {
+ wsi->protocol = &vh->protocols[n];
+ if (wsi->protocol->callback(wsi, reason, NULL, in, len)) {
+ lws_free(wsi);
+ return 1;
+ }
+ }
+
+ lws_free(wsi);
+
+ return 0;
+}
+
LWS_VISIBLE LWS_EXTERN void
lws_set_fops(struct lws_context *context, const struct lws_plat_file_ops *fops)
{
@@ -1278,7 +1453,7 @@ lws_vfs_select_fops(const struct lws_plat_file_ops *fops, const char *vfs_path,
pf = fops->next;
while (pf) {
n = 0;
- while (n < ARRAY_SIZE(pf->fi) && pf->fi[n].sig) {
+ while (n < (int)ARRAY_SIZE(pf->fi) && pf->fi[n].sig) {
if (p >= vfs_path + pf->fi[n].len)
if (!strncmp(p - (pf->fi[n].len - 1),
pf->fi[n].sig,
@@ -1324,10 +1499,19 @@ lws_now_secs(void)
return tv.tv_sec;
}
+LWS_VISIBLE LWS_EXTERN int
+lws_compare_time_t(struct lws_context *context, time_t t1, time_t t2)
+{
+ if (t1 < context->time_discontiguity)
+ t1 += context->time_fixup;
-#if LWS_POSIX
+ if (t2 < context->time_discontiguity)
+ t2 += context->time_fixup;
-LWS_VISIBLE int
+ return (int)(t1 - t2);
+}
+
+LWS_VISIBLE lws_sockfd_type
lws_get_socket_fd(struct lws *wsi)
{
if (!wsi)
@@ -1335,8 +1519,6 @@ lws_get_socket_fd(struct lws *wsi)
return wsi->desc.sockfd;
}
-#endif
-
#ifdef LWS_LATENCY
void
lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
@@ -1381,8 +1563,14 @@ lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
LWS_VISIBLE int
lws_rx_flow_control(struct lws *wsi, int _enable)
{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
int en = _enable;
+ // h2 ignores rx flow control atm
+ if (lwsi_role_h2(wsi) || wsi->http2_substream ||
+ lwsi_role_h2_ENCAPSULATION(wsi))
+ return 0; // !!!
+
lwsl_info("%s: %p 0x%x\n", __func__, wsi, _enable);
if (!(_enable & LWS_RXFLOW_REASON_APPLIES)) {
@@ -1395,6 +1583,8 @@ lws_rx_flow_control(struct lws *wsi, int _enable)
en |= LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT;
}
+ lws_pt_lock(pt, __func__);
+
/* any bit set in rxflow_bitmap DISABLEs rxflow control */
if (en & LWS_RXFLOW_REASON_APPLIES_ENABLE_BIT)
wsi->rxflow_bitmap &= ~(en & 0xff);
@@ -1403,16 +1593,23 @@ lws_rx_flow_control(struct lws *wsi, int _enable)
if ((LWS_RXFLOW_PENDING_CHANGE | (!wsi->rxflow_bitmap)) ==
wsi->rxflow_change_to)
- return 0;
+ goto skip;
wsi->rxflow_change_to = LWS_RXFLOW_PENDING_CHANGE | !wsi->rxflow_bitmap;
- lwsl_info("%s: 0x%p: bitmap 0x%x: en 0x%x, ch 0x%x\n", __func__, wsi,
+ lwsl_info("%s: %p: bitmap 0x%x: en 0x%x, ch 0x%x\n", __func__, wsi,
wsi->rxflow_bitmap, en, wsi->rxflow_change_to);
if (_enable & LWS_RXFLOW_REASON_FLAG_PROCESS_NOW ||
- !wsi->rxflow_will_be_applied)
- return _lws_rx_flow_control(wsi);
+ !wsi->rxflow_will_be_applied) {
+ en = __lws_rx_flow_control(wsi);
+ lws_pt_unlock(pt);
+
+ return en;
+ }
+
+skip:
+ lws_pt_unlock(pt);
return 0;
}
@@ -1437,12 +1634,63 @@ lws_rx_flow_allow_all_protocol(const struct lws_context *context,
}
}
+int
+lws_broadcast(struct lws_context *context, int reason, void *in, size_t len)
+{
+ struct lws_vhost *v = context->vhost_list;
+ struct lws wsi;
+ int n, ret = 0;
+
+ memset(&wsi, 0, sizeof(wsi));
+ wsi.context = context;
+
+ while (v) {
+ const struct lws_protocols *p = v->protocols;
+ wsi.vhost = v;
+
+ for (n = 0; n < v->count_protocols; n++) {
+ wsi.protocol = p;
+ if (p->callback &&
+ p->callback(&wsi, reason, NULL, in, len))
+ ret |= 1;
+ p++;
+ }
+ v = v->vhost_next;
+ }
+
+ return ret;
+}
+
LWS_VISIBLE extern const char *
lws_canonical_hostname(struct lws_context *context)
{
return (const char *)context->canonical_hostname;
}
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_vhost_name(struct lws_vhost *vhost)
+{
+ return vhost->name;
+}
+
+LWS_VISIBLE LWS_EXTERN int
+lws_get_vhost_port(struct lws_vhost *vhost)
+{
+ return vhost->listen_port;
+}
+
+LWS_VISIBLE LWS_EXTERN void *
+lws_get_vhost_user(struct lws_vhost *vhost)
+{
+ return vhost->user;
+}
+
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_vhost_iface(struct lws_vhost *vhost)
+{
+ return vhost->iface;
+}
+
int user_callback_handle_rxflow(lws_callback_function callback_function,
struct lws *wsi,
enum lws_callback_reasons reason, void *user,
@@ -1454,20 +1702,15 @@ int user_callback_handle_rxflow(lws_callback_function callback_function,
n = callback_function(wsi, reason, user, in, len);
wsi->rxflow_will_be_applied = 0;
if (!n)
- n = _lws_rx_flow_control(wsi);
+ n = __lws_rx_flow_control(wsi);
return n;
}
-#if defined(LWS_WITH_ESP8266)
-#undef strchr
-#define strchr ets_strchr
-#endif
-
+#if !defined(LWS_WITHOUT_CLIENT)
LWS_VISIBLE int
lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
{
-#if !defined(LWS_WITH_ESP8266)
char *p;
char authstring[96];
@@ -1478,15 +1721,15 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
if (!strncmp(proxy, "http://", 7))
proxy += 7;
- p = strchr(proxy, '@');
+ p = strrchr(proxy, '@');
if (p) { /* auth is around */
if ((unsigned int)(p - proxy) > sizeof(authstring) - 1)
goto auth_too_long;
- strncpy(authstring, proxy, p - proxy);
+ lws_strncpy(authstring, proxy, p - proxy + 1);
// null termination not needed on input
- if (lws_b64_encode_string(authstring, (p - proxy),
+ if (lws_b64_encode_string(authstring, lws_ptr_diff(p, proxy),
vhost->proxy_basic_auth_token,
sizeof vhost->proxy_basic_auth_token) < 0)
goto auth_too_long;
@@ -1497,39 +1740,38 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
} else
vhost->proxy_basic_auth_token[0] = '\0';
- strncpy(vhost->http_proxy_address, proxy,
- sizeof(vhost->http_proxy_address) - 1);
- vhost->http_proxy_address[
- sizeof(vhost->http_proxy_address) - 1] = '\0';
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ lws_strncpy(vhost->http.http_proxy_address, proxy,
+ sizeof(vhost->http.http_proxy_address));
- p = strchr(vhost->http_proxy_address, ':');
- if (!p && !vhost->http_proxy_port) {
+ p = strchr(vhost->http.http_proxy_address, ':');
+ if (!p && !vhost->http.http_proxy_port) {
lwsl_err("http_proxy needs to be ads:port\n");
return -1;
} else {
if (p) {
*p = '\0';
- vhost->http_proxy_port = atoi(p + 1);
+ vhost->http.http_proxy_port = atoi(p + 1);
}
}
- lwsl_info(" Proxy %s:%u\n", vhost->http_proxy_address,
- vhost->http_proxy_port);
-
+ lwsl_info(" Proxy %s:%u\n", vhost->http.http_proxy_address,
+ vhost->http.http_proxy_port);
+#endif
return 0;
auth_too_long:
lwsl_err("proxy auth too long\n");
-#endif
+
return -1;
}
+#endif
#if defined(LWS_WITH_SOCKS5)
LWS_VISIBLE int
lws_set_socks(struct lws_vhost *vhost, const char *socks)
{
-#if !defined(LWS_WITH_ESP8266)
char *p_at, *p_colon;
char user[96];
char password[96];
@@ -1540,7 +1782,7 @@ lws_set_socks(struct lws_vhost *vhost, const char *socks)
vhost->socks_user[0] = '\0';
vhost->socks_password[0] = '\0';
- p_at = strchr(socks, '@');
+ p_at = strrchr(socks, '@');
if (p_at) { /* auth is around */
if ((unsigned int)(p_at - socks) > (sizeof(user)
+ sizeof(password) - 2)) {
@@ -1561,9 +1803,9 @@ lws_set_socks(struct lws_vhost *vhost, const char *socks)
goto bail;
}
- strncpy(vhost->socks_user, socks, p_colon - socks);
- strncpy(vhost->socks_password, p_colon + 1,
- p_at - (p_colon + 1));
+ lws_strncpy(vhost->socks_user, socks, p_colon - socks + 1);
+ lws_strncpy(vhost->socks_password, p_colon + 1,
+ p_at - (p_colon + 1) + 1);
}
lwsl_info(" Socks auth, user: %s, password: %s\n",
@@ -1572,10 +1814,8 @@ lws_set_socks(struct lws_vhost *vhost, const char *socks)
socks = p_at + 1;
}
- strncpy(vhost->socks_proxy_address, socks,
- sizeof(vhost->socks_proxy_address) - 1);
- vhost->socks_proxy_address[sizeof(vhost->socks_proxy_address) - 1]
- = '\0';
+ lws_strncpy(vhost->socks_proxy_address, socks,
+ sizeof(vhost->socks_proxy_address));
p_colon = strchr(vhost->socks_proxy_address, ':');
if (!p_colon && !vhost->socks_proxy_port) {
@@ -1594,7 +1834,6 @@ lws_set_socks(struct lws_vhost *vhost, const char *socks)
return 0;
bail:
-#endif
return -1;
}
#endif
@@ -1605,27 +1844,6 @@ lws_get_protocol(struct lws *wsi)
return wsi->protocol;
}
-LWS_VISIBLE int
-lws_is_final_fragment(struct lws *wsi)
-{
- lwsl_info("%s: final %d, rx pk length %ld, draining %ld\n", __func__,
- wsi->u.ws.final, (long)wsi->u.ws.rx_packet_length,
- (long)wsi->u.ws.rx_draining_ext);
- return wsi->u.ws.final && !wsi->u.ws.rx_packet_length &&
- !wsi->u.ws.rx_draining_ext;
-}
-
-LWS_VISIBLE int
-lws_is_first_fragment(struct lws *wsi)
-{
- return wsi->u.ws.first_fragment;
-}
-
-LWS_VISIBLE unsigned char
-lws_get_reserved_bits(struct lws *wsi)
-{
- return wsi->u.ws.rsv;
-}
int
lws_ensure_user_space(struct lws *wsi)
@@ -1636,7 +1854,8 @@ lws_ensure_user_space(struct lws *wsi)
/* allocate the per-connection user memory (if any) */
if (wsi->protocol->per_session_data_size && !wsi->user_space) {
- wsi->user_space = lws_zalloc(wsi->protocol->per_session_data_size, "user space");
+ wsi->user_space = lws_zalloc(
+ wsi->protocol->per_session_data_size, "user space");
if (wsi->user_space == NULL) {
lwsl_err("%s: OOM\n", __func__);
return 1;
@@ -1701,10 +1920,14 @@ lwsl_timestamp(int level, char *p, int len)
(int)(now % 10000), log_level_names[n]);
return n;
}
+#else
+ p[0] = '\0';
#endif
+
return 0;
}
+#ifndef LWS_PLAT_OPTEE
static const char * const colours[] = {
"[31;1m", /* LLL_ERR */
"[36;1m", /* LLL_WARN */
@@ -1719,17 +1942,14 @@ static const char * const colours[] = {
"[30;1m", /* LLL_USER */
};
-#ifndef LWS_PLAT_OPTEE
LWS_VISIBLE void lwsl_emit_stderr(int level, const char *line)
{
-#if !defined(LWS_WITH_ESP8266)
char buf[50];
- static char tty;
+ static char tty = 3;
int n, m = ARRAY_SIZE(colours) - 1;
if (!tty)
tty = isatty(2) | 2;
-
lwsl_timestamp(level, buf, sizeof(buf));
if (tty == 3) {
@@ -1743,17 +1963,12 @@ LWS_VISIBLE void lwsl_emit_stderr(int level, const char *line)
fprintf(stderr, "%c%s%s%s%c[0m", 27, colours[m], buf, line, 27);
} else
fprintf(stderr, "%s%s", buf, line);
-#endif
}
#endif
LWS_VISIBLE void _lws_logv(int filter, const char *format, va_list vl)
{
-#if defined(LWS_WITH_ESP8266)
- char buf[128];
-#else
char buf[256];
-#endif
int n;
if (!(log_level & filter))
@@ -1761,15 +1976,11 @@ LWS_VISIBLE void _lws_logv(int filter, const char *format, va_list vl)
n = vsnprintf(buf, sizeof(buf) - 1, format, vl);
(void)n;
-#if defined(LWS_WITH_ESP8266)
- buf[sizeof(buf) - 1] = '\0';
-#else
/* vnsprintf returns what it would have written, even if truncated */
- if (n > sizeof(buf) - 1)
+ if (n > (int)sizeof(buf) - 1)
n = sizeof(buf) - 1;
if (n > 0)
buf[n] = '\0';
-#endif
lwsl_emit(filter, buf);
}
@@ -1807,6 +2018,12 @@ lwsl_hexdump_level(int hexdump_level, const void *vbuf, size_t len)
if (!lwsl_visible(hexdump_level))
return;
+ if (!len)
+ return;
+
+ if (!vbuf)
+ return;
+
_lws_log(hexdump_level, "\n");
for (n = 0; n < len;) {
@@ -1849,19 +2066,19 @@ lwsl_hexdump(const void *vbuf, size_t len)
LWS_VISIBLE int
lws_is_ssl(struct lws *wsi)
{
-#ifdef LWS_OPENSSL_SUPPORT
- return wsi->use_ssl;
+#if defined(LWS_WITH_TLS)
+ return wsi->tls.use_ssl & LCCSCF_USE_SSL;
#else
(void)wsi;
return 0;
#endif
}
-#ifdef LWS_OPENSSL_SUPPORT
-LWS_VISIBLE SSL*
+#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
+LWS_VISIBLE lws_tls_conn*
lws_get_ssl(struct lws *wsi)
{
- return wsi->ssl;
+ return wsi->tls.ssl;
}
#endif
@@ -1871,27 +2088,28 @@ lws_partial_buffered(struct lws *wsi)
return !!wsi->trunc_len;
}
-LWS_VISIBLE size_t
+LWS_VISIBLE lws_fileofs_t
lws_get_peer_write_allowance(struct lws *wsi)
{
-#ifdef LWS_WITH_HTTP2
- /* only if we are using HTTP2 on this connection */
- if (wsi->mode != LWSCM_HTTP2_SERVING)
- return -1;
-
- return lws_h2_tx_cr_get(wsi);
-#else
- (void)wsi;
- return -1;
-#endif
+ return wsi->role_ops->tx_credit(wsi);
}
LWS_VISIBLE void
-lws_union_transition(struct lws *wsi, enum connection_mode mode)
+lws_role_transition(struct lws *wsi, enum lwsi_role role, enum lwsi_state state,
+ struct lws_role_ops *ops)
{
- lwsl_debug("%s: %p: mode %d\n", __func__, wsi, mode);
- memset(&wsi->u, 0, sizeof(wsi->u));
- wsi->mode = mode;
+#if defined(_DEBUG)
+ const char *name = "(unset)";
+#endif
+ wsi->wsistate = role | state;
+ if (ops)
+ wsi->role_ops = ops;
+#if defined(_DEBUG)
+ if (wsi->role_ops)
+ name = wsi->role_ops->name;
+ lwsl_debug("%s: %p: wsistate 0x%x, ops %s\n", __func__, wsi,
+ wsi->wsistate, name);
+#endif
}
LWS_VISIBLE struct lws_plat_file_ops *
@@ -1970,48 +2188,21 @@ lws_clear_child_pending_on_writable(struct lws *wsi)
wsi->parent_pending_cb_on_writable = 0;
}
-LWS_VISIBLE LWS_EXTERN int
-lws_get_close_length(struct lws *wsi)
-{
- return wsi->u.ws.close_in_ping_buffer_len;
-}
-
-LWS_VISIBLE LWS_EXTERN unsigned char *
-lws_get_close_payload(struct lws *wsi)
-{
- return &wsi->u.ws.ping_payload_buf[LWS_PRE];
-}
-
-LWS_VISIBLE LWS_EXTERN void
-lws_close_reason(struct lws *wsi, enum lws_close_status status,
- unsigned char *buf, size_t len)
-{
- unsigned char *p, *start;
- int budget = sizeof(wsi->u.ws.ping_payload_buf) - LWS_PRE;
-
- assert(wsi->mode == LWSCM_WS_SERVING || wsi->mode == LWSCM_WS_CLIENT);
-
- start = p = &wsi->u.ws.ping_payload_buf[LWS_PRE];
-
- *p++ = (((int)status) >> 8) & 0xff;
- *p++ = ((int)status) & 0xff;
-
- if (buf)
- while (len-- && p < start + budget)
- *p++ = *buf++;
-
- wsi->u.ws.close_in_ping_buffer_len = p - start;
-}
LWS_EXTERN int
-_lws_rx_flow_control(struct lws *wsi)
+__lws_rx_flow_control(struct lws *wsi)
{
struct lws *wsic = wsi->child_list;
+ // h2 ignores rx flow control atm
+ if (lwsi_role_h2(wsi) || wsi->http2_substream ||
+ lwsi_role_h2_ENCAPSULATION(wsi))
+ return 0; // !!!
+
/* if he has children, do those if they were changed */
while (wsic) {
if (wsic->rxflow_change_to & LWS_RXFLOW_PENDING_CHANGE)
- _lws_rx_flow_control(wsic);
+ __lws_rx_flow_control(wsic);
wsic = wsic->sibling_list;
}
@@ -2021,13 +2212,13 @@ _lws_rx_flow_control(struct lws *wsi)
return 0;
/* stuff is still buffered, not ready to really accept new input */
- if (wsi->rxflow_buffer) {
+ if (lws_buflist_next_segment_len(&wsi->buflist, NULL)) {
/* get ourselves called back to deal with stashed buffer */
lws_callback_on_writable(wsi);
return 0;
}
- /* pending is cleared, we can change rxflow state */
+ /* now the pending is cleared, we can change rxflow state */
wsi->rxflow_change_to &= ~LWS_RXFLOW_PENDING_CHANGE;
@@ -2037,12 +2228,12 @@ _lws_rx_flow_control(struct lws *wsi)
/* adjust the pollfd for this wsi */
if (wsi->rxflow_change_to & LWS_RXFLOW_ALLOW) {
- if (lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
+ if (__lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
lwsl_info("%s: fail\n", __func__);
return -1;
}
} else
- if (lws_change_pollfd(wsi, LWS_POLLIN, 0))
+ if (__lws_change_pollfd(wsi, LWS_POLLIN, 0))
return -1;
return 0;
@@ -2159,14 +2350,14 @@ lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
return 0;
}
-#ifdef LWS_NO_EXTENSIONS
+#if defined(LWS_WITHOUT_EXTENSIONS)
/* we need to provide dummy callbacks for internal exts
* so user code runs when faced with a lib compiled with
* extensions disabled.
*/
-int
+LWS_VISIBLE int
lws_extension_callback_pm_deflate(struct lws_context *context,
const struct lws_extension *ext,
struct lws *wsi,
@@ -2183,13 +2374,19 @@ lws_extension_callback_pm_deflate(struct lws_context *context,
return 0;
}
+
+LWS_EXTERN int
+lws_set_extension_option(struct lws *wsi, const char *ext_name,
+ const char *opt_name, const char *opt_val)
+{
+ return -1;
+}
#endif
LWS_EXTERN int
lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
const char *iface)
{
-#if LWS_POSIX
#ifdef LWS_WITH_UNIX_SOCK
struct sockaddr_un serv_unix;
#endif
@@ -2201,6 +2398,9 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
socklen_t len = sizeof(struct sockaddr_storage);
#endif
int n;
+#if !defined(LWS_WITH_ESP32)
+ int m;
+#endif
struct sockaddr_storage sin;
struct sockaddr *v;
@@ -2210,6 +2410,8 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
n = sizeof(struct sockaddr_un);
bzero((char *) &serv_unix, sizeof(serv_unix));
serv_unix.sun_family = AF_UNIX;
+ if (!iface)
+ return -1;
if (sizeof(serv_unix.sun_path) <= strlen(iface)) {
lwsl_err("\"%s\" too long for UNIX domain socket\n",
iface);
@@ -2227,10 +2429,17 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
n = sizeof(struct sockaddr_in6);
bzero((char *) &serv_addr6, sizeof(serv_addr6));
if (iface) {
- if (interface_to_sa(vhost, iface,
- (struct sockaddr_in *)v, n) < 0) {
- lwsl_err("Unable to find if %s\n", iface);
- return -1;
+ m = interface_to_sa(vhost, iface,
+ (struct sockaddr_in *)v, n);
+ if (m == LWS_ITOSA_NOT_USABLE) {
+ lwsl_info("%s: netif %s: Not usable\n",
+ __func__, iface);
+ return m;
+ }
+ if (m == LWS_ITOSA_NOT_EXIST) {
+ lwsl_info("%s: netif %s: Does not exist\n",
+ __func__, iface);
+ return m;
}
serv_addr6.sin6_scope_id = lws_get_addr_scope(iface);
}
@@ -2247,16 +2456,28 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
serv_addr4.sin_family = AF_INET;
#if !defined(LWS_WITH_ESP32)
- if (iface &&
- interface_to_sa(vhost, iface,
- (struct sockaddr_in *)v, n) < 0) {
- lwsl_err("Unable to find interface %s\n", iface);
- return -1;
+ if (iface) {
+ m = interface_to_sa(vhost, iface,
+ (struct sockaddr_in *)v, n);
+ if (m == LWS_ITOSA_NOT_USABLE) {
+ lwsl_info("%s: netif %s: Not usable\n",
+ __func__, iface);
+ return m;
+ }
+ if (m == LWS_ITOSA_NOT_EXIST) {
+ lwsl_info("%s: netif %s: Does not exist\n",
+ __func__, iface);
+ return m;
+ }
}
#endif
serv_addr4.sin_port = htons(port);
} /* ipv4 */
+ /* just checking for the interface extant */
+ if (sockfd == LWS_SOCK_INVALID)
+ return 0;
+
n = bind(sockfd, v, n);
#ifdef LWS_WITH_UNIX_SOCK
if (n < 0 && LWS_UNIX_SOCK_ENABLED(vhost)) {
@@ -2278,8 +2499,8 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
#endif
#if defined(LWS_WITH_IPV6)
port = (sin.ss_family == AF_INET6) ?
- ntohs(((struct sockaddr_in6 *) &sin)->sin6_port) :
- ntohs(((struct sockaddr_in *) &sin)->sin_port);
+ ntohs(((struct sockaddr_in6 *) &sin)->sin6_port) :
+ ntohs(((struct sockaddr_in *) &sin)->sin_port);
#else
{
struct sockaddr_in sain;
@@ -2287,11 +2508,16 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
port = ntohs(sain.sin_port);
}
#endif
-#endif
return port;
}
+LWS_VISIBLE LWS_EXTERN int
+lws_get_vhost_listen_port(struct lws_vhost *vhost)
+{
+ return vhost->listen_port;
+}
+
#if defined(LWS_WITH_IPV6)
LWS_EXTERN unsigned long
lws_get_addr_scope(const char *ipaddr)
@@ -2365,7 +2591,8 @@ lws_get_addr_scope(const char *ipaddr)
while (adapter && !found) {
addr = adapter->FirstUnicastAddress;
while (addr && !found) {
- if (addr->Address.lpSockaddr->sa_family == AF_INET6) {
+ if (addr->Address.lpSockaddr->sa_family ==
+ AF_INET6) {
sockaddr = (struct sockaddr_in6 *)
(addr->Address.lpSockaddr);
@@ -2392,18 +2619,73 @@ lws_get_addr_scope(const char *ipaddr)
}
#endif
-LWS_EXTERN void
-lws_restart_ws_ping_pong_timer(struct lws *wsi)
+#if !defined(LWS_NO_SERVER)
+
+LWS_EXTERN struct lws *
+lws_create_adopt_udp(struct lws_vhost *vhost, int port, int flags,
+ const char *protocol_name, struct lws *parent_wsi)
{
- if (!wsi->context->ws_ping_pong_interval)
- return;
- if (wsi->state != LWSS_ESTABLISHED)
- return;
+ lws_sock_file_fd_type sock;
+ struct addrinfo h, *r, *rp;
+ struct lws *wsi = NULL;
+ char buf[16];
+ int n;
- wsi->u.ws.time_next_ping_check = (time_t)lws_now_secs() +
- wsi->context->ws_ping_pong_interval;
+ memset(&h, 0, sizeof(h));
+ h.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
+ h.ai_socktype = SOCK_DGRAM;
+ h.ai_protocol = IPPROTO_UDP;
+ h.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+
+ lws_snprintf(buf, sizeof(buf), "%u", port);
+ n = getaddrinfo(NULL, buf, &h, &r);
+ if (n) {
+ lwsl_info("%s: getaddrinfo error: %s\n", __func__,
+ gai_strerror(n));
+ goto bail;
+ }
+
+ for (rp = r; rp; rp = rp->ai_next) {
+ sock.sockfd = socket(rp->ai_family, rp->ai_socktype,
+ rp->ai_protocol);
+ if (sock.sockfd >= 0)
+ break;
+ }
+ if (!rp) {
+ lwsl_err("%s: unable to create INET socket\n", __func__);
+ goto bail1;
+ }
+
+ if ((flags & LWS_CAUDP_BIND) && bind(sock.sockfd, rp->ai_addr,
+#if defined(_WIN32)
+ (int)rp->ai_addrlen
+#else
+ rp->ai_addrlen
+#endif
+ ) == -1) {
+ lwsl_err("%s: bind failed\n", __func__);
+ goto bail2;
+ }
+
+ wsi = lws_adopt_descriptor_vhost(vhost, LWS_ADOPT_RAW_SOCKET_UDP, sock,
+ protocol_name, parent_wsi);
+ if (!wsi)
+ lwsl_err("%s: udp adoption failed\n", __func__);
+
+bail2:
+ if (!wsi)
+ close((int)sock.sockfd);
+bail1:
+ freeaddrinfo(r);
+
+bail:
+ return wsi;
}
+#endif
+
+
+
static const char *hex = "0123456789ABCDEF";
LWS_VISIBLE LWS_EXTERN const char *
@@ -2455,6 +2737,27 @@ lws_json_purify(char *escaped, const char *string, int len)
return escaped;
}
+LWS_VISIBLE LWS_EXTERN void
+lws_filename_purify_inplace(char *filename)
+{
+ while (*filename) {
+
+ if (*filename == '.' && filename[1] == '.') {
+ *filename = '_';
+ filename[1] = '_';
+ }
+
+ if (*filename == ':' ||
+ *filename == '/' ||
+ *filename == '\\' ||
+ *filename == '$' ||
+ *filename == '%')
+ *filename = '_';
+
+ filename++;
+ }
+}
+
LWS_VISIBLE LWS_EXTERN const char *
lws_urlencode(char *escaped, const char *string, int len)
{
@@ -2567,32 +2870,42 @@ lws_snprintf(char *str, size_t size, const char *format, ...)
va_end(ap);
if (n >= (int)size)
- return size;
+ return (int)size;
return n;
}
+char *
+lws_strncpy(char *dest, const char *src, size_t size)
+{
+ strncpy(dest, src, size - 1);
+ dest[size - 1] = '\0';
+
+ return dest;
+}
+
LWS_VISIBLE LWS_EXTERN int
lws_is_cgi(struct lws *wsi) {
#ifdef LWS_WITH_CGI
- return !!wsi->cgi;
+ return !!wsi->http.cgi;
#else
return 0;
#endif
}
+const struct lws_protocol_vhost_options *
+lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name)
+{
+ while (pvo) {
+ if (!strcmp(pvo->name, name))
+ break;
+ pvo = pvo->next;
+ }
-#ifdef LWS_NO_EXTENSIONS
-LWS_EXTERN int
-lws_set_extension_option(struct lws *wsi, const char *ext_name,
- const char *opt_name, const char *opt_val)
-{
- return -1;
+ return pvo;
}
-#endif
-
void
lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs)
@@ -2616,11 +2929,34 @@ lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs)
}
}
+const char *
+lws_cmdline_option(int argc, const char **argv, const char *val)
+{
+ int n = (int)strlen(val), c = argc;
+
+ while (--c > 0) {
+
+ if (!strncmp(argv[c], val, n)) {
+ if (!*(argv[c] + n) && c < argc - 1) {
+ /* coverity treats unchecked argv as "tainted" */
+ if (!argv[c + 1] || strlen(argv[c + 1]) > 1024)
+ return NULL;
+ return argv[c + 1];
+ }
+
+ return argv[c] + n;
+ }
+ }
+
+ return NULL;
+}
+
#ifdef LWS_WITH_SERVER_STATUS
LWS_EXTERN int
lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)
{
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
static const char * const prots[] = {
"http://",
"https://",
@@ -2630,6 +2966,7 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)
">https://",
"callback://"
};
+#endif
char *orig = buf, *end = buf + len - 1, first = 1;
int n = 0;
@@ -2653,8 +2990,8 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)
" \"h2_subs\":\"%lu\""
,
vh->name, vh->listen_port,
-#ifdef LWS_OPENSSL_SUPPORT
- vh->use_ssl,
+#if defined(LWS_WITH_TLS)
+ vh->tls.use_ssl & LCCSCF_USE_SSL,
#else
0,
#endif
@@ -2669,9 +3006,9 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)
vh->conn_stats.h2_alpn,
vh->conn_stats.h2_subs
);
-
- if (vh->mount_list) {
- const struct lws_http_mount *m = vh->mount_list;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ if (vh->http.mount_list) {
+ const struct lws_http_mount *m = vh->http.mount_list;
buf += lws_snprintf(buf, end - buf, ",\n \"mounts\":[");
while (m) {
@@ -2702,7 +3039,7 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)
}
buf += lws_snprintf(buf, end - buf, "\n ]");
}
-
+#endif
if (vh->protocols) {
n = 0;
first = 1;
@@ -2795,8 +3132,8 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len,
" \"ah_wait_list\":\"%d\"\n"
" }",
pt->fds_count,
- pt->ah_count_in_use,
- pt->ah_wait_list_length);
+ pt->http.ah_count_in_use,
+ pt->http.ah_wait_list_length);
}
buf += lws_snprintf(buf, end - buf, "]");
@@ -2847,7 +3184,7 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len,
#ifdef LWS_WITH_CGI
for (n = 0; n < context->count_threads; n++) {
pt = &context->pt[n];
- pcgi = &pt->cgi_list;
+ pcgi = &pt->http.cgi_list;
while (*pcgi) {
pcgi = &(*pcgi)->cgi_list;
@@ -2895,63 +3232,117 @@ lws_stats_log_dump(struct lws_context *context)
lwsl_notice("\n");
lwsl_notice("LWS internal statistics dump ----->\n");
- lwsl_notice("LWSSTATS_C_CONNECTIONS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_CONNECTIONS));
- lwsl_notice("LWSSTATS_C_API_CLOSE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_CLOSE));
- lwsl_notice("LWSSTATS_C_API_READ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_READ));
- lwsl_notice("LWSSTATS_C_API_LWS_WRITE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_LWS_WRITE));
- lwsl_notice("LWSSTATS_C_API_WRITE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_WRITE));
- lwsl_notice("LWSSTATS_C_WRITE_PARTIALS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITE_PARTIALS));
- lwsl_notice("LWSSTATS_C_WRITEABLE_CB_REQ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB_REQ));
- lwsl_notice("LWSSTATS_C_WRITEABLE_CB_EFF_REQ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB_EFF_REQ));
- lwsl_notice("LWSSTATS_C_WRITEABLE_CB: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB));
- lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN));
- lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_FAILED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_FAILED));
- lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED));
- lwsl_notice("LWSSTATS_C_SSL_CONNS_HAD_RX: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNS_HAD_RX));
- lwsl_notice("LWSSTATS_C_PEER_LIMIT_AH_DENIED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_PEER_LIMIT_AH_DENIED));
- lwsl_notice("LWSSTATS_C_PEER_LIMIT_WSI_DENIED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_PEER_LIMIT_WSI_DENIED));
-
- lwsl_notice("LWSSTATS_C_TIMEOUTS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_TIMEOUTS));
- lwsl_notice("LWSSTATS_C_SERVICE_ENTRY: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SERVICE_ENTRY));
- lwsl_notice("LWSSTATS_B_READ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_B_READ));
- lwsl_notice("LWSSTATS_B_WRITE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_B_WRITE));
- lwsl_notice("LWSSTATS_B_PARTIALS_ACCEPTED_PARTS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_B_PARTIALS_ACCEPTED_PARTS));
- lwsl_notice("LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY: %8llums\n", (unsigned long long)lws_stats_get(context, LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) / 1000);
+ lwsl_notice("LWSSTATS_C_CONNECTIONS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_CONNECTIONS));
+ lwsl_notice("LWSSTATS_C_API_CLOSE: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_CLOSE));
+ lwsl_notice("LWSSTATS_C_API_READ: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_READ));
+ lwsl_notice("LWSSTATS_C_API_LWS_WRITE: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_LWS_WRITE));
+ lwsl_notice("LWSSTATS_C_API_WRITE: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_WRITE));
+ lwsl_notice("LWSSTATS_C_WRITE_PARTIALS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITE_PARTIALS));
+ lwsl_notice("LWSSTATS_C_WRITEABLE_CB_REQ: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITEABLE_CB_REQ));
+ lwsl_notice("LWSSTATS_C_WRITEABLE_CB_EFF_REQ: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITEABLE_CB_EFF_REQ));
+ lwsl_notice("LWSSTATS_C_WRITEABLE_CB: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITEABLE_CB));
+ lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN));
+ lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_FAILED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_FAILED));
+ lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED));
+ lwsl_notice("LWSSTATS_C_SSL_CONNS_HAD_RX: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNS_HAD_RX));
+ lwsl_notice("LWSSTATS_C_PEER_LIMIT_AH_DENIED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_PEER_LIMIT_AH_DENIED));
+ lwsl_notice("LWSSTATS_C_PEER_LIMIT_WSI_DENIED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_PEER_LIMIT_WSI_DENIED));
+
+ lwsl_notice("LWSSTATS_C_TIMEOUTS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_TIMEOUTS));
+ lwsl_notice("LWSSTATS_C_SERVICE_ENTRY: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SERVICE_ENTRY));
+ lwsl_notice("LWSSTATS_B_READ: %8llu\n",
+ (unsigned long long)lws_stats_get(context, LWSSTATS_B_READ));
+ lwsl_notice("LWSSTATS_B_WRITE: %8llu\n",
+ (unsigned long long)lws_stats_get(context, LWSSTATS_B_WRITE));
+ lwsl_notice("LWSSTATS_B_PARTIALS_ACCEPTED_PARTS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_B_PARTIALS_ACCEPTED_PARTS));
+ lwsl_notice("LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY: %8llums\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) / 1000);
if (lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED))
lwsl_notice(" Avg accept delay: %8llums\n",
- (unsigned long long)(lws_stats_get(context, LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) /
- lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED)) / 1000);
- lwsl_notice("LWSSTATS_MS_SSL_RX_DELAY: %8llums\n", (unsigned long long)lws_stats_get(context, LWSSTATS_MS_SSL_RX_DELAY) / 1000);
+ (unsigned long long)(lws_stats_get(context,
+ LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) /
+ lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED)) / 1000);
+ lwsl_notice("LWSSTATS_MS_SSL_RX_DELAY: %8llums\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_SSL_RX_DELAY) / 1000);
if (lws_stats_get(context, LWSSTATS_C_SSL_CONNS_HAD_RX))
lwsl_notice(" Avg accept-rx delay: %8llums\n",
- (unsigned long long)(lws_stats_get(context, LWSSTATS_MS_SSL_RX_DELAY) /
- lws_stats_get(context, LWSSTATS_C_SSL_CONNS_HAD_RX)) / 1000);
+ (unsigned long long)(lws_stats_get(context,
+ LWSSTATS_MS_SSL_RX_DELAY) /
+ lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNS_HAD_RX)) / 1000);
lwsl_notice("LWSSTATS_MS_WRITABLE_DELAY: %8lluus\n",
- (unsigned long long)lws_stats_get(context, LWSSTATS_MS_WRITABLE_DELAY));
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_WRITABLE_DELAY));
lwsl_notice("LWSSTATS_MS_WORST_WRITABLE_DELAY: %8lluus\n",
- (unsigned long long)lws_stats_get(context, LWSSTATS_MS_WORST_WRITABLE_DELAY));
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_WORST_WRITABLE_DELAY));
if (lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB))
lwsl_notice(" Avg writable delay: %8lluus\n",
- (unsigned long long)(lws_stats_get(context, LWSSTATS_MS_WRITABLE_DELAY) /
+ (unsigned long long)(lws_stats_get(context,
+ LWSSTATS_MS_WRITABLE_DELAY) /
lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB)));
- lwsl_notice("Simultaneous SSL restriction: %8d/%d/%d\n", context->simultaneous_ssl,
- context->simultaneous_ssl_restriction, context->ssl_gate_accepts);
+ lwsl_notice("Simultaneous SSL restriction: %8d/%d\n",
+ context->simultaneous_ssl,
+ context->simultaneous_ssl_restriction);
- lwsl_notice("Live wsi: %8d\n", context->count_wsi_allocated);
+ lwsl_notice("Live wsi: %8d\n",
+ context->count_wsi_allocated);
context->updated = 1;
while (v) {
- if (v->lserv_wsi) {
+ if (v->lserv_wsi &&
+ v->lserv_wsi->position_in_fds_table != LWS_NO_FDS_POS) {
- struct lws_context_per_thread *pt = &context->pt[(int)v->lserv_wsi->tsi];
+ struct lws_context_per_thread *pt =
+ &context->pt[(int)v->lserv_wsi->tsi];
struct lws_pollfd *pfd;
pfd = &pt->fds[v->lserv_wsi->position_in_fds_table];
lwsl_notice(" Listen port %d actual POLLIN: %d\n",
- v->listen_port, (int)pfd->events & LWS_POLLIN);
+ v->listen_port,
+ (int)pfd->events & LWS_POLLIN);
}
v = v->vhost_next;
@@ -2964,20 +3355,20 @@ lws_stats_log_dump(struct lws_context *context)
lwsl_notice("PT %d\n", n + 1);
- lws_pt_lock(pt);
+ lws_pt_lock(pt, __func__);
lwsl_notice(" AH in use / max: %d / %d\n",
- pt->ah_count_in_use,
+ pt->http.ah_count_in_use,
context->max_http_header_pool);
- wl = pt->ah_wait_list;
+ wl = pt->http.ah_wait_list;
while (wl) {
m++;
- wl = wl->u.hdr.ah_wait_list;
+ wl = wl->ah_wait_list;
}
lwsl_notice(" AH wait list count / actual: %d / %d\n",
- pt->ah_wait_list_length, m);
+ pt->http.ah_wait_list_length, m);
lws_pt_unlock(pt);
}
@@ -3001,15 +3392,20 @@ lws_stats_log_dump(struct lws_context *context)
for (n = 0; n < (int)context->pl_hash_elements; n++) {
char buf[72];
- lws_start_foreach_llp(struct lws_peer **, peer, context->pl_hash_table[n]) {
+ lws_start_foreach_llp(struct lws_peer **, peer,
+ context->pl_hash_table[n]) {
struct lws_peer *df = *peer;
if (!lws_plat_inet_ntop(df->af, df->addr, buf,
sizeof(buf) - 1))
strcpy(buf, "unknown");
-
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
lwsl_notice(" peer %s: count wsi: %d, count ah: %d\n",
buf, df->count_wsi, df->count_ah);
+#else
+ lwsl_notice(" peer %s: count wsi: %d\n",
+ buf, df->count_wsi);
+#endif
if (!--m)
break;
@@ -3025,23 +3421,23 @@ void
lws_stats_atomic_bump(struct lws_context * context,
struct lws_context_per_thread *pt, int index, uint64_t bump)
{
- lws_pt_lock(pt);
+ lws_pt_stats_lock(pt);
context->lws_stats[index] += bump;
if (index != LWSSTATS_C_SERVICE_ENTRY)
context->updated = 1;
- lws_pt_unlock(pt);
+ lws_pt_stats_unlock(pt);
}
void
lws_stats_atomic_max(struct lws_context * context,
struct lws_context_per_thread *pt, int index, uint64_t val)
{
- lws_pt_lock(pt);
+ lws_pt_stats_lock(pt);
if (val > context->lws_stats[index]) {
context->lws_stats[index] = val;
context->updated = 1;
}
- lws_pt_unlock(pt);
+ lws_pt_stats_unlock(pt);
}
#endif
diff --git a/thirdparty/libwebsockets/core/output.c b/thirdparty/libwebsockets/core/output.c
new file mode 100644
index 0000000000..e2ff18ef27
--- /dev/null
+++ b/thirdparty/libwebsockets/core/output.c
@@ -0,0 +1,308 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+/*
+ * notice this returns number of bytes consumed, or -1
+ */
+int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
+{
+ struct lws_context *context = lws_get_context(wsi);
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ size_t real_len = len;
+ unsigned int n;
+
+ // lwsl_hexdump_err(buf, len);
+
+ /*
+ * Detect if we got called twice without going through the
+ * event loop to handle pending. This would be caused by either
+ * back-to-back writes in one WRITABLE (illegal) or calling lws_write()
+ * from outside the WRITABLE callback (illegal).
+ */
+ if (wsi->could_have_pending) {
+ lwsl_hexdump_level(LLL_ERR, buf, len);
+ lwsl_err("** %p: vh: %s, prot: %s, role %s: "
+ "Illegal back-to-back write of %lu detected...\n",
+ wsi, wsi->vhost->name, wsi->protocol->name,
+ wsi->role_ops->name,
+ (unsigned long)len);
+ // assert(0);
+
+ return -1;
+ }
+
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_WRITE, 1);
+
+ if (!len)
+ return 0;
+ /* just ignore sends after we cleared the truncation buffer */
+ if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE && !wsi->trunc_len)
+ return (int)len;
+
+ if (wsi->trunc_len && (buf < wsi->trunc_alloc ||
+ buf > (wsi->trunc_alloc + wsi->trunc_len + wsi->trunc_offset))) {
+ lwsl_hexdump_level(LLL_ERR, buf, len);
+ lwsl_err("** %p: vh: %s, prot: %s, Sending new %lu, pending truncated ...\n"
+ " It's illegal to do an lws_write outside of\n"
+ " the writable callback: fix your code\n",
+ wsi, wsi->vhost->name, wsi->protocol->name,
+ (unsigned long)len);
+ assert(0);
+
+ return -1;
+ }
+
+ if (!wsi->http2_substream && !lws_socket_is_valid(wsi->desc.sockfd))
+ lwsl_warn("** error invalid sock but expected to send\n");
+
+ /* limit sending */
+ if (wsi->protocol->tx_packet_size)
+ n = (int)wsi->protocol->tx_packet_size;
+ else {
+ n = (int)wsi->protocol->rx_buffer_size;
+ if (!n)
+ n = context->pt_serv_buf_size;
+ }
+ n += LWS_PRE + 4;
+ if (n > len)
+ n = (int)len;
+
+ /* nope, send it on the socket directly */
+ lws_latency_pre(context, wsi);
+ n = lws_ssl_capable_write(wsi, buf, n);
+ lws_latency(context, wsi, "send lws_issue_raw", n, n == len);
+
+ /* something got written, it can have been truncated now */
+ wsi->could_have_pending = 1;
+
+ switch (n) {
+ case LWS_SSL_CAPABLE_ERROR:
+ /* we're going to close, let close know sends aren't possible */
+ wsi->socket_is_permanently_unusable = 1;
+ return -1;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ /*
+ * nothing got sent, not fatal. Retry the whole thing later,
+ * ie, implying treat it was a truncated send so it gets
+ * retried
+ */
+ n = 0;
+ break;
+ }
+
+ /*
+ * we were already handling a truncated send?
+ */
+ if (wsi->trunc_len) {
+ lwsl_info("%p partial adv %d (vs %ld)\n", wsi, n, (long)real_len);
+ wsi->trunc_offset += n;
+ wsi->trunc_len -= n;
+
+ if (!wsi->trunc_len) {
+ lwsl_info("** %p partial send completed\n", wsi);
+ /* done with it, but don't free it */
+ n = (int)real_len;
+ if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE) {
+ lwsl_info("** %p signalling to close now\n", wsi);
+ return -1; /* retry closing now */
+ }
+ }
+ /* always callback on writeable */
+ lws_callback_on_writable(wsi);
+
+ return n;
+ }
+
+ if ((unsigned int)n == real_len)
+ /* what we just sent went out cleanly */
+ return n;
+
+ /*
+ * Newly truncated send. Buffer the remainder (it will get
+ * first priority next time the socket is writable).
+ */
+ lwsl_debug("%p new partial sent %d from %lu total\n", wsi, n,
+ (unsigned long)real_len);
+
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITE_PARTIALS, 1);
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_B_PARTIALS_ACCEPTED_PARTS, n);
+
+ /*
+ * - if we still have a suitable malloc lying around, use it
+ * - or, if too small, reallocate it
+ * - or, if no buffer, create it
+ */
+ if (!wsi->trunc_alloc || real_len - n > wsi->trunc_alloc_len) {
+ lws_free(wsi->trunc_alloc);
+
+ wsi->trunc_alloc_len = (unsigned int)(real_len - n);
+ wsi->trunc_alloc = lws_malloc(real_len - n,
+ "truncated send alloc");
+ if (!wsi->trunc_alloc) {
+ lwsl_err("truncated send: unable to malloc %lu\n",
+ (unsigned long)(real_len - n));
+ return -1;
+ }
+ }
+ wsi->trunc_offset = 0;
+ wsi->trunc_len = (unsigned int)(real_len - n);
+ memcpy(wsi->trunc_alloc, buf + n, real_len - n);
+
+#if !defined(LWS_WITH_ESP32)
+ if (lws_wsi_is_udp(wsi)) {
+ /* stash original destination for fulfilling UDP partials */
+ wsi->udp->sa_pending = wsi->udp->sa;
+ wsi->udp->salen_pending = wsi->udp->salen;
+ }
+#endif
+
+ /* since something buffered, force it to get another chance to send */
+ lws_callback_on_writable(wsi);
+
+ return (int)real_len;
+}
+
+LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len,
+ enum lws_write_protocol wp)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ if (wsi->parent_carries_io) {
+ struct lws_write_passthru pas;
+
+ pas.buf = buf;
+ pas.len = len;
+ pas.wp = wp;
+ pas.wsi = wsi;
+
+ if (wsi->parent->protocol->callback(wsi->parent,
+ LWS_CALLBACK_CHILD_WRITE_VIA_PARENT,
+ wsi->parent->user_space,
+ (void *)&pas, 0))
+ return 1;
+
+ return (int)len;
+ }
+
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_LWS_WRITE, 1);
+
+ if ((int)len < 0) {
+ lwsl_err("%s: suspicious len int %d, ulong %lu\n", __func__,
+ (int)len, (unsigned long)len);
+ return -1;
+ }
+
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_B_WRITE, len);
+
+#ifdef LWS_WITH_ACCESS_LOG
+ wsi->http.access_log.sent += len;
+#endif
+ if (wsi->vhost)
+ wsi->vhost->conn_stats.tx += len;
+
+ assert(wsi->role_ops);
+ if (!wsi->role_ops->write_role_protocol)
+ return lws_issue_raw(wsi, buf, len);
+
+ return wsi->role_ops->write_role_protocol(wsi, buf, len, &wp);
+}
+
+LWS_VISIBLE int
+lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ int n = 0;
+
+ lws_stats_atomic_bump(context, pt, LWSSTATS_C_API_READ, 1);
+
+ if (lws_wsi_is_udp(wsi)) {
+#if !defined(LWS_WITH_ESP32)
+ wsi->udp->salen = sizeof(wsi->udp->sa);
+ n = recvfrom(wsi->desc.sockfd, (char *)buf, len, 0,
+ &wsi->udp->sa, &wsi->udp->salen);
+#endif
+ } else
+ n = recv(wsi->desc.sockfd, (char *)buf, len, 0);
+
+ if (n >= 0) {
+ if (wsi->vhost)
+ wsi->vhost->conn_stats.rx += n;
+ lws_stats_atomic_bump(context, pt, LWSSTATS_B_READ, n);
+
+ return n;
+ }
+
+ if (LWS_ERRNO == LWS_EAGAIN ||
+ LWS_ERRNO == LWS_EWOULDBLOCK ||
+ LWS_ERRNO == LWS_EINTR)
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+
+ lwsl_notice("error on reading from skt : %d\n", LWS_ERRNO);
+ return LWS_SSL_CAPABLE_ERROR;
+}
+
+LWS_VISIBLE int
+lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len)
+{
+ int n = 0;
+
+ if (lws_wsi_is_udp(wsi)) {
+#if !defined(LWS_WITH_ESP32)
+ if (wsi->trunc_len)
+ n = sendto(wsi->desc.sockfd, buf, len, 0, &wsi->udp->sa_pending, wsi->udp->salen_pending);
+ else
+ n = sendto(wsi->desc.sockfd, buf, len, 0, &wsi->udp->sa, wsi->udp->salen);
+#endif
+ } else
+ n = send(wsi->desc.sockfd, (char *)buf, len, MSG_NOSIGNAL);
+// lwsl_info("%s: sent len %d result %d", __func__, len, n);
+ if (n >= 0)
+ return n;
+
+ if (LWS_ERRNO == LWS_EAGAIN ||
+ LWS_ERRNO == LWS_EWOULDBLOCK ||
+ LWS_ERRNO == LWS_EINTR) {
+ if (LWS_ERRNO == LWS_EWOULDBLOCK) {
+ lws_set_blocking_send(wsi);
+ }
+
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+ }
+
+ lwsl_debug("ERROR writing len %d to skt fd %d err %d / errno %d\n",
+ len, wsi->desc.sockfd, n, LWS_ERRNO);
+
+ return LWS_SSL_CAPABLE_ERROR;
+}
+
+LWS_VISIBLE int
+lws_ssl_pending_no_ssl(struct lws *wsi)
+{
+ (void)wsi;
+#if defined(LWS_WITH_ESP32)
+ return 100;
+#else
+ return 0;
+#endif
+}
diff --git a/thirdparty/lws/pollfd.c b/thirdparty/libwebsockets/core/pollfd.c
index 4d6704d41c..2a632ce8ec 100644
--- a/thirdparty/lws/pollfd.c
+++ b/thirdparty/libwebsockets/core/pollfd.c
@@ -19,21 +19,31 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
int
_lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
{
+#if !defined(LWS_WITH_LIBUV) && !defined(LWS_WITH_LIBEV) && !defined(LWS_WITH_LIBEVENT)
+ volatile struct lws_context_per_thread *vpt;
+#endif
struct lws_context_per_thread *pt;
struct lws_context *context;
int ret = 0, pa_events = 1;
struct lws_pollfd *pfd;
int sampled_tid, tid;
- if (!wsi || wsi->position_in_fds_table < 0)
+ if (!wsi)
+ return 0;
+
+ assert(wsi->position_in_fds_table == LWS_NO_FDS_POS ||
+ wsi->position_in_fds_table >= 0);
+
+ if (wsi->position_in_fds_table == LWS_NO_FDS_POS)
return 0;
- if (wsi->handling_pollout && !_and && _or == LWS_POLLOUT) {
+ if (((volatile struct lws *)wsi)->handling_pollout &&
+ !_and && _or == LWS_POLLOUT) {
/*
* Happening alongside service thread handling POLLOUT.
* The danger is when he is finished, he will disable POLLOUT,
@@ -42,7 +52,7 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
* Instead of changing the fds, inform the service thread
* what happened, and ask it to leave POLLOUT active on exit
*/
- wsi->leave_pollout_active = 1;
+ ((volatile struct lws *)wsi)->leave_pollout_active = 1;
/*
* by definition service thread is not in poll wait, so no need
* to cancel service
@@ -55,42 +65,106 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
context = wsi->context;
pt = &context->pt[(int)wsi->tsi];
- assert(wsi->position_in_fds_table >= 0 &&
- wsi->position_in_fds_table < pt->fds_count);
+
+ assert(wsi->position_in_fds_table < (int)pt->fds_count);
+
+#if !defined(LWS_WITH_LIBUV) && \
+ !defined(LWS_WITH_LIBEV) && \
+ !defined(LWS_WITH_LIBEVENT)
+ /*
+ * This only applies when we use the default poll() event loop.
+ *
+ * BSD can revert pa->events at any time, when the kernel decides to
+ * exit from poll(). We can't protect against it using locking.
+ *
+ * Therefore we must check first if the service thread is in poll()
+ * wait; if so, we know we must be being called from a foreign thread,
+ * and we must keep a strictly ordered list of changes we made instead
+ * of trying to apply them, since when poll() exits, which may happen
+ * at any time it would revert our changes.
+ *
+ * The plat code will apply them when it leaves the poll() wait
+ * before doing anything else.
+ */
+
+ vpt = (volatile struct lws_context_per_thread *)pt;
+
+ vpt->foreign_spinlock = 1;
+ lws_memory_barrier();
+
+ if (vpt->inside_poll) {
+ struct lws_foreign_thread_pollfd *ftp, **ftp1;
+ /*
+ * We are certainly a foreign thread trying to change events
+ * while the service thread is in the poll() wait.
+ *
+ * Create a list of changes to be applied after poll() exit,
+ * instead of trying to apply them now.
+ */
+ ftp = lws_malloc(sizeof(*ftp), "ftp");
+ if (!ftp) {
+ vpt->foreign_spinlock = 0;
+ lws_memory_barrier();
+ ret = -1;
+ goto bail;
+ }
+
+ ftp->_and = _and;
+ ftp->_or = _or;
+ ftp->fd_index = wsi->position_in_fds_table;
+ ftp->next = NULL;
+
+ /* place at END of list to maintain order */
+ ftp1 = (struct lws_foreign_thread_pollfd **)
+ &vpt->foreign_pfd_list;
+ while (*ftp1)
+ ftp1 = &((*ftp1)->next);
+
+ *ftp1 = ftp;
+ vpt->foreign_spinlock = 0;
+ lws_memory_barrier();
+ lws_cancel_service_pt(wsi);
+
+ return 0;
+ }
+
+ vpt->foreign_spinlock = 0;
+ lws_memory_barrier();
+#endif
pfd = &pt->fds[wsi->position_in_fds_table];
pa->fd = wsi->desc.sockfd;
+ lwsl_debug("%s: wsi %p: fd %d events %d -> %d\n", __func__, wsi, pa->fd, pfd->events, (pfd->events & ~_and) | _or);
pa->prev_events = pfd->events;
pa->events = pfd->events = (pfd->events & ~_and) | _or;
if (wsi->http2_substream)
return 0;
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_CHANGE_MODE_POLL_FD,
- wsi->user_space, (void *)pa, 0)) {
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi,
+ LWS_CALLBACK_CHANGE_MODE_POLL_FD,
+ wsi->user_space, (void *)pa, 0)) {
ret = -1;
goto bail;
}
- if (_and & LWS_POLLIN) {
- lws_libev_io(wsi, LWS_EV_STOP | LWS_EV_READ);
- lws_libuv_io(wsi, LWS_EV_STOP | LWS_EV_READ);
- lws_libevent_io(wsi, LWS_EV_STOP | LWS_EV_READ);
- }
- if (_or & LWS_POLLIN) {
- lws_libev_io(wsi, LWS_EV_START | LWS_EV_READ);
- lws_libuv_io(wsi, LWS_EV_START | LWS_EV_READ);
- lws_libevent_io(wsi, LWS_EV_START | LWS_EV_READ);
- }
- if (_and & LWS_POLLOUT) {
- lws_libev_io(wsi, LWS_EV_STOP | LWS_EV_WRITE);
- lws_libuv_io(wsi, LWS_EV_STOP | LWS_EV_WRITE);
- lws_libevent_io(wsi, LWS_EV_STOP | LWS_EV_WRITE);
- }
- if (_or & LWS_POLLOUT) {
- lws_libev_io(wsi, LWS_EV_START | LWS_EV_WRITE);
- lws_libuv_io(wsi, LWS_EV_START | LWS_EV_WRITE);
- lws_libevent_io(wsi, LWS_EV_START | LWS_EV_WRITE);
+ if (context->event_loop_ops->io) {
+ if (_and & LWS_POLLIN)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_STOP | LWS_EV_READ);
+
+ if (_or & LWS_POLLIN)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_START | LWS_EV_READ);
+
+ if (_and & LWS_POLLOUT)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_STOP | LWS_EV_WRITE);
+
+ if (_or & LWS_POLLOUT)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_START | LWS_EV_WRITE);
}
/*
@@ -100,20 +174,16 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
* ... and the service thread is waiting ...
* then cancel it to force a restart with our changed events
*/
-#if LWS_POSIX
pa_events = pa->prev_events != pa->events;
-#endif
if (pa_events) {
-
if (lws_plat_change_pollfd(context, wsi, pfd)) {
lwsl_info("%s failed\n", __func__);
ret = -1;
goto bail;
}
-
sampled_tid = context->service_tid;
- if (sampled_tid) {
+ if (sampled_tid && wsi->vhost) {
tid = wsi->vhost->protocols[0].callback(wsi,
LWS_CALLBACK_GET_THREAD_ID, NULL, NULL, 0);
if (tid == -1) {
@@ -124,34 +194,39 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
lws_cancel_service_pt(wsi);
}
}
+
bail:
return ret;
}
#ifndef LWS_NO_SERVER
+/*
+ * Enable or disable listen sockets on this pt globally...
+ * it's modulated according to the pt having space for a new accept.
+ */
static void
-lws_accept_modulation(struct lws_context_per_thread *pt, int allow)
+lws_accept_modulation(struct lws_context *context,
+ struct lws_context_per_thread *pt, int allow)
{
-// multithread listen seems broken
-#if 0
struct lws_vhost *vh = context->vhost_list;
struct lws_pollargs pa1;
while (vh) {
- if (allow)
- _lws_change_pollfd(pt->wsi_listening,
+ if (vh->lserv_wsi) {
+ if (allow)
+ _lws_change_pollfd(vh->lserv_wsi,
0, LWS_POLLIN, &pa1);
- else
- _lws_change_pollfd(pt->wsi_listening,
+ else
+ _lws_change_pollfd(vh->lserv_wsi,
LWS_POLLIN, 0, &pa1);
+ }
vh = vh->vhost_next;
}
-#endif
}
#endif
int
-insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi)
+__insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi)
{
struct lws_pollargs pa = { wsi->desc.sockfd, LWS_POLLIN, 0 };
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
@@ -167,52 +242,46 @@ insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi)
return 1;
}
-#if !defined(_WIN32) && !defined(LWS_WITH_ESP8266)
- if (wsi->desc.sockfd >= context->max_fds) {
- lwsl_err("Socket fd %d is too high (%d)\n",
- wsi->desc.sockfd, context->max_fds);
+#if !defined(_WIN32)
+ if (wsi->desc.sockfd - lws_plat_socket_offset() >= context->max_fds) {
+ lwsl_err("Socket fd %d is too high (%d) offset %d\n",
+ wsi->desc.sockfd, context->max_fds, lws_plat_socket_offset());
return 1;
}
#endif
assert(wsi);
- assert(wsi->vhost);
+ assert(wsi->event_pipe || wsi->vhost);
assert(lws_socket_is_valid(wsi->desc.sockfd));
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
wsi->user_space, (void *) &pa, 1))
return -1;
- lws_pt_lock(pt);
pt->count_conns++;
insert_wsi(context, wsi);
-#if defined(LWS_WITH_ESP8266)
- if (wsi->position_in_fds_table == -1)
-#endif
- wsi->position_in_fds_table = pt->fds_count;
+ wsi->position_in_fds_table = pt->fds_count;
pt->fds[wsi->position_in_fds_table].fd = wsi->desc.sockfd;
-#if LWS_POSIX
pt->fds[wsi->position_in_fds_table].events = LWS_POLLIN;
-#else
- pt->fds[wsi->position_in_fds_table].events = 0;
-#endif
pa.events = pt->fds[pt->fds_count].events;
lws_plat_insert_socket_into_fds(context, wsi);
/* external POLL support via protocol 0 */
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_ADD_POLL_FD,
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_ADD_POLL_FD,
wsi->user_space, (void *) &pa, 0))
ret = -1;
#ifndef LWS_NO_SERVER
/* if no more room, defeat accepts on this thread */
if ((unsigned int)pt->fds_count == context->fd_limit_per_thread - 1)
- lws_accept_modulation(pt, 0);
+ lws_accept_modulation(context, pt, 0);
#endif
- lws_pt_unlock(pt);
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_UNLOCK_POLL,
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_UNLOCK_POLL,
wsi->user_space, (void *)&pa, 1))
ret = -1;
@@ -220,15 +289,13 @@ insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi)
}
int
-remove_wsi_socket_from_fds(struct lws *wsi)
+__remove_wsi_socket_from_fds(struct lws *wsi)
{
struct lws_context *context = wsi->context;
struct lws_pollargs pa = { wsi->desc.sockfd, 0, 0 };
-#if !defined(LWS_WITH_ESP8266)
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
struct lws *end_wsi;
int v;
-#endif
int m, ret = 0;
if (wsi->parent_carries_io) {
@@ -236,15 +303,16 @@ remove_wsi_socket_from_fds(struct lws *wsi)
return 0;
}
-#if !defined(_WIN32) && !defined(LWS_WITH_ESP8266)
- if (wsi->desc.sockfd > context->max_fds) {
+#if !defined(_WIN32)
+ if (wsi->desc.sockfd - lws_plat_socket_offset() > context->max_fds) {
lwsl_err("fd %d too high (%d)\n", wsi->desc.sockfd,
context->max_fds);
return 1;
}
#endif
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
wsi->user_space, (void *)&pa, 1))
return -1;
@@ -253,101 +321,114 @@ remove_wsi_socket_from_fds(struct lws *wsi)
/* the guy who is to be deleted's slot index in pt->fds */
m = wsi->position_in_fds_table;
-#if !defined(LWS_WITH_ESP8266)
- lws_libev_io(wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE |
- LWS_EV_PREPARE_DELETION);
- lws_libuv_io(wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE |
- LWS_EV_PREPARE_DELETION);
+ /* these are the only valid possibilities for position_in_fds_table */
+ assert(m == LWS_NO_FDS_POS || (m >= 0 &&
+ (unsigned int)m < pt->fds_count));
- lws_pt_lock(pt);
+ if (context->event_loop_ops->io)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE |
+ LWS_EV_PREPARE_DELETION);
lwsl_debug("%s: wsi=%p, sock=%d, fds pos=%d, end guy pos=%d, endfd=%d\n",
__func__, wsi, wsi->desc.sockfd, wsi->position_in_fds_table,
pt->fds_count, pt->fds[pt->fds_count].fd);
- /* have the last guy take up the now vacant slot */
- pt->fds[m] = pt->fds[pt->fds_count - 1];
-#endif
- /* this decrements pt->fds_count */
- lws_plat_delete_socket_from_fds(context, wsi, m);
-#if !defined(LWS_WITH_ESP8266)
- v = (int) pt->fds[m].fd;
- /* end guy's "position in fds table" is now the deletion guy's old one */
- end_wsi = wsi_from_fd(context, v);
- if (!end_wsi) {
- lwsl_err("no wsi found for sock fd %d at pos %d, pt->fds_count=%d\n",
- (int)pt->fds[m].fd, m, pt->fds_count);
- assert(0);
- } else
- end_wsi->position_in_fds_table = m;
-
- /* deletion guy's lws_lookup entry needs nuking */
- delete_from_fd(context, wsi->desc.sockfd);
- /* removed wsi has no position any more */
- wsi->position_in_fds_table = -1;
+ if (m != LWS_NO_FDS_POS) {
+
+ /* have the last guy take up the now vacant slot */
+ pt->fds[m] = pt->fds[pt->fds_count - 1];
+ /* this decrements pt->fds_count */
+ lws_plat_delete_socket_from_fds(context, wsi, m);
+ v = (int) pt->fds[m].fd;
+ /* end guy's "position in fds table" is now the deletion guy's old one */
+ end_wsi = wsi_from_fd(context, v);
+ if (!end_wsi) {
+ lwsl_err("no wsi for fd %d at pos %d, pt->fds_count=%d\n",
+ (int)pt->fds[m].fd, m, pt->fds_count);
+ assert(0);
+ } else
+ end_wsi->position_in_fds_table = m;
+
+ /* deletion guy's lws_lookup entry needs nuking */
+ delete_from_fd(context, wsi->desc.sockfd);
+
+ /* removed wsi has no position any more */
+ wsi->position_in_fds_table = LWS_NO_FDS_POS;
+ }
/* remove also from external POLL support via protocol 0 */
- if (lws_socket_is_valid(wsi->desc.sockfd))
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_DEL_POLL_FD,
- wsi->user_space, (void *) &pa, 0))
- ret = -1;
+ if (lws_socket_is_valid(wsi->desc.sockfd) && wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_DEL_POLL_FD,
+ wsi->user_space, (void *) &pa, 0))
+ ret = -1;
+
#ifndef LWS_NO_SERVER
- if (!context->being_destroyed)
- /* if this made some room, accept connects on this thread */
- if ((unsigned int)pt->fds_count < context->fd_limit_per_thread - 1)
- lws_accept_modulation(pt, 1);
+ if (!context->being_destroyed &&
+ /* if this made some room, accept connects on this thread */
+ (unsigned int)pt->fds_count < context->fd_limit_per_thread - 1)
+ lws_accept_modulation(context, pt, 1);
#endif
- lws_pt_unlock(pt);
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_UNLOCK_POLL,
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_UNLOCK_POLL,
wsi->user_space, (void *) &pa, 1))
ret = -1;
-#endif
+
return ret;
}
int
-lws_change_pollfd(struct lws *wsi, int _and, int _or)
+__lws_change_pollfd(struct lws *wsi, int _and, int _or)
{
- struct lws_context_per_thread *pt;
struct lws_context *context;
struct lws_pollargs pa;
int ret = 0;
- if (!wsi || !wsi->protocol || wsi->position_in_fds_table < 0)
- return 1;
+ if (!wsi || (!wsi->protocol && !wsi->event_pipe) ||
+ wsi->position_in_fds_table == LWS_NO_FDS_POS)
+ return 0;
context = lws_get_context(wsi);
if (!context)
return 1;
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
- wsi->user_space, (void *) &pa, 0))
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
+ wsi->user_space, (void *) &pa, 0))
return -1;
- pt = &context->pt[(int)wsi->tsi];
-
- lws_pt_lock(pt);
ret = _lws_change_pollfd(wsi, _and, _or, &pa);
- lws_pt_unlock(pt);
- if (wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_UNLOCK_POLL,
+ if (wsi->vhost &&
+ wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_UNLOCK_POLL,
wsi->user_space, (void *) &pa, 0))
ret = -1;
return ret;
}
+int
+lws_change_pollfd(struct lws *wsi, int _and, int _or)
+{
+ struct lws_context_per_thread *pt;
+ int ret = 0;
+
+ pt = &wsi->context->pt[(int)wsi->tsi];
+
+ lws_pt_lock(pt, __func__);
+ ret = __lws_change_pollfd(wsi, _and, _or);
+ lws_pt_unlock(pt);
+
+ return ret;
+}
+
LWS_VISIBLE int
lws_callback_on_writable(struct lws *wsi)
{
struct lws_context_per_thread *pt;
-#ifdef LWS_WITH_HTTP2
- struct lws *network_wsi, *wsi2;
- int already;
-#endif
int n;
- if (wsi->state == LWSS_SHUTDOWN)
+ if (lwsi_state(wsi) == LRS_SHUTDOWN)
return 0;
if (wsi->socket_is_permanently_unusable)
@@ -375,72 +456,31 @@ lws_callback_on_writable(struct lws *wsi)
#if defined(LWS_WITH_STATS)
if (!wsi->active_writable_req_us) {
wsi->active_writable_req_us = time_in_microseconds();
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
}
#endif
-#ifdef LWS_WITH_HTTP2
- lwsl_info("%s: %p\n", __func__, wsi);
-
- if (wsi->mode != LWSCM_HTTP2_SERVING)
- goto network_sock;
- if (wsi->u.h2.requested_POLLOUT) {
- lwsl_info("already pending writable\n");
- return 1;
+ if (wsi->role_ops->callback_on_writable) {
+ if (wsi->role_ops->callback_on_writable(wsi))
+ return 1;
+ wsi = lws_get_network_wsi(wsi);
}
- /* is this for DATA or for control messages? */
- if (wsi->upgraded_to_http2 && !wsi->u.h2.h2n->pps &&
- !lws_h2_tx_cr_get(wsi)) {
- /*
- * other side is not able to cope with us sending DATA
- * anything so no matter if we have POLLOUT on our side if it's
- * DATA we want to send.
- *
- * Delay waiting for our POLLOUT until peer indicates he has
- * space for more using tx window command in http2 layer
- */
- lwsl_notice("%s: %p: skint (%d)\n", __func__, wsi, wsi->u.h2.tx_cr);
- wsi->u.h2.skint = 1;
- return 0;
- }
-
- wsi->u.h2.skint = 0;
- network_wsi = lws_get_network_wsi(wsi);
- already = network_wsi->u.h2.requested_POLLOUT;
-
- /* mark everybody above him as requesting pollout */
-
- wsi2 = wsi;
- while (wsi2) {
- wsi2->u.h2.requested_POLLOUT = 1;
- lwsl_info("mark %p pending writable\n", wsi2);
- wsi2 = wsi2->u.h2.parent_wsi;
- }
-
- /* for network action, act only on the network wsi */
-
- wsi = network_wsi;
- if (already)
- return 1;
-network_sock:
-#endif
-
- if (lws_ext_cb_active(wsi, LWS_EXT_CB_REQUEST_ON_WRITEABLE, NULL, 0))
- return 1;
-
- if (wsi->position_in_fds_table < 0) {
- lwsl_debug("%s: failed to find socket %d\n", __func__, wsi->desc.sockfd);
+ if (wsi->position_in_fds_table == LWS_NO_FDS_POS) {
+ lwsl_debug("%s: failed to find socket %d\n", __func__,
+ wsi->desc.sockfd);
return -1;
}
- if (lws_change_pollfd(wsi, 0, LWS_POLLOUT))
+ if (__lws_change_pollfd(wsi, 0, LWS_POLLOUT))
return -1;
return 1;
}
+
/*
* stitch protocol choice into the vh protocol linked list
* We always insert ourselves at the start of the list
@@ -458,6 +498,8 @@ lws_same_vh_protocol_insert(struct lws *wsi, int n)
lwsl_notice("Attempted to attach wsi twice to same vh prot\n");
}
+ lws_vhost_lock(wsi->vhost);
+
wsi->same_vh_protocol_prev = &wsi->vhost->same_vh_protocol_list[n];
/* old first guy is our next */
wsi->same_vh_protocol_next = wsi->vhost->same_vh_protocol_list[n];
@@ -468,6 +510,10 @@ lws_same_vh_protocol_insert(struct lws *wsi, int n)
/* old first guy points back to us now */
wsi->same_vh_protocol_next->same_vh_protocol_prev =
&wsi->same_vh_protocol_next;
+
+ wsi->on_same_vh_list = 1;
+
+ lws_vhost_unlock(wsi->vhost);
}
void
@@ -482,6 +528,11 @@ lws_same_vh_protocol_remove(struct lws *wsi)
*/
lwsl_info("%s: removing same prot wsi %p\n", __func__, wsi);
+ if (!wsi->vhost || !wsi->on_same_vh_list)
+ return;
+
+ lws_vhost_lock(wsi->vhost);
+
if (wsi->same_vh_protocol_prev) {
assert (*(wsi->same_vh_protocol_prev) == wsi);
lwsl_info("have prev %p, setting him to our next %p\n",
@@ -493,13 +544,15 @@ lws_same_vh_protocol_remove(struct lws *wsi)
}
/* our next should point back to our prev */
- if (wsi->same_vh_protocol_next) {
+ if (wsi->same_vh_protocol_next)
wsi->same_vh_protocol_next->same_vh_protocol_prev =
wsi->same_vh_protocol_prev;
- }
wsi->same_vh_protocol_prev = NULL;
wsi->same_vh_protocol_next = NULL;
+ wsi->on_same_vh_list = 0;
+
+ lws_vhost_unlock(wsi->vhost);
}
@@ -523,7 +576,8 @@ lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
assert(wsi->protocol == protocol);
assert(*wsi->same_vh_protocol_prev == wsi);
if (wsi->same_vh_protocol_next)
- assert(wsi->same_vh_protocol_next->same_vh_protocol_prev ==
+ assert(wsi->same_vh_protocol_next->
+ same_vh_protocol_prev ==
&wsi->same_vh_protocol_next);
lws_callback_on_writable(wsi);
@@ -537,9 +591,14 @@ LWS_VISIBLE int
lws_callback_on_writable_all_protocol(const struct lws_context *context,
const struct lws_protocols *protocol)
{
- struct lws_vhost *vhost = context->vhost_list;
+ struct lws_vhost *vhost;
int n;
+ if (!context)
+ return 0;
+
+ vhost = context->vhost_list;
+
while (vhost) {
for (n = 0; n < vhost->count_protocols; n++)
if (protocol->callback ==
diff --git a/thirdparty/libwebsockets/core/private.h b/thirdparty/libwebsockets/core/private.h
new file mode 100644
index 0000000000..d6b494ac8c
--- /dev/null
+++ b/thirdparty/libwebsockets/core/private.h
@@ -0,0 +1,1751 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "lws_config.h"
+#include "lws_config_private.h"
+
+#if defined(LWS_WITH_CGI) && defined(LWS_HAVE_VFORK)
+ #define _GNU_SOURCE
+#endif
+
+#if defined(__COVERITY__) && !defined(LWS_COVERITY_WORKAROUND)
+ #define LWS_COVERITY_WORKAROUND
+ typedef float _Float32;
+ typedef float _Float64;
+ typedef float _Float128;
+ typedef float _Float32x;
+ typedef float _Float64x;
+ typedef float _Float128x;
+#endif
+
+#ifdef LWS_HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <inttypes.h>
+
+#if defined(LWS_WITH_ESP32)
+ #define MSG_NOSIGNAL 0
+ #define SOMAXCONN 3
+#endif
+
+#define STORE_IN_ROM
+#include <assert.h>
+#if LWS_MAX_SMP > 1
+ #include <pthread.h>
+#endif
+
+#ifdef LWS_HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+#endif
+
+#if defined(WIN32) || defined(_WIN32)
+
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
+
+ #if (WINVER < 0x0501)
+ #undef WINVER
+ #undef _WIN32_WINNT
+ #define WINVER 0x0501
+ #define _WIN32_WINNT WINVER
+ #endif
+
+ #define LWS_NO_DAEMONIZE
+ #define LWS_ERRNO WSAGetLastError()
+ #define LWS_EAGAIN WSAEWOULDBLOCK
+ #define LWS_EALREADY WSAEALREADY
+ #define LWS_EINPROGRESS WSAEINPROGRESS
+ #define LWS_EINTR WSAEINTR
+ #define LWS_EISCONN WSAEISCONN
+ #define LWS_EWOULDBLOCK WSAEWOULDBLOCK
+ #define MSG_NOSIGNAL 0
+ #define SHUT_RDWR SD_BOTH
+ #define SOL_TCP IPPROTO_TCP
+ #define SHUT_WR SD_SEND
+
+ #define compatible_close(fd) closesocket(fd)
+ #define lws_set_blocking_send(wsi) wsi->sock_send_blocking = 1
+ #define LWS_SOCK_INVALID (INVALID_SOCKET)
+
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #include <windows.h>
+ #include <tchar.h>
+ #ifdef LWS_HAVE_IN6ADDR_H
+ #include <in6addr.h>
+ #endif
+ #include <mstcpip.h>
+ #include <io.h>
+
+ #if !defined(LWS_HAVE_ATOLL)
+ #if defined(LWS_HAVE__ATOI64)
+ #define atoll _atoi64
+ #else
+ #warning No atoll or _atoi64 available, using atoi
+ #define atoll atoi
+ #endif
+ #endif
+
+ #ifndef __func__
+ #define __func__ __FUNCTION__
+ #endif
+
+ #ifdef LWS_HAVE__VSNPRINTF
+ #define vsnprintf _vsnprintf
+ #endif
+
+ /* we don't have an implementation for this on windows... */
+ int kill(int pid, int sig);
+ int fork(void);
+ #ifndef SIGINT
+ #define SIGINT 2
+ #endif
+
+#else /* not windows --> */
+
+ #include <fcntl.h>
+ #include <strings.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+
+ #ifndef __cplusplus
+ #include <errno.h>
+ #endif
+ #include <netdb.h>
+ #include <signal.h>
+ #include <sys/socket.h>
+
+ #if defined(LWS_BUILTIN_GETIFADDRS)
+ #include "./misc/getifaddrs.h"
+ #else
+ #if !defined(LWS_WITH_ESP32)
+ #if defined(__HAIKU__)
+ #define _BSD_SOURCE
+ #endif
+ #include <ifaddrs.h>
+ #endif
+ #endif
+ #if defined (__ANDROID__)
+ #include <syslog.h>
+ #include <sys/resource.h>
+ #elif defined (__sun) || defined(__HAIKU__) || defined(__QNX__)
+ #include <syslog.h>
+ #else
+ #if !defined(LWS_WITH_ESP32)
+ #include <sys/syslog.h>
+ #endif
+ #endif
+ #include <netdb.h>
+ #if !defined(LWS_WITH_ESP32)
+ #include <sys/mman.h>
+ #include <sys/un.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
+ #include <arpa/inet.h>
+ #include <poll.h>
+ #endif
+ #ifndef LWS_NO_FORK
+ #ifdef LWS_HAVE_SYS_PRCTL_H
+ #include <sys/prctl.h>
+ #endif
+ #endif
+
+ #include <sys/time.h>
+
+ #define LWS_ERRNO errno
+ #define LWS_EAGAIN EAGAIN
+ #define LWS_EALREADY EALREADY
+ #define LWS_EINPROGRESS EINPROGRESS
+ #define LWS_EINTR EINTR
+ #define LWS_EISCONN EISCONN
+ #define LWS_EWOULDBLOCK EWOULDBLOCK
+
+ #define lws_set_blocking_send(wsi)
+
+ #define LWS_SOCK_INVALID (-1)
+#endif /* not windows */
+
+#ifndef LWS_HAVE_BZERO
+ #ifndef bzero
+ #define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
+ #endif
+#endif
+
+#ifndef LWS_HAVE_STRERROR
+ #define strerror(x) ""
+#endif
+
+
+#define lws_socket_is_valid(x) (x != LWS_SOCK_INVALID)
+
+#include "libwebsockets.h"
+
+#include "tls/private.h"
+
+#if defined(WIN32) || defined(_WIN32)
+ #include <gettimeofday.h>
+
+ #ifndef BIG_ENDIAN
+ #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */
+ #endif
+ #ifndef LITTLE_ENDIAN
+ #define LITTLE_ENDIAN 1234
+ #endif
+ #ifndef BYTE_ORDER
+ #define BYTE_ORDER LITTLE_ENDIAN
+ #endif
+
+ #undef __P
+ #ifndef __P
+ #if __STDC__
+ #define __P(protos) protos
+ #else
+ #define __P(protos) ()
+ #endif
+ #endif
+
+#else /* not windows */
+ static inline int compatible_close(int fd) { return close(fd); }
+
+ #include <sys/stat.h>
+ #include <sys/time.h>
+
+ #if defined(__APPLE__)
+ #include <machine/endian.h>
+ #elif defined(__FreeBSD__)
+ #include <sys/endian.h>
+ #elif defined(__linux__)
+ #include <endian.h>
+ #endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__QNX__)
+ #include <gulliver.h>
+ #if defined(__LITTLEENDIAN__)
+ #define BYTE_ORDER __LITTLEENDIAN__
+ #define LITTLE_ENDIAN __LITTLEENDIAN__
+ #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc); for suppres warning that BIG_ENDIAN is not defined. */
+ #endif
+ #if defined(__BIGENDIAN__)
+ #define BYTE_ORDER __BIGENDIAN__
+ #define LITTLE_ENDIAN 1234 /* to show byte order (taken from gcc); for suppres warning that LITTLE_ENDIAN is not defined. */
+ #define BIG_ENDIAN __BIGENDIAN__
+ #endif
+#endif
+
+#if defined(__sun) && defined(__GNUC__)
+
+ #include <arpa/nameser_compat.h>
+
+ #if !defined (BYTE_ORDER)
+ #define BYTE_ORDER __BYTE_ORDER__
+ #endif
+
+ #if !defined(LITTLE_ENDIAN)
+ #define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+ #endif
+
+ #if !defined(BIG_ENDIAN)
+ #define BIG_ENDIAN __ORDER_BIG_ENDIAN__
+ #endif
+
+#endif /* sun + GNUC */
+
+#if !defined(BYTE_ORDER)
+ #define BYTE_ORDER __BYTE_ORDER
+#endif
+#if !defined(LITTLE_ENDIAN)
+ #define LITTLE_ENDIAN __LITTLE_ENDIAN
+#endif
+#if !defined(BIG_ENDIAN)
+ #define BIG_ENDIAN __BIG_ENDIAN
+#endif
+
+
+/*
+ * Mac OSX as well as iOS do not define the MSG_NOSIGNAL flag,
+ * but happily have something equivalent in the SO_NOSIGPIPE flag.
+ */
+#ifdef __APPLE__
+#define MSG_NOSIGNAL SO_NOSIGPIPE
+#endif
+
+/*
+ * Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in
+ * POSIX 2008.
+ */
+#ifdef __sun
+ #define MSG_NOSIGNAL 0
+#endif
+
+#ifdef _WIN32
+ #ifndef FD_HASHTABLE_MODULUS
+ #define FD_HASHTABLE_MODULUS 32
+ #endif
+#endif
+
+#ifndef LWS_DEF_HEADER_LEN
+#define LWS_DEF_HEADER_LEN 4096
+#endif
+#ifndef LWS_DEF_HEADER_POOL
+#define LWS_DEF_HEADER_POOL 4
+#endif
+#ifndef LWS_MAX_PROTOCOLS
+#define LWS_MAX_PROTOCOLS 5
+#endif
+#ifndef LWS_MAX_EXTENSIONS_ACTIVE
+#define LWS_MAX_EXTENSIONS_ACTIVE 1
+#endif
+#ifndef LWS_MAX_EXT_OFFERS
+#define LWS_MAX_EXT_OFFERS 8
+#endif
+#ifndef SPEC_LATEST_SUPPORTED
+#define SPEC_LATEST_SUPPORTED 13
+#endif
+#ifndef AWAITING_TIMEOUT
+#define AWAITING_TIMEOUT 20
+#endif
+#ifndef CIPHERS_LIST_STRING
+#define CIPHERS_LIST_STRING "DEFAULT"
+#endif
+#ifndef LWS_SOMAXCONN
+#define LWS_SOMAXCONN SOMAXCONN
+#endif
+
+#define MAX_WEBSOCKET_04_KEY_LEN 128
+
+#ifndef SYSTEM_RANDOM_FILEPATH
+#define SYSTEM_RANDOM_FILEPATH "/dev/urandom"
+#endif
+
+#define LWS_H2_RX_SCRATCH_SIZE 512
+
+
+
+/*
+ * All lws_tls...() functions must return this type, converting the
+ * native backend result and doing the extra work to determine which one
+ * as needed.
+ *
+ * Native TLS backend return codes are NOT ALLOWED outside the backend.
+ *
+ * Non-SSL mode also uses these types.
+ */
+enum lws_ssl_capable_status {
+ LWS_SSL_CAPABLE_ERROR = -1, /* it failed */
+ LWS_SSL_CAPABLE_DONE = 0, /* it succeeded */
+ LWS_SSL_CAPABLE_MORE_SERVICE_READ = -2, /* retry WANT_READ */
+ LWS_SSL_CAPABLE_MORE_SERVICE_WRITE = -3, /* retry WANT_WRITE */
+ LWS_SSL_CAPABLE_MORE_SERVICE = -4, /* general retry */
+};
+
+#if defined(__clang__)
+#define lws_memory_barrier() __sync_synchronize()
+#elif defined(__GNUC__)
+#define lws_memory_barrier() __sync_synchronize()
+#else
+#define lws_memory_barrier()
+#endif
+
+/*
+ *
+ * ------ roles ------
+ *
+ */
+
+#include "roles/private.h"
+
+/* null-terminated array of pointers to roles lws built with */
+extern const struct lws_role_ops *available_roles[];
+
+#define LWS_FOR_EVERY_AVAILABLE_ROLE_START(xx) { \
+ const struct lws_role_ops **ppxx = available_roles; \
+ while (*ppxx) { \
+ const struct lws_role_ops *xx = *ppxx++;
+
+#define LWS_FOR_EVERY_AVAILABLE_ROLE_END }}
+
+/*
+ *
+ * ------ event_loop ops ------
+ *
+ */
+
+#include "event-libs/private.h"
+
+/* enums of socks version */
+enum socks_version {
+ SOCKS_VERSION_4 = 4,
+ SOCKS_VERSION_5 = 5
+};
+
+/* enums of subnegotiation version */
+enum socks_subnegotiation_version {
+ SOCKS_SUBNEGOTIATION_VERSION_1 = 1,
+};
+
+/* enums of socks commands */
+enum socks_command {
+ SOCKS_COMMAND_CONNECT = 1,
+ SOCKS_COMMAND_BIND = 2,
+ SOCKS_COMMAND_UDP_ASSOCIATE = 3
+};
+
+/* enums of socks address type */
+enum socks_atyp {
+ SOCKS_ATYP_IPV4 = 1,
+ SOCKS_ATYP_DOMAINNAME = 3,
+ SOCKS_ATYP_IPV6 = 4
+};
+
+/* enums of socks authentication methods */
+enum socks_auth_method {
+ SOCKS_AUTH_NO_AUTH = 0,
+ SOCKS_AUTH_GSSAPI = 1,
+ SOCKS_AUTH_USERNAME_PASSWORD = 2
+};
+
+/* enums of subnegotiation status */
+enum socks_subnegotiation_status {
+ SOCKS_SUBNEGOTIATION_STATUS_SUCCESS = 0,
+};
+
+/* enums of socks request reply */
+enum socks_request_reply {
+ SOCKS_REQUEST_REPLY_SUCCESS = 0,
+ SOCKS_REQUEST_REPLY_FAILURE_GENERAL = 1,
+ SOCKS_REQUEST_REPLY_CONNECTION_NOT_ALLOWED = 2,
+ SOCKS_REQUEST_REPLY_NETWORK_UNREACHABLE = 3,
+ SOCKS_REQUEST_REPLY_HOST_UNREACHABLE = 4,
+ SOCKS_REQUEST_REPLY_CONNECTION_REFUSED = 5,
+ SOCKS_REQUEST_REPLY_TTL_EXPIRED = 6,
+ SOCKS_REQUEST_REPLY_COMMAND_NOT_SUPPORTED = 7,
+ SOCKS_REQUEST_REPLY_ATYP_NOT_SUPPORTED = 8
+};
+
+/* enums used to generate socks messages */
+enum socks_msg_type {
+ /* greeting */
+ SOCKS_MSG_GREETING,
+ /* credential, user name and password */
+ SOCKS_MSG_USERNAME_PASSWORD,
+ /* connect command */
+ SOCKS_MSG_CONNECT
+};
+
+enum {
+ LWS_RXFLOW_ALLOW = (1 << 0),
+ LWS_RXFLOW_PENDING_CHANGE = (1 << 1),
+};
+
+struct lws_ring {
+ void *buf;
+ void (*destroy_element)(void *element);
+ uint32_t buflen;
+ uint32_t element_len;
+ uint32_t head;
+ uint32_t oldest_tail;
+};
+
+struct lws_protocols;
+struct lws;
+
+struct lws_io_watcher {
+#ifdef LWS_WITH_LIBEV
+ struct lws_io_watcher_libev ev;
+#endif
+#ifdef LWS_WITH_LIBUV
+ struct lws_io_watcher_libuv uv;
+#endif
+#ifdef LWS_WITH_LIBEVENT
+ struct lws_io_watcher_libevent event;
+#endif
+ struct lws_context *context;
+
+ uint8_t actual_events;
+};
+
+struct lws_signal_watcher {
+#ifdef LWS_WITH_LIBEV
+ struct lws_signal_watcher_libev ev;
+#endif
+#ifdef LWS_WITH_LIBUV
+ struct lws_signal_watcher_libuv uv;
+#endif
+#ifdef LWS_WITH_LIBEVENT
+ struct lws_signal_watcher_libevent event;
+#endif
+ struct lws_context *context;
+};
+
+#ifdef _WIN32
+#define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) % FD_HASHTABLE_MODULUS)
+struct lws_fd_hashtable {
+ struct lws **wsi;
+ int length;
+};
+#endif
+
+struct lws_foreign_thread_pollfd {
+ struct lws_foreign_thread_pollfd *next;
+ int fd_index;
+ int _and;
+ int _or;
+};
+
+
+#define LWS_HRTIMER_NOWAIT (0x7fffffffffffffffll)
+
+/*
+ * so we can have n connections being serviced simultaneously,
+ * these things need to be isolated per-thread.
+ */
+
+struct lws_context_per_thread {
+#if LWS_MAX_SMP > 1
+ pthread_mutex_t lock;
+ pthread_mutex_t lock_stats;
+ pthread_t lock_owner;
+ const char *last_lock_reason;
+#endif
+
+ struct lws_context *context;
+
+ /*
+ * usable by anything in the service code, but only if the scope
+ * does not last longer than the service action (since next service
+ * of any socket can likewise use it and overwrite)
+ */
+ unsigned char *serv_buf;
+
+ struct lws_dll_lws dll_head_timeout;
+ struct lws_dll_lws dll_head_hrtimer;
+ struct lws_dll_lws dll_head_buflist; /* guys with pending rxflow */
+
+#if defined(LWS_WITH_TLS)
+ struct lws_pt_tls tls;
+#endif
+
+ struct lws_pollfd *fds;
+ volatile struct lws_foreign_thread_pollfd * volatile foreign_pfd_list;
+#ifdef _WIN32
+ WSAEVENT *events;
+#endif
+ lws_sockfd_type dummy_pipe_fds[2];
+ struct lws *pipe_wsi;
+
+ /* --- role based members --- */
+
+#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_pt_role_ws ws;
+#endif
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ struct lws_pt_role_http http;
+#endif
+
+ /* --- event library based members --- */
+
+#if defined(LWS_WITH_LIBEV)
+ struct lws_pt_eventlibs_libev ev;
+#endif
+#if defined(LWS_WITH_LIBUV)
+ struct lws_pt_eventlibs_libuv uv;
+#endif
+#if defined(LWS_WITH_LIBEVENT)
+ struct lws_pt_eventlibs_libevent event;
+#endif
+
+#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
+ struct lws_signal_watcher w_sigint;
+#endif
+
+ /* --- */
+
+ unsigned long count_conns;
+ unsigned int fds_count;
+
+ volatile unsigned char inside_poll;
+ volatile unsigned char foreign_spinlock;
+
+ unsigned char tid;
+
+ unsigned char lock_depth;
+ unsigned char inside_service:1;
+ unsigned char event_loop_foreign:1;
+ unsigned char event_loop_destroy_processing_done:1;
+};
+
+struct lws_conn_stats {
+ unsigned long long rx, tx;
+ unsigned long h1_conn, h1_trans, h2_trans, ws_upg, h2_alpn, h2_subs,
+ h2_upg, rejected;
+};
+
+void
+lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs);
+
+struct lws_timed_vh_protocol {
+ struct lws_timed_vh_protocol *next;
+ const struct lws_protocols *protocol;
+ time_t time;
+ int reason;
+};
+
+/*
+ * virtual host -related context information
+ * vhostwide SSL context
+ * vhostwide proxy
+ *
+ * hierarchy:
+ *
+ * context -> vhost -> wsi
+ *
+ * incoming connection non-SSL vhost binding:
+ *
+ * listen socket -> wsi -> select vhost after first headers
+ *
+ * incoming connection SSL vhost binding:
+ *
+ * SSL SNI -> wsi -> bind after SSL negotiation
+ */
+
+
+struct lws_vhost {
+#if !defined(LWS_WITHOUT_CLIENT)
+ char proxy_basic_auth_token[128];
+#endif
+#if LWS_MAX_SMP > 1
+ pthread_mutex_t lock;
+#endif
+
+#if defined(LWS_ROLE_H2)
+ struct lws_vhost_role_h2 h2;
+#endif
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ struct lws_vhost_role_http http;
+#endif
+#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_vhost_role_ws ws;
+#endif
+
+#if defined(LWS_WITH_SOCKS5)
+ char socks_proxy_address[128];
+ char socks_user[96];
+ char socks_password[96];
+#endif
+#if defined(LWS_WITH_LIBEV)
+ struct lws_io_watcher w_accept;
+#endif
+ struct lws_conn_stats conn_stats;
+ struct lws_context *context;
+ struct lws_vhost *vhost_next;
+
+ struct lws *lserv_wsi;
+ const char *name;
+ const char *iface;
+
+#if !defined(LWS_WITH_ESP32) && !defined(OPTEE_TA) && !defined(WIN32)
+ int bind_iface;
+#endif
+ const struct lws_protocols *protocols;
+ void **protocol_vh_privs;
+ const struct lws_protocol_vhost_options *pvo;
+ const struct lws_protocol_vhost_options *headers;
+ struct lws **same_vh_protocol_list;
+ struct lws_vhost *no_listener_vhost_list;
+#if !defined(LWS_NO_CLIENT)
+ struct lws_dll_lws dll_active_client_conns;
+#endif
+
+#if defined(LWS_WITH_TLS)
+ struct lws_vhost_tls tls;
+#endif
+
+ struct lws_timed_vh_protocol *timed_vh_protocol_list;
+ void *user;
+
+ int listen_port;
+
+#if defined(LWS_WITH_SOCKS5)
+ unsigned int socks_proxy_port;
+#endif
+ unsigned int options;
+ int count_protocols;
+ int ka_time;
+ int ka_probes;
+ int ka_interval;
+ int keepalive_timeout;
+ int timeout_secs_ah_idle;
+
+#ifdef LWS_WITH_ACCESS_LOG
+ int log_fd;
+#endif
+
+ unsigned int created_vhost_protocols:1;
+ unsigned int being_destroyed:1;
+
+ unsigned char default_protocol_index;
+ unsigned char raw_protocol_index;
+};
+
+struct lws_deferred_free
+{
+ struct lws_deferred_free *next;
+ time_t deadline;
+ void *payload;
+};
+
+typedef union {
+#ifdef LWS_WITH_IPV6
+ struct sockaddr_in6 sa6;
+#endif
+ struct sockaddr_in sa4;
+} sockaddr46;
+
+
+#if defined(LWS_WITH_PEER_LIMITS)
+struct lws_peer {
+ struct lws_peer *next;
+ struct lws_peer *peer_wait_list;
+
+ time_t time_created;
+ time_t time_closed_all;
+
+ uint8_t addr[32];
+ uint32_t hash;
+ uint32_t count_wsi;
+ uint32_t total_wsi;
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ struct lws_peer_role_http http;
+#endif
+
+ uint8_t af;
+};
+#endif
+
+/*
+ * the rest is managed per-context, that includes
+ *
+ * - processwide single fd -> wsi lookup
+ * - contextwide headers pool
+ */
+
+struct lws_context {
+ time_t last_timeout_check_s;
+ time_t last_ws_ping_pong_check_s;
+ time_t time_up;
+ time_t time_discontiguity;
+ time_t time_fixup;
+ const struct lws_plat_file_ops *fops;
+ struct lws_plat_file_ops fops_platform;
+ struct lws_context **pcontext_finalize;
+
+ const struct lws_tls_ops *tls_ops;
+
+#if defined(LWS_WITH_HTTP2)
+ struct http2_settings set;
+#endif
+#if defined(LWS_WITH_ZIP_FOPS)
+ struct lws_plat_file_ops fops_zip;
+#endif
+ struct lws_context_per_thread pt[LWS_MAX_SMP];
+ struct lws_conn_stats conn_stats;
+#if LWS_MAX_SMP > 1
+ pthread_mutex_t lock;
+ int lock_depth;
+#endif
+#ifdef _WIN32
+/* different implementation between unix and windows */
+ struct lws_fd_hashtable fd_hashtable[FD_HASHTABLE_MODULUS];
+#else
+ struct lws **lws_lookup; /* fd to wsi */
+#endif
+ struct lws_vhost *vhost_list;
+ struct lws_vhost *no_listener_vhost_list;
+ struct lws_vhost *vhost_pending_destruction_list;
+ struct lws_plugin *plugin_list;
+ struct lws_deferred_free *deferred_free_list;
+#if defined(LWS_WITH_PEER_LIMITS)
+ struct lws_peer **pl_hash_table;
+ struct lws_peer *peer_wait_list;
+ time_t next_cull;
+#endif
+
+ void *external_baggage_free_on_destroy;
+ const struct lws_token_limits *token_limits;
+ void *user_space;
+ const struct lws_protocol_vhost_options *reject_service_keywords;
+ lws_reload_func deprecation_cb;
+ void (*eventlib_signal_cb)(void *event_lib_handle, int signum);
+
+#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
+ cap_value_t caps[4];
+ char count_caps;
+#endif
+
+#if defined(LWS_WITH_LIBEV)
+ struct lws_context_eventlibs_libev ev;
+#endif
+#if defined(LWS_WITH_LIBUV)
+ struct lws_context_eventlibs_libuv uv;
+#endif
+#if defined(LWS_WITH_LIBEVENT)
+ struct lws_context_eventlibs_libevent event;
+#endif
+ struct lws_event_loop_ops *event_loop_ops;
+
+
+#if defined(LWS_WITH_TLS)
+ struct lws_context_tls tls;
+#endif
+
+ char canonical_hostname[128];
+ const char *server_string;
+
+#ifdef LWS_LATENCY
+ unsigned long worst_latency;
+ char worst_latency_info[256];
+#endif
+
+#if defined(LWS_WITH_STATS)
+ uint64_t lws_stats[LWSSTATS_SIZE];
+ uint64_t last_dump;
+ int updated;
+#endif
+#if defined(LWS_WITH_ESP32)
+ unsigned long time_last_state_dump;
+ uint32_t last_free_heap;
+#endif
+
+ int max_fds;
+ int count_event_loop_static_asset_handles;
+ int started_with_parent;
+ int uid, gid;
+
+ int fd_random;
+
+ int count_wsi_allocated;
+ int count_cgi_spawned;
+ unsigned int options;
+ unsigned int fd_limit_per_thread;
+ unsigned int timeout_secs;
+ unsigned int pt_serv_buf_size;
+ int max_http_header_data;
+ int simultaneous_ssl_restriction;
+ int simultaneous_ssl;
+#if defined(LWS_WITH_PEER_LIMITS)
+ uint32_t pl_hash_elements; /* protected by context->lock */
+ uint32_t count_peers; /* protected by context->lock */
+ unsigned short ip_limit_ah;
+ unsigned short ip_limit_wsi;
+#endif
+ unsigned int deprecated:1;
+ unsigned int being_destroyed:1;
+ unsigned int being_destroyed1:1;
+ unsigned int being_destroyed2:1;
+ unsigned int requested_kill:1;
+ unsigned int protocol_init_done:1;
+ unsigned int doing_protocol_init:1;
+ unsigned int done_protocol_destroy_cb:1;
+ unsigned int finalize_destroy_after_internal_loops_stopped:1;
+ /*
+ * set to the Thread ID that's doing the service loop just before entry
+ * to poll indicates service thread likely idling in poll()
+ * volatile because other threads may check it as part of processing
+ * for pollfd event change.
+ */
+ volatile int service_tid;
+ int service_tid_detected;
+
+ short max_http_header_pool;
+ short count_threads;
+ short plugin_protocol_count;
+ short plugin_extension_count;
+ short server_string_len;
+ unsigned short ws_ping_pong_interval;
+ unsigned short deprecation_pending_listen_close_count;
+
+ uint8_t max_fi;
+};
+
+int
+lws_check_deferred_free(struct lws_context *context, int force);
+
+#define lws_get_context_protocol(ctx, x) ctx->vhost_list->protocols[x]
+#define lws_get_vh_protocol(vh, x) vh->protocols[x]
+
+LWS_EXTERN void
+__lws_close_free_wsi_final(struct lws *wsi);
+LWS_EXTERN void
+lws_libuv_closehandle(struct lws *wsi);
+LWS_EXTERN int
+lws_libuv_check_watcher_active(struct lws *wsi);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_plugins_init(struct lws_context * context, const char * const *d);
+
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_plugins_destroy(struct lws_context * context);
+
+LWS_EXTERN void
+lws_restart_ws_ping_pong_timer(struct lws *wsi);
+
+struct lws *
+lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd);
+
+int
+lws_jws_base64_enc(const char *in, size_t in_len, char *out, size_t out_max);
+
+void
+lws_vhost_destroy1(struct lws_vhost *vh);
+
+enum {
+ LWS_EV_READ = (1 << 0),
+ LWS_EV_WRITE = (1 << 1),
+ LWS_EV_START = (1 << 2),
+ LWS_EV_STOP = (1 << 3),
+
+ LWS_EV_PREPARE_DELETION = (1 << 31),
+};
+
+
+#if defined(LWS_WITH_ESP32)
+LWS_EXTERN int
+lws_find_string_in_file(const char *filename, const char *string, int stringlen);
+#endif
+
+#ifdef LWS_WITH_IPV6
+#define LWS_IPV6_ENABLED(vh) \
+ (!lws_check_opt(vh->context->options, LWS_SERVER_OPTION_DISABLE_IPV6) && \
+ !lws_check_opt(vh->options, LWS_SERVER_OPTION_DISABLE_IPV6))
+#else
+#define LWS_IPV6_ENABLED(context) (0)
+#endif
+
+#ifdef LWS_WITH_UNIX_SOCK
+#define LWS_UNIX_SOCK_ENABLED(vhost) \
+ (vhost->options & LWS_SERVER_OPTION_UNIX_SOCK)
+#else
+#define LWS_UNIX_SOCK_ENABLED(vhost) (0)
+#endif
+
+enum uri_path_states {
+ URIPS_IDLE,
+ URIPS_SEEN_SLASH,
+ URIPS_SEEN_SLASH_DOT,
+ URIPS_SEEN_SLASH_DOT_DOT,
+};
+
+enum uri_esc_states {
+ URIES_IDLE,
+ URIES_SEEN_PERCENT,
+ URIES_SEEN_PERCENT_H1,
+};
+
+
+#ifndef LWS_NO_CLIENT
+struct client_info_stash {
+ char *address;
+ char *path;
+ char *host;
+ char *origin;
+ char *protocol;
+ char *method;
+ char *iface;
+ char *alpn;
+};
+#endif
+
+
+signed char char_to_hex(const char c);
+
+
+struct lws_buflist {
+ struct lws_buflist *next;
+
+ size_t len;
+ size_t pos;
+
+ uint8_t buf[1]; /* true length of this is set by the oversize malloc */
+};
+
+#define lws_wsi_is_udp(___wsi) (!!___wsi->udp)
+
+#define LWS_H2_FRAME_HEADER_LENGTH 9
+
+
+struct lws {
+ /* structs */
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ struct _lws_http_mode_related http;
+#endif
+#if defined(LWS_ROLE_H2)
+ struct _lws_h2_related h2;
+#endif
+#if defined(LWS_ROLE_WS)
+ struct _lws_websocket_related *ws; /* allocated if we upgrade to ws */
+#endif
+
+ const struct lws_role_ops *role_ops;
+ lws_wsi_state_t wsistate;
+ lws_wsi_state_t wsistate_pre_close;
+
+ /* lifetime members */
+
+#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
+ struct lws_io_watcher w_read;
+#endif
+#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBEVENT)
+ struct lws_io_watcher w_write;
+#endif
+
+ /* pointers */
+
+ struct lws_context *context;
+ struct lws_vhost *vhost;
+ struct lws *parent; /* points to parent, if any */
+ struct lws *child_list; /* points to first child */
+ struct lws *sibling_list; /* subsequent children at same level */
+
+ const struct lws_protocols *protocol;
+ struct lws **same_vh_protocol_prev, *same_vh_protocol_next;
+
+ struct lws_dll_lws dll_timeout;
+ struct lws_dll_lws dll_hrtimer;
+ struct lws_dll_lws dll_buflist; /* guys with pending rxflow */
+
+#if defined(LWS_WITH_PEER_LIMITS)
+ struct lws_peer *peer;
+#endif
+
+ struct lws_udp *udp;
+#ifndef LWS_NO_CLIENT
+ struct client_info_stash *stash;
+ char *client_hostname_copy;
+ struct lws_dll_lws dll_active_client_conns;
+ struct lws_dll_lws dll_client_transaction_queue_head;
+ struct lws_dll_lws dll_client_transaction_queue;
+#endif
+ void *user_space;
+ void *opaque_parent_data;
+
+ struct lws_buflist *buflist;
+
+ /* truncated send handling */
+ unsigned char *trunc_alloc; /* non-NULL means buffering in progress */
+
+#if defined(LWS_WITH_TLS)
+ struct lws_lws_tls tls;
+#endif
+
+ lws_sock_file_fd_type desc; /* .filefd / .sockfd */
+#if defined(LWS_WITH_STATS)
+ uint64_t active_writable_req_us;
+#if defined(LWS_WITH_TLS)
+ uint64_t accept_start_us;
+#endif
+#endif
+
+ lws_usec_t pending_timer; /* hrtimer fires */
+ time_t pending_timeout_set; /* second-resolution timeout start */
+
+#ifdef LWS_LATENCY
+ unsigned long action_start;
+ unsigned long latency_start;
+#endif
+
+ /* ints */
+#define LWS_NO_FDS_POS (-1)
+ int position_in_fds_table;
+ unsigned int trunc_alloc_len; /* size of malloc */
+ unsigned int trunc_offset; /* where we are in terms of spilling */
+ unsigned int trunc_len; /* how much is buffered */
+#ifndef LWS_NO_CLIENT
+ int chunk_remaining;
+#endif
+ unsigned int cache_secs;
+
+ unsigned int hdr_parsing_completed:1;
+ unsigned int http2_substream:1;
+ unsigned int upgraded_to_http2:1;
+ unsigned int h2_stream_carries_ws:1;
+ unsigned int seen_nonpseudoheader:1;
+ unsigned int listener:1;
+ unsigned int user_space_externally_allocated:1;
+ unsigned int socket_is_permanently_unusable:1;
+ unsigned int rxflow_change_to:2;
+ unsigned int conn_stat_done:1;
+ unsigned int cache_reuse:1;
+ unsigned int cache_revalidate:1;
+ unsigned int cache_intermediaries:1;
+ unsigned int favoured_pollin:1;
+ unsigned int sending_chunked:1;
+ unsigned int interpreting:1;
+ unsigned int already_did_cce:1;
+ unsigned int told_user_closed:1;
+ unsigned int told_event_loop_closed:1;
+ unsigned int waiting_to_send_close_frame:1;
+ unsigned int close_needs_ack:1;
+ unsigned int ipv6:1;
+ unsigned int parent_carries_io:1;
+ unsigned int parent_pending_cb_on_writable:1;
+ unsigned int cgi_stdout_zero_length:1;
+ unsigned int seen_zero_length_recv:1;
+ unsigned int rxflow_will_be_applied:1;
+ unsigned int event_pipe:1;
+ unsigned int on_same_vh_list:1;
+ unsigned int handling_404:1;
+ unsigned int protocol_bind_balance:1;
+
+ unsigned int could_have_pending:1; /* detect back-to-back writes */
+ unsigned int outer_will_close:1;
+
+#ifdef LWS_WITH_ACCESS_LOG
+ unsigned int access_log_pending:1;
+#endif
+#ifndef LWS_NO_CLIENT
+ unsigned int do_ws:1; /* whether we are doing http or ws flow */
+ unsigned int chunked:1; /* if the clientside connection is chunked */
+ unsigned int client_rx_avail:1;
+ unsigned int client_http_body_pending:1;
+ unsigned int transaction_from_pipeline_queue:1;
+ unsigned int keepalive_active:1;
+ unsigned int keepalive_rejected:1;
+ unsigned int client_pipeline:1;
+ unsigned int client_h2_alpn:1;
+ unsigned int client_h2_substream:1;
+#endif
+
+#ifdef _WIN32
+ unsigned int sock_send_blocking:1;
+#endif
+
+#ifndef LWS_NO_CLIENT
+ unsigned short c_port;
+#endif
+ unsigned short pending_timeout_limit;
+
+ /* chars */
+
+ char lws_rx_parse_state; /* enum lws_rx_parse_state */
+ char rx_frame_type; /* enum lws_write_protocol */
+ char pending_timeout; /* enum pending_timeout */
+ char tsi; /* thread service index we belong to */
+ char protocol_interpret_idx;
+ char redirects;
+ uint8_t rxflow_bitmap;
+#ifdef LWS_WITH_CGI
+ char cgi_channel; /* which of stdin/out/err */
+ char hdr_state;
+#endif
+#ifndef LWS_NO_CLIENT
+ char chunk_parser; /* enum lws_chunk_parser */
+#endif
+#if defined(LWS_WITH_CGI) || !defined(LWS_NO_CLIENT)
+ char reason_bf; /* internal writeable callback reason bitfield */
+#endif
+#if defined(LWS_WITH_STATS) && defined(LWS_WITH_TLS)
+ char seen_rx;
+#endif
+ uint8_t ws_over_h2_count;
+ /* volatile to make sure code is aware other thread can change */
+ volatile char handling_pollout;
+ volatile char leave_pollout_active;
+};
+
+#define lws_is_flowcontrolled(w) (!!(wsi->rxflow_bitmap))
+
+void
+lws_service_do_ripe_rxflow(struct lws_context_per_thread *pt);
+
+LWS_EXTERN int log_level;
+
+LWS_EXTERN int
+lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
+ const char *iface);
+
+#if defined(LWS_WITH_IPV6)
+LWS_EXTERN unsigned long
+lws_get_addr_scope(const char *ipaddr);
+#endif
+
+LWS_EXTERN void
+lws_close_free_wsi(struct lws *wsi, enum lws_close_status, const char *caller);
+LWS_EXTERN void
+__lws_close_free_wsi(struct lws *wsi, enum lws_close_status, const char *caller);
+
+LWS_EXTERN void
+__lws_free_wsi(struct lws *wsi);
+
+LWS_EXTERN int
+__remove_wsi_socket_from_fds(struct lws *wsi);
+LWS_EXTERN int
+lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len);
+
+#ifndef LWS_LATENCY
+static inline void
+lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
+ int ret, int completion) {
+ do {
+ (void)context; (void)wsi; (void)action; (void)ret;
+ (void)completion;
+ } while (0);
+}
+static inline void
+lws_latency_pre(struct lws_context *context, struct lws *wsi) {
+ do { (void)context; (void)wsi; } while (0);
+}
+#else
+#define lws_latency_pre(_context, _wsi) lws_latency(_context, _wsi, NULL, 0, 0)
+extern void
+lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
+ int ret, int completion);
+#endif
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ws_client_rx_sm(struct lws *wsi, unsigned char c);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_parse(struct lws *wsi, unsigned char *buf, int *len);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_parse_urldecode(struct lws *wsi, uint8_t *_c);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_http_action(struct lws *wsi);
+
+LWS_EXTERN int
+lws_b64_selftest(void);
+
+LWS_EXTERN int
+lws_service_flag_pending(struct lws_context *context, int tsi);
+
+LWS_EXTERN int
+lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p);
+
+#if defined(_WIN32)
+LWS_EXTERN struct lws *
+wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd);
+
+LWS_EXTERN int
+insert_wsi(struct lws_context *context, struct lws *wsi);
+
+LWS_EXTERN int
+delete_from_fd(struct lws_context *context, lws_sockfd_type fd);
+#else
+#define wsi_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]
+#define insert_wsi(A,B) assert(A->lws_lookup[B->desc.sockfd - lws_plat_socket_offset()] == 0); A->lws_lookup[B->desc.sockfd - lws_plat_socket_offset()]=B
+#define delete_from_fd(A,B) A->lws_lookup[B - lws_plat_socket_offset()]=0
+#endif
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+__insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len);
+
+LWS_EXTERN void
+lws_remove_from_timeout_list(struct lws *wsi);
+
+LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
+lws_client_connect_2(struct lws *wsi);
+
+LWS_VISIBLE struct lws * LWS_WARN_UNUSED_RESULT
+lws_client_reset(struct lws **wsi, int ssl, const char *address, int port,
+ const char *path, const char *host);
+
+LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
+lws_create_new_server_wsi(struct lws_vhost *vhost, int fixed_tsi);
+
+LWS_EXTERN char * LWS_WARN_UNUSED_RESULT
+lws_generate_client_handshake(struct lws *wsi, char *pkt);
+
+LWS_EXTERN int
+lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd);
+
+LWS_EXTERN struct lws *
+lws_client_connect_via_info2(struct lws *wsi);
+
+
+
+LWS_EXTERN void
+lws_client_stash_destroy(struct lws *wsi);
+
+/*
+ * EXTENSIONS
+ */
+
+#if defined(LWS_WITHOUT_EXTENSIONS)
+#define lws_any_extension_handled(_a, _b, _c, _d) (0)
+#define lws_ext_cb_active(_a, _b, _c, _d) (0)
+#define lws_ext_cb_all_exts(_a, _b, _c, _d, _e) (0)
+#define lws_issue_raw_ext_access lws_issue_raw
+#define lws_context_init_extensions(_a, _b)
+#endif
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_client_interpret_server_handshake(struct lws *wsi);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ws_rx_sm(struct lws *wsi, char already_processed, unsigned char c);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_issue_raw_ext_access(struct lws *wsi, unsigned char *buf, size_t len);
+
+LWS_EXTERN void
+lws_role_transition(struct lws *wsi, enum lwsi_role role, enum lwsi_state state,
+ struct lws_role_ops *ops);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+user_callback_handle_rxflow(lws_callback_function, struct lws *wsi,
+ enum lws_callback_reasons reason, void *user,
+ void *in, size_t len);
+
+LWS_EXTERN int
+lws_plat_socket_offset(void);
+
+LWS_EXTERN int
+lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd);
+
+LWS_EXTERN int
+lws_plat_check_connection_error(struct lws *wsi);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_header_table_attach(struct lws *wsi, int autoservice);
+
+LWS_EXTERN int
+lws_header_table_detach(struct lws *wsi, int autoservice);
+LWS_EXTERN int
+__lws_header_table_detach(struct lws *wsi, int autoservice);
+
+LWS_EXTERN void
+lws_header_table_reset(struct lws *wsi, int autoservice);
+
+void
+__lws_header_table_reset(struct lws *wsi, int autoservice);
+
+LWS_EXTERN char * LWS_WARN_UNUSED_RESULT
+lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_hdr_simple_create(struct lws *wsi, enum lws_token_indexes h, const char *s);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ensure_user_space(struct lws *wsi);
+
+LWS_EXTERN int
+lws_change_pollfd(struct lws *wsi, int _and, int _or);
+
+#ifndef LWS_NO_SERVER
+ int _lws_vhost_init_server(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost);
+ LWS_EXTERN struct lws_vhost *
+ lws_select_vhost(struct lws_context *context, int port, const char *servername);
+ LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+ lws_parse_ws(struct lws *wsi, unsigned char **buf, size_t len);
+ LWS_EXTERN void
+ lws_server_get_canonical_hostname(struct lws_context *context,
+ const struct lws_context_creation_info *info);
+#else
+ #define _lws_vhost_init_server(_a, _b) (0)
+ #define lws_parse_ws(_a, _b, _c) (0)
+ #define lws_server_get_canonical_hostname(_a, _b)
+#endif
+
+#ifndef LWS_NO_DAEMONIZE
+ LWS_EXTERN int get_daemonize_pid();
+#else
+ #define get_daemonize_pid() (0)
+#endif
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+interface_to_sa(struct lws_vhost *vh, const char *ifname,
+ struct sockaddr_in *addr, size_t addrlen);
+LWS_EXTERN void lwsl_emit_stderr(int level, const char *line);
+
+#if !defined(LWS_WITH_TLS)
+ #define LWS_SSL_ENABLED(context) (0)
+ #define lws_context_init_server_ssl(_a, _b) (0)
+ #define lws_ssl_destroy(_a)
+ #define lws_context_init_alpn(_a)
+ #define lws_ssl_capable_read lws_ssl_capable_read_no_ssl
+ #define lws_ssl_capable_write lws_ssl_capable_write_no_ssl
+ #define lws_ssl_pending lws_ssl_pending_no_ssl
+ #define lws_server_socket_service_ssl(_b, _c) (0)
+ #define lws_ssl_close(_a) (0)
+ #define lws_ssl_context_destroy(_a)
+ #define lws_ssl_SSL_CTX_destroy(_a)
+ #define lws_ssl_remove_wsi_from_buffered_list(_a)
+ #define __lws_ssl_remove_wsi_from_buffered_list(_a)
+ #define lws_context_init_ssl_library(_a)
+ #define lws_tls_check_all_cert_lifetimes(_a)
+ #define lws_tls_acme_sni_cert_destroy(_a)
+#endif
+
+
+#if LWS_MAX_SMP > 1
+
+static LWS_INLINE void
+lws_pt_mutex_init(struct lws_context_per_thread *pt)
+{
+ pthread_mutex_init(&pt->lock, NULL);
+ pthread_mutex_init(&pt->lock_stats, NULL);
+}
+
+static LWS_INLINE void
+lws_pt_mutex_destroy(struct lws_context_per_thread *pt)
+{
+ pthread_mutex_destroy(&pt->lock_stats);
+ pthread_mutex_destroy(&pt->lock);
+}
+
+static LWS_INLINE void
+lws_pt_lock(struct lws_context_per_thread *pt, const char *reason)
+{
+ if (pt->lock_owner == pthread_self()) {
+ pt->lock_depth++;
+ return;
+ }
+ pthread_mutex_lock(&pt->lock);
+ pt->last_lock_reason = reason;
+ pt->lock_owner = pthread_self();
+ //lwsl_notice("tid %d: lock %s\n", pt->tid, reason);
+}
+
+static LWS_INLINE void
+lws_pt_unlock(struct lws_context_per_thread *pt)
+{
+ if (pt->lock_depth) {
+ pt->lock_depth--;
+ return;
+ }
+ pt->last_lock_reason = "free";
+ pt->lock_owner = 0;
+ //lwsl_notice("tid %d: unlock %s\n", pt->tid, pt->last_lock_reason);
+ pthread_mutex_unlock(&pt->lock);
+}
+
+static LWS_INLINE void
+lws_pt_stats_lock(struct lws_context_per_thread *pt)
+{
+ pthread_mutex_lock(&pt->lock_stats);
+}
+
+static LWS_INLINE void
+lws_pt_stats_unlock(struct lws_context_per_thread *pt)
+{
+ pthread_mutex_unlock(&pt->lock_stats);
+}
+
+static LWS_INLINE void
+lws_context_lock(struct lws_context *context)
+{
+ pthread_mutex_lock(&context->lock);
+}
+
+static LWS_INLINE void
+lws_context_unlock(struct lws_context *context)
+{
+ pthread_mutex_unlock(&context->lock);
+}
+
+static LWS_INLINE void
+lws_vhost_lock(struct lws_vhost *vhost)
+{
+ pthread_mutex_lock(&vhost->lock);
+}
+
+static LWS_INLINE void
+lws_vhost_unlock(struct lws_vhost *vhost)
+{
+ pthread_mutex_unlock(&vhost->lock);
+}
+
+
+#else
+#define lws_pt_mutex_init(_a) (void)(_a)
+#define lws_pt_mutex_destroy(_a) (void)(_a)
+#define lws_pt_lock(_a, b) (void)(_a)
+#define lws_pt_unlock(_a) (void)(_a)
+#define lws_context_lock(_a) (void)(_a)
+#define lws_context_unlock(_a) (void)(_a)
+#define lws_vhost_lock(_a) (void)(_a)
+#define lws_vhost_unlock(_a) (void)(_a)
+#define lws_pt_stats_lock(_a) (void)(_a)
+#define lws_pt_stats_unlock(_a) (void)(_a)
+#endif
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ssl_pending_no_ssl(struct lws *wsi);
+
+int
+lws_tls_check_cert_lifetime(struct lws_vhost *vhost);
+
+int lws_jws_selftest(void);
+
+
+#ifndef LWS_NO_CLIENT
+LWS_EXTERN int lws_client_socket_service(struct lws *wsi,
+ struct lws_pollfd *pollfd,
+ struct lws *wsi_conn);
+LWS_EXTERN struct lws *
+lws_client_wsi_effective(struct lws *wsi);
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_http_transaction_completed_client(struct lws *wsi);
+#if !defined(LWS_WITH_TLS)
+ #define lws_context_init_client_ssl(_a, _b) (0)
+#endif
+LWS_EXTERN void
+lws_decode_ssl_error(void);
+#else
+#define lws_context_init_client_ssl(_a, _b) (0)
+#endif
+
+LWS_EXTERN int
+__lws_rx_flow_control(struct lws *wsi);
+
+LWS_EXTERN int
+_lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa);
+
+#ifndef LWS_NO_SERVER
+LWS_EXTERN int
+lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len);
+#else
+#define lws_server_socket_service(_b, _c) (0)
+#define lws_handshake_server(_a, _b, _c) (0)
+#endif
+
+#ifdef LWS_WITH_ACCESS_LOG
+LWS_EXTERN int
+lws_access_log(struct lws *wsi);
+LWS_EXTERN void
+lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int meth);
+#else
+#define lws_access_log(_a)
+#endif
+
+LWS_EXTERN int
+lws_cgi_kill_terminated(struct lws_context_per_thread *pt);
+
+LWS_EXTERN void
+lws_cgi_remove_and_kill(struct lws *wsi);
+
+int
+lws_protocol_init(struct lws_context *context);
+
+int
+lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p);
+
+const struct lws_http_mount *
+lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len);
+
+/*
+ * custom allocator
+ */
+LWS_EXTERN void *
+lws_realloc(void *ptr, size_t size, const char *reason);
+
+LWS_EXTERN void * LWS_WARN_UNUSED_RESULT
+lws_zalloc(size_t size, const char *reason);
+
+#ifdef LWS_PLAT_OPTEE
+void *lws_malloc(size_t size, const char *reason);
+void lws_free(void *p);
+#define lws_free_set_NULL(P) do { lws_free(P); (P) = NULL; } while(0)
+#else
+#define lws_malloc(S, R) lws_realloc(NULL, S, R)
+#define lws_free(P) lws_realloc(P, 0, "lws_free")
+#define lws_free_set_NULL(P) do { lws_realloc(P, 0, "free"); (P) = NULL; } while(0)
+#endif
+
+int
+lws_plat_pipe_create(struct lws *wsi);
+int
+lws_plat_pipe_signal(struct lws *wsi);
+void
+lws_plat_pipe_close(struct lws *wsi);
+int
+lws_create_event_pipes(struct lws_context *context);
+
+const struct lws_plat_file_ops *
+lws_vfs_select_fops(const struct lws_plat_file_ops *fops, const char *vfs_path,
+ const char **vpath);
+
+/* lws_plat_ */
+LWS_EXTERN void
+lws_plat_delete_socket_from_fds(struct lws_context *context,
+ struct lws *wsi, int m);
+LWS_EXTERN void
+lws_plat_insert_socket_into_fds(struct lws_context *context,
+ struct lws *wsi);
+LWS_EXTERN void
+lws_plat_service_periodic(struct lws_context *context);
+
+LWS_EXTERN int
+lws_plat_change_pollfd(struct lws_context *context, struct lws *wsi,
+ struct lws_pollfd *pfd);
+LWS_EXTERN void
+lws_add_wsi_to_draining_ext_list(struct lws *wsi);
+LWS_EXTERN void
+lws_remove_wsi_from_draining_ext_list(struct lws *wsi);
+LWS_EXTERN int
+lws_plat_context_early_init(void);
+LWS_EXTERN void
+lws_plat_context_early_destroy(struct lws_context *context);
+LWS_EXTERN void
+lws_plat_context_late_destroy(struct lws_context *context);
+LWS_EXTERN int
+lws_poll_listen_fd(struct lws_pollfd *fd);
+LWS_EXTERN int
+lws_plat_service(struct lws_context *context, int timeout_ms);
+LWS_EXTERN LWS_VISIBLE int
+_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
+LWS_EXTERN int
+lws_plat_init(struct lws_context *context,
+ const struct lws_context_creation_info *info);
+LWS_EXTERN void
+lws_plat_drop_app_privileges(const struct lws_context_creation_info *info);
+LWS_EXTERN unsigned long long
+time_in_microseconds(void);
+LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
+lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt);
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_plat_inet_pton(int af, const char *src, void *dst);
+
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_check_utf8(unsigned char *state, unsigned char *buf, size_t len);
+LWS_EXTERN int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
+ lws_filepos_t *amount);
+
+
+LWS_EXTERN void
+lws_same_vh_protocol_remove(struct lws *wsi);
+LWS_EXTERN void
+lws_same_vh_protocol_insert(struct lws *wsi, int n);
+
+LWS_EXTERN int
+lws_broadcast(struct lws_context *context, int reason, void *in, size_t len);
+
+#if defined(LWS_WITH_STATS)
+ void
+ lws_stats_atomic_bump(struct lws_context * context,
+ struct lws_context_per_thread *pt, int index, uint64_t bump);
+ void
+ lws_stats_atomic_max(struct lws_context * context,
+ struct lws_context_per_thread *pt, int index, uint64_t val);
+#else
+ static inline uint64_t lws_stats_atomic_bump(struct lws_context * context,
+ struct lws_context_per_thread *pt, int index, uint64_t bump) {
+ (void)context; (void)pt; (void)index; (void)bump; return 0; }
+ static inline uint64_t lws_stats_atomic_max(struct lws_context * context,
+ struct lws_context_per_thread *pt, int index, uint64_t val) {
+ (void)context; (void)pt; (void)index; (void)val; return 0; }
+#endif
+
+/* socks */
+void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
+ ssize_t *msg_len);
+
+#if defined(LWS_WITH_PEER_LIMITS)
+void
+lws_peer_track_wsi_close(struct lws_context *context, struct lws_peer *peer);
+int
+lws_peer_confirm_ah_attach_ok(struct lws_context *context, struct lws_peer *peer);
+void
+lws_peer_track_ah_detach(struct lws_context *context, struct lws_peer *peer);
+void
+lws_peer_cull_peer_wait_list(struct lws_context *context);
+struct lws_peer *
+lws_get_or_create_peer(struct lws_vhost *vhost, lws_sockfd_type sockfd);
+void
+lws_peer_add_wsi(struct lws_context *context, struct lws_peer *peer,
+ struct lws *wsi);
+void
+lws_peer_dump_from_wsi(struct lws *wsi);
+#endif
+
+
+void
+__lws_remove_from_timeout_list(struct lws *wsi);
+
+lws_usec_t
+__lws_hrtimer_service(struct lws_context_per_thread *pt);
+
+void
+__lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
+int
+__lws_change_pollfd(struct lws *wsi, int _and, int _or);
+
+
+int
+lws_callback_as_writeable(struct lws *wsi);
+int
+lws_buflist_aware_read(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_tokens *ebuf);
+int
+lws_buflist_aware_consume(struct lws *wsi, struct lws_tokens *ebuf, int used,
+ int buffered);
+
+
+char *
+lws_generate_client_ws_handshake(struct lws *wsi, char *p);
+int
+lws_client_ws_upgrade(struct lws *wsi, const char **cce);
+int
+lws_create_client_ws_object(struct lws_client_connect_info *i, struct lws *wsi);
+int
+lws_alpn_comma_to_openssl(const char *comma, uint8_t *os, int len);
+int
+lws_role_call_alpn_negotiated(struct lws *wsi, const char *alpn);
+int
+lws_tls_server_conn_alpn(struct lws *wsi);
+
+int
+lws_ws_client_rx_sm_block(struct lws *wsi, unsigned char **buf, size_t len);
+void
+lws_destroy_event_pipe(struct lws *wsi);
+void
+lws_context_destroy2(struct lws_context *context);
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/thirdparty/libwebsockets/core/service.c b/thirdparty/libwebsockets/core/service.c
new file mode 100644
index 0000000000..6523058814
--- /dev/null
+++ b/thirdparty/libwebsockets/core/service.c
@@ -0,0 +1,987 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+int
+lws_callback_as_writeable(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ int n, m;
+
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB, 1);
+#if defined(LWS_WITH_STATS)
+ if (wsi->active_writable_req_us) {
+ uint64_t ul = time_in_microseconds() -
+ wsi->active_writable_req_us;
+
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_MS_WRITABLE_DELAY, ul);
+ lws_stats_atomic_max(wsi->context, pt,
+ LWSSTATS_MS_WORST_WRITABLE_DELAY, ul);
+ wsi->active_writable_req_us = 0;
+ }
+#endif
+
+ n = wsi->role_ops->writeable_cb[lwsi_role_server(wsi)];
+
+ m = user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, (enum lws_callback_reasons) n,
+ wsi->user_space, NULL, 0);
+
+ return m;
+}
+
+LWS_VISIBLE int
+lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
+{
+ volatile struct lws *vwsi = (volatile struct lws *)wsi;
+ int n;
+
+ //lwsl_notice("%s: %p\n", __func__, wsi);
+
+ vwsi->leave_pollout_active = 0;
+ vwsi->handling_pollout = 1;
+ /*
+ * if another thread wants POLLOUT on us, from here on while
+ * handling_pollout is set, he will only set leave_pollout_active.
+ * If we are going to disable POLLOUT, we will check that first.
+ */
+ wsi->could_have_pending = 0; /* clear back-to-back write detection */
+
+ /*
+ * user callback is lowest priority to get these notifications
+ * actually, since other pending things cannot be disordered
+ *
+ * Priority 1: pending truncated sends are incomplete ws fragments
+ * If anything else sent first the protocol would be
+ * corrupted.
+ */
+
+ if (wsi->trunc_len) {
+ //lwsl_notice("%s: completing partial\n", __func__);
+ if (lws_issue_raw(wsi, wsi->trunc_alloc + wsi->trunc_offset,
+ wsi->trunc_len) < 0) {
+ lwsl_info("%s signalling to close\n", __func__);
+ goto bail_die;
+ }
+ /* leave POLLOUT active either way */
+ goto bail_ok;
+ } else
+ if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE) {
+ wsi->socket_is_permanently_unusable = 1;
+ goto bail_die; /* retry closing now */
+ }
+
+#ifdef LWS_WITH_CGI
+ /*
+ * A cgi master's wire protocol remains h1 or h2. He is just getting
+ * his data from his child cgis.
+ */
+ if (wsi->http.cgi) {
+ /* also one shot */
+ if (pollfd)
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_info("failed at set pollfd\n");
+ return 1;
+ }
+ goto user_service_go_again;
+ }
+#endif
+
+ /* if we got here, we should have wire protocol ops set on the wsi */
+ assert(wsi->role_ops);
+
+ if (!wsi->role_ops->handle_POLLOUT)
+ goto bail_ok;
+
+ switch ((wsi->role_ops->handle_POLLOUT)(wsi)) {
+ case LWS_HP_RET_BAIL_OK:
+ goto bail_ok;
+ case LWS_HP_RET_BAIL_DIE:
+ goto bail_die;
+ case LWS_HP_RET_USER_SERVICE:
+ break;
+ default:
+ assert(0);
+ }
+
+ /* one shot */
+
+ if (wsi->parent_carries_io) {
+ vwsi->handling_pollout = 0;
+ vwsi->leave_pollout_active = 0;
+
+ return lws_callback_as_writeable(wsi);
+ }
+
+ if (pollfd) {
+ int eff = vwsi->leave_pollout_active;
+
+ if (!eff) {
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_info("failed at set pollfd\n");
+ goto bail_die;
+ }
+ }
+
+ vwsi->handling_pollout = 0;
+
+ /* cannot get leave_pollout_active set after the above */
+ if (!eff && wsi->leave_pollout_active) {
+ /*
+ * got set inbetween sampling eff and clearing
+ * handling_pollout, force POLLOUT on
+ */
+ lwsl_debug("leave_pollout_active\n");
+ if (lws_change_pollfd(wsi, 0, LWS_POLLOUT)) {
+ lwsl_info("failed at set pollfd\n");
+ goto bail_die;
+ }
+ }
+
+ vwsi->leave_pollout_active = 0;
+ }
+
+ if (lwsi_role_client(wsi) &&
+ !wsi->hdr_parsing_completed &&
+ lwsi_state(wsi) != LRS_H2_WAITING_TO_SEND_HEADERS &&
+ lwsi_state(wsi) != LRS_ISSUE_HTTP_BODY
+ )
+ goto bail_ok;
+
+
+#ifdef LWS_WITH_CGI
+user_service_go_again:
+#endif
+
+ if (wsi->role_ops->perform_user_POLLOUT) {
+ if (wsi->role_ops->perform_user_POLLOUT(wsi) == -1)
+ goto bail_die;
+ else
+ goto bail_ok;
+ }
+
+ lwsl_debug("%s: %p: non mux: wsistate 0x%x, ops %s\n", __func__, wsi,
+ wsi->wsistate, wsi->role_ops->name);
+
+ vwsi = (volatile struct lws *)wsi;
+ vwsi->leave_pollout_active = 0;
+
+ n = lws_callback_as_writeable(wsi);
+ vwsi->handling_pollout = 0;
+
+ if (vwsi->leave_pollout_active)
+ lws_change_pollfd(wsi, 0, LWS_POLLOUT);
+
+ return n;
+
+ /*
+ * since these don't disable the POLLOUT, they are always doing the
+ * right thing for leave_pollout_active whether it was set or not.
+ */
+
+bail_ok:
+ vwsi->handling_pollout = 0;
+ vwsi->leave_pollout_active = 0;
+
+ return 0;
+
+bail_die:
+ vwsi->handling_pollout = 0;
+ vwsi->leave_pollout_active = 0;
+
+ return -1;
+}
+
+static int
+__lws_service_timeout_check(struct lws *wsi, time_t sec)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ int n = 0;
+
+ (void)n;
+
+ /*
+ * if we went beyond the allowed time, kill the
+ * connection
+ */
+ if (wsi->dll_timeout.prev &&
+ lws_compare_time_t(wsi->context, sec, wsi->pending_timeout_set) >
+ wsi->pending_timeout_limit) {
+
+ if (wsi->desc.sockfd != LWS_SOCK_INVALID &&
+ wsi->position_in_fds_table >= 0)
+ n = pt->fds[wsi->position_in_fds_table].events;
+
+ lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_TIMEOUTS, 1);
+
+ /* no need to log normal idle keepalive timeout */
+ if (wsi->pending_timeout != PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE)
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ lwsl_info("wsi %p: TIMEDOUT WAITING on %d "
+ "(did hdr %d, ah %p, wl %d, pfd "
+ "events %d) %llu vs %llu\n",
+ (void *)wsi, wsi->pending_timeout,
+ wsi->hdr_parsing_completed, wsi->http.ah,
+ pt->http.ah_wait_list_length, n,
+ (unsigned long long)sec,
+ (unsigned long long)wsi->pending_timeout_limit);
+#if defined(LWS_WITH_CGI)
+ if (wsi->http.cgi)
+ lwsl_notice("CGI timeout: %s\n", wsi->http.cgi->summary);
+#endif
+#else
+ lwsl_info("wsi %p: TIMEDOUT WAITING on %d ", (void *)wsi,
+ wsi->pending_timeout);
+#endif
+
+ /*
+ * Since he failed a timeout, he already had a chance to do
+ * something and was unable to... that includes situations like
+ * half closed connections. So process this "failed timeout"
+ * close as a violent death and don't try to do protocol
+ * cleanup like flush partials.
+ */
+ wsi->socket_is_permanently_unusable = 1;
+ if (lwsi_state(wsi) == LRS_WAITING_SSL && wsi->protocol)
+ wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
+ wsi->user_space,
+ (void *)"Timed out waiting SSL", 21);
+
+ __lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "timeout");
+
+ return 1;
+ }
+
+ return 0;
+}
+
+int lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ uint8_t *buffered;
+ size_t blen;
+ int ret = 0, m;
+
+ /* his RX is flowcontrolled, don't send remaining now */
+ blen = lws_buflist_next_segment_len(&wsi->buflist, &buffered);
+ if (blen) {
+ if (buf >= buffered && buf + len <= buffered + blen) {
+ /* rxflow while we were spilling prev rxflow */
+ lwsl_info("%s: staying in rxflow buf\n", __func__);
+
+ return 1;
+ }
+ ret = 1;
+ }
+
+ /* a new rxflow, buffer it and warn caller */
+
+ m = lws_buflist_append_segment(&wsi->buflist, buf + n, len - n);
+
+ if (m < 0)
+ return -1;
+ if (m) {
+ lwsl_debug("%s: added %p to rxflow list\n", __func__, wsi);
+ lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
+ }
+
+ return ret;
+}
+
+/* this is used by the platform service code to stop us waiting for network
+ * activity in poll() when we have something that already needs service
+ */
+
+LWS_VISIBLE LWS_EXTERN int
+lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[tsi];
+
+ /* Figure out if we really want to wait in poll()
+ * We only need to wait if really nothing already to do and we have
+ * to wait for something from network
+ */
+#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
+ /* 1) if we know we are draining rx ext, do not wait in poll */
+ if (pt->ws.rx_draining_ext_list)
+ return 0;
+#endif
+
+ /* 2) if we know we have non-network pending data, do not wait in poll */
+
+ if (pt->context->tls_ops &&
+ pt->context->tls_ops->fake_POLLIN_for_buffered)
+ if (pt->context->tls_ops->fake_POLLIN_for_buffered(pt))
+ return 0;
+
+ /* 3) If there is any wsi with rxflow buffered and in a state to process
+ * it, we should not wait in poll
+ */
+
+ lws_start_foreach_dll(struct lws_dll_lws *, d, pt->dll_head_buflist.next) {
+ struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
+
+ if (lwsi_state(wsi) != LRS_DEFERRING_ACTION)
+ return 0;
+
+ } lws_end_foreach_dll(d);
+
+ return timeout_ms;
+}
+
+/*
+ * POLLIN said there is something... we must read it, and either use it; or
+ * if other material already in the buflist append it and return the buflist
+ * head material.
+ */
+int
+lws_buflist_aware_read(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_tokens *ebuf)
+{
+ int n, prior = (int)lws_buflist_next_segment_len(&wsi->buflist, NULL);
+
+ ebuf->token = (char *)pt->serv_buf;
+ ebuf->len = lws_ssl_capable_read(wsi, pt->serv_buf,
+ wsi->context->pt_serv_buf_size);
+
+ if (ebuf->len == LWS_SSL_CAPABLE_MORE_SERVICE && prior)
+ goto get_from_buflist;
+
+ if (ebuf->len <= 0)
+ return 0;
+
+ /* nothing in buflist already? Then just use what we read */
+
+ if (!prior)
+ return 0;
+
+ /* stash what we read */
+
+ n = lws_buflist_append_segment(&wsi->buflist, (uint8_t *)ebuf->token,
+ ebuf->len);
+ if (n < 0)
+ return -1;
+ if (n) {
+ lwsl_debug("%s: added %p to rxflow list\n", __func__, wsi);
+ lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
+ }
+
+ /* get the first buflist guy in line */
+
+get_from_buflist:
+
+ ebuf->len = (int)lws_buflist_next_segment_len(&wsi->buflist,
+ (uint8_t **)&ebuf->token);
+
+ return 1; /* came from buflist */
+}
+
+int
+lws_buflist_aware_consume(struct lws *wsi, struct lws_tokens *ebuf, int used,
+ int buffered)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ int m;
+
+ /* it's in the buflist; we didn't use any */
+
+ if (!used && buffered)
+ return 0;
+
+ if (used && buffered) {
+ m = lws_buflist_use_segment(&wsi->buflist, used);
+ lwsl_info("%s: draining rxflow: used %d, next %d\n",
+ __func__, used, m);
+ if (m)
+ return 0;
+
+ lwsl_info("%s: removed %p from dll_buflist\n", __func__, wsi);
+ lws_dll_lws_remove(&wsi->dll_buflist);
+
+ return 0;
+ }
+
+ /* any remainder goes on the buflist */
+
+ if (used != ebuf->len) {
+ m = lws_buflist_append_segment(&wsi->buflist,
+ (uint8_t *)ebuf->token + used,
+ ebuf->len - used);
+ if (m < 0)
+ return 1; /* OOM */
+ if (m) {
+ lwsl_debug("%s: added %p to rxflow list\n", __func__, wsi);
+ lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
+ }
+ }
+
+ return 0;
+}
+
+void
+lws_service_do_ripe_rxflow(struct lws_context_per_thread *pt)
+{
+ struct lws_pollfd pfd;
+
+ if (!pt->dll_head_buflist.next)
+ return;
+
+ /*
+ * service all guys with pending rxflow that reached a state they can
+ * accept the pending data
+ */
+
+ lws_pt_lock(pt, __func__);
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ pt->dll_head_buflist.next) {
+ struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
+
+ pfd.events = LWS_POLLIN;
+ pfd.revents = LWS_POLLIN;
+ pfd.fd = -1;
+
+ lwsl_debug("%s: rxflow processing: %p 0x%x\n", __func__, wsi,
+ wsi->wsistate);
+
+ if (!lws_is_flowcontrolled(wsi) &&
+ lwsi_state(wsi) != LRS_DEFERRING_ACTION &&
+ (wsi->role_ops->handle_POLLIN)(pt, wsi, &pfd) ==
+ LWS_HPI_RET_PLEASE_CLOSE_ME)
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "close_and_handled");
+
+ } lws_end_foreach_dll_safe(d, d1);
+
+ lws_pt_unlock(pt);
+}
+
+/*
+ * guys that need POLLIN service again without waiting for network action
+ * can force POLLIN here if not flowcontrolled, so they will get service.
+ *
+ * Return nonzero if anybody got their POLLIN faked
+ */
+int
+lws_service_flag_pending(struct lws_context *context, int tsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[tsi];
+
+#if defined(LWS_WITH_TLS)
+ struct lws *wsi, *wsi_next;
+#endif
+ int forced = 0;
+
+ lws_pt_lock(pt, __func__);
+
+ /*
+ * 1) If there is any wsi with a buflist and in a state to process
+ * it, we should not wait in poll
+ */
+
+ lws_start_foreach_dll(struct lws_dll_lws *, d, pt->dll_head_buflist.next) {
+ struct lws *wsi = lws_container_of(d, struct lws, dll_buflist);
+
+ if (lwsi_state(wsi) != LRS_DEFERRING_ACTION) {
+ forced = 1;
+ break;
+ }
+ } lws_end_foreach_dll(d);
+
+#if defined(LWS_ROLE_WS)
+ forced |= role_ops_ws.service_flag_pending(context, tsi);
+#endif
+
+#if defined(LWS_WITH_TLS)
+ /*
+ * 2) For all guys with buffered SSL read data already saved up, if they
+ * are not flowcontrolled, fake their POLLIN status so they'll get
+ * service to use up the buffered incoming data, even though their
+ * network socket may have nothing
+ */
+ wsi = pt->tls.pending_read_list;
+ while (wsi) {
+ wsi_next = wsi->tls.pending_read_list_next;
+ pt->fds[wsi->position_in_fds_table].revents |=
+ pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
+ if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN) {
+ forced = 1;
+ /*
+ * he's going to get serviced now, take him off the
+ * list of guys with buffered SSL. If he still has some
+ * at the end of the service, he'll get put back on the
+ * list then.
+ */
+ __lws_ssl_remove_wsi_from_buffered_list(wsi);
+ }
+
+ wsi = wsi_next;
+ }
+#endif
+
+ lws_pt_unlock(pt);
+
+ return forced;
+}
+
+static int
+lws_service_periodic_checks(struct lws_context *context,
+ struct lws_pollfd *pollfd, int tsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[tsi];
+ lws_sockfd_type our_fd = 0, tmp_fd;
+ struct lws *wsi;
+ int timed_out = 0;
+ time_t now;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ struct allocated_headers *ah;
+ int m;
+#endif
+
+ if (!context->protocol_init_done)
+ if (lws_protocol_init(context))
+ return -1;
+
+ time(&now);
+
+ /*
+ * handle case that system time was uninitialized when lws started
+ * at boot, and got initialized a little later
+ */
+ if (context->time_up < 1464083026 && now > 1464083026)
+ context->time_up = now;
+
+ if (context->last_timeout_check_s &&
+ now - context->last_timeout_check_s > 100) {
+ /*
+ * There has been a discontiguity. Any stored time that is
+ * less than context->time_discontiguity should have context->
+ * time_fixup added to it.
+ *
+ * Some platforms with no RTC will experience this as a normal
+ * event when ntp sets their clock, but we can have started
+ * long before that with a 0-based unix time.
+ */
+
+ context->time_discontiguity = now;
+ context->time_fixup = now - context->last_timeout_check_s;
+
+ lwsl_notice("time discontiguity: at old time %llus, "
+ "new time %llus: +%llus\n",
+ (unsigned long long)context->last_timeout_check_s,
+ (unsigned long long)context->time_discontiguity,
+ (unsigned long long)context->time_fixup);
+
+ context->last_timeout_check_s = now - 1;
+ }
+
+ if (!lws_compare_time_t(context, context->last_timeout_check_s, now))
+ return 0;
+
+ context->last_timeout_check_s = now;
+
+#if defined(LWS_WITH_STATS)
+ if (!tsi && now - context->last_dump > 10) {
+ lws_stats_log_dump(context);
+ context->last_dump = now;
+ }
+#endif
+
+ lws_plat_service_periodic(context);
+ lws_check_deferred_free(context, 0);
+
+#if defined(LWS_WITH_PEER_LIMITS)
+ lws_peer_cull_peer_wait_list(context);
+#endif
+
+ /* retire unused deprecated context */
+#if !defined(LWS_PLAT_OPTEE) && !defined(LWS_WITH_ESP32)
+#if !defined(_WIN32)
+ if (context->deprecated && !context->count_wsi_allocated) {
+ lwsl_notice("%s: ending deprecated context\n", __func__);
+ kill(getpid(), SIGINT);
+ return 0;
+ }
+#endif
+#endif
+ /* global timeout check once per second */
+
+ if (pollfd)
+ our_fd = pollfd->fd;
+
+ /*
+ * Phase 1: check every wsi on the timeout check list
+ */
+
+ lws_pt_lock(pt, __func__);
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ context->pt[tsi].dll_head_timeout.next) {
+ wsi = lws_container_of(d, struct lws, dll_timeout);
+ tmp_fd = wsi->desc.sockfd;
+ if (__lws_service_timeout_check(wsi, now)) {
+ /* he did time out... */
+ if (tmp_fd == our_fd)
+ /* it was the guy we came to service! */
+ timed_out = 1;
+ /* he's gone, no need to mark as handled */
+ }
+ } lws_end_foreach_dll_safe(d, d1);
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ /*
+ * Phase 2: double-check active ah timeouts independent of wsi
+ * timeout status
+ */
+
+ ah = pt->http.ah_list;
+ while (ah) {
+ int len;
+ char buf[256];
+ const unsigned char *c;
+
+ if (!ah->in_use || !ah->wsi || !ah->assigned ||
+ (ah->wsi->vhost &&
+ lws_compare_time_t(context, now, ah->assigned) <
+ ah->wsi->vhost->timeout_secs_ah_idle + 360)) {
+ ah = ah->next;
+ continue;
+ }
+
+ /*
+ * a single ah session somehow got held for
+ * an unreasonable amount of time.
+ *
+ * Dump info on the connection...
+ */
+ wsi = ah->wsi;
+ buf[0] = '\0';
+#if !defined(LWS_PLAT_OPTEE)
+ lws_get_peer_simple(wsi, buf, sizeof(buf));
+#else
+ buf[0] = '\0';
+#endif
+ lwsl_notice("ah excessive hold: wsi %p\n"
+ " peer address: %s\n"
+ " ah pos %u\n",
+ wsi, buf, ah->pos);
+ buf[0] = '\0';
+ m = 0;
+ do {
+ c = lws_token_to_string(m);
+ if (!c)
+ break;
+ if (!(*c))
+ break;
+
+ len = lws_hdr_total_length(wsi, m);
+ if (!len || len > (int)sizeof(buf) - 1) {
+ m++;
+ continue;
+ }
+
+ if (lws_hdr_copy(wsi, buf,
+ sizeof buf, m) > 0) {
+ buf[sizeof(buf) - 1] = '\0';
+
+ lwsl_notice(" %s = %s\n",
+ (const char *)c, buf);
+ }
+ m++;
+ } while (1);
+
+ /* explicitly detach the ah */
+ lws_header_table_detach(wsi, 0);
+
+ /* ... and then drop the connection */
+
+ m = 0;
+ if (wsi->desc.sockfd == our_fd) {
+ m = timed_out;
+
+ /* it was the guy we came to service! */
+ timed_out = 1;
+ }
+
+ if (!m) /* if he didn't already timeout */
+ __lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "excessive ah");
+
+ ah = pt->http.ah_list;
+ }
+#endif
+ lws_pt_unlock(pt);
+
+#if 0
+ {
+ char s[300], *p = s;
+
+ for (n = 0; n < context->count_threads; n++)
+ p += sprintf(p, " %7lu (%5d), ",
+ context->pt[n].count_conns,
+ context->pt[n].fds_count);
+
+ lwsl_notice("load: %s\n", s);
+ }
+#endif
+ /*
+ * Phase 3: vhost / protocol timer callbacks
+ */
+
+ wsi = NULL;
+ lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
+ struct lws_timed_vh_protocol *nx;
+ if (v->timed_vh_protocol_list) {
+ lws_start_foreach_ll(struct lws_timed_vh_protocol *,
+ q, v->timed_vh_protocol_list) {
+ if (now >= q->time) {
+ if (!wsi)
+ wsi = lws_zalloc(sizeof(*wsi), "cbwsi");
+ wsi->context = context;
+ wsi->vhost = v;
+ wsi->protocol = q->protocol;
+ lwsl_debug("timed cb: vh %s, protocol %s, reason %d\n", v->name, q->protocol->name, q->reason);
+ q->protocol->callback(wsi, q->reason, NULL, NULL, 0);
+ nx = q->next;
+ lws_timed_callback_remove(v, q);
+ q = nx;
+ continue; /* we pointed ourselves to the next from the now-deleted guy */
+ }
+ } lws_end_foreach_ll(q, next);
+ }
+ } lws_end_foreach_ll(v, vhost_next);
+ if (wsi)
+ lws_free(wsi);
+
+ /*
+ * Phase 4: check for unconfigured vhosts due to required
+ * interface missing before
+ */
+
+ lws_context_lock(context);
+ lws_start_foreach_llp(struct lws_vhost **, pv,
+ context->no_listener_vhost_list) {
+ struct lws_vhost *v = *pv;
+ lwsl_debug("deferred iface: checking if on vh %s\n", (*pv)->name);
+ if (_lws_vhost_init_server(NULL, *pv) == 0) {
+ /* became happy */
+ lwsl_notice("vh %s: became connected\n", v->name);
+ *pv = v->no_listener_vhost_list;
+ v->no_listener_vhost_list = NULL;
+ break;
+ }
+ } lws_end_foreach_llp(pv, no_listener_vhost_list);
+ lws_context_unlock(context);
+
+ /*
+ * Phase 5: role periodic checks
+ */
+#if defined(LWS_ROLE_WS)
+ role_ops_ws.periodic_checks(context, tsi, now);
+#endif
+#if defined(LWS_ROLE_CGI)
+ role_ops_cgi.periodic_checks(context, tsi, now);
+#endif
+
+ /*
+ * Phase 6: check the remaining cert lifetime daily
+ */
+
+ if (context->tls_ops &&
+ context->tls_ops->periodic_housekeeping)
+ context->tls_ops->periodic_housekeeping(context, now);
+
+ return timed_out;
+}
+
+LWS_VISIBLE int
+lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
+ int tsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[tsi];
+ struct lws *wsi;
+
+ if (!context || context->being_destroyed1)
+ return -1;
+
+ /* the socket we came to service timed out, nothing to do */
+ if (lws_service_periodic_checks(context, pollfd, tsi) || !pollfd)
+ return 0;
+
+ /* no, here to service a socket descriptor */
+ wsi = wsi_from_fd(context, pollfd->fd);
+ if (!wsi)
+ /* not lws connection ... leave revents alone and return */
+ return 0;
+
+ /*
+ * so that caller can tell we handled, past here we need to
+ * zero down pollfd->revents after handling
+ */
+
+ /* handle session socket closed */
+
+ if ((!(pollfd->revents & pollfd->events & LWS_POLLIN)) &&
+ (pollfd->revents & LWS_POLLHUP)) {
+ wsi->socket_is_permanently_unusable = 1;
+ lwsl_debug("Session Socket %p (fd=%d) dead\n",
+ (void *)wsi, pollfd->fd);
+
+ goto close_and_handled;
+ }
+
+#ifdef _WIN32
+ if (pollfd->revents & LWS_POLLOUT)
+ wsi->sock_send_blocking = FALSE;
+#endif
+
+ if ((!(pollfd->revents & pollfd->events & LWS_POLLIN)) &&
+ (pollfd->revents & LWS_POLLHUP)) {
+ lwsl_debug("pollhup\n");
+ wsi->socket_is_permanently_unusable = 1;
+ goto close_and_handled;
+ }
+
+#if defined(LWS_WITH_TLS)
+ if (lwsi_state(wsi) == LRS_SHUTDOWN &&
+ lws_is_ssl(wsi) && wsi->tls.ssl) {
+ switch (__lws_tls_shutdown(wsi)) {
+ case LWS_SSL_CAPABLE_DONE:
+ case LWS_SSL_CAPABLE_ERROR:
+ goto close_and_handled;
+
+ case LWS_SSL_CAPABLE_MORE_SERVICE_READ:
+ case LWS_SSL_CAPABLE_MORE_SERVICE_WRITE:
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ goto handled;
+ }
+ }
+#endif
+ wsi->could_have_pending = 0; /* clear back-to-back write detection */
+
+ /* okay, what we came here to do... */
+
+ /* if we got here, we should have wire protocol ops set on the wsi */
+ assert(wsi->role_ops);
+
+ // lwsl_notice("%s: %s: wsistate 0x%x\n", __func__, wsi->role_ops->name,
+ // wsi->wsistate);
+
+ switch ((wsi->role_ops->handle_POLLIN)(pt, wsi, pollfd)) {
+ case LWS_HPI_RET_WSI_ALREADY_DIED:
+ return 1;
+ case LWS_HPI_RET_HANDLED:
+ break;
+ case LWS_HPI_RET_PLEASE_CLOSE_ME:
+close_and_handled:
+ lwsl_debug("%p: Close and handled\n", wsi);
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "close_and_handled");
+#if defined(_DEBUG) && defined(LWS_WITH_LIBUV)
+ /*
+ * confirm close has no problem being called again while
+ * it waits for libuv service to complete the first async
+ * close
+ */
+ if (context->event_loop_ops == &event_loop_ops_uv)
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "close_and_handled uv repeat test");
+#endif
+ /*
+ * pollfd may point to something else after the close
+ * due to pollfd swapping scheme on delete on some platforms
+ * we can't clear revents now because it'd be the wrong guy's
+ * revents
+ */
+ return 1;
+ default:
+ assert(0);
+ }
+#if defined(LWS_WITH_TLS)
+handled:
+#endif
+ pollfd->revents = 0;
+
+ lws_pt_lock(pt, __func__);
+ __lws_hrtimer_service(pt);
+ lws_pt_unlock(pt);
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd)
+{
+ return lws_service_fd_tsi(context, pollfd, 0);
+}
+
+LWS_VISIBLE int
+lws_service(struct lws_context *context, int timeout_ms)
+{
+ struct lws_context_per_thread *pt = &context->pt[0];
+ int n;
+
+ if (!context)
+ return 1;
+
+ pt->inside_service = 1;
+
+ if (context->event_loop_ops->run_pt) {
+ /* we are configured for an event loop */
+ context->event_loop_ops->run_pt(context, 0);
+
+ pt->inside_service = 0;
+
+ return 1;
+ }
+ n = lws_plat_service(context, timeout_ms);
+
+ pt->inside_service = 0;
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[tsi];
+ int n;
+
+ pt->inside_service = 1;
+
+ if (context->event_loop_ops->run_pt) {
+ /* we are configured for an event loop */
+ context->event_loop_ops->run_pt(context, tsi);
+
+ pt->inside_service = 0;
+
+ return 1;
+ }
+
+ n = _lws_plat_service_tsi(context, timeout_ms, tsi);
+
+ pt->inside_service = 0;
+
+ return n;
+}
diff --git a/thirdparty/libwebsockets/event-libs/poll/poll.c b/thirdparty/libwebsockets/event-libs/poll/poll.c
new file mode 100644
index 0000000000..09af5b15d8
--- /dev/null
+++ b/thirdparty/libwebsockets/event-libs/poll/poll.c
@@ -0,0 +1,43 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h if LWS_ROLE_WS
+ */
+
+#include <core/private.h>
+
+struct lws_event_loop_ops event_loop_ops_poll = {
+ /* name */ "poll",
+ /* init_context */ NULL,
+ /* destroy_context1 */ NULL,
+ /* destroy_context2 */ NULL,
+ /* init_vhost_listen_wsi */ NULL,
+ /* init_pt */ NULL,
+ /* wsi_logical_close */ NULL,
+ /* check_client_connect_ok */ NULL,
+ /* close_handle_manually */ NULL,
+ /* accept */ NULL,
+ /* io */ NULL,
+ /* run */ NULL,
+ /* destroy_pt */ NULL,
+ /* destroy wsi */ NULL,
+
+ /* periodic_events_available */ 1,
+}; \ No newline at end of file
diff --git a/thirdparty/libwebsockets/event-libs/poll/private.h b/thirdparty/libwebsockets/event-libs/poll/private.h
new file mode 100644
index 0000000000..ca313ebfb0
--- /dev/null
+++ b/thirdparty/libwebsockets/event-libs/poll/private.h
@@ -0,0 +1,23 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ */
+
+extern struct lws_event_loop_ops event_loop_ops_poll;
diff --git a/thirdparty/libwebsockets/event-libs/private.h b/thirdparty/libwebsockets/event-libs/private.h
new file mode 100644
index 0000000000..c36d39c8c2
--- /dev/null
+++ b/thirdparty/libwebsockets/event-libs/private.h
@@ -0,0 +1,74 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h
+ */
+
+struct lws_event_loop_ops {
+ const char *name;
+ /* event loop-specific context init during context creation */
+ int (*init_context)(struct lws_context *context,
+ const struct lws_context_creation_info *info);
+ /* called during lws_destroy_context */
+ int (*destroy_context1)(struct lws_context *context);
+ /* called during lws_destroy_context2 */
+ int (*destroy_context2)(struct lws_context *context);
+ /* init vhost listening wsi */
+ int (*init_vhost_listen_wsi)(struct lws *wsi);
+ /* init the event loop for a pt */
+ int (*init_pt)(struct lws_context *context, void *_loop, int tsi);
+ /* called at end of first phase of close_free_wsi() */
+ int (*wsi_logical_close)(struct lws *wsi);
+ /* return nonzero if client connect not allowed */
+ int (*check_client_connect_ok)(struct lws *wsi);
+ /* close handle manually */
+ void (*close_handle_manually)(struct lws *wsi);
+ /* event loop accept processing */
+ void (*accept)(struct lws *wsi);
+ /* control wsi active events */
+ void (*io)(struct lws *wsi, int flags);
+ /* run the event loop for a pt */
+ void (*run_pt)(struct lws_context *context, int tsi);
+ /* called before pt is destroyed */
+ void (*destroy_pt)(struct lws_context *context, int tsi);
+ /* called just before wsi is freed */
+ void (*destroy_wsi)(struct lws *wsi);
+
+ unsigned int periodic_events_available:1;
+};
+
+/* bring in event libs private declarations */
+
+#if defined(LWS_WITH_POLL)
+#include "event-libs/poll/private.h"
+#endif
+
+#if defined(LWS_WITH_LIBUV)
+#include "event-libs/libuv/private.h"
+#endif
+
+#if defined(LWS_WITH_LIBEVENT)
+#include "event-libs/libevent/private.h"
+#endif
+
+#if defined(LWS_WITH_LIBEV)
+#include "event-libs/libev/private.h"
+#endif
+
diff --git a/thirdparty/lws/libwebsockets.h b/thirdparty/libwebsockets/libwebsockets.h
index ef996c5d78..7ae563d582 100644
--- a/thirdparty/lws/libwebsockets.h
+++ b/thirdparty/libwebsockets/libwebsockets.h
@@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2016 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -27,25 +27,21 @@
#ifdef __cplusplus
#include <cstddef>
#include <cstdarg>
-#
+
extern "C" {
#else
#include <stdarg.h>
#endif
+#include <string.h>
+#include <stdlib.h>
+
#include "lws_config.h"
/*
* CARE: everything using cmake defines needs to be below here
*/
-#if defined(LWS_WITH_ESP8266)
-struct sockaddr_in;
-#define LWS_POSIX 0
-#else
-#define LWS_POSIX 1
-#endif
-
#if defined(LWS_HAS_INTPTR_T)
#include <stdint.h>
#define lws_intptr_t intptr_t
@@ -62,6 +58,7 @@ typedef unsigned long long lws_intptr_t;
#include <ws2tcpip.h>
#include <stddef.h>
#include <basetsd.h>
+#include <io.h>
#ifndef _WIN32_WCE
#include <fcntl.h>
#else
@@ -99,25 +96,18 @@ typedef unsigned long long lws_intptr_t;
#define LWS_O_CREAT _O_CREAT
#define LWS_O_TRUNC _O_TRUNC
-#if !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER < 1900) /* Visual Studio 2015 already defines this in <stdio.h> */
-#define lws_snprintf _snprintf
-#endif
-
#ifndef __func__
#define __func__ __FUNCTION__
#endif
-#if !defined(__MINGW32__) &&(!defined(_MSC_VER) || _MSC_VER < 1900) && !defined(snprintf)
-#define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
-#endif
-
#else /* NOT WIN32 */
#include <unistd.h>
#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
#include <sys/capability.h>
#endif
-#if defined(__NetBSD__) || defined(__FreeBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__QNX__) || defined(__OpenBSD__)
+#include <sys/socket.h>
#include <netinet/in.h>
#endif
@@ -127,7 +117,7 @@ typedef unsigned long long lws_intptr_t;
#define LWS_O_CREAT O_CREAT
#define LWS_O_TRUNC O_TRUNC
-#if !defined(LWS_WITH_ESP8266) && !defined(OPTEE_TA) && !defined(LWS_WITH_ESP32)
+#if !defined(LWS_PLAT_OPTEE) && !defined(OPTEE_TA) && !defined(LWS_WITH_ESP32)
#include <poll.h>
#include <netdb.h>
#define LWS_INVALID_FILE -1
@@ -166,7 +156,7 @@ typedef unsigned long long lws_intptr_t;
#endif
-#ifdef LWS_WITH_LIBEV
+#if defined(LWS_WITH_LIBEV)
#include <ev.h>
#endif /* LWS_WITH_LIBEV */
#ifdef LWS_WITH_LIBUV
@@ -175,7 +165,7 @@ typedef unsigned long long lws_intptr_t;
#include <uv-version.h>
#endif
#endif /* LWS_WITH_LIBUV */
-#ifdef LWS_WITH_LIBEVENT
+#if defined(LWS_WITH_LIBEVENT)
#include <event2/event.h>
#endif /* LWS_WITH_LIBEVENT */
@@ -192,13 +182,34 @@ typedef unsigned long long lws_intptr_t;
#endif
#endif
-#ifdef LWS_OPENSSL_SUPPORT
+#if defined(LWS_WITH_TLS)
#ifdef USE_WOLFSSL
#ifdef USE_OLD_CYASSL
+#ifdef _WIN32
+/*
+ * Include user-controlled settings for windows from
+ * <wolfssl-root>/IDE/WIN/user_settings.h
+ */
+#include <IDE/WIN/user_settings.h>
+#include <cyassl/ctaocrypt/settings.h>
+#else
+#include <cyassl/options.h>
+#endif
#include <cyassl/openssl/ssl.h>
#include <cyassl/error-ssl.h>
+
#else
+#ifdef _WIN32
+/*
+ * Include user-controlled settings for windows from
+ * <wolfssl-root>/IDE/WIN/user_settings.h
+ */
+#include <IDE/WIN/user_settings.h>
+#include <wolfssl/wolfcrypt/settings.h>
+#else
+#include <wolfssl/options.h>
+#endif
#include <wolfssl/openssl/ssl.h>
#include <wolfssl/error-ssl.h>
#endif /* not USE_OLD_CYASSL */
@@ -210,14 +221,60 @@ typedef unsigned long long lws_intptr_t;
#define MBEDTLS_CONFIG_FILE <mbedtls/esp_config.h>
#endif
#include <mbedtls/ssl.h>
-#endif
+#else
#include <openssl/ssl.h>
#if !defined(LWS_WITH_MBEDTLS)
#include <openssl/err.h>
#endif
+#endif
#endif /* not USE_WOLFSSL */
#endif
+/*
+ * Helpers for pthread mutex in user code... if lws is built for
+ * multiple service threads, these resolve to pthread mutex
+ * operations. In the case LWS_MAX_SMP is 1 (the default), they
+ * are all NOPs and no pthread type or api is referenced.
+ */
+
+#if LWS_MAX_SMP > 1
+
+#include <pthread.h>
+
+#define lws_pthread_mutex(name) pthread_mutex_t name;
+
+static LWS_INLINE void
+lws_pthread_mutex_init(pthread_mutex_t *lock)
+{
+ pthread_mutex_init(lock, NULL);
+}
+
+static LWS_INLINE void
+lws_pthread_mutex_destroy(pthread_mutex_t *lock)
+{
+ pthread_mutex_destroy(lock);
+}
+
+static LWS_INLINE void
+lws_pthread_mutex_lock(pthread_mutex_t *lock)
+{
+ pthread_mutex_lock(lock);
+}
+
+static LWS_INLINE void
+lws_pthread_mutex_unlock(pthread_mutex_t *lock)
+{
+ pthread_mutex_unlock(lock);
+}
+
+#else
+#define lws_pthread_mutex(name)
+#define lws_pthread_mutex_init(_a)
+#define lws_pthread_mutex_destroy(_a)
+#define lws_pthread_mutex_lock(_a)
+#define lws_pthread_mutex_unlock(_a)
+#endif
+
#define CONTEXT_PORT_NO_LISTEN -1
#define CONTEXT_PORT_NO_LISTEN_SERVER -2
@@ -280,10 +337,6 @@ lwsl_timestamp(int level, char *p, int len);
* active
*/
-#if defined(LWS_WITH_ESP8266)
-#undef _DEBUG
-#endif
-
#ifdef _DEBUG
#if defined(LWS_WITH_NO_LOGS)
/* notice, warn and log are always compiled in */
@@ -313,14 +366,20 @@ lwsl_timestamp(int level, char *p, int len);
#endif
+#define lwsl_hexdump_err(...) lwsl_hexdump_level(LLL_ERR, __VA_ARGS__)
+#define lwsl_hexdump_warn(...) lwsl_hexdump_level(LLL_WARN, __VA_ARGS__)
+#define lwsl_hexdump_notice(...) lwsl_hexdump_level(LLL_NOTICE, __VA_ARGS__)
+#define lwsl_hexdump_info(...) lwsl_hexdump_level(LLL_INFO, __VA_ARGS__)
+#define lwsl_hexdump_debug(...) lwsl_hexdump_level(LLL_DEBUG, __VA_ARGS__)
+
/**
- * lwsl_hexdump() - helper to hexdump a buffer
+ * lwsl_hexdump_level() - helper to hexdump a buffer at a selected debug level
*
* \param level: one of LLL_ constants
- * \param buf: buffer start to dump
+ * \param vbuf: buffer start to dump
* \param len: length of buffer to dump
*
- * If \p level is visible, does a nice hexdump -C style dump of \p buf for
+ * If \p level is visible, does a nice hexdump -C style dump of \p vbuf for
* \p len bytes. This can be extremely convenient while debugging.
*/
LWS_VISIBLE LWS_EXTERN void
@@ -396,12 +455,13 @@ lwsl_visible(int level);
#define lws_container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
#endif
-
struct lws;
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
+typedef int64_t lws_usec_t;
+
/* api change list for user code to test against */
#define LWS_FEATURE_SERVE_HTTP_FILE_HAS_OTHER_HEADERS_ARG
@@ -422,7 +482,7 @@ struct lws;
#if defined(_WIN32)
typedef SOCKET lws_sockfd_type;
typedef HANDLE lws_filefd_type;
-#define lws_sockfd_valid(sfd) (!!sfd)
+
struct lws_pollfd {
lws_sockfd_type fd; /**< file descriptor */
SHORT events; /**< which events to respond to */
@@ -434,77 +494,11 @@ struct lws_pollfd {
#else
-#if defined(LWS_WITH_ESP8266)
-
-#include <user_interface.h>
-#include <espconn.h>
-
-typedef struct espconn * lws_sockfd_type;
-typedef void * lws_filefd_type;
-#define lws_sockfd_valid(sfd) (!!sfd)
-struct pollfd {
- lws_sockfd_type fd; /**< fd related to */
- short events; /**< which POLL... events to respond to */
- short revents; /**< which POLL... events occurred */
-};
-#define POLLIN 0x0001
-#define POLLPRI 0x0002
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-#define POLLHUP 0x0010
-#define POLLNVAL 0x0020
-
-struct lws_vhost;
-
-lws_sockfd_type esp8266_create_tcp_listen_socket(struct lws_vhost *vh);
-void esp8266_tcp_stream_accept(lws_sockfd_type fd, struct lws *wsi);
-
-#include <os_type.h>
-#include <osapi.h>
-#include "ets_sys.h"
-
-int ets_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
-#define snprintf ets_snprintf
-
-typedef os_timer_t uv_timer_t;
-typedef void uv_cb_t(uv_timer_t *);
-
-void os_timer_disarm(void *);
-void os_timer_setfn(os_timer_t *, os_timer_func_t *, void *);
-
-void ets_timer_arm_new(os_timer_t *, int, int, int);
-
-//void os_timer_arm(os_timer_t *, int, int);
-
-#define UV_VERSION_MAJOR 1
-
-#define lws_uv_getloop(a, b) (NULL)
-
-static inline void uv_timer_init(void *l, uv_timer_t *t)
-{
- (void)l;
- memset(t, 0, sizeof(*t));
- os_timer_disarm(t);
-}
-
-static inline void uv_timer_start(uv_timer_t *t, uv_cb_t *cb, int first, int rep)
-{
- os_timer_setfn(t, (os_timer_func_t *)cb, t);
- /* ms, repeat */
- os_timer_arm(t, first, !!rep);
-}
-
-static inline void uv_timer_stop(uv_timer_t *t)
-{
- os_timer_disarm(t);
-}
-
-#else
#if defined(LWS_WITH_ESP32)
typedef int lws_sockfd_type;
typedef int lws_filefd_type;
-#define lws_sockfd_valid(sfd) (sfd >= 0)
+
struct pollfd {
lws_sockfd_type fd; /**< fd related to */
short events; /**< which POLL... events to respond to */
@@ -638,13 +632,14 @@ struct lws_esp32 {
char model[16];
char group[16];
char role[16];
- char ssid[4][16];
- char password[4][32];
- char active_ssid[32];
+ char ssid[4][64];
+ char password[4][64];
+ char active_ssid[64];
char access_pw[16];
char hostname[32];
char mac[20];
- mdns_server_t *mdns;
+ char le_dns[64];
+ char le_email[64];
char region;
char inet;
char conn_ap;
@@ -656,6 +651,11 @@ struct lws_esp32 {
void *scan_consumer_arg;
struct lws_group_member *first;
int extant_group_members;
+
+ char acme;
+ char upload;
+
+ volatile char button_is_down;
};
struct lws_esp32_image {
@@ -702,8 +702,6 @@ extern void lws_esp32_leds_timer_cb(TimerHandle_t th);
#else
typedef int lws_sockfd_type;
typedef int lws_filefd_type;
-#define lws_sockfd_valid(sfd) (sfd >= 0)
-#endif
#endif
#define lws_pollfd pollfd
@@ -830,6 +828,8 @@ enum lws_close_status {
connection was closed due to a failure to perform a TLS handshake
(e.g., the server certificate can't be verified). */
+ LWS_CLOSE_STATUS_CLIENT_TRANSACTION_DONE = 2000,
+
/****** add new things just above ---^ ******/
LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY = 9999,
@@ -858,37 +858,6 @@ struct lws_context;
/* needed even with extensions disabled for create context */
struct lws_extension;
-/*! \defgroup lwsmeta lws-meta
- *
- * ##lws-meta protocol
- *
- * The protocol wraps other muxed connections inside one tcp connection.
- *
- * Commands are assigned from 0x41 up (so they are valid unicode)
- */
-///@{
-
-enum lws_meta_commands {
- LWS_META_CMD_OPEN_SUBCHANNEL = 'A',
- /**< Client requests to open new subchannel
- */
- LWS_META_CMD_OPEN_RESULT,
- /**< Result of client request to open new subchannel */
- LWS_META_CMD_CLOSE_NOTIFY,
- /**< Notification of subchannel closure */
- LWS_META_CMD_CLOSE_RQ,
- /**< client requests to close a subchannel */
- LWS_META_CMD_WRITE,
- /**< connection writes something to specific channel index */
-
- /****** add new things just above ---^ ******/
-};
-
-/* channel numbers are transported offset by 0x20 so they are valid unicode */
-
-#define LWS_META_TRANSPORT_OFFSET 0x20
-
-///@}
/*! \defgroup usercb User Callback
*
@@ -908,16 +877,388 @@ struct lws_ssl_info {
int ret;
};
+enum lws_cert_update_state {
+ LWS_CUS_IDLE,
+ LWS_CUS_STARTING,
+ LWS_CUS_SUCCESS,
+ LWS_CUS_FAILED,
+
+ LWS_CUS_CREATE_KEYS,
+ LWS_CUS_REG,
+ LWS_CUS_AUTH,
+ LWS_CUS_CHALLENGE,
+ LWS_CUS_CREATE_REQ,
+ LWS_CUS_REQ,
+ LWS_CUS_CONFIRM,
+ LWS_CUS_ISSUE,
+};
+
+enum {
+ LWS_TLS_REQ_ELEMENT_COUNTRY,
+ LWS_TLS_REQ_ELEMENT_STATE,
+ LWS_TLS_REQ_ELEMENT_LOCALITY,
+ LWS_TLS_REQ_ELEMENT_ORGANIZATION,
+ LWS_TLS_REQ_ELEMENT_COMMON_NAME,
+ LWS_TLS_REQ_ELEMENT_EMAIL,
+
+ LWS_TLS_REQ_ELEMENT_COUNT,
+
+ LWS_TLS_SET_DIR_URL = LWS_TLS_REQ_ELEMENT_COUNT,
+ LWS_TLS_SET_AUTH_PATH,
+ LWS_TLS_SET_CERT_PATH,
+ LWS_TLS_SET_KEY_PATH,
+
+ LWS_TLS_TOTAL_COUNT
+};
+
+struct lws_acme_cert_aging_args {
+ struct lws_vhost *vh;
+ const char *element_overrides[LWS_TLS_TOTAL_COUNT]; /* NULL = use pvo */
+};
+
/*
* NOTE: These public enums are part of the abi. If you want to add one,
* add it at where specified so existing users are unaffected.
*/
/** enum lws_callback_reasons - reason you're getting a protocol callback */
enum lws_callback_reasons {
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to wsi and protocol binding lifecycle -----
+ */
+
+ LWS_CALLBACK_PROTOCOL_INIT = 27,
+ /**< One-time call per protocol, per-vhost using it, so it can
+ * do initial setup / allocations etc */
+
+ LWS_CALLBACK_PROTOCOL_DESTROY = 28,
+ /**< One-time call per protocol, per-vhost using it, indicating
+ * this protocol won't get used at all after this callback, the
+ * vhost is getting destroyed. Take the opportunity to
+ * deallocate everything that was allocated by the protocol. */
+
+ LWS_CALLBACK_WSI_CREATE = 29,
+ /**< outermost (earliest) wsi create notification to protocols[0] */
+
+ LWS_CALLBACK_WSI_DESTROY = 30,
+ /**< outermost (latest) wsi destroy notification to protocols[0] */
+
+ LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
+ /**< By default, all HTTP handling is done in protocols[0].
+ * However you can bind different protocols (by name) to
+ * different parts of the URL space using callback mounts. This
+ * callback occurs in the new protocol when a wsi is bound
+ * to that protocol. Any protocol allocation related to the
+ * http transaction processing should be created then.
+ * These specific callbacks are necessary because with HTTP/1.1,
+ * a single connection may perform at series of different
+ * transactions at different URLs, thus the lifetime of the
+ * protocol bind is just for one transaction, not connection. */
+
+ LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
+ /**< This is called when a transaction is unbound from a protocol.
+ * It indicates the connection completed its transaction and may
+ * do something different now. Any protocol allocation related
+ * to the http transaction processing should be destroyed. */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Server TLS -----
+ */
+
+ LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS = 21,
+ /**< if configured for
+ * including OpenSSL support, this callback allows your user code
+ * to perform extra SSL_CTX_load_verify_locations() or similar
+ * calls to direct OpenSSL where to find certificates the client
+ * can use to confirm the remote server identity. user is the
+ * OpenSSL SSL_CTX* */
+
+ LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS = 22,
+ /**< if configured for
+ * including OpenSSL support, this callback allows your user code
+ * to load extra certificates into the server which allow it to
+ * verify the validity of certificates returned by clients. user
+ * is the server's OpenSSL SSL_CTX* and in is the lws_vhost */
+
+ LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION = 23,
+ /**< if the libwebsockets vhost was created with the option
+ * LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT, then this
+ * callback is generated during OpenSSL verification of the cert
+ * sent from the client. It is sent to protocol[0] callback as
+ * no protocol has been negotiated on the connection yet.
+ * Notice that the libwebsockets context and wsi are both NULL
+ * during this callback. See
+ * http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
+ * to understand more detail about the OpenSSL callback that
+ * generates this libwebsockets callback and the meanings of the
+ * arguments passed. In this callback, user is the x509_ctx,
+ * in is the ssl pointer and len is preverify_ok
+ * Notice that this callback maintains libwebsocket return
+ * conventions, return 0 to mean the cert is OK or 1 to fail it.
+ * This also means that if you don't handle this callback then
+ * the default callback action of returning 0 allows the client
+ * certificates. */
+
+ LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY = 37,
+ /**< if configured for including OpenSSL support but no private key
+ * file has been specified (ssl_private_key_filepath is NULL), this is
+ * called to allow the user to set the private key directly via
+ * libopenssl and perform further operations if required; this might be
+ * useful in situations where the private key is not directly accessible
+ * by the OS, for example if it is stored on a smartcard.
+ * user is the server's OpenSSL SSL_CTX* */
+
+ LWS_CALLBACK_SSL_INFO = 67,
+ /**< SSL connections only. An event you registered an
+ * interest in at the vhost has occurred on a connection
+ * using the vhost. in is a pointer to a
+ * struct lws_ssl_info containing information about the
+ * event*/
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Client TLS -----
+ */
+
+ LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION = 58,
+ /**< Similar to LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION
+ * this callback is called during OpenSSL verification of the cert
+ * sent from the server to the client. It is sent to protocol[0]
+ * callback as no protocol has been negotiated on the connection yet.
+ * Notice that the wsi is set because lws_client_connect_via_info was
+ * successful.
+ *
+ * See http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
+ * to understand more detail about the OpenSSL callback that
+ * generates this libwebsockets callback and the meanings of the
+ * arguments passed. In this callback, user is the x509_ctx,
+ * in is the ssl pointer and len is preverify_ok.
+ *
+ * THIS IS NOT RECOMMENDED BUT if a cert validation error shall be
+ * overruled and cert shall be accepted as ok,
+ * X509_STORE_CTX_set_error((X509_STORE_CTX*)user, X509_V_OK); must be
+ * called and return value must be 0 to mean the cert is OK;
+ * returning 1 will fail the cert in any case.
+ *
+ * This also means that if you don't handle this callback then
+ * the default callback action of returning 0 will not accept the
+ * certificate in case of a validation error decided by the SSL lib.
+ *
+ * This is expected and secure behaviour when validating certificates.
+ *
+ * Note: LCCSCF_ALLOW_SELFSIGNED and
+ * LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK still work without this
+ * callback being implemented.
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to HTTP Server -----
+ */
+
+ LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED = 19,
+ /**< A new client has been accepted by the ws server. This
+ * callback allows setting any relevant property to it. Because this
+ * happens immediately after the instantiation of a new client,
+ * there's no websocket protocol selected yet so this callback is
+ * issued only to protocol 0. Only wsi is defined, pointing to the
+ * new client, and the return value is ignored. */
+
+ LWS_CALLBACK_HTTP = 12,
+ /**< an http request has come from a client that is not
+ * asking to upgrade the connection to a websocket
+ * one. This is a chance to serve http content,
+ * for example, to send a script to the client
+ * which will then open the websockets connection.
+ * in points to the URI path requested and
+ * lws_serve_http_file() makes it very
+ * simple to send back a file to the client.
+ * Normally after sending the file you are done
+ * with the http connection, since the rest of the
+ * activity will come by websockets from the script
+ * that was delivered by http, so you will want to
+ * return 1; to close and free up the connection. */
+
+ LWS_CALLBACK_HTTP_BODY = 13,
+ /**< the next len bytes data from the http
+ * request body HTTP connection is now available in in. */
+
+ LWS_CALLBACK_HTTP_BODY_COMPLETION = 14,
+ /**< the expected amount of http request body has been delivered */
+
+ LWS_CALLBACK_HTTP_FILE_COMPLETION = 15,
+ /**< a file requested to be sent down http link has completed. */
+
+ LWS_CALLBACK_HTTP_WRITEABLE = 16,
+ /**< you can write more down the http protocol link now. */
+
+ LWS_CALLBACK_CLOSED_HTTP = 5,
+ /**< when a HTTP (non-websocket) session ends */
+
+ LWS_CALLBACK_FILTER_HTTP_CONNECTION = 18,
+ /**< called when the request has
+ * been received and parsed from the client, but the response is
+ * not sent yet. Return non-zero to disallow the connection.
+ * user is a pointer to the connection user space allocation,
+ * in is the URI, eg, "/"
+ * In your handler you can use the public APIs
+ * lws_hdr_total_length() / lws_hdr_copy() to access all of the
+ * headers using the header enums lws_token_indexes from
+ * libwebsockets.h to check for and read the supported header
+ * presence and content before deciding to allow the http
+ * connection to proceed or to kill the connection. */
+
+ LWS_CALLBACK_ADD_HEADERS = 53,
+ /**< This gives your user code a chance to add headers to a server
+ * transaction bound to your protocol. `in` points to a
+ * `struct lws_process_html_args` describing a buffer and length
+ * you can add headers into using the normal lws apis.
+ *
+ * (see LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to add headers to
+ * a client transaction)
+ *
+ * Only `args->p` and `args->len` are valid, and `args->p` should
+ * be moved on by the amount of bytes written, if any. Eg
+ *
+ * case LWS_CALLBACK_ADD_HEADERS:
+ *
+ * struct lws_process_html_args *args =
+ * (struct lws_process_html_args *)in;
+ *
+ * if (lws_add_http_header_by_name(wsi,
+ * (unsigned char *)"set-cookie:",
+ * (unsigned char *)cookie, cookie_len,
+ * (unsigned char **)&args->p,
+ * (unsigned char *)args->p + args->max_len))
+ * return 1;
+ *
+ * break;
+ */
+
+ LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
+ /**< This gives the user code a chance to forbid an http access.
+ * `in` points to a `struct lws_process_html_args`, which
+ * describes the URL, and a bit mask describing the type of
+ * authentication required. If the callback returns nonzero,
+ * the transaction ends with HTTP_STATUS_UNAUTHORIZED. */
+
+ LWS_CALLBACK_PROCESS_HTML = 52,
+ /**< This gives your user code a chance to mangle outgoing
+ * HTML. `in` points to a `struct lws_process_html_args`
+ * which describes the buffer containing outgoing HTML.
+ * The buffer may grow up to `.max_len` (currently +128
+ * bytes per buffer).
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to HTTP Client -----
+ */
+
+ LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
+ /**< The HTTP client connection has succeeded, and is now
+ * connected to the server */
+
+ LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
+ /**< The HTTP client connection is closing */
+
+ LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
+ /**< This is generated by lws_http_client_read() used to drain
+ * incoming data. In the case the incoming data was chunked, it will
+ * be split into multiple smaller callbacks for each chunk block,
+ * removing the chunk headers. If not chunked, it will appear all in
+ * one callback. */
+
+ LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
+ /**< This simply indicates data was received on the HTTP client
+ * connection. It does NOT drain or provide the data.
+ * This exists to neatly allow a proxying type situation,
+ * where this incoming data will go out on another connection.
+ * If the outgoing connection stalls, we should stall processing
+ * the incoming data. So a handler for this in that case should
+ * simply set a flag to indicate there is incoming data ready
+ * and ask for a writeable callback on the outgoing connection.
+ * In the writable callback he can check the flag and then get
+ * and drain the waiting incoming data using lws_http_client_read().
+ * This will use callbacks to LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ
+ * to get and drain the incoming data, where it should be sent
+ * back out on the outgoing connection. */
+ LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
+ /**< The client transaction completed... at the moment this
+ * is the same as closing since transaction pipelining on
+ * client side is not yet supported. */
+
+ LWS_CALLBACK_CLIENT_HTTP_WRITEABLE = 57,
+ /**< when doing an HTTP type client connection, you can call
+ * lws_client_http_body_pending(wsi, 1) from
+ * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to get these callbacks
+ * sending the HTTP headers.
+ *
+ * From this callback, when you have sent everything, you should let
+ * lws know by calling lws_client_http_body_pending(wsi, 0)
+ */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Websocket Server -----
+ */
+
LWS_CALLBACK_ESTABLISHED = 0,
/**< (VH) after the server completes a handshake with an incoming
* client. If you built the library with ssl support, in is a
- * pointer to the ssl struct associated with the connection or NULL.*/
+ * pointer to the ssl struct associated with the connection or NULL.
+ *
+ * b0 of len is set if the connection was made using ws-over-h2
+ */
+
+ LWS_CALLBACK_CLOSED = 4,
+ /**< when the websocket session ends */
+
+ LWS_CALLBACK_SERVER_WRITEABLE = 11,
+ /**< See LWS_CALLBACK_CLIENT_WRITEABLE */
+
+ LWS_CALLBACK_RECEIVE = 6,
+ /**< data has appeared for this server endpoint from a
+ * remote client, it can be found at *in and is
+ * len bytes long */
+
+ LWS_CALLBACK_RECEIVE_PONG = 7,
+ /**< servers receive PONG packets with this callback reason */
+
+ LWS_CALLBACK_WS_PEER_INITIATED_CLOSE = 38,
+ /**< The peer has sent an unsolicited Close WS packet. in and
+ * len are the optional close code (first 2 bytes, network
+ * order) and the optional additional information which is not
+ * defined in the standard, and may be a string or non human-readable
+ * data.
+ * If you return 0 lws will echo the close and then close the
+ * connection. If you return nonzero lws will just close the
+ * connection. */
+
+ LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION = 20,
+ /**< called when the handshake has
+ * been received and parsed from the client, but the response is
+ * not sent yet. Return non-zero to disallow the connection.
+ * user is a pointer to the connection user space allocation,
+ * in is the requested protocol name
+ * In your handler you can use the public APIs
+ * lws_hdr_total_length() / lws_hdr_copy() to access all of the
+ * headers using the header enums lws_token_indexes from
+ * libwebsockets.h to check for and read the supported header
+ * presence and content before deciding to allow the handshake
+ * to proceed or to kill the connection. */
+
+ LWS_CALLBACK_CONFIRM_EXTENSION_OKAY = 25,
+ /**< When the server handshake code
+ * sees that it does support a requested extension, before
+ * accepting the extension by additing to the list sent back to
+ * the client it gives this callback just to check that it's okay
+ * to use that extension. It calls back to the requested protocol
+ * and with in being the extension name, len is 0 and user is
+ * valid. Note though at this time the ESTABLISHED callback hasn't
+ * happened yet so if you initialize user content there, user
+ * content during this callback might not be useful for anything. */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Websocket Client -----
+ */
+
LWS_CALLBACK_CLIENT_CONNECTION_ERROR = 1,
/**< the request client connection has been unable to complete a
* handshake with the remote server. If in is non-NULL, you can
@@ -962,6 +1303,7 @@ enum lws_callback_reasons {
* "HS: SO_SNDBUF failed"
* "HS: Rejected at CLIENT_ESTABLISHED"
*/
+
LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH = 2,
/**< this is the last chance for the client user code to examine the
* http headers and decide to reject the connection. If the
@@ -969,131 +1311,14 @@ enum lws_callback_reasons {
* client (url, etc) it needs to copy it out at
* this point since it will be destroyed before
* the CLIENT_ESTABLISHED call */
+
LWS_CALLBACK_CLIENT_ESTABLISHED = 3,
- /**< after your client connection completed
- * a handshake with the remote server */
- LWS_CALLBACK_CLOSED = 4,
- /**< when the websocket session ends */
- LWS_CALLBACK_CLOSED_HTTP = 5,
- /**< when a HTTP (non-websocket) session ends */
- LWS_CALLBACK_RECEIVE = 6,
- /**< data has appeared for this server endpoint from a
- * remote client, it can be found at *in and is
- * len bytes long */
- LWS_CALLBACK_RECEIVE_PONG = 7,
- /**< servers receive PONG packets with this callback reason */
- LWS_CALLBACK_CLIENT_RECEIVE = 8,
- /**< data has appeared from the server for the client connection, it
- * can be found at *in and is len bytes long */
- LWS_CALLBACK_CLIENT_RECEIVE_PONG = 9,
- /**< clients receive PONG packets with this callback reason */
- LWS_CALLBACK_CLIENT_WRITEABLE = 10,
- /**< If you call lws_callback_on_writable() on a connection, you will
- * get one of these callbacks coming when the connection socket
- * is able to accept another write packet without blocking.
- * If it already was able to take another packet without blocking,
- * you'll get this callback at the next call to the service loop
- * function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE
- * and servers get LWS_CALLBACK_SERVER_WRITEABLE. */
- LWS_CALLBACK_SERVER_WRITEABLE = 11,
- /**< See LWS_CALLBACK_CLIENT_WRITEABLE */
- LWS_CALLBACK_HTTP = 12,
- /**< an http request has come from a client that is not
- * asking to upgrade the connection to a websocket
- * one. This is a chance to serve http content,
- * for example, to send a script to the client
- * which will then open the websockets connection.
- * in points to the URI path requested and
- * lws_serve_http_file() makes it very
- * simple to send back a file to the client.
- * Normally after sending the file you are done
- * with the http connection, since the rest of the
- * activity will come by websockets from the script
- * that was delivered by http, so you will want to
- * return 1; to close and free up the connection. */
- LWS_CALLBACK_HTTP_BODY = 13,
- /**< the next len bytes data from the http
- * request body HTTP connection is now available in in. */
- LWS_CALLBACK_HTTP_BODY_COMPLETION = 14,
- /**< the expected amount of http request body has been delivered */
- LWS_CALLBACK_HTTP_FILE_COMPLETION = 15,
- /**< a file requested to be sent down http link has completed. */
- LWS_CALLBACK_HTTP_WRITEABLE = 16,
- /**< you can write more down the http protocol link now. */
- LWS_CALLBACK_FILTER_NETWORK_CONNECTION = 17,
- /**< called when a client connects to
- * the server at network level; the connection is accepted but then
- * passed to this callback to decide whether to hang up immediately
- * or not, based on the client IP. in contains the connection
- * socket's descriptor. Since the client connection information is
- * not available yet, wsi still pointing to the main server socket.
- * Return non-zero to terminate the connection before sending or
- * receiving anything. Because this happens immediately after the
- * network connection from the client, there's no websocket protocol
- * selected yet so this callback is issued only to protocol 0. */
- LWS_CALLBACK_FILTER_HTTP_CONNECTION = 18,
- /**< called when the request has
- * been received and parsed from the client, but the response is
- * not sent yet. Return non-zero to disallow the connection.
- * user is a pointer to the connection user space allocation,
- * in is the URI, eg, "/"
- * In your handler you can use the public APIs
- * lws_hdr_total_length() / lws_hdr_copy() to access all of the
- * headers using the header enums lws_token_indexes from
- * libwebsockets.h to check for and read the supported header
- * presence and content before deciding to allow the http
- * connection to proceed or to kill the connection. */
- LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED = 19,
- /**< A new client just had
- * been connected, accepted, and instantiated into the pool. This
- * callback allows setting any relevant property to it. Because this
- * happens immediately after the instantiation of a new client,
- * there's no websocket protocol selected yet so this callback is
- * issued only to protocol 0. Only wsi is defined, pointing to the
- * new client, and the return value is ignored. */
- LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION = 20,
- /**< called when the handshake has
- * been received and parsed from the client, but the response is
- * not sent yet. Return non-zero to disallow the connection.
- * user is a pointer to the connection user space allocation,
- * in is the requested protocol name
- * In your handler you can use the public APIs
- * lws_hdr_total_length() / lws_hdr_copy() to access all of the
- * headers using the header enums lws_token_indexes from
- * libwebsockets.h to check for and read the supported header
- * presence and content before deciding to allow the handshake
- * to proceed or to kill the connection. */
- LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS = 21,
- /**< if configured for
- * including OpenSSL support, this callback allows your user code
- * to perform extra SSL_CTX_load_verify_locations() or similar
- * calls to direct OpenSSL where to find certificates the client
- * can use to confirm the remote server identity. user is the
- * OpenSSL SSL_CTX* */
- LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS = 22,
- /**< if configured for
- * including OpenSSL support, this callback allows your user code
- * to load extra certifcates into the server which allow it to
- * verify the validity of certificates returned by clients. user
- * is the server's OpenSSL SSL_CTX* */
- LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION = 23,
- /**< if the libwebsockets vhost was created with the option
- * LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT, then this
- * callback is generated during OpenSSL verification of the cert
- * sent from the client. It is sent to protocol[0] callback as
- * no protocol has been negotiated on the connection yet.
- * Notice that the libwebsockets context and wsi are both NULL
- * during this callback. See
- * http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
- * to understand more detail about the OpenSSL callback that
- * generates this libwebsockets callback and the meanings of the
- * arguments passed. In this callback, user is the x509_ctx,
- * in is the ssl pointer and len is preverify_ok
- * Notice that this callback maintains libwebsocket return
- * conventions, return 0 to mean the cert is OK or 1 to fail it.
- * This also means that if you don't handle this callback then
- * the default callback action of returning 0 allows the client
- * certificates. */
+ /**< after your client connection completed the websocket upgrade
+ * handshake with the remote server */
+
+ LWS_CALLBACK_CLIENT_CLOSED = 75,
+ /**< when a client websocket session ends */
+
LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER = 24,
/**< this callback happens
* when a client handshake is being compiled. user is NULL,
@@ -1117,19 +1342,30 @@ enum lws_callback_reasons {
* optional, if you don't handle it everything is fine.
*
* Notice the callback is coming to protocols[0] all the time,
- * because there is no specific protocol negotiated yet. */
- LWS_CALLBACK_CONFIRM_EXTENSION_OKAY = 25,
- /**< When the server handshake code
- * sees that it does support a requested extension, before
- * accepting the extension by additing to the list sent back to
- * the client it gives this callback just to check that it's okay
- * to use that extension. It calls back to the requested protocol
- * and with in being the extension name, len is 0 and user is
- * valid. Note though at this time the ESTABLISHED callback hasn't
- * happened yet so if you initialize user content there, user
- * content during this callback might not be useful for anything. */
+ * because there is no specific protocol negotiated yet.
+ *
+ * See LWS_CALLBACK_ADD_HEADERS for adding headers to server
+ * transactions.
+ */
+
+ LWS_CALLBACK_CLIENT_RECEIVE = 8,
+ /**< data has appeared from the server for the client connection, it
+ * can be found at *in and is len bytes long */
+
+ LWS_CALLBACK_CLIENT_RECEIVE_PONG = 9,
+ /**< clients receive PONG packets with this callback reason */
+
+ LWS_CALLBACK_CLIENT_WRITEABLE = 10,
+ /**< If you call lws_callback_on_writable() on a connection, you will
+ * get one of these callbacks coming when the connection socket
+ * is able to accept another write packet without blocking.
+ * If it already was able to take another packet without blocking,
+ * you'll get this callback at the next call to the service loop
+ * function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE
+ * and servers get LWS_CALLBACK_SERVER_WRITEABLE. */
+
LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED = 26,
- /**< When a client
+ /**< When a ws client
* connection is being prepared to start a handshake to a server,
* each supported extension is checked with protocols[0] callback
* with this reason, giving the user code a chance to suppress the
@@ -1137,18 +1373,32 @@ enum lws_callback_reasons {
* unhandled, by default 0 will be returned and the extension
* support included in the header to the server. Notice this
* callback comes to protocols[0]. */
- LWS_CALLBACK_PROTOCOL_INIT = 27,
- /**< One-time call per protocol, per-vhost using it, so it can
- * do initial setup / allocations etc */
- LWS_CALLBACK_PROTOCOL_DESTROY = 28,
- /**< One-time call per protocol, per-vhost using it, indicating
- * this protocol won't get used at all after this callback, the
- * vhost is getting destroyed. Take the opportunity to
- * deallocate everything that was allocated by the protocol. */
- LWS_CALLBACK_WSI_CREATE = 29,
- /**< outermost (earliest) wsi create notification to protocols[0] */
- LWS_CALLBACK_WSI_DESTROY = 30,
- /**< outermost (latest) wsi destroy notification to protocols[0] */
+
+ LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
+ /**< Gives client connections an opportunity to adjust negotiated
+ * extension defaults. `user` is the extension name that was
+ * negotiated (eg, "permessage-deflate"). `in` points to a
+ * buffer and `len` is the buffer size. The user callback can
+ * set the buffer to a string describing options the extension
+ * should parse. Or just ignore for defaults. */
+
+
+ LWS_CALLBACK_FILTER_NETWORK_CONNECTION = 17,
+ /**< called when a client connects to
+ * the server at network level; the connection is accepted but then
+ * passed to this callback to decide whether to hang up immediately
+ * or not, based on the client IP. in contains the connection
+ * socket's descriptor. Since the client connection information is
+ * not available yet, wsi still pointing to the main server socket.
+ * Return non-zero to terminate the connection before sending or
+ * receiving anything. Because this happens immediately after the
+ * network connection from the client, there's no websocket protocol
+ * selected yet so this callback is issued only to protocol 0. */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to external poll loop integration -----
+ */
+
LWS_CALLBACK_GET_THREAD_ID = 31,
/**< lws can accept callback when writable requests from other
* threads, if you implement this callback and return an opaque
@@ -1171,12 +1421,14 @@ enum lws_callback_reasons {
*
* If you are using the internal lws polling / event loop
* you can just ignore these callbacks. */
+
LWS_CALLBACK_DEL_POLL_FD = 33,
/**< This callback happens when a socket descriptor
* needs to be removed from an external polling array. in is
* again the struct lws_pollargs containing the fd member
* to be removed. If you are using the internal polling
* loop, you can just ignore it. */
+
LWS_CALLBACK_CHANGE_MODE_POLL_FD = 34,
/**< This callback happens when lws wants to modify the events for
* a connection.
@@ -1185,6 +1437,7 @@ enum lws_callback_reasons {
* the prev_events member.
* If you are using the internal polling loop, you can just ignore
* it. */
+
LWS_CALLBACK_LOCK_POLL = 35,
/**< These allow the external poll changes driven
* by lws to participate in an external thread locking
@@ -1197,135 +1450,46 @@ enum lws_callback_reasons {
* len == 1 allows external threads to be synchronized against
* wsi lifecycle changes if it acquires the same lock for the
* duration of wsi dereference from the other thread context. */
+
LWS_CALLBACK_UNLOCK_POLL = 36,
/**< See LWS_CALLBACK_LOCK_POLL, ignore if using lws internal poll */
- LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY = 37,
- /**< if configured for including OpenSSL support but no private key
- * file has been specified (ssl_private_key_filepath is NULL), this is
- * called to allow the user to set the private key directly via
- * libopenssl and perform further operations if required; this might be
- * useful in situations where the private key is not directly accessible
- * by the OS, for example if it is stored on a smartcard.
- * user is the server's OpenSSL SSL_CTX* */
- LWS_CALLBACK_WS_PEER_INITIATED_CLOSE = 38,
- /**< The peer has sent an unsolicited Close WS packet. in and
- * len are the optional close code (first 2 bytes, network
- * order) and the optional additional information which is not
- * defined in the standard, and may be a string or non-human- readable data.
- * If you return 0 lws will echo the close and then close the
- * connection. If you return nonzero lws will just close the
- * connection. */
-
- LWS_CALLBACK_WS_EXT_DEFAULTS = 39,
- /**< Gives client connections an opportunity to adjust negotiated
- * extension defaults. `user` is the extension name that was
- * negotiated (eg, "permessage-deflate"). `in` points to a
- * buffer and `len` is the buffer size. The user callback can
- * set the buffer to a string describing options the extension
- * should parse. Or just ignore for defaults. */
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to CGI serving -----
+ */
LWS_CALLBACK_CGI = 40,
/**< CGI: CGI IO events on stdin / out / err are sent here on
* protocols[0]. The provided `lws_callback_http_dummy()`
* handles this and the callback should be directed there if
* you use CGI. */
+
LWS_CALLBACK_CGI_TERMINATED = 41,
/**< CGI: The related CGI process ended, this is called before
* the wsi is closed. Used to, eg, terminate chunking.
* The provided `lws_callback_http_dummy()`
* handles this and the callback should be directed there if
* you use CGI. The child PID that terminated is in len. */
+
LWS_CALLBACK_CGI_STDIN_DATA = 42,
/**< CGI: Data is, to be sent to the CGI process stdin, eg from
* a POST body. The provided `lws_callback_http_dummy()`
* handles this and the callback should be directed there if
* you use CGI. */
+
LWS_CALLBACK_CGI_STDIN_COMPLETED = 43,
/**< CGI: no more stdin is coming. The provided
* `lws_callback_http_dummy()` handles this and the callback
* should be directed there if you use CGI. */
- LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP = 44,
- /**< The HTTP client connection has succeeded, and is now
- * connected to the server */
- LWS_CALLBACK_CLOSED_CLIENT_HTTP = 45,
- /**< The HTTP client connection is closing */
- LWS_CALLBACK_RECEIVE_CLIENT_HTTP = 46,
- /**< This simply indicates data was received on the HTTP client
- * connection. It does NOT drain or provide the data.
- * This exists to neatly allow a proxying type situation,
- * where this incoming data will go out on another connection.
- * If the outgoing connection stalls, we should stall processing
- * the incoming data. So a handler for this in that case should
- * simply set a flag to indicate there is incoming data ready
- * and ask for a writeable callback on the outgoing connection.
- * In the writable callback he can check the flag and then get
- * and drain the waiting incoming data using lws_http_client_read().
- * This will use callbacks to LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ
- * to get and drain the incoming data, where it should be sent
- * back out on the outgoing connection. */
- LWS_CALLBACK_COMPLETED_CLIENT_HTTP = 47,
- /**< The client transaction completed... at the moment this
- * is the same as closing since transaction pipelining on
- * client side is not yet supported. */
- LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ = 48,
- /**< This is generated by lws_http_client_read() used to drain
- * incoming data. In the case the incoming data was chunked,
- * it will be split into multiple smaller callbacks for each
- * chunk block, removing the chunk headers. If not chunked,
- * it will appear all in one callback. */
- LWS_CALLBACK_HTTP_BIND_PROTOCOL = 49,
- /**< By default, all HTTP handling is done in protocols[0].
- * However you can bind different protocols (by name) to
- * different parts of the URL space using callback mounts. This
- * callback occurs in the new protocol when a wsi is bound
- * to that protocol. Any protocol allocation related to the
- * http transaction processing should be created then.
- * These specific callbacks are necessary because with HTTP/1.1,
- * a single connection may perform at series of different
- * transactions at different URLs, thus the lifetime of the
- * protocol bind is just for one transaction, not connection. */
- LWS_CALLBACK_HTTP_DROP_PROTOCOL = 50,
- /**< This is called when a transaction is unbound from a protocol.
- * It indicates the connection completed its transaction and may
- * do something different now. Any protocol allocation related
- * to the http transaction processing should be destroyed. */
- LWS_CALLBACK_CHECK_ACCESS_RIGHTS = 51,
- /**< This gives the user code a chance to forbid an http access.
- * `in` points to a `struct lws_process_html_args`, which
- * describes the URL, and a bit mask describing the type of
- * authentication required. If the callback returns nonzero,
- * the transaction ends with HTTP_STATUS_UNAUTHORIZED. */
- LWS_CALLBACK_PROCESS_HTML = 52,
- /**< This gives your user code a chance to mangle outgoing
- * HTML. `in` points to a `struct lws_process_html_args`
- * which describes the buffer containing outgoing HTML.
- * The buffer may grow up to `.max_len` (currently +128
- * bytes per buffer).
- * */
- LWS_CALLBACK_ADD_HEADERS = 53,
- /**< This gives your user code a chance to add headers to a
- * transaction bound to your protocol. `in` points to a
- * `struct lws_process_html_args` describing a buffer and length
- * you can add headers into using the normal lws apis.
- *
- * Only `args->p` and `args->len` are valid, and `args->p` should
- * be moved on by the amount of bytes written, if any. Eg
- *
- * case LWS_CALLBACK_ADD_HEADERS:
- *
- * struct lws_process_html_args *args =
- * (struct lws_process_html_args *)in;
- *
- * if (lws_add_http_header_by_name(wsi,
- * (unsigned char *)"set-cookie:",
- * (unsigned char *)cookie, cookie_len,
- * (unsigned char **)&args->p,
- * (unsigned char *)args->p + args->max_len))
- * return 1;
- *
- * break;
+
+ LWS_CALLBACK_CGI_PROCESS_ATTACH = 70,
+ /**< CGI: Sent when the CGI process is spawned for the wsi. The
+ * len parameter is the PID of the child process */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to Generic Sessions -----
*/
+
LWS_CALLBACK_SESSION_INFO = 54,
/**< This is only generated by user code using generic sessions.
* It's used to get a `struct lws_session_info` filled in by
@@ -1335,85 +1499,103 @@ enum lws_callback_reasons {
LWS_CALLBACK_GS_EVENT = 55,
/**< Indicates an event happened to the Generic Sessions session.
* `in` contains a `struct lws_gs_event_args` describing the event. */
+
LWS_CALLBACK_HTTP_PMO = 56,
/**< per-mount options for this connection, called before
* the normal LWS_CALLBACK_HTTP when the mount has per-mount
* options.
*/
- LWS_CALLBACK_CLIENT_HTTP_WRITEABLE = 57,
- /**< when doing an HTTP type client connection, you can call
- * lws_client_http_body_pending(wsi, 1) from
- * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER to get these callbacks
- * sending the HTTP headers.
- *
- * From this callback, when you have sent everything, you should let
- * lws know by calling lws_client_http_body_pending(wsi, 0)
- */
- LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION = 58,
- /**< Similar to LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION
- * this callback is called during OpenSSL verification of the cert
- * sent from the server to the client. It is sent to protocol[0]
- * callback as no protocol has been negotiated on the connection yet.
- * Notice that the wsi is set because lws_client_connect_via_info was
- * successful.
- *
- * See http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
- * to understand more detail about the OpenSSL callback that
- * generates this libwebsockets callback and the meanings of the
- * arguments passed. In this callback, user is the x509_ctx,
- * in is the ssl pointer and len is preverify_ok.
- *
- * THIS IS NOT RECOMMENDED BUT if a cert validation error shall be
- * overruled and cert shall be accepted as ok,
- * X509_STORE_CTX_set_error((X509_STORE_CTX*)user, X509_V_OK); must be
- * called and return value must be 0 to mean the cert is OK;
- * returning 1 will fail the cert in any case.
- *
- * This also means that if you don't handle this callback then
- * the default callback action of returning 0 will not accept the
- * certificate in case of a validation error decided by the SSL lib.
- *
- * This is expected and secure behaviour when validating certificates.
- *
- * Note: LCCSCF_ALLOW_SELFSIGNED and
- * LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK still work without this
- * callback being implemented.
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to RAW sockets -----
*/
+
LWS_CALLBACK_RAW_RX = 59,
/**< RAW mode connection RX */
+
LWS_CALLBACK_RAW_CLOSE = 60,
/**< RAW mode connection is closing */
+
LWS_CALLBACK_RAW_WRITEABLE = 61,
/**< RAW mode connection may be written */
+
LWS_CALLBACK_RAW_ADOPT = 62,
/**< RAW mode connection was adopted (equivalent to 'wsi created') */
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to RAW file handles -----
+ */
+
LWS_CALLBACK_RAW_ADOPT_FILE = 63,
/**< RAW mode file was adopted (equivalent to 'wsi created') */
+
LWS_CALLBACK_RAW_RX_FILE = 64,
- /**< RAW mode file has something to read */
+ /**< This is the indication the RAW mode file has something to read.
+ * This doesn't actually do the read of the file and len is always
+ * 0... your code should do the read having been informed there is
+ * something to read now. */
+
LWS_CALLBACK_RAW_WRITEABLE_FILE = 65,
/**< RAW mode file is writeable */
+
LWS_CALLBACK_RAW_CLOSE_FILE = 66,
/**< RAW mode wsi that adopted a file is closing */
- LWS_CALLBACK_SSL_INFO = 67,
- /**< SSL connections only. An event you registered an
- * interest in at the vhost has occurred on a connection
- * using the vhost. in is a pointer to a
- * struct lws_ssl_info containing information about the
- * event*/
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to generic wsi events -----
+ */
+
+ LWS_CALLBACK_TIMER = 73,
+ /**< When the time elapsed after a call to
+ * lws_set_timer_usecs(wsi, usecs) is up, the wsi will get one of
+ * these callbacks. The deadline can be continuously extended into the
+ * future by later calls to lws_set_timer_usecs() before the deadline
+ * expires, or cancelled by lws_set_timer_usecs(wsi, -1);
+ * See the note on lws_set_timer_usecs() about which event loops are
+ * supported. */
+
+ LWS_CALLBACK_EVENT_WAIT_CANCELLED = 71,
+ /**< This is sent to every protocol of every vhost in response
+ * to lws_cancel_service() or lws_cancel_service_pt(). This
+ * callback is serialized in the lws event loop normally, even
+ * if the lws_cancel_service[_pt]() call was from a different
+ * thread. */
+
+ LWS_CALLBACK_CHILD_CLOSING = 69,
+ /**< Sent to parent to notify them a child is closing / being
+ * destroyed. in is the child wsi.
+ */
+
LWS_CALLBACK_CHILD_WRITE_VIA_PARENT = 68,
/**< Child has been marked with parent_carries_io attribute, so
* lws_write directs the to this callback at the parent,
* in is a struct lws_write_passthru containing the args
* the lws_write() was called with.
*/
- LWS_CALLBACK_CHILD_CLOSING = 69,
- /**< Sent to parent to notify them a child is closing / being
- * destroyed. in is the child wsi.
+
+ /* ---------------------------------------------------------------------
+ * ----- Callbacks related to TLS certificate management -----
*/
- LWS_CALLBACK_CGI_PROCESS_ATTACH = 70,
- /**< CGI: Sent when the CGI process is spawned for the wsi. The
- * len parameter is the PID of the child process */
+
+ LWS_CALLBACK_VHOST_CERT_AGING = 72,
+ /**< When a vhost TLS cert has its expiry checked, this callback
+ * is broadcast to every protocol of every vhost in case the
+ * protocol wants to take some action with this information.
+ * \p in is a pointer to a struct lws_acme_cert_aging_args,
+ * and \p len is the number of days left before it expires, as
+ * a (ssize_t). In the struct lws_acme_cert_aging_args, vh
+ * points to the vhost the cert aging information applies to,
+ * and element_overrides[] is an optional way to update information
+ * from the pvos... NULL in an index means use the information from
+ * from the pvo for the cert renewal, non-NULL in the array index
+ * means use that pointer instead for the index. */
+
+ LWS_CALLBACK_VHOST_CERT_UPDATE = 74,
+ /**< When a vhost TLS cert is being updated, progress is
+ * reported to the vhost in question here, including completion
+ * and failure. in points to optional JSON, and len represents the
+ * connection state using enum lws_cert_update_state */
+
/****** add new things just above ---^ ******/
@@ -1448,6 +1630,8 @@ lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
#define LWS_CB_REASON_AUX_BF__CGI_HEADERS 8
///@}
+struct lws_vhost;
+
/*! \defgroup generic hash
* ## Generic Hash related functions
*
@@ -1459,7 +1643,7 @@ lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
*/
///@{
-#ifdef LWS_OPENSSL_SUPPORT
+#if defined(LWS_WITH_TLS)
#if defined(LWS_WITH_MBEDTLS)
#include <mbedtls/sha1.h>
@@ -1467,9 +1651,20 @@ lws_callback_function(struct lws *wsi, enum lws_callback_reasons reason,
#include <mbedtls/sha512.h>
#endif
-#define LWS_GENHASH_TYPE_SHA1 0
-#define LWS_GENHASH_TYPE_SHA256 1
-#define LWS_GENHASH_TYPE_SHA512 2
+enum lws_genhash_types {
+ LWS_GENHASH_TYPE_SHA1,
+ LWS_GENHASH_TYPE_SHA256,
+ LWS_GENHASH_TYPE_SHA384,
+ LWS_GENHASH_TYPE_SHA512,
+};
+
+enum lws_genhmac_types {
+ LWS_GENHMAC_TYPE_SHA256,
+ LWS_GENHMAC_TYPE_SHA384,
+ LWS_GENHMAC_TYPE_SHA512,
+};
+
+#define LWS_GENHASH_LARGEST 64
struct lws_genhash_ctx {
uint8_t type;
@@ -1477,7 +1672,8 @@ struct lws_genhash_ctx {
union {
mbedtls_sha1_context sha1;
mbedtls_sha256_context sha256;
- mbedtls_sha512_context sha512;
+ mbedtls_sha512_context sha512; /* 384 also uses this */
+ const mbedtls_md_info_t *hmac;
} u;
#else
const EVP_MD *evp_type;
@@ -1485,6 +1681,17 @@ struct lws_genhash_ctx {
#endif
};
+struct lws_genhmac_ctx {
+ uint8_t type;
+#if defined(LWS_WITH_MBEDTLS)
+ const mbedtls_md_info_t *hmac;
+ mbedtls_md_context_t ctx;
+#else
+ const EVP_MD *evp_type;
+ EVP_MD_CTX *ctx;
+#endif
+};
+
/** lws_genhash_size() - get hash size in bytes
*
* \param type: one of LWS_GENHASH_TYPE_...
@@ -1492,7 +1699,16 @@ struct lws_genhash_ctx {
* Returns number of bytes in this type of hash
*/
LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT
-lws_genhash_size(int type);
+lws_genhash_size(enum lws_genhash_types type);
+
+/** lws_genhmac_size() - get hash size in bytes
+ *
+ * \param type: one of LWS_GENHASH_TYPE_...
+ *
+ * Returns number of bytes in this type of hmac
+ */
+LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT
+lws_genhmac_size(enum lws_genhmac_types type);
/** lws_genhash_init() - prepare your struct lws_genhash_ctx for use
*
@@ -1502,7 +1718,7 @@ lws_genhash_size(int type);
* Initializes the hash context for the type you requested
*/
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_genhash_init(struct lws_genhash_ctx *ctx, int type);
+lws_genhash_init(struct lws_genhash_ctx *ctx, enum lws_genhash_types type);
/** lws_genhash_update() - digest len bytes of the buffer starting at in
*
@@ -1529,10 +1745,386 @@ lws_genhash_update(struct lws_genhash_ctx *ctx, const void *in, size_t len);
LWS_VISIBLE LWS_EXTERN int
lws_genhash_destroy(struct lws_genhash_ctx *ctx, void *result);
+/** lws_genhmac_init() - prepare your struct lws_genhmac_ctx for use
+ *
+ * \param ctx: your struct lws_genhmac_ctx
+ * \param type: one of LWS_GENHMAC_TYPE_...
+ * \param key: pointer to the start of the HMAC key
+ * \param key_len: length of the HMAC key
+ *
+ * Initializes the hash context for the type you requested
+ *
+ * If the return is nonzero, it failed and there is nothing needing to be
+ * destroyed.
+ */
+int
+lws_genhmac_init(struct lws_genhmac_ctx *ctx, enum lws_genhmac_types type,
+ const uint8_t *key, size_t key_len);
+
+/** lws_genhmac_update() - digest len bytes of the buffer starting at in
+ *
+ * \param ctx: your struct lws_genhmac_ctx
+ * \param in: start of the bytes to digest
+ * \param len: count of bytes to digest
+ *
+ * Updates the state of your hash context to reflect digesting len bytes from in
+ *
+ * If the return is nonzero, it failed and needs destroying.
+ */
+int
+lws_genhmac_update(struct lws_genhmac_ctx *ctx, const void *in, size_t len);
+
+/** lws_genhmac_destroy() - copy out the result digest and destroy the ctx
+ *
+ * \param ctx: your struct lws_genhmac_ctx
+ * \param result: NULL, or where to copy the result hash
+ *
+ * Finalizes the hash and copies out the digest. Destroys any allocations such
+ * that ctx can safely go out of scope after calling this.
+ *
+ * NULL result is supported so that you can destroy the ctx cleanly on error
+ * conditions, where there is no valid result.
+ */
+int
+lws_genhmac_destroy(struct lws_genhmac_ctx *ctx, void *result);
+///@}
+
+/*! \defgroup generic RSA
+ * ## Generic RSA related functions
+ *
+ * Lws provides generic RSA functions that abstract the ones
+ * provided by whatever OpenSSL library you are linking against.
+ *
+ * It lets you use the same code if you build against mbedtls or OpenSSL
+ * for example.
+ */
+///@{
+
+enum enum_jwk_tok {
+ JWK_KEY_E,
+ JWK_KEY_N,
+ JWK_KEY_D,
+ JWK_KEY_P,
+ JWK_KEY_Q,
+ JWK_KEY_DP,
+ JWK_KEY_DQ,
+ JWK_KEY_QI,
+ JWK_KTY, /* also serves as count of real elements */
+ JWK_KEY,
+};
+
+#define LWS_COUNT_RSA_ELEMENTS JWK_KTY
+
+struct lws_genrsa_ctx {
+#if defined(LWS_WITH_MBEDTLS)
+ mbedtls_rsa_context *ctx;
+#else
+ BIGNUM *bn[LWS_COUNT_RSA_ELEMENTS];
+ RSA *rsa;
#endif
+};
+
+struct lws_genrsa_element {
+ uint8_t *buf;
+ uint16_t len;
+};
+struct lws_genrsa_elements {
+ struct lws_genrsa_element e[LWS_COUNT_RSA_ELEMENTS];
+};
+
+/** lws_jwk_destroy_genrsa_elements() - Free allocations in genrsa_elements
+ *
+ * \param el: your struct lws_genrsa_elements
+ *
+ * This is a helper for user code making use of struct lws_genrsa_elements
+ * where the elements are allocated on the heap, it frees any non-NULL
+ * buf element and sets the buf to NULL.
+ *
+ * NB: lws_genrsa_public_... apis do not need this as they take care of the key
+ * creation and destruction themselves.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_jwk_destroy_genrsa_elements(struct lws_genrsa_elements *el);
+
+/** lws_genrsa_public_decrypt_create() - Create RSA public decrypt context
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param el: struct prepared with key element data
+ *
+ * Creates an RSA context with a public key associated with it, formed from
+ * the key elements in \p el.
+ *
+ * Returns 0 for OK or nonzero for error.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_create(struct lws_genrsa_ctx *ctx, struct lws_genrsa_elements *el);
+
+/** lws_genrsa_new_keypair() - Create new RSA keypair
+ *
+ * \param context: your struct lws_context (may be used for RNG)
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param el: struct to get the new key element data allocated into it
+ * \param bits: key size, eg, 4096
+ *
+ * Creates a new RSA context and generates a new keypair into it, with \p bits
+ * bits.
+ *
+ * Returns 0 for OK or nonzero for error.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_new_keypair(struct lws_context *context, struct lws_genrsa_ctx *ctx,
+ struct lws_genrsa_elements *el, int bits);
+
+/** lws_genrsa_public_decrypt() - Perform RSA public decryption
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param in: encrypted input
+ * \param in_len: length of encrypted input
+ * \param out: decrypted output
+ * \param out_max: size of output buffer
+ *
+ * Performs the decryption.
+ *
+ * Returns <0 for error, or length of decrypted data.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_public_decrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ size_t in_len, uint8_t *out, size_t out_max);
+
+/** lws_genrsa_public_verify() - Perform RSA public verification
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param in: unencrypted payload (usually a recomputed hash)
+ * \param hash_type: one of LWS_GENHASH_TYPE_
+ * \param sig: pointer to the signature we received with the payload
+ * \param sig_len: length of the signature we are checking in bytes
+ *
+ * Returns <0 for error, or 0 if signature matches the payload + key.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_public_verify(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ enum lws_genhash_types hash_type,
+ const uint8_t *sig, size_t sig_len);
+
+/** lws_genrsa_public_sign() - Create RSA signature
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param in: precomputed hash
+ * \param hash_type: one of LWS_GENHASH_TYPE_
+ * \param sig: pointer to buffer to take signature
+ * \param sig_len: length of the buffer (must be >= length of key N)
+ *
+ * Returns <0 for error, or 0 for success.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_public_sign(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ enum lws_genhash_types hash_type, uint8_t *sig,
+ size_t sig_len);
+
+/** lws_genrsa_public_decrypt_destroy() - Destroy RSA public decrypt context
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ *
+ * Destroys any allocations related to \p ctx.
+ *
+ * This and related APIs operate identically with OpenSSL or mbedTLS backends.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_genrsa_destroy(struct lws_genrsa_ctx *ctx);
+
+/** lws_genrsa_render_pkey_asn1() - Exports public or private key to ASN1/DER
+ *
+ * \param ctx: your struct lws_genrsa_ctx
+ * \param _private: 0 = public part only, 1 = all parts of the key
+ * \param pkey_asn1: pointer to buffer to take the ASN1
+ * \param pkey_asn1_len: max size of the pkey_asn1_len
+ *
+ * Returns length of pkey_asn1 written, or -1 for error.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_genrsa_render_pkey_asn1(struct lws_genrsa_ctx *ctx, int _private,
+ uint8_t *pkey_asn1, size_t pkey_asn1_len);
+///@}
+
+/*! \defgroup jwk JSON Web Keys
+ * ## JSON Web Keys API
+ *
+ * Lws provides an API to parse JSON Web Keys into a struct lws_genrsa_elements.
+ *
+ * "oct" and "RSA" type keys are supported. For "oct" keys, they are held in
+ * the "e" member of the struct lws_genrsa_elements.
+ *
+ * Keys elements are allocated on the heap. You must destroy the allocations
+ * in the struct lws_genrsa_elements by calling
+ * lws_jwk_destroy_genrsa_elements() when you are finished with it.
+ */
+///@{
+
+struct lws_jwk {
+ char keytype[5]; /**< "oct" or "RSA" */
+ struct lws_genrsa_elements el; /**< OCTet key is in el.e */
+};
+
+/** lws_jwk_import() - Create a JSON Web key from the textual representation
+ *
+ * \param s: the JWK object to create
+ * \param in: a single JWK JSON stanza in utf-8
+ * \param len: the length of the JWK JSON stanza in bytes
+ *
+ * Creates an lws_jwk struct filled with data from the JSON representation.
+ * "oct" and "rsa" key types are supported.
+ *
+ * For "oct" type keys, it is loaded into el.e.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jwk_import(struct lws_jwk *s, const char *in, size_t len);
+
+/** lws_jwk_destroy() - Destroy a JSON Web key
+ *
+ * \param s: the JWK object to destroy
+ *
+ * All allocations in the lws_jwk are destroyed
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_jwk_destroy(struct lws_jwk *s);
+
+/** lws_jwk_export() - Export a JSON Web key to a textual representation
+ *
+ * \param s: the JWK object to export
+ * \param _private: 0 = just export public parts, 1 = export everything
+ * \param p: the buffer to write the exported JWK to
+ * \param len: the length of the buffer \p p in bytes
+ *
+ * Returns length of the used part of the buffer if OK, or -1 for error.
+ *
+ * Serializes the content of the JWK into a char buffer.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jwk_export(struct lws_jwk *s, int _private, char *p, size_t len);
+
+/** lws_jwk_load() - Import a JSON Web key from a file
+ *
+ * \param s: the JWK object to load into
+ * \param filename: filename to load from
+ *
+ * Returns 0 for OK or -1 for failure
+ */
+LWS_VISIBLE int
+lws_jwk_load(struct lws_jwk *s, const char *filename);
+
+/** lws_jwk_save() - Export a JSON Web key to a file
+ *
+ * \param s: the JWK object to save from
+ * \param filename: filename to save to
+ *
+ * Returns 0 for OK or -1 for failure
+ */
+LWS_VISIBLE int
+lws_jwk_save(struct lws_jwk *s, const char *filename);
+
+/** lws_jwk_rfc7638_fingerprint() - jwk to RFC7638 compliant fingerprint
+ *
+ * \param s: the JWK object to fingerprint
+ * \param digest32: buffer to take 32-byte digest
+ *
+ * Returns 0 for OK or -1 for failure
+ */
+LWS_VISIBLE int
+lws_jwk_rfc7638_fingerprint(struct lws_jwk *s, char *digest32);
///@}
+
+/*! \defgroup jws JSON Web Signature
+ * ## JSON Web Signature API
+ *
+ * Lws provides an API to check and create RFC7515 JSON Web Signatures
+ *
+ * SHA256/384/512 HMAC, and RSA 256/384/512 are supported.
+ *
+ * The API uses your TLS library crypto, but works exactly the same no matter
+ * what you TLS backend is.
+ */
+///@{
+
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_confirm_sig(const char *in, size_t len, struct lws_jwk *jwk);
+
+/**
+ * lws_jws_sign_from_b64() - add b64 sig to b64 hdr + payload
+ *
+ * \param b64_hdr: protected header encoded in b64, may be NULL
+ * \param hdr_len: bytes in b64 coding of protected header
+ * \param b64_pay: payload encoded in b64
+ * \param pay_len: bytes in b64 coding of payload
+ * \param b64_sig: buffer to write the b64 encoded signature into
+ * \param sig_len: max bytes we can write at b64_sig
+ * \param hash_type: one of LWS_GENHASH_TYPE_SHA[256|384|512]
+ * \param jwk: the struct lws_jwk containing the signing key
+ *
+ * This adds a b64-coded JWS signature of the b64-encoded protected header
+ * and b64-encoded payload, at \p b64_sig. The signature will be as large
+ * as the N element of the RSA key when the RSA key is used, eg, 512 bytes for
+ * a 4096-bit key, and then b64-encoding on top.
+ *
+ * In some special cases, there is only payload to sign and no header, in that
+ * case \p b64_hdr may be NULL, and only the payload will be hashed before
+ * signing.
+ *
+ * Returns the length of the encoded signature written to \p b64_sig, or -1.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_sign_from_b64(const char *b64_hdr, size_t hdr_len, const char *b64_pay,
+ size_t pay_len, char *b64_sig, size_t sig_len,
+ enum lws_genhash_types hash_type, struct lws_jwk *jwk);
+
+/**
+ * lws_jws_create_packet() - add b64 sig to b64 hdr + payload
+ *
+ * \param jwk: the struct lws_jwk containing the signing key
+ * \param payload: unencoded payload JSON
+ * \param len: length of unencoded payload JSON
+ * \param nonce: Nonse string to include in protected header
+ * \param out: buffer to take signed packet
+ * \param out_len: size of \p out buffer
+ *
+ * This creates a "flattened" JWS packet from the jwk and the plaintext
+ * payload, and signs it. The packet is written into \p out.
+ *
+ * This does the whole packet assembly and signing, calling through to
+ * lws_jws_sign_from_b64() as part of the process.
+ *
+ * Returns the length written to \p out, or -1.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_create_packet(struct lws_jwk *jwk, const char *payload, size_t len,
+ const char *nonce, char *out, size_t out_len);
+
+/**
+ * lws_jws_base64_enc() - encode input data into b64url data
+ *
+ * \param in: the incoming plaintext
+ * \param in_len: the length of the incoming plaintext in bytes
+ * \param out: the buffer to store the b64url encoded data to
+ * \param out_max: the length of \p out in bytes
+ *
+ * Returns either -1 if problems, or the number of bytes written to \p out.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_jws_base64_enc(const char *in, size_t in_len, char *out, size_t out_max);
+///@}
+#endif
+
/*! \defgroup extensions Extension related functions
* ##Extension releated functions
*
@@ -1548,27 +2140,10 @@ lws_genhash_destroy(struct lws_genhash_ctx *ctx, void *result);
* add it at where specified so existing users are unaffected.
*/
enum lws_extension_callback_reasons {
- LWS_EXT_CB_SERVER_CONTEXT_CONSTRUCT = 0,
- LWS_EXT_CB_CLIENT_CONTEXT_CONSTRUCT = 1,
- LWS_EXT_CB_SERVER_CONTEXT_DESTRUCT = 2,
- LWS_EXT_CB_CLIENT_CONTEXT_DESTRUCT = 3,
LWS_EXT_CB_CONSTRUCT = 4,
LWS_EXT_CB_CLIENT_CONSTRUCT = 5,
- LWS_EXT_CB_CHECK_OK_TO_REALLY_CLOSE = 6,
- LWS_EXT_CB_CHECK_OK_TO_PROPOSE_EXTENSION = 7,
LWS_EXT_CB_DESTROY = 8,
- LWS_EXT_CB_DESTROY_ANY_WSI_CLOSING = 9,
- LWS_EXT_CB_ANY_WSI_ESTABLISHED = 10,
- LWS_EXT_CB_PACKET_RX_PREPARSE = 11,
LWS_EXT_CB_PACKET_TX_PRESEND = 12,
- LWS_EXT_CB_PACKET_TX_DO_SEND = 13,
- LWS_EXT_CB_HANDSHAKE_REPLY_TX = 14,
- LWS_EXT_CB_FLUSH_PENDING_TX = 15,
- LWS_EXT_CB_EXTENDED_PAYLOAD_RX = 16,
- LWS_EXT_CB_CAN_PROXY_CLIENT_CONNECTION = 17,
- LWS_EXT_CB_1HZ = 18,
- LWS_EXT_CB_REQUEST_ON_WRITEABLE = 19,
- LWS_EXT_CB_IS_WRITEABLE = 20,
LWS_EXT_CB_PAYLOAD_TX = 21,
LWS_EXT_CB_PAYLOAD_RX = 22,
LWS_EXT_CB_OPTION_DEFAULT = 23,
@@ -1646,18 +2221,6 @@ struct lws_ext_option_arg {
* user data is deleted. This same callback is used whether you
* are in client or server instantiation context.
*
- * LWS_EXT_CB_PACKET_RX_PREPARSE: when this extension was active on
- * a connection, and a packet of data arrived at the connection,
- * it is passed to this callback to give the extension a chance to
- * change the data, eg, decompress it. user is pointing to the
- * extension's private connection context data, in is pointing
- * to an lws_tokens struct, it consists of a char * pointer called
- * token, and an int called token_len. At entry, these are
- * set to point to the received buffer and set to the content
- * length. If the extension will grow the content, it should use
- * a new buffer allocated in its private user context data and
- * set the pointed-to lws_tokens members to point to its buffer.
- *
* LWS_EXT_CB_PACKET_TX_PRESEND: this works the same way as
* LWS_EXT_CB_PACKET_RX_PREPARSE above, except it gives the
* extension a chance to change websocket data just before it will
@@ -1697,16 +2260,6 @@ LWS_VISIBLE LWS_EXTERN int
lws_set_extension_option(struct lws *wsi, const char *ext_name,
const char *opt_name, const char *opt_val);
-#ifndef LWS_NO_EXTENSIONS
-/* lws_get_internal_extensions() - DEPRECATED
- *
- * \Deprecated There is no longer a set internal extensions table. The table is provided
- * by user code along with application-specific settings. See the test
- * client and server for how to do.
- */
-static LWS_INLINE LWS_WARN_DEPRECATED const struct lws_extension *
-lws_get_internal_extensions(void) { return NULL; }
-
/**
* lws_ext_parse_options() - deal with parsing negotiated extension options
*
@@ -1721,7 +2274,6 @@ LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
void *ext_user, const struct lws_ext_options *opts,
const char *o, int len);
-#endif
/** lws_extension_callback_pm_deflate() - extension for RFC7692
*
@@ -1785,8 +2337,8 @@ struct lws_protocols {
* be able to consume it all without having to return to the event
* loop. That is supported in lws.
*
- * If .tx_packet_size is 0, this also controls how much may be sent at once
- * for backwards compatibility.
+ * If .tx_packet_size is 0, this also controls how much may be sent at
+ * once for backwards compatibility.
*/
unsigned int id;
/**< ignored by lws, but useful to contain user information bound
@@ -1811,8 +2363,6 @@ struct lws_protocols {
* This is part of the ABI, don't needlessly break compatibility */
};
-struct lws_vhost;
-
/**
* lws_vhost_name_to_protocol() - get vhost's protocol object from its name
*
@@ -1894,6 +2444,17 @@ lws_adjust_protocol_psds(struct lws *wsi, size_t new_size);
LWS_VISIBLE LWS_EXTERN int
lws_finalize_startup(struct lws_context *context);
+/**
+ * lws_pvo_search() - helper to find a named pvo in a linked-list
+ *
+ * \param pvo: the first pvo in the linked-list
+ * \param name: the name of the pvo to return if found
+ *
+ * Returns NULL, or a pointer to the name pvo in the linked-list
+ */
+LWS_VISIBLE LWS_EXTERN const struct lws_protocol_vhost_options *
+lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name);
+
LWS_VISIBLE LWS_EXTERN int
lws_protocol_init(struct lws_context *context);
@@ -2088,6 +2649,17 @@ enum lws_context_options {
* LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS callback, which
* provides the vhost SSL_CTX * in the user parameter.
*/
+ LWS_SERVER_OPTION_SKIP_PROTOCOL_INIT = (1 << 25),
+ /**< (VH) You probably don't want this. It forces this vhost to not
+ * call LWS_CALLBACK_PROTOCOL_INIT on its protocols. It's used in the
+ * special case of a temporary vhost bound to a single protocol.
+ */
+ LWS_SERVER_OPTION_IGNORE_MISSING_CERT = (1 << 26),
+ /**< (VH) Don't fail if the vhost TLS cert or key are missing, just
+ * continue. The vhost won't be able to serve anything, but if for
+ * example the ACME plugin was configured to fetch a cert, this lets
+ * you bootstrap your vhost from having no cert to start with.
+ */
/****** add new things just above ---^ ******/
};
@@ -2110,7 +2682,11 @@ struct lws_context_creation_info {
/**< VHOST: Port to listen on. Use CONTEXT_PORT_NO_LISTEN to suppress
* listening for a client. Use CONTEXT_PORT_NO_LISTEN_SERVER if you are
* writing a server but you are using \ref sock-adopt instead of the
- * built-in listener */
+ * built-in listener.
+ *
+ * You can also set port to 0, in which case the kernel will pick
+ * a random port that is not already in use. You can find out what
+ * port the vhost is listening on using lws_get_vhost_listen_port() */
const char *iface;
/**< VHOST: NULL to bind the listen socket to all interfaces, or the
* interface name, eg, "eth2"
@@ -2191,12 +2767,12 @@ struct lws_context_creation_info {
int ka_interval;
/**< CONTEXT: if ka_time was nonzero, how long to wait before each ka_probes
* attempt */
-#ifdef LWS_OPENSSL_SUPPORT
+#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
SSL_CTX *provided_client_ssl_ctx;
/**< CONTEXT: If non-null, swap out libwebsockets ssl
- * implementation for the one provided by provided_ssl_ctx.
- * Libwebsockets no longer is responsible for freeing the context
- * if this option is selected. */
+ * implementation for the one provided by provided_ssl_ctx.
+ * Libwebsockets no longer is responsible for freeing the context
+ * if this option is selected. */
#else /* maintain structure layout either way */
void *provided_client_ssl_ctx; /**< dummy if ssl disabled */
#endif
@@ -2207,9 +2783,10 @@ struct lws_context_creation_info {
short max_http_header_pool;
/**< CONTEXT: The max number of connections with http headers that
* can be processed simultaneously (the corresponding memory is
- * allocated for the lifetime of the context). If the pool is
- * busy new incoming connections must wait for accept until one
- * becomes free. */
+ * allocated and deallocated dynamically as needed). If the pool is
+ * fully busy new incoming connections must wait for accept until one
+ * becomes free. 0 = allow as many ah as number of availble fds for
+ * the process */
unsigned int count_threads;
/**< CONTEXT: how many contexts to create in an array, 0 = 1 */
@@ -2372,13 +2949,42 @@ struct lws_context_creation_info {
* given here.
*/
uint32_t http2_settings[7];
- /**< CONTEXT: after context creation http2_settings[1] thru [6] have
- * been set to the lws platform default values.
- * VHOST: if http2_settings[0] is nonzero, the values given in
+ /**< VHOST: if http2_settings[0] is nonzero, the values given in
* http2_settings[1]..[6] are used instead of the lws
* platform default values.
* Just leave all at 0 if you don't care.
*/
+ const char *error_document_404;
+ /**< VHOST: If non-NULL, when asked to serve a non-existent file,
+ * lws attempts to server this url path instead. Eg,
+ * "/404.html" */
+ const char *alpn;
+ /**< CONTEXT: If non-NULL, default list of advertised alpn, comma-
+ * separated
+ *
+ * VHOST: If non-NULL, per-vhost list of advertised alpn, comma-
+ * separated
+ */
+ void **foreign_loops;
+ /**< CONTEXT: This is ignored if the context is not being started with
+ * an event loop, ie, .options has a flag like
+ * LWS_SERVER_OPTION_LIBUV.
+ *
+ * NULL indicates lws should start its own even loop for
+ * each service thread, and deal with closing the loops
+ * when the context is destroyed.
+ *
+ * Non-NULL means it points to an array of external
+ * ("foreign") event loops that are to be used in turn for
+ * each service thread. In the default case of 1 service
+ * thread, it can just point to one foreign event loop.
+ */
+ void (*signal_cb)(void *event_lib_handle, int signum);
+ /**< CONTEXT: NULL: default signal handling. Otherwise this receives
+ * the signal handler callback. event_lib_handle is the
+ * native event library signal handle, eg uv_signal_t *
+ * for libuv.
+ */
/* Add new things just above here ---^
* This is part of the ABI, don't needlessly break compatibility
@@ -2387,8 +2993,14 @@ struct lws_context_creation_info {
* members added above will see 0 (default) even if the app
* was not built against the newer headers.
*/
+ struct lws_context **pcontext;
+ /**< CONTEXT: if non-NULL, at the end of context destroy processing,
+ * the pointer pointed to by pcontext is written with NULL. You can
+ * use this to let foreign event loops know that lws context destruction
+ * is fully completed.
+ */
- void *_unused[8]; /**< dummy */
+ void *_unused[4]; /**< dummy */
};
/**
@@ -2426,7 +3038,8 @@ struct lws_context_creation_info {
* one place; they're all handled in the user callback.
*/
LWS_VISIBLE LWS_EXTERN struct lws_context *
-lws_create_context(struct lws_context_creation_info *info);
+lws_create_context(const struct lws_context_creation_info *info);
+
/**
* lws_context_destroy() - Destroy the websocket context
@@ -2439,9 +3052,6 @@ lws_create_context(struct lws_context_creation_info *info);
LWS_VISIBLE LWS_EXTERN void
lws_context_destroy(struct lws_context *context);
-LWS_VISIBLE LWS_EXTERN void
-lws_context_destroy2(struct lws_context *context);
-
typedef int (*lws_reload_func)(void);
/**
@@ -2529,7 +3139,7 @@ struct lws_vhost;
*/
LWS_VISIBLE LWS_EXTERN struct lws_vhost *
lws_create_vhost(struct lws_context *context,
- struct lws_context_creation_info *info);
+ const struct lws_context_creation_info *info);
/**
* lws_vhost_destroy() - Destroy a vhost (virtual server context)
@@ -2598,6 +3208,38 @@ LWS_VISIBLE LWS_EXTERN struct lws_vhost *
lws_get_vhost(struct lws *wsi);
/**
+ * lws_get_vhost_name() - returns the name of a vhost
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_vhost_name(struct lws_vhost *vhost);
+
+/**
+ * lws_get_vhost_port() - returns the port a vhost listens on, or -1
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_get_vhost_port(struct lws_vhost *vhost);
+
+/**
+ * lws_get_vhost_user() - returns the user pointer for the vhost
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN void *
+lws_get_vhost_user(struct lws_vhost *vhost);
+
+/**
+ * lws_get_vhost_iface() - returns the binding for the vhost listen socket
+ *
+ * \param vhost: which vhost
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_get_vhost_iface(struct lws_vhost *vhost);
+
+/**
* lws_json_dump_vhost() - describe vhost state and stats in JSON
*
* \param vh: the vhost
@@ -2748,7 +3390,16 @@ enum lws_client_connect_ssl_connection_flags {
LCCSCF_USE_SSL = (1 << 0),
LCCSCF_ALLOW_SELFSIGNED = (1 << 1),
LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK = (1 << 2),
- LCCSCF_ALLOW_EXPIRED = (1 << 3)
+ LCCSCF_ALLOW_EXPIRED = (1 << 3),
+
+ LCCSCF_PIPELINE = (1 << 16),
+ /**< Serialize / pipeline multiple client connections
+ * on a single connection where possible.
+ *
+ * HTTP/1.0: possible if Keep-Alive: yes sent by server
+ * HTTP/1.1: always possible... uses pipelining
+ * HTTP/2: always possible... uses parallel streams
+ * */
};
/** struct lws_client_connect_info - parameters to connect with when using
@@ -2762,7 +3413,7 @@ struct lws_client_connect_info {
int port;
/**< remote port to connect to */
int ssl_connection;
- /**< nonzero for ssl */
+ /**< 0, or a combination of LCCSCF_ flags */
const char *path;
/**< uri path */
const char *host;
@@ -2779,7 +3430,9 @@ struct lws_client_connect_info {
/**< UNUSED... provide in info.extensions at context creation time */
const char *method;
/**< if non-NULL, do this http method instead of ws[s] upgrade.
- * use "GET" to be a simple http client connection */
+ * use "GET" to be a simple http client connection. "RAW" gets
+ * you a connected socket that lws itself will leave alone once
+ * connected. */
struct lws *parent_wsi;
/**< if another wsi is responsible for this connection, give it here.
* this is used to make sure if the parent closes so do any
@@ -2805,6 +3458,13 @@ struct lws_client_connect_info {
const char *iface;
/**< NULL to allow routing on any interface, or interface name or IP
* to bind the socket to */
+ const char *local_protocol_name;
+ /**< NULL: .protocol is used both to select the local protocol handler
+ * to bind to and as the list of remote ws protocols we could
+ * accept.
+ * non-NULL: this protocol name is used to bind the connection to
+ * the local protocol handler. .protocol is used for the
+ * list of remote ws protocols we could accept */
/* Add new things just above here ---^
* This is part of the ABI, don't needlessly break compatibility
@@ -2813,6 +3473,12 @@ struct lws_client_connect_info {
* members added above will see 0 (default) even if the app
* was not built against the newer headers.
*/
+ const char *alpn;
+ /* NULL: allow lws default ALPN list, from vhost if present or from
+ * list of roles built into lws
+ * non-NULL: require one from provided comma-separated list of alpn
+ * tokens
+ */
void *_unused[4]; /**< dummy */
};
@@ -2938,6 +3604,10 @@ lws_http_client_read(struct lws *wsi, char **buf, int *len);
* \param wsi: client connection
*
* Returns the last server response code, eg, 200 for client http connections.
+ *
+ * You should capture this during the LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP
+ * callback, because after that the memory reserved for storing the related
+ * headers is freed and this value is lost.
*/
LWS_VISIBLE LWS_EXTERN unsigned int
lws_http_client_http_response(struct lws *wsi);
@@ -3030,15 +3700,8 @@ lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
* on one thread
* \param wsi: Cancel service on the thread this wsi is serviced by
*
- * This function lets a call to lws_service() waiting for a timeout
- * immediately return.
- *
- * It works by creating a phony event and then swallowing it silently.
- *
- * The reason it may be needed is when waiting in poll(), changes to
- * the event masks are ignored by the OS until poll() is reentered. This
- * lets you halt the poll() wait and make the reentry happen immediately
- * instead of having the wait out the rest of the poll timeout.
+ * Same as lws_cancel_service(), but targets a single service thread, the one
+ * the wsi belongs to. You probably want to use lws_cancel_service() instead.
*/
LWS_VISIBLE LWS_EXTERN void
lws_cancel_service_pt(struct lws *wsi);
@@ -3047,12 +3710,13 @@ lws_cancel_service_pt(struct lws *wsi);
* lws_cancel_service() - Cancel wait for new pending socket activity
* \param context: Websocket context
*
- * This function let a call to lws_service() waiting for a timeout
- * immediately return.
+ * This function creates an immediate "synchronous interrupt" to the lws poll()
+ * wait or event loop. As soon as possible in the serialzed service sequencing,
+ * a LWS_CALLBACK_EVENT_WAIT_CANCELLED callback is sent to every protocol on
+ * every vhost.
*
- * What it basically does is provide a fake event that will be swallowed,
- * so the wait in poll() is ended. That's useful because poll() doesn't
- * attend to changes in POLLIN/OUT/ERR until it re-enters the wait.
+ * lws_cancel_service() may be called from another thread while the context
+ * exists, and its effect will be immediately serialized.
*/
LWS_VISIBLE LWS_EXTERN void
lws_cancel_service(struct lws_context *context);
@@ -3235,6 +3899,7 @@ struct lws_process_html_args {
int len; /**< length of the original data at p */
int max_len; /**< maximum length we can grow the data to */
int final; /**< set if this is the last chunk of the file */
+ int chunked; /**< 0 == unchunked, 1 == produce chunk headers (incompatible with HTTP/2) */
};
typedef const char *(*lws_process_html_state_cb)(void *data, int index);
@@ -3296,12 +3961,12 @@ lws_chunked_html_process(struct lws_process_html_args *args,
/** struct lws_tokens
* you need these to look at headers that have been parsed if using the
* LWS_CALLBACK_FILTER_CONNECTION callback. If a header from the enum
- * list below is absent, .token = NULL and token_len = 0. Otherwise .token
- * points to .token_len chars containing that header content.
+ * list below is absent, .token = NULL and len = 0. Otherwise .token
+ * points to .len chars containing that header content.
*/
struct lws_tokens {
char *token; /**< pointer to start of the token */
- int token_len; /**< length of the token's value */
+ int len; /**< length of the token's value */
};
/* enum lws_token_indexes
@@ -3399,6 +4064,10 @@ enum lws_token_indexes {
WSI_TOKEN_CONNECT = 81,
WSI_TOKEN_HEAD_URI = 82,
WSI_TOKEN_TE = 83,
+ WSI_TOKEN_REPLAY_NONCE = 84,
+ WSI_TOKEN_COLON_PROTOCOL = 85,
+ WSI_TOKEN_X_AUTH_TOKEN = 86,
+
/****** add new things just above ---^ ******/
/* use token storage to stash these internally, not for
@@ -3411,6 +4080,7 @@ enum lws_token_indexes {
_WSI_TOKEN_CLIENT_ORIGIN,
_WSI_TOKEN_CLIENT_METHOD,
_WSI_TOKEN_CLIENT_IFACE,
+ _WSI_TOKEN_CLIENT_ALPN,
/* always last real token index*/
WSI_TOKEN_COUNT,
@@ -3605,6 +4275,54 @@ lws_add_http_header_content_length(struct lws *wsi,
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_finalize_http_header(struct lws *wsi, unsigned char **p,
unsigned char *end);
+
+/**
+ * lws_finalize_write_http_header() - Helper finializing and writing http headers
+ *
+ * \param wsi: the connection to check
+ * \param start: pointer to the start of headers in the buffer, eg &buf[LWS_PRE]
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Terminates the headers correctly accoring to the protocol in use (h1 / h2)
+ * and writes the headers. Returns nonzero for error.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_finalize_write_http_header(struct lws *wsi, unsigned char *start,
+ unsigned char **p, unsigned char *end);
+
+#define LWS_ILLEGAL_HTTP_CONTENT_LEN ((lws_filepos_t)-1ll)
+
+/**
+ * lws_add_http_common_headers() - Helper preparing common http headers
+ *
+ * \param wsi: the connection to check
+ * \param code: an HTTP code like 200, 404 etc (see enum http_status)
+ * \param content_type: the content type, like "text/html"
+ * \param content_len: the content length, in bytes
+ * \param p: pointer to current position in buffer pointer
+ * \param end: pointer to end of buffer
+ *
+ * Adds the initial response code, so should be called first.
+ *
+ * Code may additionally take OR'd flags:
+ *
+ * LWSAHH_FLAG_NO_SERVER_NAME: don't apply server name header this time
+ *
+ * This helper just calls public apis to simplify adding headers that are
+ * commonly needed. If it doesn't fit your case, or you want to add additional
+ * headers just call the public apis directly yourself for what you want.
+ *
+ * You can miss out the content length header by providing the constant
+ * LWS_ILLEGAL_HTTP_CONTENT_LEN for the content_len.
+ *
+ * It does not call lws_finalize_http_header(), to allow you to add further
+ * headers after calling this. You will need to call that yourself at the end.
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_add_http_common_headers(struct lws *wsi, unsigned int code,
+ const char *content_type, lws_filepos_t content_len,
+ unsigned char **p, unsigned char *end);
///@}
/** \defgroup form-parsing Form Parsing
@@ -3787,7 +4505,7 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
const char *html_body);
/**
- * lws_http_redirect() - write http redirect into buffer
+ * lws_http_redirect() - write http redirect out on wsi
*
* \param wsi: websocket connection
* \param code: HTTP response code (eg, 301)
@@ -3795,6 +4513,8 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
* \param len: length of loc
* \param p: pointer current position in buffer (updated as we write)
* \param end: pointer to end of buffer
+ *
+ * Returns amount written, or < 0 indicating fatal write failure.
*/
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
@@ -3845,30 +4565,29 @@ lws_sql_purify(char *escaped, const char *string, int len);
*/
LWS_VISIBLE LWS_EXTERN const char *
lws_json_purify(char *escaped, const char *string, int len);
-///@}
-/*! \defgroup ev libev helpers
+/**
+ * lws_filename_purify_inplace() - replace scary filename chars with underscore
*
- * ##libev helpers
+ * \param filename: filename to be purified
*
- * APIs specific to libev event loop itegration
+ * Replace scary characters in the filename (it should not be a path)
+ * with underscore, so it's safe to use.
*/
-///@{
-
-#ifdef LWS_WITH_LIBEV
-typedef void (lws_ev_signal_cb_t)(EV_P_ struct ev_signal *w, int revents);
+LWS_VISIBLE LWS_EXTERN void
+lws_filename_purify_inplace(char *filename);
LWS_VISIBLE LWS_EXTERN int
-lws_ev_sigint_cfg(struct lws_context *context, int use_ev_sigint,
- lws_ev_signal_cb_t *cb);
-
+lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
+ int len);
LWS_VISIBLE LWS_EXTERN int
-lws_ev_initloop(struct lws_context *context, struct ev_loop *loop, int tsi);
+lws_plat_write_file(const char *filename, void *buf, int len);
-LWS_VISIBLE LWS_EXTERN void
-lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents);
-#endif /* LWS_WITH_LIBEV */
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_read_file(const char *filename, void *buf, int len);
+LWS_VISIBLE LWS_EXTERN int
+lws_plat_recommended_rsa_bits(void);
///@}
/*! \defgroup uv libuv helpers
@@ -3879,60 +4598,38 @@ lws_ev_sigint_cb(struct ev_loop *loop, struct ev_signal *watcher, int revents);
*/
///@{
#ifdef LWS_WITH_LIBUV
-LWS_VISIBLE LWS_EXTERN int
-lws_uv_sigint_cfg(struct lws_context *context, int use_uv_sigint,
- uv_signal_cb cb);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_libuv_run(const struct lws_context *context, int tsi);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_libuv_stop(struct lws_context *context);
-
-LWS_VISIBLE LWS_EXTERN void
-lws_libuv_stop_without_kill(const struct lws_context *context, int tsi);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, int tsi);
+/*
+ * Any direct libuv allocations in lws protocol handlers must participate in the
+ * lws reference counting scheme. Two apis are provided:
+ *
+ * - lws_libuv_static_refcount_add(handle, context) to mark the handle with
+ * a pointer to the context and increment the global uv object counter
+ *
+ * - lws_libuv_static_refcount_del() which should be used as the close callback
+ * for your own libuv objects declared in the protocol scope.
+ *
+ * Using the apis allows lws to detach itself from a libuv loop completely
+ * cleanly and at the moment all of its libuv objects have completed close.
+ */
LWS_VISIBLE LWS_EXTERN uv_loop_t *
lws_uv_getloop(struct lws_context *context, int tsi);
LWS_VISIBLE LWS_EXTERN void
-lws_uv_sigint_cb(uv_signal_t *watcher, int signum);
+lws_libuv_static_refcount_add(uv_handle_t *, struct lws_context *context);
LWS_VISIBLE LWS_EXTERN void
-lws_close_all_handles_in_loop(uv_loop_t *loop);
-#endif /* LWS_WITH_LIBUV */
-///@}
-
-/*! \defgroup event libevent helpers
- *
- * ##libevent helpers
- *
- * APIs specific to libevent event loop itegration
- */
-///@{
-
-#ifdef LWS_WITH_LIBEVENT
-typedef void (lws_event_signal_cb_t) (evutil_socket_t sock_fd, short revents,
- void *ctx);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_event_sigint_cfg(struct lws_context *context, int use_event_sigint,
- lws_event_signal_cb_t cb);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_event_initloop(struct lws_context *context, struct event_base *loop,
- int tsi);
+lws_libuv_static_refcount_del(uv_handle_t *);
-LWS_VISIBLE LWS_EXTERN void
-lws_event_sigint_cb(evutil_socket_t sock_fd, short revents,
- void *ctx);
-#endif /* LWS_WITH_LIBEVENT */
+#endif /* LWS_WITH_LIBUV */
+#if defined(LWS_WITH_ESP32)
+#define lws_libuv_static_refcount_add(_a, _b)
+#define lws_libuv_static_refcount_del NULL
+#endif
///@}
+
/*! \defgroup timeout Connection timeouts
APIs related to setting connection timeouts
@@ -3951,7 +4648,7 @@ enum pending_timeout {
PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE = 4,
PENDING_TIMEOUT_AWAITING_PING = 5,
PENDING_TIMEOUT_CLOSE_ACK = 6,
- PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE = 7,
+ PENDING_TIMEOUT_UNUSED1 = 7,
PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE = 8,
PENDING_TIMEOUT_SSL_ACCEPT = 9,
PENDING_TIMEOUT_HTTP_CONTENT = 10,
@@ -3970,6 +4667,9 @@ enum pending_timeout {
PENDING_TIMEOUT_KILLED_BY_PARENT = 23,
PENDING_TIMEOUT_CLOSE_SEND = 24,
PENDING_TIMEOUT_HOLDING_AH = 25,
+ PENDING_TIMEOUT_UDP_IDLE = 26,
+ PENDING_TIMEOUT_CLIENT_CONN_IDLE = 27,
+ PENDING_TIMEOUT_LAGGING = 28,
/****** add new things just above ---^ ******/
@@ -4003,6 +4703,60 @@ enum pending_timeout {
*/
LWS_VISIBLE LWS_EXTERN void
lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
+
+#define LWS_SET_TIMER_USEC_CANCEL ((lws_usec_t)-1ll)
+#define LWS_USEC_PER_SEC (1000000ll)
+
+/**
+ * lws_set_timer_usecs() - schedules a callback on the wsi in the future
+ *
+ * \param wsi: Websocket connection instance
+ * \param usecs: LWS_SET_TIMER_USEC_CANCEL removes any existing scheduled
+ * callback, otherwise number of microseconds in the future
+ * the callback will occur at.
+ *
+ * NOTE: event loop support for this:
+ *
+ * default poll() loop: yes
+ * libuv event loop: yes
+ * libev: not implemented (patch welcome)
+ * libevent: not implemented (patch welcome)
+ *
+ * After the deadline expires, the wsi will get a callback of type
+ * LWS_CALLBACK_TIMER and the timer is exhausted. The deadline may be
+ * continuously deferred by further calls to lws_set_timer_usecs() with a later
+ * deadline, or cancelled by lws_set_timer_usecs(wsi, -1).
+ *
+ * If the timer should repeat, lws_set_timer_usecs() must be called again from
+ * LWS_CALLBACK_TIMER.
+ *
+ * Accuracy depends on the platform and the load on the event loop or system...
+ * all that's guaranteed is the callback will come after the requested wait
+ * period.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs);
+
+/*
+ * lws_timed_callback_vh_protocol() - calls back a protocol on a vhost after
+ * the specified delay
+ *
+ * \param vh: the vhost to call back
+ * \param protocol: the protocol to call back
+ * \param reason: callback reason
+ * \param secs: how many seconds in the future to do the callback. Set to
+ * -1 to cancel the timer callback.
+ *
+ * Callback the specified protocol with a fake wsi pointing to the specified
+ * vhost and protocol, with the specified reason, at the specified time in the
+ * future.
+ *
+ * Returns 0 if OK.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_timed_callback_vh_protocol(struct lws_vhost *vh,
+ const struct lws_protocols *prot,
+ int reason, int secs);
///@}
/*! \defgroup sending-data Sending data
@@ -4011,10 +4765,7 @@ lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
*/
//@{
#if !defined(LWS_SIZEOFPTR)
-#define LWS_SIZEOFPTR (sizeof (void *))
-#endif
-#if !defined(u_int64_t)
-#define u_int64_t unsigned long long
+#define LWS_SIZEOFPTR ((int)sizeof (void *))
#endif
#if defined(__x86_64__)
@@ -4030,6 +4781,8 @@ lws_set_timeout(struct lws *wsi, enum pending_timeout reason, int secs);
#define LWS_SEND_BUFFER_PRE_PADDING LWS_PRE
#define LWS_SEND_BUFFER_POST_PADDING 0
+#define LWS_WRITE_RAW LWS_WRITE_HTTP
+
/*
* NOTE: These public enums are part of the abi. If you want to add one,
* add it at where specified so existing users are unaffected.
@@ -4188,6 +4941,23 @@ lws_write(struct lws *wsi, unsigned char *buf, size_t len,
/* helper for case where buffer may be const */
#define lws_write_http(wsi, buf, len) \
lws_write(wsi, (unsigned char *)(buf), len, LWS_WRITE_HTTP)
+
+/* helper for multi-frame ws message flags */
+static inline int
+lws_write_ws_flags(int initial, int is_start, int is_end)
+{
+ int r;
+
+ if (is_start)
+ r = initial;
+ else
+ r = LWS_WRITE_CONTINUATION;
+
+ if (!is_end)
+ r |= LWS_WRITE_NO_FIN;
+
+ return r;
+}
///@}
/** \defgroup callback-when-writeable Callback when writeable
@@ -4327,9 +5097,31 @@ lws_callback_all_protocol_vhost_args(struct lws_vhost *vh,
* - Which: connections using this protocol on same VHOST as wsi ONLY
* - When: now
* - What: reason
+ *
+ * This is deprecated since v2.5, use lws_callback_vhost_protocols_vhost()
+ * which takes the pointer to the vhost directly without using or needing the
+ * wsi.
*/
LWS_VISIBLE LWS_EXTERN int
-lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len);
+lws_callback_vhost_protocols(struct lws *wsi, int reason, void *in, int len)
+LWS_WARN_DEPRECATED;
+
+/**
+ * lws_callback_vhost_protocols_vhost() - Callback all protocols enabled on a vhost
+ * with the given reason
+ *
+ * \param vh: vhost that will get callbacks
+ * \param reason: Callback reason index
+ * \param in: in argument to callback
+ * \param len: len argument to callback
+ *
+ * - Which: connections using this protocol on same VHOST as wsi ONLY
+ * - When: now
+ * - What: reason
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_callback_vhost_protocols_vhost(struct lws_vhost *vh, int reason, void *in,
+ size_t len);
LWS_VISIBLE LWS_EXTERN int
lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
@@ -4338,11 +5130,11 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
/**
* lws_get_socket_fd() - returns the socket file descriptor
*
- * You will not need this unless you are doing something special
+ * This is needed to use sendto() on UDP raw sockets
*
* \param wsi: Websocket connection instance
*/
-LWS_VISIBLE LWS_EXTERN int
+LWS_VISIBLE LWS_EXTERN lws_sockfd_type
lws_get_socket_fd(struct lws *wsi);
/**
@@ -4366,7 +5158,7 @@ lws_get_socket_fd(struct lws *wsi);
* automatically, so this number reflects the situation at the peer or
* intermediary dynamically.
*/
-LWS_VISIBLE LWS_EXTERN size_t
+LWS_VISIBLE LWS_EXTERN lws_fileofs_t
lws_get_peer_write_allowance(struct lws *wsi);
///@}
@@ -4425,19 +5217,22 @@ lws_rx_flow_allow_all_protocol(const struct lws_context *context,
/**
* lws_remaining_packet_payload() - Bytes to come before "overall"
- * rx packet is complete
+ * rx fragment is complete
* \param wsi: Websocket instance (available from user callback)
*
- * This function is intended to be called from the callback if the
- * user code is interested in "complete packets" from the client.
- * libwebsockets just passes through payload as it comes and issues a buffer
- * additionally when it hits a built-in limit. The LWS_CALLBACK_RECEIVE
- * callback handler can use this API to find out if the buffer it has just
- * been given is the last piece of a "complete packet" from the client --
- * when that is the case lws_remaining_packet_payload() will return
- * 0.
+ * This tracks how many bytes are left in the current ws fragment, according
+ * to the ws length given in the fragment header.
+ *
+ * If the message was in a single fragment, and there is no compression, this
+ * is the same as "how much data is left to read for this message".
*
- * Many protocols won't care becuse their packets are always small.
+ * However, if the message is being sent in multiple fragments, this will
+ * reflect the unread amount of the current **fragment**, not the message. With
+ * ws, it is legal to not know the length of the message before it completes.
+ *
+ * Additionally if the message is sent via the negotiated permessage-deflate
+ * extension, this number only tells the amount of **compressed** data left to
+ * be read, since that is the only information available at the ws layer.
*/
LWS_VISIBLE LWS_EXTERN size_t
lws_remaining_packet_payload(struct lws *wsi);
@@ -4491,8 +5286,10 @@ typedef enum {
LWS_ADOPT_ALLOW_SSL = 4, /* flag: if set requires LWS_ADOPT_SOCKET */
LWS_ADOPT_WS_PARENTIO = 8, /* flag: ws mode parent handles IO
* if given must be only flag
- * wsi put directly into ws mode
- */
+ * wsi put directly into ws mode */
+ LWS_ADOPT_FLAG_UDP = 16, /* flag: socket is UDP */
+
+ LWS_ADOPT_RAW_SOCKET_UDP = LWS_ADOPT_SOCKET | LWS_ADOPT_FLAG_UDP,
} lws_adoption_type;
typedef union {
@@ -4500,6 +5297,16 @@ typedef union {
lws_filefd_type filefd;
} lws_sock_file_fd_type;
+#if !defined(LWS_WITH_ESP32)
+struct lws_udp {
+ struct sockaddr sa;
+ socklen_t salen;
+
+ struct sockaddr sa_pending;
+ socklen_t salen_pending;
+};
+#endif
+
/*
* lws_adopt_descriptor_vhost() - adopt foreign socket or file descriptor
* if socket descriptor, should already have been accepted from listen socket
@@ -4576,6 +5383,24 @@ lws_adopt_socket_readbuf(struct lws_context *context, lws_sockfd_type accept_fd,
LWS_VISIBLE LWS_EXTERN struct lws *
lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost, lws_sockfd_type accept_fd,
const char *readbuf, size_t len);
+
+#define LWS_CAUDP_BIND 1
+
+/**
+ * lws_create_adopt_udp() - create, bind and adopt a UDP socket
+ *
+ * \param vhost: lws vhost
+ * \param port: UDP port to bind to, -1 means unbound
+ * \param flags: 0 or LWS_CAUDP_NO_BIND
+ * \param protocol_name: Name of protocol on vhost to bind wsi to
+ * \param parent_wsi: NULL or parent wsi new wsi will be a child of
+ *
+ * Either returns new wsi bound to accept_fd, or closes accept_fd and
+ * returns NULL, having cleaned up any new wsi pieces.
+ * */
+LWS_VISIBLE LWS_EXTERN struct lws *
+lws_create_adopt_udp(struct lws_vhost *vhost, int port, int flags,
+ const char *protocol_name, struct lws *parent_wsi);
///@}
/** \defgroup net Network related helper APIs
@@ -4627,17 +5452,31 @@ lws_get_peer_addresses(struct lws *wsi, lws_sockfd_type fd, char *name,
*/
LWS_VISIBLE LWS_EXTERN const char *
lws_get_peer_simple(struct lws *wsi, char *name, int namelen);
-#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32)
+
+
+#define LWS_ITOSA_NOT_EXIST -1
+#define LWS_ITOSA_NOT_USABLE -2
+#define LWS_ITOSA_USABLE 0
+#if !defined(LWS_WITH_ESP32)
/**
* lws_interface_to_sa() - Convert interface name or IP to sockaddr struct
*
- * \param ipv6: Allow IPV6 addresses
+ * \param ipv6: Allow IPV6 addresses
* \param ifname: Interface name or IP
- * \param addr: struct sockaddr_in * to be written
+ * \param addr: struct sockaddr_in * to be written
* \param addrlen: Length of addr
*
* This converts a textual network interface name to a sockaddr usable by
- * other network functions
+ * other network functions.
+ *
+ * If the network interface doesn't exist, it will return LWS_ITOSA_NOT_EXIST.
+ *
+ * If the network interface is not usable, eg ethernet cable is removed, it
+ * may logically exist but not have any IP address. As such it will return
+ * LWS_ITOSA_NOT_USABLE.
+ *
+ * If the network interface exists and is usable, it will return
+ * LWS_ITOSA_USABLE.
*/
LWS_VISIBLE LWS_EXTERN int
lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
@@ -4705,6 +5544,13 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
type it = &(start); \
while (*(it)) {
+#define lws_start_foreach_llp_safe(type, it, start, nxt)\
+{ \
+ type it = &(start); \
+ type next; \
+ while (*(it)) { \
+ next = &((*(it))->nxt); \
+
/**
* lws_end_foreach_llp(): linkedlist pointer iterator helper end
*
@@ -4720,6 +5566,170 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
} \
}
+#define lws_end_foreach_llp_safe(it) \
+ it = next; \
+ } \
+}
+
+#define lws_ll_fwd_insert(\
+ ___new_object, /* pointer to new object */ \
+ ___m_list, /* member for next list object ptr */ \
+ ___list_head /* list head */ \
+ ) {\
+ ___new_object->___m_list = ___list_head; \
+ ___list_head = ___new_object; \
+ }
+
+#define lws_ll_fwd_remove(\
+ ___type, /* type of listed object */ \
+ ___m_list, /* member for next list object ptr */ \
+ ___target, /* object to remove from list */ \
+ ___list_head /* list head */ \
+ ) { \
+ lws_start_foreach_llp(___type **, ___ppss, ___list_head) { \
+ if (*___ppss == ___target) { \
+ *___ppss = ___target->___m_list; \
+ break; \
+ } \
+ } lws_end_foreach_llp(___ppss, ___m_list); \
+ }
+
+/*
+ * doubly linked-list
+ */
+
+struct lws_dll { /* abstract */
+ struct lws_dll *prev;
+ struct lws_dll *next;
+};
+
+/*
+ * these all point to the composed list objects... you have to use the
+ * lws_container_of() helper to recover the start of the containing struct
+ */
+
+LWS_VISIBLE LWS_EXTERN void
+lws_dll_add_front(struct lws_dll *d, struct lws_dll *phead);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_dll_remove(struct lws_dll *d);
+
+struct lws_dll_lws { /* typed as struct lws * */
+ struct lws_dll_lws *prev;
+ struct lws_dll_lws *next;
+};
+
+#define lws_dll_is_null(___dll) (!(___dll)->prev && !(___dll)->next)
+
+static inline void
+lws_dll_lws_add_front(struct lws_dll_lws *_a, struct lws_dll_lws *_head)
+{
+ lws_dll_add_front((struct lws_dll *)_a, (struct lws_dll *)_head);
+}
+
+static inline void
+lws_dll_lws_remove(struct lws_dll_lws *_a)
+{
+ lws_dll_remove((struct lws_dll *)_a);
+}
+
+/*
+ * these are safe against the current container object getting deleted,
+ * since the hold his next in a temp and go to that next. ___tmp is
+ * the temp.
+ */
+
+#define lws_start_foreach_dll_safe(___type, ___it, ___tmp, ___start) \
+{ \
+ ___type ___it = ___start; \
+ while (___it) { \
+ ___type ___tmp = (___it)->next;
+
+#define lws_end_foreach_dll_safe(___it, ___tmp) \
+ ___it = ___tmp; \
+ } \
+}
+
+#define lws_start_foreach_dll(___type, ___it, ___start) \
+{ \
+ ___type ___it = ___start; \
+ while (___it) {
+
+#define lws_end_foreach_dll(___it) \
+ ___it = (___it)->next; \
+ } \
+}
+
+struct lws_buflist;
+
+/**
+ * lws_buflist_append_segment(): add buffer to buflist at head
+ *
+ * \param head: list head
+ * \param buf: buffer to stash
+ * \param len: length of buffer to stash
+ *
+ * Returns -1 on OOM, 1 if this was the first segment on the list, and 0 if
+ * it was a subsequent segment.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
+ size_t len);
+/**
+ * lws_buflist_next_segment_len(): number of bytes left in current segment
+ *
+ * \param head: list head
+ * \param buf: if non-NULL, *buf is written with the address of the start of
+ * the remaining data in the segment
+ *
+ * Returns the number of bytes left in the current segment. 0 indicates
+ * that the buflist is empty (there are no segments on the buflist).
+ */
+LWS_VISIBLE LWS_EXTERN size_t
+lws_buflist_next_segment_len(struct lws_buflist **head, uint8_t **buf);
+/**
+ * lws_buflist_use_segment(): remove len bytes from the current segment
+ *
+ * \param head: list head
+ * \param len: number of bytes to mark as used
+ *
+ * If len is less than the remaining length of the current segment, the position
+ * in the current segment is simply advanced and it returns.
+ *
+ * If len uses up the remaining length of the current segment, then the segment
+ * is deleted and the list head moves to the next segment if any.
+ *
+ * Returns the number of bytes left in the current segment. 0 indicates
+ * that the buflist is empty (there are no segments on the buflist).
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_buflist_use_segment(struct lws_buflist **head, size_t len);
+/**
+ * lws_buflist_destroy_all_segments(): free all segments on the list
+ *
+ * \param head: list head
+ *
+ * This frees everything on the list unconditionally. *head is always
+ * NULL after this.
+ */
+LWS_VISIBLE LWS_EXTERN void
+lws_buflist_destroy_all_segments(struct lws_buflist **head);
+
+void
+lws_buflist_describe(struct lws_buflist **head, void *id);
+
+/**
+ * lws_ptr_diff(): helper to report distance between pointers as an int
+ *
+ * \param head: the pointer with the larger address
+ * \param tail: the pointer with the smaller address
+ *
+ * This helper gives you an int representing the number of bytes further
+ * forward the first pointer is compared to the second pointer.
+ */
+#define lws_ptr_diff(head, tail) \
+ ((int)((char *)(head) - (char *)(tail)))
+
/**
* lws_snprintf(): snprintf that truncates the returned length too
*
@@ -4735,6 +5745,19 @@ LWS_VISIBLE LWS_EXTERN int
lws_snprintf(char *str, size_t size, const char *format, ...) LWS_FORMAT(3);
/**
+ * lws_strncpy(): strncpy that guarantees NUL on truncated copy
+ *
+ * \param dest: destination buffer
+ * \param src: source buffer
+ * \param size: bytes left in destination buffer
+ *
+ * This lets you correctly truncate buffers by concatenating lengths, if you
+ * reach the limit the reported length doesn't exceed the limit.
+ */
+LWS_VISIBLE LWS_EXTERN char *
+lws_strncpy(char *dest, const char *src, size_t size);
+
+/**
* lws_get_random(): fill a buffer with platform random data
*
* \param context: the lws context
@@ -4800,6 +5823,25 @@ lws_set_wsi_user(struct lws *wsi, void *user);
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
const char **path);
+/**
+ * lws_cmdline_option(): simple commandline parser
+ *
+ * \param argc: count of argument strings
+ * \param argv: argument strings
+ * \param val: string to find
+ *
+ * Returns NULL if the string \p val is not found in the arguments.
+ *
+ * If it is found, then it returns a pointer to the next character after \p val.
+ * So if \p val is "-d", then for the commandlines "myapp -d15" and
+ * "myapp -d 15", in both cases the return will point to the "15".
+ *
+ * In the case there is no argument, like "myapp -d", the return will
+ * either point to the '\\0' at the end of -d, or to the start of the
+ * next argument, ie, will be non-NULL.
+ */
+LWS_VISIBLE LWS_EXTERN const char *
+lws_cmdline_option(int argc, const char **argv, const char *val);
/**
* lws_now_secs(): return seconds since 1970-1-1
@@ -4808,7 +5850,27 @@ LWS_VISIBLE LWS_EXTERN unsigned long
lws_now_secs(void);
/**
- * lws_get_context - Allow geting lws_context from a Websocket connection
+ * lws_compare_time_t(): return relationship between two time_t
+ *
+ * \param context: struct lws_context
+ * \param t1: time_t 1
+ * \param t2: time_t 2
+ *
+ * returns <0 if t2 > t1; >0 if t1 > t2; or == 0 if t1 == t2.
+ *
+ * This is aware of clock discontiguities that may have affected either t1 or
+ * t2 and adapts the comparison for them.
+ *
+ * For the discontiguity detection to work, you must avoid any arithmetic on
+ * the times being compared. For example to have a timeout that triggers
+ * 15s from when it was set, store the time it was set and compare like
+ * `if (lws_compare_time_t(context, now, set_time) > 15)`
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_compare_time_t(struct lws_context *context, time_t t1, time_t t2);
+
+/**
+ * lws_get_context - Allow getting lws_context from a Websocket connection
* instance
*
* With this function, users can access context in the callback function.
@@ -4820,6 +5882,18 @@ LWS_VISIBLE LWS_EXTERN struct lws_context * LWS_WARN_UNUSED_RESULT
lws_get_context(const struct lws *wsi);
/**
+ * lws_get_vhost_listen_port - Find out the port number a vhost is listening on
+ *
+ * In the case you passed 0 for the port number at context creation time, you
+ * can discover the port number that was actually chosen for the vhost using
+ * this api.
+ *
+ * \param vhost: Vhost to get listen port from
+ */
+LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_get_vhost_listen_port(struct lws_vhost *vhost);
+
+/**
* lws_get_count_threads(): how many service threads the context uses
*
* \param context: the lws context
@@ -4851,6 +5925,16 @@ LWS_VISIBLE LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
lws_get_child(const struct lws *wsi);
/**
+ * lws_get_udp() - get wsi's udp struct
+ *
+ * \param wsi: lws connection
+ *
+ * Returns NULL or pointer to the wsi's UDP-specific information
+ */
+LWS_VISIBLE LWS_EXTERN const struct lws_udp * LWS_WARN_UNUSED_RESULT
+lws_get_udp(const struct lws *wsi);
+
+/**
* lws_parent_carries_io() - mark wsi as needing to send messages via parent
*
* \param wsi: child lws connection
@@ -4890,14 +5974,6 @@ lws_get_close_payload(struct lws *wsi);
LWS_VISIBLE LWS_EXTERN
struct lws *lws_get_network_wsi(struct lws *wsi);
-/*
- * \deprecated DEPRECATED Note: this is not normally needed as a user api.
- * It's provided in case it is
- * useful when integrating with other app poll loop service code.
- */
-LWS_VISIBLE LWS_EXTERN int
-lws_read(struct lws *wsi, unsigned char *buf, lws_filepos_t len);
-
/**
* lws_set_allocator() - custom allocator support
*
@@ -4995,7 +6071,18 @@ lws_is_ssl(struct lws *wsi);
LWS_VISIBLE LWS_EXTERN int
lws_is_cgi(struct lws *wsi);
-#ifdef LWS_OPENSSL_SUPPORT
+
+struct lws_wifi_scan { /* generic wlan scan item */
+ struct lws_wifi_scan *next;
+ char ssid[32];
+ int32_t rssi; /* divide by .count to get db */
+ uint8_t bssid[6];
+ uint8_t count;
+ uint8_t channel;
+ uint8_t authmode;
+};
+
+#if defined(LWS_WITH_TLS) && !defined(LWS_WITH_MBEDTLS)
/**
* lws_get_ssl() - Return wsi's SSL context structure
* \param wsi: websocket connection
@@ -5005,6 +6092,160 @@ lws_is_cgi(struct lws *wsi);
LWS_VISIBLE LWS_EXTERN SSL*
lws_get_ssl(struct lws *wsi);
#endif
+
+enum lws_tls_cert_info {
+ LWS_TLS_CERT_INFO_VALIDITY_FROM,
+ /**< fills .time with the time_t the cert validity started from */
+ LWS_TLS_CERT_INFO_VALIDITY_TO,
+ /**< fills .time with the time_t the cert validity ends at */
+ LWS_TLS_CERT_INFO_COMMON_NAME,
+ /**< fills up to len bytes of .ns.name with the cert common name */
+ LWS_TLS_CERT_INFO_ISSUER_NAME,
+ /**< fills up to len bytes of .ns.name with the cert issuer name */
+ LWS_TLS_CERT_INFO_USAGE,
+ /**< fills verified with a bitfield asserting the valid uses */
+ LWS_TLS_CERT_INFO_VERIFIED,
+ /**< fills .verified with a bool representing peer cert validity,
+ * call returns -1 if no cert */
+ LWS_TLS_CERT_INFO_OPAQUE_PUBLIC_KEY,
+ /**< the certificate's public key, as an opaque bytestream. These
+ * opaque bytestreams can only be compared with each other using the
+ * same tls backend, ie, OpenSSL or mbedTLS. The different backends
+ * produce different, incompatible representations for the same cert.
+ */
+};
+
+union lws_tls_cert_info_results {
+ unsigned int verified;
+ time_t time;
+ unsigned int usage;
+ struct {
+ int len;
+ /* KEEP LAST... notice the [64] is only there because
+ * name[] is not allowed in a union. The actual length of
+ * name[] is arbitrary and is passed into the api using the
+ * len parameter. Eg
+ *
+ * char big[1024];
+ * union lws_tls_cert_info_results *buf =
+ * (union lws_tls_cert_info_results *)big;
+ *
+ * lws_tls_peer_cert_info(wsi, type, buf, sizeof(big) -
+ * sizeof(*buf) + sizeof(buf->ns.name));
+ */
+ char name[64];
+ } ns;
+};
+
+/**
+ * lws_tls_peer_cert_info() - get information from the peer's TLS cert
+ *
+ * \param wsi: the connection to query
+ * \param type: one of LWS_TLS_CERT_INFO_
+ * \param buf: pointer to union to take result
+ * \param len: when result is a string, the true length of buf->ns.name[]
+ *
+ * lws_tls_peer_cert_info() lets you get hold of information from the peer
+ * certificate.
+ *
+ * Return 0 if there is a result in \p buf, or -1 indicating there was no cert
+ * or another problem.
+ *
+ * This function works the same no matter if the TLS backend is OpenSSL or
+ * mbedTLS.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_peer_cert_info(struct lws *wsi, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len);
+
+/**
+ * lws_tls_vhost_cert_info() - get information from the vhost's own TLS cert
+ *
+ * \param vhost: the vhost to query
+ * \param type: one of LWS_TLS_CERT_INFO_
+ * \param buf: pointer to union to take result
+ * \param len: when result is a string, the true length of buf->ns.name[]
+ *
+ * lws_tls_vhost_cert_info() lets you get hold of information from the vhost
+ * certificate.
+ *
+ * Return 0 if there is a result in \p buf, or -1 indicating there was no cert
+ * or another problem.
+ *
+ * This function works the same no matter if the TLS backend is OpenSSL or
+ * mbedTLS.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_vhost_cert_info(struct lws_vhost *vhost, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len);
+
+/**
+ * lws_tls_acme_sni_cert_create() - creates a temp selfsigned cert
+ * and attaches to a vhost
+ *
+ * \param vhost: the vhost to acquire the selfsigned cert
+ * \param san_a: SAN written into the certificate
+ * \param san_b: second SAN written into the certificate
+ *
+ *
+ * Returns 0 if created and attached to the vhost. Returns -1 if problems and
+ * frees all allocations before returning.
+ *
+ * On success, any allocations are destroyed at vhost destruction automatically.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
+ const char *san_b);
+
+/**
+ * lws_tls_acme_sni_csr_create() - creates a CSR and related private key PEM
+ *
+ * \param context: lws_context used for random
+ * \param elements: array of LWS_TLS_REQ_ELEMENT_COUNT const char *
+ * \param csr: buffer that will get the b64URL(ASN-1 CSR)
+ * \param csr_len: max length of the csr buffer
+ * \param privkey_pem: pointer to pointer allocated to hold the privkey_pem
+ * \param privkey_len: pointer to size_t set to the length of the privkey_pem
+ *
+ * Creates a CSR according to the information in \p elements, and a private
+ * RSA key used to sign the CSR.
+ *
+ * The outputs are the b64URL(ASN-1 CSR) into csr, and the PEM private key into
+ * privkey_pem.
+ *
+ * Notice that \p elements points to an array of const char *s pointing to the
+ * information listed in the enum above. If an entry is NULL or an empty
+ * string, the element is set to "none" in the CSR.
+ *
+ * Returns 0 on success or nonzero for failure.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_acme_sni_csr_create(struct lws_context *context, const char *elements[],
+ uint8_t *csr, size_t csr_len, char **privkey_pem,
+ size_t *privkey_len);
+
+/**
+ * lws_tls_cert_updated() - update every vhost using the given cert path
+ *
+ * \param context: our lws_context
+ * \param certpath: the filepath to the certificate
+ * \param keypath: the filepath to the private key of the certificate
+ * \param mem_cert: copy of the cert in memory
+ * \param len_mem_cert: length of the copy of the cert in memory
+ * \param mem_privkey: copy of the private key in memory
+ * \param len_mem_privkey: length of the copy of the private key in memory
+ *
+ * Checks every vhost to see if it is the using certificate described by the
+ * the given filepaths. If so, it attempts to update the vhost ssl_ctx to use
+ * the new certificate.
+ *
+ * Returns 0 on success or nonzero for failure.
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_cert_updated(struct lws_context *context, const char *certpath,
+ const char *keypath,
+ const char *mem_cert, size_t len_mem_cert,
+ const char *mem_privkey, size_t len_mem_privkey);
///@}
/** \defgroup lws_ring LWS Ringbuffer APIs
@@ -5229,6 +6470,65 @@ lws_ring_next_linear_insert_range(struct lws_ring *ring, void **start,
*/
LWS_VISIBLE LWS_EXTERN void
lws_ring_bump_head(struct lws_ring *ring, size_t bytes);
+
+LWS_VISIBLE LWS_EXTERN void
+lws_ring_dump(struct lws_ring *ring, uint32_t *tail);
+
+/*
+ * This is a helper that combines the common pattern of needing to consume
+ * some ringbuffer elements, move the consumer tail on, and check if that
+ * has moved any ringbuffer elements out of scope, because it was the last
+ * consumer that had not already consumed them.
+ *
+ * Elements that go out of scope because the oldest tail is now after them
+ * get garbage-collected by calling the destroy_element callback on them
+ * defined when the ringbuffer was created.
+ */
+
+#define lws_ring_consume_and_update_oldest_tail(\
+ ___ring, /* the lws_ring object */ \
+ ___type, /* type of objects with tails */ \
+ ___ptail, /* ptr to tail of obj with tail doing consuming */ \
+ ___count, /* count of payload objects being consumed */ \
+ ___list_head, /* head of list of objects with tails */ \
+ ___mtail, /* member name of tail in ___type */ \
+ ___mlist /* member name of next list member ptr in ___type */ \
+ ) { \
+ int ___n, ___m; \
+ \
+ ___n = lws_ring_get_oldest_tail(___ring) == *(___ptail); \
+ lws_ring_consume(___ring, ___ptail, NULL, ___count); \
+ if (___n) { \
+ uint32_t ___oldest; \
+ ___n = 0; \
+ ___oldest = *(___ptail); \
+ lws_start_foreach_llp(___type **, ___ppss, ___list_head) { \
+ ___m = lws_ring_get_count_waiting_elements( \
+ ___ring, &(*___ppss)->tail); \
+ if (___m >= ___n) { \
+ ___n = ___m; \
+ ___oldest = (*___ppss)->tail; \
+ } \
+ } lws_end_foreach_llp(___ppss, ___mlist); \
+ \
+ lws_ring_update_oldest_tail(___ring, ___oldest); \
+ } \
+}
+
+/*
+ * This does the same as the lws_ring_consume_and_update_oldest_tail()
+ * helper, but for the simpler case there is only one consumer, so one
+ * tail, and that tail is always the oldest tail.
+ */
+
+#define lws_ring_consume_single_tail(\
+ ___ring, /* the lws_ring object */ \
+ ___ptail, /* ptr to tail of obj with tail doing consuming */ \
+ ___count /* count of payload objects being consumed */ \
+ ) { \
+ lws_ring_consume(___ring, ___ptail, NULL, ___count); \
+ lws_ring_update_oldest_tail(___ring, *(___ptail)); \
+}
///@}
/** \defgroup sha SHA and B64 helpers
@@ -5265,16 +6565,40 @@ lws_SHA1(const unsigned char *d, size_t n, unsigned char *md);
LWS_VISIBLE LWS_EXTERN int
lws_b64_encode_string(const char *in, int in_len, char *out, int out_size);
/**
+ * lws_b64_encode_string_url(): encode a string into base 64
+ *
+ * \param in: incoming buffer
+ * \param in_len: length of incoming buffer
+ * \param out: result buffer
+ * \param out_size: length of result buffer
+ *
+ * Encodes a string using b64 with the "URL" variant (+ -> -, and / -> _)
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_b64_encode_string_url(const char *in, int in_len, char *out, int out_size);
+/**
* lws_b64_decode_string(): decode a string from base 64
*
* \param in: incoming buffer
* \param out: result buffer
* \param out_size: length of result buffer
*
- * Decodes a string using b64
+ * Decodes a NUL-terminated string using b64
*/
LWS_VISIBLE LWS_EXTERN int
lws_b64_decode_string(const char *in, char *out, int out_size);
+/**
+ * lws_b64_decode_string_len(): decode a string from base 64
+ *
+ * \param in: incoming buffer
+ * \param in_len: length of incoming buffer
+ * \param out: result buffer
+ * \param out_size: length of result buffer
+ *
+ * Decodes a range of chars using b64
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_b64_decode_string_len(const char *in, int in_len, char *out, int out_size);
///@}
@@ -5730,6 +7054,248 @@ lws_email_destroy(struct lws_email *email);
#endif
//@}
+
+/** \defgroup lejp JSON parser
+ * ##JSON parsing related functions
+ * \ingroup lwsapi
+ *
+ * LEJP is an extremely lightweight JSON stream parser included in lws.
+ */
+//@{
+struct lejp_ctx;
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
+#endif
+#define LWS_ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
+#define LEJP_FLAG_WS_KEEP 64
+#define LEJP_FLAG_WS_COMMENTLINE 32
+
+enum lejp_states {
+ LEJP_IDLE = 0,
+ LEJP_MEMBERS = 1,
+ LEJP_M_P = 2,
+ LEJP_MP_STRING = LEJP_FLAG_WS_KEEP | 3,
+ LEJP_MP_STRING_ESC = LEJP_FLAG_WS_KEEP | 4,
+ LEJP_MP_STRING_ESC_U1 = LEJP_FLAG_WS_KEEP | 5,
+ LEJP_MP_STRING_ESC_U2 = LEJP_FLAG_WS_KEEP | 6,
+ LEJP_MP_STRING_ESC_U3 = LEJP_FLAG_WS_KEEP | 7,
+ LEJP_MP_STRING_ESC_U4 = LEJP_FLAG_WS_KEEP | 8,
+ LEJP_MP_DELIM = 9,
+ LEJP_MP_VALUE = 10,
+ LEJP_MP_VALUE_NUM_INT = LEJP_FLAG_WS_KEEP | 11,
+ LEJP_MP_VALUE_NUM_EXP = LEJP_FLAG_WS_KEEP | 12,
+ LEJP_MP_VALUE_TOK = LEJP_FLAG_WS_KEEP | 13,
+ LEJP_MP_COMMA_OR_END = 14,
+ LEJP_MP_ARRAY_END = 15,
+};
+
+enum lejp_reasons {
+ LEJP_CONTINUE = -1,
+ LEJP_REJECT_IDLE_NO_BRACE = -2,
+ LEJP_REJECT_MEMBERS_NO_CLOSE = -3,
+ LEJP_REJECT_MP_NO_OPEN_QUOTE = -4,
+ LEJP_REJECT_MP_STRING_UNDERRUN = -5,
+ LEJP_REJECT_MP_ILLEGAL_CTRL = -6,
+ LEJP_REJECT_MP_STRING_ESC_ILLEGAL_ESC = -7,
+ LEJP_REJECT_ILLEGAL_HEX = -8,
+ LEJP_REJECT_MP_DELIM_MISSING_COLON = -9,
+ LEJP_REJECT_MP_DELIM_BAD_VALUE_START = -10,
+ LEJP_REJECT_MP_VAL_NUM_INT_NO_FRAC = -11,
+ LEJP_REJECT_MP_VAL_NUM_FORMAT = -12,
+ LEJP_REJECT_MP_VAL_NUM_EXP_BAD_EXP = -13,
+ LEJP_REJECT_MP_VAL_TOK_UNKNOWN = -14,
+ LEJP_REJECT_MP_C_OR_E_UNDERF = -15,
+ LEJP_REJECT_MP_C_OR_E_NOTARRAY = -16,
+ LEJP_REJECT_MP_ARRAY_END_MISSING = -17,
+ LEJP_REJECT_STACK_OVERFLOW = -18,
+ LEJP_REJECT_MP_DELIM_ISTACK = -19,
+ LEJP_REJECT_NUM_TOO_LONG = -20,
+ LEJP_REJECT_MP_C_OR_E_NEITHER = -21,
+ LEJP_REJECT_UNKNOWN = -22,
+ LEJP_REJECT_CALLBACK = -23
+};
+
+#define LEJP_FLAG_CB_IS_VALUE 64
+
+enum lejp_callbacks {
+ LEJPCB_CONSTRUCTED = 0,
+ LEJPCB_DESTRUCTED = 1,
+
+ LEJPCB_START = 2,
+ LEJPCB_COMPLETE = 3,
+ LEJPCB_FAILED = 4,
+
+ LEJPCB_PAIR_NAME = 5,
+
+ LEJPCB_VAL_TRUE = LEJP_FLAG_CB_IS_VALUE | 6,
+ LEJPCB_VAL_FALSE = LEJP_FLAG_CB_IS_VALUE | 7,
+ LEJPCB_VAL_NULL = LEJP_FLAG_CB_IS_VALUE | 8,
+ LEJPCB_VAL_NUM_INT = LEJP_FLAG_CB_IS_VALUE | 9,
+ LEJPCB_VAL_NUM_FLOAT = LEJP_FLAG_CB_IS_VALUE | 10,
+ LEJPCB_VAL_STR_START = 11, /* notice handle separately */
+ LEJPCB_VAL_STR_CHUNK = LEJP_FLAG_CB_IS_VALUE | 12,
+ LEJPCB_VAL_STR_END = LEJP_FLAG_CB_IS_VALUE | 13,
+
+ LEJPCB_ARRAY_START = 14,
+ LEJPCB_ARRAY_END = 15,
+
+ LEJPCB_OBJECT_START = 16,
+ LEJPCB_OBJECT_END = 17
+};
+
+/**
+ * _lejp_callback() - User parser actions
+ * \param ctx: LEJP context
+ * \param reason: Callback reason
+ *
+ * Your user callback is associated with the context at construction time,
+ * and receives calls as the parsing progresses.
+ *
+ * All of the callbacks may be ignored and just return 0.
+ *
+ * The reasons it might get called, found in @reason, are:
+ *
+ * LEJPCB_CONSTRUCTED: The context was just constructed... you might want to
+ * perform one-time allocation for the life of the context.
+ *
+ * LEJPCB_DESTRUCTED: The context is being destructed... if you made any
+ * allocations at construction-time, you can free them now
+ *
+ * LEJPCB_START: Parsing is beginning at the first byte of input
+ *
+ * LEJPCB_COMPLETE: Parsing has completed successfully. You'll get a 0 or
+ * positive return code from lejp_parse indicating the
+ * amount of unused bytes left in the input buffer
+ *
+ * LEJPCB_FAILED: Parsing failed. You'll get a negative error code
+ * returned from lejp_parse
+ *
+ * LEJPCB_PAIR_NAME: When a "name":"value" pair has had the name parsed,
+ * this callback occurs. You can find the new name at
+ * the end of ctx->path[]
+ *
+ * LEJPCB_VAL_TRUE: The "true" value appeared
+ *
+ * LEJPCB_VAL_FALSE: The "false" value appeared
+ *
+ * LEJPCB_VAL_NULL: The "null" value appeared
+ *
+ * LEJPCB_VAL_NUM_INT: A string representing an integer is in ctx->buf
+ *
+ * LEJPCB_VAL_NUM_FLOAT: A string representing a float is in ctx->buf
+ *
+ * LEJPCB_VAL_STR_START: We are starting to parse a string, no data yet
+ *
+ * LEJPCB_VAL_STR_CHUNK: We parsed LEJP_STRING_CHUNK -1 bytes of string data in
+ * ctx->buf, which is as much as we can buffer, so we are
+ * spilling it. If all your strings are less than
+ * LEJP_STRING_CHUNK - 1 bytes, you will never see this
+ * callback.
+ *
+ * LEJPCB_VAL_STR_END: String parsing has completed, the last chunk of the
+ * string is in ctx->buf.
+ *
+ * LEJPCB_ARRAY_START: An array started
+ *
+ * LEJPCB_ARRAY_END: An array ended
+ *
+ * LEJPCB_OBJECT_START: An object started
+ *
+ * LEJPCB_OBJECT_END: An object ended
+ */
+LWS_EXTERN signed char _lejp_callback(struct lejp_ctx *ctx, char reason);
+
+typedef signed char (*lejp_callback)(struct lejp_ctx *ctx, char reason);
+
+#ifndef LEJP_MAX_DEPTH
+#define LEJP_MAX_DEPTH 12
+#endif
+#ifndef LEJP_MAX_INDEX_DEPTH
+#define LEJP_MAX_INDEX_DEPTH 5
+#endif
+#ifndef LEJP_MAX_PATH
+#define LEJP_MAX_PATH 128
+#endif
+#ifndef LEJP_STRING_CHUNK
+/* must be >= 30 to assemble floats */
+#define LEJP_STRING_CHUNK 255
+#endif
+
+enum num_flags {
+ LEJP_SEEN_MINUS = (1 << 0),
+ LEJP_SEEN_POINT = (1 << 1),
+ LEJP_SEEN_POST_POINT = (1 << 2),
+ LEJP_SEEN_EXP = (1 << 3)
+};
+
+struct _lejp_stack {
+ char s; /* lejp_state stack*/
+ char p; /* path length */
+ char i; /* index array length */
+ char b; /* user bitfield */
+};
+
+struct lejp_ctx {
+
+ /* sorted by type for most compact alignment
+ *
+ * pointers
+ */
+
+ signed char (*callback)(struct lejp_ctx *ctx, char reason);
+ void *user;
+ const char * const *paths;
+
+ /* arrays */
+
+ struct _lejp_stack st[LEJP_MAX_DEPTH];
+ uint16_t i[LEJP_MAX_INDEX_DEPTH]; /* index array */
+ uint16_t wild[LEJP_MAX_INDEX_DEPTH]; /* index array */
+ char path[LEJP_MAX_PATH];
+ char buf[LEJP_STRING_CHUNK];
+
+ /* int */
+
+ uint32_t line;
+
+ /* short */
+
+ uint16_t uni;
+
+ /* char */
+
+ uint8_t npos;
+ uint8_t dcount;
+ uint8_t f;
+ uint8_t sp; /* stack head */
+ uint8_t ipos; /* index stack depth */
+ uint8_t ppos;
+ uint8_t count_paths;
+ uint8_t path_match;
+ uint8_t path_match_len;
+ uint8_t wildcount;
+};
+
+LWS_VISIBLE LWS_EXTERN void
+lejp_construct(struct lejp_ctx *ctx,
+ signed char (*callback)(struct lejp_ctx *ctx, char reason),
+ void *user, const char * const *paths, unsigned char paths_count);
+
+LWS_VISIBLE LWS_EXTERN void
+lejp_destruct(struct lejp_ctx *ctx);
+
+LWS_VISIBLE LWS_EXTERN int
+lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len);
+
+LWS_VISIBLE LWS_EXTERN void
+lejp_change_callback(struct lejp_ctx *ctx,
+ signed char (*callback)(struct lejp_ctx *ctx, char reason));
+
+LWS_VISIBLE LWS_EXTERN int
+lejp_get_wildcard(struct lejp_ctx *ctx, int wildcard, char *dest, int len);
+//@}
+
/*
* Stats are all uint64_t numbers that start at 0.
* Index names here have the convention
@@ -5778,9 +7344,9 @@ LWS_VISIBLE LWS_EXTERN void
lws_stats_log_dump(struct lws_context *context);
#else
static LWS_INLINE uint64_t
-lws_stats_get(struct lws_context *context, int index) { return 0; }
+lws_stats_get(struct lws_context *context, int index) { (void)context; (void)index; return 0; }
static LWS_INLINE void
-lws_stats_log_dump(struct lws_context *context) { }
+lws_stats_log_dump(struct lws_context *context) { (void)context; }
#endif
#ifdef __cplusplus
diff --git a/thirdparty/lws/lws_config.h b/thirdparty/libwebsockets/lws_config.h
index 3a918747b1..7185a806a5 100644
--- a/thirdparty/lws/lws_config.h
+++ b/thirdparty/libwebsockets/lws_config.h
@@ -1,5 +1,10 @@
/* lws_config.h Generated from lws_config.h.in */
-#include "lws_config_private.h"
+
+/* GODOT ADDITION */
+#ifndef DEBUG_ENABLED
+#define LWS_WITH_NO_LOGS
+#endif
+/* END GODOT ADDITION */
#ifndef NDEBUG
#ifndef _DEBUG
@@ -9,6 +14,12 @@
#define LWS_INSTALL_DATADIR "/usr/local/share"
+#define LWS_ROLE_H1
+#define LWS_ROLE_WS
+#define LWS_ROLE_RAW
+/* #undef LWS_ROLE_H2 */
+/* #undef LWS_ROLE_CGI */
+
/* Define to 1 to use wolfSSL/CyaSSL as a replacement for OpenSSL.
* LWS_OPENSSL_SUPPORT needs to be set also for this to work. */
/* #undef USE_WOLFSSL */
@@ -20,59 +31,56 @@
#define LWS_WITH_MBEDTLS
/* #undef LWS_WITH_POLARSSL */
-/* #undef LWS_WITH_ESP8266 */
/* #undef LWS_WITH_ESP32 */
/* #undef LWS_WITH_PLUGINS */
/* #undef LWS_WITH_NO_LOGS */
-#ifndef DEBUG_ENABLED
-#define LWS_WITH_NO_LOGS
-#endif
/* The Libwebsocket version */
-#define LWS_LIBRARY_VERSION "2.4.1"
+#define LWS_LIBRARY_VERSION "3.0.0"
-#define LWS_LIBRARY_VERSION_MAJOR 2
-#define LWS_LIBRARY_VERSION_MINOR 4
-#define LWS_LIBRARY_VERSION_PATCH 1
+#define LWS_LIBRARY_VERSION_MAJOR 3
+#define LWS_LIBRARY_VERSION_MINOR 0
+#define LWS_LIBRARY_VERSION_PATCH 0
/* LWS_LIBRARY_VERSION_NUMBER looks like 1005001 for e.g. version 1.5.1 */
#define LWS_LIBRARY_VERSION_NUMBER (LWS_LIBRARY_VERSION_MAJOR*1000000)+(LWS_LIBRARY_VERSION_MINOR*1000)+LWS_LIBRARY_VERSION_PATCH
/* The current git commit hash that we're building from */
-#define LWS_BUILD_HASH "55f97b7806e07db2d4c8a158172cd309d0faf450"
+#define LWS_BUILD_HASH "v2.0.0-948-geaa935a8"
-/* Build with OpenSSL support */
+/* Build with OpenSSL support ... alias of LWS_WITH_TLS for compatibility*/
#define LWS_OPENSSL_SUPPORT
+#define LWS_WITH_TLS
/* The client should load and trust CA root certs it finds in the OS */
-#define LWS_SSL_CLIENT_USE_OS_CA_CERTS
+/* #undef LWS_SSL_CLIENT_USE_OS_CA_CERTS */
/* Sets the path where the client certs should be installed. */
-#define LWS_OPENSSL_CLIENT_CERTS "../share"
+/* #undef LWS_OPENSSL_CLIENT_CERTS "../share" */
/* Turn off websocket extensions */
-/* #undef LWS_NO_EXTENSIONS */
+#define LWS_WITHOUT_EXTENSIONS
+
+/* notice if client or server gone */
+/* #undef LWS_WITHOUT_SERVER */
+/* #undef LWS_WITHOUT_CLIENT */
+
+#define LWS_WITH_POLL
/* Enable libev io loop */
/* #undef LWS_WITH_LIBEV */
-#undef LWS_WITH_LIBEV
/* Enable libuv io loop */
/* #undef LWS_WITH_LIBUV */
-#undef LWS_WITH_LIBUV
/* Enable libevent io loop */
/* #undef LWS_WITH_LIBEVENT */
-#undef LWS_WITH_LIBEVENT
/* Build with support for ipv6 */
/* #undef LWS_WITH_IPV6 */
/* Build with support for UNIX domain socket */
/* #undef LWS_WITH_UNIX_SOCK */
-#ifdef WINDOWS_ENABLED
-#undef LWS_USE_UNIX_SOCK
-#endif
/* Build with support for HTTP2 */
/* #undef LWS_WITH_HTTP2 */
@@ -100,23 +108,26 @@
/* SSL server using ECDH certificate */
/* #undef LWS_SSL_SERVER_WITH_ECDH_CERT */
-#define LWS_HAVE_SSL_CTX_set1_param
+/* #undef LWS_HAVE_SSL_CTX_set1_param */
#define LWS_HAVE_X509_VERIFY_PARAM_set1_host
/* #undef LWS_HAVE_RSA_SET0_KEY */
+/* #undef LWS_HAVE_X509_get_key_usage */
+/* #undef LWS_HAVE_SSL_CTX_get0_certificate */
/* #undef LWS_HAVE_UV_VERSION_H */
+/* #undef LWS_HAVE_PTHREAD_H */
/* CGI apis */
/* #undef LWS_WITH_CGI */
/* whether the Openssl is recent enough, and / or built with, ecdh */
-#define LWS_HAVE_OPENSSL_ECDH_H
+/* #undef LWS_HAVE_OPENSSL_ECDH_H */
/* HTTP Proxy support */
/* #undef LWS_WITH_HTTP_PROXY */
/* HTTP Ranges support */
-#define LWS_WITH_RANGES
+/* #undef LWS_WITH_RANGES */
/* Http access log support */
/* #undef LWS_WITH_ACCESS_LOG */
@@ -138,7 +149,7 @@
/* #undef LWS_PLAT_OPTEE */
/* ZIP FOPS */
-#define LWS_WITH_ZIP_FOPS
+/* #undef LWS_WITH_ZIP_FOPS */
#define LWS_HAVE_STDINT_H
/* #undef LWS_AVOID_SIGPIPE_IGN */
@@ -155,11 +166,26 @@
/* #undef LWS_HAVE__ATOI64 */
/* #undef LWS_HAVE__STAT32I64 */
+/* #undef LWS_WITH_JWS */
+/* #undef LWS_WITH_ACME */
+/* #undef LWS_WITH_SELFTESTS */
+
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#define LWS_HAVE_MALLOC_H
+#endif
+
+#if !defined(IPHONE_ENABLED) && !defined(OSX_ENABLED)
+#define LWS_HAVE_PIPE2
+#endif
+
/* OpenSSL various APIs */
-/* #undef LWS_HAVE_TLS_CLIENT_METHOD */
-#define LWS_HAVE_TLSV1_2_CLIENT_METHOD
-#define LWS_HAVE_SSL_SET_INFO_CALLBACK
+#define LWS_HAVE_TLS_CLIENT_METHOD
+/* #undef LWS_HAVE_TLSV1_2_CLIENT_METHOD */
+/* #undef LWS_HAVE_SSL_SET_INFO_CALLBACK */
+/* #undef LWS_HAVE_SSL_EXTRA_CHAIN_CERTS */
+/* #undef LWS_HAVE_SSL_get0_alpn_selected */
+/* #undef LWS_HAVE_SSL_set_alpn_protos */
#define LWS_HAS_INTPTR_T
diff --git a/thirdparty/lws/lws_config_private.h b/thirdparty/libwebsockets/lws_config_private.h
index 475d1bd3f8..9d04078fef 100644
--- a/thirdparty/lws/lws_config_private.h
+++ b/thirdparty/libwebsockets/lws_config_private.h
@@ -100,6 +100,8 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define LWS_HAVE_UNISTD_H
+#define LWS_HAVE_TCP_USER_TIMEOUT
+
/* Define to 1 if you have the `vfork' function. */
#define LWS_HAVE_VFORK
diff --git a/thirdparty/lws/misc/base64-decode.c b/thirdparty/libwebsockets/misc/base64-decode.c
index c8f11d21b8..64b84d78fa 100644
--- a/thirdparty/lws/misc/base64-decode.c
+++ b/thirdparty/libwebsockets/misc/base64-decode.c
@@ -40,15 +40,18 @@
#include <stdio.h>
#include <string.h>
-#include "private-libwebsockets.h"
+#include "core/private.h"
-static const char encode[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+static const char encode_orig[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char encode_url[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz0123456789-_";
static const char decode[] = "|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW"
"$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
-LWS_VISIBLE int
-lws_b64_encode_string(const char *in, int in_len, char *out, int out_size)
+static int
+_lws_b64_encode_string(const char *encode, const char *in, int in_len,
+ char *out, int out_size)
{
unsigned char triple[3];
int i;
@@ -89,26 +92,47 @@ lws_b64_encode_string(const char *in, int in_len, char *out, int out_size)
return done;
}
+LWS_VISIBLE int
+lws_b64_encode_string(const char *in, int in_len, char *out, int out_size)
+{
+ return _lws_b64_encode_string(encode_orig, in, in_len, out, out_size);
+}
+
+LWS_VISIBLE int
+lws_b64_encode_string_url(const char *in, int in_len, char *out, int out_size)
+{
+ return _lws_b64_encode_string(encode_url, in, in_len, out, out_size);
+}
+
/*
* returns length of decoded string in out, or -1 if out was too small
* according to out_size
+ *
+ * Only reads up to in_len chars, otherwise if in_len is -1 on entry reads until
+ * the first NUL in the input.
*/
-LWS_VISIBLE int
-lws_b64_decode_string(const char *in, char *out, int out_size)
+static int
+_lws_b64_decode_string(const char *in, int in_len, char *out, int out_size)
{
int len, i, c = 0, done = 0;
unsigned char v, quad[4];
- while (*in) {
+ while (in_len && *in) {
len = 0;
- for (i = 0; i < 4 && *in; i++) {
+ for (i = 0; i < 4 && in_len && *in; i++) {
v = 0;
c = 0;
- while (*in && !v) {
+ while (in_len && *in && !v) {
c = v = *in++;
+ in_len--;
+ /* support the url base64 variant too */
+ if (v == '-')
+ c = v = '+';
+ if (v == '_')
+ c = v = '/';
v = (v < 43 || v > 122) ? 0 : decode[v - 43];
if (v)
v = (v == '$') ? 0 : v - 61;
@@ -131,7 +155,7 @@ lws_b64_decode_string(const char *in, char *out, int out_size)
* bytes." (wikipedia)
*/
- if (!*in && c == '=')
+ if ((!in_len || !*in) && c == '=')
len--;
if (len >= 2)
@@ -152,6 +176,18 @@ lws_b64_decode_string(const char *in, char *out, int out_size)
return done;
}
+LWS_VISIBLE int
+lws_b64_decode_string(const char *in, char *out, int out_size)
+{
+ return _lws_b64_decode_string(in, -1, out, out_size);
+}
+
+LWS_VISIBLE int
+lws_b64_decode_string_len(const char *in, int in_len, char *out, int out_size)
+{
+ return _lws_b64_decode_string(in, in_len, out, out_size);
+}
+
#if 0
int
lws_b64_selftest(void)
diff --git a/thirdparty/lws/misc/getifaddrs.c b/thirdparty/libwebsockets/misc/getifaddrs.c
index 4f42ab4595..735b899f48 100644
--- a/thirdparty/lws/misc/getifaddrs.c
+++ b/thirdparty/libwebsockets/misc/getifaddrs.c
@@ -43,7 +43,7 @@
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
-#include "private-libwebsockets.h"
+#include "core/private.h"
#ifdef LWS_HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
diff --git a/thirdparty/lws/misc/getifaddrs.h b/thirdparty/libwebsockets/misc/getifaddrs.h
index d26670c082..d26670c082 100644
--- a/thirdparty/lws/misc/getifaddrs.h
+++ b/thirdparty/libwebsockets/misc/getifaddrs.h
diff --git a/thirdparty/lws/misc/lejp.c b/thirdparty/libwebsockets/misc/lejp.c
index 5407c90f97..00d350f81e 100644
--- a/thirdparty/lws/misc/lejp.c
+++ b/thirdparty/libwebsockets/misc/lejp.c
@@ -1,14 +1,26 @@
/*
* Lightweight Embedded JSON Parser
*
- * Copyright (C) 2013 Andy Green <andy@warmcat.com>
- * This code is licensed under LGPL 2.1
- * http://www.gnu.org/licenses/lgpl-2.1.html
+ * Copyright (C) 2013-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
*/
+#include <libwebsockets.h>
#include <string.h>
-#include "lejp.h"
-
#include <stdio.h>
/**
@@ -148,7 +160,8 @@ lejp_get_wildcard(struct lejp_ctx *ctx, int wildcard, char *dest, int len)
n = ctx->wild[wildcard];
- while (--len && n < ctx->ppos && (n == ctx->wild[wildcard] || ctx->path[n] != '.'))
+ while (--len && n < ctx->ppos &&
+ (n == ctx->wild[wildcard] || ctx->path[n] != '.'))
*dest++ = ctx->path[n++];
*dest = '\0';
@@ -186,7 +199,6 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
while (len--) {
c = *json++;
-
s = ctx->st[ctx->sp].s;
/* skip whitespace unless we should care */
@@ -411,6 +423,26 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
}
goto add_stack_level;
+ case ']':
+ /* pop */
+ ctx->sp--;
+ if (ctx->st[ctx->sp].s != LEJP_MP_ARRAY_END) {
+ ret = LEJP_REJECT_MP_C_OR_E_NOTARRAY;
+ goto reject;
+ }
+ /* drop the path [n] bit */
+ ctx->ppos = ctx->st[ctx->sp - 1].p;
+ ctx->ipos = ctx->st[ctx->sp - 1].i;
+ ctx->path[ctx->ppos] = '\0';
+ if (ctx->path_match &&
+ ctx->ppos <= ctx->path_match_len)
+ /*
+ * we shrank the path to be
+ * smaller than the matching point
+ */
+ ctx->path_match = 0;
+ goto array_end;
+
case 't': /* true */
ctx->uni = 0;
ctx->st[ctx->sp].s = LEJP_MP_VALUE_TOK;
@@ -444,7 +476,7 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
goto append_npos;
}
if (c == '.') {
- if (ctx->dcount || (ctx->f & LEJP_SEEN_POINT)) {
+ if (!ctx->dcount || (ctx->f & LEJP_SEEN_POINT)) {
ret = LEJP_REJECT_MP_VAL_NUM_FORMAT;
goto reject;
}
@@ -582,8 +614,10 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
goto reject;
}
/* drop the path [n] bit */
- ctx->ppos = ctx->st[ctx->sp - 1].p;
- ctx->ipos = ctx->st[ctx->sp - 1].i;
+ if (ctx->sp) {
+ ctx->ppos = ctx->st[ctx->sp - 1].p;
+ ctx->ipos = ctx->st[ctx->sp - 1].i;
+ }
ctx->path[ctx->ppos] = '\0';
if (ctx->path_match &&
ctx->ppos <= ctx->path_match_len)
@@ -609,8 +643,10 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
}
/* pop */
ctx->sp--;
- ctx->ppos = ctx->st[ctx->sp - 1].p;
- ctx->ipos = ctx->st[ctx->sp - 1].i;
+ if (ctx->sp) {
+ ctx->ppos = ctx->st[ctx->sp - 1].p;
+ ctx->ipos = ctx->st[ctx->sp - 1].i;
+ }
ctx->path[ctx->ppos] = '\0';
if (ctx->path_match &&
ctx->ppos <= ctx->path_match_len)
@@ -631,6 +667,7 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
goto reject;
case LEJP_MP_ARRAY_END:
+array_end:
ctx->path[ctx->ppos] = '\0';
if (c == ',') {
/* increment this stack level's index */
diff --git a/thirdparty/lws/misc/sha-1.c b/thirdparty/libwebsockets/misc/sha-1.c
index 9353fbefe4..2e4db52693 100644
--- a/thirdparty/lws/misc/sha-1.c
+++ b/thirdparty/libwebsockets/misc/sha-1.c
@@ -32,7 +32,7 @@
* implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
#ifdef LWS_HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -45,7 +45,7 @@ struct sha1_ctxt {
} h;
union {
unsigned char b8[8];
- u_int64_t b64[1];
+ uint64_t b64[1];
} c;
union {
unsigned char b8[64];
diff --git a/thirdparty/lws/plat/lws-plat-unix.c b/thirdparty/libwebsockets/plat/lws-plat-unix.c
index a51e67bb81..bacc6af647 100644
--- a/thirdparty/lws/plat/lws-plat-unix.c
+++ b/thirdparty/libwebsockets/plat/lws-plat-unix.c
@@ -19,7 +19,8 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#define _GNU_SOURCE
+#include "core/private.h"
#include <pwd.h>
#include <grp.h>
@@ -29,6 +30,56 @@
#endif
#include <dirent.h>
+int
+lws_plat_socket_offset(void)
+{
+ return 0;
+}
+
+int
+lws_plat_pipe_create(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+#if defined(LWS_HAVE_PIPE2)
+ return pipe2(pt->dummy_pipe_fds, O_NONBLOCK);
+#else
+ return pipe(pt->dummy_pipe_fds);
+#endif
+}
+
+int
+lws_plat_pipe_signal(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ char buf = 0;
+ int n;
+
+ n = write(pt->dummy_pipe_fds[1], &buf, 1);
+
+ return n != 1;
+}
+
+void
+lws_plat_pipe_close(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ if (pt->dummy_pipe_fds[0] && pt->dummy_pipe_fds[0] != -1)
+ close(pt->dummy_pipe_fds[0]);
+ if (pt->dummy_pipe_fds[1] && pt->dummy_pipe_fds[1] != -1)
+ close(pt->dummy_pipe_fds[1]);
+
+ pt->dummy_pipe_fds[0] = pt->dummy_pipe_fds[1] = -1;
+}
+
+#ifdef __QNX__
+# include "netinet/tcp_var.h"
+# define TCP_KEEPINTVL TCPCTL_KEEPINTVL
+# define TCP_KEEPIDLE TCPCTL_KEEPIDLE
+# define TCP_KEEPCNT TCPCTL_KEEPCNT
+#endif
+
unsigned long long time_in_microseconds(void)
{
struct timeval tv;
@@ -52,6 +103,10 @@ lws_send_pipe_choked(struct lws *wsi)
#if defined(LWS_WITH_HTTP2)
wsi_eff = lws_get_network_wsi(wsi);
#endif
+
+ /* the fact we checked implies we avoided back-to-back writes */
+ wsi_eff->could_have_pending = 0;
+
/* treat the fact we got a truncated send pending as if we're choked */
if (wsi_eff->trunc_len)
return 1;
@@ -77,29 +132,6 @@ lws_poll_listen_fd(struct lws_pollfd *fd)
return poll(fd, 1, 0);
}
-LWS_VISIBLE void
-lws_cancel_service_pt(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- char buf = 0;
-
- if (write(pt->dummy_pipe_fds[1], &buf, sizeof(buf)) != 1)
- lwsl_err("Cannot write to dummy pipe");
-}
-
-LWS_VISIBLE void
-lws_cancel_service(struct lws_context *context)
-{
- struct lws_context_per_thread *pt = &context->pt[0];
- char buf = 0, m = context->count_threads;
-
- while (m--) {
- if (write(pt->dummy_pipe_fds[1], &buf, sizeof(buf)) != 1)
- lwsl_err("Cannot write to dummy pipe");
- pt++;
- }
-}
-
LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
{
int syslog_level = LOG_DEBUG;
@@ -124,9 +156,10 @@ LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
LWS_VISIBLE LWS_EXTERN int
_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
{
+ volatile struct lws_foreign_thread_pollfd *ftp, *next;
+ volatile struct lws_context_per_thread *vpt;
struct lws_context_per_thread *pt;
int n = -1, m, c;
- char buf;
/* stay dead once we are dead */
@@ -134,15 +167,15 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
return 1;
pt = &context->pt[tsi];
+ vpt = (volatile struct lws_context_per_thread *)pt;
lws_stats_atomic_bump(context, pt, LWSSTATS_C_SERVICE_ENTRY, 1);
if (timeout_ms < 0)
goto faked_service;
- lws_libev_run(context, tsi);
- lws_libuv_run(context, tsi);
- lws_libevent_run(context, tsi);
+ if (context->event_loop_ops->run_pt)
+ context->event_loop_ops->run_pt(context, tsi);
if (!context->service_tid_detected) {
struct lws _lws;
@@ -169,15 +202,73 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
timeout_ms = 0;
}
+ if (timeout_ms) {
+ lws_pt_lock(pt, __func__);
+ /* don't stay in poll wait longer than next hr timeout */
+ lws_usec_t t = __lws_hrtimer_service(pt);
+ if ((lws_usec_t)timeout_ms * 1000 > t)
+ timeout_ms = t / 1000;
+ lws_pt_unlock(pt);
+ }
+
+ vpt->inside_poll = 1;
+ lws_memory_barrier();
n = poll(pt->fds, pt->fds_count, timeout_ms);
+ vpt->inside_poll = 0;
+ lws_memory_barrier();
-#ifdef LWS_OPENSSL_SUPPORT
- if (!n && !pt->rx_draining_ext_list &&
- !lws_ssl_anybody_has_buffered_read_tsi(context, tsi)) {
-#else
- if (!pt->rx_draining_ext_list && !n) /* poll timeout */ {
+ /* Collision will be rare and brief. Just spin until it completes */
+ while (vpt->foreign_spinlock)
+ ;
+
+ /*
+ * At this point we are not inside a foreign thread pollfd change,
+ * and we have marked ourselves as outside the poll() wait. So we
+ * are the only guys that can modify the lws_foreign_thread_pollfd
+ * list on the pt. Drain the list and apply the changes to the
+ * affected pollfds in the correct order.
+ */
+
+ lws_pt_lock(pt, __func__);
+
+ ftp = vpt->foreign_pfd_list;
+ //lwsl_notice("cleared list %p\n", ftp);
+ while (ftp) {
+ struct lws *wsi;
+ struct lws_pollfd *pfd;
+
+ next = ftp->next;
+ pfd = &vpt->fds[ftp->fd_index];
+ if (lws_socket_is_valid(pfd->fd)) {
+ wsi = wsi_from_fd(context, pfd->fd);
+ if (wsi)
+ __lws_change_pollfd(wsi, ftp->_and, ftp->_or);
+ }
+ lws_free((void *)ftp);
+ ftp = next;
+ }
+ vpt->foreign_pfd_list = NULL;
+ lws_memory_barrier();
+
+ /* we have come out of a poll wait... check the hrtimer list */
+
+ __lws_hrtimer_service(pt);
+
+ lws_pt_unlock(pt);
+
+ m = 0;
+#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)
+ m |= !!pt->ws.rx_draining_ext_list;
#endif
+
+ if (pt->context->tls_ops &&
+ pt->context->tls_ops->fake_POLLIN_for_buffered)
+ m |= pt->context->tls_ops->fake_POLLIN_for_buffered(pt);
+
+ if (!m && !n) { /* nothing to do */
lws_service_fd_tsi(context, NULL, tsi);
+ lws_service_do_ripe_rxflow(pt);
+
return 0;
}
@@ -194,18 +285,12 @@ faked_service:
c = n;
/* any socket with events to service? */
- for (n = 0; n < pt->fds_count && c; n++) {
+ for (n = 0; n < (int)pt->fds_count && c; n++) {
if (!pt->fds[n].revents)
continue;
c--;
- if (pt->fds[n].fd == pt->dummy_pipe_fds[0]) {
- if (read(pt->fds[n].fd, &buf, 1) != 1)
- lwsl_err("Cannot read from dummy pipe.");
- continue;
- }
-
m = lws_service_fd_tsi(context, &pt->fds[n], tsi);
if (m < 0)
return -1;
@@ -214,6 +299,8 @@ faked_service:
n--;
}
+ lws_service_do_ripe_rxflow(pt);
+
return 0;
}
@@ -262,6 +349,14 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
*/
#else
/* set the keepalive conditions we want on it too */
+
+#if defined(LWS_HAVE_TCP_USER_TIMEOUT)
+ optval = 1000 * (vhost->ka_time +
+ (vhost->ka_interval * vhost->ka_probes));
+ if (setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT,
+ (const void *)&optval, optlen) < 0)
+ return 1;
+#endif
optval = vhost->ka_time;
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
(const void *)&optval, optlen) < 0)
@@ -292,7 +387,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
/* Disable Nagle */
optval = 1;
-#if defined (__sun)
+#if defined (__sun) || defined(__QNX__)
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
return 1;
#elif !defined(__APPLE__) && \
@@ -317,7 +412,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
static void
-_lws_plat_apply_caps(int mode, cap_value_t *cv, int count)
+_lws_plat_apply_caps(int mode, const cap_value_t *cv, int count)
{
cap_t caps;
@@ -334,7 +429,7 @@ _lws_plat_apply_caps(int mode, cap_value_t *cv, int count)
#endif
LWS_VISIBLE void
-lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
+lws_plat_drop_app_privileges(const struct lws_context_creation_info *info)
{
#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
int n;
@@ -449,8 +544,8 @@ lws_plat_plugins_init(struct lws_context * context, const char * const *d)
}
plugin->list = context->plugin_list;
context->plugin_list = plugin;
- strncpy(plugin->name, namelist[i]->d_name, sizeof(plugin->name) - 1);
- plugin->name[sizeof(plugin->name) - 1] = '\0';
+ lws_strncpy(plugin->name, namelist[i]->d_name,
+ sizeof(plugin->name));
plugin->l = l;
plugin->caps = lcaps;
context->plugin_protocol_count += lcaps.count_protocols;
@@ -543,9 +638,6 @@ lws_plat_context_early_destroy(struct lws_context *context)
LWS_VISIBLE void
lws_plat_context_late_destroy(struct lws_context *context)
{
- struct lws_context_per_thread *pt = &context->pt[0];
- int m = context->count_threads;
-
#ifdef LWS_WITH_PLUGINS
if (context->plugin_list)
lws_plat_plugins_destroy(context);
@@ -554,13 +646,6 @@ lws_plat_context_late_destroy(struct lws_context *context)
if (context->lws_lookup)
lws_free(context->lws_lookup);
- while (m--) {
- if (pt->dummy_pipe_fds[0])
- close(pt->dummy_pipe_fds[0]);
- if (pt->dummy_pipe_fds[1])
- close(pt->dummy_pipe_fds[1]);
- pt++;
- }
if (!context->fd_random)
lwsl_err("ZERO RANDOM FD\n");
if (context->fd_random != LWS_INVALID_FILE)
@@ -573,7 +658,7 @@ LWS_VISIBLE int
lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
size_t addrlen)
{
- int rc = -1;
+ int rc = LWS_ITOSA_NOT_EXIST;
struct ifaddrs *ifr;
struct ifaddrs *ifc;
@@ -586,12 +671,19 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
if (!ifc->ifa_addr)
continue;
- lwsl_info(" interface %s vs %s\n", ifc->ifa_name, ifname);
+ lwsl_debug(" interface %s vs %s (fam %d) ipv6 %d\n", ifc->ifa_name, ifname, ifc->ifa_addr->sa_family, ipv6);
if (strcmp(ifc->ifa_name, ifname))
continue;
switch (ifc->ifa_addr->sa_family) {
+#if defined(AF_PACKET)
+ case AF_PACKET:
+ /* interface exists but is not usable */
+ rc = LWS_ITOSA_NOT_USABLE;
+ continue;
+#endif
+
case AF_INET:
#ifdef LWS_WITH_IPV6
if (ipv6) {
@@ -619,20 +711,20 @@ lws_interface_to_sa(int ipv6, const char *ifname, struct sockaddr_in *addr,
default:
continue;
}
- rc = 0;
+ rc = LWS_ITOSA_USABLE;
}
freeifaddrs(ifr);
- if (rc == -1) {
+ if (rc) {
/* check if bind to IP address */
#ifdef LWS_WITH_IPV6
if (inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1)
- rc = 0;
+ rc = LWS_ITOSA_USABLE;
else
#endif
if (inet_pton(AF_INET, ifname, &addr->sin_addr) == 1)
- rc = 0;
+ rc = LWS_ITOSA_USABLE;
}
return rc;
@@ -643,9 +735,8 @@ lws_plat_insert_socket_into_fds(struct lws_context *context, struct lws *wsi)
{
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- lws_libev_io(wsi, LWS_EV_START | LWS_EV_READ);
- lws_libuv_io(wsi, LWS_EV_START | LWS_EV_READ);
- lws_libevent_io(wsi, LWS_EV_START | LWS_EV_READ);
+ if (context->event_loop_ops->io)
+ context->event_loop_ops->io(wsi, LWS_EV_START | LWS_EV_READ);
pt->fds[pt->fds_count++].revents = 0;
}
@@ -656,9 +747,9 @@ lws_plat_delete_socket_from_fds(struct lws_context *context,
{
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- lws_libev_io(wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
- lws_libuv_io(wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
- lws_libevent_io(wsi, LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
+ if (context->event_loop_ops->io)
+ context->event_loop_ops->io(wsi,
+ LWS_EV_STOP | LWS_EV_READ | LWS_EV_WRITE);
pt->fds_count--;
}
@@ -739,7 +830,8 @@ _lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset)
{
lws_fileofs_t r;
- if (offset > 0 && offset > fop_fd->len - fop_fd->pos)
+ if (offset > 0 &&
+ offset > (lws_fileofs_t)fop_fd->len - (lws_fileofs_t)fop_fd->pos)
offset = fop_fd->len - fop_fd->pos;
if ((lws_fileofs_t)fop_fd->pos + offset < 0)
@@ -793,13 +885,11 @@ _lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
return 0;
}
-
LWS_VISIBLE int
lws_plat_init(struct lws_context *context,
- struct lws_context_creation_info *info)
+ const struct lws_context_creation_info *info)
{
- struct lws_context_per_thread *pt = &context->pt[0];
- int n = context->count_threads, fd;
+ int fd;
/* master context has the global fd lookup array */
context->lws_lookup = lws_zalloc(sizeof(struct lws *) *
@@ -821,26 +911,6 @@ lws_plat_init(struct lws_context *context,
return 1;
}
- if (!lws_libev_init_fd_table(context) &&
- !lws_libuv_init_fd_table(context) &&
- !lws_libevent_init_fd_table(context)) {
- /* otherwise libev/uv/event handled it instead */
-
- while (n--) {
- if (pipe(pt->dummy_pipe_fds)) {
- lwsl_err("Unable to create pipe\n");
- return 1;
- }
-
- /* use the read end of pipe as first item */
- pt->fds[0].fd = pt->dummy_pipe_fds[0];
- pt->fds[0].events = LWS_POLLIN;
- pt->fds[0].revents = 0;
- pt->fds_count = 1;
- pt++;
- }
- }
-
#ifdef LWS_WITH_PLUGINS
if (info->plugin_dirs)
lws_plat_plugins_init(context, info->plugin_dirs);
@@ -848,3 +918,52 @@ lws_plat_init(struct lws_context *context,
return 0;
}
+
+LWS_VISIBLE int
+lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
+ int len)
+{
+ int n;
+
+ n = write(fd, buf, len);
+
+ fsync(fd);
+ lseek(fd, 0, SEEK_SET);
+
+ return n != len;
+}
+
+LWS_VISIBLE int
+lws_plat_write_file(const char *filename, void *buf, int len)
+{
+ int m, fd;
+
+ fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+ if (fd == -1)
+ return 1;
+
+ m = write(fd, buf, len);
+ close(fd);
+
+ return m != len;
+}
+
+LWS_VISIBLE int
+lws_plat_read_file(const char *filename, void *buf, int len)
+{
+ int n, fd = open(filename, O_RDONLY);
+ if (fd == -1)
+ return -1;
+
+ n = read(fd, buf, len);
+ close(fd);
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_plat_recommended_rsa_bits(void)
+{
+ return 4096;
+}
diff --git a/thirdparty/lws/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
index f5b178ce85..948db62896 100644
--- a/thirdparty/lws/plat/lws-plat-win.c
+++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
@@ -1,7 +1,34 @@
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#endif
-#include "private-libwebsockets.h"
+#include "core/private.h"
+
+int
+lws_plat_socket_offset(void)
+{
+ return 0;
+}
+
+int
+lws_plat_pipe_create(struct lws *wsi)
+{
+ return 1;
+}
+
+int
+lws_plat_pipe_signal(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ WSASetEvent(pt->events[0]); /* trigger the cancel event */
+
+ return 0;
+}
+
+void
+lws_plat_pipe_close(struct lws *wsi)
+{
+}
unsigned long long
time_in_microseconds()
@@ -19,9 +46,10 @@ time_in_microseconds()
#endif
/*
- * As per Windows documentation for FILETIME, copy the resulting FILETIME structure to a
- * ULARGE_INTEGER structure using memcpy (using memcpy instead of direct assignment can
- * prevent alignment faults on 64-bit Windows).
+ * As per Windows documentation for FILETIME, copy the resulting
+ * FILETIME structure to a ULARGE_INTEGER structure using memcpy
+ * (using memcpy instead of direct assignment can prevent alignment
+ * faults on 64-bit Windows).
*/
memcpy(&datetime, &filetime, sizeof(datetime));
@@ -81,7 +109,7 @@ delete_from_fd(struct lws_context *context, lws_sockfd_type fd)
if (context->fd_hashtable[h].wsi[n]->desc.sockfd == fd) {
while (n < context->fd_hashtable[h].length) {
context->fd_hashtable[h].wsi[n] =
- context->fd_hashtable[h].wsi[n + 1];
+ context->fd_hashtable[h].wsi[n + 1];
n++;
}
context->fd_hashtable[h].length--;
@@ -94,8 +122,8 @@ delete_from_fd(struct lws_context *context, lws_sockfd_type fd)
return 1;
}
-LWS_VISIBLE int lws_get_random(struct lws_context *context,
- void *buf, int len)
+LWS_VISIBLE int
+lws_get_random(struct lws_context *context, void *buf, int len)
{
int n;
char *p = (char *)buf;
@@ -106,16 +134,25 @@ LWS_VISIBLE int lws_get_random(struct lws_context *context,
return n;
}
-LWS_VISIBLE int lws_send_pipe_choked(struct lws *wsi)
-{
+LWS_VISIBLE int
+lws_send_pipe_choked(struct lws *wsi)
+{ struct lws *wsi_eff = wsi;
+
+#if defined(LWS_WITH_HTTP2)
+ wsi_eff = lws_get_network_wsi(wsi);
+#endif
+ /* the fact we checked implies we avoided back-to-back writes */
+ wsi_eff->could_have_pending = 0;
+
/* treat the fact we got a truncated send pending as if we're choked */
- if (wsi->trunc_len)
+ if (wsi_eff->trunc_len)
return 1;
- return (int)wsi->sock_send_blocking;
+ return (int)wsi_eff->sock_send_blocking;
}
-LWS_VISIBLE int lws_poll_listen_fd(struct lws_pollfd *fd)
+LWS_VISIBLE int
+lws_poll_listen_fd(struct lws_pollfd *fd)
{
fd_set readfds;
struct timeval tv = { 0, 0 };
@@ -125,29 +162,11 @@ LWS_VISIBLE int lws_poll_listen_fd(struct lws_pollfd *fd)
FD_ZERO(&readfds);
FD_SET(fd->fd, &readfds);
- return select(fd->fd + 1, &readfds, NULL, NULL, &tv);
+ return select(((int)fd->fd) + 1, &readfds, NULL, NULL, &tv);
}
LWS_VISIBLE void
-lws_cancel_service(struct lws_context *context)
-{
- struct lws_context_per_thread *pt = &context->pt[0];
- int n = context->count_threads;
-
- while (n--) {
- WSASetEvent(pt->events[0]);
- pt++;
- }
-}
-
-LWS_VISIBLE void
-lws_cancel_service_pt(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- WSASetEvent(pt->events[0]);
-}
-
-LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
+lwsl_emit_syslog(int level, const char *line)
{
lwsl_emit_stderr(level, line);
}
@@ -182,9 +201,8 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
context->service_tid_detected = 1;
}
- if (timeout_ms < 0)
- {
- if (lws_service_flag_pending(context, tsi)) {
+ if (timeout_ms < 0) {
+ if (lws_service_flag_pending(context, tsi)) {
/* any socket with events to service? */
for (n = 0; n < (int)pt->fds_count; n++) {
if (!pt->fds[n].revents)
@@ -201,6 +219,9 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
return 0;
}
+ if (context->event_loop_ops->run_pt)
+ context->event_loop_ops->run_pt(context, tsi);
+
for (i = 0; i < pt->fds_count; ++i) {
pfd = &pt->fds[i];
@@ -220,6 +241,9 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
if (n)
i--;
+ /*
+ * any wsi has truncated, force him signalled
+ */
if (wsi->trunc_len)
WSASetEvent(pt->events[0]);
}
@@ -236,29 +260,44 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
timeout_ms = 0;
}
- ev = WSAWaitForMultipleEvents( 1, pt->events , FALSE, timeout_ms, FALSE);
+ if (timeout_ms) {
+ lws_pt_lock(pt, __func__);
+ /* don't stay in poll wait longer than next hr timeout */
+ lws_usec_t t = __lws_hrtimer_service(pt);
+
+ if ((lws_usec_t)timeout_ms * 1000 > t)
+ timeout_ms = (int)(t / 1000);
+ lws_pt_unlock(pt);
+ }
+
+ ev = WSAWaitForMultipleEvents(1, pt->events, FALSE, timeout_ms, FALSE);
if (ev == WSA_WAIT_EVENT_0) {
- unsigned int eIdx;
+ unsigned int eIdx, err;
WSAResetEvent(pt->events[0]);
+ if (pt->context->tls_ops &&
+ pt->context->tls_ops->fake_POLLIN_for_buffered)
+ pt->context->tls_ops->fake_POLLIN_for_buffered(pt);
+
for (eIdx = 0; eIdx < pt->fds_count; ++eIdx) {
- if (WSAEnumNetworkEvents(pt->fds[eIdx].fd, 0, &networkevents) == SOCKET_ERROR) {
- lwsl_err("WSAEnumNetworkEvents() failed with error %d\n", LWS_ERRNO);
+ if (WSAEnumNetworkEvents(pt->fds[eIdx].fd, 0,
+ &networkevents) == SOCKET_ERROR) {
+ lwsl_err("WSAEnumNetworkEvents() failed "
+ "with error %d\n", LWS_ERRNO);
return -1;
}
pfd = &pt->fds[eIdx];
pfd->revents = (short)networkevents.lNetworkEvents;
+ err = networkevents.iErrorCode[FD_CONNECT_BIT];
+
if ((networkevents.lNetworkEvents & FD_CONNECT) &&
- networkevents.iErrorCode[FD_CONNECT_BIT] &&
- networkevents.iErrorCode[FD_CONNECT_BIT] != LWS_EALREADY &&
- networkevents.iErrorCode[FD_CONNECT_BIT] != LWS_EINPROGRESS &&
- networkevents.iErrorCode[FD_CONNECT_BIT] != LWS_EWOULDBLOCK &&
- networkevents.iErrorCode[FD_CONNECT_BIT] != WSAEINVAL) {
- lwsl_debug("Unable to connect errno=%d\n",
- networkevents.iErrorCode[FD_CONNECT_BIT]);
+ err && err != LWS_EALREADY &&
+ err != LWS_EINPROGRESS && err != LWS_EWOULDBLOCK &&
+ err != WSAEINVAL) {
+ lwsl_debug("Unable to connect errno=%d\n", err);
pfd->revents |= LWS_POLLHUP;
}
@@ -269,21 +308,19 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
}
/* if something closed, retry this slot */
if (pfd->revents & LWS_POLLHUP)
- --eIdx;
+ --eIdx;
- if( pfd->revents != 0 ) {
+ if (pfd->revents)
lws_service_fd_tsi(context, pfd, tsi);
-
- }
}
}
context->service_tid = 0;
- if (ev == WSA_WAIT_TIMEOUT) {
+ if (ev == WSA_WAIT_TIMEOUT)
lws_service_fd(context, NULL);
- }
- return 0;;
+
+ return 0;
}
LWS_VISIBLE int
@@ -309,7 +346,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
/* enable keepalive on this socket */
optval = 1;
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE,
- (const char *)&optval, optlen) < 0)
+ (const char *)&optval, optlen) < 0)
return 1;
alive.onoff = TRUE;
@@ -317,7 +354,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
alive.keepaliveinterval = vhost->ka_interval;
if (WSAIoctl(fd, SIO_KEEPALIVE_VALS, &alive, sizeof(alive),
- NULL, 0, &dwBytesRet, NULL, NULL))
+ NULL, 0, &dwBytesRet, NULL, NULL))
return 1;
}
@@ -343,7 +380,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
}
LWS_VISIBLE void
-lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
+lws_plat_drop_app_privileges(const struct lws_context_creation_info *info)
{
}
@@ -406,7 +443,7 @@ lws_interface_to_sa(int ipv6,
if (ipv6) {
if (lws_plat_inet_pton(AF_INET6, ifname, &addr6->sin6_addr) == 1) {
- return 0;
+ return LWS_ITOSA_USABLE;
}
}
#endif
@@ -420,11 +457,11 @@ lws_interface_to_sa(int ipv6,
}
if (address == INADDR_NONE)
- return -1;
+ return LWS_ITOSA_NOT_EXIST;
- addr->sin_addr.s_addr = (lws_intptr_t)address;
+ addr->sin_addr.s_addr = (unsigned long)(lws_intptr_t)address;
- return 0;
+ return LWS_ITOSA_USABLE;
}
LWS_VISIBLE void
@@ -542,7 +579,7 @@ LWS_VISIBLE int
lws_plat_inet_pton(int af, const char *src, void *dst)
{
WCHAR *buffer;
- DWORD bufferlen = strlen(src) + 1;
+ DWORD bufferlen = (int)strlen(src) + 1;
BOOL ok = FALSE;
buffer = lws_malloc(bufferlen * 2, "inet_pton");
@@ -692,7 +729,7 @@ _lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount,
LWS_VISIBLE int
lws_plat_init(struct lws_context *context,
- struct lws_context_creation_info *info)
+ const struct lws_context_creation_info *info)
{
struct lws_context_per_thread *pt = &context->pt[0];
int i, n = context->count_threads;
@@ -715,7 +752,7 @@ lws_plat_init(struct lws_context *context,
}
pt->fds_count = 0;
- pt->events[0] = WSACreateEvent();
+ pt->events[0] = WSACreateEvent(); /* the cancel event */
pt++;
}
@@ -743,3 +780,50 @@ int fork(void)
exit(0);
}
+LWS_VISIBLE int
+lws_plat_write_cert(struct lws_vhost *vhost, int is_key, int fd, void *buf,
+ int len)
+{
+ int n;
+
+ n = write(fd, buf, len);
+
+ lseek(fd, 0, SEEK_SET);
+
+ return n != len;
+}
+
+LWS_VISIBLE int
+lws_plat_write_file(const char *filename, void *buf, int len)
+{
+ int m, fd;
+
+ fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+
+ if (fd == -1)
+ return -1;
+
+ m = write(fd, buf, len);
+ close(fd);
+
+ return m != len;
+}
+
+LWS_VISIBLE int
+lws_plat_read_file(const char *filename, void *buf, int len)
+{
+ int n, fd = open(filename, O_RDONLY);
+ if (fd == -1)
+ return -1;
+
+ n = read(fd, buf, len);
+ close(fd);
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_plat_recommended_rsa_bits(void)
+{
+ return 4096;
+}
diff --git a/thirdparty/libwebsockets/roles/h1/ops-h1.c b/thirdparty/libwebsockets/roles/h1/ops-h1.c
new file mode 100644
index 0000000000..d3b16f4d1f
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/h1/ops-h1.c
@@ -0,0 +1,687 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+#ifndef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+
+/*
+ * We have to take care about parsing because the headers may be split
+ * into multiple fragments. They may contain unknown headers with arbitrary
+ * argument lengths. So, we parse using a single-character at a time state
+ * machine that is completely independent of packet size.
+ *
+ * Returns <0 for error or length of chars consumed from buf (up to len)
+ */
+
+int
+lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len)
+{
+ unsigned char *last_char, *oldbuf = buf;
+ lws_filepos_t body_chunk_len;
+ size_t n;
+
+ // lwsl_notice("%s: h1 path: wsi state 0x%x\n", __func__, lwsi_state(wsi));
+
+ switch (lwsi_state(wsi)) {
+
+ case LRS_ISSUING_FILE:
+ return 0;
+
+ case LRS_ESTABLISHED:
+
+ if (lwsi_role_ws(wsi))
+ goto ws_mode;
+
+ if (lwsi_role_client(wsi))
+ break;
+
+ wsi->hdr_parsing_completed = 0;
+
+ /* fallthru */
+
+ case LRS_HEADERS:
+ if (!wsi->http.ah) {
+ lwsl_err("%s: LRS_HEADERS: NULL ah\n", __func__);
+ assert(0);
+ }
+ lwsl_parser("issuing %d bytes to parser\n", (int)len);
+#if defined(LWS_ROLE_WS) && !defined(LWS_NO_CLIENT)
+ if (lws_ws_handshake_client(wsi, &buf, (size_t)len))
+ goto bail;
+#endif
+ last_char = buf;
+ if (lws_handshake_server(wsi, &buf, (size_t)len))
+ /* Handshake indicates this session is done. */
+ goto bail;
+
+ /* we might have transitioned to RAW */
+ if (wsi->role_ops == &role_ops_raw_skt ||
+ wsi->role_ops == &role_ops_raw_file)
+ /* we gave the read buffer to RAW handler already */
+ goto read_ok;
+
+ /*
+ * It's possible that we've exhausted our data already, or
+ * rx flow control has stopped us dealing with this early,
+ * but lws_handshake_server doesn't update len for us.
+ * Figure out how much was read, so that we can proceed
+ * appropriately:
+ */
+ len -= (buf - last_char);
+// lwsl_debug("%s: thinks we have used %ld\n", __func__, (long)len);
+
+ if (!wsi->hdr_parsing_completed)
+ /* More header content on the way */
+ goto read_ok;
+
+ switch (lwsi_state(wsi)) {
+ case LRS_ESTABLISHED:
+ case LRS_HEADERS:
+ goto read_ok;
+ case LRS_ISSUING_FILE:
+ goto read_ok;
+ case LRS_BODY:
+ wsi->http.rx_content_remain =
+ wsi->http.rx_content_length;
+ if (wsi->http.rx_content_remain)
+ goto http_postbody;
+
+ /* there is no POST content */
+ goto postbody_completion;
+ default:
+ break;
+ }
+ break;
+
+ case LRS_BODY:
+http_postbody:
+ lwsl_debug("%s: http post body: remain %d\n", __func__,
+ (int)wsi->http.rx_content_remain);
+ while (len && wsi->http.rx_content_remain) {
+ /* Copy as much as possible, up to the limit of:
+ * what we have in the read buffer (len)
+ * remaining portion of the POST body (content_remain)
+ */
+ body_chunk_len = min(wsi->http.rx_content_remain, len);
+ wsi->http.rx_content_remain -= body_chunk_len;
+ len -= body_chunk_len;
+#ifdef LWS_WITH_CGI
+ if (wsi->http.cgi) {
+ struct lws_cgi_args args;
+
+ args.ch = LWS_STDIN;
+ args.stdwsi = &wsi->http.cgi->stdwsi[0];
+ args.data = buf;
+ args.len = body_chunk_len;
+
+ /* returns how much used */
+ n = user_callback_handle_rxflow(
+ wsi->protocol->callback,
+ wsi, LWS_CALLBACK_CGI_STDIN_DATA,
+ wsi->user_space,
+ (void *)&args, 0);
+ if ((int)n < 0)
+ goto bail;
+ } else {
+#endif
+ n = wsi->protocol->callback(wsi,
+ LWS_CALLBACK_HTTP_BODY, wsi->user_space,
+ buf, (size_t)body_chunk_len);
+ if (n)
+ goto bail;
+ n = (size_t)body_chunk_len;
+#ifdef LWS_WITH_CGI
+ }
+#endif
+ buf += n;
+
+ if (wsi->http.rx_content_remain) {
+ lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT,
+ wsi->context->timeout_secs);
+ break;
+ }
+ /* he sent all the content in time */
+postbody_completion:
+#ifdef LWS_WITH_CGI
+ /*
+ * If we're running a cgi, we can't let him off the
+ * hook just because he sent his POST data
+ */
+ if (wsi->http.cgi)
+ lws_set_timeout(wsi, PENDING_TIMEOUT_CGI,
+ wsi->context->timeout_secs);
+ else
+#endif
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+#ifdef LWS_WITH_CGI
+ if (!wsi->http.cgi)
+#endif
+ {
+ lwsl_info("HTTP_BODY_COMPLETION: %p (%s)\n",
+ wsi, wsi->protocol->name);
+ n = wsi->protocol->callback(wsi,
+ LWS_CALLBACK_HTTP_BODY_COMPLETION,
+ wsi->user_space, NULL, 0);
+ if (n)
+ goto bail;
+
+ if (wsi->http2_substream)
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ }
+
+ break;
+ }
+ break;
+
+ case LRS_AWAITING_CLOSE_ACK:
+ case LRS_WAITING_TO_SEND_CLOSE:
+ case LRS_SHUTDOWN:
+
+ws_mode:
+#if !defined(LWS_NO_CLIENT) && defined(LWS_ROLE_WS)
+ // lwsl_notice("%s: ws_mode\n", __func__);
+ if (lws_ws_handshake_client(wsi, &buf, (size_t)len))
+ goto bail;
+#endif
+#if defined(LWS_ROLE_WS)
+ if (lwsi_role_ws(wsi) && lwsi_role_server(wsi) &&
+ /*
+ * for h2 we are on the swsi
+ */
+ lws_parse_ws(wsi, &buf, (size_t)len) < 0) {
+ lwsl_info("%s: lws_parse_ws bailed\n", __func__);
+ goto bail;
+ }
+#endif
+ // lwsl_notice("%s: ws_mode: buf moved on by %d\n", __func__,
+ // lws_ptr_diff(buf, oldbuf));
+ break;
+
+ case LRS_DEFERRING_ACTION:
+ lwsl_debug("%s: LRS_DEFERRING_ACTION\n", __func__);
+ break;
+
+ case LRS_SSL_ACK_PENDING:
+ break;
+
+ case LRS_DEAD_SOCKET:
+ lwsl_err("%s: Unhandled state LRS_DEAD_SOCKET\n", __func__);
+ goto bail;
+ // assert(0);
+ /* fallthru */
+
+ default:
+ lwsl_err("%s: Unhandled state %d\n", __func__, lwsi_state(wsi));
+ assert(0);
+ goto bail;
+ }
+
+read_ok:
+ /* Nothing more to do for now */
+// lwsl_info("%s: %p: read_ok, used %ld (len %d, state %d)\n", __func__,
+// wsi, (long)(buf - oldbuf), (int)len, wsi->state);
+
+ return lws_ptr_diff(buf, oldbuf);
+
+bail:
+ /*
+ * h2 / h2-ws calls us recursively in
+ *
+ * lws_read_h1()->
+ * lws_h2_parser()->
+ * lws_read_h1()
+ *
+ * pattern, having stripped the h2 framing in the middle.
+ *
+ * When taking down the whole connection, make sure that only the
+ * outer lws_read() does the wsi close.
+ */
+ if (!wsi->outer_will_close)
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "lws_read_h1 bail");
+
+ return -1;
+}
+#if !defined(LWS_NO_SERVER)
+static int
+lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ struct lws_tokens ebuf;
+ int n, buffered;
+
+ if (lwsi_state(wsi) == LRS_DEFERRING_ACTION)
+ goto try_pollout;
+
+ /* any incoming data ready? */
+
+ if (!(pollfd->revents & pollfd->events & LWS_POLLIN))
+ goto try_pollout;
+
+ /*
+ * If we previously just did POLLIN when IN and OUT were signaled
+ * (because POLLIN processing may have used up the POLLOUT), don't let
+ * that happen twice in a row... next time we see the situation favour
+ * POLLOUT
+ */
+
+ if (wsi->favoured_pollin &&
+ (pollfd->revents & pollfd->events & LWS_POLLOUT)) {
+ // lwsl_notice("favouring pollout\n");
+ wsi->favoured_pollin = 0;
+ goto try_pollout;
+ }
+
+ /*
+ * We haven't processed that the tunnel is set up yet, so
+ * defer reading
+ */
+
+ if (lwsi_state(wsi) == LRS_SSL_ACK_PENDING)
+ return LWS_HPI_RET_HANDLED;
+
+ /* these states imply we MUST have an ah attached */
+
+ if ((lwsi_state(wsi) == LRS_ESTABLISHED ||
+ lwsi_state(wsi) == LRS_ISSUING_FILE ||
+ lwsi_state(wsi) == LRS_HEADERS ||
+ lwsi_state(wsi) == LRS_BODY)) {
+
+ if (!wsi->http.ah && lws_header_table_attach(wsi, 0)) {
+ lwsl_info("%s: wsi %p: ah not available\n", __func__, wsi);
+ goto try_pollout;
+ }
+
+ /*
+ * We got here because there was specifically POLLIN...
+ * regardless of our buflist state, we need to get it,
+ * and either use it, or append to the buflist and use
+ * buflist head material.
+ *
+ * We will not notice a connection close until the buflist is
+ * exhausted and we tried to do a read of some kind.
+ */
+
+ buffered = lws_buflist_aware_read(pt, wsi, &ebuf);
+ switch (ebuf.len) {
+ case 0:
+ lwsl_info("%s: read 0 len a\n", __func__);
+ wsi->seen_zero_length_recv = 1;
+ lws_change_pollfd(wsi, LWS_POLLIN, 0);
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ /*
+ * autobahn requires us to win the race between close
+ * and draining the extensions
+ */
+ if (wsi->ws &&
+ (wsi->ws->rx_draining_ext || wsi->ws->tx_draining_ext))
+ goto try_pollout;
+#endif
+ /*
+ * normally, we respond to close with logically closing
+ * our side immediately
+ */
+ goto fail;
+
+ case LWS_SSL_CAPABLE_ERROR:
+ goto fail;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ goto try_pollout;
+ }
+
+ /* just ignore incoming if waiting for close */
+ if (lwsi_state(wsi) == LRS_FLUSHING_BEFORE_CLOSE) {
+ lwsl_notice("%s: just ignoring\n", __func__);
+ goto try_pollout;
+ }
+
+ if (lwsi_state(wsi) == LRS_ISSUING_FILE) {
+ // lwsl_notice("stashing: wsi %p: bd %d\n", wsi, buffered);
+ if (lws_buflist_aware_consume(wsi, &ebuf, 0, buffered))
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+
+ goto try_pollout;
+ }
+
+ /*
+ * Otherwise give it to whoever wants it according to the
+ * connection state
+ */
+#if defined(LWS_ROLE_H2)
+ if (lwsi_role_h2(wsi) && lwsi_state(wsi) != LRS_BODY)
+ n = lws_read_h2(wsi, (uint8_t *)ebuf.token, ebuf.len);
+ else
+#endif
+ n = lws_read_h1(wsi, (uint8_t *)ebuf.token, ebuf.len);
+ if (n < 0) /* we closed wsi */
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+
+ lwsl_debug("%s: consumed %d\n", __func__, n);
+
+ if (lws_buflist_aware_consume(wsi, &ebuf, n, buffered))
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+
+ /*
+ * during the parsing our role changed to something non-http,
+ * so the ah has no further meaning
+ */
+
+ if (wsi->http.ah &&
+ !lwsi_role_h1(wsi) &&
+ !lwsi_role_h2(wsi) &&
+ !lwsi_role_cgi(wsi))
+ lws_header_table_detach(wsi, 0);
+
+ /*
+ * He may have used up the writability above, if we will defer
+ * POLLOUT processing in favour of POLLIN, note it
+ */
+
+ if (pollfd->revents & LWS_POLLOUT)
+ wsi->favoured_pollin = 1;
+
+ return LWS_HPI_RET_HANDLED;
+ }
+
+ /*
+ * He may have used up the writability above, if we will defer POLLOUT
+ * processing in favour of POLLIN, note it
+ */
+
+ if (pollfd->revents & LWS_POLLOUT)
+ wsi->favoured_pollin = 1;
+
+try_pollout:
+
+ /* this handles POLLOUT for http serving fragments */
+
+ if (!(pollfd->revents & LWS_POLLOUT))
+ return LWS_HPI_RET_HANDLED;
+
+ /* one shot */
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_notice("%s a\n", __func__);
+ goto fail;
+ }
+
+ /* clear back-to-back write detection */
+ wsi->could_have_pending = 0;
+
+ if (lwsi_state(wsi) == LRS_DEFERRING_ACTION) {
+ lwsl_debug("%s: LRS_DEFERRING_ACTION now writable\n", __func__);
+
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_info("failed at set pollfd\n");
+ goto fail;
+ }
+ }
+
+ if (!wsi->hdr_parsing_completed)
+ return LWS_HPI_RET_HANDLED;
+
+ if (lwsi_state(wsi) != LRS_ISSUING_FILE) {
+
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_WRITEABLE_CB, 1);
+#if defined(LWS_WITH_STATS)
+ if (wsi->active_writable_req_us) {
+ uint64_t ul = time_in_microseconds() -
+ wsi->active_writable_req_us;
+
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_MS_WRITABLE_DELAY, ul);
+ lws_stats_atomic_max(wsi->context, pt,
+ LWSSTATS_MS_WORST_WRITABLE_DELAY, ul);
+ wsi->active_writable_req_us = 0;
+ }
+#endif
+
+ n = user_callback_handle_rxflow(wsi->protocol->callback, wsi,
+ LWS_CALLBACK_HTTP_WRITEABLE,
+ wsi->user_space, NULL, 0);
+ if (n < 0) {
+ lwsl_info("writeable_fail\n");
+ goto fail;
+ }
+
+ return LWS_HPI_RET_HANDLED;
+ }
+
+ /* >0 == completion, <0 == error
+ *
+ * We'll get a LWS_CALLBACK_HTTP_FILE_COMPLETION callback when
+ * it's done. That's the case even if we just completed the
+ * send, so wait for that.
+ */
+ n = lws_serve_http_file_fragment(wsi);
+ if (n < 0)
+ goto fail;
+
+ return LWS_HPI_RET_HANDLED;
+
+
+fail:
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "server socket svc fail");
+
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+}
+#endif
+
+static int
+rops_handle_POLLIN_h1(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
+{
+
+// lwsl_notice("%s: %p: wsistate 0x%x %s, revents 0x%x\n", __func__, wsi,
+// wsi->wsistate, wsi->role_ops->name, pollfd->revents);
+
+#ifdef LWS_WITH_CGI
+ if (wsi->http.cgi && (pollfd->revents & LWS_POLLOUT)) {
+ if (lws_handle_POLLOUT_event(wsi, pollfd))
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+
+ return LWS_HPI_RET_HANDLED;
+ }
+#endif
+
+ if (lws_is_flowcontrolled(wsi))
+ /* We cannot deal with any kind of new RX because we are
+ * RX-flowcontrolled.
+ */
+ return LWS_HPI_RET_HANDLED;
+
+#if !defined(LWS_NO_SERVER)
+ if (!lwsi_role_client(wsi)) {
+ int n;
+
+ lwsl_debug("%s: %p: wsistate 0x%x\n", __func__, wsi, wsi->wsistate);
+ n = lws_h1_server_socket_service(wsi, pollfd);
+ if (n != LWS_HPI_RET_HANDLED)
+ return n;
+ if (lwsi_state(wsi) != LRS_SSL_INIT)
+ if (lws_server_socket_service_ssl(wsi, LWS_SOCK_INVALID))
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+
+ return LWS_HPI_RET_HANDLED;
+ }
+#endif
+
+#ifndef LWS_NO_CLIENT
+ if ((pollfd->revents & LWS_POLLIN) &&
+ wsi->hdr_parsing_completed && !wsi->told_user_closed) {
+
+ /*
+ * In SSL mode we get POLLIN notification about
+ * encrypted data in.
+ *
+ * But that is not necessarily related to decrypted
+ * data out becoming available; in may need to perform
+ * other in or out before that happens.
+ *
+ * simply mark ourselves as having readable data
+ * and turn off our POLLIN
+ */
+ wsi->client_rx_avail = 1;
+ lws_change_pollfd(wsi, LWS_POLLIN, 0);
+
+ //lwsl_notice("calling back %s\n", wsi->protocol->name);
+
+ /* let user code know, he'll usually ask for writeable
+ * callback and drain / re-enable it there
+ */
+ if (user_callback_handle_rxflow(
+ wsi->protocol->callback,
+ wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP,
+ wsi->user_space, NULL, 0)) {
+ lwsl_info("RECEIVE_CLIENT_HTTP closed it\n");
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ return LWS_HPI_RET_HANDLED;
+ }
+#endif
+
+// if (lwsi_state(wsi) == LRS_ESTABLISHED)
+// return LWS_HPI_RET_HANDLED;
+
+#if !defined(LWS_NO_CLIENT)
+ if ((pollfd->revents & LWS_POLLOUT) &&
+ lws_handle_POLLOUT_event(wsi, pollfd)) {
+ lwsl_debug("POLLOUT event closed it\n");
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ if (lws_client_socket_service(wsi, pollfd, NULL))
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+#endif
+
+ return LWS_HPI_RET_HANDLED;
+}
+
+int rops_handle_POLLOUT_h1(struct lws *wsi)
+{
+ if (lwsi_state(wsi) == LRS_ISSUE_HTTP_BODY)
+ return LWS_HP_RET_USER_SERVICE;
+
+ if (lwsi_role_client(wsi))
+ return LWS_HP_RET_USER_SERVICE;
+
+ return LWS_HP_RET_BAIL_OK;
+}
+
+static int
+rops_write_role_protocol_h1(struct lws *wsi, unsigned char *buf, size_t len,
+ enum lws_write_protocol *wp)
+{
+#if 0
+ /* if not in a state to send stuff, then just send nothing */
+
+ if ((lwsi_state(wsi) != LRS_RETURNED_CLOSE &&
+ lwsi_state(wsi) != LRS_WAITING_TO_SEND_CLOSE &&
+ lwsi_state(wsi) != LRS_AWAITING_CLOSE_ACK)) {
+ //assert(0);
+ lwsl_debug("binning %d %d\n", lwsi_state(wsi), *wp);
+ return 0;
+ }
+#endif
+
+ return lws_issue_raw(wsi, (unsigned char *)buf, len);
+}
+
+static int
+rops_alpn_negotiated_h1(struct lws *wsi, const char *alpn)
+{
+ lwsl_debug("%s: client %d\n", __func__, lwsi_role_client(wsi));
+#if !defined(LWS_NO_CLIENT)
+ if (lwsi_role_client(wsi)) {
+ /*
+ * If alpn asserts it is http/1.1, server support for KA is
+ * mandatory.
+ *
+ * Knowing this lets us proceed with sending pipelined headers
+ * before we received the first response headers.
+ */
+ wsi->keepalive_active = 1;
+ }
+#endif
+
+ return 0;
+}
+
+static int
+rops_destroy_role_h1(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ struct allocated_headers *ah;
+
+ /* we may not have an ah, but may be on the waiting list... */
+ lwsl_info("%s: ah det due to close\n", __func__);
+ __lws_header_table_detach(wsi, 0);
+
+ ah = pt->http.ah_list;
+
+ while (ah) {
+ if (ah->in_use && ah->wsi == wsi) {
+ lwsl_err("%s: ah leak: wsi %p\n", __func__, wsi);
+ ah->in_use = 0;
+ ah->wsi = NULL;
+ pt->http.ah_count_in_use--;
+ break;
+ }
+ ah = ah->next;
+ }
+
+ return 0;
+}
+
+struct lws_role_ops role_ops_h1 = {
+ /* role name */ "h1",
+ /* alpn id */ "http/1.1",
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ NULL,
+ /* destroy_vhost */ NULL,
+ /* periodic_checks */ NULL,
+ /* service_flag_pending */ NULL,
+ /* handle_POLLIN */ rops_handle_POLLIN_h1,
+ /* handle_POLLOUT */ rops_handle_POLLOUT_h1,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ NULL,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ rops_write_role_protocol_h1,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ rops_alpn_negotiated_h1,
+ /* close_via_role_protocol */ NULL,
+ /* close_role */ NULL,
+ /* close_kill_connection */ NULL,
+ /* destroy_role */ rops_destroy_role_h1,
+ /* writeable cb clnt, srv */ { LWS_CALLBACK_CLIENT_HTTP_WRITEABLE,
+ LWS_CALLBACK_HTTP_WRITEABLE },
+ /* close cb clnt, srv */ { LWS_CALLBACK_CLOSED_CLIENT_HTTP,
+ LWS_CALLBACK_CLOSED_HTTP },
+ /* file_handle */ 0,
+};
diff --git a/thirdparty/libwebsockets/roles/h1/private.h b/thirdparty/libwebsockets/roles/h1/private.h
new file mode 100644
index 0000000000..3f53954d33
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/h1/private.h
@@ -0,0 +1,27 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h if LWS_ROLE_H1
+ *
+ * Most of the h1 business is defined in the h1 / h2 common roles/http dir
+ */
+
+extern struct lws_role_ops role_ops_h1;
+#define lwsi_role_h1(wsi) (wsi->role_ops == &role_ops_h1)
diff --git a/thirdparty/lws/client/client-handshake.c b/thirdparty/libwebsockets/roles/http/client/client-handshake.c
index c2720d9283..4830fc9eca 100644
--- a/thirdparty/lws/client/client-handshake.c
+++ b/thirdparty/libwebsockets/roles/http/client/client-handshake.c
@@ -1,4 +1,4 @@
-#include "private-libwebsockets.h"
+#include "core/private.h"
static int
lws_getaddrinfo46(struct lws *wsi, const char *ads, struct addrinfo **result)
@@ -20,7 +20,6 @@ lws_getaddrinfo46(struct lws *wsi, const char *ads, struct addrinfo **result)
{
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME;
}
return getaddrinfo(ads, NULL, &hints, result);
@@ -29,15 +28,20 @@ lws_getaddrinfo46(struct lws *wsi, const char *ads, struct addrinfo **result)
struct lws *
lws_client_connect_2(struct lws *wsi)
{
- sockaddr46 sa46;
- struct addrinfo *result;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
struct lws_context *context = wsi->context;
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ const char *adsin;
+ struct lws *wsi_piggyback = NULL;
struct lws_pollfd pfd;
- const char *cce = "", *iface;
- int n, port;
ssize_t plen = 0;
+#endif
+ struct addrinfo *result;
const char *ads;
+ sockaddr46 sa46;
+ int n, port;
+ const char *cce = "", *iface;
+ const char *meth = NULL;
#ifdef LWS_WITH_IPV6
char ipv6only = lws_check_opt(wsi->vhost->options,
LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY |
@@ -48,24 +52,148 @@ lws_client_connect_2(struct lws *wsi)
#endif
#endif
- lwsl_client("%s\n", __func__);
+ lwsl_client("%s: %p\n", __func__, wsi);
- if (!wsi->u.hdr.ah) {
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ if (!wsi->http.ah) {
cce = "ah was NULL at cc2";
lwsl_err("%s\n", cce);
goto oom4;
}
+ /* we can only piggyback GET or POST */
+
+ meth = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_METHOD);
+ if (meth && strcmp(meth, "GET") && strcmp(meth, "POST"))
+ goto create_new_conn;
+
+ /* we only pipeline connections that said it was okay */
+
+ if (!wsi->client_pipeline)
+ goto create_new_conn;
+
+ /*
+ * let's take a look first and see if there are any already-active
+ * client connections we can piggy-back on.
+ */
+
+ adsin = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS);
+
+ lws_vhost_lock(wsi->vhost); /* ----------------------------------- { */
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ wsi->vhost->dll_active_client_conns.next) {
+ struct lws *w = lws_container_of(d, struct lws,
+ dll_active_client_conns);
+
+ lwsl_debug("%s: check %s %s %d %d\n", __func__, adsin,
+ w->client_hostname_copy, wsi->c_port, w->c_port);
+
+ if (w != wsi && w->client_hostname_copy &&
+ !strcmp(adsin, w->client_hostname_copy) &&
+#if defined(LWS_WITH_TLS)
+ (wsi->tls.use_ssl & LCCSCF_USE_SSL) ==
+ (w->tls.use_ssl & LCCSCF_USE_SSL) &&
+#endif
+ wsi->c_port == w->c_port) {
+
+ /* someone else is already connected to the right guy */
+
+ /* do we know for a fact pipelining won't fly? */
+ if (w->keepalive_rejected) {
+ lwsl_info("defeating pipelining due to no "
+ "keepalive on server\n");
+ lws_vhost_unlock(wsi->vhost); /* } ---------- */
+ goto create_new_conn;
+ }
+#if defined (LWS_WITH_HTTP2)
+ /*
+ * h2: in usable state already: just use it without
+ * going through the queue
+ */
+ if (w->client_h2_alpn &&
+ (lwsi_state(w) == LRS_H2_WAITING_TO_SEND_HEADERS ||
+ lwsi_state(w) == LRS_ESTABLISHED)) {
+
+ lwsl_info("%s: just join h2 directly\n",
+ __func__);
+
+ wsi->client_h2_alpn = 1;
+ lws_wsi_h2_adopt(w, wsi);
+ lws_vhost_unlock(wsi->vhost); /* } ---------- */
+
+ return wsi;
+ }
+#endif
+
+ lwsl_info("applying %p to txn queue on %p (wsistate 0x%x)\n",
+ wsi, w, w->wsistate);
+ /*
+ * ...let's add ourselves to his transaction queue...
+ * we are adding ourselves at the HEAD
+ */
+ lws_dll_lws_add_front(&wsi->dll_client_transaction_queue,
+ &w->dll_client_transaction_queue_head);
+
+ /*
+ * h1: pipeline our headers out on him,
+ * and wait for our turn at client transaction_complete
+ * to take over parsing the rx.
+ */
+
+ wsi_piggyback = w;
+
+ lws_vhost_unlock(wsi->vhost); /* } ---------- */
+ goto send_hs;
+ }
+
+ } lws_end_foreach_dll_safe(d, d1);
+
+ lws_vhost_unlock(wsi->vhost); /* } ---------------------------------- */
+
+create_new_conn:
+#endif
+
+ /*
+ * clients who will create their own fresh connection keep a copy of
+ * the hostname they originally connected to, in case other connections
+ * want to use it too
+ */
+
+ if (!wsi->client_hostname_copy)
+ wsi->client_hostname_copy =
+ strdup(lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_PEER_ADDRESS));
+
+ /*
+ * If we made our own connection, and we're doing a method that can take
+ * a pipeline, we are an "active client connection".
+ *
+ * Add ourselves to the vhost list of those so that others can
+ * piggyback on our transaction queue
+ */
+
+ if (meth && (!strcmp(meth, "GET") || !strcmp(meth, "POST")) &&
+ lws_dll_is_null(&wsi->dll_client_transaction_queue) &&
+ lws_dll_is_null(&wsi->dll_active_client_conns)) {
+ lws_vhost_lock(wsi->vhost);
+ lws_dll_lws_add_front(&wsi->dll_active_client_conns,
+ &wsi->vhost->dll_active_client_conns);
+ lws_vhost_unlock(wsi->vhost);
+ }
+
/*
* start off allowing ipv6 on connection if vhost allows it
*/
wsi->ipv6 = LWS_IPV6_ENABLED(wsi->vhost);
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+
/* Decide what it is we need to connect to:
*
* Priority 1: connect to http proxy */
- if (wsi->vhost->http_proxy_port) {
+ if (wsi->vhost->http.http_proxy_port) {
plen = sprintf((char *)pt->serv_buf,
"CONNECT %s:%u HTTP/1.0\x0d\x0a"
"User-agent: libwebsockets\x0d\x0a",
@@ -78,8 +206,11 @@ lws_client_connect_2(struct lws *wsi)
wsi->vhost->proxy_basic_auth_token);
plen += sprintf((char *)pt->serv_buf + plen, "\x0d\x0a");
- ads = wsi->vhost->http_proxy_address;
- port = wsi->vhost->http_proxy_port;
+ ads = wsi->vhost->http.http_proxy_address;
+ port = wsi->vhost->http.http_proxy_port;
+#else
+ if (0) {
+#endif
#if defined(LWS_WITH_SOCKS5)
@@ -104,12 +235,14 @@ lws_client_connect_2(struct lws *wsi)
* to whatever we decided to connect to
*/
- lwsl_notice("%s: %p: address %s\n", __func__, wsi, ads);
+ lwsl_info("%s: %p: address %s\n", __func__, wsi, ads);
n = lws_getaddrinfo46(wsi, ads, &result);
#ifdef LWS_WITH_IPV6
if (wsi->ipv6) {
+ struct sockaddr_in6 *sa6 =
+ ((struct sockaddr_in6 *)result->ai_addr);
if (n) {
/* lws_getaddrinfo46 failed, there is no usable result */
@@ -138,11 +271,10 @@ lws_client_connect_2(struct lws *wsi)
break;
case AF_INET6:
- memcpy(&sa46.sa6.sin6_addr,
- &((struct sockaddr_in6 *)result->ai_addr)->sin6_addr,
+ memcpy(&sa46.sa6.sin6_addr, &sa6->sin6_addr,
sizeof(struct in6_addr));
- sa46.sa6.sin6_scope_id = ((struct sockaddr_in6 *)result->ai_addr)->sin6_scope_id;
- sa46.sa6.sin6_flowinfo = ((struct sockaddr_in6 *)result->ai_addr)->sin6_flowinfo;
+ sa46.sa6.sin6_scope_id = sa6->sin6_scope_id;
+ sa46.sa6.sin6_flowinfo = sa6->sin6_flowinfo;
break;
default:
lwsl_err("Unknown address family\n");
@@ -211,14 +343,11 @@ lws_client_connect_2(struct lws *wsi)
if (!lws_socket_is_valid(wsi->desc.sockfd)) {
-#if defined(LWS_WITH_LIBUV)
- if (LWS_LIBUV_ENABLED(context))
- if (lws_libuv_check_watcher_active(wsi)) {
- lwsl_warn("Waiting for libuv watcher to close\n");
- cce = "waiting for libuv watcher to close";
- goto oom4;
- }
-#endif
+ if (wsi->context->event_loop_ops->check_client_connect_ok &&
+ wsi->context->event_loop_ops->check_client_connect_ok(wsi)) {
+ cce = "waiting for event loop watcher to close";
+ goto oom4;
+ }
#ifdef LWS_WITH_IPV6
if (wsi->ipv6)
@@ -240,13 +369,12 @@ lws_client_connect_2(struct lws *wsi)
goto oom4;
}
- wsi->mode = LWSCM_WSCL_WAITING_CONNECT;
+ lwsi_set_state(wsi, LRS_WAITING_CONNECT);
- lws_libev_accept(wsi, wsi->desc);
- lws_libuv_accept(wsi, wsi->desc);
- lws_libevent_accept(wsi, wsi->desc);
+ if (wsi->context->event_loop_ops->accept)
+ wsi->context->event_loop_ops->accept(wsi);
- if (insert_wsi_socket_into_fds(context, wsi)) {
+ if (__insert_wsi_socket_into_fds(wsi->context, wsi)) {
compatible_close(wsi->desc.sockfd);
cce = "insert wsi failed";
goto oom4;
@@ -328,10 +456,11 @@ lws_client_connect_2(struct lws *wsi)
lwsl_client("connected\n");
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
/* we are connected to server, or proxy */
/* http proxy */
- if (wsi->vhost->http_proxy_port) {
+ if (wsi->vhost->http.http_proxy_port) {
/*
* OK from now on we talk via the proxy, so connect to that
@@ -340,11 +469,11 @@ lws_client_connect_2(struct lws *wsi)
* leaving old string/frag there but unreferenced)
*/
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS,
- wsi->vhost->http_proxy_address))
+ wsi->vhost->http.http_proxy_address))
goto failed;
- wsi->c_port = wsi->vhost->http_proxy_port;
+ wsi->c_port = wsi->vhost->http.http_proxy_port;
- n = send(wsi->desc.sockfd, (char *)pt->serv_buf, plen,
+ n = send(wsi->desc.sockfd, (char *)pt->serv_buf, (int)plen,
MSG_NOSIGNAL);
if (n < 0) {
lwsl_debug("ERROR writing to proxy socket\n");
@@ -355,10 +484,11 @@ lws_client_connect_2(struct lws *wsi)
lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE,
AWAITING_TIMEOUT);
- wsi->mode = LWSCM_WSCL_WAITING_PROXY_REPLY;
+ lwsi_set_state(wsi, LRS_WAITING_PROXY_REPLY);
return wsi;
}
+#endif
#if defined(LWS_WITH_SOCKS5)
/* socks proxy */
else if (wsi->vhost->socks_proxy_port) {
@@ -373,72 +503,105 @@ lws_client_connect_2(struct lws *wsi)
lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SOCKS_GREETING_REPLY,
AWAITING_TIMEOUT);
- wsi->mode = LWSCM_WSCL_WAITING_SOCKS_GREETING_REPLY;
+ lwsi_set_state(wsi, LRS_WAITING_SOCKS_GREETING_REPLY);
return wsi;
}
#endif
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+send_hs:
- /*
- * provoke service to issue the handshake directly
- * we need to do it this way because in the proxy case, this is the
- * next state and executed only if and when we get a good proxy
- * response inside the state machine... but notice in SSL case this
- * may not have sent anything yet with 0 return, and won't until some
- * many retries from main loop. To stop that becoming endless,
- * cover with a timeout.
- */
+ if (wsi_piggyback &&
+ !lws_dll_is_null(&wsi->dll_client_transaction_queue)) {
+ /*
+ * We are pipelining on an already-established connection...
+ * we can skip tls establishment.
+ */
+
+ lwsi_set_state(wsi, LRS_H1C_ISSUE_HANDSHAKE2);
+
+ /*
+ * we can't send our headers directly, because they have to
+ * be sent when the parent is writeable. The parent will check
+ * for anybody on his client transaction queue that is in
+ * LRS_H1C_ISSUE_HANDSHAKE2, and let them write.
+ *
+ * If we are trying to do this too early, before the master
+ * connection has written his own headers, then it will just
+ * wait in the queue until it's possible to send them.
+ */
+ lws_callback_on_writable(wsi_piggyback);
+ lwsl_info("%s: wsi %p: waiting to send headers (parent state %x)\n",
+ __func__, wsi, lwsi_state(wsi_piggyback));
+ } else {
+ lwsl_info("%s: wsi %p: client creating own connection\n",
+ __func__, wsi);
- lws_set_timeout(wsi, PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE,
- AWAITING_TIMEOUT);
+ /* we are making our own connection */
+ lwsi_set_state(wsi, LRS_H1C_ISSUE_HANDSHAKE);
+
+ /*
+ * provoke service to issue the handshake directly.
+ *
+ * we need to do it this way because in the proxy case, this is
+ * the next state and executed only if and when we get a good
+ * proxy response inside the state machine... but notice in
+ * SSL case this may not have sent anything yet with 0 return,
+ * and won't until many retries from main loop. To stop that
+ * becoming endless, cover with a timeout.
+ */
- wsi->mode = LWSCM_WSCL_ISSUE_HANDSHAKE;
- pfd.fd = wsi->desc.sockfd;
- pfd.events = LWS_POLLIN;
- pfd.revents = LWS_POLLIN;
+ lws_set_timeout(wsi, PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE,
+ AWAITING_TIMEOUT);
- n = lws_service_fd(context, &pfd);
- if (n < 0) {
- cce = "first service failed";
- goto failed;
- }
- if (n) /* returns 1 on failure after closing wsi */
- return NULL;
+ pfd.fd = wsi->desc.sockfd;
+ pfd.events = LWS_POLLIN;
+ pfd.revents = LWS_POLLIN;
+ n = lws_service_fd(context, &pfd);
+ if (n < 0) {
+ cce = "first service failed";
+ goto failed;
+ }
+ if (n) /* returns 1 on failure after closing wsi */
+ return NULL;
+ }
+#endif
return wsi;
oom4:
- /* we're closing, losing some rx is OK */
- lws_header_table_force_to_detachable_state(wsi);
-
- if (wsi->mode == LWSCM_HTTP_CLIENT ||
- wsi->mode == LWSCM_HTTP_CLIENT_ACCEPTED ||
- wsi->mode == LWSCM_WSCL_WAITING_CONNECT) {
- wsi->vhost->protocols[0].callback(wsi,
+ if (lwsi_role_client(wsi) && lwsi_state_est(wsi)) {
+ wsi->protocol->callback(wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space, (void *)cce, strlen(cce));
wsi->already_did_cce = 1;
}
/* take care that we might be inserted in fds already */
- if (wsi->position_in_fds_table != -1)
+ if (wsi->position_in_fds_table != LWS_NO_FDS_POS)
goto failed1;
lws_remove_from_timeout_list(wsi);
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
lws_header_table_detach(wsi, 0);
+#endif
+ lws_client_stash_destroy(wsi);
+ lws_free_set_NULL(wsi->client_hostname_copy);
lws_free(wsi);
return NULL;
failed:
- wsi->vhost->protocols[0].callback(wsi,
+ wsi->protocol->callback(wsi,
LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space, (void *)cce, strlen(cce));
wsi->already_did_cce = 1;
failed1:
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "client_connect2");
return NULL;
}
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+
/**
* lws_client_reset() - retarget a connected wsi to start over with a new connection (ie, redirect)
* this only works if still in HTTP, ie, not upgraded yet
@@ -452,7 +615,8 @@ LWS_VISIBLE struct lws *
lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,
const char *path, const char *host)
{
- char origin[300] = "", protocol[300] = "", method[32] = "", iface[16] = "", *p;
+ char origin[300] = "", protocol[300] = "", method[32] = "",
+ iface[16] = "", alpn[32] = "", *p;
struct lws *wsi = *pwsi;
if (wsi->redirects == 3) {
@@ -463,49 +627,42 @@ lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,
p = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ORIGIN);
if (p)
- strncpy(origin, p, sizeof(origin) - 1);
+ lws_strncpy(origin, p, sizeof(origin));
p = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
if (p)
- strncpy(protocol, p, sizeof(protocol) - 1);
+ lws_strncpy(protocol, p, sizeof(protocol));
p = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_METHOD);
if (p)
- strncpy(method, p, sizeof(method) - 1);
+ lws_strncpy(method, p, sizeof(method));
p = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_IFACE);
if (p)
- strncpy(method, p, sizeof(iface) - 1);
+ lws_strncpy(iface, p, sizeof(iface));
+
+ p = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ALPN);
+ if (p)
+ lws_strncpy(alpn, p, sizeof(alpn));
lwsl_info("redirect ads='%s', port=%d, path='%s', ssl = %d\n",
address, port, path, ssl);
/* close the connection by hand */
-#ifdef LWS_OPENSSL_SUPPORT
+#if defined(LWS_WITH_TLS)
lws_ssl_close(wsi);
#endif
-#ifdef LWS_WITH_LIBUV
- if (LWS_LIBUV_ENABLED(wsi->context)) {
- lwsl_debug("%s: lws_libuv_closehandle: wsi %p\n", __func__, wsi);
- /*
- * libuv has to do his own close handle processing asynchronously
- * but once it starts we can do everything else synchronously,
- * including trash wsi->desc.sockfd since it took a copy.
- *
- * When it completes it will call compatible_close()
- */
- lws_libuv_closehandle_manually(wsi);
- } else
-#else
- compatible_close(wsi->desc.sockfd);
-#endif
+ if (wsi->context->event_loop_ops->close_handle_manually)
+ wsi->context->event_loop_ops->close_handle_manually(wsi);
+ else
+ compatible_close(wsi->desc.sockfd);
- remove_wsi_socket_from_fds(wsi);
+ __remove_wsi_socket_from_fds(wsi);
-#ifdef LWS_OPENSSL_SUPPORT
- wsi->use_ssl = ssl;
+#if defined(LWS_WITH_TLS)
+ wsi->tls.use_ssl = ssl;
#else
if (ssl) {
lwsl_err("%s: not configured for ssl\n", __func__);
@@ -514,12 +671,12 @@ lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,
#endif
wsi->desc.sockfd = LWS_SOCK_INVALID;
- wsi->state = LWSS_CLIENT_UNCONNECTED;
+ lwsi_set_state(wsi, LRS_UNCONNECTED);
wsi->protocol = NULL;
wsi->pending_timeout = NO_PENDING_TIMEOUT;
wsi->c_port = port;
wsi->hdr_parsing_completed = 0;
- _lws_header_table_reset(wsi->u.hdr.ah);
+ _lws_header_table_reset(wsi->http.ah);
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS, address))
return NULL;
@@ -544,6 +701,10 @@ lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_IFACE,
iface))
return NULL;
+ if (alpn[0])
+ if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_ALPN,
+ alpn))
+ return NULL;
origin[0] = '/';
strncpy(&origin[1], path, sizeof(origin) - 2);
@@ -683,26 +844,68 @@ html_parser_cb(const hubbub_token *token, void *pw)
}
#endif
+#endif
+
+static char *
+lws_strdup(const char *s)
+{
+ char *d = lws_malloc(strlen(s) + 1, "strdup");
+
+ if (d)
+ strcpy(d, s);
+
+ return d;
+}
+
+void
+lws_client_stash_destroy(struct lws *wsi)
+{
+ if (!wsi || !wsi->stash)
+ return;
+
+ lws_free_set_NULL(wsi->stash->address);
+ lws_free_set_NULL(wsi->stash->path);
+ lws_free_set_NULL(wsi->stash->host);
+ lws_free_set_NULL(wsi->stash->origin);
+ lws_free_set_NULL(wsi->stash->protocol);
+ lws_free_set_NULL(wsi->stash->method);
+ lws_free_set_NULL(wsi->stash->iface);
+ lws_free_set_NULL(wsi->stash->alpn);
+
+ lws_free_set_NULL(wsi->stash);
+}
+
LWS_VISIBLE struct lws *
lws_client_connect_via_info(struct lws_client_connect_info *i)
{
struct lws *wsi;
- int v = SPEC_LATEST_SUPPORTED;
const struct lws_protocols *p;
+ const char *local = i->protocol;
if (i->context->requested_kill)
return NULL;
if (!i->context->protocol_init_done)
lws_protocol_init(i->context);
+ /*
+ * If we have .local_protocol_name, use it to select the
+ * local protocol handler to bind to. Otherwise use .protocol if
+ * http[s].
+ */
+ if (i->local_protocol_name)
+ local = i->local_protocol_name;
wsi = lws_zalloc(sizeof(struct lws), "client wsi");
if (wsi == NULL)
goto bail;
wsi->context = i->context;
+#if defined(LWS_ROLE_H1)
/* assert the mode and union status (hdr) clearly */
- lws_union_transition(wsi, LWSCM_HTTP_CLIENT);
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, &role_ops_h1);
+#else
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, &role_ops_raw_skt);
+#endif
wsi->desc.sockfd = LWS_SOCK_INVALID;
/* 1) fill up the wsi with stuff from the connect_info as far as it
@@ -710,26 +913,52 @@ lws_client_connect_via_info(struct lws_client_connect_info *i)
* not even be able to get ahold of an ah at this point.
*/
- /* -1 means just use latest supported */
- if (i->ietf_version_or_minus_one != -1 && i->ietf_version_or_minus_one)
- v = i->ietf_version_or_minus_one;
+ if (!i->method) /* ie, ws */
+#if defined(LWS_ROLE_WS)
+ if (lws_create_client_ws_object(i, wsi))
+ return NULL;
+#else
+ return NULL;
+#endif
- wsi->ietf_spec_revision = v;
wsi->user_space = NULL;
- wsi->state = LWSS_CLIENT_UNCONNECTED;
wsi->pending_timeout = NO_PENDING_TIMEOUT;
- wsi->position_in_fds_table = -1;
+ wsi->position_in_fds_table = LWS_NO_FDS_POS;
wsi->c_port = i->port;
wsi->vhost = i->vhost;
if (!wsi->vhost)
wsi->vhost = i->context->vhost_list;
+ if (!wsi->vhost) {
+ lwsl_err("At least one vhost in the context is required\n");
+
+ goto bail;
+ }
+
wsi->protocol = &wsi->vhost->protocols[0];
+ wsi->client_pipeline = !!(i->ssl_connection & LCCSCF_PIPELINE);
- /* for http[s] connection, allow protocol selection by name */
+ /* reasonable place to start */
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED,
+#if defined(LWS_ROLE_H1)
+ &role_ops_h1);
+#else
+ &role_ops_raw_skt);
+#endif
- if (i->method && i->vhost && i->protocol) {
- p = lws_vhost_name_to_protocol(i->vhost, i->protocol);
+ /*
+ * 1) for http[s] connection, allow protocol selection by name
+ * 2) for ws[s], if local_protocol_name given also use it for
+ * local protocol binding... this defeats the server
+ * protocol negotiation if so
+ *
+ * Otherwise leave at protocols[0]... the server will tell us
+ * which protocol we are associated with since we can give it a
+ * list.
+ */
+ if (/*(i->method || i->local_protocol_name) && */local) {
+ lwsl_info("binding to %s\n", local);
+ p = lws_vhost_name_to_protocol(wsi->vhost, local);
if (p)
wsi->protocol = p;
}
@@ -745,10 +974,10 @@ lws_client_connect_via_info(struct lws_client_connect_info *i)
if (lws_ensure_user_space(wsi))
goto bail;
-#ifdef LWS_OPENSSL_SUPPORT
- wsi->use_ssl = i->ssl_connection;
+#if defined(LWS_WITH_TLS)
+ wsi->tls.use_ssl = i->ssl_connection;
#else
- if (i->ssl_connection) {
+ if (i->ssl_connection & LCCSCF_USE_SSL) {
lwsl_err("libwebsockets not configured for ssl\n");
goto bail;
}
@@ -760,47 +989,63 @@ lws_client_connect_via_info(struct lws_client_connect_info *i)
* things pointed to have gone out of scope.
*/
- wsi->u.hdr.stash = lws_malloc(sizeof(*wsi->u.hdr.stash), "client stash");
- if (!wsi->u.hdr.stash) {
+ wsi->stash = lws_zalloc(sizeof(*wsi->stash), "client stash");
+ if (!wsi->stash) {
lwsl_err("%s: OOM\n", __func__);
- goto bail;
+ goto bail1;
}
- wsi->u.hdr.stash->origin[0] = '\0';
- wsi->u.hdr.stash->protocol[0] = '\0';
- wsi->u.hdr.stash->method[0] = '\0';
- wsi->u.hdr.stash->iface[0] = '\0';
-
- strncpy(wsi->u.hdr.stash->address, i->address,
- sizeof(wsi->u.hdr.stash->address) - 1);
- strncpy(wsi->u.hdr.stash->path, i->path,
- sizeof(wsi->u.hdr.stash->path) - 1);
- strncpy(wsi->u.hdr.stash->host, i->host,
- sizeof(wsi->u.hdr.stash->host) - 1);
- if (i->origin)
- strncpy(wsi->u.hdr.stash->origin, i->origin,
- sizeof(wsi->u.hdr.stash->origin) - 1);
- if (i->protocol)
- strncpy(wsi->u.hdr.stash->protocol, i->protocol,
- sizeof(wsi->u.hdr.stash->protocol) - 1);
- if (i->method)
- strncpy(wsi->u.hdr.stash->method, i->method,
- sizeof(wsi->u.hdr.stash->method) - 1);
- if (i->iface)
- strncpy(wsi->u.hdr.stash->iface, i->iface,
- sizeof(wsi->u.hdr.stash->iface) - 1);
-
- wsi->u.hdr.stash->address[sizeof(wsi->u.hdr.stash->address) - 1] = '\0';
- wsi->u.hdr.stash->path[sizeof(wsi->u.hdr.stash->path) - 1] = '\0';
- wsi->u.hdr.stash->host[sizeof(wsi->u.hdr.stash->host) - 1] = '\0';
- wsi->u.hdr.stash->origin[sizeof(wsi->u.hdr.stash->origin) - 1] = '\0';
- wsi->u.hdr.stash->protocol[sizeof(wsi->u.hdr.stash->protocol) - 1] = '\0';
- wsi->u.hdr.stash->method[sizeof(wsi->u.hdr.stash->method) - 1] = '\0';
- wsi->u.hdr.stash->iface[sizeof(wsi->u.hdr.stash->iface) - 1] = '\0';
+ wsi->stash->address = lws_strdup(i->address);
+ wsi->stash->path = lws_strdup(i->path);
+ wsi->stash->host = lws_strdup(i->host);
+
+ if (!wsi->stash->address || !wsi->stash->path || !wsi->stash->host)
+ goto bail1;
+
+ if (i->origin) {
+ wsi->stash->origin = lws_strdup(i->origin);
+ if (!wsi->stash->origin)
+ goto bail1;
+ }
+ if (i->protocol) {
+ wsi->stash->protocol = lws_strdup(i->protocol);
+ if (!wsi->stash->protocol)
+ goto bail1;
+ }
+ if (i->method) {
+ wsi->stash->method = lws_strdup(i->method);
+ if (!wsi->stash->method)
+ goto bail1;
+ }
+ if (i->iface) {
+ wsi->stash->iface = lws_strdup(i->iface);
+ if (!wsi->stash->iface)
+ goto bail1;
+ }
+ /*
+ * For ws, default to http/1.1 only. If i->alpn is set, defer to
+ * whatever he has set in there (eg, "h2").
+ *
+ * The problem is he has to commit to h2 before he can find out if the
+ * server has the SETTINGS for ws-over-h2 enabled; if not then ws is
+ * not possible on that connection. So we only try it if he
+ * assertively said to use h2 alpn.
+ */
+ if (!i->method && !i->alpn) {
+ wsi->stash->alpn = lws_strdup("http/1.1");
+ if (!wsi->stash->alpn)
+ goto bail1;
+ } else
+ if (i->alpn) {
+ wsi->stash->alpn = lws_strdup(i->alpn);
+ if (!wsi->stash->alpn)
+ goto bail1;
+ }
if (i->pwsi)
*i->pwsi = wsi;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
/* if we went on the waiting list, no probs just return the wsi
* when we get the ah, now or later, he will call
* lws_client_connect_via_info2() below.
@@ -810,9 +1055,11 @@ lws_client_connect_via_info(struct lws_client_connect_info *i)
* if we failed here, the connection is already closed
* and freed.
*/
- goto bail1;
+ goto bail2;
}
+#endif
+
if (i->parent_wsi) {
lwsl_info("%s: created child %p of parent %p\n", __func__,
wsi, i->parent_wsi);
@@ -822,17 +1069,21 @@ lws_client_connect_via_info(struct lws_client_connect_info *i)
}
#ifdef LWS_WITH_HTTP_PROXY
if (i->uri_replace_to)
- wsi->rw = lws_rewrite_create(wsi, html_parser_cb,
+ wsi->http.rw = lws_rewrite_create(wsi, html_parser_cb,
i->uri_replace_from,
i->uri_replace_to);
#endif
return wsi;
+bail1:
+ lws_client_stash_destroy(wsi);
+
bail:
lws_free(wsi);
-
-bail1:
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+bail2:
+#endif
if (i->pwsi)
*i->pwsi = NULL;
@@ -842,28 +1093,27 @@ bail1:
struct lws *
lws_client_connect_via_info2(struct lws *wsi)
{
- struct client_info_stash *stash = wsi->u.hdr.stash;
+ struct client_info_stash *stash = wsi->stash;
if (!stash)
return wsi;
/*
* we're not necessarily in a position to action these right away,
- * stash them... we only need during connect phase so u.hdr is fine
+ * stash them... we only need during connect phase so into a temp
+ * allocated stash
*/
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS,
stash->address))
goto bail1;
- /* these only need u.hdr lifetime as well */
-
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_URI, stash->path))
goto bail1;
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_HOST, stash->host))
goto bail1;
- if (stash->origin[0])
+ if (stash->origin)
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_ORIGIN,
stash->origin))
goto bail1;
@@ -871,45 +1121,28 @@ lws_client_connect_via_info2(struct lws *wsi)
* this is a list of protocols we tell the server we're okay with
* stash it for later when we compare server response with it
*/
- if (stash->protocol[0])
+ if (stash->protocol)
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS,
stash->protocol))
goto bail1;
- if (stash->method[0])
+ if (stash->method)
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_METHOD,
stash->method))
goto bail1;
- if (stash->iface[0])
+ if (stash->iface)
if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_IFACE,
stash->iface))
goto bail1;
+ if (stash->alpn)
+ if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_ALPN,
+ stash->alpn))
+ goto bail1;
#if defined(LWS_WITH_SOCKS5)
if (!wsi->vhost->socks_proxy_port)
- lws_free_set_NULL(wsi->u.hdr.stash);
+ lws_client_stash_destroy(wsi);
#endif
- /*
- * Check with each extension if it is able to route and proxy this
- * connection for us. For example, an extension like x-google-mux
- * can handle this and then we don't need an actual socket for this
- * connection.
- */
-
- if (lws_ext_cb_all_exts(wsi->context, wsi,
- LWS_EXT_CB_CAN_PROXY_CLIENT_CONNECTION,
- (void *)stash->address,
- wsi->c_port) > 0) {
- lwsl_client("lws_client_connect: ext handling conn\n");
-
- lws_set_timeout(wsi,
- PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE,
- AWAITING_TIMEOUT);
-
- wsi->mode = LWSCM_WSCL_WAITING_EXTENSION_CONNECT;
- return wsi;
- }
- lwsl_client("lws_client_connect: direct conn\n");
wsi->context->count_wsi_allocated++;
return lws_client_connect_2(wsi);
@@ -917,7 +1150,7 @@ lws_client_connect_via_info2(struct lws *wsi)
bail1:
#if defined(LWS_WITH_SOCKS5)
if (!wsi->vhost->socks_proxy_port)
- lws_free_set_NULL(wsi->u.hdr.stash);
+ lws_free_set_NULL(wsi->stash);
#endif
return NULL;
@@ -1003,14 +1236,14 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
/* length of the user name */
pt->serv_buf[len++] = n;
/* user name */
- strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_user,
- context->pt_serv_buf_size - len);
+ lws_strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_user,
+ context->pt_serv_buf_size - len + 1);
len += n;
/* length of the password */
pt->serv_buf[len++] = passwd_len;
/* password */
- strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_password,
- context->pt_serv_buf_size - len);
+ lws_strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_password,
+ context->pt_serv_buf_size - len + 1);
len += passwd_len;
break;
@@ -1029,9 +1262,9 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
n = len++;
/* the address we tell SOCKS proxy to connect to */
- strncpy((char *)&(pt->serv_buf[len]), wsi->u.hdr.stash->address,
- context->pt_serv_buf_size - len);
- len += strlen(wsi->u.hdr.stash->address);
+ lws_strncpy((char *)&(pt->serv_buf[len]), wsi->stash->address,
+ context->pt_serv_buf_size - len + 1);
+ len += strlen(wsi->stash->address);
net_num = htons(wsi->c_port);
/* the port we tell SOCKS proxy to connect to */
@@ -1039,7 +1272,7 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
pt->serv_buf[len++] = p[1];
/* the length of the address, excluding port */
- pt->serv_buf[n] = strlen(wsi->u.hdr.stash->address);
+ pt->serv_buf[n] = strlen(wsi->stash->address);
break;
default:
diff --git a/thirdparty/libwebsockets/roles/http/client/client.c b/thirdparty/libwebsockets/roles/http/client/client.c
new file mode 100644
index 0000000000..ce42dc6cd3
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/http/client/client.c
@@ -0,0 +1,1231 @@
+/*
+ * libwebsockets - lib/client/client.c
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+LWS_VISIBLE LWS_EXTERN void
+lws_client_http_body_pending(struct lws *wsi, int something_left_to_send)
+{
+ wsi->client_http_body_pending = !!something_left_to_send;
+}
+
+/*
+ * return self, or queued client wsi we are acting on behalf of
+ *
+ * That is the TAIL of the queue (new queue elements are added at the HEAD)
+ */
+
+struct lws *
+lws_client_wsi_effective(struct lws *wsi)
+{
+ struct lws_dll_lws *tail = NULL;
+
+ if (!wsi->transaction_from_pipeline_queue ||
+ !wsi->dll_client_transaction_queue_head.next)
+ return wsi;
+
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ wsi->dll_client_transaction_queue_head.next) {
+ tail = d;
+ } lws_end_foreach_dll_safe(d, d1);
+
+ return lws_container_of(tail, struct lws,
+ dll_client_transaction_queue);
+}
+
+/*
+ * return self or the guy we are queued under
+ *
+ * REQUIRES VHOST LOCK HELD
+ */
+
+static struct lws *
+_lws_client_wsi_master(struct lws *wsi)
+{
+ struct lws *wsi_eff = wsi;
+ struct lws_dll_lws *d;
+
+ d = wsi->dll_client_transaction_queue.prev;
+ while (d) {
+ wsi_eff = lws_container_of(d, struct lws,
+ dll_client_transaction_queue_head);
+
+ d = d->prev;
+ }
+
+ return wsi_eff;
+}
+
+int
+lws_client_socket_service(struct lws *wsi, struct lws_pollfd *pollfd,
+ struct lws *wsi_conn)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ char *p = (char *)&pt->serv_buf[0];
+ struct lws *w;
+#if defined(LWS_WITH_TLS)
+ char ebuf[128];
+#endif
+ const char *cce = NULL;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ ssize_t len = 0;
+ unsigned char c;
+#endif
+ char *sb = p;
+ int n = 0;
+#if defined(LWS_WITH_SOCKS5)
+ char conn_mode = 0, pending_timeout = 0;
+#endif
+
+ if ((pollfd->revents & LWS_POLLOUT) &&
+ wsi->keepalive_active &&
+ wsi->dll_client_transaction_queue_head.next) {
+ struct lws *wfound = NULL;
+
+ lwsl_debug("%s: pollout HANDSHAKE2\n", __func__);
+
+ /*
+ * We have a transaction queued that wants to pipeline.
+ *
+ * We have to allow it to send headers strictly in the order
+ * that it was queued, ie, tail-first.
+ */
+ lws_vhost_lock(wsi->vhost);
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ wsi->dll_client_transaction_queue_head.next) {
+ struct lws *w = lws_container_of(d, struct lws,
+ dll_client_transaction_queue);
+
+ lwsl_debug("%s: %p states 0x%x\n", __func__, w, w->wsistate);
+ if (lwsi_state(w) == LRS_H1C_ISSUE_HANDSHAKE2)
+ wfound = w;
+ } lws_end_foreach_dll_safe(d, d1);
+
+ if (wfound) {
+ /*
+ * pollfd has the master sockfd in it... we
+ * need to use that in HANDSHAKE2 to understand
+ * which wsi to actually write on
+ */
+ lws_client_socket_service(wfound, pollfd, wsi);
+ lws_callback_on_writable(wsi);
+ } else
+ lwsl_debug("%s: didn't find anything in txn q in HS2\n",
+ __func__);
+
+ lws_vhost_unlock(wsi->vhost);
+
+ return 0;
+ }
+
+ switch (lwsi_state(wsi)) {
+
+ case LRS_WAITING_CONNECT:
+
+ /*
+ * we are under PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE
+ * timeout protection set in client-handshake.c
+ */
+
+ if (!lws_client_connect_2(wsi)) {
+ /* closed */
+ lwsl_client("closed\n");
+ return -1;
+ }
+
+ /* either still pending connection, or changed mode */
+ return 0;
+
+#if defined(LWS_WITH_SOCKS5)
+ /* SOCKS Greeting Reply */
+ case LRS_WAITING_SOCKS_GREETING_REPLY:
+ case LRS_WAITING_SOCKS_AUTH_REPLY:
+ case LRS_WAITING_SOCKS_CONNECT_REPLY:
+
+ /* handle proxy hung up on us */
+
+ if (pollfd->revents & LWS_POLLHUP) {
+ lwsl_warn("SOCKS connection %p (fd=%d) dead\n",
+ (void *)wsi, pollfd->fd);
+ goto bail3;
+ }
+
+ n = recv(wsi->desc.sockfd, sb, context->pt_serv_buf_size, 0);
+ if (n < 0) {
+ if (LWS_ERRNO == LWS_EAGAIN) {
+ lwsl_debug("SOCKS read EAGAIN, retrying\n");
+ return 0;
+ }
+ lwsl_err("ERROR reading from SOCKS socket\n");
+ goto bail3;
+ }
+
+ switch (lwsi_state(wsi)) {
+
+ case LRS_WAITING_SOCKS_GREETING_REPLY:
+ if (pt->serv_buf[0] != SOCKS_VERSION_5)
+ goto socks_reply_fail;
+
+ if (pt->serv_buf[1] == SOCKS_AUTH_NO_AUTH) {
+ lwsl_client("SOCKS GR: No Auth Method\n");
+ socks_generate_msg(wsi, SOCKS_MSG_CONNECT, &len);
+ conn_mode = LRS_WAITING_SOCKS_CONNECT_REPLY;
+ pending_timeout =
+ PENDING_TIMEOUT_AWAITING_SOCKS_CONNECT_REPLY;
+ goto socks_send;
+ }
+
+ if (pt->serv_buf[1] == SOCKS_AUTH_USERNAME_PASSWORD) {
+ lwsl_client("SOCKS GR: User/Pw Method\n");
+ socks_generate_msg(wsi,
+ SOCKS_MSG_USERNAME_PASSWORD,
+ &len);
+ conn_mode = LRS_WAITING_SOCKS_AUTH_REPLY;
+ pending_timeout =
+ PENDING_TIMEOUT_AWAITING_SOCKS_AUTH_REPLY;
+ goto socks_send;
+ }
+ goto socks_reply_fail;
+
+ case LRS_WAITING_SOCKS_AUTH_REPLY:
+ if (pt->serv_buf[0] != SOCKS_SUBNEGOTIATION_VERSION_1 ||
+ pt->serv_buf[1] != SOCKS_SUBNEGOTIATION_STATUS_SUCCESS)
+ goto socks_reply_fail;
+
+ lwsl_client("SOCKS password OK, sending connect\n");
+ socks_generate_msg(wsi, SOCKS_MSG_CONNECT, &len);
+ conn_mode = LRS_WAITING_SOCKS_CONNECT_REPLY;
+ pending_timeout =
+ PENDING_TIMEOUT_AWAITING_SOCKS_CONNECT_REPLY;
+socks_send:
+ n = send(wsi->desc.sockfd, (char *)pt->serv_buf, len,
+ MSG_NOSIGNAL);
+ if (n < 0) {
+ lwsl_debug("ERROR writing to socks proxy\n");
+ goto bail3;
+ }
+
+ lws_set_timeout(wsi, pending_timeout, AWAITING_TIMEOUT);
+ lwsi_set_state(wsi, conn_mode);
+ break;
+
+socks_reply_fail:
+ lwsl_notice("socks reply: v%d, err %d\n",
+ pt->serv_buf[0], pt->serv_buf[1]);
+ goto bail3;
+
+ case LRS_WAITING_SOCKS_CONNECT_REPLY:
+ if (pt->serv_buf[0] != SOCKS_VERSION_5 ||
+ pt->serv_buf[1] != SOCKS_REQUEST_REPLY_SUCCESS)
+ goto socks_reply_fail;
+
+ lwsl_client("socks connect OK\n");
+
+ /* free stash since we are done with it */
+ lws_client_stash_destroy(wsi);
+ if (lws_hdr_simple_create(wsi,
+ _WSI_TOKEN_CLIENT_PEER_ADDRESS,
+ wsi->vhost->socks_proxy_address))
+ goto bail3;
+
+ wsi->c_port = wsi->vhost->socks_proxy_port;
+
+ /* clear his proxy connection timeout */
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+ goto start_ws_handshake;
+ }
+ break;
+#endif
+
+ case LRS_WAITING_PROXY_REPLY:
+
+ /* handle proxy hung up on us */
+
+ if (pollfd->revents & LWS_POLLHUP) {
+
+ lwsl_warn("Proxy connection %p (fd=%d) dead\n",
+ (void *)wsi, pollfd->fd);
+
+ goto bail3;
+ }
+
+ n = recv(wsi->desc.sockfd, sb, context->pt_serv_buf_size, 0);
+ if (n < 0) {
+ if (LWS_ERRNO == LWS_EAGAIN) {
+ lwsl_debug("Proxy read EAGAIN... retrying\n");
+ return 0;
+ }
+ lwsl_err("ERROR reading from proxy socket\n");
+ goto bail3;
+ }
+
+ pt->serv_buf[13] = '\0';
+ if (strcmp(sb, "HTTP/1.0 200 ") &&
+ strcmp(sb, "HTTP/1.1 200 ")) {
+ lwsl_err("ERROR proxy: %s\n", sb);
+ goto bail3;
+ }
+
+ /* clear his proxy connection timeout */
+
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+
+ /* fallthru */
+
+ case LRS_H1C_ISSUE_HANDSHAKE:
+
+ /*
+ * we are under PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE
+ * timeout protection set in client-handshake.c
+ *
+ * take care of our lws_callback_on_writable
+ * happening at a time when there's no real connection yet
+ */
+#if defined(LWS_WITH_SOCKS5)
+start_ws_handshake:
+#endif
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0))
+ return -1;
+
+#if defined(LWS_WITH_TLS)
+ /* we can retry this... just cook the SSL BIO the first time */
+
+ if ((wsi->tls.use_ssl & LCCSCF_USE_SSL) && !wsi->tls.ssl &&
+ lws_ssl_client_bio_create(wsi) < 0) {
+ cce = "bio_create failed";
+ goto bail3;
+ }
+
+ if (wsi->tls.use_ssl & LCCSCF_USE_SSL) {
+ n = lws_ssl_client_connect1(wsi);
+ if (!n)
+ return 0;
+ if (n < 0) {
+ cce = "lws_ssl_client_connect1 failed";
+ goto bail3;
+ }
+ } else
+ wsi->tls.ssl = NULL;
+
+ /* fallthru */
+
+ case LRS_WAITING_SSL:
+
+ if (wsi->tls.use_ssl & LCCSCF_USE_SSL) {
+ n = lws_ssl_client_connect2(wsi, ebuf, sizeof(ebuf));
+ if (!n)
+ return 0;
+ if (n < 0) {
+ cce = ebuf;
+ goto bail3;
+ }
+ } else
+ wsi->tls.ssl = NULL;
+#endif
+#if defined (LWS_WITH_HTTP2)
+ if (wsi->client_h2_alpn) {
+ /*
+ * We connected to the server and set up tls, and
+ * negotiated "h2".
+ *
+ * So this is it, we are an h2 master client connection
+ * now, not an h1 client connection.
+ */
+ lws_tls_server_conn_alpn(wsi);
+
+ /* send the H2 preface to legitimize the connection */
+ if (lws_h2_issue_preface(wsi)) {
+ cce = "error sending h2 preface";
+ goto bail3;
+ }
+
+ break;
+ }
+#endif
+ lwsi_set_state(wsi, LRS_H1C_ISSUE_HANDSHAKE2);
+ lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND,
+ context->timeout_secs);
+
+ /* fallthru */
+
+ case LRS_H1C_ISSUE_HANDSHAKE2:
+ p = lws_generate_client_handshake(wsi, p);
+ if (p == NULL) {
+ if (wsi->role_ops == &role_ops_raw_skt ||
+ wsi->role_ops == &role_ops_raw_file)
+ return 0;
+
+ lwsl_err("Failed to generate handshake for client\n");
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "chs");
+ return 0;
+ }
+
+ /* send our request to the server */
+ lws_latency_pre(context, wsi);
+
+ w = _lws_client_wsi_master(wsi);
+ lwsl_info("%s: HANDSHAKE2: %p: sending headers on %p (wsistate 0x%x 0x%x)\n",
+ __func__, wsi, w, wsi->wsistate, w->wsistate);
+
+ n = lws_ssl_capable_write(w, (unsigned char *)sb, (int)(p - sb));
+ lws_latency(context, wsi, "send lws_issue_raw", n,
+ n == p - sb);
+ switch (n) {
+ case LWS_SSL_CAPABLE_ERROR:
+ lwsl_debug("ERROR writing to client socket\n");
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "cws");
+ return 0;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ lws_callback_on_writable(wsi);
+ break;
+ }
+
+ if (wsi->client_http_body_pending) {
+ lwsi_set_state(wsi, LRS_ISSUE_HTTP_BODY);
+ lws_set_timeout(wsi,
+ PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD,
+ context->timeout_secs);
+ /* user code must ask for writable callback */
+ break;
+ }
+
+ lwsi_set_state(wsi, LRS_WAITING_SERVER_REPLY);
+ wsi->hdr_parsing_completed = 0;
+
+ if (lwsi_state(w) == LRS_IDLING) {
+ lwsi_set_state(w, LRS_WAITING_SERVER_REPLY);
+ w->hdr_parsing_completed = 0;
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ w->http.ah->parser_state = WSI_TOKEN_NAME_PART;
+ w->http.ah->lextable_pos = 0;
+ /* If we're (re)starting on headers, need other implied init */
+ wsi->http.ah->ues = URIES_IDLE;
+#endif
+ }
+
+ lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,
+ wsi->context->timeout_secs);
+
+ lws_callback_on_writable(w);
+
+ goto client_http_body_sent;
+
+ case LRS_ISSUE_HTTP_BODY:
+ if (wsi->client_http_body_pending) {
+ //lws_set_timeout(wsi,
+ // PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD,
+ // context->timeout_secs);
+ /* user code must ask for writable callback */
+ break;
+ }
+client_http_body_sent:
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ /* prepare ourselves to do the parsing */
+ wsi->http.ah->parser_state = WSI_TOKEN_NAME_PART;
+ wsi->http.ah->lextable_pos = 0;
+#endif
+ lwsi_set_state(wsi, LRS_WAITING_SERVER_REPLY);
+ lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,
+ context->timeout_secs);
+ break;
+
+ case LRS_WAITING_SERVER_REPLY:
+ /*
+ * handle server hanging up on us...
+ * but if there is POLLIN waiting, handle that first
+ */
+ if ((pollfd->revents & (LWS_POLLIN | LWS_POLLHUP)) ==
+ LWS_POLLHUP) {
+
+ lwsl_debug("Server connection %p (fd=%d) dead\n",
+ (void *)wsi, pollfd->fd);
+ cce = "Peer hung up";
+ goto bail3;
+ }
+
+ if (!(pollfd->revents & LWS_POLLIN))
+ break;
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ /* interpret the server response
+ *
+ * HTTP/1.1 101 Switching Protocols
+ * Upgrade: websocket
+ * Connection: Upgrade
+ * Sec-WebSocket-Accept: me89jWimTRKTWwrS3aRrL53YZSo=
+ * Sec-WebSocket-Nonce: AQIDBAUGBwgJCgsMDQ4PEC==
+ * Sec-WebSocket-Protocol: chat
+ *
+ * we have to take some care here to only take from the
+ * socket bytewise. The browser may (and has been seen to
+ * in the case that onopen() performs websocket traffic)
+ * coalesce both handshake response and websocket traffic
+ * in one packet, since at that point the connection is
+ * definitively ready from browser pov.
+ */
+ len = 1;
+ while (wsi->http.ah->parser_state != WSI_PARSING_COMPLETE &&
+ len > 0) {
+ int plen = 1;
+
+ n = lws_ssl_capable_read(wsi, &c, 1);
+ lws_latency(context, wsi, "send lws_issue_raw", n,
+ n == 1);
+ switch (n) {
+ case 0:
+ case LWS_SSL_CAPABLE_ERROR:
+ cce = "read failed";
+ goto bail3;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ return 0;
+ }
+
+ if (lws_parse(wsi, &c, &plen)) {
+ lwsl_warn("problems parsing header\n");
+ goto bail3;
+ }
+ }
+
+ /*
+ * hs may also be coming in multiple packets, there is a 5-sec
+ * libwebsocket timeout still active here too, so if parsing did
+ * not complete just wait for next packet coming in this state
+ */
+ if (wsi->http.ah->parser_state != WSI_PARSING_COMPLETE)
+ break;
+
+#endif
+
+ /*
+ * otherwise deal with the handshake. If there's any
+ * packet traffic already arrived we'll trigger poll() again
+ * right away and deal with it that way
+ */
+ return lws_client_interpret_server_handshake(wsi);
+
+bail3:
+ lwsl_info("closing conn at LWS_CONNMODE...SERVER_REPLY\n");
+ if (cce)
+ lwsl_info("reason: %s\n", cce);
+ wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
+ wsi->user_space, (void *)cce, cce ? strlen(cce) : 0);
+ wsi->already_did_cce = 1;
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "cbail3");
+ return -1;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+
+int LWS_WARN_UNUSED_RESULT
+lws_http_transaction_completed_client(struct lws *wsi)
+{
+ struct lws *wsi_eff = lws_client_wsi_effective(wsi);
+
+ lwsl_info("%s: wsi: %p, wsi_eff: %p\n", __func__, wsi, wsi_eff);
+
+ if (user_callback_handle_rxflow(wsi_eff->protocol->callback,
+ wsi_eff, LWS_CALLBACK_COMPLETED_CLIENT_HTTP,
+ wsi_eff->user_space, NULL, 0)) {
+ lwsl_debug("%s: Completed call returned nonzero (role 0x%x)\n",
+ __func__, lwsi_role(wsi_eff));
+ return -1;
+ }
+
+ /*
+ * Are we constitutionally capable of having a queue, ie, we are on
+ * the "active client connections" list?
+ *
+ * If not, that's it for us.
+ */
+
+ if (lws_dll_is_null(&wsi->dll_active_client_conns))
+ return -1;
+
+ /* if this was a queued guy, close him and remove from queue */
+
+ if (wsi->transaction_from_pipeline_queue) {
+ lwsl_debug("closing queued wsi %p\n", wsi_eff);
+ /* so the close doesn't trigger a CCE */
+ wsi_eff->already_did_cce = 1;
+ __lws_close_free_wsi(wsi_eff,
+ LWS_CLOSE_STATUS_CLIENT_TRANSACTION_DONE,
+ "queued client done");
+ }
+
+ /* after the first one, they can only be coming from the queue */
+ wsi->transaction_from_pipeline_queue = 1;
+
+ wsi->http.rx_content_length = 0;
+ wsi->hdr_parsing_completed = 0;
+
+ /* is there a new tail after removing that one? */
+ wsi_eff = lws_client_wsi_effective(wsi);
+
+ /*
+ * Do we have something pipelined waiting?
+ * it's OK if he hasn't managed to send his headers yet... he's next
+ * in line to do that...
+ */
+ if (wsi_eff == wsi) {
+ /*
+ * Nothing pipelined... we should hang around a bit
+ * in case something turns up...
+ */
+ lwsl_info("%s: nothing pipelined waiting\n", __func__);
+ lwsi_set_state(wsi, LRS_IDLING);
+
+ lws_set_timeout(wsi, PENDING_TIMEOUT_CLIENT_CONN_IDLE, 5);
+
+ return 0;
+ }
+
+ /*
+ * H1: we can serialize the queued guys into the same ah
+ * H2: everybody needs their own ah until their own STREAM_END
+ */
+
+ /* otherwise set ourselves up ready to go again */
+ lwsi_set_state(wsi, LRS_WAITING_SERVER_REPLY);
+
+ wsi->http.ah->parser_state = WSI_TOKEN_NAME_PART;
+ wsi->http.ah->lextable_pos = 0;
+
+ lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,
+ wsi->context->timeout_secs);
+
+ /* If we're (re)starting on headers, need other implied init */
+ wsi->http.ah->ues = URIES_IDLE;
+
+ lwsl_info("%s: %p: new queued transaction as %p\n", __func__, wsi, wsi_eff);
+ lws_callback_on_writable(wsi);
+
+ return 0;
+}
+
+LWS_VISIBLE LWS_EXTERN unsigned int
+lws_http_client_http_response(struct lws *wsi)
+{
+ if (!wsi->http.ah)
+ return 0;
+
+ return wsi->http.ah->http_response;
+}
+#endif
+#if defined(LWS_PLAT_OPTEE)
+char *
+strrchr(const char *s, int c)
+{
+ char *hit = NULL;
+
+ while (*s)
+ if (*(s++) == (char)c)
+ hit = (char *)s - 1;
+
+ return hit;
+}
+
+#define atoll atoi
+#endif
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+int
+lws_client_interpret_server_handshake(struct lws *wsi)
+{
+ int n, port = 0, ssl = 0;
+ int close_reason = LWS_CLOSE_STATUS_PROTOCOL_ERR;
+ const char *prot, *ads = NULL, *path, *cce = NULL;
+ struct allocated_headers *ah = NULL;
+ struct lws *w = lws_client_wsi_effective(wsi);
+ char *p, *q;
+ char new_path[300];
+
+ lws_client_stash_destroy(wsi);
+
+ ah = wsi->http.ah;
+ if (!wsi->do_ws) {
+ /* we are being an http client...
+ */
+#if defined(LWS_ROLE_H2)
+ if (wsi->client_h2_alpn || wsi->client_h2_substream) {
+ lwsl_debug("%s: %p: transitioning to h2 client\n", __func__, wsi);
+ lws_role_transition(wsi, LWSIFR_CLIENT,
+ LRS_ESTABLISHED, &role_ops_h2);
+ } else
+#endif
+ {
+#if defined(LWS_ROLE_H1)
+ {
+ lwsl_debug("%s: %p: transitioning to h1 client\n", __func__, wsi);
+ lws_role_transition(wsi, LWSIFR_CLIENT,
+ LRS_ESTABLISHED, &role_ops_h1);
+ }
+#else
+ return -1;
+#endif
+ }
+
+ wsi->http.ah = ah;
+ ah->http_response = 0;
+ }
+
+ /*
+ * well, what the server sent looked reasonable for syntax.
+ * Now let's confirm it sent all the necessary headers
+ *
+ * http (non-ws) client will expect something like this
+ *
+ * HTTP/1.0.200
+ * server:.libwebsockets
+ * content-type:.text/html
+ * content-length:.17703
+ * set-cookie:.test=LWS_1456736240_336776_COOKIE;Max-Age=360000
+ */
+
+ wsi->http.connection_type = HTTP_CONNECTION_KEEP_ALIVE;
+ if (!wsi->client_h2_substream) {
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
+ if (wsi->do_ws && !p) {
+ lwsl_info("no URI\n");
+ cce = "HS: URI missing";
+ goto bail3;
+ }
+ if (!p) {
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP1_0);
+ wsi->http.connection_type = HTTP_CONNECTION_CLOSE;
+ }
+ if (!p) {
+ cce = "HS: URI missing";
+ lwsl_info("no URI\n");
+ goto bail3;
+ }
+ } else {
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COLON_STATUS);
+ if (!p) {
+ cce = "HS: :status missing";
+ lwsl_info("no status\n");
+ goto bail3;
+ }
+ }
+ n = atoi(p);
+ if (ah)
+ ah->http_response = n;
+
+ if (n == 301 || n == 302 || n == 303 || n == 307 || n == 308) {
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_LOCATION);
+ if (!p) {
+ cce = "HS: Redirect code but no Location";
+ goto bail3;
+ }
+
+ /* Relative reference absolute path */
+ if (p[0] == '/') {
+#if defined(LWS_WITH_TLS)
+ ssl = wsi->tls.use_ssl & LCCSCF_USE_SSL;
+#endif
+ ads = lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_PEER_ADDRESS);
+ port = wsi->c_port;
+ /* +1 as lws_client_reset expects leading / omitted */
+ path = p + 1;
+ }
+ /* Absolute (Full) URI */
+ else if (strchr(p, ':')) {
+ if (lws_parse_uri(p, &prot, &ads, &port, &path)) {
+ cce = "HS: URI did not parse";
+ goto bail3;
+ }
+
+ if (!strcmp(prot, "wss") || !strcmp(prot, "https"))
+ ssl = 1;
+ }
+ /* Relative reference relative path */
+ else {
+ /* This doesn't try to calculate an absolute path,
+ * that will be left to the server */
+#if defined(LWS_WITH_TLS)
+ ssl = wsi->tls.use_ssl & LCCSCF_USE_SSL;
+#endif
+ ads = lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_PEER_ADDRESS);
+ port = wsi->c_port;
+ /* +1 as lws_client_reset expects leading / omitted */
+ path = new_path + 1;
+ lws_strncpy(new_path, lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_URI), sizeof(new_path));
+ q = strrchr(new_path, '/');
+ if (q)
+ lws_strncpy(q + 1, p, sizeof(new_path) -
+ (q - new_path));
+ else
+ path = p;
+ }
+
+#if defined(LWS_WITH_TLS)
+ if ((wsi->tls.use_ssl & LCCSCF_USE_SSL) && !ssl) {
+ cce = "HS: Redirect attempted SSL downgrade";
+ goto bail3;
+ }
+#endif
+
+ if (!lws_client_reset(&wsi, ssl, ads, port, path, ads)) {
+ /* there are two ways to fail out with NULL return...
+ * simple, early problem where the wsi is intact, or
+ * we went through with the reconnect attempt and the
+ * wsi is already closed. In the latter case, the wsi
+ * has beet set to NULL additionally.
+ */
+ lwsl_err("Redirect failed\n");
+ cce = "HS: Redirect failed";
+ if (wsi)
+ goto bail3;
+
+ return 1;
+ }
+ return 0;
+ }
+
+ if (!wsi->do_ws) {
+
+ /* if h1 KA is allowed, enable the queued pipeline guys */
+
+ if (!wsi->client_h2_alpn && !wsi->client_h2_substream && w == wsi) { /* ie, coming to this for the first time */
+ if (wsi->http.connection_type == HTTP_CONNECTION_KEEP_ALIVE)
+ wsi->keepalive_active = 1;
+ else {
+ /*
+ * Ugh... now the main http connection has seen
+ * both sides, we learn the server doesn't
+ * support keepalive.
+ *
+ * That means any guys queued on us are going
+ * to have to be restarted from connect2 with
+ * their own connections.
+ */
+
+ /*
+ * stick around telling any new guys they can't
+ * pipeline to this server
+ */
+ wsi->keepalive_rejected = 1;
+
+ lws_vhost_lock(wsi->vhost);
+ lws_start_foreach_dll_safe(struct lws_dll_lws *, d, d1,
+ wsi->dll_client_transaction_queue_head.next) {
+ struct lws *ww = lws_container_of(d, struct lws,
+ dll_client_transaction_queue);
+
+ /* remove him from our queue */
+ lws_dll_lws_remove(&ww->dll_client_transaction_queue);
+ /* give up on pipelining */
+ ww->client_pipeline = 0;
+
+ /* go back to "trying to connect" state */
+ lws_role_transition(ww, LWSIFR_CLIENT,
+ LRS_UNCONNECTED,
+#if defined(LWS_ROLE_H1)
+ &role_ops_h1);
+#else
+#if defined (LWS_ROLE_H2)
+ &role_ops_h2);
+#else
+ &role_ops_raw);
+#endif
+#endif
+ ww->user_space = NULL;
+ } lws_end_foreach_dll_safe(d, d1);
+ lws_vhost_unlock(wsi->vhost);
+ }
+ }
+
+#ifdef LWS_WITH_HTTP_PROXY
+ wsi->http.perform_rewrite = 0;
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE)) {
+ if (!strncmp(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_HTTP_CONTENT_TYPE),
+ "text/html", 9))
+ wsi->http.perform_rewrite = 1;
+ }
+#endif
+
+ /* allocate the per-connection user memory (if any) */
+ if (lws_ensure_user_space(wsi)) {
+ lwsl_err("Problem allocating wsi user mem\n");
+ cce = "HS: OOM";
+ goto bail2;
+ }
+
+ /* he may choose to send us stuff in chunked transfer-coding */
+ wsi->chunked = 0;
+ wsi->chunk_remaining = 0; /* ie, next thing is chunk size */
+ if (lws_hdr_total_length(wsi,
+ WSI_TOKEN_HTTP_TRANSFER_ENCODING)) {
+ wsi->chunked = !strcmp(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_HTTP_TRANSFER_ENCODING),
+ "chunked");
+ /* first thing is hex, after payload there is crlf */
+ wsi->chunk_parser = ELCP_HEX;
+ }
+
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {
+ wsi->http.rx_content_length =
+ atoll(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_HTTP_CONTENT_LENGTH));
+ lwsl_info("%s: incoming content length %llu\n",
+ __func__, (unsigned long long)
+ wsi->http.rx_content_length);
+ wsi->http.rx_content_remain =
+ wsi->http.rx_content_length;
+ } else /* can't do 1.1 without a content length or chunked */
+ if (!wsi->chunked)
+ wsi->http.connection_type =
+ HTTP_CONNECTION_CLOSE;
+
+ /*
+ * we seem to be good to go, give client last chance to check
+ * headers and OK it
+ */
+ if (wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH,
+ wsi->user_space, NULL, 0)) {
+
+ cce = "HS: disallowed by client filter";
+ goto bail2;
+ }
+
+ /* clear his proxy connection timeout */
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+
+ wsi->rxflow_change_to = LWS_RXFLOW_ALLOW;
+
+ /* call him back to inform him he is up */
+ if (wsi->protocol->callback(wsi,
+ LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP,
+ wsi->user_space, NULL, 0)) {
+ cce = "HS: disallowed at ESTABLISHED";
+ goto bail3;
+ }
+
+ /*
+ * for pipelining, master needs to keep his ah... guys who
+ * queued on him can drop it now though.
+ */
+
+ if (w != wsi)
+ /* free up parsing allocations for queued guy */
+ lws_header_table_detach(w, 0);
+
+ lwsl_info("%s: client connection up\n", __func__);
+
+ return 0;
+ }
+
+#if defined(LWS_ROLE_WS)
+ switch (lws_client_ws_upgrade(wsi, &cce)) {
+ case 2:
+ goto bail2;
+ case 3:
+ goto bail3;
+ }
+
+ return 0;
+#endif
+
+bail3:
+ close_reason = LWS_CLOSE_STATUS_NOSTATUS;
+
+bail2:
+ if (wsi->protocol) {
+ n = 0;
+ if (cce)
+ n = (int)strlen(cce);
+ wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
+ wsi->user_space, (void *)cce,
+ (unsigned int)n);
+ }
+ wsi->already_did_cce = 1;
+
+ lwsl_info("closing connection due to bail2 connection error\n");
+
+ /* closing will free up his parsing allocations */
+ lws_close_free_wsi(wsi, close_reason, "c hs interp");
+
+ return 1;
+}
+#endif
+
+char *
+lws_generate_client_handshake(struct lws *wsi, char *pkt)
+{
+ char *p = pkt;
+ const char *meth;
+ const char *pp = lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
+
+ meth = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_METHOD);
+ if (!meth) {
+ meth = "GET";
+ wsi->do_ws = 1;
+ } else {
+ wsi->do_ws = 0;
+ }
+
+ if (!strcmp(meth, "RAW")) {
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+ lwsl_notice("client transition to raw\n");
+
+ if (pp) {
+ const struct lws_protocols *pr;
+
+ pr = lws_vhost_name_to_protocol(wsi->vhost, pp);
+
+ if (!pr) {
+ lwsl_err("protocol %s not enabled on vhost\n",
+ pp);
+ return NULL;
+ }
+
+ lws_bind_protocol(wsi, pr);
+ }
+
+ if ((wsi->protocol->callback)(wsi, LWS_CALLBACK_RAW_ADOPT,
+ wsi->user_space, NULL, 0))
+ return NULL;
+
+ lws_role_transition(wsi, 0, LRS_ESTABLISHED, &role_ops_raw_skt);
+ lws_header_table_detach(wsi, 1);
+
+ return NULL;
+ }
+
+ /*
+ * 04 example client handshake
+ *
+ * GET /chat HTTP/1.1
+ * Host: server.example.com
+ * Upgrade: websocket
+ * Connection: Upgrade
+ * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
+ * Sec-WebSocket-Origin: http://example.com
+ * Sec-WebSocket-Protocol: chat, superchat
+ * Sec-WebSocket-Version: 4
+ */
+
+ p += sprintf(p, "%s %s HTTP/1.1\x0d\x0a", meth,
+ lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_URI));
+
+ p += sprintf(p, "Pragma: no-cache\x0d\x0a"
+ "Cache-Control: no-cache\x0d\x0a");
+
+ p += sprintf(p, "Host: %s\x0d\x0a",
+ lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_HOST));
+
+ if (lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ORIGIN)) {
+ if (lws_check_opt(wsi->context->options,
+ LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN))
+ p += sprintf(p, "Origin: %s\x0d\x0a",
+ lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_ORIGIN));
+ else
+ p += sprintf(p, "Origin: http://%s\x0d\x0a",
+ lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_ORIGIN));
+ }
+#if defined(LWS_ROLE_WS)
+ if (wsi->do_ws)
+ p = lws_generate_client_ws_handshake(wsi, p);
+#endif
+
+ /* give userland a chance to append, eg, cookies */
+
+ if (wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER,
+ wsi->user_space, &p,
+ (pkt + wsi->context->pt_serv_buf_size) - p - 12))
+ return NULL;
+
+ p += sprintf(p, "\x0d\x0a");
+
+ return p;
+}
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+
+LWS_VISIBLE int
+lws_http_client_read(struct lws *wsi, char **buf, int *len)
+{
+ int rlen, n;
+
+ rlen = lws_ssl_capable_read(wsi, (unsigned char *)*buf, *len);
+ *len = 0;
+
+ // lwsl_notice("%s: rlen %d\n", __func__, rlen);
+
+ /* allow the source to signal he has data again next time */
+ lws_change_pollfd(wsi, 0, LWS_POLLIN);
+
+ if (rlen == LWS_SSL_CAPABLE_ERROR) {
+ lwsl_notice("%s: SSL capable error\n", __func__);
+ return -1;
+ }
+
+ if (rlen == 0)
+ return -1;
+
+ if (rlen < 0)
+ return 0;
+
+ *len = rlen;
+ wsi->client_rx_avail = 0;
+
+ /*
+ * server may insist on transfer-encoding: chunked,
+ * so http client must deal with it
+ */
+spin_chunks:
+ while (wsi->chunked && (wsi->chunk_parser != ELCP_CONTENT) && *len) {
+ switch (wsi->chunk_parser) {
+ case ELCP_HEX:
+ if ((*buf)[0] == '\x0d') {
+ wsi->chunk_parser = ELCP_CR;
+ break;
+ }
+ n = char_to_hex((*buf)[0]);
+ if (n < 0) {
+ lwsl_debug("chunking failure\n");
+ return -1;
+ }
+ wsi->chunk_remaining <<= 4;
+ wsi->chunk_remaining |= n;
+ break;
+ case ELCP_CR:
+ if ((*buf)[0] != '\x0a') {
+ lwsl_debug("chunking failure\n");
+ return -1;
+ }
+ wsi->chunk_parser = ELCP_CONTENT;
+ lwsl_info("chunk %d\n", wsi->chunk_remaining);
+ if (wsi->chunk_remaining)
+ break;
+ lwsl_info("final chunk\n");
+ goto completed;
+
+ case ELCP_CONTENT:
+ break;
+
+ case ELCP_POST_CR:
+ if ((*buf)[0] != '\x0d') {
+ lwsl_debug("chunking failure\n");
+
+ return -1;
+ }
+
+ wsi->chunk_parser = ELCP_POST_LF;
+ break;
+
+ case ELCP_POST_LF:
+ if ((*buf)[0] != '\x0a')
+ return -1;
+
+ wsi->chunk_parser = ELCP_HEX;
+ wsi->chunk_remaining = 0;
+ break;
+ }
+ (*buf)++;
+ (*len)--;
+ }
+
+ if (wsi->chunked && !wsi->chunk_remaining)
+ return 0;
+
+ if (wsi->http.rx_content_remain &&
+ wsi->http.rx_content_remain < (unsigned int)*len)
+ n = (int)wsi->http.rx_content_remain;
+ else
+ n = *len;
+
+ if (wsi->chunked && wsi->chunk_remaining &&
+ wsi->chunk_remaining < n)
+ n = wsi->chunk_remaining;
+
+#ifdef LWS_WITH_HTTP_PROXY
+ /* hubbub */
+ if (wsi->http.perform_rewrite)
+ lws_rewrite_parse(wsi->http.rw, (unsigned char *)*buf, n);
+ else
+#endif
+ {
+ struct lws *wsi_eff = lws_client_wsi_effective(wsi);
+
+ if (user_callback_handle_rxflow(wsi_eff->protocol->callback,
+ wsi_eff, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ,
+ wsi_eff->user_space, *buf, n)) {
+ lwsl_debug("%s: RECEIVE_CLIENT_HTTP_READ returned -1\n",
+ __func__);
+
+ return -1;
+ }
+ }
+
+ if (wsi->chunked && wsi->chunk_remaining) {
+ (*buf) += n;
+ wsi->chunk_remaining -= n;
+ *len -= n;
+ }
+
+ if (wsi->chunked && !wsi->chunk_remaining)
+ wsi->chunk_parser = ELCP_POST_CR;
+
+ if (wsi->chunked && *len)
+ goto spin_chunks;
+
+ if (wsi->chunked)
+ return 0;
+
+ /* if we know the content length, decrement the content remaining */
+ if (wsi->http.rx_content_length > 0)
+ wsi->http.rx_content_remain -= n;
+
+ // lwsl_notice("rx_content_remain %lld, rx_content_length %lld\n",
+ // wsi->http.rx_content_remain, wsi->http.rx_content_length);
+
+ if (wsi->http.rx_content_remain || !wsi->http.rx_content_length)
+ return 0;
+
+completed:
+
+ if (lws_http_transaction_completed_client(wsi)) {
+ lwsl_notice("%s: transaction completed says -1\n", __func__);
+ return -1;
+ }
+
+ return 0;
+}
+
+#endif \ No newline at end of file
diff --git a/thirdparty/lws/header.c b/thirdparty/libwebsockets/roles/http/header.c
index e2562cd6ea..99e56f7564 100644
--- a/thirdparty/lws/header.c
+++ b/thirdparty/libwebsockets/roles/http/header.c
@@ -19,12 +19,12 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
-
+#include "core/private.h"
#include "lextable-strings.h"
-const unsigned char *lws_token_to_string(enum lws_token_indexes token)
+const unsigned char *
+lws_token_to_string(enum lws_token_indexes token)
{
if ((unsigned int)token >= ARRAY_SIZE(set))
return NULL;
@@ -38,7 +38,7 @@ lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
unsigned char **p, unsigned char *end)
{
#ifdef LWS_WITH_HTTP2
- if (wsi->mode == LWSCM_HTTP2_SERVING)
+ if (lwsi_role_h2(wsi) || lwsi_role_h2_ENCAPSULATION(wsi))
return lws_add_http2_header_by_name(wsi, name,
value, length, p, end);
#else
@@ -66,7 +66,7 @@ int lws_finalize_http_header(struct lws *wsi, unsigned char **p,
unsigned char *end)
{
#ifdef LWS_WITH_HTTP2
- if (wsi->mode == LWSCM_HTTP2_SERVING)
+ if (lwsi_role_h2(wsi) || lwsi_role_h2_ENCAPSULATION(wsi))
return 0;
#else
(void)wsi;
@@ -80,19 +80,39 @@ int lws_finalize_http_header(struct lws *wsi, unsigned char **p,
}
int
+lws_finalize_write_http_header(struct lws *wsi, unsigned char *start,
+ unsigned char **pp, unsigned char *end)
+{
+ unsigned char *p;
+ int len;
+
+ if (lws_finalize_http_header(wsi, pp, end))
+ return 1;
+
+ p = *pp;
+ len = lws_ptr_diff(p, start);
+
+ if (lws_write(wsi, start, len, LWS_WRITE_HTTP_HEADERS) != len)
+ return 1;
+
+ return 0;
+}
+
+int
lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
const unsigned char *value, int length,
unsigned char **p, unsigned char *end)
{
const unsigned char *name;
#ifdef LWS_WITH_HTTP2
- if (wsi->mode == LWSCM_HTTP2_SERVING)
+ if (lwsi_role_h2(wsi) || lwsi_role_h2_ENCAPSULATION(wsi))
return lws_add_http2_header_by_token(wsi, token, value,
length, p, end);
#endif
name = lws_token_to_string(token);
if (!name)
return 1;
+
return lws_add_http_header_by_name(wsi, name, value, length, p, end);
}
@@ -107,8 +127,31 @@ int lws_add_http_header_content_length(struct lws *wsi,
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH,
(unsigned char *)b, n, p, end))
return 1;
- wsi->u.http.tx_content_length = content_length;
- wsi->u.http.tx_content_remain = content_length;
+ wsi->http.tx_content_length = content_length;
+ wsi->http.tx_content_remain = content_length;
+
+ lwsl_info("%s: wsi %p: tx_content_length/remain %llu\n", __func__,
+ wsi, (unsigned long long)content_length);
+
+ return 0;
+}
+
+int
+lws_add_http_common_headers(struct lws *wsi, unsigned int code,
+ const char *content_type, lws_filepos_t content_len,
+ unsigned char **p, unsigned char *end)
+{
+ if (lws_add_http_header_status(wsi, code, p, end))
+ return 1;
+
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE,
+ (unsigned char *)content_type,
+ (int)strlen(content_type), p, end))
+ return 1;
+
+ if (content_len != LWS_ILLEGAL_HTTP_CONTENT_LEN &&
+ lws_add_http_header_content_length(wsi, content_len, p, end))
+ return 1;
return 0;
}
@@ -157,11 +200,11 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
int n;
#ifdef LWS_WITH_ACCESS_LOG
- wsi->access_log.response = code;
+ wsi->http.access_log.response = code;
#endif
#ifdef LWS_WITH_HTTP2
- if (wsi->mode == LWSCM_HTTP2_SERVING)
+ if (lwsi_role_h2(wsi) || lwsi_role_h2_ENCAPSULATION(wsi))
return lws_add_http2_header_status(wsi, code, p, end);
#endif
if (code >= 400 && code < (400 + ARRAY_SIZE(err400)))
@@ -171,18 +214,16 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
if (code == 100)
description = "Continue";
-
if (code == 200)
description = "OK";
-
if (code == 304)
description = "Not Modified";
else
if (code >= 300 && code < 400)
description = "Redirect";
- if (wsi->u.http.request_version < ARRAY_SIZE(hver))
- p1 = hver[wsi->u.http.request_version];
+ if (wsi->http.request_version < ARRAY_SIZE(hver))
+ p1 = hver[wsi->http.request_version];
else
p1 = hver[0];
@@ -196,7 +237,7 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
if (lws_add_http_header_by_name(wsi,
(const unsigned char *)headers->name,
(unsigned char *)headers->value,
- strlen(headers->value), p, end))
+ (int)strlen(headers->value), p, end))
return 1;
headers = headers->next;
@@ -231,6 +272,26 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
int n = 0, m = 0, len;
char slen[20];
+ if (!wsi->vhost) {
+ lwsl_err("%s: wsi not bound to vhost\n", __func__);
+
+ return 1;
+ }
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ if (!wsi->handling_404 &&
+ wsi->vhost->http.error_document_404 &&
+ code == HTTP_STATUS_NOT_FOUND)
+ /* we should do a redirect, and do the 404 there */
+ if (lws_http_redirect(wsi, HTTP_STATUS_FOUND,
+ (uint8_t *)wsi->vhost->http.error_document_404,
+ (int)strlen(wsi->vhost->http.error_document_404),
+ &p, end) > 0)
+ return 0;
+#endif
+
+ /* if the redirect failed, just do a simple status */
+ p = start;
+
if (!html_body)
html_body = "";
@@ -242,12 +303,11 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
&p, end))
return 1;
- len = 35 + strlen(html_body) + sprintf(slen, "%d", code);
+ len = 35 + (int)strlen(html_body) + sprintf(slen, "%d", code);
n = sprintf(slen, "%d", len);
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH,
- (unsigned char *)slen, n,
- &p, end))
+ (unsigned char *)slen, n, &p, end))
return 1;
if (lws_finalize_http_header(wsi, &p, end))
@@ -270,7 +330,7 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
* Solve it by writing the headers now...
*/
m = lws_write(wsi, start, p - start, LWS_WRITE_HTTP_HEADERS);
- if (m != (int)(p - start))
+ if (m != lws_ptr_diff(p, start))
return 1;
/*
@@ -281,15 +341,15 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
len = sprintf((char *)body,
"<html><body><h1>%u</h1>%s</body></html>",
code, html_body);
- wsi->u.http.tx_content_length = len;
- wsi->u.http.tx_content_remain = len;
+ wsi->http.tx_content_length = len;
+ wsi->http.tx_content_remain = len;
- wsi->u.h2.pending_status_body = lws_malloc(len + LWS_PRE + 1,
+ wsi->h2.pending_status_body = lws_malloc(len + LWS_PRE + 1,
"pending status body");
- if (!wsi->u.h2.pending_status_body)
+ if (!wsi->h2.pending_status_body)
return -1;
- strcpy(wsi->u.h2.pending_status_body + LWS_PRE,
+ strcpy(wsi->h2.pending_status_body + LWS_PRE,
(const char *)body);
lws_callback_on_writable(wsi);
@@ -305,15 +365,12 @@ lws_return_http_status(struct lws *wsi, unsigned int code,
"<html><body><h1>%u</h1>%s</body></html>",
code, html_body);
- n = (int)(p - start);
-
+ n = lws_ptr_diff(p, start);
m = lws_write(wsi, start, n, LWS_WRITE_HTTP);
if (m != n)
return 1;
}
- lwsl_notice("%s: return\n", __func__);
-
return m != n;
}
@@ -322,34 +379,29 @@ lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
unsigned char **p, unsigned char *end)
{
unsigned char *start = *p;
- int n;
if (lws_add_http_header_status(wsi, code, p, end))
return -1;
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_LOCATION,
- loc, len, p, end))
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_LOCATION, loc, len,
+ p, end))
return -1;
/*
* if we're going with http/1.1 and keepalive, we have to give fake
* content metadata so the client knows we completed the transaction and
* it can do the redirect...
*/
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_CONTENT_TYPE,
- (unsigned char *)"text/html", 9,
- p, end))
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE,
+ (unsigned char *)"text/html", 9, p,
+ end))
return -1;
- if (lws_add_http_header_by_token(wsi,
- WSI_TOKEN_HTTP_CONTENT_LENGTH,
- (unsigned char *)"0", 1, p, end))
+ if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH,
+ (unsigned char *)"0", 1, p, end))
return -1;
if (lws_finalize_http_header(wsi, p, end))
return -1;
- n = lws_write(wsi, start, *p - start, LWS_WRITE_HTTP_HEADERS | LWS_WRITE_H2_STREAM_END);
-
- return n;
+ return lws_write(wsi, start, *p - start, LWS_WRITE_HTTP_HEADERS |
+ LWS_WRITE_H2_STREAM_END);
}
diff --git a/thirdparty/lws/lextable-strings.h b/thirdparty/libwebsockets/roles/http/lextable-strings.h
index ab42c3e476..631f5cb600 100644
--- a/thirdparty/lws/lextable-strings.h
+++ b/thirdparty/libwebsockets/roles/http/lextable-strings.h
@@ -98,6 +98,10 @@ STORE_IN_ROM static const char * const set[] = {
"connect ",
"head ",
"te:", /* http/2 wants it to reject it */
+ "replay-nonce:", /* ACME */
+ ":protocol", /* defined in mcmanus-httpbis-h2-ws-02 */
+
+ "x-auth-token:",
"", /* not matchable */
diff --git a/thirdparty/libwebsockets/roles/http/lextable.h b/thirdparty/libwebsockets/roles/http/lextable.h
new file mode 100644
index 0000000000..9a8063b157
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/http/lextable.h
@@ -0,0 +1,838 @@
+/* pos 0000: 0 */ 0x67 /* 'g' */, 0x40, 0x00 /* (to 0x0040 state 1) */,
+ 0x70 /* 'p' */, 0x42, 0x00 /* (to 0x0045 state 5) */,
+ 0x6F /* 'o' */, 0x51, 0x00 /* (to 0x0057 state 10) */,
+ 0x68 /* 'h' */, 0x5D, 0x00 /* (to 0x0066 state 18) */,
+ 0x63 /* 'c' */, 0x69, 0x00 /* (to 0x0075 state 23) */,
+ 0x75 /* 'u' */, 0x8A, 0x00 /* (to 0x0099 state 34) */,
+ 0x73 /* 's' */, 0xA0, 0x00 /* (to 0x00B2 state 48) */,
+ 0x0D /* '.' */, 0xD9, 0x00 /* (to 0x00EE state 68) */,
+ 0x61 /* 'a' */, 0x31, 0x01 /* (to 0x0149 state 129) */,
+ 0x69 /* 'i' */, 0x70, 0x01 /* (to 0x018B state 163) */,
+ 0x64 /* 'd' */, 0x19, 0x02 /* (to 0x0237 state 265) */,
+ 0x72 /* 'r' */, 0x22, 0x02 /* (to 0x0243 state 270) */,
+ 0x3A /* ':' */, 0x56, 0x02 /* (to 0x027A state 299) */,
+ 0x65 /* 'e' */, 0xE8, 0x02 /* (to 0x030F state 409) */,
+ 0x66 /* 'f' */, 0x04, 0x03 /* (to 0x032E state 425) */,
+ 0x6C /* 'l' */, 0x26, 0x03 /* (to 0x0353 state 458) */,
+ 0x6D /* 'm' */, 0x49, 0x03 /* (to 0x0379 state 484) */,
+ 0x74 /* 't' */, 0xB8, 0x03 /* (to 0x03EB state 578) */,
+ 0x76 /* 'v' */, 0xD9, 0x03 /* (to 0x040F state 606) */,
+ 0x77 /* 'w' */, 0xE6, 0x03 /* (to 0x041F state 614) */,
+ 0x78 /* 'x' */, 0x0D, 0x04 /* (to 0x0449 state 650) */,
+ 0x08, /* fail */
+/* pos 0040: 1 */ 0xE5 /* 'e' -> */,
+/* pos 0041: 2 */ 0xF4 /* 't' -> */,
+/* pos 0042: 3 */ 0xA0 /* ' ' -> */,
+/* pos 0043: 4 */ 0x00, 0x00 /* - terminal marker 0 - */,
+/* pos 0045: 5 */ 0x6F /* 'o' */, 0x0D, 0x00 /* (to 0x0052 state 6) */,
+ 0x72 /* 'r' */, 0x95, 0x01 /* (to 0x01DD state 211) */,
+ 0x61 /* 'a' */, 0xE6, 0x03 /* (to 0x0431 state 631) */,
+ 0x75 /* 'u' */, 0xE8, 0x03 /* (to 0x0436 state 635) */,
+ 0x08, /* fail */
+/* pos 0052: 6 */ 0xF3 /* 's' -> */,
+/* pos 0053: 7 */ 0xF4 /* 't' -> */,
+/* pos 0054: 8 */ 0xA0 /* ' ' -> */,
+/* pos 0055: 9 */ 0x00, 0x01 /* - terminal marker 1 - */,
+/* pos 0057: 10 */ 0x70 /* 'p' */, 0x07, 0x00 /* (to 0x005E state 11) */,
+ 0x72 /* 'r' */, 0x51, 0x00 /* (to 0x00AB state 42) */,
+ 0x08, /* fail */
+/* pos 005e: 11 */ 0xF4 /* 't' -> */,
+/* pos 005f: 12 */ 0xE9 /* 'i' -> */,
+/* pos 0060: 13 */ 0xEF /* 'o' -> */,
+/* pos 0061: 14 */ 0xEE /* 'n' -> */,
+/* pos 0062: 15 */ 0xF3 /* 's' -> */,
+/* pos 0063: 16 */ 0xA0 /* ' ' -> */,
+/* pos 0064: 17 */ 0x00, 0x02 /* - terminal marker 2 - */,
+/* pos 0066: 18 */ 0x6F /* 'o' */, 0x0A, 0x00 /* (to 0x0070 state 19) */,
+ 0x74 /* 't' */, 0xBF, 0x00 /* (to 0x0128 state 110) */,
+ 0x65 /* 'e' */, 0x04, 0x04 /* (to 0x0470 state 676) */,
+ 0x08, /* fail */
+/* pos 0070: 19 */ 0xF3 /* 's' -> */,
+/* pos 0071: 20 */ 0xF4 /* 't' -> */,
+/* pos 0072: 21 */ 0xBA /* ':' -> */,
+/* pos 0073: 22 */ 0x00, 0x03 /* - terminal marker 3 - */,
+/* pos 0075: 23 */ 0x6F /* 'o' */, 0x07, 0x00 /* (to 0x007C state 24) */,
+ 0x61 /* 'a' */, 0x72, 0x01 /* (to 0x01EA state 217) */,
+ 0x08, /* fail */
+/* pos 007c: 24 */ 0x6E /* 'n' */, 0x07, 0x00 /* (to 0x0083 state 25) */,
+ 0x6F /* 'o' */, 0x87, 0x01 /* (to 0x0206 state 243) */,
+ 0x08, /* fail */
+/* pos 0083: 25 */ 0x6E /* 'n' */, 0x07, 0x00 /* (to 0x008A state 26) */,
+ 0x74 /* 't' */, 0x86, 0x01 /* (to 0x020C state 248) */,
+ 0x08, /* fail */
+/* pos 008a: 26 */ 0xE5 /* 'e' -> */,
+/* pos 008b: 27 */ 0xE3 /* 'c' -> */,
+/* pos 008c: 28 */ 0xF4 /* 't' -> */,
+/* pos 008d: 29 */ 0x69 /* 'i' */, 0x07, 0x00 /* (to 0x0094 state 30) */,
+ 0x20 /* ' ' */, 0xDE, 0x03 /* (to 0x046E state 675) */,
+ 0x08, /* fail */
+/* pos 0094: 30 */ 0xEF /* 'o' -> */,
+/* pos 0095: 31 */ 0xEE /* 'n' -> */,
+/* pos 0096: 32 */ 0xBA /* ':' -> */,
+/* pos 0097: 33 */ 0x00, 0x04 /* - terminal marker 4 - */,
+/* pos 0099: 34 */ 0x70 /* 'p' */, 0x0A, 0x00 /* (to 0x00A3 state 35) */,
+ 0x73 /* 's' */, 0x68, 0x03 /* (to 0x0404 state 596) */,
+ 0x72 /* 'r' */, 0xA0, 0x03 /* (to 0x043F state 642) */,
+ 0x08, /* fail */
+/* pos 00a3: 35 */ 0xE7 /* 'g' -> */,
+/* pos 00a4: 36 */ 0xF2 /* 'r' -> */,
+/* pos 00a5: 37 */ 0xE1 /* 'a' -> */,
+/* pos 00a6: 38 */ 0xE4 /* 'd' -> */,
+/* pos 00a7: 39 */ 0xE5 /* 'e' -> */,
+/* pos 00a8: 40 */ 0xBA /* ':' -> */,
+/* pos 00a9: 41 */ 0x00, 0x05 /* - terminal marker 5 - */,
+/* pos 00ab: 42 */ 0xE9 /* 'i' -> */,
+/* pos 00ac: 43 */ 0xE7 /* 'g' -> */,
+/* pos 00ad: 44 */ 0xE9 /* 'i' -> */,
+/* pos 00ae: 45 */ 0xEE /* 'n' -> */,
+/* pos 00af: 46 */ 0xBA /* ':' -> */,
+/* pos 00b0: 47 */ 0x00, 0x06 /* - terminal marker 6 - */,
+/* pos 00b2: 48 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x00B9 state 49) */,
+ 0x74 /* 't' */, 0x1C, 0x03 /* (to 0x03D1 state 553) */,
+ 0x08, /* fail */
+/* pos 00b9: 49 */ 0x63 /* 'c' */, 0x0A, 0x00 /* (to 0x00C3 state 50) */,
+ 0x72 /* 'r' */, 0x05, 0x03 /* (to 0x03C1 state 539) */,
+ 0x74 /* 't' */, 0x08, 0x03 /* (to 0x03C7 state 544) */,
+ 0x08, /* fail */
+/* pos 00c3: 50 */ 0xAD /* '-' -> */,
+/* pos 00c4: 51 */ 0xF7 /* 'w' -> */,
+/* pos 00c5: 52 */ 0xE5 /* 'e' -> */,
+/* pos 00c6: 53 */ 0xE2 /* 'b' -> */,
+/* pos 00c7: 54 */ 0xF3 /* 's' -> */,
+/* pos 00c8: 55 */ 0xEF /* 'o' -> */,
+/* pos 00c9: 56 */ 0xE3 /* 'c' -> */,
+/* pos 00ca: 57 */ 0xEB /* 'k' -> */,
+/* pos 00cb: 58 */ 0xE5 /* 'e' -> */,
+/* pos 00cc: 59 */ 0xF4 /* 't' -> */,
+/* pos 00cd: 60 */ 0xAD /* '-' -> */,
+/* pos 00ce: 61 */ 0x64 /* 'd' */, 0x19, 0x00 /* (to 0x00E7 state 62) */,
+ 0x65 /* 'e' */, 0x20, 0x00 /* (to 0x00F1 state 70) */,
+ 0x6B /* 'k' */, 0x29, 0x00 /* (to 0x00FD state 81) */,
+ 0x70 /* 'p' */, 0x38, 0x00 /* (to 0x010F state 88) */,
+ 0x61 /* 'a' */, 0x3F, 0x00 /* (to 0x0119 state 97) */,
+ 0x6E /* 'n' */, 0x44, 0x00 /* (to 0x0121 state 104) */,
+ 0x76 /* 'v' */, 0x89, 0x01 /* (to 0x0269 state 284) */,
+ 0x6F /* 'o' */, 0x8F, 0x01 /* (to 0x0272 state 292) */,
+ 0x08, /* fail */
+/* pos 00e7: 62 */ 0xF2 /* 'r' -> */,
+/* pos 00e8: 63 */ 0xE1 /* 'a' -> */,
+/* pos 00e9: 64 */ 0xE6 /* 'f' -> */,
+/* pos 00ea: 65 */ 0xF4 /* 't' -> */,
+/* pos 00eb: 66 */ 0xBA /* ':' -> */,
+/* pos 00ec: 67 */ 0x00, 0x07 /* - terminal marker 7 - */,
+/* pos 00ee: 68 */ 0x8A /* '.' -> */,
+/* pos 00ef: 69 */ 0x00, 0x08 /* - terminal marker 8 - */,
+/* pos 00f1: 70 */ 0xF8 /* 'x' -> */,
+/* pos 00f2: 71 */ 0xF4 /* 't' -> */,
+/* pos 00f3: 72 */ 0xE5 /* 'e' -> */,
+/* pos 00f4: 73 */ 0xEE /* 'n' -> */,
+/* pos 00f5: 74 */ 0xF3 /* 's' -> */,
+/* pos 00f6: 75 */ 0xE9 /* 'i' -> */,
+/* pos 00f7: 76 */ 0xEF /* 'o' -> */,
+/* pos 00f8: 77 */ 0xEE /* 'n' -> */,
+/* pos 00f9: 78 */ 0xF3 /* 's' -> */,
+/* pos 00fa: 79 */ 0xBA /* ':' -> */,
+/* pos 00fb: 80 */ 0x00, 0x09 /* - terminal marker 9 - */,
+/* pos 00fd: 81 */ 0xE5 /* 'e' -> */,
+/* pos 00fe: 82 */ 0xF9 /* 'y' -> */,
+/* pos 00ff: 83 */ 0x31 /* '1' */, 0x0A, 0x00 /* (to 0x0109 state 84) */,
+ 0x32 /* '2' */, 0x0A, 0x00 /* (to 0x010C state 86) */,
+ 0x3A /* ':' */, 0x62, 0x01 /* (to 0x0267 state 283) */,
+ 0x08, /* fail */
+/* pos 0109: 84 */ 0xBA /* ':' -> */,
+/* pos 010a: 85 */ 0x00, 0x0A /* - terminal marker 10 - */,
+/* pos 010c: 86 */ 0xBA /* ':' -> */,
+/* pos 010d: 87 */ 0x00, 0x0B /* - terminal marker 11 - */,
+/* pos 010f: 88 */ 0xF2 /* 'r' -> */,
+/* pos 0110: 89 */ 0xEF /* 'o' -> */,
+/* pos 0111: 90 */ 0xF4 /* 't' -> */,
+/* pos 0112: 91 */ 0xEF /* 'o' -> */,
+/* pos 0113: 92 */ 0xE3 /* 'c' -> */,
+/* pos 0114: 93 */ 0xEF /* 'o' -> */,
+/* pos 0115: 94 */ 0xEC /* 'l' -> */,
+/* pos 0116: 95 */ 0xBA /* ':' -> */,
+/* pos 0117: 96 */ 0x00, 0x0C /* - terminal marker 12 - */,
+/* pos 0119: 97 */ 0xE3 /* 'c' -> */,
+/* pos 011a: 98 */ 0xE3 /* 'c' -> */,
+/* pos 011b: 99 */ 0xE5 /* 'e' -> */,
+/* pos 011c: 100 */ 0xF0 /* 'p' -> */,
+/* pos 011d: 101 */ 0xF4 /* 't' -> */,
+/* pos 011e: 102 */ 0xBA /* ':' -> */,
+/* pos 011f: 103 */ 0x00, 0x0D /* - terminal marker 13 - */,
+/* pos 0121: 104 */ 0xEF /* 'o' -> */,
+/* pos 0122: 105 */ 0xEE /* 'n' -> */,
+/* pos 0123: 106 */ 0xE3 /* 'c' -> */,
+/* pos 0124: 107 */ 0xE5 /* 'e' -> */,
+/* pos 0125: 108 */ 0xBA /* ':' -> */,
+/* pos 0126: 109 */ 0x00, 0x0E /* - terminal marker 14 - */,
+/* pos 0128: 110 */ 0xF4 /* 't' -> */,
+/* pos 0129: 111 */ 0xF0 /* 'p' -> */,
+/* pos 012a: 112 */ 0x2F /* '/' */, 0x07, 0x00 /* (to 0x0131 state 113) */,
+ 0x32 /* '2' */, 0x10, 0x00 /* (to 0x013D state 118) */,
+ 0x08, /* fail */
+/* pos 0131: 113 */ 0xB1 /* '1' -> */,
+/* pos 0132: 114 */ 0xAE /* '.' -> */,
+/* pos 0133: 115 */ 0x31 /* '1' */, 0x07, 0x00 /* (to 0x013A state 116) */,
+ 0x30 /* '0' */, 0x27, 0x03 /* (to 0x045D state 660) */,
+ 0x08, /* fail */
+/* pos 013a: 116 */ 0xA0 /* ' ' -> */,
+/* pos 013b: 117 */ 0x00, 0x0F /* - terminal marker 15 - */,
+/* pos 013d: 118 */ 0xAD /* '-' -> */,
+/* pos 013e: 119 */ 0xF3 /* 's' -> */,
+/* pos 013f: 120 */ 0xE5 /* 'e' -> */,
+/* pos 0140: 121 */ 0xF4 /* 't' -> */,
+/* pos 0141: 122 */ 0xF4 /* 't' -> */,
+/* pos 0142: 123 */ 0xE9 /* 'i' -> */,
+/* pos 0143: 124 */ 0xEE /* 'n' -> */,
+/* pos 0144: 125 */ 0xE7 /* 'g' -> */,
+/* pos 0145: 126 */ 0xF3 /* 's' -> */,
+/* pos 0146: 127 */ 0xBA /* ':' -> */,
+/* pos 0147: 128 */ 0x00, 0x10 /* - terminal marker 16 - */,
+/* pos 0149: 129 */ 0x63 /* 'c' */, 0x0D, 0x00 /* (to 0x0156 state 130) */,
+ 0x75 /* 'u' */, 0xAC, 0x00 /* (to 0x01F8 state 230) */,
+ 0x67 /* 'g' */, 0x86, 0x01 /* (to 0x02D5 state 358) */,
+ 0x6C /* 'l' */, 0x87, 0x01 /* (to 0x02D9 state 361) */,
+ 0x08, /* fail */
+/* pos 0156: 130 */ 0xE3 /* 'c' -> */,
+/* pos 0157: 131 */ 0xE5 /* 'e' -> */,
+/* pos 0158: 132 */ 0x70 /* 'p' */, 0x07, 0x00 /* (to 0x015F state 133) */,
+ 0x73 /* 's' */, 0x0E, 0x00 /* (to 0x0169 state 136) */,
+ 0x08, /* fail */
+/* pos 015f: 133 */ 0xF4 /* 't' -> */,
+/* pos 0160: 134 */ 0x3A /* ':' */, 0x07, 0x00 /* (to 0x0167 state 135) */,
+ 0x2D /* '-' */, 0x59, 0x00 /* (to 0x01BC state 192) */,
+ 0x08, /* fail */
+/* pos 0167: 135 */ 0x00, 0x11 /* - terminal marker 17 - */,
+/* pos 0169: 136 */ 0xF3 /* 's' -> */,
+/* pos 016a: 137 */ 0xAD /* '-' -> */,
+/* pos 016b: 138 */ 0xE3 /* 'c' -> */,
+/* pos 016c: 139 */ 0xEF /* 'o' -> */,
+/* pos 016d: 140 */ 0xEE /* 'n' -> */,
+/* pos 016e: 141 */ 0xF4 /* 't' -> */,
+/* pos 016f: 142 */ 0xF2 /* 'r' -> */,
+/* pos 0170: 143 */ 0xEF /* 'o' -> */,
+/* pos 0171: 144 */ 0xEC /* 'l' -> */,
+/* pos 0172: 145 */ 0xAD /* '-' -> */,
+/* pos 0173: 146 */ 0x72 /* 'r' */, 0x07, 0x00 /* (to 0x017A state 147) */,
+ 0x61 /* 'a' */, 0x51, 0x01 /* (to 0x02C7 state 345) */,
+ 0x08, /* fail */
+/* pos 017a: 147 */ 0xE5 /* 'e' -> */,
+/* pos 017b: 148 */ 0xF1 /* 'q' -> */,
+/* pos 017c: 149 */ 0xF5 /* 'u' -> */,
+/* pos 017d: 150 */ 0xE5 /* 'e' -> */,
+/* pos 017e: 151 */ 0xF3 /* 's' -> */,
+/* pos 017f: 152 */ 0xF4 /* 't' -> */,
+/* pos 0180: 153 */ 0xAD /* '-' -> */,
+/* pos 0181: 154 */ 0xE8 /* 'h' -> */,
+/* pos 0182: 155 */ 0xE5 /* 'e' -> */,
+/* pos 0183: 156 */ 0xE1 /* 'a' -> */,
+/* pos 0184: 157 */ 0xE4 /* 'd' -> */,
+/* pos 0185: 158 */ 0xE5 /* 'e' -> */,
+/* pos 0186: 159 */ 0xF2 /* 'r' -> */,
+/* pos 0187: 160 */ 0xF3 /* 's' -> */,
+/* pos 0188: 161 */ 0xBA /* ':' -> */,
+/* pos 0189: 162 */ 0x00, 0x12 /* - terminal marker 18 - */,
+/* pos 018b: 163 */ 0xE6 /* 'f' -> */,
+/* pos 018c: 164 */ 0xAD /* '-' -> */,
+/* pos 018d: 165 */ 0x6D /* 'm' */, 0x0D, 0x00 /* (to 0x019A state 166) */,
+ 0x6E /* 'n' */, 0x20, 0x00 /* (to 0x01B0 state 181) */,
+ 0x72 /* 'r' */, 0xA7, 0x01 /* (to 0x033A state 435) */,
+ 0x75 /* 'u' */, 0xAB, 0x01 /* (to 0x0341 state 441) */,
+ 0x08, /* fail */
+/* pos 019a: 166 */ 0x6F /* 'o' */, 0x07, 0x00 /* (to 0x01A1 state 167) */,
+ 0x61 /* 'a' */, 0x97, 0x01 /* (to 0x0334 state 430) */,
+ 0x08, /* fail */
+/* pos 01a1: 167 */ 0xE4 /* 'd' -> */,
+/* pos 01a2: 168 */ 0xE9 /* 'i' -> */,
+/* pos 01a3: 169 */ 0xE6 /* 'f' -> */,
+/* pos 01a4: 170 */ 0xE9 /* 'i' -> */,
+/* pos 01a5: 171 */ 0xE5 /* 'e' -> */,
+/* pos 01a6: 172 */ 0xE4 /* 'd' -> */,
+/* pos 01a7: 173 */ 0xAD /* '-' -> */,
+/* pos 01a8: 174 */ 0xF3 /* 's' -> */,
+/* pos 01a9: 175 */ 0xE9 /* 'i' -> */,
+/* pos 01aa: 176 */ 0xEE /* 'n' -> */,
+/* pos 01ab: 177 */ 0xE3 /* 'c' -> */,
+/* pos 01ac: 178 */ 0xE5 /* 'e' -> */,
+/* pos 01ad: 179 */ 0xBA /* ':' -> */,
+/* pos 01ae: 180 */ 0x00, 0x13 /* - terminal marker 19 - */,
+/* pos 01b0: 181 */ 0xEF /* 'o' -> */,
+/* pos 01b1: 182 */ 0xEE /* 'n' -> */,
+/* pos 01b2: 183 */ 0xE5 /* 'e' -> */,
+/* pos 01b3: 184 */ 0xAD /* '-' -> */,
+/* pos 01b4: 185 */ 0xED /* 'm' -> */,
+/* pos 01b5: 186 */ 0xE1 /* 'a' -> */,
+/* pos 01b6: 187 */ 0xF4 /* 't' -> */,
+/* pos 01b7: 188 */ 0xE3 /* 'c' -> */,
+/* pos 01b8: 189 */ 0xE8 /* 'h' -> */,
+/* pos 01b9: 190 */ 0xBA /* ':' -> */,
+/* pos 01ba: 191 */ 0x00, 0x14 /* - terminal marker 20 - */,
+/* pos 01bc: 192 */ 0x65 /* 'e' */, 0x0D, 0x00 /* (to 0x01C9 state 193) */,
+ 0x6C /* 'l' */, 0x14, 0x00 /* (to 0x01D3 state 202) */,
+ 0x63 /* 'c' */, 0xF4, 0x00 /* (to 0x02B6 state 330) */,
+ 0x72 /* 'r' */, 0xFA, 0x00 /* (to 0x02BF state 338) */,
+ 0x08, /* fail */
+/* pos 01c9: 193 */ 0xEE /* 'n' -> */,
+/* pos 01ca: 194 */ 0xE3 /* 'c' -> */,
+/* pos 01cb: 195 */ 0xEF /* 'o' -> */,
+/* pos 01cc: 196 */ 0xE4 /* 'd' -> */,
+/* pos 01cd: 197 */ 0xE9 /* 'i' -> */,
+/* pos 01ce: 198 */ 0xEE /* 'n' -> */,
+/* pos 01cf: 199 */ 0xE7 /* 'g' -> */,
+/* pos 01d0: 200 */ 0xBA /* ':' -> */,
+/* pos 01d1: 201 */ 0x00, 0x15 /* - terminal marker 21 - */,
+/* pos 01d3: 202 */ 0xE1 /* 'a' -> */,
+/* pos 01d4: 203 */ 0xEE /* 'n' -> */,
+/* pos 01d5: 204 */ 0xE7 /* 'g' -> */,
+/* pos 01d6: 205 */ 0xF5 /* 'u' -> */,
+/* pos 01d7: 206 */ 0xE1 /* 'a' -> */,
+/* pos 01d8: 207 */ 0xE7 /* 'g' -> */,
+/* pos 01d9: 208 */ 0xE5 /* 'e' -> */,
+/* pos 01da: 209 */ 0xBA /* ':' -> */,
+/* pos 01db: 210 */ 0x00, 0x16 /* - terminal marker 22 - */,
+/* pos 01dd: 211 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x01E4 state 212) */,
+ 0x6F /* 'o' */, 0xA7, 0x01 /* (to 0x0387 state 497) */,
+ 0x08, /* fail */
+/* pos 01e4: 212 */ 0xE7 /* 'g' -> */,
+/* pos 01e5: 213 */ 0xED /* 'm' -> */,
+/* pos 01e6: 214 */ 0xE1 /* 'a' -> */,
+/* pos 01e7: 215 */ 0xBA /* ':' -> */,
+/* pos 01e8: 216 */ 0x00, 0x17 /* - terminal marker 23 - */,
+/* pos 01ea: 217 */ 0xE3 /* 'c' -> */,
+/* pos 01eb: 218 */ 0xE8 /* 'h' -> */,
+/* pos 01ec: 219 */ 0xE5 /* 'e' -> */,
+/* pos 01ed: 220 */ 0xAD /* '-' -> */,
+/* pos 01ee: 221 */ 0xE3 /* 'c' -> */,
+/* pos 01ef: 222 */ 0xEF /* 'o' -> */,
+/* pos 01f0: 223 */ 0xEE /* 'n' -> */,
+/* pos 01f1: 224 */ 0xF4 /* 't' -> */,
+/* pos 01f2: 225 */ 0xF2 /* 'r' -> */,
+/* pos 01f3: 226 */ 0xEF /* 'o' -> */,
+/* pos 01f4: 227 */ 0xEC /* 'l' -> */,
+/* pos 01f5: 228 */ 0xBA /* ':' -> */,
+/* pos 01f6: 229 */ 0x00, 0x18 /* - terminal marker 24 - */,
+/* pos 01f8: 230 */ 0xF4 /* 't' -> */,
+/* pos 01f9: 231 */ 0xE8 /* 'h' -> */,
+/* pos 01fa: 232 */ 0xEF /* 'o' -> */,
+/* pos 01fb: 233 */ 0xF2 /* 'r' -> */,
+/* pos 01fc: 234 */ 0xE9 /* 'i' -> */,
+/* pos 01fd: 235 */ 0xFA /* 'z' -> */,
+/* pos 01fe: 236 */ 0xE1 /* 'a' -> */,
+/* pos 01ff: 237 */ 0xF4 /* 't' -> */,
+/* pos 0200: 238 */ 0xE9 /* 'i' -> */,
+/* pos 0201: 239 */ 0xEF /* 'o' -> */,
+/* pos 0202: 240 */ 0xEE /* 'n' -> */,
+/* pos 0203: 241 */ 0xBA /* ':' -> */,
+/* pos 0204: 242 */ 0x00, 0x19 /* - terminal marker 25 - */,
+/* pos 0206: 243 */ 0xEB /* 'k' -> */,
+/* pos 0207: 244 */ 0xE9 /* 'i' -> */,
+/* pos 0208: 245 */ 0xE5 /* 'e' -> */,
+/* pos 0209: 246 */ 0xBA /* ':' -> */,
+/* pos 020a: 247 */ 0x00, 0x1A /* - terminal marker 26 - */,
+/* pos 020c: 248 */ 0xE5 /* 'e' -> */,
+/* pos 020d: 249 */ 0xEE /* 'n' -> */,
+/* pos 020e: 250 */ 0xF4 /* 't' -> */,
+/* pos 020f: 251 */ 0xAD /* '-' -> */,
+/* pos 0210: 252 */ 0x6C /* 'l' */, 0x10, 0x00 /* (to 0x0220 state 253) */,
+ 0x74 /* 't' */, 0x1E, 0x00 /* (to 0x0231 state 260) */,
+ 0x64 /* 'd' */, 0xC9, 0x00 /* (to 0x02DF state 366) */,
+ 0x65 /* 'e' */, 0xD3, 0x00 /* (to 0x02EC state 378) */,
+ 0x72 /* 'r' */, 0xEC, 0x00 /* (to 0x0308 state 403) */,
+ 0x08, /* fail */
+/* pos 0220: 253 */ 0x65 /* 'e' */, 0x0A, 0x00 /* (to 0x022A state 254) */,
+ 0x61 /* 'a' */, 0xD3, 0x00 /* (to 0x02F6 state 387) */,
+ 0x6F /* 'o' */, 0xD9, 0x00 /* (to 0x02FF state 395) */,
+ 0x08, /* fail */
+/* pos 022a: 254 */ 0xEE /* 'n' -> */,
+/* pos 022b: 255 */ 0xE7 /* 'g' -> */,
+/* pos 022c: 256 */ 0xF4 /* 't' -> */,
+/* pos 022d: 257 */ 0xE8 /* 'h' -> */,
+/* pos 022e: 258 */ 0xBA /* ':' -> */,
+/* pos 022f: 259 */ 0x00, 0x1B /* - terminal marker 27 - */,
+/* pos 0231: 260 */ 0xF9 /* 'y' -> */,
+/* pos 0232: 261 */ 0xF0 /* 'p' -> */,
+/* pos 0233: 262 */ 0xE5 /* 'e' -> */,
+/* pos 0234: 263 */ 0xBA /* ':' -> */,
+/* pos 0235: 264 */ 0x00, 0x1C /* - terminal marker 28 - */,
+/* pos 0237: 265 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x023E state 266) */,
+ 0x65 /* 'e' */, 0xFF, 0x01 /* (to 0x0439 state 637) */,
+ 0x08, /* fail */
+/* pos 023e: 266 */ 0xF4 /* 't' -> */,
+/* pos 023f: 267 */ 0xE5 /* 'e' -> */,
+/* pos 0240: 268 */ 0xBA /* ':' -> */,
+/* pos 0241: 269 */ 0x00, 0x1D /* - terminal marker 29 - */,
+/* pos 0243: 270 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x024A state 271) */,
+ 0x65 /* 'e' */, 0x0A, 0x00 /* (to 0x0250 state 276) */,
+ 0x08, /* fail */
+/* pos 024a: 271 */ 0xEE /* 'n' -> */,
+/* pos 024b: 272 */ 0xE7 /* 'g' -> */,
+/* pos 024c: 273 */ 0xE5 /* 'e' -> */,
+/* pos 024d: 274 */ 0xBA /* ':' -> */,
+/* pos 024e: 275 */ 0x00, 0x1E /* - terminal marker 30 - */,
+/* pos 0250: 276 */ 0x66 /* 'f' */, 0x0A, 0x00 /* (to 0x025A state 277) */,
+ 0x74 /* 't' */, 0x63, 0x01 /* (to 0x03B6 state 529) */,
+ 0x70 /* 'p' */, 0x22, 0x02 /* (to 0x0478 state 682) */,
+ 0x08, /* fail */
+/* pos 025a: 277 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x0261 state 278) */,
+ 0x72 /* 'r' */, 0x53, 0x01 /* (to 0x03B0 state 524) */,
+ 0x08, /* fail */
+/* pos 0261: 278 */ 0xF2 /* 'r' -> */,
+/* pos 0262: 279 */ 0xE5 /* 'e' -> */,
+/* pos 0263: 280 */ 0xF2 /* 'r' -> */,
+/* pos 0264: 281 */ 0xBA /* ':' -> */,
+/* pos 0265: 282 */ 0x00, 0x1F /* - terminal marker 31 - */,
+/* pos 0267: 283 */ 0x00, 0x20 /* - terminal marker 32 - */,
+/* pos 0269: 284 */ 0xE5 /* 'e' -> */,
+/* pos 026a: 285 */ 0xF2 /* 'r' -> */,
+/* pos 026b: 286 */ 0xF3 /* 's' -> */,
+/* pos 026c: 287 */ 0xE9 /* 'i' -> */,
+/* pos 026d: 288 */ 0xEF /* 'o' -> */,
+/* pos 026e: 289 */ 0xEE /* 'n' -> */,
+/* pos 026f: 290 */ 0xBA /* ':' -> */,
+/* pos 0270: 291 */ 0x00, 0x21 /* - terminal marker 33 - */,
+/* pos 0272: 292 */ 0xF2 /* 'r' -> */,
+/* pos 0273: 293 */ 0xE9 /* 'i' -> */,
+/* pos 0274: 294 */ 0xE7 /* 'g' -> */,
+/* pos 0275: 295 */ 0xE9 /* 'i' -> */,
+/* pos 0276: 296 */ 0xEE /* 'n' -> */,
+/* pos 0277: 297 */ 0xBA /* ':' -> */,
+/* pos 0278: 298 */ 0x00, 0x22 /* - terminal marker 34 - */,
+/* pos 027a: 299 */ 0x61 /* 'a' */, 0x0D, 0x00 /* (to 0x0287 state 300) */,
+ 0x6D /* 'm' */, 0x14, 0x00 /* (to 0x0291 state 309) */,
+ 0x70 /* 'p' */, 0x18, 0x00 /* (to 0x0298 state 315) */,
+ 0x73 /* 's' */, 0x20, 0x00 /* (to 0x02A3 state 319) */,
+ 0x08, /* fail */
+/* pos 0287: 300 */ 0xF5 /* 'u' -> */,
+/* pos 0288: 301 */ 0xF4 /* 't' -> */,
+/* pos 0289: 302 */ 0xE8 /* 'h' -> */,
+/* pos 028a: 303 */ 0xEF /* 'o' -> */,
+/* pos 028b: 304 */ 0xF2 /* 'r' -> */,
+/* pos 028c: 305 */ 0xE9 /* 'i' -> */,
+/* pos 028d: 306 */ 0xF4 /* 't' -> */,
+/* pos 028e: 307 */ 0xF9 /* 'y' -> */,
+/* pos 028f: 308 */ 0x00, 0x23 /* - terminal marker 35 - */,
+/* pos 0291: 309 */ 0xE5 /* 'e' -> */,
+/* pos 0292: 310 */ 0xF4 /* 't' -> */,
+/* pos 0293: 311 */ 0xE8 /* 'h' -> */,
+/* pos 0294: 312 */ 0xEF /* 'o' -> */,
+/* pos 0295: 313 */ 0xE4 /* 'd' -> */,
+/* pos 0296: 314 */ 0x00, 0x24 /* - terminal marker 36 - */,
+/* pos 0298: 315 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x029F state 316) */,
+ 0x72 /* 'r' */, 0xE9, 0x01 /* (to 0x0484 state 693) */,
+ 0x08, /* fail */
+/* pos 029f: 316 */ 0xF4 /* 't' -> */,
+/* pos 02a0: 317 */ 0xE8 /* 'h' -> */,
+/* pos 02a1: 318 */ 0x00, 0x25 /* - terminal marker 37 - */,
+/* pos 02a3: 319 */ 0x63 /* 'c' */, 0x07, 0x00 /* (to 0x02AA state 320) */,
+ 0x74 /* 't' */, 0x0A, 0x00 /* (to 0x02B0 state 325) */,
+ 0x08, /* fail */
+/* pos 02aa: 320 */ 0xE8 /* 'h' -> */,
+/* pos 02ab: 321 */ 0xE5 /* 'e' -> */,
+/* pos 02ac: 322 */ 0xED /* 'm' -> */,
+/* pos 02ad: 323 */ 0xE5 /* 'e' -> */,
+/* pos 02ae: 324 */ 0x00, 0x26 /* - terminal marker 38 - */,
+/* pos 02b0: 325 */ 0xE1 /* 'a' -> */,
+/* pos 02b1: 326 */ 0xF4 /* 't' -> */,
+/* pos 02b2: 327 */ 0xF5 /* 'u' -> */,
+/* pos 02b3: 328 */ 0xF3 /* 's' -> */,
+/* pos 02b4: 329 */ 0x00, 0x27 /* - terminal marker 39 - */,
+/* pos 02b6: 330 */ 0xE8 /* 'h' -> */,
+/* pos 02b7: 331 */ 0xE1 /* 'a' -> */,
+/* pos 02b8: 332 */ 0xF2 /* 'r' -> */,
+/* pos 02b9: 333 */ 0xF3 /* 's' -> */,
+/* pos 02ba: 334 */ 0xE5 /* 'e' -> */,
+/* pos 02bb: 335 */ 0xF4 /* 't' -> */,
+/* pos 02bc: 336 */ 0xBA /* ':' -> */,
+/* pos 02bd: 337 */ 0x00, 0x28 /* - terminal marker 40 - */,
+/* pos 02bf: 338 */ 0xE1 /* 'a' -> */,
+/* pos 02c0: 339 */ 0xEE /* 'n' -> */,
+/* pos 02c1: 340 */ 0xE7 /* 'g' -> */,
+/* pos 02c2: 341 */ 0xE5 /* 'e' -> */,
+/* pos 02c3: 342 */ 0xF3 /* 's' -> */,
+/* pos 02c4: 343 */ 0xBA /* ':' -> */,
+/* pos 02c5: 344 */ 0x00, 0x29 /* - terminal marker 41 - */,
+/* pos 02c7: 345 */ 0xEC /* 'l' -> */,
+/* pos 02c8: 346 */ 0xEC /* 'l' -> */,
+/* pos 02c9: 347 */ 0xEF /* 'o' -> */,
+/* pos 02ca: 348 */ 0xF7 /* 'w' -> */,
+/* pos 02cb: 349 */ 0xAD /* '-' -> */,
+/* pos 02cc: 350 */ 0xEF /* 'o' -> */,
+/* pos 02cd: 351 */ 0xF2 /* 'r' -> */,
+/* pos 02ce: 352 */ 0xE9 /* 'i' -> */,
+/* pos 02cf: 353 */ 0xE7 /* 'g' -> */,
+/* pos 02d0: 354 */ 0xE9 /* 'i' -> */,
+/* pos 02d1: 355 */ 0xEE /* 'n' -> */,
+/* pos 02d2: 356 */ 0xBA /* ':' -> */,
+/* pos 02d3: 357 */ 0x00, 0x2A /* - terminal marker 42 - */,
+/* pos 02d5: 358 */ 0xE5 /* 'e' -> */,
+/* pos 02d6: 359 */ 0xBA /* ':' -> */,
+/* pos 02d7: 360 */ 0x00, 0x2B /* - terminal marker 43 - */,
+/* pos 02d9: 361 */ 0xEC /* 'l' -> */,
+/* pos 02da: 362 */ 0xEF /* 'o' -> */,
+/* pos 02db: 363 */ 0xF7 /* 'w' -> */,
+/* pos 02dc: 364 */ 0xBA /* ':' -> */,
+/* pos 02dd: 365 */ 0x00, 0x2C /* - terminal marker 44 - */,
+/* pos 02df: 366 */ 0xE9 /* 'i' -> */,
+/* pos 02e0: 367 */ 0xF3 /* 's' -> */,
+/* pos 02e1: 368 */ 0xF0 /* 'p' -> */,
+/* pos 02e2: 369 */ 0xEF /* 'o' -> */,
+/* pos 02e3: 370 */ 0xF3 /* 's' -> */,
+/* pos 02e4: 371 */ 0xE9 /* 'i' -> */,
+/* pos 02e5: 372 */ 0xF4 /* 't' -> */,
+/* pos 02e6: 373 */ 0xE9 /* 'i' -> */,
+/* pos 02e7: 374 */ 0xEF /* 'o' -> */,
+/* pos 02e8: 375 */ 0xEE /* 'n' -> */,
+/* pos 02e9: 376 */ 0xBA /* ':' -> */,
+/* pos 02ea: 377 */ 0x00, 0x2D /* - terminal marker 45 - */,
+/* pos 02ec: 378 */ 0xEE /* 'n' -> */,
+/* pos 02ed: 379 */ 0xE3 /* 'c' -> */,
+/* pos 02ee: 380 */ 0xEF /* 'o' -> */,
+/* pos 02ef: 381 */ 0xE4 /* 'd' -> */,
+/* pos 02f0: 382 */ 0xE9 /* 'i' -> */,
+/* pos 02f1: 383 */ 0xEE /* 'n' -> */,
+/* pos 02f2: 384 */ 0xE7 /* 'g' -> */,
+/* pos 02f3: 385 */ 0xBA /* ':' -> */,
+/* pos 02f4: 386 */ 0x00, 0x2E /* - terminal marker 46 - */,
+/* pos 02f6: 387 */ 0xEE /* 'n' -> */,
+/* pos 02f7: 388 */ 0xE7 /* 'g' -> */,
+/* pos 02f8: 389 */ 0xF5 /* 'u' -> */,
+/* pos 02f9: 390 */ 0xE1 /* 'a' -> */,
+/* pos 02fa: 391 */ 0xE7 /* 'g' -> */,
+/* pos 02fb: 392 */ 0xE5 /* 'e' -> */,
+/* pos 02fc: 393 */ 0xBA /* ':' -> */,
+/* pos 02fd: 394 */ 0x00, 0x2F /* - terminal marker 47 - */,
+/* pos 02ff: 395 */ 0xE3 /* 'c' -> */,
+/* pos 0300: 396 */ 0xE1 /* 'a' -> */,
+/* pos 0301: 397 */ 0xF4 /* 't' -> */,
+/* pos 0302: 398 */ 0xE9 /* 'i' -> */,
+/* pos 0303: 399 */ 0xEF /* 'o' -> */,
+/* pos 0304: 400 */ 0xEE /* 'n' -> */,
+/* pos 0305: 401 */ 0xBA /* ':' -> */,
+/* pos 0306: 402 */ 0x00, 0x30 /* - terminal marker 48 - */,
+/* pos 0308: 403 */ 0xE1 /* 'a' -> */,
+/* pos 0309: 404 */ 0xEE /* 'n' -> */,
+/* pos 030a: 405 */ 0xE7 /* 'g' -> */,
+/* pos 030b: 406 */ 0xE5 /* 'e' -> */,
+/* pos 030c: 407 */ 0xBA /* ':' -> */,
+/* pos 030d: 408 */ 0x00, 0x31 /* - terminal marker 49 - */,
+/* pos 030f: 409 */ 0x74 /* 't' */, 0x07, 0x00 /* (to 0x0316 state 410) */,
+ 0x78 /* 'x' */, 0x09, 0x00 /* (to 0x031B state 414) */,
+ 0x08, /* fail */
+/* pos 0316: 410 */ 0xE1 /* 'a' -> */,
+/* pos 0317: 411 */ 0xE7 /* 'g' -> */,
+/* pos 0318: 412 */ 0xBA /* ':' -> */,
+/* pos 0319: 413 */ 0x00, 0x32 /* - terminal marker 50 - */,
+/* pos 031b: 414 */ 0xF0 /* 'p' -> */,
+/* pos 031c: 415 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x0323 state 416) */,
+ 0x69 /* 'i' */, 0x09, 0x00 /* (to 0x0328 state 420) */,
+ 0x08, /* fail */
+/* pos 0323: 416 */ 0xE3 /* 'c' -> */,
+/* pos 0324: 417 */ 0xF4 /* 't' -> */,
+/* pos 0325: 418 */ 0xBA /* ':' -> */,
+/* pos 0326: 419 */ 0x00, 0x33 /* - terminal marker 51 - */,
+/* pos 0328: 420 */ 0xF2 /* 'r' -> */,
+/* pos 0329: 421 */ 0xE5 /* 'e' -> */,
+/* pos 032a: 422 */ 0xF3 /* 's' -> */,
+/* pos 032b: 423 */ 0xBA /* ':' -> */,
+/* pos 032c: 424 */ 0x00, 0x34 /* - terminal marker 52 - */,
+/* pos 032e: 425 */ 0xF2 /* 'r' -> */,
+/* pos 032f: 426 */ 0xEF /* 'o' -> */,
+/* pos 0330: 427 */ 0xED /* 'm' -> */,
+/* pos 0331: 428 */ 0xBA /* ':' -> */,
+/* pos 0332: 429 */ 0x00, 0x35 /* - terminal marker 53 - */,
+/* pos 0334: 430 */ 0xF4 /* 't' -> */,
+/* pos 0335: 431 */ 0xE3 /* 'c' -> */,
+/* pos 0336: 432 */ 0xE8 /* 'h' -> */,
+/* pos 0337: 433 */ 0xBA /* ':' -> */,
+/* pos 0338: 434 */ 0x00, 0x36 /* - terminal marker 54 - */,
+/* pos 033a: 435 */ 0xE1 /* 'a' -> */,
+/* pos 033b: 436 */ 0xEE /* 'n' -> */,
+/* pos 033c: 437 */ 0xE7 /* 'g' -> */,
+/* pos 033d: 438 */ 0xE5 /* 'e' -> */,
+/* pos 033e: 439 */ 0xBA /* ':' -> */,
+/* pos 033f: 440 */ 0x00, 0x37 /* - terminal marker 55 - */,
+/* pos 0341: 441 */ 0xEE /* 'n' -> */,
+/* pos 0342: 442 */ 0xED /* 'm' -> */,
+/* pos 0343: 443 */ 0xEF /* 'o' -> */,
+/* pos 0344: 444 */ 0xE4 /* 'd' -> */,
+/* pos 0345: 445 */ 0xE9 /* 'i' -> */,
+/* pos 0346: 446 */ 0xE6 /* 'f' -> */,
+/* pos 0347: 447 */ 0xE9 /* 'i' -> */,
+/* pos 0348: 448 */ 0xE5 /* 'e' -> */,
+/* pos 0349: 449 */ 0xE4 /* 'd' -> */,
+/* pos 034a: 450 */ 0xAD /* '-' -> */,
+/* pos 034b: 451 */ 0xF3 /* 's' -> */,
+/* pos 034c: 452 */ 0xE9 /* 'i' -> */,
+/* pos 034d: 453 */ 0xEE /* 'n' -> */,
+/* pos 034e: 454 */ 0xE3 /* 'c' -> */,
+/* pos 034f: 455 */ 0xE5 /* 'e' -> */,
+/* pos 0350: 456 */ 0xBA /* ':' -> */,
+/* pos 0351: 457 */ 0x00, 0x38 /* - terminal marker 56 - */,
+/* pos 0353: 458 */ 0x61 /* 'a' */, 0x0A, 0x00 /* (to 0x035D state 459) */,
+ 0x69 /* 'i' */, 0x15, 0x00 /* (to 0x036B state 472) */,
+ 0x6F /* 'o' */, 0x17, 0x00 /* (to 0x0370 state 476) */,
+ 0x08, /* fail */
+/* pos 035d: 459 */ 0xF3 /* 's' -> */,
+/* pos 035e: 460 */ 0xF4 /* 't' -> */,
+/* pos 035f: 461 */ 0xAD /* '-' -> */,
+/* pos 0360: 462 */ 0xED /* 'm' -> */,
+/* pos 0361: 463 */ 0xEF /* 'o' -> */,
+/* pos 0362: 464 */ 0xE4 /* 'd' -> */,
+/* pos 0363: 465 */ 0xE9 /* 'i' -> */,
+/* pos 0364: 466 */ 0xE6 /* 'f' -> */,
+/* pos 0365: 467 */ 0xE9 /* 'i' -> */,
+/* pos 0366: 468 */ 0xE5 /* 'e' -> */,
+/* pos 0367: 469 */ 0xE4 /* 'd' -> */,
+/* pos 0368: 470 */ 0xBA /* ':' -> */,
+/* pos 0369: 471 */ 0x00, 0x39 /* - terminal marker 57 - */,
+/* pos 036b: 472 */ 0xEE /* 'n' -> */,
+/* pos 036c: 473 */ 0xEB /* 'k' -> */,
+/* pos 036d: 474 */ 0xBA /* ':' -> */,
+/* pos 036e: 475 */ 0x00, 0x3A /* - terminal marker 58 - */,
+/* pos 0370: 476 */ 0xE3 /* 'c' -> */,
+/* pos 0371: 477 */ 0xE1 /* 'a' -> */,
+/* pos 0372: 478 */ 0xF4 /* 't' -> */,
+/* pos 0373: 479 */ 0xE9 /* 'i' -> */,
+/* pos 0374: 480 */ 0xEF /* 'o' -> */,
+/* pos 0375: 481 */ 0xEE /* 'n' -> */,
+/* pos 0376: 482 */ 0xBA /* ':' -> */,
+/* pos 0377: 483 */ 0x00, 0x3B /* - terminal marker 59 - */,
+/* pos 0379: 484 */ 0xE1 /* 'a' -> */,
+/* pos 037a: 485 */ 0xF8 /* 'x' -> */,
+/* pos 037b: 486 */ 0xAD /* '-' -> */,
+/* pos 037c: 487 */ 0xE6 /* 'f' -> */,
+/* pos 037d: 488 */ 0xEF /* 'o' -> */,
+/* pos 037e: 489 */ 0xF2 /* 'r' -> */,
+/* pos 037f: 490 */ 0xF7 /* 'w' -> */,
+/* pos 0380: 491 */ 0xE1 /* 'a' -> */,
+/* pos 0381: 492 */ 0xF2 /* 'r' -> */,
+/* pos 0382: 493 */ 0xE4 /* 'd' -> */,
+/* pos 0383: 494 */ 0xF3 /* 's' -> */,
+/* pos 0384: 495 */ 0xBA /* ':' -> */,
+/* pos 0385: 496 */ 0x00, 0x3C /* - terminal marker 60 - */,
+/* pos 0387: 497 */ 0xF8 /* 'x' -> */,
+/* pos 0388: 498 */ 0xF9 /* 'y' -> */,
+/* pos 0389: 499 */ 0x2D /* '-' */, 0x07, 0x00 /* (to 0x0390 state 500) */,
+ 0x20 /* ' ' */, 0xBB, 0x00 /* (to 0x0447 state 649) */,
+ 0x08, /* fail */
+/* pos 0390: 500 */ 0xE1 /* 'a' -> */,
+/* pos 0391: 501 */ 0xF5 /* 'u' -> */,
+/* pos 0392: 502 */ 0xF4 /* 't' -> */,
+/* pos 0393: 503 */ 0xE8 /* 'h' -> */,
+/* pos 0394: 504 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x039B state 505) */,
+ 0x6F /* 'o' */, 0x0E, 0x00 /* (to 0x03A5 state 514) */,
+ 0x08, /* fail */
+/* pos 039b: 505 */ 0xEE /* 'n' -> */,
+/* pos 039c: 506 */ 0xF4 /* 't' -> */,
+/* pos 039d: 507 */ 0xE9 /* 'i' -> */,
+/* pos 039e: 508 */ 0xE3 /* 'c' -> */,
+/* pos 039f: 509 */ 0xE1 /* 'a' -> */,
+/* pos 03a0: 510 */ 0xF4 /* 't' -> */,
+/* pos 03a1: 511 */ 0xE5 /* 'e' -> */,
+/* pos 03a2: 512 */ 0xBA /* ':' -> */,
+/* pos 03a3: 513 */ 0x00, 0x3D /* - terminal marker 61 - */,
+/* pos 03a5: 514 */ 0xF2 /* 'r' -> */,
+/* pos 03a6: 515 */ 0xE9 /* 'i' -> */,
+/* pos 03a7: 516 */ 0xFA /* 'z' -> */,
+/* pos 03a8: 517 */ 0xE1 /* 'a' -> */,
+/* pos 03a9: 518 */ 0xF4 /* 't' -> */,
+/* pos 03aa: 519 */ 0xE9 /* 'i' -> */,
+/* pos 03ab: 520 */ 0xEF /* 'o' -> */,
+/* pos 03ac: 521 */ 0xEE /* 'n' -> */,
+/* pos 03ad: 522 */ 0xBA /* ':' -> */,
+/* pos 03ae: 523 */ 0x00, 0x3E /* - terminal marker 62 - */,
+/* pos 03b0: 524 */ 0xE5 /* 'e' -> */,
+/* pos 03b1: 525 */ 0xF3 /* 's' -> */,
+/* pos 03b2: 526 */ 0xE8 /* 'h' -> */,
+/* pos 03b3: 527 */ 0xBA /* ':' -> */,
+/* pos 03b4: 528 */ 0x00, 0x3F /* - terminal marker 63 - */,
+/* pos 03b6: 529 */ 0xF2 /* 'r' -> */,
+/* pos 03b7: 530 */ 0xF9 /* 'y' -> */,
+/* pos 03b8: 531 */ 0xAD /* '-' -> */,
+/* pos 03b9: 532 */ 0xE1 /* 'a' -> */,
+/* pos 03ba: 533 */ 0xE6 /* 'f' -> */,
+/* pos 03bb: 534 */ 0xF4 /* 't' -> */,
+/* pos 03bc: 535 */ 0xE5 /* 'e' -> */,
+/* pos 03bd: 536 */ 0xF2 /* 'r' -> */,
+/* pos 03be: 537 */ 0xBA /* ':' -> */,
+/* pos 03bf: 538 */ 0x00, 0x40 /* - terminal marker 64 - */,
+/* pos 03c1: 539 */ 0xF6 /* 'v' -> */,
+/* pos 03c2: 540 */ 0xE5 /* 'e' -> */,
+/* pos 03c3: 541 */ 0xF2 /* 'r' -> */,
+/* pos 03c4: 542 */ 0xBA /* ':' -> */,
+/* pos 03c5: 543 */ 0x00, 0x41 /* - terminal marker 65 - */,
+/* pos 03c7: 544 */ 0xAD /* '-' -> */,
+/* pos 03c8: 545 */ 0xE3 /* 'c' -> */,
+/* pos 03c9: 546 */ 0xEF /* 'o' -> */,
+/* pos 03ca: 547 */ 0xEF /* 'o' -> */,
+/* pos 03cb: 548 */ 0xEB /* 'k' -> */,
+/* pos 03cc: 549 */ 0xE9 /* 'i' -> */,
+/* pos 03cd: 550 */ 0xE5 /* 'e' -> */,
+/* pos 03ce: 551 */ 0xBA /* ':' -> */,
+/* pos 03cf: 552 */ 0x00, 0x42 /* - terminal marker 66 - */,
+/* pos 03d1: 553 */ 0xF2 /* 'r' -> */,
+/* pos 03d2: 554 */ 0xE9 /* 'i' -> */,
+/* pos 03d3: 555 */ 0xE3 /* 'c' -> */,
+/* pos 03d4: 556 */ 0xF4 /* 't' -> */,
+/* pos 03d5: 557 */ 0xAD /* '-' -> */,
+/* pos 03d6: 558 */ 0xF4 /* 't' -> */,
+/* pos 03d7: 559 */ 0xF2 /* 'r' -> */,
+/* pos 03d8: 560 */ 0xE1 /* 'a' -> */,
+/* pos 03d9: 561 */ 0xEE /* 'n' -> */,
+/* pos 03da: 562 */ 0xF3 /* 's' -> */,
+/* pos 03db: 563 */ 0xF0 /* 'p' -> */,
+/* pos 03dc: 564 */ 0xEF /* 'o' -> */,
+/* pos 03dd: 565 */ 0xF2 /* 'r' -> */,
+/* pos 03de: 566 */ 0xF4 /* 't' -> */,
+/* pos 03df: 567 */ 0xAD /* '-' -> */,
+/* pos 03e0: 568 */ 0xF3 /* 's' -> */,
+/* pos 03e1: 569 */ 0xE5 /* 'e' -> */,
+/* pos 03e2: 570 */ 0xE3 /* 'c' -> */,
+/* pos 03e3: 571 */ 0xF5 /* 'u' -> */,
+/* pos 03e4: 572 */ 0xF2 /* 'r' -> */,
+/* pos 03e5: 573 */ 0xE9 /* 'i' -> */,
+/* pos 03e6: 574 */ 0xF4 /* 't' -> */,
+/* pos 03e7: 575 */ 0xF9 /* 'y' -> */,
+/* pos 03e8: 576 */ 0xBA /* ':' -> */,
+/* pos 03e9: 577 */ 0x00, 0x43 /* - terminal marker 67 - */,
+/* pos 03eb: 578 */ 0x72 /* 'r' */, 0x07, 0x00 /* (to 0x03F2 state 579) */,
+ 0x65 /* 'e' */, 0x87, 0x00 /* (to 0x0475 state 680) */,
+ 0x08, /* fail */
+/* pos 03f2: 579 */ 0xE1 /* 'a' -> */,
+/* pos 03f3: 580 */ 0xEE /* 'n' -> */,
+/* pos 03f4: 581 */ 0xF3 /* 's' -> */,
+/* pos 03f5: 582 */ 0xE6 /* 'f' -> */,
+/* pos 03f6: 583 */ 0xE5 /* 'e' -> */,
+/* pos 03f7: 584 */ 0xF2 /* 'r' -> */,
+/* pos 03f8: 585 */ 0xAD /* '-' -> */,
+/* pos 03f9: 586 */ 0xE5 /* 'e' -> */,
+/* pos 03fa: 587 */ 0xEE /* 'n' -> */,
+/* pos 03fb: 588 */ 0xE3 /* 'c' -> */,
+/* pos 03fc: 589 */ 0xEF /* 'o' -> */,
+/* pos 03fd: 590 */ 0xE4 /* 'd' -> */,
+/* pos 03fe: 591 */ 0xE9 /* 'i' -> */,
+/* pos 03ff: 592 */ 0xEE /* 'n' -> */,
+/* pos 0400: 593 */ 0xE7 /* 'g' -> */,
+/* pos 0401: 594 */ 0xBA /* ':' -> */,
+/* pos 0402: 595 */ 0x00, 0x44 /* - terminal marker 68 - */,
+/* pos 0404: 596 */ 0xE5 /* 'e' -> */,
+/* pos 0405: 597 */ 0xF2 /* 'r' -> */,
+/* pos 0406: 598 */ 0xAD /* '-' -> */,
+/* pos 0407: 599 */ 0xE1 /* 'a' -> */,
+/* pos 0408: 600 */ 0xE7 /* 'g' -> */,
+/* pos 0409: 601 */ 0xE5 /* 'e' -> */,
+/* pos 040a: 602 */ 0xEE /* 'n' -> */,
+/* pos 040b: 603 */ 0xF4 /* 't' -> */,
+/* pos 040c: 604 */ 0xBA /* ':' -> */,
+/* pos 040d: 605 */ 0x00, 0x45 /* - terminal marker 69 - */,
+/* pos 040f: 606 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x0416 state 607) */,
+ 0x69 /* 'i' */, 0x09, 0x00 /* (to 0x041B state 611) */,
+ 0x08, /* fail */
+/* pos 0416: 607 */ 0xF2 /* 'r' -> */,
+/* pos 0417: 608 */ 0xF9 /* 'y' -> */,
+/* pos 0418: 609 */ 0xBA /* ':' -> */,
+/* pos 0419: 610 */ 0x00, 0x46 /* - terminal marker 70 - */,
+/* pos 041b: 611 */ 0xE1 /* 'a' -> */,
+/* pos 041c: 612 */ 0xBA /* ':' -> */,
+/* pos 041d: 613 */ 0x00, 0x47 /* - terminal marker 71 - */,
+/* pos 041f: 614 */ 0xF7 /* 'w' -> */,
+/* pos 0420: 615 */ 0xF7 /* 'w' -> */,
+/* pos 0421: 616 */ 0xAD /* '-' -> */,
+/* pos 0422: 617 */ 0xE1 /* 'a' -> */,
+/* pos 0423: 618 */ 0xF5 /* 'u' -> */,
+/* pos 0424: 619 */ 0xF4 /* 't' -> */,
+/* pos 0425: 620 */ 0xE8 /* 'h' -> */,
+/* pos 0426: 621 */ 0xE5 /* 'e' -> */,
+/* pos 0427: 622 */ 0xEE /* 'n' -> */,
+/* pos 0428: 623 */ 0xF4 /* 't' -> */,
+/* pos 0429: 624 */ 0xE9 /* 'i' -> */,
+/* pos 042a: 625 */ 0xE3 /* 'c' -> */,
+/* pos 042b: 626 */ 0xE1 /* 'a' -> */,
+/* pos 042c: 627 */ 0xF4 /* 't' -> */,
+/* pos 042d: 628 */ 0xE5 /* 'e' -> */,
+/* pos 042e: 629 */ 0xBA /* ':' -> */,
+/* pos 042f: 630 */ 0x00, 0x48 /* - terminal marker 72 - */,
+/* pos 0431: 631 */ 0xF4 /* 't' -> */,
+/* pos 0432: 632 */ 0xE3 /* 'c' -> */,
+/* pos 0433: 633 */ 0xE8 /* 'h' -> */,
+/* pos 0434: 634 */ 0x00, 0x49 /* - terminal marker 73 - */,
+/* pos 0436: 635 */ 0xF4 /* 't' -> */,
+/* pos 0437: 636 */ 0x00, 0x4A /* - terminal marker 74 - */,
+/* pos 0439: 637 */ 0xEC /* 'l' -> */,
+/* pos 043a: 638 */ 0xE5 /* 'e' -> */,
+/* pos 043b: 639 */ 0xF4 /* 't' -> */,
+/* pos 043c: 640 */ 0xE5 /* 'e' -> */,
+/* pos 043d: 641 */ 0x00, 0x4B /* - terminal marker 75 - */,
+/* pos 043f: 642 */ 0xE9 /* 'i' -> */,
+/* pos 0440: 643 */ 0xAD /* '-' -> */,
+/* pos 0441: 644 */ 0xE1 /* 'a' -> */,
+/* pos 0442: 645 */ 0xF2 /* 'r' -> */,
+/* pos 0443: 646 */ 0xE7 /* 'g' -> */,
+/* pos 0444: 647 */ 0xF3 /* 's' -> */,
+/* pos 0445: 648 */ 0x00, 0x4C /* - terminal marker 76 - */,
+/* pos 0447: 649 */ 0x00, 0x4D /* - terminal marker 77 - */,
+/* pos 0449: 650 */ 0xAD /* '-' -> */,
+/* pos 044a: 651 */ 0x72 /* 'r' */, 0x0A, 0x00 /* (to 0x0454 state 652) */,
+ 0x66 /* 'f' */, 0x13, 0x00 /* (to 0x0460 state 662) */,
+ 0x61 /* 'a' */, 0x3C, 0x00 /* (to 0x048C state 700) */,
+ 0x08, /* fail */
+/* pos 0454: 652 */ 0xE5 /* 'e' -> */,
+/* pos 0455: 653 */ 0xE1 /* 'a' -> */,
+/* pos 0456: 654 */ 0xEC /* 'l' -> */,
+/* pos 0457: 655 */ 0xAD /* '-' -> */,
+/* pos 0458: 656 */ 0xE9 /* 'i' -> */,
+/* pos 0459: 657 */ 0xF0 /* 'p' -> */,
+/* pos 045a: 658 */ 0xBA /* ':' -> */,
+/* pos 045b: 659 */ 0x00, 0x4E /* - terminal marker 78 - */,
+/* pos 045d: 660 */ 0xA0 /* ' ' -> */,
+/* pos 045e: 661 */ 0x00, 0x4F /* - terminal marker 79 - */,
+/* pos 0460: 662 */ 0xEF /* 'o' -> */,
+/* pos 0461: 663 */ 0xF2 /* 'r' -> */,
+/* pos 0462: 664 */ 0xF7 /* 'w' -> */,
+/* pos 0463: 665 */ 0xE1 /* 'a' -> */,
+/* pos 0464: 666 */ 0xF2 /* 'r' -> */,
+/* pos 0465: 667 */ 0xE4 /* 'd' -> */,
+/* pos 0466: 668 */ 0xE5 /* 'e' -> */,
+/* pos 0467: 669 */ 0xE4 /* 'd' -> */,
+/* pos 0468: 670 */ 0xAD /* '-' -> */,
+/* pos 0469: 671 */ 0xE6 /* 'f' -> */,
+/* pos 046a: 672 */ 0xEF /* 'o' -> */,
+/* pos 046b: 673 */ 0xF2 /* 'r' -> */,
+/* pos 046c: 674 */ 0x00, 0x50 /* - terminal marker 80 - */,
+/* pos 046e: 675 */ 0x00, 0x51 /* - terminal marker 81 - */,
+/* pos 0470: 676 */ 0xE1 /* 'a' -> */,
+/* pos 0471: 677 */ 0xE4 /* 'd' -> */,
+/* pos 0472: 678 */ 0xA0 /* ' ' -> */,
+/* pos 0473: 679 */ 0x00, 0x52 /* - terminal marker 82 - */,
+/* pos 0475: 680 */ 0xBA /* ':' -> */,
+/* pos 0476: 681 */ 0x00, 0x53 /* - terminal marker 83 - */,
+/* pos 0478: 682 */ 0xEC /* 'l' -> */,
+/* pos 0479: 683 */ 0xE1 /* 'a' -> */,
+/* pos 047a: 684 */ 0xF9 /* 'y' -> */,
+/* pos 047b: 685 */ 0xAD /* '-' -> */,
+/* pos 047c: 686 */ 0xEE /* 'n' -> */,
+/* pos 047d: 687 */ 0xEF /* 'o' -> */,
+/* pos 047e: 688 */ 0xEE /* 'n' -> */,
+/* pos 047f: 689 */ 0xE3 /* 'c' -> */,
+/* pos 0480: 690 */ 0xE5 /* 'e' -> */,
+/* pos 0481: 691 */ 0xBA /* ':' -> */,
+/* pos 0482: 692 */ 0x00, 0x54 /* - terminal marker 84 - */,
+/* pos 0484: 693 */ 0xEF /* 'o' -> */,
+/* pos 0485: 694 */ 0xF4 /* 't' -> */,
+/* pos 0486: 695 */ 0xEF /* 'o' -> */,
+/* pos 0487: 696 */ 0xE3 /* 'c' -> */,
+/* pos 0488: 697 */ 0xEF /* 'o' -> */,
+/* pos 0489: 698 */ 0xEC /* 'l' -> */,
+/* pos 048a: 699 */ 0x00, 0x55 /* - terminal marker 85 - */,
+/* pos 048c: 700 */ 0xF5 /* 'u' -> */,
+/* pos 048d: 701 */ 0xF4 /* 't' -> */,
+/* pos 048e: 702 */ 0xE8 /* 'h' -> */,
+/* pos 048f: 703 */ 0xAD /* '-' -> */,
+/* pos 0490: 704 */ 0xF4 /* 't' -> */,
+/* pos 0491: 705 */ 0xEF /* 'o' -> */,
+/* pos 0492: 706 */ 0xEB /* 'k' -> */,
+/* pos 0493: 707 */ 0xE5 /* 'e' -> */,
+/* pos 0494: 708 */ 0xEE /* 'n' -> */,
+/* pos 0495: 709 */ 0xBA /* ':' -> */,
+/* pos 0496: 710 */ 0x00, 0x56 /* - terminal marker 86 - */,
+/* total size 1176 bytes */
diff --git a/thirdparty/libwebsockets/roles/http/private.h b/thirdparty/libwebsockets/roles/http/private.h
new file mode 100644
index 0000000000..2aa7a92f75
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/http/private.h
@@ -0,0 +1,257 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h if either H1 or H2 roles are
+ * enabled
+ */
+
+#if defined(LWS_WITH_HTTP_PROXY)
+ #include <hubbub/hubbub.h>
+ #include <hubbub/parser.h>
+ #endif
+
+#define lwsi_role_http(wsi) (lwsi_role_h1(wsi) || lwsi_role_h2(wsi))
+
+enum http_version {
+ HTTP_VERSION_1_0,
+ HTTP_VERSION_1_1,
+ HTTP_VERSION_2
+};
+
+enum http_connection_type {
+ HTTP_CONNECTION_CLOSE,
+ HTTP_CONNECTION_KEEP_ALIVE
+};
+
+/*
+ * This is totally opaque to code using the library. It's exported as a
+ * forward-reference pointer-only declaration; the user can use the pointer with
+ * other APIs to get information out of it.
+ */
+
+#if defined(LWS_WITH_ESP32)
+typedef uint16_t ah_data_idx_t;
+#else
+typedef uint32_t ah_data_idx_t;
+#endif
+
+struct lws_fragments {
+ ah_data_idx_t offset;
+ uint16_t len;
+ uint8_t nfrag; /* which ah->frag[] continues this content, or 0 */
+ uint8_t flags; /* only http2 cares */
+};
+
+#if defined(LWS_WITH_RANGES)
+enum range_states {
+ LWSRS_NO_ACTIVE_RANGE,
+ LWSRS_BYTES_EQ,
+ LWSRS_FIRST,
+ LWSRS_STARTING,
+ LWSRS_ENDING,
+ LWSRS_COMPLETED,
+ LWSRS_SYNTAX,
+};
+
+struct lws_range_parsing {
+ unsigned long long start, end, extent, agg, budget;
+ const char buf[128];
+ int pos;
+ enum range_states state;
+ char start_valid, end_valid, ctr, count_ranges, did_try, inside, send_ctr;
+};
+
+int
+lws_ranges_init(struct lws *wsi, struct lws_range_parsing *rp,
+ unsigned long long extent);
+int
+lws_ranges_next(struct lws_range_parsing *rp);
+void
+lws_ranges_reset(struct lws_range_parsing *rp);
+#endif
+
+/*
+ * these are assigned from a pool held in the context.
+ * Both client and server mode uses them for http header analysis
+ */
+
+struct allocated_headers {
+ struct allocated_headers *next; /* linked list */
+ struct lws *wsi; /* owner */
+ char *data; /* prepared by context init to point to dedicated storage */
+ ah_data_idx_t data_length;
+ /*
+ * the randomly ordered fragments, indexed by frag_index and
+ * lws_fragments->nfrag for continuation.
+ */
+ struct lws_fragments frags[WSI_TOKEN_COUNT];
+ time_t assigned;
+ /*
+ * for each recognized token, frag_index says which frag[] his data
+ * starts in (0 means the token did not appear)
+ * the actual header data gets dumped as it comes in, into data[]
+ */
+ uint8_t frag_index[WSI_TOKEN_COUNT];
+
+#ifndef LWS_NO_CLIENT
+ char initial_handshake_hash_base64[30];
+#endif
+
+ uint32_t pos;
+ uint32_t http_response;
+ uint32_t current_token_limit;
+ int hdr_token_idx;
+
+ int16_t lextable_pos;
+
+ uint8_t in_use;
+ uint8_t nfrag;
+ char /*enum uri_path_states */ ups;
+ char /*enum uri_esc_states */ ues;
+
+ char esc_stash;
+ char post_literal_equal;
+ uint8_t /* enum lws_token_indexes */ parser_state;
+};
+
+
+
+#if defined(LWS_WITH_HTTP_PROXY)
+struct lws_rewrite {
+ hubbub_parser *parser;
+ hubbub_parser_optparams params;
+ const char *from, *to;
+ int from_len, to_len;
+ unsigned char *p, *end;
+ struct lws *wsi;
+};
+static LWS_INLINE int hstrcmp(hubbub_string *s, const char *p, int len)
+{
+ if ((int)s->len != len)
+ return 1;
+
+ return strncmp((const char *)s->ptr, p, len);
+}
+typedef hubbub_error (*hubbub_callback_t)(const hubbub_token *token, void *pw);
+LWS_EXTERN struct lws_rewrite *
+lws_rewrite_create(struct lws *wsi, hubbub_callback_t cb, const char *from, const char *to);
+LWS_EXTERN void
+lws_rewrite_destroy(struct lws_rewrite *r);
+LWS_EXTERN int
+lws_rewrite_parse(struct lws_rewrite *r, const unsigned char *in, int in_len);
+#endif
+
+struct lws_pt_role_http {
+ struct allocated_headers *ah_list;
+ struct lws *ah_wait_list;
+#ifdef LWS_WITH_CGI
+ struct lws_cgi *cgi_list;
+#endif
+ int ah_wait_list_length;
+ uint32_t ah_pool_length;
+
+ int ah_count_in_use;
+};
+
+struct lws_peer_role_http {
+ uint32_t count_ah;
+ uint32_t total_ah;
+};
+
+struct lws_vhost_role_http {
+ char http_proxy_address[128];
+ const struct lws_http_mount *mount_list;
+ const char *error_document_404;
+ unsigned int http_proxy_port;
+};
+
+#ifdef LWS_WITH_ACCESS_LOG
+struct lws_access_log {
+ char *header_log;
+ char *user_agent;
+ char *referrer;
+ unsigned long sent;
+ int response;
+};
+#endif
+
+struct _lws_http_mode_related {
+ struct lws *new_wsi_list;
+
+#if defined(LWS_WITH_HTTP_PROXY)
+ struct lws_rewrite *rw;
+#endif
+ struct allocated_headers *ah;
+ struct lws *ah_wait_list;
+
+ lws_filepos_t filepos;
+ lws_filepos_t filelen;
+ lws_fop_fd_t fop_fd;
+
+#if defined(LWS_WITH_RANGES)
+ struct lws_range_parsing range;
+ char multipart_content_type[64];
+#endif
+
+#ifdef LWS_WITH_ACCESS_LOG
+ struct lws_access_log access_log;
+#endif
+#ifdef LWS_WITH_CGI
+ struct lws_cgi *cgi; /* wsi being cgi master have one of these */
+#endif
+
+ enum http_version request_version;
+ enum http_connection_type connection_type;
+ lws_filepos_t tx_content_length;
+ lws_filepos_t tx_content_remain;
+ lws_filepos_t rx_content_length;
+ lws_filepos_t rx_content_remain;
+
+#if defined(LWS_WITH_HTTP_PROXY)
+ unsigned int perform_rewrite:1;
+#endif
+};
+
+
+#ifndef LWS_NO_CLIENT
+enum lws_chunk_parser {
+ ELCP_HEX,
+ ELCP_CR,
+ ELCP_CONTENT,
+ ELCP_POST_CR,
+ ELCP_POST_LF,
+};
+#endif
+
+enum lws_parse_urldecode_results {
+ LPUR_CONTINUE,
+ LPUR_SWALLOW,
+ LPUR_FORBID,
+ LPUR_EXCESSIVE,
+};
+
+int
+lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len);
+
+void
+_lws_header_table_reset(struct allocated_headers *ah);
+
+LWS_EXTERN int
+_lws_destroy_ah(struct lws_context_per_thread *pt, struct allocated_headers *ah);
diff --git a/thirdparty/libwebsockets/roles/http/server/access-log.c b/thirdparty/libwebsockets/roles/http/server/access-log.c
new file mode 100644
index 0000000000..0e75309d7a
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/http/server/access-log.c
@@ -0,0 +1,182 @@
+/*
+ * libwebsockets - server access log handling
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+/*
+ * Produce Apache-compatible log string for wsi, like this:
+ *
+ * 2.31.234.19 - - [27/Mar/2016:03:22:44 +0800]
+ * "GET /aep-screen.png HTTP/1.1"
+ * 200 152987 "https://libwebsockets.org/index.html"
+ * "Mozilla/5.0 (Macint... Chrome/49.0.2623.87 Safari/537.36"
+ *
+ */
+
+extern const char * const method_names[];
+
+static const char * const hver[] = {
+ "HTTP/1.0", "HTTP/1.1", "HTTP/2"
+};
+
+void
+lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int meth)
+{
+#ifdef LWS_WITH_IPV6
+ char ads[INET6_ADDRSTRLEN];
+#else
+ char ads[INET_ADDRSTRLEN];
+#endif
+ char da[64];
+ const char *pa, *me;
+ struct tm *tmp;
+ time_t t = time(NULL);
+ int l = 256, m;
+
+ if (!wsi->vhost)
+ return;
+
+ /* only worry about preparing it if we store it */
+ if (wsi->vhost->log_fd == (int)LWS_INVALID_FILE)
+ return;
+
+ if (wsi->access_log_pending)
+ lws_access_log(wsi);
+
+ wsi->http.access_log.header_log = lws_malloc(l, "access log");
+ if (wsi->http.access_log.header_log) {
+
+ tmp = localtime(&t);
+ if (tmp)
+ strftime(da, sizeof(da), "%d/%b/%Y:%H:%M:%S %z", tmp);
+ else
+ strcpy(da, "01/Jan/1970:00:00:00 +0000");
+
+ pa = lws_get_peer_simple(wsi, ads, sizeof(ads));
+ if (!pa)
+ pa = "(unknown)";
+
+ if (wsi->http2_substream)
+ me = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COLON_METHOD);
+ else
+ me = method_names[meth];
+ if (!me)
+ me = "(null)";
+
+ lws_snprintf(wsi->http.access_log.header_log, l,
+ "%s - - [%s] \"%s %s %s\"",
+ pa, da, me, uri_ptr,
+ hver[wsi->http.request_version]);
+
+ l = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_USER_AGENT);
+ if (l) {
+ wsi->http.access_log.user_agent = lws_malloc(l + 2, "access log");
+ if (!wsi->http.access_log.user_agent) {
+ lwsl_err("OOM getting user agent\n");
+ lws_free_set_NULL(wsi->http.access_log.header_log);
+ return;
+ }
+
+ lws_hdr_copy(wsi, wsi->http.access_log.user_agent,
+ l + 1, WSI_TOKEN_HTTP_USER_AGENT);
+
+ for (m = 0; m < l; m++)
+ if (wsi->http.access_log.user_agent[m] == '\"')
+ wsi->http.access_log.user_agent[m] = '\'';
+ }
+ l = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_REFERER);
+ if (l) {
+ wsi->http.access_log.referrer = lws_malloc(l + 2, "referrer");
+ if (!wsi->http.access_log.referrer) {
+ lwsl_err("OOM getting user agent\n");
+ lws_free_set_NULL(wsi->http.access_log.user_agent);
+ lws_free_set_NULL(wsi->http.access_log.header_log);
+ return;
+ }
+ lws_hdr_copy(wsi, wsi->http.access_log.referrer,
+ l + 1, WSI_TOKEN_HTTP_REFERER);
+
+ for (m = 0; m < l; m++)
+ if (wsi->http.access_log.referrer[m] == '\"')
+ wsi->http.access_log.referrer[m] = '\'';
+ }
+ wsi->access_log_pending = 1;
+ }
+}
+
+
+int
+lws_access_log(struct lws *wsi)
+{
+ char *p = wsi->http.access_log.user_agent, ass[512],
+ *p1 = wsi->http.access_log.referrer;
+ int l;
+
+ if (!wsi->vhost)
+ return 0;
+
+ if (wsi->vhost->log_fd == (int)LWS_INVALID_FILE)
+ return 0;
+
+ if (!wsi->access_log_pending)
+ return 0;
+
+ if (!wsi->http.access_log.header_log)
+ return 0;
+
+ if (!p)
+ p = "";
+
+ if (!p1)
+ p1 = "";
+
+ /*
+ * We do this in two parts to restrict an oversize referrer such that
+ * we will always have space left to append an empty useragent, while
+ * maintaining the structure of the log text
+ */
+ l = lws_snprintf(ass, sizeof(ass) - 7, "%s %d %lu \"%s",
+ wsi->http.access_log.header_log,
+ wsi->http.access_log.response, wsi->http.access_log.sent, p1);
+ if (strlen(p) > sizeof(ass) - 6 - l)
+ p[sizeof(ass) - 6 - l] = '\0';
+ l += lws_snprintf(ass + l, sizeof(ass) - 1 - l, "\" \"%s\"\n", p);
+
+ if (write(wsi->vhost->log_fd, ass, l) != l)
+ lwsl_err("Failed to write log\n");
+
+ if (wsi->http.access_log.header_log) {
+ lws_free(wsi->http.access_log.header_log);
+ wsi->http.access_log.header_log = NULL;
+ }
+ if (wsi->http.access_log.user_agent) {
+ lws_free(wsi->http.access_log.user_agent);
+ wsi->http.access_log.user_agent = NULL;
+ }
+ if (wsi->http.access_log.referrer) {
+ lws_free(wsi->http.access_log.referrer);
+ wsi->http.access_log.referrer = NULL;
+ }
+ wsi->access_log_pending = 0;
+
+ return 0;
+}
+
diff --git a/thirdparty/lws/server/fops-zip.c b/thirdparty/libwebsockets/roles/http/server/fops-zip.c
index 2b254f67af..4db83ce621 100644
--- a/thirdparty/lws/server/fops-zip.c
+++ b/thirdparty/libwebsockets/roles/http/server/fops-zip.c
@@ -51,7 +51,7 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
#include <zlib.h>
@@ -241,13 +241,13 @@ lws_fops_zip_scan(lws_fops_zip_t priv, const char *name, int len)
if (priv->hdr.filename_len != len)
goto next;
- if (len >= sizeof(buf) - 1)
+ if (len >= (int)sizeof(buf) - 1)
return LWS_FZ_ERR_NAME_TOO_LONG;
if (priv->zip_fop_fd->fops->LWS_FOP_READ(priv->zip_fop_fd,
&amount, buf, len))
return LWS_FZ_ERR_NAME_READ;
- if (amount != len)
+ if ((int)amount != len)
return LWS_FZ_ERR_NAME_READ;
buf[len] = '\0';
@@ -348,9 +348,8 @@ lws_fops_zip_open(const struct lws_plat_file_ops *fops, const char *vfs_path,
m = sizeof(rp) - 1;
if ((vpath - vfs_path - 1) < m)
- m = vpath - vfs_path - 1;
- strncpy(rp, vfs_path, m);
- rp[m] = '\0';
+ m = lws_ptr_diff(vpath, vfs_path) - 1;
+ lws_strncpy(rp, vfs_path, m + 1);
/* open the zip file itself using the incoming fops, not fops_zip */
@@ -363,7 +362,7 @@ lws_fops_zip_open(const struct lws_plat_file_ops *fops, const char *vfs_path,
if (*vpath == '/')
vpath++;
- m = lws_fops_zip_scan(priv, vpath, strlen(vpath));
+ m = lws_fops_zip_scan(priv, vpath, (int)strlen(vpath));
if (m) {
lwsl_err("unable to find record matching '%s' %d\n", vpath, m);
goto bail2;
@@ -565,7 +564,7 @@ spin:
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR;
- /* and fall through */
+ /* fallthru */
case Z_DATA_ERROR:
case Z_MEM_ERROR:
diff --git a/thirdparty/lws/server/lejp-conf.c b/thirdparty/libwebsockets/roles/http/server/lejp-conf.c
index c2b684c278..e9ce854cfc 100644
--- a/thirdparty/lws/server/lejp-conf.c
+++ b/thirdparty/libwebsockets/roles/http/server/lejp-conf.c
@@ -19,8 +19,7 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
-#include "../misc/lejp.h"
+#include "core/private.h"
#ifndef _WIN32
/* this is needed for Travis CI */
@@ -40,6 +39,7 @@ static const char * const paths_global[] = {
"global.timeout-secs",
"global.reject-service-keywords[].*",
"global.reject-service-keywords[]",
+ "global.default-alpn",
};
enum lejp_global_paths {
@@ -52,7 +52,8 @@ enum lejp_global_paths {
LWJPGP_PINGPONG_SECS,
LWJPGP_TIMEOUT_SECS,
LWJPGP_REJECT_SERVICE_KEYWORDS_NAME,
- LWJPGP_REJECT_SERVICE_KEYWORDS
+ LWJPGP_REJECT_SERVICE_KEYWORDS,
+ LWJPGP_DEFAULT_ALPN,
};
static const char * const paths_vhosts[] = {
@@ -100,6 +101,10 @@ static const char * const paths_vhosts[] = {
"vhosts[].client-ssl-ca",
"vhosts[].client-ssl-ciphers",
"vhosts[].onlyraw",
+ "vhosts[].client-cert-required",
+ "vhosts[].ignore-missing-cert",
+ "vhosts[].error-document-404",
+ "vhosts[].alpn",
};
enum lejp_vhost_paths {
@@ -147,6 +152,10 @@ enum lejp_vhost_paths {
LEJPVP_CLIENT_SSL_CA,
LEJPVP_CLIENT_CIPHERS,
LEJPVP_FLAG_ONLYRAW,
+ LEJPVP_FLAG_CLIENT_CERT_REQUIRED,
+ LEJPVP_IGNORE_MISSING_CERT,
+ LEJPVP_ERROR_DOCUMENT_404,
+ LEJPVP_ALPN,
};
static const char * const parser_errs[] = {
@@ -216,7 +225,7 @@ arg_to_bool(const char *s)
if (n)
return 1;
- for (n = 0; n < ARRAY_SIZE(on); n++)
+ for (n = 0; n < (int)ARRAY_SIZE(on); n++)
if (!strcasecmp(s, on[n]))
return 1;
@@ -285,6 +294,10 @@ lejp_globals_cb(struct lejp_ctx *ctx, char reason)
a->info->timeout_secs = atoi(ctx->buf);
return 0;
+ case LWJPGP_DEFAULT_ALPN:
+ a->info->alpn = a->p;
+ break;
+
default:
return 0;
}
@@ -312,20 +325,39 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
#endif
if (reason == LEJPCB_OBJECT_START && ctx->path_match == LEJPVP + 1) {
+ uint32_t i[4];
+ const char *ss;
+
/* set the defaults for this vhost */
a->valid = 1;
a->head = NULL;
a->last = NULL;
- a->info->port = 0;
- a->info->iface = NULL;
+
+ i[0] = a->info->count_threads;
+ i[1] = a->info->options & (
+ LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME |
+ LWS_SERVER_OPTION_LIBUV |
+ LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT |
+ LWS_SERVER_OPTION_EXPLICIT_VHOSTS |
+ LWS_SERVER_OPTION_UV_NO_SIGSEGV_SIGFPE_SPIN |
+ LWS_SERVER_OPTION_LIBEVENT |
+ LWS_SERVER_OPTION_LIBEV
+ );
+ ss = a->info->server_string;
+ i[2] = a->info->ws_ping_pong_interval;
+ i[3] = a->info->timeout_secs;
+
+ memset(a->info, 0, sizeof(*a->info));
+
+ a->info->count_threads = i[0];
+ a->info->options = i[1];
+ a->info->server_string = ss;
+ a->info->ws_ping_pong_interval = i[2];
+ a->info->timeout_secs = i[3];
+
a->info->protocols = a->protocols;
a->info->extensions = a->extensions;
- a->info->ssl_cert_filepath = NULL;
- a->info->ssl_private_key_filepath = NULL;
- a->info->ssl_ca_filepath = NULL;
- a->info->client_ssl_cert_filepath = NULL;
- a->info->client_ssl_private_key_filepath = NULL;
- a->info->client_ssl_ca_filepath = NULL;
+#if defined(LWS_WITH_TLS)
a->info->client_ssl_cipher_list = "ECDHE-ECDSA-AES256-GCM-SHA384:"
"ECDHE-RSA-AES256-GCM-SHA384:"
"DHE-RSA-AES256-GCM-SHA384:"
@@ -339,7 +371,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
"!DHE-RSA-AES256-SHA256:"
"!AES256-GCM-SHA384:"
"!AES256-SHA256";
- a->info->timeout_secs = 5;
+#endif
a->info->ssl_cipher_list = "ECDHE-ECDSA-AES256-GCM-SHA384:"
"ECDHE-RSA-AES256-GCM-SHA384:"
"DHE-RSA-AES256-GCM-SHA384:"
@@ -353,13 +385,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
"!DHE-RSA-AES256-SHA256:"
"!AES256-GCM-SHA384:"
"!AES256-SHA256";
- a->info->pvo = NULL;
- a->info->headers = NULL;
a->info->keepalive_timeout = 5;
- a->info->log_filepath = NULL;
- a->info->options &= ~(LWS_SERVER_OPTION_UNIX_SOCK |
- LWS_SERVER_OPTION_STS | LWS_SERVER_OPTION_ONLY_RAW);
- a->enable_client_ssl = 0;
}
if (reason == LEJPCB_OBJECT_START &&
@@ -379,7 +405,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->pvo->next = a->info->pvo;
a->info->pvo = a->pvo;
a->pvo->name = a->p;
- lwsl_notice(" adding protocol %s\n", a->p);
+ lwsl_info(" adding protocol %s\n", a->p);
a->p += n;
a->pvo->value = a->p;
a->pvo->options = NULL;
@@ -431,6 +457,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
}
a->any_vhosts = 1;
+#if defined(LWS_WITH_TLS)
if (a->enable_client_ssl) {
const char *cert_filepath = a->info->client_ssl_cert_filepath;
const char *private_key_filepath = a->info->client_ssl_private_key_filepath;
@@ -444,6 +471,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->info->options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
lws_init_vhost_client_ssl(a->info, vhost);
}
+#endif
return 0;
}
@@ -474,7 +502,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
if (a->last)
a->last->mount_next = m;
- for (n = 0; n < ARRAY_SIZE(mount_protocols); n++)
+ for (n = 0; n < (int)ARRAY_SIZE(mount_protocols); n++)
if (!strncmp(a->m.origin, mount_protocols[n],
strlen(mount_protocols[n]))) {
lwsl_info("----%s\n", a->m.origin);
@@ -484,7 +512,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
break;
}
- if (n == ARRAY_SIZE(mount_protocols)) {
+ if (n == (int)ARRAY_SIZE(mount_protocols)) {
lwsl_err("unsupported protocol:// %s\n", a->m.origin);
return 1;
}
@@ -573,9 +601,11 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
case LEJPVP_KEEPALIVE_TIMEOUT:
a->info->keepalive_timeout = atoi(ctx->buf);
return 0;
+#if defined(LWS_WITH_TLS)
case LEJPVP_CLIENT_CIPHERS:
a->info->client_ssl_cipher_list = a->p;
break;
+#endif
case LEJPVP_CIPHERS:
a->info->ssl_cipher_list = a->p;
break;
@@ -651,6 +681,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
case LEJPVP_ENABLE_CLIENT_SSL:
a->enable_client_ssl = arg_to_bool(ctx->buf);
return 0;
+#if defined(LWS_WITH_TLS)
case LEJPVP_CLIENT_SSL_KEY:
a->info->client_ssl_private_key_filepath = a->p;
break;
@@ -660,6 +691,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
case LEJPVP_CLIENT_SSL_CA:
a->info->client_ssl_ca_filepath = a->p;
break;
+#endif
case LEJPVP_NOIPV6:
if (arg_to_bool(ctx->buf))
@@ -683,6 +715,24 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->info->options &= ~(LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE);
return 0;
+ case LEJPVP_FLAG_CLIENT_CERT_REQUIRED:
+ if (arg_to_bool(ctx->buf))
+ a->info->options |=
+ LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT;
+ return 0;
+
+ case LEJPVP_IGNORE_MISSING_CERT:
+ if (arg_to_bool(ctx->buf))
+ a->info->options |= LWS_SERVER_OPTION_IGNORE_MISSING_CERT;
+ else
+ a->info->options &= ~(LWS_SERVER_OPTION_IGNORE_MISSING_CERT);
+
+ return 0;
+
+ case LEJPVP_ERROR_DOCUMENT_404:
+ a->info->error_document_404 = a->p;
+ break;
+
case LEJPVP_SSL_OPTION_SET:
a->info->ssl_options_set |= atol(ctx->buf);
return 0;
@@ -690,6 +740,10 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
a->info->ssl_options_clear |= atol(ctx->buf);
return 0;
+ case LEJPVP_ALPN:
+ a->info->alpn = a->p;
+ break;
+
default:
return 0;
}
@@ -701,7 +755,7 @@ dostring:
n = p1 - p;
if (n > a->end - a->p)
n = a->end - a->p;
- strncpy(a->p, p, n);
+ lws_strncpy(a->p, p, n + 1);
a->p += n;
a->p += lws_snprintf(a->p, a->end - a->p, "%s", LWS_INSTALL_DATADIR);
p += n + strlen(ESC_INSTALL_DATADIR);
diff --git a/thirdparty/libwebsockets/roles/http/server/parsers.c b/thirdparty/libwebsockets/roles/http/server/parsers.c
new file mode 100644
index 0000000000..cb022e362b
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/http/server/parsers.c
@@ -0,0 +1,1139 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+static const unsigned char lextable[] = {
+ #include "../lextable.h"
+};
+
+#define FAIL_CHAR 0x08
+
+static struct allocated_headers *
+_lws_create_ah(struct lws_context_per_thread *pt, ah_data_idx_t data_size)
+{
+ struct allocated_headers *ah = lws_zalloc(sizeof(*ah), "ah struct");
+
+ if (!ah)
+ return NULL;
+
+ ah->data = lws_malloc(data_size, "ah data");
+ if (!ah->data) {
+ lws_free(ah);
+
+ return NULL;
+ }
+ ah->next = pt->http.ah_list;
+ pt->http.ah_list = ah;
+ ah->data_length = data_size;
+ pt->http.ah_pool_length++;
+
+ lwsl_info("%s: created ah %p (size %d): pool length %d\n", __func__,
+ ah, (int)data_size, pt->http.ah_pool_length);
+
+ return ah;
+}
+
+int
+_lws_destroy_ah(struct lws_context_per_thread *pt, struct allocated_headers *ah)
+{
+ lws_start_foreach_llp(struct allocated_headers **, a, pt->http.ah_list) {
+ if ((*a) == ah) {
+ *a = ah->next;
+ pt->http.ah_pool_length--;
+ lwsl_info("%s: freed ah %p : pool length %d\n",
+ __func__, ah, pt->http.ah_pool_length);
+ if (ah->data)
+ lws_free(ah->data);
+ lws_free(ah);
+
+ return 0;
+ }
+ } lws_end_foreach_llp(a, next);
+
+ return 1;
+}
+
+void
+_lws_header_table_reset(struct allocated_headers *ah)
+{
+ /* init the ah to reflect no headers or data have appeared yet */
+ memset(ah->frag_index, 0, sizeof(ah->frag_index));
+ memset(ah->frags, 0, sizeof(ah->frags));
+ ah->nfrag = 0;
+ ah->pos = 0;
+ ah->http_response = 0;
+ ah->parser_state = WSI_TOKEN_NAME_PART;
+ ah->lextable_pos = 0;
+}
+
+// doesn't scrub the ah rxbuffer by default, parent must do if needed
+
+void
+__lws_header_table_reset(struct lws *wsi, int autoservice)
+{
+ struct allocated_headers *ah = wsi->http.ah;
+ struct lws_context_per_thread *pt;
+ struct lws_pollfd *pfd;
+
+ /* if we have the idea we're resetting 'our' ah, must be bound to one */
+ assert(ah);
+ /* ah also concurs with ownership */
+ assert(ah->wsi == wsi);
+
+ _lws_header_table_reset(ah);
+
+ /* since we will restart the ah, our new headers are not completed */
+ wsi->hdr_parsing_completed = 0;
+
+ /* while we hold the ah, keep a timeout on the wsi */
+ __lws_set_timeout(wsi, PENDING_TIMEOUT_HOLDING_AH,
+ wsi->vhost->timeout_secs_ah_idle);
+
+ time(&ah->assigned);
+
+ if (wsi->position_in_fds_table != LWS_NO_FDS_POS &&
+ lws_buflist_next_segment_len(&wsi->buflist, NULL) &&
+ autoservice) {
+ lwsl_debug("%s: service on readbuf ah\n", __func__);
+
+ pt = &wsi->context->pt[(int)wsi->tsi];
+ /*
+ * Unlike a normal connect, we have the headers already
+ * (or the first part of them anyway)
+ */
+ pfd = &pt->fds[wsi->position_in_fds_table];
+ pfd->revents |= LWS_POLLIN;
+ lwsl_err("%s: calling service\n", __func__);
+ lws_service_fd_tsi(wsi->context, pfd, wsi->tsi);
+ }
+}
+
+void
+lws_header_table_reset(struct lws *wsi, int autoservice)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ lws_pt_lock(pt, __func__);
+
+ __lws_header_table_reset(wsi, autoservice);
+
+ lws_pt_unlock(pt);
+}
+
+static void
+_lws_header_ensure_we_are_on_waiting_list(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ struct lws_pollargs pa;
+ struct lws **pwsi = &pt->http.ah_wait_list;
+
+ while (*pwsi) {
+ if (*pwsi == wsi)
+ return;
+ pwsi = &(*pwsi)->http.ah_wait_list;
+ }
+
+ lwsl_info("%s: wsi: %p\n", __func__, wsi);
+ wsi->http.ah_wait_list = pt->http.ah_wait_list;
+ pt->http.ah_wait_list = wsi;
+ pt->http.ah_wait_list_length++;
+
+ /* we cannot accept input then */
+
+ _lws_change_pollfd(wsi, LWS_POLLIN, 0, &pa);
+}
+
+static int
+__lws_remove_from_ah_waiting_list(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ struct lws **pwsi =&pt->http.ah_wait_list;
+
+ while (*pwsi) {
+ if (*pwsi == wsi) {
+ lwsl_info("%s: wsi %p\n", __func__, wsi);
+ /* point prev guy to our next */
+ *pwsi = wsi->http.ah_wait_list;
+ /* we shouldn't point anywhere now */
+ wsi->http.ah_wait_list = NULL;
+ pt->http.ah_wait_list_length--;
+
+ return 1;
+ }
+ pwsi = &(*pwsi)->http.ah_wait_list;
+ }
+
+ return 0;
+}
+
+int LWS_WARN_UNUSED_RESULT
+lws_header_table_attach(struct lws *wsi, int autoservice)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ struct lws_pollargs pa;
+ int n;
+
+ lwsl_info("%s: wsi %p: ah %p (tsi %d, count = %d) in\n", __func__,
+ (void *)wsi, (void *)wsi->http.ah, wsi->tsi,
+ pt->http.ah_count_in_use);
+
+ lws_pt_lock(pt, __func__);
+
+ /* if we are already bound to one, just clear it down */
+ if (wsi->http.ah) {
+ lwsl_info("%s: cleardown\n", __func__);
+ goto reset;
+ }
+
+ n = pt->http.ah_count_in_use == context->max_http_header_pool;
+#if defined(LWS_WITH_PEER_LIMITS)
+ if (!n) {
+ n = lws_peer_confirm_ah_attach_ok(context, wsi->peer);
+ if (n)
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_PEER_LIMIT_AH_DENIED, 1);
+ }
+#endif
+ if (n) {
+ /*
+ * Pool is either all busy, or we don't want to give this
+ * particular guy an ah right now...
+ *
+ * Make sure we are on the waiting list, and return that we
+ * weren't able to provide the ah
+ */
+ _lws_header_ensure_we_are_on_waiting_list(wsi);
+
+ goto bail;
+ }
+
+ __lws_remove_from_ah_waiting_list(wsi);
+
+ wsi->http.ah = _lws_create_ah(pt, context->max_http_header_data);
+ if (!wsi->http.ah) { /* we could not create an ah */
+ _lws_header_ensure_we_are_on_waiting_list(wsi);
+
+ goto bail;
+ }
+
+ wsi->http.ah->in_use = 1;
+ wsi->http.ah->wsi = wsi; /* mark our owner */
+ pt->http.ah_count_in_use++;
+
+#if defined(LWS_WITH_PEER_LIMITS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
+ lws_context_lock(context); /* <====================================== */
+ if (wsi->peer)
+ wsi->peer->http.count_ah++;
+ lws_context_unlock(context); /* ====================================> */
+#endif
+
+ _lws_change_pollfd(wsi, 0, LWS_POLLIN, &pa);
+
+ lwsl_info("%s: did attach wsi %p: ah %p: count %d (on exit)\n", __func__,
+ (void *)wsi, (void *)wsi->http.ah, pt->http.ah_count_in_use);
+
+reset:
+ __lws_header_table_reset(wsi, autoservice);
+
+ lws_pt_unlock(pt);
+
+#ifndef LWS_NO_CLIENT
+ if (lwsi_role_client(wsi) && lwsi_state(wsi) == LRS_UNCONNECTED)
+ if (!lws_client_connect_via_info2(wsi))
+ /* our client connect has failed, the wsi
+ * has been closed
+ */
+ return -1;
+#endif
+
+ return 0;
+
+bail:
+ lws_pt_unlock(pt);
+
+ return 1;
+}
+
+int __lws_header_table_detach(struct lws *wsi, int autoservice)
+{
+ struct lws_context *context = wsi->context;
+ struct allocated_headers *ah = wsi->http.ah;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ struct lws_pollargs pa;
+ struct lws **pwsi, **pwsi_eligible;
+ time_t now;
+
+ __lws_remove_from_ah_waiting_list(wsi);
+
+ if (!ah)
+ return 0;
+
+ lwsl_info("%s: wsi %p: ah %p (tsi=%d, count = %d)\n", __func__,
+ (void *)wsi, (void *)ah, wsi->tsi,
+ pt->http.ah_count_in_use);
+
+ /* we did have an ah attached */
+ time(&now);
+ if (ah->assigned && now - ah->assigned > 3) {
+ /*
+ * we're detaching the ah, but it was held an
+ * unreasonably long time
+ */
+ lwsl_debug("%s: wsi %p: ah held %ds, role/state 0x%x 0x%x,"
+ "\n", __func__, wsi, (int)(now - ah->assigned),
+ lwsi_role(wsi), lwsi_state(wsi));
+ }
+
+ ah->assigned = 0;
+
+ /* if we think we're detaching one, there should be one in use */
+ assert(pt->http.ah_count_in_use > 0);
+ /* and this specific one should have been in use */
+ assert(ah->in_use);
+ memset(&wsi->http.ah, 0, sizeof(wsi->http.ah));
+
+#if defined(LWS_WITH_PEER_LIMITS)
+ if (ah->wsi)
+ lws_peer_track_ah_detach(context, wsi->peer);
+#endif
+ ah->wsi = NULL; /* no owner */
+
+ pwsi = &pt->http.ah_wait_list;
+
+ /* oh there is nobody on the waiting list... leave the ah unattached */
+ if (!*pwsi)
+ goto nobody_usable_waiting;
+
+ /*
+ * at least one wsi on the same tsi is waiting, give it to oldest guy
+ * who is allowed to take it (if any)
+ */
+ lwsl_info("pt wait list %p\n", *pwsi);
+ wsi = NULL;
+ pwsi_eligible = NULL;
+
+ while (*pwsi) {
+#if defined(LWS_WITH_PEER_LIMITS)
+ /* are we willing to give this guy an ah? */
+ if (!lws_peer_confirm_ah_attach_ok(context, (*pwsi)->peer))
+#endif
+ {
+ wsi = *pwsi;
+ pwsi_eligible = pwsi;
+ }
+#if defined(LWS_WITH_PEER_LIMITS)
+ else
+ if (!(*pwsi)->http.ah_wait_list)
+ lws_stats_atomic_bump(context, pt,
+ LWSSTATS_C_PEER_LIMIT_AH_DENIED, 1);
+#endif
+ pwsi = &(*pwsi)->http.ah_wait_list;
+ }
+
+ if (!wsi) /* everybody waiting already has too many ah... */
+ goto nobody_usable_waiting;
+
+ lwsl_info("%s: transferring ah to last eligible wsi in wait list %p (wsistate 0x%x)\n", __func__, wsi, wsi->wsistate);
+
+ wsi->http.ah = ah;
+ ah->wsi = wsi; /* new owner */
+
+ __lws_header_table_reset(wsi, autoservice);
+#if defined(LWS_WITH_PEER_LIMITS) && (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))
+ lws_context_lock(context); /* <====================================== */
+ if (wsi->peer)
+ wsi->peer->http.count_ah++;
+ lws_context_unlock(context); /* ====================================> */
+#endif
+
+ /* clients acquire the ah and then insert themselves in fds table... */
+ if (wsi->position_in_fds_table != LWS_NO_FDS_POS) {
+ lwsl_info("%s: Enabling %p POLLIN\n", __func__, wsi);
+
+ /* he has been stuck waiting for an ah, but now his wait is
+ * over, let him progress */
+
+ _lws_change_pollfd(wsi, 0, LWS_POLLIN, &pa);
+ }
+
+ /* point prev guy to next guy in list instead */
+ *pwsi_eligible = wsi->http.ah_wait_list;
+ /* the guy who got one is out of the list */
+ wsi->http.ah_wait_list = NULL;
+ pt->http.ah_wait_list_length--;
+
+#ifndef LWS_NO_CLIENT
+ if (lwsi_role_client(wsi) && lwsi_state(wsi) == LRS_UNCONNECTED) {
+ lws_pt_unlock(pt);
+
+ if (!lws_client_connect_via_info2(wsi)) {
+ /* our client connect has failed, the wsi
+ * has been closed
+ */
+
+ return -1;
+ }
+ return 0;
+ }
+#endif
+
+ assert(!!pt->http.ah_wait_list_length == !!(lws_intptr_t)pt->http.ah_wait_list);
+bail:
+ lwsl_info("%s: wsi %p: ah %p (tsi=%d, count = %d)\n", __func__,
+ (void *)wsi, (void *)ah, pt->tid, pt->http.ah_count_in_use);
+
+ return 0;
+
+nobody_usable_waiting:
+ lwsl_info("%s: nobody usable waiting\n", __func__);
+ _lws_destroy_ah(pt, ah);
+ pt->http.ah_count_in_use--;
+
+ goto bail;
+}
+
+int lws_header_table_detach(struct lws *wsi, int autoservice)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ int n;
+
+ lws_pt_lock(pt, __func__);
+ n = __lws_header_table_detach(wsi, autoservice);
+ lws_pt_unlock(pt);
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx)
+{
+ int n;
+
+ if (!wsi->http.ah)
+ return 0;
+
+ n = wsi->http.ah->frag_index[h];
+ if (!n)
+ return 0;
+ do {
+ if (!frag_idx)
+ return wsi->http.ah->frags[n].len;
+ n = wsi->http.ah->frags[n].nfrag;
+ } while (frag_idx-- && n);
+
+ return 0;
+}
+
+LWS_VISIBLE int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)
+{
+ int n;
+ int len = 0;
+
+ if (!wsi->http.ah)
+ return 0;
+
+ n = wsi->http.ah->frag_index[h];
+ if (!n)
+ return 0;
+ do {
+ len += wsi->http.ah->frags[n].len;
+ n = wsi->http.ah->frags[n].nfrag;
+ } while (n);
+
+ return len;
+}
+
+LWS_VISIBLE int lws_hdr_copy_fragment(struct lws *wsi, char *dst, int len,
+ enum lws_token_indexes h, int frag_idx)
+{
+ int n = 0;
+ int f;
+
+ if (!wsi->http.ah)
+ return -1;
+
+ f = wsi->http.ah->frag_index[h];
+
+ if (!f)
+ return -1;
+
+ while (n < frag_idx) {
+ f = wsi->http.ah->frags[f].nfrag;
+ if (!f)
+ return -1;
+ n++;
+ }
+
+ if (wsi->http.ah->frags[f].len >= len)
+ return -1;
+
+ memcpy(dst, wsi->http.ah->data + wsi->http.ah->frags[f].offset,
+ wsi->http.ah->frags[f].len);
+ dst[wsi->http.ah->frags[f].len] = '\0';
+
+ return wsi->http.ah->frags[f].len;
+}
+
+LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dst, int len,
+ enum lws_token_indexes h)
+{
+ int toklen = lws_hdr_total_length(wsi, h);
+ int n;
+
+ if (toklen >= len)
+ return -1;
+
+ if (!wsi->http.ah)
+ return -1;
+
+ n = wsi->http.ah->frag_index[h];
+ if (!n)
+ return 0;
+
+ do {
+ if (wsi->http.ah->frags[n].len >= len)
+ return -1;
+ strncpy(dst, &wsi->http.ah->data[wsi->http.ah->frags[n].offset],
+ wsi->http.ah->frags[n].len);
+ dst += wsi->http.ah->frags[n].len;
+ len -= wsi->http.ah->frags[n].len;
+ n = wsi->http.ah->frags[n].nfrag;
+ } while (n);
+ *dst = '\0';
+
+ return toklen;
+}
+
+char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)
+{
+ int n;
+
+ n = wsi->http.ah->frag_index[h];
+ if (!n)
+ return NULL;
+
+ return wsi->http.ah->data + wsi->http.ah->frags[n].offset;
+}
+
+static int LWS_WARN_UNUSED_RESULT
+lws_pos_in_bounds(struct lws *wsi)
+{
+ if (wsi->http.ah->pos <
+ (unsigned int)wsi->context->max_http_header_data)
+ return 0;
+
+ if ((int)wsi->http.ah->pos == wsi->context->max_http_header_data) {
+ lwsl_err("Ran out of header data space\n");
+ return 1;
+ }
+
+ /*
+ * with these tests everywhere, it should never be able to exceed
+ * the limit, only meet it
+ */
+ lwsl_err("%s: pos %d, limit %d\n", __func__, wsi->http.ah->pos,
+ wsi->context->max_http_header_data);
+ assert(0);
+
+ return 1;
+}
+
+int LWS_WARN_UNUSED_RESULT
+lws_hdr_simple_create(struct lws *wsi, enum lws_token_indexes h, const char *s)
+{
+ wsi->http.ah->nfrag++;
+ if (wsi->http.ah->nfrag == ARRAY_SIZE(wsi->http.ah->frags)) {
+ lwsl_warn("More hdr frags than we can deal with, dropping\n");
+ return -1;
+ }
+
+ wsi->http.ah->frag_index[h] = wsi->http.ah->nfrag;
+
+ wsi->http.ah->frags[wsi->http.ah->nfrag].offset = wsi->http.ah->pos;
+ wsi->http.ah->frags[wsi->http.ah->nfrag].len = 0;
+ wsi->http.ah->frags[wsi->http.ah->nfrag].nfrag = 0;
+
+ do {
+ if (lws_pos_in_bounds(wsi))
+ return -1;
+
+ wsi->http.ah->data[wsi->http.ah->pos++] = *s;
+ if (*s)
+ wsi->http.ah->frags[wsi->http.ah->nfrag].len++;
+ } while (*s++);
+
+ return 0;
+}
+
+static int LWS_WARN_UNUSED_RESULT
+issue_char(struct lws *wsi, unsigned char c)
+{
+ unsigned short frag_len;
+
+ if (lws_pos_in_bounds(wsi))
+ return -1;
+
+ frag_len = wsi->http.ah->frags[wsi->http.ah->nfrag].len;
+ /*
+ * If we haven't hit the token limit, just copy the character into
+ * the header
+ */
+ if (frag_len < wsi->http.ah->current_token_limit) {
+ wsi->http.ah->data[wsi->http.ah->pos++] = c;
+ if (c)
+ wsi->http.ah->frags[wsi->http.ah->nfrag].len++;
+ return 0;
+ }
+
+ /* Insert a null character when we *hit* the limit: */
+ if (frag_len == wsi->http.ah->current_token_limit) {
+ if (lws_pos_in_bounds(wsi))
+ return -1;
+
+ wsi->http.ah->data[wsi->http.ah->pos++] = '\0';
+ lwsl_warn("header %i exceeds limit %d\n",
+ wsi->http.ah->parser_state,
+ wsi->http.ah->current_token_limit);
+ }
+
+ return 1;
+}
+
+int
+lws_parse_urldecode(struct lws *wsi, uint8_t *_c)
+{
+ struct allocated_headers *ah = wsi->http.ah;
+ unsigned int enc = 0;
+ uint8_t c = *_c;
+
+ // lwsl_notice("ah->ups %d\n", ah->ups);
+
+ /*
+ * PRIORITY 1
+ * special URI processing... convert %xx
+ */
+ switch (ah->ues) {
+ case URIES_IDLE:
+ if (c == '%') {
+ ah->ues = URIES_SEEN_PERCENT;
+ goto swallow;
+ }
+ break;
+ case URIES_SEEN_PERCENT:
+ if (char_to_hex(c) < 0)
+ /* illegal post-% char */
+ goto forbid;
+
+ ah->esc_stash = c;
+ ah->ues = URIES_SEEN_PERCENT_H1;
+ goto swallow;
+
+ case URIES_SEEN_PERCENT_H1:
+ if (char_to_hex(c) < 0)
+ /* illegal post-% char */
+ goto forbid;
+
+ *_c = (char_to_hex(ah->esc_stash) << 4) |
+ char_to_hex(c);
+ c = *_c;
+ enc = 1;
+ ah->ues = URIES_IDLE;
+ break;
+ }
+
+ /*
+ * PRIORITY 2
+ * special URI processing...
+ * convert /.. or /... or /../ etc to /
+ * convert /./ to /
+ * convert // or /// etc to /
+ * leave /.dir or whatever alone
+ */
+
+ switch (ah->ups) {
+ case URIPS_IDLE:
+ if (!c)
+ return -1;
+ /* genuine delimiter */
+ if ((c == '&' || c == ';') && !enc) {
+ if (issue_char(wsi, c) < 0)
+ return -1;
+ /* swallow the terminator */
+ ah->frags[ah->nfrag].len--;
+ /* link to next fragment */
+ ah->frags[ah->nfrag].nfrag = ah->nfrag + 1;
+ ah->nfrag++;
+ if (ah->nfrag >= ARRAY_SIZE(ah->frags))
+ goto excessive;
+ /* start next fragment after the & */
+ ah->post_literal_equal = 0;
+ ah->frags[ah->nfrag].offset = ah->pos;
+ ah->frags[ah->nfrag].len = 0;
+ ah->frags[ah->nfrag].nfrag = 0;
+ goto swallow;
+ }
+ /* uriencoded = in the name part, disallow */
+ if (c == '=' && enc &&
+ ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS] &&
+ !ah->post_literal_equal) {
+ c = '_';
+ *_c =c;
+ }
+
+ /* after the real =, we don't care how many = */
+ if (c == '=' && !enc)
+ ah->post_literal_equal = 1;
+
+ /* + to space */
+ if (c == '+' && !enc) {
+ c = ' ';
+ *_c = c;
+ }
+ /* issue the first / always */
+ if (c == '/' && !ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS])
+ ah->ups = URIPS_SEEN_SLASH;
+ break;
+ case URIPS_SEEN_SLASH:
+ /* swallow subsequent slashes */
+ if (c == '/')
+ goto swallow;
+ /* track and swallow the first . after / */
+ if (c == '.') {
+ ah->ups = URIPS_SEEN_SLASH_DOT;
+ goto swallow;
+ }
+ ah->ups = URIPS_IDLE;
+ break;
+ case URIPS_SEEN_SLASH_DOT:
+ /* swallow second . */
+ if (c == '.') {
+ ah->ups = URIPS_SEEN_SLASH_DOT_DOT;
+ goto swallow;
+ }
+ /* change /./ to / */
+ if (c == '/') {
+ ah->ups = URIPS_SEEN_SLASH;
+ goto swallow;
+ }
+ /* it was like /.dir ... regurgitate the . */
+ ah->ups = URIPS_IDLE;
+ if (issue_char(wsi, '.') < 0)
+ return -1;
+ break;
+
+ case URIPS_SEEN_SLASH_DOT_DOT:
+
+ /* /../ or /..[End of URI] --> backup to last / */
+ if (c == '/' || c == '?') {
+ /*
+ * back up one dir level if possible
+ * safe against header fragmentation because
+ * the method URI can only be in 1 fragment
+ */
+ if (ah->frags[ah->nfrag].len > 2) {
+ ah->pos--;
+ ah->frags[ah->nfrag].len--;
+ do {
+ ah->pos--;
+ ah->frags[ah->nfrag].len--;
+ } while (ah->frags[ah->nfrag].len > 1 &&
+ ah->data[ah->pos] != '/');
+ }
+ ah->ups = URIPS_SEEN_SLASH;
+ if (ah->frags[ah->nfrag].len > 1)
+ break;
+ goto swallow;
+ }
+
+ /* /..[^/] ... regurgitate and allow */
+
+ if (issue_char(wsi, '.') < 0)
+ return -1;
+ if (issue_char(wsi, '.') < 0)
+ return -1;
+ ah->ups = URIPS_IDLE;
+ break;
+ }
+
+ if (c == '?' && !enc &&
+ !ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS]) { /* start of URI args */
+ if (ah->ues != URIES_IDLE)
+ goto forbid;
+
+ /* seal off uri header */
+ if (issue_char(wsi, '\0') < 0)
+ return -1;
+
+ /* move to using WSI_TOKEN_HTTP_URI_ARGS */
+ ah->nfrag++;
+ if (ah->nfrag >= ARRAY_SIZE(ah->frags))
+ goto excessive;
+ ah->frags[ah->nfrag].offset = ah->pos;
+ ah->frags[ah->nfrag].len = 0;
+ ah->frags[ah->nfrag].nfrag = 0;
+
+ ah->post_literal_equal = 0;
+ ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS] = ah->nfrag;
+ ah->ups = URIPS_IDLE;
+ goto swallow;
+ }
+
+ return LPUR_CONTINUE;
+
+swallow:
+ return LPUR_SWALLOW;
+
+forbid:
+ return LPUR_FORBID;
+
+excessive:
+ return LPUR_EXCESSIVE;
+}
+
+static const unsigned char methods[] = {
+ WSI_TOKEN_GET_URI,
+ WSI_TOKEN_POST_URI,
+ WSI_TOKEN_OPTIONS_URI,
+ WSI_TOKEN_PUT_URI,
+ WSI_TOKEN_PATCH_URI,
+ WSI_TOKEN_DELETE_URI,
+ WSI_TOKEN_CONNECT,
+ WSI_TOKEN_HEAD_URI,
+};
+
+/*
+ * possible returns:, -1 fail, 0 ok or 2, transition to raw
+ */
+
+int LWS_WARN_UNUSED_RESULT
+lws_parse(struct lws *wsi, unsigned char *buf, int *len)
+{
+ struct allocated_headers *ah = wsi->http.ah;
+ struct lws_context *context = wsi->context;
+ unsigned int n, m;
+ unsigned char c;
+ int r, pos;
+
+ assert(wsi->http.ah);
+
+ do {
+ (*len)--;
+ c = *buf++;
+
+ switch (ah->parser_state) {
+ default:
+
+ lwsl_parser("WSI_TOK_(%d) '%c'\n", ah->parser_state, c);
+
+ /* collect into malloc'd buffers */
+ /* optional initial space swallow */
+ if (!ah->frags[ah->frag_index[ah->parser_state]].len &&
+ c == ' ')
+ break;
+
+ for (m = 0; m < ARRAY_SIZE(methods); m++)
+ if (ah->parser_state == methods[m])
+ break;
+ if (m == ARRAY_SIZE(methods))
+ /* it was not any of the methods */
+ goto check_eol;
+
+ /* special URI processing... end at space */
+
+ if (c == ' ') {
+ /* enforce starting with / */
+ if (!ah->frags[ah->nfrag].len)
+ if (issue_char(wsi, '/') < 0)
+ return -1;
+
+ if (ah->ups == URIPS_SEEN_SLASH_DOT_DOT) {
+ /*
+ * back up one dir level if possible
+ * safe against header fragmentation because
+ * the method URI can only be in 1 fragment
+ */
+ if (ah->frags[ah->nfrag].len > 2) {
+ ah->pos--;
+ ah->frags[ah->nfrag].len--;
+ do {
+ ah->pos--;
+ ah->frags[ah->nfrag].len--;
+ } while (ah->frags[ah->nfrag].len > 1 &&
+ ah->data[ah->pos] != '/');
+ }
+ }
+
+ /* begin parsing HTTP version: */
+ if (issue_char(wsi, '\0') < 0)
+ return -1;
+ ah->parser_state = WSI_TOKEN_HTTP;
+ goto start_fragment;
+ }
+
+ r = lws_parse_urldecode(wsi, &c);
+ switch (r) {
+ case LPUR_CONTINUE:
+ break;
+ case LPUR_SWALLOW:
+ goto swallow;
+ case LPUR_FORBID:
+ goto forbid;
+ case LPUR_EXCESSIVE:
+ goto excessive;
+ default:
+ return -1;
+ }
+check_eol:
+ /* bail at EOL */
+ if (ah->parser_state != WSI_TOKEN_CHALLENGE &&
+ c == '\x0d') {
+ if (ah->ues != URIES_IDLE)
+ goto forbid;
+
+ c = '\0';
+ ah->parser_state = WSI_TOKEN_SKIPPING_SAW_CR;
+ lwsl_parser("*\n");
+ }
+
+ n = issue_char(wsi, c);
+ if ((int)n < 0)
+ return -1;
+ if (n > 0)
+ ah->parser_state = WSI_TOKEN_SKIPPING;
+
+swallow:
+ /* per-protocol end of headers management */
+
+ if (ah->parser_state == WSI_TOKEN_CHALLENGE)
+ goto set_parsing_complete;
+ break;
+
+ /* collecting and checking a name part */
+ case WSI_TOKEN_NAME_PART:
+ lwsl_parser("WSI_TOKEN_NAME_PART '%c' 0x%02X (role=0x%x) "
+ "wsi->lextable_pos=%d\n", c, c, lwsi_role(wsi),
+ ah->lextable_pos);
+
+ if (c >= 'A' && c <= 'Z')
+ c += 'a' - 'A';
+
+ pos = ah->lextable_pos;
+
+ while (1) {
+ if (lextable[pos] & (1 << 7)) { /* 1-byte, fail on mismatch */
+ if ((lextable[pos] & 0x7f) != c) {
+nope:
+ ah->lextable_pos = -1;
+ break;
+ }
+ /* fall thru */
+ pos++;
+ if (lextable[pos] == FAIL_CHAR)
+ goto nope;
+
+ ah->lextable_pos = pos;
+ break;
+ }
+
+ if (lextable[pos] == FAIL_CHAR)
+ goto nope;
+
+ /* b7 = 0, end or 3-byte */
+ if (lextable[pos] < FAIL_CHAR) { /* terminal marker */
+ ah->lextable_pos = pos;
+ break;
+ }
+
+ if (lextable[pos] == c) { /* goto */
+ ah->lextable_pos = pos + (lextable[pos + 1]) +
+ (lextable[pos + 2] << 8);
+ break;
+ }
+
+ /* fall thru goto */
+ pos += 3;
+ /* continue */
+ }
+
+ /*
+ * If it's h1, server needs to look out for unknown
+ * methods...
+ */
+ if (ah->lextable_pos < 0 && lwsi_role_h1(wsi) &&
+ lwsi_role_server(wsi)) {
+ /* this is not a header we know about */
+ for (m = 0; m < ARRAY_SIZE(methods); m++)
+ if (ah->frag_index[methods[m]]) {
+ /*
+ * already had the method, no idea what
+ * this crap from the client is, ignore
+ */
+ ah->parser_state = WSI_TOKEN_SKIPPING;
+ break;
+ }
+ /*
+ * hm it's an unknown http method from a client in fact,
+ * it cannot be valid http
+ */
+ if (m == ARRAY_SIZE(methods)) {
+ /*
+ * are we set up to accept raw in these cases?
+ */
+ if (lws_check_opt(wsi->vhost->options,
+ LWS_SERVER_OPTION_FALLBACK_TO_RAW))
+ return 2; /* transition to raw */
+
+ lwsl_info("Unknown method - dropping\n");
+ goto forbid;
+ }
+ break;
+ }
+ /*
+ * ...otherwise for a client, let him ignore unknown headers
+ * coming from the server
+ */
+ if (ah->lextable_pos < 0) {
+ ah->parser_state = WSI_TOKEN_SKIPPING;
+ break;
+ }
+
+ if (lextable[ah->lextable_pos] < FAIL_CHAR) {
+ /* terminal state */
+
+ n = ((unsigned int)lextable[ah->lextable_pos] << 8) |
+ lextable[ah->lextable_pos + 1];
+
+ lwsl_parser("known hdr %d\n", n);
+ for (m = 0; m < ARRAY_SIZE(methods); m++)
+ if (n == methods[m] &&
+ ah->frag_index[methods[m]]) {
+ lwsl_warn("Duplicated method\n");
+ return -1;
+ }
+
+ /*
+ * WSORIGIN is protocol equiv to ORIGIN,
+ * JWebSocket likes to send it, map to ORIGIN
+ */
+ if (n == WSI_TOKEN_SWORIGIN)
+ n = WSI_TOKEN_ORIGIN;
+
+ ah->parser_state = (enum lws_token_indexes)
+ (WSI_TOKEN_GET_URI + n);
+ ah->ups = URIPS_IDLE;
+
+ if (context->token_limits)
+ ah->current_token_limit = context->
+ token_limits->token_limit[
+ ah->parser_state];
+ else
+ ah->current_token_limit =
+ wsi->context->max_http_header_data;
+
+ if (ah->parser_state == WSI_TOKEN_CHALLENGE)
+ goto set_parsing_complete;
+
+ goto start_fragment;
+ }
+ break;
+
+start_fragment:
+ ah->nfrag++;
+excessive:
+ if (ah->nfrag == ARRAY_SIZE(ah->frags)) {
+ lwsl_warn("More hdr frags than we can deal with\n");
+ return -1;
+ }
+
+ ah->frags[ah->nfrag].offset = ah->pos;
+ ah->frags[ah->nfrag].len = 0;
+ ah->frags[ah->nfrag].nfrag = 0;
+ ah->frags[ah->nfrag].flags = 2;
+
+ n = ah->frag_index[ah->parser_state];
+ if (!n) { /* first fragment */
+ ah->frag_index[ah->parser_state] = ah->nfrag;
+ ah->hdr_token_idx = ah->parser_state;
+ break;
+ }
+ /* continuation */
+ while (ah->frags[n].nfrag)
+ n = ah->frags[n].nfrag;
+ ah->frags[n].nfrag = ah->nfrag;
+
+ if (issue_char(wsi, ' ') < 0)
+ return -1;
+ break;
+
+ /* skipping arg part of a name we didn't recognize */
+ case WSI_TOKEN_SKIPPING:
+ lwsl_parser("WSI_TOKEN_SKIPPING '%c'\n", c);
+
+ if (c == '\x0d')
+ ah->parser_state = WSI_TOKEN_SKIPPING_SAW_CR;
+ break;
+
+ case WSI_TOKEN_SKIPPING_SAW_CR:
+ lwsl_parser("WSI_TOKEN_SKIPPING_SAW_CR '%c'\n", c);
+ if (ah->ues != URIES_IDLE)
+ goto forbid;
+ if (c == '\x0a') {
+ ah->parser_state = WSI_TOKEN_NAME_PART;
+ ah->lextable_pos = 0;
+ } else
+ ah->parser_state = WSI_TOKEN_SKIPPING;
+ break;
+ /* we're done, ignore anything else */
+
+ case WSI_PARSING_COMPLETE:
+ lwsl_parser("WSI_PARSING_COMPLETE '%c'\n", c);
+ break;
+ }
+
+ } while (*len);
+
+ return 0;
+
+set_parsing_complete:
+ if (ah->ues != URIES_IDLE)
+ goto forbid;
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_VERSION))
+ wsi->rx_frame_type = /* temp for ws version index */
+ atoi(lws_hdr_simple_ptr(wsi, WSI_TOKEN_VERSION));
+
+ lwsl_parser("v%02d hdrs done\n", wsi->rx_frame_type);
+ }
+ ah->parser_state = WSI_PARSING_COMPLETE;
+ wsi->hdr_parsing_completed = 1;
+
+ return 0;
+
+forbid:
+ lwsl_notice(" forbidding on uri sanitation\n");
+ lws_return_http_status(wsi, HTTP_STATUS_FORBIDDEN, NULL);
+
+ return -1;
+}
+
diff --git a/thirdparty/lws/server/server.c b/thirdparty/libwebsockets/roles/http/server/server.c
index db05954257..350af3cd7e 100644
--- a/thirdparty/lws/server/server.c
+++ b/thirdparty/libwebsockets/roles/http/server/server.c
@@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,7 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
const char * const method_names[] = {
"GET", "POST", "OPTIONS", "PUT", "PATCH", "DELETE", "CONNECT", "HEAD",
@@ -28,42 +28,46 @@ const char * const method_names[] = {
#endif
};
-#if defined (LWS_WITH_ESP8266)
-#undef memcpy
-void *memcpy(void *dest, const void *src, size_t n)
-{
- return ets_memcpy(dest, src, n);
-}
-#endif
+/*
+ * return 0: all done
+ * 1: nonfatal error
+ * <0: fatal error
+ *
+ * REQUIRES CONTEXT LOCK HELD
+ */
int
-lws_context_init_server(struct lws_context_creation_info *info,
- struct lws_vhost *vhost)
+_lws_vhost_init_server(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost)
{
-#if LWS_POSIX
int n, opt = 1, limit = 1;
-#endif
lws_sockfd_type sockfd;
struct lws_vhost *vh;
struct lws *wsi;
- int m = 0;
+ int m = 0, is;
(void)method_names;
(void)opt;
+
+ if (info) {
+ vhost->iface = info->iface;
+ vhost->listen_port = info->port;
+ }
+
/* set up our external listening socket we serve on */
- if (info->port == CONTEXT_PORT_NO_LISTEN ||
- info->port == CONTEXT_PORT_NO_LISTEN_SERVER)
+ if (vhost->listen_port == CONTEXT_PORT_NO_LISTEN ||
+ vhost->listen_port == CONTEXT_PORT_NO_LISTEN_SERVER)
return 0;
vh = vhost->context->vhost_list;
while (vh) {
- if (vh->listen_port == info->port) {
- if ((!info->iface && !vh->iface) ||
- (info->iface && vh->iface &&
- !strcmp(info->iface, vh->iface))) {
- vhost->listen_port = info->port;
- vhost->iface = info->iface;
+ if (vh->listen_port == vhost->listen_port) {
+ if (((!vhost->iface && !vh->iface) ||
+ (vhost->iface && vh->iface &&
+ !strcmp(vhost->iface, vh->iface))) &&
+ vh->lserv_wsi
+ ) {
lwsl_notice(" using listen skt from vhost %s\n",
vh->name);
return 0;
@@ -72,7 +76,59 @@ lws_context_init_server(struct lws_context_creation_info *info,
vh = vh->vhost_next;
}
-#if LWS_POSIX
+ if (vhost->iface) {
+ /*
+ * let's check before we do anything else about the disposition
+ * of the interface he wants to bind to...
+ */
+ is = lws_socket_bind(vhost, LWS_SOCK_INVALID, vhost->listen_port, vhost->iface);
+ lwsl_debug("initial if check says %d\n", is);
+deal:
+
+ lws_start_foreach_llp(struct lws_vhost **, pv,
+ vhost->context->no_listener_vhost_list) {
+ if (is >= LWS_ITOSA_USABLE && *pv == vhost) {
+ /* on the list and shouldn't be: remove it */
+ lwsl_debug("deferred iface: removing vh %s\n", (*pv)->name);
+ *pv = vhost->no_listener_vhost_list;
+ vhost->no_listener_vhost_list = NULL;
+ goto done_list;
+ }
+ if (is < LWS_ITOSA_USABLE && *pv == vhost)
+ goto done_list;
+ } lws_end_foreach_llp(pv, no_listener_vhost_list);
+
+ /* not on the list... */
+
+ if (is < LWS_ITOSA_USABLE) {
+
+ /* ... but needs to be: so add it */
+
+ lwsl_debug("deferred iface: adding vh %s\n", vhost->name);
+ vhost->no_listener_vhost_list = vhost->context->no_listener_vhost_list;
+ vhost->context->no_listener_vhost_list = vhost;
+ }
+
+done_list:
+
+ switch (is) {
+ default:
+ break;
+ case LWS_ITOSA_NOT_EXIST:
+ /* can't add it */
+ if (info) /* first time */
+ lwsl_err("VH %s: iface %s port %d DOESN'T EXIST\n",
+ vhost->name, vhost->iface, vhost->listen_port);
+ return 1;
+ case LWS_ITOSA_NOT_USABLE:
+ /* can't add it */
+ if (info) /* first time */
+ lwsl_err("VH %s: iface %s port %d NOT USABLE\n",
+ vhost->name, vhost->iface, vhost->listen_port);
+ return 1;
+ }
+ }
+
(void)n;
#if defined(__linux__)
limit = vhost->context->count_threads;
@@ -80,159 +136,150 @@ lws_context_init_server(struct lws_context_creation_info *info,
for (m = 0; m < limit; m++) {
#ifdef LWS_WITH_UNIX_SOCK
- if (LWS_UNIX_SOCK_ENABLED(vhost))
- sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
- else
+ if (LWS_UNIX_SOCK_ENABLED(vhost))
+ sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ else
#endif
#ifdef LWS_WITH_IPV6
- if (LWS_IPV6_ENABLED(vhost))
- sockfd = socket(AF_INET6, SOCK_STREAM, 0);
- else
+ if (LWS_IPV6_ENABLED(vhost))
+ sockfd = socket(AF_INET6, SOCK_STREAM, 0);
+ else
#endif
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if (sockfd == -1) {
-#else
-#if defined(LWS_WITH_ESP8266)
- sockfd = esp8266_create_tcp_listen_socket(vhost);
- if (!lws_sockfd_valid(sockfd)) {
-#endif
+ if (sockfd == LWS_SOCK_INVALID) {
+ lwsl_err("ERROR opening socket\n");
+ return 1;
+ }
+#if !defined(LWS_WITH_ESP32)
+#if (defined(WIN32) || defined(_WIN32)) && defined(SO_EXCLUSIVEADDRUSE)
+ /*
+ * only accept that we are the only listener on the port
+ * https://msdn.microsoft.com/zh-tw/library/
+ * windows/desktop/ms740621(v=vs.85).aspx
+ *
+ * for lws, to match Linux, we default to exclusive listen
+ */
+ if (!lws_check_opt(vhost->options,
+ LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE)) {
+ if (setsockopt(sockfd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
+ (const void *)&opt, sizeof(opt)) < 0) {
+ lwsl_err("reuseaddr failed\n");
+ compatible_close(sockfd);
+ return -1;
+ }
+ } else
#endif
- lwsl_err("ERROR opening socket\n");
- return 1;
- }
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
-#if (defined(WIN32) || defined(_WIN32)) && defined(SO_EXCLUSIVEADDRUSE)
- /*
- * only accept that we are the only listener on the port
- * https://msdn.microsoft.com/zh-tw/library/
- * windows/desktop/ms740621(v=vs.85).aspx
- *
- * for lws, to match Linux, we default to exclusive listen
- */
- if (!lws_check_opt(vhost->options,
- LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE)) {
- if (setsockopt(sockfd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
+ /*
+ * allow us to restart even if old sockets in TIME_WAIT
+ */
+ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
(const void *)&opt, sizeof(opt)) < 0) {
lwsl_err("reuseaddr failed\n");
compatible_close(sockfd);
- return 1;
+ return -1;
}
- } else
-#endif
-
- /*
- * allow us to restart even if old sockets in TIME_WAIT
- */
- if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
- (const void *)&opt, sizeof(opt)) < 0) {
- lwsl_err("reuseaddr failed\n");
- compatible_close(sockfd);
- return 1;
- }
#if defined(LWS_WITH_IPV6) && defined(IPV6_V6ONLY)
- if (LWS_IPV6_ENABLED(vhost)) {
- if (vhost->options & LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY) {
+ if (LWS_IPV6_ENABLED(vhost) &&
+ vhost->options & LWS_SERVER_OPTION_IPV6_V6ONLY_MODIFY) {
int value = (vhost->options &
LWS_SERVER_OPTION_IPV6_V6ONLY_VALUE) ? 1 : 0;
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY,
(const void*)&value, sizeof(value)) < 0) {
compatible_close(sockfd);
- return 1;
+ return -1;
}
}
- }
#endif
#if defined(__linux__) && defined(SO_REUSEPORT)
- n = lws_check_opt(vhost->options, LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE);
+ /* keep coverity happy */
#if LWS_MAX_SMP > 1
- n = 1;
+ n = 1;
+#else
+ n = lws_check_opt(vhost->options,
+ LWS_SERVER_OPTION_ALLOW_LISTEN_SHARE);
#endif
-
- if (n)
- if (vhost->context->count_threads > 1)
+ if (n && vhost->context->count_threads > 1)
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT,
(const void *)&opt, sizeof(opt)) < 0) {
compatible_close(sockfd);
- return 1;
+ return -1;
}
#endif
#endif
- lws_plat_set_socket_options(vhost, sockfd);
+ lws_plat_set_socket_options(vhost, sockfd);
-#if LWS_POSIX
- n = lws_socket_bind(vhost, sockfd, info->port, info->iface);
- if (n < 0)
- goto bail;
- info->port = n;
-#endif
- vhost->listen_port = info->port;
- vhost->iface = info->iface;
+ is = lws_socket_bind(vhost, sockfd, vhost->listen_port, vhost->iface);
+ /*
+ * There is a race where the network device may come up and then
+ * go away and fail here. So correctly handle unexpected failure
+ * here despite we earlier confirmed it.
+ */
+ if (is < 0) {
+ lwsl_info("%s: lws_socket_bind says %d\n", __func__, is);
+ compatible_close(sockfd);
+ goto deal;
+ }
+ vhost->listen_port = is;
- wsi = lws_zalloc(sizeof(struct lws), "listen wsi");
- if (wsi == NULL) {
- lwsl_err("Out of mem\n");
- goto bail;
- }
- wsi->context = vhost->context;
- wsi->desc.sockfd = sockfd;
- wsi->mode = LWSCM_SERVER_LISTENER;
- wsi->protocol = vhost->protocols;
- wsi->tsi = m;
- wsi->vhost = vhost;
- wsi->listener = 1;
-
-#ifdef LWS_WITH_LIBUV
- if (LWS_LIBUV_ENABLED(vhost->context))
- lws_uv_initvhost(vhost, wsi);
-#endif
+ lwsl_debug("%s: lws_socket_bind says %d\n", __func__, is);
- if (insert_wsi_socket_into_fds(vhost->context, wsi))
- goto bail;
+ wsi = lws_zalloc(sizeof(struct lws), "listen wsi");
+ if (wsi == NULL) {
+ lwsl_err("Out of mem\n");
+ goto bail;
+ }
+ wsi->context = vhost->context;
+ wsi->desc.sockfd = sockfd;
+ lws_role_transition(wsi, 0, LRS_UNCONNECTED, &role_ops_listen);
+ wsi->protocol = vhost->protocols;
+ wsi->tsi = m;
+ wsi->vhost = vhost;
+ wsi->listener = 1;
- vhost->context->count_wsi_allocated++;
- vhost->lserv_wsi = wsi;
+ if (wsi->context->event_loop_ops->init_vhost_listen_wsi)
+ wsi->context->event_loop_ops->init_vhost_listen_wsi(wsi);
-#if LWS_POSIX
- n = listen(wsi->desc.sockfd, LWS_SOMAXCONN);
- if (n < 0) {
- lwsl_err("listen failed with error %d\n", LWS_ERRNO);
- vhost->lserv_wsi = NULL;
- vhost->context->count_wsi_allocated--;
- remove_wsi_socket_from_fds(wsi);
- goto bail;
- }
+ if (__insert_wsi_socket_into_fds(vhost->context, wsi)) {
+ lwsl_notice("inserting wsi socket into fds failed\n");
+ goto bail;
+ }
+
+ vhost->context->count_wsi_allocated++;
+ vhost->lserv_wsi = wsi;
+
+ n = listen(wsi->desc.sockfd, LWS_SOMAXCONN);
+ if (n < 0) {
+ lwsl_err("listen failed with error %d\n", LWS_ERRNO);
+ vhost->lserv_wsi = NULL;
+ vhost->context->count_wsi_allocated--;
+ __remove_wsi_socket_from_fds(wsi);
+ goto bail;
+ }
} /* for each thread able to independently listen */
-#else
-#if defined(LWS_WITH_ESP8266)
- esp8266_tcp_stream_bind(wsi->desc.sockfd, info->port, wsi);
-#endif
-#endif
- if (!lws_check_opt(info->options, LWS_SERVER_OPTION_EXPLICIT_VHOSTS)) {
+
+ if (!lws_check_opt(vhost->context->options, LWS_SERVER_OPTION_EXPLICIT_VHOSTS)) {
#ifdef LWS_WITH_UNIX_SOCK
if (LWS_UNIX_SOCK_ENABLED(vhost))
- lwsl_info(" Listening on \"%s\"\n", info->iface);
+ lwsl_info(" Listening on \"%s\"\n", vhost->iface);
else
#endif
- lwsl_info(" Listening on port %d\n", info->port);
+ lwsl_info(" Listening on port %d\n", vhost->listen_port);
}
+ // info->port = vhost->listen_port;
+
return 0;
bail:
compatible_close(sockfd);
- return 1;
+ return -1;
}
-#if defined(LWS_WITH_ESP8266)
-#undef strchr
-#define strchr ets_strchr
-#endif
-
struct lws_vhost *
lws_select_vhost(struct lws_context *context, int port, const char *servername)
{
@@ -240,11 +287,11 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
const char *p;
int n, m, colon;
- n = strlen(servername);
+ n = (int)strlen(servername);
colon = n;
p = strchr(servername, ':');
if (p)
- colon = p - servername;
+ colon = lws_ptr_diff(p, servername);
/* Priotity 1: first try exact matches */
@@ -266,7 +313,7 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
*/
vhost = context->vhost_list;
while (vhost) {
- m = strlen(vhost->name);
+ m = (int)strlen(vhost->name);
if (port == vhost->listen_port &&
m <= (colon - 2) &&
servername[colon - m - 1] == '.' &&
@@ -283,8 +330,8 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
vhost = context->vhost_list;
while (vhost) {
if (port == vhost->listen_port) {
- lwsl_info("vhost match to %s based on port %d\n",
- vhost->name, port);
+ lwsl_info("%s: vhost match to %s based on port %d\n",
+ __func__, vhost->name, port);
return vhost;
}
vhost = vhost->vhost_next;
@@ -298,7 +345,7 @@ lws_select_vhost(struct lws_context *context, int port, const char *servername)
LWS_VISIBLE LWS_EXTERN const char *
lws_get_mimetype(const char *file, const struct lws_http_mount *m)
{
- int n = strlen(file);
+ int n = (int)strlen(file);
const struct lws_protocol_vhost_options *pvo = NULL;
if (m)
@@ -388,7 +435,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
const struct lws_protocol_vhost_options *pvo = m->interpret;
struct lws_process_html_args args;
const char *mimetype;
-#if !defined(_WIN32_WCE) && !defined(LWS_WITH_ESP8266)
+#if !defined(_WIN32_WCE)
const struct lws_plat_file_ops *fops;
const char *vpath;
lws_fop_flags_t fflags = LWS_O_RDONLY;
@@ -402,14 +449,24 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
char path[256], sym[512];
unsigned char *p = (unsigned char *)sym + 32 + LWS_PRE, *start = p;
unsigned char *end = p + sizeof(sym) - 32 - LWS_PRE;
-#if !defined(WIN32) && LWS_POSIX && !defined(LWS_WITH_ESP32)
+#if !defined(WIN32) && !defined(LWS_WITH_ESP32)
size_t len;
#endif
int n;
+ wsi->handling_404 = 0;
+ if (!wsi->vhost)
+ return -1;
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ if (wsi->vhost->http.error_document_404 &&
+ !strcmp(uri, wsi->vhost->http.error_document_404))
+ wsi->handling_404 = 1;
+#endif
+
lws_snprintf(path, sizeof(path) - 1, "%s/%s", origin, uri);
-#if !defined(_WIN32_WCE) && !defined(LWS_WITH_ESP8266)
+#if !defined(_WIN32_WCE)
fflags |= lws_vfs_prepare_flags(wsi);
@@ -417,13 +474,14 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
spin++;
fops = lws_vfs_select_fops(wsi->context->fops, path, &vpath);
- if (wsi->u.http.fop_fd)
- lws_vfs_file_close(&wsi->u.http.fop_fd);
+ if (wsi->http.fop_fd)
+ lws_vfs_file_close(&wsi->http.fop_fd);
- wsi->u.http.fop_fd = fops->LWS_FOP_OPEN(wsi->context->fops,
+ wsi->http.fop_fd = fops->LWS_FOP_OPEN(wsi->context->fops,
path, vpath, &fflags);
- if (!wsi->u.http.fop_fd) {
- lwsl_err("Unable to open '%s'\n", path);
+ if (!wsi->http.fop_fd) {
+ lwsl_info("%s: Unable to open '%s': errno %d\n",
+ __func__, path, errno);
return -1;
}
@@ -435,7 +493,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
break;
#endif
#if !defined(WIN32)
- if (fstat(wsi->u.http.fop_fd->fd, &st)) {
+ if (fstat(wsi->http.fop_fd->fd, &st)) {
lwsl_info("unable to stat %s\n", path);
goto bail;
}
@@ -453,10 +511,10 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
#endif
#endif
- wsi->u.http.fop_fd->mod_time = (uint32_t)st.st_mtime;
+ wsi->http.fop_fd->mod_time = (uint32_t)st.st_mtime;
fflags |= LWS_FOP_FLAG_MOD_TIME_VALID;
-#if !defined(WIN32) && LWS_POSIX && !defined(LWS_WITH_ESP32)
+#if !defined(WIN32) && !defined(LWS_WITH_ESP32)
if ((S_IFMT & st.st_mode) == S_IFLNK) {
len = readlink(path, sym, sizeof(sym) - 1);
if (len) {
@@ -480,15 +538,15 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
lwsl_err("symlink loop %s \n", path);
n = sprintf(sym, "%08llX%08lX",
- (unsigned long long)lws_vfs_get_length(wsi->u.http.fop_fd),
- (unsigned long)lws_vfs_get_mod_time(wsi->u.http.fop_fd));
+ (unsigned long long)lws_vfs_get_length(wsi->http.fop_fd),
+ (unsigned long)lws_vfs_get_mod_time(wsi->http.fop_fd));
/* disable ranges if IF_RANGE token invalid */
if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_IF_RANGE))
if (strcmp(sym, lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_IF_RANGE)))
/* differs - defeat Range: */
- wsi->u.http.ah->frag_index[WSI_TOKEN_HTTP_RANGE] = 0;
+ wsi->http.ah->frag_index[WSI_TOKEN_HTTP_RANGE] = 0;
if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_IF_NONE_MATCH)) {
/*
@@ -523,7 +581,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
return -1;
}
- lws_vfs_file_close(&wsi->u.http.fop_fd);
+ lws_vfs_file_close(&wsi->http.fop_fd);
return lws_http_transaction_completed(wsi);
}
@@ -549,10 +607,12 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
* a protocol
*/
while (pvo) {
- n = strlen(path);
+ n = (int)strlen(path);
if (n > (int)strlen(pvo->name) &&
!strcmp(&path[n - strlen(pvo->name)], pvo->name)) {
- wsi->sending_chunked = 1;
+ wsi->interpreting = 1;
+ if (!wsi->http2_substream)
+ wsi->sending_chunked = 1;
wsi->protocol_interpret_idx =
(char)(lws_intptr_t)pvo->value;
lwsl_info("want %s interpreted by %s\n", path,
@@ -574,14 +634,15 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,
if (lws_bind_protocol(wsi, pp))
return 1;
args.p = (char *)p;
- args.max_len = end - p;
+ args.max_len = lws_ptr_diff(end, p);
if (pp->callback(wsi, LWS_CALLBACK_ADD_HEADERS,
wsi->user_space, &args, 0))
return -1;
p = (unsigned char *)args.p;
}
- n = lws_serve_http_file(wsi, path, mimetype, (char *)start, p - start);
+ n = lws_serve_http_file(wsi, path, mimetype, (char *)start,
+ lws_ptr_diff(p, start));
if (n < 0 || ((n > 0) && lws_http_transaction_completed(wsi)))
return -1; /* error or can't reuse connection: close the socket */
@@ -592,13 +653,14 @@ bail:
return -1;
}
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
const struct lws_http_mount *
lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len)
{
const struct lws_http_mount *hm, *hit = NULL;
int best = 0;
- hm = wsi->vhost->mount_list;
+ hm = wsi->vhost->http.mount_list;
while (hm) {
if (uri_len >= hm->mountpoint_len &&
!strncmp(uri_ptr, hm->mountpoint, hm->mountpoint_len) &&
@@ -623,9 +685,9 @@ lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len)
return hit;
}
+#endif
-#if LWS_POSIX
-
+#if !defined(LWS_WITH_ESP32)
static int
lws_find_string_in_file(const char *filename, const char *string, int stringlen)
{
@@ -635,7 +697,7 @@ lws_find_string_in_file(const char *filename, const char *string, int stringlen)
fd = open(filename, O_RDONLY);
if (fd < 0) {
lwsl_err("can't open auth file: %s\n", filename);
- return 1;
+ return 0;
}
while (1) {
@@ -669,6 +731,7 @@ lws_find_string_in_file(const char *filename, const char *string, int stringlen)
return hit;
}
+#endif
static int
lws_unauthorised_basic_auth(struct lws *wsi)
@@ -702,8 +765,6 @@ lws_unauthorised_basic_auth(struct lws *wsi)
}
-#endif
-
int lws_clean_url(char *p)
{
if (p[0] == 'h' && p[1] == 't' && p[2] == 't' && p[3] == 'p') {
@@ -732,7 +793,6 @@ int lws_clean_url(char *p)
return 0;
}
-
static const unsigned char methods[] = {
WSI_TOKEN_GET_URI,
WSI_TOKEN_POST_URI,
@@ -752,7 +812,7 @@ lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len)
{
int n, count = 0;
- for (n = 0; n < ARRAY_SIZE(methods); n++)
+ for (n = 0; n < (int)ARRAY_SIZE(methods); n++)
if (lws_hdr_total_length(wsi, methods[n]))
count++;
if (!count) {
@@ -767,7 +827,7 @@ lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len)
return -1;
}
- for (n = 0; n < ARRAY_SIZE(methods); n++)
+ for (n = 0; n < (int)ARRAY_SIZE(methods); n++)
if (lws_hdr_total_length(wsi, methods[n])) {
*puri_ptr = lws_hdr_simple_ptr(wsi, methods[n]);
*puri_len = lws_hdr_total_length(wsi, methods[n]);
@@ -797,7 +857,7 @@ lws_http_action(struct lws *wsi)
};
meth = lws_http_get_uri_and_method(wsi, &uri_ptr, &uri_len);
- if (meth < 0 || meth >= ARRAY_SIZE(method_names))
+ if (meth < 0 || meth >= (int)ARRAY_SIZE(method_names))
goto bail_nuke_ah;
/* we insist on absolute paths */
@@ -811,26 +871,36 @@ lws_http_action(struct lws *wsi)
lwsl_info("Method: '%s' (%d), request for '%s'\n", method_names[meth],
meth, uri_ptr);
+ if (wsi->role_ops && wsi->role_ops->check_upgrades)
+ switch (wsi->role_ops->check_upgrades(wsi)) {
+ case LWS_UPG_RET_DONE:
+ return 0;
+ case LWS_UPG_RET_CONTINUE:
+ break;
+ case LWS_UPG_RET_BAIL:
+ goto bail_nuke_ah;
+ }
+
if (lws_ensure_user_space(wsi))
goto bail_nuke_ah;
/* HTTP header had a content length? */
- wsi->u.http.rx_content_length = 0;
+ wsi->http.rx_content_length = 0;
if (lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI) ||
lws_hdr_total_length(wsi, WSI_TOKEN_PATCH_URI) ||
lws_hdr_total_length(wsi, WSI_TOKEN_PUT_URI))
- wsi->u.http.rx_content_length = 100 * 1024 * 1024;
+ wsi->http.rx_content_length = 100 * 1024 * 1024;
if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {
lws_hdr_copy(wsi, content_length_str,
sizeof(content_length_str) - 1,
WSI_TOKEN_HTTP_CONTENT_LENGTH);
- wsi->u.http.rx_content_length = atoll(content_length_str);
+ wsi->http.rx_content_length = atoll(content_length_str);
}
if (wsi->http2_substream) {
- wsi->u.http.request_version = HTTP_VERSION_2;
+ wsi->http.request_version = HTTP_VERSION_2;
} else {
/* http_version? Default to 1.0, override with token: */
request_version = HTTP_VERSION_1_0;
@@ -845,7 +915,7 @@ lws_http_action(struct lws *wsi)
http_version_str[7] == '1')
request_version = HTTP_VERSION_1_1;
}
- wsi->u.http.request_version = request_version;
+ wsi->http.request_version = request_version;
/* HTTP/1.1 defaults to "keep-alive", 1.0 to "close" */
if (request_version == HTTP_VERSION_1_1)
@@ -865,7 +935,7 @@ lws_http_action(struct lws *wsi)
if (!strcasecmp(http_conn_str, "close"))
connection_type = HTTP_CONNECTION_CLOSE;
}
- wsi->u.http.connection_type = connection_type;
+ wsi->http.connection_type = connection_type;
}
n = wsi->protocol->callback(wsi, LWS_CALLBACK_FILTER_HTTP_CONNECTION,
@@ -881,8 +951,8 @@ lws_http_action(struct lws *wsi)
*/
lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT,
wsi->context->timeout_secs);
-#ifdef LWS_OPENSSL_SUPPORT
- if (wsi->redirect_to_https) {
+#ifdef LWS_WITH_TLS
+ if (wsi->tls.redirect_to_https) {
/*
* we accepted http:// only so we could redirect to
* https://, so issue the redirect. Create the redirection
@@ -921,6 +991,8 @@ lws_http_action(struct lws *wsi)
if (lws_bind_protocol(wsi, &wsi->vhost->protocols[0]))
return 1;
+ lwsi_set_state(wsi, LRS_DOING_TRANSACTION);
+
n = wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP,
wsi->user_space, uri_ptr, uri_len);
@@ -989,7 +1061,6 @@ lws_http_action(struct lws *wsi)
return lws_http_transaction_completed(wsi);
}
-#if LWS_POSIX
/* basic auth? */
if (hit->basic_auth_login_file) {
@@ -1029,11 +1100,10 @@ lws_http_action(struct lws *wsi)
return lws_unauthorised_basic_auth(wsi);
}
- lwsl_notice("basic auth accepted\n");
+ lwsl_info("basic auth accepted\n");
/* accept the auth */
}
-#endif
#if defined(LWS_WITH_HTTP_PROXY)
/*
@@ -1064,7 +1134,7 @@ lws_http_action(struct lws *wsi)
else
n = pslash - hit->origin;
- if (n >= sizeof(ads) - 2)
+ if (n >= (int)sizeof(ads) - 2)
n = sizeof(ads) - 2;
memcpy(ads, hit->origin, n);
@@ -1104,9 +1174,10 @@ lws_http_action(struct lws *wsi)
i.uri_replace_from = hit->origin;
i.uri_replace_to = hit->mountpoint;
- lwsl_notice("proxying to %s port %d url %s, ssl %d, from %s, to %s\n",
- i.address, i.port, i.path, i.ssl_connection,
- i.uri_replace_from, i.uri_replace_to);
+ lwsl_notice("proxying to %s port %d url %s, ssl %d, "
+ "from %s, to %s\n",
+ i.address, i.port, i.path, i.ssl_connection,
+ i.uri_replace_from, i.uri_replace_to);
if (!lws_client_connect_via_info(&i)) {
lwsl_err("proxy connect fail\n");
@@ -1144,8 +1215,10 @@ lws_http_action(struct lws *wsi)
args.len = uri_len;
args.max_len = hit->auth_mask;
args.final = 0; /* used to signal callback dealt with it */
+ args.chunked = 0;
- n = wsi->protocol->callback(wsi, LWS_CALLBACK_CHECK_ACCESS_RIGHTS,
+ n = wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CHECK_ACCESS_RIGHTS,
wsi->user_space, &args, 0);
if (n) {
lws_return_http_status(wsi, HTTP_STATUS_UNAUTHORIZED,
@@ -1195,7 +1268,7 @@ lws_http_action(struct lws *wsi)
}
#endif
- n = strlen(s);
+ n = (int)strlen(s);
if (s[0] == '\0' || (n == 1 && s[n - 1] == '/'))
s = (char *)hit->def;
if (!s)
@@ -1206,14 +1279,17 @@ lws_http_action(struct lws *wsi)
wsi->cache_revalidate = hit->cache_revalidate;
wsi->cache_intermediaries = hit->cache_intermediaries;
- n = lws_http_serve(wsi, s, hit->origin, hit);
+ n = 1;
+ if (hit->origin_protocol == LWSMPRO_FILE)
+ n = lws_http_serve(wsi, s, hit->origin, hit);
if (n) {
/*
- * lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
+ * lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
*/
if (hit->protocol) {
- const struct lws_protocols *pp = lws_vhost_name_to_protocol(
- wsi->vhost, hit->protocol);
+ const struct lws_protocols *pp =
+ lws_vhost_name_to_protocol(
+ wsi->vhost, hit->protocol);
if (lws_bind_protocol(wsi, pp))
return 1;
@@ -1245,125 +1321,90 @@ deal_body:
* In any case, return 0 and let lws_read decide how to
* proceed based on state
*/
- if (wsi->state != LWSS_HTTP_ISSUING_FILE) {
+ if (lwsi_state(wsi) != LRS_ISSUING_FILE) {
/* Prepare to read body if we have a content length: */
- lwsl_debug("wsi->u.http.rx_content_length %lld %d %d\n",
- (long long)wsi->u.http.rx_content_length,
+ lwsl_debug("wsi->http.rx_content_length %lld %d %d\n",
+ (long long)wsi->http.rx_content_length,
wsi->upgraded_to_http2, wsi->http2_substream);
- if (wsi->u.http.rx_content_length > 0) {
- lwsl_notice("%s: %p: LWSS_HTTP_BODY state set\n",
- __func__, wsi);
- wsi->state = LWSS_HTTP_BODY;
- wsi->u.http.rx_content_remain =
- wsi->u.http.rx_content_length;
+ if (wsi->http.rx_content_length > 0) {
+ struct lws_tokens ebuf;
+ int m;
+
+ lwsi_set_state(wsi, LRS_BODY);
+ lwsl_info("%s: %p: LRS_BODY state set (0x%x)\n",
+ __func__, wsi, wsi->wsistate);
+ wsi->http.rx_content_remain =
+ wsi->http.rx_content_length;
+
+ /*
+ * At this point we have transitioned from deferred
+ * action to expecting BODY on the stream wsi, if it's
+ * in a bundle like h2. So if the stream wsi has its
+ * own buflist, we need to deal with that first.
+ */
+
+ while (1) {
+ ebuf.len = (int)lws_buflist_next_segment_len(
+ &wsi->buflist, (uint8_t **)&ebuf.token);
+ if (!ebuf.len)
+ break;
+ lwsl_notice("%s: consuming %d\n", __func__, (int)ebuf.len);
+ m = lws_read_h1(wsi, (uint8_t *)ebuf.token, ebuf.len);
+ if (m < 0)
+ return -1;
+
+ if (lws_buflist_aware_consume(wsi, &ebuf, m, 1))
+ return -1;
+ }
}
}
return 0;
bail_nuke_ah:
- /* we're closing, losing some rx is OK */
- lws_header_table_force_to_detachable_state(wsi);
lws_header_table_detach(wsi, 1);
return 1;
-#if LWS_POSIX
transaction_result_n:
lws_return_http_status(wsi, n, NULL);
return lws_http_transaction_completed(wsi);
-#endif
-}
-
-static int
-lws_server_init_wsi_for_ws(struct lws *wsi)
-{
- int n;
-
- wsi->state = LWSS_ESTABLISHED;
- lws_restart_ws_ping_pong_timer(wsi);
-
- /*
- * create the frame buffer for this connection according to the
- * size mentioned in the protocol definition. If 0 there, use
- * a big default for compatibility
- */
-
- n = wsi->protocol->rx_buffer_size;
- if (!n)
- n = wsi->context->pt_serv_buf_size;
- n += LWS_PRE;
- wsi->u.ws.rx_ubuf = lws_malloc(n + 4 /* 0x0000ffff zlib */, "rx_ubuf");
- if (!wsi->u.ws.rx_ubuf) {
- lwsl_err("Out of Mem allocating rx buffer %d\n", n);
- return 1;
- }
- wsi->u.ws.rx_ubuf_alloc = n;
- lwsl_debug("Allocating RX buffer %d\n", n);
-
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
- if (!wsi->parent_carries_io)
- if (setsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_SNDBUF,
- (const char *)&n, sizeof n)) {
- lwsl_warn("Failed to set SNDBUF to %d", n);
- return 1;
- }
-#endif
-
- /* notify user code that we're ready to roll */
-
- if (wsi->protocol->callback)
- if (wsi->protocol->callback(wsi, LWS_CALLBACK_ESTABLISHED,
- wsi->user_space,
-#ifdef LWS_OPENSSL_SUPPORT
- wsi->ssl,
-#else
- NULL,
-#endif
- 0))
- return 1;
-
- return 0;
}
int
lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)
{
- int protocol_len, n = 0, hit, non_space_char_found = 0, m;
struct lws_context *context = lws_get_context(wsi);
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- struct _lws_header_related hdr;
- struct allocated_headers *ah;
unsigned char *obuf = *buf;
- char protocol_list[128];
- char protocol_name[64];
+#if defined(LWS_WITH_HTTP2)
+ char tbuf[128], *p;
+#endif
size_t olen = len;
- char *p;
+ int n = 0, m, i;
if (len >= 10000000) {
lwsl_err("%s: assert: len %ld\n", __func__, (long)len);
assert(0);
}
- if (!wsi->u.hdr.ah) {
+ if (!wsi->http.ah) {
lwsl_err("%s: assert: NULL ah\n", __func__);
assert(0);
}
- lwsl_hexdump(*buf, len);
-
- while (len--) {
- wsi->more_rx_waiting = !!len;
-
- if (wsi->mode != LWSCM_HTTP_SERVING &&
- wsi->mode != LWSCM_HTTP2_SERVING &&
- wsi->mode != LWSCM_HTTP_SERVING_ACCEPTED) {
- lwsl_err("%s: bad wsi mode %d\n", __func__, wsi->mode);
+ while (len) {
+ if (!lwsi_role_server(wsi) || !lwsi_role_http(wsi)) {
+ lwsl_err("%s: bad wsi role 0x%x\n", __func__,
+ lwsi_role(wsi));
goto bail_nuke_ah;
}
- m = lws_parse(wsi, *(*buf)++);
+ i = (int)len;
+ m = lws_parse(wsi, *buf, &i);
+ lwsl_info("%s: parsed count %d\n", __func__, (int)len - i);
+ (*buf) += (int)len - i;
+ len = i;
if (m) {
if (m == 2) {
/*
@@ -1384,8 +1425,8 @@ raw_transition:
wsi->user_space, NULL, 0))
goto bail_nuke_ah;
- lws_header_table_force_to_detachable_state(wsi);
- lws_union_transition(wsi, LWSCM_RAW);
+ lws_role_transition(wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_skt);
lws_header_table_detach(wsi, 1);
if (m == 2 && (wsi->protocol->callback)(wsi,
@@ -1399,12 +1440,10 @@ raw_transition:
goto bail_nuke_ah;
}
- if (wsi->u.hdr.parser_state != WSI_PARSING_COMPLETE)
+ if (wsi->http.ah->parser_state != WSI_PARSING_COMPLETE)
continue;
lwsl_parser("%s: lws_parse sees parsing complete\n", __func__);
- lwsl_debug("%s: wsi->more_rx_waiting=%d\n", __func__,
- wsi->more_rx_waiting);
/* select vhost */
@@ -1418,7 +1457,7 @@ raw_transition:
} else
lwsl_info("no host\n");
- if (wsi->mode != LWSCM_HTTP2_SERVING) {
+ if (!lwsi_role_h2(wsi) || !lwsi_role_server(wsi)) {
wsi->vhost->conn_stats.h1_trans++;
if (!wsi->conn_stat_done) {
wsi->vhost->conn_stats.h1_conn++;
@@ -1435,38 +1474,39 @@ raw_transition:
if (lws_hdr_copy(wsi, ua, sizeof(ua) - 1,
WSI_TOKEN_HTTP_USER_AGENT) > 0) {
- ua[sizeof(ua) - 1] = '\0';
- while (rej) {
- if (strstr(ua, rej->name)) {
#ifdef LWS_WITH_ACCESS_LOG
- char *uri_ptr = NULL;
- int meth, uri_len;
+ char *uri_ptr = NULL;
+ int meth, uri_len;
#endif
+ ua[sizeof(ua) - 1] = '\0';
+ while (rej) {
+ if (!strstr(ua, rej->name)) {
+ rej = rej->next;
+ continue;
+ }
- msg = strchr(rej->value, ' ');
- if (msg)
- msg++;
- lws_return_http_status(wsi,
- atoi(rej->value), msg);
+ msg = strchr(rej->value, ' ');
+ if (msg)
+ msg++;
+ lws_return_http_status(wsi,
+ atoi(rej->value), msg);
#ifdef LWS_WITH_ACCESS_LOG
- meth = lws_http_get_uri_and_method(wsi,
- &uri_ptr, &uri_len);
- if (meth >= 0)
- lws_prepare_access_log_info(wsi,
+ meth = lws_http_get_uri_and_method(wsi,
+ &uri_ptr, &uri_len);
+ if (meth >= 0)
+ lws_prepare_access_log_info(wsi,
uri_ptr, meth);
- /* wsi close will do the log */
+ /* wsi close will do the log */
#endif
- wsi->vhost->conn_stats.rejected++;
- /*
- * We don't want anything from
- * this rejected guy. Follow
- * the close flow, not the
- * transaction complete flow.
- */
- goto bail_nuke_ah;
- }
- rej = rej->next;
+ wsi->vhost->conn_stats.rejected++;
+ /*
+ * We don't want anything from
+ * this rejected guy. Follow
+ * the close flow, not the
+ * transaction complete flow.
+ */
+ goto bail_nuke_ah;
}
}
}
@@ -1478,20 +1518,24 @@ raw_transition:
goto raw_transition;
}
- wsi->mode = LWSCM_PRE_WS_SERVING_ACCEPT;
+ lwsi_set_state(wsi, LRS_PRE_WS_SERVING_ACCEPT);
lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
/* is this websocket protocol or normal http 1.0? */
if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
- if (!strcasecmp(lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE),
+ if (!strcasecmp(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_UPGRADE),
"websocket")) {
+#if defined(LWS_ROLE_WS)
wsi->vhost->conn_stats.ws_upg++;
lwsl_info("Upgrade to ws\n");
goto upgrade_ws;
+#endif
}
-#ifdef LWS_WITH_HTTP2
- if (!strcasecmp(lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE),
+#if defined(LWS_WITH_HTTP2)
+ if (!strcasecmp(lws_hdr_simple_ptr(wsi,
+ WSI_TOKEN_UPGRADE),
"h2c")) {
wsi->vhost->conn_stats.h2_upg++;
lwsl_info("Upgrade to h2c\n");
@@ -1505,23 +1549,19 @@ raw_transition:
/* no upgrade ack... he remained as HTTP */
- lwsl_info("No upgrade\n");
- ah = wsi->u.hdr.ah;
+ lwsl_info("%s: %p: No upgrade\n", __func__, wsi);
- lws_union_transition(wsi, LWSCM_HTTP_SERVING_ACCEPTED);
- wsi->state = LWSS_HTTP;
- wsi->u.http.fop_fd = NULL;
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ wsi->http.fop_fd = NULL;
- /* expose it at the same offset as u.hdr */
- wsi->u.http.ah = ah;
lwsl_debug("%s: wsi %p: ah %p\n", __func__, (void *)wsi,
- (void *)wsi->u.hdr.ah);
+ (void *)wsi->http.ah);
n = lws_http_action(wsi);
return n;
-#ifdef LWS_WITH_HTTP2
+#if defined(LWS_WITH_HTTP2)
upgrade_h2c:
if (!lws_hdr_total_length(wsi, WSI_TOKEN_HTTP2_SETTINGS)) {
lwsl_info("missing http2_settings\n");
@@ -1532,8 +1572,7 @@ upgrade_h2c:
p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP2_SETTINGS);
/* convert the peer's HTTP-Settings */
- n = lws_b64_decode_string(p, protocol_list,
- sizeof(protocol_list));
+ n = lws_b64_decode_string(p, tbuf, sizeof(tbuf));
if (n < 0) {
lwsl_parser("HTTP2_SETTINGS too long\n");
return 1;
@@ -1541,16 +1580,10 @@ upgrade_h2c:
/* adopt the header info */
- ah = wsi->u.hdr.ah;
-
- lws_union_transition(wsi, LWSCM_HTTP2_SERVING);
-
- /* http2 union member has http union struct at start */
- wsi->u.http.ah = ah;
-
- if (!wsi->u.h2.h2n) {
- wsi->u.h2.h2n = lws_zalloc(sizeof(*wsi->u.h2.h2n), "h2n");
- if (!wsi->u.h2.h2n)
+ if (!wsi->h2.h2n) {
+ wsi->h2.h2n = lws_zalloc(sizeof(*wsi->h2.h2n),
+ "h2n");
+ if (!wsi->h2.h2n)
return 1;
}
@@ -1558,195 +1591,39 @@ upgrade_h2c:
/* HTTP2 union */
- lws_h2_settings(wsi, &wsi->u.h2.h2n->set,
- (unsigned char *)protocol_list, n);
+ lws_h2_settings(wsi, &wsi->h2.h2n->set, (unsigned char *)tbuf, n);
- lws_hpack_dynamic_size(wsi, wsi->u.h2.h2n->set.s[
+ lws_hpack_dynamic_size(wsi, wsi->h2.h2n->set.s[
H2SET_HEADER_TABLE_SIZE]);
- strcpy(protocol_list, "HTTP/1.1 101 Switching Protocols\x0d\x0a"
- "Connection: Upgrade\x0d\x0a"
- "Upgrade: h2c\x0d\x0a\x0d\x0a");
- n = lws_issue_raw(wsi, (unsigned char *)protocol_list,
- strlen(protocol_list));
- if (n != strlen(protocol_list)) {
+ strcpy(tbuf, "HTTP/1.1 101 Switching Protocols\x0d\x0a"
+ "Connection: Upgrade\x0d\x0a"
+ "Upgrade: h2c\x0d\x0a\x0d\x0a");
+ m = (int)strlen(tbuf);
+ n = lws_issue_raw(wsi, (unsigned char *)tbuf, m);
+ if (n != m) {
lwsl_debug("http2 switch: ERROR writing to socket\n");
return 1;
}
- wsi->state = LWSS_HTTP2_AWAIT_CLIENT_PREFACE;
+ lwsi_set_state(wsi, LRS_H2_AWAIT_PREFACE);
+ wsi->upgraded_to_http2 = 1;
return 0;
#endif
-
+#if defined(LWS_ROLE_WS)
upgrade_ws:
- if (!wsi->protocol)
- lwsl_err("NULL protocol at lws_read\n");
-
- /*
- * It's websocket
- *
- * Select the first protocol we support from the list
- * the client sent us.
- *
- * Copy it to remove header fragmentation
- */
-
- if (lws_hdr_copy(wsi, protocol_list, sizeof(protocol_list) - 1,
- WSI_TOKEN_PROTOCOL) < 0) {
- lwsl_err("protocol list too long");
- goto bail_nuke_ah;
- }
-
- protocol_len = lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL);
- protocol_list[protocol_len] = '\0';
- p = protocol_list;
- hit = 0;
-
- while (*p && !hit) {
- n = 0;
- non_space_char_found = 0;
- while (n < sizeof(protocol_name) - 1 &&
- *p && *p != ',') {
- /* ignore leading spaces */
- if (!non_space_char_found && *p == ' ') {
- n++;
- continue;
- }
- non_space_char_found = 1;
- protocol_name[n++] = *p++;
- }
- protocol_name[n] = '\0';
- if (*p)
- p++;
-
- lwsl_info("checking %s\n", protocol_name);
-
- n = 0;
- while (wsi->vhost->protocols[n].callback) {
- lwsl_info("try %s\n",
- wsi->vhost->protocols[n].name);
-
- if (wsi->vhost->protocols[n].name &&
- !strcmp(wsi->vhost->protocols[n].name,
- protocol_name)) {
- wsi->protocol = &wsi->vhost->protocols[n];
- hit = 1;
- break;
- }
-
- n++;
- }
- }
-
- /* we didn't find a protocol he wanted? */
-
- if (!hit) {
- if (lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL)) {
- lwsl_info("No protocol from \"%s\" supported\n",
- protocol_list);
- goto bail_nuke_ah;
- }
- /*
- * some clients only have one protocol and
- * do not send the protocol list header...
- * allow it and match to the vhost's default
- * protocol (which itself defaults to zero)
- */
- lwsl_info("defaulting to prot handler %d\n",
- wsi->vhost->default_protocol_index);
- n = wsi->vhost->default_protocol_index;
- wsi->protocol = &wsi->vhost->protocols[
- (int)wsi->vhost->default_protocol_index];
- }
-
- /* allocate wsi->user storage */
- if (lws_ensure_user_space(wsi))
- goto bail_nuke_ah;
-
- /*
- * Give the user code a chance to study the request and
- * have the opportunity to deny it
- */
- if ((wsi->protocol->callback)(wsi,
- LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION,
- wsi->user_space,
- lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL), 0)) {
- lwsl_warn("User code denied connection\n");
- goto bail_nuke_ah;
- }
-
- /*
- * Perform the handshake according to the protocol version the
- * client announced
- */
-
- switch (wsi->ietf_spec_revision) {
- case 13:
- lwsl_parser("lws_parse calling handshake_04\n");
- if (handshake_0405(context, wsi)) {
- lwsl_info("hs0405 has failed the connection\n");
- goto bail_nuke_ah;
- }
- break;
-
- default:
- lwsl_info("Unknown client spec version %d\n",
- wsi->ietf_spec_revision);
+ if (lws_process_ws_upgrade(wsi))
goto bail_nuke_ah;
- }
-
- lws_same_vh_protocol_insert(wsi, n);
-
- /* we are upgrading to ws, so http/1.1 and keepalive +
- * pipelined header considerations about keeping the ah around
- * no longer apply. However it's common for the first ws
- * protocol data to have been coalesced with the browser
- * upgrade request and to already be in the ah rx buffer.
- */
-
- lwsl_info("%s: %p: inheriting ws ah (rxpos:%d, rxlen:%d)\n",
- __func__, wsi, wsi->u.hdr.ah->rxpos,
- wsi->u.hdr.ah->rxlen);
- lws_pt_lock(pt);
- hdr = wsi->u.hdr;
-
- lws_union_transition(wsi, LWSCM_WS_SERVING);
- /*
- * first service is WS mode will notice this, use the RX and
- * then detach the ah (caution: we are not in u.hdr union
- * mode any more then... ah_temp member is at start the same
- * though)
- *
- * Because rxpos/rxlen shows something in the ah, we will get
- * service guaranteed next time around the event loop
- *
- * All union members begin with hdr, so we can use it even
- * though we transitioned to ws union mode (the ah detach
- * code uses it anyway).
- */
- wsi->u.hdr = hdr;
- lws_pt_unlock(pt);
-
- lws_server_init_wsi_for_ws(wsi);
- lwsl_parser("accepted v%02d connection\n",
- wsi->ietf_spec_revision);
-
- /* !!! drop ah unreservedly after ESTABLISHED */
- if (!wsi->more_rx_waiting) {
- lws_header_table_force_to_detachable_state(wsi);
- lws_header_table_detach(wsi, 1);
- }
return 0;
+#endif
} /* while all chars are handled */
return 0;
bail_nuke_ah:
/* drop the header info */
- /* we're closing, losing some rx is OK */
- lws_header_table_force_to_detachable_state(wsi);
lws_header_table_detach(wsi, 1);
return 1;
@@ -1772,10 +1649,13 @@ lws_get_idlest_tsi(struct lws_context *context)
}
struct lws *
-lws_create_new_server_wsi(struct lws_vhost *vhost)
+lws_create_new_server_wsi(struct lws_vhost *vhost, int fixed_tsi)
{
struct lws *new_wsi;
- int n = lws_get_idlest_tsi(vhost->context);
+ int n = fixed_tsi;
+
+ if (n < 0)
+ n = lws_get_idlest_tsi(vhost->context);
if (n < 0) {
lwsl_err("no space for new conn\n");
@@ -1799,12 +1679,11 @@ lws_create_new_server_wsi(struct lws_vhost *vhost)
/* initialize the instance struct */
- new_wsi->state = LWSS_HTTP;
- new_wsi->mode = LWSCM_HTTP_SERVING;
+ lwsi_set_state(new_wsi, LRS_UNCONNECTED);
new_wsi->hdr_parsing_completed = 0;
-#ifdef LWS_OPENSSL_SUPPORT
- new_wsi->use_ssl = LWS_SSL_ENABLED(vhost);
+#ifdef LWS_WITH_TLS
+ new_wsi->tls.use_ssl = LWS_SSL_ENABLED(vhost);
#endif
/*
@@ -1815,9 +1694,8 @@ lws_create_new_server_wsi(struct lws_vhost *vhost)
*/
new_wsi->protocol = vhost->protocols;
new_wsi->user_space = NULL;
- new_wsi->ietf_spec_revision = 0;
new_wsi->desc.sockfd = LWS_SOCK_INVALID;
- new_wsi->position_in_fds_table = -1;
+ new_wsi->position_in_fds_table = LWS_NO_FDS_POS;
vhost->context->count_wsi_allocated++;
@@ -1845,7 +1723,6 @@ lws_http_transaction_completed(struct lws *wsi)
return 0;
}
- lwsl_debug("%s: wsi %p\n", __func__, wsi);
/* if we can't go back to accept new headers, drop the connection */
if (wsi->http2_substream)
return 0;
@@ -1853,22 +1730,28 @@ lws_http_transaction_completed(struct lws *wsi)
if (wsi->seen_zero_length_recv)
return 1;
- if (wsi->u.http.connection_type != HTTP_CONNECTION_KEEP_ALIVE) {
- lwsl_info("%s: %p: close connection\n", __func__, wsi);
+ if (wsi->http.connection_type != HTTP_CONNECTION_KEEP_ALIVE) {
+ lwsl_notice("%s: %p: close connection\n", __func__, wsi);
return 1;
}
if (lws_bind_protocol(wsi, &wsi->vhost->protocols[0]))
return 1;
- /* otherwise set ourselves up ready to go again */
- wsi->state = LWSS_HTTP;
- wsi->mode = LWSCM_HTTP_SERVING;
- wsi->u.http.tx_content_length = 0;
- wsi->u.http.tx_content_remain = 0;
+ /*
+ * otherwise set ourselves up ready to go again, but because we have no
+ * idea about the wsi writability, we make put it in a holding state
+ * until we can verify POLLOUT. The part of this that confirms POLLOUT
+ * with no partials is in lws_server_socket_service() below.
+ */
+ lwsl_debug("%s: %p: setting DEF_ACT from 0x%x\n", __func__,
+ wsi, wsi->wsistate);
+ lwsi_set_state(wsi, LRS_DEFERRING_ACTION);
+ wsi->http.tx_content_length = 0;
+ wsi->http.tx_content_remain = 0;
wsi->hdr_parsing_completed = 0;
#ifdef LWS_WITH_ACCESS_LOG
- wsi->access_log.sent = 0;
+ wsi->http.access_log.sent = 0;
#endif
if (wsi->vhost->keepalive_timeout)
@@ -1887,21 +1770,20 @@ lws_http_transaction_completed(struct lws *wsi)
* that is already at least the start of another header set, simply
* reset the existing header table and keep it.
*/
- if (wsi->u.hdr.ah) {
- lwsl_debug("%s: wsi->more_rx_waiting=%d\n", __func__,
- wsi->more_rx_waiting);
-
- if (!wsi->more_rx_waiting) {
- lws_header_table_force_to_detachable_state(wsi);
+ if (wsi->http.ah) {
+ // lws_buflist_describe(&wsi->buflist, wsi);
+ if (!lws_buflist_next_segment_len(&wsi->buflist, NULL)) {
+ lwsl_info("%s: %p: nothing in buflist so detaching ah\n",
+ __func__, wsi);
lws_header_table_detach(wsi, 1);
-#ifdef LWS_OPENSSL_SUPPORT
+#ifdef LWS_WITH_TLS
/*
* additionally... if we are hogging an SSL instance
* with no pending pipelined headers (or ah now), and
* SSL is scarce, drop this connection without waiting
*/
- if (wsi->vhost->use_ssl &&
+ if (wsi->vhost->tls.use_ssl &&
wsi->context->simultaneous_ssl_restriction &&
wsi->context->simultaneous_ssl ==
wsi->context->simultaneous_ssl_restriction) {
@@ -1911,7 +1793,9 @@ lws_http_transaction_completed(struct lws *wsi)
}
#endif
} else {
- lws_header_table_reset(wsi, 1);
+ lwsl_info("%s: %p: resetting and keeping ah as pipeline\n",
+ __func__, wsi);
+ lws_header_table_reset(wsi, 0);
/*
* If we kept the ah, we should restrict the amount
* of time we are willing to keep it. Otherwise it
@@ -1921,12 +1805,18 @@ lws_http_transaction_completed(struct lws *wsi)
lws_set_timeout(wsi, PENDING_TIMEOUT_HOLDING_AH,
wsi->vhost->keepalive_timeout);
}
- }
+ /* If we're (re)starting on headers, need other implied init */
+ if (wsi->http.ah)
+ wsi->http.ah->ues = URIES_IDLE;
- /* If we're (re)starting on headers, need other implied init */
- wsi->u.hdr.ues = URIES_IDLE;
+ //lwsi_set_state(wsi, LRS_ESTABLISHED);
+ } else
+ if (lws_buflist_next_segment_len(&wsi->buflist, NULL))
+ if (lws_header_table_attach(wsi, 0))
+ lwsl_debug("acquired ah\n");
lwsl_info("%s: %p: keep-alive await new transaction\n", __func__, wsi);
+ lws_callback_on_writable(wsi);
return 0;
}
@@ -1949,11 +1839,7 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
if (type & LWS_ADOPT_SOCKET && !(type & LWS_ADOPT_WS_PARENTIO)) {
peer = lws_get_or_create_peer(vh, fd.sockfd);
- if (!peer) {
- lwsl_err("OOM creating peer\n");
- return NULL;
- }
- if (context->ip_limit_wsi &&
+ if (peer && context->ip_limit_wsi &&
peer->count_wsi >= context->ip_limit_wsi) {
lwsl_notice("Peer reached wsi limit %d\n",
context->ip_limit_wsi);
@@ -1964,7 +1850,10 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
}
#endif
- new_wsi = lws_create_new_server_wsi(vh);
+ n = -1;
+ if (parent)
+ n = parent->tsi;
+ new_wsi = lws_create_new_server_wsi(vh, n);
if (!new_wsi) {
if (type & LWS_ADOPT_SOCKET && !(type & LWS_ADOPT_WS_PARENTIO))
compatible_close(fd.sockfd);
@@ -2000,28 +1889,51 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
lwsl_notice("OOM trying to get user_space\n");
goto bail;
}
+#if defined(LWS_ROLE_WS)
if (type & LWS_ADOPT_WS_PARENTIO) {
new_wsi->desc.sockfd = LWS_SOCK_INVALID;
lwsl_debug("binding to %s\n", new_wsi->protocol->name);
lws_bind_protocol(new_wsi, new_wsi->protocol);
- lws_union_transition(new_wsi, LWSCM_WS_SERVING);
+ lws_role_transition(new_wsi, LWSIFR_SERVER,
+ LRS_ESTABLISHED, &role_ops_ws);
+ /* allocate the ws struct for the wsi */
+ new_wsi->ws = lws_zalloc(sizeof(*new_wsi->ws), "ws struct");
+ if (!new_wsi->ws) {
+ lwsl_notice("OOM\n");
+ goto bail;
+ }
lws_server_init_wsi_for_ws(new_wsi);
return new_wsi;
}
+#endif
} else
- if (type & LWS_ADOPT_HTTP) /* he will transition later */
+#if defined(LWS_ROLE_H1)
+ if (type & LWS_ADOPT_HTTP) {/* he will transition later */
new_wsi->protocol =
&vh->protocols[vh->default_protocol_index];
- else { /* this is the only time he will transition */
+ new_wsi->role_ops = &role_ops_h1;
+ }
+ else
+#endif
+ { /* this is the only time he will transition */
lws_bind_protocol(new_wsi,
&vh->protocols[vh->raw_protocol_index]);
- lws_union_transition(new_wsi, LWSCM_RAW);
+ lws_role_transition(new_wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_skt);
}
if (type & LWS_ADOPT_SOCKET) { /* socket desc */
lwsl_debug("%s: new wsi %p, sockfd %d\n", __func__, new_wsi,
(int)(lws_intptr_t)fd.sockfd);
+#if !defined(LWS_WITH_ESP32)
+ if (type & LWS_ADOPT_FLAG_UDP)
+ /*
+ * these can be >128 bytes, so just alloc for UDP
+ */
+ new_wsi->udp = lws_malloc(sizeof(*new_wsi->udp),
+ "udp struct");
+#endif
if (type & LWS_ADOPT_HTTP)
/* the transport is accepted...
@@ -2030,11 +1942,6 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
PENDING_TIMEOUT_ESTABLISH_WITH_SERVER,
context->timeout_secs);
-#if LWS_POSIX == 0
-#if defined(LWS_WITH_ESP8266)
- esp8266_tcp_stream_accept(accept_fd, new_wsi);
-#endif
-#endif
} else /* file desc */
lwsl_debug("%s: new wsi %p, filefd %d\n", __func__, new_wsi,
(int)(lws_intptr_t)fd.filefd);
@@ -2058,29 +1965,43 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
/* non-SSL */
if (!(type & LWS_ADOPT_HTTP)) {
if (!(type & LWS_ADOPT_SOCKET))
- new_wsi->mode = LWSCM_RAW_FILEDESC;
+ lws_role_transition(new_wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_file);
else
- new_wsi->mode = LWSCM_RAW;
+ lws_role_transition(new_wsi, 0, LRS_ESTABLISHED,
+ &role_ops_raw_skt);
}
+#if defined(LWS_ROLE_H1)
+ else
+ lws_role_transition(new_wsi, LWSIFR_SERVER,
+ LRS_HEADERS, &role_ops_h1);
+#endif
} else {
/* SSL */
if (!(type & LWS_ADOPT_HTTP))
- new_wsi->mode = LWSCM_SSL_INIT_RAW;
+ lws_role_transition(new_wsi, 0, LRS_SSL_INIT,
+ &role_ops_raw_skt);
+#if defined(LWS_ROLE_H1)
else
- new_wsi->mode = LWSCM_SSL_INIT;
-
+ lws_role_transition(new_wsi, LWSIFR_SERVER,
+ LRS_SSL_INIT, &role_ops_h1);
+#endif
ssl = 1;
}
- lws_libev_accept(new_wsi, new_wsi->desc);
- lws_libuv_accept(new_wsi, new_wsi->desc);
- lws_libevent_accept(new_wsi, new_wsi->desc);
+ lwsl_debug("new wsi wsistate 0x%x\n", new_wsi->wsistate);
+
+ if (context->event_loop_ops->accept)
+ context->event_loop_ops->accept(new_wsi);
if (!ssl) {
- if (insert_wsi_socket_into_fds(context, new_wsi)) {
+ lws_pt_lock(pt, __func__);
+ if (__insert_wsi_socket_into_fds(context, new_wsi)) {
+ lws_pt_unlock(pt);
lwsl_err("%s: fail inserting socket\n", __func__);
goto fail;
}
+ lws_pt_unlock(pt);
} else
if (lws_server_socket_service_ssl(new_wsi, fd.sockfd)) {
lwsl_info("%s: fail ssl negotiation\n", __func__);
@@ -2102,11 +2023,13 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,
lwsl_info("%s: waiting for ah\n", __func__);
}
+ lws_cancel_service_pt(new_wsi);
+
return new_wsi;
fail:
if (type & LWS_ADOPT_SOCKET)
- lws_close_free_wsi(new_wsi, LWS_CLOSE_STATUS_NOSTATUS);
+ lws_close_free_wsi(new_wsi, LWS_CLOSE_STATUS_NOSTATUS, "adopt skt fail");
return NULL;
@@ -2143,8 +2066,8 @@ static struct lws*
adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
{
struct lws_context_per_thread *pt;
- struct allocated_headers *ah;
struct lws_pollfd *pfd;
+ int n;
if (!wsi)
return NULL;
@@ -2152,10 +2075,16 @@ adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
if (!readbuf || len == 0)
return wsi;
- if (len > sizeof(ah->rx)) {
- lwsl_err("%s: rx in too big\n", __func__);
+ if (wsi->position_in_fds_table == LWS_NO_FDS_POS)
+ return wsi;
+
+ pt = &wsi->context->pt[(int)wsi->tsi];
+
+ n = lws_buflist_append_segment(&wsi->buflist, (const uint8_t *)readbuf, len);
+ if (n < 0)
goto bail;
- }
+ if (n)
+ lws_dll_lws_add_front(&wsi->dll_buflist, &pt->dll_head_buflist);
/*
* we can't process the initial read data until we can attach an ah.
@@ -2167,14 +2096,9 @@ adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
* readbuf data to wsi or ah yet, and we will do it next if we get
* the ah.
*/
- if (wsi->u.hdr.ah || !lws_header_table_attach(wsi, 0)) {
- ah = wsi->u.hdr.ah;
- memcpy(ah->rx, readbuf, len);
- ah->rxpos = 0;
- ah->rxlen = (int16_t)len;
+ if (wsi->http.ah || !lws_header_table_attach(wsi, 0)) {
lwsl_notice("%s: calling service on readbuf ah\n", __func__);
- pt = &wsi->context->pt[(int)wsi->tsi];
/* unlike a normal connect, we have the headers already
* (or the first part of them anyway).
@@ -2191,25 +2115,11 @@ adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)
return wsi;
}
lwsl_err("%s: deferring handling ah\n", __func__);
- /*
- * hum if no ah came, we are on the wait list and must defer
- * dealing with this until the ah arrives.
- *
- * later successful lws_header_table_attach() will apply the
- * below to the rx buffer (via lws_header_table_reset()).
- */
- wsi->u.hdr.preamble_rx = lws_malloc(len, "preamble_rx");
- if (!wsi->u.hdr.preamble_rx) {
- lwsl_err("OOM\n");
- goto bail;
- }
- memcpy(wsi->u.hdr.preamble_rx, readbuf, len);
- wsi->u.hdr.preamble_rx_len = len;
return wsi;
bail:
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "adopt skt readbuf fail");
return NULL;
}
@@ -2232,397 +2142,6 @@ lws_adopt_socket_vhost_readbuf(struct lws_vhost *vhost,
}
LWS_VISIBLE int
-lws_server_socket_service(struct lws_context *context, struct lws *wsi,
- struct lws_pollfd *pollfd)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- lws_sockfd_type accept_fd = LWS_SOCK_INVALID;
- struct allocated_headers *ah;
- lws_sock_file_fd_type fd;
- int opts = LWS_ADOPT_SOCKET | LWS_ADOPT_ALLOW_SSL;
-#if LWS_POSIX
- struct sockaddr_storage cli_addr;
- socklen_t clilen;
-#endif
- int n, len;
-
- switch (wsi->mode) {
-
- case LWSCM_HTTP_SERVING:
- case LWSCM_HTTP_SERVING_ACCEPTED:
- case LWSCM_HTTP2_SERVING:
- case LWSCM_RAW:
-
- /* handle http headers coming in */
-
- /* pending truncated sends have uber priority */
-
- if (wsi->trunc_len) {
- if (!(pollfd->revents & LWS_POLLOUT))
- break;
-
- if (lws_issue_raw(wsi, wsi->trunc_alloc +
- wsi->trunc_offset,
- wsi->trunc_len) < 0)
- goto fail;
- /*
- * we can't afford to allow input processing to send
- * something new, so spin around he event loop until
- * he doesn't have any partials
- */
- break;
- }
-
- /* any incoming data ready? */
-
- if (!(pollfd->revents & pollfd->events & LWS_POLLIN))
- goto try_pollout;
-
- /*
- * If we previously just did POLLIN when IN and OUT were
- * signalled (because POLLIN processing may have used up
- * the POLLOUT), don't let that happen twice in a row...
- * next time we see the situation favour POLLOUT
- */
-#if !defined(LWS_WITH_ESP8266)
- if (wsi->favoured_pollin &&
- (pollfd->revents & pollfd->events & LWS_POLLOUT)) {
- lwsl_notice("favouring pollout\n");
- wsi->favoured_pollin = 0;
- goto try_pollout;
- }
-#endif
-
- /* these states imply we MUST have an ah attached */
-
- if (wsi->mode != LWSCM_RAW && (wsi->state == LWSS_HTTP ||
- wsi->state == LWSS_HTTP_ISSUING_FILE ||
- wsi->state == LWSS_HTTP_HEADERS)) {
- if (!wsi->u.hdr.ah) {
- /* no autoservice beacuse we will do it next */
- if (lws_header_table_attach(wsi, 0)) {
- lwsl_info("wsi %p: ah get fail\n", wsi);
- goto try_pollout;
- }
- }
- ah = wsi->u.hdr.ah;
-
- /* if nothing in ah rx buffer, get some fresh rx */
- if (ah->rxpos == ah->rxlen) {
- ah->rxlen = lws_ssl_capable_read(wsi, ah->rx,
- sizeof(ah->rx));
- ah->rxpos = 0;
- switch (ah->rxlen) {
- case 0:
- lwsl_info("%s: read 0 len a\n", __func__);
- wsi->seen_zero_length_recv = 1;
- lws_change_pollfd(wsi, LWS_POLLIN, 0);
- goto try_pollout;
- /* fallthru */
- case LWS_SSL_CAPABLE_ERROR:
- goto fail;
- case LWS_SSL_CAPABLE_MORE_SERVICE:
- ah->rxlen = ah->rxpos = 0;
- goto try_pollout;
- }
-
- /*
- * make sure ah does not get detached if we
- * have live data in the rx
- */
- if (ah->rxlen)
- wsi->more_rx_waiting = 1;
- }
-
- if (!(ah->rxpos != ah->rxlen && ah->rxlen)) {
- lwsl_err("%s: assert: rxpos %d, rxlen %d\n",
- __func__, ah->rxpos, ah->rxlen);
-
- assert(0);
- }
-
- /* just ignore incoming if waiting for close */
- if (wsi->state != LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE &&
- wsi->state != LWSS_HTTP_ISSUING_FILE) {
- /*
- * otherwise give it to whoever wants it
- * according to the connection state
- */
-
- n = lws_read(wsi, ah->rx + ah->rxpos,
- ah->rxlen - ah->rxpos);
- if (n < 0) /* we closed wsi */
- return 1;
-
- if (!wsi->u.hdr.ah)
- break;
- if ( wsi->u.hdr.ah->rxlen)
- wsi->u.hdr.ah->rxpos += n;
-
- lwsl_debug("%s: wsi %p: ah read rxpos %d, rxlen %d\n",
- __func__, wsi, wsi->u.hdr.ah->rxpos,
- wsi->u.hdr.ah->rxlen);
-
- if (lws_header_table_is_in_detachable_state(wsi) &&
- (wsi->mode != LWSCM_HTTP_SERVING &&
- wsi->mode != LWSCM_HTTP_SERVING_ACCEPTED &&
- wsi->mode != LWSCM_HTTP2_SERVING))
- lws_header_table_detach(wsi, 1);
-
- break;
- }
-
- goto try_pollout;
- }
-
- len = lws_ssl_capable_read(wsi, pt->serv_buf,
- context->pt_serv_buf_size);
- lwsl_debug("%s: wsi %p read %d\r\n", __func__, wsi, len);
- switch (len) {
- case 0:
- lwsl_info("%s: read 0 len b\n", __func__);
-
- /* fallthru */
- case LWS_SSL_CAPABLE_ERROR:
- goto fail;
- case LWS_SSL_CAPABLE_MORE_SERVICE:
- goto try_pollout;
- }
-
- if (len < 0) /* coverity */
- goto fail;
-
- if (wsi->mode == LWSCM_RAW) {
- n = user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_RAW_RX,
- wsi->user_space, pt->serv_buf, len);
- if (n < 0) {
- lwsl_info("LWS_CALLBACK_RAW_RX_fail\n");
- goto fail;
- }
- goto try_pollout;
- }
-
- /* just ignore incoming if waiting for close */
- if (wsi->state != LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE &&
- wsi->state != LWSS_HTTP_ISSUING_FILE) {
- /*
- * this may want to send
- * (via HTTP callback for example)
- */
- n = lws_read(wsi, pt->serv_buf, len);
- if (n < 0) /* we closed wsi */
- return 1;
- /*
- * he may have used up the
- * writability above, if we will defer POLLOUT
- * processing in favour of POLLIN, note it
- */
- if (pollfd->revents & LWS_POLLOUT)
- wsi->favoured_pollin = 1;
- break;
- }
- /*
- * he may have used up the
- * writability above, if we will defer POLLOUT
- * processing in favour of POLLIN, note it
- */
- if (pollfd->revents & LWS_POLLOUT)
- wsi->favoured_pollin = 1;
-
-try_pollout:
-
- /* this handles POLLOUT for http serving fragments */
-
- if (!(pollfd->revents & LWS_POLLOUT))
- break;
-
- /* one shot */
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_notice("%s a\n", __func__);
- goto fail;
- }
-
- if (wsi->mode == LWSCM_RAW) {
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_WRITEABLE_CB, 1);
-#if defined(LWS_WITH_STATS)
- if (wsi->active_writable_req_us) {
- uint64_t ul = time_in_microseconds() -
- wsi->active_writable_req_us;
-
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_MS_WRITABLE_DELAY, ul);
- lws_stats_atomic_max(wsi->context, pt,
- LWSSTATS_MS_WORST_WRITABLE_DELAY, ul);
- wsi->active_writable_req_us = 0;
- }
-#endif
- n = user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_RAW_WRITEABLE,
- wsi->user_space, NULL, 0);
- if (n < 0) {
- lwsl_info("writeable_fail\n");
- goto fail;
- }
- break;
- }
-
- if (!wsi->hdr_parsing_completed)
- break;
-
- if (wsi->state != LWSS_HTTP_ISSUING_FILE) {
-
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_WRITEABLE_CB, 1);
-#if defined(LWS_WITH_STATS)
- if (wsi->active_writable_req_us) {
- uint64_t ul = time_in_microseconds() -
- wsi->active_writable_req_us;
-
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_MS_WRITABLE_DELAY, ul);
- lws_stats_atomic_max(wsi->context, pt,
- LWSSTATS_MS_WORST_WRITABLE_DELAY, ul);
- wsi->active_writable_req_us = 0;
- }
-#endif
-
- n = user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_HTTP_WRITEABLE,
- wsi->user_space, NULL, 0);
- if (n < 0) {
- lwsl_info("writeable_fail\n");
- goto fail;
- }
- break;
- }
-
- /* >0 == completion, <0 == error
- *
- * We'll get a LWS_CALLBACK_HTTP_FILE_COMPLETION callback when
- * it's done. That's the case even if we just completed the
- * send, so wait for that.
- */
- n = lws_serve_http_file_fragment(wsi);
- if (n < 0)
- goto fail;
-
- break;
-
- case LWSCM_SERVER_LISTENER:
-
-#if LWS_POSIX
- /* pollin means a client has connected to us then */
-
- do {
- if (!(pollfd->revents & LWS_POLLIN) ||
- !(pollfd->events & LWS_POLLIN))
- break;
-
-#ifdef LWS_OPENSSL_SUPPORT
- /*
- * can we really accept it, with regards to SSL limit?
- * another vhost may also have had POLLIN on his listener this
- * round and used it up already
- */
-
- if (wsi->vhost->use_ssl &&
- context->simultaneous_ssl_restriction &&
- context->simultaneous_ssl ==
- context->simultaneous_ssl_restriction)
- /* no... ignore it, he won't come again until we are
- * below the simultaneous_ssl_restriction limit and
- * POLLIN is enabled on him again
- */
- break;
-#endif
- /* listen socket got an unencrypted connection... */
-
- clilen = sizeof(cli_addr);
- lws_latency_pre(context, wsi);
-
- /*
- * We cannot identify the peer who is in the listen
- * socket connect queue before we accept it; even if
- * we could, not accepting it due to PEER_LIMITS would
- * block the connect queue for other legit peers.
- */
- accept_fd = accept(pollfd->fd, (struct sockaddr *)&cli_addr,
- &clilen);
- lws_latency(context, wsi, "listener accept", accept_fd,
- accept_fd >= 0);
- if (accept_fd < 0) {
- if (LWS_ERRNO == LWS_EAGAIN ||
- LWS_ERRNO == LWS_EWOULDBLOCK) {
- break;
- }
- lwsl_err("ERROR on accept: %s\n", strerror(LWS_ERRNO));
- break;
- }
-
- lws_plat_set_socket_options(wsi->vhost, accept_fd);
-
-#if defined(LWS_WITH_IPV6)
- lwsl_debug("accepted new conn port %u on fd=%d\n",
- ((cli_addr.ss_family == AF_INET6) ?
- ntohs(((struct sockaddr_in6 *) &cli_addr)->sin6_port) :
- ntohs(((struct sockaddr_in *) &cli_addr)->sin_port)),
- accept_fd);
-#else
- lwsl_debug("accepted new conn port %u on fd=%d\n",
- ntohs(((struct sockaddr_in *) &cli_addr)->sin_port),
- accept_fd);
-#endif
-
-#else
- /* not very beautiful... */
- accept_fd = (lws_sockfd_type)pollfd;
-#endif
- /*
- * look at who we connected to and give user code a chance
- * to reject based on client IP. There's no protocol selected
- * yet so we issue this to protocols[0]
- */
- if ((wsi->vhost->protocols[0].callback)(wsi,
- LWS_CALLBACK_FILTER_NETWORK_CONNECTION,
- NULL, (void *)(lws_intptr_t)accept_fd, 0)) {
- lwsl_debug("Callback denied network connection\n");
- compatible_close(accept_fd);
- break;
- }
-
- if (!(wsi->vhost->options & LWS_SERVER_OPTION_ONLY_RAW))
- opts |= LWS_ADOPT_HTTP;
- else
- opts = LWS_ADOPT_SOCKET;
-
- fd.sockfd = accept_fd;
- if (!lws_adopt_descriptor_vhost(wsi->vhost, opts, fd,
- NULL, NULL))
- /* already closed cleanly as necessary */
- return 1;
-
-#if LWS_POSIX
- } while (pt->fds_count < context->fd_limit_per_thread - 1 &&
- lws_poll_listen_fd(&pt->fds[wsi->position_in_fds_table]) > 0);
-#endif
- return 0;
-
- default:
- break;
- }
-
- if (!lws_server_socket_service_ssl(wsi, accept_fd))
- return 0;
-
-fail:
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
-
- return 1;
-}
-
-LWS_VISIBLE int
lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
const char *other_headers, int other_headers_len)
{
@@ -2630,13 +2149,13 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
struct lws_context *context = lws_get_context(wsi);
struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
#if defined(LWS_WITH_RANGES)
- struct lws_range_parsing *rp = &wsi->u.http.range;
+ struct lws_range_parsing *rp = &wsi->http.range;
#endif
char cache_control[50], *cc = "no-store";
unsigned char *response = pt->serv_buf + LWS_PRE;
unsigned char *p = response;
unsigned char *end = p + context->pt_serv_buf_size - LWS_PRE;
- lws_filepos_t computed_total_content_length;
+ lws_filepos_t total_content_length;
int ret = 0, cclen = 8, n = HTTP_STATUS_OK;
lws_fop_flags_t fflags = LWS_O_RDONLY;
#if defined(LWS_WITH_RANGES)
@@ -2645,29 +2164,34 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
const struct lws_plat_file_ops *fops;
const char *vpath;
+ if (wsi->handling_404)
+ n = HTTP_STATUS_NOT_FOUND;
+
/*
* We either call the platform fops .open with first arg platform fops,
* or we call fops_zip .open with first arg platform fops, and fops_zip
* open will decide whether to switch to fops_zip or stay with fops_def.
*
- * If wsi->u.http.fop_fd is already set, the caller already opened it
+ * If wsi->http.fop_fd is already set, the caller already opened it
*/
- if (!wsi->u.http.fop_fd) {
+ if (!wsi->http.fop_fd) {
fops = lws_vfs_select_fops(wsi->context->fops, file, &vpath);
fflags |= lws_vfs_prepare_flags(wsi);
- wsi->u.http.fop_fd = fops->LWS_FOP_OPEN(wsi->context->fops,
+ wsi->http.fop_fd = fops->LWS_FOP_OPEN(wsi->context->fops,
file, vpath, &fflags);
- if (!wsi->u.http.fop_fd) {
- lwsl_err("Unable to open '%s'\n", file);
-
- return -1;
+ if (!wsi->http.fop_fd) {
+ lwsl_info("%s: Unable to open: '%s': errno %d\n",
+ __func__, file, errno);
+ if (lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL))
+ return -1;
+ return !wsi->http2_substream;
}
}
- wsi->u.http.filelen = lws_vfs_get_length(wsi->u.http.fop_fd);
- computed_total_content_length = wsi->u.http.filelen;
+ wsi->http.filelen = lws_vfs_get_length(wsi->http.fop_fd);
+ total_content_length = wsi->http.filelen;
#if defined(LWS_WITH_RANGES)
- ranges = lws_ranges_init(wsi, rp, wsi->u.http.filelen);
+ ranges = lws_ranges_init(wsi, rp, wsi->http.filelen);
lwsl_debug("Range count %d\n", ranges);
/*
@@ -2684,7 +2208,7 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
if (lws_http_transaction_completed(wsi))
return -1; /* <0 means just hang up */
- lws_vfs_file_close(&wsi->u.http.fop_fd);
+ lws_vfs_file_close(&wsi->http.fop_fd);
return 0; /* == 0 means we dealt with the transaction complete */
}
@@ -2695,7 +2219,7 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
if (lws_add_http_header_status(wsi, n, &p, end))
return -1;
- if ((wsi->u.http.fop_fd->flags & (LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP |
+ if ((wsi->http.fop_fd->flags & (LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP |
LWS_FOP_FLAG_COMPR_IS_GZIP)) ==
(LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP | LWS_FOP_FLAG_COMPR_IS_GZIP)) {
if (lws_add_http_header_by_token(wsi,
@@ -2710,20 +2234,24 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
ranges < 2 &&
#endif
content_type && content_type[0])
- if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE,
+ if (lws_add_http_header_by_token(wsi,
+ WSI_TOKEN_HTTP_CONTENT_TYPE,
(unsigned char *)content_type,
- strlen(content_type), &p, end))
+ (int)strlen(content_type),
+ &p, end))
return -1;
#if defined(LWS_WITH_RANGES)
if (ranges >= 2) { /* multipart byteranges */
- strncpy(wsi->u.http.multipart_content_type, content_type,
- sizeof(wsi->u.http.multipart_content_type) - 1);
- wsi->u.http.multipart_content_type[
- sizeof(wsi->u.http.multipart_content_type) - 1] = '\0';
- if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE,
- (unsigned char *)"multipart/byteranges; boundary=_lws",
- 20, &p, end))
+ lws_strncpy(wsi->http.multipart_content_type, content_type,
+ sizeof(wsi->http.multipart_content_type));
+
+ if (lws_add_http_header_by_token(wsi,
+ WSI_TOKEN_HTTP_CONTENT_TYPE,
+ (unsigned char *)
+ "multipart/byteranges; "
+ "boundary=_lws",
+ 20, &p, end))
return -1;
/*
@@ -2738,8 +2266,8 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
* Precompute it for the main response header
*/
- computed_total_content_length = (lws_filepos_t)rp->agg +
- 6 /* final _lws\r\n */;
+ total_content_length = (lws_filepos_t)rp->agg +
+ 6 /* final _lws\r\n */;
lws_ranges_reset(rp);
while (lws_ranges_next(rp)) {
@@ -2747,7 +2275,7 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
"bytes %llu-%llu/%llu",
rp->start, rp->end, rp->extent);
- computed_total_content_length +=
+ total_content_length +=
6 /* header _lws\r\n */ +
/* Content-Type: xxx/xxx\r\n */
14 + strlen(content_type) + 2 +
@@ -2761,35 +2289,38 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
}
if (ranges == 1) {
- computed_total_content_length = (lws_filepos_t)rp->agg;
+ total_content_length = (lws_filepos_t)rp->agg;
n = lws_snprintf(cache_control, sizeof(cache_control),
"bytes %llu-%llu/%llu",
rp->start, rp->end, rp->extent);
- if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_RANGE,
+ if (lws_add_http_header_by_token(wsi,
+ WSI_TOKEN_HTTP_CONTENT_RANGE,
(unsigned char *)cache_control,
n, &p, end))
return -1;
}
- wsi->u.http.range.inside = 0;
+ wsi->http.range.inside = 0;
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_ACCEPT_RANGES,
(unsigned char *)"bytes", 5, &p, end))
return -1;
#endif
- if (!wsi->sending_chunked) {
- if (lws_add_http_header_content_length(wsi,
- computed_total_content_length,
- &p, end))
- return -1;
- } else {
- if (lws_add_http_header_by_token(wsi,
+ if (!wsi->http2_substream) {
+ if (!wsi->sending_chunked) {
+ if (lws_add_http_header_content_length(wsi,
+ total_content_length,
+ &p, end))
+ return -1;
+ } else {
+ if (lws_add_http_header_by_token(wsi,
WSI_TOKEN_HTTP_TRANSFER_ENCODING,
(unsigned char *)"chunked",
7, &p, end))
- return -1;
+ return -1;
+ }
}
if (wsi->cache_secs && wsi->cache_reuse) {
@@ -2808,7 +2339,7 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
(unsigned char *)cc, cclen, &p, end))
return -1;
- if (wsi->u.http.connection_type == HTTP_CONNECTION_KEEP_ALIVE)
+ if (wsi->http.connection_type == HTTP_CONNECTION_KEEP_ALIVE)
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_CONNECTION,
(unsigned char *)"keep-alive", 10, &p, end))
return -1;
@@ -2830,91 +2361,268 @@ lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
return -1;
}
- wsi->u.http.filepos = 0;
- wsi->state = LWSS_HTTP_ISSUING_FILE;
+ wsi->http.filepos = 0;
+ lwsi_set_state(wsi, LRS_ISSUING_FILE);
lws_callback_on_writable(wsi);
return 0;
}
-int
-lws_interpret_incoming_packet(struct lws *wsi, unsigned char **buf, size_t len)
+LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
{
- int m;
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ struct lws_process_html_args args;
+ lws_filepos_t amount, poss;
+ unsigned char *p, *pstart;
+#if defined(LWS_WITH_RANGES)
+ unsigned char finished = 0;
+#endif
+ int n, m;
+
+ lwsl_debug("wsi->http2_substream %d\n", wsi->http2_substream);
+
+ do {
+
+ if (wsi->trunc_len) {
+ if (lws_issue_raw(wsi, wsi->trunc_alloc +
+ wsi->trunc_offset,
+ wsi->trunc_len) < 0) {
+ lwsl_info("%s: closing\n", __func__);
+ goto file_had_it;
+ }
+ break;
+ }
+
+ if (wsi->http.filepos == wsi->http.filelen)
+ goto all_sent;
+
+ n = 0;
+
+ pstart = pt->serv_buf + LWS_H2_FRAME_HEADER_LENGTH;
+
+ p = pstart;
+
+#if defined(LWS_WITH_RANGES)
+ if (wsi->http.range.count_ranges && !wsi->http.range.inside) {
+
+ lwsl_notice("%s: doing range start %llu\n", __func__,
+ wsi->http.range.start);
+
+ if ((long long)lws_vfs_file_seek_cur(wsi->http.fop_fd,
+ wsi->http.range.start -
+ wsi->http.filepos) < 0)
+ goto file_had_it;
+
+ wsi->http.filepos = wsi->http.range.start;
+
+ if (wsi->http.range.count_ranges > 1) {
+ n = lws_snprintf((char *)p,
+ context->pt_serv_buf_size -
+ LWS_H2_FRAME_HEADER_LENGTH,
+ "_lws\x0d\x0a"
+ "Content-Type: %s\x0d\x0a"
+ "Content-Range: bytes %llu-%llu/%llu\x0d\x0a"
+ "\x0d\x0a",
+ wsi->http.multipart_content_type,
+ wsi->http.range.start,
+ wsi->http.range.end,
+ wsi->http.range.extent);
+ p += n;
+ }
- lwsl_parser("%s: received %d byte packet\n", __func__, (int)len);
-#if 0
- lwsl_hexdump(*buf, len);
+ wsi->http.range.budget = wsi->http.range.end -
+ wsi->http.range.start + 1;
+ wsi->http.range.inside = 1;
+ }
#endif
- /* let the rx protocol state machine have as much as it needs */
+ poss = context->pt_serv_buf_size - n - LWS_H2_FRAME_HEADER_LENGTH;
+
+ if (wsi->http.tx_content_length)
+ if (poss > wsi->http.tx_content_remain)
+ poss = wsi->http.tx_content_remain;
- while (len) {
/*
- * we were accepting input but now we stopped doing so
+ * if there is a hint about how much we will do well to send at
+ * one time, restrict ourselves to only trying to send that.
*/
- if (wsi->rxflow_bitmap) {
- lws_rxflow_cache(wsi, *buf, 0, len);
- lwsl_parser("%s: cached %ld\n", __func__, (long)len);
- return 1;
- }
+ if (wsi->protocol->tx_packet_size &&
+ poss > wsi->protocol->tx_packet_size)
+ poss = wsi->protocol->tx_packet_size;
- if (wsi->u.ws.rx_draining_ext) {
- m = lws_rx_sm(wsi, 0);
- if (m < 0)
- return -1;
- continue;
- }
+ if (wsi->role_ops->tx_credit) {
+ lws_filepos_t txc = wsi->role_ops->tx_credit(wsi);
- /* account for what we're using in rxflow buffer */
- if (wsi->rxflow_buffer) {
- wsi->rxflow_pos++;
- if (wsi->rxflow_pos > wsi->rxflow_len) {
- lwsl_err("bumped rxflow buffer too far (%d / %d)", wsi->rxflow_pos, wsi->rxflow_len);
- assert(0);
+ if (!txc) {
+ lwsl_info("%s: came here with no tx credit\n",
+ __func__);
+ return 0;
}
+ if (txc < poss)
+ poss = txc;
+
+ /*
+ * consumption of the actual payload amount sent will be
+ * handled when the role data frame is sent
+ */
}
- /* consume payload bytes efficiently */
- if (wsi->lws_rx_parse_state ==
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED) {
- m = lws_payload_until_length_exhausted(wsi, buf, &len);
- if (wsi->rxflow_buffer)
- wsi->rxflow_pos += m;
+#if defined(LWS_WITH_RANGES)
+ if (wsi->http.range.count_ranges) {
+ if (wsi->http.range.count_ranges > 1)
+ poss -= 7; /* allow for final boundary */
+ if (poss > wsi->http.range.budget)
+ poss = wsi->http.range.budget;
+ }
+#endif
+ if (wsi->sending_chunked) {
+ /* we need to drop the chunk size in here */
+ p += 10;
+ /* allow for the chunk to grow by 128 in translation */
+ poss -= 10 + 128;
}
- if (wsi->rxflow_buffer && wsi->rxflow_pos == wsi->rxflow_len) {
- lwsl_debug("%s: %p flow buf: drained\n", __func__, wsi);
- lws_free_set_NULL(wsi->rxflow_buffer);
- /* having drained the rxflow buffer, can rearm POLLIN */
-#ifdef LWS_NO_SERVER
- m =
+ if (lws_vfs_file_read(wsi->http.fop_fd, &amount, p, poss) < 0)
+ goto file_had_it; /* caller will close */
+
+ if (wsi->sending_chunked)
+ n = (int)amount;
+ else
+ n = lws_ptr_diff(p, pstart) + (int)amount;
+
+ lwsl_debug("%s: sending %d\n", __func__, n);
+
+ if (n) {
+ lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT,
+ context->timeout_secs);
+
+ if (wsi->interpreting) {
+ args.p = (char *)p;
+ args.len = n;
+ args.max_len = (unsigned int)poss + 128;
+ args.final = wsi->http.filepos + n ==
+ wsi->http.filelen;
+ args.chunked = wsi->sending_chunked;
+ if (user_callback_handle_rxflow(
+ wsi->vhost->protocols[
+ (int)wsi->protocol_interpret_idx].callback,
+ wsi, LWS_CALLBACK_PROCESS_HTML,
+ wsi->user_space, &args, 0) < 0)
+ goto file_had_it;
+ n = args.len;
+ p = (unsigned char *)args.p;
+ } else
+ p = pstart;
+
+#if defined(LWS_WITH_RANGES)
+ if (wsi->http.range.send_ctr + 1 ==
+ wsi->http.range.count_ranges && // last range
+ wsi->http.range.count_ranges > 1 && // was 2+ ranges (ie, multipart)
+ wsi->http.range.budget - amount == 0) {// final part
+ n += lws_snprintf((char *)pstart + n, 6,
+ "_lws\x0d\x0a"); // append trailing boundary
+ lwsl_debug("added trailing boundary\n");
+ }
+#endif
+ m = lws_write(wsi, p, n,
+ wsi->http.filepos + amount == wsi->http.filelen ?
+ LWS_WRITE_HTTP_FINAL :
+ LWS_WRITE_HTTP
+ );
+ if (m < 0)
+ goto file_had_it;
+
+ wsi->http.filepos += amount;
+
+#if defined(LWS_WITH_RANGES)
+ if (wsi->http.range.count_ranges >= 1) {
+ wsi->http.range.budget -= amount;
+ if (wsi->http.range.budget == 0) {
+ lwsl_notice("range budget exhausted\n");
+ wsi->http.range.inside = 0;
+ wsi->http.range.send_ctr++;
+
+ if (lws_ranges_next(&wsi->http.range) < 1) {
+ finished = 1;
+ goto all_sent;
+ }
+ }
+ }
#endif
- _lws_rx_flow_control(wsi);
- /* m ignored, needed for NO_SERVER case */
+
+ if (m != n) {
+ /* adjust for what was not sent */
+ if (lws_vfs_file_seek_cur(wsi->http.fop_fd,
+ m - n) ==
+ (lws_fileofs_t)-1)
+ goto file_had_it;
+ }
}
- /* process the byte */
- m = lws_rx_sm(wsi, *(*buf)++);
- if (m < 0)
- return -1;
- len--;
- }
+all_sent:
+ if ((!wsi->trunc_len && wsi->http.filepos >= wsi->http.filelen)
+#if defined(LWS_WITH_RANGES)
+ || finished)
+#else
+ )
+#endif
+ {
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ /* we might be in keepalive, so close it off here */
+ lws_vfs_file_close(&wsi->http.fop_fd);
+
+ lwsl_debug("file completed\n");
+
+ if (wsi->protocol->callback &&
+ user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION,
+ wsi->user_space, NULL,
+ 0) < 0) {
+ /*
+ * For http/1.x, the choices from
+ * transaction_completed are either
+ * 0 to use the connection for pipelined
+ * or nonzero to hang it up.
+ *
+ * However for http/2. while we are
+ * still interested in hanging up the
+ * nwsi if there was a network-level
+ * fatal error, simply completing the
+ * transaction is a matter of the stream
+ * state, not the root connection at the
+ * network level
+ */
+ if (wsi->http2_substream)
+ return 1;
+ else
+ return -1;
+ }
+
+ return 1; /* >0 indicates completed */
+ }
+ } while (0); // while (!lws_send_pipe_choked(wsi))
+
+ lws_callback_on_writable(wsi);
- lwsl_parser("%s: exit with %d unused\n", __func__, (int)len);
+ return 0; /* indicates further processing must be done */
- return 0;
+file_had_it:
+ lws_vfs_file_close(&wsi->http.fop_fd);
+
+ return -1;
}
+
LWS_VISIBLE void
lws_server_get_canonical_hostname(struct lws_context *context,
- struct lws_context_creation_info *info)
+ const struct lws_context_creation_info *info)
{
if (lws_check_opt(info->options,
LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME))
return;
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
+#if !defined(LWS_WITH_ESP32)
/* find canonical hostname */
gethostname((char *)context->canonical_hostname,
sizeof(context->canonical_hostname) - 1);
@@ -2968,11 +2676,11 @@ skip:
sp = s->start + 1;
continue;
}
- if (hits == 1 && s->pos == strlen(s->vars[hit])) {
+ if (hits == 1 && s->pos == (int)strlen(s->vars[hit])) {
pc = s->replace(s->data, hit);
if (!pc)
pc = "NULL";
- n = strlen(pc);
+ n = (int)strlen(pc);
s->swallow[s->pos] = '\0';
if (n != s->pos) {
memmove(s->start + n,
@@ -2994,31 +2702,33 @@ skip:
sp++;
}
- /* no space left for final chunk trailer */
- if (args->final && args->len + 7 >= args->max_len)
- return -1;
+ if (args->chunked) {
+ /* no space left for final chunk trailer */
+ if (args->final && args->len + 7 >= args->max_len)
+ return -1;
- n = sprintf(buffer, "%X\x0d\x0a", args->len);
-
- args->p -= n;
- memcpy(args->p, buffer, n);
- args->len += n;
-
- if (args->final) {
- sp = args->p + args->len;
- *sp++ = '\x0d';
- *sp++ = '\x0a';
- *sp++ = '0';
- *sp++ = '\x0d';
- *sp++ = '\x0a';
- *sp++ = '\x0d';
- *sp++ = '\x0a';
- args->len += 7;
- } else {
- sp = args->p + args->len;
- *sp++ = '\x0d';
- *sp++ = '\x0a';
- args->len += 2;
+ n = sprintf(buffer, "%X\x0d\x0a", args->len);
+
+ args->p -= n;
+ memcpy(args->p, buffer, n);
+ args->len += n;
+
+ if (args->final) {
+ sp = args->p + args->len;
+ *sp++ = '\x0d';
+ *sp++ = '\x0a';
+ *sp++ = '0';
+ *sp++ = '\x0d';
+ *sp++ = '\x0a';
+ *sp++ = '\x0d';
+ *sp++ = '\x0a';
+ args->len += 7;
+ } else {
+ sp = args->p + args->len;
+ *sp++ = '\x0d';
+ *sp++ = '\x0a';
+ args->len += 2;
+ }
}
return 0;
diff --git a/thirdparty/libwebsockets/roles/listen/ops-listen.c b/thirdparty/libwebsockets/roles/listen/ops-listen.c
new file mode 100644
index 0000000000..dbeb9753a2
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/listen/ops-listen.c
@@ -0,0 +1,177 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+static int
+rops_handle_POLLIN_listen(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
+{
+ struct lws_context *context = wsi->context;
+ lws_sockfd_type accept_fd = LWS_SOCK_INVALID;
+ lws_sock_file_fd_type fd;
+ int opts = LWS_ADOPT_SOCKET | LWS_ADOPT_ALLOW_SSL;
+ struct sockaddr_storage cli_addr;
+ socklen_t clilen;
+
+ /* pollin means a client has connected to us then
+ *
+ * pollout is a hack on esp32 for background accepts signalling
+ * they completed
+ */
+
+ do {
+ struct lws *cwsi;
+
+ if (!(pollfd->revents & (LWS_POLLIN | LWS_POLLOUT)) ||
+ !(pollfd->events & LWS_POLLIN))
+ break;
+
+#if defined(LWS_WITH_TLS)
+ /*
+ * can we really accept it, with regards to SSL limit?
+ * another vhost may also have had POLLIN on his
+ * listener this round and used it up already
+ */
+ if (wsi->vhost->tls.use_ssl &&
+ context->simultaneous_ssl_restriction &&
+ context->simultaneous_ssl ==
+ context->simultaneous_ssl_restriction)
+ /*
+ * no... ignore it, he won't come again until
+ * we are below the simultaneous_ssl_restriction
+ * limit and POLLIN is enabled on him again
+ */
+ break;
+#endif
+ /* listen socket got an unencrypted connection... */
+
+ clilen = sizeof(cli_addr);
+ lws_latency_pre(context, wsi);
+
+ /*
+ * We cannot identify the peer who is in the listen
+ * socket connect queue before we accept it; even if
+ * we could, not accepting it due to PEER_LIMITS would
+ * block the connect queue for other legit peers.
+ */
+
+ accept_fd = accept((int)pollfd->fd,
+ (struct sockaddr *)&cli_addr, &clilen);
+ lws_latency(context, wsi, "listener accept",
+ (int)accept_fd, accept_fd != LWS_SOCK_INVALID);
+ if (accept_fd == LWS_SOCK_INVALID) {
+ if (LWS_ERRNO == LWS_EAGAIN ||
+ LWS_ERRNO == LWS_EWOULDBLOCK) {
+ break;
+ }
+ lwsl_err("ERROR on accept: %s\n",
+ strerror(LWS_ERRNO));
+ break;
+ }
+
+ lws_plat_set_socket_options(wsi->vhost, accept_fd);
+
+#if defined(LWS_WITH_IPV6)
+ lwsl_debug("accepted new conn port %u on fd=%d\n",
+ ((cli_addr.ss_family == AF_INET6) ?
+ ntohs(((struct sockaddr_in6 *) &cli_addr)->sin6_port) :
+ ntohs(((struct sockaddr_in *) &cli_addr)->sin_port)),
+ accept_fd);
+#else
+ lwsl_debug("accepted new conn port %u on fd=%d\n",
+ ntohs(((struct sockaddr_in *) &cli_addr)->sin_port),
+ accept_fd);
+#endif
+
+ /*
+ * look at who we connected to and give user code a
+ * chance to reject based on client IP. There's no
+ * protocol selected yet so we issue this to
+ * protocols[0]
+ */
+ if ((wsi->vhost->protocols[0].callback)(wsi,
+ LWS_CALLBACK_FILTER_NETWORK_CONNECTION,
+ NULL,
+ (void *)(lws_intptr_t)accept_fd, 0)) {
+ lwsl_debug("Callback denied net connection\n");
+ compatible_close(accept_fd);
+ break;
+ }
+
+ if (!(wsi->vhost->options & LWS_SERVER_OPTION_ONLY_RAW))
+ opts |= LWS_ADOPT_HTTP;
+ else
+ opts = LWS_ADOPT_SOCKET;
+
+ fd.sockfd = accept_fd;
+ cwsi = lws_adopt_descriptor_vhost(wsi->vhost, opts, fd,
+ NULL, NULL);
+ if (!cwsi)
+ /* already closed cleanly as necessary */
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+
+ if (lws_server_socket_service_ssl(cwsi, accept_fd)) {
+ lws_close_free_wsi(cwsi, LWS_CLOSE_STATUS_NOSTATUS,
+ "listen svc fail");
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+ }
+
+ lwsl_info("%s: new wsi %p: wsistate 0x%x, role_ops %s\n",
+ __func__, cwsi, cwsi->wsistate, cwsi->role_ops->name);
+
+ } while (pt->fds_count < context->fd_limit_per_thread - 1 &&
+ wsi->position_in_fds_table != LWS_NO_FDS_POS &&
+ lws_poll_listen_fd(&pt->fds[wsi->position_in_fds_table]) > 0);
+
+ return LWS_HPI_RET_HANDLED;
+}
+
+int rops_handle_POLLOUT_listen(struct lws *wsi)
+{
+ return LWS_HP_RET_USER_SERVICE;
+}
+
+struct lws_role_ops role_ops_listen = {
+ /* role name */ "listen",
+ /* alpn id */ NULL,
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ NULL,
+ /* destroy_vhost */ NULL,
+ /* periodic_checks */ NULL,
+ /* service_flag_pending */ NULL,
+ /* handle_POLLIN */ rops_handle_POLLIN_listen,
+ /* handle_POLLOUT */ rops_handle_POLLOUT_listen,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ NULL,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ NULL,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ NULL,
+ /* close_via_role_protocol */ NULL,
+ /* close_role */ NULL,
+ /* close_kill_connection */ NULL,
+ /* destroy_role */ NULL,
+ /* writeable cb clnt, srv */ { 0, 0 },
+ /* close cb clnt, srv */ { 0, 0 },
+ /* file_handle */ 0,
+};
diff --git a/thirdparty/libwebsockets/roles/pipe/ops-pipe.c b/thirdparty/libwebsockets/roles/pipe/ops-pipe.c
new file mode 100644
index 0000000000..b9348d58d7
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/pipe/ops-pipe.c
@@ -0,0 +1,81 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+static int
+rops_handle_POLLIN_pipe(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
+{
+#if !defined(WIN32) && !defined(_WIN32)
+ char s[100];
+ int n;
+
+ /*
+ * discard the byte(s) that signaled us
+ * We really don't care about the number of bytes, but coverity
+ * thinks we should.
+ */
+ n = read(wsi->desc.sockfd, s, sizeof(s));
+ (void)n;
+ if (n < 0)
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+#endif
+ /*
+ * the poll() wait, or the event loop for libuv etc is a
+ * process-wide resource that we interrupted. So let every
+ * protocol that may be interested in the pipe event know that
+ * it happened.
+ */
+ if (lws_broadcast(wsi->context, LWS_CALLBACK_EVENT_WAIT_CANCELLED,
+ NULL, 0)) {
+ lwsl_info("closed in event cancel\n");
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ return LWS_HPI_RET_HANDLED;
+}
+
+struct lws_role_ops role_ops_pipe = {
+ /* role name */ "pipe",
+ /* alpn id */ NULL,
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ NULL,
+ /* destroy_vhost */ NULL,
+ /* periodic_checks */ NULL,
+ /* service_flag_pending */ NULL,
+ /* handle_POLLIN */ rops_handle_POLLIN_pipe,
+ /* handle_POLLOUT */ NULL,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ NULL,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ NULL,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ NULL,
+ /* close_via_role_protocol */ NULL,
+ /* close_role */ NULL,
+ /* close_kill_connection */ NULL,
+ /* destroy_role */ NULL,
+ /* writeable cb clnt, srv */ { 0, 0 },
+ /* close cb clnt, srv */ { 0, 0 },
+ /* file_handle */ 1,
+};
diff --git a/thirdparty/libwebsockets/roles/private.h b/thirdparty/libwebsockets/roles/private.h
new file mode 100644
index 0000000000..ae4278b5d3
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/private.h
@@ -0,0 +1,282 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h
+ */
+
+typedef uint32_t lws_wsi_state_t;
+
+/*
+ * The wsi->role_ops pointer decides almost everything about what role the wsi
+ * will play, h2, raw, ws, etc.
+ *
+ * However there are a few additional flags needed that vary, such as if the
+ * role is a client or server side, if it has that concept. And the connection
+ * fulfilling the role, has a separate dynamic state.
+ *
+ * 31 16 15 0
+ * [ role flags ] [ state ]
+ *
+ * The role flags part is generally invariant for the lifetime of the wsi,
+ * although it can change if the connection role itself does, eg, if the
+ * connection upgrades from H1 -> WS1 the role flags may be changed at that
+ * point.
+ *
+ * The state part reflects the dynamic connection state, and the states are
+ * reused between roles.
+ *
+ * None of the internal role or state representations are made available outside
+ * of lws internals. Even for lws internals, if you add stuff here, please keep
+ * the constants inside this header only by adding necessary helpers here and
+ * use the helpers in the actual code. This is to ease any future refactors.
+ *
+ * Notice LWSIFR_ENCAP means we have a parent wsi that actually carries our
+ * data as a stream inside a different protocol.
+ */
+
+#define _RS 16
+
+#define LWSIFR_CLIENT (0x1000 << _RS) /* client side */
+#define LWSIFR_SERVER (0x2000 << _RS) /* server side */
+
+#define LWSIFR_P_ENCAP_H2 (0x0100 << _RS) /* we are encapsulated by h2 */
+
+enum lwsi_role {
+ LWSI_ROLE_MASK = (0xffff << _RS),
+ LWSI_ROLE_ENCAP_MASK = (0x0f00 << _RS),
+};
+
+#define lwsi_role(wsi) (wsi->wsistate & LWSI_ROLE_MASK)
+#if !defined (_DEBUG)
+#define lwsi_set_role(wsi, role) wsi->wsistate = \
+ (wsi->wsistate & (~LWSI_ROLE_MASK)) | role
+#else
+void lwsi_set_role(struct lws *wsi, lws_wsi_state_t role);
+#endif
+
+#define lwsi_role_client(wsi) (!!(wsi->wsistate & LWSIFR_CLIENT))
+#define lwsi_role_server(wsi) (!!(wsi->wsistate & LWSIFR_SERVER))
+#define lwsi_role_h2_ENCAPSULATION(wsi) \
+ ((wsi->wsistate & LWSI_ROLE_ENCAP_MASK) == LWSIFR_P_ENCAP_H2)
+
+/* Pollout wants a callback in this state */
+#define LWSIFS_POCB (0x100)
+/* Before any protocol connection was established */
+#define LWSIFS_NOT_EST (0x200)
+
+enum lwsi_state {
+
+ /* Phase 1: pre-transport */
+
+ LRS_UNCONNECTED = LWSIFS_NOT_EST | 0,
+ LRS_WAITING_CONNECT = LWSIFS_NOT_EST | 1,
+
+ /* Phase 2: establishing intermediaries on top of transport */
+
+ LRS_WAITING_PROXY_REPLY = LWSIFS_NOT_EST | 2,
+ LRS_WAITING_SSL = LWSIFS_NOT_EST | 3,
+ LRS_WAITING_SOCKS_GREETING_REPLY = LWSIFS_NOT_EST | 4,
+ LRS_WAITING_SOCKS_CONNECT_REPLY = LWSIFS_NOT_EST | 5,
+ LRS_WAITING_SOCKS_AUTH_REPLY = LWSIFS_NOT_EST | 6,
+
+ /* Phase 3: establishing tls tunnel */
+
+ LRS_SSL_INIT = LWSIFS_NOT_EST | 7,
+ LRS_SSL_ACK_PENDING = LWSIFS_NOT_EST | 8,
+ LRS_PRE_WS_SERVING_ACCEPT = LWSIFS_NOT_EST | 9,
+
+ /* Phase 4: connected */
+
+ LRS_WAITING_SERVER_REPLY = LWSIFS_NOT_EST | 10,
+ LRS_H2_AWAIT_PREFACE = LWSIFS_NOT_EST | 11,
+ LRS_H2_AWAIT_SETTINGS = LWSIFS_NOT_EST |
+ LWSIFS_POCB | 12,
+
+ /* Phase 5: protocol logically established */
+
+ LRS_H2_CLIENT_SEND_SETTINGS = LWSIFS_POCB | 13,
+ LRS_H2_WAITING_TO_SEND_HEADERS = LWSIFS_POCB | 14,
+ LRS_DEFERRING_ACTION = LWSIFS_POCB | 15,
+ LRS_IDLING = 16,
+ LRS_H1C_ISSUE_HANDSHAKE = 17,
+ LRS_H1C_ISSUE_HANDSHAKE2 = 18,
+ LRS_ISSUE_HTTP_BODY = 19,
+ LRS_ISSUING_FILE = 20,
+ LRS_HEADERS = 21,
+ LRS_BODY = 22,
+ LRS_ESTABLISHED = LWSIFS_POCB | 23,
+ /* we are established, but we have embarked on serving a single
+ * transaction. Other transaction input may be pending, but we will
+ * not service it while we are busy dealing with the current
+ * transaction.
+ *
+ * When we complete the current transaction, we would reset our state
+ * back to ESTABLISHED and start to process the next transaction.
+ */
+ LRS_DOING_TRANSACTION = LWSIFS_POCB | 24,
+
+ /* Phase 6: finishing */
+
+ LRS_WAITING_TO_SEND_CLOSE = LWSIFS_POCB | 25,
+ LRS_RETURNED_CLOSE = LWSIFS_POCB | 26,
+ LRS_AWAITING_CLOSE_ACK = LWSIFS_POCB | 27,
+ LRS_FLUSHING_BEFORE_CLOSE = LWSIFS_POCB | 28,
+ LRS_SHUTDOWN = 29,
+
+ /* Phase 7: dead */
+
+ LRS_DEAD_SOCKET = 30,
+
+ LRS_MASK = 0xffff
+};
+
+#define lwsi_state(wsi) ((enum lwsi_state)(wsi->wsistate & LRS_MASK))
+#define lwsi_state_PRE_CLOSE(wsi) ((enum lwsi_state)(wsi->wsistate_pre_close & LRS_MASK))
+#define lwsi_state_est(wsi) (!(wsi->wsistate & LWSIFS_NOT_EST))
+#define lwsi_state_est_PRE_CLOSE(wsi) (!(wsi->wsistate_pre_close & LWSIFS_NOT_EST))
+#define lwsi_state_can_handle_POLLOUT(wsi) (wsi->wsistate & LWSIFS_POCB)
+#if !defined (_DEBUG)
+#define lwsi_set_state(wsi, lrs) wsi->wsistate = \
+ (wsi->wsistate & (~LRS_MASK)) | lrs
+#else
+void lwsi_set_state(struct lws *wsi, lws_wsi_state_t lrs);
+#endif
+
+/*
+ * internal role-specific ops
+ */
+struct lws_context_per_thread;
+struct lws_role_ops {
+ const char *name;
+ const char *alpn;
+ /*
+ * After http headers have parsed, this is the last chance for a role
+ * to upgrade the connection to something else using the headers.
+ * ws-over-h2 is upgraded from h2 like this.
+ */
+ int (*check_upgrades)(struct lws *wsi);
+ /* role-specific context init during context creation */
+ int (*init_context)(struct lws_context *context,
+ const struct lws_context_creation_info *info);
+ /* role-specific per-vhost init during vhost creation */
+ int (*init_vhost)(struct lws_vhost *vh,
+ const struct lws_context_creation_info *info);
+ /* role-specific per-vhost destructor during vhost destroy */
+ int (*destroy_vhost)(struct lws_vhost *vh);
+ /* generic 1Hz callback for the role itself */
+ int (*periodic_checks)(struct lws_context *context, int tsi,
+ time_t now);
+ /* chance for the role to force POLLIN without network activity */
+ int (*service_flag_pending)(struct lws_context *context, int tsi);
+ /* an fd using this role has POLLIN signalled */
+ int (*handle_POLLIN)(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd);
+ /* an fd using the role wanted a POLLOUT callback and now has it */
+ int (*handle_POLLOUT)(struct lws *wsi);
+ /* perform user pollout */
+ int (*perform_user_POLLOUT)(struct lws *wsi);
+ /* do effective callback on writeable */
+ int (*callback_on_writable)(struct lws *wsi);
+ /* connection-specific tx credit in bytes */
+ lws_fileofs_t (*tx_credit)(struct lws *wsi);
+ /* role-specific write formatting */
+ int (*write_role_protocol)(struct lws *wsi, unsigned char *buf,
+ size_t len, enum lws_write_protocol *wp);
+
+ /* get encapsulation parent */
+ struct lws * (*encapsulation_parent)(struct lws *wsi);
+
+ /* role-specific destructor */
+ int (*alpn_negotiated)(struct lws *wsi, const char *alpn);
+
+ /* chance for the role to handle close in the protocol */
+ int (*close_via_role_protocol)(struct lws *wsi,
+ enum lws_close_status reason);
+ /* role-specific close processing */
+ int (*close_role)(struct lws_context_per_thread *pt, struct lws *wsi);
+ /* role-specific connection close processing */
+ int (*close_kill_connection)(struct lws *wsi,
+ enum lws_close_status reason);
+ /* role-specific destructor */
+ int (*destroy_role)(struct lws *wsi);
+
+ /*
+ * the callback reasons for WRITEABLE for client, server
+ * (just client applies if no concept of client or server)
+ */
+ uint16_t writeable_cb[2];
+ /*
+ * the callback reasons for CLOSE for client, server
+ * (just client applies if no concept of client or server)
+ */
+ uint16_t close_cb[2];
+
+ unsigned int file_handle:1; /* role operates on files not sockets */
+};
+
+/* core roles */
+extern struct lws_role_ops role_ops_raw_skt, role_ops_raw_file, role_ops_listen,
+ role_ops_pipe;
+
+/* bring in role private declarations */
+
+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
+ #include "roles/http/private.h"
+#else
+ #define lwsi_role_http(wsi) (0)
+#endif
+
+#if defined(LWS_ROLE_H1)
+ #include "roles/h1/private.h"
+#else
+ #define lwsi_role_h1(wsi) (0)
+#endif
+
+#if defined(LWS_ROLE_H2)
+ #include "roles/h2/private.h"
+#else
+ #define lwsi_role_h2(wsi) (0)
+#endif
+
+#if defined(LWS_ROLE_WS)
+ #include "roles/ws/private.h"
+#else
+ #define lwsi_role_ws(wsi) (0)
+#endif
+
+#if defined(LWS_ROLE_CGI)
+ #include "roles/cgi/private.h"
+#else
+ #define lwsi_role_cgi(wsi) (0)
+#endif
+
+enum {
+ LWS_HP_RET_BAIL_OK,
+ LWS_HP_RET_BAIL_DIE,
+ LWS_HP_RET_USER_SERVICE,
+
+ LWS_HPI_RET_WSI_ALREADY_DIED, /* we closed it */
+ LWS_HPI_RET_HANDLED, /* no probs */
+ LWS_HPI_RET_PLEASE_CLOSE_ME, /* close it for us */
+
+ LWS_UPG_RET_DONE,
+ LWS_UPG_RET_CONTINUE,
+ LWS_UPG_RET_BAIL
+};
diff --git a/thirdparty/libwebsockets/roles/raw/ops-raw.c b/thirdparty/libwebsockets/roles/raw/ops-raw.c
new file mode 100644
index 0000000000..68b52bded6
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/raw/ops-raw.c
@@ -0,0 +1,223 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+static int
+rops_handle_POLLIN_raw_skt(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
+{
+ struct lws_tokens ebuf;
+ int n, buffered;
+
+ /* pending truncated sends have uber priority */
+
+ if (wsi->trunc_len) {
+ if (!(pollfd->revents & LWS_POLLOUT))
+ return LWS_HPI_RET_HANDLED;
+
+ if (lws_issue_raw(wsi, wsi->trunc_alloc + wsi->trunc_offset,
+ wsi->trunc_len) < 0)
+ goto fail;
+ /*
+ * we can't afford to allow input processing to send
+ * something new, so spin around he event loop until
+ * he doesn't have any partials
+ */
+ return LWS_HPI_RET_HANDLED;
+ }
+
+ if ((pollfd->revents & pollfd->events & LWS_POLLIN) &&
+ /* any tunnel has to have been established... */
+ lwsi_state(wsi) != LRS_SSL_ACK_PENDING &&
+ !(wsi->favoured_pollin &&
+ (pollfd->revents & pollfd->events & LWS_POLLOUT))) {
+
+ buffered = lws_buflist_aware_read(pt, wsi, &ebuf);
+ switch (ebuf.len) {
+ case 0:
+ lwsl_info("%s: read 0 len\n", __func__);
+ wsi->seen_zero_length_recv = 1;
+ lws_change_pollfd(wsi, LWS_POLLIN, 0);
+
+ /*
+ * we need to go to fail here, since it's the only
+ * chance we get to understand that the socket has
+ * closed
+ */
+ // goto try_pollout;
+ goto fail;
+
+ case LWS_SSL_CAPABLE_ERROR:
+ goto fail;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ goto try_pollout;
+ }
+
+ n = user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_RAW_RX,
+ wsi->user_space, ebuf.token,
+ ebuf.len);
+ if (n < 0) {
+ lwsl_info("LWS_CALLBACK_RAW_RX_fail\n");
+ goto fail;
+ }
+
+ if (lws_buflist_aware_consume(wsi, &ebuf, ebuf.len, buffered))
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ } else
+ if (wsi->favoured_pollin &&
+ (pollfd->revents & pollfd->events & LWS_POLLOUT))
+ /* we balanced the last favouring of pollin */
+ wsi->favoured_pollin = 0;
+
+try_pollout:
+
+ /* this handles POLLOUT for http serving fragments */
+
+ if (!(pollfd->revents & LWS_POLLOUT))
+ return LWS_HPI_RET_HANDLED;
+
+ /* one shot */
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_notice("%s a\n", __func__);
+ goto fail;
+ }
+
+ /* clear back-to-back write detection */
+ wsi->could_have_pending = 0;
+
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_WRITEABLE_CB, 1);
+#if defined(LWS_WITH_STATS)
+ if (wsi->active_writable_req_us) {
+ uint64_t ul = time_in_microseconds() -
+ wsi->active_writable_req_us;
+
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_MS_WRITABLE_DELAY, ul);
+ lws_stats_atomic_max(wsi->context, pt,
+ LWSSTATS_MS_WORST_WRITABLE_DELAY, ul);
+ wsi->active_writable_req_us = 0;
+ }
+#endif
+ n = user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_RAW_WRITEABLE,
+ wsi->user_space, NULL, 0);
+ if (n < 0) {
+ lwsl_info("writeable_fail\n");
+ goto fail;
+ }
+
+ return LWS_HPI_RET_HANDLED;
+
+fail:
+ lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "raw svc fail");
+
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+}
+
+
+static int
+rops_handle_POLLIN_raw_file(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
+{
+ int n;
+
+ if (pollfd->revents & LWS_POLLOUT) {
+ n = lws_callback_as_writeable(wsi);
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_info("failed at set pollfd\n");
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+ }
+ if (n)
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ if (pollfd->revents & LWS_POLLIN) {
+ if (user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_RAW_RX_FILE,
+ wsi->user_space, NULL, 0)) {
+ lwsl_debug("raw rx callback closed it\n");
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+ }
+
+ if (pollfd->revents & LWS_POLLHUP)
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+
+ return LWS_HPI_RET_HANDLED;
+}
+
+
+struct lws_role_ops role_ops_raw_skt = {
+ /* role name */ "raw-skt",
+ /* alpn id */ NULL,
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ NULL,
+ /* destroy_vhost */ NULL,
+ /* periodic_checks */ NULL,
+ /* service_flag_pending */ NULL,
+ /* handle_POLLIN */ rops_handle_POLLIN_raw_skt,
+ /* handle_POLLOUT */ NULL,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ NULL,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ NULL,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ NULL,
+ /* close_via_role_protocol */ NULL,
+ /* close_role */ NULL,
+ /* close_kill_connection */ NULL,
+ /* destroy_role */ NULL,
+ /* writeable cb clnt, srv */ { LWS_CALLBACK_RAW_WRITEABLE, 0 },
+ /* close cb clnt, srv */ { LWS_CALLBACK_RAW_CLOSE, 0 },
+ /* file_handle */ 0,
+};
+
+
+
+struct lws_role_ops role_ops_raw_file = {
+ /* role name */ "raw-file",
+ /* alpn id */ NULL,
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ NULL,
+ /* destroy_vhost */ NULL,
+ /* periodic_checks */ NULL,
+ /* service_flag_pending */ NULL,
+ /* handle_POLLIN */ rops_handle_POLLIN_raw_file,
+ /* handle_POLLOUT */ NULL,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ NULL,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ NULL,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ NULL,
+ /* close_via_role_protocol */ NULL,
+ /* close_role */ NULL,
+ /* close_kill_connection */ NULL,
+ /* destroy_role */ NULL,
+ /* writeable cb clnt, srv */ { LWS_CALLBACK_RAW_WRITEABLE_FILE, 0 },
+ /* close cb clnt, srv */ { LWS_CALLBACK_RAW_CLOSE_FILE, 0 },
+ /* file_handle */ 1,
+};
diff --git a/thirdparty/lws/client/client-parser.c b/thirdparty/libwebsockets/roles/ws/client-parser-ws.c
index 0e42dac362..aa561ce034 100644
--- a/thirdparty/lws/client/client-parser.c
+++ b/thirdparty/libwebsockets/roles/ws/client-parser-ws.c
@@ -19,31 +19,38 @@
* MA 02110-1301 USA
*/
-#include "private-libwebsockets.h"
+#include "core/private.h"
/*
- * parsers.c: lws_rx_sm() needs to be roughly kept in
+ * parsers.c: lws_ws_rx_sm() needs to be roughly kept in
* sync with changes here, esp related to ext draining
*/
-int lws_client_rx_sm(struct lws *wsi, unsigned char c)
+int lws_ws_client_rx_sm(struct lws *wsi, unsigned char c)
{
int callback_action = LWS_CALLBACK_CLIENT_RECEIVE;
- int handled, n, m, rx_draining_ext = 0;
+ int handled, m;
unsigned short close_code;
- struct lws_tokens eff_buf;
+ struct lws_tokens ebuf;
unsigned char *pp;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ int rx_draining_ext = 0, n;
+#endif
+
+ ebuf.token = NULL;
+ ebuf.len = 0;
- if (wsi->u.ws.rx_draining_ext) {
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext) {
assert(!c);
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
+
lws_remove_wsi_from_draining_ext_list(wsi);
rx_draining_ext = 1;
lwsl_debug("%s: doing draining flow\n", __func__);
goto drain_extension;
}
+#endif
if (wsi->socket_is_permanently_unusable)
return -1;
@@ -51,35 +58,38 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
switch (wsi->lws_rx_parse_state) {
case LWS_RXPS_NEW:
/* control frames (PING) may interrupt checkable sequences */
- wsi->u.ws.defeat_check_utf8 = 0;
+ wsi->ws->defeat_check_utf8 = 0;
- switch (wsi->ietf_spec_revision) {
+ switch (wsi->ws->ietf_spec_revision) {
case 13:
- wsi->u.ws.opcode = c & 0xf;
+ wsi->ws->opcode = c & 0xf;
/* revisit if an extension wants them... */
- switch (wsi->u.ws.opcode) {
+ switch (wsi->ws->opcode) {
case LWSWSOPC_TEXT_FRAME:
- wsi->u.ws.rsv_first_msg = (c & 0x70);
- wsi->u.ws.continuation_possible = 1;
- wsi->u.ws.check_utf8 = lws_check_opt(
+ wsi->ws->rsv_first_msg = (c & 0x70);
+ wsi->ws->continuation_possible = 1;
+ wsi->ws->check_utf8 = lws_check_opt(
wsi->context->options,
LWS_SERVER_OPTION_VALIDATE_UTF8);
- wsi->u.ws.utf8 = 0;
+ wsi->ws->utf8 = 0;
+ wsi->ws->first_fragment = 1;
break;
case LWSWSOPC_BINARY_FRAME:
- wsi->u.ws.rsv_first_msg = (c & 0x70);
- wsi->u.ws.check_utf8 = 0;
- wsi->u.ws.continuation_possible = 1;
+ wsi->ws->rsv_first_msg = (c & 0x70);
+ wsi->ws->check_utf8 = 0;
+ wsi->ws->continuation_possible = 1;
+ wsi->ws->first_fragment = 1;
break;
case LWSWSOPC_CONTINUATION:
- if (!wsi->u.ws.continuation_possible) {
+ if (!wsi->ws->continuation_possible) {
lwsl_info("disordered continuation\n");
return -1;
}
+ wsi->ws->first_fragment = 0;
break;
case LWSWSOPC_CLOSE:
- wsi->u.ws.check_utf8 = 0;
- wsi->u.ws.utf8 = 0;
+ wsi->ws->check_utf8 = 0;
+ wsi->ws->utf8 = 0;
break;
case 3:
case 4:
@@ -94,45 +104,45 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
lwsl_info("illegal opcode\n");
return -1;
default:
- wsi->u.ws.defeat_check_utf8 = 1;
+ wsi->ws->defeat_check_utf8 = 1;
break;
}
- wsi->u.ws.rsv = (c & 0x70);
+ wsi->ws->rsv = (c & 0x70);
/* revisit if an extension wants them... */
if (
-#ifndef LWS_NO_EXTENSIONS
- !wsi->count_act_ext &&
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ !wsi->ws->count_act_ext &&
#endif
- wsi->u.ws.rsv) {
+ wsi->ws->rsv) {
lwsl_info("illegal rsv bits set\n");
return -1;
}
- wsi->u.ws.final = !!((c >> 7) & 1);
+ wsi->ws->final = !!((c >> 7) & 1);
lwsl_ext("%s: This RX frame Final %d\n", __func__,
- wsi->u.ws.final);
+ wsi->ws->final);
- if (wsi->u.ws.owed_a_fin &&
- (wsi->u.ws.opcode == LWSWSOPC_TEXT_FRAME ||
- wsi->u.ws.opcode == LWSWSOPC_BINARY_FRAME)) {
+ if (wsi->ws->owed_a_fin &&
+ (wsi->ws->opcode == LWSWSOPC_TEXT_FRAME ||
+ wsi->ws->opcode == LWSWSOPC_BINARY_FRAME)) {
lwsl_info("hey you owed us a FIN\n");
return -1;
}
- if ((!(wsi->u.ws.opcode & 8)) && wsi->u.ws.final) {
- wsi->u.ws.continuation_possible = 0;
- wsi->u.ws.owed_a_fin = 0;
+ if ((!(wsi->ws->opcode & 8)) && wsi->ws->final) {
+ wsi->ws->continuation_possible = 0;
+ wsi->ws->owed_a_fin = 0;
}
- if ((wsi->u.ws.opcode & 8) && !wsi->u.ws.final) {
+ if ((wsi->ws->opcode & 8) && !wsi->ws->final) {
lwsl_info("control msg can't be fragmented\n");
return -1;
}
- if (!wsi->u.ws.final)
- wsi->u.ws.owed_a_fin = 1;
+ if (!wsi->ws->final)
+ wsi->ws->owed_a_fin = 1;
- switch (wsi->u.ws.opcode) {
+ switch (wsi->ws->opcode) {
case LWSWSOPC_TEXT_FRAME:
case LWSWSOPC_BINARY_FRAME:
- wsi->u.ws.frame_is_binary = wsi->u.ws.opcode ==
+ wsi->ws->frame_is_binary = wsi->ws->opcode ==
LWSWSOPC_BINARY_FRAME;
break;
}
@@ -141,38 +151,38 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
default:
lwsl_err("unknown spec version %02d\n",
- wsi->ietf_spec_revision);
+ wsi->ws->ietf_spec_revision);
break;
}
break;
case LWS_RXPS_04_FRAME_HDR_LEN:
- wsi->u.ws.this_frame_masked = !!(c & 0x80);
+ wsi->ws->this_frame_masked = !!(c & 0x80);
switch (c & 0x7f) {
case 126:
/* control frames are not allowed to have big lengths */
- if (wsi->u.ws.opcode & 8)
+ if (wsi->ws->opcode & 8)
goto illegal_ctl_length;
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_2;
break;
case 127:
/* control frames are not allowed to have big lengths */
- if (wsi->u.ws.opcode & 8)
+ if (wsi->ws->opcode & 8)
goto illegal_ctl_length;
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_8;
break;
default:
- wsi->u.ws.rx_packet_length = c;
- if (wsi->u.ws.this_frame_masked)
+ wsi->ws->rx_packet_length = c & 0x7f;
+ if (wsi->ws->this_frame_masked)
wsi->lws_rx_parse_state =
LWS_RXPS_07_COLLECT_FRAME_KEY_1;
else {
- if (c)
+ if (wsi->ws->rx_packet_length) {
wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
- else {
+ LWS_RXPS_WS_FRAME_PAYLOAD;
+ } else {
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
}
@@ -182,18 +192,18 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
break;
case LWS_RXPS_04_FRAME_HDR_LEN16_2:
- wsi->u.ws.rx_packet_length = c << 8;
+ wsi->ws->rx_packet_length = c << 8;
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_1;
break;
case LWS_RXPS_04_FRAME_HDR_LEN16_1:
- wsi->u.ws.rx_packet_length |= c;
- if (wsi->u.ws.this_frame_masked)
+ wsi->ws->rx_packet_length |= c;
+ if (wsi->ws->this_frame_masked)
wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_1;
else {
- if (wsi->u.ws.rx_packet_length)
+ if (wsi->ws->rx_packet_length)
wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
+ LWS_RXPS_WS_FRAME_PAYLOAD;
else {
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
@@ -208,58 +218,58 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
return -1;
}
#if defined __LP64__
- wsi->u.ws.rx_packet_length = ((size_t)c) << 56;
+ wsi->ws->rx_packet_length = ((size_t)c) << 56;
#else
- wsi->u.ws.rx_packet_length = 0;
+ wsi->ws->rx_packet_length = 0;
#endif
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_7:
#if defined __LP64__
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 48;
+ wsi->ws->rx_packet_length |= ((size_t)c) << 48;
#endif
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_6:
#if defined __LP64__
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 40;
+ wsi->ws->rx_packet_length |= ((size_t)c) << 40;
#endif
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_5:
#if defined __LP64__
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 32;
+ wsi->ws->rx_packet_length |= ((size_t)c) << 32;
#endif
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_4:
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 24;
+ wsi->ws->rx_packet_length |= ((size_t)c) << 24;
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_3;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_3:
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 16;
+ wsi->ws->rx_packet_length |= ((size_t)c) << 16;
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_2;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_2:
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 8;
+ wsi->ws->rx_packet_length |= ((size_t)c) << 8;
wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_1;
break;
case LWS_RXPS_04_FRAME_HDR_LEN64_1:
- wsi->u.ws.rx_packet_length |= (size_t)c;
- if (wsi->u.ws.this_frame_masked)
+ wsi->ws->rx_packet_length |= (size_t)c;
+ if (wsi->ws->this_frame_masked)
wsi->lws_rx_parse_state =
LWS_RXPS_07_COLLECT_FRAME_KEY_1;
else {
- if (wsi->u.ws.rx_packet_length)
+ if (wsi->ws->rx_packet_length)
wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
+ LWS_RXPS_WS_FRAME_PAYLOAD;
else {
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
@@ -268,53 +278,53 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
break;
case LWS_RXPS_07_COLLECT_FRAME_KEY_1:
- wsi->u.ws.mask[0] = c;
+ wsi->ws->mask[0] = c;
if (c)
- wsi->u.ws.all_zero_nonce = 0;
+ wsi->ws->all_zero_nonce = 0;
wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_2;
break;
case LWS_RXPS_07_COLLECT_FRAME_KEY_2:
- wsi->u.ws.mask[1] = c;
+ wsi->ws->mask[1] = c;
if (c)
- wsi->u.ws.all_zero_nonce = 0;
+ wsi->ws->all_zero_nonce = 0;
wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_3;
break;
case LWS_RXPS_07_COLLECT_FRAME_KEY_3:
- wsi->u.ws.mask[2] = c;
+ wsi->ws->mask[2] = c;
if (c)
- wsi->u.ws.all_zero_nonce = 0;
+ wsi->ws->all_zero_nonce = 0;
wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_4;
break;
case LWS_RXPS_07_COLLECT_FRAME_KEY_4:
- wsi->u.ws.mask[3] = c;
+ wsi->ws->mask[3] = c;
if (c)
- wsi->u.ws.all_zero_nonce = 0;
+ wsi->ws->all_zero_nonce = 0;
- if (wsi->u.ws.rx_packet_length)
+ if (wsi->ws->rx_packet_length)
wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
+ LWS_RXPS_WS_FRAME_PAYLOAD;
else {
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
}
break;
- case LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED:
-
- assert(wsi->u.ws.rx_ubuf);
+ case LWS_RXPS_WS_FRAME_PAYLOAD:
- if (wsi->u.ws.rx_draining_ext)
+ assert(wsi->ws->rx_ubuf);
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext)
goto drain_extension;
+#endif
+ if (wsi->ws->this_frame_masked && !wsi->ws->all_zero_nonce)
+ c ^= wsi->ws->mask[(wsi->ws->mask_idx++) & 3];
- if (wsi->u.ws.this_frame_masked && !wsi->u.ws.all_zero_nonce)
- c ^= wsi->u.ws.mask[(wsi->u.ws.mask_idx++) & 3];
-
- wsi->u.ws.rx_ubuf[LWS_PRE + (wsi->u.ws.rx_ubuf_head++)] = c;
+ wsi->ws->rx_ubuf[LWS_PRE + (wsi->ws->rx_ubuf_head++)] = c;
- if (--wsi->u.ws.rx_packet_length == 0) {
+ if (--wsi->ws->rx_packet_length == 0) {
/* spill because we have the whole frame */
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
goto spill;
@@ -325,11 +335,11 @@ int lws_client_rx_sm(struct lws *wsi, unsigned char c)
* supposed to default to context->pt_serv_buf_size
*/
if (!wsi->protocol->rx_buffer_size &&
- wsi->u.ws.rx_ubuf_head != wsi->context->pt_serv_buf_size)
+ wsi->ws->rx_ubuf_head != wsi->context->pt_serv_buf_size)
break;
if (wsi->protocol->rx_buffer_size &&
- wsi->u.ws.rx_ubuf_head != wsi->protocol->rx_buffer_size)
+ wsi->ws->rx_ubuf_head != wsi->protocol->rx_buffer_size)
break;
/* spill because we filled our rx buffer */
@@ -342,18 +352,18 @@ spill:
* layer? If so service it and hide it from the user callback
*/
- switch (wsi->u.ws.opcode) {
+ switch (wsi->ws->opcode) {
case LWSWSOPC_CLOSE:
- pp = (unsigned char *)&wsi->u.ws.rx_ubuf[LWS_PRE];
+ pp = (unsigned char *)&wsi->ws->rx_ubuf[LWS_PRE];
if (lws_check_opt(wsi->context->options,
LWS_SERVER_OPTION_VALIDATE_UTF8) &&
- wsi->u.ws.rx_ubuf_head > 2 &&
- lws_check_utf8(&wsi->u.ws.utf8, pp + 2,
- wsi->u.ws.rx_ubuf_head - 2))
+ wsi->ws->rx_ubuf_head > 2 &&
+ lws_check_utf8(&wsi->ws->utf8, pp + 2,
+ wsi->ws->rx_ubuf_head - 2))
goto utf8_fail;
- /* is this an acknowledgement of our close? */
- if (wsi->state == LWSS_AWAITING_CLOSE_ACK) {
+ /* is this an acknowledgment of our close? */
+ if (lwsi_state(wsi) == LRS_AWAITING_CLOSE_ACK) {
/*
* fine he has told us he is closing too, let's
* finish our close
@@ -363,8 +373,8 @@ spill:
}
lwsl_parser("client sees server close len = %d\n",
- wsi->u.ws.rx_ubuf_head);
- if (wsi->u.ws.rx_ubuf_head >= 2) {
+ wsi->ws->rx_ubuf_head);
+ if (wsi->ws->rx_ubuf_head >= 2) {
close_code = (pp[0] << 8) | pp[1];
if (close_code < 1000 ||
close_code == 1004 ||
@@ -384,39 +394,32 @@ spill:
wsi->protocol->callback, wsi,
LWS_CALLBACK_WS_PEER_INITIATED_CLOSE,
wsi->user_space, pp,
- wsi->u.ws.rx_ubuf_head))
+ wsi->ws->rx_ubuf_head))
return -1;
- if (lws_partial_buffered(wsi))
- /*
- * if we're in the middle of something,
- * we can't do a normal close response and
- * have to just close our end.
- */
- wsi->socket_is_permanently_unusable = 1;
- else
- /*
- * parrot the close packet payload back
- * we do not care about how it went, we are closing
- * immediately afterwards
- */
- lws_write(wsi, (unsigned char *)
- &wsi->u.ws.rx_ubuf[LWS_PRE],
- wsi->u.ws.rx_ubuf_head,
- LWS_WRITE_CLOSE);
- wsi->state = LWSS_RETURNED_CLOSE_ALREADY;
- /* close the connection */
- return -1;
+ memcpy(wsi->ws->ping_payload_buf + LWS_PRE, pp,
+ wsi->ws->rx_ubuf_head);
+ wsi->ws->close_in_ping_buffer_len = wsi->ws->rx_ubuf_head;
+
+ lwsl_info("%s: scheduling return close as ack\n", __func__);
+ __lws_change_pollfd(wsi, LWS_POLLIN, 0);
+ lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_SEND, 3);
+ wsi->waiting_to_send_close_frame = 1;
+ wsi->close_needs_ack = 0;
+ lwsi_set_state(wsi, LRS_WAITING_TO_SEND_CLOSE);
+ lws_callback_on_writable(wsi);
+ handled = 1;
+ break;
case LWSWSOPC_PING:
lwsl_info("received %d byte ping, sending pong\n",
- wsi->u.ws.rx_ubuf_head);
+ wsi->ws->rx_ubuf_head);
/* he set a close reason on this guy, ignore PING */
- if (wsi->u.ws.close_in_ping_buffer_len)
+ if (wsi->ws->close_in_ping_buffer_len)
goto ping_drop;
- if (wsi->u.ws.ping_pending_flag) {
+ if (wsi->ws->ping_pending_flag) {
/*
* there is already a pending ping payload
* we should just log and drop
@@ -426,30 +429,30 @@ spill:
}
/* control packets can only be < 128 bytes long */
- if (wsi->u.ws.rx_ubuf_head > 128 - 3) {
+ if (wsi->ws->rx_ubuf_head > 128 - 3) {
lwsl_parser("DROP PING payload too large\n");
goto ping_drop;
}
/* stash the pong payload */
- memcpy(wsi->u.ws.ping_payload_buf + LWS_PRE,
- &wsi->u.ws.rx_ubuf[LWS_PRE],
- wsi->u.ws.rx_ubuf_head);
+ memcpy(wsi->ws->ping_payload_buf + LWS_PRE,
+ &wsi->ws->rx_ubuf[LWS_PRE],
+ wsi->ws->rx_ubuf_head);
- wsi->u.ws.ping_payload_len = wsi->u.ws.rx_ubuf_head;
- wsi->u.ws.ping_pending_flag = 1;
+ wsi->ws->ping_payload_len = wsi->ws->rx_ubuf_head;
+ wsi->ws->ping_pending_flag = 1;
/* get it sent as soon as possible */
lws_callback_on_writable(wsi);
ping_drop:
- wsi->u.ws.rx_ubuf_head = 0;
+ wsi->ws->rx_ubuf_head = 0;
handled = 1;
break;
case LWSWSOPC_PONG:
lwsl_info("client receied pong\n");
- lwsl_hexdump(&wsi->u.ws.rx_ubuf[LWS_PRE],
- wsi->u.ws.rx_ubuf_head);
+ lwsl_hexdump(&wsi->ws->rx_ubuf[LWS_PRE],
+ wsi->ws->rx_ubuf_head);
if (wsi->pending_timeout ==
PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG) {
@@ -467,30 +470,11 @@ ping_drop:
break;
default:
+ /* not handled or failed */
+ lwsl_ext("Unhandled ext opc 0x%x\n", wsi->ws->opcode);
+ wsi->ws->rx_ubuf_head = 0;
- lwsl_parser("Reserved opc 0x%2X\n", wsi->u.ws.opcode);
-
- /*
- * It's something special we can't understand here.
- * Pass the payload up to the extension's parsing
- * state machine.
- */
-
- eff_buf.token = &wsi->u.ws.rx_ubuf[LWS_PRE];
- eff_buf.token_len = wsi->u.ws.rx_ubuf_head;
-
- if (lws_ext_cb_active(wsi,
- LWS_EXT_CB_EXTENDED_PAYLOAD_RX,
- &eff_buf, 0) <= 0) {
- /* not handled or failed */
- lwsl_ext("Unhandled ext opc 0x%x\n",
- wsi->u.ws.opcode);
- wsi->u.ws.rx_ubuf_head = 0;
-
- return 0;
- }
- handled = 1;
- break;
+ return -1;
}
/*
@@ -501,53 +485,71 @@ ping_drop:
if (handled)
goto already_done;
- eff_buf.token = &wsi->u.ws.rx_ubuf[LWS_PRE];
- eff_buf.token_len = wsi->u.ws.rx_ubuf_head;
+ ebuf.token = &wsi->ws->rx_ubuf[LWS_PRE];
+ ebuf.len = wsi->ws->rx_ubuf_head;
- if (wsi->u.ws.opcode == LWSWSOPC_PONG && !eff_buf.token_len)
+ if (wsi->ws->opcode == LWSWSOPC_PONG && !ebuf.len)
goto already_done;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
drain_extension:
- lwsl_ext("%s: passing %d to ext\n", __func__, eff_buf.token_len);
+ lwsl_ext("%s: passing %d to ext\n", __func__, ebuf.len);
- n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &eff_buf, 0);
+ n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &ebuf, 0);
lwsl_ext("Ext RX returned %d\n", n);
if (n < 0) {
wsi->socket_is_permanently_unusable = 1;
return -1;
}
+#endif
+ lwsl_debug("post inflate ebuf len %d\n", ebuf.len);
- lwsl_ext("post inflate eff_buf len %d\n", eff_buf.token_len);
-
- if (rx_draining_ext && !eff_buf.token_len) {
+ if (
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ rx_draining_ext &&
+#endif
+ !ebuf.len) {
lwsl_debug(" --- ending drain on 0 read result\n");
goto already_done;
}
- if (wsi->u.ws.check_utf8 && !wsi->u.ws.defeat_check_utf8) {
- if (lws_check_utf8(&wsi->u.ws.utf8,
- (unsigned char *)eff_buf.token,
- eff_buf.token_len))
+ if (wsi->ws->check_utf8 && !wsi->ws->defeat_check_utf8) {
+ if (lws_check_utf8(&wsi->ws->utf8,
+ (unsigned char *)ebuf.token,
+ ebuf.len)) {
+ lws_close_reason(wsi,
+ LWS_CLOSE_STATUS_INVALID_PAYLOAD,
+ (uint8_t *)"bad utf8", 8);
goto utf8_fail;
+ }
/* we are ending partway through utf-8 character? */
- if (!wsi->u.ws.rx_packet_length && wsi->u.ws.final &&
- wsi->u.ws.utf8 && !n) {
+ if (!wsi->ws->rx_packet_length && wsi->ws->final &&
+ wsi->ws->utf8
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ && !n
+#endif
+ ) {
lwsl_info("FINAL utf8 error\n");
+ lws_close_reason(wsi,
+ LWS_CLOSE_STATUS_INVALID_PAYLOAD,
+ (uint8_t *)"partial utf8", 12);
utf8_fail:
lwsl_info("utf8 error\n");
+ lwsl_hexdump_info(ebuf.token, ebuf.len);
+
return -1;
}
}
- if (eff_buf.token_len < 0 &&
+ if (ebuf.len < 0 &&
callback_action != LWS_CALLBACK_CLIENT_RECEIVE_PONG)
goto already_done;
- if (!eff_buf.token)
+ if (!ebuf.token)
goto already_done;
- eff_buf.token[eff_buf.token_len] = '\0';
+ ebuf.token[ebuf.len] = '\0';
if (!wsi->protocol->callback)
goto already_done;
@@ -555,7 +557,12 @@ utf8_fail:
if (callback_action == LWS_CALLBACK_CLIENT_RECEIVE_PONG)
lwsl_info("Client doing pong callback\n");
- if (n && eff_buf.token_len)
+ if (
+ /* coverity says dead code otherwise */
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ n &&
+#endif
+ ebuf.len)
/* extension had more... main loop will come back
* we want callback to be done with this set, if so,
* because lws_is_final() hides it was final until the
@@ -565,21 +572,26 @@ utf8_fail:
else
lws_remove_wsi_from_draining_ext_list(wsi);
- if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY ||
- wsi->state == LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION ||
- wsi->state == LWSS_AWAITING_CLOSE_ACK)
+ if (lwsi_state(wsi) == LRS_RETURNED_CLOSE ||
+ lwsi_state(wsi) == LRS_WAITING_TO_SEND_CLOSE ||
+ lwsi_state(wsi) == LRS_AWAITING_CLOSE_ACK)
goto already_done;
m = wsi->protocol->callback(wsi,
(enum lws_callback_reasons)callback_action,
- wsi->user_space, eff_buf.token, eff_buf.token_len);
+ wsi->user_space, ebuf.token, ebuf.len);
+
+ wsi->ws->first_fragment = 0;
+
+ // lwsl_notice("%s: bulk ws rx: input used %d, output %d\n",
+ // __func__, wsi->ws->rx_ubuf_head, ebuf.len);
/* if user code wants to close, let caller know */
if (m)
return 1;
already_done:
- wsi->u.ws.rx_ubuf_head = 0;
+ wsi->ws->rx_ubuf_head = 0;
break;
default:
lwsl_err("client rx illegal state\n");
diff --git a/thirdparty/libwebsockets/roles/ws/client-ws.c b/thirdparty/libwebsockets/roles/ws/client-ws.c
new file mode 100644
index 0000000000..fd6cf42551
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/ws/client-ws.c
@@ -0,0 +1,629 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+/*
+ * In-place str to lower case
+ */
+
+static void
+strtolower(char *s)
+{
+ while (*s) {
+#ifdef LWS_PLAT_OPTEE
+ int tolower_optee(int c);
+ *s = tolower_optee((int)*s);
+#else
+ *s = tolower((int)*s);
+#endif
+ s++;
+ }
+}
+
+int
+lws_create_client_ws_object(struct lws_client_connect_info *i, struct lws *wsi)
+{
+ int v = SPEC_LATEST_SUPPORTED;
+
+ /* allocate the ws struct for the wsi */
+ wsi->ws = lws_zalloc(sizeof(*wsi->ws), "client ws struct");
+ if (!wsi->ws) {
+ lwsl_notice("OOM\n");
+ return 1;
+ }
+
+ /* -1 means just use latest supported */
+ if (i->ietf_version_or_minus_one != -1 &&
+ i->ietf_version_or_minus_one)
+ v = i->ietf_version_or_minus_one;
+
+ wsi->ws->ietf_spec_revision = v;
+
+ return 0;
+}
+
+#if !defined(LWS_NO_CLIENT)
+int
+lws_ws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
+{
+ if ((lwsi_state(wsi) != LRS_WAITING_PROXY_REPLY) &&
+ (lwsi_state(wsi) != LRS_H1C_ISSUE_HANDSHAKE) &&
+ (lwsi_state(wsi) != LRS_WAITING_SERVER_REPLY) &&
+ !lwsi_role_client(wsi))
+ return 0;
+
+ // lwsl_notice("%s: hs client gets %d in\n", __func__, (int)len);
+
+ while (len) {
+ /*
+ * we were accepting input but now we stopped doing so
+ */
+ if (lws_is_flowcontrolled(wsi)) {
+ //lwsl_notice("%s: caching %ld\n", __func__, (long)len);
+ lws_rxflow_cache(wsi, *buf, 0, (int)len);
+ *buf += len;
+ return 0;
+ }
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext) {
+ int m;
+
+ //lwsl_notice("%s: draining ext\n", __func__);
+ if (lwsi_role_client(wsi))
+ m = lws_ws_client_rx_sm(wsi, 0);
+ else
+ m = lws_ws_rx_sm(wsi, 0, 0);
+ if (m < 0)
+ return -1;
+ continue;
+ }
+#endif
+ /* caller will account for buflist usage */
+
+ if (lws_ws_client_rx_sm(wsi, *(*buf)++)) {
+ lwsl_notice("%s: client_rx_sm exited, DROPPING %d\n",
+ __func__, (int)len);
+ return -1;
+ }
+ len--;
+ }
+ // lwsl_notice("%s: finished with %ld\n", __func__, (long)len);
+
+ return 0;
+}
+#endif
+
+char *
+lws_generate_client_ws_handshake(struct lws *wsi, char *p)
+{
+ char buf[128], hash[20], key_b64[40];
+ int n;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ const struct lws_extension *ext;
+ int ext_count = 0;
+#endif
+
+ /*
+ * create the random key
+ */
+ n = lws_get_random(wsi->context, hash, 16);
+ if (n != 16) {
+ lwsl_err("Unable to read from random dev %s\n",
+ SYSTEM_RANDOM_FILEPATH);
+ return NULL;
+ }
+
+ lws_b64_encode_string(hash, 16, key_b64, sizeof(key_b64));
+
+ p += sprintf(p, "Upgrade: websocket\x0d\x0a"
+ "Connection: Upgrade\x0d\x0a"
+ "Sec-WebSocket-Key: ");
+ strcpy(p, key_b64);
+ p += strlen(key_b64);
+ p += sprintf(p, "\x0d\x0a");
+ if (lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS))
+ p += sprintf(p, "Sec-WebSocket-Protocol: %s\x0d\x0a",
+ lws_hdr_simple_ptr(wsi,
+ _WSI_TOKEN_CLIENT_SENT_PROTOCOLS));
+
+ /* tell the server what extensions we could support */
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ ext = wsi->vhost->ws.extensions;
+ while (ext && ext->callback) {
+
+ n = wsi->vhost->protocols[0].callback(wsi,
+ LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED,
+ wsi->user_space, (char *)ext->name, 0);
+
+ /*
+ * zero return from callback means go ahead and allow
+ * the extension, it's what we get if the callback is
+ * unhandled
+ */
+
+ if (n) {
+ ext++;
+ continue;
+ }
+
+ /* apply it */
+
+ if (ext_count)
+ *p++ = ',';
+ else
+ p += sprintf(p, "Sec-WebSocket-Extensions: ");
+ p += sprintf(p, "%s", ext->client_offer);
+ ext_count++;
+
+ ext++;
+ }
+ if (ext_count)
+ p += sprintf(p, "\x0d\x0a");
+#endif
+
+ if (wsi->ws->ietf_spec_revision)
+ p += sprintf(p, "Sec-WebSocket-Version: %d\x0d\x0a",
+ wsi->ws->ietf_spec_revision);
+
+ /* prepare the expected server accept response */
+
+ key_b64[39] = '\0'; /* enforce composed length below buf sizeof */
+ n = sprintf(buf, "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
+ key_b64);
+
+ lws_SHA1((unsigned char *)buf, n, (unsigned char *)hash);
+
+ lws_b64_encode_string(hash, 20,
+ wsi->http.ah->initial_handshake_hash_base64,
+ sizeof(wsi->http.ah->initial_handshake_hash_base64));
+
+ return p;
+}
+
+int
+lws_client_ws_upgrade(struct lws *wsi, const char **cce)
+{
+ int n, len, okay = 0;
+ struct lws_context *context = wsi->context;
+ const char *pc;
+ char *p;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ char *sb = (char *)&pt->serv_buf[0];
+ const struct lws_ext_options *opts;
+ const struct lws_extension *ext;
+ char ext_name[128];
+ const char *c, *a;
+ char ignore;
+ int more = 1;
+#endif
+
+ if (wsi->client_h2_substream) {/* !!! client ws-over-h2 not there yet */
+ lwsl_warn("%s: client ws-over-h2 upgrade not supported yet\n",
+ __func__);
+ *cce = "HS: h2 / ws upgrade unsupported";
+ goto bail3;
+ }
+
+ if (wsi->http.ah->http_response == 401) {
+ lwsl_warn(
+ "lws_client_handshake: got bad HTTP response '%d'\n",
+ wsi->http.ah->http_response);
+ *cce = "HS: ws upgrade unauthorized";
+ goto bail3;
+ }
+
+ if (wsi->http.ah->http_response != 101) {
+ lwsl_warn(
+ "lws_client_handshake: got bad HTTP response '%d'\n",
+ wsi->http.ah->http_response);
+ *cce = "HS: ws upgrade response not 101";
+ goto bail3;
+ }
+
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_ACCEPT) == 0) {
+ lwsl_info("no ACCEPT\n");
+ *cce = "HS: ACCEPT missing";
+ goto bail3;
+ }
+
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE);
+ if (!p) {
+ lwsl_info("no UPGRADE\n");
+ *cce = "HS: UPGRADE missing";
+ goto bail3;
+ }
+ strtolower(p);
+ if (strcmp(p, "websocket")) {
+ lwsl_warn(
+ "lws_client_handshake: got bad Upgrade header '%s'\n", p);
+ *cce = "HS: Upgrade to something other than websocket";
+ goto bail3;
+ }
+
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_CONNECTION);
+ if (!p) {
+ lwsl_info("no Connection hdr\n");
+ *cce = "HS: CONNECTION missing";
+ goto bail3;
+ }
+ strtolower(p);
+ if (strcmp(p, "upgrade")) {
+ lwsl_warn("lws_client_int_s_hs: bad header %s\n", p);
+ *cce = "HS: UPGRADE malformed";
+ goto bail3;
+ }
+
+ pc = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
+ if (!pc) {
+ lwsl_parser("lws_client_int_s_hs: no protocol list\n");
+ } else
+ lwsl_parser("lws_client_int_s_hs: protocol list '%s'\n", pc);
+
+ /*
+ * confirm the protocol the server wants to talk was in the list
+ * of protocols we offered
+ */
+
+ len = lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL);
+ if (!len) {
+ lwsl_info("%s: WSI_TOKEN_PROTOCOL is null\n", __func__);
+ /*
+ * no protocol name to work from,
+ * default to first protocol
+ */
+ n = 0;
+ wsi->protocol = &wsi->vhost->protocols[0];
+ goto check_extensions;
+ }
+
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL);
+ len = (int)strlen(p);
+
+ while (pc && *pc && !okay) {
+ if (!strncmp(pc, p, len) &&
+ (pc[len] == ',' || pc[len] == '\0')) {
+ okay = 1;
+ continue;
+ }
+ while (*pc && *pc++ != ',')
+ ;
+ while (*pc && *pc == ' ')
+ pc++;
+ }
+
+ if (!okay) {
+ lwsl_info("%s: got bad protocol %s\n", __func__, p);
+ *cce = "HS: PROTOCOL malformed";
+ goto bail2;
+ }
+
+ /*
+ * identify the selected protocol struct and set it
+ */
+ n = 0;
+ /* keep client connection pre-bound protocol */
+ if (!lwsi_role_client(wsi))
+ wsi->protocol = NULL;
+
+ while (wsi->vhost->protocols[n].callback) {
+ if (!wsi->protocol &&
+ strcmp(p, wsi->vhost->protocols[n].name) == 0) {
+ wsi->protocol = &wsi->vhost->protocols[n];
+ break;
+ }
+ n++;
+ }
+
+ if (!wsi->vhost->protocols[n].callback) { /* no match */
+ /* if server, that's already fatal */
+ if (!lwsi_role_client(wsi)) {
+ lwsl_info("%s: fail protocol %s\n", __func__, p);
+ *cce = "HS: Cannot match protocol";
+ goto bail2;
+ }
+
+ /* for client, find the index of our pre-bound protocol */
+
+ n = 0;
+ while (wsi->vhost->protocols[n].callback) {
+ if (wsi->protocol && strcmp(wsi->protocol->name,
+ wsi->vhost->protocols[n].name) == 0) {
+ wsi->protocol = &wsi->vhost->protocols[n];
+ break;
+ }
+ n++;
+ }
+
+ if (!wsi->vhost->protocols[n].callback) {
+ if (wsi->protocol)
+ lwsl_err("Failed to match protocol %s\n",
+ wsi->protocol->name);
+ else
+ lwsl_err("No protocol on client\n");
+ goto bail2;
+ }
+ }
+
+ lwsl_debug("Selected protocol %s\n", wsi->protocol->name);
+
+check_extensions:
+ /*
+ * stitch protocol choice into the vh protocol linked list
+ * We always insert ourselves at the start of the list
+ *
+ * X <-> B
+ * X <-> pAn <-> pB
+ */
+
+ lws_vhost_lock(wsi->vhost);
+
+ wsi->same_vh_protocol_prev = /* guy who points to us */
+ &wsi->vhost->same_vh_protocol_list[n];
+ wsi->same_vh_protocol_next = /* old first guy is our next */
+ wsi->vhost->same_vh_protocol_list[n];
+ /* we become the new first guy */
+ wsi->vhost->same_vh_protocol_list[n] = wsi;
+
+ if (wsi->same_vh_protocol_next)
+ /* old first guy points back to us now */
+ wsi->same_vh_protocol_next->same_vh_protocol_prev =
+ &wsi->same_vh_protocol_next;
+ wsi->on_same_vh_list = 1;
+
+ lws_vhost_unlock(wsi->vhost);
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ /* instantiate the accepted extensions */
+
+ if (!lws_hdr_total_length(wsi, WSI_TOKEN_EXTENSIONS)) {
+ lwsl_ext("no client extensions allowed by server\n");
+ goto check_accept;
+ }
+
+ /*
+ * break down the list of server accepted extensions
+ * and go through matching them or identifying bogons
+ */
+
+ if (lws_hdr_copy(wsi, sb, context->pt_serv_buf_size,
+ WSI_TOKEN_EXTENSIONS) < 0) {
+ lwsl_warn("ext list from server failed to copy\n");
+ *cce = "HS: EXT: list too big";
+ goto bail2;
+ }
+
+ c = sb;
+ n = 0;
+ ignore = 0;
+ a = NULL;
+ while (more) {
+
+ if (*c && (*c != ',' && *c != '\t')) {
+ if (*c == ';') {
+ ignore = 1;
+ if (!a)
+ a = c + 1;
+ }
+ if (ignore || *c == ' ') {
+ c++;
+ continue;
+ }
+
+ ext_name[n] = *c++;
+ if (n < (int)sizeof(ext_name) - 1)
+ n++;
+ continue;
+ }
+ ext_name[n] = '\0';
+ ignore = 0;
+ if (!*c)
+ more = 0;
+ else {
+ c++;
+ if (!n)
+ continue;
+ }
+
+ /* check we actually support it */
+
+ lwsl_notice("checking client ext %s\n", ext_name);
+
+ n = 0;
+ ext = wsi->vhost->ws.extensions;
+ while (ext && ext->callback) {
+ if (strcmp(ext_name, ext->name)) {
+ ext++;
+ continue;
+ }
+
+ n = 1;
+ lwsl_notice("instantiating client ext %s\n", ext_name);
+
+ /* instantiate the extension on this conn */
+
+ wsi->ws->active_extensions[wsi->ws->count_act_ext] = ext;
+
+ /* allow him to construct his ext instance */
+
+ if (ext->callback(lws_get_context(wsi), ext, wsi,
+ LWS_EXT_CB_CLIENT_CONSTRUCT,
+ (void *)&wsi->ws->act_ext_user[wsi->ws->count_act_ext],
+ (void *)&opts, 0)) {
+ lwsl_info(" ext %s failed construction\n",
+ ext_name);
+ ext++;
+ continue;
+ }
+
+ /*
+ * allow the user code to override ext defaults if it
+ * wants to
+ */
+ ext_name[0] = '\0';
+ if (user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_WS_EXT_DEFAULTS,
+ (char *)ext->name, ext_name,
+ sizeof(ext_name))) {
+ *cce = "HS: EXT: failed setting defaults";
+ goto bail2;
+ }
+
+ if (ext_name[0] &&
+ lws_ext_parse_options(ext, wsi, wsi->ws->act_ext_user[
+ wsi->ws->count_act_ext], opts, ext_name,
+ (int)strlen(ext_name))) {
+ lwsl_err("%s: unable to parse user defaults '%s'",
+ __func__, ext_name);
+ *cce = "HS: EXT: failed parsing defaults";
+ goto bail2;
+ }
+
+ /*
+ * give the extension the server options
+ */
+ if (a && lws_ext_parse_options(ext, wsi,
+ wsi->ws->act_ext_user[wsi->ws->count_act_ext],
+ opts, a, lws_ptr_diff(c, a))) {
+ lwsl_err("%s: unable to parse remote def '%s'",
+ __func__, a);
+ *cce = "HS: EXT: failed parsing options";
+ goto bail2;
+ }
+
+ if (ext->callback(lws_get_context(wsi), ext, wsi,
+ LWS_EXT_CB_OPTION_CONFIRM,
+ wsi->ws->act_ext_user[wsi->ws->count_act_ext],
+ NULL, 0)) {
+ lwsl_err("%s: ext %s rejects server options %s",
+ __func__, ext->name, a);
+ *cce = "HS: EXT: Rejects server options";
+ goto bail2;
+ }
+
+ wsi->ws->count_act_ext++;
+
+ ext++;
+ }
+
+ if (n == 0) {
+ lwsl_warn("Unknown ext '%s'!\n", ext_name);
+ *cce = "HS: EXT: unknown ext";
+ goto bail2;
+ }
+
+ a = NULL;
+ n = 0;
+ }
+
+check_accept:
+#endif
+
+ /*
+ * Confirm his accept token is the one we precomputed
+ */
+
+ p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_ACCEPT);
+ if (strcmp(p, wsi->http.ah->initial_handshake_hash_base64)) {
+ lwsl_warn("lws_client_int_s_hs: accept '%s' wrong vs '%s'\n", p,
+ wsi->http.ah->initial_handshake_hash_base64);
+ *cce = "HS: Accept hash wrong";
+ goto bail2;
+ }
+
+ /* allocate the per-connection user memory (if any) */
+ if (lws_ensure_user_space(wsi)) {
+ lwsl_err("Problem allocating wsi user mem\n");
+ *cce = "HS: OOM";
+ goto bail2;
+ }
+
+ /*
+ * we seem to be good to go, give client last chance to check
+ * headers and OK it
+ */
+ if (wsi->protocol->callback(wsi,
+ LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH,
+ wsi->user_space, NULL, 0)) {
+ *cce = "HS: Rejected by filter cb";
+ goto bail2;
+ }
+
+ /* clear his proxy connection timeout */
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+
+ /* free up his parsing allocations */
+ lws_header_table_detach(wsi, 0);
+
+ lws_role_transition(wsi, LWSIFR_CLIENT, LRS_ESTABLISHED,
+ &role_ops_ws);
+ lws_restart_ws_ping_pong_timer(wsi);
+
+ wsi->rxflow_change_to = LWS_RXFLOW_ALLOW;
+
+ /*
+ * create the frame buffer for this connection according to the
+ * size mentioned in the protocol definition. If 0 there, then
+ * use a big default for compatibility
+ */
+ n = (int)wsi->protocol->rx_buffer_size;
+ if (!n)
+ n = context->pt_serv_buf_size;
+ n += LWS_PRE;
+ wsi->ws->rx_ubuf = lws_malloc(n + 4 /* 0x0000ffff zlib */,
+ "client frame buffer");
+ if (!wsi->ws->rx_ubuf) {
+ lwsl_err("Out of Mem allocating rx buffer %d\n", n);
+ *cce = "HS: OOM";
+ goto bail2;
+ }
+ wsi->ws->rx_ubuf_alloc = n;
+ lwsl_info("Allocating client RX buffer %d\n", n);
+
+#if !defined(LWS_WITH_ESP32)
+ if (setsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_SNDBUF,
+ (const char *)&n, sizeof n)) {
+ lwsl_warn("Failed to set SNDBUF to %d", n);
+ *cce = "HS: SO_SNDBUF failed";
+ goto bail3;
+ }
+#endif
+
+ lwsl_debug("handshake OK for protocol %s\n", wsi->protocol->name);
+
+ /* call him back to inform him he is up */
+
+ if (wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_ESTABLISHED,
+ wsi->user_space, NULL, 0)) {
+ *cce = "HS: Rejected at CLIENT_ESTABLISHED";
+ goto bail3;
+ }
+
+ return 0;
+
+bail3:
+ return 3;
+
+bail2:
+ return 2;
+}
diff --git a/thirdparty/libwebsockets/roles/ws/ops-ws.c b/thirdparty/libwebsockets/roles/ws/ops-ws.c
new file mode 100644
index 0000000000..5ddaba9e18
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/ws/ops-ws.c
@@ -0,0 +1,1992 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+#define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); }
+
+/*
+ * client-parser.c: lws_ws_client_rx_sm() needs to be roughly kept in
+ * sync with changes here, esp related to ext draining
+ */
+
+int
+lws_ws_rx_sm(struct lws *wsi, char already_processed, unsigned char c)
+{
+ int callback_action = LWS_CALLBACK_RECEIVE;
+ int ret = 0;
+ unsigned short close_code;
+ struct lws_tokens ebuf;
+ unsigned char *pp;
+ int n = 0;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ int rx_draining_ext = 0;
+ int lin;
+#endif
+
+ ebuf.token = NULL;
+ ebuf.len = 0;
+ if (wsi->socket_is_permanently_unusable)
+ return -1;
+
+ switch (wsi->lws_rx_parse_state) {
+ case LWS_RXPS_NEW:
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext) {
+ ebuf.token = NULL;
+ ebuf.len = 0;
+ lws_remove_wsi_from_draining_ext_list(wsi);
+ rx_draining_ext = 1;
+ lwsl_debug("%s: doing draining flow\n", __func__);
+
+ goto drain_extension;
+ }
+#endif
+ switch (wsi->ws->ietf_spec_revision) {
+ case 13:
+ /*
+ * no prepended frame key any more
+ */
+ wsi->ws->all_zero_nonce = 1;
+ goto handle_first;
+
+ default:
+ lwsl_warn("lws_ws_rx_sm: unknown spec version %d\n",
+ wsi->ws->ietf_spec_revision);
+ break;
+ }
+ break;
+ case LWS_RXPS_04_mask_1:
+ wsi->ws->mask[1] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+ wsi->lws_rx_parse_state = LWS_RXPS_04_mask_2;
+ break;
+ case LWS_RXPS_04_mask_2:
+ wsi->ws->mask[2] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+ wsi->lws_rx_parse_state = LWS_RXPS_04_mask_3;
+ break;
+ case LWS_RXPS_04_mask_3:
+ wsi->ws->mask[3] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+
+ /*
+ * start from the zero'th byte in the XOR key buffer since
+ * this is the start of a frame with a new key
+ */
+
+ wsi->ws->mask_idx = 0;
+
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_1;
+ break;
+
+ /*
+ * 04 logical framing from the spec (all this is masked when incoming
+ * and has to be unmasked)
+ *
+ * We ignore the possibility of extension data because we don't
+ * negotiate any extensions at the moment.
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-------+-+-------------+-------------------------------+
+ * |F|R|R|R| opcode|R| Payload len | Extended payload length |
+ * |I|S|S|S| (4) |S| (7) | (16/63) |
+ * |N|V|V|V| |V| | (if payload len==126/127) |
+ * | |1|2|3| |4| | |
+ * +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
+ * | Extended payload length continued, if payload len == 127 |
+ * + - - - - - - - - - - - - - - - +-------------------------------+
+ * | | Extension data |
+ * +-------------------------------+ - - - - - - - - - - - - - - - +
+ * : :
+ * +---------------------------------------------------------------+
+ * : Application data :
+ * +---------------------------------------------------------------+
+ *
+ * We pass payload through to userland as soon as we get it, ignoring
+ * FIN. It's up to userland to buffer it up if it wants to see a
+ * whole unfragmented block of the original size (which may be up to
+ * 2^63 long!)
+ */
+
+ case LWS_RXPS_04_FRAME_HDR_1:
+handle_first:
+
+ wsi->ws->opcode = c & 0xf;
+ wsi->ws->rsv = c & 0x70;
+ wsi->ws->final = !!((c >> 7) & 1);
+ wsi->ws->defeat_check_utf8 = 0;
+
+ if (((wsi->ws->opcode) & 8) && !wsi->ws->final) {
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR,
+ (uint8_t *)"frag ctl", 8);
+ return -1;
+ }
+
+ switch (wsi->ws->opcode) {
+ case LWSWSOPC_TEXT_FRAME:
+ wsi->ws->check_utf8 = lws_check_opt(
+ wsi->context->options,
+ LWS_SERVER_OPTION_VALIDATE_UTF8);
+ /* fallthru */
+ case LWSWSOPC_BINARY_FRAME:
+ if (wsi->ws->opcode == LWSWSOPC_BINARY_FRAME)
+ wsi->ws->check_utf8 = 0;
+ if (wsi->ws->continuation_possible) {
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad cont", 8);
+ return -1;
+ }
+ wsi->ws->rsv_first_msg = (c & 0x70);
+ wsi->ws->frame_is_binary =
+ wsi->ws->opcode == LWSWSOPC_BINARY_FRAME;
+ wsi->ws->first_fragment = 1;
+ wsi->ws->continuation_possible = !wsi->ws->final;
+ break;
+ case LWSWSOPC_CONTINUATION:
+ if (!wsi->ws->continuation_possible) {
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad cont", 8);
+ return -1;
+ }
+ break;
+ case LWSWSOPC_CLOSE:
+ wsi->ws->check_utf8 = 0;
+ wsi->ws->utf8 = 0;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 0xb:
+ case 0xc:
+ case 0xd:
+ case 0xe:
+ case 0xf:
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad opc", 7);
+ lwsl_info("illegal opcode\n");
+ return -1;
+ }
+
+ if (wsi->ws->owed_a_fin &&
+ (wsi->ws->opcode == LWSWSOPC_TEXT_FRAME ||
+ wsi->ws->opcode == LWSWSOPC_BINARY_FRAME)) {
+ lwsl_info("hey you owed us a FIN\n");
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR, (uint8_t *)"bad fin", 7);
+ return -1;
+ }
+ if ((!(wsi->ws->opcode & 8)) && wsi->ws->final) {
+ wsi->ws->continuation_possible = 0;
+ wsi->ws->owed_a_fin = 0;
+ }
+
+ if (!wsi->ws->final)
+ wsi->ws->owed_a_fin = 1;
+
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN;
+ if (wsi->ws->rsv &&
+ (
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ !wsi->ws->count_act_ext ||
+#endif
+ (wsi->ws->rsv & ~0x40))) {
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_PROTOCOL_ERR,
+ (uint8_t *)"rsv bits", 8);
+ return -1;
+ }
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN:
+
+ wsi->ws->this_frame_masked = !!(c & 0x80);
+
+ switch (c & 0x7f) {
+ case 126:
+ /* control frames are not allowed to have big lengths */
+ if (wsi->ws->opcode & 8)
+ goto illegal_ctl_length;
+
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_2;
+ break;
+ case 127:
+ /* control frames are not allowed to have big lengths */
+ if (wsi->ws->opcode & 8)
+ goto illegal_ctl_length;
+
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_8;
+ break;
+ default:
+ wsi->ws->rx_packet_length = c & 0x7f;
+
+
+ if (wsi->ws->this_frame_masked)
+ wsi->lws_rx_parse_state =
+ LWS_RXPS_07_COLLECT_FRAME_KEY_1;
+ else
+ if (wsi->ws->rx_packet_length) {
+ wsi->lws_rx_parse_state =
+ LWS_RXPS_WS_FRAME_PAYLOAD;
+ } else {
+ wsi->lws_rx_parse_state = LWS_RXPS_NEW;
+ goto spill;
+ }
+ break;
+ }
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN16_2:
+ wsi->ws->rx_packet_length = c << 8;
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_1;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN16_1:
+ wsi->ws->rx_packet_length |= c;
+ if (wsi->ws->this_frame_masked)
+ wsi->lws_rx_parse_state =
+ LWS_RXPS_07_COLLECT_FRAME_KEY_1;
+ else {
+ wsi->lws_rx_parse_state =
+ LWS_RXPS_WS_FRAME_PAYLOAD;
+ }
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_8:
+ if (c & 0x80) {
+ lwsl_warn("b63 of length must be zero\n");
+ /* kill the connection */
+ return -1;
+ }
+#if defined __LP64__
+ wsi->ws->rx_packet_length = ((size_t)c) << 56;
+#else
+ wsi->ws->rx_packet_length = 0;
+#endif
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_7:
+#if defined __LP64__
+ wsi->ws->rx_packet_length |= ((size_t)c) << 48;
+#endif
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_6:
+#if defined __LP64__
+ wsi->ws->rx_packet_length |= ((size_t)c) << 40;
+#endif
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_5:
+#if defined __LP64__
+ wsi->ws->rx_packet_length |= ((size_t)c) << 32;
+#endif
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_4:
+ wsi->ws->rx_packet_length |= ((size_t)c) << 24;
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_3;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_3:
+ wsi->ws->rx_packet_length |= ((size_t)c) << 16;
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_2;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_2:
+ wsi->ws->rx_packet_length |= ((size_t)c) << 8;
+ wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_1;
+ break;
+
+ case LWS_RXPS_04_FRAME_HDR_LEN64_1:
+ wsi->ws->rx_packet_length |= ((size_t)c);
+ if (wsi->ws->this_frame_masked)
+ wsi->lws_rx_parse_state =
+ LWS_RXPS_07_COLLECT_FRAME_KEY_1;
+ else
+ wsi->lws_rx_parse_state = LWS_RXPS_WS_FRAME_PAYLOAD;
+ break;
+
+ case LWS_RXPS_07_COLLECT_FRAME_KEY_1:
+ wsi->ws->mask[0] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+ wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_2;
+ break;
+
+ case LWS_RXPS_07_COLLECT_FRAME_KEY_2:
+ wsi->ws->mask[1] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+ wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_3;
+ break;
+
+ case LWS_RXPS_07_COLLECT_FRAME_KEY_3:
+ wsi->ws->mask[2] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+ wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_4;
+ break;
+
+ case LWS_RXPS_07_COLLECT_FRAME_KEY_4:
+ wsi->ws->mask[3] = c;
+ if (c)
+ wsi->ws->all_zero_nonce = 0;
+ wsi->lws_rx_parse_state = LWS_RXPS_WS_FRAME_PAYLOAD;
+ wsi->ws->mask_idx = 0;
+ if (wsi->ws->rx_packet_length == 0) {
+ wsi->lws_rx_parse_state = LWS_RXPS_NEW;
+ goto spill;
+ }
+ break;
+
+
+ case LWS_RXPS_WS_FRAME_PAYLOAD:
+ assert(wsi->ws->rx_ubuf);
+
+ if (wsi->ws->rx_ubuf_head + LWS_PRE >= wsi->ws->rx_ubuf_alloc) {
+ lwsl_err("Attempted overflow \n");
+ return -1;
+ }
+ if (!(already_processed & ALREADY_PROCESSED_IGNORE_CHAR)) {
+ if (wsi->ws->all_zero_nonce)
+ wsi->ws->rx_ubuf[LWS_PRE + (wsi->ws->rx_ubuf_head++)] =
+ c;
+ else
+ wsi->ws->rx_ubuf[LWS_PRE + (wsi->ws->rx_ubuf_head++)] =
+ c ^ wsi->ws->mask[(wsi->ws->mask_idx++) & 3];
+
+ --wsi->ws->rx_packet_length;
+ }
+
+ if (!wsi->ws->rx_packet_length) {
+ lwsl_debug("%s: ws fragment length exhausted\n", __func__);
+ /* spill because we have the whole frame */
+ wsi->lws_rx_parse_state = LWS_RXPS_NEW;
+ goto spill;
+ }
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext) {
+ lwsl_debug("%s: UNTIL_EXHAUSTED draining\n", __func__);
+ goto drain_extension;
+ }
+#endif
+ /*
+ * if there's no protocol max frame size given, we are
+ * supposed to default to context->pt_serv_buf_size
+ */
+ if (!wsi->protocol->rx_buffer_size &&
+ wsi->ws->rx_ubuf_head != wsi->context->pt_serv_buf_size)
+ break;
+
+ if (wsi->protocol->rx_buffer_size &&
+ wsi->ws->rx_ubuf_head != wsi->protocol->rx_buffer_size)
+ break;
+
+ /* spill because we filled our rx buffer */
+spill:
+ /*
+ * is this frame a control packet we should take care of at this
+ * layer? If so service it and hide it from the user callback
+ */
+
+ lwsl_parser("spill on %s\n", wsi->protocol->name);
+
+ switch (wsi->ws->opcode) {
+ case LWSWSOPC_CLOSE:
+
+ if (wsi->ws->peer_has_sent_close)
+ break;
+
+ wsi->ws->peer_has_sent_close = 1;
+
+ pp = (unsigned char *)&wsi->ws->rx_ubuf[LWS_PRE];
+ if (lws_check_opt(wsi->context->options,
+ LWS_SERVER_OPTION_VALIDATE_UTF8) &&
+ wsi->ws->rx_ubuf_head > 2 &&
+ lws_check_utf8(&wsi->ws->utf8, pp + 2,
+ wsi->ws->rx_ubuf_head - 2))
+ goto utf8_fail;
+
+ /* is this an acknowledgment of our close? */
+ if (lwsi_state(wsi) == LRS_AWAITING_CLOSE_ACK) {
+ /*
+ * fine he has told us he is closing too, let's
+ * finish our close
+ */
+ lwsl_parser("seen client close ack\n");
+ return -1;
+ }
+ if (lwsi_state(wsi) == LRS_RETURNED_CLOSE)
+ /* if he sends us 2 CLOSE, kill him */
+ return -1;
+
+ if (lws_partial_buffered(wsi)) {
+ /*
+ * if we're in the middle of something,
+ * we can't do a normal close response and
+ * have to just close our end.
+ */
+ wsi->socket_is_permanently_unusable = 1;
+ lwsl_parser("Closing on peer close due to Pending tx\n");
+ return -1;
+ }
+
+ if (wsi->ws->rx_ubuf_head >= 2) {
+ close_code = (pp[0] << 8) | pp[1];
+ if (close_code < 1000 ||
+ close_code == 1004 ||
+ close_code == 1005 ||
+ close_code == 1006 ||
+ close_code == 1012 ||
+ close_code == 1013 ||
+ close_code == 1014 ||
+ close_code == 1015 ||
+ (close_code >= 1016 && close_code < 3000)
+ ) {
+ pp[0] = (LWS_CLOSE_STATUS_PROTOCOL_ERR >> 8) & 0xff;
+ pp[1] = LWS_CLOSE_STATUS_PROTOCOL_ERR & 0xff;
+ }
+ }
+
+ if (user_callback_handle_rxflow(
+ wsi->protocol->callback, wsi,
+ LWS_CALLBACK_WS_PEER_INITIATED_CLOSE,
+ wsi->user_space,
+ &wsi->ws->rx_ubuf[LWS_PRE],
+ wsi->ws->rx_ubuf_head))
+ return -1;
+
+ lwsl_parser("server sees client close packet\n");
+ lwsi_set_state(wsi, LRS_RETURNED_CLOSE);
+ /* deal with the close packet contents as a PONG */
+ wsi->ws->payload_is_close = 1;
+ goto process_as_ping;
+
+ case LWSWSOPC_PING:
+ lwsl_info("received %d byte ping, sending pong\n",
+ wsi->ws->rx_ubuf_head);
+
+ if (wsi->ws->ping_pending_flag) {
+ /*
+ * there is already a pending ping payload
+ * we should just log and drop
+ */
+ lwsl_parser("DROP PING since one pending\n");
+ goto ping_drop;
+ }
+process_as_ping:
+ /* control packets can only be < 128 bytes long */
+ if (wsi->ws->rx_ubuf_head > 128 - 3) {
+ lwsl_parser("DROP PING payload too large\n");
+ goto ping_drop;
+ }
+
+ /* stash the pong payload */
+ memcpy(wsi->ws->ping_payload_buf + LWS_PRE,
+ &wsi->ws->rx_ubuf[LWS_PRE],
+ wsi->ws->rx_ubuf_head);
+
+ wsi->ws->ping_payload_len = wsi->ws->rx_ubuf_head;
+ wsi->ws->ping_pending_flag = 1;
+
+ /* get it sent as soon as possible */
+ lws_callback_on_writable(wsi);
+ping_drop:
+ wsi->ws->rx_ubuf_head = 0;
+ return 0;
+
+ case LWSWSOPC_PONG:
+ lwsl_info("received pong\n");
+ lwsl_hexdump(&wsi->ws->rx_ubuf[LWS_PRE],
+ wsi->ws->rx_ubuf_head);
+
+ if (wsi->pending_timeout ==
+ PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG) {
+ lwsl_info("received expected PONG on wsi %p\n",
+ wsi);
+ lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
+ }
+
+ /* issue it */
+ callback_action = LWS_CALLBACK_RECEIVE_PONG;
+ break;
+
+ case LWSWSOPC_TEXT_FRAME:
+ case LWSWSOPC_BINARY_FRAME:
+ case LWSWSOPC_CONTINUATION:
+ break;
+
+ default:
+ lwsl_parser("unknown opc %x\n", wsi->ws->opcode);
+
+ return -1;
+ }
+
+ /*
+ * No it's real payload, pass it up to the user callback.
+ * It's nicely buffered with the pre-padding taken care of
+ * so it can be sent straight out again using lws_write
+ */
+
+ ebuf.token = &wsi->ws->rx_ubuf[LWS_PRE];
+ ebuf.len = wsi->ws->rx_ubuf_head;
+
+ if (wsi->ws->opcode == LWSWSOPC_PONG && !ebuf.len)
+ goto already_done;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+drain_extension:
+#endif
+ // lwsl_notice("%s: passing %d to ext\n", __func__, ebuf.len);
+
+ if (lwsi_state(wsi) == LRS_RETURNED_CLOSE ||
+ lwsi_state(wsi) == LRS_AWAITING_CLOSE_ACK)
+ goto already_done;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ lin = ebuf.len;
+ //if (lin)
+ // lwsl_hexdump_notice(ebuf.token, ebuf.len);
+ n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &ebuf, 0);
+ lwsl_debug("%s: ext says %d / ebuf.len %d\n", __func__, n, ebuf.len);
+ if (wsi->ws->rx_draining_ext)
+ already_processed &= ~ALREADY_PROCESSED_NO_CB;
+#endif
+ /*
+ * ebuf may be pointing somewhere completely different now,
+ * it's the output
+ */
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (n < 0) {
+ /*
+ * we may rely on this to get RX, just drop connection
+ */
+ wsi->socket_is_permanently_unusable = 1;
+ return -1;
+ }
+#endif
+ if (
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ rx_draining_ext &&
+#endif
+ ebuf.len == 0)
+ goto already_done;
+
+ if (
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ n &&
+#endif
+ ebuf.len)
+ /* extension had more... main loop will come back */
+ lws_add_wsi_to_draining_ext_list(wsi);
+ else
+ lws_remove_wsi_from_draining_ext_list(wsi);
+
+ if (wsi->ws->check_utf8 && !wsi->ws->defeat_check_utf8) {
+ if (lws_check_utf8(&wsi->ws->utf8,
+ (unsigned char *)ebuf.token,
+ ebuf.len)) {
+ lws_close_reason(wsi,
+ LWS_CLOSE_STATUS_INVALID_PAYLOAD,
+ (uint8_t *)"bad utf8", 8);
+ goto utf8_fail;
+ }
+
+ /* we are ending partway through utf-8 character? */
+ if (!wsi->ws->rx_packet_length && wsi->ws->final &&
+ wsi->ws->utf8 && !n) {
+ lwsl_info("FINAL utf8 error\n");
+ lws_close_reason(wsi,
+ LWS_CLOSE_STATUS_INVALID_PAYLOAD,
+ (uint8_t *)"partial utf8", 12);
+utf8_fail:
+ lwsl_notice("utf8 error\n");
+ lwsl_hexdump_notice(ebuf.token, ebuf.len);
+
+ return -1;
+ }
+ }
+
+ if (!wsi->wsistate_pre_close && (ebuf.len >= 0 ||
+ callback_action == LWS_CALLBACK_RECEIVE_PONG)) {
+ if (ebuf.len)
+ ebuf.token[ebuf.len] = '\0';
+
+ if (wsi->protocol->callback &&
+ !(already_processed & ALREADY_PROCESSED_NO_CB)) {
+ if (callback_action == LWS_CALLBACK_RECEIVE_PONG)
+ lwsl_info("Doing pong callback\n");
+
+ ret = user_callback_handle_rxflow(
+ wsi->protocol->callback,
+ wsi, (enum lws_callback_reasons)
+ callback_action,
+ wsi->user_space,
+ ebuf.token,
+ ebuf.len);
+ }
+ wsi->ws->first_fragment = 0;
+ }
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (!lin)
+ break;
+#endif
+
+already_done:
+ wsi->ws->rx_ubuf_head = 0;
+ break;
+ }
+
+ return ret;
+
+illegal_ctl_length:
+
+ lwsl_warn("Control frame with xtended length is illegal\n");
+ /* kill the connection */
+ return -1;
+}
+
+
+LWS_VISIBLE size_t
+lws_remaining_packet_payload(struct lws *wsi)
+{
+ return wsi->ws->rx_packet_length;
+}
+
+LWS_VISIBLE int lws_frame_is_binary(struct lws *wsi)
+{
+ return wsi->ws->frame_is_binary;
+}
+
+void
+lws_add_wsi_to_draining_ext_list(struct lws *wsi)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ if (wsi->ws->rx_draining_ext)
+ return;
+
+ lwsl_debug("%s: RX EXT DRAINING: Adding to list\n", __func__);
+
+ wsi->ws->rx_draining_ext = 1;
+ wsi->ws->rx_draining_ext_list = pt->ws.rx_draining_ext_list;
+ pt->ws.rx_draining_ext_list = wsi;
+#endif
+}
+
+void
+lws_remove_wsi_from_draining_ext_list(struct lws *wsi)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ struct lws **w = &pt->ws.rx_draining_ext_list;
+
+ if (!wsi->ws->rx_draining_ext)
+ return;
+
+ lwsl_debug("%s: RX EXT DRAINING: Removing from list\n", __func__);
+
+ wsi->ws->rx_draining_ext = 0;
+
+ /* remove us from context draining ext list */
+ while (*w) {
+ if (*w == wsi) {
+ /* if us, point it instead to who we were pointing to */
+ *w = wsi->ws->rx_draining_ext_list;
+ break;
+ }
+ w = &((*w)->ws->rx_draining_ext_list);
+ }
+ wsi->ws->rx_draining_ext_list = NULL;
+#endif
+}
+
+LWS_EXTERN void
+lws_restart_ws_ping_pong_timer(struct lws *wsi)
+{
+ if (!wsi->context->ws_ping_pong_interval ||
+ !lwsi_role_ws(wsi))
+ return;
+
+ wsi->ws->time_next_ping_check = (time_t)lws_now_secs();
+}
+
+static int
+lws_0405_frame_mask_generate(struct lws *wsi)
+{
+ int n;
+ /* fetch the per-frame nonce */
+
+ n = lws_get_random(lws_get_context(wsi), wsi->ws->mask, 4);
+ if (n != 4) {
+ lwsl_parser("Unable to read from random device %s %d\n",
+ SYSTEM_RANDOM_FILEPATH, n);
+ return 1;
+ }
+
+ /* start masking from first byte of masking key buffer */
+ wsi->ws->mask_idx = 0;
+
+ return 0;
+}
+
+int
+lws_server_init_wsi_for_ws(struct lws *wsi)
+{
+ int n;
+
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ lws_restart_ws_ping_pong_timer(wsi);
+
+ /*
+ * create the frame buffer for this connection according to the
+ * size mentioned in the protocol definition. If 0 there, use
+ * a big default for compatibility
+ */
+
+ n = (int)wsi->protocol->rx_buffer_size;
+ if (!n)
+ n = wsi->context->pt_serv_buf_size;
+ n += LWS_PRE;
+ wsi->ws->rx_ubuf = lws_malloc(n + 4 /* 0x0000ffff zlib */, "rx_ubuf");
+ if (!wsi->ws->rx_ubuf) {
+ lwsl_err("Out of Mem allocating rx buffer %d\n", n);
+ return 1;
+ }
+ wsi->ws->rx_ubuf_alloc = n;
+ lwsl_debug("Allocating RX buffer %d\n", n);
+
+#if !defined(LWS_WITH_ESP32)
+ if (!wsi->parent_carries_io &&
+ !wsi->h2_stream_carries_ws)
+ if (setsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_SNDBUF,
+ (const char *)&n, sizeof n)) {
+ lwsl_warn("Failed to set SNDBUF to %d", n);
+ return 1;
+ }
+#endif
+
+ /* notify user code that we're ready to roll */
+
+ if (wsi->protocol->callback)
+ if (wsi->protocol->callback(wsi, LWS_CALLBACK_ESTABLISHED,
+ wsi->user_space,
+#ifdef LWS_WITH_TLS
+ wsi->tls.ssl,
+#else
+ NULL,
+#endif
+ wsi->h2_stream_carries_ws))
+ return 1;
+
+ lwsl_debug("ws established\n");
+
+ return 0;
+}
+
+
+
+LWS_VISIBLE int
+lws_is_final_fragment(struct lws *wsi)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ lwsl_debug("%s: final %d, rx pk length %ld, draining %ld\n", __func__,
+ wsi->ws->final, (long)wsi->ws->rx_packet_length,
+ (long)wsi->ws->rx_draining_ext);
+ return wsi->ws->final && !wsi->ws->rx_packet_length &&
+ !wsi->ws->rx_draining_ext;
+#else
+ return wsi->ws->final && !wsi->ws->rx_packet_length;
+#endif
+}
+
+LWS_VISIBLE int
+lws_is_first_fragment(struct lws *wsi)
+{
+ return wsi->ws->first_fragment;
+}
+
+LWS_VISIBLE unsigned char
+lws_get_reserved_bits(struct lws *wsi)
+{
+ return wsi->ws->rsv;
+}
+
+LWS_VISIBLE LWS_EXTERN int
+lws_get_close_length(struct lws *wsi)
+{
+ return wsi->ws->close_in_ping_buffer_len;
+}
+
+LWS_VISIBLE LWS_EXTERN unsigned char *
+lws_get_close_payload(struct lws *wsi)
+{
+ return &wsi->ws->ping_payload_buf[LWS_PRE];
+}
+
+LWS_VISIBLE LWS_EXTERN void
+lws_close_reason(struct lws *wsi, enum lws_close_status status,
+ unsigned char *buf, size_t len)
+{
+ unsigned char *p, *start;
+ int budget = sizeof(wsi->ws->ping_payload_buf) - LWS_PRE;
+
+ assert(lwsi_role_ws(wsi));
+
+ start = p = &wsi->ws->ping_payload_buf[LWS_PRE];
+
+ *p++ = (((int)status) >> 8) & 0xff;
+ *p++ = ((int)status) & 0xff;
+
+ if (buf)
+ while (len-- && p < start + budget)
+ *p++ = *buf++;
+
+ wsi->ws->close_in_ping_buffer_len = lws_ptr_diff(p, start);
+}
+
+static int
+lws_is_ws_with_ext(struct lws *wsi)
+{
+#if defined(LWS_WITHOUT_EXTENSIONS)
+ return 0;
+#else
+ return lwsi_role_ws(wsi) && !!wsi->ws->count_act_ext;
+#endif
+}
+
+static int
+rops_handle_POLLIN_ws(struct lws_context_per_thread *pt, struct lws *wsi,
+ struct lws_pollfd *pollfd)
+{
+ struct lws_tokens ebuf;
+ unsigned int pending = 0;
+ char buffered = 0;
+ int n = 0, m;
+#if defined(LWS_WITH_HTTP2)
+ struct lws *wsi1;
+#endif
+
+ if (!wsi->ws) {
+ lwsl_err("ws role wsi with no ws\n");
+ return 1;
+ }
+
+ // lwsl_notice("%s: %s\n", __func__, wsi->protocol->name);
+
+ //lwsl_info("%s: wsistate 0x%x, pollout %d\n", __func__,
+ // wsi->wsistate, pollfd->revents & LWS_POLLOUT);
+
+ /*
+ * something went wrong with parsing the handshake, and
+ * we ended up back in the event loop without completing it
+ */
+ if (lwsi_state(wsi) == LRS_PRE_WS_SERVING_ACCEPT) {
+ wsi->socket_is_permanently_unusable = 1;
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ ebuf.token = NULL;
+ ebuf.len = 0;
+
+ if (lwsi_state(wsi) == LRS_WAITING_CONNECT) {
+#if !defined(LWS_NO_CLIENT)
+ if ((pollfd->revents & LWS_POLLOUT) &&
+ lws_handle_POLLOUT_event(wsi, pollfd)) {
+ lwsl_debug("POLLOUT event closed it\n");
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ n = lws_client_socket_service(wsi, pollfd, NULL);
+ if (n)
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+#endif
+ return LWS_HPI_RET_HANDLED;
+ }
+
+ //lwsl_notice("%s: wsi->ws->tx_draining_ext %d revents 0x%x 0x%x %d\n", __func__, wsi->ws->tx_draining_ext, pollfd->revents, wsi->wsistate, lwsi_state_can_handle_POLLOUT(wsi));
+
+ /* 1: something requested a callback when it was OK to write */
+
+ if ((pollfd->revents & LWS_POLLOUT) &&
+ lwsi_state_can_handle_POLLOUT(wsi) &&
+ lws_handle_POLLOUT_event(wsi, pollfd)) {
+ if (lwsi_state(wsi) == LRS_RETURNED_CLOSE)
+ lwsi_set_state(wsi, LRS_FLUSHING_BEFORE_CLOSE);
+
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ if (lwsi_state(wsi) == LRS_RETURNED_CLOSE ||
+ lwsi_state(wsi) == LRS_WAITING_TO_SEND_CLOSE) {
+ /*
+ * we stopped caring about anything except control
+ * packets. Force flow control off, defeat tx
+ * draining.
+ */
+ lws_rx_flow_control(wsi, 1);
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws)
+ wsi->ws->tx_draining_ext = 0;
+#endif
+ }
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->tx_draining_ext)
+ /*
+ * We cannot deal with new RX until the TX ext path has
+ * been drained. It's because new rx will, eg, crap on
+ * the wsi rx buf that may be needed to retain state.
+ *
+ * TX ext drain path MUST go through event loop to avoid
+ * blocking.
+ */
+ return LWS_HPI_RET_HANDLED;
+#endif
+ if (lws_is_flowcontrolled(wsi)) {
+ /* We cannot deal with any kind of new RX because we are
+ * RX-flowcontrolled.
+ */
+ lwsl_info("flowcontrolled\n");
+ return LWS_HPI_RET_HANDLED;
+ }
+
+#if defined(LWS_WITH_HTTP2)
+ if (wsi->http2_substream || wsi->upgraded_to_http2) {
+ wsi1 = lws_get_network_wsi(wsi);
+ if (wsi1 && wsi1->trunc_len)
+ /* We cannot deal with any kind of new RX
+ * because we are dealing with a partial send
+ * (new RX may trigger new http_action() that
+ * expect to be able to send)
+ */
+ return LWS_HPI_RET_HANDLED;
+ }
+#endif
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ /* 2: RX Extension needs to be drained
+ */
+
+ if (wsi->ws->rx_draining_ext) {
+
+ lwsl_debug("%s: RX EXT DRAINING: Service\n", __func__);
+#ifndef LWS_NO_CLIENT
+ if (lwsi_role_client(wsi)) {
+ n = lws_ws_client_rx_sm(wsi, 0);
+ if (n < 0)
+ /* we closed wsi */
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ } else
+#endif
+ n = lws_ws_rx_sm(wsi, ALREADY_PROCESSED_IGNORE_CHAR, 0);
+
+ return LWS_HPI_RET_HANDLED;
+ }
+
+ if (wsi->ws->rx_draining_ext)
+ /*
+ * We have RX EXT content to drain, but can't do it
+ * right now. That means we cannot do anything lower
+ * priority either.
+ */
+ return LWS_HPI_RET_HANDLED;
+#endif
+
+ /* 3: buflist needs to be drained
+ */
+read:
+ //lws_buflist_describe(&wsi->buflist, wsi);
+ ebuf.len = (int)lws_buflist_next_segment_len(&wsi->buflist,
+ (uint8_t **)&ebuf.token);
+ if (ebuf.len) {
+ lwsl_info("draining buflist (len %d)\n", ebuf.len);
+ buffered = 1;
+ goto drain;
+ }
+
+ if (!(pollfd->revents & pollfd->events & LWS_POLLIN) && !wsi->http.ah)
+ return LWS_HPI_RET_HANDLED;
+
+ if (lws_is_flowcontrolled(wsi)) {
+ lwsl_info("%s: %p should be rxflow (bm 0x%x)..\n",
+ __func__, wsi, wsi->rxflow_bitmap);
+ return LWS_HPI_RET_HANDLED;
+ }
+
+ if (!(lwsi_role_client(wsi) &&
+ (lwsi_state(wsi) != LRS_ESTABLISHED &&
+ lwsi_state(wsi) != LRS_AWAITING_CLOSE_ACK &&
+ lwsi_state(wsi) != LRS_H2_WAITING_TO_SEND_HEADERS))) {
+ /*
+ * In case we are going to react to this rx by scheduling
+ * writes, we need to restrict the amount of rx to the size
+ * the protocol reported for rx buffer.
+ *
+ * Otherwise we get a situation we have to absorb possibly a
+ * lot of reads before we get a chance to drain them by writing
+ * them, eg, with echo type tests in autobahn.
+ */
+
+ buffered = 0;
+ ebuf.token = (char *)pt->serv_buf;
+ if (lwsi_role_ws(wsi))
+ ebuf.len = wsi->ws->rx_ubuf_alloc;
+ else
+ ebuf.len = wsi->context->pt_serv_buf_size;
+
+ if ((unsigned int)ebuf.len > wsi->context->pt_serv_buf_size)
+ ebuf.len = wsi->context->pt_serv_buf_size;
+
+ if ((int)pending > ebuf.len)
+ pending = ebuf.len;
+
+ ebuf.len = lws_ssl_capable_read(wsi, (uint8_t *)ebuf.token,
+ pending ? (int)pending :
+ ebuf.len);
+ switch (ebuf.len) {
+ case 0:
+ lwsl_info("%s: zero length read\n",
+ __func__);
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ lwsl_info("SSL Capable more service\n");
+ return LWS_HPI_RET_HANDLED;
+ case LWS_SSL_CAPABLE_ERROR:
+ lwsl_info("%s: LWS_SSL_CAPABLE_ERROR\n",
+ __func__);
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+ // lwsl_notice("Actual RX %d\n", ebuf.len);
+
+ lws_restart_ws_ping_pong_timer(wsi);
+
+ /*
+ * coverity thinks ssl_capable_read() may read over
+ * 2GB. Dissuade it...
+ */
+ ebuf.len &= 0x7fffffff;
+ }
+
+drain:
+
+ /*
+ * give any active extensions a chance to munge the buffer
+ * before parse. We pass in a pointer to an lws_tokens struct
+ * prepared with the default buffer and content length that's in
+ * there. Rather than rewrite the default buffer, extensions
+ * that expect to grow the buffer can adapt .token to
+ * point to their own per-connection buffer in the extension
+ * user allocation. By default with no extensions or no
+ * extension callback handling, just the normal input buffer is
+ * used then so it is efficient.
+ */
+ m = 0;
+ do {
+
+ /* service incoming data */
+ //lws_buflist_describe(&wsi->buflist, wsi);
+ if (ebuf.len) {
+#if defined(LWS_ROLE_H2)
+ if (lwsi_role_h2(wsi) && lwsi_state(wsi) != LRS_BODY)
+ n = lws_read_h2(wsi, (unsigned char *)ebuf.token,
+ ebuf.len);
+ else
+#endif
+ n = lws_read_h1(wsi, (unsigned char *)ebuf.token,
+ ebuf.len);
+
+ if (n < 0) {
+ /* we closed wsi */
+ n = 0;
+ return LWS_HPI_RET_WSI_ALREADY_DIED;
+ }
+ //lws_buflist_describe(&wsi->buflist, wsi);
+ //lwsl_notice("%s: consuming %d / %d\n", __func__, n, ebuf.len);
+ if (lws_buflist_aware_consume(wsi, &ebuf, n, buffered))
+ return LWS_HPI_RET_PLEASE_CLOSE_ME;
+ }
+
+ ebuf.token = NULL;
+ ebuf.len = 0;
+ } while (m);
+
+ if (wsi->http.ah
+#if !defined(LWS_NO_CLIENT)
+ && !wsi->client_h2_alpn
+#endif
+ ) {
+ lwsl_info("%s: %p: detaching ah\n", __func__, wsi);
+ lws_header_table_detach(wsi, 0);
+ }
+
+ pending = lws_ssl_pending(wsi);
+ if (pending) {
+ if (lws_is_ws_with_ext(wsi))
+ pending = pending > wsi->ws->rx_ubuf_alloc ?
+ wsi->ws->rx_ubuf_alloc : pending;
+ else
+ pending = pending > wsi->context->pt_serv_buf_size ?
+ wsi->context->pt_serv_buf_size : pending;
+ goto read;
+ }
+
+ if (buffered && /* were draining, now nothing left */
+ !lws_buflist_next_segment_len(&wsi->buflist, NULL)) {
+ lwsl_info("%s: %p flow buf: drained\n", __func__, wsi);
+ /* having drained the rxflow buffer, can rearm POLLIN */
+#ifdef LWS_NO_SERVER
+ n =
+#endif
+ __lws_rx_flow_control(wsi);
+ /* n ignored, needed for NO_SERVER case */
+ }
+
+ /* n = 0 */
+ return LWS_HPI_RET_HANDLED;
+}
+
+
+int rops_handle_POLLOUT_ws(struct lws *wsi)
+{
+ int write_type = LWS_WRITE_PONG;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_tokens ebuf;
+ int ret, m;
+#endif
+ int n;
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ lwsl_debug("%s: %s: wsi->ws->tx_draining_ext %d\n", __func__,
+ wsi->protocol->name, wsi->ws->tx_draining_ext);
+#endif
+
+ /* Priority 3: pending control packets (pong or close)
+ *
+ * 3a: close notification packet requested from close api
+ */
+
+ if (lwsi_state(wsi) == LRS_WAITING_TO_SEND_CLOSE) {
+ lwsl_debug("sending close packet\n");
+ lwsl_hexdump_debug(&wsi->ws->ping_payload_buf[LWS_PRE],
+ wsi->ws->close_in_ping_buffer_len);
+ wsi->waiting_to_send_close_frame = 0;
+ n = lws_write(wsi, &wsi->ws->ping_payload_buf[LWS_PRE],
+ wsi->ws->close_in_ping_buffer_len,
+ LWS_WRITE_CLOSE);
+ if (n >= 0) {
+ if (wsi->close_needs_ack) {
+ lwsi_set_state(wsi, LRS_AWAITING_CLOSE_ACK);
+ lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_ACK, 5);
+ lwsl_debug("sent close indication, awaiting ack\n");
+
+ return LWS_HP_RET_BAIL_OK;
+ }
+ wsi->close_needs_ack = 0;
+ lwsi_set_state(wsi, LRS_RETURNED_CLOSE);
+ }
+
+ return LWS_HP_RET_BAIL_DIE;
+ }
+
+ /* else, the send failed and we should just hang up */
+
+ if ((lwsi_role_ws(wsi) && wsi->ws->ping_pending_flag) ||
+ (lwsi_state(wsi) == LRS_RETURNED_CLOSE &&
+ wsi->ws->payload_is_close)) {
+
+ if (wsi->ws->payload_is_close)
+ write_type = LWS_WRITE_CLOSE;
+ else {
+ if (wsi->wsistate_pre_close) {
+ /* we started close flow, forget pong */
+ wsi->ws->ping_pending_flag = 0;
+ return LWS_HP_RET_BAIL_OK;
+ }
+ lwsl_info("issuing pong %d on wsi %p\n", wsi->ws->ping_payload_len, wsi);
+ }
+
+ n = lws_write(wsi, &wsi->ws->ping_payload_buf[LWS_PRE],
+ wsi->ws->ping_payload_len, write_type);
+ if (n < 0)
+ return LWS_HP_RET_BAIL_DIE;
+
+ /* well he is sent, mark him done */
+ wsi->ws->ping_pending_flag = 0;
+ if (wsi->ws->payload_is_close) {
+ // assert(0);
+ /* oh... a close frame was it... then we are done */
+ return LWS_HP_RET_BAIL_DIE;
+ }
+
+ /* otherwise for PING, leave POLLOUT active either way */
+ return LWS_HP_RET_BAIL_OK;
+ }
+
+ if (lwsi_role_client(wsi) && !wsi->socket_is_permanently_unusable &&
+ wsi->ws->send_check_ping) {
+
+ lwsl_info("issuing ping on wsi %p\n", wsi);
+ wsi->ws->send_check_ping = 0;
+ n = lws_write(wsi, &wsi->ws->ping_payload_buf[LWS_PRE],
+ 0, LWS_WRITE_PING);
+ if (n < 0)
+ return LWS_HP_RET_BAIL_DIE;
+
+ /*
+ * we apparently were able to send the PING in a reasonable time
+ * now reset the clock on our peer to be able to send the
+ * PONG in a reasonable time.
+ */
+
+ lws_set_timeout(wsi, PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG,
+ wsi->context->timeout_secs);
+
+ return LWS_HP_RET_BAIL_OK;
+ }
+
+ /* Priority 4: if we are closing, not allowed to send more data frags
+ * which means user callback or tx ext flush banned now
+ */
+ if (lwsi_state(wsi) == LRS_RETURNED_CLOSE)
+ return LWS_HP_RET_USER_SERVICE;
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ /* Priority 5: Tx path extension with more to send
+ *
+ * These are handled as new fragments each time around
+ * So while we must block new writeable callback to enforce
+ * payload ordering, but since they are always complete
+ * fragments control packets can interleave OK.
+ */
+ if (lwsi_role_client(wsi) && wsi->ws->tx_draining_ext) {
+ lwsl_ext("SERVICING TX EXT DRAINING\n");
+ if (lws_write(wsi, NULL, 0, LWS_WRITE_CONTINUATION) < 0)
+ return LWS_HP_RET_BAIL_DIE;
+ /* leave POLLOUT active */
+ return LWS_HP_RET_BAIL_OK;
+ }
+
+ /* Priority 6: extensions
+ */
+ if (!wsi->ws->extension_data_pending)
+ return LWS_HP_RET_USER_SERVICE;
+
+ /*
+ * check in on the active extensions, see if they
+ * had pending stuff to spill... they need to get the
+ * first look-in otherwise sequence will be disordered
+ *
+ * NULL, zero-length ebuf means just spill pending
+ */
+
+ ret = 1;
+ if (wsi->role_ops == &role_ops_raw_skt ||
+ wsi->role_ops == &role_ops_raw_file)
+ ret = 0;
+
+ while (ret == 1) {
+
+ /* default to nobody has more to spill */
+
+ ret = 0;
+ ebuf.token = NULL;
+ ebuf.len = 0;
+
+ /* give every extension a chance to spill */
+
+ m = lws_ext_cb_active(wsi, LWS_EXT_CB_PACKET_TX_PRESEND,
+ &ebuf, 0);
+ if (m < 0) {
+ lwsl_err("ext reports fatal error\n");
+ return LWS_HP_RET_BAIL_DIE;
+ }
+ if (m)
+ /*
+ * at least one extension told us he has more
+ * to spill, so we will go around again after
+ */
+ ret = 1;
+
+ /* assuming they gave us something to send, send it */
+
+ if (ebuf.len) {
+ n = lws_issue_raw(wsi, (unsigned char *)ebuf.token,
+ ebuf.len);
+ if (n < 0) {
+ lwsl_info("closing from POLLOUT spill\n");
+ return LWS_HP_RET_BAIL_DIE;
+ }
+ /*
+ * Keep amount spilled small to minimize chance of this
+ */
+ if (n != ebuf.len) {
+ lwsl_err("Unable to spill ext %d vs %d\n",
+ ebuf.len, n);
+ return LWS_HP_RET_BAIL_DIE;
+ }
+ } else
+ continue;
+
+ /* no extension has more to spill */
+
+ if (!ret)
+ continue;
+
+ /*
+ * There's more to spill from an extension, but we just sent
+ * something... did that leave the pipe choked?
+ */
+
+ if (!lws_send_pipe_choked(wsi))
+ /* no we could add more */
+ continue;
+
+ lwsl_info("choked in POLLOUT service\n");
+
+ /*
+ * Yes, he's choked. Leave the POLLOUT masked on so we will
+ * come back here when he is unchoked. Don't call the user
+ * callback to enforce ordering of spilling, he'll get called
+ * when we come back here and there's nothing more to spill.
+ */
+
+ return LWS_HP_RET_BAIL_OK;
+ }
+
+ wsi->ws->extension_data_pending = 0;
+#endif
+
+ return LWS_HP_RET_USER_SERVICE;
+}
+
+static int
+rops_periodic_checks_ws(struct lws_context *context, int tsi, time_t now)
+{
+ struct lws_vhost *vh;
+
+ if (!context->ws_ping_pong_interval ||
+ context->last_ws_ping_pong_check_s >= now + 10)
+ return 0;
+
+ vh = context->vhost_list;
+ context->last_ws_ping_pong_check_s = now;
+
+ while (vh) {
+ int n;
+
+ lws_vhost_lock(vh);
+
+ for (n = 0; n < vh->count_protocols; n++) {
+ struct lws *wsi = vh->same_vh_protocol_list[n];
+
+ while (wsi) {
+ if (lwsi_role_ws(wsi) &&
+ !wsi->socket_is_permanently_unusable &&
+ !wsi->ws->send_check_ping &&
+ wsi->ws->time_next_ping_check &&
+ lws_compare_time_t(context, now,
+ wsi->ws->time_next_ping_check) >
+ context->ws_ping_pong_interval) {
+
+ lwsl_info("req pp on wsi %p\n",
+ wsi);
+ wsi->ws->send_check_ping = 1;
+ lws_set_timeout(wsi,
+ PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
+ context->timeout_secs);
+ lws_callback_on_writable(wsi);
+ wsi->ws->time_next_ping_check =
+ now;
+ }
+ wsi = wsi->same_vh_protocol_next;
+ }
+ }
+
+ lws_vhost_unlock(vh);
+ vh = vh->vhost_next;
+ }
+
+ return 0;
+}
+
+static int
+rops_service_flag_pending_ws(struct lws_context *context, int tsi)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_context_per_thread *pt = &context->pt[tsi];
+ struct lws *wsi;
+ int forced = 0;
+
+ /* POLLIN faking (the pt lock is taken by the parent) */
+
+ /*
+ * 1) For all guys with already-available ext data to drain, if they are
+ * not flowcontrolled, fake their POLLIN status
+ */
+ wsi = pt->ws.rx_draining_ext_list;
+ while (wsi && wsi->position_in_fds_table != LWS_NO_FDS_POS) {
+ pt->fds[wsi->position_in_fds_table].revents |=
+ pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
+ if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN)
+ forced = 1;
+
+ wsi = wsi->ws->rx_draining_ext_list;
+ }
+
+ return forced;
+#else
+ return 0;
+#endif
+}
+
+static int
+rops_close_via_role_protocol_ws(struct lws *wsi, enum lws_close_status reason)
+{
+ if (!wsi->ws->close_in_ping_buffer_len && /* already a reason */
+ (reason == LWS_CLOSE_STATUS_NOSTATUS ||
+ reason == LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY))
+ return 0;
+
+ lwsl_debug("%s: sending close indication...\n", __func__);
+
+ /* if no prepared close reason, use 1000 and no aux data */
+
+ if (!wsi->ws->close_in_ping_buffer_len) {
+ wsi->ws->close_in_ping_buffer_len = 2;
+ wsi->ws->ping_payload_buf[LWS_PRE] = (reason >> 8) & 0xff;
+ wsi->ws->ping_payload_buf[LWS_PRE + 1] = reason & 0xff;
+ }
+
+ wsi->waiting_to_send_close_frame = 1;
+ wsi->close_needs_ack = 1;
+ lwsi_set_state(wsi, LRS_WAITING_TO_SEND_CLOSE);
+ __lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_SEND, 5);
+
+ lws_callback_on_writable(wsi);
+
+ return 1;
+}
+
+static int
+rops_close_role_ws(struct lws_context_per_thread *pt, struct lws *wsi)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext) {
+ struct lws **w = &pt->ws.rx_draining_ext_list;
+
+ wsi->ws->rx_draining_ext = 0;
+ /* remove us from context draining ext list */
+ while (*w) {
+ if (*w == wsi) {
+ *w = wsi->ws->rx_draining_ext_list;
+ break;
+ }
+ w = &((*w)->ws->rx_draining_ext_list);
+ }
+ wsi->ws->rx_draining_ext_list = NULL;
+ }
+
+ if (wsi->ws->tx_draining_ext) {
+ struct lws **w = &pt->ws.tx_draining_ext_list;
+ lwsl_notice("%s: CLEARING tx_draining_ext\n", __func__);
+ wsi->ws->tx_draining_ext = 0;
+ /* remove us from context draining ext list */
+ while (*w) {
+ if (*w == wsi) {
+ *w = wsi->ws->tx_draining_ext_list;
+ break;
+ }
+ w = &((*w)->ws->tx_draining_ext_list);
+ }
+ wsi->ws->tx_draining_ext_list = NULL;
+ }
+#endif
+ lws_free_set_NULL(wsi->ws->rx_ubuf);
+
+ if (wsi->trunc_alloc)
+ /* not going to be completed... nuke it */
+ lws_free_set_NULL(wsi->trunc_alloc);
+
+ wsi->ws->ping_payload_len = 0;
+ wsi->ws->ping_pending_flag = 0;
+
+ /* deallocate any active extension contexts */
+
+ if (lws_ext_cb_active(wsi, LWS_EXT_CB_DESTROY, NULL, 0) < 0)
+ lwsl_warn("extension destruction failed\n");
+
+ return 0;
+}
+
+static int
+rops_write_role_protocol_ws(struct lws *wsi, unsigned char *buf, size_t len,
+ enum lws_write_protocol *wp)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ enum lws_write_protocol wpt;
+#endif
+ int masked7 = lwsi_role_client(wsi);
+ unsigned char is_masked_bit = 0;
+ unsigned char *dropmask = NULL;
+ struct lws_tokens ebuf;
+ size_t orig_len = len;
+ int pre = 0, n = 0;
+
+ // lwsl_err("%s: wp 0x%x len %d\n", __func__, *wp, (int)len);
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->tx_draining_ext) {
+ /* remove us from the list */
+ struct lws **w = &pt->ws.tx_draining_ext_list;
+
+ lwsl_notice("%s: CLEARING tx_draining_ext\n", __func__);
+ wsi->ws->tx_draining_ext = 0;
+ /* remove us from context draining ext list */
+ while (*w) {
+ if (*w == wsi) {
+ *w = wsi->ws->tx_draining_ext_list;
+ break;
+ }
+ w = &((*w)->ws->tx_draining_ext_list);
+ }
+ wsi->ws->tx_draining_ext_list = NULL;
+
+ wpt = *wp;
+ *wp = (wsi->ws->tx_draining_stashed_wp & 0xc0)|
+ LWS_WRITE_CONTINUATION;
+
+ /*
+ * When we are just flushing (len == 0), we can trust the
+ * stashed wp info completely. Otherwise adjust it to the
+ * FIN status of the incoming packet.
+ */
+
+ if (!(wpt & LWS_WRITE_NO_FIN) && len)
+ *wp &= ~LWS_WRITE_NO_FIN;
+
+ lwsl_notice("FORCED draining wp to 0x%02X (stashed 0x%02X, incoming 0x%02X)\n", *wp,
+ wsi->ws->tx_draining_stashed_wp, wpt);
+ // assert(0);
+ }
+#endif
+ lws_restart_ws_ping_pong_timer(wsi);
+
+ if (((*wp) & 0x1f) == LWS_WRITE_HTTP ||
+ ((*wp) & 0x1f) == LWS_WRITE_HTTP_FINAL ||
+ ((*wp) & 0x1f) == LWS_WRITE_HTTP_HEADERS_CONTINUATION ||
+ ((*wp) & 0x1f) == LWS_WRITE_HTTP_HEADERS)
+ goto send_raw;
+
+
+
+ /* if we are continuing a frame that already had its header done */
+
+ if (wsi->ws->inside_frame) {
+ lwsl_debug("INSIDE FRAME\n");
+ goto do_more_inside_frame;
+ }
+
+ wsi->ws->clean_buffer = 1;
+
+ /*
+ * give a chance to the extensions to modify payload
+ * the extension may decide to produce unlimited payload erratically
+ * (eg, compression extension), so we require only that if he produces
+ * something, it will be a complete fragment of the length known at
+ * the time (just the fragment length known), and if he has
+ * more we will come back next time he is writeable and allow him to
+ * produce more fragments until he's drained.
+ *
+ * This allows what is sent each time it is writeable to be limited to
+ * a size that can be sent without partial sends or blocking, allows
+ * interleaving of control frames and other connection service.
+ */
+ ebuf.token = (char *)buf;
+ ebuf.len = (int)len;
+
+ switch ((int)*wp) {
+ case LWS_WRITE_PING:
+ case LWS_WRITE_PONG:
+ case LWS_WRITE_CLOSE:
+ break;
+ default:
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ // lwsl_notice("LWS_EXT_CB_PAYLOAD_TX\n");
+ // m = (int)ebuf.len;
+ /* returns 0 if no more tx pending, 1 if more pending */
+ n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_TX, &ebuf, *wp);
+ if (n < 0)
+ return -1;
+ // lwsl_notice("ext processed %d plaintext into %d compressed (wp 0x%x)\n", m, (int)ebuf.len, *wp);
+
+ if (n && ebuf.len) {
+ lwsl_notice("write drain len %d (wp 0x%x) SETTING tx_draining_ext\n", (int)ebuf.len, *wp);
+ /* extension requires further draining */
+ wsi->ws->tx_draining_ext = 1;
+ wsi->ws->tx_draining_ext_list = pt->ws.tx_draining_ext_list;
+ pt->ws.tx_draining_ext_list = wsi;
+ /* we must come back to do more */
+ lws_callback_on_writable(wsi);
+ /*
+ * keep a copy of the write type for the overall
+ * action that has provoked generation of these
+ * fragments, so the last guy can use its FIN state.
+ */
+ wsi->ws->tx_draining_stashed_wp = *wp;
+ /* this is definitely not actually the last fragment
+ * because the extension asserted he has more coming
+ * So make sure this intermediate one doesn't go out
+ * with a FIN.
+ */
+ *wp |= LWS_WRITE_NO_FIN;
+ }
+#endif
+ if (ebuf.len && wsi->ws->stashed_write_pending) {
+ wsi->ws->stashed_write_pending = 0;
+ *wp = ((*wp) & 0xc0) | (int)wsi->ws->stashed_write_type;
+ }
+ }
+
+ /*
+ * an extension did something we need to keep... for example, if
+ * compression extension, it has already updated its state according
+ * to this being issued
+ */
+ if ((char *)buf != ebuf.token) {
+ /*
+ * ext might eat it, but not have anything to issue yet.
+ * In that case we have to follow his lead, but stash and
+ * replace the write type that was lost here the first time.
+ */
+ if (len && !ebuf.len) {
+ if (!wsi->ws->stashed_write_pending)
+ wsi->ws->stashed_write_type = (char)(*wp) & 0x3f;
+ wsi->ws->stashed_write_pending = 1;
+ return (int)len;
+ }
+ /*
+ * extension recreated it:
+ * need to buffer this if not all sent
+ */
+ wsi->ws->clean_buffer = 0;
+ }
+
+ buf = (unsigned char *)ebuf.token;
+ len = ebuf.len;
+
+ if (!buf) {
+ lwsl_err("null buf (%d)\n", (int)len);
+ return -1;
+ }
+
+ switch (wsi->ws->ietf_spec_revision) {
+ case 13:
+ if (masked7) {
+ pre += 4;
+ dropmask = &buf[0 - pre];
+ is_masked_bit = 0x80;
+ }
+
+ switch ((*wp) & 0xf) {
+ case LWS_WRITE_TEXT:
+ n = LWSWSOPC_TEXT_FRAME;
+ break;
+ case LWS_WRITE_BINARY:
+ n = LWSWSOPC_BINARY_FRAME;
+ break;
+ case LWS_WRITE_CONTINUATION:
+ n = LWSWSOPC_CONTINUATION;
+ break;
+
+ case LWS_WRITE_CLOSE:
+ n = LWSWSOPC_CLOSE;
+ break;
+ case LWS_WRITE_PING:
+ n = LWSWSOPC_PING;
+ break;
+ case LWS_WRITE_PONG:
+ n = LWSWSOPC_PONG;
+ break;
+ default:
+ lwsl_warn("lws_write: unknown write opc / wp\n");
+ return -1;
+ }
+
+ if (!((*wp) & LWS_WRITE_NO_FIN))
+ n |= 1 << 7;
+
+ if (len < 126) {
+ pre += 2;
+ buf[-pre] = n;
+ buf[-pre + 1] = (unsigned char)(len | is_masked_bit);
+ } else {
+ if (len < 65536) {
+ pre += 4;
+ buf[-pre] = n;
+ buf[-pre + 1] = 126 | is_masked_bit;
+ buf[-pre + 2] = (unsigned char)(len >> 8);
+ buf[-pre + 3] = (unsigned char)len;
+ } else {
+ pre += 10;
+ buf[-pre] = n;
+ buf[-pre + 1] = 127 | is_masked_bit;
+#if defined __LP64__
+ buf[-pre + 2] = (len >> 56) & 0x7f;
+ buf[-pre + 3] = len >> 48;
+ buf[-pre + 4] = len >> 40;
+ buf[-pre + 5] = len >> 32;
+#else
+ buf[-pre + 2] = 0;
+ buf[-pre + 3] = 0;
+ buf[-pre + 4] = 0;
+ buf[-pre + 5] = 0;
+#endif
+ buf[-pre + 6] = (unsigned char)(len >> 24);
+ buf[-pre + 7] = (unsigned char)(len >> 16);
+ buf[-pre + 8] = (unsigned char)(len >> 8);
+ buf[-pre + 9] = (unsigned char)len;
+ }
+ }
+ break;
+ }
+
+do_more_inside_frame:
+
+ /*
+ * Deal with masking if we are in client -> server direction and
+ * the wp demands it
+ */
+
+ if (masked7) {
+ if (!wsi->ws->inside_frame)
+ if (lws_0405_frame_mask_generate(wsi)) {
+ lwsl_err("frame mask generation failed\n");
+ return -1;
+ }
+
+ /*
+ * in v7, just mask the payload
+ */
+ if (dropmask) { /* never set if already inside frame */
+ for (n = 4; n < (int)len + 4; n++)
+ dropmask[n] = dropmask[n] ^ wsi->ws->mask[
+ (wsi->ws->mask_idx++) & 3];
+
+ /* copy the frame nonce into place */
+ memcpy(dropmask, wsi->ws->mask, 4);
+ }
+ }
+
+ if (lwsi_role_h2_ENCAPSULATION(wsi)) {
+ struct lws *encap = lws_get_network_wsi(wsi);
+
+ assert(encap != wsi);
+ return encap->role_ops->write_role_protocol(wsi, buf - pre,
+ len + pre, wp);
+ }
+
+ switch ((*wp) & 0x1f) {
+ case LWS_WRITE_TEXT:
+ case LWS_WRITE_BINARY:
+ case LWS_WRITE_CONTINUATION:
+ if (!wsi->h2_stream_carries_ws) {
+
+ /*
+ * give any active extensions a chance to munge the
+ * buffer before send. We pass in a pointer to an
+ * lws_tokens struct prepared with the default buffer
+ * and content length that's in there. Rather than
+ * rewrite the default buffer, extensions that expect
+ * to grow the buffer can adapt .token to point to their
+ * own per-connection buffer in the extension user
+ * allocation. By default with no extensions or no
+ * extension callback handling, just the normal input
+ * buffer is used then so it is efficient.
+ *
+ * callback returns 1 in case it wants to spill more
+ * buffers
+ *
+ * This takes care of holding the buffer if send is
+ * incomplete, ie, if wsi->ws->clean_buffer is 0
+ * (meaning an extension meddled with the buffer). If
+ * wsi->ws->clean_buffer is 1, it will instead return
+ * to the user code how much OF THE USER BUFFER was
+ * consumed.
+ */
+
+ n = lws_issue_raw_ext_access(wsi, buf - pre, len + pre);
+ wsi->ws->inside_frame = 1;
+ if (n <= 0)
+ return n;
+
+ if (n == (int)len + pre) {
+ /* everything in the buffer was handled
+ * (or rebuffered...) */
+ wsi->ws->inside_frame = 0;
+ return (int)orig_len;
+ }
+
+ /*
+ * it is how many bytes of user buffer got sent... may
+ * be < orig_len in which case callback when writable
+ * has already been arranged and user code can call
+ * lws_write() again with the rest later.
+ */
+
+ return n - pre;
+ }
+ break;
+ default:
+ break;
+ }
+
+send_raw:
+ return lws_issue_raw(wsi, (unsigned char *)buf - pre, len + pre);
+}
+
+static int
+rops_close_kill_connection_ws(struct lws *wsi, enum lws_close_status reason)
+{
+ /* deal with ws encapsulation in h2 */
+#if defined(LWS_WITH_HTTP2)
+ if (wsi->http2_substream && wsi->h2_stream_carries_ws)
+ return role_ops_h2.close_kill_connection(wsi, reason);
+
+ return 0;
+#else
+ return 0;
+#endif
+}
+
+static int
+rops_callback_on_writable_ws(struct lws *wsi)
+{
+#if defined(LWS_WITH_HTTP2)
+ if (lwsi_role_h2_ENCAPSULATION(wsi)) {
+ /* we know then that it has an h2 parent */
+ struct lws *enc = role_ops_h2.encapsulation_parent(wsi);
+
+ assert(enc);
+ if (enc->role_ops->callback_on_writable(wsi))
+ return 1;
+ }
+#endif
+ return 0;
+}
+
+static int
+rops_init_vhost_ws(struct lws_vhost *vh,
+ const struct lws_context_creation_info *info)
+{
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+#ifdef LWS_WITH_PLUGINS
+ struct lws_plugin *plugin = vh->context->plugin_list;
+ int m;
+
+ if (vh->context->plugin_extension_count) {
+
+ m = 0;
+ while (info->extensions && info->extensions[m].callback)
+ m++;
+
+ /*
+ * give the vhost a unified list of extensions including the
+ * ones that came from plugins
+ */
+ vh->ws.extensions = lws_zalloc(sizeof(struct lws_extension) *
+ (m + vh->context->plugin_extension_count + 1),
+ "extensions");
+ if (!vh->ws.extensions)
+ return 1;
+
+ memcpy((struct lws_extension *)vh->ws.extensions, info->extensions,
+ sizeof(struct lws_extension) * m);
+ plugin = vh->context->plugin_list;
+ while (plugin) {
+ memcpy((struct lws_extension *)&vh->ws.extensions[m],
+ plugin->caps.extensions,
+ sizeof(struct lws_extension) *
+ plugin->caps.count_extensions);
+ m += plugin->caps.count_extensions;
+ plugin = plugin->list;
+ }
+ } else
+#endif
+ vh->ws.extensions = info->extensions;
+#endif
+
+ return 0;
+}
+
+static int
+rops_destroy_vhost_ws(struct lws_vhost *vh)
+{
+#ifdef LWS_WITH_PLUGINS
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (vh->context->plugin_extension_count)
+ lws_free((void *)vh->ws.extensions);
+#endif
+#endif
+
+ return 0;
+}
+
+static int
+rops_destroy_role_ws(struct lws *wsi)
+{
+ lws_free_set_NULL(wsi->ws);
+
+ return 0;
+}
+
+struct lws_role_ops role_ops_ws = {
+ /* role name */ "ws",
+ /* alpn id */ NULL,
+ /* check_upgrades */ NULL,
+ /* init_context */ NULL,
+ /* init_vhost */ rops_init_vhost_ws,
+ /* destroy_vhost */ rops_destroy_vhost_ws,
+ /* periodic_checks */ rops_periodic_checks_ws,
+ /* service_flag_pending */ rops_service_flag_pending_ws,
+ /* handle_POLLIN */ rops_handle_POLLIN_ws,
+ /* handle_POLLOUT */ rops_handle_POLLOUT_ws,
+ /* perform_user_POLLOUT */ NULL,
+ /* callback_on_writable */ rops_callback_on_writable_ws,
+ /* tx_credit */ NULL,
+ /* write_role_protocol */ rops_write_role_protocol_ws,
+ /* encapsulation_parent */ NULL,
+ /* alpn_negotiated */ NULL,
+ /* close_via_role_protocol */ rops_close_via_role_protocol_ws,
+ /* close_role */ rops_close_role_ws,
+ /* close_kill_connection */ rops_close_kill_connection_ws,
+ /* destroy_role */ rops_destroy_role_ws,
+ /* writeable cb clnt, srv */ { LWS_CALLBACK_CLIENT_WRITEABLE,
+ LWS_CALLBACK_SERVER_WRITEABLE },
+ /* close cb clnt, srv */ { LWS_CALLBACK_CLIENT_CLOSED,
+ LWS_CALLBACK_CLOSED },
+ /* file handles */ 0
+};
diff --git a/thirdparty/libwebsockets/roles/ws/private.h b/thirdparty/libwebsockets/roles/ws/private.h
new file mode 100644
index 0000000000..71ffcaea96
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/ws/private.h
@@ -0,0 +1,164 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h if LWS_ROLE_WS
+ */
+
+extern struct lws_role_ops role_ops_ws;
+
+#define lwsi_role_ws(wsi) (wsi->role_ops == &role_ops_ws)
+
+enum lws_rx_parse_state {
+ LWS_RXPS_NEW,
+
+ LWS_RXPS_04_mask_1,
+ LWS_RXPS_04_mask_2,
+ LWS_RXPS_04_mask_3,
+
+ LWS_RXPS_04_FRAME_HDR_1,
+ LWS_RXPS_04_FRAME_HDR_LEN,
+ LWS_RXPS_04_FRAME_HDR_LEN16_2,
+ LWS_RXPS_04_FRAME_HDR_LEN16_1,
+ LWS_RXPS_04_FRAME_HDR_LEN64_8,
+ LWS_RXPS_04_FRAME_HDR_LEN64_7,
+ LWS_RXPS_04_FRAME_HDR_LEN64_6,
+ LWS_RXPS_04_FRAME_HDR_LEN64_5,
+ LWS_RXPS_04_FRAME_HDR_LEN64_4,
+ LWS_RXPS_04_FRAME_HDR_LEN64_3,
+ LWS_RXPS_04_FRAME_HDR_LEN64_2,
+ LWS_RXPS_04_FRAME_HDR_LEN64_1,
+
+ LWS_RXPS_07_COLLECT_FRAME_KEY_1,
+ LWS_RXPS_07_COLLECT_FRAME_KEY_2,
+ LWS_RXPS_07_COLLECT_FRAME_KEY_3,
+ LWS_RXPS_07_COLLECT_FRAME_KEY_4,
+
+ LWS_RXPS_WS_FRAME_PAYLOAD
+};
+
+enum lws_websocket_opcodes_07 {
+ LWSWSOPC_CONTINUATION = 0,
+ LWSWSOPC_TEXT_FRAME = 1,
+ LWSWSOPC_BINARY_FRAME = 2,
+
+ LWSWSOPC_NOSPEC__MUX = 7,
+
+ /* control extensions 8+ */
+
+ LWSWSOPC_CLOSE = 8,
+ LWSWSOPC_PING = 9,
+ LWSWSOPC_PONG = 0xa,
+};
+
+/* this is not usable directly by user code any more, lws_close_reason() */
+#define LWS_WRITE_CLOSE 4
+
+#define ALREADY_PROCESSED_IGNORE_CHAR 1
+#define ALREADY_PROCESSED_NO_CB 2
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+struct lws_vhost_role_ws {
+ const struct lws_extension *extensions;
+};
+
+struct lws_pt_role_ws {
+ struct lws *rx_draining_ext_list;
+ struct lws *tx_draining_ext_list;
+};
+#endif
+
+struct _lws_websocket_related {
+ char *rx_ubuf;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ const struct lws_extension *active_extensions[LWS_MAX_EXTENSIONS_ACTIVE];
+ void *act_ext_user[LWS_MAX_EXTENSIONS_ACTIVE];
+ struct lws *rx_draining_ext_list;
+ struct lws *tx_draining_ext_list;
+#endif
+ /* Also used for close content... control opcode == < 128 */
+ uint8_t ping_payload_buf[128 - 3 + LWS_PRE];
+ uint8_t mask[4];
+
+ time_t time_next_ping_check;
+ size_t rx_packet_length;
+ uint32_t rx_ubuf_head;
+ uint32_t rx_ubuf_alloc;
+
+ uint8_t ping_payload_len;
+ uint8_t mask_idx;
+ uint8_t opcode;
+ uint8_t rsv;
+ uint8_t rsv_first_msg;
+ /* zero if no info, or length including 2-byte close code */
+ uint8_t close_in_ping_buffer_len;
+ uint8_t utf8;
+ uint8_t stashed_write_type;
+ uint8_t tx_draining_stashed_wp;
+ uint8_t ietf_spec_revision;
+
+ unsigned int final:1;
+ unsigned int frame_is_binary:1;
+ unsigned int all_zero_nonce:1;
+ unsigned int this_frame_masked:1;
+ unsigned int inside_frame:1; /* next write will be more of frame */
+ unsigned int clean_buffer:1; /* buffer not rewritten by extension */
+ unsigned int payload_is_close:1; /* process as PONG, but it is close */
+ unsigned int ping_pending_flag:1;
+ unsigned int continuation_possible:1;
+ unsigned int owed_a_fin:1;
+ unsigned int check_utf8:1;
+ unsigned int defeat_check_utf8:1;
+ unsigned int stashed_write_pending:1;
+ unsigned int send_check_ping:1;
+ unsigned int first_fragment:1;
+ unsigned int peer_has_sent_close:1;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ unsigned int extension_data_pending:1;
+ unsigned int rx_draining_ext:1;
+ unsigned int tx_draining_ext:1;
+
+ uint8_t count_act_ext;
+#endif
+};
+
+int
+lws_ws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len);
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+LWS_VISIBLE void
+lws_context_init_extensions(const struct lws_context_creation_info *info,
+ struct lws_context *context);
+LWS_EXTERN int
+lws_any_extension_handled(struct lws *wsi, enum lws_extension_callback_reasons r,
+ void *v, size_t len);
+
+LWS_EXTERN int
+lws_ext_cb_active(struct lws *wsi, int reason, void *buf, int len);
+LWS_EXTERN int
+lws_ext_cb_all_exts(struct lws_context *context, struct lws *wsi, int reason,
+ void *arg, int len);
+#endif
+
+int
+handshake_0405(struct lws_context *context, struct lws *wsi);
+int
+lws_process_ws_upgrade(struct lws *wsi);
+int
+lws_server_init_wsi_for_ws(struct lws *wsi);
diff --git a/thirdparty/libwebsockets/roles/ws/server-ws.c b/thirdparty/libwebsockets/roles/ws/server-ws.c
new file mode 100644
index 0000000000..62bcd8524f
--- /dev/null
+++ b/thirdparty/libwebsockets/roles/ws/server-ws.c
@@ -0,0 +1,836 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <core/private.h>
+
+#define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); }
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+static int
+lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ char ext_name[64], *args, *end = (*p) + budget - 1;
+ const struct lws_ext_options *opts, *po;
+ const struct lws_extension *ext;
+ struct lws_ext_option_arg oa;
+ int n, m, more = 1;
+ int ext_count = 0;
+ char ignore;
+ char *c;
+
+ /*
+ * Figure out which extensions the client has that we want to
+ * enable on this connection, and give him back the list
+ */
+ if (!lws_hdr_total_length(wsi, WSI_TOKEN_EXTENSIONS))
+ return 0;
+
+ /*
+ * break down the list of client extensions
+ * and go through them
+ */
+
+ if (lws_hdr_copy(wsi, (char *)pt->serv_buf, context->pt_serv_buf_size,
+ WSI_TOKEN_EXTENSIONS) < 0)
+ return 1;
+
+ c = (char *)pt->serv_buf;
+ lwsl_parser("WSI_TOKEN_EXTENSIONS = '%s'\n", c);
+ wsi->ws->count_act_ext = 0;
+ ignore = 0;
+ n = 0;
+ args = NULL;
+
+ /*
+ * We may get a simple request
+ *
+ * Sec-WebSocket-Extensions: permessage-deflate
+ *
+ * or an elaborated one with requested options
+ *
+ * Sec-WebSocket-Extensions: permessage-deflate; \
+ * server_no_context_takeover; \
+ * client_no_context_takeover
+ */
+
+ while (more) {
+
+ if (c >= (char *)pt->serv_buf + 255)
+ return -1;
+
+ if (*c && (*c != ',' && *c != '\t')) {
+ if (*c == ';') {
+ ignore = 1;
+ if (!args)
+ args = c + 1;
+ }
+ if (ignore || *c == ' ') {
+ c++;
+ continue;
+ }
+ ext_name[n] = *c++;
+ if (n < (int)sizeof(ext_name) - 1)
+ n++;
+ continue;
+ }
+ ext_name[n] = '\0';
+
+ ignore = 0;
+ if (!*c)
+ more = 0;
+ else {
+ c++;
+ if (!n)
+ continue;
+ }
+
+ while (args && *args && *args == ' ')
+ args++;
+
+ /* check a client's extension against our support */
+
+ ext = wsi->vhost->ws.extensions;
+
+ while (ext && ext->callback) {
+
+ if (strcmp(ext_name, ext->name)) {
+ ext++;
+ continue;
+ }
+
+ /*
+ * oh, we do support this one he asked for... but let's
+ * confirm he only gave it once
+ */
+ for (m = 0; m < wsi->ws->count_act_ext; m++)
+ if (wsi->ws->active_extensions[m] == ext) {
+ lwsl_info("extension mentioned twice\n");
+ return 1; /* shenanigans */
+ }
+
+ /*
+ * ask user code if it's OK to apply it on this
+ * particular connection + protocol
+ */
+ m = (wsi->protocol->callback)(wsi,
+ LWS_CALLBACK_CONFIRM_EXTENSION_OKAY,
+ wsi->user_space, ext_name, 0);
+
+ /*
+ * zero return from callback means go ahead and allow
+ * the extension, it's what we get if the callback is
+ * unhandled
+ */
+ if (m) {
+ ext++;
+ continue;
+ }
+
+ /* apply it */
+
+ ext_count++;
+
+ /* instantiate the extension on this conn */
+
+ wsi->ws->active_extensions[wsi->ws->count_act_ext] = ext;
+
+ /* allow him to construct his context */
+
+ if (ext->callback(lws_get_context(wsi), ext, wsi,
+ LWS_EXT_CB_CONSTRUCT,
+ (void *)&wsi->ws->act_ext_user[
+ wsi->ws->count_act_ext],
+ (void *)&opts, 0)) {
+ lwsl_info("ext %s failed construction\n",
+ ext_name);
+ ext_count--;
+ ext++;
+
+ continue;
+ }
+
+ if (ext_count > 1)
+ *(*p)++ = ',';
+ else
+ LWS_CPYAPP(*p,
+ "\x0d\x0aSec-WebSocket-Extensions: ");
+ *p += lws_snprintf(*p, (end - *p), "%s", ext_name);
+
+ /*
+ * The client may send a bunch of different option
+ * sets for the same extension, we are supposed to
+ * pick one we like the look of. The option sets are
+ * separated by comma.
+ *
+ * Actually we just either accept the first one or
+ * nothing.
+ *
+ * Go through the options trying to apply the
+ * recognized ones
+ */
+
+ lwsl_info("ext args %s\n", args);
+
+ while (args && *args && *args != ',') {
+ while (*args == ' ')
+ args++;
+ po = opts;
+ while (po->name) {
+ /* only support arg-less options... */
+ if (po->type != EXTARG_NONE ||
+ strncmp(args, po->name,
+ strlen(po->name))) {
+ po++;
+ continue;
+ }
+ oa.option_name = NULL;
+ oa.option_index = (int)(po - opts);
+ oa.start = NULL;
+ oa.len = 0;
+ lwsl_info("setting '%s'\n", po->name);
+ if (!ext->callback(lws_get_context(wsi),
+ ext, wsi,
+ LWS_EXT_CB_OPTION_SET,
+ wsi->ws->act_ext_user[
+ wsi->ws->count_act_ext],
+ &oa, (end - *p))) {
+
+ *p += lws_snprintf(*p, (end - *p),
+ "; %s", po->name);
+ lwsl_debug("adding option %s\n",
+ po->name);
+ }
+ po++;
+ }
+ while (*args && *args != ',' && *args != ';')
+ args++;
+
+ if (*args == ';')
+ args++;
+ }
+
+ wsi->ws->count_act_ext++;
+ lwsl_parser("cnt_act_ext <- %d\n", wsi->ws->count_act_ext);
+
+ if (args && *args == ',')
+ more = 0;
+
+ ext++;
+ }
+
+ n = 0;
+ args = NULL;
+ }
+
+ return 0;
+}
+#endif
+
+
+
+int
+lws_process_ws_upgrade(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ char protocol_list[128], protocol_name[64], *p;
+ int protocol_len, hit, n = 0, non_space_char_found = 0;
+
+ if (!wsi->protocol)
+ lwsl_err("NULL protocol at lws_read\n");
+
+ /*
+ * It's either websocket or h2->websocket
+ *
+ * Select the first protocol we support from the list
+ * the client sent us.
+ *
+ * Copy it to remove header fragmentation
+ */
+
+ if (lws_hdr_copy(wsi, protocol_list, sizeof(protocol_list) - 1,
+ WSI_TOKEN_PROTOCOL) < 0) {
+ lwsl_err("protocol list too long");
+ return 1;
+ }
+
+ protocol_len = lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL);
+ protocol_list[protocol_len] = '\0';
+ p = protocol_list;
+ hit = 0;
+
+ while (*p && !hit) {
+ n = 0;
+ non_space_char_found = 0;
+ while (n < (int)sizeof(protocol_name) - 1 &&
+ *p && *p != ',') {
+ /* ignore leading spaces */
+ if (!non_space_char_found && *p == ' ') {
+ n++;
+ continue;
+ }
+ non_space_char_found = 1;
+ protocol_name[n++] = *p++;
+ }
+ protocol_name[n] = '\0';
+ if (*p)
+ p++;
+
+ lwsl_debug("checking %s\n", protocol_name);
+
+ n = 0;
+ while (wsi->vhost->protocols[n].callback) {
+ lwsl_debug("try %s\n",
+ wsi->vhost->protocols[n].name);
+
+ if (wsi->vhost->protocols[n].name &&
+ !strcmp(wsi->vhost->protocols[n].name,
+ protocol_name)) {
+ wsi->protocol = &wsi->vhost->protocols[n];
+ hit = 1;
+ break;
+ }
+
+ n++;
+ }
+ }
+
+ /* we didn't find a protocol he wanted? */
+
+ if (!hit) {
+ if (lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL)) {
+ lwsl_notice("No protocol from \"%s\" supported\n",
+ protocol_list);
+ return 1;
+ }
+ /*
+ * some clients only have one protocol and
+ * do not send the protocol list header...
+ * allow it and match to the vhost's default
+ * protocol (which itself defaults to zero)
+ */
+ lwsl_info("defaulting to prot handler %d\n",
+ wsi->vhost->default_protocol_index);
+ n = wsi->vhost->default_protocol_index;
+ wsi->protocol = &wsi->vhost->protocols[
+ (int)wsi->vhost->default_protocol_index];
+ }
+
+ /* allocate the ws struct for the wsi */
+ wsi->ws = lws_zalloc(sizeof(*wsi->ws), "ws struct");
+ if (!wsi->ws) {
+ lwsl_notice("OOM\n");
+ return 1;
+ }
+
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_VERSION))
+ wsi->ws->ietf_spec_revision =
+ atoi(lws_hdr_simple_ptr(wsi, WSI_TOKEN_VERSION));
+
+ /* allocate wsi->user storage */
+ if (lws_ensure_user_space(wsi)) {
+ lwsl_notice("problem with user space\n");
+ return 1;
+ }
+
+ /*
+ * Give the user code a chance to study the request and
+ * have the opportunity to deny it
+ */
+ if ((wsi->protocol->callback)(wsi,
+ LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION,
+ wsi->user_space,
+ lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL), 0)) {
+ lwsl_warn("User code denied connection\n");
+ return 1;
+ }
+
+ /*
+ * Perform the handshake according to the protocol version the
+ * client announced
+ */
+
+ switch (wsi->ws->ietf_spec_revision) {
+ default:
+ lwsl_notice("Unknown client spec version %d\n",
+ wsi->ws->ietf_spec_revision);
+ wsi->ws->ietf_spec_revision = 13;
+ //return 1;
+ /* fallthru */
+ case 13:
+#if defined(LWS_WITH_HTTP2)
+ if (wsi->h2_stream_carries_ws) {
+ if (lws_h2_ws_handshake(wsi)) {
+ lwsl_notice("h2 ws handshake failed\n");
+ return 1;
+ }
+ } else
+#endif
+ {
+ lwsl_parser("lws_parse calling handshake_04\n");
+ if (handshake_0405(wsi->context, wsi)) {
+ lwsl_notice("hs0405 has failed the connection\n");
+ return 1;
+ }
+ }
+ break;
+ }
+
+ lws_same_vh_protocol_insert(wsi, n);
+
+ /*
+ * We are upgrading to ws, so http/1.1 + h2 and keepalive + pipelined
+ * header considerations about keeping the ah around no longer apply.
+ *
+ * However it's common for the first ws protocol data to have been
+ * coalesced with the browser upgrade request and to already be in the
+ * ah rx buffer.
+ */
+
+ lws_pt_lock(pt, __func__);
+
+ if (wsi->h2_stream_carries_ws)
+ lws_role_transition(wsi, LWSIFR_SERVER | LWSIFR_P_ENCAP_H2,
+ LRS_ESTABLISHED, &role_ops_ws);
+ else
+ lws_role_transition(wsi, LWSIFR_SERVER, LRS_ESTABLISHED,
+ &role_ops_ws);
+
+ lws_pt_unlock(pt);
+
+ lws_server_init_wsi_for_ws(wsi);
+ lwsl_parser("accepted v%02d connection\n", wsi->ws->ietf_spec_revision);
+
+ lwsl_info("%s: %p: dropping ah on ws upgrade\n", __func__, wsi);
+ lws_header_table_detach(wsi, 1);
+
+ return 0;
+}
+
+int
+handshake_0405(struct lws_context *context, struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ struct lws_process_html_args args;
+ unsigned char hash[20];
+ int n, accept_len;
+ char *response;
+ char *p;
+
+ if (!lws_hdr_total_length(wsi, WSI_TOKEN_HOST) ||
+ !lws_hdr_total_length(wsi, WSI_TOKEN_KEY)) {
+ lwsl_info("handshake_04 missing pieces\n");
+ /* completed header processing, but missing some bits */
+ goto bail;
+ }
+
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_KEY) >= MAX_WEBSOCKET_04_KEY_LEN) {
+ lwsl_warn("Client key too long %d\n", MAX_WEBSOCKET_04_KEY_LEN);
+ goto bail;
+ }
+
+ /*
+ * since key length is restricted above (currently 128), cannot
+ * overflow
+ */
+ n = sprintf((char *)pt->serv_buf,
+ "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
+ lws_hdr_simple_ptr(wsi, WSI_TOKEN_KEY));
+
+ lws_SHA1(pt->serv_buf, n, hash);
+
+ accept_len = lws_b64_encode_string((char *)hash, 20,
+ (char *)pt->serv_buf, context->pt_serv_buf_size);
+ if (accept_len < 0) {
+ lwsl_warn("Base64 encoded hash too long\n");
+ goto bail;
+ }
+
+ /* allocate the per-connection user memory (if any) */
+ if (lws_ensure_user_space(wsi))
+ goto bail;
+
+ /* create the response packet */
+
+ /* make a buffer big enough for everything */
+
+ response = (char *)pt->serv_buf + MAX_WEBSOCKET_04_KEY_LEN + 256 + LWS_PRE;
+ p = response;
+ LWS_CPYAPP(p, "HTTP/1.1 101 Switching Protocols\x0d\x0a"
+ "Upgrade: WebSocket\x0d\x0a"
+ "Connection: Upgrade\x0d\x0a"
+ "Sec-WebSocket-Accept: ");
+ strcpy(p, (char *)pt->serv_buf);
+ p += accept_len;
+
+ /* we can only return the protocol header if:
+ * - one came in, and ... */
+ if (lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL) &&
+ /* - it is not an empty string */
+ wsi->protocol->name &&
+ wsi->protocol->name[0]) {
+ LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: ");
+ p += lws_snprintf(p, 128, "%s", wsi->protocol->name);
+ }
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ /*
+ * Figure out which extensions the client has that we want to
+ * enable on this connection, and give him back the list.
+ *
+ * Give him a limited write bugdet
+ */
+ if (lws_extension_server_handshake(wsi, &p, 192))
+ goto bail;
+#endif
+ LWS_CPYAPP(p, "\x0d\x0a");
+
+ args.p = p;
+ args.max_len = lws_ptr_diff((char *)pt->serv_buf +
+ context->pt_serv_buf_size, p);
+ if (user_callback_handle_rxflow(wsi->protocol->callback, wsi,
+ LWS_CALLBACK_ADD_HEADERS,
+ wsi->user_space, &args, 0))
+ goto bail;
+
+ p = args.p;
+
+ /* end of response packet */
+
+ LWS_CPYAPP(p, "\x0d\x0a");
+
+ /* okay send the handshake response accepting the connection */
+
+ lwsl_parser("issuing resp pkt %d len\n",
+ lws_ptr_diff(p, response));
+#if defined(DEBUG)
+ fwrite(response, 1, p - response, stderr);
+#endif
+ n = lws_write(wsi, (unsigned char *)response, p - response,
+ LWS_WRITE_HTTP_HEADERS);
+ if (n != (p - response)) {
+ lwsl_info("%s: ERROR writing to socket %d\n", __func__, n);
+ goto bail;
+ }
+
+ /* alright clean up and set ourselves into established state */
+
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ wsi->lws_rx_parse_state = LWS_RXPS_NEW;
+
+ {
+ const char * uri_ptr =
+ lws_hdr_simple_ptr(wsi, WSI_TOKEN_GET_URI);
+ int uri_len = lws_hdr_total_length(wsi, WSI_TOKEN_GET_URI);
+ const struct lws_http_mount *hit =
+ lws_find_mount(wsi, uri_ptr, uri_len);
+ if (hit && hit->cgienv &&
+ wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_PMO,
+ wsi->user_space, (void *)hit->cgienv, 0))
+ return 1;
+ }
+
+ return 0;
+
+bail:
+ /* caller will free up his parsing allocations */
+ return -1;
+}
+
+
+
+/*
+ * Once we reach LWS_RXPS_WS_FRAME_PAYLOAD, we know how much
+ * to expect in that state and can deal with it in bulk more efficiently.
+ */
+
+static int
+lws_ws_frame_rest_is_payload(struct lws *wsi, uint8_t **buf, size_t len)
+{
+ uint8_t *buffer = *buf, mask[4];
+ struct lws_tokens ebuf;
+ unsigned int avail = (unsigned int)len;
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ unsigned int old_packet_length = (int)wsi->ws->rx_packet_length;
+#endif
+ int n = 0;
+
+ /*
+ * With zlib, we can give it as much input as we like. The pmd
+ * extension will draw it down in chunks (default 1024).
+ *
+ * If we try to restrict how much we give it, because we must go
+ * back to the event loop each time, we will drop the remainder...
+ */
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (!wsi->ws->count_act_ext)
+#endif
+ {
+ if (wsi->protocol->rx_buffer_size)
+ avail = (int)wsi->protocol->rx_buffer_size;
+ else
+ avail = wsi->context->pt_serv_buf_size;
+ }
+
+ /* do not consume more than we should */
+ if (avail > wsi->ws->rx_packet_length)
+ avail = (unsigned int)wsi->ws->rx_packet_length;
+
+ /* do not consume more than what is in the buffer */
+ if (avail > len)
+ avail = (unsigned int)len;
+
+ if (avail <= 0)
+ return 0;
+
+ ebuf.token = (char *)buffer;
+ ebuf.len = avail;
+
+ //lwsl_hexdump_notice(ebuf.token, ebuf.len);
+
+ if (!wsi->ws->all_zero_nonce) {
+
+ for (n = 0; n < 4; n++)
+ mask[n] = wsi->ws->mask[(wsi->ws->mask_idx + n) & 3];
+
+ /* deal with 4-byte chunks using unwrapped loop */
+ n = avail >> 2;
+ while (n--) {
+ *(buffer) = *(buffer) ^ mask[0];
+ buffer++;
+ *(buffer) = *(buffer) ^ mask[1];
+ buffer++;
+ *(buffer) = *(buffer) ^ mask[2];
+ buffer++;
+ *(buffer) = *(buffer) ^ mask[3];
+ buffer++;
+ }
+ /* and the remaining bytes bytewise */
+ for (n = 0; n < (int)(avail & 3); n++) {
+ *(buffer) = *(buffer) ^ mask[n];
+ buffer++;
+ }
+
+ wsi->ws->mask_idx = (wsi->ws->mask_idx + avail) & 3;
+ }
+
+ lwsl_info("%s: using %d of raw input (total %d on offer)\n", __func__,
+ avail, (int)len);
+
+ (*buf) += avail;
+ len -= avail;
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &ebuf, 0);
+ lwsl_info("%s: ext says %d / ebuf.len %d\n", __func__, n, ebuf.len);
+#endif
+ /*
+ * ebuf may be pointing somewhere completely different now,
+ * it's the output
+ */
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (n < 0) {
+ /*
+ * we may rely on this to get RX, just drop connection
+ */
+ lwsl_notice("%s: LWS_EXT_CB_PAYLOAD_RX blew out\n", __func__);
+ wsi->socket_is_permanently_unusable = 1;
+ return -1;
+ }
+#endif
+
+ wsi->ws->rx_packet_length -= avail;
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ /*
+ * if we had an rx fragment right at the last compressed byte of the
+ * message, we can get a zero length inflated output, where no prior
+ * rx inflated output marked themselves with FIN, since there was
+ * raw ws payload still to drain at that time.
+ *
+ * Then we need to generate a zero length ws rx that can be understood
+ * as the message completion.
+ */
+
+ if (!ebuf.len && /* zero-length inflation output */
+ !n && /* nothing left to drain from the inflator */
+ wsi->ws->count_act_ext && /* we are using pmd */
+ old_packet_length && /* we gave the inflator new input */
+ !wsi->ws->rx_packet_length && /* raw ws packet payload all gone */
+ wsi->ws->final && /* the raw ws packet is a FIN guy */
+ wsi->protocol->callback &&
+ !wsi->wsistate_pre_close) {
+
+ if (user_callback_handle_rxflow(wsi->protocol->callback, wsi,
+ LWS_CALLBACK_RECEIVE,
+ wsi->user_space, NULL, 0))
+ return -1;
+
+ return avail;
+ }
+#endif
+
+ if (!ebuf.len)
+ return avail;
+
+ if (
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ n &&
+#endif
+ ebuf.len)
+ /* extension had more... main loop will come back */
+ lws_add_wsi_to_draining_ext_list(wsi);
+ else
+ lws_remove_wsi_from_draining_ext_list(wsi);
+
+ if (wsi->ws->check_utf8 && !wsi->ws->defeat_check_utf8) {
+ if (lws_check_utf8(&wsi->ws->utf8,
+ (unsigned char *)ebuf.token, ebuf.len)) {
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_INVALID_PAYLOAD,
+ (uint8_t *)"bad utf8", 8);
+ goto utf8_fail;
+ }
+
+ /* we are ending partway through utf-8 character? */
+ if (!wsi->ws->rx_packet_length && wsi->ws->final &&
+ wsi->ws->utf8 && !n) {
+ lwsl_info("FINAL utf8 error\n");
+ lws_close_reason(wsi, LWS_CLOSE_STATUS_INVALID_PAYLOAD,
+ (uint8_t *)"partial utf8", 12);
+
+utf8_fail:
+ lwsl_info("utf8 error\n");
+ lwsl_hexdump_info(ebuf.token, ebuf.len);
+
+ return -1;
+ }
+ }
+
+ if (wsi->protocol->callback && !wsi->wsistate_pre_close)
+ if (user_callback_handle_rxflow(wsi->protocol->callback, wsi,
+ LWS_CALLBACK_RECEIVE,
+ wsi->user_space,
+ ebuf.token, ebuf.len))
+ return -1;
+
+ wsi->ws->first_fragment = 0;
+
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ lwsl_info("%s: input used %d, output %d, rem len %d, rx_draining_ext %d\n",
+ __func__, avail, ebuf.len, (int)len, wsi->ws->rx_draining_ext);
+#endif
+
+ return avail; /* how much we used from the input */
+}
+
+
+int
+lws_parse_ws(struct lws *wsi, unsigned char **buf, size_t len)
+{
+ int m, bulk = 0;
+
+ lwsl_debug("%s: received %d byte packet\n", __func__, (int)len);
+
+ //lwsl_hexdump_notice(*buf, len);
+
+ /* let the rx protocol state machine have as much as it needs */
+
+ while (len) {
+ /*
+ * we were accepting input but now we stopped doing so
+ */
+ if (wsi->rxflow_bitmap) {
+ lwsl_info("%s: doing rxflow\n", __func__);
+ lws_rxflow_cache(wsi, *buf, 0, (int)len);
+ lwsl_parser("%s: cached %ld\n", __func__, (long)len);
+ *buf += len; /* stashing it is taking care of it */
+ return 1;
+ }
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ if (wsi->ws->rx_draining_ext) {
+ lwsl_debug("%s: draining rx ext\n", __func__);
+ m = lws_ws_rx_sm(wsi, ALREADY_PROCESSED_IGNORE_CHAR, 0);
+ if (m < 0)
+ return -1;
+ continue;
+ }
+#endif
+
+ /* consume payload bytes efficiently */
+ while (wsi->lws_rx_parse_state == LWS_RXPS_WS_FRAME_PAYLOAD &&
+ (wsi->ws->opcode == LWSWSOPC_TEXT_FRAME ||
+ wsi->ws->opcode == LWSWSOPC_BINARY_FRAME ||
+ wsi->ws->opcode == LWSWSOPC_CONTINUATION) &&
+ len) {
+ uint8_t *bin = *buf;
+
+ bulk = 1;
+ m = lws_ws_frame_rest_is_payload(wsi, buf, len);
+ assert((int)lws_ptr_diff(*buf, bin) <= (int)len);
+ len -= lws_ptr_diff(*buf, bin);
+
+ if (!m) {
+
+ break;
+ }
+ if (m < 0) {
+ lwsl_info("%s: rest_is_payload bailed\n",
+ __func__);
+ return -1;
+ }
+ }
+
+ if (!bulk) {
+ /* process the byte */
+ m = lws_ws_rx_sm(wsi, 0, *(*buf)++);
+ len--;
+ } else {
+ /*
+ * We already handled this byte in bulk, just deal
+ * with the ramifications
+ */
+#if !defined(LWS_WITHOUT_EXTENSIONS)
+ lwsl_debug("%s: coming out of bulk with len %d, "
+ "wsi->ws->rx_draining_ext %d\n",
+ __func__, (int)len,
+ wsi->ws->rx_draining_ext);
+#endif
+ m = lws_ws_rx_sm(wsi, ALREADY_PROCESSED_IGNORE_CHAR |
+ ALREADY_PROCESSED_NO_CB, 0);
+ }
+
+ if (m < 0) {
+ lwsl_info("%s: lws_ws_rx_sm bailed %d\n", __func__,
+ bulk);
+
+ return -1;
+ }
+
+ bulk = 0;
+ }
+
+ lwsl_debug("%s: exit with %d unused\n", __func__, (int)len);
+
+ return 0;
+}
diff --git a/thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c b/thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c
new file mode 100644
index 0000000000..ce4ee6e382
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/mbedtls/lws-genhash.c
@@ -0,0 +1,202 @@
+/*
+ * libwebsockets - generic hash and HMAC api hiding the backend
+ *
+ * Copyright (C) 2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * lws_genhash provides a hash / hmac abstraction api in lws that works the
+ * same whether you are using openssl or mbedtls hash functions underneath.
+ */
+#include "libwebsockets.h"
+#include <mbedtls/version.h>
+
+#if (MBEDTLS_VERSION_NUMBER >= 0x02070000)
+#define MBA(fn) fn##_ret
+#else
+#define MBA(fn) fn
+#endif
+
+size_t
+lws_genhash_size(enum lws_genhash_types type)
+{
+ switch(type) {
+ case LWS_GENHASH_TYPE_SHA1:
+ return 20;
+ case LWS_GENHASH_TYPE_SHA256:
+ return 32;
+ case LWS_GENHASH_TYPE_SHA384:
+ return 48;
+ case LWS_GENHASH_TYPE_SHA512:
+ return 64;
+ }
+
+ return 0;
+}
+
+int
+lws_genhash_init(struct lws_genhash_ctx *ctx, enum lws_genhash_types type)
+{
+ ctx->type = type;
+
+ switch (ctx->type) {
+ case LWS_GENHASH_TYPE_SHA1:
+ mbedtls_sha1_init(&ctx->u.sha1);
+ MBA(mbedtls_sha1_starts)(&ctx->u.sha1);
+ break;
+ case LWS_GENHASH_TYPE_SHA256:
+ mbedtls_sha256_init(&ctx->u.sha256);
+ MBA(mbedtls_sha256_starts)(&ctx->u.sha256, 0);
+ break;
+ case LWS_GENHASH_TYPE_SHA384:
+ mbedtls_sha512_init(&ctx->u.sha512);
+ MBA(mbedtls_sha512_starts)(&ctx->u.sha512, 1 /* is384 */);
+ break;
+ case LWS_GENHASH_TYPE_SHA512:
+ mbedtls_sha512_init(&ctx->u.sha512);
+ MBA(mbedtls_sha512_starts)(&ctx->u.sha512, 0);
+ break;
+ default:
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+lws_genhash_update(struct lws_genhash_ctx *ctx, const void *in, size_t len)
+{
+ switch (ctx->type) {
+ case LWS_GENHASH_TYPE_SHA1:
+ MBA(mbedtls_sha1_update)(&ctx->u.sha1, in, len);
+ break;
+ case LWS_GENHASH_TYPE_SHA256:
+ MBA(mbedtls_sha256_update)(&ctx->u.sha256, in, len);
+ break;
+ case LWS_GENHASH_TYPE_SHA384:
+ MBA(mbedtls_sha512_update)(&ctx->u.sha512, in, len);
+ break;
+ case LWS_GENHASH_TYPE_SHA512:
+ MBA(mbedtls_sha512_update)(&ctx->u.sha512, in, len);
+ break;
+ }
+
+ return 0;
+}
+
+int
+lws_genhash_destroy(struct lws_genhash_ctx *ctx, void *result)
+{
+ switch (ctx->type) {
+ case LWS_GENHASH_TYPE_SHA1:
+ MBA(mbedtls_sha1_finish)(&ctx->u.sha1, result);
+ mbedtls_sha1_free(&ctx->u.sha1);
+ break;
+ case LWS_GENHASH_TYPE_SHA256:
+ MBA(mbedtls_sha256_finish)(&ctx->u.sha256, result);
+ mbedtls_sha256_free(&ctx->u.sha256);
+ break;
+ case LWS_GENHASH_TYPE_SHA384:
+ MBA(mbedtls_sha512_finish)(&ctx->u.sha512, result);
+ mbedtls_sha512_free(&ctx->u.sha512);
+ break;
+ case LWS_GENHASH_TYPE_SHA512:
+ MBA(mbedtls_sha512_finish)(&ctx->u.sha512, result);
+ mbedtls_sha512_free(&ctx->u.sha512);
+ break;
+ }
+
+ return 0;
+}
+
+size_t
+lws_genhmac_size(enum lws_genhmac_types type)
+{
+ switch(type) {
+ case LWS_GENHMAC_TYPE_SHA256:
+ return 32;
+ case LWS_GENHMAC_TYPE_SHA384:
+ return 48;
+ case LWS_GENHMAC_TYPE_SHA512:
+ return 64;
+ }
+
+ return 0;
+}
+
+int
+lws_genhmac_init(struct lws_genhmac_ctx *ctx, enum lws_genhmac_types type,
+ const uint8_t *key, size_t key_len)
+{
+ int t;
+
+ ctx->type = type;
+
+ switch (type) {
+ case LWS_GENHMAC_TYPE_SHA256:
+ t = MBEDTLS_MD_SHA256;
+ break;
+ case LWS_GENHMAC_TYPE_SHA384:
+ t = MBEDTLS_MD_SHA384;
+ break;
+ case LWS_GENHMAC_TYPE_SHA512:
+ t = MBEDTLS_MD_SHA512;
+ break;
+ default:
+ return -1;
+ }
+
+ ctx->hmac = mbedtls_md_info_from_type(t);
+ if (!ctx->hmac)
+ return -1;
+
+ if (mbedtls_md_init_ctx(&ctx->ctx, ctx->hmac))
+ return -1;
+
+ if (mbedtls_md_hmac_starts(&ctx->ctx, key, key_len)) {
+ mbedtls_md_free(&ctx->ctx);
+ ctx->hmac = NULL;
+
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+lws_genhmac_update(struct lws_genhmac_ctx *ctx, const void *in, size_t len)
+{
+ if (mbedtls_md_hmac_update(&ctx->ctx, in, len))
+ return -1;
+
+ return 0;
+}
+
+int
+lws_genhmac_destroy(struct lws_genhmac_ctx *ctx, void *result)
+{
+ int n = 0;
+
+ if (result)
+ n = mbedtls_md_hmac_finish(&ctx->ctx, result);
+
+ mbedtls_md_free(&ctx->ctx);
+ ctx->hmac = NULL;
+ if (n)
+ return -1;
+
+ return 0;
+}
diff --git a/thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c b/thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c
new file mode 100644
index 0000000000..70a9fcf42c
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/mbedtls/lws-genrsa.c
@@ -0,0 +1,329 @@
+/*
+ * libwebsockets - generic RSA api hiding the backend
+ *
+ * Copyright (C) 2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * lws_genhash provides a hash / hmac abstraction api in lws that works the
+ * same whether you are using openssl or mbedtls hash functions underneath.
+ */
+#include "core/private.h"
+
+LWS_VISIBLE void
+lws_jwk_destroy_genrsa_elements(struct lws_genrsa_elements *el)
+{
+ int n;
+
+ for (n = 0; n < LWS_COUNT_RSA_ELEMENTS; n++)
+ if (el->e[n].buf)
+ lws_free_set_NULL(el->e[n].buf);
+}
+
+LWS_VISIBLE int
+lws_genrsa_create(struct lws_genrsa_ctx *ctx, struct lws_genrsa_elements *el)
+{
+ int n;
+
+ memset(ctx, 0, sizeof(*ctx));
+ ctx->ctx = lws_zalloc(sizeof(*ctx->ctx), "genrsa");
+ if (!ctx->ctx)
+ return 1;
+
+ mbedtls_rsa_init(ctx->ctx, MBEDTLS_RSA_PKCS_V15, 0);
+
+ {
+ mbedtls_mpi *mpi[LWS_COUNT_RSA_ELEMENTS] = {
+ &ctx->ctx->E, &ctx->ctx->N, &ctx->ctx->D, &ctx->ctx->P,
+ &ctx->ctx->Q, &ctx->ctx->DP, &ctx->ctx->DQ,
+ &ctx->ctx->QP,
+ };
+
+ for (n = 0; n < LWS_COUNT_RSA_ELEMENTS; n++)
+ if (el->e[n].buf &&
+ mbedtls_mpi_read_binary(mpi[n], el->e[n].buf,
+ el->e[n].len)) {
+ lwsl_notice("mpi load failed\n");
+ lws_free_set_NULL(ctx->ctx);
+
+ return -1;
+ }
+ }
+
+ ctx->ctx->len = el->e[JWK_KEY_N].len;
+
+ return 0;
+}
+
+static int
+_rngf(void *context, unsigned char *buf, size_t len)
+{
+ if ((size_t)lws_get_random(context, buf, len) == len)
+ return 0;
+
+ return -1;
+}
+
+LWS_VISIBLE int
+lws_genrsa_new_keypair(struct lws_context *context, struct lws_genrsa_ctx *ctx,
+ struct lws_genrsa_elements *el, int bits)
+{
+ int n;
+
+ memset(ctx, 0, sizeof(*ctx));
+ ctx->ctx = lws_zalloc(sizeof(*ctx->ctx), "genrsa");
+ if (!ctx->ctx)
+ return -1;
+
+ mbedtls_rsa_init(ctx->ctx, MBEDTLS_RSA_PKCS_V15, 0);
+
+ n = mbedtls_rsa_gen_key(ctx->ctx, _rngf, context, bits, 65537);
+ if (n) {
+ lwsl_err("mbedtls_rsa_gen_key failed 0x%x\n", -n);
+ goto cleanup_1;
+ }
+
+ {
+ mbedtls_mpi *mpi[LWS_COUNT_RSA_ELEMENTS] = {
+ &ctx->ctx->E, &ctx->ctx->N, &ctx->ctx->D, &ctx->ctx->P,
+ &ctx->ctx->Q, &ctx->ctx->DP, &ctx->ctx->DQ,
+ &ctx->ctx->QP,
+ };
+
+ for (n = 0; n < LWS_COUNT_RSA_ELEMENTS; n++)
+ if (mbedtls_mpi_size(mpi[n])) {
+ el->e[n].buf = lws_malloc(
+ mbedtls_mpi_size(mpi[n]), "genrsakey");
+ if (!el->e[n].buf)
+ goto cleanup;
+ el->e[n].len = mbedtls_mpi_size(mpi[n]);
+ mbedtls_mpi_write_binary(mpi[n], el->e[n].buf,
+ el->e[n].len);
+ }
+ }
+
+ return 0;
+
+cleanup:
+ for (n = 0; n < LWS_COUNT_RSA_ELEMENTS; n++)
+ if (el->e[n].buf)
+ lws_free_set_NULL(el->e[n].buf);
+cleanup_1:
+ lws_free(ctx->ctx);
+
+ return -1;
+}
+
+LWS_VISIBLE int
+lws_genrsa_public_decrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ size_t in_len, uint8_t *out, size_t out_max)
+{
+ size_t olen = 0;
+ int n;
+
+ ctx->ctx->len = in_len;
+ n = mbedtls_rsa_rsaes_pkcs1_v15_decrypt(ctx->ctx, NULL, NULL,
+ MBEDTLS_RSA_PUBLIC,
+ &olen, in, out, out_max);
+ if (n) {
+ lwsl_notice("%s: -0x%x\n", __func__, -n);
+
+ return -1;
+ }
+
+ return olen;
+}
+
+LWS_VISIBLE int
+lws_genrsa_public_encrypt(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ size_t in_len, uint8_t *out)
+{
+ int n;
+
+ ctx->ctx->len = in_len;
+ n = mbedtls_rsa_rsaes_pkcs1_v15_encrypt(ctx->ctx, NULL, NULL,
+ MBEDTLS_RSA_PRIVATE,
+ in_len, in, out);
+ if (n) {
+ lwsl_notice("%s: -0x%x\n", __func__, -n);
+
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
+lws_genrsa_genrsa_hash_to_mbed_hash(enum lws_genhash_types hash_type)
+{
+ int h = -1;
+
+ switch (hash_type) {
+ case LWS_GENHASH_TYPE_SHA1:
+ h = MBEDTLS_MD_SHA1;
+ break;
+ case LWS_GENHASH_TYPE_SHA256:
+ h = MBEDTLS_MD_SHA256;
+ break;
+ case LWS_GENHASH_TYPE_SHA384:
+ h = MBEDTLS_MD_SHA384;
+ break;
+ case LWS_GENHASH_TYPE_SHA512:
+ h = MBEDTLS_MD_SHA512;
+ break;
+ }
+
+ return h;
+}
+
+LWS_VISIBLE int
+lws_genrsa_public_verify(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ enum lws_genhash_types hash_type, const uint8_t *sig,
+ size_t sig_len)
+{
+ int n, h = lws_genrsa_genrsa_hash_to_mbed_hash(hash_type);
+
+ if (h < 0)
+ return -1;
+
+ n = mbedtls_rsa_rsassa_pkcs1_v15_verify(ctx->ctx, NULL, NULL,
+ MBEDTLS_RSA_PUBLIC,
+ h, 0, in, sig);
+ if (n < 0) {
+ lwsl_notice("%s: -0x%x\n", __func__, -n);
+
+ return -1;
+ }
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_genrsa_public_sign(struct lws_genrsa_ctx *ctx, const uint8_t *in,
+ enum lws_genhash_types hash_type, uint8_t *sig,
+ size_t sig_len)
+{
+ int n, h = lws_genrsa_genrsa_hash_to_mbed_hash(hash_type);
+
+ if (h < 0)
+ return -1;
+
+ /*
+ * The "sig" buffer must be as large as the size of ctx->N
+ * (eg. 128 bytes if RSA-1024 is used).
+ */
+ if (sig_len < ctx->ctx->len)
+ return -1;
+
+ n = mbedtls_rsa_rsassa_pkcs1_v15_sign(ctx->ctx, NULL, NULL,
+ MBEDTLS_RSA_PRIVATE, h, 0, in,
+ sig);
+ if (n < 0) {
+ lwsl_notice("%s: -0x%x\n", __func__, -n);
+
+ return -1;
+ }
+
+ return ctx->ctx->len;
+}
+
+LWS_VISIBLE int
+lws_genrsa_render_pkey_asn1(struct lws_genrsa_ctx *ctx, int _private,
+ uint8_t *pkey_asn1, size_t pkey_asn1_len)
+{
+ uint8_t *p = pkey_asn1, *totlen, *end = pkey_asn1 + pkey_asn1_len - 1;
+ mbedtls_mpi *mpi[LWS_COUNT_RSA_ELEMENTS] = {
+ &ctx->ctx->N, &ctx->ctx->E, &ctx->ctx->D, &ctx->ctx->P,
+ &ctx->ctx->Q, &ctx->ctx->DP, &ctx->ctx->DQ,
+ &ctx->ctx->QP,
+ };
+ int n;
+
+ /* 30 82 - sequence
+ * 09 29 <-- length(0x0929) less 4 bytes
+ * 02 01 <- length (1)
+ * 00
+ * 02 82
+ * 02 01 <- length (513) N
+ * ...
+ *
+ * 02 03 <- length (3) E
+ * 01 00 01
+ *
+ * 02 82
+ * 02 00 <- length (512) D P Q EXP1 EXP2 COEFF
+ *
+ * */
+
+ *p++ = 0x30;
+ *p++ = 0x82;
+ totlen = p;
+ p += 2;
+
+ *p++ = 0x02;
+ *p++ = 0x01;
+ *p++ = 0x00;
+
+ for (n = 0; n < LWS_COUNT_RSA_ELEMENTS; n++) {
+ int m = mbedtls_mpi_size(mpi[n]);
+ uint8_t *elen;
+
+ *p++ = 0x02;
+ elen = p;
+ if (m < 0x7f)
+ *p++ = m;
+ else {
+ *p++ = 0x82;
+ *p++ = m >> 8;
+ *p++ = m & 0xff;
+ }
+
+ if (p + m > end)
+ return -1;
+
+ mbedtls_mpi_write_binary(mpi[n], p, m);
+ if (p[0] & 0x80) {
+ p[0] = 0x00;
+ mbedtls_mpi_write_binary(mpi[n], &p[1], m);
+ m++;
+ }
+ if (m < 0x7f)
+ *elen = m;
+ else {
+ *elen++ = 0x82;
+ *elen++ = m >> 8;
+ *elen = m & 0xff;
+ }
+ p += m;
+ }
+
+ n = lws_ptr_diff(p, pkey_asn1);
+
+ *totlen++ = (n - 4) >> 8;
+ *totlen = (n - 4) & 0xff;
+
+ return n;
+}
+
+LWS_VISIBLE void
+lws_genrsa_destroy(struct lws_genrsa_ctx *ctx)
+{
+ if (!ctx->ctx)
+ return;
+ mbedtls_rsa_free(ctx->ctx);
+ lws_free(ctx->ctx);
+ ctx->ctx = NULL;
+}
diff --git a/thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c
new file mode 100644
index 0000000000..a7864ab790
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-client.c
@@ -0,0 +1,240 @@
+/*
+ * libwebsockets - mbedtls-specific client TLS code
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+static int
+OpenSSL_client_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
+{
+ return 0;
+}
+
+int
+lws_ssl_client_bio_create(struct lws *wsi)
+{
+ X509_VERIFY_PARAM *param;
+ char hostname[128], *p;
+ const char *alpn_comma = wsi->context->tls.alpn_default;
+ struct alpn_ctx protos;
+
+ if (lws_hdr_copy(wsi, hostname, sizeof(hostname),
+ _WSI_TOKEN_CLIENT_HOST) <= 0) {
+ lwsl_err("%s: Unable to get hostname\n", __func__);
+
+ return -1;
+ }
+
+ /*
+ * remove any :port part on the hostname... necessary for network
+ * connection but typical certificates do not contain it
+ */
+ p = hostname;
+ while (*p) {
+ if (*p == ':') {
+ *p = '\0';
+ break;
+ }
+ p++;
+ }
+
+ wsi->tls.ssl = SSL_new(wsi->vhost->tls.ssl_client_ctx);
+ if (!wsi->tls.ssl)
+ return -1;
+
+ if (wsi->vhost->tls.ssl_info_event_mask)
+ SSL_set_info_callback(wsi->tls.ssl, lws_ssl_info_callback);
+
+ if (!(wsi->tls.use_ssl & LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK)) {
+ param = SSL_get0_param(wsi->tls.ssl);
+ /* Enable automatic hostname checks */
+ // X509_VERIFY_PARAM_set_hostflags(param,
+ // X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
+ X509_VERIFY_PARAM_set1_host(param, hostname, 0);
+ }
+
+ if (wsi->vhost->tls.alpn)
+ alpn_comma = wsi->vhost->tls.alpn;
+
+ if (lws_hdr_copy(wsi, hostname, sizeof(hostname),
+ _WSI_TOKEN_CLIENT_ALPN) > 0)
+ alpn_comma = hostname;
+
+ lwsl_info("%s: %p: client conn sending ALPN list '%s'\n",
+ __func__, wsi, alpn_comma);
+
+ protos.len = lws_alpn_comma_to_openssl(alpn_comma, protos.data,
+ sizeof(protos.data) - 1);
+
+ /* with mbedtls, protos is not pointed to after exit from this call */
+ SSL_set_alpn_select_cb(wsi->tls.ssl, &protos);
+
+ /*
+ * use server name indication (SNI), if supported,
+ * when establishing connection
+ */
+ SSL_set_verify(wsi->tls.ssl, SSL_VERIFY_PEER,
+ OpenSSL_client_verify_callback);
+
+ SSL_set_fd(wsi->tls.ssl, wsi->desc.sockfd);
+
+ return 0;
+}
+
+int ERR_get_error(void)
+{
+ return 0;
+}
+
+enum lws_ssl_capable_status
+lws_tls_client_connect(struct lws *wsi)
+{
+ int m, n = SSL_connect(wsi->tls.ssl);
+ const unsigned char *prot;
+ unsigned int len;
+
+ if (n == 1) {
+ SSL_get0_alpn_selected(wsi->tls.ssl, &prot, &len);
+ lws_role_call_alpn_negotiated(wsi, (const char *)prot);
+ lwsl_info("client connect OK\n");
+ return LWS_SSL_CAPABLE_DONE;
+ }
+
+ m = SSL_get_error(wsi->tls.ssl, n);
+
+ if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->tls.ssl))
+ return LWS_SSL_CAPABLE_MORE_SERVICE_READ;
+
+ if (m == SSL_ERROR_WANT_WRITE || SSL_want_write(wsi->tls.ssl))
+ return LWS_SSL_CAPABLE_MORE_SERVICE_WRITE;
+
+ if (!n) /* we don't know what he wants, but he says to retry */
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+
+ return LWS_SSL_CAPABLE_ERROR;
+}
+
+int
+lws_tls_client_confirm_peer_cert(struct lws *wsi, char *ebuf, int ebuf_len)
+{
+ int n;
+ X509 *peer = SSL_get_peer_certificate(wsi->tls.ssl);
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+ char *sb = (char *)&pt->serv_buf[0];
+
+ if (!peer) {
+ lwsl_info("peer did not provide cert\n");
+
+ return -1;
+ }
+ lwsl_info("peer provided cert\n");
+
+ n = SSL_get_verify_result(wsi->tls.ssl);
+ lws_latency(wsi->context, wsi,
+ "SSL_get_verify_result LWS_CONNMODE..HANDSHAKE", n, n > 0);
+
+ lwsl_debug("get_verify says %d\n", n);
+
+ if (n == X509_V_OK)
+ return 0;
+
+ if (n == X509_V_ERR_HOSTNAME_MISMATCH &&
+ (wsi->tls.use_ssl & LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK)) {
+ lwsl_info("accepting certificate for invalid hostname\n");
+ return 0;
+ }
+
+ if (n == X509_V_ERR_INVALID_CA &&
+ (wsi->tls.use_ssl & LCCSCF_ALLOW_SELFSIGNED)) {
+ lwsl_info("accepting certificate from untrusted CA\n");
+ return 0;
+ }
+
+ if ((n == X509_V_ERR_CERT_NOT_YET_VALID ||
+ n == X509_V_ERR_CERT_HAS_EXPIRED) &&
+ (wsi->tls.use_ssl & LCCSCF_ALLOW_EXPIRED)) {
+ lwsl_info("accepting expired or not yet valid certificate\n");
+
+ return 0;
+ }
+ lws_snprintf(ebuf, ebuf_len,
+ "server's cert didn't look good, X509_V_ERR = %d: %s\n",
+ n, ERR_error_string(n, sb));
+ lwsl_info("%s\n", ebuf);
+ lws_ssl_elaborate_error();
+
+ return -1;
+}
+
+int
+lws_tls_client_create_vhost_context(struct lws_vhost *vh,
+ const struct lws_context_creation_info *info,
+ const char *cipher_list,
+ const char *ca_filepath,
+ const char *cert_filepath,
+ const char *private_key_filepath)
+{
+ X509 *d2i_X509(X509 **cert, const unsigned char *buffer, long len);
+ SSL_METHOD *method = (SSL_METHOD *)TLS_client_method();
+ unsigned long error;
+ lws_filepos_t len;
+ uint8_t *buf;
+
+ if (!method) {
+ error = ERR_get_error();
+ lwsl_err("problem creating ssl method %lu: %s\n",
+ error, ERR_error_string(error,
+ (char *)vh->context->pt[0].serv_buf));
+ return 1;
+ }
+ /* create context */
+ vh->tls.ssl_client_ctx = SSL_CTX_new(method);
+ if (!vh->tls.ssl_client_ctx) {
+ error = ERR_get_error();
+ lwsl_err("problem creating ssl context %lu: %s\n",
+ error, ERR_error_string(error,
+ (char *)vh->context->pt[0].serv_buf));
+ return 1;
+ }
+
+ if (!ca_filepath)
+ return 0;
+
+ if (alloc_file(vh->context, ca_filepath, &buf, &len)) {
+ lwsl_err("Load CA cert file %s failed\n", ca_filepath);
+ return 1;
+ }
+
+ vh->tls.x509_client_CA = d2i_X509(NULL, buf, len);
+ free(buf);
+ if (!vh->tls.x509_client_CA) {
+ lwsl_err("client CA: x509 parse failed\n");
+ return 1;
+ }
+
+ if (!vh->tls.ssl_ctx)
+ SSL_CTX_add_client_CA(vh->tls.ssl_client_ctx, vh->tls.x509_client_CA);
+ else
+ SSL_CTX_add_client_CA(vh->tls.ssl_ctx, vh->tls.x509_client_CA);
+
+ lwsl_notice("client loaded CA for verification %s\n", ca_filepath);
+
+ return 0;
+}
diff --git a/thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c
new file mode 100644
index 0000000000..2de6d422e3
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/mbedtls/mbedtls-server.c
@@ -0,0 +1,694 @@
+/*
+ * libwebsockets - mbedTLS-specific server functions
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+#include <mbedtls/x509_csr.h>
+
+int
+lws_tls_server_client_cert_verify_config(struct lws_vhost *vh)
+{
+ int verify_options = SSL_VERIFY_PEER;
+
+ /* as a server, are we requiring clients to identify themselves? */
+ if (!lws_check_opt(vh->options,
+ LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT)) {
+ lwsl_notice("no client cert required\n");
+ return 0;
+ }
+
+ /*
+ * The wrapper has this messed-up mapping:
+ *
+ * else if (ctx->verify_mode == SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
+ * mode = MBEDTLS_SSL_VERIFY_OPTIONAL;
+ *
+ * ie the meaning is inverted. So where we should test for ! we don't
+ */
+ if (lws_check_opt(vh->options, LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED))
+ verify_options = SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+
+ lwsl_notice("%s: vh %s requires client cert %d\n", __func__, vh->name,
+ verify_options);
+
+ SSL_CTX_set_verify(vh->tls.ssl_ctx, verify_options, NULL);
+
+ return 0;
+}
+
+static int
+lws_mbedtls_sni_cb(void *arg, mbedtls_ssl_context *mbedtls_ctx,
+ const unsigned char *servername, size_t len)
+{
+ SSL *ssl = SSL_SSL_from_mbedtls_ssl_context(mbedtls_ctx);
+ struct lws_context *context = (struct lws_context *)arg;
+ struct lws_vhost *vhost, *vh;
+
+ lwsl_notice("%s: %s\n", __func__, servername);
+
+ /*
+ * We can only get ssl accepted connections by using a vhost's ssl_ctx
+ * find out which listening one took us and only match vhosts on the
+ * same port.
+ */
+ vh = context->vhost_list;
+ while (vh) {
+ if (!vh->being_destroyed &&
+ vh->tls.ssl_ctx == SSL_get_SSL_CTX(ssl))
+ break;
+ vh = vh->vhost_next;
+ }
+
+ if (!vh) {
+ assert(vh); /* can't match the incoming vh? */
+ return 0;
+ }
+
+ vhost = lws_select_vhost(context, vh->listen_port,
+ (const char *)servername);
+ if (!vhost) {
+ lwsl_info("SNI: none: %s:%d\n", servername, vh->listen_port);
+
+ return 0;
+ }
+
+ lwsl_info("SNI: Found: %s:%d at vhost '%s'\n", servername,
+ vh->listen_port, vhost->name);
+
+ /* select the ssl ctx from the selected vhost for this conn */
+ SSL_set_SSL_CTX(ssl, vhost->tls.ssl_ctx);
+
+ return 0;
+}
+
+int
+lws_tls_server_certs_load(struct lws_vhost *vhost, struct lws *wsi,
+ const char *cert, const char *private_key,
+ const char *mem_cert, size_t len_mem_cert,
+ const char *mem_privkey, size_t mem_privkey_len)
+{
+ int n, f = 0;
+ const char *filepath = private_key;
+ uint8_t *mem = NULL, *p = NULL;
+ size_t mem_len = 0;
+ lws_filepos_t flen;
+ long err;
+
+ if ((!cert || !private_key) && (!mem_cert || !mem_privkey)) {
+ lwsl_notice("%s: no usable input\n", __func__);
+ return 0;
+ }
+
+ n = lws_tls_generic_cert_checks(vhost, cert, private_key);
+
+ if (n == LWS_TLS_EXTANT_NO && (!mem_cert || !mem_privkey))
+ return 0;
+
+ /*
+ * we can't read the root-privs files. But if mem_cert is provided,
+ * we should use that.
+ */
+ if (n == LWS_TLS_EXTANT_NO)
+ n = LWS_TLS_EXTANT_ALTERNATIVE;
+
+ if (n == LWS_TLS_EXTANT_ALTERNATIVE && (!mem_cert || !mem_privkey))
+ return 1; /* no alternative */
+
+ if (n == LWS_TLS_EXTANT_ALTERNATIVE) {
+ /*
+ * Although we have prepared update certs, we no longer have
+ * the rights to read our own cert + key we saved.
+ *
+ * If we were passed copies in memory buffers, use those
+ * instead.
+ *
+ * The passed memory-buffer cert image is in DER, and the
+ * memory-buffer private key image is PEM.
+ */
+ /* mem cert is already DER */
+ p = (uint8_t *)mem_cert;
+ flen = len_mem_cert;
+ /* mem private key is PEM, so go through the motions */
+ mem = (uint8_t *)mem_privkey;
+ mem_len = mem_privkey_len;
+ filepath = NULL;
+ } else {
+ if (lws_tls_alloc_pem_to_der_file(vhost->context, cert, NULL,
+ 0, &p, &flen)) {
+ lwsl_err("couldn't find cert file %s\n", cert);
+
+ return 1;
+ }
+ f = 1;
+ }
+ err = SSL_CTX_use_certificate_ASN1(vhost->tls.ssl_ctx, flen, p);
+ if (!err) {
+ free(p);
+ lwsl_err("Problem loading cert\n");
+ return 1;
+ }
+
+ if (f)
+ free(p);
+ p = NULL;
+
+ if (private_key || n == LWS_TLS_EXTANT_ALTERNATIVE) {
+ if (lws_tls_alloc_pem_to_der_file(vhost->context, filepath,
+ (char *)mem, mem_len, &p,
+ &flen)) {
+ lwsl_err("couldn't find private key file %s\n",
+ private_key);
+
+ return 1;
+ }
+ err = SSL_CTX_use_PrivateKey_ASN1(0, vhost->tls.ssl_ctx, p, flen);
+ if (!err) {
+ free(p);
+ lwsl_err("Problem loading key\n");
+
+ return 1;
+ }
+ }
+
+ if (p && !mem_privkey) {
+ free(p);
+ p = NULL;
+ }
+
+ if (!private_key && !mem_privkey &&
+ vhost->protocols[0].callback(wsi,
+ LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY,
+ vhost->tls.ssl_ctx, NULL, 0)) {
+ lwsl_err("ssl private key not set\n");
+
+ return 1;
+ }
+
+ vhost->tls.skipped_certs = 0;
+
+ return 0;
+}
+
+int
+lws_tls_server_vhost_backend_init(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost, struct lws *wsi)
+{
+ const SSL_METHOD *method = TLS_server_method();
+ uint8_t *p;
+ lws_filepos_t flen;
+ int n;
+
+ vhost->tls.ssl_ctx = SSL_CTX_new(method); /* create context */
+ if (!vhost->tls.ssl_ctx) {
+ lwsl_err("problem creating ssl context\n");
+ return 1;
+ }
+
+ if (!vhost->tls.use_ssl || !info->ssl_cert_filepath)
+ return 0;
+
+ if (info->ssl_ca_filepath) {
+ lwsl_notice("%s: vh %s: loading CA filepath %s\n", __func__,
+ vhost->name, info->ssl_ca_filepath);
+ if (lws_tls_alloc_pem_to_der_file(vhost->context,
+ info->ssl_ca_filepath, NULL, 0, &p, &flen)) {
+ lwsl_err("couldn't find client CA file %s\n",
+ info->ssl_ca_filepath);
+
+ return 1;
+ }
+
+ if (SSL_CTX_add_client_CA_ASN1(vhost->tls.ssl_ctx, (int)flen, p) != 1) {
+ lwsl_err("%s: SSL_CTX_add_client_CA_ASN1 unhappy\n",
+ __func__);
+ free(p);
+ return 1;
+ }
+ free(p);
+ }
+
+ n = lws_tls_server_certs_load(vhost, wsi, info->ssl_cert_filepath,
+ info->ssl_private_key_filepath, NULL,
+ 0, NULL, 0);
+ if (n)
+ return n;
+
+ return 0;
+}
+
+int
+lws_tls_server_new_nonblocking(struct lws *wsi, lws_sockfd_type accept_fd)
+{
+ errno = 0;
+ wsi->tls.ssl = SSL_new(wsi->vhost->tls.ssl_ctx);
+ if (wsi->tls.ssl == NULL) {
+ lwsl_err("SSL_new failed: errno %d\n", errno);
+
+ lws_ssl_elaborate_error();
+ return 1;
+ }
+
+ SSL_set_fd(wsi->tls.ssl, accept_fd);
+
+ if (wsi->vhost->tls.ssl_info_event_mask)
+ SSL_set_info_callback(wsi->tls.ssl, lws_ssl_info_callback);
+
+ SSL_set_sni_callback(wsi->tls.ssl, lws_mbedtls_sni_cb, wsi->context);
+
+ return 0;
+}
+
+int
+lws_tls_server_abort_connection(struct lws *wsi)
+{
+ __lws_tls_shutdown(wsi);
+ SSL_free(wsi->tls.ssl);
+
+ return 0;
+}
+
+enum lws_ssl_capable_status
+lws_tls_server_accept(struct lws *wsi)
+{
+ union lws_tls_cert_info_results ir;
+ int m, n;
+
+ n = SSL_accept(wsi->tls.ssl);
+ if (n == 1) {
+
+ if (strstr(wsi->vhost->name, ".invalid")) {
+ lwsl_notice("%s: vhost has .invalid, rejecting accept\n", __func__);
+
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+
+ n = lws_tls_peer_cert_info(wsi, LWS_TLS_CERT_INFO_COMMON_NAME, &ir,
+ sizeof(ir.ns.name));
+ if (!n)
+ lwsl_notice("%s: client cert CN '%s'\n",
+ __func__, ir.ns.name);
+ else
+ lwsl_info("%s: couldn't get client cert CN\n", __func__);
+ return LWS_SSL_CAPABLE_DONE;
+ }
+
+ m = SSL_get_error(wsi->tls.ssl, n);
+ lwsl_debug("%s: %p: accept SSL_get_error %d errno %d\n", __func__,
+ wsi, m, errno);
+
+ // mbedtls wrapper only
+ if (m == SSL_ERROR_SYSCALL && errno == 11)
+ return LWS_SSL_CAPABLE_MORE_SERVICE_READ;
+
+ if (m == SSL_ERROR_SYSCALL || m == SSL_ERROR_SSL)
+ return LWS_SSL_CAPABLE_ERROR;
+
+ if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->tls.ssl)) {
+ if (lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
+ lwsl_info("%s: WANT_READ change_pollfd failed\n", __func__);
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+
+ lwsl_info("SSL_ERROR_WANT_READ\n");
+ return LWS_SSL_CAPABLE_MORE_SERVICE_READ;
+ }
+ if (m == SSL_ERROR_WANT_WRITE || SSL_want_write(wsi->tls.ssl)) {
+ lwsl_debug("%s: WANT_WRITE\n", __func__);
+
+ if (lws_change_pollfd(wsi, 0, LWS_POLLOUT)) {
+ lwsl_info("%s: WANT_WRITE change_pollfd failed\n", __func__);
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+ return LWS_SSL_CAPABLE_MORE_SERVICE_WRITE;
+ }
+
+ return LWS_SSL_CAPABLE_ERROR;
+}
+
+#if defined(LWS_WITH_ACME)
+/*
+ * mbedtls doesn't support SAN for cert creation. So we use a known-good
+ * tls-sni-01 cert from OpenSSL that worked on Let's Encrypt, and just replace
+ * the pubkey n part and the signature part.
+ *
+ * This will need redoing for tls-sni-02...
+ */
+
+static uint8_t ss_cert_leadin[] = {
+ 0x30, 0x82,
+ 0x05, 0x56, /* total length: LEN1 (+2 / +3) (correct for 513 + 512)*/
+
+ 0x30, 0x82, /* length: LEN2 (+6 / +7) (correct for 513) */
+ 0x03, 0x3e,
+
+ /* addition: v3 cert (+5 bytes)*/
+ 0xa0, 0x03,
+ 0x02, 0x01, 0x02,
+
+ 0x02, 0x01, 0x01,
+ 0x30, 0x0d, 0x06, 0x09, 0x2a,
+ 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3f,
+ 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47,
+ 0x42, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0b,
+ 0x73, 0x6f, 0x6d, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x31,
+ 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x11, 0x74, 0x65,
+ 0x6d, 0x70, 0x2e, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x69, 0x6e, 0x76, 0x61,
+ 0x6c, 0x69, 0x64, 0x30, 0x1e, 0x17, 0x0d,
+
+ /* from 2017-10-29 ... */
+ 0x31, 0x37, 0x31, 0x30, 0x32, 0x39, 0x31, 0x31, 0x34, 0x39, 0x34, 0x35,
+ 0x5a, 0x17, 0x0d,
+
+ /* thru 2049-10-29 we immediately discard the private key, no worries */
+ 0x34, 0x39, 0x31, 0x30, 0x32, 0x39, 0x31, 0x32, 0x34, 0x39, 0x34, 0x35,
+ 0x5a,
+
+ 0x30, 0x3f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
+ 0x02, 0x47, 0x42, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0a,
+ 0x0c, 0x0b, 0x73, 0x6f, 0x6d, 0x65, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e,
+ 0x79, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x11,
+ 0x74, 0x65, 0x6d, 0x70, 0x2e, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x69, 0x6e,
+ 0x76, 0x61, 0x6c, 0x69, 0x64, 0x30,
+
+ 0x82,
+ 0x02, 0x22, /* LEN3 (+C3 / C4) */
+ 0x30, 0x0d, 0x06,
+ 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
+ 0x03,
+
+ 0x82,
+ 0x02, 0x0f, /* LEN4 (+D6 / D7) */
+
+ 0x00, 0x30, 0x82,
+
+ 0x02, 0x0a, /* LEN5 (+ DB / DC) */
+
+ 0x02, 0x82,
+
+ //0x02, 0x01, /* length of n in bytes (including leading 00 if any) */
+ },
+
+ /* 1 + (keybits / 8) bytes N */
+
+ ss_cert_san_leadin[] = {
+ /* e - fixed */
+ 0x02, 0x03, 0x01, 0x00, 0x01,
+
+ 0xa3, 0x5d, 0x30, 0x5b, 0x30, 0x59, 0x06, 0x03, 0x55, 0x1d,
+ 0x11, 0x04, 0x52, 0x30, 0x50, /* <-- SAN length + 2 */
+
+ 0x82, 0x4e, /* <-- SAN length */
+ },
+
+ /* 78 bytes of SAN (tls-sni-01)
+ 0x61, 0x64, 0x34, 0x31, 0x61, 0x66, 0x62, 0x65, 0x30, 0x63, 0x61, 0x34,
+ 0x36, 0x34, 0x32, 0x66, 0x30, 0x61, 0x34, 0x34, 0x39, 0x64, 0x39, 0x63,
+ 0x61, 0x37, 0x36, 0x65, 0x62, 0x61, 0x61, 0x62, 0x2e, 0x32, 0x38, 0x39,
+ 0x34, 0x64, 0x34, 0x31, 0x36, 0x63, 0x39, 0x38, 0x33, 0x66, 0x31, 0x32,
+ 0x65, 0x64, 0x37, 0x33, 0x31, 0x61, 0x33, 0x30, 0x66, 0x35, 0x63, 0x34,
+ 0x34, 0x37, 0x37, 0x66, 0x65, 0x2e, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x69,
+ 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, */
+
+ /* end of LEN2 area */
+
+ ss_cert_sig_leadin[] = {
+ /* it's saying that the signature is SHA256 + RSA */
+ 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
+ 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03,
+
+ 0x82,
+ 0x02, 0x01,
+ 0x00,
+ };
+
+ /* (keybits / 8) bytes signature to end of LEN1 area */
+
+#define SAN_A_LENGTH 78
+
+LWS_VISIBLE int
+lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
+ const char *san_b)
+{
+ int buflen = 0x560;
+ uint8_t *buf = lws_malloc(buflen, "tmp cert buf"), *p = buf, *pkey_asn1;
+ struct lws_genrsa_ctx ctx;
+ struct lws_genrsa_elements el;
+ uint8_t digest[32];
+ struct lws_genhash_ctx hash_ctx;
+ int pkey_asn1_len = 3 * 1024;
+ int n, m, keybits = lws_plat_recommended_rsa_bits(), adj;
+
+ if (!buf)
+ return 1;
+
+ n = lws_genrsa_new_keypair(vhost->context, &ctx, &el, keybits);
+ if (n < 0) {
+ lws_jwk_destroy_genrsa_elements(&el);
+ goto bail1;
+ }
+
+ n = sizeof(ss_cert_leadin);
+ memcpy(p, ss_cert_leadin, n);
+ p += n;
+
+ adj = (0x0556 - 0x401) + (keybits / 4) + 1;
+ buf[2] = adj >> 8;
+ buf[3] = adj & 0xff;
+
+ adj = (0x033e - 0x201) + (keybits / 8) + 1;
+ buf[6] = adj >> 8;
+ buf[7] = adj & 0xff;
+
+ adj = (0x0222 - 0x201) + (keybits / 8) + 1;
+ buf[0xc3] = adj >> 8;
+ buf[0xc4] = adj & 0xff;
+
+ adj = (0x020f - 0x201) + (keybits / 8) + 1;
+ buf[0xd6] = adj >> 8;
+ buf[0xd7] = adj & 0xff;
+
+ adj = (0x020a - 0x201) + (keybits / 8) + 1;
+ buf[0xdb] = adj >> 8;
+ buf[0xdc] = adj & 0xff;
+
+ *p++ = ((keybits / 8) + 1) >> 8;
+ *p++ = ((keybits / 8) + 1) & 0xff;
+
+ /* we need to drop 1 + (keybits / 8) bytes of n in here, 00 + key */
+
+ *p++ = 0x00;
+ memcpy(p, el.e[JWK_KEY_N].buf, el.e[JWK_KEY_N].len);
+ p += el.e[JWK_KEY_N].len;
+
+ memcpy(p, ss_cert_san_leadin, sizeof(ss_cert_san_leadin));
+ p += sizeof(ss_cert_san_leadin);
+
+ /* drop in 78 bytes of san_a */
+
+ memcpy(p, san_a, SAN_A_LENGTH);
+ p += SAN_A_LENGTH;
+ memcpy(p, ss_cert_sig_leadin, sizeof(ss_cert_sig_leadin));
+
+ p[17] = ((keybits / 8) + 1) >> 8;
+ p[18] = ((keybits / 8) + 1) & 0xff;
+
+ p += sizeof(ss_cert_sig_leadin);
+
+ /* hash the cert plaintext */
+
+ if (lws_genhash_init(&hash_ctx, LWS_GENHASH_TYPE_SHA256))
+ goto bail2;
+
+ if (lws_genhash_update(&hash_ctx, buf, lws_ptr_diff(p, buf))) {
+ lws_genhash_destroy(&hash_ctx, NULL);
+
+ goto bail2;
+ }
+ if (lws_genhash_destroy(&hash_ctx, digest))
+ goto bail2;
+
+ /* sign the hash */
+
+ n = lws_genrsa_public_sign(&ctx, digest, LWS_GENHASH_TYPE_SHA256, p,
+ buflen - lws_ptr_diff(p, buf));
+ if (n < 0)
+ goto bail2;
+ p += n;
+
+ pkey_asn1 = lws_malloc(pkey_asn1_len, "mbed crt tmp");
+ if (!pkey_asn1)
+ goto bail2;
+
+ m = lws_genrsa_render_pkey_asn1(&ctx, 1, pkey_asn1, pkey_asn1_len);
+ if (m < 0) {
+ lws_free(pkey_asn1);
+ goto bail2;
+ }
+
+// lwsl_hexdump_level(LLL_DEBUG, buf, lws_ptr_diff(p, buf));
+ n = SSL_CTX_use_certificate_ASN1(vhost->tls.ssl_ctx,
+ lws_ptr_diff(p, buf), buf);
+ if (n != 1) {
+ lws_free(pkey_asn1);
+ lwsl_err("%s: generated cert failed to load 0x%x\n",
+ __func__, -n);
+ } else {
+ //lwsl_debug("private key\n");
+ //lwsl_hexdump_level(LLL_DEBUG, pkey_asn1, n);
+
+ /* and to use our generated private key */
+ n = SSL_CTX_use_PrivateKey_ASN1(0, vhost->tls.ssl_ctx, pkey_asn1, m);
+ lws_free(pkey_asn1);
+ if (n != 1) {
+ lwsl_err("%s: SSL_CTX_use_PrivateKey_ASN1 failed\n",
+ __func__);
+ }
+ }
+
+ lws_genrsa_destroy(&ctx);
+ lws_jwk_destroy_genrsa_elements(&el);
+
+ lws_free(buf);
+
+ return n != 1;
+
+bail2:
+ lws_genrsa_destroy(&ctx);
+ lws_jwk_destroy_genrsa_elements(&el);
+bail1:
+ lws_free(buf);
+
+ return -1;
+}
+
+void
+lws_tls_acme_sni_cert_destroy(struct lws_vhost *vhost)
+{
+}
+
+#if defined(LWS_WITH_JWS)
+static int
+_rngf(void *context, unsigned char *buf, size_t len)
+{
+ if ((size_t)lws_get_random(context, buf, len) == len)
+ return 0;
+
+ return -1;
+}
+
+static const char *x5[] = { "C", "ST", "L", "O", "CN" };
+
+/*
+ * CSR is output formatted as b64url(DER)
+ * Private key is output as a PEM in memory
+ */
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_acme_sni_csr_create(struct lws_context *context, const char *elements[],
+ uint8_t *dcsr, size_t csr_len, char **privkey_pem,
+ size_t *privkey_len)
+{
+ mbedtls_x509write_csr csr;
+ mbedtls_pk_context mpk;
+ int buf_size = 4096, n;
+ char subject[200], *p = subject, *end = p + sizeof(subject) - 1;
+ uint8_t *buf = malloc(buf_size); /* malloc because given to user code */
+
+ if (!buf)
+ return -1;
+
+ mbedtls_x509write_csr_init(&csr);
+
+ mbedtls_pk_init(&mpk);
+ if (mbedtls_pk_setup(&mpk, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA))) {
+ lwsl_notice("%s: pk_setup failed\n", __func__);
+ goto fail;
+ }
+
+ n = mbedtls_rsa_gen_key(mbedtls_pk_rsa(mpk), _rngf, context,
+ lws_plat_recommended_rsa_bits(), 65537);
+ if (n) {
+ lwsl_notice("%s: failed to generate keys\n", __func__);
+
+ goto fail1;
+ }
+
+ /* subject must be formatted like "C=TW,O=warmcat,CN=myserver" */
+
+ for (n = 0; n < (int)ARRAY_SIZE(x5); n++) {
+ if (p != subject)
+ *p++ = ',';
+ if (elements[n])
+ p += lws_snprintf(p, end - p, "%s=%s", x5[n],
+ elements[n]);
+ }
+
+ if (mbedtls_x509write_csr_set_subject_name(&csr, subject))
+ goto fail1;
+
+ mbedtls_x509write_csr_set_key(&csr, &mpk);
+ mbedtls_x509write_csr_set_md_alg(&csr, MBEDTLS_MD_SHA256);
+
+ /*
+ * data is written at the end of the buffer! Use the
+ * return value to determine where you should start
+ * using the buffer
+ */
+ n = mbedtls_x509write_csr_der(&csr, buf, buf_size, _rngf, context);
+ if (n < 0) {
+ lwsl_notice("%s: write csr der failed\n", __func__);
+ goto fail1;
+ }
+
+ /* we have it in DER, we need it in b64URL */
+
+ n = lws_jws_base64_enc((char *)(buf + buf_size) - n, n,
+ (char *)dcsr, csr_len);
+ if (n < 0)
+ goto fail1;
+
+ /*
+ * okay, the CSR is done, last we need the private key in PEM
+ * re-use the DER CSR buf as the result buffer since we cn do it in
+ * one step
+ */
+
+ if (mbedtls_pk_write_key_pem(&mpk, buf, buf_size)) {
+ lwsl_notice("write key pem failed\n");
+ goto fail1;
+ }
+
+ *privkey_pem = (char *)buf;
+ *privkey_len = strlen((const char *)buf);
+
+ mbedtls_pk_free(&mpk);
+ mbedtls_x509write_csr_free(&csr);
+
+ return n;
+
+fail1:
+ mbedtls_pk_free(&mpk);
+fail:
+ mbedtls_x509write_csr_free(&csr);
+ free(buf);
+
+ return -1;
+}
+#endif
+#endif
diff --git a/thirdparty/libwebsockets/tls/mbedtls/ssl.c b/thirdparty/libwebsockets/tls/mbedtls/ssl.c
new file mode 100644
index 0000000000..6ae9d2556b
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/mbedtls/ssl.c
@@ -0,0 +1,520 @@
+/*
+ * libwebsockets - mbedTLS-specific lws apis
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+#include <mbedtls/oid.h>
+
+void
+lws_ssl_elaborate_error(void)
+{
+}
+
+int
+lws_context_init_ssl_library(const struct lws_context_creation_info *info)
+{
+ lwsl_info(" Compiled with MbedTLS support\n");
+
+ if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
+ lwsl_info(" SSL disabled: no LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT\n");
+
+ return 0;
+}
+
+LWS_VISIBLE void
+lws_ssl_destroy(struct lws_vhost *vhost)
+{
+ if (!lws_check_opt(vhost->context->options,
+ LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
+ return;
+
+ if (vhost->tls.ssl_ctx)
+ SSL_CTX_free(vhost->tls.ssl_ctx);
+ if (!vhost->tls.user_supplied_ssl_ctx && vhost->tls.ssl_client_ctx)
+ SSL_CTX_free(vhost->tls.ssl_client_ctx);
+
+ if (vhost->tls.x509_client_CA)
+ X509_free(vhost->tls.x509_client_CA);
+}
+
+LWS_VISIBLE int
+lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ int n = 0, m;
+
+ if (!wsi->tls.ssl)
+ return lws_ssl_capable_read_no_ssl(wsi, buf, len);
+
+ lws_stats_atomic_bump(context, pt, LWSSTATS_C_API_READ, 1);
+
+ errno = 0;
+ n = SSL_read(wsi->tls.ssl, buf, len);
+#if defined(LWS_WITH_ESP32)
+ if (!n && errno == ENOTCONN) {
+ lwsl_debug("%p: SSL_read ENOTCONN\n", wsi);
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+#endif
+#if defined(LWS_WITH_STATS)
+ if (!wsi->seen_rx) {
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_MS_SSL_RX_DELAY,
+ time_in_microseconds() - wsi->accept_start_us);
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_SSL_CONNS_HAD_RX, 1);
+ wsi->seen_rx = 1;
+ }
+#endif
+
+
+ lwsl_debug("%p: SSL_read says %d\n", wsi, n);
+ /* manpage: returning 0 means connection shut down */
+ if (!n) {
+ wsi->socket_is_permanently_unusable = 1;
+
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+
+ if (n < 0) {
+ m = SSL_get_error(wsi->tls.ssl, n);
+ lwsl_debug("%p: ssl err %d errno %d\n", wsi, m, errno);
+ if (m == SSL_ERROR_ZERO_RETURN ||
+ m == SSL_ERROR_SYSCALL)
+ return LWS_SSL_CAPABLE_ERROR;
+
+ if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->tls.ssl)) {
+ lwsl_debug("%s: WANT_READ\n", __func__);
+ lwsl_debug("%p: LWS_SSL_CAPABLE_MORE_SERVICE\n", wsi);
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+ }
+ if (m == SSL_ERROR_WANT_WRITE || SSL_want_write(wsi->tls.ssl)) {
+ lwsl_debug("%s: WANT_WRITE\n", __func__);
+ lwsl_debug("%p: LWS_SSL_CAPABLE_MORE_SERVICE\n", wsi);
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+ }
+ wsi->socket_is_permanently_unusable = 1;
+
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+
+ lws_stats_atomic_bump(context, pt, LWSSTATS_B_READ, n);
+
+ if (wsi->vhost)
+ wsi->vhost->conn_stats.rx += n;
+
+ lws_restart_ws_ping_pong_timer(wsi);
+
+ /*
+ * if it was our buffer that limited what we read,
+ * check if SSL has additional data pending inside SSL buffers.
+ *
+ * Because these won't signal at the network layer with POLLIN
+ * and if we don't realize, this data will sit there forever
+ */
+ if (n != len)
+ goto bail;
+ if (!wsi->tls.ssl)
+ goto bail;
+
+ if (!SSL_pending(wsi->tls.ssl))
+ goto bail;
+
+ if (wsi->tls.pending_read_list_next)
+ return n;
+ if (wsi->tls.pending_read_list_prev)
+ return n;
+ if (pt->tls.pending_read_list == wsi)
+ return n;
+
+ /* add us to the linked list of guys with pending ssl */
+ if (pt->tls.pending_read_list)
+ pt->tls.pending_read_list->tls.pending_read_list_prev = wsi;
+
+ wsi->tls.pending_read_list_next = pt->tls.pending_read_list;
+ wsi->tls.pending_read_list_prev = NULL;
+ pt->tls.pending_read_list = wsi;
+
+ return n;
+bail:
+ lws_ssl_remove_wsi_from_buffered_list(wsi);
+
+ return n;
+}
+
+LWS_VISIBLE int
+lws_ssl_pending(struct lws *wsi)
+{
+ if (!wsi->tls.ssl)
+ return 0;
+
+ return SSL_pending(wsi->tls.ssl);
+}
+
+LWS_VISIBLE int
+lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len)
+{
+ int n, m;
+
+ if (!wsi->tls.ssl)
+ return lws_ssl_capable_write_no_ssl(wsi, buf, len);
+
+ n = SSL_write(wsi->tls.ssl, buf, len);
+ if (n > 0)
+ return n;
+
+ m = SSL_get_error(wsi->tls.ssl, n);
+ if (m != SSL_ERROR_SYSCALL) {
+ if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->tls.ssl)) {
+ lwsl_notice("%s: want read\n", __func__);
+
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+ }
+
+ if (m == SSL_ERROR_WANT_WRITE || SSL_want_write(wsi->tls.ssl)) {
+ lws_set_blocking_send(wsi);
+ lwsl_notice("%s: want write\n", __func__);
+
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+ }
+ }
+
+ lwsl_debug("%s failed: %d\n",__func__, m);
+ wsi->socket_is_permanently_unusable = 1;
+
+ return LWS_SSL_CAPABLE_ERROR;
+}
+
+int openssl_SSL_CTX_private_data_index;
+
+void
+lws_ssl_info_callback(const SSL *ssl, int where, int ret)
+{
+ struct lws *wsi;
+ struct lws_context *context;
+ struct lws_ssl_info si;
+
+ context = (struct lws_context *)SSL_CTX_get_ex_data(
+ SSL_get_SSL_CTX(ssl),
+ openssl_SSL_CTX_private_data_index);
+ if (!context)
+ return;
+ wsi = wsi_from_fd(context, SSL_get_fd(ssl));
+ if (!wsi)
+ return;
+
+ if (!(where & wsi->vhost->tls.ssl_info_event_mask))
+ return;
+
+ si.where = where;
+ si.ret = ret;
+
+ if (user_callback_handle_rxflow(wsi->protocol->callback,
+ wsi, LWS_CALLBACK_SSL_INFO,
+ wsi->user_space, &si, 0))
+ lws_set_timeout(wsi, PENDING_TIMEOUT_KILLED_BY_SSL_INFO, -1);
+}
+
+
+LWS_VISIBLE int
+lws_ssl_close(struct lws *wsi)
+{
+ lws_sockfd_type n;
+
+ if (!wsi->tls.ssl)
+ return 0; /* not handled */
+
+#if defined (LWS_HAVE_SSL_SET_INFO_CALLBACK)
+ /* kill ssl callbacks, becausse we will remove the fd from the
+ * table linking it to the wsi
+ */
+ if (wsi->vhost->tls.ssl_info_event_mask)
+ SSL_set_info_callback(wsi->tls.ssl, NULL);
+#endif
+
+ n = SSL_get_fd(wsi->tls.ssl);
+ if (!wsi->socket_is_permanently_unusable)
+ SSL_shutdown(wsi->tls.ssl);
+ compatible_close(n);
+ SSL_free(wsi->tls.ssl);
+ wsi->tls.ssl = NULL;
+
+ if (!lwsi_role_client(wsi) &&
+ wsi->context->simultaneous_ssl_restriction &&
+ wsi->context->simultaneous_ssl-- ==
+ wsi->context->simultaneous_ssl_restriction)
+ /* we made space and can do an accept */
+ lws_gate_accepts(wsi->context, 1);
+
+#if defined(LWS_WITH_STATS)
+ wsi->context->updated = 1;
+#endif
+
+ return 1; /* handled */
+}
+
+void
+lws_ssl_SSL_CTX_destroy(struct lws_vhost *vhost)
+{
+ if (vhost->tls.ssl_ctx)
+ SSL_CTX_free(vhost->tls.ssl_ctx);
+
+ if (!vhost->tls.user_supplied_ssl_ctx && vhost->tls.ssl_client_ctx)
+ SSL_CTX_free(vhost->tls.ssl_client_ctx);
+#if defined(LWS_WITH_ACME)
+ lws_tls_acme_sni_cert_destroy(vhost);
+#endif
+}
+
+void
+lws_ssl_context_destroy(struct lws_context *context)
+{
+}
+
+lws_tls_ctx *
+lws_tls_ctx_from_wsi(struct lws *wsi)
+{
+ if (!wsi->tls.ssl)
+ return NULL;
+
+ return SSL_get_SSL_CTX(wsi->tls.ssl);
+}
+
+enum lws_ssl_capable_status
+__lws_tls_shutdown(struct lws *wsi)
+{
+ int n = SSL_shutdown(wsi->tls.ssl);
+
+ lwsl_debug("SSL_shutdown=%d for fd %d\n", n, wsi->desc.sockfd);
+
+ switch (n) {
+ case 1: /* successful completion */
+ n = shutdown(wsi->desc.sockfd, SHUT_WR);
+ return LWS_SSL_CAPABLE_DONE;
+
+ case 0: /* needs a retry */
+ __lws_change_pollfd(wsi, 0, LWS_POLLIN);
+ return LWS_SSL_CAPABLE_MORE_SERVICE;
+
+ default: /* fatal error, or WANT */
+ n = SSL_get_error(wsi->tls.ssl, n);
+ if (n != SSL_ERROR_SYSCALL && n != SSL_ERROR_SSL) {
+ if (SSL_want_read(wsi->tls.ssl)) {
+ lwsl_debug("(wants read)\n");
+ __lws_change_pollfd(wsi, 0, LWS_POLLIN);
+ return LWS_SSL_CAPABLE_MORE_SERVICE_READ;
+ }
+ if (SSL_want_write(wsi->tls.ssl)) {
+ lwsl_debug("(wants write)\n");
+ __lws_change_pollfd(wsi, 0, LWS_POLLOUT);
+ return LWS_SSL_CAPABLE_MORE_SERVICE_WRITE;
+ }
+ }
+ return LWS_SSL_CAPABLE_ERROR;
+ }
+}
+
+static time_t
+lws_tls_mbedtls_time_to_unix(mbedtls_x509_time *xtime)
+{
+ struct tm t;
+
+ if (!xtime || !xtime->year || xtime->year < 0)
+ return (time_t)(long long)-1;
+
+ memset(&t, 0, sizeof(t));
+
+ t.tm_year = xtime->year - 1900;
+ t.tm_mon = xtime->mon - 1; /* mbedtls months are 1+, tm are 0+ */
+ t.tm_mday = xtime->day - 1; /* mbedtls days are 1+, tm are 0+ */
+ t.tm_hour = xtime->hour;
+ t.tm_min = xtime->min;
+ t.tm_sec = xtime->sec;
+ t.tm_isdst = -1;
+
+ return mktime(&t);
+}
+
+static int
+lws_tls_mbedtls_get_x509_name(mbedtls_x509_name *name,
+ union lws_tls_cert_info_results *buf, size_t len)
+{
+ while (name) {
+ if (MBEDTLS_OID_CMP(MBEDTLS_OID_AT_CN, &name->oid)) {
+ name = name->next;
+ continue;
+ }
+
+ if (len - 1 < name->val.len)
+ return -1;
+
+ memcpy(&buf->ns.name[0], name->val.p, name->val.len);
+ buf->ns.name[name->val.len] = '\0';
+ buf->ns.len = name->val.len;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+static int
+lws_tls_mbedtls_cert_info(mbedtls_x509_crt *x509, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len)
+{
+ if (!x509)
+ return -1;
+
+ switch (type) {
+ case LWS_TLS_CERT_INFO_VALIDITY_FROM:
+ buf->time = lws_tls_mbedtls_time_to_unix(&x509->valid_from);
+ if (buf->time == (time_t)(long long)-1)
+ return -1;
+ break;
+
+ case LWS_TLS_CERT_INFO_VALIDITY_TO:
+ buf->time = lws_tls_mbedtls_time_to_unix(&x509->valid_to);
+ if (buf->time == (time_t)(long long)-1)
+ return -1;
+ break;
+
+ case LWS_TLS_CERT_INFO_COMMON_NAME:
+ return lws_tls_mbedtls_get_x509_name(&x509->subject, buf, len);
+
+ case LWS_TLS_CERT_INFO_ISSUER_NAME:
+ return lws_tls_mbedtls_get_x509_name(&x509->issuer, buf, len);
+
+ case LWS_TLS_CERT_INFO_USAGE:
+ buf->usage = x509->key_usage;
+ break;
+
+ case LWS_TLS_CERT_INFO_OPAQUE_PUBLIC_KEY:
+ {
+ char *p = buf->ns.name;
+ size_t r = len, u;
+
+ switch (mbedtls_pk_get_type(&x509->pk)) {
+ case MBEDTLS_PK_RSA:
+ {
+ mbedtls_rsa_context *rsa = mbedtls_pk_rsa(x509->pk);
+
+ if (mbedtls_mpi_write_string(&rsa->N, 16, p, r, &u))
+ return -1;
+ r -= u;
+ p += u;
+ if (mbedtls_mpi_write_string(&rsa->E, 16, p, r, &u))
+ return -1;
+
+ p += u;
+ buf->ns.len = lws_ptr_diff(p, buf->ns.name);
+ break;
+ }
+ case MBEDTLS_PK_ECKEY:
+ {
+ mbedtls_ecp_keypair *ecp = mbedtls_pk_ec(x509->pk);
+
+ if (mbedtls_mpi_write_string(&ecp->Q.X, 16, p, r, &u))
+ return -1;
+ r -= u;
+ p += u;
+ if (mbedtls_mpi_write_string(&ecp->Q.Y, 16, p, r, &u))
+ return -1;
+ r -= u;
+ p += u;
+ if (mbedtls_mpi_write_string(&ecp->Q.Z, 16, p, r, &u))
+ return -1;
+ p += u;
+ buf->ns.len = lws_ptr_diff(p, buf->ns.name);
+ break;
+ }
+ default:
+ lwsl_notice("%s: x509 has unsupported pubkey type %d\n",
+ __func__,
+ mbedtls_pk_get_type(&x509->pk));
+
+ return -1;
+ }
+ break;
+ }
+
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+LWS_VISIBLE LWS_EXTERN int
+lws_tls_vhost_cert_info(struct lws_vhost *vhost, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len)
+{
+ mbedtls_x509_crt *x509 = ssl_ctx_get_mbedtls_x509_crt(vhost->tls.ssl_ctx);
+
+ return lws_tls_mbedtls_cert_info(x509, type, buf, len);
+}
+
+LWS_VISIBLE int
+lws_tls_peer_cert_info(struct lws *wsi, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len)
+{
+ mbedtls_x509_crt *x509;
+
+ wsi = lws_get_network_wsi(wsi);
+
+ x509 = ssl_get_peer_mbedtls_x509_crt(wsi->tls.ssl);
+
+ if (!x509)
+ return -1;
+
+ switch (type) {
+ case LWS_TLS_CERT_INFO_VERIFIED:
+ buf->verified = SSL_get_verify_result(wsi->tls.ssl) == X509_V_OK;
+ return 0;
+ default:
+ return lws_tls_mbedtls_cert_info(x509, type, buf, len);
+ }
+
+ return -1;
+}
+
+static int
+tops_fake_POLLIN_for_buffered_mbedtls(struct lws_context_per_thread *pt)
+{
+ return lws_tls_fake_POLLIN_for_buffered(pt);
+}
+
+static int
+tops_periodic_housekeeping_mbedtls(struct lws_context *context, time_t now)
+{
+ int n;
+
+ n = lws_compare_time_t(context, now, context->tls.last_cert_check_s);
+ if ((!context->tls.last_cert_check_s || n > (24 * 60 * 60)) &&
+ !lws_tls_check_all_cert_lifetimes(context))
+ context->tls.last_cert_check_s = now;
+
+ return 0;
+}
+
+const struct lws_tls_ops tls_ops_mbedtls = {
+ /* fake_POLLIN_for_buffered */ tops_fake_POLLIN_for_buffered_mbedtls,
+ /* periodic_housekeeping */ tops_periodic_housekeeping_mbedtls,
+};
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl3.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl3.h
index 007b392f3e..007b392f3e 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl3.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl3.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_cert.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_cert.h
index 86cf31ad51..86cf31ad51 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_cert.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_cert.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_code.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_code.h
index 80fdbb20f3..80fdbb20f3 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_code.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_code.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_dbg.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_dbg.h
index ad32cb92ff..ad32cb92ff 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_dbg.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_dbg.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_lib.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_lib.h
index 42b2de7501..42b2de7501 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_lib.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_lib.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_methods.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_methods.h
index cd2f8c0533..cd2f8c0533 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_methods.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_methods.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_pkey.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_pkey.h
index e790fcc995..e790fcc995 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_pkey.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_pkey.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_stack.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_stack.h
index 7a7051a026..7a7051a026 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_stack.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_stack.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_types.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_types.h
index 45198bc978..ba19663d9e 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_types.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_types.h
@@ -203,6 +203,8 @@ struct ssl_st
const SSL_METHOD *method;
+ const char **alpn_protos;
+
RECORD_LAYER rlayer;
/* where we are */
@@ -215,6 +217,7 @@ struct ssl_st
int (*verify_callback) (int ok, X509_STORE_CTX *ctx);
int rwstate;
+ int interrupted_remaining_write;
long verify_result;
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_x509.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_x509.h
index 7594d064b4..7594d064b4 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/ssl_x509.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/ssl_x509.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/tls1.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/tls1.h
index 7af1b0157d..7af1b0157d 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/tls1.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/tls1.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/internal/x509_vfy.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/x509_vfy.h
index 26bf6c88a8..26bf6c88a8 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/internal/x509_vfy.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/internal/x509_vfy.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/openssl/ssl.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/openssl/ssl.h
index 5a84b4552e..e2b74fc6af 100644..100755
--- a/thirdparty/lws/mbedtls_wrapper/include/openssl/ssl.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/openssl/ssl.h
@@ -35,6 +35,22 @@
#define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS (1 << 3)
#define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS (1 << 4)
+ mbedtls_x509_crt *
+ ssl_ctx_get_mbedtls_x509_crt(SSL_CTX *ssl_ctx);
+
+ mbedtls_x509_crt *
+ ssl_get_peer_mbedtls_x509_crt(SSL *ssl);
+
+ int SSL_set_sni_callback(SSL *ssl, int(*cb)(void *, mbedtls_ssl_context *,
+ const unsigned char *, size_t), void *param);
+
+ void SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx);
+
+ int SSL_CTX_add_client_CA_ASN1(SSL_CTX *ssl, int len,
+ const unsigned char *d);
+
+ SSL *SSL_SSL_from_mbedtls_ssl_context(mbedtls_ssl_context *msc);
+
/**
* @brief create a SSL context
*
@@ -305,6 +321,7 @@ void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
void *arg),
void *arg);
+void SSL_set_alpn_select_cb(SSL *ssl, void *arg);
/**
* @brief set the SSL context ALPN select protocol
diff --git a/thirdparty/lws/mbedtls_wrapper/include/platform/ssl_pm.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_pm.h
index cbbe3aa3a2..cbbe3aa3a2 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/platform/ssl_pm.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_pm.h
diff --git a/thirdparty/lws/mbedtls_wrapper/include/platform/ssl_port.h b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_port.h
index fd461e9819..74c7634355 100644
--- a/thirdparty/lws/mbedtls_wrapper/include/platform/ssl_port.h
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/include/platform/ssl_port.h
@@ -19,15 +19,9 @@
extern "C" {
#endif
-/*
-#include "esp_types.h"
-#include "esp_log.h"
-*/
#include "string.h"
-
-#ifdef __APPLE__
-#include <stdlib.h>
-#else
+#include "stdlib.h"
+#if defined(LWS_HAVE_MALLOC_H)
#include "malloc.h"
#endif
diff --git a/thirdparty/lws/mbedtls_wrapper/library/ssl_cert.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_cert.c
index 5c608125ac..5c608125ac 100644
--- a/thirdparty/lws/mbedtls_wrapper/library/ssl_cert.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_cert.c
diff --git a/thirdparty/lws/mbedtls_wrapper/library/ssl_lib.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_lib.c
index 187fc9f005..2f688ca9ef 100644
--- a/thirdparty/lws/mbedtls_wrapper/library/ssl_lib.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_lib.c
@@ -19,6 +19,9 @@
#include "ssl_dbg.h"
#include "ssl_port.h"
+char *
+lws_strncpy(char *dest, const char *src, size_t size);
+
#define SSL_SEND_DATA_MAX_LENGTH 1460
/**
@@ -142,9 +145,9 @@ int SSL_get_error(const SSL *ssl, int ret_code)
ret = SSL_ERROR_NONE;
else if (ret_code < 0)
{
- if (SSL_want_read(ssl))
+ if (ssl->err == SSL_ERROR_WANT_READ || SSL_want_read(ssl))
ret = SSL_ERROR_WANT_READ;
- else if (SSL_want_write(ssl))
+ else if (ssl->err == SSL_ERROR_WANT_WRITE || SSL_want_write(ssl))
ret = SSL_ERROR_WANT_WRITE;
else
ret = SSL_ERROR_SYSCALL; //unknown
@@ -348,6 +351,9 @@ void SSL_free(SSL *ssl)
SSL_SESSION_free(ssl->session);
+ if (ssl->alpn_protos)
+ ssl_mem_free(ssl->alpn_protos);
+
ssl_mem_free(ssl);
}
@@ -457,7 +463,7 @@ int SSL_read(SSL *ssl, void *buffer, int len)
int SSL_write(SSL *ssl, const void *buffer, int len)
{
int ret;
- int send_bytes;
+ int send_bytes, bytes;
const unsigned char *pbuf;
SSL_ASSERT1(ssl);
@@ -470,25 +476,36 @@ int SSL_write(SSL *ssl, const void *buffer, int len)
pbuf = (const unsigned char *)buffer;
do {
- int bytes;
-
if (send_bytes > SSL_SEND_DATA_MAX_LENGTH)
bytes = SSL_SEND_DATA_MAX_LENGTH;
else
bytes = send_bytes;
+ if (ssl->interrupted_remaining_write) {
+ bytes = ssl->interrupted_remaining_write;
+ ssl->interrupted_remaining_write = 0;
+ }
+
ret = SSL_METHOD_CALL(send, ssl, pbuf, bytes);
+ //printf("%s: ssl_pm said %d for %d requested (cum %d)\n", __func__, ret, bytes, len -send_bytes);
+ /* the return is a NEGATIVE OpenSSL error code, or the length sent */
if (ret > 0) {
pbuf += ret;
send_bytes -= ret;
- }
- } while (ret > 0 && send_bytes);
+ } else
+ ssl->interrupted_remaining_write = bytes;
+ } while (ret > 0 && send_bytes && ret == bytes);
if (ret >= 0) {
ret = len - send_bytes;
- ssl->rwstate = SSL_NOTHING;
- } else
- ret = -1;
+ if (!ret)
+ ssl->rwstate = SSL_NOTHING;
+ } else {
+ if (send_bytes == len)
+ ret = -1;
+ else
+ ret = len - send_bytes;
+ }
return ret;
}
@@ -1571,7 +1588,7 @@ void SSL_set_verify(SSL *ssl, int mode, int (*verify_callback)(int, X509_STORE_C
void ERR_error_string_n(unsigned long e, char *buf, size_t len)
{
- strncpy(buf, "unknown", len);
+ lws_strncpy(buf, "unknown", len);
}
void ERR_free_strings(void)
@@ -1580,11 +1597,34 @@ void ERR_free_strings(void)
char *ERR_error_string(unsigned long e, char *buf)
{
- if (buf) {
- strcpy(buf, "unknown");
+ if (!buf)
+ return "unknown";
+
+ switch(e) {
+ case X509_V_ERR_INVALID_CA:
+ strcpy(buf, "CA is not trusted");
+ break;
+ case X509_V_ERR_HOSTNAME_MISMATCH:
+ strcpy(buf, "Hostname mismatch");
+ break;
+ case X509_V_ERR_CA_KEY_TOO_SMALL:
+ strcpy(buf, "CA key too small");
+ break;
+ case X509_V_ERR_CA_MD_TOO_WEAK:
+ strcpy(buf, "MD key too weak");
+ break;
+ case X509_V_ERR_CERT_NOT_YET_VALID:
+ strcpy(buf, "Cert from the future");
+ break;
+ case X509_V_ERR_CERT_HAS_EXPIRED:
+ strcpy(buf, "Cert expired");
+ break;
+ default:
+ strcpy(buf, "unknown");
+ break;
}
- return "unknown";
+ return buf;
}
void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx)
@@ -1608,15 +1648,16 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx)
*/
struct alpn_ctx {
- unsigned char *data;
- unsigned short len;
+ unsigned char data[23];
+ unsigned char len;
};
-void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, next_proto_cb cb, void *arg)
+static void
+_openssl_alpn_to_mbedtls(struct alpn_ctx *ac, char ***palpn_protos)
{
- struct alpn_ctx *ac = arg;
unsigned char *p = ac->data, *q;
unsigned char len;
+ char **alpn_protos;
int count = 0;
/* find out how many entries he gave us */
@@ -1633,23 +1674,28 @@ void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, next_proto_cb cb, void *arg)
break;
}
+ if (!len)
+ count++;
+
if (!count)
return;
/* allocate space for count + 1 pointers and the data afterwards */
- ctx->alpn_protos = ssl_mem_zalloc((count + 1) * sizeof(char *) + ac->len + 1);
- if (!ctx->alpn_protos)
+ alpn_protos = ssl_mem_zalloc((count + 1) * sizeof(char *) + ac->len + 1);
+ if (!alpn_protos)
return;
+ *palpn_protos = alpn_protos;
+
/* convert to mbedtls format */
- q = (unsigned char *)ctx->alpn_protos + (count + 1) * sizeof(char *);
+ q = (unsigned char *)alpn_protos + (count + 1) * sizeof(char *);
p = ac->data;
count = 0;
len = *p++;
- ctx->alpn_protos[count] = (char *)q;
+ alpn_protos[count] = (char *)q;
while (p - ac->data < ac->len) {
if (len--) {
*q++ = *p++;
@@ -1658,11 +1704,33 @@ void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, next_proto_cb cb, void *arg)
*q++ = '\0';
count++;
len = *p++;
- ctx->alpn_protos[count] = (char *)q;
+ alpn_protos[count] = (char *)q;
if (!len)
break;
}
- ctx->alpn_protos[count] = NULL; /* last pointer ends list with NULL */
+ if (!len) {
+ *q++ = '\0';
+ count++;
+ len = *p++;
+ alpn_protos[count] = (char *)q;
+ }
+ alpn_protos[count] = NULL; /* last pointer ends list with NULL */
+}
+
+void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, next_proto_cb cb, void *arg)
+{
+ struct alpn_ctx *ac = arg;
ctx->alpn_cb = cb;
+
+ _openssl_alpn_to_mbedtls(ac, (char ***)&ctx->alpn_protos);
+}
+
+void SSL_set_alpn_select_cb(SSL *ssl, void *arg)
+{
+ struct alpn_ctx *ac = arg;
+
+ _openssl_alpn_to_mbedtls(ac, (char ***)&ssl->alpn_protos);
+
+ _ssl_set_alpn_list(ssl);
}
diff --git a/thirdparty/lws/mbedtls_wrapper/library/ssl_methods.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_methods.c
index 0002360846..0002360846 100644
--- a/thirdparty/lws/mbedtls_wrapper/library/ssl_methods.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_methods.c
diff --git a/thirdparty/lws/mbedtls_wrapper/library/ssl_pkey.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_pkey.c
index 567a33e2c2..567a33e2c2 100644
--- a/thirdparty/lws/mbedtls_wrapper/library/ssl_pkey.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_pkey.c
diff --git a/thirdparty/lws/mbedtls_wrapper/library/ssl_stack.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_stack.c
index da836daf9c..da836daf9c 100644
--- a/thirdparty/lws/mbedtls_wrapper/library/ssl_stack.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_stack.c
diff --git a/thirdparty/lws/mbedtls_wrapper/library/ssl_x509.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_x509.c
index 4441490a03..ed79150831 100644
--- a/thirdparty/lws/mbedtls_wrapper/library/ssl_x509.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/library/ssl_x509.c
@@ -17,6 +17,8 @@
#include "ssl_dbg.h"
#include "ssl_port.h"
+#include <assert.h>
+
/**
* @brief show X509 certification information
*/
@@ -155,7 +157,7 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
{
SSL_ASSERT1(ctx);
SSL_ASSERT1(x);
-
+ assert(ctx);
if (ctx->client_CA == x)
return 1;
@@ -169,6 +171,28 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
/**
* @brief add CA client certification into the SSL
*/
+int SSL_CTX_add_client_CA_ASN1(SSL_CTX *ctx, int len,
+ const unsigned char *d)
+{
+ X509 *x;
+
+ x = d2i_X509(NULL, d, len);
+ if (!x) {
+ SSL_DEBUG(SSL_PKEY_ERROR_LEVEL, "d2i_X509() return NULL");
+ return 0;
+ }
+ SSL_ASSERT1(ctx);
+
+ X509_free(ctx->client_CA);
+
+ ctx->client_CA = x;
+
+ return 1;
+}
+
+/**
+ * @brief add CA client certification into the SSL
+ */
int SSL_add_client_CA(SSL *ssl, X509 *x)
{
SSL_ASSERT1(ssl);
diff --git a/thirdparty/lws/mbedtls_wrapper/platform/ssl_pm.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_pm.c
index 536733fbab..4716c1ff56 100644..100755
--- a/thirdparty/lws/mbedtls_wrapper/platform/ssl_pm.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_pm.c
@@ -25,6 +25,8 @@
#include "mbedtls/error.h"
#include "mbedtls/certs.h"
+#include <libwebsockets.h>
+
#define X509_INFO_STRING_LENGTH 8192
struct ssl_pm
@@ -41,6 +43,8 @@ struct ssl_pm
mbedtls_ssl_context ssl;
mbedtls_entropy_context entropy;
+
+ SSL *owner;
};
struct x509_pm
@@ -62,7 +66,7 @@ unsigned int max_content_len;
/*********************************************************************************************/
/************************************ SSL arch interface *************************************/
-#ifdef CONFIG_OPENSSL_LOWLEVEL_DEBUG
+//#ifdef CONFIG_OPENSSL_LOWLEVEL_DEBUG
/* mbedtls debug level */
#define MBEDTLS_DEBUG_LEVEL 4
@@ -79,13 +83,13 @@ static void ssl_platform_debug(void *ctx, int level,
This is a bit wasteful because the macros are compiled in with
the full _FILE_ path in each case.
*/
- char *file_sep = rindex(file, '/');
- if(file_sep)
- file = file_sep + 1;
+// char *file_sep = rindex(file, '/');
+ // if(file_sep)
+ // file = file_sep + 1;
- SSL_DEBUG(SSL_DEBUG_ON, "%s:%d %s", file, line, str);
+ printf("%s:%d %s", file, line, str);
}
-#endif
+//#endif
/**
* @brief create SSL low-level object
@@ -109,6 +113,8 @@ int ssl_pm_new(SSL *ssl)
goto no_mem;
}
+ ssl_pm->owner = ssl;
+
if (!ssl->ctx->read_buffer_len)
ssl->ctx->read_buffer_len = 2048;
@@ -159,12 +165,12 @@ int ssl_pm_new(SSL *ssl)
mbedtls_ssl_conf_rng(&ssl_pm->conf, mbedtls_ctr_drbg_random, &ssl_pm->ctr_drbg);
-#ifdef CONFIG_OPENSSL_LOWLEVEL_DEBUG
- mbedtls_debug_set_threshold(MBEDTLS_DEBUG_LEVEL);
+//#ifdef CONFIG_OPENSSL_LOWLEVEL_DEBUG
+ // mbedtls_debug_set_threshold(MBEDTLS_DEBUG_LEVEL);
+// mbedtls_ssl_conf_dbg(&ssl_pm->conf, ssl_platform_debug, NULL);
+//#else
mbedtls_ssl_conf_dbg(&ssl_pm->conf, ssl_platform_debug, NULL);
-#else
- mbedtls_ssl_conf_dbg(&ssl_pm->conf, NULL, NULL);
-#endif
+//#endif
ret = mbedtls_ssl_setup(&ssl_pm->ssl, &ssl_pm->conf);
if (ret) {
@@ -218,7 +224,7 @@ static int ssl_pm_reload_crt(SSL *ssl)
struct x509_pm *crt_pm = (struct x509_pm *)ssl->cert->x509->x509_pm;
if (ssl->verify_mode == SSL_VERIFY_PEER)
- mode = MBEDTLS_SSL_VERIFY_REQUIRED;
+ mode = MBEDTLS_SSL_VERIFY_OPTIONAL;
else if (ssl->verify_mode == SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
mode = MBEDTLS_SSL_VERIFY_OPTIONAL;
else if (ssl->verify_mode == SSL_VERIFY_CLIENT_ONCE)
@@ -261,7 +267,7 @@ static int mbedtls_handshake( mbedtls_ssl_context *ssl )
while (ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER) {
ret = mbedtls_ssl_handshake_step(ssl);
- SSL_DEBUG(SSL_PLATFORM_DEBUG_LEVEL, "ssl ret %d state %d", ret, ssl->state);
+ lwsl_info("%s: ssl ret -%x state %d\n", __func__, -ret, ssl->state);
if (ret != 0)
break;
@@ -270,14 +276,21 @@ static int mbedtls_handshake( mbedtls_ssl_context *ssl )
return ret;
}
+#include <errno.h>
+
int ssl_pm_handshake(SSL *ssl)
{
int ret;
struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
+ ssl->err = 0;
+ errno = 0;
+
ret = ssl_pm_reload_crt(ssl);
- if (ret)
+ if (ret) {
+ printf("%s: cert reload failed\n", __func__);
return 0;
+ }
if (ssl_pm->ssl.state != MBEDTLS_SSL_HANDSHAKE_OVER) {
ssl_speed_up_enter();
@@ -298,6 +311,7 @@ int ssl_pm_handshake(SSL *ssl)
* <0 = death
*/
if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
+ ssl->err = ret;
SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_handshake() return -0x%x", -ret);
return 0; /* OpenSSL: did not complete but may be retried */
}
@@ -309,6 +323,14 @@ int ssl_pm_handshake(SSL *ssl)
return 1; /* openssl successful */
}
+ if (errno == 11) {
+ ssl->err = ret == MBEDTLS_ERR_SSL_WANT_READ;
+
+ return 0;
+ }
+
+ printf("%s: mbedtls_ssl_handshake() returned -0x%x\n", __func__, -ret);
+
/* it's had it */
ssl->err = SSL_ERROR_SYSCALL;
@@ -316,6 +338,28 @@ int ssl_pm_handshake(SSL *ssl)
return -1; /* openssl death */
}
+mbedtls_x509_crt *
+ssl_ctx_get_mbedtls_x509_crt(SSL_CTX *ssl_ctx)
+{
+ struct x509_pm *x509_pm = (struct x509_pm *)ssl_ctx->cert->x509->x509_pm;
+
+ if (!x509_pm)
+ return NULL;
+
+ return x509_pm->x509_crt;
+}
+
+mbedtls_x509_crt *
+ssl_get_peer_mbedtls_x509_crt(SSL *ssl)
+{
+ struct x509_pm *x509_pm = (struct x509_pm *)ssl->session->peer->x509_pm;
+
+ if (!x509_pm)
+ return NULL;
+
+ return x509_pm->ex_crt;
+}
+
int ssl_pm_shutdown(SSL *ssl)
{
int ret;
@@ -351,8 +395,10 @@ int ssl_pm_read(SSL *ssl, void *buffer, int len)
ret = mbedtls_ssl_read(&ssl_pm->ssl, buffer, len);
if (ret < 0) {
+ // lwsl_notice("%s: mbedtls_ssl_read says -0x%x\n", __func__, -ret);
SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_read() return -0x%x", -ret);
- if (ret == MBEDTLS_ERR_NET_CONN_RESET)
+ if (ret == MBEDTLS_ERR_NET_CONN_RESET ||
+ ret <= MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE) /* fatal errors */
ssl->err = SSL_ERROR_SYSCALL;
ret = -1;
}
@@ -360,17 +406,53 @@ int ssl_pm_read(SSL *ssl, void *buffer, int len)
return ret;
}
+/*
+ * This returns -1, or the length sent.
+ * If -1, then you need to find out if the error was
+ * fatal or recoverable using SSL_get_error()
+ */
int ssl_pm_send(SSL *ssl, const void *buffer, int len)
{
int ret;
struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
ret = mbedtls_ssl_write(&ssl_pm->ssl, buffer, len);
+ /*
+ * We can get a positive number, which may be less than len... that
+ * much was sent successfully and you can call again to send more.
+ *
+ * We can get a negative mbedtls error code... if WANT_WRITE or WANT_READ,
+ * it's nonfatal and means it should be retried as-is. If something else,
+ * it's fatal actually.
+ *
+ * If this function returns something other than a positive value or
+ * MBEDTLS_ERR_SSL_WANT_READ/WRITE, the ssl context becomes unusable, and
+ * you should either free it or call mbedtls_ssl_session_reset() on it
+ * before re-using it for a new connection; the current connection must
+ * be closed.
+ *
+ * When this function returns MBEDTLS_ERR_SSL_WANT_WRITE/READ, it must be
+ * called later with the same arguments, until it returns a positive value.
+ */
+
if (ret < 0) {
- if (ret == MBEDTLS_ERR_NET_CONN_RESET)
+ SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_write() return -0x%x", -ret);
+ switch (ret) {
+ case MBEDTLS_ERR_NET_SEND_FAILED:
+ case MBEDTLS_ERR_NET_CONN_RESET:
ssl->err = SSL_ERROR_SYSCALL;
- SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_write() return -0x%x", -ret);
- ret = -1;
+ break;
+ case MBEDTLS_ERR_SSL_WANT_WRITE:
+ ssl->err = SSL_ERROR_WANT_WRITE;
+ break;
+ case MBEDTLS_ERR_SSL_WANT_READ:
+ ssl->err = SSL_ERROR_WANT_READ;
+ break;
+ default:
+ break;
+ }
+
+ ret = -1;
}
return ret;
@@ -554,22 +636,27 @@ int x509_pm_load(X509 *x, const unsigned char *buffer, int len)
}
}
- load_buf = ssl_mem_malloc(len + 1);
- if (!load_buf) {
- SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "no enough memory > (load_buf)");
- goto failed;
- }
-
- ssl_memcpy(load_buf, buffer, len);
- load_buf[len] = '\0';
-
mbedtls_x509_crt_init(x509_pm->x509_crt);
+ if (buffer[0] != 0x30) {
+ load_buf = ssl_mem_malloc(len + 1);
+ if (!load_buf) {
+ SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "no enough memory > (load_buf)");
+ goto failed;
+ }
+
+ ssl_memcpy(load_buf, buffer, len);
+ load_buf[len] = '\0';
+
+ ret = mbedtls_x509_crt_parse(x509_pm->x509_crt, load_buf, len + 1);
+ ssl_mem_free(load_buf);
+ } else {
+ printf("parsing as der\n");
- ret = mbedtls_x509_crt_parse(x509_pm->x509_crt, load_buf, len + 1);
- ssl_mem_free(load_buf);
+ ret = mbedtls_x509_crt_parse_der(x509_pm->x509_crt, buffer, len);
+ }
if (ret) {
- SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_x509_crt_parse return -0x%x", -ret);
+ printf("mbedtls_x509_crt_parse return -0x%x", -ret);
goto failed;
}
@@ -672,18 +759,44 @@ void ssl_pm_set_bufflen(SSL *ssl, int len)
long ssl_pm_get_verify_result(const SSL *ssl)
{
- uint32_t ret;
- long verify_result;
- struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
+ uint32_t ret;
+ long verify_result;
+ struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
- ret = mbedtls_ssl_get_verify_result(&ssl_pm->ssl);
- if (ret) {
- SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_get_verify_result() return 0x%x", ret);
- verify_result = X509_V_ERR_UNSPECIFIED;
- } else
- verify_result = X509_V_OK;
+ ret = mbedtls_ssl_get_verify_result(&ssl_pm->ssl);
+ if (!ret)
+ return X509_V_OK;
+
+ if (ret & MBEDTLS_X509_BADCERT_NOT_TRUSTED ||
+ (ret & MBEDTLS_X509_BADCRL_NOT_TRUSTED))
+ verify_result = X509_V_ERR_INVALID_CA;
+
+ else if (ret & MBEDTLS_X509_BADCERT_CN_MISMATCH)
+ verify_result = X509_V_ERR_HOSTNAME_MISMATCH;
- return verify_result;
+ else if ((ret & MBEDTLS_X509_BADCERT_BAD_KEY) ||
+ (ret & MBEDTLS_X509_BADCRL_BAD_KEY))
+ verify_result = X509_V_ERR_CA_KEY_TOO_SMALL;
+
+ else if ((ret & MBEDTLS_X509_BADCERT_BAD_MD) ||
+ (ret & MBEDTLS_X509_BADCRL_BAD_MD))
+ verify_result = X509_V_ERR_CA_MD_TOO_WEAK;
+
+ else if ((ret & MBEDTLS_X509_BADCERT_FUTURE) ||
+ (ret & MBEDTLS_X509_BADCRL_FUTURE))
+ verify_result = X509_V_ERR_CERT_NOT_YET_VALID;
+
+ else if ((ret & MBEDTLS_X509_BADCERT_EXPIRED) ||
+ (ret & MBEDTLS_X509_BADCRL_EXPIRED))
+ verify_result = X509_V_ERR_CERT_HAS_EXPIRED;
+
+ else
+ verify_result = X509_V_ERR_UNSPECIFIED;
+
+ SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL,
+ "mbedtls_ssl_get_verify_result() return 0x%x", ret);
+
+ return verify_result;
}
/**
@@ -716,6 +829,12 @@ int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
void _ssl_set_alpn_list(const SSL *ssl)
{
+ if (ssl->alpn_protos) {
+ if (mbedtls_ssl_conf_alpn_protocols(&((struct ssl_pm *)(ssl->ssl_pm))->conf, ssl->alpn_protos))
+ fprintf(stderr, "mbedtls_ssl_conf_alpn_protocols failed\n");
+
+ return;
+ }
if (!ssl->ctx->alpn_protos)
return;
if (mbedtls_ssl_conf_alpn_protocols(&((struct ssl_pm *)(ssl->ssl_pm))->conf, ssl->ctx->alpn_protos))
@@ -734,3 +853,55 @@ void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,
*len = 0;
}
+int SSL_set_sni_callback(SSL *ssl, int(*cb)(void *, mbedtls_ssl_context *,
+ const unsigned char *, size_t), void *param)
+{
+ struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
+
+ mbedtls_ssl_conf_sni(&ssl_pm->conf, cb, param);
+
+ return 0;
+}
+
+SSL *SSL_SSL_from_mbedtls_ssl_context(mbedtls_ssl_context *msc)
+{
+ struct ssl_pm *ssl_pm = (struct ssl_pm *)((char *)msc - offsetof(struct ssl_pm, ssl));
+
+ return ssl_pm->owner;
+}
+
+#include "ssl_cert.h"
+
+void SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
+{
+ struct ssl_pm *ssl_pm = ssl->ssl_pm;
+ struct x509_pm *x509_pm = (struct x509_pm *)ctx->cert->x509->x509_pm;
+ struct x509_pm *x509_pm_ca = (struct x509_pm *)ctx->client_CA->x509_pm;
+
+ struct pkey_pm *pkey_pm = (struct pkey_pm *)ctx->cert->pkey->pkey_pm;
+ int mode;
+
+ if (ssl->cert)
+ ssl_cert_free(ssl->cert);
+ ssl->ctx = ctx;
+ ssl->cert = __ssl_cert_new(ctx->cert);
+
+ if (ctx->verify_mode == SSL_VERIFY_PEER)
+ mode = MBEDTLS_SSL_VERIFY_OPTIONAL;
+ else if (ctx->verify_mode == SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
+ mode = MBEDTLS_SSL_VERIFY_OPTIONAL;
+ else if (ctx->verify_mode == SSL_VERIFY_CLIENT_ONCE)
+ mode = MBEDTLS_SSL_VERIFY_UNSET;
+ else
+ mode = MBEDTLS_SSL_VERIFY_NONE;
+
+ // printf("ssl: %p, client ca x509_crt %p, mbedtls mode %d\n", ssl, x509_pm_ca->x509_crt, mode);
+
+ /* apply new ctx cert to ssl */
+
+ ssl->verify_mode = ctx->verify_mode;
+
+ mbedtls_ssl_set_hs_ca_chain(&ssl_pm->ssl, x509_pm_ca->x509_crt, NULL);
+ mbedtls_ssl_set_hs_own_cert(&ssl_pm->ssl, x509_pm->x509_crt, pkey_pm->pkey);
+ mbedtls_ssl_set_hs_authmode(&ssl_pm->ssl, mode);
+}
diff --git a/thirdparty/lws/mbedtls_wrapper/platform/ssl_port.c b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_port.c
index 8c7a31338b..8c7a31338b 100644
--- a/thirdparty/lws/mbedtls_wrapper/platform/ssl_port.c
+++ b/thirdparty/libwebsockets/tls/mbedtls/wrapper/platform/ssl_port.c
diff --git a/thirdparty/libwebsockets/tls/private.h b/thirdparty/libwebsockets/tls/private.h
new file mode 100644
index 0000000000..606e2574dc
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/private.h
@@ -0,0 +1,281 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * This is included from core/private.h if LWS_WITH_TLS
+ */
+
+#if defined(LWS_WITH_TLS)
+
+#if defined(USE_WOLFSSL)
+ #if defined(USE_OLD_CYASSL)
+ #if defined(_WIN32)
+ #include <IDE/WIN/user_settings.h>
+ #include <cyassl/ctaocrypt/settings.h>
+ #else
+ #include <cyassl/options.h>
+ #endif
+ #include <cyassl/openssl/ssl.h>
+ #include <cyassl/error-ssl.h>
+ #else
+ #if defined(_WIN32)
+ #include <IDE/WIN/user_settings.h>
+ #include <wolfssl/wolfcrypt/settings.h>
+ #else
+ #include <wolfssl/options.h>
+ #endif
+ #include <wolfssl/openssl/ssl.h>
+ #include <wolfssl/error-ssl.h>
+ #define OPENSSL_NO_TLSEXT
+ #endif /* not USE_OLD_CYASSL */
+#else /* WOLFSSL */
+ #if defined(LWS_WITH_ESP32)
+ #define OPENSSL_NO_TLSEXT
+ #undef MBEDTLS_CONFIG_FILE
+ #define MBEDTLS_CONFIG_FILE <mbedtls/esp_config.h>
+ #include <mbedtls/ssl.h>
+ #include <mbedtls/x509_crt.h>
+ #include "tls/mbedtls/wrapper/include/openssl/ssl.h" /* wrapper !!!! */
+ #else /* not esp32 */
+ #if defined(LWS_WITH_MBEDTLS)
+ #include <mbedtls/ssl.h>
+ #include <mbedtls/x509_crt.h>
+ #include <mbedtls/x509_csr.h>
+ #include "tls/mbedtls/wrapper/include/openssl/ssl.h" /* wrapper !!!! */
+ #else
+ #include <openssl/ssl.h>
+ #include <openssl/evp.h>
+ #include <openssl/err.h>
+ #include <openssl/md5.h>
+ #include <openssl/sha.h>
+ #ifdef LWS_HAVE_OPENSSL_ECDH_H
+ #include <openssl/ecdh.h>
+ #endif
+ #include <openssl/x509v3.h>
+ #endif /* not mbedtls */
+ #if defined(OPENSSL_VERSION_NUMBER)
+ #if (OPENSSL_VERSION_NUMBER < 0x0009080afL)
+/* later openssl defines this to negate the presence of tlsext... but it was only
+ * introduced at 0.9.8j. Earlier versions don't know it exists so don't
+ * define it... making it look like the feature exists...
+ */
+ #define OPENSSL_NO_TLSEXT
+ #endif
+ #endif
+ #endif /* not ESP32 */
+#endif /* not USE_WOLFSSL */
+
+#endif /* LWS_WITH_TLS */
+
+enum lws_tls_extant {
+ LWS_TLS_EXTANT_NO,
+ LWS_TLS_EXTANT_YES,
+ LWS_TLS_EXTANT_ALTERNATIVE
+};
+
+struct lws_context_per_thread;
+
+struct lws_tls_ops {
+ int (*fake_POLLIN_for_buffered)(struct lws_context_per_thread *pt);
+ int (*periodic_housekeeping)(struct lws_context *context, time_t now);
+};
+
+#if defined(LWS_WITH_TLS)
+
+typedef SSL lws_tls_conn;
+typedef SSL_CTX lws_tls_ctx;
+typedef BIO lws_tls_bio;
+typedef X509 lws_tls_x509;
+
+
+#define LWS_SSL_ENABLED(context) (context->tls.use_ssl)
+
+extern const struct lws_tls_ops tls_ops_openssl, tls_ops_mbedtls;
+
+struct lws_context_tls {
+ char alpn_discovered[32];
+ const char *alpn_default;
+ time_t last_cert_check_s;
+};
+
+struct lws_pt_tls {
+ struct lws *pending_read_list; /* linked list */
+};
+
+struct lws_tls_ss_pieces;
+
+struct alpn_ctx {
+ uint8_t data[23];
+ uint8_t len;
+};
+
+struct lws_vhost_tls {
+ lws_tls_ctx *ssl_ctx;
+ lws_tls_ctx *ssl_client_ctx;
+ const char *alpn;
+ struct lws_tls_ss_pieces *ss; /* for acme tls certs */
+ char *alloc_cert_path;
+ char *key_path;
+#if defined(LWS_WITH_MBEDTLS)
+ lws_tls_x509 *x509_client_CA;
+#endif
+ char ecdh_curve[16];
+ struct alpn_ctx alpn_ctx;
+
+ int use_ssl;
+ int allow_non_ssl_on_ssl_port;
+ int ssl_info_event_mask;
+
+ unsigned int user_supplied_ssl_ctx:1;
+ unsigned int skipped_certs:1;
+};
+
+struct lws_lws_tls {
+ lws_tls_conn *ssl;
+ lws_tls_bio *client_bio;
+ struct lws *pending_read_list_prev, *pending_read_list_next;
+ unsigned int use_ssl;
+ unsigned int redirect_to_https:1;
+};
+
+LWS_EXTERN void
+lws_context_init_alpn(struct lws_vhost *vhost);
+LWS_EXTERN enum lws_tls_extant
+lws_tls_use_any_upgrade_check_extant(const char *name);
+LWS_EXTERN int openssl_websocket_private_data_index;
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len);
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len);
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_ssl_pending(struct lws *wsi);
+LWS_EXTERN int
+lws_context_init_ssl_library(const struct lws_context_creation_info *info);
+LWS_EXTERN int LWS_WARN_UNUSED_RESULT
+lws_server_socket_service_ssl(struct lws *new_wsi, lws_sockfd_type accept_fd);
+LWS_EXTERN int
+lws_ssl_close(struct lws *wsi);
+LWS_EXTERN void
+lws_ssl_SSL_CTX_destroy(struct lws_vhost *vhost);
+LWS_EXTERN void
+lws_ssl_context_destroy(struct lws_context *context);
+void
+__lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi);
+LWS_VISIBLE void
+lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi);
+LWS_EXTERN int
+lws_ssl_client_bio_create(struct lws *wsi);
+LWS_EXTERN int
+lws_ssl_client_connect1(struct lws *wsi);
+LWS_EXTERN int
+lws_ssl_client_connect2(struct lws *wsi, char *errbuf, int len);
+LWS_EXTERN void
+lws_ssl_elaborate_error(void);
+LWS_EXTERN int
+lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt);
+LWS_EXTERN int
+lws_gate_accepts(struct lws_context *context, int on);
+LWS_EXTERN void
+lws_ssl_bind_passphrase(lws_tls_ctx *ssl_ctx,
+ const struct lws_context_creation_info *info);
+LWS_EXTERN void
+lws_ssl_info_callback(const lws_tls_conn *ssl, int where, int ret);
+LWS_EXTERN int
+lws_tls_openssl_cert_info(X509 *x509, enum lws_tls_cert_info type,
+ union lws_tls_cert_info_results *buf, size_t len);
+LWS_EXTERN int
+lws_tls_check_all_cert_lifetimes(struct lws_context *context);
+LWS_EXTERN int
+lws_tls_server_certs_load(struct lws_vhost *vhost, struct lws *wsi,
+ const char *cert, const char *private_key,
+ const char *mem_cert, size_t len_mem_cert,
+ const char *mem_privkey, size_t mem_privkey_len);
+LWS_EXTERN enum lws_tls_extant
+lws_tls_generic_cert_checks(struct lws_vhost *vhost, const char *cert,
+ const char *private_key);
+LWS_EXTERN int
+lws_tls_alloc_pem_to_der_file(struct lws_context *context, const char *filename,
+ const char *inbuf, lws_filepos_t inlen,
+ uint8_t **buf, lws_filepos_t *amount);
+
+#if !defined(LWS_NO_SERVER)
+ LWS_EXTERN int
+ lws_context_init_server_ssl(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost);
+ void
+ lws_tls_acme_sni_cert_destroy(struct lws_vhost *vhost);
+#else
+ #define lws_context_init_server_ssl(_a, _b) (0)
+ #define lws_tls_acme_sni_cert_destroy(_a)
+#endif
+
+LWS_EXTERN void
+lws_ssl_destroy(struct lws_vhost *vhost);
+LWS_EXTERN char *
+lws_ssl_get_error_string(int status, int ret, char *buf, size_t len);
+
+/*
+ * lws_tls_ abstract backend implementations
+ */
+
+LWS_EXTERN int
+lws_tls_server_client_cert_verify_config(struct lws_vhost *vh);
+LWS_EXTERN int
+lws_tls_server_vhost_backend_init(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost, struct lws *wsi);
+LWS_EXTERN int
+lws_tls_server_new_nonblocking(struct lws *wsi, lws_sockfd_type accept_fd);
+
+LWS_EXTERN enum lws_ssl_capable_status
+lws_tls_server_accept(struct lws *wsi);
+
+LWS_EXTERN enum lws_ssl_capable_status
+lws_tls_server_abort_connection(struct lws *wsi);
+
+LWS_EXTERN enum lws_ssl_capable_status
+__lws_tls_shutdown(struct lws *wsi);
+
+LWS_EXTERN enum lws_ssl_capable_status
+lws_tls_client_connect(struct lws *wsi);
+LWS_EXTERN int
+lws_tls_client_confirm_peer_cert(struct lws *wsi, char *ebuf, int ebuf_len);
+LWS_EXTERN int
+lws_tls_client_create_vhost_context(struct lws_vhost *vh,
+ const struct lws_context_creation_info *info,
+ const char *cipher_list,
+ const char *ca_filepath,
+ const char *cert_filepath,
+ const char *private_key_filepath);
+
+LWS_EXTERN lws_tls_ctx *
+lws_tls_ctx_from_wsi(struct lws *wsi);
+LWS_EXTERN int
+lws_ssl_get_error(struct lws *wsi, int n);
+
+LWS_EXTERN int
+lws_context_init_client_ssl(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost);
+
+LWS_EXTERN void
+lws_ssl_info_callback(const lws_tls_conn *ssl, int where, int ret);
+
+int
+lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt);
+
+#endif \ No newline at end of file
diff --git a/thirdparty/libwebsockets/tls/tls-client.c b/thirdparty/libwebsockets/tls/tls-client.c
new file mode 100644
index 0000000000..70eb6f6078
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/tls-client.c
@@ -0,0 +1,150 @@
+/*
+ * libwebsockets - client-related ssl code independent of backend
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+int
+lws_ssl_client_connect1(struct lws *wsi)
+{
+ struct lws_context *context = wsi->context;
+ int n = 0;
+
+ lws_latency_pre(context, wsi);
+ n = lws_tls_client_connect(wsi);
+ lws_latency(context, wsi, "SSL_connect hs", n, n > 0);
+
+ switch (n) {
+ case LWS_SSL_CAPABLE_ERROR:
+ return -1;
+ case LWS_SSL_CAPABLE_DONE:
+ return 1; /* connected */
+ case LWS_SSL_CAPABLE_MORE_SERVICE_WRITE:
+ lws_callback_on_writable(wsi);
+ /* fallthru */
+ case LWS_SSL_CAPABLE_MORE_SERVICE_READ:
+ lwsi_set_state(wsi, LRS_WAITING_SSL);
+ break;
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ break;
+ }
+
+ return 0; /* retry */
+}
+
+int
+lws_ssl_client_connect2(struct lws *wsi, char *errbuf, int len)
+{
+ int n = 0;
+
+ if (lwsi_state(wsi) == LRS_WAITING_SSL) {
+ lws_latency_pre(wsi->context, wsi);
+
+ n = lws_tls_client_connect(wsi);
+ lwsl_debug("%s: SSL_connect says %d\n", __func__, n);
+ lws_latency(wsi->context, wsi,
+ "SSL_connect LRS_WAITING_SSL", n, n > 0);
+
+ switch (n) {
+ case LWS_SSL_CAPABLE_ERROR:
+ lws_snprintf(errbuf, len, "client connect failed");
+ return -1;
+ case LWS_SSL_CAPABLE_DONE:
+ break; /* connected */
+ case LWS_SSL_CAPABLE_MORE_SERVICE_WRITE:
+ lws_callback_on_writable(wsi);
+ /* fallthru */
+ case LWS_SSL_CAPABLE_MORE_SERVICE_READ:
+ lwsi_set_state(wsi, LRS_WAITING_SSL);
+ /* fallthru */
+ case LWS_SSL_CAPABLE_MORE_SERVICE:
+ return 0;
+ }
+ }
+
+ if (lws_tls_client_confirm_peer_cert(wsi, errbuf, len))
+ return -1;
+
+ return 1;
+}
+
+
+int lws_context_init_client_ssl(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost)
+{
+ const char *ca_filepath = info->ssl_ca_filepath;
+ const char *cipher_list = info->ssl_cipher_list;
+ const char *private_key_filepath = info->ssl_private_key_filepath;
+ const char *cert_filepath = info->ssl_cert_filepath;
+ struct lws wsi;
+
+ if (vhost->options & LWS_SERVER_OPTION_ONLY_RAW)
+ return 0;
+
+ /*
+ * for backwards-compatibility default to using ssl_... members, but
+ * if the newer client-specific ones are given, use those
+ */
+ if (info->client_ssl_cipher_list)
+ cipher_list = info->client_ssl_cipher_list;
+ if (info->client_ssl_cert_filepath)
+ cert_filepath = info->client_ssl_cert_filepath;
+ if (info->client_ssl_private_key_filepath)
+ private_key_filepath = info->client_ssl_private_key_filepath;
+
+ if (info->client_ssl_ca_filepath)
+ ca_filepath = info->client_ssl_ca_filepath;
+
+ if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
+ return 0;
+
+ if (vhost->tls.ssl_client_ctx)
+ return 0;
+
+ if (info->provided_client_ssl_ctx) {
+ /* use the provided OpenSSL context if given one */
+ vhost->tls.ssl_client_ctx = info->provided_client_ssl_ctx;
+ /* nothing for lib to delete */
+ vhost->tls.user_supplied_ssl_ctx = 1;
+
+ return 0;
+ }
+
+ if (lws_tls_client_create_vhost_context(vhost, info, cipher_list,
+ ca_filepath, cert_filepath,
+ private_key_filepath))
+ return 1;
+
+ lwsl_notice("created client ssl context for %s\n", vhost->name);
+
+ /*
+ * give him a fake wsi with context set, so he can use
+ * lws_get_context() in the callback
+ */
+ memset(&wsi, 0, sizeof(wsi));
+ wsi.vhost = vhost;
+ wsi.context = vhost->context;
+
+ vhost->protocols[0].callback(&wsi,
+ LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS,
+ vhost->tls.ssl_client_ctx, NULL, 0);
+
+ return 0;
+}
diff --git a/thirdparty/libwebsockets/tls/tls-server.c b/thirdparty/libwebsockets/tls/tls-server.c
new file mode 100644
index 0000000000..440e790660
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/tls-server.c
@@ -0,0 +1,382 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+#if defined(LWS_WITH_MBEDTLS) || (defined(OPENSSL_VERSION_NUMBER) && \
+ OPENSSL_VERSION_NUMBER >= 0x10002000L)
+static int
+alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
+ const unsigned char *in, unsigned int inlen, void *arg)
+{
+#if !defined(LWS_WITH_MBEDTLS)
+ struct alpn_ctx *alpn_ctx = (struct alpn_ctx *)arg;
+
+ if (SSL_select_next_proto((unsigned char **)out, outlen, alpn_ctx->data,
+ alpn_ctx->len, in, inlen) !=
+ OPENSSL_NPN_NEGOTIATED)
+ return SSL_TLSEXT_ERR_NOACK;
+#endif
+
+ return SSL_TLSEXT_ERR_OK;
+}
+#endif
+
+void
+lws_context_init_alpn(struct lws_vhost *vhost)
+{
+#if defined(LWS_WITH_MBEDTLS) || (defined(OPENSSL_VERSION_NUMBER) && \
+ OPENSSL_VERSION_NUMBER >= 0x10002000L)
+ const char *alpn_comma = vhost->context->tls.alpn_default;
+
+ if (vhost->tls.alpn)
+ alpn_comma = vhost->tls.alpn;
+
+ lwsl_info(" Server '%s' advertising ALPN: %s\n",
+ vhost->name, alpn_comma);
+ vhost->tls.alpn_ctx.len = lws_alpn_comma_to_openssl(alpn_comma,
+ vhost->tls.alpn_ctx.data,
+ sizeof(vhost->tls.alpn_ctx.data) - 1);
+
+ SSL_CTX_set_alpn_select_cb(vhost->tls.ssl_ctx, alpn_cb, &vhost->tls.alpn_ctx);
+#else
+ lwsl_err(
+ " HTTP2 / ALPN configured but not supported by OpenSSL 0x%lx\n",
+ OPENSSL_VERSION_NUMBER);
+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
+}
+
+int
+lws_tls_server_conn_alpn(struct lws *wsi)
+{
+#if defined(LWS_WITH_MBEDTLS) || (defined(OPENSSL_VERSION_NUMBER) && \
+ OPENSSL_VERSION_NUMBER >= 0x10002000L)
+ const unsigned char *name = NULL;
+ char cstr[10];
+ unsigned len;
+
+ SSL_get0_alpn_selected(wsi->tls.ssl, &name, &len);
+ if (!len) {
+ lwsl_info("no ALPN upgrade\n");
+ return 0;
+ }
+
+ if (len > sizeof(cstr) - 1)
+ len = sizeof(cstr) - 1;
+
+ memcpy(cstr, name, len);
+ cstr[len] = '\0';
+
+ lwsl_info("negotiated '%s' using ALPN\n", cstr);
+ wsi->tls.use_ssl |= LCCSCF_USE_SSL;
+
+ return lws_role_call_alpn_negotiated(wsi, (const char *)cstr);
+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_context_init_server_ssl(const struct lws_context_creation_info *info,
+ struct lws_vhost *vhost)
+{
+ struct lws_context *context = vhost->context;
+ struct lws wsi;
+
+ if (!lws_check_opt(info->options,
+ LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT)) {
+ vhost->tls.use_ssl = 0;
+
+ return 0;
+ }
+
+ /*
+ * If he is giving a cert filepath, take it as a sign he wants to use
+ * it on this vhost. User code can leave the cert filepath NULL and
+ * set the LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX option itself, in
+ * which case he's expected to set up the cert himself at
+ * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS, which
+ * provides the vhost SSL_CTX * in the user parameter.
+ */
+ if (info->ssl_cert_filepath)
+ vhost->options |= LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX;
+
+ if (info->port != CONTEXT_PORT_NO_LISTEN) {
+
+ vhost->tls.use_ssl = lws_check_opt(vhost->options,
+ LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX);
+
+ if (vhost->tls.use_ssl && info->ssl_cipher_list)
+ lwsl_notice(" SSL ciphers: '%s'\n",
+ info->ssl_cipher_list);
+
+ if (vhost->tls.use_ssl)
+ lwsl_notice(" Using SSL mode\n");
+ else
+ lwsl_notice(" Using non-SSL mode\n");
+ }
+
+ /*
+ * give him a fake wsi with context + vhost set, so he can use
+ * lws_get_context() in the callback
+ */
+ memset(&wsi, 0, sizeof(wsi));
+ wsi.vhost = vhost;
+ wsi.context = context;
+
+ /*
+ * as a server, if we are requiring clients to identify themselves
+ * then set the backend up for it
+ */
+ if (lws_check_opt(info->options,
+ LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT))
+ /* Normally SSL listener rejects non-ssl, optionally allow */
+ vhost->tls.allow_non_ssl_on_ssl_port = 1;
+
+ /*
+ * give user code a chance to load certs into the server
+ * allowing it to verify incoming client certs
+ */
+ if (vhost->tls.use_ssl) {
+ if (lws_tls_server_vhost_backend_init(info, vhost, &wsi))
+ return -1;
+
+ lws_tls_server_client_cert_verify_config(vhost);
+
+ if (vhost->protocols[0].callback(&wsi,
+ LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS,
+ vhost->tls.ssl_ctx, vhost, 0))
+ return -1;
+ }
+
+ if (vhost->tls.use_ssl)
+ lws_context_init_alpn(vhost);
+
+ return 0;
+}
+
+LWS_VISIBLE int
+lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_vhost *vh;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+ int n;
+ char buf[256];
+
+ (void)buf;
+
+ if (!LWS_SSL_ENABLED(wsi->vhost))
+ return 0;
+
+ switch (lwsi_state(wsi)) {
+ case LRS_SSL_INIT:
+
+ if (wsi->tls.ssl)
+ lwsl_err("%s: leaking ssl\n", __func__);
+ if (accept_fd == LWS_SOCK_INVALID)
+ assert(0);
+ if (context->simultaneous_ssl_restriction &&
+ context->simultaneous_ssl >=
+ context->simultaneous_ssl_restriction) {
+ lwsl_notice("unable to deal with SSL connection\n");
+ return 1;
+ }
+
+ if (lws_tls_server_new_nonblocking(wsi, accept_fd)) {
+ if (accept_fd != LWS_SOCK_INVALID)
+ compatible_close(accept_fd);
+ goto fail;
+ }
+
+ if (context->simultaneous_ssl_restriction &&
+ ++context->simultaneous_ssl ==
+ context->simultaneous_ssl_restriction)
+ /* that was the last allowed SSL connection */
+ lws_gate_accepts(context, 0);
+
+#if defined(LWS_WITH_STATS)
+ context->updated = 1;
+#endif
+ /*
+ * we are not accepted yet, but we need to enter ourselves
+ * as a live connection. That way we can retry when more
+ * pieces come if we're not sorted yet
+ */
+ lwsi_set_state(wsi, LRS_SSL_ACK_PENDING);
+
+ lws_pt_lock(pt, __func__);
+ if (__insert_wsi_socket_into_fds(context, wsi)) {
+ lwsl_err("%s: failed to insert into fds\n", __func__);
+ goto fail;
+ }
+ lws_pt_unlock(pt);
+
+ lws_set_timeout(wsi, PENDING_TIMEOUT_SSL_ACCEPT,
+ context->timeout_secs);
+
+ lwsl_debug("inserted SSL accept into fds, trying SSL_accept\n");
+
+ /* fallthru */
+
+ case LRS_SSL_ACK_PENDING:
+
+ if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
+ lwsl_err("%s: lws_change_pollfd failed\n", __func__);
+ goto fail;
+ }
+
+ lws_latency_pre(context, wsi);
+
+ if (wsi->vhost->tls.allow_non_ssl_on_ssl_port) {
+
+ n = recv(wsi->desc.sockfd, (char *)pt->serv_buf,
+ context->pt_serv_buf_size, MSG_PEEK);
+
+ /*
+ * optionally allow non-SSL connect on SSL listening socket
+ * This is disabled by default, if enabled it goes around any
+ * SSL-level access control (eg, client-side certs) so leave
+ * it disabled unless you know it's not a problem for you
+ */
+ if (n >= 1 && pt->serv_buf[0] >= ' ') {
+ /*
+ * TLS content-type for Handshake is 0x16, and
+ * for ChangeCipherSpec Record, it's 0x14
+ *
+ * A non-ssl session will start with the HTTP
+ * method in ASCII. If we see it's not a legit
+ * SSL handshake kill the SSL for this
+ * connection and try to handle as a HTTP
+ * connection upgrade directly.
+ */
+ wsi->tls.use_ssl = 0;
+
+ lws_tls_server_abort_connection(wsi);
+ /*
+ * care... this creates wsi with no ssl
+ * when ssl is enabled and normally
+ * mandatory
+ */
+ wsi->tls.ssl = NULL;
+ if (lws_check_opt(context->options,
+ LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS))
+ wsi->tls.redirect_to_https = 1;
+ lwsl_debug("accepted as non-ssl\n");
+ goto accepted;
+ }
+ if (!n) {
+ /*
+ * connection is gone, fail out
+ */
+ lwsl_debug("PEEKed 0\n");
+ goto fail;
+ }
+ if (n < 0 && (LWS_ERRNO == LWS_EAGAIN ||
+ LWS_ERRNO == LWS_EWOULDBLOCK)) {
+ /*
+ * well, we get no way to know ssl or not
+ * so go around again waiting for something
+ * to come and give us a hint, or timeout the
+ * connection.
+ */
+ if (lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
+ lwsl_info("%s: change_pollfd failed\n",
+ __func__);
+ return -1;
+ }
+
+ lwsl_info("SSL_ERROR_WANT_READ\n");
+ return 0;
+ }
+ }
+
+ /* normal SSL connection processing path */
+
+#if defined(LWS_WITH_STATS)
+ if (!wsi->accept_start_us)
+ wsi->accept_start_us = time_in_microseconds();
+#endif
+ errno = 0;
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN, 1);
+ n = lws_tls_server_accept(wsi);
+ lws_latency(context, wsi,
+ "SSL_accept LRS_SSL_ACK_PENDING\n", n, n == 1);
+ lwsl_info("SSL_accept says %d\n", n);
+ switch (n) {
+ case LWS_SSL_CAPABLE_DONE:
+ break;
+ case LWS_SSL_CAPABLE_ERROR:
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_SSL_CONNECTIONS_FAILED, 1);
+ lwsl_info("SSL_accept failed socket %u: %d\n",
+ wsi->desc.sockfd, n);
+ wsi->socket_is_permanently_unusable = 1;
+ goto fail;
+
+ default: /* MORE_SERVICE */
+ return 0;
+ }
+
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED, 1);
+#if defined(LWS_WITH_STATS)
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY,
+ time_in_microseconds() - wsi->accept_start_us);
+ wsi->accept_start_us = time_in_microseconds();
+#endif
+
+accepted:
+
+ /* adapt our vhost to match the SNI SSL_CTX that was chosen */
+ vh = context->vhost_list;
+ while (vh) {
+ if (!vh->being_destroyed && wsi->tls.ssl &&
+ vh->tls.ssl_ctx == lws_tls_ctx_from_wsi(wsi)) {
+ lwsl_info("setting wsi to vh %s\n", vh->name);
+ wsi->vhost = vh;
+ break;
+ }
+ vh = vh->vhost_next;
+ }
+
+ /* OK, we are accepted... give him some time to negotiate */
+ lws_set_timeout(wsi, PENDING_TIMEOUT_ESTABLISH_WITH_SERVER,
+ context->timeout_secs);
+
+ lwsi_set_state(wsi, LRS_ESTABLISHED);
+ if (lws_tls_server_conn_alpn(wsi))
+ goto fail;
+ lwsl_debug("accepted new SSL conn\n");
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+
+fail:
+ return 1;
+}
+
diff --git a/thirdparty/libwebsockets/tls/tls.c b/thirdparty/libwebsockets/tls/tls.c
new file mode 100644
index 0000000000..92b7c5593c
--- /dev/null
+++ b/thirdparty/libwebsockets/tls/tls.c
@@ -0,0 +1,522 @@
+/*
+ * libwebsockets - small server side websockets and web server implementation
+ *
+ * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation:
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include "core/private.h"
+
+/*
+ * fakes POLLIN on all tls guys with buffered rx
+ *
+ * returns nonzero if any tls guys had POLLIN faked
+ */
+
+int
+lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt)
+{
+ struct lws *wsi, *wsi_next;
+ int ret = 0;
+
+ wsi = pt->tls.pending_read_list;
+ while (wsi && wsi->position_in_fds_table != LWS_NO_FDS_POS) {
+ wsi_next = wsi->tls.pending_read_list_next;
+ pt->fds[wsi->position_in_fds_table].revents |=
+ pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
+ ret |= pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN;
+
+ wsi = wsi_next;
+ }
+
+ return !!ret;
+}
+
+void
+__lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi)
+{
+ struct lws_context *context = wsi->context;
+ struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
+
+ if (!wsi->tls.pending_read_list_prev &&
+ !wsi->tls.pending_read_list_next &&
+ pt->tls.pending_read_list != wsi)
+ /* we are not on the list */
+ return;
+
+ /* point previous guy's next to our next */
+ if (!wsi->tls.pending_read_list_prev)
+ pt->tls.pending_read_list = wsi->tls.pending_read_list_next;
+ else
+ wsi->tls.pending_read_list_prev->tls.pending_read_list_next =
+ wsi->tls.pending_read_list_next;
+
+ /* point next guy's previous to our previous */
+ if (wsi->tls.pending_read_list_next)
+ wsi->tls.pending_read_list_next->tls.pending_read_list_prev =
+ wsi->tls.pending_read_list_prev;
+
+ wsi->tls.pending_read_list_prev = NULL;
+ wsi->tls.pending_read_list_next = NULL;
+}
+
+void
+lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi)
+{
+ struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
+
+ lws_pt_lock(pt, __func__);
+ __lws_ssl_remove_wsi_from_buffered_list(wsi);
+ lws_pt_unlock(pt);
+}
+
+#if defined(LWS_WITH_ESP32)
+int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
+ lws_filepos_t *amount)
+{
+ nvs_handle nvh;
+ size_t s;
+ int n = 0;
+
+ ESP_ERROR_CHECK(nvs_open("lws-station", NVS_READWRITE, &nvh));
+ if (nvs_get_blob(nvh, filename, NULL, &s) != ESP_OK) {
+ n = 1;
+ goto bail;
+ }
+ *buf = lws_malloc(s + 1, "alloc_file");
+ if (!*buf) {
+ n = 2;
+ goto bail;
+ }
+ if (nvs_get_blob(nvh, filename, (char *)*buf, &s) != ESP_OK) {
+ lws_free(*buf);
+ n = 1;
+ goto bail;
+ }
+
+ *amount = s;
+ (*buf)[s] = '\0';
+
+ lwsl_notice("%s: nvs: read %s, %d bytes\n", __func__, filename, (int)s);
+
+bail:
+ nvs_close(nvh);
+
+ return n;
+}
+#else
+int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
+ lws_filepos_t *amount)
+{
+ FILE *f;
+ size_t s;
+ int n = 0;
+
+ f = fopen(filename, "rb");
+ if (f == NULL) {
+ n = 1;
+ goto bail;
+ }
+
+ if (fseek(f, 0, SEEK_END) != 0) {
+ n = 1;
+ goto bail;
+ }
+
+ s = ftell(f);
+ if (s == (size_t)-1) {
+ n = 1;
+ goto bail;
+ }
+
+ if (fseek(f, 0, SEEK_SET) != 0) {
+ n = 1;
+ goto bail;
+ }
+
+ *buf = lws_malloc(s, "alloc_file");
+ if (!*buf) {
+ n = 2;
+ goto bail;
+ }
+
+ if (fread(*buf, s, 1, f) != 1) {
+ lws_free(*buf);
+ n = 1;
+ goto bail;
+ }
+
+ *amount = s;
+
+bail:
+ if (f)
+ fclose(f);
+
+ return n;
+
+}
+#endif
+
+int
+lws_tls_alloc_pem_to_der_file(struct lws_context *context, const char *filename,
+ const char *inbuf, lws_filepos_t inlen,
+ uint8_t **buf, lws_filepos_t *amount)
+{
+ const uint8_t *pem, *p, *end;
+ uint8_t *q;
+ lws_filepos_t len;
+ int n;
+
+ if (filename) {
+ n = alloc_file(context, filename, (uint8_t **)&pem, &len);
+ if (n)
+ return n;
+ } else {
+ pem = (const uint8_t *)inbuf;
+ len = inlen;
+ }
+
+ /* trim the first line */
+
+ p = pem;
+ end = p + len;
+ if (strncmp((char *)p, "-----", 5))
+ goto bail;
+ p += 5;
+ while (p < end && *p != '\n' && *p != '-')
+ p++;
+
+ if (*p != '-')
+ goto bail;
+
+ while (p < end && *p != '\n')
+ p++;
+
+ if (p >= end)
+ goto bail;
+
+ p++;
+
+ /* trim the last line */
+
+ q = (uint8_t *)end - 2;
+
+ while (q > pem && *q != '\n')
+ q--;
+
+ if (*q != '\n')
+ goto bail;
+
+ *q = '\0';
+
+ *amount = lws_b64_decode_string((char *)p, (char *)pem,
+ (int)(long long)len);
+ *buf = (uint8_t *)pem;
+
+ return 0;
+
+bail:
+ lws_free((uint8_t *)pem);
+
+ return 4;
+}
+
+int
+lws_tls_check_cert_lifetime(struct lws_vhost *v)
+{
+ union lws_tls_cert_info_results ir;
+ time_t now = (time_t)lws_now_secs(), life = 0;
+ struct lws_acme_cert_aging_args caa;
+ int n;
+
+ if (v->tls.ssl_ctx && !v->tls.skipped_certs) {
+
+ if (now < 1464083026) /* May 2016 */
+ /* our clock is wrong and we can't judge the certs */
+ return -1;
+
+ n = lws_tls_vhost_cert_info(v, LWS_TLS_CERT_INFO_VALIDITY_TO, &ir, 0);
+ if (n)
+ return 1;
+
+ life = (ir.time - now) / (24 * 3600);
+ lwsl_notice(" vhost %s: cert expiry: %dd\n", v->name, (int)life);
+ } else
+ lwsl_notice(" vhost %s: no cert\n", v->name);
+
+ memset(&caa, 0, sizeof(caa));
+ caa.vh = v;
+ lws_broadcast(v->context, LWS_CALLBACK_VHOST_CERT_AGING, (void *)&caa,
+ (size_t)(ssize_t)life);
+
+ return 0;
+}
+
+int
+lws_tls_check_all_cert_lifetimes(struct lws_context *context)
+{
+ struct lws_vhost *v = context->vhost_list;
+
+ while (v) {
+ if (lws_tls_check_cert_lifetime(v) < 0)
+ return -1;
+ v = v->vhost_next;
+ }
+
+ return 0;
+}
+#if !defined(LWS_WITH_ESP32) && !defined(LWS_PLAT_OPTEE)
+static int
+lws_tls_extant(const char *name)
+{
+ /* it exists if we can open it... */
+ int fd = open(name, O_RDONLY), n;
+ char buf[1];
+
+ if (fd < 0)
+ return 1;
+
+ /* and we can read at least one byte out of it */
+ n = read(fd, buf, 1);
+ close(fd);
+
+ return n != 1;
+}
+#endif
+/*
+ * Returns 0 if the filepath "name" exists and can be read from.
+ *
+ * In addition, if "name".upd exists, backup "name" to "name.old.1"
+ * and rename "name".upd to "name" before reporting its existence.
+ *
+ * There are four situations and three results possible:
+ *
+ * 1) LWS_TLS_EXTANT_NO: There are no certs at all (we are waiting for them to
+ * be provisioned). We also feel like this if we need privs we don't have
+ * any more to look in the directory.
+ *
+ * 2) There are provisioned certs written (xxx.upd) and we still have root
+ * privs... in this case we rename any existing cert to have a backup name
+ * and move the upd cert into place with the correct name. This then becomes
+ * situation 4 for the caller.
+ *
+ * 3) LWS_TLS_EXTANT_ALTERNATIVE: There are provisioned certs written (xxx.upd)
+ * but we no longer have the privs needed to read or rename them. In this
+ * case, indicate that the caller should use temp copies if any we do have
+ * rights to access. This is normal after we have updated the cert.
+ *
+ * But if we dropped privs, we can't detect the provisioned xxx.upd cert +
+ * key, because we can't see in the dir. So we have to upgrade NO to
+ * ALTERNATIVE when we actually have the in-memory alternative.
+ *
+ * 4) LWS_TLS_EXTANT_YES: The certs are present with the correct name and we
+ * have the rights to read them.
+ */
+enum lws_tls_extant
+lws_tls_use_any_upgrade_check_extant(const char *name)
+{
+#if !defined(LWS_PLAT_OPTEE)
+
+ int n;
+
+#if !defined(LWS_WITH_ESP32)
+ char buf[256];
+
+ lws_snprintf(buf, sizeof(buf) - 1, "%s.upd", name);
+ if (!lws_tls_extant(buf)) {
+ /* ah there is an updated file... how about the desired file? */
+ if (!lws_tls_extant(name)) {
+ /* rename the desired file */
+ for (n = 0; n < 50; n++) {
+ lws_snprintf(buf, sizeof(buf) - 1,
+ "%s.old.%d", name, n);
+ if (!rename(name, buf))
+ break;
+ }
+ if (n == 50) {
+ lwsl_notice("unable to rename %s\n", name);
+
+ return LWS_TLS_EXTANT_ALTERNATIVE;
+ }
+ lws_snprintf(buf, sizeof(buf) - 1, "%s.upd", name);
+ }
+ /* desired file is out of the way, rename the updated file */
+ if (rename(buf, name)) {
+ lwsl_notice("unable to rename %s to %s\n", buf, name);
+
+ return LWS_TLS_EXTANT_ALTERNATIVE;
+ }
+ }
+
+ if (lws_tls_extant(name))
+ return LWS_TLS_EXTANT_NO;
+#else
+ nvs_handle nvh;
+ size_t s = 8192;
+
+ if (nvs_open("lws-station", NVS_READWRITE, &nvh)) {
+ lwsl_notice("%s: can't open nvs\n", __func__);
+ return LWS_TLS_EXTANT_NO;
+ }
+
+ n = nvs_get_blob(nvh, name, NULL, &s);
+ nvs_close(nvh);
+
+ if (n)
+ return LWS_TLS_EXTANT_NO;
+#endif
+#endif
+ return LWS_TLS_EXTANT_YES;
+}
+
+/*
+ * LWS_TLS_EXTANT_NO : skip adding the cert
+ * LWS_TLS_EXTANT_YES : use the cert and private key paths normally
+ * LWS_TLS_EXTANT_ALTERNATIVE: normal paths not usable, try alternate if poss
+ */
+enum lws_tls_extant
+lws_tls_generic_cert_checks(struct lws_vhost *vhost, const char *cert,
+ const char *private_key)
+{
+ int n, m;
+
+ /*
+ * The user code can choose to either pass the cert and
+ * key filepaths using the info members like this, or it can
+ * leave them NULL; force the vhost SSL_CTX init using the info
+ * options flag LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX; and
+ * set up the cert himself using the user callback
+ * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS, which
+ * happened just above and has the vhost SSL_CTX * in the user
+ * parameter.
+ */
+
+ if (!cert || !private_key)
+ return LWS_TLS_EXTANT_NO;
+
+ n = lws_tls_use_any_upgrade_check_extant(cert);
+ if (n == LWS_TLS_EXTANT_ALTERNATIVE)
+ return LWS_TLS_EXTANT_ALTERNATIVE;
+ m = lws_tls_use_any_upgrade_check_extant(private_key);
+ if (m == LWS_TLS_EXTANT_ALTERNATIVE)
+ return LWS_TLS_EXTANT_ALTERNATIVE;
+
+ if ((n == LWS_TLS_EXTANT_NO || m == LWS_TLS_EXTANT_NO) &&
+ (vhost->options & LWS_SERVER_OPTION_IGNORE_MISSING_CERT)) {
+ lwsl_notice("Ignoring missing %s or %s\n", cert, private_key);
+ vhost->tls.skipped_certs = 1;
+
+ return LWS_TLS_EXTANT_NO;
+ }
+
+ /*
+ * the cert + key exist
+ */
+
+ return LWS_TLS_EXTANT_YES;
+}
+
+#if !defined(LWS_NO_SERVER)
+/*
+ * update the cert for every vhost using the given path
+ */
+
+LWS_VISIBLE int
+lws_tls_cert_updated(struct lws_context *context, const char *certpath,
+ const char *keypath,
+ const char *mem_cert, size_t len_mem_cert,
+ const char *mem_privkey, size_t len_mem_privkey)
+{
+ struct lws wsi;
+
+ wsi.context = context;
+
+ lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
+ wsi.vhost = v;
+ if (v->tls.alloc_cert_path && v->tls.key_path &&
+ !strcmp(v->tls.alloc_cert_path, certpath) &&
+ !strcmp(v->tls.key_path, keypath)) {
+ lws_tls_server_certs_load(v, &wsi, certpath, keypath,
+ mem_cert, len_mem_cert,
+ mem_privkey, len_mem_privkey);
+
+ if (v->tls.skipped_certs)
+ lwsl_notice("%s: vhost %s: cert unset\n",
+ __func__, v->name);
+ }
+ } lws_end_foreach_ll(v, vhost_next);
+
+ return 0;
+}
+#endif
+
+int
+lws_gate_accepts(struct lws_context *context, int on)
+{
+ struct lws_vhost *v = context->vhost_list;
+
+ lwsl_notice("%s: on = %d\n", __func__, on);
+
+#if defined(LWS_WITH_STATS)
+ context->updated = 1;
+#endif
+
+ while (v) {
+ if (v->tls.use_ssl && v->lserv_wsi &&
+ lws_change_pollfd(v->lserv_wsi, (LWS_POLLIN) * !on,
+ (LWS_POLLIN) * on))
+ lwsl_notice("Unable to set accept POLLIN %d\n", on);
+
+ v = v->vhost_next;
+ }
+
+ return 0;
+}
+
+/* comma-separated alpn list, like "h2,http/1.1" to openssl alpn format */
+
+int
+lws_alpn_comma_to_openssl(const char *comma, uint8_t *os, int len)
+{
+ uint8_t *oos = os, *plen = NULL;
+
+ while (*comma && len > 1) {
+ if (!plen && *comma == ' ') {
+ comma++;
+ continue;
+ }
+ if (!plen) {
+ plen = os++;
+ len--;
+ }
+
+ if (*comma == ',') {
+ *plen = lws_ptr_diff(os, plen + 1);
+ plen = NULL;
+ comma++;
+ } else {
+ *os++ = *comma++;
+ len--;
+ }
+ }
+
+ if (plen)
+ *plen = lws_ptr_diff(os, plen + 1);
+
+ return lws_ptr_diff(os, oos);
+}
+
diff --git a/thirdparty/lws/win32helpers/getopt.c b/thirdparty/libwebsockets/win32helpers/getopt.c
index 3bb21f6f28..2181f1cb12 100644
--- a/thirdparty/lws/win32helpers/getopt.c
+++ b/thirdparty/libwebsockets/win32helpers/getopt.c
@@ -1,153 +1,153 @@
-/* $NetBSD: getopt.c,v 1.16 1999/12/02 13:15:56 kleink Exp $ */
-
-/*
- * Copyright (c) 1987, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#define __P(x) x
-#define _DIAGASSERT(x) assert(x)
-
-#ifdef __weak_alias
-__weak_alias(getopt,_getopt);
-#endif
-
-
-int opterr = 1, /* if error message should be printed */
- optind = 1, /* index into parent argv vector */
- optopt, /* character checked for validity */
- optreset; /* reset getopt */
-char *optarg; /* argument associated with option */
-
-static char * _progname __P((char *));
-int getopt_internal __P((int, char * const *, const char *));
-
-static char *
-_progname(nargv0)
- char * nargv0;
-{
- char * tmp;
-
- _DIAGASSERT(nargv0 != NULL);
-
- tmp = strrchr(nargv0, '/');
- if (tmp)
- tmp++;
- else
- tmp = nargv0;
- return(tmp);
-}
-
-#define BADCH (int)'?'
-#define BADARG (int)':'
-#define EMSG ""
-
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt(nargc, nargv, ostr)
- int nargc;
- char * const nargv[];
- const char *ostr;
-{
- static char *__progname = 0;
- static char *place = EMSG; /* option letter processing */
- char *oli; /* option letter list index */
- __progname = __progname?__progname:_progname(*nargv);
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(ostr != NULL);
-
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
- place = EMSG;
- return (-1);
- }
- if (place[1] && *++place == '-' /* found "--" */
- && place[1] == '\0') {
- ++optind;
- place = EMSG;
- return (-1);
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
- /*
- * if the user didn't specify '-' as an option,
- * assume it means -1.
- */
- if (optopt == (int)'-')
- return (-1);
- if (!*place)
- ++optind;
- if (opterr && *ostr != ':')
- (void)fprintf(stderr,
- "%s: illegal option -- %c\n", __progname, optopt);
- return (BADCH);
- }
- if (*++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place)
- ++optind;
- }
- else { /* need an argument */
- if (*place) /* no white space */
- optarg = place;
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- if (*ostr == ':')
- return (BADARG);
- if (opterr)
- (void)fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- __progname, optopt);
- return (BADCH);
- }
- else /* white space */
- optarg = nargv[optind];
- place = EMSG;
- ++optind;
- }
- return (optopt); /* dump back option letter */
-}
-
+/* $NetBSD: getopt.c,v 1.16 1999/12/02 13:15:56 kleink Exp $ */
+
+/*
+ * Copyright (c) 1987, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if 0
+static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#define __P(x) x
+#define _DIAGASSERT(x) assert(x)
+
+#ifdef __weak_alias
+__weak_alias(getopt,_getopt);
+#endif
+
+
+int opterr = 1, /* if error message should be printed */
+ optind = 1, /* index into parent argv vector */
+ optopt, /* character checked for validity */
+ optreset; /* reset getopt */
+char *optarg; /* argument associated with option */
+
+static char * _progname __P((char *));
+int getopt_internal __P((int, char * const *, const char *));
+
+static char *
+_progname(nargv0)
+ char * nargv0;
+{
+ char * tmp;
+
+ _DIAGASSERT(nargv0 != NULL);
+
+ tmp = strrchr(nargv0, '/');
+ if (tmp)
+ tmp++;
+ else
+ tmp = nargv0;
+ return(tmp);
+}
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt(nargc, nargv, ostr)
+ int nargc;
+ char * const nargv[];
+ const char *ostr;
+{
+ static char *__progname = 0;
+ static char *place = EMSG; /* option letter processing */
+ char *oli; /* option letter list index */
+ __progname = __progname?__progname:_progname(*nargv);
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(ostr != NULL);
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (-1);
+ }
+ if (place[1] && *++place == '-' /* found "--" */
+ && place[1] == '\0') {
+ ++optind;
+ place = EMSG;
+ return (-1);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1.
+ */
+ if (optopt == (int)'-')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)fprintf(stderr,
+ "%s: illegal option -- %c\n", __progname, optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ }
+ else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if (*ostr == ':')
+ return (BADARG);
+ if (opterr)
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %c\n",
+ __progname, optopt);
+ return (BADCH);
+ }
+ else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
+
diff --git a/thirdparty/lws/win32helpers/getopt.h b/thirdparty/libwebsockets/win32helpers/getopt.h
index 7137f0379c..7137f0379c 100644
--- a/thirdparty/lws/win32helpers/getopt.h
+++ b/thirdparty/libwebsockets/win32helpers/getopt.h
diff --git a/thirdparty/lws/win32helpers/getopt_long.c b/thirdparty/libwebsockets/win32helpers/getopt_long.c
index 5bcf40060f..22e5fa8945 100644
--- a/thirdparty/lws/win32helpers/getopt_long.c
+++ b/thirdparty/libwebsockets/win32helpers/getopt_long.c
@@ -1,237 +1,240 @@
-
-/*
- * Copyright (c) 1987, 1993, 1994, 1996
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "getopt.h"
-
-extern int opterr; /* if error message should be printed */
-extern int optind; /* index into parent argv vector */
-extern int optopt; /* character checked for validity */
-extern int optreset; /* reset getopt */
-extern char *optarg; /* argument associated with option */
-
-#define __P(x) x
-#define _DIAGASSERT(x) assert(x)
-
-static char * __progname __P((char *));
-int getopt_internal __P((int, char * const *, const char *));
-
-static char *
-__progname(nargv0)
- char * nargv0;
-{
- char * tmp;
-
- _DIAGASSERT(nargv0 != NULL);
-
- tmp = strrchr(nargv0, '/');
- if (tmp)
- tmp++;
- else
- tmp = nargv0;
- return(tmp);
-}
-
-#define BADCH (int)'?'
-#define BADARG (int)':'
-#define EMSG ""
-
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt_internal(nargc, nargv, ostr)
- int nargc;
- char * const *nargv;
- const char *ostr;
-{
- static char *place = EMSG; /* option letter processing */
- char *oli; /* option letter list index */
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(ostr != NULL);
-
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
- place = EMSG;
- return (-1);
- }
- if (place[1] && *++place == '-') { /* found "--" */
- /* ++optind; */
- place = EMSG;
- return (-2);
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
- /*
- * if the user didn't specify '-' as an option,
- * assume it means -1.
- */
- if (optopt == (int)'-')
- return (-1);
- if (!*place)
- ++optind;
- if (opterr && *ostr != ':')
- (void)fprintf(stderr,
- "%s: illegal option -- %c\n", __progname(nargv[0]), optopt);
- return (BADCH);
- }
- if (*++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place)
- ++optind;
- } else { /* need an argument */
- if (*place) /* no white space */
- optarg = place;
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- if ((opterr) && (*ostr != ':'))
- (void)fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- __progname(nargv[0]), optopt);
- return (BADARG);
- } else /* white space */
- optarg = nargv[optind];
- place = EMSG;
- ++optind;
- }
- return (optopt); /* dump back option letter */
-}
-
-#if 0
-/*
- * getopt --
- * Parse argc/argv argument vector.
- */
-int
-getopt2(nargc, nargv, ostr)
- int nargc;
- char * const *nargv;
- const char *ostr;
-{
- int retval;
-
- if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) {
- retval = -1;
- ++optind;
- }
- return(retval);
-}
-#endif
-
-/*
- * getopt_long --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long(nargc, nargv, options, long_options, index)
- int nargc;
- char ** nargv;
- char * options;
- struct option * long_options;
- int * index;
-{
- int retval;
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(options != NULL);
- _DIAGASSERT(long_options != NULL);
- /* index may be NULL */
-
- if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
- char *current_argv = nargv[optind++] + 2, *has_equal;
- int i, current_argv_len, match = -1;
-
- if (*current_argv == '\0') {
- return(-1);
- }
- if ((has_equal = strchr(current_argv, '=')) != NULL) {
- current_argv_len = has_equal - current_argv;
- has_equal++;
- } else
- current_argv_len = strlen(current_argv);
-
- for (i = 0; long_options[i].name; i++) {
- if (strncmp(current_argv, long_options[i].name, current_argv_len))
- continue;
-
- if (strlen(long_options[i].name) == (unsigned)current_argv_len) {
- match = i;
- break;
- }
- if (match == -1)
- match = i;
- }
- if (match != -1) {
- if (long_options[match].has_arg == required_argument ||
- long_options[match].has_arg == optional_argument) {
- if (has_equal)
- optarg = has_equal;
- else
- optarg = nargv[optind++];
- }
- if ((long_options[match].has_arg == required_argument)
- && (optarg == NULL)) {
- /*
- * Missing argument, leading :
- * indicates no error should be generated
- */
- if ((opterr) && (*options != ':'))
- (void)fprintf(stderr,
- "%s: option requires an argument -- %s\n",
- __progname(nargv[0]), current_argv);
- return (BADARG);
- }
- } else { /* No matching argument */
- if ((opterr) && (*options != ':'))
- (void)fprintf(stderr,
- "%s: illegal option -- %s\n", __progname(nargv[0]), current_argv);
- return (BADCH);
- }
- if (long_options[match].flag) {
- *long_options[match].flag = long_options[match].val;
- retval = 0;
- } else
- retval = long_options[match].val;
- if (index)
- *index = match;
- }
- return(retval);
-}
+
+/*
+ * Copyright (c) 1987, 1993, 1994, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "getopt.h"
+
+#define lws_ptr_diff(head, tail) \
+ ((int)((char *)(head) - (char *)(tail)))
+
+extern int opterr; /* if error message should be printed */
+extern int optind; /* index into parent argv vector */
+extern int optopt; /* character checked for validity */
+extern int optreset; /* reset getopt */
+extern char *optarg; /* argument associated with option */
+
+#define __P(x) x
+#define _DIAGASSERT(x) assert(x)
+
+static char * __progname __P((char *));
+int getopt_internal __P((int, char * const *, const char *));
+
+static char *
+__progname(nargv0)
+ char * nargv0;
+{
+ char * tmp;
+
+ _DIAGASSERT(nargv0 != NULL);
+
+ tmp = strrchr(nargv0, '/');
+ if (tmp)
+ tmp++;
+ else
+ tmp = nargv0;
+ return(tmp);
+}
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_internal(nargc, nargv, ostr)
+ int nargc;
+ char * const *nargv;
+ const char *ostr;
+{
+ static char *place = EMSG; /* option letter processing */
+ char *oli; /* option letter list index */
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(ostr != NULL);
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (-1);
+ }
+ if (place[1] && *++place == '-') { /* found "--" */
+ /* ++optind; */
+ place = EMSG;
+ return (-2);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1.
+ */
+ if (optopt == (int)'-')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)fprintf(stderr,
+ "%s: illegal option -- %c\n", __progname(nargv[0]), optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ } else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if ((opterr) && (*ostr != ':'))
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %c\n",
+ __progname(nargv[0]), optopt);
+ return (BADARG);
+ } else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
+
+#if 0
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt2(nargc, nargv, ostr)
+ int nargc;
+ char * const *nargv;
+ const char *ostr;
+{
+ int retval;
+
+ if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) {
+ retval = -1;
+ ++optind;
+ }
+ return(retval);
+}
+#endif
+
+/*
+ * getopt_long --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_long(nargc, nargv, options, long_options, index)
+ int nargc;
+ char ** nargv;
+ char * options;
+ struct option * long_options;
+ int * index;
+{
+ int retval;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+ _DIAGASSERT(long_options != NULL);
+ /* index may be NULL */
+
+ if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
+ char *current_argv = nargv[optind++] + 2, *has_equal;
+ int i, current_argv_len, match = -1;
+
+ if (*current_argv == '\0') {
+ return(-1);
+ }
+ if ((has_equal = strchr(current_argv, '=')) != NULL) {
+ current_argv_len = lws_ptr_diff(has_equal, current_argv);
+ has_equal++;
+ } else
+ current_argv_len = (int)strlen(current_argv);
+
+ for (i = 0; long_options[i].name; i++) {
+ if (strncmp(current_argv, long_options[i].name, current_argv_len))
+ continue;
+
+ if (strlen(long_options[i].name) == (unsigned)current_argv_len) {
+ match = i;
+ break;
+ }
+ if (match == -1)
+ match = i;
+ }
+ if (match != -1) {
+ if (long_options[match].has_arg == required_argument ||
+ long_options[match].has_arg == optional_argument) {
+ if (has_equal)
+ optarg = has_equal;
+ else
+ optarg = nargv[optind++];
+ }
+ if ((long_options[match].has_arg == required_argument)
+ && (optarg == NULL)) {
+ /*
+ * Missing argument, leading :
+ * indicates no error should be generated
+ */
+ if ((opterr) && (*options != ':'))
+ (void)fprintf(stderr,
+ "%s: option requires an argument -- %s\n",
+ __progname(nargv[0]), current_argv);
+ return (BADARG);
+ }
+ } else { /* No matching argument */
+ if ((opterr) && (*options != ':'))
+ (void)fprintf(stderr,
+ "%s: illegal option -- %s\n", __progname(nargv[0]), current_argv);
+ return (BADCH);
+ }
+ if (long_options[match].flag) {
+ *long_options[match].flag = long_options[match].val;
+ retval = 0;
+ } else
+ retval = long_options[match].val;
+ if (index)
+ *index = match;
+ }
+ return(retval);
+}
diff --git a/thirdparty/lws/win32helpers/gettimeofday.c b/thirdparty/libwebsockets/win32helpers/gettimeofday.c
index 35dd73531d..08385c2320 100644
--- a/thirdparty/lws/win32helpers/gettimeofday.c
+++ b/thirdparty/libwebsockets/win32helpers/gettimeofday.c
@@ -1,36 +1,36 @@
-#include <time.h>
-#include <windows.h> //I've omitted context line
-
-#include "gettimeofday.h"
-
-int gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- FILETIME ft;
- unsigned __int64 tmpres = 0;
- static int tzflag;
-
- if (NULL != tv) {
- GetSystemTimeAsFileTime(&ft);
-
- tmpres |= ft.dwHighDateTime;
- tmpres <<= 32;
- tmpres |= ft.dwLowDateTime;
-
- /*converting file time to unix epoch*/
- tmpres /= 10; /*convert into microseconds*/
+#include <time.h>
+#include <windows.h> //I've omitted context line
+
+#include "gettimeofday.h"
+
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ unsigned __int64 tmpres = 0;
+ static int tzflag;
+
+ if (NULL != tv) {
+ GetSystemTimeAsFileTime(&ft);
+
+ tmpres |= ft.dwHighDateTime;
+ tmpres <<= 32;
+ tmpres |= ft.dwLowDateTime;
+
+ /*converting file time to unix epoch*/
+ tmpres /= 10; /*convert into microseconds*/
tmpres -= DELTA_EPOCH_IN_MICROSECS;
- tv->tv_sec = (long)(tmpres / 1000000UL);
- tv->tv_usec = (long)(tmpres % 1000000UL);
- }
-
- if (NULL != tz) {
- if (!tzflag) {
- _tzset();
- tzflag++;
- }
- tz->tz_minuteswest = _timezone / 60;
- tz->tz_dsttime = _daylight;
- }
-
- return 0;
-}
+ tv->tv_sec = (long)(tmpres / 1000000UL);
+ tv->tv_usec = (long)(tmpres % 1000000UL);
+ }
+
+ if (NULL != tz) {
+ if (!tzflag) {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
diff --git a/thirdparty/lws/win32helpers/gettimeofday.h b/thirdparty/libwebsockets/win32helpers/gettimeofday.h
index 33e7a750fe..33e7a750fe 100644
--- a/thirdparty/lws/win32helpers/gettimeofday.h
+++ b/thirdparty/libwebsockets/win32helpers/gettimeofday.h
diff --git a/thirdparty/lws/client/client.c b/thirdparty/lws/client/client.c
deleted file mode 100644
index 20450aa923..0000000000
--- a/thirdparty/lws/client/client.c
+++ /dev/null
@@ -1,1296 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2014 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-int
-lws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
-{
- int m;
-
- switch (wsi->mode) {
- case LWSCM_WSCL_WAITING_PROXY_REPLY:
- case LWSCM_WSCL_ISSUE_HANDSHAKE:
- case LWSCM_WSCL_WAITING_SERVER_REPLY:
- case LWSCM_WSCL_WAITING_EXTENSION_CONNECT:
- case LWSCM_WS_CLIENT:
- while (len) {
- /*
- * we were accepting input but now we stopped doing so
- */
- if (lws_is_flowcontrolled(wsi)) {
- lwsl_debug("%s: caching %ld\n", __func__, (long)len);
- lws_rxflow_cache(wsi, *buf, 0, len);
- return 0;
- }
- if (wsi->u.ws.rx_draining_ext) {
-#if !defined(LWS_NO_CLIENT)
- if (wsi->mode == LWSCM_WS_CLIENT)
- m = lws_client_rx_sm(wsi, 0);
- else
-#endif
- m = lws_rx_sm(wsi, 0);
- if (m < 0)
- return -1;
- continue;
- }
- /* account for what we're using in rxflow buffer */
- if (wsi->rxflow_buffer)
- wsi->rxflow_pos++;
-
- if (lws_client_rx_sm(wsi, *(*buf)++)) {
- lwsl_debug("client_rx_sm exited\n");
- return -1;
- }
- len--;
- }
- lwsl_debug("%s: finished with %ld\n", __func__, (long)len);
- return 0;
- default:
- break;
- }
-
- return 0;
-}
-
-LWS_VISIBLE LWS_EXTERN void
-lws_client_http_body_pending(struct lws *wsi, int something_left_to_send)
-{
- wsi->client_http_body_pending = !!something_left_to_send;
-}
-
-int
-lws_client_socket_service(struct lws_context *context, struct lws *wsi,
- struct lws_pollfd *pollfd)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- char *p = (char *)&pt->serv_buf[0];
- const char *cce = NULL;
- unsigned char c;
- char *sb = p;
- int n = 0;
- ssize_t len = 0;
-#if defined(LWS_WITH_SOCKS5)
- char conn_mode = 0, pending_timeout = 0;
-#endif
-
- switch (wsi->mode) {
-
- case LWSCM_WSCL_WAITING_CONNECT:
-
- /*
- * we are under PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE
- * timeout protection set in client-handshake.c
- */
-
- if (!lws_client_connect_2(wsi)) {
- /* closed */
- lwsl_client("closed\n");
- return -1;
- }
-
- /* either still pending connection, or changed mode */
- return 0;
-
-#if defined(LWS_WITH_SOCKS5)
- /* SOCKS Greeting Reply */
- case LWSCM_WSCL_WAITING_SOCKS_GREETING_REPLY:
- case LWSCM_WSCL_WAITING_SOCKS_AUTH_REPLY:
- case LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY:
-
- /* handle proxy hung up on us */
-
- if (pollfd->revents & LWS_POLLHUP) {
- lwsl_warn("SOCKS connection %p (fd=%d) dead\n",
- (void *)wsi, pollfd->fd);
- goto bail3;
- }
-
- n = recv(wsi->desc.sockfd, sb, context->pt_serv_buf_size, 0);
- if (n < 0) {
- if (LWS_ERRNO == LWS_EAGAIN) {
- lwsl_debug("SOCKS read EAGAIN, retrying\n");
- return 0;
- }
- lwsl_err("ERROR reading from SOCKS socket\n");
- goto bail3;
- }
-
- switch (wsi->mode) {
-
- case LWSCM_WSCL_WAITING_SOCKS_GREETING_REPLY:
- if (pt->serv_buf[0] != SOCKS_VERSION_5)
- goto socks_reply_fail;
-
- if (pt->serv_buf[1] == SOCKS_AUTH_NO_AUTH) {
- lwsl_client("SOCKS greeting reply: No Auth Method\n");
- socks_generate_msg(wsi, SOCKS_MSG_CONNECT, &len);
- conn_mode = LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY;
- pending_timeout = PENDING_TIMEOUT_AWAITING_SOCKS_CONNECT_REPLY;
- goto socks_send;
- }
-
- if (pt->serv_buf[1] == SOCKS_AUTH_USERNAME_PASSWORD) {
- lwsl_client("SOCKS greeting reply: User/Pw Method\n");
- socks_generate_msg(wsi, SOCKS_MSG_USERNAME_PASSWORD, &len);
- conn_mode = LWSCM_WSCL_WAITING_SOCKS_AUTH_REPLY;
- pending_timeout = PENDING_TIMEOUT_AWAITING_SOCKS_AUTH_REPLY;
- goto socks_send;
- }
- goto socks_reply_fail;
-
- case LWSCM_WSCL_WAITING_SOCKS_AUTH_REPLY:
- if (pt->serv_buf[0] != SOCKS_SUBNEGOTIATION_VERSION_1 ||
- pt->serv_buf[1] != SOCKS_SUBNEGOTIATION_STATUS_SUCCESS)
- goto socks_reply_fail;
-
- lwsl_client("SOCKS password OK, sending connect\n");
- socks_generate_msg(wsi, SOCKS_MSG_CONNECT, &len);
- conn_mode = LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY;
- pending_timeout = PENDING_TIMEOUT_AWAITING_SOCKS_CONNECT_REPLY;
-socks_send:
- n = send(wsi->desc.sockfd, (char *)pt->serv_buf, len,
- MSG_NOSIGNAL);
- if (n < 0) {
- lwsl_debug("ERROR writing to socks proxy\n");
- goto bail3;
- }
-
- lws_set_timeout(wsi, pending_timeout, AWAITING_TIMEOUT);
- wsi->mode = conn_mode;
- break;
-
-socks_reply_fail:
- lwsl_notice("socks reply: v%d, err %d\n",
- pt->serv_buf[0], pt->serv_buf[1]);
- goto bail3;
-
- case LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY:
- if (pt->serv_buf[0] != SOCKS_VERSION_5 ||
- pt->serv_buf[1] != SOCKS_REQUEST_REPLY_SUCCESS)
- goto socks_reply_fail;
-
- lwsl_client("socks connect OK\n");
-
- /* free stash since we are done with it */
- lws_free_set_NULL(wsi->u.hdr.stash);
- if (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS,
- wsi->vhost->socks_proxy_address))
- goto bail3;
-
- wsi->c_port = wsi->vhost->socks_proxy_port;
-
- /* clear his proxy connection timeout */
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
- goto start_ws_handshake;
- }
- break;
-#endif
-
- case LWSCM_WSCL_WAITING_PROXY_REPLY:
-
- /* handle proxy hung up on us */
-
- if (pollfd->revents & LWS_POLLHUP) {
-
- lwsl_warn("Proxy connection %p (fd=%d) dead\n",
- (void *)wsi, pollfd->fd);
-
- goto bail3;
- }
-
- n = recv(wsi->desc.sockfd, sb, context->pt_serv_buf_size, 0);
- if (n < 0) {
- if (LWS_ERRNO == LWS_EAGAIN) {
- lwsl_debug("Proxy read returned EAGAIN... retrying\n");
- return 0;
- }
- lwsl_err("ERROR reading from proxy socket\n");
- goto bail3;
- }
-
- pt->serv_buf[13] = '\0';
- if (strcmp(sb, "HTTP/1.0 200 ") &&
- strcmp(sb, "HTTP/1.1 200 ")) {
- lwsl_err("ERROR proxy: %s\n", sb);
- goto bail3;
- }
-
- /* clear his proxy connection timeout */
-
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
-
- /* fallthru */
-
- case LWSCM_WSCL_ISSUE_HANDSHAKE:
-
- /*
- * we are under PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE
- * timeout protection set in client-handshake.c
- *
- * take care of our lws_callback_on_writable
- * happening at a time when there's no real connection yet
- */
-#if defined(LWS_WITH_SOCKS5)
-start_ws_handshake:
-#endif
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0))
- return -1;
-
-#ifdef LWS_OPENSSL_SUPPORT
- /* we can retry this... just cook the SSL BIO the first time */
-
- if (wsi->use_ssl && !wsi->ssl) {
- if (lws_ssl_client_bio_create(wsi))
- return -1;
- }
-
- if (wsi->use_ssl) {
- n = lws_ssl_client_connect1(wsi);
- if (!n)
- return 0;
- if (n < 0) {
- cce = "lws_ssl_client_connect1 failed";
- goto bail3;
- }
- } else
- wsi->ssl = NULL;
-
- /* fallthru */
-
- case LWSCM_WSCL_WAITING_SSL:
-
- if (wsi->use_ssl) {
- n = lws_ssl_client_connect2(wsi);
- if (!n)
- return 0;
- if (n < 0) {
- cce = "lws_ssl_client_connect2 failed";
- goto bail3;
- }
- } else
- wsi->ssl = NULL;
-#endif
-
- wsi->mode = LWSCM_WSCL_ISSUE_HANDSHAKE2;
- lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND,
- context->timeout_secs);
-
- /* fallthru */
-
- case LWSCM_WSCL_ISSUE_HANDSHAKE2:
- p = lws_generate_client_handshake(wsi, p);
- if (p == NULL) {
- if (wsi->mode == LWSCM_RAW)
- return 0;
-
- lwsl_err("Failed to generate handshake for client\n");
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
- return 0;
- }
-
- /* send our request to the server */
- lws_latency_pre(context, wsi);
-
- n = lws_ssl_capable_write(wsi, (unsigned char *)sb, p - sb);
- lws_latency(context, wsi, "send lws_issue_raw", n,
- n == p - sb);
- switch (n) {
- case LWS_SSL_CAPABLE_ERROR:
- lwsl_debug("ERROR writing to client socket\n");
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
- return 0;
- case LWS_SSL_CAPABLE_MORE_SERVICE:
- lws_callback_on_writable(wsi);
- break;
- }
-
- if (wsi->client_http_body_pending) {
- wsi->mode = LWSCM_WSCL_ISSUE_HTTP_BODY;
- lws_set_timeout(wsi, PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD,
- context->timeout_secs);
- /* user code must ask for writable callback */
- break;
- }
-
- goto client_http_body_sent;
-
- case LWSCM_WSCL_ISSUE_HTTP_BODY:
- if (wsi->client_http_body_pending) {
- lws_set_timeout(wsi, PENDING_TIMEOUT_CLIENT_ISSUE_PAYLOAD,
- context->timeout_secs);
- /* user code must ask for writable callback */
- break;
- }
-client_http_body_sent:
- wsi->u.hdr.parser_state = WSI_TOKEN_NAME_PART;
- wsi->u.hdr.lextable_pos = 0;
- wsi->mode = LWSCM_WSCL_WAITING_SERVER_REPLY;
- lws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,
- context->timeout_secs);
- break;
-
- case LWSCM_WSCL_WAITING_SERVER_REPLY:
- /*
- * handle server hanging up on us...
- * but if there is POLLIN waiting, handle that first
- */
- if ((pollfd->revents & (LWS_POLLIN | LWS_POLLHUP)) ==
- LWS_POLLHUP) {
-
- lwsl_debug("Server connection %p (fd=%d) dead\n",
- (void *)wsi, pollfd->fd);
- cce = "Peer hung up";
- goto bail3;
- }
-
- if (!(pollfd->revents & LWS_POLLIN))
- break;
-
- /* interpret the server response
- *
- * HTTP/1.1 101 Switching Protocols
- * Upgrade: websocket
- * Connection: Upgrade
- * Sec-WebSocket-Accept: me89jWimTRKTWwrS3aRrL53YZSo=
- * Sec-WebSocket-Nonce: AQIDBAUGBwgJCgsMDQ4PEC==
- * Sec-WebSocket-Protocol: chat
- *
- * we have to take some care here to only take from the
- * socket bytewise. The browser may (and has been seen to
- * in the case that onopen() performs websocket traffic)
- * coalesce both handshake response and websocket traffic
- * in one packet, since at that point the connection is
- * definitively ready from browser pov.
- */
- len = 1;
- while (wsi->u.hdr.parser_state != WSI_PARSING_COMPLETE &&
- len > 0) {
- n = lws_ssl_capable_read(wsi, &c, 1);
- lws_latency(context, wsi, "send lws_issue_raw", n,
- n == 1);
- switch (n) {
- case 0:
- case LWS_SSL_CAPABLE_ERROR:
- cce = "read failed";
- goto bail3;
- case LWS_SSL_CAPABLE_MORE_SERVICE:
- return 0;
- }
-
- if (lws_parse(wsi, c)) {
- lwsl_warn("problems parsing header\n");
- goto bail3;
- }
- }
-
- /*
- * hs may also be coming in multiple packets, there is a 5-sec
- * libwebsocket timeout still active here too, so if parsing did
- * not complete just wait for next packet coming in this state
- */
- if (wsi->u.hdr.parser_state != WSI_PARSING_COMPLETE)
- break;
-
- /*
- * otherwise deal with the handshake. If there's any
- * packet traffic already arrived we'll trigger poll() again
- * right away and deal with it that way
- */
- return lws_client_interpret_server_handshake(wsi);
-
-bail3:
- lwsl_info("closing conn at LWS_CONNMODE...SERVER_REPLY\n");
- if (cce)
- lwsl_info("reason: %s\n", cce);
- wsi->protocol->callback(wsi,
- LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
- wsi->user_space, (void *)cce, cce ? strlen(cce) : 0);
- wsi->already_did_cce = 1;
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
- return -1;
-
- case LWSCM_WSCL_WAITING_EXTENSION_CONNECT:
- lwsl_ext("LWSCM_WSCL_WAITING_EXTENSION_CONNECT\n");
- break;
-
- case LWSCM_WSCL_PENDING_CANDIDATE_CHILD:
- lwsl_ext("LWSCM_WSCL_PENDING_CANDIDATE_CHILD\n");
- break;
- default:
- break;
- }
-
- return 0;
-}
-
-/*
- * In-place str to lower case
- */
-
-static void
-strtolower(char *s)
-{
- while (*s) {
-#ifdef LWS_PLAT_OPTEE
- int tolower_optee(int c);
- *s = tolower_optee((int)*s);
-#else
- *s = tolower((int)*s);
-#endif
- s++;
- }
-}
-
-int LWS_WARN_UNUSED_RESULT
-lws_http_transaction_completed_client(struct lws *wsi)
-{
- lwsl_debug("%s: wsi %p\n", __func__, wsi);
- /* if we can't go back to accept new headers, drop the connection */
- if (wsi->u.http.connection_type != HTTP_CONNECTION_KEEP_ALIVE) {
- lwsl_info("%s: %p: close connection\n", __func__, wsi);
- return 1;
- }
-
- /* we don't support chained client connections yet */
- return 1;
-#if 0
- /* otherwise set ourselves up ready to go again */
- wsi->state = LWSS_CLIENT_HTTP_ESTABLISHED;
- wsi->mode = LWSCM_HTTP_CLIENT_ACCEPTED;
- wsi->u.http.rx_content_length = 0;
- wsi->hdr_parsing_completed = 0;
-
- /* He asked for it to stay alive indefinitely */
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
-
- /*
- * As client, nothing new is going to come until we ask for it
- * we can drop the ah, if any
- */
- if (wsi->u.hdr.ah) {
- lws_header_table_force_to_detachable_state(wsi);
- lws_header_table_detach(wsi, 0);
- }
-
- /* If we're (re)starting on headers, need other implied init */
- wsi->u.hdr.ues = URIES_IDLE;
-
- lwsl_info("%s: %p: keep-alive await new transaction\n", __func__, wsi);
-
- return 0;
-#endif
-}
-
-LWS_VISIBLE LWS_EXTERN unsigned int
-lws_http_client_http_response(struct lws *wsi)
-{
- if (!wsi->u.http.ah)
- return 0;
-
- return wsi->u.http.ah->http_response;
-}
-
-int
-lws_client_interpret_server_handshake(struct lws *wsi)
-{
- int n, len, okay = 0, port = 0, ssl = 0;
- int close_reason = LWS_CLOSE_STATUS_PROTOCOL_ERR;
- struct lws_context *context = wsi->context;
- const char *pc, *prot, *ads = NULL, *path, *cce = NULL;
- struct allocated_headers *ah = NULL;
- char *p, *q;
- char new_path[300];
-#ifndef LWS_NO_EXTENSIONS
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- char *sb = (char *)&pt->serv_buf[0];
- const struct lws_ext_options *opts;
- const struct lws_extension *ext;
- char ext_name[128];
- const char *c, *a;
- char ignore;
- int more = 1;
- void *v;
-#endif
- if (wsi->u.hdr.stash)
- lws_free_set_NULL(wsi->u.hdr.stash);
-
- ah = wsi->u.hdr.ah;
- if (!wsi->do_ws) {
- /* we are being an http client...
- */
- lws_union_transition(wsi, LWSCM_HTTP_CLIENT_ACCEPTED);
- wsi->state = LWSS_CLIENT_HTTP_ESTABLISHED;
- wsi->u.http.ah = ah;
- ah->http_response = 0;
- }
-
- /*
- * well, what the server sent looked reasonable for syntax.
- * Now let's confirm it sent all the necessary headers
- *
- * http (non-ws) client will expect something like this
- *
- * HTTP/1.0.200
- * server:.libwebsockets
- * content-type:.text/html
- * content-length:.17703
- * set-cookie:.test=LWS_1456736240_336776_COOKIE;Max-Age=360000
- *
- *
- *
- */
-
- wsi->u.http.connection_type = HTTP_CONNECTION_KEEP_ALIVE;
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
- if (wsi->do_ws && !p) {
- lwsl_info("no URI\n");
- cce = "HS: URI missing";
- goto bail3;
- }
- if (!p) {
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP1_0);
- wsi->u.http.connection_type = HTTP_CONNECTION_CLOSE;
- }
- if (!p) {
- cce = "HS: URI missing";
- lwsl_info("no URI\n");
- goto bail3;
- }
- n = atoi(p);
- if (ah)
- ah->http_response = n;
-
- if (n == 301 || n == 302 || n == 303 || n == 307 || n == 308) {
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_LOCATION);
- if (!p) {
- cce = "HS: Redirect code but no Location";
- goto bail3;
- }
-
- /* Relative reference absolute path */
- if (p[0] == '/')
- {
-#ifdef LWS_OPENSSL_SUPPORT
- ssl = wsi->use_ssl;
-#endif
- ads = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS);
- port = wsi->c_port;
- path = p + 1; /* +1 as lws_client_reset expects leading / to be omitted */
- }
- /* Absolute (Full) URI */
- else if (strchr(p, ':'))
- {
- if (lws_parse_uri(p, &prot, &ads, &port, &path)) {
- cce = "HS: URI did not parse";
- goto bail3;
- }
-
- if (!strcmp(prot, "wss") || !strcmp(prot, "https"))
- ssl = 1;
- }
- /* Relative reference relative path */
- else
- {
- /* This doesn't try to calculate an absolute path, that will be left to the server */
-#ifdef LWS_OPENSSL_SUPPORT
- ssl = wsi->use_ssl;
-#endif
- ads = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS);
- port = wsi->c_port;
- path = new_path + 1; /* +1 as lws_client_reset expects leading / to be omitted */
- strncpy(new_path, lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_URI), sizeof(new_path));
- new_path[sizeof(new_path) - 1] = '\0';
- q = strrchr(new_path, '/');
- if (q)
- {
- strncpy(q + 1, p, sizeof(new_path) - (q - new_path) - 1);
- new_path[sizeof(new_path) - 1] = '\0';
- }
- else
- {
- path = p;
- }
- }
-
-#ifdef LWS_OPENSSL_SUPPORT
- if (wsi->use_ssl && !ssl) {
- cce = "HS: Redirect attempted SSL downgrade";
- goto bail3;
- }
-#endif
-
- if (!lws_client_reset(&wsi, ssl, ads, port, path, ads)) {
- /* there are two ways to fail out with NULL return...
- * simple, early problem where the wsi is intact, or
- * we went through with the reconnect attempt and the
- * wsi is already closed. In the latter case, the wsi
- * has beet set to NULL additionally.
- */
- lwsl_err("Redirect failed\n");
- cce = "HS: Redirect failed";
- if (wsi)
- goto bail3;
-
- return 1;
- }
- return 0;
- }
-
- if (!wsi->do_ws) {
-
-#ifdef LWS_WITH_HTTP_PROXY
- wsi->perform_rewrite = 0;
- if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE)) {
- if (!strncmp(lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_CONTENT_TYPE),
- "text/html", 9))
- wsi->perform_rewrite = 1;
- }
-#endif
-
- /* allocate the per-connection user memory (if any) */
- if (lws_ensure_user_space(wsi)) {
- lwsl_err("Problem allocating wsi user mem\n");
- cce = "HS: OOM";
- goto bail2;
- }
-
- /* he may choose to send us stuff in chunked transfer-coding */
- wsi->chunked = 0;
- wsi->chunk_remaining = 0; /* ie, next thing is chunk size */
- if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_TRANSFER_ENCODING)) {
- wsi->chunked = !strcmp(lws_hdr_simple_ptr(wsi,
- WSI_TOKEN_HTTP_TRANSFER_ENCODING),
- "chunked");
- /* first thing is hex, after payload there is crlf */
- wsi->chunk_parser = ELCP_HEX;
- }
-
- if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH)) {
- wsi->u.http.rx_content_length =
- atoll(lws_hdr_simple_ptr(wsi,
- WSI_TOKEN_HTTP_CONTENT_LENGTH));
- lwsl_notice("%s: incoming content length %llu\n", __func__,
- (unsigned long long)wsi->u.http.rx_content_length);
- wsi->u.http.rx_content_remain = wsi->u.http.rx_content_length;
- } else /* can't do 1.1 without a content length or chunked */
- if (!wsi->chunked)
- wsi->u.http.connection_type = HTTP_CONNECTION_CLOSE;
-
- /*
- * we seem to be good to go, give client last chance to check
- * headers and OK it
- */
- if (wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH,
- wsi->user_space, NULL, 0)) {
-
- cce = "HS: disallowed by client filter";
- goto bail2;
- }
-
- /* clear his proxy connection timeout */
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
-
- wsi->rxflow_change_to = LWS_RXFLOW_ALLOW;
-
- /* call him back to inform him he is up */
- if (wsi->protocol->callback(wsi,
- LWS_CALLBACK_ESTABLISHED_CLIENT_HTTP,
- wsi->user_space, NULL, 0)) {
- cce = "HS: disallowed at ESTABLISHED";
- goto bail3;
- }
-
- /* free up his parsing allocations */
- lws_header_table_detach(wsi, 0);
-
- lwsl_notice("%s: client connection up\n", __func__);
-
- return 0;
- }
-
- if (lws_hdr_total_length(wsi, WSI_TOKEN_ACCEPT) == 0) {
- lwsl_info("no ACCEPT\n");
- cce = "HS: ACCEPT missing";
- goto bail3;
- }
-
- if (p && strncmp(p, "101", 3)) {
- lwsl_warn(
- "lws_client_handshake: got bad HTTP response '%s'\n", p);
- cce = "HS: ws upgrade response not 101";
- goto bail3;
- }
-
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE);
- if (!p) {
- lwsl_info("no UPGRADE\n");
- cce = "HS: UPGRADE missing";
- goto bail3;
- }
- strtolower(p);
- if (strcmp(p, "websocket")) {
- lwsl_warn(
- "lws_client_handshake: got bad Upgrade header '%s'\n", p);
- cce = "HS: Upgrade to something other than websocket";
- goto bail3;
- }
-
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_CONNECTION);
- if (!p) {
- lwsl_info("no Connection hdr\n");
- cce = "HS: CONNECTION missing";
- goto bail3;
- }
- strtolower(p);
- if (strcmp(p, "upgrade")) {
- lwsl_warn("lws_client_int_s_hs: bad header %s\n", p);
- cce = "HS: UPGRADE malformed";
- goto bail3;
- }
-
- pc = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
- if (!pc) {
- lwsl_parser("lws_client_int_s_hs: no protocol list\n");
- } else
- lwsl_parser("lws_client_int_s_hs: protocol list '%s'\n", pc);
-
- /*
- * confirm the protocol the server wants to talk was in the list
- * of protocols we offered
- */
-
- len = lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL);
- if (!len) {
- lwsl_info("lws_client_int_s_hs: WSI_TOKEN_PROTOCOL is null\n");
- /*
- * no protocol name to work from,
- * default to first protocol
- */
- n = 0;
- wsi->protocol = &wsi->vhost->protocols[0];
- goto check_extensions;
- }
-
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_PROTOCOL);
- len = strlen(p);
-
- while (pc && *pc && !okay) {
- if (!strncmp(pc, p, len) &&
- (pc[len] == ',' || pc[len] == '\0')) {
- okay = 1;
- continue;
- }
- while (*pc && *pc++ != ',')
- ;
- while (*pc && *pc == ' ')
- pc++;
- }
-
- if (!okay) {
- lwsl_err("lws_client_int_s_hs: got bad protocol %s\n", p);
- cce = "HS: PROTOCOL malformed";
- goto bail2;
- }
-
- /*
- * identify the selected protocol struct and set it
- */
- n = 0;
- wsi->protocol = NULL;
- while (wsi->vhost->protocols[n].callback && !wsi->protocol) {
- if (strcmp(p, wsi->vhost->protocols[n].name) == 0) {
- wsi->protocol = &wsi->vhost->protocols[n];
- break;
- }
- n++;
- }
-
- if (wsi->protocol == NULL) {
- lwsl_err("lws_client_int_s_hs: fail protocol %s\n", p);
- cce = "HS: Cannot match protocol";
- goto bail2;
- }
-
-check_extensions:
- /*
- * stitch protocol choice into the vh protocol linked list
- * We always insert ourselves at the start of the list
- *
- * X <-> B
- * X <-> pAn <-> pB
- */
- //lwsl_err("%s: pre insert vhost start wsi %p, that wsi prev == %p\n",
- // __func__,
- // wsi->vhost->same_vh_protocol_list[n],
- // wsi->same_vh_protocol_prev);
- wsi->same_vh_protocol_prev = /* guy who points to us */
- &wsi->vhost->same_vh_protocol_list[n];
- wsi->same_vh_protocol_next = /* old first guy is our next */
- wsi->vhost->same_vh_protocol_list[n];
- /* we become the new first guy */
- wsi->vhost->same_vh_protocol_list[n] = wsi;
-
- if (wsi->same_vh_protocol_next)
- /* old first guy points back to us now */
- wsi->same_vh_protocol_next->same_vh_protocol_prev =
- &wsi->same_vh_protocol_next;
-
-#ifndef LWS_NO_EXTENSIONS
- /* instantiate the accepted extensions */
-
- if (!lws_hdr_total_length(wsi, WSI_TOKEN_EXTENSIONS)) {
- lwsl_ext("no client extensions allowed by server\n");
- goto check_accept;
- }
-
- /*
- * break down the list of server accepted extensions
- * and go through matching them or identifying bogons
- */
-
- if (lws_hdr_copy(wsi, sb, context->pt_serv_buf_size, WSI_TOKEN_EXTENSIONS) < 0) {
- lwsl_warn("ext list from server failed to copy\n");
- cce = "HS: EXT: list too big";
- goto bail2;
- }
-
- c = sb;
- n = 0;
- ignore = 0;
- a = NULL;
- while (more) {
-
- if (*c && (*c != ',' && *c != '\t')) {
- if (*c == ';') {
- ignore = 1;
- if (!a)
- a = c + 1;
- }
- if (ignore || *c == ' ') {
- c++;
- continue;
- }
-
- ext_name[n] = *c++;
- if (n < sizeof(ext_name) - 1)
- n++;
- continue;
- }
- ext_name[n] = '\0';
- ignore = 0;
- if (!*c)
- more = 0;
- else {
- c++;
- if (!n)
- continue;
- }
-
- /* check we actually support it */
-
- lwsl_notice("checking client ext %s\n", ext_name);
-
- n = 0;
- ext = wsi->vhost->extensions;
- while (ext && ext->callback) {
- if (strcmp(ext_name, ext->name)) {
- ext++;
- continue;
- }
-
- n = 1;
- lwsl_notice("instantiating client ext %s\n", ext_name);
-
- /* instantiate the extension on this conn */
-
- wsi->active_extensions[wsi->count_act_ext] = ext;
-
- /* allow him to construct his ext instance */
-
- if (ext->callback(lws_get_context(wsi), ext, wsi,
- LWS_EXT_CB_CLIENT_CONSTRUCT,
- (void *)&wsi->act_ext_user[wsi->count_act_ext],
- (void *)&opts, 0)) {
- lwsl_info(" ext %s failed construction\n", ext_name);
- ext++;
- continue;
- }
-
- /*
- * allow the user code to override ext defaults if it
- * wants to
- */
- ext_name[0] = '\0';
- if (user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_WS_EXT_DEFAULTS,
- (char *)ext->name, ext_name,
- sizeof(ext_name))) {
- cce = "HS: EXT: failed setting defaults";
- goto bail2;
- }
-
- if (ext_name[0] &&
- lws_ext_parse_options(ext, wsi, wsi->act_ext_user[
- wsi->count_act_ext], opts, ext_name,
- strlen(ext_name))) {
- lwsl_err("%s: unable to parse user defaults '%s'",
- __func__, ext_name);
- cce = "HS: EXT: failed parsing defaults";
- goto bail2;
- }
-
- /*
- * give the extension the server options
- */
- if (a && lws_ext_parse_options(ext, wsi,
- wsi->act_ext_user[wsi->count_act_ext],
- opts, a, c - a)) {
- lwsl_err("%s: unable to parse remote def '%s'",
- __func__, a);
- cce = "HS: EXT: failed parsing options";
- goto bail2;
- }
-
- if (ext->callback(lws_get_context(wsi), ext, wsi,
- LWS_EXT_CB_OPTION_CONFIRM,
- wsi->act_ext_user[wsi->count_act_ext],
- NULL, 0)) {
- lwsl_err("%s: ext %s rejects server options %s",
- __func__, ext->name, a);
- cce = "HS: EXT: Rejects server options";
- goto bail2;
- }
-
- wsi->count_act_ext++;
-
- ext++;
- }
-
- if (n == 0) {
- lwsl_warn("Unknown ext '%s'!\n", ext_name);
- cce = "HS: EXT: unknown ext";
- goto bail2;
- }
-
- a = NULL;
- n = 0;
- }
-
-check_accept:
-#endif
-
- /*
- * Confirm his accept token is the one we precomputed
- */
-
- p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_ACCEPT);
- if (strcmp(p, wsi->u.hdr.ah->initial_handshake_hash_base64)) {
- lwsl_warn("lws_client_int_s_hs: accept '%s' wrong vs '%s'\n", p,
- wsi->u.hdr.ah->initial_handshake_hash_base64);
- cce = "HS: Accept hash wrong";
- goto bail2;
- }
-
- /* allocate the per-connection user memory (if any) */
- if (lws_ensure_user_space(wsi)) {
- lwsl_err("Problem allocating wsi user mem\n");
- cce = "HS: OOM";
- goto bail2;
- }
-
- /*
- * we seem to be good to go, give client last chance to check
- * headers and OK it
- */
- if (wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH,
- wsi->user_space, NULL, 0)) {
- cce = "HS: Rejected by filter cb";
- goto bail2;
- }
-
- /* clear his proxy connection timeout */
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
-
- /* free up his parsing allocations */
- lws_header_table_detach(wsi, 0);
-
- lws_union_transition(wsi, LWSCM_WS_CLIENT);
- wsi->state = LWSS_ESTABLISHED;
- lws_restart_ws_ping_pong_timer(wsi);
-
- wsi->rxflow_change_to = LWS_RXFLOW_ALLOW;
-
- /*
- * create the frame buffer for this connection according to the
- * size mentioned in the protocol definition. If 0 there, then
- * use a big default for compatibility
- */
- n = wsi->protocol->rx_buffer_size;
- if (!n)
- n = context->pt_serv_buf_size;
- n += LWS_PRE;
- wsi->u.ws.rx_ubuf = lws_malloc(n + 4 /* 0x0000ffff zlib */, "client frame buffer");
- if (!wsi->u.ws.rx_ubuf) {
- lwsl_err("Out of Mem allocating rx buffer %d\n", n);
- cce = "HS: OOM";
- goto bail2;
- }
- wsi->u.ws.rx_ubuf_alloc = n;
- lwsl_info("Allocating client RX buffer %d\n", n);
-
-#if !defined(LWS_WITH_ESP32)
- if (setsockopt(wsi->desc.sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&n,
- sizeof n)) {
- lwsl_warn("Failed to set SNDBUF to %d", n);
- cce = "HS: SO_SNDBUF failed";
- goto bail3;
- }
-#endif
-
- lwsl_debug("handshake OK for protocol %s\n", wsi->protocol->name);
-
- /* call him back to inform him he is up */
-
- if (wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_ESTABLISHED,
- wsi->user_space, NULL, 0)) {
- cce = "HS: Rejected at CLIENT_ESTABLISHED";
- goto bail3;
- }
-#ifndef LWS_NO_EXTENSIONS
- /*
- * inform all extensions, not just active ones since they
- * already know
- */
- ext = wsi->vhost->extensions;
-
- while (ext && ext->callback) {
- v = NULL;
- for (n = 0; n < wsi->count_act_ext; n++)
- if (wsi->active_extensions[n] == ext)
- v = wsi->act_ext_user[n];
-
- ext->callback(context, ext, wsi,
- LWS_EXT_CB_ANY_WSI_ESTABLISHED, v, NULL, 0);
- ext++;
- }
-#endif
-
- return 0;
-
-bail3:
- close_reason = LWS_CLOSE_STATUS_NOSTATUS;
-
-bail2:
- if (wsi->protocol)
- wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
- wsi->user_space, (void *)cce,
- (unsigned int)strlen(cce));
- wsi->already_did_cce = 1;
-
- lwsl_info("closing connection due to bail2 connection error\n");
-
- /* closing will free up his parsing allocations */
- lws_close_free_wsi(wsi, close_reason);
-
- return 1;
-}
-
-
-char *
-lws_generate_client_handshake(struct lws *wsi, char *pkt)
-{
- char buf[128], hash[20], key_b64[40], *p = pkt;
- struct lws_context *context = wsi->context;
- const char *meth;
- int n;
-#ifndef LWS_NO_EXTENSIONS
- const struct lws_extension *ext;
- int ext_count = 0;
-#endif
- const char *pp = lws_hdr_simple_ptr(wsi,
- _WSI_TOKEN_CLIENT_SENT_PROTOCOLS);
-
- meth = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_METHOD);
- if (!meth) {
- meth = "GET";
- wsi->do_ws = 1;
- } else {
- wsi->do_ws = 0;
- }
-
- if (!strcmp(meth, "RAW")) {
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
- lwsl_notice("client transition to raw\n");
-
- if (pp) {
- const struct lws_protocols *pr;
-
- pr = lws_vhost_name_to_protocol(wsi->vhost, pp);
-
- if (!pr) {
- lwsl_err("protocol %s not enabled on vhost\n",
- pp);
- return NULL;
- }
-
- lws_bind_protocol(wsi, pr);
- }
-
- if ((wsi->protocol->callback)(wsi,
- LWS_CALLBACK_RAW_ADOPT,
- wsi->user_space, NULL, 0))
- return NULL;
-
- lws_header_table_force_to_detachable_state(wsi);
- lws_union_transition(wsi, LWSCM_RAW);
- lws_header_table_detach(wsi, 1);
-
- return NULL;
- }
-
- if (wsi->do_ws) {
- /*
- * create the random key
- */
- n = lws_get_random(context, hash, 16);
- if (n != 16) {
- lwsl_err("Unable to read from random dev %s\n",
- SYSTEM_RANDOM_FILEPATH);
- return NULL;
- }
-
- lws_b64_encode_string(hash, 16, key_b64, sizeof(key_b64));
- }
-
- /*
- * 04 example client handshake
- *
- * GET /chat HTTP/1.1
- * Host: server.example.com
- * Upgrade: websocket
- * Connection: Upgrade
- * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
- * Sec-WebSocket-Origin: http://example.com
- * Sec-WebSocket-Protocol: chat, superchat
- * Sec-WebSocket-Version: 4
- */
-
- p += sprintf(p, "%s %s HTTP/1.1\x0d\x0a", meth,
- lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_URI));
-
- p += sprintf(p, "Pragma: no-cache\x0d\x0a"
- "Cache-Control: no-cache\x0d\x0a");
-
- p += sprintf(p, "Host: %s\x0d\x0a",
- lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_HOST));
-
- if (lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ORIGIN)) {
- if (lws_check_opt(context->options, LWS_SERVER_OPTION_JUST_USE_RAW_ORIGIN))
- p += sprintf(p, "Origin: %s\x0d\x0a",
- lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ORIGIN));
- else
- p += sprintf(p, "Origin: http://%s\x0d\x0a",
- lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ORIGIN));
- }
-
- if (wsi->do_ws) {
- p += sprintf(p, "Upgrade: websocket\x0d\x0a"
- "Connection: Upgrade\x0d\x0a"
- "Sec-WebSocket-Key: ");
- strcpy(p, key_b64);
- p += strlen(key_b64);
- p += sprintf(p, "\x0d\x0a");
- if (lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS))
- p += sprintf(p, "Sec-WebSocket-Protocol: %s\x0d\x0a",
- lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_SENT_PROTOCOLS));
-
- /* tell the server what extensions we could support */
-
-#ifndef LWS_NO_EXTENSIONS
- ext = wsi->vhost->extensions;
- while (ext && ext->callback) {
- n = lws_ext_cb_all_exts(context, wsi,
- LWS_EXT_CB_CHECK_OK_TO_PROPOSE_EXTENSION,
- (char *)ext->name, 0);
- if (n) { /* an extension vetos us */
- lwsl_ext("ext %s vetoed\n", (char *)ext->name);
- ext++;
- continue;
- }
- n = wsi->vhost->protocols[0].callback(wsi,
- LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED,
- wsi->user_space, (char *)ext->name, 0);
-
- /*
- * zero return from callback means
- * go ahead and allow the extension,
- * it's what we get if the callback is
- * unhandled
- */
-
- if (n) {
- ext++;
- continue;
- }
-
- /* apply it */
-
- if (ext_count)
- *p++ = ',';
- else
- p += sprintf(p, "Sec-WebSocket-Extensions: ");
- p += sprintf(p, "%s", ext->client_offer);
- ext_count++;
-
- ext++;
- }
- if (ext_count)
- p += sprintf(p, "\x0d\x0a");
-#endif
-
- if (wsi->ietf_spec_revision)
- p += sprintf(p, "Sec-WebSocket-Version: %d\x0d\x0a",
- wsi->ietf_spec_revision);
-
- /* prepare the expected server accept response */
-
- key_b64[39] = '\0'; /* enforce composed length below buf sizeof */
- n = sprintf(buf, "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11", key_b64);
-
- lws_SHA1((unsigned char *)buf, n, (unsigned char *)hash);
-
- lws_b64_encode_string(hash, 20,
- wsi->u.hdr.ah->initial_handshake_hash_base64,
- sizeof(wsi->u.hdr.ah->initial_handshake_hash_base64));
- }
-
- /* give userland a chance to append, eg, cookies */
-
- if (wsi->protocol->callback(wsi, LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER,
- wsi->user_space, &p, (pkt + context->pt_serv_buf_size) - p - 12))
- return NULL;
-
- p += sprintf(p, "\x0d\x0a");
-
- return p;
-}
-
diff --git a/thirdparty/lws/client/ssl-client.c b/thirdparty/lws/client/ssl-client.c
deleted file mode 100644
index b69fd2da30..0000000000
--- a/thirdparty/lws/client/ssl-client.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-extern int openssl_websocket_private_data_index,
- openssl_SSL_CTX_private_data_index;
-
-extern void
-lws_ssl_bind_passphrase(SSL_CTX *ssl_ctx, struct lws_context_creation_info *info);
-
-extern int lws_ssl_get_error(struct lws *wsi, int n);
-
-#if defined(USE_WOLFSSL)
-#else
-
-static int
-OpenSSL_client_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
-{
-#if defined(LWS_WITH_MBEDTLS)
- lwsl_notice("%s\n", __func__);
-
- return 0;
-#else
- SSL *ssl;
- int n;
- struct lws *wsi;
-
- /* keep old behaviour accepting self-signed server certs */
- if (!preverify_ok) {
- int err = X509_STORE_CTX_get_error(x509_ctx);
-
- if (err != X509_V_OK) {
- ssl = X509_STORE_CTX_get_ex_data(x509_ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
- wsi = SSL_get_ex_data(ssl, openssl_websocket_private_data_index);
-
- if ((err == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT ||
- err == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) &&
- wsi->use_ssl & LCCSCF_ALLOW_SELFSIGNED) {
- lwsl_notice("accepting self-signed certificate (verify_callback)\n");
- X509_STORE_CTX_set_error(x509_ctx, X509_V_OK);
- return 1; // ok
- } else if ((err == X509_V_ERR_CERT_NOT_YET_VALID ||
- err == X509_V_ERR_CERT_HAS_EXPIRED) &&
- wsi->use_ssl & LCCSCF_ALLOW_EXPIRED) {
- if (err == X509_V_ERR_CERT_NOT_YET_VALID)
- lwsl_notice("accepting not yet valid certificate (verify_callback)\n");
- else if (err == X509_V_ERR_CERT_HAS_EXPIRED)
- lwsl_notice("accepting expired certificate (verify_callback)\n");
- X509_STORE_CTX_set_error(x509_ctx, X509_V_OK);
- return 1; // ok
- }
- }
- }
-
- ssl = X509_STORE_CTX_get_ex_data(x509_ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
- wsi = SSL_get_ex_data(ssl, openssl_websocket_private_data_index);
-
- n = lws_get_context_protocol(wsi->context, 0).callback(wsi,
- LWS_CALLBACK_OPENSSL_PERFORM_SERVER_CERT_VERIFICATION,
- x509_ctx, ssl, preverify_ok);
-
- /* keep old behaviour if something wrong with server certs */
- /* if ssl error is overruled in callback and cert is ok,
- * X509_STORE_CTX_set_error(x509_ctx, X509_V_OK); must be set and
- * return value is 0 from callback */
- if (!preverify_ok) {
- int err = X509_STORE_CTX_get_error(x509_ctx);
-
- if (err != X509_V_OK) { /* cert validation error was not handled in callback */
- int depth = X509_STORE_CTX_get_error_depth(x509_ctx);
- const char* msg = X509_verify_cert_error_string(err);
- lwsl_err("SSL error: %s (preverify_ok=%d;err=%d;depth=%d)\n", msg, preverify_ok, err, depth);
- return preverify_ok; // not ok
- }
- }
- /* convert callback return code from 0 = OK to verify callback return value 1 = OK */
- return !n;
-#endif
-}
-#endif
-
-int
-lws_ssl_client_bio_create(struct lws *wsi)
-{
- char hostname[128], *p;
-
- if (lws_hdr_copy(wsi, hostname, sizeof(hostname),
- _WSI_TOKEN_CLIENT_HOST) <= 0) {
- lwsl_err("%s: Unable to get hostname\n", __func__);
-
- return -1;
- }
-
- /*
- * remove any :port part on the hostname... necessary for network
- * connection but typical certificates do not contain it
- */
- p = hostname;
- while (*p) {
- if (*p == ':') {
- *p = '\0';
- break;
- }
- p++;
- }
-
- wsi->ssl = SSL_new(wsi->vhost->ssl_client_ctx);
- if (!wsi->ssl) {
- lwsl_err("SSL_new failed: %s\n",
- ERR_error_string(lws_ssl_get_error(wsi, 0), NULL));
- lws_ssl_elaborate_error();
- return -1;
- }
-
-#if defined (LWS_HAVE_SSL_SET_INFO_CALLBACK)
- if (wsi->vhost->ssl_info_event_mask)
- SSL_set_info_callback(wsi->ssl, lws_ssl_info_callback);
-#endif
-
-#if defined LWS_HAVE_X509_VERIFY_PARAM_set1_host
- X509_VERIFY_PARAM *param;
- (void)param;
-
- if (!(wsi->use_ssl & LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK)) {
- param = SSL_get0_param(wsi->ssl);
- /* Enable automatic hostname checks */
- X509_VERIFY_PARAM_set_hostflags(param,
- X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
- X509_VERIFY_PARAM_set1_host(param, hostname, 0);
- }
-
-#endif
-
-#if !defined(USE_WOLFSSL) && !defined(LWS_WITH_MBEDTLS)
-#ifndef USE_OLD_CYASSL
- /* OpenSSL_client_verify_callback will be called @ SSL_connect() */
- SSL_set_verify(wsi->ssl, SSL_VERIFY_PEER, OpenSSL_client_verify_callback);
-#endif
-#endif
-
-#if !defined(USE_WOLFSSL) && !defined(LWS_WITH_MBEDTLS)
- SSL_set_mode(wsi->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
-#endif
- /*
- * use server name indication (SNI), if supported,
- * when establishing connection
- */
-#ifdef USE_WOLFSSL
-#ifdef USE_OLD_CYASSL
-#ifdef CYASSL_SNI_HOST_NAME
- CyaSSL_UseSNI(wsi->ssl, CYASSL_SNI_HOST_NAME, hostname, strlen(hostname));
-#endif
-#else
-#ifdef WOLFSSL_SNI_HOST_NAME
- wolfSSL_UseSNI(wsi->ssl, WOLFSSL_SNI_HOST_NAME, hostname, strlen(hostname));
-#endif
-#endif
-#else
-#if defined(LWS_WITH_MBEDTLS)
- if (wsi->vhost->x509_client_CA)
- SSL_set_verify(wsi->ssl, SSL_VERIFY_PEER, OpenSSL_client_verify_callback);
- else
- SSL_set_verify(wsi->ssl, SSL_VERIFY_NONE, OpenSSL_client_verify_callback);
-
-#else
-#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
- SSL_set_tlsext_host_name(wsi->ssl, hostname);
-#endif
-#endif
-#endif
-
-#ifdef USE_WOLFSSL
- /*
- * wolfSSL/CyaSSL does certificate verification differently
- * from OpenSSL.
- * If we should ignore the certificate, we need to set
- * this before SSL_new and SSL_connect is called.
- * Otherwise the connect will simply fail with error code -155
- */
-#ifdef USE_OLD_CYASSL
- if (wsi->use_ssl == 2)
- CyaSSL_set_verify(wsi->ssl, SSL_VERIFY_NONE, NULL);
-#else
- if (wsi->use_ssl == 2)
- wolfSSL_set_verify(wsi->ssl, SSL_VERIFY_NONE, NULL);
-#endif
-#endif /* USE_WOLFSSL */
-
-#if !defined(LWS_WITH_MBEDTLS)
- wsi->client_bio = BIO_new_socket(wsi->desc.sockfd, BIO_NOCLOSE);
- SSL_set_bio(wsi->ssl, wsi->client_bio, wsi->client_bio);
-#else
- SSL_set_fd(wsi->ssl, wsi->desc.sockfd);
-#endif
-
-#ifdef USE_WOLFSSL
-#ifdef USE_OLD_CYASSL
- CyaSSL_set_using_nonblock(wsi->ssl, 1);
-#else
- wolfSSL_set_using_nonblock(wsi->ssl, 1);
-#endif
-#else
-#if !defined(LWS_WITH_MBEDTLS)
- BIO_set_nbio(wsi->client_bio, 1); /* nonblocking */
-#endif
-#endif
-
-#if !defined(LWS_WITH_MBEDTLS)
- SSL_set_ex_data(wsi->ssl, openssl_websocket_private_data_index,
- wsi);
-#endif
-
- return 0;
-}
-
-#if defined(LWS_WITH_MBEDTLS)
-int ERR_get_error(void)
-{
- return 0;
-}
-#endif
-
-int
-lws_ssl_client_connect1(struct lws *wsi)
-{
- struct lws_context *context = wsi->context;
- int n = 0;
-
- lws_latency_pre(context, wsi);
-
- n = SSL_connect(wsi->ssl);
-
- lws_latency(context, wsi,
- "SSL_connect LWSCM_WSCL_ISSUE_HANDSHAKE", n, n > 0);
-
- if (n < 0) {
- n = lws_ssl_get_error(wsi, n);
-
- if (n == SSL_ERROR_WANT_READ)
- goto some_wait;
-
- if (n == SSL_ERROR_WANT_WRITE) {
- /*
- * wants us to retry connect due to
- * state of the underlying ssl layer...
- * but since it may be stalled on
- * blocked write, no incoming data may
- * arrive to trigger the retry.
- * Force (possibly many times if the SSL
- * state persists in returning the
- * condition code, but other sockets
- * are getting serviced inbetweentimes)
- * us to get called back when writable.
- */
- lwsl_info("%s: WANT_WRITE... retrying\n", __func__);
- lws_callback_on_writable(wsi);
-some_wait:
- wsi->mode = LWSCM_WSCL_WAITING_SSL;
-
- return 0; /* no error */
- }
-
- {
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- char *p = (char *)&pt->serv_buf[0];
- char *sb = p;
-
- lwsl_err("ssl hs1 error, X509_V_ERR = %d: %s\n",
- n, ERR_error_string(n, sb));
- lws_ssl_elaborate_error();
- }
-
- n = -1;
- }
-
- if (n <= 0) {
- /*
- * retry if new data comes until we
- * run into the connection timeout or win
- */
-
- unsigned long error = ERR_get_error();
-
- if (error != SSL_ERROR_NONE) {
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- char *p = (char *)&pt->serv_buf[0];
- char *sb = p;
- lwsl_err("SSL connect error %lu: %s\n",
- error, ERR_error_string(error, sb));
- return -1;
- }
-
- return 0;
- }
-
- return 1;
-}
-
-int
-lws_ssl_client_connect2(struct lws *wsi)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- char *p = (char *)&pt->serv_buf[0];
- char *sb = p;
- int n = 0;
-
- if (wsi->mode == LWSCM_WSCL_WAITING_SSL) {
- lws_latency_pre(context, wsi);
- n = SSL_connect(wsi->ssl);
- lwsl_debug("%s: SSL_connect says %d\n", __func__, n);
-
- lws_latency(context, wsi,
- "SSL_connect LWSCM_WSCL_WAITING_SSL", n, n > 0);
-
- if (n < 0) {
- n = lws_ssl_get_error(wsi, n);
-
- if (n == SSL_ERROR_WANT_READ) {
- lwsl_info("SSL_connect WANT_READ... retrying\n");
-
- wsi->mode = LWSCM_WSCL_WAITING_SSL;
-
- return 0; /* no error */
- }
-
- if (n == SSL_ERROR_WANT_WRITE) {
- /*
- * wants us to retry connect due to
- * state of the underlying ssl layer...
- * but since it may be stalled on
- * blocked write, no incoming data may
- * arrive to trigger the retry.
- * Force (possibly many times if the SSL
- * state persists in returning the
- * condition code, but other sockets
- * are getting serviced inbetweentimes)
- * us to get called back when writable.
- */
- lwsl_info("SSL_connect WANT_WRITE... retrying\n");
- lws_callback_on_writable(wsi);
-
- wsi->mode = LWSCM_WSCL_WAITING_SSL;
-
- return 0; /* no error */
- }
-
- n = -1;
- }
-
- if (n <= 0) {
- /*
- * retry if new data comes until we
- * run into the connection timeout or win
- */
- unsigned long error = ERR_get_error();
- if (error != SSL_ERROR_NONE) {
- lwsl_err("SSL connect error %lu: %s\n",
- error, ERR_error_string(error, sb));
- return -1;
- }
- }
- }
-
-#if defined(LWS_WITH_MBEDTLS)
- {
- X509 *peer = SSL_get_peer_certificate(wsi->ssl);
-
- if (!peer) {
- lwsl_notice("peer did not provide cert\n");
-
- return -1;
- }
- lwsl_notice("peer provided cert\n");
- }
-#endif
-
-#ifndef USE_WOLFSSL
- /*
- * See comment above about wolfSSL certificate
- * verification
- */
- lws_latency_pre(context, wsi);
- n = SSL_get_verify_result(wsi->ssl);
- lws_latency(context, wsi,
- "SSL_get_verify_result LWS_CONNMODE..HANDSHAKE", n, n > 0);
-
- lwsl_debug("get_verify says %d\n", n);
-
- if (n != X509_V_OK) {
- if ((n == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT ||
- n == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) &&
- (wsi->use_ssl & LCCSCF_ALLOW_SELFSIGNED)) {
- lwsl_notice("accepting self-signed certificate\n");
- } else if ((n == X509_V_ERR_CERT_NOT_YET_VALID ||
- n == X509_V_ERR_CERT_HAS_EXPIRED) &&
- (wsi->use_ssl & LCCSCF_ALLOW_EXPIRED)) {
- lwsl_notice("accepting expired certificate\n");
- } else if (n == X509_V_ERR_CERT_NOT_YET_VALID) {
- lwsl_notice("Cert is from the future... "
- "probably our clock... accepting...\n");
- } else {
- lwsl_err("server's cert didn't look good, X509_V_ERR = %d: %s\n",
- n, ERR_error_string(n, sb));
- lws_ssl_elaborate_error();
- return -1;
- }
- }
-
-#endif /* USE_WOLFSSL */
-
- return 1;
-}
-
-
-int lws_context_init_client_ssl(struct lws_context_creation_info *info,
- struct lws_vhost *vhost)
-{
- SSL_METHOD *method = NULL;
- struct lws wsi;
- unsigned long error;
- const char *ca_filepath = info->ssl_ca_filepath;
-#if !defined(LWS_WITH_MBEDTLS)
- const char *cipher_list = info->ssl_cipher_list;
- const char *private_key_filepath = info->ssl_private_key_filepath;
- const char *cert_filepath = info->ssl_cert_filepath;
- int n;
-
- if (vhost->options & LWS_SERVER_OPTION_ONLY_RAW)
- return 0;
-
- /*
- * for backwards-compatibility default to using ssl_... members, but
- * if the newer client-specific ones are given, use those
- */
- if (info->client_ssl_cipher_list)
- cipher_list = info->client_ssl_cipher_list;
- if (info->client_ssl_cert_filepath)
- cert_filepath = info->client_ssl_cert_filepath;
- if (info->client_ssl_private_key_filepath)
- private_key_filepath = info->client_ssl_private_key_filepath;
-#endif
- if (info->client_ssl_ca_filepath)
- ca_filepath = info->client_ssl_ca_filepath;
-
- if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
- return 0;
-
- if (vhost->ssl_client_ctx)
- return 0;
-
- if (info->provided_client_ssl_ctx) {
- /* use the provided OpenSSL context if given one */
- vhost->ssl_client_ctx = info->provided_client_ssl_ctx;
- /* nothing for lib to delete */
- vhost->user_supplied_ssl_ctx = 1;
-
- return 0;
- }
-
- /* basic openssl init already happened in context init */
-
- /* choose the most recent spin of the api */
-#if defined(LWS_HAVE_TLS_CLIENT_METHOD)
- method = (SSL_METHOD *)TLS_client_method();
-#elif defined(LWS_HAVE_TLSV1_2_CLIENT_METHOD)
- method = (SSL_METHOD *)TLSv1_2_client_method();
-#else
- method = (SSL_METHOD *)SSLv23_client_method();
-#endif
- if (!method) {
- error = ERR_get_error();
- lwsl_err("problem creating ssl method %lu: %s\n",
- error, ERR_error_string(error,
- (char *)vhost->context->pt[0].serv_buf));
- return 1;
- }
- /* create context */
- vhost->ssl_client_ctx = SSL_CTX_new(method);
- if (!vhost->ssl_client_ctx) {
- error = ERR_get_error();
- lwsl_err("problem creating ssl context %lu: %s\n",
- error, ERR_error_string(error,
- (char *)vhost->context->pt[0].serv_buf));
- return 1;
- }
-
- lwsl_notice("created client ssl context for %s\n", vhost->name);
-
-#ifdef SSL_OP_NO_COMPRESSION
- SSL_CTX_set_options(vhost->ssl_client_ctx, SSL_OP_NO_COMPRESSION);
-#endif
-
-#if defined(LWS_WITH_MBEDTLS)
- if (ca_filepath) {
- lws_filepos_t len;
- uint8_t *buf;
- /*
- * prototype this here, the shim does not export it in the
- * header, and we need to use the shim unchanged for ESP32 case
- */
- X509 *d2i_X509(X509 **cert, const unsigned char *buffer, long len);
-
- if (alloc_file(vhost->context, ca_filepath, &buf, &len)) {
- lwsl_err("Load CA cert file %s failed\n", ca_filepath);
- return 1;
- }
-
- vhost->x509_client_CA = d2i_X509(NULL, buf, len);
- free(buf);
- if (!vhost->x509_client_CA) {
- lwsl_err("client CA: x509 parse failed\n");
- return 1;
- }
-
- SSL_CTX_add_client_CA(vhost->ssl_client_ctx,
- vhost->x509_client_CA);
-
- lwsl_notice("client loaded CA for verification %s\n", ca_filepath);
- }
-#else
- SSL_CTX_set_options(vhost->ssl_client_ctx,
- SSL_OP_CIPHER_SERVER_PREFERENCE);
-
- if (cipher_list)
- SSL_CTX_set_cipher_list(vhost->ssl_client_ctx, cipher_list);
-
-#ifdef LWS_SSL_CLIENT_USE_OS_CA_CERTS
- if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DISABLE_OS_CA_CERTS))
- /* loads OS default CA certs */
- SSL_CTX_set_default_verify_paths(vhost->ssl_client_ctx);
-#endif
-
- /* openssl init for cert verification (for client sockets) */
- if (!ca_filepath) {
- if (!SSL_CTX_load_verify_locations(
- vhost->ssl_client_ctx, NULL, LWS_OPENSSL_CLIENT_CERTS))
- lwsl_err("Unable to load SSL Client certs from %s "
- "(set by LWS_OPENSSL_CLIENT_CERTS) -- "
- "client ssl isn't going to work\n",
- LWS_OPENSSL_CLIENT_CERTS);
- } else
- if (!SSL_CTX_load_verify_locations(
- vhost->ssl_client_ctx, ca_filepath, NULL)) {
- lwsl_err(
- "Unable to load SSL Client certs "
- "file from %s -- client ssl isn't "
- "going to work\n", info->client_ssl_ca_filepath);
- lws_ssl_elaborate_error();
- }
- else
- lwsl_info("loaded ssl_ca_filepath\n");
-
- /*
- * callback allowing user code to load extra verification certs
- * helping the client to verify server identity
- */
-
- /* support for client-side certificate authentication */
- if (cert_filepath) {
- lwsl_notice("%s: doing cert filepath\n", __func__);
- n = SSL_CTX_use_certificate_chain_file(vhost->ssl_client_ctx,
- cert_filepath);
- if (n < 1) {
- lwsl_err("problem %d getting cert '%s'\n", n,
- cert_filepath);
- lws_ssl_elaborate_error();
- return 1;
- }
- lwsl_notice("Loaded client cert %s\n", cert_filepath);
- }
- if (private_key_filepath) {
- lwsl_notice("%s: doing private key filepath\n", __func__);
- lws_ssl_bind_passphrase(vhost->ssl_client_ctx, info);
- /* set the private key from KeyFile */
- if (SSL_CTX_use_PrivateKey_file(vhost->ssl_client_ctx,
- private_key_filepath, SSL_FILETYPE_PEM) != 1) {
- lwsl_err("use_PrivateKey_file '%s'\n",
- private_key_filepath);
- lws_ssl_elaborate_error();
- return 1;
- }
- lwsl_notice("Loaded client cert private key %s\n",
- private_key_filepath);
-
- /* verify private key */
- if (!SSL_CTX_check_private_key(vhost->ssl_client_ctx)) {
- lwsl_err("Private SSL key doesn't match cert\n");
- return 1;
- }
- }
-#endif
- /*
- * give him a fake wsi with context set, so he can use
- * lws_get_context() in the callback
- */
- memset(&wsi, 0, sizeof(wsi));
- wsi.vhost = vhost;
- wsi.context = vhost->context;
-
- vhost->protocols[0].callback(&wsi,
- LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS,
- vhost->ssl_client_ctx, NULL, 0);
-
- return 0;
-}
diff --git a/thirdparty/lws/ext/extension-permessage-deflate.c b/thirdparty/lws/ext/extension-permessage-deflate.c
deleted file mode 100644
index e2be2ae615..0000000000
--- a/thirdparty/lws/ext/extension-permessage-deflate.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * ./lib/extension-permessage-deflate.c
- *
- * Copyright (C) 2016 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-#include "extension-permessage-deflate.h"
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#define LWS_ZLIB_MEMLEVEL 8
-
-const struct lws_ext_options lws_ext_pm_deflate_options[] = {
- /* public RFC7692 settings */
- { "server_no_context_takeover", EXTARG_NONE },
- { "client_no_context_takeover", EXTARG_NONE },
- { "server_max_window_bits", EXTARG_OPT_DEC },
- { "client_max_window_bits", EXTARG_OPT_DEC },
- /* ones only user code can set */
- { "rx_buf_size", EXTARG_DEC },
- { "tx_buf_size", EXTARG_DEC },
- { "compression_level", EXTARG_DEC },
- { "mem_level", EXTARG_DEC },
- { NULL, 0 }, /* sentinel */
-};
-
-static void
-lws_extension_pmdeflate_restrict_args(struct lws *wsi,
- struct lws_ext_pm_deflate_priv *priv)
-{
- int n, extra;
-
- /* cap the RX buf at the nearest power of 2 to protocol rx buf */
-
- n = wsi->context->pt_serv_buf_size;
- if (wsi->protocol->rx_buffer_size)
- n = wsi->protocol->rx_buffer_size;
-
- extra = 7;
- while (n >= 1 << (extra + 1))
- extra++;
-
- if (extra < priv->args[PMD_RX_BUF_PWR2]) {
- priv->args[PMD_RX_BUF_PWR2] = extra;
- lwsl_info(" Capping pmd rx to %d\n", 1 << extra);
- }
-}
-
-LWS_VISIBLE int
-lws_extension_callback_pm_deflate(struct lws_context *context,
- const struct lws_extension *ext,
- struct lws *wsi,
- enum lws_extension_callback_reasons reason,
- void *user, void *in, size_t len)
-{
- struct lws_ext_pm_deflate_priv *priv =
- (struct lws_ext_pm_deflate_priv *)user;
- struct lws_tokens *eff_buf = (struct lws_tokens *)in;
- static unsigned char trail[] = { 0, 0, 0xff, 0xff };
- int n, ret = 0, was_fin = 0, extra;
- struct lws_ext_option_arg *oa;
-
- switch (reason) {
- case LWS_EXT_CB_NAMED_OPTION_SET:
- oa = in;
- if (!oa->option_name)
- break;
- for (n = 0; n < ARRAY_SIZE(lws_ext_pm_deflate_options); n++)
- if (!strcmp(lws_ext_pm_deflate_options[n].name, oa->option_name))
- break;
-
- if (n == ARRAY_SIZE(lws_ext_pm_deflate_options))
- break;
- oa->option_index = n;
-
- /* fallthru */
-
- case LWS_EXT_CB_OPTION_SET:
- oa = in;
- lwsl_notice("%s: option set: idx %d, %s, len %d\n", __func__,
- oa->option_index, oa->start, oa->len);
- if (oa->start)
- priv->args[oa->option_index] = atoi(oa->start);
- else
- priv->args[oa->option_index] = 1;
-
- if (priv->args[PMD_CLIENT_MAX_WINDOW_BITS] == 8)
- priv->args[PMD_CLIENT_MAX_WINDOW_BITS] = 9;
-
- lws_extension_pmdeflate_restrict_args(wsi, priv);
- break;
-
- case LWS_EXT_CB_OPTION_CONFIRM:
- if (priv->args[PMD_SERVER_MAX_WINDOW_BITS] < 8 ||
- priv->args[PMD_SERVER_MAX_WINDOW_BITS] > 15 ||
- priv->args[PMD_CLIENT_MAX_WINDOW_BITS] < 8 ||
- priv->args[PMD_CLIENT_MAX_WINDOW_BITS] > 15)
- return -1;
- break;
-
- case LWS_EXT_CB_CLIENT_CONSTRUCT:
- case LWS_EXT_CB_CONSTRUCT:
-
- n = context->pt_serv_buf_size;
- if (wsi->protocol->rx_buffer_size)
- n = wsi->protocol->rx_buffer_size;
-
- if (n < 128) {
- lwsl_info(" permessage-deflate requires the protocol (%s) to have an RX buffer >= 128\n",
- wsi->protocol->name);
- return -1;
- }
-
- /* fill in **user */
- priv = lws_zalloc(sizeof(*priv), "pmd priv");
- *((void **)user) = priv;
- lwsl_ext("%s: LWS_EXT_CB_*CONSTRUCT\n", __func__);
- memset(priv, 0, sizeof(*priv));
-
- /* fill in pointer to options list */
- if (in)
- *((const struct lws_ext_options **)in) =
- lws_ext_pm_deflate_options;
-
- /* fallthru */
-
- case LWS_EXT_CB_OPTION_DEFAULT:
-
- /* set the public, RFC7692 defaults... */
-
- priv->args[PMD_SERVER_NO_CONTEXT_TAKEOVER] = 0,
- priv->args[PMD_CLIENT_NO_CONTEXT_TAKEOVER] = 0;
- priv->args[PMD_SERVER_MAX_WINDOW_BITS] = 15;
- priv->args[PMD_CLIENT_MAX_WINDOW_BITS] = 15;
-
- /* ...and the ones the user code can override */
-
- priv->args[PMD_RX_BUF_PWR2] = 10; /* ie, 1024 */
- priv->args[PMD_TX_BUF_PWR2] = 10; /* ie, 1024 */
- priv->args[PMD_COMP_LEVEL] = 1;
- priv->args[PMD_MEM_LEVEL] = 8;
-
- lws_extension_pmdeflate_restrict_args(wsi, priv);
- break;
-
- case LWS_EXT_CB_DESTROY:
- lwsl_ext("%s: LWS_EXT_CB_DESTROY\n", __func__);
- lws_free(priv->buf_rx_inflated);
- lws_free(priv->buf_tx_deflated);
- if (priv->rx_init)
- (void)inflateEnd(&priv->rx);
- if (priv->tx_init)
- (void)deflateEnd(&priv->tx);
- lws_free(priv);
- return ret;
-
- case LWS_EXT_CB_PAYLOAD_RX:
- lwsl_ext(" %s: LWS_EXT_CB_PAYLOAD_RX: in %d, existing in %d\n",
- __func__, eff_buf->token_len, priv->rx.avail_in);
- if (!(wsi->u.ws.rsv_first_msg & 0x40))
- return 0;
-
-#if 0
- for (n = 0; n < eff_buf->token_len; n++) {
- printf("%02X ", (unsigned char)eff_buf->token[n]);
- if ((n & 15) == 15)
- printf("\n");
- }
- printf("\n");
-#endif
- if (!priv->rx_init)
- if (inflateInit2(&priv->rx, -priv->args[PMD_SERVER_MAX_WINDOW_BITS]) != Z_OK) {
- lwsl_err("%s: iniflateInit failed\n", __func__);
- return -1;
- }
- priv->rx_init = 1;
- if (!priv->buf_rx_inflated)
- priv->buf_rx_inflated = lws_malloc(LWS_PRE + 7 + 5 +
- (1 << priv->args[PMD_RX_BUF_PWR2]), "pmd rx inflate buf");
- if (!priv->buf_rx_inflated) {
- lwsl_err("%s: OOM\n", __func__);
- return -1;
- }
-
- /*
- * We have to leave the input stream alone if we didn't
- * finish with it yet. The input stream is held in the wsi
- * rx buffer by the caller, so this assumption is safe while
- * we block new rx while draining the existing rx
- */
- if (!priv->rx.avail_in && eff_buf->token && eff_buf->token_len) {
- priv->rx.next_in = (unsigned char *)eff_buf->token;
- priv->rx.avail_in = eff_buf->token_len;
- }
- priv->rx.next_out = priv->buf_rx_inflated + LWS_PRE;
- eff_buf->token = (char *)priv->rx.next_out;
- priv->rx.avail_out = 1 << priv->args[PMD_RX_BUF_PWR2];
-
- if (priv->rx_held_valid) {
- lwsl_ext("-- RX piling on held byte --\n");
- *(priv->rx.next_out++) = priv->rx_held;
- priv->rx.avail_out--;
- priv->rx_held_valid = 0;
- }
-
- /* if...
- *
- * - he has no remaining input content for this message, and
- * - and this is the final fragment, and
- * - we used everything that could be drained on the input side
- *
- * ...then put back the 00 00 FF FF the sender stripped as our
- * input to zlib
- */
- if (!priv->rx.avail_in && wsi->u.ws.final &&
- !wsi->u.ws.rx_packet_length) {
- lwsl_ext("RX APPEND_TRAILER-DO\n");
- was_fin = 1;
- priv->rx.next_in = trail;
- priv->rx.avail_in = sizeof(trail);
- }
-
- n = inflate(&priv->rx, Z_NO_FLUSH);
- lwsl_ext("inflate ret %d, avi %d, avo %d, wsifinal %d\n", n,
- priv->rx.avail_in, priv->rx.avail_out, wsi->u.ws.final);
- switch (n) {
- case Z_NEED_DICT:
- case Z_STREAM_ERROR:
- case Z_DATA_ERROR:
- case Z_MEM_ERROR:
- lwsl_info("zlib error inflate %d: %s\n",
- n, priv->rx.msg);
- return -1;
- }
- /*
- * If we did not already send in the 00 00 FF FF, and he's
- * out of input, he did not EXACTLY fill the output buffer
- * (which is ambiguous and we will force it to go around
- * again by withholding a byte), and he's otherwise working on
- * being a FIN fragment, then do the FIN message processing
- * of faking up the 00 00 FF FF that the sender stripped.
- */
- if (!priv->rx.avail_in && wsi->u.ws.final &&
- !wsi->u.ws.rx_packet_length && !was_fin &&
- priv->rx.avail_out /* ambiguous as to if it is the end */
- ) {
- lwsl_ext("RX APPEND_TRAILER-DO\n");
- was_fin = 1;
- priv->rx.next_in = trail;
- priv->rx.avail_in = sizeof(trail);
- n = inflate(&priv->rx, Z_SYNC_FLUSH);
- lwsl_ext("RX trailer inf returned %d, avi %d, avo %d\n", n,
- priv->rx.avail_in, priv->rx.avail_out);
- switch (n) {
- case Z_NEED_DICT:
- case Z_STREAM_ERROR:
- case Z_DATA_ERROR:
- case Z_MEM_ERROR:
- lwsl_info("zlib error inflate %d: %s\n",
- n, priv->rx.msg);
- return -1;
- }
- }
- /*
- * we must announce in our returncode now if there is more
- * output to be expected from inflate, so we can decide to
- * set the FIN bit on this bufferload or not. However zlib
- * is ambiguous when we exactly filled the inflate buffer. It
- * does not give us a clue as to whether we should understand
- * that to mean he ended on a buffer boundary, or if there is
- * more in the pipeline.
- *
- * So to work around that safely, if it used all output space
- * exactly, we ALWAYS say there is more coming and we withhold
- * the last byte of the buffer to guarantee that is true.
- *
- * That still leaves us at least one byte to finish with a FIN
- * on, even if actually nothing more is coming from the next
- * inflate action itself.
- */
- if (!priv->rx.avail_out) { /* he used all available out buf */
- lwsl_ext("-- rx grabbing held --\n");
- /* snip the last byte and hold it for next time */
- priv->rx_held = *(--priv->rx.next_out);
- priv->rx_held_valid = 1;
- }
-
- eff_buf->token_len = (char *)priv->rx.next_out - eff_buf->token;
- priv->count_rx_between_fin += eff_buf->token_len;
-
- lwsl_ext(" %s: RX leaving with new effbuff len %d, "
- "ret %d, rx.avail_in=%d, TOTAL RX since FIN %lu\n",
- __func__, eff_buf->token_len, priv->rx_held_valid,
- priv->rx.avail_in,
- (unsigned long)priv->count_rx_between_fin);
-
- if (was_fin) {
- priv->count_rx_between_fin = 0;
- if (priv->args[PMD_SERVER_NO_CONTEXT_TAKEOVER]) {
- (void)inflateEnd(&priv->rx);
- priv->rx_init = 0;
- }
- }
-#if 0
- for (n = 0; n < eff_buf->token_len; n++)
- putchar(eff_buf->token[n]);
- puts("\n");
-#endif
-
- return priv->rx_held_valid;
-
- case LWS_EXT_CB_PAYLOAD_TX:
-
- if (!priv->tx_init) {
- n = deflateInit2(&priv->tx, priv->args[PMD_COMP_LEVEL],
- Z_DEFLATED,
- -priv->args[PMD_SERVER_MAX_WINDOW_BITS +
- (wsi->vhost->listen_port <= 0)],
- priv->args[PMD_MEM_LEVEL],
- Z_DEFAULT_STRATEGY);
- if (n != Z_OK) {
- lwsl_ext("inflateInit2 failed %d\n", n);
- return 1;
- }
- }
- priv->tx_init = 1;
- if (!priv->buf_tx_deflated)
- priv->buf_tx_deflated = lws_malloc(LWS_PRE + 7 + 5 +
- (1 << priv->args[PMD_TX_BUF_PWR2]), "pmd tx deflate buf");
- if (!priv->buf_tx_deflated) {
- lwsl_err("%s: OOM\n", __func__);
- return -1;
- }
-
- if (eff_buf->token) {
- lwsl_ext("%s: TX: eff_buf length %d\n", __func__,
- eff_buf->token_len);
- priv->tx.next_in = (unsigned char *)eff_buf->token;
- priv->tx.avail_in = eff_buf->token_len;
- }
-
-#if 0
- for (n = 0; n < eff_buf->token_len; n++) {
- printf("%02X ", (unsigned char)eff_buf->token[n]);
- if ((n & 15) == 15)
- printf("\n");
- }
- printf("\n");
-#endif
-
- priv->tx.next_out = priv->buf_tx_deflated + LWS_PRE + 5;
- eff_buf->token = (char *)priv->tx.next_out;
- priv->tx.avail_out = 1 << priv->args[PMD_TX_BUF_PWR2];
-
- n = deflate(&priv->tx, Z_SYNC_FLUSH);
- if (n == Z_STREAM_ERROR) {
- lwsl_ext("%s: Z_STREAM_ERROR\n", __func__);
- return -1;
- }
-
- if (priv->tx_held_valid) {
- priv->tx_held_valid = 0;
- if (priv->tx.avail_out == 1 << priv->args[PMD_TX_BUF_PWR2])
- /*
- * we can get a situation he took something in
- * but did not generate anything out, at the end
- * of a message (eg, next thing he sends is 80
- * 00, a zero length FIN, like Authobahn can
- * send).
- * If we have come back as a FIN, we must not
- * place the pending trailer 00 00 FF FF, just
- * the 1 byte of live data
- */
- *(--eff_buf->token) = priv->tx_held[0];
- else {
- /* he generated data, prepend whole pending */
- eff_buf->token -= 5;
- for (n = 0; n < 5; n++)
- eff_buf->token[n] = priv->tx_held[n];
-
- }
- }
- priv->compressed_out = 1;
- eff_buf->token_len = (int)(priv->tx.next_out -
- (unsigned char *)eff_buf->token);
-
- /*
- * we must announce in our returncode now if there is more
- * output to be expected from inflate, so we can decide to
- * set the FIN bit on this bufferload or not. However zlib
- * is ambiguous when we exactly filled the inflate buffer. It
- * does not give us a clue as to whether we should understand
- * that to mean he ended on a buffer boundary, or if there is
- * more in the pipeline.
- *
- * Worse, the guy providing the stuff we are sending may not
- * know until after that this was, actually, the last chunk,
- * that can happen even if we did not fill the output buf, ie
- * he may send after this a zero-length FIN fragment.
- *
- * This is super difficult because we must snip the last 4
- * bytes in the case this is the last compressed output of the
- * message. The only way to deal with it is defer sending the
- * last 5 bytes of each frame until the next one, when we will
- * be in a position to understand if that has a FIN or not.
- */
-
- extra = !!(len & LWS_WRITE_NO_FIN) || !priv->tx.avail_out;
-
- if (eff_buf->token_len >= 4 + extra) {
- lwsl_ext("tx held %d\n", 4 + extra);
- priv->tx_held_valid = extra;
- for (n = 3 + extra; n >= 0; n--)
- priv->tx_held[n] = *(--priv->tx.next_out);
- eff_buf->token_len -= 4 + extra;
- }
- lwsl_ext(" TX rewritten with new effbuff len %d, ret %d\n",
- eff_buf->token_len, !priv->tx.avail_out);
-
- return !priv->tx.avail_out; /* 1 == have more tx pending */
-
- case LWS_EXT_CB_PACKET_TX_PRESEND:
- if (!priv->compressed_out)
- break;
- priv->compressed_out = 0;
-
- if ((*(eff_buf->token) & 0x80) &&
- priv->args[PMD_CLIENT_NO_CONTEXT_TAKEOVER]) {
- lwsl_debug("PMD_CLIENT_NO_CONTEXT_TAKEOVER\n");
- (void)deflateEnd(&priv->tx);
- priv->tx_init = 0;
- }
-
- n = *(eff_buf->token) & 15;
- /* set RSV1, but not on CONTINUATION */
- if (n == LWSWSOPC_TEXT_FRAME || n == LWSWSOPC_BINARY_FRAME)
- *eff_buf->token |= 0x40;
-#if 0
- for (n = 0; n < eff_buf->token_len; n++) {
- printf("%02X ", (unsigned char)eff_buf->token[n]);
- if ((n & 15) == 15)
- puts("\n");
- }
- puts("\n");
-#endif
- lwsl_ext("%s: tx opcode 0x%02X\n", __func__,
- (unsigned char)*eff_buf->token);
- break;
-
- default:
- break;
- }
-
- return 0;
-}
-
diff --git a/thirdparty/lws/ext/extension-permessage-deflate.h b/thirdparty/lws/ext/extension-permessage-deflate.h
deleted file mode 100644
index 8737736897..0000000000
--- a/thirdparty/lws/ext/extension-permessage-deflate.h
+++ /dev/null
@@ -1,41 +0,0 @@
-
-#include <zlib.h>
-
-#define DEFLATE_FRAME_COMPRESSION_LEVEL_SERVER 1
-#define DEFLATE_FRAME_COMPRESSION_LEVEL_CLIENT Z_DEFAULT_COMPRESSION
-
-enum arg_indexes {
- PMD_SERVER_NO_CONTEXT_TAKEOVER,
- PMD_CLIENT_NO_CONTEXT_TAKEOVER,
- PMD_SERVER_MAX_WINDOW_BITS,
- PMD_CLIENT_MAX_WINDOW_BITS,
- PMD_RX_BUF_PWR2,
- PMD_TX_BUF_PWR2,
- PMD_COMP_LEVEL,
- PMD_MEM_LEVEL,
-
- PMD_ARG_COUNT
-};
-
-struct lws_ext_pm_deflate_priv {
- z_stream rx;
- z_stream tx;
-
- unsigned char *buf_rx_inflated; /* RX inflated output buffer */
- unsigned char *buf_tx_deflated; /* TX deflated output buffer */
-
- size_t count_rx_between_fin;
-
- unsigned char args[PMD_ARG_COUNT];
- unsigned char tx_held[5];
- unsigned char rx_held;
-
- unsigned char tx_init:1;
- unsigned char rx_init:1;
- unsigned char compressed_out:1;
- unsigned char rx_held_valid:1;
- unsigned char tx_held_valid:1;
- unsigned char rx_append_trailer:1;
- unsigned char pending_tx_trailer:1;
-};
-
diff --git a/thirdparty/lws/ext/extension.c b/thirdparty/lws/ext/extension.c
deleted file mode 100644
index ac28204034..0000000000
--- a/thirdparty/lws/ext/extension.c
+++ /dev/null
@@ -1,344 +0,0 @@
-#include "private-libwebsockets.h"
-
-#include "extension-permessage-deflate.h"
-
-LWS_VISIBLE void
-lws_context_init_extensions(struct lws_context_creation_info *info,
- struct lws_context *context)
-{
- lwsl_info(" LWS_MAX_EXTENSIONS_ACTIVE: %u\n", LWS_MAX_EXTENSIONS_ACTIVE);
-}
-
-enum lws_ext_option_parser_states {
- LEAPS_SEEK_NAME,
- LEAPS_EAT_NAME,
- LEAPS_SEEK_VAL,
- LEAPS_EAT_DEC,
- LEAPS_SEEK_ARG_TERM
-};
-
-LWS_VISIBLE int
-lws_ext_parse_options(const struct lws_extension *ext, struct lws *wsi,
- void *ext_user, const struct lws_ext_options *opts,
- const char *in, int len)
-{
- enum lws_ext_option_parser_states leap = LEAPS_SEEK_NAME;
- unsigned int match_map = 0, n, m, w = 0, count_options = 0,
- pending_close_quote = 0;
- struct lws_ext_option_arg oa;
-
- oa.option_name = NULL;
-
- while (opts[count_options].name)
- count_options++;
- while (len) {
- lwsl_ext("'%c' %d", *in, leap);
- switch (leap) {
- case LEAPS_SEEK_NAME:
- if (*in == ' ')
- break;
- if (*in == ',') {
- len = 1;
- break;
- }
- match_map = (1 << count_options) - 1;
- leap = LEAPS_EAT_NAME;
- w = 0;
-
- /* fallthru */
-
- case LEAPS_EAT_NAME:
- oa.start = NULL;
- oa.len = 0;
- m = match_map;
- n = 0;
- pending_close_quote = 0;
- while (m) {
- if (m & 1) {
- lwsl_ext(" m=%d, n=%d, w=%d\n", m, n, w);
-
- if (*in == opts[n].name[w]) {
- if (!opts[n].name[w + 1]) {
- oa.option_index = n;
- lwsl_ext("hit %d\n", oa.option_index);
- leap = LEAPS_SEEK_VAL;
- if (len == 1)
- goto set_arg;
- break;
- }
- } else {
- match_map &= ~(1 << n);
- if (!match_map) {
- lwsl_ext("empty match map\n");
- return -1;
- }
- }
- }
- m >>= 1;
- n++;
- }
- w++;
- break;
- case LEAPS_SEEK_VAL:
- if (*in == ' ')
- break;
- if (*in == ',') {
- len = 1;
- break;
- }
- if (*in == ';' || len == 1) { /* ie,nonoptional */
- if (opts[oa.option_index].type == EXTARG_DEC)
- return -1;
- leap = LEAPS_SEEK_NAME;
- goto set_arg;
- }
- if (*in == '=') {
- w = 0;
- pending_close_quote = 0;
- if (opts[oa.option_index].type == EXTARG_NONE)
- return -1;
-
- leap = LEAPS_EAT_DEC;
- break;
- }
- return -1;
-
- case LEAPS_EAT_DEC:
- if (*in >= '0' && *in <= '9') {
- if (!w)
- oa.start = in;
- w++;
- if (len != 1)
- break;
- }
- if (!w && *in =='"') {
- pending_close_quote = 1;
- break;
- }
- if (!w)
- return -1;
- if (pending_close_quote && *in != '"' && len != 1)
- return -1;
- leap = LEAPS_SEEK_ARG_TERM;
- if (oa.start)
- oa.len = in - oa.start;
- if (len == 1)
- oa.len++;
-
-set_arg:
- ext->callback(lws_get_context(wsi),
- ext, wsi, LWS_EXT_CB_OPTION_SET,
- ext_user, (char *)&oa, 0);
- if (len == 1)
- break;
- if (pending_close_quote && *in == '"')
- break;
-
- /* fallthru */
-
- case LEAPS_SEEK_ARG_TERM:
- if (*in == ' ')
- break;
- if (*in == ';') {
- leap = LEAPS_SEEK_NAME;
- break;
- }
- if (*in == ',') {
- len = 1;
- break;
- }
- return -1;
- }
- len--;
- in++;
- }
-
- return 0;
-}
-
-
-/* 0 = nobody had nonzero return, 1 = somebody had positive return, -1 = fail */
-
-int lws_ext_cb_active(struct lws *wsi, int reason, void *arg, int len)
-{
- int n, m, handled = 0;
-
- for (n = 0; n < wsi->count_act_ext; n++) {
- m = wsi->active_extensions[n]->callback(lws_get_context(wsi),
- wsi->active_extensions[n], wsi, reason,
- wsi->act_ext_user[n], arg, len);
- if (m < 0) {
- lwsl_ext("Ext '%s' failed to handle callback %d!\n",
- wsi->active_extensions[n]->name, reason);
- return -1;
- }
- /* valgrind... */
- if (reason == LWS_EXT_CB_DESTROY)
- wsi->act_ext_user[n] = NULL;
- if (m > handled)
- handled = m;
- }
-
- return handled;
-}
-
-int lws_ext_cb_all_exts(struct lws_context *context, struct lws *wsi,
- int reason, void *arg, int len)
-{
- int n = 0, m, handled = 0;
- const struct lws_extension *ext;
-
- if (!wsi || !wsi->vhost)
- return 0;
-
- ext = wsi->vhost->extensions;
-
- while (ext && ext->callback && !handled) {
- m = ext->callback(context, ext, wsi, reason,
- (void *)(lws_intptr_t)n, arg, len);
- if (m < 0) {
- lwsl_ext("Ext '%s' failed to handle callback %d!\n",
- wsi->active_extensions[n]->name, reason);
- return -1;
- }
- if (m)
- handled = 1;
-
- ext++;
- n++;
- }
-
- return 0;
-}
-
-int
-lws_issue_raw_ext_access(struct lws *wsi, unsigned char *buf, size_t len)
-{
- struct lws_tokens eff_buf;
- int ret, m, n = 0;
-
- eff_buf.token = (char *)buf;
- eff_buf.token_len = len;
-
- /*
- * while we have original buf to spill ourselves, or extensions report
- * more in their pipeline
- */
-
- ret = 1;
- while (ret == 1) {
-
- /* default to nobody has more to spill */
-
- ret = 0;
-
- /* show every extension the new incoming data */
- m = lws_ext_cb_active(wsi,
- LWS_EXT_CB_PACKET_TX_PRESEND, &eff_buf, 0);
- if (m < 0)
- return -1;
- if (m) /* handled */
- ret = 1;
-
- if ((char *)buf != eff_buf.token)
- /*
- * extension recreated it:
- * need to buffer this if not all sent
- */
- wsi->u.ws.clean_buffer = 0;
-
- /* assuming they left us something to send, send it */
-
- if (eff_buf.token_len) {
- n = lws_issue_raw(wsi, (unsigned char *)eff_buf.token,
- eff_buf.token_len);
- if (n < 0) {
- lwsl_info("closing from ext access\n");
- return -1;
- }
-
- /* always either sent it all or privately buffered */
- if (wsi->u.ws.clean_buffer)
- len = n;
- }
-
- lwsl_parser("written %d bytes to client\n", n);
-
- /* no extension has more to spill? Then we can go */
-
- if (!ret)
- break;
-
- /* we used up what we had */
-
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
-
- /*
- * Did that leave the pipe choked?
- * Or we had to hold on to some of it?
- */
-
- if (!lws_send_pipe_choked(wsi) && !wsi->trunc_len)
- /* no we could add more, lets's do that */
- continue;
-
- lwsl_debug("choked\n");
-
- /*
- * Yes, he's choked. Don't spill the rest now get a callback
- * when he is ready to send and take care of it there
- */
- lws_callback_on_writable(wsi);
- wsi->extension_data_pending = 1;
- ret = 0;
- }
-
- return len;
-}
-
-int
-lws_any_extension_handled(struct lws *wsi, enum lws_extension_callback_reasons r,
- void *v, size_t len)
-{
- struct lws_context *context = wsi->context;
- int n, handled = 0;
-
- /* maybe an extension will take care of it for us */
-
- for (n = 0; n < wsi->count_act_ext && !handled; n++) {
- if (!wsi->active_extensions[n]->callback)
- continue;
-
- handled |= wsi->active_extensions[n]->callback(context,
- wsi->active_extensions[n], wsi,
- r, wsi->act_ext_user[n], v, len);
- }
-
- return handled;
-}
-
-int
-lws_set_extension_option(struct lws *wsi, const char *ext_name,
- const char *opt_name, const char *opt_val)
-{
- struct lws_ext_option_arg oa;
- int idx = 0;
-
- /* first identify if the ext is active on this wsi */
- while (idx < wsi->count_act_ext &&
- strcmp(wsi->active_extensions[idx]->name, ext_name))
- idx++;
-
- if (idx == wsi->count_act_ext)
- return -1; /* request ext not active on this wsi */
-
- oa.option_name = opt_name;
- oa.option_index = 0;
- oa.start = opt_val;
- oa.len = 0;
-
- return wsi->active_extensions[idx]->callback(
- wsi->context, wsi->active_extensions[idx], wsi,
- LWS_EXT_CB_NAMED_OPTION_SET, wsi->act_ext_user[idx], &oa, 0);
-}
diff --git a/thirdparty/lws/handshake.c b/thirdparty/lws/handshake.c
deleted file mode 100644
index bc7609d920..0000000000
--- a/thirdparty/lws/handshake.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-/*
- * -04 of the protocol (actually the 80th version) has a radically different
- * handshake. The 04 spec gives the following idea
- *
- * The handshake from the client looks as follows:
- *
- * GET /chat HTTP/1.1
- * Host: server.example.com
- * Upgrade: websocket
- * Connection: Upgrade
- * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
- * Sec-WebSocket-Origin: http://example.com
- * Sec-WebSocket-Protocol: chat, superchat
- * Sec-WebSocket-Version: 4
- *
- * The handshake from the server looks as follows:
- *
- * HTTP/1.1 101 Switching Protocols
- * Upgrade: websocket
- * Connection: Upgrade
- * Sec-WebSocket-Accept: me89jWimTRKTWwrS3aRrL53YZSo=
- * Sec-WebSocket-Nonce: AQIDBAUGBwgJCgsMDQ4PEC==
- * Sec-WebSocket-Protocol: chat
- */
-
-#ifndef min
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-/*
- * We have to take care about parsing because the headers may be split
- * into multiple fragments. They may contain unknown headers with arbitrary
- * argument lengths. So, we parse using a single-character at a time state
- * machine that is completely independent of packet size.
- *
- * Returns <0 for error or length of chars consumed from buf (up to len)
- */
-
-LWS_VISIBLE int
-lws_read(struct lws *wsi, unsigned char *buf, lws_filepos_t len)
-{
- unsigned char *last_char, *oldbuf = buf;
- lws_filepos_t body_chunk_len;
- size_t n;
-
- switch (wsi->state) {
-#ifdef LWS_WITH_HTTP2
- case LWSS_HTTP2_AWAIT_CLIENT_PREFACE:
- case LWSS_HTTP2_ESTABLISHED_PRE_SETTINGS:
- case LWSS_HTTP2_ESTABLISHED:
- n = 0;
- //lwsl_debug("%s: starting new block of %d\n", __func__, (int)len);
- /*
- * wsi here is always the network connection wsi, not a stream
- * wsi.
- */
- while (n < len) {
- /*
- * we were accepting input but now we stopped doing so
- */
- if (lws_is_flowcontrolled(wsi)) {
- lws_rxflow_cache(wsi, buf, n, len);
-
- return 1;
- }
-
- /* account for what we're using in rxflow buffer */
- if (wsi->rxflow_buffer) {
- wsi->rxflow_pos++;
- assert(wsi->rxflow_pos <= wsi->rxflow_len);
- }
-
- if (lws_h2_parser(wsi, buf[n++])) {
- lwsl_debug("%s: http2_parser bailed\n", __func__);
- goto bail;
- }
- }
- lwsl_debug("%s: used up block of %d\n", __func__, (int)len);
- break;
-#endif
-
- case LWSS_HTTP_ISSUING_FILE:
- return 0;
-
- case LWSS_CLIENT_HTTP_ESTABLISHED:
- break;
-
- case LWSS_HTTP:
- wsi->hdr_parsing_completed = 0;
-
- /* fallthru */
-
- case LWSS_HTTP_HEADERS:
- if (!wsi->u.hdr.ah) {
- lwsl_err("%s: LWSS_HTTP_HEADERS: NULL ah\n", __func__);
- assert(0);
- }
- lwsl_parser("issuing %d bytes to parser\n", (int)len);
-
- lwsl_hexdump(buf, (size_t)len);
-
- if (lws_handshake_client(wsi, &buf, (size_t)len))
- goto bail;
-
- last_char = buf;
- if (lws_handshake_server(wsi, &buf, (size_t)len))
- /* Handshake indicates this session is done. */
- goto bail;
-
- /* we might have transitioned to RAW */
- if (wsi->mode == LWSCM_RAW)
- /* we gave the read buffer to RAW handler already */
- goto read_ok;
-
- /*
- * It's possible that we've exhausted our data already, or
- * rx flow control has stopped us dealing with this early,
- * but lws_handshake_server doesn't update len for us.
- * Figure out how much was read, so that we can proceed
- * appropriately:
- */
- len -= (buf - last_char);
- lwsl_debug("%s: thinks we have used %ld\n", __func__, (long)len);
-
- if (!wsi->hdr_parsing_completed)
- /* More header content on the way */
- goto read_ok;
-
- switch (wsi->state) {
- case LWSS_HTTP:
- case LWSS_HTTP_HEADERS:
- goto read_ok;
- case LWSS_HTTP_ISSUING_FILE:
- goto read_ok;
- case LWSS_HTTP_BODY:
- wsi->u.http.rx_content_remain =
- wsi->u.http.rx_content_length;
- if (wsi->u.http.rx_content_remain)
- goto http_postbody;
-
- /* there is no POST content */
- goto postbody_completion;
- default:
- break;
- }
- break;
-
- case LWSS_HTTP_BODY:
-http_postbody:
- //lwsl_notice("http post body\n");
- while (len && wsi->u.http.rx_content_remain) {
- /* Copy as much as possible, up to the limit of:
- * what we have in the read buffer (len)
- * remaining portion of the POST body (content_remain)
- */
- body_chunk_len = min(wsi->u.http.rx_content_remain, len);
- wsi->u.http.rx_content_remain -= body_chunk_len;
- len -= body_chunk_len;
-#ifdef LWS_WITH_CGI
- if (wsi->cgi) {
- struct lws_cgi_args args;
-
- args.ch = LWS_STDIN;
- args.stdwsi = &wsi->cgi->stdwsi[0];
- args.data = buf;
- args.len = body_chunk_len;
-
- /* returns how much used */
- n = user_callback_handle_rxflow(
- wsi->protocol->callback,
- wsi, LWS_CALLBACK_CGI_STDIN_DATA,
- wsi->user_space,
- (void *)&args, 0);
- if ((int)n < 0)
- goto bail;
- } else {
-#endif
- n = wsi->protocol->callback(wsi,
- LWS_CALLBACK_HTTP_BODY, wsi->user_space,
- buf, (size_t)body_chunk_len);
- if (n)
- goto bail;
- n = (size_t)body_chunk_len;
-#ifdef LWS_WITH_CGI
- }
-#endif
- buf += n;
-
- if (wsi->u.http.rx_content_remain) {
- lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT,
- wsi->context->timeout_secs);
- break;
- }
- /* he sent all the content in time */
-postbody_completion:
-#ifdef LWS_WITH_CGI
- /*
- * If we're running a cgi, we can't let him off the
- * hook just because he sent his POST data
- */
- if (wsi->cgi)
- lws_set_timeout(wsi, PENDING_TIMEOUT_CGI,
- wsi->context->timeout_secs);
- else
-#endif
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
-#ifdef LWS_WITH_CGI
- if (!wsi->cgi)
-#endif
- {
- lwsl_notice("LWS_CALLBACK_HTTP_BODY_COMPLETION\n");
- n = wsi->protocol->callback(wsi,
- LWS_CALLBACK_HTTP_BODY_COMPLETION,
- wsi->user_space, NULL, 0);
- if (n)
- goto bail;
-
- if (wsi->http2_substream)
- wsi->state = LWSS_HTTP2_ESTABLISHED;
- }
-
- break;
- }
- break;
-
- case LWSS_ESTABLISHED:
- case LWSS_AWAITING_CLOSE_ACK:
- case LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION:
- case LWSS_SHUTDOWN:
- if (lws_handshake_client(wsi, &buf, (size_t)len))
- goto bail;
- switch (wsi->mode) {
- case LWSCM_WS_SERVING:
-
- if (lws_interpret_incoming_packet(wsi, &buf, (size_t)len) < 0) {
- lwsl_info("interpret_incoming_packet has bailed\n");
- goto bail;
- }
- break;
- }
- break;
- default:
- lwsl_err("%s: Unhandled state %d\n", __func__, wsi->state);
- break;
- }
-
-read_ok:
- /* Nothing more to do for now */
- lwsl_info("%s: read_ok, used %ld\n", __func__, (long)(buf - oldbuf));
-
- return buf - oldbuf;
-
-bail:
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
-
- return -1;
-}
diff --git a/thirdparty/lws/lextable.h b/thirdparty/lws/lextable.h
deleted file mode 100644
index f940afd25b..0000000000
--- a/thirdparty/lws/lextable.h
+++ /dev/null
@@ -1,805 +0,0 @@
-/* pos 0000: 0 */ 0x67 /* 'g' */, 0x40, 0x00 /* (to 0x0040 state 1) */,
- 0x70 /* 'p' */, 0x42, 0x00 /* (to 0x0045 state 5) */,
- 0x6F /* 'o' */, 0x51, 0x00 /* (to 0x0057 state 10) */,
- 0x68 /* 'h' */, 0x5D, 0x00 /* (to 0x0066 state 18) */,
- 0x63 /* 'c' */, 0x69, 0x00 /* (to 0x0075 state 23) */,
- 0x75 /* 'u' */, 0x8A, 0x00 /* (to 0x0099 state 34) */,
- 0x73 /* 's' */, 0xA0, 0x00 /* (to 0x00B2 state 48) */,
- 0x0D /* '.' */, 0xD9, 0x00 /* (to 0x00EE state 68) */,
- 0x61 /* 'a' */, 0x31, 0x01 /* (to 0x0149 state 129) */,
- 0x69 /* 'i' */, 0x70, 0x01 /* (to 0x018B state 163) */,
- 0x64 /* 'd' */, 0x19, 0x02 /* (to 0x0237 state 265) */,
- 0x72 /* 'r' */, 0x22, 0x02 /* (to 0x0243 state 270) */,
- 0x3A /* ':' */, 0x53, 0x02 /* (to 0x0277 state 299) */,
- 0x65 /* 'e' */, 0xDF, 0x02 /* (to 0x0306 state 409) */,
- 0x66 /* 'f' */, 0xFB, 0x02 /* (to 0x0325 state 425) */,
- 0x6C /* 'l' */, 0x1D, 0x03 /* (to 0x034A state 458) */,
- 0x6D /* 'm' */, 0x40, 0x03 /* (to 0x0370 state 484) */,
- 0x74 /* 't' */, 0xAF, 0x03 /* (to 0x03E2 state 578) */,
- 0x76 /* 'v' */, 0xD0, 0x03 /* (to 0x0406 state 606) */,
- 0x77 /* 'w' */, 0xDD, 0x03 /* (to 0x0416 state 614) */,
- 0x78 /* 'x' */, 0x04, 0x04 /* (to 0x0440 state 650) */,
- 0x08, /* fail */
-/* pos 0040: 1 */ 0xE5 /* 'e' -> */,
-/* pos 0041: 2 */ 0xF4 /* 't' -> */,
-/* pos 0042: 3 */ 0xA0 /* ' ' -> */,
-/* pos 0043: 4 */ 0x00, 0x00 /* - terminal marker 0 - */,
-/* pos 0045: 5 */ 0x6F /* 'o' */, 0x0D, 0x00 /* (to 0x0052 state 6) */,
- 0x72 /* 'r' */, 0x95, 0x01 /* (to 0x01DD state 211) */,
- 0x61 /* 'a' */, 0xDD, 0x03 /* (to 0x0428 state 631) */,
- 0x75 /* 'u' */, 0xDF, 0x03 /* (to 0x042D state 635) */,
- 0x08, /* fail */
-/* pos 0052: 6 */ 0xF3 /* 's' -> */,
-/* pos 0053: 7 */ 0xF4 /* 't' -> */,
-/* pos 0054: 8 */ 0xA0 /* ' ' -> */,
-/* pos 0055: 9 */ 0x00, 0x01 /* - terminal marker 1 - */,
-/* pos 0057: 10 */ 0x70 /* 'p' */, 0x07, 0x00 /* (to 0x005E state 11) */,
- 0x72 /* 'r' */, 0x51, 0x00 /* (to 0x00AB state 42) */,
- 0x08, /* fail */
-/* pos 005e: 11 */ 0xF4 /* 't' -> */,
-/* pos 005f: 12 */ 0xE9 /* 'i' -> */,
-/* pos 0060: 13 */ 0xEF /* 'o' -> */,
-/* pos 0061: 14 */ 0xEE /* 'n' -> */,
-/* pos 0062: 15 */ 0xF3 /* 's' -> */,
-/* pos 0063: 16 */ 0xA0 /* ' ' -> */,
-/* pos 0064: 17 */ 0x00, 0x02 /* - terminal marker 2 - */,
-/* pos 0066: 18 */ 0x6F /* 'o' */, 0x0A, 0x00 /* (to 0x0070 state 19) */,
- 0x74 /* 't' */, 0xBF, 0x00 /* (to 0x0128 state 110) */,
- 0x65 /* 'e' */, 0xF8, 0x03 /* (to 0x0464 state 676) */,
- 0x08, /* fail */
-/* pos 0070: 19 */ 0xF3 /* 's' -> */,
-/* pos 0071: 20 */ 0xF4 /* 't' -> */,
-/* pos 0072: 21 */ 0xBA /* ':' -> */,
-/* pos 0073: 22 */ 0x00, 0x03 /* - terminal marker 3 - */,
-/* pos 0075: 23 */ 0x6F /* 'o' */, 0x07, 0x00 /* (to 0x007C state 24) */,
- 0x61 /* 'a' */, 0x72, 0x01 /* (to 0x01EA state 217) */,
- 0x08, /* fail */
-/* pos 007c: 24 */ 0x6E /* 'n' */, 0x07, 0x00 /* (to 0x0083 state 25) */,
- 0x6F /* 'o' */, 0x87, 0x01 /* (to 0x0206 state 243) */,
- 0x08, /* fail */
-/* pos 0083: 25 */ 0x6E /* 'n' */, 0x07, 0x00 /* (to 0x008A state 26) */,
- 0x74 /* 't' */, 0x86, 0x01 /* (to 0x020C state 248) */,
- 0x08, /* fail */
-/* pos 008a: 26 */ 0xE5 /* 'e' -> */,
-/* pos 008b: 27 */ 0xE3 /* 'c' -> */,
-/* pos 008c: 28 */ 0xF4 /* 't' -> */,
-/* pos 008d: 29 */ 0x69 /* 'i' */, 0x07, 0x00 /* (to 0x0094 state 30) */,
- 0x20 /* ' ' */, 0xD2, 0x03 /* (to 0x0462 state 675) */,
- 0x08, /* fail */
-/* pos 0094: 30 */ 0xEF /* 'o' -> */,
-/* pos 0095: 31 */ 0xEE /* 'n' -> */,
-/* pos 0096: 32 */ 0xBA /* ':' -> */,
-/* pos 0097: 33 */ 0x00, 0x04 /* - terminal marker 4 - */,
-/* pos 0099: 34 */ 0x70 /* 'p' */, 0x0A, 0x00 /* (to 0x00A3 state 35) */,
- 0x73 /* 's' */, 0x5F, 0x03 /* (to 0x03FB state 596) */,
- 0x72 /* 'r' */, 0x97, 0x03 /* (to 0x0436 state 642) */,
- 0x08, /* fail */
-/* pos 00a3: 35 */ 0xE7 /* 'g' -> */,
-/* pos 00a4: 36 */ 0xF2 /* 'r' -> */,
-/* pos 00a5: 37 */ 0xE1 /* 'a' -> */,
-/* pos 00a6: 38 */ 0xE4 /* 'd' -> */,
-/* pos 00a7: 39 */ 0xE5 /* 'e' -> */,
-/* pos 00a8: 40 */ 0xBA /* ':' -> */,
-/* pos 00a9: 41 */ 0x00, 0x05 /* - terminal marker 5 - */,
-/* pos 00ab: 42 */ 0xE9 /* 'i' -> */,
-/* pos 00ac: 43 */ 0xE7 /* 'g' -> */,
-/* pos 00ad: 44 */ 0xE9 /* 'i' -> */,
-/* pos 00ae: 45 */ 0xEE /* 'n' -> */,
-/* pos 00af: 46 */ 0xBA /* ':' -> */,
-/* pos 00b0: 47 */ 0x00, 0x06 /* - terminal marker 6 - */,
-/* pos 00b2: 48 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x00B9 state 49) */,
- 0x74 /* 't' */, 0x13, 0x03 /* (to 0x03C8 state 553) */,
- 0x08, /* fail */
-/* pos 00b9: 49 */ 0x63 /* 'c' */, 0x0A, 0x00 /* (to 0x00C3 state 50) */,
- 0x72 /* 'r' */, 0xFC, 0x02 /* (to 0x03B8 state 539) */,
- 0x74 /* 't' */, 0xFF, 0x02 /* (to 0x03BE state 544) */,
- 0x08, /* fail */
-/* pos 00c3: 50 */ 0xAD /* '-' -> */,
-/* pos 00c4: 51 */ 0xF7 /* 'w' -> */,
-/* pos 00c5: 52 */ 0xE5 /* 'e' -> */,
-/* pos 00c6: 53 */ 0xE2 /* 'b' -> */,
-/* pos 00c7: 54 */ 0xF3 /* 's' -> */,
-/* pos 00c8: 55 */ 0xEF /* 'o' -> */,
-/* pos 00c9: 56 */ 0xE3 /* 'c' -> */,
-/* pos 00ca: 57 */ 0xEB /* 'k' -> */,
-/* pos 00cb: 58 */ 0xE5 /* 'e' -> */,
-/* pos 00cc: 59 */ 0xF4 /* 't' -> */,
-/* pos 00cd: 60 */ 0xAD /* '-' -> */,
-/* pos 00ce: 61 */ 0x64 /* 'd' */, 0x19, 0x00 /* (to 0x00E7 state 62) */,
- 0x65 /* 'e' */, 0x20, 0x00 /* (to 0x00F1 state 70) */,
- 0x6B /* 'k' */, 0x29, 0x00 /* (to 0x00FD state 81) */,
- 0x70 /* 'p' */, 0x38, 0x00 /* (to 0x010F state 88) */,
- 0x61 /* 'a' */, 0x3F, 0x00 /* (to 0x0119 state 97) */,
- 0x6E /* 'n' */, 0x44, 0x00 /* (to 0x0121 state 104) */,
- 0x76 /* 'v' */, 0x86, 0x01 /* (to 0x0266 state 284) */,
- 0x6F /* 'o' */, 0x8C, 0x01 /* (to 0x026F state 292) */,
- 0x08, /* fail */
-/* pos 00e7: 62 */ 0xF2 /* 'r' -> */,
-/* pos 00e8: 63 */ 0xE1 /* 'a' -> */,
-/* pos 00e9: 64 */ 0xE6 /* 'f' -> */,
-/* pos 00ea: 65 */ 0xF4 /* 't' -> */,
-/* pos 00eb: 66 */ 0xBA /* ':' -> */,
-/* pos 00ec: 67 */ 0x00, 0x07 /* - terminal marker 7 - */,
-/* pos 00ee: 68 */ 0x8A /* '.' -> */,
-/* pos 00ef: 69 */ 0x00, 0x08 /* - terminal marker 8 - */,
-/* pos 00f1: 70 */ 0xF8 /* 'x' -> */,
-/* pos 00f2: 71 */ 0xF4 /* 't' -> */,
-/* pos 00f3: 72 */ 0xE5 /* 'e' -> */,
-/* pos 00f4: 73 */ 0xEE /* 'n' -> */,
-/* pos 00f5: 74 */ 0xF3 /* 's' -> */,
-/* pos 00f6: 75 */ 0xE9 /* 'i' -> */,
-/* pos 00f7: 76 */ 0xEF /* 'o' -> */,
-/* pos 00f8: 77 */ 0xEE /* 'n' -> */,
-/* pos 00f9: 78 */ 0xF3 /* 's' -> */,
-/* pos 00fa: 79 */ 0xBA /* ':' -> */,
-/* pos 00fb: 80 */ 0x00, 0x09 /* - terminal marker 9 - */,
-/* pos 00fd: 81 */ 0xE5 /* 'e' -> */,
-/* pos 00fe: 82 */ 0xF9 /* 'y' -> */,
-/* pos 00ff: 83 */ 0x31 /* '1' */, 0x0A, 0x00 /* (to 0x0109 state 84) */,
- 0x32 /* '2' */, 0x0A, 0x00 /* (to 0x010C state 86) */,
- 0x3A /* ':' */, 0x5F, 0x01 /* (to 0x0264 state 283) */,
- 0x08, /* fail */
-/* pos 0109: 84 */ 0xBA /* ':' -> */,
-/* pos 010a: 85 */ 0x00, 0x0A /* - terminal marker 10 - */,
-/* pos 010c: 86 */ 0xBA /* ':' -> */,
-/* pos 010d: 87 */ 0x00, 0x0B /* - terminal marker 11 - */,
-/* pos 010f: 88 */ 0xF2 /* 'r' -> */,
-/* pos 0110: 89 */ 0xEF /* 'o' -> */,
-/* pos 0111: 90 */ 0xF4 /* 't' -> */,
-/* pos 0112: 91 */ 0xEF /* 'o' -> */,
-/* pos 0113: 92 */ 0xE3 /* 'c' -> */,
-/* pos 0114: 93 */ 0xEF /* 'o' -> */,
-/* pos 0115: 94 */ 0xEC /* 'l' -> */,
-/* pos 0116: 95 */ 0xBA /* ':' -> */,
-/* pos 0117: 96 */ 0x00, 0x0C /* - terminal marker 12 - */,
-/* pos 0119: 97 */ 0xE3 /* 'c' -> */,
-/* pos 011a: 98 */ 0xE3 /* 'c' -> */,
-/* pos 011b: 99 */ 0xE5 /* 'e' -> */,
-/* pos 011c: 100 */ 0xF0 /* 'p' -> */,
-/* pos 011d: 101 */ 0xF4 /* 't' -> */,
-/* pos 011e: 102 */ 0xBA /* ':' -> */,
-/* pos 011f: 103 */ 0x00, 0x0D /* - terminal marker 13 - */,
-/* pos 0121: 104 */ 0xEF /* 'o' -> */,
-/* pos 0122: 105 */ 0xEE /* 'n' -> */,
-/* pos 0123: 106 */ 0xE3 /* 'c' -> */,
-/* pos 0124: 107 */ 0xE5 /* 'e' -> */,
-/* pos 0125: 108 */ 0xBA /* ':' -> */,
-/* pos 0126: 109 */ 0x00, 0x0E /* - terminal marker 14 - */,
-/* pos 0128: 110 */ 0xF4 /* 't' -> */,
-/* pos 0129: 111 */ 0xF0 /* 'p' -> */,
-/* pos 012a: 112 */ 0x2F /* '/' */, 0x07, 0x00 /* (to 0x0131 state 113) */,
- 0x32 /* '2' */, 0x10, 0x00 /* (to 0x013D state 118) */,
- 0x08, /* fail */
-/* pos 0131: 113 */ 0xB1 /* '1' -> */,
-/* pos 0132: 114 */ 0xAE /* '.' -> */,
-/* pos 0133: 115 */ 0x31 /* '1' */, 0x07, 0x00 /* (to 0x013A state 116) */,
- 0x30 /* '0' */, 0x1B, 0x03 /* (to 0x0451 state 660) */,
- 0x08, /* fail */
-/* pos 013a: 116 */ 0xA0 /* ' ' -> */,
-/* pos 013b: 117 */ 0x00, 0x0F /* - terminal marker 15 - */,
-/* pos 013d: 118 */ 0xAD /* '-' -> */,
-/* pos 013e: 119 */ 0xF3 /* 's' -> */,
-/* pos 013f: 120 */ 0xE5 /* 'e' -> */,
-/* pos 0140: 121 */ 0xF4 /* 't' -> */,
-/* pos 0141: 122 */ 0xF4 /* 't' -> */,
-/* pos 0142: 123 */ 0xE9 /* 'i' -> */,
-/* pos 0143: 124 */ 0xEE /* 'n' -> */,
-/* pos 0144: 125 */ 0xE7 /* 'g' -> */,
-/* pos 0145: 126 */ 0xF3 /* 's' -> */,
-/* pos 0146: 127 */ 0xBA /* ':' -> */,
-/* pos 0147: 128 */ 0x00, 0x10 /* - terminal marker 16 - */,
-/* pos 0149: 129 */ 0x63 /* 'c' */, 0x0D, 0x00 /* (to 0x0156 state 130) */,
- 0x75 /* 'u' */, 0xAC, 0x00 /* (to 0x01F8 state 230) */,
- 0x67 /* 'g' */, 0x7D, 0x01 /* (to 0x02CC state 358) */,
- 0x6C /* 'l' */, 0x7E, 0x01 /* (to 0x02D0 state 361) */,
- 0x08, /* fail */
-/* pos 0156: 130 */ 0xE3 /* 'c' -> */,
-/* pos 0157: 131 */ 0xE5 /* 'e' -> */,
-/* pos 0158: 132 */ 0x70 /* 'p' */, 0x07, 0x00 /* (to 0x015F state 133) */,
- 0x73 /* 's' */, 0x0E, 0x00 /* (to 0x0169 state 136) */,
- 0x08, /* fail */
-/* pos 015f: 133 */ 0xF4 /* 't' -> */,
-/* pos 0160: 134 */ 0x3A /* ':' */, 0x07, 0x00 /* (to 0x0167 state 135) */,
- 0x2D /* '-' */, 0x59, 0x00 /* (to 0x01BC state 192) */,
- 0x08, /* fail */
-/* pos 0167: 135 */ 0x00, 0x11 /* - terminal marker 17 - */,
-/* pos 0169: 136 */ 0xF3 /* 's' -> */,
-/* pos 016a: 137 */ 0xAD /* '-' -> */,
-/* pos 016b: 138 */ 0xE3 /* 'c' -> */,
-/* pos 016c: 139 */ 0xEF /* 'o' -> */,
-/* pos 016d: 140 */ 0xEE /* 'n' -> */,
-/* pos 016e: 141 */ 0xF4 /* 't' -> */,
-/* pos 016f: 142 */ 0xF2 /* 'r' -> */,
-/* pos 0170: 143 */ 0xEF /* 'o' -> */,
-/* pos 0171: 144 */ 0xEC /* 'l' -> */,
-/* pos 0172: 145 */ 0xAD /* '-' -> */,
-/* pos 0173: 146 */ 0x72 /* 'r' */, 0x07, 0x00 /* (to 0x017A state 147) */,
- 0x61 /* 'a' */, 0x48, 0x01 /* (to 0x02BE state 345) */,
- 0x08, /* fail */
-/* pos 017a: 147 */ 0xE5 /* 'e' -> */,
-/* pos 017b: 148 */ 0xF1 /* 'q' -> */,
-/* pos 017c: 149 */ 0xF5 /* 'u' -> */,
-/* pos 017d: 150 */ 0xE5 /* 'e' -> */,
-/* pos 017e: 151 */ 0xF3 /* 's' -> */,
-/* pos 017f: 152 */ 0xF4 /* 't' -> */,
-/* pos 0180: 153 */ 0xAD /* '-' -> */,
-/* pos 0181: 154 */ 0xE8 /* 'h' -> */,
-/* pos 0182: 155 */ 0xE5 /* 'e' -> */,
-/* pos 0183: 156 */ 0xE1 /* 'a' -> */,
-/* pos 0184: 157 */ 0xE4 /* 'd' -> */,
-/* pos 0185: 158 */ 0xE5 /* 'e' -> */,
-/* pos 0186: 159 */ 0xF2 /* 'r' -> */,
-/* pos 0187: 160 */ 0xF3 /* 's' -> */,
-/* pos 0188: 161 */ 0xBA /* ':' -> */,
-/* pos 0189: 162 */ 0x00, 0x12 /* - terminal marker 18 - */,
-/* pos 018b: 163 */ 0xE6 /* 'f' -> */,
-/* pos 018c: 164 */ 0xAD /* '-' -> */,
-/* pos 018d: 165 */ 0x6D /* 'm' */, 0x0D, 0x00 /* (to 0x019A state 166) */,
- 0x6E /* 'n' */, 0x20, 0x00 /* (to 0x01B0 state 181) */,
- 0x72 /* 'r' */, 0x9E, 0x01 /* (to 0x0331 state 435) */,
- 0x75 /* 'u' */, 0xA2, 0x01 /* (to 0x0338 state 441) */,
- 0x08, /* fail */
-/* pos 019a: 166 */ 0x6F /* 'o' */, 0x07, 0x00 /* (to 0x01A1 state 167) */,
- 0x61 /* 'a' */, 0x8E, 0x01 /* (to 0x032B state 430) */,
- 0x08, /* fail */
-/* pos 01a1: 167 */ 0xE4 /* 'd' -> */,
-/* pos 01a2: 168 */ 0xE9 /* 'i' -> */,
-/* pos 01a3: 169 */ 0xE6 /* 'f' -> */,
-/* pos 01a4: 170 */ 0xE9 /* 'i' -> */,
-/* pos 01a5: 171 */ 0xE5 /* 'e' -> */,
-/* pos 01a6: 172 */ 0xE4 /* 'd' -> */,
-/* pos 01a7: 173 */ 0xAD /* '-' -> */,
-/* pos 01a8: 174 */ 0xF3 /* 's' -> */,
-/* pos 01a9: 175 */ 0xE9 /* 'i' -> */,
-/* pos 01aa: 176 */ 0xEE /* 'n' -> */,
-/* pos 01ab: 177 */ 0xE3 /* 'c' -> */,
-/* pos 01ac: 178 */ 0xE5 /* 'e' -> */,
-/* pos 01ad: 179 */ 0xBA /* ':' -> */,
-/* pos 01ae: 180 */ 0x00, 0x13 /* - terminal marker 19 - */,
-/* pos 01b0: 181 */ 0xEF /* 'o' -> */,
-/* pos 01b1: 182 */ 0xEE /* 'n' -> */,
-/* pos 01b2: 183 */ 0xE5 /* 'e' -> */,
-/* pos 01b3: 184 */ 0xAD /* '-' -> */,
-/* pos 01b4: 185 */ 0xED /* 'm' -> */,
-/* pos 01b5: 186 */ 0xE1 /* 'a' -> */,
-/* pos 01b6: 187 */ 0xF4 /* 't' -> */,
-/* pos 01b7: 188 */ 0xE3 /* 'c' -> */,
-/* pos 01b8: 189 */ 0xE8 /* 'h' -> */,
-/* pos 01b9: 190 */ 0xBA /* ':' -> */,
-/* pos 01ba: 191 */ 0x00, 0x14 /* - terminal marker 20 - */,
-/* pos 01bc: 192 */ 0x65 /* 'e' */, 0x0D, 0x00 /* (to 0x01C9 state 193) */,
- 0x6C /* 'l' */, 0x14, 0x00 /* (to 0x01D3 state 202) */,
- 0x63 /* 'c' */, 0xEB, 0x00 /* (to 0x02AD state 330) */,
- 0x72 /* 'r' */, 0xF1, 0x00 /* (to 0x02B6 state 338) */,
- 0x08, /* fail */
-/* pos 01c9: 193 */ 0xEE /* 'n' -> */,
-/* pos 01ca: 194 */ 0xE3 /* 'c' -> */,
-/* pos 01cb: 195 */ 0xEF /* 'o' -> */,
-/* pos 01cc: 196 */ 0xE4 /* 'd' -> */,
-/* pos 01cd: 197 */ 0xE9 /* 'i' -> */,
-/* pos 01ce: 198 */ 0xEE /* 'n' -> */,
-/* pos 01cf: 199 */ 0xE7 /* 'g' -> */,
-/* pos 01d0: 200 */ 0xBA /* ':' -> */,
-/* pos 01d1: 201 */ 0x00, 0x15 /* - terminal marker 21 - */,
-/* pos 01d3: 202 */ 0xE1 /* 'a' -> */,
-/* pos 01d4: 203 */ 0xEE /* 'n' -> */,
-/* pos 01d5: 204 */ 0xE7 /* 'g' -> */,
-/* pos 01d6: 205 */ 0xF5 /* 'u' -> */,
-/* pos 01d7: 206 */ 0xE1 /* 'a' -> */,
-/* pos 01d8: 207 */ 0xE7 /* 'g' -> */,
-/* pos 01d9: 208 */ 0xE5 /* 'e' -> */,
-/* pos 01da: 209 */ 0xBA /* ':' -> */,
-/* pos 01db: 210 */ 0x00, 0x16 /* - terminal marker 22 - */,
-/* pos 01dd: 211 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x01E4 state 212) */,
- 0x6F /* 'o' */, 0x9E, 0x01 /* (to 0x037E state 497) */,
- 0x08, /* fail */
-/* pos 01e4: 212 */ 0xE7 /* 'g' -> */,
-/* pos 01e5: 213 */ 0xED /* 'm' -> */,
-/* pos 01e6: 214 */ 0xE1 /* 'a' -> */,
-/* pos 01e7: 215 */ 0xBA /* ':' -> */,
-/* pos 01e8: 216 */ 0x00, 0x17 /* - terminal marker 23 - */,
-/* pos 01ea: 217 */ 0xE3 /* 'c' -> */,
-/* pos 01eb: 218 */ 0xE8 /* 'h' -> */,
-/* pos 01ec: 219 */ 0xE5 /* 'e' -> */,
-/* pos 01ed: 220 */ 0xAD /* '-' -> */,
-/* pos 01ee: 221 */ 0xE3 /* 'c' -> */,
-/* pos 01ef: 222 */ 0xEF /* 'o' -> */,
-/* pos 01f0: 223 */ 0xEE /* 'n' -> */,
-/* pos 01f1: 224 */ 0xF4 /* 't' -> */,
-/* pos 01f2: 225 */ 0xF2 /* 'r' -> */,
-/* pos 01f3: 226 */ 0xEF /* 'o' -> */,
-/* pos 01f4: 227 */ 0xEC /* 'l' -> */,
-/* pos 01f5: 228 */ 0xBA /* ':' -> */,
-/* pos 01f6: 229 */ 0x00, 0x18 /* - terminal marker 24 - */,
-/* pos 01f8: 230 */ 0xF4 /* 't' -> */,
-/* pos 01f9: 231 */ 0xE8 /* 'h' -> */,
-/* pos 01fa: 232 */ 0xEF /* 'o' -> */,
-/* pos 01fb: 233 */ 0xF2 /* 'r' -> */,
-/* pos 01fc: 234 */ 0xE9 /* 'i' -> */,
-/* pos 01fd: 235 */ 0xFA /* 'z' -> */,
-/* pos 01fe: 236 */ 0xE1 /* 'a' -> */,
-/* pos 01ff: 237 */ 0xF4 /* 't' -> */,
-/* pos 0200: 238 */ 0xE9 /* 'i' -> */,
-/* pos 0201: 239 */ 0xEF /* 'o' -> */,
-/* pos 0202: 240 */ 0xEE /* 'n' -> */,
-/* pos 0203: 241 */ 0xBA /* ':' -> */,
-/* pos 0204: 242 */ 0x00, 0x19 /* - terminal marker 25 - */,
-/* pos 0206: 243 */ 0xEB /* 'k' -> */,
-/* pos 0207: 244 */ 0xE9 /* 'i' -> */,
-/* pos 0208: 245 */ 0xE5 /* 'e' -> */,
-/* pos 0209: 246 */ 0xBA /* ':' -> */,
-/* pos 020a: 247 */ 0x00, 0x1A /* - terminal marker 26 - */,
-/* pos 020c: 248 */ 0xE5 /* 'e' -> */,
-/* pos 020d: 249 */ 0xEE /* 'n' -> */,
-/* pos 020e: 250 */ 0xF4 /* 't' -> */,
-/* pos 020f: 251 */ 0xAD /* '-' -> */,
-/* pos 0210: 252 */ 0x6C /* 'l' */, 0x10, 0x00 /* (to 0x0220 state 253) */,
- 0x74 /* 't' */, 0x1E, 0x00 /* (to 0x0231 state 260) */,
- 0x64 /* 'd' */, 0xC0, 0x00 /* (to 0x02D6 state 366) */,
- 0x65 /* 'e' */, 0xCA, 0x00 /* (to 0x02E3 state 378) */,
- 0x72 /* 'r' */, 0xE3, 0x00 /* (to 0x02FF state 403) */,
- 0x08, /* fail */
-/* pos 0220: 253 */ 0x65 /* 'e' */, 0x0A, 0x00 /* (to 0x022A state 254) */,
- 0x61 /* 'a' */, 0xCA, 0x00 /* (to 0x02ED state 387) */,
- 0x6F /* 'o' */, 0xD0, 0x00 /* (to 0x02F6 state 395) */,
- 0x08, /* fail */
-/* pos 022a: 254 */ 0xEE /* 'n' -> */,
-/* pos 022b: 255 */ 0xE7 /* 'g' -> */,
-/* pos 022c: 256 */ 0xF4 /* 't' -> */,
-/* pos 022d: 257 */ 0xE8 /* 'h' -> */,
-/* pos 022e: 258 */ 0xBA /* ':' -> */,
-/* pos 022f: 259 */ 0x00, 0x1B /* - terminal marker 27 - */,
-/* pos 0231: 260 */ 0xF9 /* 'y' -> */,
-/* pos 0232: 261 */ 0xF0 /* 'p' -> */,
-/* pos 0233: 262 */ 0xE5 /* 'e' -> */,
-/* pos 0234: 263 */ 0xBA /* ':' -> */,
-/* pos 0235: 264 */ 0x00, 0x1C /* - terminal marker 28 - */,
-/* pos 0237: 265 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x023E state 266) */,
- 0x65 /* 'e' */, 0xF6, 0x01 /* (to 0x0430 state 637) */,
- 0x08, /* fail */
-/* pos 023e: 266 */ 0xF4 /* 't' -> */,
-/* pos 023f: 267 */ 0xE5 /* 'e' -> */,
-/* pos 0240: 268 */ 0xBA /* ':' -> */,
-/* pos 0241: 269 */ 0x00, 0x1D /* - terminal marker 29 - */,
-/* pos 0243: 270 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x024A state 271) */,
- 0x65 /* 'e' */, 0x0A, 0x00 /* (to 0x0250 state 276) */,
- 0x08, /* fail */
-/* pos 024a: 271 */ 0xEE /* 'n' -> */,
-/* pos 024b: 272 */ 0xE7 /* 'g' -> */,
-/* pos 024c: 273 */ 0xE5 /* 'e' -> */,
-/* pos 024d: 274 */ 0xBA /* ':' -> */,
-/* pos 024e: 275 */ 0x00, 0x1E /* - terminal marker 30 - */,
-/* pos 0250: 276 */ 0x66 /* 'f' */, 0x07, 0x00 /* (to 0x0257 state 277) */,
- 0x74 /* 't' */, 0x5A, 0x01 /* (to 0x03AD state 529) */,
- 0x08, /* fail */
-/* pos 0257: 277 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x025E state 278) */,
- 0x72 /* 'r' */, 0x4D, 0x01 /* (to 0x03A7 state 524) */,
- 0x08, /* fail */
-/* pos 025e: 278 */ 0xF2 /* 'r' -> */,
-/* pos 025f: 279 */ 0xE5 /* 'e' -> */,
-/* pos 0260: 280 */ 0xF2 /* 'r' -> */,
-/* pos 0261: 281 */ 0xBA /* ':' -> */,
-/* pos 0262: 282 */ 0x00, 0x1F /* - terminal marker 31 - */,
-/* pos 0264: 283 */ 0x00, 0x20 /* - terminal marker 32 - */,
-/* pos 0266: 284 */ 0xE5 /* 'e' -> */,
-/* pos 0267: 285 */ 0xF2 /* 'r' -> */,
-/* pos 0268: 286 */ 0xF3 /* 's' -> */,
-/* pos 0269: 287 */ 0xE9 /* 'i' -> */,
-/* pos 026a: 288 */ 0xEF /* 'o' -> */,
-/* pos 026b: 289 */ 0xEE /* 'n' -> */,
-/* pos 026c: 290 */ 0xBA /* ':' -> */,
-/* pos 026d: 291 */ 0x00, 0x21 /* - terminal marker 33 - */,
-/* pos 026f: 292 */ 0xF2 /* 'r' -> */,
-/* pos 0270: 293 */ 0xE9 /* 'i' -> */,
-/* pos 0271: 294 */ 0xE7 /* 'g' -> */,
-/* pos 0272: 295 */ 0xE9 /* 'i' -> */,
-/* pos 0273: 296 */ 0xEE /* 'n' -> */,
-/* pos 0274: 297 */ 0xBA /* ':' -> */,
-/* pos 0275: 298 */ 0x00, 0x22 /* - terminal marker 34 - */,
-/* pos 0277: 299 */ 0x61 /* 'a' */, 0x0D, 0x00 /* (to 0x0284 state 300) */,
- 0x6D /* 'm' */, 0x14, 0x00 /* (to 0x028E state 309) */,
- 0x70 /* 'p' */, 0x18, 0x00 /* (to 0x0295 state 315) */,
- 0x73 /* 's' */, 0x1A, 0x00 /* (to 0x029A state 319) */,
- 0x08, /* fail */
-/* pos 0284: 300 */ 0xF5 /* 'u' -> */,
-/* pos 0285: 301 */ 0xF4 /* 't' -> */,
-/* pos 0286: 302 */ 0xE8 /* 'h' -> */,
-/* pos 0287: 303 */ 0xEF /* 'o' -> */,
-/* pos 0288: 304 */ 0xF2 /* 'r' -> */,
-/* pos 0289: 305 */ 0xE9 /* 'i' -> */,
-/* pos 028a: 306 */ 0xF4 /* 't' -> */,
-/* pos 028b: 307 */ 0xF9 /* 'y' -> */,
-/* pos 028c: 308 */ 0x00, 0x23 /* - terminal marker 35 - */,
-/* pos 028e: 309 */ 0xE5 /* 'e' -> */,
-/* pos 028f: 310 */ 0xF4 /* 't' -> */,
-/* pos 0290: 311 */ 0xE8 /* 'h' -> */,
-/* pos 0291: 312 */ 0xEF /* 'o' -> */,
-/* pos 0292: 313 */ 0xE4 /* 'd' -> */,
-/* pos 0293: 314 */ 0x00, 0x24 /* - terminal marker 36 - */,
-/* pos 0295: 315 */ 0xE1 /* 'a' -> */,
-/* pos 0296: 316 */ 0xF4 /* 't' -> */,
-/* pos 0297: 317 */ 0xE8 /* 'h' -> */,
-/* pos 0298: 318 */ 0x00, 0x25 /* - terminal marker 37 - */,
-/* pos 029a: 319 */ 0x63 /* 'c' */, 0x07, 0x00 /* (to 0x02A1 state 320) */,
- 0x74 /* 't' */, 0x0A, 0x00 /* (to 0x02A7 state 325) */,
- 0x08, /* fail */
-/* pos 02a1: 320 */ 0xE8 /* 'h' -> */,
-/* pos 02a2: 321 */ 0xE5 /* 'e' -> */,
-/* pos 02a3: 322 */ 0xED /* 'm' -> */,
-/* pos 02a4: 323 */ 0xE5 /* 'e' -> */,
-/* pos 02a5: 324 */ 0x00, 0x26 /* - terminal marker 38 - */,
-/* pos 02a7: 325 */ 0xE1 /* 'a' -> */,
-/* pos 02a8: 326 */ 0xF4 /* 't' -> */,
-/* pos 02a9: 327 */ 0xF5 /* 'u' -> */,
-/* pos 02aa: 328 */ 0xF3 /* 's' -> */,
-/* pos 02ab: 329 */ 0x00, 0x27 /* - terminal marker 39 - */,
-/* pos 02ad: 330 */ 0xE8 /* 'h' -> */,
-/* pos 02ae: 331 */ 0xE1 /* 'a' -> */,
-/* pos 02af: 332 */ 0xF2 /* 'r' -> */,
-/* pos 02b0: 333 */ 0xF3 /* 's' -> */,
-/* pos 02b1: 334 */ 0xE5 /* 'e' -> */,
-/* pos 02b2: 335 */ 0xF4 /* 't' -> */,
-/* pos 02b3: 336 */ 0xBA /* ':' -> */,
-/* pos 02b4: 337 */ 0x00, 0x28 /* - terminal marker 40 - */,
-/* pos 02b6: 338 */ 0xE1 /* 'a' -> */,
-/* pos 02b7: 339 */ 0xEE /* 'n' -> */,
-/* pos 02b8: 340 */ 0xE7 /* 'g' -> */,
-/* pos 02b9: 341 */ 0xE5 /* 'e' -> */,
-/* pos 02ba: 342 */ 0xF3 /* 's' -> */,
-/* pos 02bb: 343 */ 0xBA /* ':' -> */,
-/* pos 02bc: 344 */ 0x00, 0x29 /* - terminal marker 41 - */,
-/* pos 02be: 345 */ 0xEC /* 'l' -> */,
-/* pos 02bf: 346 */ 0xEC /* 'l' -> */,
-/* pos 02c0: 347 */ 0xEF /* 'o' -> */,
-/* pos 02c1: 348 */ 0xF7 /* 'w' -> */,
-/* pos 02c2: 349 */ 0xAD /* '-' -> */,
-/* pos 02c3: 350 */ 0xEF /* 'o' -> */,
-/* pos 02c4: 351 */ 0xF2 /* 'r' -> */,
-/* pos 02c5: 352 */ 0xE9 /* 'i' -> */,
-/* pos 02c6: 353 */ 0xE7 /* 'g' -> */,
-/* pos 02c7: 354 */ 0xE9 /* 'i' -> */,
-/* pos 02c8: 355 */ 0xEE /* 'n' -> */,
-/* pos 02c9: 356 */ 0xBA /* ':' -> */,
-/* pos 02ca: 357 */ 0x00, 0x2A /* - terminal marker 42 - */,
-/* pos 02cc: 358 */ 0xE5 /* 'e' -> */,
-/* pos 02cd: 359 */ 0xBA /* ':' -> */,
-/* pos 02ce: 360 */ 0x00, 0x2B /* - terminal marker 43 - */,
-/* pos 02d0: 361 */ 0xEC /* 'l' -> */,
-/* pos 02d1: 362 */ 0xEF /* 'o' -> */,
-/* pos 02d2: 363 */ 0xF7 /* 'w' -> */,
-/* pos 02d3: 364 */ 0xBA /* ':' -> */,
-/* pos 02d4: 365 */ 0x00, 0x2C /* - terminal marker 44 - */,
-/* pos 02d6: 366 */ 0xE9 /* 'i' -> */,
-/* pos 02d7: 367 */ 0xF3 /* 's' -> */,
-/* pos 02d8: 368 */ 0xF0 /* 'p' -> */,
-/* pos 02d9: 369 */ 0xEF /* 'o' -> */,
-/* pos 02da: 370 */ 0xF3 /* 's' -> */,
-/* pos 02db: 371 */ 0xE9 /* 'i' -> */,
-/* pos 02dc: 372 */ 0xF4 /* 't' -> */,
-/* pos 02dd: 373 */ 0xE9 /* 'i' -> */,
-/* pos 02de: 374 */ 0xEF /* 'o' -> */,
-/* pos 02df: 375 */ 0xEE /* 'n' -> */,
-/* pos 02e0: 376 */ 0xBA /* ':' -> */,
-/* pos 02e1: 377 */ 0x00, 0x2D /* - terminal marker 45 - */,
-/* pos 02e3: 378 */ 0xEE /* 'n' -> */,
-/* pos 02e4: 379 */ 0xE3 /* 'c' -> */,
-/* pos 02e5: 380 */ 0xEF /* 'o' -> */,
-/* pos 02e6: 381 */ 0xE4 /* 'd' -> */,
-/* pos 02e7: 382 */ 0xE9 /* 'i' -> */,
-/* pos 02e8: 383 */ 0xEE /* 'n' -> */,
-/* pos 02e9: 384 */ 0xE7 /* 'g' -> */,
-/* pos 02ea: 385 */ 0xBA /* ':' -> */,
-/* pos 02eb: 386 */ 0x00, 0x2E /* - terminal marker 46 - */,
-/* pos 02ed: 387 */ 0xEE /* 'n' -> */,
-/* pos 02ee: 388 */ 0xE7 /* 'g' -> */,
-/* pos 02ef: 389 */ 0xF5 /* 'u' -> */,
-/* pos 02f0: 390 */ 0xE1 /* 'a' -> */,
-/* pos 02f1: 391 */ 0xE7 /* 'g' -> */,
-/* pos 02f2: 392 */ 0xE5 /* 'e' -> */,
-/* pos 02f3: 393 */ 0xBA /* ':' -> */,
-/* pos 02f4: 394 */ 0x00, 0x2F /* - terminal marker 47 - */,
-/* pos 02f6: 395 */ 0xE3 /* 'c' -> */,
-/* pos 02f7: 396 */ 0xE1 /* 'a' -> */,
-/* pos 02f8: 397 */ 0xF4 /* 't' -> */,
-/* pos 02f9: 398 */ 0xE9 /* 'i' -> */,
-/* pos 02fa: 399 */ 0xEF /* 'o' -> */,
-/* pos 02fb: 400 */ 0xEE /* 'n' -> */,
-/* pos 02fc: 401 */ 0xBA /* ':' -> */,
-/* pos 02fd: 402 */ 0x00, 0x30 /* - terminal marker 48 - */,
-/* pos 02ff: 403 */ 0xE1 /* 'a' -> */,
-/* pos 0300: 404 */ 0xEE /* 'n' -> */,
-/* pos 0301: 405 */ 0xE7 /* 'g' -> */,
-/* pos 0302: 406 */ 0xE5 /* 'e' -> */,
-/* pos 0303: 407 */ 0xBA /* ':' -> */,
-/* pos 0304: 408 */ 0x00, 0x31 /* - terminal marker 49 - */,
-/* pos 0306: 409 */ 0x74 /* 't' */, 0x07, 0x00 /* (to 0x030D state 410) */,
- 0x78 /* 'x' */, 0x09, 0x00 /* (to 0x0312 state 414) */,
- 0x08, /* fail */
-/* pos 030d: 410 */ 0xE1 /* 'a' -> */,
-/* pos 030e: 411 */ 0xE7 /* 'g' -> */,
-/* pos 030f: 412 */ 0xBA /* ':' -> */,
-/* pos 0310: 413 */ 0x00, 0x32 /* - terminal marker 50 - */,
-/* pos 0312: 414 */ 0xF0 /* 'p' -> */,
-/* pos 0313: 415 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x031A state 416) */,
- 0x69 /* 'i' */, 0x09, 0x00 /* (to 0x031F state 420) */,
- 0x08, /* fail */
-/* pos 031a: 416 */ 0xE3 /* 'c' -> */,
-/* pos 031b: 417 */ 0xF4 /* 't' -> */,
-/* pos 031c: 418 */ 0xBA /* ':' -> */,
-/* pos 031d: 419 */ 0x00, 0x33 /* - terminal marker 51 - */,
-/* pos 031f: 420 */ 0xF2 /* 'r' -> */,
-/* pos 0320: 421 */ 0xE5 /* 'e' -> */,
-/* pos 0321: 422 */ 0xF3 /* 's' -> */,
-/* pos 0322: 423 */ 0xBA /* ':' -> */,
-/* pos 0323: 424 */ 0x00, 0x34 /* - terminal marker 52 - */,
-/* pos 0325: 425 */ 0xF2 /* 'r' -> */,
-/* pos 0326: 426 */ 0xEF /* 'o' -> */,
-/* pos 0327: 427 */ 0xED /* 'm' -> */,
-/* pos 0328: 428 */ 0xBA /* ':' -> */,
-/* pos 0329: 429 */ 0x00, 0x35 /* - terminal marker 53 - */,
-/* pos 032b: 430 */ 0xF4 /* 't' -> */,
-/* pos 032c: 431 */ 0xE3 /* 'c' -> */,
-/* pos 032d: 432 */ 0xE8 /* 'h' -> */,
-/* pos 032e: 433 */ 0xBA /* ':' -> */,
-/* pos 032f: 434 */ 0x00, 0x36 /* - terminal marker 54 - */,
-/* pos 0331: 435 */ 0xE1 /* 'a' -> */,
-/* pos 0332: 436 */ 0xEE /* 'n' -> */,
-/* pos 0333: 437 */ 0xE7 /* 'g' -> */,
-/* pos 0334: 438 */ 0xE5 /* 'e' -> */,
-/* pos 0335: 439 */ 0xBA /* ':' -> */,
-/* pos 0336: 440 */ 0x00, 0x37 /* - terminal marker 55 - */,
-/* pos 0338: 441 */ 0xEE /* 'n' -> */,
-/* pos 0339: 442 */ 0xED /* 'm' -> */,
-/* pos 033a: 443 */ 0xEF /* 'o' -> */,
-/* pos 033b: 444 */ 0xE4 /* 'd' -> */,
-/* pos 033c: 445 */ 0xE9 /* 'i' -> */,
-/* pos 033d: 446 */ 0xE6 /* 'f' -> */,
-/* pos 033e: 447 */ 0xE9 /* 'i' -> */,
-/* pos 033f: 448 */ 0xE5 /* 'e' -> */,
-/* pos 0340: 449 */ 0xE4 /* 'd' -> */,
-/* pos 0341: 450 */ 0xAD /* '-' -> */,
-/* pos 0342: 451 */ 0xF3 /* 's' -> */,
-/* pos 0343: 452 */ 0xE9 /* 'i' -> */,
-/* pos 0344: 453 */ 0xEE /* 'n' -> */,
-/* pos 0345: 454 */ 0xE3 /* 'c' -> */,
-/* pos 0346: 455 */ 0xE5 /* 'e' -> */,
-/* pos 0347: 456 */ 0xBA /* ':' -> */,
-/* pos 0348: 457 */ 0x00, 0x38 /* - terminal marker 56 - */,
-/* pos 034a: 458 */ 0x61 /* 'a' */, 0x0A, 0x00 /* (to 0x0354 state 459) */,
- 0x69 /* 'i' */, 0x15, 0x00 /* (to 0x0362 state 472) */,
- 0x6F /* 'o' */, 0x17, 0x00 /* (to 0x0367 state 476) */,
- 0x08, /* fail */
-/* pos 0354: 459 */ 0xF3 /* 's' -> */,
-/* pos 0355: 460 */ 0xF4 /* 't' -> */,
-/* pos 0356: 461 */ 0xAD /* '-' -> */,
-/* pos 0357: 462 */ 0xED /* 'm' -> */,
-/* pos 0358: 463 */ 0xEF /* 'o' -> */,
-/* pos 0359: 464 */ 0xE4 /* 'd' -> */,
-/* pos 035a: 465 */ 0xE9 /* 'i' -> */,
-/* pos 035b: 466 */ 0xE6 /* 'f' -> */,
-/* pos 035c: 467 */ 0xE9 /* 'i' -> */,
-/* pos 035d: 468 */ 0xE5 /* 'e' -> */,
-/* pos 035e: 469 */ 0xE4 /* 'd' -> */,
-/* pos 035f: 470 */ 0xBA /* ':' -> */,
-/* pos 0360: 471 */ 0x00, 0x39 /* - terminal marker 57 - */,
-/* pos 0362: 472 */ 0xEE /* 'n' -> */,
-/* pos 0363: 473 */ 0xEB /* 'k' -> */,
-/* pos 0364: 474 */ 0xBA /* ':' -> */,
-/* pos 0365: 475 */ 0x00, 0x3A /* - terminal marker 58 - */,
-/* pos 0367: 476 */ 0xE3 /* 'c' -> */,
-/* pos 0368: 477 */ 0xE1 /* 'a' -> */,
-/* pos 0369: 478 */ 0xF4 /* 't' -> */,
-/* pos 036a: 479 */ 0xE9 /* 'i' -> */,
-/* pos 036b: 480 */ 0xEF /* 'o' -> */,
-/* pos 036c: 481 */ 0xEE /* 'n' -> */,
-/* pos 036d: 482 */ 0xBA /* ':' -> */,
-/* pos 036e: 483 */ 0x00, 0x3B /* - terminal marker 59 - */,
-/* pos 0370: 484 */ 0xE1 /* 'a' -> */,
-/* pos 0371: 485 */ 0xF8 /* 'x' -> */,
-/* pos 0372: 486 */ 0xAD /* '-' -> */,
-/* pos 0373: 487 */ 0xE6 /* 'f' -> */,
-/* pos 0374: 488 */ 0xEF /* 'o' -> */,
-/* pos 0375: 489 */ 0xF2 /* 'r' -> */,
-/* pos 0376: 490 */ 0xF7 /* 'w' -> */,
-/* pos 0377: 491 */ 0xE1 /* 'a' -> */,
-/* pos 0378: 492 */ 0xF2 /* 'r' -> */,
-/* pos 0379: 493 */ 0xE4 /* 'd' -> */,
-/* pos 037a: 494 */ 0xF3 /* 's' -> */,
-/* pos 037b: 495 */ 0xBA /* ':' -> */,
-/* pos 037c: 496 */ 0x00, 0x3C /* - terminal marker 60 - */,
-/* pos 037e: 497 */ 0xF8 /* 'x' -> */,
-/* pos 037f: 498 */ 0xF9 /* 'y' -> */,
-/* pos 0380: 499 */ 0x2D /* '-' */, 0x07, 0x00 /* (to 0x0387 state 500) */,
- 0x20 /* ' ' */, 0xBB, 0x00 /* (to 0x043E state 649) */,
- 0x08, /* fail */
-/* pos 0387: 500 */ 0xE1 /* 'a' -> */,
-/* pos 0388: 501 */ 0xF5 /* 'u' -> */,
-/* pos 0389: 502 */ 0xF4 /* 't' -> */,
-/* pos 038a: 503 */ 0xE8 /* 'h' -> */,
-/* pos 038b: 504 */ 0x65 /* 'e' */, 0x07, 0x00 /* (to 0x0392 state 505) */,
- 0x6F /* 'o' */, 0x0E, 0x00 /* (to 0x039C state 514) */,
- 0x08, /* fail */
-/* pos 0392: 505 */ 0xEE /* 'n' -> */,
-/* pos 0393: 506 */ 0xF4 /* 't' -> */,
-/* pos 0394: 507 */ 0xE9 /* 'i' -> */,
-/* pos 0395: 508 */ 0xE3 /* 'c' -> */,
-/* pos 0396: 509 */ 0xE1 /* 'a' -> */,
-/* pos 0397: 510 */ 0xF4 /* 't' -> */,
-/* pos 0398: 511 */ 0xE5 /* 'e' -> */,
-/* pos 0399: 512 */ 0xBA /* ':' -> */,
-/* pos 039a: 513 */ 0x00, 0x3D /* - terminal marker 61 - */,
-/* pos 039c: 514 */ 0xF2 /* 'r' -> */,
-/* pos 039d: 515 */ 0xE9 /* 'i' -> */,
-/* pos 039e: 516 */ 0xFA /* 'z' -> */,
-/* pos 039f: 517 */ 0xE1 /* 'a' -> */,
-/* pos 03a0: 518 */ 0xF4 /* 't' -> */,
-/* pos 03a1: 519 */ 0xE9 /* 'i' -> */,
-/* pos 03a2: 520 */ 0xEF /* 'o' -> */,
-/* pos 03a3: 521 */ 0xEE /* 'n' -> */,
-/* pos 03a4: 522 */ 0xBA /* ':' -> */,
-/* pos 03a5: 523 */ 0x00, 0x3E /* - terminal marker 62 - */,
-/* pos 03a7: 524 */ 0xE5 /* 'e' -> */,
-/* pos 03a8: 525 */ 0xF3 /* 's' -> */,
-/* pos 03a9: 526 */ 0xE8 /* 'h' -> */,
-/* pos 03aa: 527 */ 0xBA /* ':' -> */,
-/* pos 03ab: 528 */ 0x00, 0x3F /* - terminal marker 63 - */,
-/* pos 03ad: 529 */ 0xF2 /* 'r' -> */,
-/* pos 03ae: 530 */ 0xF9 /* 'y' -> */,
-/* pos 03af: 531 */ 0xAD /* '-' -> */,
-/* pos 03b0: 532 */ 0xE1 /* 'a' -> */,
-/* pos 03b1: 533 */ 0xE6 /* 'f' -> */,
-/* pos 03b2: 534 */ 0xF4 /* 't' -> */,
-/* pos 03b3: 535 */ 0xE5 /* 'e' -> */,
-/* pos 03b4: 536 */ 0xF2 /* 'r' -> */,
-/* pos 03b5: 537 */ 0xBA /* ':' -> */,
-/* pos 03b6: 538 */ 0x00, 0x40 /* - terminal marker 64 - */,
-/* pos 03b8: 539 */ 0xF6 /* 'v' -> */,
-/* pos 03b9: 540 */ 0xE5 /* 'e' -> */,
-/* pos 03ba: 541 */ 0xF2 /* 'r' -> */,
-/* pos 03bb: 542 */ 0xBA /* ':' -> */,
-/* pos 03bc: 543 */ 0x00, 0x41 /* - terminal marker 65 - */,
-/* pos 03be: 544 */ 0xAD /* '-' -> */,
-/* pos 03bf: 545 */ 0xE3 /* 'c' -> */,
-/* pos 03c0: 546 */ 0xEF /* 'o' -> */,
-/* pos 03c1: 547 */ 0xEF /* 'o' -> */,
-/* pos 03c2: 548 */ 0xEB /* 'k' -> */,
-/* pos 03c3: 549 */ 0xE9 /* 'i' -> */,
-/* pos 03c4: 550 */ 0xE5 /* 'e' -> */,
-/* pos 03c5: 551 */ 0xBA /* ':' -> */,
-/* pos 03c6: 552 */ 0x00, 0x42 /* - terminal marker 66 - */,
-/* pos 03c8: 553 */ 0xF2 /* 'r' -> */,
-/* pos 03c9: 554 */ 0xE9 /* 'i' -> */,
-/* pos 03ca: 555 */ 0xE3 /* 'c' -> */,
-/* pos 03cb: 556 */ 0xF4 /* 't' -> */,
-/* pos 03cc: 557 */ 0xAD /* '-' -> */,
-/* pos 03cd: 558 */ 0xF4 /* 't' -> */,
-/* pos 03ce: 559 */ 0xF2 /* 'r' -> */,
-/* pos 03cf: 560 */ 0xE1 /* 'a' -> */,
-/* pos 03d0: 561 */ 0xEE /* 'n' -> */,
-/* pos 03d1: 562 */ 0xF3 /* 's' -> */,
-/* pos 03d2: 563 */ 0xF0 /* 'p' -> */,
-/* pos 03d3: 564 */ 0xEF /* 'o' -> */,
-/* pos 03d4: 565 */ 0xF2 /* 'r' -> */,
-/* pos 03d5: 566 */ 0xF4 /* 't' -> */,
-/* pos 03d6: 567 */ 0xAD /* '-' -> */,
-/* pos 03d7: 568 */ 0xF3 /* 's' -> */,
-/* pos 03d8: 569 */ 0xE5 /* 'e' -> */,
-/* pos 03d9: 570 */ 0xE3 /* 'c' -> */,
-/* pos 03da: 571 */ 0xF5 /* 'u' -> */,
-/* pos 03db: 572 */ 0xF2 /* 'r' -> */,
-/* pos 03dc: 573 */ 0xE9 /* 'i' -> */,
-/* pos 03dd: 574 */ 0xF4 /* 't' -> */,
-/* pos 03de: 575 */ 0xF9 /* 'y' -> */,
-/* pos 03df: 576 */ 0xBA /* ':' -> */,
-/* pos 03e0: 577 */ 0x00, 0x43 /* - terminal marker 67 - */,
-/* pos 03e2: 578 */ 0x72 /* 'r' */, 0x07, 0x00 /* (to 0x03E9 state 579) */,
- 0x65 /* 'e' */, 0x84, 0x00 /* (to 0x0469 state 680) */,
- 0x08, /* fail */
-/* pos 03e9: 579 */ 0xE1 /* 'a' -> */,
-/* pos 03ea: 580 */ 0xEE /* 'n' -> */,
-/* pos 03eb: 581 */ 0xF3 /* 's' -> */,
-/* pos 03ec: 582 */ 0xE6 /* 'f' -> */,
-/* pos 03ed: 583 */ 0xE5 /* 'e' -> */,
-/* pos 03ee: 584 */ 0xF2 /* 'r' -> */,
-/* pos 03ef: 585 */ 0xAD /* '-' -> */,
-/* pos 03f0: 586 */ 0xE5 /* 'e' -> */,
-/* pos 03f1: 587 */ 0xEE /* 'n' -> */,
-/* pos 03f2: 588 */ 0xE3 /* 'c' -> */,
-/* pos 03f3: 589 */ 0xEF /* 'o' -> */,
-/* pos 03f4: 590 */ 0xE4 /* 'd' -> */,
-/* pos 03f5: 591 */ 0xE9 /* 'i' -> */,
-/* pos 03f6: 592 */ 0xEE /* 'n' -> */,
-/* pos 03f7: 593 */ 0xE7 /* 'g' -> */,
-/* pos 03f8: 594 */ 0xBA /* ':' -> */,
-/* pos 03f9: 595 */ 0x00, 0x44 /* - terminal marker 68 - */,
-/* pos 03fb: 596 */ 0xE5 /* 'e' -> */,
-/* pos 03fc: 597 */ 0xF2 /* 'r' -> */,
-/* pos 03fd: 598 */ 0xAD /* '-' -> */,
-/* pos 03fe: 599 */ 0xE1 /* 'a' -> */,
-/* pos 03ff: 600 */ 0xE7 /* 'g' -> */,
-/* pos 0400: 601 */ 0xE5 /* 'e' -> */,
-/* pos 0401: 602 */ 0xEE /* 'n' -> */,
-/* pos 0402: 603 */ 0xF4 /* 't' -> */,
-/* pos 0403: 604 */ 0xBA /* ':' -> */,
-/* pos 0404: 605 */ 0x00, 0x45 /* - terminal marker 69 - */,
-/* pos 0406: 606 */ 0x61 /* 'a' */, 0x07, 0x00 /* (to 0x040D state 607) */,
- 0x69 /* 'i' */, 0x09, 0x00 /* (to 0x0412 state 611) */,
- 0x08, /* fail */
-/* pos 040d: 607 */ 0xF2 /* 'r' -> */,
-/* pos 040e: 608 */ 0xF9 /* 'y' -> */,
-/* pos 040f: 609 */ 0xBA /* ':' -> */,
-/* pos 0410: 610 */ 0x00, 0x46 /* - terminal marker 70 - */,
-/* pos 0412: 611 */ 0xE1 /* 'a' -> */,
-/* pos 0413: 612 */ 0xBA /* ':' -> */,
-/* pos 0414: 613 */ 0x00, 0x47 /* - terminal marker 71 - */,
-/* pos 0416: 614 */ 0xF7 /* 'w' -> */,
-/* pos 0417: 615 */ 0xF7 /* 'w' -> */,
-/* pos 0418: 616 */ 0xAD /* '-' -> */,
-/* pos 0419: 617 */ 0xE1 /* 'a' -> */,
-/* pos 041a: 618 */ 0xF5 /* 'u' -> */,
-/* pos 041b: 619 */ 0xF4 /* 't' -> */,
-/* pos 041c: 620 */ 0xE8 /* 'h' -> */,
-/* pos 041d: 621 */ 0xE5 /* 'e' -> */,
-/* pos 041e: 622 */ 0xEE /* 'n' -> */,
-/* pos 041f: 623 */ 0xF4 /* 't' -> */,
-/* pos 0420: 624 */ 0xE9 /* 'i' -> */,
-/* pos 0421: 625 */ 0xE3 /* 'c' -> */,
-/* pos 0422: 626 */ 0xE1 /* 'a' -> */,
-/* pos 0423: 627 */ 0xF4 /* 't' -> */,
-/* pos 0424: 628 */ 0xE5 /* 'e' -> */,
-/* pos 0425: 629 */ 0xBA /* ':' -> */,
-/* pos 0426: 630 */ 0x00, 0x48 /* - terminal marker 72 - */,
-/* pos 0428: 631 */ 0xF4 /* 't' -> */,
-/* pos 0429: 632 */ 0xE3 /* 'c' -> */,
-/* pos 042a: 633 */ 0xE8 /* 'h' -> */,
-/* pos 042b: 634 */ 0x00, 0x49 /* - terminal marker 73 - */,
-/* pos 042d: 635 */ 0xF4 /* 't' -> */,
-/* pos 042e: 636 */ 0x00, 0x4A /* - terminal marker 74 - */,
-/* pos 0430: 637 */ 0xEC /* 'l' -> */,
-/* pos 0431: 638 */ 0xE5 /* 'e' -> */,
-/* pos 0432: 639 */ 0xF4 /* 't' -> */,
-/* pos 0433: 640 */ 0xE5 /* 'e' -> */,
-/* pos 0434: 641 */ 0x00, 0x4B /* - terminal marker 75 - */,
-/* pos 0436: 642 */ 0xE9 /* 'i' -> */,
-/* pos 0437: 643 */ 0xAD /* '-' -> */,
-/* pos 0438: 644 */ 0xE1 /* 'a' -> */,
-/* pos 0439: 645 */ 0xF2 /* 'r' -> */,
-/* pos 043a: 646 */ 0xE7 /* 'g' -> */,
-/* pos 043b: 647 */ 0xF3 /* 's' -> */,
-/* pos 043c: 648 */ 0x00, 0x4C /* - terminal marker 76 - */,
-/* pos 043e: 649 */ 0x00, 0x4D /* - terminal marker 77 - */,
-/* pos 0440: 650 */ 0xAD /* '-' -> */,
-/* pos 0441: 651 */ 0x72 /* 'r' */, 0x07, 0x00 /* (to 0x0448 state 652) */,
- 0x66 /* 'f' */, 0x10, 0x00 /* (to 0x0454 state 662) */,
- 0x08, /* fail */
-/* pos 0448: 652 */ 0xE5 /* 'e' -> */,
-/* pos 0449: 653 */ 0xE1 /* 'a' -> */,
-/* pos 044a: 654 */ 0xEC /* 'l' -> */,
-/* pos 044b: 655 */ 0xAD /* '-' -> */,
-/* pos 044c: 656 */ 0xE9 /* 'i' -> */,
-/* pos 044d: 657 */ 0xF0 /* 'p' -> */,
-/* pos 044e: 658 */ 0xBA /* ':' -> */,
-/* pos 044f: 659 */ 0x00, 0x4E /* - terminal marker 78 - */,
-/* pos 0451: 660 */ 0xA0 /* ' ' -> */,
-/* pos 0452: 661 */ 0x00, 0x4F /* - terminal marker 79 - */,
-/* pos 0454: 662 */ 0xEF /* 'o' -> */,
-/* pos 0455: 663 */ 0xF2 /* 'r' -> */,
-/* pos 0456: 664 */ 0xF7 /* 'w' -> */,
-/* pos 0457: 665 */ 0xE1 /* 'a' -> */,
-/* pos 0458: 666 */ 0xF2 /* 'r' -> */,
-/* pos 0459: 667 */ 0xE4 /* 'd' -> */,
-/* pos 045a: 668 */ 0xE5 /* 'e' -> */,
-/* pos 045b: 669 */ 0xE4 /* 'd' -> */,
-/* pos 045c: 670 */ 0xAD /* '-' -> */,
-/* pos 045d: 671 */ 0xE6 /* 'f' -> */,
-/* pos 045e: 672 */ 0xEF /* 'o' -> */,
-/* pos 045f: 673 */ 0xF2 /* 'r' -> */,
-/* pos 0460: 674 */ 0x00, 0x50 /* - terminal marker 80 - */,
-/* pos 0462: 675 */ 0x00, 0x51 /* - terminal marker 81 - */,
-/* pos 0464: 676 */ 0xE1 /* 'a' -> */,
-/* pos 0465: 677 */ 0xE4 /* 'd' -> */,
-/* pos 0466: 678 */ 0xA0 /* ' ' -> */,
-/* pos 0467: 679 */ 0x00, 0x52 /* - terminal marker 82 - */,
-/* pos 0469: 680 */ 0xBA /* ':' -> */,
-/* pos 046a: 681 */ 0x00, 0x53 /* - terminal marker 83 - */,
-/* total size 1132 bytes */
diff --git a/thirdparty/lws/minilex.c b/thirdparty/lws/minilex.c
deleted file mode 100644
index 3cb1e33696..0000000000
--- a/thirdparty/lws/minilex.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * minilex.c
- *
- * High efficiency lexical state parser
- *
- * Copyright (C)2011-2014 Andy Green <andy@warmcat.com>
- *
- * Licensed under LGPL2
- *
- * Usage: gcc minilex.c -o minilex && ./minilex > lextable.h
- *
- * Run it twice to test parsing on the generated table on stderr
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lextable-strings.h"
-
-/*
- * b7 = 0 = 1-byte seq
- * 0x08 = fail
- * 2-byte seq
- * 0x00 - 0x07, then terminal as given in 2nd byte
- 3-byte seq
- * no match: go fwd 3 byte, match: jump fwd by amt in +1/+2 bytes
- * = 1 = 1-byte seq
- * no match: die, match go fwd 1 byte
- */
-
-unsigned char lextable[] = {
- #include "lextable.h"
-};
-
-#define PARALLEL 30
-
-struct state {
- char c[PARALLEL];
- int state[PARALLEL];
- int count;
- int bytepos;
-
- int real_pos;
-};
-
-struct state state[1000];
-int next = 1;
-
-#define FAIL_CHAR 0x08
-
-int lextable_decode(int pos, char c)
-{
- while (1) {
- if (lextable[pos] & (1 << 7)) { /* 1-byte, fail on mismatch */
- if ((lextable[pos] & 0x7f) != c)
- return -1;
- /* fall thru */
- pos++;
- if (lextable[pos] == FAIL_CHAR)
- return -1;
- return pos;
- } else { /* b7 = 0, end or 3-byte */
- if (lextable[pos] < FAIL_CHAR) /* terminal marker */
- return pos;
-
- if (lextable[pos] == c) /* goto */
- return pos + (lextable[pos + 1]) +
- (lextable[pos + 2] << 8);
- /* fall thru goto */
- pos += 3;
- /* continue */
- }
- }
-}
-
-int main(void)
-{
- int n = 0;
- int m = 0;
- int prev;
- char c;
- int walk;
- int saw;
- int y;
- int j;
- int pos = 0;
-
- while (n < sizeof(set) / sizeof(set[0])) {
-
- m = 0;
- walk = 0;
- prev = 0;
-
- if (set[n][0] == '\0') {
- n++;
- continue;
- }
-
- while (set[n][m]) {
-
- saw = 0;
- for (y = 0; y < state[walk].count; y++)
- if (state[walk].c[y] == set[n][m]) {
- /* exists -- go forward */
- walk = state[walk].state[y];
- saw = 1;
- break;
- }
-
- if (saw)
- goto again;
-
- /* something we didn't see before */
-
- state[walk].c[state[walk].count] = set[n][m];
-
- state[walk].state[state[walk].count] = next;
- state[walk].count++;
- walk = next++;
-again:
- m++;
- }
-
- state[walk].c[0] = n++;
- state[walk].state[0] = 0; /* terminal marker */
- state[walk].count = 1;
- }
-
- walk = 0;
- for (n = 0; n < next; n++) {
- state[n].bytepos = walk;
- walk += (2 * state[n].count);
- }
-
- /* compute everyone's position first */
-
- pos = 0;
- walk = 0;
- for (n = 0; n < next; n++) {
-
- state[n].real_pos = pos;
-
- for (m = 0; m < state[n].count; m++) {
-
- if (state[n].state[m] == 0)
- pos += 2; /* terminal marker */
- else { /* c is a character */
- if ((state[state[n].state[m]].bytepos -
- walk) == 2)
- pos++;
- else {
- pos += 3;
- if (m == state[n].count - 1)
- pos++; /* fail */
- }
- }
- walk += 2;
- }
- }
-
- walk = 0;
- pos = 0;
- for (n = 0; n < next; n++) {
- for (m = 0; m < state[n].count; m++) {
-
- if (!m)
- fprintf(stdout, "/* pos %04x: %3d */ ",
- state[n].real_pos, n);
- else
- fprintf(stdout, " ");
-
- y = state[n].c[m];
- saw = state[n].state[m];
-
- if (saw == 0) { // c is a terminal then
-
- if (y > 0x7ff) {
- fprintf(stderr, "terminal too big\n");
- return 2;
- }
-
- fprintf(stdout, " 0x%02X, 0x%02X "
- " "
- "/* - terminal marker %2d - */,\n",
- y >> 8, y & 0xff, y & 0x7f);
- pos += 2;
- walk += 2;
- continue;
- }
-
- /* c is a character */
-
- prev = y &0x7f;
- if (prev < 32 || prev > 126)
- prev = '.';
-
-
- if ((state[saw].bytepos - walk) == 2) {
- fprintf(stdout, " 0x%02X /* '%c' -> */,\n",
- y | 0x80, prev);
- pos++;
- walk += 2;
- continue;
- }
-
- j = state[saw].real_pos - pos;
-
- if (j > 0xffff) {
- fprintf(stderr,
- "Jump > 64K bytes ahead (%d to %d)\n",
- state[n].real_pos, state[saw].real_pos);
- return 1;
- }
- fprintf(stdout, " 0x%02X /* '%c' */, 0x%02X, 0x%02X "
- "/* (to 0x%04X state %3d) */,\n",
- y, prev,
- j & 0xff, j >> 8,
- state[saw].real_pos, saw);
- pos += 3;
-
- if (m == state[n].count - 1) {
- fprintf(stdout,
- " 0x%02X, /* fail */\n",
- FAIL_CHAR);
- pos++; /* fail */
- }
-
- walk += 2;
- }
- }
-
- fprintf(stdout, "/* total size %d bytes */\n", pos);
-
- /*
- * Try to parse every legal input string
- */
-
- for (n = 0; n < sizeof(set) / sizeof(set[0]); n++) {
- walk = 0;
- m = 0;
- y = -1;
-
- if (set[n][0] == '\0')
- continue;
-
- fprintf(stderr, " trying '%s'\n", set[n]);
-
- while (set[n][m]) {
- walk = lextable_decode(walk, set[n][m]);
- if (walk < 0) {
- fprintf(stderr, "failed\n");
- return 3;
- }
-
- if (lextable[walk] < FAIL_CHAR) {
- y = (lextable[walk] << 8) + lextable[walk + 1];
- break;
- }
- m++;
- }
-
- if (y != n) {
- fprintf(stderr, "decode failed %d\n", y);
- return 4;
- }
- }
-
- fprintf(stderr, "All decode OK\n");
-
- return 0;
-}
diff --git a/thirdparty/lws/misc/lejp.h b/thirdparty/lws/misc/lejp.h
deleted file mode 100644
index 0b37bb3e42..0000000000
--- a/thirdparty/lws/misc/lejp.h
+++ /dev/null
@@ -1,232 +0,0 @@
-#include "libwebsockets.h"
-struct lejp_ctx;
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
-#endif
-#define LEJP_FLAG_WS_KEEP 64
-#define LEJP_FLAG_WS_COMMENTLINE 32
-
-enum lejp_states {
- LEJP_IDLE = 0,
- LEJP_MEMBERS = 1,
- LEJP_M_P = 2,
- LEJP_MP_STRING = LEJP_FLAG_WS_KEEP | 3,
- LEJP_MP_STRING_ESC = LEJP_FLAG_WS_KEEP | 4,
- LEJP_MP_STRING_ESC_U1 = LEJP_FLAG_WS_KEEP | 5,
- LEJP_MP_STRING_ESC_U2 = LEJP_FLAG_WS_KEEP | 6,
- LEJP_MP_STRING_ESC_U3 = LEJP_FLAG_WS_KEEP | 7,
- LEJP_MP_STRING_ESC_U4 = LEJP_FLAG_WS_KEEP | 8,
- LEJP_MP_DELIM = 9,
- LEJP_MP_VALUE = 10,
- LEJP_MP_VALUE_NUM_INT = LEJP_FLAG_WS_KEEP | 11,
- LEJP_MP_VALUE_NUM_EXP = LEJP_FLAG_WS_KEEP | 12,
- LEJP_MP_VALUE_TOK = LEJP_FLAG_WS_KEEP | 13,
- LEJP_MP_COMMA_OR_END = 14,
- LEJP_MP_ARRAY_END = 15,
-};
-
-enum lejp_reasons {
- LEJP_CONTINUE = -1,
- LEJP_REJECT_IDLE_NO_BRACE = -2,
- LEJP_REJECT_MEMBERS_NO_CLOSE = -3,
- LEJP_REJECT_MP_NO_OPEN_QUOTE = -4,
- LEJP_REJECT_MP_STRING_UNDERRUN = -5,
- LEJP_REJECT_MP_ILLEGAL_CTRL = -6,
- LEJP_REJECT_MP_STRING_ESC_ILLEGAL_ESC = -7,
- LEJP_REJECT_ILLEGAL_HEX = -8,
- LEJP_REJECT_MP_DELIM_MISSING_COLON = -9,
- LEJP_REJECT_MP_DELIM_BAD_VALUE_START = -10,
- LEJP_REJECT_MP_VAL_NUM_INT_NO_FRAC = -11,
- LEJP_REJECT_MP_VAL_NUM_FORMAT = -12,
- LEJP_REJECT_MP_VAL_NUM_EXP_BAD_EXP = -13,
- LEJP_REJECT_MP_VAL_TOK_UNKNOWN = -14,
- LEJP_REJECT_MP_C_OR_E_UNDERF = -15,
- LEJP_REJECT_MP_C_OR_E_NOTARRAY = -16,
- LEJP_REJECT_MP_ARRAY_END_MISSING = -17,
- LEJP_REJECT_STACK_OVERFLOW = -18,
- LEJP_REJECT_MP_DELIM_ISTACK = -19,
- LEJP_REJECT_NUM_TOO_LONG = -20,
- LEJP_REJECT_MP_C_OR_E_NEITHER = -21,
- LEJP_REJECT_UNKNOWN = -22,
- LEJP_REJECT_CALLBACK = -23
-};
-
-#define LEJP_FLAG_CB_IS_VALUE 64
-
-enum lejp_callbacks {
- LEJPCB_CONSTRUCTED = 0,
- LEJPCB_DESTRUCTED = 1,
-
- LEJPCB_START = 2,
- LEJPCB_COMPLETE = 3,
- LEJPCB_FAILED = 4,
-
- LEJPCB_PAIR_NAME = 5,
-
- LEJPCB_VAL_TRUE = LEJP_FLAG_CB_IS_VALUE | 6,
- LEJPCB_VAL_FALSE = LEJP_FLAG_CB_IS_VALUE | 7,
- LEJPCB_VAL_NULL = LEJP_FLAG_CB_IS_VALUE | 8,
- LEJPCB_VAL_NUM_INT = LEJP_FLAG_CB_IS_VALUE | 9,
- LEJPCB_VAL_NUM_FLOAT = LEJP_FLAG_CB_IS_VALUE | 10,
- LEJPCB_VAL_STR_START = 11, /* notice handle separately */
- LEJPCB_VAL_STR_CHUNK = LEJP_FLAG_CB_IS_VALUE | 12,
- LEJPCB_VAL_STR_END = LEJP_FLAG_CB_IS_VALUE | 13,
-
- LEJPCB_ARRAY_START = 14,
- LEJPCB_ARRAY_END = 15,
-
- LEJPCB_OBJECT_START = 16,
- LEJPCB_OBJECT_END = 17
-};
-
-/**
- * _lejp_callback() - User parser actions
- * \param ctx: LEJP context
- * \param reason: Callback reason
- *
- * Your user callback is associated with the context at construction time,
- * and receives calls as the parsing progresses.
- *
- * All of the callbacks may be ignored and just return 0.
- *
- * The reasons it might get called, found in @reason, are:
- *
- * LEJPCB_CONSTRUCTED: The context was just constructed... you might want to
- * perform one-time allocation for the life of the context.
- *
- * LEJPCB_DESTRUCTED: The context is being destructed... if you made any
- * allocations at construction-time, you can free them now
- *
- * LEJPCB_START: Parsing is beginning at the first byte of input
- *
- * LEJPCB_COMPLETE: Parsing has completed successfully. You'll get a 0 or
- * positive return code from lejp_parse indicating the
- * amount of unused bytes left in the input buffer
- *
- * LEJPCB_FAILED: Parsing failed. You'll get a negative error code
- * returned from lejp_parse
- *
- * LEJPCB_PAIR_NAME: When a "name":"value" pair has had the name parsed,
- * this callback occurs. You can find the new name at
- * the end of ctx->path[]
- *
- * LEJPCB_VAL_TRUE: The "true" value appeared
- *
- * LEJPCB_VAL_FALSE: The "false" value appeared
- *
- * LEJPCB_VAL_NULL: The "null" value appeared
- *
- * LEJPCB_VAL_NUM_INT: A string representing an integer is in ctx->buf
- *
- * LEJPCB_VAL_NUM_FLOAT: A string representing a float is in ctx->buf
- *
- * LEJPCB_VAL_STR_START: We are starting to parse a string, no data yet
- *
- * LEJPCB_VAL_STR_CHUNK: We parsed LEJP_STRING_CHUNK -1 bytes of string data in
- * ctx->buf, which is as much as we can buffer, so we are
- * spilling it. If all your strings are less than
- * LEJP_STRING_CHUNK - 1 bytes, you will never see this
- * callback.
- *
- * LEJPCB_VAL_STR_END: String parsing has completed, the last chunk of the
- * string is in ctx->buf.
- *
- * LEJPCB_ARRAY_START: An array started
- *
- * LEJPCB_ARRAY_END: An array ended
- *
- * LEJPCB_OBJECT_START: An object started
- *
- * LEJPCB_OBJECT_END: An object ended
- */
-LWS_EXTERN signed char _lejp_callback(struct lejp_ctx *ctx, char reason);
-
-typedef signed char (*lejp_callback)(struct lejp_ctx *ctx, char reason);
-
-#ifndef LEJP_MAX_DEPTH
-#define LEJP_MAX_DEPTH 12
-#endif
-#ifndef LEJP_MAX_INDEX_DEPTH
-#define LEJP_MAX_INDEX_DEPTH 5
-#endif
-#ifndef LEJP_MAX_PATH
-#define LEJP_MAX_PATH 128
-#endif
-#ifndef LEJP_STRING_CHUNK
-/* must be >= 30 to assemble floats */
-#define LEJP_STRING_CHUNK 255
-#endif
-
-enum num_flags {
- LEJP_SEEN_MINUS = (1 << 0),
- LEJP_SEEN_POINT = (1 << 1),
- LEJP_SEEN_POST_POINT = (1 << 2),
- LEJP_SEEN_EXP = (1 << 3)
-};
-
-struct _lejp_stack {
- char s; /* lejp_state stack*/
- char p; /* path length */
- char i; /* index array length */
- char b; /* user bitfield */
-};
-
-struct lejp_ctx {
-
- /* sorted by type for most compact alignment
- *
- * pointers
- */
-
- signed char (*callback)(struct lejp_ctx *ctx, char reason);
- void *user;
- const char * const *paths;
-
- /* arrays */
-
- struct _lejp_stack st[LEJP_MAX_DEPTH];
- unsigned short i[LEJP_MAX_INDEX_DEPTH]; /* index array */
- unsigned short wild[LEJP_MAX_INDEX_DEPTH]; /* index array */
- char path[LEJP_MAX_PATH];
- char buf[LEJP_STRING_CHUNK];
-
- /* int */
-
- unsigned int line;
-
- /* short */
-
- unsigned short uni;
-
- /* char */
-
- unsigned char npos;
- unsigned char dcount;
- unsigned char f;
- unsigned char sp; /* stack head */
- unsigned char ipos; /* index stack depth */
- unsigned char ppos;
- unsigned char count_paths;
- unsigned char path_match;
- unsigned char path_match_len;
- unsigned char wildcount;
-};
-
-LWS_VISIBLE LWS_EXTERN void
-lejp_construct(struct lejp_ctx *ctx,
- signed char (*callback)(struct lejp_ctx *ctx, char reason),
- void *user, const char * const *paths, unsigned char paths_count);
-
-LWS_VISIBLE LWS_EXTERN void
-lejp_destruct(struct lejp_ctx *ctx);
-
-LWS_VISIBLE LWS_EXTERN int
-lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len);
-
-LWS_VISIBLE LWS_EXTERN void
-lejp_change_callback(struct lejp_ctx *ctx,
- signed char (*callback)(struct lejp_ctx *ctx, char reason));
-
-LWS_VISIBLE LWS_EXTERN int
-lejp_get_wildcard(struct lejp_ctx *ctx, int wildcard, char *dest, int len);
diff --git a/thirdparty/lws/output.c b/thirdparty/lws/output.c
deleted file mode 100644
index ed4752490e..0000000000
--- a/thirdparty/lws/output.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-static int
-lws_0405_frame_mask_generate(struct lws *wsi)
-{
-#if 0
- wsi->u.ws.mask[0] = 0;
- wsi->u.ws.mask[1] = 0;
- wsi->u.ws.mask[2] = 0;
- wsi->u.ws.mask[3] = 0;
-#else
- int n;
- /* fetch the per-frame nonce */
-
- n = lws_get_random(lws_get_context(wsi), wsi->u.ws.mask, 4);
- if (n != 4) {
- lwsl_parser("Unable to read from random device %s %d\n",
- SYSTEM_RANDOM_FILEPATH, n);
- return 1;
- }
-#endif
- /* start masking from first byte of masking key buffer */
- wsi->u.ws.mask_idx = 0;
-
- return 0;
-}
-
-/*
- * notice this returns number of bytes consumed, or -1
- */
-int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
-{
- struct lws_context *context = lws_get_context(wsi);
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- size_t real_len = len;
- unsigned int n;
- int m;
-
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_WRITE, 1);
-
- if (!len)
- return 0;
- /* just ignore sends after we cleared the truncation buffer */
- if (wsi->state == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE &&
- !wsi->trunc_len)
- return len;
-
- if (wsi->trunc_len && (buf < wsi->trunc_alloc ||
- buf > (wsi->trunc_alloc + wsi->trunc_len + wsi->trunc_offset))) {
- char dump[20];
- strncpy(dump, (char *)buf, sizeof(dump) - 1);
- dump[sizeof(dump) - 1] = '\0';
-#if defined(LWS_WITH_ESP8266)
- lwsl_err("****** %p: Sending new %lu (%s), pending truncated ...\n",
- wsi, (unsigned long)len, dump);
-#else
- lwsl_err("****** %p: Sending new %lu (%s), pending truncated ...\n"
- " It's illegal to do an lws_write outside of\n"
- " the writable callback: fix your code\n",
- wsi, (unsigned long)len, dump);
-#endif
- assert(0);
-
- return -1;
- }
-
- m = lws_ext_cb_active(wsi, LWS_EXT_CB_PACKET_TX_DO_SEND, &buf, len);
- if (m < 0)
- return -1;
- if (m) /* handled */ {
- n = m;
- goto handle_truncated_send;
- }
-
- if (!wsi->http2_substream && !lws_socket_is_valid(wsi->desc.sockfd))
- lwsl_warn("** error invalid sock but expected to send\n");
-
- /* limit sending */
- if (wsi->protocol->tx_packet_size)
- n = wsi->protocol->tx_packet_size;
- else {
- n = wsi->protocol->rx_buffer_size;
- if (!n)
- n = context->pt_serv_buf_size;
- }
- n += LWS_PRE + 4;
- if (n > len)
- n = len;
-#if defined(LWS_WITH_ESP8266)
- if (wsi->pending_send_completion) {
- n = 0;
- goto handle_truncated_send;
- }
-#endif
-
- /* nope, send it on the socket directly */
- lws_latency_pre(context, wsi);
- n = lws_ssl_capable_write(wsi, buf, n);
- lws_latency(context, wsi, "send lws_issue_raw", n, n == len);
-
- switch (n) {
- case LWS_SSL_CAPABLE_ERROR:
- /* we're going to close, let close know sends aren't possible */
- wsi->socket_is_permanently_unusable = 1;
- return -1;
- case LWS_SSL_CAPABLE_MORE_SERVICE:
- /* nothing got sent, not fatal, retry the whole thing later */
- n = 0;
- break;
- }
-
-handle_truncated_send:
- /*
- * we were already handling a truncated send?
- */
- if (wsi->trunc_len) {
- lwsl_info("%p partial adv %d (vs %ld)\n", wsi, n, (long)real_len);
- wsi->trunc_offset += n;
- wsi->trunc_len -= n;
-
- if (!wsi->trunc_len) {
- lwsl_info("***** %p partial send completed\n", wsi);
- /* done with it, but don't free it */
- n = real_len;
- if (wsi->state == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
- lwsl_info("***** %p signalling to close now\n", wsi);
- return -1; /* retry closing now */
- }
- }
- /* always callback on writeable */
- lws_callback_on_writable(wsi);
-
- return n;
- }
-
- if ((unsigned int)n == real_len)
- /* what we just sent went out cleanly */
- return n;
-
- /*
- * Newly truncated send. Buffer the remainder (it will get
- * first priority next time the socket is writable)
- */
- lwsl_debug("%p new partial sent %d from %lu total\n", wsi, n,
- (unsigned long)real_len);
-
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITE_PARTIALS, 1);
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_B_PARTIALS_ACCEPTED_PARTS, n);
-
- /*
- * - if we still have a suitable malloc lying around, use it
- * - or, if too small, reallocate it
- * - or, if no buffer, create it
- */
- if (!wsi->trunc_alloc || real_len - n > wsi->trunc_alloc_len) {
- lws_free(wsi->trunc_alloc);
-
- wsi->trunc_alloc_len = real_len - n;
- wsi->trunc_alloc = lws_malloc(real_len - n, "truncated send alloc");
- if (!wsi->trunc_alloc) {
- lwsl_err("truncated send: unable to malloc %lu\n",
- (unsigned long)(real_len - n));
- return -1;
- }
- }
- wsi->trunc_offset = 0;
- wsi->trunc_len = real_len - n;
- memcpy(wsi->trunc_alloc, buf + n, real_len - n);
-
- /* since something buffered, force it to get another chance to send */
- lws_callback_on_writable(wsi);
-
- return real_len;
-}
-
-LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len,
- enum lws_write_protocol wp)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- int masked7 = (wsi->mode == LWSCM_WS_CLIENT);
- unsigned char is_masked_bit = 0;
- unsigned char *dropmask = NULL;
- struct lws_tokens eff_buf;
- size_t orig_len = len;
- int pre = 0, n;
-
- if (wsi->parent_carries_io) {
- struct lws_write_passthru pas;
-
- pas.buf = buf;
- pas.len = len;
- pas.wp = wp;
- pas.wsi = wsi;
-
- if (wsi->parent->protocol->callback(wsi->parent,
- LWS_CALLBACK_CHILD_WRITE_VIA_PARENT,
- wsi->parent->user_space,
- (void *)&pas, 0))
- return 1;
-
- return len;
- }
-
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_API_LWS_WRITE, 1);
-
- if ((int)len < 0) {
- lwsl_err("%s: suspicious len int %d, ulong %lu\n", __func__,
- (int)len, (unsigned long)len);
- return -1;
- }
-
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_B_WRITE, len);
-
-#ifdef LWS_WITH_ACCESS_LOG
- wsi->access_log.sent += len;
-#endif
- if (wsi->vhost)
- wsi->vhost->conn_stats.tx += len;
-
- if (wsi->state == LWSS_ESTABLISHED && wsi->u.ws.tx_draining_ext) {
- /* remove us from the list */
- struct lws **w = &pt->tx_draining_ext_list;
-
- wsi->u.ws.tx_draining_ext = 0;
- /* remove us from context draining ext list */
- while (*w) {
- if (*w == wsi) {
- *w = wsi->u.ws.tx_draining_ext_list;
- break;
- }
- w = &((*w)->u.ws.tx_draining_ext_list);
- }
- wsi->u.ws.tx_draining_ext_list = NULL;
- wp = (wsi->u.ws.tx_draining_stashed_wp & 0xc0) |
- LWS_WRITE_CONTINUATION;
-
- lwsl_ext("FORCED draining wp to 0x%02X\n", wp);
- }
-
- lws_restart_ws_ping_pong_timer(wsi);
-
- if ((wp & 0x1f) == LWS_WRITE_HTTP ||
- (wp & 0x1f) == LWS_WRITE_HTTP_FINAL ||
- (wp & 0x1f) == LWS_WRITE_HTTP_HEADERS_CONTINUATION ||
- (wp & 0x1f) == LWS_WRITE_HTTP_HEADERS)
- goto send_raw;
-
- /* if not in a state to send stuff, then just send nothing */
-
- if (wsi->state != LWSS_ESTABLISHED &&
- ((wsi->state != LWSS_RETURNED_CLOSE_ALREADY &&
- wsi->state != LWSS_AWAITING_CLOSE_ACK) ||
- wp != LWS_WRITE_CLOSE))
- return 0;
-
- /* if we are continuing a frame that already had its header done */
-
- if (wsi->u.ws.inside_frame) {
- lwsl_debug("INSIDE FRAME\n");
- goto do_more_inside_frame;
- }
-
- wsi->u.ws.clean_buffer = 1;
-
- /*
- * give a chance to the extensions to modify payload
- * the extension may decide to produce unlimited payload erratically
- * (eg, compression extension), so we require only that if he produces
- * something, it will be a complete fragment of the length known at
- * the time (just the fragment length known), and if he has
- * more we will come back next time he is writeable and allow him to
- * produce more fragments until he's drained.
- *
- * This allows what is sent each time it is writeable to be limited to
- * a size that can be sent without partial sends or blocking, allows
- * interleaving of control frames and other connection service.
- */
- eff_buf.token = (char *)buf;
- eff_buf.token_len = len;
-
- switch ((int)wp) {
- case LWS_WRITE_PING:
- case LWS_WRITE_PONG:
- case LWS_WRITE_CLOSE:
- break;
- default:
- lwsl_debug("LWS_EXT_CB_PAYLOAD_TX\n");
- n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_TX, &eff_buf, wp);
- if (n < 0)
- return -1;
-
- if (n && eff_buf.token_len) {
- lwsl_debug("drain len %d\n", (int)eff_buf.token_len);
- /* extension requires further draining */
- wsi->u.ws.tx_draining_ext = 1;
- wsi->u.ws.tx_draining_ext_list = pt->tx_draining_ext_list;
- pt->tx_draining_ext_list = wsi;
- /* we must come back to do more */
- lws_callback_on_writable(wsi);
- /*
- * keep a copy of the write type for the overall
- * action that has provoked generation of these
- * fragments, so the last guy can use its FIN state.
- */
- wsi->u.ws.tx_draining_stashed_wp = wp;
- /* this is definitely not actually the last fragment
- * because the extension asserted he has more coming
- * So make sure this intermediate one doesn't go out
- * with a FIN.
- */
- wp |= LWS_WRITE_NO_FIN;
- }
-
- if (eff_buf.token_len && wsi->u.ws.stashed_write_pending) {
- wsi->u.ws.stashed_write_pending = 0;
- wp = (wp &0xc0) | (int)wsi->u.ws.stashed_write_type;
- }
- }
-
- /*
- * an extension did something we need to keep... for example, if
- * compression extension, it has already updated its state according
- * to this being issued
- */
- if ((char *)buf != eff_buf.token) {
- /*
- * ext might eat it, but not have anything to issue yet.
- * In that case we have to follow his lead, but stash and
- * replace the write type that was lost here the first time.
- */
- if (len && !eff_buf.token_len) {
- if (!wsi->u.ws.stashed_write_pending)
- wsi->u.ws.stashed_write_type = (char)wp & 0x3f;
- wsi->u.ws.stashed_write_pending = 1;
- return len;
- }
- /*
- * extension recreated it:
- * need to buffer this if not all sent
- */
- wsi->u.ws.clean_buffer = 0;
- }
-
- buf = (unsigned char *)eff_buf.token;
- len = eff_buf.token_len;
-
- if (!buf) {
- lwsl_err("null buf (%d)\n", (int)len);
- return -1;
- }
-
- switch (wsi->ietf_spec_revision) {
- case 13:
- if (masked7) {
- pre += 4;
- dropmask = &buf[0 - pre];
- is_masked_bit = 0x80;
- }
-
- switch (wp & 0xf) {
- case LWS_WRITE_TEXT:
- n = LWSWSOPC_TEXT_FRAME;
- break;
- case LWS_WRITE_BINARY:
- n = LWSWSOPC_BINARY_FRAME;
- break;
- case LWS_WRITE_CONTINUATION:
- n = LWSWSOPC_CONTINUATION;
- break;
-
- case LWS_WRITE_CLOSE:
- n = LWSWSOPC_CLOSE;
- break;
- case LWS_WRITE_PING:
- n = LWSWSOPC_PING;
- break;
- case LWS_WRITE_PONG:
- n = LWSWSOPC_PONG;
- break;
- default:
- lwsl_warn("lws_write: unknown write opc / wp\n");
- return -1;
- }
-
- if (!(wp & LWS_WRITE_NO_FIN))
- n |= 1 << 7;
-
- if (len < 126) {
- pre += 2;
- buf[-pre] = n;
- buf[-pre + 1] = (unsigned char)(len | is_masked_bit);
- } else {
- if (len < 65536) {
- pre += 4;
- buf[-pre] = n;
- buf[-pre + 1] = 126 | is_masked_bit;
- buf[-pre + 2] = (unsigned char)(len >> 8);
- buf[-pre + 3] = (unsigned char)len;
- } else {
- pre += 10;
- buf[-pre] = n;
- buf[-pre + 1] = 127 | is_masked_bit;
-#if defined __LP64__
- buf[-pre + 2] = (len >> 56) & 0x7f;
- buf[-pre + 3] = len >> 48;
- buf[-pre + 4] = len >> 40;
- buf[-pre + 5] = len >> 32;
-#else
- buf[-pre + 2] = 0;
- buf[-pre + 3] = 0;
- buf[-pre + 4] = 0;
- buf[-pre + 5] = 0;
-#endif
- buf[-pre + 6] = (unsigned char)(len >> 24);
- buf[-pre + 7] = (unsigned char)(len >> 16);
- buf[-pre + 8] = (unsigned char)(len >> 8);
- buf[-pre + 9] = (unsigned char)len;
- }
- }
- break;
- }
-
-do_more_inside_frame:
-
- /*
- * Deal with masking if we are in client -> server direction and
- * the wp demands it
- */
-
- if (masked7) {
- if (!wsi->u.ws.inside_frame)
- if (lws_0405_frame_mask_generate(wsi)) {
- lwsl_err("frame mask generation failed\n");
- return -1;
- }
-
- /*
- * in v7, just mask the payload
- */
- if (dropmask) { /* never set if already inside frame */
- for (n = 4; n < (int)len + 4; n++)
- dropmask[n] = dropmask[n] ^ wsi->u.ws.mask[
- (wsi->u.ws.mask_idx++) & 3];
-
- /* copy the frame nonce into place */
- memcpy(dropmask, wsi->u.ws.mask, 4);
- }
- }
-
-send_raw:
- switch ((int)(wp & 0x1f)) {
- case LWS_WRITE_CLOSE:
-/* lwsl_hexdump(&buf[-pre], len); */
- case LWS_WRITE_HTTP:
- case LWS_WRITE_HTTP_FINAL:
- case LWS_WRITE_HTTP_HEADERS:
- case LWS_WRITE_HTTP_HEADERS_CONTINUATION:
- case LWS_WRITE_PONG:
- case LWS_WRITE_PING:
-#ifdef LWS_WITH_HTTP2
- if (wsi->mode == LWSCM_HTTP2_SERVING) {
- unsigned char flags = 0;
-
- n = LWS_H2_FRAME_TYPE_DATA;
- if ((wp & 0x1f) == LWS_WRITE_HTTP_HEADERS) {
- n = LWS_H2_FRAME_TYPE_HEADERS;
- if (!(wp & LWS_WRITE_NO_FIN))
- flags = LWS_H2_FLAG_END_HEADERS;
- if (wsi->u.h2.send_END_STREAM || (wp & LWS_WRITE_H2_STREAM_END)) {
- flags |= LWS_H2_FLAG_END_STREAM;
- wsi->u.h2.send_END_STREAM = 1;
- }
- }
-
- if ((wp & 0x1f) == LWS_WRITE_HTTP_HEADERS_CONTINUATION) {
- n = LWS_H2_FRAME_TYPE_CONTINUATION;
- if (!(wp & LWS_WRITE_NO_FIN))
- flags = LWS_H2_FLAG_END_HEADERS;
- if (wsi->u.h2.send_END_STREAM || (wp & LWS_WRITE_H2_STREAM_END)) {
- flags |= LWS_H2_FLAG_END_STREAM;
- wsi->u.h2.send_END_STREAM = 1;
- }
- }
-
- if (((wp & 0x1f) == LWS_WRITE_HTTP ||
- (wp & 0x1f) == LWS_WRITE_HTTP_FINAL) &&
- wsi->u.http.tx_content_length) {
- wsi->u.http.tx_content_remain -= len;
- lwsl_info("%s: content_remain = %llu\n", __func__,
- (unsigned long long)wsi->u.http.tx_content_remain);
- if (!wsi->u.http.tx_content_remain) {
- lwsl_info("%s: selecting final write mode\n", __func__);
- wp = LWS_WRITE_HTTP_FINAL;
- }
- }
-
- if ((wp & 0x1f) == LWS_WRITE_HTTP_FINAL || (wp & LWS_WRITE_H2_STREAM_END)) {
- //lws_get_network_wsi(wsi)->u.h2.END_STREAM) {
- lwsl_info("%s: setting END_STREAM\n", __func__);
- flags |= LWS_H2_FLAG_END_STREAM;
- wsi->u.h2.send_END_STREAM = 1;
- }
-
- return lws_h2_frame_write(wsi, n, flags,
- wsi->u.h2.my_sid, len, buf);
- }
-#endif
- return lws_issue_raw(wsi, (unsigned char *)buf - pre, len + pre);
- default:
- break;
- }
-
- /*
- * give any active extensions a chance to munge the buffer
- * before send. We pass in a pointer to an lws_tokens struct
- * prepared with the default buffer and content length that's in
- * there. Rather than rewrite the default buffer, extensions
- * that expect to grow the buffer can adapt .token to
- * point to their own per-connection buffer in the extension
- * user allocation. By default with no extensions or no
- * extension callback handling, just the normal input buffer is
- * used then so it is efficient.
- *
- * callback returns 1 in case it wants to spill more buffers
- *
- * This takes care of holding the buffer if send is incomplete, ie,
- * if wsi->u.ws.clean_buffer is 0 (meaning an extension meddled with
- * the buffer). If wsi->u.ws.clean_buffer is 1, it will instead
- * return to the user code how much OF THE USER BUFFER was consumed.
- */
-
- n = lws_issue_raw_ext_access(wsi, buf - pre, len + pre);
- wsi->u.ws.inside_frame = 1;
- if (n <= 0)
- return n;
-
- if (n == (int)len + pre) {
- /* everything in the buffer was handled (or rebuffered...) */
- wsi->u.ws.inside_frame = 0;
- return orig_len;
- }
-
- /*
- * it is how many bytes of user buffer got sent... may be < orig_len
- * in which case callback when writable has already been arranged
- * and user code can call lws_write() again with the rest
- * later.
- */
-
- return n - pre;
-}
-
-LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- struct lws_process_html_args args;
- lws_filepos_t amount, poss;
- unsigned char *p, *pstart;
-#if defined(LWS_WITH_RANGES)
- unsigned char finished = 0;
-#endif
- int n, m;
-
- lwsl_debug("wsi->http2_substream %d\n", wsi->http2_substream);
-
- while (!lws_send_pipe_choked(wsi)) {
-
- if (wsi->trunc_len) {
- if (lws_issue_raw(wsi, wsi->trunc_alloc +
- wsi->trunc_offset,
- wsi->trunc_len) < 0) {
- lwsl_info("%s: closing\n", __func__);
- goto file_had_it;
- }
- continue;
- }
-
- if (wsi->u.http.filepos == wsi->u.http.filelen)
- goto all_sent;
-
- n = 0;
-
- pstart = pt->serv_buf + LWS_H2_FRAME_HEADER_LENGTH;
-
- p = pstart;
-
-#if defined(LWS_WITH_RANGES)
- if (wsi->u.http.range.count_ranges && !wsi->u.http.range.inside) {
-
- lwsl_notice("%s: doing range start %llu\n", __func__, wsi->u.http.range.start);
-
- if ((long long)lws_vfs_file_seek_cur(wsi->u.http.fop_fd,
- wsi->u.http.range.start -
- wsi->u.http.filepos) < 0)
- goto file_had_it;
-
- wsi->u.http.filepos = wsi->u.http.range.start;
-
- if (wsi->u.http.range.count_ranges > 1) {
- n = lws_snprintf((char *)p, context->pt_serv_buf_size - LWS_H2_FRAME_HEADER_LENGTH,
- "_lws\x0d\x0a"
- "Content-Type: %s\x0d\x0a"
- "Content-Range: bytes %llu-%llu/%llu\x0d\x0a"
- "\x0d\x0a",
- wsi->u.http.multipart_content_type,
- wsi->u.http.range.start,
- wsi->u.http.range.end,
- wsi->u.http.range.extent);
- p += n;
- }
-
- wsi->u.http.range.budget = wsi->u.http.range.end -
- wsi->u.http.range.start + 1;
- wsi->u.http.range.inside = 1;
- }
-#endif
-
- poss = context->pt_serv_buf_size - n - LWS_H2_FRAME_HEADER_LENGTH;
-
- /*
- * if there is a hint about how much we will do well to send at one time,
- * restrict ourselves to only trying to send that.
- */
- if (wsi->protocol->tx_packet_size &&
- poss > wsi->protocol->tx_packet_size)
- poss = wsi->protocol->tx_packet_size;
-
-#if defined(LWS_WITH_HTTP2)
- m = lws_h2_tx_cr_get(wsi);
- if (!m) {
- lwsl_info("%s: came here with no tx credit", __func__);
- return 0;
- }
- if (m < poss)
- poss = m;
- /*
- * consumption of the actual payload amount sent will be handled
- * when the http2 data frame is sent
- */
-#endif
-
-#if defined(LWS_WITH_RANGES)
- if (wsi->u.http.range.count_ranges) {
- if (wsi->u.http.range.count_ranges > 1)
- poss -= 7; /* allow for final boundary */
- if (poss > wsi->u.http.range.budget)
- poss = wsi->u.http.range.budget;
- }
-#endif
- if (wsi->sending_chunked) {
- /* we need to drop the chunk size in here */
- p += 10;
- /* allow for the chunk to grow by 128 in translation */
- poss -= 10 + 128;
- }
-
- if (lws_vfs_file_read(wsi->u.http.fop_fd, &amount, p, poss) < 0)
- goto file_had_it; /* caller will close */
-
- if (wsi->sending_chunked)
- n = (int)amount;
- else
- n = (p - pstart) + (int)amount;
-
- lwsl_debug("%s: sending %d\n", __func__, n);
-
- if (n) {
- lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT,
- context->timeout_secs);
-
- if (wsi->sending_chunked) {
- args.p = (char *)p;
- args.len = n;
- args.max_len = (unsigned int)poss + 128;
- args.final = wsi->u.http.filepos + n ==
- wsi->u.http.filelen;
- if (user_callback_handle_rxflow(
- wsi->vhost->protocols[(int)wsi->protocol_interpret_idx].callback, wsi,
- LWS_CALLBACK_PROCESS_HTML,
- wsi->user_space, &args, 0) < 0)
- goto file_had_it;
- n = args.len;
- p = (unsigned char *)args.p;
- } else
- p = pstart;
-
-#if defined(LWS_WITH_RANGES)
- if (wsi->u.http.range.send_ctr + 1 ==
- wsi->u.http.range.count_ranges && // last range
- wsi->u.http.range.count_ranges > 1 && // was 2+ ranges (ie, multipart)
- wsi->u.http.range.budget - amount == 0) {// final part
- n += lws_snprintf((char *)pstart + n, 6,
- "_lws\x0d\x0a"); // append trailing boundary
- lwsl_debug("added trailing boundary\n");
- }
-#endif
- m = lws_write(wsi, p, n,
- wsi->u.http.filepos == wsi->u.http.filelen ?
- LWS_WRITE_HTTP_FINAL :
- LWS_WRITE_HTTP
- );
- if (m < 0)
- goto file_had_it;
-
- wsi->u.http.filepos += amount;
-
-#if defined(LWS_WITH_RANGES)
- if (wsi->u.http.range.count_ranges >= 1) {
- wsi->u.http.range.budget -= amount;
- if (wsi->u.http.range.budget == 0) {
- lwsl_notice("range budget exhausted\n");
- wsi->u.http.range.inside = 0;
- wsi->u.http.range.send_ctr++;
-
- if (lws_ranges_next(&wsi->u.http.range) < 1) {
- finished = 1;
- goto all_sent;
- }
- }
- }
-#endif
-
- if (m != n) {
- /* adjust for what was not sent */
- if (lws_vfs_file_seek_cur(wsi->u.http.fop_fd,
- m - n) ==
- (unsigned long)-1)
- goto file_had_it;
- }
- }
-
-all_sent:
- if ((!wsi->trunc_len && wsi->u.http.filepos >= wsi->u.http.filelen)
-#if defined(LWS_WITH_RANGES)
- || finished)
-#else
- )
-#endif
- {
- wsi->state = LWSS_HTTP;
- /* we might be in keepalive, so close it off here */
- lws_vfs_file_close(&wsi->u.http.fop_fd);
-
- lwsl_debug("file completed\n");
-
- if (wsi->protocol->callback &&
- user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_HTTP_FILE_COMPLETION,
- wsi->user_space, NULL,
- 0) < 0) {
- /*
- * For http/1.x, the choices from
- * transaction_completed are either
- * 0 to use the connection for pipelined
- * or nonzero to hang it up.
- *
- * However for http/2. while we are
- * still interested in hanging up the
- * nwsi if there was a network-level
- * fatal error, simply completing the
- * transaction is a matter of the stream
- * state, not the root connection at the
- * network level
- */
- if (wsi->http2_substream)
- return 1;
- else
- return -1;
- }
-
- return 1; /* >0 indicates completed */
- }
- }
-
- lws_callback_on_writable(wsi);
-
- return 0; /* indicates further processing must be done */
-
-file_had_it:
- lws_vfs_file_close(&wsi->u.http.fop_fd);
-
- return -1;
-}
-
-#if LWS_POSIX
-LWS_VISIBLE int
-lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- int n;
-
- lws_stats_atomic_bump(context, pt, LWSSTATS_C_API_READ, 1);
-
- n = recv(wsi->desc.sockfd, (char *)buf, len, 0);
- if (n >= 0) {
- if (wsi->vhost)
- wsi->vhost->conn_stats.rx += n;
- lws_stats_atomic_bump(context, pt, LWSSTATS_B_READ, n);
- lws_restart_ws_ping_pong_timer(wsi);
- return n;
- }
-#if LWS_POSIX
- if (LWS_ERRNO == LWS_EAGAIN ||
- LWS_ERRNO == LWS_EWOULDBLOCK ||
- LWS_ERRNO == LWS_EINTR)
- return LWS_SSL_CAPABLE_MORE_SERVICE;
-#endif
- lwsl_notice("error on reading from skt : %d\n", LWS_ERRNO);
- return LWS_SSL_CAPABLE_ERROR;
-}
-
-LWS_VISIBLE int
-lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len)
-{
- int n = 0;
-
-#if LWS_POSIX
- n = send(wsi->desc.sockfd, (char *)buf, len, MSG_NOSIGNAL);
-// lwsl_info("%s: sent len %d result %d", __func__, len, n);
- if (n >= 0)
- return n;
-
- if (LWS_ERRNO == LWS_EAGAIN ||
- LWS_ERRNO == LWS_EWOULDBLOCK ||
- LWS_ERRNO == LWS_EINTR) {
- if (LWS_ERRNO == LWS_EWOULDBLOCK) {
- lws_set_blocking_send(wsi);
- }
-
- return LWS_SSL_CAPABLE_MORE_SERVICE;
- }
-#else
- (void)n;
- (void)wsi;
- (void)buf;
- (void)len;
- // !!!
-#endif
-
- lwsl_debug("ERROR writing len %d to skt fd %d err %d / errno %d\n",
- len, wsi->desc.sockfd, n, LWS_ERRNO);
- return LWS_SSL_CAPABLE_ERROR;
-}
-#endif
-LWS_VISIBLE int
-lws_ssl_pending_no_ssl(struct lws *wsi)
-{
- (void)wsi;
-#if defined(LWS_WITH_ESP32)
- return 100;
-#else
- return 0;
-#endif
-}
diff --git a/thirdparty/lws/private-libwebsockets.h b/thirdparty/lws/private-libwebsockets.h
deleted file mode 100644
index 4f0b374332..0000000000
--- a/thirdparty/lws/private-libwebsockets.h
+++ /dev/null
@@ -1,2618 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010 - 2016 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "lws_config.h"
-#include "lws_config_private.h"
-
-
-#if defined(LWS_WITH_CGI) && defined(LWS_HAVE_VFORK)
-#define _GNU_SOURCE
-#endif
-
-#if defined(__COVERITY__)
-typedef struct { long double x, y; } _Float128;
-#endif
-
-#ifdef LWS_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <inttypes.h>
-
-#if defined(LWS_WITH_ESP32)
-#define MSG_NOSIGNAL 0
-#define SOMAXCONN 3
-#endif
-
-#if defined(LWS_WITH_ESP8266)
-#include <user_interface.h>
-#define assert(n)
-
-/* rom-provided stdc functions for free, ensure use these instead of libc ones */
-
-int ets_vsprintf(char *str, const char *format, va_list argptr);
-int ets_vsnprintf(char *buffer, size_t sizeOfBuffer, const char *format, va_list argptr);
-int ets_snprintf(char *str, size_t size, const char *format, ...);
-int ets_sprintf(char *str, const char *format, ...);
-int os_printf_plus(const char *format, ...);
-#undef malloc
-#undef realloc
-#undef free
-void *pvPortMalloc(size_t s, const char *f, int line);
-#define malloc(s) pvPortMalloc(s, "", 0)
-void *pvPortRealloc(void *p, size_t s, const char *f, int line);
-#define realloc(p, s) pvPortRealloc(p, s, "", 0)
-void vPortFree(void *p, const char *f, int line);
-#define free(p) vPortFree(p, "", 0)
-#undef memcpy
-void *ets_memcpy(void *dest, const void *src, size_t n);
-#define memcpy ets_memcpy
-void *ets_memset(void *dest, int v, size_t n);
-#define memset ets_memset
-char *ets_strcpy(char *dest, const char *src);
-#define strcpy ets_strcpy
-char *ets_strncpy(char *dest, const char *src, size_t n);
-#define strncpy ets_strncpy
-char *ets_strstr(const char *haystack, const char *needle);
-#define strstr ets_strstr
-int ets_strcmp(const char *s1, const char *s2);
-int ets_strncmp(const char *s1, const char *s2, size_t n);
-#define strcmp ets_strcmp
-#define strncmp ets_strncmp
-size_t ets_strlen(const char *s);
-#define strlen ets_strlen
-void *ets_memmove(void *dest, const void *src, size_t n);
-#define memmove ets_memmove
-char *ets_strchr(const char *s, int c);
-#define strchr_ets_strchr
-#undef _DEBUG
-#include <osapi.h>
-
-#else
-#define STORE_IN_ROM
-#include <assert.h>
-#endif
-#if LWS_MAX_SMP > 1
-#include <pthread.h>
-#endif
-
-#ifdef LWS_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if defined(WIN32) || defined(_WIN32)
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#if (WINVER < 0x0501)
-#undef WINVER
-#undef _WIN32_WINNT
-#define WINVER 0x0501
-#define _WIN32_WINNT WINVER
-#endif
-#define LWS_NO_DAEMONIZE
-#define LWS_ERRNO WSAGetLastError()
-#define LWS_EAGAIN WSAEWOULDBLOCK
-#define LWS_EALREADY WSAEALREADY
-#define LWS_EINPROGRESS WSAEINPROGRESS
-#define LWS_EINTR WSAEINTR
-#define LWS_EISCONN WSAEISCONN
-#define LWS_EWOULDBLOCK WSAEWOULDBLOCK
-#define MSG_NOSIGNAL 0
-#define SHUT_RDWR SD_BOTH
-#define SOL_TCP IPPROTO_TCP
-#define SHUT_WR SD_SEND
-
-#define compatible_close(fd) closesocket(fd)
-#define lws_set_blocking_send(wsi) wsi->sock_send_blocking = 1
-#define lws_socket_is_valid(x) (!!x)
-#define LWS_SOCK_INVALID 0
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windows.h>
-#include <tchar.h>
-#ifdef LWS_HAVE_IN6ADDR_H
-#include <in6addr.h>
-#endif
-#include <mstcpip.h>
-#include <io.h>
-
-#if !defined(LWS_HAVE_ATOLL)
-#if defined(LWS_HAVE__ATOI64)
-#define atoll _atoi64
-#else
-#warning No atoll or _atoi64 available, using atoi
-#define atoll atoi
-#endif
-#endif
-
-#ifndef __func__
-#define __func__ __FUNCTION__
-#endif
-
-#ifdef LWS_HAVE__VSNPRINTF
-#define vsnprintf _vsnprintf
-#endif
-
-/* we don't have an implementation for this on windows... */
-int kill(int pid, int sig);
-int fork(void);
-#ifndef SIGINT
-#define SIGINT 2
-#endif
-
-#else /* not windows --> */
-
-#include <fcntl.h>
-#include <strings.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#ifndef __cplusplus
-#include <errno.h>
-#endif
-#include <netdb.h>
-#include <signal.h>
-#ifdef LWS_WITH_ESP8266
-#include <sockets.h>
-#define vsnprintf ets_vsnprintf
-#define snprintf ets_snprintf
-#define sprintf ets_sprintf
-
-int kill(int pid, int sig);
-
-#else
-#include <sys/socket.h>
-#endif
-#ifdef LWS_WITH_HTTP_PROXY
-#include <hubbub/hubbub.h>
-#include <hubbub/parser.h>
-#endif
-#if defined(LWS_BUILTIN_GETIFADDRS)
- #include "./misc/getifaddrs.h"
-#else
- #if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32)
- #if defined(__HAIKU__)
- #define _BSD_SOURCE
- #endif
- #include <ifaddrs.h>
- #endif
-#endif
-#if defined (__ANDROID__)
-#include <syslog.h>
-#include <sys/resource.h>
-#elif defined (__sun) || defined(__HAIKU__)
-#include <syslog.h>
-#else
-#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32)
-#include <sys/syslog.h>
-#endif
-#endif
-#include <netdb.h>
-#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32)
-#include <sys/mman.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <poll.h>
-#endif
-#ifdef LWS_WITH_LIBEV
-#include <ev.h>
-#endif
-#ifdef LWS_WITH_LIBUV
-#include <uv.h>
-#endif
-#ifdef LWS_WITH_LIBEVENT
-#include <event2/event.h>
-#endif
-
-#ifndef LWS_NO_FORK
-#ifdef LWS_HAVE_SYS_PRCTL_H
-#include <sys/prctl.h>
-#endif
-#endif
-
-#include <sys/time.h>
-
-#define LWS_ERRNO errno
-#define LWS_EAGAIN EAGAIN
-#define LWS_EALREADY EALREADY
-#define LWS_EINPROGRESS EINPROGRESS
-#define LWS_EINTR EINTR
-#define LWS_EISCONN EISCONN
-#define LWS_EWOULDBLOCK EWOULDBLOCK
-
-#define lws_set_blocking_send(wsi)
-
-#if defined(LWS_WITH_ESP8266)
-#define lws_socket_is_valid(x) ((x) != NULL)
-#define LWS_SOCK_INVALID (NULL)
-struct lws;
-const char *
-lws_plat_get_peer_simple(struct lws *wsi, char *name, int namelen);
-#else
-#define lws_socket_is_valid(x) (x >= 0)
-#define LWS_SOCK_INVALID (-1)
-#endif
-#endif
-
-#ifndef LWS_HAVE_BZERO
-#ifndef bzero
-#define bzero(b, len) (memset((b), '\0', (len)), (void) 0)
-#endif
-#endif
-
-#ifndef LWS_HAVE_STRERROR
-#define strerror(x) ""
-#endif
-
-#ifdef LWS_OPENSSL_SUPPORT
-
-#ifdef USE_WOLFSSL
-#ifdef USE_OLD_CYASSL
-#include <cyassl/openssl/ssl.h>
-#include <cyassl/error-ssl.h>
-#else
-#include <wolfssl/openssl/ssl.h>
-#include <wolfssl/error-ssl.h>
-#define OPENSSL_NO_TLSEXT
-#endif /* not USE_OLD_CYASSL */
-#else
-#if defined(LWS_WITH_ESP32)
-#define OPENSSL_NO_TLSEXT
-#else
-#if defined(LWS_WITH_MBEDTLS)
-#include <mbedtls/ssl.h>
-#include <mbedtls/x509_crt.h>
-#else
-#include <openssl/ssl.h>
-#include <openssl/evp.h>
-#include <openssl/err.h>
-#include <openssl/md5.h>
-#include <openssl/sha.h>
-#ifdef LWS_HAVE_OPENSSL_ECDH_H
-#include <openssl/ecdh.h>
-#endif
-#include <openssl/x509v3.h>
-#endif
-#if defined(OPENSSL_VERSION_NUMBER)
-#if (OPENSSL_VERSION_NUMBER < 0x0009080afL)
-/* later openssl defines this to negate the presence of tlsext... but it was only
- * introduced at 0.9.8j. Earlier versions don't know it exists so don't
- * define it... making it look like the feature exists...
- */
-#define OPENSSL_NO_TLSEXT
-#endif
-#endif
-#endif /* not ESP32 */
-#endif /* not USE_WOLFSSL */
-#endif
-
-#include "libwebsockets.h"
-#if defined(WIN32) || defined(_WIN32)
-#else
-static inline int compatible_close(int fd) { return close(fd); }
-#endif
-
-#if defined(WIN32) || defined(_WIN32)
-#include <gettimeofday.h>
-#endif
-
-#if defined(LWS_WITH_ESP8266)
-#undef compatible_close
-#define compatible_close(fd) { fd->state=ESPCONN_CLOSE; espconn_delete(fd); }
-lws_sockfd_type
-esp8266_create_tcp_stream_socket(void);
-void
-esp8266_tcp_stream_bind(lws_sockfd_type fd, int port, struct lws *wsi);
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */
-#endif
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#endif
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-#endif
-
-
-#if defined(WIN32) || defined(_WIN32)
-
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */
-#endif
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#endif
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-#ifndef u_int64_t
-typedef unsigned __int64 u_int64_t;
-#endif
-
-#undef __P
-#ifndef __P
-#if __STDC__
-#define __P(protos) protos
-#else
-#define __P(protos) ()
-#endif
-#endif
-
-#else
-
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#if defined(__APPLE__)
-#include <machine/endian.h>
-#elif defined(__FreeBSD__)
-#include <sys/endian.h>
-#elif defined(__linux__)
-#include <endian.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(__QNX__)
- #include <gulliver.h>
- #if defined(__LITTLEENDIAN__)
- #define BYTE_ORDER __LITTLEENDIAN__
- #define LITTLE_ENDIAN __LITTLEENDIAN__
- #define BIG_ENDIAN 4321 /* to show byte order (taken from gcc); for suppres warning that BIG_ENDIAN is not defined. */
- #endif
- #if defined(__BIGENDIAN__)
- #define BYTE_ORDER __BIGENDIAN__
- #define LITTLE_ENDIAN 1234 /* to show byte order (taken from gcc); for suppres warning that LITTLE_ENDIAN is not defined. */
- #define BIG_ENDIAN __BIGENDIAN__
- #endif
-#endif
-
-#if defined(__sun) && defined(__GNUC__)
-
-#include <arpa/nameser_compat.h>
-
-#if !defined (BYTE_ORDER)
-# define BYTE_ORDER __BYTE_ORDER__
-#endif
-
-#if !defined(LITTLE_ENDIAN)
-# define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
-#endif
-
-#if !defined(BIG_ENDIAN)
-# define BIG_ENDIAN __ORDER_BIG_ENDIAN__
-#endif
-
-#endif /* sun + GNUC */
-
-#if !defined(BYTE_ORDER)
-# define BYTE_ORDER __BYTE_ORDER
-#endif
-#if !defined(LITTLE_ENDIAN)
-# define LITTLE_ENDIAN __LITTLE_ENDIAN
-#endif
-#if !defined(BIG_ENDIAN)
-# define BIG_ENDIAN __BIG_ENDIAN
-#endif
-
-#endif
-
-/*
- * Mac OSX as well as iOS do not define the MSG_NOSIGNAL flag,
- * but happily have something equivalent in the SO_NOSIGPIPE flag.
- */
-#ifdef __APPLE__
-#define MSG_NOSIGNAL SO_NOSIGPIPE
-#endif
-
-/*
- * Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in
- * POSIX 2008.
- */
-#ifdef __sun
-#define MSG_NOSIGNAL 0
-#endif
-
-#ifdef _WIN32
-#ifndef FD_HASHTABLE_MODULUS
-#define FD_HASHTABLE_MODULUS 32
-#endif
-#endif
-
-#ifndef LWS_DEF_HEADER_LEN
-#define LWS_DEF_HEADER_LEN 4096
-#endif
-#ifndef LWS_DEF_HEADER_POOL
-#define LWS_DEF_HEADER_POOL 4
-#endif
-#ifndef LWS_MAX_PROTOCOLS
-#define LWS_MAX_PROTOCOLS 5
-#endif
-#ifndef LWS_MAX_EXTENSIONS_ACTIVE
-#define LWS_MAX_EXTENSIONS_ACTIVE 2
-#endif
-#ifndef LWS_MAX_EXT_OFFERS
-#define LWS_MAX_EXT_OFFERS 8
-#endif
-#ifndef SPEC_LATEST_SUPPORTED
-#define SPEC_LATEST_SUPPORTED 13
-#endif
-#ifndef AWAITING_TIMEOUT
-#define AWAITING_TIMEOUT 20
-#endif
-#ifndef CIPHERS_LIST_STRING
-#define CIPHERS_LIST_STRING "DEFAULT"
-#endif
-#ifndef LWS_SOMAXCONN
-#define LWS_SOMAXCONN SOMAXCONN
-#endif
-
-#define MAX_WEBSOCKET_04_KEY_LEN 128
-
-#ifndef SYSTEM_RANDOM_FILEPATH
-#define SYSTEM_RANDOM_FILEPATH "/dev/urandom"
-#endif
-
-enum lws_websocket_opcodes_07 {
- LWSWSOPC_CONTINUATION = 0,
- LWSWSOPC_TEXT_FRAME = 1,
- LWSWSOPC_BINARY_FRAME = 2,
-
- LWSWSOPC_NOSPEC__MUX = 7,
-
- /* control extensions 8+ */
-
- LWSWSOPC_CLOSE = 8,
- LWSWSOPC_PING = 9,
- LWSWSOPC_PONG = 0xa,
-};
-
-
-enum lws_connection_states {
- LWSS_HTTP,
- LWSS_HTTP_ISSUING_FILE,
- LWSS_HTTP_HEADERS,
- LWSS_HTTP_BODY,
- LWSS_DEAD_SOCKET,
- LWSS_ESTABLISHED,
- LWSS_CLIENT_HTTP_ESTABLISHED,
- LWSS_CLIENT_UNCONNECTED,
- LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION,
- LWSS_RETURNED_CLOSE_ALREADY,
- LWSS_AWAITING_CLOSE_ACK,
- LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE,
- LWSS_SHUTDOWN,
-
- LWSS_HTTP2_AWAIT_CLIENT_PREFACE,
- LWSS_HTTP2_ESTABLISHED_PRE_SETTINGS,
- LWSS_HTTP2_ESTABLISHED,
-
- LWSS_CGI,
-};
-
-enum http_version {
- HTTP_VERSION_1_0,
- HTTP_VERSION_1_1,
- HTTP_VERSION_2
-};
-
-enum http_connection_type {
- HTTP_CONNECTION_CLOSE,
- HTTP_CONNECTION_KEEP_ALIVE
-};
-
-enum lws_rx_parse_state {
- LWS_RXPS_NEW,
-
- LWS_RXPS_04_mask_1,
- LWS_RXPS_04_mask_2,
- LWS_RXPS_04_mask_3,
-
- LWS_RXPS_04_FRAME_HDR_1,
- LWS_RXPS_04_FRAME_HDR_LEN,
- LWS_RXPS_04_FRAME_HDR_LEN16_2,
- LWS_RXPS_04_FRAME_HDR_LEN16_1,
- LWS_RXPS_04_FRAME_HDR_LEN64_8,
- LWS_RXPS_04_FRAME_HDR_LEN64_7,
- LWS_RXPS_04_FRAME_HDR_LEN64_6,
- LWS_RXPS_04_FRAME_HDR_LEN64_5,
- LWS_RXPS_04_FRAME_HDR_LEN64_4,
- LWS_RXPS_04_FRAME_HDR_LEN64_3,
- LWS_RXPS_04_FRAME_HDR_LEN64_2,
- LWS_RXPS_04_FRAME_HDR_LEN64_1,
-
- LWS_RXPS_07_COLLECT_FRAME_KEY_1,
- LWS_RXPS_07_COLLECT_FRAME_KEY_2,
- LWS_RXPS_07_COLLECT_FRAME_KEY_3,
- LWS_RXPS_07_COLLECT_FRAME_KEY_4,
-
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED
-};
-
-#define LWSCM_FLAG_IMPLIES_CALLBACK_CLOSED_CLIENT_HTTP 32
-
-enum connection_mode {
- LWSCM_HTTP_SERVING,
- LWSCM_HTTP_SERVING_ACCEPTED, /* actual HTTP service going on */
- LWSCM_PRE_WS_SERVING_ACCEPT,
-
- LWSCM_WS_SERVING,
- LWSCM_WS_CLIENT,
-
- LWSCM_HTTP2_SERVING,
-
- /* transient, ssl delay hiding */
- LWSCM_SSL_ACK_PENDING,
- LWSCM_SSL_INIT,
- /* as above, but complete into LWSCM_RAW */
- LWSCM_SSL_ACK_PENDING_RAW,
- LWSCM_SSL_INIT_RAW,
-
- /* special internal types */
- LWSCM_SERVER_LISTENER,
- LWSCM_CGI, /* stdin, stdout, stderr for another cgi master wsi */
- LWSCM_RAW, /* raw with bulk handling */
- LWSCM_RAW_FILEDESC, /* raw without bulk handling */
-
- /* HTTP Client related */
- LWSCM_HTTP_CLIENT = LWSCM_FLAG_IMPLIES_CALLBACK_CLOSED_CLIENT_HTTP,
- LWSCM_HTTP_CLIENT_ACCEPTED, /* actual HTTP service going on */
- LWSCM_WSCL_WAITING_CONNECT,
- LWSCM_WSCL_WAITING_PROXY_REPLY,
- LWSCM_WSCL_ISSUE_HANDSHAKE,
- LWSCM_WSCL_ISSUE_HANDSHAKE2,
- LWSCM_WSCL_ISSUE_HTTP_BODY,
- LWSCM_WSCL_WAITING_SSL,
- LWSCM_WSCL_WAITING_SERVER_REPLY,
- LWSCM_WSCL_WAITING_EXTENSION_CONNECT,
- LWSCM_WSCL_PENDING_CANDIDATE_CHILD,
- LWSCM_WSCL_WAITING_SOCKS_GREETING_REPLY,
- LWSCM_WSCL_WAITING_SOCKS_CONNECT_REPLY,
- LWSCM_WSCL_WAITING_SOCKS_AUTH_REPLY,
-
- /****** add new things just above ---^ ******/
-
-
-};
-
-/* enums of socks version */
-enum socks_version {
- SOCKS_VERSION_4 = 4,
- SOCKS_VERSION_5 = 5
-};
-
-/* enums of subnegotiation version */
-enum socks_subnegotiation_version {
- SOCKS_SUBNEGOTIATION_VERSION_1 = 1,
-};
-
-/* enums of socks commands */
-enum socks_command {
- SOCKS_COMMAND_CONNECT = 1,
- SOCKS_COMMAND_BIND = 2,
- SOCKS_COMMAND_UDP_ASSOCIATE = 3
-};
-
-/* enums of socks address type */
-enum socks_atyp {
- SOCKS_ATYP_IPV4 = 1,
- SOCKS_ATYP_DOMAINNAME = 3,
- SOCKS_ATYP_IPV6 = 4
-};
-
-/* enums of socks authentication methods */
-enum socks_auth_method {
- SOCKS_AUTH_NO_AUTH = 0,
- SOCKS_AUTH_GSSAPI = 1,
- SOCKS_AUTH_USERNAME_PASSWORD = 2
-};
-
-/* enums of subnegotiation status */
-enum socks_subnegotiation_status {
- SOCKS_SUBNEGOTIATION_STATUS_SUCCESS = 0,
-};
-
-/* enums of socks request reply */
-enum socks_request_reply {
- SOCKS_REQUEST_REPLY_SUCCESS = 0,
- SOCKS_REQUEST_REPLY_FAILURE_GENERAL = 1,
- SOCKS_REQUEST_REPLY_CONNECTION_NOT_ALLOWED = 2,
- SOCKS_REQUEST_REPLY_NETWORK_UNREACHABLE = 3,
- SOCKS_REQUEST_REPLY_HOST_UNREACHABLE = 4,
- SOCKS_REQUEST_REPLY_CONNECTION_REFUSED = 5,
- SOCKS_REQUEST_REPLY_TTL_EXPIRED = 6,
- SOCKS_REQUEST_REPLY_COMMAND_NOT_SUPPORTED = 7,
- SOCKS_REQUEST_REPLY_ATYP_NOT_SUPPORTED = 8
-};
-
-/* enums used to generate socks messages */
-enum socks_msg_type {
- /* greeting */
- SOCKS_MSG_GREETING,
- /* credential, user name and password */
- SOCKS_MSG_USERNAME_PASSWORD,
- /* connect command */
- SOCKS_MSG_CONNECT
-};
-
-enum {
- LWS_RXFLOW_ALLOW = (1 << 0),
- LWS_RXFLOW_PENDING_CHANGE = (1 << 1),
-};
-
-struct lws_ring {
- void *buf;
- void (*destroy_element)(void *element);
- size_t buflen;
- size_t element_len;
- uint32_t head;
- uint32_t oldest_tail;
-};
-
-/* this is not usable directly by user code any more, lws_close_reason() */
-#define LWS_WRITE_CLOSE 4
-
-struct lws_protocols;
-struct lws;
-
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
-
-struct lws_io_watcher {
-#ifdef LWS_WITH_LIBEV
- ev_io ev_watcher;
-#endif
-#ifdef LWS_WITH_LIBUV
- uv_poll_t uv_watcher;
-#endif
-#ifdef LWS_WITH_LIBEVENT
- struct event *event_watcher;
-#endif
- struct lws_context *context;
-
- uint8_t actual_events;
-};
-
-struct lws_signal_watcher {
-#ifdef LWS_WITH_LIBEV
- ev_signal ev_watcher;
-#endif
-#ifdef LWS_WITH_LIBUV
- uv_signal_t uv_watcher;
-#endif
-#ifdef LWS_WITH_LIBEVENT
- struct event *event_watcher;
-#endif
- struct lws_context *context;
-};
-#endif
-
-#ifdef _WIN32
-#define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) % FD_HASHTABLE_MODULUS)
-struct lws_fd_hashtable {
- struct lws **wsi;
- int length;
-};
-#endif
-
-/*
- * This is totally opaque to code using the library. It's exported as a
- * forward-reference pointer-only declaration; the user can use the pointer with
- * other APIs to get information out of it.
- */
-
-#if defined(LWS_WITH_ESP32)
-typedef uint16_t ah_data_idx_t;
-#else
-typedef uint32_t ah_data_idx_t;
-#endif
-
-struct lws_fragments {
- ah_data_idx_t offset;
- uint16_t len;
- uint8_t nfrag; /* which ah->frag[] continues this content, or 0 */
- uint8_t flags; /* only http2 cares */
-};
-
-/*
- * these are assigned from a pool held in the context.
- * Both client and server mode uses them for http header analysis
- */
-
-struct allocated_headers {
- struct allocated_headers *next; /* linked list */
- struct lws *wsi; /* owner */
- char *data; /* prepared by context init to point to dedicated storage */
- ah_data_idx_t data_length;
- /*
- * the randomly ordered fragments, indexed by frag_index and
- * lws_fragments->nfrag for continuation.
- */
- struct lws_fragments frags[WSI_TOKEN_COUNT];
- time_t assigned;
- /*
- * for each recognized token, frag_index says which frag[] his data
- * starts in (0 means the token did not appear)
- * the actual header data gets dumped as it comes in, into data[]
- */
- uint8_t frag_index[WSI_TOKEN_COUNT];
-#if defined(LWS_WITH_ESP32)
- uint8_t rx[256];
-#else
- uint8_t rx[2048];
-#endif
-
- int16_t rxpos;
- int16_t rxlen;
- uint32_t pos;
- uint32_t http_response;
- int hdr_token_idx;
-
-#ifndef LWS_NO_CLIENT
- char initial_handshake_hash_base64[30];
-#endif
-
- uint8_t in_use;
- uint8_t nfrag;
-};
-
-/*
- * so we can have n connections being serviced simultaneously,
- * these things need to be isolated per-thread.
- */
-
-struct lws_context_per_thread {
-#if LWS_MAX_SMP > 1
- pthread_mutex_t lock;
-#endif
- struct lws_pollfd *fds;
-#if defined(LWS_WITH_ESP8266)
- struct lws **lws_vs_fds_index;
-#endif
- struct lws *rx_draining_ext_list;
- struct lws *tx_draining_ext_list;
- struct lws *timeout_list;
-#if defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
- struct lws_context *context;
-#endif
-#ifdef LWS_WITH_CGI
- struct lws_cgi *cgi_list;
-#endif
- void *http_header_data;
- struct allocated_headers *ah_list;
- struct lws *ah_wait_list;
- int ah_wait_list_length;
-#ifdef LWS_OPENSSL_SUPPORT
- struct lws *pending_read_list; /* linked list */
-#endif
-#if defined(LWS_WITH_LIBEV)
- struct ev_loop *io_loop_ev;
-#endif
-#if defined(LWS_WITH_LIBUV)
- uv_loop_t *io_loop_uv;
- uv_signal_t signals[8];
- uv_timer_t uv_timeout_watcher;
- uv_idle_t uv_idle;
-#endif
-#if defined(LWS_WITH_LIBEVENT)
- struct event_base *io_loop_event_base;
-#endif
-#if defined(LWS_WITH_LIBEV)
- struct lws_io_watcher w_accept;
-#endif
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
- struct lws_signal_watcher w_sigint;
- unsigned char ev_loop_foreign:1;
-#endif
-
- unsigned long count_conns;
- /*
- * usable by anything in the service code, but only if the scope
- * does not last longer than the service action (since next service
- * of any socket can likewise use it and overwrite)
- */
- unsigned char *serv_buf;
-#ifdef _WIN32
- WSAEVENT *events;
-#else
- lws_sockfd_type dummy_pipe_fds[2];
-#endif
- unsigned int fds_count;
- uint32_t ah_pool_length;
-
- short ah_count_in_use;
- unsigned char tid;
- unsigned char lock_depth;
-};
-
-struct lws_conn_stats {
- unsigned long long rx, tx;
- unsigned long h1_conn, h1_trans, h2_trans, ws_upg, h2_alpn, h2_subs,
- h2_upg, rejected;
-};
-
-void
-lws_sum_stats(const struct lws_context *ctx, struct lws_conn_stats *cs);
-
-
-enum lws_h2_settings {
- H2SET_HEADER_TABLE_SIZE = 1,
- H2SET_ENABLE_PUSH,
- H2SET_MAX_CONCURRENT_STREAMS,
- H2SET_INITIAL_WINDOW_SIZE,
- H2SET_MAX_FRAME_SIZE,
- H2SET_MAX_HEADER_LIST_SIZE,
-
- H2SET_COUNT /* always last */
-};
-
-struct http2_settings {
- uint32_t s[H2SET_COUNT];
-};
-
-/*
- * virtual host -related context information
- * vhostwide SSL context
- * vhostwide proxy
- *
- * hierarchy:
- *
- * context -> vhost -> wsi
- *
- * incoming connection non-SSL vhost binding:
- *
- * listen socket -> wsi -> select vhost after first headers
- *
- * incoming connection SSL vhost binding:
- *
- * SSL SNI -> wsi -> bind after SSL negotiation
- */
-
-struct lws_vhost {
-#if !defined(LWS_WITH_ESP8266)
- char http_proxy_address[128];
- char proxy_basic_auth_token[128];
-#if defined(LWS_WITH_HTTP2)
- struct http2_settings set;
-#endif
-#if defined(LWS_WITH_SOCKS5)
- char socks_proxy_address[128];
- char socks_user[96];
- char socks_password[96];
-#endif
-#endif
-#if defined(LWS_WITH_ESP8266)
- /* listen sockets need a place to hang their hat */
- esp_tcp tcp;
-#endif
- struct lws_conn_stats conn_stats;
- struct lws_context *context;
- struct lws_vhost *vhost_next;
- const struct lws_http_mount *mount_list;
- struct lws *lserv_wsi;
- const char *name;
- const char *iface;
-#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32) && !defined(OPTEE_TA) && !defined(WIN32)
- int bind_iface;
-#endif
- const struct lws_protocols *protocols;
- void **protocol_vh_privs;
- const struct lws_protocol_vhost_options *pvo;
- const struct lws_protocol_vhost_options *headers;
- struct lws **same_vh_protocol_list;
-#ifdef LWS_OPENSSL_SUPPORT
- SSL_CTX *ssl_ctx;
- SSL_CTX *ssl_client_ctx;
-#endif
-#if defined(LWS_WITH_MBEDTLS)
- X509 *x509_client_CA;
-#endif
-#ifndef LWS_NO_EXTENSIONS
- const struct lws_extension *extensions;
-#endif
- void *user;
-
- int listen_port;
- unsigned int http_proxy_port;
-#if defined(LWS_WITH_SOCKS5)
- unsigned int socks_proxy_port;
-#endif
- unsigned int options;
- int count_protocols;
- int ka_time;
- int ka_probes;
- int ka_interval;
- int keepalive_timeout;
- int timeout_secs_ah_idle;
- int ssl_info_event_mask;
-#ifdef LWS_WITH_ACCESS_LOG
- int log_fd;
-#endif
-
-#ifdef LWS_OPENSSL_SUPPORT
- int use_ssl;
- int allow_non_ssl_on_ssl_port;
- unsigned int user_supplied_ssl_ctx:1;
-#endif
-
- unsigned int created_vhost_protocols:1;
- unsigned int being_destroyed:1;
-
- unsigned char default_protocol_index;
- unsigned char raw_protocol_index;
-};
-
-struct lws_deferred_free
-{
- struct lws_deferred_free *next;
- time_t deadline;
- void *payload;
-};
-
-typedef union {
-#ifdef LWS_WITH_IPV6
- struct sockaddr_in6 sa6;
-#endif
- struct sockaddr_in sa4;
-} sockaddr46;
-
-
-#if defined(LWS_WITH_PEER_LIMITS)
-struct lws_peer {
- struct lws_peer *next;
- struct lws_peer *peer_wait_list;
-
- time_t time_created;
- time_t time_closed_all;
-
- uint8_t addr[32];
- uint32_t hash;
- uint32_t count_wsi;
- uint32_t count_ah;
-
- uint32_t total_wsi;
- uint32_t total_ah;
-
- uint8_t af;
-};
-#endif
-
-/*
- * the rest is managed per-context, that includes
- *
- * - processwide single fd -> wsi lookup
- * - contextwide headers pool
- */
-
-struct lws_context {
- time_t last_timeout_check_s;
- time_t last_ws_ping_pong_check_s;
- time_t time_up;
- const struct lws_plat_file_ops *fops;
- struct lws_plat_file_ops fops_platform;
-#if defined(LWS_WITH_HTTP2)
- struct http2_settings set;
-#endif
-#if defined(LWS_WITH_ZIP_FOPS)
- struct lws_plat_file_ops fops_zip;
-#endif
- struct lws_context_per_thread pt[LWS_MAX_SMP];
- struct lws_conn_stats conn_stats;
-#if LWS_MAX_SMP > 1
- pthread_mutex_t lock;
- int lock_depth;
-#endif
-#ifdef _WIN32
-/* different implementation between unix and windows */
- struct lws_fd_hashtable fd_hashtable[FD_HASHTABLE_MODULUS];
-#else
-#if defined(LWS_WITH_ESP8266)
- struct espconn **connpool; /* .reverse points to the wsi */
- void *rxd;
- int rxd_len;
- os_timer_t to_timer;
-#else
- struct lws **lws_lookup; /* fd to wsi */
-#endif
-#endif
- struct lws_vhost *vhost_list;
- struct lws_vhost *vhost_pending_destruction_list;
- struct lws_plugin *plugin_list;
- struct lws_deferred_free *deferred_free_list;
-#if defined(LWS_WITH_PEER_LIMITS)
- struct lws_peer **pl_hash_table;
- struct lws_peer *peer_wait_list;
- time_t next_cull;
-#endif
-
- void *external_baggage_free_on_destroy;
- const struct lws_token_limits *token_limits;
- void *user_space;
- const char *server_string;
- const struct lws_protocol_vhost_options *reject_service_keywords;
- lws_reload_func deprecation_cb;
-
-#if defined(LWS_HAVE_SYS_CAPABILITY_H) && defined(LWS_HAVE_LIBCAP)
- cap_value_t caps[4];
- char count_caps;
-#endif
-
-#if defined(LWS_WITH_LIBEV)
- lws_ev_signal_cb_t * lws_ev_sigint_cb;
-#endif
-#if defined(LWS_WITH_LIBUV)
- uv_signal_cb lws_uv_sigint_cb;
- uv_loop_t pu_loop;
-#endif
-#if defined(LWS_WITH_LIBEVENT)
- lws_event_signal_cb_t * lws_event_sigint_cb;
-#endif
- char canonical_hostname[128];
-#ifdef LWS_LATENCY
- unsigned long worst_latency;
- char worst_latency_info[256];
-#endif
-
-#if defined(LWS_WITH_STATS)
- uint64_t lws_stats[LWSSTATS_SIZE];
- uint64_t last_dump;
- int updated;
-#endif
-#if defined(LWS_WITH_ESP32)
- unsigned long time_last_state_dump;
- uint32_t last_free_heap;
-#endif
-
- int max_fds;
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
- int use_ev_sigint;
-#endif
- int started_with_parent;
- int uid, gid;
-
- int fd_random;
-
- int count_wsi_allocated;
- int count_cgi_spawned;
- unsigned int options;
- unsigned int fd_limit_per_thread;
- unsigned int timeout_secs;
- unsigned int pt_serv_buf_size;
- int max_http_header_data;
- int simultaneous_ssl_restriction;
- int simultaneous_ssl;
-#if defined(LWS_WITH_PEER_LIMITS)
- uint32_t pl_hash_elements; /* protected by context->lock */
- uint32_t count_peers; /* protected by context->lock */
- unsigned short ip_limit_ah;
- unsigned short ip_limit_wsi;
-#endif
- unsigned int deprecated:1;
- unsigned int being_destroyed:1;
- unsigned int being_destroyed1:1;
- unsigned int requested_kill:1;
- unsigned int protocol_init_done:1;
- unsigned int ssl_gate_accepts:1;
- unsigned int doing_protocol_init;
- /*
- * set to the Thread ID that's doing the service loop just before entry
- * to poll indicates service thread likely idling in poll()
- * volatile because other threads may check it as part of processing
- * for pollfd event change.
- */
- volatile int service_tid;
- int service_tid_detected;
-
- short max_http_header_pool;
- short count_threads;
- short plugin_protocol_count;
- short plugin_extension_count;
- short server_string_len;
- unsigned short ws_ping_pong_interval;
- unsigned short deprecation_pending_listen_close_count;
-
- uint8_t max_fi;
-};
-
-int
-lws_check_deferred_free(struct lws_context *context, int force);
-
-#define lws_get_context_protocol(ctx, x) ctx->vhost_list->protocols[x]
-#define lws_get_vh_protocol(vh, x) vh->protocols[x]
-
-LWS_EXTERN void
-lws_close_free_wsi_final(struct lws *wsi);
-LWS_EXTERN void
-lws_libuv_closehandle(struct lws *wsi);
-LWS_EXTERN void
-lws_libuv_closehandle_manually(struct lws *wsi);
-LWS_EXTERN int
-lws_libuv_check_watcher_active(struct lws *wsi);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_plat_plugins_init(struct lws_context * context, const char * const *d);
-
-LWS_VISIBLE LWS_EXTERN int
-lws_plat_plugins_destroy(struct lws_context * context);
-
-LWS_EXTERN void
-lws_restart_ws_ping_pong_timer(struct lws *wsi);
-
-struct lws *
-lws_adopt_socket_vhost(struct lws_vhost *vh, lws_sockfd_type accept_fd);
-
-
-enum {
- LWS_EV_READ = (1 << 0),
- LWS_EV_WRITE = (1 << 1),
- LWS_EV_START = (1 << 2),
- LWS_EV_STOP = (1 << 3),
-
- LWS_EV_PREPARE_DELETION = (1 << 31),
-};
-
-#if defined(LWS_WITH_LIBEV)
-LWS_EXTERN void
-lws_libev_accept(struct lws *new_wsi, lws_sock_file_fd_type desc);
-LWS_EXTERN void
-lws_libev_io(struct lws *wsi, int flags);
-LWS_EXTERN int
-lws_libev_init_fd_table(struct lws_context *context);
-LWS_EXTERN void
-lws_libev_destroyloop(struct lws_context *context, int tsi);
-LWS_EXTERN void
-lws_libev_run(const struct lws_context *context, int tsi);
-#define LWS_LIBEV_ENABLED(context) lws_check_opt(context->options, LWS_SERVER_OPTION_LIBEV)
-LWS_EXTERN void lws_feature_status_libev(struct lws_context_creation_info *info);
-#else
-#define lws_libev_accept(_a, _b) ((void) 0)
-#define lws_libev_io(_a, _b) ((void) 0)
-#define lws_libev_init_fd_table(_a) (0)
-#define lws_libev_run(_a, _b) ((void) 0)
-#define lws_libev_destroyloop(_a, _b) ((void) 0)
-#define LWS_LIBEV_ENABLED(context) (0)
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
-#define lws_feature_status_libev(_a) \
- lwsl_info("libev support not compiled in\n")
-#else
-#define lws_feature_status_libev(_a)
-#endif
-#endif
-
-#if defined(LWS_WITH_LIBUV)
-LWS_EXTERN void
-lws_libuv_accept(struct lws *new_wsi, lws_sock_file_fd_type desc);
-LWS_EXTERN void
-lws_libuv_io(struct lws *wsi, int flags);
-LWS_EXTERN int
-lws_libuv_init_fd_table(struct lws_context *context);
-LWS_EXTERN void
-lws_libuv_run(const struct lws_context *context, int tsi);
-LWS_EXTERN void
-lws_libuv_destroyloop(struct lws_context *context, int tsi);
-LWS_EXTERN int
-lws_uv_initvhost(struct lws_vhost* vh, struct lws*);
-#define LWS_LIBUV_ENABLED(context) lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV)
-LWS_EXTERN void lws_feature_status_libuv(struct lws_context_creation_info *info);
-#else
-#define lws_libuv_accept(_a, _b) ((void) 0)
-#define lws_libuv_io(_a, _b) ((void) 0)
-#define lws_libuv_init_fd_table(_a) (0)
-#define lws_libuv_run(_a, _b) ((void) 0)
-#define lws_libuv_destroyloop(_a, _b) ((void) 0)
-#define LWS_LIBUV_ENABLED(context) (0)
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
-#define lws_feature_status_libuv(_a) \
- lwsl_notice("libuv support not compiled in\n")
-#else
-#define lws_feature_status_libuv(_a)
-#endif
-#endif
-
-#if defined(LWS_WITH_LIBEVENT)
-LWS_EXTERN void
-lws_libevent_accept(struct lws *new_wsi, lws_sock_file_fd_type desc);
-LWS_EXTERN void
-lws_libevent_io(struct lws *wsi, int flags);
-LWS_EXTERN int
-lws_libevent_init_fd_table(struct lws_context *context);
-LWS_EXTERN void
-lws_libevent_destroyloop(struct lws_context *context, int tsi);
-LWS_EXTERN void
-lws_libevent_run(const struct lws_context *context, int tsi);
-#define LWS_LIBEVENT_ENABLED(context) lws_check_opt(context->options, LWS_SERVER_OPTION_LIBEVENT)
-LWS_EXTERN void lws_feature_status_libevent(struct lws_context_creation_info *info);
-#else
-#define lws_libevent_accept(_a, _b) ((void) 0)
-#define lws_libevent_io(_a, _b) ((void) 0)
-#define lws_libevent_init_fd_table(_a) (0)
-#define lws_libevent_run(_a, _b) ((void) 0)
-#define lws_libevent_destroyloop(_a, _b) ((void) 0)
-#define LWS_LIBEVENT_ENABLED(context) (0)
-#if LWS_POSIX && !defined(LWS_WITH_ESP32)
-#define lws_feature_status_libevent(_a) \
- lwsl_notice("libevent support not compiled in\n")
-#else
-#define lws_feature_status_libevent(_a)
-#endif
-#endif
-
-
-#ifdef LWS_WITH_IPV6
-#define LWS_IPV6_ENABLED(vh) \
- (!lws_check_opt(vh->context->options, LWS_SERVER_OPTION_DISABLE_IPV6) && \
- !lws_check_opt(vh->options, LWS_SERVER_OPTION_DISABLE_IPV6))
-#else
-#define LWS_IPV6_ENABLED(context) (0)
-#endif
-
-#ifdef LWS_WITH_UNIX_SOCK
-#define LWS_UNIX_SOCK_ENABLED(vhost) \
- (vhost->options & LWS_SERVER_OPTION_UNIX_SOCK)
-#else
-#define LWS_UNIX_SOCK_ENABLED(vhost) (0)
-#endif
-
-enum uri_path_states {
- URIPS_IDLE,
- URIPS_SEEN_SLASH,
- URIPS_SEEN_SLASH_DOT,
- URIPS_SEEN_SLASH_DOT_DOT,
-};
-
-enum uri_esc_states {
- URIES_IDLE,
- URIES_SEEN_PERCENT,
- URIES_SEEN_PERCENT_H1,
-};
-
-/* notice that these union members:
- *
- * hdr
- * http
- * http2
- *
- * all have a pointer to allocated_headers struct as their first member.
- *
- * It means for allocated_headers access, the three union paths can all be
- * used interchangeably to access the same data
- */
-
-
-#ifndef LWS_NO_CLIENT
-struct client_info_stash {
- char address[256];
- char path[4096];
- char host[256];
- char origin[256];
- char protocol[256];
- char method[16];
- char iface[16];
-};
-#endif
-
-struct _lws_header_related {
- /* MUST be first in struct */
- struct allocated_headers *ah;
- struct lws *ah_wait_list;
- unsigned char *preamble_rx;
-#ifndef LWS_NO_CLIENT
- struct client_info_stash *stash;
-#endif
- unsigned int preamble_rx_len;
- enum uri_path_states ups;
- enum uri_esc_states ues;
- short lextable_pos;
- unsigned int current_token_limit;
-
- char esc_stash;
- char post_literal_equal;
- unsigned char parser_state; /* enum lws_token_indexes */
-};
-
-#if defined(LWS_WITH_RANGES)
-enum range_states {
- LWSRS_NO_ACTIVE_RANGE,
- LWSRS_BYTES_EQ,
- LWSRS_FIRST,
- LWSRS_STARTING,
- LWSRS_ENDING,
- LWSRS_COMPLETED,
- LWSRS_SYNTAX,
-};
-
-struct lws_range_parsing {
- unsigned long long start, end, extent, agg, budget;
- const char buf[128];
- int pos;
- enum range_states state;
- char start_valid, end_valid, ctr, count_ranges, did_try, inside, send_ctr;
-};
-
-int
-lws_ranges_init(struct lws *wsi, struct lws_range_parsing *rp, unsigned long long extent);
-int
-lws_ranges_next(struct lws_range_parsing *rp);
-void
-lws_ranges_reset(struct lws_range_parsing *rp);
-#endif
-
-struct _lws_http_mode_related {
- /* MUST be first in struct */
- struct allocated_headers *ah; /* mirroring _lws_header_related */
- struct lws *ah_wait_list;
- unsigned char *preamble_rx;
-#ifndef LWS_NO_CLIENT
- struct client_info_stash *stash;
-#endif
- unsigned int preamble_rx_len;
- struct lws *new_wsi_list;
- lws_filepos_t filepos;
- lws_filepos_t filelen;
- lws_fop_fd_t fop_fd;
-
-#if defined(LWS_WITH_RANGES)
- struct lws_range_parsing range;
- char multipart_content_type[64];
-#endif
-
- enum http_version request_version;
- enum http_connection_type connection_type;
- lws_filepos_t tx_content_length;
- lws_filepos_t tx_content_remain;
- lws_filepos_t rx_content_length;
- lws_filepos_t rx_content_remain;
-};
-
-#define LWS_H2_FRAME_HEADER_LENGTH 9
-
-#ifdef LWS_WITH_HTTP2
-
-enum lws_h2_wellknown_frame_types {
- LWS_H2_FRAME_TYPE_DATA,
- LWS_H2_FRAME_TYPE_HEADERS,
- LWS_H2_FRAME_TYPE_PRIORITY,
- LWS_H2_FRAME_TYPE_RST_STREAM,
- LWS_H2_FRAME_TYPE_SETTINGS,
- LWS_H2_FRAME_TYPE_PUSH_PROMISE,
- LWS_H2_FRAME_TYPE_PING,
- LWS_H2_FRAME_TYPE_GOAWAY,
- LWS_H2_FRAME_TYPE_WINDOW_UPDATE,
- LWS_H2_FRAME_TYPE_CONTINUATION,
-
- LWS_H2_FRAME_TYPE_COUNT /* always last */
-};
-
-enum lws_h2_flags {
- LWS_H2_FLAG_END_STREAM = 1,
- LWS_H2_FLAG_END_HEADERS = 4,
- LWS_H2_FLAG_PADDED = 8,
- LWS_H2_FLAG_PRIORITY = 0x20,
-
- LWS_H2_FLAG_SETTINGS_ACK = 1,
-};
-
-enum lws_h2_errors {
- H2_ERR_NO_ERROR, /* Graceful shutdown */
- H2_ERR_PROTOCOL_ERROR, /* Protocol error detected */
- H2_ERR_INTERNAL_ERROR, /* Implementation fault */
- H2_ERR_FLOW_CONTROL_ERROR, /* Flow-control limits exceeded */
- H2_ERR_SETTINGS_TIMEOUT, /* Settings not acknowledged */
- H2_ERR_STREAM_CLOSED, /* Frame received for closed stream */
- H2_ERR_FRAME_SIZE_ERROR, /* Frame size incorrect */
- H2_ERR_REFUSED_STREAM, /* Stream not processed */
- H2_ERR_CANCEL, /* Stream cancelled */
- H2_ERR_COMPRESSION_ERROR, /* Compression state not updated */
- H2_ERR_CONNECT_ERROR, /* TCP connection error for CONNECT method */
- H2_ERR_ENHANCE_YOUR_CALM, /* Processing capacity exceeded */
- H2_ERR_INADEQUATE_SECURITY, /* Negotiated TLS parameters not acceptable */
- H2_ERR_HTTP_1_1_REQUIRED, /* Use HTTP/1.1 for the request */
-};
-
-enum lws_h2_states {
- LWS_H2_STATE_IDLE,
- /*
- * Send PUSH_PROMISE -> LWS_H2_STATE_RESERVED_LOCAL
- * Recv PUSH_PROMISE -> LWS_H2_STATE_RESERVED_REMOTE
- * Send HEADERS -> LWS_H2_STATE_OPEN
- * Recv HEADERS -> LWS_H2_STATE_OPEN
- *
- * - Only PUSH_PROMISE + HEADERS valid to send
- * - Only HEADERS or PRIORITY valid to receive
- */
- LWS_H2_STATE_RESERVED_LOCAL,
- /*
- * Send RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv RST_STREAM -> LWS_H2_STATE_CLOSED
- * Send HEADERS -> LWS_H2_STATE_HALF_CLOSED_REMOTE
- *
- * - Only HEADERS, RST_STREAM, or PRIORITY valid to send
- * - Only RST_STREAM, PRIORITY, or WINDOW_UPDATE valid to receive
- */
- LWS_H2_STATE_RESERVED_REMOTE,
- /*
- * Send RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv HEADERS -> LWS_H2_STATE_HALF_CLOSED_LOCAL
- *
- * - Only RST_STREAM, WINDOW_UPDATE, or PRIORITY valid to send
- * - Only HEADERS, RST_STREAM, or PRIORITY valid to receive
- */
- LWS_H2_STATE_OPEN,
- /*
- * Send RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv RST_STREAM -> LWS_H2_STATE_CLOSED
- * Send END_STREAM flag -> LWS_H2_STATE_HALF_CLOSED_LOCAL
- * Recv END_STREAM flag -> LWS_H2_STATE_HALF_CLOSED_REMOTE
- */
- LWS_H2_STATE_HALF_CLOSED_REMOTE,
- /*
- * Send RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv RST_STREAM -> LWS_H2_STATE_CLOSED
- * Send END_STREAM flag -> LWS_H2_STATE_CLOSED
- *
- * - Any frame valid to send
- * - Only WINDOW_UPDATE, PRIORITY, or RST_STREAM valid to receive
- */
- LWS_H2_STATE_HALF_CLOSED_LOCAL,
- /*
- * Send RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv RST_STREAM -> LWS_H2_STATE_CLOSED
- * Recv END_STREAM flag -> LWS_H2_STATE_CLOSED
- *
- * - Only WINDOW_UPDATE, PRIORITY, and RST_STREAM valid to send
- * - Any frame valid to receive
- */
- LWS_H2_STATE_CLOSED,
- /*
- * - Only PRIORITY, WINDOW_UPDATE (IGNORE) and RST_STREAM (IGNORE)
- * may be received
- *
- * - Only PRIORITY valid to send
- */
-};
-
-#define LWS_H2_STREAM_ID_MASTER 0
-#define LWS_H2_SETTINGS_LEN 6
-
-enum http2_hpack_state {
- HPKS_TYPE,
-
- HPKS_IDX_EXT,
-
- HPKS_HLEN,
- HPKS_HLEN_EXT,
-
- HPKS_DATA,
-};
-
-/*
- * lws general parsimonious header strategy is only store values from known
- * headers, and refer to them by index.
- *
- * That means if we can't map the peer header name to one that lws knows, we
- * will drop the content but track the indexing with associated_lws_hdr_idx =
- * LWS_HPACK_IGNORE_ENTRY.
- */
-
-enum http2_hpack_type {
- HPKT_INDEXED_HDR_7, /* 1xxxxxxx: just "header field" */
- HPKT_INDEXED_HDR_6_VALUE_INCR, /* 01xxxxxx: NEW indexed hdr with value */
- HPKT_LITERAL_HDR_VALUE_INCR, /* 01000000: NEW literal hdr with value */
- HPKT_INDEXED_HDR_4_VALUE, /* 0000xxxx: indexed hdr with value */
- HPKT_INDEXED_HDR_4_VALUE_NEVER, /* 0001xxxx: indexed hdr with value NEVER NEW */
- HPKT_LITERAL_HDR_VALUE, /* 00000000: literal hdr with value */
- HPKT_LITERAL_HDR_VALUE_NEVER, /* 00010000: literal hdr with value NEVER NEW */
- HPKT_SIZE_5
-};
-
-#define LWS_HPACK_IGNORE_ENTRY 0xffff
-
-
-struct hpack_dt_entry {
- char *value; /* malloc'd */
- uint16_t value_len;
- uint16_t hdr_len; /* virtual, for accounting */
- uint16_t lws_hdr_idx; /* LWS_HPACK_IGNORE_ENTRY = IGNORE */
-};
-
-struct hpack_dynamic_table {
- struct hpack_dt_entry *entries; /* malloc'd */
- uint32_t virtual_payload_usage;
- uint32_t virtual_payload_max;
- uint16_t pos;
- uint16_t used_entries;
- uint16_t num_entries;
-};
-
-enum lws_h2_protocol_send_type {
- LWS_PPS_NONE,
- LWS_H2_PPS_MY_SETTINGS,
- LWS_H2_PPS_ACK_SETTINGS,
- LWS_H2_PPS_PONG,
- LWS_H2_PPS_GOAWAY,
- LWS_H2_PPS_RST_STREAM,
- LWS_H2_PPS_UPDATE_WINDOW,
-};
-
-struct lws_h2_protocol_send {
- struct lws_h2_protocol_send *next; /* linked list */
- enum lws_h2_protocol_send_type type;
-
- union uu {
- struct {
- char str[32];
- uint32_t highest_sid;
- uint32_t err;
- } ga;
- struct {
- uint32_t sid;
- uint32_t err;
- } rs;
- struct {
- uint8_t ping_payload[8];
- } ping;
- struct {
- uint32_t sid;
- uint32_t credit;
- } update_window;
- } u;
-};
-
-struct lws_h2_ghost_sid {
- struct lws_h2_ghost_sid *next;
- uint32_t sid;
-};
-
-#define LWS_H2_RX_SCRATCH_SIZE 512
-
-/*
- * http/2 connection info that is only used by the root connection that has
- * the network connection.
- *
- * h2 tends to spawn many child connections from one network connection, so
- * it's necessary to make members only needed by the network connection
- * distinct and only malloc'd on network connections.
- *
- * There's only one HPACK parser per network connection.
- *
- * But there is an ah per logical child connection... the network connection
- * fills it but it belongs to the logical child.
- */
-struct lws_h2_netconn {
- struct http2_settings set;
- struct hpack_dynamic_table hpack_dyn_table;
- uint8_t ping_payload[8];
- uint8_t one_setting[LWS_H2_SETTINGS_LEN];
- char goaway_str[32]; /* for rx */
- struct lws *swsi;
- struct lws_h2_protocol_send *pps; /* linked list */
- char *rx_scratch;
-
- enum http2_hpack_state hpack;
- enum http2_hpack_type hpack_type;
-
- unsigned int huff:1;
- unsigned int value:1;
- unsigned int unknown_header:1;
- unsigned int cont_exp:1;
- unsigned int cont_exp_headers:1;
- unsigned int we_told_goaway:1;
- unsigned int pad_length:1;
- unsigned int collected_priority:1;
- unsigned int is_first_header_char:1;
- unsigned int seen_nonpseudoheader:1;
- unsigned int zero_huff_padding:1;
- unsigned int last_action_dyntable_resize:1;
-
- uint32_t hdr_idx;
- uint32_t hpack_len;
- uint32_t hpack_e_dep;
- uint32_t count;
- uint32_t preamble;
- uint32_t length;
- uint32_t sid;
- uint32_t inside;
- uint32_t highest_sid;
- uint32_t highest_sid_opened;
- uint32_t cont_exp_sid;
- uint32_t dep;
- uint32_t goaway_last_sid;
- uint32_t goaway_err;
- uint32_t hpack_hdr_len;
-
- uint32_t rx_scratch_pos;
- uint32_t rx_scratch_len;
-
- uint16_t hpack_pos;
-
- uint8_t frame_state;
- uint8_t type;
- uint8_t flags;
- uint8_t padding;
- uint8_t weight_temp;
- uint8_t huff_pad;
- char first_hdr_char;
- uint8_t hpack_m;
- uint8_t ext_count;
-};
-
-struct _lws_h2_related {
- /*
- * having this first lets us also re-use all HTTP union code
- * and in turn, http_mode_related has allocated headers in right
- * place so we can use the header apis on the wsi directly still
- */
- struct _lws_http_mode_related http; /* MUST BE FIRST IN STRUCT */
-
- struct lws_h2_netconn *h2n; /* malloc'd for root net conn */
- struct lws *parent_wsi;
- struct lws *child_list;
- struct lws *sibling_list;
-
- char *pending_status_body;
-
- int tx_cr;
- int peer_tx_cr_est;
- unsigned int my_sid;
- unsigned int child_count;
- int my_priority;
- uint32_t dependent_on;
-
- unsigned int END_STREAM:1;
- unsigned int END_HEADERS:1;
- unsigned int send_END_STREAM:1;
- unsigned int GOING_AWAY;
- unsigned int requested_POLLOUT:1;
- unsigned int skint:1;
-
- uint16_t round_robin_POLLOUT;
- uint16_t count_POLLOUT_children;
- uint8_t h2_state; /* the RFC7540 state of the connection */
- uint8_t weight;
-
- uint8_t initialized;
-};
-
-#define HTTP2_IS_TOPLEVEL_WSI(wsi) (!wsi->u.h2.parent_wsi)
-
-#endif
-
-struct _lws_websocket_related {
- /* cheapest way to deal with ah overlap with ws union transition */
- struct _lws_header_related hdr;
- char *rx_ubuf;
- unsigned int rx_ubuf_alloc;
- struct lws *rx_draining_ext_list;
- struct lws *tx_draining_ext_list;
- time_t time_next_ping_check;
- size_t rx_packet_length;
- unsigned int rx_ubuf_head;
- unsigned char mask[4];
- /* Also used for close content... control opcode == < 128 */
- unsigned char ping_payload_buf[128 - 3 + LWS_PRE];
-
- unsigned char ping_payload_len;
- unsigned char mask_idx;
- unsigned char opcode;
- unsigned char rsv;
- unsigned char rsv_first_msg;
- /* zero if no info, or length including 2-byte close code */
- unsigned char close_in_ping_buffer_len;
- unsigned char utf8;
- unsigned char stashed_write_type;
- unsigned char tx_draining_stashed_wp;
-
- unsigned int final:1;
- unsigned int frame_is_binary:1;
- unsigned int all_zero_nonce:1;
- unsigned int this_frame_masked:1;
- unsigned int inside_frame:1; /* next write will be more of frame */
- unsigned int clean_buffer:1; /* buffer not rewritten by extension */
- unsigned int payload_is_close:1; /* process as PONG, but it is close */
- unsigned int ping_pending_flag:1;
- unsigned int continuation_possible:1;
- unsigned int owed_a_fin:1;
- unsigned int check_utf8:1;
- unsigned int defeat_check_utf8:1;
- unsigned int pmce_compressed_message:1;
- unsigned int stashed_write_pending:1;
- unsigned int rx_draining_ext:1;
- unsigned int tx_draining_ext:1;
- unsigned int send_check_ping:1;
- unsigned int first_fragment:1;
-};
-
-#ifdef LWS_WITH_CGI
-
-#define LWS_HTTP_CHUNK_HDR_SIZE 16
-
-enum {
- SIGNIFICANT_HDR_CONTENT_LENGTH,
- SIGNIFICANT_HDR_LOCATION,
- SIGNIFICANT_HDR_STATUS,
- SIGNIFICANT_HDR_TRANSFER_ENCODING,
-
- SIGNIFICANT_HDR_COUNT
-};
-
-/* wsi who is master of the cgi points to an lws_cgi */
-
-struct lws_cgi {
- struct lws_cgi *cgi_list;
- struct lws *stdwsi[3]; /* points to the associated stdin/out/err wsis */
- struct lws *wsi; /* owner */
- unsigned char *headers_buf;
- unsigned char *headers_start;
- unsigned char *headers_pos;
- unsigned char *headers_dumped;
- unsigned char *headers_end;
- lws_filepos_t content_length;
- lws_filepos_t content_length_seen;
- int pipe_fds[3][2];
- int match[SIGNIFICANT_HDR_COUNT];
- int pid;
- int response_code;
- int lp;
- char l[12];
-
- unsigned int being_closed:1;
- unsigned int explicitly_chunked:1;
-
- unsigned char chunked_grace;
-};
-#endif
-
-signed char char_to_hex(const char c);
-
-#ifndef LWS_NO_CLIENT
-enum lws_chunk_parser {
- ELCP_HEX,
- ELCP_CR,
- ELCP_CONTENT,
- ELCP_POST_CR,
- ELCP_POST_LF,
-};
-#endif
-
-enum lws_parse_urldecode_results {
- LPUR_CONTINUE,
- LPUR_SWALLOW,
- LPUR_FORBID,
- LPUR_EXCESSIVE,
-};
-
-struct lws_rewrite;
-
-#ifdef LWS_WITH_ACCESS_LOG
-struct lws_access_log {
- char *header_log;
- char *user_agent;
- char *referrer;
- unsigned long sent;
- int response;
-};
-#endif
-
-struct lws {
-
- /* structs */
- /* members with mutually exclusive lifetimes are unionized */
-
- union u {
- struct _lws_http_mode_related http;
-#ifdef LWS_WITH_HTTP2
- struct _lws_h2_related h2;
-#endif
- struct _lws_header_related hdr;
- struct _lws_websocket_related ws;
- } u;
-
- /* lifetime members */
-
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)
- struct lws_io_watcher w_read;
-#endif
-#if defined(LWS_WITH_LIBEV) || defined(LWS_WITH_LIBEVENT)
- struct lws_io_watcher w_write;
-#endif
-#ifdef LWS_WITH_ACCESS_LOG
- struct lws_access_log access_log;
-#endif
- time_t pending_timeout_limit;
-
- /* pointers */
-
- struct lws_context *context;
- struct lws_vhost *vhost;
- struct lws *parent; /* points to parent, if any */
- struct lws *child_list; /* points to first child */
- struct lws *sibling_list; /* subsequent children at same level */
-#ifdef LWS_WITH_CGI
- struct lws_cgi *cgi; /* wsi being cgi master have one of these */
-#endif
- const struct lws_protocols *protocol;
- struct lws **same_vh_protocol_prev, *same_vh_protocol_next;
- struct lws *timeout_list;
- struct lws **timeout_list_prev;
-#if defined(LWS_WITH_PEER_LIMITS)
- struct lws_peer *peer;
-#endif
-
- void *user_space;
- void *opaque_parent_data;
- /* rxflow handling */
- unsigned char *rxflow_buffer;
- /* truncated send handling */
- unsigned char *trunc_alloc; /* non-NULL means buffering in progress */
-
-#if defined (LWS_WITH_ESP8266)
- void *premature_rx;
- unsigned short prem_rx_size, prem_rx_pos;
-#endif
-
-#ifndef LWS_NO_EXTENSIONS
- const struct lws_extension *active_extensions[LWS_MAX_EXTENSIONS_ACTIVE];
- void *act_ext_user[LWS_MAX_EXTENSIONS_ACTIVE];
-#endif
-#ifdef LWS_OPENSSL_SUPPORT
- SSL *ssl;
- BIO *client_bio;
- struct lws *pending_read_list_prev, *pending_read_list_next;
-#if defined(LWS_WITH_STATS)
- uint64_t accept_start_us;
- char seen_rx;
-#endif
-#endif
-#ifdef LWS_WITH_HTTP_PROXY
- struct lws_rewrite *rw;
-#endif
-#ifdef LWS_LATENCY
- unsigned long action_start;
- unsigned long latency_start;
-#endif
- lws_sock_file_fd_type desc; /* .filefd / .sockfd */
-#if defined(LWS_WITH_STATS)
- uint64_t active_writable_req_us;
-#endif
- /* ints */
- int position_in_fds_table;
- uint32_t rxflow_len;
- uint32_t rxflow_pos;
- unsigned int trunc_alloc_len; /* size of malloc */
- unsigned int trunc_offset; /* where we are in terms of spilling */
- unsigned int trunc_len; /* how much is buffered */
-#ifndef LWS_NO_CLIENT
- int chunk_remaining;
-#endif
- unsigned int cache_secs;
-
- unsigned int hdr_parsing_completed:1;
- unsigned int http2_substream:1;
- unsigned int upgraded_to_http2:1;
- unsigned int listener:1;
- unsigned int user_space_externally_allocated:1;
- unsigned int socket_is_permanently_unusable:1;
- unsigned int rxflow_change_to:2;
- unsigned int more_rx_waiting:1; /* has to live here since ah may stick to end */
- unsigned int conn_stat_done:1;
- unsigned int cache_reuse:1;
- unsigned int cache_revalidate:1;
- unsigned int cache_intermediaries:1;
- unsigned int favoured_pollin:1;
- unsigned int sending_chunked:1;
- unsigned int already_did_cce:1;
- unsigned int told_user_closed:1;
- unsigned int waiting_to_send_close_frame:1;
- unsigned int ipv6:1;
- unsigned int parent_carries_io:1;
- unsigned int parent_pending_cb_on_writable:1;
- unsigned int cgi_stdout_zero_length:1;
- unsigned int seen_zero_length_recv:1;
- unsigned int rxflow_will_be_applied:1;
-
-#if defined(LWS_WITH_ESP8266)
- unsigned int pending_send_completion:3;
- unsigned int close_is_pending_send_completion:1;
-#endif
-#ifdef LWS_WITH_ACCESS_LOG
- unsigned int access_log_pending:1;
-#endif
-#ifndef LWS_NO_CLIENT
- unsigned int do_ws:1; /* whether we are doing http or ws flow */
- unsigned int chunked:1; /* if the clientside connection is chunked */
- unsigned int client_rx_avail:1;
- unsigned int client_http_body_pending:1;
-#endif
-#ifdef LWS_WITH_HTTP_PROXY
- unsigned int perform_rewrite:1;
-#endif
-#ifndef LWS_NO_EXTENSIONS
- unsigned int extension_data_pending:1;
-#endif
-#ifdef LWS_OPENSSL_SUPPORT
- unsigned int use_ssl:4;
-#endif
-#ifdef _WIN32
- unsigned int sock_send_blocking:1;
-#endif
-#ifdef LWS_OPENSSL_SUPPORT
- unsigned int redirect_to_https:1;
-#endif
-
- /* volatile to make sure code is aware other thread can change */
- volatile unsigned int handling_pollout:1;
- volatile unsigned int leave_pollout_active:1;
-
-#ifndef LWS_NO_CLIENT
- unsigned short c_port;
-#endif
-
- /* chars */
-#ifndef LWS_NO_EXTENSIONS
- unsigned char count_act_ext;
-#endif
- uint8_t ietf_spec_revision;
- char mode; /* enum connection_mode */
- char state; /* enum lws_connection_states */
- char state_pre_close;
- char lws_rx_parse_state; /* enum lws_rx_parse_state */
- char rx_frame_type; /* enum lws_write_protocol */
- char pending_timeout; /* enum pending_timeout */
- char tsi; /* thread service index we belong to */
- char protocol_interpret_idx;
- char redirects;
- uint8_t rxflow_bitmap;
-#ifdef LWS_WITH_CGI
- char cgi_channel; /* which of stdin/out/err */
- char hdr_state;
-#endif
-#ifndef LWS_NO_CLIENT
- char chunk_parser; /* enum lws_chunk_parser */
-#endif
-#if defined(LWS_WITH_CGI) || !defined(LWS_NO_CLIENT)
- char reason_bf; /* internal writeable callback reason bitfield */
-#endif
-};
-
-#define lws_is_flowcontrolled(w) (!!(wsi->rxflow_bitmap))
-
-LWS_EXTERN int log_level;
-
-LWS_EXTERN int
-lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
- const char *iface);
-
-#if defined(LWS_WITH_IPV6)
-LWS_EXTERN unsigned long
-lws_get_addr_scope(const char *ipaddr);
-#endif
-
-LWS_EXTERN void
-lws_close_free_wsi(struct lws *wsi, enum lws_close_status);
-
-LWS_EXTERN void
-lws_free_wsi(struct lws *wsi);
-
-LWS_EXTERN int
-remove_wsi_socket_from_fds(struct lws *wsi);
-LWS_EXTERN int
-lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len);
-
-#ifndef LWS_LATENCY
-static inline void
-lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
- int ret, int completion) {
- do {
- (void)context; (void)wsi; (void)action; (void)ret;
- (void)completion;
- } while (0);
-}
-static inline void
-lws_latency_pre(struct lws_context *context, struct lws *wsi) {
- do { (void)context; (void)wsi; } while (0);
-}
-#else
-#define lws_latency_pre(_context, _wsi) lws_latency(_context, _wsi, NULL, 0, 0)
-extern void
-lws_latency(struct lws_context *context, struct lws *wsi, const char *action,
- int ret, int completion);
-#endif
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_client_rx_sm(struct lws *wsi, unsigned char c);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_parse(struct lws *wsi, unsigned char c);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_parse_urldecode(struct lws *wsi, uint8_t *_c);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_http_action(struct lws *wsi);
-
-LWS_EXTERN int
-lws_b64_selftest(void);
-
-LWS_EXTERN int
-lws_service_flag_pending(struct lws_context *context, int tsi);
-
-#if defined(_WIN32) || defined(LWS_WITH_ESP8266)
-LWS_EXTERN struct lws *
-wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd);
-
-LWS_EXTERN int
-insert_wsi(struct lws_context *context, struct lws *wsi);
-
-LWS_EXTERN int
-delete_from_fd(struct lws_context *context, lws_sockfd_type fd);
-#else
-#define wsi_from_fd(A,B) A->lws_lookup[B]
-#define insert_wsi(A,B) assert(A->lws_lookup[B->desc.sockfd] == 0); A->lws_lookup[B->desc.sockfd]=B
-#define delete_from_fd(A,B) A->lws_lookup[B]=0
-#endif
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len);
-
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_service_timeout_check(struct lws *wsi, unsigned int sec);
-
-LWS_EXTERN void
-lws_remove_from_timeout_list(struct lws *wsi);
-
-LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
-lws_client_connect_2(struct lws *wsi);
-
-LWS_VISIBLE struct lws * LWS_WARN_UNUSED_RESULT
-lws_client_reset(struct lws **wsi, int ssl, const char *address, int port,
- const char *path, const char *host);
-
-LWS_EXTERN struct lws * LWS_WARN_UNUSED_RESULT
-lws_create_new_server_wsi(struct lws_vhost *vhost);
-
-LWS_EXTERN char * LWS_WARN_UNUSED_RESULT
-lws_generate_client_handshake(struct lws *wsi, char *pkt);
-
-LWS_EXTERN int
-lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd);
-
-LWS_EXTERN struct lws *
-lws_client_connect_via_info2(struct lws *wsi);
-
-LWS_EXTERN int
-_lws_destroy_ah(struct lws_context_per_thread *pt, struct allocated_headers *ah);
-
-/*
- * EXTENSIONS
- */
-
-#ifndef LWS_NO_EXTENSIONS
-LWS_VISIBLE void
-lws_context_init_extensions(struct lws_context_creation_info *info,
- struct lws_context *context);
-LWS_EXTERN int
-lws_any_extension_handled(struct lws *wsi, enum lws_extension_callback_reasons r,
- void *v, size_t len);
-
-LWS_EXTERN int
-lws_ext_cb_active(struct lws *wsi, int reason, void *buf, int len);
-LWS_EXTERN int
-lws_ext_cb_all_exts(struct lws_context *context, struct lws *wsi, int reason,
- void *arg, int len);
-
-#else
-#define lws_any_extension_handled(_a, _b, _c, _d) (0)
-#define lws_ext_cb_active(_a, _b, _c, _d) (0)
-#define lws_ext_cb_all_exts(_a, _b, _c, _d, _e) (0)
-#define lws_issue_raw_ext_access lws_issue_raw
-#define lws_context_init_extensions(_a, _b)
-#endif
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_client_interpret_server_handshake(struct lws *wsi);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_rx_sm(struct lws *wsi, unsigned char c);
-
-LWS_EXTERN int
-lws_payload_until_length_exhausted(struct lws *wsi, unsigned char **buf, size_t *len);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_issue_raw_ext_access(struct lws *wsi, unsigned char *buf, size_t len);
-
-LWS_EXTERN void
-lws_union_transition(struct lws *wsi, enum connection_mode mode);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-user_callback_handle_rxflow(lws_callback_function, struct lws *wsi,
- enum lws_callback_reasons reason, void *user,
- void *in, size_t len);
-#ifdef LWS_WITH_HTTP2
-struct lws * lws_h2_get_nth_child(struct lws *wsi, int n);
-LWS_EXTERN void lws_h2_init(struct lws *wsi);
-LWS_EXTERN int
-lws_h2_settings(struct lws *nwsi, struct http2_settings *settings,
- unsigned char *buf, int len);
-LWS_EXTERN int
-lws_h2_parser(struct lws *wsi, unsigned char c);
-LWS_EXTERN int lws_h2_do_pps_send(struct lws *wsi);
-LWS_EXTERN int lws_h2_frame_write(struct lws *wsi, int type, int flags,
- unsigned int sid, unsigned int len,
- unsigned char *buf);
-LWS_EXTERN struct lws *
-lws_h2_wsi_from_id(struct lws *wsi, unsigned int sid);
-LWS_EXTERN int lws_hpack_interpret(struct lws *wsi,
- unsigned char c);
-LWS_EXTERN int
-lws_add_http2_header_by_name(struct lws *wsi,
- const unsigned char *name,
- const unsigned char *value, int length,
- unsigned char **p, unsigned char *end);
-LWS_EXTERN int
-lws_add_http2_header_by_token(struct lws *wsi,
- enum lws_token_indexes token,
- const unsigned char *value, int length,
- unsigned char **p, unsigned char *end);
-LWS_EXTERN int
-lws_add_http2_header_status(struct lws *wsi,
- unsigned int code, unsigned char **p,
- unsigned char *end);
-LWS_EXTERN int
-lws_h2_configure_if_upgraded(struct lws *wsi);
-LWS_EXTERN void
-lws_hpack_destroy_dynamic_header(struct lws *wsi);
-LWS_EXTERN int
-lws_hpack_dynamic_size(struct lws *wsi, int size);
-LWS_EXTERN int
-lws_h2_goaway(struct lws *wsi, uint32_t err, const char *reason);
-LWS_EXTERN int
-lws_h2_tx_cr_get(struct lws *wsi);
-LWS_EXTERN void
-lws_h2_tx_cr_consume(struct lws *wsi, int consumed);
-LWS_EXTERN int
-lws_hdr_extant(struct lws *wsi, enum lws_token_indexes h);
-LWS_EXTERN void
-lws_pps_schedule(struct lws *wsi, struct lws_h2_protocol_send *pss);
-
-LWS_EXTERN const struct http2_settings lws_h2_defaults;
-#else
-#define lws_h2_configure_if_upgraded(x)
-#endif
-
-LWS_EXTERN int
-lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd);
-
-LWS_EXTERN int
-lws_plat_check_connection_error(struct lws *wsi);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_header_table_attach(struct lws *wsi, int autoservice);
-
-LWS_EXTERN int
-lws_header_table_detach(struct lws *wsi, int autoservice);
-
-LWS_EXTERN void
-lws_header_table_reset(struct lws *wsi, int autoservice);
-void
-_lws_header_table_reset(struct allocated_headers *ah);
-
-void
-lws_header_table_force_to_detachable_state(struct lws *wsi);
-int
-lws_header_table_is_in_detachable_state(struct lws *wsi);
-
-LWS_EXTERN char * LWS_WARN_UNUSED_RESULT
-lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_hdr_simple_create(struct lws *wsi, enum lws_token_indexes h, const char *s);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ensure_user_space(struct lws *wsi);
-
-LWS_EXTERN int
-lws_change_pollfd(struct lws *wsi, int _and, int _or);
-
-#ifndef LWS_NO_SERVER
-int lws_context_init_server(struct lws_context_creation_info *info,
- struct lws_vhost *vhost);
-LWS_EXTERN struct lws_vhost *
-lws_select_vhost(struct lws_context *context, int port, const char *servername);
-LWS_EXTERN int
-handshake_0405(struct lws_context *context, struct lws *wsi);
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_interpret_incoming_packet(struct lws *wsi, unsigned char **buf, size_t len);
-LWS_EXTERN void
-lws_server_get_canonical_hostname(struct lws_context *context,
- struct lws_context_creation_info *info);
-#else
-#define lws_context_init_server(_a, _b) (0)
-#define lws_interpret_incoming_packet(_a, _b, _c) (0)
-#define lws_server_get_canonical_hostname(_a, _b)
-#endif
-
-#ifndef LWS_NO_DAEMONIZE
-LWS_EXTERN int get_daemonize_pid();
-#else
-#define get_daemonize_pid() (0)
-#endif
-
-#if !defined(LWS_WITH_ESP8266)
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-interface_to_sa(struct lws_vhost *vh, const char *ifname,
- struct sockaddr_in *addr, size_t addrlen);
-#endif
-LWS_EXTERN void lwsl_emit_stderr(int level, const char *line);
-
-enum lws_ssl_capable_status {
- LWS_SSL_CAPABLE_ERROR = -1,
- LWS_SSL_CAPABLE_MORE_SERVICE = -2,
-};
-
-#ifndef LWS_OPENSSL_SUPPORT
-#define LWS_SSL_ENABLED(context) (0)
-#define lws_context_init_server_ssl(_a, _b) (0)
-#define lws_ssl_destroy(_a)
-#define lws_context_init_http2_ssl(_a)
-#define lws_ssl_capable_read lws_ssl_capable_read_no_ssl
-#define lws_ssl_capable_write lws_ssl_capable_write_no_ssl
-#define lws_ssl_pending lws_ssl_pending_no_ssl
-#define lws_server_socket_service_ssl(_b, _c) (0)
-#define lws_ssl_close(_a) (0)
-#define lws_ssl_context_destroy(_a)
-#define lws_ssl_SSL_CTX_destroy(_a)
-#define lws_ssl_remove_wsi_from_buffered_list(_a)
-#define lws_context_init_ssl_library(_a)
-#define lws_ssl_anybody_has_buffered_read_tsi(_a, _b) (0)
-#else
-#define LWS_SSL_ENABLED(context) (context->use_ssl)
-LWS_EXTERN int openssl_websocket_private_data_index;
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len);
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len);
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ssl_pending(struct lws *wsi);
-LWS_EXTERN int
-lws_context_init_ssl_library(struct lws_context_creation_info *info);
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_server_socket_service_ssl(struct lws *new_wsi, lws_sockfd_type accept_fd);
-LWS_EXTERN int
-lws_ssl_close(struct lws *wsi);
-LWS_EXTERN void
-lws_ssl_SSL_CTX_destroy(struct lws_vhost *vhost);
-LWS_EXTERN void
-lws_ssl_context_destroy(struct lws_context *context);
-LWS_VISIBLE void
-lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi);
-LWS_EXTERN int
-lws_ssl_client_bio_create(struct lws *wsi);
-LWS_EXTERN int
-lws_ssl_client_connect1(struct lws *wsi);
-LWS_EXTERN int
-lws_ssl_client_connect2(struct lws *wsi);
-LWS_EXTERN void
-lws_ssl_elaborate_error(void);
-LWS_EXTERN int
-lws_ssl_anybody_has_buffered_read_tsi(struct lws_context *context, int tsi);
-#ifndef LWS_NO_SERVER
-LWS_EXTERN int
-lws_context_init_server_ssl(struct lws_context_creation_info *info,
- struct lws_vhost *vhost);
-#else
-#define lws_context_init_server_ssl(_a, _b) (0)
-#endif
-LWS_EXTERN void
-lws_ssl_destroy(struct lws_vhost *vhost);
-/* HTTP2-related */
-
-#ifdef LWS_WITH_HTTP2
-LWS_EXTERN void
-lws_context_init_http2_ssl(struct lws_vhost *vhost);
-#else
-#define lws_context_init_http2_ssl(_a)
-#endif
-#endif
-
-#if LWS_MAX_SMP > 1
-static LWS_INLINE void
-lws_pt_mutex_init(struct lws_context_per_thread *pt)
-{
- pthread_mutex_init(&pt->lock, NULL);
-}
-
-static LWS_INLINE void
-lws_pt_mutex_destroy(struct lws_context_per_thread *pt)
-{
- pthread_mutex_destroy(&pt->lock);
-}
-
-static LWS_INLINE void
-lws_pt_lock(struct lws_context_per_thread *pt)
-{
- if (!pt->lock_depth++)
- pthread_mutex_lock(&pt->lock);
-}
-
-static LWS_INLINE void
-lws_pt_unlock(struct lws_context_per_thread *pt)
-{
- if (!(--pt->lock_depth))
- pthread_mutex_unlock(&pt->lock);
-}
-static LWS_INLINE void
-lws_context_lock(struct lws_context *context)
-{
- if (!context->lock_depth++)
- pthread_mutex_lock(&context->lock);
-}
-
-static LWS_INLINE void
-lws_context_unlock(struct lws_context *context)
-{
- if (!(--context->lock_depth))
- pthread_mutex_unlock(&context->lock);
-}
-
-#else
-#define lws_pt_mutex_init(_a) (void)(_a)
-#define lws_pt_mutex_destroy(_a) (void)(_a)
-#define lws_pt_lock(_a) (void)(_a)
-#define lws_pt_unlock(_a) (void)(_a)
-#define lws_context_lock(_a) (void)(_a)
-#define lws_context_unlock(_a) (void)(_a)
-#endif
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ssl_capable_read_no_ssl(struct lws *wsi, unsigned char *buf, int len);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ssl_capable_write_no_ssl(struct lws *wsi, unsigned char *buf, int len);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_ssl_pending_no_ssl(struct lws *wsi);
-
-#ifdef LWS_WITH_HTTP_PROXY
-struct lws_rewrite {
- hubbub_parser *parser;
- hubbub_parser_optparams params;
- const char *from, *to;
- int from_len, to_len;
- unsigned char *p, *end;
- struct lws *wsi;
-};
-static LWS_INLINE int hstrcmp(hubbub_string *s, const char *p, int len)
-{
- if (s->len != len)
- return 1;
-
- return strncmp((const char *)s->ptr, p, len);
-}
-typedef hubbub_error (*hubbub_callback_t)(const hubbub_token *token, void *pw);
-LWS_EXTERN struct lws_rewrite *
-lws_rewrite_create(struct lws *wsi, hubbub_callback_t cb, const char *from, const char *to);
-LWS_EXTERN void
-lws_rewrite_destroy(struct lws_rewrite *r);
-LWS_EXTERN int
-lws_rewrite_parse(struct lws_rewrite *r, const unsigned char *in, int in_len);
-#endif
-
-#ifndef LWS_NO_CLIENT
-LWS_EXTERN int lws_client_socket_service(struct lws_context *context,
- struct lws *wsi,
- struct lws_pollfd *pollfd);
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_http_transaction_completed_client(struct lws *wsi);
-#ifdef LWS_OPENSSL_SUPPORT
-LWS_EXTERN int
-lws_context_init_client_ssl(struct lws_context_creation_info *info,
- struct lws_vhost *vhost);
-
-LWS_EXTERN void
-lws_ssl_info_callback(const SSL *ssl, int where, int ret);
-
-#else
- #define lws_context_init_client_ssl(_a, _b) (0)
-#endif
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len);
-LWS_EXTERN void
-lws_decode_ssl_error(void);
-#else
-#define lws_context_init_client_ssl(_a, _b) (0)
-#define lws_handshake_client(_a, _b, _c) (0)
-#endif
-
-LWS_EXTERN int
-_lws_rx_flow_control(struct lws *wsi);
-
-LWS_EXTERN int
-_lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa);
-
-#ifndef LWS_NO_SERVER
-LWS_EXTERN int
-lws_server_socket_service(struct lws_context *context, struct lws *wsi,
- struct lws_pollfd *pollfd);
-LWS_EXTERN int
-lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len);
-#else
-#define lws_server_socket_service(_a, _b, _c) (0)
-#define lws_handshake_server(_a, _b, _c) (0)
-#endif
-
-#ifdef LWS_WITH_ACCESS_LOG
-LWS_EXTERN int
-lws_access_log(struct lws *wsi);
-LWS_EXTERN void
-lws_prepare_access_log_info(struct lws *wsi, char *uri_ptr, int meth);
-#else
-#define lws_access_log(_a)
-#endif
-
-LWS_EXTERN int
-lws_cgi_kill_terminated(struct lws_context_per_thread *pt);
-
-LWS_EXTERN void
-lws_cgi_remove_and_kill(struct lws *wsi);
-
-int
-lws_protocol_init(struct lws_context *context);
-
-int
-lws_bind_protocol(struct lws *wsi, const struct lws_protocols *p);
-
-const struct lws_http_mount *
-lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len);
-
-/*
- * custom allocator
- */
-LWS_EXTERN void *
-lws_realloc(void *ptr, size_t size, const char *reason);
-
-LWS_EXTERN void * LWS_WARN_UNUSED_RESULT
-lws_zalloc(size_t size, const char *reason);
-
-#ifdef LWS_PLAT_OPTEE
-void *lws_malloc(size_t size, const char *reason);
-void lws_free(void *p);
-#define lws_free_set_NULL(P) do { lws_free(P); (P) = NULL; } while(0)
-#else
-#define lws_malloc(S, R) lws_realloc(NULL, S, R)
-#define lws_free(P) lws_realloc(P, 0, "lws_free")
-#define lws_free_set_NULL(P) do { lws_realloc(P, 0, "free"); (P) = NULL; } while(0)
-#endif
-
-const struct lws_plat_file_ops *
-lws_vfs_select_fops(const struct lws_plat_file_ops *fops, const char *vfs_path,
- const char **vpath);
-
-/* lws_plat_ */
-LWS_EXTERN void
-lws_plat_delete_socket_from_fds(struct lws_context *context,
- struct lws *wsi, int m);
-LWS_EXTERN void
-lws_plat_insert_socket_into_fds(struct lws_context *context,
- struct lws *wsi);
-LWS_EXTERN void
-lws_plat_service_periodic(struct lws_context *context);
-
-LWS_EXTERN int
-lws_plat_change_pollfd(struct lws_context *context, struct lws *wsi,
- struct lws_pollfd *pfd);
-LWS_EXTERN void
-lws_add_wsi_to_draining_ext_list(struct lws *wsi);
-LWS_EXTERN void
-lws_remove_wsi_from_draining_ext_list(struct lws *wsi);
-LWS_EXTERN int
-lws_plat_context_early_init(void);
-LWS_EXTERN void
-lws_plat_context_early_destroy(struct lws_context *context);
-LWS_EXTERN void
-lws_plat_context_late_destroy(struct lws_context *context);
-LWS_EXTERN int
-lws_poll_listen_fd(struct lws_pollfd *fd);
-LWS_EXTERN int
-lws_plat_service(struct lws_context *context, int timeout_ms);
-LWS_EXTERN LWS_VISIBLE int
-_lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi);
-LWS_EXTERN int
-lws_plat_init(struct lws_context *context,
- struct lws_context_creation_info *info);
-LWS_EXTERN void
-lws_plat_drop_app_privileges(struct lws_context_creation_info *info);
-LWS_EXTERN unsigned long long
-time_in_microseconds(void);
-LWS_EXTERN const char * LWS_WARN_UNUSED_RESULT
-lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt);
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_plat_inet_pton(int af, const char *src, void *dst);
-
-LWS_EXTERN int LWS_WARN_UNUSED_RESULT
-lws_check_utf8(unsigned char *state, unsigned char *buf, size_t len);
-LWS_EXTERN int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
- lws_filepos_t *amount);
-LWS_EXTERN int alloc_pem_to_der_file(struct lws_context *context, const char *filename, uint8_t **buf,
- lws_filepos_t *amount);
-
-LWS_EXTERN void
-lws_same_vh_protocol_remove(struct lws *wsi);
-LWS_EXTERN void
-lws_same_vh_protocol_insert(struct lws *wsi, int n);
-
-#if defined(LWS_WITH_STATS)
-void
-lws_stats_atomic_bump(struct lws_context * context,
- struct lws_context_per_thread *pt, int index, uint64_t bump);
-void
-lws_stats_atomic_max(struct lws_context * context,
- struct lws_context_per_thread *pt, int index, uint64_t val);
-#else
-static inline uint64_t lws_stats_atomic_bump(struct lws_context * context,
- struct lws_context_per_thread *pt, int index, uint64_t bump) {
- (void)context; (void)pt; (void)index; (void)bump; return 0; }
-static inline uint64_t lws_stats_atomic_max(struct lws_context * context,
- struct lws_context_per_thread *pt, int index, uint64_t val) {
- (void)context; (void)pt; (void)index; (void)val; return 0; }
-#endif
-
-/* socks */
-void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
- ssize_t *msg_len);
-
-#if defined(LWS_WITH_PEER_LIMITS)
-void
-lws_peer_track_wsi_close(struct lws_context *context, struct lws_peer *peer);
-int
-lws_peer_confirm_ah_attach_ok(struct lws_context *context, struct lws_peer *peer);
-void
-lws_peer_track_ah_detach(struct lws_context *context, struct lws_peer *peer);
-void
-lws_peer_cull_peer_wait_list(struct lws_context *context);
-struct lws_peer *
-lws_get_or_create_peer(struct lws_vhost *vhost, lws_sockfd_type sockfd);
-void
-lws_peer_add_wsi(struct lws_context *context, struct lws_peer *peer,
- struct lws *wsi);
-#endif
-
-#ifdef __cplusplus
-};
-#endif
diff --git a/thirdparty/lws/server/parsers.c b/thirdparty/lws/server/parsers.c
deleted file mode 100644
index fb345ab04c..0000000000
--- a/thirdparty/lws/server/parsers.c
+++ /dev/null
@@ -1,1783 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-const unsigned char lextable[] = {
- #include "lextable.h"
-};
-
-#define FAIL_CHAR 0x08
-
-int LWS_WARN_UNUSED_RESULT
-lextable_decode(int pos, char c)
-{
- if (c >= 'A' && c <= 'Z')
- c += 'a' - 'A';
-
- while (1) {
- if (lextable[pos] & (1 << 7)) { /* 1-byte, fail on mismatch */
- if ((lextable[pos] & 0x7f) != c)
- return -1;
- /* fall thru */
- pos++;
- if (lextable[pos] == FAIL_CHAR)
- return -1;
- return pos;
- }
-
- if (lextable[pos] == FAIL_CHAR)
- return -1;
-
- /* b7 = 0, end or 3-byte */
- if (lextable[pos] < FAIL_CHAR) /* terminal marker */
- return pos;
-
- if (lextable[pos] == c) /* goto */
- return pos + (lextable[pos + 1]) +
- (lextable[pos + 2] << 8);
- /* fall thru goto */
- pos += 3;
- /* continue */
- }
-}
-
-static struct allocated_headers *
-_lws_create_ah(struct lws_context_per_thread *pt, ah_data_idx_t data_size)
-{
- struct allocated_headers *ah = lws_zalloc(sizeof(*ah), "ah struct");
-
- if (!ah)
- return NULL;
-
- ah->data = lws_malloc(data_size, "ah data");
- if (!ah->data) {
- lws_free(ah);
-
- return NULL;
- }
- ah->next = pt->ah_list;
- pt->ah_list = ah;
- ah->data_length = data_size;
- pt->ah_pool_length++;
-
- lwsl_info("%s: created ah %p (size %d): pool length %d\n", __func__,
- ah, (int)data_size, pt->ah_pool_length);
-
- return ah;
-}
-
-int
-_lws_destroy_ah(struct lws_context_per_thread *pt, struct allocated_headers *ah)
-{
- lws_start_foreach_llp(struct allocated_headers **, a, pt->ah_list) {
- if ((*a) == ah) {
- *a = ah->next;
- pt->ah_pool_length--;
- lwsl_info("%s: freed ah %p : pool length %d\n",
- __func__, ah, pt->ah_pool_length);
- if (ah->data)
- lws_free(ah->data);
- lws_free(ah);
-
- return 0;
- }
- } lws_end_foreach_llp(a, next);
-
- return 1;
-}
-
-void
-_lws_header_table_reset(struct allocated_headers *ah)
-{
- /* init the ah to reflect no headers or data have appeared yet */
- memset(ah->frag_index, 0, sizeof(ah->frag_index));
- memset(ah->frags, 0, sizeof(ah->frags));
- ah->nfrag = 0;
- ah->pos = 0;
- ah->http_response = 0;
-}
-
-// doesn't scrub the ah rxbuffer by default, parent must do if needed
-
-void
-lws_header_table_reset(struct lws *wsi, int autoservice)
-{
- struct allocated_headers *ah = wsi->u.hdr.ah;
- struct lws_context_per_thread *pt;
- struct lws_pollfd *pfd;
-
- /* if we have the idea we're resetting 'our' ah, must be bound to one */
- assert(ah);
- /* ah also concurs with ownership */
- assert(ah->wsi == wsi);
-
- _lws_header_table_reset(ah);
-
- wsi->u.hdr.parser_state = WSI_TOKEN_NAME_PART;
- wsi->u.hdr.lextable_pos = 0;
-
- /* since we will restart the ah, our new headers are not completed */
- wsi->hdr_parsing_completed = 0;
-
- /* while we hold the ah, keep a timeout on the wsi */
- lws_set_timeout(wsi, PENDING_TIMEOUT_HOLDING_AH,
- wsi->vhost->timeout_secs_ah_idle);
-
- time(&ah->assigned);
-
- /*
- * if we inherited pending rx (from socket adoption deferred
- * processing), apply and free it.
- */
- if (wsi->u.hdr.preamble_rx) {
- memcpy(ah->rx, wsi->u.hdr.preamble_rx,
- wsi->u.hdr.preamble_rx_len);
- ah->rxlen = wsi->u.hdr.preamble_rx_len;
- lws_free_set_NULL(wsi->u.hdr.preamble_rx);
-
- if (autoservice) {
- lwsl_debug("%s: service on readbuf ah\n", __func__);
-
- pt = &wsi->context->pt[(int)wsi->tsi];
- /*
- * Unlike a normal connect, we have the headers already
- * (or the first part of them anyway)
- */
- pfd = &pt->fds[wsi->position_in_fds_table];
- pfd->revents |= LWS_POLLIN;
- lwsl_err("%s: calling service\n", __func__);
- lws_service_fd_tsi(wsi->context, pfd, wsi->tsi);
- }
- }
-}
-
-static void
-_lws_header_ensure_we_are_on_waiting_list(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- struct lws_pollargs pa;
- struct lws **pwsi = &pt->ah_wait_list;
-
- while (*pwsi) {
- if (*pwsi == wsi)
- return;
- pwsi = &(*pwsi)->u.hdr.ah_wait_list;
- }
-
- lwsl_info("%s: wsi: %p\n", __func__, wsi);
- wsi->u.hdr.ah_wait_list = pt->ah_wait_list;
- pt->ah_wait_list = wsi;
- pt->ah_wait_list_length++;
-
- /* we cannot accept input then */
-
- _lws_change_pollfd(wsi, LWS_POLLIN, 0, &pa);
-}
-
-static int
-__lws_remove_from_ah_waiting_list(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- struct lws **pwsi =&pt->ah_wait_list;
-
- while (*pwsi) {
- if (*pwsi == wsi) {
- lwsl_info("%s: wsi %p\n", __func__, wsi);
- /* point prev guy to our next */
- *pwsi = wsi->u.hdr.ah_wait_list;
- /* we shouldn't point anywhere now */
- wsi->u.hdr.ah_wait_list = NULL;
- pt->ah_wait_list_length--;
-
- return 1;
- }
- pwsi = &(*pwsi)->u.hdr.ah_wait_list;
- }
-
- return 0;
-}
-
-int LWS_WARN_UNUSED_RESULT
-lws_header_table_attach(struct lws *wsi, int autoservice)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- struct lws_pollargs pa;
- int n;
-
- lwsl_info("%s: wsi %p: ah %p (tsi %d, count = %d) in\n", __func__,
- (void *)wsi, (void *)wsi->u.hdr.ah, wsi->tsi,
- pt->ah_count_in_use);
-
- /* if we are already bound to one, just clear it down */
- if (wsi->u.hdr.ah) {
- lwsl_info("%s: cleardown\n", __func__);
- goto reset;
- }
-
- lws_pt_lock(pt);
-
- n = pt->ah_count_in_use == context->max_http_header_pool;
-#if defined(LWS_WITH_PEER_LIMITS)
- if (!n) {
- n = lws_peer_confirm_ah_attach_ok(context, wsi->peer);
- if (n)
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_PEER_LIMIT_AH_DENIED, 1);
- }
-#endif
- if (n) {
- /*
- * Pool is either all busy, or we don't want to give this
- * particular guy an ah right now...
- *
- * Make sure we are on the waiting list, and return that we
- * weren't able to provide the ah
- */
- _lws_header_ensure_we_are_on_waiting_list(wsi);
-
- goto bail;
- }
-
- __lws_remove_from_ah_waiting_list(wsi);
-
- wsi->u.hdr.ah = _lws_create_ah(pt, context->max_http_header_data);
- if (!wsi->u.hdr.ah) { /* we could not create an ah */
- _lws_header_ensure_we_are_on_waiting_list(wsi);
-
- goto bail;
- }
-
- wsi->u.hdr.ah->in_use = 1;
- wsi->u.hdr.ah->wsi = wsi; /* mark our owner */
- pt->ah_count_in_use++;
-
-#if defined(LWS_WITH_PEER_LIMITS)
- if (wsi->peer)
- wsi->peer->count_ah++;
-#endif
-
- _lws_change_pollfd(wsi, 0, LWS_POLLIN, &pa);
-
- lwsl_info("%s: did attach wsi %p: ah %p: count %d (on exit)\n", __func__,
- (void *)wsi, (void *)wsi->u.hdr.ah, pt->ah_count_in_use);
-
- lws_pt_unlock(pt);
-
-reset:
-
- /* and reset the rx state */
- wsi->u.hdr.ah->rxpos = 0;
- wsi->u.hdr.ah->rxlen = 0;
-
- lws_header_table_reset(wsi, autoservice);
-
-#ifndef LWS_NO_CLIENT
- if (wsi->state == LWSS_CLIENT_UNCONNECTED)
- if (!lws_client_connect_via_info2(wsi))
- /* our client connect has failed, the wsi
- * has been closed
- */
- return -1;
-#endif
-
- return 0;
-
-bail:
- lws_pt_unlock(pt);
-
- return 1;
-}
-
-void
-lws_header_table_force_to_detachable_state(struct lws *wsi)
-{
- if (wsi->u.hdr.ah) {
- wsi->u.hdr.ah->rxpos = -1;
- wsi->u.hdr.ah->rxlen = -1;
- wsi->hdr_parsing_completed = 1;
- }
-}
-
-int
-lws_header_table_is_in_detachable_state(struct lws *wsi)
-{
- struct allocated_headers *ah = wsi->u.hdr.ah;
-
- return ah && ah->rxpos == ah->rxlen && wsi->hdr_parsing_completed;
-}
-
-int lws_header_table_detach(struct lws *wsi, int autoservice)
-{
- struct lws_context *context = wsi->context;
- struct allocated_headers *ah = wsi->u.hdr.ah;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- struct lws_pollargs pa;
- struct lws **pwsi, **pwsi_eligible;
- time_t now;
-
- lws_pt_lock(pt);
- __lws_remove_from_ah_waiting_list(wsi);
- lws_pt_unlock(pt);
-
- if (!ah)
- return 0;
-
- lwsl_info("%s: wsi %p: ah %p (tsi=%d, count = %d)\n", __func__,
- (void *)wsi, (void *)ah, wsi->tsi,
- pt->ah_count_in_use);
-
- if (wsi->u.hdr.preamble_rx)
- lws_free_set_NULL(wsi->u.hdr.preamble_rx);
-
- /* may not be detached while he still has unprocessed rx */
- if (!lws_header_table_is_in_detachable_state(wsi)) {
- lwsl_err("%s: %p: CANNOT DETACH rxpos:%d, rxlen:%d, "
- "wsi->hdr_parsing_completed = %d\n", __func__, wsi,
- ah->rxpos, ah->rxlen, wsi->hdr_parsing_completed);
- return 0;
- }
-
- lws_pt_lock(pt);
-
- /* we did have an ah attached */
- time(&now);
- if (ah->assigned && now - ah->assigned > 3) {
- /*
- * we're detaching the ah, but it was held an
- * unreasonably long time
- */
- lwsl_debug("%s: wsi %p: ah held %ds, "
- "ah.rxpos %d, ah.rxlen %d, mode/state %d %d,"
- "wsi->more_rx_waiting %d\n", __func__, wsi,
- (int)(now - ah->assigned),
- ah->rxpos, ah->rxlen, wsi->mode, wsi->state,
- wsi->more_rx_waiting);
- }
-
- ah->assigned = 0;
-
- /* if we think we're detaching one, there should be one in use */
- assert(pt->ah_count_in_use > 0);
- /* and this specific one should have been in use */
- assert(ah->in_use);
- wsi->u.hdr.ah = NULL;
- ah->wsi = NULL; /* no owner */
-#if defined(LWS_WITH_PEER_LIMITS)
- lws_peer_track_ah_detach(context, wsi->peer);
-#endif
-
- pwsi = &pt->ah_wait_list;
-
- /* oh there is nobody on the waiting list... leave the ah unattached */
- if (!*pwsi)
- goto nobody_usable_waiting;
-
- /*
- * at least one wsi on the same tsi is waiting, give it to oldest guy
- * who is allowed to take it (if any)
- */
- lwsl_info("pt wait list %p\n", *pwsi);
- wsi = NULL;
- pwsi_eligible = NULL;
-
- while (*pwsi) {
-#if defined(LWS_WITH_PEER_LIMITS)
- /* are we willing to give this guy an ah? */
- if (!lws_peer_confirm_ah_attach_ok(context, (*pwsi)->peer))
-#endif
- {
- wsi = *pwsi;
- pwsi_eligible = pwsi;
- }
-#if defined(LWS_WITH_PEER_LIMITS)
- else
- if (!(*pwsi)->u.hdr.ah_wait_list)
- lws_stats_atomic_bump(context, pt,
- LWSSTATS_C_PEER_LIMIT_AH_DENIED, 1);
-#endif
- pwsi = &(*pwsi)->u.hdr.ah_wait_list;
- }
-
- if (!wsi) /* everybody waiting already has too many ah... */
- goto nobody_usable_waiting;
-
- lwsl_info("%s: last eligible wsi in wait list %p\n", __func__, wsi);
-
- wsi->u.hdr.ah = ah;
- ah->wsi = wsi; /* new owner */
-
- /* and reset the rx state */
- ah->rxpos = 0;
- ah->rxlen = 0;
- lws_header_table_reset(wsi, autoservice);
-#if defined(LWS_WITH_PEER_LIMITS)
- if (wsi->peer)
- wsi->peer->count_ah++;
-#endif
-
- /* clients acquire the ah and then insert themselves in fds table... */
- if (wsi->position_in_fds_table != -1) {
- lwsl_info("%s: Enabling %p POLLIN\n", __func__, wsi);
-
- /* he has been stuck waiting for an ah, but now his wait is
- * over, let him progress */
-
- _lws_change_pollfd(wsi, 0, LWS_POLLIN, &pa);
- }
-
- /* point prev guy to next guy in list instead */
- *pwsi_eligible = wsi->u.hdr.ah_wait_list;
- /* the guy who got one is out of the list */
- wsi->u.hdr.ah_wait_list = NULL;
- pt->ah_wait_list_length--;
-
-#ifndef LWS_NO_CLIENT
- if (wsi->state == LWSS_CLIENT_UNCONNECTED) {
- lws_pt_unlock(pt);
-
- if (!lws_client_connect_via_info2(wsi)) {
- /* our client connect has failed, the wsi
- * has been closed
- */
-
- return -1;
- }
- return 0;
- }
-#endif
-
- assert(!!pt->ah_wait_list_length == !!(lws_intptr_t)pt->ah_wait_list);
-bail:
- lwsl_info("%s: wsi %p: ah %p (tsi=%d, count = %d)\n", __func__,
- (void *)wsi, (void *)ah, pt->tid, pt->ah_count_in_use);
-
- lws_pt_unlock(pt);
-
- return 0;
-
-nobody_usable_waiting:
- lwsl_info("%s: nobody usable waiting\n", __func__);
- _lws_destroy_ah(pt, ah);
- pt->ah_count_in_use--;
-
- goto bail;
-}
-
-LWS_VISIBLE int
-lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx)
-{
- int n;
-
- if (!wsi->u.hdr.ah)
- return 0;
-
- n = wsi->u.hdr.ah->frag_index[h];
- if (!n)
- return 0;
- do {
- if (!frag_idx)
- return wsi->u.hdr.ah->frags[n].len;
- n = wsi->u.hdr.ah->frags[n].nfrag;
- } while (frag_idx-- && n);
-
- return 0;
-}
-
-LWS_VISIBLE int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)
-{
- int n;
- int len = 0;
-
- if (!wsi->u.hdr.ah)
- return 0;
-
- n = wsi->u.hdr.ah->frag_index[h];
- if (!n)
- return 0;
- do {
- len += wsi->u.hdr.ah->frags[n].len;
- n = wsi->u.hdr.ah->frags[n].nfrag;
- } while (n);
-
- return len;
-}
-
-LWS_VISIBLE int lws_hdr_copy_fragment(struct lws *wsi, char *dst, int len,
- enum lws_token_indexes h, int frag_idx)
-{
- int n = 0;
- int f;
-
- if (!wsi->u.hdr.ah)
- return -1;
-
- f = wsi->u.hdr.ah->frag_index[h];
-
- if (!f)
- return -1;
-
- while (n < frag_idx) {
- f = wsi->u.hdr.ah->frags[f].nfrag;
- if (!f)
- return -1;
- n++;
- }
-
- if (wsi->u.hdr.ah->frags[f].len >= len)
- return -1;
-
- memcpy(dst, wsi->u.hdr.ah->data + wsi->u.hdr.ah->frags[f].offset,
- wsi->u.hdr.ah->frags[f].len);
- dst[wsi->u.hdr.ah->frags[f].len] = '\0';
-
- return wsi->u.hdr.ah->frags[f].len;
-}
-
-LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dst, int len,
- enum lws_token_indexes h)
-{
- int toklen = lws_hdr_total_length(wsi, h);
- int n;
-
- if (toklen >= len)
- return -1;
-
- if (!wsi->u.hdr.ah)
- return -1;
-
- n = wsi->u.hdr.ah->frag_index[h];
- if (!n)
- return 0;
-
- do {
- if (wsi->u.hdr.ah->frags[n].len >= len)
- return -1;
- strncpy(dst, &wsi->u.hdr.ah->data[wsi->u.hdr.ah->frags[n].offset],
- wsi->u.hdr.ah->frags[n].len);
- dst += wsi->u.hdr.ah->frags[n].len;
- len -= wsi->u.hdr.ah->frags[n].len;
- n = wsi->u.hdr.ah->frags[n].nfrag;
- } while (n);
- *dst = '\0';
-
- return toklen;
-}
-
-char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)
-{
- int n;
-
- n = wsi->u.hdr.ah->frag_index[h];
- if (!n)
- return NULL;
-
- return wsi->u.hdr.ah->data + wsi->u.hdr.ah->frags[n].offset;
-}
-
-int LWS_WARN_UNUSED_RESULT
-lws_pos_in_bounds(struct lws *wsi)
-{
- if (wsi->u.hdr.ah->pos <
- (unsigned int)wsi->context->max_http_header_data)
- return 0;
-
- if (wsi->u.hdr.ah->pos == wsi->context->max_http_header_data) {
- lwsl_err("Ran out of header data space\n");
- return 1;
- }
-
- /*
- * with these tests everywhere, it should never be able to exceed
- * the limit, only meet it
- */
- lwsl_err("%s: pos %d, limit %d\n", __func__, wsi->u.hdr.ah->pos,
- wsi->context->max_http_header_data);
- assert(0);
-
- return 1;
-}
-
-int LWS_WARN_UNUSED_RESULT
-lws_hdr_simple_create(struct lws *wsi, enum lws_token_indexes h, const char *s)
-{
- wsi->u.hdr.ah->nfrag++;
- if (wsi->u.hdr.ah->nfrag == ARRAY_SIZE(wsi->u.hdr.ah->frags)) {
- lwsl_warn("More hdr frags than we can deal with, dropping\n");
- return -1;
- }
-
- wsi->u.hdr.ah->frag_index[h] = wsi->u.hdr.ah->nfrag;
-
- wsi->u.hdr.ah->frags[wsi->u.hdr.ah->nfrag].offset = wsi->u.hdr.ah->pos;
- wsi->u.hdr.ah->frags[wsi->u.hdr.ah->nfrag].len = 0;
- wsi->u.hdr.ah->frags[wsi->u.hdr.ah->nfrag].nfrag = 0;
-
- do {
- if (lws_pos_in_bounds(wsi))
- return -1;
-
- wsi->u.hdr.ah->data[wsi->u.hdr.ah->pos++] = *s;
- if (*s)
- wsi->u.hdr.ah->frags[wsi->u.hdr.ah->nfrag].len++;
- } while (*s++);
-
- return 0;
-}
-
-signed char char_to_hex(const char c)
-{
- if (c >= '0' && c <= '9')
- return c - '0';
-
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
-
- if (c >= 'A' && c <= 'F')
- return c - 'A' + 10;
-
- return -1;
-}
-
-static int LWS_WARN_UNUSED_RESULT
-issue_char(struct lws *wsi, unsigned char c)
-{
- unsigned short frag_len;
-
- if (lws_pos_in_bounds(wsi))
- return -1;
-
- frag_len = wsi->u.hdr.ah->frags[wsi->u.hdr.ah->nfrag].len;
- /*
- * If we haven't hit the token limit, just copy the character into
- * the header
- */
- if (frag_len < wsi->u.hdr.current_token_limit) {
- wsi->u.hdr.ah->data[wsi->u.hdr.ah->pos++] = c;
- if (c)
- wsi->u.hdr.ah->frags[wsi->u.hdr.ah->nfrag].len++;
- return 0;
- }
-
- /* Insert a null character when we *hit* the limit: */
- if (frag_len == wsi->u.hdr.current_token_limit) {
- if (lws_pos_in_bounds(wsi))
- return -1;
-
- wsi->u.hdr.ah->data[wsi->u.hdr.ah->pos++] = '\0';
- lwsl_warn("header %i exceeds limit %d\n",
- wsi->u.hdr.parser_state,
- wsi->u.hdr.current_token_limit);
- }
-
- return 1;
-}
-
-int
-lws_parse_urldecode(struct lws *wsi, uint8_t *_c)
-{
- struct allocated_headers *ah = wsi->u.hdr.ah;
- unsigned int enc = 0;
- uint8_t c = *_c;
-
- /*
- * PRIORITY 1
- * special URI processing... convert %xx
- */
- switch (wsi->u.hdr.ues) {
- case URIES_IDLE:
- if (c == '%') {
- wsi->u.hdr.ues = URIES_SEEN_PERCENT;
- goto swallow;
- }
- break;
- case URIES_SEEN_PERCENT:
- if (char_to_hex(c) < 0)
- /* illegal post-% char */
- goto forbid;
-
- wsi->u.hdr.esc_stash = c;
- wsi->u.hdr.ues = URIES_SEEN_PERCENT_H1;
- goto swallow;
-
- case URIES_SEEN_PERCENT_H1:
- if (char_to_hex(c) < 0)
- /* illegal post-% char */
- goto forbid;
-
- *_c = (char_to_hex(wsi->u.hdr.esc_stash) << 4) |
- char_to_hex(c);
- c = *_c;
- enc = 1;
- wsi->u.hdr.ues = URIES_IDLE;
- break;
- }
-
- /*
- * PRIORITY 2
- * special URI processing...
- * convert /.. or /... or /../ etc to /
- * convert /./ to /
- * convert // or /// etc to /
- * leave /.dir or whatever alone
- */
-
- switch (wsi->u.hdr.ups) {
- case URIPS_IDLE:
- if (!c)
- return -1;
- /* genuine delimiter */
- if ((c == '&' || c == ';') && !enc) {
- if (issue_char(wsi, c) < 0)
- return -1;
- /* swallow the terminator */
- ah->frags[ah->nfrag].len--;
- /* link to next fragment */
- ah->frags[ah->nfrag].nfrag = ah->nfrag + 1;
- ah->nfrag++;
- if (ah->nfrag >= ARRAY_SIZE(ah->frags))
- goto excessive;
- /* start next fragment after the & */
- wsi->u.hdr.post_literal_equal = 0;
- ah->frags[ah->nfrag].offset = ah->pos;
- ah->frags[ah->nfrag].len = 0;
- ah->frags[ah->nfrag].nfrag = 0;
- goto swallow;
- }
- /* uriencoded = in the name part, disallow */
- if (c == '=' && enc &&
- ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS] &&
- !wsi->u.hdr.post_literal_equal) {
- c = '_';
- *_c =c;
- }
-
- /* after the real =, we don't care how many = */
- if (c == '=' && !enc)
- wsi->u.hdr.post_literal_equal = 1;
-
- /* + to space */
- if (c == '+' && !enc) {
- c = ' ';
- *_c = c;
- }
- /* issue the first / always */
- if (c == '/' && !ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS])
- wsi->u.hdr.ups = URIPS_SEEN_SLASH;
- break;
- case URIPS_SEEN_SLASH:
- /* swallow subsequent slashes */
- if (c == '/')
- goto swallow;
- /* track and swallow the first . after / */
- if (c == '.') {
- wsi->u.hdr.ups = URIPS_SEEN_SLASH_DOT;
- goto swallow;
- }
- wsi->u.hdr.ups = URIPS_IDLE;
- break;
- case URIPS_SEEN_SLASH_DOT:
- /* swallow second . */
- if (c == '.') {
- wsi->u.hdr.ups = URIPS_SEEN_SLASH_DOT_DOT;
- goto swallow;
- }
- /* change /./ to / */
- if (c == '/') {
- wsi->u.hdr.ups = URIPS_SEEN_SLASH;
- goto swallow;
- }
- /* it was like /.dir ... regurgitate the . */
- wsi->u.hdr.ups = URIPS_IDLE;
- if (issue_char(wsi, '.') < 0)
- return -1;
- break;
-
- case URIPS_SEEN_SLASH_DOT_DOT:
-
- /* /../ or /..[End of URI] --> backup to last / */
- if (c == '/' || c == '?') {
- /*
- * back up one dir level if possible
- * safe against header fragmentation because
- * the method URI can only be in 1 fragment
- */
- if (ah->frags[ah->nfrag].len > 2) {
- ah->pos--;
- ah->frags[ah->nfrag].len--;
- do {
- ah->pos--;
- ah->frags[ah->nfrag].len--;
- } while (ah->frags[ah->nfrag].len > 1 &&
- ah->data[ah->pos] != '/');
- }
- wsi->u.hdr.ups = URIPS_SEEN_SLASH;
- if (ah->frags[ah->nfrag].len > 1)
- break;
- goto swallow;
- }
-
- /* /..[^/] ... regurgitate and allow */
-
- if (issue_char(wsi, '.') < 0)
- return -1;
- if (issue_char(wsi, '.') < 0)
- return -1;
- wsi->u.hdr.ups = URIPS_IDLE;
- break;
- }
-
- if (c == '?' && !enc &&
- !ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS]) { /* start of URI arguments */
- if (wsi->u.hdr.ues != URIES_IDLE)
- goto forbid;
-
- /* seal off uri header */
- if (issue_char(wsi, '\0') < 0)
- return -1;
-
- /* move to using WSI_TOKEN_HTTP_URI_ARGS */
- ah->nfrag++;
- if (ah->nfrag >= ARRAY_SIZE(ah->frags))
- goto excessive;
- ah->frags[ah->nfrag].offset = ah->pos;
- ah->frags[ah->nfrag].len = 0;
- ah->frags[ah->nfrag].nfrag = 0;
-
- wsi->u.hdr.post_literal_equal = 0;
- ah->frag_index[WSI_TOKEN_HTTP_URI_ARGS] = ah->nfrag;
- wsi->u.hdr.ups = URIPS_IDLE;
- goto swallow;
- }
-
- return LPUR_CONTINUE;
-
-swallow:
- return LPUR_SWALLOW;
-
-forbid:
- return LPUR_FORBID;
-
-excessive:
- return LPUR_EXCESSIVE;
-}
-
-static const unsigned char methods[] = {
- WSI_TOKEN_GET_URI,
- WSI_TOKEN_POST_URI,
- WSI_TOKEN_OPTIONS_URI,
- WSI_TOKEN_PUT_URI,
- WSI_TOKEN_PATCH_URI,
- WSI_TOKEN_DELETE_URI,
- WSI_TOKEN_CONNECT,
- WSI_TOKEN_HEAD_URI,
-};
-
-int LWS_WARN_UNUSED_RESULT
-lws_parse(struct lws *wsi, unsigned char c)
-{
- struct allocated_headers *ah = wsi->u.hdr.ah;
- struct lws_context *context = wsi->context;
- unsigned int n, m;
- int r;
-
- assert(wsi->u.hdr.ah);
-
- switch (wsi->u.hdr.parser_state) {
- default:
-
- lwsl_parser("WSI_TOK_(%d) '%c'\n", wsi->u.hdr.parser_state, c);
-
- /* collect into malloc'd buffers */
- /* optional initial space swallow */
- if (!ah->frags[ah->frag_index[wsi->u.hdr.parser_state]].len &&
- c == ' ')
- break;
-
- for (m = 0; m < ARRAY_SIZE(methods); m++)
- if (wsi->u.hdr.parser_state == methods[m])
- break;
- if (m == ARRAY_SIZE(methods))
- /* it was not any of the methods */
- goto check_eol;
-
- /* special URI processing... end at space */
-
- if (c == ' ') {
- /* enforce starting with / */
- if (!ah->frags[ah->nfrag].len)
- if (issue_char(wsi, '/') < 0)
- return -1;
-
- if (wsi->u.hdr.ups == URIPS_SEEN_SLASH_DOT_DOT) {
- /*
- * back up one dir level if possible
- * safe against header fragmentation because
- * the method URI can only be in 1 fragment
- */
- if (ah->frags[ah->nfrag].len > 2) {
- ah->pos--;
- ah->frags[ah->nfrag].len--;
- do {
- ah->pos--;
- ah->frags[ah->nfrag].len--;
- } while (ah->frags[ah->nfrag].len > 1 &&
- ah->data[ah->pos] != '/');
- }
- }
-
- /* begin parsing HTTP version: */
- if (issue_char(wsi, '\0') < 0)
- return -1;
- wsi->u.hdr.parser_state = WSI_TOKEN_HTTP;
- goto start_fragment;
- }
-
- r = lws_parse_urldecode(wsi, &c);
- switch (r) {
- case LPUR_CONTINUE:
- break;
- case LPUR_SWALLOW:
- goto swallow;
- case LPUR_FORBID:
- goto forbid;
- case LPUR_EXCESSIVE:
- goto excessive;
- default:
- return -1;
- }
-check_eol:
- /* bail at EOL */
- if (wsi->u.hdr.parser_state != WSI_TOKEN_CHALLENGE &&
- c == '\x0d') {
- if (wsi->u.hdr.ues != URIES_IDLE)
- goto forbid;
-
- c = '\0';
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING_SAW_CR;
- lwsl_parser("*\n");
- }
-
- n = issue_char(wsi, c);
- if ((int)n < 0)
- return -1;
- if (n > 0)
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
-
-swallow:
- /* per-protocol end of headers management */
-
- if (wsi->u.hdr.parser_state == WSI_TOKEN_CHALLENGE)
- goto set_parsing_complete;
- break;
-
- /* collecting and checking a name part */
- case WSI_TOKEN_NAME_PART:
- lwsl_parser("WSI_TOKEN_NAME_PART '%c' 0x%02X (mode=%d) wsi->u.hdr.lextable_pos=%d\n", c, c, wsi->mode, wsi->u.hdr.lextable_pos);
-
- wsi->u.hdr.lextable_pos =
- lextable_decode(wsi->u.hdr.lextable_pos, c);
- /*
- * Server needs to look out for unknown methods...
- */
- if (wsi->u.hdr.lextable_pos < 0 &&
- (wsi->mode == LWSCM_HTTP_SERVING)) {
- /* this is not a header we know about */
- for (m = 0; m < ARRAY_SIZE(methods); m++)
- if (ah->frag_index[methods[m]]) {
- /*
- * already had the method, no idea what
- * this crap from the client is, ignore
- */
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
- break;
- }
- /*
- * hm it's an unknown http method from a client in fact,
- * it cannot be valid http
- */
- if (m == ARRAY_SIZE(methods)) {
- /*
- * are we set up to accept raw in these cases?
- */
- if (lws_check_opt(wsi->vhost->options,
- LWS_SERVER_OPTION_FALLBACK_TO_RAW))
- return 2; /* transition to raw */
-
- lwsl_info("Unknown method - dropping\n");
- goto forbid;
- }
- break;
- }
- /*
- * ...otherwise for a client, let him ignore unknown headers
- * coming from the server
- */
- if (wsi->u.hdr.lextable_pos < 0) {
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
- break;
- }
-
- if (lextable[wsi->u.hdr.lextable_pos] < FAIL_CHAR) {
- /* terminal state */
-
- n = ((unsigned int)lextable[wsi->u.hdr.lextable_pos] << 8) |
- lextable[wsi->u.hdr.lextable_pos + 1];
-
- lwsl_parser("known hdr %d\n", n);
- for (m = 0; m < ARRAY_SIZE(methods); m++)
- if (n == methods[m] &&
- ah->frag_index[methods[m]]) {
- lwsl_warn("Duplicated method\n");
- return -1;
- }
-
- /*
- * WSORIGIN is protocol equiv to ORIGIN,
- * JWebSocket likes to send it, map to ORIGIN
- */
- if (n == WSI_TOKEN_SWORIGIN)
- n = WSI_TOKEN_ORIGIN;
-
- wsi->u.hdr.parser_state = (enum lws_token_indexes)
- (WSI_TOKEN_GET_URI + n);
-
- if (context->token_limits)
- wsi->u.hdr.current_token_limit =
- context->token_limits->token_limit[
- wsi->u.hdr.parser_state];
- else
- wsi->u.hdr.current_token_limit =
- wsi->context->max_http_header_data;
-
- if (wsi->u.hdr.parser_state == WSI_TOKEN_CHALLENGE)
- goto set_parsing_complete;
-
- goto start_fragment;
- }
- break;
-
-start_fragment:
- ah->nfrag++;
-excessive:
- if (ah->nfrag == ARRAY_SIZE(ah->frags)) {
- lwsl_warn("More hdr frags than we can deal with\n");
- return -1;
- }
-
- ah->frags[ah->nfrag].offset = ah->pos;
- ah->frags[ah->nfrag].len = 0;
- ah->frags[ah->nfrag].nfrag = 0;
- ah->frags[ah->nfrag].flags = 2;
-
- n = ah->frag_index[wsi->u.hdr.parser_state];
- if (!n) { /* first fragment */
- ah->frag_index[wsi->u.hdr.parser_state] = ah->nfrag;
- ah->hdr_token_idx = wsi->u.hdr.parser_state;
- break;
- }
- /* continuation */
- while (ah->frags[n].nfrag)
- n = ah->frags[n].nfrag;
- ah->frags[n].nfrag = ah->nfrag;
-
- if (issue_char(wsi, ' ') < 0)
- return -1;
- break;
-
- /* skipping arg part of a name we didn't recognize */
- case WSI_TOKEN_SKIPPING:
- lwsl_parser("WSI_TOKEN_SKIPPING '%c'\n", c);
-
- if (c == '\x0d')
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING_SAW_CR;
- break;
-
- case WSI_TOKEN_SKIPPING_SAW_CR:
- lwsl_parser("WSI_TOKEN_SKIPPING_SAW_CR '%c'\n", c);
- if (wsi->u.hdr.ues != URIES_IDLE)
- goto forbid;
- if (c == '\x0a') {
- wsi->u.hdr.parser_state = WSI_TOKEN_NAME_PART;
- wsi->u.hdr.lextable_pos = 0;
- } else
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
- break;
- /* we're done, ignore anything else */
-
- case WSI_PARSING_COMPLETE:
- lwsl_parser("WSI_PARSING_COMPLETE '%c'\n", c);
- break;
- }
-
- return 0;
-
-set_parsing_complete:
- if (wsi->u.hdr.ues != URIES_IDLE)
- goto forbid;
- if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
- if (lws_hdr_total_length(wsi, WSI_TOKEN_VERSION))
- wsi->ietf_spec_revision =
- atoi(lws_hdr_simple_ptr(wsi, WSI_TOKEN_VERSION));
-
- lwsl_parser("v%02d hdrs completed\n", wsi->ietf_spec_revision);
- }
- wsi->u.hdr.parser_state = WSI_PARSING_COMPLETE;
- wsi->hdr_parsing_completed = 1;
-
- return 0;
-
-forbid:
- lwsl_notice(" forbidding on uri sanitation\n");
- lws_return_http_status(wsi, HTTP_STATUS_FORBIDDEN, NULL);
-
- return -1;
-}
-
-LWS_VISIBLE int lws_frame_is_binary(struct lws *wsi)
-{
- return wsi->u.ws.frame_is_binary;
-}
-
-void
-lws_add_wsi_to_draining_ext_list(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
-
- if (wsi->u.ws.rx_draining_ext)
- return;
-
- lwsl_ext("%s: RX EXT DRAINING: Adding to list\n", __func__);
-
- wsi->u.ws.rx_draining_ext = 1;
- wsi->u.ws.rx_draining_ext_list = pt->rx_draining_ext_list;
- pt->rx_draining_ext_list = wsi;
-}
-
-void
-lws_remove_wsi_from_draining_ext_list(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- struct lws **w = &pt->rx_draining_ext_list;
-
- if (!wsi->u.ws.rx_draining_ext)
- return;
-
- lwsl_ext("%s: RX EXT DRAINING: Removing from list\n", __func__);
-
- wsi->u.ws.rx_draining_ext = 0;
-
- /* remove us from context draining ext list */
- while (*w) {
- if (*w == wsi) {
- /* if us, point it instead to who we were pointing to */
- *w = wsi->u.ws.rx_draining_ext_list;
- break;
- }
- w = &((*w)->u.ws.rx_draining_ext_list);
- }
- wsi->u.ws.rx_draining_ext_list = NULL;
-}
-
-/*
- * client-parser.c: lws_client_rx_sm() needs to be roughly kept in
- * sync with changes here, esp related to ext draining
- */
-
-int
-lws_rx_sm(struct lws *wsi, unsigned char c)
-{
- int callback_action = LWS_CALLBACK_RECEIVE;
- int ret = 0, n, rx_draining_ext = 0;
- struct lws_tokens eff_buf;
-
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
- if (wsi->socket_is_permanently_unusable)
- return -1;
-
- switch (wsi->lws_rx_parse_state) {
- case LWS_RXPS_NEW:
- if (wsi->u.ws.rx_draining_ext) {
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
- lws_remove_wsi_from_draining_ext_list(wsi);
- rx_draining_ext = 1;
- lwsl_debug("%s: doing draining flow\n", __func__);
-
- goto drain_extension;
- }
- switch (wsi->ietf_spec_revision) {
- case 13:
- /*
- * no prepended frame key any more
- */
- wsi->u.ws.all_zero_nonce = 1;
- goto handle_first;
-
- default:
- lwsl_warn("lws_rx_sm: unknown spec version %d\n",
- wsi->ietf_spec_revision);
- break;
- }
- break;
- case LWS_RXPS_04_mask_1:
- wsi->u.ws.mask[1] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
- wsi->lws_rx_parse_state = LWS_RXPS_04_mask_2;
- break;
- case LWS_RXPS_04_mask_2:
- wsi->u.ws.mask[2] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
- wsi->lws_rx_parse_state = LWS_RXPS_04_mask_3;
- break;
- case LWS_RXPS_04_mask_3:
- wsi->u.ws.mask[3] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
-
- /*
- * start from the zero'th byte in the XOR key buffer since
- * this is the start of a frame with a new key
- */
-
- wsi->u.ws.mask_idx = 0;
-
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_1;
- break;
-
- /*
- * 04 logical framing from the spec (all this is masked when incoming
- * and has to be unmasked)
- *
- * We ignore the possibility of extension data because we don't
- * negotiate any extensions at the moment.
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-------+-+-------------+-------------------------------+
- * |F|R|R|R| opcode|R| Payload len | Extended payload length |
- * |I|S|S|S| (4) |S| (7) | (16/63) |
- * |N|V|V|V| |V| | (if payload len==126/127) |
- * | |1|2|3| |4| | |
- * +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
- * | Extended payload length continued, if payload len == 127 |
- * + - - - - - - - - - - - - - - - +-------------------------------+
- * | | Extension data |
- * +-------------------------------+ - - - - - - - - - - - - - - - +
- * : :
- * +---------------------------------------------------------------+
- * : Application data :
- * +---------------------------------------------------------------+
- *
- * We pass payload through to userland as soon as we get it, ignoring
- * FIN. It's up to userland to buffer it up if it wants to see a
- * whole unfragmented block of the original size (which may be up to
- * 2^63 long!)
- */
-
- case LWS_RXPS_04_FRAME_HDR_1:
-handle_first:
-
- wsi->u.ws.opcode = c & 0xf;
- wsi->u.ws.rsv = c & 0x70;
- wsi->u.ws.final = !!((c >> 7) & 1);
-
- switch (wsi->u.ws.opcode) {
- case LWSWSOPC_TEXT_FRAME:
- case LWSWSOPC_BINARY_FRAME:
- wsi->u.ws.rsv_first_msg = (c & 0x70);
- wsi->u.ws.frame_is_binary =
- wsi->u.ws.opcode == LWSWSOPC_BINARY_FRAME;
- wsi->u.ws.first_fragment = 1;
- break;
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 0xb:
- case 0xc:
- case 0xd:
- case 0xe:
- case 0xf:
- lwsl_info("illegal opcode\n");
- return -1;
- }
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN:
-
- wsi->u.ws.this_frame_masked = !!(c & 0x80);
-
- switch (c & 0x7f) {
- case 126:
- /* control frames are not allowed to have big lengths */
- if (wsi->u.ws.opcode & 8)
- goto illegal_ctl_length;
-
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_2;
- break;
- case 127:
- /* control frames are not allowed to have big lengths */
- if (wsi->u.ws.opcode & 8)
- goto illegal_ctl_length;
-
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_8;
- break;
- default:
- wsi->u.ws.rx_packet_length = c & 0x7f;
- if (wsi->u.ws.this_frame_masked)
- wsi->lws_rx_parse_state =
- LWS_RXPS_07_COLLECT_FRAME_KEY_1;
- else
- if (wsi->u.ws.rx_packet_length)
- wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
- else {
- wsi->lws_rx_parse_state = LWS_RXPS_NEW;
- goto spill;
- }
- break;
- }
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN16_2:
- wsi->u.ws.rx_packet_length = c << 8;
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_1;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN16_1:
- wsi->u.ws.rx_packet_length |= c;
- if (wsi->u.ws.this_frame_masked)
- wsi->lws_rx_parse_state =
- LWS_RXPS_07_COLLECT_FRAME_KEY_1;
- else
- wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_8:
- if (c & 0x80) {
- lwsl_warn("b63 of length must be zero\n");
- /* kill the connection */
- return -1;
- }
-#if defined __LP64__
- wsi->u.ws.rx_packet_length = ((size_t)c) << 56;
-#else
- wsi->u.ws.rx_packet_length = 0;
-#endif
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_7:
-#if defined __LP64__
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 48;
-#endif
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_6:
-#if defined __LP64__
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 40;
-#endif
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_5:
-#if defined __LP64__
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 32;
-#endif
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_4:
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 24;
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_3;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_3:
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 16;
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_2;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_2:
- wsi->u.ws.rx_packet_length |= ((size_t)c) << 8;
- wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_1;
- break;
-
- case LWS_RXPS_04_FRAME_HDR_LEN64_1:
- wsi->u.ws.rx_packet_length |= ((size_t)c);
- if (wsi->u.ws.this_frame_masked)
- wsi->lws_rx_parse_state =
- LWS_RXPS_07_COLLECT_FRAME_KEY_1;
- else
- wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
- break;
-
- case LWS_RXPS_07_COLLECT_FRAME_KEY_1:
- wsi->u.ws.mask[0] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
- wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_2;
- break;
-
- case LWS_RXPS_07_COLLECT_FRAME_KEY_2:
- wsi->u.ws.mask[1] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
- wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_3;
- break;
-
- case LWS_RXPS_07_COLLECT_FRAME_KEY_3:
- wsi->u.ws.mask[2] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
- wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_4;
- break;
-
- case LWS_RXPS_07_COLLECT_FRAME_KEY_4:
- wsi->u.ws.mask[3] = c;
- if (c)
- wsi->u.ws.all_zero_nonce = 0;
- wsi->lws_rx_parse_state =
- LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED;
- wsi->u.ws.mask_idx = 0;
- if (wsi->u.ws.rx_packet_length == 0) {
- wsi->lws_rx_parse_state = LWS_RXPS_NEW;
- goto spill;
- }
- break;
-
-
- case LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED:
- assert(wsi->u.ws.rx_ubuf);
-
- if (wsi->u.ws.rx_draining_ext)
- goto drain_extension;
-
- if (wsi->u.ws.rx_ubuf_head + LWS_PRE >=
- wsi->u.ws.rx_ubuf_alloc) {
- lwsl_err("Attempted overflow \n");
- return -1;
- }
- if (wsi->u.ws.all_zero_nonce)
- wsi->u.ws.rx_ubuf[LWS_PRE +
- (wsi->u.ws.rx_ubuf_head++)] = c;
- else
- wsi->u.ws.rx_ubuf[LWS_PRE +
- (wsi->u.ws.rx_ubuf_head++)] =
- c ^ wsi->u.ws.mask[
- (wsi->u.ws.mask_idx++) & 3];
-
- if (--wsi->u.ws.rx_packet_length == 0) {
- /* spill because we have the whole frame */
- wsi->lws_rx_parse_state = LWS_RXPS_NEW;
- goto spill;
- }
-
- /*
- * if there's no protocol max frame size given, we are
- * supposed to default to context->pt_serv_buf_size
- */
- if (!wsi->protocol->rx_buffer_size &&
- wsi->u.ws.rx_ubuf_head != wsi->context->pt_serv_buf_size)
- break;
-
- if (wsi->protocol->rx_buffer_size &&
- wsi->u.ws.rx_ubuf_head != wsi->protocol->rx_buffer_size)
- break;
-
- /* spill because we filled our rx buffer */
-spill:
- /*
- * is this frame a control packet we should take care of at this
- * layer? If so service it and hide it from the user callback
- */
-
- lwsl_parser("spill on %s\n", wsi->protocol->name);
-
- switch (wsi->u.ws.opcode) {
- case LWSWSOPC_CLOSE:
-
- /* is this an acknowledgement of our close? */
- if (wsi->state == LWSS_AWAITING_CLOSE_ACK) {
- /*
- * fine he has told us he is closing too, let's
- * finish our close
- */
- lwsl_parser("seen client close ack\n");
- return -1;
- }
- if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY)
- /* if he sends us 2 CLOSE, kill him */
- return -1;
-
- if (lws_partial_buffered(wsi)) {
- /*
- * if we're in the middle of something,
- * we can't do a normal close response and
- * have to just close our end.
- */
- wsi->socket_is_permanently_unusable = 1;
- lwsl_parser("Closing on peer close due to Pending tx\n");
- return -1;
- }
-
- if (user_callback_handle_rxflow(
- wsi->protocol->callback, wsi,
- LWS_CALLBACK_WS_PEER_INITIATED_CLOSE,
- wsi->user_space,
- &wsi->u.ws.rx_ubuf[LWS_PRE],
- wsi->u.ws.rx_ubuf_head))
- return -1;
-
- lwsl_parser("server sees client close packet\n");
- wsi->state = LWSS_RETURNED_CLOSE_ALREADY;
- /* deal with the close packet contents as a PONG */
- wsi->u.ws.payload_is_close = 1;
- goto process_as_ping;
-
- case LWSWSOPC_PING:
- lwsl_info("received %d byte ping, sending pong\n",
- wsi->u.ws.rx_ubuf_head);
-
- if (wsi->u.ws.ping_pending_flag) {
- /*
- * there is already a pending ping payload
- * we should just log and drop
- */
- lwsl_parser("DROP PING since one pending\n");
- goto ping_drop;
- }
-process_as_ping:
- /* control packets can only be < 128 bytes long */
- if (wsi->u.ws.rx_ubuf_head > 128 - 3) {
- lwsl_parser("DROP PING payload too large\n");
- goto ping_drop;
- }
-
- /* stash the pong payload */
- memcpy(wsi->u.ws.ping_payload_buf + LWS_PRE,
- &wsi->u.ws.rx_ubuf[LWS_PRE],
- wsi->u.ws.rx_ubuf_head);
-
- wsi->u.ws.ping_payload_len = wsi->u.ws.rx_ubuf_head;
- wsi->u.ws.ping_pending_flag = 1;
-
- /* get it sent as soon as possible */
- lws_callback_on_writable(wsi);
-ping_drop:
- wsi->u.ws.rx_ubuf_head = 0;
- return 0;
-
- case LWSWSOPC_PONG:
- lwsl_info("received pong\n");
- lwsl_hexdump(&wsi->u.ws.rx_ubuf[LWS_PRE],
- wsi->u.ws.rx_ubuf_head);
-
- if (wsi->pending_timeout == PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG) {
- lwsl_info("received expected PONG on wsi %p\n", wsi);
- lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
- }
-
- /* issue it */
- callback_action = LWS_CALLBACK_RECEIVE_PONG;
- break;
-
- case LWSWSOPC_TEXT_FRAME:
- case LWSWSOPC_BINARY_FRAME:
- case LWSWSOPC_CONTINUATION:
- break;
-
- default:
- lwsl_parser("passing opc %x up to exts\n",
- wsi->u.ws.opcode);
- /*
- * It's something special we can't understand here.
- * Pass the payload up to the extension's parsing
- * state machine.
- */
-
- eff_buf.token = &wsi->u.ws.rx_ubuf[LWS_PRE];
- eff_buf.token_len = wsi->u.ws.rx_ubuf_head;
-
- if (lws_ext_cb_active(wsi, LWS_EXT_CB_EXTENDED_PAYLOAD_RX,
- &eff_buf, 0) <= 0)
- /* not handle or fail */
- lwsl_ext("ext opc opcode 0x%x unknown\n",
- wsi->u.ws.opcode);
-
- wsi->u.ws.rx_ubuf_head = 0;
- return 0;
- }
-
- /*
- * No it's real payload, pass it up to the user callback.
- * It's nicely buffered with the pre-padding taken care of
- * so it can be sent straight out again using lws_write
- */
-
- eff_buf.token = &wsi->u.ws.rx_ubuf[LWS_PRE];
- eff_buf.token_len = wsi->u.ws.rx_ubuf_head;
-
- if (wsi->u.ws.opcode == LWSWSOPC_PONG && !eff_buf.token_len)
- goto already_done;
-
-drain_extension:
- lwsl_ext("%s: passing %d to ext\n", __func__, eff_buf.token_len);
-
- if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY ||
- wsi->state == LWSS_AWAITING_CLOSE_ACK)
- goto already_done;
-
- n = lws_ext_cb_active(wsi, LWS_EXT_CB_PAYLOAD_RX, &eff_buf, 0);
- /*
- * eff_buf may be pointing somewhere completely different now,
- * it's the output
- */
- wsi->u.ws.first_fragment = 0;
- if (n < 0) {
- /*
- * we may rely on this to get RX, just drop connection
- */
- wsi->socket_is_permanently_unusable = 1;
- return -1;
- }
-
- if (rx_draining_ext && eff_buf.token_len == 0)
- goto already_done;
-
- if (n && eff_buf.token_len)
- /* extension had more... main loop will come back */
- lws_add_wsi_to_draining_ext_list(wsi);
- else
- lws_remove_wsi_from_draining_ext_list(wsi);
-
- if (eff_buf.token_len > 0 ||
- callback_action == LWS_CALLBACK_RECEIVE_PONG) {
- eff_buf.token[eff_buf.token_len] = '\0';
-
- if (wsi->protocol->callback) {
-
- if (callback_action == LWS_CALLBACK_RECEIVE_PONG)
- lwsl_info("Doing pong callback\n");
-
- ret = user_callback_handle_rxflow(
- wsi->protocol->callback,
- wsi,
- (enum lws_callback_reasons)callback_action,
- wsi->user_space,
- eff_buf.token,
- eff_buf.token_len);
- }
- else
- lwsl_err("No callback on payload spill!\n");
- }
-
-already_done:
- wsi->u.ws.rx_ubuf_head = 0;
- break;
- }
-
- return ret;
-
-illegal_ctl_length:
-
- lwsl_warn("Control frame with xtended length is illegal\n");
- /* kill the connection */
- return -1;
-}
-
-LWS_VISIBLE size_t
-lws_remaining_packet_payload(struct lws *wsi)
-{
- return wsi->u.ws.rx_packet_length;
-}
-
-/* Once we reach LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED, we know how much
- * to expect in that state and can deal with it in bulk more efficiently.
- */
-
-int
-lws_payload_until_length_exhausted(struct lws *wsi, unsigned char **buf,
- size_t *len)
-{
- unsigned char *buffer = *buf, mask[4];
- int buffer_size, n;
- unsigned int avail;
- char *rx_ubuf;
-
- if (wsi->protocol->rx_buffer_size)
- buffer_size = wsi->protocol->rx_buffer_size;
- else
- buffer_size = wsi->context->pt_serv_buf_size;
- avail = buffer_size - wsi->u.ws.rx_ubuf_head;
-
- /* do not consume more than we should */
- if (avail > wsi->u.ws.rx_packet_length)
- avail = wsi->u.ws.rx_packet_length;
-
- /* do not consume more than what is in the buffer */
- if (avail > *len)
- avail = *len;
-
- /* we want to leave 1 byte for the parser to handle properly */
- if (avail <= 1)
- return 0;
-
- avail--;
- rx_ubuf = wsi->u.ws.rx_ubuf + LWS_PRE + wsi->u.ws.rx_ubuf_head;
- if (wsi->u.ws.all_zero_nonce)
- memcpy(rx_ubuf, buffer, avail);
- else {
-
- for (n = 0; n < 4; n++)
- mask[n] = wsi->u.ws.mask[(wsi->u.ws.mask_idx + n) & 3];
-
- /* deal with 4-byte chunks using unwrapped loop */
- n = avail >> 2;
- while (n--) {
- *(rx_ubuf++) = *(buffer++) ^ mask[0];
- *(rx_ubuf++) = *(buffer++) ^ mask[1];
- *(rx_ubuf++) = *(buffer++) ^ mask[2];
- *(rx_ubuf++) = *(buffer++) ^ mask[3];
- }
- /* and the remaining bytes bytewise */
- for (n = 0; n < (int)(avail & 3); n++)
- *(rx_ubuf++) = *(buffer++) ^ mask[n];
-
- wsi->u.ws.mask_idx = (wsi->u.ws.mask_idx + avail) & 3;
- }
-
- (*buf) += avail;
- wsi->u.ws.rx_ubuf_head += avail;
- wsi->u.ws.rx_packet_length -= avail;
- *len -= avail;
-
- return avail;
-}
diff --git a/thirdparty/lws/server/ranges.c b/thirdparty/lws/server/ranges.c
deleted file mode 100644
index bc1578d733..0000000000
--- a/thirdparty/lws/server/ranges.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * RFC7233 ranges parser
- *
- * Copyright (C) 2016 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-/*
- * RFC7233 examples
- *
- * o The first 500 bytes (byte offsets 0-499, inclusive):
- *
- * bytes=0-499
- *
- * o The second 500 bytes (byte offsets 500-999, inclusive):
- *
- * bytes=500-999
- *
- * o The final 500 bytes (byte offsets 9500-9999, inclusive):
- *
- * bytes=-500
- *
- * Or:
- *
- * bytes=9500-
- *
- * o The first and last bytes only (bytes 0 and 9999):
- *
- * bytes=0-0,-1
- *
- * o Other valid (but not canonical) specifications of the second 500
- * bytes (byte offsets 500-999, inclusive):
- *
- * bytes=500-600,601-999
- * bytes=500-700,601-999
- */
-
-/*
- * returns 1 if the range struct represents a usable range
- * if no ranges header, you get one of these for the whole
- * file. Otherwise you get one for each valid range in the
- * header.
- *
- * returns 0 if no further valid range forthcoming; rp->state
- * may be LWSRS_SYNTAX or LWSRS_COMPLETED
- */
-
-int
-lws_ranges_next(struct lws_range_parsing *rp)
-{
- static const char * const beq = "bytes=";
- char c;
-
- while (1) {
-
- c = rp->buf[rp->pos];
-
- switch (rp->state) {
- case LWSRS_SYNTAX:
- case LWSRS_COMPLETED:
- return 0;
-
- case LWSRS_NO_ACTIVE_RANGE:
- rp->state = LWSRS_COMPLETED;
- return 0;
-
- case LWSRS_BYTES_EQ: // looking for "bytes="
- if (c != beq[rp->pos]) {
- rp->state = LWSRS_SYNTAX;
- return -1;
- }
- if (rp->pos == 5)
- rp->state = LWSRS_FIRST;
- break;
-
- case LWSRS_FIRST:
- rp->start = 0;
- rp->end = 0;
- rp->start_valid = 0;
- rp->end_valid = 0;
-
- rp->state = LWSRS_STARTING;
-
- // fallthru
-
- case LWSRS_STARTING:
- if (c == '-') {
- rp->state = LWSRS_ENDING;
- break;
- }
-
- if (!(c >= '0' && c <= '9')) {
- rp->state = LWSRS_SYNTAX;
- return 0;
- }
- rp->start = (rp->start * 10) + (c - '0');
- rp->start_valid = 1;
- break;
-
- case LWSRS_ENDING:
- if (c == ',' || c == '\0') {
- rp->state = LWSRS_FIRST;
- if (c == ',')
- rp->pos++;
-
- /*
- * By the end of this, start and end are
- * always valid if the range still is
- */
-
- if (!rp->start_valid) { /* eg, -500 */
- if (rp->end > rp->extent)
- rp->end = rp->extent;
-
- rp->start = rp->extent - rp->end;
- rp->end = rp->extent - 1;
- } else
- if (!rp->end_valid)
- rp->end = rp->extent - 1;
-
- rp->did_try = 1;
-
- /* end must be >= start or ignore it */
- if (rp->end < rp->start) {
- if (c == ',')
- break;
- rp->state = LWSRS_COMPLETED;
- return 0;
- }
-
- return 1; /* issue range */
- }
-
- if (!(c >= '0' && c <= '9')) {
- rp->state = LWSRS_SYNTAX;
- return 0;
- }
- rp->end = (rp->end * 10) + (c - '0');
- rp->end_valid = 1;
- break;
- }
-
- rp->pos++;
- }
-}
-
-void
-lws_ranges_reset(struct lws_range_parsing *rp)
-{
- rp->pos = 0;
- rp->ctr = 0;
- rp->start = 0;
- rp->end = 0;
- rp->start_valid = 0;
- rp->end_valid = 0;
- rp->state = LWSRS_BYTES_EQ;
-}
-
-/*
- * returns count of valid ranges
- */
-int
-lws_ranges_init(struct lws *wsi, struct lws_range_parsing *rp,
- unsigned long long extent)
-{
- rp->agg = 0;
- rp->send_ctr = 0;
- rp->inside = 0;
- rp->count_ranges = 0;
- rp->did_try = 0;
- lws_ranges_reset(rp);
- rp->state = LWSRS_COMPLETED;
-
- rp->extent = extent;
-
- if (lws_hdr_copy(wsi, (char *)rp->buf, sizeof(rp->buf),
- WSI_TOKEN_HTTP_RANGE) <= 0)
- return 0;
-
- rp->state = LWSRS_BYTES_EQ;
-
- while (lws_ranges_next(rp)) {
- rp->count_ranges++;
- rp->agg += rp->end - rp->start + 1;
- }
-
- lwsl_debug("%s: count %d\n", __func__, rp->count_ranges);
- lws_ranges_reset(rp);
-
- if (rp->did_try && !rp->count_ranges)
- return -1; /* "not satisfiable */
-
- lws_ranges_next(rp);
-
- return rp->count_ranges;
-}
diff --git a/thirdparty/lws/server/server-handshake.c b/thirdparty/lws/server/server-handshake.c
deleted file mode 100644
index 3d319c35d6..0000000000
--- a/thirdparty/lws/server/server-handshake.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2013 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-#define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); }
-
-#ifndef LWS_NO_EXTENSIONS
-static int
-lws_extension_server_handshake(struct lws *wsi, char **p, int budget)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- char ext_name[64], *args, *end = (*p) + budget - 1;
- const struct lws_ext_options *opts, *po;
- const struct lws_extension *ext;
- struct lws_ext_option_arg oa;
- int n, m, more = 1;
- int ext_count = 0;
- char ignore;
- char *c;
-
- /*
- * Figure out which extensions the client has that we want to
- * enable on this connection, and give him back the list
- */
- if (!lws_hdr_total_length(wsi, WSI_TOKEN_EXTENSIONS))
- return 0;
-
- /*
- * break down the list of client extensions
- * and go through them
- */
-
- if (lws_hdr_copy(wsi, (char *)pt->serv_buf, context->pt_serv_buf_size,
- WSI_TOKEN_EXTENSIONS) < 0)
- return 1;
-
- c = (char *)pt->serv_buf;
- lwsl_parser("WSI_TOKEN_EXTENSIONS = '%s'\n", c);
- wsi->count_act_ext = 0;
- ignore = 0;
- n = 0;
- args = NULL;
-
- /*
- * We may get a simple request
- *
- * Sec-WebSocket-Extensions: permessage-deflate
- *
- * or an elaborated one with requested options
- *
- * Sec-WebSocket-Extensions: permessage-deflate; \
- * server_no_context_takeover; \
- * client_no_context_takeover
- */
-
- while (more) {
-
- if (*c && (*c != ',' && *c != '\t')) {
- if (*c == ';') {
- ignore = 1;
- args = c + 1;
- }
- if (ignore || *c == ' ') {
- c++;
- continue;
- }
- ext_name[n] = *c++;
- if (n < sizeof(ext_name) - 1)
- n++;
- continue;
- }
- ext_name[n] = '\0';
-
- ignore = 0;
- if (!*c)
- more = 0;
- else {
- c++;
- if (!n)
- continue;
- }
-
- while (args && *args && *args == ' ')
- args++;
-
- /* check a client's extension against our support */
-
- ext = wsi->vhost->extensions;
-
- while (ext && ext->callback) {
-
- if (strcmp(ext_name, ext->name)) {
- ext++;
- continue;
- }
-
- /*
- * oh, we do support this one he asked for... but let's
- * confirm he only gave it once
- */
- for (m = 0; m < wsi->count_act_ext; m++)
- if (wsi->active_extensions[m] == ext) {
- lwsl_info("extension mentioned twice\n");
- return 1; /* shenanigans */
- }
-
- /*
- * ask user code if it's OK to apply it on this
- * particular connection + protocol
- */
- m = (wsi->protocol->callback)(wsi,
- LWS_CALLBACK_CONFIRM_EXTENSION_OKAY,
- wsi->user_space, ext_name, 0);
-
- /*
- * zero return from callback means go ahead and allow
- * the extension, it's what we get if the callback is
- * unhandled
- */
- if (m) {
- ext++;
- continue;
- }
-
- /* apply it */
-
- ext_count++;
-
- /* instantiate the extension on this conn */
-
- wsi->active_extensions[wsi->count_act_ext] = ext;
-
- /* allow him to construct his context */
-
- if (ext->callback(lws_get_context(wsi), ext, wsi,
- LWS_EXT_CB_CONSTRUCT,
- (void *)&wsi->act_ext_user[
- wsi->count_act_ext],
- (void *)&opts, 0)) {
- lwsl_info("ext %s failed construction\n",
- ext_name);
- ext_count--;
- ext++;
-
- continue;
- }
-
- if (ext_count > 1)
- *(*p)++ = ',';
- else
- LWS_CPYAPP(*p,
- "\x0d\x0aSec-WebSocket-Extensions: ");
- *p += lws_snprintf(*p, (end - *p), "%s", ext_name);
-
- /*
- * go through the options trying to apply the
- * recognized ones
- */
-
- lwsl_debug("ext args %s", args);
-
- while (args && *args && *args != ',') {
- while (*args == ' ')
- args++;
- po = opts;
- while (po->name) {
- lwsl_debug("'%s' '%s'\n", po->name, args);
- /* only support arg-less options... */
- if (po->type == EXTARG_NONE &&
- !strncmp(args, po->name,
- strlen(po->name))) {
- oa.option_name = NULL;
- oa.option_index = po - opts;
- oa.start = NULL;
- lwsl_debug("setting %s\n", po->name);
- if (!ext->callback(
- lws_get_context(wsi), ext, wsi,
- LWS_EXT_CB_OPTION_SET,
- wsi->act_ext_user[
- wsi->count_act_ext],
- &oa, (end - *p))) {
-
- *p += lws_snprintf(*p, (end - *p), "; %s", po->name);
- lwsl_debug("adding option %s\n", po->name);
- }
- }
- po++;
- }
- while (*args && *args != ',' && *args != ';')
- args++;
- }
-
- wsi->count_act_ext++;
- lwsl_parser("count_act_ext <- %d\n",
- wsi->count_act_ext);
-
- ext++;
- }
-
- n = 0;
- args = NULL;
- }
-
- return 0;
-}
-#endif
-int
-handshake_0405(struct lws_context *context, struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- struct lws_process_html_args args;
- unsigned char hash[20];
- int n, accept_len;
- char *response;
- char *p;
-
- if (!lws_hdr_total_length(wsi, WSI_TOKEN_HOST) ||
- !lws_hdr_total_length(wsi, WSI_TOKEN_KEY)) {
- lwsl_parser("handshake_04 missing pieces\n");
- /* completed header processing, but missing some bits */
- goto bail;
- }
-
- if (lws_hdr_total_length(wsi, WSI_TOKEN_KEY) >= MAX_WEBSOCKET_04_KEY_LEN) {
- lwsl_warn("Client key too long %d\n", MAX_WEBSOCKET_04_KEY_LEN);
- goto bail;
- }
-
- /*
- * since key length is restricted above (currently 128), cannot
- * overflow
- */
- n = sprintf((char *)pt->serv_buf,
- "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
- lws_hdr_simple_ptr(wsi, WSI_TOKEN_KEY));
-
- lws_SHA1(pt->serv_buf, n, hash);
-
- accept_len = lws_b64_encode_string((char *)hash, 20,
- (char *)pt->serv_buf, context->pt_serv_buf_size);
- if (accept_len < 0) {
- lwsl_warn("Base64 encoded hash too long\n");
- goto bail;
- }
-
- /* allocate the per-connection user memory (if any) */
- if (lws_ensure_user_space(wsi))
- goto bail;
-
- /* create the response packet */
-
- /* make a buffer big enough for everything */
-
- response = (char *)pt->serv_buf + MAX_WEBSOCKET_04_KEY_LEN + LWS_PRE;
- p = response;
- LWS_CPYAPP(p, "HTTP/1.1 101 Switching Protocols\x0d\x0a"
- "Upgrade: WebSocket\x0d\x0a"
- "Connection: Upgrade\x0d\x0a"
- "Sec-WebSocket-Accept: ");
- strcpy(p, (char *)pt->serv_buf);
- p += accept_len;
-
- /* we can only return the protocol header if:
- * - one came in, and ... */
- if (lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL) &&
- /* - it is not an empty string */
- wsi->protocol->name &&
- wsi->protocol->name[0]) {
- LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: ");
- p += lws_snprintf(p, 128, "%s", wsi->protocol->name);
- }
-
-#ifndef LWS_NO_EXTENSIONS
- /*
- * Figure out which extensions the client has that we want to
- * enable on this connection, and give him back the list.
- *
- * Give him a limited write bugdet
- */
- if (lws_extension_server_handshake(wsi, &p, 192))
- goto bail;
-#endif
- LWS_CPYAPP(p, "\x0d\x0a");
-
- args.p = p;
- args.max_len = ((char *)pt->serv_buf + context->pt_serv_buf_size) - p;
- if (user_callback_handle_rxflow(wsi->protocol->callback, wsi,
- LWS_CALLBACK_ADD_HEADERS,
- wsi->user_space, &args, 0))
- goto bail;
-
- p = args.p;
-
- /* end of response packet */
-
- LWS_CPYAPP(p, "\x0d\x0a");
-
- if (!lws_any_extension_handled(wsi, LWS_EXT_CB_HANDSHAKE_REPLY_TX,
- response, p - response)) {
-
- /* okay send the handshake response accepting the connection */
-
- lwsl_parser("issuing resp pkt %d len\n", (int)(p - response));
-#if defined(DEBUG) && ! defined(LWS_WITH_ESP8266)
- fwrite(response, 1, p - response, stderr);
-#endif
- n = lws_write(wsi, (unsigned char *)response,
- p - response, LWS_WRITE_HTTP_HEADERS);
- if (n != (p - response)) {
- lwsl_debug("handshake_0405: ERROR writing to socket\n");
- goto bail;
- }
-
- }
-
- /* alright clean up and set ourselves into established state */
-
- wsi->state = LWSS_ESTABLISHED;
- wsi->lws_rx_parse_state = LWS_RXPS_NEW;
-
- {
- const char * uri_ptr =
- lws_hdr_simple_ptr(wsi, WSI_TOKEN_GET_URI);
- int uri_len = lws_hdr_total_length(wsi, WSI_TOKEN_GET_URI);
- const struct lws_http_mount *hit =
- lws_find_mount(wsi, uri_ptr, uri_len);
- if (hit && hit->cgienv &&
- wsi->protocol->callback(wsi, LWS_CALLBACK_HTTP_PMO,
- wsi->user_space, (void *)hit->cgienv, 0))
- return 1;
- }
-
- return 0;
-
-
-bail:
- /* caller will free up his parsing allocations */
- return -1;
-}
-
diff --git a/thirdparty/lws/server/ssl-server.c b/thirdparty/lws/server/ssl-server.c
deleted file mode 100644
index a9516f2239..0000000000
--- a/thirdparty/lws/server/ssl-server.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-extern int openssl_websocket_private_data_index,
- openssl_SSL_CTX_private_data_index;
-
-extern void
-lws_ssl_bind_passphrase(SSL_CTX *ssl_ctx, struct lws_context_creation_info *info);
-
-#if !defined(LWS_WITH_MBEDTLS)
-static int
-OpenSSL_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx)
-{
- SSL *ssl;
- int n;
- struct lws *wsi;
-
- ssl = X509_STORE_CTX_get_ex_data(x509_ctx,
- SSL_get_ex_data_X509_STORE_CTX_idx());
-
- /*
- * !!! nasty openssl requires the index to come as a library-scope
- * static
- */
- wsi = SSL_get_ex_data(ssl, openssl_websocket_private_data_index);
-
- n = wsi->vhost->protocols[0].callback(wsi,
- LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION,
- x509_ctx, ssl, preverify_ok);
-
- /* convert return code from 0 = OK to 1 = OK */
- return !n;
-}
-#endif
-
-static int
-lws_context_ssl_init_ecdh(struct lws_vhost *vhost)
-{
-#ifdef LWS_SSL_SERVER_WITH_ECDH_CERT
- EC_KEY *EC_key = NULL;
- EVP_PKEY *pkey;
- int KeyType;
- X509 *x;
-
- if (!lws_check_opt(vhost->context->options, LWS_SERVER_OPTION_SSL_ECDH))
- return 0;
-
- lwsl_notice(" Using ECDH certificate support\n");
-
- /* Get X509 certificate from ssl context */
- x = sk_X509_value(vhost->ssl_ctx->extra_certs, 0);
- if (!x) {
- lwsl_err("%s: x is NULL\n", __func__);
- return 1;
- }
- /* Get the public key from certificate */
- pkey = X509_get_pubkey(x);
- if (!pkey) {
- lwsl_err("%s: pkey is NULL\n", __func__);
-
- return 1;
- }
- /* Get the key type */
- KeyType = EVP_PKEY_type(pkey->type);
-
- if (EVP_PKEY_EC != KeyType) {
- lwsl_notice("Key type is not EC\n");
- return 0;
- }
- /* Get the key */
- EC_key = EVP_PKEY_get1_EC_KEY(pkey);
- /* Set ECDH parameter */
- if (!EC_key) {
- lwsl_err("%s: ECDH key is NULL \n", __func__);
- return 1;
- }
- SSL_CTX_set_tmp_ecdh(vhost->ssl_ctx, EC_key);
- EC_KEY_free(EC_key);
-#endif
- return 0;
-}
-
-static int
-lws_context_ssl_init_ecdh_curve(struct lws_context_creation_info *info,
- struct lws_vhost *vhost)
-{
-#if defined(LWS_HAVE_OPENSSL_ECDH_H) && !defined(LWS_WITH_MBEDTLS)
- EC_KEY *ecdh;
- int ecdh_nid;
- const char *ecdh_curve = "prime256v1";
-
- if (info->ecdh_curve)
- ecdh_curve = info->ecdh_curve;
-
- ecdh_nid = OBJ_sn2nid(ecdh_curve);
- if (NID_undef == ecdh_nid) {
- lwsl_err("SSL: Unknown curve name '%s'", ecdh_curve);
- return 1;
- }
-
- ecdh = EC_KEY_new_by_curve_name(ecdh_nid);
- if (NULL == ecdh) {
- lwsl_err("SSL: Unable to create curve '%s'", ecdh_curve);
- return 1;
- }
- SSL_CTX_set_tmp_ecdh(vhost->ssl_ctx, ecdh);
- EC_KEY_free(ecdh);
-
- SSL_CTX_set_options(vhost->ssl_ctx, SSL_OP_SINGLE_ECDH_USE);
-
- lwsl_notice(" SSL ECDH curve '%s'\n", ecdh_curve);
-#else
-#if !defined(LWS_WITH_MBEDTLS)
- lwsl_notice(" OpenSSL doesn't support ECDH\n");
-#endif
-#endif
- return 0;
-}
-
-#if !defined(LWS_WITH_MBEDTLS) && defined(SSL_TLSEXT_ERR_NOACK) && !defined(OPENSSL_NO_TLSEXT)
-static int
-lws_ssl_server_name_cb(SSL *ssl, int *ad, void *arg)
-{
- struct lws_context *context = (struct lws_context *)arg;
- struct lws_vhost *vhost, *vh;
- const char *servername;
-
- if (!ssl)
- return SSL_TLSEXT_ERR_NOACK;
-
- /*
- * We can only get ssl accepted connections by using a vhost's ssl_ctx
- * find out which listening one took us and only match vhosts on the
- * same port.
- */
- vh = context->vhost_list;
- while (vh) {
- if (!vh->being_destroyed && vh->ssl_ctx == SSL_get_SSL_CTX(ssl))
- break;
- vh = vh->vhost_next;
- }
-
- if (!vh) {
- assert(vh); /* can't match the incoming vh? */
- return SSL_TLSEXT_ERR_OK;
- }
-
- servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
- if (!servername) {
- /* the client doesn't know what hostname it wants */
- lwsl_info("SNI: Unknown ServerName: %s\n", servername);
-
- return SSL_TLSEXT_ERR_OK;
- }
-
- vhost = lws_select_vhost(context, vh->listen_port, servername);
- if (!vhost) {
- lwsl_info("SNI: none: %s:%d\n", servername, vh->listen_port);
-
- return SSL_TLSEXT_ERR_OK;
- }
-
- lwsl_info("SNI: Found: %s:%d\n", servername, vh->listen_port);
-
- /* select the ssl ctx from the selected vhost for this conn */
- SSL_set_SSL_CTX(ssl, vhost->ssl_ctx);
-
- return SSL_TLSEXT_ERR_OK;
-}
-#endif
-
-LWS_VISIBLE int
-lws_context_init_server_ssl(struct lws_context_creation_info *info,
- struct lws_vhost *vhost)
-{
- struct lws_context *context = vhost->context;
- struct lws wsi;
- unsigned long error;
- int n;
-
- if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT)) {
- vhost->use_ssl = 0;
- return 0;
- }
-
- /*
- * If he is giving a cert filepath, take it as a sign he wants to use
- * it on this vhost. User code can leave the cert filepath NULL and
- * set the LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX option itself, in
- * which case he's expected to set up the cert himself at
- * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS, which
- * provides the vhost SSL_CTX * in the user parameter.
- */
- if (info->ssl_cert_filepath)
- info->options |= LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX;
-
- if (info->port != CONTEXT_PORT_NO_LISTEN) {
-
- vhost->use_ssl = lws_check_opt(info->options,
- LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX);
-
- if (vhost->use_ssl && info->ssl_cipher_list)
- lwsl_notice(" SSL ciphers: '%s'\n", info->ssl_cipher_list);
-
- if (vhost->use_ssl)
- lwsl_notice(" Using SSL mode\n");
- else
- lwsl_notice(" Using non-SSL mode\n");
- }
-
- /*
- * give him a fake wsi with context + vhost set, so he can use
- * lws_get_context() in the callback
- */
- memset(&wsi, 0, sizeof(wsi));
- wsi.vhost = vhost;
- wsi.context = context;
-
- (void)n;
- (void)error;
-
- /*
- * Firefox insists on SSLv23 not SSLv3
- * Konq disables SSLv2 by default now, SSLv23 works
- *
- * SSLv23_server_method() is the openssl method for "allow all TLS
- * versions", compared to e.g. TLSv1_2_server_method() which only allows
- * tlsv1.2. Unwanted versions must be disabled using SSL_CTX_set_options()
- */
-#if !defined(LWS_WITH_MBEDTLS)
- {
- SSL_METHOD *method;
-
- method = (SSL_METHOD *)SSLv23_server_method();
- if (!method) {
- error = ERR_get_error();
- lwsl_err("problem creating ssl method %lu: %s\n",
- error, ERR_error_string(error,
- (char *)context->pt[0].serv_buf));
- return 1;
- }
- vhost->ssl_ctx = SSL_CTX_new(method); /* create context */
- if (!vhost->ssl_ctx) {
- error = ERR_get_error();
- lwsl_err("problem creating ssl context %lu: %s\n",
- error, ERR_error_string(error,
- (char *)context->pt[0].serv_buf));
- return 1;
- }
- }
-#else
- {
- const SSL_METHOD *method = TLSv1_2_server_method();
-
- vhost->ssl_ctx = SSL_CTX_new(method); /* create context */
- if (!vhost->ssl_ctx) {
- lwsl_err("problem creating ssl context\n");
- return 1;
- }
-
- }
-#endif
-#if !defined(LWS_WITH_MBEDTLS)
-
- /* associate the lws context with the SSL_CTX */
-
- SSL_CTX_set_ex_data(vhost->ssl_ctx,
- openssl_SSL_CTX_private_data_index, (char *)vhost->context);
- /* Disable SSLv2 and SSLv3 */
- SSL_CTX_set_options(vhost->ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
-#ifdef SSL_OP_NO_COMPRESSION
- SSL_CTX_set_options(vhost->ssl_ctx, SSL_OP_NO_COMPRESSION);
-#endif
- SSL_CTX_set_options(vhost->ssl_ctx, SSL_OP_SINGLE_DH_USE);
- SSL_CTX_set_options(vhost->ssl_ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
-
- if (info->ssl_cipher_list)
- SSL_CTX_set_cipher_list(vhost->ssl_ctx,
- info->ssl_cipher_list);
-#endif
-
- /* as a server, are we requiring clients to identify themselves? */
-
- if (lws_check_opt(info->options,
- LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT)) {
- int verify_options = SSL_VERIFY_PEER;
-
- if (!lws_check_opt(info->options,
- LWS_SERVER_OPTION_PEER_CERT_NOT_REQUIRED))
- verify_options |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
-
-#if !defined(LWS_WITH_MBEDTLS)
- SSL_CTX_set_session_id_context(vhost->ssl_ctx,
- (unsigned char *)context, sizeof(void *));
-
- /* absolutely require the client cert */
-
- SSL_CTX_set_verify(vhost->ssl_ctx,
- verify_options, OpenSSL_verify_callback);
-#endif
- }
-
-#if !defined(LWS_WITH_MBEDTLS) && !defined(OPENSSL_NO_TLSEXT)
- SSL_CTX_set_tlsext_servername_callback(vhost->ssl_ctx,
- lws_ssl_server_name_cb);
- SSL_CTX_set_tlsext_servername_arg(vhost->ssl_ctx, context);
-#endif
-
- /*
- * give user code a chance to load certs into the server
- * allowing it to verify incoming client certs
- */
-#if !defined(LWS_WITH_MBEDTLS)
- if (info->ssl_ca_filepath &&
- !SSL_CTX_load_verify_locations(vhost->ssl_ctx,
- info->ssl_ca_filepath, NULL)) {
- lwsl_err("%s: SSL_CTX_load_verify_locations unhappy\n", __func__);
- }
-#endif
- if (vhost->use_ssl) {
- if (lws_context_ssl_init_ecdh_curve(info, vhost))
- return -1;
-
- vhost->protocols[0].callback(&wsi,
- LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS,
- vhost->ssl_ctx, NULL, 0);
- }
-
- if (lws_check_opt(info->options, LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT))
- /* Normally SSL listener rejects non-ssl, optionally allow */
- vhost->allow_non_ssl_on_ssl_port = 1;
-
- if (info->ssl_options_set)
- SSL_CTX_set_options(vhost->ssl_ctx, info->ssl_options_set);
-
-/* SSL_clear_options introduced in 0.9.8m */
-#if !defined(LWS_WITH_MBEDTLS)
-#if (OPENSSL_VERSION_NUMBER >= 0x009080df) && !defined(USE_WOLFSSL)
- if (info->ssl_options_clear)
- SSL_CTX_clear_options(vhost->ssl_ctx, info->ssl_options_clear);
-#endif
-#endif
-
- lwsl_info(" SSL options 0x%lX\n", SSL_CTX_get_options(vhost->ssl_ctx));
-
- if (vhost->use_ssl && info->ssl_cert_filepath) {
- /*
- * The user code can choose to either pass the cert and
- * key filepaths using the info members like this, or it can
- * leave them NULL; force the vhost SSL_CTX init using the info
- * options flag LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX; and
- * set up the cert himself using the user callback
- * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS, which
- * happened just above and has the vhost SSL_CTX * in the user
- * parameter.
- */
-#if !defined(LWS_WITH_MBEDTLS)
- /* set the local certificate from CertFile */
- n = SSL_CTX_use_certificate_chain_file(vhost->ssl_ctx,
- info->ssl_cert_filepath);
- if (n != 1) {
- error = ERR_get_error();
- lwsl_err("problem getting cert '%s' %lu: %s\n",
- info->ssl_cert_filepath,
- error,
- ERR_error_string(error,
- (char *)context->pt[0].serv_buf));
- return 1;
- }
- lws_ssl_bind_passphrase(vhost->ssl_ctx, info);
-#else
- uint8_t *p;
- lws_filepos_t flen;
- int err;
-
- if (alloc_pem_to_der_file(vhost->context, info->ssl_cert_filepath, &p,
- &flen)) {
- lwsl_err("couldn't find cert file %s\n",
- info->ssl_cert_filepath);
-
- return 1;
- }
- err = SSL_CTX_use_certificate_ASN1(vhost->ssl_ctx, flen, p);
- if (!err) {
- lwsl_err("Problem loading cert\n");
- return 1;
- }
-#if !defined(LWS_WITH_ESP32)
- free(p);
- p = NULL;
-#endif
-
- if (info->ssl_private_key_filepath) {
- if (alloc_pem_to_der_file(vhost->context,
- info->ssl_private_key_filepath, &p, &flen)) {
- lwsl_err("couldn't find cert file %s\n",
- info->ssl_cert_filepath);
-
- return 1;
- }
- err = SSL_CTX_use_PrivateKey_ASN1(0, vhost->ssl_ctx, p, flen);
- if (!err) {
- lwsl_err("Problem loading key\n");
-
- return 1;
- }
- }
-
-#if !defined(LWS_WITH_ESP32)
- free(p);
- p = NULL;
-#endif
-#endif
- if (info->ssl_private_key_filepath != NULL) {
-#if !defined(LWS_WITH_MBEDTLS)
- /* set the private key from KeyFile */
- if (SSL_CTX_use_PrivateKey_file(vhost->ssl_ctx,
- info->ssl_private_key_filepath,
- SSL_FILETYPE_PEM) != 1) {
- error = ERR_get_error();
- lwsl_err("ssl problem getting key '%s' %lu: %s\n",
- info->ssl_private_key_filepath, error,
- ERR_error_string(error,
- (char *)context->pt[0].serv_buf));
- return 1;
- }
-#endif
- } else
- if (vhost->protocols[0].callback(&wsi,
- LWS_CALLBACK_OPENSSL_CONTEXT_REQUIRES_PRIVATE_KEY,
- vhost->ssl_ctx, NULL, 0)) {
- lwsl_err("ssl private key not set\n");
-
- return 1;
- }
-#if !defined(LWS_WITH_MBEDTLS)
- /* verify private key */
- if (!SSL_CTX_check_private_key(vhost->ssl_ctx)) {
- lwsl_err("Private SSL key doesn't match cert\n");
- return 1;
- }
-#endif
- }
- if (vhost->use_ssl) {
- if (lws_context_ssl_init_ecdh(vhost))
- return 1;
-
- /*
- * SSL is happy and has a cert it's content with
- * If we're supporting HTTP2, initialize that
- */
- lws_context_init_http2_ssl(vhost);
- }
-
- return 0;
-}
-
diff --git a/thirdparty/lws/service.c b/thirdparty/lws/service.c
deleted file mode 100644
index 6748e30bd4..0000000000
--- a/thirdparty/lws/service.c
+++ /dev/null
@@ -1,1699 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-static int
-lws_calllback_as_writeable(struct lws *wsi)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- int n;
-
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB, 1);
-#if defined(LWS_WITH_STATS)
- if (wsi->active_writable_req_us) {
- uint64_t ul = time_in_microseconds() -
- wsi->active_writable_req_us;
-
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_MS_WRITABLE_DELAY, ul);
- lws_stats_atomic_max(wsi->context, pt,
- LWSSTATS_MS_WORST_WRITABLE_DELAY, ul);
- wsi->active_writable_req_us = 0;
- }
-#endif
-
- switch (wsi->mode) {
- case LWSCM_RAW:
- n = LWS_CALLBACK_RAW_WRITEABLE;
- break;
- case LWSCM_RAW_FILEDESC:
- n = LWS_CALLBACK_RAW_WRITEABLE_FILE;
- break;
- case LWSCM_WS_CLIENT:
- n = LWS_CALLBACK_CLIENT_WRITEABLE;
- break;
- case LWSCM_WSCL_ISSUE_HTTP_BODY:
- n = LWS_CALLBACK_CLIENT_HTTP_WRITEABLE;
- break;
- case LWSCM_WS_SERVING:
- n = LWS_CALLBACK_SERVER_WRITEABLE;
- break;
- default:
- n = LWS_CALLBACK_HTTP_WRITEABLE;
- break;
- }
-
- return user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, (enum lws_callback_reasons) n,
- wsi->user_space, NULL, 0);
-}
-
-LWS_VISIBLE int
-lws_handle_POLLOUT_event(struct lws *wsi, struct lws_pollfd *pollfd)
-{
- int write_type = LWS_WRITE_PONG;
- struct lws_tokens eff_buf;
-#ifdef LWS_WITH_HTTP2
- struct lws **wsi2, *wsi2a;
-#endif
- int ret, m, n;
-
- wsi->leave_pollout_active = 0;
- wsi->handling_pollout = 1;
- /*
- * if another thread wants POLLOUT on us, from here on while
- * handling_pollout is set, he will only set leave_pollout_active.
- * If we are going to disable POLLOUT, we will check that first.
- */
-
- /*
- * user callback is lowest priority to get these notifications
- * actually, since other pending things cannot be disordered
- */
-
- /* Priority 1: pending truncated sends are incomplete ws fragments
- * If anything else sent first the protocol would be
- * corrupted.
- */
- if (wsi->trunc_len) {
- //lwsl_notice("%s: completing partial\n", __func__);
- if (lws_issue_raw(wsi, wsi->trunc_alloc + wsi->trunc_offset,
- wsi->trunc_len) < 0) {
- lwsl_info("%s signalling to close\n", __func__);
- goto bail_die;
- }
- /* leave POLLOUT active either way */
- goto bail_ok;
- } else
- if (wsi->state == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
- wsi->socket_is_permanently_unusable = 1;
- goto bail_die; /* retry closing now */
- }
-
- if (wsi->mode == LWSCM_WSCL_ISSUE_HTTP_BODY)
- goto user_service;
-
-#ifdef LWS_WITH_HTTP2
- /*
- * Priority 2: protocol packets
- */
- if (wsi->upgraded_to_http2 && wsi->u.h2.h2n->pps) {
- lwsl_info("servicing pps\n");
- if (lws_h2_do_pps_send(wsi)) {
- wsi->socket_is_permanently_unusable = 1;
- goto bail_die;
- }
- if (wsi->u.h2.h2n->pps)
- goto bail_ok;
-
- /* we can resume whatever we were doing */
- lws_rx_flow_control(wsi, LWS_RXFLOW_REASON_APPLIES_ENABLE |
- LWS_RXFLOW_REASON_H2_PPS_PENDING);
-
- goto bail_ok; /* leave POLLOUT active */
- }
-#endif
-
-#ifdef LWS_WITH_CGI
- if (wsi->cgi) {
- /* also one shot */
- if (pollfd)
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_info("failed at set pollfd\n");
- return 1;
- }
- goto user_service_go_again;
- }
-#endif
-
- /* Priority 3: pending control packets (pong or close)
- *
- * 3a: close notification packet requested from close api
- */
-
- if (wsi->state == LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION) {
- lwsl_debug("sending close packet\n");
- wsi->waiting_to_send_close_frame = 0;
- n = lws_write(wsi, &wsi->u.ws.ping_payload_buf[LWS_PRE],
- wsi->u.ws.close_in_ping_buffer_len,
- LWS_WRITE_CLOSE);
- if (n >= 0) {
- wsi->state = LWSS_AWAITING_CLOSE_ACK;
- lws_set_timeout(wsi, PENDING_TIMEOUT_CLOSE_ACK, 1);
- lwsl_debug("sent close indication, awaiting ack\n");
-
- goto bail_ok;
- }
-
- goto bail_die;
- }
-
- /* else, the send failed and we should just hang up */
-
- if ((wsi->state == LWSS_ESTABLISHED &&
- wsi->u.ws.ping_pending_flag) ||
- (wsi->state == LWSS_RETURNED_CLOSE_ALREADY &&
- wsi->u.ws.payload_is_close)) {
-
- if (wsi->u.ws.payload_is_close)
- write_type = LWS_WRITE_CLOSE;
-
- n = lws_write(wsi, &wsi->u.ws.ping_payload_buf[LWS_PRE],
- wsi->u.ws.ping_payload_len, write_type);
- if (n < 0)
- goto bail_die;
-
- /* well he is sent, mark him done */
- wsi->u.ws.ping_pending_flag = 0;
- if (wsi->u.ws.payload_is_close)
- /* oh... a close frame was it... then we are done */
- goto bail_die;
-
- /* otherwise for PING, leave POLLOUT active either way */
- goto bail_ok;
- }
-
- if (wsi->state == LWSS_ESTABLISHED &&
- !wsi->socket_is_permanently_unusable &&
- wsi->u.ws.send_check_ping) {
-
- lwsl_info("issuing ping on wsi %p\n", wsi);
- wsi->u.ws.send_check_ping = 0;
- n = lws_write(wsi, &wsi->u.ws.ping_payload_buf[LWS_PRE],
- 0, LWS_WRITE_PING);
- if (n < 0)
- goto bail_die;
-
- /*
- * we apparently were able to send the PING in a reasonable time
- * now reset the clock on our peer to be able to send the
- * PONG in a reasonable time.
- */
-
- lws_set_timeout(wsi, PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG,
- wsi->context->timeout_secs);
-
- goto bail_ok;
- }
-
- /* Priority 4: if we are closing, not allowed to send more data frags
- * which means user callback or tx ext flush banned now
- */
- if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY)
- goto user_service;
-
- /* Priority 5: Tx path extension with more to send
- *
- * These are handled as new fragments each time around
- * So while we must block new writeable callback to enforce
- * payload ordering, but since they are always complete
- * fragments control packets can interleave OK.
- */
- if (wsi->state == LWSS_ESTABLISHED && wsi->u.ws.tx_draining_ext) {
- lwsl_ext("SERVICING TX EXT DRAINING\n");
- if (lws_write(wsi, NULL, 0, LWS_WRITE_CONTINUATION) < 0)
- goto bail_die;
- /* leave POLLOUT active */
- goto bail_ok;
- }
-
- /* Priority 6: user can get the callback
- */
- m = lws_ext_cb_active(wsi, LWS_EXT_CB_IS_WRITEABLE, NULL, 0);
- if (m)
- goto bail_die;
-#ifndef LWS_NO_EXTENSIONS
- if (!wsi->extension_data_pending)
- goto user_service;
-#endif
- /*
- * check in on the active extensions, see if they
- * had pending stuff to spill... they need to get the
- * first look-in otherwise sequence will be disordered
- *
- * NULL, zero-length eff_buf means just spill pending
- */
-
- ret = 1;
- if (wsi->mode == LWSCM_RAW || wsi->mode == LWSCM_RAW_FILEDESC)
- ret = 0;
-
- while (ret == 1) {
-
- /* default to nobody has more to spill */
-
- ret = 0;
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
-
- /* give every extension a chance to spill */
-
- m = lws_ext_cb_active(wsi, LWS_EXT_CB_PACKET_TX_PRESEND,
- &eff_buf, 0);
- if (m < 0) {
- lwsl_err("ext reports fatal error\n");
- goto bail_die;
- }
- if (m)
- /*
- * at least one extension told us he has more
- * to spill, so we will go around again after
- */
- ret = 1;
-
- /* assuming they gave us something to send, send it */
-
- if (eff_buf.token_len) {
- n = lws_issue_raw(wsi, (unsigned char *)eff_buf.token,
- eff_buf.token_len);
- if (n < 0) {
- lwsl_info("closing from POLLOUT spill\n");
- goto bail_die;
- }
- /*
- * Keep amount spilled small to minimize chance of this
- */
- if (n != eff_buf.token_len) {
- lwsl_err("Unable to spill ext %d vs %d\n",
- eff_buf.token_len, n);
- goto bail_die;
- }
- } else
- continue;
-
- /* no extension has more to spill */
-
- if (!ret)
- continue;
-
- /*
- * There's more to spill from an extension, but we just sent
- * something... did that leave the pipe choked?
- */
-
- if (!lws_send_pipe_choked(wsi))
- /* no we could add more */
- continue;
-
- lwsl_info("choked in POLLOUT service\n");
-
- /*
- * Yes, he's choked. Leave the POLLOUT masked on so we will
- * come back here when he is unchoked. Don't call the user
- * callback to enforce ordering of spilling, he'll get called
- * when we come back here and there's nothing more to spill.
- */
-
- goto bail_ok;
- }
-#ifndef LWS_NO_EXTENSIONS
- wsi->extension_data_pending = 0;
-#endif
-user_service:
- /* one shot */
-
- if (wsi->parent_carries_io) {
- wsi->handling_pollout = 0;
- wsi->leave_pollout_active = 0;
-
- return lws_calllback_as_writeable(wsi);
- }
-
- if (pollfd) {
- int eff = wsi->leave_pollout_active;
-
- if (!eff)
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_info("failed at set pollfd\n");
- goto bail_die;
- }
-
- wsi->handling_pollout = 0;
-
- /* cannot get leave_pollout_active set after the above */
- if (!eff && wsi->leave_pollout_active)
- /* got set inbetween sampling eff and clearing
- * handling_pollout, force POLLOUT on */
- lws_calllback_as_writeable(wsi);
-
- wsi->leave_pollout_active = 0;
- }
-
- if (wsi->mode != LWSCM_WSCL_ISSUE_HTTP_BODY &&
- !wsi->hdr_parsing_completed)
- goto bail_ok;
-
-
-#ifdef LWS_WITH_CGI
-user_service_go_again:
-#endif
-
-#ifdef LWS_WITH_HTTP2
- /*
- * we are the 'network wsi' for potentially many muxed child wsi with
- * no network connection of their own, who have to use us for all their
- * network actions. So we use a round-robin scheme to share out the
- * POLLOUT notifications to our children.
- *
- * But because any child could exhaust the socket's ability to take
- * writes, we can only let one child get notified each time.
- *
- * In addition children may be closed / deleted / added between POLLOUT
- * notifications, so we can't hold pointers
- */
-
- if (wsi->mode != LWSCM_HTTP2_SERVING) {
- lwsl_info("%s: non http2\n", __func__);
- goto notify;
- }
-
- wsi->u.h2.requested_POLLOUT = 0;
- if (!wsi->u.h2.initialized) {
- lwsl_info("pollout on uninitialized http2 conn\n");
- goto bail_ok;
- }
-
-// if (SSL_want_read(wsi->ssl) || SSL_want_write(wsi->ssl)) {
-// lws_callback_on_writable(wsi);
-// goto bail_ok;
-// }
-
- lwsl_info("%s: %p: children waiting for POLLOUT service:\n", __func__, wsi);
- wsi2a = wsi->u.h2.child_list;
- while (wsi2a) {
- if (wsi2a->u.h2.requested_POLLOUT)
- lwsl_debug(" * %p\n", wsi2a);
- else
- lwsl_debug(" %p\n", wsi2a);
-
- wsi2a = wsi2a->u.h2.sibling_list;
- }
-
- wsi2 = &wsi->u.h2.child_list;
- if (!*wsi2)
- goto bail_ok;
-
- do {
- struct lws *w, **wa;
-
- wa = &(*wsi2)->u.h2.sibling_list;
- if (!(*wsi2)->u.h2.requested_POLLOUT) {
- lwsl_debug(" child %p doesn't want POLLOUT\n", *wsi2);
- goto next_child;
- }
-
- /*
- * we're going to do writable callback for this child.
- * move him to be the last child
- */
-
- lwsl_debug("servicing child %p\n", *wsi2);
-
- w = *wsi2;
- while (w) {
- if (!w->u.h2.sibling_list) { /* w is the current last */
- lwsl_debug("w=%p, *wsi2 = %p\n", w, *wsi2);
- if (w == *wsi2) /* we are already last */
- break;
- w->u.h2.sibling_list = *wsi2; /* last points to us as new last */
- *wsi2 = (*wsi2)->u.h2.sibling_list; /* guy pointing to us until now points to our old next */
- w->u.h2.sibling_list->u.h2.sibling_list = NULL; /* we point to nothing because we are last */
- w = w->u.h2.sibling_list; /* w becomes us */
- break;
- }
- w = w->u.h2.sibling_list;
- }
-
- w->u.h2.requested_POLLOUT = 0;
- lwsl_info("%s: child %p (state %d)\n", __func__, (*wsi2), (*wsi2)->state);
-
- if (w->u.h2.pending_status_body) {
- w->u.h2.send_END_STREAM = 1;
- n = lws_write(w,
- (uint8_t *)w->u.h2.pending_status_body + LWS_PRE,
- strlen(w->u.h2.pending_status_body + LWS_PRE),
- LWS_WRITE_HTTP_FINAL);
- lws_free_set_NULL(w->u.h2.pending_status_body);
- lws_close_free_wsi(w, LWS_CLOSE_STATUS_NOSTATUS);
- wa = &wsi->u.h2.child_list;
- goto next_child;
- }
-
- if (w->state == LWSS_HTTP_ISSUING_FILE) {
-
- w->leave_pollout_active = 0;
-
- /* >0 == completion, <0 == error
- *
- * We'll get a LWS_CALLBACK_HTTP_FILE_COMPLETION callback when
- * it's done. That's the case even if we just completed the
- * send, so wait for that.
- */
- n = lws_serve_http_file_fragment(w);
- lwsl_debug("lws_serve_http_file_fragment says %d\n", n);
-
- /*
- * We will often hear about out having sent the final
- * DATA here... if so close the actual wsi
- */
- if (n < 0 || w->u.h2.send_END_STREAM) {
- lwsl_debug("Closing POLLOUT child %p\n", w);
- lws_close_free_wsi(w, LWS_CLOSE_STATUS_NOSTATUS);
- wa = &wsi->u.h2.child_list;
- goto next_child;
- }
- if (n > 0)
- if (lws_http_transaction_completed(w))
- goto bail_die;
- if (!n) {
- lws_callback_on_writable(w);
- (w)->u.h2.requested_POLLOUT = 1;
- }
-
- goto next_child;
- }
-
- if (lws_calllback_as_writeable(w) || w->u.h2.send_END_STREAM) {
- lwsl_debug("Closing POLLOUT child\n");
- lws_close_free_wsi(w, LWS_CLOSE_STATUS_NOSTATUS);
- wa = &wsi->u.h2.child_list;
- }
-
-next_child:
- wsi2 = wa;
- } while (wsi2 && *wsi2 && !lws_send_pipe_choked(wsi));
-
- lwsl_info("%s: %p: children waiting for POLLOUT service: %p\n", __func__, wsi, wsi->u.h2.child_list);
- wsi2a = wsi->u.h2.child_list;
- while (wsi2a) {
- if (wsi2a->u.h2.requested_POLLOUT)
- lwsl_debug(" * %p\n", wsi2a);
- else
- lwsl_debug(" %p\n", wsi2a);
-
- wsi2a = wsi2a->u.h2.sibling_list;
- }
-
-
- wsi2a = wsi->u.h2.child_list;
- while (wsi2a) {
- if (wsi2a->u.h2.requested_POLLOUT) {
- lws_change_pollfd(wsi, 0, LWS_POLLOUT);
- break;
- }
- wsi2a = wsi2a->u.h2.sibling_list;
- }
-
- goto bail_ok;
-
-
-notify:
-#endif
- wsi->leave_pollout_active = 0;
-
- n = lws_calllback_as_writeable(wsi);
- wsi->handling_pollout = 0;
-
- if (wsi->leave_pollout_active)
- lws_change_pollfd(wsi, 0, LWS_POLLOUT);
-
- return n;
-
- /*
- * since these don't disable the POLLOUT, they are always doing the
- * right thing for leave_pollout_active whether it was set or not.
- */
-
-bail_ok:
- wsi->handling_pollout = 0;
- wsi->leave_pollout_active = 0;
-
- return 0;
-
-bail_die:
- wsi->handling_pollout = 0;
- wsi->leave_pollout_active = 0;
-
- return -1;
-}
-
-int
-lws_service_timeout_check(struct lws *wsi, unsigned int sec)
-{
- struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
- int n = 0;
-
- (void)n;
-
- /*
- * if extensions want in on it (eg, we are a mux parent)
- * give them a chance to service child timeouts
- */
- if (lws_ext_cb_active(wsi, LWS_EXT_CB_1HZ, NULL, sec) < 0)
- return 0;
-
- if (!wsi->pending_timeout)
- return 0;
-
- /*
- * if we went beyond the allowed time, kill the
- * connection
- */
- if ((time_t)sec > wsi->pending_timeout_limit) {
-
- if (wsi->desc.sockfd != LWS_SOCK_INVALID &&
- wsi->position_in_fds_table >= 0)
- n = pt->fds[wsi->position_in_fds_table].events;
-
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_TIMEOUTS, 1);
-
- /* no need to log normal idle keepalive timeout */
- if (wsi->pending_timeout != PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE)
- lwsl_info("wsi %p: TIMEDOUT WAITING on %d "
- "(did hdr %d, ah %p, wl %d, pfd "
- "events %d) %llu vs %llu\n",
- (void *)wsi, wsi->pending_timeout,
- wsi->hdr_parsing_completed, wsi->u.hdr.ah,
- pt->ah_wait_list_length, n,
- (unsigned long long)sec,
- (unsigned long long)wsi->pending_timeout_limit);
-
- /*
- * Since he failed a timeout, he already had a chance to do
- * something and was unable to... that includes situations like
- * half closed connections. So process this "failed timeout"
- * close as a violent death and don't try to do protocol
- * cleanup like flush partials.
- */
- wsi->socket_is_permanently_unusable = 1;
- if (wsi->mode == LWSCM_WSCL_WAITING_SSL)
- wsi->vhost->protocols[0].callback(wsi,
- LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
- wsi->user_space,
- (void *)"Timed out waiting SSL", 21);
-
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
-
- return 1;
- }
-
- return 0;
-}
-
-int lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len)
-{
-#if defined(LWS_WITH_HTTP2)
- if (wsi->upgraded_to_http2) {
- struct lws_h2_netconn *h2n = wsi->u.h2.h2n;
-
- assert(h2n->rx_scratch);
- buf += n;
- len -= n;
- assert ((char *)buf >= (char *)h2n->rx_scratch &&
- (char *)&buf[len] <= (char *)&h2n->rx_scratch[LWS_H2_RX_SCRATCH_SIZE]);
-
- h2n->rx_scratch_pos = ((char *)buf - (char *)h2n->rx_scratch);
- h2n->rx_scratch_len = len;
-
- lwsl_info("%s: %p: pausing h2 rx_scratch\n", __func__, wsi);
-
- return 0;
- }
-#endif
- /* his RX is flowcontrolled, don't send remaining now */
- if (wsi->rxflow_buffer) {
- if (buf >= wsi->rxflow_buffer &&
- &buf[len - 1] < &wsi->rxflow_buffer[wsi->rxflow_len]) {
- /* rxflow while we were spilling prev rxflow */
- lwsl_info("%s: staying in rxflow buf\n", __func__);
- return 1;
- } else {
- lwsl_err("%s: conflicting rxflow buf, "
- "current %p len %d, new %p len %d\n", __func__,
- wsi->rxflow_buffer, wsi->rxflow_len, buf, len);
- assert(0);
- return 1;
- }
- }
-
- /* a new rxflow, buffer it and warn caller */
- lwsl_info("%s: new rxflow input buffer len %d\n", __func__, len - n);
- wsi->rxflow_buffer = lws_malloc(len - n, "rxflow buf");
- if (!wsi->rxflow_buffer)
- return -1;
-
- wsi->rxflow_len = len - n;
- wsi->rxflow_pos = 0;
- memcpy(wsi->rxflow_buffer, buf + n, len - n);
-
- return 0;
-}
-
-/* this is used by the platform service code to stop us waiting for network
- * activity in poll() when we have something that already needs service
- */
-
-LWS_VISIBLE LWS_EXTERN int
-lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
-{
- struct lws_context_per_thread *pt = &context->pt[tsi];
- struct allocated_headers *ah;
-
- /* Figure out if we really want to wait in poll()
- * We only need to wait if really nothing already to do and we have
- * to wait for something from network
- */
-
- /* 1) if we know we are draining rx ext, do not wait in poll */
- if (pt->rx_draining_ext_list)
- return 0;
-
-#ifdef LWS_OPENSSL_SUPPORT
- /* 2) if we know we have non-network pending data, do not wait in poll */
- if (lws_ssl_anybody_has_buffered_read_tsi(context, tsi)) {
- lwsl_info("ssl buffered read\n");
- return 0;
- }
-#endif
-
- /* 3) if any ah has pending rx, do not wait in poll */
- ah = pt->ah_list;
- while (ah) {
- if (ah->rxpos != ah->rxlen) {
- if (!ah->wsi) {
- assert(0);
- }
- return 0;
- }
- ah = ah->next;
- }
-
- return timeout_ms;
-}
-
-/*
- * guys that need POLLIN service again without waiting for network action
- * can force POLLIN here if not flowcontrolled, so they will get service.
- *
- * Return nonzero if anybody got their POLLIN faked
- */
-int
-lws_service_flag_pending(struct lws_context *context, int tsi)
-{
- struct lws_context_per_thread *pt = &context->pt[tsi];
- struct allocated_headers *ah;
-#ifdef LWS_OPENSSL_SUPPORT
- struct lws *wsi_next;
-#endif
- struct lws *wsi;
- int forced = 0;
-
- /* POLLIN faking */
-
- /*
- * 1) For all guys with already-available ext data to drain, if they are
- * not flowcontrolled, fake their POLLIN status
- */
- wsi = pt->rx_draining_ext_list;
- while (wsi) {
- pt->fds[wsi->position_in_fds_table].revents |=
- pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
- if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN) {
- forced = 1;
- break;
- }
- wsi = wsi->u.ws.rx_draining_ext_list;
- }
-
-#ifdef LWS_OPENSSL_SUPPORT
- /*
- * 2) For all guys with buffered SSL read data already saved up, if they
- * are not flowcontrolled, fake their POLLIN status so they'll get
- * service to use up the buffered incoming data, even though their
- * network socket may have nothing
- */
- wsi = pt->pending_read_list;
- while (wsi) {
- wsi_next = wsi->pending_read_list_next;
- pt->fds[wsi->position_in_fds_table].revents |=
- pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
- if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN) {
- forced = 1;
- /*
- * he's going to get serviced now, take him off the
- * list of guys with buffered SSL. If he still has some
- * at the end of the service, he'll get put back on the
- * list then.
- */
- lws_ssl_remove_wsi_from_buffered_list(wsi);
- }
-
- wsi = wsi_next;
- }
-#endif
- /*
- * 3) For any wsi who have an ah with pending RX who did not
- * complete their current headers, and are not flowcontrolled,
- * fake their POLLIN status so they will be able to drain the
- * rx buffered in the ah
- */
- ah = pt->ah_list;
- while (ah) {
- if (ah->rxpos != ah->rxlen && !ah->wsi->hdr_parsing_completed) {
- pt->fds[ah->wsi->position_in_fds_table].revents |=
- pt->fds[ah->wsi->position_in_fds_table].events &
- LWS_POLLIN;
- if (pt->fds[ah->wsi->position_in_fds_table].revents &
- LWS_POLLIN) {
- forced = 1;
- break;
- }
- }
- ah = ah->next;
- }
-
- return forced;
-}
-
-#ifndef LWS_NO_CLIENT
-
-LWS_VISIBLE int
-lws_http_client_read(struct lws *wsi, char **buf, int *len)
-{
- int rlen, n;
-
- rlen = lws_ssl_capable_read(wsi, (unsigned char *)*buf, *len);
- *len = 0;
-
- /* allow the source to signal he has data again next time */
- lws_change_pollfd(wsi, 0, LWS_POLLIN);
-
- if (rlen == LWS_SSL_CAPABLE_ERROR) {
- lwsl_notice("%s: SSL capable error\n", __func__);
- return -1;
- }
-
- if (rlen == 0)
- return -1;
-
- if (rlen < 0)
- return 0;
-
- *len = rlen;
- wsi->client_rx_avail = 0;
-
- /*
- * server may insist on transfer-encoding: chunked,
- * so http client must deal with it
- */
-spin_chunks:
- while (wsi->chunked && (wsi->chunk_parser != ELCP_CONTENT) && *len) {
- switch (wsi->chunk_parser) {
- case ELCP_HEX:
- if ((*buf)[0] == '\x0d') {
- wsi->chunk_parser = ELCP_CR;
- break;
- }
- n = char_to_hex((*buf)[0]);
- if (n < 0) {
- lwsl_debug("chunking failure\n");
- return -1;
- }
- wsi->chunk_remaining <<= 4;
- wsi->chunk_remaining |= n;
- break;
- case ELCP_CR:
- if ((*buf)[0] != '\x0a') {
- lwsl_debug("chunking failure\n");
- return -1;
- }
- wsi->chunk_parser = ELCP_CONTENT;
- lwsl_info("chunk %d\n", wsi->chunk_remaining);
- if (wsi->chunk_remaining)
- break;
- lwsl_info("final chunk\n");
- goto completed;
-
- case ELCP_CONTENT:
- break;
-
- case ELCP_POST_CR:
- if ((*buf)[0] != '\x0d') {
- lwsl_debug("chunking failure\n");
-
- return -1;
- }
-
- wsi->chunk_parser = ELCP_POST_LF;
- break;
-
- case ELCP_POST_LF:
- if ((*buf)[0] != '\x0a')
- return -1;
-
- wsi->chunk_parser = ELCP_HEX;
- wsi->chunk_remaining = 0;
- break;
- }
- (*buf)++;
- (*len)--;
- }
-
- if (wsi->chunked && !wsi->chunk_remaining)
- return 0;
-
- if (wsi->u.http.rx_content_remain &&
- wsi->u.http.rx_content_remain < *len)
- n = (int)wsi->u.http.rx_content_remain;
- else
- n = *len;
-
- if (wsi->chunked && wsi->chunk_remaining &&
- wsi->chunk_remaining < n)
- n = wsi->chunk_remaining;
-
-#ifdef LWS_WITH_HTTP_PROXY
- /* hubbub */
- if (wsi->perform_rewrite)
- lws_rewrite_parse(wsi->rw, (unsigned char *)*buf, n);
- else
-#endif
- if (user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ,
- wsi->user_space, *buf, n)) {
- lwsl_debug("%s: LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ returned -1\n", __func__);
-
- return -1;
- }
-
- if (wsi->chunked && wsi->chunk_remaining) {
- (*buf) += n;
- wsi->chunk_remaining -= n;
- *len -= n;
- }
-
- if (wsi->chunked && !wsi->chunk_remaining)
- wsi->chunk_parser = ELCP_POST_CR;
-
- if (wsi->chunked && *len)
- goto spin_chunks;
-
- if (wsi->chunked)
- return 0;
-
- /* if we know the content length, decrement the content remaining */
- if (wsi->u.http.rx_content_length > 0)
- wsi->u.http.rx_content_remain -= n;
-
- if (wsi->u.http.rx_content_remain || !wsi->u.http.rx_content_length)
- return 0;
-
-completed:
- if (user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_COMPLETED_CLIENT_HTTP,
- wsi->user_space, NULL, 0)) {
- lwsl_debug("Completed call returned -1\n");
- return -1;
- }
-
- if (lws_http_transaction_completed_client(wsi)) {
- lwsl_notice("%s: transaction completed says -1\n", __func__);
- return -1;
- }
-
- return 0;
-}
-#endif
-
-static int
-lws_is_ws_with_ext(struct lws *wsi)
-{
-#if defined(LWS_NO_EXTENSIONS)
- return 0;
-#else
- return wsi->state == LWSS_ESTABLISHED &&
- !!wsi->count_act_ext;
-#endif
-}
-
-LWS_VISIBLE int
-lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int tsi)
-{
- struct lws_context_per_thread *pt = &context->pt[tsi];
- lws_sockfd_type our_fd = 0, tmp_fd;
- struct allocated_headers *ah;
- struct lws_tokens eff_buf;
- unsigned int pending = 0;
- struct lws *wsi, *wsi1;
- char draining_flow = 0;
- int timed_out = 0;
- time_t now;
- int n = 0, m;
- int more;
-
- if (!context->protocol_init_done)
- lws_protocol_init(context);
-
- time(&now);
-
- /*
- * handle case that system time was uninitialized when lws started
- * at boot, and got initialized a little later
- */
- if (context->time_up < 1464083026 && now > 1464083026)
- context->time_up = now;
-
- /* TODO: if using libev, we should probably use timeout watchers... */
- if (context->last_timeout_check_s != now) {
- context->last_timeout_check_s = now;
-
-#if defined(LWS_WITH_STATS)
- if (!tsi && now - context->last_dump > 10) {
- lws_stats_log_dump(context);
- context->last_dump = now;
- }
-#endif
-
- lws_plat_service_periodic(context);
-
- lws_check_deferred_free(context, 0);
-
-#if defined(LWS_WITH_PEER_LIMITS)
- lws_peer_cull_peer_wait_list(context);
-#endif
-
- /* retire unused deprecated context */
-#if !defined(LWS_PLAT_OPTEE) && !defined(LWS_WITH_ESP32)
-#if LWS_POSIX && !defined(_WIN32)
- if (context->deprecated && !context->count_wsi_allocated) {
- lwsl_notice("%s: ending deprecated context\n", __func__);
- kill(getpid(), SIGINT);
- return 0;
- }
-#endif
-#endif
- /* global timeout check once per second */
-
- if (pollfd)
- our_fd = pollfd->fd;
-
- /*
- * Phase 1: check every wsi on the timeout check list
- */
-
- wsi = context->pt[tsi].timeout_list;
- while (wsi) {
- /* we have to take copies, because he may be deleted */
- wsi1 = wsi->timeout_list;
- tmp_fd = wsi->desc.sockfd;
- if (lws_service_timeout_check(wsi, (unsigned int)now)) {
- /* he did time out... */
- if (tmp_fd == our_fd)
- /* it was the guy we came to service! */
- timed_out = 1;
- /* he's gone, no need to mark as handled */
- }
- wsi = wsi1;
- }
-
- /*
- * Phase 2: double-check active ah timeouts independent of wsi
- * timeout status
- */
-
- ah = pt->ah_list;
- while (ah) {
- int len;
- char buf[256];
- const unsigned char *c;
-
- if (!ah->in_use || !ah->wsi || !ah->assigned ||
- (ah->wsi->vhost && now - ah->assigned <
- ah->wsi->vhost->timeout_secs_ah_idle + 60)) {
- ah = ah->next;
- continue;
- }
-
- /*
- * a single ah session somehow got held for
- * an unreasonable amount of time.
- *
- * Dump info on the connection...
- */
- wsi = ah->wsi;
- buf[0] = '\0';
- lws_get_peer_simple(wsi, buf, sizeof(buf));
- lwsl_notice("ah excessive hold: wsi %p\n"
- " peer address: %s\n"
- " ah rxpos %u, rxlen %u, pos %u\n",
- wsi, buf, ah->rxpos, ah->rxlen,
- ah->pos);
- buf[0] = '\0';
- m = 0;
- do {
- c = lws_token_to_string(m);
- if (!c)
- break;
-
- len = lws_hdr_total_length(wsi, m);
- if (!len || len > sizeof(buf) - 1) {
- m++;
- continue;
- }
-
- if (lws_hdr_copy(wsi, buf,
- sizeof buf, m) > 0) {
- buf[sizeof(buf) - 1] = '\0';
-
- lwsl_notice(" %s = %s\n",
- (const char *)c, buf);
- }
- m++;
- } while (1);
-
- /* ... and then drop the connection */
-
- if (wsi->desc.sockfd == our_fd)
- /* it was the guy we came to service! */
- timed_out = 1;
-
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
-
- ah = ah->next;
- }
-
-#ifdef LWS_WITH_CGI
- /*
- * Phase 3: handle cgi timeouts
- */
- lws_cgi_kill_terminated(pt);
-#endif
-#if 0
- {
- char s[300], *p = s;
-
- for (n = 0; n < context->count_threads; n++)
- p += sprintf(p, " %7lu (%5d), ",
- context->pt[n].count_conns,
- context->pt[n].fds_count);
-
- lwsl_notice("load: %s\n", s);
- }
-#endif
- }
-
- /*
- * at intervals, check for ws connections needing ping-pong checks
- */
-
- if (context->ws_ping_pong_interval &&
- context->last_ws_ping_pong_check_s < now + 10) {
- struct lws_vhost *vh = context->vhost_list;
- context->last_ws_ping_pong_check_s = now;
-
- while (vh) {
- for (n = 0; n < vh->count_protocols; n++) {
- wsi = vh->same_vh_protocol_list[n];
-
- while (wsi) {
- if (wsi->state == LWSS_ESTABLISHED &&
- !wsi->socket_is_permanently_unusable &&
- !wsi->u.ws.send_check_ping &&
- wsi->u.ws.time_next_ping_check &&
- wsi->u.ws.time_next_ping_check < now) {
-
- lwsl_info("requesting ping-pong on wsi %p\n", wsi);
- wsi->u.ws.send_check_ping = 1;
- lws_set_timeout(wsi, PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
- context->timeout_secs);
- lws_callback_on_writable(wsi);
- wsi->u.ws.time_next_ping_check = now +
- wsi->context->ws_ping_pong_interval;
- }
- wsi = wsi->same_vh_protocol_next;
- }
- }
- vh = vh->vhost_next;
- }
- }
-
-
- /* the socket we came to service timed out, nothing to do */
- if (timed_out)
- return 0;
-
- /* just here for timeout management? */
- if (!pollfd)
- return 0;
-
- /* no, here to service a socket descriptor */
- wsi = wsi_from_fd(context, pollfd->fd);
- if (!wsi)
- /* not lws connection ... leave revents alone and return */
- return 0;
-
- /*
- * so that caller can tell we handled, past here we need to
- * zero down pollfd->revents after handling
- */
-
-#if LWS_POSIX
- /* handle session socket closed */
-
- if ((!(pollfd->revents & pollfd->events & LWS_POLLIN)) &&
- (pollfd->revents & LWS_POLLHUP)) {
- wsi->socket_is_permanently_unusable = 1;
- lwsl_debug("Session Socket %p (fd=%d) dead\n",
- (void *)wsi, pollfd->fd);
-
- goto close_and_handled;
- }
-
-#ifdef _WIN32
- if (pollfd->revents & LWS_POLLOUT)
- wsi->sock_send_blocking = FALSE;
-#endif
-
-#endif
-
- if ((!(pollfd->revents & pollfd->events & LWS_POLLIN)) &&
- (pollfd->revents & LWS_POLLHUP)) {
- lwsl_debug("pollhup\n");
- wsi->socket_is_permanently_unusable = 1;
- goto close_and_handled;
- }
-
-#ifdef LWS_OPENSSL_SUPPORT
- if ((wsi->state == LWSS_SHUTDOWN) && lws_is_ssl(wsi) && wsi->ssl) {
- n = SSL_shutdown(wsi->ssl);
- lwsl_debug("SSL_shutdown=%d for fd %d\n", n, wsi->desc.sockfd);
- switch (n) {
- case 1:
- n = shutdown(wsi->desc.sockfd, SHUT_WR);
- goto close_and_handled;
-
- case 0:
- lws_change_pollfd(wsi, 0, LWS_POLLIN);
- n = 0;
- goto handled;
-
- default:
- n = SSL_get_error(wsi->ssl, n);
- if (n != SSL_ERROR_SYSCALL && n != SSL_ERROR_SSL) {
- if (SSL_want_read(wsi->ssl)) {
- lwsl_debug("(wants read)\n");
- lws_change_pollfd(wsi, 0, LWS_POLLIN);
- n = 0;
- goto handled;
- }
- if (SSL_want_write(wsi->ssl)) {
- lwsl_debug("(wants write)\n");
- lws_change_pollfd(wsi, 0, LWS_POLLOUT);
- n = 0;
- goto handled;
- }
- }
-
- /* actual error occurred, just close the connection */
- n = shutdown(wsi->desc.sockfd, SHUT_WR);
- goto close_and_handled;
- }
- }
-#endif
-
- /* okay, what we came here to do... */
-
- switch (wsi->mode) {
- case LWSCM_HTTP_SERVING:
- case LWSCM_HTTP_CLIENT:
- case LWSCM_HTTP_SERVING_ACCEPTED:
- case LWSCM_SERVER_LISTENER:
- case LWSCM_SSL_ACK_PENDING:
- case LWSCM_SSL_ACK_PENDING_RAW:
- if (wsi->state == LWSS_CLIENT_HTTP_ESTABLISHED)
- goto handled;
-
-#ifdef LWS_WITH_CGI
- if (wsi->cgi && (pollfd->revents & LWS_POLLOUT)) {
- n = lws_handle_POLLOUT_event(wsi, pollfd);
- if (n)
- goto close_and_handled;
- goto handled;
- }
-#endif
- /* fallthru */
- case LWSCM_RAW:
- n = lws_server_socket_service(context, wsi, pollfd);
- if (n) /* closed by above */
- return 1;
- goto handled;
-
- case LWSCM_RAW_FILEDESC:
-
- if (pollfd->revents & LWS_POLLOUT) {
- n = lws_calllback_as_writeable(wsi);
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_info("failed at set pollfd\n");
- return 1;
- }
- if (n)
- goto close_and_handled;
- }
- n = LWS_CALLBACK_RAW_RX;
- if (wsi->mode == LWSCM_RAW_FILEDESC)
- n = LWS_CALLBACK_RAW_RX_FILE;
-
- if (pollfd->revents & LWS_POLLIN) {
- if (user_callback_handle_rxflow(
- wsi->protocol->callback,
- wsi, n,
- wsi->user_space, NULL, 0)) {
- lwsl_debug("raw rx callback closed it\n");
- goto close_and_handled;
- }
- }
-
- if (pollfd->revents & LWS_POLLHUP)
- goto close_and_handled;
- n = 0;
- goto handled;
-
- case LWSCM_WS_SERVING:
- case LWSCM_WS_CLIENT:
- case LWSCM_HTTP2_SERVING:
- case LWSCM_HTTP_CLIENT_ACCEPTED:
-
- /* 1: something requested a callback when it was OK to write */
-
- if ((pollfd->revents & LWS_POLLOUT) &&
- ((wsi->state == LWSS_ESTABLISHED ||
- wsi->state == LWSS_HTTP2_ESTABLISHED ||
- wsi->state == LWSS_HTTP2_ESTABLISHED_PRE_SETTINGS ||
- wsi->state == LWSS_RETURNED_CLOSE_ALREADY ||
- wsi->state == LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION ||
- wsi->state == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE)) &&
- lws_handle_POLLOUT_event(wsi, pollfd)) {
- if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY)
- wsi->state = LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE;
- lwsl_info("lws_service_fd: closing\n");
- goto close_and_handled;
- }
-
- if (wsi->state == LWSS_RETURNED_CLOSE_ALREADY ||
- wsi->state == LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION ||
- wsi->state == LWSS_AWAITING_CLOSE_ACK) {
- /*
- * we stopped caring about anything except control
- * packets. Force flow control off, defeat tx
- * draining.
- */
- lws_rx_flow_control(wsi, 1);
- wsi->u.ws.tx_draining_ext = 0;
- }
-
- if (wsi->u.ws.tx_draining_ext)
- /* we cannot deal with new RX until the TX ext
- * path has been drained. It's because new
- * rx will, eg, crap on the wsi rx buf that
- * may be needed to retain state.
- *
- * TX ext drain path MUST go through event loop
- * to avoid blocking.
- */
- break;
-
- if (lws_is_flowcontrolled(wsi))
- /* We cannot deal with any kind of new RX
- * because we are RX-flowcontrolled.
- */
- break;
-
-#if defined(LWS_WITH_HTTP2)
- if (wsi->http2_substream || wsi->upgraded_to_http2) {
- wsi1 = lws_get_network_wsi(wsi);
- if (wsi1 && wsi1->trunc_len)
- /* We cannot deal with any kind of new RX
- * because we are dealing with a partial send
- * (new RX may trigger new http_action() that
- * expect to be able to send)
- */
- break;
- }
-#endif
-
- /* 2: RX Extension needs to be drained
- */
-
- if (wsi->state == LWSS_ESTABLISHED &&
- wsi->u.ws.rx_draining_ext) {
-
- lwsl_ext("%s: RX EXT DRAINING: Service\n", __func__);
-#ifndef LWS_NO_CLIENT
- if (wsi->mode == LWSCM_WS_CLIENT) {
- n = lws_client_rx_sm(wsi, 0);
- if (n < 0)
- /* we closed wsi */
- n = 0;
- } else
-#endif
- n = lws_rx_sm(wsi, 0);
-
- goto handled;
- }
-
- if (wsi->u.ws.rx_draining_ext)
- /*
- * We have RX EXT content to drain, but can't do it
- * right now. That means we cannot do anything lower
- * priority either.
- */
- break;
-
- /* 3: RX Flowcontrol buffer / h2 rx scratch needs to be drained
- */
-
- if (wsi->rxflow_buffer) {
- lwsl_info("draining rxflow (len %d)\n",
- wsi->rxflow_len - wsi->rxflow_pos);
- assert(wsi->rxflow_pos < wsi->rxflow_len);
- /* well, drain it */
- eff_buf.token = (char *)wsi->rxflow_buffer +
- wsi->rxflow_pos;
- eff_buf.token_len = wsi->rxflow_len - wsi->rxflow_pos;
- draining_flow = 1;
- goto drain;
- }
-
-#if defined(LWS_WITH_HTTP2)
- if (wsi->upgraded_to_http2) {
- struct lws_h2_netconn *h2n = wsi->u.h2.h2n;
-
- if (h2n->rx_scratch_len) {
- lwsl_info("%s: %p: resuming h2 rx_scratch pos = %d len = %d\n",
- __func__, wsi, h2n->rx_scratch_pos, h2n->rx_scratch_len);
- eff_buf.token = (char *)h2n->rx_scratch +
- h2n->rx_scratch_pos;
- eff_buf.token_len = h2n->rx_scratch_len;
-
- h2n->rx_scratch_len = 0;
- goto drain;
- }
- }
-#endif
-
- /* 4: any incoming (or ah-stashed incoming rx) data ready?
- * notice if rx flow going off raced poll(), rx flow wins
- */
-
- if (!(pollfd->revents & pollfd->events & LWS_POLLIN))
- break;
-read:
- if (lws_is_flowcontrolled(wsi)) {
- lwsl_info("%s: %p should be rxflow (bm 0x%x)..\n",
- __func__, wsi, wsi->rxflow_bitmap);
- break;
- }
-
- /* all the union members start with hdr, so even in ws mode
- * we can deal with the ah via u.hdr
- */
- if (wsi->u.hdr.ah) {
- lwsl_info("%s: %p: inherited ah rx\n", __func__, wsi);
- eff_buf.token_len = wsi->u.hdr.ah->rxlen -
- wsi->u.hdr.ah->rxpos;
- eff_buf.token = (char *)wsi->u.hdr.ah->rx +
- wsi->u.hdr.ah->rxpos;
- } else {
- if (wsi->mode != LWSCM_HTTP_CLIENT_ACCEPTED) {
- /*
- * extension may not consume everything (eg, pmd may be constrained
- * as to what it can output...) has to go in per-wsi rx buf area.
- * Otherwise in large temp serv_buf area.
- */
-
-#if defined(LWS_WITH_HTTP2)
- if (wsi->upgraded_to_http2) {
- if (!wsi->u.h2.h2n->rx_scratch) {
- wsi->u.h2.h2n->rx_scratch = lws_malloc(LWS_H2_RX_SCRATCH_SIZE, "h2 rx scratch");
- if (!wsi->u.h2.h2n->rx_scratch)
- goto close_and_handled;
- }
- eff_buf.token = wsi->u.h2.h2n->rx_scratch;
- eff_buf.token_len = LWS_H2_RX_SCRATCH_SIZE;
- } else
-#endif
- {
- eff_buf.token = (char *)pt->serv_buf;
- if (lws_is_ws_with_ext(wsi)) {
- eff_buf.token_len = wsi->u.ws.rx_ubuf_alloc;
- } else {
- eff_buf.token_len = context->pt_serv_buf_size;
- }
-
- if ((unsigned int)eff_buf.token_len > context->pt_serv_buf_size)
- eff_buf.token_len = context->pt_serv_buf_size;
- }
-
- if ((int)pending > eff_buf.token_len)
- pending = eff_buf.token_len;
-
- eff_buf.token_len = lws_ssl_capable_read(wsi,
- (unsigned char *)eff_buf.token, pending ? pending :
- eff_buf.token_len);
- switch (eff_buf.token_len) {
- case 0:
- lwsl_info("%s: zero length read\n", __func__);
- goto close_and_handled;
- case LWS_SSL_CAPABLE_MORE_SERVICE:
- lwsl_info("SSL Capable more service\n");
- n = 0;
- goto handled;
- case LWS_SSL_CAPABLE_ERROR:
- lwsl_info("Closing when error\n");
- goto close_and_handled;
- }
- // lwsl_notice("Actual RX %d\n", eff_buf.token_len);
- }
- }
-
-drain:
-#ifndef LWS_NO_CLIENT
- if (wsi->mode == LWSCM_HTTP_CLIENT_ACCEPTED &&
- !wsi->told_user_closed) {
-
- /*
- * In SSL mode we get POLLIN notification about
- * encrypted data in.
- *
- * But that is not necessarily related to decrypted
- * data out becoming available; in may need to perform
- * other in or out before that happens.
- *
- * simply mark ourselves as having readable data
- * and turn off our POLLIN
- */
- wsi->client_rx_avail = 1;
- lws_change_pollfd(wsi, LWS_POLLIN, 0);
-
- /* let user code know, he'll usually ask for writeable
- * callback and drain / re-enable it there
- */
- if (user_callback_handle_rxflow(
- wsi->protocol->callback,
- wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP,
- wsi->user_space, NULL, 0)) {
- lwsl_info("RECEIVE_CLIENT_HTTP closed it\n");
- goto close_and_handled;
- }
-
- n = 0;
- goto handled;
- }
-#endif
- /*
- * give any active extensions a chance to munge the buffer
- * before parse. We pass in a pointer to an lws_tokens struct
- * prepared with the default buffer and content length that's in
- * there. Rather than rewrite the default buffer, extensions
- * that expect to grow the buffer can adapt .token to
- * point to their own per-connection buffer in the extension
- * user allocation. By default with no extensions or no
- * extension callback handling, just the normal input buffer is
- * used then so it is efficient.
- */
- do {
- more = 0;
-
- m = lws_ext_cb_active(wsi, LWS_EXT_CB_PACKET_RX_PREPARSE,
- &eff_buf, 0);
- if (m < 0)
- goto close_and_handled;
- if (m)
- more = 1;
-
- /* service incoming data */
-
- if (eff_buf.token_len) {
- /*
- * if draining from rxflow buffer, not
- * critical to track what was used since at the
- * use it bumps wsi->rxflow_pos. If we come
- * around again it will pick up from where it
- * left off.
- */
- n = lws_read(wsi, (unsigned char *)eff_buf.token,
- eff_buf.token_len);
- if (n < 0) {
- /* we closed wsi */
- n = 0;
- goto handled;
- }
- }
-
- eff_buf.token = NULL;
- eff_buf.token_len = 0;
- } while (more);
-
- if (wsi->u.hdr.ah) {
- lwsl_debug("%s: %p: detaching\n", __func__, wsi);
- lws_header_table_force_to_detachable_state(wsi);
- /* we can run the normal ah detach flow despite
- * being in ws union mode, since all union members
- * start with hdr */
- lws_header_table_detach(wsi, 0);
- }
-
- pending = lws_ssl_pending(wsi);
- if (pending) {
- if (lws_is_ws_with_ext(wsi))
- pending = pending > wsi->u.ws.rx_ubuf_alloc ?
- wsi->u.ws.rx_ubuf_alloc : pending;
- else
- pending = pending > context->pt_serv_buf_size ?
- context->pt_serv_buf_size : pending;
- goto read;
- }
-
- if (draining_flow && wsi->rxflow_buffer &&
- wsi->rxflow_pos == wsi->rxflow_len) {
- lwsl_info("%s: %p flow buf: drained\n", __func__, wsi);
- lws_free_set_NULL(wsi->rxflow_buffer);
- /* having drained the rxflow buffer, can rearm POLLIN */
-#ifdef LWS_NO_SERVER
- n =
-#endif
- _lws_rx_flow_control(wsi);
- /* n ignored, needed for NO_SERVER case */
- }
-
- break;
-#ifdef LWS_WITH_CGI
- case LWSCM_CGI: /* we exist to handle a cgi's stdin/out/err data...
- * do the callback on our master wsi
- */
- {
- struct lws_cgi_args args;
-
- if (wsi->cgi_channel >= LWS_STDOUT &&
- !(pollfd->revents & pollfd->events & LWS_POLLIN))
- break;
- if (wsi->cgi_channel == LWS_STDIN &&
- !(pollfd->revents & pollfd->events & LWS_POLLOUT))
- break;
-
- if (wsi->cgi_channel == LWS_STDIN)
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_info("failed at set pollfd\n");
- return 1;
- }
-
- args.ch = wsi->cgi_channel;
- args.stdwsi = &wsi->parent->cgi->stdwsi[0];
- args.hdr_state = wsi->hdr_state;
-
- lwsl_debug("CGI LWS_STDOUT %p mode %d state %d\n",
- wsi->parent, wsi->parent->mode,
- wsi->parent->state);
-
- if (user_callback_handle_rxflow(
- wsi->parent->protocol->callback,
- wsi->parent, LWS_CALLBACK_CGI,
- wsi->parent->user_space,
- (void *)&args, 0))
- return 1;
-
- break;
- }
-#endif
- default:
-#ifdef LWS_NO_CLIENT
- break;
-#else
- if ((pollfd->revents & LWS_POLLOUT) &&
- lws_handle_POLLOUT_event(wsi, pollfd)) {
- lwsl_debug("POLLOUT event closed it\n");
- goto close_and_handled;
- }
-
- n = lws_client_socket_service(context, wsi, pollfd);
- if (n)
- return 1;
- goto handled;
-#endif
- }
-
- n = 0;
- goto handled;
-
-close_and_handled:
- lwsl_debug("%p: Close and handled\n", wsi);
- lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
- /*
- * pollfd may point to something else after the close
- * due to pollfd swapping scheme on delete on some platforms
- * we can't clear revents now because it'd be the wrong guy's revents
- */
- return 1;
-
-handled:
- pollfd->revents = 0;
- return n;
-}
-
-LWS_VISIBLE int
-lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd)
-{
- return lws_service_fd_tsi(context, pollfd, 0);
-}
-
-LWS_VISIBLE int
-lws_service(struct lws_context *context, int timeout_ms)
-{
- return lws_plat_service(context, timeout_ms);
-}
-
-LWS_VISIBLE int
-lws_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
-{
- return _lws_plat_service_tsi(context, timeout_ms, tsi);
-}
-
diff --git a/thirdparty/lws/ssl.c b/thirdparty/lws/ssl.c
deleted file mode 100644
index 0a647b469c..0000000000
--- a/thirdparty/lws/ssl.c
+++ /dev/null
@@ -1,976 +0,0 @@
-/*
- * libwebsockets - small server side websockets and web server implementation
- *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation:
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include "private-libwebsockets.h"
-
-/* workaround for mingw */
-#if !defined(ECONNABORTED)
-#define ECONNABORTED 103
-#endif
-
-int lws_alloc_vfs_file(struct lws_context *context, const char *filename, uint8_t **buf,
- lws_filepos_t *amount)
-{
- lws_filepos_t len;
- lws_fop_flags_t flags = LWS_O_RDONLY;
- lws_fop_fd_t fops_fd = lws_vfs_file_open(
- lws_get_fops(context), filename, &flags);
- int ret = 1;
-
- if (!fops_fd)
- return 1;
-
- len = lws_vfs_get_length(fops_fd);
-
- *buf = lws_malloc((size_t)len, "lws_alloc_vfs_file");
- if (!*buf)
- goto bail;
-
- if (lws_vfs_file_read(fops_fd, amount, *buf, len))
- goto bail;
-
- ret = 0;
-bail:
- lws_vfs_file_close(&fops_fd);
-
- return ret;
-}
-
-#if defined(LWS_WITH_MBEDTLS)
-#if defined(LWS_WITH_ESP32)
-int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
- lws_filepos_t *amount)
-{
- nvs_handle nvh;
- size_t s;
- int n = 0;
-
- ESP_ERROR_CHECK(nvs_open("lws-station", NVS_READWRITE, &nvh));
- if (nvs_get_blob(nvh, filename, NULL, &s) != ESP_OK) {
- n = 1;
- goto bail;
- }
- *buf = lws_malloc(s, "alloc_file");
- if (!*buf) {
- n = 2;
- goto bail;
- }
- if (nvs_get_blob(nvh, filename, (char *)*buf, &s) != ESP_OK) {
- lws_free(*buf);
- n = 1;
- goto bail;
- }
-
- *amount = s;
-
-bail:
- nvs_close(nvh);
-
- return n;
-}
-#else
-int alloc_file(struct lws_context *context, const char *filename, uint8_t **buf,
- lws_filepos_t *amount)
-{
- FILE *f;
- size_t s;
- int n = 0;
-
- f = fopen(filename, "rb");
- if (f == NULL) {
- n = 1;
- goto bail;
- }
-
- if (fseek(f, 0, SEEK_END) != 0) {
- n = 1;
- goto bail;
- }
-
- s = ftell(f);
- if (s == -1) {
- n = 1;
- goto bail;
- }
-
- if (fseek(f, 0, SEEK_SET) != 0) {
- n = 1;
- goto bail;
- }
-
- *buf = lws_malloc(s, "alloc_file");
- if (!*buf) {
- n = 2;
- goto bail;
- }
-
- if (fread(*buf, s, 1, f) != 1) {
- lws_free(*buf);
- n = 1;
- goto bail;
- }
-
- *amount = s;
-
-bail:
- if (f)
- fclose(f);
-
- return n;
-
-}
-#endif
-int alloc_pem_to_der_file(struct lws_context *context, const char *filename, uint8_t **buf,
- lws_filepos_t *amount)
-{
- uint8_t *pem, *p, *q, *end;
- lws_filepos_t len;
- int n;
-
- n = alloc_file(context, filename, &pem, &len);
- if (n)
- return n;
-
- /* trim the first line */
-
- p = pem;
- end = p + len;
- if (strncmp((char *)p, "-----", 5))
- goto bail;
- p += 5;
- while (p < end && *p != '\n' && *p != '-')
- p++;
-
- if (*p != '-')
- goto bail;
-
- while (p < end && *p != '\n')
- p++;
-
- if (p >= end)
- goto bail;
-
- p++;
-
- /* trim the last line */
-
- q = end - 2;
-
- while (q > pem && *q != '\n')
- q--;
-
- if (*q != '\n')
- goto bail;
-
- *q = '\0';
-
- *amount = lws_b64_decode_string((char *)p, (char *)pem, len);
- *buf = pem;
-
- return 0;
-
-bail:
- lws_free(pem);
-
- return 4;
-}
-#endif
-
-int openssl_websocket_private_data_index,
- openssl_SSL_CTX_private_data_index;
-
-int lws_ssl_get_error(struct lws *wsi, int n)
-{
- int m;
-
- if (!wsi->ssl)
- return 99;
-
- m = SSL_get_error(wsi->ssl, n);
- lwsl_debug("%s: %p %d -> %d\n", __func__, wsi->ssl, n, m);
-
- return m;
-}
-
-/* Copies a string describing the code returned by lws_ssl_get_error(),
- * which may also contain system error information in the case of SSL_ERROR_SYSCALL,
- * into buf up to len.
- * Returns a pointer to buf.
- *
- * Note: the lws_ssl_get_error() code is *not* an error code that can be passed
- * to ERR_error_string(),
- *
- * ret is the return value originally passed to lws_ssl_get_error(), needed to disambiguate
- * SYS_ERROR_SYSCALL.
- *
- * See man page for SSL_get_error().
- *
- * Not thread safe, uses strerror()
- */
-char* lws_ssl_get_error_string(int status, int ret, char *buf, size_t len) {
- switch (status) {
- case SSL_ERROR_NONE: return strncpy(buf, "SSL_ERROR_NONE", len);
- case SSL_ERROR_ZERO_RETURN: return strncpy(buf, "SSL_ERROR_ZERO_RETURN", len);
- case SSL_ERROR_WANT_READ: return strncpy(buf, "SSL_ERROR_WANT_READ", len);
- case SSL_ERROR_WANT_WRITE: return strncpy(buf, "SSL_ERROR_WANT_WRITE", len);
- case SSL_ERROR_WANT_CONNECT: return strncpy(buf, "SSL_ERROR_WANT_CONNECT", len);
- case SSL_ERROR_WANT_ACCEPT: return strncpy(buf, "SSL_ERROR_WANT_ACCEPT", len);
- case SSL_ERROR_WANT_X509_LOOKUP: return strncpy(buf, "SSL_ERROR_WANT_X509_LOOKUP", len);
- case SSL_ERROR_SYSCALL:
- switch (ret) {
- case 0:
- lws_snprintf(buf, len, "SSL_ERROR_SYSCALL: EOF");
- return buf;
- case -1:
-#ifndef LWS_PLAT_OPTEE
- lws_snprintf(buf, len, "SSL_ERROR_SYSCALL: %s", strerror(errno));
-#else
- lws_snprintf(buf, len, "SSL_ERROR_SYSCALL: %d", errno);
-#endif
- return buf;
- default:
- return strncpy(buf, "SSL_ERROR_SYSCALL", len);
- }
- case SSL_ERROR_SSL: return "SSL_ERROR_SSL";
- default: return "SSL_ERROR_UNKNOWN";
- }
-}
-
-void
-lws_ssl_elaborate_error(void)
-{
-#if defined(LWS_WITH_MBEDTLS)
-#else
- char buf[256];
- u_long err;
-
- while ((err = ERR_get_error()) != 0) {
- ERR_error_string_n(err, buf, sizeof(buf));
- lwsl_info("*** %s\n", buf);
- }
-#endif
-}
-
-#if !defined(LWS_WITH_MBEDTLS)
-
-static int
-lws_context_init_ssl_pem_passwd_cb(char * buf, int size, int rwflag, void *userdata)
-{
- struct lws_context_creation_info * info =
- (struct lws_context_creation_info *)userdata;
-
- strncpy(buf, info->ssl_private_key_password, size);
- buf[size - 1] = '\0';
-
- return strlen(buf);
-}
-
-void
-lws_ssl_bind_passphrase(SSL_CTX *ssl_ctx, struct lws_context_creation_info *info)
-{
- if (!info->ssl_private_key_password)
- return;
- /*
- * password provided, set ssl callback and user data
- * for checking password which will be trigered during
- * SSL_CTX_use_PrivateKey_file function
- */
- SSL_CTX_set_default_passwd_cb_userdata(ssl_ctx, (void *)info);
- SSL_CTX_set_default_passwd_cb(ssl_ctx, lws_context_init_ssl_pem_passwd_cb);
-}
-#endif
-
-int
-lws_context_init_ssl_library(struct lws_context_creation_info *info)
-{
-#ifdef USE_WOLFSSL
-#ifdef USE_OLD_CYASSL
- lwsl_info(" Compiled with CyaSSL support\n");
-#else
- lwsl_info(" Compiled with wolfSSL support\n");
-#endif
-#else
-#if defined(LWS_WITH_BORINGSSL)
- lwsl_info(" Compiled with BoringSSL support\n");
-#else
-#if defined(LWS_WITH_MBEDTLS)
- lwsl_info(" Compiled with MbedTLS support\n");
-#else
- lwsl_info(" Compiled with OpenSSL support\n");
-#endif
-#endif
-#endif
- if (!lws_check_opt(info->options, LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT)) {
- lwsl_info(" SSL disabled: no LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT\n");
- return 0;
- }
-
- /* basic openssl init */
-
- lwsl_info("Doing SSL library init\n");
-
-#if !defined(LWS_WITH_MBEDTLS)
- SSL_library_init();
- OpenSSL_add_all_algorithms();
- SSL_load_error_strings();
-
- openssl_websocket_private_data_index =
- SSL_get_ex_new_index(0, "lws", NULL, NULL, NULL);
-
- openssl_SSL_CTX_private_data_index = SSL_CTX_get_ex_new_index(0,
- NULL, NULL, NULL, NULL);
-#endif
-
- return 0;
-}
-
-LWS_VISIBLE void
-lws_ssl_destroy(struct lws_vhost *vhost)
-{
- if (!lws_check_opt(vhost->context->options,
- LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT))
- return;
-
- if (vhost->ssl_ctx)
- SSL_CTX_free(vhost->ssl_ctx);
- if (!vhost->user_supplied_ssl_ctx && vhost->ssl_client_ctx)
- SSL_CTX_free(vhost->ssl_client_ctx);
-
-#if defined(LWS_WITH_MBEDTLS)
- if (vhost->x509_client_CA)
- X509_free(vhost->x509_client_CA);
-#else
-// after 1.1.0 no need
-#if (OPENSSL_VERSION_NUMBER < 0x10100000)
-// <= 1.0.1f = old api, 1.0.1g+ = new api
-#if (OPENSSL_VERSION_NUMBER <= 0x1000106f) || defined(USE_WOLFSSL)
- ERR_remove_state(0);
-#else
-#if OPENSSL_VERSION_NUMBER >= 0x1010005f && \
- !defined(LIBRESSL_VERSION_NUMBER) && \
- !defined(OPENSSL_IS_BORINGSSL)
- ERR_remove_thread_state();
-#else
- ERR_remove_thread_state(NULL);
-#endif
-#endif
- // after 1.1.0 no need
-#if (OPENSSL_VERSION_NUMBER >= 0x10002000) && (OPENSSL_VERSION_NUMBER <= 0x10100000)
- SSL_COMP_free_compression_methods();
-#endif
- ERR_free_strings();
- EVP_cleanup();
- CRYPTO_cleanup_all_ex_data();
-#endif
-#endif
-}
-
-int
-lws_ssl_anybody_has_buffered_read_tsi(struct lws_context *context, int tsi)
-{
- struct lws_context_per_thread *pt = &context->pt[tsi];
- struct lws *wsi, *wsi_next;
-
- wsi = pt->pending_read_list;
- while (wsi) {
- wsi_next = wsi->pending_read_list_next;
- pt->fds[wsi->position_in_fds_table].revents |=
- pt->fds[wsi->position_in_fds_table].events & LWS_POLLIN;
- if (pt->fds[wsi->position_in_fds_table].revents & LWS_POLLIN)
- return 1;
-
- wsi = wsi_next;
- }
-
- return 0;
-}
-
-LWS_VISIBLE void
-lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
-
- if (!wsi->pending_read_list_prev &&
- !wsi->pending_read_list_next &&
- pt->pending_read_list != wsi)
- /* we are not on the list */
- return;
-
- /* point previous guy's next to our next */
- if (!wsi->pending_read_list_prev)
- pt->pending_read_list = wsi->pending_read_list_next;
- else
- wsi->pending_read_list_prev->pending_read_list_next =
- wsi->pending_read_list_next;
-
- /* point next guy's previous to our previous */
- if (wsi->pending_read_list_next)
- wsi->pending_read_list_next->pending_read_list_prev =
- wsi->pending_read_list_prev;
-
- wsi->pending_read_list_prev = NULL;
- wsi->pending_read_list_next = NULL;
-}
-
-LWS_VISIBLE int
-lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
-{
- struct lws_context *context = wsi->context;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- int n = 0, m;
-
- if (!wsi->ssl)
- return lws_ssl_capable_read_no_ssl(wsi, buf, len);
-
- lws_stats_atomic_bump(context, pt, LWSSTATS_C_API_READ, 1);
-
- errno = 0;
- n = SSL_read(wsi->ssl, buf, len);
-#if defined(LWS_WITH_ESP32)
- if (!n && errno == ENOTCONN) {
- lwsl_debug("%p: SSL_read ENOTCONN\n", wsi);
- return LWS_SSL_CAPABLE_ERROR;
- }
-#endif
-#if defined(LWS_WITH_STATS)
- if (!wsi->seen_rx) {
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_MS_SSL_RX_DELAY,
- time_in_microseconds() - wsi->accept_start_us);
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_SSL_CONNS_HAD_RX, 1);
- wsi->seen_rx = 1;
- }
-#endif
-
-
- lwsl_debug("%p: SSL_read says %d\n", wsi, n);
- /* manpage: returning 0 means connection shut down */
- if (!n) {
- wsi->socket_is_permanently_unusable = 1;
-
- return LWS_SSL_CAPABLE_ERROR;
- }
-
- if (n < 0) {
- m = lws_ssl_get_error(wsi, n);
- lwsl_debug("%p: ssl err %d errno %d\n", wsi, m, errno);
- if (m == SSL_ERROR_ZERO_RETURN ||
- m == SSL_ERROR_SYSCALL)
- return LWS_SSL_CAPABLE_ERROR;
-
- if (SSL_want_read(wsi->ssl)) {
- lwsl_debug("%s: WANT_READ\n", __func__);
- lwsl_debug("%p: LWS_SSL_CAPABLE_MORE_SERVICE\n", wsi);
- return LWS_SSL_CAPABLE_MORE_SERVICE;
- }
- if (SSL_want_write(wsi->ssl)) {
- lwsl_debug("%s: WANT_WRITE\n", __func__);
- lwsl_debug("%p: LWS_SSL_CAPABLE_MORE_SERVICE\n", wsi);
- return LWS_SSL_CAPABLE_MORE_SERVICE;
- }
- wsi->socket_is_permanently_unusable = 1;
-
- return LWS_SSL_CAPABLE_ERROR;
- }
-
- lws_stats_atomic_bump(context, pt, LWSSTATS_B_READ, n);
-
- if (wsi->vhost)
- wsi->vhost->conn_stats.rx += n;
-
- lws_restart_ws_ping_pong_timer(wsi);
-
- /*
- * if it was our buffer that limited what we read,
- * check if SSL has additional data pending inside SSL buffers.
- *
- * Because these won't signal at the network layer with POLLIN
- * and if we don't realize, this data will sit there forever
- */
- if (n != len)
- goto bail;
- if (!wsi->ssl)
- goto bail;
-
- if (!SSL_pending(wsi->ssl))
- goto bail;
-
- if (wsi->pending_read_list_next)
- return n;
- if (wsi->pending_read_list_prev)
- return n;
- if (pt->pending_read_list == wsi)
- return n;
-
- /* add us to the linked list of guys with pending ssl */
- if (pt->pending_read_list)
- pt->pending_read_list->pending_read_list_prev = wsi;
-
- wsi->pending_read_list_next = pt->pending_read_list;
- wsi->pending_read_list_prev = NULL;
- pt->pending_read_list = wsi;
-
- return n;
-bail:
- lws_ssl_remove_wsi_from_buffered_list(wsi);
-
- return n;
-}
-
-LWS_VISIBLE int
-lws_ssl_pending(struct lws *wsi)
-{
- if (!wsi->ssl)
- return 0;
-
- return SSL_pending(wsi->ssl);
-}
-
-LWS_VISIBLE int
-lws_ssl_capable_write(struct lws *wsi, unsigned char *buf, int len)
-{
- int n, m;
-
- if (!wsi->ssl)
- return lws_ssl_capable_write_no_ssl(wsi, buf, len);
-
- n = SSL_write(wsi->ssl, buf, len);
- if (n > 0)
- return n;
-
- m = lws_ssl_get_error(wsi, n);
- if (m != SSL_ERROR_SYSCALL) {
-
- if (SSL_want_read(wsi->ssl)) {
- lwsl_notice("%s: want read\n", __func__);
-
- return LWS_SSL_CAPABLE_MORE_SERVICE;
- }
-
- if (SSL_want_write(wsi->ssl)) {
- lws_set_blocking_send(wsi);
-
- lwsl_notice("%s: want write\n", __func__);
-
- return LWS_SSL_CAPABLE_MORE_SERVICE;
- }
- }
-
- lwsl_debug("%s failed: %s\n",__func__, ERR_error_string(m, NULL));
- lws_ssl_elaborate_error();
-
- wsi->socket_is_permanently_unusable = 1;
-
- return LWS_SSL_CAPABLE_ERROR;
-}
-
-static int
-lws_gate_accepts(struct lws_context *context, int on)
-{
- struct lws_vhost *v = context->vhost_list;
-
- lwsl_info("gating accepts %d\n", on);
- context->ssl_gate_accepts = !on;
-#if defined(LWS_WITH_STATS)
- context->updated = 1;
-#endif
-
- while (v) {
- if (v->use_ssl && v->lserv_wsi) /* gate ability to accept incoming connections */
- if (lws_change_pollfd(v->lserv_wsi, (LWS_POLLIN) * !on,
- (LWS_POLLIN) * on))
- lwsl_info("Unable to set accept POLLIN %d\n", on);
-
- v = v->vhost_next;
- }
-
- return 0;
-}
-
-void
-lws_ssl_info_callback(const SSL *ssl, int where, int ret)
-{
- struct lws *wsi;
- struct lws_context *context;
- struct lws_ssl_info si;
-
- context = (struct lws_context *)SSL_CTX_get_ex_data(
- SSL_get_SSL_CTX(ssl),
- openssl_SSL_CTX_private_data_index);
- if (!context)
- return;
- wsi = wsi_from_fd(context, SSL_get_fd(ssl));
- if (!wsi)
- return;
-
- if (!(where & wsi->vhost->ssl_info_event_mask))
- return;
-
- si.where = where;
- si.ret = ret;
-
- if (user_callback_handle_rxflow(wsi->protocol->callback,
- wsi, LWS_CALLBACK_SSL_INFO,
- wsi->user_space, &si, 0))
- lws_set_timeout(wsi, PENDING_TIMEOUT_KILLED_BY_SSL_INFO, -1);
-}
-
-
-LWS_VISIBLE int
-lws_ssl_close(struct lws *wsi)
-{
- lws_sockfd_type n;
-
- if (!wsi->ssl)
- return 0; /* not handled */
-
-#if defined (LWS_HAVE_SSL_SET_INFO_CALLBACK)
- /* kill ssl callbacks, becausse we will remove the fd from the
- * table linking it to the wsi
- */
- if (wsi->vhost->ssl_info_event_mask)
- SSL_set_info_callback(wsi->ssl, NULL);
-#endif
-
- n = SSL_get_fd(wsi->ssl);
- if (!wsi->socket_is_permanently_unusable)
- SSL_shutdown(wsi->ssl);
- compatible_close(n);
- SSL_free(wsi->ssl);
- wsi->ssl = NULL;
-
- if (wsi->context->simultaneous_ssl_restriction &&
- wsi->context->simultaneous_ssl-- ==
- wsi->context->simultaneous_ssl_restriction)
- /* we made space and can do an accept */
- lws_gate_accepts(wsi->context, 1);
-#if defined(LWS_WITH_STATS)
- wsi->context->updated = 1;
-#endif
-
- return 1; /* handled */
-}
-
-/* leave all wsi close processing to the caller */
-
-LWS_VISIBLE int
-lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
-{
- struct lws_context *context = wsi->context;
- struct lws_vhost *vh;
- struct lws_context_per_thread *pt = &context->pt[(int)wsi->tsi];
- int n, m;
-#if !defined(USE_WOLFSSL) && !defined(LWS_WITH_MBEDTLS)
- BIO *bio;
-#endif
- char buf[256];
-
- (void)buf;
-
- if (!LWS_SSL_ENABLED(wsi->vhost))
- return 0;
-
- switch (wsi->mode) {
- case LWSCM_SSL_INIT:
- case LWSCM_SSL_INIT_RAW:
- if (wsi->ssl)
- lwsl_err("%s: leaking ssl\n", __func__);
- if (accept_fd == LWS_SOCK_INVALID)
- assert(0);
- if (context->simultaneous_ssl_restriction &&
- context->simultaneous_ssl >= context->simultaneous_ssl_restriction) {
- lwsl_notice("unable to deal with SSL connection\n");
- return 1;
- }
- errno = 0;
- wsi->ssl = SSL_new(wsi->vhost->ssl_ctx);
- if (wsi->ssl == NULL) {
- lwsl_err("SSL_new failed: %d (errno %d)\n",
- lws_ssl_get_error(wsi, 0), errno);
-
- lws_ssl_elaborate_error();
- if (accept_fd != LWS_SOCK_INVALID)
- compatible_close(accept_fd);
- goto fail;
- }
-#if defined (LWS_HAVE_SSL_SET_INFO_CALLBACK)
- if (wsi->vhost->ssl_info_event_mask)
- SSL_set_info_callback(wsi->ssl, lws_ssl_info_callback);
-#endif
- if (context->simultaneous_ssl_restriction &&
- ++context->simultaneous_ssl == context->simultaneous_ssl_restriction)
- /* that was the last allowed SSL connection */
- lws_gate_accepts(context, 0);
-#if defined(LWS_WITH_STATS)
- context->updated = 1;
-#endif
-
-#if !defined(LWS_WITH_MBEDTLS)
- SSL_set_ex_data(wsi->ssl,
- openssl_websocket_private_data_index, wsi);
-#endif
- SSL_set_fd(wsi->ssl, accept_fd);
-
-#ifdef USE_WOLFSSL
-#ifdef USE_OLD_CYASSL
- CyaSSL_set_using_nonblock(wsi->ssl, 1);
-#else
- wolfSSL_set_using_nonblock(wsi->ssl, 1);
-#endif
-#else
-#if defined(LWS_WITH_MBEDTLS)
- lws_plat_set_socket_options(wsi->vhost, accept_fd);
-#else
- SSL_set_mode(wsi->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
- bio = SSL_get_rbio(wsi->ssl);
- if (bio)
- BIO_set_nbio(bio, 1); /* nonblocking */
- else
- lwsl_notice("NULL rbio\n");
- bio = SSL_get_wbio(wsi->ssl);
- if (bio)
- BIO_set_nbio(bio, 1); /* nonblocking */
- else
- lwsl_notice("NULL rbio\n");
-#endif
-#endif
-
- /*
- * we are not accepted yet, but we need to enter ourselves
- * as a live connection. That way we can retry when more
- * pieces come if we're not sorted yet
- */
-
- if (wsi->mode == LWSCM_SSL_INIT)
- wsi->mode = LWSCM_SSL_ACK_PENDING;
- else
- wsi->mode = LWSCM_SSL_ACK_PENDING_RAW;
-
- if (insert_wsi_socket_into_fds(context, wsi)) {
- lwsl_err("%s: failed to insert into fds\n", __func__);
- goto fail;
- }
-
- lws_set_timeout(wsi, PENDING_TIMEOUT_SSL_ACCEPT,
- context->timeout_secs);
-
- lwsl_debug("inserted SSL accept into fds, trying SSL_accept\n");
-
- /* fallthru */
-
- case LWSCM_SSL_ACK_PENDING:
- case LWSCM_SSL_ACK_PENDING_RAW:
- if (lws_change_pollfd(wsi, LWS_POLLOUT, 0)) {
- lwsl_err("%s: lws_change_pollfd failed\n", __func__);
- goto fail;
- }
-
- lws_latency_pre(context, wsi);
-
- if (wsi->vhost->allow_non_ssl_on_ssl_port) {
-
- n = recv(wsi->desc.sockfd, (char *)pt->serv_buf,
- context->pt_serv_buf_size, MSG_PEEK);
-
- /*
- * optionally allow non-SSL connect on SSL listening socket
- * This is disabled by default, if enabled it goes around any
- * SSL-level access control (eg, client-side certs) so leave
- * it disabled unless you know it's not a problem for you
- */
-
- if (n >= 1 && pt->serv_buf[0] >= ' ') {
- /*
- * TLS content-type for Handshake is 0x16, and
- * for ChangeCipherSpec Record, it's 0x14
- *
- * A non-ssl session will start with the HTTP
- * method in ASCII. If we see it's not a legit
- * SSL handshake kill the SSL for this
- * connection and try to handle as a HTTP
- * connection upgrade directly.
- */
- wsi->use_ssl = 0;
-
- SSL_shutdown(wsi->ssl);
- SSL_free(wsi->ssl);
- wsi->ssl = NULL;
- if (lws_check_opt(context->options,
- LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS))
- wsi->redirect_to_https = 1;
- goto accepted;
- }
- if (!n) /*
- * connection is gone, or nothing to read
- * if it's gone, we will timeout on
- * PENDING_TIMEOUT_SSL_ACCEPT
- */
- break;
- if (n < 0 && (LWS_ERRNO == LWS_EAGAIN ||
- LWS_ERRNO == LWS_EWOULDBLOCK)) {
- /*
- * well, we get no way to know ssl or not
- * so go around again waiting for something
- * to come and give us a hint, or timeout the
- * connection.
- */
- m = SSL_ERROR_WANT_READ;
- goto go_again;
- }
- }
-
- /* normal SSL connection processing path */
-
-#if defined(LWS_WITH_STATS)
- if (!wsi->accept_start_us)
- wsi->accept_start_us = time_in_microseconds();
-#endif
- errno = 0;
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN, 1);
- n = SSL_accept(wsi->ssl);
- lws_latency(context, wsi,
- "SSL_accept LWSCM_SSL_ACK_PENDING\n", n, n == 1);
- lwsl_info("SSL_accept says %d\n", n);
- if (n == 1)
- goto accepted;
-
- m = lws_ssl_get_error(wsi, n);
-
-#if defined(LWS_WITH_MBEDTLS)
- if (m == SSL_ERROR_SYSCALL && errno == 11)
- m = SSL_ERROR_WANT_READ;
-#endif
- if (m == SSL_ERROR_SYSCALL || m == SSL_ERROR_SSL)
- goto failed;
-
-go_again:
- if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->ssl)) {
- if (lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
- lwsl_info("%s: WANT_READ change_pollfd failed\n", __func__);
- goto fail;
- }
-
- lwsl_info("SSL_ERROR_WANT_READ\n");
- break;
- }
- if (m == SSL_ERROR_WANT_WRITE || SSL_want_write(wsi->ssl)) {
- lwsl_debug("%s: WANT_WRITE\n", __func__);
-
- if (lws_change_pollfd(wsi, 0, LWS_POLLOUT)) {
- lwsl_info("%s: WANT_WRITE change_pollfd failed\n", __func__);
- goto fail;
- }
-
- break;
- }
-failed:
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_SSL_CONNECTIONS_FAILED, 1);
- lwsl_info("SSL_accept failed socket %u: %s\n", wsi->desc.sockfd,
- lws_ssl_get_error_string(m, n, buf, sizeof(buf)));
- lws_ssl_elaborate_error();
- goto fail;
-
-accepted:
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED, 1);
-#if defined(LWS_WITH_STATS)
- lws_stats_atomic_bump(wsi->context, pt,
- LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY,
- time_in_microseconds() - wsi->accept_start_us);
- wsi->accept_start_us = time_in_microseconds();
-#endif
-
- /* adapt our vhost to match the SNI SSL_CTX that was chosen */
- vh = context->vhost_list;
- while (vh) {
- if (!vh->being_destroyed &&
- vh->ssl_ctx == SSL_get_SSL_CTX(wsi->ssl)) {
- lwsl_info("setting wsi to vh %s\n", vh->name);
- wsi->vhost = vh;
- break;
- }
- vh = vh->vhost_next;
- }
-
- /* OK, we are accepted... give him some time to negotiate */
- lws_set_timeout(wsi, PENDING_TIMEOUT_ESTABLISH_WITH_SERVER,
- context->timeout_secs);
-
- if (wsi->mode == LWSCM_SSL_ACK_PENDING_RAW)
- wsi->mode = LWSCM_RAW;
- else
- wsi->mode = LWSCM_HTTP_SERVING;
-#if defined(LWS_WITH_HTTP2)
- if (lws_h2_configure_if_upgraded(wsi))
- goto fail;
-#endif
- lwsl_debug("accepted new SSL conn\n");
- break;
- }
-
- return 0;
-
-fail:
- return 1;
-}
-
-void
-lws_ssl_SSL_CTX_destroy(struct lws_vhost *vhost)
-{
- if (vhost->ssl_ctx)
- SSL_CTX_free(vhost->ssl_ctx);
-
- if (!vhost->user_supplied_ssl_ctx && vhost->ssl_client_ctx)
- SSL_CTX_free(vhost->ssl_client_ctx);
-}
-
-void
-lws_ssl_context_destroy(struct lws_context *context)
-{
-
-#if !defined(LWS_WITH_MBEDTLS)
-
-// after 1.1.0 no need
-#if (OPENSSL_VERSION_NUMBER < 0x10100000)
-// <= 1.0.1f = old api, 1.0.1g+ = new api
-#if (OPENSSL_VERSION_NUMBER <= 0x1000106f) || defined(USE_WOLFSSL)
- ERR_remove_state(0);
-#else
-#if OPENSSL_VERSION_NUMBER >= 0x1010005f && \
- !defined(LIBRESSL_VERSION_NUMBER) && \
- !defined(OPENSSL_IS_BORINGSSL)
- ERR_remove_thread_state();
-#else
- ERR_remove_thread_state(NULL);
-#endif
-#endif
- // after 1.1.0 no need
-#if (OPENSSL_VERSION_NUMBER >= 0x10002000) && (OPENSSL_VERSION_NUMBER <= 0x10100000)
- SSL_COMP_free_compression_methods();
-#endif
- ERR_free_strings();
- EVP_cleanup();
- CRYPTO_cleanup_all_ex_data();
-#endif
-#endif
-}
diff --git a/thirdparty/mbedtls/1453.diff b/thirdparty/mbedtls/1453.diff
new file mode 100644
index 0000000000..acc3654cd4
--- /dev/null
+++ b/thirdparty/mbedtls/1453.diff
@@ -0,0 +1,120 @@
+diff --git a/thirdparty/mbedtls/library/entropy_poll.c b/thirdparty/mbedtls/library/entropy_poll.c
+index 67900c46c8..cefe882d2a 100644
+--- a/thirdparty/mbedtls/library/entropy_poll.c
++++ b/thirdparty/mbedtls/library/entropy_poll.c
+@@ -54,28 +54,43 @@
+ #define _WIN32_WINNT 0x0400
+ #endif
+ #include <windows.h>
+-#include <wincrypt.h>
++#include <bcrypt.h>
++#if defined(_MSC_VER) && _MSC_VER <= 1600
++/* Visual Studio 2010 and earlier issue a warning when both <stdint.h> and
++ * <intsafe.h> are included, as they redefine a number of <TYPE>_MAX constants.
++ * These constants are guaranteed to be the same, though, so we suppress the
++ * warning when including intsafe.h.
++ */
++#pragma warning( push )
++#pragma warning( disable : 4005 )
++#endif
++#include <intsafe.h>
++#if defined(_MSC_VER) && _MSC_VER <= 1600
++#pragma warning( pop )
++#endif
+
+ int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len,
+ size_t *olen )
+ {
+- HCRYPTPROV provider;
++ ULONG len_as_ulong = 0;
+ ((void) data);
+ *olen = 0;
+
+- if( CryptAcquireContext( &provider, NULL, NULL,
+- PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) == FALSE )
++ /*
++ * BCryptGenRandom takes ULONG for size, which is smaller than size_t on
++ * 64-bit Windows platforms. Ensure len's value can be safely converted into
++ * a ULONG.
++ */
++ if ( FAILED( SizeTToULong( len, &len_as_ulong ) ) )
+ {
+ return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+ }
+
+- if( CryptGenRandom( provider, (DWORD) len, output ) == FALSE )
++ if ( !BCRYPT_SUCCESS( BCryptGenRandom( NULL, output, len_as_ulong, BCRYPT_USE_SYSTEM_PREFERRED_RNG ) ) )
+ {
+- CryptReleaseContext( provider, 0 );
+ return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+ }
+
+- CryptReleaseContext( provider, 0 );
+ *olen = len;
+
+ return( 0 );
+diff --git a/thirdparty/mbedtls/library/x509_crt.c b/thirdparty/mbedtls/library/x509_crt.c
+index afff4e18bf..7960fa1a1a 100644
+--- a/thirdparty/mbedtls/library/x509_crt.c
++++ b/thirdparty/mbedtls/library/x509_crt.c
+@@ -64,6 +64,19 @@
+
+ #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
+ #include <windows.h>
++#if defined(_MSC_VER) && _MSC_VER <= 1600
++/* Visual Studio 2010 and earlier issue a warning when both <stdint.h> and
++ * <intsafe.h> are included, as they redefine a number of <TYPE>_MAX constants.
++ * These constants are guaranteed to be the same, though, so we suppress the
++ * warning when including intsafe.h.
++ */
++#pragma warning( push )
++#pragma warning( disable : 4005 )
++#endif
++#include <intsafe.h>
++#if defined(_MSC_VER) && _MSC_VER <= 1600
++#pragma warning( pop )
++#endif
+ #else
+ #include <time.h>
+ #endif
+@@ -1130,6 +1143,7 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
+ char filename[MAX_PATH];
+ char *p;
+ size_t len = strlen( path );
++ int lengthAsInt = 0;
+
+ WIN32_FIND_DATAW file_data;
+ HANDLE hFind;
+@@ -1144,7 +1158,18 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
+ p = filename + len;
+ filename[len++] = '*';
+
+- w_ret = MultiByteToWideChar( CP_ACP, 0, filename, (int)len, szDir,
++ if ( FAILED ( SizeTToInt( len, &lengthAsInt ) ) )
++ return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
++
++ /*
++ * Note this function uses the code page CP_ACP, and assumes the incoming
++ * string is encoded in ANSI, before translating it into Unicode. If the
++ * incoming string were changed to be UTF-8, then the length check needs to
++ * change to check the number of characters, not the number of bytes, in the
++ * incoming string are less than MAX_PATH to avoid a buffer overrun with
++ * MultiByteToWideChar().
++ */
++ w_ret = MultiByteToWideChar( CP_ACP, 0, filename, lengthAsInt, szDir,
+ MAX_PATH - 3 );
+ if( w_ret == 0 )
+ return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
+@@ -1161,8 +1186,11 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
+ if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
+ continue;
+
++ if ( FAILED( SizeTToInt( wcslen( file_data.cFileName ), &lengthAsInt ) ) )
++ return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
++
+ w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
+- lstrlenW( file_data.cFileName ),
++ lengthAsInt,
+ p, (int) len - 1,
+ NULL, NULL );
+ if( w_ret == 0 )
diff --git a/thirdparty/mbedtls/LICENSE b/thirdparty/mbedtls/LICENSE
new file mode 100644
index 0000000000..546a8e631f
--- /dev/null
+++ b/thirdparty/mbedtls/LICENSE
@@ -0,0 +1,2 @@
+Unless specifically indicated otherwise in a file, files are licensed
+under the Apache 2.0 license, as can be found in: apache-2.0.txt
diff --git a/thirdparty/mbedtls/apache-2.0.txt b/thirdparty/mbedtls/apache-2.0.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/thirdparty/mbedtls/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ 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.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/thirdparty/mbedtls/include/mbedtls/asn1.h b/thirdparty/mbedtls/include/mbedtls/asn1.h
index fde328a128..96c1c9a8ab 100644
--- a/thirdparty/mbedtls/include/mbedtls/asn1.h
+++ b/thirdparty/mbedtls/include/mbedtls/asn1.h
@@ -88,6 +88,21 @@
#define MBEDTLS_ASN1_PRIMITIVE 0x00
#define MBEDTLS_ASN1_CONSTRUCTED 0x20
#define MBEDTLS_ASN1_CONTEXT_SPECIFIC 0x80
+
+/*
+ * Bit masks for each of the components of an ASN.1 tag as specified in
+ * ITU X.690 (08/2015), section 8.1 "General rules for encoding",
+ * paragraph 8.1.2.2:
+ *
+ * Bit 8 7 6 5 1
+ * +-------+-----+------------+
+ * | Class | P/C | Tag number |
+ * +-------+-----+------------+
+ */
+#define MBEDTLS_ASN1_TAG_CLASS_MASK 0xC0
+#define MBEDTLS_ASN1_TAG_PC_MASK 0x20
+#define MBEDTLS_ASN1_TAG_VALUE_MASK 0x1F
+
/* \} name */
/* \} addtogroup asn1_module */
diff --git a/thirdparty/mbedtls/include/mbedtls/ccm.h b/thirdparty/mbedtls/include/mbedtls/ccm.h
index 5a9ee4a1cd..630b7fdf6c 100644
--- a/thirdparty/mbedtls/include/mbedtls/ccm.h
+++ b/thirdparty/mbedtls/include/mbedtls/ccm.h
@@ -105,7 +105,7 @@ void mbedtls_ccm_free( mbedtls_ccm_context *ctx );
* Must be at least \p length Bytes wide.
* \param tag The buffer holding the tag.
* \param tag_len The length of the tag to generate in Bytes:
- * 4, 6, 8, 10, 14 or 16.
+ * 4, 6, 8, 10, 12, 14 or 16.
*
* \note The tag is written to a separate buffer. To concatenate
* the \p tag with the \p output, as done in <em>RFC-3610:
@@ -131,10 +131,13 @@ int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
* \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
* \param add The additional data field.
* \param add_len The length of additional data in Bytes.
+ * Must be less than 2^16 - 2^8.
* \param input The buffer holding the input data.
* \param output The buffer holding the output data.
+ * Must be at least \p length Bytes wide.
* \param tag The buffer holding the tag.
* \param tag_len The length of the tag in Bytes.
+ * 4, 6, 8, 10, 12, 14 or 16.
*
* \return 0 if successful and authenticated, or
* #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match.
diff --git a/thirdparty/mbedtls/include/mbedtls/check_config.h b/thirdparty/mbedtls/include/mbedtls/check_config.h
index 1143aa2687..be80332963 100644
--- a/thirdparty/mbedtls/include/mbedtls/check_config.h
+++ b/thirdparty/mbedtls/include/mbedtls/check_config.h
@@ -78,6 +78,10 @@
#error "MBEDTLS_DHM_C defined, but not all prerequisites"
#endif
+#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT) && !defined(MBEDTLS_SSL_TRUNCATED_HMAC)
+#error "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT defined, but not all prerequisites"
+#endif
+
#if defined(MBEDTLS_CMAC_C) && \
!defined(MBEDTLS_AES_C) && !defined(MBEDTLS_DES_C)
#error "MBEDTLS_CMAC_C defined, but not all prerequisites"
diff --git a/thirdparty/mbedtls/include/mbedtls/config.h b/thirdparty/mbedtls/include/mbedtls/config.h
index 79eedffddd..b5905ef9d0 100644
--- a/thirdparty/mbedtls/include/mbedtls/config.h
+++ b/thirdparty/mbedtls/include/mbedtls/config.h
@@ -1049,7 +1049,8 @@
/**
* \def MBEDTLS_RSA_NO_CRT
*
- * Do not use the Chinese Remainder Theorem for the RSA private operation.
+ * Do not use the Chinese Remainder Theorem
+ * for the RSA private operation.
*
* Uncomment this macro to disable the use of CRT in RSA.
*
@@ -1412,6 +1413,30 @@
#define MBEDTLS_SSL_TRUNCATED_HMAC
/**
+ * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
+ *
+ * Fallback to old (pre-2.7), non-conforming implementation of the truncated
+ * HMAC extension which also truncates the HMAC key. Note that this option is
+ * only meant for a transitory upgrade period and is likely to be removed in
+ * a future version of the library.
+ *
+ * \warning The old implementation is non-compliant and has a security weakness
+ * (2^80 brute force attack on the HMAC key used for a single,
+ * uninterrupted connection). This should only be enabled temporarily
+ * when (1) the use of truncated HMAC is essential in order to save
+ * bandwidth, and (2) the peer is an Mbed TLS stack that doesn't use
+ * the fixed implementation yet (pre-2.7).
+ *
+ * \deprecated This option is deprecated and will likely be removed in a
+ * future version of Mbed TLS.
+ *
+ * Uncomment to fallback to old, non-compliant truncated HMAC implementation.
+ *
+ * Requires: MBEDTLS_SSL_TRUNCATED_HMAC
+ */
+//#define MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
+
+/**
* \def MBEDTLS_THREADING_ALT
*
* Provide your own alternate threading implementation.
@@ -1517,6 +1542,9 @@
*
* \note Currently compression can't be used with DTLS.
*
+ * \deprecated This feature is deprecated and will be removed
+ * in the next major revision of the library.
+ *
* Used in: library/ssl_tls.c
* library/ssl_cli.c
* library/ssl_srv.c
diff --git a/thirdparty/mbedtls/include/mbedtls/dhm.h b/thirdparty/mbedtls/include/mbedtls/dhm.h
index da2e66b111..00fafd8d16 100644
--- a/thirdparty/mbedtls/include/mbedtls/dhm.h
+++ b/thirdparty/mbedtls/include/mbedtls/dhm.h
@@ -372,7 +372,7 @@ MBEDTLS_DEPRECATED typedef char const * mbedtls_deprecated_constant_t;
* in <em>RFC-5114: Additional Diffie-Hellman Groups for Use with
* IETF Standards</em>.
*/
-#define MBEDTLS_DHM_RFC5114_MODP_P \
+#define MBEDTLS_DHM_RFC5114_MODP_2048_P \
MBEDTLS_DEPRECATED_STRING_CONSTANT( \
"AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1" \
"B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15" \
diff --git a/thirdparty/mbedtls/include/mbedtls/md2.h b/thirdparty/mbedtls/include/mbedtls/md2.h
index 2ff3f171a3..0fd8b5afcc 100644
--- a/thirdparty/mbedtls/include/mbedtls/md2.h
+++ b/thirdparty/mbedtls/include/mbedtls/md2.h
@@ -39,11 +39,6 @@
#define MBEDTLS_ERR_MD2_HW_ACCEL_FAILED -0x002B /**< MD2 hardware accelerator failed */
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
-
#if !defined(MBEDTLS_MD2_ALT)
// Regular implementation
//
@@ -187,11 +182,7 @@ int mbedtls_internal_md2_process( mbedtls_md2_context *ctx );
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md2_starts(
- mbedtls_md2_context *ctx )
-{
- mbedtls_md2_starts_ret( ctx );
-}
+MBEDTLS_DEPRECATED void mbedtls_md2_starts( mbedtls_md2_context *ctx );
/**
* \brief MD2 process buffer
@@ -207,13 +198,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md2_starts(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md2_update(
- mbedtls_md2_context *ctx,
- const unsigned char *input,
- size_t ilen )
-{
- mbedtls_md2_update_ret( ctx, input, ilen );
-}
+MBEDTLS_DEPRECATED void mbedtls_md2_update( mbedtls_md2_context *ctx,
+ const unsigned char *input,
+ size_t ilen );
/**
* \brief MD2 final digest
@@ -228,12 +215,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md2_update(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md2_finish(
- mbedtls_md2_context *ctx,
- unsigned char output[16] )
-{
- mbedtls_md2_finish_ret( ctx, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_md2_finish( mbedtls_md2_context *ctx,
+ unsigned char output[16] );
/**
* \brief MD2 process data block (internal use only)
@@ -247,11 +230,7 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md2_finish(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md2_process(
- mbedtls_md2_context *ctx )
-{
- mbedtls_internal_md2_process( ctx );
-}
+MBEDTLS_DEPRECATED void mbedtls_md2_process( mbedtls_md2_context *ctx );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -304,12 +283,9 @@ int mbedtls_md2_ret( const unsigned char *input,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md2( const unsigned char *input,
- size_t ilen,
- unsigned char output[16] )
-{
- mbedtls_md2_ret( input, ilen, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_md2( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[16] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/md4.h b/thirdparty/mbedtls/include/mbedtls/md4.h
index a2ab57f078..23fa95e46a 100644
--- a/thirdparty/mbedtls/include/mbedtls/md4.h
+++ b/thirdparty/mbedtls/include/mbedtls/md4.h
@@ -40,11 +40,6 @@
#define MBEDTLS_ERR_MD4_HW_ACCEL_FAILED -0x002D /**< MD4 hardware accelerator failed */
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
-
#if !defined(MBEDTLS_MD4_ALT)
// Regular implementation
//
@@ -188,11 +183,7 @@ int mbedtls_internal_md4_process( mbedtls_md4_context *ctx,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md4_starts(
- mbedtls_md4_context *ctx )
-{
- mbedtls_md4_starts_ret( ctx );
-}
+MBEDTLS_DEPRECATED void mbedtls_md4_starts( mbedtls_md4_context *ctx );
/**
* \brief MD4 process buffer
@@ -208,13 +199,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md4_starts(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md4_update(
- mbedtls_md4_context *ctx,
- const unsigned char *input,
- size_t ilen )
-{
- mbedtls_md4_update_ret( ctx, input, ilen );
-}
+MBEDTLS_DEPRECATED void mbedtls_md4_update( mbedtls_md4_context *ctx,
+ const unsigned char *input,
+ size_t ilen );
/**
* \brief MD4 final digest
@@ -229,12 +216,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md4_update(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md4_finish(
- mbedtls_md4_context *ctx,
- unsigned char output[16] )
-{
- mbedtls_md4_finish_ret( ctx, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_md4_finish( mbedtls_md4_context *ctx,
+ unsigned char output[16] );
/**
* \brief MD4 process data block (internal use only)
@@ -249,12 +232,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md4_finish(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md4_process(
- mbedtls_md4_context *ctx,
- const unsigned char data[64] )
-{
- mbedtls_internal_md4_process( ctx, data );
-}
+MBEDTLS_DEPRECATED void mbedtls_md4_process( mbedtls_md4_context *ctx,
+ const unsigned char data[64] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -309,12 +288,9 @@ int mbedtls_md4_ret( const unsigned char *input,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md4( const unsigned char *input,
- size_t ilen,
- unsigned char output[16] )
-{
- mbedtls_md4_ret( input, ilen, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_md4( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[16] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/md5.h b/thirdparty/mbedtls/include/mbedtls/md5.h
index d49391f811..06ea4c5d44 100644
--- a/thirdparty/mbedtls/include/mbedtls/md5.h
+++ b/thirdparty/mbedtls/include/mbedtls/md5.h
@@ -43,11 +43,6 @@
// Regular implementation
//
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -188,11 +183,7 @@ int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md5_starts(
- mbedtls_md5_context *ctx )
-{
- mbedtls_md5_starts_ret( ctx );
-}
+MBEDTLS_DEPRECATED void mbedtls_md5_starts( mbedtls_md5_context *ctx );
/**
* \brief MD5 process buffer
@@ -208,13 +199,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md5_starts(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md5_update(
- mbedtls_md5_context *ctx,
- const unsigned char *input,
- size_t ilen )
-{
- mbedtls_md5_update_ret( ctx, input, ilen );
-}
+MBEDTLS_DEPRECATED void mbedtls_md5_update( mbedtls_md5_context *ctx,
+ const unsigned char *input,
+ size_t ilen );
/**
* \brief MD5 final digest
@@ -229,12 +216,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md5_update(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md5_finish(
- mbedtls_md5_context *ctx,
- unsigned char output[16] )
-{
- mbedtls_md5_finish_ret( ctx, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_md5_finish( mbedtls_md5_context *ctx,
+ unsigned char output[16] );
/**
* \brief MD5 process data block (internal use only)
@@ -249,12 +232,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_md5_finish(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md5_process(
- mbedtls_md5_context *ctx,
- const unsigned char data[64] )
-{
- mbedtls_internal_md5_process( ctx, data );
-}
+MBEDTLS_DEPRECATED void mbedtls_md5_process( mbedtls_md5_context *ctx,
+ const unsigned char data[64] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -309,12 +288,9 @@ int mbedtls_md5_ret( const unsigned char *input,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_md5( const unsigned char *input,
- size_t ilen,
- unsigned char output[16] )
-{
- mbedtls_md5_ret( input, ilen, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_md5( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[16] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/oid.h b/thirdparty/mbedtls/include/mbedtls/oid.h
index bf2ef5ece4..408645ece7 100644
--- a/thirdparty/mbedtls/include/mbedtls/oid.h
+++ b/thirdparty/mbedtls/include/mbedtls/oid.h
@@ -228,6 +228,14 @@
#define MBEDTLS_OID_HMAC_SHA1 MBEDTLS_OID_RSA_COMPANY "\x02\x07" /**< id-hmacWithSHA1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 7 } */
+#define MBEDTLS_OID_HMAC_SHA224 MBEDTLS_OID_RSA_COMPANY "\x02\x08" /**< id-hmacWithSHA224 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 8 } */
+
+#define MBEDTLS_OID_HMAC_SHA256 MBEDTLS_OID_RSA_COMPANY "\x02\x09" /**< id-hmacWithSHA256 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 9 } */
+
+#define MBEDTLS_OID_HMAC_SHA384 MBEDTLS_OID_RSA_COMPANY "\x02\x0A" /**< id-hmacWithSHA384 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 10 } */
+
+#define MBEDTLS_OID_HMAC_SHA512 MBEDTLS_OID_RSA_COMPANY "\x02\x0B" /**< id-hmacWithSHA512 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 11 } */
+
/*
* Encryption algorithms
*/
@@ -514,6 +522,16 @@ int mbedtls_oid_get_oid_by_sig_alg( mbedtls_pk_type_t pk_alg, mbedtls_md_type_t
* \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
*/
int mbedtls_oid_get_md_alg( const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_alg );
+
+/**
+ * \brief Translate hmac algorithm OID into md_type
+ *
+ * \param oid OID to use
+ * \param md_hmac place to store message hmac algorithm
+ *
+ * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ */
+int mbedtls_oid_get_md_hmac( const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_hmac );
#endif /* MBEDTLS_MD_C */
/**
diff --git a/thirdparty/mbedtls/include/mbedtls/ripemd160.h b/thirdparty/mbedtls/include/mbedtls/ripemd160.h
index c21868b185..3a8b50a621 100644
--- a/thirdparty/mbedtls/include/mbedtls/ripemd160.h
+++ b/thirdparty/mbedtls/include/mbedtls/ripemd160.h
@@ -35,11 +35,6 @@
#define MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED -0x0031 /**< RIPEMD160 hardware accelerator failed */
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
-
#if !defined(MBEDTLS_RIPEMD160_ALT)
// Regular implementation
//
@@ -139,11 +134,8 @@ int mbedtls_internal_ripemd160_process( mbedtls_ripemd160_context *ctx,
*
* \param ctx context to be initialized
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_starts(
- mbedtls_ripemd160_context *ctx )
-{
- mbedtls_ripemd160_starts_ret( ctx );
-}
+MBEDTLS_DEPRECATED void mbedtls_ripemd160_starts(
+ mbedtls_ripemd160_context *ctx );
/**
* \brief RIPEMD-160 process buffer
@@ -154,13 +146,10 @@ MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_starts(
* \param input buffer holding the data
* \param ilen length of the input data
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_update(
+MBEDTLS_DEPRECATED void mbedtls_ripemd160_update(
mbedtls_ripemd160_context *ctx,
const unsigned char *input,
- size_t ilen )
-{
- mbedtls_ripemd160_update_ret( ctx, input, ilen );
-}
+ size_t ilen );
/**
* \brief RIPEMD-160 final digest
@@ -170,12 +159,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_update(
* \param ctx RIPEMD-160 context
* \param output RIPEMD-160 checksum result
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_finish(
+MBEDTLS_DEPRECATED void mbedtls_ripemd160_finish(
mbedtls_ripemd160_context *ctx,
- unsigned char output[20] )
-{
- mbedtls_ripemd160_finish_ret( ctx, output );
-}
+ unsigned char output[20] );
/**
* \brief RIPEMD-160 process data block (internal use only)
@@ -185,12 +171,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_finish(
* \param ctx RIPEMD-160 context
* \param data buffer holding one block of data
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160_process(
+MBEDTLS_DEPRECATED void mbedtls_ripemd160_process(
mbedtls_ripemd160_context *ctx,
- const unsigned char data[64] )
-{
- mbedtls_internal_ripemd160_process( ctx, data );
-}
+ const unsigned char data[64] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -235,13 +218,9 @@ int mbedtls_ripemd160_ret( const unsigned char *input,
* \param ilen length of the input data
* \param output RIPEMD-160 checksum result
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_ripemd160(
- const unsigned char *input,
- size_t ilen,
- unsigned char output[20] )
-{
- mbedtls_ripemd160_ret( input, ilen, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_ripemd160( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[20] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/rsa.h b/thirdparty/mbedtls/include/mbedtls/rsa.h
index fb2f77f94f..5548f3c127 100644
--- a/thirdparty/mbedtls/include/mbedtls/rsa.h
+++ b/thirdparty/mbedtls/include/mbedtls/rsa.h
@@ -518,6 +518,18 @@ int mbedtls_rsa_public( mbedtls_rsa_context *ctx,
*
* \note The input and output buffers must be large
* enough. For example, 128 Bytes if RSA-1024 is used.
+ *
+ * \note Blinding is used if and only if a PRNG is provided.
+ *
+ * \note If blinding is used, both the base of exponentation
+ * and the exponent are blinded, providing protection
+ * against some side-channel attacks.
+ *
+ * \warning It is deprecated and a security risk to not provide
+ * a PRNG here and thereby prevent the use of blinding.
+ * Future versions of the library may enforce the presence
+ * of a PRNG.
+ *
*/
int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t),
diff --git a/thirdparty/mbedtls/include/mbedtls/sha1.h b/thirdparty/mbedtls/include/mbedtls/sha1.h
index e4f8650216..05540cde12 100644
--- a/thirdparty/mbedtls/include/mbedtls/sha1.h
+++ b/thirdparty/mbedtls/include/mbedtls/sha1.h
@@ -39,11 +39,6 @@
#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035 /**< SHA-1 hardware accelerator failed */
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
-
#if !defined(MBEDTLS_SHA1_ALT)
// Regular implementation
//
@@ -190,11 +185,7 @@ int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha1_starts(
- mbedtls_sha1_context *ctx )
-{
- mbedtls_sha1_starts_ret( ctx );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
/**
* \brief SHA-1 process buffer
@@ -210,13 +201,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha1_starts(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha1_update(
- mbedtls_sha1_context *ctx,
- const unsigned char *input,
- size_t ilen )
-{
- mbedtls_sha1_update_ret( ctx, input, ilen );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
+ const unsigned char *input,
+ size_t ilen );
/**
* \brief SHA-1 final digest
@@ -231,12 +218,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha1_update(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha1_finish(
- mbedtls_sha1_context *ctx,
- unsigned char output[20] )
-{
- mbedtls_sha1_finish_ret( ctx, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
+ unsigned char output[20] );
/**
* \brief SHA-1 process data block (internal use only)
@@ -251,12 +234,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha1_finish(
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha1_process(
- mbedtls_sha1_context *ctx,
- const unsigned char data[64] )
-{
- mbedtls_internal_sha1_process( ctx, data );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
+ const unsigned char data[64] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -317,12 +296,9 @@ int mbedtls_sha1_ret( const unsigned char *input,
* stronger message digests instead.
*
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha1( const unsigned char *input,
- size_t ilen,
- unsigned char output[20] )
-{
- mbedtls_sha1_ret( input, ilen, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[20] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/sha256.h b/thirdparty/mbedtls/include/mbedtls/sha256.h
index a2b6e11644..ffb16c277a 100644
--- a/thirdparty/mbedtls/include/mbedtls/sha256.h
+++ b/thirdparty/mbedtls/include/mbedtls/sha256.h
@@ -35,10 +35,6 @@
#define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037 /**< SHA-256 hardware accelerator failed */
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
#if !defined(MBEDTLS_SHA256_ALT)
// Regular implementation
//
@@ -156,12 +152,8 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
* <ul><li>0: Use SHA-256.</li>
* <li>1: Use SHA-224.</li></ul>
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha256_starts(
- mbedtls_sha256_context *ctx,
- int is224 )
-{
- mbedtls_sha256_starts_ret( ctx, is224 );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
+ int is224 );
/**
* \brief This function feeds an input buffer into an ongoing
@@ -173,13 +165,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha256_starts(
* \param input The buffer holding the data.
* \param ilen The length of the input data.
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha256_update(
- mbedtls_sha256_context *ctx,
- const unsigned char *input,
- size_t ilen )
-{
- mbedtls_sha256_update_ret( ctx, input, ilen );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
+ const unsigned char *input,
+ size_t ilen );
/**
* \brief This function finishes the SHA-256 operation, and writes
@@ -190,12 +178,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha256_update(
* \param ctx The SHA-256 context.
* \param output The SHA-224or SHA-256 checksum result.
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha256_finish(
- mbedtls_sha256_context *ctx,
- unsigned char output[32] )
-{
- mbedtls_sha256_finish_ret( ctx, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
+ unsigned char output[32] );
/**
* \brief This function processes a single data block within
@@ -207,12 +191,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha256_finish(
* \param ctx The SHA-256 context.
* \param data The buffer holding one block of data.
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha256_process(
- mbedtls_sha256_context *ctx,
- const unsigned char data[64] )
-{
- mbedtls_internal_sha256_process( ctx, data );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
+ const unsigned char data[64] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -276,14 +256,10 @@ int mbedtls_sha256_ret( const unsigned char *input,
* <ul><li>0: Use SHA-256.</li>
* <li>1: Use SHA-224.</li></ul>
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha256(
- const unsigned char *input,
- size_t ilen,
- unsigned char output[32],
- int is224 )
-{
- mbedtls_sha256_ret( input, ilen, output, is224 );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[32],
+ int is224 );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/sha512.h b/thirdparty/mbedtls/include/mbedtls/sha512.h
index 52ae204d44..8404a2d599 100644
--- a/thirdparty/mbedtls/include/mbedtls/sha512.h
+++ b/thirdparty/mbedtls/include/mbedtls/sha512.h
@@ -35,10 +35,6 @@
#define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039 /**< SHA-512 hardware accelerator failed */
-#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
- !defined(inline) && !defined(__cplusplus)
-#define inline __inline
-#endif
#if !defined(MBEDTLS_SHA512_ALT)
// Regular implementation
//
@@ -156,12 +152,8 @@ int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
* <ul><li>0: Use SHA-512.</li>
* <li>1: Use SHA-384.</li></ul>
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha512_starts(
- mbedtls_sha512_context *ctx,
- int is384 )
-{
- mbedtls_sha512_starts_ret( ctx, is384 );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
+ int is384 );
/**
* \brief This function feeds an input buffer into an ongoing
@@ -173,13 +165,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha512_starts(
* \param input The buffer holding the data.
* \param ilen The length of the input data.
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha512_update(
- mbedtls_sha512_context *ctx,
- const unsigned char *input,
- size_t ilen )
-{
- mbedtls_sha512_update_ret( ctx, input, ilen );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
+ const unsigned char *input,
+ size_t ilen );
/**
* \brief This function finishes the SHA-512 operation, and writes
@@ -190,12 +178,8 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha512_update(
* \param ctx The SHA-512 context.
* \param output The SHA-384 or SHA-512 checksum result.
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha512_finish(
- mbedtls_sha512_context *ctx,
- unsigned char output[64] )
-{
- mbedtls_sha512_finish_ret( ctx, output );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
+ unsigned char output[64] );
/**
* \brief This function processes a single data block within
@@ -207,12 +191,9 @@ MBEDTLS_DEPRECATED static inline void mbedtls_sha512_finish(
* \param ctx The SHA-512 context.
* \param data The buffer holding one block of data.
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha512_process(
+MBEDTLS_DEPRECATED void mbedtls_sha512_process(
mbedtls_sha512_context *ctx,
- const unsigned char data[128] )
-{
- mbedtls_internal_sha512_process( ctx, data );
-}
+ const unsigned char data[128] );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
@@ -278,14 +259,10 @@ int mbedtls_sha512_ret( const unsigned char *input,
* <ul><li>0: Use SHA-512.</li>
* <li>1: Use SHA-384.</li></ul>
*/
-MBEDTLS_DEPRECATED static inline void mbedtls_sha512(
- const unsigned char *input,
- size_t ilen,
- unsigned char output[64],
- int is384 )
-{
- mbedtls_sha512_ret( input, ilen, output, is384 );
-}
+MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[64],
+ int is384 );
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
diff --git a/thirdparty/mbedtls/include/mbedtls/ssl.h b/thirdparty/mbedtls/include/mbedtls/ssl.h
index 51e843ae24..dffc162191 100644
--- a/thirdparty/mbedtls/include/mbedtls/ssl.h
+++ b/thirdparty/mbedtls/include/mbedtls/ssl.h
@@ -49,6 +49,15 @@
#endif
#if defined(MBEDTLS_ZLIB_SUPPORT)
+
+#if defined(MBEDTLS_DEPRECATED_WARNING)
+#warning "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and will be removed in the next major revision of the library"
+#endif
+
+#if defined(MBEDTLS_DEPRECATED_REMOVED)
+#error "Record compression support via MBEDTLS_ZLIB_SUPPORT is deprecated and cannot be used if MBEDTLS_DEPRECATED_REMOVED is set"
+#endif
+
#include "zlib.h"
#endif
@@ -971,8 +980,13 @@ void mbedtls_ssl_init( mbedtls_ssl_context *ssl );
* \note No copy of the configuration context is made, it can be
* shared by many mbedtls_ssl_context structures.
*
- * \warning Modifying the conf structure after it has been used in this
- * function is unsupported!
+ * \warning The conf structure will be accessed during the session.
+ * It must not be modified or freed as long as the session
+ * is active.
+ *
+ * \warning This function must be called exactly once per context.
+ * Calling mbedtls_ssl_setup again is not supported, even
+ * if no session is active.
*
* \param ssl SSL context
* \param conf SSL configuration to use
diff --git a/thirdparty/mbedtls/include/mbedtls/ssl_internal.h b/thirdparty/mbedtls/include/mbedtls/ssl_internal.h
index 9f583a8777..60b431a0f4 100644
--- a/thirdparty/mbedtls/include/mbedtls/ssl_internal.h
+++ b/thirdparty/mbedtls/include/mbedtls/ssl_internal.h
@@ -71,6 +71,9 @@
#endif /* MBEDTLS_SSL_PROTO_TLS1 */
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
+#define MBEDTLS_SSL_MIN_VALID_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_1
+#define MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
+
/* Determine maximum supported version */
#define MBEDTLS_SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
diff --git a/thirdparty/mbedtls/include/mbedtls/version.h b/thirdparty/mbedtls/include/mbedtls/version.h
index 961be59c35..c3ee649f5c 100644
--- a/thirdparty/mbedtls/include/mbedtls/version.h
+++ b/thirdparty/mbedtls/include/mbedtls/version.h
@@ -39,7 +39,7 @@
* Major, Minor, Patchlevel
*/
#define MBEDTLS_VERSION_MAJOR 2
-#define MBEDTLS_VERSION_MINOR 7
+#define MBEDTLS_VERSION_MINOR 8
#define MBEDTLS_VERSION_PATCH 0
/**
@@ -47,9 +47,9 @@
* MMNNPP00
* Major version | Minor version | Patch version
*/
-#define MBEDTLS_VERSION_NUMBER 0x02070000
-#define MBEDTLS_VERSION_STRING "2.7.0"
-#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.7.0"
+#define MBEDTLS_VERSION_NUMBER 0x02080000
+#define MBEDTLS_VERSION_STRING "2.8.0"
+#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.8.0"
#if defined(MBEDTLS_VERSION_C)
diff --git a/thirdparty/mbedtls/library/aes.c b/thirdparty/mbedtls/library/aes.c
index dba4a5f578..3d2eac82dd 100644
--- a/thirdparty/mbedtls/library/aes.c
+++ b/thirdparty/mbedtls/library/aes.c
@@ -765,12 +765,14 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
}
#endif /* !MBEDTLS_AES_ENCRYPT_ALT */
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
mbedtls_internal_aes_encrypt( ctx, input, output );
}
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
/*
* AES-ECB block decryption
@@ -831,12 +833,14 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
}
#endif /* !MBEDTLS_AES_DECRYPT_ALT */
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
const unsigned char input[16],
unsigned char output[16] )
{
mbedtls_internal_aes_decrypt( ctx, input, output );
}
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
/*
* AES-ECB block encryption/decryption
diff --git a/thirdparty/mbedtls/library/bignum.c b/thirdparty/mbedtls/library/bignum.c
index d27c130bcb..9f13da4421 100644
--- a/thirdparty/mbedtls/library/bignum.c
+++ b/thirdparty/mbedtls/library/bignum.c
@@ -1623,7 +1623,7 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi
mbedtls_mpi RR, T, W[ 2 << MBEDTLS_MPI_WINDOW_SIZE ], Apos;
int neg;
- if( mbedtls_mpi_cmp_int( N, 0 ) < 0 || ( N->p[0] & 1 ) == 0 )
+ if( mbedtls_mpi_cmp_int( N, 0 ) <= 0 || ( N->p[0] & 1 ) == 0 )
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
if( mbedtls_mpi_cmp_int( E, 0 ) < 0 )
diff --git a/thirdparty/mbedtls/library/ctr_drbg.c b/thirdparty/mbedtls/library/ctr_drbg.c
index c2310cb579..ff532a0134 100644
--- a/thirdparty/mbedtls/library/ctr_drbg.c
+++ b/thirdparty/mbedtls/library/ctr_drbg.c
@@ -19,7 +19,7 @@
* This file is part of mbed TLS (https://tls.mbed.org)
*/
/*
- * The NIST SP 800-90 DRBGs are described in the following publucation.
+ * The NIST SP 800-90 DRBGs are described in the following publication.
*
* http://csrc.nist.gov/publications/nistpubs/800-90/SP800-90revised_March2007.pdf
*/
diff --git a/thirdparty/mbedtls/library/debug.c b/thirdparty/mbedtls/library/debug.c
index f9229b3606..db3924ac54 100644
--- a/thirdparty/mbedtls/library/debug.c
+++ b/thirdparty/mbedtls/library/debug.c
@@ -91,7 +91,7 @@ void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level,
va_start( argp, format );
#if defined(_WIN32)
-#if defined(_TRUNCATE)
+#if defined(_TRUNCATE) && !defined(__MINGW32__)
ret = _vsnprintf_s( str, DEBUG_BUF_SIZE, _TRUNCATE, format, argp );
#else
ret = _vsnprintf( str, DEBUG_BUF_SIZE, format, argp );
diff --git a/thirdparty/mbedtls/library/entropy_poll.c b/thirdparty/mbedtls/library/entropy_poll.c
index 5e8a090b37..ed350735d0 100644
--- a/thirdparty/mbedtls/library/entropy_poll.c
+++ b/thirdparty/mbedtls/library/entropy_poll.c
@@ -55,16 +55,17 @@
#endif
#include <windows.h>
#include <bcrypt.h>
-#if _MSC_VER <= 1600
-/* Visual Studio 2010 and earlier issue a warning when both <stdint.h> and <intsafe.h> are included, as they
- * redefine a number of <TYPE>_MAX constants. These constants are guaranteed to be the same, though, so
- * we suppress the warning when including intsafe.h.
+#if defined(_MSC_VER) && _MSC_VER <= 1600
+/* Visual Studio 2010 and earlier issue a warning when both <stdint.h> and
+ * <intsafe.h> are included, as they redefine a number of <TYPE>_MAX constants.
+ * These constants are guaranteed to be the same, though, so we suppress the
+ * warning when including intsafe.h.
*/
#pragma warning( push )
#pragma warning( disable : 4005 )
#endif
#include <intsafe.h>
-#if _MSC_VER <= 1600
+#if defined(_MSC_VER) && _MSC_VER <= 1600
#pragma warning( pop )
#endif
@@ -76,8 +77,9 @@ int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len
*olen = 0;
/*
- * BCryptGenRandom takes ULONG for size, which is smaller than size_t on 64-bit platforms.
- * Ensure len's value can be safely converted into a ULONG.
+ * BCryptGenRandom takes ULONG for size, which is smaller than size_t on
+ * 64-bit Windows platforms. Ensure len's value can be safely converted into
+ * a ULONG.
*/
if ( FAILED( SizeTToULong( len, &len_as_ulong ) ) )
{
diff --git a/thirdparty/mbedtls/library/md2.c b/thirdparty/mbedtls/library/md2.c
index 5028e8c586..b88aa406af 100644
--- a/thirdparty/mbedtls/library/md2.c
+++ b/thirdparty/mbedtls/library/md2.c
@@ -115,6 +115,13 @@ int mbedtls_md2_starts_ret( mbedtls_md2_context *ctx )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md2_starts( mbedtls_md2_context *ctx )
+{
+ mbedtls_md2_starts_ret( ctx );
+}
+#endif
+
#if !defined(MBEDTLS_MD2_PROCESS_ALT)
int mbedtls_internal_md2_process( mbedtls_md2_context *ctx )
{
@@ -151,6 +158,13 @@ int mbedtls_internal_md2_process( mbedtls_md2_context *ctx )
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md2_process( mbedtls_md2_context *ctx )
+{
+ mbedtls_internal_md2_process( ctx );
+}
+#endif
#endif /* !MBEDTLS_MD2_PROCESS_ALT */
/*
@@ -187,6 +201,15 @@ int mbedtls_md2_update_ret( mbedtls_md2_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md2_update( mbedtls_md2_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_md2_update_ret( ctx, input, ilen );
+}
+#endif
+
/*
* MD2 final digest
*/
@@ -214,6 +237,14 @@ int mbedtls_md2_finish_ret( mbedtls_md2_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md2_finish( mbedtls_md2_context *ctx,
+ unsigned char output[16] )
+{
+ mbedtls_md2_finish_ret( ctx, output );
+}
+#endif
+
#endif /* !MBEDTLS_MD2_ALT */
/*
@@ -243,6 +274,15 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md2( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[16] )
+{
+ mbedtls_md2_ret( input, ilen, output );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
diff --git a/thirdparty/mbedtls/library/md4.c b/thirdparty/mbedtls/library/md4.c
index 34a4b0e24e..ba704f58e8 100644
--- a/thirdparty/mbedtls/library/md4.c
+++ b/thirdparty/mbedtls/library/md4.c
@@ -111,6 +111,13 @@ int mbedtls_md4_starts_ret( mbedtls_md4_context *ctx )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md4_starts( mbedtls_md4_context *ctx )
+{
+ mbedtls_md4_starts_ret( ctx );
+}
+#endif
+
#if !defined(MBEDTLS_MD4_PROCESS_ALT)
int mbedtls_internal_md4_process( mbedtls_md4_context *ctx,
const unsigned char data[64] )
@@ -217,6 +224,14 @@ int mbedtls_internal_md4_process( mbedtls_md4_context *ctx,
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md4_process( mbedtls_md4_context *ctx,
+ const unsigned char data[64] )
+{
+ mbedtls_internal_md4_process( ctx, data );
+}
+#endif
#endif /* !MBEDTLS_MD4_PROCESS_ALT */
/*
@@ -273,6 +288,15 @@ int mbedtls_md4_update_ret( mbedtls_md4_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md4_update( mbedtls_md4_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_md4_update_ret( ctx, input, ilen );
+}
+#endif
+
static const unsigned char md4_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -318,6 +342,14 @@ int mbedtls_md4_finish_ret( mbedtls_md4_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md4_finish( mbedtls_md4_context *ctx,
+ unsigned char output[16] )
+{
+ mbedtls_md4_finish_ret( ctx, output );
+}
+#endif
+
#endif /* !MBEDTLS_MD4_ALT */
/*
@@ -347,6 +379,15 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md4( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[16] )
+{
+ mbedtls_md4_ret( input, ilen, output );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
diff --git a/thirdparty/mbedtls/library/md5.c b/thirdparty/mbedtls/library/md5.c
index 8872dc467d..8440ebffcf 100644
--- a/thirdparty/mbedtls/library/md5.c
+++ b/thirdparty/mbedtls/library/md5.c
@@ -110,6 +110,13 @@ int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md5_starts( mbedtls_md5_context *ctx )
+{
+ mbedtls_md5_starts_ret( ctx );
+}
+#endif
+
#if !defined(MBEDTLS_MD5_PROCESS_ALT)
int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
const unsigned char data[64] )
@@ -236,6 +243,14 @@ int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md5_process( mbedtls_md5_context *ctx,
+ const unsigned char data[64] )
+{
+ mbedtls_internal_md5_process( ctx, data );
+}
+#endif
#endif /* !MBEDTLS_MD5_PROCESS_ALT */
/*
@@ -289,6 +304,15 @@ int mbedtls_md5_update_ret( mbedtls_md5_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md5_update( mbedtls_md5_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_md5_update_ret( ctx, input, ilen );
+}
+#endif
+
static const unsigned char md5_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -332,6 +356,14 @@ int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md5_finish( mbedtls_md5_context *ctx,
+ unsigned char output[16] )
+{
+ mbedtls_md5_finish_ret( ctx, output );
+}
+#endif
+
#endif /* !MBEDTLS_MD5_ALT */
/*
@@ -361,6 +393,15 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_md5( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[16] )
+{
+ mbedtls_md5_ret( input, ilen, output );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
* RFC 1321 test vectors
diff --git a/thirdparty/mbedtls/library/memory_buffer_alloc.c b/thirdparty/mbedtls/library/memory_buffer_alloc.c
index 545d5a2c32..821ae2c708 100644
--- a/thirdparty/mbedtls/library/memory_buffer_alloc.c
+++ b/thirdparty/mbedtls/library/memory_buffer_alloc.c
@@ -113,7 +113,7 @@ static void debug_header( memory_header *hdr )
#endif
}
-static void debug_chain()
+static void debug_chain( void )
{
memory_header *cur = heap.first;
@@ -180,11 +180,11 @@ static int verify_header( memory_header *hdr )
return( 0 );
}
-static int verify_chain()
+static int verify_chain( void )
{
- memory_header *prv = heap.first, *cur = heap.first->next;
+ memory_header *prv = heap.first, *cur;
- if( verify_header( heap.first ) != 0 )
+ if( prv == NULL || verify_header( prv ) != 0 )
{
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf( stderr, "FATAL: verification of first header "
@@ -202,6 +202,8 @@ static int verify_chain()
return( 1 );
}
+ cur = heap.first->next;
+
while( cur != NULL )
{
if( verify_header( cur ) != 0 )
@@ -245,7 +247,9 @@ static void *buffer_alloc_calloc( size_t n, size_t size )
original_len = len = n * size;
- if( n != 0 && len / n != size )
+ if( n == 0 || size == 0 || len / n != size )
+ return( NULL );
+ else if( len > (size_t)-MBEDTLS_MEMORY_ALIGN_MULTIPLE )
return( NULL );
if( len % MBEDTLS_MEMORY_ALIGN_MULTIPLE )
@@ -386,7 +390,7 @@ static void buffer_alloc_free( void *ptr )
if( ptr == NULL || heap.buf == NULL || heap.first == NULL )
return;
- if( p < heap.buf || p > heap.buf + heap.len )
+ if( p < heap.buf || p >= heap.buf + heap.len )
{
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_fprintf( stderr, "FATAL: mbedtls_free() outside of managed "
@@ -500,13 +504,13 @@ void mbedtls_memory_buffer_set_verify( int verify )
heap.verify = verify;
}
-int mbedtls_memory_buffer_alloc_verify()
+int mbedtls_memory_buffer_alloc_verify( void )
{
return verify_chain();
}
#if defined(MBEDTLS_MEMORY_DEBUG)
-void mbedtls_memory_buffer_alloc_status()
+void mbedtls_memory_buffer_alloc_status( void )
{
mbedtls_fprintf( stderr,
"Current use: %zu blocks / %zu bytes, max: %zu blocks / "
@@ -570,8 +574,7 @@ static void buffer_alloc_free_mutexed( void *ptr )
void mbedtls_memory_buffer_alloc_init( unsigned char *buf, size_t len )
{
- memset( &heap, 0, sizeof(buffer_alloc_ctx) );
- memset( buf, 0, len );
+ memset( &heap, 0, sizeof( buffer_alloc_ctx ) );
#if defined(MBEDTLS_THREADING_C)
mbedtls_mutex_init( &heap.mutex );
@@ -581,26 +584,30 @@ void mbedtls_memory_buffer_alloc_init( unsigned char *buf, size_t len )
mbedtls_platform_set_calloc_free( buffer_alloc_calloc, buffer_alloc_free );
#endif
- if( (size_t) buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE )
+ if( len < sizeof( memory_header ) + MBEDTLS_MEMORY_ALIGN_MULTIPLE )
+ return;
+ else if( (size_t)buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE )
{
/* Adjust len first since buf is used in the computation */
len -= MBEDTLS_MEMORY_ALIGN_MULTIPLE
- - (size_t) buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE;
+ - (size_t)buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE;
buf += MBEDTLS_MEMORY_ALIGN_MULTIPLE
- - (size_t) buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE;
+ - (size_t)buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE;
}
+ memset( buf, 0, len );
+
heap.buf = buf;
heap.len = len;
- heap.first = (memory_header *) buf;
- heap.first->size = len - sizeof(memory_header);
+ heap.first = (memory_header *)buf;
+ heap.first->size = len - sizeof( memory_header );
heap.first->magic1 = MAGIC1;
heap.first->magic2 = MAGIC2;
heap.first_free = heap.first;
}
-void mbedtls_memory_buffer_alloc_free()
+void mbedtls_memory_buffer_alloc_free( void )
{
#if defined(MBEDTLS_THREADING_C)
mbedtls_mutex_free( &heap.mutex );
@@ -620,7 +627,7 @@ static int check_pointer( void *p )
return( 0 );
}
-static int check_all_free( )
+static int check_all_free( void )
{
if(
#if defined(MBEDTLS_MEMORY_DEBUG)
diff --git a/thirdparty/mbedtls/library/net_sockets.c b/thirdparty/mbedtls/library/net_sockets.c
index 754049005d..2fb548caa9 100644
--- a/thirdparty/mbedtls/library/net_sockets.c
+++ b/thirdparty/mbedtls/library/net_sockets.c
@@ -45,11 +45,14 @@
#if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \
!defined(EFI32)
-#ifdef _WIN32_WINNT
+/* GODOT ADDITION */
+#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
#undef _WIN32_WINNT
-#endif
/* Enables getaddrinfo() & Co */
-#define _WIN32_WINNT 0x0601
+#define _WIN32_WINNT 0x0501
+#endif
+/* END GODOT ADDITION */
+
#include <ws2tcpip.h>
#include <winsock2.h>
diff --git a/thirdparty/mbedtls/library/oid.c b/thirdparty/mbedtls/library/oid.c
index f13826ed74..edea950f8f 100644
--- a/thirdparty/mbedtls/library/oid.c
+++ b/thirdparty/mbedtls/library/oid.c
@@ -625,6 +625,51 @@ static const oid_md_alg_t oid_md_alg[] =
FN_OID_TYPED_FROM_ASN1(oid_md_alg_t, md_alg, oid_md_alg)
FN_OID_GET_ATTR1(mbedtls_oid_get_md_alg, oid_md_alg_t, md_alg, mbedtls_md_type_t, md_alg)
FN_OID_GET_OID_BY_ATTR1(mbedtls_oid_get_oid_by_md, oid_md_alg_t, oid_md_alg, mbedtls_md_type_t, md_alg)
+
+/*
+ * For HMAC digestAlgorithm
+ */
+typedef struct {
+ mbedtls_oid_descriptor_t descriptor;
+ mbedtls_md_type_t md_hmac;
+} oid_md_hmac_t;
+
+static const oid_md_hmac_t oid_md_hmac[] =
+{
+#if defined(MBEDTLS_SHA1_C)
+ {
+ { ADD_LEN( MBEDTLS_OID_HMAC_SHA1 ), "hmacSHA1", "HMAC-SHA-1" },
+ MBEDTLS_MD_SHA1,
+ },
+#endif /* MBEDTLS_SHA1_C */
+#if defined(MBEDTLS_SHA256_C)
+ {
+ { ADD_LEN( MBEDTLS_OID_HMAC_SHA224 ), "hmacSHA224", "HMAC-SHA-224" },
+ MBEDTLS_MD_SHA224,
+ },
+ {
+ { ADD_LEN( MBEDTLS_OID_HMAC_SHA256 ), "hmacSHA256", "HMAC-SHA-256" },
+ MBEDTLS_MD_SHA256,
+ },
+#endif /* MBEDTLS_SHA256_C */
+#if defined(MBEDTLS_SHA512_C)
+ {
+ { ADD_LEN( MBEDTLS_OID_HMAC_SHA384 ), "hmacSHA384", "HMAC-SHA-384" },
+ MBEDTLS_MD_SHA384,
+ },
+ {
+ { ADD_LEN( MBEDTLS_OID_HMAC_SHA512 ), "hmacSHA512", "HMAC-SHA-512" },
+ MBEDTLS_MD_SHA512,
+ },
+#endif /* MBEDTLS_SHA512_C */
+ {
+ { NULL, 0, NULL, NULL },
+ MBEDTLS_MD_NONE,
+ },
+};
+
+FN_OID_TYPED_FROM_ASN1(oid_md_hmac_t, md_hmac, oid_md_hmac)
+FN_OID_GET_ATTR1(mbedtls_oid_get_md_hmac, oid_md_hmac_t, md_hmac, mbedtls_md_type_t, md_hmac)
#endif /* MBEDTLS_MD_C */
#if defined(MBEDTLS_PKCS12_C)
diff --git a/thirdparty/mbedtls/library/pem.c b/thirdparty/mbedtls/library/pem.c
index c09651f4a2..ac86d7e479 100644
--- a/thirdparty/mbedtls/library/pem.c
+++ b/thirdparty/mbedtls/library/pem.c
@@ -442,7 +442,7 @@ int mbedtls_pem_write_buffer( const char *header, const char *footer,
unsigned char *buf, size_t buf_len, size_t *olen )
{
int ret;
- unsigned char *encode_buf, *c, *p = buf;
+ unsigned char *encode_buf = NULL, *c, *p = buf;
size_t len = 0, use_len, add_len = 0;
mbedtls_base64_encode( NULL, 0, &use_len, der_data, der_len );
@@ -454,7 +454,8 @@ int mbedtls_pem_write_buffer( const char *header, const char *footer,
return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
}
- if( ( encode_buf = mbedtls_calloc( 1, use_len ) ) == NULL )
+ if( use_len != 0 &&
+ ( ( encode_buf = mbedtls_calloc( 1, use_len ) ) == NULL ) )
return( MBEDTLS_ERR_PEM_ALLOC_FAILED );
if( ( ret = mbedtls_base64_encode( encode_buf, use_len, &use_len, der_data,
diff --git a/thirdparty/mbedtls/library/pkcs5.c b/thirdparty/mbedtls/library/pkcs5.c
index e28d5a8473..95f44fa98b 100644
--- a/thirdparty/mbedtls/library/pkcs5.c
+++ b/thirdparty/mbedtls/library/pkcs5.c
@@ -96,11 +96,9 @@ static int pkcs5_parse_pbkdf2_params( const mbedtls_asn1_buf *params,
if( ( ret = mbedtls_asn1_get_alg_null( &p, end, &prf_alg_oid ) ) != 0 )
return( MBEDTLS_ERR_PKCS5_INVALID_FORMAT + ret );
- if( MBEDTLS_OID_CMP( MBEDTLS_OID_HMAC_SHA1, &prf_alg_oid ) != 0 )
+ if( mbedtls_oid_get_md_hmac( &prf_alg_oid, md_type ) != 0 )
return( MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE );
- *md_type = MBEDTLS_MD_SHA1;
-
if( p != end )
return( MBEDTLS_ERR_PKCS5_INVALID_FORMAT +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
diff --git a/thirdparty/mbedtls/library/pkparse.c b/thirdparty/mbedtls/library/pkparse.c
index b4def4f914..9022db2f93 100644
--- a/thirdparty/mbedtls/library/pkparse.c
+++ b/thirdparty/mbedtls/library/pkparse.c
@@ -181,6 +181,10 @@ static int pk_get_ecparams( unsigned char **p, const unsigned char *end,
{
int ret;
+ if ( end - *p < 1 )
+ return( MBEDTLS_ERR_PK_KEY_INVALID_FORMAT +
+ MBEDTLS_ERR_ASN1_OUT_OF_DATA );
+
/* Tag may be either OID or SEQUENCE */
params->tag = **p;
if( params->tag != MBEDTLS_ASN1_OID
@@ -1277,6 +1281,9 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
{
unsigned char *key_copy;
+ if( keylen == 0 )
+ return( MBEDTLS_ERR_PK_KEY_INVALID_FORMAT );
+
if( ( key_copy = mbedtls_calloc( 1, keylen ) ) == NULL )
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
@@ -1348,11 +1355,45 @@ int mbedtls_pk_parse_public_key( mbedtls_pk_context *ctx,
{
int ret;
unsigned char *p;
+#if defined(MBEDTLS_RSA_C)
+ const mbedtls_pk_info_t *pk_info;
+#endif
#if defined(MBEDTLS_PEM_PARSE_C)
size_t len;
mbedtls_pem_context pem;
mbedtls_pem_init( &pem );
+#if defined(MBEDTLS_RSA_C)
+ /* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated string */
+ if( keylen == 0 || key[keylen - 1] != '\0' )
+ ret = MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT;
+ else
+ ret = mbedtls_pem_read_buffer( &pem,
+ "-----BEGIN RSA PUBLIC KEY-----",
+ "-----END RSA PUBLIC KEY-----",
+ key, NULL, 0, &len );
+
+ if( ret == 0 )
+ {
+ p = pem.buf;
+ if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
+ return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
+
+ if( ( ret = mbedtls_pk_setup( ctx, pk_info ) ) != 0 )
+ return( ret );
+
+ if ( ( ret = pk_get_rsapubkey( &p, p + pem.buflen, mbedtls_pk_rsa( *ctx ) ) ) != 0 )
+ mbedtls_pk_free( ctx );
+
+ mbedtls_pem_free( &pem );
+ return( ret );
+ }
+ else if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )
+ {
+ mbedtls_pem_free( &pem );
+ return( ret );
+ }
+#endif /* MBEDTLS_RSA_C */
/* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated string */
if( keylen == 0 || key[keylen - 1] != '\0' )
@@ -1368,23 +1409,43 @@ int mbedtls_pk_parse_public_key( mbedtls_pk_context *ctx,
/*
* Was PEM encoded
*/
- key = pem.buf;
- keylen = pem.buflen;
+ p = pem.buf;
+
+ ret = mbedtls_pk_parse_subpubkey( &p, p + pem.buflen, ctx );
+ mbedtls_pem_free( &pem );
+ return( ret );
}
else if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )
{
mbedtls_pem_free( &pem );
return( ret );
}
+ mbedtls_pem_free( &pem );
#endif /* MBEDTLS_PEM_PARSE_C */
+
+#if defined(MBEDTLS_RSA_C)
+ if( ( pk_info = mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == NULL )
+ return( MBEDTLS_ERR_PK_UNKNOWN_PK_ALG );
+
+ if( ( ret = mbedtls_pk_setup( ctx, pk_info ) ) != 0 )
+ return( ret );
+
+ p = (unsigned char *)key;
+ ret = pk_get_rsapubkey( &p, p + keylen, mbedtls_pk_rsa( *ctx ) );
+ if( ret == 0 )
+ {
+ return( ret );
+ }
+ mbedtls_pk_free( ctx );
+ if( ret != ( MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) )
+ {
+ return( ret );
+ }
+#endif /* MBEDTLS_RSA_C */
p = (unsigned char *) key;
ret = mbedtls_pk_parse_subpubkey( &p, p + keylen, ctx );
-#if defined(MBEDTLS_PEM_PARSE_C)
- mbedtls_pem_free( &pem );
-#endif
-
return( ret );
}
diff --git a/thirdparty/mbedtls/library/platform.c b/thirdparty/mbedtls/library/platform.c
index 76df7fac18..a295f9b9af 100644
--- a/thirdparty/mbedtls/library/platform.c
+++ b/thirdparty/mbedtls/library/platform.c
@@ -82,7 +82,7 @@ int mbedtls_platform_win32_snprintf( char *s, size_t n, const char *fmt, ... )
return( -1 );
va_start( argp, fmt );
-#if defined(_TRUNCATE)
+#if defined(_TRUNCATE) && !defined(__MINGW32__)
ret = _vsnprintf_s( s, n, _TRUNCATE, fmt, argp );
#else
ret = _vsnprintf( s, n, fmt, argp );
diff --git a/thirdparty/mbedtls/library/ripemd160.c b/thirdparty/mbedtls/library/ripemd160.c
index b85b117c6a..2ba48b7fdb 100644
--- a/thirdparty/mbedtls/library/ripemd160.c
+++ b/thirdparty/mbedtls/library/ripemd160.c
@@ -112,6 +112,13 @@ int mbedtls_ripemd160_starts_ret( mbedtls_ripemd160_context *ctx )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_ripemd160_starts( mbedtls_ripemd160_context *ctx )
+{
+ mbedtls_ripemd160_starts_ret( ctx );
+}
+#endif
+
#if !defined(MBEDTLS_RIPEMD160_PROCESS_ALT)
/*
* Process one block
@@ -295,6 +302,14 @@ int mbedtls_internal_ripemd160_process( mbedtls_ripemd160_context *ctx,
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_ripemd160_process( mbedtls_ripemd160_context *ctx,
+ const unsigned char data[64] )
+{
+ mbedtls_internal_ripemd160_process( ctx, data );
+}
+#endif
#endif /* !MBEDTLS_RIPEMD160_PROCESS_ALT */
/*
@@ -349,6 +364,15 @@ int mbedtls_ripemd160_update_ret( mbedtls_ripemd160_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_ripemd160_update( mbedtls_ripemd160_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_ripemd160_update_ret( ctx, input, ilen );
+}
+#endif
+
static const unsigned char ripemd160_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -395,6 +419,14 @@ int mbedtls_ripemd160_finish_ret( mbedtls_ripemd160_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_ripemd160_finish( mbedtls_ripemd160_context *ctx,
+ unsigned char output[20] )
+{
+ mbedtls_ripemd160_finish_ret( ctx, output );
+}
+#endif
+
#endif /* ! MBEDTLS_RIPEMD160_ALT */
/*
@@ -424,6 +456,15 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_ripemd160( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[20] )
+{
+ mbedtls_ripemd160_ret( input, ilen, output );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
* Test vectors from the RIPEMD-160 paper and
diff --git a/thirdparty/mbedtls/library/rsa.c b/thirdparty/mbedtls/library/rsa.c
index 6526978e26..c9f7ba91b6 100644
--- a/thirdparty/mbedtls/library/rsa.c
+++ b/thirdparty/mbedtls/library/rsa.c
@@ -773,16 +773,38 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
{
int ret;
size_t olen;
- mbedtls_mpi T, T1, T2;
+
+ /* Temporary holding the result */
+ mbedtls_mpi T;
+
+ /* Temporaries holding P-1, Q-1 and the
+ * exponent blinding factor, respectively. */
mbedtls_mpi P1, Q1, R;
-#if defined(MBEDTLS_RSA_NO_CRT)
- mbedtls_mpi D_blind;
- mbedtls_mpi *D = &ctx->D;
-#else
+
+#if !defined(MBEDTLS_RSA_NO_CRT)
+ /* Temporaries holding the results mod p resp. mod q. */
+ mbedtls_mpi TP, TQ;
+
+ /* Temporaries holding the blinded exponents for
+ * the mod p resp. mod q computation (if used). */
mbedtls_mpi DP_blind, DQ_blind;
+
+ /* Pointers to actual exponents to be used - either the unblinded
+ * or the blinded ones, depending on the presence of a PRNG. */
mbedtls_mpi *DP = &ctx->DP;
mbedtls_mpi *DQ = &ctx->DQ;
-#endif
+#else
+ /* Temporary holding the blinded exponent (if used). */
+ mbedtls_mpi D_blind;
+
+ /* Pointer to actual exponent to be used - either the unblinded
+ * or the blinded one, depending on the presence of a PRNG. */
+ mbedtls_mpi *D = &ctx->D;
+#endif /* MBEDTLS_RSA_NO_CRT */
+
+ /* Temporaries holding the initial input and the double
+ * checked result; should be the same in the end. */
+ mbedtls_mpi I, C;
if( rsa_check_context( ctx, 1 /* private key checks */,
f_rng != NULL /* blinding y/n */ ) != 0 )
@@ -790,8 +812,17 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
}
- mbedtls_mpi_init( &T ); mbedtls_mpi_init( &T1 ); mbedtls_mpi_init( &T2 );
- mbedtls_mpi_init( &P1 ); mbedtls_mpi_init( &Q1 ); mbedtls_mpi_init( &R );
+#if defined(MBEDTLS_THREADING_C)
+ if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 )
+ return( ret );
+#endif
+
+ /* MPI Initialization */
+ mbedtls_mpi_init( &T );
+
+ mbedtls_mpi_init( &P1 );
+ mbedtls_mpi_init( &Q1 );
+ mbedtls_mpi_init( &R );
if( f_rng != NULL )
{
@@ -803,12 +834,15 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
#endif
}
-
-#if defined(MBEDTLS_THREADING_C)
- if( ( ret = mbedtls_mutex_lock( &ctx->mutex ) ) != 0 )
- return( ret );
+#if !defined(MBEDTLS_RSA_NO_CRT)
+ mbedtls_mpi_init( &TP ); mbedtls_mpi_init( &TQ );
#endif
+ mbedtls_mpi_init( &I );
+ mbedtls_mpi_init( &C );
+
+ /* End of MPI initialization */
+
MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &T, input, ctx->len ) );
if( mbedtls_mpi_cmp_mpi( &T, &ctx->N ) >= 0 )
{
@@ -816,6 +850,8 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
goto cleanup;
}
+ MBEDTLS_MPI_CHK( mbedtls_mpi_copy( &I, &T ) );
+
if( f_rng != NULL )
{
/*
@@ -874,24 +910,25 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
/*
* Faster decryption using the CRT
*
- * T1 = input ^ dP mod P
- * T2 = input ^ dQ mod Q
+ * TP = input ^ dP mod P
+ * TQ = input ^ dQ mod Q
*/
- MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &T1, &T, DP, &ctx->P, &ctx->RP ) );
- MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &T2, &T, DQ, &ctx->Q, &ctx->RQ ) );
+
+ MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &TP, &T, DP, &ctx->P, &ctx->RP ) );
+ MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &TQ, &T, DQ, &ctx->Q, &ctx->RQ ) );
/*
- * T = (T1 - T2) * (Q^-1 mod P) mod P
+ * T = (TP - TQ) * (Q^-1 mod P) mod P
*/
- MBEDTLS_MPI_CHK( mbedtls_mpi_sub_mpi( &T, &T1, &T2 ) );
- MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &T1, &T, &ctx->QP ) );
- MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &T, &T1, &ctx->P ) );
+ MBEDTLS_MPI_CHK( mbedtls_mpi_sub_mpi( &T, &TP, &TQ ) );
+ MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &TP, &T, &ctx->QP ) );
+ MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &T, &TP, &ctx->P ) );
/*
- * T = T2 + T * Q
+ * T = TQ + T * Q
*/
- MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &T1, &T, &ctx->Q ) );
- MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( &T, &T2, &T1 ) );
+ MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &TP, &T, &ctx->Q ) );
+ MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( &T, &TQ, &TP ) );
#endif /* MBEDTLS_RSA_NO_CRT */
if( f_rng != NULL )
@@ -904,6 +941,15 @@ int mbedtls_rsa_private( mbedtls_rsa_context *ctx,
MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &T, &T, &ctx->N ) );
}
+ /* Verify the result to prevent glitching attacks. */
+ MBEDTLS_MPI_CHK( mbedtls_mpi_exp_mod( &C, &T, &ctx->E,
+ &ctx->N, &ctx->RN ) );
+ if( mbedtls_mpi_cmp_mpi( &C, &I ) != 0 )
+ {
+ ret = MBEDTLS_ERR_RSA_VERIFY_FAILED;
+ goto cleanup;
+ }
+
olen = ctx->len;
MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &T, output, olen ) );
@@ -913,8 +959,9 @@ cleanup:
return( MBEDTLS_ERR_THREADING_MUTEX_ERROR );
#endif
- mbedtls_mpi_free( &T ); mbedtls_mpi_free( &T1 ); mbedtls_mpi_free( &T2 );
- mbedtls_mpi_free( &P1 ); mbedtls_mpi_free( &Q1 ); mbedtls_mpi_free( &R );
+ mbedtls_mpi_free( &P1 );
+ mbedtls_mpi_free( &Q1 );
+ mbedtls_mpi_free( &R );
if( f_rng != NULL )
{
@@ -926,6 +973,15 @@ cleanup:
#endif
}
+ mbedtls_mpi_free( &T );
+
+#if !defined(MBEDTLS_RSA_NO_CRT)
+ mbedtls_mpi_free( &TP ); mbedtls_mpi_free( &TQ );
+#endif
+
+ mbedtls_mpi_free( &C );
+ mbedtls_mpi_free( &I );
+
if( ret != 0 )
return( MBEDTLS_ERR_RSA_PRIVATE_FAILED + ret );
@@ -2222,7 +2278,8 @@ int mbedtls_rsa_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( 1 );
+ ret = 1;
+ goto cleanup;
}
if( verbose != 0 )
@@ -2237,7 +2294,8 @@ int mbedtls_rsa_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( 1 );
+ ret = 1;
+ goto cleanup;
}
if( verbose != 0 )
@@ -2250,7 +2308,8 @@ int mbedtls_rsa_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( 1 );
+ ret = 1;
+ goto cleanup;
}
if( memcmp( rsa_decrypted, rsa_plaintext, len ) != 0 )
@@ -2258,7 +2317,8 @@ int mbedtls_rsa_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( 1 );
+ ret = 1;
+ goto cleanup;
}
if( verbose != 0 )
@@ -2283,7 +2343,8 @@ int mbedtls_rsa_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( 1 );
+ ret = 1;
+ goto cleanup;
}
if( verbose != 0 )
@@ -2296,7 +2357,8 @@ int mbedtls_rsa_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( "failed\n" );
- return( 1 );
+ ret = 1;
+ goto cleanup;
}
if( verbose != 0 )
diff --git a/thirdparty/mbedtls/library/sha1.c b/thirdparty/mbedtls/library/sha1.c
index 8432eba8bd..1f29a0fbf8 100644
--- a/thirdparty/mbedtls/library/sha1.c
+++ b/thirdparty/mbedtls/library/sha1.c
@@ -111,6 +111,13 @@ int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha1_starts( mbedtls_sha1_context *ctx )
+{
+ mbedtls_sha1_starts_ret( ctx );
+}
+#endif
+
#if !defined(MBEDTLS_SHA1_PROCESS_ALT)
int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
const unsigned char data[64] )
@@ -270,6 +277,14 @@ int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
+ const unsigned char data[64] )
+{
+ mbedtls_internal_sha1_process( ctx, data );
+}
+#endif
#endif /* !MBEDTLS_SHA1_PROCESS_ALT */
/*
@@ -322,6 +337,15 @@ int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_sha1_update_ret( ctx, input, ilen );
+}
+#endif
+
static const unsigned char sha1_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -365,6 +389,14 @@ int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
+ unsigned char output[20] )
+{
+ mbedtls_sha1_finish_ret( ctx, output );
+}
+#endif
+
#endif /* !MBEDTLS_SHA1_ALT */
/*
@@ -394,6 +426,15 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha1( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[20] )
+{
+ mbedtls_sha1_ret( input, ilen, output );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
* FIPS-180-1 test vectors
diff --git a/thirdparty/mbedtls/library/sha256.c b/thirdparty/mbedtls/library/sha256.c
index abcd64d134..f39bcbab6c 100644
--- a/thirdparty/mbedtls/library/sha256.c
+++ b/thirdparty/mbedtls/library/sha256.c
@@ -135,6 +135,14 @@ int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
+ int is224 )
+{
+ mbedtls_sha256_starts_ret( ctx, is224 );
+}
+#endif
+
#if !defined(MBEDTLS_SHA256_PROCESS_ALT)
static const uint32_t K[] =
{
@@ -238,6 +246,14 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
+ const unsigned char data[64] )
+{
+ mbedtls_internal_sha256_process( ctx, data );
+}
+#endif
#endif /* !MBEDTLS_SHA256_PROCESS_ALT */
/*
@@ -290,6 +306,15 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_sha256_update_ret( ctx, input, ilen );
+}
+#endif
+
static const unsigned char sha256_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -339,6 +364,14 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
+ unsigned char output[32] )
+{
+ mbedtls_sha256_finish_ret( ctx, output );
+}
+#endif
+
#endif /* !MBEDTLS_SHA256_ALT */
/*
@@ -369,6 +402,16 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha256( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[32],
+ int is224 )
+{
+ mbedtls_sha256_ret( input, ilen, output, is224 );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
* FIPS-180-2 test vectors
diff --git a/thirdparty/mbedtls/library/sha512.c b/thirdparty/mbedtls/library/sha512.c
index c99b6da950..97cee07c56 100644
--- a/thirdparty/mbedtls/library/sha512.c
+++ b/thirdparty/mbedtls/library/sha512.c
@@ -149,6 +149,14 @@ int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 )
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
+ int is384 )
+{
+ mbedtls_sha512_starts_ret( ctx, is384 );
+}
+#endif
+
#if !defined(MBEDTLS_SHA512_PROCESS_ALT)
/*
@@ -269,6 +277,14 @@ int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
return( 0 );
}
+
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha512_process( mbedtls_sha512_context *ctx,
+ const unsigned char data[128] )
+{
+ mbedtls_internal_sha512_process( ctx, data );
+}
+#endif
#endif /* !MBEDTLS_SHA512_PROCESS_ALT */
/*
@@ -320,6 +336,15 @@ int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
+ const unsigned char *input,
+ size_t ilen )
+{
+ mbedtls_sha512_update_ret( ctx, input, ilen );
+}
+#endif
+
static const unsigned char sha512_padding[128] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -375,6 +400,14 @@ int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
return( 0 );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
+ unsigned char output[64] )
+{
+ mbedtls_sha512_finish_ret( ctx, output );
+}
+#endif
+
#endif /* !MBEDTLS_SHA512_ALT */
/*
@@ -405,6 +438,16 @@ exit:
return( ret );
}
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
+void mbedtls_sha512( const unsigned char *input,
+ size_t ilen,
+ unsigned char output[64],
+ int is384 )
+{
+ mbedtls_sha512_ret( input, ilen, output, is384 );
+}
+#endif
+
#if defined(MBEDTLS_SELF_TEST)
/*
diff --git a/thirdparty/mbedtls/library/ssl_cli.c b/thirdparty/mbedtls/library/ssl_cli.c
index 2534346a49..88864b8136 100644
--- a/thirdparty/mbedtls/library/ssl_cli.c
+++ b/thirdparty/mbedtls/library/ssl_cli.c
@@ -902,6 +902,8 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
*p++ = (unsigned char)( ciphersuites[i] );
}
+ MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, got %d ciphersuites (excluding SCSVs)", n ) );
+
/*
* Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV
*/
@@ -909,6 +911,7 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE )
#endif
{
+ MBEDTLS_SSL_DEBUG_MSG( 3, ( "adding EMPTY_RENEGOTIATION_INFO_SCSV" ) );
*p++ = (unsigned char)( MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO >> 8 );
*p++ = (unsigned char)( MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO );
n++;
@@ -928,8 +931,6 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
*q++ = (unsigned char)( n >> 7 );
*q++ = (unsigned char)( n << 1 );
- MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, got %d ciphersuites", n ) );
-
#if defined(MBEDTLS_ZLIB_SUPPORT)
offer_compress = 1;
#else
@@ -2057,10 +2058,16 @@ static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,
*
* opaque psk_identity_hint<0..2^16-1>;
*/
+ if( (*p) > end - 2 )
+ {
+ MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
+ "(psk_identity_hint length)" ) );
+ return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
+ }
len = (*p)[0] << 8 | (*p)[1];
*p += 2;
- if( (*p) + len > end )
+ if( (*p) > end - len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
"(psk_identity_hint length)" ) );
@@ -2478,10 +2485,18 @@ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
/*
* Read signature
*/
+
+ if( p > end - 2 )
+ {
+ MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
+ mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
+ MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
+ return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
+ }
sig_len = ( p[0] << 8 ) | p[1];
p += 2;
- if( end != p + sig_len )
+ if( p != end - sig_len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
diff --git a/thirdparty/mbedtls/library/ssl_tls.c b/thirdparty/mbedtls/library/ssl_tls.c
index 617dedb1b0..236e52d767 100644
--- a/thirdparty/mbedtls/library/ssl_tls.c
+++ b/thirdparty/mbedtls/library/ssl_tls.c
@@ -501,6 +501,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
unsigned char *key2;
unsigned char *mac_enc;
unsigned char *mac_dec;
+ size_t mac_key_len;
size_t iv_copy_len;
const mbedtls_cipher_info_t *cipher_info;
const mbedtls_md_info_t *md_info;
@@ -692,6 +693,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
cipher_info->mode == MBEDTLS_MODE_CCM )
{
transform->maclen = 0;
+ mac_key_len = 0;
transform->ivlen = 12;
transform->fixed_ivlen = 4;
@@ -712,7 +714,8 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
}
/* Get MAC length */
- transform->maclen = mbedtls_md_get_size( md_info );
+ mac_key_len = mbedtls_md_get_size( md_info );
+ transform->maclen = mac_key_len;
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
/*
@@ -721,7 +724,16 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
* so we only need to adjust the length here.
*/
if( session->trunc_hmac == MBEDTLS_SSL_TRUNC_HMAC_ENABLED )
+ {
transform->maclen = MBEDTLS_SSL_TRUNCATED_HMAC_LEN;
+
+#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT)
+ /* Fall back to old, non-compliant version of the truncated
+ * HMAC implementation which also truncates the key
+ * (Mbed TLS versions from 1.3 to 2.6.0) */
+ mac_key_len = transform->maclen;
+#endif
+ }
#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
/* IV length */
@@ -783,11 +795,11 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_CLI_C)
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
{
- key1 = keyblk + transform->maclen * 2;
- key2 = keyblk + transform->maclen * 2 + transform->keylen;
+ key1 = keyblk + mac_key_len * 2;
+ key2 = keyblk + mac_key_len * 2 + transform->keylen;
mac_enc = keyblk;
- mac_dec = keyblk + transform->maclen;
+ mac_dec = keyblk + mac_key_len;
/*
* This is not used in TLS v1.1.
@@ -803,10 +815,10 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_SRV_C)
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER )
{
- key1 = keyblk + transform->maclen * 2 + transform->keylen;
- key2 = keyblk + transform->maclen * 2;
+ key1 = keyblk + mac_key_len * 2 + transform->keylen;
+ key2 = keyblk + mac_key_len * 2;
- mac_enc = keyblk + transform->maclen;
+ mac_enc = keyblk + mac_key_len;
mac_dec = keyblk;
/*
@@ -828,14 +840,14 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_PROTO_SSL3)
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 )
{
- if( transform->maclen > sizeof transform->mac_enc )
+ if( mac_key_len > sizeof transform->mac_enc )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
- memcpy( transform->mac_enc, mac_enc, transform->maclen );
- memcpy( transform->mac_dec, mac_dec, transform->maclen );
+ memcpy( transform->mac_enc, mac_enc, mac_key_len );
+ memcpy( transform->mac_dec, mac_dec, mac_key_len );
}
else
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
@@ -843,8 +855,8 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
defined(MBEDTLS_SSL_PROTO_TLS1_2)
if( ssl->minor_ver >= MBEDTLS_SSL_MINOR_VERSION_1 )
{
- mbedtls_md_hmac_starts( &transform->md_ctx_enc, mac_enc, transform->maclen );
- mbedtls_md_hmac_starts( &transform->md_ctx_dec, mac_dec, transform->maclen );
+ mbedtls_md_hmac_starts( &transform->md_ctx_enc, mac_enc, mac_key_len );
+ mbedtls_md_hmac_starts( &transform->md_ctx_dec, mac_dec, mac_key_len );
}
else
#endif
@@ -864,7 +876,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
transform->iv_enc, transform->iv_dec,
iv_copy_len,
mac_enc, mac_dec,
- transform->maclen ) ) != 0 )
+ mac_key_len ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_hw_record_init", ret );
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
@@ -877,7 +889,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
{
ssl->conf->f_export_keys( ssl->conf->p_export_keys,
session->master, keyblk,
- transform->maclen, transform->keylen,
+ mac_key_len, transform->keylen,
iv_copy_len );
}
#endif
@@ -7673,8 +7685,14 @@ int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
* Default
*/
default:
- conf->min_major_ver = MBEDTLS_SSL_MAJOR_VERSION_3;
- conf->min_minor_ver = MBEDTLS_SSL_MINOR_VERSION_1; /* TLS 1.0 */
+ conf->min_major_ver = ( MBEDTLS_SSL_MIN_MAJOR_VERSION >
+ MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION ) ?
+ MBEDTLS_SSL_MIN_MAJOR_VERSION :
+ MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION;
+ conf->min_minor_ver = ( MBEDTLS_SSL_MIN_MINOR_VERSION >
+ MBEDTLS_SSL_MIN_VALID_MINOR_VERSION ) ?
+ MBEDTLS_SSL_MIN_MINOR_VERSION :
+ MBEDTLS_SSL_MIN_VALID_MINOR_VERSION;
conf->max_major_ver = MBEDTLS_SSL_MAX_MAJOR_VERSION;
conf->max_minor_ver = MBEDTLS_SSL_MAX_MINOR_VERSION;
diff --git a/thirdparty/mbedtls/library/version.c b/thirdparty/mbedtls/library/version.c
index 6ca80d4695..fd96750885 100644
--- a/thirdparty/mbedtls/library/version.c
+++ b/thirdparty/mbedtls/library/version.c
@@ -30,7 +30,7 @@
#include "mbedtls/version.h"
#include <string.h>
-unsigned int mbedtls_version_get_number()
+unsigned int mbedtls_version_get_number( void )
{
return( MBEDTLS_VERSION_NUMBER );
}
diff --git a/thirdparty/mbedtls/library/version_features.c b/thirdparty/mbedtls/library/version_features.c
index 72afec2da0..da47e3d753 100644
--- a/thirdparty/mbedtls/library/version_features.c
+++ b/thirdparty/mbedtls/library/version_features.c
@@ -468,6 +468,9 @@ static const char *features[] = {
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
"MBEDTLS_SSL_TRUNCATED_HMAC",
#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
+#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT)
+ "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT",
+#endif /* MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT */
#if defined(MBEDTLS_THREADING_ALT)
"MBEDTLS_THREADING_ALT",
#endif /* MBEDTLS_THREADING_ALT */
diff --git a/thirdparty/mbedtls/library/x509_crl.c b/thirdparty/mbedtls/library/x509_crl.c
index 55d12acd03..b0f39d428b 100644
--- a/thirdparty/mbedtls/library/x509_crl.c
+++ b/thirdparty/mbedtls/library/x509_crl.c
@@ -95,17 +95,23 @@ static int x509_crl_get_version( unsigned char **p,
}
/*
- * X.509 CRL v2 extensions (no extensions parsed yet.)
+ * X.509 CRL v2 extensions
+ *
+ * We currently don't parse any extension's content, but we do check that the
+ * list of extensions is well-formed and abort on critical extensions (that
+ * are unsupported as we don't support any extension so far)
*/
static int x509_get_crl_ext( unsigned char **p,
const unsigned char *end,
mbedtls_x509_buf *ext )
{
int ret;
- size_t len = 0;
- /* Get explicit tag */
- if( ( ret = mbedtls_x509_get_ext( p, end, ext, 0) ) != 0 )
+ /*
+ * crlExtensions [0] EXPLICIT Extensions OPTIONAL
+ * -- if present, version MUST be v2
+ */
+ if( ( ret = mbedtls_x509_get_ext( p, end, ext, 0 ) ) != 0 )
{
if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG )
return( 0 );
@@ -115,11 +121,54 @@ static int x509_get_crl_ext( unsigned char **p,
while( *p < end )
{
+ /*
+ * Extension ::= SEQUENCE {
+ * extnID OBJECT IDENTIFIER,
+ * critical BOOLEAN DEFAULT FALSE,
+ * extnValue OCTET STRING }
+ */
+ int is_critical = 0;
+ const unsigned char *end_ext_data;
+ size_t len;
+
+ /* Get enclosing sequence tag */
if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
+ end_ext_data = *p + len;
+
+ /* Get OID (currently ignored) */
+ if( ( ret = mbedtls_asn1_get_tag( p, end_ext_data, &len,
+ MBEDTLS_ASN1_OID ) ) != 0 )
+ {
+ return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
+ }
+ *p += len;
+
+ /* Get optional critical */
+ if( ( ret = mbedtls_asn1_get_bool( p, end_ext_data,
+ &is_critical ) ) != 0 &&
+ ( ret != MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) )
+ {
+ return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
+ }
+
+ /* Data should be octet string type */
+ if( ( ret = mbedtls_asn1_get_tag( p, end_ext_data, &len,
+ MBEDTLS_ASN1_OCTET_STRING ) ) != 0 )
+ return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
+
+ /* Ignore data so far and just check its length */
*p += len;
+ if( *p != end_ext_data )
+ return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
+ MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
+
+ /* Abort on (unsupported) critical extensions */
+ if( is_critical )
+ return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
+ MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );
}
if( *p != end )
@@ -257,7 +306,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
{
int ret;
size_t len;
- unsigned char *p, *end;
+ unsigned char *p = NULL, *end = NULL;
mbedtls_x509_buf sig_params1, sig_params2, sig_oid2;
mbedtls_x509_crl *crl = chain;
@@ -294,7 +343,11 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
/*
* Copy raw DER-encoded CRL
*/
- if( ( p = mbedtls_calloc( 1, buflen ) ) == NULL )
+ if( buflen == 0 )
+ return( MBEDTLS_ERR_X509_INVALID_FORMAT );
+
+ p = mbedtls_calloc( 1, buflen );
+ if( p == NULL )
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
memcpy( p, buf, buflen );
diff --git a/thirdparty/mbedtls/library/x509_crt.c b/thirdparty/mbedtls/library/x509_crt.c
index 6c592fdb5a..2a5dbb8783 100644
--- a/thirdparty/mbedtls/library/x509_crt.c
+++ b/thirdparty/mbedtls/library/x509_crt.c
@@ -62,16 +62,17 @@
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
#include <windows.h>
-#if _MSC_VER <= 1600
-/* Visual Studio 2010 and earlier issue a warning when both <stdint.h> and <intsafe.h> are included, as they
- * redefine a number of <TYPE>_MAX constants. These constants are guaranteed to be the same, though, so
- * we suppress the warning when including intsafe.h.
+#if defined(_MSC_VER) && _MSC_VER <= 1600
+/* Visual Studio 2010 and earlier issue a warning when both <stdint.h> and
+ * <intsafe.h> are included, as they redefine a number of <TYPE>_MAX constants.
+ * These constants are guaranteed to be the same, though, so we suppress the
+ * warning when including intsafe.h.
*/
#pragma warning( push )
#pragma warning( disable : 4005 )
#endif
#include <intsafe.h>
-#if _MSC_VER <= 1600
+#if defined(_MSC_VER) && _MSC_VER <= 1600
#pragma warning( pop )
#endif
#else
@@ -145,7 +146,8 @@ const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb =
MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |
MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ),
/* Only ECDSA */
- MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_ECDSA ),
+ MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_ECDSA ) |
+ MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_ECKEY ),
#if defined(MBEDTLS_ECP_C)
/* Only NIST P-256 and P-384 */
MBEDTLS_X509_ID_FLAG( MBEDTLS_ECP_DP_SECP256R1 ) |
@@ -484,9 +486,12 @@ static int x509_get_subject_alt_name( unsigned char **p,
if( ( ret = mbedtls_asn1_get_len( p, end, &tag_len ) ) != 0 )
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
- if( ( tag & MBEDTLS_ASN1_CONTEXT_SPECIFIC ) != MBEDTLS_ASN1_CONTEXT_SPECIFIC )
+ if( ( tag & MBEDTLS_ASN1_TAG_CLASS_MASK ) !=
+ MBEDTLS_ASN1_CONTEXT_SPECIFIC )
+ {
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );
+ }
/* Skip everything but DNS name */
if( tag != ( MBEDTLS_ASN1_CONTEXT_SPECIFIC | 2 ) )
@@ -1140,6 +1145,14 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
if ( FAILED ( SizeTToInt( len, &lengthAsInt ) ) )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
+ /*
+ * Note this function uses the code page CP_ACP, and assumes the incoming
+ * string is encoded in ANSI, before translating it into Unicode. If the
+ * incoming string were changed to be UTF-8, then the length check needs to
+ * change to check the number of characters, not the number of bytes, in the
+ * incoming string are less than MAX_PATH to avoid a buffer overrun with
+ * MultiByteToWideChar().
+ */
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, lengthAsInt, szDir,
MAX_PATH - 3 );
if( w_ret == 0 )
diff --git a/thirdparty/miniupnpc/LICENSE b/thirdparty/miniupnpc/LICENSE
new file mode 100644
index 0000000000..0816733704
--- /dev/null
+++ b/thirdparty/miniupnpc/LICENSE
@@ -0,0 +1,27 @@
+MiniUPnPc
+Copyright (c) 2005-2016, Thomas BERNARD
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/thirdparty/miniupnpc/codelength.h b/thirdparty/miniupnpc/codelength.h
new file mode 100644
index 0000000000..ea0b005ffe
--- /dev/null
+++ b/thirdparty/miniupnpc/codelength.h
@@ -0,0 +1,54 @@
+/* $Id: codelength.h,v 1.3 2011/07/30 13:10:05 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2015 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#ifndef CODELENGTH_H_INCLUDED
+#define CODELENGTH_H_INCLUDED
+
+/* Encode length by using 7bit per Byte :
+ * Most significant bit of each byte specifies that the
+ * following byte is part of the code */
+
+/* n : unsigned
+ * p : unsigned char *
+ */
+#define DECODELENGTH(n, p) n = 0; \
+ do { n = (n << 7) | (*p & 0x7f); } \
+ while((*(p++)&0x80) && (n<(1<<25)));
+
+/* n : unsigned
+ * READ : function/macro to read one byte (unsigned char)
+ */
+#define DECODELENGTH_READ(n, READ) \
+ n = 0; \
+ do { \
+ unsigned char c; \
+ READ(c); \
+ n = (n << 7) | (c & 0x07f); \
+ if(!(c&0x80)) break; \
+ } while(n<(1<<25));
+
+/* n : unsigned
+ * p : unsigned char *
+ * p_limit : unsigned char *
+ */
+#define DECODELENGTH_CHECKLIMIT(n, p, p_limit) \
+ n = 0; \
+ do { \
+ if((p) >= (p_limit)) break; \
+ n = (n << 7) | (*(p) & 0x7f); \
+ } while((*((p)++)&0x80) && (n<(1<<25)));
+
+
+/* n : unsigned
+ * p : unsigned char *
+ */
+#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \
+ if(n>=2097152) *(p++) = (n >> 21) | 0x80; \
+ if(n>=16384) *(p++) = (n >> 14) | 0x80; \
+ if(n>=128) *(p++) = (n >> 7) | 0x80; \
+ *(p++) = n & 0x7f;
+
+#endif /* CODELENGTH_H_INCLUDED */
diff --git a/thirdparty/miniupnpc/connecthostport.c b/thirdparty/miniupnpc/connecthostport.c
new file mode 100644
index 0000000000..ea6e4e5943
--- /dev/null
+++ b/thirdparty/miniupnpc/connecthostport.c
@@ -0,0 +1,264 @@
+/* $Id: connecthostport.c,v 1.15 2015/10/09 16:26:19 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2010-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+
+/* use getaddrinfo() or gethostbyname()
+ * uncomment the following line in order to use gethostbyname() */
+#ifdef NO_GETADDRINFO
+#define USE_GETHOSTBYNAME
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <io.h>
+#define MAXHOSTNAMELEN 64
+#define snprintf _snprintf
+#define herror
+#define socklen_t int
+#else /* #ifdef _WIN32 */
+#include <unistd.h>
+#include <sys/types.h>
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+#include <sys/time.h>
+#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
+#include <sys/param.h>
+#include <sys/select.h>
+#include <errno.h>
+#define closesocket close
+#include <netdb.h>
+#include <netinet/in.h>
+/* defining MINIUPNPC_IGNORE_EINTR enable the ignore of interruptions
+ * during the connect() call */
+#define MINIUPNPC_IGNORE_EINTR
+#include <sys/socket.h>
+#include <sys/select.h>
+#endif /* #else _WIN32 */
+
+/* definition of PRINT_SOCKET_ERROR */
+#ifdef _WIN32
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
+#else
+#define PRINT_SOCKET_ERROR(x) perror(x)
+#endif
+
+#if defined(__amigaos__) || defined(__amigaos4__)
+#define herror(A) printf("%s\n", A)
+#endif
+
+#include "connecthostport.h"
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 64
+#endif
+
+/* connecthostport()
+ * return a socket connected (TCP) to the host and port
+ * or -1 in case of error */
+SOCKET connecthostport(const char * host, unsigned short port,
+ unsigned int scope_id)
+{
+ SOCKET s;
+ int n;
+#ifdef USE_GETHOSTBYNAME
+ struct sockaddr_in dest;
+ struct hostent *hp;
+#else /* #ifdef USE_GETHOSTBYNAME */
+ char tmp_host[MAXHOSTNAMELEN+1];
+ char port_str[8];
+ struct addrinfo *ai, *p;
+ struct addrinfo hints;
+#endif /* #ifdef USE_GETHOSTBYNAME */
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ struct timeval timeout;
+#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
+
+#ifdef USE_GETHOSTBYNAME
+ hp = gethostbyname(host);
+ if(hp == NULL)
+ {
+ herror(host);
+ return INVALID_SOCKET;
+ }
+ memcpy(&dest.sin_addr, hp->h_addr, sizeof(dest.sin_addr));
+ memset(dest.sin_zero, 0, sizeof(dest.sin_zero));
+ s = socket(PF_INET, SOCK_STREAM, 0);
+ if(ISINVALID(s))
+ {
+ PRINT_SOCKET_ERROR("socket");
+ return INVALID_SOCKET;
+ }
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ /* setting a 3 seconds timeout for the connect() call */
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt SO_RCVTIMEO");
+ }
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt SO_SNDTIMEO");
+ }
+#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
+ dest.sin_family = AF_INET;
+ dest.sin_port = htons(port);
+ n = connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr_in));
+#ifdef MINIUPNPC_IGNORE_EINTR
+ /* EINTR The system call was interrupted by a signal that was caught
+ * EINPROGRESS The socket is nonblocking and the connection cannot
+ * be completed immediately. */
+ while(n < 0 && (errno == EINTR || errno == EINPROGRESS))
+ {
+ socklen_t len;
+ fd_set wset;
+ int err;
+ FD_ZERO(&wset);
+ FD_SET(s, &wset);
+ if((n = select(s + 1, NULL, &wset, NULL, NULL)) == -1 && errno == EINTR)
+ continue;
+ /*len = 0;*/
+ /*n = getpeername(s, NULL, &len);*/
+ len = sizeof(err);
+ if(getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
+ PRINT_SOCKET_ERROR("getsockopt");
+ closesocket(s);
+ return INVALID_SOCKET;
+ }
+ if(err != 0) {
+ errno = err;
+ n = -1;
+ }
+ }
+#endif /* #ifdef MINIUPNPC_IGNORE_EINTR */
+ if(n<0)
+ {
+ PRINT_SOCKET_ERROR("connect");
+ closesocket(s);
+ return INVALID_SOCKET;
+ }
+#else /* #ifdef USE_GETHOSTBYNAME */
+ /* use getaddrinfo() instead of gethostbyname() */
+ memset(&hints, 0, sizeof(hints));
+ /* hints.ai_flags = AI_ADDRCONFIG; */
+#ifdef AI_NUMERICSERV
+ hints.ai_flags = AI_NUMERICSERV;
+#endif
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_family = AF_UNSPEC; /* AF_INET, AF_INET6 or AF_UNSPEC */
+ /* hints.ai_protocol = IPPROTO_TCP; */
+ snprintf(port_str, sizeof(port_str), "%hu", port);
+ if(host[0] == '[')
+ {
+ /* literal ip v6 address */
+ int i, j;
+ for(i = 0, j = 1; host[j] && (host[j] != ']') && i < MAXHOSTNAMELEN; i++, j++)
+ {
+ tmp_host[i] = host[j];
+ if(0 == memcmp(host+j, "%25", 3)) /* %25 is just url encoding for '%' */
+ j+=2; /* skip "25" */
+ }
+ tmp_host[i] = '\0';
+ }
+ else
+ {
+ strncpy(tmp_host, host, MAXHOSTNAMELEN);
+ }
+ tmp_host[MAXHOSTNAMELEN] = '\0';
+ n = getaddrinfo(tmp_host, port_str, &hints, &ai);
+ if(n != 0)
+ {
+#ifdef _WIN32
+ fprintf(stderr, "getaddrinfo() error : %d\n", n);
+#else
+ fprintf(stderr, "getaddrinfo() error : %s\n", gai_strerror(n));
+#endif
+ return INVALID_SOCKET;
+ }
+ s = -1;
+ for(p = ai; p; p = p->ai_next)
+ {
+ s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
+ if(ISINVALID(s))
+ continue;
+ if(p->ai_addr->sa_family == AF_INET6 && scope_id > 0) {
+ struct sockaddr_in6 * addr6 = (struct sockaddr_in6 *)p->ai_addr;
+ addr6->sin6_scope_id = scope_id;
+ }
+#ifdef MINIUPNPC_SET_SOCKET_TIMEOUT
+ /* setting a 3 seconds timeout for the connect() call */
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt");
+ }
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt");
+ }
+#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
+ n = connect(s, p->ai_addr, p->ai_addrlen);
+#ifdef MINIUPNPC_IGNORE_EINTR
+ /* EINTR The system call was interrupted by a signal that was caught
+ * EINPROGRESS The socket is nonblocking and the connection cannot
+ * be completed immediately. */
+ while(n < 0 && (errno == EINTR || errno == EINPROGRESS))
+ {
+ socklen_t len;
+ fd_set wset;
+ int err;
+ FD_ZERO(&wset);
+ FD_SET(s, &wset);
+ if((n = select(s + 1, NULL, &wset, NULL, NULL)) == -1 && errno == EINTR)
+ continue;
+ /*len = 0;*/
+ /*n = getpeername(s, NULL, &len);*/
+ len = sizeof(err);
+ if(getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
+ PRINT_SOCKET_ERROR("getsockopt");
+ closesocket(s);
+ freeaddrinfo(ai);
+ return INVALID_SOCKET;
+ }
+ if(err != 0) {
+ errno = err;
+ n = -1;
+ }
+ }
+#endif /* #ifdef MINIUPNPC_IGNORE_EINTR */
+ if(n < 0)
+ {
+ closesocket(s);
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ freeaddrinfo(ai);
+ if(ISINVALID(s))
+ {
+ PRINT_SOCKET_ERROR("socket");
+ return INVALID_SOCKET;
+ }
+ if(n < 0)
+ {
+ PRINT_SOCKET_ERROR("connect");
+ return INVALID_SOCKET;
+ }
+#endif /* #ifdef USE_GETHOSTBYNAME */
+ return s;
+}
+
diff --git a/thirdparty/miniupnpc/connecthostport.h b/thirdparty/miniupnpc/connecthostport.h
new file mode 100644
index 0000000000..701816b5b6
--- /dev/null
+++ b/thirdparty/miniupnpc/connecthostport.h
@@ -0,0 +1,20 @@
+/* $Id: connecthostport.h,v 1.2 2012/06/23 22:32:33 nanard Exp $ */
+/* Project: miniupnp
+ * http://miniupnp.free.fr/
+ * Author: Thomas Bernard
+ * Copyright (c) 2010-2018 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef CONNECTHOSTPORT_H_INCLUDED
+#define CONNECTHOSTPORT_H_INCLUDED
+
+#include "miniupnpc_socketdef.h"
+
+/* connecthostport()
+ * return a socket connected (TCP) to the host and port
+ * or INVALID_SOCKET in case of error */
+SOCKET connecthostport(const char * host, unsigned short port,
+ unsigned int scope_id);
+
+#endif
+
diff --git a/thirdparty/miniupnpc/igd_desc_parse.c b/thirdparty/miniupnpc/igd_desc_parse.c
new file mode 100644
index 0000000000..d2999ad011
--- /dev/null
+++ b/thirdparty/miniupnpc/igd_desc_parse.c
@@ -0,0 +1,123 @@
+/* $Id: igd_desc_parse.c,v 1.17 2015/09/15 13:30:04 nanard Exp $ */
+/* Project : miniupnp
+ * http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2015 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+
+#include "igd_desc_parse.h"
+#include <stdio.h>
+#include <string.h>
+
+/* Start element handler :
+ * update nesting level counter and copy element name */
+void IGDstartelt(void * d, const char * name, int l)
+{
+ struct IGDdatas * datas = (struct IGDdatas *)d;
+ if(l >= MINIUPNPC_URL_MAXSIZE)
+ l = MINIUPNPC_URL_MAXSIZE-1;
+ memcpy(datas->cureltname, name, l);
+ datas->cureltname[l] = '\0';
+ datas->level++;
+ if( (l==7) && !memcmp(name, "service", l) ) {
+ datas->tmp.controlurl[0] = '\0';
+ datas->tmp.eventsuburl[0] = '\0';
+ datas->tmp.scpdurl[0] = '\0';
+ datas->tmp.servicetype[0] = '\0';
+ }
+}
+
+#define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1))
+
+/* End element handler :
+ * update nesting level counter and update parser state if
+ * service element is parsed */
+void IGDendelt(void * d, const char * name, int l)
+{
+ struct IGDdatas * datas = (struct IGDdatas *)d;
+ datas->level--;
+ /*printf("endelt %2d %.*s\n", datas->level, l, name);*/
+ if( (l==7) && !memcmp(name, "service", l) )
+ {
+ if(COMPARE(datas->tmp.servicetype,
+ "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:")) {
+ memcpy(&datas->CIF, &datas->tmp, sizeof(struct IGDdatas_service));
+ } else if(COMPARE(datas->tmp.servicetype,
+ "urn:schemas-upnp-org:service:WANIPv6FirewallControl:")) {
+ memcpy(&datas->IPv6FC, &datas->tmp, sizeof(struct IGDdatas_service));
+ } else if(COMPARE(datas->tmp.servicetype,
+ "urn:schemas-upnp-org:service:WANIPConnection:")
+ || COMPARE(datas->tmp.servicetype,
+ "urn:schemas-upnp-org:service:WANPPPConnection:") ) {
+ if(datas->first.servicetype[0] == '\0') {
+ memcpy(&datas->first, &datas->tmp, sizeof(struct IGDdatas_service));
+ } else {
+ memcpy(&datas->second, &datas->tmp, sizeof(struct IGDdatas_service));
+ }
+ }
+ }
+}
+
+/* Data handler :
+ * copy data depending on the current element name and state */
+void IGDdata(void * d, const char * data, int l)
+{
+ struct IGDdatas * datas = (struct IGDdatas *)d;
+ char * dstmember = 0;
+ /*printf("%2d %s : %.*s\n",
+ datas->level, datas->cureltname, l, data); */
+ if( !strcmp(datas->cureltname, "URLBase") )
+ dstmember = datas->urlbase;
+ else if( !strcmp(datas->cureltname, "presentationURL") )
+ dstmember = datas->presentationurl;
+ else if( !strcmp(datas->cureltname, "serviceType") )
+ dstmember = datas->tmp.servicetype;
+ else if( !strcmp(datas->cureltname, "controlURL") )
+ dstmember = datas->tmp.controlurl;
+ else if( !strcmp(datas->cureltname, "eventSubURL") )
+ dstmember = datas->tmp.eventsuburl;
+ else if( !strcmp(datas->cureltname, "SCPDURL") )
+ dstmember = datas->tmp.scpdurl;
+/* else if( !strcmp(datas->cureltname, "deviceType") )
+ dstmember = datas->devicetype_tmp;*/
+ if(dstmember)
+ {
+ if(l>=MINIUPNPC_URL_MAXSIZE)
+ l = MINIUPNPC_URL_MAXSIZE-1;
+ memcpy(dstmember, data, l);
+ dstmember[l] = '\0';
+ }
+}
+
+#ifdef DEBUG
+void printIGD(struct IGDdatas * d)
+{
+ printf("urlbase = '%s'\n", d->urlbase);
+ printf("WAN Device (Common interface config) :\n");
+ /*printf(" deviceType = '%s'\n", d->CIF.devicetype);*/
+ printf(" serviceType = '%s'\n", d->CIF.servicetype);
+ printf(" controlURL = '%s'\n", d->CIF.controlurl);
+ printf(" eventSubURL = '%s'\n", d->CIF.eventsuburl);
+ printf(" SCPDURL = '%s'\n", d->CIF.scpdurl);
+ printf("primary WAN Connection Device (IP or PPP Connection):\n");
+ /*printf(" deviceType = '%s'\n", d->first.devicetype);*/
+ printf(" servicetype = '%s'\n", d->first.servicetype);
+ printf(" controlURL = '%s'\n", d->first.controlurl);
+ printf(" eventSubURL = '%s'\n", d->first.eventsuburl);
+ printf(" SCPDURL = '%s'\n", d->first.scpdurl);
+ printf("secondary WAN Connection Device (IP or PPP Connection):\n");
+ /*printf(" deviceType = '%s'\n", d->second.devicetype);*/
+ printf(" servicetype = '%s'\n", d->second.servicetype);
+ printf(" controlURL = '%s'\n", d->second.controlurl);
+ printf(" eventSubURL = '%s'\n", d->second.eventsuburl);
+ printf(" SCPDURL = '%s'\n", d->second.scpdurl);
+ printf("WAN IPv6 Firewall Control :\n");
+ /*printf(" deviceType = '%s'\n", d->IPv6FC.devicetype);*/
+ printf(" servicetype = '%s'\n", d->IPv6FC.servicetype);
+ printf(" controlURL = '%s'\n", d->IPv6FC.controlurl);
+ printf(" eventSubURL = '%s'\n", d->IPv6FC.eventsuburl);
+ printf(" SCPDURL = '%s'\n", d->IPv6FC.scpdurl);
+}
+#endif /* DEBUG */
+
diff --git a/thirdparty/miniupnpc/igd_desc_parse.h b/thirdparty/miniupnpc/igd_desc_parse.h
new file mode 100644
index 0000000000..0de546b697
--- /dev/null
+++ b/thirdparty/miniupnpc/igd_desc_parse.h
@@ -0,0 +1,49 @@
+/* $Id: igd_desc_parse.h,v 1.12 2014/11/17 17:19:13 nanard Exp $ */
+/* Project : miniupnp
+ * http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2014 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef IGD_DESC_PARSE_H_INCLUDED
+#define IGD_DESC_PARSE_H_INCLUDED
+
+/* Structure to store the result of the parsing of UPnP
+ * descriptions of Internet Gateway Devices */
+#define MINIUPNPC_URL_MAXSIZE (128)
+struct IGDdatas_service {
+ char controlurl[MINIUPNPC_URL_MAXSIZE];
+ char eventsuburl[MINIUPNPC_URL_MAXSIZE];
+ char scpdurl[MINIUPNPC_URL_MAXSIZE];
+ char servicetype[MINIUPNPC_URL_MAXSIZE];
+ /*char devicetype[MINIUPNPC_URL_MAXSIZE];*/
+};
+
+struct IGDdatas {
+ char cureltname[MINIUPNPC_URL_MAXSIZE];
+ char urlbase[MINIUPNPC_URL_MAXSIZE];
+ char presentationurl[MINIUPNPC_URL_MAXSIZE];
+ int level;
+ /*int state;*/
+ /* "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" */
+ struct IGDdatas_service CIF;
+ /* "urn:schemas-upnp-org:service:WANIPConnection:1"
+ * "urn:schemas-upnp-org:service:WANPPPConnection:1" */
+ struct IGDdatas_service first;
+ /* if both WANIPConnection and WANPPPConnection are present */
+ struct IGDdatas_service second;
+ /* "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1" */
+ struct IGDdatas_service IPv6FC;
+ /* tmp */
+ struct IGDdatas_service tmp;
+};
+
+void IGDstartelt(void *, const char *, int);
+void IGDendelt(void *, const char *, int);
+void IGDdata(void *, const char *, int);
+#ifdef DEBUG
+void printIGD(struct IGDdatas *);
+#endif /* DEBUG */
+
+#endif /* IGD_DESC_PARSE_H_INCLUDED */
diff --git a/thirdparty/miniupnpc/listdevices.c b/thirdparty/miniupnpc/listdevices.c
new file mode 100644
index 0000000000..bd9ba57efc
--- /dev/null
+++ b/thirdparty/miniupnpc/listdevices.c
@@ -0,0 +1,197 @@
+/* $Id: listdevices.c,v 1.6 2015/07/23 20:40:08 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2013-2015 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#endif /* _WIN32 */
+#include "miniupnpc.h"
+
+struct upnp_dev_list {
+ struct upnp_dev_list * next;
+ char * descURL;
+ struct UPNPDev * * array;
+ size_t count;
+ size_t allocated_count;
+};
+
+#define ADD_DEVICE_COUNT_STEP 16
+
+void add_device(struct upnp_dev_list * * list_head, struct UPNPDev * dev)
+{
+ struct upnp_dev_list * elt;
+ size_t i;
+
+ if(dev == NULL)
+ return;
+ for(elt = *list_head; elt != NULL; elt = elt->next) {
+ if(strcmp(elt->descURL, dev->descURL) == 0) {
+ for(i = 0; i < elt->count; i++) {
+ if (strcmp(elt->array[i]->st, dev->st) == 0 && strcmp(elt->array[i]->usn, dev->usn) == 0) {
+ return; /* already found */
+ }
+ }
+ if(elt->count >= elt->allocated_count) {
+ struct UPNPDev * * tmp;
+ elt->allocated_count += ADD_DEVICE_COUNT_STEP;
+ tmp = realloc(elt->array, elt->allocated_count * sizeof(struct UPNPDev *));
+ if(tmp == NULL) {
+ fprintf(stderr, "Failed to realloc(%p, %lu)\n", elt->array, (unsigned long)(elt->allocated_count * sizeof(struct UPNPDev *)));
+ return;
+ }
+ elt->array = tmp;
+ }
+ elt->array[elt->count++] = dev;
+ return;
+ }
+ }
+ elt = malloc(sizeof(struct upnp_dev_list));
+ if(elt == NULL) {
+ fprintf(stderr, "Failed to malloc(%lu)\n", (unsigned long)sizeof(struct upnp_dev_list));
+ return;
+ }
+ elt->next = *list_head;
+ elt->descURL = strdup(dev->descURL);
+ if(elt->descURL == NULL) {
+ fprintf(stderr, "Failed to strdup(%s)\n", dev->descURL);
+ free(elt);
+ return;
+ }
+ elt->allocated_count = ADD_DEVICE_COUNT_STEP;
+ elt->array = malloc(ADD_DEVICE_COUNT_STEP * sizeof(struct UPNPDev *));
+ if(elt->array == NULL) {
+ fprintf(stderr, "Failed to malloc(%lu)\n", (unsigned long)(ADD_DEVICE_COUNT_STEP * sizeof(struct UPNPDev *)));
+ free(elt->descURL);
+ free(elt);
+ return;
+ }
+ elt->array[0] = dev;
+ elt->count = 1;
+ *list_head = elt;
+}
+
+void free_device(struct upnp_dev_list * elt)
+{
+ free(elt->descURL);
+ free(elt->array);
+ free(elt);
+}
+
+int main(int argc, char * * argv)
+{
+ const char * searched_device = NULL;
+ const char * * searched_devices = NULL;
+ const char * multicastif = 0;
+ const char * minissdpdpath = 0;
+ int ipv6 = 0;
+ unsigned char ttl = 2;
+ int error = 0;
+ struct UPNPDev * devlist = 0;
+ struct UPNPDev * dev;
+ struct upnp_dev_list * sorted_list = NULL;
+ struct upnp_dev_list * dev_array;
+ int i;
+
+#ifdef _WIN32
+ WSADATA wsaData;
+ int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+ if(nResult != NO_ERROR)
+ {
+ fprintf(stderr, "WSAStartup() failed.\n");
+ return -1;
+ }
+#endif
+
+ for(i = 1; i < argc; i++) {
+ if(strcmp(argv[i], "-6") == 0)
+ ipv6 = 1;
+ else if(strcmp(argv[i], "-d") == 0) {
+ if(++i >= argc) {
+ fprintf(stderr, "%s option needs one argument\n", "-d");
+ return 1;
+ }
+ searched_device = argv[i];
+ } else if(strcmp(argv[i], "-t") == 0) {
+ if(++i >= argc) {
+ fprintf(stderr, "%s option needs one argument\n", "-t");
+ return 1;
+ }
+ ttl = (unsigned char)atoi(argv[i]);
+ } else if(strcmp(argv[i], "-l") == 0) {
+ if(++i >= argc) {
+ fprintf(stderr, "-l option needs at least one argument\n");
+ return 1;
+ }
+ searched_devices = (const char * *)(argv + i);
+ break;
+ } else if(strcmp(argv[i], "-m") == 0) {
+ if(++i >= argc) {
+ fprintf(stderr, "-m option needs one argument\n");
+ return 1;
+ }
+ multicastif = argv[i];
+ } else {
+ printf("usage : %s [options] [-l <device1> <device2> ...]\n", argv[0]);
+ printf("options :\n");
+ printf(" -6 : use IPv6\n");
+ printf(" -m address/ifname : network interface to use for multicast\n");
+ printf(" -d <device string> : search only for this type of device\n");
+ printf(" -l <device1> <device2> ... : search only for theses types of device\n");
+ printf(" -t ttl : set multicast TTL. Default value is 2.\n");
+ printf(" -h : this help\n");
+ return 1;
+ }
+ }
+
+ if(searched_device) {
+ printf("searching UPnP device type %s\n", searched_device);
+ devlist = upnpDiscoverDevice(searched_device,
+ 2000, multicastif, minissdpdpath,
+ 0/*localport*/, ipv6, ttl, &error);
+ } else if(searched_devices) {
+ printf("searching UPnP device types :\n");
+ for(i = 0; searched_devices[i]; i++)
+ printf("\t%s\n", searched_devices[i]);
+ devlist = upnpDiscoverDevices(searched_devices,
+ 2000, multicastif, minissdpdpath,
+ 0/*localport*/, ipv6, ttl, &error, 1);
+ } else {
+ printf("searching all UPnP devices\n");
+ devlist = upnpDiscoverAll(2000, multicastif, minissdpdpath,
+ 0/*localport*/, ipv6, ttl, &error);
+ }
+ if(devlist) {
+ for(dev = devlist, i = 1; dev != NULL; dev = dev->pNext, i++) {
+ printf("%3d: %-48s\n", i, dev->st);
+ printf(" %s\n", dev->descURL);
+ printf(" %s\n", dev->usn);
+ add_device(&sorted_list, dev);
+ }
+ putchar('\n');
+ for (dev_array = sorted_list; dev_array != NULL ; dev_array = dev_array->next) {
+ printf("%s :\n", dev_array->descURL);
+ for(i = 0; (unsigned)i < dev_array->count; i++) {
+ printf("%2d: %s\n", i+1, dev_array->array[i]->st);
+ printf(" %s\n", dev_array->array[i]->usn);
+ }
+ putchar('\n');
+ }
+ freeUPNPDevlist(devlist);
+ while(sorted_list != NULL) {
+ dev_array = sorted_list;
+ sorted_list = sorted_list->next;
+ free_device(dev_array);
+ }
+ } else {
+ printf("no device found.\n");
+ }
+
+ return 0;
+}
+
diff --git a/thirdparty/miniupnpc/minisoap.c b/thirdparty/miniupnpc/minisoap.c
new file mode 100644
index 0000000000..520c9302e8
--- /dev/null
+++ b/thirdparty/miniupnpc/minisoap.c
@@ -0,0 +1,124 @@
+/* $Id: minisoap.c,v 1.25 2017/04/21 10:03:24 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ *
+ * Minimal SOAP implementation for UPnP protocol.
+ */
+#include <stdio.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#include <winsock2.h>
+#define snprintf _snprintf
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#endif
+#include "minisoap.h"
+#include "miniupnpcstrings.h"
+
+/* only for malloc */
+#include <stdlib.h>
+
+#ifdef _WIN32
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
+#else
+#define PRINT_SOCKET_ERROR(x) perror(x)
+#endif
+
+/* httpWrite sends the headers and the body to the socket
+ * and returns the number of bytes sent */
+static int
+httpWrite(SOCKET fd, const char * body, int bodysize,
+ const char * headers, int headerssize)
+{
+ int n = 0;
+ /*n = write(fd, headers, headerssize);*/
+ /*if(bodysize>0)
+ n += write(fd, body, bodysize);*/
+ /* Note : my old linksys router only took into account
+ * soap request that are sent into only one packet */
+ char * p;
+ /* TODO: AVOID MALLOC, we could use writev() for that */
+ p = malloc(headerssize+bodysize);
+ if(!p)
+ return -1;
+ memcpy(p, headers, headerssize);
+ memcpy(p+headerssize, body, bodysize);
+ /*n = write(fd, p, headerssize+bodysize);*/
+ n = send(fd, p, headerssize+bodysize, 0);
+ if(n<0) {
+ PRINT_SOCKET_ERROR("send");
+ }
+ /* disable send on the socket */
+ /* draytek routers don't seem to like that... */
+#if 0
+#ifdef _WIN32
+ if(shutdown(fd, SD_SEND)<0) {
+#else
+ if(shutdown(fd, SHUT_WR)<0) { /*SD_SEND*/
+#endif
+ PRINT_SOCKET_ERROR("shutdown");
+ }
+#endif
+ free(p);
+ return n;
+}
+
+/* self explanatory */
+int soapPostSubmit(SOCKET fd,
+ const char * url,
+ const char * host,
+ unsigned short port,
+ const char * action,
+ const char * body,
+ const char * httpversion)
+{
+ int bodysize;
+ char headerbuf[512];
+ int headerssize;
+ char portstr[8];
+ bodysize = (int)strlen(body);
+ /* We are not using keep-alive HTTP connections.
+ * HTTP/1.1 needs the header Connection: close to do that.
+ * This is the default with HTTP/1.0
+ * Using HTTP/1.1 means we need to support chunked transfer-encoding :
+ * When using HTTP/1.1, the router "BiPAC 7404VNOX" always use chunked
+ * transfer encoding. */
+ /* Connection: Close is normally there only in HTTP/1.1 but who knows */
+ portstr[0] = '\0';
+ if(port != 80)
+ snprintf(portstr, sizeof(portstr), ":%hu", port);
+ headerssize = snprintf(headerbuf, sizeof(headerbuf),
+ "POST %s HTTP/%s\r\n"
+ "Host: %s%s\r\n"
+ "User-Agent: " OS_STRING ", " UPNP_VERSION_STRING ", MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
+ "Content-Length: %d\r\n"
+ "Content-Type: text/xml\r\n"
+ "SOAPAction: \"%s\"\r\n"
+ "Connection: Close\r\n"
+ "Cache-Control: no-cache\r\n" /* ??? */
+ "Pragma: no-cache\r\n"
+ "\r\n",
+ url, httpversion, host, portstr, bodysize, action);
+ if ((unsigned int)headerssize >= sizeof(headerbuf))
+ return -1;
+#ifdef DEBUG
+ /*printf("SOAP request : headersize=%d bodysize=%d\n",
+ headerssize, bodysize);
+ */
+ printf("SOAP request : POST %s HTTP/%s - Host: %s%s\n",
+ url, httpversion, host, portstr);
+ printf("SOAPAction: \"%s\" - Content-Length: %d\n", action, bodysize);
+ printf("Headers :\n%s", headerbuf);
+ printf("Body :\n%s\n", body);
+#endif
+ return httpWrite(fd, body, bodysize, headerbuf, headerssize);
+}
+
+
diff --git a/thirdparty/miniupnpc/minisoap.h b/thirdparty/miniupnpc/minisoap.h
new file mode 100644
index 0000000000..d6a45d03ba
--- /dev/null
+++ b/thirdparty/miniupnpc/minisoap.h
@@ -0,0 +1,17 @@
+/* $Id: minisoap.h,v 1.4 2010/04/12 20:39:41 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+#ifndef MINISOAP_H_INCLUDED
+#define MINISOAP_H_INCLUDED
+
+#include "miniupnpc_socketdef.h"
+
+/*int httpWrite(int, const char *, int, const char *);*/
+int soapPostSubmit(SOCKET, const char *, const char *, unsigned short,
+ const char *, const char *, const char *);
+
+#endif
+
diff --git a/thirdparty/miniupnpc/minissdpc.c b/thirdparty/miniupnpc/minissdpc.c
new file mode 100644
index 0000000000..d76b242ad0
--- /dev/null
+++ b/thirdparty/miniupnpc/minissdpc.c
@@ -0,0 +1,888 @@
+/* $Id: minissdpc.c,v 1.32 2016/10/07 09:04:36 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
+ * Web : http://miniupnp.free.fr/
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2018 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+/*#include <syslog.h>*/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#if defined (__NetBSD__)
+#include <net/if.h>
+#endif
+#if defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <io.h>
+#include <iphlpapi.h>
+#define snprintf _snprintf
+#if !defined(_MSC_VER)
+#include <stdint.h>
+#else /* !defined(_MSC_VER) */
+typedef unsigned short uint16_t;
+#endif /* !defined(_MSC_VER) */
+#ifndef strncasecmp
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#define strncasecmp _memicmp
+#else /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
+#define strncasecmp memicmp
+#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
+#endif /* #ifndef strncasecmp */
+#endif /* _WIN32 */
+#if defined(__amigaos__) || defined(__amigaos4__)
+#include <sys/socket.h>
+#endif /* defined(__amigaos__) || defined(__amigaos4__) */
+#if defined(__amigaos__)
+#define uint16_t unsigned short
+#endif /* defined(__amigaos__) */
+/* Hack */
+#define UNIX_PATH_LEN 108
+struct sockaddr_un {
+ uint16_t sun_family;
+ char sun_path[UNIX_PATH_LEN];
+};
+#else /* defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__) */
+#include <strings.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <net/if.h>
+#define closesocket close
+#endif
+
+#include "miniupnpc_socketdef.h"
+
+#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__)
+#define HAS_IP_MREQN
+#endif
+
+#if !defined(HAS_IP_MREQN) && !defined(_WIN32)
+#include <sys/ioctl.h>
+#if defined(__sun)
+#include <sys/sockio.h>
+#endif
+#endif
+
+#if defined(HAS_IP_MREQN) && defined(NEED_STRUCT_IP_MREQN)
+/* Several versions of glibc don't define this structure,
+ * define it here and compile with CFLAGS NEED_STRUCT_IP_MREQN */
+struct ip_mreqn
+{
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_address; /* local IP address of interface */
+ int imr_ifindex; /* Interface index */
+};
+#endif
+
+#if defined(__amigaos__) || defined(__amigaos4__)
+/* Amiga OS specific stuff */
+#define TIMEVAL struct timeval
+#endif
+
+#include "minissdpc.h"
+#include "miniupnpc.h"
+#include "receivedata.h"
+
+#if !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__))
+
+#include "codelength.h"
+
+struct UPNPDev *
+getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath, int * error)
+{
+ struct UPNPDev * devlist = NULL;
+ int s;
+ int res;
+
+ s = connectToMiniSSDPD(socketpath);
+ if (s < 0) {
+ if (error)
+ *error = s;
+ return NULL;
+ }
+ res = requestDevicesFromMiniSSDPD(s, devtype);
+ if (res < 0) {
+ if (error)
+ *error = res;
+ } else {
+ devlist = receiveDevicesFromMiniSSDPD(s, error);
+ }
+ disconnectFromMiniSSDPD(s);
+ return devlist;
+}
+
+/* macros used to read from unix socket */
+#define READ_BYTE_BUFFER(c) \
+ if((int)bufferindex >= n) { \
+ n = read(s, buffer, sizeof(buffer)); \
+ if(n<=0) break; \
+ bufferindex = 0; \
+ } \
+ c = buffer[bufferindex++];
+
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif /* MIN */
+
+#define READ_COPY_BUFFER(dst, len) \
+ for(l = len, p = (unsigned char *)dst; l > 0; ) { \
+ unsigned int lcopy; \
+ if((int)bufferindex >= n) { \
+ n = read(s, buffer, sizeof(buffer)); \
+ if(n<=0) break; \
+ bufferindex = 0; \
+ } \
+ lcopy = MIN(l, (n - bufferindex)); \
+ memcpy(p, buffer + bufferindex, lcopy); \
+ l -= lcopy; \
+ p += lcopy; \
+ bufferindex += lcopy; \
+ }
+
+#define READ_DISCARD_BUFFER(len) \
+ for(l = len; l > 0; ) { \
+ unsigned int lcopy; \
+ if(bufferindex >= n) { \
+ n = read(s, buffer, sizeof(buffer)); \
+ if(n<=0) break; \
+ bufferindex = 0; \
+ } \
+ lcopy = MIN(l, (n - bufferindex)); \
+ l -= lcopy; \
+ bufferindex += lcopy; \
+ }
+
+int
+connectToMiniSSDPD(const char * socketpath)
+{
+ int s;
+ struct sockaddr_un addr;
+#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
+ struct timeval timeout;
+#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
+
+ s = socket(AF_UNIX, SOCK_STREAM, 0);
+ if(s < 0)
+ {
+ /*syslog(LOG_ERR, "socket(unix): %m");*/
+ perror("socket(unix)");
+ return MINISSDPC_SOCKET_ERROR;
+ }
+#if defined(MINIUPNPC_SET_SOCKET_TIMEOUT) && !defined(__sun)
+ /* setting a 3 seconds timeout */
+ /* not supported for AF_UNIX sockets under Solaris */
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ if(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(struct timeval)) < 0)
+ {
+ perror("setsockopt SO_RCVTIMEO unix");
+ }
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+ if(setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(struct timeval)) < 0)
+ {
+ perror("setsockopt SO_SNDTIMEO unix");
+ }
+#endif /* #ifdef MINIUPNPC_SET_SOCKET_TIMEOUT */
+ if(!socketpath)
+ socketpath = "/var/run/minissdpd.sock";
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
+ /* TODO : check if we need to handle the EINTR */
+ if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0)
+ {
+ /*syslog(LOG_WARNING, "connect(\"%s\"): %m", socketpath);*/
+ close(s);
+ return MINISSDPC_SOCKET_ERROR;
+ }
+ return s;
+}
+
+int
+disconnectFromMiniSSDPD(int s)
+{
+ if (close(s) < 0)
+ return MINISSDPC_SOCKET_ERROR;
+ return MINISSDPC_SUCCESS;
+}
+
+int
+requestDevicesFromMiniSSDPD(int s, const char * devtype)
+{
+ unsigned char buffer[256];
+ unsigned char * p;
+ unsigned int stsize, l;
+
+ stsize = strlen(devtype);
+ if(stsize == 8 && 0 == memcmp(devtype, "ssdp:all", 8))
+ {
+ buffer[0] = 3; /* request type 3 : everything */
+ }
+ else
+ {
+ buffer[0] = 1; /* request type 1 : request devices/services by type */
+ }
+ p = buffer + 1;
+ l = stsize; CODELENGTH(l, p);
+ if(p + stsize > buffer + sizeof(buffer))
+ {
+ /* devtype is too long ! */
+#ifdef DEBUG
+ fprintf(stderr, "devtype is too long ! stsize=%u sizeof(buffer)=%u\n",
+ stsize, (unsigned)sizeof(buffer));
+#endif /* DEBUG */
+ return MINISSDPC_INVALID_INPUT;
+ }
+ memcpy(p, devtype, stsize);
+ p += stsize;
+ if(write(s, buffer, p - buffer) < 0)
+ {
+ /*syslog(LOG_ERR, "write(): %m");*/
+ perror("minissdpc.c: write()");
+ return MINISSDPC_SOCKET_ERROR;
+ }
+ return MINISSDPC_SUCCESS;
+}
+
+struct UPNPDev *
+receiveDevicesFromMiniSSDPD(int s, int * error)
+{
+ struct UPNPDev * tmp;
+ struct UPNPDev * devlist = NULL;
+ unsigned char buffer[256];
+ ssize_t n;
+ unsigned char * p;
+ unsigned char * url;
+ unsigned char * st;
+ unsigned int bufferindex;
+ unsigned int i, ndev;
+ unsigned int urlsize, stsize, usnsize, l;
+
+ n = read(s, buffer, sizeof(buffer));
+ if(n<=0)
+ {
+ perror("minissdpc.c: read()");
+ if (error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ return NULL;
+ }
+ ndev = buffer[0];
+ bufferindex = 1;
+ for(i = 0; i < ndev; i++)
+ {
+ DECODELENGTH_READ(urlsize, READ_BYTE_BUFFER);
+ if(n<=0) {
+ if (error)
+ *error = MINISSDPC_INVALID_SERVER_REPLY;
+ return devlist;
+ }
+#ifdef DEBUG
+ printf(" urlsize=%u", urlsize);
+#endif /* DEBUG */
+ url = malloc(urlsize);
+ if(url == NULL) {
+ if (error)
+ *error = MINISSDPC_MEMORY_ERROR;
+ return devlist;
+ }
+ READ_COPY_BUFFER(url, urlsize);
+ if(n<=0) {
+ if (error)
+ *error = MINISSDPC_INVALID_SERVER_REPLY;
+ goto free_url_and_return;
+ }
+ DECODELENGTH_READ(stsize, READ_BYTE_BUFFER);
+ if(n<=0) {
+ if (error)
+ *error = MINISSDPC_INVALID_SERVER_REPLY;
+ goto free_url_and_return;
+ }
+#ifdef DEBUG
+ printf(" stsize=%u", stsize);
+#endif /* DEBUG */
+ st = malloc(stsize);
+ if (st == NULL) {
+ if (error)
+ *error = MINISSDPC_MEMORY_ERROR;
+ goto free_url_and_return;
+ }
+ READ_COPY_BUFFER(st, stsize);
+ if(n<=0) {
+ if (error)
+ *error = MINISSDPC_INVALID_SERVER_REPLY;
+ goto free_url_and_st_and_return;
+ }
+ DECODELENGTH_READ(usnsize, READ_BYTE_BUFFER);
+ if(n<=0) {
+ if (error)
+ *error = MINISSDPC_INVALID_SERVER_REPLY;
+ goto free_url_and_st_and_return;
+ }
+#ifdef DEBUG
+ printf(" usnsize=%u\n", usnsize);
+#endif /* DEBUG */
+ tmp = (struct UPNPDev *)malloc(sizeof(struct UPNPDev)+urlsize+stsize+usnsize);
+ if(tmp == NULL) {
+ if (error)
+ *error = MINISSDPC_MEMORY_ERROR;
+ goto free_url_and_st_and_return;
+ }
+ tmp->pNext = devlist;
+ tmp->descURL = tmp->buffer;
+ tmp->st = tmp->buffer + 1 + urlsize;
+ memcpy(tmp->buffer, url, urlsize);
+ tmp->buffer[urlsize] = '\0';
+ memcpy(tmp->st, st, stsize);
+ tmp->buffer[urlsize+1+stsize] = '\0';
+ free(url);
+ free(st);
+ url = NULL;
+ st = NULL;
+ tmp->usn = tmp->buffer + 1 + urlsize + 1 + stsize;
+ READ_COPY_BUFFER(tmp->usn, usnsize);
+ if(n<=0) {
+ if (error)
+ *error = MINISSDPC_INVALID_SERVER_REPLY;
+ goto free_tmp_and_return;
+ }
+ tmp->buffer[urlsize+1+stsize+1+usnsize] = '\0';
+ tmp->scope_id = 0; /* default value. scope_id is not available with MiniSSDPd */
+ devlist = tmp;
+ }
+ if (error)
+ *error = MINISSDPC_SUCCESS;
+ return devlist;
+
+free_url_and_st_and_return:
+ free(st);
+free_url_and_return:
+ free(url);
+ return devlist;
+
+free_tmp_and_return:
+ free(tmp);
+ return devlist;
+}
+
+#endif /* !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) */
+
+/* parseMSEARCHReply()
+ * the last 4 arguments are filled during the parsing :
+ * - location/locationsize : "location:" field of the SSDP reply packet
+ * - st/stsize : "st:" field of the SSDP reply packet.
+ * The strings are NOT null terminated */
+static void
+parseMSEARCHReply(const char * reply, int size,
+ const char * * location, int * locationsize,
+ const char * * st, int * stsize,
+ const char * * usn, int * usnsize)
+{
+ int a, b, i;
+ i = 0;
+ a = i; /* start of the line */
+ b = 0; /* end of the "header" (position of the colon) */
+ while(i<size)
+ {
+ switch(reply[i])
+ {
+ case ':':
+ if(b==0)
+ {
+ b = i; /* end of the "header" */
+ /*for(j=a; j<b; j++)
+ {
+ putchar(reply[j]);
+ }
+ */
+ }
+ break;
+ case '\x0a':
+ case '\x0d':
+ if(b!=0)
+ {
+ /*for(j=b+1; j<i; j++)
+ {
+ putchar(reply[j]);
+ }
+ putchar('\n');*/
+ /* skip the colon and white spaces */
+ do { b++; } while(reply[b]==' ');
+ if(0==strncasecmp(reply+a, "location", 8))
+ {
+ *location = reply+b;
+ *locationsize = i-b;
+ }
+ else if(0==strncasecmp(reply+a, "st", 2))
+ {
+ *st = reply+b;
+ *stsize = i-b;
+ }
+ else if(0==strncasecmp(reply+a, "usn", 3))
+ {
+ *usn = reply+b;
+ *usnsize = i-b;
+ }
+ b = 0;
+ }
+ a = i+1;
+ break;
+ default:
+ break;
+ }
+ i++;
+ }
+}
+
+/* port upnp discover : SSDP protocol */
+#define SSDP_PORT 1900
+#define XSTR(s) STR(s)
+#define STR(s) #s
+#define UPNP_MCAST_ADDR "239.255.255.250"
+/* for IPv6 */
+#define UPNP_MCAST_LL_ADDR "FF02::C" /* link-local */
+#define UPNP_MCAST_SL_ADDR "FF05::C" /* site-local */
+
+/* direct discovery if minissdpd responses are not sufficient */
+/* ssdpDiscoverDevices() :
+ * return a chained list of all devices found or NULL if
+ * no devices was found.
+ * It is up to the caller to free the chained list
+ * delay is in millisecond (poll).
+ * UDA v1.1 says :
+ * The TTL for the IP packet SHOULD default to 2 and
+ * SHOULD be configurable. */
+struct UPNPDev *
+ssdpDiscoverDevices(const char * const deviceTypes[],
+ int delay, const char * multicastif,
+ int localport,
+ int ipv6, unsigned char ttl,
+ int * error,
+ int searchalltypes)
+{
+ struct UPNPDev * tmp;
+ struct UPNPDev * devlist = 0;
+ unsigned int scope_id = 0;
+ int opt = 1;
+ static const char MSearchMsgFmt[] =
+ "M-SEARCH * HTTP/1.1\r\n"
+ "HOST: %s:" XSTR(SSDP_PORT) "\r\n"
+ "ST: %s\r\n"
+ "MAN: \"ssdp:discover\"\r\n"
+ "MX: %u\r\n"
+ "\r\n";
+ int deviceIndex;
+ char bufr[1536]; /* reception and emission buffer */
+ SOCKET sudp;
+ int n;
+ struct sockaddr_storage sockudp_r;
+ unsigned int mx;
+#ifdef NO_GETADDRINFO
+ struct sockaddr_storage sockudp_w;
+#else
+ int rv;
+ struct addrinfo hints, *servinfo, *p;
+#endif
+#ifdef _WIN32
+ MIB_IPFORWARDROW ip_forward;
+ unsigned long _ttl = (unsigned long)ttl;
+#endif
+ int linklocal = 1;
+ int sentok;
+
+ if(error)
+ *error = MINISSDPC_UNKNOWN_ERROR;
+
+ if(localport==UPNP_LOCAL_PORT_SAME)
+ localport = SSDP_PORT;
+
+#ifdef _WIN32
+ sudp = socket(ipv6 ? PF_INET6 : PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+#else
+ sudp = socket(ipv6 ? PF_INET6 : PF_INET, SOCK_DGRAM, 0);
+#endif
+ if(ISINVALID(sudp))
+ {
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ PRINT_SOCKET_ERROR("socket");
+ return NULL;
+ }
+ /* reception */
+ memset(&sockudp_r, 0, sizeof(struct sockaddr_storage));
+ if(ipv6) {
+ struct sockaddr_in6 * p = (struct sockaddr_in6 *)&sockudp_r;
+ p->sin6_family = AF_INET6;
+ if(localport > 0 && localport < 65536)
+ p->sin6_port = htons((unsigned short)localport);
+ p->sin6_addr = in6addr_any; /* in6addr_any is not available with MinGW32 3.4.2 */
+ } else {
+ struct sockaddr_in * p = (struct sockaddr_in *)&sockudp_r;
+ p->sin_family = AF_INET;
+ if(localport > 0 && localport < 65536)
+ p->sin_port = htons((unsigned short)localport);
+ p->sin_addr.s_addr = INADDR_ANY;
+ }
+#ifdef _WIN32
+/* This code could help us to use the right Network interface for
+ * SSDP multicast traffic */
+/* Get IP associated with the index given in the ip_forward struct
+ * in order to give this ip to setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF) */
+ if(!ipv6
+ && (GetBestRoute(inet_addr("223.255.255.255"), 0, &ip_forward) == NO_ERROR)) {
+ DWORD dwRetVal = 0;
+ PMIB_IPADDRTABLE pIPAddrTable;
+ DWORD dwSize = 0;
+#ifdef DEBUG
+ IN_ADDR IPAddr;
+#endif
+ int i;
+#ifdef DEBUG
+ printf("ifIndex=%lu nextHop=%lx \n", ip_forward.dwForwardIfIndex, ip_forward.dwForwardNextHop);
+#endif
+ pIPAddrTable = (MIB_IPADDRTABLE *) malloc(sizeof (MIB_IPADDRTABLE));
+ if(pIPAddrTable) {
+ if (GetIpAddrTable(pIPAddrTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) {
+ free(pIPAddrTable);
+ pIPAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
+ }
+ }
+ if(pIPAddrTable) {
+ dwRetVal = GetIpAddrTable( pIPAddrTable, &dwSize, 0 );
+ if (dwRetVal == NO_ERROR) {
+#ifdef DEBUG
+ printf("\tNum Entries: %ld\n", pIPAddrTable->dwNumEntries);
+#endif
+ for (i=0; i < (int) pIPAddrTable->dwNumEntries; i++) {
+#ifdef DEBUG
+ printf("\n\tInterface Index[%d]:\t%ld\n", i, pIPAddrTable->table[i].dwIndex);
+ IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwAddr;
+ printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwMask;
+ printf("\tSubnet Mask[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwBCastAddr;
+ printf("\tBroadCast[%d]: \t%s (%ld)\n", i, inet_ntoa(IPAddr), pIPAddrTable->table[i].dwBCastAddr);
+ printf("\tReassembly size[%d]:\t%ld\n", i, pIPAddrTable->table[i].dwReasmSize);
+ printf("\tType and State[%d]:", i);
+ printf("\n");
+#endif
+ if (pIPAddrTable->table[i].dwIndex == ip_forward.dwForwardIfIndex) {
+ /* Set the address of this interface to be used */
+ struct in_addr mc_if;
+ memset(&mc_if, 0, sizeof(mc_if));
+ mc_if.s_addr = pIPAddrTable->table[i].dwAddr;
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0) {
+ PRINT_SOCKET_ERROR("setsockopt");
+ }
+ ((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = pIPAddrTable->table[i].dwAddr;
+#ifndef DEBUG
+ break;
+#endif
+ }
+ }
+ }
+ free(pIPAddrTable);
+ pIPAddrTable = NULL;
+ }
+ }
+#endif /* _WIN32 */
+
+#ifdef _WIN32
+ if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof (opt)) < 0)
+#else
+ if (setsockopt(sudp, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt)) < 0)
+#endif
+ {
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ PRINT_SOCKET_ERROR("setsockopt(SO_REUSEADDR,...)");
+ return NULL;
+ }
+
+ if(ipv6) {
+#ifdef _WIN32
+ DWORD mcastHops = ttl;
+ if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (const char *)&mcastHops, sizeof(mcastHops)) < 0)
+#else /* _WIN32 */
+ int mcastHops = ttl;
+ if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastHops, sizeof(mcastHops)) < 0)
+#endif /* _WIN32 */
+ {
+ PRINT_SOCKET_ERROR("setsockopt(IPV6_MULTICAST_HOPS,...)");
+ }
+ } else {
+#ifdef _WIN32
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&_ttl, sizeof(_ttl)) < 0)
+#else /* _WIN32 */
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0)
+#endif /* _WIN32 */
+ {
+ /* not a fatal error */
+ PRINT_SOCKET_ERROR("setsockopt(IP_MULTICAST_TTL,...)");
+ }
+ }
+
+ if(multicastif)
+ {
+ if(ipv6) {
+#if !defined(_WIN32)
+ /* according to MSDN, if_nametoindex() is supported since
+ * MS Windows Vista and MS Windows Server 2008.
+ * http://msdn.microsoft.com/en-us/library/bb408409%28v=vs.85%29.aspx */
+ unsigned int ifindex = if_nametoindex(multicastif); /* eth0, etc. */
+ if(setsockopt(sudp, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifindex, sizeof(ifindex)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt IPV6_MULTICAST_IF");
+ }
+#else
+#ifdef DEBUG
+ printf("Setting of multicast interface not supported in IPv6 under Windows.\n");
+#endif
+#endif
+ } else {
+ struct in_addr mc_if;
+ mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
+ if(mc_if.s_addr != INADDR_NONE)
+ {
+ ((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = mc_if.s_addr;
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
+ }
+ } else {
+#ifdef HAS_IP_MREQN
+ /* was not an ip address, try with an interface name */
+ struct ip_mreqn reqn; /* only defined with -D_BSD_SOURCE or -D_GNU_SOURCE */
+ memset(&reqn, 0, sizeof(struct ip_mreqn));
+ reqn.imr_ifindex = if_nametoindex(multicastif);
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&reqn, sizeof(reqn)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
+ }
+#elif !defined(_WIN32)
+ struct ifreq ifr;
+ int ifrlen = sizeof(ifr);
+ strncpy(ifr.ifr_name, multicastif, IFNAMSIZ);
+ ifr.ifr_name[IFNAMSIZ-1] = '\0';
+ if(ioctl(sudp, SIOCGIFADDR, &ifr, &ifrlen) < 0)
+ {
+ PRINT_SOCKET_ERROR("ioctl(...SIOCGIFADDR...)");
+ }
+ mc_if.s_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
+ if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0)
+ {
+ PRINT_SOCKET_ERROR("setsockopt IP_MULTICAST_IF");
+ }
+#else /* _WIN32 */
+#ifdef DEBUG
+ printf("Setting of multicast interface not supported with interface name.\n");
+#endif
+#endif /* #ifdef HAS_IP_MREQN / !defined(_WIN32) */
+ }
+ }
+ }
+
+ /* Before sending the packed, we first "bind" in order to be able
+ * to receive the response */
+ if (bind(sudp, (const struct sockaddr *)&sockudp_r,
+ ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) != 0)
+ {
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ PRINT_SOCKET_ERROR("bind");
+ closesocket(sudp);
+ return NULL;
+ }
+
+ if(error)
+ *error = MINISSDPC_SUCCESS;
+ /* Calculating maximum response time in seconds */
+ mx = ((unsigned int)delay) / 1000u;
+ if(mx == 0) {
+ mx = 1;
+ delay = 1000;
+ }
+ /* receiving SSDP response packet */
+ for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) {
+ sentok = 0;
+ /* sending the SSDP M-SEARCH packet */
+ n = snprintf(bufr, sizeof(bufr),
+ MSearchMsgFmt,
+ ipv6 ?
+ (linklocal ? "[" UPNP_MCAST_LL_ADDR "]" : "[" UPNP_MCAST_SL_ADDR "]")
+ : UPNP_MCAST_ADDR,
+ deviceTypes[deviceIndex], mx);
+ if ((unsigned int)n >= sizeof(bufr)) {
+ if(error)
+ *error = MINISSDPC_MEMORY_ERROR;
+ goto error;
+ }
+#ifdef DEBUG
+ /*printf("Sending %s", bufr);*/
+ printf("Sending M-SEARCH request to %s with ST: %s\n",
+ ipv6 ?
+ (linklocal ? "[" UPNP_MCAST_LL_ADDR "]" : "[" UPNP_MCAST_SL_ADDR "]")
+ : UPNP_MCAST_ADDR,
+ deviceTypes[deviceIndex]);
+#endif
+#ifdef NO_GETADDRINFO
+ /* the following code is not using getaddrinfo */
+ /* emission */
+ memset(&sockudp_w, 0, sizeof(struct sockaddr_storage));
+ if(ipv6) {
+ struct sockaddr_in6 * p = (struct sockaddr_in6 *)&sockudp_w;
+ p->sin6_family = AF_INET6;
+ p->sin6_port = htons(SSDP_PORT);
+ inet_pton(AF_INET6,
+ linklocal ? UPNP_MCAST_LL_ADDR : UPNP_MCAST_SL_ADDR,
+ &(p->sin6_addr));
+ } else {
+ struct sockaddr_in * p = (struct sockaddr_in *)&sockudp_w;
+ p->sin_family = AF_INET;
+ p->sin_port = htons(SSDP_PORT);
+ p->sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);
+ }
+ n = sendto(sudp, bufr, n, 0, &sockudp_w,
+ ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in));
+ if (n < 0) {
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ PRINT_SOCKET_ERROR("sendto");
+ } else {
+ sentok = 1;
+ }
+#else /* #ifdef NO_GETADDRINFO */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC; /* AF_INET6 or AF_INET */
+ hints.ai_socktype = SOCK_DGRAM;
+ /*hints.ai_flags = */
+ if ((rv = getaddrinfo(ipv6
+ ? (linklocal ? UPNP_MCAST_LL_ADDR : UPNP_MCAST_SL_ADDR)
+ : UPNP_MCAST_ADDR,
+ XSTR(SSDP_PORT), &hints, &servinfo)) != 0) {
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+#ifdef _WIN32
+ fprintf(stderr, "getaddrinfo() failed: %d\n", rv);
+#else
+ fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
+#endif
+ break;
+ }
+ for(p = servinfo; p; p = p->ai_next) {
+ n = sendto(sudp, bufr, n, 0, p->ai_addr, p->ai_addrlen);
+ if (n < 0) {
+#ifdef DEBUG
+ char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
+ if (getnameinfo(p->ai_addr, p->ai_addrlen, hbuf, sizeof(hbuf), sbuf,
+ sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
+ fprintf(stderr, "host:%s port:%s\n", hbuf, sbuf);
+ }
+#endif
+ PRINT_SOCKET_ERROR("sendto");
+ continue;
+ } else {
+ sentok = 1;
+ }
+ }
+ freeaddrinfo(servinfo);
+ if(!sentok) {
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ }
+#endif /* #ifdef NO_GETADDRINFO */
+ /* Waiting for SSDP REPLY packet to M-SEARCH
+ * if searchalltypes is set, enter the loop only
+ * when the last deviceType is reached */
+ if((sentok && !searchalltypes) || !deviceTypes[deviceIndex + 1]) do {
+ n = receivedata(sudp, bufr, sizeof(bufr), delay, &scope_id);
+ if (n < 0) {
+ /* error */
+ if(error)
+ *error = MINISSDPC_SOCKET_ERROR;
+ goto error;
+ } else if (n == 0) {
+ /* no data or Time Out */
+#ifdef DEBUG
+ printf("NODATA or TIMEOUT\n");
+#endif /* DEBUG */
+ if (devlist && !searchalltypes) {
+ /* found some devices, stop now*/
+ if(error)
+ *error = MINISSDPC_SUCCESS;
+ goto error;
+ }
+ } else {
+ const char * descURL=NULL;
+ int urlsize=0;
+ const char * st=NULL;
+ int stsize=0;
+ const char * usn=NULL;
+ int usnsize=0;
+ parseMSEARCHReply(bufr, n, &descURL, &urlsize, &st, &stsize, &usn, &usnsize);
+ if(st&&descURL) {
+#ifdef DEBUG
+ printf("M-SEARCH Reply:\n ST: %.*s\n USN: %.*s\n Location: %.*s\n",
+ stsize, st, usnsize, (usn?usn:""), urlsize, descURL);
+#endif /* DEBUG */
+ for(tmp=devlist; tmp; tmp = tmp->pNext) {
+ if(memcmp(tmp->descURL, descURL, urlsize) == 0 &&
+ tmp->descURL[urlsize] == '\0' &&
+ memcmp(tmp->st, st, stsize) == 0 &&
+ tmp->st[stsize] == '\0' &&
+ (usnsize == 0 || memcmp(tmp->usn, usn, usnsize) == 0) &&
+ tmp->usn[usnsize] == '\0')
+ break;
+ }
+ /* at the exit of the loop above, tmp is null if
+ * no duplicate device was found */
+ if(tmp)
+ continue;
+ tmp = (struct UPNPDev *)malloc(sizeof(struct UPNPDev)+urlsize+stsize+usnsize);
+ if(!tmp) {
+ /* memory allocation error */
+ if(error)
+ *error = MINISSDPC_MEMORY_ERROR;
+ goto error;
+ }
+ tmp->pNext = devlist;
+ tmp->descURL = tmp->buffer;
+ tmp->st = tmp->buffer + 1 + urlsize;
+ tmp->usn = tmp->st + 1 + stsize;
+ memcpy(tmp->buffer, descURL, urlsize);
+ tmp->buffer[urlsize] = '\0';
+ memcpy(tmp->st, st, stsize);
+ tmp->buffer[urlsize+1+stsize] = '\0';
+ if(usn != NULL)
+ memcpy(tmp->usn, usn, usnsize);
+ tmp->buffer[urlsize+1+stsize+1+usnsize] = '\0';
+ tmp->scope_id = scope_id;
+ devlist = tmp;
+ }
+ }
+ } while(n > 0);
+ if(ipv6) {
+ /* switch linklocal flag */
+ if(linklocal) {
+ linklocal = 0;
+ --deviceIndex;
+ } else {
+ linklocal = 1;
+ }
+ }
+ }
+error:
+ closesocket(sudp);
+ return devlist;
+}
+
diff --git a/thirdparty/miniupnpc/minissdpc.h b/thirdparty/miniupnpc/minissdpc.h
new file mode 100644
index 0000000000..167d897cb6
--- /dev/null
+++ b/thirdparty/miniupnpc/minissdpc.h
@@ -0,0 +1,58 @@
+/* $Id: minissdpc.h,v 1.6 2015/09/18 12:45:16 nanard Exp $ */
+/* Project: miniupnp
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * Author: Thomas Bernard
+ * Copyright (c) 2005-2015 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef MINISSDPC_H_INCLUDED
+#define MINISSDPC_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+#include "upnpdev.h"
+
+/* error codes : */
+#define MINISSDPC_SUCCESS (0)
+#define MINISSDPC_UNKNOWN_ERROR (-1)
+#define MINISSDPC_SOCKET_ERROR (-101)
+#define MINISSDPC_MEMORY_ERROR (-102)
+#define MINISSDPC_INVALID_INPUT (-103)
+#define MINISSDPC_INVALID_SERVER_REPLY (-104)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__))
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath, int * error);
+
+MINIUPNP_LIBSPEC int
+connectToMiniSSDPD(const char * socketpath);
+
+MINIUPNP_LIBSPEC int
+disconnectFromMiniSSDPD(int fd);
+
+MINIUPNP_LIBSPEC int
+requestDevicesFromMiniSSDPD(int fd, const char * devtype);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+receiveDevicesFromMiniSSDPD(int fd, int * error);
+
+#endif /* !(defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__)) */
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+ssdpDiscoverDevices(const char * const deviceTypes[],
+ int delay, const char * multicastif,
+ int localport,
+ int ipv6, unsigned char ttl,
+ int * error,
+ int searchalltypes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/thirdparty/miniupnpc/miniupnpc.c b/thirdparty/miniupnpc/miniupnpc.c
new file mode 100644
index 0000000000..5d93ef9933
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc.c
@@ -0,0 +1,727 @@
+/* $Id: miniupnpc.c,v 1.149 2016/02/09 09:50:46 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
+ * Web : http://miniupnp.free.fr/
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2018 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENSE file. */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef _WIN32
+/* Win32 Specific includes and defines */
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <io.h>
+#include <iphlpapi.h>
+#define snprintf _snprintf
+#define strdup _strdup
+#ifndef strncasecmp
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#define strncasecmp _memicmp
+#else /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
+#define strncasecmp memicmp
+#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
+#endif /* #ifndef strncasecmp */
+#define MAXHOSTNAMELEN 64
+#else /* #ifdef _WIN32 */
+/* Standard POSIX includes */
+#include <unistd.h>
+#if defined(__amigaos__) && !defined(__amigaos4__)
+/* Amiga OS 3 specific stuff */
+#define socklen_t int
+#else
+#include <sys/select.h>
+#endif
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <net/if.h>
+#if !defined(__amigaos__) && !defined(__amigaos4__)
+#include <poll.h>
+#endif
+#include <strings.h>
+#include <errno.h>
+#define closesocket close
+#endif /* #else _WIN32 */
+#ifdef __GNU__
+#define MAXHOSTNAMELEN 64
+#endif
+
+
+#include "miniupnpc.h"
+#include "minissdpc.h"
+#include "miniwget.h"
+#include "miniwget_private.h"
+#include "minisoap.h"
+#include "minixml.h"
+#include "upnpcommands.h"
+#include "connecthostport.h"
+
+/* compare the beginning of a string with a constant string */
+#define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1))
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 64
+#endif
+
+#define SOAPPREFIX "s"
+#define SERVICEPREFIX "u"
+#define SERVICEPREFIX2 'u'
+
+/* check if an ip address is a private (LAN) address
+ * see https://tools.ietf.org/html/rfc1918 */
+static int is_rfc1918addr(const char * addr)
+{
+ /* 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) */
+ if(COMPARE(addr, "192.168."))
+ return 1;
+ /* 10.0.0.0 - 10.255.255.255 (10/8 prefix) */
+ if(COMPARE(addr, "10."))
+ return 1;
+ /* 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) */
+ if(COMPARE(addr, "172.")) {
+ int i = atoi(addr + 4);
+ if((16 <= i) && (i <= 31))
+ return 1;
+ }
+ return 0;
+}
+
+/* root description parsing */
+MINIUPNP_LIBSPEC void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)
+{
+ struct xmlparser parser;
+ /* xmlparser object */
+ parser.xmlstart = buffer;
+ parser.xmlsize = bufsize;
+ parser.data = data;
+ parser.starteltfunc = IGDstartelt;
+ parser.endeltfunc = IGDendelt;
+ parser.datafunc = IGDdata;
+ parser.attfunc = 0;
+ parsexml(&parser);
+#ifdef DEBUG
+ printIGD(data);
+#endif
+}
+
+/* simpleUPnPcommand2 :
+ * not so simple !
+ * return values :
+ * pointer - OK
+ * NULL - error */
+static char *
+simpleUPnPcommand2(SOCKET s, const char * url, const char * service,
+ const char * action, struct UPNParg * args,
+ int * bufsize, const char * httpversion)
+{
+ char hostname[MAXHOSTNAMELEN+1];
+ unsigned short port = 0;
+ char * path;
+ char soapact[128];
+ char soapbody[2048];
+ int soapbodylen;
+ char * buf;
+ int n;
+ int status_code;
+
+ *bufsize = 0;
+ snprintf(soapact, sizeof(soapact), "%s#%s", service, action);
+ if(args==NULL)
+ {
+ soapbodylen = snprintf(soapbody, sizeof(soapbody),
+ "<?xml version=\"1.0\"?>\r\n"
+ "<" SOAPPREFIX ":Envelope "
+ "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+ SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+ "<" SOAPPREFIX ":Body>"
+ "<" SERVICEPREFIX ":%s xmlns:" SERVICEPREFIX "=\"%s\">"
+ "</" SERVICEPREFIX ":%s>"
+ "</" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>"
+ "\r\n", action, service, action);
+ if ((unsigned int)soapbodylen >= sizeof(soapbody))
+ return NULL;
+ }
+ else
+ {
+ char * p;
+ const char * pe, * pv;
+ const char * const pend = soapbody + sizeof(soapbody);
+ soapbodylen = snprintf(soapbody, sizeof(soapbody),
+ "<?xml version=\"1.0\"?>\r\n"
+ "<" SOAPPREFIX ":Envelope "
+ "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+ SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+ "<" SOAPPREFIX ":Body>"
+ "<" SERVICEPREFIX ":%s xmlns:" SERVICEPREFIX "=\"%s\">",
+ action, service);
+ if ((unsigned int)soapbodylen >= sizeof(soapbody))
+ return NULL;
+ p = soapbody + soapbodylen;
+ while(args->elt)
+ {
+ if(p >= pend) /* check for space to write next byte */
+ return NULL;
+ *(p++) = '<';
+
+ pe = args->elt;
+ while(p < pend && *pe)
+ *(p++) = *(pe++);
+
+ if(p >= pend) /* check for space to write next byte */
+ return NULL;
+ *(p++) = '>';
+
+ if((pv = args->val))
+ {
+ while(p < pend && *pv)
+ *(p++) = *(pv++);
+ }
+
+ if((p+2) > pend) /* check for space to write next 2 bytes */
+ return NULL;
+ *(p++) = '<';
+ *(p++) = '/';
+
+ pe = args->elt;
+ while(p < pend && *pe)
+ *(p++) = *(pe++);
+
+ if(p >= pend) /* check for space to write next byte */
+ return NULL;
+ *(p++) = '>';
+
+ args++;
+ }
+ if((p+4) > pend) /* check for space to write next 4 bytes */
+ return NULL;
+ *(p++) = '<';
+ *(p++) = '/';
+ *(p++) = SERVICEPREFIX2;
+ *(p++) = ':';
+
+ pe = action;
+ while(p < pend && *pe)
+ *(p++) = *(pe++);
+
+ strncpy(p, "></" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>\r\n",
+ pend - p);
+ if(soapbody[sizeof(soapbody)-1]) /* strncpy pads buffer with 0s, so if it doesn't end in 0, could not fit full string */
+ return NULL;
+ }
+ if(!parseURL(url, hostname, &port, &path, NULL)) return NULL;
+ if(ISINVALID(s)) {
+ s = connecthostport(hostname, port, 0);
+ if(ISINVALID(s)) {
+ /* failed to connect */
+ return NULL;
+ }
+ }
+
+ n = soapPostSubmit(s, path, hostname, port, soapact, soapbody, httpversion);
+ if(n<=0) {
+#ifdef DEBUG
+ printf("Error sending SOAP request\n");
+#endif
+ closesocket(s);
+ return NULL;
+ }
+
+ buf = getHTTPResponse(s, bufsize, &status_code);
+#ifdef DEBUG
+ if(*bufsize > 0 && buf)
+ {
+ printf("HTTP %d SOAP Response :\n%.*s\n", status_code, *bufsize, buf);
+ }
+ else
+ {
+ printf("HTTP %d, empty SOAP response. size=%d\n", status_code, *bufsize);
+ }
+#endif
+ closesocket(s);
+ return buf;
+}
+
+/* simpleUPnPcommand :
+ * not so simple !
+ * return values :
+ * pointer - OK
+ * NULL - error */
+char *
+simpleUPnPcommand(int s, const char * url, const char * service,
+ const char * action, struct UPNParg * args,
+ int * bufsize)
+{
+ char * buf;
+
+#if 1
+ buf = simpleUPnPcommand2((SOCKET)s, url, service, action, args, bufsize, "1.1");
+#else
+ buf = simpleUPnPcommand2((SOCKET)s, url, service, action, args, bufsize, "1.0");
+ if (!buf || *bufsize == 0)
+ {
+#if DEBUG
+ printf("Error or no result from SOAP request; retrying with HTTP/1.1\n");
+#endif
+ buf = simpleUPnPcommand2((SOCKET)s, url, service, action, args, bufsize, "1.1");
+ }
+#endif
+ return buf;
+}
+
+/* upnpDiscoverDevices() :
+ * return a chained list of all devices found or NULL if
+ * no devices was found.
+ * It is up to the caller to free the chained list
+ * delay is in millisecond (poll).
+ * UDA v1.1 says :
+ * The TTL for the IP packet SHOULD default to 2 and
+ * SHOULD be configurable. */
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverDevices(const char * const deviceTypes[],
+ int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error,
+ int searchalltypes)
+{
+ struct UPNPDev * tmp;
+ struct UPNPDev * devlist = 0;
+#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
+ int deviceIndex;
+#endif /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
+
+ if(error)
+ *error = UPNPDISCOVER_UNKNOWN_ERROR;
+#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
+ /* first try to get infos from minissdpd ! */
+ if(!minissdpdsock)
+ minissdpdsock = "/var/run/minissdpd.sock";
+ if(minissdpdsock[0] != '\0') {
+ for(deviceIndex = 0; deviceTypes[deviceIndex]; deviceIndex++) {
+ struct UPNPDev * minissdpd_devlist;
+ int only_rootdevice = 1;
+ minissdpd_devlist = getDevicesFromMiniSSDPD(deviceTypes[deviceIndex],
+ minissdpdsock, 0);
+ if(minissdpd_devlist) {
+#ifdef DEBUG
+ printf("returned by MiniSSDPD: %s\t%s\n",
+ minissdpd_devlist->st, minissdpd_devlist->descURL);
+#endif /* DEBUG */
+ if(!strstr(minissdpd_devlist->st, "rootdevice"))
+ only_rootdevice = 0;
+ for(tmp = minissdpd_devlist; tmp->pNext != NULL; tmp = tmp->pNext) {
+#ifdef DEBUG
+ printf("returned by MiniSSDPD: %s\t%s\n",
+ tmp->pNext->st, tmp->pNext->descURL);
+#endif /* DEBUG */
+ if(!strstr(tmp->st, "rootdevice"))
+ only_rootdevice = 0;
+ }
+ tmp->pNext = devlist;
+ devlist = minissdpd_devlist;
+ if(!searchalltypes && !only_rootdevice)
+ break;
+ }
+ }
+ }
+ for(tmp = devlist; tmp != NULL; tmp = tmp->pNext) {
+ /* We return what we have found if it was not only a rootdevice */
+ if(!strstr(tmp->st, "rootdevice")) {
+ if(error)
+ *error = UPNPDISCOVER_SUCCESS;
+ return devlist;
+ }
+ }
+#endif /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
+
+ /* direct discovery if minissdpd responses are not sufficient */
+ {
+ struct UPNPDev * discovered_devlist;
+ discovered_devlist = ssdpDiscoverDevices(deviceTypes, delay, multicastif, localport,
+ ipv6, ttl, error, searchalltypes);
+ if(devlist == NULL)
+ devlist = discovered_devlist;
+ else {
+ for(tmp = devlist; tmp->pNext != NULL; tmp = tmp->pNext);
+ tmp->pNext = discovered_devlist;
+ }
+ }
+ return devlist;
+}
+
+/* upnpDiscover() Discover IGD device */
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscover(int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error)
+{
+ static const char * const deviceList[] = {
+#if 0
+ "urn:schemas-upnp-org:device:InternetGatewayDevice:2",
+ "urn:schemas-upnp-org:service:WANIPConnection:2",
+#endif
+ "urn:schemas-upnp-org:device:InternetGatewayDevice:1",
+ "urn:schemas-upnp-org:service:WANIPConnection:1",
+ "urn:schemas-upnp-org:service:WANPPPConnection:1",
+ "upnp:rootdevice",
+ /*"ssdp:all",*/
+ 0
+ };
+ return upnpDiscoverDevices(deviceList,
+ delay, multicastif, minissdpdsock, localport,
+ ipv6, ttl, error, 0);
+}
+
+/* upnpDiscoverAll() Discover all UPnP devices */
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverAll(int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error)
+{
+ static const char * const deviceList[] = {
+ /*"upnp:rootdevice",*/
+ "ssdp:all",
+ 0
+ };
+ return upnpDiscoverDevices(deviceList,
+ delay, multicastif, minissdpdsock, localport,
+ ipv6, ttl, error, 0);
+}
+
+/* upnpDiscoverDevice() Discover a specific device */
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverDevice(const char * device, int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error)
+{
+ const char * const deviceList[] = {
+ device,
+ 0
+ };
+ return upnpDiscoverDevices(deviceList,
+ delay, multicastif, minissdpdsock, localport,
+ ipv6, ttl, error, 0);
+}
+
+static char *
+build_absolute_url(const char * baseurl, const char * descURL,
+ const char * url, unsigned int scope_id)
+{
+ int l, n;
+ char * s;
+ const char * base;
+ char * p;
+#if defined(IF_NAMESIZE) && !defined(_WIN32)
+ char ifname[IF_NAMESIZE];
+#else /* defined(IF_NAMESIZE) && !defined(_WIN32) */
+ char scope_str[8];
+#endif /* defined(IF_NAMESIZE) && !defined(_WIN32) */
+
+ if( (url[0] == 'h')
+ &&(url[1] == 't')
+ &&(url[2] == 't')
+ &&(url[3] == 'p')
+ &&(url[4] == ':')
+ &&(url[5] == '/')
+ &&(url[6] == '/'))
+ return strdup(url);
+ base = (baseurl[0] == '\0') ? descURL : baseurl;
+ n = strlen(base);
+ if(n > 7) {
+ p = strchr(base + 7, '/');
+ if(p)
+ n = p - base;
+ }
+ l = n + strlen(url) + 1;
+ if(url[0] != '/')
+ l++;
+ if(scope_id != 0) {
+#if defined(IF_NAMESIZE) && !defined(_WIN32)
+ if(if_indextoname(scope_id, ifname)) {
+ l += 3 + strlen(ifname); /* 3 == strlen(%25) */
+ }
+#else /* defined(IF_NAMESIZE) && !defined(_WIN32) */
+ /* under windows, scope is numerical */
+ l += 3 + snprintf(scope_str, sizeof(scope_str), "%u", scope_id);
+#endif /* defined(IF_NAMESIZE) && !defined(_WIN32) */
+ }
+ s = malloc(l);
+ if(s == NULL) return NULL;
+ memcpy(s, base, n);
+ if(scope_id != 0) {
+ s[n] = '\0';
+ if(0 == memcmp(s, "http://[fe80:", 13)) {
+ /* this is a linklocal IPv6 address */
+ p = strchr(s, ']');
+ if(p) {
+ /* insert %25<scope> into URL */
+#if defined(IF_NAMESIZE) && !defined(_WIN32)
+ memmove(p + 3 + strlen(ifname), p, strlen(p) + 1);
+ memcpy(p, "%25", 3);
+ memcpy(p + 3, ifname, strlen(ifname));
+ n += 3 + strlen(ifname);
+#else /* defined(IF_NAMESIZE) && !defined(_WIN32) */
+ memmove(p + 3 + strlen(scope_str), p, strlen(p) + 1);
+ memcpy(p, "%25", 3);
+ memcpy(p + 3, scope_str, strlen(scope_str));
+ n += 3 + strlen(scope_str);
+#endif /* defined(IF_NAMESIZE) && !defined(_WIN32) */
+ }
+ }
+ }
+ if(url[0] != '/')
+ s[n++] = '/';
+ memcpy(s + n, url, l - n);
+ return s;
+}
+
+/* Prepare the Urls for usage...
+ */
+MINIUPNP_LIBSPEC void
+GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,
+ const char * descURL, unsigned int scope_id)
+{
+ /* strdup descURL */
+ urls->rootdescURL = strdup(descURL);
+
+ /* get description of WANIPConnection */
+ urls->ipcondescURL = build_absolute_url(data->urlbase, descURL,
+ data->first.scpdurl, scope_id);
+ urls->controlURL = build_absolute_url(data->urlbase, descURL,
+ data->first.controlurl, scope_id);
+ urls->controlURL_CIF = build_absolute_url(data->urlbase, descURL,
+ data->CIF.controlurl, scope_id);
+ urls->controlURL_6FC = build_absolute_url(data->urlbase, descURL,
+ data->IPv6FC.controlurl, scope_id);
+
+#ifdef DEBUG
+ printf("urls->ipcondescURL='%s'\n", urls->ipcondescURL);
+ printf("urls->controlURL='%s'\n", urls->controlURL);
+ printf("urls->controlURL_CIF='%s'\n", urls->controlURL_CIF);
+ printf("urls->controlURL_6FC='%s'\n", urls->controlURL_6FC);
+#endif
+}
+
+MINIUPNP_LIBSPEC void
+FreeUPNPUrls(struct UPNPUrls * urls)
+{
+ if(!urls)
+ return;
+ free(urls->controlURL);
+ urls->controlURL = 0;
+ free(urls->ipcondescURL);
+ urls->ipcondescURL = 0;
+ free(urls->controlURL_CIF);
+ urls->controlURL_CIF = 0;
+ free(urls->controlURL_6FC);
+ urls->controlURL_6FC = 0;
+ free(urls->rootdescURL);
+ urls->rootdescURL = 0;
+}
+
+int
+UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
+{
+ char status[64];
+ unsigned int uptime;
+ status[0] = '\0';
+ UPNP_GetStatusInfo(urls->controlURL, data->first.servicetype,
+ status, &uptime, NULL);
+ if(0 == strcmp("Connected", status))
+ return 1;
+ else if(0 == strcmp("Up", status)) /* Also accept "Up" */
+ return 1;
+ else
+ return 0;
+}
+
+
+/* UPNP_GetValidIGD() :
+ * return values :
+ * -1 = Internal error
+ * 0 = NO IGD found
+ * 1 = A valid connected IGD has been found
+ * 2 = A valid IGD has been found but it reported as
+ * not connected
+ * 3 = an UPnP device has been found but was not recognized as an IGD
+ *
+ * In any positive non zero return case, the urls and data structures
+ * passed as parameters are set. Don't forget to call FreeUPNPUrls(urls) to
+ * free allocated memory.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetValidIGD(struct UPNPDev * devlist,
+ struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ char * lanaddr, int lanaddrlen)
+{
+ struct xml_desc {
+ char * xml;
+ int size;
+ int is_igd;
+ } * desc = NULL;
+ struct UPNPDev * dev;
+ int ndev = 0;
+ int i;
+ int state = -1; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
+ int n_igd = 0;
+ char extIpAddr[16];
+ char myLanAddr[40];
+ int status_code = -1;
+
+ if(!devlist)
+ {
+#ifdef DEBUG
+ printf("Empty devlist\n");
+#endif
+ return 0;
+ }
+ /* counting total number of devices in the list */
+ for(dev = devlist; dev; dev = dev->pNext)
+ ndev++;
+ if(ndev > 0)
+ {
+ desc = calloc(ndev, sizeof(struct xml_desc));
+ if(!desc)
+ return -1; /* memory allocation error */
+ }
+ /* Step 1 : downloading descriptions and testing type */
+ for(dev = devlist, i = 0; dev; dev = dev->pNext, i++)
+ {
+ /* we should choose an internet gateway device.
+ * with st == urn:schemas-upnp-org:device:InternetGatewayDevice:1 */
+ desc[i].xml = miniwget_getaddr(dev->descURL, &(desc[i].size),
+ myLanAddr, sizeof(myLanAddr),
+ dev->scope_id, &status_code);
+#ifdef DEBUG
+ if(!desc[i].xml)
+ {
+ printf("error getting XML description %s\n", dev->descURL);
+ }
+#endif
+ if(desc[i].xml)
+ {
+ memset(data, 0, sizeof(struct IGDdatas));
+ memset(urls, 0, sizeof(struct UPNPUrls));
+ parserootdesc(desc[i].xml, desc[i].size, data);
+ if(COMPARE(data->CIF.servicetype,
+ "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:"))
+ {
+ desc[i].is_igd = 1;
+ n_igd++;
+ if(lanaddr)
+ strncpy(lanaddr, myLanAddr, lanaddrlen);
+ }
+ }
+ }
+ /* iterate the list to find a device depending on state */
+ for(state = 1; state <= 3; state++)
+ {
+ for(dev = devlist, i = 0; dev; dev = dev->pNext, i++)
+ {
+ if(desc[i].xml)
+ {
+ memset(data, 0, sizeof(struct IGDdatas));
+ memset(urls, 0, sizeof(struct UPNPUrls));
+ parserootdesc(desc[i].xml, desc[i].size, data);
+ if(desc[i].is_igd || state >= 3 )
+ {
+ int is_connected;
+
+ GetUPNPUrls(urls, data, dev->descURL, dev->scope_id);
+
+ /* in state 2 and 3 we don't test if device is connected ! */
+ if(state >= 2)
+ goto free_and_return;
+ is_connected = UPNPIGD_IsConnected(urls, data);
+#ifdef DEBUG
+ printf("UPNPIGD_IsConnected(%s) = %d\n",
+ urls->controlURL, is_connected);
+#endif
+ /* checks that status is connected AND there is a external IP address assigned */
+ if(is_connected &&
+ (UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) {
+ if(!is_rfc1918addr(extIpAddr) && (extIpAddr[0] != '\0')
+ && (0 != strcmp(extIpAddr, "0.0.0.0")))
+ goto free_and_return;
+ }
+ FreeUPNPUrls(urls);
+ if(data->second.servicetype[0] != '\0') {
+#ifdef DEBUG
+ printf("We tried %s, now we try %s !\n",
+ data->first.servicetype, data->second.servicetype);
+#endif
+ /* swaping WANPPPConnection and WANIPConnection ! */
+ memcpy(&data->tmp, &data->first, sizeof(struct IGDdatas_service));
+ memcpy(&data->first, &data->second, sizeof(struct IGDdatas_service));
+ memcpy(&data->second, &data->tmp, sizeof(struct IGDdatas_service));
+ GetUPNPUrls(urls, data, dev->descURL, dev->scope_id);
+ is_connected = UPNPIGD_IsConnected(urls, data);
+#ifdef DEBUG
+ printf("UPNPIGD_IsConnected(%s) = %d\n",
+ urls->controlURL, is_connected);
+#endif
+ if(is_connected &&
+ (UPNP_GetExternalIPAddress(urls->controlURL, data->first.servicetype, extIpAddr) == 0)) {
+ if(!is_rfc1918addr(extIpAddr) && (extIpAddr[0] != '\0')
+ && (0 != strcmp(extIpAddr, "0.0.0.0")))
+ goto free_and_return;
+ }
+ FreeUPNPUrls(urls);
+ }
+ }
+ memset(data, 0, sizeof(struct IGDdatas));
+ }
+ }
+ }
+ state = 0;
+free_and_return:
+ if(desc) {
+ for(i = 0; i < ndev; i++) {
+ if(desc[i].xml) {
+ free(desc[i].xml);
+ }
+ }
+ free(desc);
+ }
+ return state;
+}
+
+/* UPNP_GetIGDFromUrl()
+ * Used when skipping the discovery process.
+ * return value :
+ * 0 - Not ok
+ * 1 - OK */
+int
+UPNP_GetIGDFromUrl(const char * rootdescurl,
+ struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ char * lanaddr, int lanaddrlen)
+{
+ char * descXML;
+ int descXMLsize = 0;
+
+ descXML = miniwget_getaddr(rootdescurl, &descXMLsize,
+ lanaddr, lanaddrlen, 0, NULL);
+ if(descXML) {
+ memset(data, 0, sizeof(struct IGDdatas));
+ memset(urls, 0, sizeof(struct UPNPUrls));
+ parserootdesc(descXML, descXMLsize, data);
+ free(descXML);
+ descXML = NULL;
+ GetUPNPUrls(urls, data, rootdescurl, 0);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
diff --git a/thirdparty/miniupnpc/miniupnpc.def b/thirdparty/miniupnpc/miniupnpc.def
new file mode 100644
index 0000000000..60e0bbe423
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc.def
@@ -0,0 +1,45 @@
+LIBRARY
+; miniupnpc library
+ miniupnpc
+
+EXPORTS
+; miniupnpc
+ upnpDiscover
+ freeUPNPDevlist
+ parserootdesc
+ UPNP_GetValidIGD
+ UPNP_GetIGDFromUrl
+ GetUPNPUrls
+ FreeUPNPUrls
+; miniwget
+ miniwget
+ miniwget_getaddr
+; upnpcommands
+ UPNP_GetTotalBytesSent
+ UPNP_GetTotalBytesReceived
+ UPNP_GetTotalPacketsSent
+ UPNP_GetTotalPacketsReceived
+ UPNP_GetStatusInfo
+ UPNP_GetConnectionTypeInfo
+ UPNP_GetExternalIPAddress
+ UPNP_GetLinkLayerMaxBitRates
+ UPNP_AddPortMapping
+ UPNP_AddAnyPortMapping
+ UPNP_DeletePortMapping
+ UPNP_DeletePortMappingRange
+ UPNP_GetPortMappingNumberOfEntries
+ UPNP_GetSpecificPortMappingEntry
+ UPNP_GetGenericPortMappingEntry
+ UPNP_GetListOfPortMappings
+ UPNP_AddPinhole
+ UPNP_CheckPinholeWorking
+ UPNP_UpdatePinhole
+ UPNP_GetPinholePackets
+ UPNP_DeletePinhole
+ UPNP_GetFirewallStatus
+ UPNP_GetOutboundPinholeTimeout
+; upnperrors
+ strupnperror
+; portlistingparse
+ ParsePortListing
+ FreePortListing
diff --git a/thirdparty/miniupnpc/miniupnpc.h b/thirdparty/miniupnpc/miniupnpc.h
new file mode 100644
index 0000000000..8ddc282bd1
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc.h
@@ -0,0 +1,153 @@
+/* $Id: miniupnpc.h,v 1.53 2018/05/07 11:05:16 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project: miniupnp
+ * http://miniupnp.free.fr/
+ * Author: Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef MINIUPNPC_H_INCLUDED
+#define MINIUPNPC_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+#include "igd_desc_parse.h"
+#include "upnpdev.h"
+
+/* error codes : */
+#define UPNPDISCOVER_SUCCESS (0)
+#define UPNPDISCOVER_UNKNOWN_ERROR (-1)
+#define UPNPDISCOVER_SOCKET_ERROR (-101)
+#define UPNPDISCOVER_MEMORY_ERROR (-102)
+
+/* versions : */
+#define MINIUPNPC_VERSION "2.1"
+#define MINIUPNPC_API_VERSION 17
+
+/* Source port:
+ Using "1" as an alias for 1900 for backwards compatibility
+ (presuming one would have used that for the "sameport" parameter) */
+#define UPNP_LOCAL_PORT_ANY 0
+#define UPNP_LOCAL_PORT_SAME 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Structures definitions : */
+struct UPNParg { const char * elt; const char * val; };
+
+char *
+simpleUPnPcommand(int, const char *, const char *,
+ const char *, struct UPNParg *,
+ int *);
+
+/* upnpDiscover()
+ * discover UPnP devices on the network.
+ * The discovered devices are returned as a chained list.
+ * It is up to the caller to free the list with freeUPNPDevlist().
+ * delay (in millisecond) is the maximum time for waiting any device
+ * response.
+ * If available, device list will be obtained from MiniSSDPd.
+ * Default path for minissdpd socket will be used if minissdpdsock argument
+ * is NULL.
+ * If multicastif is not NULL, it will be used instead of the default
+ * multicast interface for sending SSDP discover packets.
+ * If localport is set to UPNP_LOCAL_PORT_SAME(1) SSDP packets will be sent
+ * from the source port 1900 (same as destination port), if set to
+ * UPNP_LOCAL_PORT_ANY(0) system assign a source port, any other value will
+ * be attempted as the source port.
+ * "searchalltypes" parameter is useful when searching several types,
+ * if 0, the discovery will stop with the first type returning results.
+ * TTL should default to 2. */
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscover(int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverAll(int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverDevice(const char * device, int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverDevices(const char * const deviceTypes[],
+ int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error,
+ int searchalltypes);
+
+/* parserootdesc() :
+ * parse root XML description of a UPnP device and fill the IGDdatas
+ * structure. */
+MINIUPNP_LIBSPEC void parserootdesc(const char *, int, struct IGDdatas *);
+
+/* structure used to get fast access to urls
+ * controlURL: controlURL of the WANIPConnection
+ * ipcondescURL: url of the description of the WANIPConnection
+ * controlURL_CIF: controlURL of the WANCommonInterfaceConfig
+ * controlURL_6FC: controlURL of the WANIPv6FirewallControl
+ */
+struct UPNPUrls {
+ char * controlURL;
+ char * ipcondescURL;
+ char * controlURL_CIF;
+ char * controlURL_6FC;
+ char * rootdescURL;
+};
+
+/* UPNP_GetValidIGD() :
+ * return values :
+ * 0 = NO IGD found
+ * 1 = A valid connected IGD has been found
+ * 2 = A valid IGD has been found but it reported as
+ * not connected
+ * 3 = an UPnP device has been found but was not recognized as an IGD
+ *
+ * In any non zero return case, the urls and data structures
+ * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
+ * free allocated memory.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetValidIGD(struct UPNPDev * devlist,
+ struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ char * lanaddr, int lanaddrlen);
+
+/* UPNP_GetIGDFromUrl()
+ * Used when skipping the discovery process.
+ * When succeding, urls, data, and lanaddr arguments are set.
+ * return value :
+ * 0 - Not ok
+ * 1 - OK */
+MINIUPNP_LIBSPEC int
+UPNP_GetIGDFromUrl(const char * rootdescurl,
+ struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ char * lanaddr, int lanaddrlen);
+
+MINIUPNP_LIBSPEC void
+GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *,
+ const char *, unsigned int);
+
+MINIUPNP_LIBSPEC void
+FreeUPNPUrls(struct UPNPUrls *);
+
+/* return 0 or 1 */
+MINIUPNP_LIBSPEC int UPNPIGD_IsConnected(struct UPNPUrls *, struct IGDdatas *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpc.h b/thirdparty/miniupnpc/miniupnpc/miniupnpc.h
new file mode 100644
index 0000000000..8ddc282bd1
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc/miniupnpc.h
@@ -0,0 +1,153 @@
+/* $Id: miniupnpc.h,v 1.53 2018/05/07 11:05:16 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project: miniupnp
+ * http://miniupnp.free.fr/
+ * Author: Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef MINIUPNPC_H_INCLUDED
+#define MINIUPNPC_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+#include "igd_desc_parse.h"
+#include "upnpdev.h"
+
+/* error codes : */
+#define UPNPDISCOVER_SUCCESS (0)
+#define UPNPDISCOVER_UNKNOWN_ERROR (-1)
+#define UPNPDISCOVER_SOCKET_ERROR (-101)
+#define UPNPDISCOVER_MEMORY_ERROR (-102)
+
+/* versions : */
+#define MINIUPNPC_VERSION "2.1"
+#define MINIUPNPC_API_VERSION 17
+
+/* Source port:
+ Using "1" as an alias for 1900 for backwards compatibility
+ (presuming one would have used that for the "sameport" parameter) */
+#define UPNP_LOCAL_PORT_ANY 0
+#define UPNP_LOCAL_PORT_SAME 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Structures definitions : */
+struct UPNParg { const char * elt; const char * val; };
+
+char *
+simpleUPnPcommand(int, const char *, const char *,
+ const char *, struct UPNParg *,
+ int *);
+
+/* upnpDiscover()
+ * discover UPnP devices on the network.
+ * The discovered devices are returned as a chained list.
+ * It is up to the caller to free the list with freeUPNPDevlist().
+ * delay (in millisecond) is the maximum time for waiting any device
+ * response.
+ * If available, device list will be obtained from MiniSSDPd.
+ * Default path for minissdpd socket will be used if minissdpdsock argument
+ * is NULL.
+ * If multicastif is not NULL, it will be used instead of the default
+ * multicast interface for sending SSDP discover packets.
+ * If localport is set to UPNP_LOCAL_PORT_SAME(1) SSDP packets will be sent
+ * from the source port 1900 (same as destination port), if set to
+ * UPNP_LOCAL_PORT_ANY(0) system assign a source port, any other value will
+ * be attempted as the source port.
+ * "searchalltypes" parameter is useful when searching several types,
+ * if 0, the discovery will stop with the first type returning results.
+ * TTL should default to 2. */
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscover(int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverAll(int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverDevice(const char * device, int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error);
+
+MINIUPNP_LIBSPEC struct UPNPDev *
+upnpDiscoverDevices(const char * const deviceTypes[],
+ int delay, const char * multicastif,
+ const char * minissdpdsock, int localport,
+ int ipv6, unsigned char ttl,
+ int * error,
+ int searchalltypes);
+
+/* parserootdesc() :
+ * parse root XML description of a UPnP device and fill the IGDdatas
+ * structure. */
+MINIUPNP_LIBSPEC void parserootdesc(const char *, int, struct IGDdatas *);
+
+/* structure used to get fast access to urls
+ * controlURL: controlURL of the WANIPConnection
+ * ipcondescURL: url of the description of the WANIPConnection
+ * controlURL_CIF: controlURL of the WANCommonInterfaceConfig
+ * controlURL_6FC: controlURL of the WANIPv6FirewallControl
+ */
+struct UPNPUrls {
+ char * controlURL;
+ char * ipcondescURL;
+ char * controlURL_CIF;
+ char * controlURL_6FC;
+ char * rootdescURL;
+};
+
+/* UPNP_GetValidIGD() :
+ * return values :
+ * 0 = NO IGD found
+ * 1 = A valid connected IGD has been found
+ * 2 = A valid IGD has been found but it reported as
+ * not connected
+ * 3 = an UPnP device has been found but was not recognized as an IGD
+ *
+ * In any non zero return case, the urls and data structures
+ * passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
+ * free allocated memory.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetValidIGD(struct UPNPDev * devlist,
+ struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ char * lanaddr, int lanaddrlen);
+
+/* UPNP_GetIGDFromUrl()
+ * Used when skipping the discovery process.
+ * When succeding, urls, data, and lanaddr arguments are set.
+ * return value :
+ * 0 - Not ok
+ * 1 - OK */
+MINIUPNP_LIBSPEC int
+UPNP_GetIGDFromUrl(const char * rootdescurl,
+ struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ char * lanaddr, int lanaddrlen);
+
+MINIUPNP_LIBSPEC void
+GetUPNPUrls(struct UPNPUrls *, struct IGDdatas *,
+ const char *, unsigned int);
+
+MINIUPNP_LIBSPEC void
+FreeUPNPUrls(struct UPNPUrls *);
+
+/* return 0 or 1 */
+MINIUPNP_LIBSPEC int UPNPIGD_IsConnected(struct UPNPUrls *, struct IGDdatas *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/thirdparty/miniupnpc/miniupnpc/miniwget.h b/thirdparty/miniupnpc/miniupnpc/miniwget.h
new file mode 100644
index 0000000000..f5572c2544
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc/miniwget.h
@@ -0,0 +1,27 @@
+/* $Id: miniwget.h,v 1.12 2016/01/24 17:24:36 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef MINIWGET_H_INCLUDED
+#define MINIWGET_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int, int *);
+
+MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, unsigned int, int *);
+
+int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/miniupnpc/miniupnpc/upnpcommands.h b/thirdparty/miniupnpc/miniupnpc/upnpcommands.h
new file mode 100644
index 0000000000..0c6d501666
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc/upnpcommands.h
@@ -0,0 +1,348 @@
+/* $Id: upnpcommands.h,v 1.32 2018/03/13 23:34:47 nanard Exp $ */
+/* Miniupnp project : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided within this distribution */
+#ifndef UPNPCOMMANDS_H_INCLUDED
+#define UPNPCOMMANDS_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+#include "miniupnpctypes.h"
+
+/* MiniUPnPc return codes : */
+#define UPNPCOMMAND_SUCCESS (0)
+#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
+#define UPNPCOMMAND_INVALID_ARGS (-2)
+#define UPNPCOMMAND_HTTP_ERROR (-3)
+#define UPNPCOMMAND_INVALID_RESPONSE (-4)
+#define UPNPCOMMAND_MEM_ALLOC_ERROR (-5)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct PortMappingParserData;
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesSent(const char * controlURL,
+ const char * servicetype);
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesReceived(const char * controlURL,
+ const char * servicetype);
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsSent(const char * controlURL,
+ const char * servicetype);
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsReceived(const char * controlURL,
+ const char * servicetype);
+
+/* UPNP_GetStatusInfo()
+ * status and lastconnerror are 64 byte buffers
+ * Return values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error code */
+MINIUPNP_LIBSPEC int
+UPNP_GetStatusInfo(const char * controlURL,
+ const char * servicetype,
+ char * status,
+ unsigned int * uptime,
+ char * lastconnerror);
+
+/* UPNP_GetConnectionTypeInfo()
+ * argument connectionType is a 64 character buffer
+ * Return Values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error code */
+MINIUPNP_LIBSPEC int
+UPNP_GetConnectionTypeInfo(const char * controlURL,
+ const char * servicetype,
+ char * connectionType);
+
+/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
+ * if the third arg is not null the value is copied to it.
+ * at least 16 bytes must be available
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR Either an UPnP error code or an unknown error.
+ *
+ * possible UPnP Errors :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control. */
+MINIUPNP_LIBSPEC int
+UPNP_GetExternalIPAddress(const char * controlURL,
+ const char * servicetype,
+ char * extIpAdd);
+
+/* UPNP_GetLinkLayerMaxBitRates()
+ * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
+ *
+ * return values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code. */
+MINIUPNP_LIBSPEC int
+UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
+ const char* servicetype,
+ unsigned int * bitrateDown,
+ unsigned int * bitrateUp);
+
+/* UPNP_AddPortMapping()
+ * if desc is NULL, it will be defaulted to "libminiupnpc"
+ * remoteHost is usually NULL because IGD don't support it.
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
+ *
+ * List of possible UPnP errors for AddPortMapping :
+ * errorCode errorDescription (short) - Description (long)
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization and
+ * the sender was not authorized.
+ * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
+ * wild-carded
+ * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
+ * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
+ * with a mapping assigned previously to another client
+ * 724 SamePortValuesRequired - Internal and External port values
+ * must be the same
+ * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
+ * permanent lease times on port mappings
+ * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
+ * and cannot be a specific IP address or DNS name
+ * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
+ * cannot be a specific port value
+ * 728 NoPortMapsAvailable - There are not enough free ports available to
+ * complete port mapping.
+ * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
+ * due to conflict with other mechanisms.
+ * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
+ */
+MINIUPNP_LIBSPEC int
+UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort,
+ const char * inPort,
+ const char * inClient,
+ const char * desc,
+ const char * proto,
+ const char * remoteHost,
+ const char * leaseDuration);
+
+/* UPNP_AddAnyPortMapping()
+ * if desc is NULL, it will be defaulted to "libminiupnpc"
+ * remoteHost is usually NULL because IGD don't support it.
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
+ *
+ * List of possible UPnP errors for AddPortMapping :
+ * errorCode errorDescription (short) - Description (long)
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization and
+ * the sender was not authorized.
+ * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
+ * wild-carded
+ * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
+ * 728 NoPortMapsAvailable - There are not enough free ports available to
+ * complete port mapping.
+ * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
+ * due to conflict with other mechanisms.
+ * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
+ */
+MINIUPNP_LIBSPEC int
+UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort,
+ const char * inPort,
+ const char * inClient,
+ const char * desc,
+ const char * proto,
+ const char * remoteHost,
+ const char * leaseDuration,
+ char * reservedPort);
+
+/* UPNP_DeletePortMapping()
+ * Use same argument values as what was used for AddPortMapping().
+ * remoteHost is usually NULL because IGD don't support it.
+ * Return Values :
+ * 0 : SUCCESS
+ * NON ZERO : error. Either an UPnP error code or an undefined error.
+ *
+ * List of possible UPnP errors for DeletePortMapping :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 714 NoSuchEntryInArray - The specified value does not exist in the array */
+MINIUPNP_LIBSPEC int
+UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort, const char * proto,
+ const char * remoteHost);
+
+/* UPNP_DeletePortRangeMapping()
+ * Use same argument values as what was used for AddPortMapping().
+ * remoteHost is usually NULL because IGD don't support it.
+ * Return Values :
+ * 0 : SUCCESS
+ * NON ZERO : error. Either an UPnP error code or an undefined error.
+ *
+ * List of possible UPnP errors for DeletePortMapping :
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 730 PortMappingNotFound - This error message is returned if no port
+ * mapping is found in the specified range.
+ * 733 InconsistentParameters - NewStartPort and NewEndPort values are not consistent. */
+MINIUPNP_LIBSPEC int
+UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
+ const char * extPortStart, const char * extPortEnd,
+ const char * proto,
+ const char * manage);
+
+/* UPNP_GetPortMappingNumberOfEntries()
+ * not supported by all routers */
+MINIUPNP_LIBSPEC int
+UPNP_GetPortMappingNumberOfEntries(const char* controlURL,
+ const char* servicetype,
+ unsigned int * num);
+
+/* UPNP_GetSpecificPortMappingEntry()
+ * retrieves an existing port mapping
+ * params :
+ * in extPort
+ * in proto
+ * in remoteHost
+ * out intClient (16 bytes)
+ * out intPort (6 bytes)
+ * out desc (80 bytes)
+ * out enabled (4 bytes)
+ * out leaseDuration (16 bytes)
+ *
+ * return value :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code.
+ *
+ * List of possible UPnP errors for _GetSpecificPortMappingEntry :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 714 NoSuchEntryInArray - The specified value does not exist in the array.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetSpecificPortMappingEntry(const char * controlURL,
+ const char * servicetype,
+ const char * extPort,
+ const char * proto,
+ const char * remoteHost,
+ char * intClient,
+ char * intPort,
+ char * desc,
+ char * enabled,
+ char * leaseDuration);
+
+/* UPNP_GetGenericPortMappingEntry()
+ * params :
+ * in index
+ * out extPort (6 bytes)
+ * out intClient (16 bytes)
+ * out intPort (6 bytes)
+ * out protocol (4 bytes)
+ * out desc (80 bytes)
+ * out enabled (4 bytes)
+ * out rHost (64 bytes)
+ * out duration (16 bytes)
+ *
+ * return value :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code.
+ *
+ * Possible UPNP Error codes :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetGenericPortMappingEntry(const char * controlURL,
+ const char * servicetype,
+ const char * index,
+ char * extPort,
+ char * intClient,
+ char * intPort,
+ char * protocol,
+ char * desc,
+ char * enabled,
+ char * rHost,
+ char * duration);
+
+/* UPNP_GetListOfPortMappings() Available in IGD v2
+ *
+ *
+ * Possible UPNP Error codes :
+ * 606 Action not Authorized
+ * 730 PortMappingNotFound - no port mapping is found in the specified range.
+ * 733 InconsistantParameters - NewStartPort and NewEndPort values are not
+ * consistent.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetListOfPortMappings(const char * controlURL,
+ const char * servicetype,
+ const char * startPort,
+ const char * endPort,
+ const char * protocol,
+ const char * numberOfPorts,
+ struct PortMappingParserData * data);
+
+/* IGD:2, functions for service WANIPv6FirewallControl:1 */
+MINIUPNP_LIBSPEC int
+UPNP_GetFirewallStatus(const char * controlURL,
+ const char * servicetype,
+ int * firewallEnabled,
+ int * inboundPinholeAllowed);
+
+MINIUPNP_LIBSPEC int
+UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype,
+ const char * remoteHost,
+ const char * remotePort,
+ const char * intClient,
+ const char * intPort,
+ const char * proto,
+ int * opTimeout);
+
+MINIUPNP_LIBSPEC int
+UPNP_AddPinhole(const char * controlURL, const char * servicetype,
+ const char * remoteHost,
+ const char * remotePort,
+ const char * intClient,
+ const char * intPort,
+ const char * proto,
+ const char * leaseTime,
+ char * uniqueID);
+
+MINIUPNP_LIBSPEC int
+UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
+ const char * uniqueID,
+ const char * leaseTime);
+
+MINIUPNP_LIBSPEC int
+UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
+
+MINIUPNP_LIBSPEC int
+UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
+ const char * uniqueID, int * isWorking);
+
+MINIUPNP_LIBSPEC int
+UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
+ const char * uniqueID, int * packets);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/thirdparty/miniupnpc/miniupnpc_declspec.h b/thirdparty/miniupnpc/miniupnpc_declspec.h
new file mode 100644
index 0000000000..40adb922ec
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc_declspec.h
@@ -0,0 +1,21 @@
+#ifndef MINIUPNPC_DECLSPEC_H_INCLUDED
+#define MINIUPNPC_DECLSPEC_H_INCLUDED
+
+#if defined(_WIN32) && !defined(MINIUPNP_STATICLIB)
+ /* for windows dll */
+ #ifdef MINIUPNP_EXPORTS
+ #define MINIUPNP_LIBSPEC __declspec(dllexport)
+ #else
+ #define MINIUPNP_LIBSPEC __declspec(dllimport)
+ #endif
+#else
+ #if defined(__GNUC__) && __GNUC__ >= 4
+ /* fix dynlib for OS X 10.9.2 and Apple LLVM version 5.0 */
+ #define MINIUPNP_LIBSPEC __attribute__ ((visibility ("default")))
+ #else
+ #define MINIUPNP_LIBSPEC
+ #endif
+#endif
+
+#endif /* MINIUPNPC_DECLSPEC_H_INCLUDED */
+
diff --git a/thirdparty/miniupnpc/miniupnpc_socketdef.h b/thirdparty/miniupnpc/miniupnpc_socketdef.h
new file mode 100644
index 0000000000..965d9151b9
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpc_socketdef.h
@@ -0,0 +1,37 @@
+/* $Id: miniupnpc_socketdef.h,v 1.1 2018/03/13 23:44:10 nanard Exp $ */
+/* Miniupnp project : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
+ * Author : Thomas Bernard
+ * Copyright (c) 2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided within this distribution */
+#ifndef MINIUPNPC_SOCKETDEF_H_INCLUDED
+#define MINIUPNPC_SOCKETDEF_H_INCLUDED
+
+#ifdef _MSC_VER
+
+#define ISINVALID(s) (INVALID_SOCKET==(s))
+
+#else
+
+#ifndef SOCKET
+#define SOCKET int
+#endif
+#ifndef SSIZE_T
+#define SSIZE_T ssize_t
+#endif
+#ifndef INVALID_SOCKET
+#define INVALID_SOCKET (-1)
+#endif
+#ifndef ISINVALID
+#define ISINVALID(s) ((s)<0)
+#endif
+
+#endif
+
+#ifdef _WIN32
+#define PRINT_SOCKET_ERROR(x) fprintf(stderr, "Socket error: %s, %d\n", x, WSAGetLastError());
+#else
+#define PRINT_SOCKET_ERROR(x) perror(x)
+#endif
+
+#endif /* MINIUPNPC_SOCKETDEF_H_INCLUDED */
diff --git a/thirdparty/miniupnpc/miniupnpcmodule.c b/thirdparty/miniupnpc/miniupnpcmodule.c
new file mode 100644
index 0000000000..8657a0e002
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpcmodule.c
@@ -0,0 +1,703 @@
+/* $Id: miniupnpcmodule.c,v 1.24 2014/06/10 09:48:11 nanard Exp $*/
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * website : https://miniupnp.tuxfamily.org/
+ * copyright (c) 2007-2018 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#include <Python.h>
+#define MINIUPNP_STATICLIB
+#include "structmember.h"
+#include "miniupnpc.h"
+#include "upnpcommands.h"
+#include "upnperrors.h"
+
+#ifdef _WIN32
+#include <winsock2.h>
+#endif
+
+/* for compatibility with Python < 2.4 */
+#ifndef Py_RETURN_NONE
+#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#endif
+
+#ifndef Py_RETURN_TRUE
+#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
+#endif
+
+#ifndef Py_RETURN_FALSE
+#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
+#endif
+
+/* for compatibility with Python < 3.0 */
+#ifndef PyVarObject_HEAD_INIT
+#define PyVarObject_HEAD_INIT(type, size) \
+ PyObject_HEAD_INIT(type) size,
+#endif
+
+#ifndef Py_TYPE
+#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+#endif
+
+typedef struct {
+ PyObject_HEAD
+ /* Type-specific fields go here. */
+ struct UPNPDev * devlist;
+ struct UPNPUrls urls;
+ struct IGDdatas data;
+ unsigned int discoverdelay; /* value passed to upnpDiscover() */
+ unsigned int localport; /* value passed to upnpDiscover() */
+ char lanaddr[40]; /* our ip address on the LAN */
+ char * multicastif;
+ char * minissdpdsocket;
+} UPnPObject;
+
+static PyMemberDef UPnP_members[] = {
+ {"lanaddr", T_STRING_INPLACE, offsetof(UPnPObject, lanaddr),
+ READONLY, "ip address on the LAN"
+ },
+ {"discoverdelay", T_UINT, offsetof(UPnPObject, discoverdelay),
+ 0/*READWRITE*/, "value in ms used to wait for SSDP responses"
+ },
+ {"localport", T_UINT, offsetof(UPnPObject, localport),
+ 0/*READWRITE*/,
+ "If localport is set to UPNP_LOCAL_PORT_SAME(1) "
+ "SSDP packets will be sent from the source port "
+ "1900 (same as destination port), if set to "
+ "UPNP_LOCAL_PORT_ANY(0) system assign a source "
+ "port, any other value will be attempted as the "
+ "source port"
+ },
+ /* T_STRING is allways readonly :( */
+ {"multicastif", T_STRING, offsetof(UPnPObject, multicastif),
+ 0, "IP of the network interface to be used for multicast operations"
+ },
+ {"minissdpdsocket", T_STRING, offsetof(UPnPObject, minissdpdsocket),
+ 0, "path of the MiniSSDPd unix socket"
+ },
+ {NULL}
+};
+
+
+static int UPnP_init(UPnPObject *self, PyObject *args, PyObject *kwds)
+{
+ char* multicastif = NULL;
+ char* minissdpdsocket = NULL;
+ static char *kwlist[] = {
+ "multicastif", "minissdpdsocket", "discoverdelay",
+ "localport", NULL
+ };
+
+ if(!PyArg_ParseTupleAndKeywords(args, kwds, "|zzII", kwlist,
+ &multicastif,
+ &minissdpdsocket,
+ &self->discoverdelay,
+ &self->localport))
+ return -1;
+
+ if(self->localport>1 &&
+ (self->localport>65534||self->localport<1024)) {
+ PyErr_SetString(PyExc_Exception, "Invalid localport value");
+ return -1;
+ }
+ if(multicastif)
+ self->multicastif = strdup(multicastif);
+ if(minissdpdsocket)
+ self->minissdpdsocket = strdup(minissdpdsocket);
+
+ return 0;
+}
+
+static void
+UPnPObject_dealloc(UPnPObject *self)
+{
+ freeUPNPDevlist(self->devlist);
+ FreeUPNPUrls(&self->urls);
+ free(self->multicastif);
+ free(self->minissdpdsocket);
+ Py_TYPE(self)->tp_free((PyObject*)self);
+}
+
+static PyObject *
+UPnP_discover(UPnPObject *self)
+{
+ struct UPNPDev * dev;
+ int i;
+ PyObject *res = NULL;
+ if(self->devlist)
+ {
+ freeUPNPDevlist(self->devlist);
+ self->devlist = 0;
+ }
+ Py_BEGIN_ALLOW_THREADS
+ self->devlist = upnpDiscover((int)self->discoverdelay/*timeout in ms*/,
+ self->multicastif,
+ self->minissdpdsocket,
+ (int)self->localport,
+ 0/*ip v6*/,
+ 2/* TTL */,
+ 0/*error */);
+ Py_END_ALLOW_THREADS
+ /* Py_RETURN_NONE ??? */
+ for(dev = self->devlist, i = 0; dev; dev = dev->pNext)
+ i++;
+ res = Py_BuildValue("i", i);
+ return res;
+}
+
+static PyObject *
+UPnP_selectigd(UPnPObject *self)
+{
+ int r;
+Py_BEGIN_ALLOW_THREADS
+ r = UPNP_GetValidIGD(self->devlist, &self->urls, &self->data,
+ self->lanaddr, sizeof(self->lanaddr));
+Py_END_ALLOW_THREADS
+ if(r)
+ {
+ return Py_BuildValue("s", self->urls.controlURL);
+ }
+ else
+ {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, "No UPnP device discovered");
+ return NULL;
+ }
+}
+
+static PyObject *
+UPnP_totalbytesent(UPnPObject *self)
+{
+ UNSIGNED_INTEGER i;
+Py_BEGIN_ALLOW_THREADS
+ i = UPNP_GetTotalBytesSent(self->urls.controlURL_CIF,
+ self->data.CIF.servicetype);
+Py_END_ALLOW_THREADS
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("I", i);
+#else
+ return Py_BuildValue("i", (int)i);
+#endif
+}
+
+static PyObject *
+UPnP_totalbytereceived(UPnPObject *self)
+{
+ UNSIGNED_INTEGER i;
+Py_BEGIN_ALLOW_THREADS
+ i = UPNP_GetTotalBytesReceived(self->urls.controlURL_CIF,
+ self->data.CIF.servicetype);
+Py_END_ALLOW_THREADS
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("I", i);
+#else
+ return Py_BuildValue("i", (int)i);
+#endif
+}
+
+static PyObject *
+UPnP_totalpacketsent(UPnPObject *self)
+{
+ UNSIGNED_INTEGER i;
+Py_BEGIN_ALLOW_THREADS
+ i = UPNP_GetTotalPacketsSent(self->urls.controlURL_CIF,
+ self->data.CIF.servicetype);
+Py_END_ALLOW_THREADS
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("I", i);
+#else
+ return Py_BuildValue("i", (int)i);
+#endif
+}
+
+static PyObject *
+UPnP_totalpacketreceived(UPnPObject *self)
+{
+ UNSIGNED_INTEGER i;
+Py_BEGIN_ALLOW_THREADS
+ i = UPNP_GetTotalPacketsReceived(self->urls.controlURL_CIF,
+ self->data.CIF.servicetype);
+Py_END_ALLOW_THREADS
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("I", i);
+#else
+ return Py_BuildValue("i", (int)i);
+#endif
+}
+
+static PyObject *
+UPnP_statusinfo(UPnPObject *self)
+{
+ char status[64];
+ char lastconnerror[64];
+ unsigned int uptime = 0;
+ int r;
+ status[0] = '\0';
+ lastconnerror[0] = '\0';
+Py_BEGIN_ALLOW_THREADS
+ r = UPNP_GetStatusInfo(self->urls.controlURL, self->data.first.servicetype,
+ status, &uptime, lastconnerror);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("(s,I,s)", status, uptime, lastconnerror);
+#else
+ return Py_BuildValue("(s,i,s)", status, (int)uptime, lastconnerror);
+#endif
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+static PyObject *
+UPnP_connectiontype(UPnPObject *self)
+{
+ char connectionType[64];
+ int r;
+ connectionType[0] = '\0';
+Py_BEGIN_ALLOW_THREADS
+ r = UPNP_GetConnectionTypeInfo(self->urls.controlURL,
+ self->data.first.servicetype,
+ connectionType);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+ return Py_BuildValue("s", connectionType);
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+static PyObject *
+UPnP_externalipaddress(UPnPObject *self)
+{
+ char externalIPAddress[40];
+ int r;
+ externalIPAddress[0] = '\0';
+Py_BEGIN_ALLOW_THREADS
+ r = UPNP_GetExternalIPAddress(self->urls.controlURL,
+ self->data.first.servicetype,
+ externalIPAddress);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+ return Py_BuildValue("s", externalIPAddress);
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+/* AddPortMapping(externalPort, protocol, internalHost, internalPort, desc,
+ * remoteHost)
+ * protocol is 'UDP' or 'TCP' */
+static PyObject *
+UPnP_addportmapping(UPnPObject *self, PyObject *args)
+{
+ char extPort[6];
+ unsigned short ePort;
+ char inPort[6];
+ unsigned short iPort;
+ const char * proto;
+ const char * host;
+ const char * desc;
+ const char * remoteHost;
+ const char * leaseDuration = "0";
+ int r;
+ if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto,
+ &host, &iPort, &desc, &remoteHost))
+ return NULL;
+Py_BEGIN_ALLOW_THREADS
+ sprintf(extPort, "%hu", ePort);
+ sprintf(inPort, "%hu", iPort);
+ r = UPNP_AddPortMapping(self->urls.controlURL, self->data.first.servicetype,
+ extPort, inPort, host, desc, proto,
+ remoteHost, leaseDuration);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS)
+ {
+ Py_RETURN_TRUE;
+ }
+ else
+ {
+ // TODO: RAISE an Exception. See upnpcommands.h for errors codes.
+ // upnperrors.c
+ //Py_RETURN_FALSE;
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+/* AddAnyPortMapping(externalPort, protocol, internalHost, internalPort, desc,
+ * remoteHost)
+ * protocol is 'UDP' or 'TCP' */
+static PyObject *
+UPnP_addanyportmapping(UPnPObject *self, PyObject *args)
+{
+ char extPort[6];
+ unsigned short ePort;
+ char inPort[6];
+ unsigned short iPort;
+ char reservedPort[6];
+ const char * proto;
+ const char * host;
+ const char * desc;
+ const char * remoteHost;
+ const char * leaseDuration = "0";
+ int r;
+ if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto, &host, &iPort, &desc, &remoteHost))
+ return NULL;
+Py_BEGIN_ALLOW_THREADS
+ sprintf(extPort, "%hu", ePort);
+ sprintf(inPort, "%hu", iPort);
+ r = UPNP_AddAnyPortMapping(self->urls.controlURL, self->data.first.servicetype,
+ extPort, inPort, host, desc, proto,
+ remoteHost, leaseDuration, reservedPort);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+ return Py_BuildValue("i", atoi(reservedPort));
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+
+/* DeletePortMapping(extPort, proto, removeHost='')
+ * proto = 'UDP', 'TCP' */
+static PyObject *
+UPnP_deleteportmapping(UPnPObject *self, PyObject *args)
+{
+ char extPort[6];
+ unsigned short ePort;
+ const char * proto;
+ const char * remoteHost = "";
+ int r;
+ if(!PyArg_ParseTuple(args, "Hs|z", &ePort, &proto, &remoteHost))
+ return NULL;
+Py_BEGIN_ALLOW_THREADS
+ sprintf(extPort, "%hu", ePort);
+ r = UPNP_DeletePortMapping(self->urls.controlURL, self->data.first.servicetype,
+ extPort, proto, remoteHost);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+ Py_RETURN_TRUE;
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+/* DeletePortMappingRange(extPort, proto, removeHost='')
+ * proto = 'UDP', 'TCP' */
+static PyObject *
+UPnP_deleteportmappingrange(UPnPObject *self, PyObject *args)
+{
+ char extPortStart[6];
+ unsigned short ePortStart;
+ char extPortEnd[6];
+ unsigned short ePortEnd;
+ const char * proto;
+ unsigned char manage;
+ char manageStr[6];
+ int r;
+ if(!PyArg_ParseTuple(args, "HHsb", &ePortStart, &ePortEnd, &proto, &manage))
+ return NULL;
+Py_BEGIN_ALLOW_THREADS
+ sprintf(extPortStart, "%hu", ePortStart);
+ sprintf(extPortEnd, "%hu", ePortEnd);
+ sprintf(manageStr, "%hu", (unsigned short)manage);
+ r = UPNP_DeletePortMappingRange(self->urls.controlURL, self->data.first.servicetype,
+ extPortStart, extPortEnd, proto, manageStr);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+ Py_RETURN_TRUE;
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+static PyObject *
+UPnP_getportmappingnumberofentries(UPnPObject *self)
+{
+ unsigned int n = 0;
+ int r;
+Py_BEGIN_ALLOW_THREADS
+ r = UPNP_GetPortMappingNumberOfEntries(self->urls.controlURL,
+ self->data.first.servicetype,
+ &n);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS) {
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("I", n);
+#else
+ return Py_BuildValue("i", (int)n);
+#endif
+ } else {
+ /* TODO: have our own exception type ! */
+ PyErr_SetString(PyExc_Exception, strupnperror(r));
+ return NULL;
+ }
+}
+
+/* GetSpecificPortMapping(ePort, proto, remoteHost='')
+ * proto = 'UDP' or 'TCP' */
+static PyObject *
+UPnP_getspecificportmapping(UPnPObject *self, PyObject *args)
+{
+ char extPort[6];
+ unsigned short ePort;
+ const char * proto;
+ const char * remoteHost = "";
+ char intClient[40];
+ char intPort[6];
+ unsigned short iPort;
+ char desc[80];
+ char enabled[4];
+ char leaseDuration[16];
+ if(!PyArg_ParseTuple(args, "Hs|z", &ePort, &proto, &remoteHost))
+ return NULL;
+ extPort[0] = '\0'; intClient[0] = '\0'; intPort[0] = '\0';
+ desc[0] = '\0'; enabled[0] = '\0'; leaseDuration[0] = '\0';
+Py_BEGIN_ALLOW_THREADS
+ sprintf(extPort, "%hu", ePort);
+ UPNP_GetSpecificPortMappingEntry(self->urls.controlURL,
+ self->data.first.servicetype,
+ extPort, proto, remoteHost,
+ intClient, intPort,
+ desc, enabled, leaseDuration);
+Py_END_ALLOW_THREADS
+ if(intClient[0])
+ {
+ iPort = (unsigned short)atoi(intPort);
+ return Py_BuildValue("(s,H,s,O,i)",
+ intClient, iPort, desc,
+ PyBool_FromLong(atoi(enabled)),
+ atoi(leaseDuration));
+ }
+ else
+ {
+ Py_RETURN_NONE;
+ }
+}
+
+/* GetGenericPortMapping(index) */
+static PyObject *
+UPnP_getgenericportmapping(UPnPObject *self, PyObject *args)
+{
+ int i, r;
+ char index[8];
+ char intClient[40];
+ char intPort[6];
+ unsigned short iPort;
+ char extPort[6];
+ unsigned short ePort;
+ char protocol[4];
+ char desc[80];
+ char enabled[6];
+ char rHost[64];
+ char duration[16]; /* lease duration */
+ unsigned int dur;
+ if(!PyArg_ParseTuple(args, "i", &i))
+ return NULL;
+Py_BEGIN_ALLOW_THREADS
+ snprintf(index, sizeof(index), "%d", i);
+ rHost[0] = '\0'; enabled[0] = '\0';
+ duration[0] = '\0'; desc[0] = '\0';
+ extPort[0] = '\0'; intPort[0] = '\0'; intClient[0] = '\0';
+ r = UPNP_GetGenericPortMappingEntry(self->urls.controlURL,
+ self->data.first.servicetype,
+ index,
+ extPort, intClient, intPort,
+ protocol, desc, enabled, rHost,
+ duration);
+Py_END_ALLOW_THREADS
+ if(r==UPNPCOMMAND_SUCCESS)
+ {
+ ePort = (unsigned short)atoi(extPort);
+ iPort = (unsigned short)atoi(intPort);
+ dur = (unsigned int)strtoul(duration, 0, 0);
+#if (PY_MAJOR_VERSION >= 3) || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 3)
+ return Py_BuildValue("(H,s,(s,H),s,s,s,I)",
+ ePort, protocol, intClient, iPort,
+ desc, enabled, rHost, dur);
+#else
+ return Py_BuildValue("(i,s,(s,i),s,s,s,i)",
+ (int)ePort, protocol, intClient, (int)iPort,
+ desc, enabled, rHost, (int)dur);
+#endif
+ }
+ else
+ {
+ Py_RETURN_NONE;
+ }
+}
+
+/* miniupnpc.UPnP object Method Table */
+static PyMethodDef UPnP_methods[] = {
+ {"discover", (PyCFunction)UPnP_discover, METH_NOARGS,
+ "discover UPnP IGD devices on the network"
+ },
+ {"selectigd", (PyCFunction)UPnP_selectigd, METH_NOARGS,
+ "select a valid UPnP IGD among discovered devices"
+ },
+ {"totalbytesent", (PyCFunction)UPnP_totalbytesent, METH_NOARGS,
+ "return the total number of bytes sent by UPnP IGD"
+ },
+ {"totalbytereceived", (PyCFunction)UPnP_totalbytereceived, METH_NOARGS,
+ "return the total number of bytes received by UPnP IGD"
+ },
+ {"totalpacketsent", (PyCFunction)UPnP_totalpacketsent, METH_NOARGS,
+ "return the total number of packets sent by UPnP IGD"
+ },
+ {"totalpacketreceived", (PyCFunction)UPnP_totalpacketreceived, METH_NOARGS,
+ "return the total number of packets received by UPnP IGD"
+ },
+ {"statusinfo", (PyCFunction)UPnP_statusinfo, METH_NOARGS,
+ "return status and uptime"
+ },
+ {"connectiontype", (PyCFunction)UPnP_connectiontype, METH_NOARGS,
+ "return IGD WAN connection type"
+ },
+ {"externalipaddress", (PyCFunction)UPnP_externalipaddress, METH_NOARGS,
+ "return external IP address"
+ },
+ {"addportmapping", (PyCFunction)UPnP_addportmapping, METH_VARARGS,
+ "add a port mapping"
+ },
+ {"addanyportmapping", (PyCFunction)UPnP_addanyportmapping, METH_VARARGS,
+ "add a port mapping, IGD to select alternative if necessary"
+ },
+ {"deleteportmapping", (PyCFunction)UPnP_deleteportmapping, METH_VARARGS,
+ "delete a port mapping"
+ },
+ {"deleteportmappingrange", (PyCFunction)UPnP_deleteportmappingrange, METH_VARARGS,
+ "delete a range of port mappings"
+ },
+ {"getportmappingnumberofentries", (PyCFunction)UPnP_getportmappingnumberofentries, METH_NOARGS,
+ "-- non standard --"
+ },
+ {"getspecificportmapping", (PyCFunction)UPnP_getspecificportmapping, METH_VARARGS,
+ "get details about a specific port mapping entry"
+ },
+ {"getgenericportmapping", (PyCFunction)UPnP_getgenericportmapping, METH_VARARGS,
+ "get all details about the port mapping at index"
+ },
+ {NULL} /* Sentinel */
+};
+
+static PyTypeObject UPnPType = {
+ PyVarObject_HEAD_INIT(NULL,
+ 0) /*ob_size*/
+ "miniupnpc.UPnP", /*tp_name*/
+ sizeof(UPnPObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ (destructor)UPnPObject_dealloc,/*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "UPnP objects", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ UPnP_methods, /* tp_methods */
+ UPnP_members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)UPnP_init, /* tp_init */
+ 0, /* tp_alloc */
+#ifndef _WIN32
+ PyType_GenericNew,/*UPnP_new,*/ /* tp_new */
+#else
+ 0,
+#endif
+};
+
+/* module methods */
+static PyMethodDef miniupnpc_methods[] = {
+ {NULL} /* Sentinel */
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "miniupnpc", /* m_name */
+ "miniupnpc module.", /* m_doc */
+ -1, /* m_size */
+ miniupnpc_methods, /* m_methods */
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL, /* m_free */
+};
+#endif
+
+#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+
+PyMODINIT_FUNC
+#if PY_MAJOR_VERSION >= 3
+PyInit_miniupnpc(void)
+#else
+initminiupnpc(void)
+#endif
+{
+ PyObject* m;
+
+#ifdef _WIN32
+ /* initialize Winsock. */
+ WSADATA wsaData;
+ int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+
+ UPnPType.tp_new = PyType_GenericNew;
+#endif
+ if (PyType_Ready(&UPnPType) < 0)
+#if PY_MAJOR_VERSION >= 3
+ return 0;
+#else
+ return;
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ m = PyModule_Create(&moduledef);
+#else
+ m = Py_InitModule3("miniupnpc", miniupnpc_methods,
+ "miniupnpc module.");
+#endif
+
+ Py_INCREF(&UPnPType);
+ PyModule_AddObject(m, "UPnP", (PyObject *)&UPnPType);
+
+#if PY_MAJOR_VERSION >= 3
+ return m;
+#endif
+}
+
diff --git a/thirdparty/miniupnpc/miniupnpcstrings.h b/thirdparty/miniupnpc/miniupnpcstrings.h
new file mode 100644
index 0000000000..1d5c5882fd
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpcstrings.h
@@ -0,0 +1,17 @@
+#ifndef MINIUPNPCSTRINGS_H_INCLUDED
+#define MINIUPNPCSTRINGS_H_INCLUDED
+
+#include <version.h>
+
+#define OS_STRING VERSION_NAME "/1.0"
+#define MINIUPNPC_VERSION_STRING "2.1"
+
+#if 0
+/* according to "UPnP Device Architecture 1.0" */
+#define UPNP_VERSION_STRING "UPnP/1.0"
+#else
+/* according to "UPnP Device Architecture 1.1" */
+#define UPNP_VERSION_STRING "UPnP/1.1"
+#endif
+
+#endif
diff --git a/thirdparty/miniupnpc/miniupnpctypes.h b/thirdparty/miniupnpc/miniupnpctypes.h
new file mode 100644
index 0000000000..307ce39699
--- /dev/null
+++ b/thirdparty/miniupnpc/miniupnpctypes.h
@@ -0,0 +1,19 @@
+/* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */
+/* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org
+ * Author : Thomas Bernard
+ * Copyright (c) 2011 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided within this distribution */
+#ifndef MINIUPNPCTYPES_H_INCLUDED
+#define MINIUPNPCTYPES_H_INCLUDED
+
+#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
+#define UNSIGNED_INTEGER unsigned long long
+#define STRTOUI strtoull
+#else
+#define UNSIGNED_INTEGER unsigned int
+#define STRTOUI strtoul
+#endif
+
+#endif
+
diff --git a/thirdparty/miniupnpc/miniwget.c b/thirdparty/miniupnpc/miniwget.c
new file mode 100644
index 0000000000..a46ba76022
--- /dev/null
+++ b/thirdparty/miniupnpc/miniwget.c
@@ -0,0 +1,662 @@
+/* $Id: miniwget.c,v 1.78 2018/03/13 23:22:18 nanard Exp $ */
+/* Project : miniupnp
+ * Website : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <io.h>
+#define MAXHOSTNAMELEN 64
+#define snprintf _snprintf
+#define socklen_t int
+#ifndef strncasecmp
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#define strncasecmp _memicmp
+#else /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
+#define strncasecmp memicmp
+#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */
+#endif /* #ifndef strncasecmp */
+#else /* #ifdef _WIN32 */
+#include <unistd.h>
+#include <sys/param.h>
+#if defined(__amigaos__) && !defined(__amigaos4__)
+#define socklen_t int
+#else /* #if defined(__amigaos__) && !defined(__amigaos4__) */
+#include <sys/select.h>
+#endif /* #else defined(__amigaos__) && !defined(__amigaos4__) */
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <netdb.h>
+#define closesocket close
+#include <strings.h>
+#endif /* #else _WIN32 */
+#ifdef __GNU__
+#define MAXHOSTNAMELEN 64
+#endif /* __GNU__ */
+
+#ifndef MIN
+#define MIN(x,y) (((x)<(y))?(x):(y))
+#endif /* MIN */
+
+
+#include "miniupnpcstrings.h"
+#include "miniwget.h"
+#include "connecthostport.h"
+#include "receivedata.h"
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 64
+#endif
+
+/*
+ * Read a HTTP response from a socket.
+ * Process Content-Length and Transfer-encoding headers.
+ * return a pointer to the content buffer, which length is saved
+ * to the length parameter.
+ */
+void *
+getHTTPResponse(SOCKET s, int * size, int * status_code)
+{
+ char buf[2048];
+ int n;
+ int endofheaders = 0;
+ int chunked = 0;
+ int content_length = -1;
+ unsigned int chunksize = 0;
+ unsigned int bytestocopy = 0;
+ /* buffers : */
+ char * header_buf;
+ unsigned int header_buf_len = 2048;
+ unsigned int header_buf_used = 0;
+ char * content_buf;
+ unsigned int content_buf_len = 2048;
+ unsigned int content_buf_used = 0;
+ char chunksize_buf[32];
+ unsigned int chunksize_buf_index;
+#ifdef DEBUG
+ char * reason_phrase = NULL;
+ int reason_phrase_len = 0;
+#endif
+
+ if(status_code) *status_code = -1;
+ header_buf = malloc(header_buf_len);
+ if(header_buf == NULL)
+ {
+#ifdef DEBUG
+ fprintf(stderr, "%s: Memory allocation error\n", "getHTTPResponse");
+#endif /* DEBUG */
+ *size = -1;
+ return NULL;
+ }
+ content_buf = malloc(content_buf_len);
+ if(content_buf == NULL)
+ {
+ free(header_buf);
+#ifdef DEBUG
+ fprintf(stderr, "%s: Memory allocation error\n", "getHTTPResponse");
+#endif /* DEBUG */
+ *size = -1;
+ return NULL;
+ }
+ chunksize_buf[0] = '\0';
+ chunksize_buf_index = 0;
+
+ while((n = receivedata(s, buf, sizeof(buf), 5000, NULL)) > 0)
+ {
+ if(endofheaders == 0)
+ {
+ int i;
+ int linestart=0;
+ int colon=0;
+ int valuestart=0;
+ if(header_buf_used + n > header_buf_len) {
+ char * tmp = realloc(header_buf, header_buf_used + n);
+ if(tmp == NULL) {
+ /* memory allocation error */
+ free(header_buf);
+ free(content_buf);
+ *size = -1;
+ return NULL;
+ }
+ header_buf = tmp;
+ header_buf_len = header_buf_used + n;
+ }
+ memcpy(header_buf + header_buf_used, buf, n);
+ header_buf_used += n;
+ /* search for CR LF CR LF (end of headers)
+ * recognize also LF LF */
+ i = 0;
+ while(i < ((int)header_buf_used-1) && (endofheaders == 0)) {
+ if(header_buf[i] == '\r') {
+ i++;
+ if(header_buf[i] == '\n') {
+ i++;
+ if(i < (int)header_buf_used && header_buf[i] == '\r') {
+ i++;
+ if(i < (int)header_buf_used && header_buf[i] == '\n') {
+ endofheaders = i+1;
+ }
+ }
+ }
+ } else if(header_buf[i] == '\n') {
+ i++;
+ if(header_buf[i] == '\n') {
+ endofheaders = i+1;
+ }
+ }
+ i++;
+ }
+ if(endofheaders == 0)
+ continue;
+ /* parse header lines */
+ for(i = 0; i < endofheaders - 1; i++) {
+ if(linestart > 0 && colon <= linestart && header_buf[i]==':')
+ {
+ colon = i;
+ while(i < (endofheaders-1)
+ && (header_buf[i+1] == ' ' || header_buf[i+1] == '\t'))
+ i++;
+ valuestart = i + 1;
+ }
+ /* detecting end of line */
+ else if(header_buf[i]=='\r' || header_buf[i]=='\n')
+ {
+ if(linestart == 0 && status_code)
+ {
+ /* Status line
+ * HTTP-Version SP Status-Code SP Reason-Phrase CRLF */
+ int sp;
+ for(sp = 0; sp < i; sp++)
+ if(header_buf[sp] == ' ')
+ {
+ if(*status_code < 0)
+ *status_code = atoi(header_buf + sp + 1);
+ else
+ {
+#ifdef DEBUG
+ reason_phrase = header_buf + sp + 1;
+ reason_phrase_len = i - sp - 1;
+#endif
+ break;
+ }
+ }
+#ifdef DEBUG
+ printf("HTTP status code = %d, Reason phrase = %.*s\n",
+ *status_code, reason_phrase_len, reason_phrase);
+#endif
+ }
+ else if(colon > linestart && valuestart > colon)
+ {
+#ifdef DEBUG
+ printf("header='%.*s', value='%.*s'\n",
+ colon-linestart, header_buf+linestart,
+ i-valuestart, header_buf+valuestart);
+#endif
+ if(0==strncasecmp(header_buf+linestart, "content-length", colon-linestart))
+ {
+ content_length = atoi(header_buf+valuestart);
+#ifdef DEBUG
+ printf("Content-Length: %d\n", content_length);
+#endif
+ }
+ else if(0==strncasecmp(header_buf+linestart, "transfer-encoding", colon-linestart)
+ && 0==strncasecmp(header_buf+valuestart, "chunked", 7))
+ {
+#ifdef DEBUG
+ printf("chunked transfer-encoding!\n");
+#endif
+ chunked = 1;
+ }
+ }
+ while((i < (int)header_buf_used) && (header_buf[i]=='\r' || header_buf[i] == '\n'))
+ i++;
+ linestart = i;
+ colon = linestart;
+ valuestart = 0;
+ }
+ }
+ /* copy the remaining of the received data back to buf */
+ n = header_buf_used - endofheaders;
+ memcpy(buf, header_buf + endofheaders, n);
+ /* if(headers) */
+ }
+ /* if we get there, endofheaders != 0.
+ * In the other case, there was a continue above */
+ /* content */
+ if(chunked)
+ {
+ int i = 0;
+ while(i < n)
+ {
+ if(chunksize == 0)
+ {
+ /* reading chunk size */
+ if(chunksize_buf_index == 0) {
+ /* skipping any leading CR LF */
+ if(i<n && buf[i] == '\r') i++;
+ if(i<n && buf[i] == '\n') i++;
+ }
+ while(i<n && isxdigit(buf[i])
+ && chunksize_buf_index < (sizeof(chunksize_buf)-1))
+ {
+ chunksize_buf[chunksize_buf_index++] = buf[i];
+ chunksize_buf[chunksize_buf_index] = '\0';
+ i++;
+ }
+ while(i<n && buf[i] != '\r' && buf[i] != '\n')
+ i++; /* discarding chunk-extension */
+ if(i<n && buf[i] == '\r') i++;
+ if(i<n && buf[i] == '\n') {
+ unsigned int j;
+ for(j = 0; j < chunksize_buf_index; j++) {
+ if(chunksize_buf[j] >= '0'
+ && chunksize_buf[j] <= '9')
+ chunksize = (chunksize << 4) + (chunksize_buf[j] - '0');
+ else
+ chunksize = (chunksize << 4) + ((chunksize_buf[j] | 32) - 'a' + 10);
+ }
+ chunksize_buf[0] = '\0';
+ chunksize_buf_index = 0;
+ i++;
+ } else {
+ /* not finished to get chunksize */
+ continue;
+ }
+#ifdef DEBUG
+ printf("chunksize = %u (%x)\n", chunksize, chunksize);
+#endif
+ if(chunksize == 0)
+ {
+#ifdef DEBUG
+ printf("end of HTTP content - %d %d\n", i, n);
+ /*printf("'%.*s'\n", n-i, buf+i);*/
+#endif
+ goto end_of_stream;
+ }
+ }
+ /* it is guaranteed that (n >= i) */
+ bytestocopy = (chunksize < (unsigned int)(n - i))?chunksize:(unsigned int)(n - i);
+ if((content_buf_used + bytestocopy) > content_buf_len)
+ {
+ char * tmp;
+ if((content_length >= 0) && ((unsigned int)content_length >= (content_buf_used + bytestocopy))) {
+ content_buf_len = content_length;
+ } else {
+ content_buf_len = content_buf_used + bytestocopy;
+ }
+ tmp = realloc(content_buf, content_buf_len);
+ if(tmp == NULL) {
+ /* memory allocation error */
+ free(content_buf);
+ free(header_buf);
+ *size = -1;
+ return NULL;
+ }
+ content_buf = tmp;
+ }
+ memcpy(content_buf + content_buf_used, buf + i, bytestocopy);
+ content_buf_used += bytestocopy;
+ i += bytestocopy;
+ chunksize -= bytestocopy;
+ }
+ }
+ else
+ {
+ /* not chunked */
+ if(content_length > 0
+ && (content_buf_used + n) > (unsigned int)content_length) {
+ /* skipping additional bytes */
+ n = content_length - content_buf_used;
+ }
+ if(content_buf_used + n > content_buf_len)
+ {
+ char * tmp;
+ if(content_length >= 0
+ && (unsigned int)content_length >= (content_buf_used + n)) {
+ content_buf_len = content_length;
+ } else {
+ content_buf_len = content_buf_used + n;
+ }
+ tmp = realloc(content_buf, content_buf_len);
+ if(tmp == NULL) {
+ /* memory allocation error */
+ free(content_buf);
+ free(header_buf);
+ *size = -1;
+ return NULL;
+ }
+ content_buf = tmp;
+ }
+ memcpy(content_buf + content_buf_used, buf, n);
+ content_buf_used += n;
+ }
+ /* use the Content-Length header value if available */
+ if(content_length > 0 && content_buf_used >= (unsigned int)content_length)
+ {
+#ifdef DEBUG
+ printf("End of HTTP content\n");
+#endif
+ break;
+ }
+ }
+end_of_stream:
+ free(header_buf); header_buf = NULL;
+ *size = content_buf_used;
+ if(content_buf_used == 0)
+ {
+ free(content_buf);
+ content_buf = NULL;
+ }
+ return content_buf;
+}
+
+/* miniwget3() :
+ * do all the work.
+ * Return NULL if something failed. */
+static void *
+miniwget3(const char * host,
+ unsigned short port, const char * path,
+ int * size, char * addr_str, int addr_str_len,
+ const char * httpversion, unsigned int scope_id,
+ int * status_code)
+{
+ char buf[2048];
+ SOCKET s;
+ int n;
+ int len;
+ int sent;
+ void * content;
+
+ *size = 0;
+ s = connecthostport(host, port, scope_id);
+ if(ISINVALID(s))
+ return NULL;
+
+ /* get address for caller ! */
+ if(addr_str)
+ {
+ struct sockaddr_storage saddr;
+ socklen_t saddrlen;
+
+ saddrlen = sizeof(saddr);
+ if(getsockname(s, (struct sockaddr *)&saddr, &saddrlen) < 0)
+ {
+ perror("getsockname");
+ }
+ else
+ {
+#if defined(__amigaos__) && !defined(__amigaos4__)
+ /* using INT WINAPI WSAAddressToStringA(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOA, LPSTR, LPDWORD);
+ * But his function make a string with the port : nn.nn.nn.nn:port */
+/* if(WSAAddressToStringA((SOCKADDR *)&saddr, sizeof(saddr),
+ NULL, addr_str, (DWORD *)&addr_str_len))
+ {
+ printf("WSAAddressToStringA() failed : %d\n", WSAGetLastError());
+ }*/
+ /* the following code is only compatible with ip v4 addresses */
+ strncpy(addr_str, inet_ntoa(((struct sockaddr_in *)&saddr)->sin_addr), addr_str_len);
+#else
+#if 0
+ if(saddr.sa_family == AF_INET6) {
+ inet_ntop(AF_INET6,
+ &(((struct sockaddr_in6 *)&saddr)->sin6_addr),
+ addr_str, addr_str_len);
+ } else {
+ inet_ntop(AF_INET,
+ &(((struct sockaddr_in *)&saddr)->sin_addr),
+ addr_str, addr_str_len);
+ }
+#endif
+ /* getnameinfo return ip v6 address with the scope identifier
+ * such as : 2a01:e35:8b2b:7330::%4281128194 */
+ n = getnameinfo((const struct sockaddr *)&saddr, saddrlen,
+ addr_str, addr_str_len,
+ NULL, 0,
+ NI_NUMERICHOST | NI_NUMERICSERV);
+ if(n != 0) {
+#ifdef _WIN32
+ fprintf(stderr, "getnameinfo() failed : %d\n", n);
+#else
+ fprintf(stderr, "getnameinfo() failed : %s\n", gai_strerror(n));
+#endif
+ }
+#endif
+ }
+#ifdef DEBUG
+ printf("address miniwget : %s\n", addr_str);
+#endif
+ }
+
+ len = snprintf(buf, sizeof(buf),
+ "GET %s HTTP/%s\r\n"
+ "Host: %s:%d\r\n"
+ "Connection: Close\r\n"
+ "User-Agent: " OS_STRING ", " UPNP_VERSION_STRING ", MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
+
+ "\r\n",
+ path, httpversion, host, port);
+ if ((unsigned int)len >= sizeof(buf))
+ {
+ closesocket(s);
+ return NULL;
+ }
+ sent = 0;
+ /* sending the HTTP request */
+ while(sent < len)
+ {
+ n = send(s, buf+sent, len-sent, 0);
+ if(n < 0)
+ {
+ perror("send");
+ closesocket(s);
+ return NULL;
+ }
+ else
+ {
+ sent += n;
+ }
+ }
+ content = getHTTPResponse(s, size, status_code);
+ closesocket(s);
+ return content;
+}
+
+/* miniwget2() :
+ * Call miniwget3(); retry with HTTP/1.1 if 1.0 fails. */
+static void *
+miniwget2(const char * host,
+ unsigned short port, const char * path,
+ int * size, char * addr_str, int addr_str_len,
+ unsigned int scope_id, int * status_code)
+{
+ char * respbuffer;
+
+#if 1
+ respbuffer = miniwget3(host, port, path, size,
+ addr_str, addr_str_len, "1.1",
+ scope_id, status_code);
+#else
+ respbuffer = miniwget3(host, port, path, size,
+ addr_str, addr_str_len, "1.0",
+ scope_id, status_code);
+ if (*size == 0)
+ {
+#ifdef DEBUG
+ printf("Retrying with HTTP/1.1\n");
+#endif
+ free(respbuffer);
+ respbuffer = miniwget3(host, port, path, size,
+ addr_str, addr_str_len, "1.1",
+ scope_id, status_code);
+ }
+#endif
+ return respbuffer;
+}
+
+
+
+
+/* parseURL()
+ * arguments :
+ * url : source string not modified
+ * hostname : hostname destination string (size of MAXHOSTNAMELEN+1)
+ * port : port (destination)
+ * path : pointer to the path part of the URL
+ *
+ * Return values :
+ * 0 - Failure
+ * 1 - Success */
+int
+parseURL(const char * url,
+ char * hostname, unsigned short * port,
+ char * * path, unsigned int * scope_id)
+{
+ char * p1, *p2, *p3;
+ if(!url)
+ return 0;
+ p1 = strstr(url, "://");
+ if(!p1)
+ return 0;
+ p1 += 3;
+ if( (url[0]!='h') || (url[1]!='t')
+ ||(url[2]!='t') || (url[3]!='p'))
+ return 0;
+ memset(hostname, 0, MAXHOSTNAMELEN + 1);
+ if(*p1 == '[')
+ {
+ /* IP v6 : http://[2a00:1450:8002::6a]/path/abc */
+ char * scope;
+ scope = strchr(p1, '%');
+ p2 = strchr(p1, ']');
+ if(p2 && scope && scope < p2 && scope_id) {
+ /* parse scope */
+#ifdef IF_NAMESIZE
+ char tmp[IF_NAMESIZE];
+ int l;
+ scope++;
+ /* "%25" is just '%' in URL encoding */
+ if(scope[0] == '2' && scope[1] == '5')
+ scope += 2; /* skip "25" */
+ l = p2 - scope;
+ if(l >= IF_NAMESIZE)
+ l = IF_NAMESIZE - 1;
+ memcpy(tmp, scope, l);
+ tmp[l] = '\0';
+ *scope_id = if_nametoindex(tmp);
+ if(*scope_id == 0) {
+ *scope_id = (unsigned int)strtoul(tmp, NULL, 10);
+ }
+#else
+ /* under windows, scope is numerical */
+ char tmp[8];
+ int l;
+ scope++;
+ /* "%25" is just '%' in URL encoding */
+ if(scope[0] == '2' && scope[1] == '5')
+ scope += 2; /* skip "25" */
+ l = p2 - scope;
+ if(l >= sizeof(tmp))
+ l = sizeof(tmp) - 1;
+ memcpy(tmp, scope, l);
+ tmp[l] = '\0';
+ *scope_id = (unsigned int)strtoul(tmp, NULL, 10);
+#endif
+ }
+ p3 = strchr(p1, '/');
+ if(p2 && p3)
+ {
+ p2++;
+ strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p2-p1)));
+ if(*p2 == ':')
+ {
+ *port = 0;
+ p2++;
+ while( (*p2 >= '0') && (*p2 <= '9'))
+ {
+ *port *= 10;
+ *port += (unsigned short)(*p2 - '0');
+ p2++;
+ }
+ }
+ else
+ {
+ *port = 80;
+ }
+ *path = p3;
+ return 1;
+ }
+ }
+ p2 = strchr(p1, ':');
+ p3 = strchr(p1, '/');
+ if(!p3)
+ return 0;
+ if(!p2 || (p2>p3))
+ {
+ strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p3-p1)));
+ *port = 80;
+ }
+ else
+ {
+ strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p2-p1)));
+ *port = 0;
+ p2++;
+ while( (*p2 >= '0') && (*p2 <= '9'))
+ {
+ *port *= 10;
+ *port += (unsigned short)(*p2 - '0');
+ p2++;
+ }
+ }
+ *path = p3;
+ return 1;
+}
+
+void *
+miniwget(const char * url, int * size,
+ unsigned int scope_id, int * status_code)
+{
+ unsigned short port;
+ char * path;
+ /* protocol://host:port/chemin */
+ char hostname[MAXHOSTNAMELEN+1];
+ *size = 0;
+ if(!parseURL(url, hostname, &port, &path, &scope_id))
+ return NULL;
+#ifdef DEBUG
+ printf("parsed url : hostname='%s' port=%hu path='%s' scope_id=%u\n",
+ hostname, port, path, scope_id);
+#endif
+ return miniwget2(hostname, port, path, size, 0, 0, scope_id, status_code);
+}
+
+void *
+miniwget_getaddr(const char * url, int * size,
+ char * addr, int addrlen, unsigned int scope_id,
+ int * status_code)
+{
+ unsigned short port;
+ char * path;
+ /* protocol://host:port/path */
+ char hostname[MAXHOSTNAMELEN+1];
+ *size = 0;
+ if(addr)
+ addr[0] = '\0';
+ if(!parseURL(url, hostname, &port, &path, &scope_id))
+ return NULL;
+#ifdef DEBUG
+ printf("parsed url : hostname='%s' port=%hu path='%s' scope_id=%u\n",
+ hostname, port, path, scope_id);
+#endif
+ return miniwget2(hostname, port, path, size, addr, addrlen, scope_id, status_code);
+}
+
diff --git a/thirdparty/miniupnpc/miniwget.h b/thirdparty/miniupnpc/miniwget.h
new file mode 100644
index 0000000000..f5572c2544
--- /dev/null
+++ b/thirdparty/miniupnpc/miniwget.h
@@ -0,0 +1,27 @@
+/* $Id: miniwget.h,v 1.12 2016/01/24 17:24:36 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2016 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef MINIWGET_H_INCLUDED
+#define MINIWGET_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MINIUPNP_LIBSPEC void * miniwget(const char *, int *, unsigned int, int *);
+
+MINIUPNP_LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, unsigned int, int *);
+
+int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/miniupnpc/miniwget_private.h b/thirdparty/miniupnpc/miniwget_private.h
new file mode 100644
index 0000000000..e4eaac8085
--- /dev/null
+++ b/thirdparty/miniupnpc/miniwget_private.h
@@ -0,0 +1,15 @@
+/* $Id: miniwget_private.h,v 1.1 2018/04/06 10:17:58 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef MINIWGET_INTERNAL_H_INCLUDED
+#define MINIWGET_INTERNAL_H_INCLUDED
+
+#include "miniupnpc_socketdef.h"
+
+void * getHTTPResponse(SOCKET s, int * size, int * status_code);
+
+#endif
diff --git a/thirdparty/miniupnpc/minixml.c b/thirdparty/miniupnpc/minixml.c
new file mode 100644
index 0000000000..ed2d3c759c
--- /dev/null
+++ b/thirdparty/miniupnpc/minixml.c
@@ -0,0 +1,231 @@
+/* $Id: minixml.c,v 1.10 2012/03/05 19:42:47 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * minixml.c : the minimum size a xml parser can be ! */
+/* Project : miniupnp
+ * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * Author : Thomas Bernard
+
+Copyright (c) 2005-2017, Thomas BERNARD
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+#include <string.h>
+#include "minixml.h"
+
+/* parseatt : used to parse the argument list
+ * return 0 (false) in case of success and -1 (true) if the end
+ * of the xmlbuffer is reached. */
+static int parseatt(struct xmlparser * p)
+{
+ const char * attname;
+ int attnamelen;
+ const char * attvalue;
+ int attvaluelen;
+ while(p->xml < p->xmlend)
+ {
+ if(*p->xml=='/' || *p->xml=='>')
+ return 0;
+ if( !IS_WHITE_SPACE(*p->xml) )
+ {
+ char sep;
+ attname = p->xml;
+ attnamelen = 0;
+ while(*p->xml!='=' && !IS_WHITE_SPACE(*p->xml) )
+ {
+ attnamelen++; p->xml++;
+ if(p->xml >= p->xmlend)
+ return -1;
+ }
+ while(*(p->xml++) != '=')
+ {
+ if(p->xml >= p->xmlend)
+ return -1;
+ }
+ while(IS_WHITE_SPACE(*p->xml))
+ {
+ p->xml++;
+ if(p->xml >= p->xmlend)
+ return -1;
+ }
+ sep = *p->xml;
+ if(sep=='\'' || sep=='\"')
+ {
+ p->xml++;
+ if(p->xml >= p->xmlend)
+ return -1;
+ attvalue = p->xml;
+ attvaluelen = 0;
+ while(*p->xml != sep)
+ {
+ attvaluelen++; p->xml++;
+ if(p->xml >= p->xmlend)
+ return -1;
+ }
+ }
+ else
+ {
+ attvalue = p->xml;
+ attvaluelen = 0;
+ while( !IS_WHITE_SPACE(*p->xml)
+ && *p->xml != '>' && *p->xml != '/')
+ {
+ attvaluelen++; p->xml++;
+ if(p->xml >= p->xmlend)
+ return -1;
+ }
+ }
+ /*printf("%.*s='%.*s'\n",
+ attnamelen, attname, attvaluelen, attvalue);*/
+ if(p->attfunc)
+ p->attfunc(p->data, attname, attnamelen, attvalue, attvaluelen);
+ }
+ p->xml++;
+ }
+ return -1;
+}
+
+/* parseelt parse the xml stream and
+ * call the callback functions when needed... */
+static void parseelt(struct xmlparser * p)
+{
+ int i;
+ const char * elementname;
+ while(p->xml < (p->xmlend - 1))
+ {
+ if((p->xml + 4) <= p->xmlend && (0 == memcmp(p->xml, "<!--", 4)))
+ {
+ p->xml += 3;
+ /* ignore comments */
+ do
+ {
+ p->xml++;
+ if ((p->xml + 3) >= p->xmlend)
+ return;
+ }
+ while(memcmp(p->xml, "-->", 3) != 0);
+ p->xml += 3;
+ }
+ else if((p->xml)[0]=='<' && (p->xml)[1]!='?')
+ {
+ i = 0; elementname = ++p->xml;
+ while( !IS_WHITE_SPACE(*p->xml)
+ && (*p->xml!='>') && (*p->xml!='/')
+ )
+ {
+ i++; p->xml++;
+ if (p->xml >= p->xmlend)
+ return;
+ /* to ignore namespace : */
+ if(*p->xml==':')
+ {
+ i = 0;
+ elementname = ++p->xml;
+ }
+ }
+ if(i>0)
+ {
+ if(p->starteltfunc)
+ p->starteltfunc(p->data, elementname, i);
+ if(parseatt(p))
+ return;
+ if(*p->xml!='/')
+ {
+ const char * data;
+ i = 0; data = ++p->xml;
+ if (p->xml >= p->xmlend)
+ return;
+ while( IS_WHITE_SPACE(*p->xml) )
+ {
+ i++; p->xml++;
+ if (p->xml >= p->xmlend)
+ return;
+ }
+ /* CDATA are at least 9 + 3 characters long : <![CDATA[ ]]> */
+ if((p->xmlend >= (p->xml + (9 + 3))) && (memcmp(p->xml, "<![CDATA[", 9) == 0))
+ {
+ /* CDATA handling */
+ p->xml += 9;
+ data = p->xml;
+ i = 0;
+ while(memcmp(p->xml, "]]>", 3) != 0)
+ {
+ i++; p->xml++;
+ if ((p->xml + 3) >= p->xmlend)
+ return;
+ }
+ if(i>0 && p->datafunc)
+ p->datafunc(p->data, data, i);
+ while(*p->xml!='<')
+ {
+ p->xml++;
+ if (p->xml >= p->xmlend)
+ return;
+ }
+ }
+ else
+ {
+ while(*p->xml!='<')
+ {
+ i++; p->xml++;
+ if ((p->xml + 1) >= p->xmlend)
+ return;
+ }
+ if(i>0 && p->datafunc && *(p->xml + 1) == '/')
+ p->datafunc(p->data, data, i);
+ }
+ }
+ }
+ else if(*p->xml == '/')
+ {
+ i = 0; elementname = ++p->xml;
+ if (p->xml >= p->xmlend)
+ return;
+ while((*p->xml != '>'))
+ {
+ i++; p->xml++;
+ if (p->xml >= p->xmlend)
+ return;
+ }
+ if(p->endeltfunc)
+ p->endeltfunc(p->data, elementname, i);
+ p->xml++;
+ }
+ }
+ else
+ {
+ p->xml++;
+ }
+ }
+}
+
+/* the parser must be initialized before calling this function */
+void parsexml(struct xmlparser * parser)
+{
+ parser->xml = parser->xmlstart;
+ parser->xmlend = parser->xmlstart + parser->xmlsize;
+ parseelt(parser);
+}
+
+
diff --git a/thirdparty/miniupnpc/minixml.h b/thirdparty/miniupnpc/minixml.h
new file mode 100644
index 0000000000..19e6f513bf
--- /dev/null
+++ b/thirdparty/miniupnpc/minixml.h
@@ -0,0 +1,37 @@
+/* $Id: minixml.h,v 1.6 2006/11/30 11:47:21 nanard Exp $ */
+/* minimal xml parser
+ *
+ * Project : miniupnp
+ * Website : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#ifndef MINIXML_H_INCLUDED
+#define MINIXML_H_INCLUDED
+#define IS_WHITE_SPACE(c) ((c==' ') || (c=='\t') || (c=='\r') || (c=='\n'))
+
+/* if a callback function pointer is set to NULL,
+ * the function is not called */
+struct xmlparser {
+ const char *xmlstart;
+ const char *xmlend;
+ const char *xml; /* pointer to current character */
+ int xmlsize;
+ void * data;
+ void (*starteltfunc) (void *, const char *, int);
+ void (*endeltfunc) (void *, const char *, int);
+ void (*datafunc) (void *, const char *, int);
+ void (*attfunc) (void *, const char *, int, const char *, int);
+};
+
+/* parsexml()
+ * the xmlparser structure must be initialized before the call
+ * the following structure members have to be initialized :
+ * xmlstart, xmlsize, data, *func
+ * xml is for internal usage, xmlend is computed automatically */
+void parsexml(struct xmlparser *);
+
+#endif
+
diff --git a/thirdparty/miniupnpc/minixmlvalid.c b/thirdparty/miniupnpc/minixmlvalid.c
new file mode 100644
index 0000000000..dad1488122
--- /dev/null
+++ b/thirdparty/miniupnpc/minixmlvalid.c
@@ -0,0 +1,163 @@
+/* $Id: minixmlvalid.c,v 1.7 2015/07/15 12:41:15 nanard Exp $ */
+/* MiniUPnP Project
+ * http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
+ * minixmlvalid.c :
+ * validation program for the minixml parser
+ *
+ * (c) 2006-2011 Thomas Bernard */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "minixml.h"
+
+/* xml event structure */
+struct event {
+ enum { ELTSTART, ELTEND, ATT, CHARDATA } type;
+ const char * data;
+ int len;
+};
+
+struct eventlist {
+ int n;
+ struct event * events;
+};
+
+/* compare 2 xml event lists
+ * return 0 if the two lists are equals */
+int evtlistcmp(struct eventlist * a, struct eventlist * b)
+{
+ int i;
+ struct event * ae, * be;
+ if(a->n != b->n)
+ {
+ printf("event number not matching : %d != %d\n", a->n, b->n);
+ /*return 1;*/
+ }
+ for(i=0; i<a->n; i++)
+ {
+ ae = a->events + i;
+ be = b->events + i;
+ if( (ae->type != be->type)
+ ||(ae->len != be->len)
+ ||memcmp(ae->data, be->data, ae->len))
+ {
+ printf("Found a difference : %d '%.*s' != %d '%.*s'\n",
+ ae->type, ae->len, ae->data,
+ be->type, be->len, be->data);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Test data */
+static const char xmldata[] =
+"<xmlroot>\n"
+" <elt1 att1=\"attvalue1\" att2=\"attvalue2\">"
+"character data"
+"</elt1> \n \t"
+"<elt1b/>"
+"<elt1>\n<![CDATA[ <html>stuff !\n ]]> \n</elt1>\n"
+"<elt2a> \t<elt2b>chardata1</elt2b><elt2b> chardata2 </elt2b></elt2a>"
+"</xmlroot>";
+
+static const struct event evtref[] =
+{
+ {ELTSTART, "xmlroot", 7},
+ {ELTSTART, "elt1", 4},
+ /* attributes */
+ {CHARDATA, "character data", 14},
+ {ELTEND, "elt1", 4},
+ {ELTSTART, "elt1b", 5},
+ {ELTSTART, "elt1", 4},
+ {CHARDATA, " <html>stuff !\n ", 16},
+ {ELTEND, "elt1", 4},
+ {ELTSTART, "elt2a", 5},
+ {ELTSTART, "elt2b", 5},
+ {CHARDATA, "chardata1", 9},
+ {ELTEND, "elt2b", 5},
+ {ELTSTART, "elt2b", 5},
+ {CHARDATA, " chardata2 ", 11},
+ {ELTEND, "elt2b", 5},
+ {ELTEND, "elt2a", 5},
+ {ELTEND, "xmlroot", 7}
+};
+
+void startelt(void * data, const char * p, int l)
+{
+ struct eventlist * evtlist = data;
+ struct event * evt;
+ evt = evtlist->events + evtlist->n;
+ /*printf("startelt : %.*s\n", l, p);*/
+ evt->type = ELTSTART;
+ evt->data = p;
+ evt->len = l;
+ evtlist->n++;
+}
+
+void endelt(void * data, const char * p, int l)
+{
+ struct eventlist * evtlist = data;
+ struct event * evt;
+ evt = evtlist->events + evtlist->n;
+ /*printf("endelt : %.*s\n", l, p);*/
+ evt->type = ELTEND;
+ evt->data = p;
+ evt->len = l;
+ evtlist->n++;
+}
+
+void chardata(void * data, const char * p, int l)
+{
+ struct eventlist * evtlist = data;
+ struct event * evt;
+ evt = evtlist->events + evtlist->n;
+ /*printf("chardata : '%.*s'\n", l, p);*/
+ evt->type = CHARDATA;
+ evt->data = p;
+ evt->len = l;
+ evtlist->n++;
+}
+
+int testxmlparser(const char * xml, int size)
+{
+ int r;
+ struct eventlist evtlist;
+ struct eventlist evtlistref;
+ struct xmlparser parser;
+ evtlist.n = 0;
+ evtlist.events = malloc(sizeof(struct event)*100);
+ if(evtlist.events == NULL)
+ {
+ fprintf(stderr, "Memory allocation error.\n");
+ return -1;
+ }
+ memset(&parser, 0, sizeof(parser));
+ parser.xmlstart = xml;
+ parser.xmlsize = size;
+ parser.data = &evtlist;
+ parser.starteltfunc = startelt;
+ parser.endeltfunc = endelt;
+ parser.datafunc = chardata;
+ parsexml(&parser);
+ printf("%d events\n", evtlist.n);
+ /* compare */
+ evtlistref.n = sizeof(evtref)/sizeof(struct event);
+ evtlistref.events = (struct event *)evtref;
+ r = evtlistcmp(&evtlistref, &evtlist);
+ free(evtlist.events);
+ return r;
+}
+
+int main(int argc, char * * argv)
+{
+ int r;
+ (void)argc; (void)argv;
+
+ r = testxmlparser(xmldata, sizeof(xmldata)-1);
+ if(r)
+ printf("minixml validation test failed\n");
+ return r;
+}
+
diff --git a/thirdparty/miniupnpc/portlistingparse.c b/thirdparty/miniupnpc/portlistingparse.c
new file mode 100644
index 0000000000..55859f2714
--- /dev/null
+++ b/thirdparty/miniupnpc/portlistingparse.c
@@ -0,0 +1,172 @@
+/* $Id: portlistingparse.c,v 1.9 2015/07/15 12:41:13 nanard Exp $ */
+/* MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2011-2016 Thomas Bernard
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+#include <string.h>
+#include <stdlib.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif /* DEBUG */
+#include "portlistingparse.h"
+#include "minixml.h"
+
+/* list of the elements */
+static const struct {
+ const portMappingElt code;
+ const char * const str;
+} elements[] = {
+ { PortMappingEntry, "PortMappingEntry"},
+ { NewRemoteHost, "NewRemoteHost"},
+ { NewExternalPort, "NewExternalPort"},
+ { NewProtocol, "NewProtocol"},
+ { NewInternalPort, "NewInternalPort"},
+ { NewInternalClient, "NewInternalClient"},
+ { NewEnabled, "NewEnabled"},
+ { NewDescription, "NewDescription"},
+ { NewLeaseTime, "NewLeaseTime"},
+ { PortMappingEltNone, NULL}
+};
+
+/* Helper function */
+static UNSIGNED_INTEGER
+atoui(const char * p, int l)
+{
+ UNSIGNED_INTEGER r = 0;
+ while(l > 0 && *p)
+ {
+ if(*p >= '0' && *p <= '9')
+ r = r*10 + (*p - '0');
+ else
+ break;
+ p++;
+ l--;
+ }
+ return r;
+}
+
+/* Start element handler */
+static void
+startelt(void * d, const char * name, int l)
+{
+ int i;
+ struct PortMappingParserData * pdata = (struct PortMappingParserData *)d;
+ pdata->curelt = PortMappingEltNone;
+ for(i = 0; elements[i].str; i++)
+ {
+ if(strlen(elements[i].str) == (size_t)l && memcmp(name, elements[i].str, l) == 0)
+ {
+ pdata->curelt = elements[i].code;
+ break;
+ }
+ }
+ if(pdata->curelt == PortMappingEntry)
+ {
+ struct PortMapping * pm;
+ pm = calloc(1, sizeof(struct PortMapping));
+ if(pm == NULL)
+ {
+ /* malloc error */
+#ifdef DEBUG
+ fprintf(stderr, "%s: error allocating memory",
+ "startelt");
+#endif /* DEBUG */
+ return;
+ }
+ pm->l_next = pdata->l_head; /* insert in list */
+ pdata->l_head = pm;
+ }
+}
+
+/* End element handler */
+static void
+endelt(void * d, const char * name, int l)
+{
+ struct PortMappingParserData * pdata = (struct PortMappingParserData *)d;
+ (void)name;
+ (void)l;
+ pdata->curelt = PortMappingEltNone;
+}
+
+/* Data handler */
+static void
+data(void * d, const char * data, int l)
+{
+ struct PortMapping * pm;
+ struct PortMappingParserData * pdata = (struct PortMappingParserData *)d;
+ pm = pdata->l_head;
+ if(!pm)
+ return;
+ if(l > 63)
+ l = 63;
+ switch(pdata->curelt)
+ {
+ case NewRemoteHost:
+ memcpy(pm->remoteHost, data, l);
+ pm->remoteHost[l] = '\0';
+ break;
+ case NewExternalPort:
+ pm->externalPort = (unsigned short)atoui(data, l);
+ break;
+ case NewProtocol:
+ if(l > 3)
+ l = 3;
+ memcpy(pm->protocol, data, l);
+ pm->protocol[l] = '\0';
+ break;
+ case NewInternalPort:
+ pm->internalPort = (unsigned short)atoui(data, l);
+ break;
+ case NewInternalClient:
+ memcpy(pm->internalClient, data, l);
+ pm->internalClient[l] = '\0';
+ break;
+ case NewEnabled:
+ pm->enabled = (unsigned char)atoui(data, l);
+ break;
+ case NewDescription:
+ memcpy(pm->description, data, l);
+ pm->description[l] = '\0';
+ break;
+ case NewLeaseTime:
+ pm->leaseTime = atoui(data, l);
+ break;
+ default:
+ break;
+ }
+}
+
+
+/* Parse the PortMappingList XML document for IGD version 2
+ */
+void
+ParsePortListing(const char * buffer, int bufsize,
+ struct PortMappingParserData * pdata)
+{
+ struct xmlparser parser;
+
+ memset(pdata, 0, sizeof(struct PortMappingParserData));
+ /* init xmlparser */
+ parser.xmlstart = buffer;
+ parser.xmlsize = bufsize;
+ parser.data = pdata;
+ parser.starteltfunc = startelt;
+ parser.endeltfunc = endelt;
+ parser.datafunc = data;
+ parser.attfunc = 0;
+ parsexml(&parser);
+}
+
+void
+FreePortListing(struct PortMappingParserData * pdata)
+{
+ struct PortMapping * pm;
+ while((pm = pdata->l_head) != NULL)
+ {
+ /* remove from list */
+ pdata->l_head = pm->l_next;
+ free(pm);
+ }
+}
+
diff --git a/thirdparty/miniupnpc/portlistingparse.h b/thirdparty/miniupnpc/portlistingparse.h
new file mode 100644
index 0000000000..e3957a3f4c
--- /dev/null
+++ b/thirdparty/miniupnpc/portlistingparse.h
@@ -0,0 +1,65 @@
+/* $Id: portlistingparse.h,v 1.10 2014/11/01 10:37:32 nanard Exp $ */
+/* MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2011-2015 Thomas Bernard
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+#ifndef PORTLISTINGPARSE_H_INCLUDED
+#define PORTLISTINGPARSE_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+/* for the definition of UNSIGNED_INTEGER */
+#include "miniupnpctypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* sample of PortMappingEntry :
+ <p:PortMappingEntry>
+ <p:NewRemoteHost>202.233.2.1</p:NewRemoteHost>
+ <p:NewExternalPort>2345</p:NewExternalPort>
+ <p:NewProtocol>TCP</p:NewProtocol>
+ <p:NewInternalPort>2345</p:NewInternalPort>
+ <p:NewInternalClient>192.168.1.137</p:NewInternalClient>
+ <p:NewEnabled>1</p:NewEnabled>
+ <p:NewDescription>dooom</p:NewDescription>
+ <p:NewLeaseTime>345</p:NewLeaseTime>
+ </p:PortMappingEntry>
+ */
+typedef enum { PortMappingEltNone,
+ PortMappingEntry, NewRemoteHost,
+ NewExternalPort, NewProtocol,
+ NewInternalPort, NewInternalClient,
+ NewEnabled, NewDescription,
+ NewLeaseTime } portMappingElt;
+
+struct PortMapping {
+ struct PortMapping * l_next; /* list next element */
+ UNSIGNED_INTEGER leaseTime;
+ unsigned short externalPort;
+ unsigned short internalPort;
+ char remoteHost[64];
+ char internalClient[64];
+ char description[64];
+ char protocol[4];
+ unsigned char enabled;
+};
+
+struct PortMappingParserData {
+ struct PortMapping * l_head; /* list head */
+ portMappingElt curelt;
+};
+
+MINIUPNP_LIBSPEC void
+ParsePortListing(const char * buffer, int bufsize,
+ struct PortMappingParserData * pdata);
+
+MINIUPNP_LIBSPEC void
+FreePortListing(struct PortMappingParserData * pdata);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/miniupnpc/receivedata.c b/thirdparty/miniupnpc/receivedata.c
new file mode 100644
index 0000000000..7b9cc5b778
--- /dev/null
+++ b/thirdparty/miniupnpc/receivedata.c
@@ -0,0 +1,99 @@
+/* $Id: receivedata.c,v 1.7 2015/11/09 21:51:41 nanard Exp $ */
+/* Project : miniupnp
+ * Website : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2011-2014 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+
+#include <stdio.h>
+#include <string.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else /* _WIN32 */
+#include <unistd.h>
+#if defined(__amigaos__) && !defined(__amigaos4__)
+#define socklen_t int
+#else /* #if defined(__amigaos__) && !defined(__amigaos4__) */
+#include <sys/select.h>
+#endif /* #else defined(__amigaos__) && !defined(__amigaos4__) */
+#include <sys/socket.h>
+#include <netinet/in.h>
+#if !defined(__amigaos__) && !defined(__amigaos4__)
+#include <poll.h>
+#endif /* !defined(__amigaos__) && !defined(__amigaos4__) */
+#include <errno.h>
+#define MINIUPNPC_IGNORE_EINTR
+#endif /* _WIN32 */
+
+#include "receivedata.h"
+
+int
+receivedata(SOCKET socket,
+ char * data, int length,
+ int timeout, unsigned int * scope_id)
+{
+#ifdef MINIUPNPC_GET_SRC_ADDR
+ struct sockaddr_storage src_addr;
+ socklen_t src_addr_len = sizeof(src_addr);
+#endif /* MINIUPNPC_GET_SRC_ADDR */
+ int n;
+#if !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__)
+ /* using poll */
+ struct pollfd fds[1]; /* for the poll */
+#ifdef MINIUPNPC_IGNORE_EINTR
+ do {
+#endif /* MINIUPNPC_IGNORE_EINTR */
+ fds[0].fd = socket;
+ fds[0].events = POLLIN;
+ n = poll(fds, 1, timeout);
+#ifdef MINIUPNPC_IGNORE_EINTR
+ } while(n < 0 && errno == EINTR);
+#endif /* MINIUPNPC_IGNORE_EINTR */
+ if(n < 0) {
+ PRINT_SOCKET_ERROR("poll");
+ return -1;
+ } else if(n == 0) {
+ /* timeout */
+ return 0;
+ }
+#else /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
+ /* using select under _WIN32 and amigaos */
+ fd_set socketSet;
+ TIMEVAL timeval;
+ FD_ZERO(&socketSet);
+ FD_SET(socket, &socketSet);
+ timeval.tv_sec = timeout / 1000;
+ timeval.tv_usec = (timeout % 1000) * 1000;
+ n = select(FD_SETSIZE, &socketSet, NULL, NULL, &timeval);
+ if(n < 0) {
+ PRINT_SOCKET_ERROR("select");
+ return -1;
+ } else if(n == 0) {
+ return 0;
+ }
+#endif /* !defined(_WIN32) && !defined(__amigaos__) && !defined(__amigaos4__) */
+#ifdef MINIUPNPC_GET_SRC_ADDR
+ memset(&src_addr, 0, sizeof(src_addr));
+ n = recvfrom(socket, data, length, 0,
+ (struct sockaddr *)&src_addr, &src_addr_len);
+#else /* MINIUPNPC_GET_SRC_ADDR */
+ n = recv(socket, data, length, 0);
+#endif /* MINIUPNPC_GET_SRC_ADDR */
+ if(n<0) {
+ PRINT_SOCKET_ERROR("recv");
+ }
+#ifdef MINIUPNPC_GET_SRC_ADDR
+ if (src_addr.ss_family == AF_INET6) {
+ const struct sockaddr_in6 * src_addr6 = (struct sockaddr_in6 *)&src_addr;
+#ifdef DEBUG
+ printf("scope_id=%u\n", src_addr6->sin6_scope_id);
+#endif /* DEBUG */
+ if(scope_id)
+ *scope_id = src_addr6->sin6_scope_id;
+ }
+#endif /* MINIUPNPC_GET_SRC_ADDR */
+ return n;
+}
+
diff --git a/thirdparty/miniupnpc/receivedata.h b/thirdparty/miniupnpc/receivedata.h
new file mode 100644
index 0000000000..c9fdc561f8
--- /dev/null
+++ b/thirdparty/miniupnpc/receivedata.h
@@ -0,0 +1,21 @@
+/* $Id: receivedata.h,v 1.3 2012/06/23 22:34:47 nanard Exp $ */
+/* Project: miniupnp
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * Author: Thomas Bernard
+ * Copyright (c) 2011-2018 Thomas Bernard
+ * This software is subjects to the conditions detailed
+ * in the LICENCE file provided within this distribution */
+#ifndef RECEIVEDATA_H_INCLUDED
+#define RECEIVEDATA_H_INCLUDED
+
+#include "miniupnpc_socketdef.h"
+
+/* Reads data from the specified socket.
+ * Returns the number of bytes read if successful, zero if no bytes were
+ * read or if we timed out. Returns negative if there was an error. */
+int receivedata(SOCKET socket,
+ char * data, int length,
+ int timeout, unsigned int * scope_id);
+
+#endif
+
diff --git a/thirdparty/miniupnpc/upnpc.c b/thirdparty/miniupnpc/upnpc.c
new file mode 100644
index 0000000000..0c65cbe8c0
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpc.c
@@ -0,0 +1,861 @@
+/* $Id: upnpc.c,v 1.119 2018/03/13 23:34:46 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#define snprintf _snprintf
+#else
+/* for IPPROTO_TCP / IPPROTO_UDP */
+#include <netinet/in.h>
+#endif
+#include <ctype.h>
+#include "miniwget.h"
+#include "miniupnpc.h"
+#include "upnpcommands.h"
+#include "portlistingparse.h"
+#include "upnperrors.h"
+#include "miniupnpcstrings.h"
+
+/* protofix() checks if protocol is "UDP" or "TCP"
+ * returns NULL if not */
+const char * protofix(const char * proto)
+{
+ static const char proto_tcp[4] = { 'T', 'C', 'P', 0};
+ static const char proto_udp[4] = { 'U', 'D', 'P', 0};
+ int i, b;
+ for(i=0, b=1; i<4; i++)
+ b = b && ( (proto[i] == proto_tcp[i])
+ || (proto[i] == (proto_tcp[i] | 32)) );
+ if(b)
+ return proto_tcp;
+ for(i=0, b=1; i<4; i++)
+ b = b && ( (proto[i] == proto_udp[i])
+ || (proto[i] == (proto_udp[i] | 32)) );
+ if(b)
+ return proto_udp;
+ return 0;
+}
+
+/* is_int() checks if parameter is an integer or not
+ * 1 for integer
+ * 0 for not an integer */
+int is_int(char const* s)
+{
+ if(s == NULL)
+ return 0;
+ while(*s) {
+ /* #define isdigit(c) ((c) >= '0' && (c) <= '9') */
+ if(!isdigit(*s))
+ return 0;
+ s++;
+ }
+ return 1;
+}
+
+static void DisplayInfos(struct UPNPUrls * urls,
+ struct IGDdatas * data)
+{
+ char externalIPAddress[40];
+ char connectionType[64];
+ char status[64];
+ char lastconnerr[64];
+ unsigned int uptime = 0;
+ unsigned int brUp, brDown;
+ time_t timenow, timestarted;
+ int r;
+ if(UPNP_GetConnectionTypeInfo(urls->controlURL,
+ data->first.servicetype,
+ connectionType) != UPNPCOMMAND_SUCCESS)
+ printf("GetConnectionTypeInfo failed.\n");
+ else
+ printf("Connection Type : %s\n", connectionType);
+ if(UPNP_GetStatusInfo(urls->controlURL, data->first.servicetype,
+ status, &uptime, lastconnerr) != UPNPCOMMAND_SUCCESS)
+ printf("GetStatusInfo failed.\n");
+ else
+ printf("Status : %s, uptime=%us, LastConnectionError : %s\n",
+ status, uptime, lastconnerr);
+ if(uptime > 0) {
+ timenow = time(NULL);
+ timestarted = timenow - uptime;
+ printf(" Time started : %s", ctime(&timestarted));
+ }
+ if(UPNP_GetLinkLayerMaxBitRates(urls->controlURL_CIF, data->CIF.servicetype,
+ &brDown, &brUp) != UPNPCOMMAND_SUCCESS) {
+ printf("GetLinkLayerMaxBitRates failed.\n");
+ } else {
+ printf("MaxBitRateDown : %u bps", brDown);
+ if(brDown >= 1000000) {
+ printf(" (%u.%u Mbps)", brDown / 1000000, (brDown / 100000) % 10);
+ } else if(brDown >= 1000) {
+ printf(" (%u Kbps)", brDown / 1000);
+ }
+ printf(" MaxBitRateUp %u bps", brUp);
+ if(brUp >= 1000000) {
+ printf(" (%u.%u Mbps)", brUp / 1000000, (brUp / 100000) % 10);
+ } else if(brUp >= 1000) {
+ printf(" (%u Kbps)", brUp / 1000);
+ }
+ printf("\n");
+ }
+ r = UPNP_GetExternalIPAddress(urls->controlURL,
+ data->first.servicetype,
+ externalIPAddress);
+ if(r != UPNPCOMMAND_SUCCESS) {
+ printf("GetExternalIPAddress failed. (errorcode=%d)\n", r);
+ } else {
+ printf("ExternalIPAddress = %s\n", externalIPAddress);
+ }
+}
+
+static void GetConnectionStatus(struct UPNPUrls * urls,
+ struct IGDdatas * data)
+{
+ unsigned int bytessent, bytesreceived, packetsreceived, packetssent;
+ DisplayInfos(urls, data);
+ bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, data->CIF.servicetype);
+ bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, data->CIF.servicetype);
+ packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, data->CIF.servicetype);
+ packetsreceived = UPNP_GetTotalPacketsReceived(urls->controlURL_CIF, data->CIF.servicetype);
+ printf("Bytes: Sent: %8u\tRecv: %8u\n", bytessent, bytesreceived);
+ printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived);
+}
+
+static void ListRedirections(struct UPNPUrls * urls,
+ struct IGDdatas * data)
+{
+ int r;
+ int i = 0;
+ char index[6];
+ char intClient[40];
+ char intPort[6];
+ char extPort[6];
+ char protocol[4];
+ char desc[80];
+ char enabled[6];
+ char rHost[64];
+ char duration[16];
+ /*unsigned int num=0;
+ UPNP_GetPortMappingNumberOfEntries(urls->controlURL, data->servicetype, &num);
+ printf("PortMappingNumberOfEntries : %u\n", num);*/
+ printf(" i protocol exPort->inAddr:inPort description remoteHost leaseTime\n");
+ do {
+ snprintf(index, 6, "%d", i);
+ rHost[0] = '\0'; enabled[0] = '\0';
+ duration[0] = '\0'; desc[0] = '\0';
+ extPort[0] = '\0'; intPort[0] = '\0'; intClient[0] = '\0';
+ r = UPNP_GetGenericPortMappingEntry(urls->controlURL,
+ data->first.servicetype,
+ index,
+ extPort, intClient, intPort,
+ protocol, desc, enabled,
+ rHost, duration);
+ if(r==0)
+ /*
+ printf("%02d - %s %s->%s:%s\tenabled=%s leaseDuration=%s\n"
+ " desc='%s' rHost='%s'\n",
+ i, protocol, extPort, intClient, intPort,
+ enabled, duration,
+ desc, rHost);
+ */
+ printf("%2d %s %5s->%s:%-5s '%s' '%s' %s\n",
+ i, protocol, extPort, intClient, intPort,
+ desc, rHost, duration);
+ else
+ printf("GetGenericPortMappingEntry() returned %d (%s)\n",
+ r, strupnperror(r));
+ i++;
+ } while(r==0);
+}
+
+static void NewListRedirections(struct UPNPUrls * urls,
+ struct IGDdatas * data)
+{
+ int r;
+ int i = 0;
+ struct PortMappingParserData pdata;
+ struct PortMapping * pm;
+
+ memset(&pdata, 0, sizeof(struct PortMappingParserData));
+ r = UPNP_GetListOfPortMappings(urls->controlURL,
+ data->first.servicetype,
+ "0",
+ "65535",
+ "TCP",
+ "1000",
+ &pdata);
+ if(r == UPNPCOMMAND_SUCCESS)
+ {
+ printf(" i protocol exPort->inAddr:inPort description remoteHost leaseTime\n");
+ for(pm = pdata.l_head; pm != NULL; pm = pm->l_next)
+ {
+ printf("%2d %s %5hu->%s:%-5hu '%s' '%s' %u\n",
+ i, pm->protocol, pm->externalPort, pm->internalClient,
+ pm->internalPort,
+ pm->description, pm->remoteHost,
+ (unsigned)pm->leaseTime);
+ i++;
+ }
+ FreePortListing(&pdata);
+ }
+ else
+ {
+ printf("GetListOfPortMappings() returned %d (%s)\n",
+ r, strupnperror(r));
+ }
+ r = UPNP_GetListOfPortMappings(urls->controlURL,
+ data->first.servicetype,
+ "0",
+ "65535",
+ "UDP",
+ "1000",
+ &pdata);
+ if(r == UPNPCOMMAND_SUCCESS)
+ {
+ for(pm = pdata.l_head; pm != NULL; pm = pm->l_next)
+ {
+ printf("%2d %s %5hu->%s:%-5hu '%s' '%s' %u\n",
+ i, pm->protocol, pm->externalPort, pm->internalClient,
+ pm->internalPort,
+ pm->description, pm->remoteHost,
+ (unsigned)pm->leaseTime);
+ i++;
+ }
+ FreePortListing(&pdata);
+ }
+ else
+ {
+ printf("GetListOfPortMappings() returned %d (%s)\n",
+ r, strupnperror(r));
+ }
+}
+
+/* Test function
+ * 1 - get connection type
+ * 2 - get extenal ip address
+ * 3 - Add port mapping
+ * 4 - get this port mapping from the IGD */
+static int SetRedirectAndTest(struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ const char * iaddr,
+ const char * iport,
+ const char * eport,
+ const char * proto,
+ const char * leaseDuration,
+ const char * description,
+ int addAny)
+{
+ char externalIPAddress[40];
+ char intClient[40];
+ char intPort[6];
+ char reservedPort[6];
+ char duration[16];
+ int r;
+
+ if(!iaddr || !iport || !eport || !proto)
+ {
+ fprintf(stderr, "Wrong arguments\n");
+ return -1;
+ }
+ proto = protofix(proto);
+ if(!proto)
+ {
+ fprintf(stderr, "invalid protocol\n");
+ return -1;
+ }
+
+ r = UPNP_GetExternalIPAddress(urls->controlURL,
+ data->first.servicetype,
+ externalIPAddress);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("GetExternalIPAddress failed.\n");
+ else
+ printf("ExternalIPAddress = %s\n", externalIPAddress);
+
+ if (addAny) {
+ r = UPNP_AddAnyPortMapping(urls->controlURL, data->first.servicetype,
+ eport, iport, iaddr, description,
+ proto, 0, leaseDuration, reservedPort);
+ if(r==UPNPCOMMAND_SUCCESS)
+ eport = reservedPort;
+ else
+ printf("AddAnyPortMapping(%s, %s, %s) failed with code %d (%s)\n",
+ eport, iport, iaddr, r, strupnperror(r));
+ } else {
+ r = UPNP_AddPortMapping(urls->controlURL, data->first.servicetype,
+ eport, iport, iaddr, description,
+ proto, 0, leaseDuration);
+ if(r!=UPNPCOMMAND_SUCCESS) {
+ printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
+ eport, iport, iaddr, r, strupnperror(r));
+ return -2;
+ }
+ }
+
+ r = UPNP_GetSpecificPortMappingEntry(urls->controlURL,
+ data->first.servicetype,
+ eport, proto, NULL/*remoteHost*/,
+ intClient, intPort, NULL/*desc*/,
+ NULL/*enabled*/, duration);
+ if(r!=UPNPCOMMAND_SUCCESS) {
+ printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
+ r, strupnperror(r));
+ return -2;
+ } else {
+ printf("InternalIP:Port = %s:%s\n", intClient, intPort);
+ printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
+ externalIPAddress, eport, proto, intClient, intPort, duration);
+ }
+ return 0;
+}
+
+static int
+RemoveRedirect(struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ const char * eport,
+ const char * proto,
+ const char * remoteHost)
+{
+ int r;
+ if(!proto || !eport)
+ {
+ fprintf(stderr, "invalid arguments\n");
+ return -1;
+ }
+ proto = protofix(proto);
+ if(!proto)
+ {
+ fprintf(stderr, "protocol invalid\n");
+ return -1;
+ }
+ r = UPNP_DeletePortMapping(urls->controlURL, data->first.servicetype, eport, proto, remoteHost);
+ if(r!=UPNPCOMMAND_SUCCESS) {
+ printf("UPNP_DeletePortMapping() failed with code : %d\n", r);
+ return -2;
+ }else {
+ printf("UPNP_DeletePortMapping() returned : %d\n", r);
+ }
+ return 0;
+}
+
+static int
+RemoveRedirectRange(struct UPNPUrls * urls,
+ struct IGDdatas * data,
+ const char * ePortStart, char const * ePortEnd,
+ const char * proto, const char * manage)
+{
+ int r;
+
+ if (!manage)
+ manage = "0";
+
+ if(!proto || !ePortStart || !ePortEnd)
+ {
+ fprintf(stderr, "invalid arguments\n");
+ return -1;
+ }
+ proto = protofix(proto);
+ if(!proto)
+ {
+ fprintf(stderr, "protocol invalid\n");
+ return -1;
+ }
+ r = UPNP_DeletePortMappingRange(urls->controlURL, data->first.servicetype, ePortStart, ePortEnd, proto, manage);
+ if(r!=UPNPCOMMAND_SUCCESS) {
+ printf("UPNP_DeletePortMappingRange() failed with code : %d\n", r);
+ return -2;
+ }else {
+ printf("UPNP_DeletePortMappingRange() returned : %d\n", r);
+ }
+ return 0;
+}
+
+/* IGD:2, functions for service WANIPv6FirewallControl:1 */
+static void GetFirewallStatus(struct UPNPUrls * urls, struct IGDdatas * data)
+{
+ unsigned int bytessent, bytesreceived, packetsreceived, packetssent;
+ int firewallEnabled = 0, inboundPinholeAllowed = 0;
+
+ UPNP_GetFirewallStatus(urls->controlURL_6FC, data->IPv6FC.servicetype, &firewallEnabled, &inboundPinholeAllowed);
+ printf("FirewallEnabled: %d & Inbound Pinhole Allowed: %d\n", firewallEnabled, inboundPinholeAllowed);
+ printf("GetFirewallStatus:\n Firewall Enabled: %s\n Inbound Pinhole Allowed: %s\n", (firewallEnabled)? "Yes":"No", (inboundPinholeAllowed)? "Yes":"No");
+
+ bytessent = UPNP_GetTotalBytesSent(urls->controlURL_CIF, data->CIF.servicetype);
+ bytesreceived = UPNP_GetTotalBytesReceived(urls->controlURL_CIF, data->CIF.servicetype);
+ packetssent = UPNP_GetTotalPacketsSent(urls->controlURL_CIF, data->CIF.servicetype);
+ packetsreceived = UPNP_GetTotalPacketsReceived(urls->controlURL_CIF, data->CIF.servicetype);
+ printf("Bytes: Sent: %8u\tRecv: %8u\n", bytessent, bytesreceived);
+ printf("Packets: Sent: %8u\tRecv: %8u\n", packetssent, packetsreceived);
+}
+
+/* Test function
+ * 1 - Add pinhole
+ * 2 - Check if pinhole is working from the IGD side */
+static void SetPinholeAndTest(struct UPNPUrls * urls, struct IGDdatas * data,
+ const char * remoteaddr, const char * eport,
+ const char * intaddr, const char * iport,
+ const char * proto, const char * lease_time)
+{
+ char uniqueID[8];
+ /*int isWorking = 0;*/
+ int r;
+ char proto_tmp[8];
+
+ if(!intaddr || !remoteaddr || !iport || !eport || !proto || !lease_time)
+ {
+ fprintf(stderr, "Wrong arguments\n");
+ return;
+ }
+ if(atoi(proto) == 0)
+ {
+ const char * protocol;
+ protocol = protofix(proto);
+ if(protocol && (strcmp("TCP", protocol) == 0))
+ {
+ snprintf(proto_tmp, sizeof(proto_tmp), "%d", IPPROTO_TCP);
+ proto = proto_tmp;
+ }
+ else if(protocol && (strcmp("UDP", protocol) == 0))
+ {
+ snprintf(proto_tmp, sizeof(proto_tmp), "%d", IPPROTO_UDP);
+ proto = proto_tmp;
+ }
+ else
+ {
+ fprintf(stderr, "invalid protocol\n");
+ return;
+ }
+ }
+ r = UPNP_AddPinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, remoteaddr, eport, intaddr, iport, proto, lease_time, uniqueID);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("AddPinhole([%s]:%s -> [%s]:%s) failed with code %d (%s)\n",
+ remoteaddr, eport, intaddr, iport, r, strupnperror(r));
+ else
+ {
+ printf("AddPinhole: ([%s]:%s -> [%s]:%s) / Pinhole ID = %s\n",
+ remoteaddr, eport, intaddr, iport, uniqueID);
+ /*r = UPNP_CheckPinholeWorking(urls->controlURL_6FC, data->servicetype_6FC, uniqueID, &isWorking);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("CheckPinholeWorking() failed with code %d (%s)\n", r, strupnperror(r));
+ printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");*/
+ }
+}
+
+/* Test function
+ * 1 - Check if pinhole is working from the IGD side
+ * 2 - Update pinhole */
+static void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data,
+ const char * uniqueID, const char * lease_time)
+{
+ int isWorking = 0;
+ int r;
+
+ if(!uniqueID || !lease_time)
+ {
+ fprintf(stderr, "Wrong arguments\n");
+ return;
+ }
+ r = UPNP_CheckPinholeWorking(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID, &isWorking);
+ printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("CheckPinholeWorking() failed with code %d (%s)\n", r, strupnperror(r));
+ if(isWorking || r==709)
+ {
+ r = UPNP_UpdatePinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID, lease_time);
+ printf("UpdatePinhole: Pinhole ID = %s with Lease Time: %s\n", uniqueID, lease_time);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("UpdatePinhole: ID (%s) failed with code %d (%s)\n", uniqueID, r, strupnperror(r));
+ }
+}
+
+/* Test function
+ * Get pinhole timeout
+ */
+static void GetPinholeOutboundTimeout(struct UPNPUrls * urls, struct IGDdatas * data,
+ const char * remoteaddr, const char * eport,
+ const char * intaddr, const char * iport,
+ const char * proto)
+{
+ int timeout = 0;
+ int r;
+
+ if(!intaddr || !remoteaddr || !iport || !eport || !proto)
+ {
+ fprintf(stderr, "Wrong arguments\n");
+ return;
+ }
+
+ r = UPNP_GetOutboundPinholeTimeout(urls->controlURL_6FC, data->IPv6FC.servicetype, remoteaddr, eport, intaddr, iport, proto, &timeout);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("GetOutboundPinholeTimeout([%s]:%s -> [%s]:%s) failed with code %d (%s)\n",
+ intaddr, iport, remoteaddr, eport, r, strupnperror(r));
+ else
+ printf("GetOutboundPinholeTimeout: ([%s]:%s -> [%s]:%s) / Timeout = %d\n", intaddr, iport, remoteaddr, eport, timeout);
+}
+
+static void
+GetPinholePackets(struct UPNPUrls * urls,
+ struct IGDdatas * data, const char * uniqueID)
+{
+ int r, pinholePackets = 0;
+ if(!uniqueID)
+ {
+ fprintf(stderr, "invalid arguments\n");
+ return;
+ }
+ r = UPNP_GetPinholePackets(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID, &pinholePackets);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("GetPinholePackets() failed with code %d (%s)\n", r, strupnperror(r));
+ else
+ printf("GetPinholePackets: Pinhole ID = %s / PinholePackets = %d\n", uniqueID, pinholePackets);
+}
+
+static void
+CheckPinhole(struct UPNPUrls * urls,
+ struct IGDdatas * data, const char * uniqueID)
+{
+ int r, isWorking = 0;
+ if(!uniqueID)
+ {
+ fprintf(stderr, "invalid arguments\n");
+ return;
+ }
+ r = UPNP_CheckPinholeWorking(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID, &isWorking);
+ if(r!=UPNPCOMMAND_SUCCESS)
+ printf("CheckPinholeWorking() failed with code %d (%s)\n", r, strupnperror(r));
+ else
+ printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");
+}
+
+static void
+RemovePinhole(struct UPNPUrls * urls,
+ struct IGDdatas * data, const char * uniqueID)
+{
+ int r;
+ if(!uniqueID)
+ {
+ fprintf(stderr, "invalid arguments\n");
+ return;
+ }
+ r = UPNP_DeletePinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID);
+ printf("UPNP_DeletePinhole() returned : %d\n", r);
+}
+
+
+/* sample upnp client program */
+int main(int argc, char ** argv)
+{
+ char command = 0;
+ char ** commandargv = 0;
+ int commandargc = 0;
+ struct UPNPDev * devlist = 0;
+ char lanaddr[64] = "unset"; /* my ip address on the LAN */
+ int i;
+ const char * rootdescurl = 0;
+ const char * multicastif = 0;
+ const char * minissdpdpath = 0;
+ int localport = UPNP_LOCAL_PORT_ANY;
+ int retcode = 0;
+ int error = 0;
+ int ipv6 = 0;
+ unsigned char ttl = 2; /* defaulting to 2 */
+ const char * description = 0;
+
+#ifdef _WIN32
+ WSADATA wsaData;
+ int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
+ if(nResult != NO_ERROR)
+ {
+ fprintf(stderr, "WSAStartup() failed.\n");
+ return -1;
+ }
+#endif
+ printf("upnpc : miniupnpc library test client, version %s.\n", MINIUPNPC_VERSION_STRING);
+ printf(" (c) 2005-2018 Thomas Bernard.\n");
+ printf("Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/\n"
+ "for more information.\n");
+ /* command line processing */
+ for(i=1; i<argc; i++)
+ {
+ if(0 == strcmp(argv[i], "--help") || 0 == strcmp(argv[i], "-h"))
+ {
+ command = 0;
+ break;
+ }
+ if(argv[i][0] == '-')
+ {
+ if(argv[i][1] == 'u')
+ rootdescurl = argv[++i];
+ else if(argv[i][1] == 'm')
+ {
+ multicastif = argv[++i];
+ minissdpdpath = ""; /* Disable usage of minissdpd */
+ }
+ else if(argv[i][1] == 'z')
+ {
+ char junk;
+ if(sscanf(argv[++i], "%d%c", &localport, &junk)!=1 ||
+ localport<0 || localport>65535 ||
+ (localport >1 && localport < 1024))
+ {
+ fprintf(stderr, "Invalid localport '%s'\n", argv[i]);
+ localport = UPNP_LOCAL_PORT_ANY;
+ break;
+ }
+ }
+ else if(argv[i][1] == 'p')
+ minissdpdpath = argv[++i];
+ else if(argv[i][1] == '6')
+ ipv6 = 1;
+ else if(argv[i][1] == 'e')
+ description = argv[++i];
+ else if(argv[i][1] == 't')
+ ttl = (unsigned char)atoi(argv[++i]);
+ else
+ {
+ command = argv[i][1];
+ i++;
+ commandargv = argv + i;
+ commandargc = argc - i;
+ break;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "option '%s' invalid\n", argv[i]);
+ }
+ }
+
+ if(!command
+ || (command == 'a' && commandargc<4)
+ || (command == 'd' && argc<2)
+ || (command == 'r' && argc<2)
+ || (command == 'A' && commandargc<6)
+ || (command == 'U' && commandargc<2)
+ || (command == 'D' && commandargc<1))
+ {
+ fprintf(stderr, "Usage :\t%s [options] -a ip port external_port protocol [duration]\n\t\tAdd port redirection\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -d external_port protocol <remote host>\n\t\tDelete port redirection\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -s\n\t\tGet Connection status\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -l\n\t\tList redirections\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -L\n\t\tList redirections (using GetListOfPortMappings (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -n ip port external_port protocol [duration]\n\t\tAdd (any) port redirection allowing IGD to use alternative external_port (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -N external_port_start external_port_end protocol [manage]\n\t\tDelete range of port redirections (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -r port1 [external_port1] protocol1 [port2 [external_port2] protocol2] [...]\n\t\tAdd all redirections to the current host\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -A remote_ip remote_port internal_ip internal_port protocol lease_time\n\t\tAdd Pinhole (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -U uniqueID new_lease_time\n\t\tUpdate Pinhole (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -C uniqueID\n\t\tCheck if Pinhole is Working (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -K uniqueID\n\t\tGet Number of packets going through the rule (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -D uniqueID\n\t\tDelete Pinhole (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -S\n\t\tGet Firewall status (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -G remote_ip remote_port internal_ip internal_port protocol\n\t\tGet Outbound Pinhole Timeout (for IGD:2 only)\n", argv[0]);
+ fprintf(stderr, " \t%s [options] -P\n\t\tGet Presentation url\n", argv[0]);
+ fprintf(stderr, "\nprotocol is UDP or TCP\n");
+ fprintf(stderr, "Options:\n");
+ fprintf(stderr, " -e description : set description for port mapping.\n");
+ fprintf(stderr, " -6 : use ip v6 instead of ip v4.\n");
+ fprintf(stderr, " -u url : bypass discovery process by providing the XML root description url.\n");
+ fprintf(stderr, " -m address/interface : provide ip address (ip v4) or interface name (ip v4 or v6) to use for sending SSDP multicast packets.\n");
+ fprintf(stderr, " -z localport : SSDP packets local (source) port (1024-65535).\n");
+ fprintf(stderr, " -p path : use this path for MiniSSDPd socket.\n");
+ fprintf(stderr, " -t ttl : set multicast TTL. Default value is 2.\n");
+ return 1;
+ }
+
+ if( rootdescurl
+ || (devlist = upnpDiscover(2000, multicastif, minissdpdpath,
+ localport, ipv6, ttl, &error)))
+ {
+ struct UPNPDev * device;
+ struct UPNPUrls urls;
+ struct IGDdatas data;
+ if(devlist)
+ {
+ printf("List of UPNP devices found on the network :\n");
+ for(device = devlist; device; device = device->pNext)
+ {
+ printf(" desc: %s\n st: %s\n\n",
+ device->descURL, device->st);
+ }
+ }
+ else if(!rootdescurl)
+ {
+ printf("upnpDiscover() error code=%d\n", error);
+ }
+ i = 1;
+ if( (rootdescurl && UPNP_GetIGDFromUrl(rootdescurl, &urls, &data, lanaddr, sizeof(lanaddr)))
+ || (i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr))))
+ {
+ switch(i) {
+ case 1:
+ printf("Found valid IGD : %s\n", urls.controlURL);
+ break;
+ case 2:
+ printf("Found a (not connected?) IGD : %s\n", urls.controlURL);
+ printf("Trying to continue anyway\n");
+ break;
+ case 3:
+ printf("UPnP device found. Is it an IGD ? : %s\n", urls.controlURL);
+ printf("Trying to continue anyway\n");
+ break;
+ default:
+ printf("Found device (igd ?) : %s\n", urls.controlURL);
+ printf("Trying to continue anyway\n");
+ }
+ printf("Local LAN ip address : %s\n", lanaddr);
+ #if 0
+ printf("getting \"%s\"\n", urls.ipcondescURL);
+ descXML = miniwget(urls.ipcondescURL, &descXMLsize);
+ if(descXML)
+ {
+ /*fwrite(descXML, 1, descXMLsize, stdout);*/
+ free(descXML); descXML = NULL;
+ }
+ #endif
+
+ switch(command)
+ {
+ case 'l':
+ DisplayInfos(&urls, &data);
+ ListRedirections(&urls, &data);
+ break;
+ case 'L':
+ NewListRedirections(&urls, &data);
+ break;
+ case 'a':
+ if (SetRedirectAndTest(&urls, &data,
+ commandargv[0], commandargv[1],
+ commandargv[2], commandargv[3],
+ (commandargc > 4)?commandargv[4]:"0",
+ description, 0) < 0)
+ retcode = 2;
+ break;
+ case 'd':
+ if (RemoveRedirect(&urls, &data, commandargv[0], commandargv[1],
+ commandargc > 2 ? commandargv[2] : NULL) < 0)
+ retcode = 2;
+ break;
+ case 'n': /* aNy */
+ if (SetRedirectAndTest(&urls, &data,
+ commandargv[0], commandargv[1],
+ commandargv[2], commandargv[3],
+ (commandargc > 4)?commandargv[4]:"0",
+ description, 1) < 0)
+ retcode = 2;
+ break;
+ case 'N':
+ if (commandargc < 3)
+ fprintf(stderr, "too few arguments\n");
+
+ if (RemoveRedirectRange(&urls, &data, commandargv[0], commandargv[1], commandargv[2],
+ commandargc > 3 ? commandargv[3] : NULL) < 0)
+ retcode = 2;
+ break;
+ case 's':
+ GetConnectionStatus(&urls, &data);
+ break;
+ case 'r':
+ i = 0;
+ while(i<commandargc)
+ {
+ if(!is_int(commandargv[i])) {
+ /* 1st parameter not an integer : error */
+ fprintf(stderr, "command -r : %s is not an port number\n", commandargv[i]);
+ retcode = 1;
+ break;
+ } else if(is_int(commandargv[i+1])){
+ /* 2nd parameter is an integer : <port> <external_port> <protocol> */
+ if (SetRedirectAndTest(&urls, &data,
+ lanaddr, commandargv[i],
+ commandargv[i+1], commandargv[i+2], "0",
+ description, 0) < 0)
+ retcode = 2;
+ i+=3; /* 3 parameters parsed */
+ } else {
+ /* 2nd parameter not an integer : <port> <protocol> */
+ if (SetRedirectAndTest(&urls, &data,
+ lanaddr, commandargv[i],
+ commandargv[i], commandargv[i+1], "0",
+ description, 0) < 0)
+ retcode = 2;
+ i+=2; /* 2 parameters parsed */
+ }
+ }
+ break;
+ case 'A':
+ SetPinholeAndTest(&urls, &data,
+ commandargv[0], commandargv[1],
+ commandargv[2], commandargv[3],
+ commandargv[4], commandargv[5]);
+ break;
+ case 'U':
+ GetPinholeAndUpdate(&urls, &data,
+ commandargv[0], commandargv[1]);
+ break;
+ case 'C':
+ for(i=0; i<commandargc; i++)
+ {
+ CheckPinhole(&urls, &data, commandargv[i]);
+ }
+ break;
+ case 'K':
+ for(i=0; i<commandargc; i++)
+ {
+ GetPinholePackets(&urls, &data, commandargv[i]);
+ }
+ break;
+ case 'D':
+ for(i=0; i<commandargc; i++)
+ {
+ RemovePinhole(&urls, &data, commandargv[i]);
+ }
+ break;
+ case 'S':
+ GetFirewallStatus(&urls, &data);
+ break;
+ case 'G':
+ GetPinholeOutboundTimeout(&urls, &data,
+ commandargv[0], commandargv[1],
+ commandargv[2], commandargv[3],
+ commandargv[4]);
+ break;
+ case 'P':
+ printf("Presentation URL found:\n");
+ printf(" %s\n", data.presentationurl);
+ break;
+ default:
+ fprintf(stderr, "Unknown switch -%c\n", command);
+ retcode = 1;
+ }
+
+ FreeUPNPUrls(&urls);
+ }
+ else
+ {
+ fprintf(stderr, "No valid UPNP Internet Gateway Device found.\n");
+ retcode = 1;
+ }
+ freeUPNPDevlist(devlist); devlist = 0;
+ }
+ else
+ {
+ fprintf(stderr, "No IGD UPnP Device found on the network !\n");
+ retcode = 1;
+ }
+#ifdef _WIN32
+ nResult = WSACleanup();
+ if(nResult != NO_ERROR) {
+ fprintf(stderr, "WSACleanup() failed.\n");
+ }
+#endif /* _WIN32 */
+ return retcode;
+}
+
diff --git a/thirdparty/miniupnpc/upnpcommands.c b/thirdparty/miniupnpc/upnpcommands.c
new file mode 100644
index 0000000000..b6a693a93a
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpcommands.c
@@ -0,0 +1,1241 @@
+/* $Id: upnpcommands.c,v 1.49 2018/03/13 23:34:47 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * Project : miniupnp
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided in this distribution.
+ * */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "upnpcommands.h"
+#include "miniupnpc.h"
+#include "portlistingparse.h"
+#include "upnpreplyparse.h"
+
+static UNSIGNED_INTEGER
+my_atoui(const char * s)
+{
+ return s ? ((UNSIGNED_INTEGER)STRTOUI(s, NULL, 0)) : 0;
+}
+
+/*
+ * */
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesSent(const char * controlURL,
+ const char * servicetype)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ unsigned int r = 0;
+ char * p;
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetTotalBytesSent", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ /*DisplayNameValueList(buffer, bufsize);*/
+ free(buffer); buffer = NULL;
+ p = GetValueFromNameValueList(&pdata, "NewTotalBytesSent");
+ r = my_atoui(p);
+ ClearNameValueList(&pdata);
+ return r;
+}
+
+/*
+ * */
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesReceived(const char * controlURL,
+ const char * servicetype)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ unsigned int r = 0;
+ char * p;
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetTotalBytesReceived", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ /*DisplayNameValueList(buffer, bufsize);*/
+ free(buffer); buffer = NULL;
+ p = GetValueFromNameValueList(&pdata, "NewTotalBytesReceived");
+ r = my_atoui(p);
+ ClearNameValueList(&pdata);
+ return r;
+}
+
+/*
+ * */
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsSent(const char * controlURL,
+ const char * servicetype)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ unsigned int r = 0;
+ char * p;
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetTotalPacketsSent", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ /*DisplayNameValueList(buffer, bufsize);*/
+ free(buffer); buffer = NULL;
+ p = GetValueFromNameValueList(&pdata, "NewTotalPacketsSent");
+ r = my_atoui(p);
+ ClearNameValueList(&pdata);
+ return r;
+}
+
+/*
+ * */
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsReceived(const char * controlURL,
+ const char * servicetype)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ unsigned int r = 0;
+ char * p;
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetTotalPacketsReceived", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ /*DisplayNameValueList(buffer, bufsize);*/
+ free(buffer); buffer = NULL;
+ p = GetValueFromNameValueList(&pdata, "NewTotalPacketsReceived");
+ r = my_atoui(p);
+ ClearNameValueList(&pdata);
+ return r;
+}
+
+/* UPNP_GetStatusInfo() call the corresponding UPNP method
+ * returns the current status and uptime */
+MINIUPNP_LIBSPEC int
+UPNP_GetStatusInfo(const char * controlURL,
+ const char * servicetype,
+ char * status,
+ unsigned int * uptime,
+ char * lastconnerror)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ char * p;
+ char * up;
+ char * err;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!status && !uptime)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetStatusInfo", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ /*DisplayNameValueList(buffer, bufsize);*/
+ free(buffer); buffer = NULL;
+ up = GetValueFromNameValueList(&pdata, "NewUptime");
+ p = GetValueFromNameValueList(&pdata, "NewConnectionStatus");
+ err = GetValueFromNameValueList(&pdata, "NewLastConnectionError");
+ if(p && up)
+ ret = UPNPCOMMAND_SUCCESS;
+
+ if(status) {
+ if(p){
+ strncpy(status, p, 64 );
+ status[63] = '\0';
+ }else
+ status[0]= '\0';
+ }
+
+ if(uptime) {
+ if(up)
+ sscanf(up,"%u",uptime);
+ else
+ *uptime = 0;
+ }
+
+ if(lastconnerror) {
+ if(err) {
+ strncpy(lastconnerror, err, 64 );
+ lastconnerror[63] = '\0';
+ } else
+ lastconnerror[0] = '\0';
+ }
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+/* UPNP_GetConnectionTypeInfo() call the corresponding UPNP method
+ * returns the connection type */
+MINIUPNP_LIBSPEC int
+UPNP_GetConnectionTypeInfo(const char * controlURL,
+ const char * servicetype,
+ char * connectionType)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ char * p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!connectionType)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetConnectionTypeInfo", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ p = GetValueFromNameValueList(&pdata, "NewConnectionType");
+ /*p = GetValueFromNameValueList(&pdata, "NewPossibleConnectionTypes");*/
+ /* PossibleConnectionTypes will have several values.... */
+ if(p) {
+ strncpy(connectionType, p, 64 );
+ connectionType[63] = '\0';
+ ret = UPNPCOMMAND_SUCCESS;
+ } else
+ connectionType[0] = '\0';
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+/* UPNP_GetLinkLayerMaxBitRate() call the corresponding UPNP method.
+ * Returns 2 values: Downloadlink bandwidth and Uplink bandwidth.
+ * One of the values can be null
+ * Note : GetLinkLayerMaxBitRates belongs to WANPPPConnection:1 only
+ * We can use the GetCommonLinkProperties from WANCommonInterfaceConfig:1 */
+MINIUPNP_LIBSPEC int
+UPNP_GetLinkLayerMaxBitRates(const char * controlURL,
+ const char * servicetype,
+ unsigned int * bitrateDown,
+ unsigned int * bitrateUp)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ char * down;
+ char * up;
+ char * p;
+
+ if(!bitrateDown && !bitrateUp)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ /* shouldn't we use GetCommonLinkProperties ? */
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetCommonLinkProperties", 0, &bufsize))) {
+ /*"GetLinkLayerMaxBitRates", 0, &bufsize);*/
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ /*DisplayNameValueList(buffer, bufsize);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ /*down = GetValueFromNameValueList(&pdata, "NewDownstreamMaxBitRate");*/
+ /*up = GetValueFromNameValueList(&pdata, "NewUpstreamMaxBitRate");*/
+ down = GetValueFromNameValueList(&pdata, "NewLayer1DownstreamMaxBitRate");
+ up = GetValueFromNameValueList(&pdata, "NewLayer1UpstreamMaxBitRate");
+ /*GetValueFromNameValueList(&pdata, "NewWANAccessType");*/
+ /*GetValueFromNameValueList(&pdata, "NewPhysicalLinkStatus");*/
+ if(down && up)
+ ret = UPNPCOMMAND_SUCCESS;
+
+ if(bitrateDown) {
+ if(down)
+ sscanf(down,"%u",bitrateDown);
+ else
+ *bitrateDown = 0;
+ }
+
+ if(bitrateUp) {
+ if(up)
+ sscanf(up,"%u",bitrateUp);
+ else
+ *bitrateUp = 0;
+ }
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+
+/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
+ * if the third arg is not null the value is copied to it.
+ * at least 16 bytes must be available
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR Either an UPnP error code or an unknown error.
+ *
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetExternalIPAddress(const char * controlURL,
+ const char * servicetype,
+ char * extIpAdd)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ char * p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!extIpAdd || !controlURL || !servicetype)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetExternalIPAddress", 0, &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ /*DisplayNameValueList(buffer, bufsize);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ /*printf("external ip = %s\n", GetValueFromNameValueList(&pdata, "NewExternalIPAddress") );*/
+ p = GetValueFromNameValueList(&pdata, "NewExternalIPAddress");
+ if(p) {
+ strncpy(extIpAdd, p, 16 );
+ extIpAdd[15] = '\0';
+ ret = UPNPCOMMAND_SUCCESS;
+ } else
+ extIpAdd[0] = '\0';
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort,
+ const char * inPort,
+ const char * inClient,
+ const char * desc,
+ const char * proto,
+ const char * remoteHost,
+ const char * leaseDuration)
+{
+ struct UPNParg * AddPortMappingArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ int ret;
+
+ if(!inPort || !inClient || !proto || !extPort)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ AddPortMappingArgs = calloc(9, sizeof(struct UPNParg));
+ if(AddPortMappingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ AddPortMappingArgs[0].elt = "NewRemoteHost";
+ AddPortMappingArgs[0].val = remoteHost;
+ AddPortMappingArgs[1].elt = "NewExternalPort";
+ AddPortMappingArgs[1].val = extPort;
+ AddPortMappingArgs[2].elt = "NewProtocol";
+ AddPortMappingArgs[2].val = proto;
+ AddPortMappingArgs[3].elt = "NewInternalPort";
+ AddPortMappingArgs[3].val = inPort;
+ AddPortMappingArgs[4].elt = "NewInternalClient";
+ AddPortMappingArgs[4].val = inClient;
+ AddPortMappingArgs[5].elt = "NewEnabled";
+ AddPortMappingArgs[5].val = "1";
+ AddPortMappingArgs[6].elt = "NewPortMappingDescription";
+ AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
+ AddPortMappingArgs[7].elt = "NewLeaseDuration";
+ AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "AddPortMapping", AddPortMappingArgs,
+ &bufsize);
+ free(AddPortMappingArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ /*DisplayNameValueList(buffer, bufsize);*/
+ /*buffer[bufsize] = '\0';*/
+ /*puts(buffer);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal) {
+ /*printf("AddPortMapping errorCode = '%s'\n", resVal); */
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ } else {
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort,
+ const char * inPort,
+ const char * inClient,
+ const char * desc,
+ const char * proto,
+ const char * remoteHost,
+ const char * leaseDuration,
+ char * reservedPort)
+{
+ struct UPNParg * AddPortMappingArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ int ret;
+
+ if(!inPort || !inClient || !proto || !extPort)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ AddPortMappingArgs = calloc(9, sizeof(struct UPNParg));
+ if(AddPortMappingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ AddPortMappingArgs[0].elt = "NewRemoteHost";
+ AddPortMappingArgs[0].val = remoteHost;
+ AddPortMappingArgs[1].elt = "NewExternalPort";
+ AddPortMappingArgs[1].val = extPort;
+ AddPortMappingArgs[2].elt = "NewProtocol";
+ AddPortMappingArgs[2].val = proto;
+ AddPortMappingArgs[3].elt = "NewInternalPort";
+ AddPortMappingArgs[3].val = inPort;
+ AddPortMappingArgs[4].elt = "NewInternalClient";
+ AddPortMappingArgs[4].val = inClient;
+ AddPortMappingArgs[5].elt = "NewEnabled";
+ AddPortMappingArgs[5].val = "1";
+ AddPortMappingArgs[6].elt = "NewPortMappingDescription";
+ AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
+ AddPortMappingArgs[7].elt = "NewLeaseDuration";
+ AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "AddAnyPortMapping", AddPortMappingArgs,
+ &bufsize);
+ free(AddPortMappingArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ } else {
+ char *p;
+
+ p = GetValueFromNameValueList(&pdata, "NewReservedPort");
+ if(p) {
+ strncpy(reservedPort, p, 6);
+ reservedPort[5] = '\0';
+ ret = UPNPCOMMAND_SUCCESS;
+ } else {
+ ret = UPNPCOMMAND_INVALID_RESPONSE;
+ }
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort, const char * proto,
+ const char * remoteHost)
+{
+ /*struct NameValueParserData pdata;*/
+ struct UPNParg * DeletePortMappingArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ int ret;
+
+ if(!extPort || !proto)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ DeletePortMappingArgs = calloc(4, sizeof(struct UPNParg));
+ if(DeletePortMappingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ DeletePortMappingArgs[0].elt = "NewRemoteHost";
+ DeletePortMappingArgs[0].val = remoteHost;
+ DeletePortMappingArgs[1].elt = "NewExternalPort";
+ DeletePortMappingArgs[1].val = extPort;
+ DeletePortMappingArgs[2].elt = "NewProtocol";
+ DeletePortMappingArgs[2].val = proto;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "DeletePortMapping",
+ DeletePortMappingArgs, &bufsize);
+ free(DeletePortMappingArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ /*DisplayNameValueList(buffer, bufsize);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ } else {
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
+ const char * extPortStart, const char * extPortEnd,
+ const char * proto,
+ const char * manage)
+{
+ struct UPNParg * DeletePortMappingArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ int ret;
+
+ if(!extPortStart || !extPortEnd || !proto || !manage)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ DeletePortMappingArgs = calloc(5, sizeof(struct UPNParg));
+ if(DeletePortMappingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ DeletePortMappingArgs[0].elt = "NewStartPort";
+ DeletePortMappingArgs[0].val = extPortStart;
+ DeletePortMappingArgs[1].elt = "NewEndPort";
+ DeletePortMappingArgs[1].val = extPortEnd;
+ DeletePortMappingArgs[2].elt = "NewProtocol";
+ DeletePortMappingArgs[2].val = proto;
+ DeletePortMappingArgs[3].elt = "NewManage";
+ DeletePortMappingArgs[3].val = manage;
+
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "DeletePortMappingRange",
+ DeletePortMappingArgs, &bufsize);
+ free(DeletePortMappingArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ } else {
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_GetGenericPortMappingEntry(const char * controlURL,
+ const char * servicetype,
+ const char * index,
+ char * extPort,
+ char * intClient,
+ char * intPort,
+ char * protocol,
+ char * desc,
+ char * enabled,
+ char * rHost,
+ char * duration)
+{
+ struct NameValueParserData pdata;
+ struct UPNParg * GetPortMappingArgs;
+ char * buffer;
+ int bufsize;
+ char * p;
+ int r = UPNPCOMMAND_UNKNOWN_ERROR;
+ if(!index)
+ return UPNPCOMMAND_INVALID_ARGS;
+ intClient[0] = '\0';
+ intPort[0] = '\0';
+ GetPortMappingArgs = calloc(2, sizeof(struct UPNParg));
+ if(GetPortMappingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ GetPortMappingArgs[0].elt = "NewPortMappingIndex";
+ GetPortMappingArgs[0].val = index;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetGenericPortMappingEntry",
+ GetPortMappingArgs, &bufsize);
+ free(GetPortMappingArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+
+ p = GetValueFromNameValueList(&pdata, "NewRemoteHost");
+ if(p && rHost)
+ {
+ strncpy(rHost, p, 64);
+ rHost[63] = '\0';
+ }
+ p = GetValueFromNameValueList(&pdata, "NewExternalPort");
+ if(p && extPort)
+ {
+ strncpy(extPort, p, 6);
+ extPort[5] = '\0';
+ r = UPNPCOMMAND_SUCCESS;
+ }
+ p = GetValueFromNameValueList(&pdata, "NewProtocol");
+ if(p && protocol)
+ {
+ strncpy(protocol, p, 4);
+ protocol[3] = '\0';
+ }
+ p = GetValueFromNameValueList(&pdata, "NewInternalClient");
+ if(p)
+ {
+ strncpy(intClient, p, 16);
+ intClient[15] = '\0';
+ r = 0;
+ }
+ p = GetValueFromNameValueList(&pdata, "NewInternalPort");
+ if(p)
+ {
+ strncpy(intPort, p, 6);
+ intPort[5] = '\0';
+ }
+ p = GetValueFromNameValueList(&pdata, "NewEnabled");
+ if(p && enabled)
+ {
+ strncpy(enabled, p, 4);
+ enabled[3] = '\0';
+ }
+ p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
+ if(p && desc)
+ {
+ strncpy(desc, p, 80);
+ desc[79] = '\0';
+ }
+ p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
+ if(p && duration)
+ {
+ strncpy(duration, p, 16);
+ duration[15] = '\0';
+ }
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ r = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &r);
+ }
+ ClearNameValueList(&pdata);
+ return r;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_GetPortMappingNumberOfEntries(const char * controlURL,
+ const char * servicetype,
+ unsigned int * numEntries)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ char* p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetPortMappingNumberOfEntries", 0,
+ &bufsize))) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+#ifdef DEBUG
+ DisplayNameValueList(buffer, bufsize);
+#endif
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+
+ p = GetValueFromNameValueList(&pdata, "NewPortMappingNumberOfEntries");
+ if(numEntries && p) {
+ *numEntries = 0;
+ sscanf(p, "%u", numEntries);
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping
+ * the result is returned in the intClient and intPort strings
+ * please provide 16 and 6 bytes of data */
+MINIUPNP_LIBSPEC int
+UPNP_GetSpecificPortMappingEntry(const char * controlURL,
+ const char * servicetype,
+ const char * extPort,
+ const char * proto,
+ const char * remoteHost,
+ char * intClient,
+ char * intPort,
+ char * desc,
+ char * enabled,
+ char * leaseDuration)
+{
+ struct NameValueParserData pdata;
+ struct UPNParg * GetPortMappingArgs;
+ char * buffer;
+ int bufsize;
+ char * p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!intPort || !intClient || !extPort || !proto)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ GetPortMappingArgs = calloc(4, sizeof(struct UPNParg));
+ if(GetPortMappingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ GetPortMappingArgs[0].elt = "NewRemoteHost";
+ GetPortMappingArgs[0].val = remoteHost;
+ GetPortMappingArgs[1].elt = "NewExternalPort";
+ GetPortMappingArgs[1].val = extPort;
+ GetPortMappingArgs[2].elt = "NewProtocol";
+ GetPortMappingArgs[2].val = proto;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetSpecificPortMappingEntry",
+ GetPortMappingArgs, &bufsize);
+ free(GetPortMappingArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ /*DisplayNameValueList(buffer, bufsize);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+
+ p = GetValueFromNameValueList(&pdata, "NewInternalClient");
+ if(p) {
+ strncpy(intClient, p, 16);
+ intClient[15] = '\0';
+ ret = UPNPCOMMAND_SUCCESS;
+ } else
+ intClient[0] = '\0';
+
+ p = GetValueFromNameValueList(&pdata, "NewInternalPort");
+ if(p) {
+ strncpy(intPort, p, 6);
+ intPort[5] = '\0';
+ } else
+ intPort[0] = '\0';
+
+ p = GetValueFromNameValueList(&pdata, "NewEnabled");
+ if(p && enabled) {
+ strncpy(enabled, p, 4);
+ enabled[3] = '\0';
+ }
+
+ p = GetValueFromNameValueList(&pdata, "NewPortMappingDescription");
+ if(p && desc) {
+ strncpy(desc, p, 80);
+ desc[79] = '\0';
+ }
+
+ p = GetValueFromNameValueList(&pdata, "NewLeaseDuration");
+ if(p && leaseDuration)
+ {
+ strncpy(leaseDuration, p, 16);
+ leaseDuration[15] = '\0';
+ }
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+/* UPNP_GetListOfPortMappings()
+ *
+ * Possible UPNP Error codes :
+ * 606 Action not Authorized
+ * 730 PortMappingNotFound - no port mapping is found in the specified range.
+ * 733 InconsistantParameters - NewStartPort and NewEndPort values are not
+ * consistent.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetListOfPortMappings(const char * controlURL,
+ const char * servicetype,
+ const char * startPort,
+ const char * endPort,
+ const char * protocol,
+ const char * numberOfPorts,
+ struct PortMappingParserData * data)
+{
+ struct NameValueParserData pdata;
+ struct UPNParg * GetListOfPortMappingsArgs;
+ const char * p;
+ char * buffer;
+ int bufsize;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!startPort || !endPort || !protocol)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ GetListOfPortMappingsArgs = calloc(6, sizeof(struct UPNParg));
+ if(GetListOfPortMappingsArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ GetListOfPortMappingsArgs[0].elt = "NewStartPort";
+ GetListOfPortMappingsArgs[0].val = startPort;
+ GetListOfPortMappingsArgs[1].elt = "NewEndPort";
+ GetListOfPortMappingsArgs[1].val = endPort;
+ GetListOfPortMappingsArgs[2].elt = "NewProtocol";
+ GetListOfPortMappingsArgs[2].val = protocol;
+ GetListOfPortMappingsArgs[3].elt = "NewManage";
+ GetListOfPortMappingsArgs[3].val = "1";
+ GetListOfPortMappingsArgs[4].elt = "NewNumberOfPorts";
+ GetListOfPortMappingsArgs[4].val = numberOfPorts?numberOfPorts:"1000";
+
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetListOfPortMappings",
+ GetListOfPortMappingsArgs, &bufsize);
+ free(GetListOfPortMappingsArgs);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+
+ /*DisplayNameValueList(buffer, bufsize);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+
+ /*p = GetValueFromNameValueList(&pdata, "NewPortListing");*/
+ /*if(p) {
+ printf("NewPortListing : %s\n", p);
+ }*/
+ /*printf("NewPortListing(%d chars) : %s\n",
+ pdata.portListingLength, pdata.portListing);*/
+ if(pdata.portListing)
+ {
+ /*struct PortMapping * pm;
+ int i = 0;*/
+ ParsePortListing(pdata.portListing, pdata.portListingLength,
+ data);
+ ret = UPNPCOMMAND_SUCCESS;
+ /*
+ for(pm = data->head.lh_first; pm != NULL; pm = pm->entries.le_next)
+ {
+ printf("%2d %s %5hu->%s:%-5hu '%s' '%s'\n",
+ i, pm->protocol, pm->externalPort, pm->internalClient,
+ pm->internalPort,
+ pm->description, pm->remoteHost);
+ i++;
+ }
+ */
+ /*FreePortListing(&data);*/
+ }
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p) {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+ ClearNameValueList(&pdata);
+
+ /*printf("%.*s", bufsize, buffer);*/
+
+ return ret;
+}
+
+/* IGD:2, functions for service WANIPv6FirewallControl:1 */
+MINIUPNP_LIBSPEC int
+UPNP_GetFirewallStatus(const char * controlURL,
+ const char * servicetype,
+ int * firewallEnabled,
+ int * inboundPinholeAllowed)
+{
+ struct NameValueParserData pdata;
+ char * buffer;
+ int bufsize;
+ char * fe, *ipa, *p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!firewallEnabled || !inboundPinholeAllowed)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetFirewallStatus", 0, &bufsize);
+ if(!buffer) {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ fe = GetValueFromNameValueList(&pdata, "FirewallEnabled");
+ ipa = GetValueFromNameValueList(&pdata, "InboundPinholeAllowed");
+ if(ipa && fe)
+ ret = UPNPCOMMAND_SUCCESS;
+ if(fe)
+ *firewallEnabled = my_atoui(fe);
+ /*else
+ *firewallEnabled = 0;*/
+ if(ipa)
+ *inboundPinholeAllowed = my_atoui(ipa);
+ /*else
+ *inboundPinholeAllowed = 0;*/
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p)
+ {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype,
+ const char * remoteHost,
+ const char * remotePort,
+ const char * intClient,
+ const char * intPort,
+ const char * proto,
+ int * opTimeout)
+{
+ struct UPNParg * GetOutboundPinholeTimeoutArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ char * p;
+ int ret;
+
+ if(!intPort || !intClient || !proto || !remotePort || !remoteHost)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ GetOutboundPinholeTimeoutArgs = calloc(6, sizeof(struct UPNParg));
+ if(GetOutboundPinholeTimeoutArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ GetOutboundPinholeTimeoutArgs[0].elt = "RemoteHost";
+ GetOutboundPinholeTimeoutArgs[0].val = remoteHost;
+ GetOutboundPinholeTimeoutArgs[1].elt = "RemotePort";
+ GetOutboundPinholeTimeoutArgs[1].val = remotePort;
+ GetOutboundPinholeTimeoutArgs[2].elt = "Protocol";
+ GetOutboundPinholeTimeoutArgs[2].val = proto;
+ GetOutboundPinholeTimeoutArgs[3].elt = "InternalPort";
+ GetOutboundPinholeTimeoutArgs[3].val = intPort;
+ GetOutboundPinholeTimeoutArgs[4].elt = "InternalClient";
+ GetOutboundPinholeTimeoutArgs[4].val = intClient;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetOutboundPinholeTimeout", GetOutboundPinholeTimeoutArgs, &bufsize);
+ free(GetOutboundPinholeTimeoutArgs);
+ if(!buffer)
+ return UPNPCOMMAND_HTTP_ERROR;
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal)
+ {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ }
+ else
+ {
+ ret = UPNPCOMMAND_SUCCESS;
+ p = GetValueFromNameValueList(&pdata, "OutboundPinholeTimeout");
+ if(p)
+ *opTimeout = my_atoui(p);
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_AddPinhole(const char * controlURL, const char * servicetype,
+ const char * remoteHost,
+ const char * remotePort,
+ const char * intClient,
+ const char * intPort,
+ const char * proto,
+ const char * leaseTime,
+ char * uniqueID)
+{
+ struct UPNParg * AddPinholeArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ char * p;
+ int ret;
+
+ if(!intPort || !intClient || !proto || !remoteHost || !remotePort || !leaseTime)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ AddPinholeArgs = calloc(7, sizeof(struct UPNParg));
+ if(AddPinholeArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ /* RemoteHost can be wilcarded */
+ if(strncmp(remoteHost, "empty", 5)==0)
+ {
+ AddPinholeArgs[0].elt = "RemoteHost";
+ AddPinholeArgs[0].val = "";
+ }
+ else
+ {
+ AddPinholeArgs[0].elt = "RemoteHost";
+ AddPinholeArgs[0].val = remoteHost;
+ }
+ AddPinholeArgs[1].elt = "RemotePort";
+ AddPinholeArgs[1].val = remotePort;
+ AddPinholeArgs[2].elt = "Protocol";
+ AddPinholeArgs[2].val = proto;
+ AddPinholeArgs[3].elt = "InternalPort";
+ AddPinholeArgs[3].val = intPort;
+ if(strncmp(intClient, "empty", 5)==0)
+ {
+ AddPinholeArgs[4].elt = "InternalClient";
+ AddPinholeArgs[4].val = "";
+ }
+ else
+ {
+ AddPinholeArgs[4].elt = "InternalClient";
+ AddPinholeArgs[4].val = intClient;
+ }
+ AddPinholeArgs[5].elt = "LeaseTime";
+ AddPinholeArgs[5].val = leaseTime;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "AddPinhole", AddPinholeArgs, &bufsize);
+ free(AddPinholeArgs);
+ if(!buffer)
+ return UPNPCOMMAND_HTTP_ERROR;
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ p = GetValueFromNameValueList(&pdata, "UniqueID");
+ if(p)
+ {
+ strncpy(uniqueID, p, 8);
+ uniqueID[7] = '\0';
+ }
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal)
+ {
+ /*printf("AddPortMapping errorCode = '%s'\n", resVal);*/
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ }
+ else
+ {
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
+ const char * uniqueID,
+ const char * leaseTime)
+{
+ struct UPNParg * UpdatePinholeArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ int ret;
+
+ if(!uniqueID || !leaseTime)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ UpdatePinholeArgs = calloc(3, sizeof(struct UPNParg));
+ if(UpdatePinholeArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ UpdatePinholeArgs[0].elt = "UniqueID";
+ UpdatePinholeArgs[0].val = uniqueID;
+ UpdatePinholeArgs[1].elt = "NewLeaseTime";
+ UpdatePinholeArgs[1].val = leaseTime;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "UpdatePinhole", UpdatePinholeArgs, &bufsize);
+ free(UpdatePinholeArgs);
+ if(!buffer)
+ return UPNPCOMMAND_HTTP_ERROR;
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal)
+ {
+ /*printf("AddPortMapping errorCode = '%s'\n", resVal); */
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ }
+ else
+ {
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID)
+{
+ /*struct NameValueParserData pdata;*/
+ struct UPNParg * DeletePinholeArgs;
+ char * buffer;
+ int bufsize;
+ struct NameValueParserData pdata;
+ const char * resVal;
+ int ret;
+
+ if(!uniqueID)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ DeletePinholeArgs = calloc(2, sizeof(struct UPNParg));
+ if(DeletePinholeArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ DeletePinholeArgs[0].elt = "UniqueID";
+ DeletePinholeArgs[0].val = uniqueID;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "DeletePinhole", DeletePinholeArgs, &bufsize);
+ free(DeletePinholeArgs);
+ if(!buffer)
+ return UPNPCOMMAND_HTTP_ERROR;
+ /*DisplayNameValueList(buffer, bufsize);*/
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+ resVal = GetValueFromNameValueList(&pdata, "errorCode");
+ if(resVal)
+ {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(resVal, "%d", &ret);
+ }
+ else
+ {
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
+ const char * uniqueID, int * isWorking)
+{
+ struct NameValueParserData pdata;
+ struct UPNParg * CheckPinholeWorkingArgs;
+ char * buffer;
+ int bufsize;
+ char * p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!uniqueID)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ CheckPinholeWorkingArgs = calloc(4, sizeof(struct UPNParg));
+ if(CheckPinholeWorkingArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ CheckPinholeWorkingArgs[0].elt = "UniqueID";
+ CheckPinholeWorkingArgs[0].val = uniqueID;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "CheckPinholeWorking", CheckPinholeWorkingArgs, &bufsize);
+ free(CheckPinholeWorkingArgs);
+ if(!buffer)
+ {
+ return UPNPCOMMAND_HTTP_ERROR;
+ }
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+
+ p = GetValueFromNameValueList(&pdata, "IsWorking");
+ if(p)
+ {
+ *isWorking=my_atoui(p);
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+ else
+ *isWorking = 0;
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p)
+ {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+MINIUPNP_LIBSPEC int
+UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
+ const char * uniqueID, int * packets)
+{
+ struct NameValueParserData pdata;
+ struct UPNParg * GetPinholePacketsArgs;
+ char * buffer;
+ int bufsize;
+ char * p;
+ int ret = UPNPCOMMAND_UNKNOWN_ERROR;
+
+ if(!uniqueID)
+ return UPNPCOMMAND_INVALID_ARGS;
+
+ GetPinholePacketsArgs = calloc(4, sizeof(struct UPNParg));
+ if(GetPinholePacketsArgs == NULL)
+ return UPNPCOMMAND_MEM_ALLOC_ERROR;
+ GetPinholePacketsArgs[0].elt = "UniqueID";
+ GetPinholePacketsArgs[0].val = uniqueID;
+ buffer = simpleUPnPcommand(-1, controlURL, servicetype,
+ "GetPinholePackets", GetPinholePacketsArgs, &bufsize);
+ free(GetPinholePacketsArgs);
+ if(!buffer)
+ return UPNPCOMMAND_HTTP_ERROR;
+ ParseNameValue(buffer, bufsize, &pdata);
+ free(buffer); buffer = NULL;
+
+ p = GetValueFromNameValueList(&pdata, "PinholePackets");
+ if(p)
+ {
+ *packets=my_atoui(p);
+ ret = UPNPCOMMAND_SUCCESS;
+ }
+
+ p = GetValueFromNameValueList(&pdata, "errorCode");
+ if(p)
+ {
+ ret = UPNPCOMMAND_UNKNOWN_ERROR;
+ sscanf(p, "%d", &ret);
+ }
+
+ ClearNameValueList(&pdata);
+ return ret;
+}
+
+
diff --git a/thirdparty/miniupnpc/upnpcommands.h b/thirdparty/miniupnpc/upnpcommands.h
new file mode 100644
index 0000000000..0c6d501666
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpcommands.h
@@ -0,0 +1,348 @@
+/* $Id: upnpcommands.h,v 1.32 2018/03/13 23:34:47 nanard Exp $ */
+/* Miniupnp project : http://miniupnp.free.fr/
+ * Author : Thomas Bernard
+ * Copyright (c) 2005-2018 Thomas Bernard
+ * This software is subject to the conditions detailed in the
+ * LICENCE file provided within this distribution */
+#ifndef UPNPCOMMANDS_H_INCLUDED
+#define UPNPCOMMANDS_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+#include "miniupnpctypes.h"
+
+/* MiniUPnPc return codes : */
+#define UPNPCOMMAND_SUCCESS (0)
+#define UPNPCOMMAND_UNKNOWN_ERROR (-1)
+#define UPNPCOMMAND_INVALID_ARGS (-2)
+#define UPNPCOMMAND_HTTP_ERROR (-3)
+#define UPNPCOMMAND_INVALID_RESPONSE (-4)
+#define UPNPCOMMAND_MEM_ALLOC_ERROR (-5)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct PortMappingParserData;
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesSent(const char * controlURL,
+ const char * servicetype);
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalBytesReceived(const char * controlURL,
+ const char * servicetype);
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsSent(const char * controlURL,
+ const char * servicetype);
+
+MINIUPNP_LIBSPEC UNSIGNED_INTEGER
+UPNP_GetTotalPacketsReceived(const char * controlURL,
+ const char * servicetype);
+
+/* UPNP_GetStatusInfo()
+ * status and lastconnerror are 64 byte buffers
+ * Return values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error code */
+MINIUPNP_LIBSPEC int
+UPNP_GetStatusInfo(const char * controlURL,
+ const char * servicetype,
+ char * status,
+ unsigned int * uptime,
+ char * lastconnerror);
+
+/* UPNP_GetConnectionTypeInfo()
+ * argument connectionType is a 64 character buffer
+ * Return Values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error code */
+MINIUPNP_LIBSPEC int
+UPNP_GetConnectionTypeInfo(const char * controlURL,
+ const char * servicetype,
+ char * connectionType);
+
+/* UPNP_GetExternalIPAddress() call the corresponding UPNP method.
+ * if the third arg is not null the value is copied to it.
+ * at least 16 bytes must be available
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR Either an UPnP error code or an unknown error.
+ *
+ * possible UPnP Errors :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control. */
+MINIUPNP_LIBSPEC int
+UPNP_GetExternalIPAddress(const char * controlURL,
+ const char * servicetype,
+ char * extIpAdd);
+
+/* UPNP_GetLinkLayerMaxBitRates()
+ * call WANCommonInterfaceConfig:1#GetCommonLinkProperties
+ *
+ * return values :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code. */
+MINIUPNP_LIBSPEC int
+UPNP_GetLinkLayerMaxBitRates(const char* controlURL,
+ const char* servicetype,
+ unsigned int * bitrateDown,
+ unsigned int * bitrateUp);
+
+/* UPNP_AddPortMapping()
+ * if desc is NULL, it will be defaulted to "libminiupnpc"
+ * remoteHost is usually NULL because IGD don't support it.
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
+ *
+ * List of possible UPnP errors for AddPortMapping :
+ * errorCode errorDescription (short) - Description (long)
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization and
+ * the sender was not authorized.
+ * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
+ * wild-carded
+ * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
+ * 718 ConflictInMappingEntry - The port mapping entry specified conflicts
+ * with a mapping assigned previously to another client
+ * 724 SamePortValuesRequired - Internal and External port values
+ * must be the same
+ * 725 OnlyPermanentLeasesSupported - The NAT implementation only supports
+ * permanent lease times on port mappings
+ * 726 RemoteHostOnlySupportsWildcard - RemoteHost must be a wildcard
+ * and cannot be a specific IP address or DNS name
+ * 727 ExternalPortOnlySupportsWildcard - ExternalPort must be a wildcard and
+ * cannot be a specific port value
+ * 728 NoPortMapsAvailable - There are not enough free ports available to
+ * complete port mapping.
+ * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
+ * due to conflict with other mechanisms.
+ * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
+ */
+MINIUPNP_LIBSPEC int
+UPNP_AddPortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort,
+ const char * inPort,
+ const char * inClient,
+ const char * desc,
+ const char * proto,
+ const char * remoteHost,
+ const char * leaseDuration);
+
+/* UPNP_AddAnyPortMapping()
+ * if desc is NULL, it will be defaulted to "libminiupnpc"
+ * remoteHost is usually NULL because IGD don't support it.
+ *
+ * Return values :
+ * 0 : SUCCESS
+ * NON ZERO : ERROR. Either an UPnP error code or an unknown error.
+ *
+ * List of possible UPnP errors for AddPortMapping :
+ * errorCode errorDescription (short) - Description (long)
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization and
+ * the sender was not authorized.
+ * 715 WildCardNotPermittedInSrcIP - The source IP address cannot be
+ * wild-carded
+ * 716 WildCardNotPermittedInExtPort - The external port cannot be wild-carded
+ * 728 NoPortMapsAvailable - There are not enough free ports available to
+ * complete port mapping.
+ * 729 ConflictWithOtherMechanisms - Attempted port mapping is not allowed
+ * due to conflict with other mechanisms.
+ * 732 WildCardNotPermittedInIntPort - The internal port cannot be wild-carded
+ */
+MINIUPNP_LIBSPEC int
+UPNP_AddAnyPortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort,
+ const char * inPort,
+ const char * inClient,
+ const char * desc,
+ const char * proto,
+ const char * remoteHost,
+ const char * leaseDuration,
+ char * reservedPort);
+
+/* UPNP_DeletePortMapping()
+ * Use same argument values as what was used for AddPortMapping().
+ * remoteHost is usually NULL because IGD don't support it.
+ * Return Values :
+ * 0 : SUCCESS
+ * NON ZERO : error. Either an UPnP error code or an undefined error.
+ *
+ * List of possible UPnP errors for DeletePortMapping :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 714 NoSuchEntryInArray - The specified value does not exist in the array */
+MINIUPNP_LIBSPEC int
+UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,
+ const char * extPort, const char * proto,
+ const char * remoteHost);
+
+/* UPNP_DeletePortRangeMapping()
+ * Use same argument values as what was used for AddPortMapping().
+ * remoteHost is usually NULL because IGD don't support it.
+ * Return Values :
+ * 0 : SUCCESS
+ * NON ZERO : error. Either an UPnP error code or an undefined error.
+ *
+ * List of possible UPnP errors for DeletePortMapping :
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 730 PortMappingNotFound - This error message is returned if no port
+ * mapping is found in the specified range.
+ * 733 InconsistentParameters - NewStartPort and NewEndPort values are not consistent. */
+MINIUPNP_LIBSPEC int
+UPNP_DeletePortMappingRange(const char * controlURL, const char * servicetype,
+ const char * extPortStart, const char * extPortEnd,
+ const char * proto,
+ const char * manage);
+
+/* UPNP_GetPortMappingNumberOfEntries()
+ * not supported by all routers */
+MINIUPNP_LIBSPEC int
+UPNP_GetPortMappingNumberOfEntries(const char* controlURL,
+ const char* servicetype,
+ unsigned int * num);
+
+/* UPNP_GetSpecificPortMappingEntry()
+ * retrieves an existing port mapping
+ * params :
+ * in extPort
+ * in proto
+ * in remoteHost
+ * out intClient (16 bytes)
+ * out intPort (6 bytes)
+ * out desc (80 bytes)
+ * out enabled (4 bytes)
+ * out leaseDuration (16 bytes)
+ *
+ * return value :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code.
+ *
+ * List of possible UPnP errors for _GetSpecificPortMappingEntry :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 501 Action Failed - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 714 NoSuchEntryInArray - The specified value does not exist in the array.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetSpecificPortMappingEntry(const char * controlURL,
+ const char * servicetype,
+ const char * extPort,
+ const char * proto,
+ const char * remoteHost,
+ char * intClient,
+ char * intPort,
+ char * desc,
+ char * enabled,
+ char * leaseDuration);
+
+/* UPNP_GetGenericPortMappingEntry()
+ * params :
+ * in index
+ * out extPort (6 bytes)
+ * out intClient (16 bytes)
+ * out intPort (6 bytes)
+ * out protocol (4 bytes)
+ * out desc (80 bytes)
+ * out enabled (4 bytes)
+ * out rHost (64 bytes)
+ * out duration (16 bytes)
+ *
+ * return value :
+ * UPNPCOMMAND_SUCCESS, UPNPCOMMAND_INVALID_ARGS, UPNPCOMMAND_UNKNOWN_ERROR
+ * or a UPnP Error Code.
+ *
+ * Possible UPNP Error codes :
+ * 402 Invalid Args - See UPnP Device Architecture section on Control.
+ * 606 Action not authorized - The action requested REQUIRES authorization
+ * and the sender was not authorized.
+ * 713 SpecifiedArrayIndexInvalid - The specified array index is out of bounds
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetGenericPortMappingEntry(const char * controlURL,
+ const char * servicetype,
+ const char * index,
+ char * extPort,
+ char * intClient,
+ char * intPort,
+ char * protocol,
+ char * desc,
+ char * enabled,
+ char * rHost,
+ char * duration);
+
+/* UPNP_GetListOfPortMappings() Available in IGD v2
+ *
+ *
+ * Possible UPNP Error codes :
+ * 606 Action not Authorized
+ * 730 PortMappingNotFound - no port mapping is found in the specified range.
+ * 733 InconsistantParameters - NewStartPort and NewEndPort values are not
+ * consistent.
+ */
+MINIUPNP_LIBSPEC int
+UPNP_GetListOfPortMappings(const char * controlURL,
+ const char * servicetype,
+ const char * startPort,
+ const char * endPort,
+ const char * protocol,
+ const char * numberOfPorts,
+ struct PortMappingParserData * data);
+
+/* IGD:2, functions for service WANIPv6FirewallControl:1 */
+MINIUPNP_LIBSPEC int
+UPNP_GetFirewallStatus(const char * controlURL,
+ const char * servicetype,
+ int * firewallEnabled,
+ int * inboundPinholeAllowed);
+
+MINIUPNP_LIBSPEC int
+UPNP_GetOutboundPinholeTimeout(const char * controlURL, const char * servicetype,
+ const char * remoteHost,
+ const char * remotePort,
+ const char * intClient,
+ const char * intPort,
+ const char * proto,
+ int * opTimeout);
+
+MINIUPNP_LIBSPEC int
+UPNP_AddPinhole(const char * controlURL, const char * servicetype,
+ const char * remoteHost,
+ const char * remotePort,
+ const char * intClient,
+ const char * intPort,
+ const char * proto,
+ const char * leaseTime,
+ char * uniqueID);
+
+MINIUPNP_LIBSPEC int
+UPNP_UpdatePinhole(const char * controlURL, const char * servicetype,
+ const char * uniqueID,
+ const char * leaseTime);
+
+MINIUPNP_LIBSPEC int
+UPNP_DeletePinhole(const char * controlURL, const char * servicetype, const char * uniqueID);
+
+MINIUPNP_LIBSPEC int
+UPNP_CheckPinholeWorking(const char * controlURL, const char * servicetype,
+ const char * uniqueID, int * isWorking);
+
+MINIUPNP_LIBSPEC int
+UPNP_GetPinholePackets(const char * controlURL, const char * servicetype,
+ const char * uniqueID, int * packets);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/thirdparty/miniupnpc/upnpdev.c b/thirdparty/miniupnpc/upnpdev.c
new file mode 100644
index 0000000000..d89a9934c3
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpdev.c
@@ -0,0 +1,23 @@
+/* $Id: upnpdev.c,v 1.1 2015/08/28 12:14:19 nanard Exp $ */
+/* Project : miniupnp
+ * Web : http://miniupnp.free.fr/
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2015 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENSE file. */
+#include <stdlib.h>
+#include "upnpdev.h"
+
+/* freeUPNPDevlist() should be used to
+ * free the chained list returned by upnpDiscover() */
+void freeUPNPDevlist(struct UPNPDev * devlist)
+{
+ struct UPNPDev * next;
+ while(devlist)
+ {
+ next = devlist->pNext;
+ free(devlist);
+ devlist = next;
+ }
+}
+
diff --git a/thirdparty/miniupnpc/upnpdev.h b/thirdparty/miniupnpc/upnpdev.h
new file mode 100644
index 0000000000..f4ae174426
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpdev.h
@@ -0,0 +1,36 @@
+/* $Id: upnpdev.h,v 1.1 2015/08/28 12:14:19 nanard Exp $ */
+/* Project : miniupnp
+ * Web : http://miniupnp.free.fr/
+ * Author : Thomas BERNARD
+ * copyright (c) 2005-2018 Thomas Bernard
+ * This software is subjet to the conditions detailed in the
+ * provided LICENSE file. */
+#ifndef UPNPDEV_H_INCLUDED
+#define UPNPDEV_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct UPNPDev {
+ struct UPNPDev * pNext;
+ char * descURL;
+ char * st;
+ char * usn;
+ unsigned int scope_id;
+ char buffer[3];
+};
+
+/* freeUPNPDevlist()
+ * free list returned by upnpDiscover() */
+MINIUPNP_LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* UPNPDEV_H_INCLUDED */
diff --git a/thirdparty/miniupnpc/upnperrors.c b/thirdparty/miniupnpc/upnperrors.c
new file mode 100644
index 0000000000..40a2e7857f
--- /dev/null
+++ b/thirdparty/miniupnpc/upnperrors.c
@@ -0,0 +1,107 @@
+/* $Id: upnperrors.c,v 1.5 2011/04/10 11:19:36 nanard Exp $ */
+/* Project : miniupnp
+ * Author : Thomas BERNARD
+ * copyright (c) 2007 Thomas Bernard
+ * All Right reserved.
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#include <string.h>
+#include "upnperrors.h"
+#include "upnpcommands.h"
+#include "miniupnpc.h"
+
+const char * strupnperror(int err)
+{
+ const char * s = NULL;
+ switch(err) {
+ case UPNPCOMMAND_SUCCESS:
+ s = "Success";
+ break;
+ case UPNPCOMMAND_UNKNOWN_ERROR:
+ s = "Miniupnpc Unknown Error";
+ break;
+ case UPNPCOMMAND_INVALID_ARGS:
+ s = "Miniupnpc Invalid Arguments";
+ break;
+ case UPNPCOMMAND_INVALID_RESPONSE:
+ s = "Miniupnpc Invalid response";
+ break;
+ case UPNPDISCOVER_SOCKET_ERROR:
+ s = "Miniupnpc Socket error";
+ break;
+ case UPNPDISCOVER_MEMORY_ERROR:
+ s = "Miniupnpc Memory allocation error";
+ break;
+ case 401:
+ s = "Invalid Action";
+ break;
+ case 402:
+ s = "Invalid Args";
+ break;
+ case 501:
+ s = "Action Failed";
+ break;
+ case 606:
+ s = "Action not authorized";
+ break;
+ case 701:
+ s = "PinholeSpaceExhausted";
+ break;
+ case 702:
+ s = "FirewallDisabled";
+ break;
+ case 703:
+ s = "InboundPinholeNotAllowed";
+ break;
+ case 704:
+ s = "NoSuchEntry";
+ break;
+ case 705:
+ s = "ProtocolNotSupported";
+ break;
+ case 706:
+ s = "InternalPortWildcardingNotAllowed";
+ break;
+ case 707:
+ s = "ProtocolWildcardingNotAllowed";
+ break;
+ case 708:
+ s = "WildcardNotPermittedInSrcIP";
+ break;
+ case 709:
+ s = "NoPacketSent";
+ break;
+ case 713:
+ s = "SpecifiedArrayIndexInvalid";
+ break;
+ case 714:
+ s = "NoSuchEntryInArray";
+ break;
+ case 715:
+ s = "WildCardNotPermittedInSrcIP";
+ break;
+ case 716:
+ s = "WildCardNotPermittedInExtPort";
+ break;
+ case 718:
+ s = "ConflictInMappingEntry";
+ break;
+ case 724:
+ s = "SamePortValuesRequired";
+ break;
+ case 725:
+ s = "OnlyPermanentLeasesSupported";
+ break;
+ case 726:
+ s = "RemoteHostOnlySupportsWildcard";
+ break;
+ case 727:
+ s = "ExternalPortOnlySupportsWildcard";
+ break;
+ default:
+ s = "UnknownError";
+ break;
+ }
+ return s;
+}
diff --git a/thirdparty/miniupnpc/upnperrors.h b/thirdparty/miniupnpc/upnperrors.h
new file mode 100644
index 0000000000..8499d9a1c9
--- /dev/null
+++ b/thirdparty/miniupnpc/upnperrors.h
@@ -0,0 +1,26 @@
+/* $Id: upnperrors.h,v 1.2 2008/07/02 23:31:15 nanard Exp $ */
+/* (c) 2007-2015 Thomas Bernard
+ * All rights reserved.
+ * MiniUPnP Project.
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * This software is subjet to the conditions detailed in the
+ * provided LICENCE file. */
+#ifndef UPNPERRORS_H_INCLUDED
+#define UPNPERRORS_H_INCLUDED
+
+#include "miniupnpc_declspec.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* strupnperror()
+ * Return a string description of the UPnP error code
+ * or NULL for undefinded errors */
+MINIUPNP_LIBSPEC const char * strupnperror(int err);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/miniupnpc/upnpreplyparse.c b/thirdparty/miniupnpc/upnpreplyparse.c
new file mode 100644
index 0000000000..68a47c0278
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpreplyparse.c
@@ -0,0 +1,196 @@
+/* $Id: upnpreplyparse.c,v 1.19 2015/07/15 10:29:11 nanard Exp $ */
+/* vim: tabstop=4 shiftwidth=4 noexpandtab
+ * MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2006-2017 Thomas Bernard
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "upnpreplyparse.h"
+#include "minixml.h"
+
+static void
+NameValueParserStartElt(void * d, const char * name, int l)
+{
+ struct NameValueParserData * data = (struct NameValueParserData *)d;
+ data->topelt = 1;
+ if(l>63)
+ l = 63;
+ memcpy(data->curelt, name, l);
+ data->curelt[l] = '\0';
+ data->cdata = NULL;
+ data->cdatalen = 0;
+}
+
+static void
+NameValueParserEndElt(void * d, const char * name, int namelen)
+{
+ struct NameValueParserData * data = (struct NameValueParserData *)d;
+ struct NameValue * nv;
+ (void)name;
+ (void)namelen;
+ if(!data->topelt)
+ return;
+ if(strcmp(data->curelt, "NewPortListing") != 0)
+ {
+ int l;
+ /* standard case. Limited to n chars strings */
+ l = data->cdatalen;
+ nv = malloc(sizeof(struct NameValue));
+ if(nv == NULL)
+ {
+ /* malloc error */
+#ifdef DEBUG
+ fprintf(stderr, "%s: error allocating memory",
+ "NameValueParserEndElt");
+#endif /* DEBUG */
+ return;
+ }
+ if(l>=(int)sizeof(nv->value))
+ l = sizeof(nv->value) - 1;
+ strncpy(nv->name, data->curelt, 64);
+ nv->name[63] = '\0';
+ if(data->cdata != NULL)
+ {
+ memcpy(nv->value, data->cdata, l);
+ nv->value[l] = '\0';
+ }
+ else
+ {
+ nv->value[0] = '\0';
+ }
+ nv->l_next = data->l_head; /* insert in list */
+ data->l_head = nv;
+ }
+ data->cdata = NULL;
+ data->cdatalen = 0;
+ data->topelt = 0;
+}
+
+static void
+NameValueParserGetData(void * d, const char * datas, int l)
+{
+ struct NameValueParserData * data = (struct NameValueParserData *)d;
+ if(strcmp(data->curelt, "NewPortListing") == 0)
+ {
+ /* specific case for NewPortListing which is a XML Document */
+ data->portListing = malloc(l + 1);
+ if(!data->portListing)
+ {
+ /* malloc error */
+#ifdef DEBUG
+ fprintf(stderr, "%s: error allocating memory",
+ "NameValueParserGetData");
+#endif /* DEBUG */
+ return;
+ }
+ memcpy(data->portListing, datas, l);
+ data->portListing[l] = '\0';
+ data->portListingLength = l;
+ }
+ else
+ {
+ /* standard case. */
+ data->cdata = datas;
+ data->cdatalen = l;
+ }
+}
+
+void
+ParseNameValue(const char * buffer, int bufsize,
+ struct NameValueParserData * data)
+{
+ struct xmlparser parser;
+ memset(data, 0, sizeof(struct NameValueParserData));
+ /* init xmlparser object */
+ parser.xmlstart = buffer;
+ parser.xmlsize = bufsize;
+ parser.data = data;
+ parser.starteltfunc = NameValueParserStartElt;
+ parser.endeltfunc = NameValueParserEndElt;
+ parser.datafunc = NameValueParserGetData;
+ parser.attfunc = 0;
+ parsexml(&parser);
+}
+
+void
+ClearNameValueList(struct NameValueParserData * pdata)
+{
+ struct NameValue * nv;
+ if(pdata->portListing)
+ {
+ free(pdata->portListing);
+ pdata->portListing = NULL;
+ pdata->portListingLength = 0;
+ }
+ while((nv = pdata->l_head) != NULL)
+ {
+ pdata->l_head = nv->l_next;
+ free(nv);
+ }
+}
+
+char *
+GetValueFromNameValueList(struct NameValueParserData * pdata,
+ const char * Name)
+{
+ struct NameValue * nv;
+ char * p = NULL;
+ for(nv = pdata->l_head;
+ (nv != NULL) && (p == NULL);
+ nv = nv->l_next)
+ {
+ if(strcmp(nv->name, Name) == 0)
+ p = nv->value;
+ }
+ return p;
+}
+
+#if 0
+/* useless now that minixml ignores namespaces by itself */
+char *
+GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
+ const char * Name)
+{
+ struct NameValue * nv;
+ char * p = NULL;
+ char * pname;
+ for(nv = pdata->head.lh_first;
+ (nv != NULL) && (p == NULL);
+ nv = nv->entries.le_next)
+ {
+ pname = strrchr(nv->name, ':');
+ if(pname)
+ pname++;
+ else
+ pname = nv->name;
+ if(strcmp(pname, Name)==0)
+ p = nv->value;
+ }
+ return p;
+}
+#endif
+
+/* debug all-in-one function
+ * do parsing then display to stdout */
+#ifdef DEBUG
+void
+DisplayNameValueList(char * buffer, int bufsize)
+{
+ struct NameValueParserData pdata;
+ struct NameValue * nv;
+ ParseNameValue(buffer, bufsize, &pdata);
+ for(nv = pdata.l_head;
+ nv != NULL;
+ nv = nv->l_next)
+ {
+ printf("%s = %s\n", nv->name, nv->value);
+ }
+ ClearNameValueList(&pdata);
+}
+#endif /* DEBUG */
+
diff --git a/thirdparty/miniupnpc/upnpreplyparse.h b/thirdparty/miniupnpc/upnpreplyparse.h
new file mode 100644
index 0000000000..6badd15b26
--- /dev/null
+++ b/thirdparty/miniupnpc/upnpreplyparse.h
@@ -0,0 +1,63 @@
+/* $Id: upnpreplyparse.h,v 1.19 2014/10/27 16:33:19 nanard Exp $ */
+/* MiniUPnP project
+ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
+ * (c) 2006-2013 Thomas Bernard
+ * This software is subject to the conditions detailed
+ * in the LICENCE file provided within the distribution */
+
+#ifndef UPNPREPLYPARSE_H_INCLUDED
+#define UPNPREPLYPARSE_H_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct NameValue {
+ struct NameValue * l_next;
+ char name[64];
+ char value[128];
+};
+
+struct NameValueParserData {
+ struct NameValue * l_head;
+ char curelt[64];
+ char * portListing;
+ int portListingLength;
+ int topelt;
+ const char * cdata;
+ int cdatalen;
+};
+
+/* ParseNameValue() */
+void
+ParseNameValue(const char * buffer, int bufsize,
+ struct NameValueParserData * data);
+
+/* ClearNameValueList() */
+void
+ClearNameValueList(struct NameValueParserData * pdata);
+
+/* GetValueFromNameValueList() */
+char *
+GetValueFromNameValueList(struct NameValueParserData * pdata,
+ const char * Name);
+
+#if 0
+/* GetValueFromNameValueListIgnoreNS() */
+char *
+GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata,
+ const char * Name);
+#endif
+
+/* DisplayNameValueList() */
+#ifdef DEBUG
+void
+DisplayNameValueList(char * buffer, int bufsize);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/thirdparty/minizip/crypt.h b/thirdparty/minizip/crypt.h
index a01d08d932..1e9e8200b2 100644
--- a/thirdparty/minizip/crypt.h
+++ b/thirdparty/minizip/crypt.h
@@ -32,7 +32,7 @@
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
-static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
+static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
@@ -45,7 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
/***********************************************************************
* Update the encryption keys with the next byte of plain text
*/
-static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
+static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
{
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
@@ -62,7 +62,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int
* Initialize the encryption keys and the random header according to
* the given password.
*/
-static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
+static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
{
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
@@ -91,7 +91,7 @@ static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
- const unsigned long* pcrc_32_tab,
+ const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
diff --git a/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch b/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch
index 8e66416a43..2162bafbbc 100644
--- a/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch
+++ b/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch
@@ -96,8 +96,8 @@ index 7617f41f1..32e27bd65 100644
+/* GODOT end */
+
/*
- Close a ZipFile opened with unzipOpen.
- If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
+ Close a ZipFile opened with unzOpen.
+ If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
@@ -1018,10 +1034,20 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
@@ -237,7 +237,7 @@ index 3183968b7..54e65ad8a 100644
--- a/thirdparty/minizip/unzip.h
+++ b/thirdparty/minizip/unzip.h
@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose OF((unzFile file));
- these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
+/* GODOT start */
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
index 2b42df4abd..9cb27c16db 100644
--- a/thirdparty/minizip/ioapi.c
+++ b/thirdparty/minizip/ioapi.c
@@ -10,10 +10,22 @@
*/
-#if (defined(_WIN32))
+#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
#define _CRT_SECURE_NO_WARNINGS
#endif
+#if defined(__APPLE__) || defined(IOAPI_NO_64)
+// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
+#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
+#define FTELLO_FUNC(stream) ftello(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
+#else
+#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
+#define FTELLO_FUNC(stream) ftello64(stream)
+#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
+#endif
+
+
#include "ioapi.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
@@ -47,7 +59,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
else
{
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
- if ((tell_uLong) == ((uLong)-1))
+ if ((tell_uLong) == MAXU32)
return (ZPOS64_T)-1;
else
return tell_uLong;
@@ -119,7 +131,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL))
- file = fopen64((const char*)filename, mode_fopen);
+ file = FOPEN_FUNC((const char*)filename, mode_fopen);
return file;
}
@@ -149,7 +161,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
ZPOS64_T ret;
- ret = ftello64((FILE *)stream);
+ ret = FTELLO_FUNC((FILE *)stream);
return ret;
}
@@ -195,7 +207,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
ret = 0;
- if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
+ if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
ret = -1;
return ret;
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
index 6043d34cea..4011e9cabb 100644
--- a/thirdparty/minizip/ioapi.h
+++ b/thirdparty/minizip/ioapi.h
@@ -21,7 +21,7 @@
#ifndef _ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H
-#if (!defined(_WIN32)) && (!defined(WIN32))
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
// Linux needs this to support file operation on files larger then 4+GB
// But might need better if/def to select just the platforms that needs them.
@@ -38,6 +38,7 @@
#ifndef _FILE_OFFSET_BIT
#define _FILE_OFFSET_BIT 64
#endif
+
#endif
#include <stdio.h>
@@ -65,6 +66,11 @@
#define ftello64 ftell
#define fseeko64 fseek
#else
+#ifdef __FreeBSD__
+#define fopen64 fopen
+#define ftello64 ftello
+#define fseeko64 fseeko
+#endif
#ifdef _MSC_VER
#define fopen64 fopen
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
@@ -101,6 +107,8 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
typedef uint64_t ZPOS64_T;
#else
+/* Maximum unsigned 32-bit value used as placeholder for zip64 */
+#define MAXU32 0xffffffff
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
index 32e27bd657..31f8a5ff47 100644
--- a/thirdparty/minizip/unzip.c
+++ b/thirdparty/minizip/unzip.c
@@ -191,7 +191,7 @@ typedef struct
# ifndef NOUNCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
- const unsigned long* pcrc_32_tab;
+ const z_crc_t* pcrc_32_tab;
# endif
} unz64_s;
@@ -203,7 +203,7 @@ typedef struct
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
+ IN assertion: the stream s has been successfully opened for reading.
*/
@@ -817,9 +817,9 @@ extern void* unzGetOpaque(unzFile file) {
/* GODOT end */
/*
- Close a ZipFile opened with unzipOpen.
- If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
- these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ Close a ZipFile opened with unzOpen.
+ If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+ these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzClose (unzFile file)
{
@@ -1066,26 +1066,26 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
{
uLong uL;
- if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
+ if(file_info.uncompressed_size == MAXU32)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
- if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
+ if(file_info.compressed_size == MAXU32)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
- if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
+ if(file_info_internal.offset_curfile == MAXU32)
{
/* Relative Header offset */
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
err=UNZ_ERRNO;
}
- if(file_info.disk_num_start == (unsigned long)-1)
+ if(file_info.disk_num_start == MAXU32)
{
/* Disk Start Number */
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
@@ -1171,7 +1171,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
szFileName,fileNameBufferSize,
extraField,extraFieldBufferSize,
szComment,commentBufferSize);
- if (err==UNZ_OK)
+ if ((err==UNZ_OK) && (pfile_info != NULL))
{
pfile_info->version = file_info64.version;
pfile_info->version_needed = file_info64.version_needed;
@@ -1249,7 +1249,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file)
/*
Try locate the file szFileName in the zipfile.
- For the iCaseSensitivity signification, see unzipStringFileNameCompare
+ For the iCaseSensitivity signification, see unzStringFileNameCompare
return value :
UNZ_OK if the file is found. It becomes the current file.
@@ -1806,7 +1806,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
return UNZ_PARAMERROR;
- if ((pfile_in_zip_read_info->read_buffer == NULL))
+ if (pfile_in_zip_read_info->read_buffer == NULL)
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;
@@ -2108,7 +2108,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
}
/*
- Close the file in zip opened with unzipOpenCurrentFile
+ Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzCloseCurrentFile (unzFile file)
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
index 54e65ad8ab..bab1cb939f 100644
--- a/thirdparty/minizip/unzip.h
+++ b/thirdparty/minizip/unzip.h
@@ -197,9 +197,9 @@ extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
extern int ZEXPORT unzClose OF((unzFile file));
/*
- Close a ZipFile opened with unzipOpen.
+ Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
- these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
/* GODOT start */
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
index d7093e7457..2936e2b5d9 100644
--- a/thirdparty/minizip/zip.c
+++ b/thirdparty/minizip/zip.c
@@ -15,7 +15,7 @@
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
It is used when recreting zip archive with RAW when deleting items from a zip.
- ZIP64 data is automaticly added to items that needs it, and existing ZIP64 data need to be removed.
+ ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
@@ -116,7 +116,7 @@ typedef struct linkedlist_datablock_internal_s
struct linkedlist_datablock_internal_s* next_datablock;
uLong avail_in_this_block;
uLong filled_in_this_block;
- uLong unused; /* for future use and alignement */
+ uLong unused; /* for future use and alignment */
unsigned char data[SIZEDATA_INDATABLOCK];
} linkedlist_datablock_internal;
@@ -157,7 +157,7 @@ typedef struct
ZPOS64_T totalUncompressedData;
#ifndef NOCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
- const unsigned long* pcrc_32_tab;
+ const z_crc_t* pcrc_32_tab;
int crypt_header_size;
#endif
} curfile64_info;
@@ -171,7 +171,7 @@ typedef struct
curfile64_info ci; /* info on the file curretly writing */
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
- ZPOS64_T add_position_when_writting_offset;
+ ZPOS64_T add_position_when_writing_offset;
ZPOS64_T number_entry;
#ifndef NO_ADDFILEINEXISTINGZIP
@@ -807,7 +807,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit)
}
byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir);
- pziinit->add_position_when_writting_offset = byte_before_the_zipfile;
+ pziinit->add_position_when_writing_offset = byte_before_the_zipfile;
{
ZPOS64_T size_central_dir_to_read = size_central_dir;
@@ -877,7 +877,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
ziinit.in_opened_file_inzip = 0;
ziinit.ci.stream_initialised = 0;
ziinit.number_entry = 0;
- ziinit.add_position_when_writting_offset = 0;
+ ziinit.add_position_when_writing_offset = 0;
init_linkedlist(&(ziinit.central_dir));
@@ -1069,6 +1069,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
int err = ZIP_OK;
# ifdef NOCRYPT
+ (crcForCrypting);
if (password != NULL)
return ZIP_PARAMERROR;
# endif
@@ -1116,9 +1117,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
zi->ci.flag = flagBase;
if ((level==8) || (level==9))
zi->ci.flag |= 2;
- if ((level==2))
+ if (level==2)
zi->ci.flag |= 4;
- if ((level==1))
+ if (level==1)
zi->ci.flag |= 6;
if (password != NULL)
zi->ci.flag |= 1;
@@ -1165,7 +1166,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
if(zi->ci.pos_local_header >= 0xffffffff)
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4);
else
- zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writting_offset,4);
+ zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writing_offset,4);
for (i=0;i<size_filename;i++)
*(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
@@ -1714,7 +1715,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
if (err==ZIP_OK)
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */
- if(uncompressed_size >= 0xffffffff)
+ if(uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff )
{
if(zi->ci.pos_zip64extrainfo > 0)
{
@@ -1728,6 +1729,8 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
if (err==ZIP_OK) /* uncompressed size, unknown */
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, compressed_size, 8);
}
+ else
+ err = ZIP_BADZIPFILE; // Caller passed zip64 = 0, so no room for zip64 info -> fatal
}
else
{
@@ -1756,7 +1759,7 @@ extern int ZEXPORT zipCloseFileInZip (zipFile file)
int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
int err = ZIP_OK;
- ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
+ ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
@@ -1809,7 +1812,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
{
- ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
+ ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
}
return err;
@@ -1850,13 +1853,13 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
{
- ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
+ ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
if(pos >= 0xffffffff)
{
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4);
}
else
- err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
+ err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4);
}
return err;
@@ -1922,8 +1925,8 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
}
free_linkedlist(&(zi->central_dir));
- pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
- if(pos >= 0xffffffff)
+ pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
+ if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
{
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip);
diff --git a/thirdparty/misc/stb_truetype.h b/thirdparty/misc/stb_truetype.h
index cec2425471..e2efae2285 100644
--- a/thirdparty/misc/stb_truetype.h
+++ b/thirdparty/misc/stb_truetype.h
@@ -1,4 +1,4 @@
-// stb_truetype.h - v1.17 - public domain
+// stb_truetype.h - v1.19 - public domain
// authored from 2009-2016 by Sean Barrett / RAD Game Tools
//
// This library processes TrueType files:
@@ -22,41 +22,35 @@
// Mikko Mononen: compound shape support, more cmap formats
// Tor Andersson: kerning, subpixel rendering
// Dougall Johnson: OpenType / Type 2 font handling
+// Daniel Ribeiro Maciel: basic GPOS-based kerning
//
// Misc other:
// Ryan Gordon
// Simon Glass
// github:IntellectualKitty
// Imanol Celaya
+// Daniel Ribeiro Maciel
//
// Bug/warning reports/fixes:
-// "Zer" on mollyrocket
-// Cass Everitt
-// stoiko (Haemimont Games)
-// Brian Hook
-// Walter van Niftrik
-// David Gow
-// David Given
-// Ivan-Assen Ivanov
-// Anthony Pesch
-// Johan Duparc
-// Hou Qiming
-// Fabian "ryg" Giesen
-// Martins Mozeiko
-// Cap Petschulat
-// Omar Cornut
-// github:aloucks
-// Peter LaValle
-// Sergey Popov
-// Giumo X. Clanjor
-// Higor Euripedes
-// Thomas Fields
-// Derek Vinyard
-// Cort Stratton
-// github:oyvindjam
+// "Zer" on mollyrocket Fabian "ryg" Giesen
+// Cass Everitt Martins Mozeiko
+// stoiko (Haemimont Games) Cap Petschulat
+// Brian Hook Omar Cornut
+// Walter van Niftrik github:aloucks
+// David Gow Peter LaValle
+// David Given Sergey Popov
+// Ivan-Assen Ivanov Giumo X. Clanjor
+// Anthony Pesch Higor Euripedes
+// Johan Duparc Thomas Fields
+// Hou Qiming Derek Vinyard
+// Rob Loach Cort Stratton
+// Kenney Phillis Jr. github:oyvindjam
+// Brian Costabile github:vassvik
//
// VERSION HISTORY
//
+// 1.19 (2018-02-11) GPOS kerning, STBTT_fmod
+// 1.18 (2018-01-29) add missing function
// 1.17 (2017-07-23) make more arguments const; doc fix
// 1.16 (2017-07-12) SDF support
// 1.15 (2017-03-03) make more arguments const
@@ -171,7 +165,7 @@
// measurement for describing font size, defined as 72 points per inch.
// stb_truetype provides a point API for compatibility. However, true
// "per inch" conventions don't make much sense on computer displays
-// since they different monitors have different number of pixels per
+// since different monitors have different number of pixels per
// inch. For example, Windows traditionally uses a convention that
// there are 96 pixels per inch, thus making 'inch' measurements have
// nothing to do with inches, and thus effectively defining a point to
@@ -181,6 +175,39 @@
// for non-commercial fonts, thus making fonts scaled in points
// according to the TrueType spec incoherently sized in practice.
//
+// DETAILED USAGE:
+//
+// Scale:
+// Select how high you want the font to be, in points or pixels.
+// Call ScaleForPixelHeight or ScaleForMappingEmToPixels to compute
+// a scale factor SF that will be used by all other functions.
+//
+// Baseline:
+// You need to select a y-coordinate that is the baseline of where
+// your text will appear. Call GetFontBoundingBox to get the baseline-relative
+// bounding box for all characters. SF*-y0 will be the distance in pixels
+// that the worst-case character could extend above the baseline, so if
+// you want the top edge of characters to appear at the top of the
+// screen where y=0, then you would set the baseline to SF*-y0.
+//
+// Current point:
+// Set the current point where the first character will appear. The
+// first character could extend left of the current point; this is font
+// dependent. You can either choose a current point that is the leftmost
+// point and hope, or add some padding, or check the bounding box or
+// left-side-bearing of the first character to be displayed and set
+// the current point based on that.
+//
+// Displaying a character:
+// Compute the bounding box of the character. It will contain signed values
+// relative to <current_point, baseline>. I.e. if it returns x0,y0,x1,y1,
+// then the character should be displayed in the rectangle from
+// <current_point+SF*x0, baseline+SF*y0> to <current_point+SF*x1,baseline+SF*y1).
+//
+// Advancing for the next character:
+// Call GlyphHMetrics, and compute 'current_point += SF * advance'.
+//
+//
// ADVANCED USAGE
//
// Quality:
@@ -224,7 +251,7 @@
// Curve tesselation 120 LOC \__ 550 LOC Bitmap creation
// Bitmap management 100 LOC /
// Baked bitmap interface 70 LOC /
-// Font name matching & access 150 LOC ---- 150
+// Font name matching & access 150 LOC ---- 150
// C runtime library abstraction 60 LOC ---- 60
//
//
@@ -317,7 +344,7 @@ int main(int argc, char **argv)
}
return 0;
}
-#endif
+#endif
//
// Output:
//
@@ -331,9 +358,9 @@ int main(int argc, char **argv)
// :@@. M@M
// @@@o@@@@
// :M@@V:@@.
-//
+//
//////////////////////////////////////////////////////////////////////////////
-//
+//
// Complete program: print "Hello World!" banner, with bugs
//
#if 0
@@ -387,7 +414,8 @@ int main(int arg, char **argv)
//// INTEGRATION WITH YOUR CODEBASE
////
//// The following sections allow you to supply alternate definitions
-//// of C library functions used by stb_truetype.
+//// of C library functions used by stb_truetype, e.g. if you don't
+//// link with the C runtime library.
#ifdef STB_TRUETYPE_IMPLEMENTATION
// #define your own (u)stbtt_int8/16/32 before including to override this
@@ -403,7 +431,7 @@ int main(int arg, char **argv)
typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1];
typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1];
- // #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h
+ // e.g. #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h
#ifndef STBTT_ifloor
#include <math.h>
#define STBTT_ifloor(x) ((int) floor(x))
@@ -416,15 +444,15 @@ int main(int arg, char **argv)
#define STBTT_pow(x,y) pow(x,y)
#endif
- #ifndef STBTT_cos
+ #ifndef STBTT_fmod
#include <math.h>
- #define STBTT_cos(x) cos(x)
- #define STBTT_acos(x) acos(x)
+ #define STBTT_fmod(x,y) fmod(x,y)
#endif
- #ifndef STBTT_fabs
+ #ifndef STBTT_cos
#include <math.h>
- #define STBTT_fabs(x) fabs(x)
+ #define STBTT_cos(x) cos(x)
+ #define STBTT_acos(x) acos(x)
#endif
#ifndef STBTT_fabs
@@ -625,7 +653,7 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, cons
// Calling these functions in sequence is roughly equivalent to calling
// stbtt_PackFontRanges(). If you more control over the packing of multiple
// fonts, or if you want to pack custom data into a font texture, take a look
-// at the source to of stbtt_PackFontRanges() and create a custom version
+// at the source to of stbtt_PackFontRanges() and create a custom version
// using these functions, e.g. call GatherRects multiple times,
// building up a single array of rects, then call PackRects once,
// then call RenderIntoRects repeatedly. This may result in a
@@ -676,7 +704,7 @@ struct stbtt_fontinfo
int numGlyphs; // number of glyphs, needed for range checking
- int loca,head,glyf,hhea,hmtx,kern; // table locations as offset from start of .ttf
+ int loca,head,glyf,hhea,hmtx,kern,gpos; // table locations as offset from start of .ttf
int index_map; // a cmap mapping for our chosen character encoding
int indexToLocFormat; // format needed to map from glyph index to glyph
@@ -931,7 +959,7 @@ STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, floa
// and computing from that can allow drop-out prevention).
//
// The algorithm has not been optimized at all, so expect it to be slow
-// if computing lots of characters or very large sizes.
+// if computing lots of characters or very large sizes.
@@ -1319,6 +1347,7 @@ static int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, in
info->hhea = stbtt__find_table(data, fontstart, "hhea"); // required
info->hmtx = stbtt__find_table(data, fontstart, "hmtx"); // required
info->kern = stbtt__find_table(data, fontstart, "kern"); // not required
+ info->gpos = stbtt__find_table(data, fontstart, "GPOS"); // not required
if (!cmap || !info->head || !info->hhea || !info->hmtx)
return 0;
@@ -1687,7 +1716,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s
if (i != 0)
num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy);
- // now start the new one
+ // now start the new one
start_off = !(flags & 1);
if (start_off) {
// if we start off with an off-curve point, then when we need to find a point on the curve
@@ -1740,7 +1769,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s
int comp_num_verts = 0, i;
stbtt_vertex *comp_verts = 0, *tmp = 0;
float mtx[6] = {1,0,0,1,0,0}, m, n;
-
+
flags = ttSHORT(comp); comp+=2;
gidx = ttSHORT(comp); comp+=2;
@@ -1770,7 +1799,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s
mtx[2] = ttSHORT(comp)/16384.0f; comp+=2;
mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;
}
-
+
// Find transformation scales.
m = (float) STBTT_sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]);
n = (float) STBTT_sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]);
@@ -2172,7 +2201,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st
// push immediate
if (b0 == 255) {
- f = (float)stbtt__buf_get32(&b) / 0x10000;
+ f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000;
} else {
stbtt__buf_skip(&b, -1);
f = (float)(stbtt_int16)stbtt__cff_int(&b);
@@ -2210,12 +2239,10 @@ static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, in
{
stbtt__csctx c = STBTT__CSCTX_INIT(1);
int r = stbtt__run_charstring(info, glyph_index, &c);
- if (x0) {
- *x0 = r ? c.min_x : 0;
- *y0 = r ? c.min_y : 0;
- *x1 = r ? c.max_x : 0;
- *y1 = r ? c.max_y : 0;
- }
+ if (x0) *x0 = r ? c.min_x : 0;
+ if (y0) *y0 = r ? c.min_y : 0;
+ if (x1) *x1 = r ? c.max_x : 0;
+ if (y1) *y1 = r ? c.max_y : 0;
return r ? c.num_vertices : 0;
}
@@ -2239,7 +2266,7 @@ STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_inde
}
}
-STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2)
+static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2)
{
stbtt_uint8 *data = info->data + info->kern;
stbtt_uint32 needle, straw;
@@ -2269,9 +2296,260 @@ STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1,
return 0;
}
+static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph)
+{
+ stbtt_uint16 coverageFormat = ttUSHORT(coverageTable);
+ switch(coverageFormat) {
+ case 1: {
+ stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2);
+
+ // Binary search.
+ stbtt_int32 l=0, r=glyphCount-1, m;
+ int straw, needle=glyph;
+ while (l <= r) {
+ stbtt_uint8 *glyphArray = coverageTable + 4;
+ stbtt_uint16 glyphID;
+ m = (l + r) >> 1;
+ glyphID = ttUSHORT(glyphArray + 2 * m);
+ straw = glyphID;
+ if (needle < straw)
+ r = m - 1;
+ else if (needle > straw)
+ l = m + 1;
+ else {
+ return m;
+ }
+ }
+ } break;
+
+ case 2: {
+ stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2);
+ stbtt_uint8 *rangeArray = coverageTable + 4;
+
+ // Binary search.
+ stbtt_int32 l=0, r=rangeCount-1, m;
+ int strawStart, strawEnd, needle=glyph;
+ while (l <= r) {
+ stbtt_uint8 *rangeRecord;
+ m = (l + r) >> 1;
+ rangeRecord = rangeArray + 6 * m;
+ strawStart = ttUSHORT(rangeRecord);
+ strawEnd = ttUSHORT(rangeRecord + 2);
+ if (needle < strawStart)
+ r = m - 1;
+ else if (needle > strawEnd)
+ l = m + 1;
+ else {
+ stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4);
+ return startCoverageIndex + glyph - strawStart;
+ }
+ }
+ } break;
+
+ default: {
+ // There are no other cases.
+ STBTT_assert(0);
+ } break;
+ }
+
+ return -1;
+}
+
+static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)
+{
+ stbtt_uint16 classDefFormat = ttUSHORT(classDefTable);
+ switch(classDefFormat)
+ {
+ case 1: {
+ stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2);
+ stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4);
+ stbtt_uint8 *classDef1ValueArray = classDefTable + 6;
+
+ if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount)
+ return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID));
+
+ classDefTable = classDef1ValueArray + 2 * glyphCount;
+ } break;
+
+ case 2: {
+ stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2);
+ stbtt_uint8 *classRangeRecords = classDefTable + 4;
+
+ // Binary search.
+ stbtt_int32 l=0, r=classRangeCount-1, m;
+ int strawStart, strawEnd, needle=glyph;
+ while (l <= r) {
+ stbtt_uint8 *classRangeRecord;
+ m = (l + r) >> 1;
+ classRangeRecord = classRangeRecords + 6 * m;
+ strawStart = ttUSHORT(classRangeRecord);
+ strawEnd = ttUSHORT(classRangeRecord + 2);
+ if (needle < strawStart)
+ r = m - 1;
+ else if (needle > strawEnd)
+ l = m + 1;
+ else
+ return (stbtt_int32)ttUSHORT(classRangeRecord + 4);
+ }
+
+ classDefTable = classRangeRecords + 6 * classRangeCount;
+ } break;
+
+ default: {
+ // There are no other cases.
+ STBTT_assert(0);
+ } break;
+ }
+
+ return -1;
+}
+
+// Define to STBTT_assert(x) if you want to break on unimplemented formats.
+#define STBTT_GPOS_TODO_assert(x)
+
+static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2)
+{
+ stbtt_uint16 lookupListOffset;
+ stbtt_uint8 *lookupList;
+ stbtt_uint16 lookupCount;
+ stbtt_uint8 *data;
+ stbtt_int32 i;
+
+ if (!info->gpos) return 0;
+
+ data = info->data + info->gpos;
+
+ if (ttUSHORT(data+0) != 1) return 0; // Major version 1
+ if (ttUSHORT(data+2) != 0) return 0; // Minor version 0
+
+ lookupListOffset = ttUSHORT(data+8);
+ lookupList = data + lookupListOffset;
+ lookupCount = ttUSHORT(lookupList);
+
+ for (i=0; i<lookupCount; ++i) {
+ stbtt_uint16 lookupOffset = ttUSHORT(lookupList + 2 + 2 * i);
+ stbtt_uint8 *lookupTable = lookupList + lookupOffset;
+
+ stbtt_uint16 lookupType = ttUSHORT(lookupTable);
+ stbtt_uint16 subTableCount = ttUSHORT(lookupTable + 4);
+ stbtt_uint8 *subTableOffsets = lookupTable + 6;
+ switch(lookupType) {
+ case 2: { // Pair Adjustment Positioning Subtable
+ stbtt_int32 sti;
+ for (sti=0; sti<subTableCount; sti++) {
+ stbtt_uint16 subtableOffset = ttUSHORT(subTableOffsets + 2 * sti);
+ stbtt_uint8 *table = lookupTable + subtableOffset;
+ stbtt_uint16 posFormat = ttUSHORT(table);
+ stbtt_uint16 coverageOffset = ttUSHORT(table + 2);
+ stbtt_int32 coverageIndex = stbtt__GetCoverageIndex(table + coverageOffset, glyph1);
+ if (coverageIndex == -1) continue;
+
+ switch (posFormat) {
+ case 1: {
+ stbtt_int32 l, r, m;
+ int straw, needle;
+ stbtt_uint16 valueFormat1 = ttUSHORT(table + 4);
+ stbtt_uint16 valueFormat2 = ttUSHORT(table + 6);
+ stbtt_int32 valueRecordPairSizeInBytes = 2;
+ stbtt_uint16 pairSetCount = ttUSHORT(table + 8);
+ stbtt_uint16 pairPosOffset = ttUSHORT(table + 10 + 2 * coverageIndex);
+ stbtt_uint8 *pairValueTable = table + pairPosOffset;
+ stbtt_uint16 pairValueCount = ttUSHORT(pairValueTable);
+ stbtt_uint8 *pairValueArray = pairValueTable + 2;
+ // TODO: Support more formats.
+ STBTT_GPOS_TODO_assert(valueFormat1 == 4);
+ if (valueFormat1 != 4) return 0;
+ STBTT_GPOS_TODO_assert(valueFormat2 == 0);
+ if (valueFormat2 != 0) return 0;
+
+ STBTT_assert(coverageIndex < pairSetCount);
+
+ needle=glyph2;
+ r=pairValueCount-1;
+ l=0;
+
+ // Binary search.
+ while (l <= r) {
+ stbtt_uint16 secondGlyph;
+ stbtt_uint8 *pairValue;
+ m = (l + r) >> 1;
+ pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m;
+ secondGlyph = ttUSHORT(pairValue);
+ straw = secondGlyph;
+ if (needle < straw)
+ r = m - 1;
+ else if (needle > straw)
+ l = m + 1;
+ else {
+ stbtt_int16 xAdvance = ttSHORT(pairValue + 2);
+ return xAdvance;
+ }
+ }
+ } break;
+
+ case 2: {
+ stbtt_uint16 valueFormat1 = ttUSHORT(table + 4);
+ stbtt_uint16 valueFormat2 = ttUSHORT(table + 6);
+
+ stbtt_uint16 classDef1Offset = ttUSHORT(table + 8);
+ stbtt_uint16 classDef2Offset = ttUSHORT(table + 10);
+ int glyph1class = stbtt__GetGlyphClass(table + classDef1Offset, glyph1);
+ int glyph2class = stbtt__GetGlyphClass(table + classDef2Offset, glyph2);
+
+ stbtt_uint16 class1Count = ttUSHORT(table + 12);
+ stbtt_uint16 class2Count = ttUSHORT(table + 14);
+ STBTT_assert(glyph1class < class1Count);
+ STBTT_assert(glyph2class < class2Count);
+
+ // TODO: Support more formats.
+ STBTT_GPOS_TODO_assert(valueFormat1 == 4);
+ if (valueFormat1 != 4) return 0;
+ STBTT_GPOS_TODO_assert(valueFormat2 == 0);
+ if (valueFormat2 != 0) return 0;
+
+ if (glyph1class >= 0 && glyph1class < class1Count && glyph2class >= 0 && glyph2class < class2Count) {
+ stbtt_uint8 *class1Records = table + 16;
+ stbtt_uint8 *class2Records = class1Records + 2 * (glyph1class * class2Count);
+ stbtt_int16 xAdvance = ttSHORT(class2Records + 2 * glyph2class);
+ return xAdvance;
+ }
+ } break;
+
+ default: {
+ // There are no other cases.
+ STBTT_assert(0);
+ break;
+ };
+ }
+ }
+ break;
+ };
+
+ default:
+ // TODO: Implement other stuff.
+ break;
+ }
+ }
+
+ return 0;
+}
+
+STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int g2)
+{
+ int xAdvance = 0;
+
+ if (info->gpos)
+ xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2);
+
+ if (info->kern)
+ xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2);
+
+ return xAdvance;
+}
+
STBTT_DEF int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2)
{
- if (!info->kern) // if no kerning table, don't waste time looking up both codepoint->glyphs
+ if (!info->kern && !info->gpos) // if no kerning table, don't waste time looking up both codepoint->glyphs
return 0;
return stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info,ch1), stbtt_FindGlyphIndex(info,ch2));
}
@@ -2395,7 +2673,7 @@ static void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata)
hh->num_remaining_in_head_chunk = count;
}
--hh->num_remaining_in_head_chunk;
- return (char *) (hh->head) + size * hh->num_remaining_in_head_chunk;
+ return (char *) (hh->head) + sizeof(stbtt__hheap_chunk) + size * hh->num_remaining_in_head_chunk;
}
}
@@ -2449,7 +2727,7 @@ static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, i
float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
STBTT_assert(z != NULL);
if (!z) return z;
-
+
// round dx down to avoid overshooting
if (dxdy < 0)
z->dx = -STBTT_ifloor(STBTT_FIX * -dxdy);
@@ -2527,7 +2805,7 @@ static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__ac
}
}
}
-
+
e = e->next;
}
}
@@ -3229,8 +3507,9 @@ error:
STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata)
{
- float scale = scale_x > scale_y ? scale_y : scale_x;
- int winding_count, *winding_lengths;
+ float scale = scale_x > scale_y ? scale_y : scale_x;
+ int winding_count = 0;
+ int *winding_lengths = NULL;
stbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata);
if (windings) {
stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, invert, userdata);
@@ -3248,7 +3527,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
{
int ix0,iy0,ix1,iy1;
stbtt__bitmap gbm;
- stbtt_vertex *vertices;
+ stbtt_vertex *vertices;
int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);
if (scale_x == 0) scale_x = scale_y;
@@ -3271,7 +3550,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
if (height) *height = gbm.h;
if (xoff ) *xoff = ix0;
if (yoff ) *yoff = iy0;
-
+
if (gbm.w && gbm.h) {
gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata);
if (gbm.pixels) {
@@ -3282,7 +3561,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
}
STBTT_free(vertices, info->userdata);
return gbm.pixels;
-}
+}
STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff)
{
@@ -3294,7 +3573,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigne
int ix0,iy0;
stbtt_vertex *vertices;
int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);
- stbtt__bitmap gbm;
+ stbtt__bitmap gbm;
stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0);
gbm.pixels = output;
@@ -3316,7 +3595,12 @@ STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *
STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff)
{
return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff);
-}
+}
+
+STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint)
+{
+ stbtt_MakeGlyphBitmapSubpixelPrefilter(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, oversample_x, oversample_y, sub_x, sub_y, stbtt_FindGlyphIndex(info,codepoint));
+}
STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint)
{
@@ -3326,7 +3610,7 @@ STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, uns
STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff)
{
return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff);
-}
+}
STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)
{
@@ -3451,7 +3735,7 @@ static void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_node *no
con->y = 0;
con->bottom_y = 0;
STBTT__NOTUSED(nodes);
- STBTT__NOTUSED(num_nodes);
+ STBTT__NOTUSED(num_nodes);
}
static void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects)
@@ -3826,7 +4110,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char
n = 0;
for (i=0; i < num_ranges; ++i)
n += ranges[i].num_chars;
-
+
rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context);
if (rects == NULL)
return 0;
@@ -3837,7 +4121,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char
n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects);
stbtt_PackFontRangesPackRects(spc, rects, n);
-
+
return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects);
STBTT_free(rects, spc->user_allocator_context);
@@ -3909,7 +4193,7 @@ static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2],
float discr = b*b - a*c;
if (discr > 0.0) {
float rcpna = -1 / a;
- float d = (float) sqrt(discr);
+ float d = (float) STBTT_sqrt(discr);
s0 = (b+d) * rcpna;
s1 = (b-d) * rcpna;
if (s0 >= 0.0 && s0 <= 1.0)
@@ -3971,7 +4255,7 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex
orig[1] = y;
// make sure y never passes through a vertex of the shape
- y_frac = (float) fmod(y, 1.0f);
+ y_frac = (float) STBTT_fmod(y, 1.0f);
if (y_frac < 0.01f)
y += 0.01f;
else if (y_frac > 0.99f)
@@ -3985,7 +4269,7 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex
int x1 = (int) verts[i ].x, y1 = (int) verts[i ].y;
if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) {
float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0;
- if (x_inter < x)
+ if (x_inter < x)
winding += (y0 < y1) ? 1 : -1;
}
}
@@ -4011,7 +4295,7 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex
y1 = (int)verts[i ].y;
if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) {
float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0;
- if (x_inter < x)
+ if (x_inter < x)
winding += (y0 < y1) ? 1 : -1;
}
} else {
@@ -4023,7 +4307,7 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex
if (hits[1][0] < 0)
winding += (hits[1][1] < 0 ? -1 : 1);
}
- }
+ }
}
}
return winding;
@@ -4104,7 +4388,7 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
// invert for y-downwards bitmaps
scale_y = -scale_y;
-
+
{
int x,y,i,j;
float *precompute;
@@ -4253,7 +4537,7 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
STBTT_free(verts, info->userdata);
}
return data;
-}
+}
STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff)
{
@@ -4271,7 +4555,7 @@ STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)
//
// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string
-static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2)
+static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
@@ -4310,7 +4594,7 @@ static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, s
return i;
}
-static int stbtt_CompareUTF8toUTF16_bigendian_internal(char *s1, int len1, char *s2, int len2)
+static int stbtt_CompareUTF8toUTF16_bigendian_internal(char *s1, int len1, char *s2, int len2)
{
return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8*) s1, len1, (stbtt_uint8*) s2, len2);
}
@@ -4439,7 +4723,7 @@ STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,
STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index)
{
- return stbtt_GetFontOffsetForIndex_internal((unsigned char *) data, index);
+ return stbtt_GetFontOffsetForIndex_internal((unsigned char *) data, index);
}
STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data)
@@ -4471,6 +4755,9 @@ STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const
// FULL VERSION HISTORY
//
+// 1.19 (2018-02-11) OpenType GPOS kerning (horizontal only), STBTT_fmod
+// 1.18 (2018-01-29) add missing function
+// 1.17 (2017-07-23) make more arguments const; doc fix
// 1.16 (2017-07-12) SDF support
// 1.15 (2017-03-03) make more arguments const
// 1.14 (2017-01-16) num-fonts-in-TTC function
@@ -4529,38 +4816,38 @@ This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett
-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
+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
+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
+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.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
-Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
-software, either in source code form or as a compiled binary, for any purpose,
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
+software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
-In jurisdictions that recognize copyright laws, the author or authors of this
-software dedicate any and all copyright interest in the software to the public
-domain. We make this dedication for the benefit of the public at large and to
-the detriment of our heirs and successors. We intend this dedication to be an
-overt act of relinquishment in perpetuity of all present and future rights to
+In jurisdictions that recognize copyright laws, the author or authors of this
+software dedicate any and all copyright interest in the software to the public
+domain. We make this dedication for the benefit of the public at large and to
+the detriment of our heirs and successors. We intend this dedication to be an
+overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+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.
------------------------------------------------------------------------------
*/
diff --git a/thirdparty/misc/stb_vorbis.c b/thirdparty/misc/stb_vorbis.c
index 14cebbf87e..8edcf0f38a 100644
--- a/thirdparty/misc/stb_vorbis.c
+++ b/thirdparty/misc/stb_vorbis.c
@@ -1,11 +1,11 @@
-// Ogg Vorbis audio decoder - v1.11 - public domain
+// Ogg Vorbis audio decoder - v1.14 - public domain
// http://nothings.org/stb_vorbis/
//
// Original version written by Sean Barrett in 2007.
//
-// Originally sponsored by RAD Game Tools. Seeking sponsored
-// by Phillip Bennefall, Marc Andersen, Aaron Baker, Elias Software,
-// Aras Pranckevicius, and Sean Barrett.
+// Originally sponsored by RAD Game Tools. Seeking implementation
+// sponsored by Phillip Bennefall, Marc Andersen, Aaron Baker,
+// Elias Software, Aras Pranckevicius, and Sean Barrett.
//
// LICENSE
//
@@ -30,22 +30,26 @@
// Tom Beaumont Ingo Leitgeb Nicolas Guillemot
// Phillip Bennefall Rohit Thiago Goulart
// manxorist@github saga musix github:infatum
+// Timur Gagiev
//
// Partial history:
-// 1.11 - 2017/07/23 - fix MinGW compilation
-// 1.10 - 2017/03/03 - more robust seeking; fix negative ilog(); clear error in open_memory
-// 1.09 - 2016/04/04 - back out 'truncation of last frame' fix from previous version
-// 1.08 - 2016/04/02 - warnings; setup memory leaks; truncation of last frame
-// 1.07 - 2015/01/16 - fixes for crashes on invalid files; warning fixes; const
-// 1.06 - 2015/08/31 - full, correct support for seeking API (Dougall Johnson)
+// 1.14 - 2018-02-11 - delete bogus dealloca usage
+// 1.13 - 2018-01-29 - fix truncation of last frame (hopefully)
+// 1.12 - 2017-11-21 - limit residue begin/end to blocksize/2 to avoid large temp allocs in bad/corrupt files
+// 1.11 - 2017-07-23 - fix MinGW compilation
+// 1.10 - 2017-03-03 - more robust seeking; fix negative ilog(); clear error in open_memory
+// 1.09 - 2016-04-04 - back out 'truncation of last frame' fix from previous version
+// 1.08 - 2016-04-02 - warnings; setup memory leaks; truncation of last frame
+// 1.07 - 2015-01-16 - fixes for crashes on invalid files; warning fixes; const
+// 1.06 - 2015-08-31 - full, correct support for seeking API (Dougall Johnson)
// some crash fixes when out of memory or with corrupt files
// fix some inappropriately signed shifts
-// 1.05 - 2015/04/19 - don't define __forceinline if it's redundant
-// 1.04 - 2014/08/27 - fix missing const-correct case in API
-// 1.03 - 2014/08/07 - warning fixes
-// 1.02 - 2014/07/09 - declare qsort comparison as explicitly _cdecl in Windows
-// 1.01 - 2014/06/18 - fix stb_vorbis_get_samples_float (interleaved was correct)
-// 1.0 - 2014/05/26 - fix memory leaks; fix warnings; fix bugs in >2-channel;
+// 1.05 - 2015-04-19 - don't define __forceinline if it's redundant
+// 1.04 - 2014-08-27 - fix missing const-correct case in API
+// 1.03 - 2014-08-07 - warning fixes
+// 1.02 - 2014-07-09 - declare qsort comparison as explicitly _cdecl in Windows
+// 1.01 - 2014-06-18 - fix stb_vorbis_get_samples_float (interleaved was correct)
+// 1.0 - 2014-05-26 - fix memory leaks; fix warnings; fix bugs in >2-channel;
// (API change) report sample rate for decode-full-file funcs
//
// See end of file for full version history.
@@ -816,7 +820,7 @@ struct stb_vorbis
int current_loc_valid;
// per-blocksize precomputed data
-
+
// twiddle factors
float *A[2],*B[2],*C[2];
float *window[2];
@@ -880,11 +884,7 @@ static int error(vorb *f, enum STBVorbisError e)
#define array_size_required(count,size) (count*(sizeof(void *)+(size)))
#define temp_alloc(f,size) (f->alloc.alloc_buffer ? setup_temp_malloc(f,size) : alloca(size))
-#ifdef dealloca
-#define temp_free(f,p) (f->alloc.alloc_buffer ? 0 : dealloca(size))
-#else
#define temp_free(f,p) 0
-#endif
#define temp_alloc_save(f) ((f)->temp_offset)
#define temp_alloc_restore(f,p) ((f)->temp_offset = (p))
@@ -1142,7 +1142,7 @@ static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *values)
if (!c->sparse) {
int k = 0;
for (i=0; i < c->entries; ++i)
- if (include_in_sort(c, lengths[i]))
+ if (include_in_sort(c, lengths[i]))
c->sorted_codewords[k++] = bit_reverse(c->codewords[i]);
assert(k == c->sorted_entries);
} else {
@@ -1323,7 +1323,7 @@ static int getn(vorb *z, uint8 *data, int n)
return 1;
}
- #ifndef STB_VORBIS_NO_STDIO
+ #ifndef STB_VORBIS_NO_STDIO
if (fread(data, n, 1, z->f) == 1)
return 1;
else {
@@ -1403,7 +1403,7 @@ static int start_page_no_capturepattern(vorb *f)
// header flag
f->page_flag = get8(f);
// absolute granule position
- loc0 = get32(f);
+ loc0 = get32(f);
loc1 = get32(f);
// @TODO: validate loc0,loc1 as valid positions?
// stream serial number -- vorbis doesn't interleave, so discard
@@ -1888,69 +1888,69 @@ static int predict_point(int x, int x0, int x1, int y0, int y1)
// the following table is block-copied from the specification
static float inverse_db_table[256] =
{
- 1.0649863e-07f, 1.1341951e-07f, 1.2079015e-07f, 1.2863978e-07f,
- 1.3699951e-07f, 1.4590251e-07f, 1.5538408e-07f, 1.6548181e-07f,
- 1.7623575e-07f, 1.8768855e-07f, 1.9988561e-07f, 2.1287530e-07f,
- 2.2670913e-07f, 2.4144197e-07f, 2.5713223e-07f, 2.7384213e-07f,
- 2.9163793e-07f, 3.1059021e-07f, 3.3077411e-07f, 3.5226968e-07f,
- 3.7516214e-07f, 3.9954229e-07f, 4.2550680e-07f, 4.5315863e-07f,
- 4.8260743e-07f, 5.1396998e-07f, 5.4737065e-07f, 5.8294187e-07f,
- 6.2082472e-07f, 6.6116941e-07f, 7.0413592e-07f, 7.4989464e-07f,
- 7.9862701e-07f, 8.5052630e-07f, 9.0579828e-07f, 9.6466216e-07f,
- 1.0273513e-06f, 1.0941144e-06f, 1.1652161e-06f, 1.2409384e-06f,
- 1.3215816e-06f, 1.4074654e-06f, 1.4989305e-06f, 1.5963394e-06f,
- 1.7000785e-06f, 1.8105592e-06f, 1.9282195e-06f, 2.0535261e-06f,
- 2.1869758e-06f, 2.3290978e-06f, 2.4804557e-06f, 2.6416497e-06f,
- 2.8133190e-06f, 2.9961443e-06f, 3.1908506e-06f, 3.3982101e-06f,
- 3.6190449e-06f, 3.8542308e-06f, 4.1047004e-06f, 4.3714470e-06f,
- 4.6555282e-06f, 4.9580707e-06f, 5.2802740e-06f, 5.6234160e-06f,
- 5.9888572e-06f, 6.3780469e-06f, 6.7925283e-06f, 7.2339451e-06f,
- 7.7040476e-06f, 8.2047000e-06f, 8.7378876e-06f, 9.3057248e-06f,
- 9.9104632e-06f, 1.0554501e-05f, 1.1240392e-05f, 1.1970856e-05f,
- 1.2748789e-05f, 1.3577278e-05f, 1.4459606e-05f, 1.5399272e-05f,
- 1.6400004e-05f, 1.7465768e-05f, 1.8600792e-05f, 1.9809576e-05f,
- 2.1096914e-05f, 2.2467911e-05f, 2.3928002e-05f, 2.5482978e-05f,
- 2.7139006e-05f, 2.8902651e-05f, 3.0780908e-05f, 3.2781225e-05f,
- 3.4911534e-05f, 3.7180282e-05f, 3.9596466e-05f, 4.2169667e-05f,
- 4.4910090e-05f, 4.7828601e-05f, 5.0936773e-05f, 5.4246931e-05f,
- 5.7772202e-05f, 6.1526565e-05f, 6.5524908e-05f, 6.9783085e-05f,
- 7.4317983e-05f, 7.9147585e-05f, 8.4291040e-05f, 8.9768747e-05f,
- 9.5602426e-05f, 0.00010181521f, 0.00010843174f, 0.00011547824f,
- 0.00012298267f, 0.00013097477f, 0.00013948625f, 0.00014855085f,
- 0.00015820453f, 0.00016848555f, 0.00017943469f, 0.00019109536f,
- 0.00020351382f, 0.00021673929f, 0.00023082423f, 0.00024582449f,
- 0.00026179955f, 0.00027881276f, 0.00029693158f, 0.00031622787f,
- 0.00033677814f, 0.00035866388f, 0.00038197188f, 0.00040679456f,
- 0.00043323036f, 0.00046138411f, 0.00049136745f, 0.00052329927f,
- 0.00055730621f, 0.00059352311f, 0.00063209358f, 0.00067317058f,
- 0.00071691700f, 0.00076350630f, 0.00081312324f, 0.00086596457f,
- 0.00092223983f, 0.00098217216f, 0.0010459992f, 0.0011139742f,
- 0.0011863665f, 0.0012634633f, 0.0013455702f, 0.0014330129f,
- 0.0015261382f, 0.0016253153f, 0.0017309374f, 0.0018434235f,
- 0.0019632195f, 0.0020908006f, 0.0022266726f, 0.0023713743f,
- 0.0025254795f, 0.0026895994f, 0.0028643847f, 0.0030505286f,
- 0.0032487691f, 0.0034598925f, 0.0036847358f, 0.0039241906f,
- 0.0041792066f, 0.0044507950f, 0.0047400328f, 0.0050480668f,
- 0.0053761186f, 0.0057254891f, 0.0060975636f, 0.0064938176f,
- 0.0069158225f, 0.0073652516f, 0.0078438871f, 0.0083536271f,
- 0.0088964928f, 0.009474637f, 0.010090352f, 0.010746080f,
- 0.011444421f, 0.012188144f, 0.012980198f, 0.013823725f,
- 0.014722068f, 0.015678791f, 0.016697687f, 0.017782797f,
- 0.018938423f, 0.020169149f, 0.021479854f, 0.022875735f,
- 0.024362330f, 0.025945531f, 0.027631618f, 0.029427276f,
- 0.031339626f, 0.033376252f, 0.035545228f, 0.037855157f,
- 0.040315199f, 0.042935108f, 0.045725273f, 0.048696758f,
- 0.051861348f, 0.055231591f, 0.058820850f, 0.062643361f,
- 0.066714279f, 0.071049749f, 0.075666962f, 0.080584227f,
- 0.085821044f, 0.091398179f, 0.097337747f, 0.10366330f,
- 0.11039993f, 0.11757434f, 0.12521498f, 0.13335215f,
- 0.14201813f, 0.15124727f, 0.16107617f, 0.17154380f,
- 0.18269168f, 0.19456402f, 0.20720788f, 0.22067342f,
- 0.23501402f, 0.25028656f, 0.26655159f, 0.28387361f,
- 0.30232132f, 0.32196786f, 0.34289114f, 0.36517414f,
- 0.38890521f, 0.41417847f, 0.44109412f, 0.46975890f,
- 0.50028648f, 0.53279791f, 0.56742212f, 0.60429640f,
- 0.64356699f, 0.68538959f, 0.72993007f, 0.77736504f,
+ 1.0649863e-07f, 1.1341951e-07f, 1.2079015e-07f, 1.2863978e-07f,
+ 1.3699951e-07f, 1.4590251e-07f, 1.5538408e-07f, 1.6548181e-07f,
+ 1.7623575e-07f, 1.8768855e-07f, 1.9988561e-07f, 2.1287530e-07f,
+ 2.2670913e-07f, 2.4144197e-07f, 2.5713223e-07f, 2.7384213e-07f,
+ 2.9163793e-07f, 3.1059021e-07f, 3.3077411e-07f, 3.5226968e-07f,
+ 3.7516214e-07f, 3.9954229e-07f, 4.2550680e-07f, 4.5315863e-07f,
+ 4.8260743e-07f, 5.1396998e-07f, 5.4737065e-07f, 5.8294187e-07f,
+ 6.2082472e-07f, 6.6116941e-07f, 7.0413592e-07f, 7.4989464e-07f,
+ 7.9862701e-07f, 8.5052630e-07f, 9.0579828e-07f, 9.6466216e-07f,
+ 1.0273513e-06f, 1.0941144e-06f, 1.1652161e-06f, 1.2409384e-06f,
+ 1.3215816e-06f, 1.4074654e-06f, 1.4989305e-06f, 1.5963394e-06f,
+ 1.7000785e-06f, 1.8105592e-06f, 1.9282195e-06f, 2.0535261e-06f,
+ 2.1869758e-06f, 2.3290978e-06f, 2.4804557e-06f, 2.6416497e-06f,
+ 2.8133190e-06f, 2.9961443e-06f, 3.1908506e-06f, 3.3982101e-06f,
+ 3.6190449e-06f, 3.8542308e-06f, 4.1047004e-06f, 4.3714470e-06f,
+ 4.6555282e-06f, 4.9580707e-06f, 5.2802740e-06f, 5.6234160e-06f,
+ 5.9888572e-06f, 6.3780469e-06f, 6.7925283e-06f, 7.2339451e-06f,
+ 7.7040476e-06f, 8.2047000e-06f, 8.7378876e-06f, 9.3057248e-06f,
+ 9.9104632e-06f, 1.0554501e-05f, 1.1240392e-05f, 1.1970856e-05f,
+ 1.2748789e-05f, 1.3577278e-05f, 1.4459606e-05f, 1.5399272e-05f,
+ 1.6400004e-05f, 1.7465768e-05f, 1.8600792e-05f, 1.9809576e-05f,
+ 2.1096914e-05f, 2.2467911e-05f, 2.3928002e-05f, 2.5482978e-05f,
+ 2.7139006e-05f, 2.8902651e-05f, 3.0780908e-05f, 3.2781225e-05f,
+ 3.4911534e-05f, 3.7180282e-05f, 3.9596466e-05f, 4.2169667e-05f,
+ 4.4910090e-05f, 4.7828601e-05f, 5.0936773e-05f, 5.4246931e-05f,
+ 5.7772202e-05f, 6.1526565e-05f, 6.5524908e-05f, 6.9783085e-05f,
+ 7.4317983e-05f, 7.9147585e-05f, 8.4291040e-05f, 8.9768747e-05f,
+ 9.5602426e-05f, 0.00010181521f, 0.00010843174f, 0.00011547824f,
+ 0.00012298267f, 0.00013097477f, 0.00013948625f, 0.00014855085f,
+ 0.00015820453f, 0.00016848555f, 0.00017943469f, 0.00019109536f,
+ 0.00020351382f, 0.00021673929f, 0.00023082423f, 0.00024582449f,
+ 0.00026179955f, 0.00027881276f, 0.00029693158f, 0.00031622787f,
+ 0.00033677814f, 0.00035866388f, 0.00038197188f, 0.00040679456f,
+ 0.00043323036f, 0.00046138411f, 0.00049136745f, 0.00052329927f,
+ 0.00055730621f, 0.00059352311f, 0.00063209358f, 0.00067317058f,
+ 0.00071691700f, 0.00076350630f, 0.00081312324f, 0.00086596457f,
+ 0.00092223983f, 0.00098217216f, 0.0010459992f, 0.0011139742f,
+ 0.0011863665f, 0.0012634633f, 0.0013455702f, 0.0014330129f,
+ 0.0015261382f, 0.0016253153f, 0.0017309374f, 0.0018434235f,
+ 0.0019632195f, 0.0020908006f, 0.0022266726f, 0.0023713743f,
+ 0.0025254795f, 0.0026895994f, 0.0028643847f, 0.0030505286f,
+ 0.0032487691f, 0.0034598925f, 0.0036847358f, 0.0039241906f,
+ 0.0041792066f, 0.0044507950f, 0.0047400328f, 0.0050480668f,
+ 0.0053761186f, 0.0057254891f, 0.0060975636f, 0.0064938176f,
+ 0.0069158225f, 0.0073652516f, 0.0078438871f, 0.0083536271f,
+ 0.0088964928f, 0.009474637f, 0.010090352f, 0.010746080f,
+ 0.011444421f, 0.012188144f, 0.012980198f, 0.013823725f,
+ 0.014722068f, 0.015678791f, 0.016697687f, 0.017782797f,
+ 0.018938423f, 0.020169149f, 0.021479854f, 0.022875735f,
+ 0.024362330f, 0.025945531f, 0.027631618f, 0.029427276f,
+ 0.031339626f, 0.033376252f, 0.035545228f, 0.037855157f,
+ 0.040315199f, 0.042935108f, 0.045725273f, 0.048696758f,
+ 0.051861348f, 0.055231591f, 0.058820850f, 0.062643361f,
+ 0.066714279f, 0.071049749f, 0.075666962f, 0.080584227f,
+ 0.085821044f, 0.091398179f, 0.097337747f, 0.10366330f,
+ 0.11039993f, 0.11757434f, 0.12521498f, 0.13335215f,
+ 0.14201813f, 0.15124727f, 0.16107617f, 0.17154380f,
+ 0.18269168f, 0.19456402f, 0.20720788f, 0.22067342f,
+ 0.23501402f, 0.25028656f, 0.26655159f, 0.28387361f,
+ 0.30232132f, 0.32196786f, 0.34289114f, 0.36517414f,
+ 0.38890521f, 0.41417847f, 0.44109412f, 0.46975890f,
+ 0.50028648f, 0.53279791f, 0.56742212f, 0.60429640f,
+ 0.64356699f, 0.68538959f, 0.72993007f, 0.77736504f,
0.82788260f, 0.88168307f, 0.9389798f, 1.0f
};
@@ -2042,6 +2042,8 @@ static int residue_decode(vorb *f, Codebook *book, float *target, int offset, in
return TRUE;
}
+// n is 1/2 of the blocksize --
+// specification: "Correct per-vector decode length is [n]/2"
static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int rn, uint8 *do_not_decode)
{
int i,j,pass;
@@ -2049,7 +2051,10 @@ static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int
int rtype = f->residue_types[rn];
int c = r->classbook;
int classwords = f->codebooks[c].dimensions;
- int n_read = r->end - r->begin;
+ unsigned int actual_size = rtype == 2 ? n*2 : n;
+ unsigned int limit_r_begin = (r->begin < actual_size ? r->begin : actual_size);
+ unsigned int limit_r_end = (r->end < actual_size ? r->end : actual_size);
+ int n_read = limit_r_end - limit_r_begin;
int part_read = n_read / r->part_size;
int temp_alloc_point = temp_alloc_save(f);
#ifndef STB_VORBIS_DIVIDES_IN_RESIDUE
@@ -2346,11 +2351,11 @@ void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype)
#if LIBVORBIS_MDCT
// directly call the vorbis MDCT using an interface documented
// by Jeff Roberts... useful for performance comparison
-typedef struct
+typedef struct
{
int n;
int log2n;
-
+
float *trig;
int *bitrev;
@@ -2369,7 +2374,7 @@ void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
if (M1.n == n) M = &M1;
else if (M2.n == n) M = &M2;
else if (M1.n == 0) { mdct_init(&M1, n); M = &M1; }
- else {
+ else {
if (M2.n) __asm int 3;
mdct_init(&M2, n);
M = &M2;
@@ -2782,7 +2787,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
d1[0] = u[k4+1];
d0[1] = u[k4+2];
d0[0] = u[k4+3];
-
+
d0 -= 4;
d1 -= 4;
bitrev += 2;
@@ -2863,7 +2868,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
float p0,p1,p2,p3;
p3 = e[6]*B[7] - e[7]*B[6];
- p2 = -e[6]*B[6] - e[7]*B[7];
+ p2 = -e[6]*B[6] - e[7]*B[7];
d0[0] = p3;
d1[3] = - p3;
@@ -2871,7 +2876,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
d3[3] = p2;
p1 = e[4]*B[5] - e[5]*B[4];
- p0 = -e[4]*B[4] - e[5]*B[5];
+ p0 = -e[4]*B[4] - e[5]*B[5];
d0[1] = p1;
d1[2] = - p1;
@@ -2879,7 +2884,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
d3[2] = p0;
p3 = e[2]*B[3] - e[3]*B[2];
- p2 = -e[2]*B[2] - e[3]*B[3];
+ p2 = -e[2]*B[2] - e[3]*B[3];
d0[2] = p3;
d1[1] = - p3;
@@ -2887,7 +2892,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
d3[1] = p2;
p1 = e[0]*B[1] - e[1]*B[0];
- p0 = -e[0]*B[0] - e[1]*B[1];
+ p0 = -e[0]*B[0] - e[1]*B[1];
d0[3] = p1;
d1[0] = - p1;
@@ -3391,7 +3396,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
if (f->last_seg_which == f->end_seg_with_known_loc) {
// if we have a valid current loc, and this is final:
if (f->current_loc_valid && (f->page_flag & PAGEFLAG_last_page)) {
- uint32 current_end = f->known_loc_for_packet - (n-right_end);
+ uint32 current_end = f->known_loc_for_packet;
// then let's infer the size of the (probably) short final frame
if (current_end < f->current_loc + (right_end-left_start)) {
if (current_end < f->current_loc) {
@@ -3400,7 +3405,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start,
} else {
*len = current_end - f->current_loc;
}
- *len += left_start;
+ *len += left_start; // this doesn't seem right, but has no ill effect on my test files
if (*len > right_end) *len = right_end; // this should never happen
f->current_loc += *len;
return TRUE;
@@ -3521,7 +3526,7 @@ static int is_whole_packet_present(stb_vorbis *f, int end_page)
first = FALSE;
}
for (; s == -1;) {
- uint8 *q;
+ uint8 *q;
int n;
// check that we have the page header ready
@@ -3874,7 +3879,7 @@ static int start_decoder(vorb *f)
} else {
stbv__floor_ordering p[31*8+2];
Floor1 *g = &f->floor_config[i].floor1;
- int max_class = -1;
+ int max_class = -1;
g->partitions = get_bits(f, 5);
for (j=0; j < g->partitions; ++j) {
g->partition_class_list[j] = get_bits(f, 4);
@@ -3984,7 +3989,7 @@ static int start_decoder(vorb *f)
if (f->mapping == NULL) return error(f, VORBIS_outofmem);
memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping));
for (i=0; i < f->mapping_count; ++i) {
- Mapping *m = f->mapping + i;
+ Mapping *m = f->mapping + i;
int mapping_type = get_bits(f,16);
if (mapping_type != 0) return error(f, VORBIS_invalid_setup);
m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan));
@@ -4050,6 +4055,7 @@ static int start_decoder(vorb *f)
f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist);
if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem);
+ memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1);
#ifdef STB_VORBIS_NO_DEFER_FLOOR
f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem);
@@ -4077,7 +4083,10 @@ static int start_decoder(vorb *f)
int i,max_part_read=0;
for (i=0; i < f->residue_count; ++i) {
Residue *r = f->residue_config + i;
- int n_read = r->end - r->begin;
+ unsigned int actual_size = f->blocksize_1 / 2;
+ unsigned int limit_r_begin = r->begin < actual_size ? r->begin : actual_size;
+ unsigned int limit_r_end = r->end < actual_size ? r->end : actual_size;
+ int n_read = limit_r_end - limit_r_begin;
int part_read = n_read / r->part_size;
if (part_read > max_part_read)
max_part_read = part_read;
@@ -4088,6 +4097,8 @@ static int start_decoder(vorb *f)
classify_mem = f->channels * (sizeof(void*) + max_part_read * sizeof(int *));
#endif
+ // maximum reasonable partition size is f->blocksize_1
+
f->temp_memory_required = classify_mem;
if (imdct_mem > f->temp_memory_required)
f->temp_memory_required = imdct_mem;
@@ -4963,7 +4974,7 @@ stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, con
stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const stb_vorbis_alloc *alloc)
{
FILE *f = fopen(filename, "rb");
- if (f)
+ if (f)
return stb_vorbis_open_file(f, TRUE, error, alloc);
if (error) *error = VORBIS_file_open_failure;
return NULL;
@@ -5026,7 +5037,7 @@ static int8 channel_position[7][6] =
#define MAGIC(SHIFT) (1.5f * (1 << (23-SHIFT)) + 0.5f/(1 << SHIFT))
#define ADDEND(SHIFT) (((150-SHIFT) << 23) + (1 << 22))
#define FAST_SCALED_FLOAT_TO_INT(temp,x,s) (temp.f = (x) + MAGIC(s), temp.i - ADDEND(s))
- #define check_endianness()
+ #define check_endianness()
#else
#define FAST_SCALED_FLOAT_TO_INT(temp,x,s) ((int) ((x) * (1 << (s))))
#define check_endianness()
@@ -5351,20 +5362,22 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
#endif // STB_VORBIS_NO_PULLDATA_API
/* Version history
- 1.10 - 2017/03/03 - more robust seeking; fix negative ilog(); clear error in open_memory
- 1.09 - 2016/04/04 - back out 'avoid discarding last frame' fix from previous version
- 1.08 - 2016/04/02 - fixed multiple warnings; fix setup memory leaks;
+ 1.12 - 2017-11-21 - limit residue begin/end to blocksize/2 to avoid large temp allocs in bad/corrupt files
+ 1.11 - 2017-07-23 - fix MinGW compilation
+ 1.10 - 2017-03-03 - more robust seeking; fix negative ilog(); clear error in open_memory
+ 1.09 - 2016-04-04 - back out 'avoid discarding last frame' fix from previous version
+ 1.08 - 2016-04-02 - fixed multiple warnings; fix setup memory leaks;
avoid discarding last frame of audio data
- 1.07 - 2015/01/16 - fixed some warnings, fix mingw, const-correct API
- some more crash fixes when out of memory or with corrupt files
- 1.06 - 2015/08/31 - full, correct support for seeking API (Dougall Johnson)
+ 1.07 - 2015-01-16 - fixed some warnings, fix mingw, const-correct API
+ some more crash fixes when out of memory or with corrupt files
+ 1.06 - 2015-08-31 - full, correct support for seeking API (Dougall Johnson)
some crash fixes when out of memory or with corrupt files
- 1.05 - 2015/04/19 - don't define __forceinline if it's redundant
- 1.04 - 2014/08/27 - fix missing const-correct case in API
- 1.03 - 2014/08/07 - Warning fixes
- 1.02 - 2014/07/09 - Declare qsort compare function _cdecl on windows
- 1.01 - 2014/06/18 - fix stb_vorbis_get_samples_float
- 1.0 - 2014/05/26 - fix memory leaks; fix warnings; fix bugs in multichannel
+ 1.05 - 2015-04-19 - don't define __forceinline if it's redundant
+ 1.04 - 2014-08-27 - fix missing const-correct case in API
+ 1.03 - 2014-08-07 - Warning fixes
+ 1.02 - 2014-07-09 - Declare qsort compare function _cdecl on windows
+ 1.01 - 2014-06-18 - fix stb_vorbis_get_samples_float
+ 1.0 - 2014-05-26 - fix memory leaks; fix warnings; fix bugs in multichannel
(API change) report sample rate for decode-full-file funcs
0.99996 - bracket #include <malloc.h> for macintosh compilation by Laurent Gomila
0.99995 - use union instead of pointer-cast for fast-float-to-int to avoid alias-optimization problem
@@ -5412,38 +5425,38 @@ This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett
-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
+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
+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
+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.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
-Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
-software, either in source code form or as a compiled binary, for any purpose,
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
+software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
-In jurisdictions that recognize copyright laws, the author or authors of this
-software dedicate any and all copyright interest in the software to the public
-domain. We make this dedication for the benefit of the public at large and to
-the detriment of our heirs and successors. We intend this dedication to be an
-overt act of relinquishment in perpetuity of all present and future rights to
+In jurisdictions that recognize copyright laws, the author or authors of this
+software dedicate any and all copyright interest in the software to the public
+domain. We make this dedication for the benefit of the public at large and to
+the detriment of our heirs and successors. We intend this dedication to be an
+overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+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.
------------------------------------------------------------------------------
*/
diff --git a/thirdparty/pcre2/AUTHORS b/thirdparty/pcre2/AUTHORS
index e056ad6868..d5592bbc5b 100644
--- a/thirdparty/pcre2/AUTHORS
+++ b/thirdparty/pcre2/AUTHORS
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2017 University of Cambridge
+Copyright (c) 1997-2018 University of Cambridge
All rights reserved
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2017 Zoltan Herczeg
+Copyright(c) 2010-2018 Zoltan Herczeg
All rights reserved.
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2017 Zoltan Herczeg
+Copyright(c) 2009-2018 Zoltan Herczeg
All rights reserved.
####
diff --git a/thirdparty/pcre2/LICENCE b/thirdparty/pcre2/LICENCE
index 402fe2435c..bfe3c8d528 100644
--- a/thirdparty/pcre2/LICENCE
+++ b/thirdparty/pcre2/LICENCE
@@ -5,9 +5,10 @@ PCRE2 is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Release 10 of PCRE2 is distributed under the terms of the "BSD" licence, as
-specified below. The documentation for PCRE2, supplied in the "doc"
-directory, is distributed under the same terms as the software itself. The data
-in the testdata directory is not copyrighted and is in the public domain.
+specified below, with one exemption for certain binary redistributions. The
+documentation for PCRE2, supplied in the "doc" directory, is distributed under
+the same terms as the software itself. The data in the testdata directory is
+not copyrighted and is in the public domain.
The basic library functions are written in C and are freestanding. Also
included in the distribution is a just-in-time compiler that can be used to
@@ -25,7 +26,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2017 University of Cambridge
+Copyright (c) 1997-2018 University of Cambridge
All rights reserved.
@@ -36,7 +37,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2017 Zoltan Herczeg
+Copyright(c) 2010-2018 Zoltan Herczeg
All rights reserved.
@@ -47,7 +48,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2017 Zoltan Herczeg
+Copyright(c) 2009-2018 Zoltan Herczeg
All rights reserved.
@@ -57,11 +58,11 @@ THE "BSD" LICENCE
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice,
+ * Redistributions of source code must retain the above copyright notices,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
+ notices, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of any
@@ -80,4 +81,14 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+
+EXEMPTION FOR BINARY LIBRARY-LIKE PACKAGES
+------------------------------------------
+
+The second condition in the BSD licence (covering binary redistributions) does
+not apply all the way down a chain of software. If binary package A includes
+PCRE2, it must respect the condition, but if package B is software that
+includes package A, the condition is not imposed on package B unless it uses
+PCRE2 independently.
+
End
diff --git a/thirdparty/pcre2/src/config.h b/thirdparty/pcre2/src/config.h
index 3315b7770e..f738616714 100644
--- a/thirdparty/pcre2/src/config.h
+++ b/thirdparty/pcre2/src/config.h
@@ -132,13 +132,11 @@ sure both macros are undefined; an emulation function will then be used. */
/* Define to 1 if you have the <zlib.h> header file. */
/* #undef HAVE_ZLIB_H */
-/* PCRE2 uses recursive function calls to handle backtracking while matching.
- This can sometimes be a problem on systems that have stacks of limited
- size. Define HEAP_MATCH_RECURSE to any value to get a version that doesn't
- use recursion in the match() function; instead it creates its own stack by
- steam using memory from the heap. For more detail, see the comments and
- other stuff just above the match() function. */
-/* #undef HEAP_MATCH_RECURSE */
+/* This limits the amount of memory that pcre2_match() may use while matching
+ a pattern. The value is in kilobytes. */
+#ifndef HEAP_LIMIT
+#define HEAP_LIMIT 20000000
+#endif
/* The value of LINK_SIZE determines the number of bytes used to store links
as offsets within the compiled regex. The default is 2, which allows for
@@ -156,25 +154,25 @@ sure both macros are undefined; an emulation function will then be used. */
#endif
/* The value of MATCH_LIMIT determines the default number of times the
- internal match() function can be called during a single execution of
- pcre2_match(). There is a runtime interface for setting a different limit.
- The limit exists in order to catch runaway regular expressions that take
- for ever to determine that they do not match. The default is set very large
- so that it does not accidentally catch legitimate cases. */
+ pcre2_match() function can record a backtrack position during a single
+ matching attempt. There is a runtime interface for setting a different
+ limit. The limit exists in order to catch runaway regular expressions that
+ take for ever to determine that they do not match. The default is set very
+ large so that it does not accidentally catch legitimate cases. */
#ifndef MATCH_LIMIT
#define MATCH_LIMIT 10000000
#endif
-/* The above limit applies to all calls of match(), whether or not they
- increase the recursion depth. In some environments it is desirable to limit
- the depth of recursive calls of match() more strictly, in order to restrict
- the maximum amount of stack (or heap, if HEAP_MATCH_RECURSE is defined)
- that is used. The value of MATCH_LIMIT_RECURSION applies only to recursive
- calls of match(). To have any useful effect, it must be less than the value
- of MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There
- is a runtime method for setting a different limit. */
-#ifndef MATCH_LIMIT_RECURSION
-#define MATCH_LIMIT_RECURSION MATCH_LIMIT
+/* The above limit applies to all backtracks, whether or not they are nested.
+ In some environments it is desirable to limit the nesting of backtracking
+ (that is, the depth of tree that is searched) more strictly, in order to
+ restrict the maximum amount of heap memory that is used. The value of
+ MATCH_LIMIT_DEPTH provides this facility. To have any useful effect, it
+ must be less than the value of MATCH_LIMIT. The default is to use the same
+ value as MATCH_LIMIT. There is a runtime method for setting a different
+ limit. */
+#ifndef MATCH_LIMIT_DEPTH
+#define MATCH_LIMIT_DEPTH MATCH_LIMIT
#endif
/* This limit is parameterized just in case anybody ever wants to change it.
@@ -196,8 +194,8 @@ sure both macros are undefined; an emulation function will then be used. */
/* The value of NEWLINE_DEFAULT determines the default newline character
sequence. PCRE2 client programs can override this by selecting other values
- at run time. The valid values are 1 (CR), 2 (LF), 3 (CRLF), 4 (ANY), and 5
- (ANYCRLF). */
+ at run time. The valid values are 1 (CR), 2 (LF), 3 (CRLF), 4 (ANY), 5
+ (ANYCRLF), and 6 (NUL). */
#ifndef NEWLINE_DEFAULT
#define NEWLINE_DEFAULT 2
#endif
@@ -212,7 +210,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_NAME "PCRE2"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "PCRE2 10.23"
+#define PACKAGE_STRING "PCRE2 10.31"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "pcre2"
@@ -221,7 +219,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "10.23"
+#define PACKAGE_VERSION "10.31"
/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
parentheses (of any kind) in a pattern. This limits the amount of system
@@ -269,6 +267,11 @@ sure both macros are undefined; an emulation function will then be used. */
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
+/* Define to any non-zero number to enable support for SELinux compatible
+ executable memory allocator in JIT. Note that this will have no effect
+ unless SUPPORT_JIT is also defined. */
+/* #undef SLJIT_PROT_EXECUTABLE_ALLOCATOR */
+
/* Define to 1 if you have the ANSI C header files. */
/* #undef STDC_HEADERS */
@@ -336,7 +339,7 @@ sure both macros are undefined; an emulation function will then be used. */
#endif
/* Version number of package */
-#define VERSION "10.23"
+#define VERSION "10.31"
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
diff --git a/thirdparty/pcre2/src/pcre2.h b/thirdparty/pcre2/src/pcre2.h
index 86503208e8..fffcc307d0 100644
--- a/thirdparty/pcre2/src/pcre2.h
+++ b/thirdparty/pcre2/src/pcre2.h
@@ -5,7 +5,7 @@
/* This is the public header file for the PCRE library, second API, to be
#included by applications that call PCRE2 functions.
- Copyright (c) 2016 University of Cambridge
+ Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE2_MAJOR 10
-#define PCRE2_MINOR 23
+#define PCRE2_MINOR 31
#define PCRE2_PRERELEASE
-#define PCRE2_DATE 2017-02-14
+#define PCRE2_DATE 2018-02-12
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
@@ -101,6 +101,7 @@ others can be added next to them */
#define PCRE2_ANCHORED 0x80000000u
#define PCRE2_NO_UTF_CHECK 0x40000000u
+#define PCRE2_ENDANCHORED 0x20000000u
/* The following option bits can be passed only to pcre2_compile(). However,
they may affect compilation, JIT compilation, and/or interpretive execution.
@@ -136,6 +137,15 @@ D is inspected during pcre2_dfa_match() execution
#define PCRE2_ALT_CIRCUMFLEX 0x00200000u /* J M D */
#define PCRE2_ALT_VERBNAMES 0x00400000u /* C */
#define PCRE2_USE_OFFSET_LIMIT 0x00800000u /* J M D */
+#define PCRE2_EXTENDED_MORE 0x01000000u /* C */
+#define PCRE2_LITERAL 0x02000000u /* C */
+
+/* An additional compile options word is available in the compile context. */
+
+#define PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES 0x00000001u /* C */
+#define PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL 0x00000002u /* C */
+#define PCRE2_EXTRA_MATCH_WORD 0x00000004u /* C */
+#define PCRE2_EXTRA_MATCH_LINE 0x00000008u /* C */
/* These are for pcre2_jit_compile(). */
@@ -174,6 +184,16 @@ ignored for pcre2_jit_match(). */
#define PCRE2_NO_JIT 0x00002000u
+/* Options for pcre2_pattern_convert(). */
+
+#define PCRE2_CONVERT_UTF 0x00000001u
+#define PCRE2_CONVERT_NO_UTF_CHECK 0x00000002u
+#define PCRE2_CONVERT_POSIX_BASIC 0x00000004u
+#define PCRE2_CONVERT_POSIX_EXTENDED 0x00000008u
+#define PCRE2_CONVERT_GLOB 0x00000010u
+#define PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR 0x00000030u
+#define PCRE2_CONVERT_GLOB_NO_STARSTAR 0x00000050u
+
/* Newline and \R settings, for use in compile contexts. The newline values
must be kept in step with values set in config.h and both sets must all be
greater than zero. */
@@ -183,11 +203,109 @@ greater than zero. */
#define PCRE2_NEWLINE_CRLF 3
#define PCRE2_NEWLINE_ANY 4
#define PCRE2_NEWLINE_ANYCRLF 5
+#define PCRE2_NEWLINE_NUL 6
#define PCRE2_BSR_UNICODE 1
#define PCRE2_BSR_ANYCRLF 2
-/* Error codes: no match and partial match are "expected" errors. */
+/* Error codes for pcre2_compile(). Some of these are also used by
+pcre2_pattern_convert(). */
+
+#define PCRE2_ERROR_END_BACKSLASH 101
+#define PCRE2_ERROR_END_BACKSLASH_C 102
+#define PCRE2_ERROR_UNKNOWN_ESCAPE 103
+#define PCRE2_ERROR_QUANTIFIER_OUT_OF_ORDER 104
+#define PCRE2_ERROR_QUANTIFIER_TOO_BIG 105
+#define PCRE2_ERROR_MISSING_SQUARE_BRACKET 106
+#define PCRE2_ERROR_ESCAPE_INVALID_IN_CLASS 107
+#define PCRE2_ERROR_CLASS_RANGE_ORDER 108
+#define PCRE2_ERROR_QUANTIFIER_INVALID 109
+#define PCRE2_ERROR_INTERNAL_UNEXPECTED_REPEAT 110
+#define PCRE2_ERROR_INVALID_AFTER_PARENS_QUERY 111
+#define PCRE2_ERROR_POSIX_CLASS_NOT_IN_CLASS 112
+#define PCRE2_ERROR_POSIX_NO_SUPPORT_COLLATING 113
+#define PCRE2_ERROR_MISSING_CLOSING_PARENTHESIS 114
+#define PCRE2_ERROR_BAD_SUBPATTERN_REFERENCE 115
+#define PCRE2_ERROR_NULL_PATTERN 116
+#define PCRE2_ERROR_BAD_OPTIONS 117
+#define PCRE2_ERROR_MISSING_COMMENT_CLOSING 118
+#define PCRE2_ERROR_PARENTHESES_NEST_TOO_DEEP 119
+#define PCRE2_ERROR_PATTERN_TOO_LARGE 120
+#define PCRE2_ERROR_HEAP_FAILED 121
+#define PCRE2_ERROR_UNMATCHED_CLOSING_PARENTHESIS 122
+#define PCRE2_ERROR_INTERNAL_CODE_OVERFLOW 123
+#define PCRE2_ERROR_MISSING_CONDITION_CLOSING 124
+#define PCRE2_ERROR_LOOKBEHIND_NOT_FIXED_LENGTH 125
+#define PCRE2_ERROR_ZERO_RELATIVE_REFERENCE 126
+#define PCRE2_ERROR_TOO_MANY_CONDITION_BRANCHES 127
+#define PCRE2_ERROR_CONDITION_ASSERTION_EXPECTED 128
+#define PCRE2_ERROR_BAD_RELATIVE_REFERENCE 129
+#define PCRE2_ERROR_UNKNOWN_POSIX_CLASS 130
+#define PCRE2_ERROR_INTERNAL_STUDY_ERROR 131
+#define PCRE2_ERROR_UNICODE_NOT_SUPPORTED 132
+#define PCRE2_ERROR_PARENTHESES_STACK_CHECK 133
+#define PCRE2_ERROR_CODE_POINT_TOO_BIG 134
+#define PCRE2_ERROR_LOOKBEHIND_TOO_COMPLICATED 135
+#define PCRE2_ERROR_LOOKBEHIND_INVALID_BACKSLASH_C 136
+#define PCRE2_ERROR_UNSUPPORTED_ESCAPE_SEQUENCE 137
+#define PCRE2_ERROR_CALLOUT_NUMBER_TOO_BIG 138
+#define PCRE2_ERROR_MISSING_CALLOUT_CLOSING 139
+#define PCRE2_ERROR_ESCAPE_INVALID_IN_VERB 140
+#define PCRE2_ERROR_UNRECOGNIZED_AFTER_QUERY_P 141
+#define PCRE2_ERROR_MISSING_NAME_TERMINATOR 142
+#define PCRE2_ERROR_DUPLICATE_SUBPATTERN_NAME 143
+#define PCRE2_ERROR_INVALID_SUBPATTERN_NAME 144
+#define PCRE2_ERROR_UNICODE_PROPERTIES_UNAVAILABLE 145
+#define PCRE2_ERROR_MALFORMED_UNICODE_PROPERTY 146
+#define PCRE2_ERROR_UNKNOWN_UNICODE_PROPERTY 147
+#define PCRE2_ERROR_SUBPATTERN_NAME_TOO_LONG 148
+#define PCRE2_ERROR_TOO_MANY_NAMED_SUBPATTERNS 149
+#define PCRE2_ERROR_CLASS_INVALID_RANGE 150
+#define PCRE2_ERROR_OCTAL_BYTE_TOO_BIG 151
+#define PCRE2_ERROR_INTERNAL_OVERRAN_WORKSPACE 152
+#define PCRE2_ERROR_INTERNAL_MISSING_SUBPATTERN 153
+#define PCRE2_ERROR_DEFINE_TOO_MANY_BRANCHES 154
+#define PCRE2_ERROR_BACKSLASH_O_MISSING_BRACE 155
+#define PCRE2_ERROR_INTERNAL_UNKNOWN_NEWLINE 156
+#define PCRE2_ERROR_BACKSLASH_G_SYNTAX 157
+#define PCRE2_ERROR_PARENS_QUERY_R_MISSING_CLOSING 158
+#define PCRE2_ERROR_VERB_ARGUMENT_NOT_ALLOWED 159
+#define PCRE2_ERROR_VERB_UNKNOWN 160
+#define PCRE2_ERROR_SUBPATTERN_NUMBER_TOO_BIG 161
+#define PCRE2_ERROR_SUBPATTERN_NAME_EXPECTED 162
+#define PCRE2_ERROR_INTERNAL_PARSED_OVERFLOW 163
+#define PCRE2_ERROR_INVALID_OCTAL 164
+#define PCRE2_ERROR_SUBPATTERN_NAMES_MISMATCH 165
+#define PCRE2_ERROR_MARK_MISSING_ARGUMENT 166
+#define PCRE2_ERROR_INVALID_HEXADECIMAL 167
+#define PCRE2_ERROR_BACKSLASH_C_SYNTAX 168
+#define PCRE2_ERROR_BACKSLASH_K_SYNTAX 169
+#define PCRE2_ERROR_INTERNAL_BAD_CODE_LOOKBEHINDS 170
+#define PCRE2_ERROR_BACKSLASH_N_IN_CLASS 171
+#define PCRE2_ERROR_CALLOUT_STRING_TOO_LONG 172
+#define PCRE2_ERROR_UNICODE_DISALLOWED_CODE_POINT 173
+#define PCRE2_ERROR_UTF_IS_DISABLED 174
+#define PCRE2_ERROR_UCP_IS_DISABLED 175
+#define PCRE2_ERROR_VERB_NAME_TOO_LONG 176
+#define PCRE2_ERROR_BACKSLASH_U_CODE_POINT_TOO_BIG 177
+#define PCRE2_ERROR_MISSING_OCTAL_OR_HEX_DIGITS 178
+#define PCRE2_ERROR_VERSION_CONDITION_SYNTAX 179
+#define PCRE2_ERROR_INTERNAL_BAD_CODE_AUTO_POSSESS 180
+#define PCRE2_ERROR_CALLOUT_NO_STRING_DELIMITER 181
+#define PCRE2_ERROR_CALLOUT_BAD_STRING_DELIMITER 182
+#define PCRE2_ERROR_BACKSLASH_C_CALLER_DISABLED 183
+#define PCRE2_ERROR_QUERY_BARJX_NEST_TOO_DEEP 184
+#define PCRE2_ERROR_BACKSLASH_C_LIBRARY_DISABLED 185
+#define PCRE2_ERROR_PATTERN_TOO_COMPLICATED 186
+#define PCRE2_ERROR_LOOKBEHIND_TOO_LONG 187
+#define PCRE2_ERROR_PATTERN_STRING_TOO_LONG 188
+#define PCRE2_ERROR_INTERNAL_BAD_CODE 189
+#define PCRE2_ERROR_INTERNAL_BAD_CODE_IN_SKIP 190
+#define PCRE2_ERROR_NO_SURROGATES_IN_UTF16 191
+#define PCRE2_ERROR_BAD_LITERAL_OPTIONS 192
+
+
+/* "Expected" matching error codes: no match and partial match. */
#define PCRE2_ERROR_NOMATCH (-1)
#define PCRE2_ERROR_PARTIAL (-2)
@@ -227,10 +345,10 @@ greater than zero. */
#define PCRE2_ERROR_UTF32_ERR1 (-27)
#define PCRE2_ERROR_UTF32_ERR2 (-28)
-/* Error codes for pcre2[_dfa]_match(), substring extraction functions, context
-functions, and serializing functions. They are in numerical order. Originally
-they were in alphabetical order too, but now that PCRE2 is released, the
-numbers must not be changed. */
+/* Miscellaneous error codes for pcre2[_dfa]_match(), substring extraction
+functions, context functions, and serializing functions. They are in numerical
+order. Originally they were in alphabetical order too, but now that PCRE2 is
+released, the numbers must not be changed. */
#define PCRE2_ERROR_BADDATA (-29)
#define PCRE2_ERROR_MIXEDTABLES (-30) /* Name was changed */
@@ -256,7 +374,8 @@ numbers must not be changed. */
#define PCRE2_ERROR_NOUNIQUESUBSTRING (-50)
#define PCRE2_ERROR_NULL (-51)
#define PCRE2_ERROR_RECURSELOOP (-52)
-#define PCRE2_ERROR_RECURSIONLIMIT (-53)
+#define PCRE2_ERROR_DEPTHLIMIT (-53)
+#define PCRE2_ERROR_RECURSIONLIMIT (-53) /* Obsolete synonym */
#define PCRE2_ERROR_UNAVAILABLE (-54)
#define PCRE2_ERROR_UNSET (-55)
#define PCRE2_ERROR_BADOFFSETLIMIT (-56)
@@ -266,6 +385,9 @@ numbers must not be changed. */
#define PCRE2_ERROR_BADSUBSPATTERN (-60)
#define PCRE2_ERROR_TOOMANYREPLACE (-61)
#define PCRE2_ERROR_BADSERIALIZEDDATA (-62)
+#define PCRE2_ERROR_HEAPLIMIT (-63)
+#define PCRE2_ERROR_CONVERT_SYNTAX (-64)
+
/* Request types for pcre2_pattern_info() */
@@ -290,9 +412,13 @@ numbers must not be changed. */
#define PCRE2_INFO_NAMEENTRYSIZE 18
#define PCRE2_INFO_NAMETABLE 19
#define PCRE2_INFO_NEWLINE 20
-#define PCRE2_INFO_RECURSIONLIMIT 21
+#define PCRE2_INFO_DEPTHLIMIT 21
+#define PCRE2_INFO_RECURSIONLIMIT 21 /* Obsolete synonym */
#define PCRE2_INFO_SIZE 22
#define PCRE2_INFO_HASBACKSLASHC 23
+#define PCRE2_INFO_FRAMESIZE 24
+#define PCRE2_INFO_HEAPLIMIT 25
+#define PCRE2_INFO_EXTRAOPTIONS 26
/* Request types for pcre2_config(). */
@@ -303,11 +429,16 @@ numbers must not be changed. */
#define PCRE2_CONFIG_MATCHLIMIT 4
#define PCRE2_CONFIG_NEWLINE 5
#define PCRE2_CONFIG_PARENSLIMIT 6
-#define PCRE2_CONFIG_RECURSIONLIMIT 7
-#define PCRE2_CONFIG_STACKRECURSE 8
+#define PCRE2_CONFIG_DEPTHLIMIT 7
+#define PCRE2_CONFIG_RECURSIONLIMIT 7 /* Obsolete synonym */
+#define PCRE2_CONFIG_STACKRECURSE 8 /* Obsolete */
#define PCRE2_CONFIG_UNICODE 9
#define PCRE2_CONFIG_UNICODE_VERSION 10
#define PCRE2_CONFIG_VERSION 11
+#define PCRE2_CONFIG_HEAPLIMIT 12
+#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
+#define PCRE2_CONFIG_COMPILED_WIDTHS 14
+
/* Types for code units in patterns and subject strings. */
@@ -342,6 +473,9 @@ typedef struct pcre2_real_compile_context pcre2_compile_context; \
struct pcre2_real_match_context; \
typedef struct pcre2_real_match_context pcre2_match_context; \
\
+struct pcre2_real_convert_context; \
+typedef struct pcre2_real_convert_context pcre2_convert_context; \
+\
struct pcre2_real_code; \
typedef struct pcre2_real_code pcre2_code; \
\
@@ -360,6 +494,11 @@ without changing the API of the function, thereby allowing old clients to work
without modification. Define the generic version in a macro; the width-specific
versions are generated from this macro below. */
+/* Flags for the callout_flags field. These are cleared after a callout. */
+
+#define PCRE2_CALLOUT_STARTMATCH 0x00000001u /* Set for each bumpalong */
+#define PCRE2_CALLOUT_BACKTRACK 0x00000002u /* Set after a backtrack */
+
#define PCRE2_STRUCTURE_LIST \
typedef struct pcre2_callout_block { \
uint32_t version; /* Identifies version of block */ \
@@ -379,6 +518,8 @@ typedef struct pcre2_callout_block { \
PCRE2_SIZE callout_string_offset; /* Offset to string within pattern */ \
PCRE2_SIZE callout_string_length; /* Length of string compiled into pattern */ \
PCRE2_SPTR callout_string; /* String compiled into pattern */ \
+ /* ------------------- Added for Version 2 -------------------------- */ \
+ uint32_t callout_flags; /* See above for list */ \
/* ------------------------------------------------------------------ */ \
} pcre2_callout_block; \
\
@@ -426,6 +567,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_character_tables(pcre2_compile_context *, const unsigned char *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+ pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_max_pattern_length(pcre2_compile_context *, PCRE2_SIZE); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_newline(pcre2_compile_context *, uint32_t); \
@@ -446,6 +589,10 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_callout(pcre2_match_context *, \
int (*)(pcre2_callout_block *, void *), void *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+ pcre2_set_depth_limit(pcre2_match_context *, uint32_t); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+ pcre2_set_heap_limit(pcre2_match_context *, uint32_t); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_match_limit(pcre2_match_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \
@@ -455,6 +602,18 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_recursion_memory_management(pcre2_match_context *, \
void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *);
+#define PCRE2_CONVERT_CONTEXT_FUNCTIONS \
+PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \
+ *pcre2_convert_context_copy(pcre2_convert_context *); \
+PCRE2_EXP_DECL pcre2_convert_context PCRE2_CALL_CONVENTION \
+ *pcre2_convert_context_create(pcre2_general_context *); \
+PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
+ pcre2_convert_context_free(pcre2_convert_context *); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+ pcre2_set_glob_escape(pcre2_convert_context *, uint32_t); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+ pcre2_set_glob_separator(pcre2_convert_context *, uint32_t);
+
/* Functions concerned with compiling a pattern to PCRE internal code. */
@@ -561,6 +720,16 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
PCRE2_SIZE, PCRE2_UCHAR *, PCRE2_SIZE *);
+/* Functions for converting pattern source strings. */
+
+#define PCRE2_CONVERT_FUNCTIONS \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+ pcre2_pattern_convert(PCRE2_SPTR, PCRE2_SIZE, uint32_t, PCRE2_UCHAR **, \
+ PCRE2_SIZE *, pcre2_convert_context *); \
+PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
+ pcre2_converted_pattern_free(PCRE2_UCHAR *);
+
+
/* Functions for JIT processing */
#define PCRE2_JIT_FUNCTIONS \
@@ -612,6 +781,7 @@ pcre2_compile are called by application code. */
#define pcre2_real_code PCRE2_SUFFIX(pcre2_real_code_)
#define pcre2_real_general_context PCRE2_SUFFIX(pcre2_real_general_context_)
#define pcre2_real_compile_context PCRE2_SUFFIX(pcre2_real_compile_context_)
+#define pcre2_real_convert_context PCRE2_SUFFIX(pcre2_real_convert_context_)
#define pcre2_real_match_context PCRE2_SUFFIX(pcre2_real_match_context_)
#define pcre2_real_jit_stack PCRE2_SUFFIX(pcre2_real_jit_stack_)
#define pcre2_real_match_data PCRE2_SUFFIX(pcre2_real_match_data_)
@@ -623,6 +793,7 @@ pcre2_compile are called by application code. */
#define pcre2_callout_enumerate_block PCRE2_SUFFIX(pcre2_callout_enumerate_block_)
#define pcre2_general_context PCRE2_SUFFIX(pcre2_general_context_)
#define pcre2_compile_context PCRE2_SUFFIX(pcre2_compile_context_)
+#define pcre2_convert_context PCRE2_SUFFIX(pcre2_convert_context_)
#define pcre2_match_context PCRE2_SUFFIX(pcre2_match_context_)
#define pcre2_match_data PCRE2_SUFFIX(pcre2_match_data_)
@@ -638,6 +809,10 @@ pcre2_compile are called by application code. */
#define pcre2_compile_context_create PCRE2_SUFFIX(pcre2_compile_context_create_)
#define pcre2_compile_context_free PCRE2_SUFFIX(pcre2_compile_context_free_)
#define pcre2_config PCRE2_SUFFIX(pcre2_config_)
+#define pcre2_convert_context_copy PCRE2_SUFFIX(pcre2_convert_context_copy_)
+#define pcre2_convert_context_create PCRE2_SUFFIX(pcre2_convert_context_create_)
+#define pcre2_convert_context_free PCRE2_SUFFIX(pcre2_convert_context_free_)
+#define pcre2_converted_pattern_free PCRE2_SUFFIX(pcre2_converted_pattern_free_)
#define pcre2_dfa_match PCRE2_SUFFIX(pcre2_dfa_match_)
#define pcre2_general_context_copy PCRE2_SUFFIX(pcre2_general_context_copy_)
#define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_)
@@ -661,6 +836,7 @@ pcre2_compile are called by application code. */
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
+#define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
#define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_)
#define pcre2_serialize_encode PCRE2_SUFFIX(pcre2_serialize_encode_)
@@ -669,14 +845,17 @@ pcre2_compile are called by application code. */
#define pcre2_set_bsr PCRE2_SUFFIX(pcre2_set_bsr_)
#define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_)
#define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_)
+#define pcre2_set_compile_extra_options PCRE2_SUFFIX(pcre2_set_compile_extra_options_)
#define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
+#define pcre2_set_depth_limit PCRE2_SUFFIX(pcre2_set_depth_limit_)
+#define pcre2_set_glob_escape PCRE2_SUFFIX(pcre2_set_glob_escape_)
+#define pcre2_set_glob_separator PCRE2_SUFFIX(pcre2_set_glob_separator_)
+#define pcre2_set_heap_limit PCRE2_SUFFIX(pcre2_set_heap_limit_)
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
#define pcre2_set_max_pattern_length PCRE2_SUFFIX(pcre2_set_max_pattern_length_)
#define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
#define pcre2_set_offset_limit PCRE2_SUFFIX(pcre2_set_offset_limit_)
-#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
-#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
#define pcre2_substitute PCRE2_SUFFIX(pcre2_substitute_)
#define pcre2_substring_copy_byname PCRE2_SUFFIX(pcre2_substring_copy_byname_)
#define pcre2_substring_copy_bynumber PCRE2_SUFFIX(pcre2_substring_copy_bynumber_)
@@ -690,6 +869,11 @@ pcre2_compile are called by application code. */
#define pcre2_substring_nametable_scan PCRE2_SUFFIX(pcre2_substring_nametable_scan_)
#define pcre2_substring_number_from_name PCRE2_SUFFIX(pcre2_substring_number_from_name_)
+/* Keep this old function name for backwards compatibility */
+#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
+
+/* Keep this obsolete function for backwards compatibility: it is now a noop. */
+#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
/* Now generate all three sets of width-specific structures and function
prototypes. */
@@ -700,6 +884,8 @@ PCRE2_STRUCTURE_LIST \
PCRE2_GENERAL_INFO_FUNCTIONS \
PCRE2_GENERAL_CONTEXT_FUNCTIONS \
PCRE2_COMPILE_CONTEXT_FUNCTIONS \
+PCRE2_CONVERT_CONTEXT_FUNCTIONS \
+PCRE2_CONVERT_FUNCTIONS \
PCRE2_MATCH_CONTEXT_FUNCTIONS \
PCRE2_COMPILE_FUNCTIONS \
PCRE2_PATTERN_INFO_FUNCTIONS \
@@ -729,6 +915,7 @@ PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
#undef PCRE2_GENERAL_INFO_FUNCTIONS
#undef PCRE2_GENERAL_CONTEXT_FUNCTIONS
#undef PCRE2_COMPILE_CONTEXT_FUNCTIONS
+#undef PCRE2_CONVERT_CONTEXT_FUNCTIONS
#undef PCRE2_MATCH_CONTEXT_FUNCTIONS
#undef PCRE2_COMPILE_FUNCTIONS
#undef PCRE2_PATTERN_INFO_FUNCTIONS
diff --git a/thirdparty/pcre2/src/pcre2_auto_possess.c b/thirdparty/pcre2/src/pcre2_auto_possess.c
index 64ec6dfbbc..23275a2e39 100644
--- a/thirdparty/pcre2/src/pcre2_auto_possess.c
+++ b/thirdparty/pcre2/src/pcre2_auto_possess.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -558,50 +558,74 @@ for(;;)
continue;
}
+ /* At the end of a branch, skip to the end of the group. */
+
if (c == OP_ALT)
{
do code += GET(code, 1); while (*code == OP_ALT);
c = *code;
}
+ /* Inspect the next opcode. */
+
switch(c)
{
- case OP_END:
- case OP_KETRPOS:
- /* TRUE only in greedy case. The non-greedy case could be replaced by
- an OP_EXACT, but it is probably not worth it. (And note that OP_EXACT
- uses more memory, which we cannot get at this stage.) */
+ /* We can always possessify a greedy iterator at the end of the pattern,
+ which is reached after skipping over the final OP_KET. A non-greedy
+ iterator must never be possessified. */
+ case OP_END:
return base_list[1] != 0;
+ /* When an iterator is at the end of certain kinds of group we can inspect
+ what follows the group by skipping over the closing ket. Note that this
+ does not apply to OP_KETRMAX or OP_KETRMIN because what follows any given
+ iteration is variable (could be another iteration or could be the next
+ item). As these two opcodes are not listed in the next switch, they will
+ end up as the next code to inspect, and return FALSE by virtue of being
+ unsupported. */
+
case OP_KET:
- /* If the bracket is capturing, and referenced by an OP_RECURSE, or
- it is an atomic sub-pattern (assert, once, etc.) the non-greedy case
- cannot be converted to a possessive form. */
+ case OP_KETRPOS:
+ /* The non-greedy case cannot be converted to a possessive form. */
if (base_list[1] == 0) return FALSE;
+ /* If the bracket is capturing it might be referenced by an OP_RECURSE
+ so its last iterator can never be possessified if the pattern contains
+ recursions. (This could be improved by keeping a list of group numbers that
+ are called by recursion.) */
+
switch(*(code - GET(code, 1)))
{
+ case OP_CBRA:
+ case OP_SCBRA:
+ case OP_CBRAPOS:
+ case OP_SCBRAPOS:
+ if (cb->had_recurse) return FALSE;
+ break;
+
+ /* Atomic sub-patterns and assertions can always auto-possessify their
+ last iterator. However, if the group was entered as a result of checking
+ a previous iterator, this is not possible. */
+
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
- case OP_ONCE_NC:
-
- /* Atomic sub-patterns and assertions can always auto-possessify their
- last iterator. However, if the group was entered as a result of checking
- a previous iterator, this is not possible. */
return !entered_a_group;
}
+ /* Skip over the bracket and inspect what comes next. */
+
code += PRIV(OP_lengths)[c];
continue;
+ /* Handle cases where the next item is a group. */
+
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRA:
case OP_CBRA:
next_code = code + GET(code, 1);
@@ -625,8 +649,8 @@ for(;;)
case OP_BRAMINZERO:
next_code = code + 1;
- if (*next_code != OP_BRA && *next_code != OP_CBRA
- && *next_code != OP_ONCE && *next_code != OP_ONCE_NC) return FALSE;
+ if (*next_code != OP_BRA && *next_code != OP_CBRA &&
+ *next_code != OP_ONCE) return FALSE;
do next_code += GET(next_code, 1); while (*next_code == OP_ALT);
@@ -639,11 +663,15 @@ for(;;)
code += PRIV(OP_lengths)[c];
continue;
+ /* The next opcode does not need special handling; fall through and use it
+ to see if the base can be possessified. */
+
default:
break;
}
- /* Check for a supported opcode, and load its properties. */
+ /* We now have the next appropriate opcode to compare with the base. Check
+ for a supported opcode, and load its properties. */
code = get_chr_property_list(code, utf, cb->fcc, list);
if (code == NULL) return FALSE; /* Unsupported */
@@ -1077,7 +1105,7 @@ for (;;)
{
c = *code;
- if (c > OP_TABLE_LENGTH) return -1; /* Something gone wrong */
+ if (c >= OP_TABLE_LENGTH) return -1; /* Something gone wrong */
if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
{
diff --git a/thirdparty/pcre2/src/pcre2_compile.c b/thirdparty/pcre2/src/pcre2_compile.c
index 6d98a68caa..87530fb584 100644
--- a/thirdparty/pcre2/src/pcre2_compile.c
+++ b/thirdparty/pcre2/src/pcre2_compile.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -160,7 +160,7 @@ the length of compiled items varies with this.
In the real compile phase, this workspace is not currently used. */
-#define COMPILE_WORK_SIZE (2048*LINK_SIZE) /* Size in code units */
+#define COMPILE_WORK_SIZE (3000*LINK_SIZE) /* Size in code units */
#define C16_WORK_SIZE \
((COMPILE_WORK_SIZE * sizeof(PCRE2_UCHAR))/sizeof(uint16_t))
@@ -690,17 +690,29 @@ static int posix_substitutes[] = {
#define POSIX_SUBSIZE (sizeof(posix_substitutes) / (2*sizeof(uint32_t)))
#endif /* SUPPORT_UNICODE */
-/* Masks for checking option settings. */
+/* Masks for checking option settings. When PCRE2_LITERAL is set, only a subset
+are allowed. */
+
+#define PUBLIC_LITERAL_COMPILE_OPTIONS \
+ (PCRE2_ANCHORED|PCRE2_AUTO_CALLOUT|PCRE2_CASELESS|PCRE2_ENDANCHORED| \
+ PCRE2_FIRSTLINE|PCRE2_LITERAL|PCRE2_NO_START_OPTIMIZE| \
+ PCRE2_NO_UTF_CHECK|PCRE2_USE_OFFSET_LIMIT|PCRE2_UTF)
#define PUBLIC_COMPILE_OPTIONS \
- (PCRE2_ANCHORED|PCRE2_ALLOW_EMPTY_CLASS|PCRE2_ALT_BSUX|PCRE2_ALT_CIRCUMFLEX| \
- PCRE2_ALT_VERBNAMES|PCRE2_AUTO_CALLOUT|PCRE2_CASELESS|PCRE2_DOLLAR_ENDONLY| \
- PCRE2_DOTALL|PCRE2_DUPNAMES|PCRE2_EXTENDED|PCRE2_FIRSTLINE| \
- PCRE2_MATCH_UNSET_BACKREF|PCRE2_MULTILINE|PCRE2_NEVER_BACKSLASH_C| \
- PCRE2_NEVER_UCP|PCRE2_NEVER_UTF|PCRE2_NO_AUTO_CAPTURE| \
- PCRE2_NO_AUTO_POSSESS|PCRE2_NO_DOTSTAR_ANCHOR|PCRE2_NO_START_OPTIMIZE| \
- PCRE2_NO_UTF_CHECK|PCRE2_UCP|PCRE2_UNGREEDY|PCRE2_USE_OFFSET_LIMIT| \
- PCRE2_UTF)
+ (PUBLIC_LITERAL_COMPILE_OPTIONS| \
+ PCRE2_ALLOW_EMPTY_CLASS|PCRE2_ALT_BSUX|PCRE2_ALT_CIRCUMFLEX| \
+ PCRE2_ALT_VERBNAMES|PCRE2_DOLLAR_ENDONLY|PCRE2_DOTALL|PCRE2_DUPNAMES| \
+ PCRE2_EXTENDED|PCRE2_EXTENDED_MORE|PCRE2_MATCH_UNSET_BACKREF| \
+ PCRE2_MULTILINE|PCRE2_NEVER_BACKSLASH_C|PCRE2_NEVER_UCP| \
+ PCRE2_NEVER_UTF|PCRE2_NO_AUTO_CAPTURE|PCRE2_NO_AUTO_POSSESS| \
+ PCRE2_NO_DOTSTAR_ANCHOR|PCRE2_UCP|PCRE2_UNGREEDY)
+
+#define PUBLIC_LITERAL_COMPILE_EXTRA_OPTIONS \
+ (PCRE2_EXTRA_MATCH_LINE|PCRE2_EXTRA_MATCH_WORD)
+
+#define PUBLIC_COMPILE_EXTRA_OPTIONS \
+ (PUBLIC_LITERAL_COMPILE_EXTRA_OPTIONS| \
+ PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES|PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL)
/* Compile time error code numbers. They are given names so that they can more
easily be tracked. When a new number is added, the tables called eint1 and
@@ -716,7 +728,8 @@ enum { ERR0 = COMPILE_ERROR_BASE,
ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59, ERR60,
ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70,
ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, ERR80,
- ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90 };
+ ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90,
+ ERR91, ERR92};
/* This is a table of start-of-pattern options such as (*UTF) and settings such
as (*LIMIT_MATCH=nnnn) and (*CRLF). For completeness and backward
@@ -727,8 +740,9 @@ enum { PSO_OPT, /* Value is an option bit */
PSO_FLG, /* Value is a flag bit */
PSO_NL, /* Value is a newline type */
PSO_BSR, /* Value is a \R type */
+ PSO_LIMH, /* Read integer value for heap limit */
PSO_LIMM, /* Read integer value for match limit */
- PSO_LIMR }; /* Read integer value for recursion limit */
+ PSO_LIMD }; /* Read integer value for depth limit */
typedef struct pso {
const uint8_t *name;
@@ -749,12 +763,15 @@ static pso pso_list[] = {
{ (uint8_t *)STRING_NO_DOTSTAR_ANCHOR_RIGHTPAR, 18, PSO_OPT, PCRE2_NO_DOTSTAR_ANCHOR },
{ (uint8_t *)STRING_NO_JIT_RIGHTPAR, 7, PSO_FLG, PCRE2_NOJIT },
{ (uint8_t *)STRING_NO_START_OPT_RIGHTPAR, 13, PSO_OPT, PCRE2_NO_START_OPTIMIZE },
+ { (uint8_t *)STRING_LIMIT_HEAP_EQ, 11, PSO_LIMH, 0 },
{ (uint8_t *)STRING_LIMIT_MATCH_EQ, 12, PSO_LIMM, 0 },
- { (uint8_t *)STRING_LIMIT_RECURSION_EQ, 16, PSO_LIMR, 0 },
+ { (uint8_t *)STRING_LIMIT_DEPTH_EQ, 12, PSO_LIMD, 0 },
+ { (uint8_t *)STRING_LIMIT_RECURSION_EQ, 16, PSO_LIMD, 0 },
{ (uint8_t *)STRING_CR_RIGHTPAR, 3, PSO_NL, PCRE2_NEWLINE_CR },
{ (uint8_t *)STRING_LF_RIGHTPAR, 3, PSO_NL, PCRE2_NEWLINE_LF },
{ (uint8_t *)STRING_CRLF_RIGHTPAR, 5, PSO_NL, PCRE2_NEWLINE_CRLF },
{ (uint8_t *)STRING_ANY_RIGHTPAR, 4, PSO_NL, PCRE2_NEWLINE_ANY },
+ { (uint8_t *)STRING_NUL_RIGHTPAR, 4, PSO_NL, PCRE2_NEWLINE_NUL },
{ (uint8_t *)STRING_ANYCRLF_RIGHTPAR, 8, PSO_NL, PCRE2_NEWLINE_ANYCRLF },
{ (uint8_t *)STRING_BSR_ANYCRLF_RIGHTPAR, 12, PSO_BSR, PCRE2_BSR_ANYCRLF },
{ (uint8_t *)STRING_BSR_UNICODE_RIGHTPAR, 12, PSO_BSR, PCRE2_BSR_UNICODE }
@@ -1470,7 +1487,10 @@ else
if (utf)
{
if (c > 0x10ffffU) *errorcodeptr = ERR77;
- else if (c >= 0xd800 && c <= 0xdfff) *errorcodeptr = ERR73;
+ else
+ if (c >= 0xd800 && c <= 0xdfff &&
+ (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0)
+ *errorcodeptr = ERR73;
}
else if (c > MAX_NON_UTF_CHAR) *errorcodeptr = ERR77;
}
@@ -1604,7 +1624,7 @@ else
if (c >= CHAR_8) break;
- /* Fall through with a digit less than 8 */
+ /* Fall through */
/* \0 always starts an octal number, but we may drop through to here with a
larger first octal digit. The original code used just to take the least
@@ -1659,7 +1679,8 @@ else
}
else if (ptr < ptrend && *ptr++ == CHAR_RIGHT_CURLY_BRACKET)
{
- if (utf && c >= 0xd800 && c <= 0xdfff)
+ if (utf && c >= 0xd800 && c <= 0xdfff && (cb == NULL ||
+ (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0))
{
ptr--;
*errorcodeptr = ERR73;
@@ -1728,7 +1749,8 @@ else
}
else if (ptr < ptrend && *ptr++ == CHAR_RIGHT_CURLY_BRACKET)
{
- if (utf && c >= 0xd800 && c <= 0xdfff)
+ if (utf && c >= 0xd800 && c <= 0xdfff && (cb == NULL ||
+ (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) == 0))
{
ptr--;
*errorcodeptr = ERR73;
@@ -1901,7 +1923,7 @@ if (c == CHAR_LEFT_CURLY_BRACKET)
{
if (ptr >= cb->end_pattern) goto ERROR_RETURN;
c = *ptr++;
- if (c == CHAR_NULL) goto ERROR_RETURN;
+ if (c == CHAR_NUL) goto ERROR_RETURN;
if (c == CHAR_RIGHT_CURLY_BRACKET) break;
name[i] = c;
}
@@ -2159,7 +2181,7 @@ the parsed pattern.
Arguments:
ptr current pattern pointer
pcalloutptr points to a pointer to previous callout, or NULL
- options the compiling options
+ auto_callout TRUE if auto_callouts are enabled
parsed_pattern the parsed pattern pointer
cb compile block
@@ -2167,15 +2189,15 @@ Returns: possibly updated parsed_pattern pointer.
*/
static uint32_t *
-manage_callouts(PCRE2_SPTR ptr, uint32_t **pcalloutptr, uint32_t options,
+manage_callouts(PCRE2_SPTR ptr, uint32_t **pcalloutptr, BOOL auto_callout,
uint32_t *parsed_pattern, compile_block *cb)
{
uint32_t *previous_callout = *pcalloutptr;
-if (previous_callout != NULL) previous_callout[2] = ptr - cb->start_pattern -
- (PCRE2_SIZE)previous_callout[1];
+if (previous_callout != NULL) previous_callout[2] = (uint32_t)(ptr -
+ cb->start_pattern - (PCRE2_SIZE)previous_callout[1]);
-if ((options & PCRE2_AUTO_CALLOUT) == 0) previous_callout = NULL; else
+if (!auto_callout) previous_callout = NULL; else
{
if (previous_callout == NULL ||
previous_callout != parsed_pattern - 4 ||
@@ -2223,12 +2245,17 @@ typedef struct nest_save {
uint16_t reset_group;
uint16_t max_group;
uint16_t flags;
+ uint32_t options;
} nest_save;
-#define NSF_RESET 0x0001u
-#define NSF_EXTENDED 0x0002u
-#define NSF_DUPNAMES 0x0004u
-#define NSF_CONDASSERT 0x0008u
+#define NSF_RESET 0x0001u
+#define NSF_CONDASSERT 0x0002u
+
+/* Of the options that are changeable within the pattern, these are tracked
+during parsing. The rest are used from META_OPTIONS items when compiling. */
+
+#define PARSE_TRACKED_OPTIONS \
+ (PCRE2_DUPNAMES|PCRE2_EXTENDED|PCRE2_EXTENDED_MORE|PCRE2_NO_AUTO_CAPTURE)
/* States used for analyzing ranges in character classes. The two OK values
must be last. */
@@ -2272,15 +2299,57 @@ int i;
BOOL inescq = FALSE;
BOOL inverbname = FALSE;
BOOL utf = (options & PCRE2_UTF) != 0;
+BOOL auto_callout = (options & PCRE2_AUTO_CALLOUT) != 0;
BOOL isdupname;
BOOL negate_class;
BOOL okquantifier = FALSE;
+PCRE2_SPTR thisptr;
PCRE2_SPTR name;
PCRE2_SPTR ptrend = cb->end_pattern;
PCRE2_SPTR verbnamestart = NULL; /* Value avoids compiler warning */
named_group *ng;
-nest_save *top_nest = NULL;
-nest_save *end_nests = (nest_save *)(cb->start_workspace + cb->workspace_size);
+nest_save *top_nest, *end_nests;
+
+/* Insert leading items for word and line matching (features provided for the
+benefit of pcre2grep). */
+
+if ((cb->cx->extra_options & PCRE2_EXTRA_MATCH_LINE) != 0)
+ {
+ *parsed_pattern++ = META_CIRCUMFLEX;
+ *parsed_pattern++ = META_NOCAPTURE;
+ }
+else if ((cb->cx->extra_options & PCRE2_EXTRA_MATCH_WORD) != 0)
+ {
+ *parsed_pattern++ = META_ESCAPE + ESC_b;
+ *parsed_pattern++ = META_NOCAPTURE;
+ }
+
+/* If the pattern is actually a literal string, process it separately to avoid
+cluttering up the main loop. */
+
+if ((options & PCRE2_LITERAL) != 0)
+ {
+ while (ptr < ptrend)
+ {
+ if (parsed_pattern >= parsed_pattern_end)
+ {
+ errorcode = ERR63; /* Internal error (parsed pattern overflow) */
+ goto FAILED;
+ }
+ thisptr = ptr;
+ GETCHARINCTEST(c, ptr);
+ if (auto_callout)
+ parsed_pattern = manage_callouts(thisptr, &previous_callout,
+ auto_callout, parsed_pattern, cb);
+ PARSED_LITERAL(c, parsed_pattern);
+ }
+ goto PARSED_END;
+ }
+
+/* Process a real regex which may contain meta-characters. */
+
+top_nest = NULL;
+end_nests = (nest_save *)(cb->start_workspace + cb->workspace_size);
/* The size of the nest_save structure might not be a factor of the size of the
workspace. Therefore we must round down end_nests so as to correctly avoid
@@ -2289,9 +2358,11 @@ creating a nest_save that spans the end of the workspace. */
end_nests = (nest_save *)((char *)end_nests -
((cb->workspace_size * sizeof(PCRE2_UCHAR)) % sizeof(nest_save)));
-/* Now scan the pattern */
+/* PCRE2_EXTENDED_MORE implies PCRE2_EXTENDED */
-*has_lookbehind = FALSE;
+if ((options & PCRE2_EXTENDED_MORE) != 0) options |= PCRE2_EXTENDED;
+
+/* Now scan the pattern */
while (ptr < ptrend)
{
@@ -2302,7 +2373,6 @@ while (ptr < ptrend)
uint32_t prev_meta_quantifier;
BOOL prev_okquantifier;
PCRE2_SPTR tempptr;
- PCRE2_SPTR thisptr;
PCRE2_SIZE offset;
if (parsed_pattern >= parsed_pattern_end)
@@ -2314,7 +2384,7 @@ while (ptr < ptrend)
if (nest_depth > cb->cx->parens_nest_limit)
{
errorcode = ERR19;
- goto FAILED;
+ goto FAILED; /* Parentheses too deeply nested */
}
/* Get next input character, save its position for callout handling. */
@@ -2341,8 +2411,8 @@ while (ptr < ptrend)
goto FAILED;
}
if (!inverbname && after_manual_callout-- <= 0)
- parsed_pattern = manage_callouts(thisptr, &previous_callout, options,
- parsed_pattern, cb);
+ parsed_pattern = manage_callouts(thisptr, &previous_callout,
+ auto_callout, parsed_pattern, cb);
PARSED_LITERAL(c, parsed_pattern);
meta_quantifier = 0;
}
@@ -2487,7 +2557,7 @@ while (ptr < ptrend)
!read_repeat_counts(&tempptr, ptrend, NULL, NULL, &errorcode))))
{
if (after_manual_callout-- <= 0)
- parsed_pattern = manage_callouts(thisptr, &previous_callout, options,
+ parsed_pattern = manage_callouts(thisptr, &previous_callout, auto_callout,
parsed_pattern, cb);
}
@@ -2571,11 +2641,23 @@ while (ptr < ptrend)
/* ---- Escape sequence ---- */
case CHAR_BACKSLASH:
+ tempptr = ptr;
escape = PRIV(check_escape)(&ptr, ptrend, &c, &errorcode, options,
FALSE, cb);
- if (errorcode != 0) goto FAILED;
+ if (errorcode != 0)
+ {
+ ESCAPE_FAILED:
+ if ((cb->cx->extra_options & PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL) == 0)
+ goto FAILED;
+ ptr = tempptr;
+ if (ptr >= ptrend) c = CHAR_BACKSLASH; else
+ {
+ GETCHARINCTEST(c, ptr); /* Get character value, increment pointer */
+ }
+ escape = 0; /* Treat as literal character */
+ }
- /* The escape was a data character. */
+ /* The escape was a data escape or literal character. */
if (escape == 0)
{
@@ -2627,12 +2709,12 @@ while (ptr < ptrend)
case ESC_C:
#ifdef NEVER_BACKSLASH_C
errorcode = ERR85;
- goto FAILED;
+ goto ESCAPE_FAILED;
#else
if ((options & PCRE2_NEVER_BACKSLASH_C) != 0)
{
errorcode = ERR83;
- goto FAILED;
+ goto ESCAPE_FAILED;
}
#endif
okquantifier = TRUE;
@@ -2642,7 +2724,7 @@ while (ptr < ptrend)
case ESC_X:
#ifndef SUPPORT_UNICODE
errorcode = ERR45; /* Supported only with Unicode support */
- goto FAILED;
+ goto ESCAPE_FAILED;
#endif
case ESC_H:
case ESC_h:
@@ -2707,7 +2789,7 @@ while (ptr < ptrend)
BOOL negated;
uint16_t ptype = 0, pdata = 0;
if (!get_ucp(&ptr, &negated, &ptype, &pdata, &errorcode, cb))
- goto FAILED;
+ goto ESCAPE_FAILED;
if (negated) escape = (escape == ESC_P)? ESC_p : ESC_P;
*parsed_pattern++ = META_ESCAPE + escape;
*parsed_pattern++ = (ptype << 16) | pdata;
@@ -2715,7 +2797,7 @@ while (ptr < ptrend)
}
#else
errorcode = ERR45;
- goto FAILED;
+ goto ESCAPE_FAILED;
#endif
break; /* End \P and \p */
@@ -2731,7 +2813,7 @@ while (ptr < ptrend)
*ptr != CHAR_LESS_THAN_SIGN && *ptr != CHAR_APOSTROPHE))
{
errorcode = (escape == ESC_g)? ERR57 : ERR69;
- goto FAILED;
+ goto ESCAPE_FAILED;
}
terminator = (*ptr == CHAR_LESS_THAN_SIGN)?
CHAR_GREATER_THAN_SIGN : (*ptr == CHAR_APOSTROPHE)?
@@ -2749,18 +2831,18 @@ while (ptr < ptrend)
if (p >= ptrend || *p != terminator)
{
errorcode = ERR57;
- goto FAILED;
+ goto ESCAPE_FAILED;
}
ptr = p;
goto SET_RECURSION;
}
- if (errorcode != 0) goto FAILED;
+ if (errorcode != 0) goto ESCAPE_FAILED;
}
/* Not a numerical recursion */
if (!read_name(&ptr, ptrend, terminator, &offset, &name, &namelen,
- &errorcode, cb)) goto FAILED;
+ &errorcode, cb)) goto ESCAPE_FAILED;
/* \k and \g when used with braces are back references, whereas \g used
with quotes or angle brackets is a recursion */
@@ -2772,7 +2854,7 @@ while (ptr < ptrend)
PUTOFFSET(offset, parsed_pattern);
okquantifier = TRUE;
- break;
+ break; /* End special escape processing */
}
break; /* End escape sequence processing */
@@ -2904,7 +2986,8 @@ while (ptr < ptrend)
/* Process a regular character class. If the first character is '^', set
the negation flag. If the first few characters (either before or after ^)
- are \Q\E or \E we skip them too. This makes for compatibility with Perl. */
+ are \Q\E or \E or space or tab in extended-more mode, we skip them too.
+ This makes for compatibility with Perl. */
negate_class = FALSE;
while (ptr < ptrend)
@@ -2919,6 +3002,9 @@ while (ptr < ptrend)
else
break;
}
+ else if ((options & PCRE2_EXTENDED_MORE) != 0 &&
+ (c == CHAR_SPACE || c == CHAR_HT)) /* Note: just these two */
+ continue;
else if (!negate_class && c == CHAR_CIRCUMFLEX_ACCENT)
negate_class = TRUE;
else break;
@@ -2966,6 +3052,12 @@ while (ptr < ptrend)
goto CLASS_LITERAL;
}
+ /* Skip over space and tab (only) in extended-more mode. */
+
+ if ((options & PCRE2_EXTENDED_MORE) != 0 &&
+ (c == CHAR_SPACE || c == CHAR_HT))
+ goto CLASS_CONTINUE;
+
/* Handle POSIX class names. Perl allows a negation extension of the
form [:^name:]. A square bracket that doesn't match the syntax is
treated as a literal. We also recognize the POSIX constructions
@@ -3013,21 +3105,23 @@ while (ptr < ptrend)
ptr = tempptr + 2;
/* Perl treats a hyphen after a POSIX class as a literal, not the
- start of a range. However, it gives a warning in its warning mode. PCRE
- does not have a warning mode, so we give an error, because this is
- likely an error on the user's part. */
+ start of a range. However, it gives a warning in its warning mode
+ unless the hyphen is the last character in the class. PCRE does not
+ have a warning mode, so we give an error, because this is likely an
+ error on the user's part. */
- if (ptr < ptrend && *ptr == CHAR_MINUS)
+ if (ptr < ptrend - 1 && *ptr == CHAR_MINUS &&
+ ptr[1] != CHAR_RIGHT_SQUARE_BRACKET)
{
errorcode = ERR50;
goto FAILED;
}
- /* Set "a hyphen is not the start of a range" just in case the POSIX
- class is followed by \E or \Q\E (possibly repeated - fuzzers do that
- kind of thing) and *then* a hyphen. This causes that hyphen to be
- treated as a literal. I don't think it's worth setting up special
- apparatus to do otherwise. */
+ /* Set "a hyphen is not the start of a range" for the -] case, and also
+ in case the POSIX class is followed by \E or \Q\E (possibly repeated -
+ fuzzers do that kind of thing) and *then* a hyphen. This causes that
+ hyphen to be treated as a literal. I don't think it's worth setting up
+ special apparatus to do otherwise. */
class_range_state = RANGE_NO;
@@ -3109,10 +3203,23 @@ while (ptr < ptrend)
else
{
+ tempptr = ptr;
escape = PRIV(check_escape)(&ptr, ptrend, &c, &errorcode,
options, TRUE, cb);
- if (errorcode != 0) goto FAILED;
+ if (errorcode != 0)
+ {
+ CLASS_ESCAPE_FAILED:
+ if ((cb->cx->extra_options & PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL) == 0)
+ goto FAILED;
+ ptr = tempptr;
+ if (ptr >= ptrend) c = CHAR_BACKSLASH; else
+ {
+ GETCHARINCTEST(c, ptr); /* Get character value, increment pointer */
+ }
+ escape = 0; /* Treat as literal character */
+ }
+
if (escape == 0) /* Escaped character code point is in c */
{
char_is_literal = FALSE;
@@ -3146,7 +3253,7 @@ while (ptr < ptrend)
if (class_range_state == RANGE_STARTED)
{
errorcode = ERR50;
- goto FAILED;
+ goto CLASS_ESCAPE_FAILED;
}
/* Of the remaining escapes, only those that define characters are
@@ -3157,7 +3264,7 @@ while (ptr < ptrend)
{
case ESC_N:
errorcode = ERR71; /* Not supported in a class */
- goto FAILED;
+ goto CLASS_ESCAPE_FAILED;
case ESC_H:
case ESC_h:
@@ -3220,13 +3327,24 @@ while (ptr < ptrend)
}
#else
errorcode = ERR45;
- goto FAILED;
+ goto CLASS_ESCAPE_FAILED;
#endif
break; /* End \P and \p */
default: /* All others are not allowed in a class */
errorcode = ERR7;
- goto FAILED_BACK;
+ ptr--;
+ goto CLASS_ESCAPE_FAILED;
+ }
+
+ /* Perl gives a warning unless a following hyphen is the last character
+ in the class. PCRE throws an error. */
+
+ if (ptr < ptrend - 1 && *ptr == CHAR_MINUS &&
+ ptr[1] != CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ errorcode = ERR50;
+ goto FAILED;
}
}
@@ -3384,8 +3502,7 @@ while (ptr < ptrend)
}
top_nest->nest_depth = nest_depth;
top_nest->flags = 0;
- if ((options & PCRE2_EXTENDED) != 0) top_nest->flags |= NSF_EXTENDED;
- if ((options & PCRE2_DUPNAMES) != 0) top_nest->flags |= NSF_DUPNAMES;
+ top_nest->options = options & PARSE_TRACKED_OPTIONS;
/* Start of non-capturing group that resets the capture count for each
branch. */
@@ -3400,9 +3517,7 @@ while (ptr < ptrend)
ptr++;
}
- /* Scan for options imsxJU. We need to keep track of (?x) and (?J) for
- use while scanning. The other options are used during the compiling
- phases. */
+ /* Scan for options imnsxJU to be set or unset. */
else
{
@@ -3425,16 +3540,36 @@ while (ptr < ptrend)
case CHAR_i: *optset |= PCRE2_CASELESS; break;
case CHAR_m: *optset |= PCRE2_MULTILINE; break;
+ case CHAR_n: *optset |= PCRE2_NO_AUTO_CAPTURE; break;
case CHAR_s: *optset |= PCRE2_DOTALL; break;
- case CHAR_x: *optset |= PCRE2_EXTENDED; break;
case CHAR_U: *optset |= PCRE2_UNGREEDY; break;
+ /* If x appears twice it sets the extended extended option. */
+
+ case CHAR_x:
+ *optset |= PCRE2_EXTENDED;
+ if (ptr < ptrend && *ptr == CHAR_x)
+ {
+ *optset |= PCRE2_EXTENDED_MORE;
+ ptr++;
+ }
+ break;
+
default:
errorcode = ERR11;
ptr--; /* Correct the offset */
goto FAILED;
}
}
+
+ /* If we are setting extended without extended-more, ensure that any
+ existing extended-more gets unset. Also, unsetting extended must also
+ unset extended-more. */
+
+ if ((set & (PCRE2_EXTENDED|PCRE2_EXTENDED_MORE)) == PCRE2_EXTENDED ||
+ (unset & PCRE2_EXTENDED) != 0)
+ unset |= PCRE2_EXTENDED_MORE;
+
options = (options | set) & (~unset);
/* If the options ended with ')' this is not the start of a nested
@@ -3671,7 +3806,7 @@ while (ptr < ptrend)
/* Remember the offset to the next item in the pattern, and set a default
length. This should get updated after the next item is read. */
- previous_callout[1] = ptr - cb->start_pattern;
+ previous_callout[1] = (uint32_t)(ptr - cb->start_pattern);
previous_callout[2] = 0;
break; /* End callout */
@@ -3913,8 +4048,7 @@ while (ptr < ptrend)
}
top_nest->nest_depth = nest_depth;
top_nest->flags = NSF_CONDASSERT;
- if ((options & PCRE2_EXTENDED) != 0) top_nest->flags |= NSF_EXTENDED;
- if ((options & PCRE2_DUPNAMES) != 0) top_nest->flags |= NSF_DUPNAMES;
+ top_nest->options = options & PARSE_TRACKED_OPTIONS;
}
break;
@@ -4035,20 +4169,17 @@ while (ptr < ptrend)
break;
/* End of group; reset the capture count to the maximum if we are in a (?|
- group and/or reset the extended and dupnames options. Disallow quantifier
- for a condition that is an assertion. */
+ group and/or reset the options that are tracked during parsing. Disallow
+ quantifier for a condition that is an assertion. */
case CHAR_RIGHT_PARENTHESIS:
okquantifier = TRUE;
if (top_nest != NULL && top_nest->nest_depth == nest_depth)
{
+ options = (options & ~PARSE_TRACKED_OPTIONS) | top_nest->options;
if ((top_nest->flags & NSF_RESET) != 0 &&
top_nest->max_group > cb->bracount)
cb->bracount = top_nest->max_group;
- if ((top_nest->flags & NSF_EXTENDED) != 0) options |= PCRE2_EXTENDED;
- else options &= ~PCRE2_EXTENDED;
- if ((top_nest->flags & NSF_DUPNAMES) != 0) options |= PCRE2_DUPNAMES;
- else options &= ~PCRE2_DUPNAMES;
if ((top_nest->flags & NSF_CONDASSERT) != 0)
okquantifier = FALSE;
if (top_nest == (nest_save *)(cb->start_workspace)) top_nest = NULL;
@@ -4075,9 +4206,24 @@ if (inverbname && ptr >= ptrend)
/* Manage callout for the final item */
-parsed_pattern = manage_callouts(ptr, &previous_callout, options,
+PARSED_END:
+parsed_pattern = manage_callouts(ptr, &previous_callout, auto_callout,
parsed_pattern, cb);
+/* Insert trailing items for word and line matching (features provided for the
+benefit of pcre2grep). */
+
+if ((cb->cx->extra_options & PCRE2_EXTRA_MATCH_LINE) != 0)
+ {
+ *parsed_pattern++ = META_KET;
+ *parsed_pattern++ = META_DOLLAR;
+ }
+else if ((cb->cx->extra_options & PCRE2_EXTRA_MATCH_WORD) != 0)
+ {
+ *parsed_pattern++ = META_KET;
+ *parsed_pattern++ = META_ESCAPE + ESC_b;
+ }
+
/* Terminate the parsed pattern, then return success if all groups are closed.
Otherwise we have unclosed parentheses. */
@@ -4086,6 +4232,7 @@ if (parsed_pattern >= parsed_pattern_end)
errorcode = ERR63; /* Internal error (parsed pattern overflow) */
goto FAILED;
}
+
*parsed_pattern = META_END;
if (nest_depth == 0) return 0;
@@ -4164,6 +4311,18 @@ for (;;)
code += GET(code, 1 + 2*LINK_SIZE);
break;
+ case OP_SKIPZERO:
+ code += 2 + GET(code, 2) + LINK_SIZE;
+ break;
+
+ case OP_COND:
+ case OP_SCOND:
+ if (code[1+LINK_SIZE] != OP_FALSE || /* Not DEFINE */
+ code[GET(code, 1)] != OP_KET) /* More than one branch */
+ return code;
+ code += GET(code, 1) + 1 + LINK_SIZE;
+ break;
+
default:
return code;
}
@@ -4746,7 +4905,6 @@ for (;; pptr++)
int class_has_8bitchar;
int i;
uint32_t mclength;
- uint32_t templastcapture;
uint32_t skipunits;
uint32_t subreqcu, subfirstcu;
uint32_t groupnumber;
@@ -5198,6 +5356,10 @@ for (;; pptr++)
options & ~PCRE2_CASELESS, cb, PRIV(vspace_list));
break;
+ /* If Unicode is not supported, \P and \p are not allowed and are
+ faulted at parse time, so will never appear here. */
+
+#ifdef SUPPORT_UNICODE
case ESC_p:
case ESC_P:
{
@@ -5206,12 +5368,11 @@ for (;; pptr++)
*class_uchardata++ = (escape == ESC_p)? XCL_PROP : XCL_NOTPROP;
*class_uchardata++ = ptype;
*class_uchardata++ = pdata;
-#ifdef SUPPORT_WIDE_CHARS
xclass_has_prop = TRUE;
-#endif
class_has_8bitchar--; /* Undo! */
}
break;
+#endif
}
goto CONTINUE_CLASS;
@@ -5438,14 +5599,17 @@ for (;; pptr++)
/* ===================================================================*/
/* Deal with (*VERB)s. */
- /* Check for open captures before ACCEPT and convert it to ASSERT_ACCEPT if
- in an assertion. In the first pass, just accumulate the length required;
+ /* Check for open captures before ACCEPT and close those that are within
+ the same assertion level, also converting ACCEPT to ASSERT_ACCEPT in an
+ assertion. In the first pass, just accumulate the length required;
otherwise hitting (*ACCEPT) inside many nested parentheses can cause
workspace overflow. Do not set firstcu after *ACCEPT. */
case META_ACCEPT:
cb->had_accept = TRUE;
- for (oc = cb->open_caps; oc != NULL; oc = oc->next)
+ for (oc = cb->open_caps;
+ oc != NULL && oc->assert_depth >= cb->assert_depth;
+ oc = oc->next)
{
if (lengthptr != NULL)
{
@@ -5753,7 +5917,6 @@ for (;; pptr++)
pptr++;
tempcode = code;
tempreqvary = cb->req_varyopt; /* Save value before group */
- templastcapture = cb->lastcapture; /* Save value before group */
length_prevgroup = 0; /* Initialize for pre-compile phase */
if ((group_return =
@@ -5783,12 +5946,6 @@ for (;; pptr++)
if (note_group_empty && bravalue != OP_COND && group_return > 0)
matched_char = TRUE;
- /* If that was an atomic group and there are no capturing groups within it,
- generate OP_ONCE_NC instead of OP_ONCE. */
-
- if (bravalue == OP_ONCE && cb->lastcapture <= templastcapture)
- *code = OP_ONCE_NC;
-
/* If we've just compiled an assertion, pop the assert depth. */
if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NOT)
@@ -6113,7 +6270,7 @@ for (;; pptr++)
}
else *callout_string++ = *pp++;
}
- *callout_string++ = CHAR_NULL;
+ *callout_string++ = CHAR_NUL;
/* Set the length of the entire item, the advance to its end. */
@@ -6209,24 +6366,6 @@ for (;; pptr++)
tempcode = previous;
op_previous = *previous;
- /* If previous was a recursion call, wrap it in atomic brackets so that
- previous becomes the atomic group. All recursions were so wrapped in the
- past, but it no longer happens for non-repeated recursions. In fact, the
- repeated ones could be re-implemented independently so as not to need this,
- but for the moment we rely on the code for repeating groups. */
-
- if (op_previous == OP_RECURSE)
- {
- memmove(previous + 1 + LINK_SIZE, previous, CU2BYTES(1 + LINK_SIZE));
- op_previous = *previous = OP_ONCE;
- PUT(previous, 1, 2 + 2*LINK_SIZE);
- previous[2 + 2*LINK_SIZE] = OP_KET;
- PUT(previous, 3 + 2*LINK_SIZE, 2 + 2*LINK_SIZE);
- code += 2 + 2 * LINK_SIZE;
- length_prevgroup = 3 + 3*LINK_SIZE;
- group_return = -1; /* Set "may match empty string" */
- }
-
/* Now handle repetition for the different types of item. */
switch (op_previous)
@@ -6311,6 +6450,77 @@ for (;; pptr++)
case OP_FAIL:
goto END_REPEAT;
+ /* Prior to 10.30, repeated recursions were wrapped in OP_ONCE brackets
+ because pcre2_match() could not handle backtracking into recursively
+ called groups. Now that this backtracking is available, we no longer need
+ to do this. However, we still need to replicate recursions as we do for
+ groups so as to have independent backtracking points. We can replicate
+ for the minimum number of repeats directly. For optional repeats we now
+ wrap the recursion in OP_BRA brackets and make use of the bracket
+ repetition. */
+
+ case OP_RECURSE:
+
+ /* Generate unwrapped repeats for a non-zero minimum, except when the
+ minimum is 1 and the maximum unlimited, because that can be handled with
+ OP_BRA terminated by OP_KETRMAX/MIN. When the maximum is equal to the
+ minimum, we just need to generate the appropriate additional copies.
+ Otherwise we need to generate one more, to simulate the situation when
+ the minimum is zero. */
+
+ if (repeat_min > 0 && (repeat_min != 1 || repeat_max != REPEAT_UNLIMITED))
+ {
+ int replicate = repeat_min;
+ if (repeat_min == repeat_max) replicate--;
+
+ /* In the pre-compile phase, we don't actually do the replication. We
+ just adjust the length as if we had. Do some paranoid checks for
+ potential integer overflow. The INT64_OR_DOUBLE type is a 64-bit
+ integer type when available, otherwise double. */
+
+ if (lengthptr != NULL)
+ {
+ PCRE2_SIZE delta = replicate*(1 + LINK_SIZE);
+ if ((INT64_OR_DOUBLE)replicate*
+ (INT64_OR_DOUBLE)(1 + LINK_SIZE) >
+ (INT64_OR_DOUBLE)INT_MAX ||
+ OFLOW_MAX - *lengthptr < delta)
+ {
+ *errorcodeptr = ERR20;
+ return 0;
+ }
+ *lengthptr += delta;
+ }
+
+ else for (i = 0; i < replicate; i++)
+ {
+ memcpy(code, previous, CU2BYTES(1 + LINK_SIZE));
+ previous = code;
+ code += 1 + LINK_SIZE;
+ }
+
+ /* If the number of repeats is fixed, we are done. Otherwise, adjust
+ the counts and fall through. */
+
+ if (repeat_min == repeat_max) break;
+ if (repeat_max != REPEAT_UNLIMITED) repeat_max -= repeat_min;
+ repeat_min = 0;
+ }
+
+ /* Wrap the recursion call in OP_BRA brackets. */
+
+ memmove(previous + 1 + LINK_SIZE, previous, CU2BYTES(1 + LINK_SIZE));
+ op_previous = *previous = OP_BRA;
+ PUT(previous, 1, 2 + 2*LINK_SIZE);
+ previous[2 + 2*LINK_SIZE] = OP_KET;
+ PUT(previous, 3 + 2*LINK_SIZE, 2 + 2*LINK_SIZE);
+ code += 2 + 2 * LINK_SIZE;
+ length_prevgroup = 3 + 3*LINK_SIZE;
+ group_return = -1; /* Set "may match empty string" */
+
+ /* Now treat as a repeated OP_BRA. */
+ /* Fall through */
+
/* If previous was a bracket group, we may have to replicate it in
certain cases. Note that at this point we can encounter only the "basic"
bracket opcodes such as BRA and CBRA, as this is the place where they get
@@ -6323,7 +6533,6 @@ for (;; pptr++)
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRA:
case OP_CBRA:
case OP_COND:
@@ -6340,10 +6549,10 @@ for (;; pptr++)
previous[GET(previous, 1)] != OP_ALT)
goto END_REPEAT;
- /* There is no sense in actually repeating assertions. The only potential
- use of repetition is in cases when the assertion is optional. Therefore,
- if the minimum is greater than zero, just ignore the repeat. If the
- maximum is not zero or one, set it to 1. */
+ /* There is no sense in actually repeating assertions. The only
+ potential use of repetition is in cases when the assertion is optional.
+ Therefore, if the minimum is greater than zero, just ignore the repeat.
+ If the maximum is not zero or one, set it to 1. */
if (op_previous < OP_ONCE) /* Assertion */
{
@@ -6567,14 +6776,12 @@ for (;; pptr++)
/* Convert possessive ONCE brackets to non-capturing */
- if ((*bracode == OP_ONCE || *bracode == OP_ONCE_NC) &&
- possessive_quantifier) *bracode = OP_BRA;
+ if (*bracode == OP_ONCE && possessive_quantifier) *bracode = OP_BRA;
/* For non-possessive ONCE brackets, all we need to do is to
set the KET. */
- if (*bracode == OP_ONCE || *bracode == OP_ONCE_NC)
- *ketcode = OP_KETRMAX + repeat_type;
+ if (*bracode == OP_ONCE) *ketcode = OP_KETRMAX + repeat_type;
/* Handle non-ONCE brackets and possessive ONCEs (which have been
converted to non-capturing above). */
@@ -6928,7 +7135,7 @@ for (;; pptr++)
later. */
HANDLE_SINGLE_REFERENCE:
- if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE;
+ if (firstcuflags == REQ_UNSET) zerofirstcuflags = firstcuflags = REQ_NONE;
*code++ = ((options & PCRE2_CASELESS) != 0)? OP_REFI : OP_REF;
PUT2INC(code, 0, meta_arg);
@@ -7143,7 +7350,6 @@ for (;; pptr++)
if (mclength == 1 || req_caseopt == 0)
{
- firstcu = mcbuffer[0] | req_caseopt;
firstcu = mcbuffer[0];
firstcuflags = req_caseopt;
if (mclength != 1)
@@ -7280,6 +7486,7 @@ if (*code == OP_CBRA)
capitem.number = capnumber;
capitem.next = cb->open_caps;
capitem.flag = FALSE;
+ capitem.assert_depth = cb->assert_depth;
cb->open_caps = &capitem;
}
@@ -7568,7 +7775,7 @@ do {
/* Atomic groups */
- else if (op == OP_ONCE || op == OP_ONCE_NC)
+ else if (op == OP_ONCE)
{
if (!is_anchored(scode, bracket_map, cb, atomcount + 1, inassert))
return FALSE;
@@ -7698,7 +7905,7 @@ do {
/* Atomic brackets */
- else if (op == OP_ONCE || op == OP_ONCE_NC)
+ else if (op == OP_ONCE)
{
if (!is_startline(scode, bracket_map, cb, atomcount + 1, inassert))
return FALSE;
@@ -7720,9 +7927,8 @@ do {
}
/* Check for explicit circumflex; anything else gives a FALSE result. Note
- in particular that this includes atomic brackets OP_ONCE and OP_ONCE_NC
- because the number of characters matched by .* cannot be adjusted inside
- them. */
+ in particular that this includes atomic brackets OP_ONCE because the number
+ of characters matched by .* cannot be adjusted inside them. */
else if (op != OP_CIRC && op != OP_CIRCM) return FALSE;
@@ -7900,13 +8106,13 @@ REQ_NONE in the flags.
Arguments:
code points to start of compiled pattern
flags points to the first code unit flags
- inassert TRUE if in an assertion
+ inassert non-zero if in an assertion
Returns: the fixed first code unit, or 0 with REQ_NONE in flags
*/
static uint32_t
-find_firstassertedcu(PCRE2_SPTR code, int32_t *flags, BOOL inassert)
+find_firstassertedcu(PCRE2_SPTR code, int32_t *flags, uint32_t inassert)
{
uint32_t c = 0;
int cflags = REQ_NONE;
@@ -7933,8 +8139,7 @@ do {
case OP_SCBRAPOS:
case OP_ASSERT:
case OP_ONCE:
- case OP_ONCE_NC:
- d = find_firstassertedcu(scode, &dflags, op == OP_ASSERT);
+ d = find_firstassertedcu(scode, &dflags, inassert + ((op==OP_ASSERT)?1:0));
if (dflags < 0)
return 0;
if (cflags < 0) { c = d; cflags = dflags; }
@@ -7949,7 +8154,7 @@ do {
case OP_PLUS:
case OP_MINPLUS:
case OP_POSPLUS:
- if (!inassert) return 0;
+ if (inassert == 0) return 0;
if (cflags < 0) { c = scode[1]; cflags = 0; }
else if (c != scode[1]) return 0;
break;
@@ -7962,7 +8167,7 @@ do {
case OP_PLUSI:
case OP_MINPLUSI:
case OP_POSPLUSI:
- if (!inassert) return 0;
+ if (inassert == 0) return 0;
if (cflags < 0) { c = scode[1]; cflags = REQ_CASELESS; }
else if (c != scode[1]) return 0;
break;
@@ -8049,6 +8254,10 @@ the end of the branch, it is called to skip over an internal lookaround, and it
is also called to skip to the end of a class, during which it will never
encounter nested groups (but there's no need to have special code for that).
+When called to find the end of a branch or group, pptr must point to the first
+meta code inside the branch, not the branch-starting code. In other cases it
+can point to the item that causes the function to be called.
+
Arguments:
pptr current pointer to skip from
skiptype PSKIP_CLASS when skipping to end of class
@@ -8065,7 +8274,7 @@ parsed_skip(uint32_t *pptr, uint32_t skiptype)
{
uint32_t nestlevel = 0;
-for (pptr += 1;; pptr++)
+for (;; pptr++)
{
uint32_t meta = META_CODE(*pptr);
@@ -8160,11 +8369,12 @@ return pptr;
/* This is called for nested groups within a branch of a lookbehind whose
length is being computed. If all the branches in the nested group have the same
length, that is OK. On entry, the pointer must be at the first element after
-the group initializing code. Caching is used to improve processing speed when
-the same capturing group occurs many times.
+the group initializing code. On exit it points to OP_KET. Caching is used to
+improve processing speed when the same capturing group occurs many times.
Arguments:
pptrptr pointer to pointer in the parsed pattern
+ isinline FALSE if a reference or recursion; TRUE for inline group
errcodeptr pointer to the errorcode
lcptr pointer to the loop counter
group number of captured group or -1 for a non-capturing group
@@ -8175,27 +8385,29 @@ Returns: the group length or a negative number
*/
static int
-get_grouplength(uint32_t **pptrptr, int *errcodeptr, int *lcptr,
+get_grouplength(uint32_t **pptrptr, BOOL isinline, int *errcodeptr, int *lcptr,
int group, parsed_recurse_check *recurses, compile_block *cb)
{
int branchlength;
int grouplength = -1;
/* The cache can be used only if there is no possibility of there being two
-groups with the same number. */
+groups with the same number. We do not need to set the end pointer for a group
+that is being processed as a back reference or recursion, but we must do so for
+an inline group. */
-if (group > 0)
+if (group > 0 && (cb->external_flags & PCRE2_DUPCAPUSED) == 0)
{
uint32_t groupinfo = cb->groupinfo[group];
- if ((cb->external_flags & PCRE2_DUPCAPUSED) == 0)
+ if ((groupinfo & GI_NOT_FIXED_LENGTH) != 0) return -1;
+ if ((groupinfo & GI_SET_FIXED_LENGTH) != 0)
{
- if ((groupinfo & GI_NOT_FIXED_LENGTH) != 0) return -1;
- if ((groupinfo & GI_SET_FIXED_LENGTH) != 0)
- return groupinfo & GI_FIXED_LENGTH_MASK;
+ if (isinline) *pptrptr = parsed_skip(*pptrptr, PSKIP_KET);
+ return groupinfo & GI_FIXED_LENGTH_MASK;
}
}
-/* Scan the group */
+/* Scan the group. In this case we find the end pointer of necessity. */
for(;;)
{
@@ -8353,11 +8565,12 @@ for (;; pptr++)
}
break;
- /* Lookaheads can be ignored. */
+ /* Lookaheads can be ignored, but we must start the skip inside the group
+ so that it isn't treated as a group within the branch. */
case META_LOOKAHEAD:
case META_LOOKAHEADNOT:
- pptr = parsed_skip(pptr, PSKIP_KET);
+ pptr = parsed_skip(pptr + 1, PSKIP_KET);
if (pptr == NULL) goto PARSED_SKIP_FAILED;
break;
@@ -8378,6 +8591,7 @@ for (;; pptr++)
case META_BACKREF_BYNAME:
if ((cb->external_options & PCRE2_MATCH_UNSET_BACKREF) != 0)
goto ISNOTFIXED;
+ /* Fall through */
case META_RECURSE_BYNAME:
{
@@ -8432,7 +8646,8 @@ for (;; pptr++)
goto RECURSE_OR_BACKREF_LENGTH;
}
- /* Fall through for groups >= 10 - picking up group twice does no harm. */
+ /* Fall through */
+ /* For groups >= 10 - picking up group twice does no harm. */
/* A true recursion implies not fixed length, but a subroutine call may
be OK. Back reference "recursions" are also failed. */
@@ -8455,15 +8670,24 @@ for (;; pptr++)
else if (*gptr == (META_CAPTURE | group)) break;
}
- gptrend = parsed_skip(gptr, PSKIP_KET);
+ /* We must start the search for the end of the group at the first meta code
+ inside the group. Otherwise it will be treated as an enclosed group. */
+
+ gptrend = parsed_skip(gptr + 1, PSKIP_KET);
if (gptrend == NULL) goto PARSED_SKIP_FAILED;
if (pptr > gptr && pptr < gptrend) goto ISNOTFIXED; /* Local recursion */
for (r = recurses; r != NULL; r = r->prev) if (r->groupptr == gptr) break;
if (r != NULL) goto ISNOTFIXED; /* Mutual recursion */
this_recurse.prev = recurses;
this_recurse.groupptr = gptr;
+
+ /* We do not need to know the position of the end of the group, that is,
+ gptr is not used after the call to get_grouplength(). Setting the second
+ argument FALSE stops it scanning for the end when the length can be found
+ in the cache. */
+
gptr++;
- grouplength = get_grouplength(&gptr, errcodeptr, lcptr, group,
+ grouplength = get_grouplength(&gptr, FALSE, errcodeptr, lcptr, group,
&this_recurse, cb);
if (grouplength < 0)
{
@@ -8500,7 +8724,8 @@ for (;; pptr++)
case META_NOCAPTURE:
pptr++;
CHECK_GROUP:
- grouplength = get_grouplength(&pptr, errcodeptr, lcptr, group, recurses, cb);
+ grouplength = get_grouplength(&pptr, TRUE, errcodeptr, lcptr, group,
+ recurses, cb);
if (grouplength < 0) return -1;
itemlength = grouplength;
break;
@@ -8760,7 +8985,7 @@ pcre2_compile(PCRE2_SPTR pattern, PCRE2_SIZE patlen, uint32_t options,
int *errorptr, PCRE2_SIZE *erroroffset, pcre2_compile_context *ccontext)
{
BOOL utf; /* Set TRUE for UTF mode */
-BOOL has_lookbehind; /* Set TRUE if a lookbehind is found */
+BOOL has_lookbehind = FALSE; /* Set TRUE if a lookbehind is found */
BOOL zero_terminated; /* Set TRUE for zero-terminated pattern */
pcre2_real_code *re = NULL; /* What we will return */
compile_block cb; /* "Static" compile-time data */
@@ -8782,8 +9007,9 @@ uint32_t firstcu, reqcu; /* Value of first/req code unit */
uint32_t setflags = 0; /* NL and BSR set flags */
uint32_t skipatstart; /* When checking (*UTF) etc */
+uint32_t limit_heap = UINT32_MAX;
uint32_t limit_match = UINT32_MAX; /* Unset match limits */
-uint32_t limit_recursion = UINT32_MAX;
+uint32_t limit_depth = UINT32_MAX;
int newline = 0; /* Unset; can be set by the pattern */
int bsr = 0; /* Unset; can be set by the pattern */
@@ -8821,18 +9047,27 @@ if (pattern == NULL)
return NULL;
}
+/* A NULL compile context means "use a default context" */
+
+if (ccontext == NULL)
+ ccontext = (pcre2_compile_context *)(&PRIV(default_compile_context));
+
/* Check that all undefined public option bits are zero. */
-if ((options & ~PUBLIC_COMPILE_OPTIONS) != 0)
+if ((options & ~PUBLIC_COMPILE_OPTIONS) != 0 ||
+ (ccontext->extra_options & ~PUBLIC_COMPILE_EXTRA_OPTIONS) != 0)
{
*errorptr = ERR17;
return NULL;
}
-/* A NULL compile context means "use a default context" */
-
-if (ccontext == NULL)
- ccontext = (pcre2_compile_context *)(&PRIV(default_compile_context));
+if ((options & PCRE2_LITERAL) != 0 &&
+ ((options & ~PUBLIC_LITERAL_COMPILE_OPTIONS) != 0 ||
+ (ccontext->extra_options & ~PUBLIC_LITERAL_COMPILE_EXTRA_OPTIONS) != 0))
+ {
+ *errorptr = ERR92;
+ return NULL;
+ }
/* A zero-terminated pattern is indicated by the special length value
PCRE2_ZERO_TERMINATED. Check for an overlong pattern. */
@@ -8907,10 +9142,11 @@ for (i = 0; i < 10; i++) cb.small_ref_offset[i] = PCRE2_UNSET;
/* --------------- Start looking at the pattern --------------- */
-/* Check for global one-time option settings at the start of the pattern, and
-remember the offset to the actual regex. With valgrind support, make the
-terminator of a zero-terminated pattern inaccessible. This catches bugs that
-would otherwise only show up for non-zero-terminated patterns. */
+/* Unless PCRE2_LITERAL is set, check for global one-time option settings at
+the start of the pattern, and remember the offset to the actual regex. With
+valgrind support, make the terminator of a zero-terminated pattern
+inaccessible. This catches bugs that would otherwise only show up for
+non-zero-terminated patterns. */
#ifdef SUPPORT_VALGRIND
if (zero_terminated) VALGRIND_MAKE_MEM_NOACCESS(pattern + patlen, CU2BYTES(1));
@@ -8919,70 +9155,75 @@ if (zero_terminated) VALGRIND_MAKE_MEM_NOACCESS(pattern + patlen, CU2BYTES(1));
ptr = pattern;
skipatstart = 0;
-while (patlen - skipatstart >= 2 &&
- ptr[skipatstart] == CHAR_LEFT_PARENTHESIS &&
- ptr[skipatstart+1] == CHAR_ASTERISK)
+if ((options & PCRE2_LITERAL) == 0)
{
- for (i = 0; i < sizeof(pso_list)/sizeof(pso); i++)
+ while (patlen - skipatstart >= 2 &&
+ ptr[skipatstart] == CHAR_LEFT_PARENTHESIS &&
+ ptr[skipatstart+1] == CHAR_ASTERISK)
{
- pso *p = pso_list + i;
-
- if (patlen - skipatstart - 2 >= p->length &&
- PRIV(strncmp_c8)(ptr+skipatstart+2, (char *)(p->name), p->length) == 0)
+ for (i = 0; i < sizeof(pso_list)/sizeof(pso); i++)
{
uint32_t c, pp;
+ pso *p = pso_list + i;
- skipatstart += p->length + 2;
- switch(p->type)
+ if (patlen - skipatstart - 2 >= p->length &&
+ PRIV(strncmp_c8)(ptr + skipatstart + 2, (char *)(p->name),
+ p->length) == 0)
{
- case PSO_OPT:
- cb.external_options |= p->value;
- break;
+ skipatstart += p->length + 2;
+ switch(p->type)
+ {
+ case PSO_OPT:
+ cb.external_options |= p->value;
+ break;
- case PSO_FLG:
- setflags |= p->value;
- break;
+ case PSO_FLG:
+ setflags |= p->value;
+ break;
- case PSO_NL:
- newline = p->value;
- setflags |= PCRE2_NL_SET;
- break;
+ case PSO_NL:
+ newline = p->value;
+ setflags |= PCRE2_NL_SET;
+ break;
- case PSO_BSR:
- bsr = p->value;
- setflags |= PCRE2_BSR_SET;
- break;
+ case PSO_BSR:
+ bsr = p->value;
+ setflags |= PCRE2_BSR_SET;
+ break;
- case PSO_LIMM:
- case PSO_LIMR:
- c = 0;
- pp = skipatstart;
- if (!IS_DIGIT(ptr[pp]))
- {
- errorcode = ERR60;
- ptr += pp;
- goto HAD_EARLY_ERROR;
- }
- while (IS_DIGIT(ptr[pp]))
- {
- if (c > UINT32_MAX / 10 - 1) break; /* Integer overflow */
- c = c*10 + (ptr[pp++] - CHAR_0);
- }
- if (ptr[pp++] != CHAR_RIGHT_PARENTHESIS)
- {
- errorcode = ERR60;
- ptr += pp;
- goto HAD_EARLY_ERROR;
+ case PSO_LIMM:
+ case PSO_LIMD:
+ case PSO_LIMH:
+ c = 0;
+ pp = skipatstart;
+ if (!IS_DIGIT(ptr[pp]))
+ {
+ errorcode = ERR60;
+ ptr += pp;
+ goto HAD_EARLY_ERROR;
+ }
+ while (IS_DIGIT(ptr[pp]))
+ {
+ if (c > UINT32_MAX / 10 - 1) break; /* Integer overflow */
+ c = c*10 + (ptr[pp++] - CHAR_0);
+ }
+ if (ptr[pp++] != CHAR_RIGHT_PARENTHESIS)
+ {
+ errorcode = ERR60;
+ ptr += pp;
+ goto HAD_EARLY_ERROR;
+ }
+ if (p->type == PSO_LIMH) limit_heap = c;
+ else if (p->type == PSO_LIMM) limit_match = c;
+ else limit_depth = c;
+ skipatstart += pp - skipatstart;
+ break;
}
- if (p->type == PSO_LIMM) limit_match = c;
- else limit_recursion = c;
- skipatstart += pp - skipatstart;
- break;
+ break; /* Out of the table scan loop */
}
- break; /* Out of the table scan loop */
}
+ if (i >= sizeof(pso_list)/sizeof(pso)) break; /* Out of pso loop */
}
- if (i >= sizeof(pso_list)/sizeof(pso)) break; /* Out of pso loop */
}
/* End of pattern-start options; advance to start of real regex. */
@@ -9000,7 +9241,9 @@ if ((cb.external_options & (PCRE2_UTF|PCRE2_UCP)) != 0)
#endif
/* Check UTF. We have the original options in 'options', with that value as
-modified by (*UTF) etc in cb->external_options. */
+modified by (*UTF) etc in cb->external_options. The extra option
+PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not permitted in UTF-16 mode because the
+surrogate code points cannot be represented in UTF-16. */
utf = (cb.external_options & PCRE2_UTF) != 0;
if (utf)
@@ -9013,6 +9256,14 @@ if (utf)
if ((options & PCRE2_NO_UTF_CHECK) == 0 &&
(errorcode = PRIV(valid_utf)(pattern, patlen, erroroffset)) != 0)
goto HAD_ERROR; /* Offset was set by valid_utf() */
+
+#if PCRE2_CODE_UNIT_WIDTH == 16
+ if ((ccontext->extra_options & PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES) != 0)
+ {
+ errorcode = ERR91;
+ goto HAD_EARLY_ERROR;
+ }
+#endif
}
/* Check UCP lockout. */
@@ -9044,6 +9295,11 @@ switch(newline)
cb.nl[0] = CHAR_NL;
break;
+ case PCRE2_NEWLINE_NUL:
+ cb.nllen = 1;
+ cb.nl[0] = CHAR_NUL;
+ break;
+
case PCRE2_NEWLINE_CRLF:
cb.nllen = 2;
cb.nl[0] = CHAR_CR;
@@ -9071,10 +9327,10 @@ and comments removed (amongst other things).
In all but one case, when PCRE2_AUTO_CALLOUT is not set, the number of unsigned
32-bit ints in the parsed pattern is bounded by the length of the pattern plus
-one (for the terminator). The exceptional case is when running in 32-bit,
-non-UTF mode, when literal characters greater than META_END (0x80000000) have
-to be coded as two units. In this case, therefore, we scan the pattern to check
-for such values. */
+one (for the terminator) plus four if PCRE2_EXTRA_WORD or PCRE2_EXTRA_LINE is
+set. The exceptional case is when running in 32-bit, non-UTF mode, when literal
+characters greater than META_END (0x80000000) have to be coded as two units. In
+this case, therefore, we scan the pattern to check for such values. */
#if PCRE2_CODE_UNIT_WIDTH == 32
if (!utf)
@@ -9091,6 +9347,11 @@ many smaller patterns the vector on the stack (which was set up above) can be
used. */
parsed_size_needed = patlen - skipatstart + big32count;
+
+if ((ccontext->extra_options &
+ (PCRE2_EXTRA_MATCH_WORD|PCRE2_EXTRA_MATCH_LINE)) != 0)
+ parsed_size_needed += 4;
+
if ((options & PCRE2_AUTO_CALLOUT) != 0)
parsed_size_needed = (parsed_size_needed + 1) * 5;
@@ -9199,7 +9460,8 @@ possible because nowadays we limit the maximum value of cb.names_found and
cb.name_entry_size. */
re_blocksize = sizeof(pcre2_real_code) +
- CU2BYTES(length + cb.names_found * cb.name_entry_size);
+ CU2BYTES(length +
+ (PCRE2_SIZE)cb.names_found * (PCRE2_SIZE)cb.name_entry_size);
re = (pcre2_real_code *)
ccontext->memctl.malloc(re_blocksize, ccontext->memctl.memory_data);
if (re == NULL)
@@ -9208,6 +9470,13 @@ if (re == NULL)
goto HAD_CB_ERROR;
}
+/* The compiler may put padding at the end of the pcre2_real_code structure in
+order to round it up to a multiple of 4 or 8 bytes. This means that when a
+compiled pattern is copied (for example, when serialized) undefined bytes are
+read, and this annoys debuggers such as valgrind. To avoid this, we explicitly
+write to the last 8 bytes of the structure before setting the fields. */
+
+memset((char *)re + sizeof(pcre2_real_code) - 8, 0, 8);
re->memctl = ccontext->memctl;
re->tables = tables;
re->executable_jit = NULL;
@@ -9216,9 +9485,11 @@ re->blocksize = re_blocksize;
re->magic_number = MAGIC_NUMBER;
re->compile_options = options;
re->overall_options = cb.external_options;
+re->extra_options = ccontext->extra_options;
re->flags = PCRE2_CODE_UNIT_WIDTH/8 | cb.external_flags | setflags;
+re->limit_heap = limit_heap;
re->limit_match = limit_match;
-re->limit_recursion = limit_recursion;
+re->limit_depth = limit_depth;
re->first_codeunit = 0;
re->last_codeunit = 0;
re->bsr_convention = bsr;
@@ -9390,16 +9661,21 @@ if ((re->overall_options & PCRE2_ANCHORED) == 0 &&
is_anchored(codestart, 0, &cb, 0, FALSE))
re->overall_options |= PCRE2_ANCHORED;
-/* If the pattern is still not anchored and we do not have a first code unit,
-see if there is one that is asserted (these are not saved during the compile
-because they can cause conflicts with actual literals that follow). This code
-need not be obeyed if PCRE2_NO_START_OPTIMIZE is set, as the data it would
-create will not be used. */
+/* Set up the first code unit or startline flag, the required code unit, and
+then study the pattern. This code need not be obeyed if PCRE2_NO_START_OPTIMIZE
+is set, as the data it would create will not be used. Note that a first code
+unit (but not the startline flag) is useful for anchored patterns because it
+can still give a quick "no match" and also avoid searching for a last code
+unit. */
-if ((re->overall_options & (PCRE2_ANCHORED|PCRE2_NO_START_OPTIMIZE)) == 0)
+if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
{
+ /* If we do not have a first code unit, see if there is one that is asserted
+ (these are not saved during the compile because they can cause conflicts with
+ actual literals that follow). */
+
if (firstcuflags < 0)
- firstcu = find_firstassertedcu(codestart, &firstcuflags, FALSE);
+ firstcu = find_firstassertedcu(codestart, &firstcuflags, 0);
/* Save the data for a first code unit. */
@@ -9430,52 +9706,50 @@ if ((re->overall_options & (PCRE2_ANCHORED|PCRE2_NO_START_OPTIMIZE)) == 0)
}
}
- /* When there is no first code unit, see if we can set the PCRE2_STARTLINE
- flag. This is helpful for multiline matches when all branches start with ^
- and also when all branches start with non-atomic .* for non-DOTALL matches
- when *PRUNE and SKIP are not present. (There is an option that disables this
- case.) */
+ /* When there is no first code unit, for non-anchored patterns, see if we can
+ set the PCRE2_STARTLINE flag. This is helpful for multiline matches when all
+ branches start with ^ and also when all branches start with non-atomic .* for
+ non-DOTALL matches when *PRUNE and SKIP are not present. (There is an option
+ that disables this case.) */
- else if (is_startline(codestart, 0, &cb, 0, FALSE))
+ else if ((re->overall_options & PCRE2_ANCHORED) == 0 &&
+ is_startline(codestart, 0, &cb, 0, FALSE))
re->flags |= PCRE2_STARTLINE;
- }
-/* Handle the "required code unit", if one is set. In the case of an anchored
-pattern, do this only if it follows a variable length item in the pattern.
-Again, skip this if PCRE2_NO_START_OPTIMIZE is set. */
+ /* Handle the "required code unit", if one is set. In the case of an anchored
+ pattern, do this only if it follows a variable length item in the pattern. */
-if (reqcuflags >= 0 &&
- ((re->overall_options & (PCRE2_ANCHORED|PCRE2_NO_START_OPTIMIZE)) == 0 ||
- (reqcuflags & REQ_VARY) != 0))
- {
- re->last_codeunit = reqcu;
- re->flags |= PCRE2_LASTSET;
+ if (reqcuflags >= 0 &&
+ ((re->overall_options & PCRE2_ANCHORED) == 0 ||
+ (reqcuflags & REQ_VARY) != 0))
+ {
+ re->last_codeunit = reqcu;
+ re->flags |= PCRE2_LASTSET;
- /* Handle caseless required code units as for first code units (above). */
+ /* Handle caseless required code units as for first code units (above). */
- if ((reqcuflags & REQ_CASELESS) != 0)
- {
- if (reqcu < 128 || (!utf && reqcu < 255))
+ if ((reqcuflags & REQ_CASELESS) != 0)
{
- if (cb.fcc[reqcu] != reqcu) re->flags |= PCRE2_LASTCASELESS;
- }
+ if (reqcu < 128 || (!utf && reqcu < 255))
+ {
+ if (cb.fcc[reqcu] != reqcu) re->flags |= PCRE2_LASTCASELESS;
+ }
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
- else if (reqcu <= MAX_UTF_CODE_POINT && UCD_OTHERCASE(reqcu) != reqcu)
- re->flags |= PCRE2_LASTCASELESS;
+ else if (reqcu <= MAX_UTF_CODE_POINT && UCD_OTHERCASE(reqcu) != reqcu)
+ re->flags |= PCRE2_LASTCASELESS;
#endif
+ }
}
- }
-/* Finally, unless PCRE2_NO_START_OPTIMIZE is set, study the compiled pattern
-to set up information such as a bitmap of starting code units and a minimum
-matching length. */
+ /* Finally, study the compiled pattern to set up information such as a bitmap
+ of starting code units and a minimum matching length. */
-if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0 &&
- PRIV(study)(re) != 0)
- {
- errorcode = ERR31;
- goto HAD_CB_ERROR;
- }
+ if (PRIV(study)(re) != 0)
+ {
+ errorcode = ERR31;
+ goto HAD_CB_ERROR;
+ }
+ } /* End of start-of-match optimizations. */
/* Control ends up here in all cases. When running under valgrind, make a
pattern's terminating zero defined again. If memory was obtained for the parsed
diff --git a/thirdparty/pcre2/src/pcre2_config.c b/thirdparty/pcre2/src/pcre2_config.c
index e99272f577..e487b10220 100644
--- a/thirdparty/pcre2/src/pcre2_config.c
+++ b/thirdparty/pcre2/src/pcre2_config.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -84,13 +84,16 @@ if (where == NULL) /* Requests a length */
return PCRE2_ERROR_BADOPTION;
case PCRE2_CONFIG_BSR:
+ case PCRE2_CONFIG_COMPILED_WIDTHS:
+ case PCRE2_CONFIG_DEPTHLIMIT:
+ case PCRE2_CONFIG_HEAPLIMIT:
case PCRE2_CONFIG_JIT:
case PCRE2_CONFIG_LINKSIZE:
case PCRE2_CONFIG_MATCHLIMIT:
+ case PCRE2_CONFIG_NEVER_BACKSLASH_C:
case PCRE2_CONFIG_NEWLINE:
case PCRE2_CONFIG_PARENSLIMIT:
- case PCRE2_CONFIG_RECURSIONLIMIT:
- case PCRE2_CONFIG_STACKRECURSE:
+ case PCRE2_CONFIG_STACKRECURSE: /* Obsolete */
case PCRE2_CONFIG_UNICODE:
return sizeof(uint32_t);
@@ -116,6 +119,28 @@ switch (what)
#endif
break;
+ case PCRE2_CONFIG_COMPILED_WIDTHS:
+ *((uint32_t *)where) = 0
+#ifdef SUPPORT_PCRE2_8
+ + 1
+#endif
+#ifdef SUPPORT_PCRE2_16
+ + 2
+#endif
+#ifdef SUPPORT_PCRE2_32
+ + 4
+#endif
+ ;
+ break;
+
+ case PCRE2_CONFIG_DEPTHLIMIT:
+ *((uint32_t *)where) = MATCH_LIMIT_DEPTH;
+ break;
+
+ case PCRE2_CONFIG_HEAPLIMIT:
+ *((uint32_t *)where) = HEAP_LIMIT;
+ break;
+
case PCRE2_CONFIG_JIT:
#ifdef SUPPORT_JIT
*((uint32_t *)where) = 1;
@@ -147,20 +172,23 @@ switch (what)
*((uint32_t *)where) = NEWLINE_DEFAULT;
break;
+ case PCRE2_CONFIG_NEVER_BACKSLASH_C:
+#ifdef NEVER_BACKSLASH_C
+ *((uint32_t *)where) = 1;
+#else
+ *((uint32_t *)where) = 0;
+#endif
+ break;
+
case PCRE2_CONFIG_PARENSLIMIT:
*((uint32_t *)where) = PARENS_NEST_LIMIT;
break;
- case PCRE2_CONFIG_RECURSIONLIMIT:
- *((uint32_t *)where) = MATCH_LIMIT_RECURSION;
- break;
+ /* This is now obsolete. The stack is no longer used via recursion for
+ handling backtracking in pcre2_match(). */
case PCRE2_CONFIG_STACKRECURSE:
-#ifdef HEAP_MATCH_RECURSE
*((uint32_t *)where) = 0;
-#else
- *((uint32_t *)where) = 1;
-#endif
break;
case PCRE2_CONFIG_UNICODE_VERSION:
diff --git a/thirdparty/pcre2/src/pcre2_context.c b/thirdparty/pcre2/src/pcre2_context.c
index ae050fe92c..2c14df0080 100644
--- a/thirdparty/pcre2/src/pcre2_context.c
+++ b/thirdparty/pcre2/src/pcre2_context.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -138,7 +138,8 @@ const pcre2_compile_context PRIV(default_compile_context) = {
PCRE2_UNSET, /* Max pattern length */
BSR_DEFAULT, /* Backslash R default */
NEWLINE_DEFAULT, /* Newline convention */
- PARENS_NEST_LIMIT }; /* As it says */
+ PARENS_NEST_LIMIT, /* As it says */
+ 0 }; /* Extra options */
/* The create function copies the default into the new memory, but must
override the default memory handling functions if a gcontext was provided. */
@@ -161,9 +162,6 @@ when no context is supplied to a match function. */
const pcre2_match_context PRIV(default_match_context) = {
{ default_malloc, default_free, NULL },
-#ifdef HEAP_MATCH_RECURSE
- { default_malloc, default_free, NULL },
-#endif
#ifdef SUPPORT_JIT
NULL,
NULL,
@@ -171,8 +169,9 @@ const pcre2_match_context PRIV(default_match_context) = {
NULL,
NULL,
PCRE2_UNSET, /* Offset limit */
+ HEAP_LIMIT,
MATCH_LIMIT,
- MATCH_LIMIT_RECURSION };
+ MATCH_LIMIT_DEPTH };
/* The create function copies the default into the new memory, but must
override the default memory handling functions if a gcontext was provided. */
@@ -190,6 +189,36 @@ return mcontext;
}
+/* A default convert context is set up to save having to initialize at run time
+when no context is supplied to the convert function. */
+
+const pcre2_convert_context PRIV(default_convert_context) = {
+ { default_malloc, default_free, NULL }, /* Default memory handling */
+#ifdef _WIN32
+ CHAR_BACKSLASH, /* Default path separator */
+ CHAR_GRAVE_ACCENT /* Default escape character */
+#else /* Not Windows */
+ CHAR_SLASH, /* Default path separator */
+ CHAR_BACKSLASH /* Default escape character */
+#endif
+ };
+
+/* The create function copies the default into the new memory, but must
+override the default memory handling functions if a gcontext was provided. */
+
+PCRE2_EXP_DEFN pcre2_convert_context * PCRE2_CALL_CONVENTION
+pcre2_convert_context_create(pcre2_general_context *gcontext)
+{
+pcre2_convert_context *ccontext = PRIV(memctl_malloc)(
+ sizeof(pcre2_real_convert_context), (pcre2_memctl *)gcontext);
+if (ccontext == NULL) return NULL;
+*ccontext = PRIV(default_convert_context);
+if (gcontext != NULL)
+ *((pcre2_memctl *)ccontext) = *((pcre2_memctl *)gcontext);
+return ccontext;
+}
+
+
/*************************************************
* Context copy functions *
*************************************************/
@@ -231,11 +260,22 @@ return new;
+PCRE2_EXP_DEFN pcre2_convert_context * PCRE2_CALL_CONVENTION
+pcre2_convert_context_copy(pcre2_convert_context *ccontext)
+{
+pcre2_convert_context *new =
+ ccontext->memctl.malloc(sizeof(pcre2_real_convert_context),
+ ccontext->memctl.memory_data);
+if (new == NULL) return NULL;
+memcpy(new, ccontext, sizeof(pcre2_real_convert_context));
+return new;
+}
+
+
/*************************************************
* Context free functions *
*************************************************/
-
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_general_context_free(pcre2_general_context *gcontext)
{
@@ -260,6 +300,12 @@ if (mcontext != NULL)
}
+PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
+pcre2_convert_context_free(pcre2_convert_context *ccontext)
+{
+if (ccontext != NULL)
+ ccontext->memctl.free(ccontext, ccontext->memctl.memory_data);
+}
/*************************************************
@@ -271,7 +317,7 @@ data is given. Only some of the functions are able to test the validity of the
data. */
-/* ------------ Compile contexts ------------ */
+/* ------------ Compile context ------------ */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_character_tables(pcre2_compile_context *ccontext,
@@ -313,6 +359,7 @@ switch(newline)
case PCRE2_NEWLINE_CRLF:
case PCRE2_NEWLINE_ANY:
case PCRE2_NEWLINE_ANYCRLF:
+ case PCRE2_NEWLINE_NUL:
ccontext->newline_convention = newline;
return 0;
@@ -329,6 +376,13 @@ return 0;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_set_compile_extra_options(pcre2_compile_context *ccontext, uint32_t options)
+{
+ccontext->extra_options = options;
+return 0;
+}
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_compile_recursion_guard(pcre2_compile_context *ccontext,
int (*guard)(uint32_t, void *), void *user_data)
{
@@ -338,7 +392,7 @@ return 0;
}
-/* ------------ Match contexts ------------ */
+/* ------------ Match context ------------ */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_callout(pcre2_match_context *mcontext,
@@ -350,6 +404,13 @@ return 0;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_set_heap_limit(pcre2_match_context *mcontext, uint32_t limit)
+{
+mcontext->heap_limit = limit;
+return 0;
+}
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_match_limit(pcre2_match_context *mcontext, uint32_t limit)
{
mcontext->match_limit = limit;
@@ -357,17 +418,26 @@ return 0;
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_set_depth_limit(pcre2_match_context *mcontext, uint32_t limit)
+{
+mcontext->depth_limit = limit;
+return 0;
+}
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_offset_limit(pcre2_match_context *mcontext, PCRE2_SIZE limit)
{
mcontext->offset_limit = limit;
return 0;
}
+/* This function became obsolete at release 10.30. It is kept as a synonym for
+backwards compatibility. */
+
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_limit(pcre2_match_context *mcontext, uint32_t limit)
{
-mcontext->recursion_limit = limit;
-return 0;
+return pcre2_set_depth_limit(mcontext, limit);
}
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
@@ -375,17 +445,32 @@ pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
void *(*mymalloc)(size_t, void *), void (*myfree)(void *, void *),
void *mydata)
{
-#ifdef HEAP_MATCH_RECURSE
-mcontext->stack_memctl.malloc = mymalloc;
-mcontext->stack_memctl.free = myfree;
-mcontext->stack_memctl.memory_data = mydata;
-#else
(void)mcontext;
(void)mymalloc;
(void)myfree;
(void)mydata;
-#endif
+return 0;
+}
+
+/* ------------ Convert context ------------ */
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_set_glob_separator(pcre2_convert_context *ccontext, uint32_t separator)
+{
+if (separator != CHAR_SLASH && separator != CHAR_BACKSLASH &&
+ separator != CHAR_DOT) return PCRE2_ERROR_BADDATA;
+ccontext->glob_separator = separator;
+return 0;
+}
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_set_glob_escape(pcre2_convert_context *ccontext, uint32_t escape)
+{
+if (escape > 255 || (escape != 0 && !ispunct(escape)))
+ return PCRE2_ERROR_BADDATA;
+ccontext->glob_escape = escape;
return 0;
}
/* End of pcre2_context.c */
+
diff --git a/thirdparty/pcre2/src/pcre2_convert.c b/thirdparty/pcre2/src/pcre2_convert.c
new file mode 100644
index 0000000000..bdf9b86df6
--- /dev/null
+++ b/thirdparty/pcre2/src/pcre2_convert.c
@@ -0,0 +1,1176 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+ Written by Philip Hazel
+ Original API code Copyright (c) 1997-2012 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pcre2_internal.h"
+
+#define TYPE_OPTIONS (PCRE2_CONVERT_GLOB| \
+ PCRE2_CONVERT_POSIX_BASIC|PCRE2_CONVERT_POSIX_EXTENDED)
+
+#define ALL_OPTIONS (PCRE2_CONVERT_UTF|PCRE2_CONVERT_NO_UTF_CHECK| \
+ PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR| \
+ PCRE2_CONVERT_GLOB_NO_STARSTAR| \
+ TYPE_OPTIONS)
+
+#define DUMMY_BUFFER_SIZE 100
+
+/* Generated pattern fragments */
+
+#define STR_BACKSLASH_A STR_BACKSLASH STR_A
+#define STR_BACKSLASH_z STR_BACKSLASH STR_z
+#define STR_COLON_RIGHT_SQUARE_BRACKET STR_COLON STR_RIGHT_SQUARE_BRACKET
+#define STR_DOT_STAR_LOOKBEHIND STR_DOT STR_ASTERISK STR_LEFT_PARENTHESIS STR_QUESTION_MARK STR_LESS_THAN_SIGN STR_EQUALS_SIGN
+#define STR_LOOKAHEAD_NOT_DOT STR_LEFT_PARENTHESIS STR_QUESTION_MARK STR_EXCLAMATION_MARK STR_BACKSLASH STR_DOT STR_RIGHT_PARENTHESIS
+#define STR_QUERY_s STR_LEFT_PARENTHESIS STR_QUESTION_MARK STR_s STR_RIGHT_PARENTHESIS
+#define STR_STAR_NUL STR_LEFT_PARENTHESIS STR_ASTERISK STR_N STR_U STR_L STR_RIGHT_PARENTHESIS
+
+/* States for range and POSIX processing */
+
+enum { RANGE_NOT_STARTED, RANGE_STARTING, RANGE_STARTED };
+enum { POSIX_START_REGEX, POSIX_ANCHORED, POSIX_NOT_BRACKET,
+ POSIX_CLASS_NOT_STARTED, POSIX_CLASS_STARTING, POSIX_CLASS_STARTED };
+
+/* Macro to add a character string to the output buffer, checking for overflow. */
+
+#define PUTCHARS(string) \
+ { \
+ for (s = (char *)(string); *s != 0; s++) \
+ { \
+ if (p >= endp) return PCRE2_ERROR_NOMEMORY; \
+ *p++ = *s; \
+ } \
+ }
+
+/* Literals that must be escaped: \ ? * + | . ^ $ { } [ ] ( ) */
+
+static const char *pcre2_escaped_literals =
+ STR_BACKSLASH STR_QUESTION_MARK STR_ASTERISK STR_PLUS
+ STR_VERTICAL_LINE STR_DOT STR_CIRCUMFLEX_ACCENT STR_DOLLAR_SIGN
+ STR_LEFT_CURLY_BRACKET STR_RIGHT_CURLY_BRACKET
+ STR_LEFT_SQUARE_BRACKET STR_RIGHT_SQUARE_BRACKET
+ STR_LEFT_PARENTHESIS STR_RIGHT_PARENTHESIS;
+
+/* Recognized escaped metacharacters in POSIX basic patterns. */
+
+static const char *posix_meta_escapes =
+ STR_LEFT_PARENTHESIS STR_RIGHT_PARENTHESIS
+ STR_LEFT_CURLY_BRACKET STR_RIGHT_CURLY_BRACKET
+ STR_1 STR_2 STR_3 STR_4 STR_5 STR_6 STR_7 STR_8 STR_9;
+
+
+
+/*************************************************
+* Convert a POSIX pattern *
+*************************************************/
+
+/* This function handles both basic and extended POSIX patterns.
+
+Arguments:
+ pattype the pattern type
+ pattern the pattern
+ plength length in code units
+ utf TRUE if UTF
+ use_buffer where to put the output
+ use_length length of use_buffer
+ bufflenptr where to put the used length
+ dummyrun TRUE if a dummy run
+ ccontext the convert context
+
+Returns: 0 => success
+ !0 => error code
+*/
+
+static int
+convert_posix(uint32_t pattype, PCRE2_SPTR pattern, PCRE2_SIZE plength,
+ BOOL utf, PCRE2_UCHAR *use_buffer, PCRE2_SIZE use_length,
+ PCRE2_SIZE *bufflenptr, BOOL dummyrun, pcre2_convert_context *ccontext)
+{
+char *s;
+PCRE2_SPTR posix = pattern;
+PCRE2_UCHAR *p = use_buffer;
+PCRE2_UCHAR *pp = p;
+PCRE2_UCHAR *endp = p + use_length - 1; /* Allow for trailing zero */
+PCRE2_SIZE convlength = 0;
+
+uint32_t bracount = 0;
+uint32_t posix_state = POSIX_START_REGEX;
+uint32_t lastspecial = 0;
+BOOL extended = (pattype & PCRE2_CONVERT_POSIX_EXTENDED) != 0;
+BOOL nextisliteral = FALSE;
+
+(void)utf; /* Not used when Unicode not supported */
+(void)ccontext; /* Not currently used */
+
+/* Initialize default for error offset as end of input. */
+
+*bufflenptr = plength;
+PUTCHARS(STR_STAR_NUL);
+
+/* Now scan the input. */
+
+while (plength > 0)
+ {
+ uint32_t c, sc;
+ int clength = 1;
+
+ /* Add in the length of the last item, then, if in the dummy run, pull the
+ pointer back to the start of the (temporary) buffer and then remember the
+ start of the next item. */
+
+ convlength += p - pp;
+ if (dummyrun) p = use_buffer;
+ pp = p;
+
+ /* Pick up the next character */
+
+#ifndef SUPPORT_UNICODE
+ c = *posix;
+#else
+ GETCHARLENTEST(c, posix, clength);
+#endif
+ posix += clength;
+ plength -= clength;
+
+ sc = nextisliteral? 0 : c;
+ nextisliteral = FALSE;
+
+ /* Handle a character within a class. */
+
+ if (posix_state >= POSIX_CLASS_NOT_STARTED)
+ {
+ if (c == CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ PUTCHARS(STR_RIGHT_SQUARE_BRACKET);
+ posix_state = POSIX_NOT_BRACKET;
+ }
+
+ /* Not the end of the class */
+
+ else
+ {
+ switch (posix_state)
+ {
+ case POSIX_CLASS_STARTED:
+ if (c <= 127 && islower(c)) break; /* Remain in started state */
+ posix_state = POSIX_CLASS_NOT_STARTED;
+ if (c == CHAR_COLON && plength > 0 &&
+ *posix == CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ PUTCHARS(STR_COLON_RIGHT_SQUARE_BRACKET);
+ plength--;
+ posix++;
+ continue; /* With next character after :] */
+ }
+ /* Fall through */
+
+ case POSIX_CLASS_NOT_STARTED:
+ if (c == CHAR_LEFT_SQUARE_BRACKET)
+ posix_state = POSIX_CLASS_STARTING;
+ break;
+
+ case POSIX_CLASS_STARTING:
+ if (c == CHAR_COLON) posix_state = POSIX_CLASS_STARTED;
+ break;
+ }
+
+ if (c == CHAR_BACKSLASH) PUTCHARS(STR_BACKSLASH);
+ if (p + clength > endp) return PCRE2_ERROR_NOMEMORY;
+ memcpy(p, posix - clength, CU2BYTES(clength));
+ p += clength;
+ }
+ }
+
+ /* Handle a character not within a class. */
+
+ else switch(sc)
+ {
+ case CHAR_LEFT_SQUARE_BRACKET:
+ PUTCHARS(STR_LEFT_SQUARE_BRACKET);
+
+#ifdef NEVER
+ /* We could handle special cases [[:<:]] and [[:>:]] (which PCRE does
+ support) but they are not part of POSIX 1003.1. */
+
+ if (plength >= 6)
+ {
+ if (posix[0] == CHAR_LEFT_SQUARE_BRACKET &&
+ posix[1] == CHAR_COLON &&
+ (posix[2] == CHAR_LESS_THAN_SIGN ||
+ posix[2] == CHAR_GREATER_THAN_SIGN) &&
+ posix[3] == CHAR_COLON &&
+ posix[4] == CHAR_RIGHT_SQUARE_BRACKET &&
+ posix[5] == CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ if (p + 6 > endp) return PCRE2_ERROR_NOMEMORY;
+ memcpy(p, posix, CU2BYTES(6));
+ p += 6;
+ posix += 6;
+ plength -= 6;
+ continue; /* With next character */
+ }
+ }
+#endif
+
+ /* Handle start of "normal" character classes */
+
+ posix_state = POSIX_CLASS_NOT_STARTED;
+
+ /* Handle ^ and ] as first characters */
+
+ if (plength > 0)
+ {
+ if (*posix == CHAR_CIRCUMFLEX_ACCENT)
+ {
+ posix++;
+ plength--;
+ PUTCHARS(STR_CIRCUMFLEX_ACCENT);
+ }
+ if (plength > 0 && *posix == CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ posix++;
+ plength--;
+ PUTCHARS(STR_RIGHT_SQUARE_BRACKET);
+ }
+ }
+ break;
+
+ case CHAR_BACKSLASH:
+ if (plength <= 0) return PCRE2_ERROR_END_BACKSLASH;
+ if (extended) nextisliteral = TRUE; else
+ {
+ if (*posix < 127 && strchr(posix_meta_escapes, *posix) != NULL)
+ {
+ if (isdigit(*posix)) PUTCHARS(STR_BACKSLASH);
+ if (p + 1 > endp) return PCRE2_ERROR_NOMEMORY;
+ lastspecial = *p++ = *posix++;
+ plength--;
+ }
+ else nextisliteral = TRUE;
+ }
+ break;
+
+ case CHAR_RIGHT_PARENTHESIS:
+ if (!extended || bracount == 0) goto ESCAPE_LITERAL;
+ bracount--;
+ goto COPY_SPECIAL;
+
+ case CHAR_LEFT_PARENTHESIS:
+ bracount++;
+ /* Fall through */
+
+ case CHAR_QUESTION_MARK:
+ case CHAR_PLUS:
+ case CHAR_LEFT_CURLY_BRACKET:
+ case CHAR_RIGHT_CURLY_BRACKET:
+ case CHAR_VERTICAL_LINE:
+ if (!extended) goto ESCAPE_LITERAL;
+ /* Fall through */
+
+ case CHAR_DOT:
+ case CHAR_DOLLAR_SIGN:
+ posix_state = POSIX_NOT_BRACKET;
+ COPY_SPECIAL:
+ lastspecial = c;
+ if (p + 1 > endp) return PCRE2_ERROR_NOMEMORY;
+ *p++ = c;
+ break;
+
+ case CHAR_ASTERISK:
+ if (lastspecial != CHAR_ASTERISK)
+ {
+ if (!extended && (posix_state < POSIX_NOT_BRACKET ||
+ lastspecial == CHAR_LEFT_PARENTHESIS))
+ goto ESCAPE_LITERAL;
+ goto COPY_SPECIAL;
+ }
+ break; /* Ignore second and subsequent asterisks */
+
+ case CHAR_CIRCUMFLEX_ACCENT:
+ if (extended) goto COPY_SPECIAL;
+ if (posix_state == POSIX_START_REGEX ||
+ lastspecial == CHAR_LEFT_PARENTHESIS)
+ {
+ posix_state = POSIX_ANCHORED;
+ goto COPY_SPECIAL;
+ }
+ /* Fall through */
+
+ default:
+ if (c < 128 && strchr(pcre2_escaped_literals, c) != NULL)
+ {
+ ESCAPE_LITERAL:
+ PUTCHARS(STR_BACKSLASH);
+ }
+ lastspecial = 0xff; /* Indicates nothing special */
+ if (p + clength > endp) return PCRE2_ERROR_NOMEMORY;
+ memcpy(p, posix - clength, CU2BYTES(clength));
+ p += clength;
+ posix_state = POSIX_NOT_BRACKET;
+ break;
+ }
+ }
+
+if (posix_state >= POSIX_CLASS_NOT_STARTED)
+ return PCRE2_ERROR_MISSING_SQUARE_BRACKET;
+convlength += p - pp; /* Final segment */
+*bufflenptr = convlength;
+*p++ = 0;
+return 0;
+}
+
+
+/*************************************************
+* Convert a glob pattern *
+*************************************************/
+
+/* Context for writing the output into a buffer. */
+
+typedef struct pcre2_output_context {
+ PCRE2_UCHAR *output; /* current output position */
+ PCRE2_SPTR output_end; /* output end */
+ PCRE2_SIZE output_size; /* size of the output */
+ uint8_t out_str[8]; /* string copied to the output */
+} pcre2_output_context;
+
+
+/* Write a character into the output.
+
+Arguments:
+ out output context
+ chr the next character
+*/
+
+static void
+convert_glob_write(pcre2_output_context *out, PCRE2_UCHAR chr)
+{
+out->output_size++;
+
+if (out->output < out->output_end)
+ *out->output++ = chr;
+}
+
+
+/* Write a string into the output.
+
+Arguments:
+ out output context
+ length length of out->out_str
+*/
+
+static void
+convert_glob_write_str(pcre2_output_context *out, PCRE2_SIZE length)
+{
+uint8_t *out_str = out->out_str;
+PCRE2_UCHAR *output = out->output;
+PCRE2_SPTR output_end = out->output_end;
+PCRE2_SIZE output_size = out->output_size;
+
+do
+ {
+ output_size++;
+
+ if (output < output_end)
+ *output++ = *out_str++;
+ }
+while (--length != 0);
+
+out->output = output;
+out->output_size = output_size;
+}
+
+
+/* Prints the separator into the output.
+
+Arguments:
+ out output context
+ separator glob separator
+ with_escape backslash is needed before separator
+*/
+
+static void
+convert_glob_print_separator(pcre2_output_context *out,
+ PCRE2_UCHAR separator, BOOL with_escape)
+{
+if (with_escape)
+ convert_glob_write(out, CHAR_BACKSLASH);
+
+convert_glob_write(out, separator);
+}
+
+
+/* Prints a wildcard into the output.
+
+Arguments:
+ out output context
+ separator glob separator
+ with_escape backslash is needed before separator
+*/
+
+static void
+convert_glob_print_wildcard(pcre2_output_context *out,
+ PCRE2_UCHAR separator, BOOL with_escape)
+{
+out->out_str[0] = CHAR_LEFT_SQUARE_BRACKET;
+out->out_str[1] = CHAR_CIRCUMFLEX_ACCENT;
+convert_glob_write_str(out, 2);
+
+convert_glob_print_separator(out, separator, with_escape);
+
+convert_glob_write(out, CHAR_RIGHT_SQUARE_BRACKET);
+}
+
+
+/* Parse a posix class.
+
+Arguments:
+ from starting point of scanning the range
+ pattern_end end of pattern
+ out output context
+
+Returns: >0 => class index
+ 0 => malformed class
+*/
+
+static int
+convert_glob_parse_class(PCRE2_SPTR *from, PCRE2_SPTR pattern_end,
+ pcre2_output_context *out)
+{
+static const char *posix_classes = "alnum:alpha:ascii:blank:cntrl:digit:"
+ "graph:lower:print:punct:space:upper:word:xdigit:";
+PCRE2_SPTR start = *from + 1;
+PCRE2_SPTR pattern = start;
+const char *class_ptr;
+PCRE2_UCHAR c;
+int class_index;
+
+while (TRUE)
+ {
+ if (pattern >= pattern_end) return 0;
+
+ c = *pattern++;
+
+ if (c < CHAR_a || c > CHAR_z) break;
+ }
+
+if (c != CHAR_COLON || pattern >= pattern_end ||
+ *pattern != CHAR_RIGHT_SQUARE_BRACKET)
+ return 0;
+
+class_ptr = posix_classes;
+class_index = 1;
+
+while (TRUE)
+ {
+ if (*class_ptr == CHAR_NUL) return 0;
+
+ pattern = start;
+
+ while (*pattern == (PCRE2_UCHAR) *class_ptr)
+ {
+ if (*pattern == CHAR_COLON)
+ {
+ pattern += 2;
+ start -= 2;
+
+ do convert_glob_write(out, *start++); while (start < pattern);
+
+ *from = pattern;
+ return class_index;
+ }
+ pattern++;
+ class_ptr++;
+ }
+
+ while (*class_ptr != CHAR_COLON) class_ptr++;
+ class_ptr++;
+ class_index++;
+ }
+}
+
+/* Checks whether the character is in the class.
+
+Arguments:
+ class_index class index
+ c character
+
+Returns: !0 => character is found in the class
+ 0 => otherwise
+*/
+
+static BOOL
+convert_glob_char_in_class(int class_index, PCRE2_UCHAR c)
+{
+switch (class_index)
+ {
+ case 1: return isalnum(c);
+ case 2: return isalpha(c);
+ case 3: return 1;
+ case 4: return c == CHAR_HT || c == CHAR_SPACE;
+ case 5: return iscntrl(c);
+ case 6: return isdigit(c);
+ case 7: return isgraph(c);
+ case 8: return islower(c);
+ case 9: return isprint(c);
+ case 10: return ispunct(c);
+ case 11: return isspace(c);
+ case 12: return isupper(c);
+ case 13: return isalnum(c) || c == CHAR_UNDERSCORE;
+ default: return isxdigit(c);
+ }
+}
+
+/* Parse a range of characters.
+
+Arguments:
+ from starting point of scanning the range
+ pattern_end end of pattern
+ out output context
+ separator glob separator
+ with_escape backslash is needed before separator
+
+Returns: 0 => success
+ !0 => error code
+*/
+
+static int
+convert_glob_parse_range(PCRE2_SPTR *from, PCRE2_SPTR pattern_end,
+ pcre2_output_context *out, BOOL utf, PCRE2_UCHAR separator,
+ BOOL with_escape, PCRE2_UCHAR escape, BOOL no_wildsep)
+{
+BOOL is_negative = FALSE;
+BOOL separator_seen = FALSE;
+BOOL has_prev_c;
+PCRE2_SPTR pattern = *from;
+PCRE2_SPTR char_start = NULL;
+uint32_t c, prev_c;
+int len, class_index;
+
+(void)utf; /* Avoid compiler warning. */
+
+if (pattern >= pattern_end)
+ {
+ *from = pattern;
+ return PCRE2_ERROR_MISSING_SQUARE_BRACKET;
+ }
+
+if (*pattern == CHAR_EXCLAMATION_MARK
+ || *pattern == CHAR_CIRCUMFLEX_ACCENT)
+ {
+ pattern++;
+
+ if (pattern >= pattern_end)
+ {
+ *from = pattern;
+ return PCRE2_ERROR_MISSING_SQUARE_BRACKET;
+ }
+
+ is_negative = TRUE;
+
+ out->out_str[0] = CHAR_LEFT_SQUARE_BRACKET;
+ out->out_str[1] = CHAR_CIRCUMFLEX_ACCENT;
+ len = 2;
+
+ if (!no_wildsep)
+ {
+ if (with_escape)
+ {
+ out->out_str[len] = CHAR_BACKSLASH;
+ len++;
+ }
+ out->out_str[len] = (uint8_t) separator;
+ }
+
+ convert_glob_write_str(out, len + 1);
+ }
+else
+ convert_glob_write(out, CHAR_LEFT_SQUARE_BRACKET);
+
+has_prev_c = FALSE;
+prev_c = 0;
+
+if (*pattern == CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ out->out_str[0] = CHAR_BACKSLASH;
+ out->out_str[1] = CHAR_RIGHT_SQUARE_BRACKET;
+ convert_glob_write_str(out, 2);
+ has_prev_c = TRUE;
+ prev_c = CHAR_RIGHT_SQUARE_BRACKET;
+ pattern++;
+ }
+
+while (pattern < pattern_end)
+ {
+ char_start = pattern;
+ GETCHARINCTEST(c, pattern);
+
+ if (c == CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ convert_glob_write(out, c);
+
+ if (!is_negative && !no_wildsep && separator_seen)
+ {
+ out->out_str[0] = CHAR_LEFT_PARENTHESIS;
+ out->out_str[1] = CHAR_QUESTION_MARK;
+ out->out_str[2] = CHAR_LESS_THAN_SIGN;
+ out->out_str[3] = CHAR_EXCLAMATION_MARK;
+ convert_glob_write_str(out, 4);
+
+ convert_glob_print_separator(out, separator, with_escape);
+ convert_glob_write(out, CHAR_RIGHT_PARENTHESIS);
+ }
+
+ *from = pattern;
+ return 0;
+ }
+
+ if (pattern >= pattern_end) break;
+
+ if (c == CHAR_LEFT_SQUARE_BRACKET && *pattern == CHAR_COLON)
+ {
+ *from = pattern;
+ class_index = convert_glob_parse_class(from, pattern_end, out);
+
+ if (class_index != 0)
+ {
+ pattern = *from;
+
+ has_prev_c = FALSE;
+ prev_c = 0;
+
+ if (!is_negative &&
+ convert_glob_char_in_class (class_index, separator))
+ separator_seen = TRUE;
+ continue;
+ }
+ }
+ else if (c == CHAR_MINUS && has_prev_c &&
+ *pattern != CHAR_RIGHT_SQUARE_BRACKET)
+ {
+ convert_glob_write(out, CHAR_MINUS);
+
+ char_start = pattern;
+ GETCHARINCTEST(c, pattern);
+
+ if (pattern >= pattern_end) break;
+
+ if (escape != 0 && c == escape)
+ {
+ char_start = pattern;
+ GETCHARINCTEST(c, pattern);
+ }
+ else if (c == CHAR_LEFT_SQUARE_BRACKET && *pattern == CHAR_COLON)
+ {
+ *from = pattern;
+ return PCRE2_ERROR_CONVERT_SYNTAX;
+ }
+
+ if (prev_c > c)
+ {
+ *from = pattern;
+ return PCRE2_ERROR_CONVERT_SYNTAX;
+ }
+
+ if (prev_c < separator && separator < c) separator_seen = TRUE;
+
+ has_prev_c = FALSE;
+ prev_c = 0;
+ }
+ else
+ {
+ if (escape != 0 && c == escape)
+ {
+ char_start = pattern;
+ GETCHARINCTEST(c, pattern);
+
+ if (pattern >= pattern_end) break;
+ }
+
+ has_prev_c = TRUE;
+ prev_c = c;
+ }
+
+ if (c == CHAR_LEFT_SQUARE_BRACKET || c == CHAR_RIGHT_SQUARE_BRACKET ||
+ c == CHAR_BACKSLASH || c == CHAR_MINUS)
+ convert_glob_write(out, CHAR_BACKSLASH);
+
+ if (c == separator) separator_seen = TRUE;
+
+ do convert_glob_write(out, *char_start++); while (char_start < pattern);
+ }
+
+*from = pattern;
+return PCRE2_ERROR_MISSING_SQUARE_BRACKET;
+}
+
+
+/* Prints a (*COMMIT) into the output.
+
+Arguments:
+ out output context
+*/
+
+static void
+convert_glob_print_commit(pcre2_output_context *out)
+{
+out->out_str[0] = CHAR_LEFT_PARENTHESIS;
+out->out_str[1] = CHAR_ASTERISK;
+out->out_str[2] = CHAR_C;
+out->out_str[3] = CHAR_O;
+out->out_str[4] = CHAR_M;
+out->out_str[5] = CHAR_M;
+out->out_str[6] = CHAR_I;
+out->out_str[7] = CHAR_T;
+convert_glob_write_str(out, 8);
+convert_glob_write(out, CHAR_RIGHT_PARENTHESIS);
+}
+
+
+/* Bash glob converter.
+
+Arguments:
+ pattype the pattern type
+ pattern the pattern
+ plength length in code units
+ utf TRUE if UTF
+ use_buffer where to put the output
+ use_length length of use_buffer
+ bufflenptr where to put the used length
+ dummyrun TRUE if a dummy run
+ ccontext the convert context
+
+Returns: 0 => success
+ !0 => error code
+*/
+
+static int
+convert_glob(uint32_t options, PCRE2_SPTR pattern, PCRE2_SIZE plength,
+ BOOL utf, PCRE2_UCHAR *use_buffer, PCRE2_SIZE use_length,
+ PCRE2_SIZE *bufflenptr, BOOL dummyrun, pcre2_convert_context *ccontext)
+{
+pcre2_output_context out;
+PCRE2_SPTR pattern_start = pattern;
+PCRE2_SPTR pattern_end = pattern + plength;
+PCRE2_UCHAR separator = ccontext->glob_separator;
+PCRE2_UCHAR escape = ccontext->glob_escape;
+PCRE2_UCHAR c;
+BOOL no_wildsep = (options & PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR) != 0;
+BOOL no_starstar = (options & PCRE2_CONVERT_GLOB_NO_STARSTAR) != 0;
+BOOL in_atomic = FALSE;
+BOOL after_starstar = FALSE;
+BOOL no_slash_z = FALSE;
+BOOL with_escape, is_start, after_separator;
+int result = 0;
+
+(void)utf; /* Avoid compiler warning. */
+
+#ifdef SUPPORT_UNICODE
+if (utf && (separator >= 128 || escape >= 128))
+ {
+ /* Currently only ASCII characters are supported. */
+ *bufflenptr = 0;
+ return PCRE2_ERROR_CONVERT_SYNTAX;
+ }
+#endif
+
+with_escape = strchr(pcre2_escaped_literals, separator) != NULL;
+
+/* Initialize default for error offset as end of input. */
+out.output = use_buffer;
+out.output_end = use_buffer + use_length;
+out.output_size = 0;
+
+out.out_str[0] = CHAR_LEFT_PARENTHESIS;
+out.out_str[1] = CHAR_QUESTION_MARK;
+out.out_str[2] = CHAR_s;
+out.out_str[3] = CHAR_RIGHT_PARENTHESIS;
+convert_glob_write_str(&out, 4);
+
+is_start = TRUE;
+
+if (pattern < pattern_end && pattern[0] == CHAR_ASTERISK)
+ {
+ if (no_wildsep)
+ is_start = FALSE;
+ else if (!no_starstar && pattern + 1 < pattern_end &&
+ pattern[1] == CHAR_ASTERISK)
+ is_start = FALSE;
+ }
+
+if (is_start)
+ {
+ out.out_str[0] = CHAR_BACKSLASH;
+ out.out_str[1] = CHAR_A;
+ convert_glob_write_str(&out, 2);
+ }
+
+while (pattern < pattern_end)
+ {
+ c = *pattern++;
+
+ if (c == CHAR_ASTERISK)
+ {
+ is_start = pattern == pattern_start + 1;
+
+ if (in_atomic)
+ {
+ convert_glob_write(&out, CHAR_RIGHT_PARENTHESIS);
+ in_atomic = FALSE;
+ }
+
+ if (!no_starstar && pattern < pattern_end && *pattern == CHAR_ASTERISK)
+ {
+ after_separator = is_start || (pattern[-2] == separator);
+
+ do pattern++; while (pattern < pattern_end &&
+ *pattern == CHAR_ASTERISK);
+
+ if (pattern >= pattern_end)
+ {
+ no_slash_z = TRUE;
+ break;
+ }
+
+ after_starstar = TRUE;
+
+ if (after_separator && escape != 0 && *pattern == escape &&
+ pattern + 1 < pattern_end && pattern[1] == separator)
+ pattern++;
+
+ if (is_start)
+ {
+ if (*pattern != separator) continue;
+
+ out.out_str[0] = CHAR_LEFT_PARENTHESIS;
+ out.out_str[1] = CHAR_QUESTION_MARK;
+ out.out_str[2] = CHAR_COLON;
+ out.out_str[3] = CHAR_BACKSLASH;
+ out.out_str[4] = CHAR_A;
+ out.out_str[5] = CHAR_VERTICAL_LINE;
+ convert_glob_write_str(&out, 6);
+
+ convert_glob_print_separator(&out, separator, with_escape);
+ convert_glob_write(&out, CHAR_RIGHT_PARENTHESIS);
+
+ pattern++;
+ continue;
+ }
+
+ convert_glob_print_commit(&out);
+
+ if (!after_separator || *pattern != separator)
+ {
+ out.out_str[0] = CHAR_DOT;
+ out.out_str[1] = CHAR_ASTERISK;
+ out.out_str[2] = CHAR_QUESTION_MARK;
+ convert_glob_write_str(&out, 3);
+ continue;
+ }
+
+ out.out_str[0] = CHAR_LEFT_PARENTHESIS;
+ out.out_str[1] = CHAR_QUESTION_MARK;
+ out.out_str[2] = CHAR_COLON;
+ out.out_str[3] = CHAR_DOT;
+ out.out_str[4] = CHAR_ASTERISK;
+ out.out_str[5] = CHAR_QUESTION_MARK;
+
+ convert_glob_write_str(&out, 6);
+
+ convert_glob_print_separator(&out, separator, with_escape);
+
+ out.out_str[0] = CHAR_RIGHT_PARENTHESIS;
+ out.out_str[1] = CHAR_QUESTION_MARK;
+ out.out_str[2] = CHAR_QUESTION_MARK;
+ convert_glob_write_str(&out, 3);
+
+ pattern++;
+ continue;
+ }
+
+ if (pattern < pattern_end && *pattern == CHAR_ASTERISK)
+ {
+ do pattern++; while (pattern < pattern_end &&
+ *pattern == CHAR_ASTERISK);
+ }
+
+ if (no_wildsep)
+ {
+ if (pattern >= pattern_end)
+ {
+ no_slash_z = TRUE;
+ break;
+ }
+
+ /* Start check must be after the end check. */
+ if (is_start) continue;
+ }
+
+ if (!is_start)
+ {
+ if (after_starstar)
+ {
+ out.out_str[0] = CHAR_LEFT_PARENTHESIS;
+ out.out_str[1] = CHAR_QUESTION_MARK;
+ out.out_str[2] = CHAR_GREATER_THAN_SIGN;
+ convert_glob_write_str(&out, 3);
+ in_atomic = TRUE;
+ }
+ else
+ convert_glob_print_commit(&out);
+ }
+
+ if (no_wildsep)
+ convert_glob_write(&out, CHAR_DOT);
+ else
+ convert_glob_print_wildcard(&out, separator, with_escape);
+
+ out.out_str[0] = CHAR_ASTERISK;
+ out.out_str[1] = CHAR_QUESTION_MARK;
+ if (pattern >= pattern_end)
+ out.out_str[1] = CHAR_PLUS;
+ convert_glob_write_str(&out, 2);
+ continue;
+ }
+
+ if (c == CHAR_QUESTION_MARK)
+ {
+ if (no_wildsep)
+ convert_glob_write(&out, CHAR_DOT);
+ else
+ convert_glob_print_wildcard(&out, separator, with_escape);
+ continue;
+ }
+
+ if (c == CHAR_LEFT_SQUARE_BRACKET)
+ {
+ result = convert_glob_parse_range(&pattern, pattern_end,
+ &out, utf, separator, with_escape, escape, no_wildsep);
+ if (result != 0) break;
+ continue;
+ }
+
+ if (escape != 0 && c == escape)
+ {
+ if (pattern >= pattern_end)
+ {
+ result = PCRE2_ERROR_CONVERT_SYNTAX;
+ break;
+ }
+ c = *pattern++;
+ }
+
+ if (c < 128 && strchr(pcre2_escaped_literals, c) != NULL)
+ convert_glob_write(&out, CHAR_BACKSLASH);
+
+ convert_glob_write(&out, c);
+ }
+
+if (result == 0)
+ {
+ if (!no_slash_z)
+ {
+ out.out_str[0] = CHAR_BACKSLASH;
+ out.out_str[1] = CHAR_z;
+ convert_glob_write_str(&out, 2);
+ }
+
+ if (in_atomic)
+ convert_glob_write(&out, CHAR_RIGHT_PARENTHESIS);
+
+ convert_glob_write(&out, CHAR_NUL);
+
+ if (!dummyrun && out.output_size != (PCRE2_SIZE) (out.output - use_buffer))
+ result = PCRE2_ERROR_NOMEMORY;
+ }
+
+if (result != 0)
+ {
+ *bufflenptr = pattern - pattern_start;
+ return result;
+ }
+
+*bufflenptr = out.output_size - 1;
+return 0;
+}
+
+
+/*************************************************
+* Convert pattern *
+*************************************************/
+
+/* This is the external-facing function for converting other forms of pattern
+into PCRE2 regular expression patterns. On error, the bufflenptr argument is
+used to return an offset in the original pattern.
+
+Arguments:
+ pattern the input pattern
+ plength length of input, or PCRE2_ZERO_TERMINATED
+ options options bits
+ buffptr pointer to pointer to output buffer
+ bufflenptr pointer to length of output buffer
+ ccontext convert context or NULL
+
+Returns: 0 for success, else an error code (+ve or -ve)
+*/
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_pattern_convert(PCRE2_SPTR pattern, PCRE2_SIZE plength, uint32_t options,
+ PCRE2_UCHAR **buffptr, PCRE2_SIZE *bufflenptr,
+ pcre2_convert_context *ccontext)
+{
+int i, rc;
+PCRE2_UCHAR dummy_buffer[DUMMY_BUFFER_SIZE];
+PCRE2_UCHAR *use_buffer = dummy_buffer;
+PCRE2_SIZE use_length = DUMMY_BUFFER_SIZE;
+BOOL utf = (options & PCRE2_CONVERT_UTF) != 0;
+uint32_t pattype = options & TYPE_OPTIONS;
+
+if (pattern == NULL || bufflenptr == NULL) return PCRE2_ERROR_NULL;
+if ((options & ~ALL_OPTIONS) != 0 || /* Undefined bit set */
+ (pattype & (~pattype+1)) != pattype || /* More than one type set */
+ pattype == 0) /* No type set */
+ {
+ *bufflenptr = 0; /* Error offset */
+ return PCRE2_ERROR_BADOPTION;
+ }
+
+if (plength == PCRE2_ZERO_TERMINATED) plength = PRIV(strlen)(pattern);
+if (ccontext == NULL) ccontext =
+ (pcre2_convert_context *)(&PRIV(default_convert_context));
+
+/* Check UTF if required. */
+
+#ifndef SUPPORT_UNICODE
+if (utf) return PCRE2_ERROR_UNICODE_NOT_SUPPORTED;
+#else
+if (utf && (options & PCRE2_CONVERT_NO_UTF_CHECK) == 0)
+ {
+ PCRE2_SIZE erroroffset;
+ rc = PRIV(valid_utf)(pattern, plength, &erroroffset);
+ if (rc != 0)
+ {
+ *bufflenptr = erroroffset;
+ return rc;
+ }
+ }
+#endif
+
+/* If buffptr is not NULL, and what it points to is not NULL, we are being
+provided with a buffer and a length, so set them as the buffer to use. */
+
+if (buffptr != NULL && *buffptr != NULL)
+ {
+ use_buffer = *buffptr;
+ use_length = *bufflenptr;
+ }
+
+/* Call an individual converter, either just once (if a buffer was provided or
+just the length is needed), or twice (if a memory allocation is required). */
+
+for (i = 0; i < 2; i++)
+ {
+ PCRE2_UCHAR *allocated;
+ BOOL dummyrun = buffptr == NULL || *buffptr == NULL;
+
+ switch(pattype)
+ {
+ case PCRE2_CONVERT_GLOB:
+ rc = convert_glob(options & ~PCRE2_CONVERT_GLOB, pattern, plength, utf,
+ use_buffer, use_length, bufflenptr, dummyrun, ccontext);
+ break;
+
+ case PCRE2_CONVERT_POSIX_BASIC:
+ case PCRE2_CONVERT_POSIX_EXTENDED:
+ rc = convert_posix(pattype, pattern, plength, utf, use_buffer, use_length,
+ bufflenptr, dummyrun, ccontext);
+ break;
+
+ default:
+ return PCRE2_ERROR_INTERNAL;
+ }
+
+ if (rc != 0 || /* Error */
+ buffptr == NULL || /* Just the length is required */
+ *buffptr != NULL) /* Buffer was provided or allocated */
+ return rc;
+
+ /* Allocate memory for the buffer, with hidden space for an allocator at
+ the start. The next time round the loop runs the conversion for real. */
+
+ allocated = PRIV(memctl_malloc)(sizeof(pcre2_memctl) +
+ (*bufflenptr + 1)*PCRE2_CODE_UNIT_WIDTH, (pcre2_memctl *)ccontext);
+ if (allocated == NULL) return PCRE2_ERROR_NOMEMORY;
+ *buffptr = (PCRE2_UCHAR *)(((char *)allocated) + sizeof(pcre2_memctl));
+
+ use_buffer = *buffptr;
+ use_length = *bufflenptr + 1;
+ }
+
+/* Control should never get here. */
+
+return PCRE2_ERROR_INTERNAL;
+}
+
+
+/*************************************************
+* Free converted pattern *
+*************************************************/
+
+/* This frees a converted pattern that was put in newly-allocated memory.
+
+Argument: the converted pattern
+Returns: nothing
+*/
+
+PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
+pcre2_converted_pattern_free(PCRE2_UCHAR *converted)
+{
+if (converted != NULL)
+ {
+ pcre2_memctl *memctl =
+ (pcre2_memctl *)((char *)converted - sizeof(pcre2_memctl));
+ memctl->free(memctl, memctl->memory_data);
+ }
+}
+
+/* End of pcre2_convert.c */
diff --git a/thirdparty/pcre2/src/pcre2_dfa_match.c b/thirdparty/pcre2/src/pcre2_dfa_match.c
index c909d61285..c6184ff5e9 100644
--- a/thirdparty/pcre2/src/pcre2_dfa_match.c
+++ b/thirdparty/pcre2/src/pcre2_dfa_match.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -83,7 +83,7 @@ in others, so I abandoned this code. */
#include "pcre2_internal.h"
#define PUBLIC_DFA_MATCH_OPTIONS \
- (PCRE2_ANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
+ (PCRE2_ANCHORED|PCRE2_ENDANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
PCRE2_NOTEMPTY_ATSTART|PCRE2_NO_UTF_CHECK|PCRE2_PARTIAL_HARD| \
PCRE2_PARTIAL_SOFT|PCRE2_DFA_SHORTEST|PCRE2_DFA_RESTART)
@@ -172,7 +172,7 @@ static const uint8_t coptable[] = {
0, /* Assert not */
0, /* Assert behind */
0, /* Assert behind not */
- 0, 0, /* ONCE, ONCE_NC */
+ 0, /* ONCE */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
0, 0, 0, 0, 0, /* SBRA, SBRAPOS, SCBRA, SCBRAPOS, SCOND */
0, 0, /* CREF, DNCREF */
@@ -245,7 +245,7 @@ static const uint8_t poptable[] = {
0, /* Assert not */
0, /* Assert behind */
0, /* Assert behind not */
- 0, 0, /* ONCE, ONCE_NC */
+ 0, /* ONCE */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
0, 0, 0, 0, 0, /* SBRA, SBRAPOS, SCBRA, SCBRAPOS, SCOND */
0, 0, /* CREF, DNCREF */
@@ -294,6 +294,66 @@ typedef struct stateblock {
/*************************************************
+* Process a callout *
+*************************************************/
+
+/* This function is called to perform a callout.
+
+Arguments:
+ code current code pointer
+ offsets points to current capture offsets
+ current_subject start of current subject match
+ ptr current position in subject
+ mb the match block
+ extracode extra code offset when called from condition
+ lengthptr where to return the callout length
+
+Returns: the return from the callout
+*/
+
+static int
+do_callout(PCRE2_SPTR code, PCRE2_SIZE *offsets, PCRE2_SPTR current_subject,
+ PCRE2_SPTR ptr, dfa_match_block *mb, PCRE2_SIZE extracode,
+ PCRE2_SIZE *lengthptr)
+{
+pcre2_callout_block *cb = mb->cb;
+
+*lengthptr = (code[extracode] == OP_CALLOUT)?
+ (PCRE2_SIZE)PRIV(OP_lengths)[OP_CALLOUT] :
+ (PCRE2_SIZE)GET(code, 1 + 2*LINK_SIZE + extracode);
+
+if (mb->callout == NULL) return 0; /* No callout provided */
+
+/* Fixed fields in the callout block are set once and for all at the start of
+matching. */
+
+cb->offset_vector = offsets;
+cb->start_match = (PCRE2_SIZE)(current_subject - mb->start_subject);
+cb->current_position = (PCRE2_SIZE)(ptr - mb->start_subject);
+cb->pattern_position = GET(code, 1 + extracode);
+cb->next_item_length = GET(code, 1 + LINK_SIZE + extracode);
+
+if (code[extracode] == OP_CALLOUT)
+ {
+ cb->callout_number = code[1 + 2*LINK_SIZE + extracode];
+ cb->callout_string_offset = 0;
+ cb->callout_string = NULL;
+ cb->callout_string_length = 0;
+ }
+else
+ {
+ cb->callout_number = 0;
+ cb->callout_string_offset = GET(code, 1 + 3*LINK_SIZE + extracode);
+ cb->callout_string = code + (1 + 4*LINK_SIZE + extracode) + 1;
+ cb->callout_string_length = *lengthptr - (1 + 4*LINK_SIZE) - 2;
+ }
+
+return (mb->callout)(cb, mb->callout_data);
+}
+
+
+
+/*************************************************
* Match a Regular Expression - DFA engine *
*************************************************/
@@ -375,14 +435,10 @@ internal_dfa_match(
{
stateblock *active_states, *new_states, *temp_states;
stateblock *next_active_state, *next_new_state;
-
const uint8_t *ctypes, *lcc, *fcc;
PCRE2_SPTR ptr;
PCRE2_SPTR end_code;
-PCRE2_SPTR first_op;
-
dfa_recursion_info new_recursive;
-
int active_count, new_count, match_count;
/* Some fields in the mb block are frequently referenced, so we load them into
@@ -400,7 +456,8 @@ BOOL utf = FALSE;
BOOL reset_could_continue = FALSE;
-if (rlevel++ > mb->match_limit_recursion) return PCRE2_ERROR_RECURSIONLIMIT;
+if (mb->match_call_count++ >= mb->match_limit) return PCRE2_ERROR_MATCHLIMIT;
+if (rlevel++ > mb->match_limit_depth) return PCRE2_ERROR_DEPTHLIMIT;
offsetcount &= (uint32_t)(-2); /* Round down */
wscount -= 2;
@@ -417,21 +474,15 @@ active_states = (stateblock *)(workspace + 2);
next_new_state = new_states = active_states + wscount;
new_count = 0;
-first_op = this_start_code + 1 + LINK_SIZE +
- ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA ||
- *this_start_code == OP_CBRAPOS || *this_start_code == OP_SCBRAPOS)
- ? IMM2_SIZE:0);
-
/* The first thing in any (sub) pattern is a bracket of some sort. Push all
the alternative states onto the list, and find out where the end is. This
makes is possible to use this function recursively, when we want to stop at a
matching internal ket rather than at the end.
-If the first opcode in the first alternative is OP_REVERSE, we are dealing with
-a backward assertion. In that case, we have to find out the maximum amount to
-move back, and set up each alternative appropriately. */
+If we are dealing with a backward assertion we have to find out the maximum
+amount to move back, and set up each alternative appropriately. */
-if (*first_op == OP_REVERSE)
+if (*this_start_code == OP_ASSERTBACK || *this_start_code == OP_ASSERTBACK_NOT)
{
size_t max_back = 0;
size_t gone_back;
@@ -457,7 +508,8 @@ if (*first_op == OP_REVERSE)
{
if (current_subject <= start_subject) break;
current_subject--;
- ACROSSCHAR(current_subject > start_subject, *current_subject, current_subject--);
+ ACROSSCHAR(current_subject > start_subject, current_subject,
+ current_subject--);
}
}
else
@@ -476,15 +528,17 @@ if (*first_op == OP_REVERSE)
if (current_subject < mb->start_used_ptr)
mb->start_used_ptr = current_subject;
- /* Now we can process the individual branches. */
+ /* Now we can process the individual branches. There will be an OP_REVERSE at
+ the start of each branch, except when the length of the branch is zero. */
end_code = this_start_code;
do
{
- size_t back = (size_t)GET(end_code, 2+LINK_SIZE);
+ uint32_t revlen = (end_code[1+LINK_SIZE] == OP_REVERSE)? 1 + LINK_SIZE : 0;
+ size_t back = (revlen == 0)? 0 : (size_t)GET(end_code, 2+LINK_SIZE);
if (back <= gone_back)
{
- int bstate = (int)(end_code - start_code + 2 + 2*LINK_SIZE);
+ int bstate = (int)(end_code - start_code + 1 + LINK_SIZE + revlen);
ADD_NEW_DATA(-bstate, 0, (int)(gone_back - back));
}
end_code += GET(end_code, 1);
@@ -697,7 +751,7 @@ for (;;)
case OP_TABLE_LENGTH +
((sizeof(coptable) == OP_TABLE_LENGTH) &&
(sizeof(poptable) == OP_TABLE_LENGTH)):
- break;
+ return 0;
/* ========================================================================== */
/* Reached a closing bracket. If not at the end of the pattern, carry
@@ -1371,25 +1425,14 @@ for (;;)
if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
if (clen > 0)
{
- uint32_t lgb, rgb;
- PCRE2_SPTR nptr = ptr + clen;
int ncount = 0;
if (count > 0 && codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSPLUS)
{
active_count--; /* Remove non-match possibility */
next_active_state--;
}
- lgb = UCD_GRAPHBREAK(c);
- while (nptr < end_subject)
- {
- dlen = 1;
- if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
- rgb = UCD_GRAPHBREAK(d);
- if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
- ncount++;
- lgb = rgb;
- nptr += dlen;
- }
+ (void)PRIV(extuni)(c, ptr + clen, mb->start_subject, end_subject, utf,
+ &ncount);
count++;
ADD_NEW_DATA(-state_offset, count, ncount);
}
@@ -1632,8 +1675,6 @@ for (;;)
ADD_ACTIVE(state_offset + 2, 0);
if (clen > 0)
{
- uint32_t lgb, rgb;
- PCRE2_SPTR nptr = ptr + clen;
int ncount = 0;
if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSSTAR ||
codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSQUERY)
@@ -1641,17 +1682,8 @@ for (;;)
active_count--; /* Remove non-match possibility */
next_active_state--;
}
- lgb = UCD_GRAPHBREAK(c);
- while (nptr < end_subject)
- {
- dlen = 1;
- if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
- rgb = UCD_GRAPHBREAK(d);
- if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
- ncount++;
- lgb = rgb;
- nptr += dlen;
- }
+ (void)PRIV(extuni)(c, ptr + clen, mb->start_subject, end_subject, utf,
+ &ncount);
ADD_NEW_DATA(-(state_offset + count), 0, ncount);
}
break;
@@ -1904,25 +1936,15 @@ for (;;)
count = current_state->count; /* Number already matched */
if (clen > 0)
{
- uint32_t lgb, rgb;
- PCRE2_SPTR nptr = ptr + clen;
+ PCRE2_SPTR nptr;
int ncount = 0;
if (codevalue == OP_EXTUNI_EXTRA + OP_TYPEPOSUPTO)
{
active_count--; /* Remove non-match possibility */
next_active_state--;
}
- lgb = UCD_GRAPHBREAK(c);
- while (nptr < end_subject)
- {
- dlen = 1;
- if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
- rgb = UCD_GRAPHBREAK(d);
- if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
- ncount++;
- lgb = rgb;
- nptr += dlen;
- }
+ nptr = PRIV(extuni)(c, ptr + clen, mb->start_subject, end_subject, utf,
+ &ncount);
if (nptr >= end_subject && (mb->moptions & PCRE2_PARTIAL_HARD) != 0)
reset_could_continue = TRUE;
if (++count >= (int)GET2(code, 1))
@@ -2099,20 +2121,9 @@ for (;;)
case OP_EXTUNI:
if (clen > 0)
{
- uint32_t lgb, rgb;
- PCRE2_SPTR nptr = ptr + clen;
int ncount = 0;
- lgb = UCD_GRAPHBREAK(c);
- while (nptr < end_subject)
- {
- dlen = 1;
- if (!utf) d = *nptr; else { GETCHARLEN(d, nptr, dlen); }
- rgb = UCD_GRAPHBREAK(d);
- if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
- ncount++;
- lgb = rgb;
- nptr += dlen;
- }
+ PCRE2_SPTR nptr = PRIV(extuni)(c, ptr + clen, mb->start_subject,
+ end_subject, utf, &ncount);
if (nptr >= end_subject && (mb->moptions & PCRE2_PARTIAL_HARD) != 0)
reset_could_continue = TRUE;
ADD_NEW_DATA(-(state_offset + 1), 0, ncount);
@@ -2136,6 +2147,7 @@ for (;;)
case 0x2029:
#endif /* Not EBCDIC */
if (mb->bsr_convention == PCRE2_BSR_ANYCRLF) break;
+ /* Fall through */
case CHAR_LF:
ADD_NEW(state_offset + 1, 0);
@@ -2225,7 +2237,7 @@ for (;;)
case OP_NOTI:
if (clen > 0)
{
- unsigned int otherd;
+ uint32_t otherd;
#ifdef SUPPORT_UNICODE
if (utf && d >= 128)
otherd = UCD_OTHERCASE(d);
@@ -2539,11 +2551,13 @@ for (;;)
if (isinclass)
{
int max = (int)GET2(ecode, 1 + IMM2_SIZE);
- if (*ecode == OP_CRPOSRANGE)
+
+ if (*ecode == OP_CRPOSRANGE && count >= (int)GET2(ecode, 1))
{
active_count--; /* Remove non-match possibility */
next_active_state--;
}
+
if (++count >= max && max != 0) /* Max 0 => no limit */
{ ADD_NEW(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
else
@@ -2613,45 +2627,10 @@ for (;;)
if (code[LINK_SIZE + 1] == OP_CALLOUT
|| code[LINK_SIZE + 1] == OP_CALLOUT_STR)
{
- PCRE2_SIZE callout_length = (code[LINK_SIZE + 1] == OP_CALLOUT)?
- (PCRE2_SIZE)PRIV(OP_lengths)[OP_CALLOUT] :
- (PCRE2_SIZE)GET(code, 2 + 3*LINK_SIZE);
-
- rrc = 0;
- if (mb->callout != NULL)
- {
- pcre2_callout_block cb;
- cb.version = 1;
- cb.capture_top = 1;
- cb.capture_last = 0;
- cb.offset_vector = offsets;
- cb.mark = NULL; /* No (*MARK) support */
- cb.subject = start_subject;
- cb.subject_length = (PCRE2_SIZE)(end_subject - start_subject);
- cb.start_match = (PCRE2_SIZE)(current_subject - start_subject);
- cb.current_position = (PCRE2_SIZE)(ptr - start_subject);
- cb.pattern_position = GET(code, LINK_SIZE + 2);
- cb.next_item_length = GET(code, LINK_SIZE + 2 + LINK_SIZE);
-
- if (code[LINK_SIZE + 1] == OP_CALLOUT)
- {
- cb.callout_number = code[2 + 3*LINK_SIZE];
- cb.callout_string_offset = 0;
- cb.callout_string = NULL;
- cb.callout_string_length = 0;
- }
- else
- {
- cb.callout_number = 0;
- cb.callout_string_offset = GET(code, 2 + 4*LINK_SIZE);
- cb.callout_string = code + (2 + 5*LINK_SIZE) + 1;
- cb.callout_string_length =
- callout_length - (1 + 4*LINK_SIZE) - 2;
- }
-
- if ((rrc = (mb->callout)(&cb, mb->callout_data)) < 0)
- return rrc; /* Abandon */
- }
+ PCRE2_SIZE callout_length;
+ rrc = do_callout(code, offsets, current_subject, ptr, mb,
+ 1 + LINK_SIZE, &callout_length);
+ if (rrc < 0) return rrc; /* Abandon */
if (rrc > 0) break; /* Fail this thread */
code += callout_length; /* Skip callout data */
}
@@ -2889,7 +2868,6 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_ONCE:
- case OP_ONCE_NC:
{
PCRE2_SIZE local_offsets[2];
int local_workspace[1000];
@@ -2984,44 +2962,10 @@ for (;;)
case OP_CALLOUT:
case OP_CALLOUT_STR:
{
- unsigned int callout_length = (*code == OP_CALLOUT)
- ? PRIV(OP_lengths)[OP_CALLOUT] : GET(code, 1 + 2*LINK_SIZE);
- rrc = 0;
-
- if (mb->callout != NULL)
- {
- pcre2_callout_block cb;
- cb.version = 1;
- cb.capture_top = 1;
- cb.capture_last = 0;
- cb.offset_vector = offsets;
- cb.mark = NULL; /* No (*MARK) support */
- cb.subject = start_subject;
- cb.subject_length = (PCRE2_SIZE)(end_subject - start_subject);
- cb.start_match = (PCRE2_SIZE)(current_subject - start_subject);
- cb.current_position = (PCRE2_SIZE)(ptr - start_subject);
- cb.pattern_position = GET(code, 1);
- cb.next_item_length = GET(code, 1 + LINK_SIZE);
-
- if (*code == OP_CALLOUT)
- {
- cb.callout_number = code[1 + 2*LINK_SIZE];
- cb.callout_string_offset = 0;
- cb.callout_string = NULL;
- cb.callout_string_length = 0;
- }
- else
- {
- cb.callout_number = 0;
- cb.callout_string_offset = GET(code, 1 + 3*LINK_SIZE);
- cb.callout_string = code + (1 + 4*LINK_SIZE) + 1;
- cb.callout_string_length =
- callout_length - (1 + 4*LINK_SIZE) - 2;
- }
-
- if ((rrc = (mb->callout)(&cb, mb->callout_data)) < 0)
- return rrc; /* Abandon */
- }
+ PCRE2_SIZE callout_length;
+ rrc = do_callout(code, offsets, current_subject, ptr, mb, 0,
+ &callout_length);
+ if (rrc < 0) return rrc; /* Abandon */
if (rrc == 0)
{ ADD_ACTIVE(state_offset + (int)callout_length, 0); }
}
@@ -3069,7 +3013,7 @@ for (;;)
)
)
match_count = PCRE2_ERROR_PARTIAL;
- break; /* In effect, "return", but see the comment below */
+ break; /* Exit from loop along the subject string */
}
/* One or more states are active for the next character. */
@@ -3077,11 +3021,13 @@ for (;;)
ptr += clen; /* Advance to next subject character */
} /* Loop to move along the subject string */
-/* Control gets here from "break" a few lines above. We do it this way because
-if we use "return" above, we have compiler trouble. Some compilers warn if
-there's nothing here because they think the function doesn't return a value. On
-the other hand, if we put a dummy statement here, some more clever compilers
-complain that it can't be reached. Sigh. */
+/* Control gets here from "break" a few lines above. If we have a match and
+PCRE2_ENDANCHORED is set, the match fails. */
+
+if (match_count >= 0 &&
+ ((mb->moptions | mb->poptions) & PCRE2_ENDANCHORED) != 0 &&
+ ptr < end_subject)
+ match_count = PCRE2_ERROR_NOMATCH;
return match_count;
}
@@ -3138,6 +3084,7 @@ const uint8_t *start_bits = NULL;
/* We need to have mb pointing to a match block, because the IS_NEWLINE macro
is used below, and it expects NLBLOCK to be defined as a pointer. */
+pcre2_callout_block cb;
dfa_match_block actual_match_block;
dfa_match_block *mb = &actual_match_block;
@@ -3154,6 +3101,13 @@ if (re == NULL || subject == NULL || workspace == NULL || match_data == NULL)
if (wscount < 20) return PCRE2_ERROR_DFA_WSSIZE;
if (start_offset > length) return PCRE2_ERROR_BADOFFSET;
+/* Partial matching and PCRE2_ENDANCHORED are currently not allowed at the same
+time. */
+
+if ((options & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) != 0 &&
+ ((re->overall_options | options) & PCRE2_ENDANCHORED) != 0)
+ return PCRE2_ERROR_BADOPTION;
+
/* Check that the first field in the block is the magic number. If it is not,
return with PCRE2_ERROR_BADMAGIC. */
@@ -3208,15 +3162,28 @@ startline = (re->flags & PCRE2_STARTLINE) != 0;
firstline = (re->overall_options & PCRE2_FIRSTLINE) != 0;
bumpalong_limit = end_subject;
-/* Get data from the match context, if present, and fill in the fields in the
-match block. It is an error to set an offset limit without setting the flag at
-compile time. */
+/* Initialize and set up the fixed fields in the callout block, with a pointer
+in the match block. */
+
+mb->cb = &cb;
+cb.version = 2;
+cb.subject = subject;
+cb.subject_length = (PCRE2_SIZE)(end_subject - subject);
+cb.callout_flags = 0;
+cb.capture_top = 1; /* No capture support */
+cb.capture_last = 0;
+cb.mark = NULL; /* No (*MARK) support */
+
+/* Get data from the match context, if present, and fill in the remaining
+fields in the match block. It is an error to set an offset limit without
+setting the flag at compile time. */
if (mcontext == NULL)
{
mb->callout = NULL;
mb->memctl = re->memctl;
- mb->match_limit_recursion = PRIV(default_match_context).recursion_limit;
+ mb->match_limit = PRIV(default_match_context).match_limit;
+ mb->match_limit_depth = PRIV(default_match_context).depth_limit;
}
else
{
@@ -3229,10 +3196,15 @@ else
mb->callout = mcontext->callout;
mb->callout_data = mcontext->callout_data;
mb->memctl = mcontext->memctl;
- mb->match_limit_recursion = mcontext->recursion_limit;
+ mb->match_limit = mcontext->match_limit;
+ mb->match_limit_depth = mcontext->depth_limit;
}
-if (mb->match_limit_recursion > re->limit_recursion)
- mb->match_limit_recursion = re->limit_recursion;
+
+if (mb->match_limit > re->limit_match)
+ mb->match_limit = re->limit_match;
+
+if (mb->match_limit_depth > re->limit_depth)
+ mb->match_limit_depth = re->limit_depth;
mb->start_code = (PCRE2_UCHAR *)((uint8_t *)re + sizeof(pcre2_real_code)) +
re->name_count * re->name_entry_size;
@@ -3242,6 +3214,7 @@ mb->end_subject = end_subject;
mb->start_offset = start_offset;
mb->moptions = options;
mb->poptions = re->overall_options;
+mb->match_call_count = 0;
/* Process the \R and newline settings. */
@@ -3259,6 +3232,11 @@ switch(re->newline_convention)
mb->nl[0] = CHAR_NL;
break;
+ case PCRE2_NEWLINE_NUL:
+ mb->nllen = 1;
+ mb->nl[0] = CHAR_NUL;
+ break;
+
case PCRE2_NEWLINE_CRLF:
mb->nllen = 2;
mb->nl[0] = CHAR_CR;
@@ -3325,34 +3303,27 @@ if (utf && (options & PCRE2_NO_UTF_CHECK) == 0)
}
#endif /* SUPPORT_UNICODE */
-/* Set up the first code unit to match, if available. The first_codeunit value
-is never set for an anchored regular expression, but the anchoring may be
-forced at run time, so we have to test for anchoring. The first code unit may
-be unset for an unanchored pattern, of course. If there's no first code unit
-there may be a bitmap of possible first characters. */
+/* Set up the first code unit to match, if available. If there's no first code
+unit there may be a bitmap of possible first characters. */
-if (!anchored)
+if ((re->flags & PCRE2_FIRSTSET) != 0)
{
- if ((re->flags & PCRE2_FIRSTSET) != 0)
+ has_first_cu = TRUE;
+ first_cu = first_cu2 = (PCRE2_UCHAR)(re->first_codeunit);
+ if ((re->flags & PCRE2_FIRSTCASELESS) != 0)
{
- has_first_cu = TRUE;
- first_cu = first_cu2 = (PCRE2_UCHAR)(re->first_codeunit);
- if ((re->flags & PCRE2_FIRSTCASELESS) != 0)
- {
- first_cu2 = TABLE_GET(first_cu, mb->tables + fcc_offset, first_cu);
+ first_cu2 = TABLE_GET(first_cu, mb->tables + fcc_offset, first_cu);
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
- if (utf && first_cu > 127)
- first_cu2 = (PCRE2_UCHAR)UCD_OTHERCASE(first_cu);
+ if (utf && first_cu > 127)
+ first_cu2 = (PCRE2_UCHAR)UCD_OTHERCASE(first_cu);
#endif
- }
}
- else
- if (!startline && (re->flags & PCRE2_FIRSTMAPSET) != 0)
- start_bits = re->start_bitmap;
}
+else
+ if (!startline && (re->flags & PCRE2_FIRSTMAPSET) != 0)
+ start_bits = re->start_bitmap;
-/* For anchored or unanchored matches, there may be a "last known required
-character" set. */
+/* There may be a "last known required code unit" set. */
if ((re->flags & PCRE2_LASTSET) != 0)
{
@@ -3393,13 +3364,13 @@ for (;;)
if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0 &&
(options & PCRE2_DFA_RESTART) == 0)
{
- PCRE2_SPTR save_end_subject = end_subject;
-
/* If firstline is TRUE, the start of the match is constrained to the first
line of a multiline string. That is, the match must be before or at the
- first newline. Implement this by temporarily adjusting end_subject so that
- we stop the optimization scans at a newline. If the match fails at the
- newline, later code breaks this loop. */
+ first newline following the start of matching. Temporarily adjust
+ end_subject so that we stop the optimization scans for a first code unit
+ immediately after the first character of a newline (the first code unit can
+ legitimately be a newline). If the match fails at the newline, later code
+ breaks this loop. */
if (firstline)
{
@@ -3407,85 +3378,162 @@ for (;;)
#ifdef SUPPORT_UNICODE
if (utf)
{
- while (t < mb->end_subject && !IS_NEWLINE(t))
+ while (t < end_subject && !IS_NEWLINE(t))
{
t++;
- ACROSSCHAR(t < end_subject, *t, t++);
+ ACROSSCHAR(t < end_subject, t, t++);
}
}
else
#endif
- while (t < mb->end_subject && !IS_NEWLINE(t)) t++;
+ while (t < end_subject && !IS_NEWLINE(t)) t++;
end_subject = t;
}
- /* Advance to a unique first code unit if there is one. */
+ /* Anchored: check the first code unit if one is recorded. This may seem
+ pointless but it can help in detecting a no match case without scanning for
+ the required code unit. */
- if (has_first_cu)
+ if (anchored)
{
- PCRE2_UCHAR smc;
- if (first_cu != first_cu2)
- while (start_match < end_subject &&
- (smc = UCHAR21TEST(start_match)) != first_cu && smc != first_cu2)
- start_match++;
- else
- while (start_match < end_subject && UCHAR21TEST(start_match) != first_cu)
- start_match++;
+ if (has_first_cu || start_bits != NULL)
+ {
+ BOOL ok = start_match < end_subject;
+ if (ok)
+ {
+ PCRE2_UCHAR c = UCHAR21TEST(start_match);
+ ok = has_first_cu && (c == first_cu || c == first_cu2);
+ if (!ok && start_bits != NULL)
+ {
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ if (c > 255) c = 255;
+#endif
+ ok = (start_bits[c/8] & (1 << (c&7))) != 0;
+ }
+ }
+ if (!ok) break;
+ }
}
- /* Or to just after a linebreak for a multiline match */
+ /* Not anchored. Advance to a unique first code unit if there is one. In
+ 8-bit mode, the use of memchr() gives a big speed up, even though we have
+ to call it twice in caseless mode, in order to find the earliest occurrence
+ of the character in either of its cases. */
- else if (startline)
+ else
{
- if (start_match > mb->start_subject + start_offset)
+ if (has_first_cu)
{
-#ifdef SUPPORT_UNICODE
- if (utf)
+ if (first_cu != first_cu2) /* Caseless */
{
- while (start_match < end_subject && !WAS_NEWLINE(start_match))
- {
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ PCRE2_UCHAR smc;
+ while (start_match < end_subject &&
+ (smc = UCHAR21TEST(start_match)) != first_cu &&
+ smc != first_cu2)
start_match++;
- ACROSSCHAR(start_match < end_subject, *start_match,
- start_match++);
- }
+#else /* 8-bit code units */
+ PCRE2_SPTR pp1 =
+ memchr(start_match, first_cu, end_subject-start_match);
+ PCRE2_SPTR pp2 =
+ memchr(start_match, first_cu2, end_subject-start_match);
+ if (pp1 == NULL)
+ start_match = (pp2 == NULL)? end_subject : pp2;
+ else
+ start_match = (pp2 == NULL || pp1 < pp2)? pp1 : pp2;
+#endif
}
+
+ /* The caseful case */
+
else
+ {
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ while (start_match < end_subject && UCHAR21TEST(start_match) !=
+ first_cu)
+ start_match++;
+#else
+ start_match = memchr(start_match, first_cu, end_subject - start_match);
+ if (start_match == NULL) start_match = end_subject;
#endif
- while (start_match < end_subject && !WAS_NEWLINE(start_match))
- start_match++;
+ }
- /* If we have just passed a CR and the newline option is ANY or
- ANYCRLF, and we are now at a LF, advance the match position by one more
- code unit. */
+ /* If we can't find the required code unit, having reached the true end
+ of the subject, break the bumpalong loop, to force a match failure,
+ except when doing partial matching, when we let the next cycle run at
+ the end of the subject. To see why, consider the pattern /(?<=abc)def/,
+ which partially matches "abc", even though the string does not contain
+ the starting character "d". If we have not reached the true end of the
+ subject (PCRE2_FIRSTLINE caused end_subject to be temporarily modified)
+ we also let the cycle run, because the matching string is legitimately
+ allowed to start with the first code unit of a newline. */
- if (start_match[-1] == CHAR_CR &&
- (mb->nltype == NLTYPE_ANY || mb->nltype == NLTYPE_ANYCRLF) &&
- start_match < end_subject &&
- UCHAR21TEST(start_match) == CHAR_NL)
- start_match++;
+ if ((mb->moptions & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) == 0 &&
+ start_match >= mb->end_subject)
+ break;
}
- }
- /* Or to a non-unique first code unit if any have been identified. The
- bitmap contains only 256 bits. When code units are 16 or 32 bits wide, all
- code units greater than 254 set the 255 bit. */
+ /* If there's no first code unit, advance to just after a linebreak for a
+ multiline match if required. */
- else if (start_bits != NULL)
- {
- while (start_match < end_subject)
+ else if (startline)
{
- uint32_t c = UCHAR21TEST(start_match);
+ if (start_match > mb->start_subject + start_offset)
+ {
+#ifdef SUPPORT_UNICODE
+ if (utf)
+ {
+ while (start_match < end_subject && !WAS_NEWLINE(start_match))
+ {
+ start_match++;
+ ACROSSCHAR(start_match < end_subject, start_match, start_match++);
+ }
+ }
+ else
+#endif
+ while (start_match < end_subject && !WAS_NEWLINE(start_match))
+ start_match++;
+
+ /* If we have just passed a CR and the newline option is ANY or
+ ANYCRLF, and we are now at a LF, advance the match position by one
+ more code unit. */
+
+ if (start_match[-1] == CHAR_CR &&
+ (mb->nltype == NLTYPE_ANY || mb->nltype == NLTYPE_ANYCRLF) &&
+ start_match < end_subject &&
+ UCHAR21TEST(start_match) == CHAR_NL)
+ start_match++;
+ }
+ }
+
+ /* If there's no first code unit or a requirement for a multiline line
+ start, advance to a non-unique first code unit if any have been
+ identified. The bitmap contains only 256 bits. When code units are 16 or
+ 32 bits wide, all code units greater than 254 set the 255 bit. */
+
+ else if (start_bits != NULL)
+ {
+ while (start_match < end_subject)
+ {
+ uint32_t c = UCHAR21TEST(start_match);
#if PCRE2_CODE_UNIT_WIDTH != 8
- if (c > 255) c = 255;
+ if (c > 255) c = 255;
#endif
- if ((start_bits[c/8] & (1 << (c&7))) != 0) break;
- start_match++;
+ if ((start_bits[c/8] & (1 << (c&7))) != 0) break;
+ start_match++;
+ }
+
+ /* See comment above in first_cu checking about the next line. */
+
+ if ((mb->moptions & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) == 0 &&
+ start_match >= mb->end_subject)
+ break;
}
- }
+ } /* End of first code unit handling */
/* Restore fudged end_subject */
- end_subject = save_end_subject;
+ end_subject = mb->end_subject;
/* The following two optimizations are disabled for partial matching. */
@@ -3600,8 +3648,7 @@ for (;;)
#ifdef SUPPORT_UNICODE
if (utf)
{
- ACROSSCHAR(start_match < end_subject, *start_match,
- start_match++);
+ ACROSSCHAR(start_match < end_subject, start_match, start_match++);
}
#endif
if (start_match > end_subject) break;
diff --git a/thirdparty/pcre2/src/pcre2_error.c b/thirdparty/pcre2/src/pcre2_error.c
index 437bdfd202..d98cae9963 100644
--- a/thirdparty/pcre2/src/pcre2_error.c
+++ b/thirdparty/pcre2/src/pcre2_error.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -176,6 +176,8 @@ static const unsigned char compile_error_texts[] =
"internal error: unknown code in parsed pattern\0"
/* 90 */
"internal error: bad code value in parsed_skip()\0"
+ "PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode\0"
+ "invalid option bits with PCRE2_LITERAL\0"
;
/* Match-time and UTF error texts are in the same format. */
@@ -244,7 +246,7 @@ static const unsigned char match_error_texts[] =
"non-unique substring name\0"
"NULL argument passed\0"
"nested recursion at the same subject position\0"
- "recursion limit exceeded\0"
+ "matching depth limit exceeded\0"
"requested value is not available\0"
/* 55 */
"requested value is not set\0"
@@ -256,6 +258,8 @@ static const unsigned char match_error_texts[] =
"match with end before start is not supported\0"
"too many replacements (more than INT_MAX)\0"
"bad serialized data\0"
+ "heap limit exceeded\0"
+ "invalid syntax\0"
;
@@ -271,7 +275,7 @@ distinct.
Arguments:
enumber error number
buffer where to put the message (zero terminated)
- size size of the buffer
+ size size of the buffer in code units
Returns: length of message if all is well
negative on error
@@ -304,8 +308,8 @@ else /* Invalid error number */
for (; n > 0; n--)
{
- while (*message++ != CHAR_NULL) {};
- if (*message == CHAR_NULL) return PCRE2_ERROR_BADDATA;
+ while (*message++ != CHAR_NUL) {};
+ if (*message == CHAR_NUL) return PCRE2_ERROR_BADDATA;
}
for (i = 0; *message != 0; i++)
diff --git a/thirdparty/pcre2/src/pcre2_extuni.c b/thirdparty/pcre2/src/pcre2_extuni.c
new file mode 100644
index 0000000000..11a0bfbdd6
--- /dev/null
+++ b/thirdparty/pcre2/src/pcre2_extuni.c
@@ -0,0 +1,148 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+ Written by Philip Hazel
+ Original API code Copyright (c) 1997-2012 University of Cambridge
+ New API code Copyright (c) 2016-2018 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This module contains an internal function that is used to match a Unicode
+extended grapheme sequence. It is used by both pcre2_match() and
+pcre2_def_match(). However, it is called only when Unicode support is being
+compiled. Nevertheless, we provide a dummy function when there is no Unicode
+support, because some compilers do not like functionless source files. */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include "pcre2_internal.h"
+
+
+/* Dummy function */
+
+#ifndef SUPPORT_UNICODE
+PCRE2_SPTR
+PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
+ PCRE2_SPTR end_subject, BOOL utf, int *xcount)
+{
+(void)c;
+(void)eptr;
+(void)start_subject;
+(void)end_subject;
+(void)utf;
+(void)xcount;
+return NULL;
+}
+#else
+
+
+/*************************************************
+* Match an extended grapheme sequence *
+*************************************************/
+
+/*
+Arguments:
+ c the first character
+ eptr pointer to next character
+ start_subject pointer to start of subject
+ end_subject pointer to end of subject
+ utf TRUE if in UTF mode
+ xcount pointer to count of additional characters,
+ or NULL if count not needed
+
+Returns: pointer after the end of the sequence
+*/
+
+PCRE2_SPTR
+PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
+ PCRE2_SPTR end_subject, BOOL utf, int *xcount)
+{
+int lgb = UCD_GRAPHBREAK(c);
+
+while (eptr < end_subject)
+ {
+ int rgb;
+ int len = 1;
+ if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
+ rgb = UCD_GRAPHBREAK(c);
+ if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+
+ /* Not breaking between Regional Indicators is allowed only if there
+ are an even number of preceding RIs. */
+
+ if (lgb == ucp_gbRegionalIndicator && rgb == ucp_gbRegionalIndicator)
+ {
+ int ricount = 0;
+ PCRE2_SPTR bptr = eptr - 1;
+ if (utf) BACKCHAR(bptr);
+
+ /* bptr is pointing to the left-hand character */
+
+ while (bptr > start_subject)
+ {
+ bptr--;
+ if (utf)
+ {
+ BACKCHAR(bptr);
+ GETCHAR(c, bptr);
+ }
+ else
+ c = *bptr;
+ if (UCD_GRAPHBREAK(c) != ucp_gbRegionalIndicator) break;
+ ricount++;
+ }
+ if ((ricount & 1) != 0) break; /* Grapheme break required */
+ }
+
+ /* If Extend follows E_Base[_GAZ] do not update lgb; this allows
+ any number of Extend before a following E_Modifier. */
+
+ if (rgb != ucp_gbExtend ||
+ (lgb != ucp_gbE_Base && lgb != ucp_gbE_Base_GAZ))
+ lgb = rgb;
+
+ eptr += len;
+ if (xcount != NULL) *xcount += 1;
+ }
+
+return eptr;
+}
+
+#endif /* SUPPORT_UNICODE */
+
+/* End of pcre2_extuni.c */
diff --git a/thirdparty/pcre2/src/pcre2_internal.h b/thirdparty/pcre2/src/pcre2_internal.h
index 6a8774ce8c..3db9d604f4 100644
--- a/thirdparty/pcre2/src/pcre2_internal.h
+++ b/thirdparty/pcre2/src/pcre2_internal.h
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,9 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
+#ifndef PCRE2_INTERNAL_H_IDEMPOTENT_GUARD
+#define PCRE2_INTERNAL_H_IDEMPOTENT_GUARD
+
/* We do not support both EBCDIC and Unicode at the same time. The "configure"
script prevents both being selected, but not everybody uses "configure". EBCDIC
is only supported for the 8-bit library, but the check for this has to be later
@@ -240,6 +243,16 @@ not rely on this. */
#define COMPILE_ERROR_BASE 100
+/* The initial frames vector for remembering backtracking points in
+pcre2_match() is allocated on the system stack, of this size (bytes). The size
+must be a multiple of sizeof(PCRE2_SPTR) in all environments, so making it a
+multiple of 8 is best. Typical frame sizes are a few hundred bytes (it depends
+on the number of capturing parentheses) so 20K handles quite a few frames. A
+larger vector on the heap is obtained for patterns that need more frames. The
+maximum size of this can be limited. */
+
+#define START_FRAMES_SIZE 20480
+
/* Define the default BSR convention. */
#ifdef BSR_ANYCRLF
@@ -547,9 +560,14 @@ enum { PCRE2_MATCHEDBY_INTERPRETER, /* pcre2_match() */
#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
/* The maximum remaining length of subject we are prepared to search for a
-req_unit match. */
+req_unit match. In 8-bit mode, memchr() is used and is much faster than the
+search loop that has to be used in 16-bit and 32-bit modes. */
+#if PCRE2_CODE_UNIT_WIDTH == 8
+#define REQ_CU_MAX 2000
+#else
#define REQ_CU_MAX 1000
+#endif
/* Offsets for the bitmap tables in the cbits set of tables. Each table
contains a set of bits for a class map. Some classes are built by combining
@@ -668,7 +686,7 @@ a positive value. */
/* The remaining definitions work in both environments. */
-#define CHAR_NULL '\0'
+#define CHAR_NUL '\0'
#define CHAR_HT '\t'
#define CHAR_VT '\v'
#define CHAR_FF '\f'
@@ -909,6 +927,7 @@ a positive value. */
#define STRING_CRLF_RIGHTPAR "CRLF)"
#define STRING_ANY_RIGHTPAR "ANY)"
#define STRING_ANYCRLF_RIGHTPAR "ANYCRLF)"
+#define STRING_NUL_RIGHTPAR "NUL)"
#define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
#define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
#define STRING_UTF8_RIGHTPAR "UTF8)"
@@ -922,7 +941,9 @@ a positive value. */
#define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
#define STRING_NOTEMPTY_RIGHTPAR "NOTEMPTY)"
#define STRING_NOTEMPTY_ATSTART_RIGHTPAR "NOTEMPTY_ATSTART)"
+#define STRING_LIMIT_HEAP_EQ "LIMIT_HEAP="
#define STRING_LIMIT_MATCH_EQ "LIMIT_MATCH="
+#define STRING_LIMIT_DEPTH_EQ "LIMIT_DEPTH="
#define STRING_LIMIT_RECURSION_EQ "LIMIT_RECURSION="
#define STRING_MARK "MARK"
@@ -944,7 +965,7 @@ only. */
#define CHAR_ESC '\033'
#define CHAR_DEL '\177'
-#define CHAR_NULL '\0'
+#define CHAR_NUL '\0'
#define CHAR_SPACE '\040'
#define CHAR_EXCLAMATION_MARK '\041'
#define CHAR_QUOTATION_MARK '\042'
@@ -1182,6 +1203,7 @@ only. */
#define STRING_CRLF_RIGHTPAR STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
#define STRING_ANY_RIGHTPAR STR_A STR_N STR_Y STR_RIGHT_PARENTHESIS
#define STRING_ANYCRLF_RIGHTPAR STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_NUL_RIGHTPAR STR_N STR_U STR_L STR_RIGHT_PARENTHESIS
#define STRING_BSR_ANYCRLF_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
#define STRING_BSR_UNICODE_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_U STR_N STR_I STR_C STR_O STR_D STR_E STR_RIGHT_PARENTHESIS
#define STRING_UTF8_RIGHTPAR STR_U STR_T STR_F STR_8 STR_RIGHT_PARENTHESIS
@@ -1195,7 +1217,9 @@ only. */
#define STRING_NO_START_OPT_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_S STR_T STR_A STR_R STR_T STR_UNDERSCORE STR_O STR_P STR_T STR_RIGHT_PARENTHESIS
#define STRING_NOTEMPTY_RIGHTPAR STR_N STR_O STR_T STR_E STR_M STR_P STR_T STR_Y STR_RIGHT_PARENTHESIS
#define STRING_NOTEMPTY_ATSTART_RIGHTPAR STR_N STR_O STR_T STR_E STR_M STR_P STR_T STR_Y STR_UNDERSCORE STR_A STR_T STR_S STR_T STR_A STR_R STR_T STR_RIGHT_PARENTHESIS
+#define STRING_LIMIT_HEAP_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_H STR_E STR_A STR_P STR_EQUALS_SIGN
#define STRING_LIMIT_MATCH_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_M STR_A STR_T STR_C STR_H STR_EQUALS_SIGN
+#define STRING_LIMIT_DEPTH_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_D STR_E STR_P STR_T STR_H STR_EQUALS_SIGN
#define STRING_LIMIT_RECURSION_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_R STR_E STR_C STR_U STR_R STR_S STR_I STR_O STR_N STR_EQUALS_SIGN
#define STRING_MARK STR_M STR_A STR_R STR_K
@@ -1510,68 +1534,67 @@ enum {
OP_ASSERTBACK, /* 128 Positive lookbehind */
OP_ASSERTBACK_NOT, /* 129 Negative lookbehind */
- /* ONCE, ONCE_NC, BRA, BRAPOS, CBRA, CBRAPOS, and COND must come immediately
- after the assertions, with ONCE first, as there's a test for >= ONCE for a
- subpattern that isn't an assertion. The POS versions must immediately follow
- the non-POS versions in each case. */
+ /* ONCE, BRA, BRAPOS, CBRA, CBRAPOS, and COND must come immediately after the
+ assertions, with ONCE first, as there's a test for >= ONCE for a subpattern
+ that isn't an assertion. The POS versions must immediately follow the non-POS
+ versions in each case. */
OP_ONCE, /* 130 Atomic group, contains captures */
- OP_ONCE_NC, /* 131 Atomic group containing no captures */
- OP_BRA, /* 132 Start of non-capturing bracket */
- OP_BRAPOS, /* 133 Ditto, with unlimited, possessive repeat */
- OP_CBRA, /* 134 Start of capturing bracket */
- OP_CBRAPOS, /* 135 Ditto, with unlimited, possessive repeat */
- OP_COND, /* 136 Conditional group */
+ OP_BRA, /* 131 Start of non-capturing bracket */
+ OP_BRAPOS, /* 132 Ditto, with unlimited, possessive repeat */
+ OP_CBRA, /* 133 Start of capturing bracket */
+ OP_CBRAPOS, /* 134 Ditto, with unlimited, possessive repeat */
+ OP_COND, /* 135 Conditional group */
/* These five must follow the previous five, in the same order. There's a
check for >= SBRA to distinguish the two sets. */
- OP_SBRA, /* 137 Start of non-capturing bracket, check empty */
- OP_SBRAPOS, /* 138 Ditto, with unlimited, possessive repeat */
- OP_SCBRA, /* 139 Start of capturing bracket, check empty */
- OP_SCBRAPOS, /* 140 Ditto, with unlimited, possessive repeat */
- OP_SCOND, /* 141 Conditional group, check empty */
+ OP_SBRA, /* 136 Start of non-capturing bracket, check empty */
+ OP_SBRAPOS, /* 137 Ditto, with unlimited, possessive repeat */
+ OP_SCBRA, /* 138 Start of capturing bracket, check empty */
+ OP_SCBRAPOS, /* 139 Ditto, with unlimited, possessive repeat */
+ OP_SCOND, /* 140 Conditional group, check empty */
/* The next two pairs must (respectively) be kept together. */
- OP_CREF, /* 142 Used to hold a capture number as condition */
- OP_DNCREF, /* 143 Used to point to duplicate names as a condition */
- OP_RREF, /* 144 Used to hold a recursion number as condition */
- OP_DNRREF, /* 145 Used to point to duplicate names as a condition */
- OP_FALSE, /* 146 Always false (used by DEFINE and VERSION) */
- OP_TRUE, /* 147 Always true (used by VERSION) */
+ OP_CREF, /* 141 Used to hold a capture number as condition */
+ OP_DNCREF, /* 142 Used to point to duplicate names as a condition */
+ OP_RREF, /* 143 Used to hold a recursion number as condition */
+ OP_DNRREF, /* 144 Used to point to duplicate names as a condition */
+ OP_FALSE, /* 145 Always false (used by DEFINE and VERSION) */
+ OP_TRUE, /* 146 Always true (used by VERSION) */
- OP_BRAZERO, /* 148 These two must remain together and in this */
- OP_BRAMINZERO, /* 149 order. */
- OP_BRAPOSZERO, /* 150 */
+ OP_BRAZERO, /* 147 These two must remain together and in this */
+ OP_BRAMINZERO, /* 148 order. */
+ OP_BRAPOSZERO, /* 149 */
/* These are backtracking control verbs */
- OP_MARK, /* 151 always has an argument */
- OP_PRUNE, /* 152 */
- OP_PRUNE_ARG, /* 153 same, but with argument */
- OP_SKIP, /* 154 */
- OP_SKIP_ARG, /* 155 same, but with argument */
- OP_THEN, /* 156 */
- OP_THEN_ARG, /* 157 same, but with argument */
- OP_COMMIT, /* 158 */
+ OP_MARK, /* 150 always has an argument */
+ OP_PRUNE, /* 151 */
+ OP_PRUNE_ARG, /* 152 same, but with argument */
+ OP_SKIP, /* 153 */
+ OP_SKIP_ARG, /* 154 same, but with argument */
+ OP_THEN, /* 155 */
+ OP_THEN_ARG, /* 156 same, but with argument */
+ OP_COMMIT, /* 157 */
/* These are forced failure and success verbs */
- OP_FAIL, /* 159 */
- OP_ACCEPT, /* 160 */
- OP_ASSERT_ACCEPT, /* 161 Used inside assertions */
- OP_CLOSE, /* 162 Used before OP_ACCEPT to close open captures */
+ OP_FAIL, /* 158 */
+ OP_ACCEPT, /* 159 */
+ OP_ASSERT_ACCEPT, /* 160 Used inside assertions */
+ OP_CLOSE, /* 161 Used before OP_ACCEPT to close open captures */
/* This is used to skip a subpattern with a {0} quantifier */
- OP_SKIPZERO, /* 163 */
+ OP_SKIPZERO, /* 162 */
/* This is used to identify a DEFINE group during compilation so that it can
be checked for having only one branch. It is changed to OP_FALSE before
compilation finishes. */
- OP_DEFINE, /* 164 */
+ OP_DEFINE, /* 163 */
/* This is not an opcode, but is used to check that tables indexed by opcode
are the correct length, in order to catch updating errors - there have been
@@ -1618,7 +1641,7 @@ some cases doesn't actually use these names at all). */
"Recurse", "Callout", "CalloutStr", \
"Alt", "Ket", "KetRmax", "KetRmin", "KetRpos", \
"Reverse", "Assert", "Assert not", "AssertB", "AssertB not", \
- "Once", "Once_NC", \
+ "Once", \
"Bra", "BraPos", "CBra", "CBraPos", \
"Cond", \
"SBra", "SBraPos", "SCBra", "SCBraPos", \
@@ -1702,7 +1725,6 @@ in UTF-8 mode. The code that uses this table must know about such things. */
1+LINK_SIZE, /* Assert behind */ \
1+LINK_SIZE, /* Assert behind not */ \
1+LINK_SIZE, /* ONCE */ \
- 1+LINK_SIZE, /* ONCE_NC */ \
1+LINK_SIZE, /* BRA */ \
1+LINK_SIZE, /* BRAPOS */ \
1+LINK_SIZE+IMM2_SIZE, /* CBRA */ \
@@ -1748,6 +1770,7 @@ typedef struct open_capitem {
struct open_capitem *next; /* Chain link */
uint16_t number; /* Capture number */
uint16_t flag; /* Set TRUE if recursive back ref */
+ uint16_t assert_depth; /* Assertion depth when opened */
} open_capitem;
/* Layout of the UCP type table that translates property names into types and
@@ -1774,10 +1797,17 @@ typedef struct {
/* UCD access macros */
#define UCD_BLOCK_SIZE 128
-#define GET_UCD(ch) (PRIV(ucd_records) + \
+#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \
PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \
UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE])
+#if PCRE2_CODE_UNIT_WIDTH == 32
+#define GET_UCD(ch) ((ch > MAX_UTF_CODE_POINT)? \
+ PRIV(dummy_ucd_record) : REAL_GET_UCD(ch))
+#else
+#define GET_UCD(ch) REAL_GET_UCD(ch)
+#endif
+
#define UCD_CHARTYPE(ch) GET_UCD(ch)->chartype
#define UCD_SCRIPT(ch) GET_UCD(ch)->script
#define UCD_CATEGORY(ch) PRIV(ucp_gentype)[UCD_CHARTYPE(ch)]
@@ -1832,8 +1862,12 @@ extern const uint8_t PRIV(utf8_table4)[];
#define _pcre2_callout_end_delims PCRE2_SUFFIX(_pcre2_callout_end_delims_)
#define _pcre2_callout_start_delims PCRE2_SUFFIX(_pcre2_callout_start_delims_)
#define _pcre2_default_compile_context PCRE2_SUFFIX(_pcre2_default_compile_context_)
+#define _pcre2_default_convert_context PCRE2_SUFFIX(_pcre2_default_convert_context_)
#define _pcre2_default_match_context PCRE2_SUFFIX(_pcre2_default_match_context_)
#define _pcre2_default_tables PCRE2_SUFFIX(_pcre2_default_tables_)
+#if PCRE2_CODE_UNIT_WIDTH == 32
+#define _pcre2_dummy_ucd_record PCRE2_SUFFIX(_pcre2_dummy_ucd_record_)
+#endif
#define _pcre2_hspace_list PCRE2_SUFFIX(_pcre2_hspace_list_)
#define _pcre2_vspace_list PCRE2_SUFFIX(_pcre2_vspace_list_)
#define _pcre2_ucd_caseless_sets PCRE2_SUFFIX(_pcre2_ucd_caseless_sets_)
@@ -1852,12 +1886,16 @@ extern const uint8_t PRIV(OP_lengths)[];
extern const uint32_t PRIV(callout_end_delims)[];
extern const uint32_t PRIV(callout_start_delims)[];
extern const pcre2_compile_context PRIV(default_compile_context);
+extern const pcre2_convert_context PRIV(default_convert_context);
extern const pcre2_match_context PRIV(default_match_context);
extern const uint8_t PRIV(default_tables)[];
extern const uint32_t PRIV(hspace_list)[];
extern const uint32_t PRIV(vspace_list)[];
extern const uint32_t PRIV(ucd_caseless_sets)[];
extern const ucd_record PRIV(ucd_records)[];
+#if PCRE2_CODE_UNIT_WIDTH == 32
+extern const ucd_record PRIV(dummy_ucd_record)[];
+#endif
extern const uint8_t PRIV(ucd_stage1)[];
extern const uint16_t PRIV(ucd_stage2)[];
extern const uint32_t PRIV(ucp_gbtable)[];
@@ -1892,6 +1930,7 @@ is available. */
#define _pcre2_auto_possessify PCRE2_SUFFIX(_pcre2_auto_possessify_)
#define _pcre2_check_escape PCRE2_SUFFIX(_pcre2_check_escape_)
+#define _pcre2_extuni PCRE2_SUFFIX(_pcre2_extuni_)
#define _pcre2_find_bracket PCRE2_SUFFIX(_pcre2_find_bracket_)
#define _pcre2_is_newline PCRE2_SUFFIX(_pcre2_is_newline_)
#define _pcre2_jit_free_rodata PCRE2_SUFFIX(_pcre2_jit_free_rodata_)
@@ -1915,6 +1954,8 @@ extern int _pcre2_auto_possessify(PCRE2_UCHAR *, BOOL,
const compile_block *);
extern int _pcre2_check_escape(PCRE2_SPTR *, PCRE2_SPTR, uint32_t *,
int *, uint32_t, BOOL, compile_block *);
+extern PCRE2_SPTR _pcre2_extuni(uint32_t, PCRE2_SPTR, PCRE2_SPTR, PCRE2_SPTR,
+ BOOL, int *);
extern PCRE2_SPTR _pcre2_find_bracket(PCRE2_SPTR, BOOL, int);
extern BOOL _pcre2_is_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR,
uint32_t *, BOOL);
@@ -1936,5 +1977,6 @@ extern BOOL _pcre2_was_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR,
uint32_t *, BOOL);
extern BOOL _pcre2_xclass(uint32_t, PCRE2_SPTR, BOOL);
#endif /* PCRE2_CODE_UNIT_WIDTH */
+#endif /* PCRE2_INTERNAL_H_IDEMPOTENT_GUARD */
/* End of pcre2_internal.h */
diff --git a/thirdparty/pcre2/src/pcre2_intmodedep.h b/thirdparty/pcre2/src/pcre2_intmodedep.h
index ebff7e3066..c4c4c3adb9 100644
--- a/thirdparty/pcre2/src/pcre2_intmodedep.h
+++ b/thirdparty/pcre2/src/pcre2_intmodedep.h
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,7 @@ just to undefine them all. */
#undef ACROSSCHAR
#undef BACKCHAR
#undef BYTES2CU
+#undef CHMAX_255
#undef CU2BYTES
#undef FORWARDCHAR
#undef FORWARDCHARTEST
@@ -201,20 +202,25 @@ arithmetic results in a signed value. Hence the cast. */
/* Other macros that are different for 8-bit mode. The MAX_255 macro checks
whether its argument, which is assumed to be one code unit, is less than 256.
-The maximum length of a MARK name must fit in one code unit; currently it is
-set to 255 or 65535. The TABLE_GET macro is used to access elements of tables
-containing exactly 256 items. When code points can be greater than 255, a check
-is needed before accessing these tables. */
+The CHMAX_255 macro does not assume one code unit. The maximum length of a MARK
+name must fit in one code unit; currently it is set to 255 or 65535. The
+TABLE_GET macro is used to access elements of tables containing exactly 256
+items. When code points can be greater than 255, a check is needed before
+accessing these tables. */
#if PCRE2_CODE_UNIT_WIDTH == 8
#define MAX_255(c) TRUE
#define MAX_MARK ((1u << 8) - 1)
#ifdef SUPPORT_UNICODE
#define SUPPORT_WIDE_CHARS
+#define CHMAX_255(c) ((c) <= 255u)
+#else
+#define CHMAX_255(c) TRUE
#endif /* SUPPORT_UNICODE */
#define TABLE_GET(c, table, default) ((table)[c])
#else /* Code units are 16 or 32 bits */
+#define CHMAX_255(c) ((c) <= 255u)
#define MAX_255(c) ((c) <= 255u)
#define MAX_MARK ((1u << 16) - 1)
#define SUPPORT_WIDE_CHARS
@@ -345,7 +351,7 @@ because almost all calls are already within a block of UTF-8 only code. */
/* Same as above, but it allows a fully customizable form. */
#define ACROSSCHAR(condition, eptr, action) \
- while((condition) && ((eptr) & 0xc0u) == 0x80u) action
+ while((condition) && ((*eptr) & 0xc0u) == 0x80u) action
/* Deposit a character into memory, returning the number of code units. */
@@ -451,7 +457,7 @@ code. */
/* Same as above, but it allows a fully customizable form. */
#define ACROSSCHAR(condition, eptr, action) \
- if ((condition) && ((eptr) & 0xfc00u) == 0xdc00u) action
+ if ((condition) && ((*eptr) & 0xfc00u) == 0xdc00u) action
/* Deposit a character into memory, returning the number of code units. */
@@ -566,15 +572,13 @@ typedef struct pcre2_real_compile_context {
uint16_t bsr_convention;
uint16_t newline_convention;
uint32_t parens_nest_limit;
+ uint32_t extra_options;
} pcre2_real_compile_context;
/* The real match context structure. */
typedef struct pcre2_real_match_context {
pcre2_memctl memctl;
-#ifdef HEAP_MATCH_RECURSE
- pcre2_memctl stack_memctl;
-#endif
#ifdef SUPPORT_JIT
pcre2_jit_callback jit_callback;
void *jit_callback_data;
@@ -582,10 +586,19 @@ typedef struct pcre2_real_match_context {
int (*callout)(pcre2_callout_block *, void *);
void *callout_data;
PCRE2_SIZE offset_limit;
+ uint32_t heap_limit;
uint32_t match_limit;
- uint32_t recursion_limit;
+ uint32_t depth_limit;
} pcre2_real_match_context;
+/* The real convert context structure. */
+
+typedef struct pcre2_real_convert_context {
+ pcre2_memctl memctl;
+ uint32_t glob_separator;
+ uint32_t glob_escape;
+} pcre2_real_convert_context;
+
/* The real compiled code structure. The type for the blocksize field is
defined specially because it is required in pcre2_serialize_decode() when
copying the size from possibly unaligned memory into a variable of the same
@@ -610,9 +623,11 @@ typedef struct pcre2_real_code {
uint32_t magic_number; /* Paranoid and endianness check */
uint32_t compile_options; /* Options passed to pcre2_compile() */
uint32_t overall_options; /* Options after processing the pattern */
+ uint32_t extra_options; /* Taken from compile_context */
uint32_t flags; /* Various state flags */
+ uint32_t limit_heap; /* Limit set in the pattern */
uint32_t limit_match; /* Limit set in the pattern */
- uint32_t limit_recursion; /* Limit set in the pattern */
+ uint32_t limit_depth; /* Limit set in the pattern */
uint32_t first_codeunit; /* Starting code unit */
uint32_t last_codeunit; /* This codeunit must be seen */
uint16_t bsr_convention; /* What \R matches */
@@ -625,7 +640,13 @@ typedef struct pcre2_real_code {
uint16_t name_count; /* Number of name entries in the table */
} pcre2_real_code;
-/* The real match data structure. */
+/* The real match data structure. Define ovector as large as it can ever
+actually be so that array bound checkers don't grumble. Memory for this
+structure is obtained by calling pcre2_match_data_create(), which sets the size
+as the offset of ovector plus a pair of elements for each capturable string, so
+the size varies from call to call. As the maximum number of capturing
+subpatterns is 65535 we must allow for 65536 strings to include the overall
+match. (See also the heapframe structure below.) */
typedef struct pcre2_real_match_data {
pcre2_memctl memctl;
@@ -638,7 +659,7 @@ typedef struct pcre2_real_match_data {
uint16_t matchedby; /* Type of match (normal, JIT, DFA) */
uint16_t oveccount; /* Number of pairs */
int rc; /* The return code from the match */
- PCRE2_SIZE ovector[1]; /* The first field */
+ PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
} pcre2_real_match_data;
@@ -705,6 +726,8 @@ typedef struct compile_block {
PCRE2_SIZE erroroffset; /* Offset of error in pattern */
uint16_t names_found; /* Number of entries so far */
uint16_t name_entry_size; /* Size of each entry */
+ uint16_t parens_depth; /* Depth of nested parentheses */
+ uint16_t assert_depth; /* Depth of nested assertions */
open_capitem *open_caps; /* Chain of open capture items */
named_group *named_groups; /* Points to vector in pre-compile */
uint32_t named_group_list_size; /* Number of entries in the list */
@@ -723,8 +746,6 @@ typedef struct compile_block {
uint32_t class_range_end; /* Overall class range end */
PCRE2_UCHAR nl[4]; /* Newline string when fixed length */
int max_lookbehind; /* Maximum lookbehind (characters) */
- int parens_depth; /* Depth of nested parentheses */
- int assert_depth; /* Depth of nested assertions */
int req_varyopt; /* "After variable item" flag for reqbyte */
BOOL had_accept; /* (*ACCEPT) encountered */
BOOL had_pruneorskip; /* (*PRUNE) or (*SKIP) encountered */
@@ -740,27 +761,8 @@ typedef struct pcre2_real_jit_stack {
void* stack;
} pcre2_real_jit_stack;
-/* Structure for keeping a chain of heap blocks used for saving ovectors
-during pattern recursion when the ovector is larger than can be saved on
-the system stack. */
-
-typedef struct ovecsave_frame {
- struct ovecsave_frame *next; /* Next frame on free chain */
- PCRE2_SIZE saved_ovec[1]; /* First vector element */
-} ovecsave_frame;
-
/* Structure for items in a linked list that represents an explicit recursive
-call within the pattern; used by pcre_match(). */
-
-typedef struct recursion_info {
- struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
- unsigned int group_num; /* Number of group that was called */
- PCRE2_SIZE *ovec_save; /* Pointer to saved ovector frame */
- uint32_t saved_capture_last; /* Last capture number */
- PCRE2_SPTR subject_position; /* Position at start of recursion */
-} recursion_info;
-
-/* A similar structure for pcre_dfa_match(). */
+call within the pattern when running pcre_dfa_match(). */
typedef struct dfa_recursion_info {
struct dfa_recursion_info *prevrec;
@@ -768,35 +770,75 @@ typedef struct dfa_recursion_info {
uint32_t group_num;
} dfa_recursion_info;
-/* Structure for building a chain of data for holding the values of the subject
-pointer at the start of each subpattern, so as to detect when an empty string
-has been matched by a subpattern - to break infinite loops; used by
-pcre2_match(). */
+/* Structure for "stack" frames that are used for remembering backtracking
+positions during matching. As these are used in a vector, with the ovector item
+being extended, the size of the structure must be a multiple of PCRE2_SIZE. The
+only way to check this at compile time is to force an error by generating an
+array with a negative size. By putting this in a typedef (which is never used),
+we don't generate any code when all is well. */
+
+typedef struct heapframe {
+
+ /* The first set of fields are variables that have to be preserved over calls
+ to RRMATCH(), but which do not need to be copied to new frames. */
+
+ PCRE2_SPTR ecode; /* The current position in the pattern */
+ PCRE2_SPTR temp_sptr[2]; /* Used for short-term PCRE_SPTR values */
+ PCRE2_SIZE length; /* Used for character, string, or code lengths */
+ PCRE2_SIZE back_frame; /* Amount to subtract on RRETURN */
+ PCRE2_SIZE temp_size; /* Used for short-term PCRE2_SIZE values */
+ uint32_t rdepth; /* "Recursion" depth */
+ uint32_t group_frame_type; /* Type information for group frames */
+ uint32_t temp_32[4]; /* Used for short-term 32-bit or BOOL values */
+ uint8_t return_id; /* Where to go on in internal "return" */
+ uint8_t op; /* Processing opcode */
-typedef struct eptrblock {
- struct eptrblock *epb_prev;
- PCRE2_SPTR epb_saved_eptr;
-} eptrblock;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ PCRE2_UCHAR occu[6]; /* Used for other case code units */
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+ PCRE2_UCHAR occu[2]; /* Used for other case code units */
+#else
+ PCRE2_UCHAR occu[1]; /* Used for other case code units */
+#endif
+
+ /* The rest have to be copied from the previous frame whenever a new frame
+ becomes current. The final field is specified as a large vector so that
+ runtime array bound checks don't catch references to it. However, for any
+ specific call to pcre2_match() the memory allocated for each frame structure
+ allows for exactly the right size ovector for the number of capturing
+ parentheses. (See also the comment for pcre2_real_match_data above.) */
+
+ PCRE2_SPTR eptr; /* MUST BE FIRST */
+ PCRE2_SPTR start_match; /* Can be adjusted by \K */
+ PCRE2_SPTR mark; /* Most recent mark on the success path */
+ uint32_t current_recurse; /* Current (deepest) recursion number */
+ uint32_t capture_last; /* Most recent capture */
+ PCRE2_SIZE last_group_offset; /* Saved offset to most recent group frame */
+ PCRE2_SIZE offset_top; /* Offset after highest capture */
+ PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
+} heapframe;
+
+typedef char check_heapframe_size[
+ ((sizeof(heapframe) % sizeof(PCRE2_SIZE)) == 0)? (+1):(-1)];
/* Structure for passing "static" information around between the functions
doing traditional NFA matching (pcre2_match() and friends). */
typedef struct match_block {
pcre2_memctl memctl; /* For general use */
-#ifdef HEAP_MATCH_RECURSE
- pcre2_memctl stack_memctl; /* For "stack" frames */
-#endif
- uint32_t match_call_count; /* As it says */
+ PCRE2_SIZE frame_vector_size; /* Size of a backtracking frame */
+ heapframe *match_frames; /* Points to vector of frames */
+ heapframe *match_frames_top; /* Points after the end of the vector */
+ heapframe *stack_frames; /* The original vector on the stack */
+ PCRE2_SIZE heap_limit; /* As it says */
uint32_t match_limit; /* As it says */
- uint32_t match_limit_recursion; /* As it says */
+ uint32_t match_limit_depth; /* As it says */
+ uint32_t match_call_count; /* Number of times a new frame is created */
BOOL hitend; /* Hit the end of the subject at some point */
BOOL hasthen; /* Pattern contains (*THEN) */
const uint8_t *lcc; /* Points to lower casing table */
const uint8_t *fcc; /* Points to case-flipping table */
const uint8_t *ctypes; /* Points to table of type maps */
- PCRE2_SIZE *ovector; /* Pointer to the offset vector */
- PCRE2_SIZE offset_end; /* One past the end */
- PCRE2_SIZE offset_max; /* The maximum usable for return data */
PCRE2_SIZE start_offset; /* The start offset value */
PCRE2_SIZE end_offset_top; /* Highwater mark at end of match */
uint16_t partial; /* PARTIAL options */
@@ -807,30 +849,24 @@ typedef struct match_block {
PCRE2_SPTR start_code; /* For use when recursing */
PCRE2_SPTR start_subject; /* Start of the subject string */
PCRE2_SPTR end_subject; /* End of the subject string */
- PCRE2_SPTR start_match_ptr; /* Start of matched string */
PCRE2_SPTR end_match_ptr; /* Subject position at end match */
PCRE2_SPTR start_used_ptr; /* Earliest consulted character */
PCRE2_SPTR last_used_ptr; /* Latest consulted character */
PCRE2_SPTR mark; /* Mark pointer to pass back on success */
PCRE2_SPTR nomatch_mark; /* Mark pointer to pass back on failure */
- PCRE2_SPTR once_target; /* Where to back up to for atomic groups */
+ PCRE2_SPTR verb_ecode_ptr; /* For passing back info */
+ PCRE2_SPTR verb_skip_ptr; /* For passing back a (*SKIP) name */
+ uint32_t verb_current_recurse; /* Current recurse when (*VERB) happens */
uint32_t moptions; /* Match options */
uint32_t poptions; /* Pattern options */
- uint32_t capture_last; /* Most recent capture number + overflow flag */
uint32_t skip_arg_count; /* For counting SKIP_ARGs */
uint32_t ignore_skip_arg; /* For re-run when SKIP arg name not found */
- uint32_t match_function_type; /* Set for certain special calls of match() */
uint32_t nltype; /* Newline type */
uint32_t nllen; /* Newline string length */
PCRE2_UCHAR nl[4]; /* Newline string when fixed */
- eptrblock *eptrchain; /* Chain of eptrblocks for tail recursions */
- recursion_info *recursive; /* Linked list of recursion data */
- ovecsave_frame *ovecsave_chain; /* Linked list of free ovecsave blocks */
+ pcre2_callout_block *cb; /* Points to a callout block */
void *callout_data; /* To pass back to callouts */
int (*callout)(pcre2_callout_block *,void *); /* Callout function or NULL */
-#ifdef HEAP_MATCH_RECURSE
- void *match_frames_base; /* For remembering malloc'd frames */
-#endif
} match_block;
/* A similar structure is used for the same purpose by the DFA matching
@@ -845,13 +881,16 @@ typedef struct dfa_match_block {
PCRE2_SPTR last_used_ptr; /* Latest consulted character */
const uint8_t *tables; /* Character tables */
PCRE2_SIZE start_offset; /* The start offset value */
- uint32_t match_limit_recursion; /* As it says */
+ uint32_t match_limit; /* As it says */
+ uint32_t match_limit_depth; /* As it says */
+ uint32_t match_call_count; /* Number of calls of internal function */
uint32_t moptions; /* Match options */
uint32_t poptions; /* Pattern options */
uint32_t nltype; /* Newline type */
uint32_t nllen; /* Newline string length */
PCRE2_UCHAR nl[4]; /* Newline string when fixed */
uint16_t bsr_convention; /* \R interpretation */
+ pcre2_callout_block *cb; /* Points to a callout block */
void *callout_data; /* To pass back to callouts */
int (*callout)(pcre2_callout_block *,void *); /* Callout function or NULL */
dfa_recursion_info *recursive; /* Linked list of recursion data */
diff --git a/thirdparty/pcre2/src/pcre2_jit_compile.c b/thirdparty/pcre2/src/pcre2_jit_compile.c
index 8dea90a1c5..80ed1c4ca6 100644
--- a/thirdparty/pcre2/src/pcre2_jit_compile.c
+++ b/thirdparty/pcre2/src/pcre2_jit_compile.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -228,7 +228,7 @@ enum control_types {
type_then_trap = 1
};
-typedef int (SLJIT_CALL *jit_function)(jit_arguments *args);
+typedef int (SLJIT_FUNC *jit_function)(jit_arguments *args);
/* The following structure is the key data type for the recursive
code generator. It is allocated by compile_matchingpath, and contains
@@ -313,16 +313,25 @@ typedef struct ref_iterator_backtrack {
typedef struct recurse_entry {
struct recurse_entry *next;
- /* Contains the function entry. */
- struct sljit_label *entry;
- /* Collects the calls until the function is not created. */
- jump_list *calls;
+ /* Contains the function entry label. */
+ struct sljit_label *entry_label;
+ /* Contains the function entry label. */
+ struct sljit_label *backtrack_label;
+ /* Collects the entry calls until the function is not created. */
+ jump_list *entry_calls;
+ /* Collects the backtrack calls until the function is not created. */
+ jump_list *backtrack_calls;
/* Points to the starting opcode. */
sljit_sw start;
} recurse_entry;
typedef struct recurse_backtrack {
backtrack_common common;
+ /* Return to the matching path. */
+ struct sljit_label *matchingpath;
+ /* Recursive pattern. */
+ recurse_entry *entry;
+ /* Pattern is inlined. */
BOOL inlined_pattern;
} recurse_backtrack;
@@ -341,11 +350,26 @@ typedef struct then_trap_backtrack {
int framesize;
} then_trap_backtrack;
-#define MAX_RANGE_SIZE 4
+#define MAX_N_CHARS 12
+#define MAX_DIFF_CHARS 5
+
+typedef struct fast_forward_char_data {
+ /* Number of characters in the chars array, 255 for any character. */
+ sljit_u8 count;
+ /* Number of last UTF-8 characters in the chars array. */
+ sljit_u8 last_count;
+ /* Available characters in the current position. */
+ PCRE2_UCHAR chars[MAX_DIFF_CHARS];
+} fast_forward_char_data;
+
+#define MAX_CLASS_RANGE_SIZE 4
+#define MAX_CLASS_CHARS_SIZE 3
typedef struct compiler_common {
/* The sljit ceneric compiler. */
struct sljit_compiler *compiler;
+ /* Compiled regular expression. */
+ pcre2_real_code *re;
/* First byte code. */
PCRE2_SPTR start;
/* Maps private data offset to each opcode. */
@@ -402,10 +426,10 @@ typedef struct compiler_common {
BOOL has_then;
/* (*SKIP) or (*SKIP:arg) is found in lookbehind assertion. */
BOOL has_skip_in_assert_back;
- /* Currently in recurse or negative assert. */
- BOOL local_exit;
- /* Currently in a positive assert. */
- BOOL positive_assert;
+ /* Quit is redirected by recurse, negative assertion, or positive assertion in conditional block. */
+ BOOL local_quit_available;
+ /* Currently in a positive assertion. */
+ BOOL in_positive_assertion;
/* Newline control. */
int nltype;
sljit_u32 nlmax;
@@ -426,7 +450,7 @@ typedef struct compiler_common {
/* Labels and jump lists. */
struct sljit_label *partialmatchlabel;
struct sljit_label *quit_label;
- struct sljit_label *forced_quit_label;
+ struct sljit_label *abort_label;
struct sljit_label *accept_label;
struct sljit_label *ff_newline_shortcut;
stub_list *stubs;
@@ -435,8 +459,9 @@ typedef struct compiler_common {
recurse_entry *currententry;
jump_list *partialmatch;
jump_list *quit;
- jump_list *positive_assert_quit;
- jump_list *forced_quit;
+ jump_list *positive_assertion_quit;
+ jump_list *abort;
+ jump_list *failed_match;
jump_list *accept;
jump_list *calllimit;
jump_list *stackalloc;
@@ -500,14 +525,29 @@ typedef struct compare_context {
#undef CMP
/* Used for accessing the elements of the stack. */
-#define STACK(i) ((-(i) - 1) * (int)sizeof(sljit_sw))
+#define STACK(i) ((i) * (int)sizeof(sljit_sw))
+
+#ifdef SLJIT_PREF_SHIFT_REG
+#if SLJIT_PREF_SHIFT_REG == SLJIT_R2
+/* Nothing. */
+#elif SLJIT_PREF_SHIFT_REG == SLJIT_R3
+#define SHIFT_REG_IS_R3
+#else
+#error "Unsupported shift register"
+#endif
+#endif
#define TMP1 SLJIT_R0
+#ifdef SHIFT_REG_IS_R3
+#define TMP2 SLJIT_R3
+#define TMP3 SLJIT_R2
+#else
#define TMP2 SLJIT_R2
#define TMP3 SLJIT_R3
-#define STR_PTR SLJIT_S0
-#define STR_END SLJIT_S1
-#define STACK_TOP SLJIT_R1
+#endif
+#define STR_PTR SLJIT_R1
+#define STR_END SLJIT_S0
+#define STACK_TOP SLJIT_S1
#define STACK_LIMIT SLJIT_S2
#define COUNT_MATCH SLJIT_S3
#define ARGUMENTS SLJIT_S4
@@ -533,16 +573,13 @@ the start pointers when the end of the capturing group has not yet reached. */
#if PCRE2_CODE_UNIT_WIDTH == 8
#define MOV_UCHAR SLJIT_MOV_U8
-#define MOVU_UCHAR SLJIT_MOVU_U8
#define IN_UCHARS(x) (x)
#elif PCRE2_CODE_UNIT_WIDTH == 16
#define MOV_UCHAR SLJIT_MOV_U16
-#define MOVU_UCHAR SLJIT_MOVU_U16
#define UCHAR_SHIFT (1)
#define IN_UCHARS(x) ((x) * 2)
#elif PCRE2_CODE_UNIT_WIDTH == 32
#define MOV_UCHAR SLJIT_MOV_U32
-#define MOVU_UCHAR SLJIT_MOVU_U32
#define UCHAR_SHIFT (2)
#define IN_UCHARS(x) ((x) * 4)
#else
@@ -570,13 +607,17 @@ the start pointers when the end of the capturing group has not yet reached. */
sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w))
#define CMPTO(type, src1, src1w, src2, src2w, label) \
sljit_set_label(sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w)), (label))
-#define OP_FLAGS(op, dst, dstw, src, srcw, type) \
- sljit_emit_op_flags(compiler, (op), (dst), (dstw), (src), (srcw), (type))
+#define OP_FLAGS(op, dst, dstw, type) \
+ sljit_emit_op_flags(compiler, (op), (dst), (dstw), (type))
+#define CMOV(type, dst_reg, src, srcw) \
+ sljit_emit_cmov(compiler, (type), (dst_reg), (src), (srcw))
#define GET_LOCAL_BASE(dst, dstw, offset) \
sljit_get_local_base(compiler, (dst), (dstw), (offset))
#define READ_CHAR_MAX 0x7fffffff
+#define INVALID_UTF_CHAR 888
+
static PCRE2_SPTR bracketend(PCRE2_SPTR cc)
{
SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
@@ -606,8 +647,8 @@ return count;
set_private_data_ptrs
get_framesize
init_frame
- get_private_data_copy_length
- copy_private_data
+ get_recurse_data_length
+ copy_recurse_data
compile_matchingpath
compile_backtrackingpath
*/
@@ -675,7 +716,6 @@ switch(*cc)
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRA:
case OP_BRAPOS:
case OP_CBRA:
@@ -806,7 +846,7 @@ switch(*cc)
default:
/* All opcodes are supported now! */
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
}
@@ -1304,7 +1344,7 @@ while (cc < ccend)
if (private_data_ptr > SLJIT_MAX_LOCAL_SIZE)
break;
- if (repeat_check && (*cc == OP_ONCE || *cc == OP_ONCE_NC || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND))
+ if (repeat_check && (*cc == OP_ONCE || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND))
{
if (detect_repeat(common, cc))
{
@@ -1333,7 +1373,6 @@ while (cc < ccend)
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRAPOS:
case OP_SBRA:
case OP_SBRAPOS:
@@ -1654,11 +1693,11 @@ if (length > 0)
return stack_restore ? no_frame : no_stack;
}
-static void init_frame(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, int stackpos, int stacktop, BOOL recursive)
+static void init_frame(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, int stackpos, int stacktop)
{
DEFINE_COMPILER;
-BOOL setsom_found = recursive;
-BOOL setmark_found = recursive;
+BOOL setsom_found = FALSE;
+BOOL setmark_found = FALSE;
/* The last capture is a local variable even for recursions. */
BOOL capture_last_found = FALSE;
int offset;
@@ -1671,7 +1710,7 @@ stackpos = STACK(stackpos);
if (ccend == NULL)
{
ccend = bracketend(cc) - (1 + LINK_SIZE);
- if (recursive || (*cc != OP_CBRAPOS && *cc != OP_SCBRAPOS))
+ if (*cc != OP_CBRAPOS && *cc != OP_SCBRAPOS)
cc = next_opcode(common, cc);
}
@@ -1685,9 +1724,9 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setsom_found = TRUE;
}
cc += 1;
@@ -1701,9 +1740,9 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setmark_found = TRUE;
}
cc += 1 + 2 + cc[1];
@@ -1714,27 +1753,27 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setsom_found = TRUE;
}
if (common->mark_ptr != 0 && !setmark_found)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setmark_found = TRUE;
}
if (common->capture_last_ptr != 0 && !capture_last_found)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
capture_last_found = TRUE;
}
cc += 1 + LINK_SIZE;
@@ -1748,20 +1787,20 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
capture_last_found = TRUE;
}
offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, OVECTOR(offset));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP2, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
@@ -1776,21 +1815,127 @@ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, 0);
SLJIT_ASSERT(stackpos == STACK(stacktop));
}
-static SLJIT_INLINE int get_private_data_copy_length(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, BOOL needs_control_head)
+#define RECURSE_TMP_REG_COUNT 3
+
+typedef struct delayed_mem_copy_status {
+ struct sljit_compiler *compiler;
+ int store_bases[RECURSE_TMP_REG_COUNT];
+ int store_offsets[RECURSE_TMP_REG_COUNT];
+ int tmp_regs[RECURSE_TMP_REG_COUNT];
+ int saved_tmp_regs[RECURSE_TMP_REG_COUNT];
+ int next_tmp_reg;
+} delayed_mem_copy_status;
+
+static void delayed_mem_copy_init(delayed_mem_copy_status *status, compiler_common *common)
+{
+int i;
+
+for (i = 0; i < RECURSE_TMP_REG_COUNT; i++)
+ {
+ SLJIT_ASSERT(status->tmp_regs[i] >= 0);
+ SLJIT_ASSERT(sljit_get_register_index(status->saved_tmp_regs[i]) < 0 || status->tmp_regs[i] == status->saved_tmp_regs[i]);
+
+ status->store_bases[i] = -1;
+ }
+status->next_tmp_reg = 0;
+status->compiler = common->compiler;
+}
+
+static void delayed_mem_copy_move(delayed_mem_copy_status *status, int load_base, sljit_sw load_offset,
+ int store_base, sljit_sw store_offset)
+{
+struct sljit_compiler *compiler = status->compiler;
+int next_tmp_reg = status->next_tmp_reg;
+int tmp_reg = status->tmp_regs[next_tmp_reg];
+
+SLJIT_ASSERT(load_base > 0 && store_base > 0);
+
+if (status->store_bases[next_tmp_reg] == -1)
+ {
+ /* Preserve virtual registers. */
+ if (sljit_get_register_index(status->saved_tmp_regs[next_tmp_reg]) < 0)
+ OP1(SLJIT_MOV, status->saved_tmp_regs[next_tmp_reg], 0, tmp_reg, 0);
+ }
+else
+ OP1(SLJIT_MOV, SLJIT_MEM1(status->store_bases[next_tmp_reg]), status->store_offsets[next_tmp_reg], tmp_reg, 0);
+
+OP1(SLJIT_MOV, tmp_reg, 0, SLJIT_MEM1(load_base), load_offset);
+status->store_bases[next_tmp_reg] = store_base;
+status->store_offsets[next_tmp_reg] = store_offset;
+
+status->next_tmp_reg = (next_tmp_reg + 1) % RECURSE_TMP_REG_COUNT;
+}
+
+static void delayed_mem_copy_finish(delayed_mem_copy_status *status)
+{
+struct sljit_compiler *compiler = status->compiler;
+int next_tmp_reg = status->next_tmp_reg;
+int tmp_reg, saved_tmp_reg, i;
+
+for (i = 0; i < RECURSE_TMP_REG_COUNT; i++)
+ {
+ if (status->store_bases[next_tmp_reg] != -1)
+ {
+ tmp_reg = status->tmp_regs[next_tmp_reg];
+ saved_tmp_reg = status->saved_tmp_regs[next_tmp_reg];
+
+ OP1(SLJIT_MOV, SLJIT_MEM1(status->store_bases[next_tmp_reg]), status->store_offsets[next_tmp_reg], tmp_reg, 0);
+
+ /* Restore virtual registers. */
+ if (sljit_get_register_index(saved_tmp_reg) < 0)
+ OP1(SLJIT_MOV, tmp_reg, 0, saved_tmp_reg, 0);
+ }
+
+ next_tmp_reg = (next_tmp_reg + 1) % RECURSE_TMP_REG_COUNT;
+ }
+}
+
+#undef RECURSE_TMP_REG_COUNT
+
+static int get_recurse_data_length(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
+ BOOL *needs_control_head, BOOL *has_quit, BOOL *has_accept)
{
-int private_data_length = needs_control_head ? 3 : 2;
+int length = 1;
int size;
PCRE2_SPTR alternative;
+BOOL quit_found = FALSE;
+BOOL accept_found = FALSE;
+BOOL setsom_found = FALSE;
+BOOL setmark_found = FALSE;
+BOOL capture_last_found = FALSE;
+BOOL control_head_found = FALSE;
+
+#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
+SLJIT_ASSERT(common->control_head_ptr != 0);
+control_head_found = TRUE;
+#endif
+
/* Calculate the sum of the private machine words. */
while (cc < ccend)
{
size = 0;
switch(*cc)
{
+ case OP_SET_SOM:
+ SLJIT_ASSERT(common->has_set_som);
+ setsom_found = TRUE;
+ cc += 1;
+ break;
+
+ case OP_RECURSE:
+ if (common->has_set_som)
+ setsom_found = TRUE;
+ if (common->mark_ptr != 0)
+ setmark_found = TRUE;
+ if (common->capture_last_ptr != 0)
+ capture_last_found = TRUE;
+ cc += 1 + LINK_SIZE;
+ break;
+
case OP_KET:
if (PRIVATE_DATA(cc) != 0)
{
- private_data_length++;
+ length++;
SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
cc += PRIVATE_DATA(cc + 1);
}
@@ -1802,26 +1947,30 @@ while (cc < ccend)
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRAPOS:
case OP_SBRA:
case OP_SBRAPOS:
case OP_SCOND:
- private_data_length++;
+ length++;
SLJIT_ASSERT(PRIVATE_DATA(cc) != 0);
cc += 1 + LINK_SIZE;
break;
case OP_CBRA:
case OP_SCBRA:
+ length += 2;
+ if (common->capture_last_ptr != 0)
+ capture_last_found = TRUE;
if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
- private_data_length++;
+ length++;
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
case OP_CBRAPOS:
case OP_SCBRAPOS:
- private_data_length += 2;
+ length += 2 + 2;
+ if (common->capture_last_ptr != 0)
+ capture_last_found = TRUE;
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
@@ -1829,13 +1978,13 @@ while (cc < ccend)
/* Might be a hidden SCOND. */
alternative = cc + GET(cc, 1);
if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
- private_data_length++;
+ length++;
cc += 1 + LINK_SIZE;
break;
CASE_ITERATOR_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
- private_data_length++;
+ if (PRIVATE_DATA(cc) != 0)
+ length++;
cc += 2;
#ifdef SUPPORT_UNICODE
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
@@ -1843,8 +1992,8 @@ while (cc < ccend)
break;
CASE_ITERATOR_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- private_data_length += 2;
+ if (PRIVATE_DATA(cc) != 0)
+ length += 2;
cc += 2;
#ifdef SUPPORT_UNICODE
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
@@ -1852,8 +2001,8 @@ while (cc < ccend)
break;
CASE_ITERATOR_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- private_data_length += 2;
+ if (PRIVATE_DATA(cc) != 0)
+ length += 2;
cc += 2 + IMM2_SIZE;
#ifdef SUPPORT_UNICODE
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
@@ -1861,20 +2010,20 @@ while (cc < ccend)
break;
CASE_ITERATOR_TYPE_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
- private_data_length++;
+ if (PRIVATE_DATA(cc) != 0)
+ length++;
cc += 1;
break;
CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- private_data_length += 2;
+ if (PRIVATE_DATA(cc) != 0)
+ length += 2;
cc += 1;
break;
CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- private_data_length += 2;
+ if (PRIVATE_DATA(cc) != 0)
+ length += 2;
cc += 1 + IMM2_SIZE;
break;
@@ -1886,11 +2035,51 @@ while (cc < ccend)
#else
size = 1 + 32 / (int)sizeof(PCRE2_UCHAR);
#endif
- if (PRIVATE_DATA(cc))
- private_data_length += get_class_iterator_size(cc + size);
+ if (PRIVATE_DATA(cc) != 0)
+ length += get_class_iterator_size(cc + size);
cc += size;
break;
+ case OP_MARK:
+ case OP_PRUNE_ARG:
+ case OP_THEN_ARG:
+ SLJIT_ASSERT(common->mark_ptr != 0);
+ if (!setmark_found)
+ setmark_found = TRUE;
+ if (common->control_head_ptr != 0)
+ control_head_found = TRUE;
+ if (*cc != OP_MARK)
+ quit_found = TRUE;
+
+ cc += 1 + 2 + cc[1];
+ break;
+
+ case OP_PRUNE:
+ case OP_SKIP:
+ case OP_COMMIT:
+ quit_found = TRUE;
+ cc++;
+ break;
+
+ case OP_SKIP_ARG:
+ quit_found = TRUE;
+ cc += 1 + 2 + cc[1];
+ break;
+
+ case OP_THEN:
+ SLJIT_ASSERT(common->control_head_ptr != 0);
+ quit_found = TRUE;
+ if (!control_head_found)
+ control_head_found = TRUE;
+ cc++;
+ break;
+
+ case OP_ACCEPT:
+ case OP_ASSERT_ACCEPT:
+ accept_found = TRUE;
+ cc++;
+ break;
+
default:
cc = next_opcode(common, cc);
SLJIT_ASSERT(cc != NULL);
@@ -1898,329 +2087,446 @@ while (cc < ccend)
}
}
SLJIT_ASSERT(cc == ccend);
-return private_data_length;
+
+if (control_head_found)
+ length++;
+if (capture_last_found)
+ length++;
+if (quit_found)
+ {
+ if (setsom_found)
+ length++;
+ if (setmark_found)
+ length++;
+ }
+
+*needs_control_head = control_head_found;
+*has_quit = quit_found;
+*has_accept = accept_found;
+return length;
}
-static void copy_private_data(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
- BOOL save, int stackptr, int stacktop, BOOL needs_control_head)
+enum copy_recurse_data_types {
+ recurse_copy_from_global,
+ recurse_copy_private_to_global,
+ recurse_copy_shared_to_global,
+ recurse_copy_kept_shared_to_global,
+ recurse_swap_global
+};
+
+static void copy_recurse_data(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
+ int type, int stackptr, int stacktop, BOOL has_quit)
{
-DEFINE_COMPILER;
-int srcw[2];
-int count, size;
-BOOL tmp1next = TRUE;
-BOOL tmp1empty = TRUE;
-BOOL tmp2empty = TRUE;
+delayed_mem_copy_status status;
PCRE2_SPTR alternative;
-enum {
- start,
- loop,
- end
-} status;
+sljit_sw private_srcw[2];
+sljit_sw shared_srcw[3];
+sljit_sw kept_shared_srcw[2];
+int private_count, shared_count, kept_shared_count;
+int from_sp, base_reg, offset, i;
+BOOL setsom_found = FALSE;
+BOOL setmark_found = FALSE;
+BOOL capture_last_found = FALSE;
+BOOL control_head_found = FALSE;
-status = save ? start : loop;
-stackptr = STACK(stackptr - 2);
-stacktop = STACK(stacktop - 1);
+#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
+SLJIT_ASSERT(common->control_head_ptr != 0);
+control_head_found = TRUE;
+#endif
-if (!save)
+switch (type)
{
- stackptr += (needs_control_head ? 2 : 1) * sizeof(sljit_sw);
- if (stackptr < stacktop)
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), stackptr);
- stackptr += sizeof(sljit_sw);
- tmp1empty = FALSE;
- }
- if (stackptr < stacktop)
- {
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), stackptr);
- stackptr += sizeof(sljit_sw);
- tmp2empty = FALSE;
- }
- /* The tmp1next must be TRUE in either way. */
+ case recurse_copy_from_global:
+ from_sp = TRUE;
+ base_reg = STACK_TOP;
+ break;
+
+ case recurse_copy_private_to_global:
+ case recurse_copy_shared_to_global:
+ case recurse_copy_kept_shared_to_global:
+ from_sp = FALSE;
+ base_reg = STACK_TOP;
+ break;
+
+ default:
+ SLJIT_ASSERT(type == recurse_swap_global);
+ from_sp = FALSE;
+ base_reg = TMP2;
+ break;
}
-do
+stackptr = STACK(stackptr);
+stacktop = STACK(stacktop);
+
+status.tmp_regs[0] = TMP1;
+status.saved_tmp_regs[0] = TMP1;
+
+if (base_reg != TMP2)
{
- count = 0;
- switch(status)
+ status.tmp_regs[1] = TMP2;
+ status.saved_tmp_regs[1] = TMP2;
+ }
+else
+ {
+ status.saved_tmp_regs[1] = RETURN_ADDR;
+ if (sljit_get_register_index (RETURN_ADDR) == -1)
+ status.tmp_regs[1] = STR_PTR;
+ else
+ status.tmp_regs[1] = RETURN_ADDR;
+ }
+
+status.saved_tmp_regs[2] = TMP3;
+if (sljit_get_register_index (TMP3) == -1)
+ status.tmp_regs[2] = STR_END;
+else
+ status.tmp_regs[2] = TMP3;
+
+delayed_mem_copy_init(&status, common);
+
+if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global)
+ {
+ SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_private_to_global || type == recurse_swap_global);
+
+ if (!from_sp)
+ delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, common->recursive_head_ptr);
+
+ if (from_sp || type == recurse_swap_global)
+ delayed_mem_copy_move(&status, SLJIT_SP, common->recursive_head_ptr, base_reg, stackptr);
+ }
+
+stackptr += sizeof(sljit_sw);
+
+#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
+if (type != recurse_copy_shared_to_global)
+ {
+ if (!from_sp)
+ delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, common->control_head_ptr);
+
+ if (from_sp || type == recurse_swap_global)
+ delayed_mem_copy_move(&status, SLJIT_SP, common->control_head_ptr, base_reg, stackptr);
+ }
+
+stackptr += sizeof(sljit_sw);
+#endif
+
+while (cc < ccend)
+ {
+ private_count = 0;
+ shared_count = 0;
+ kept_shared_count = 0;
+
+ switch(*cc)
{
- case start:
- SLJIT_ASSERT(save && common->recursive_head_ptr != 0);
- count = 1;
- srcw[0] = common->recursive_head_ptr;
- if (needs_control_head)
+ case OP_SET_SOM:
+ SLJIT_ASSERT(common->has_set_som);
+ if (has_quit && !setsom_found)
{
- SLJIT_ASSERT(common->control_head_ptr != 0);
- count = 2;
- srcw[1] = common->control_head_ptr;
+ kept_shared_srcw[0] = OVECTOR(0);
+ kept_shared_count = 1;
+ setsom_found = TRUE;
}
- status = loop;
+ cc += 1;
break;
- case loop:
- if (cc >= ccend)
+ case OP_RECURSE:
+ if (has_quit)
{
- status = end;
- break;
+ if (common->has_set_som && !setsom_found)
+ {
+ kept_shared_srcw[0] = OVECTOR(0);
+ kept_shared_count = 1;
+ setsom_found = TRUE;
+ }
+ if (common->mark_ptr != 0 && !setmark_found)
+ {
+ kept_shared_srcw[kept_shared_count] = common->mark_ptr;
+ kept_shared_count++;
+ setmark_found = TRUE;
+ }
+ }
+ if (common->capture_last_ptr != 0 && !capture_last_found)
+ {
+ shared_srcw[0] = common->capture_last_ptr;
+ shared_count = 1;
+ capture_last_found = TRUE;
}
+ cc += 1 + LINK_SIZE;
+ break;
- switch(*cc)
+ case OP_KET:
+ if (PRIVATE_DATA(cc) != 0)
{
- case OP_KET:
- if (PRIVATE_DATA(cc) != 0)
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
- cc += PRIVATE_DATA(cc + 1);
- }
- cc += 1 + LINK_SIZE;
- break;
+ private_count = 1;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
+ cc += PRIVATE_DATA(cc + 1);
+ }
+ cc += 1 + LINK_SIZE;
+ break;
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- case OP_ONCE:
- case OP_ONCE_NC:
- case OP_BRAPOS:
- case OP_SBRA:
- case OP_SBRAPOS:
- case OP_SCOND:
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(srcw[0] != 0);
- cc += 1 + LINK_SIZE;
- break;
+ case OP_ASSERT:
+ case OP_ASSERT_NOT:
+ case OP_ASSERTBACK:
+ case OP_ASSERTBACK_NOT:
+ case OP_ONCE:
+ case OP_BRAPOS:
+ case OP_SBRA:
+ case OP_SBRAPOS:
+ case OP_SCOND:
+ private_count = 1;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ cc += 1 + LINK_SIZE;
+ break;
- case OP_CBRA:
- case OP_SCBRA:
- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
- {
- count = 1;
- srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
- }
- cc += 1 + LINK_SIZE + IMM2_SIZE;
- break;
+ case OP_CBRA:
+ case OP_SCBRA:
+ offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
+ shared_srcw[0] = OVECTOR(offset);
+ shared_srcw[1] = OVECTOR(offset + 1);
+ shared_count = 2;
- case OP_CBRAPOS:
- case OP_SCBRAPOS:
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
- SLJIT_ASSERT(srcw[0] != 0 && srcw[1] != 0);
- cc += 1 + LINK_SIZE + IMM2_SIZE;
- break;
+ if (common->capture_last_ptr != 0 && !capture_last_found)
+ {
+ shared_srcw[2] = common->capture_last_ptr;
+ shared_count = 3;
+ capture_last_found = TRUE;
+ }
- case OP_COND:
- /* Might be a hidden SCOND. */
- alternative = cc + GET(cc, 1);
- if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(srcw[0] != 0);
- }
- cc += 1 + LINK_SIZE;
- break;
+ if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
+ {
+ private_count = 1;
+ private_srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
+ }
+ cc += 1 + LINK_SIZE + IMM2_SIZE;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- }
- cc += 2;
+ case OP_CBRAPOS:
+ case OP_SCBRAPOS:
+ offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
+ shared_srcw[0] = OVECTOR(offset);
+ shared_srcw[1] = OVECTOR(offset + 1);
+ shared_count = 2;
+
+ if (common->capture_last_ptr != 0 && !capture_last_found)
+ {
+ shared_srcw[2] = common->capture_last_ptr;
+ shared_count = 3;
+ capture_last_found = TRUE;
+ }
+
+ private_count = 2;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ private_srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
+ cc += 1 + LINK_SIZE + IMM2_SIZE;
+ break;
+
+ case OP_COND:
+ /* Might be a hidden SCOND. */
+ alternative = cc + GET(cc, 1);
+ if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
+ {
+ private_count = 1;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ }
+ cc += 1 + LINK_SIZE;
+ break;
+
+ CASE_ITERATOR_PRIVATE_DATA_1
+ if (PRIVATE_DATA(cc))
+ {
+ private_count = 1;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ }
+ cc += 2;
#ifdef SUPPORT_UNICODE
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
- }
- cc += 2;
+ CASE_ITERATOR_PRIVATE_DATA_2A
+ if (PRIVATE_DATA(cc))
+ {
+ private_count = 2;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
+ }
+ cc += 2;
#ifdef SUPPORT_UNICODE
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
- }
- cc += 2 + IMM2_SIZE;
+ CASE_ITERATOR_PRIVATE_DATA_2B
+ if (PRIVATE_DATA(cc))
+ {
+ private_count = 2;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
+ }
+ cc += 2 + IMM2_SIZE;
#ifdef SUPPORT_UNICODE
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- }
- cc += 1;
- break;
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_1
+ if (PRIVATE_DATA(cc))
+ {
+ private_count = 1;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ }
+ cc += 1;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
- }
- cc += 1;
- break;
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
+ if (PRIVATE_DATA(cc))
+ {
+ private_count = 2;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
+ }
+ cc += 1;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
- }
- cc += 1 + IMM2_SIZE;
- break;
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
+ if (PRIVATE_DATA(cc))
+ {
+ private_count = 2;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
+ }
+ cc += 1 + IMM2_SIZE;
+ break;
- case OP_CLASS:
- case OP_NCLASS:
+ case OP_CLASS:
+ case OP_NCLASS:
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8
- case OP_XCLASS:
- size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(PCRE2_UCHAR);
+ case OP_XCLASS:
+ i = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(PCRE2_UCHAR);
#else
- size = 1 + 32 / (int)sizeof(PCRE2_UCHAR);
+ i = 1 + 32 / (int)sizeof(PCRE2_UCHAR);
#endif
- if (PRIVATE_DATA(cc))
- switch(get_class_iterator_size(cc + size))
- {
- case 1:
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- break;
-
- case 2:
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
- break;
+ if (PRIVATE_DATA(cc) != 0)
+ switch(get_class_iterator_size(cc + i))
+ {
+ case 1:
+ private_count = 1;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ break;
+
+ case 2:
+ private_count = 2;
+ private_srcw[0] = PRIVATE_DATA(cc);
+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
+ break;
+
+ default:
+ SLJIT_UNREACHABLE();
+ break;
+ }
+ cc += i;
+ break;
- default:
- SLJIT_ASSERT_STOP();
- break;
- }
- cc += size;
- break;
+ case OP_MARK:
+ case OP_PRUNE_ARG:
+ case OP_THEN_ARG:
+ SLJIT_ASSERT(common->mark_ptr != 0);
+ if (has_quit && !setmark_found)
+ {
+ kept_shared_srcw[0] = common->mark_ptr;
+ kept_shared_count = 1;
+ setmark_found = TRUE;
+ }
+ if (common->control_head_ptr != 0 && !control_head_found)
+ {
+ shared_srcw[0] = common->control_head_ptr;
+ shared_count = 1;
+ control_head_found = TRUE;
+ }
+ cc += 1 + 2 + cc[1];
+ break;
- default:
- cc = next_opcode(common, cc);
- SLJIT_ASSERT(cc != NULL);
- break;
+ case OP_THEN:
+ SLJIT_ASSERT(common->control_head_ptr != 0);
+ if (!control_head_found)
+ {
+ shared_srcw[0] = common->control_head_ptr;
+ shared_count = 1;
+ control_head_found = TRUE;
}
+ cc++;
break;
- case end:
- SLJIT_ASSERT_STOP();
+ default:
+ cc = next_opcode(common, cc);
+ SLJIT_ASSERT(cc != NULL);
break;
}
- while (count > 0)
+ if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global)
{
- count--;
- if (save)
- {
- if (tmp1next)
- {
- if (!tmp1empty)
- {
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP1, 0);
- stackptr += sizeof(sljit_sw);
- }
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), srcw[count]);
- tmp1empty = FALSE;
- tmp1next = FALSE;
- }
- else
- {
- if (!tmp2empty)
- {
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP2, 0);
- stackptr += sizeof(sljit_sw);
- }
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), srcw[count]);
- tmp2empty = FALSE;
- tmp1next = TRUE;
- }
- }
- else
+ SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_private_to_global || type == recurse_swap_global);
+
+ for (i = 0; i < private_count; i++)
{
- if (tmp1next)
- {
- SLJIT_ASSERT(!tmp1empty);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), srcw[count], TMP1, 0);
- tmp1empty = stackptr >= stacktop;
- if (!tmp1empty)
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), stackptr);
- stackptr += sizeof(sljit_sw);
- }
- tmp1next = FALSE;
- }
- else
- {
- SLJIT_ASSERT(!tmp2empty);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), srcw[count], TMP2, 0);
- tmp2empty = stackptr >= stacktop;
- if (!tmp2empty)
- {
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), stackptr);
- stackptr += sizeof(sljit_sw);
- }
- tmp1next = TRUE;
- }
+ SLJIT_ASSERT(private_srcw[i] != 0);
+
+ if (!from_sp)
+ delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, private_srcw[i]);
+
+ if (from_sp || type == recurse_swap_global)
+ delayed_mem_copy_move(&status, SLJIT_SP, private_srcw[i], base_reg, stackptr);
+
+ stackptr += sizeof(sljit_sw);
}
}
- }
-while (status != end);
+ else
+ stackptr += sizeof(sljit_sw) * private_count;
-if (save)
- {
- if (tmp1next)
+ if (type != recurse_copy_private_to_global && type != recurse_copy_kept_shared_to_global)
{
- if (!tmp1empty)
- {
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP1, 0);
- stackptr += sizeof(sljit_sw);
- }
- if (!tmp2empty)
+ SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_shared_to_global || type == recurse_swap_global);
+
+ for (i = 0; i < shared_count; i++)
{
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP2, 0);
+ SLJIT_ASSERT(shared_srcw[i] != 0);
+
+ if (!from_sp)
+ delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, shared_srcw[i]);
+
+ if (from_sp || type == recurse_swap_global)
+ delayed_mem_copy_move(&status, SLJIT_SP, shared_srcw[i], base_reg, stackptr);
+
stackptr += sizeof(sljit_sw);
}
}
else
+ stackptr += sizeof(sljit_sw) * shared_count;
+
+ if (type != recurse_copy_private_to_global && type != recurse_swap_global)
{
- if (!tmp2empty)
- {
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP2, 0);
- stackptr += sizeof(sljit_sw);
- }
- if (!tmp1empty)
+ SLJIT_ASSERT(type == recurse_copy_from_global || type == recurse_copy_shared_to_global || type == recurse_copy_kept_shared_to_global);
+
+ for (i = 0; i < kept_shared_count; i++)
{
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP1, 0);
+ SLJIT_ASSERT(kept_shared_srcw[i] != 0);
+
+ if (!from_sp)
+ delayed_mem_copy_move(&status, base_reg, stackptr, SLJIT_SP, kept_shared_srcw[i]);
+
+ if (from_sp || type == recurse_swap_global)
+ delayed_mem_copy_move(&status, SLJIT_SP, kept_shared_srcw[i], base_reg, stackptr);
+
stackptr += sizeof(sljit_sw);
}
}
+ else
+ stackptr += sizeof(sljit_sw) * kept_shared_count;
}
-SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));
+
+SLJIT_ASSERT(cc == ccend && stackptr == stacktop);
+
+delayed_mem_copy_finish(&status);
}
static SLJIT_INLINE PCRE2_SPTR set_then_offsets(compiler_common *common, PCRE2_SPTR cc, sljit_u8 *current_offset)
@@ -2337,7 +2643,7 @@ static SLJIT_INLINE void count_match(compiler_common *common)
{
DEFINE_COMPILER;
-OP2(SLJIT_SUB | SLJIT_SET_E, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
+OP2(SLJIT_SUB | SLJIT_SET_Z, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
add_jump(compiler, &common->calllimit, JUMP(SLJIT_ZERO));
}
@@ -2347,7 +2653,7 @@ static SLJIT_INLINE void allocate_stack(compiler_common *common, int size)
DEFINE_COMPILER;
SLJIT_ASSERT(size > 0);
-OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
#ifdef DESTROY_REGISTERS
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 12345);
OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
@@ -2355,7 +2661,7 @@ OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, TMP1, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0);
#endif
-add_stub(common, CMP(SLJIT_GREATER, STACK_TOP, 0, STACK_LIMIT, 0));
+add_stub(common, CMP(SLJIT_LESS, STACK_TOP, 0, STACK_LIMIT, 0));
}
static SLJIT_INLINE void free_stack(compiler_common *common, int size)
@@ -2363,7 +2669,7 @@ static SLJIT_INLINE void free_stack(compiler_common *common, int size)
DEFINE_COMPILER;
SLJIT_ASSERT(size > 0);
-OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
+OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
}
static sljit_uw * allocate_read_only_data(compiler_common *common, sljit_uw size)
@@ -2403,12 +2709,25 @@ if (length < 8)
}
else
{
- GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START);
- OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
- loop = LABEL();
- OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw), SLJIT_R0, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, loop);
+ if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_STORE | SLJIT_MEM_PRE, SLJIT_R0, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw)) == SLJIT_SUCCESS)
+ {
+ GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START);
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
+ loop = LABEL();
+ sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_STORE | SLJIT_MEM_PRE, SLJIT_R0, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw));
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_NOT_ZERO, loop);
+ }
+ else
+ {
+ GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START + sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
+ loop = LABEL();
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), 0, SLJIT_R0, 0);
+ OP2(SLJIT_ADD, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_NOT_ZERO, loop);
+ }
}
}
@@ -2441,12 +2760,25 @@ if (length < 8)
}
else
{
- GET_LOCAL_BASE(TMP2, 0, OVECTOR_START + sizeof(sljit_sw));
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
- loop = LABEL();
- OP1(SLJIT_MOVU, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, loop);
+ if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_STORE | SLJIT_MEM_PRE, TMP1, SLJIT_MEM1(TMP2), sizeof(sljit_sw)) == SLJIT_SUCCESS)
+ {
+ GET_LOCAL_BASE(TMP2, 0, OVECTOR_START + sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
+ loop = LABEL();
+ sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_STORE | SLJIT_MEM_PRE, TMP1, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_NOT_ZERO, loop);
+ }
+ else
+ {
+ GET_LOCAL_BASE(TMP2, 0, OVECTOR_START + 2 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
+ loop = LABEL();
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, TMP1, 0);
+ OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_NOT_ZERO, loop);
+ }
}
OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0);
@@ -2456,37 +2788,38 @@ if (common->control_head_ptr != 0)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack));
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
-OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, base));
+OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, end));
}
-static sljit_sw SLJIT_CALL do_search_mark(sljit_sw *current, PCRE2_SPTR skip_arg)
+static sljit_sw SLJIT_FUNC do_search_mark(sljit_sw *current, PCRE2_SPTR skip_arg)
{
while (current != NULL)
{
- switch (current[-2])
+ switch (current[1])
{
case type_then_trap:
break;
case type_mark:
- if (PRIV(strcmp)(skip_arg, (PCRE2_SPTR)current[-3]) == 0)
- return current[-4];
+ if (PRIV(strcmp)(skip_arg, (PCRE2_SPTR)current[2]) == 0)
+ return current[3];
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
- SLJIT_ASSERT(current > (sljit_sw*)current[-1]);
- current = (sljit_sw*)current[-1];
+ SLJIT_ASSERT(current[0] == 0 || current < (sljit_sw*)current[0]);
+ current = (sljit_sw*)current[0];
}
-return -1;
+return 0;
}
static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbracket)
{
DEFINE_COMPILER;
struct sljit_label *loop;
+BOOL has_pre;
/* At this point we can freely use all registers. */
OP1(SLJIT_MOV, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
@@ -2503,36 +2836,62 @@ if (common->mark_ptr != 0)
OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, match_data),
SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE));
-GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START);
+has_pre = sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, SLJIT_S1, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw)) == SLJIT_SUCCESS;
+
+GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START - (has_pre ? sizeof(sljit_sw) : 0));
OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, begin));
loop = LABEL();
-OP2(SLJIT_SUB, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 0, SLJIT_R0, 0);
-OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw));
+
+if (has_pre)
+ sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_PRE, SLJIT_S1, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw));
+else
+ {
+ OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 0);
+ OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw));
+ }
+
+OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, sizeof(PCRE2_SIZE));
+OP2(SLJIT_SUB, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_R0, 0);
/* Copy the integer value to the output buffer */
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
+
SLJIT_ASSERT(sizeof(PCRE2_SIZE) == 4 || sizeof(PCRE2_SIZE) == 8);
-if (sizeof(PCRE2_SIZE) == 4)
- OP1(SLJIT_MOVU_U32, SLJIT_MEM1(SLJIT_R2), sizeof(PCRE2_SIZE), SLJIT_S1, 0);
-else
- OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R2), sizeof(PCRE2_SIZE), SLJIT_S1, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
+OP1(((sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_U32 : SLJIT_MOV), SLJIT_MEM1(SLJIT_R2), 0, SLJIT_S1, 0);
+
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
/* Calculate the return value, which is the maximum ovector value. */
if (topbracket > 1)
{
- GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_sw));
- OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1);
+ if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, SLJIT_R2, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw))) == SLJIT_SUCCESS)
+ {
+ GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1);
- /* OVECTOR(0) is never equal to SLJIT_S2. */
- loop = LABEL();
- OP1(SLJIT_MOVU, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw)));
- OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
- CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
- OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0);
+ /* OVECTOR(0) is never equal to SLJIT_S2. */
+ loop = LABEL();
+ sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_PRE, SLJIT_R2, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw)));
+ OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
+ CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
+ OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0);
+ }
+ else
+ {
+ GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + (topbracket - 1) * 2 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1);
+
+ /* OVECTOR(0) is never equal to SLJIT_S2. */
+ loop = LABEL();
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), 0);
+ OP2(SLJIT_SUB, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, 2 * (sljit_sw)sizeof(sljit_sw));
+ OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
+ CMPTO(SLJIT_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop);
+ OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0);
+ }
}
else
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
@@ -2543,7 +2902,7 @@ static SLJIT_INLINE void return_with_partial_match(compiler_common *common, stru
DEFINE_COMPILER;
sljit_s32 mov_opcode;
-SLJIT_COMPILE_ASSERT(STR_END == SLJIT_S1, str_end_must_be_saved_reg2);
+SLJIT_COMPILE_ASSERT(STR_END == SLJIT_S0, str_end_must_be_saved_reg0);
SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0
&& (common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start != 0 : common->hit_start == 0));
@@ -2553,19 +2912,19 @@ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP),
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_PARTIAL);
/* Store match begin and end. */
-OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, begin));
+OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, begin));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_R2, 0);
OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, match_data));
mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_U32 : SLJIT_MOV;
-OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_S0, 0);
+OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_S1, 0);
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
OP1(mov_opcode, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(pcre2_match_data, ovector), SLJIT_R2, 0);
-OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_S0, 0);
+OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_S1, 0);
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_ASHR, STR_END, 0, STR_END, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3104,8 +3463,8 @@ if (common->utf)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
/* Skip low surrogate if necessary. */
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
return;
@@ -3124,6 +3483,7 @@ struct sljit_jump *jump;
if (nltype == NLTYPE_ANY)
{
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(jumpifmatch ? SLJIT_NOT_ZERO : SLJIT_ZERO));
}
else if (nltype == NLTYPE_ANYCRLF)
@@ -3165,7 +3525,7 @@ OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -3179,7 +3539,7 @@ OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
jump = JUMP(SLJIT_NOT_ZERO);
/* Three byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
@@ -3213,15 +3573,15 @@ OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_NOT_ZERO);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_NOT_ZERO);
/* This code runs only in 8 bit mode. No need to shift the value. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
@@ -3244,7 +3604,7 @@ struct sljit_jump *compare;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
@@ -3281,10 +3641,30 @@ static void do_getucd(compiler_common *common)
/* Search the UCD record for the character comes in TMP1.
Returns chartype in TMP1 and UCD offset in TMP2. */
DEFINE_COMPILER;
+#if PCRE2_CODE_UNIT_WIDTH == 32
+struct sljit_jump *jump;
+#endif
+
+#if defined SLJIT_DEBUG && SLJIT_DEBUG
+/* dummy_ucd_record */
+const ucd_record *record = GET_UCD(INVALID_UTF_CHAR);
+SLJIT_ASSERT(record->script == ucp_Common && record->chartype == ucp_Cn && record->gbprop == ucp_gbOther);
+SLJIT_ASSERT(record->caseset == 0 && record->other_case == 0);
+#endif
SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 8);
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
+
+#if PCRE2_CODE_UNIT_WIDTH == 32
+if (!common->utf)
+ {
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, MAX_UTF_CODE_POINT + 1);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
+ JUMPHERE(jump);
+ }
+#endif
+
OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
@@ -3299,7 +3679,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
#endif /* SUPPORT_UNICODE */
-static SLJIT_INLINE struct sljit_label *mainloop_entry(compiler_common *common, BOOL hascrorlf, sljit_u32 overall_options)
+static SLJIT_INLINE struct sljit_label *mainloop_entry(compiler_common *common)
{
DEFINE_COMPILER;
struct sljit_label *mainloop;
@@ -3311,6 +3691,8 @@ struct sljit_jump *end2 = NULL;
struct sljit_jump *singlechar;
#endif
jump_list *newline = NULL;
+sljit_u32 overall_options = common->re->overall_options;
+BOOL hascrorlf = (common->re->flags & PCRE2_HASCRORLF) != 0;
BOOL newlinecheck = FALSE;
BOOL readuchar = FALSE;
@@ -3318,7 +3700,7 @@ if (!(hascrorlf || (overall_options & PCRE2_FIRSTLINE) != 0)
&& (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF || common->newline > 255))
newlinecheck = TRUE;
-SLJIT_ASSERT(common->forced_quit_label == NULL);
+SLJIT_ASSERT(common->abort_label == NULL);
if ((overall_options & PCRE2_FIRSTLINE) != 0)
{
@@ -3375,7 +3757,7 @@ else if ((overall_options & PCRE2_USE_OFFSET_LIMIT) != 0)
OP1(SLJIT_MOV, TMP2, 0, STR_END, 0);
JUMPHERE(end2);
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_NOMATCH);
- add_jump(compiler, &common->forced_quit, CMP(SLJIT_LESS, TMP2, 0, STR_PTR, 0));
+ add_jump(compiler, &common->abort, CMP(SLJIT_LESS, TMP2, 0, STR_PTR, 0));
JUMPHERE(end);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, TMP2, 0);
}
@@ -3388,8 +3770,8 @@ if (newlinecheck)
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
end = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3426,8 +3808,8 @@ if (common->utf)
{
singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
JUMPHERE(singlechar);
@@ -3445,40 +3827,42 @@ if (newlinecheck)
return mainloop;
}
-#define MAX_N_CHARS 16
-#define MAX_DIFF_CHARS 6
-static SLJIT_INLINE void add_prefix_char(PCRE2_UCHAR chr, PCRE2_UCHAR *chars)
+static SLJIT_INLINE void add_prefix_char(PCRE2_UCHAR chr, fast_forward_char_data *chars, BOOL last)
{
-PCRE2_UCHAR i, len;
+sljit_u32 i, count = chars->count;
-len = chars[0];
-if (len == 255)
+if (count == 255)
return;
-if (len == 0)
+if (count == 0)
{
- chars[0] = 1;
- chars[1] = chr;
+ chars->count = 1;
+ chars->chars[0] = chr;
+
+ if (last)
+ chars->last_count = 1;
return;
}
-for (i = len; i > 0; i--)
- if (chars[i] == chr)
+for (i = 0; i < count; i++)
+ if (chars->chars[i] == chr)
return;
-if (len >= MAX_DIFF_CHARS - 1)
+if (count >= MAX_DIFF_CHARS)
{
- chars[0] = 255;
+ chars->count = 255;
return;
}
-len++;
-chars[len] = chr;
-chars[0] = len;
+chars->chars[count] = chr;
+chars->count = count + 1;
+
+if (last)
+ chars->last_count++;
}
-static int scan_prefix(compiler_common *common, PCRE2_SPTR cc, PCRE2_UCHAR *chars, int max_chars, sljit_u32 *rec_count)
+static int scan_prefix(compiler_common *common, PCRE2_SPTR cc, fast_forward_char_data *chars, int max_chars, sljit_u32 *rec_count)
{
/* Recursive function, which scans prefix literals. */
BOOL last, any, class, caseless;
@@ -3487,7 +3871,7 @@ sljit_u32 chr; /* Any unicode character. */
sljit_u8 *bytes, *bytes_end, byte;
PCRE2_SPTR alternative, cc_save, oc;
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
-PCRE2_UCHAR othercase[8];
+PCRE2_UCHAR othercase[4];
#elif defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 16
PCRE2_UCHAR othercase[2];
#else
@@ -3510,6 +3894,7 @@ while (TRUE)
{
case OP_CHARI:
caseless = TRUE;
+ /* Fall through */
case OP_CHAR:
last = FALSE;
cc++;
@@ -3541,6 +3926,7 @@ while (TRUE)
case OP_MINPLUSI:
case OP_POSPLUSI:
caseless = TRUE;
+ /* Fall through */
case OP_PLUS:
case OP_MINPLUS:
case OP_POSPLUS:
@@ -3549,6 +3935,7 @@ while (TRUE)
case OP_EXACTI:
caseless = TRUE;
+ /* Fall through */
case OP_EXACT:
repeat = GET2(cc, 1);
last = FALSE;
@@ -3559,6 +3946,7 @@ while (TRUE)
case OP_MINQUERYI:
case OP_POSQUERYI:
caseless = TRUE;
+ /* Fall through */
case OP_QUERY:
case OP_MINQUERY:
case OP_POSQUERY:
@@ -3582,7 +3970,6 @@ while (TRUE)
continue;
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRA:
case OP_BRAPOS:
case OP_CBRA:
@@ -3703,12 +4090,12 @@ while (TRUE)
{
do
{
- chars[0] = 255;
+ chars->count = 255;
consumed++;
if (--max_chars == 0)
return consumed;
- chars += MAX_DIFF_CHARS;
+ chars++;
}
while (--repeat > 0);
@@ -3752,8 +4139,8 @@ while (TRUE)
do
{
if (bytes[31] & 0x80)
- chars[0] = 255;
- else if (chars[0] != 255)
+ chars->count = 255;
+ else if (chars->count != 255)
{
bytes_end = bytes + 32;
chr = 0;
@@ -3768,7 +4155,7 @@ while (TRUE)
do
{
if ((byte & 0x1) != 0)
- add_prefix_char(chr, chars);
+ add_prefix_char(chr, chars, TRUE);
byte >>= 1;
chr++;
}
@@ -3776,14 +4163,14 @@ while (TRUE)
chr = (chr + 7) & ~7;
}
}
- while (chars[0] != 255 && bytes < bytes_end);
+ while (chars->count != 255 && bytes < bytes_end);
bytes = bytes_end - 32;
}
consumed++;
if (--max_chars == 0)
return consumed;
- chars += MAX_DIFF_CHARS;
+ chars++;
}
while (--repeat > 0);
@@ -3847,17 +4234,18 @@ while (TRUE)
oc = othercase;
do
{
+ len--;
+ consumed++;
+
chr = *cc;
- add_prefix_char(*cc, chars);
+ add_prefix_char(*cc, chars, len == 0);
if (caseless)
- add_prefix_char(*oc, chars);
+ add_prefix_char(*oc, chars, len == 0);
- len--;
- consumed++;
if (--max_chars == 0)
return consumed;
- chars += MAX_DIFF_CHARS;
+ chars++;
cc++;
oc++;
}
@@ -3876,7 +4264,37 @@ while (TRUE)
}
}
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+static void jumpto_if_not_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg, struct sljit_label *label)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0);
+CMPTO(SLJIT_EQUAL, reg, 0, SLJIT_IMM, 0x80, label);
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00);
+CMPTO(SLJIT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00, label);
+#else
+#error "Unknown code width"
+#endif
+}
+#endif
+
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+static struct sljit_jump *jump_if_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0);
+return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0x80);
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00);
+return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00);
+#else
+#error "Unknown code width"
+#endif
+}
+#endif
static sljit_s32 character_to_int32(PCRE2_UCHAR chr)
{
@@ -3895,39 +4313,140 @@ return value;
#endif
}
-static SLJIT_INLINE void fast_forward_first_char2_sse2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2)
+static void load_from_mem_sse2(struct sljit_compiler *compiler, sljit_s32 dst_xmm_reg, sljit_s32 src_general_reg)
+{
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+sljit_u8 instruction[5];
+#else
+sljit_u8 instruction[4];
+#endif
+
+SLJIT_ASSERT(dst_xmm_reg < 8);
+
+/* MOVDQA xmm1, xmm2/m128 */
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+if (src_general_reg < 8)
+ {
+ instruction[0] = 0x66;
+ instruction[1] = 0x0f;
+ instruction[2] = 0x6f;
+ instruction[3] = (dst_xmm_reg << 3) | src_general_reg;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+else
+ {
+ instruction[0] = 0x66;
+ instruction[1] = 0x41;
+ instruction[2] = 0x0f;
+ instruction[3] = 0x6f;
+ instruction[4] = (dst_xmm_reg << 3) | (src_general_reg & 0x7);
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+#else
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+instruction[2] = 0x6f;
+instruction[3] = (dst_xmm_reg << 3) | src_general_reg;
+sljit_emit_op_custom(compiler, instruction, 4);
+#endif
+}
+
+static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *compiler, PCRE2_UCHAR char1, PCRE2_UCHAR char2,
+ sljit_u32 bit, sljit_s32 dst_ind, sljit_s32 cmp1_ind, sljit_s32 cmp2_ind, sljit_s32 tmp_ind)
+{
+sljit_u8 instruction[4];
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+
+if (char1 == char2 || bit != 0)
+ {
+ if (bit != 0)
+ {
+ /* POR xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0xeb;
+ instruction[3] = 0xc0 | (dst_ind << 3) | cmp2_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+
+ /* PCMPEQB/W/D xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
+ instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+else
+ {
+ /* MOVDQA xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x6f;
+ instruction[3] = 0xc0 | (tmp_ind << 3) | dst_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+
+ /* PCMPEQB/W/D xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
+ instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+
+ instruction[3] = 0xc0 | (tmp_ind << 3) | cmp2_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+
+ /* POR xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0xeb;
+ instruction[3] = 0xc0 | (dst_ind << 3) | tmp_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+}
+
+static void fast_forward_first_char2_sse2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset)
{
DEFINE_COMPILER;
struct sljit_label *start;
-struct sljit_jump *quit[3];
-struct sljit_jump *nomatch;
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+struct sljit_label *restart;
+#endif
+struct sljit_jump *quit;
+struct sljit_jump *partial_quit[2];
sljit_u8 instruction[8];
sljit_s32 tmp1_ind = sljit_get_register_index(TMP1);
-sljit_s32 tmp2_ind = sljit_get_register_index(TMP2);
sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR);
-BOOL load_twice = FALSE;
-PCRE2_UCHAR bit;
+sljit_s32 data_ind = 0;
+sljit_s32 tmp_ind = 1;
+sljit_s32 cmp1_ind = 2;
+sljit_s32 cmp2_ind = 3;
+sljit_u32 bit = 0;
-bit = char1 ^ char2;
-if (!is_powerof2(bit))
- bit = 0;
+SLJIT_UNUSED_ARG(offset);
-if ((char1 != char2) && bit == 0)
- load_twice = TRUE;
+if (char1 != char2)
+ {
+ bit = char1 ^ char2;
+ if (!is_powerof2(bit))
+ bit = 0;
+ }
-quit[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+partial_quit[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit[0]);
/* First part (unaligned start) */
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1 | bit));
-SLJIT_ASSERT(tmp1_ind < 8 && tmp2_ind == 1);
+SLJIT_ASSERT(tmp1_ind < 8);
/* MOVD xmm, r/m32 */
instruction[0] = 0x66;
instruction[1] = 0x0f;
instruction[2] = 0x6e;
-instruction[3] = 0xc0 | (2 << 3) | tmp1_ind;
+instruction[3] = 0xc0 | (cmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 4);
if (char1 != char2)
@@ -3935,224 +4454,521 @@ if (char1 != char2)
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(bit != 0 ? bit : char2));
/* MOVD xmm, r/m32 */
- instruction[3] = 0xc0 | (3 << 3) | tmp1_ind;
+ instruction[3] = 0xc0 | (cmp2_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 4);
}
+OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+
/* PSHUFD xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
instruction[2] = 0x70;
-instruction[3] = 0xc0 | (2 << 3) | 2;
+instruction[3] = 0xc0 | (cmp1_ind << 3) | 2;
instruction[4] = 0;
sljit_emit_op_custom(compiler, instruction, 5);
if (char1 != char2)
{
/* PSHUFD xmm1, xmm2/m128, imm8 */
- instruction[3] = 0xc0 | (3 << 3) | 3;
- instruction[4] = 0;
+ instruction[3] = 0xc0 | (cmp2_ind << 3) | 3;
sljit_emit_op_custom(compiler, instruction, 5);
}
-OP2(SLJIT_AND, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 0xf);
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+restart = LABEL();
+#endif
OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf);
+OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf);
-/* MOVDQA xmm1, xmm2/m128 */
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+load_from_mem_sse2(compiler, data_ind, str_ptr_ind);
+fast_forward_char_pair_sse2_compare(compiler, char1, char2, bit, data_ind, cmp1_ind, cmp2_ind, tmp_ind);
-if (str_ptr_ind < 8)
- {
- instruction[2] = 0x6f;
- instruction[3] = (0 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
-
- if (load_twice)
- {
- instruction[3] = (1 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
- }
-else
- {
- instruction[1] = 0x41;
- instruction[2] = 0x0f;
- instruction[3] = 0x6f;
- instruction[4] = (0 << 3) | (str_ptr_ind & 0x7);
- sljit_emit_op_custom(compiler, instruction, 5);
+/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xd7;
+instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
+sljit_emit_op_custom(compiler, instruction, 4);
- if (load_twice)
- {
- instruction[4] = (1 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 5);
- }
- instruction[1] = 0x0f;
- }
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0);
-#else
+/* BSF r32, r/m32 */
+instruction[0] = 0x0f;
+instruction[1] = 0xbc;
+instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
+sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
-instruction[2] = 0x6f;
-instruction[3] = (0 << 3) | str_ptr_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
+quit = JUMP(SLJIT_NOT_ZERO);
-if (load_twice)
- {
- instruction[3] = (1 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-#endif
+start = LABEL();
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
-if (bit != 0)
- {
- /* POR xmm1, xmm2/m128 */
- instruction[2] = 0xeb;
- instruction[3] = 0xc0 | (0 << 3) | 3;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
+partial_quit[1] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit[1]);
-/* PCMPEQB/W/D xmm1, xmm2/m128 */
-instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
-instruction[3] = 0xc0 | (0 << 3) | 2;
-sljit_emit_op_custom(compiler, instruction, 4);
+/* Second part (aligned) */
-if (load_twice)
- {
- instruction[3] = 0xc0 | (1 << 3) | 3;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
+load_from_mem_sse2(compiler, 0, str_ptr_ind);
+fast_forward_char_pair_sse2_compare(compiler, char1, char2, bit, data_ind, cmp1_ind, cmp2_ind, tmp_ind);
/* PMOVMSKB reg, xmm */
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
instruction[2] = 0xd7;
instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
sljit_emit_op_custom(compiler, instruction, 4);
-if (load_twice)
- {
- OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP2, 0);
- instruction[3] = 0xc0 | (tmp2_ind << 3) | 1;
- sljit_emit_op_custom(compiler, instruction, 4);
-
- OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
- OP1(SLJIT_MOV, TMP2, 0, RETURN_ADDR, 0);
- }
-
-OP2(SLJIT_ASHR, TMP1, 0, TMP1, 0, TMP2, 0);
-
/* BSF r32, r/m32 */
instruction[0] = 0x0f;
instruction[1] = 0xbc;
instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
-nomatch = JUMP(SLJIT_ZERO);
+JUMPTO(SLJIT_ZERO, start);
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+JUMPHERE(quit);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
-quit[1] = JUMP(SLJIT_JUMP);
-JUMPHERE(nomatch);
+if (common->mode != PCRE2_JIT_COMPLETE)
+ {
+ JUMPHERE(partial_quit[0]);
+ JUMPHERE(partial_quit[1]);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
+ CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0);
+ }
+else
+ add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-start = LABEL();
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
-quit[2] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+if (common->utf && offset > 0)
+ {
+ SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE);
-/* Second part (aligned) */
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset));
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
+ quit = jump_if_utf_char_start(compiler, TMP1);
-/* MOVDQA xmm1, xmm2/m128 */
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+ JUMPTO(SLJIT_JUMP, restart);
-if (str_ptr_ind < 8)
+ JUMPHERE(quit);
+ }
+#endif
+}
+
+#ifndef _WIN64
+
+static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_sse2_offset(void)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+return 15;
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+return 7;
+#elif PCRE2_CODE_UNIT_WIDTH == 32
+return 3;
+#else
+#error "Unsupported unit width"
+#endif
+}
+
+static void fast_forward_char_pair_sse2(compiler_common *common, sljit_s32 offs1,
+ PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b)
+{
+DEFINE_COMPILER;
+sljit_u32 bit1 = 0;
+sljit_u32 bit2 = 0;
+sljit_u32 diff = IN_UCHARS(offs1 - offs2);
+sljit_s32 tmp1_ind = sljit_get_register_index(TMP1);
+sljit_s32 tmp2_ind = sljit_get_register_index(TMP2);
+sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR);
+sljit_s32 data1_ind = 0;
+sljit_s32 data2_ind = 1;
+sljit_s32 tmp_ind = 2;
+sljit_s32 cmp1a_ind = 3;
+sljit_s32 cmp1b_ind = 4;
+sljit_s32 cmp2a_ind = 5;
+sljit_s32 cmp2b_ind = 6;
+struct sljit_label *start;
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+struct sljit_label *restart;
+#endif
+struct sljit_jump *jump[2];
+
+sljit_u8 instruction[8];
+
+SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2);
+SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_sse2_offset()));
+SLJIT_ASSERT(tmp1_ind < 8 && tmp2_ind == 1);
+
+/* Initialize. */
+if (common->match_end_ptr != 0)
{
- instruction[2] = 0x6f;
- instruction[3] = (0 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+ OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
+ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1));
+
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);
+ CMOV(SLJIT_LESS, STR_END, TMP1, 0);
+ }
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1));
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
- if (load_twice)
+/* MOVD xmm, r/m32 */
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+instruction[2] = 0x6e;
+
+if (char1a == char1b)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a));
+else
+ {
+ bit1 = char1a ^ char1b;
+ if (is_powerof2(bit1))
{
- instruction[3] = (1 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a | bit1));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit1));
+ }
+ else
+ {
+ bit1 = 0;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char1b));
}
}
-else
+
+instruction[3] = 0xc0 | (cmp1a_ind << 3) | tmp1_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+if (char1a != char1b)
{
- instruction[1] = 0x41;
- instruction[2] = 0x0f;
- instruction[3] = 0x6f;
- instruction[4] = (0 << 3) | (str_ptr_ind & 0x7);
- sljit_emit_op_custom(compiler, instruction, 5);
+ instruction[3] = 0xc0 | (cmp1b_ind << 3) | tmp2_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
- if (load_twice)
+if (char2a == char2b)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a));
+else
+ {
+ bit2 = char2a ^ char2b;
+ if (is_powerof2(bit2))
{
- instruction[4] = (1 << 3) | str_ptr_ind;
- sljit_emit_op_custom(compiler, instruction, 5);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a | bit2));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit2));
+ }
+ else
+ {
+ bit2 = 0;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char2b));
}
- instruction[1] = 0x0f;
}
-#else
-
-instruction[2] = 0x6f;
-instruction[3] = (0 << 3) | str_ptr_ind;
+instruction[3] = 0xc0 | (cmp2a_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 4);
-if (load_twice)
+if (char2a != char2b)
{
- instruction[3] = (1 << 3) | str_ptr_ind;
+ instruction[3] = 0xc0 | (cmp2b_ind << 3) | tmp2_ind;
sljit_emit_op_custom(compiler, instruction, 4);
}
-#endif
+/* PSHUFD xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x70;
+instruction[4] = 0;
-if (bit != 0)
+instruction[3] = 0xc0 | (cmp1a_ind << 3) | cmp1a_ind;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+if (char1a != char1b)
{
- /* POR xmm1, xmm2/m128 */
- instruction[2] = 0xeb;
- instruction[3] = 0xc0 | (0 << 3) | 3;
- sljit_emit_op_custom(compiler, instruction, 4);
+ instruction[3] = 0xc0 | (cmp1b_ind << 3) | cmp1b_ind;
+ sljit_emit_op_custom(compiler, instruction, 5);
}
-/* PCMPEQB/W/D xmm1, xmm2/m128 */
-instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
-instruction[3] = 0xc0 | (0 << 3) | 2;
-sljit_emit_op_custom(compiler, instruction, 4);
+instruction[3] = 0xc0 | (cmp2a_ind << 3) | cmp2a_ind;
+sljit_emit_op_custom(compiler, instruction, 5);
-if (load_twice)
+if (char2a != char2b)
{
- instruction[3] = 0xc0 | (1 << 3) | 3;
- sljit_emit_op_custom(compiler, instruction, 4);
+ instruction[3] = 0xc0 | (cmp2b_ind << 3) | cmp2b_ind;
+ sljit_emit_op_custom(compiler, instruction, 5);
}
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+restart = LABEL();
+#endif
+
+OP2(SLJIT_SUB, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1 - offs2));
+OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf);
+OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, ~0xf);
+
+load_from_mem_sse2(compiler, data1_ind, str_ptr_ind);
+
+jump[0] = CMP(SLJIT_EQUAL, STR_PTR, 0, TMP1, 0);
+
+load_from_mem_sse2(compiler, data2_ind, tmp1_ind);
+
+/* MOVDQA xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x6f;
+instruction[3] = 0xc0 | (tmp_ind << 3) | data1_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PSLLDQ xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x73;
+instruction[3] = 0xc0 | (7 << 3) | tmp_ind;
+instruction[4] = diff;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+/* PSRLDQ xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+/* instruction[2] = 0x73; */
+instruction[3] = 0xc0 | (3 << 3) | data2_ind;
+instruction[4] = 16 - diff;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+/* POR xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xeb;
+instruction[3] = 0xc0 | (data2_ind << 3) | tmp_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+jump[1] = JUMP(SLJIT_JUMP);
+
+JUMPHERE(jump[0]);
+
+/* MOVDQA xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x6f;
+instruction[3] = 0xc0 | (data2_ind << 3) | data1_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PSLLDQ xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x73;
+instruction[3] = 0xc0 | (7 << 3) | data2_ind;
+instruction[4] = diff;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+JUMPHERE(jump[1]);
+
+OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf);
+
+fast_forward_char_pair_sse2_compare(compiler, char2a, char2b, bit2, data2_ind, cmp2a_ind, cmp2b_ind, tmp_ind);
+fast_forward_char_pair_sse2_compare(compiler, char1a, char1b, bit1, data1_ind, cmp1a_ind, cmp1b_ind, tmp_ind);
+
+/* PAND xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xdb;
+instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
instruction[2] = 0xd7;
instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
sljit_emit_op_custom(compiler, instruction, 4);
-if (load_twice)
- {
- instruction[3] = 0xc0 | (tmp2_ind << 3) | 1;
- sljit_emit_op_custom(compiler, instruction, 4);
+/* Ignore matches before the first STR_PTR. */
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0);
- OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
- }
+/* BSF r32, r/m32 */
+instruction[0] = 0x0f;
+instruction[1] = 0xbc;
+instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
+sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
+
+jump[0] = JUMP(SLJIT_NOT_ZERO);
+
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+
+/* Main loop. */
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+
+start = LABEL();
+
+load_from_mem_sse2(compiler, data2_ind, str_ptr_ind);
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+load_from_mem_sse2(compiler, data1_ind, str_ptr_ind);
+
+/* PSRLDQ xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x73;
+instruction[3] = 0xc0 | (3 << 3) | data2_ind;
+instruction[4] = 16 - diff;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+/* MOVDQA xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x6f;
+instruction[3] = 0xc0 | (tmp_ind << 3) | data1_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PSLLDQ xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x73;
+instruction[3] = 0xc0 | (7 << 3) | tmp_ind;
+instruction[4] = diff;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+/* POR xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xeb;
+instruction[3] = 0xc0 | (data2_ind << 3) | tmp_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+fast_forward_char_pair_sse2_compare(compiler, char1a, char1b, bit1, data1_ind, cmp1a_ind, cmp1b_ind, tmp_ind);
+fast_forward_char_pair_sse2_compare(compiler, char2a, char2b, bit2, data2_ind, cmp2a_ind, cmp2b_ind, tmp_ind);
+
+/* PAND xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xdb;
+instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xd7;
+instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
+sljit_emit_op_custom(compiler, instruction, 4);
/* BSF r32, r/m32 */
instruction[0] = 0x0f;
instruction[1] = 0xbc;
instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
JUMPTO(SLJIT_ZERO, start);
+JUMPHERE(jump[0]);
+
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
-start = LABEL();
-SET_LABEL(quit[0], start);
-SET_LABEL(quit[1], start);
-SET_LABEL(quit[2], start);
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+if (common->match_end_ptr != 0)
+ OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+if (common->utf)
+ {
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offs1));
+
+ jump[0] = jump_if_utf_char_start(compiler, TMP1);
+
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, restart);
+
+ add_jump(compiler, &common->failed_match, JUMP(SLJIT_JUMP));
+
+ JUMPHERE(jump[0]);
+ }
+#endif
+
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1));
+
+if (common->match_end_ptr != 0)
+ OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
+}
+
+static BOOL check_fast_forward_char_pair_sse2(compiler_common *common, fast_forward_char_data *chars, int max)
+{
+sljit_s32 i, j, priority, count;
+sljit_u32 priorities;
+PCRE2_UCHAR a1, a2, b1, b2;
+
+priorities = 0;
+
+count = 0;
+for (i = 0; i < max; i++)
+ {
+ if (chars[i].last_count > 2)
+ {
+ SLJIT_ASSERT(chars[i].last_count <= 7);
+
+ priorities |= (1 << chars[i].last_count);
+ count++;
+ }
+ }
+
+if (count < 2)
+ return FALSE;
+
+for (priority = 7; priority > 2; priority--)
+ {
+ if ((priorities & (1 << priority)) == 0)
+ continue;
+
+ for (i = max - 1; i >= 1; i--)
+ if (chars[i].last_count >= priority)
+ {
+ SLJIT_ASSERT(chars[i].count <= 2 && chars[i].count >= 1);
+
+ a1 = chars[i].chars[0];
+ a2 = chars[i].chars[1];
+
+ j = i - max_fast_forward_char_pair_sse2_offset();
+ if (j < 0)
+ j = 0;
+
+ while (j < i)
+ {
+ if (chars[j].last_count >= priority)
+ {
+ b1 = chars[j].chars[0];
+ b2 = chars[j].chars[1];
+
+ if (a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2)
+ {
+ fast_forward_char_pair_sse2(common, i, a1, a2, j, b1, b2);
+ return TRUE;
+ }
+ }
+ j++;
+ }
+ }
+ }
+
+return FALSE;
}
+#endif
+
#undef SSE2_COMPARE_TYPE_INDEX
#endif
@@ -4161,15 +4977,16 @@ static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1,
{
DEFINE_COMPILER;
struct sljit_label *start;
-struct sljit_jump *quit;
-struct sljit_jump *found;
+struct sljit_jump *match;
+struct sljit_jump *partial_quit;
PCRE2_UCHAR mask;
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-struct sljit_label *utf_start = NULL;
-struct sljit_jump *utf_quit = NULL;
-#endif
BOOL has_match_end = (common->match_end_ptr != 0);
+SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE || offset == 0);
+
+if (has_match_end)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+
if (offset > 0)
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
@@ -4177,76 +4994,21 @@ if (has_match_end)
{
OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
- OP2(SLJIT_ADD, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, SLJIT_IMM, IN_UCHARS(offset + 1));
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
- if (sljit_x86_is_cmov_available())
- {
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_END, 0, TMP3, 0);
- sljit_x86_emit_cmov(compiler, SLJIT_GREATER, STR_END, TMP3, 0);
- }
-#endif
- {
- quit = CMP(SLJIT_LESS_EQUAL, STR_END, 0, TMP3, 0);
- OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
- JUMPHERE(quit);
- }
+ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offset + 1));
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0);
+ CMOV(SLJIT_GREATER, STR_END, TMP1, 0);
}
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-if (common->utf && offset > 0)
- utf_start = LABEL();
-#endif
-
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
/* SSE2 accelerated first character search. */
-if (sljit_x86_is_sse2_available())
+if (sljit_has_cpu_feature(SLJIT_HAS_SSE2))
{
- fast_forward_first_char2_sse2(common, char1, char2);
+ fast_forward_first_char2_sse2(common, char1, char2, offset);
- SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE || offset == 0);
- if (common->mode == PCRE2_JIT_COMPLETE)
- {
- /* In complete mode, we don't need to run a match when STR_PTR == STR_END. */
- SLJIT_ASSERT(common->forced_quit_label == NULL);
- OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_NOMATCH);
- add_jump(compiler, &common->forced_quit, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
- if (common->utf && offset > 0)
- {
- SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE);
-
- OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset));
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-#if PCRE2_CODE_UNIT_WIDTH == 8
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xc0);
- CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, utf_start);
-#elif PCRE2_CODE_UNIT_WIDTH == 16
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0xdc00, utf_start);
-#else
-#error "Unknown code width"
-#endif
- OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- }
-#endif
-
- if (offset > 0)
- OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
- }
- else if (sljit_x86_is_cmov_available())
- {
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
- sljit_x86_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, has_match_end ? SLJIT_MEM1(SLJIT_SP) : STR_END, has_match_end ? common->match_end_ptr : 0);
- }
- else
- {
- quit = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, STR_PTR, 0, has_match_end ? SLJIT_MEM1(SLJIT_SP) : STR_END, has_match_end ? common->match_end_ptr : 0);
- JUMPHERE(quit);
- }
+ if (offset > 0)
+ OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
if (has_match_end)
OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
@@ -4255,85 +5017,56 @@ if (sljit_x86_is_sse2_available())
#endif
-quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
-
start = LABEL();
+
+partial_quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit);
+
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
if (char1 == char2)
- found = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, char1);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char1, start);
else
{
mask = char1 ^ char2;
if (is_powerof2(mask))
{
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, mask);
- found = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, char1 | mask);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char1 | mask, start);
}
else
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char1);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char2);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- found = JUMP(SLJIT_NOT_ZERO);
+ match = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, char1);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char2, start);
+ JUMPHERE(match);
}
}
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, start);
-
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-if (common->utf && offset > 0)
- utf_quit = JUMP(SLJIT_JUMP);
-#endif
-
-JUMPHERE(found);
-
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
if (common->utf && offset > 0)
{
- OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset));
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-#if PCRE2_CODE_UNIT_WIDTH == 8
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xc0);
- CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, utf_start);
-#elif PCRE2_CODE_UNIT_WIDTH == 16
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0xdc00, utf_start);
-#else
-#error "Unknown code width"
-#endif
- OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- JUMPHERE(utf_quit);
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-(offset + 1)));
+ jumpto_if_not_utf_char_start(compiler, TMP1, start);
}
#endif
-JUMPHERE(quit);
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset + 1));
+
+if (common->mode != PCRE2_JIT_COMPLETE)
+ JUMPHERE(partial_quit);
if (has_match_end)
- {
- quit = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
- if (offset > 0)
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
- JUMPHERE(quit);
OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
- }
-
-if (offset > 0)
- OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
}
static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common)
{
DEFINE_COMPILER;
struct sljit_label *start;
-struct sljit_jump *quit;
struct sljit_jump *match;
-/* bytes[0] represent the number of characters between 0
-and MAX_N_BYTES - 1, 255 represents any character. */
-PCRE2_UCHAR chars[MAX_N_CHARS * MAX_DIFF_CHARS];
+fast_forward_char_data chars[MAX_N_CHARS];
sljit_s32 offset;
PCRE2_UCHAR mask;
PCRE2_UCHAR *char_set, *char_set_end;
@@ -4344,7 +5077,10 @@ BOOL in_range;
sljit_u32 rec_count;
for (i = 0; i < MAX_N_CHARS; i++)
- chars[i * MAX_DIFF_CHARS] = 0;
+ {
+ chars[i].count = 0;
+ chars[i].last_count = 0;
+ }
rec_count = 10000;
max = scan_prefix(common, common->start, chars, MAX_N_CHARS, &rec_count);
@@ -4352,21 +5088,50 @@ max = scan_prefix(common, common->start, chars, MAX_N_CHARS, &rec_count);
if (max < 1)
return FALSE;
+/* Convert last_count to priority. */
+for (i = 0; i < max; i++)
+ {
+ SLJIT_ASSERT(chars[i].count > 0 && chars[i].last_count <= chars[i].count);
+
+ if (chars[i].count == 1)
+ {
+ chars[i].last_count = (chars[i].last_count == 1) ? 7 : 5;
+ /* Simplifies algorithms later. */
+ chars[i].chars[1] = chars[i].chars[0];
+ }
+ else if (chars[i].count == 2)
+ {
+ SLJIT_ASSERT(chars[i].chars[0] != chars[i].chars[1]);
+
+ if (is_powerof2(chars[i].chars[0] ^ chars[i].chars[1]))
+ chars[i].last_count = (chars[i].last_count == 2) ? 6 : 4;
+ else
+ chars[i].last_count = (chars[i].last_count == 2) ? 3 : 2;
+ }
+ else
+ chars[i].last_count = (chars[i].count == 255) ? 0 : 1;
+ }
+
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND) && !(defined _WIN64)
+if (check_fast_forward_char_pair_sse2(common, chars, max))
+ return TRUE;
+#endif
+
in_range = FALSE;
/* Prevent compiler "uninitialized" warning */
from = 0;
range_len = 4 /* minimum length */ - 1;
for (i = 0; i <= max; i++)
{
- if (in_range && (i - from) > range_len && (chars[(i - 1) * MAX_DIFF_CHARS] < 255))
+ if (in_range && (i - from) > range_len && (chars[i - 1].count < 255))
{
range_len = i - from;
range_right = i - 1;
}
- if (i < max && chars[i * MAX_DIFF_CHARS] < 255)
+ if (i < max && chars[i].count < 255)
{
- SLJIT_ASSERT(chars[i * MAX_DIFF_CHARS] > 0);
+ SLJIT_ASSERT(chars[i].count > 0);
if (!in_range)
{
in_range = TRUE;
@@ -4386,16 +5151,17 @@ if (range_right >= 0)
for (i = 0; i < range_len; i++)
{
- char_set = chars + ((range_right - i) * MAX_DIFF_CHARS);
- SLJIT_ASSERT(char_set[0] > 0 && char_set[0] < 255);
- char_set_end = char_set + char_set[0];
- char_set++;
- while (char_set <= char_set_end)
+ SLJIT_ASSERT(chars[range_right - i].count > 0 && chars[range_right - i].count < 255);
+
+ char_set = chars[range_right - i].chars;
+ char_set_end = char_set + chars[range_right - i].count;
+ do
{
if (update_table[(*char_set) & 0xff] > IN_UCHARS(i))
update_table[(*char_set) & 0xff] = IN_UCHARS(i);
char_set++;
}
+ while (char_set < char_set_end);
}
}
@@ -4403,54 +5169,38 @@ offset = -1;
/* Scan forward. */
for (i = 0; i < max; i++)
{
+ if (range_right == i)
+ continue;
+
if (offset == -1)
{
- if (chars[i * MAX_DIFF_CHARS] <= 2)
+ if (chars[i].last_count >= 2)
offset = i;
}
- else if (chars[offset * MAX_DIFF_CHARS] == 2 && chars[i * MAX_DIFF_CHARS] <= 2)
- {
- if (chars[i * MAX_DIFF_CHARS] == 1)
- offset = i;
- else
- {
- mask = chars[offset * MAX_DIFF_CHARS + 1] ^ chars[offset * MAX_DIFF_CHARS + 2];
- if (!is_powerof2(mask))
- {
- mask = chars[i * MAX_DIFF_CHARS + 1] ^ chars[i * MAX_DIFF_CHARS + 2];
- if (is_powerof2(mask))
- offset = i;
- }
- }
- }
+ else if (chars[offset].last_count < chars[i].last_count)
+ offset = i;
}
+SLJIT_ASSERT(offset == -1 || (chars[offset].count >= 1 && chars[offset].count <= 2));
+
if (range_right < 0)
{
if (offset < 0)
return FALSE;
- SLJIT_ASSERT(chars[offset * MAX_DIFF_CHARS] >= 1 && chars[offset * MAX_DIFF_CHARS] <= 2);
/* Works regardless the value is 1 or 2. */
- mask = chars[offset * MAX_DIFF_CHARS + chars[offset * MAX_DIFF_CHARS]];
- fast_forward_first_char2(common, chars[offset * MAX_DIFF_CHARS + 1], mask, offset);
+ fast_forward_first_char2(common, chars[offset].chars[0], chars[offset].chars[1], offset);
return TRUE;
}
-if (range_right == offset)
- offset = -1;
+SLJIT_ASSERT(range_right != offset);
-SLJIT_ASSERT(offset == -1 || (chars[offset * MAX_DIFF_CHARS] >= 1 && chars[offset * MAX_DIFF_CHARS] <= 2));
-
-max -= 1;
-SLJIT_ASSERT(max > 0);
if (common->match_end_ptr != 0)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
- quit = CMP(SLJIT_LESS_EQUAL, STR_END, 0, TMP1, 0);
- OP1(SLJIT_MOV, STR_END, 0, TMP1, 0);
- JUMPHERE(quit);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0);
+ CMOV(SLJIT_GREATER, STR_END, TMP1, 0);
}
else
OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
@@ -4462,7 +5212,7 @@ OP1(SLJIT_MOV, RETURN_ADDR, 0, SLJIT_IMM, (sljit_sw)update_table);
#endif
start = LABEL();
-quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0));
#if PCRE2_CODE_UNIT_WIDTH == 8 || (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right));
@@ -4483,20 +5233,20 @@ if (offset >= 0)
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(offset));
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- if (chars[offset * MAX_DIFF_CHARS] == 1)
- CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset * MAX_DIFF_CHARS + 1], start);
+ if (chars[offset].count == 1)
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[0], start);
else
{
- mask = chars[offset * MAX_DIFF_CHARS + 1] ^ chars[offset * MAX_DIFF_CHARS + 2];
+ mask = chars[offset].chars[0] ^ chars[offset].chars[1];
if (is_powerof2(mask))
{
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, mask);
- CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset * MAX_DIFF_CHARS + 1] | mask, start);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[0] | mask, start);
}
else
{
- match = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset * MAX_DIFF_CHARS + 1]);
- CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset * MAX_DIFF_CHARS + 2], start);
+ match = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[0]);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[1], start);
JUMPHERE(match);
}
}
@@ -4512,15 +5262,9 @@ if (common->utf && offset != 0)
}
else
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
-#if PCRE2_CODE_UNIT_WIDTH == 8
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xc0);
- CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, start);
-#elif PCRE2_CODE_UNIT_WIDTH == 16
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- CMPTO(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0xdc00, start);
-#else
-#error "Unknown code width"
-#endif
+
+ jumpto_if_not_utf_char_start(compiler, TMP1, start);
+
if (offset < 0)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
}
@@ -4529,33 +5273,20 @@ if (common->utf && offset != 0)
if (offset >= 0)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-JUMPHERE(quit);
-
if (common->match_end_ptr != 0)
- {
- if (range_right >= 0)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
- if (range_right >= 0)
- {
- quit = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP1, 0);
- OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0);
- JUMPHERE(quit);
- }
- }
else
OP2(SLJIT_ADD, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
return TRUE;
}
-#undef MAX_N_CHARS
-
-static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, PCRE2_UCHAR first_char, BOOL caseless)
+static SLJIT_INLINE void fast_forward_first_char(compiler_common *common)
{
+PCRE2_UCHAR first_char = (PCRE2_UCHAR)(common->re->first_codeunit);
PCRE2_UCHAR oc;
oc = first_char;
-if (caseless)
+if ((common->re->flags & PCRE2_FIRSTCASELESS) != 0)
{
oc = TABLE_GET(first_char, common->fcc, first_char);
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
@@ -4593,8 +5324,8 @@ if (common->nltype == NLTYPE_FIXED && common->newline > 255)
firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER_EQUAL);
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -4638,8 +5369,8 @@ if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
JUMPHERE(foundcr);
notfoundnl = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -4654,79 +5385,75 @@ if (common->match_end_ptr != 0)
OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
}
-static BOOL check_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks);
+static BOOL optimize_class(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks);
-static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common, const sljit_u8 *start_bits)
+static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common)
{
DEFINE_COMPILER;
+const sljit_u8 *start_bits = common->re->start_bitmap;
struct sljit_label *start;
-struct sljit_jump *quit;
-struct sljit_jump *found = NULL;
-jump_list *matches = NULL;
+struct sljit_jump *partial_quit;
#if PCRE2_CODE_UNIT_WIDTH != 8
-struct sljit_jump *jump;
+struct sljit_jump *found = NULL;
#endif
+jump_list *matches = NULL;
if (common->match_end_ptr != 0)
{
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
OP1(SLJIT_MOV, RETURN_ADDR, 0, STR_END, 0);
- OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0);
+ CMOV(SLJIT_GREATER, STR_END, TMP1, 0);
}
start = LABEL();
-quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+
+partial_quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit);
+
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
-#ifdef SUPPORT_UNICODE
-if (common->utf)
- OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
-#endif
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-if (!check_class_ranges(common, start_bits, (start_bits[31] & 0x80) != 0, TRUE, &matches))
+if (!optimize_class(common, start_bits, (start_bits[31] & 0x80) != 0, FALSE, &matches))
{
#if PCRE2_CODE_UNIT_WIDTH != 8
- jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 255);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 255);
- JUMPHERE(jump);
+ if ((start_bits[31] & 0x80) != 0)
+ found = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 255);
+ else
+ CMPTO(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 255, start);
+#elif defined SUPPORT_UNICODE
+ if (common->utf && is_char7_bitset(start_bits, FALSE))
+ CMPTO(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 127, start);
#endif
OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
- OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- found = JUMP(SLJIT_NOT_ZERO);
+ if (sljit_get_register_index(TMP3) >= 0)
+ {
+ OP2(SLJIT_SHL, TMP3, 0, SLJIT_IMM, 1, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP3, 0);
+ }
+ else
+ {
+ OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ }
+ JUMPTO(SLJIT_ZERO, start);
}
+else
+ set_jumps(matches, start);
-#ifdef SUPPORT_UNICODE
-if (common->utf)
- OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
-#endif
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-#ifdef SUPPORT_UNICODE
-#if PCRE2_CODE_UNIT_WIDTH == 8
-if (common->utf)
- {
- CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
- OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
- }
-#elif PCRE2_CODE_UNIT_WIDTH == 16
-if (common->utf)
- {
- CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
- OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
- }
-#endif /* PCRE2_CODE_UNIT_WIDTH == [8|16] */
-#endif /* SUPPORT_UNICODE */
-JUMPTO(SLJIT_JUMP, start);
+#if PCRE2_CODE_UNIT_WIDTH != 8
if (found != NULL)
JUMPHERE(found);
-if (matches != NULL)
- set_jumps(matches, LABEL());
-JUMPHERE(quit);
+#endif
+
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+if (common->mode != PCRE2_JIT_COMPLETE)
+ JUMPHERE(partial_quit);
if (common->match_end_ptr != 0)
OP1(SLJIT_MOV, STR_END, 0, RETURN_ADDR, 0);
@@ -4802,31 +5529,50 @@ struct sljit_jump *jump;
struct sljit_label *mainloop;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP1(SLJIT_MOV, TMP1, 0, STACK_TOP, 0);
-GET_LOCAL_BASE(TMP3, 0, 0);
+GET_LOCAL_BASE(TMP1, 0, 0);
/* Drop frames until we reach STACK_TOP. */
mainloop = LABEL();
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);
-OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0);
-jump = JUMP(SLJIT_SIG_LESS_EQUAL);
-
-OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_sw));
-OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
+OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), -sizeof(sljit_sw));
+jump = CMP(SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0);
+
+OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
+if (sljit_get_register_index (TMP3) < 0)
+ {
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -(3 * sizeof(sljit_sw)));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
+ }
+else
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
+ OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(STACK_TOP), -(3 * sizeof(sljit_sw)));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, TMP1, 0);
+ GET_LOCAL_BASE(TMP1, 0, 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP3, 0);
+ }
JUMPTO(SLJIT_JUMP, mainloop);
JUMPHERE(jump);
-jump = JUMP(SLJIT_SIG_LESS);
-/* End of dropping frames. */
+jump = CMP(SLJIT_NOT_ZERO /* SIG_LESS */, TMP2, 0, SLJIT_IMM, 0);
+/* End of reverting values. */
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
OP1(SLJIT_NEG, TMP2, 0, TMP2, 0);
-OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
-OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
+OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
+if (sljit_get_register_index (TMP3) < 0)
+ {
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
+ }
+else
+ {
+ OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, TMP3, 0);
+ }
JUMPTO(SLJIT_JUMP, mainloop);
}
@@ -4859,11 +5605,11 @@ if (common->use_ucp)
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
}
@@ -4903,11 +5649,11 @@ if (common->use_ucp)
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
}
else
@@ -4935,15 +5681,15 @@ else
}
set_jumps(skipread_list, LABEL());
-OP2(SLJIT_XOR | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
+OP2(SLJIT_XOR | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
}
-static BOOL check_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
+static BOOL optimize_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
{
/* May destroy TMP1. */
DEFINE_COMPILER;
-int ranges[MAX_RANGE_SIZE];
+int ranges[MAX_CLASS_RANGE_SIZE];
sljit_u8 bit, cbit, all;
int i, byte, length = 0;
@@ -4961,7 +5707,7 @@ for (i = 0; i < 256; )
cbit = (bits[byte] >> (i & 0x7)) & 0x1;
if (cbit != bit)
{
- if (length >= MAX_RANGE_SIZE)
+ if (length >= MAX_CLASS_RANGE_SIZE)
return FALSE;
ranges[length] = i;
length++;
@@ -4974,7 +5720,7 @@ for (i = 0; i < 256; )
if (((bit == 0) && nclass) || ((bit == 1) && !nclass))
{
- if (length >= MAX_RANGE_SIZE)
+ if (length >= MAX_CLASS_RANGE_SIZE)
return FALSE;
ranges[length] = 256;
length++;
@@ -5086,9 +5832,116 @@ switch(length)
return TRUE;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
+ return FALSE;
+ }
+}
+
+static BOOL optimize_class_chars(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
+{
+/* May destroy TMP1. */
+DEFINE_COMPILER;
+uint16_t char_list[MAX_CLASS_CHARS_SIZE];
+uint8_t byte;
+sljit_s32 type;
+int i, j, k, len, c;
+
+if (!sljit_has_cpu_feature(SLJIT_HAS_CMOV))
return FALSE;
+
+if (invert)
+ nclass = !nclass;
+
+len = 0;
+
+for (i = 0; i < 32; i++)
+ {
+ byte = bits[i];
+
+ if (nclass)
+ byte = ~byte;
+
+ j = 0;
+ while (byte != 0)
+ {
+ if (byte & 0x1)
+ {
+ c = i * 8 + j;
+
+ k = len;
+
+ if ((c & 0x20) != 0)
+ {
+ for (k = 0; k < len; k++)
+ if (char_list[k] == c - 0x20)
+ {
+ char_list[k] |= 0x120;
+ break;
+ }
+ }
+
+ if (k == len)
+ {
+ if (len >= MAX_CLASS_CHARS_SIZE)
+ return FALSE;
+
+ char_list[len++] = (uint16_t) c;
+ }
+ }
+
+ byte >>= 1;
+ j++;
+ }
+ }
+
+i = 0;
+j = 0;
+
+if (char_list[0] == 0)
+ {
+ i++;
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_ZERO);
}
+else
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
+
+while (i < len)
+ {
+ if ((char_list[i] & 0x100) != 0)
+ j++;
+ else
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char_list[i]);
+ CMOV(SLJIT_ZERO, TMP2, TMP1, 0);
+ }
+ i++;
+ }
+
+if (j != 0)
+ {
+ OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x20);
+
+ for (i = 0; i < len; i++)
+ if ((char_list[i] & 0x100) != 0)
+ {
+ j--;
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char_list[i] & 0xff);
+ CMOV(SLJIT_ZERO, TMP2, TMP1, 0);
+ }
+ }
+
+type = nclass ? SLJIT_NOT_EQUAL : SLJIT_EQUAL;
+add_jump(compiler, backtracks, CMP(type, TMP2, 0, SLJIT_IMM, 0));
+return TRUE;
+}
+
+static BOOL optimize_class(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks)
+{
+/* May destroy TMP1. */
+if (optimize_class_ranges(common, bits, nclass, invert, backtracks))
+ return TRUE;
+return optimize_class_chars(common, bits, nclass, invert, backtracks);
}
static void check_anynewline(compiler_common *common)
@@ -5099,22 +5952,22 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
-OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
+OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
#if PCRE2_CODE_UNIT_WIDTH == 8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#if PCRE2_CODE_UNIT_WIDTH == 8
}
#endif
#endif /* SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == [16|32] */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5125,34 +5978,34 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
-OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
+OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
#if PCRE2_CODE_UNIT_WIDTH == 8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x2000);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
#if PCRE2_CODE_UNIT_WIDTH == 8
}
#endif
#endif /* SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == [16|32] */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5165,113 +6018,210 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
-OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
+OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
#if PCRE2_CODE_UNIT_WIDTH == 8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#if PCRE2_CODE_UNIT_WIDTH == 8
}
#endif
#endif /* SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == [16|32] */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
-#define CHAR1 STR_END
-#define CHAR2 STACK_TOP
-
static void do_casefulcmp(compiler_common *common)
{
DEFINE_COMPILER;
struct sljit_jump *jump;
struct sljit_label *label;
+int char1_reg;
+int char2_reg;
-sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
+if (sljit_get_register_index(TMP3) < 0)
+ {
+ char1_reg = STR_END;
+ char2_reg = STACK_TOP;
+ }
+else
+ {
+ char1_reg = TMP3;
+ char2_reg = RETURN_ADDR;
+ }
+
+sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, CHAR2, 0);
-OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
-OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-label = LABEL();
-OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
-OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
-jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
-JUMPTO(SLJIT_NOT_ZERO, label);
+if (char1_reg == STR_END)
+ {
+ OP1(SLJIT_MOV, TMP3, 0, char1_reg, 0);
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, char2_reg, 0);
+ }
-JUMPHERE(jump);
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-OP1(SLJIT_MOV, CHAR1, 0, TMP3, 0);
-OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
-sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
-}
+if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
+ {
+ label = LABEL();
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
+ jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+ JUMPTO(SLJIT_NOT_ZERO, label);
-#define LCC_TABLE STACK_LIMIT
+ JUMPHERE(jump);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ }
+else if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
+ {
+ OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
+ OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+ label = LABEL();
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
+ jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+ JUMPTO(SLJIT_NOT_ZERO, label);
+
+ JUMPHERE(jump);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ }
+else
+ {
+ label = LABEL();
+ OP1(MOV_UCHAR, char1_reg, 0, SLJIT_MEM1(TMP1), 0);
+ OP1(MOV_UCHAR, char2_reg, 0, SLJIT_MEM1(STR_PTR), 0);
+ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+ JUMPTO(SLJIT_NOT_ZERO, label);
+
+ JUMPHERE(jump);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ }
+
+if (char1_reg == STR_END)
+ {
+ OP1(SLJIT_MOV, char1_reg, 0, TMP3, 0);
+ OP1(SLJIT_MOV, char2_reg, 0, RETURN_ADDR, 0);
+ }
+
+sljit_emit_fast_return(compiler, TMP1, 0);
+}
static void do_caselesscmp(compiler_common *common)
{
DEFINE_COMPILER;
struct sljit_jump *jump;
struct sljit_label *label;
+int char1_reg = STR_END;
+int char2_reg;
+int lcc_table;
+int opt_type = 0;
-sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
+if (sljit_get_register_index(TMP3) < 0)
+ {
+ char2_reg = STACK_TOP;
+ lcc_table = STACK_LIMIT;
+ }
+else
+ {
+ char2_reg = RETURN_ADDR;
+ lcc_table = TMP3;
+ }
+
+if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
+ opt_type = 1;
+else if (sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1)) == SLJIT_SUCCESS)
+ opt_type = 2;
+
+sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, CHAR1, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, CHAR2, 0);
-OP1(SLJIT_MOV, LCC_TABLE, 0, SLJIT_IMM, common->lcc);
-OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
-OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, char1_reg, 0);
+
+if (char2_reg == STACK_TOP)
+ {
+ OP1(SLJIT_MOV, TMP3, 0, char2_reg, 0);
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, lcc_table, 0);
+ }
+
+OP1(SLJIT_MOV, lcc_table, 0, SLJIT_IMM, common->lcc);
+
+if (opt_type == 1)
+ {
+ label = LABEL();
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_POST, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
+ }
+else if (opt_type == 2)
+ {
+ OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
+ OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+ label = LABEL();
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char1_reg, SLJIT_MEM1(TMP1), IN_UCHARS(1));
+ sljit_emit_mem(compiler, MOV_UCHAR | SLJIT_MEM_PRE, char2_reg, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
+ }
+else
+ {
+ label = LABEL();
+ OP1(MOV_UCHAR, char1_reg, 0, SLJIT_MEM1(TMP1), 0);
+ OP1(MOV_UCHAR, char2_reg, 0, SLJIT_MEM1(STR_PTR), 0);
+ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
+ }
-label = LABEL();
-OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
-OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
#if PCRE2_CODE_UNIT_WIDTH != 8
-jump = CMP(SLJIT_GREATER, CHAR1, 0, SLJIT_IMM, 255);
+jump = CMP(SLJIT_GREATER, char1_reg, 0, SLJIT_IMM, 255);
#endif
-OP1(SLJIT_MOV_U8, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
+OP1(SLJIT_MOV_U8, char1_reg, 0, SLJIT_MEM2(lcc_table, char1_reg), 0);
#if PCRE2_CODE_UNIT_WIDTH != 8
JUMPHERE(jump);
-jump = CMP(SLJIT_GREATER, CHAR2, 0, SLJIT_IMM, 255);
+jump = CMP(SLJIT_GREATER, char2_reg, 0, SLJIT_IMM, 255);
#endif
-OP1(SLJIT_MOV_U8, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
+OP1(SLJIT_MOV_U8, char2_reg, 0, SLJIT_MEM2(lcc_table, char2_reg), 0);
#if PCRE2_CODE_UNIT_WIDTH != 8
JUMPHERE(jump);
#endif
-jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+
+if (opt_type == 0)
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+jump = CMP(SLJIT_NOT_EQUAL, char1_reg, 0, char2_reg, 0);
+OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
-OP1(SLJIT_MOV, LCC_TABLE, 0, TMP3, 0);
-OP1(SLJIT_MOV, CHAR1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
-OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
-sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
-}
+OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
-#undef LCC_TABLE
-#undef CHAR1
-#undef CHAR2
+if (opt_type == 2)
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+if (char2_reg == STACK_TOP)
+ {
+ OP1(SLJIT_MOV, char2_reg, 0, TMP3, 0);
+ OP1(SLJIT_MOV, lcc_table, 0, RETURN_ADDR, 0);
+ }
+
+OP1(SLJIT_MOV, char1_reg, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
+sljit_emit_fast_return(compiler, TMP1, 0);
+}
#if defined SUPPORT_UNICODE
-static PCRE2_SPTR SLJIT_CALL do_utf_caselesscmp(PCRE2_SPTR src1, jit_arguments *args, PCRE2_SPTR end1)
+static PCRE2_SPTR SLJIT_FUNC do_utf_caselesscmp(PCRE2_SPTR src1, PCRE2_SPTR src2, PCRE2_SPTR end1, PCRE2_SPTR end2)
{
/* This function would be ineffective to do in JIT level. */
sljit_u32 c1, c2;
-PCRE2_SPTR src2 = args->startchar_ptr;
-PCRE2_SPTR end2 = args->end;
const ucd_record *ur;
const sljit_u32 *pp;
@@ -5416,7 +6366,7 @@ do
#endif
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
context->ucharptr = 0;
@@ -5591,7 +6541,7 @@ while (*cc != XCL_END)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
cc += 2;
@@ -5609,13 +6559,13 @@ if ((cc[-1] & XCL_HASPROP) == 0)
if ((cc[-1] & XCL_MAP) != 0)
{
jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
- if (!check_class_ranges(common, (const sljit_u8 *)cc, (((const sljit_u8 *)cc)[31] & 0x80) != 0, TRUE, &found))
+ if (!optimize_class(common, (const sljit_u8 *)cc, (((const sljit_u8 *)cc)[31] & 0x80) != 0, TRUE, &found))
{
OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));
}
@@ -5636,7 +6586,7 @@ else if ((cc[-1] & XCL_MAP) != 0)
#ifdef SUPPORT_UNICODE
charsaved = TRUE;
#endif
- if (!check_class_ranges(common, (const sljit_u8 *)cc, FALSE, TRUE, list))
+ if (!optimize_class(common, (const sljit_u8 *)cc, FALSE, TRUE, list))
{
#if PCRE2_CODE_UNIT_WIDTH == 8
jump = NULL;
@@ -5648,7 +6598,7 @@ else if ((cc[-1] & XCL_MAP) != 0)
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
#if PCRE2_CODE_UNIT_WIDTH == 8
@@ -5667,6 +6617,15 @@ if (needstype || needsscript)
if (needschar && !charsaved)
OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
+#if PCRE2_CODE_UNIT_WIDTH == 32
+ if (!common->utf)
+ {
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, MAX_UTF_CODE_POINT + 1);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
+ JUMPHERE(jump);
+ }
+#endif
+
OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
@@ -5758,14 +6717,14 @@ while (*cc != XCL_END)
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
@@ -5784,14 +6743,14 @@ while (*cc != XCL_END)
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
@@ -5816,12 +6775,12 @@ while (*cc != XCL_END)
break;
case PT_LAMP:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
@@ -5843,33 +6802,33 @@ while (*cc != XCL_END)
case PT_SPACE:
case PT_PXSPACE:
SET_CHAR_OFFSET(9);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
SET_TYPE_OFFSET(ucp_Zl);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_WORD:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
/* Fall through. */
case PT_ALNUM:
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, (*cc == PT_ALNUM) ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Nd);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
@@ -5891,8 +6850,8 @@ while (*cc != XCL_END)
OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
other_cases += 2;
}
else if (is_powerof2(other_cases[2] ^ other_cases[1]))
@@ -5904,63 +6863,63 @@ while (*cc != XCL_END)
OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
- OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
+ OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL);
other_cases += 3;
}
else
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
}
while (*other_cases != NOTACHAR)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
+ OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL);
}
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_UCNC:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
SET_CHAR_OFFSET(0xa0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_GREATER_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_GREATER_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_PXGRAPH:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER);
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
@@ -5969,21 +6928,21 @@ while (*cc != XCL_END)
case PT_PXPRINT:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_NOT_EQUAL);
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
@@ -5991,21 +6950,21 @@ while (*cc != XCL_END)
case PT_PXPUNCT:
SET_TYPE_OFFSET(ucp_Sc);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Pc);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
cc += 2;
@@ -6051,6 +7010,7 @@ switch(type)
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6066,10 +7026,10 @@ switch(type)
else
{
jump[1] = CMP(SLJIT_EQUAL, TMP2, 0, STR_END, 0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_NOT_EQUAL);
add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL));
check_partial(common, TRUE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
@@ -6091,9 +7051,9 @@ switch(type)
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
jump[1] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
jump[2] = JUMP(SLJIT_GREATER);
- add_jump(compiler, backtracks, JUMP(SLJIT_LESS));
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL) /* LESS */);
/* Equal. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
jump[3] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
@@ -6112,6 +7072,7 @@ switch(type)
read_char_range(common, common->nlmin, common->nlmax, TRUE);
add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0));
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
}
@@ -6129,8 +7090,8 @@ switch(type)
case OP_DOLL:
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
- OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
- add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
if (!common->endonly)
compile_simple_assertion_matchingpath(common, OP_EODN, cc, backtracks);
@@ -6144,8 +7105,8 @@ switch(type)
case OP_DOLLM:
jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
- OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
- add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
check_partial(common, FALSE);
jump[0] = JUMP(SLJIT_JUMP);
JUMPHERE(jump[1]);
@@ -6182,16 +7143,16 @@ switch(type)
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
- OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
- add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
return cc;
case OP_CIRCM:
OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0);
- OP2(SLJIT_AND32 | SLJIT_SET_E, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
- add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
jump[0] = JUMP(SLJIT_JUMP);
JUMPHERE(jump[1]);
@@ -6229,7 +7190,7 @@ switch(type)
label = LABEL();
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
skip_char_back(common);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -6242,10 +7203,126 @@ switch(type)
check_start_used_ptr(common);
return cc + LINK_SIZE;
}
-SLJIT_ASSERT_STOP();
+SLJIT_UNREACHABLE();
+return cc;
+}
+
+#ifdef SUPPORT_UNICODE
+
+#if PCRE2_CODE_UNIT_WIDTH != 32
+
+static PCRE2_SPTR SLJIT_FUNC do_extuni_utf(jit_arguments *args, PCRE2_SPTR cc)
+{
+PCRE2_SPTR start_subject = args->begin;
+PCRE2_SPTR end_subject = args->end;
+int lgb, rgb, len, ricount;
+PCRE2_SPTR prevcc, bptr;
+uint32_t c;
+
+prevcc = cc;
+GETCHARINC(c, cc);
+lgb = UCD_GRAPHBREAK(c);
+
+while (cc < end_subject)
+ {
+ len = 1;
+ GETCHARLEN(c, cc, len);
+ rgb = UCD_GRAPHBREAK(c);
+
+ if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+
+ /* Not breaking between Regional Indicators is allowed only if there
+ are an even number of preceding RIs. */
+
+ if (lgb == ucp_gbRegionalIndicator && rgb == ucp_gbRegionalIndicator)
+ {
+ ricount = 0;
+ bptr = prevcc;
+
+ /* bptr is pointing to the left-hand character */
+ while (bptr > start_subject)
+ {
+ bptr--;
+ BACKCHAR(bptr);
+ GETCHAR(c, bptr);
+
+ if (UCD_GRAPHBREAK(c) != ucp_gbRegionalIndicator) break;
+
+ ricount++;
+ }
+
+ if ((ricount & 1) != 0) break; /* Grapheme break required */
+ }
+
+ /* If Extend follows E_Base[_GAZ] do not update lgb; this allows
+ any number of Extend before a following E_Modifier. */
+
+ if (rgb != ucp_gbExtend || (lgb != ucp_gbE_Base && lgb != ucp_gbE_Base_GAZ))
+ lgb = rgb;
+
+ prevcc = cc;
+ cc += len;
+ }
+
return cc;
}
+#endif
+
+static PCRE2_SPTR SLJIT_FUNC do_extuni_no_utf(jit_arguments *args, PCRE2_SPTR cc)
+{
+PCRE2_SPTR start_subject = args->begin;
+PCRE2_SPTR end_subject = args->end;
+int lgb, rgb, ricount;
+PCRE2_SPTR bptr;
+uint32_t c;
+
+GETCHARINC(c, cc);
+lgb = UCD_GRAPHBREAK(c);
+
+while (cc < end_subject)
+ {
+ c = *cc;
+ rgb = UCD_GRAPHBREAK(c);
+
+ if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+
+ /* Not breaking between Regional Indicators is allowed only if there
+ are an even number of preceding RIs. */
+
+ if (lgb == ucp_gbRegionalIndicator && rgb == ucp_gbRegionalIndicator)
+ {
+ ricount = 0;
+ bptr = cc - 1;
+
+ /* bptr is pointing to the left-hand character */
+ while (bptr > start_subject)
+ {
+ bptr--;
+ c = *bptr;
+
+ if (UCD_GRAPHBREAK(c) != ucp_gbRegionalIndicator) break;
+
+ ricount++;
+ }
+
+ if ((ricount & 1) != 0) break; /* Grapheme break required */
+ }
+
+ /* If Extend follows E_Base[_GAZ] do not update lgb; this allows
+ any number of Extend before a following E_Modifier. */
+
+ if (rgb != ucp_gbExtend || (lgb != ucp_gbE_Base && lgb != ucp_gbE_Base_GAZ))
+ lgb = rgb;
+
+ cc++;
+ }
+
+return cc;
+}
+
+#endif
+
static PCRE2_SPTR compile_char1_matchingpath(compiler_common *common, PCRE2_UCHAR type, PCRE2_SPTR cc, jump_list **backtracks, BOOL check_str_ptr)
{
DEFINE_COMPILER;
@@ -6255,7 +7332,6 @@ compare_context context;
struct sljit_jump *jump[3];
jump_list *end_list;
#ifdef SUPPORT_UNICODE
-struct sljit_label *label;
PCRE2_UCHAR propdata[5];
#endif /* SUPPORT_UNICODE */
@@ -6273,7 +7349,7 @@ switch(type)
#endif
read_char8_type(common, type == OP_NOT_DIGIT);
/* Flip the starting bit in the negative case. */
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
add_jump(compiler, backtracks, JUMP(type == OP_DIGIT ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6287,7 +7363,7 @@ switch(type)
else
#endif
read_char8_type(common, type == OP_NOT_WHITESPACE);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
add_jump(compiler, backtracks, JUMP(type == OP_WHITESPACE ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6301,7 +7377,7 @@ switch(type)
else
#endif
read_char8_type(common, type == OP_NOT_WORDCHAR);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
add_jump(compiler, backtracks, JUMP(type == OP_WORDCHAR ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6343,8 +7419,8 @@ switch(type)
#elif PCRE2_CODE_UNIT_WIDTH == 16
jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
#endif
@@ -6404,6 +7480,7 @@ switch(type)
detect_partial_match(common, backtracks);
read_char_range(common, 0x9, 0x3000, type == OP_NOT_HSPACE);
add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6413,6 +7490,7 @@ switch(type)
detect_partial_match(common, backtracks);
read_char_range(common, 0xa, 0x2029, type == OP_NOT_VSPACE);
add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6420,35 +7498,22 @@ switch(type)
case OP_EXTUNI:
if (check_str_ptr)
detect_partial_match(common, backtracks);
- read_char(common);
- add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
- /* Optimize register allocation: use a real register. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
- OP1(SLJIT_MOV_U8, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);
- label = LABEL();
- jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
- read_char(common);
- add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
- OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM2(TMP1, TMP2), 3);
+ SLJIT_ASSERT(TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1);
+ OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
- OP2(SLJIT_SHL, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2);
- OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));
- OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
- OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
- JUMPTO(SLJIT_NOT_ZERO, label);
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM,
+ common->utf ? SLJIT_FUNC_OFFSET(do_extuni_utf) : SLJIT_FUNC_OFFSET(do_extuni_no_utf));
+#else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_extuni_no_utf));
+#endif
- OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
- JUMPHERE(jump[0]);
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
if (common->mode == PCRE2_JIT_PARTIAL_HARD)
{
- jump[0] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
+ jump[0] = CMP(SLJIT_LESS, SLJIT_RETURN_REG, 0, STR_END, 0);
/* Since we successfully read a char above, partial matching must occure. */
check_partial(common, TRUE);
JUMPHERE(jump[0]);
@@ -6582,7 +7647,7 @@ switch(type)
read_char_range(common, 0, 255, type == OP_NCLASS);
#endif
- if (check_class_ranges(common, (const sljit_u8 *)cc, type == OP_NCLASS, FALSE, backtracks))
+ if (optimize_class(common, (const sljit_u8 *)cc, type == OP_NCLASS, FALSE, backtracks))
return cc + 32 / sizeof(PCRE2_UCHAR);
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
@@ -6609,7 +7674,7 @@ switch(type)
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8
@@ -6626,7 +7691,7 @@ switch(type)
return cc + GET(cc, 0) - 1;
#endif
}
-SLJIT_ASSERT_STOP();
+SLJIT_UNREACHABLE();
return cc;
}
@@ -6781,40 +7846,42 @@ else
#if defined SUPPORT_UNICODE
if (common->utf && *cc == OP_REFI)
{
- SLJIT_ASSERT(TMP1 == SLJIT_R0 && STACK_TOP == SLJIT_R1 && TMP2 == SLJIT_R2);
+ SLJIT_ASSERT(TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1);
if (ref)
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
else
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
if (withchecks)
- jump = CMP(SLJIT_EQUAL, TMP1, 0, TMP2, 0);
-
- /* Needed to save important temporary registers. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
- OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), STR_PTR, 0);
- sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_R2, 0);
+ /* No free saved registers so save data on stack. */
+
+ OP1(SLJIT_MOV, SLJIT_R3, 0, STR_END, 0);
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
+
if (common->mode == PCRE2_JIT_COMPLETE)
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1));
else
{
- add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
- nopartial = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_LESS, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
+
+ add_jump(compiler, backtracks, JUMP(SLJIT_LESS));
+
+ nopartial = JUMP(SLJIT_NOT_EQUAL);
+ OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0);
check_partial(common, FALSE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
JUMPHERE(nopartial);
}
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
}
else
#endif /* SUPPORT_UNICODE */
{
if (ref)
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0);
else
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
if (withchecks)
jump = JUMP(SLJIT_ZERO);
@@ -6905,7 +7972,7 @@ switch(type)
cc += 1 + IMM2_SIZE + 1 + 2 * IMM2_SIZE;
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -6919,7 +7986,7 @@ if (!minimize)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
/* Temporary release of STR_PTR. */
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
/* Handles both invalid and empty cases. Since the minimum repeat,
is zero the invalid case is basically the same as an empty case. */
if (ref)
@@ -6932,7 +7999,7 @@ if (!minimize)
zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
/* Restore if not zero length. */
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
}
else
{
@@ -7096,8 +8163,10 @@ if (entry == NULL)
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
return NULL;
entry->next = NULL;
- entry->entry = NULL;
- entry->calls = NULL;
+ entry->entry_label = NULL;
+ entry->backtrack_label = NULL;
+ entry->entry_calls = NULL;
+ entry->backtrack_calls = NULL;
entry->start = start;
if (prev != NULL)
@@ -7106,71 +8175,74 @@ if (entry == NULL)
common->entries = entry;
}
-if (common->has_set_som && common->mark_ptr != 0)
- {
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
- allocate_stack(common, 2);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);
- }
-else if (common->has_set_som || common->mark_ptr != 0)
- {
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr);
- allocate_stack(common, 1);
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
- }
+BACKTRACK_AS(recurse_backtrack)->entry = entry;
-if (entry->entry == NULL)
- add_jump(compiler, &entry->calls, JUMP(SLJIT_FAST_CALL));
+if (entry->entry_label == NULL)
+ add_jump(compiler, &entry->entry_calls, JUMP(SLJIT_FAST_CALL));
else
- JUMPTO(SLJIT_FAST_CALL, entry->entry);
+ JUMPTO(SLJIT_FAST_CALL, entry->entry_label);
/* Leave if the match is failed. */
add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, 0));
+BACKTRACK_AS(recurse_backtrack)->matchingpath = LABEL();
return cc + 1 + LINK_SIZE;
}
-static int SLJIT_CALL do_callout(struct jit_arguments *arguments, pcre2_callout_block *callout_block, PCRE2_SPTR *jit_ovector)
+static sljit_s32 SLJIT_FUNC do_callout(struct jit_arguments *arguments, pcre2_callout_block *callout_block, PCRE2_SPTR *jit_ovector)
{
-PCRE2_SPTR begin = arguments->begin;
-PCRE2_SIZE *ovector = arguments->match_data->ovector;
-sljit_u32 oveccount = arguments->oveccount;
-sljit_u32 i;
+PCRE2_SPTR begin;
+PCRE2_SIZE *ovector;
+sljit_u32 oveccount, capture_top;
if (arguments->callout == NULL)
return 0;
-callout_block->version = 1;
+SLJIT_COMPILE_ASSERT(sizeof (PCRE2_SIZE) <= sizeof (sljit_sw), pcre2_size_must_be_lower_than_sljit_sw_size);
+
+begin = arguments->begin;
+ovector = (PCRE2_SIZE*)(callout_block + 1);
+oveccount = callout_block->capture_top;
+
+SLJIT_ASSERT(oveccount >= 1);
+
+callout_block->version = 2;
+callout_block->callout_flags = 0;
/* Offsets in subject. */
callout_block->subject_length = arguments->end - arguments->begin;
-callout_block->start_match = (PCRE2_SPTR)callout_block->subject - arguments->begin;
-callout_block->current_position = (PCRE2_SPTR)callout_block->offset_vector - arguments->begin;
+callout_block->start_match = jit_ovector[0] - begin;
+callout_block->current_position = (PCRE2_SPTR)callout_block->offset_vector - begin;
callout_block->subject = begin;
/* Convert and copy the JIT offset vector to the ovector array. */
-callout_block->capture_top = 0;
+callout_block->capture_top = 1;
callout_block->offset_vector = ovector;
-for (i = 2; i < oveccount; i += 2)
- {
- ovector[i] = jit_ovector[i] - begin;
- ovector[i + 1] = jit_ovector[i + 1] - begin;
- if (jit_ovector[i] >= begin)
- callout_block->capture_top = i;
- }
-callout_block->capture_top = (callout_block->capture_top >> 1) + 1;
ovector[0] = PCRE2_UNSET;
ovector[1] = PCRE2_UNSET;
+ovector += 2;
+jit_ovector += 2;
+capture_top = 1;
+
+/* Convert pointers to sizes. */
+while (--oveccount != 0)
+ {
+ capture_top++;
+
+ ovector[0] = (PCRE2_SIZE)(jit_ovector[0] - begin);
+ ovector[1] = (PCRE2_SIZE)(jit_ovector[1] - begin);
+
+ if (ovector[0] != PCRE2_UNSET)
+ callout_block->capture_top = capture_top;
+
+ ovector += 2;
+ jit_ovector += 2;
+ }
+
return (arguments->callout)(callout_block, arguments->callout_data);
}
-/* Aligning to 8 byte. */
-#define CALLOUT_ARG_SIZE \
- (((int)sizeof(pcre2_callout_block) + 7) & ~7)
-
#define CALLOUT_ARG_OFFSET(arg) \
- (-CALLOUT_ARG_SIZE + SLJIT_OFFSETOF(pcre2_callout_block, arg))
+ SLJIT_OFFSETOF(pcre2_callout_block, arg)
static SLJIT_INLINE PCRE2_SPTR compile_callout_matchingpath(compiler_common *common, PCRE2_SPTR cc, backtrack_common *parent)
{
@@ -7182,10 +8254,13 @@ unsigned int callout_length = (*cc == OP_CALLOUT)
sljit_sw value1;
sljit_sw value2;
sljit_sw value3;
+sljit_uw callout_arg_size = (common->re->top_bracket + 1) * 2 * sizeof(sljit_sw);
PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL);
-allocate_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
+callout_arg_size = (sizeof(pcre2_callout_block) + callout_arg_size + sizeof(sljit_sw) - 1) / sizeof(sljit_sw);
+
+allocate_stack(common, callout_arg_size);
SLJIT_ASSERT(common->capture_last_ptr != 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
@@ -7193,11 +8268,10 @@ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
value1 = (*cc == OP_CALLOUT) ? cc[1 + 2 * LINK_SIZE] : 0;
OP1(SLJIT_MOV_U32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, value1);
OP1(SLJIT_MOV_U32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);
+OP1(SLJIT_MOV_U32, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_top), SLJIT_IMM, common->re->top_bracket + 1);
/* These pointer sized fields temporarly stores internal variables. */
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(offset_vector), STR_PTR, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(subject), TMP2, 0);
if (common->mark_ptr != 0)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr));
@@ -7223,22 +8297,24 @@ OP1(mov_opcode, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_string_length)
OP1(mov_opcode, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_string_offset), SLJIT_IMM, value3);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_ptr != 0) ? TMP2 : SLJIT_IMM, 0);
+SLJIT_ASSERT(TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1);
+
/* Needed to save important temporary registers. */
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
-OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE);
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STR_PTR, 0);
+/* SLJIT_R0 = arguments */
+OP1(SLJIT_MOV, SLJIT_R1, 0, STACK_TOP, 0);
GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
-sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
-OP1(SLJIT_MOV_S32, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
-OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
-free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
+sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(S32) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+free_stack(common, callout_arg_size);
/* Check return value. */
-OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
-add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER));
-if (common->forced_quit_label == NULL)
- add_jump(compiler, &common->forced_quit, JUMP(SLJIT_SIG_LESS));
+OP2(SLJIT_SUB32 | SLJIT_SET_Z | SLJIT_SET_SIG_GREATER, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER32));
+if (common->abort_label == NULL)
+ add_jump(compiler, &common->abort, JUMP(SLJIT_NOT_EQUAL32) /* SIG_LESS */);
else
- JUMPTO(SLJIT_SIG_LESS, common->forced_quit_label);
+ JUMPTO(SLJIT_NOT_EQUAL32 /* SIG_LESS */, common->abort_label);
return cc + callout_length;
}
@@ -7280,6 +8356,7 @@ static PCRE2_SPTR compile_assert_matchingpath(compiler_common *common, PCRE2_SPT
DEFINE_COMPILER;
int framesize;
int extrasize;
+BOOL local_quit_available = FALSE;
BOOL needs_control_head;
int private_data_ptr;
backtrack_common altbacktrack;
@@ -7290,13 +8367,13 @@ jump_list *tmp = NULL;
jump_list **target = (conditional) ? &backtrack->condfailed : &backtrack->common.topbacktracks;
jump_list **found;
/* Saving previous accept variables. */
-BOOL save_local_exit = common->local_exit;
-BOOL save_positive_assert = common->positive_assert;
+BOOL save_local_quit_available = common->local_quit_available;
+BOOL save_in_positive_assertion = common->in_positive_assertion;
then_trap_backtrack *save_then_trap = common->then_trap;
struct sljit_label *save_quit_label = common->quit_label;
struct sljit_label *save_accept_label = common->accept_label;
jump_list *save_quit = common->quit;
-jump_list *save_positive_assert_quit = common->positive_assert_quit;
+jump_list *save_positive_assertion_quit = common->positive_assertion_quit;
jump_list *save_accept = common->accept;
struct sljit_jump *jump;
struct sljit_jump *brajump = NULL;
@@ -7363,7 +8440,7 @@ else
allocate_stack(common, framesize + extrasize);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0);
if (needs_control_head)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
@@ -7378,21 +8455,21 @@ else
else
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);
- init_frame(common, ccbegin, NULL, framesize + extrasize - 1, extrasize, FALSE);
+ init_frame(common, ccbegin, NULL, framesize + extrasize - 1, extrasize);
}
memset(&altbacktrack, 0, sizeof(backtrack_common));
-if (opcode == OP_ASSERT_NOT || opcode == OP_ASSERTBACK_NOT)
+if (conditional || (opcode == OP_ASSERT_NOT || opcode == OP_ASSERTBACK_NOT))
{
- /* Negative assert is stronger than positive assert. */
- common->local_exit = TRUE;
+ /* Control verbs cannot escape from these asserts. */
+ local_quit_available = TRUE;
+ common->local_quit_available = TRUE;
common->quit_label = NULL;
common->quit = NULL;
- common->positive_assert = FALSE;
}
-else
- common->positive_assert = TRUE;
-common->positive_assert_quit = NULL;
+
+common->in_positive_assertion = (opcode == OP_ASSERT || opcode == OP_ASSERTBACK);
+common->positive_assertion_quit = NULL;
while (1)
{
@@ -7408,16 +8485,16 @@ while (1)
compile_matchingpath(common, ccbegin + 1 + LINK_SIZE, cc, &altbacktrack);
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
{
- if (opcode == OP_ASSERT_NOT || opcode == OP_ASSERTBACK_NOT)
+ if (local_quit_available)
{
- common->local_exit = save_local_exit;
+ common->local_quit_available = save_local_quit_available;
common->quit_label = save_quit_label;
common->quit = save_quit;
}
- common->positive_assert = save_positive_assert;
+ common->in_positive_assertion = save_in_positive_assertion;
common->then_trap = save_then_trap;
common->accept_label = save_accept_label;
- common->positive_assert_quit = save_positive_assert_quit;
+ common->positive_assertion_quit = save_positive_assertion_quit;
common->accept = save_accept;
return NULL;
}
@@ -7434,23 +8511,24 @@ while (1)
free_stack(common, extrasize);
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
else
{
if ((opcode != OP_ASSERT_NOT && opcode != OP_ASSERTBACK_NOT) || conditional)
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
else
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 2));
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize - 1) * sizeof(sljit_sw));
}
}
@@ -7460,25 +8538,25 @@ while (1)
if (conditional)
{
if (extrasize > 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? sizeof(sljit_sw) : 0);
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? STACK(-2) : STACK(-1));
}
else if (bra == OP_BRAZERO)
{
if (framesize < 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize));
else
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (framesize + extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-framesize - extrasize));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0);
}
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
}
else if (framesize >= 0)
{
/* For OP_BRA and OP_BRAMINZERO. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
}
}
add_jump(compiler, found, JUMP(SLJIT_JUMP));
@@ -7486,16 +8564,16 @@ while (1)
compile_backtrackingpath(common, altbacktrack.top);
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
{
- if (opcode == OP_ASSERT_NOT || opcode == OP_ASSERTBACK_NOT)
+ if (local_quit_available)
{
- common->local_exit = save_local_exit;
+ common->local_quit_available = save_local_quit_available;
common->quit_label = save_quit_label;
common->quit = save_quit;
}
- common->positive_assert = save_positive_assert;
+ common->in_positive_assertion = save_in_positive_assertion;
common->then_trap = save_then_trap;
common->accept_label = save_accept_label;
- common->positive_assert_quit = save_positive_assert_quit;
+ common->positive_assertion_quit = save_positive_assertion_quit;
common->accept = save_accept;
return NULL;
}
@@ -7508,26 +8586,26 @@ while (1)
cc += GET(cc, 1);
}
-if (opcode == OP_ASSERT_NOT || opcode == OP_ASSERTBACK_NOT)
+if (local_quit_available)
{
- SLJIT_ASSERT(common->positive_assert_quit == NULL);
+ SLJIT_ASSERT(common->positive_assertion_quit == NULL);
/* Makes the check less complicated below. */
- common->positive_assert_quit = common->quit;
+ common->positive_assertion_quit = common->quit;
}
/* None of them matched. */
-if (common->positive_assert_quit != NULL)
+if (common->positive_assertion_quit != NULL)
{
jump = JUMP(SLJIT_JUMP);
- set_jumps(common->positive_assert_quit, LABEL());
+ set_jumps(common->positive_assertion_quit, LABEL());
SLJIT_ASSERT(framesize != no_stack);
if (framesize < 0)
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw));
else
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (extrasize + 1) * sizeof(sljit_sw));
}
JUMPHERE(jump);
}
@@ -7576,18 +8654,18 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
{
/* We know that STR_PTR was stored on the top of the stack. */
if (extrasize > 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize));
/* Keep the STR_PTR on the top of the stack. */
if (bra == OP_BRAZERO)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
if (extrasize == 2)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
}
else if (bra == OP_BRAMINZERO)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
}
}
@@ -7596,13 +8674,13 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
if (bra == OP_BRA)
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 2) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize + 1));
}
else
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw));
if (extrasize == 2)
{
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
@@ -7630,7 +8708,9 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0);
}
set_jumps(backtrack->common.topbacktracks, LABEL());
}
@@ -7683,16 +8763,16 @@ else
}
}
-if (opcode == OP_ASSERT_NOT || opcode == OP_ASSERTBACK_NOT)
+if (local_quit_available)
{
- common->local_exit = save_local_exit;
+ common->local_quit_available = save_local_quit_available;
common->quit_label = save_quit_label;
common->quit = save_quit;
}
-common->positive_assert = save_positive_assert;
+common->in_positive_assertion = save_in_positive_assertion;
common->then_trap = save_then_trap;
common->accept_label = save_accept_label;
-common->positive_assert_quit = save_positive_assert_quit;
+common->positive_assertion_quit = save_positive_assertion_quit;
common->accept = save_accept;
return cc + 1 + LINK_SIZE;
}
@@ -7717,23 +8797,23 @@ if (framesize < 0)
}
if (needs_control_head)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), (ket != OP_KET || has_alternatives) ? sizeof(sljit_sw) : 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), (ket != OP_KET || has_alternatives) ? STACK(-2) : STACK(-1));
/* TMP2 which is set here used by OP_KETRMAX below. */
if (ket == OP_KETRMAX)
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-1));
else if (ket == OP_KETRMIN)
{
/* Move the STR_PTR to the private_data_ptr. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
}
else
{
stacksize = (ket != OP_KET || has_alternatives) ? 2 : 1;
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw));
if (needs_control_head)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-1));
if (ket == OP_KETRMAX)
{
@@ -7820,7 +8900,6 @@ return stacksize;
(|) OP_*BRA | OP_ALT ... M A
(?()|) OP_*COND | OP_ALT M A
(?>|) OP_ONCE | OP_ALT ... [stack trace] M A
- (?>|) OP_ONCE_NC | OP_ALT ... [stack trace] M A
Or nothing, if trace is unnecessary
*/
@@ -7888,8 +8967,6 @@ if (SLJIT_UNLIKELY(opcode == OP_COND || opcode == OP_SCOND))
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
opcode = OP_SCOND;
-if (SLJIT_UNLIKELY(opcode == OP_ONCE_NC))
- opcode = OP_ONCE;
if (opcode == OP_CBRA || opcode == OP_SCBRA)
{
@@ -7966,7 +9043,7 @@ if (bra == OP_BRAMINZERO)
{
/* Except when the whole stack frame must be saved. */
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw));
+ braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), STACK(-BACKTRACK_AS(bracket_backtrack)->u.framesize - 2));
}
JUMPHERE(skip);
}
@@ -8039,7 +9116,7 @@ if (opcode == OP_ONCE)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), STR_PTR, 0);
if (BACKTRACK_AS(bracket_backtrack)->u.framesize == no_frame)
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize + 1), TMP2, 0);
}
else if (ket == OP_KETRMAX || has_alternatives)
@@ -8057,7 +9134,7 @@ if (opcode == OP_ONCE)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
stacksize = needs_control_head ? 1 : 0;
if (ket != OP_KET || has_alternatives)
@@ -8072,7 +9149,7 @@ if (opcode == OP_ONCE)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), TMP1, 0);
}
- init_frame(common, ccbegin, NULL, BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize, stacksize + 1, FALSE);
+ init_frame(common, ccbegin, NULL, BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize, stacksize + 1);
}
}
else if (opcode == OP_CBRA || opcode == OP_SCBRA)
@@ -8129,13 +9206,13 @@ if (opcode == OP_COND || opcode == OP_SCOND)
slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
slot += common->name_entry_size;
i--;
while (i-- > 0)
{
OP2(SLJIT_SUB, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
- OP2(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, STR_PTR, 0);
+ OP2(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, TMP2, 0, STR_PTR, 0);
slot += common->name_entry_size;
}
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
@@ -8288,7 +9365,7 @@ if (ket == OP_KETRMAX)
{
if (has_alternatives)
BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, rmax_label);
/* Drop STR_PTR for greedy plus quantifier. */
if (opcode != OP_ONCE)
@@ -8318,7 +9395,7 @@ if (ket == OP_KETRMAX)
if (repeat_type == OP_EXACT)
{
count_match(common);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, rmax_label);
}
else if (repeat_type == OP_UPTO)
@@ -8346,6 +9423,7 @@ if (bra == OP_BRAMINZERO)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (BACKTRACK_AS(bracket_backtrack)->u.framesize - 1) * sizeof(sljit_sw));
}
else if (ket == OP_KETRMIN && opcode != OP_ONCE)
free_stack(common, 1);
@@ -8418,7 +9496,7 @@ switch(opcode)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -8496,7 +9574,7 @@ else
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
if (needs_control_head)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
stack = 0;
if (!zero)
@@ -8515,7 +9593,7 @@ else
stack++;
}
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stack), TMP1, 0);
- init_frame(common, cc, NULL, stacksize - 1, stacksize - framesize, FALSE);
+ init_frame(common, cc, NULL, stacksize - 1, stacksize - framesize);
stack -= 1 + (offset == 0);
}
@@ -8568,7 +9646,7 @@ while (*cc != OP_KETRPOS)
{
if (offset != 0)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), cbraprivptr, STR_PTR, 0);
@@ -8579,10 +9657,10 @@ while (*cc != OP_KETRPOS)
else
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_ADD, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
if (opcode == OP_SBRAPOS)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw));
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw), STR_PTR, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), STACK(-framesize - 2));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), STACK(-framesize - 2), STR_PTR, 0);
}
/* Even if the match is empty, we need to reset the control head. */
@@ -8628,7 +9706,7 @@ while (*cc != OP_KETRPOS)
else
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), STACK(-framesize - 2));
}
}
@@ -8645,7 +9723,7 @@ if (!zero)
if (framesize < 0)
add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));
else /* TMP2 is set to [private_data_ptr] above. */
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_sw), SLJIT_IMM, 0));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), STACK(-stacksize), SLJIT_IMM, 0));
}
/* None of them matched. */
@@ -8868,7 +9946,7 @@ if (exact > 1)
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -8876,7 +9954,7 @@ if (exact > 1)
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
}
@@ -8906,7 +9984,7 @@ switch(opcode)
if (opcode == OP_UPTO)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
jump = JUMP(SLJIT_ZERO);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0);
}
@@ -8968,7 +10046,7 @@ switch(opcode)
label = LABEL();
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO));
}
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
@@ -8988,7 +10066,7 @@ switch(opcode)
OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
}
@@ -9015,7 +10093,7 @@ switch(opcode)
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -9044,7 +10122,7 @@ switch(opcode)
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -9070,7 +10148,7 @@ switch(opcode)
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
}
@@ -9157,7 +10235,7 @@ switch(opcode)
label = LABEL();
compile_char1_matchingpath(common, type, cc, &no_match, TRUE);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
set_jumps(no_match, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1);
@@ -9168,7 +10246,7 @@ switch(opcode)
label = LABEL();
detect_partial_match(common, &no_match);
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
set_jumps(no_char1_match, LABEL());
@@ -9186,7 +10264,7 @@ switch(opcode)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -9207,6 +10285,9 @@ if (*cc == OP_FAIL)
return cc + 1;
}
+if (*cc == OP_ACCEPT && common->currententry == NULL && (common->re->overall_options & PCRE2_ENDANCHORED) != 0)
+ add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0));
+
if (*cc == OP_ASSERT_ACCEPT || common->currententry != NULL || !common->might_be_empty)
{
/* No need to check notempty conditions. */
@@ -9223,9 +10304,9 @@ else
CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_NOT_ZERO));
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
if (common->accept_label == NULL)
add_jump(compiler, &common->accept, JUMP(SLJIT_ZERO));
else
@@ -9309,7 +10390,7 @@ size = 3 + (size < 0 ? 0 : size);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
allocate_stack(common, size);
if (size > 3)
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
else
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 1), SLJIT_IMM, BACKTRACK_AS(then_trap_backtrack)->start);
@@ -9318,7 +10399,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 3), TMP2, 0);
size = BACKTRACK_AS(then_trap_backtrack)->framesize;
if (size >= 0)
- init_frame(common, cc, ccend, size - 1, 0, FALSE);
+ init_frame(common, cc, ccend, size - 1, 0);
}
static void compile_matchingpath(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, backtrack_common *parent)
@@ -9540,7 +10621,6 @@ while (cc < ccend)
break;
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRA:
case OP_CBRA:
case OP_COND:
@@ -9615,7 +10695,7 @@ while (cc < ccend)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return;
}
if (cc == NULL)
@@ -9723,7 +10803,7 @@ switch(opcode)
case OP_MINUPTO:
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
add_jump(compiler, &jumplist, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
@@ -9769,7 +10849,7 @@ switch(opcode)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -9804,27 +10884,21 @@ free_stack(common, ref ? 2 : 3);
static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_common *common, struct backtrack_common *current)
{
DEFINE_COMPILER;
+recurse_entry *entry;
-if (CURRENT_AS(recurse_backtrack)->inlined_pattern)
- compile_backtrackingpath(common, current->top);
-set_jumps(current->topbacktracks, LABEL());
-if (CURRENT_AS(recurse_backtrack)->inlined_pattern)
- return;
-
-if (common->has_set_som && common->mark_ptr != 0)
+if (!CURRENT_AS(recurse_backtrack)->inlined_pattern)
{
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
- free_stack(common, 2);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), TMP2, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP1, 0);
- }
-else if (common->has_set_som || common->mark_ptr != 0)
- {
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
- free_stack(common, 1);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr, TMP2, 0);
+ entry = CURRENT_AS(recurse_backtrack)->entry;
+ if (entry->backtrack_label == NULL)
+ add_jump(compiler, &entry->backtrack_calls, JUMP(SLJIT_FAST_CALL));
+ else
+ JUMPTO(SLJIT_FAST_CALL, entry->backtrack_label);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, CURRENT_AS(recurse_backtrack)->matchingpath);
}
+else
+ compile_backtrackingpath(common, current->top);
+
+set_jumps(current->topbacktracks, LABEL());
}
static void compile_assert_backtrackingpath(compiler_common *common, struct backtrack_common *current)
@@ -9877,7 +10951,9 @@ if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (CURRENT_AS(assert_backtrack)->framesize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, TMP1, 0);
set_jumps(current->topbacktracks, LABEL());
}
@@ -9887,7 +10963,7 @@ else
if (bra == OP_BRAZERO)
{
/* We know there is enough place on the stack. */
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
JUMPTO(SLJIT_JUMP, CURRENT_AS(assert_backtrack)->matchingpath);
JUMPHERE(brajump);
@@ -9947,8 +11023,6 @@ if (opcode == OP_CBRA || opcode == OP_SCBRA)
offset = (GET2(ccbegin, 1 + LINK_SIZE)) << 1;
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
opcode = OP_SCOND;
-if (SLJIT_UNLIKELY(opcode == OP_ONCE_NC))
- opcode = OP_ONCE;
alt_max = has_alternatives ? no_alternatives(ccbegin) : 0;
@@ -10000,7 +11074,7 @@ else if (ket == OP_KETRMIN)
else
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (CURRENT_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), STACK(-CURRENT_AS(bracket_backtrack)->u.framesize - 2), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
}
/* Drop STR_PTR for non-greedy plus quantifier. */
if (opcode != OP_ONCE)
@@ -10054,6 +11128,7 @@ if (SLJIT_UNLIKELY(opcode == OP_ONCE))
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (CURRENT_AS(bracket_backtrack)->u.framesize - 1) * sizeof(sljit_sw));
}
once = JUMP(SLJIT_JUMP);
}
@@ -10106,7 +11181,9 @@ if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND))
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (assert->framesize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, TMP1, 0);
}
cond = JUMP(SLJIT_JUMP);
set_jumps(CURRENT_AS(bracket_backtrack)->u.assert->condfailed, LABEL());
@@ -10247,7 +11324,9 @@ if (has_alternatives)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (assert->framesize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, TMP1, 0);
}
JUMPHERE(cond);
}
@@ -10302,7 +11381,7 @@ else if (opcode == OP_ONCE)
JUMPHERE(once);
/* Restore previous private_data_ptr */
if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(bracket_backtrack)->u.framesize - 1));
else if (ket == OP_KETRMIN)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
@@ -10383,6 +11462,7 @@ if (CURRENT_AS(bracketpos_backtrack)->framesize < 0)
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (CURRENT_AS(bracketpos_backtrack)->framesize - 1) * sizeof(sljit_sw));
if (current->topbacktracks)
{
@@ -10392,7 +11472,7 @@ if (current->topbacktracks)
free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
JUMPHERE(jump);
}
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_sw));
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(bracketpos_backtrack)->framesize - 1));
}
static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current)
@@ -10438,22 +11518,23 @@ if (opcode == OP_THEN || opcode == OP_THEN_ARG)
jump = JUMP(SLJIT_JUMP);
loop = LABEL();
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), -(int)sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
JUMPHERE(jump);
- CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(2 * sizeof(sljit_sw)), TMP1, 0, loop);
- CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(3 * sizeof(sljit_sw)), TMP2, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0, loop);
add_jump(compiler, &common->then_trap->quit, JUMP(SLJIT_JUMP));
return;
}
- else if (common->positive_assert)
+ else if (!common->local_quit_available && common->in_positive_assertion)
{
- add_jump(compiler, &common->positive_assert_quit, JUMP(SLJIT_JUMP));
+ add_jump(compiler, &common->positive_assertion_quit, JUMP(SLJIT_JUMP));
return;
}
}
-if (common->local_exit)
+if (common->local_quit_available)
{
+ /* Abort match with a fail. */
if (common->quit_label == NULL)
add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP));
else
@@ -10463,15 +11544,13 @@ if (common->local_exit)
if (opcode == OP_SKIP_ARG)
{
- SLJIT_ASSERT(common->control_head_ptr != 0);
+ SLJIT_ASSERT(common->control_head_ptr != 0 && TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, (sljit_sw)(current->cc + 2));
- sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_search_mark));
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, (sljit_sw)(current->cc + 2));
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_search_mark));
- OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0);
- add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, -1));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_R0, 0);
+ add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_IMM, 0));
return;
}
@@ -10504,7 +11583,10 @@ jump = JUMP(SLJIT_JUMP);
set_jumps(CURRENT_AS(then_trap_backtrack)->quit, LABEL());
/* STACK_TOP is set by THEN. */
if (CURRENT_AS(then_trap_backtrack)->framesize >= 0)
+ {
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (CURRENT_AS(then_trap_backtrack)->framesize - 1) * sizeof(sljit_sw));
+ }
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 3);
@@ -10621,7 +11703,6 @@ while (current)
break;
case OP_ONCE:
- case OP_ONCE_NC:
case OP_BRA:
case OP_CBRA:
case OP_COND:
@@ -10670,7 +11751,7 @@ while (current)
break;
case OP_COMMIT:
- if (!common->local_exit)
+ if (!common->local_quit_available)
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_NOMATCH);
if (common->quit_label == NULL)
add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP));
@@ -10692,7 +11773,7 @@ while (current)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
current = current->prev;
@@ -10707,38 +11788,52 @@ PCRE2_SPTR cc = common->start + common->currententry->start;
PCRE2_SPTR ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE);
PCRE2_SPTR ccend = bracketend(cc) - (1 + LINK_SIZE);
BOOL needs_control_head;
-int framesize = get_framesize(common, cc, NULL, TRUE, &needs_control_head);
-int private_data_size = get_private_data_copy_length(common, ccbegin, ccend, needs_control_head);
-int alternativesize;
-BOOL needs_frame;
+BOOL has_quit;
+BOOL has_accept;
+int private_data_size = get_recurse_data_length(common, ccbegin, ccend, &needs_control_head, &has_quit, &has_accept);
+int alt_count, alt_max, local_size;
backtrack_common altbacktrack;
-struct sljit_jump *jump;
+jump_list *match = NULL;
+sljit_uw *next_update_addr = NULL;
+struct sljit_jump *alt1 = NULL;
+struct sljit_jump *alt2 = NULL;
+struct sljit_jump *accept_exit = NULL;
+struct sljit_label *quit;
/* Recurse captures then. */
common->then_trap = NULL;
SLJIT_ASSERT(*cc == OP_BRA || *cc == OP_CBRA || *cc == OP_CBRAPOS || *cc == OP_SCBRA || *cc == OP_SCBRAPOS);
-needs_frame = framesize >= 0;
-if (!needs_frame)
- framesize = 0;
-alternativesize = *(cc + GET(cc, 1)) == OP_ALT ? 1 : 0;
-SLJIT_ASSERT(common->currententry->entry == NULL && common->recursive_head_ptr != 0);
-common->currententry->entry = LABEL();
-set_jumps(common->currententry->calls, common->currententry->entry);
+alt_max = no_alternatives(cc);
+alt_count = 0;
+
+/* Matching path. */
+SLJIT_ASSERT(common->currententry->entry_label == NULL && common->recursive_head_ptr != 0);
+common->currententry->entry_label = LABEL();
+set_jumps(common->currententry->entry_calls, common->currententry->entry_label);
sljit_emit_fast_enter(compiler, TMP2, 0);
count_match(common);
-allocate_stack(common, private_data_size + framesize + alternativesize);
-OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(private_data_size + framesize + alternativesize - 1), TMP2, 0);
-copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
+
+local_size = (alt_max > 1) ? 2 : 1;
+
+/* (Reversed) stack layout:
+ [private data][return address][optional: str ptr] ... [optional: alternative index][recursive_head_ptr] */
+
+allocate_stack(common, private_data_size + local_size);
+/* Save return address. */
+OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(local_size - 1), TMP2, 0);
+
+copy_recurse_data(common, ccbegin, ccend, recurse_copy_from_global, local_size, private_data_size + local_size, has_quit);
+
+/* This variable is saved and restored all time when we enter or exit from a recursive context. */
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0);
+
if (needs_control_head)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0);
-if (needs_frame)
- init_frame(common, cc, NULL, framesize + alternativesize - 1, alternativesize, TRUE);
-if (alternativesize > 0)
+if (alt_max > 1)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
memset(&altbacktrack, 0, sizeof(backtrack_common));
@@ -10760,7 +11855,75 @@ while (1)
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
return;
- add_jump(compiler, &common->accept, JUMP(SLJIT_JUMP));
+ allocate_stack(common, (alt_max > 1 || has_accept) ? 2 : 1);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
+
+ if (alt_max > 1 || has_accept)
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count);
+
+ add_jump(compiler, &match, JUMP(SLJIT_JUMP));
+
+ if (alt_count == 0)
+ {
+ /* Backtracking path entry. */
+ SLJIT_ASSERT(common->currententry->backtrack_label == NULL);
+ common->currententry->backtrack_label = LABEL();
+ set_jumps(common->currententry->backtrack_calls, common->currententry->backtrack_label);
+
+ sljit_emit_fast_enter(compiler, TMP1, 0);
+
+ if (has_accept)
+ accept_exit = CMP(SLJIT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_max * sizeof (sljit_sw));
+
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
+ /* Save return address. */
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), STACK(local_size - 1), TMP1, 0);
+
+ copy_recurse_data(common, ccbegin, ccend, recurse_swap_global, local_size, private_data_size + local_size, has_quit);
+
+ if (alt_max > 1)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
+ free_stack(common, 2);
+
+ if (alt_max > 4)
+ {
+ /* Table jump if alt_max is greater than 4. */
+ next_update_addr = allocate_read_only_data(common, alt_max * sizeof(sljit_uw));
+ if (SLJIT_UNLIKELY(next_update_addr == NULL))
+ return;
+ sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr);
+ add_label_addr(common, next_update_addr++);
+ }
+ else
+ {
+ if (alt_max == 4)
+ alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
+ alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
+ }
+ }
+ else
+ free_stack(common, has_accept ? 2 : 1);
+ }
+ else if (alt_max > 4)
+ add_label_addr(common, next_update_addr++);
+ else
+ {
+ if (alt_count != 2 * sizeof(sljit_uw))
+ {
+ JUMPHERE(alt1);
+ if (alt_max == 3 && alt_count == sizeof(sljit_uw))
+ alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
+ }
+ else
+ {
+ JUMPHERE(alt2);
+ if (alt_max == 4)
+ alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw));
+ }
+ }
+
+ alt_count += sizeof(sljit_uw);
compile_backtrackingpath(common, altbacktrack.top);
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
@@ -10774,55 +11937,65 @@ while (1)
cc += GET(cc, 1);
}
-/* None of them matched. */
-OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);
-jump = JUMP(SLJIT_JUMP);
+/* No alternative is matched. */
+
+quit = LABEL();
+
+copy_recurse_data(common, ccbegin, ccend, recurse_copy_private_to_global, local_size, private_data_size + local_size, has_quit);
+
+OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(local_size - 1));
+free_stack(common, private_data_size + local_size);
+OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
+sljit_emit_fast_return(compiler, TMP2, 0);
if (common->quit != NULL)
{
+ SLJIT_ASSERT(has_quit);
+
set_jumps(common->quit, LABEL());
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
- if (needs_frame)
- {
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- }
- OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);
- common->quit = NULL;
- add_jump(compiler, &common->quit, JUMP(SLJIT_JUMP));
+ copy_recurse_data(common, ccbegin, ccend, recurse_copy_shared_to_global, local_size, private_data_size + local_size, has_quit);
+ JUMPTO(SLJIT_JUMP, quit);
}
-set_jumps(common->accept, LABEL());
-OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
-if (needs_frame)
+if (has_accept)
{
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- }
-OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);
+ JUMPHERE(accept_exit);
+ free_stack(common, 2);
-JUMPHERE(jump);
-if (common->quit != NULL)
- set_jumps(common->quit, LABEL());
-copy_private_data(common, ccbegin, ccend, FALSE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
-free_stack(common, private_data_size + framesize + alternativesize);
-if (needs_control_head)
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 2 * sizeof(sljit_sw));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP1, 0);
- OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0);
+ /* Save return address. */
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(local_size - 1), TMP1, 0);
+
+ copy_recurse_data(common, ccbegin, ccend, recurse_copy_kept_shared_to_global, local_size, private_data_size + local_size, has_quit);
+
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(local_size - 1));
+ free_stack(common, private_data_size + local_size);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
+ sljit_emit_fast_return(compiler, TMP2, 0);
}
-else
+
+if (common->accept != NULL)
{
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw));
- OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP2, 0);
+ SLJIT_ASSERT(has_accept);
+
+ set_jumps(common->accept, LABEL());
+
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
+ OP1(SLJIT_MOV, TMP2, 0, STACK_TOP, 0);
+
+ allocate_stack(common, 2);
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count);
}
-sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0);
+
+set_jumps(match, LABEL());
+
+OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
+
+copy_recurse_data(common, ccbegin, ccend, recurse_swap_global, local_size, private_data_size + local_size, has_quit);
+
+OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), STACK(local_size - 1));
+OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 1);
+sljit_emit_fast_return(compiler, TMP2, 0);
}
#undef COMPILE_BACKTRACKINGPATH
@@ -10854,11 +12027,13 @@ struct sljit_jump *jump;
struct sljit_jump *minlength_check_failed = NULL;
struct sljit_jump *reqbyte_notfound = NULL;
struct sljit_jump *empty_match = NULL;
+struct sljit_jump *end_anchor_failed = NULL;
SLJIT_ASSERT(tables);
memset(&rootbacktrack, 0, sizeof(backtrack_common));
memset(common, 0, sizeof(compiler_common));
+common->re = re;
common->name_table = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code));
rootbacktrack.cc = common->name_table + re->name_count * re->name_entry_size;
@@ -11045,7 +12220,7 @@ if (!compiler)
common->compiler = compiler;
/* Main pcre_jit_exec entry. */
-sljit_emit_enter(compiler, 0, 1, 5, 5, 0, 0, private_data_size);
+sljit_emit_enter(compiler, 0, SLJIT_ARG1(SW), 5, 5, 0, 0, private_data_size);
/* Register init. */
reset_ovector(common, (re->top_bracket + 1) * 2);
@@ -11058,8 +12233,8 @@ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str))
OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
-OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base));
-OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit));
+OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, end));
+OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, start));
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LIMIT_MATCH, TMP1, 0);
@@ -11076,7 +12251,7 @@ if (common->control_head_ptr != 0)
/* Main part of the matching */
if ((re->overall_options & PCRE2_ANCHORED) == 0)
{
- mainloop_label = mainloop_entry(common, (re->flags & PCRE2_HASCRORLF) != 0, re->overall_options);
+ mainloop_label = mainloop_entry(common);
continue_match_label = LABEL();
/* Forward search if possible. */
if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
@@ -11084,11 +12259,11 @@ if ((re->overall_options & PCRE2_ANCHORED) == 0)
if (mode == PCRE2_JIT_COMPLETE && fast_forward_first_n_chars(common))
;
else if ((re->flags & PCRE2_FIRSTSET) != 0)
- fast_forward_first_char(common, (PCRE2_UCHAR)(re->first_codeunit), (re->flags & PCRE2_FIRSTCASELESS) != 0);
+ fast_forward_first_char(common);
else if ((re->flags & PCRE2_STARTLINE) != 0)
fast_forward_newline(common);
else if ((re->flags & PCRE2_FIRSTMAPSET) != 0)
- fast_forward_start_bits(common, re->start_bitmap);
+ fast_forward_start_bits(common);
}
}
else
@@ -11135,6 +12310,9 @@ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
return PCRE2_ERROR_NOMEMORY;
}
+if ((re->overall_options & PCRE2_ENDANCHORED) != 0)
+ end_anchor_failed = CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0);
+
if (common->might_be_empty)
{
empty_match = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
@@ -11147,15 +12325,26 @@ if (common->accept != NULL)
/* This means we have a match. Update the ovector. */
copy_ovector(common, re->top_bracket + 1);
-common->quit_label = common->forced_quit_label = LABEL();
+common->quit_label = common->abort_label = LABEL();
if (common->quit != NULL)
set_jumps(common->quit, common->quit_label);
-if (common->forced_quit != NULL)
- set_jumps(common->forced_quit, common->forced_quit_label);
+if (common->abort != NULL)
+ set_jumps(common->abort, common->abort_label);
if (minlength_check_failed != NULL)
- SET_LABEL(minlength_check_failed, common->forced_quit_label);
+ SET_LABEL(minlength_check_failed, common->abort_label);
sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
+if (common->failed_match != NULL)
+ {
+ SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE);
+ set_jumps(common->failed_match, LABEL());
+ OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_NOMATCH);
+ JUMPTO(SLJIT_JUMP, common->abort_label);
+ }
+
+if ((re->overall_options & PCRE2_ENDANCHORED) != 0)
+ JUMPHERE(end_anchor_failed);
+
if (mode != PCRE2_JIT_COMPLETE)
{
common->partialmatchlabel = LABEL();
@@ -11236,9 +12425,9 @@ if (common->might_be_empty)
JUMPHERE(empty_match);
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
JUMPTO(SLJIT_NOT_ZERO, empty_match_backtrack_label);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
JUMPTO(SLJIT_ZERO, empty_match_found_label);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
CMPTO(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0, empty_match_found_label);
@@ -11249,7 +12438,7 @@ common->fast_forward_bc_ptr = NULL;
common->fast_fail_start_ptr = 0;
common->fast_fail_end_ptr = 0;
common->currententry = common->entries;
-common->local_exit = TRUE;
+common->local_quit_available = TRUE;
quit_label = common->quit_label;
while (common->currententry != NULL)
{
@@ -11266,7 +12455,7 @@ while (common->currententry != NULL)
flush_stubs(common);
common->currententry = common->currententry->next;
}
-common->local_exit = FALSE;
+common->local_quit_available = FALSE;
common->quit_label = quit_label;
/* Allocating stack, returns with PCRE_ERROR_JIT_STACKLIMIT if fails. */
@@ -11274,20 +12463,23 @@ common->quit_label = quit_label;
set_jumps(common->stackalloc, LABEL());
/* RETURN_ADDR is not a saved register. */
sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
-OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
-OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top), STACK_TOP, 0);
-OP2(SLJIT_ADD, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
-sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
-jump = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
-OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
-OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
-OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top));
-OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit));
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
-sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+SLJIT_ASSERT(TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1);
+
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, STR_PTR, 0);
+OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
+OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_LIMIT, 0, SLJIT_IMM, STACK_GROWTH_RATE);
+OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, stack));
+OP1(SLJIT_MOV, STACK_LIMIT, 0, TMP2, 0);
+
+sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
+
+jump = CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+OP1(SLJIT_MOV, TMP2, 0, STACK_LIMIT, 0);
+OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_RETURN_REG, 0);
+OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
+sljit_emit_fast_return(compiler, TMP1, 0);
/* Allocation failed. */
JUMPHERE(jump);
diff --git a/thirdparty/pcre2/src/pcre2_jit_match.c b/thirdparty/pcre2/src/pcre2_jit_match.c
index a323971ff3..5a66545bae 100644
--- a/thirdparty/pcre2/src/pcre2_jit_match.c
+++ b/thirdparty/pcre2/src/pcre2_jit_match.c
@@ -49,10 +49,10 @@ static SLJIT_NOINLINE int jit_machine_stack_exec(jit_arguments *arguments, jit_f
sljit_u8 local_space[MACHINE_STACK_SIZE];
struct sljit_stack local_stack;
-local_stack.top = (sljit_sw)&local_space;
-local_stack.base = local_stack.top;
-local_stack.limit = local_stack.base + MACHINE_STACK_SIZE;
-local_stack.max_limit = local_stack.limit;
+local_stack.min_start = local_space;
+local_stack.start = local_space;
+local_stack.end = local_space + MACHINE_STACK_SIZE;
+local_stack.top = local_space + MACHINE_STACK_SIZE;
arguments->stack = &local_stack;
return executable_func(arguments);
}
@@ -118,7 +118,7 @@ if ((options & PCRE2_PARTIAL_HARD) != 0)
else if ((options & PCRE2_PARTIAL_SOFT) != 0)
index = 1;
-if (functions->executable_funcs[index] == NULL)
+if (functions == NULL || functions->executable_funcs[index] == NULL)
return PCRE2_ERROR_JIT_BADOPTION;
/* Sanity checks should be handled by pcre_exec. */
diff --git a/thirdparty/pcre2/src/pcre2_jit_test.c b/thirdparty/pcre2/src/pcre2_jit_test.c
deleted file mode 100644
index 705ba181eb..0000000000
--- a/thirdparty/pcre2/src/pcre2_jit_test.c
+++ /dev/null
@@ -1,1735 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
- Written by Philip Hazel
- Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
-
------------------------------------------------------------------------------
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of the University of Cambridge nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-#define PCRE2_CODE_UNIT_WIDTH 0
-#include "pcre2.h"
-
-/*
- Letter characters:
- \xe6\x92\xad = 0x64ad = 25773 (kanji)
- Non-letter characters:
- \xc2\xa1 = 0xa1 = (Inverted Exclamation Mark)
- \xf3\xa9\xb7\x80 = 0xe9dc0 = 957888
- \xed\xa0\x80 = 55296 = 0xd800 (Invalid UTF character)
- \xed\xb0\x80 = 56320 = 0xdc00 (Invalid UTF character)
- Newlines:
- \xc2\x85 = 0x85 = 133 (NExt Line = NEL)
- \xe2\x80\xa8 = 0x2028 = 8232 (Line Separator)
- Othercase pairs:
- \xc3\xa9 = 0xe9 = 233 (e')
- \xc3\x89 = 0xc9 = 201 (E')
- \xc3\xa1 = 0xe1 = 225 (a')
- \xc3\x81 = 0xc1 = 193 (A')
- \x53 = 0x53 = S
- \x73 = 0x73 = s
- \xc5\xbf = 0x17f = 383 (long S)
- \xc8\xba = 0x23a = 570
- \xe2\xb1\xa5 = 0x2c65 = 11365
- \xe1\xbd\xb8 = 0x1f78 = 8056
- \xe1\xbf\xb8 = 0x1ff8 = 8184
- \xf0\x90\x90\x80 = 0x10400 = 66560
- \xf0\x90\x90\xa8 = 0x10428 = 66600
- \xc7\x84 = 0x1c4 = 452
- \xc7\x85 = 0x1c5 = 453
- \xc7\x86 = 0x1c6 = 454
- Caseless sets:
- ucp_Armenian - \x{531}-\x{556} -> \x{561}-\x{586}
- ucp_Coptic - \x{2c80}-\x{2ce3} -> caseless: XOR 0x1
- ucp_Latin - \x{ff21}-\x{ff3a} -> \x{ff41]-\x{ff5a}
-
- Mark property:
- \xcc\x8d = 0x30d = 781
- Special:
- \xc2\x80 = 0x80 = 128 (lowest 2 byte character)
- \xdf\xbf = 0x7ff = 2047 (highest 2 byte character)
- \xe0\xa0\x80 = 0x800 = 2048 (lowest 2 byte character)
- \xef\xbf\xbf = 0xffff = 65535 (highest 3 byte character)
- \xf0\x90\x80\x80 = 0x10000 = 65536 (lowest 4 byte character)
- \xf4\x8f\xbf\xbf = 0x10ffff = 1114111 (highest allowed utf character)
-*/
-
-static int regression_tests(void);
-
-int main(void)
-{
- int jit = 0;
-#if defined SUPPORT_PCRE2_8
- pcre2_config_8(PCRE2_CONFIG_JIT, &jit);
-#elif defined SUPPORT_PCRE2_16
- pcre2_config_16(PCRE2_CONFIG_JIT, &jit);
-#elif defined SUPPORT_PCRE2_32
- pcre2_config_32(PCRE2_CONFIG_JIT, &jit);
-#endif
- if (!jit) {
- printf("JIT must be enabled to run pcre_jit_test\n");
- return 1;
- }
- return regression_tests();
-}
-
-/* --------------------------------------------------------------------------------------- */
-
-#if !(defined SUPPORT_PCRE2_8) && !(defined SUPPORT_PCRE2_16) && !(defined SUPPORT_PCRE2_32)
-#error SUPPORT_PCRE2_8 or SUPPORT_PCRE2_16 or SUPPORT_PCRE2_32 must be defined
-#endif
-
-#define MU (PCRE2_MULTILINE | PCRE2_UTF)
-#define MUP (PCRE2_MULTILINE | PCRE2_UTF | PCRE2_UCP)
-#define CMU (PCRE2_CASELESS | PCRE2_MULTILINE | PCRE2_UTF)
-#define CMUP (PCRE2_CASELESS | PCRE2_MULTILINE | PCRE2_UTF | PCRE2_UCP)
-#define M (PCRE2_MULTILINE)
-#define MP (PCRE2_MULTILINE | PCRE2_UCP)
-#define U (PCRE2_UTF)
-#define CM (PCRE2_CASELESS | PCRE2_MULTILINE)
-
-#define BSR(x) ((x) << 16)
-#define A PCRE2_NEWLINE_ANYCRLF
-
-#define GET_NEWLINE(x) ((x) & 0xffff)
-#define GET_BSR(x) ((x) >> 16)
-
-#define OFFSET_MASK 0x00ffff
-#define F_NO8 0x010000
-#define F_NO16 0x020000
-#define F_NO32 0x020000
-#define F_NOMATCH 0x040000
-#define F_DIFF 0x080000
-#define F_FORCECONV 0x100000
-#define F_PROPERTY 0x200000
-
-struct regression_test_case {
- int compile_options;
- int newline;
- int match_options;
- int start_offset;
- const char *pattern;
- const char *input;
-};
-
-static struct regression_test_case regression_test_cases[] = {
- /* Constant strings. */
- { MU, A, 0, 0, "AbC", "AbAbC" },
- { MU, A, 0, 0, "ACCEPT", "AACACCACCEACCEPACCEPTACCEPTT" },
- { CMU, A, 0, 0, "aA#\xc3\xa9\xc3\x81", "aA#Aa#\xc3\x89\xc3\xa1" },
- { M, A, 0, 0, "[^a]", "aAbB" },
- { CM, A, 0, 0, "[^m]", "mMnN" },
- { M, A, 0, 0, "a[^b][^#]", "abacd" },
- { CM, A, 0, 0, "A[^B][^E]", "abacd" },
- { CMU, A, 0, 0, "[^x][^#]", "XxBll" },
- { MU, A, 0, 0, "[^a]", "aaa\xc3\xa1#Ab" },
- { CMU, A, 0, 0, "[^A]", "aA\xe6\x92\xad" },
- { MU, A, 0, 0, "\\W(\\W)?\\w", "\r\n+bc" },
- { MU, A, 0, 0, "\\W(\\W)?\\w", "\n\r+bc" },
- { MU, A, 0, 0, "\\W(\\W)?\\w", "\r\r+bc" },
- { MU, A, 0, 0, "\\W(\\W)?\\w", "\n\n+bc" },
- { MU, A, 0, 0, "[axd]", "sAXd" },
- { CMU, A, 0, 0, "[axd]", "sAXd" },
- { CMU, A, 0, 0 | F_NOMATCH, "[^axd]", "DxA" },
- { MU, A, 0, 0, "[a-dA-C]", "\xe6\x92\xad\xc3\xa9.B" },
- { MU, A, 0, 0, "[^a-dA-C]", "\xe6\x92\xad\xc3\xa9" },
- { CMU, A, 0, 0, "[^\xc3\xa9]", "\xc3\xa9\xc3\x89." },
- { MU, A, 0, 0, "[^\xc3\xa9]", "\xc3\xa9\xc3\x89." },
- { MU, A, 0, 0, "[^a]", "\xc2\x80[]" },
- { CMU, A, 0, 0, "\xf0\x90\x90\xa7", "\xf0\x90\x91\x8f" },
- { CM, A, 0, 0, "1a2b3c4", "1a2B3c51A2B3C4" },
- { PCRE2_CASELESS, 0, 0, 0, "\xff#a", "\xff#\xff\xfe##\xff#A" },
- { PCRE2_CASELESS, 0, 0, 0, "\xfe", "\xff\xfc#\xfe\xfe" },
- { PCRE2_CASELESS, 0, 0, 0, "a1", "Aa1" },
- { M, A, 0, 0, "\\Ca", "cda" },
- { CM, A, 0, 0, "\\Ca", "CDA" },
- { M, A, 0, 0 | F_NOMATCH, "\\Cx", "cda" },
- { CM, A, 0, 0 | F_NOMATCH, "\\Cx", "CDA" },
- { CMUP, A, 0, 0, "\xf0\x90\x90\x80\xf0\x90\x90\xa8", "\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
- { CMUP, A, 0, 0, "\xf0\x90\x90\x80{2}", "\xf0\x90\x90\x80#\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
- { CMUP, A, 0, 0, "\xf0\x90\x90\xa8{2}", "\xf0\x90\x90\x80#\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
- { CMUP, A, 0, 0, "\xe1\xbd\xb8\xe1\xbf\xb8", "\xe1\xbf\xb8\xe1\xbd\xb8" },
- { M, A, 0, 0, "[3-57-9]", "5" },
-
- /* Assertions. */
- { MU, A, 0, 0, "\\b[^A]", "A_B#" },
- { M, A, 0, 0 | F_NOMATCH, "\\b\\W", "\n*" },
- { MU, A, 0, 0, "\\B[^,]\\b[^s]\\b", "#X" },
- { MP, A, 0, 0, "\\B", "_\xa1" },
- { MP, A, 0, 0 | F_PROPERTY, "\\b_\\b[,A]\\B", "_," },
- { MUP, A, 0, 0, "\\b", "\xe6\x92\xad!" },
- { MUP, A, 0, 0, "\\B", "_\xc2\xa1\xc3\xa1\xc2\x85" },
- { MUP, A, 0, 0, "\\b[^A]\\B[^c]\\b[^_]\\B", "_\xc3\xa1\xe2\x80\xa8" },
- { MUP, A, 0, 0, "\\b\\w+\\B", "\xc3\x89\xc2\xa1\xe6\x92\xad\xc3\x81\xc3\xa1" },
- { MU, A, 0, 0 | F_NOMATCH, "\\b.", "\xcd\xbe" },
- { CMUP, A, 0, 0, "\\By", "\xf0\x90\x90\xa8y" },
- { M, A, 0, 0 | F_NOMATCH, "\\R^", "\n" },
- { M, A, 0, 1 | F_NOMATCH, "^", "\n" },
- { 0, 0, 0, 0, "^ab", "ab" },
- { 0, 0, 0, 0 | F_NOMATCH, "^ab", "aab" },
- { M, PCRE2_NEWLINE_CRLF, 0, 0, "^a", "\r\raa\n\naa\r\naa" },
- { MU, A, 0, 0, "^-", "\xe2\x80\xa8--\xc2\x85-\r\n-" },
- { M, PCRE2_NEWLINE_ANY, 0, 0, "^-", "a--b--\x85--" },
- { MU, PCRE2_NEWLINE_ANY, 0, 0, "^-", "a--\xe2\x80\xa8--" },
- { MU, PCRE2_NEWLINE_ANY, 0, 0, "^-", "a--\xc2\x85--" },
- { 0, 0, 0, 0, "ab$", "ab" },
- { 0, 0, 0, 0 | F_NOMATCH, "ab$", "abab\n\n" },
- { PCRE2_DOLLAR_ENDONLY, 0, 0, 0 | F_NOMATCH, "ab$", "abab\r\n" },
- { M, PCRE2_NEWLINE_CRLF, 0, 0, "a$", "\r\raa\n\naa\r\naa" },
- { M, PCRE2_NEWLINE_ANY, 0, 0, "a$", "aaa" },
- { MU, PCRE2_NEWLINE_ANYCRLF, 0, 0, "#$", "#\xc2\x85###\r#" },
- { MU, PCRE2_NEWLINE_ANY, 0, 0, "#$", "#\xe2\x80\xa9" },
- { 0, PCRE2_NEWLINE_ANY, PCRE2_NOTBOL, 0 | F_NOMATCH, "^a", "aa\naa" },
- { M, PCRE2_NEWLINE_ANY, PCRE2_NOTBOL, 0, "^a", "aa\naa" },
- { 0, PCRE2_NEWLINE_ANY, PCRE2_NOTEOL, 0 | F_NOMATCH, "a$", "aa\naa" },
- { 0, PCRE2_NEWLINE_ANY, PCRE2_NOTEOL, 0 | F_NOMATCH, "a$", "aa\r\n" },
- { U | PCRE2_DOLLAR_ENDONLY, PCRE2_NEWLINE_ANY, 0, 0 | F_PROPERTY, "\\p{Any}{2,}$", "aa\r\n" },
- { M, PCRE2_NEWLINE_ANY, PCRE2_NOTEOL, 0, "a$", "aa\naa" },
- { 0, PCRE2_NEWLINE_CR, 0, 0, ".\\Z", "aaa" },
- { U, PCRE2_NEWLINE_CR, 0, 0, "a\\Z", "aaa\r" },
- { 0, PCRE2_NEWLINE_CR, 0, 0, ".\\Z", "aaa\n" },
- { 0, PCRE2_NEWLINE_CRLF, 0, 0, ".\\Z", "aaa\r" },
- { U, PCRE2_NEWLINE_CRLF, 0, 0, ".\\Z", "aaa\n" },
- { 0, PCRE2_NEWLINE_CRLF, 0, 0, ".\\Z", "aaa\r\n" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\r" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\n" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\r\n" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\xe2\x80\xa8" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\r" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\n" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".\\Z", "aaa\r\n" },
- { U, PCRE2_NEWLINE_ANY, 0, 0, ".\\Z", "aaa\xc2\x85" },
- { U, PCRE2_NEWLINE_ANY, 0, 0, ".\\Z", "aaa\xe2\x80\xa8" },
- { M, A, 0, 0, "\\Aa", "aaa" },
- { M, A, 0, 1 | F_NOMATCH, "\\Aa", "aaa" },
- { M, A, 0, 1, "\\Ga", "aaa" },
- { M, A, 0, 1 | F_NOMATCH, "\\Ga", "aba" },
- { M, A, 0, 0, "a\\z", "aaa" },
- { M, A, 0, 0 | F_NOMATCH, "a\\z", "aab" },
-
- /* Brackets and alternatives. */
- { MU, A, 0, 0, "(ab|bb|cd)", "bacde" },
- { MU, A, 0, 0, "(?:ab|a)(bc|c)", "ababc" },
- { MU, A, 0, 0, "((ab|(cc))|(bb)|(?:cd|efg))", "abac" },
- { CMU, A, 0, 0, "((aB|(Cc))|(bB)|(?:cd|EFg))", "AcCe" },
- { MU, A, 0, 0, "((ab|(cc))|(bb)|(?:cd|ebg))", "acebebg" },
- { MU, A, 0, 0, "(?:(a)|(?:b))(cc|(?:d|e))(a|b)k", "accabdbbccbk" },
- { MU, A, 0, 0, "\xc7\x82|\xc6\x82", "\xf1\x83\x82\x82\xc7\x82\xc7\x83" },
- { MU, A, 0, 0, "=\xc7\x82|#\xc6\x82", "\xf1\x83\x82\x82=\xc7\x82\xc7\x83" },
- { MU, A, 0, 0, "\xc7\x82\xc7\x83|\xc6\x82\xc6\x82", "\xf1\x83\x82\x82\xc7\x82\xc7\x83" },
- { MU, A, 0, 0, "\xc6\x82\xc6\x82|\xc7\x83\xc7\x83|\xc8\x84\xc8\x84", "\xf1\x83\x82\x82\xc8\x84\xc8\x84" },
-
- /* Greedy and non-greedy ? operators. */
- { MU, A, 0, 0, "(?:a)?a", "laab" },
- { CMU, A, 0, 0, "(A)?A", "llaab" },
- { MU, A, 0, 0, "(a)?\?a", "aab" }, /* ?? is the prefix of trygraphs in GCC. */
- { MU, A, 0, 0, "(a)?a", "manm" },
- { CMU, A, 0, 0, "(a|b)?\?d((?:e)?)", "ABABdx" },
- { MU, A, 0, 0, "(a|b)?\?d((?:e)?)", "abcde" },
- { MU, A, 0, 0, "((?:ab)?\?g|b(?:g(nn|d)?\?)?)?\?(?:n)?m", "abgnbgnnbgdnmm" },
-
- /* Greedy and non-greedy + operators */
- { MU, A, 0, 0, "(aa)+aa", "aaaaaaa" },
- { MU, A, 0, 0, "(aa)+?aa", "aaaaaaa" },
- { MU, A, 0, 0, "(?:aba|ab|a)+l", "ababamababal" },
- { MU, A, 0, 0, "(?:aba|ab|a)+?l", "ababamababal" },
- { MU, A, 0, 0, "(a(?:bc|cb|b|c)+?|ss)+e", "accssabccbcacbccbbXaccssabccbcacbccbbe" },
- { MU, A, 0, 0, "(a(?:bc|cb|b|c)+|ss)+?e", "accssabccbcacbccbbXaccssabccbcacbccbbe" },
- { MU, A, 0, 0, "(?:(b(c)+?)+)?\?(?:(bc)+|(cb)+)+(?:m)+", "bccbcccbcbccbcbPbccbcccbcbccbcbmmn" },
-
- /* Greedy and non-greedy * operators */
- { CMU, A, 0, 0, "(?:AA)*AB", "aaaaaaamaaaaaaab" },
- { MU, A, 0, 0, "(?:aa)*?ab", "aaaaaaamaaaaaaab" },
- { MU, A, 0, 0, "(aa|ab)*ab", "aaabaaab" },
- { CMU, A, 0, 0, "(aa|Ab)*?aB", "aaabaaab" },
- { MU, A, 0, 0, "(a|b)*(?:a)*(?:b)*m", "abbbaaababanabbbaaababamm" },
- { MU, A, 0, 0, "(a|b)*?(?:a)*?(?:b)*?m", "abbbaaababanabbbaaababamm" },
- { M, A, 0, 0, "a(a(\\1*)a|(b)b+){0}a", "aa" },
- { M, A, 0, 0, "((?:a|)*){0}a", "a" },
-
- /* Combining ? + * operators */
- { MU, A, 0, 0, "((bm)+)?\?(?:a)*(bm)+n|((am)+?)?(?:a)+(am)*n", "bmbmabmamaaamambmaman" },
- { MU, A, 0, 0, "(((ab)?cd)*ef)+g", "abcdcdefcdefefmabcdcdefcdefefgg" },
- { MU, A, 0, 0, "(((ab)?\?cd)*?ef)+?g", "abcdcdefcdefefmabcdcdefcdefefgg" },
- { MU, A, 0, 0, "(?:(ab)?c|(?:ab)+?d)*g", "ababcdccababddg" },
- { MU, A, 0, 0, "(?:(?:ab)?\?c|(ab)+d)*?g", "ababcdccababddg" },
-
- /* Single character iterators. */
- { MU, A, 0, 0, "(a+aab)+aaaab", "aaaabcaaaabaabcaabcaaabaaaab" },
- { MU, A, 0, 0, "(a*a*aab)+x", "aaaaabaabaaabmaabx" },
- { MU, A, 0, 0, "(a*?(b|ab)a*?)+x", "aaaabcxbbaabaacbaaabaabax" },
- { MU, A, 0, 0, "(a+(ab|ad)a+)+x", "aaabaaaadaabaaabaaaadaaax" },
- { MU, A, 0, 0, "(a?(a)a?)+(aaa)", "abaaabaaaaaaaa" },
- { MU, A, 0, 0, "(a?\?(a)a?\?)+(b)", "aaaacaaacaacacbaaab" },
- { MU, A, 0, 0, "(a{0,4}(b))+d", "aaaaaabaabcaaaaabaaaaabd" },
- { MU, A, 0, 0, "(a{0,4}?[^b])+d+(a{0,4}[^b])d+", "aaaaadaaaacaadddaaddd" },
- { MU, A, 0, 0, "(ba{2})+c", "baabaaabacbaabaac" },
- { MU, A, 0, 0, "(a*+bc++)+", "aaabbcaaabcccab" },
- { MU, A, 0, 0, "(a?+[^b])+", "babaacacb" },
- { MU, A, 0, 0, "(a{0,3}+b)(a{0,3}+b)(a{0,3}+)[^c]", "abaabaaacbaabaaaac" },
- { CMU, A, 0, 0, "([a-c]+[d-f]+?)+?g", "aBdacdehAbDaFgA" },
- { CMU, A, 0, 0, "[c-f]+k", "DemmFke" },
- { MU, A, 0, 0, "([DGH]{0,4}M)+", "GGDGHDGMMHMDHHGHM" },
- { MU, A, 0, 0, "([a-c]{4,}s)+", "abasabbasbbaabsbba" },
- { CMU, A, 0, 0, "[ace]{3,7}", "AcbDAcEEcEd" },
- { CMU, A, 0, 0, "[ace]{3,7}?", "AcbDAcEEcEd" },
- { CMU, A, 0, 0, "[ace]{3,}", "AcbDAcEEcEd" },
- { CMU, A, 0, 0, "[ace]{3,}?", "AcbDAcEEcEd" },
- { MU, A, 0, 0, "[ckl]{2,}?g", "cdkkmlglglkcg" },
- { CMU, A, 0, 0, "[ace]{5}?", "AcCebDAcEEcEd" },
- { MU, A, 0, 0, "([AbC]{3,5}?d)+", "BACaAbbAEAACCbdCCbdCCAAbb" },
- { MU, A, 0, 0, "([^ab]{0,}s){2}", "abaabcdsABamsDDs" },
- { MU, A, 0, 0, "\\b\\w+\\B", "x,a_cd" },
- { MUP, A, 0, 0, "\\b[^\xc2\xa1]+\\B", "\xc3\x89\xc2\xa1\xe6\x92\xad\xc3\x81\xc3\xa1" },
- { CMU, A, 0, 0, "[^b]+(a*)([^c]?d{3})", "aaaaddd" },
- { CMUP, A, 0, 0, "\xe1\xbd\xb8{2}", "\xe1\xbf\xb8#\xe1\xbf\xb8\xe1\xbd\xb8" },
- { CMU, A, 0, 0, "[^\xf0\x90\x90\x80]{2,4}@", "\xf0\x90\x90\xa8\xf0\x90\x90\x80###\xf0\x90\x90\x80@@@" },
- { CMU, A, 0, 0, "[^\xe1\xbd\xb8][^\xc3\xa9]", "\xe1\xbd\xb8\xe1\xbf\xb8\xc3\xa9\xc3\x89#" },
- { MU, A, 0, 0, "[^\xe1\xbd\xb8][^\xc3\xa9]", "\xe1\xbd\xb8\xe1\xbf\xb8\xc3\xa9\xc3\x89#" },
- { MU, A, 0, 0, "[^\xe1\xbd\xb8]{3,}?", "##\xe1\xbd\xb8#\xe1\xbd\xb8#\xc3\x89#\xe1\xbd\xb8" },
- { MU, A, 0, 0, "\\d+123", "987654321,01234" },
- { MU, A, 0, 0, "abcd*|\\w+xy", "aaaaa,abxyz" },
- { MU, A, 0, 0, "(?:abc|((?:amc|\\b\\w*xy)))", "aaaaa,abxyz" },
- { MU, A, 0, 0, "a(?R)|([a-z]++)#", ".abcd.abcd#."},
- { MU, A, 0, 0, "a(?R)|([a-z]++)#", ".abcd.mbcd#."},
- { MU, A, 0, 0, ".[ab]*.", "xx" },
- { MU, A, 0, 0, ".[ab]*a", "xxa" },
- { MU, A, 0, 0, ".[ab]?.", "xx" },
-
- /* Bracket repeats with limit. */
- { MU, A, 0, 0, "(?:(ab){2}){5}M", "abababababababababababM" },
- { MU, A, 0, 0, "(?:ab|abab){1,5}M", "abababababababababababM" },
- { MU, A, 0, 0, "(?>ab|abab){1,5}M", "abababababababababababM" },
- { MU, A, 0, 0, "(?:ab|abab){1,5}?M", "abababababababababababM" },
- { MU, A, 0, 0, "(?>ab|abab){1,5}?M", "abababababababababababM" },
- { MU, A, 0, 0, "(?:(ab){1,4}?){1,3}?M", "abababababababababababababM" },
- { MU, A, 0, 0, "(?:(ab){1,4}){1,3}abababababababababababM", "ababababababababababababM" },
- { MU, A, 0, 0 | F_NOMATCH, "(?:(ab){1,4}){1,3}abababababababababababM", "abababababababababababM" },
- { MU, A, 0, 0, "(ab){4,6}?M", "abababababababM" },
-
- /* Basic character sets. */
- { MU, A, 0, 0, "(?:\\s)+(?:\\S)+", "ab \t\xc3\xa9\xe6\x92\xad " },
- { MU, A, 0, 0, "(\\w)*(k)(\\W)?\?", "abcdef abck11" },
- { MU, A, 0, 0, "\\((\\d)+\\)\\D", "a() (83 (8)2 (9)ab" },
- { MU, A, 0, 0, "\\w(\\s|(?:\\d)*,)+\\w\\wb", "a 5, 4,, bb 5, 4,, aab" },
- { MU, A, 0, 0, "(\\v+)(\\V+)", "\x0e\xc2\x85\xe2\x80\xa8\x0b\x09\xe2\x80\xa9" },
- { MU, A, 0, 0, "(\\h+)(\\H+)", "\xe2\x80\xa8\xe2\x80\x80\x20\xe2\x80\x8a\xe2\x81\x9f\xe3\x80\x80\x09\x20\xc2\xa0\x0a" },
- { MU, A, 0, 0, "x[bcef]+", "xaxdxecbfg" },
- { MU, A, 0, 0, "x[bcdghij]+", "xaxexfxdgbjk" },
- { MU, A, 0, 0, "x[^befg]+", "xbxexacdhg" },
- { MU, A, 0, 0, "x[^bcdl]+", "xlxbxaekmd" },
- { MU, A, 0, 0, "x[^bcdghi]+", "xbxdxgxaefji" },
- { MU, A, 0, 0, "x[B-Fb-f]+", "xaxAxgxbfBFG" },
- { CMU, A, 0, 0, "\\x{e9}+", "#\xf0\x90\x90\xa8\xc3\xa8\xc3\xa9\xc3\x89\xc3\x88" },
- { CMU, A, 0, 0, "[^\\x{e9}]+", "\xc3\xa9#\xf0\x90\x90\xa8\xc3\xa8\xc3\x88\xc3\x89" },
- { MU, A, 0, 0, "[\\x02\\x7e]+", "\xc3\x81\xe1\xbf\xb8\xf0\x90\x90\xa8\x01\x02\x7e\x7f" },
- { MU, A, 0, 0, "[^\\x02\\x7e]+", "\x02\xc3\x81\xe1\xbf\xb8\xf0\x90\x90\xa8\x01\x7f\x7e" },
- { MU, A, 0, 0, "[\\x{81}-\\x{7fe}]+", "#\xe1\xbf\xb8\xf0\x90\x90\xa8\xc2\x80\xc2\x81\xdf\xbe\xdf\xbf" },
- { MU, A, 0, 0, "[^\\x{81}-\\x{7fe}]+", "\xc2\x81#\xe1\xbf\xb8\xf0\x90\x90\xa8\xc2\x80\xdf\xbf\xdf\xbe" },
- { MU, A, 0, 0, "[\\x{801}-\\x{fffe}]+", "#\xc3\xa9\xf0\x90\x90\x80\xe0\xa0\x80\xe0\xa0\x81\xef\xbf\xbe\xef\xbf\xbf" },
- { MU, A, 0, 0, "[^\\x{801}-\\x{fffe}]+", "\xe0\xa0\x81#\xc3\xa9\xf0\x90\x90\x80\xe0\xa0\x80\xef\xbf\xbf\xef\xbf\xbe" },
- { MU, A, 0, 0, "[\\x{10001}-\\x{10fffe}]+", "#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf0\x90\x80\x81\xf4\x8f\xbf\xbe\xf4\x8f\xbf\xbf" },
- { MU, A, 0, 0, "[^\\x{10001}-\\x{10fffe}]+", "\xf0\x90\x80\x81#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf4\x8f\xbf\xbf\xf4\x8f\xbf\xbe" },
-
- /* Unicode properties. */
- { MUP, A, 0, 0, "[1-5\xc3\xa9\\w]", "\xc3\xa1_" },
- { MUP, A, 0, 0 | F_PROPERTY, "[\xc3\x81\\p{Ll}]", "A_\xc3\x89\xc3\xa1" },
- { MUP, A, 0, 0, "[\\Wd-h_x-z]+", "a\xc2\xa1#_yhzdxi" },
- { MUP, A, 0, 0 | F_NOMATCH | F_PROPERTY, "[\\P{Any}]", "abc" },
- { MUP, A, 0, 0 | F_NOMATCH | F_PROPERTY, "[^\\p{Any}]", "abc" },
- { MUP, A, 0, 0 | F_NOMATCH | F_PROPERTY, "[\\P{Any}\xc3\xa1-\xc3\xa8]", "abc" },
- { MUP, A, 0, 0 | F_NOMATCH | F_PROPERTY, "[^\\p{Any}\xc3\xa1-\xc3\xa8]", "abc" },
- { MUP, A, 0, 0 | F_NOMATCH | F_PROPERTY, "[\xc3\xa1-\xc3\xa8\\P{Any}]", "abc" },
- { MUP, A, 0, 0 | F_NOMATCH | F_PROPERTY, "[^\xc3\xa1-\xc3\xa8\\p{Any}]", "abc" },
- { MUP, A, 0, 0 | F_PROPERTY, "[\xc3\xa1-\xc3\xa8\\p{Any}]", "abc" },
- { MUP, A, 0, 0 | F_PROPERTY, "[^\xc3\xa1-\xc3\xa8\\P{Any}]", "abc" },
- { MUP, A, 0, 0, "[b-\xc3\xa9\\s]", "a\xc\xe6\x92\xad" },
- { CMUP, A, 0, 0, "[\xc2\x85-\xc2\x89\xc3\x89]", "\xc2\x84\xc3\xa9" },
- { MUP, A, 0, 0, "[^b-d^&\\s]{3,}", "db^ !a\xe2\x80\xa8_ae" },
- { MUP, A, 0, 0 | F_PROPERTY, "[^\\S\\P{Any}][\\sN]{1,3}[\\P{N}]{4}", "\xe2\x80\xaa\xa N\x9\xc3\xa9_0" },
- { MU, A, 0, 0 | F_PROPERTY, "[^\\P{L}\x9!D-F\xa]{2,3}", "\x9,.DF\xa.CG\xc3\x81" },
- { CMUP, A, 0, 0, "[\xc3\xa1-\xc3\xa9_\xe2\x80\xa0-\xe2\x80\xaf]{1,5}[^\xe2\x80\xa0-\xe2\x80\xaf]", "\xc2\xa1\xc3\x89\xc3\x89\xe2\x80\xaf_\xe2\x80\xa0" },
- { MUP, A, 0, 0 | F_PROPERTY, "[\xc3\xa2-\xc3\xa6\xc3\x81-\xc3\x84\xe2\x80\xa8-\xe2\x80\xa9\xe6\x92\xad\\p{Zs}]{2,}", "\xe2\x80\xa7\xe2\x80\xa9\xe6\x92\xad \xe6\x92\xae" },
- { MUP, A, 0, 0 | F_PROPERTY, "[\\P{L&}]{2}[^\xc2\x85-\xc2\x89\\p{Ll}\\p{Lu}]{2}", "\xc3\xa9\xe6\x92\xad.a\xe6\x92\xad|\xc2\x8a#" },
- { PCRE2_UCP, 0, 0, 0 | F_PROPERTY, "[a-b\\s]{2,5}[^a]", "AB baaa" },
-
- /* Possible empty brackets. */
- { MU, A, 0, 0, "(?:|ab||bc|a)+d", "abcxabcabd" },
- { MU, A, 0, 0, "(|ab||bc|a)+d", "abcxabcabd" },
- { MU, A, 0, 0, "(?:|ab||bc|a)*d", "abcxabcabd" },
- { MU, A, 0, 0, "(|ab||bc|a)*d", "abcxabcabd" },
- { MU, A, 0, 0, "(?:|ab||bc|a)+?d", "abcxabcabd" },
- { MU, A, 0, 0, "(|ab||bc|a)+?d", "abcxabcabd" },
- { MU, A, 0, 0, "(?:|ab||bc|a)*?d", "abcxabcabd" },
- { MU, A, 0, 0, "(|ab||bc|a)*?d", "abcxabcabd" },
- { MU, A, 0, 0, "(((a)*?|(?:ba)+)+?|(?:|c|ca)*)*m", "abaacaccabacabalabaacaccabacabamm" },
- { MU, A, 0, 0, "(?:((?:a)*|(ba)+?)+|(|c|ca)*?)*?m", "abaacaccabacabalabaacaccabacabamm" },
-
- /* Start offset. */
- { MU, A, 0, 3, "(\\d|(?:\\w)*\\w)+", "0ac01Hb" },
- { MU, A, 0, 4 | F_NOMATCH, "(\\w\\W\\w)+", "ab#d" },
- { MU, A, 0, 2 | F_NOMATCH, "(\\w\\W\\w)+", "ab#d" },
- { MU, A, 0, 1, "(\\w\\W\\w)+", "ab#d" },
-
- /* Newline. */
- { M, PCRE2_NEWLINE_CRLF, 0, 0, "\\W{0,2}[^#]{3}", "\r\n#....." },
- { M, PCRE2_NEWLINE_CR, 0, 0, "\\W{0,2}[^#]{3}", "\r\n#....." },
- { M, PCRE2_NEWLINE_CRLF, 0, 0, "\\W{1,3}[^#]", "\r\n##...." },
- { MU, A, PCRE2_NO_UTF_CHECK, 1, "^.a", "\n\x80\nxa" },
- { MU, A, 0, 1, "^", "\r\n" },
- { M, PCRE2_NEWLINE_CRLF, 0, 1 | F_NOMATCH, "^", "\r\n" },
- { M, PCRE2_NEWLINE_CRLF, 0, 1, "^", "\r\na" },
-
- /* Any character except newline or any newline. */
- { 0, PCRE2_NEWLINE_CRLF, 0, 0, ".", "\r" },
- { U, PCRE2_NEWLINE_CRLF, 0, 0, ".(.).", "a\xc3\xa1\r\n\n\r\r" },
- { 0, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".(.)", "a\rb\nc\r\n\xc2\x85\xe2\x80\xa8" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0, ".(.)", "a\rb\nc\r\n\xc2\x85\xe2\x80\xa8" },
- { U, PCRE2_NEWLINE_ANY, 0, 0, "(.).", "a\rb\nc\r\n\xc2\x85\xe2\x80\xa9$de" },
- { U, PCRE2_NEWLINE_ANYCRLF, 0, 0 | F_NOMATCH, ".(.).", "\xe2\x80\xa8\nb\r" },
- { 0, PCRE2_NEWLINE_ANY, 0, 0, "(.)(.)", "#\x85#\r#\n#\r\n#\x84" },
- { U, PCRE2_NEWLINE_ANY, 0, 0, "(.+)#", "#\rMn\xc2\x85#\n###" },
- { 0, BSR(PCRE2_BSR_ANYCRLF), 0, 0, "\\R", "\r" },
- { 0, BSR(PCRE2_BSR_ANYCRLF), 0, 0, "\\R", "\x85#\r\n#" },
- { U, BSR(PCRE2_BSR_UNICODE), 0, 0, "\\R", "ab\xe2\x80\xa8#c" },
- { U, BSR(PCRE2_BSR_UNICODE), 0, 0, "\\R", "ab\r\nc" },
- { U, PCRE2_NEWLINE_CRLF | BSR(PCRE2_BSR_UNICODE), 0, 0, "(\\R.)+", "\xc2\x85\r\n#\xe2\x80\xa8\n\r\n\r" },
- { MU, A, 0, 0 | F_NOMATCH, "\\R+", "ab" },
- { MU, A, 0, 0, "\\R+", "ab\r\n\r" },
- { MU, A, 0, 0, "\\R*", "ab\r\n\r" },
- { MU, A, 0, 0, "\\R*", "\r\n\r" },
- { MU, A, 0, 0, "\\R{2,4}", "\r\nab\r\r" },
- { MU, A, 0, 0, "\\R{2,4}", "\r\nab\n\n\n\r\r\r" },
- { MU, A, 0, 0, "\\R{2,}", "\r\nab\n\n\n\r\r\r" },
- { MU, A, 0, 0, "\\R{0,3}", "\r\n\r\n\r\n\r\n\r\n" },
- { MU, A, 0, 0 | F_NOMATCH, "\\R+\\R\\R", "\r\n\r\n" },
- { MU, A, 0, 0, "\\R+\\R\\R", "\r\r\r" },
- { MU, A, 0, 0, "\\R*\\R\\R", "\n\r" },
- { MU, A, 0, 0 | F_NOMATCH, "\\R{2,4}\\R\\R", "\r\r\r" },
- { MU, A, 0, 0, "\\R{2,4}\\R\\R", "\r\r\r\r" },
-
- /* Atomic groups (no fallback from "next" direction). */
- { MU, A, 0, 0 | F_NOMATCH, "(?>ab)ab", "bab" },
- { MU, A, 0, 0 | F_NOMATCH, "(?>(ab))ab", "bab" },
- { MU, A, 0, 0, "(?>ab)+abc(?>de)*def(?>gh)?ghe(?>ij)+?k(?>lm)*?n(?>op)?\?op",
- "bababcdedefgheijijklmlmnop" },
- { MU, A, 0, 0, "(?>a(b)+a|(ab)?\?(b))an", "abban" },
- { MU, A, 0, 0, "(?>ab+a|(?:ab)?\?b)an", "abban" },
- { MU, A, 0, 0, "((?>ab|ad|)*?)(?>|c)*abad", "abababcababad" },
- { MU, A, 0, 0, "(?>(aa|b|)*+(?>(##)|###)*d|(aa)(?>(baa)?)m)", "aabaa#####da" },
- { MU, A, 0, 0, "((?>a|)+?)b", "aaacaaab" },
- { MU, A, 0, 0, "(?>x|)*$", "aaa" },
- { MU, A, 0, 0, "(?>(x)|)*$", "aaa" },
- { MU, A, 0, 0, "(?>x|())*$", "aaa" },
- { MU, A, 0, 0, "((?>[cxy]a|[a-d])*?)b", "aaa+ aaab" },
- { MU, A, 0, 0, "((?>[cxy](a)|[a-d])*?)b", "aaa+ aaab" },
- { MU, A, 0, 0, "(?>((?>(a+))))bab|(?>((?>(a+))))bb", "aaaabaaabaabab" },
- { MU, A, 0, 0, "(?>(?>a+))bab|(?>(?>a+))bb", "aaaabaaabaabab" },
- { MU, A, 0, 0, "(?>(a)c|(?>(c)|(a))a)b*?bab", "aaaabaaabaabab" },
- { MU, A, 0, 0, "(?>ac|(?>c|a)a)b*?bab", "aaaabaaabaabab" },
- { MU, A, 0, 0, "(?>(b)b|(a))*b(?>(c)|d)?x", "ababcaaabdbx" },
- { MU, A, 0, 0, "(?>bb|a)*b(?>c|d)?x", "ababcaaabdbx" },
- { MU, A, 0, 0, "(?>(bb)|a)*b(?>c|(d))?x", "ababcaaabdbx" },
- { MU, A, 0, 0, "(?>(a))*?(?>(a))+?(?>(a))??x", "aaaaaacccaaaaabax" },
- { MU, A, 0, 0, "(?>a)*?(?>a)+?(?>a)??x", "aaaaaacccaaaaabax" },
- { MU, A, 0, 0, "(?>(a)|)*?(?>(a)|)+?(?>(a)|)??x", "aaaaaacccaaaaabax" },
- { MU, A, 0, 0, "(?>a|)*?(?>a|)+?(?>a|)??x", "aaaaaacccaaaaabax" },
- { MU, A, 0, 0, "(?>a(?>(a{0,2}))*?b|aac)+b", "aaaaaaacaaaabaaaaacaaaabaacaaabb" },
- { CM, A, 0, 0, "(?>((?>a{32}|b+|(a*))?(?>c+|d*)?\?)+e)+?f", "aaccebbdde bbdaaaccebbdee bbdaaaccebbdeef" },
- { MU, A, 0, 0, "(?>(?:(?>aa|a||x)+?b|(?>aa|a||(x))+?c)?(?>[ad]{0,2})*?d)+d", "aaacdbaabdcabdbaaacd aacaabdbdcdcaaaadaabcbaadd" },
- { MU, A, 0, 0, "(?>(?:(?>aa|a||(x))+?b|(?>aa|a||x)+?c)?(?>[ad]{0,2})*?d)+d", "aaacdbaabdcabdbaaacd aacaabdbdcdcaaaadaabcbaadd" },
- { MU, A, 0, 0 | F_PROPERTY, "\\X", "\xcc\x8d\xcc\x8d" },
- { MU, A, 0, 0 | F_PROPERTY, "\\X", "\xcc\x8d\xcc\x8d#\xcc\x8d\xcc\x8d" },
- { MU, A, 0, 0 | F_PROPERTY, "\\X+..", "\xcc\x8d#\xcc\x8d#\xcc\x8d\xcc\x8d" },
- { MU, A, 0, 0 | F_PROPERTY, "\\X{2,4}", "abcdef" },
- { MU, A, 0, 0 | F_PROPERTY, "\\X{2,4}?", "abcdef" },
- { MU, A, 0, 0 | F_NOMATCH | F_PROPERTY, "\\X{2,4}..", "#\xcc\x8d##" },
- { MU, A, 0, 0 | F_PROPERTY, "\\X{2,4}..", "#\xcc\x8d#\xcc\x8d##" },
- { MU, A, 0, 0, "(c(ab)?+ab)+", "cabcababcab" },
- { MU, A, 0, 0, "(?>(a+)b)+aabab", "aaaabaaabaabab" },
-
- /* Possessive quantifiers. */
- { MU, A, 0, 0, "(?:a|b)++m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "(?:a|b)*+m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "(?:a|b)*+m", "ababbaaxababbaam" },
- { MU, A, 0, 0, "(a|b)++m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "(a|b)*+m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "(a|b)*+m", "ababbaaxababbaam" },
- { MU, A, 0, 0, "(a|b(*ACCEPT))++m", "maaxab" },
- { MU, A, 0, 0, "(?:b*)++m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "(?:b*)++m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "(?:b*)*+m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "(?:b*)*+m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "(b*)++m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "(b*)++m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "(b*)*+m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "(b*)*+m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "(?:a|(b))++m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "(?:(a)|b)*+m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "(?:(a)|(b))*+m", "ababbaaxababbaam" },
- { MU, A, 0, 0, "(a|(b))++m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "((a)|b)*+m", "mababbaaxababbaam" },
- { MU, A, 0, 0, "((a)|(b))*+m", "ababbaaxababbaam" },
- { MU, A, 0, 0, "(a|(b)(*ACCEPT))++m", "maaxab" },
- { MU, A, 0, 0, "(?:(b*))++m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "(?:(b*))++m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "(?:(b*))*+m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "(?:(b*))*+m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "((b*))++m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "((b*))++m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0, "((b*))*+m", "bxbbxbbbxm" },
- { MU, A, 0, 0, "((b*))*+m", "bxbbxbbbxbbm" },
- { MU, A, 0, 0 | F_NOMATCH, "(?>(b{2,4}))(?:(?:(aa|c))++m|(?:(aa|c))+n)", "bbaacaaccaaaacxbbbmbn" },
- { MU, A, 0, 0, "((?:b)++a)+(cd)*+m", "bbababbacdcdnbbababbacdcdm" },
- { MU, A, 0, 0, "((?:(b))++a)+((c)d)*+m", "bbababbacdcdnbbababbacdcdm" },
- { MU, A, 0, 0, "(?:(?:(?:ab)*+k)++(?:n(?:cd)++)*+)*+m", "ababkkXababkkabkncXababkkabkncdcdncdXababkkabkncdcdncdkkabkncdXababkkabkncdcdncdkkabkncdm" },
- { MU, A, 0, 0, "(?:((ab)*+(k))++(n(?:c(d))++)*+)*+m", "ababkkXababkkabkncXababkkabkncdcdncdXababkkabkncdcdncdkkabkncdXababkkabkncdcdncdkkabkncdm" },
-
- /* Back references. */
- { MU, A, 0, 0, "(aa|bb)(\\1*)(ll|)(\\3*)bbbbbbc", "aaaaaabbbbbbbbc" },
- { CMU, A, 0, 0, "(aa|bb)(\\1+)(ll|)(\\3+)bbbbbbc", "bBbbBbCbBbbbBbbcbbBbbbBBbbC" },
- { CM, A, 0, 0, "(a{2,4})\\1", "AaAaaAaA" },
- { MU, A, 0, 0, "(aa|bb)(\\1?)aa(\\1?)(ll|)(\\4+)bbc", "aaaaaaaabbaabbbbaabbbbc" },
- { MU, A, 0, 0, "(aa|bb)(\\1{0,5})(ll|)(\\3{0,5})cc", "bbxxbbbbxxaaaaaaaaaaaaaaaacc" },
- { MU, A, 0, 0, "(aa|bb)(\\1{3,5})(ll|)(\\3{3,5})cc", "bbbbbbbbbbbbaaaaaaccbbbbbbbbbbbbbbcc" },
- { MU, A, 0, 0, "(aa|bb)(\\1{3,})(ll|)(\\3{3,})cc", "bbbbbbbbbbbbaaaaaaccbbbbbbbbbbbbbbcc" },
- { MU, A, 0, 0, "(\\w+)b(\\1+)c", "GabGaGaDbGaDGaDc" },
- { MU, A, 0, 0, "(?:(aa)|b)\\1?b", "bb" },
- { CMU, A, 0, 0, "(aa|bb)(\\1*?)aa(\\1+?)", "bBBbaaAAaaAAaa" },
- { MU, A, 0, 0, "(aa|bb)(\\1*?)(dd|)cc(\\3+?)", "aaaaaccdd" },
- { CMU, A, 0, 0, "(?:(aa|bb)(\\1?\?)cc){2}(\\1?\?)", "aAaABBbbAAaAcCaAcCaA" },
- { MU, A, 0, 0, "(?:(aa|bb)(\\1{3,5}?)){2}(dd|)(\\3{3,5}?)", "aaaaaabbbbbbbbbbaaaaaaaaaaaaaa" },
- { CM, A, 0, 0, "(?:(aa|bb)(\\1{3,}?)){2}(dd|)(\\3{3,}?)", "aaaaaabbbbbbbbbbaaaaaaaaaaaaaa" },
- { MU, A, 0, 0, "(?:(aa|bb)(\\1{0,3}?)){2}(dd|)(\\3{0,3}?)b(\\1{0,3}?)(\\1{0,3})", "aaaaaaaaaaaaaaabaaaaa" },
- { MU, A, 0, 0, "(a(?:\\1|)a){3}b", "aaaaaaaaaaab" },
- { M, A, 0, 0, "(a?)b(\\1\\1*\\1+\\1?\\1*?\\1+?\\1??\\1*+\\1++\\1?+\\1{4}\\1{3,5}\\1{4,}\\1{0,5}\\1{3,5}?\\1{4,}?\\1{0,5}?\\1{3,5}+\\1{4,}+\\1{0,5}+#){2}d", "bb#b##d" },
- { MUP, A, 0, 0 | F_PROPERTY, "(\\P{N})\\1{2,}", ".www." },
- { MUP, A, 0, 0 | F_PROPERTY, "(\\P{N})\\1{0,2}", "wwwww." },
- { MUP, A, 0, 0 | F_PROPERTY, "(\\P{N})\\1{1,2}ww", "wwww" },
- { MUP, A, 0, 0 | F_PROPERTY, "(\\P{N})\\1{1,2}ww", "wwwww" },
- { PCRE2_UCP, 0, 0, 0 | F_PROPERTY, "(\\P{N})\\1{2,}", ".www." },
- { CMUP, A, 0, 0, "(\xf0\x90\x90\x80)\\1", "\xf0\x90\x90\xa8\xf0\x90\x90\xa8" },
- { MU | PCRE2_DUPNAMES, A, 0, 0 | F_NOMATCH, "\\k<A>{1,3}(?<A>aa)(?<A>bb)", "aabb" },
- { MU | PCRE2_DUPNAMES | PCRE2_MATCH_UNSET_BACKREF, A, 0, 0, "\\k<A>{1,3}(?<A>aa)(?<A>bb)", "aabb" },
- { MU | PCRE2_DUPNAMES | PCRE2_MATCH_UNSET_BACKREF, A, 0, 0, "\\k<A>*(?<A>aa)(?<A>bb)", "aabb" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "(?<A>aa)(?<A>bb)\\k<A>{0,3}aaaaaa", "aabbaaaaaa" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "(?<A>aa)(?<A>bb)\\k<A>{2,5}bb", "aabbaaaabb" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{0,3}m", "aaaaaaaabbbbaabbbbm" },
- { MU | PCRE2_DUPNAMES, A, 0, 0 | F_NOMATCH, "\\k<A>{1,3}?(?<A>aa)(?<A>bb)", "aabb" },
- { MU | PCRE2_DUPNAMES | PCRE2_MATCH_UNSET_BACKREF, A, 0, 0, "\\k<A>{1,3}?(?<A>aa)(?<A>bb)", "aabb" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "\\k<A>*?(?<A>aa)(?<A>bb)", "aabb" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{0,3}?m", "aaaaaabbbbbbaabbbbbbbbbbm" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>*?m", "aaaaaabbbbbbaabbbbbbbbbbm" },
- { MU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
- { CMU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}M", "aaaaaaaabbbbaabbbbm" },
- { CMU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{1,3}M", "aaaaaaaabbbbaabbbbm" },
- { CMU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}?M", "aaaaaabbbbbbaabbbbbbbbbbm" },
- { CMU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
-
- /* Assertions. */
- { MU, A, 0, 0, "(?=xx|yy|zz)\\w{4}", "abczzdefg" },
- { MU, A, 0, 0, "(?=((\\w+)b){3}|ab)", "dbbbb ab" },
- { MU, A, 0, 0, "(?!ab|bc|cd)[a-z]{2}", "Xabcdef" },
- { MU, A, 0, 0, "(?<=aaa|aa|a)a", "aaa" },
- { MU, A, 0, 2, "(?<=aaa|aa|a)a", "aaa" },
- { M, A, 0, 0, "(?<=aaa|aa|a)a", "aaa" },
- { M, A, 0, 2, "(?<=aaa|aa|a)a", "aaa" },
- { MU, A, 0, 0, "(\\d{2})(?!\\w+c|(((\\w?)m){2}n)+|\\1)", "x5656" },
- { MU, A, 0, 0, "((?=((\\d{2,6}\\w){2,}))\\w{5,20}K){2,}", "567v09708K12l00M00 567v09708K12l00M00K45K" },
- { MU, A, 0, 0, "(?=(?:(?=\\S+a)\\w*(b)){3})\\w+\\d", "bba bbab nbbkba nbbkba0kl" },
- { MU, A, 0, 0, "(?>a(?>(b+))a(?=(..)))*?k", "acabbcabbaabacabaabbakk" },
- { MU, A, 0, 0, "((?(?=(a))a)+k)", "bbak" },
- { MU, A, 0, 0, "((?(?=a)a)+k)", "bbak" },
- { MU, A, 0, 0 | F_NOMATCH, "(?=(?>(a))m)amk", "a k" },
- { MU, A, 0, 0 | F_NOMATCH, "(?!(?>(a))m)amk", "a k" },
- { MU, A, 0, 0 | F_NOMATCH, "(?>(?=(a))am)amk", "a k" },
- { MU, A, 0, 0, "(?=(?>a|(?=(?>(b+))a|c)[a-c]+)*?m)[a-cm]+k", "aaam bbam baaambaam abbabba baaambaamk" },
- { MU, A, 0, 0, "(?> ?\?\\b(?(?=\\w{1,4}(a))m)\\w{0,8}bc){2,}?", "bca ssbc mabd ssbc mabc" },
- { MU, A, 0, 0, "(?:(?=ab)?[^n][^n])+m", "ababcdabcdcdabnababcdabcdcdabm" },
- { MU, A, 0, 0, "(?:(?=a(b))?[^n][^n])+m", "ababcdabcdcdabnababcdabcdcdabm" },
- { MU, A, 0, 0, "(?:(?=.(.))??\\1.)+m", "aabbbcbacccanaabbbcbacccam" },
- { MU, A, 0, 0, "(?:(?=.)??[a-c])+m", "abacdcbacacdcaccam" },
- { MU, A, 0, 0, "((?!a)?(?!([^a]))?)+$", "acbab" },
- { MU, A, 0, 0, "((?!a)?\?(?!([^a]))?\?)+$", "acbab" },
- { MU, A, 0, 0, "a(?=(?C)\\B(?C`x`))b", "ab" },
- { MU, A, 0, 0, "a(?!(?C)\\B(?C`x`))bb|ab", "abb" },
- { MU, A, 0, 0, "a(?=\\b|(?C)\\B(?C`x`))b", "ab" },
- { MU, A, 0, 0, "a(?!\\b|(?C)\\B(?C`x`))bb|ab", "abb" },
- { MU, A, 0, 0, "c(?(?=(?C)\\B(?C`x`))ab|a)", "cab" },
- { MU, A, 0, 0, "c(?(?!(?C)\\B(?C`x`))ab|a)", "cab" },
- { MU, A, 0, 0, "c(?(?=\\b|(?C)\\B(?C`x`))ab|a)", "cab" },
- { MU, A, 0, 0, "c(?(?!\\b|(?C)\\B(?C`x`))ab|a)", "cab" },
- { MU, A, 0, 0, "a(?=)b", "ab" },
- { MU, A, 0, 0 | F_NOMATCH, "a(?!)b", "ab" },
-
- /* Not empty, ACCEPT, FAIL */
- { MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "a*", "bcx" },
- { MU, A, PCRE2_NOTEMPTY, 0, "a*", "bcaad" },
- { MU, A, PCRE2_NOTEMPTY, 0, "a*?", "bcaad" },
- { MU, A, PCRE2_NOTEMPTY_ATSTART, 0, "a*", "bcaad" },
- { MU, A, 0, 0, "a(*ACCEPT)b", "ab" },
- { MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "a*(*ACCEPT)b", "bcx" },
- { MU, A, PCRE2_NOTEMPTY, 0, "a*(*ACCEPT)b", "bcaad" },
- { MU, A, PCRE2_NOTEMPTY, 0, "a*?(*ACCEPT)b", "bcaad" },
- { MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "(?:z|a*(*ACCEPT)b)", "bcx" },
- { MU, A, PCRE2_NOTEMPTY, 0, "(?:z|a*(*ACCEPT)b)", "bcaad" },
- { MU, A, PCRE2_NOTEMPTY, 0, "(?:z|a*?(*ACCEPT)b)", "bcaad" },
- { MU, A, PCRE2_NOTEMPTY_ATSTART, 0, "a*(*ACCEPT)b", "bcx" },
- { MU, A, PCRE2_NOTEMPTY_ATSTART, 0 | F_NOMATCH, "a*(*ACCEPT)b", "" },
- { MU, A, 0, 0, "((a(*ACCEPT)b))", "ab" },
- { MU, A, 0, 0, "(a(*FAIL)a|a)", "aaa" },
- { MU, A, 0, 0, "(?=ab(*ACCEPT)b)a", "ab" },
- { MU, A, 0, 0, "(?=(?:x|ab(*ACCEPT)b))", "ab" },
- { MU, A, 0, 0, "(?=(a(b(*ACCEPT)b)))a", "ab" },
- { MU, A, PCRE2_NOTEMPTY, 0, "(?=a*(*ACCEPT))c", "c" },
-
- /* Conditional blocks. */
- { MU, A, 0, 0, "(?(?=(a))a|b)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?!(b))a|b)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?=a)a|b)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?!b)a|b)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?=(a))a*|b*)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?!(b))a*|b*)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?!(b))(?:aaaaaa|a)|(?:bbbbbb|b))+aaaak", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb aaaaaaak" },
- { MU, A, 0, 0, "(?(?!b)(?:aaaaaa|a)|(?:bbbbbb|b))+aaaak", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb aaaaaaak" },
- { MU, A, 0, 0 | F_DIFF, "(?(?!(b))(?:aaaaaa|a)|(?:bbbbbb|b))+bbbbk", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb bbbbbbbk" },
- { MU, A, 0, 0, "(?(?!b)(?:aaaaaa|a)|(?:bbbbbb|b))+bbbbk", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb bbbbbbbk" },
- { MU, A, 0, 0, "(?(?=a)a*|b*)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?!b)a*|b*)+k", "ababbalbbadabak" },
- { MU, A, 0, 0, "(?(?=a)ab)", "a" },
- { MU, A, 0, 0, "(?(?<!b)c)", "b" },
- { MU, A, 0, 0, "(?(DEFINE)a(b))", "a" },
- { MU, A, 0, 0, "a(?(DEFINE)(?:b|(?:c?)+)*)", "a" },
- { MU, A, 0, 0, "(?(?=.[a-c])[k-l]|[A-D])", "kdB" },
- { MU, A, 0, 0, "(?(?!.{0,4}[cd])(aa|bb)|(cc|dd))+", "aabbccddaa" },
- { MU, A, 0, 0, "(?(?=[^#@]*@)(aaab|aa|aba)|(aba|aab)){3,}", "aaabaaaba#aaabaaaba#aaabaaaba@" },
- { MU, A, 0, 0, "((?=\\w{5})\\w(?(?=\\w*k)\\d|[a-f_])*\\w\\s)+", "mol m10kk m088k _f_a_ mbkkl" },
- { MU, A, 0, 0, "(c)?\?(?(1)a|b)", "cdcaa" },
- { MU, A, 0, 0, "(c)?\?(?(1)a|b)", "cbb" },
- { MU, A, 0, 0 | F_DIFF, "(?(?=(a))(aaaa|a?))+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?=a)(aaaa|a?))+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?!(b))(aaaa|a?))+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?!b)(aaaa|a?))+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0 | F_DIFF, "(?(?=(a))a*)+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?=a)a*)+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?!(b))a*)+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?!b)a*)+aak", "aaaaab aaaaak" },
- { MU, A, 0, 0, "(?(?=(?=(?!(x))a)aa)aaa|(?(?=(?!y)bb)bbb))*k", "abaabbaaabbbaaabbb abaabbaaabbbaaabbbk" },
- { MU, A, 0, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)*l", "bc ddd abccabccl" },
- { MU, A, 0, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+?dd", "bcabcacdb bdddd" },
- { MU, A, 0, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+l", "ababccddabdbccd abcccl" },
- { MU, A, 0, 0, "((?:a|aa)(?(1)aaa))x", "aax" },
- { MU, A, 0, 0, "(?(?!)a|b)", "ab" },
- { MU, A, 0, 0, "(?(?!)a)", "ab" },
- { MU, A, 0, 0 | F_NOMATCH, "(?(?!)a|b)", "ac" },
-
- /* Set start of match. */
- { MU, A, 0, 0, "(?:\\Ka)*aaaab", "aaaaaaaa aaaaaaabb" },
- { MU, A, 0, 0, "(?>\\Ka\\Ka)*aaaab", "aaaaaaaa aaaaaaaaaabb" },
- { MU, A, 0, 0, "a+\\K(?<=\\Gaa)a", "aaaaaa" },
- { MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "a\\K(*ACCEPT)b", "aa" },
- { MU, A, PCRE2_NOTEMPTY_ATSTART, 0, "a\\K(*ACCEPT)b", "aa" },
-
- /* First line. */
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_PROPERTY, "\\p{Any}a", "bb\naaa" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_NOMATCH | F_PROPERTY, "\\p{Any}a", "bb\r\naaa" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0, "(?<=a)", "a" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_NOMATCH, "[^a][^b]", "ab" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_NOMATCH, "a", "\na" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_NOMATCH, "[abc]", "\na" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_NOMATCH, "^a", "\na" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0 | F_NOMATCH, "^(?<=\n)", "\na" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0, "\xf0\x90\x90\x80", "\xf0\x90\x90\x80" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_ANY, 0, 0 | F_NOMATCH, "#", "\xc2\x85#" },
- { M | PCRE2_FIRSTLINE, PCRE2_NEWLINE_ANY, 0, 0 | F_NOMATCH, "#", "\x85#" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_ANY, 0, 0 | F_NOMATCH, "^#", "\xe2\x80\xa8#" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_CRLF, 0, 0 | F_PROPERTY, "\\p{Any}", "\r\na" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_CRLF, 0, 0, ".", "\r" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_CRLF, 0, 0, "a", "\ra" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_CRLF, 0, 0 | F_NOMATCH, "ba", "bbb\r\nba" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_CRLF, 0, 0 | F_NOMATCH | F_PROPERTY, "\\p{Any}{4}|a", "\r\na" },
- { MU | PCRE2_FIRSTLINE, PCRE2_NEWLINE_CRLF, 0, 1, ".", "\r\n" },
- { PCRE2_FIRSTLINE | PCRE2_DOTALL, PCRE2_NEWLINE_LF, 0, 0 | F_NOMATCH, "ab.", "ab" },
- { MU | PCRE2_FIRSTLINE, A, 0, 1 | F_NOMATCH, "^[a-d0-9]", "\nxx\nd" },
- { PCRE2_FIRSTLINE | PCRE2_DOTALL, PCRE2_NEWLINE_ANY, 0, 0, "....a", "012\n0a" },
- { MU | PCRE2_FIRSTLINE, A, 0, 0, "[aC]", "a" },
-
- /* Recurse. */
- { MU, A, 0, 0, "(a)(?1)", "aa" },
- { MU, A, 0, 0, "((a))(?1)", "aa" },
- { MU, A, 0, 0, "(b|a)(?1)", "aa" },
- { MU, A, 0, 0, "(b|(a))(?1)", "aa" },
- { MU, A, 0, 0 | F_NOMATCH, "((a)(b)(?:a*))(?1)", "aba" },
- { MU, A, 0, 0, "((a)(b)(?:a*))(?1)", "abab" },
- { MU, A, 0, 0, "((a+)c(?2))b(?1)", "aacaabaca" },
- { MU, A, 0, 0, "((?2)b|(a)){2}(?1)", "aabab" },
- { MU, A, 0, 0, "(?1)(a)*+(?2)(b(?1))", "aababa" },
- { MU, A, 0, 0, "(?1)(((a(*ACCEPT)))b)", "axaa" },
- { MU, A, 0, 0, "(?1)(?(DEFINE) (((ac(*ACCEPT)))b) )", "akaac" },
- { MU, A, 0, 0, "(a+)b(?1)b\\1", "abaaabaaaaa" },
- { MU, A, 0, 0 | F_NOMATCH, "(?(DEFINE)(aa|a))(?1)ab", "aab" },
- { MU, A, 0, 0, "(?(DEFINE)(a\\Kb))(?1)+ababc", "abababxabababc" },
- { MU, A, 0, 0, "(a\\Kb)(?1)+ababc", "abababxababababc" },
- { MU, A, 0, 0 | F_NOMATCH, "(a\\Kb)(?1)+ababc", "abababxababababxc" },
- { MU, A, 0, 0, "b|<(?R)*>", "<<b>" },
- { MU, A, 0, 0, "(a\\K){0}(?:(?1)b|ac)", "ac" },
- { MU, A, 0, 0, "(?(DEFINE)(a(?2)|b)(b(?1)|(a)))(?:(?1)|(?2))m", "ababababnababababaam" },
- { MU, A, 0, 0, "(a)((?(R)a|b))(?2)", "aabbabaa" },
- { MU, A, 0, 0, "(a)((?(R2)a|b))(?2)", "aabbabaa" },
- { MU, A, 0, 0, "(a)((?(R1)a|b))(?2)", "ababba" },
- { MU, A, 0, 0, "(?(R0)aa|bb(?R))", "abba aabb bbaa" },
- { MU, A, 0, 0, "((?(R)(?:aaaa|a)|(?:(aaaa)|(a)))+)(?1)$", "aaaaaaaaaa aaaa" },
- { MU, A, 0, 0, "(?P<Name>a(?(R&Name)a|b))(?1)", "aab abb abaa" },
- { MU, A, 0, 0, "((?(R)a|(?1)){3})", "XaaaaaaaaaX" },
- { MU, A, 0, 0, "((?:(?(R)a|(?1))){3})", "XaaaaaaaaaX" },
- { MU, A, 0, 0, "((?(R)a|(?1)){1,3})aaaaaa", "aaaaaaaaXaaaaaaaaa" },
- { MU, A, 0, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" },
-
- /* 16 bit specific tests. */
- { CM, A, 0, 0 | F_FORCECONV, "\xc3\xa1", "\xc3\x81\xc3\xa1" },
- { CM, A, 0, 0 | F_FORCECONV, "\xe1\xbd\xb8", "\xe1\xbf\xb8\xe1\xbd\xb8" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xc3\xa1]", "\xc3\x81\xc3\xa1" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xe1\xbd\xb8]", "\xe1\xbf\xb8\xe1\xbd\xb8" },
- { CM, A, 0, 0 | F_FORCECONV, "[a-\xed\xb0\x80]", "A" },
- { CM, A, 0, 0 | F_NO8 | F_FORCECONV, "[a-\\x{dc00}]", "B" },
- { CM, A, 0, 0 | F_NO8 | F_NOMATCH | F_FORCECONV, "[b-\\x{dc00}]", "a" },
- { CM, A, 0, 0 | F_NO8 | F_FORCECONV, "\xed\xa0\x80\\x{d800}\xed\xb0\x80\\x{dc00}", "\xed\xa0\x80\xed\xa0\x80\xed\xb0\x80\xed\xb0\x80" },
- { CM, A, 0, 0 | F_NO8 | F_FORCECONV, "[\xed\xa0\x80\\x{d800}]{1,2}?[\xed\xb0\x80\\x{dc00}]{1,2}?#", "\xed\xa0\x80\xed\xa0\x80\xed\xb0\x80\xed\xb0\x80#" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xed\xa0\x80\xed\xb0\x80#]{0,3}(?<=\xed\xb0\x80.)", "\xed\xa0\x80#\xed\xa0\x80##\xed\xb0\x80\xed\xa0\x80" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xed\xa0\x80-\xed\xb3\xbf]", "\xed\x9f\xbf\xed\xa0\x83" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xed\xa0\x80-\xed\xb3\xbf]", "\xed\xb4\x80\xed\xb3\xb0" },
- { CM, A, 0, 0 | F_NO8 | F_FORCECONV, "[\\x{d800}-\\x{dcff}]", "\xed\x9f\xbf\xed\xa0\x83" },
- { CM, A, 0, 0 | F_NO8 | F_FORCECONV, "[\\x{d800}-\\x{dcff}]", "\xed\xb4\x80\xed\xb3\xb0" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xed\xa0\x80-\xef\xbf\xbf]+[\x1-\xed\xb0\x80]+#", "\xed\xa0\x85\xc3\x81\xed\xa0\x85\xef\xbf\xb0\xc2\x85\xed\xa9\x89#" },
- { CM, A, 0, 0 | F_FORCECONV, "[\xed\xa0\x80][\xed\xb0\x80]{2,}", "\xed\xa0\x80\xed\xb0\x80\xed\xa0\x80\xed\xb0\x80\xed\xb0\x80\xed\xb0\x80" },
- { M, A, 0, 0 | F_FORCECONV, "[^\xed\xb0\x80]{3,}?", "##\xed\xb0\x80#\xed\xb0\x80#\xc3\x89#\xed\xb0\x80" },
- { M, A, 0, 0 | F_NO8 | F_FORCECONV, "[^\\x{dc00}]{3,}?", "##\xed\xb0\x80#\xed\xb0\x80#\xc3\x89#\xed\xb0\x80" },
- { CM, A, 0, 0 | F_FORCECONV, ".\\B.", "\xed\xa0\x80\xed\xb0\x80" },
- { CM, A, 0, 0 | F_FORCECONV, "\\D+(?:\\d+|.)\\S+(?:\\s+|.)\\W+(?:\\w+|.)\xed\xa0\x80\xed\xa0\x80", "\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80" },
- { CM, A, 0, 0 | F_FORCECONV, "\\d*\\s*\\w*\xed\xa0\x80\xed\xa0\x80", "\xed\xa0\x80\xed\xa0\x80" },
- { CM, A, 0, 0 | F_FORCECONV | F_NOMATCH, "\\d*?\\D*?\\s*?\\S*?\\w*?\\W*?##", "\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80#" },
- { CM | PCRE2_EXTENDED, A, 0, 0 | F_FORCECONV, "\xed\xa0\x80 \xed\xb0\x80 !", "\xed\xa0\x80\xed\xb0\x80!" },
- { CM, A, 0, 0 | F_FORCECONV, "\xed\xa0\x80+#[^#]+\xed\xa0\x80", "\xed\xa0\x80#a\xed\xa0\x80" },
- { CM, A, 0, 0 | F_FORCECONV, "(\xed\xa0\x80+)#\\1", "\xed\xa0\x80\xed\xa0\x80#\xed\xa0\x80\xed\xa0\x80" },
- { M, PCRE2_NEWLINE_ANY, 0, 0 | F_NO8 | F_FORCECONV, "^-", "a--\xe2\x80\xa8--" },
- { 0, BSR(PCRE2_BSR_UNICODE), 0, 0 | F_NO8 | F_FORCECONV, "\\R", "ab\xe2\x80\xa8" },
- { 0, 0, 0, 0 | F_NO8 | F_FORCECONV, "\\v", "ab\xe2\x80\xa9" },
- { 0, 0, 0, 0 | F_NO8 | F_FORCECONV, "\\h", "ab\xe1\xa0\x8e" },
- { 0, 0, 0, 0 | F_NO8 | F_FORCECONV, "\\v+?\\V+?#", "\xe2\x80\xa9\xe2\x80\xa9\xef\xbf\xbf\xef\xbf\xbf#" },
- { 0, 0, 0, 0 | F_NO8 | F_FORCECONV, "\\h+?\\H+?#", "\xe1\xa0\x8e\xe1\xa0\x8e\xef\xbf\xbf\xef\xbf\xbf#" },
-
- /* Partial matching. */
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "ab", "a" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "ab|a", "a" },
- { MU, A, PCRE2_PARTIAL_HARD, 0, "ab|a", "a" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "\\b#", "a" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "(?<=a)b", "a" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "abc|(?<=xxa)bc", "xxab" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "a\\B", "a" },
- { MU, A, PCRE2_PARTIAL_HARD, 0, "a\\b", "a" },
-
- /* (*MARK) verb. */
- { MU, A, 0, 0, "a(*MARK:aa)a", "ababaa" },
- { MU, A, 0, 0 | F_NOMATCH, "a(*:aa)a", "abab" },
- { MU, A, 0, 0, "a(*:aa)(b(*:bb)b|bc)", "abc" },
- { MU, A, 0, 0 | F_NOMATCH, "a(*:1)x|b(*:2)y", "abc" },
- { MU, A, 0, 0, "(?>a(*:aa))b|ac", "ac" },
- { MU, A, 0, 0, "(?(DEFINE)(a(*:aa)))(?1)", "a" },
- { MU, A, 0, 0 | F_NOMATCH, "(?(DEFINE)((a)(*:aa)))(?1)b", "aa" },
- { MU, A, 0, 0, "(?(DEFINE)(a(*:aa)))a(?1)b|aac", "aac" },
- { MU, A, 0, 0, "(a(*:aa)){0}(?:b(?1)b|c)+c", "babbab cc" },
- { MU, A, 0, 0, "(a(*:aa)){0}(?:b(?1)b)+", "babba" },
- { MU, A, 0, 0 | F_NOMATCH, "(a(*:aa)){0}(?:b(?1)b)+", "ba" },
- { MU, A, 0, 0, "(a\\K(*:aa)){0}(?:b(?1)b|c)+c", "babbab cc" },
- { MU, A, 0, 0, "(a\\K(*:aa)){0}(?:b(?1)b)+", "babba" },
- { MU, A, 0, 0 | F_NOMATCH, "(a\\K(*:aa)){0}(?:b(?1)b)+", "ba" },
- { MU, A, 0, 0 | F_NOMATCH, "(*:mark)m", "a" },
-
- /* (*COMMIT) verb. */
- { MU, A, 0, 0 | F_NOMATCH, "a(*COMMIT)b", "ac" },
- { MU, A, 0, 0, "aa(*COMMIT)b", "xaxaab" },
- { MU, A, 0, 0 | F_NOMATCH, "a(*COMMIT)(*:msg)b|ac", "ac" },
- { MU, A, 0, 0 | F_NOMATCH, "(a(*COMMIT)b)++", "abac" },
- { MU, A, 0, 0 | F_NOMATCH, "((a)(*COMMIT)b)++", "abac" },
- { MU, A, 0, 0 | F_NOMATCH, "(?=a(*COMMIT)b)ab|ad", "ad" },
-
- /* (*PRUNE) verb. */
- { MU, A, 0, 0, "aa\\K(*PRUNE)b", "aaab" },
- { MU, A, 0, 0, "aa(*PRUNE:bb)b|a", "aa" },
- { MU, A, 0, 0, "(a)(a)(*PRUNE)b|(a)", "aa" },
- { MU, A, 0, 0, "(a)(a)(a)(a)(a)(a)(a)(a)(*PRUNE)b|(a)", "aaaaaaaa" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "a(*PRUNE)a|", "a" },
- { MU, A, PCRE2_PARTIAL_SOFT, 0, "a(*PRUNE)a|m", "a" },
- { MU, A, 0, 0 | F_NOMATCH, "(?=a(*PRUNE)b)ab|ad", "ad" },
- { MU, A, 0, 0, "a(*COMMIT)(*PRUNE)d|bc", "abc" },
- { MU, A, 0, 0, "(?=a(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?=a(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
- { MU, A, 0, 0, "(?=(a)(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?=(a)(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
- { MU, A, 0, 0, "(a(*COMMIT)b){0}a(?1)(*PRUNE)c|bc", "abc" },
- { MU, A, 0, 0 | F_NOMATCH, "(a(*COMMIT)b){0}a(*COMMIT)(?1)(*PRUNE)c|bc", "abc" },
- { MU, A, 0, 0, "(a(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(a(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
- { MU, A, 0, 0, "((a)(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)((a)(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
- { MU, A, 0, 0, "(?>a(*COMMIT)b)*abab(*PRUNE)d|ba", "ababab" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)*abab(*PRUNE)d|ba", "ababab" },
- { MU, A, 0, 0, "(?>a(*COMMIT)b)+abab(*PRUNE)d|ba", "ababab" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)+abab(*PRUNE)d|ba", "ababab" },
- { MU, A, 0, 0, "(?>a(*COMMIT)b)?ab(*PRUNE)d|ba", "aba" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)?ab(*PRUNE)d|ba", "aba" },
- { MU, A, 0, 0, "(?>a(*COMMIT)b)*?n(*PRUNE)d|ba", "abababn" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)*?n(*PRUNE)d|ba", "abababn" },
- { MU, A, 0, 0, "(?>a(*COMMIT)b)+?n(*PRUNE)d|ba", "abababn" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)+?n(*PRUNE)d|ba", "abababn" },
- { MU, A, 0, 0, "(?>a(*COMMIT)b)??n(*PRUNE)d|bn", "abn" },
- { MU, A, 0, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)??n(*PRUNE)d|bn", "abn" },
-
- /* (*SKIP) verb. */
- { MU, A, 0, 0 | F_NOMATCH, "(?=a(*SKIP)b)ab|ad", "ad" },
- { MU, A, 0, 0, "(\\w+(*SKIP)#)", "abcd,xyz#," },
- { MU, A, 0, 0, "\\w+(*SKIP)#|mm", "abcd,xyz#," },
- { MU, A, 0, 0 | F_NOMATCH, "b+(?<=(*SKIP)#c)|b+", "#bbb" },
-
- /* (*THEN) verb. */
- { MU, A, 0, 0, "((?:a(*THEN)|aab)(*THEN)c|a+)+m", "aabcaabcaabcaabcnacm" },
- { MU, A, 0, 0 | F_NOMATCH, "((?:a(*THEN)|aab)(*THEN)c|a+)+m", "aabcm" },
- { MU, A, 0, 0, "((?:a(*THEN)|aab)c|a+)+m", "aabcaabcnmaabcaabcm" },
- { MU, A, 0, 0, "((?:a|aab)(*THEN)c|a+)+m", "aam" },
- { MU, A, 0, 0, "((?:a(*COMMIT)|aab)(*THEN)c|a+)+m", "aam" },
- { MU, A, 0, 0, "(?(?=a(*THEN)b)ab|ad)", "ad" },
- { MU, A, 0, 0, "(?(?!a(*THEN)b)ad|add)", "add" },
- { MU, A, 0, 0 | F_NOMATCH, "(?(?=a)a(*THEN)b|ad)", "ad" },
- { MU, A, 0, 0, "(?!(?(?=a)ab|b(*THEN)d))bn|bnn", "bnn" },
-
- /* Deep recursion. */
- { MU, A, 0, 0, "((((?:(?:(?:\\w)+)?)*|(?>\\w)+?)+|(?>\\w)?\?)*)?\\s", "aaaaa+ " },
- { MU, A, 0, 0, "(?:((?:(?:(?:\\w*?)+)??|(?>\\w)?|\\w*+)*)+)+?\\s", "aa+ " },
- { MU, A, 0, 0, "((a?)+)+b", "aaaaaaaaaaaa b" },
-
- /* Deep recursion: Stack limit reached. */
- { M, A, 0, 0 | F_NOMATCH, "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa" },
- { M, A, 0, 0 | F_NOMATCH, "(?:a+)+b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
- { M, A, 0, 0 | F_NOMATCH, "(?:a+?)+?b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
- { M, A, 0, 0 | F_NOMATCH, "(?:a*)*b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
- { M, A, 0, 0 | F_NOMATCH, "(?:a*?)*?b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
-
- { 0, 0, 0, 0, NULL, NULL }
-};
-
-#ifdef SUPPORT_PCRE2_8
-static pcre2_jit_stack_8* callback8(void *arg)
-{
- return (pcre2_jit_stack_8 *)arg;
-}
-#endif
-
-#ifdef SUPPORT_PCRE2_16
-static pcre2_jit_stack_16* callback16(void *arg)
-{
- return (pcre2_jit_stack_16 *)arg;
-}
-#endif
-
-#ifdef SUPPORT_PCRE2_32
-static pcre2_jit_stack_32* callback32(void *arg)
-{
- return (pcre2_jit_stack_32 *)arg;
-}
-#endif
-
-#ifdef SUPPORT_PCRE2_8
-static pcre2_jit_stack_8 *stack8;
-
-static pcre2_jit_stack_8 *getstack8(void)
-{
- if (!stack8)
- stack8 = pcre2_jit_stack_create_8(1, 1024 * 1024, NULL);
- return stack8;
-}
-
-static void setstack8(pcre2_match_context_8 *mcontext)
-{
- if (!mcontext) {
- if (stack8)
- pcre2_jit_stack_free_8(stack8);
- stack8 = NULL;
- return;
- }
-
- pcre2_jit_stack_assign_8(mcontext, callback8, getstack8());
-}
-#endif /* SUPPORT_PCRE2_8 */
-
-#ifdef SUPPORT_PCRE2_16
-static pcre2_jit_stack_16 *stack16;
-
-static pcre2_jit_stack_16 *getstack16(void)
-{
- if (!stack16)
- stack16 = pcre2_jit_stack_create_16(1, 1024 * 1024, NULL);
- return stack16;
-}
-
-static void setstack16(pcre2_match_context_16 *mcontext)
-{
- if (!mcontext) {
- if (stack16)
- pcre2_jit_stack_free_16(stack16);
- stack16 = NULL;
- return;
- }
-
- pcre2_jit_stack_assign_16(mcontext, callback16, getstack16());
-}
-#endif /* SUPPORT_PCRE2_16 */
-
-#ifdef SUPPORT_PCRE2_32
-static pcre2_jit_stack_32 *stack32;
-
-static pcre2_jit_stack_32 *getstack32(void)
-{
- if (!stack32)
- stack32 = pcre2_jit_stack_create_32(1, 1024 * 1024, NULL);
- return stack32;
-}
-
-static void setstack32(pcre2_match_context_32 *mcontext)
-{
- if (!mcontext) {
- if (stack32)
- pcre2_jit_stack_free_32(stack32);
- stack32 = NULL;
- return;
- }
-
- pcre2_jit_stack_assign_32(mcontext, callback32, getstack32());
-}
-#endif /* SUPPORT_PCRE2_32 */
-
-#ifdef SUPPORT_PCRE2_16
-
-static int convert_utf8_to_utf16(PCRE2_SPTR8 input, PCRE2_UCHAR16 *output, int *offsetmap, int max_length)
-{
- PCRE2_SPTR8 iptr = input;
- PCRE2_UCHAR16 *optr = output;
- unsigned int c;
-
- if (max_length == 0)
- return 0;
-
- while (*iptr && max_length > 1) {
- c = 0;
- if (offsetmap)
- *offsetmap++ = (int)(iptr - (unsigned char*)input);
-
- if (*iptr < 0xc0)
- c = *iptr++;
- else if (!(*iptr & 0x20)) {
- c = ((iptr[0] & 0x1f) << 6) | (iptr[1] & 0x3f);
- iptr += 2;
- } else if (!(*iptr & 0x10)) {
- c = ((iptr[0] & 0x0f) << 12) | ((iptr[1] & 0x3f) << 6) | (iptr[2] & 0x3f);
- iptr += 3;
- } else if (!(*iptr & 0x08)) {
- c = ((iptr[0] & 0x07) << 18) | ((iptr[1] & 0x3f) << 12) | ((iptr[2] & 0x3f) << 6) | (iptr[3] & 0x3f);
- iptr += 4;
- }
-
- if (c < 65536) {
- *optr++ = c;
- max_length--;
- } else if (max_length <= 2) {
- *optr = '\0';
- return (int)(optr - output);
- } else {
- c -= 0x10000;
- *optr++ = 0xd800 | ((c >> 10) & 0x3ff);
- *optr++ = 0xdc00 | (c & 0x3ff);
- max_length -= 2;
- if (offsetmap)
- offsetmap++;
- }
- }
- if (offsetmap)
- *offsetmap = (int)(iptr - (unsigned char*)input);
- *optr = '\0';
- return (int)(optr - output);
-}
-
-static int copy_char8_to_char16(PCRE2_SPTR8 input, PCRE2_UCHAR16 *output, int max_length)
-{
- PCRE2_SPTR8 iptr = input;
- PCRE2_UCHAR16 *optr = output;
-
- if (max_length == 0)
- return 0;
-
- while (*iptr && max_length > 1) {
- *optr++ = *iptr++;
- max_length--;
- }
- *optr = '\0';
- return (int)(optr - output);
-}
-
-#define REGTEST_MAX_LENGTH16 4096
-static PCRE2_UCHAR16 regtest_buf16[REGTEST_MAX_LENGTH16];
-static int regtest_offsetmap16[REGTEST_MAX_LENGTH16];
-
-#endif /* SUPPORT_PCRE2_16 */
-
-#ifdef SUPPORT_PCRE2_32
-
-static int convert_utf8_to_utf32(PCRE2_SPTR8 input, PCRE2_UCHAR32 *output, int *offsetmap, int max_length)
-{
- PCRE2_SPTR8 iptr = input;
- PCRE2_UCHAR32 *optr = output;
- unsigned int c;
-
- if (max_length == 0)
- return 0;
-
- while (*iptr && max_length > 1) {
- c = 0;
- if (offsetmap)
- *offsetmap++ = (int)(iptr - (unsigned char*)input);
-
- if (*iptr < 0xc0)
- c = *iptr++;
- else if (!(*iptr & 0x20)) {
- c = ((iptr[0] & 0x1f) << 6) | (iptr[1] & 0x3f);
- iptr += 2;
- } else if (!(*iptr & 0x10)) {
- c = ((iptr[0] & 0x0f) << 12) | ((iptr[1] & 0x3f) << 6) | (iptr[2] & 0x3f);
- iptr += 3;
- } else if (!(*iptr & 0x08)) {
- c = ((iptr[0] & 0x07) << 18) | ((iptr[1] & 0x3f) << 12) | ((iptr[2] & 0x3f) << 6) | (iptr[3] & 0x3f);
- iptr += 4;
- }
-
- *optr++ = c;
- max_length--;
- }
- if (offsetmap)
- *offsetmap = (int)(iptr - (unsigned char*)input);
- *optr = 0;
- return (int)(optr - output);
-}
-
-static int copy_char8_to_char32(PCRE2_SPTR8 input, PCRE2_UCHAR32 *output, int max_length)
-{
- PCRE2_SPTR8 iptr = input;
- PCRE2_UCHAR32 *optr = output;
-
- if (max_length == 0)
- return 0;
-
- while (*iptr && max_length > 1) {
- *optr++ = *iptr++;
- max_length--;
- }
- *optr = '\0';
- return (int)(optr - output);
-}
-
-#define REGTEST_MAX_LENGTH32 4096
-static PCRE2_UCHAR32 regtest_buf32[REGTEST_MAX_LENGTH32];
-static int regtest_offsetmap32[REGTEST_MAX_LENGTH32];
-
-#endif /* SUPPORT_PCRE2_32 */
-
-static int check_ascii(const char *input)
-{
- const unsigned char *ptr = (unsigned char *)input;
- while (*ptr) {
- if (*ptr > 127)
- return 0;
- ptr++;
- }
- return 1;
-}
-
-#define OVECTOR_SIZE 15
-
-static int regression_tests(void)
-{
- struct regression_test_case *current = regression_test_cases;
- int error;
- PCRE2_SIZE err_offs;
- int is_successful;
- int is_ascii;
- int total = 0;
- int successful = 0;
- int successful_row = 0;
- int counter = 0;
- int jit_compile_mode;
- int utf = 0;
- int disabled_options = 0;
- int i;
-#ifdef SUPPORT_PCRE2_8
- pcre2_code_8 *re8;
- pcre2_compile_context_8 *ccontext8;
- pcre2_match_data_8 *mdata8_1;
- pcre2_match_data_8 *mdata8_2;
- pcre2_match_context_8 *mcontext8;
- PCRE2_SIZE *ovector8_1 = NULL;
- PCRE2_SIZE *ovector8_2 = NULL;
- int return_value8[2];
-#endif
-#ifdef SUPPORT_PCRE2_16
- pcre2_code_16 *re16;
- pcre2_compile_context_16 *ccontext16;
- pcre2_match_data_16 *mdata16_1;
- pcre2_match_data_16 *mdata16_2;
- pcre2_match_context_16 *mcontext16;
- PCRE2_SIZE *ovector16_1 = NULL;
- PCRE2_SIZE *ovector16_2 = NULL;
- int return_value16[2];
- int length16;
-#endif
-#ifdef SUPPORT_PCRE2_32
- pcre2_code_32 *re32;
- pcre2_compile_context_32 *ccontext32;
- pcre2_match_data_32 *mdata32_1;
- pcre2_match_data_32 *mdata32_2;
- pcre2_match_context_32 *mcontext32;
- PCRE2_SIZE *ovector32_1 = NULL;
- PCRE2_SIZE *ovector32_2 = NULL;
- int return_value32[2];
- int length32;
-#endif
-
-#if defined SUPPORT_PCRE2_8
- PCRE2_UCHAR8 cpu_info[128];
-#elif defined SUPPORT_PCRE2_16
- PCRE2_UCHAR16 cpu_info[128];
-#elif defined SUPPORT_PCRE2_32
- PCRE2_UCHAR32 cpu_info[128];
-#endif
-#if defined SUPPORT_UTF && ((defined(SUPPORT_PCRE2_8) + defined(SUPPORT_PCRE2_16) + defined(SUPPORT_PCRE2_32)) >= 2)
- int return_value;
-#endif
-
- /* This test compares the behaviour of interpreter and JIT. Although disabling
- utf or ucp may make tests fail, if the pcre_exec result is the SAME, it is
- still considered successful from pcre_jit_test point of view. */
-
-#if defined SUPPORT_PCRE2_8
- pcre2_config_8(PCRE2_CONFIG_JITTARGET, &cpu_info);
-#elif defined SUPPORT_PCRE2_16
- pcre2_config_16(PCRE2_CONFIG_JITTARGET, &cpu_info);
-#elif defined SUPPORT_PCRE2_32
- pcre2_config_32(PCRE2_CONFIG_JITTARGET, &cpu_info);
-#endif
-
- printf("Running JIT regression tests\n");
- printf(" target CPU of SLJIT compiler: ");
- for (i = 0; cpu_info[i]; i++)
- printf("%c", (char)(cpu_info[i]));
- printf("\n");
-
-#if defined SUPPORT_PCRE2_8
- pcre2_config_8(PCRE2_CONFIG_UNICODE, &utf);
-#elif defined SUPPORT_PCRE2_16
- pcre2_config_16(PCRE2_CONFIG_UNICODE, &utf);
-#elif defined SUPPORT_PCRE2_32
- pcre2_config_32(PCRE2_CONFIG_UNICODE, &utf);
-#endif
-
- if (!utf)
- disabled_options |= PCRE2_UTF;
-#ifdef SUPPORT_PCRE2_8
- printf(" in 8 bit mode with UTF-8 %s:\n", utf ? "enabled" : "disabled");
-#endif
-#ifdef SUPPORT_PCRE2_16
- printf(" in 16 bit mode with UTF-16 %s:\n", utf ? "enabled" : "disabled");
-#endif
-#ifdef SUPPORT_PCRE2_32
- printf(" in 32 bit mode with UTF-32 %s:\n", utf ? "enabled" : "disabled");
-#endif
-
- while (current->pattern) {
- /* printf("\nPattern: %s :\n", current->pattern); */
- total++;
- is_ascii = 0;
- if (!(current->start_offset & F_PROPERTY))
- is_ascii = check_ascii(current->pattern) && check_ascii(current->input);
-
- if (current->match_options & PCRE2_PARTIAL_SOFT)
- jit_compile_mode = PCRE2_JIT_PARTIAL_SOFT;
- else if (current->match_options & PCRE2_PARTIAL_HARD)
- jit_compile_mode = PCRE2_JIT_PARTIAL_HARD;
- else
- jit_compile_mode = PCRE2_JIT_COMPLETE;
- error = 0;
-#ifdef SUPPORT_PCRE2_8
- re8 = NULL;
- ccontext8 = pcre2_compile_context_create_8(NULL);
- if (ccontext8) {
- if (GET_NEWLINE(current->newline))
- pcre2_set_newline_8(ccontext8, GET_NEWLINE(current->newline));
- if (GET_BSR(current->newline))
- pcre2_set_bsr_8(ccontext8, GET_BSR(current->newline));
-
- if (!(current->start_offset & F_NO8)) {
- re8 = pcre2_compile_8((PCRE2_SPTR8)current->pattern, PCRE2_ZERO_TERMINATED,
- current->compile_options & ~disabled_options,
- &error, &err_offs, ccontext8);
-
- if (!re8 && (utf || is_ascii))
- printf("\n8 bit: Cannot compile pattern \"%s\": %d\n", current->pattern, error);
- }
- pcre2_compile_context_free_8(ccontext8);
- }
- else
- printf("\n8 bit: Cannot allocate compile context\n");
-#endif
-#ifdef SUPPORT_PCRE2_16
- if ((current->compile_options & PCRE2_UTF) || (current->start_offset & F_FORCECONV))
- convert_utf8_to_utf16((PCRE2_SPTR8)current->pattern, regtest_buf16, NULL, REGTEST_MAX_LENGTH16);
- else
- copy_char8_to_char16((PCRE2_SPTR8)current->pattern, regtest_buf16, REGTEST_MAX_LENGTH16);
-
- re16 = NULL;
- ccontext16 = pcre2_compile_context_create_16(NULL);
- if (ccontext16) {
- if (GET_NEWLINE(current->newline))
- pcre2_set_newline_16(ccontext16, GET_NEWLINE(current->newline));
- if (GET_BSR(current->newline))
- pcre2_set_bsr_16(ccontext16, GET_BSR(current->newline));
-
- if (!(current->start_offset & F_NO16)) {
- re16 = pcre2_compile_16(regtest_buf16, PCRE2_ZERO_TERMINATED,
- current->compile_options & ~disabled_options,
- &error, &err_offs, ccontext16);
-
- if (!re16 && (utf || is_ascii))
- printf("\n16 bit: Cannot compile pattern \"%s\": %d\n", current->pattern, error);
- }
- pcre2_compile_context_free_16(ccontext16);
- }
- else
- printf("\n16 bit: Cannot allocate compile context\n");
-#endif
-#ifdef SUPPORT_PCRE2_32
- if ((current->compile_options & PCRE2_UTF) || (current->start_offset & F_FORCECONV))
- convert_utf8_to_utf32((PCRE2_SPTR8)current->pattern, regtest_buf32, NULL, REGTEST_MAX_LENGTH32);
- else
- copy_char8_to_char32((PCRE2_SPTR8)current->pattern, regtest_buf32, REGTEST_MAX_LENGTH32);
-
- re32 = NULL;
- ccontext32 = pcre2_compile_context_create_32(NULL);
- if (ccontext32) {
- if (GET_NEWLINE(current->newline))
- pcre2_set_newline_32(ccontext32, GET_NEWLINE(current->newline));
- if (GET_BSR(current->newline))
- pcre2_set_bsr_32(ccontext32, GET_BSR(current->newline));
-
- if (!(current->start_offset & F_NO32)) {
- re32 = pcre2_compile_32(regtest_buf32, PCRE2_ZERO_TERMINATED,
- current->compile_options & ~disabled_options,
- &error, &err_offs, ccontext32);
-
- if (!re32 && (utf || is_ascii))
- printf("\n32 bit: Cannot compile pattern \"%s\": %d\n", current->pattern, error);
- }
- pcre2_compile_context_free_32(ccontext32);
- }
- else
- printf("\n32 bit: Cannot allocate compile context\n");
-#endif
-
- counter++;
- if ((counter & 0x3) != 0) {
-#ifdef SUPPORT_PCRE2_8
- setstack8(NULL);
-#endif
-#ifdef SUPPORT_PCRE2_16
- setstack16(NULL);
-#endif
-#ifdef SUPPORT_PCRE2_32
- setstack32(NULL);
-#endif
- }
-
-#ifdef SUPPORT_PCRE2_8
- return_value8[0] = -1000;
- return_value8[1] = -1000;
- mdata8_1 = pcre2_match_data_create_8(OVECTOR_SIZE, NULL);
- mdata8_2 = pcre2_match_data_create_8(OVECTOR_SIZE, NULL);
- mcontext8 = pcre2_match_context_create_8(NULL);
- if (!mdata8_1 || !mdata8_2 || !mcontext8) {
- printf("\n8 bit: Cannot allocate match data\n");
- pcre2_match_data_free_8(mdata8_1);
- pcre2_match_data_free_8(mdata8_2);
- pcre2_match_context_free_8(mcontext8);
- pcre2_code_free_8(re8);
- re8 = NULL;
- } else {
- ovector8_1 = pcre2_get_ovector_pointer_8(mdata8_1);
- ovector8_2 = pcre2_get_ovector_pointer_8(mdata8_2);
- for (i = 0; i < OVECTOR_SIZE * 3; ++i)
- ovector8_1[i] = -2;
- for (i = 0; i < OVECTOR_SIZE * 3; ++i)
- ovector8_2[i] = -2;
- }
- if (re8) {
- return_value8[1] = pcre2_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
- current->start_offset & OFFSET_MASK, current->match_options, mdata8_2, NULL);
-
- if (pcre2_jit_compile_8(re8, jit_compile_mode)) {
- printf("\n8 bit: JIT compiler does not support \"%s\"\n", current->pattern);
- } else if ((counter & 0x1) != 0) {
- setstack8(mcontext8);
- return_value8[0] = pcre2_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
- current->start_offset & OFFSET_MASK, current->match_options, mdata8_1, mcontext8);
- } else {
- pcre2_jit_stack_assign_8(mcontext8, NULL, getstack8());
- return_value8[0] = pcre2_jit_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
- current->start_offset & OFFSET_MASK, current->match_options, mdata8_1, mcontext8);
- }
- }
-#endif
-
-#ifdef SUPPORT_PCRE2_16
- return_value16[0] = -1000;
- return_value16[1] = -1000;
- mdata16_1 = pcre2_match_data_create_16(OVECTOR_SIZE, NULL);
- mdata16_2 = pcre2_match_data_create_16(OVECTOR_SIZE, NULL);
- mcontext16 = pcre2_match_context_create_16(NULL);
- if (!mdata16_1 || !mdata16_2 || !mcontext16) {
- printf("\n16 bit: Cannot allocate match data\n");
- pcre2_match_data_free_16(mdata16_1);
- pcre2_match_data_free_16(mdata16_2);
- pcre2_match_context_free_16(mcontext16);
- pcre2_code_free_16(re16);
- re16 = NULL;
- } else {
- ovector16_1 = pcre2_get_ovector_pointer_16(mdata16_1);
- ovector16_2 = pcre2_get_ovector_pointer_16(mdata16_2);
- for (i = 0; i < OVECTOR_SIZE * 3; ++i)
- ovector16_1[i] = -2;
- for (i = 0; i < OVECTOR_SIZE * 3; ++i)
- ovector16_2[i] = -2;
- }
- if (re16) {
- if ((current->compile_options & PCRE2_UTF) || (current->start_offset & F_FORCECONV))
- length16 = convert_utf8_to_utf16((PCRE2_SPTR8)current->input, regtest_buf16, regtest_offsetmap16, REGTEST_MAX_LENGTH16);
- else
- length16 = copy_char8_to_char16((PCRE2_SPTR8)current->input, regtest_buf16, REGTEST_MAX_LENGTH16);
-
- return_value16[1] = pcre2_match_16(re16, regtest_buf16, length16,
- current->start_offset & OFFSET_MASK, current->match_options, mdata16_2, NULL);
-
- if (pcre2_jit_compile_16(re16, jit_compile_mode)) {
- printf("\n16 bit: JIT compiler does not support \"%s\"\n", current->pattern);
- } else if ((counter & 0x1) != 0) {
- setstack16(mcontext16);
- return_value16[0] = pcre2_match_16(re16, regtest_buf16, length16,
- current->start_offset & OFFSET_MASK, current->match_options, mdata16_1, mcontext16);
- } else {
- pcre2_jit_stack_assign_16(mcontext16, NULL, getstack16());
- return_value16[0] = pcre2_jit_match_16(re16, regtest_buf16, length16,
- current->start_offset & OFFSET_MASK, current->match_options, mdata16_1, mcontext16);
- }
- }
-#endif
-
-#ifdef SUPPORT_PCRE2_32
- return_value32[0] = -1000;
- return_value32[1] = -1000;
- mdata32_1 = pcre2_match_data_create_32(OVECTOR_SIZE, NULL);
- mdata32_2 = pcre2_match_data_create_32(OVECTOR_SIZE, NULL);
- mcontext32 = pcre2_match_context_create_32(NULL);
- if (!mdata32_1 || !mdata32_2 || !mcontext32) {
- printf("\n32 bit: Cannot allocate match data\n");
- pcre2_match_data_free_32(mdata32_1);
- pcre2_match_data_free_32(mdata32_2);
- pcre2_match_context_free_32(mcontext32);
- pcre2_code_free_32(re32);
- re32 = NULL;
- } else {
- ovector32_1 = pcre2_get_ovector_pointer_32(mdata32_1);
- ovector32_2 = pcre2_get_ovector_pointer_32(mdata32_2);
- for (i = 0; i < OVECTOR_SIZE * 3; ++i)
- ovector32_1[i] = -2;
- for (i = 0; i < OVECTOR_SIZE * 3; ++i)
- ovector32_2[i] = -2;
- }
- if (re32) {
- if ((current->compile_options & PCRE2_UTF) || (current->start_offset & F_FORCECONV))
- length32 = convert_utf8_to_utf32((PCRE2_SPTR8)current->input, regtest_buf32, regtest_offsetmap32, REGTEST_MAX_LENGTH32);
- else
- length32 = copy_char8_to_char32((PCRE2_SPTR8)current->input, regtest_buf32, REGTEST_MAX_LENGTH32);
-
- return_value32[1] = pcre2_match_32(re32, regtest_buf32, length32,
- current->start_offset & OFFSET_MASK, current->match_options, mdata32_2, NULL);
-
- if (pcre2_jit_compile_32(re32, jit_compile_mode)) {
- printf("\n32 bit: JIT compiler does not support \"%s\"\n", current->pattern);
- } else if ((counter & 0x1) != 0) {
- setstack32(mcontext32);
- return_value32[0] = pcre2_match_32(re32, regtest_buf32, length32,
- current->start_offset & OFFSET_MASK, current->match_options, mdata32_1, mcontext32);
- } else {
- pcre2_jit_stack_assign_32(mcontext32, NULL, getstack32());
- return_value32[0] = pcre2_jit_match_32(re32, regtest_buf32, length32,
- current->start_offset & OFFSET_MASK, current->match_options, mdata32_1, mcontext32);
- }
- }
-#endif
-
- /* printf("[%d-%d-%d|%d-%d|%d-%d|%d-%d]%s",
- return_value8[0], return_value16[0], return_value32[0],
- (int)ovector8_1[0], (int)ovector8_1[1],
- (int)ovector16_1[0], (int)ovector16_1[1],
- (int)ovector32_1[0], (int)ovector32_1[1],
- (current->compile_options & PCRE2_CASELESS) ? "C" : ""); */
-
- /* If F_DIFF is set, just run the test, but do not compare the results.
- Segfaults can still be captured. */
-
- is_successful = 1;
- if (!(current->start_offset & F_DIFF)) {
-#if defined SUPPORT_UTF && ((defined(SUPPORT_PCRE2_8) + defined(SUPPORT_PCRE2_16) + defined(SUPPORT_PCRE2_32)) >= 2)
- if (!(current->start_offset & F_FORCECONV)) {
-
- /* All results must be the same. */
-#ifdef SUPPORT_PCRE2_8
- if ((return_value = return_value8[0]) != return_value8[1]) {
- printf("\n8 bit: Return value differs(J8:%d,I8:%d): [%d] '%s' @ '%s'\n",
- return_value8[0], return_value8[1], total, current->pattern, current->input);
- is_successful = 0;
- } else
-#endif
-#ifdef SUPPORT_PCRE2_16
- if ((return_value = return_value16[0]) != return_value16[1]) {
- printf("\n16 bit: Return value differs(J16:%d,I16:%d): [%d] '%s' @ '%s'\n",
- return_value16[0], return_value16[1], total, current->pattern, current->input);
- is_successful = 0;
- } else
-#endif
-#ifdef SUPPORT_PCRE2_32
- if ((return_value = return_value32[0]) != return_value32[1]) {
- printf("\n32 bit: Return value differs(J32:%d,I32:%d): [%d] '%s' @ '%s'\n",
- return_value32[0], return_value32[1], total, current->pattern, current->input);
- is_successful = 0;
- } else
-#endif
-#if defined SUPPORT_PCRE2_8 && defined SUPPORT_PCRE2_16
- if (return_value8[0] != return_value16[0]) {
- printf("\n8 and 16 bit: Return value differs(J8:%d,J16:%d): [%d] '%s' @ '%s'\n",
- return_value8[0], return_value16[0],
- total, current->pattern, current->input);
- is_successful = 0;
- } else
-#endif
-#if defined SUPPORT_PCRE2_8 && defined SUPPORT_PCRE2_32
- if (return_value8[0] != return_value32[0]) {
- printf("\n8 and 32 bit: Return value differs(J8:%d,J32:%d): [%d] '%s' @ '%s'\n",
- return_value8[0], return_value32[0],
- total, current->pattern, current->input);
- is_successful = 0;
- } else
-#endif
-#if defined SUPPORT_PCRE2_16 && defined SUPPORT_PCRE2_32
- if (return_value16[0] != return_value32[0]) {
- printf("\n16 and 32 bit: Return value differs(J16:%d,J32:%d): [%d] '%s' @ '%s'\n",
- return_value16[0], return_value32[0],
- total, current->pattern, current->input);
- is_successful = 0;
- } else
-#endif
- if (return_value >= 0 || return_value == PCRE_ERROR_PARTIAL) {
- if (return_value == PCRE_ERROR_PARTIAL) {
- return_value = 2;
- } else {
- return_value *= 2;
- }
-#ifdef SUPPORT_PCRE2_8
- return_value8[0] = return_value;
-#endif
-#ifdef SUPPORT_PCRE2_16
- return_value16[0] = return_value;
-#endif
-#ifdef SUPPORT_PCRE2_32
- return_value32[0] = return_value;
-#endif
- /* Transform back the results. */
- if (current->flags & PCRE_UTF8) {
-#ifdef SUPPORT_PCRE2_16
- for (i = 0; i < return_value; ++i) {
- if (ovector16_1[i] >= 0)
- ovector16_1[i] = regtest_offsetmap16[ovector16_1[i]];
- if (ovector16_2[i] >= 0)
- ovector16_2[i] = regtest_offsetmap16[ovector16_2[i]];
- }
-#endif
-#ifdef SUPPORT_PCRE2_32
- for (i = 0; i < return_value; ++i) {
- if (ovector32_1[i] >= 0)
- ovector32_1[i] = regtest_offsetmap32[ovector32_1[i]];
- if (ovector32_2[i] >= 0)
- ovector32_2[i] = regtest_offsetmap32[ovector32_2[i]];
- }
-#endif
- }
-
- for (i = 0; i < return_value; ++i) {
-#if defined SUPPORT_PCRE2_8 && defined SUPPORT_PCRE2_16
- if (ovector8_1[i] != ovector8_2[i] || ovector8_1[i] != ovector16_1[i] || ovector8_1[i] != ovector16_2[i]) {
- printf("\n8 and 16 bit: Ovector[%d] value differs(J8:%d,I8:%d,J16:%d,I16:%d): [%d] '%s' @ '%s' \n",
- i, ovector8_1[i], ovector8_2[i], ovector16_1[i], ovector16_2[i],
- total, current->pattern, current->input);
- is_successful = 0;
- }
-#endif
-#if defined SUPPORT_PCRE2_8 && defined SUPPORT_PCRE2_32
- if (ovector8_1[i] != ovector8_2[i] || ovector8_1[i] != ovector32_1[i] || ovector8_1[i] != ovector32_2[i]) {
- printf("\n8 and 32 bit: Ovector[%d] value differs(J8:%d,I8:%d,J32:%d,I32:%d): [%d] '%s' @ '%s' \n",
- i, ovector8_1[i], ovector8_2[i], ovector32_1[i], ovector32_2[i],
- total, current->pattern, current->input);
- is_successful = 0;
- }
-#endif
-#if defined SUPPORT_PCRE2_16 && defined SUPPORT_PCRE2_32
- if (ovector16_1[i] != ovector16_2[i] || ovector16_1[i] != ovector32_1[i] || ovector16_1[i] != ovector32_2[i]) {
- printf("\n16 and 32 bit: Ovector[%d] value differs(J16:%d,I16:%d,J32:%d,I32:%d): [%d] '%s' @ '%s' \n",
- i, ovector16_1[i], ovector16_2[i], ovector32_1[i], ovector32_2[i],
- total, current->pattern, current->input);
- is_successful = 0;
- }
-#endif
- }
- }
- } else
-#endif /* more than one of SUPPORT_PCRE2_8, SUPPORT_PCRE2_16 and SUPPORT_PCRE2_32 */
- {
-#ifdef SUPPORT_PCRE2_8
- if (return_value8[0] != return_value8[1]) {
- printf("\n8 bit: Return value differs(%d:%d): [%d] '%s' @ '%s'\n",
- return_value8[0], return_value8[1], total, current->pattern, current->input);
- is_successful = 0;
- } else if (return_value8[0] >= 0 || return_value8[0] == PCRE2_ERROR_PARTIAL) {
- if (return_value8[0] == PCRE2_ERROR_PARTIAL)
- return_value8[0] = 2;
- else
- return_value8[0] *= 2;
-
- for (i = 0; i < return_value8[0]; ++i)
- if (ovector8_1[i] != ovector8_2[i]) {
- printf("\n8 bit: Ovector[%d] value differs(%d:%d): [%d] '%s' @ '%s'\n",
- i, (int)ovector8_1[i], (int)ovector8_2[i], total, current->pattern, current->input);
- is_successful = 0;
- }
- }
-#endif
-
-#ifdef SUPPORT_PCRE2_16
- if (return_value16[0] != return_value16[1]) {
- printf("\n16 bit: Return value differs(%d:%d): [%d] '%s' @ '%s'\n",
- return_value16[0], return_value16[1], total, current->pattern, current->input);
- is_successful = 0;
- } else if (return_value16[0] >= 0 || return_value16[0] == PCRE2_ERROR_PARTIAL) {
- if (return_value16[0] == PCRE2_ERROR_PARTIAL)
- return_value16[0] = 2;
- else
- return_value16[0] *= 2;
-
- for (i = 0; i < return_value16[0]; ++i)
- if (ovector16_1[i] != ovector16_2[i]) {
- printf("\n16 bit: Ovector[%d] value differs(%d:%d): [%d] '%s' @ '%s'\n",
- i, (int)ovector16_1[i], (int)ovector16_2[i], total, current->pattern, current->input);
- is_successful = 0;
- }
- }
-#endif
-
-#ifdef SUPPORT_PCRE2_32
- if (return_value32[0] != return_value32[1]) {
- printf("\n32 bit: Return value differs(%d:%d): [%d] '%s' @ '%s'\n",
- return_value32[0], return_value32[1], total, current->pattern, current->input);
- is_successful = 0;
- } else if (return_value32[0] >= 0 || return_value32[0] == PCRE2_ERROR_PARTIAL) {
- if (return_value32[0] == PCRE2_ERROR_PARTIAL)
- return_value32[0] = 2;
- else
- return_value32[0] *= 2;
-
- for (i = 0; i < return_value32[0]; ++i)
- if (ovector32_1[i] != ovector32_2[i]) {
- printf("\n32 bit: Ovector[%d] value differs(%d:%d): [%d] '%s' @ '%s'\n",
- i, (int)ovector32_1[i], (int)ovector32_2[i], total, current->pattern, current->input);
- is_successful = 0;
- }
- }
-#endif
- }
- }
-
- if (is_successful) {
-#ifdef SUPPORT_PCRE2_8
- if (!(current->start_offset & F_NO8) && (utf || is_ascii)) {
- if (return_value8[0] < 0 && !(current->start_offset & F_NOMATCH)) {
- printf("8 bit: Test should match: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
-
- if (return_value8[0] >= 0 && (current->start_offset & F_NOMATCH)) {
- printf("8 bit: Test should not match: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
- }
-#endif
-#ifdef SUPPORT_PCRE2_16
- if (!(current->start_offset & F_NO16) && (utf || is_ascii)) {
- if (return_value16[0] < 0 && !(current->start_offset & F_NOMATCH)) {
- printf("16 bit: Test should match: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
-
- if (return_value16[0] >= 0 && (current->start_offset & F_NOMATCH)) {
- printf("16 bit: Test should not match: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
- }
-#endif
-#ifdef SUPPORT_PCRE2_32
- if (!(current->start_offset & F_NO32) && (utf || is_ascii)) {
- if (return_value32[0] < 0 && !(current->start_offset & F_NOMATCH)) {
- printf("32 bit: Test should match: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
-
- if (return_value32[0] >= 0 && (current->start_offset & F_NOMATCH)) {
- printf("32 bit: Test should not match: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
- }
-#endif
- }
-
- if (is_successful) {
-#ifdef SUPPORT_PCRE2_8
- if (re8 && !(current->start_offset & F_NO8) && pcre2_get_mark_8(mdata8_1) != pcre2_get_mark_8(mdata8_2)) {
- printf("8 bit: Mark value mismatch: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
-#endif
-#ifdef SUPPORT_PCRE2_16
- if (re16 && !(current->start_offset & F_NO16) && pcre2_get_mark_16(mdata16_1) != pcre2_get_mark_16(mdata16_2)) {
- printf("16 bit: Mark value mismatch: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
-#endif
-#ifdef SUPPORT_PCRE2_32
- if (re32 && !(current->start_offset & F_NO32) && pcre2_get_mark_32(mdata32_1) != pcre2_get_mark_32(mdata32_2)) {
- printf("32 bit: Mark value mismatch: [%d] '%s' @ '%s'\n",
- total, current->pattern, current->input);
- is_successful = 0;
- }
-#endif
- }
-
-#ifdef SUPPORT_PCRE2_8
- pcre2_code_free_8(re8);
- pcre2_match_data_free_8(mdata8_1);
- pcre2_match_data_free_8(mdata8_2);
- pcre2_match_context_free_8(mcontext8);
-#endif
-#ifdef SUPPORT_PCRE2_16
- pcre2_code_free_16(re16);
- pcre2_match_data_free_16(mdata16_1);
- pcre2_match_data_free_16(mdata16_2);
- pcre2_match_context_free_16(mcontext16);
-#endif
-#ifdef SUPPORT_PCRE2_32
- pcre2_code_free_32(re32);
- pcre2_match_data_free_32(mdata32_1);
- pcre2_match_data_free_32(mdata32_2);
- pcre2_match_context_free_32(mcontext32);
-#endif
-
- if (is_successful) {
- successful++;
- successful_row++;
- printf(".");
- if (successful_row >= 60) {
- successful_row = 0;
- printf("\n");
- }
- } else
- successful_row = 0;
-
- fflush(stdout);
- current++;
- }
-#ifdef SUPPORT_PCRE2_8
- setstack8(NULL);
-#endif
-#ifdef SUPPORT_PCRE2_16
- setstack16(NULL);
-#endif
-#ifdef SUPPORT_PCRE2_32
- setstack32(NULL);
-#endif
-
- if (total == successful) {
- printf("\nAll JIT regression tests are successfully passed.\n");
- return 0;
- } else {
- printf("\nSuccessful test ratio: %d%% (%d failed)\n", successful * 100 / total, total - successful);
- return 1;
- }
-}
-
-/* End of pcre2_jit_test.c */
diff --git a/thirdparty/pcre2/src/pcre2_match.c b/thirdparty/pcre2/src/pcre2_match.c
index 78a9bacbc8..79cc93f918 100644
--- a/thirdparty/pcre2/src/pcre2_match.c
+++ b/thirdparty/pcre2/src/pcre2_match.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2015-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -43,17 +43,31 @@ POSSIBILITY OF SUCH DAMAGE.
#include "config.h"
#endif
-#define NLBLOCK mb /* Block containing newline information */
-#define PSSTART start_subject /* Field containing processed string start */
-#define PSEND end_subject /* Field containing processed string end */
+/* These defines enables debugging code */
+
+//#define DEBUG_FRAMES_DISPLAY
+//#define DEBUG_SHOW_OPS
+//#define DEBUG_SHOW_RMATCH
+
+#ifdef DEBUG_FRAME_DISPLAY
+#include <stdarg.h>
+#endif
+
+/* These defines identify the name of the block containing "static"
+information, and fields within it. */
+
+#define NLBLOCK mb /* Block containing newline information */
+#define PSSTART start_subject /* Field containing processed string start */
+#define PSEND end_subject /* Field containing processed string end */
#include "pcre2_internal.h"
-/* Masks for identifying the public options that are permitted at match time.
-*/
+#define RECURSE_UNSET 0xffffffffu /* Bigger than max group number */
+
+/* Masks for identifying the public options that are permitted at match time. */
#define PUBLIC_MATCH_OPTIONS \
- (PCRE2_ANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
+ (PCRE2_ANCHORED|PCRE2_ENDANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
PCRE2_NOTEMPTY_ATSTART|PCRE2_NO_UTF_CHECK|PCRE2_PARTIAL_HARD| \
PCRE2_PARTIAL_SOFT|PCRE2_NO_JIT)
@@ -61,60 +75,255 @@ POSSIBILITY OF SUCH DAMAGE.
(PCRE2_NO_UTF_CHECK|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY|\
PCRE2_NOTEMPTY_ATSTART|PCRE2_PARTIAL_SOFT|PCRE2_PARTIAL_HARD)
-/* The mb->capture_last field uses the lower 16 bits for the last captured
-substring (which can never be greater than 65535) and a bit in the top half
-to mean "capture vector overflowed". This odd way of doing things was
-implemented when it was realized that preserving and restoring the overflow bit
-whenever the last capture number was saved/restored made for a neater
-interface, and doing it this way saved on (a) another variable, which would
-have increased the stack frame size (a big NO-NO in PCRE) and (b) another
-separate set of save/restore instructions. The following defines are used in
-implementing this. */
-
-#define CAPLMASK 0x0000ffff /* The bits used for last_capture */
-#define OVFLMASK 0xffff0000 /* The bits used for the overflow flag */
-#define OVFLBIT 0x00010000 /* The bit that is set for overflow */
-
-/* Bits for setting in mb->match_function_type to indicate two special types
-of call to match(). We do it this way to save on using another stack variable,
-as stack usage is to be discouraged. */
-
-#define MATCH_CONDASSERT 1 /* Called to check a condition assertion */
-#define MATCH_CBEGROUP 2 /* Could-be-empty unlimited repeat group */
-
-/* Non-error returns from the match() function. Error returns are externally
-defined PCRE2_ERROR_xxx codes, which are all negative. */
+/* Non-error returns from and within the match() function. Error returns are
+externally defined PCRE2_ERROR_xxx codes, which are all negative. */
#define MATCH_MATCH 1
#define MATCH_NOMATCH 0
-/* Special internal returns from the match() function. Make them sufficiently
-negative to avoid the external error codes. */
+/* Special internal returns used in the match() function. Make them
+sufficiently negative to avoid the external error codes. */
#define MATCH_ACCEPT (-999)
#define MATCH_KETRPOS (-998)
-#define MATCH_ONCE (-997)
/* The next 5 must be kept together and in sequence so that a test that checks
for any one of them can use a range. */
-#define MATCH_COMMIT (-996)
-#define MATCH_PRUNE (-995)
-#define MATCH_SKIP (-994)
-#define MATCH_SKIP_ARG (-993)
-#define MATCH_THEN (-992)
+#define MATCH_COMMIT (-997)
+#define MATCH_PRUNE (-996)
+#define MATCH_SKIP (-995)
+#define MATCH_SKIP_ARG (-994)
+#define MATCH_THEN (-993)
#define MATCH_BACKTRACK_MAX MATCH_THEN
#define MATCH_BACKTRACK_MIN MATCH_COMMIT
-/* Min and max values for the common repeats; for the maxima, 0 => infinity */
+/* Group frame type values. Zero means the frame is not a group frame. The
+lower 16 bits are used for data (e.g. the capture number). Group frames are
+used for most groups so that information about the start is easily available at
+the end without having to scan back through intermediate frames (backtrack
+points). */
+
+#define GF_CAPTURE 0x00010000u
+#define GF_NOCAPTURE 0x00020000u
+#define GF_CONDASSERT 0x00030000u
+#define GF_RECURSE 0x00040000u
-static const char rep_min[] = { 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, };
-static const char rep_max[] = { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, };
+/* Masks for the identity and data parts of the group frame type. */
-/* Maximum number of ovector elements that can be saved on the system stack
-when processing OP_RECURSE in non-HEAP_MATCH_RECURSE mode. If the ovector is
-bigger, malloc() is used. This value should be a multiple of 3, because the
-ovector length is always a multiple of 3. */
+#define GF_IDMASK(a) ((a) & 0xffff0000u)
+#define GF_DATAMASK(a) ((a) & 0x0000ffffu)
-#define OP_RECURSE_STACK_SAVE_MAX 45
+/* Repetition types */
+
+enum { REPTYPE_MIN, REPTYPE_MAX, REPTYPE_POS };
+
+/* Min and max values for the common repeats; a maximum of UINT32_MAX =>
+infinity. */
+
+static const uint32_t rep_min[] = {
+ 0, 0, /* * and *? */
+ 1, 1, /* + and +? */
+ 0, 0, /* ? and ?? */
+ 0, 0, /* dummy placefillers for OP_CR[MIN]RANGE */
+ 0, 1, 0 }; /* OP_CRPOS{STAR, PLUS, QUERY} */
+
+static const uint32_t rep_max[] = {
+ UINT32_MAX, UINT32_MAX, /* * and *? */
+ UINT32_MAX, UINT32_MAX, /* + and +? */
+ 1, 1, /* ? and ?? */
+ 0, 0, /* dummy placefillers for OP_CR[MIN]RANGE */
+ UINT32_MAX, UINT32_MAX, 1 }; /* OP_CRPOS{STAR, PLUS, QUERY} */
+
+/* Repetition types - must include OP_CRPOSRANGE (not needed above) */
+
+static const uint32_t rep_typ[] = {
+ REPTYPE_MAX, REPTYPE_MIN, /* * and *? */
+ REPTYPE_MAX, REPTYPE_MIN, /* + and +? */
+ REPTYPE_MAX, REPTYPE_MIN, /* ? and ?? */
+ REPTYPE_MAX, REPTYPE_MIN, /* OP_CRRANGE and OP_CRMINRANGE */
+ REPTYPE_POS, REPTYPE_POS, /* OP_CRPOSSTAR, OP_CRPOSPLUS */
+ REPTYPE_POS, REPTYPE_POS }; /* OP_CRPOSQUERY, OP_CRPOSRANGE */
+
+/* Numbers for RMATCH calls at backtracking points. When these lists are
+changed, the code at RETURN_SWITCH below must be updated in sync. */
+
+enum { RM1=1, RM2, RM3, RM4, RM5, RM6, RM7, RM8, RM9, RM10,
+ RM11, RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20,
+ RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
+ RM31, RM32, RM33, RM34, RM35 };
+
+#ifdef SUPPORT_WIDE_CHARS
+enum { RM100=100, RM101 };
+#endif
+
+#ifdef SUPPORT_UNICODE
+enum { RM200=200, RM201, RM202, RM203, RM204, RM205, RM206, RM207,
+ RM208, RM209, RM210, RM211, RM212, RM213, RM214, RM215,
+ RM216, RM217, RM218, RM219, RM220, RM221, RM222 };
+#endif
+
+/* Define short names for general fields in the current backtrack frame, which
+is always pointed to by the F variable. Occasional references to fields in
+other frames are written out explicitly. There are also some fields in the
+current frame whose names start with "temp" that are used for short-term,
+localised backtracking memory. These are #defined with Lxxx names at the point
+of use and undefined afterwards. */
+
+#define Fback_frame F->back_frame
+#define Fcapture_last F->capture_last
+#define Fcurrent_recurse F->current_recurse
+#define Fecode F->ecode
+#define Feptr F->eptr
+#define Fgroup_frame_type F->group_frame_type
+#define Flast_group_offset F->last_group_offset
+#define Flength F->length
+#define Fmark F->mark
+#define Frdepth F->rdepth
+#define Fstart_match F->start_match
+#define Foffset_top F->offset_top
+#define Foccu F->occu
+#define Fop F->op
+#define Fovector F->ovector
+#define Freturn_id F->return_id
+
+
+#ifdef DEBUG_FRAMES_DISPLAY
+/*************************************************
+* Display current frames and contents *
+*************************************************/
+
+/* This debugging function displays the current set of frames and their
+contents. It is not called automatically from anywhere, the intention being
+that calls can be inserted where necessary when debugging frame-related
+problems.
+
+Arguments:
+ f the file to write to
+ F the current top frame
+ P a previous frame of interest
+ frame_size the frame size
+ mb points to the match block
+ s identification text
+
+Returns: nothing
+*/
+
+static void
+display_frames(FILE *f, heapframe *F, heapframe *P, PCRE2_SIZE frame_size,
+ match_block *mb, const char *s, ...)
+{
+uint32_t i;
+heapframe *Q;
+va_list ap;
+va_start(ap, s);
+
+fprintf(f, "FRAMES ");
+vfprintf(f, s, ap);
+va_end(ap);
+
+if (P != NULL) fprintf(f, " P=%lu",
+ ((char *)P - (char *)(mb->match_frames))/frame_size);
+fprintf(f, "\n");
+
+for (i = 0, Q = mb->match_frames;
+ Q <= F;
+ i++, Q = (heapframe *)((char *)Q + frame_size))
+ {
+ fprintf(f, "Frame %d type=%x subj=%lu code=%d back=%lu id=%d",
+ i, Q->group_frame_type, Q->eptr - mb->start_subject, *(Q->ecode),
+ Q->back_frame, Q->return_id);
+
+ if (Q->last_group_offset == PCRE2_UNSET)
+ fprintf(f, " lgoffset=unset\n");
+ else
+ fprintf(f, " lgoffset=%lu\n", Q->last_group_offset/frame_size);
+ }
+}
+
+#endif
+
+
+
+/*************************************************
+* Process a callout *
+*************************************************/
+
+/* This function is called for all callouts, whether "standalone" or at the
+start of a conditional group. Feptr will be pointing to either OP_CALLOUT or
+OP_CALLOUT_STR. A callout block is allocated in pcre2_match() and initialized
+with fixed values.
+
+Arguments:
+ F points to the current backtracking frame
+ mb points to the match block
+ lengthptr where to return the length of the callout item
+
+Returns: the return from the callout
+ or 0 if no callout function exists
+*/
+
+static int
+do_callout(heapframe *F, match_block *mb, PCRE2_SIZE *lengthptr)
+{
+int rc;
+PCRE2_SIZE save0, save1;
+PCRE2_SIZE *callout_ovector;
+pcre2_callout_block *cb;
+
+*lengthptr = (*Fecode == OP_CALLOUT)?
+ PRIV(OP_lengths)[OP_CALLOUT] : GET(Fecode, 1 + 2*LINK_SIZE);
+
+if (mb->callout == NULL) return 0; /* No callout function provided */
+
+/* The original matching code (pre 10.30) worked directly with the ovector
+passed by the user, and this was passed to callouts. Now that the working
+ovector is in the backtracking frame, it no longer needs to reserve space for
+the overall match offsets (which would waste space in the frame). For backward
+compatibility, however, we pass capture_top and offset_vector to the callout as
+if for the extended ovector, and we ensure that the first two slots are unset
+by preserving and restoring their current contents. Picky compilers complain if
+references such as Fovector[-2] are use directly, so we set up a separate
+pointer. */
+
+callout_ovector = (PCRE2_SIZE *)(Fovector) - 2;
+
+/* The cb->version, cb->subject, cb->subject_length, and cb->start_match fields
+are set externally. The first 3 never change; the last is updated for each
+bumpalong. */
+
+cb = mb->cb;
+cb->capture_top = (uint32_t)Foffset_top/2 + 1;
+cb->capture_last = Fcapture_last;
+cb->offset_vector = callout_ovector;
+cb->mark = mb->nomatch_mark;
+cb->current_position = (PCRE2_SIZE)(Feptr - mb->start_subject);
+cb->pattern_position = GET(Fecode, 1);
+cb->next_item_length = GET(Fecode, 1 + LINK_SIZE);
+
+if (*Fecode == OP_CALLOUT) /* Numerical callout */
+ {
+ cb->callout_number = Fecode[1 + 2*LINK_SIZE];
+ cb->callout_string_offset = 0;
+ cb->callout_string = NULL;
+ cb->callout_string_length = 0;
+ }
+else /* String callout */
+ {
+ cb->callout_number = 0;
+ cb->callout_string_offset = GET(Fecode, 1 + 3*LINK_SIZE);
+ cb->callout_string = Fecode + (1 + 4*LINK_SIZE) + 1;
+ cb->callout_string_length =
+ *lengthptr - (1 + 4*LINK_SIZE) - 2;
+ }
+
+save0 = callout_ovector[0];
+save1 = callout_ovector[1];
+callout_ovector[0] = callout_ovector[1] = PCRE2_UNSET;
+rc = mb->callout(cb, mb->callout_data);
+callout_ovector[0] = save0;
+callout_ovector[1] = save1;
+cb->callout_flags = 0;
+return rc;
+}
@@ -130,10 +339,9 @@ seems unlikely.)
Arguments:
offset index into the offset vector
- offset_top top of the used offset vector
- eptr pointer into the subject
- mb points to match block
caseless TRUE if caseless
+ F the current backtracking frame pointer
+ mb points to match block
lengthptr pointer for returning the length matched
Returns: = 0 sucessful match; number of code units matched is set
@@ -142,21 +350,18 @@ Returns: = 0 sucessful match; number of code units matched is set
*/
static int
-match_ref(PCRE2_SIZE offset, PCRE2_SIZE offset_top, PCRE2_SPTR eptr,
- match_block *mb, BOOL caseless, PCRE2_SIZE *lengthptr)
+match_ref(PCRE2_SIZE offset, BOOL caseless, heapframe *F, match_block *mb,
+ PCRE2_SIZE *lengthptr)
{
-#if defined SUPPORT_UNICODE
-BOOL utf = (mb->poptions & PCRE2_UTF) != 0;
-#endif
-
PCRE2_SPTR p;
PCRE2_SIZE length;
-PCRE2_SPTR eptr_start = eptr;
+PCRE2_SPTR eptr;
+PCRE2_SPTR eptr_start;
/* Deal with an unset group. The default is no match, but there is an option to
match an empty string. */
-if (offset >= offset_top || mb->ovector[offset] == PCRE2_UNSET)
+if (offset >= Foffset_top || Fovector[offset] == PCRE2_UNSET)
{
if ((mb->poptions & PCRE2_MATCH_UNSET_BACKREF) != 0)
{
@@ -168,19 +373,20 @@ if (offset >= offset_top || mb->ovector[offset] == PCRE2_UNSET)
/* Separate the caseless and UTF cases for speed. */
-p = mb->start_subject + mb->ovector[offset];
-length = mb->ovector[offset+1] - mb->ovector[offset];
+eptr = eptr_start = Feptr;
+p = mb->start_subject + Fovector[offset];
+length = Fovector[offset+1] - Fovector[offset];
if (caseless)
{
#if defined SUPPORT_UNICODE
- if (utf)
+ if ((mb->poptions & PCRE2_UTF) != 0)
{
/* Match characters up to the end of the reference. NOTE: the number of
code units matched may differ, because in UTF-8 there are some characters
- whose upper and lower case versions code have different numbers of bytes.
- For example, U+023A (2 bytes in UTF-8) is the upper case version of U+2C65
- (3 bytes in UTF-8); a sequence of 3 of the former uses 6 bytes, as does a
+ whose upper and lower case codes have different numbers of bytes. For
+ example, U+023A (2 bytes in UTF-8) is the upper case version of U+2C65 (3
+ bytes in UTF-8); a sequence of 3 of the former uses 6 bytes, as does a
sequence of two of the latter. It is important, therefore, to check the
length along the reference, not along the subject (earlier code did this
wrong). */
@@ -226,14 +432,26 @@ if (caseless)
}
/* In the caseful case, we can just compare the code units, whether or not we
-are in UTF mode. */
+are in UTF mode. When partial matching, we have to do this unit-by-unit. */
else
{
- for (; length > 0; length--)
+ if (mb->partial != 0)
+ {
+ for (; length > 0; length--)
+ {
+ if (eptr >= mb->end_subject) return 1; /* Partial match */
+ if (UCHAR21INCTEST(p) != UCHAR21INCTEST(eptr)) return -1; /* No match */
+ }
+ }
+
+ /* Not partial matching */
+
+ else
{
- if (eptr >= mb->end_subject) return 1; /* Partial match */
- if (UCHAR21INCTEST(p) != UCHAR21INCTEST(eptr)) return -1; /*No match */
+ if ((PCRE2_SIZE)(mb->end_subject - eptr) < length) return 1; /* Partial */
+ if (memcmp(p, eptr, CU2BYTES(length)) != 0) return -1; /* No match */
+ eptr += length;
}
}
@@ -243,278 +461,73 @@ return 0; /* Match */
-/***************************************************************************
-****************************************************************************
- RECURSION IN THE match() FUNCTION
-
-The match() function is highly recursive, though not every recursive call
-increases the recursion depth. Nevertheless, some regular expressions can cause
-it to recurse to a great depth. I was writing for Unix, so I just let it call
-itself recursively. This uses the stack for saving everything that has to be
-saved for a recursive call. On Unix, the stack can be large, and this works
-fine.
-
-It turns out that on some non-Unix-like systems there are problems with
-programs that use a lot of stack. (This despite the fact that every last chip
-has oodles of memory these days, and techniques for extending the stack have
-been known for decades.) So....
-
-There is a fudge, triggered by defining HEAP_MATCH_RECURSE, which avoids
-recursive calls by keeping local variables that need to be preserved in blocks
-of memory on the heap instead instead of on the stack. Macros are used to
-achieve this so that the actual code doesn't look very different to what it
-always used to.
-
-The original heap-recursive code used longjmp(). However, it seems that this
-can be very slow on some operating systems. Following a suggestion from Stan
-Switzer, the use of longjmp() has been abolished, at the cost of having to
-provide a unique number for each call to RMATCH. There is no way of generating
-a sequence of numbers at compile time in C. I have given them names, to make
-them stand out more clearly.
-
-Crude tests on x86 Linux show a small speedup of around 5-8%. However, on
-FreeBSD, avoiding longjmp() more than halves the time taken to run the standard
-tests. Furthermore, not using longjmp() means that local dynamic variables
-don't have indeterminate values; this has meant that the frame size can be
-reduced because the result can be "passed back" by straight setting of the
-variable instead of being passed in the frame.
-****************************************************************************
-***************************************************************************/
-
-/* Numbers for RMATCH calls. When this list is changed, the code at HEAP_RETURN
-below must be updated in sync. */
-
-enum { RM1=1, RM2, RM3, RM4, RM5, RM6, RM7, RM8, RM9, RM10,
- RM11, RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20,
- RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
- RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
- RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
- RM51, RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60,
- RM61, RM62, RM63, RM64, RM65, RM66, RM67, RM68 };
-
-/* These versions of the macros use the stack, as normal. Note that the "rw"
-argument of RMATCH isn't actually used in this definition. */
-
-#ifndef HEAP_MATCH_RECURSE
-#define RMATCH(ra,rb,rc,rd,re,rw) \
- rrc = match(ra,rb,mstart,rc,rd,re,rdepth+1)
-#define RRETURN(ra) return ra
-#else
-
-/* These versions of the macros manage a private stack on the heap. Note that
-the "rd" argument of RMATCH isn't actually used in this definition. It's the mb
-argument of match(), which never changes. */
-
-#define RMATCH(ra,rb,rc,rd,re,rw)\
- {\
- heapframe *newframe = frame->Xnextframe;\
- if (newframe == NULL)\
- {\
- newframe = (heapframe *)(mb->stack_memctl.malloc)\
- (sizeof(heapframe), mb->stack_memctl.memory_data);\
- if (newframe == NULL) RRETURN(PCRE2_ERROR_NOMEMORY);\
- newframe->Xnextframe = NULL;\
- frame->Xnextframe = newframe;\
- }\
- frame->Xwhere = rw;\
- newframe->Xeptr = ra;\
- newframe->Xecode = rb;\
- newframe->Xmstart = mstart;\
- newframe->Xoffset_top = rc;\
- newframe->Xeptrb = re;\
- newframe->Xrdepth = frame->Xrdepth + 1;\
- newframe->Xprevframe = frame;\
- frame = newframe;\
- goto HEAP_RECURSE;\
- L_##rw:;\
- }
-
-#define RRETURN(ra)\
- {\
- heapframe *oldframe = frame;\
- frame = oldframe->Xprevframe;\
- if (frame != NULL)\
- {\
- rrc = ra;\
- goto HEAP_RETURN;\
- }\
- return ra;\
- }
-
-
-/* Structure for remembering the local variables in a private frame. Arrange it
-so as to minimize the number of holes. */
-
-typedef struct heapframe {
- struct heapframe *Xprevframe;
- struct heapframe *Xnextframe;
-
-#ifdef SUPPORT_UNICODE
- PCRE2_SPTR Xcharptr;
-#endif
- PCRE2_SPTR Xeptr;
- PCRE2_SPTR Xecode;
- PCRE2_SPTR Xmstart;
- PCRE2_SPTR Xcallpat;
- PCRE2_SPTR Xdata;
- PCRE2_SPTR Xnext_ecode;
- PCRE2_SPTR Xpp;
- PCRE2_SPTR Xprev;
- PCRE2_SPTR Xsaved_eptr;
-
- eptrblock *Xeptrb;
-
- PCRE2_SIZE Xlength;
- PCRE2_SIZE Xoffset;
- PCRE2_SIZE Xoffset_top;
- PCRE2_SIZE Xsave_offset1, Xsave_offset2, Xsave_offset3;
-
- uint32_t Xfc;
- uint32_t Xnumber;
- uint32_t Xrdepth;
- uint32_t Xop;
- uint32_t Xsave_capture_last;
-
-#ifdef SUPPORT_UNICODE
- uint32_t Xprop_value;
- int Xprop_type;
- int Xprop_fail_result;
- int Xoclength;
-#endif
-
- int Xcodelink;
- int Xctype;
- int Xfi;
- int Xmax;
- int Xmin;
- int Xwhere; /* Where to jump back to */
-
- BOOL Xcondition;
- BOOL Xcur_is_word;
- BOOL Xprev_is_word;
+/******************************************************************************
+*******************************************************************************
+ "Recursion" in the match() function
- eptrblock Xnewptrb;
- recursion_info Xnew_recursive;
+The original match() function was highly recursive, but this proved to be the
+source of a number of problems over the years, mostly because of the relatively
+small system stacks that are commonly found. As new features were added to
+patterns, various kludges were invented to reduce the amount of stack used,
+making the code hard to understand in places.
-#ifdef SUPPORT_UNICODE
- PCRE2_UCHAR Xocchars[6];
-#endif
-} heapframe;
-
-#endif
-
-
-/***************************************************************************
-***************************************************************************/
+A version did exist that used individual frames on the heap instead of calling
+match() recursively, but this ran substantially slower. The current version is
+a refactoring that uses a vector of frames to remember backtracking points.
+This runs no slower, and possibly even a bit faster than the original recursive
+implementation. An initial vector of size START_FRAMES_SIZE (enough for maybe
+50 frames) is allocated on the system stack. If this is not big enough, the
+heap is used for a larger vector.
+*******************************************************************************
+******************************************************************************/
-/* When HEAP_MATCH_RECURSE is not defined, the match() function implements
-backtrack points by calling itself recursively in all but one case. The one
-special case is when processing OP_RECURSE, which specifies recursion in the
-pattern. The entire ovector must be saved and restored while processing
-OP_RECURSE. If the ovector is small enough, instead of calling match()
-directly, op_recurse_ovecsave() is called. This function uses the system stack
-to save the ovector while calling match() to process the pattern recursion. */
-#ifndef HEAP_MATCH_RECURSE
-
-/* We need a prototype for match() because it is mutually recursive with
-op_recurse_ovecsave(). */
-
-static int
-match(PCRE2_SPTR eptr, PCRE2_SPTR ecode, PCRE2_SPTR mstart,
- PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb, uint32_t rdepth);
/*************************************************
-* Process OP_RECURSE, stacking ovector *
+* Macros for the match() function *
*************************************************/
-/* When this function is called, mb->recursive has already been updated to
-point to a new recursion data block, and all its fields other than ovec_save
-have been set.
+/* These macros pack up tests that are used for partial matching several times
+in the code. We set the "hit end" flag if the pointer is at the end of the
+subject and also past the earliest inspected character (i.e. something has been
+matched, even if not part of the actual matched string). For hard partial
+matching, we then return immediately. The second one is used when we already
+know we are past the end of the subject. */
-This function exists so that the local vector variable ovecsave is no longer
-defined in the match() function, as it was in PCRE1. It is used only when there
-is recursion in the pattern, so it wastes a lot of stack to have it defined for
-every call of match(). We now use this function as an indirect way of calling
-match() only in the case when ovecsave is needed. (David Wheeler used to say
-"All problems in computer science can be solved by another level of
-indirection.")
-
-HOWEVER: when this file is compiled by gcc in an optimizing mode, because this
-function is called only once, and only from within match(), gcc will "inline"
-it - that is, move it inside match() - and this completely negates its reason
-for existence. Therefore, we mark it as non-inline when gcc is in use.
-
-Arguments:
- eptr pointer to current character in subject
- callpat the recursion point in the pattern
- mstart pointer to the current match start position (can be modified
- by encountering \K)
- offset_top current top pointer (highest ovector offset used + 1)
- mb pointer to "static" info block for the match
- eptrb pointer to chain of blocks containing eptr at start of
- brackets - for testing for empty matches
- rdepth the recursion depth
-
-Returns: a match() return code
-*/
-
-static int
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
-__attribute__ ((noinline))
-#endif
-op_recurse_ovecsave(PCRE2_SPTR eptr, PCRE2_SPTR callpat,
- PCRE2_SPTR mstart, PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb,
- uint32_t rdepth)
-{
-int rrc;
-BOOL cbegroup = *callpat >= OP_SBRA;
-recursion_info *new_recursive = mb->recursive;
-PCRE2_SIZE ovecsave[OP_RECURSE_STACK_SAVE_MAX];
-
-/* Save the ovector */
+#define CHECK_PARTIAL()\
+ if (mb->partial != 0 && Feptr >= mb->end_subject && \
+ Feptr > mb->start_used_ptr) \
+ { \
+ mb->hitend = TRUE; \
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \
+ }
-new_recursive->ovec_save = ovecsave;
-memcpy(ovecsave, mb->ovector, mb->offset_end * sizeof(PCRE2_SIZE));
+#define SCHECK_PARTIAL()\
+ if (mb->partial != 0 && Feptr > mb->start_used_ptr) \
+ { \
+ mb->hitend = TRUE; \
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \
+ }
-/* Do the recursion. After processing each alternative, restore the ovector
-data and the last captured value. */
+/* These macros are used to implement backtracking. They simulate a recursive
+call to the match() function by means of a local vector of frames which
+remember the backtracking points. */
-do
- {
- if (cbegroup) mb->match_function_type |= MATCH_CBEGROUP;
- rrc = match(eptr, callpat + PRIV(OP_lengths)[*callpat], mstart, offset_top,
- mb, eptrb, rdepth + 1);
- memcpy(mb->ovector, new_recursive->ovec_save,
- mb->offset_end * sizeof(PCRE2_SIZE));
- mb->capture_last = new_recursive->saved_capture_last;
- if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) return rrc;
-
- /* PCRE does not allow THEN, SKIP, PRUNE or COMMIT to escape beyond a
- recursion; they cause a NOMATCH for the entire recursion. These codes
- are defined in a range that can be tested for. */
-
- if (rrc >= MATCH_BACKTRACK_MIN && rrc <= MATCH_BACKTRACK_MAX)
- return MATCH_NOMATCH;
-
- /* Any return code other than NOMATCH is an error. Otherwise, advance to the
- next alternative or to the end of the recursing subpattern. If there were
- nested recursions, mb->recursive might be changed, so reset it before
- looping. */
-
- if (rrc != MATCH_NOMATCH) return rrc;
- mb->recursive = new_recursive;
- callpat += GET(callpat, 1);
+#define RMATCH(ra,rb)\
+ {\
+ start_ecode = ra;\
+ Freturn_id = rb;\
+ goto MATCH_RECURSE;\
+ L_##rb:;\
}
-while (*callpat == OP_ALT); /* Loop for the alternatives */
-
-/* None of the alternatives matched. */
-return MATCH_NOMATCH;
-}
-#endif /* HEAP_MATCH_RECURSE */
+#define RRETURN(ra)\
+ {\
+ rrc = ra;\
+ goto RETURN_SWITCH;\
+ }
@@ -522,2468 +535,1270 @@ return MATCH_NOMATCH;
* Match from current position *
*************************************************/
-/* This function is called recursively in many circumstances. Whenever it
-returns a negative (error) response, the outer incarnation must also return the
-same response. */
+/* This function is called to run one match attempt at a single starting point
+in the subject.
-/* These macros pack up tests that are used for partial matching, and which
-appear several times in the code. We set the "hit end" flag if the pointer is
-at the end of the subject and also past the earliest inspected character (i.e.
-something has been matched, even if not part of the actual matched string). For
-hard partial matching, we then return immediately. The second one is used when
-we already know we are past the end of the subject. */
-
-#define CHECK_PARTIAL()\
- if (mb->partial != 0 && eptr >= mb->end_subject && \
- eptr > mb->start_used_ptr) \
- { \
- mb->hitend = TRUE; \
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL); \
- }
-
-#define SCHECK_PARTIAL()\
- if (mb->partial != 0 && eptr > mb->start_used_ptr) \
- { \
- mb->hitend = TRUE; \
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL); \
- }
-
-
-/* Performance note: It might be tempting to extract commonly used fields from
-the mb structure (e.g. utf, end_subject) into individual variables to improve
+Performance note: It might be tempting to extract commonly used fields from the
+mb structure (e.g. end_subject) into individual variables to improve
performance. Tests using gcc on a SPARC disproved this; in the first case, it
made performance worse.
Arguments:
- eptr pointer to current character in subject
- ecode pointer to current position in compiled code
- mstart pointer to the current match start position (can be modified
- by encountering \K)
- offset_top current top pointer (highest ovector offset used + 1)
- mb pointer to "static" info block for the match
- eptrb pointer to chain of blocks containing eptr at start of
- brackets - for testing for empty matches
- rdepth the recursion depth
-
-Returns: MATCH_MATCH if matched ) these values are >= 0
- MATCH_NOMATCH if failed to match )
- a negative MATCH_xxx value for PRUNE, SKIP, etc
- a negative PCRE2_ERROR_xxx value if aborted by an error condition
- (e.g. stopped by repeated call or recursion limit)
+ start_eptr starting character in subject
+ start_ecode starting position in compiled code
+ ovector pointer to the final output vector
+ oveccount number of pairs in ovector
+ top_bracket number of capturing parentheses in the pattern
+ frame_size size of each backtracking frame
+ mb pointer to "static" variables block
+
+Returns: MATCH_MATCH if matched ) these values are >= 0
+ MATCH_NOMATCH if failed to match )
+ negative MATCH_xxx value for PRUNE, SKIP, etc
+ negative PCRE2_ERROR_xxx value if aborted by an error condition
+ (e.g. stopped by repeated call or depth limit)
*/
static int
-match(PCRE2_SPTR eptr, PCRE2_SPTR ecode, PCRE2_SPTR mstart,
- PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb, uint32_t rdepth)
+match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, PCRE2_SIZE *ovector,
+ uint16_t oveccount, uint16_t top_bracket, PCRE2_SIZE frame_size,
+ match_block *mb)
{
-/* These variables do not need to be preserved over recursion in this function,
-so they can be ordinary variables in all cases. Mark some of them with
-"register" because they are used a lot in loops. */
-
-int rrc; /* Returns from recursive calls */
-int i; /* Used for loops not involving calls to RMATCH() */
-uint32_t c; /* Character values not kept over RMATCH() calls */
-BOOL utf; /* Local copy of UTF flag for speed */
-
-BOOL minimize, possessive; /* Quantifier options */
-int condcode;
+/* Frame-handling variables */
-/* When recursion is not being used, all "local" variables that have to be
-preserved over calls to RMATCH() are part of a "frame". We set up the top-level
-frame on the stack here; subsequent instantiations are obtained from the heap
-whenever RMATCH() does a "recursion". See the macro definitions above. Putting
-the top-level on the stack rather than malloc-ing them all gives a performance
-boost in many cases where there is not much "recursion". */
+heapframe *F; /* Current frame pointer */
+heapframe *N = NULL; /* Temporary frame pointers */
+heapframe *P = NULL;
+heapframe *assert_accept_frame; /* For passing back the frame with captures */
+PCRE2_SIZE frame_copy_size; /* Amount to copy when creating a new frame */
-#ifdef HEAP_MATCH_RECURSE
-heapframe *frame = (heapframe *)mb->match_frames_base;
+/* Local variables that do not need to be preserved over calls to RRMATCH(). */
-/* Copy in the original argument variables */
+PCRE2_SPTR bracode; /* Temp pointer to start of group */
+PCRE2_SIZE offset; /* Used for group offsets */
+PCRE2_SIZE length; /* Used for various length calculations */
-frame->Xeptr = eptr;
-frame->Xecode = ecode;
-frame->Xmstart = mstart;
-frame->Xoffset_top = offset_top;
-frame->Xeptrb = eptrb;
-frame->Xrdepth = rdepth;
-
-/* This is where control jumps back to to effect "recursion" */
-
-HEAP_RECURSE:
+int rrc; /* Return from functions & backtracking "recursions" */
+#ifdef SUPPORT_UNICODE
+int proptype; /* Type of character property */
+#endif
-/* Macros make the argument variables come from the current frame */
+uint32_t i; /* Used for local loops */
+uint32_t fc; /* Character values */
+uint32_t number; /* Used for group and other numbers */
+uint32_t reptype = 0; /* Type of repetition (0 to avoid compiler warning) */
+uint32_t group_frame_type; /* Specifies type for new group frames */
-#define eptr frame->Xeptr
-#define ecode frame->Xecode
-#define mstart frame->Xmstart
-#define offset_top frame->Xoffset_top
-#define eptrb frame->Xeptrb
-#define rdepth frame->Xrdepth
+BOOL condition; /* Used in conditional groups */
+BOOL cur_is_word; /* Used in "word" tests */
+BOOL prev_is_word; /* Used in "word" tests */
-/* Ditto for the local variables */
+/* UTF flag */
#ifdef SUPPORT_UNICODE
-#define charptr frame->Xcharptr
-#define prop_value frame->Xprop_value
-#define prop_type frame->Xprop_type
-#define prop_fail_result frame->Xprop_fail_result
-#define oclength frame->Xoclength
-#define occhars frame->Xocchars
+BOOL utf = (mb->poptions & PCRE2_UTF) != 0;
+#else
+BOOL utf = FALSE;
#endif
+/* This is the length of the last part of a backtracking frame that must be
+copied when a new frame is created. */
-#define callpat frame->Xcallpat
-#define codelink frame->Xcodelink
-#define data frame->Xdata
-#define next_ecode frame->Xnext_ecode
-#define pp frame->Xpp
-#define prev frame->Xprev
-#define saved_eptr frame->Xsaved_eptr
-
-#define new_recursive frame->Xnew_recursive
-
-#define ctype frame->Xctype
-#define fc frame->Xfc
-#define fi frame->Xfi
-#define length frame->Xlength
-#define max frame->Xmax
-#define min frame->Xmin
-#define number frame->Xnumber
-#define offset frame->Xoffset
-#define op frame->Xop
-#define save_capture_last frame->Xsave_capture_last
-#define save_offset1 frame->Xsave_offset1
-#define save_offset2 frame->Xsave_offset2
-#define save_offset3 frame->Xsave_offset3
-
-#define condition frame->Xcondition
-#define cur_is_word frame->Xcur_is_word
-#define prev_is_word frame->Xprev_is_word
-
-#define newptrb frame->Xnewptrb
-
-/* When normal stack-based recursion is being used for match(), local variables
-are allocated on the stack and get preserved during recursion in the usual way.
-In this environment, fi and i, and fc and c, can be the same variables. */
-
-#else /* HEAP_MATCH_RECURSE not defined */
-#define fi i
-#define fc c
-
-/* Many of the following variables are used only in small blocks of the code.
-My normal style of coding would have declared them within each of those blocks.
-However, in order to accommodate the version of this code that uses an external
-"stack" implemented on the heap, it is easier to declare them all here, so the
-declarations can be cut out in a block. The only declarations within blocks
-below are for variables that do not have to be preserved over a recursive call
-to RMATCH(). */
+frame_copy_size = frame_size - offsetof(heapframe, eptr);
-#ifdef SUPPORT_UNICODE
-PCRE2_SPTR charptr;
-#endif
-PCRE2_SPTR callpat;
-PCRE2_SPTR data;
-PCRE2_SPTR next_ecode;
-PCRE2_SPTR pp;
-PCRE2_SPTR prev;
-PCRE2_SPTR saved_eptr;
+/* Set up the first current frame at the start of the vector, and initialize
+fields that are not reset for new frames. */
-PCRE2_SIZE length;
-PCRE2_SIZE offset;
-PCRE2_SIZE save_offset1, save_offset2, save_offset3;
+F = mb->match_frames;
+Frdepth = 0; /* "Recursion" depth */
+Fcapture_last = 0; /* Number of most recent capture */
+Fcurrent_recurse = RECURSE_UNSET; /* Not pattern recursing. */
+Fstart_match = Feptr = start_eptr; /* Current data pointer and start match */
+Fmark = NULL; /* Most recent mark */
+Foffset_top = 0; /* End of captures within the frame */
+Flast_group_offset = PCRE2_UNSET; /* Saved frame of most recent group */
+group_frame_type = 0; /* Not a start of group frame */
+goto NEW_FRAME; /* Start processing with this frame */
-uint32_t number;
-uint32_t op;
-uint32_t save_capture_last;
-
-#ifdef SUPPORT_UNICODE
-uint32_t prop_value;
-int prop_type;
-int prop_fail_result;
-int oclength;
-PCRE2_UCHAR occhars[6];
-#endif
+/* Come back here when we want to create a new frame for remembering a
+backtracking point. */
-int codelink;
-int ctype;
-int max;
-int min;
+MATCH_RECURSE:
-BOOL condition;
-BOOL cur_is_word;
-BOOL prev_is_word;
+/* Set up a new backtracking frame. If the vector is full, get a new one
+on the heap, doubling the size, but constrained by the heap limit. */
-eptrblock newptrb;
-recursion_info new_recursive;
-#endif /* HEAP_MATCH_RECURSE not defined */
+N = (heapframe *)((char *)F + frame_size);
+if (N >= mb->match_frames_top)
+ {
+ PCRE2_SIZE newsize = mb->frame_vector_size * 2;
+ heapframe *new;
-/* To save space on the stack and in the heap frame, I have doubled up on some
-of the local variables that are used only in localised parts of the code, but
-still need to be preserved over recursive calls of match(). These macros define
-the alternative names that are used. */
+ if ((newsize / 1024) > mb->heap_limit)
+ {
+ PCRE2_SIZE maxsize = ((mb->heap_limit * 1024)/frame_size) * frame_size;
+ if (mb->frame_vector_size >= maxsize) return PCRE2_ERROR_HEAPLIMIT;
+ newsize = maxsize;
+ }
-#define allow_zero cur_is_word
-#define caseless cur_is_word
-#define cbegroup condition
-#define code_offset codelink
-#define condassert condition
-#define foc number
-#define matched_once prev_is_word
-#define save_mark data
+ new = mb->memctl.malloc(newsize, mb->memctl.memory_data);
+ if (new == NULL) return PCRE2_ERROR_NOMEMORY;
+ memcpy(new, mb->match_frames, mb->frame_vector_size);
-/* These statements are here to stop the compiler complaining about unitialized
-variables. */
+ F = (heapframe *)((char *)new + ((char *)F - (char *)mb->match_frames));
+ N = (heapframe *)((char *)F + frame_size);
-#ifdef SUPPORT_UNICODE
-prop_value = 0;
-prop_fail_result = 0;
-#endif
+ if (mb->match_frames != mb->stack_frames)
+ mb->memctl.free(mb->match_frames, mb->memctl.memory_data);
+ mb->match_frames = new;
+ mb->match_frames_top = (heapframe *)((char *)mb->match_frames + newsize);
+ mb->frame_vector_size = newsize;
+ }
+#ifdef DEBUG_SHOW_RMATCH
+fprintf(stderr, "++ RMATCH %2d frame=%d", Freturn_id, Frdepth + 1);
+if (group_frame_type != 0)
+ {
+ fprintf(stderr, " type=%x ", group_frame_type);
+ switch (GF_IDMASK(group_frame_type))
+ {
+ case GF_CAPTURE:
+ fprintf(stderr, "capture=%d", GF_DATAMASK(group_frame_type));
+ break;
-/* This label is used for tail recursion, which is used in a few cases even
-when HEAP_MATCH_RECURSE is not defined, in order to reduce the amount of stack
-that is used. Thanks to Ian Taylor for noticing this possibility and sending
-the original patch. */
+ case GF_NOCAPTURE:
+ fprintf(stderr, "nocapture op=%d", GF_DATAMASK(group_frame_type));
+ break;
-TAIL_RECURSE:
+ case GF_CONDASSERT:
+ fprintf(stderr, "condassert op=%d", GF_DATAMASK(group_frame_type));
+ break;
-/* OK, now we can get on with the real code of the function. Recursive calls
-are specified by the macro RMATCH and RRETURN is used to return. When
-HEAP_MATCH_RECURSE is *not* defined, these just turn into a recursive call to
-match() and a "return", respectively. However, RMATCH isn't like a function
-call because it's quite a complicated macro. It has to be used in one
-particular way. This shouldn't, however, impact performance when true recursion
-is being used. */
+ case GF_RECURSE:
+ fprintf(stderr, "recurse=%d", GF_DATAMASK(group_frame_type));
+ break;
-#ifdef SUPPORT_UNICODE
-utf = (mb->poptions & PCRE2_UTF) != 0;
-#else
-utf = FALSE;
+ default:
+ fprintf(stderr, "*** unknown ***");
+ break;
+ }
+ }
+fprintf(stderr, "\n");
#endif
-/* First check that we haven't called match() too many times, or that we
-haven't exceeded the recursive call limit. */
+/* Copy those fields that must be copied into the new frame, increase the
+"recursion" depth (i.e. the new frame's index) and then make the new frame
+current. */
+
+memcpy((char *)N + offsetof(heapframe, eptr),
+ (char *)F + offsetof(heapframe, eptr),
+ frame_copy_size);
+
+N->rdepth = Frdepth + 1;
+F = N;
-if (mb->match_call_count++ >= mb->match_limit) RRETURN(PCRE2_ERROR_MATCHLIMIT);
-if (rdepth >= mb->match_limit_recursion) RRETURN(PCRE2_ERROR_RECURSIONLIMIT);
+/* Carry on processing with a new frame. */
-/* At the start of a group with an unlimited repeat that may match an empty
-string, the variable mb->match_function_type contains the MATCH_CBEGROUP bit.
-It is done this way to save having to use another function argument, which
-would take up space on the stack. See also MATCH_CONDASSERT below.
+NEW_FRAME:
+Fgroup_frame_type = group_frame_type;
+Fecode = start_ecode; /* Starting code pointer */
+Fback_frame = frame_size; /* Default is go back one frame */
-When MATCH_CBEGROUP is set, add the current subject pointer to the chain of
-such remembered pointers, to be checked when we hit the closing ket, in order
-to break infinite loops that match no characters. When match() is called in
-other circumstances, don't add to the chain. The MATCH_CBEGROUP feature must
-NOT be used with tail recursion, because the memory block that is used is on
-the stack, so a new one may be required for each match(). */
+/* If this is a special type of group frame, remember its offset for quick
+access at the end of the group. If this is a recursion, set a new current
+recursion value. */
-if ((mb->match_function_type & MATCH_CBEGROUP) != 0)
+if (group_frame_type != 0)
{
- newptrb.epb_saved_eptr = eptr;
- newptrb.epb_prev = eptrb;
- eptrb = &newptrb;
- mb->match_function_type &= ~MATCH_CBEGROUP;
+ Flast_group_offset = (char *)F - (char *)mb->match_frames;
+ if (GF_IDMASK(group_frame_type) == GF_RECURSE)
+ Fcurrent_recurse = GF_DATAMASK(group_frame_type);
+ group_frame_type = 0;
}
-/* Now, at last, we can start processing the opcodes. */
+
+/* ========================================================================= */
+/* This is the main processing loop. First check that we haven't recorded too
+many backtracks (search tree is too large), or that we haven't exceeded the
+recursive depth limit (used too many backtracking frames). If not, process the
+opcodes. */
+
+if (mb->match_call_count++ >= mb->match_limit) return PCRE2_ERROR_MATCHLIMIT;
+if (Frdepth >= mb->match_limit_depth) return PCRE2_ERROR_DEPTHLIMIT;
for (;;)
{
- minimize = possessive = FALSE;
- op = *ecode;
+#ifdef DEBUG_SHOW_OPS
+fprintf(stderr, "++ op=%d\n", *Fecode);
+#endif
- switch(op)
+ Fop = (uint8_t)(*Fecode); /* Cast needed for 16-bit and 32-bit modes */
+ switch(Fop)
{
- case OP_MARK:
- mb->nomatch_mark = ecode + 2;
- mb->mark = NULL; /* In case previously set by assertion */
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode] + ecode[1], offset_top, mb,
- eptrb, RM55);
- if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
- mb->mark == NULL) mb->mark = ecode + 2;
-
- /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an
- argument, and we must check whether that argument matches this MARK's
- argument. It is passed back in mb->start_match_ptr (an overloading of that
- variable). If it does match, we reset that variable to the current subject
- position and return MATCH_SKIP. Otherwise, pass back the return code
- unaltered. */
+ /* ===================================================================== */
+ /* Before OP_ACCEPT there may be any number of OP_CLOSE opcodes, to close
+ any currently open capturing brackets. Unlike reaching the end of a group,
+ where we know the starting frame is at the top of the chained frames, in
+ this case we have to search back for the relevant frame in case other types
+ of group that use chained frames have intervened. Multiple OP_CLOSEs always
+ come innermost first, which matches the chain order. We can ignore this in
+ a recursion, because captures are not passed out of recursions. */
- else if (rrc == MATCH_SKIP_ARG &&
- PRIV(strcmp)(ecode + 2, mb->start_match_ptr) == 0)
+ case OP_CLOSE:
+ if (Fcurrent_recurse == RECURSE_UNSET)
{
- mb->start_match_ptr = eptr;
- RRETURN(MATCH_SKIP);
+ number = GET2(Fecode, 1);
+ offset = Flast_group_offset;
+ for(;;)
+ {
+ if (offset == PCRE2_UNSET) return PCRE2_ERROR_INTERNAL;
+ N = (heapframe *)((char *)mb->match_frames + offset);
+ P = (heapframe *)((char *)N - frame_size);
+ if (N->group_frame_type == (GF_CAPTURE | number)) break;
+ offset = P->last_group_offset;
+ }
+ offset = (number << 1) - 2;
+ Fcapture_last = number;
+ Fovector[offset] = P->eptr - mb->start_subject;
+ Fovector[offset+1] = Feptr - mb->start_subject;
+ if (offset >= Foffset_top) Foffset_top = offset + 2;
}
- RRETURN(rrc);
-
- case OP_FAIL:
- RRETURN(MATCH_NOMATCH);
-
- case OP_COMMIT:
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM52);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- RRETURN(MATCH_COMMIT);
-
- case OP_PRUNE:
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM51);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- RRETURN(MATCH_PRUNE);
-
- case OP_PRUNE_ARG:
- mb->nomatch_mark = ecode + 2;
- mb->mark = NULL; /* In case previously set by assertion */
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode] + ecode[1], offset_top, mb,
- eptrb, RM56);
- if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
- mb->mark == NULL) mb->mark = ecode + 2;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- RRETURN(MATCH_PRUNE);
+ Fecode += PRIV(OP_lengths)[*Fecode];
+ break;
- case OP_SKIP:
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM53);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->start_match_ptr = eptr; /* Pass back current position */
- RRETURN(MATCH_SKIP);
- /* Note that, for Perl compatibility, SKIP with an argument does NOT set
- nomatch_mark. When a pattern match ends with a SKIP_ARG for which there was
- not a matching mark, we have to re-run the match, ignoring the SKIP_ARG
- that failed and any that precede it (either they also failed, or were not
- triggered). To do this, we maintain a count of executed SKIP_ARGs. If a
- SKIP_ARG gets to top level, the match is re-run with mb->ignore_skip_arg
- set to the count of the one that failed. */
+ /* ===================================================================== */
+ /* Real or forced end of the pattern, assertion, or recursion. In an
+ assertion ACCEPT, update the last used pointer and remember the current
+ frame so that the captures can be fished out of it. */
- case OP_SKIP_ARG:
- mb->skip_arg_count++;
- if (mb->skip_arg_count <= mb->ignore_skip_arg)
- {
- ecode += PRIV(OP_lengths)[*ecode] + ecode[1];
- break;
- }
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode] + ecode[1], offset_top, mb,
- eptrb, RM57);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ case OP_ASSERT_ACCEPT:
+ if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
+ assert_accept_frame = F;
+ RRETURN(MATCH_ACCEPT);
- /* Pass back the current skip name by overloading mb->start_match_ptr and
- returning the special MATCH_SKIP_ARG return code. This will either be
- caught by a matching MARK, or get to the top, where it causes a rematch
- with mb->ignore_skip_arg set to the value of mb->skip_arg_count. */
+ /* If recursing, we have to find the most recent recursion. */
- mb->start_match_ptr = ecode + 2;
- RRETURN(MATCH_SKIP_ARG);
-
- /* For THEN (and THEN_ARG) we pass back the address of the opcode, so that
- the branch in which it occurs can be determined. Overload the start of
- match pointer to do this. */
-
- case OP_THEN:
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM54);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->start_match_ptr = ecode;
- RRETURN(MATCH_THEN);
+ case OP_ACCEPT:
+ case OP_END:
- case OP_THEN_ARG:
- mb->nomatch_mark = ecode + 2;
- mb->mark = NULL; /* In case previously set by assertion */
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode] + ecode[1], offset_top,
- mb, eptrb, RM58);
- if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
- mb->mark == NULL) mb->mark = ecode + 2;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->start_match_ptr = ecode;
- RRETURN(MATCH_THEN);
+ /* Handle end of a recursion. */
- /* Handle an atomic group that does not contain any capturing parentheses.
- This can be handled like an assertion. Prior to 8.13, all atomic groups
- were handled this way. In 8.13, the code was changed as below for ONCE, so
- that backups pass through the group and thereby reset captured values.
- However, this uses a lot more stack, so in 8.20, atomic groups that do not
- contain any captures generate OP_ONCE_NC, which can be handled in the old,
- less stack intensive way.
-
- Check the alternative branches in turn - the matching won't pass the KET
- for this kind of subpattern. If any one branch matches, we carry on as at
- the end of a normal bracket, leaving the subject pointer, but resetting
- the start-of-match value in case it was changed by \K. */
-
- case OP_ONCE_NC:
- prev = ecode;
- saved_eptr = eptr;
- save_mark = mb->mark;
- do
+ if (Fcurrent_recurse != RECURSE_UNSET)
{
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, eptrb, RM64);
- if (rrc == MATCH_MATCH) /* Note: _not_ MATCH_ACCEPT */
+ offset = Flast_group_offset;
+ for(;;)
{
- mstart = mb->start_match_ptr;
- break;
+ if (offset == PCRE2_UNSET) return PCRE2_ERROR_INTERNAL;
+ N = (heapframe *)((char *)mb->match_frames + offset);
+ P = (heapframe *)((char *)N - frame_size);
+ if (GF_IDMASK(N->group_frame_type) == GF_RECURSE) break;
+ offset = P->last_group_offset;
}
- if (rrc == MATCH_THEN)
- {
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
- rrc = MATCH_NOMATCH;
- }
-
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- ecode += GET(ecode,1);
- mb->mark = save_mark;
- }
- while (*ecode == OP_ALT);
-
- /* If hit the end of the group (which could be repeated), fail */
- if (*ecode != OP_ONCE_NC && *ecode != OP_ALT) RRETURN(MATCH_NOMATCH);
+ /* N is now the frame of the recursion; the previous frame is at the
+ OP_RECURSE position. Go back there, copying the current subject position
+ and mark, and move on past the OP_RECURSE. */
- /* Continue as from after the group, updating the offsets high water
- mark, since extracts may have been taken. */
-
- do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
-
- offset_top = mb->end_offset_top;
- eptr = mb->end_match_ptr;
+ P->eptr = Feptr;
+ P->mark = Fmark;
+ F = P;
+ Fecode += 1 + LINK_SIZE;
+ continue;
+ }
- /* For a non-repeating ket, just continue at this level. This also
- happens for a repeating ket if no characters were matched in the group.
- This is the forcible breaking of infinite loops as implemented in Perl
- 5.005. */
+ /* Not a recursion. Fail for an empty string match if either PCRE2_NOTEMPTY
+ is set, or if PCRE2_NOTEMPTY_ATSTART is set and we have matched at the
+ start of the subject. In both cases, backtracking will then try other
+ alternatives, if any. */
- if (*ecode == OP_KET || eptr == saved_eptr)
- {
- ecode += 1+LINK_SIZE;
- break;
- }
+ if (Feptr == Fstart_match &&
+ ((mb->moptions & PCRE2_NOTEMPTY) != 0 ||
+ ((mb->moptions & PCRE2_NOTEMPTY_ATSTART) != 0 &&
+ Fstart_match == mb->start_subject + mb->start_offset)))
+ RRETURN(MATCH_NOMATCH);
- /* The repeating kets try the rest of the pattern or restart from the
- preceding bracket, in the appropriate order. The second "call" of match()
- uses tail recursion, to avoid using another stack frame. */
+ /* Also fail if PCRE2_ENDANCHORED is set and the end of the match is not
+ the end of the subject. After (*ACCEPT) we fail the entire match (at this
+ position) but backtrack on reaching the end of the pattern. */
- if (*ecode == OP_KETRMIN)
- {
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, eptrb, RM65);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- ecode = prev;
- goto TAIL_RECURSE;
- }
- else /* OP_KETRMAX */
+ if (Feptr < mb->end_subject &&
+ ((mb->moptions | mb->poptions) & PCRE2_ENDANCHORED) != 0)
{
- RMATCH(eptr, prev, offset_top, mb, eptrb, RM66);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- ecode += 1 + LINK_SIZE;
- goto TAIL_RECURSE;
+ if (Fop == OP_END) RRETURN(MATCH_NOMATCH);
+ return MATCH_NOMATCH;
}
- /* Control never gets here */
- /* Handle a capturing bracket, other than those that are possessive with an
- unlimited repeat. If there is space in the offset vector, save the current
- subject position in the working slot at the top of the vector. We mustn't
- change the current values of the data slot, because they may be set from a
- previous iteration of this group, and be referred to by a reference inside
- the group. A failure to match might occur after the group has succeeded,
- if something later on doesn't match. For this reason, we need to restore
- the working value and also the values of the final offsets, in case they
- were set by a previous iteration of the same bracket.
-
- If there isn't enough space in the offset vector, treat this as if it were
- a non-capturing bracket. Don't worry about setting the flag for the error
- case here; that is handled in the code for KET. */
+ /* We have a successful match of the whole pattern. Record the result and
+ then do a direct return from the function. If there is space in the offset
+ vector, set any pairs that follow the highest-numbered captured string but
+ are less than the number of capturing groups in the pattern to PCRE2_UNSET.
+ It is documented that this happens. "Gaps" are set to PCRE2_UNSET
+ dynamically. It is only those at the end that need setting here. */
- case OP_CBRA:
- case OP_SCBRA:
- number = GET2(ecode, 1+LINK_SIZE);
- offset = number << 1;
+ mb->end_match_ptr = Feptr; /* Record where we ended */
+ mb->end_offset_top = Foffset_top; /* and how many extracts were taken */
+ mb->mark = Fmark; /* and the last success mark */
+ if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
- if (offset < mb->offset_max)
- {
- save_offset1 = mb->ovector[offset];
- save_offset2 = mb->ovector[offset+1];
- save_offset3 = mb->ovector[mb->offset_end - number];
- save_capture_last = mb->capture_last;
- save_mark = mb->mark;
+ ovector[0] = Fstart_match - mb->start_subject;
+ ovector[1] = Feptr - mb->start_subject;
- mb->ovector[mb->offset_end - number] = eptr - mb->start_subject;
+ /* Set i to the smaller of the sizes of the external and frame ovectors. */
- for (;;)
- {
- if (op >= OP_SBRA) mb->match_function_type |= MATCH_CBEGROUP;
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM1);
- if (rrc == MATCH_ONCE) break; /* Backing up through an atomic group */
-
- /* If we backed up to a THEN, check whether it is within the current
- branch by comparing the address of the THEN that is passed back with
- the end of the branch. If it is within the current branch, and the
- branch is one of two or more alternatives (it either starts or ends
- with OP_ALT), we have reached the limit of THEN's action, so convert
- the return code to NOMATCH, which will cause normal backtracking to
- happen from now on. Otherwise, THEN is passed back to an outer
- alternative. This implements Perl's treatment of parenthesized groups,
- where a group not containing | does not affect the current alternative,
- that is, (X) is NOT the same as (X|(*F)). */
-
- if (rrc == MATCH_THEN)
- {
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
- rrc = MATCH_NOMATCH;
- }
+ i = 2 * ((top_bracket + 1 > oveccount)? oveccount : top_bracket + 1);
+ memcpy(ovector + 2, Fovector, (i - 2) * sizeof(PCRE2_SIZE));
+ while (--i >= Foffset_top + 2) ovector[i] = PCRE2_UNSET;
+ return MATCH_MATCH; /* Note: NOT RRETURN */
- /* Anything other than NOMATCH is passed back. */
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->capture_last = save_capture_last;
- ecode += GET(ecode, 1);
- mb->mark = save_mark;
- if (*ecode != OP_ALT) break;
- }
-
- mb->ovector[offset] = save_offset1;
- mb->ovector[offset+1] = save_offset2;
- mb->ovector[mb->offset_end - number] = save_offset3;
-
- /* At this point, rrc will be one of MATCH_ONCE or MATCH_NOMATCH. */
+ /*===================================================================== */
+ /* Match any single character type except newline; have to take care with
+ CRLF newlines and partial matching. */
- RRETURN(rrc);
+ case OP_ANY:
+ if (IS_NEWLINE(Feptr)) RRETURN(MATCH_NOMATCH);
+ if (mb->partial != 0 &&
+ Feptr == mb->end_subject - 1 &&
+ NLBLOCK->nltype == NLTYPE_FIXED &&
+ NLBLOCK->nllen == 2 &&
+ UCHAR21TEST(Feptr) == NLBLOCK->nl[0])
+ {
+ mb->hitend = TRUE;
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
+ /* Fall through */
- /* FALL THROUGH ... Insufficient room for saving captured contents. Treat
- as a non-capturing bracket. */
+ /* Match any single character whatsoever. */
- /* VVVVVVVVVVVVVVVVVVVVVVVVV */
- /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+ case OP_ALLANY:
+ if (Feptr >= mb->end_subject) /* DO NOT merge the Feptr++ here; it must */
+ { /* not be updated before SCHECK_PARTIAL. */
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ Feptr++;
+#ifdef SUPPORT_UNICODE
+ if (utf) ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
+#endif
+ Fecode++;
+ break;
- /* Non-capturing or atomic group, except for possessive with unlimited
- repeat and ONCE group with no captures. Loop for all the alternatives.
- When we get to the final alternative within the brackets, we used to return
- the result of a recursive call to match() whatever happened so it was
- possible to reduce stack usage by turning this into a tail recursion,
- except in the case of a possibly empty group. However, now that there is
- the possiblity of (*THEN) occurring in the final alternative, this
- optimization is no longer always possible.
+ /* ===================================================================== */
+ /* Match a single code unit, even in UTF mode. This opcode really does
+ match any code unit, even newline. (It really should be called ANYCODEUNIT,
+ of course - the byte name is from pre-16 bit days.) */
- We can optimize if we know there are no (*THEN)s in the pattern; at present
- this is the best that can be done.
+ case OP_ANYBYTE:
+ if (Feptr >= mb->end_subject) /* DO NOT merge the Feptr++ here; it must */
+ { /* not be updated before SCHECK_PARTIAL. */
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ Feptr++;
+ Fecode++;
+ break;
- MATCH_ONCE is returned when the end of an atomic group is successfully
- reached, but subsequent matching fails. It passes back up the tree (causing
- captured values to be reset) until the original atomic group level is
- reached. This is tested by comparing mb->once_target with the start of the
- group. At this point, the return is converted into MATCH_NOMATCH so that
- previous backup points can be taken. */
- case OP_ONCE:
- case OP_BRA:
- case OP_SBRA:
+ /* ===================================================================== */
+ /* Match a single character, casefully */
- for (;;)
+ case OP_CHAR:
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- if (op >= OP_SBRA || op == OP_ONCE)
- mb->match_function_type |= MATCH_CBEGROUP;
-
- /* If this is not a possibly empty group, and there are no (*THEN)s in
- the pattern, and this is the final alternative, optimize as described
- above. */
-
- else if (!mb->hasthen && ecode[GET(ecode, 1)] != OP_ALT)
+ Flength = 1;
+ Fecode++;
+ GETCHARLEN(fc, Fecode, Flength);
+ if (Flength > (PCRE2_SIZE)(mb->end_subject - Feptr))
{
- ecode += PRIV(OP_lengths)[*ecode];
- goto TAIL_RECURSE;
- }
-
- /* In all other cases, we have to make another call to match(). */
-
- save_mark = mb->mark;
- save_capture_last = mb->capture_last;
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb, eptrb,
- RM2);
-
- /* See comment in the code for capturing groups above about handling
- THEN. */
-
- if (rrc == MATCH_THEN)
- {
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
- rrc = MATCH_NOMATCH;
+ CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */
+ RRETURN(MATCH_NOMATCH);
}
-
- if (rrc != MATCH_NOMATCH)
+ for (; Flength > 0; Flength--)
{
- if (rrc == MATCH_ONCE)
- {
- PCRE2_SPTR scode = ecode;
- if (*scode != OP_ONCE) /* If not at start, find it */
- {
- while (*scode == OP_ALT) scode += GET(scode, 1);
- scode -= GET(scode, 1);
- }
- if (mb->once_target == scode) rrc = MATCH_NOMATCH;
- }
- RRETURN(rrc);
+ if (*Fecode++ != UCHAR21INC(Feptr)) RRETURN(MATCH_NOMATCH);
}
- ecode += GET(ecode, 1);
- mb->mark = save_mark;
- if (*ecode != OP_ALT) break;
- mb->capture_last = save_capture_last;
}
-
- RRETURN(MATCH_NOMATCH);
-
- /* Handle possessive capturing brackets with an unlimited repeat. We come
- here from BRAZERO with allow_zero set TRUE. The ovector values are
- handled similarly to the normal case above. However, the matching is
- different. The end of these brackets will always be OP_KETRPOS, which
- returns MATCH_KETRPOS without going further in the pattern. By this means
- we can handle the group by iteration rather than recursion, thereby
- reducing the amount of stack needed. If the ovector is too small for
- capturing, treat as non-capturing. */
-
- case OP_CBRAPOS:
- case OP_SCBRAPOS:
- allow_zero = FALSE;
-
- POSSESSIVE_CAPTURE:
- number = GET2(ecode, 1+LINK_SIZE);
- offset = number << 1;
- if (offset >= mb->offset_max) goto POSSESSIVE_NON_CAPTURE;
-
- matched_once = FALSE;
- code_offset = (int)(ecode - mb->start_code);
-
- save_offset1 = mb->ovector[offset];
- save_offset2 = mb->ovector[offset+1];
- save_offset3 = mb->ovector[mb->offset_end - number];
- save_capture_last = mb->capture_last;
-
- /* Each time round the loop, save the current subject position for use
- when the group matches. For MATCH_MATCH, the group has matched, so we
- restart it with a new subject starting position, remembering that we had
- at least one match. For MATCH_NOMATCH, carry on with the alternatives, as
- usual. If we haven't matched any alternatives in any iteration, check to
- see if a previous iteration matched. If so, the group has matched;
- continue from afterwards. Otherwise it has failed; restore the previous
- capture values before returning NOMATCH. */
-
- for (;;)
+ else
+#endif
+ /* Not UTF mode */
{
- mb->ovector[mb->offset_end - number] = eptr - mb->start_subject;
- if (op >= OP_SBRA) mb->match_function_type |= MATCH_CBEGROUP;
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM63);
- if (rrc == MATCH_KETRPOS)
+ if (mb->end_subject - Feptr < 1)
{
- offset_top = mb->end_offset_top;
- ecode = mb->start_code + code_offset;
- save_capture_last = mb->capture_last;
- matched_once = TRUE;
- mstart = mb->start_match_ptr; /* In case \K changed it */
- if (eptr == mb->end_match_ptr) /* Matched an empty string */
- {
- do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
- break;
- }
- eptr = mb->end_match_ptr;
- continue;
+ SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */
+ RRETURN(MATCH_NOMATCH);
}
+ if (Fecode[1] != *Feptr++) RRETURN(MATCH_NOMATCH);
+ Fecode += 2;
+ }
+ break;
- /* See comment in the code for capturing groups above about handling
- THEN. */
-
- if (rrc == MATCH_THEN)
- {
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
- rrc = MATCH_NOMATCH;
- }
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->capture_last = save_capture_last;
- ecode += GET(ecode, 1);
- if (*ecode != OP_ALT) break;
- }
+ /* ===================================================================== */
+ /* Match a single character, caselessly. If we are at the end of the
+ subject, give up immediately. We get here only when the pattern character
+ has at most one other case. Characters with more than two cases are coded
+ as OP_PROP with the pseudo-property PT_CLIST. */
- if (!matched_once)
+ case OP_CHARI:
+ if (Feptr >= mb->end_subject)
{
- mb->ovector[offset] = save_offset1;
- mb->ovector[offset+1] = save_offset2;
- mb->ovector[mb->offset_end - number] = save_offset3;
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
- if (allow_zero || matched_once)
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- ecode += 1 + LINK_SIZE;
- break;
- }
- RRETURN(MATCH_NOMATCH);
-
- /* Non-capturing possessive bracket with unlimited repeat. We come here
- from BRAZERO with allow_zero = TRUE. The code is similar to the above,
- without the capturing complication. It is written out separately for speed
- and cleanliness. */
-
- case OP_BRAPOS:
- case OP_SBRAPOS:
- allow_zero = FALSE;
+ Flength = 1;
+ Fecode++;
+ GETCHARLEN(fc, Fecode, Flength);
- POSSESSIVE_NON_CAPTURE:
- matched_once = FALSE;
- code_offset = (int)(ecode - mb->start_code);
- save_capture_last = mb->capture_last;
+ /* If the pattern character's value is < 128, we know that its other case
+ (if any) is also < 128 (and therefore only one code unit long in all
+ code-unit widths), so we can use the fast lookup table. We checked above
+ that there is at least one character left in the subject. */
- for (;;)
- {
- if (op >= OP_SBRA) mb->match_function_type |= MATCH_CBEGROUP;
- RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode], offset_top, mb,
- eptrb, RM48);
- if (rrc == MATCH_KETRPOS)
+ if (fc < 128)
{
- offset_top = mb->end_offset_top;
- ecode = mb->start_code + code_offset;
- matched_once = TRUE;
- mstart = mb->start_match_ptr; /* In case \K reset it */
- if (eptr == mb->end_match_ptr) /* Matched an empty string */
- {
- do ecode += GET(ecode, 1); while (*ecode == OP_ALT);
- break;
- }
- eptr = mb->end_match_ptr;
- continue;
+ uint32_t cc = UCHAR21(Feptr);
+ if (mb->lcc[fc] != TABLE_GET(cc, mb->lcc, cc)) RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ Feptr++;
}
- /* See comment in the code for capturing groups above about handling
- THEN. */
+ /* Otherwise we must pick up the subject character and use Unicode
+ property support to test its other case. Note that we cannot use the
+ value of "Flength" to check for sufficient bytes left, because the other
+ case of the character may have more or fewer code units. */
- if (rrc == MATCH_THEN)
+ else
{
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
- rrc = MATCH_NOMATCH;
+ uint32_t dc;
+ GETCHARINC(dc, Feptr);
+ Fecode += Flength;
+ if (dc != fc && dc != UCD_OTHERCASE(fc)) RRETURN(MATCH_NOMATCH);
}
-
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- ecode += GET(ecode, 1);
- if (*ecode != OP_ALT) break;
- mb->capture_last = save_capture_last;
}
+ else
+#endif /* SUPPORT_UNICODE */
- if (matched_once || allow_zero)
+ /* Not UTF mode; use the table for characters < 256. */
{
- ecode += 1 + LINK_SIZE;
- break;
+ if (TABLE_GET(Fecode[1], mb->lcc, Fecode[1])
+ != TABLE_GET(*Feptr, mb->lcc, *Feptr)) RRETURN(MATCH_NOMATCH);
+ Feptr++;
+ Fecode += 2;
}
- RRETURN(MATCH_NOMATCH);
-
- /* Control never reaches here. */
-
- /* Conditional group: compilation checked that there are no more than two
- branches. If the condition is false, skipping the first branch takes us
- past the end of the item if there is only one branch, but that's exactly
- what we want. */
-
- case OP_COND:
- case OP_SCOND:
-
- /* The variable codelink will be added to ecode when the condition is
- false, to get to the second branch. Setting it to the offset to the ALT
- or KET, then incrementing ecode achieves this effect. We now have ecode
- pointing to the condition or callout. */
+ break;
- codelink = GET(ecode, 1); /* Offset to the second branch */
- ecode += 1 + LINK_SIZE; /* From this opcode */
- /* Because of the way auto-callout works during compile, a callout item is
- inserted between OP_COND and an assertion condition. */
+ /* ===================================================================== */
+ /* Match not a single character. */
- if (*ecode == OP_CALLOUT || *ecode == OP_CALLOUT_STR)
+ case OP_NOT:
+ case OP_NOTI:
+ if (Feptr >= mb->end_subject)
{
- unsigned int callout_length = (*ecode == OP_CALLOUT)
- ? PRIV(OP_lengths)[OP_CALLOUT] : GET(ecode, 1 + 2*LINK_SIZE);
-
- if (mb->callout != NULL)
- {
- pcre2_callout_block cb;
- cb.version = 1;
- cb.capture_top = (uint32_t)offset_top/2;
- cb.capture_last = mb->capture_last & CAPLMASK;
- cb.offset_vector = mb->ovector;
- cb.mark = mb->nomatch_mark;
- cb.subject = mb->start_subject;
- cb.subject_length = (PCRE2_SIZE)(mb->end_subject - mb->start_subject);
- cb.start_match = (PCRE2_SIZE)(mstart - mb->start_subject);
- cb.current_position = (PCRE2_SIZE)(eptr - mb->start_subject);
- cb.pattern_position = GET(ecode, 1);
- cb.next_item_length = GET(ecode, 1 + LINK_SIZE);
-
- if (*ecode == OP_CALLOUT)
- {
- cb.callout_number = ecode[1 + 2*LINK_SIZE];
- cb.callout_string_offset = 0;
- cb.callout_string = NULL;
- cb.callout_string_length = 0;
- }
- else
- {
- cb.callout_number = 0;
- cb.callout_string_offset = GET(ecode, 1 + 3*LINK_SIZE);
- cb.callout_string = ecode + (1 + 4*LINK_SIZE) + 1;
- cb.callout_string_length =
- callout_length - (1 + 4*LINK_SIZE) - 2;
- }
-
- if ((rrc = mb->callout(&cb, mb->callout_data)) > 0)
- RRETURN(MATCH_NOMATCH);
- if (rrc < 0) RRETURN(rrc);
- }
-
- /* Advance ecode past the callout, so it now points to the condition. We
- must adjust codelink so that the value of ecode+codelink is unchanged. */
-
- ecode += callout_length;
- codelink -= callout_length;
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
-
- /* Test the various possible conditions */
-
- condition = FALSE;
- switch(condcode = *ecode)
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- case OP_RREF: /* Numbered group recursion test */
- if (mb->recursive != NULL) /* Not recursing => FALSE */
- {
- uint32_t recno = GET2(ecode, 1); /* Recursion group number*/
- condition = (recno == RREF_ANY || recno == mb->recursive->group_num);
- }
- break;
-
- case OP_DNRREF: /* Duplicate named group recursion test */
- if (mb->recursive != NULL)
- {
- int count = GET2(ecode, 1 + IMM2_SIZE);
- PCRE2_SPTR slot = mb->name_table + GET2(ecode, 1) * mb->name_entry_size;
- while (count-- > 0)
- {
- uint32_t recno = GET2(slot, 0);
- condition = recno == mb->recursive->group_num;
- if (condition) break;
- slot += mb->name_entry_size;
- }
- }
- break;
-
- case OP_CREF: /* Numbered group used test */
- offset = GET2(ecode, 1) << 1; /* Doubled ref number */
- condition = offset < offset_top &&
- mb->ovector[offset] != PCRE2_UNSET;
- break;
-
- case OP_DNCREF: /* Duplicate named group used test */
- {
- int count = GET2(ecode, 1 + IMM2_SIZE);
- PCRE2_SPTR slot = mb->name_table + GET2(ecode, 1) * mb->name_entry_size;
- while (count-- > 0)
- {
- offset = GET2(slot, 0) << 1;
- condition = offset < offset_top &&
- mb->ovector[offset] != PCRE2_UNSET;
- if (condition) break;
- slot += mb->name_entry_size;
- }
- }
- break;
-
- case OP_FALSE:
- case OP_FAIL: /* The assertion (?!) becomes OP_FAIL */
- break;
-
- case OP_TRUE:
- condition = TRUE;
- break;
-
- /* The condition is an assertion. Call match() to evaluate it - setting
- the MATCH_CONDASSERT bit in mb->match_function_type causes it to stop at
- the end of an assertion. */
-
- default:
- mb->match_function_type |= MATCH_CONDASSERT;
- RMATCH(eptr, ecode, offset_top, mb, NULL, RM3);
- if (rrc == MATCH_MATCH)
- {
- if (mb->end_offset_top > offset_top)
- offset_top = mb->end_offset_top; /* Captures may have happened */
- condition = TRUE;
-
- /* Advance ecode past the assertion to the start of the first branch,
- but adjust it so that the general choosing code below works. If the
- assertion has a quantifier that allows zero repeats we must skip over
- the BRAZERO. This is a lunatic thing to do, but somebody did! */
-
- if (*ecode == OP_BRAZERO) ecode++;
- ecode += GET(ecode, 1);
- while (*ecode == OP_ALT) ecode += GET(ecode, 1);
- ecode += 1 + LINK_SIZE - PRIV(OP_lengths)[condcode];
- }
-
- /* PCRE doesn't allow the effect of (*THEN) to escape beyond an
- assertion; it is therefore treated as NOMATCH. Any other return is an
- error. */
-
- else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
+ uint32_t ch;
+ Fecode++;
+ GETCHARINC(ch, Fecode);
+ GETCHARINC(fc, Feptr);
+ if (ch == fc)
{
- RRETURN(rrc); /* Need braces because of following else */
+ RRETURN(MATCH_NOMATCH); /* Caseful match */
}
- break;
- }
-
- /* Choose branch according to the condition */
-
- ecode += condition? PRIV(OP_lengths)[condcode] : codelink;
-
- /* We are now at the branch that is to be obeyed. As there is only one, we
- can use tail recursion to avoid using another stack frame, except when
- there is unlimited repeat of a possibly empty group. In the latter case, a
- recursive call to match() is always required, unless the second alternative
- doesn't exist, in which case we can just plough on. Note that, for
- compatibility with Perl, the | in a conditional group is NOT treated as
- creating two alternatives. If a THEN is encountered in the branch, it
- propagates out to the enclosing alternative (unless nested in a deeper set
- of alternatives, of course). */
-
- if (condition || ecode[-(1+LINK_SIZE)] == OP_ALT)
- {
- if (op != OP_SCOND)
+ else if (Fop == OP_NOTI) /* If caseless */
{
- goto TAIL_RECURSE;
+ if (ch > 127)
+ ch = UCD_OTHERCASE(ch);
+ else
+ ch = TABLE_GET(ch, mb->fcc, ch);
+ if (ch == fc) RRETURN(MATCH_NOMATCH);
}
-
- mb->match_function_type |= MATCH_CBEGROUP;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM49);
- RRETURN(rrc);
}
-
- /* Condition false & no alternative; continue after the group. */
-
else
+#endif /* SUPPORT_UNICODE */
{
+ uint32_t ch = Fecode[1];
+ fc = *Feptr++;
+ if (ch == fc || (Fop == OP_NOTI && TABLE_GET(ch, mb->fcc, ch) == fc))
+ RRETURN(MATCH_NOMATCH);
+ Fecode += 2;
}
break;
- /* Before OP_ACCEPT there may be any number of OP_CLOSE opcodes,
- to close any currently open capturing brackets. */
-
- case OP_CLOSE:
- number = GET2(ecode, 1); /* Must be less than 65536 */
- offset = number << 1;
- mb->capture_last = (mb->capture_last & OVFLMASK) | number;
- if (offset >= mb->offset_max) mb->capture_last |= OVFLBIT; else
- {
- mb->ovector[offset] =
- mb->ovector[mb->offset_end - number];
- mb->ovector[offset+1] = eptr - mb->start_subject;
-
- /* If this group is at or above the current highwater mark, ensure that
- any groups between the current high water mark and this group are marked
- unset and then update the high water mark. */
-
- if (offset >= offset_top)
- {
- PCRE2_SIZE *iptr = mb->ovector + offset_top;
- PCRE2_SIZE *iend = mb->ovector + offset;
- while (iptr < iend) *iptr++ = PCRE2_UNSET;
- offset_top = offset + 2;
- }
- }
- ecode += 1 + IMM2_SIZE;
- break;
-
+ /* ===================================================================== */
+ /* Match a single character repeatedly. */
- /* End of the pattern, either real or forced. In an assertion ACCEPT,
- update the last used pointer. */
+#define Loclength F->temp_size
+#define Lstart_eptr F->temp_sptr[0]
+#define Lcharptr F->temp_sptr[1]
+#define Lmin F->temp_32[0]
+#define Lmax F->temp_32[1]
+#define Lc F->temp_32[2]
+#define Loc F->temp_32[3]
- case OP_ASSERT_ACCEPT:
- if (eptr > mb->last_used_ptr) mb->last_used_ptr = eptr;
+ case OP_EXACT:
+ case OP_EXACTI:
+ Lmin = Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATCHAR;
- case OP_ACCEPT:
- case OP_END:
+ case OP_POSUPTO:
+ case OP_POSUPTOI:
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATCHAR;
- /* If we have matched an empty string, fail if not in an assertion and not
- in a recursion if either PCRE2_NOTEMPTY is set, or if PCRE2_NOTEMPTY_ATSTART
- is set and we have matched at the start of the subject. In both cases,
- backtracking will then try other alternatives, if any. */
+ case OP_UPTO:
+ case OP_UPTOI:
+ reptype = REPTYPE_MAX;
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATCHAR;
- if (eptr == mstart && op != OP_ASSERT_ACCEPT &&
- mb->recursive == NULL &&
- ((mb->moptions & PCRE2_NOTEMPTY) != 0 ||
- ((mb->moptions & PCRE2_NOTEMPTY_ATSTART) != 0 &&
- mstart == mb->start_subject + mb->start_offset)))
- RRETURN(MATCH_NOMATCH);
+ case OP_MINUPTO:
+ case OP_MINUPTOI:
+ reptype = REPTYPE_MIN;
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATCHAR;
- /* Otherwise, we have a match. */
+ case OP_POSSTAR:
+ case OP_POSSTARI:
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = UINT32_MAX;
+ Fecode++;
+ goto REPEATCHAR;
- mb->end_match_ptr = eptr; /* Record where we ended */
- mb->end_offset_top = offset_top; /* and how many extracts were taken */
- mb->start_match_ptr = mstart; /* and the start (\K can modify) */
+ case OP_POSPLUS:
+ case OP_POSPLUSI:
+ reptype = REPTYPE_POS;
+ Lmin = 1;
+ Lmax = UINT32_MAX;
+ Fecode++;
+ goto REPEATCHAR;
- /* For some reason, the macros don't work properly if an expression is
- given as the argument to RRETURN when the heap is in use. */
+ case OP_POSQUERY:
+ case OP_POSQUERYI:
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = 1;
+ Fecode++;
+ goto REPEATCHAR;
- rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT;
- RRETURN(rrc);
+ case OP_STAR:
+ case OP_STARI:
+ case OP_MINSTAR:
+ case OP_MINSTARI:
+ case OP_PLUS:
+ case OP_PLUSI:
+ case OP_MINPLUS:
+ case OP_MINPLUSI:
+ case OP_QUERY:
+ case OP_QUERYI:
+ case OP_MINQUERY:
+ case OP_MINQUERYI:
+ fc = *Fecode++ - ((Fop < OP_STARI)? OP_STAR : OP_STARI);
+ Lmin = rep_min[fc];
+ Lmax = rep_max[fc];
+ reptype = rep_typ[fc];
- /* Assertion brackets. Check the alternative branches in turn - the
- matching won't pass the KET for an assertion. If any one branch matches,
- the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
- start of each branch to move the current point backwards, so the code at
- this level is identical to the lookahead case. When the assertion is part
- of a condition, we want to return immediately afterwards. The caller of
- this incarnation of the match() function will have set MATCH_CONDASSERT in
- mb->match_function type, and one of these opcodes will be the first opcode
- that is processed. We use a local variable that is preserved over calls to
- match() to remember this case. */
+ /* Common code for all repeated single-character matches. We first check
+ for the minimum number of characters. If the minimum equals the maximum, we
+ are done. Otherwise, if minimizing, check the rest of the pattern for a
+ match; if there isn't one, advance up to the maximum, one character at a
+ time.
- case OP_ASSERT:
- case OP_ASSERTBACK:
- save_mark = mb->mark;
- if ((mb->match_function_type & MATCH_CONDASSERT) != 0)
- {
- condassert = TRUE;
- mb->match_function_type &= ~MATCH_CONDASSERT;
- }
- else condassert = FALSE;
+ If maximizing, advance up to the maximum number of matching characters,
+ until Feptr is past the end of the maximum run. If possessive, we are
+ then done (no backing up). Otherwise, match at this position; anything
+ other than no match is immediately returned. For nomatch, back up one
+ character, unless we are matching \R and the last thing matched was
+ \r\n, in which case, back up two code units until we reach the first
+ optional character position.
- /* Loop for each branch */
+ The various UTF/non-UTF and caseful/caseless cases are handled separately,
+ for speed. */
- do
+ REPEATCHAR:
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, NULL, RM4);
+ Flength = 1;
+ Lcharptr = Fecode;
+ GETCHARLEN(fc, Fecode, Flength);
+ Fecode += Flength;
- /* A match means that the assertion is true; break out of the loop
- that matches its alternatives. */
+ /* Handle multi-code-unit character matching, caseful and caseless. */
- if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
+ if (Flength > 1)
{
- mstart = mb->start_match_ptr; /* In case \K reset it */
- break;
- }
-
- /* If not matched, restore the previous mark setting. */
-
- mb->mark = save_mark;
-
- /* See comment in the code for capturing groups above about handling
- THEN. */
+ uint32_t othercase;
- if (rrc == MATCH_THEN)
- {
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
- rrc = MATCH_NOMATCH;
- }
+ if (Fop >= OP_STARI && /* Caseless */
+ (othercase = UCD_OTHERCASE(fc)) != fc)
+ Loclength = PRIV(ord2utf)(othercase, Foccu);
+ else Loclength = 0;
- /* Anything other than NOMATCH causes the entire assertion to fail,
- passing back the return code. This includes COMMIT, SKIP, PRUNE and an
- uncaptured THEN, which means they take their normal effect. This
- consistent approach does not always have exactly the same effect as in
- Perl. */
+ for (i = 1; i <= Lmin; i++)
+ {
+ if (Feptr <= mb->end_subject - Flength &&
+ memcmp(Feptr, Lcharptr, CU2BYTES(Flength)) == 0) Feptr += Flength;
+ else if (Loclength > 0 &&
+ Feptr <= mb->end_subject - Loclength &&
+ memcmp(Feptr, Foccu, CU2BYTES(Loclength)) == 0)
+ Feptr += Loclength;
+ else
+ {
+ CHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ }
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- ecode += GET(ecode, 1);
- }
- while (*ecode == OP_ALT); /* Continue for next alternative */
+ if (Lmin == Lmax) continue;
- /* If we have tried all the alternative branches, the assertion has
- failed. If not, we broke out after a match. */
+ if (reptype == REPTYPE_MIN)
+ {
+ for (;;)
+ {
+ RMATCH(Fecode, RM202);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr <= mb->end_subject - Flength &&
+ memcmp(Feptr, Lcharptr, CU2BYTES(Flength)) == 0) Feptr += Flength;
+ else if (Loclength > 0 &&
+ Feptr <= mb->end_subject - Loclength &&
+ memcmp(Feptr, Foccu, CU2BYTES(Loclength)) == 0)
+ Feptr += Loclength;
+ else
+ {
+ CHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ }
+ /* Control never gets here */
+ }
- if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH);
+ else /* Maximize */
+ {
+ Lstart_eptr = Feptr;
+ for (i = Lmin; i < Lmax; i++)
+ {
+ if (Feptr <= mb->end_subject - Flength &&
+ memcmp(Feptr, Lcharptr, CU2BYTES(Flength)) == 0)
+ Feptr += Flength;
+ else if (Loclength > 0 &&
+ Feptr <= mb->end_subject - Loclength &&
+ memcmp(Feptr, Foccu, CU2BYTES(Loclength)) == 0)
+ Feptr += Loclength;
+ else
+ {
+ CHECK_PARTIAL();
+ break;
+ }
+ }
- /* If checking an assertion for a condition, return MATCH_MATCH. */
+ /* After \C in UTF mode, Lstart_eptr might be in the middle of a
+ Unicode character. Use <= Lstart_eptr to ensure backtracking doesn't
+ go too far. */
- if (condassert) RRETURN(MATCH_MATCH);
+ if (reptype != REPTYPE_POS) for(;;)
+ {
+ if (Feptr <= Lstart_eptr) break;
+ RMATCH(Fecode, RM203);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Feptr--;
+ BACKCHAR(Feptr);
+ }
+ }
+ break; /* End of repeated wide character handling */
+ }
- /* Continue from after a successful assertion, updating the offsets high
- water mark, since extracts may have been taken during the assertion. */
+ /* Length of UTF character is 1. Put it into the preserved variable and
+ fall through to the non-UTF code. */
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
- ecode += 1 + LINK_SIZE;
- offset_top = mb->end_offset_top;
- continue;
+ Lc = fc;
+ }
+ else
+#endif /* SUPPORT_UNICODE */
- /* Negative assertion: all branches must fail to match for the assertion to
- succeed. */
+ /* When not in UTF mode, load a single-code-unit character. Then proceed as
+ above. */
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK_NOT:
- save_mark = mb->mark;
- if ((mb->match_function_type & MATCH_CONDASSERT) != 0)
- {
- condassert = TRUE;
- mb->match_function_type &= ~MATCH_CONDASSERT;
- }
- else condassert = FALSE;
+ Lc = *Fecode++;
- /* Loop for each alternative branch. */
+ /* Caseless comparison */
- do
+ if (Fop >= OP_STARI)
{
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, NULL, RM5);
- mb->mark = save_mark; /* Always restore the mark setting */
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ /* Lc must be < 128 in UTF-8 mode. */
+ Loc = mb->fcc[Lc];
+#else /* 16-bit & 32-bit */
+#ifdef SUPPORT_UNICODE
+ if (utf && Lc > 127) Loc = UCD_OTHERCASE(Lc);
+ else
+#endif /* SUPPORT_UNICODE */
+ Loc = TABLE_GET(Lc, mb->fcc, Lc);
+#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
- switch(rrc)
+ for (i = 1; i <= Lmin; i++)
{
- case MATCH_MATCH: /* A successful match means */
- case MATCH_ACCEPT: /* the assertion has failed. */
- RRETURN(MATCH_NOMATCH);
-
- case MATCH_NOMATCH: /* Carry on with next branch */
- break;
-
- /* See comment in the code for capturing groups above about handling
- THEN. */
-
- case MATCH_THEN:
- next_ecode = ecode + GET(ecode,1);
- if (mb->start_match_ptr < next_ecode &&
- (*ecode == OP_ALT || *next_ecode == OP_ALT))
+ uint32_t cc; /* Faster than PCRE2_UCHAR */
+ if (Feptr >= mb->end_subject)
{
- rrc = MATCH_NOMATCH;
- break;
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
- /* Otherwise fall through. */
-
- /* COMMIT, SKIP, PRUNE, and an uncaptured THEN cause the whole
- assertion to fail to match, without considering any more alternatives.
- Failing to match means the assertion is true. This is a consistent
- approach, but does not always have the same effect as in Perl. */
-
- case MATCH_COMMIT:
- case MATCH_SKIP:
- case MATCH_SKIP_ARG:
- case MATCH_PRUNE:
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
- goto NEG_ASSERT_TRUE; /* Break out of alternation loop */
-
- /* Anything else is an error */
-
- default:
- RRETURN(rrc);
+ cc = UCHAR21TEST(Feptr);
+ if (Lc != cc && Loc != cc) RRETURN(MATCH_NOMATCH);
+ Feptr++;
}
+ if (Lmin == Lmax) continue;
- /* Continue with next branch */
-
- ecode += GET(ecode,1);
- }
- while (*ecode == OP_ALT);
-
- /* All branches in the assertion failed to match. */
-
- NEG_ASSERT_TRUE:
- if (condassert) RRETURN(MATCH_MATCH); /* Condition assertion */
- ecode += 1 + LINK_SIZE; /* Continue with current branch */
- continue;
-
- /* Move the subject pointer back. This occurs only at the start of
- each branch of a lookbehind assertion. If we are too close to the start to
- move back, this match function fails. When working with UTF-8 we move
- back a number of characters, not bytes. */
-
- case OP_REVERSE:
- i = GET(ecode, 1);
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- while (i-- > 0)
+ if (reptype == REPTYPE_MIN)
{
- if (eptr <= mb->start_subject) RRETURN(MATCH_NOMATCH);
- eptr--;
- BACKCHAR(eptr);
+ for (;;)
+ {
+ uint32_t cc; /* Faster than PCRE2_UCHAR */
+ RMATCH(Fecode, RM25);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ cc = UCHAR21TEST(Feptr);
+ if (Lc != cc && Loc != cc) RRETURN(MATCH_NOMATCH);
+ Feptr++;
+ }
+ /* Control never gets here */
}
- }
- else
-#endif
- /* No UTF-8 support, or not in UTF-8 mode: count is byte count */
-
- {
- if (i > eptr - mb->start_subject) RRETURN(MATCH_NOMATCH);
- eptr -= i;
- }
-
- /* Save the earliest consulted character, then skip to next op code */
-
- if (eptr < mb->start_used_ptr) mb->start_used_ptr = eptr;
- ecode += 1 + LINK_SIZE;
- break;
-
- /* The callout item calls an external function, if one is provided, passing
- details of the match so far. This is mainly for debugging, though the
- function is able to force a failure. */
-
- case OP_CALLOUT:
- case OP_CALLOUT_STR:
- {
- unsigned int callout_length = (*ecode == OP_CALLOUT)
- ? PRIV(OP_lengths)[OP_CALLOUT] : GET(ecode, 1 + 2*LINK_SIZE);
-
- if (mb->callout != NULL)
+ else /* Maximize */
{
- pcre2_callout_block cb;
- cb.version = 1;
- cb.callout_number = ecode[LINK_SIZE + 1];
- cb.capture_top = (uint32_t)offset_top/2;
- cb.capture_last = mb->capture_last & CAPLMASK;
- cb.offset_vector = mb->ovector;
- cb.mark = mb->nomatch_mark;
- cb.subject = mb->start_subject;
- cb.subject_length = (PCRE2_SIZE)(mb->end_subject - mb->start_subject);
- cb.start_match = (PCRE2_SIZE)(mstart - mb->start_subject);
- cb.current_position = (PCRE2_SIZE)(eptr - mb->start_subject);
- cb.pattern_position = GET(ecode, 1);
- cb.next_item_length = GET(ecode, 1 + LINK_SIZE);
-
- if (*ecode == OP_CALLOUT)
+ Lstart_eptr = Feptr;
+ for (i = Lmin; i < Lmax; i++)
{
- cb.callout_number = ecode[1 + 2*LINK_SIZE];
- cb.callout_string_offset = 0;
- cb.callout_string = NULL;
- cb.callout_string_length = 0;
+ uint32_t cc; /* Faster than PCRE2_UCHAR */
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ break;
+ }
+ cc = UCHAR21TEST(Feptr);
+ if (Lc != cc && Loc != cc) break;
+ Feptr++;
}
- else
+ if (reptype != REPTYPE_POS) for (;;)
{
- cb.callout_number = 0;
- cb.callout_string_offset = GET(ecode, 1 + 3*LINK_SIZE);
- cb.callout_string = ecode + (1 + 4*LINK_SIZE) + 1;
- cb.callout_string_length =
- callout_length - (1 + 4*LINK_SIZE) - 2;
+ if (Feptr == Lstart_eptr) break;
+ RMATCH(Fecode, RM26);
+ Feptr--;
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
}
-
- if ((rrc = mb->callout(&cb, mb->callout_data)) > 0)
- RRETURN(MATCH_NOMATCH);
- if (rrc < 0) RRETURN(rrc);
}
- ecode += callout_length;
}
- break;
-
- /* Recursion either matches the current regex, or some subexpression. The
- offset data is the offset to the starting bracket from the start of the
- whole pattern. (This is so that it works from duplicated subpatterns.)
-
- The state of the capturing groups is preserved over recursion, and
- re-instated afterwards. We don't know how many are started and not yet
- finished (offset_top records the completed total) so we just have to save
- all the potential data. There may be up to 65535 such values, which is too
- large to put on the stack, but using malloc for small numbers seems
- expensive. As a compromise, the stack is used when there are no more than
- OP_RECURSE_STACK_SAVE_MAX values to store; otherwise malloc is used.
- There are also other values that have to be saved. We use a chained
- sequence of blocks that actually live on the stack. Thanks to Robin Houston
- for the original version of this logic. It has, however, been hacked around
- a lot, so he is not to blame for the current way it works. */
+ /* Caseful comparisons (includes all multi-byte characters) */
- case OP_RECURSE:
+ else
{
- ovecsave_frame *fr;
- recursion_info *ri;
- uint32_t recno;
-
- callpat = mb->start_code + GET(ecode, 1);
- recno = (callpat == mb->start_code)? 0 : GET2(callpat, 1 + LINK_SIZE);
-
- /* Check for repeating a pattern recursion without advancing the subject
- pointer. This should catch convoluted mutual recursions. (Some simple
- cases are caught at compile time.) */
-
- for (ri = mb->recursive; ri != NULL; ri = ri->prevrec)
- if (recno == ri->group_num && eptr == ri->subject_position)
- RRETURN(PCRE2_ERROR_RECURSELOOP);
-
- /* Add to "recursing stack" */
-
- new_recursive.group_num = recno;
- new_recursive.saved_capture_last = mb->capture_last;
- new_recursive.subject_position = eptr;
- new_recursive.prevrec = mb->recursive;
- mb->recursive = &new_recursive;
-
- /* Where to continue from afterwards */
-
- ecode += 1 + LINK_SIZE;
-
- /* When we are using the system stack for match() recursion we can call a
- function that uses the system stack for preserving the ovector while
- processing the pattern recursion, but only if the ovector is small
- enough. */
-
-#ifndef HEAP_MATCH_RECURSE
- if (mb->offset_end <= OP_RECURSE_STACK_SAVE_MAX)
- {
- rrc = op_recurse_ovecsave(eptr, callpat, mstart, offset_top, mb,
- eptrb, rdepth);
- mb->recursive = new_recursive.prevrec;
- if (rrc != MATCH_MATCH && rrc != MATCH_ACCEPT) RRETURN(rrc);
-
- /* Set where we got to in the subject, and reset the start, in case
- it was changed by \K. This *is* propagated back out of a recursion,
- for Perl compatibility. */
-
- eptr = mb->end_match_ptr;
- mstart = mb->start_match_ptr;
- break; /* End of processing OP_RECURSE */
- }
-#endif
- /* If the ovector is too big, or if we are using the heap for match()
- recursion, we have to use the heap for saving the ovector. Used ovecsave
- frames are kept on a chain and re-used. This makes a small improvement in
- execution time on Linux. */
-
- if (mb->ovecsave_chain != NULL)
- {
- new_recursive.ovec_save = mb->ovecsave_chain->saved_ovec;
- mb->ovecsave_chain = mb->ovecsave_chain->next;
- }
- else
+ for (i = 1; i <= Lmin; i++)
{
- fr = (ovecsave_frame *)(mb->memctl.malloc(sizeof(ovecsave_frame *) +
- mb->offset_end * sizeof(PCRE2_SIZE), mb->memctl.memory_data));
- if (fr == NULL) RRETURN(PCRE2_ERROR_NOMEMORY);
- new_recursive.ovec_save = fr->saved_ovec;
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (Lc != UCHAR21INCTEST(Feptr)) RRETURN(MATCH_NOMATCH);
}
- memcpy(new_recursive.ovec_save, mb->ovector,
- mb->offset_end * sizeof(PCRE2_SIZE));
+ if (Lmin == Lmax) continue;
- /* Do the recursion. After processing each alternative, restore the
- ovector data and the last captured value. This code has the same overall
- logic as the code in the op_recurse_ovecsave() function, but is adapted
- to use RMATCH/RRETURN and to release the heap block containing the saved
- ovector. */
-
- cbegroup = (*callpat >= OP_SBRA);
- do
+ if (reptype == REPTYPE_MIN)
{
- if (cbegroup) mb->match_function_type |= MATCH_CBEGROUP;
- RMATCH(eptr, callpat + PRIV(OP_lengths)[*callpat], offset_top,
- mb, eptrb, RM6);
- memcpy(mb->ovector, new_recursive.ovec_save,
- mb->offset_end * sizeof(PCRE2_SIZE));
- mb->capture_last = new_recursive.saved_capture_last;
- mb->recursive = new_recursive.prevrec;
-
- if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
+ for (;;)
{
- fr = (ovecsave_frame *)
- ((uint8_t *)new_recursive.ovec_save - sizeof(ovecsave_frame *));
- fr->next = mb->ovecsave_chain;
- mb->ovecsave_chain = fr;
-
- /* Set where we got to in the subject, and reset the start, in case
- it was changed by \K. This *is* propagated back out of a recursion,
- for Perl compatibility. */
-
- eptr = mb->end_match_ptr;
- mstart = mb->start_match_ptr;
- goto RECURSION_MATCHED; /* Exit loop; end processing */
+ RMATCH(Fecode, RM27);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (Lc != UCHAR21INCTEST(Feptr)) RRETURN(MATCH_NOMATCH);
}
+ /* Control never gets here */
+ }
+ else /* Maximize */
+ {
+ Lstart_eptr = Feptr;
+ for (i = Lmin; i < Lmax; i++)
+ {
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ break;
+ }
- /* PCRE does not allow THEN, SKIP, PRUNE or COMMIT to escape beyond a
- recursion; they cause a NOMATCH for the entire recursion. These codes
- are defined in a range that can be tested for. */
+ if (Lc != UCHAR21TEST(Feptr)) break;
+ Feptr++;
+ }
- if (rrc >= MATCH_BACKTRACK_MIN && rrc <= MATCH_BACKTRACK_MAX)
+ if (reptype != REPTYPE_POS) for (;;)
{
- rrc = MATCH_NOMATCH;
- goto RECURSION_RETURN;
+ if (Feptr <= Lstart_eptr) break;
+ RMATCH(Fecode, RM28);
+ Feptr--;
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
}
-
- /* Any return code other than NOMATCH is an error. */
-
- if (rrc != MATCH_NOMATCH) goto RECURSION_RETURN;
- mb->recursive = &new_recursive;
- callpat += GET(callpat, 1);
}
- while (*callpat == OP_ALT);
-
- RECURSION_RETURN:
- mb->recursive = new_recursive.prevrec;
- fr = (ovecsave_frame *)
- ((uint8_t *)new_recursive.ovec_save - sizeof(ovecsave_frame *));
- fr->next = mb->ovecsave_chain;
- mb->ovecsave_chain = fr;
- RRETURN(rrc);
}
-
- RECURSION_MATCHED:
break;
- /* An alternation is the end of a branch; scan along to find the end of the
- bracketed group and go to there. */
+#undef Loclength
+#undef Lstart_eptr
+#undef Lcharptr
+#undef Lmin
+#undef Lmax
+#undef Lc
+#undef Loc
- case OP_ALT:
- do ecode += GET(ecode,1); while (*ecode == OP_ALT);
- break;
- /* BRAZERO, BRAMINZERO and SKIPZERO occur just before a bracket group,
- indicating that it may occur zero times. It may repeat infinitely, or not
- at all - i.e. it could be ()* or ()? or even (){0} in the pattern. Brackets
- with fixed upper repeat limits are compiled as a number of copies, with the
- optional ones preceded by BRAZERO or BRAMINZERO. */
+ /* ===================================================================== */
+ /* Match a negated single one-byte character repeatedly. This is almost a
+ repeat of the code for a repeated single character, but I haven't found a
+ nice way of commoning these up that doesn't require a test of the
+ positive/negative option for each character match. Maybe that wouldn't add
+ very much to the time taken, but character matching *is* what this is all
+ about... */
- case OP_BRAZERO:
- next_ecode = ecode + 1;
- RMATCH(eptr, next_ecode, offset_top, mb, eptrb, RM10);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- do next_ecode += GET(next_ecode, 1); while (*next_ecode == OP_ALT);
- ecode = next_ecode + 1 + LINK_SIZE;
- break;
+#define Lstart_eptr F->temp_sptr[0]
+#define Lmin F->temp_32[0]
+#define Lmax F->temp_32[1]
+#define Lc F->temp_32[2]
+#define Loc F->temp_32[3]
- case OP_BRAMINZERO:
- next_ecode = ecode + 1;
- do next_ecode += GET(next_ecode, 1); while (*next_ecode == OP_ALT);
- RMATCH(eptr, next_ecode + 1+LINK_SIZE, offset_top, mb, eptrb, RM11);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- ecode++;
- break;
+ case OP_NOTEXACT:
+ case OP_NOTEXACTI:
+ Lmin = Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATNOTCHAR;
- case OP_SKIPZERO:
- next_ecode = ecode+1;
- do next_ecode += GET(next_ecode,1); while (*next_ecode == OP_ALT);
- ecode = next_ecode + 1 + LINK_SIZE;
- break;
+ case OP_NOTUPTO:
+ case OP_NOTUPTOI:
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ reptype = REPTYPE_MAX;
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATNOTCHAR;
- /* BRAPOSZERO occurs before a possessive bracket group. Don't do anything
- here; just jump to the group, with allow_zero set TRUE. */
+ case OP_NOTMINUPTO:
+ case OP_NOTMINUPTOI:
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ reptype = REPTYPE_MIN;
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATNOTCHAR;
- case OP_BRAPOSZERO:
- op = *(++ecode);
- allow_zero = TRUE;
- if (op == OP_CBRAPOS || op == OP_SCBRAPOS) goto POSSESSIVE_CAPTURE;
- goto POSSESSIVE_NON_CAPTURE;
+ case OP_NOTPOSSTAR:
+ case OP_NOTPOSSTARI:
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = UINT32_MAX;
+ Fecode++;
+ goto REPEATNOTCHAR;
- /* End of a group, repeated or non-repeating. */
+ case OP_NOTPOSPLUS:
+ case OP_NOTPOSPLUSI:
+ reptype = REPTYPE_POS;
+ Lmin = 1;
+ Lmax = UINT32_MAX;
+ Fecode++;
+ goto REPEATNOTCHAR;
- case OP_KET:
- case OP_KETRMIN:
- case OP_KETRMAX:
- case OP_KETRPOS:
- prev = ecode - GET(ecode, 1);
+ case OP_NOTPOSQUERY:
+ case OP_NOTPOSQUERYI:
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = 1;
+ Fecode++;
+ goto REPEATNOTCHAR;
- /* If this was a group that remembered the subject start, in order to break
- infinite repeats of empty string matches, retrieve the subject start from
- the chain. Otherwise, set it NULL. */
+ case OP_NOTPOSUPTO:
+ case OP_NOTPOSUPTOI:
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
+ goto REPEATNOTCHAR;
- if (*prev >= OP_SBRA || *prev == OP_ONCE)
- {
- saved_eptr = eptrb->epb_saved_eptr; /* Value at start of group */
- eptrb = eptrb->epb_prev; /* Backup to previous group */
- }
- else saved_eptr = NULL;
+ case OP_NOTSTAR:
+ case OP_NOTSTARI:
+ case OP_NOTMINSTAR:
+ case OP_NOTMINSTARI:
+ case OP_NOTPLUS:
+ case OP_NOTPLUSI:
+ case OP_NOTMINPLUS:
+ case OP_NOTMINPLUSI:
+ case OP_NOTQUERY:
+ case OP_NOTQUERYI:
+ case OP_NOTMINQUERY:
+ case OP_NOTMINQUERYI:
+ fc = *Fecode++ - ((Fop >= OP_NOTSTARI)? OP_NOTSTARI: OP_NOTSTAR);
+ Lmin = rep_min[fc];
+ Lmax = rep_max[fc];
+ reptype = rep_typ[fc];
- /* If we are at the end of an assertion group or a non-capturing atomic
- group, stop matching and return MATCH_MATCH, but record the current high
- water mark for use by positive assertions. We also need to record the match
- start in case it was changed by \K. */
+ /* Common code for all repeated single-character non-matches. */
- if ((*prev >= OP_ASSERT && *prev <= OP_ASSERTBACK_NOT) ||
- *prev == OP_ONCE_NC)
- {
- mb->end_match_ptr = eptr; /* For ONCE_NC */
- mb->end_offset_top = offset_top;
- mb->start_match_ptr = mstart;
- if (eptr > mb->last_used_ptr) mb->last_used_ptr = eptr;
- RRETURN(MATCH_MATCH); /* Sets mb->mark */
- }
+ REPEATNOTCHAR:
+ GETCHARINCTEST(Lc, Fecode);
- /* For capturing groups we have to check the group number back at the start
- and if necessary complete handling an extraction by setting the offsets and
- bumping the high water mark. Whole-pattern recursion is coded as a recurse
- into group 0, so it won't be picked up here. Instead, we catch it when the
- OP_END is reached. Other recursion is handled here. We just have to record
- the current subject position and start match pointer and give a MATCH
- return. */
+ /* The code is duplicated for the caseless and caseful cases, for speed,
+ since matching characters is likely to be quite common. First, ensure the
+ minimum number of matches are present. If Lmin = Lmax, we are done.
+ Otherwise, if minimizing, keep trying the rest of the expression and
+ advancing one matching character if failing, up to the maximum.
+ Alternatively, if maximizing, find the maximum number of characters and
+ work backwards. */
- if (*prev == OP_CBRA || *prev == OP_SCBRA ||
- *prev == OP_CBRAPOS || *prev == OP_SCBRAPOS)
+ if (Fop >= OP_NOTSTARI) /* Caseless */
{
- number = GET2(prev, 1+LINK_SIZE);
- offset = number << 1;
-
- /* Handle a recursively called group. */
-
- if (mb->recursive != NULL && mb->recursive->group_num == number)
- {
- mb->end_match_ptr = eptr;
- mb->start_match_ptr = mstart;
- if (eptr > mb->last_used_ptr) mb->last_used_ptr = eptr;
- RRETURN(MATCH_MATCH);
- }
+#ifdef SUPPORT_UNICODE
+ if (utf && Lc > 127)
+ Loc = UCD_OTHERCASE(Lc);
+ else
+#endif /* SUPPORT_UNICODE */
- /* Deal with capturing */
+ Loc = TABLE_GET(Lc, mb->fcc, Lc); /* Other case from table */
- mb->capture_last = (mb->capture_last & OVFLMASK) | number;
- if (offset >= mb->offset_max) mb->capture_last |= OVFLBIT; else
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- /* If offset is greater than offset_top, it means that we are
- "skipping" a capturing group, and that group's offsets must be marked
- unset. In earlier versions of PCRE, all the offsets were unset at the
- start of matching, but this doesn't work because atomic groups and
- assertions can cause a value to be set that should later be unset.
- Example: matching /(?>(a))b|(a)c/ against "ac". This sets group 1 as
- part of the atomic group, but this is not on the final matching path,
- so must be unset when 2 is set. (If there is no group 2, there is no
- problem, because offset_top will then be 2, indicating no capture.) */
-
- if (offset > offset_top)
+ uint32_t d;
+ for (i = 1; i <= Lmin; i++)
{
- PCRE2_SIZE *iptr = mb->ovector + offset_top;
- PCRE2_SIZE *iend = mb->ovector + offset;
- while (iptr < iend) *iptr++ = PCRE2_UNSET;
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ GETCHARINC(d, Feptr);
+ if (Lc == d || Loc == d) RRETURN(MATCH_NOMATCH);
}
-
- /* Now make the extraction */
-
- mb->ovector[offset] = mb->ovector[mb->offset_end - number];
- mb->ovector[offset+1] = eptr - mb->start_subject;
- if (offset_top <= offset) offset_top = offset + 2;
- }
- }
-
- /* OP_KETRPOS is a possessive repeating ket. Remember the current position,
- and return the MATCH_KETRPOS. This makes it possible to do the repeats one
- at a time from the outer level, thus saving stack. This must precede the
- empty string test - in this case that test is done at the outer level. */
-
- if (*ecode == OP_KETRPOS)
- {
- mb->start_match_ptr = mstart; /* In case \K reset it */
- mb->end_match_ptr = eptr;
- mb->end_offset_top = offset_top;
- if (eptr > mb->last_used_ptr) mb->last_used_ptr = eptr;
- RRETURN(MATCH_KETRPOS);
- }
-
- /* For an ordinary non-repeating ket, just continue at this level. This
- also happens for a repeating ket if no characters were matched in the
- group. This is the forcible breaking of infinite loops as implemented in
- Perl 5.005. For a non-repeating atomic group that includes captures,
- establish a backup point by processing the rest of the pattern at a lower
- level. If this results in a NOMATCH return, pass MATCH_ONCE back to the
- original OP_ONCE level, thereby bypassing intermediate backup points, but
- resetting any captures that happened along the way. */
-
- if (*ecode == OP_KET || eptr == saved_eptr)
- {
- if (*prev == OP_ONCE)
- {
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, eptrb, RM12);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->once_target = prev; /* Level at which to change to MATCH_NOMATCH */
- RRETURN(MATCH_ONCE);
- }
- ecode += 1 + LINK_SIZE; /* Carry on at this level */
- break;
- }
-
- /* The normal repeating kets try the rest of the pattern or restart from
- the preceding bracket, in the appropriate order. In the second case, we can
- use tail recursion to avoid using another stack frame, unless we have an
- an atomic group or an unlimited repeat of a group that can match an empty
- string. */
-
- if (*ecode == OP_KETRMIN)
- {
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, eptrb, RM7);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (*prev == OP_ONCE)
- {
- RMATCH(eptr, prev, offset_top, mb, eptrb, RM8);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->once_target = prev; /* Level at which to change to MATCH_NOMATCH */
- RRETURN(MATCH_ONCE);
- }
- if (*prev >= OP_SBRA) /* Could match an empty string */
- {
- RMATCH(eptr, prev, offset_top, mb, eptrb, RM50);
- RRETURN(rrc);
- }
- ecode = prev;
- goto TAIL_RECURSE;
- }
- else /* OP_KETRMAX */
- {
- RMATCH(eptr, prev, offset_top, mb, eptrb, RM13);
- if (rrc == MATCH_ONCE && mb->once_target == prev) rrc = MATCH_NOMATCH;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (*prev == OP_ONCE)
- {
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, mb, eptrb, RM9);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- mb->once_target = prev;
- RRETURN(MATCH_ONCE);
}
- ecode += 1 + LINK_SIZE;
- goto TAIL_RECURSE;
- }
- /* Control never gets here */
-
- /* Not multiline mode: start of subject assertion, unless notbol. */
-
- case OP_CIRC:
- if ((mb->moptions & PCRE2_NOTBOL) != 0 && eptr == mb->start_subject)
- RRETURN(MATCH_NOMATCH);
-
- /* Start of subject assertion */
-
- case OP_SOD:
- if (eptr != mb->start_subject) RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- /* Multiline mode: start of subject unless notbol, or after any newline
- except for one at the very end, unless PCRE2_ALT_CIRCUMFLEX is set. */
-
- case OP_CIRCM:
- if ((mb->moptions & PCRE2_NOTBOL) != 0 && eptr == mb->start_subject)
- RRETURN(MATCH_NOMATCH);
- if (eptr != mb->start_subject &&
- ((eptr == mb->end_subject &&
- (mb->poptions & PCRE2_ALT_CIRCUMFLEX) == 0) ||
- !WAS_NEWLINE(eptr)))
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- /* Start of match assertion */
-
- case OP_SOM:
- if (eptr != mb->start_subject + mb->start_offset) RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- /* Reset the start of match point */
-
- case OP_SET_SOM:
- mstart = eptr;
- ecode++;
- break;
-
- /* Multiline mode: assert before any newline, or before end of subject
- unless noteol is set. */
+ else
+#endif /* SUPPORT_UNICODE */
- case OP_DOLLM:
- if (eptr < mb->end_subject)
- {
- if (!IS_NEWLINE(eptr))
+ /* Not UTF mode */
{
- if (mb->partial != 0 &&
- eptr + 1 >= mb->end_subject &&
- NLBLOCK->nltype == NLTYPE_FIXED &&
- NLBLOCK->nllen == 2 &&
- UCHAR21TEST(eptr) == NLBLOCK->nl[0])
+ for (i = 1; i <= Lmin; i++)
{
- mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (Lc == *Feptr || Loc == *Feptr) RRETURN(MATCH_NOMATCH);
+ Feptr++;
}
- RRETURN(MATCH_NOMATCH);
}
- }
- else
- {
- if ((mb->moptions & PCRE2_NOTEOL) != 0) RRETURN(MATCH_NOMATCH);
- SCHECK_PARTIAL();
- }
- ecode++;
- break;
-
- /* Not multiline mode: assert before a terminating newline or before end of
- subject unless noteol is set. */
-
- case OP_DOLL:
- if ((mb->moptions & PCRE2_NOTEOL) != 0) RRETURN(MATCH_NOMATCH);
- if ((mb->poptions & PCRE2_DOLLAR_ENDONLY) == 0) goto ASSERT_NL_OR_EOS;
- /* ... else fall through for endonly */
+ if (Lmin == Lmax) continue; /* Finished for exact count */
- /* End of subject assertion (\z) */
-
- case OP_EOD:
- if (eptr < mb->end_subject) RRETURN(MATCH_NOMATCH);
- SCHECK_PARTIAL();
- ecode++;
- break;
-
- /* End of subject or ending \n assertion (\Z) */
-
- case OP_EODN:
- ASSERT_NL_OR_EOS:
- if (eptr < mb->end_subject &&
- (!IS_NEWLINE(eptr) || eptr != mb->end_subject - mb->nllen))
- {
- if (mb->partial != 0 &&
- eptr + 1 >= mb->end_subject &&
- NLBLOCK->nltype == NLTYPE_FIXED &&
- NLBLOCK->nllen == 2 &&
- UCHAR21TEST(eptr) == NLBLOCK->nl[0])
+ if (reptype == REPTYPE_MIN)
{
- mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
- }
- RRETURN(MATCH_NOMATCH);
- }
-
- /* Either at end of string or \n before end. */
-
- SCHECK_PARTIAL();
- ecode++;
- break;
-
- /* Word boundary assertions */
-
- case OP_NOT_WORD_BOUNDARY:
- case OP_WORD_BOUNDARY:
- {
-
- /* Find out if the previous and current characters are "word" characters.
- It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to
- be "non-word" characters. Remember the earliest consulted character for
- partial matching. */
-
#ifdef SUPPORT_UNICODE
- if (utf)
- {
- /* Get status of previous character */
-
- if (eptr == mb->start_subject) prev_is_word = FALSE; else
+ if (utf)
{
- PCRE2_SPTR lastptr = eptr - 1;
- BACKCHAR(lastptr);
- if (lastptr < mb->start_used_ptr) mb->start_used_ptr = lastptr;
- GETCHAR(c, lastptr);
- if ((mb->poptions & PCRE2_UCP) != 0)
+ uint32_t d;
+ for (;;)
{
- if (c == '_') prev_is_word = TRUE; else
+ RMATCH(Fecode, RM204);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
- int cat = UCD_CATEGORY(c);
- prev_is_word = (cat == ucp_L || cat == ucp_N);
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
+ GETCHARINC(d, Feptr);
+ if (Lc == d || Loc == d) RRETURN(MATCH_NOMATCH);
}
- else
- prev_is_word = c < 256 && (mb->ctypes[c] & ctype_word) != 0;
- }
-
- /* Get status of next character */
-
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- cur_is_word = FALSE;
}
else
+#endif /*SUPPORT_UNICODE */
+
+ /* Not UTF mode */
{
- PCRE2_SPTR nextptr = eptr + 1;
- FORWARDCHARTEST(nextptr, mb->end_subject);
- if (nextptr > mb->last_used_ptr) mb->last_used_ptr = nextptr;
- GETCHAR(c, eptr);
- if ((mb->poptions & PCRE2_UCP) != 0)
+ for (;;)
{
- if (c == '_') cur_is_word = TRUE; else
+ RMATCH(Fecode, RM29);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
- int cat = UCD_CATEGORY(c);
- cur_is_word = (cat == ucp_L || cat == ucp_N);
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
+ if (Lc == *Feptr || Loc == *Feptr) RRETURN(MATCH_NOMATCH);
+ Feptr++;
}
- else
- cur_is_word = c < 256 && (mb->ctypes[c] & ctype_word) != 0;
}
+ /* Control never gets here */
}
- else
-#endif /* SUPPORT UTF */
- /* Not in UTF-8 mode, but we may still have PCRE2_UCP set, and for
- consistency with the behaviour of \w we do use it in this case. */
+ /* Maximize case */
+ else
{
- /* Get status of previous character */
+ Lstart_eptr = Feptr;
- if (eptr == mb->start_subject) prev_is_word = FALSE; else
- {
- if (eptr <= mb->start_used_ptr) mb->start_used_ptr = eptr - 1;
#ifdef SUPPORT_UNICODE
- if ((mb->poptions & PCRE2_UCP) != 0)
+ if (utf)
+ {
+ uint32_t d;
+ for (i = Lmin; i < Lmax; i++)
{
- c = eptr[-1];
- if (c == '_') prev_is_word = TRUE; else
+ int len = 1;
+ if (Feptr >= mb->end_subject)
{
- int cat = UCD_CATEGORY(c);
- prev_is_word = (cat == ucp_L || cat == ucp_N);
+ SCHECK_PARTIAL();
+ break;
}
+ GETCHARLEN(d, Feptr, len);
+ if (Lc == d || Loc == d) break;
+ Feptr += len;
}
- else
-#endif
- prev_is_word = MAX_255(eptr[-1])
- && ((mb->ctypes[eptr[-1]] & ctype_word) != 0);
- }
- /* Get status of next character */
+ /* After \C in UTF mode, Lstart_eptr might be in the middle of a
+ Unicode character. Use <= Lstart_eptr to ensure backtracking doesn't
+ go too far. */
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- cur_is_word = FALSE;
+ if (reptype != REPTYPE_POS) for(;;)
+ {
+ if (Feptr <= Lstart_eptr) break;
+ RMATCH(Fecode, RM205);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Feptr--;
+ BACKCHAR(Feptr);
+ }
}
else
+#endif /* SUPPORT_UNICODE */
+
+ /* Not UTF mode */
{
- if (eptr >= mb->last_used_ptr) mb->last_used_ptr = eptr + 1;
-#ifdef SUPPORT_UNICODE
- if ((mb->poptions & PCRE2_UCP) != 0)
+ for (i = Lmin; i < Lmax; i++)
{
- c = *eptr;
- if (c == '_') cur_is_word = TRUE; else
+ if (Feptr >= mb->end_subject)
{
- int cat = UCD_CATEGORY(c);
- cur_is_word = (cat == ucp_L || cat == ucp_N);
+ SCHECK_PARTIAL();
+ break;
}
+ if (Lc == *Feptr || Loc == *Feptr) break;
+ Feptr++;
+ }
+ if (reptype != REPTYPE_POS) for (;;)
+ {
+ if (Feptr == Lstart_eptr) break;
+ RMATCH(Fecode, RM30);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Feptr--;
}
- else
-#endif
- cur_is_word = MAX_255(*eptr)
- && ((mb->ctypes[*eptr] & ctype_word) != 0);
}
}
-
- /* Now see if the situation is what we want */
-
- if ((*ecode++ == OP_WORD_BOUNDARY)?
- cur_is_word == prev_is_word : cur_is_word != prev_is_word)
- RRETURN(MATCH_NOMATCH);
- }
- break;
-
- /* Match any single character type except newline; have to take care with
- CRLF newlines and partial matching. */
-
- case OP_ANY:
- if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
- if (mb->partial != 0 &&
- eptr == mb->end_subject - 1 &&
- NLBLOCK->nltype == NLTYPE_FIXED &&
- NLBLOCK->nllen == 2 &&
- UCHAR21TEST(eptr) == NLBLOCK->nl[0])
- {
- mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
- }
-
- /* Fall through */
-
- /* Match any single character whatsoever. */
-
- case OP_ALLANY:
- if (eptr >= mb->end_subject) /* DO NOT merge the eptr++ here; it must */
- { /* not be updated before SCHECK_PARTIAL. */
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
}
- eptr++;
-#ifdef SUPPORT_UNICODE
- if (utf) ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
-#endif
- ecode++;
- break;
-
- /* Match a single code unit, even in UTF-8 mode. This opcode really does
- match any code unit, even newline. (It really should be called ANYCODEUNIT,
- of course - the byte name is from pre-16 bit days.) */
-
- case OP_ANYBYTE:
- if (eptr >= mb->end_subject) /* DO NOT merge the eptr++ here; it must */
- { /* not be updated before SCHECK_PARTIAL. */
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- eptr++;
- ecode++;
- break;
-
- case OP_NOT_DIGIT:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if (
-#ifdef SUPPORT_WIDE_CHARS
- c < 256 &&
-#endif
- (mb->ctypes[c] & ctype_digit) != 0
- )
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
- case OP_DIGIT:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if (
-#ifdef SUPPORT_WIDE_CHARS
- c > 255 ||
-#endif
- (mb->ctypes[c] & ctype_digit) == 0
- )
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- case OP_NOT_WHITESPACE:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if (
-#ifdef SUPPORT_WIDE_CHARS
- c < 256 &&
-#endif
- (mb->ctypes[c] & ctype_space) != 0
- )
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- case OP_WHITESPACE:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if (
-#ifdef SUPPORT_WIDE_CHARS
- c > 255 ||
-#endif
- (mb->ctypes[c] & ctype_space) == 0
- )
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- case OP_NOT_WORDCHAR:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if (
-#ifdef SUPPORT_WIDE_CHARS
- c < 256 &&
-#endif
- (mb->ctypes[c] & ctype_word) != 0
- )
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- case OP_WORDCHAR:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if (
-#ifdef SUPPORT_WIDE_CHARS
- c > 255 ||
-#endif
- (mb->ctypes[c] & ctype_word) == 0
- )
- RRETURN(MATCH_NOMATCH);
- ecode++;
- break;
-
- case OP_ANYNL:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- switch(c)
- {
- default: RRETURN(MATCH_NOMATCH);
-
- case CHAR_CR:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- }
- else if (UCHAR21TEST(eptr) == CHAR_LF) eptr++;
- break;
-
- case CHAR_LF:
- break;
-
- case CHAR_VT:
- case CHAR_FF:
- case CHAR_NEL:
-#ifndef EBCDIC
- case 0x2028:
- case 0x2029:
-#endif /* Not EBCDIC */
- if (mb->bsr_convention == PCRE2_BSR_ANYCRLF) RRETURN(MATCH_NOMATCH);
- break;
- }
- ecode++;
- break;
-
- case OP_NOT_HSPACE:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- switch(c)
- {
- HSPACE_CASES: RRETURN(MATCH_NOMATCH); /* Byte and multibyte cases */
- default: break;
- }
- ecode++;
- break;
-
- case OP_HSPACE:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- switch(c)
- {
- HSPACE_CASES: break; /* Byte and multibyte cases */
- default: RRETURN(MATCH_NOMATCH);
- }
- ecode++;
- break;
-
- case OP_NOT_VSPACE:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- switch(c)
- {
- VSPACE_CASES: RRETURN(MATCH_NOMATCH);
- default: break;
- }
- ecode++;
- break;
+ /* Caseful comparisons */
- case OP_VSPACE:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- switch(c)
+ else
{
- VSPACE_CASES: break;
- default: RRETURN(MATCH_NOMATCH);
- }
- ecode++;
- break;
-
#ifdef SUPPORT_UNICODE
- /* Check the next character by Unicode property. We will get here only
- if the support is in the binary; otherwise a compile-time error occurs. */
-
- case OP_PROP:
- case OP_NOTPROP:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- {
- const uint32_t *cp;
- const ucd_record *prop = GET_UCD(c);
-
- switch(ecode[1])
+ if (utf)
{
- case PT_ANY:
- if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
- break;
-
- case PT_LAMP:
- if ((prop->chartype == ucp_Lu ||
- prop->chartype == ucp_Ll ||
- prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- case PT_GC:
- if ((ecode[2] != PRIV(ucp_gentype)[prop->chartype]) == (op == OP_PROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- case PT_PC:
- if ((ecode[2] != prop->chartype) == (op == OP_PROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- case PT_SC:
- if ((ecode[2] != prop->script) == (op == OP_PROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- /* These are specials */
-
- case PT_ALNUM:
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
- PRIV(ucp_gentype)[prop->chartype] == ucp_N) == (op == OP_NOTPROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- /* Perl space used to exclude VT, but from Perl 5.18 it is included,
- which means that Perl space and POSIX space are now identical. PCRE
- was changed at release 8.34. */
-
- case PT_SPACE: /* Perl space */
- case PT_PXSPACE: /* POSIX space */
- switch(c)
- {
- HSPACE_CASES:
- VSPACE_CASES:
- if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
- break;
-
- default:
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z) ==
- (op == OP_NOTPROP)) RRETURN(MATCH_NOMATCH);
- break;
- }
- break;
-
- case PT_WORD:
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
- PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
- c == CHAR_UNDERSCORE) == (op == OP_NOTPROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- case PT_CLIST:
- cp = PRIV(ucd_caseless_sets) + ecode[2];
- for (;;)
+ uint32_t d;
+ for (i = 1; i <= Lmin; i++)
{
- if (c < *cp)
- { if (op == OP_PROP) { RRETURN(MATCH_NOMATCH); } else break; }
- if (c == *cp++)
- { if (op == OP_PROP) break; else { RRETURN(MATCH_NOMATCH); } }
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ GETCHARINC(d, Feptr);
+ if (Lc == d) RRETURN(MATCH_NOMATCH);
}
- break;
-
- case PT_UCNC:
- if ((c == CHAR_DOLLAR_SIGN || c == CHAR_COMMERCIAL_AT ||
- c == CHAR_GRAVE_ACCENT || (c >= 0xa0 && c <= 0xd7ff) ||
- c >= 0xe000) == (op == OP_NOTPROP))
- RRETURN(MATCH_NOMATCH);
- break;
-
- /* This should never occur */
-
- default:
- RRETURN(PCRE2_ERROR_INTERNAL);
- }
-
- ecode += 3;
- }
- break;
-
- /* Match an extended Unicode sequence. We will get here only if the support
- is in the binary; otherwise a compile-time error occurs. */
-
- case OP_EXTUNI:
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- else
- {
- int lgb, rgb;
- GETCHARINCTEST(c, eptr);
- lgb = UCD_GRAPHBREAK(c);
- while (eptr < mb->end_subject)
- {
- int len = 1;
- if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
- rgb = UCD_GRAPHBREAK(c);
- if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
- lgb = rgb;
- eptr += len;
- }
- }
- CHECK_PARTIAL();
- ecode++;
- break;
-#endif /* SUPPORT_UNICODE */
-
-
- /* Match a back reference, possibly repeatedly. Look past the end of the
- item to see if there is repeat information following.
-
- The OP_REF and OP_REFI opcodes are used for a reference to a numbered group
- or to a non-duplicated named group. For a duplicated named group, OP_DNREF
- and OP_DNREFI are used. In this case we must scan the list of groups to
- which the name refers, and use the first one that is set. */
-
- case OP_DNREF:
- case OP_DNREFI:
- caseless = op == OP_DNREFI;
- {
- int count = GET2(ecode, 1+IMM2_SIZE);
- PCRE2_SPTR slot = mb->name_table + GET2(ecode, 1) * mb->name_entry_size;
- ecode += 1 + 2*IMM2_SIZE;
-
- /* Initializing 'offset' avoids a compiler warning in the REF_REPEAT
- code. */
-
- offset = 0;
- while (count-- > 0)
- {
- offset = GET2(slot, 0) << 1;
- if (offset < offset_top && mb->ovector[offset] != PCRE2_UNSET) break;
- slot += mb->name_entry_size;
}
- }
- goto REF_REPEAT;
-
- case OP_REF:
- case OP_REFI:
- caseless = op == OP_REFI;
- offset = GET2(ecode, 1) << 1; /* Doubled ref number */
- ecode += 1 + IMM2_SIZE;
-
- /* Set up for repetition, or handle the non-repeated case */
-
- REF_REPEAT:
- switch (*ecode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- min = GET2(ecode, 1);
- max = GET2(ecode, 1 + IMM2_SIZE);
- if (max == 0) max = INT_MAX;
- ecode += 1 + 2 * IMM2_SIZE;
- break;
-
- default: /* No repeat follows */
+ else
+#endif
+ /* Not UTF mode */
{
- int rc = match_ref(offset, offset_top, eptr, mb, caseless, &length);
- if (rc != 0)
+ for (i = 1; i <= Lmin; i++)
{
- if (rc > 0) eptr = mb->end_subject; /* Partial match */
- CHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (Lc == *Feptr++) RRETURN(MATCH_NOMATCH);
}
}
- eptr += length;
- continue; /* With the main loop */
- }
-
- /* Handle repeated back references. If a set group has length zero, just
- continue with the main loop, because it matches however many times. For an
- unset reference, if the minimum is zero, we can also just continue. We an
- also continue if PCRE2_MATCH_UNSET_BACKREF is set, because this makes unset
- group be have as a zero-length group. For any other unset cases, carrying
- on will result in NOMATCH. */
-
- if (offset < offset_top && mb->ovector[offset] != PCRE2_UNSET)
- {
- if (mb->ovector[offset] == mb->ovector[offset + 1]) continue;
- }
- else /* Group is not set */
- {
- if (min == 0 || (mb->poptions & PCRE2_MATCH_UNSET_BACKREF) != 0)
- continue;
- }
-
- /* First, ensure the minimum number of matches are present. */
-
- for (i = 1; i <= min; i++)
- {
- PCRE2_SIZE slength;
- int rc = match_ref(offset, offset_top, eptr, mb, caseless, &slength);
- if (rc != 0)
- {
- if (rc > 0) eptr = mb->end_subject; /* Partial match */
- CHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- eptr += slength;
- }
- /* If min = max, continue at the same level without recursion.
- They are not both allowed to be zero. */
+ if (Lmin == Lmax) continue;
- if (min == max) continue;
-
- /* If minimizing, keep trying and advancing the pointer */
-
- if (minimize)
- {
- for (fi = min;; fi++)
+ if (reptype == REPTYPE_MIN)
{
- int rc;
- PCRE2_SIZE slength;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM14);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- rc = match_ref(offset, offset_top, eptr, mb, caseless, &slength);
- if (rc != 0)
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- if (rc > 0) eptr = mb->end_subject; /* Partial match */
- CHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
+ uint32_t d;
+ for (;;)
+ {
+ RMATCH(Fecode, RM206);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ GETCHARINC(d, Feptr);
+ if (Lc == d) RRETURN(MATCH_NOMATCH);
+ }
}
- eptr += slength;
- }
- /* Control never gets here */
- }
-
- /* If maximizing, find the longest string and work backwards, as long as
- the matched lengths for each iteration are the same. */
-
- else
- {
- BOOL samelengths = TRUE;
- pp = eptr;
- length = mb->ovector[offset+1] - mb->ovector[offset];
-
- for (i = min; i < max; i++)
- {
- PCRE2_SIZE slength;
- int rc = match_ref(offset, offset_top, eptr, mb, caseless, &slength);
-
- if (rc != 0)
+ else
+#endif
+ /* Not UTF mode */
{
- /* Can't use CHECK_PARTIAL because we don't want to update eptr in
- the soft partial matching case. */
-
- if (rc > 0 && mb->partial != 0 &&
- mb->end_subject > mb->start_used_ptr)
+ for (;;)
{
- mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ RMATCH(Fecode, RM31);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (Lc == *Feptr++) RRETURN(MATCH_NOMATCH);
}
- break;
}
-
- if (slength != length) samelengths = FALSE;
- eptr += slength;
+ /* Control never gets here */
}
- /* If the length matched for each repetition is the same as the length of
- the captured group, we can easily work backwards. This is the normal
- case. However, in caseless UTF-8 mode there are pairs of case-equivalent
- characters whose lengths (in terms of code units) differ. However, this
- is very rare, so we handle it by re-matching fewer and fewer times. */
+ /* Maximize case */
- if (samelengths)
+ else
{
- while (eptr >= pp)
+ Lstart_eptr = Feptr;
+
+#ifdef SUPPORT_UNICODE
+ if (utf)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM15);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr -= length;
- }
- }
+ uint32_t d;
+ for (i = Lmin; i < Lmax; i++)
+ {
+ int len = 1;
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ break;
+ }
+ GETCHARLEN(d, Feptr, len);
+ if (Lc == d) break;
+ Feptr += len;
+ }
- /* The rare case of non-matching lengths. Re-scan the repetition for each
- iteration. We know that match_ref() will succeed every time. */
+ /* After \C in UTF mode, Lstart_eptr might be in the middle of a
+ Unicode character. Use <= Lstart_eptr to ensure backtracking doesn't
+ go too far. */
- else
- {
- max = i;
- for (;;)
+ if (reptype != REPTYPE_POS) for(;;)
+ {
+ if (Feptr <= Lstart_eptr) break;
+ RMATCH(Fecode, RM207);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Feptr--;
+ BACKCHAR(Feptr);
+ }
+ }
+ else
+#endif
+ /* Not UTF mode */
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM68);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (eptr == pp) break; /* Failed after minimal repetition */
- eptr = pp;
- max--;
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- PCRE2_SIZE slength;
- (void)match_ref(offset, offset_top, eptr, mb, caseless, &slength);
- eptr += slength;
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ break;
+ }
+ if (Lc == *Feptr) break;
+ Feptr++;
+ }
+ if (reptype != REPTYPE_POS) for (;;)
+ {
+ if (Feptr == Lstart_eptr) break;
+ RMATCH(Fecode, RM32);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Feptr--;
}
}
}
-
- RRETURN(MATCH_NOMATCH);
}
- /* Control never gets here */
+ break;
+
+#undef Lstart_eptr
+#undef Lmin
+#undef Lmax
+#undef Lc
+#undef Loc
- /* Match a bit-mapped character class, possibly repeatedly. This op code is
- used when all the characters in the class have values in the range 0-255,
- and either the matching is caseful, or the characters are in the range
- 0-127 when UTF-8 processing is enabled. The only difference between
+
+ /* ===================================================================== */
+ /* Match a bit-mapped character class, possibly repeatedly. These op codes
+ are used when all the characters in the class have values in the range
+ 0-255, and either the matching is caseful, or the characters are in the
+ range 0-127 when UTF processing is enabled. The only difference between
OP_CLASS and OP_NCLASS occurs when a data character outside the range is
- encountered.
+ encountered. */
- First, look past the end of the item to see if there is repeat information
- following. Then obey similar code to character type repeats - written out
- again for speed. */
+#define Lmin F->temp_32[0]
+#define Lmax F->temp_32[1]
+#define Lstart_eptr F->temp_sptr[0]
+#define Lbyte_map_address F->temp_sptr[1]
+#define Lbyte_map ((unsigned char *)Lbyte_map_address)
case OP_NCLASS:
case OP_CLASS:
{
- /* The data variable is saved across frames, so the byte map needs to
- be stored there. */
-#define BYTE_MAP ((uint8_t *)data)
- data = ecode + 1; /* Save for matching */
- ecode += 1 + (32 / sizeof(PCRE2_UCHAR)); /* Advance past the item */
+ Lbyte_map_address = Fecode + 1; /* Save for matching */
+ Fecode += 1 + (32 / sizeof(PCRE2_UCHAR)); /* Advance past the item */
+
+ /* Look past the end of the item to see if there is repeat information
+ following. Then obey similar code to character type repeats. */
- switch (*ecode)
+ switch (*Fecode)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
@@ -2994,27 +1809,24 @@ for (;;)
case OP_CRPOSSTAR:
case OP_CRPOSPLUS:
case OP_CRPOSQUERY:
- c = *ecode++ - OP_CRSTAR;
- if (c < OP_CRPOSSTAR - OP_CRSTAR) minimize = (c & 1) != 0;
- else possessive = TRUE;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
+ fc = *Fecode++ - OP_CRSTAR;
+ Lmin = rep_min[fc];
+ Lmax = rep_max[fc];
+ reptype = rep_typ[fc];
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
case OP_CRPOSRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- possessive = (*ecode == OP_CRPOSRANGE);
- min = GET2(ecode, 1);
- max = GET2(ecode, 1 + IMM2_SIZE);
- if (max == 0) max = INT_MAX;
- ecode += 1 + 2 * IMM2_SIZE;
+ Lmin = GET2(Fecode, 1);
+ Lmax = GET2(Fecode, 1 + IMM2_SIZE);
+ if (Lmax == 0) Lmax = UINT32_MAX; /* Max 0 => infinity */
+ reptype = rep_typ[*Fecode - OP_CRSTAR];
+ Fecode += 1 + 2 * IMM2_SIZE;
break;
default: /* No repeat follows */
- min = max = 1;
+ Lmin = Lmax = 1;
break;
}
@@ -3023,100 +1835,99 @@ for (;;)
#ifdef SUPPORT_UNICODE
if (utf)
{
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- if (c > 255)
+ GETCHARINC(fc, Feptr);
+ if (fc > 255)
{
- if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
+ if (Fop == OP_CLASS) RRETURN(MATCH_NOMATCH);
}
else
- if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+ if ((Lbyte_map[fc/8] & (1 << (fc&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
else
#endif
/* Not UTF mode */
{
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- c = *eptr++;
+ fc = *Feptr++;
#if PCRE2_CODE_UNIT_WIDTH != 8
- if (c > 255)
+ if (fc > 255)
{
- if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
+ if (Fop == OP_CLASS) RRETURN(MATCH_NOMATCH);
}
else
#endif
- if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+ if ((Lbyte_map[fc/8] & (1 << (fc&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
- /* If max == min we can continue with the main loop without the
- need to recurse. */
+ /* If Lmax == Lmin we are done. Continue with main loop. */
- if (min == max) continue;
+ if (Lmin == Lmax) continue;
/* If minimizing, keep testing the rest of the expression and advancing
the pointer while it matches the class. */
- if (minimize)
+ if (reptype == REPTYPE_MIN)
{
#ifdef SUPPORT_UNICODE
if (utf)
{
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM16);
+ RMATCH(Fecode, RM200);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- if (c > 255)
+ GETCHARINC(fc, Feptr);
+ if (fc > 255)
{
- if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
+ if (Fop == OP_CLASS) RRETURN(MATCH_NOMATCH);
}
else
- if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+ if ((Lbyte_map[fc/8] & (1 << (fc&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
else
#endif
/* Not UTF mode */
{
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM17);
+ RMATCH(Fecode, RM23);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- c = *eptr++;
+ fc = *Feptr++;
#if PCRE2_CODE_UNIT_WIDTH != 8
- if (c > 255)
+ if (fc > 255)
{
- if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
+ if (Fop == OP_CLASS) RRETURN(MATCH_NOMATCH);
}
else
#endif
- if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+ if ((Lbyte_map[fc/8] & (1 << (fc&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -3126,91 +1937,102 @@ for (;;)
else
{
- pp = eptr;
+ Lstart_eptr = Feptr;
#ifdef SUPPORT_UNICODE
if (utf)
{
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c > 255)
+ GETCHARLEN(fc, Feptr, len);
+ if (fc > 255)
{
- if (op == OP_CLASS) break;
+ if (Fop == OP_CLASS) break;
}
else
- if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) break;
- eptr += len;
+ if ((Lbyte_map[fc/8] & (1 << (fc&7))) == 0) break;
+ Feptr += len;
}
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM18);
+ RMATCH(Fecode, RM201);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (eptr-- == pp) break; /* Stop if tried at original pos */
- BACKCHAR(eptr);
+ if (Feptr-- == Lstart_eptr) break; /* Tried at original position */
+ BACKCHAR(Feptr);
}
}
else
#endif
/* Not UTF mode */
{
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- c = *eptr;
+ fc = *Feptr;
#if PCRE2_CODE_UNIT_WIDTH != 8
- if (c > 255)
+ if (fc > 255)
{
- if (op == OP_CLASS) break;
+ if (Fop == OP_CLASS) break;
}
else
#endif
- if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) break;
- eptr++;
+ if ((Lbyte_map[fc/8] & (1 << (fc&7))) == 0) break;
+ Feptr++;
}
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
- while (eptr >= pp)
+ while (Feptr >= Lstart_eptr)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM19);
+ RMATCH(Fecode, RM24);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
+ Feptr--;
}
}
RRETURN(MATCH_NOMATCH);
}
-#undef BYTE_MAP
}
/* Control never gets here */
+#undef Lbyte_map_address
+#undef Lbyte_map
+#undef Lstart_eptr
+#undef Lmin
+#undef Lmax
+
+ /* ===================================================================== */
/* Match an extended character class. In the 8-bit library, this opcode is
encountered only when UTF-8 mode mode is supported. In the 16-bit and
32-bit libraries, codepoints greater than 255 may be encountered even when
UTF is not supported. */
+#define Lstart_eptr F->temp_sptr[0]
+#define Lxclass_data F->temp_sptr[1]
+#define Lmin F->temp_32[0]
+#define Lmax F->temp_32[1]
+
#ifdef SUPPORT_WIDE_CHARS
case OP_XCLASS:
{
- data = ecode + 1 + LINK_SIZE; /* Save for matching */
- ecode += GET(ecode, 1); /* Advance past the item */
+ Lxclass_data = Fecode + 1 + LINK_SIZE; /* Save for matching */
+ Fecode += GET(Fecode, 1); /* Advance past the item */
- switch (*ecode)
+ switch (*Fecode)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
@@ -3221,65 +2043,61 @@ for (;;)
case OP_CRPOSSTAR:
case OP_CRPOSPLUS:
case OP_CRPOSQUERY:
- c = *ecode++ - OP_CRSTAR;
- if (c < OP_CRPOSSTAR - OP_CRSTAR) minimize = (c & 1) != 0;
- else possessive = TRUE;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
+ fc = *Fecode++ - OP_CRSTAR;
+ Lmin = rep_min[fc];
+ Lmax = rep_max[fc];
+ reptype = rep_typ[fc];
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
case OP_CRPOSRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- possessive = (*ecode == OP_CRPOSRANGE);
- min = GET2(ecode, 1);
- max = GET2(ecode, 1 + IMM2_SIZE);
- if (max == 0) max = INT_MAX;
- ecode += 1 + 2 * IMM2_SIZE;
+ Lmin = GET2(Fecode, 1);
+ Lmax = GET2(Fecode, 1 + IMM2_SIZE);
+ if (Lmax == 0) Lmax = UINT32_MAX; /* Max 0 => infinity */
+ reptype = rep_typ[*Fecode - OP_CRSTAR];
+ Fecode += 1 + 2 * IMM2_SIZE;
break;
default: /* No repeat follows */
- min = max = 1;
+ Lmin = Lmax = 1;
break;
}
/* First, ensure the minimum number of matches are present. */
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if (!PRIV(xclass)(c, data, utf)) RRETURN(MATCH_NOMATCH);
+ GETCHARINCTEST(fc, Feptr);
+ if (!PRIV(xclass)(fc, Lxclass_data, utf)) RRETURN(MATCH_NOMATCH);
}
- /* If max == min we can continue with the main loop without the
- need to recurse. */
+ /* If Lmax == Lmin we can just continue with the main loop. */
- if (min == max) continue;
+ if (Lmin == Lmax) continue;
/* If minimizing, keep testing the rest of the expression and advancing
the pointer while it matches the class. */
- if (minimize)
+ if (reptype == REPTYPE_MIN)
{
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM20);
+ RMATCH(Fecode, RM100);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if (!PRIV(xclass)(c, data, utf)) RRETURN(MATCH_NOMATCH);
+ GETCHARINCTEST(fc, Feptr);
+ if (!PRIV(xclass)(fc, Lxclass_data, utf)) RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
}
@@ -3288,33 +2106,33 @@ for (;;)
else
{
- pp = eptr;
- for (i = min; i < max; i++)
+ Lstart_eptr = Feptr;
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
#ifdef SUPPORT_UNICODE
- GETCHARLENTEST(c, eptr, len);
+ GETCHARLENTEST(fc, Feptr, len);
#else
- c = *eptr;
+ fc = *Feptr;
#endif
- if (!PRIV(xclass)(c, data, utf)) break;
- eptr += len;
+ if (!PRIV(xclass)(fc, Lxclass_data, utf)) break;
+ Feptr += len;
}
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
for(;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM21);
+ RMATCH(Fecode, RM101);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (eptr-- == pp) break; /* Stop if tried at original pos */
+ if (Feptr-- == Lstart_eptr) break; /* Tried at original position */
#ifdef SUPPORT_UNICODE
- if (utf) BACKCHAR(eptr);
+ if (utf) BACKCHAR(Feptr);
#endif
}
RRETURN(MATCH_NOMATCH);
@@ -3322,887 +2140,370 @@ for (;;)
/* Control never gets here */
}
-#endif /* End of XCLASS */
+#endif /* SUPPORT_WIDE_CHARS: end of XCLASS */
- /* Match a single character, casefully */
+#undef Lstart_eptr
+#undef Lxclass_data
+#undef Lmin
+#undef Lmax
- case OP_CHAR:
-#ifdef SUPPORT_UNICODE
- if (utf)
+
+ /* ===================================================================== */
+ /* Match various character types when PCRE2_UCP is not set. These opcodes
+ are not generated when PCRE2_UCP is set - instead appropriate property
+ tests are compiled. */
+
+ case OP_NOT_DIGIT:
+ if (Feptr >= mb->end_subject)
{
- length = 1;
- ecode++;
- GETCHARLEN(fc, ecode, length);
- if (length > (PCRE2_SIZE)(mb->end_subject - eptr))
- {
- CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */
- RRETURN(MATCH_NOMATCH);
- }
- for (; length > 0; length--)
- {
- if (*ecode++ != UCHAR21INC(eptr)) RRETURN(MATCH_NOMATCH);
- }
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
- else
-#endif
- /* Not UTF mode */
+ GETCHARINCTEST(fc, Feptr);
+ if (CHMAX_255(fc) && (mb->ctypes[fc] & ctype_digit) != 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
+
+ case OP_DIGIT:
+ if (Feptr >= mb->end_subject)
{
- if (mb->end_subject - eptr < 1)
- {
- SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */
- RRETURN(MATCH_NOMATCH);
- }
- if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH);
- ecode += 2;
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
+ GETCHARINCTEST(fc, Feptr);
+ if (!CHMAX_255(fc) || (mb->ctypes[fc] & ctype_digit) == 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
break;
- /* Match a single character, caselessly. If we are at the end of the
- subject, give up immediately. */
-
- case OP_CHARI:
- if (eptr >= mb->end_subject)
+ case OP_NOT_WHITESPACE:
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
+ GETCHARINCTEST(fc, Feptr);
+ if (CHMAX_255(fc) && (mb->ctypes[fc] & ctype_space) != 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
-#ifdef SUPPORT_UNICODE
- if (utf)
+ case OP_WHITESPACE:
+ if (Feptr >= mb->end_subject)
{
- length = 1;
- ecode++;
- GETCHARLEN(fc, ecode, length);
-
- /* If the pattern character's value is < 128, we have only one byte, and
- we know that its other case must also be one byte long, so we can use the
- fast lookup table. We know that there is at least one byte left in the
- subject. */
-
- if (fc < 128)
- {
- uint32_t cc = UCHAR21(eptr);
- if (mb->lcc[fc] != TABLE_GET(cc, mb->lcc, cc)) RRETURN(MATCH_NOMATCH);
- ecode++;
- eptr++;
- }
-
- /* Otherwise we must pick up the subject character. Note that we cannot
- use the value of "length" to check for sufficient bytes left, because the
- other case of the character may have more or fewer bytes. */
-
- else
- {
- uint32_t dc;
- GETCHARINC(dc, eptr);
- ecode += length;
-
- /* If we have Unicode property support, we can use it to test the other
- case of the character, if there is one. */
-
- if (fc != dc)
- {
-#ifdef SUPPORT_UNICODE
- if (dc != UCD_OTHERCASE(fc))
-#endif
- RRETURN(MATCH_NOMATCH);
- }
- }
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
- else
-#endif /* SUPPORT_UNICODE */
+ GETCHARINCTEST(fc, Feptr);
+ if (!CHMAX_255(fc) || (mb->ctypes[fc] & ctype_space) == 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
- /* Not UTF mode */
+ case OP_NOT_WORDCHAR:
+ if (Feptr >= mb->end_subject)
{
- if (TABLE_GET(ecode[1], mb->lcc, ecode[1])
- != TABLE_GET(*eptr, mb->lcc, *eptr)) RRETURN(MATCH_NOMATCH);
- eptr++;
- ecode += 2;
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
+ GETCHARINCTEST(fc, Feptr);
+ if (CHMAX_255(fc) && (mb->ctypes[fc] & ctype_word) != 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
break;
- /* Match a single character repeatedly. */
-
- case OP_EXACT:
- case OP_EXACTI:
- min = max = GET2(ecode, 1);
- ecode += 1 + IMM2_SIZE;
- goto REPEATCHAR;
-
- case OP_POSUPTO:
- case OP_POSUPTOI:
- possessive = TRUE;
- /* Fall through */
-
- case OP_UPTO:
- case OP_UPTOI:
- case OP_MINUPTO:
- case OP_MINUPTOI:
- min = 0;
- max = GET2(ecode, 1);
- minimize = *ecode == OP_MINUPTO || *ecode == OP_MINUPTOI;
- ecode += 1 + IMM2_SIZE;
- goto REPEATCHAR;
-
- case OP_POSSTAR:
- case OP_POSSTARI:
- possessive = TRUE;
- min = 0;
- max = INT_MAX;
- ecode++;
- goto REPEATCHAR;
-
- case OP_POSPLUS:
- case OP_POSPLUSI:
- possessive = TRUE;
- min = 1;
- max = INT_MAX;
- ecode++;
- goto REPEATCHAR;
-
- case OP_POSQUERY:
- case OP_POSQUERYI:
- possessive = TRUE;
- min = 0;
- max = 1;
- ecode++;
- goto REPEATCHAR;
-
- case OP_STAR:
- case OP_STARI:
- case OP_MINSTAR:
- case OP_MINSTARI:
- case OP_PLUS:
- case OP_PLUSI:
- case OP_MINPLUS:
- case OP_MINPLUSI:
- case OP_QUERY:
- case OP_QUERYI:
- case OP_MINQUERY:
- case OP_MINQUERYI:
- c = *ecode++ - ((op < OP_STARI)? OP_STAR : OP_STARI);
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single-character matches. We first check
- for the minimum number of characters. If the minimum equals the maximum, we
- are done. Otherwise, if minimizing, check the rest of the pattern for a
- match; if there isn't one, advance up to the maximum, one character at a
- time.
-
- If maximizing, advance up to the maximum number of matching characters,
- until eptr is past the end of the maximum run. If possessive, we are
- then done (no backing up). Otherwise, match at this position; anything
- other than no match is immediately returned. For nomatch, back up one
- character, unless we are matching \R and the last thing matched was
- \r\n, in which case, back up two bytes. When we reach the first optional
- character position, we can save stack by doing a tail recurse.
-
- The various UTF/non-UTF and caseful/caseless cases are handled separately,
- for speed. */
-
- REPEATCHAR:
-#ifdef SUPPORT_UNICODE
- if (utf)
+ case OP_WORDCHAR:
+ if (Feptr >= mb->end_subject)
{
- length = 1;
- charptr = ecode;
- GETCHARLEN(fc, ecode, length);
- ecode += length;
-
- /* Handle multibyte character matching specially here. There is
- support for caseless matching if UCP support is present. */
-
- if (length > 1)
- {
- uint32_t othercase;
- if (op >= OP_STARI && /* Caseless */
- (othercase = UCD_OTHERCASE(fc)) != fc)
- oclength = PRIV(ord2utf)(othercase, occhars);
- else oclength = 0;
-
- for (i = 1; i <= min; i++)
- {
- if (eptr <= mb->end_subject - length &&
- memcmp(eptr, charptr, CU2BYTES(length)) == 0) eptr += length;
- else if (oclength > 0 &&
- eptr <= mb->end_subject - oclength &&
- memcmp(eptr, occhars, CU2BYTES(oclength)) == 0) eptr += oclength;
- else
- {
- CHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- }
-
- if (min == max) continue;
-
- if (minimize)
- {
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM22);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr <= mb->end_subject - length &&
- memcmp(eptr, charptr, CU2BYTES(length)) == 0) eptr += length;
- else if (oclength > 0 &&
- eptr <= mb->end_subject - oclength &&
- memcmp(eptr, occhars, CU2BYTES(oclength)) == 0) eptr += oclength;
- else
- {
- CHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- }
- /* Control never gets here */
- }
-
- else /* Maximize */
- {
- pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr <= mb->end_subject - length &&
- memcmp(eptr, charptr, CU2BYTES(length)) == 0) eptr += length;
- else if (oclength > 0 &&
- eptr <= mb->end_subject - oclength &&
- memcmp(eptr, occhars, CU2BYTES(oclength)) == 0) eptr += oclength;
- else
- {
- CHECK_PARTIAL();
- break;
- }
- }
-
- if (possessive) continue; /* No backtracking */
-
- /* After \C in UTF mode, pp might be in the middle of a Unicode
- character. Use <= pp to ensure backtracking doesn't go too far. */
-
- for(;;)
- {
- if (eptr <= pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM23);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- BACKCHAR(eptr);
- }
- }
- /* Control never gets here */
- }
-
- /* If the length of a UTF-8 character is 1, we fall through here, and
- obey the code as for non-UTF-8 characters below, though in this case the
- value of fc will always be < 128. */
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
- else
-#endif /* SUPPORT_UNICODE */
-
- /* When not in UTF-8 mode, load a single-byte character. */
- fc = *ecode++;
-
- /* The value of fc at this point is always one character, though we may
- or may not be in UTF mode. The code is duplicated for the caseless and
- caseful cases, for speed, since matching characters is likely to be quite
- common. First, ensure the minimum number of matches are present. If min =
- max, continue at the same level without recursing. Otherwise, if
- minimizing, keep trying the rest of the expression and advancing one
- matching character if failing, up to the maximum. Alternatively, if
- maximizing, find the maximum number of characters and work backwards. */
+ GETCHARINCTEST(fc, Feptr);
+ if (!CHMAX_255(fc) || (mb->ctypes[fc] & ctype_word) == 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
- if (op >= OP_STARI) /* Caseless */
+ case OP_ANYNL:
+ if (Feptr >= mb->end_subject)
{
-#if PCRE2_CODE_UNIT_WIDTH == 8
- /* fc must be < 128 if UTF is enabled. */
- foc = mb->fcc[fc];
-#else
-#ifdef SUPPORT_UNICODE
- if (utf && fc > 127)
- foc = UCD_OTHERCASE(fc);
- else
-#endif /* SUPPORT_UNICODE */
- foc = TABLE_GET(fc, mb->fcc, fc);
-#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
-
- for (i = 1; i <= min; i++)
- {
- uint32_t cc; /* Faster than PCRE2_UCHAR */
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- cc = UCHAR21TEST(eptr);
- if (fc != cc && foc != cc) RRETURN(MATCH_NOMATCH);
- eptr++;
- }
- if (min == max) continue;
- if (minimize)
- {
- for (fi = min;; fi++)
- {
- uint32_t cc; /* Faster than PCRE2_UCHAR */
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM24);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- cc = UCHAR21TEST(eptr);
- if (fc != cc && foc != cc) RRETURN(MATCH_NOMATCH);
- eptr++;
- }
- /* Control never gets here */
- }
- else /* Maximize */
- {
- pp = eptr;
- for (i = min; i < max; i++)
- {
- uint32_t cc; /* Faster than PCRE2_UCHAR */
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- break;
- }
- cc = UCHAR21TEST(eptr);
- if (fc != cc && foc != cc) break;
- eptr++;
- }
- if (possessive) continue; /* No backtracking */
- for (;;)
- {
- if (eptr == pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM25);
- eptr--;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- }
- /* Control never gets here */
- }
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
-
- /* Caseful comparisons (includes all multi-byte characters) */
-
- else
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
{
- for (i = 1; i <= min; i++)
+ default: RRETURN(MATCH_NOMATCH);
+
+ case CHAR_CR:
+ if (Feptr >= mb->end_subject)
{
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- if (fc != UCHAR21INCTEST(eptr)) RRETURN(MATCH_NOMATCH);
+ SCHECK_PARTIAL();
}
+ else if (UCHAR21TEST(Feptr) == CHAR_LF) Feptr++;
+ break;
- if (min == max) continue;
+ case CHAR_LF:
+ break;
- if (minimize)
- {
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM26);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- if (fc != UCHAR21INCTEST(eptr)) RRETURN(MATCH_NOMATCH);
- }
- /* Control never gets here */
- }
- else /* Maximize */
- {
- pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- break;
- }
- if (fc != UCHAR21TEST(eptr)) break;
- eptr++;
- }
- if (possessive) continue; /* No backtracking */
- for (;;)
- {
- if (eptr == pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM27);
- eptr--;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- }
- /* Control never gets here */
- }
+ case CHAR_VT:
+ case CHAR_FF:
+ case CHAR_NEL:
+#ifndef EBCDIC
+ case 0x2028:
+ case 0x2029:
+#endif /* Not EBCDIC */
+ if (mb->bsr_convention == PCRE2_BSR_ANYCRLF) RRETURN(MATCH_NOMATCH);
+ break;
}
- /* Control never gets here */
+ Fecode++;
+ break;
- /* Match a negated single one-byte character. The character we are
- checking can be multibyte. */
+ case OP_NOT_HSPACE:
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
+ {
+ HSPACE_CASES: RRETURN(MATCH_NOMATCH); /* Byte and multibyte cases */
+ default: break;
+ }
+ Fecode++;
+ break;
- case OP_NOT:
- case OP_NOTI:
- if (eptr >= mb->end_subject)
+ case OP_HSPACE:
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
-#ifdef SUPPORT_UNICODE
- if (utf)
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
{
- uint32_t ch, och;
+ HSPACE_CASES: break; /* Byte and multibyte cases */
+ default: RRETURN(MATCH_NOMATCH);
+ }
+ Fecode++;
+ break;
- ecode++;
- GETCHARINC(ch, ecode);
- GETCHARINC(c, eptr);
+ case OP_NOT_VSPACE:
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
+ {
+ VSPACE_CASES: RRETURN(MATCH_NOMATCH);
+ default: break;
+ }
+ Fecode++;
+ break;
- if (op == OP_NOT)
- {
- if (ch == c) RRETURN(MATCH_NOMATCH);
- }
- else
- {
- if (ch > 127)
- och = UCD_OTHERCASE(ch);
- else
- och = TABLE_GET(ch, mb->fcc, ch);
- if (ch == c || och == c) RRETURN(MATCH_NOMATCH);
- }
+ case OP_VSPACE:
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
}
- else
-#endif /* SUPPORT_UNICODE */
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
{
- uint32_t ch = ecode[1];
- c = *eptr++;
- if (ch == c || (op == OP_NOTI && TABLE_GET(ch, mb->fcc, ch) == c))
- RRETURN(MATCH_NOMATCH);
- ecode += 2;
+ VSPACE_CASES: break;
+ default: RRETURN(MATCH_NOMATCH);
}
+ Fecode++;
break;
- /* Match a negated single one-byte character repeatedly. This is almost a
- repeat of the code for a repeated single character, but I haven't found a
- nice way of commoning these up that doesn't require a test of the
- positive/negative option for each character match. Maybe that wouldn't add
- very much to the time taken, but character matching *is* what this is all
- about... */
- case OP_NOTEXACT:
- case OP_NOTEXACTI:
- min = max = GET2(ecode, 1);
- ecode += 1 + IMM2_SIZE;
- goto REPEATNOTCHAR;
+#ifdef SUPPORT_UNICODE
- case OP_NOTUPTO:
- case OP_NOTUPTOI:
- case OP_NOTMINUPTO:
- case OP_NOTMINUPTOI:
- min = 0;
- max = GET2(ecode, 1);
- minimize = *ecode == OP_NOTMINUPTO || *ecode == OP_NOTMINUPTOI;
- ecode += 1 + IMM2_SIZE;
- goto REPEATNOTCHAR;
+ /* ===================================================================== */
+ /* Check the next character by Unicode property. We will get here only
+ if the support is in the binary; otherwise a compile-time error occurs. */
- case OP_NOTPOSSTAR:
- case OP_NOTPOSSTARI:
- possessive = TRUE;
- min = 0;
- max = INT_MAX;
- ecode++;
- goto REPEATNOTCHAR;
+ case OP_PROP:
+ case OP_NOTPROP:
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ GETCHARINCTEST(fc, Feptr);
+ {
+ const uint32_t *cp;
+ const ucd_record *prop = GET_UCD(fc);
- case OP_NOTPOSPLUS:
- case OP_NOTPOSPLUSI:
- possessive = TRUE;
- min = 1;
- max = INT_MAX;
- ecode++;
- goto REPEATNOTCHAR;
+ switch(Fecode[1])
+ {
+ case PT_ANY:
+ if (Fop == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
+ break;
- case OP_NOTPOSQUERY:
- case OP_NOTPOSQUERYI:
- possessive = TRUE;
- min = 0;
- max = 1;
- ecode++;
- goto REPEATNOTCHAR;
+ case PT_LAMP:
+ if ((prop->chartype == ucp_Lu ||
+ prop->chartype == ucp_Ll ||
+ prop->chartype == ucp_Lt) == (Fop == OP_NOTPROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- case OP_NOTPOSUPTO:
- case OP_NOTPOSUPTOI:
- possessive = TRUE;
- min = 0;
- max = GET2(ecode, 1);
- ecode += 1 + IMM2_SIZE;
- goto REPEATNOTCHAR;
+ case PT_GC:
+ if ((Fecode[2] != PRIV(ucp_gentype)[prop->chartype]) == (Fop == OP_PROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- case OP_NOTSTAR:
- case OP_NOTSTARI:
- case OP_NOTMINSTAR:
- case OP_NOTMINSTARI:
- case OP_NOTPLUS:
- case OP_NOTPLUSI:
- case OP_NOTMINPLUS:
- case OP_NOTMINPLUSI:
- case OP_NOTQUERY:
- case OP_NOTQUERYI:
- case OP_NOTMINQUERY:
- case OP_NOTMINQUERYI:
- c = *ecode++ - ((op >= OP_NOTSTARI)? OP_NOTSTARI: OP_NOTSTAR);
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
+ case PT_PC:
+ if ((Fecode[2] != prop->chartype) == (Fop == OP_PROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- /* Common code for all repeated single-byte matches. */
+ case PT_SC:
+ if ((Fecode[2] != prop->script) == (Fop == OP_PROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- REPEATNOTCHAR:
- GETCHARINCTEST(fc, ecode);
+ /* These are specials */
- /* The code is duplicated for the caseless and caseful cases, for speed,
- since matching characters is likely to be quite common. First, ensure the
- minimum number of matches are present. If min = max, continue at the same
- level without recursing. Otherwise, if minimizing, keep trying the rest of
- the expression and advancing one matching character if failing, up to the
- maximum. Alternatively, if maximizing, find the maximum number of
- characters and work backwards. */
+ case PT_ALNUM:
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
+ PRIV(ucp_gentype)[prop->chartype] == ucp_N) == (Fop == OP_NOTPROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- if (op >= OP_NOTSTARI) /* Caseless */
- {
-#ifdef SUPPORT_UNICODE
- if (utf && fc > 127)
- foc = UCD_OTHERCASE(fc);
- else
-#endif /* SUPPORT_UNICODE */
- foc = TABLE_GET(fc, mb->fcc, fc);
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- uint32_t d;
- for (i = 1; i <= min; i++)
- {
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINC(d, eptr);
- if (fc == d || (uint32_t)foc == d) RRETURN(MATCH_NOMATCH);
- }
- }
- else
-#endif /* SUPPORT_UNICODE */
- /* Not UTF mode */
- {
- for (i = 1; i <= min; i++)
+ case PT_SPACE: /* Perl space */
+ case PT_PXSPACE: /* POSIX space */
+ switch(fc)
{
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- if (fc == *eptr || foc == *eptr) RRETURN(MATCH_NOMATCH);
- eptr++;
+ HSPACE_CASES:
+ VSPACE_CASES:
+ if (Fop == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
+ break;
+
+ default:
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z) ==
+ (Fop == OP_NOTPROP)) RRETURN(MATCH_NOMATCH);
+ break;
}
- }
+ break;
- if (min == max) continue;
+ case PT_WORD:
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
+ PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
+ fc == CHAR_UNDERSCORE) == (Fop == OP_NOTPROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- if (minimize)
- {
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- uint32_t d;
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM28);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINC(d, eptr);
- if (fc == d || (uint32_t)foc == d) RRETURN(MATCH_NOMATCH);
- }
- }
- else
-#endif /*SUPPORT_UNICODE */
- /* Not UTF mode */
+ case PT_CLIST:
+ cp = PRIV(ucd_caseless_sets) + Fecode[2];
+ for (;;)
{
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM29);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- if (fc == *eptr || foc == *eptr) RRETURN(MATCH_NOMATCH);
- eptr++;
- }
+ if (fc < *cp)
+ { if (Fop == OP_PROP) { RRETURN(MATCH_NOMATCH); } else break; }
+ if (fc == *cp++)
+ { if (Fop == OP_PROP) break; else { RRETURN(MATCH_NOMATCH); } }
}
- /* Control never gets here */
- }
-
- /* Maximize case */
-
- else
- {
- pp = eptr;
+ break;
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- uint32_t d;
- for (i = min; i < max; i++)
- {
- int len = 1;
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- break;
- }
- GETCHARLEN(d, eptr, len);
- if (fc == d || (uint32_t)foc == d) break;
- eptr += len;
- }
- if (possessive) continue; /* No backtracking */
+ case PT_UCNC:
+ if ((fc == CHAR_DOLLAR_SIGN || fc == CHAR_COMMERCIAL_AT ||
+ fc == CHAR_GRAVE_ACCENT || (fc >= 0xa0 && fc <= 0xd7ff) ||
+ fc >= 0xe000) == (Fop == OP_NOTPROP))
+ RRETURN(MATCH_NOMATCH);
+ break;
- /* After \C in UTF mode, pp might be in the middle of a Unicode
- character. Use <= pp to ensure backtracking doesn't go too far. */
+ /* This should never occur */
- for(;;)
- {
- if (eptr <= pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM30);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- BACKCHAR(eptr);
- }
- }
- else
-#endif /* SUPPORT_UNICODE */
- /* Not UTF mode */
- {
- for (i = min; i < max; i++)
- {
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- break;
- }
- if (fc == *eptr || foc == *eptr) break;
- eptr++;
- }
- if (possessive) continue; /* No backtracking */
- for (;;)
- {
- if (eptr == pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM31);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- }
- }
- /* Control never gets here */
+ default:
+ return PCRE2_ERROR_INTERNAL;
}
+
+ Fecode += 3;
}
+ break;
- /* Caseful comparisons */
+ /* ===================================================================== */
+ /* Match an extended Unicode sequence. We will get here only if the support
+ is in the binary; otherwise a compile-time error occurs. */
+
+ case OP_EXTUNI:
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
else
{
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- uint32_t d;
- for (i = 1; i <= min; i++)
- {
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINC(d, eptr);
- if (fc == d) RRETURN(MATCH_NOMATCH);
- }
- }
- else
-#endif
- /* Not UTF mode */
- {
- for (i = 1; i <= min; i++)
- {
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- if (fc == *eptr++) RRETURN(MATCH_NOMATCH);
- }
- }
-
- if (min == max) continue;
-
- if (minimize)
- {
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- uint32_t d;
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM32);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINC(d, eptr);
- if (fc == d) RRETURN(MATCH_NOMATCH);
- }
- }
- else
-#endif
- /* Not UTF mode */
- {
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM33);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- if (fc == *eptr++) RRETURN(MATCH_NOMATCH);
- }
- }
- /* Control never gets here */
- }
-
- /* Maximize case */
-
- else
- {
- pp = eptr;
+ GETCHARINCTEST(fc, Feptr);
+ Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, mb->end_subject, utf,
+ NULL);
+ }
+ CHECK_PARTIAL();
+ Fecode++;
+ break;
-#ifdef SUPPORT_UNICODE
- if (utf)
- {
- uint32_t d;
- for (i = min; i < max; i++)
- {
- int len = 1;
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- break;
- }
- GETCHARLEN(d, eptr, len);
- if (fc == d) break;
- eptr += len;
- }
- if (possessive) continue; /* No backtracking */
+#endif /* SUPPORT_UNICODE */
- /* After \C in UTF mode, pp might be in the middle of a Unicode
- character. Use <= pp to ensure backtracking doesn't go too far. */
- for(;;)
- {
- if (eptr <= pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM34);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- BACKCHAR(eptr);
- }
- }
- else
-#endif
- /* Not UTF mode */
- {
- for (i = min; i < max; i++)
- {
- if (eptr >= mb->end_subject)
- {
- SCHECK_PARTIAL();
- break;
- }
- if (fc == *eptr) break;
- eptr++;
- }
- if (possessive) continue; /* No backtracking */
- for (;;)
- {
- if (eptr == pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM35);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- }
- }
- /* Control never gets here */
- }
- }
- /* Control never gets here */
+ /* ===================================================================== */
+ /* Match a single character type repeatedly. Note that the property type
+ does not need to be in a stack frame as it not used within an RMATCH()
+ loop. */
- /* Match a single character type repeatedly; several different opcodes
- share code. This is very similar to the code for single characters, but we
- repeat it in the interests of efficiency. */
+#define Lstart_eptr F->temp_sptr[0]
+#define Lmin F->temp_32[0]
+#define Lmax F->temp_32[1]
+#define Lctype F->temp_32[2]
+#define Lpropvalue F->temp_32[3]
case OP_TYPEEXACT:
- min = max = GET2(ecode, 1);
- minimize = TRUE;
- ecode += 1 + IMM2_SIZE;
+ Lmin = Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
goto REPEATTYPE;
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
- min = 0;
- max = GET2(ecode, 1);
- minimize = *ecode == OP_TYPEMINUPTO;
- ecode += 1 + IMM2_SIZE;
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ reptype = (*Fecode == OP_TYPEMINUPTO)? REPTYPE_MIN : REPTYPE_MAX;
+ Fecode += 1 + IMM2_SIZE;
goto REPEATTYPE;
case OP_TYPEPOSSTAR:
- possessive = TRUE;
- min = 0;
- max = INT_MAX;
- ecode++;
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = UINT32_MAX;
+ Fecode++;
goto REPEATTYPE;
case OP_TYPEPOSPLUS:
- possessive = TRUE;
- min = 1;
- max = INT_MAX;
- ecode++;
+ reptype = REPTYPE_POS;
+ Lmin = 1;
+ Lmax = UINT32_MAX;
+ Fecode++;
goto REPEATTYPE;
case OP_TYPEPOSQUERY:
- possessive = TRUE;
- min = 0;
- max = 1;
- ecode++;
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = 1;
+ Fecode++;
goto REPEATTYPE;
case OP_TYPEPOSUPTO:
- possessive = TRUE;
- min = 0;
- max = GET2(ecode, 1);
- ecode += 1 + IMM2_SIZE;
+ reptype = REPTYPE_POS;
+ Lmin = 0;
+ Lmax = GET2(Fecode, 1);
+ Fecode += 1 + IMM2_SIZE;
goto REPEATTYPE;
case OP_TYPESTAR:
@@ -4211,127 +2512,122 @@ for (;;)
case OP_TYPEMINPLUS:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
- c = *ecode++ - OP_TYPESTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
+ fc = *Fecode++ - OP_TYPESTAR;
+ Lmin = rep_min[fc];
+ Lmax = rep_max[fc];
+ reptype = rep_typ[fc];
- /* Common code for all repeated single character type matches. Note that
- in UTF-8 mode, '.' matches a character of any length, but for the other
- character types, the valid characters are all one-byte long. */
+ /* Common code for all repeated character type matches. */
REPEATTYPE:
- ctype = *ecode++; /* Code for the character type */
+ Lctype = *Fecode++; /* Code for the character type */
#ifdef SUPPORT_UNICODE
- if (ctype == OP_PROP || ctype == OP_NOTPROP)
+ if (Lctype == OP_PROP || Lctype == OP_NOTPROP)
{
- prop_fail_result = ctype == OP_NOTPROP;
- prop_type = *ecode++;
- prop_value = *ecode++;
+ proptype = *Fecode++;
+ Lpropvalue = *Fecode++;
}
- else prop_type = -1;
+ else proptype = -1;
#endif
/* First, ensure the minimum number of matches are present. Use inline
code for maximizing the speed, and do the type test once at the start
- (i.e. keep it out of the loop). Separate the UTF-8 code completely as that
- is tidier. Also separate the UCP code, which can be the same for both UTF-8
- and single-bytes. */
+ (i.e. keep it out of the loop). The code for UTF mode is separated out for
+ tidiness, except for Unicode property tests. */
- if (min > 0)
+ if (Lmin > 0)
{
#ifdef SUPPORT_UNICODE
- if (prop_type >= 0)
+ if (proptype >= 0) /* Property tests in all modes */
{
- switch(prop_type)
+ switch(proptype)
{
case PT_ANY:
- if (prop_fail_result) RRETURN(MATCH_NOMATCH);
- for (i = 1; i <= min; i++)
+ if (Lctype == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
+ GETCHARINCTEST(fc, Feptr);
}
break;
case PT_LAMP:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
int chartype;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- chartype = UCD_CHARTYPE(c);
+ GETCHARINCTEST(fc, Feptr);
+ chartype = UCD_CHARTYPE(fc);
if ((chartype == ucp_Lu ||
chartype == ucp_Ll ||
- chartype == ucp_Lt) == prop_fail_result)
+ chartype == ucp_Lt) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
case PT_GC:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((UCD_CATEGORY(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
case PT_PC:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((UCD_CHARTYPE(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
case PT_SC:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((UCD_SCRIPT(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
case PT_ALNUM:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
int category;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- category = UCD_CATEGORY(c);
- if ((category == ucp_L || category == ucp_N) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ category = UCD_CATEGORY(fc);
+ if ((category == ucp_L || category == ucp_N) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
@@ -4342,23 +2638,23 @@ for (;;)
case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- switch(c)
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
{
HSPACE_CASES:
VSPACE_CASES:
- if (prop_fail_result) RRETURN(MATCH_NOMATCH);
+ if (Lctype == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
break;
default:
- if ((UCD_CATEGORY(c) == ucp_Z) == prop_fail_result)
+ if ((UCD_CATEGORY(fc) == ucp_Z) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
break;
}
@@ -4366,55 +2662,61 @@ for (;;)
break;
case PT_WORD:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
int category;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- category = UCD_CATEGORY(c);
- if ((category == ucp_L || category == ucp_N || c == CHAR_UNDERSCORE)
- == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ category = UCD_CATEGORY(fc);
+ if ((category == ucp_L || category == ucp_N ||
+ fc == CHAR_UNDERSCORE) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
case PT_CLIST:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
const uint32_t *cp;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- cp = PRIV(ucd_caseless_sets) + prop_value;
+ GETCHARINCTEST(fc, Feptr);
+ cp = PRIV(ucd_caseless_sets) + Lpropvalue;
for (;;)
{
- if (c < *cp)
- { if (prop_fail_result) break; else { RRETURN(MATCH_NOMATCH); } }
- if (c == *cp++)
- { if (prop_fail_result) { RRETURN(MATCH_NOMATCH); } else break; }
+ if (fc < *cp)
+ {
+ if (Lctype == OP_NOTPROP) break;
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (fc == *cp++)
+ {
+ if (Lctype == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
+ break;
+ }
}
}
break;
case PT_UCNC:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((c == CHAR_DOLLAR_SIGN || c == CHAR_COMMERCIAL_AT ||
- c == CHAR_GRAVE_ACCENT || (c >= 0xa0 && c <= 0xd7ff) ||
- c >= 0xe000) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((fc == CHAR_DOLLAR_SIGN || fc == CHAR_COMMERCIAL_AT ||
+ fc == CHAR_GRAVE_ACCENT || (fc >= 0xa0 && fc <= 0xd7ff) ||
+ fc >= 0xe000) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
break;
@@ -4422,105 +2724,95 @@ for (;;)
/* This should not occur */
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
}
/* Match extended Unicode sequences. We will get here only if the
support is in the binary; otherwise a compile-time error occurs. */
- else if (ctype == OP_EXTUNI)
+ else if (Lctype == OP_EXTUNI)
{
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
else
{
- int lgb, rgb;
- GETCHARINCTEST(c, eptr);
- lgb = UCD_GRAPHBREAK(c);
- while (eptr < mb->end_subject)
- {
- int len = 1;
- if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
- rgb = UCD_GRAPHBREAK(c);
- if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
- lgb = rgb;
- eptr += len;
- }
+ GETCHARINCTEST(fc, Feptr);
+ Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject,
+ mb->end_subject, utf, NULL);
}
CHECK_PARTIAL();
}
}
-
else
#endif /* SUPPORT_UNICODE */
-/* Handle all other cases when the coding is UTF-8 */
+/* Handle all other cases in UTF mode */
#ifdef SUPPORT_UNICODE
- if (utf) switch(ctype)
+ if (utf) switch(Lctype)
{
case OP_ANY:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(Feptr)) RRETURN(MATCH_NOMATCH);
if (mb->partial != 0 &&
- eptr + 1 >= mb->end_subject &&
+ Feptr + 1 >= mb->end_subject &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
- UCHAR21(eptr) == NLBLOCK->nl[0])
+ UCHAR21(Feptr) == NLBLOCK->nl[0])
{
mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
- eptr++;
- ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
+ Feptr++;
+ ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
}
break;
case OP_ALLANY:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- eptr++;
- ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
+ Feptr++;
+ ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
}
break;
case OP_ANYBYTE:
- if (eptr > mb->end_subject - min) RRETURN(MATCH_NOMATCH);
- eptr += min;
+ if (Feptr > mb->end_subject - Lmin) RRETURN(MATCH_NOMATCH);
+ Feptr += Lmin;
break;
case OP_ANYNL:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- switch(c)
+ GETCHARINC(fc, Feptr);
+ switch(fc)
{
default: RRETURN(MATCH_NOMATCH);
case CHAR_CR:
- if (eptr < mb->end_subject && UCHAR21(eptr) == CHAR_LF) eptr++;
+ if (Feptr < mb->end_subject && UCHAR21(Feptr) == CHAR_LF) Feptr++;
break;
case CHAR_LF:
@@ -4540,49 +2832,49 @@ for (;;)
break;
case OP_NOT_HSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- switch(c)
+ GETCHARINC(fc, Feptr);
+ switch(fc)
{
- HSPACE_CASES: RRETURN(MATCH_NOMATCH); /* Byte and multibyte cases */
+ HSPACE_CASES: RRETURN(MATCH_NOMATCH);
default: break;
}
}
break;
case OP_HSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- switch(c)
+ GETCHARINC(fc, Feptr);
+ switch(fc)
{
- HSPACE_CASES: break; /* Byte and multibyte cases */
+ HSPACE_CASES: break;
default: RRETURN(MATCH_NOMATCH);
}
}
break;
case OP_NOT_VSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- switch(c)
+ GETCHARINC(fc, Feptr);
+ switch(fc)
{
VSPACE_CASES: RRETURN(MATCH_NOMATCH);
default: break;
@@ -4591,15 +2883,15 @@ for (;;)
break;
case OP_VSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- switch(c)
+ GETCHARINC(fc, Feptr);
+ switch(fc)
{
VSPACE_CASES: break;
default: RRETURN(MATCH_NOMATCH);
@@ -4608,170 +2900,174 @@ for (;;)
break;
case OP_NOT_DIGIT:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINC(c, eptr);
- if (c < 128 && (mb->ctypes[c] & ctype_digit) != 0)
+ GETCHARINC(fc, Feptr);
+ if (fc < 128 && (mb->ctypes[fc] & ctype_digit) != 0)
RRETURN(MATCH_NOMATCH);
}
break;
case OP_DIGIT:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
uint32_t cc;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- cc = UCHAR21(eptr);
+ cc = UCHAR21(Feptr);
if (cc >= 128 || (mb->ctypes[cc] & ctype_digit) == 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
- /* No need to skip more bytes - we know it's a 1-byte character */
+ Feptr++;
+ /* No need to skip more code units - we know it has only one. */
}
break;
case OP_NOT_WHITESPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
uint32_t cc;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- cc = UCHAR21(eptr);
+ cc = UCHAR21(Feptr);
if (cc < 128 && (mb->ctypes[cc] & ctype_space) != 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
- ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
+ Feptr++;
+ ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
}
break;
case OP_WHITESPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
uint32_t cc;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- cc = UCHAR21(eptr);
+ cc = UCHAR21(Feptr);
if (cc >= 128 || (mb->ctypes[cc] & ctype_space) == 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
- /* No need to skip more bytes - we know it's a 1-byte character */
+ Feptr++;
+ /* No need to skip more code units - we know it has only one. */
}
break;
case OP_NOT_WORDCHAR:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
uint32_t cc;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- cc = UCHAR21(eptr);
+ cc = UCHAR21(Feptr);
if (cc < 128 && (mb->ctypes[cc] & ctype_word) != 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
- ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
+ Feptr++;
+ ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
}
break;
case OP_WORDCHAR:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
uint32_t cc;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- cc = UCHAR21(eptr);
+ cc = UCHAR21(Feptr);
if (cc >= 128 || (mb->ctypes[cc] & ctype_word) == 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
- /* No need to skip more bytes - we know it's a 1-byte character */
+ Feptr++;
+ /* No need to skip more code units - we know it has only one. */
}
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
- } /* End switch(ctype) */
+ return PCRE2_ERROR_INTERNAL;
+ } /* End switch(Lctype) */
else
#endif /* SUPPORT_UNICODE */
- /* Code for the non-UTF-8 case for minimum matching of operators other
+ /* Code for the non-UTF case for minimum matching of operators other
than OP_PROP and OP_NOTPROP. */
- switch(ctype)
+ switch(Lctype)
{
case OP_ANY:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(Feptr)) RRETURN(MATCH_NOMATCH);
if (mb->partial != 0 &&
- eptr + 1 >= mb->end_subject &&
+ Feptr + 1 >= mb->end_subject &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
- *eptr == NLBLOCK->nl[0])
+ *Feptr == NLBLOCK->nl[0])
{
mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
- eptr++;
+ Feptr++;
}
break;
case OP_ALLANY:
- if (eptr > mb->end_subject - min)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- eptr += min;
- break;
-
- case OP_ANYBYTE:
- if (eptr > mb->end_subject - min)
+ if (Feptr > mb->end_subject - Lmin)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- eptr += min;
+ Feptr += Lmin;
break;
+ /* This OP_ANYBYTE case will never be reached because \C gets turned
+ into OP_ALLANY in non-UTF mode. Cut out the code so that coverage
+ reports don't complain about it's never being used. */
+
+/* case OP_ANYBYTE:
+* if (Feptr > mb->end_subject - Lmin)
+* {
+* SCHECK_PARTIAL();
+* RRETURN(MATCH_NOMATCH);
+* }
+* Feptr += Lmin;
+* break;
+*/
case OP_ANYNL:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- switch(*eptr++)
+ switch(*Feptr++)
{
default: RRETURN(MATCH_NOMATCH);
case CHAR_CR:
- if (eptr < mb->end_subject && *eptr == CHAR_LF) eptr++;
+ if (Feptr < mb->end_subject && *Feptr == CHAR_LF) Feptr++;
break;
case CHAR_LF:
@@ -4791,14 +3087,14 @@ for (;;)
break;
case OP_NOT_HSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- switch(*eptr++)
+ switch(*Feptr++)
{
default: break;
HSPACE_BYTE_CASES:
@@ -4811,14 +3107,14 @@ for (;;)
break;
case OP_HSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- switch(*eptr++)
+ switch(*Feptr++)
{
default: RRETURN(MATCH_NOMATCH);
HSPACE_BYTE_CASES:
@@ -4831,14 +3127,14 @@ for (;;)
break;
case OP_NOT_VSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- switch(*eptr++)
+ switch(*Feptr++)
{
VSPACE_BYTE_CASES:
#if PCRE2_CODE_UNIT_WIDTH != 8
@@ -4851,14 +3147,14 @@ for (;;)
break;
case OP_VSPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- switch(*eptr++)
+ switch(*Feptr++)
{
default: RRETURN(MATCH_NOMATCH);
VSPACE_BYTE_CASES:
@@ -4871,212 +3167,212 @@ for (;;)
break;
case OP_NOT_DIGIT:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (MAX_255(*eptr) && (mb->ctypes[*eptr] & ctype_digit) != 0)
+ if (MAX_255(*Feptr) && (mb->ctypes[*Feptr] & ctype_digit) != 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
+ Feptr++;
}
break;
case OP_DIGIT:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (!MAX_255(*eptr) || (mb->ctypes[*eptr] & ctype_digit) == 0)
+ if (!MAX_255(*Feptr) || (mb->ctypes[*Feptr] & ctype_digit) == 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
+ Feptr++;
}
break;
case OP_NOT_WHITESPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (MAX_255(*eptr) && (mb->ctypes[*eptr] & ctype_space) != 0)
+ if (MAX_255(*Feptr) && (mb->ctypes[*Feptr] & ctype_space) != 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
+ Feptr++;
}
break;
case OP_WHITESPACE:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (!MAX_255(*eptr) || (mb->ctypes[*eptr] & ctype_space) == 0)
+ if (!MAX_255(*Feptr) || (mb->ctypes[*Feptr] & ctype_space) == 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
+ Feptr++;
}
break;
case OP_NOT_WORDCHAR:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (MAX_255(*eptr) && (mb->ctypes[*eptr] & ctype_word) != 0)
+ if (MAX_255(*Feptr) && (mb->ctypes[*Feptr] & ctype_word) != 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
+ Feptr++;
}
break;
case OP_WORDCHAR:
- for (i = 1; i <= min; i++)
+ for (i = 1; i <= Lmin; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (!MAX_255(*eptr) || (mb->ctypes[*eptr] & ctype_word) == 0)
+ if (!MAX_255(*Feptr) || (mb->ctypes[*Feptr] & ctype_word) == 0)
RRETURN(MATCH_NOMATCH);
- eptr++;
+ Feptr++;
}
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
}
- /* If min = max, continue at the same level without recursing */
+ /* If Lmin = Lmax we are done. Continue with the main loop. */
- if (min == max) continue;
+ if (Lmin == Lmax) continue;
/* If minimizing, we have to test the rest of the pattern before each
- subsequent match. Again, separate the UTF-8 case for speed, and also
- separate the UCP cases. */
+ subsequent match. */
- if (minimize)
+ if (reptype == REPTYPE_MIN)
{
#ifdef SUPPORT_UNICODE
- if (prop_type >= 0)
+ if (proptype >= 0)
{
- switch(prop_type)
+ switch(proptype)
{
case PT_ANY:
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM36);
+ RMATCH(Fecode, RM208);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if (prop_fail_result) RRETURN(MATCH_NOMATCH);
+ GETCHARINCTEST(fc, Feptr);
+ if (Lctype == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
case PT_LAMP:
- for (fi = min;; fi++)
+ for (;;)
{
int chartype;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM37);
+ RMATCH(Fecode, RM209);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- chartype = UCD_CHARTYPE(c);
+ GETCHARINCTEST(fc, Feptr);
+ chartype = UCD_CHARTYPE(fc);
if ((chartype == ucp_Lu ||
chartype == ucp_Ll ||
- chartype == ucp_Lt) == prop_fail_result)
+ chartype == ucp_Lt) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
case PT_GC:
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM38);
+ RMATCH(Fecode, RM210);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((UCD_CATEGORY(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
case PT_PC:
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM39);
+ RMATCH(Fecode, RM211);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((UCD_CHARTYPE(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
case PT_SC:
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM40);
+ RMATCH(Fecode, RM212);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((UCD_SCRIPT(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
case PT_ALNUM:
- for (fi = min;; fi++)
+ for (;;)
{
int category;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM59);
+ RMATCH(Fecode, RM213);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- category = UCD_CATEGORY(c);
- if ((category == ucp_L || category == ucp_N) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ category = UCD_CATEGORY(fc);
+ if ((category == ucp_L || category == ucp_N) ==
+ (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -5087,26 +3383,26 @@ for (;;)
case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM61);
+ RMATCH(Fecode, RM214);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- switch(c)
+ GETCHARINCTEST(fc, Feptr);
+ switch(fc)
{
HSPACE_CASES:
VSPACE_CASES:
- if (prop_fail_result) RRETURN(MATCH_NOMATCH);
+ if (Lctype == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
break;
default:
- if ((UCD_CATEGORY(c) == ucp_Z) == prop_fail_result)
+ if ((UCD_CATEGORY(fc) == ucp_Z) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
break;
}
@@ -5114,105 +3410,101 @@ for (;;)
/* Control never gets here */
case PT_WORD:
- for (fi = min;; fi++)
+ for (;;)
{
int category;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM62);
+ RMATCH(Fecode, RM215);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- category = UCD_CATEGORY(c);
+ GETCHARINCTEST(fc, Feptr);
+ category = UCD_CATEGORY(fc);
if ((category == ucp_L ||
category == ucp_N ||
- c == CHAR_UNDERSCORE)
- == prop_fail_result)
+ fc == CHAR_UNDERSCORE) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
case PT_CLIST:
- for (fi = min;; fi++)
+ for (;;)
{
const uint32_t *cp;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM67);
+ RMATCH(Fecode, RM216);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- cp = PRIV(ucd_caseless_sets) + prop_value;
+ GETCHARINCTEST(fc, Feptr);
+ cp = PRIV(ucd_caseless_sets) + Lpropvalue;
for (;;)
{
- if (c < *cp)
- { if (prop_fail_result) break; else { RRETURN(MATCH_NOMATCH); } }
- if (c == *cp++)
- { if (prop_fail_result) { RRETURN(MATCH_NOMATCH); } else break; }
+ if (fc < *cp)
+ {
+ if (Lctype == OP_NOTPROP) break;
+ RRETURN(MATCH_NOMATCH);
+ }
+ if (fc == *cp++)
+ {
+ if (Lctype == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
+ break;
+ }
}
}
/* Control never gets here */
case PT_UCNC:
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM60);
+ RMATCH(Fecode, RM217);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- GETCHARINCTEST(c, eptr);
- if ((c == CHAR_DOLLAR_SIGN || c == CHAR_COMMERCIAL_AT ||
- c == CHAR_GRAVE_ACCENT || (c >= 0xa0 && c <= 0xd7ff) ||
- c >= 0xe000) == prop_fail_result)
+ GETCHARINCTEST(fc, Feptr);
+ if ((fc == CHAR_DOLLAR_SIGN || fc == CHAR_COMMERCIAL_AT ||
+ fc == CHAR_GRAVE_ACCENT || (fc >= 0xa0 && fc <= 0xd7ff) ||
+ fc >= 0xe000) == (Lctype == OP_NOTPROP))
RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
/* This should never occur */
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
}
/* Match extended Unicode sequences. We will get here only if the
support is in the binary; otherwise a compile-time error occurs. */
- else if (ctype == OP_EXTUNI)
+ else if (Lctype == OP_EXTUNI)
{
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM41);
+ RMATCH(Fecode, RM218);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
else
{
- int lgb, rgb;
- GETCHARINCTEST(c, eptr);
- lgb = UCD_GRAPHBREAK(c);
- while (eptr < mb->end_subject)
- {
- int len = 1;
- if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
- rgb = UCD_GRAPHBREAK(c);
- if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
- lgb = rgb;
- eptr += len;
- }
+ GETCHARINCTEST(fc, Feptr);
+ Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, mb->end_subject,
+ utf, NULL);
}
CHECK_PARTIAL();
}
@@ -5220,33 +3512,34 @@ for (;;)
else
#endif /* SUPPORT_UNICODE */
+ /* UTF mode for non-property testing character types. */
+
#ifdef SUPPORT_UNICODE
if (utf)
{
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM42);
+ RMATCH(Fecode, RM219);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (ctype == OP_ANY && IS_NEWLINE(eptr))
- RRETURN(MATCH_NOMATCH);
- GETCHARINC(c, eptr);
- switch(ctype)
+ if (Lctype == OP_ANY && IS_NEWLINE(Feptr)) RRETURN(MATCH_NOMATCH);
+ GETCHARINC(fc, Feptr);
+ switch(Lctype)
{
case OP_ANY: /* This is the non-NL case */
if (mb->partial != 0 && /* Take care with CRLF partial */
- eptr >= mb->end_subject &&
+ Feptr >= mb->end_subject &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
- c == NLBLOCK->nl[0])
+ fc == NLBLOCK->nl[0])
{
mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
break;
@@ -5255,11 +3548,12 @@ for (;;)
break;
case OP_ANYNL:
- switch(c)
+ switch(fc)
{
default: RRETURN(MATCH_NOMATCH);
+
case CHAR_CR:
- if (eptr < mb->end_subject && UCHAR21(eptr) == CHAR_LF) eptr++;
+ if (Feptr < mb->end_subject && UCHAR21(Feptr) == CHAR_LF) Feptr++;
break;
case CHAR_LF:
@@ -5272,13 +3566,14 @@ for (;;)
case 0x2028:
case 0x2029:
#endif /* Not EBCDIC */
- if (mb->bsr_convention == PCRE2_BSR_ANYCRLF) RRETURN(MATCH_NOMATCH);
+ if (mb->bsr_convention == PCRE2_BSR_ANYCRLF)
+ RRETURN(MATCH_NOMATCH);
break;
}
break;
case OP_NOT_HSPACE:
- switch(c)
+ switch(fc)
{
HSPACE_CASES: RRETURN(MATCH_NOMATCH);
default: break;
@@ -5286,7 +3581,7 @@ for (;;)
break;
case OP_HSPACE:
- switch(c)
+ switch(fc)
{
HSPACE_CASES: break;
default: RRETURN(MATCH_NOMATCH);
@@ -5294,7 +3589,7 @@ for (;;)
break;
case OP_NOT_VSPACE:
- switch(c)
+ switch(fc)
{
VSPACE_CASES: RRETURN(MATCH_NOMATCH);
default: break;
@@ -5302,7 +3597,7 @@ for (;;)
break;
case OP_VSPACE:
- switch(c)
+ switch(fc)
{
VSPACE_CASES: break;
default: RRETURN(MATCH_NOMATCH);
@@ -5310,68 +3605,69 @@ for (;;)
break;
case OP_NOT_DIGIT:
- if (c < 256 && (mb->ctypes[c] & ctype_digit) != 0)
+ if (fc < 256 && (mb->ctypes[fc] & ctype_digit) != 0)
RRETURN(MATCH_NOMATCH);
break;
case OP_DIGIT:
- if (c >= 256 || (mb->ctypes[c] & ctype_digit) == 0)
+ if (fc >= 256 || (mb->ctypes[fc] & ctype_digit) == 0)
RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WHITESPACE:
- if (c < 256 && (mb->ctypes[c] & ctype_space) != 0)
+ if (fc < 256 && (mb->ctypes[fc] & ctype_space) != 0)
RRETURN(MATCH_NOMATCH);
break;
case OP_WHITESPACE:
- if (c >= 256 || (mb->ctypes[c] & ctype_space) == 0)
+ if (fc >= 256 || (mb->ctypes[fc] & ctype_space) == 0)
RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WORDCHAR:
- if (c < 256 && (mb->ctypes[c] & ctype_word) != 0)
+ if (fc < 256 && (mb->ctypes[fc] & ctype_word) != 0)
RRETURN(MATCH_NOMATCH);
break;
case OP_WORDCHAR:
- if (c >= 256 || (mb->ctypes[c] & ctype_word) == 0)
+ if (fc >= 256 || (mb->ctypes[fc] & ctype_word) == 0)
RRETURN(MATCH_NOMATCH);
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
}
}
else
-#endif
+#endif /* SUPPORT_UNICODE */
+
/* Not UTF mode */
{
- for (fi = min;; fi++)
+ for (;;)
{
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM43);
+ RMATCH(Fecode, RM33);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= mb->end_subject)
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
}
- if (ctype == OP_ANY && IS_NEWLINE(eptr))
+ if (Lctype == OP_ANY && IS_NEWLINE(Feptr))
RRETURN(MATCH_NOMATCH);
- c = *eptr++;
- switch(ctype)
+ fc = *Feptr++;
+ switch(Lctype)
{
case OP_ANY: /* This is the non-NL case */
if (mb->partial != 0 && /* Take care with CRLF partial */
- eptr >= mb->end_subject &&
+ Feptr >= mb->end_subject &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
- c == NLBLOCK->nl[0])
+ fc == NLBLOCK->nl[0])
{
mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
break;
@@ -5380,11 +3676,12 @@ for (;;)
break;
case OP_ANYNL:
- switch(c)
+ switch(fc)
{
default: RRETURN(MATCH_NOMATCH);
+
case CHAR_CR:
- if (eptr < mb->end_subject && *eptr == CHAR_LF) eptr++;
+ if (Feptr < mb->end_subject && *Feptr == CHAR_LF) Feptr++;
break;
case CHAR_LF:
@@ -5397,13 +3694,14 @@ for (;;)
case 0x2028:
case 0x2029:
#endif
- if (mb->bsr_convention == PCRE2_BSR_ANYCRLF) RRETURN(MATCH_NOMATCH);
+ if (mb->bsr_convention == PCRE2_BSR_ANYCRLF)
+ RRETURN(MATCH_NOMATCH);
break;
}
break;
case OP_NOT_HSPACE:
- switch(c)
+ switch(fc)
{
default: break;
HSPACE_BYTE_CASES:
@@ -5415,7 +3713,7 @@ for (;;)
break;
case OP_HSPACE:
- switch(c)
+ switch(fc)
{
default: RRETURN(MATCH_NOMATCH);
HSPACE_BYTE_CASES:
@@ -5427,7 +3725,7 @@ for (;;)
break;
case OP_NOT_VSPACE:
- switch(c)
+ switch(fc)
{
default: break;
VSPACE_BYTE_CASES:
@@ -5439,7 +3737,7 @@ for (;;)
break;
case OP_VSPACE:
- switch(c)
+ switch(fc)
{
default: RRETURN(MATCH_NOMATCH);
VSPACE_BYTE_CASES:
@@ -5451,31 +3749,37 @@ for (;;)
break;
case OP_NOT_DIGIT:
- if (MAX_255(c) && (mb->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
+ if (MAX_255(fc) && (mb->ctypes[fc] & ctype_digit) != 0)
+ RRETURN(MATCH_NOMATCH);
break;
case OP_DIGIT:
- if (!MAX_255(c) || (mb->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
+ if (!MAX_255(fc) || (mb->ctypes[fc] & ctype_digit) == 0)
+ RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WHITESPACE:
- if (MAX_255(c) && (mb->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
+ if (MAX_255(fc) && (mb->ctypes[fc] & ctype_space) != 0)
+ RRETURN(MATCH_NOMATCH);
break;
case OP_WHITESPACE:
- if (!MAX_255(c) || (mb->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
+ if (!MAX_255(fc) || (mb->ctypes[fc] & ctype_space) == 0)
+ RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WORDCHAR:
- if (MAX_255(c) && (mb->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH);
+ if (MAX_255(fc) && (mb->ctypes[fc] & ctype_word) != 0)
+ RRETURN(MATCH_NOMATCH);
break;
case OP_WORDCHAR:
- if (!MAX_255(c) || (mb->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH);
+ if (!MAX_255(fc) || (mb->ctypes[fc] & ctype_word) == 0)
+ RRETURN(MATCH_NOMATCH);
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
}
}
@@ -5483,113 +3787,116 @@ for (;;)
}
/* If maximizing, it is worth using inline code for speed, doing the type
- test once at the start (i.e. keep it out of the loop). Again, keep the
- UTF-8 and UCP stuff separate. */
+ test once at the start (i.e. keep it out of the loop). */
else
{
- pp = eptr; /* Remember where we started */
+ Lstart_eptr = Feptr; /* Remember where we started */
#ifdef SUPPORT_UNICODE
- if (prop_type >= 0)
+ if (proptype >= 0)
{
- switch(prop_type)
+ switch(proptype)
{
case PT_ANY:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- if (prop_fail_result) break;
- eptr+= len;
+ GETCHARLENTEST(fc, Feptr, len);
+ if (Lctype == OP_NOTPROP) break;
+ Feptr+= len;
}
break;
case PT_LAMP:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int chartype;
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- chartype = UCD_CHARTYPE(c);
+ GETCHARLENTEST(fc, Feptr, len);
+ chartype = UCD_CHARTYPE(fc);
if ((chartype == ucp_Lu ||
chartype == ucp_Ll ||
- chartype == ucp_Lt) == prop_fail_result)
+ chartype == ucp_Lt) == (Lctype == OP_NOTPROP))
break;
- eptr+= len;
+ Feptr+= len;
}
break;
case PT_GC:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result) break;
- eptr+= len;
+ GETCHARLENTEST(fc, Feptr, len);
+ if ((UCD_CATEGORY(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
+ break;
+ Feptr+= len;
}
break;
case PT_PC:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result) break;
- eptr+= len;
+ GETCHARLENTEST(fc, Feptr, len);
+ if ((UCD_CHARTYPE(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
+ break;
+ Feptr+= len;
}
break;
case PT_SC:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result) break;
- eptr+= len;
+ GETCHARLENTEST(fc, Feptr, len);
+ if ((UCD_SCRIPT(fc) == Lpropvalue) == (Lctype == OP_NOTPROP))
+ break;
+ Feptr+= len;
}
break;
case PT_ALNUM:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int category;
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- category = UCD_CATEGORY(c);
- if ((category == ucp_L || category == ucp_N) == prop_fail_result)
+ GETCHARLENTEST(fc, Feptr, len);
+ category = UCD_CATEGORY(fc);
+ if ((category == ucp_L || category == ucp_N) ==
+ (Lctype == OP_NOTPROP))
break;
- eptr+= len;
+ Feptr+= len;
}
break;
@@ -5599,186 +3906,178 @@ for (;;)
case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- switch(c)
+ GETCHARLENTEST(fc, Feptr, len);
+ switch(fc)
{
HSPACE_CASES:
VSPACE_CASES:
- if (prop_fail_result) goto ENDLOOP99; /* Break the loop */
+ if (Lctype == OP_NOTPROP) goto ENDLOOP99; /* Break the loop */
break;
default:
- if ((UCD_CATEGORY(c) == ucp_Z) == prop_fail_result)
+ if ((UCD_CATEGORY(fc) == ucp_Z) == (Lctype == OP_NOTPROP))
goto ENDLOOP99; /* Break the loop */
break;
}
- eptr+= len;
+ Feptr+= len;
}
ENDLOOP99:
break;
case PT_WORD:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int category;
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- category = UCD_CATEGORY(c);
+ GETCHARLENTEST(fc, Feptr, len);
+ category = UCD_CATEGORY(fc);
if ((category == ucp_L || category == ucp_N ||
- c == CHAR_UNDERSCORE) == prop_fail_result)
+ fc == CHAR_UNDERSCORE) == (Lctype == OP_NOTPROP))
break;
- eptr+= len;
+ Feptr+= len;
}
break;
case PT_CLIST:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
const uint32_t *cp;
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- cp = PRIV(ucd_caseless_sets) + prop_value;
+ GETCHARLENTEST(fc, Feptr, len);
+ cp = PRIV(ucd_caseless_sets) + Lpropvalue;
for (;;)
{
- if (c < *cp)
- { if (prop_fail_result) break; else goto GOT_MAX; }
- if (c == *cp++)
- { if (prop_fail_result) goto GOT_MAX; else break; }
+ if (fc < *cp)
+ { if (Lctype == OP_NOTPROP) break; else goto GOT_MAX; }
+ if (fc == *cp++)
+ { if (Lctype == OP_NOTPROP) goto GOT_MAX; else break; }
}
- eptr += len;
+ Feptr += len;
}
GOT_MAX:
break;
case PT_UCNC:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLENTEST(c, eptr, len);
- if ((c == CHAR_DOLLAR_SIGN || c == CHAR_COMMERCIAL_AT ||
- c == CHAR_GRAVE_ACCENT || (c >= 0xa0 && c <= 0xd7ff) ||
- c >= 0xe000) == prop_fail_result)
+ GETCHARLENTEST(fc, Feptr, len);
+ if ((fc == CHAR_DOLLAR_SIGN || fc == CHAR_COMMERCIAL_AT ||
+ fc == CHAR_GRAVE_ACCENT || (fc >= 0xa0 && fc <= 0xd7ff) ||
+ fc >= 0xe000) == (Lctype == OP_NOTPROP))
break;
- eptr += len;
+ Feptr += len;
}
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
- /* eptr is now past the end of the maximum run */
+ /* Feptr is now past the end of the maximum run */
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
- /* After \C in UTF mode, pp might be in the middle of a Unicode
- character. Use <= pp to ensure backtracking doesn't go too far. */
+ /* After \C in UTF mode, Lstart_eptr might be in the middle of a
+ Unicode character. Use <= pp to ensure backtracking doesn't go too far.
+ */
for(;;)
{
- if (eptr <= pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM44);
+ if (Feptr <= Lstart_eptr) break;
+ RMATCH(Fecode, RM222);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- if (utf) BACKCHAR(eptr);
+ Feptr--;
+ if (utf) BACKCHAR(Feptr);
}
}
/* Match extended Unicode grapheme clusters. We will get here only if the
support is in the binary; otherwise a compile-time error occurs. */
- else if (ctype == OP_EXTUNI)
+ else if (Lctype == OP_EXTUNI)
{
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
else
{
- int lgb, rgb;
- GETCHARINCTEST(c, eptr);
- lgb = UCD_GRAPHBREAK(c);
- while (eptr < mb->end_subject)
- {
- int len = 1;
- if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
- rgb = UCD_GRAPHBREAK(c);
- if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
- lgb = rgb;
- eptr += len;
- }
+ GETCHARINCTEST(fc, Feptr);
+ Feptr = PRIV(extuni)(fc, Feptr, mb->start_subject, mb->end_subject,
+ utf, NULL);
}
CHECK_PARTIAL();
}
- /* eptr is now past the end of the maximum run */
+ /* Feptr is now past the end of the maximum run */
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
- /* We use <= pp rather than == pp to detect the start of the run while
- backtracking because the use of \C in UTF mode can cause BACKCHAR to
- move back past pp. This is just palliative; the use of \C in UTF mode
- is fraught with danger. */
+ /* We use <= Lstart_eptr rather than == Lstart_eptr to detect the start
+ of the run while backtracking because the use of \C in UTF mode can
+ cause BACKCHAR to move back past Lstart_eptr. This is just palliative;
+ the use of \C in UTF mode is fraught with danger. */
for(;;)
{
int lgb, rgb;
PCRE2_SPTR fptr;
- if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM45);
+ if (Feptr <= Lstart_eptr) break; /* At start of char run */
+ RMATCH(Fecode, RM220);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
/* Backtracking over an extended grapheme cluster involves inspecting
the previous two characters (if present) to see if a break is
permitted between them. */
- eptr--;
- if (!utf) c = *eptr; else
+ Feptr--;
+ if (!utf) fc = *Feptr; else
{
- BACKCHAR(eptr);
- GETCHAR(c, eptr);
+ BACKCHAR(Feptr);
+ GETCHAR(fc, Feptr);
}
- rgb = UCD_GRAPHBREAK(c);
+ rgb = UCD_GRAPHBREAK(fc);
for (;;)
{
- if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
- fptr = eptr - 1;
- if (!utf) c = *fptr; else
+ if (Feptr <= Lstart_eptr) break; /* At start of char run */
+ fptr = Feptr - 1;
+ if (!utf) fc = *fptr; else
{
BACKCHAR(fptr);
- GETCHAR(c, fptr);
+ GETCHAR(fc, fptr);
}
- lgb = UCD_GRAPHBREAK(c);
+ lgb = UCD_GRAPHBREAK(fc);
if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
- eptr = fptr;
+ Feptr = fptr;
rgb = lgb;
}
}
@@ -5790,325 +4089,328 @@ for (;;)
#ifdef SUPPORT_UNICODE
if (utf)
{
- switch(ctype)
+ switch(Lctype)
{
case OP_ANY:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (IS_NEWLINE(eptr)) break;
+ if (IS_NEWLINE(Feptr)) break;
if (mb->partial != 0 && /* Take care with CRLF partial */
- eptr + 1 >= mb->end_subject &&
+ Feptr + 1 >= mb->end_subject &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
- UCHAR21(eptr) == NLBLOCK->nl[0])
+ UCHAR21(Feptr) == NLBLOCK->nl[0])
{
mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
- eptr++;
- ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
+ Feptr++;
+ ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
}
break;
case OP_ALLANY:
- if (max < INT_MAX)
+ if (Lmax < UINT32_MAX)
{
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- eptr++;
- ACROSSCHAR(eptr < mb->end_subject, *eptr, eptr++);
+ Feptr++;
+ ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
}
}
else
{
- eptr = mb->end_subject; /* Unlimited UTF-8 repeat */
+ Feptr = mb->end_subject; /* Unlimited UTF-8 repeat */
SCHECK_PARTIAL();
}
break;
- /* The byte case is the same as non-UTF8 */
+ /* The "byte" (i.e. "code unit") case is the same as non-UTF */
case OP_ANYBYTE:
- c = max - min;
- if (c > (uint32_t)(mb->end_subject - eptr))
+ fc = Lmax - Lmin;
+ if (fc > (uint32_t)(mb->end_subject - Feptr))
{
- eptr = mb->end_subject;
+ Feptr = mb->end_subject;
SCHECK_PARTIAL();
}
- else eptr += c;
+ else Feptr += fc;
break;
case OP_ANYNL:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c == CHAR_CR)
+ GETCHARLEN(fc, Feptr, len);
+ if (fc == CHAR_CR)
{
- if (++eptr >= mb->end_subject) break;
- if (UCHAR21(eptr) == CHAR_LF) eptr++;
+ if (++Feptr >= mb->end_subject) break;
+ if (UCHAR21(Feptr) == CHAR_LF) Feptr++;
}
else
{
- if (c != CHAR_LF &&
+ if (fc != CHAR_LF &&
(mb->bsr_convention == PCRE2_BSR_ANYCRLF ||
- (c != CHAR_VT && c != CHAR_FF && c != CHAR_NEL
+ (fc != CHAR_VT && fc != CHAR_FF && fc != CHAR_NEL
#ifndef EBCDIC
- && c != 0x2028 && c != 0x2029
+ && fc != 0x2028 && fc != 0x2029
#endif /* Not EBCDIC */
)))
break;
- eptr += len;
+ Feptr += len;
}
}
break;
case OP_NOT_HSPACE:
case OP_HSPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
BOOL gotspace;
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- switch(c)
+ GETCHARLEN(fc, Feptr, len);
+ switch(fc)
{
HSPACE_CASES: gotspace = TRUE; break;
default: gotspace = FALSE; break;
}
- if (gotspace == (ctype == OP_NOT_HSPACE)) break;
- eptr += len;
+ if (gotspace == (Lctype == OP_NOT_HSPACE)) break;
+ Feptr += len;
}
break;
case OP_NOT_VSPACE:
case OP_VSPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
BOOL gotspace;
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- switch(c)
+ GETCHARLEN(fc, Feptr, len);
+ switch(fc)
{
VSPACE_CASES: gotspace = TRUE; break;
default: gotspace = FALSE; break;
}
- if (gotspace == (ctype == OP_NOT_VSPACE)) break;
- eptr += len;
+ if (gotspace == (Lctype == OP_NOT_VSPACE)) break;
+ Feptr += len;
}
break;
case OP_NOT_DIGIT:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c < 256 && (mb->ctypes[c] & ctype_digit) != 0) break;
- eptr+= len;
+ GETCHARLEN(fc, Feptr, len);
+ if (fc < 256 && (mb->ctypes[fc] & ctype_digit) != 0) break;
+ Feptr+= len;
}
break;
case OP_DIGIT:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c >= 256 ||(mb->ctypes[c] & ctype_digit) == 0) break;
- eptr+= len;
+ GETCHARLEN(fc, Feptr, len);
+ if (fc >= 256 ||(mb->ctypes[fc] & ctype_digit) == 0) break;
+ Feptr+= len;
}
break;
case OP_NOT_WHITESPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c < 256 && (mb->ctypes[c] & ctype_space) != 0) break;
- eptr+= len;
+ GETCHARLEN(fc, Feptr, len);
+ if (fc < 256 && (mb->ctypes[fc] & ctype_space) != 0) break;
+ Feptr+= len;
}
break;
case OP_WHITESPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c >= 256 ||(mb->ctypes[c] & ctype_space) == 0) break;
- eptr+= len;
+ GETCHARLEN(fc, Feptr, len);
+ if (fc >= 256 ||(mb->ctypes[fc] & ctype_space) == 0) break;
+ Feptr+= len;
}
break;
case OP_NOT_WORDCHAR:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c < 256 && (mb->ctypes[c] & ctype_word) != 0) break;
- eptr+= len;
+ GETCHARLEN(fc, Feptr, len);
+ if (fc < 256 && (mb->ctypes[fc] & ctype_word) != 0) break;
+ Feptr+= len;
}
break;
case OP_WORDCHAR:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
int len = 1;
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- GETCHARLEN(c, eptr, len);
- if (c >= 256 || (mb->ctypes[c] & ctype_word) == 0) break;
- eptr+= len;
+ GETCHARLEN(fc, Feptr, len);
+ if (fc >= 256 || (mb->ctypes[fc] & ctype_word) == 0) break;
+ Feptr+= len;
}
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
- /* After \C in UTF mode, pp might be in the middle of a Unicode
- character. Use <= pp to ensure backtracking doesn't go too far. */
+ /* After \C in UTF mode, Lstart_eptr might be in the middle of a
+ Unicode character. Use <= Lstart_eptr to ensure backtracking doesn't go
+ too far. */
for(;;)
{
- if (eptr <= pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM46);
+ if (Feptr <= Lstart_eptr) break;
+ RMATCH(Fecode, RM221);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- BACKCHAR(eptr);
- if (ctype == OP_ANYNL && eptr > pp && UCHAR21(eptr) == CHAR_NL &&
- UCHAR21(eptr - 1) == CHAR_CR) eptr--;
+ Feptr--;
+ BACKCHAR(Feptr);
+ if (Lctype == OP_ANYNL && Feptr > Lstart_eptr &&
+ UCHAR21(Feptr) == CHAR_NL && UCHAR21(Feptr - 1) == CHAR_CR)
+ Feptr--;
}
}
else
#endif /* SUPPORT_UNICODE */
+
/* Not UTF mode */
{
- switch(ctype)
+ switch(Lctype)
{
case OP_ANY:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (IS_NEWLINE(eptr)) break;
+ if (IS_NEWLINE(Feptr)) break;
if (mb->partial != 0 && /* Take care with CRLF partial */
- eptr + 1 >= mb->end_subject &&
+ Feptr + 1 >= mb->end_subject &&
NLBLOCK->nltype == NLTYPE_FIXED &&
NLBLOCK->nllen == 2 &&
- *eptr == NLBLOCK->nl[0])
+ *Feptr == NLBLOCK->nl[0])
{
mb->hitend = TRUE;
- if (mb->partial > 1) RRETURN(PCRE2_ERROR_PARTIAL);
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
- eptr++;
+ Feptr++;
}
break;
case OP_ALLANY:
case OP_ANYBYTE:
- c = max - min;
- if (c > (uint32_t)(mb->end_subject - eptr))
+ fc = Lmax - Lmin;
+ if (fc > (uint32_t)(mb->end_subject - Feptr))
{
- eptr = mb->end_subject;
+ Feptr = mb->end_subject;
SCHECK_PARTIAL();
}
- else eptr += c;
+ else Feptr += fc;
break;
case OP_ANYNL:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- c = *eptr;
- if (c == CHAR_CR)
+ fc = *Feptr;
+ if (fc == CHAR_CR)
{
- if (++eptr >= mb->end_subject) break;
- if (*eptr == CHAR_LF) eptr++;
+ if (++Feptr >= mb->end_subject) break;
+ if (*Feptr == CHAR_LF) Feptr++;
}
else
{
- if (c != CHAR_LF && (mb->bsr_convention == PCRE2_BSR_ANYCRLF ||
- (c != CHAR_VT && c != CHAR_FF && c != CHAR_NEL
+ if (fc != CHAR_LF && (mb->bsr_convention == PCRE2_BSR_ANYCRLF ||
+ (fc != CHAR_VT && fc != CHAR_FF && fc != CHAR_NEL
#if PCRE2_CODE_UNIT_WIDTH != 8
- && c != 0x2028 && c != 0x2029
+ && fc != 0x2028 && fc != 0x2029
#endif
))) break;
- eptr++;
+ Feptr++;
}
}
break;
case OP_NOT_HSPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- switch(*eptr)
+ switch(*Feptr)
{
- default: eptr++; break;
+ default: Feptr++; break;
HSPACE_BYTE_CASES:
#if PCRE2_CODE_UNIT_WIDTH != 8
HSPACE_MULTIBYTE_CASES:
@@ -6120,37 +4422,37 @@ for (;;)
break;
case OP_HSPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- switch(*eptr)
+ switch(*Feptr)
{
default: goto ENDLOOP01;
HSPACE_BYTE_CASES:
#if PCRE2_CODE_UNIT_WIDTH != 8
HSPACE_MULTIBYTE_CASES:
#endif
- eptr++; break;
+ Feptr++; break;
}
}
ENDLOOP01:
break;
case OP_NOT_VSPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- switch(*eptr)
+ switch(*Feptr)
{
- default: eptr++; break;
+ default: Feptr++; break;
VSPACE_BYTE_CASES:
#if PCRE2_CODE_UNIT_WIDTH != 8
VSPACE_MULTIBYTE_CASES:
@@ -6162,251 +4464,1494 @@ for (;;)
break;
case OP_VSPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- switch(*eptr)
+ switch(*Feptr)
{
default: goto ENDLOOP03;
VSPACE_BYTE_CASES:
#if PCRE2_CODE_UNIT_WIDTH != 8
VSPACE_MULTIBYTE_CASES:
#endif
- eptr++; break;
+ Feptr++; break;
}
}
ENDLOOP03:
break;
case OP_NOT_DIGIT:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (MAX_255(*eptr) && (mb->ctypes[*eptr] & ctype_digit) != 0) break;
- eptr++;
+ if (MAX_255(*Feptr) && (mb->ctypes[*Feptr] & ctype_digit) != 0)
+ break;
+ Feptr++;
}
break;
case OP_DIGIT:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (!MAX_255(*eptr) || (mb->ctypes[*eptr] & ctype_digit) == 0) break;
- eptr++;
+ if (!MAX_255(*Feptr) || (mb->ctypes[*Feptr] & ctype_digit) == 0)
+ break;
+ Feptr++;
}
break;
case OP_NOT_WHITESPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (MAX_255(*eptr) && (mb->ctypes[*eptr] & ctype_space) != 0) break;
- eptr++;
+ if (MAX_255(*Feptr) && (mb->ctypes[*Feptr] & ctype_space) != 0)
+ break;
+ Feptr++;
}
break;
case OP_WHITESPACE:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (!MAX_255(*eptr) || (mb->ctypes[*eptr] & ctype_space) == 0) break;
- eptr++;
+ if (!MAX_255(*Feptr) || (mb->ctypes[*Feptr] & ctype_space) == 0)
+ break;
+ Feptr++;
}
break;
case OP_NOT_WORDCHAR:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (MAX_255(*eptr) && (mb->ctypes[*eptr] & ctype_word) != 0) break;
- eptr++;
+ if (MAX_255(*Feptr) && (mb->ctypes[*Feptr] & ctype_word) != 0)
+ break;
+ Feptr++;
}
break;
case OP_WORDCHAR:
- for (i = min; i < max; i++)
+ for (i = Lmin; i < Lmax; i++)
{
- if (eptr >= mb->end_subject)
+ if (Feptr >= mb->end_subject)
{
SCHECK_PARTIAL();
break;
}
- if (!MAX_255(*eptr) || (mb->ctypes[*eptr] & ctype_word) == 0) break;
- eptr++;
+ if (!MAX_255(*Feptr) || (mb->ctypes[*Feptr] & ctype_word) == 0)
+ break;
+ Feptr++;
}
break;
default:
- RRETURN(PCRE2_ERROR_INTERNAL);
+ return PCRE2_ERROR_INTERNAL;
}
- if (possessive) continue; /* No backtracking */
+ if (reptype == REPTYPE_POS) continue; /* No backtracking */
+
for (;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
- RMATCH(eptr, ecode, offset_top, mb, eptrb, RM47);
+ if (Feptr == Lstart_eptr) break;
+ RMATCH(Fecode, RM34);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- eptr--;
- if (ctype == OP_ANYNL && eptr > pp && *eptr == CHAR_LF &&
- eptr[-1] == CHAR_CR) eptr--;
+ Feptr--;
+ if (Lctype == OP_ANYNL && Feptr > Lstart_eptr && *Feptr == CHAR_LF &&
+ Feptr[-1] == CHAR_CR) Feptr--;
}
}
+ }
+ break; /* End of repeat character type processing */
+
+#undef Lstart_eptr
+#undef Lmin
+#undef Lmax
+#undef Lctype
+#undef Lpropvalue
+
+
+ /* ===================================================================== */
+ /* Match a back reference, possibly repeatedly. Look past the end of the
+ item to see if there is repeat information following. The OP_REF and
+ OP_REFI opcodes are used for a reference to a numbered group or to a
+ non-duplicated named group. For a duplicated named group, OP_DNREF and
+ OP_DNREFI are used. In this case we must scan the list of groups to which
+ the name refers, and use the first one that is set. */
+
+#define Lmin F->temp_32[0]
+#define Lmax F->temp_32[1]
+#define Lcaseless F->temp_32[2]
+#define Lstart F->temp_sptr[0]
+#define Loffset F->temp_size
+
+ case OP_DNREF:
+ case OP_DNREFI:
+ Lcaseless = (Fop == OP_DNREFI);
+ {
+ int count = GET2(Fecode, 1+IMM2_SIZE);
+ PCRE2_SPTR slot = mb->name_table + GET2(Fecode, 1) * mb->name_entry_size;
+ Fecode += 1 + 2*IMM2_SIZE;
+
+ while (count-- > 0)
+ {
+ Loffset = (GET2(slot, 0) << 1) - 2;
+ if (Loffset < Foffset_top && Fovector[Loffset] != PCRE2_UNSET) break;
+ slot += mb->name_entry_size;
+ }
+ }
+ goto REF_REPEAT;
+ case OP_REF:
+ case OP_REFI:
+ Lcaseless = (Fop == OP_REFI);
+ Loffset = (GET2(Fecode, 1) << 1) - 2;
+ Fecode += 1 + IMM2_SIZE;
+
+ /* Set up for repetition, or handle the non-repeated case. The maximum and
+ minimum must be in the heap frame, but as they are short-term values, we
+ use temporary fields. */
+
+ REF_REPEAT:
+ switch (*Fecode)
+ {
+ case OP_CRSTAR:
+ case OP_CRMINSTAR:
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
+ case OP_CRQUERY:
+ case OP_CRMINQUERY:
+ fc = *Fecode++ - OP_CRSTAR;
+ Lmin = rep_min[fc];
+ Lmax = rep_max[fc];
+ reptype = rep_typ[fc];
+ break;
+
+ case OP_CRRANGE:
+ case OP_CRMINRANGE:
+ Lmin = GET2(Fecode, 1);
+ Lmax = GET2(Fecode, 1 + IMM2_SIZE);
+ reptype = rep_typ[*Fecode - OP_CRSTAR];
+ if (Lmax == 0) Lmax = UINT32_MAX; /* Max 0 => infinity */
+ Fecode += 1 + 2 * IMM2_SIZE;
+ break;
+
+ default: /* No repeat follows */
+ {
+ rrc = match_ref(Loffset, Lcaseless, F, mb, &length);
+ if (rrc != 0)
+ {
+ if (rrc > 0) Feptr = mb->end_subject; /* Partial match */
+ CHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ }
+ Feptr += length;
+ continue; /* With the main loop */
+ }
+
+ /* Handle repeated back references. If a set group has length zero, just
+ continue with the main loop, because it matches however many times. For an
+ unset reference, if the minimum is zero, we can also just continue. We can
+ also continue if PCRE2_MATCH_UNSET_BACKREF is set, because this makes unset
+ group behave as a zero-length group. For any other unset cases, carrying
+ on will result in NOMATCH. */
+
+ if (Loffset < Foffset_top && Fovector[Loffset] != PCRE2_UNSET)
+ {
+ if (Fovector[Loffset] == Fovector[Loffset + 1]) continue;
+ }
+ else /* Group is not set */
+ {
+ if (Lmin == 0 || (mb->poptions & PCRE2_MATCH_UNSET_BACKREF) != 0)
+ continue;
+ }
+
+ /* First, ensure the minimum number of matches are present. */
+
+ for (i = 1; i <= Lmin; i++)
+ {
+ PCRE2_SIZE slength;
+ rrc = match_ref(Loffset, Lcaseless, F, mb, &slength);
+ if (rrc != 0)
+ {
+ if (rrc > 0) Feptr = mb->end_subject; /* Partial match */
+ CHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ Feptr += slength;
+ }
+
+ /* If min = max, we are done. They are not both allowed to be zero. */
+
+ if (Lmin == Lmax) continue;
+
+ /* If minimizing, keep trying and advancing the pointer. */
+
+ if (reptype == REPTYPE_MIN)
+ {
+ for (;;)
+ {
+ PCRE2_SIZE slength;
+ RMATCH(Fecode, RM20);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Lmin++ >= Lmax) RRETURN(MATCH_NOMATCH);
+ rrc = match_ref(Loffset, Lcaseless, F, mb, &slength);
+ if (rrc != 0)
+ {
+ if (rrc > 0) Feptr = mb->end_subject; /* Partial match */
+ CHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+ Feptr += slength;
+ }
/* Control never gets here */
}
- /* There's been some horrible disaster. Arrival here can only mean there is
- something seriously wrong in the code above or the OP_xxx definitions. */
+ /* If maximizing, find the longest string and work backwards, as long as
+ the matched lengths for each iteration are the same. */
- default:
- RRETURN(PCRE2_ERROR_INTERNAL);
- }
+ else
+ {
+ BOOL samelengths = TRUE;
+ Lstart = Feptr; /* Starting position */
+ Flength = Fovector[Loffset+1] - Fovector[Loffset];
- /* Do not stick any code in here without much thought; it is assumed
- that "continue" in the code above comes out to here to repeat the main
- loop. */
+ for (i = Lmin; i < Lmax; i++)
+ {
+ PCRE2_SIZE slength;
+ rrc = match_ref(Loffset, Lcaseless, F, mb, &slength);
+ if (rrc != 0)
+ {
+ /* Can't use CHECK_PARTIAL because we don't want to update Feptr in
+ the soft partial matching case. */
- } /* End of main loop */
-/* Control never reaches here */
+ if (rrc > 0 && mb->partial != 0 &&
+ mb->end_subject > mb->start_used_ptr)
+ {
+ mb->hitend = TRUE;
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
+ }
+ break;
+ }
+ if (slength != Flength) samelengths = FALSE;
+ Feptr += slength;
+ }
-/* When compiling to use the heap rather than the stack for recursive calls to
-match(), the RRETURN() macro jumps here. The number that is saved in
-frame->Xwhere indicates which label we actually want to return to. */
+ /* If the length matched for each repetition is the same as the length of
+ the captured group, we can easily work backwards. This is the normal
+ case. However, in caseless UTF-8 mode there are pairs of case-equivalent
+ characters whose lengths (in terms of code units) differ. However, this
+ is very rare, so we handle it by re-matching fewer and fewer times. */
-#ifdef HEAP_MATCH_RECURSE
-#define LBL(val) case val: goto L_RM##val;
-HEAP_RETURN:
-switch (frame->Xwhere)
- {
- LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
- LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
- LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
- LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
- LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64)
- LBL(65) LBL(66) LBL(68)
-#ifdef SUPPORT_WIDE_CHARS
- LBL(20) LBL(21)
+ if (samelengths)
+ {
+ while (Feptr >= Lstart)
+ {
+ RMATCH(Fecode, RM21);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Feptr -= Flength;
+ }
+ }
+
+ /* The rare case of non-matching lengths. Re-scan the repetition for each
+ iteration. We know that match_ref() will succeed every time. */
+
+ else
+ {
+ Lmax = i;
+ for (;;)
+ {
+ RMATCH(Fecode, RM22);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (Feptr == Lstart) break; /* Failed after minimal repetition */
+ Feptr = Lstart;
+ Lmax--;
+ for (i = Lmin; i < Lmax; i++)
+ {
+ PCRE2_SIZE slength;
+ (void)match_ref(Loffset, Lcaseless, F, mb, &slength);
+ Feptr += slength;
+ }
+ }
+ }
+
+ RRETURN(MATCH_NOMATCH);
+ }
+ /* Control never gets here */
+
+#undef Lcaseless
+#undef Lmin
+#undef Lmax
+#undef Lstart
+#undef Loffset
+
+
+
+/* ========================================================================= */
+/* Opcodes for the start of various parenthesized items */
+/* ========================================================================= */
+
+ /* In all cases, if the result of RMATCH() is MATCH_THEN, check whether the
+ (*THEN) is within the current branch by comparing the address of OP_THEN
+ that is passed back with the end of the branch. If (*THEN) is within the
+ current branch, and the branch is one of two or more alternatives (it
+ either starts or ends with OP_ALT), we have reached the limit of THEN's
+ action, so convert the return code to NOMATCH, which will cause normal
+ backtracking to happen from now on. Otherwise, THEN is passed back to an
+ outer alternative. This implements Perl's treatment of parenthesized
+ groups, where a group not containing | does not affect the current
+ alternative, that is, (X) is NOT the same as (X|(*F)). */
+
+
+ /* ===================================================================== */
+ /* BRAZERO, BRAMINZERO and SKIPZERO occur just before a non-possessive
+ bracket group, indicating that it may occur zero times. It may repeat
+ infinitely, or not at all - i.e. it could be ()* or ()? or even (){0} in
+ the pattern. Brackets with fixed upper repeat limits are compiled as a
+ number of copies, with the optional ones preceded by BRAZERO or BRAMINZERO.
+ Possessive groups with possible zero repeats are preceded by BRAPOSZERO. */
+
+#define Lnext_ecode F->temp_sptr[0]
+
+ case OP_BRAZERO:
+ Lnext_ecode = Fecode + 1;
+ RMATCH(Lnext_ecode, RM9);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ do Lnext_ecode += GET(Lnext_ecode, 1); while (*Lnext_ecode == OP_ALT);
+ Fecode = Lnext_ecode + 1 + LINK_SIZE;
+ break;
+
+ case OP_BRAMINZERO:
+ Lnext_ecode = Fecode + 1;
+ do Lnext_ecode += GET(Lnext_ecode, 1); while (*Lnext_ecode == OP_ALT);
+ RMATCH(Lnext_ecode + 1 + LINK_SIZE, RM10);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Fecode++;
+ break;
+
+#undef Lnext_ecode
+
+ case OP_SKIPZERO:
+ Fecode++;
+ do Fecode += GET(Fecode,1); while (*Fecode == OP_ALT);
+ Fecode += 1 + LINK_SIZE;
+ break;
+
+
+ /* ===================================================================== */
+ /* Handle possessive brackets with an unlimited repeat. The end of these
+ brackets will always be OP_KETRPOS, which returns MATCH_KETRPOS without
+ going further in the pattern. */
+
+#define Lframe_type F->temp_32[0]
+#define Lmatched_once F->temp_32[1]
+#define Lzero_allowed F->temp_32[2]
+#define Lstart_eptr F->temp_sptr[0]
+#define Lstart_group F->temp_sptr[1]
+
+ case OP_BRAPOSZERO:
+ Lzero_allowed = TRUE; /* Zero repeat is allowed */
+ Fecode += 1;
+ if (*Fecode == OP_CBRAPOS || *Fecode == OP_SCBRAPOS)
+ goto POSSESSIVE_CAPTURE;
+ goto POSSESSIVE_NON_CAPTURE;
+
+ case OP_BRAPOS:
+ case OP_SBRAPOS:
+ Lzero_allowed = FALSE; /* Zero repeat not allowed */
+
+ POSSESSIVE_NON_CAPTURE:
+ Lframe_type = GF_NOCAPTURE; /* Remembered frame type */
+ goto POSSESSIVE_GROUP;
+
+ case OP_CBRAPOS:
+ case OP_SCBRAPOS:
+ Lzero_allowed = FALSE; /* Zero repeat not allowed */
+
+ POSSESSIVE_CAPTURE:
+ number = GET2(Fecode, 1+LINK_SIZE);
+ Lframe_type = GF_CAPTURE | number; /* Remembered frame type */
+
+ POSSESSIVE_GROUP:
+ Lmatched_once = FALSE; /* Never matched */
+ Lstart_group = Fecode; /* Start of this group */
+
+ for (;;)
+ {
+ Lstart_eptr = Feptr; /* Position at group start */
+ group_frame_type = Lframe_type;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM8);
+ if (rrc == MATCH_KETRPOS)
+ {
+ Lmatched_once = TRUE; /* Matched at least once */
+ if (Feptr == Lstart_eptr) /* Empty match; skip to end */
+ {
+ do Fecode += GET(Fecode, 1); while (*Fecode == OP_ALT);
+ break;
+ }
+
+ Fecode = Lstart_group;
+ continue;
+ }
+
+ /* See comment above about handling THEN. */
+
+ if (rrc == MATCH_THEN)
+ {
+ PCRE2_SPTR next_ecode = Fecode + GET(Fecode,1);
+ if (mb->verb_ecode_ptr < next_ecode &&
+ (*Fecode == OP_ALT || *next_ecode == OP_ALT))
+ rrc = MATCH_NOMATCH;
+ }
+
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Fecode += GET(Fecode, 1);
+ if (*Fecode != OP_ALT) break;
+ }
+
+ /* Success if matched something or zero repeat allowed */
+
+ if (Lmatched_once || Lzero_allowed)
+ {
+ Fecode += 1 + LINK_SIZE;
+ break;
+ }
+
+ RRETURN(MATCH_NOMATCH);
+
+#undef Lmatched_once
+#undef Lzero_allowed
+#undef Lframe_type
+#undef Lstart_eptr
+#undef Lstart_group
+
+
+ /* ===================================================================== */
+ /* Handle non-capturing brackets that cannot match an empty string. When we
+ get to the final alternative within the brackets, as long as there are no
+ THEN's in the pattern, we can optimize by not recording a new backtracking
+ point. (Ideally we should test for a THEN within this group, but we don't
+ have that information.) Don't do this if we are at the very top level,
+ however, because that would make handling assertions and once-only brackets
+ messier when there is nothing to go back to. */
+
+#define Lframe_type F->temp_32[0] /* Set for all that use GROUPLOOP */
+#define Lnext_branch F->temp_sptr[0] /* Used only in OP_BRA handling */
+
+ case OP_BRA:
+ if (mb->hasthen || Frdepth == 0)
+ {
+ Lframe_type = 0;
+ goto GROUPLOOP;
+ }
+
+ for (;;)
+ {
+ Lnext_branch = Fecode + GET(Fecode, 1);
+ if (*Lnext_branch != OP_ALT) break;
+
+ /* This is never the final branch. We do not need to test for MATCH_THEN
+ here because this code is not used when there is a THEN in the pattern. */
+
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM1);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Fecode = Lnext_branch;
+ }
+
+ /* Hit the start of the final branch. Continue at this level. */
+
+ Fecode += PRIV(OP_lengths)[*Fecode];
+ break;
+
+#undef Lnext_branch
+
+
+ /* ===================================================================== */
+ /* Handle a capturing bracket, other than those that are possessive with an
+ unlimited repeat. */
+
+ case OP_CBRA:
+ case OP_SCBRA:
+ Lframe_type = GF_CAPTURE | GET2(Fecode, 1+LINK_SIZE);
+ goto GROUPLOOP;
+
+
+ /* ===================================================================== */
+ /* Atomic groups and non-capturing brackets that can match an empty string
+ must record a backtracking point and also set up a chained frame. */
+
+ case OP_ONCE:
+ case OP_SBRA:
+ Lframe_type = GF_NOCAPTURE | Fop;
+
+ GROUPLOOP:
+ for (;;)
+ {
+ group_frame_type = Lframe_type;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM2);
+ if (rrc == MATCH_THEN)
+ {
+ PCRE2_SPTR next_ecode = Fecode + GET(Fecode,1);
+ if (mb->verb_ecode_ptr < next_ecode &&
+ (*Fecode == OP_ALT || *next_ecode == OP_ALT))
+ rrc = MATCH_NOMATCH;
+ }
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Fecode += GET(Fecode, 1);
+ if (*Fecode != OP_ALT) RRETURN(MATCH_NOMATCH);
+ }
+ /* Control never reaches here. */
+
+#undef Lframe_type
+
+
+ /* ===================================================================== */
+ /* Recursion either matches the current regex, or some subexpression. The
+ offset data is the offset to the starting bracket from the start of the
+ whole pattern. (This is so that it works from duplicated subpatterns.) */
+
+#define Lframe_type F->temp_32[0]
+#define Lstart_branch F->temp_sptr[0]
+
+ case OP_RECURSE:
+ bracode = mb->start_code + GET(Fecode, 1);
+ number = (bracode == mb->start_code)? 0 : GET2(bracode, 1 + LINK_SIZE);
+
+ /* If we are already in a recursion, check for repeating the same one
+ without advancing the subject pointer. This should catch convoluted mutual
+ recursions. (Some simple cases are caught at compile time.) */
+
+ if (Fcurrent_recurse != RECURSE_UNSET)
+ {
+ offset = Flast_group_offset;
+ while (offset != PCRE2_UNSET)
+ {
+ N = (heapframe *)((char *)mb->match_frames + offset);
+ P = (heapframe *)((char *)N - frame_size);
+ if (N->group_frame_type == (GF_RECURSE | number))
+ {
+ if (Feptr == P->eptr) return PCRE2_ERROR_RECURSELOOP;
+ break;
+ }
+ offset = P->last_group_offset;
+ }
+ }
+
+ /* Now run the recursion, branch by branch. */
+
+ Lstart_branch = bracode;
+ Lframe_type = GF_RECURSE | number;
+
+ for (;;)
+ {
+ PCRE2_SPTR next_ecode;
+
+ group_frame_type = Lframe_type;
+ RMATCH(Lstart_branch + PRIV(OP_lengths)[*Lstart_branch], RM11);
+ next_ecode = Lstart_branch + GET(Lstart_branch,1);
+
+ /* Handle backtracking verbs, which are defined in a range that can
+ easily be tested for. PCRE does not allow THEN, SKIP, PRUNE or COMMIT to
+ escape beyond a recursion; they cause a NOMATCH for the entire recursion.
+
+ When one of these verbs triggers, the current recursion group number is
+ recorded. If it matches the recursion we are processing, the verb
+ happened within the recursion and we must deal with it. Otherwise it must
+ have happened after the recursion completed, and so has to be passed
+ back. See comment above about handling THEN. */
+
+ if (rrc >= MATCH_BACKTRACK_MIN && rrc <= MATCH_BACKTRACK_MAX &&
+ mb->verb_current_recurse == (Lframe_type ^ GF_RECURSE))
+ {
+ if (rrc == MATCH_THEN && mb->verb_ecode_ptr < next_ecode &&
+ (*Lstart_branch == OP_ALT || *next_ecode == OP_ALT))
+ rrc = MATCH_NOMATCH;
+ else RRETURN(MATCH_NOMATCH);
+ }
+
+ /* Note that carrying on after (*ACCEPT) in a recursion is handled in the
+ OP_ACCEPT code. Nothing needs to be done here. */
+
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Lstart_branch = next_ecode;
+ if (*Lstart_branch != OP_ALT) RRETURN(MATCH_NOMATCH);
+ }
+ /* Control never reaches here. */
+
+#undef Lframe_type
+#undef Lstart_branch
+
+
+ /* ===================================================================== */
+ /* Positive assertions are like other groups except that PCRE doesn't allow
+ the effect of (*THEN) to escape beyond an assertion; it is therefore
+ treated as NOMATCH. (*ACCEPT) is treated as successful assertion, with its
+ captures retained. Any other return is an error. */
+
+#define Lframe_type F->temp_32[0]
+
+ case OP_ASSERT:
+ case OP_ASSERTBACK:
+ Lframe_type = GF_NOCAPTURE | Fop;
+ for (;;)
+ {
+ group_frame_type = Lframe_type;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM3);
+ if (rrc == MATCH_ACCEPT)
+ {
+ memcpy(Fovector,
+ (char *)assert_accept_frame + offsetof(heapframe, ovector),
+ assert_accept_frame->offset_top * sizeof(PCRE2_SIZE));
+ Foffset_top = assert_accept_frame->offset_top;
+ break;
+ }
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
+ Fecode += GET(Fecode, 1);
+ if (*Fecode != OP_ALT) RRETURN(MATCH_NOMATCH);
+ }
+
+ do Fecode += GET(Fecode, 1); while (*Fecode == OP_ALT);
+ Fecode += 1 + LINK_SIZE;
+ break;
+
+#undef Lframe_type
+
+
+ /* ===================================================================== */
+ /* Handle negative assertions. Loop for each non-matching branch as for
+ positive assertions. */
+
+#define Lframe_type F->temp_32[0]
+
+ case OP_ASSERT_NOT:
+ case OP_ASSERTBACK_NOT:
+ Lframe_type = GF_NOCAPTURE | Fop;
+
+ for (;;)
+ {
+ group_frame_type = Lframe_type;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM4);
+ switch(rrc)
+ {
+ case MATCH_ACCEPT: /* Assertion matched, therefore it fails. */
+ case MATCH_MATCH:
+ RRETURN (MATCH_NOMATCH);
+
+ case MATCH_NOMATCH: /* Branch failed, try next if present. */
+ case MATCH_THEN:
+ Fecode += GET(Fecode, 1);
+ if (*Fecode != OP_ALT) goto ASSERT_NOT_FAILED;
+ break;
+
+ case MATCH_COMMIT: /* Assertion forced to fail, therefore continue. */
+ case MATCH_SKIP:
+ case MATCH_PRUNE:
+ do Fecode += GET(Fecode, 1); while (*Fecode == OP_ALT);
+ goto ASSERT_NOT_FAILED;
+
+ default: /* Pass back any other return */
+ RRETURN(rrc);
+ }
+ }
+
+ /* None of the branches have matched or there was a backtrack to (*COMMIT),
+ (*SKIP), (*PRUNE), or (*THEN) in the last branch. This is success for a
+ negative assertion, so carry on. */
+
+ ASSERT_NOT_FAILED:
+ Fecode += 1 + LINK_SIZE;
+ break;
+
+#undef Lframe_type
+
+
+ /* ===================================================================== */
+ /* The callout item calls an external function, if one is provided, passing
+ details of the match so far. This is mainly for debugging, though the
+ function is able to force a failure. */
+
+ case OP_CALLOUT:
+ case OP_CALLOUT_STR:
+ rrc = do_callout(F, mb, &length);
+ if (rrc > 0) RRETURN(MATCH_NOMATCH);
+ if (rrc < 0) RRETURN(rrc);
+ Fecode += length;
+ break;
+
+
+ /* ===================================================================== */
+ /* Conditional group: compilation checked that there are no more than two
+ branches. If the condition is false, skipping the first branch takes us
+ past the end of the item if there is only one branch, but that's exactly
+ what we want. */
+
+ case OP_COND:
+ case OP_SCOND:
+
+ /* The variable Flength will be added to Fecode when the condition is
+ false, to get to the second branch. Setting it to the offset to the ALT or
+ KET, then incrementing Fecode achieves this effect. However, if the second
+ branch is non-existent, we must point to the KET so that the end of the
+ group is correctly processed. We now have Fecode pointing to the condition
+ or callout. */
+
+ Flength = GET(Fecode, 1); /* Offset to the second branch */
+ if (Fecode[Flength] != OP_ALT) Flength -= 1 + LINK_SIZE;
+ Fecode += 1 + LINK_SIZE; /* From this opcode */
+
+ /* Because of the way auto-callout works during compile, a callout item is
+ inserted between OP_COND and an assertion condition. Such a callout can
+ also be inserted manually. */
+
+ if (*Fecode == OP_CALLOUT || *Fecode == OP_CALLOUT_STR)
+ {
+ rrc = do_callout(F, mb, &length);
+ if (rrc > 0) RRETURN(MATCH_NOMATCH);
+ if (rrc < 0) RRETURN(rrc);
+
+ /* Advance Fecode past the callout, so it now points to the condition. We
+ must adjust Flength so that the value of Fecode+Flength is unchanged. */
+
+ Fecode += length;
+ Flength -= length;
+ }
+
+ /* Test the various possible conditions */
+
+ condition = FALSE;
+ switch(*Fecode)
+ {
+ case OP_RREF: /* Group recursion test */
+ if (Fcurrent_recurse != RECURSE_UNSET)
+ {
+ number = GET2(Fecode, 1);
+ condition = (number == RREF_ANY || number == Fcurrent_recurse);
+ }
+ break;
+
+ case OP_DNRREF: /* Duplicate named group recursion test */
+ if (Fcurrent_recurse != RECURSE_UNSET)
+ {
+ int count = GET2(Fecode, 1 + IMM2_SIZE);
+ PCRE2_SPTR slot = mb->name_table + GET2(Fecode, 1) * mb->name_entry_size;
+ while (count-- > 0)
+ {
+ number = GET2(slot, 0);
+ condition = number == Fcurrent_recurse;
+ if (condition) break;
+ slot += mb->name_entry_size;
+ }
+ }
+ break;
+
+ case OP_CREF: /* Numbered group used test */
+ offset = (GET2(Fecode, 1) << 1) - 2; /* Doubled ref number */
+ condition = offset < Foffset_top && Fovector[offset] != PCRE2_UNSET;
+ break;
+
+ case OP_DNCREF: /* Duplicate named group used test */
+ {
+ int count = GET2(Fecode, 1 + IMM2_SIZE);
+ PCRE2_SPTR slot = mb->name_table + GET2(Fecode, 1) * mb->name_entry_size;
+ while (count-- > 0)
+ {
+ offset = (GET2(slot, 0) << 1) - 2;
+ condition = offset < Foffset_top && Fovector[offset] != PCRE2_UNSET;
+ if (condition) break;
+ slot += mb->name_entry_size;
+ }
+ }
+ break;
+
+ case OP_FALSE:
+ case OP_FAIL: /* The assertion (?!) becomes OP_FAIL */
+ break;
+
+ case OP_TRUE:
+ condition = TRUE;
+ break;
+
+ /* The condition is an assertion. Run code similar to the assertion code
+ above. */
+
+#define Lpositive F->temp_32[0]
+#define Lstart_branch F->temp_sptr[0]
+
+ default:
+ Lpositive = (*Fecode == OP_ASSERT || *Fecode == OP_ASSERTBACK);
+ Lstart_branch = Fecode;
+
+ for (;;)
+ {
+ group_frame_type = GF_CONDASSERT | *Fecode;
+ RMATCH(Lstart_branch + PRIV(OP_lengths)[*Lstart_branch], RM5);
+
+ switch(rrc)
+ {
+ case MATCH_ACCEPT: /* Save captures */
+ memcpy(Fovector,
+ (char *)assert_accept_frame + offsetof(heapframe, ovector),
+ assert_accept_frame->offset_top * sizeof(PCRE2_SIZE));
+ Foffset_top = assert_accept_frame->offset_top;
+
+ /* Fall through */
+ /* In the case of a match, the captures have already been put into
+ the current frame. */
+
+ case MATCH_MATCH:
+ condition = Lpositive; /* TRUE for positive assertion */
+ break;
+
+ /* PCRE doesn't allow the effect of (*THEN) to escape beyond an
+ assertion; it is therefore always treated as NOMATCH. */
+
+ case MATCH_NOMATCH:
+ case MATCH_THEN:
+ Lstart_branch += GET(Lstart_branch, 1);
+ if (*Lstart_branch == OP_ALT) continue; /* Try next branch */
+ condition = !Lpositive; /* TRUE for negative assertion */
+ break;
+
+ /* These force no match without checking other branches. */
+
+ case MATCH_COMMIT:
+ case MATCH_SKIP:
+ case MATCH_PRUNE:
+ condition = !Lpositive;
+ break;
+
+ default:
+ RRETURN(rrc);
+ }
+ break; /* Out of the branch loop */
+ }
+
+ /* If the condition is true, find the end of the assertion so that
+ advancing past it gets us to the start of the first branch. */
+
+ if (condition)
+ {
+ do Fecode += GET(Fecode, 1); while (*Fecode == OP_ALT);
+ }
+ break; /* End of assertion condition */
+ }
+
+#undef Lpositive
+#undef Lstart_branch
+
+ /* Choose branch according to the condition. */
+
+ Fecode += condition? PRIV(OP_lengths)[*Fecode] : Flength;
+
+ /* If the opcode is OP_SCOND it means we are at a repeated conditional
+ group that might match an empty string. We must therefore descend a level
+ so that the start is remembered for checking. For OP_COND we can just
+ continue at this level. */
+
+ if (Fop == OP_SCOND)
+ {
+ group_frame_type = GF_NOCAPTURE | Fop;
+ RMATCH(Fecode, RM35);
+ RRETURN(rrc);
+ }
+ break;
+
+
+
+/* ========================================================================= */
+/* End of start of parenthesis opcodes */
+/* ========================================================================= */
+
+
+ /* ===================================================================== */
+ /* Move the subject pointer back. This occurs only at the start of each
+ branch of a lookbehind assertion. If we are too close to the start to move
+ back, fail. When working with UTF-8 we move back a number of characters,
+ not bytes. */
+
+ case OP_REVERSE:
+ number = GET(Fecode, 1);
+#ifdef SUPPORT_UNICODE
+ if (utf)
+ {
+ while (number-- > 0)
+ {
+ if (Feptr <= mb->start_subject) RRETURN(MATCH_NOMATCH);
+ Feptr--;
+ BACKCHAR(Feptr);
+ }
+ }
+ else
+#endif
+
+ /* No UTF-8 support, or not in UTF-8 mode: count is byte count */
+
+ {
+ if ((ptrdiff_t)number > Feptr - mb->start_subject) RRETURN(MATCH_NOMATCH);
+ Feptr -= number;
+ }
+
+ /* Save the earliest consulted character, then skip to next op code */
+
+ if (Feptr < mb->start_used_ptr) mb->start_used_ptr = Feptr;
+ Fecode += 1 + LINK_SIZE;
+ break;
+
+
+ /* ===================================================================== */
+ /* An alternation is the end of a branch; scan along to find the end of the
+ bracketed group. */
+
+ case OP_ALT:
+ do Fecode += GET(Fecode,1); while (*Fecode == OP_ALT);
+ break;
+
+
+ /* ===================================================================== */
+ /* The end of a parenthesized group. For all but OP_BRA and OP_COND, the
+ starting frame was added to the chained frames in order to remember the
+ starting subject position for the group. */
+
+ case OP_KET:
+ case OP_KETRMIN:
+ case OP_KETRMAX:
+ case OP_KETRPOS:
+
+ bracode = Fecode - GET(Fecode, 1);
+
+ /* Point N to the frame at the start of the most recent group.
+ Remember the subject pointer at the start of the group. */
+
+ if (*bracode != OP_BRA && *bracode != OP_COND)
+ {
+ N = (heapframe *)((char *)mb->match_frames + Flast_group_offset);
+ P = (heapframe *)((char *)N - frame_size);
+ Flast_group_offset = P->last_group_offset;
+
+#ifdef DEBUG_SHOW_RMATCH
+ fprintf(stderr, "++ KET for frame=%d type=%x prev char offset=%lu\n",
+ N->rdepth, N->group_frame_type,
+ (char *)P->eptr - (char *)mb->start_subject);
#endif
+
+ /* If we are at the end of an assertion that is a condition, return a
+ match, discarding any intermediate backtracking points. Copy back the
+ captures into the frame before N so that they are set on return. Doing
+ this for all assertions, both positive and negative, seems to match what
+ Perl does. */
+
+ if (GF_IDMASK(N->group_frame_type) == GF_CONDASSERT)
+ {
+ memcpy((char *)P + offsetof(heapframe, ovector), Fovector,
+ Foffset_top * sizeof(PCRE2_SIZE));
+ P->offset_top = Foffset_top;
+ Fback_frame = (char *)F - (char *)P;
+ RRETURN(MATCH_MATCH);
+ }
+ }
+ else P = NULL; /* Indicates starting frame not recorded */
+
+ /* The group was not a conditional assertion. */
+
+ switch (*bracode)
+ {
+ case OP_BRA: /* No need to do anything for these */
+ case OP_COND:
+ case OP_SCOND:
+ break;
+
+ /* Positive assertions are like OP_ONCE, except that in addition the
+ subject pointer must be put back to where it was at the start of the
+ assertion. */
+
+ case OP_ASSERT:
+ case OP_ASSERTBACK:
+ if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
+ Feptr = P->eptr;
+ /* Fall through */
+
+ /* For an atomic group, discard internal backtracking points. We must
+ also ensure that any remaining branches within the top-level of the group
+ are not tried. Do this by adjusting the code pointer within the backtrack
+ frame so that it points to the final branch. */
+
+ case OP_ONCE:
+ Fback_frame = ((char *)F - (char *)P) + frame_size;
+ for (;;)
+ {
+ uint32_t y = GET(P->ecode,1);
+ if ((P->ecode)[y] != OP_ALT) break;
+ P->ecode += y;
+ }
+ break;
+
+ /* A matching negative assertion returns MATCH, which is turned into
+ NOMATCH at the assertion level. */
+
+ case OP_ASSERT_NOT:
+ case OP_ASSERTBACK_NOT:
+ RRETURN(MATCH_MATCH);
+
+ /* Whole-pattern recursion is coded as a recurse into group 0, so it
+ won't be picked up here. Instead, we catch it when the OP_END is reached.
+ Other recursion is handled here. */
+
+ case OP_CBRA:
+ case OP_CBRAPOS:
+ case OP_SCBRA:
+ case OP_SCBRAPOS:
+ number = GET2(bracode, 1+LINK_SIZE);
+
+ /* Handle a recursively called group. We reinstate the previous set of
+ captures and then carry on after the recursion call. */
+
+ if (Fcurrent_recurse == number)
+ {
+ P = (heapframe *)((char *)N - frame_size);
+ memcpy((char *)F + offsetof(heapframe, ovector), P->ovector,
+ P->offset_top * sizeof(PCRE2_SIZE));
+ Foffset_top = P->offset_top;
+ Fcapture_last = P->capture_last;
+ Fcurrent_recurse = P->current_recurse;
+ Fecode = P->ecode + 1 + LINK_SIZE;
+ continue; /* With next opcode */
+ }
+
+ /* Deal with actual capturing. */
+
+ offset = (number << 1) - 2;
+ Fcapture_last = number;
+ Fovector[offset] = P->eptr - mb->start_subject;
+ Fovector[offset+1] = Feptr - mb->start_subject;
+ if (offset >= Foffset_top) Foffset_top = offset + 2;
+ break;
+ } /* End actions relating to the starting opcode */
+
+ /* OP_KETRPOS is a possessive repeating ket. Remember the current position,
+ and return the MATCH_KETRPOS. This makes it possible to do the repeats one
+ at a time from the outer level. This must precede the empty string test -
+ in this case that test is done at the outer level. */
+
+ if (*Fecode == OP_KETRPOS)
+ {
+ memcpy((char *)P + offsetof(heapframe, eptr),
+ (char *)F + offsetof(heapframe, eptr),
+ frame_copy_size);
+ RRETURN(MATCH_KETRPOS);
+ }
+
+ /* Handle the different kinds of closing brackets. A non-repeating ket
+ needs no special action, just continuing at this level. This also happens
+ for the repeating kets if the group matched no characters, in order to
+ forcibly break infinite loops. Otherwise, the repeating kets try the rest
+ of the pattern or restart from the preceding bracket, in the appropriate
+ order. */
+
+ if (Fop != OP_KET && (P == NULL || Feptr != P->eptr))
+ {
+ if (Fop == OP_KETRMIN)
+ {
+ RMATCH(Fecode + 1 + LINK_SIZE, RM6);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ Fecode -= GET(Fecode, 1);
+ break; /* End of ket processing */
+ }
+
+ /* Repeat the maximum number of times (KETRMAX) */
+
+ RMATCH(bracode, RM7);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ }
+
+ /* Carry on at this level for a non-repeating ket, or after matching an
+ empty string, or after repeating for a maximum number of times. */
+
+ Fecode += 1 + LINK_SIZE;
+ break;
+
+
+ /* ===================================================================== */
+ /* Start and end of line assertions, not multiline mode. */
+
+ case OP_CIRC: /* Start of line, unless PCRE2_NOTBOL is set. */
+ if (Feptr != mb->start_subject || (mb->moptions & PCRE2_NOTBOL) != 0)
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
+
+ case OP_SOD: /* Unconditional start of subject */
+ if (Feptr != mb->start_subject) RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
+
+ /* When PCRE2_NOTEOL is unset, assert before the subject end, or a
+ terminating newline unless PCRE2_DOLLAR_ENDONLY is set. */
+
+ case OP_DOLL:
+ if ((mb->moptions & PCRE2_NOTEOL) != 0) RRETURN(MATCH_NOMATCH);
+ if ((mb->poptions & PCRE2_DOLLAR_ENDONLY) == 0) goto ASSERT_NL_OR_EOS;
+
+ /* Fall through */
+ /* Unconditional end of subject assertion (\z) */
+
+ case OP_EOD:
+ if (Feptr < mb->end_subject) RRETURN(MATCH_NOMATCH);
+ SCHECK_PARTIAL();
+ Fecode++;
+ break;
+
+ /* End of subject or ending \n assertion (\Z) */
+
+ case OP_EODN:
+ ASSERT_NL_OR_EOS:
+ if (Feptr < mb->end_subject &&
+ (!IS_NEWLINE(Feptr) || Feptr != mb->end_subject - mb->nllen))
+ {
+ if (mb->partial != 0 &&
+ Feptr + 1 >= mb->end_subject &&
+ NLBLOCK->nltype == NLTYPE_FIXED &&
+ NLBLOCK->nllen == 2 &&
+ UCHAR21TEST(Feptr) == NLBLOCK->nl[0])
+ {
+ mb->hitend = TRUE;
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
+ }
+ RRETURN(MATCH_NOMATCH);
+ }
+
+ /* Either at end of string or \n before end. */
+
+ SCHECK_PARTIAL();
+ Fecode++;
+ break;
+
+
+ /* ===================================================================== */
+ /* Start and end of line assertions, multiline mode. */
+
+ /* Start of subject unless notbol, or after any newline except for one at
+ the very end, unless PCRE2_ALT_CIRCUMFLEX is set. */
+
+ case OP_CIRCM:
+ if ((mb->moptions & PCRE2_NOTBOL) != 0 && Feptr == mb->start_subject)
+ RRETURN(MATCH_NOMATCH);
+ if (Feptr != mb->start_subject &&
+ ((Feptr == mb->end_subject &&
+ (mb->poptions & PCRE2_ALT_CIRCUMFLEX) == 0) ||
+ !WAS_NEWLINE(Feptr)))
+ RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
+
+ /* Assert before any newline, or before end of subject unless noteol is
+ set. */
+
+ case OP_DOLLM:
+ if (Feptr < mb->end_subject)
+ {
+ if (!IS_NEWLINE(Feptr))
+ {
+ if (mb->partial != 0 &&
+ Feptr + 1 >= mb->end_subject &&
+ NLBLOCK->nltype == NLTYPE_FIXED &&
+ NLBLOCK->nllen == 2 &&
+ UCHAR21TEST(Feptr) == NLBLOCK->nl[0])
+ {
+ mb->hitend = TRUE;
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
+ }
+ RRETURN(MATCH_NOMATCH);
+ }
+ }
+ else
+ {
+ if ((mb->moptions & PCRE2_NOTEOL) != 0) RRETURN(MATCH_NOMATCH);
+ SCHECK_PARTIAL();
+ }
+ Fecode++;
+ break;
+
+
+ /* ===================================================================== */
+ /* Start of match assertion */
+
+ case OP_SOM:
+ if (Feptr != mb->start_subject + mb->start_offset) RRETURN(MATCH_NOMATCH);
+ Fecode++;
+ break;
+
+
+ /* ===================================================================== */
+ /* Reset the start of match point */
+
+ case OP_SET_SOM:
+ Fstart_match = Feptr;
+ Fecode++;
+ break;
+
+
+ /* ===================================================================== */
+ /* Word boundary assertions. Find out if the previous and current
+ characters are "word" characters. It takes a bit more work in UTF mode.
+ Characters > 255 are assumed to be "non-word" characters when PCRE2_UCP is
+ not set. When it is set, use Unicode properties if available, even when not
+ in UTF mode. Remember the earliest and latest consulted characters. */
+
+ case OP_NOT_WORD_BOUNDARY:
+ case OP_WORD_BOUNDARY:
+ if (Feptr == mb->start_subject) prev_is_word = FALSE; else
+ {
+ PCRE2_SPTR lastptr = Feptr - 1;
#ifdef SUPPORT_UNICODE
- LBL(16) LBL(18)
- LBL(22) LBL(23) LBL(28) LBL(30)
- LBL(32) LBL(34) LBL(42) LBL(46)
- LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
- LBL(59) LBL(60) LBL(61) LBL(62) LBL(67)
+ if (utf)
+ {
+ BACKCHAR(lastptr);
+ GETCHAR(fc, lastptr);
+ }
+ else
#endif /* SUPPORT_UNICODE */
- default:
- return PCRE2_ERROR_INTERNAL;
- }
-#undef LBL
-#endif /* HEAP_MATCH_RECURSE */
-}
+ fc = *lastptr;
+ if (lastptr < mb->start_used_ptr) mb->start_used_ptr = lastptr;
+#ifdef SUPPORT_UNICODE
+ if ((mb->poptions & PCRE2_UCP) != 0)
+ {
+ if (fc == '_') prev_is_word = TRUE; else
+ {
+ int cat = UCD_CATEGORY(fc);
+ prev_is_word = (cat == ucp_L || cat == ucp_N);
+ }
+ }
+ else
+#endif /* SUPPORT_UNICODE */
+ prev_is_word = CHMAX_255(fc) && (mb->ctypes[fc] & ctype_word) != 0;
+ }
+ /* Get status of next character */
-/***************************************************************************
-****************************************************************************
- RECURSION IN THE match() FUNCTION
+ if (Feptr >= mb->end_subject)
+ {
+ SCHECK_PARTIAL();
+ cur_is_word = FALSE;
+ }
+ else
+ {
+ PCRE2_SPTR nextptr = Feptr + 1;
+#ifdef SUPPORT_UNICODE
+ if (utf)
+ {
+ FORWARDCHARTEST(nextptr, mb->end_subject);
+ GETCHAR(fc, Feptr);
+ }
+ else
+#endif /* SUPPORT_UNICODE */
+ fc = *Feptr;
+ if (nextptr > mb->last_used_ptr) mb->last_used_ptr = nextptr;
+#ifdef SUPPORT_UNICODE
+ if ((mb->poptions & PCRE2_UCP) != 0)
+ {
+ if (fc == '_') cur_is_word = TRUE; else
+ {
+ int cat = UCD_CATEGORY(fc);
+ cur_is_word = (cat == ucp_L || cat == ucp_N);
+ }
+ }
+ else
+#endif /* SUPPORT_UNICODE */
+ cur_is_word = CHMAX_255(fc) && (mb->ctypes[fc] & ctype_word) != 0;
+ }
-Undefine all the macros that were defined above to handle this. */
+ /* Now see if the situation is what we want */
-#ifdef HEAP_MATCH_RECURSE
-#undef eptr
-#undef ecode
-#undef mstart
-#undef offset_top
-#undef eptrb
-#undef flags
+ if ((*Fecode++ == OP_WORD_BOUNDARY)?
+ cur_is_word == prev_is_word : cur_is_word != prev_is_word)
+ RRETURN(MATCH_NOMATCH);
+ break;
-#undef callpat
-#undef charptr
-#undef data
-#undef next_ecode
-#undef pp
-#undef prev
-#undef saved_eptr
-#undef new_recursive
+ /* ===================================================================== */
+ /* Backtracking (*VERB)s, with and without arguments. Note that if the
+ pattern is successfully matched, we do not come back from RMATCH. */
-#undef cur_is_word
-#undef condition
-#undef prev_is_word
+ case OP_MARK:
+ Fmark = mb->nomatch_mark = Fecode + 2;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode] + Fecode[1], RM12);
-#undef ctype
-#undef length
-#undef max
-#undef min
-#undef number
-#undef offset
-#undef op
-#undef save_capture_last
-#undef save_offset1
-#undef save_offset2
-#undef save_offset3
+ /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an
+ argument, and we must check whether that argument matches this MARK's
+ argument. It is passed back in mb->verb_skip_ptr. If it does match, we
+ return MATCH_SKIP with mb->verb_skip_ptr now pointing to the subject
+ position that corresponds to this mark. Otherwise, pass back the return
+ code unaltered. */
-#undef newptrb
-#endif /* HEAP_MATCH_RECURSE */
+ if (rrc == MATCH_SKIP_ARG &&
+ PRIV(strcmp)(Fecode + 2, mb->verb_skip_ptr) == 0)
+ {
+ mb->verb_skip_ptr = Feptr; /* Pass back current position */
+ RRETURN(MATCH_SKIP);
+ }
+ RRETURN(rrc);
-/* These two are defined as macros in both cases */
+ case OP_FAIL:
+ RRETURN(MATCH_NOMATCH);
-#undef fc
-#undef fi
+ /* Record the current recursing group number in mb->verb_current_recurse
+ when a backtracking return such as MATCH_COMMIT is given. This enables the
+ recurse processing to catch verbs from within the recursion. */
-/***************************************************************************
-***************************************************************************/
+ case OP_COMMIT:
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM13);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_COMMIT);
+ case OP_PRUNE:
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM14);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_PRUNE);
-#ifdef HEAP_MATCH_RECURSE
-/*************************************************
-* Release allocated heap frames *
-*************************************************/
+ case OP_PRUNE_ARG:
+ Fmark = mb->nomatch_mark = Fecode + 2;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode] + Fecode[1], RM15);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_PRUNE);
-/* This function releases all the allocated frames. The base frame is on the
-machine stack, and so must not be freed.
+ case OP_SKIP:
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM16);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ mb->verb_skip_ptr = Feptr; /* Pass back current position */
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_SKIP);
-Argument:
- frame_base the address of the base frame
- mb the match block
+ /* Note that, for Perl compatibility, SKIP with an argument does NOT set
+ nomatch_mark. When a pattern match ends with a SKIP_ARG for which there was
+ not a matching mark, we have to re-run the match, ignoring the SKIP_ARG
+ that failed and any that precede it (either they also failed, or were not
+ triggered). To do this, we maintain a count of executed SKIP_ARGs. If a
+ SKIP_ARG gets to top level, the match is re-run with mb->ignore_skip_arg
+ set to the count of the one that failed. */
-Returns: nothing
-*/
+ case OP_SKIP_ARG:
+ mb->skip_arg_count++;
+ if (mb->skip_arg_count <= mb->ignore_skip_arg)
+ {
+ Fecode += PRIV(OP_lengths)[*Fecode] + Fecode[1];
+ break;
+ }
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode] + Fecode[1], RM17);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-static void
-release_match_heapframes (heapframe *frame_base, match_block *mb)
-{
-heapframe *nextframe = frame_base->Xnextframe;
-while (nextframe != NULL)
+ /* Pass back the current skip name and return the special MATCH_SKIP_ARG
+ return code. This will either be caught by a matching MARK, or get to the
+ top, where it causes a rematch with mb->ignore_skip_arg set to the value of
+ mb->skip_arg_count. */
+
+ mb->verb_skip_ptr = Fecode + 2;
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_SKIP_ARG);
+
+ /* For THEN (and THEN_ARG) we pass back the address of the opcode, so that
+ the branch in which it occurs can be determined. */
+
+ case OP_THEN:
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode], RM18);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ mb->verb_ecode_ptr = Fecode;
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_THEN);
+
+ case OP_THEN_ARG:
+ Fmark = mb->nomatch_mark = Fecode + 2;
+ RMATCH(Fecode + PRIV(OP_lengths)[*Fecode] + Fecode[1], RM19);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ mb->verb_ecode_ptr = Fecode;
+ mb->verb_current_recurse = Fcurrent_recurse;
+ RRETURN(MATCH_THEN);
+
+
+ /* ===================================================================== */
+ /* There's been some horrible disaster. Arrival here can only mean there is
+ something seriously wrong in the code above or the OP_xxx definitions. */
+
+ default:
+ return PCRE2_ERROR_INTERNAL;
+ }
+
+ /* Do not insert any code in here without much thought; it is assumed
+ that "continue" in the code above comes out to here to repeat the main
+ loop. */
+
+ } /* End of main loop */
+/* Control never reaches here */
+
+
+/* ========================================================================= */
+/* The RRETURN() macro jumps here. The number that is saved in Freturn_id
+indicates which label we actually want to return to. The value in Frdepth is
+the index number of the frame in the vector. The return value has been placed
+in rrc. */
+
+#define LBL(val) case val: goto L_RM##val;
+
+RETURN_SWITCH:
+if (Frdepth == 0) return rrc; /* Exit from the top level */
+F = (heapframe *)((char *)F - Fback_frame); /* Back track */
+mb->cb->callout_flags |= PCRE2_CALLOUT_BACKTRACK; /* Note for callouts */
+
+#ifdef DEBUG_SHOW_RMATCH
+fprintf(stderr, "++ RETURN %d to %d\n", rrc, Freturn_id);
+#endif
+
+switch (Freturn_id)
{
- heapframe *oldframe = nextframe;
- nextframe = nextframe->Xnextframe;
- mb->stack_memctl.free(oldframe, mb->stack_memctl.memory_data);
+ LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
+ LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(16)
+ LBL(17) LBL(18) LBL(19) LBL(20) LBL(21) LBL(22) LBL(23) LBL(24)
+ LBL(25) LBL(26) LBL(27) LBL(28) LBL(29) LBL(30) LBL(31) LBL(32)
+ LBL(33) LBL(34) LBL(35)
+
+#ifdef SUPPORT_WIDE_CHARS
+ LBL(100) LBL(101)
+#endif
+
+#ifdef SUPPORT_UNICODE
+ LBL(200) LBL(201) LBL(202) LBL(203) LBL(204) LBL(205) LBL(206)
+ LBL(207) LBL(208) LBL(209) LBL(210) LBL(211) LBL(212) LBL(213)
+ LBL(214) LBL(215) LBL(216) LBL(217) LBL(218) LBL(219) LBL(220)
+ LBL(221) LBL(222)
+#endif
+
+ default:
+ return PCRE2_ERROR_INTERNAL;
}
+#undef LBL
}
-#endif /* HEAP_MATCH_RECURSE */
-
/*************************************************
@@ -6439,8 +5984,6 @@ pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length,
pcre2_match_context *mcontext)
{
int rc;
-int ocount;
-
const uint8_t *start_bits = NULL;
const pcre2_real_code *re = (const pcre2_real_code *)code;
@@ -6450,7 +5993,6 @@ BOOL firstline;
BOOL has_first_cu = FALSE;
BOOL has_req_cu = FALSE;
BOOL startline;
-BOOL using_temporary_offsets = FALSE;
BOOL utf;
PCRE2_UCHAR first_cu = 0;
@@ -6465,18 +6007,22 @@ PCRE2_SPTR req_cu_ptr = start_match - 1;
PCRE2_SPTR start_partial = NULL;
PCRE2_SPTR match_partial = NULL;
-/* We need to have mb pointing to a match block, because the IS_NEWLINE macro
-is used below, and it expects NLBLOCK to be defined as a pointer. */
+PCRE2_SIZE frame_size;
+
+/* We need to have mb as a pointer to a match block, because the IS_NEWLINE
+macro is used below, and it expects NLBLOCK to be defined as a pointer. */
+pcre2_callout_block cb;
match_block actual_match_block;
match_block *mb = &actual_match_block;
-#ifdef HEAP_MATCH_RECURSE
-heapframe frame_zero;
-frame_zero.Xprevframe = NULL; /* Marks the top level */
-frame_zero.Xnextframe = NULL; /* None are allocated yet */
-mb->match_frames_base = &frame_zero;
-#endif
+/* Allocate an initial vector of backtracking frames on the stack. If this
+proves to be too small, it is replaced by a larger one on the heap. To get a
+vector of the size required that is aligned for pointers, allocate it as a
+vector of pointers. */
+
+PCRE2_SPTR stack_frames_vector[START_FRAMES_SIZE/sizeof(PCRE2_SPTR)];
+mb->stack_frames = (heapframe *)stack_frames_vector;
/* A length equal to PCRE2_ZERO_TERMINATED implies a zero-terminated
subject string. */
@@ -6505,8 +6051,8 @@ options variable for this function. Users of PCRE2 who are not calling the
function directly would like to have a way of setting these flags, in the same
way that they can set pcre2_compile() flags like PCRE2_NO_AUTOPOSSESS with
constructions like (*NO_AUTOPOSSESS). To enable this, (*NOTEMPTY) and
-(*NOTEMPTY_ATSTART) set bits in the pattern's "flag" function which can now be
-transferred to the options for this function. The bits are guaranteed to be
+(*NOTEMPTY_ATSTART) set bits in the pattern's "flag" function which we now
+transfer to the options for this function. The bits are guaranteed to be
adjacent, but do not have the same values. This bit of Boolean trickery assumes
that the match-time bits are not more significant than the flag bits. If by
accident this is not the case, a compile-time division by zero error will
@@ -6518,20 +6064,22 @@ options |= (re->flags & FF) / ((FF & (~FF+1)) / (OO & (~OO+1)));
#undef FF
#undef OO
-/* A NULL match context means "use a default context" */
-
-if (mcontext == NULL)
- mcontext = (pcre2_match_context *)(&PRIV(default_match_context));
-
/* These two settings are used in the code for checking a UTF string that
follows immediately afterwards. Other values in the mb block are used only
-during interpretive pcre_match() processing, not when the JIT support is in
-use, so they are set up later. */
+during interpretive processing, not when the JIT support is in use, so they are
+set up later. */
utf = (re->overall_options & PCRE2_UTF) != 0;
mb->partial = ((options & PCRE2_PARTIAL_HARD) != 0)? 2 :
((options & PCRE2_PARTIAL_SOFT) != 0)? 1 : 0;
+/* Partial matching and PCRE2_ENDANCHORED are currently not allowed at the same
+time. */
+
+if (mb->partial != 0 &&
+ ((re->overall_options | options) & PCRE2_ENDANCHORED) != 0)
+ return PCRE2_ERROR_BADOPTION;
+
/* Check a UTF string for validity if required. For 8-bit and 16-bit strings,
we must also check that a starting offset does not point into the middle of a
multiunit character. We check only the portion of the subject that is going to
@@ -6590,7 +6138,7 @@ if (utf && (options & PCRE2_NO_UTF_CHECK) == 0)
/* It is an error to set an offset limit without setting the flag at compile
time. */
-if (mcontext->offset_limit != PCRE2_UNSET &&
+if (mcontext != NULL && mcontext->offset_limit != PCRE2_UNSET &&
(re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0)
return PCRE2_ERROR_BADOFFSETLIMIT;
@@ -6609,7 +6157,15 @@ if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0)
}
#endif
-/* Carry on with non-JIT matching. */
+/* Carry on with non-JIT matching. A NULL match context means "use a default
+context", but we take the memory control functions from the pattern. */
+
+if (mcontext == NULL)
+ {
+ mcontext = (pcre2_match_context *)(&PRIV(default_match_context));
+ mb->memctl = re->memctl;
+ }
+else mb->memctl = mcontext->memctl;
anchored = ((re->overall_options | options) & PCRE2_ANCHORED) != 0;
firstline = (re->overall_options & PCRE2_FIRSTLINE) != 0;
@@ -6617,14 +6173,19 @@ startline = (re->flags & PCRE2_STARTLINE) != 0;
bumpalong_limit = (mcontext->offset_limit == PCRE2_UNSET)?
end_subject : subject + mcontext->offset_limit;
-/* Fill in the fields in the match block. */
+/* Initialize and set up the fixed fields in the callout block, with a pointer
+in the match block. */
+
+mb->cb = &cb;
+cb.version = 2;
+cb.subject = subject;
+cb.subject_length = (PCRE2_SIZE)(end_subject - subject);
+cb.callout_flags = 0;
+
+/* Fill in the remaining fields in the match block. */
mb->callout = mcontext->callout;
mb->callout_data = mcontext->callout_data;
-mb->memctl = mcontext->memctl;
-#ifdef HEAP_MATCH_RECURSE
-mb->stack_memctl = mcontext->stack_memctl;
-#endif
mb->start_subject = subject;
mb->start_offset = start_offset;
@@ -6636,8 +6197,6 @@ mb->poptions = re->overall_options; /* Pattern options */
mb->ignore_skip_arg = 0;
mb->mark = mb->nomatch_mark = NULL; /* In case never set */
-mb->recursive = NULL; /* No recursion at top level */
-mb->ovecsave_chain = NULL; /* No ovecsave blocks yet */
mb->hitend = FALSE;
/* The name table is needed for finding all the numbers associated with a
@@ -6648,20 +6207,6 @@ mb->name_count = re->name_count;
mb->name_entry_size = re->name_entry_size;
mb->start_code = mb->name_table + re->name_count * re->name_entry_size;
-/* Limits set in the pattern override the match context only if they are
-smaller. */
-
-mb->match_limit = (mcontext->match_limit < re->limit_match)?
- mcontext->match_limit : re->limit_match;
-mb->match_limit_recursion = (mcontext->recursion_limit < re->limit_recursion)?
- mcontext->recursion_limit : re->limit_recursion;
-
-/* Pointers to the individual character tables */
-
-mb->lcc = re->tables + lcc_offset;
-mb->fcc = re->tables + fcc_offset;
-mb->ctypes = re->tables + ctypes_offset;
-
/* Process the \R and newline settings. */
mb->bsr_convention = re->bsr_convention;
@@ -6678,6 +6223,11 @@ switch(re->newline_convention)
mb->nl[0] = CHAR_NL;
break;
+ case PCRE2_NEWLINE_NUL:
+ mb->nllen = 1;
+ mb->nl[0] = CHAR_NUL;
+ break;
+
case PCRE2_NEWLINE_CRLF:
mb->nllen = 2;
mb->nl[0] = CHAR_CR;
@@ -6695,71 +6245,91 @@ switch(re->newline_convention)
default: return PCRE2_ERROR_INTERNAL;
}
-/* If the expression has got more back references than the offsets supplied can
-hold, we get a temporary chunk of memory to use during the matching. Otherwise,
-we can use the vector supplied. The size of the ovector is three times the
-value in the oveccount field. Two-thirds of it is pairs for storing matching
-offsets, and the top third is working space. */
+/* The backtracking frames have fixed data at the front, and a PCRE2_SIZE
+vector at the end, whose size depends on the number of capturing parentheses in
+the pattern. It is not used at all if there are no capturing parentheses.
+
+ frame_size is the total size of each frame
+ mb->frame_vector_size is the total usable size of the vector (rounded down
+ to a whole number of frames)
-if (re->top_backref >= match_data->oveccount)
+The last of these is changed within the match() function if the frame vector
+has to be expanded. We therefore put it into the match block so that it is
+correct when calling match() more than once for non-anchored patterns. */
+
+frame_size = offsetof(heapframe, ovector) +
+ re->top_bracket * 2 * sizeof(PCRE2_SIZE);
+
+/* Limits set in the pattern override the match context only if they are
+smaller. */
+
+mb->heap_limit = (mcontext->heap_limit < re->limit_heap)?
+ mcontext->heap_limit : re->limit_heap;
+
+mb->match_limit = (mcontext->match_limit < re->limit_match)?
+ mcontext->match_limit : re->limit_match;
+
+mb->match_limit_depth = (mcontext->depth_limit < re->limit_depth)?
+ mcontext->depth_limit : re->limit_depth;
+
+/* If a pattern has very many capturing parentheses, the frame size may be very
+large. Ensure that there are at least 10 available frames by getting an initial
+vector on the heap if necessary, except when the heap limit prevents this. Get
+fewer if possible. (The heap limit is in kilobytes.) */
+
+if (frame_size <= START_FRAMES_SIZE/10)
{
- ocount = re->top_backref * 3 + 3;
- mb->ovector = (PCRE2_SIZE *)(mb->memctl.malloc(ocount * sizeof(PCRE2_SIZE),
- mb->memctl.memory_data));
- if (mb->ovector == NULL) return PCRE2_ERROR_NOMEMORY;
- using_temporary_offsets = TRUE;
+ mb->match_frames = mb->stack_frames; /* Initial frame vector on the stack */
+ mb->frame_vector_size = ((START_FRAMES_SIZE/frame_size) * frame_size);
}
else
{
- ocount = 3 * match_data->oveccount;
- mb->ovector = match_data->ovector;
+ mb->frame_vector_size = frame_size * 10;
+ if ((mb->frame_vector_size / 1024) > mb->heap_limit)
+ {
+ if (frame_size > mb->heap_limit * 1024) return PCRE2_ERROR_HEAPLIMIT;
+ mb->frame_vector_size = ((mb->heap_limit * 1024)/frame_size) * frame_size;
+ }
+ mb->match_frames = mb->memctl.malloc(mb->frame_vector_size,
+ mb->memctl.memory_data);
+ if (mb->match_frames == NULL) return PCRE2_ERROR_NOMEMORY;
}
-mb->offset_end = ocount;
-mb->offset_max = (2*ocount)/3;
+mb->match_frames_top =
+ (heapframe *)((char *)mb->match_frames + mb->frame_vector_size);
-/* Reset the working variable associated with each extraction. These should
-never be used unless previously set, but they get saved and restored, and so we
-initialize them to avoid reading uninitialized locations. Also, unset the
-offsets for the matched string. This is really just for tidiness with callouts,
-in case they inspect these fields. */
+/* Write to the ovector within the first frame to mark every capture unset and
+to avoid uninitialized memory read errors when it is copied to a new frame. */
-if (ocount > 0)
- {
- PCRE2_SIZE *iptr = mb->ovector + ocount;
- PCRE2_SIZE *iend = iptr - re->top_bracket;
- if (iend < mb->ovector + 2) iend = mb->ovector + 2;
- while (--iptr >= iend) *iptr = PCRE2_UNSET;
- mb->ovector[0] = mb->ovector[1] = PCRE2_UNSET;
- }
+memset((char *)(mb->match_frames) + offsetof(heapframe, ovector), 0xff,
+ re->top_bracket * 2 * sizeof(PCRE2_SIZE));
-/* Set up the first code unit to match, if available. The first_codeunit value
-is never set for an anchored regular expression, but the anchoring may be
-forced at run time, so we have to test for anchoring. The first code unit may
-be unset for an unanchored pattern, of course. If there's no first code unit
-there may be a bitmap of possible first characters. */
+/* Pointers to the individual character tables */
+
+mb->lcc = re->tables + lcc_offset;
+mb->fcc = re->tables + fcc_offset;
+mb->ctypes = re->tables + ctypes_offset;
+
+/* Set up the first code unit to match, if available. If there's no first code
+unit there may be a bitmap of possible first characters. */
-if (!anchored)
+if ((re->flags & PCRE2_FIRSTSET) != 0)
{
- if ((re->flags & PCRE2_FIRSTSET) != 0)
+ has_first_cu = TRUE;
+ first_cu = first_cu2 = (PCRE2_UCHAR)(re->first_codeunit);
+ if ((re->flags & PCRE2_FIRSTCASELESS) != 0)
{
- has_first_cu = TRUE;
- first_cu = first_cu2 = (PCRE2_UCHAR)(re->first_codeunit);
- if ((re->flags & PCRE2_FIRSTCASELESS) != 0)
- {
- first_cu2 = TABLE_GET(first_cu, mb->fcc, first_cu);
+ first_cu2 = TABLE_GET(first_cu, mb->fcc, first_cu);
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
- if (utf && first_cu > 127) first_cu2 = UCD_OTHERCASE(first_cu);
+ if (utf && first_cu > 127) first_cu2 = UCD_OTHERCASE(first_cu);
#endif
- }
}
- else
- if (!startline && (re->flags & PCRE2_FIRSTMAPSET) != 0)
- start_bits = re->start_bitmap;
}
+else
+ if (!startline && (re->flags & PCRE2_FIRSTMAPSET) != 0)
+ start_bits = re->start_bitmap;
-/* For anchored or unanchored matches, there may be a "last known required
-character" set. */
+/* There may also be a "last known required character" set. */
if ((re->flags & PCRE2_LASTSET) != 0)
{
@@ -6783,7 +6353,6 @@ the loop runs just once. */
for(;;)
{
PCRE2_SPTR new_start_match;
- mb->capture_last = 0;
/* ----------------- Start of match optimizations ---------------- */
@@ -6794,13 +6363,11 @@ for(;;)
if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
{
- PCRE2_SPTR save_end_subject = end_subject;
-
/* If firstline is TRUE, the start of the match is constrained to the first
line of a multiline string. That is, the match must be before or at the
- first newline. Implement this by temporarily adjusting end_subject so that
- we stop the optimization scans at a newline. If the match fails at the
- newline, later code breaks this loop. */
+ first newline following the start of matching. Temporarily adjust
+ end_subject so that we stop the scans for a first code unit at a newline.
+ If the match fails at the newline, later code breaks the loop. */
if (firstline)
{
@@ -6808,102 +6375,179 @@ for(;;)
#ifdef SUPPORT_UNICODE
if (utf)
{
- while (t < mb->end_subject && !IS_NEWLINE(t))
+ while (t < end_subject && !IS_NEWLINE(t))
{
t++;
- ACROSSCHAR(t < end_subject, *t, t++);
+ ACROSSCHAR(t < end_subject, t, t++);
}
}
else
#endif
- while (t < mb->end_subject && !IS_NEWLINE(t)) t++;
+ while (t < end_subject && !IS_NEWLINE(t)) t++;
end_subject = t;
}
- /* Advance to a unique first code unit if there is one. In 8-bit mode, the
- use of memchr() gives a big speed up. */
+ /* Anchored: check the first code unit if one is recorded. This may seem
+ pointless but it can help in detecting a no match case without scanning for
+ the required code unit. */
- if (has_first_cu)
+ if (anchored)
{
- PCRE2_UCHAR smc;
- if (first_cu != first_cu2)
- while (start_match < end_subject &&
- (smc = UCHAR21TEST(start_match)) != first_cu && smc != first_cu2)
- start_match++;
- else
+ if (has_first_cu || start_bits != NULL)
{
+ BOOL ok = start_match < end_subject;
+ if (ok)
+ {
+ PCRE2_UCHAR c = UCHAR21TEST(start_match);
+ ok = has_first_cu && (c == first_cu || c == first_cu2);
+ if (!ok && start_bits != NULL)
+ {
#if PCRE2_CODE_UNIT_WIDTH != 8
- while (start_match < end_subject && UCHAR21TEST(start_match) != first_cu)
- start_match++;
-#else
- start_match = memchr(start_match, first_cu, end_subject - start_match);
- if (start_match == NULL) start_match = end_subject;
+ if (c > 255) c = 255;
#endif
+ ok = (start_bits[c/8] & (1 << (c&7))) != 0;
+ }
+ }
+ if (!ok)
+ {
+ rc = MATCH_NOMATCH;
+ break;
+ }
}
}
- /* Or to just after a linebreak for a multiline match */
+ /* Not anchored. Advance to a unique first code unit if there is one. In
+ 8-bit mode, the use of memchr() gives a big speed up, even though we have
+ to call it twice in caseless mode, in order to find the earliest occurrence
+ of the character in either of its cases. */
- else if (startline)
+ else
{
- if (start_match > mb->start_subject + start_offset)
+ if (has_first_cu)
{
-#ifdef SUPPORT_UNICODE
- if (utf)
+ if (first_cu != first_cu2) /* Caseless */
{
- while (start_match < end_subject && !WAS_NEWLINE(start_match))
- {
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ PCRE2_UCHAR smc;
+ while (start_match < end_subject &&
+ (smc = UCHAR21TEST(start_match)) != first_cu &&
+ smc != first_cu2)
start_match++;
- ACROSSCHAR(start_match < end_subject, *start_match,
- start_match++);
- }
+#else /* 8-bit code units */
+ PCRE2_SPTR pp1 =
+ memchr(start_match, first_cu, end_subject-start_match);
+ PCRE2_SPTR pp2 =
+ memchr(start_match, first_cu2, end_subject-start_match);
+ if (pp1 == NULL)
+ start_match = (pp2 == NULL)? end_subject : pp2;
+ else
+ start_match = (pp2 == NULL || pp1 < pp2)? pp1 : pp2;
+#endif
}
+
+ /* The caseful case */
+
else
+ {
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ while (start_match < end_subject && UCHAR21TEST(start_match) !=
+ first_cu)
+ start_match++;
+#else
+ start_match = memchr(start_match, first_cu, end_subject - start_match);
+ if (start_match == NULL) start_match = end_subject;
#endif
- while (start_match < end_subject && !WAS_NEWLINE(start_match))
- start_match++;
+ }
- /* If we have just passed a CR and the newline option is ANY or
- ANYCRLF, and we are now at a LF, advance the match position by one more
- code unit. */
+ /* If we can't find the required code unit, having reached the true end
+ of the subject, break the bumpalong loop, to force a match failure,
+ except when doing partial matching, when we let the next cycle run at
+ the end of the subject. To see why, consider the pattern /(?<=abc)def/,
+ which partially matches "abc", even though the string does not contain
+ the starting character "d". If we have not reached the true end of the
+ subject (PCRE2_FIRSTLINE caused end_subject to be temporarily modified)
+ we also let the cycle run, because the matching string is legitimately
+ allowed to start with the first code unit of a newline. */
+
+ if (!mb->partial && start_match >= mb->end_subject)
+ {
+ rc = MATCH_NOMATCH;
+ break;
+ }
+ }
- if (start_match[-1] == CHAR_CR &&
- (mb->nltype == NLTYPE_ANY || mb->nltype == NLTYPE_ANYCRLF) &&
- start_match < end_subject &&
- UCHAR21TEST(start_match) == CHAR_NL)
- start_match++;
+ /* If there's no first code unit, advance to just after a linebreak for a
+ multiline match if required. */
+
+ else if (startline)
+ {
+ if (start_match > mb->start_subject + start_offset)
+ {
+#ifdef SUPPORT_UNICODE
+ if (utf)
+ {
+ while (start_match < end_subject && !WAS_NEWLINE(start_match))
+ {
+ start_match++;
+ ACROSSCHAR(start_match < end_subject, start_match, start_match++);
+ }
+ }
+ else
+#endif
+ while (start_match < end_subject && !WAS_NEWLINE(start_match))
+ start_match++;
+
+ /* If we have just passed a CR and the newline option is ANY or
+ ANYCRLF, and we are now at a LF, advance the match position by one
+ more code unit. */
+
+ if (start_match[-1] == CHAR_CR &&
+ (mb->nltype == NLTYPE_ANY || mb->nltype == NLTYPE_ANYCRLF) &&
+ start_match < end_subject &&
+ UCHAR21TEST(start_match) == CHAR_NL)
+ start_match++;
+ }
}
- }
- /* Or to a non-unique first code unit if any have been identified. The
- bitmap contains only 256 bits. When code units are 16 or 32 bits wide, all
- code units greater than 254 set the 255 bit. */
+ /* If there's no first code unit or a requirement for a multiline line
+ start, advance to a non-unique first code unit if any have been
+ identified. The bitmap contains only 256 bits. When code units are 16 or
+ 32 bits wide, all code units greater than 254 set the 255 bit. */
- else if (start_bits != NULL)
- {
- while (start_match < end_subject)
+ else if (start_bits != NULL)
{
- uint32_t c = UCHAR21TEST(start_match);
+ while (start_match < end_subject)
+ {
+ uint32_t c = UCHAR21TEST(start_match);
#if PCRE2_CODE_UNIT_WIDTH != 8
- if (c > 255) c = 255;
+ if (c > 255) c = 255;
#endif
- if ((start_bits[c/8] & (1 << (c&7))) != 0) break;
- start_match++;
+ if ((start_bits[c/8] & (1 << (c&7))) != 0) break;
+ start_match++;
+ }
+
+ /* See comment above in first_cu checking about the next few lines. */
+
+ if (!mb->partial && start_match >= mb->end_subject)
+ {
+ rc = MATCH_NOMATCH;
+ break;
+ }
}
- }
+ } /* End first code unit handling */
/* Restore fudged end_subject */
- end_subject = save_end_subject;
+ end_subject = mb->end_subject;
- /* The following two optimizations are disabled for partial matching. */
+ /* The following two optimizations must be disabled for partial matching. */
if (!mb->partial)
{
- /* The minimum matching length is a lower bound; no actual string of that
- length may actually match the pattern. Although the value is, strictly,
- in characters, we treat it as code units to avoid spending too much time
- in this optimization. */
+ /* The minimum matching length is a lower bound; no string of that length
+ may actually match the pattern. Although the value is, strictly, in
+ characters, we treat it as code units to avoid spending too much time in
+ this optimization. */
if (end_subject - start_match < re->minlength)
{
@@ -6912,12 +6556,16 @@ for(;;)
}
/* If req_cu is set, we know that that code unit must appear in the
- subject for the match to succeed. If the first code unit is set, req_cu
- must be later in the subject; otherwise the test starts at the match
- point. This optimization can save a huge amount of backtracking in
- patterns with nested unlimited repeats that aren't going to match.
- Writing separate code for cased/caseless versions makes it go faster, as
- does using an autoincrement and backing off on a match.
+ subject for the (non-partial) match to succeed. If the first code unit is
+ set, req_cu must be later in the subject; otherwise the test starts at
+ the match point. This optimization can save a huge amount of backtracking
+ in patterns with nested unlimited repeats that aren't going to match.
+ Writing separate code for caseful/caseless versions makes it go faster,
+ as does using an autoincrement and backing off on a match. As in the case
+ of the first code unit, using memchr() in the 8-bit library gives a big
+ speed up. Unlike the first_cu check above, we do not need to call
+ memchr() twice in the caseless case because we only need to check for the
+ presence of the character in either case, not find the first occurrence.
HOWEVER: when the subject string is very, very long, searching to its end
can take a long time, and give bad performance on quite ordinary
@@ -6930,27 +6578,52 @@ for(;;)
PCRE2_SPTR p = start_match + (has_first_cu? 1:0);
/* We don't need to repeat the search if we haven't yet reached the
- place we found it at last time. */
+ place we found it last time round the bumpalong loop. */
if (p > req_cu_ptr)
{
- if (req_cu != req_cu2)
+ if (p < end_subject)
{
- while (p < end_subject)
+ if (req_cu != req_cu2) /* Caseless */
{
- uint32_t pp = UCHAR21INCTEST(p);
- if (pp == req_cu || pp == req_cu2) { p--; break; }
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ do
+ {
+ uint32_t pp = UCHAR21INCTEST(p);
+ if (pp == req_cu || pp == req_cu2) { p--; break; }
+ }
+ while (p < end_subject);
+
+#else /* 8-bit code units */
+ PCRE2_SPTR pp = p;
+ p = memchr(pp, req_cu, end_subject - pp);
+ if (p == NULL)
+ {
+ p = memchr(pp, req_cu2, end_subject - pp);
+ if (p == NULL) p = end_subject;
+ }
+#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */
}
- }
- else
- {
- while (p < end_subject)
+
+ /* The caseful case */
+
+ else
{
- if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ do
+ {
+ if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
+ }
+ while (p < end_subject);
+
+#else /* 8-bit code units */
+ p = memchr(p, req_cu, end_subject - p);
+ if (p == NULL) p = end_subject;
+#endif
}
}
- /* If we can't find the required code unit, break the matching loop,
+ /* If we can't find the required code unit, break the bumpalong loop,
forcing a match failure. */
if (p >= end_subject)
@@ -6960,8 +6633,8 @@ for(;;)
}
/* If we have found the required code unit, save the point where we
- found it, so that we don't search again next time round the loop if
- the start hasn't passed this code unit yet. */
+ found it, so that we don't search again next time round the bumpalong
+ loop if the start hasn't yet passed this code unit. */
req_cu_ptr = p;
}
@@ -6982,14 +6655,17 @@ for(;;)
/* OK, we can now run the match. If "hitend" is set afterwards, remember the
first starting point for which a partial match was found. */
- mb->start_match_ptr = start_match;
+ cb.start_match = (PCRE2_SIZE)(start_match - subject);
+ cb.callout_flags |= PCRE2_CALLOUT_STARTMATCH;
+
mb->start_used_ptr = start_match;
mb->last_used_ptr = start_match;
mb->match_call_count = 0;
- mb->match_function_type = 0;
mb->end_offset_top = 0;
mb->skip_arg_count = 0;
- rc = match(start_match, mb->start_code, start_match, 2, mb, NULL, 0);
+
+ rc = match(start_match, mb->start_code, match_data->ovector,
+ match_data->oveccount, re->top_bracket, frame_size, mb);
if (mb->hitend && start_partial == NULL)
{
@@ -7015,9 +6691,9 @@ for(;;)
greater than the match we have just done, treat it as NOMATCH. */
case MATCH_SKIP:
- if (mb->start_match_ptr > start_match)
+ if (mb->verb_skip_ptr > start_match)
{
- new_start_match = mb->start_match_ptr;
+ new_start_match = mb->verb_skip_ptr;
break;
}
/* Fall through */
@@ -7032,7 +6708,7 @@ for(;;)
new_start_match = start_match + 1;
#ifdef SUPPORT_UNICODE
if (utf)
- ACROSSCHAR(new_start_match < end_subject, *new_start_match,
+ ACROSSCHAR(new_start_match < end_subject, new_start_match,
new_start_match++);
#endif
break;
@@ -7091,11 +6767,11 @@ for(;;)
/* ==========================================================================*/
-/* When we reach here, one of the stopping conditions is true:
+/* When we reach here, one of the following stopping conditions is true:
(1) The match succeeded, either completely, or partially;
-(2) The pattern is anchored or the match was failed by (*COMMIT);
+(2) The pattern is anchored or the match was failed after (*COMMIT);
(3) We are past the end of the subject or the bumpalong limit;
@@ -7109,18 +6785,10 @@ for(;;)
ENDLOOP:
-#ifdef HEAP_MATCH_RECURSE
-release_match_heapframes(&frame_zero, mb);
-#endif
-
-/* Release any frames that were saved from recursions. */
+/* Release an enlarged frame vector that is on the heap. */
-while (mb->ovecsave_chain != NULL)
- {
- ovecsave_frame *this = mb->ovecsave_chain;
- mb->ovecsave_chain = this->next;
- mb->memctl.free(this, mb->memctl.memory_data);
- }
+if (mb->match_frames != mb->stack_frames)
+ mb->memctl.free(mb->match_frames, mb->memctl.memory_data);
/* Fill in fields that are always returned in the match data. */
@@ -7129,68 +6797,14 @@ match_data->subject = subject;
match_data->mark = mb->mark;
match_data->matchedby = PCRE2_MATCHEDBY_INTERPRETER;
-/* Handle a fully successful match. */
+/* Handle a fully successful match. Set the return code to the number of
+captured strings, or 0 if there were too many to fit into the ovector, and then
+set the remaining returned values before returning. */
-if (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
+if (rc == MATCH_MATCH)
{
- uint32_t arg_offset_max = 2 * match_data->oveccount;
-
- /* When the offset vector is big enough to deal with any backreferences,
- captured substring offsets will already be set up. In the case where we had
- to get some local memory to hold offsets for backreference processing, copy
- those that we can. In this case there need not be overflow if certain parts
- of the pattern were not used, even though there are more capturing
- parentheses than vector slots. */
-
- if (using_temporary_offsets)
- {
- if (arg_offset_max >= 4)
- {
- memcpy(match_data->ovector + 2, mb->ovector + 2,
- (arg_offset_max - 2) * sizeof(PCRE2_SIZE));
- }
- if (mb->end_offset_top > arg_offset_max) mb->capture_last |= OVFLBIT;
- mb->memctl.free(mb->ovector, mb->memctl.memory_data);
- }
-
- /* Set the return code to the number of captured strings, or 0 if there were
- too many to fit into the ovector. */
-
- match_data->rc = ((mb->capture_last & OVFLBIT) != 0)?
- 0 : (int)mb->end_offset_top/2;
-
- /* If there is space in the offset vector, set any pairs that follow the
- highest-numbered captured string but are less than the number of capturing
- groups in the pattern (and are within the ovector) to PCRE2_UNSET. It is
- documented that this happens. In earlier versions, the whole set of potential
- capturing offsets was initialized each time round the loop, but this is
- handled differently now. "Gaps" are set to PCRE2_UNSET dynamically instead
- (this fixed a bug). Thus, it is only those at the end that need setting here.
- We can't just mark them all unset at the start of the whole thing because
- they may get set in one branch that is not the final matching branch. */
-
- if (mb->end_offset_top/2 <= re->top_bracket)
- {
- PCRE2_SIZE *iptr, *iend;
- int resetcount = re->top_bracket + 1;
- if (resetcount > match_data->oveccount) resetcount = match_data->oveccount;
- iptr = match_data->ovector + mb->end_offset_top;
- iend = match_data->ovector + 2 * resetcount;
- while (iptr < iend) *iptr++ = PCRE2_UNSET;
- }
-
- /* If there is space, set up the whole thing as substring 0. The value of
- mb->start_match_ptr might be modified if \K was encountered on the success
- matching path. */
-
- if (match_data->oveccount < 1) rc = 0; else
- {
- match_data->ovector[0] = mb->start_match_ptr - mb->start_subject;
- match_data->ovector[1] = mb->end_match_ptr - mb->start_subject;
- }
-
- /* Set the remaining returned values */
-
+ match_data->rc = ((int)mb->end_offset_top >= 2 * match_data->oveccount)?
+ 0 : (int)mb->end_offset_top/2 + 1;
match_data->startchar = start_match - subject;
match_data->leftchar = mb->start_used_ptr - subject;
match_data->rightchar = ((mb->last_used_ptr > mb->end_match_ptr)?
@@ -7206,18 +6820,14 @@ match_data->mark = mb->nomatch_mark;
/* For anything other than nomatch or partial match, just return the code. */
-if (rc != MATCH_NOMATCH && rc != PCRE2_ERROR_PARTIAL)
- match_data->rc = rc;
+if (rc != MATCH_NOMATCH && rc != PCRE2_ERROR_PARTIAL) match_data->rc = rc;
-/* Else handle a partial match. */
+/* Handle a partial match. */
else if (match_partial != NULL)
{
- if (match_data->oveccount > 0)
- {
- match_data->ovector[0] = match_partial - subject;
- match_data->ovector[1] = end_subject - subject;
- }
+ match_data->ovector[0] = match_partial - subject;
+ match_data->ovector[1] = end_subject - subject;
match_data->startchar = match_partial - subject;
match_data->leftchar = start_partial - subject;
match_data->rightchar = end_subject - subject;
@@ -7228,10 +6838,6 @@ else if (match_partial != NULL)
else match_data->rc = PCRE2_ERROR_NOMATCH;
-/* Free any temporary offsets. */
-
-if (using_temporary_offsets)
- mb->memctl.free(mb->ovector, mb->memctl.memory_data);
return match_data->rc;
}
diff --git a/thirdparty/pcre2/src/pcre2_match_data.c b/thirdparty/pcre2/src/pcre2_match_data.c
index 85ac998348..b297f326b5 100644
--- a/thirdparty/pcre2/src/pcre2_match_data.c
+++ b/thirdparty/pcre2/src/pcre2_match_data.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
* Create a match data block given ovector size *
*************************************************/
-/* A minimum of 1 is imposed on the number of ovector triplets. */
+/* A minimum of 1 is imposed on the number of ovector pairs. */
PCRE2_EXP_DEFN pcre2_match_data * PCRE2_CALL_CONVENTION
pcre2_match_data_create(uint32_t oveccount, pcre2_general_context *gcontext)
@@ -59,7 +59,7 @@ pcre2_match_data_create(uint32_t oveccount, pcre2_general_context *gcontext)
pcre2_match_data *yield;
if (oveccount < 1) oveccount = 1;
yield = PRIV(memctl_malloc)(
- sizeof(pcre2_match_data) + 3*oveccount*sizeof(PCRE2_SIZE),
+ offsetof(pcre2_match_data, ovector) + 2*oveccount*sizeof(PCRE2_SIZE),
(pcre2_memctl *)gcontext);
if (yield == NULL) return NULL;
yield->oveccount = oveccount;
diff --git a/thirdparty/pcre2/src/pcre2_pattern_info.c b/thirdparty/pcre2/src/pcre2_pattern_info.c
index 5b32a905b0..906e9198f5 100644
--- a/thirdparty/pcre2/src/pcre2_pattern_info.c
+++ b/thirdparty/pcre2/src/pcre2_pattern_info.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -75,10 +75,13 @@ if (where == NULL) /* Requests field length */
case PCRE2_INFO_BACKREFMAX:
case PCRE2_INFO_BSR:
case PCRE2_INFO_CAPTURECOUNT:
+ case PCRE2_INFO_DEPTHLIMIT:
+ case PCRE2_INFO_EXTRAOPTIONS:
case PCRE2_INFO_FIRSTCODETYPE:
case PCRE2_INFO_FIRSTCODEUNIT:
case PCRE2_INFO_HASBACKSLASHC:
case PCRE2_INFO_HASCRORLF:
+ case PCRE2_INFO_HEAPLIMIT:
case PCRE2_INFO_JCHANGED:
case PCRE2_INFO_LASTCODETYPE:
case PCRE2_INFO_LASTCODEUNIT:
@@ -89,7 +92,6 @@ if (where == NULL) /* Requests field length */
case PCRE2_INFO_NAMEENTRYSIZE:
case PCRE2_INFO_NAMECOUNT:
case PCRE2_INFO_NEWLINE:
- case PCRE2_INFO_RECURSIONLIMIT:
return sizeof(uint32_t);
case PCRE2_INFO_FIRSTBITMAP:
@@ -97,6 +99,7 @@ if (where == NULL) /* Requests field length */
case PCRE2_INFO_JITSIZE:
case PCRE2_INFO_SIZE:
+ case PCRE2_INFO_FRAMESIZE:
return sizeof(size_t);
case PCRE2_INFO_NAMETABLE:
@@ -137,6 +140,15 @@ switch(what)
*((uint32_t *)where) = re->top_bracket;
break;
+ case PCRE2_INFO_DEPTHLIMIT:
+ *((uint32_t *)where) = re->limit_depth;
+ if (re->limit_depth == UINT32_MAX) return PCRE2_ERROR_UNSET;
+ break;
+
+ case PCRE2_INFO_EXTRAOPTIONS:
+ *((uint32_t *)where) = re->extra_options;
+ break;
+
case PCRE2_INFO_FIRSTCODETYPE:
*((uint32_t *)where) = ((re->flags & PCRE2_FIRSTSET) != 0)? 1 :
((re->flags & PCRE2_STARTLINE) != 0)? 2 : 0;
@@ -152,6 +164,11 @@ switch(what)
&(re->start_bitmap[0]) : NULL;
break;
+ case PCRE2_INFO_FRAMESIZE:
+ *((size_t *)where) = offsetof(heapframe, ovector) +
+ re->top_bracket * 2 * sizeof(PCRE2_SIZE);
+ break;
+
case PCRE2_INFO_HASBACKSLASHC:
*((uint32_t *)where) = (re->flags & PCRE2_HASBKC) != 0;
break;
@@ -160,6 +177,11 @@ switch(what)
*((uint32_t *)where) = (re->flags & PCRE2_HASCRORLF) != 0;
break;
+ case PCRE2_INFO_HEAPLIMIT:
+ *((uint32_t *)where) = re->limit_heap;
+ if (re->limit_heap == UINT32_MAX) return PCRE2_ERROR_UNSET;
+ break;
+
case PCRE2_INFO_JCHANGED:
*((uint32_t *)where) = (re->flags & PCRE2_JCHANGED) != 0;
break;
@@ -215,11 +237,6 @@ switch(what)
*((uint32_t *)where) = re->newline_convention;
break;
- case PCRE2_INFO_RECURSIONLIMIT:
- *((uint32_t *)where) = re->limit_recursion;
- if (re->limit_recursion == UINT32_MAX) return PCRE2_ERROR_UNSET;
- break;
-
case PCRE2_INFO_SIZE:
*((size_t *)where) = re->blocksize;
break;
@@ -255,11 +272,15 @@ pcre2_real_code *re = (pcre2_real_code *)code;
pcre2_callout_enumerate_block cb;
PCRE2_SPTR cc;
#ifdef SUPPORT_UNICODE
-BOOL utf = (re->overall_options & PCRE2_UTF) != 0;
+BOOL utf;
#endif
if (re == NULL) return PCRE2_ERROR_NULL;
+#ifdef SUPPORT_UNICODE
+utf = (re->overall_options & PCRE2_UTF) != 0;
+#endif
+
/* Check that the first field in the block is the magic number. If it is not,
return with PCRE2_ERROR_BADMAGIC. */
diff --git a/thirdparty/pcre2/src/pcre2_printint.c b/thirdparty/pcre2/src/pcre2_printint.c
deleted file mode 100644
index 6207497648..0000000000
--- a/thirdparty/pcre2/src/pcre2_printint.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
- Written by Philip Hazel
- Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
-
------------------------------------------------------------------------------
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of the University of Cambridge nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
-*/
-
-
-/* This module contains a PCRE private debugging function for printing out the
-internal form of a compiled regular expression, along with some supporting
-local functions. This source file is #included in pcre2test.c at each supported
-code unit width, with PCRE2_SUFFIX set appropriately, just like the functions
-that comprise the library. It can also optionally be included in
-pcre2_compile.c for detailed debugging in error situations. */
-
-
-/* Tables of operator names. The same 8-bit table is used for all code unit
-widths, so it must be defined only once. The list itself is defined in
-pcre2_internal.h, which is #included by pcre2test before this file. */
-
-#ifndef OP_LISTS_DEFINED
-static const char *OP_names[] = { OP_NAME_LIST };
-#define OP_LISTS_DEFINED
-#endif
-
-/* The functions and tables herein must all have mode-dependent names. */
-
-#define OP_lengths PCRE2_SUFFIX(OP_lengths_)
-#define get_ucpname PCRE2_SUFFIX(get_ucpname_)
-#define pcre2_printint PCRE2_SUFFIX(pcre2_printint_)
-#define print_char PCRE2_SUFFIX(print_char_)
-#define print_custring PCRE2_SUFFIX(print_custring_)
-#define print_custring_bylen PCRE2_SUFFIX(print_custring_bylen_)
-#define print_prop PCRE2_SUFFIX(print_prop_)
-
-/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
-the definition is next to the definition of the opcodes in pcre2_internal.h.
-The contents of the table are, however, mode-dependent. */
-
-static const uint8_t OP_lengths[] = { OP_LENGTHS };
-
-
-
-/*************************************************
-* Print one character from a string *
-*************************************************/
-
-/* In UTF mode the character may occupy more than one code unit.
-
-Arguments:
- f file to write to
- ptr pointer to first code unit of the character
- utf TRUE if string is UTF (will be FALSE if UTF is not supported)
-
-Returns: number of additional code units used
-*/
-
-static unsigned int
-print_char(FILE *f, PCRE2_SPTR ptr, BOOL utf)
-{
-uint32_t c = *ptr;
-BOOL one_code_unit = !utf;
-
-/* If UTF is supported and requested, check for a valid single code unit. */
-
-#ifdef SUPPORT_UNICODE
-if (utf)
- {
-#if PCRE2_CODE_UNIT_WIDTH == 8
- one_code_unit = c < 0x80;
-#elif PCRE2_CODE_UNIT_WIDTH == 16
- one_code_unit = (c & 0xfc00) != 0xd800;
-#else
- one_code_unit = (c & 0xfffff800u) != 0xd800u;
-#endif /* CODE_UNIT_WIDTH */
- }
-#endif /* SUPPORT_UNICODE */
-
-/* Handle a valid one-code-unit character at any width. */
-
-if (one_code_unit)
- {
- if (PRINTABLE(c)) fprintf(f, "%c", (char)c);
- else if (c < 0x80) fprintf(f, "\\x%02x", c);
- else fprintf(f, "\\x{%02x}", c);
- return 0;
- }
-
-/* Code for invalid UTF code units and multi-unit UTF characters is different
-for each width. If UTF is not supported, control should never get here, but we
-need a return statement to keep the compiler happy. */
-
-#ifndef SUPPORT_UNICODE
-return 0;
-#else
-
-/* Malformed UTF-8 should occur only if the sanity check has been turned off.
-Rather than swallow random bytes, just stop if we hit a bad one. Print it with
-\X instead of \x as an indication. */
-
-#if PCRE2_CODE_UNIT_WIDTH == 8
-if ((c & 0xc0) != 0xc0)
- {
- fprintf(f, "\\X{%x}", c); /* Invalid starting byte */
- return 0;
- }
-else
- {
- int i;
- int a = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes */
- int s = 6*a;
- c = (c & PRIV(utf8_table3)[a]) << s;
- for (i = 1; i <= a; i++)
- {
- if ((ptr[i] & 0xc0) != 0x80)
- {
- fprintf(f, "\\X{%x}", c); /* Invalid secondary byte */
- return i - 1;
- }
- s -= 6;
- c |= (ptr[i] & 0x3f) << s;
- }
- fprintf(f, "\\x{%x}", c);
- return a;
-}
-#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
-
-/* UTF-16: rather than swallow a low surrogate, just stop if we hit a bad one.
-Print it with \X instead of \x as an indication. */
-
-#if PCRE2_CODE_UNIT_WIDTH == 16
-if ((ptr[1] & 0xfc00) != 0xdc00)
- {
- fprintf(f, "\\X{%x}", c);
- return 0;
- }
-c = (((c & 0x3ff) << 10) | (ptr[1] & 0x3ff)) + 0x10000;
-fprintf(f, "\\x{%x}", c);
-return 1;
-#endif /* PCRE2_CODE_UNIT_WIDTH == 16 */
-
-/* For UTF-32 we get here only for a malformed code unit, which should only
-occur if the sanity check has been turned off. Print it with \X instead of \x
-as an indication. */
-
-#if PCRE2_CODE_UNIT_WIDTH == 32
-fprintf(f, "\\X{%x}", c);
-return 0;
-#endif /* PCRE2_CODE_UNIT_WIDTH == 32 */
-#endif /* SUPPORT_UNICODE */
-}
-
-
-
-/*************************************************
-* Print string as a list of code units *
-*************************************************/
-
-/* These take no account of UTF as they always print each individual code unit.
-The string is zero-terminated for print_custring(); the length is given for
-print_custring_bylen().
-
-Arguments:
- f file to write to
- ptr point to the string
- len length for print_custring_bylen()
-
-Returns: nothing
-*/
-
-static void
-print_custring(FILE *f, PCRE2_SPTR ptr)
-{
-while (*ptr != '\0')
- {
- uint32_t c = *ptr++;
- if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
- }
-}
-
-static void
-print_custring_bylen(FILE *f, PCRE2_SPTR ptr, PCRE2_UCHAR len)
-{
-for (; len > 0; len--)
- {
- uint32_t c = *ptr++;
- if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
- }
-}
-
-
-
-/*************************************************
-* Find Unicode property name *
-*************************************************/
-
-/* When there is no UTF/UCP support, the table of names does not exist. This
-function should not be called in such configurations, because a pattern that
-tries to use Unicode properties won't compile. Rather than put lots of #ifdefs
-into the main code, however, we just put one into this function. */
-
-static const char *
-get_ucpname(unsigned int ptype, unsigned int pvalue)
-{
-#ifdef SUPPORT_UNICODE
-int i;
-for (i = PRIV(utt_size) - 1; i >= 0; i--)
- {
- if (ptype == PRIV(utt)[i].type && pvalue == PRIV(utt)[i].value) break;
- }
-return (i >= 0)? PRIV(utt_names) + PRIV(utt)[i].name_offset : "??";
-#else /* No UTF support */
-(void)ptype;
-(void)pvalue;
-return "??";
-#endif /* SUPPORT_UNICODE */
-}
-
-
-
-/*************************************************
-* Print Unicode property value *
-*************************************************/
-
-/* "Normal" properties can be printed from tables. The PT_CLIST property is a
-pseudo-property that contains a pointer to a list of case-equivalent
-characters.
-
-Arguments:
- f file to write to
- code pointer in the compiled code
- before text to print before
- after text to print after
-
-Returns: nothing
-*/
-
-static void
-print_prop(FILE *f, PCRE2_SPTR code, const char *before, const char *after)
-{
-if (code[1] != PT_CLIST)
- {
- fprintf(f, "%s%s %s%s", before, OP_names[*code], get_ucpname(code[1],
- code[2]), after);
- }
-else
- {
- const char *not = (*code == OP_PROP)? "" : "not ";
- const uint32_t *p = PRIV(ucd_caseless_sets) + code[2];
- fprintf (f, "%s%sclist", before, not);
- while (*p < NOTACHAR) fprintf(f, " %04x", *p++);
- fprintf(f, "%s", after);
- }
-}
-
-
-
-/*************************************************
-* Print compiled pattern *
-*************************************************/
-
-/* The print_lengths flag controls whether offsets and lengths of items are
-printed. Lenths can be turned off from pcre2test so that automatic tests on
-bytecode can be written that do not depend on the value of LINK_SIZE.
-
-Arguments:
- re a compiled pattern
- f the file to write to
- print_lengths show various lengths
-
-Returns: nothing
-*/
-
-static void
-pcre2_printint(pcre2_code *re, FILE *f, BOOL print_lengths)
-{
-PCRE2_SPTR codestart, nametable, code;
-uint32_t nesize = re->name_entry_size;
-BOOL utf = (re->overall_options & PCRE2_UTF) != 0;
-
-nametable = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code));
-code = codestart = nametable + re->name_count * re->name_entry_size;
-
-for(;;)
- {
- PCRE2_SPTR ccode;
- uint32_t c;
- int i;
- const char *flag = " ";
- unsigned int extra = 0;
-
- if (print_lengths)
- fprintf(f, "%3d ", (int)(code - codestart));
- else
- fprintf(f, " ");
-
- switch(*code)
- {
-/* ========================================================================== */
- /* These cases are never obeyed. This is a fudge that causes a compile-
- time error if the vectors OP_names or OP_lengths, which are indexed
- by opcode, are not the correct length. It seems to be the only way to do
- such a check at compile time, as the sizeof() operator does not work in
- the C preprocessor. */
-
- case OP_TABLE_LENGTH:
- case OP_TABLE_LENGTH +
- ((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) &&
- (sizeof(OP_lengths) == OP_TABLE_LENGTH)):
- break;
-/* ========================================================================== */
-
- case OP_END:
- fprintf(f, " %s\n", OP_names[*code]);
- fprintf(f, "------------------------------------------------------------------\n");
- return;
-
- case OP_CHAR:
- fprintf(f, " ");
- do
- {
- code++;
- code += 1 + print_char(f, code, utf);
- }
- while (*code == OP_CHAR);
- fprintf(f, "\n");
- continue;
-
- case OP_CHARI:
- fprintf(f, " /i ");
- do
- {
- code++;
- code += 1 + print_char(f, code, utf);
- }
- while (*code == OP_CHARI);
- fprintf(f, "\n");
- continue;
-
- case OP_CBRA:
- case OP_CBRAPOS:
- case OP_SCBRA:
- case OP_SCBRAPOS:
- if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
- else fprintf(f, " ");
- fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
- break;
-
- case OP_BRA:
- case OP_BRAPOS:
- case OP_SBRA:
- case OP_SBRAPOS:
- case OP_KETRMAX:
- case OP_KETRMIN:
- case OP_KETRPOS:
- case OP_ALT:
- case OP_KET:
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- case OP_ONCE:
- case OP_ONCE_NC:
- case OP_COND:
- case OP_SCOND:
- case OP_REVERSE:
- if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
- else fprintf(f, " ");
- fprintf(f, "%s", OP_names[*code]);
- break;
-
- case OP_CLOSE:
- fprintf(f, " %s %d", OP_names[*code], GET2(code, 1));
- break;
-
- case OP_CREF:
- fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
- break;
-
- case OP_DNCREF:
- {
- PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE;
- fprintf(f, " %s Cond ref <", flag);
- print_custring(f, entry);
- fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
- }
- break;
-
- case OP_RREF:
- c = GET2(code, 1);
- if (c == RREF_ANY)
- fprintf(f, " Cond recurse any");
- else
- fprintf(f, " Cond recurse %d", c);
- break;
-
- case OP_DNRREF:
- {
- PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE;
- fprintf(f, " %s Cond recurse <", flag);
- print_custring(f, entry);
- fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
- }
- break;
-
- case OP_FALSE:
- fprintf(f, " Cond false");
- break;
-
- case OP_TRUE:
- fprintf(f, " Cond true");
- break;
-
- case OP_STARI:
- case OP_MINSTARI:
- case OP_POSSTARI:
- case OP_PLUSI:
- case OP_MINPLUSI:
- case OP_POSPLUSI:
- case OP_QUERYI:
- case OP_MINQUERYI:
- case OP_POSQUERYI:
- flag = "/i";
- /* Fall through */
- case OP_STAR:
- case OP_MINSTAR:
- case OP_POSSTAR:
- case OP_PLUS:
- case OP_MINPLUS:
- case OP_POSPLUS:
- case OP_QUERY:
- case OP_MINQUERY:
- case OP_POSQUERY:
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEPOSSTAR:
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- case OP_TYPEPOSPLUS:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- case OP_TYPEPOSQUERY:
- fprintf(f, " %s ", flag);
-
- if (*code >= OP_TYPESTAR)
- {
- if (code[1] == OP_PROP || code[1] == OP_NOTPROP)
- {
- print_prop(f, code + 1, "", " ");
- extra = 2;
- }
- else fprintf(f, "%s", OP_names[code[1]]);
- }
- else extra = print_char(f, code+1, utf);
- fprintf(f, "%s", OP_names[*code]);
- break;
-
- case OP_EXACTI:
- case OP_UPTOI:
- case OP_MINUPTOI:
- case OP_POSUPTOI:
- flag = "/i";
- /* Fall through */
- case OP_EXACT:
- case OP_UPTO:
- case OP_MINUPTO:
- case OP_POSUPTO:
- fprintf(f, " %s ", flag);
- extra = print_char(f, code + 1 + IMM2_SIZE, utf);
- fprintf(f, "{");
- if (*code != OP_EXACT && *code != OP_EXACTI) fprintf(f, "0,");
- fprintf(f, "%d}", GET2(code,1));
- if (*code == OP_MINUPTO || *code == OP_MINUPTOI) fprintf(f, "?");
- else if (*code == OP_POSUPTO || *code == OP_POSUPTOI) fprintf(f, "+");
- break;
-
- case OP_TYPEEXACT:
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- case OP_TYPEPOSUPTO:
- if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
- {
- print_prop(f, code + IMM2_SIZE + 1, " ", " ");
- extra = 2;
- }
- else fprintf(f, " %s", OP_names[code[1 + IMM2_SIZE]]);
- fprintf(f, "{");
- if (*code != OP_TYPEEXACT) fprintf(f, "0,");
- fprintf(f, "%d}", GET2(code,1));
- if (*code == OP_TYPEMINUPTO) fprintf(f, "?");
- else if (*code == OP_TYPEPOSUPTO) fprintf(f, "+");
- break;
-
- case OP_NOTI:
- flag = "/i";
- /* Fall through */
- case OP_NOT:
- fprintf(f, " %s [^", flag);
- extra = print_char(f, code + 1, utf);
- fprintf(f, "]");
- break;
-
- case OP_NOTSTARI:
- case OP_NOTMINSTARI:
- case OP_NOTPOSSTARI:
- case OP_NOTPLUSI:
- case OP_NOTMINPLUSI:
- case OP_NOTPOSPLUSI:
- case OP_NOTQUERYI:
- case OP_NOTMINQUERYI:
- case OP_NOTPOSQUERYI:
- flag = "/i";
- /* Fall through */
-
- case OP_NOTSTAR:
- case OP_NOTMINSTAR:
- case OP_NOTPOSSTAR:
- case OP_NOTPLUS:
- case OP_NOTMINPLUS:
- case OP_NOTPOSPLUS:
- case OP_NOTQUERY:
- case OP_NOTMINQUERY:
- case OP_NOTPOSQUERY:
- fprintf(f, " %s [^", flag);
- extra = print_char(f, code + 1, utf);
- fprintf(f, "]%s", OP_names[*code]);
- break;
-
- case OP_NOTEXACTI:
- case OP_NOTUPTOI:
- case OP_NOTMINUPTOI:
- case OP_NOTPOSUPTOI:
- flag = "/i";
- /* Fall through */
-
- case OP_NOTEXACT:
- case OP_NOTUPTO:
- case OP_NOTMINUPTO:
- case OP_NOTPOSUPTO:
- fprintf(f, " %s [^", flag);
- extra = print_char(f, code + 1 + IMM2_SIZE, utf);
- fprintf(f, "]{");
- if (*code != OP_NOTEXACT && *code != OP_NOTEXACTI) fprintf(f, "0,");
- fprintf(f, "%d}", GET2(code,1));
- if (*code == OP_NOTMINUPTO || *code == OP_NOTMINUPTOI) fprintf(f, "?");
- else
- if (*code == OP_NOTPOSUPTO || *code == OP_NOTPOSUPTOI) fprintf(f, "+");
- break;
-
- case OP_RECURSE:
- if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
- else fprintf(f, " ");
- fprintf(f, "%s", OP_names[*code]);
- break;
-
- case OP_REFI:
- flag = "/i";
- /* Fall through */
- case OP_REF:
- fprintf(f, " %s \\%d", flag, GET2(code,1));
- ccode = code + OP_lengths[*code];
- goto CLASS_REF_REPEAT;
-
- case OP_DNREFI:
- flag = "/i";
- /* Fall through */
- case OP_DNREF:
- {
- PCRE2_SPTR entry = nametable + (GET2(code, 1) * nesize) + IMM2_SIZE;
- fprintf(f, " %s \\k<", flag);
- print_custring(f, entry);
- fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
- }
- ccode = code + OP_lengths[*code];
- goto CLASS_REF_REPEAT;
-
- case OP_CALLOUT:
- fprintf(f, " %s %d %d %d", OP_names[*code], code[1 + 2*LINK_SIZE],
- GET(code, 1), GET(code, 1 + LINK_SIZE));
- break;
-
- case OP_CALLOUT_STR:
- c = code[1 + 4*LINK_SIZE];
- fprintf(f, " %s %c", OP_names[*code], c);
- extra = GET(code, 1 + 2*LINK_SIZE);
- print_custring_bylen(f, code + 2 + 4*LINK_SIZE, extra - 3 - 4*LINK_SIZE);
- for (i = 0; PRIV(callout_start_delims)[i] != 0; i++)
- if (c == PRIV(callout_start_delims)[i])
- {
- c = PRIV(callout_end_delims)[i];
- break;
- }
- fprintf(f, "%c %d %d %d", c, GET(code, 1 + 3*LINK_SIZE), GET(code, 1),
- GET(code, 1 + LINK_SIZE));
- break;
-
- case OP_PROP:
- case OP_NOTPROP:
- print_prop(f, code, " ", "");
- break;
-
- /* OP_XCLASS cannot occur in 8-bit, non-UTF mode. However, there's no harm
- in having this code always here, and it makes it less messy without all
- those #ifdefs. */
-
- case OP_CLASS:
- case OP_NCLASS:
- case OP_XCLASS:
- {
- unsigned int min, max;
- BOOL printmap;
- BOOL invertmap = FALSE;
- uint8_t *map;
- uint8_t inverted_map[32];
-
- fprintf(f, " [");
-
- if (*code == OP_XCLASS)
- {
- extra = GET(code, 1);
- ccode = code + LINK_SIZE + 1;
- printmap = (*ccode & XCL_MAP) != 0;
- if ((*ccode & XCL_NOT) != 0)
- {
- invertmap = (*ccode & XCL_HASPROP) == 0;
- fprintf(f, "^");
- }
- ccode++;
- }
- else
- {
- printmap = TRUE;
- ccode = code + 1;
- }
-
- /* Print a bit map */
-
- if (printmap)
- {
- map = (uint8_t *)ccode;
- if (invertmap)
- {
- for (i = 0; i < 32; i++) inverted_map[i] = ~map[i];
- map = inverted_map;
- }
-
- for (i = 0; i < 256; i++)
- {
- if ((map[i/8] & (1 << (i&7))) != 0)
- {
- int j;
- for (j = i+1; j < 256; j++)
- if ((map[j/8] & (1 << (j&7))) == 0) break;
- if (i == '-' || i == ']') fprintf(f, "\\");
- if (PRINTABLE(i)) fprintf(f, "%c", i);
- else fprintf(f, "\\x%02x", i);
- if (--j > i)
- {
- if (j != i + 1) fprintf(f, "-");
- if (j == '-' || j == ']') fprintf(f, "\\");
- if (PRINTABLE(j)) fprintf(f, "%c", j);
- else fprintf(f, "\\x%02x", j);
- }
- i = j;
- }
- }
- ccode += 32 / sizeof(PCRE2_UCHAR);
- }
-
- /* For an XCLASS there is always some additional data */
-
- if (*code == OP_XCLASS)
- {
- PCRE2_UCHAR ch;
- while ((ch = *ccode++) != XCL_END)
- {
- BOOL not = FALSE;
- const char *notch = "";
-
- switch(ch)
- {
- case XCL_NOTPROP:
- not = TRUE;
- notch = "^";
- /* Fall through */
-
- case XCL_PROP:
- {
- unsigned int ptype = *ccode++;
- unsigned int pvalue = *ccode++;
-
- switch(ptype)
- {
- case PT_PXGRAPH:
- fprintf(f, "[:%sgraph:]", notch);
- break;
-
- case PT_PXPRINT:
- fprintf(f, "[:%sprint:]", notch);
- break;
-
- case PT_PXPUNCT:
- fprintf(f, "[:%spunct:]", notch);
- break;
-
- default:
- fprintf(f, "\\%c{%s}", (not? 'P':'p'),
- get_ucpname(ptype, pvalue));
- break;
- }
- }
- break;
-
- default:
- ccode += 1 + print_char(f, ccode, utf);
- if (ch == XCL_RANGE)
- {
- fprintf(f, "-");
- ccode += 1 + print_char(f, ccode, utf);
- }
- break;
- }
- }
- }
-
- /* Indicate a non-UTF class which was created by negation */
-
- fprintf(f, "]%s", (*code == OP_NCLASS)? " (neg)" : "");
-
- /* Handle repeats after a class or a back reference */
-
- CLASS_REF_REPEAT:
- switch(*ccode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- case OP_CRPOSSTAR:
- case OP_CRPOSPLUS:
- case OP_CRPOSQUERY:
- fprintf(f, "%s", OP_names[*ccode]);
- extra += OP_lengths[*ccode];
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- case OP_CRPOSRANGE:
- min = GET2(ccode,1);
- max = GET2(ccode,1 + IMM2_SIZE);
- if (max == 0) fprintf(f, "{%u,}", min);
- else fprintf(f, "{%u,%u}", min, max);
- if (*ccode == OP_CRMINRANGE) fprintf(f, "?");
- else if (*ccode == OP_CRPOSRANGE) fprintf(f, "+");
- extra += OP_lengths[*ccode];
- break;
-
- /* Do nothing if it's not a repeat; this code stops picky compilers
- warning about the lack of a default code path. */
-
- default:
- break;
- }
- }
- break;
-
- case OP_MARK:
- case OP_PRUNE_ARG:
- case OP_SKIP_ARG:
- case OP_THEN_ARG:
- fprintf(f, " %s ", OP_names[*code]);
- print_custring_bylen(f, code + 2, code[1]);
- extra += code[1];
- break;
-
- case OP_THEN:
- fprintf(f, " %s", OP_names[*code]);
- break;
-
- case OP_CIRCM:
- case OP_DOLLM:
- flag = "/m";
- /* Fall through */
-
- /* Anything else is just an item with no data, but possibly a flag. */
-
- default:
- fprintf(f, " %s %s", flag, OP_names[*code]);
- break;
- }
-
- code += OP_lengths[*code] + extra;
- fprintf(f, "\n");
- }
-}
-
-/* End of pcre2_printint.c */
diff --git a/thirdparty/pcre2/src/pcre2_serialize.c b/thirdparty/pcre2/src/pcre2_serialize.c
index 0af26d8fc3..d2cc603cbb 100644
--- a/thirdparty/pcre2/src/pcre2_serialize.c
+++ b/thirdparty/pcre2/src/pcre2_serialize.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -214,7 +214,10 @@ for (i = 0; i < number_of_codes; i++)
if (dst_re->magic_number != MAGIC_NUMBER ||
dst_re->name_entry_size > MAX_NAME_SIZE + IMM2_SIZE + 1 ||
dst_re->name_count > MAX_NAME_COUNT)
+ {
+ memctl->free(dst_re, memctl->memory_data);
return PCRE2_ERROR_BADSERIALIZEDDATA;
+ }
/* At the moment only one table is supported. */
diff --git a/thirdparty/pcre2/src/pcre2_study.c b/thirdparty/pcre2/src/pcre2_study.c
index 5a4d520c09..b92686759d 100644
--- a/thirdparty/pcre2/src/pcre2_study.c
+++ b/thirdparty/pcre2/src/pcre2_study.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -46,10 +46,8 @@ collecting data (e.g. minimum matching length). */
#include "config.h"
#endif
-
#include "pcre2_internal.h"
-
/* The maximum remembered capturing brackets minimum. */
#define MAX_CACHE_BACKREF 128
@@ -158,12 +156,12 @@ for (;;)
}
goto PROCESS_NON_CAPTURE;
- /* There's a special case of OP_ONCE, when it is wrapped round an
+ case OP_BRA:
+ /* There's a special case of OP_BRA, when it is wrapped round a repeated
OP_RECURSE. We'd like to process the latter at this level so that
remembering the value works for repeated cases. So we do nothing, but
set a fudge value to skip over the OP_KET after the recurse. */
- case OP_ONCE:
if (cc[1+LINK_SIZE] == OP_RECURSE && cc[2*(1+LINK_SIZE)] == OP_KET)
{
once_fudge = 1 + LINK_SIZE;
@@ -172,8 +170,7 @@ for (;;)
}
/* Fall through */
- case OP_ONCE_NC:
- case OP_BRA:
+ case OP_ONCE:
case OP_SBRA:
case OP_BRAPOS:
case OP_SBRAPOS:
@@ -789,6 +786,7 @@ if (utf)
if (caseless)
{
+#ifdef SUPPORT_UNICODE
if (utf)
{
#if PCRE2_CODE_UNIT_WIDTH == 8
@@ -801,10 +799,12 @@ if (caseless)
if (c > 0xff) SET_BIT(0xff); else SET_BIT(c);
#endif
}
+ else
+#endif /* SUPPORT_UNICODE */
/* Not UTF */
- else if (MAX_255(c)) SET_BIT(re->tables[fcc_offset + c]);
+ if (MAX_255(c)) SET_BIT(re->tables[fcc_offset + c]);
}
return p;
@@ -953,7 +953,6 @@ do
case OP_ALLANY:
case OP_ANY:
case OP_ANYBYTE:
- case OP_CIRC:
case OP_CIRCM:
case OP_CLOSE:
case OP_COMMIT:
@@ -1021,6 +1020,13 @@ do
case OP_THEN_ARG:
return SSB_FAIL;
+ /* OP_CIRC happens only at the start of an anchored branch (multiline ^
+ uses OP_CIRCM). Skip over it. */
+
+ case OP_CIRC:
+ tcode += PRIV(OP_lengths)[OP_CIRC];
+ break;
+
/* A "real" property test implies no starting bits, but the fake property
PT_CLIST identifies a list of characters. These lists are short, as they
are used for characters with more than one "other case", so there is no
@@ -1067,7 +1073,6 @@ do
case OP_CBRAPOS:
case OP_SCBRAPOS:
case OP_ONCE:
- case OP_ONCE_NC:
case OP_ASSERT:
rc = set_start_bits(re, tcode, utf);
if (rc == SSB_FAIL || rc == SSB_UNKNOWN) return rc;
@@ -1449,6 +1454,10 @@ do
classmap = ((tcode[1 + LINK_SIZE] & XCL_MAP) == 0)? NULL :
(uint8_t *)(tcode + 1 + LINK_SIZE + 1);
#endif
+ /* It seems that the fall through comment must be outside the #ifdef if
+ it is to avoid the gcc compiler warning. */
+
+ /* Fall through */
/* Enter here for a negative non-XCLASS. In the 8-bit library, if we are
in UTF mode, any byte with a value >= 0xc4 is a potentially valid starter
@@ -1576,12 +1585,11 @@ BOOL utf = (re->overall_options & PCRE2_UTF) != 0;
code = (PCRE2_UCHAR *)((uint8_t *)re + sizeof(pcre2_real_code)) +
re->name_entry_size * re->name_count;
-/* For an anchored pattern, or an unanchored pattern that has a first code
-unit, or a multiline pattern that matches only at "line start", there is no
-point in seeking a list of starting code units. */
+/* For a pattern that has a first code unit, or a multiline pattern that
+matches only at "line start", there is no point in seeking a list of starting
+code units. */
-if ((re->overall_options & PCRE2_ANCHORED) == 0 &&
- (re->flags & (PCRE2_FIRSTSET|PCRE2_STARTLINE)) == 0)
+if ((re->flags & (PCRE2_FIRSTSET|PCRE2_STARTLINE)) == 0)
{
int rc = set_start_bits(re, code, utf);
if (rc == SSB_UNKNOWN) return 1;
diff --git a/thirdparty/pcre2/src/pcre2_substring.c b/thirdparty/pcre2/src/pcre2_substring.c
index f6d7c39722..ddf5774e15 100644
--- a/thirdparty/pcre2/src/pcre2_substring.c
+++ b/thirdparty/pcre2/src/pcre2_substring.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -414,7 +414,12 @@ else
for (i = 0; i < count2; i += 2)
{
size = (ovector[i+1] > ovector[i])? (ovector[i+1] - ovector[i]) : 0;
- memcpy(sp, match_data->subject + ovector[i], CU2BYTES(size));
+
+ /* Size == 0 includes the case when the capture is unset. Avoid adding
+ PCRE2_UNSET to match_data->subject because it overflows, even though with
+ zero size calling memcpy() is harmless. */
+
+ if (size != 0) memcpy(sp, match_data->subject + ovector[i], CU2BYTES(size));
*listp++ = sp;
if (lensp != NULL) *lensp++ = size;
sp += size;
diff --git a/thirdparty/pcre2/src/pcre2_tables.c b/thirdparty/pcre2/src/pcre2_tables.c
index b945ed7a7f..9f8dc293aa 100644
--- a/thirdparty/pcre2/src/pcre2_tables.c
+++ b/thirdparty/pcre2/src/pcre2_tables.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
/* This module contains some fixed tables that are used by more than one of the
-PCRE code modules. The tables are also #included by the pcre2test program,
+PCRE2 code modules. The tables are also #included by the pcre2test program,
which uses macros to change their names from _pcre2_xxx to xxxx, thereby
avoiding name clashes with the library. In this case, PCRE2_PCRE2TEST is
defined. */
@@ -148,7 +148,7 @@ two code points. The breaking rules are as follows:
1. Break at the start and end of text (pretty obviously).
-2. Do not break between a CR and LF; otherwise, break before and after
+2. Do not break between a CR and LF; otherwise, break before and after
controls.
3. Do not break Hangul syllable sequences, the rules for which are:
@@ -157,44 +157,62 @@ two code points. The breaking rules are as follows:
LV or V may be followed by V or T
LVT or T may be followed by T
-4. Do not break before extending characters.
+4. Do not break before extending characters or zero-width-joiner (ZWJ).
-The next two rules are only for extended grapheme clusters (but that's what we
+The following rules are only for extended grapheme clusters (but that's what we
are implementing).
5. Do not break before SpacingMarks.
6. Do not break after Prepend characters.
-7. Otherwise, break everywhere.
+7. Do not break within emoji modifier sequences (E_Base or E_Base_GAZ followed
+ by E_Modifier). Extend characters are allowed before the modifier; this
+ cannot be represented in this table, the code has to deal with it.
+
+8. Do not break within emoji zwj sequences (ZWJ followed by Glue_After_Zwj or
+ E_Base_GAZ).
+
+9. Do not break within emoji flag sequences. That is, do not break between
+ regional indicator (RI) symbols if there are an odd number of RI characters
+ before the break point. This table encodes "join RI characters"; the code
+ has to deal with checking for previous adjoining RIs.
+
+10. Otherwise, break everywhere.
*/
+#define ESZ (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbZWJ)
+
const uint32_t PRIV(ucp_gbtable)[] = {
(1<<ucp_gbLF), /* 0 CR */
0, /* 1 LF */
0, /* 2 Control */
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark), /* 3 Extend */
- (1<<ucp_gbExtend)|(1<<ucp_gbPrepend)| /* 4 Prepend */
- (1<<ucp_gbSpacingMark)|(1<<ucp_gbL)|
- (1<<ucp_gbV)|(1<<ucp_gbT)|(1<<ucp_gbLV)|
- (1<<ucp_gbLVT)|(1<<ucp_gbOther),
-
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark), /* 5 SpacingMark */
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbL)| /* 6 L */
- (1<<ucp_gbL)|(1<<ucp_gbV)|(1<<ucp_gbLV)|(1<<ucp_gbLVT),
-
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbV)| /* 7 V */
- (1<<ucp_gbT),
-
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbT), /* 8 T */
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbV)| /* 9 LV */
- (1<<ucp_gbT),
-
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbT), /* 10 LVT */
+ ESZ, /* 3 Extend */
+ ESZ|(1<<ucp_gbPrepend)| /* 4 Prepend */
+ (1<<ucp_gbL)|(1<<ucp_gbV)|(1<<ucp_gbT)|
+ (1<<ucp_gbLV)|(1<<ucp_gbLVT)|(1<<ucp_gbOther)|
+ (1<<ucp_gbRegionalIndicator)|
+ (1<<ucp_gbE_Base)|(1<<ucp_gbE_Modifier)|
+ (1<<ucp_gbE_Base_GAZ)|
+ (1<<ucp_gbZWJ)|(1<<ucp_gbGlue_After_Zwj),
+ ESZ, /* 5 SpacingMark */
+ ESZ|(1<<ucp_gbL)|(1<<ucp_gbV)|(1<<ucp_gbLV)| /* 6 L */
+ (1<<ucp_gbLVT),
+ ESZ|(1<<ucp_gbV)|(1<<ucp_gbT), /* 7 V */
+ ESZ|(1<<ucp_gbT), /* 8 T */
+ ESZ|(1<<ucp_gbV)|(1<<ucp_gbT), /* 9 LV */
+ ESZ|(1<<ucp_gbT), /* 10 LVT */
(1<<ucp_gbRegionalIndicator), /* 11 RegionalIndicator */
- (1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark) /* 12 Other */
+ ESZ, /* 12 Other */
+ ESZ|(1<<ucp_gbE_Modifier), /* 13 E_Base */
+ ESZ, /* 14 E_Modifier */
+ ESZ|(1<<ucp_gbE_Modifier), /* 15 E_Base_GAZ */
+ ESZ|(1<<ucp_gbGlue_After_Zwj)|(1<<ucp_gbE_Base_GAZ), /* 16 ZWJ */
+ ESZ /* 12 Glue_After_Zwj */
};
+#undef ESZ
+
#ifdef SUPPORT_JIT
/* This table reverses PRIV(ucp_gentype). We can save the cost
of a memory load. */
@@ -227,6 +245,7 @@ version. Like all other character and string literals that are compared against
the regular expression pattern, we must use STR_ macros instead of literal
strings to make sure that UTF-8 support works on EBCDIC platforms. */
+#define STRING_Adlam0 STR_A STR_d STR_l STR_a STR_m "\0"
#define STRING_Ahom0 STR_A STR_h STR_o STR_m "\0"
#define STRING_Anatolian_Hieroglyphs0 STR_A STR_n STR_a STR_t STR_o STR_l STR_i STR_a STR_n STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0"
#define STRING_Any0 STR_A STR_n STR_y "\0"
@@ -238,6 +257,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Bassa_Vah0 STR_B STR_a STR_s STR_s STR_a STR_UNDERSCORE STR_V STR_a STR_h "\0"
#define STRING_Batak0 STR_B STR_a STR_t STR_a STR_k "\0"
#define STRING_Bengali0 STR_B STR_e STR_n STR_g STR_a STR_l STR_i "\0"
+#define STRING_Bhaiksuki0 STR_B STR_h STR_a STR_i STR_k STR_s STR_u STR_k STR_i "\0"
#define STRING_Bopomofo0 STR_B STR_o STR_p STR_o STR_m STR_o STR_f STR_o "\0"
#define STRING_Brahmi0 STR_B STR_r STR_a STR_h STR_m STR_i "\0"
#define STRING_Braille0 STR_B STR_r STR_a STR_i STR_l STR_l STR_e "\0"
@@ -313,6 +333,8 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Malayalam0 STR_M STR_a STR_l STR_a STR_y STR_a STR_l STR_a STR_m "\0"
#define STRING_Mandaic0 STR_M STR_a STR_n STR_d STR_a STR_i STR_c "\0"
#define STRING_Manichaean0 STR_M STR_a STR_n STR_i STR_c STR_h STR_a STR_e STR_a STR_n "\0"
+#define STRING_Marchen0 STR_M STR_a STR_r STR_c STR_h STR_e STR_n "\0"
+#define STRING_Masaram_Gondi0 STR_M STR_a STR_s STR_a STR_r STR_a STR_m STR_UNDERSCORE STR_G STR_o STR_n STR_d STR_i "\0"
#define STRING_Mc0 STR_M STR_c "\0"
#define STRING_Me0 STR_M STR_e "\0"
#define STRING_Meetei_Mayek0 STR_M STR_e STR_e STR_t STR_e STR_i STR_UNDERSCORE STR_M STR_a STR_y STR_e STR_k "\0"
@@ -330,9 +352,11 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Nabataean0 STR_N STR_a STR_b STR_a STR_t STR_a STR_e STR_a STR_n "\0"
#define STRING_Nd0 STR_N STR_d "\0"
#define STRING_New_Tai_Lue0 STR_N STR_e STR_w STR_UNDERSCORE STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_u STR_e "\0"
+#define STRING_Newa0 STR_N STR_e STR_w STR_a "\0"
#define STRING_Nko0 STR_N STR_k STR_o "\0"
#define STRING_Nl0 STR_N STR_l "\0"
#define STRING_No0 STR_N STR_o "\0"
+#define STRING_Nushu0 STR_N STR_u STR_s STR_h STR_u "\0"
#define STRING_Ogham0 STR_O STR_g STR_h STR_a STR_m "\0"
#define STRING_Ol_Chiki0 STR_O STR_l STR_UNDERSCORE STR_C STR_h STR_i STR_k STR_i "\0"
#define STRING_Old_Hungarian0 STR_O STR_l STR_d STR_UNDERSCORE STR_H STR_u STR_n STR_g STR_a STR_r STR_i STR_a STR_n "\0"
@@ -343,6 +367,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Old_South_Arabian0 STR_O STR_l STR_d STR_UNDERSCORE STR_S STR_o STR_u STR_t STR_h STR_UNDERSCORE STR_A STR_r STR_a STR_b STR_i STR_a STR_n "\0"
#define STRING_Old_Turkic0 STR_O STR_l STR_d STR_UNDERSCORE STR_T STR_u STR_r STR_k STR_i STR_c "\0"
#define STRING_Oriya0 STR_O STR_r STR_i STR_y STR_a "\0"
+#define STRING_Osage0 STR_O STR_s STR_a STR_g STR_e "\0"
#define STRING_Osmanya0 STR_O STR_s STR_m STR_a STR_n STR_y STR_a "\0"
#define STRING_P0 STR_P "\0"
#define STRING_Pahawh_Hmong0 STR_P STR_a STR_h STR_a STR_w STR_h STR_UNDERSCORE STR_H STR_m STR_o STR_n STR_g "\0"
@@ -373,6 +398,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Sm0 STR_S STR_m "\0"
#define STRING_So0 STR_S STR_o "\0"
#define STRING_Sora_Sompeng0 STR_S STR_o STR_r STR_a STR_UNDERSCORE STR_S STR_o STR_m STR_p STR_e STR_n STR_g "\0"
+#define STRING_Soyombo0 STR_S STR_o STR_y STR_o STR_m STR_b STR_o "\0"
#define STRING_Sundanese0 STR_S STR_u STR_n STR_d STR_a STR_n STR_e STR_s STR_e "\0"
#define STRING_Syloti_Nagri0 STR_S STR_y STR_l STR_o STR_t STR_i STR_UNDERSCORE STR_N STR_a STR_g STR_r STR_i "\0"
#define STRING_Syriac0 STR_S STR_y STR_r STR_i STR_a STR_c "\0"
@@ -383,6 +409,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Tai_Viet0 STR_T STR_a STR_i STR_UNDERSCORE STR_V STR_i STR_e STR_t "\0"
#define STRING_Takri0 STR_T STR_a STR_k STR_r STR_i "\0"
#define STRING_Tamil0 STR_T STR_a STR_m STR_i STR_l "\0"
+#define STRING_Tangut0 STR_T STR_a STR_n STR_g STR_u STR_t "\0"
#define STRING_Telugu0 STR_T STR_e STR_l STR_u STR_g STR_u "\0"
#define STRING_Thaana0 STR_T STR_h STR_a STR_a STR_n STR_a "\0"
#define STRING_Thai0 STR_T STR_h STR_a STR_i "\0"
@@ -399,11 +426,13 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Xwd0 STR_X STR_w STR_d "\0"
#define STRING_Yi0 STR_Y STR_i "\0"
#define STRING_Z0 STR_Z "\0"
+#define STRING_Zanabazar_Square0 STR_Z STR_a STR_n STR_a STR_b STR_a STR_z STR_a STR_r STR_UNDERSCORE STR_S STR_q STR_u STR_a STR_r STR_e "\0"
#define STRING_Zl0 STR_Z STR_l "\0"
#define STRING_Zp0 STR_Z STR_p "\0"
#define STRING_Zs0 STR_Z STR_s "\0"
const char PRIV(utt_names)[] =
+ STRING_Adlam0
STRING_Ahom0
STRING_Anatolian_Hieroglyphs0
STRING_Any0
@@ -415,6 +444,7 @@ const char PRIV(utt_names)[] =
STRING_Bassa_Vah0
STRING_Batak0
STRING_Bengali0
+ STRING_Bhaiksuki0
STRING_Bopomofo0
STRING_Brahmi0
STRING_Braille0
@@ -490,6 +520,8 @@ const char PRIV(utt_names)[] =
STRING_Malayalam0
STRING_Mandaic0
STRING_Manichaean0
+ STRING_Marchen0
+ STRING_Masaram_Gondi0
STRING_Mc0
STRING_Me0
STRING_Meetei_Mayek0
@@ -507,9 +539,11 @@ const char PRIV(utt_names)[] =
STRING_Nabataean0
STRING_Nd0
STRING_New_Tai_Lue0
+ STRING_Newa0
STRING_Nko0
STRING_Nl0
STRING_No0
+ STRING_Nushu0
STRING_Ogham0
STRING_Ol_Chiki0
STRING_Old_Hungarian0
@@ -520,6 +554,7 @@ const char PRIV(utt_names)[] =
STRING_Old_South_Arabian0
STRING_Old_Turkic0
STRING_Oriya0
+ STRING_Osage0
STRING_Osmanya0
STRING_P0
STRING_Pahawh_Hmong0
@@ -550,6 +585,7 @@ const char PRIV(utt_names)[] =
STRING_Sm0
STRING_So0
STRING_Sora_Sompeng0
+ STRING_Soyombo0
STRING_Sundanese0
STRING_Syloti_Nagri0
STRING_Syriac0
@@ -560,6 +596,7 @@ const char PRIV(utt_names)[] =
STRING_Tai_Viet0
STRING_Takri0
STRING_Tamil0
+ STRING_Tangut0
STRING_Telugu0
STRING_Thaana0
STRING_Thai0
@@ -576,186 +613,197 @@ const char PRIV(utt_names)[] =
STRING_Xwd0
STRING_Yi0
STRING_Z0
+ STRING_Zanabazar_Square0
STRING_Zl0
STRING_Zp0
STRING_Zs0;
const ucp_type_table PRIV(utt)[] = {
- { 0, PT_SC, ucp_Ahom },
- { 5, PT_SC, ucp_Anatolian_Hieroglyphs },
- { 27, PT_ANY, 0 },
- { 31, PT_SC, ucp_Arabic },
- { 38, PT_SC, ucp_Armenian },
- { 47, PT_SC, ucp_Avestan },
- { 55, PT_SC, ucp_Balinese },
- { 64, PT_SC, ucp_Bamum },
- { 70, PT_SC, ucp_Bassa_Vah },
- { 80, PT_SC, ucp_Batak },
- { 86, PT_SC, ucp_Bengali },
- { 94, PT_SC, ucp_Bopomofo },
- { 103, PT_SC, ucp_Brahmi },
- { 110, PT_SC, ucp_Braille },
- { 118, PT_SC, ucp_Buginese },
- { 127, PT_SC, ucp_Buhid },
- { 133, PT_GC, ucp_C },
- { 135, PT_SC, ucp_Canadian_Aboriginal },
- { 155, PT_SC, ucp_Carian },
- { 162, PT_SC, ucp_Caucasian_Albanian },
- { 181, PT_PC, ucp_Cc },
- { 184, PT_PC, ucp_Cf },
- { 187, PT_SC, ucp_Chakma },
- { 194, PT_SC, ucp_Cham },
- { 199, PT_SC, ucp_Cherokee },
- { 208, PT_PC, ucp_Cn },
- { 211, PT_PC, ucp_Co },
- { 214, PT_SC, ucp_Common },
- { 221, PT_SC, ucp_Coptic },
- { 228, PT_PC, ucp_Cs },
- { 231, PT_SC, ucp_Cuneiform },
- { 241, PT_SC, ucp_Cypriot },
- { 249, PT_SC, ucp_Cyrillic },
- { 258, PT_SC, ucp_Deseret },
- { 266, PT_SC, ucp_Devanagari },
- { 277, PT_SC, ucp_Duployan },
- { 286, PT_SC, ucp_Egyptian_Hieroglyphs },
- { 307, PT_SC, ucp_Elbasan },
- { 315, PT_SC, ucp_Ethiopic },
- { 324, PT_SC, ucp_Georgian },
- { 333, PT_SC, ucp_Glagolitic },
- { 344, PT_SC, ucp_Gothic },
- { 351, PT_SC, ucp_Grantha },
- { 359, PT_SC, ucp_Greek },
- { 365, PT_SC, ucp_Gujarati },
- { 374, PT_SC, ucp_Gurmukhi },
- { 383, PT_SC, ucp_Han },
- { 387, PT_SC, ucp_Hangul },
- { 394, PT_SC, ucp_Hanunoo },
- { 402, PT_SC, ucp_Hatran },
- { 409, PT_SC, ucp_Hebrew },
- { 416, PT_SC, ucp_Hiragana },
- { 425, PT_SC, ucp_Imperial_Aramaic },
- { 442, PT_SC, ucp_Inherited },
- { 452, PT_SC, ucp_Inscriptional_Pahlavi },
- { 474, PT_SC, ucp_Inscriptional_Parthian },
- { 497, PT_SC, ucp_Javanese },
- { 506, PT_SC, ucp_Kaithi },
- { 513, PT_SC, ucp_Kannada },
- { 521, PT_SC, ucp_Katakana },
- { 530, PT_SC, ucp_Kayah_Li },
- { 539, PT_SC, ucp_Kharoshthi },
- { 550, PT_SC, ucp_Khmer },
- { 556, PT_SC, ucp_Khojki },
- { 563, PT_SC, ucp_Khudawadi },
- { 573, PT_GC, ucp_L },
- { 575, PT_LAMP, 0 },
- { 578, PT_SC, ucp_Lao },
- { 582, PT_SC, ucp_Latin },
- { 588, PT_SC, ucp_Lepcha },
- { 595, PT_SC, ucp_Limbu },
- { 601, PT_SC, ucp_Linear_A },
- { 610, PT_SC, ucp_Linear_B },
- { 619, PT_SC, ucp_Lisu },
- { 624, PT_PC, ucp_Ll },
- { 627, PT_PC, ucp_Lm },
- { 630, PT_PC, ucp_Lo },
- { 633, PT_PC, ucp_Lt },
- { 636, PT_PC, ucp_Lu },
- { 639, PT_SC, ucp_Lycian },
- { 646, PT_SC, ucp_Lydian },
- { 653, PT_GC, ucp_M },
- { 655, PT_SC, ucp_Mahajani },
- { 664, PT_SC, ucp_Malayalam },
- { 674, PT_SC, ucp_Mandaic },
- { 682, PT_SC, ucp_Manichaean },
- { 693, PT_PC, ucp_Mc },
- { 696, PT_PC, ucp_Me },
- { 699, PT_SC, ucp_Meetei_Mayek },
- { 712, PT_SC, ucp_Mende_Kikakui },
- { 726, PT_SC, ucp_Meroitic_Cursive },
- { 743, PT_SC, ucp_Meroitic_Hieroglyphs },
- { 764, PT_SC, ucp_Miao },
- { 769, PT_PC, ucp_Mn },
- { 772, PT_SC, ucp_Modi },
- { 777, PT_SC, ucp_Mongolian },
- { 787, PT_SC, ucp_Mro },
- { 791, PT_SC, ucp_Multani },
- { 799, PT_SC, ucp_Myanmar },
- { 807, PT_GC, ucp_N },
- { 809, PT_SC, ucp_Nabataean },
- { 819, PT_PC, ucp_Nd },
- { 822, PT_SC, ucp_New_Tai_Lue },
- { 834, PT_SC, ucp_Nko },
- { 838, PT_PC, ucp_Nl },
- { 841, PT_PC, ucp_No },
- { 844, PT_SC, ucp_Ogham },
- { 850, PT_SC, ucp_Ol_Chiki },
- { 859, PT_SC, ucp_Old_Hungarian },
- { 873, PT_SC, ucp_Old_Italic },
- { 884, PT_SC, ucp_Old_North_Arabian },
- { 902, PT_SC, ucp_Old_Permic },
- { 913, PT_SC, ucp_Old_Persian },
- { 925, PT_SC, ucp_Old_South_Arabian },
- { 943, PT_SC, ucp_Old_Turkic },
- { 954, PT_SC, ucp_Oriya },
- { 960, PT_SC, ucp_Osmanya },
- { 968, PT_GC, ucp_P },
- { 970, PT_SC, ucp_Pahawh_Hmong },
- { 983, PT_SC, ucp_Palmyrene },
- { 993, PT_SC, ucp_Pau_Cin_Hau },
- { 1005, PT_PC, ucp_Pc },
- { 1008, PT_PC, ucp_Pd },
- { 1011, PT_PC, ucp_Pe },
- { 1014, PT_PC, ucp_Pf },
- { 1017, PT_SC, ucp_Phags_Pa },
- { 1026, PT_SC, ucp_Phoenician },
- { 1037, PT_PC, ucp_Pi },
- { 1040, PT_PC, ucp_Po },
- { 1043, PT_PC, ucp_Ps },
- { 1046, PT_SC, ucp_Psalter_Pahlavi },
- { 1062, PT_SC, ucp_Rejang },
- { 1069, PT_SC, ucp_Runic },
- { 1075, PT_GC, ucp_S },
- { 1077, PT_SC, ucp_Samaritan },
- { 1087, PT_SC, ucp_Saurashtra },
- { 1098, PT_PC, ucp_Sc },
- { 1101, PT_SC, ucp_Sharada },
- { 1109, PT_SC, ucp_Shavian },
- { 1117, PT_SC, ucp_Siddham },
- { 1125, PT_SC, ucp_SignWriting },
- { 1137, PT_SC, ucp_Sinhala },
- { 1145, PT_PC, ucp_Sk },
- { 1148, PT_PC, ucp_Sm },
- { 1151, PT_PC, ucp_So },
- { 1154, PT_SC, ucp_Sora_Sompeng },
- { 1167, PT_SC, ucp_Sundanese },
- { 1177, PT_SC, ucp_Syloti_Nagri },
- { 1190, PT_SC, ucp_Syriac },
- { 1197, PT_SC, ucp_Tagalog },
- { 1205, PT_SC, ucp_Tagbanwa },
- { 1214, PT_SC, ucp_Tai_Le },
- { 1221, PT_SC, ucp_Tai_Tham },
- { 1230, PT_SC, ucp_Tai_Viet },
- { 1239, PT_SC, ucp_Takri },
- { 1245, PT_SC, ucp_Tamil },
- { 1251, PT_SC, ucp_Telugu },
- { 1258, PT_SC, ucp_Thaana },
- { 1265, PT_SC, ucp_Thai },
- { 1270, PT_SC, ucp_Tibetan },
- { 1278, PT_SC, ucp_Tifinagh },
- { 1287, PT_SC, ucp_Tirhuta },
- { 1295, PT_SC, ucp_Ugaritic },
- { 1304, PT_SC, ucp_Vai },
- { 1308, PT_SC, ucp_Warang_Citi },
- { 1320, PT_ALNUM, 0 },
- { 1324, PT_PXSPACE, 0 },
- { 1328, PT_SPACE, 0 },
- { 1332, PT_UCNC, 0 },
- { 1336, PT_WORD, 0 },
- { 1340, PT_SC, ucp_Yi },
- { 1343, PT_GC, ucp_Z },
- { 1345, PT_PC, ucp_Zl },
- { 1348, PT_PC, ucp_Zp },
- { 1351, PT_PC, ucp_Zs }
+ { 0, PT_SC, ucp_Adlam },
+ { 6, PT_SC, ucp_Ahom },
+ { 11, PT_SC, ucp_Anatolian_Hieroglyphs },
+ { 33, PT_ANY, 0 },
+ { 37, PT_SC, ucp_Arabic },
+ { 44, PT_SC, ucp_Armenian },
+ { 53, PT_SC, ucp_Avestan },
+ { 61, PT_SC, ucp_Balinese },
+ { 70, PT_SC, ucp_Bamum },
+ { 76, PT_SC, ucp_Bassa_Vah },
+ { 86, PT_SC, ucp_Batak },
+ { 92, PT_SC, ucp_Bengali },
+ { 100, PT_SC, ucp_Bhaiksuki },
+ { 110, PT_SC, ucp_Bopomofo },
+ { 119, PT_SC, ucp_Brahmi },
+ { 126, PT_SC, ucp_Braille },
+ { 134, PT_SC, ucp_Buginese },
+ { 143, PT_SC, ucp_Buhid },
+ { 149, PT_GC, ucp_C },
+ { 151, PT_SC, ucp_Canadian_Aboriginal },
+ { 171, PT_SC, ucp_Carian },
+ { 178, PT_SC, ucp_Caucasian_Albanian },
+ { 197, PT_PC, ucp_Cc },
+ { 200, PT_PC, ucp_Cf },
+ { 203, PT_SC, ucp_Chakma },
+ { 210, PT_SC, ucp_Cham },
+ { 215, PT_SC, ucp_Cherokee },
+ { 224, PT_PC, ucp_Cn },
+ { 227, PT_PC, ucp_Co },
+ { 230, PT_SC, ucp_Common },
+ { 237, PT_SC, ucp_Coptic },
+ { 244, PT_PC, ucp_Cs },
+ { 247, PT_SC, ucp_Cuneiform },
+ { 257, PT_SC, ucp_Cypriot },
+ { 265, PT_SC, ucp_Cyrillic },
+ { 274, PT_SC, ucp_Deseret },
+ { 282, PT_SC, ucp_Devanagari },
+ { 293, PT_SC, ucp_Duployan },
+ { 302, PT_SC, ucp_Egyptian_Hieroglyphs },
+ { 323, PT_SC, ucp_Elbasan },
+ { 331, PT_SC, ucp_Ethiopic },
+ { 340, PT_SC, ucp_Georgian },
+ { 349, PT_SC, ucp_Glagolitic },
+ { 360, PT_SC, ucp_Gothic },
+ { 367, PT_SC, ucp_Grantha },
+ { 375, PT_SC, ucp_Greek },
+ { 381, PT_SC, ucp_Gujarati },
+ { 390, PT_SC, ucp_Gurmukhi },
+ { 399, PT_SC, ucp_Han },
+ { 403, PT_SC, ucp_Hangul },
+ { 410, PT_SC, ucp_Hanunoo },
+ { 418, PT_SC, ucp_Hatran },
+ { 425, PT_SC, ucp_Hebrew },
+ { 432, PT_SC, ucp_Hiragana },
+ { 441, PT_SC, ucp_Imperial_Aramaic },
+ { 458, PT_SC, ucp_Inherited },
+ { 468, PT_SC, ucp_Inscriptional_Pahlavi },
+ { 490, PT_SC, ucp_Inscriptional_Parthian },
+ { 513, PT_SC, ucp_Javanese },
+ { 522, PT_SC, ucp_Kaithi },
+ { 529, PT_SC, ucp_Kannada },
+ { 537, PT_SC, ucp_Katakana },
+ { 546, PT_SC, ucp_Kayah_Li },
+ { 555, PT_SC, ucp_Kharoshthi },
+ { 566, PT_SC, ucp_Khmer },
+ { 572, PT_SC, ucp_Khojki },
+ { 579, PT_SC, ucp_Khudawadi },
+ { 589, PT_GC, ucp_L },
+ { 591, PT_LAMP, 0 },
+ { 594, PT_SC, ucp_Lao },
+ { 598, PT_SC, ucp_Latin },
+ { 604, PT_SC, ucp_Lepcha },
+ { 611, PT_SC, ucp_Limbu },
+ { 617, PT_SC, ucp_Linear_A },
+ { 626, PT_SC, ucp_Linear_B },
+ { 635, PT_SC, ucp_Lisu },
+ { 640, PT_PC, ucp_Ll },
+ { 643, PT_PC, ucp_Lm },
+ { 646, PT_PC, ucp_Lo },
+ { 649, PT_PC, ucp_Lt },
+ { 652, PT_PC, ucp_Lu },
+ { 655, PT_SC, ucp_Lycian },
+ { 662, PT_SC, ucp_Lydian },
+ { 669, PT_GC, ucp_M },
+ { 671, PT_SC, ucp_Mahajani },
+ { 680, PT_SC, ucp_Malayalam },
+ { 690, PT_SC, ucp_Mandaic },
+ { 698, PT_SC, ucp_Manichaean },
+ { 709, PT_SC, ucp_Marchen },
+ { 717, PT_SC, ucp_Masaram_Gondi },
+ { 731, PT_PC, ucp_Mc },
+ { 734, PT_PC, ucp_Me },
+ { 737, PT_SC, ucp_Meetei_Mayek },
+ { 750, PT_SC, ucp_Mende_Kikakui },
+ { 764, PT_SC, ucp_Meroitic_Cursive },
+ { 781, PT_SC, ucp_Meroitic_Hieroglyphs },
+ { 802, PT_SC, ucp_Miao },
+ { 807, PT_PC, ucp_Mn },
+ { 810, PT_SC, ucp_Modi },
+ { 815, PT_SC, ucp_Mongolian },
+ { 825, PT_SC, ucp_Mro },
+ { 829, PT_SC, ucp_Multani },
+ { 837, PT_SC, ucp_Myanmar },
+ { 845, PT_GC, ucp_N },
+ { 847, PT_SC, ucp_Nabataean },
+ { 857, PT_PC, ucp_Nd },
+ { 860, PT_SC, ucp_New_Tai_Lue },
+ { 872, PT_SC, ucp_Newa },
+ { 877, PT_SC, ucp_Nko },
+ { 881, PT_PC, ucp_Nl },
+ { 884, PT_PC, ucp_No },
+ { 887, PT_SC, ucp_Nushu },
+ { 893, PT_SC, ucp_Ogham },
+ { 899, PT_SC, ucp_Ol_Chiki },
+ { 908, PT_SC, ucp_Old_Hungarian },
+ { 922, PT_SC, ucp_Old_Italic },
+ { 933, PT_SC, ucp_Old_North_Arabian },
+ { 951, PT_SC, ucp_Old_Permic },
+ { 962, PT_SC, ucp_Old_Persian },
+ { 974, PT_SC, ucp_Old_South_Arabian },
+ { 992, PT_SC, ucp_Old_Turkic },
+ { 1003, PT_SC, ucp_Oriya },
+ { 1009, PT_SC, ucp_Osage },
+ { 1015, PT_SC, ucp_Osmanya },
+ { 1023, PT_GC, ucp_P },
+ { 1025, PT_SC, ucp_Pahawh_Hmong },
+ { 1038, PT_SC, ucp_Palmyrene },
+ { 1048, PT_SC, ucp_Pau_Cin_Hau },
+ { 1060, PT_PC, ucp_Pc },
+ { 1063, PT_PC, ucp_Pd },
+ { 1066, PT_PC, ucp_Pe },
+ { 1069, PT_PC, ucp_Pf },
+ { 1072, PT_SC, ucp_Phags_Pa },
+ { 1081, PT_SC, ucp_Phoenician },
+ { 1092, PT_PC, ucp_Pi },
+ { 1095, PT_PC, ucp_Po },
+ { 1098, PT_PC, ucp_Ps },
+ { 1101, PT_SC, ucp_Psalter_Pahlavi },
+ { 1117, PT_SC, ucp_Rejang },
+ { 1124, PT_SC, ucp_Runic },
+ { 1130, PT_GC, ucp_S },
+ { 1132, PT_SC, ucp_Samaritan },
+ { 1142, PT_SC, ucp_Saurashtra },
+ { 1153, PT_PC, ucp_Sc },
+ { 1156, PT_SC, ucp_Sharada },
+ { 1164, PT_SC, ucp_Shavian },
+ { 1172, PT_SC, ucp_Siddham },
+ { 1180, PT_SC, ucp_SignWriting },
+ { 1192, PT_SC, ucp_Sinhala },
+ { 1200, PT_PC, ucp_Sk },
+ { 1203, PT_PC, ucp_Sm },
+ { 1206, PT_PC, ucp_So },
+ { 1209, PT_SC, ucp_Sora_Sompeng },
+ { 1222, PT_SC, ucp_Soyombo },
+ { 1230, PT_SC, ucp_Sundanese },
+ { 1240, PT_SC, ucp_Syloti_Nagri },
+ { 1253, PT_SC, ucp_Syriac },
+ { 1260, PT_SC, ucp_Tagalog },
+ { 1268, PT_SC, ucp_Tagbanwa },
+ { 1277, PT_SC, ucp_Tai_Le },
+ { 1284, PT_SC, ucp_Tai_Tham },
+ { 1293, PT_SC, ucp_Tai_Viet },
+ { 1302, PT_SC, ucp_Takri },
+ { 1308, PT_SC, ucp_Tamil },
+ { 1314, PT_SC, ucp_Tangut },
+ { 1321, PT_SC, ucp_Telugu },
+ { 1328, PT_SC, ucp_Thaana },
+ { 1335, PT_SC, ucp_Thai },
+ { 1340, PT_SC, ucp_Tibetan },
+ { 1348, PT_SC, ucp_Tifinagh },
+ { 1357, PT_SC, ucp_Tirhuta },
+ { 1365, PT_SC, ucp_Ugaritic },
+ { 1374, PT_SC, ucp_Vai },
+ { 1378, PT_SC, ucp_Warang_Citi },
+ { 1390, PT_ALNUM, 0 },
+ { 1394, PT_PXSPACE, 0 },
+ { 1398, PT_SPACE, 0 },
+ { 1402, PT_UCNC, 0 },
+ { 1406, PT_WORD, 0 },
+ { 1410, PT_SC, ucp_Yi },
+ { 1413, PT_GC, ucp_Z },
+ { 1415, PT_SC, ucp_Zanabazar_Square },
+ { 1432, PT_PC, ucp_Zl },
+ { 1435, PT_PC, ucp_Zp },
+ { 1438, PT_PC, ucp_Zs }
};
const size_t PRIV(utt_size) = sizeof(PRIV(utt)) / sizeof(ucp_type_table);
diff --git a/thirdparty/pcre2/src/pcre2_ucd.c b/thirdparty/pcre2/src/pcre2_ucd.c
index 116f537b38..ac7649b99e 100644
--- a/thirdparty/pcre2/src/pcre2_ucd.c
+++ b/thirdparty/pcre2/src/pcre2_ucd.c
@@ -20,7 +20,7 @@ needed. */
/* Unicode character database. */
/* This file was autogenerated by the MultiStage2.py script. */
-/* Total size: 75072 bytes, block size: 128. */
+/* Total size: 80808 bytes, block size: 128. */
/* The tables herein are needed only when UCP support is built,
and in PCRE2 that happens automatically with UTF support.
@@ -39,7 +39,21 @@ const uint16_t PRIV(ucd_stage2)[] = {0};
const uint32_t PRIV(ucd_caseless_sets)[] = {0};
#else
-const char *PRIV(unicode_version) = "8.0.0";
+const char *PRIV(unicode_version) = "10.0.0";
+
+/* If the 32-bit library is run in non-32-bit mode, character values
+greater than 0x10ffff may be encountered. For these we set up a
+special record. */
+
+#if PCRE2_CODE_UNIT_WIDTH == 32
+const ucd_record PRIV(dummy_ucd_record)[] = {{
+ ucp_Common, /* script */
+ ucp_Cn, /* type unassigned */
+ ucp_gbOther, /* grapheme break property */
+ 0, /* case set */
+ 0, /* other case */
+ }};
+#endif
/* When recompiling tables with a new Unicode version, please check the
types in this structure definition from pcre2_internal.h (the actual
@@ -72,17 +86,25 @@ const uint32_t PRIV(ucd_caseless_sets)[] = {
0x039a, 0x03ba, 0x03f0, NOTACHAR,
0x03a1, 0x03c1, 0x03f1, NOTACHAR,
0x0395, 0x03b5, 0x03f5, NOTACHAR,
+ 0x0412, 0x0432, 0x1c80, NOTACHAR,
+ 0x0414, 0x0434, 0x1c81, NOTACHAR,
+ 0x041e, 0x043e, 0x1c82, NOTACHAR,
+ 0x0421, 0x0441, 0x1c83, NOTACHAR,
+ 0x0422, 0x0442, 0x1c84, 0x1c85, NOTACHAR,
+ 0x042a, 0x044a, 0x1c86, NOTACHAR,
+ 0x0462, 0x0463, 0x1c87, NOTACHAR,
0x1e60, 0x1e61, 0x1e9b, NOTACHAR,
0x03a9, 0x03c9, 0x2126, NOTACHAR,
0x004b, 0x006b, 0x212a, NOTACHAR,
0x00c5, 0x00e5, 0x212b, NOTACHAR,
+ 0x1c88, 0xa64a, 0xa64b, NOTACHAR,
};
/* When #included in pcre2test, we don't need this large table. */
#ifndef PCRE2_PCRE2TEST
-const ucd_record PRIV(ucd_records)[] = { /* 5952 bytes, record size 8 */
+const ucd_record PRIV(ucd_records)[] = { /* 6568 bytes, record size 8 */
{ 9, 0, 2, 0, 0, }, /* 0 */
{ 9, 0, 1, 0, 0, }, /* 1 */
{ 9, 0, 0, 0, 0, }, /* 2 */
@@ -95,12 +117,12 @@ const ucd_record PRIV(ucd_records)[] = { /* 5952 bytes, record size 8 */
{ 9, 17, 12, 0, 0, }, /* 9 */
{ 9, 13, 12, 0, 0, }, /* 10 */
{ 33, 9, 12, 0, 32, }, /* 11 */
- { 33, 9, 12, 71, 32, }, /* 12 */
+ { 33, 9, 12, 100, 32, }, /* 12 */
{ 33, 9, 12, 1, 32, }, /* 13 */
{ 9, 24, 12, 0, 0, }, /* 14 */
{ 9, 16, 12, 0, 0, }, /* 15 */
{ 33, 5, 12, 0, -32, }, /* 16 */
- { 33, 5, 12, 71, -32, }, /* 17 */
+ { 33, 5, 12, 100, -32, }, /* 17 */
{ 33, 5, 12, 1, -32, }, /* 18 */
{ 9, 26, 12, 0, 0, }, /* 19 */
{ 33, 7, 12, 0, 0, }, /* 20 */
@@ -109,9 +131,9 @@ const ucd_record PRIV(ucd_records)[] = { /* 5952 bytes, record size 8 */
{ 9, 15, 12, 0, 0, }, /* 23 */
{ 9, 5, 12, 26, 775, }, /* 24 */
{ 9, 19, 12, 0, 0, }, /* 25 */
- { 33, 9, 12, 75, 32, }, /* 26 */
+ { 33, 9, 12, 104, 32, }, /* 26 */
{ 33, 5, 12, 0, 7615, }, /* 27 */
- { 33, 5, 12, 75, -32, }, /* 28 */
+ { 33, 5, 12, 104, -32, }, /* 28 */
{ 33, 5, 12, 0, 121, }, /* 29 */
{ 33, 9, 12, 0, 1, }, /* 30 */
{ 33, 5, 12, 0, -1, }, /* 31 */
@@ -218,7 +240,7 @@ const ucd_record PRIV(ucd_records)[] = { /* 5952 bytes, record size 8 */
{ 19, 9, 12, 55, 32, }, /* 132 */
{ 19, 9, 12, 30, 32, }, /* 133 */
{ 19, 9, 12, 43, 32, }, /* 134 */
- { 19, 9, 12, 67, 32, }, /* 135 */
+ { 19, 9, 12, 96, 32, }, /* 135 */
{ 19, 5, 12, 0, -38, }, /* 136 */
{ 19, 5, 12, 0, -37, }, /* 137 */
{ 19, 5, 12, 0, -32, }, /* 138 */
@@ -233,7 +255,7 @@ const ucd_record PRIV(ucd_records)[] = { /* 5952 bytes, record size 8 */
{ 19, 5, 12, 30, 1, }, /* 147 */
{ 19, 5, 12, 30, -32, }, /* 148 */
{ 19, 5, 12, 43, -32, }, /* 149 */
- { 19, 5, 12, 67, -32, }, /* 150 */
+ { 19, 5, 12, 96, -32, }, /* 150 */
{ 19, 5, 12, 0, -64, }, /* 151 */
{ 19, 5, 12, 0, -63, }, /* 152 */
{ 19, 9, 12, 0, 8, }, /* 153 */
@@ -256,577 +278,654 @@ const ucd_record PRIV(ucd_records)[] = { /* 5952 bytes, record size 8 */
{ 19, 9, 12, 0, -130, }, /* 170 */
{ 12, 9, 12, 0, 80, }, /* 171 */
{ 12, 9, 12, 0, 32, }, /* 172 */
- { 12, 5, 12, 0, -32, }, /* 173 */
- { 12, 5, 12, 0, -80, }, /* 174 */
- { 12, 9, 12, 0, 1, }, /* 175 */
- { 12, 5, 12, 0, -1, }, /* 176 */
- { 12, 26, 12, 0, 0, }, /* 177 */
- { 12, 12, 3, 0, 0, }, /* 178 */
- { 12, 11, 3, 0, 0, }, /* 179 */
- { 12, 9, 12, 0, 15, }, /* 180 */
- { 12, 5, 12, 0, -15, }, /* 181 */
- { 1, 9, 12, 0, 48, }, /* 182 */
- { 1, 6, 12, 0, 0, }, /* 183 */
- { 1, 21, 12, 0, 0, }, /* 184 */
- { 1, 5, 12, 0, -48, }, /* 185 */
- { 1, 5, 12, 0, 0, }, /* 186 */
- { 1, 17, 12, 0, 0, }, /* 187 */
- { 1, 26, 12, 0, 0, }, /* 188 */
- { 1, 23, 12, 0, 0, }, /* 189 */
- { 25, 12, 3, 0, 0, }, /* 190 */
- { 25, 17, 12, 0, 0, }, /* 191 */
- { 25, 21, 12, 0, 0, }, /* 192 */
- { 25, 7, 12, 0, 0, }, /* 193 */
- { 0, 1, 2, 0, 0, }, /* 194 */
- { 0, 25, 12, 0, 0, }, /* 195 */
- { 0, 21, 12, 0, 0, }, /* 196 */
- { 0, 23, 12, 0, 0, }, /* 197 */
- { 0, 26, 12, 0, 0, }, /* 198 */
- { 0, 12, 3, 0, 0, }, /* 199 */
- { 0, 7, 12, 0, 0, }, /* 200 */
- { 0, 13, 12, 0, 0, }, /* 201 */
- { 0, 6, 12, 0, 0, }, /* 202 */
- { 49, 21, 12, 0, 0, }, /* 203 */
- { 49, 1, 2, 0, 0, }, /* 204 */
- { 49, 7, 12, 0, 0, }, /* 205 */
- { 49, 12, 3, 0, 0, }, /* 206 */
- { 55, 7, 12, 0, 0, }, /* 207 */
- { 55, 12, 3, 0, 0, }, /* 208 */
- { 63, 13, 12, 0, 0, }, /* 209 */
- { 63, 7, 12, 0, 0, }, /* 210 */
- { 63, 12, 3, 0, 0, }, /* 211 */
- { 63, 6, 12, 0, 0, }, /* 212 */
- { 63, 26, 12, 0, 0, }, /* 213 */
- { 63, 21, 12, 0, 0, }, /* 214 */
- { 89, 7, 12, 0, 0, }, /* 215 */
- { 89, 12, 3, 0, 0, }, /* 216 */
- { 89, 6, 12, 0, 0, }, /* 217 */
- { 89, 21, 12, 0, 0, }, /* 218 */
- { 94, 7, 12, 0, 0, }, /* 219 */
- { 94, 12, 3, 0, 0, }, /* 220 */
- { 94, 21, 12, 0, 0, }, /* 221 */
- { 14, 12, 3, 0, 0, }, /* 222 */
- { 14, 10, 5, 0, 0, }, /* 223 */
- { 14, 7, 12, 0, 0, }, /* 224 */
- { 14, 13, 12, 0, 0, }, /* 225 */
- { 14, 21, 12, 0, 0, }, /* 226 */
- { 14, 6, 12, 0, 0, }, /* 227 */
- { 2, 7, 12, 0, 0, }, /* 228 */
- { 2, 12, 3, 0, 0, }, /* 229 */
- { 2, 10, 5, 0, 0, }, /* 230 */
- { 2, 10, 3, 0, 0, }, /* 231 */
- { 2, 13, 12, 0, 0, }, /* 232 */
- { 2, 23, 12, 0, 0, }, /* 233 */
- { 2, 15, 12, 0, 0, }, /* 234 */
- { 2, 26, 12, 0, 0, }, /* 235 */
- { 21, 12, 3, 0, 0, }, /* 236 */
- { 21, 10, 5, 0, 0, }, /* 237 */
- { 21, 7, 12, 0, 0, }, /* 238 */
- { 21, 13, 12, 0, 0, }, /* 239 */
- { 20, 12, 3, 0, 0, }, /* 240 */
- { 20, 10, 5, 0, 0, }, /* 241 */
- { 20, 7, 12, 0, 0, }, /* 242 */
- { 20, 13, 12, 0, 0, }, /* 243 */
- { 20, 21, 12, 0, 0, }, /* 244 */
- { 20, 23, 12, 0, 0, }, /* 245 */
- { 43, 12, 3, 0, 0, }, /* 246 */
- { 43, 10, 5, 0, 0, }, /* 247 */
- { 43, 7, 12, 0, 0, }, /* 248 */
- { 43, 10, 3, 0, 0, }, /* 249 */
- { 43, 13, 12, 0, 0, }, /* 250 */
- { 43, 26, 12, 0, 0, }, /* 251 */
- { 43, 15, 12, 0, 0, }, /* 252 */
- { 53, 12, 3, 0, 0, }, /* 253 */
- { 53, 7, 12, 0, 0, }, /* 254 */
- { 53, 10, 3, 0, 0, }, /* 255 */
- { 53, 10, 5, 0, 0, }, /* 256 */
- { 53, 13, 12, 0, 0, }, /* 257 */
- { 53, 15, 12, 0, 0, }, /* 258 */
- { 53, 26, 12, 0, 0, }, /* 259 */
- { 53, 23, 12, 0, 0, }, /* 260 */
- { 54, 12, 3, 0, 0, }, /* 261 */
- { 54, 10, 5, 0, 0, }, /* 262 */
- { 54, 7, 12, 0, 0, }, /* 263 */
- { 54, 13, 12, 0, 0, }, /* 264 */
- { 54, 15, 12, 0, 0, }, /* 265 */
- { 54, 26, 12, 0, 0, }, /* 266 */
- { 28, 12, 3, 0, 0, }, /* 267 */
- { 28, 10, 5, 0, 0, }, /* 268 */
- { 28, 7, 12, 0, 0, }, /* 269 */
- { 28, 10, 3, 0, 0, }, /* 270 */
- { 28, 13, 12, 0, 0, }, /* 271 */
- { 36, 12, 3, 0, 0, }, /* 272 */
- { 36, 10, 5, 0, 0, }, /* 273 */
- { 36, 7, 12, 0, 0, }, /* 274 */
- { 36, 10, 3, 0, 0, }, /* 275 */
- { 36, 13, 12, 0, 0, }, /* 276 */
- { 36, 15, 12, 0, 0, }, /* 277 */
- { 36, 26, 12, 0, 0, }, /* 278 */
- { 47, 10, 5, 0, 0, }, /* 279 */
- { 47, 7, 12, 0, 0, }, /* 280 */
- { 47, 12, 3, 0, 0, }, /* 281 */
- { 47, 10, 3, 0, 0, }, /* 282 */
- { 47, 13, 12, 0, 0, }, /* 283 */
- { 47, 21, 12, 0, 0, }, /* 284 */
- { 56, 7, 12, 0, 0, }, /* 285 */
- { 56, 12, 3, 0, 0, }, /* 286 */
- { 56, 7, 5, 0, 0, }, /* 287 */
- { 56, 6, 12, 0, 0, }, /* 288 */
- { 56, 21, 12, 0, 0, }, /* 289 */
- { 56, 13, 12, 0, 0, }, /* 290 */
- { 32, 7, 12, 0, 0, }, /* 291 */
- { 32, 12, 3, 0, 0, }, /* 292 */
- { 32, 7, 5, 0, 0, }, /* 293 */
- { 32, 6, 12, 0, 0, }, /* 294 */
- { 32, 13, 12, 0, 0, }, /* 295 */
- { 57, 7, 12, 0, 0, }, /* 296 */
- { 57, 26, 12, 0, 0, }, /* 297 */
- { 57, 21, 12, 0, 0, }, /* 298 */
- { 57, 12, 3, 0, 0, }, /* 299 */
- { 57, 13, 12, 0, 0, }, /* 300 */
- { 57, 15, 12, 0, 0, }, /* 301 */
- { 57, 22, 12, 0, 0, }, /* 302 */
- { 57, 18, 12, 0, 0, }, /* 303 */
- { 57, 10, 5, 0, 0, }, /* 304 */
- { 38, 7, 12, 0, 0, }, /* 305 */
- { 38, 10, 12, 0, 0, }, /* 306 */
- { 38, 12, 3, 0, 0, }, /* 307 */
- { 38, 10, 5, 0, 0, }, /* 308 */
- { 38, 13, 12, 0, 0, }, /* 309 */
- { 38, 21, 12, 0, 0, }, /* 310 */
- { 38, 26, 12, 0, 0, }, /* 311 */
- { 16, 9, 12, 0, 7264, }, /* 312 */
- { 16, 7, 12, 0, 0, }, /* 313 */
- { 16, 6, 12, 0, 0, }, /* 314 */
- { 23, 7, 6, 0, 0, }, /* 315 */
- { 23, 7, 7, 0, 0, }, /* 316 */
- { 23, 7, 8, 0, 0, }, /* 317 */
- { 15, 7, 12, 0, 0, }, /* 318 */
- { 15, 12, 3, 0, 0, }, /* 319 */
- { 15, 21, 12, 0, 0, }, /* 320 */
- { 15, 15, 12, 0, 0, }, /* 321 */
- { 15, 26, 12, 0, 0, }, /* 322 */
- { 8, 9, 12, 0, 38864, }, /* 323 */
- { 8, 9, 12, 0, 8, }, /* 324 */
- { 8, 5, 12, 0, -8, }, /* 325 */
- { 7, 17, 12, 0, 0, }, /* 326 */
- { 7, 7, 12, 0, 0, }, /* 327 */
- { 7, 21, 12, 0, 0, }, /* 328 */
- { 40, 29, 12, 0, 0, }, /* 329 */
- { 40, 7, 12, 0, 0, }, /* 330 */
- { 40, 22, 12, 0, 0, }, /* 331 */
- { 40, 18, 12, 0, 0, }, /* 332 */
- { 45, 7, 12, 0, 0, }, /* 333 */
- { 45, 14, 12, 0, 0, }, /* 334 */
- { 50, 7, 12, 0, 0, }, /* 335 */
- { 50, 12, 3, 0, 0, }, /* 336 */
- { 24, 7, 12, 0, 0, }, /* 337 */
- { 24, 12, 3, 0, 0, }, /* 338 */
- { 6, 7, 12, 0, 0, }, /* 339 */
- { 6, 12, 3, 0, 0, }, /* 340 */
- { 51, 7, 12, 0, 0, }, /* 341 */
- { 51, 12, 3, 0, 0, }, /* 342 */
- { 31, 7, 12, 0, 0, }, /* 343 */
- { 31, 12, 3, 0, 0, }, /* 344 */
- { 31, 10, 5, 0, 0, }, /* 345 */
- { 31, 21, 12, 0, 0, }, /* 346 */
- { 31, 6, 12, 0, 0, }, /* 347 */
- { 31, 23, 12, 0, 0, }, /* 348 */
- { 31, 13, 12, 0, 0, }, /* 349 */
- { 31, 15, 12, 0, 0, }, /* 350 */
- { 37, 21, 12, 0, 0, }, /* 351 */
- { 37, 17, 12, 0, 0, }, /* 352 */
- { 37, 12, 3, 0, 0, }, /* 353 */
- { 37, 1, 2, 0, 0, }, /* 354 */
- { 37, 13, 12, 0, 0, }, /* 355 */
- { 37, 7, 12, 0, 0, }, /* 356 */
- { 37, 6, 12, 0, 0, }, /* 357 */
- { 34, 7, 12, 0, 0, }, /* 358 */
- { 34, 12, 3, 0, 0, }, /* 359 */
- { 34, 10, 5, 0, 0, }, /* 360 */
- { 34, 26, 12, 0, 0, }, /* 361 */
- { 34, 21, 12, 0, 0, }, /* 362 */
- { 34, 13, 12, 0, 0, }, /* 363 */
- { 52, 7, 12, 0, 0, }, /* 364 */
- { 39, 7, 12, 0, 0, }, /* 365 */
- { 39, 13, 12, 0, 0, }, /* 366 */
- { 39, 15, 12, 0, 0, }, /* 367 */
- { 39, 26, 12, 0, 0, }, /* 368 */
- { 31, 26, 12, 0, 0, }, /* 369 */
- { 5, 7, 12, 0, 0, }, /* 370 */
- { 5, 12, 3, 0, 0, }, /* 371 */
- { 5, 10, 5, 0, 0, }, /* 372 */
- { 5, 21, 12, 0, 0, }, /* 373 */
- { 90, 7, 12, 0, 0, }, /* 374 */
- { 90, 10, 5, 0, 0, }, /* 375 */
- { 90, 12, 3, 0, 0, }, /* 376 */
- { 90, 10, 12, 0, 0, }, /* 377 */
- { 90, 13, 12, 0, 0, }, /* 378 */
- { 90, 21, 12, 0, 0, }, /* 379 */
- { 90, 6, 12, 0, 0, }, /* 380 */
- { 27, 11, 3, 0, 0, }, /* 381 */
- { 61, 12, 3, 0, 0, }, /* 382 */
- { 61, 10, 5, 0, 0, }, /* 383 */
- { 61, 7, 12, 0, 0, }, /* 384 */
- { 61, 13, 12, 0, 0, }, /* 385 */
- { 61, 21, 12, 0, 0, }, /* 386 */
- { 61, 26, 12, 0, 0, }, /* 387 */
- { 75, 12, 3, 0, 0, }, /* 388 */
- { 75, 10, 5, 0, 0, }, /* 389 */
- { 75, 7, 12, 0, 0, }, /* 390 */
- { 75, 13, 12, 0, 0, }, /* 391 */
- { 92, 7, 12, 0, 0, }, /* 392 */
- { 92, 12, 3, 0, 0, }, /* 393 */
- { 92, 10, 5, 0, 0, }, /* 394 */
- { 92, 21, 12, 0, 0, }, /* 395 */
- { 69, 7, 12, 0, 0, }, /* 396 */
- { 69, 10, 5, 0, 0, }, /* 397 */
- { 69, 12, 3, 0, 0, }, /* 398 */
- { 69, 21, 12, 0, 0, }, /* 399 */
- { 69, 13, 12, 0, 0, }, /* 400 */
- { 72, 13, 12, 0, 0, }, /* 401 */
- { 72, 7, 12, 0, 0, }, /* 402 */
- { 72, 6, 12, 0, 0, }, /* 403 */
- { 72, 21, 12, 0, 0, }, /* 404 */
- { 75, 21, 12, 0, 0, }, /* 405 */
- { 9, 10, 5, 0, 0, }, /* 406 */
- { 9, 7, 12, 0, 0, }, /* 407 */
- { 12, 5, 12, 0, 0, }, /* 408 */
- { 12, 6, 12, 0, 0, }, /* 409 */
- { 33, 5, 12, 0, 35332, }, /* 410 */
- { 33, 5, 12, 0, 3814, }, /* 411 */
- { 33, 9, 12, 63, 1, }, /* 412 */
- { 33, 5, 12, 63, -1, }, /* 413 */
- { 33, 5, 12, 63, -58, }, /* 414 */
- { 33, 9, 12, 0, -7615, }, /* 415 */
- { 19, 5, 12, 0, 8, }, /* 416 */
- { 19, 9, 12, 0, -8, }, /* 417 */
- { 19, 5, 12, 0, 74, }, /* 418 */
- { 19, 5, 12, 0, 86, }, /* 419 */
- { 19, 5, 12, 0, 100, }, /* 420 */
- { 19, 5, 12, 0, 128, }, /* 421 */
- { 19, 5, 12, 0, 112, }, /* 422 */
- { 19, 5, 12, 0, 126, }, /* 423 */
- { 19, 8, 12, 0, -8, }, /* 424 */
- { 19, 5, 12, 0, 9, }, /* 425 */
- { 19, 9, 12, 0, -74, }, /* 426 */
- { 19, 8, 12, 0, -9, }, /* 427 */
- { 19, 5, 12, 21, -7173, }, /* 428 */
- { 19, 9, 12, 0, -86, }, /* 429 */
- { 19, 9, 12, 0, -100, }, /* 430 */
- { 19, 9, 12, 0, -112, }, /* 431 */
- { 19, 9, 12, 0, -128, }, /* 432 */
- { 19, 9, 12, 0, -126, }, /* 433 */
- { 27, 1, 3, 0, 0, }, /* 434 */
- { 9, 27, 2, 0, 0, }, /* 435 */
- { 9, 28, 2, 0, 0, }, /* 436 */
- { 9, 2, 2, 0, 0, }, /* 437 */
- { 9, 9, 12, 0, 0, }, /* 438 */
- { 9, 5, 12, 0, 0, }, /* 439 */
- { 19, 9, 12, 67, -7517, }, /* 440 */
- { 33, 9, 12, 71, -8383, }, /* 441 */
- { 33, 9, 12, 75, -8262, }, /* 442 */
- { 33, 9, 12, 0, 28, }, /* 443 */
- { 33, 5, 12, 0, -28, }, /* 444 */
- { 33, 14, 12, 0, 16, }, /* 445 */
- { 33, 14, 12, 0, -16, }, /* 446 */
- { 33, 14, 12, 0, 0, }, /* 447 */
- { 9, 26, 12, 0, 26, }, /* 448 */
- { 9, 26, 12, 0, -26, }, /* 449 */
- { 4, 26, 12, 0, 0, }, /* 450 */
- { 17, 9, 12, 0, 48, }, /* 451 */
- { 17, 5, 12, 0, -48, }, /* 452 */
- { 33, 9, 12, 0, -10743, }, /* 453 */
- { 33, 9, 12, 0, -3814, }, /* 454 */
- { 33, 9, 12, 0, -10727, }, /* 455 */
- { 33, 5, 12, 0, -10795, }, /* 456 */
- { 33, 5, 12, 0, -10792, }, /* 457 */
- { 33, 9, 12, 0, -10780, }, /* 458 */
- { 33, 9, 12, 0, -10749, }, /* 459 */
- { 33, 9, 12, 0, -10783, }, /* 460 */
- { 33, 9, 12, 0, -10782, }, /* 461 */
- { 33, 9, 12, 0, -10815, }, /* 462 */
- { 10, 5, 12, 0, 0, }, /* 463 */
- { 10, 26, 12, 0, 0, }, /* 464 */
- { 10, 12, 3, 0, 0, }, /* 465 */
- { 10, 21, 12, 0, 0, }, /* 466 */
- { 10, 15, 12, 0, 0, }, /* 467 */
- { 16, 5, 12, 0, -7264, }, /* 468 */
- { 58, 7, 12, 0, 0, }, /* 469 */
- { 58, 6, 12, 0, 0, }, /* 470 */
- { 58, 21, 12, 0, 0, }, /* 471 */
- { 58, 12, 3, 0, 0, }, /* 472 */
- { 22, 26, 12, 0, 0, }, /* 473 */
- { 22, 6, 12, 0, 0, }, /* 474 */
- { 22, 14, 12, 0, 0, }, /* 475 */
- { 23, 10, 3, 0, 0, }, /* 476 */
- { 26, 7, 12, 0, 0, }, /* 477 */
- { 26, 6, 12, 0, 0, }, /* 478 */
- { 29, 7, 12, 0, 0, }, /* 479 */
- { 29, 6, 12, 0, 0, }, /* 480 */
- { 3, 7, 12, 0, 0, }, /* 481 */
- { 23, 7, 12, 0, 0, }, /* 482 */
- { 23, 26, 12, 0, 0, }, /* 483 */
- { 29, 26, 12, 0, 0, }, /* 484 */
- { 22, 7, 12, 0, 0, }, /* 485 */
- { 60, 7, 12, 0, 0, }, /* 486 */
- { 60, 6, 12, 0, 0, }, /* 487 */
- { 60, 26, 12, 0, 0, }, /* 488 */
- { 85, 7, 12, 0, 0, }, /* 489 */
- { 85, 6, 12, 0, 0, }, /* 490 */
- { 85, 21, 12, 0, 0, }, /* 491 */
- { 76, 7, 12, 0, 0, }, /* 492 */
- { 76, 6, 12, 0, 0, }, /* 493 */
- { 76, 21, 12, 0, 0, }, /* 494 */
- { 76, 13, 12, 0, 0, }, /* 495 */
- { 12, 7, 12, 0, 0, }, /* 496 */
- { 12, 21, 12, 0, 0, }, /* 497 */
- { 78, 7, 12, 0, 0, }, /* 498 */
- { 78, 14, 12, 0, 0, }, /* 499 */
- { 78, 12, 3, 0, 0, }, /* 500 */
- { 78, 21, 12, 0, 0, }, /* 501 */
- { 33, 9, 12, 0, -35332, }, /* 502 */
- { 33, 9, 12, 0, -42280, }, /* 503 */
- { 33, 9, 12, 0, -42308, }, /* 504 */
- { 33, 9, 12, 0, -42319, }, /* 505 */
- { 33, 9, 12, 0, -42315, }, /* 506 */
- { 33, 9, 12, 0, -42305, }, /* 507 */
- { 33, 9, 12, 0, -42258, }, /* 508 */
- { 33, 9, 12, 0, -42282, }, /* 509 */
- { 33, 9, 12, 0, -42261, }, /* 510 */
- { 33, 9, 12, 0, 928, }, /* 511 */
- { 48, 7, 12, 0, 0, }, /* 512 */
- { 48, 12, 3, 0, 0, }, /* 513 */
- { 48, 10, 5, 0, 0, }, /* 514 */
- { 48, 26, 12, 0, 0, }, /* 515 */
- { 64, 7, 12, 0, 0, }, /* 516 */
- { 64, 21, 12, 0, 0, }, /* 517 */
- { 74, 10, 5, 0, 0, }, /* 518 */
- { 74, 7, 12, 0, 0, }, /* 519 */
- { 74, 12, 3, 0, 0, }, /* 520 */
- { 74, 21, 12, 0, 0, }, /* 521 */
- { 74, 13, 12, 0, 0, }, /* 522 */
- { 68, 13, 12, 0, 0, }, /* 523 */
- { 68, 7, 12, 0, 0, }, /* 524 */
- { 68, 12, 3, 0, 0, }, /* 525 */
- { 68, 21, 12, 0, 0, }, /* 526 */
- { 73, 7, 12, 0, 0, }, /* 527 */
- { 73, 12, 3, 0, 0, }, /* 528 */
- { 73, 10, 5, 0, 0, }, /* 529 */
- { 73, 21, 12, 0, 0, }, /* 530 */
- { 83, 12, 3, 0, 0, }, /* 531 */
- { 83, 10, 5, 0, 0, }, /* 532 */
- { 83, 7, 12, 0, 0, }, /* 533 */
- { 83, 21, 12, 0, 0, }, /* 534 */
- { 83, 13, 12, 0, 0, }, /* 535 */
- { 38, 6, 12, 0, 0, }, /* 536 */
- { 67, 7, 12, 0, 0, }, /* 537 */
- { 67, 12, 3, 0, 0, }, /* 538 */
- { 67, 10, 5, 0, 0, }, /* 539 */
- { 67, 13, 12, 0, 0, }, /* 540 */
- { 67, 21, 12, 0, 0, }, /* 541 */
- { 91, 7, 12, 0, 0, }, /* 542 */
- { 91, 12, 3, 0, 0, }, /* 543 */
- { 91, 6, 12, 0, 0, }, /* 544 */
- { 91, 21, 12, 0, 0, }, /* 545 */
- { 86, 7, 12, 0, 0, }, /* 546 */
- { 86, 10, 5, 0, 0, }, /* 547 */
- { 86, 12, 3, 0, 0, }, /* 548 */
- { 86, 21, 12, 0, 0, }, /* 549 */
- { 86, 6, 12, 0, 0, }, /* 550 */
- { 33, 5, 12, 0, -928, }, /* 551 */
- { 8, 5, 12, 0, -38864, }, /* 552 */
- { 86, 13, 12, 0, 0, }, /* 553 */
- { 23, 7, 9, 0, 0, }, /* 554 */
- { 23, 7, 10, 0, 0, }, /* 555 */
- { 9, 4, 2, 0, 0, }, /* 556 */
- { 9, 3, 12, 0, 0, }, /* 557 */
- { 25, 25, 12, 0, 0, }, /* 558 */
- { 0, 24, 12, 0, 0, }, /* 559 */
- { 9, 6, 3, 0, 0, }, /* 560 */
- { 35, 7, 12, 0, 0, }, /* 561 */
- { 19, 14, 12, 0, 0, }, /* 562 */
- { 19, 15, 12, 0, 0, }, /* 563 */
- { 19, 26, 12, 0, 0, }, /* 564 */
- { 70, 7, 12, 0, 0, }, /* 565 */
- { 66, 7, 12, 0, 0, }, /* 566 */
- { 41, 7, 12, 0, 0, }, /* 567 */
- { 41, 15, 12, 0, 0, }, /* 568 */
- { 18, 7, 12, 0, 0, }, /* 569 */
- { 18, 14, 12, 0, 0, }, /* 570 */
- { 117, 7, 12, 0, 0, }, /* 571 */
- { 117, 12, 3, 0, 0, }, /* 572 */
- { 59, 7, 12, 0, 0, }, /* 573 */
- { 59, 21, 12, 0, 0, }, /* 574 */
- { 42, 7, 12, 0, 0, }, /* 575 */
- { 42, 21, 12, 0, 0, }, /* 576 */
- { 42, 14, 12, 0, 0, }, /* 577 */
- { 13, 9, 12, 0, 40, }, /* 578 */
- { 13, 5, 12, 0, -40, }, /* 579 */
- { 46, 7, 12, 0, 0, }, /* 580 */
- { 44, 7, 12, 0, 0, }, /* 581 */
- { 44, 13, 12, 0, 0, }, /* 582 */
- { 105, 7, 12, 0, 0, }, /* 583 */
- { 103, 7, 12, 0, 0, }, /* 584 */
- { 103, 21, 12, 0, 0, }, /* 585 */
- { 109, 7, 12, 0, 0, }, /* 586 */
- { 11, 7, 12, 0, 0, }, /* 587 */
- { 80, 7, 12, 0, 0, }, /* 588 */
- { 80, 21, 12, 0, 0, }, /* 589 */
- { 80, 15, 12, 0, 0, }, /* 590 */
- { 119, 7, 12, 0, 0, }, /* 591 */
- { 119, 26, 12, 0, 0, }, /* 592 */
- { 119, 15, 12, 0, 0, }, /* 593 */
- { 115, 7, 12, 0, 0, }, /* 594 */
- { 115, 15, 12, 0, 0, }, /* 595 */
- { 127, 7, 12, 0, 0, }, /* 596 */
- { 127, 15, 12, 0, 0, }, /* 597 */
- { 65, 7, 12, 0, 0, }, /* 598 */
- { 65, 15, 12, 0, 0, }, /* 599 */
- { 65, 21, 12, 0, 0, }, /* 600 */
- { 71, 7, 12, 0, 0, }, /* 601 */
- { 71, 21, 12, 0, 0, }, /* 602 */
- { 97, 7, 12, 0, 0, }, /* 603 */
- { 96, 7, 12, 0, 0, }, /* 604 */
- { 96, 15, 12, 0, 0, }, /* 605 */
- { 30, 7, 12, 0, 0, }, /* 606 */
- { 30, 12, 3, 0, 0, }, /* 607 */
- { 30, 15, 12, 0, 0, }, /* 608 */
- { 30, 21, 12, 0, 0, }, /* 609 */
- { 87, 7, 12, 0, 0, }, /* 610 */
- { 87, 15, 12, 0, 0, }, /* 611 */
- { 87, 21, 12, 0, 0, }, /* 612 */
- { 116, 7, 12, 0, 0, }, /* 613 */
- { 116, 15, 12, 0, 0, }, /* 614 */
- { 111, 7, 12, 0, 0, }, /* 615 */
- { 111, 26, 12, 0, 0, }, /* 616 */
- { 111, 12, 3, 0, 0, }, /* 617 */
- { 111, 15, 12, 0, 0, }, /* 618 */
- { 111, 21, 12, 0, 0, }, /* 619 */
- { 77, 7, 12, 0, 0, }, /* 620 */
- { 77, 21, 12, 0, 0, }, /* 621 */
- { 82, 7, 12, 0, 0, }, /* 622 */
- { 82, 15, 12, 0, 0, }, /* 623 */
- { 81, 7, 12, 0, 0, }, /* 624 */
- { 81, 15, 12, 0, 0, }, /* 625 */
- { 120, 7, 12, 0, 0, }, /* 626 */
- { 120, 21, 12, 0, 0, }, /* 627 */
- { 120, 15, 12, 0, 0, }, /* 628 */
- { 88, 7, 12, 0, 0, }, /* 629 */
- { 129, 9, 12, 0, 64, }, /* 630 */
- { 129, 5, 12, 0, -64, }, /* 631 */
- { 129, 15, 12, 0, 0, }, /* 632 */
- { 0, 15, 12, 0, 0, }, /* 633 */
- { 93, 10, 5, 0, 0, }, /* 634 */
- { 93, 12, 3, 0, 0, }, /* 635 */
- { 93, 7, 12, 0, 0, }, /* 636 */
- { 93, 21, 12, 0, 0, }, /* 637 */
- { 93, 15, 12, 0, 0, }, /* 638 */
- { 93, 13, 12, 0, 0, }, /* 639 */
- { 84, 12, 3, 0, 0, }, /* 640 */
- { 84, 10, 5, 0, 0, }, /* 641 */
- { 84, 7, 12, 0, 0, }, /* 642 */
- { 84, 21, 12, 0, 0, }, /* 643 */
- { 84, 1, 2, 0, 0, }, /* 644 */
- { 100, 7, 12, 0, 0, }, /* 645 */
- { 100, 13, 12, 0, 0, }, /* 646 */
- { 95, 12, 3, 0, 0, }, /* 647 */
- { 95, 7, 12, 0, 0, }, /* 648 */
- { 95, 10, 5, 0, 0, }, /* 649 */
- { 95, 13, 12, 0, 0, }, /* 650 */
- { 95, 21, 12, 0, 0, }, /* 651 */
- { 110, 7, 12, 0, 0, }, /* 652 */
- { 110, 12, 3, 0, 0, }, /* 653 */
- { 110, 21, 12, 0, 0, }, /* 654 */
- { 99, 12, 3, 0, 0, }, /* 655 */
- { 99, 10, 5, 0, 0, }, /* 656 */
- { 99, 7, 12, 0, 0, }, /* 657 */
- { 99, 21, 12, 0, 0, }, /* 658 */
- { 99, 13, 12, 0, 0, }, /* 659 */
- { 47, 15, 12, 0, 0, }, /* 660 */
- { 107, 7, 12, 0, 0, }, /* 661 */
- { 107, 10, 5, 0, 0, }, /* 662 */
- { 107, 12, 3, 0, 0, }, /* 663 */
- { 107, 21, 12, 0, 0, }, /* 664 */
- { 128, 7, 12, 0, 0, }, /* 665 */
- { 128, 21, 12, 0, 0, }, /* 666 */
- { 108, 7, 12, 0, 0, }, /* 667 */
- { 108, 12, 3, 0, 0, }, /* 668 */
- { 108, 10, 5, 0, 0, }, /* 669 */
- { 108, 13, 12, 0, 0, }, /* 670 */
- { 106, 12, 3, 0, 0, }, /* 671 */
- { 106, 10, 5, 0, 0, }, /* 672 */
- { 106, 7, 12, 0, 0, }, /* 673 */
- { 106, 10, 3, 0, 0, }, /* 674 */
- { 123, 7, 12, 0, 0, }, /* 675 */
- { 123, 10, 3, 0, 0, }, /* 676 */
- { 123, 10, 5, 0, 0, }, /* 677 */
- { 123, 12, 3, 0, 0, }, /* 678 */
- { 123, 21, 12, 0, 0, }, /* 679 */
- { 123, 13, 12, 0, 0, }, /* 680 */
- { 122, 7, 12, 0, 0, }, /* 681 */
- { 122, 10, 3, 0, 0, }, /* 682 */
- { 122, 10, 5, 0, 0, }, /* 683 */
- { 122, 12, 3, 0, 0, }, /* 684 */
- { 122, 21, 12, 0, 0, }, /* 685 */
- { 113, 7, 12, 0, 0, }, /* 686 */
- { 113, 10, 5, 0, 0, }, /* 687 */
- { 113, 12, 3, 0, 0, }, /* 688 */
- { 113, 21, 12, 0, 0, }, /* 689 */
- { 113, 13, 12, 0, 0, }, /* 690 */
- { 101, 7, 12, 0, 0, }, /* 691 */
- { 101, 12, 3, 0, 0, }, /* 692 */
- { 101, 10, 5, 0, 0, }, /* 693 */
- { 101, 13, 12, 0, 0, }, /* 694 */
- { 125, 7, 12, 0, 0, }, /* 695 */
- { 125, 12, 3, 0, 0, }, /* 696 */
- { 125, 10, 5, 0, 0, }, /* 697 */
- { 125, 13, 12, 0, 0, }, /* 698 */
- { 125, 15, 12, 0, 0, }, /* 699 */
- { 125, 21, 12, 0, 0, }, /* 700 */
- { 125, 26, 12, 0, 0, }, /* 701 */
- { 124, 9, 12, 0, 32, }, /* 702 */
- { 124, 5, 12, 0, -32, }, /* 703 */
- { 124, 13, 12, 0, 0, }, /* 704 */
- { 124, 15, 12, 0, 0, }, /* 705 */
- { 124, 7, 12, 0, 0, }, /* 706 */
- { 121, 7, 12, 0, 0, }, /* 707 */
- { 62, 7, 12, 0, 0, }, /* 708 */
- { 62, 14, 12, 0, 0, }, /* 709 */
- { 62, 21, 12, 0, 0, }, /* 710 */
- { 79, 7, 12, 0, 0, }, /* 711 */
- { 126, 7, 12, 0, 0, }, /* 712 */
- { 114, 7, 12, 0, 0, }, /* 713 */
- { 114, 13, 12, 0, 0, }, /* 714 */
- { 114, 21, 12, 0, 0, }, /* 715 */
- { 102, 7, 12, 0, 0, }, /* 716 */
- { 102, 12, 3, 0, 0, }, /* 717 */
- { 102, 21, 12, 0, 0, }, /* 718 */
- { 118, 7, 12, 0, 0, }, /* 719 */
- { 118, 12, 3, 0, 0, }, /* 720 */
- { 118, 21, 12, 0, 0, }, /* 721 */
- { 118, 26, 12, 0, 0, }, /* 722 */
- { 118, 6, 12, 0, 0, }, /* 723 */
- { 118, 13, 12, 0, 0, }, /* 724 */
- { 118, 15, 12, 0, 0, }, /* 725 */
- { 98, 7, 12, 0, 0, }, /* 726 */
- { 98, 10, 5, 0, 0, }, /* 727 */
- { 98, 12, 3, 0, 0, }, /* 728 */
- { 98, 6, 12, 0, 0, }, /* 729 */
- { 104, 7, 12, 0, 0, }, /* 730 */
- { 104, 26, 12, 0, 0, }, /* 731 */
- { 104, 12, 3, 0, 0, }, /* 732 */
- { 104, 21, 12, 0, 0, }, /* 733 */
- { 9, 10, 3, 0, 0, }, /* 734 */
- { 19, 12, 3, 0, 0, }, /* 735 */
- { 130, 26, 12, 0, 0, }, /* 736 */
- { 130, 12, 3, 0, 0, }, /* 737 */
- { 130, 21, 12, 0, 0, }, /* 738 */
- { 112, 7, 12, 0, 0, }, /* 739 */
- { 112, 15, 12, 0, 0, }, /* 740 */
- { 112, 12, 3, 0, 0, }, /* 741 */
- { 9, 26, 11, 0, 0, }, /* 742 */
- { 26, 26, 12, 0, 0, }, /* 743 */
+ { 12, 9, 12, 63, 32, }, /* 173 */
+ { 12, 9, 12, 67, 32, }, /* 174 */
+ { 12, 9, 12, 71, 32, }, /* 175 */
+ { 12, 9, 12, 75, 32, }, /* 176 */
+ { 12, 9, 12, 79, 32, }, /* 177 */
+ { 12, 9, 12, 84, 32, }, /* 178 */
+ { 12, 5, 12, 0, -32, }, /* 179 */
+ { 12, 5, 12, 63, -32, }, /* 180 */
+ { 12, 5, 12, 67, -32, }, /* 181 */
+ { 12, 5, 12, 71, -32, }, /* 182 */
+ { 12, 5, 12, 75, -32, }, /* 183 */
+ { 12, 5, 12, 79, -32, }, /* 184 */
+ { 12, 5, 12, 84, -32, }, /* 185 */
+ { 12, 5, 12, 0, -80, }, /* 186 */
+ { 12, 9, 12, 0, 1, }, /* 187 */
+ { 12, 5, 12, 0, -1, }, /* 188 */
+ { 12, 9, 12, 88, 1, }, /* 189 */
+ { 12, 5, 12, 88, -1, }, /* 190 */
+ { 12, 26, 12, 0, 0, }, /* 191 */
+ { 12, 12, 3, 0, 0, }, /* 192 */
+ { 12, 11, 3, 0, 0, }, /* 193 */
+ { 12, 9, 12, 0, 15, }, /* 194 */
+ { 12, 5, 12, 0, -15, }, /* 195 */
+ { 1, 9, 12, 0, 48, }, /* 196 */
+ { 1, 6, 12, 0, 0, }, /* 197 */
+ { 1, 21, 12, 0, 0, }, /* 198 */
+ { 1, 5, 12, 0, -48, }, /* 199 */
+ { 1, 5, 12, 0, 0, }, /* 200 */
+ { 1, 17, 12, 0, 0, }, /* 201 */
+ { 1, 26, 12, 0, 0, }, /* 202 */
+ { 1, 23, 12, 0, 0, }, /* 203 */
+ { 25, 12, 3, 0, 0, }, /* 204 */
+ { 25, 17, 12, 0, 0, }, /* 205 */
+ { 25, 21, 12, 0, 0, }, /* 206 */
+ { 25, 7, 12, 0, 0, }, /* 207 */
+ { 0, 1, 4, 0, 0, }, /* 208 */
+ { 9, 1, 4, 0, 0, }, /* 209 */
+ { 0, 25, 12, 0, 0, }, /* 210 */
+ { 0, 21, 12, 0, 0, }, /* 211 */
+ { 0, 23, 12, 0, 0, }, /* 212 */
+ { 0, 26, 12, 0, 0, }, /* 213 */
+ { 0, 12, 3, 0, 0, }, /* 214 */
+ { 0, 1, 2, 0, 0, }, /* 215 */
+ { 0, 7, 12, 0, 0, }, /* 216 */
+ { 0, 13, 12, 0, 0, }, /* 217 */
+ { 0, 6, 12, 0, 0, }, /* 218 */
+ { 49, 21, 12, 0, 0, }, /* 219 */
+ { 49, 1, 4, 0, 0, }, /* 220 */
+ { 49, 7, 12, 0, 0, }, /* 221 */
+ { 49, 12, 3, 0, 0, }, /* 222 */
+ { 55, 7, 12, 0, 0, }, /* 223 */
+ { 55, 12, 3, 0, 0, }, /* 224 */
+ { 63, 13, 12, 0, 0, }, /* 225 */
+ { 63, 7, 12, 0, 0, }, /* 226 */
+ { 63, 12, 3, 0, 0, }, /* 227 */
+ { 63, 6, 12, 0, 0, }, /* 228 */
+ { 63, 26, 12, 0, 0, }, /* 229 */
+ { 63, 21, 12, 0, 0, }, /* 230 */
+ { 89, 7, 12, 0, 0, }, /* 231 */
+ { 89, 12, 3, 0, 0, }, /* 232 */
+ { 89, 6, 12, 0, 0, }, /* 233 */
+ { 89, 21, 12, 0, 0, }, /* 234 */
+ { 94, 7, 12, 0, 0, }, /* 235 */
+ { 94, 12, 3, 0, 0, }, /* 236 */
+ { 94, 21, 12, 0, 0, }, /* 237 */
+ { 14, 12, 3, 0, 0, }, /* 238 */
+ { 14, 10, 5, 0, 0, }, /* 239 */
+ { 14, 7, 12, 0, 0, }, /* 240 */
+ { 14, 13, 12, 0, 0, }, /* 241 */
+ { 14, 21, 12, 0, 0, }, /* 242 */
+ { 14, 6, 12, 0, 0, }, /* 243 */
+ { 2, 7, 12, 0, 0, }, /* 244 */
+ { 2, 12, 3, 0, 0, }, /* 245 */
+ { 2, 10, 5, 0, 0, }, /* 246 */
+ { 2, 10, 3, 0, 0, }, /* 247 */
+ { 2, 13, 12, 0, 0, }, /* 248 */
+ { 2, 23, 12, 0, 0, }, /* 249 */
+ { 2, 15, 12, 0, 0, }, /* 250 */
+ { 2, 26, 12, 0, 0, }, /* 251 */
+ { 2, 21, 12, 0, 0, }, /* 252 */
+ { 21, 12, 3, 0, 0, }, /* 253 */
+ { 21, 10, 5, 0, 0, }, /* 254 */
+ { 21, 7, 12, 0, 0, }, /* 255 */
+ { 21, 13, 12, 0, 0, }, /* 256 */
+ { 20, 12, 3, 0, 0, }, /* 257 */
+ { 20, 10, 5, 0, 0, }, /* 258 */
+ { 20, 7, 12, 0, 0, }, /* 259 */
+ { 20, 13, 12, 0, 0, }, /* 260 */
+ { 20, 21, 12, 0, 0, }, /* 261 */
+ { 20, 23, 12, 0, 0, }, /* 262 */
+ { 43, 12, 3, 0, 0, }, /* 263 */
+ { 43, 10, 5, 0, 0, }, /* 264 */
+ { 43, 7, 12, 0, 0, }, /* 265 */
+ { 43, 10, 3, 0, 0, }, /* 266 */
+ { 43, 13, 12, 0, 0, }, /* 267 */
+ { 43, 26, 12, 0, 0, }, /* 268 */
+ { 43, 15, 12, 0, 0, }, /* 269 */
+ { 53, 12, 3, 0, 0, }, /* 270 */
+ { 53, 7, 12, 0, 0, }, /* 271 */
+ { 53, 10, 3, 0, 0, }, /* 272 */
+ { 53, 10, 5, 0, 0, }, /* 273 */
+ { 53, 13, 12, 0, 0, }, /* 274 */
+ { 53, 15, 12, 0, 0, }, /* 275 */
+ { 53, 26, 12, 0, 0, }, /* 276 */
+ { 53, 23, 12, 0, 0, }, /* 277 */
+ { 54, 12, 3, 0, 0, }, /* 278 */
+ { 54, 10, 5, 0, 0, }, /* 279 */
+ { 54, 7, 12, 0, 0, }, /* 280 */
+ { 54, 13, 12, 0, 0, }, /* 281 */
+ { 54, 15, 12, 0, 0, }, /* 282 */
+ { 54, 26, 12, 0, 0, }, /* 283 */
+ { 28, 7, 12, 0, 0, }, /* 284 */
+ { 28, 12, 3, 0, 0, }, /* 285 */
+ { 28, 10, 5, 0, 0, }, /* 286 */
+ { 28, 10, 3, 0, 0, }, /* 287 */
+ { 28, 13, 12, 0, 0, }, /* 288 */
+ { 36, 12, 3, 0, 0, }, /* 289 */
+ { 36, 10, 5, 0, 0, }, /* 290 */
+ { 36, 7, 12, 0, 0, }, /* 291 */
+ { 36, 10, 3, 0, 0, }, /* 292 */
+ { 36, 7, 4, 0, 0, }, /* 293 */
+ { 36, 26, 12, 0, 0, }, /* 294 */
+ { 36, 15, 12, 0, 0, }, /* 295 */
+ { 36, 13, 12, 0, 0, }, /* 296 */
+ { 47, 10, 5, 0, 0, }, /* 297 */
+ { 47, 7, 12, 0, 0, }, /* 298 */
+ { 47, 12, 3, 0, 0, }, /* 299 */
+ { 47, 10, 3, 0, 0, }, /* 300 */
+ { 47, 13, 12, 0, 0, }, /* 301 */
+ { 47, 21, 12, 0, 0, }, /* 302 */
+ { 56, 7, 12, 0, 0, }, /* 303 */
+ { 56, 12, 3, 0, 0, }, /* 304 */
+ { 56, 7, 5, 0, 0, }, /* 305 */
+ { 56, 6, 12, 0, 0, }, /* 306 */
+ { 56, 21, 12, 0, 0, }, /* 307 */
+ { 56, 13, 12, 0, 0, }, /* 308 */
+ { 32, 7, 12, 0, 0, }, /* 309 */
+ { 32, 12, 3, 0, 0, }, /* 310 */
+ { 32, 7, 5, 0, 0, }, /* 311 */
+ { 32, 6, 12, 0, 0, }, /* 312 */
+ { 32, 13, 12, 0, 0, }, /* 313 */
+ { 57, 7, 12, 0, 0, }, /* 314 */
+ { 57, 26, 12, 0, 0, }, /* 315 */
+ { 57, 21, 12, 0, 0, }, /* 316 */
+ { 57, 12, 3, 0, 0, }, /* 317 */
+ { 57, 13, 12, 0, 0, }, /* 318 */
+ { 57, 15, 12, 0, 0, }, /* 319 */
+ { 57, 22, 12, 0, 0, }, /* 320 */
+ { 57, 18, 12, 0, 0, }, /* 321 */
+ { 57, 10, 5, 0, 0, }, /* 322 */
+ { 38, 7, 12, 0, 0, }, /* 323 */
+ { 38, 10, 12, 0, 0, }, /* 324 */
+ { 38, 12, 3, 0, 0, }, /* 325 */
+ { 38, 10, 5, 0, 0, }, /* 326 */
+ { 38, 13, 12, 0, 0, }, /* 327 */
+ { 38, 21, 12, 0, 0, }, /* 328 */
+ { 38, 26, 12, 0, 0, }, /* 329 */
+ { 16, 9, 12, 0, 7264, }, /* 330 */
+ { 16, 7, 12, 0, 0, }, /* 331 */
+ { 16, 6, 12, 0, 0, }, /* 332 */
+ { 23, 7, 6, 0, 0, }, /* 333 */
+ { 23, 7, 7, 0, 0, }, /* 334 */
+ { 23, 7, 8, 0, 0, }, /* 335 */
+ { 15, 7, 12, 0, 0, }, /* 336 */
+ { 15, 12, 3, 0, 0, }, /* 337 */
+ { 15, 21, 12, 0, 0, }, /* 338 */
+ { 15, 15, 12, 0, 0, }, /* 339 */
+ { 15, 26, 12, 0, 0, }, /* 340 */
+ { 8, 9, 12, 0, 38864, }, /* 341 */
+ { 8, 9, 12, 0, 8, }, /* 342 */
+ { 8, 5, 12, 0, -8, }, /* 343 */
+ { 7, 17, 12, 0, 0, }, /* 344 */
+ { 7, 7, 12, 0, 0, }, /* 345 */
+ { 7, 21, 12, 0, 0, }, /* 346 */
+ { 40, 29, 12, 0, 0, }, /* 347 */
+ { 40, 7, 12, 0, 0, }, /* 348 */
+ { 40, 22, 12, 0, 0, }, /* 349 */
+ { 40, 18, 12, 0, 0, }, /* 350 */
+ { 45, 7, 12, 0, 0, }, /* 351 */
+ { 45, 14, 12, 0, 0, }, /* 352 */
+ { 50, 7, 12, 0, 0, }, /* 353 */
+ { 50, 12, 3, 0, 0, }, /* 354 */
+ { 24, 7, 12, 0, 0, }, /* 355 */
+ { 24, 12, 3, 0, 0, }, /* 356 */
+ { 6, 7, 12, 0, 0, }, /* 357 */
+ { 6, 12, 3, 0, 0, }, /* 358 */
+ { 51, 7, 12, 0, 0, }, /* 359 */
+ { 51, 12, 3, 0, 0, }, /* 360 */
+ { 31, 7, 12, 0, 0, }, /* 361 */
+ { 31, 12, 3, 0, 0, }, /* 362 */
+ { 31, 10, 5, 0, 0, }, /* 363 */
+ { 31, 21, 12, 0, 0, }, /* 364 */
+ { 31, 6, 12, 0, 0, }, /* 365 */
+ { 31, 23, 12, 0, 0, }, /* 366 */
+ { 31, 13, 12, 0, 0, }, /* 367 */
+ { 31, 15, 12, 0, 0, }, /* 368 */
+ { 37, 21, 12, 0, 0, }, /* 369 */
+ { 37, 17, 12, 0, 0, }, /* 370 */
+ { 37, 12, 3, 0, 0, }, /* 371 */
+ { 37, 1, 2, 0, 0, }, /* 372 */
+ { 37, 13, 12, 0, 0, }, /* 373 */
+ { 37, 7, 12, 0, 0, }, /* 374 */
+ { 37, 6, 12, 0, 0, }, /* 375 */
+ { 34, 7, 12, 0, 0, }, /* 376 */
+ { 34, 12, 3, 0, 0, }, /* 377 */
+ { 34, 10, 5, 0, 0, }, /* 378 */
+ { 34, 26, 12, 0, 0, }, /* 379 */
+ { 34, 21, 12, 0, 0, }, /* 380 */
+ { 34, 13, 12, 0, 0, }, /* 381 */
+ { 52, 7, 12, 0, 0, }, /* 382 */
+ { 39, 7, 12, 0, 0, }, /* 383 */
+ { 39, 13, 12, 0, 0, }, /* 384 */
+ { 39, 15, 12, 0, 0, }, /* 385 */
+ { 39, 26, 12, 0, 0, }, /* 386 */
+ { 31, 26, 12, 0, 0, }, /* 387 */
+ { 5, 7, 12, 0, 0, }, /* 388 */
+ { 5, 12, 3, 0, 0, }, /* 389 */
+ { 5, 10, 5, 0, 0, }, /* 390 */
+ { 5, 21, 12, 0, 0, }, /* 391 */
+ { 90, 7, 12, 0, 0, }, /* 392 */
+ { 90, 10, 5, 0, 0, }, /* 393 */
+ { 90, 12, 3, 0, 0, }, /* 394 */
+ { 90, 10, 12, 0, 0, }, /* 395 */
+ { 90, 13, 12, 0, 0, }, /* 396 */
+ { 90, 21, 12, 0, 0, }, /* 397 */
+ { 90, 6, 12, 0, 0, }, /* 398 */
+ { 27, 11, 3, 0, 0, }, /* 399 */
+ { 61, 12, 3, 0, 0, }, /* 400 */
+ { 61, 10, 5, 0, 0, }, /* 401 */
+ { 61, 7, 12, 0, 0, }, /* 402 */
+ { 61, 13, 12, 0, 0, }, /* 403 */
+ { 61, 21, 12, 0, 0, }, /* 404 */
+ { 61, 26, 12, 0, 0, }, /* 405 */
+ { 75, 12, 3, 0, 0, }, /* 406 */
+ { 75, 10, 5, 0, 0, }, /* 407 */
+ { 75, 7, 12, 0, 0, }, /* 408 */
+ { 75, 13, 12, 0, 0, }, /* 409 */
+ { 92, 7, 12, 0, 0, }, /* 410 */
+ { 92, 12, 3, 0, 0, }, /* 411 */
+ { 92, 10, 5, 0, 0, }, /* 412 */
+ { 92, 21, 12, 0, 0, }, /* 413 */
+ { 69, 7, 12, 0, 0, }, /* 414 */
+ { 69, 10, 5, 0, 0, }, /* 415 */
+ { 69, 12, 3, 0, 0, }, /* 416 */
+ { 69, 21, 12, 0, 0, }, /* 417 */
+ { 69, 13, 12, 0, 0, }, /* 418 */
+ { 72, 13, 12, 0, 0, }, /* 419 */
+ { 72, 7, 12, 0, 0, }, /* 420 */
+ { 72, 6, 12, 0, 0, }, /* 421 */
+ { 72, 21, 12, 0, 0, }, /* 422 */
+ { 12, 5, 12, 63, -6222, }, /* 423 */
+ { 12, 5, 12, 67, -6221, }, /* 424 */
+ { 12, 5, 12, 71, -6212, }, /* 425 */
+ { 12, 5, 12, 75, -6210, }, /* 426 */
+ { 12, 5, 12, 79, -6210, }, /* 427 */
+ { 12, 5, 12, 79, -6211, }, /* 428 */
+ { 12, 5, 12, 84, -6204, }, /* 429 */
+ { 12, 5, 12, 88, -6180, }, /* 430 */
+ { 12, 5, 12, 108, 35267, }, /* 431 */
+ { 75, 21, 12, 0, 0, }, /* 432 */
+ { 9, 10, 5, 0, 0, }, /* 433 */
+ { 9, 7, 12, 0, 0, }, /* 434 */
+ { 12, 5, 12, 0, 0, }, /* 435 */
+ { 12, 6, 12, 0, 0, }, /* 436 */
+ { 33, 5, 12, 0, 35332, }, /* 437 */
+ { 33, 5, 12, 0, 3814, }, /* 438 */
+ { 33, 9, 12, 92, 1, }, /* 439 */
+ { 33, 5, 12, 92, -1, }, /* 440 */
+ { 33, 5, 12, 92, -58, }, /* 441 */
+ { 33, 9, 12, 0, -7615, }, /* 442 */
+ { 19, 5, 12, 0, 8, }, /* 443 */
+ { 19, 9, 12, 0, -8, }, /* 444 */
+ { 19, 5, 12, 0, 74, }, /* 445 */
+ { 19, 5, 12, 0, 86, }, /* 446 */
+ { 19, 5, 12, 0, 100, }, /* 447 */
+ { 19, 5, 12, 0, 128, }, /* 448 */
+ { 19, 5, 12, 0, 112, }, /* 449 */
+ { 19, 5, 12, 0, 126, }, /* 450 */
+ { 19, 8, 12, 0, -8, }, /* 451 */
+ { 19, 5, 12, 0, 9, }, /* 452 */
+ { 19, 9, 12, 0, -74, }, /* 453 */
+ { 19, 8, 12, 0, -9, }, /* 454 */
+ { 19, 5, 12, 21, -7173, }, /* 455 */
+ { 19, 9, 12, 0, -86, }, /* 456 */
+ { 19, 9, 12, 0, -100, }, /* 457 */
+ { 19, 9, 12, 0, -112, }, /* 458 */
+ { 19, 9, 12, 0, -128, }, /* 459 */
+ { 19, 9, 12, 0, -126, }, /* 460 */
+ { 27, 1, 3, 0, 0, }, /* 461 */
+ { 27, 1, 16, 0, 0, }, /* 462 */
+ { 9, 27, 2, 0, 0, }, /* 463 */
+ { 9, 28, 2, 0, 0, }, /* 464 */
+ { 9, 2, 2, 0, 0, }, /* 465 */
+ { 9, 9, 12, 0, 0, }, /* 466 */
+ { 9, 5, 12, 0, 0, }, /* 467 */
+ { 19, 9, 12, 96, -7517, }, /* 468 */
+ { 33, 9, 12, 100, -8383, }, /* 469 */
+ { 33, 9, 12, 104, -8262, }, /* 470 */
+ { 33, 9, 12, 0, 28, }, /* 471 */
+ { 33, 5, 12, 0, -28, }, /* 472 */
+ { 33, 14, 12, 0, 16, }, /* 473 */
+ { 33, 14, 12, 0, -16, }, /* 474 */
+ { 33, 14, 12, 0, 0, }, /* 475 */
+ { 9, 26, 12, 0, 26, }, /* 476 */
+ { 9, 26, 12, 0, -26, }, /* 477 */
+ { 9, 26, 13, 0, 0, }, /* 478 */
+ { 9, 26, 17, 0, 0, }, /* 479 */
+ { 4, 26, 12, 0, 0, }, /* 480 */
+ { 17, 9, 12, 0, 48, }, /* 481 */
+ { 17, 5, 12, 0, -48, }, /* 482 */
+ { 33, 9, 12, 0, -10743, }, /* 483 */
+ { 33, 9, 12, 0, -3814, }, /* 484 */
+ { 33, 9, 12, 0, -10727, }, /* 485 */
+ { 33, 5, 12, 0, -10795, }, /* 486 */
+ { 33, 5, 12, 0, -10792, }, /* 487 */
+ { 33, 9, 12, 0, -10780, }, /* 488 */
+ { 33, 9, 12, 0, -10749, }, /* 489 */
+ { 33, 9, 12, 0, -10783, }, /* 490 */
+ { 33, 9, 12, 0, -10782, }, /* 491 */
+ { 33, 9, 12, 0, -10815, }, /* 492 */
+ { 10, 5, 12, 0, 0, }, /* 493 */
+ { 10, 26, 12, 0, 0, }, /* 494 */
+ { 10, 12, 3, 0, 0, }, /* 495 */
+ { 10, 21, 12, 0, 0, }, /* 496 */
+ { 10, 15, 12, 0, 0, }, /* 497 */
+ { 16, 5, 12, 0, -7264, }, /* 498 */
+ { 58, 7, 12, 0, 0, }, /* 499 */
+ { 58, 6, 12, 0, 0, }, /* 500 */
+ { 58, 21, 12, 0, 0, }, /* 501 */
+ { 58, 12, 3, 0, 0, }, /* 502 */
+ { 22, 26, 12, 0, 0, }, /* 503 */
+ { 22, 6, 12, 0, 0, }, /* 504 */
+ { 22, 14, 12, 0, 0, }, /* 505 */
+ { 23, 10, 3, 0, 0, }, /* 506 */
+ { 26, 7, 12, 0, 0, }, /* 507 */
+ { 26, 6, 12, 0, 0, }, /* 508 */
+ { 29, 7, 12, 0, 0, }, /* 509 */
+ { 29, 6, 12, 0, 0, }, /* 510 */
+ { 3, 7, 12, 0, 0, }, /* 511 */
+ { 23, 7, 12, 0, 0, }, /* 512 */
+ { 23, 26, 12, 0, 0, }, /* 513 */
+ { 29, 26, 12, 0, 0, }, /* 514 */
+ { 22, 7, 12, 0, 0, }, /* 515 */
+ { 60, 7, 12, 0, 0, }, /* 516 */
+ { 60, 6, 12, 0, 0, }, /* 517 */
+ { 60, 26, 12, 0, 0, }, /* 518 */
+ { 85, 7, 12, 0, 0, }, /* 519 */
+ { 85, 6, 12, 0, 0, }, /* 520 */
+ { 85, 21, 12, 0, 0, }, /* 521 */
+ { 76, 7, 12, 0, 0, }, /* 522 */
+ { 76, 6, 12, 0, 0, }, /* 523 */
+ { 76, 21, 12, 0, 0, }, /* 524 */
+ { 76, 13, 12, 0, 0, }, /* 525 */
+ { 12, 9, 12, 108, 1, }, /* 526 */
+ { 12, 5, 12, 108, -35267, }, /* 527 */
+ { 12, 7, 12, 0, 0, }, /* 528 */
+ { 12, 21, 12, 0, 0, }, /* 529 */
+ { 78, 7, 12, 0, 0, }, /* 530 */
+ { 78, 14, 12, 0, 0, }, /* 531 */
+ { 78, 12, 3, 0, 0, }, /* 532 */
+ { 78, 21, 12, 0, 0, }, /* 533 */
+ { 33, 9, 12, 0, -35332, }, /* 534 */
+ { 33, 9, 12, 0, -42280, }, /* 535 */
+ { 33, 9, 12, 0, -42308, }, /* 536 */
+ { 33, 9, 12, 0, -42319, }, /* 537 */
+ { 33, 9, 12, 0, -42315, }, /* 538 */
+ { 33, 9, 12, 0, -42305, }, /* 539 */
+ { 33, 9, 12, 0, -42258, }, /* 540 */
+ { 33, 9, 12, 0, -42282, }, /* 541 */
+ { 33, 9, 12, 0, -42261, }, /* 542 */
+ { 33, 9, 12, 0, 928, }, /* 543 */
+ { 48, 7, 12, 0, 0, }, /* 544 */
+ { 48, 12, 3, 0, 0, }, /* 545 */
+ { 48, 10, 5, 0, 0, }, /* 546 */
+ { 48, 26, 12, 0, 0, }, /* 547 */
+ { 64, 7, 12, 0, 0, }, /* 548 */
+ { 64, 21, 12, 0, 0, }, /* 549 */
+ { 74, 10, 5, 0, 0, }, /* 550 */
+ { 74, 7, 12, 0, 0, }, /* 551 */
+ { 74, 12, 3, 0, 0, }, /* 552 */
+ { 74, 21, 12, 0, 0, }, /* 553 */
+ { 74, 13, 12, 0, 0, }, /* 554 */
+ { 68, 13, 12, 0, 0, }, /* 555 */
+ { 68, 7, 12, 0, 0, }, /* 556 */
+ { 68, 12, 3, 0, 0, }, /* 557 */
+ { 68, 21, 12, 0, 0, }, /* 558 */
+ { 73, 7, 12, 0, 0, }, /* 559 */
+ { 73, 12, 3, 0, 0, }, /* 560 */
+ { 73, 10, 5, 0, 0, }, /* 561 */
+ { 73, 21, 12, 0, 0, }, /* 562 */
+ { 83, 12, 3, 0, 0, }, /* 563 */
+ { 83, 10, 5, 0, 0, }, /* 564 */
+ { 83, 7, 12, 0, 0, }, /* 565 */
+ { 83, 21, 12, 0, 0, }, /* 566 */
+ { 83, 13, 12, 0, 0, }, /* 567 */
+ { 38, 6, 12, 0, 0, }, /* 568 */
+ { 67, 7, 12, 0, 0, }, /* 569 */
+ { 67, 12, 3, 0, 0, }, /* 570 */
+ { 67, 10, 5, 0, 0, }, /* 571 */
+ { 67, 13, 12, 0, 0, }, /* 572 */
+ { 67, 21, 12, 0, 0, }, /* 573 */
+ { 91, 7, 12, 0, 0, }, /* 574 */
+ { 91, 12, 3, 0, 0, }, /* 575 */
+ { 91, 6, 12, 0, 0, }, /* 576 */
+ { 91, 21, 12, 0, 0, }, /* 577 */
+ { 86, 7, 12, 0, 0, }, /* 578 */
+ { 86, 10, 5, 0, 0, }, /* 579 */
+ { 86, 12, 3, 0, 0, }, /* 580 */
+ { 86, 21, 12, 0, 0, }, /* 581 */
+ { 86, 6, 12, 0, 0, }, /* 582 */
+ { 33, 5, 12, 0, -928, }, /* 583 */
+ { 8, 5, 12, 0, -38864, }, /* 584 */
+ { 86, 13, 12, 0, 0, }, /* 585 */
+ { 23, 7, 9, 0, 0, }, /* 586 */
+ { 23, 7, 10, 0, 0, }, /* 587 */
+ { 9, 4, 2, 0, 0, }, /* 588 */
+ { 9, 3, 12, 0, 0, }, /* 589 */
+ { 25, 25, 12, 0, 0, }, /* 590 */
+ { 0, 24, 12, 0, 0, }, /* 591 */
+ { 9, 6, 3, 0, 0, }, /* 592 */
+ { 35, 7, 12, 0, 0, }, /* 593 */
+ { 19, 14, 12, 0, 0, }, /* 594 */
+ { 19, 15, 12, 0, 0, }, /* 595 */
+ { 19, 26, 12, 0, 0, }, /* 596 */
+ { 70, 7, 12, 0, 0, }, /* 597 */
+ { 66, 7, 12, 0, 0, }, /* 598 */
+ { 41, 7, 12, 0, 0, }, /* 599 */
+ { 41, 15, 12, 0, 0, }, /* 600 */
+ { 18, 7, 12, 0, 0, }, /* 601 */
+ { 18, 14, 12, 0, 0, }, /* 602 */
+ { 117, 7, 12, 0, 0, }, /* 603 */
+ { 117, 12, 3, 0, 0, }, /* 604 */
+ { 59, 7, 12, 0, 0, }, /* 605 */
+ { 59, 21, 12, 0, 0, }, /* 606 */
+ { 42, 7, 12, 0, 0, }, /* 607 */
+ { 42, 21, 12, 0, 0, }, /* 608 */
+ { 42, 14, 12, 0, 0, }, /* 609 */
+ { 13, 9, 12, 0, 40, }, /* 610 */
+ { 13, 5, 12, 0, -40, }, /* 611 */
+ { 46, 7, 12, 0, 0, }, /* 612 */
+ { 44, 7, 12, 0, 0, }, /* 613 */
+ { 44, 13, 12, 0, 0, }, /* 614 */
+ { 135, 9, 12, 0, 40, }, /* 615 */
+ { 135, 5, 12, 0, -40, }, /* 616 */
+ { 105, 7, 12, 0, 0, }, /* 617 */
+ { 103, 7, 12, 0, 0, }, /* 618 */
+ { 103, 21, 12, 0, 0, }, /* 619 */
+ { 109, 7, 12, 0, 0, }, /* 620 */
+ { 11, 7, 12, 0, 0, }, /* 621 */
+ { 80, 7, 12, 0, 0, }, /* 622 */
+ { 80, 21, 12, 0, 0, }, /* 623 */
+ { 80, 15, 12, 0, 0, }, /* 624 */
+ { 119, 7, 12, 0, 0, }, /* 625 */
+ { 119, 26, 12, 0, 0, }, /* 626 */
+ { 119, 15, 12, 0, 0, }, /* 627 */
+ { 115, 7, 12, 0, 0, }, /* 628 */
+ { 115, 15, 12, 0, 0, }, /* 629 */
+ { 127, 7, 12, 0, 0, }, /* 630 */
+ { 127, 15, 12, 0, 0, }, /* 631 */
+ { 65, 7, 12, 0, 0, }, /* 632 */
+ { 65, 15, 12, 0, 0, }, /* 633 */
+ { 65, 21, 12, 0, 0, }, /* 634 */
+ { 71, 7, 12, 0, 0, }, /* 635 */
+ { 71, 21, 12, 0, 0, }, /* 636 */
+ { 97, 7, 12, 0, 0, }, /* 637 */
+ { 96, 7, 12, 0, 0, }, /* 638 */
+ { 96, 15, 12, 0, 0, }, /* 639 */
+ { 30, 7, 12, 0, 0, }, /* 640 */
+ { 30, 12, 3, 0, 0, }, /* 641 */
+ { 30, 15, 12, 0, 0, }, /* 642 */
+ { 30, 21, 12, 0, 0, }, /* 643 */
+ { 87, 7, 12, 0, 0, }, /* 644 */
+ { 87, 15, 12, 0, 0, }, /* 645 */
+ { 87, 21, 12, 0, 0, }, /* 646 */
+ { 116, 7, 12, 0, 0, }, /* 647 */
+ { 116, 15, 12, 0, 0, }, /* 648 */
+ { 111, 7, 12, 0, 0, }, /* 649 */
+ { 111, 26, 12, 0, 0, }, /* 650 */
+ { 111, 12, 3, 0, 0, }, /* 651 */
+ { 111, 15, 12, 0, 0, }, /* 652 */
+ { 111, 21, 12, 0, 0, }, /* 653 */
+ { 77, 7, 12, 0, 0, }, /* 654 */
+ { 77, 21, 12, 0, 0, }, /* 655 */
+ { 82, 7, 12, 0, 0, }, /* 656 */
+ { 82, 15, 12, 0, 0, }, /* 657 */
+ { 81, 7, 12, 0, 0, }, /* 658 */
+ { 81, 15, 12, 0, 0, }, /* 659 */
+ { 120, 7, 12, 0, 0, }, /* 660 */
+ { 120, 21, 12, 0, 0, }, /* 661 */
+ { 120, 15, 12, 0, 0, }, /* 662 */
+ { 88, 7, 12, 0, 0, }, /* 663 */
+ { 129, 9, 12, 0, 64, }, /* 664 */
+ { 129, 5, 12, 0, -64, }, /* 665 */
+ { 129, 15, 12, 0, 0, }, /* 666 */
+ { 0, 15, 12, 0, 0, }, /* 667 */
+ { 93, 10, 5, 0, 0, }, /* 668 */
+ { 93, 12, 3, 0, 0, }, /* 669 */
+ { 93, 7, 12, 0, 0, }, /* 670 */
+ { 93, 21, 12, 0, 0, }, /* 671 */
+ { 93, 15, 12, 0, 0, }, /* 672 */
+ { 93, 13, 12, 0, 0, }, /* 673 */
+ { 84, 12, 3, 0, 0, }, /* 674 */
+ { 84, 10, 5, 0, 0, }, /* 675 */
+ { 84, 7, 12, 0, 0, }, /* 676 */
+ { 84, 21, 12, 0, 0, }, /* 677 */
+ { 84, 1, 4, 0, 0, }, /* 678 */
+ { 100, 7, 12, 0, 0, }, /* 679 */
+ { 100, 13, 12, 0, 0, }, /* 680 */
+ { 95, 12, 3, 0, 0, }, /* 681 */
+ { 95, 7, 12, 0, 0, }, /* 682 */
+ { 95, 10, 5, 0, 0, }, /* 683 */
+ { 95, 13, 12, 0, 0, }, /* 684 */
+ { 95, 21, 12, 0, 0, }, /* 685 */
+ { 110, 7, 12, 0, 0, }, /* 686 */
+ { 110, 12, 3, 0, 0, }, /* 687 */
+ { 110, 21, 12, 0, 0, }, /* 688 */
+ { 99, 12, 3, 0, 0, }, /* 689 */
+ { 99, 10, 5, 0, 0, }, /* 690 */
+ { 99, 7, 12, 0, 0, }, /* 691 */
+ { 99, 7, 4, 0, 0, }, /* 692 */
+ { 99, 21, 12, 0, 0, }, /* 693 */
+ { 99, 13, 12, 0, 0, }, /* 694 */
+ { 47, 15, 12, 0, 0, }, /* 695 */
+ { 107, 7, 12, 0, 0, }, /* 696 */
+ { 107, 10, 5, 0, 0, }, /* 697 */
+ { 107, 12, 3, 0, 0, }, /* 698 */
+ { 107, 21, 12, 0, 0, }, /* 699 */
+ { 128, 7, 12, 0, 0, }, /* 700 */
+ { 128, 21, 12, 0, 0, }, /* 701 */
+ { 108, 7, 12, 0, 0, }, /* 702 */
+ { 108, 12, 3, 0, 0, }, /* 703 */
+ { 108, 10, 5, 0, 0, }, /* 704 */
+ { 108, 13, 12, 0, 0, }, /* 705 */
+ { 106, 12, 3, 0, 0, }, /* 706 */
+ { 106, 10, 5, 0, 0, }, /* 707 */
+ { 106, 7, 12, 0, 0, }, /* 708 */
+ { 106, 10, 3, 0, 0, }, /* 709 */
+ { 134, 7, 12, 0, 0, }, /* 710 */
+ { 134, 10, 5, 0, 0, }, /* 711 */
+ { 134, 12, 3, 0, 0, }, /* 712 */
+ { 134, 21, 12, 0, 0, }, /* 713 */
+ { 134, 13, 12, 0, 0, }, /* 714 */
+ { 123, 7, 12, 0, 0, }, /* 715 */
+ { 123, 10, 3, 0, 0, }, /* 716 */
+ { 123, 10, 5, 0, 0, }, /* 717 */
+ { 123, 12, 3, 0, 0, }, /* 718 */
+ { 123, 21, 12, 0, 0, }, /* 719 */
+ { 123, 13, 12, 0, 0, }, /* 720 */
+ { 122, 7, 12, 0, 0, }, /* 721 */
+ { 122, 10, 3, 0, 0, }, /* 722 */
+ { 122, 10, 5, 0, 0, }, /* 723 */
+ { 122, 12, 3, 0, 0, }, /* 724 */
+ { 122, 21, 12, 0, 0, }, /* 725 */
+ { 113, 7, 12, 0, 0, }, /* 726 */
+ { 113, 10, 5, 0, 0, }, /* 727 */
+ { 113, 12, 3, 0, 0, }, /* 728 */
+ { 113, 21, 12, 0, 0, }, /* 729 */
+ { 113, 13, 12, 0, 0, }, /* 730 */
+ { 101, 7, 12, 0, 0, }, /* 731 */
+ { 101, 12, 3, 0, 0, }, /* 732 */
+ { 101, 10, 5, 0, 0, }, /* 733 */
+ { 101, 13, 12, 0, 0, }, /* 734 */
+ { 125, 7, 12, 0, 0, }, /* 735 */
+ { 125, 12, 3, 0, 0, }, /* 736 */
+ { 125, 10, 5, 0, 0, }, /* 737 */
+ { 125, 13, 12, 0, 0, }, /* 738 */
+ { 125, 15, 12, 0, 0, }, /* 739 */
+ { 125, 21, 12, 0, 0, }, /* 740 */
+ { 125, 26, 12, 0, 0, }, /* 741 */
+ { 124, 9, 12, 0, 32, }, /* 742 */
+ { 124, 5, 12, 0, -32, }, /* 743 */
+ { 124, 13, 12, 0, 0, }, /* 744 */
+ { 124, 15, 12, 0, 0, }, /* 745 */
+ { 124, 7, 12, 0, 0, }, /* 746 */
+ { 140, 7, 12, 0, 0, }, /* 747 */
+ { 140, 12, 3, 0, 0, }, /* 748 */
+ { 140, 10, 5, 0, 0, }, /* 749 */
+ { 140, 7, 4, 0, 0, }, /* 750 */
+ { 140, 21, 12, 0, 0, }, /* 751 */
+ { 139, 7, 12, 0, 0, }, /* 752 */
+ { 139, 12, 3, 0, 0, }, /* 753 */
+ { 139, 10, 5, 0, 0, }, /* 754 */
+ { 139, 7, 4, 0, 0, }, /* 755 */
+ { 139, 21, 12, 0, 0, }, /* 756 */
+ { 121, 7, 12, 0, 0, }, /* 757 */
+ { 132, 7, 12, 0, 0, }, /* 758 */
+ { 132, 10, 5, 0, 0, }, /* 759 */
+ { 132, 12, 3, 0, 0, }, /* 760 */
+ { 132, 21, 12, 0, 0, }, /* 761 */
+ { 132, 13, 12, 0, 0, }, /* 762 */
+ { 132, 15, 12, 0, 0, }, /* 763 */
+ { 133, 21, 12, 0, 0, }, /* 764 */
+ { 133, 7, 12, 0, 0, }, /* 765 */
+ { 133, 12, 3, 0, 0, }, /* 766 */
+ { 133, 10, 5, 0, 0, }, /* 767 */
+ { 137, 7, 12, 0, 0, }, /* 768 */
+ { 137, 12, 3, 0, 0, }, /* 769 */
+ { 137, 7, 4, 0, 0, }, /* 770 */
+ { 137, 13, 12, 0, 0, }, /* 771 */
+ { 62, 7, 12, 0, 0, }, /* 772 */
+ { 62, 14, 12, 0, 0, }, /* 773 */
+ { 62, 21, 12, 0, 0, }, /* 774 */
+ { 79, 7, 12, 0, 0, }, /* 775 */
+ { 126, 7, 12, 0, 0, }, /* 776 */
+ { 114, 7, 12, 0, 0, }, /* 777 */
+ { 114, 13, 12, 0, 0, }, /* 778 */
+ { 114, 21, 12, 0, 0, }, /* 779 */
+ { 102, 7, 12, 0, 0, }, /* 780 */
+ { 102, 12, 3, 0, 0, }, /* 781 */
+ { 102, 21, 12, 0, 0, }, /* 782 */
+ { 118, 7, 12, 0, 0, }, /* 783 */
+ { 118, 12, 3, 0, 0, }, /* 784 */
+ { 118, 21, 12, 0, 0, }, /* 785 */
+ { 118, 26, 12, 0, 0, }, /* 786 */
+ { 118, 6, 12, 0, 0, }, /* 787 */
+ { 118, 13, 12, 0, 0, }, /* 788 */
+ { 118, 15, 12, 0, 0, }, /* 789 */
+ { 98, 7, 12, 0, 0, }, /* 790 */
+ { 98, 10, 5, 0, 0, }, /* 791 */
+ { 98, 12, 3, 0, 0, }, /* 792 */
+ { 98, 6, 12, 0, 0, }, /* 793 */
+ { 136, 6, 12, 0, 0, }, /* 794 */
+ { 138, 6, 12, 0, 0, }, /* 795 */
+ { 136, 7, 12, 0, 0, }, /* 796 */
+ { 138, 7, 12, 0, 0, }, /* 797 */
+ { 104, 7, 12, 0, 0, }, /* 798 */
+ { 104, 26, 12, 0, 0, }, /* 799 */
+ { 104, 12, 3, 0, 0, }, /* 800 */
+ { 104, 21, 12, 0, 0, }, /* 801 */
+ { 9, 10, 3, 0, 0, }, /* 802 */
+ { 19, 12, 3, 0, 0, }, /* 803 */
+ { 130, 26, 12, 0, 0, }, /* 804 */
+ { 130, 12, 3, 0, 0, }, /* 805 */
+ { 130, 21, 12, 0, 0, }, /* 806 */
+ { 17, 12, 3, 0, 0, }, /* 807 */
+ { 112, 7, 12, 0, 0, }, /* 808 */
+ { 112, 15, 12, 0, 0, }, /* 809 */
+ { 112, 12, 3, 0, 0, }, /* 810 */
+ { 131, 9, 12, 0, 34, }, /* 811 */
+ { 131, 5, 12, 0, -34, }, /* 812 */
+ { 131, 12, 3, 0, 0, }, /* 813 */
+ { 131, 13, 12, 0, 0, }, /* 814 */
+ { 131, 21, 12, 0, 0, }, /* 815 */
+ { 9, 26, 11, 0, 0, }, /* 816 */
+ { 26, 26, 12, 0, 0, }, /* 817 */
+ { 9, 24, 14, 0, 0, }, /* 818 */
+ { 9, 26, 15, 0, 0, }, /* 819 */
+ { 9, 1, 3, 0, 0, }, /* 820 */
};
const uint8_t PRIV(ucd_stage1)[] = { /* 8704 bytes */
@@ -834,549 +933,549 @@ const uint8_t PRIV(ucd_stage1)[] = { /* 8704 bytes */
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* U+0800 */
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 41, 41, 42, 43, 44, 45, /* U+1000 */
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, /* U+1800 */
- 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 71, 74, 75, /* U+2000 */
- 76, 76, 66, 77, 66, 66, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, /* U+2800 */
- 88, 89, 90, 91, 92, 93, 94, 71, 95, 95, 95, 95, 95, 95, 95, 95, /* U+3000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+3800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+4000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 96, 95, 95, 95, 95, /* U+4800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+5000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+5800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+6000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+6800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+7000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+7800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+8000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+8800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+9000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 97, /* U+9800 */
- 98, 99, 99, 99, 99, 99, 99, 99, 99,100,101,101,102,103,104,105, /* U+A000 */
-106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,114, /* U+A800 */
-115,116,117,118,119,120,114,115,116,117,118,119,120,114,115,116, /* U+B000 */
-117,118,119,120,114,115,116,117,118,119,120,114,115,116,117,118, /* U+B800 */
-119,120,114,115,116,117,118,119,120,114,115,116,117,118,119,120, /* U+C000 */
-114,115,116,117,118,119,120,114,115,116,117,118,119,120,114,115, /* U+C800 */
-116,117,118,119,120,114,115,116,117,118,119,120,114,115,116,121, /* U+D000 */
-122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122, /* U+D800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+E000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+E800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F000 */
-123,123, 95, 95,124,125,126,127,128,128,129,130,131,132,133,134, /* U+F800 */
-135,136,137,138,139,140,141,142,143,144,145,139,146,146,147,139, /* U+10000 */
-148,149,150,151,152,153,154,155,156,157,139,139,158,139,139,139, /* U+10800 */
-159,160,161,162,163,164,165,139,139,166,139,167,168,169,170,139, /* U+11000 */
-139,171,139,139,139,172,139,139,139,139,139,139,139,139,139,139, /* U+11800 */
-173,173,173,173,173,173,173,174,175,173,176,139,139,139,139,139, /* U+12000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+12800 */
-177,177,177,177,177,177,177,177,178,139,139,139,139,139,139,139, /* U+13000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+13800 */
-139,139,139,139,139,139,139,139,179,179,179,179,180,139,139,139, /* U+14000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+14800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+15000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+15800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+16000 */
-181,181,181,181,182,183,184,185,139,139,139,139,139,139,186,187, /* U+16800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+17000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+17800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+18000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+18800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+19000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+19800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1A800 */
-188,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1B000 */
-139,139,139,139,139,139,139,139,189,190,139,139,139,139,139,139, /* U+1B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1C800 */
- 71,191,192,193,194,139,195,139,196,197,198,199,200,201,202,203, /* U+1D000 */
-204,204,204,204,205,206,139,139,139,139,139,139,139,139,139,139, /* U+1D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1E000 */
-207,208,139,139,139,139,139,139,139,139,139,139,209,210,139,139, /* U+1E800 */
-211,212,213,214,215,139, 71,216, 71, 71,217,218, 71,219,220,221, /* U+1F000 */
-222,223,224,225,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1F800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+20000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+20800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+21000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+21800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+22000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+22800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+23000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+23800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+24000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+24800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+25000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+25800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+26000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+26800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+27000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+27800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+28000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+28800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+29000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+29800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,226, 95, 95, /* U+2A000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+2A800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,227, 95, /* U+2B000 */
-228, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+2B800 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+2C000 */
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,229,139,139, /* U+2C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2F000 */
- 95, 95, 95, 95,230,139,139,139,139,139,139,139,139,139,139,139, /* U+2F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+30000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+30800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+31000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+31800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+32000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+32800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+33000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+33800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+34000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+34800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+35000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+35800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+36000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+36800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+37000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+37800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+38000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+38800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+39000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+39800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+40000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+40800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+41000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+41800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+42000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+42800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+43000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+43800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+44000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+44800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+45000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+45800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+46000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+46800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+47000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+47800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+48000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+48800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+49000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+49800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+50000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+50800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+51000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+51800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+52000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+52800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+53000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+53800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+54000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+54800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+55000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+55800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+56000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+56800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+57000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+57800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+58000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+58800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+59000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+59800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+60000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+60800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+61000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+61800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+62000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+62800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+63000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+63800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+64000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+64800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+65000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+65800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+66000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+66800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+67000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+67800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+68000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+68800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+69000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+69800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+70000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+70800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+71000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+71800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+72000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+72800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+73000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+73800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+74000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+74800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+75000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+75800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+76000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+76800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+77000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+77800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+78000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+78800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+79000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+79800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+80000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+80800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+81000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+81800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+82000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+82800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+83000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+83800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+84000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+84800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+85000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+85800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+86000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+86800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+87000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+87800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+88000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+88800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+89000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+89800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+90000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+90800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+91000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+91800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+92000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+92800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+93000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+93800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+94000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+94800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+95000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+95800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+96000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+96800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+97000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+97800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+98000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+98800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+99000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+99800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9A000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9A800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9B000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9B800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9C000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9C800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9D000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9D800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9E000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9E800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9F000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9F800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A0000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A0800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A1000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A1800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A2000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A2800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A3000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A3800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A4000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A4800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A5000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A5800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A6000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A6800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A7000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A7800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A8000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A8800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A9000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A9800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AA000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AA800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AB000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AB800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AC000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AC800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AD000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AD800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AE000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AE800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AF000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AF800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B0000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B0800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B1000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B1800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B2000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B2800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B3000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B3800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B4000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B4800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B5000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B5800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B6000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B6800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B7000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B7800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B8000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B8800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B9000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B9800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BA000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BA800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BB000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BB800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BC000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BC800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BD000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BD800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BE000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BE800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BF000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BF800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C0000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C0800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C1000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C1800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C2000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C2800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C3000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C3800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C4000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C4800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C5000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C5800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C6000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C6800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C7000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C7800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C8000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C8800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C9000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C9800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CA000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CA800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CB000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CB800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CC000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CC800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CD000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CD800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CE000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CE800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CF000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CF800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D0000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D0800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D1000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D1800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D2000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D2800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D3000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D3800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D4000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D4800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D5000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D5800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D6000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D6800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D7000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D7800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D8000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D8800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D9000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D9800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DA000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DA800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DB000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DB800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DC000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DC800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DD000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DD800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DE000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DE800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DF000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DF800 */
-231,232,233,234,232,232,232,232,232,232,232,232,232,232,232,232, /* U+E0000 */
-232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232, /* U+E0800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E1000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E1800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E2000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E2800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E3000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E3800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E4000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E4800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E5000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E5800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E6000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E6800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E7000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E7800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E8000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E8800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E9000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E9800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EA000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EA800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EB000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EB800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EC000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EC800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+ED000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+ED800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EE000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EE800 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EF000 */
-139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EF800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F0000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F0800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F1000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F1800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F2000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F2800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F3000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F3800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F4000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F4800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F5000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F5800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F6000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F6800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F7000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F7800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F8000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F8800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F9000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F9800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FA000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FA800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FB000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FB800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FC000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FC800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FD000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FD800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FE000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FE800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FF000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,235, /* U+FF800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+100000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+100800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+101000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+101800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+102000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+102800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+103000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+103800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+104000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+104800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+105000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+105800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+106000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+106800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+107000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+107800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+108000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+108800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+109000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+109800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10A000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10A800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10B000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10B800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10C000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10C800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10D000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10D800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10E000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10E800 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10F000 */
-123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,235, /* U+10F800 */
+ 62, 63, 64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, /* U+2000 */
+ 77, 77, 66, 78, 66, 66, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, /* U+2800 */
+ 89, 90, 91, 92, 93, 94, 95, 71, 96, 96, 96, 96, 96, 96, 96, 96, /* U+3000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+3800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+4000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 96, 96, 96, 96, /* U+4800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+5000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+5800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+6000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+6800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+7000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+7800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+8000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+8800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+9000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 98, /* U+9800 */
+ 99,100,100,100,100,100,100,100,100,101,102,102,103,104,105,106, /* U+A000 */
+107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,115, /* U+A800 */
+116,117,118,119,120,121,115,116,117,118,119,120,121,115,116,117, /* U+B000 */
+118,119,120,121,115,116,117,118,119,120,121,115,116,117,118,119, /* U+B800 */
+120,121,115,116,117,118,119,120,121,115,116,117,118,119,120,121, /* U+C000 */
+115,116,117,118,119,120,121,115,116,117,118,119,120,121,115,116, /* U+C800 */
+117,118,119,120,121,115,116,117,118,119,120,121,115,116,117,122, /* U+D000 */
+123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+D800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+E000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+E800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F000 */
+124,124, 96, 96,125,126,127,128,129,129,130,131,132,133,134,135, /* U+F800 */
+136,137,138,139,140,141,142,143,144,145,146,140,147,147,148,140, /* U+10000 */
+149,150,151,152,153,154,155,156,157,158,140,140,159,140,140,140, /* U+10800 */
+160,161,162,163,164,165,166,140,167,168,140,169,170,171,172,140, /* U+11000 */
+140,173,140,140,174,175,140,140,176,177,178,140,140,140,140,140, /* U+11800 */
+179,179,179,179,179,179,179,180,181,179,182,140,140,140,140,140, /* U+12000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+12800 */
+183,183,183,183,183,183,183,183,184,140,140,140,140,140,140,140, /* U+13000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+13800 */
+140,140,140,140,140,140,140,140,185,185,185,185,186,140,140,140, /* U+14000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+14800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+15000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+15800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+16000 */
+187,187,187,187,188,189,190,191,140,140,140,140,140,140,192,193, /* U+16800 */
+194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* U+17000 */
+194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194, /* U+17800 */
+194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,195, /* U+18000 */
+194,194,194,194,194,196,140,140,140,140,140,140,140,140,140,140, /* U+18800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+19000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+19800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+1A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+1A800 */
+197,198,199,200,200,201,140,140,140,140,140,140,140,140,140,140, /* U+1B000 */
+140,140,140,140,140,140,140,140,202,203,140,140,140,140,140,140, /* U+1B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+1C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+1C800 */
+ 71,204,205,206,207,140,208,140,209,210,211,212,213,214,215,216, /* U+1D000 */
+217,217,217,217,218,219,140,140,140,140,140,140,140,140,140,140, /* U+1D800 */
+220,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+1E000 */
+221,222,223,140,140,140,140,140,140,140,140,140,224,225,140,140, /* U+1E800 */
+226,227,228,229,230,140,231,232,233,234,235,236,237,238,239,240, /* U+1F000 */
+241,242,243,244,140,140,140,140,140,140,140,140,140,140,140,140, /* U+1F800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+20000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+20800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+21000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+21800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+22000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+22800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+23000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+23800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+24000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+24800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+25000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+25800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+26000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+26800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+27000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+27800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+28000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+28800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+29000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+29800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,245, 96, 96, /* U+2A000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+2A800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,246, 96, /* U+2B000 */
+247, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+2B800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+2C000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,248, 96, 96, /* U+2C800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+2D000 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+2D800 */
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, /* U+2E000 */
+ 96, 96, 96, 96, 96, 96, 96,249,140,140,140,140,140,140,140,140, /* U+2E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+2F000 */
+ 96, 96, 96, 96,250,140,140,140,140,140,140,140,140,140,140,140, /* U+2F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+30000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+30800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+31000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+31800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+32000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+32800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+33000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+33800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+34000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+34800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+35000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+35800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+36000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+36800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+37000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+37800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+38000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+38800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+39000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+39800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+3F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+40000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+40800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+41000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+41800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+42000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+42800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+43000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+43800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+44000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+44800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+45000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+45800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+46000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+46800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+47000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+47800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+48000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+48800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+49000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+49800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+4F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+50000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+50800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+51000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+51800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+52000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+52800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+53000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+53800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+54000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+54800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+55000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+55800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+56000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+56800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+57000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+57800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+58000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+58800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+59000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+59800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+5F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+60000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+60800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+61000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+61800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+62000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+62800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+63000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+63800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+64000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+64800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+65000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+65800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+66000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+66800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+67000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+67800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+68000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+68800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+69000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+69800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+6F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+70000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+70800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+71000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+71800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+72000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+72800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+73000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+73800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+74000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+74800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+75000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+75800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+76000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+76800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+77000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+77800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+78000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+78800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+79000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+79800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+7F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+80000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+80800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+81000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+81800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+82000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+82800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+83000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+83800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+84000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+84800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+85000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+85800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+86000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+86800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+87000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+87800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+88000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+88800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+89000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+89800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+8F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+90000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+90800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+91000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+91800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+92000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+92800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+93000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+93800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+94000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+94800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+95000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+95800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+96000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+96800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+97000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+97800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+98000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+98800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+99000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+99800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9A000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9A800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9B000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9B800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9C000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9C800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9D000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9D800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9E000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9E800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9F000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+9F800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A0000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A0800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A1000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A1800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A2000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A2800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A3000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A3800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A4000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A4800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A5000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A5800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A6000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A6800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A7000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A7800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A8000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A8800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A9000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+A9800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AA000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AA800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AB000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AB800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AC000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AC800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AD000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AD800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AE000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AE800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AF000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+AF800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B0000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B0800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B1000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B1800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B2000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B2800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B3000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B3800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B4000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B4800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B5000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B5800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B6000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B6800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B7000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B7800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B8000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B8800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B9000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+B9800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BA000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BA800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BB000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BB800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BC000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BC800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BD000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BD800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BE000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BE800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BF000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+BF800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C0000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C0800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C1000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C1800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C2000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C2800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C3000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C3800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C4000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C4800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C5000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C5800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C6000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C6800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C7000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C7800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C8000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C8800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C9000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+C9800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CA000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CA800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CB000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CB800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CC000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CC800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CD000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CD800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CE000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CE800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CF000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+CF800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D0000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D0800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D1000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D1800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D2000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D2800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D3000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D3800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D4000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D4800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D5000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D5800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D6000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D6800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D7000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D7800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D8000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D8800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D9000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+D9800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DA000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DA800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DB000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DB800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DC000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DC800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DD000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DD800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DE000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DE800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DF000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+DF800 */
+251,252,253,254,252,252,252,252,252,252,252,252,252,252,252,252, /* U+E0000 */
+252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252, /* U+E0800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E1000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E1800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E2000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E2800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E3000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E3800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E4000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E4800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E5000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E5800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E6000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E6800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E7000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E7800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E8000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E8800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E9000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+E9800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EA000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EA800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EB000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EB800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EC000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EC800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+ED000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+ED800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EE000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EE800 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EF000 */
+140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140, /* U+EF800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F0000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F0800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F1000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F1800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F2000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F2800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F3000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F3800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F4000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F4800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F5000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F5800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F6000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F6800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F7000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F7800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F8000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F8800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F9000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+F9800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FA000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FA800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FB000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FB800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FC000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FC800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FD000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FD800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FE000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FE800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+FF000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,255, /* U+FF800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+100000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+100800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+101000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+101800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+102000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+102800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+103000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+103800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+104000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+104800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+105000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+105800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+106000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+106800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+107000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+107800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+108000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+108800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+109000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+109800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10A000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10A800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10B000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10B800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10C000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10C800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10D000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10D800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10E000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10E800 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, /* U+10F000 */
+124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,255, /* U+10F800 */
};
-const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
+const uint16_t PRIV(ucd_stage2)[] = { /* 65536 bytes, block = 128 */
/* block 0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1424,7 +1523,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
30, 31, 30, 31, 33, 33, 33, 33, 33, 33, 71, 30, 31, 72, 73, 74,
74, 30, 31, 75, 76, 77, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
78, 79, 80, 81, 82, 33, 83, 83, 33, 84, 33, 85, 86, 33, 33, 33,
- 83, 87, 33, 88, 33, 89, 90, 33, 91, 92, 33, 93, 94, 33, 33, 92,
+ 83, 87, 33, 88, 33, 89, 90, 33, 91, 92, 90, 93, 94, 33, 33, 92,
33, 95, 96, 33, 33, 97, 33, 33, 33, 33, 33, 33, 33, 98, 33, 33,
/* block 5 */
@@ -1459,493 +1558,493 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
/* block 8 */
171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,
-172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
-172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,
-173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
-173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,
-174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
+172,172,173,172,174,172,172,172,172,172,172,172,172,172,175,172,
+172,176,177,172,172,172,172,172,172,172,178,172,172,172,172,172,
+179,179,180,179,181,179,179,179,179,179,179,179,179,179,182,179,
+179,183,184,179,179,179,179,179,179,179,185,179,179,179,179,179,
+186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,186,
+187,188,189,190,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
/* block 9 */
-175,176,177,178,178,110,110,178,179,179,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-180,175,176,175,176,175,176,175,176,175,176,175,176,175,176,181,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
+187,188,191,192,192,110,110,192,193,193,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+194,187,188,187,188,187,188,187,188,187,188,187,188,187,188,195,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
/* block 10 */
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-115,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,182,115,115,183,184,184,184,184,184,184,
-115,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
-185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+115,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
+196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,
+196,196,196,196,196,196,196,115,115,197,198,198,198,198,198,198,
+115,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,199,199,199,
/* block 11 */
-185,185,185,185,185,185,185,186,115, 4,187,115,115,188,188,189,
-115,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
-190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
-190,190,190,190,190,190,190,190,190,190,190,190,190,190,191,190,
-192,190,190,192,190,190,192,190,115,115,115,115,115,115,115,115,
-193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,
-193,193,193,193,193,193,193,193,193,193,193,115,115,115,115,115,
-193,193,193,192,192,115,115,115,115,115,115,115,115,115,115,115,
+199,199,199,199,199,199,199,200,115, 4,201,115,115,202,202,203,
+115,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,205,204,
+206,204,204,206,204,204,206,204,115,115,115,115,115,115,115,115,
+207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
+207,207,207,207,207,207,207,207,207,207,207,115,115,115,115,115,
+207,207,207,206,206,115,115,115,115,115,115,115,115,115,115,115,
/* block 12 */
-194,194,194,194,194, 22,195,195,195,196,196,197, 4,196,198,198,
-199,199,199,199,199,199,199,199,199,199,199, 4, 22,115,196, 4,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-108,200,200,200,200,200,200,200,200,200,200,110,110,110,110,110,
-110,110,110,110,110,110,199,199,199,199,199,199,199,199,199,199,
-201,201,201,201,201,201,201,201,201,201,196,196,196,196,200,200,
-110,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
+208,208,208,208,208,209,210,210,210,211,211,212, 4,211,213,213,
+214,214,214,214,214,214,214,214,214,214,214, 4,215,115,211, 4,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+108,216,216,216,216,216,216,216,216,216,216,110,110,110,110,110,
+110,110,110,110,110,110,214,214,214,214,214,214,214,214,214,214,
+217,217,217,217,217,217,217,217,217,217,211,211,211,211,216,216,
+110,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
/* block 13 */
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,196,200,199,199,199,199,199,199,199, 22,198,199,
-199,199,199,199,199,202,202,199,199,198,199,199,199,199,200,200,
-201,201,201,201,201,201,201,201,201,201,200,200,200,198,198,200,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,211,216,214,214,214,214,214,214,214,209,213,214,
+214,214,214,214,214,218,218,214,214,213,214,214,214,214,216,216,
+217,217,217,217,217,217,217,217,217,217,216,216,216,213,213,216,
/* block 14 */
-203,203,203,203,203,203,203,203,203,203,203,203,203,203,115,204,
-205,206,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
-205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,
-206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
-206,206,206,206,206,206,206,206,206,206,206,115,115,205,205,205,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
+219,219,219,219,219,219,219,219,219,219,219,219,219,219,115,220,
+221,222,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
+221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,
+222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+222,222,222,222,222,222,222,222,222,222,222,115,115,221,221,221,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
/* block 15 */
-207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
-207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
-207,207,207,207,207,207,208,208,208,208,208,208,208,208,208,208,
-208,207,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-209,209,209,209,209,209,209,209,209,209,210,210,210,210,210,210,
-210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,
-210,210,210,210,210,210,210,210,210,210,210,211,211,211,211,211,
-211,211,211,211,212,212,213,214,214,214,212,115,115,115,115,115,
+223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
+223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
+223,223,223,223,223,223,224,224,224,224,224,224,224,224,224,224,
+224,223,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+225,225,225,225,225,225,225,225,225,225,226,226,226,226,226,226,
+226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
+226,226,226,226,226,226,226,226,226,226,226,227,227,227,227,227,
+227,227,227,227,228,228,229,230,230,230,228,115,115,115,115,115,
/* block 16 */
-215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
-215,215,215,215,215,215,216,216,216,216,217,216,216,216,216,216,
-216,216,216,216,217,216,216,216,217,216,216,216,216,216,115,115,
-218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,115,
-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,220,220,220,115,115,221,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,
+231,231,231,231,231,231,232,232,232,232,233,232,232,232,232,232,
+232,232,232,232,233,232,232,232,233,232,232,232,232,232,115,115,
+234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,115,
+235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
+235,235,235,235,235,235,235,235,235,236,236,236,115,115,237,115,
+221,221,221,221,221,221,221,221,221,221,221,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 17 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,115,115,115,115,115,115,115,115,115,115,115,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,115,216,216,216,216,216,216,216,216,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,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,199,
+115,115,115,115,214,214,214,214,214,214,214,214,214,214,214,214,
+214,214,209,214,214,214,214,214,214,214,214,214,214,214,214,214,
+214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
/* block 18 */
-222,222,222,223,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,222,223,222,224,223,223,
-223,222,222,222,222,222,222,222,222,223,223,223,223,222,223,223,
-224,110,110,222,222,222,222,222,224,224,224,224,224,224,224,224,
-224,224,222,222, 4, 4,225,225,225,225,225,225,225,225,225,225,
-226,227,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+238,238,238,239,240,240,240,240,240,240,240,240,240,240,240,240,
+240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
+240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
+240,240,240,240,240,240,240,240,240,240,238,239,238,240,239,239,
+239,238,238,238,238,238,238,238,238,239,239,239,239,238,239,239,
+240,110,110,238,238,238,238,238,240,240,240,240,240,240,240,240,
+240,240,238,238, 4, 4,241,241,241,241,241,241,241,241,241,241,
+242,243,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
/* block 19 */
-228,229,230,230,115,228,228,228,228,228,228,228,228,115,115,228,
-228,115,115,228,228,228,228,228,228,228,228,228,228,228,228,228,
-228,228,228,228,228,228,228,228,228,115,228,228,228,228,228,228,
-228,115,228,115,115,115,228,228,228,228,115,115,229,228,231,230,
-230,229,229,229,229,115,115,230,230,115,115,230,230,229,228,115,
-115,115,115,115,115,115,115,231,115,115,115,115,228,228,115,228,
-228,228,229,229,115,115,232,232,232,232,232,232,232,232,232,232,
-228,228,233,233,234,234,234,234,234,234,235,233,115,115,115,115,
+244,245,246,246,115,244,244,244,244,244,244,244,244,115,115,244,
+244,115,115,244,244,244,244,244,244,244,244,244,244,244,244,244,
+244,244,244,244,244,244,244,244,244,115,244,244,244,244,244,244,
+244,115,244,115,115,115,244,244,244,244,115,115,245,244,247,246,
+246,245,245,245,245,115,115,246,246,115,115,246,246,245,244,115,
+115,115,115,115,115,115,115,247,115,115,115,115,244,244,115,244,
+244,244,245,245,115,115,248,248,248,248,248,248,248,248,248,248,
+244,244,249,249,250,250,250,250,250,250,251,249,244,252,115,115,
/* block 20 */
-115,236,236,237,115,238,238,238,238,238,238,115,115,115,115,238,
-238,115,115,238,238,238,238,238,238,238,238,238,238,238,238,238,
-238,238,238,238,238,238,238,238,238,115,238,238,238,238,238,238,
-238,115,238,238,115,238,238,115,238,238,115,115,236,115,237,237,
-237,236,236,115,115,115,115,236,236,115,115,236,236,236,115,115,
-115,236,115,115,115,115,115,115,115,238,238,238,238,115,238,115,
-115,115,115,115,115,115,239,239,239,239,239,239,239,239,239,239,
-236,236,238,238,238,236,115,115,115,115,115,115,115,115,115,115,
+115,253,253,254,115,255,255,255,255,255,255,115,115,115,115,255,
+255,115,115,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,115,255,255,255,255,255,255,
+255,115,255,255,115,255,255,115,255,255,115,115,253,115,254,254,
+254,253,253,115,115,115,115,253,253,115,115,253,253,253,115,115,
+115,253,115,115,115,115,115,115,115,255,255,255,255,115,255,115,
+115,115,115,115,115,115,256,256,256,256,256,256,256,256,256,256,
+253,253,255,255,255,253,115,115,115,115,115,115,115,115,115,115,
/* block 21 */
-115,240,240,241,115,242,242,242,242,242,242,242,242,242,115,242,
-242,242,115,242,242,242,242,242,242,242,242,242,242,242,242,242,
-242,242,242,242,242,242,242,242,242,115,242,242,242,242,242,242,
-242,115,242,242,115,242,242,242,242,242,115,115,240,242,241,241,
-241,240,240,240,240,240,115,240,240,241,115,241,241,240,115,115,
-242,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-242,242,240,240,115,115,243,243,243,243,243,243,243,243,243,243,
-244,245,115,115,115,115,115,115,115,242,115,115,115,115,115,115,
+115,257,257,258,115,259,259,259,259,259,259,259,259,259,115,259,
+259,259,115,259,259,259,259,259,259,259,259,259,259,259,259,259,
+259,259,259,259,259,259,259,259,259,115,259,259,259,259,259,259,
+259,115,259,259,115,259,259,259,259,259,115,115,257,259,258,258,
+258,257,257,257,257,257,115,257,257,258,115,258,258,257,115,115,
+259,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+259,259,257,257,115,115,260,260,260,260,260,260,260,260,260,260,
+261,262,115,115,115,115,115,115,115,259,257,257,257,257,257,257,
/* block 22 */
-115,246,247,247,115,248,248,248,248,248,248,248,248,115,115,248,
-248,115,115,248,248,248,248,248,248,248,248,248,248,248,248,248,
-248,248,248,248,248,248,248,248,248,115,248,248,248,248,248,248,
-248,115,248,248,115,248,248,248,248,248,115,115,246,248,249,246,
-247,246,246,246,246,115,115,247,247,115,115,247,247,246,115,115,
-115,115,115,115,115,115,246,249,115,115,115,115,248,248,115,248,
-248,248,246,246,115,115,250,250,250,250,250,250,250,250,250,250,
-251,248,252,252,252,252,252,252,115,115,115,115,115,115,115,115,
+115,263,264,264,115,265,265,265,265,265,265,265,265,115,115,265,
+265,115,115,265,265,265,265,265,265,265,265,265,265,265,265,265,
+265,265,265,265,265,265,265,265,265,115,265,265,265,265,265,265,
+265,115,265,265,115,265,265,265,265,265,115,115,263,265,266,263,
+264,263,263,263,263,115,115,264,264,115,115,264,264,263,115,115,
+115,115,115,115,115,115,263,266,115,115,115,115,265,265,115,265,
+265,265,263,263,115,115,267,267,267,267,267,267,267,267,267,267,
+268,265,269,269,269,269,269,269,115,115,115,115,115,115,115,115,
/* block 23 */
-115,115,253,254,115,254,254,254,254,254,254,115,115,115,254,254,
-254,115,254,254,254,254,115,115,115,254,254,115,254,115,254,254,
-115,115,115,254,254,115,115,115,254,254,254,115,115,115,254,254,
-254,254,254,254,254,254,254,254,254,254,115,115,115,115,255,256,
-253,256,256,115,115,115,256,256,256,115,256,256,256,253,115,115,
-254,115,115,115,115,115,115,255,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,257,257,257,257,257,257,257,257,257,257,
-258,258,258,259,259,259,259,259,259,260,259,115,115,115,115,115,
+115,115,270,271,115,271,271,271,271,271,271,115,115,115,271,271,
+271,115,271,271,271,271,115,115,115,271,271,115,271,115,271,271,
+115,115,115,271,271,115,115,115,271,271,271,115,115,115,271,271,
+271,271,271,271,271,271,271,271,271,271,115,115,115,115,272,273,
+270,273,273,115,115,115,273,273,273,115,273,273,273,270,115,115,
+271,115,115,115,115,115,115,272,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,274,274,274,274,274,274,274,274,274,274,
+275,275,275,276,276,276,276,276,276,277,276,115,115,115,115,115,
/* block 24 */
-261,262,262,262,115,263,263,263,263,263,263,263,263,115,263,263,
-263,115,263,263,263,263,263,263,263,263,263,263,263,263,263,263,
-263,263,263,263,263,263,263,263,263,115,263,263,263,263,263,263,
-263,263,263,263,263,263,263,263,263,263,115,115,115,263,261,261,
-261,262,262,262,262,115,261,261,261,115,261,261,261,261,115,115,
-115,115,115,115,115,261,261,115,263,263,263,115,115,115,115,115,
-263,263,261,261,115,115,264,264,264,264,264,264,264,264,264,264,
-115,115,115,115,115,115,115,115,265,265,265,265,265,265,265,266,
+278,279,279,279,115,280,280,280,280,280,280,280,280,115,280,280,
+280,115,280,280,280,280,280,280,280,280,280,280,280,280,280,280,
+280,280,280,280,280,280,280,280,280,115,280,280,280,280,280,280,
+280,280,280,280,280,280,280,280,280,280,115,115,115,280,278,278,
+278,279,279,279,279,115,278,278,278,115,278,278,278,278,115,115,
+115,115,115,115,115,278,278,115,280,280,280,115,115,115,115,115,
+280,280,278,278,115,115,281,281,281,281,281,281,281,281,281,281,
+115,115,115,115,115,115,115,115,282,282,282,282,282,282,282,283,
/* block 25 */
-115,267,268,268,115,269,269,269,269,269,269,269,269,115,269,269,
-269,115,269,269,269,269,269,269,269,269,269,269,269,269,269,269,
-269,269,269,269,269,269,269,269,269,115,269,269,269,269,269,269,
-269,269,269,269,115,269,269,269,269,269,115,115,267,269,268,267,
-268,268,270,268,268,115,267,268,268,115,268,268,267,267,115,115,
-115,115,115,115,115,270,270,115,115,115,115,115,115,115,269,115,
-269,269,267,267,115,115,271,271,271,271,271,271,271,271,271,271,
-115,269,269,115,115,115,115,115,115,115,115,115,115,115,115,115,
+284,285,286,286,115,284,284,284,284,284,284,284,284,115,284,284,
+284,115,284,284,284,284,284,284,284,284,284,284,284,284,284,284,
+284,284,284,284,284,284,284,284,284,115,284,284,284,284,284,284,
+284,284,284,284,115,284,284,284,284,284,115,115,285,284,286,285,
+286,286,287,286,286,115,285,286,286,115,286,286,285,285,115,115,
+115,115,115,115,115,287,287,115,115,115,115,115,115,115,284,115,
+284,284,285,285,115,115,288,288,288,288,288,288,288,288,288,288,
+115,284,284,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 26 */
-115,272,273,273,115,274,274,274,274,274,274,274,274,115,274,274,
-274,115,274,274,274,274,274,274,274,274,274,274,274,274,274,274,
-274,274,274,274,274,274,274,274,274,274,274,274,274,274,274,274,
-274,274,274,274,274,274,274,274,274,274,274,115,115,274,275,273,
-273,272,272,272,272,115,273,273,273,115,273,273,273,272,274,115,
-115,115,115,115,115,115,115,275,115,115,115,115,115,115,115,274,
-274,274,272,272,115,115,276,276,276,276,276,276,276,276,276,276,
-277,277,277,277,277,277,115,115,115,278,274,274,274,274,274,274,
+289,289,290,290,115,291,291,291,291,291,291,291,291,115,291,291,
+291,115,291,291,291,291,291,291,291,291,291,291,291,291,291,291,
+291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,
+291,291,291,291,291,291,291,291,291,291,291,289,289,291,292,290,
+290,289,289,289,289,115,290,290,290,115,290,290,290,289,293,294,
+115,115,115,115,291,291,291,292,295,295,295,295,295,295,295,291,
+291,291,289,289,115,115,296,296,296,296,296,296,296,296,296,296,
+295,295,295,295,295,295,295,295,295,294,291,291,291,291,291,291,
/* block 27 */
-115,115,279,279,115,280,280,280,280,280,280,280,280,280,280,280,
-280,280,280,280,280,280,280,115,115,115,280,280,280,280,280,280,
-280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,280,
-280,280,115,280,280,280,280,280,280,280,280,280,115,280,115,115,
-280,280,280,280,280,280,280,115,115,115,281,115,115,115,115,282,
-279,279,281,281,281,115,281,115,279,279,279,279,279,279,279,282,
-115,115,115,115,115,115,283,283,283,283,283,283,283,283,283,283,
-115,115,279,279,284,115,115,115,115,115,115,115,115,115,115,115,
+115,115,297,297,115,298,298,298,298,298,298,298,298,298,298,298,
+298,298,298,298,298,298,298,115,115,115,298,298,298,298,298,298,
+298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,
+298,298,115,298,298,298,298,298,298,298,298,298,115,298,115,115,
+298,298,298,298,298,298,298,115,115,115,299,115,115,115,115,300,
+297,297,299,299,299,115,299,115,297,297,297,297,297,297,297,300,
+115,115,115,115,115,115,301,301,301,301,301,301,301,301,301,301,
+115,115,297,297,302,115,115,115,115,115,115,115,115,115,115,115,
/* block 28 */
-115,285,285,285,285,285,285,285,285,285,285,285,285,285,285,285,
-285,285,285,285,285,285,285,285,285,285,285,285,285,285,285,285,
-285,285,285,285,285,285,285,285,285,285,285,285,285,285,285,285,
-285,286,285,287,286,286,286,286,286,286,286,115,115,115,115, 5,
-285,285,285,285,285,285,288,286,286,286,286,286,286,286,286,289,
-290,290,290,290,290,290,290,290,290,290,289,289,115,115,115,115,
+115,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,
+303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,
+303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,
+303,304,303,305,304,304,304,304,304,304,304,115,115,115,115, 5,
+303,303,303,303,303,303,306,304,304,304,304,304,304,304,304,307,
+308,308,308,308,308,308,308,308,308,308,307,307,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 29 */
-115,291,291,115,291,115,115,291,291,115,291,115,115,291,115,115,
-115,115,115,115,291,291,291,291,115,291,291,291,291,291,291,291,
-115,291,291,291,115,291,115,291,115,115,291,291,115,291,291,291,
-291,292,291,293,292,292,292,292,292,292,115,292,292,291,115,115,
-291,291,291,291,291,115,294,115,292,292,292,292,292,292,115,115,
-295,295,295,295,295,295,295,295,295,295,115,115,291,291,291,291,
+115,309,309,115,309,115,115,309,309,115,309,115,115,309,115,115,
+115,115,115,115,309,309,309,309,115,309,309,309,309,309,309,309,
+115,309,309,309,115,309,115,309,115,115,309,309,115,309,309,309,
+309,310,309,311,310,310,310,310,310,310,115,310,310,309,115,115,
+309,309,309,309,309,115,312,115,310,310,310,310,310,310,115,115,
+313,313,313,313,313,313,313,313,313,313,115,115,309,309,309,309,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 30 */
-296,297,297,297,298,298,298,298,298,298,298,298,298,298,298,298,
-298,298,298,297,298,297,297,297,299,299,297,297,297,297,297,297,
-300,300,300,300,300,300,300,300,300,300,301,301,301,301,301,301,
-301,301,301,301,297,299,297,299,297,299,302,303,302,303,304,304,
-296,296,296,296,296,296,296,296,115,296,296,296,296,296,296,296,
-296,296,296,296,296,296,296,296,296,296,296,296,296,296,296,296,
-296,296,296,296,296,296,296,296,296,296,296,296,296,115,115,115,
-115,299,299,299,299,299,299,299,299,299,299,299,299,299,299,304,
+314,315,315,315,316,316,316,316,316,316,316,316,316,316,316,316,
+316,316,316,315,316,315,315,315,317,317,315,315,315,315,315,315,
+318,318,318,318,318,318,318,318,318,318,319,319,319,319,319,319,
+319,319,319,319,315,317,315,317,315,317,320,321,320,321,322,322,
+314,314,314,314,314,314,314,314,115,314,314,314,314,314,314,314,
+314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,
+314,314,314,314,314,314,314,314,314,314,314,314,314,115,115,115,
+115,317,317,317,317,317,317,317,317,317,317,317,317,317,317,322,
/* block 31 */
-299,299,299,299,299,298,299,299,296,296,296,296,296,299,299,299,
-299,299,299,299,299,299,299,299,115,299,299,299,299,299,299,299,
-299,299,299,299,299,299,299,299,299,299,299,299,299,299,299,299,
-299,299,299,299,299,299,299,299,299,299,299,299,299,115,297,297,
-297,297,297,297,297,297,299,297,297,297,297,297,297,115,297,297,
-298,298,298,298,298, 19, 19, 19, 19,298,298,115,115,115,115,115,
+317,317,317,317,317,316,317,317,314,314,314,314,314,317,317,317,
+317,317,317,317,317,317,317,317,115,317,317,317,317,317,317,317,
+317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
+317,317,317,317,317,317,317,317,317,317,317,317,317,115,315,315,
+315,315,315,315,315,315,317,315,315,315,315,315,315,115,315,315,
+316,316,316,316,316, 19, 19, 19, 19,316,316,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 32 */
-305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,
-305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,
-305,305,305,305,305,305,305,305,305,305,305,306,306,307,307,307,
-307,308,307,307,307,307,307,307,306,307,307,308,308,307,307,305,
-309,309,309,309,309,309,309,309,309,309,310,310,310,310,310,310,
-305,305,305,305,305,305,308,308,307,307,305,305,305,305,307,307,
-307,305,306,306,306,305,305,306,306,306,306,306,306,306,305,305,
-305,307,307,307,307,305,305,305,305,305,305,305,305,305,305,305,
+323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
+323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
+323,323,323,323,323,323,323,323,323,323,323,324,324,325,325,325,
+325,326,325,325,325,325,325,325,324,325,325,326,326,325,325,323,
+327,327,327,327,327,327,327,327,327,327,328,328,328,328,328,328,
+323,323,323,323,323,323,326,326,325,325,323,323,323,323,325,325,
+325,323,324,324,324,323,323,324,324,324,324,324,324,324,323,323,
+323,325,325,325,325,323,323,323,323,323,323,323,323,323,323,323,
/* block 33 */
-305,305,307,306,308,307,307,306,306,306,306,306,306,307,305,306,
-309,309,309,309,309,309,309,309,309,309,306,306,306,307,311,311,
-312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,
-312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,
-312,312,312,312,312,312,115,312,115,115,115,115,115,312,115,115,
-313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,
-313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,
-313,313,313,313,313,313,313,313,313,313,313, 4,314,313,313,313,
+323,323,325,324,326,325,325,324,324,324,324,324,324,325,323,324,
+327,327,327,327,327,327,327,327,327,327,324,324,324,325,329,329,
+330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
+330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
+330,330,330,330,330,330,115,330,115,115,115,115,115,330,115,115,
+331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,
+331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,
+331,331,331,331,331,331,331,331,331,331,331, 4,332,331,331,331,
/* block 34 */
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
-316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
+334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
/* block 35 */
-316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
-316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
-316,316,316,316,316,316,316,316,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
+334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
+334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
+334,334,334,334,334,334,334,334,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
/* block 36 */
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,115,318,318,318,318,115,115,
-318,318,318,318,318,318,318,115,318,115,318,318,318,318,115,115,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,115,336,336,336,336,115,115,
+336,336,336,336,336,336,336,115,336,115,336,336,336,336,115,115,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
/* block 37 */
-318,318,318,318,318,318,318,318,318,115,318,318,318,318,115,115,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,115,318,318,318,318,115,115,318,318,318,318,318,318,318,115,
-318,115,318,318,318,318,115,115,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,115,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
+336,336,336,336,336,336,336,336,336,115,336,336,336,336,115,115,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,115,336,336,336,336,115,115,336,336,336,336,336,336,336,115,
+336,115,336,336,336,336,115,115,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,115,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
/* block 38 */
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,115,318,318,318,318,115,115,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,115,115,319,319,319,
-320,320,320,320,320,320,320,320,320,321,321,321,321,321,321,321,
-321,321,321,321,321,321,321,321,321,321,321,321,321,115,115,115,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,115,336,336,336,336,115,115,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,115,115,337,337,337,
+338,338,338,338,338,338,338,338,338,339,339,339,339,339,339,339,
+339,339,339,339,339,339,339,339,339,339,339,339,339,115,115,115,
/* block 39 */
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-322,322,322,322,322,322,322,322,322,322,115,115,115,115,115,115,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-324,324,324,324,324,324,115,115,325,325,325,325,325,325,115,115,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+340,340,340,340,340,340,340,340,340,340,115,115,115,115,115,115,
+341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,
+341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,
+341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,
+341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,
+341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,
+342,342,342,342,342,342,115,115,343,343,343,343,343,343,115,115,
/* block 40 */
-326,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
+344,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
/* block 41 */
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
/* block 42 */
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,328,328,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,346,346,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
/* block 43 */
-329,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,
-330,330,330,330,330,330,330,330,330,330,330,331,332,115,115,115,
-333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
-333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
-333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
-333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
-333,333,333,333,333,333,333,333,333,333,333, 4, 4, 4,334,334,
-334,333,333,333,333,333,333,333,333,115,115,115,115,115,115,115,
+347,348,348,348,348,348,348,348,348,348,348,348,348,348,348,348,
+348,348,348,348,348,348,348,348,348,348,348,349,350,115,115,115,
+351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
+351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
+351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
+351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
+351,351,351,351,351,351,351,351,351,351,351, 4, 4, 4,352,352,
+352,351,351,351,351,351,351,351,351,115,115,115,115,115,115,115,
/* block 44 */
-335,335,335,335,335,335,335,335,335,335,335,335,335,115,335,335,
-335,335,336,336,336,115,115,115,115,115,115,115,115,115,115,115,
-337,337,337,337,337,337,337,337,337,337,337,337,337,337,337,337,
-337,337,338,338,338, 4, 4,115,115,115,115,115,115,115,115,115,
-339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,
-339,339,340,340,115,115,115,115,115,115,115,115,115,115,115,115,
-341,341,341,341,341,341,341,341,341,341,341,341,341,115,341,341,
-341,115,342,342,115,115,115,115,115,115,115,115,115,115,115,115,
+353,353,353,353,353,353,353,353,353,353,353,353,353,115,353,353,
+353,353,354,354,354,115,115,115,115,115,115,115,115,115,115,115,
+355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
+355,355,356,356,356, 4, 4,115,115,115,115,115,115,115,115,115,
+357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
+357,357,358,358,115,115,115,115,115,115,115,115,115,115,115,115,
+359,359,359,359,359,359,359,359,359,359,359,359,359,115,359,359,
+359,115,360,360,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 45 */
-343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
-343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
-343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
-343,343,343,343,344,344,345,344,344,344,344,344,344,344,345,345,
-345,345,345,345,345,345,344,345,345,344,344,344,344,344,344,344,
-344,344,344,344,346,346,346,347,346,346,346,348,343,344,115,115,
-349,349,349,349,349,349,349,349,349,349,115,115,115,115,115,115,
-350,350,350,350,350,350,350,350,350,350,115,115,115,115,115,115,
+361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,
+361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,
+361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,
+361,361,361,361,362,362,363,362,362,362,362,362,362,362,363,363,
+363,363,363,363,363,363,362,363,363,362,362,362,362,362,362,362,
+362,362,362,362,364,364,364,365,364,364,364,366,361,362,115,115,
+367,367,367,367,367,367,367,367,367,367,115,115,115,115,115,115,
+368,368,368,368,368,368,368,368,368,368,115,115,115,115,115,115,
/* block 46 */
-351,351, 4, 4,351, 4,352,351,351,351,351,353,353,353,354,115,
-355,355,355,355,355,355,355,355,355,355,115,115,115,115,115,115,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,357,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,115,115,115,115,115,115,115,115,
+369,369, 4, 4,369, 4,370,369,369,369,369,371,371,371,372,115,
+373,373,373,373,373,373,373,373,373,373,115,115,115,115,115,115,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,375,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,115,115,115,115,115,115,115,115,
/* block 47 */
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,353,356,115,115,115,115,115,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,
-327,327,327,327,327,327,115,115,115,115,115,115,115,115,115,115,
+374,374,374,374,374,371,371,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
+374,374,374,374,374,374,374,374,374,371,374,115,115,115,115,115,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,115,115,115,115,115,115,115,115,115,115,
/* block 48 */
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,115,
-359,359,359,360,360,360,360,359,359,360,360,360,115,115,115,115,
-360,360,359,360,360,360,360,360,360,359,359,359,115,115,115,115,
-361,115,115,115,362,362,363,363,363,363,363,363,363,363,363,363,
-364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,
-364,364,364,364,364,364,364,364,364,364,364,364,364,364,115,115,
-364,364,364,364,364,115,115,115,115,115,115,115,115,115,115,115,
+376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,
+376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,115,
+377,377,377,378,378,378,378,377,377,378,378,378,115,115,115,115,
+378,378,377,378,378,378,378,378,378,377,377,377,115,115,115,115,
+379,115,115,115,380,380,381,381,381,381,381,381,381,381,381,381,
+382,382,382,382,382,382,382,382,382,382,382,382,382,382,382,382,
+382,382,382,382,382,382,382,382,382,382,382,382,382,382,115,115,
+382,382,382,382,382,115,115,115,115,115,115,115,115,115,115,115,
/* block 49 */
-365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
-365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
-365,365,365,365,365,365,365,365,365,365,365,365,115,115,115,115,
-365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
-365,365,365,365,365,365,365,365,365,365,115,115,115,115,115,115,
-366,366,366,366,366,366,366,366,366,366,367,115,115,115,368,368,
-369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
-369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,383,383,115,115,115,115,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,383,383,383,383,383,383,383,383,115,115,115,115,115,115,
+384,384,384,384,384,384,384,384,384,384,385,115,115,115,386,386,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
/* block 50 */
-370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,
-370,370,370,370,370,370,370,371,371,372,372,371,115,115,373,373,
-374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
-374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
-374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,374,
-374,374,374,374,374,375,376,375,376,376,376,376,376,376,376,115,
-376,377,376,377,377,376,376,376,376,376,376,376,376,375,375,375,
-375,375,375,376,376,376,376,376,376,376,376,376,376,115,115,376,
+388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,388,
+388,388,388,388,388,388,388,389,389,390,390,389,115,115,391,391,
+392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,
+392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,
+392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,
+392,392,392,392,392,393,394,393,394,394,394,394,394,394,394,115,
+394,395,394,395,395,394,394,394,394,394,394,394,394,393,393,393,
+393,393,393,394,394,394,394,394,394,394,394,394,394,115,115,394,
/* block 51 */
-378,378,378,378,378,378,378,378,378,378,115,115,115,115,115,115,
-378,378,378,378,378,378,378,378,378,378,115,115,115,115,115,115,
-379,379,379,379,379,379,379,380,379,379,379,379,379,379,115,115,
-110,110,110,110,110,110,110,110,110,110,110,110,110,110,381,115,
+396,396,396,396,396,396,396,396,396,396,115,115,115,115,115,115,
+396,396,396,396,396,396,396,396,396,396,115,115,115,115,115,115,
+397,397,397,397,397,397,397,398,397,397,397,397,397,397,115,115,
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,399,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 52 */
-382,382,382,382,383,384,384,384,384,384,384,384,384,384,384,384,
-384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
-384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
-384,384,384,384,382,383,382,382,382,382,382,383,382,383,383,383,
-383,383,382,383,383,384,384,384,384,384,384,384,115,115,115,115,
-385,385,385,385,385,385,385,385,385,385,386,386,386,386,386,386,
-386,387,387,387,387,387,387,387,387,387,387,382,382,382,382,382,
-382,382,382,382,387,387,387,387,387,387,387,387,387,115,115,115,
+400,400,400,400,401,402,402,402,402,402,402,402,402,402,402,402,
+402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,
+402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,
+402,402,402,402,400,401,400,400,400,400,400,401,400,401,401,401,
+401,401,400,401,401,402,402,402,402,402,402,402,115,115,115,115,
+403,403,403,403,403,403,403,403,403,403,404,404,404,404,404,404,
+404,405,405,405,405,405,405,405,405,405,405,400,400,400,400,400,
+400,400,400,400,405,405,405,405,405,405,405,405,405,115,115,115,
/* block 53 */
-388,388,389,390,390,390,390,390,390,390,390,390,390,390,390,390,
-390,390,390,390,390,390,390,390,390,390,390,390,390,390,390,390,
-390,389,388,388,388,388,389,389,388,388,389,388,388,388,390,390,
-391,391,391,391,391,391,391,391,391,391,390,390,390,390,390,390,
-392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,
-392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,
-392,392,392,392,392,392,393,394,393,393,394,394,394,393,394,393,
-393,393,394,394,115,115,115,115,115,115,115,115,395,395,395,395,
+406,406,407,408,408,408,408,408,408,408,408,408,408,408,408,408,
+408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,408,
+408,407,406,406,406,406,407,407,406,406,407,406,406,406,408,408,
+409,409,409,409,409,409,409,409,409,409,408,408,408,408,408,408,
+410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
+410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
+410,410,410,410,410,410,411,412,411,411,412,412,412,411,412,411,
+411,411,412,412,115,115,115,115,115,115,115,115,413,413,413,413,
/* block 54 */
-396,396,396,396,396,396,396,396,396,396,396,396,396,396,396,396,
-396,396,396,396,396,396,396,396,396,396,396,396,396,396,396,396,
-396,396,396,396,397,397,397,397,397,397,397,397,398,398,398,398,
-398,398,398,398,397,397,398,398,115,115,115,399,399,399,399,399,
-400,400,400,400,400,400,400,400,400,400,115,115,115,396,396,396,
-401,401,401,401,401,401,401,401,401,401,402,402,402,402,402,402,
-402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,402,
-402,402,402,402,402,402,402,402,403,403,403,403,403,403,404,404,
+414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,
+414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,
+414,414,414,414,415,415,415,415,415,415,415,415,416,416,416,416,
+416,416,416,416,415,415,416,416,115,115,115,417,417,417,417,417,
+418,418,418,418,418,418,418,418,418,418,115,115,115,414,414,414,
+419,419,419,419,419,419,419,419,419,419,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,420,
+420,420,420,420,420,420,420,420,421,421,421,421,421,421,422,422,
/* block 55 */
+423,424,425,426,427,428,429,430,431,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-405,405,405,405,405,405,405,405,115,115,115,115,115,115,115,115,
+432,432,432,432,432,432,432,432,115,115,115,115,115,115,115,115,
110,110,110, 4,110,110,110,110,110,110,110,110,110,110,110,110,
-110,406,110,110,110,110,110,110,110,407,407,407,407,110,407,407,
-407,407,406,406,110,407,407,115,110,110,115,115,115,115,115,115,
+110,433,110,110,110,110,110,110,110,434,434,434,434,110,434,434,
+434,434,433,433,110,434,434,433,110,110,115,115,115,115,115,115,
/* block 56 */
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33,123,123,123,123,123,408,107,107,107,107,
+ 33, 33, 33, 33, 33, 33,123,123,123,123,123,435,107,107,107,107,
107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
107,107,107,107,107,107,107,107,107,107,107,107,107,116,116,116,
116,116,107,107,107,107,116,116,116,116,116, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33,409,410, 33, 33, 33,411, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33,436,437, 33, 33, 33,438, 33, 33,
/* block 57 */
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
@@ -1955,7 +2054,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
-110,110,110,110,110,110,115,115,115,115,115,115,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,115,110,110,110,110,110,
/* block 58 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
@@ -1964,12 +2063,12 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
-412,413, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
+439,440, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
/* block 59 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
- 30, 31, 30, 31, 30, 31, 33, 33, 33, 33, 33,414, 33, 33,415, 33,
+ 30, 31, 30, 31, 30, 31, 33, 33, 33, 33, 33,441, 33, 33,442, 33,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
@@ -1978,57 +2077,57 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
/* block 60 */
-416,416,416,416,416,416,416,416,417,417,417,417,417,417,417,417,
-416,416,416,416,416,416,115,115,417,417,417,417,417,417,115,115,
-416,416,416,416,416,416,416,416,417,417,417,417,417,417,417,417,
-416,416,416,416,416,416,416,416,417,417,417,417,417,417,417,417,
-416,416,416,416,416,416,115,115,417,417,417,417,417,417,115,115,
-123,416,123,416,123,416,123,416,115,417,115,417,115,417,115,417,
-416,416,416,416,416,416,416,416,417,417,417,417,417,417,417,417,
-418,418,419,419,419,419,420,420,421,421,422,422,423,423,115,115,
+443,443,443,443,443,443,443,443,444,444,444,444,444,444,444,444,
+443,443,443,443,443,443,115,115,444,444,444,444,444,444,115,115,
+443,443,443,443,443,443,443,443,444,444,444,444,444,444,444,444,
+443,443,443,443,443,443,443,443,444,444,444,444,444,444,444,444,
+443,443,443,443,443,443,115,115,444,444,444,444,444,444,115,115,
+123,443,123,443,123,443,123,443,115,444,115,444,115,444,115,444,
+443,443,443,443,443,443,443,443,444,444,444,444,444,444,444,444,
+445,445,446,446,446,446,447,447,448,448,449,449,450,450,115,115,
/* block 61 */
-416,416,416,416,416,416,416,416,424,424,424,424,424,424,424,424,
-416,416,416,416,416,416,416,416,424,424,424,424,424,424,424,424,
-416,416,416,416,416,416,416,416,424,424,424,424,424,424,424,424,
-416,416,123,425,123,115,123,123,417,417,426,426,427,114,428,114,
-114,114,123,425,123,115,123,123,429,429,429,429,427,114,114,114,
-416,416,123,123,115,115,123,123,417,417,430,430,115,114,114,114,
-416,416,123,123,123,164,123,123,417,417,431,431,169,114,114,114,
-115,115,123,425,123,115,123,123,432,432,433,433,427,114,114,115,
+443,443,443,443,443,443,443,443,451,451,451,451,451,451,451,451,
+443,443,443,443,443,443,443,443,451,451,451,451,451,451,451,451,
+443,443,443,443,443,443,443,443,451,451,451,451,451,451,451,451,
+443,443,123,452,123,115,123,123,444,444,453,453,454,114,455,114,
+114,114,123,452,123,115,123,123,456,456,456,456,454,114,114,114,
+443,443,123,123,115,115,123,123,444,444,457,457,115,114,114,114,
+443,443,123,123,123,164,123,123,444,444,458,458,169,114,114,114,
+115,115,123,452,123,115,123,123,459,459,460,460,454,114,114,115,
/* block 62 */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 22,434,434, 22, 22,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 22,461,462, 22, 22,
9, 9, 9, 9, 9, 9, 4, 4, 21, 25, 6, 21, 21, 25, 6, 21,
- 4, 4, 4, 4, 4, 4, 4, 4,435,436, 22, 22, 22, 22, 22, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4,463,464, 22, 22, 22, 22, 22, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 21, 25, 4, 4, 4, 4, 15,
15, 4, 4, 4, 8, 6, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 8, 4, 15, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
- 22, 22, 22, 22, 22,437, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22,465, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
23,107,115,115, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,107,
/* block 63 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,115,
107,107,107,107,107,107,107,107,107,107,107,107,107,115,115,115,
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,115,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-110,110,110,110,110,110,110,110,110,110,110,110,110,381,381,381,
-381,110,381,381,381,110,110,110,110,110,110,110,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,110,110,110,399,399,399,
+399,110,399,399,399,110,110,110,110,110,110,110,110,110,110,110,
110,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 64 */
- 19, 19,438, 19, 19, 19, 19,438, 19, 19,439,438,438,438,439,439,
-438,438,438,439, 19,438, 19, 19, 8,438,438,438,438,438, 19, 19,
- 19, 19, 19, 19,438, 19,440, 19,438, 19,441,442,438,438, 19,439,
-438,438,443,438,439,407,407,407,407,439, 19, 19,439,439,438,438,
- 8, 8, 8, 8, 8,438,439,439,439,439, 19, 8, 19, 19,444, 19,
+ 19, 19,466, 19, 19, 19, 19,466, 19, 19,467,466,466,466,467,467,
+466,466,466,467, 19,466, 19, 19, 8,466,466,466,466,466, 19, 19,
+ 19, 19, 19, 19,466, 19,468, 19,466, 19,469,470,466,466, 19,467,
+466,466,471,466,467,434,434,434,434,467, 19, 19,467,467,466,466,
+ 8, 8, 8, 8, 8,466,467,467,467,467, 19, 8, 19, 19,472, 19,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,
-446,446,446,446,446,446,446,446,446,446,446,446,446,446,446,446,
+473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
+474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,
/* block 65 */
-447,447,447, 30, 31,447,447,447,447, 23, 19, 19,115,115,115,115,
+475,475,475, 30, 31,475,475,475,475, 23, 19, 19,115,115,115,115,
8, 8, 8, 8, 8, 19, 19, 19, 19, 19, 8, 8, 19, 19, 19, 19,
8, 19, 19, 8, 19, 19, 8, 19, 19, 19, 19, 19, 19, 19, 8, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -2065,7 +2164,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8,
8, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 69 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -2081,10 +2180,10 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19,448,448,448,448,448,448,448,448,448,448,
-448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,
-449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,
-449,449,449,449,449,449,449,449,449,449, 23, 23, 23, 23, 23, 23,
+ 19, 19, 19, 19, 19, 19,476,476,476,476,476,476,476,476,476,476,
+476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,
+477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,
+477,477,477,477,477,477,477,477,477,477, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
/* block 71 */
@@ -2109,25 +2208,35 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
/* block 73 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,478, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+479, 19,479, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
/* block 74 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19,479,479, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7,
- 6, 7, 6, 7, 6, 7, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19,478, 19, 19, 19, 19, 19, 19,
/* block 75 */
+ 19, 19, 19, 19, 19, 19, 19, 19,479, 19,478,478,478,478, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19,479, 19, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7,
+ 6, 7, 6, 7, 6, 7, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+
+/* block 76 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -2137,17 +2246,17 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
8, 8, 8, 8, 8, 8, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-/* block 76 */
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,
-
/* block 77 */
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,
+
+/* block 78 */
8, 8, 8, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,
7, 6, 7, 6, 7, 6, 7, 6, 7, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -2157,7 +2266,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
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, 6, 7, 8, 8,
-/* block 78 */
+/* block 79 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -2167,257 +2276,257 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,115,115, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 79 */
+/* block 80 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,115,115, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19,115, 19, 19, 19, 19, 19, 19,
- 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115, 19, 19, 19, 19,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 80 */
-451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,
-451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,
-451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,115,
-452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
-452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,
-452,452,452,452,452,452,452,452,452,452,452,452,452,452,452,115,
- 30, 31,453,454,455,456,457, 30, 31, 30, 31, 30, 31,458,459,460,
-461, 33, 30, 31, 33, 30, 31, 33, 33, 33, 33, 33,107,107,462,462,
-
/* block 81 */
+481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
+481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
+481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,115,
+482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
+482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
+482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,115,
+ 30, 31,483,484,485,486,487, 30, 31, 30, 31, 30, 31,488,489,490,
+491, 33, 30, 31, 33, 30, 31, 33, 33, 33, 33, 33,107,107,492,492,
+
+/* block 82 */
160,161,160,161,160,161,160,161,160,161,160,161,160,161,160,161,
160,161,160,161,160,161,160,161,160,161,160,161,160,161,160,161,
160,161,160,161,160,161,160,161,160,161,160,161,160,161,160,161,
160,161,160,161,160,161,160,161,160,161,160,161,160,161,160,161,
160,161,160,161,160,161,160,161,160,161,160,161,160,161,160,161,
160,161,160,161,160,161,160,161,160,161,160,161,160,161,160,161,
-160,161,160,161,463,464,464,464,464,464,464,160,161,160,161,465,
-465,465,160,161,115,115,115,115,115,466,466,466,466,467,466,466,
-
-/* block 82 */
-468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,
-468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,
-468,468,468,468,468,468,115,468,115,115,115,115,115,468,115,115,
-469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,
-469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,
-469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,
-469,469,469,469,469,469,469,469,115,115,115,115,115,115,115,470,
-471,115,115,115,115,115,115,115,115,115,115,115,115,115,115,472,
+160,161,160,161,493,494,494,494,494,494,494,160,161,160,161,495,
+495,495,160,161,115,115,115,115,115,496,496,496,496,497,496,496,
/* block 83 */
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,115,115,115,115,115,115,115,115,115,
-318,318,318,318,318,318,318,115,318,318,318,318,318,318,318,115,
-318,318,318,318,318,318,318,115,318,318,318,318,318,318,318,115,
-318,318,318,318,318,318,318,115,318,318,318,318,318,318,318,115,
-318,318,318,318,318,318,318,115,318,318,318,318,318,318,318,115,
-178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
-178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,178,
+498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
+498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
+498,498,498,498,498,498,115,498,115,115,115,115,115,498,115,115,
+499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,
+499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,
+499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,
+499,499,499,499,499,499,499,499,115,115,115,115,115,115,115,500,
+501,115,115,115,115,115,115,115,115,115,115,115,115,115,115,502,
/* block 84 */
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,115,115,115,115,115,115,115,115,115,
+336,336,336,336,336,336,336,115,336,336,336,336,336,336,336,115,
+336,336,336,336,336,336,336,115,336,336,336,336,336,336,336,115,
+336,336,336,336,336,336,336,115,336,336,336,336,336,336,336,115,
+336,336,336,336,336,336,336,115,336,336,336,336,336,336,336,115,
+192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
+
+/* block 85 */
4, 4, 21, 25, 21, 25, 4, 4, 4, 21, 25, 4, 21, 25, 4, 4,
4, 4, 4, 4, 4, 4, 4, 9, 4, 4, 9, 4, 21, 25, 4, 4,
21, 25, 6, 7, 6, 7, 6, 7, 6, 7, 4, 4, 4, 4, 4,108,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 9, 4, 4, 4, 4,
- 9, 4, 6,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 9, 4, 6, 4, 4, 4, 4, 4, 4, 4,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 85 */
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,115,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,115,115,115,115,115,115,115,115,115,115,115,115,
-
/* block 86 */
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,115,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 87 */
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,
-473,473,473,473,473,473,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
/* block 88 */
- 3, 4, 4, 4, 19,474,407,475, 6, 7, 6, 7, 6, 7, 6, 7,
- 6, 7, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7, 9, 6, 7, 7,
- 19,475,475,475,475,475,475,475,475,475,110,110,110,110,476,476,
- 9,108,108,108,108,108, 19, 19,475,475,475,474,407, 4, 19, 19,
-115,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,
-477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,
-477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,
-477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,503,
+503,503,503,503,503,503,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
/* block 89 */
-477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,
-477,477,477,477,477,477,477,115,115,110,110, 14, 14,478,478,477,
- 9,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
-479,479,479,479,479,479,479,479,479,479,479, 4,108,480,480,479,
+ 3, 4, 4, 4, 19,504,434,505, 6, 7, 6, 7, 6, 7, 6, 7,
+ 6, 7, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7, 9, 6, 7, 7,
+ 19,505,505,505,505,505,505,505,505,505,110,110,110,110,506,506,
+ 9,108,108,108,108,108, 19, 19,505,505,505,504,434, 4, 19, 19,
+115,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
/* block 90 */
-115,115,115,115,115,481,481,481,481,481,481,481,481,481,481,481,
-481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
-481,481,481,481,481,481,481,481,481,481,481,481,481,481,115,115,
-115,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,115,115,110,110, 14, 14,508,508,507,
+ 9,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
+509,509,509,509,509,509,509,509,509,509,509, 4,108,510,510,509,
/* block 91 */
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,115,
+115,115,115,115,115,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,115,
+115,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
+
+/* block 92 */
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,115,
19, 19, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,
-481,481,481,481,481,481,481,481,481,481,481,115,115,115,115,115,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
-/* block 92 */
-483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
-483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,115,
+/* block 93 */
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,115,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23,
19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,
-483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, 19,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, 19,
-/* block 93 */
+/* block 94 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,115,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,115,
-/* block 94 */
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,
-484,484,484,484,484,484,484,484, 19, 19, 19, 19, 19, 19, 19, 19,
+/* block 95 */
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 95 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-
/* block 96 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,115,115,115,115,115,115,115,115,115,115,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+
+/* block 97 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,115,115,115,115,115,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 97 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-
/* block 98 */
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,487,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 99 */
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
-486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,486,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,517,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
/* block 100 */
-486,486,486,486,486,486,486,486,486,486,486,486,486,115,115,115,
-488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,
-488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,
-488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,
-488,488,488,488,488,488,488,115,115,115,115,115,115,115,115,115,
-489,489,489,489,489,489,489,489,489,489,489,489,489,489,489,489,
-489,489,489,489,489,489,489,489,489,489,489,489,489,489,489,489,
-489,489,489,489,489,489,489,489,490,490,490,490,490,490,491,491,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
+516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
/* block 101 */
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
+516,516,516,516,516,516,516,516,516,516,516,516,516,115,115,115,
+518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,
+518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,
+518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,
+518,518,518,518,518,518,518,115,115,115,115,115,115,115,115,115,
+519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
+519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
+519,519,519,519,519,519,519,519,520,520,520,520,520,520,521,521,
/* block 102 */
-492,492,492,492,492,492,492,492,492,492,492,492,493,494,494,494,
-492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,492,
-495,495,495,495,495,495,495,495,495,495,492,492,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,496,178,
-179,179,179,497,178,178,178,178,178,178,178,178,178,178,497,409,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
/* block 103 */
-175,176,175,176,175,176,175,176,175,176,175,176,175,176,175,176,
-175,176,175,176,175,176,175,176,175,176,175,176,409,409,178,178,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,499,499,499,499,499,499,499,499,499,499,
-500,500,501,501,501,501,501,501,115,115,115,115,115,115,115,115,
+522,522,522,522,522,522,522,522,522,522,522,522,523,524,524,524,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+525,525,525,525,525,525,525,525,525,525,522,522,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+187,188,187,188,187,188,187,188,187,188,526,527,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,528,192,
+193,193,193,529,192,192,192,192,192,192,192,192,192,192,529,436,
/* block 104 */
+187,188,187,188,187,188,187,188,187,188,187,188,187,188,187,188,
+187,188,187,188,187,188,187,188,187,188,187,188,436,436,192,192,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,531,531,531,531,531,531,531,531,531,531,
+532,532,533,533,533,533,533,533,115,115,115,115,115,115,115,115,
+
+/* block 105 */
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14,108,108,108,108,108,108,108,108,108,
14, 14, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
@@ -2425,349 +2534,349 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
-107, 33, 33, 33, 33, 33, 33, 33, 33, 30, 31, 30, 31,502, 30, 31,
+107, 33, 33, 33, 33, 33, 33, 33, 33, 30, 31, 30, 31,534, 30, 31,
-/* block 105 */
- 30, 31, 30, 31, 30, 31, 30, 31,108, 14, 14, 30, 31,503, 33, 20,
+/* block 106 */
+ 30, 31, 30, 31, 30, 31, 30, 31,108, 14, 14, 30, 31,535, 33, 20,
30, 31, 30, 31, 33, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
- 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,504,505,506,507,115,115,
-508,509,510,511, 30, 31, 30, 31,115,115,115,115,115,115,115,115,
+ 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,536,537,538,539,536,115,
+540,541,542,543, 30, 31, 30, 31,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115, 20,107,107, 33, 20, 20, 20, 20, 20,
-/* block 106 */
-512,512,513,512,512,512,513,512,512,512,512,513,512,512,512,512,
-512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
-512,512,512,514,514,513,513,514,515,515,515,515,115,115,115,115,
- 23, 23, 23, 23, 23, 23, 19, 19, 5, 19,115,115,115,115,115,115,
-516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
-516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
-516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
-516,516,516,516,517,517,517,517,115,115,115,115,115,115,115,115,
-
/* block 107 */
-518,518,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
-519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
-519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
-519,519,519,519,518,518,518,518,518,518,518,518,518,518,518,518,
-518,518,518,518,520,115,115,115,115,115,115,115,115,115,521,521,
-522,522,522,522,522,522,522,522,522,522,115,115,115,115,115,115,
-222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
-222,222,224,224,224,224,224,224,226,226,226,224,226,224,115,115,
+544,544,545,544,544,544,545,544,544,544,544,545,544,544,544,544,
+544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,
+544,544,544,546,546,545,545,546,547,547,547,547,115,115,115,115,
+ 23, 23, 23, 23, 23, 23, 19, 19, 5, 19,115,115,115,115,115,115,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,549,549,549,549,115,115,115,115,115,115,115,115,
/* block 108 */
-523,523,523,523,523,523,523,523,523,523,524,524,524,524,524,524,
-524,524,524,524,524,524,524,524,524,524,524,524,524,524,524,524,
-524,524,524,524,524,524,525,525,525,525,525,525,525,525, 4,526,
-527,527,527,527,527,527,527,527,527,527,527,527,527,527,527,527,
-527,527,527,527,527,527,527,528,528,528,528,528,528,528,528,528,
-528,528,529,529,115,115,115,115,115,115,115,115,115,115,115,530,
-315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,
-315,315,315,315,315,315,315,315,315,315,315,315,315,115,115,115,
+550,550,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
+551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
+551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
+551,551,551,551,550,550,550,550,550,550,550,550,550,550,550,550,
+550,550,550,550,552,552,115,115,115,115,115,115,115,115,553,553,
+554,554,554,554,554,554,554,554,554,554,115,115,115,115,115,115,
+238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
+238,238,240,240,240,240,240,240,242,242,242,240,242,240,115,115,
/* block 109 */
-531,531,531,532,533,533,533,533,533,533,533,533,533,533,533,533,
-533,533,533,533,533,533,533,533,533,533,533,533,533,533,533,533,
-533,533,533,533,533,533,533,533,533,533,533,533,533,533,533,533,
-533,533,533,531,532,532,531,531,531,531,532,532,531,532,532,532,
-532,534,534,534,534,534,534,534,534,534,534,534,534,534,115,108,
-535,535,535,535,535,535,535,535,535,535,115,115,115,115,534,534,
-305,305,305,305,305,307,536,305,305,305,305,305,305,305,305,305,
-309,309,309,309,309,309,309,309,309,309,305,305,305,305,305,115,
+555,555,555,555,555,555,555,555,555,555,556,556,556,556,556,556,
+556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
+556,556,556,556,556,556,557,557,557,557,557,557,557,557, 4,558,
+559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
+559,559,559,559,559,559,559,560,560,560,560,560,560,560,560,560,
+560,560,561,561,115,115,115,115,115,115,115,115,115,115,115,562,
+333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,333,
+333,333,333,333,333,333,333,333,333,333,333,333,333,115,115,115,
/* block 110 */
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,538,538,538,538,538,538,539,
-539,538,538,539,539,538,538,115,115,115,115,115,115,115,115,115,
-537,537,537,538,537,537,537,537,537,537,537,537,538,539,115,115,
-540,540,540,540,540,540,540,540,540,540,115,115,541,541,541,541,
-305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,
-536,305,305,305,305,305,305,311,311,311,305,306,307,306,305,305,
+563,563,563,564,565,565,565,565,565,565,565,565,565,565,565,565,
+565,565,565,565,565,565,565,565,565,565,565,565,565,565,565,565,
+565,565,565,565,565,565,565,565,565,565,565,565,565,565,565,565,
+565,565,565,563,564,564,563,563,563,563,564,564,563,564,564,564,
+564,566,566,566,566,566,566,566,566,566,566,566,566,566,115,108,
+567,567,567,567,567,567,567,567,567,567,115,115,115,115,566,566,
+323,323,323,323,323,325,568,323,323,323,323,323,323,323,323,323,
+327,327,327,327,327,327,327,327,327,327,323,323,323,323,323,115,
/* block 111 */
-542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
-542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
-542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
-543,542,543,543,543,542,542,543,543,542,542,542,542,542,543,543,
-542,543,542,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,542,542,544,545,545,
-546,546,546,546,546,546,546,546,546,546,546,547,548,548,547,547,
-549,549,546,550,550,547,548,115,115,115,115,115,115,115,115,115,
+569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
+569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
+569,569,569,569,569,569,569,569,569,570,570,570,570,570,570,571,
+571,570,570,571,571,570,570,115,115,115,115,115,115,115,115,115,
+569,569,569,570,569,569,569,569,569,569,569,569,570,571,115,115,
+572,572,572,572,572,572,572,572,572,572,115,115,573,573,573,573,
+323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
+568,323,323,323,323,323,323,329,329,329,323,324,325,324,323,323,
/* block 112 */
-115,318,318,318,318,318,318,115,115,318,318,318,318,318,318,115,
-115,318,318,318,318,318,318,115,115,115,115,115,115,115,115,115,
-318,318,318,318,318,318,318,115,318,318,318,318,318,318,318,115,
+574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
+574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
+574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
+575,574,575,575,575,574,574,575,575,574,574,574,574,574,575,575,
+574,575,574,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,574,574,576,577,577,
+578,578,578,578,578,578,578,578,578,578,578,579,580,580,579,579,
+581,581,578,582,582,579,580,115,115,115,115,115,115,115,115,115,
+
+/* block 113 */
+115,336,336,336,336,336,336,115,115,336,336,336,336,336,336,115,
+115,336,336,336,336,336,336,115,115,115,115,115,115,115,115,115,
+336,336,336,336,336,336,336,115,336,336,336,336,336,336,336,115,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33,551, 33, 33, 33, 33, 33, 33, 33, 14,107,107,107,107,
+ 33, 33, 33,583, 33, 33, 33, 33, 33, 33, 33, 14,107,107,107,107,
33, 33, 33, 33, 33,123,115,115,115,115,115,115,115,115,115,115,
-552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
-
-/* block 113 */
-552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
-552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
-552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
-552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
-546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
-546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
-546,546,546,547,547,548,547,547,548,547,547,549,547,548,115,115,
-553,553,553,553,553,553,553,553,553,553,115,115,115,115,115,115,
+584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
/* block 114 */
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
+584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
+584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
+584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
+584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,579,579,580,579,579,580,579,579,581,579,580,115,115,
+585,585,585,585,585,585,585,585,585,585,115,115,115,115,115,115,
/* block 115 */
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
/* block 116 */
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
/* block 117 */
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
/* block 118 */
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
/* block 119 */
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
/* block 120 */
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-554,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,554,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,554,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
/* block 121 */
-555,555,555,555,555,555,555,555,554,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,115,115,115,115,115,115,115,115,115,115,115,115,
-316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,
-316,316,316,316,316,316,316,115,115,115,115,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,
-317,317,317,317,317,317,317,317,317,317,317,317,115,115,115,115,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+586,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,586,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,586,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
/* block 122 */
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
-556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,
+587,587,587,587,587,587,587,587,586,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,115,115,115,115,115,115,115,115,115,115,115,115,
+334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
+334,334,334,334,334,334,334,115,115,115,115,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,335,
+335,335,335,335,335,335,335,335,335,335,335,335,115,115,115,115,
/* block 123 */
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
+588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
/* block 124 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,115,115,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
/* block 125 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,115,115,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
/* block 126 */
- 33, 33, 33, 33, 33, 33, 33,115,115,115,115,115,115,115,115,115,
-115,115,115,186,186,186,186,186,115,115,115,115,115,193,190,193,
-193,193,193,193,193,193,193,193,193,558,193,193,193,193,193,193,
-193,193,193,193,193,193,193,115,193,193,193,193,193,115,193,115,
-193,193,115,193,193,115,193,193,193,193,193,193,193,193,193,193,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 127 */
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
-559,559,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
+ 33, 33, 33, 33, 33, 33, 33,115,115,115,115,115,115,115,115,115,
+115,115,115,200,200,200,200,200,115,115,115,115,115,207,204,207,
+207,207,207,207,207,207,207,207,207,590,207,207,207,207,207,207,
+207,207,207,207,207,207,207,115,207,207,207,207,207,115,207,115,
+207,207,115,207,207,115,207,207,207,207,207,207,207,207,207,207,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
/* block 128 */
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,591,591,591,591,591,591,591,591,591,591,591,591,591,591,
+591,591,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
/* block 129 */
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200, 7, 6,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
/* block 130 */
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-115,115,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216, 7, 6,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-200,200,200,200,200,200,200,200,200,200,200,200,197,198,115,115,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
/* block 131 */
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+115,115,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+216,216,216,216,216,216,216,216,216,216,216,216,212,213,115,115,
+
+/* block 132 */
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
4, 4, 4, 4, 4, 4, 4, 6, 7, 4,115,115,115,115,115,115,
-110,110,110,110,110,110,110,110,110,110,110,110,110,110,178,178,
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,192,192,
4, 9, 9, 15, 15, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6,
7, 6, 7, 6, 7, 4, 4, 6, 7, 4, 4, 4, 4, 15, 15, 15,
4, 4, 4,115, 4, 4, 4, 4, 9, 6, 7, 6, 7, 6, 7, 4,
4, 4, 8, 9, 8, 8, 8,115, 4, 5, 4, 4,115,115,115,115,
-200,200,200,200,200,115,200,200,200,200,200,200,200,200,200,200,
-
-/* block 132 */
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,115,115, 22,
+216,216,216,216,216,115,216,216,216,216,216,216,216,216,216,216,
/* block 133 */
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,115,115, 22,
+
+/* block 134 */
115, 4, 4, 4, 5, 4, 4, 4, 6, 7, 4, 8, 4, 9, 4, 4,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 8, 8, 8, 4,
4, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 6, 4, 7, 14, 15,
14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6, 8, 7, 8, 6,
- 7, 4, 6, 7, 4, 4,479,479,479,479,479,479,479,479,479,479,
-108,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
+ 7, 4, 6, 7, 4, 4,509,509,509,509,509,509,509,509,509,509,
+108,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
-/* block 134 */
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,
-479,479,479,479,479,479,479,479,479,479,479,479,479,479,560,560,
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,
-482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,115,
-115,115,482,482,482,482,482,482,115,115,482,482,482,482,482,482,
-115,115,482,482,482,482,482,482,115,115,482,482,482,115,115,115,
+/* block 135 */
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,
+509,509,509,509,509,509,509,509,509,509,509,509,509,509,592,592,
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,
+512,512,512,512,512,512,512,512,512,512,512,512,512,512,512,115,
+115,115,512,512,512,512,512,512,115,115,512,512,512,512,512,512,
+115,115,512,512,512,512,512,512,115,115,512,512,512,115,115,115,
5, 5, 8, 14, 19, 5, 5,115, 19, 8, 8, 8, 8, 19, 19,115,
-437,437,437,437,437,437,437,437,437, 22, 22, 22, 19, 19,115,115,
+465,465,465,465,465,465,465,465,465, 22, 22, 22, 19, 19,115,115,
-/* block 135 */
-561,561,561,561,561,561,561,561,561,561,561,561,115,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,115,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,115,561,561,115,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,115,115,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,115,115,
+/* block 136 */
+593,593,593,593,593,593,593,593,593,593,593,593,115,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,115,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,115,593,593,115,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,115,115,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 136 */
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,115,115,115,115,115,
-
/* block 137 */
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,115,115,115,115,115,
+
+/* block 138 */
4, 4, 4,115,115,115,115, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23,115,115,115, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
-562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
-562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
-562,562,562,562,562,563,563,563,563,564,564,564,564,564,564,564,
+594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,
+594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,
+594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,
+594,594,594,594,594,595,595,595,595,596,596,596,596,596,596,596,
-/* block 138 */
-564,564,564,564,564,564,564,564,564,564,563,563,564,115,115,115,
+/* block 139 */
+596,596,596,596,596,596,596,596,596,596,595,595,596,596,596,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
-564,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+596,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,110,115,115,
-/* block 139 */
+/* block 140 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
@@ -2777,479 +2886,509 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 140 */
-565,565,565,565,565,565,565,565,565,565,565,565,565,565,565,565,
-565,565,565,565,565,565,565,565,565,565,565,565,565,115,115,115,
-566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,
-566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,
-566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,
-566,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+/* block 141 */
+597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,
+597,597,597,597,597,597,597,597,597,597,597,597,597,115,115,115,
+598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,
+598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,
+598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,
+598,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
110, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,115,115,115,115,
-/* block 141 */
-567,567,567,567,567,567,567,567,567,567,567,567,567,567,567,567,
-567,567,567,567,567,567,567,567,567,567,567,567,567,567,567,567,
-568,568,568,568,115,115,115,115,115,115,115,115,115,115,115,115,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,570,569,569,569,569,569,569,569,569,570,115,115,115,115,115,
-571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
-571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
-571,571,571,571,571,571,572,572,572,572,572,115,115,115,115,115,
-
/* block 142 */
-573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
-573,573,573,573,573,573,573,573,573,573,573,573,573,573,115,574,
-575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,
-575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,
-575,575,575,575,115,115,115,115,575,575,575,575,575,575,575,575,
-576,577,577,577,577,577,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,
+599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,
+600,600,600,600,115,115,115,115,115,115,115,115,115,599,599,599,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,602,601,601,601,601,601,601,601,601,602,115,115,115,115,115,
+603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,
+603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,
+603,603,603,603,603,603,604,604,604,604,604,115,115,115,115,115,
/* block 143 */
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,579,579,579,579,579,579,579,579,
-579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,
-579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,
-580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
-580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
-580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
-
-/* block 144 */
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,115,115,
-582,582,582,582,582,582,582,582,582,582,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,
+605,605,605,605,605,605,605,605,605,605,605,605,605,605,115,606,
+607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,
+607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,
+607,607,607,607,115,115,115,115,607,607,607,607,607,607,607,607,
+608,609,609,609,609,609,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+/* block 144 */
+610,610,610,610,610,610,610,610,610,610,610,610,610,610,610,610,
+610,610,610,610,610,610,610,610,610,610,610,610,610,610,610,610,
+610,610,610,610,610,610,610,610,611,611,611,611,611,611,611,611,
+611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,
+611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,
+612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
+612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
+612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
+
/* block 145 */
-583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,
-583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,
-583,583,583,583,583,583,583,583,115,115,115,115,115,115,115,115,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,115,115,115,115,115,115,115,115,115,115,115,585,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+613,613,613,613,613,613,613,613,613,613,613,613,613,613,613,613,
+613,613,613,613,613,613,613,613,613,613,613,613,613,613,115,115,
+614,614,614,614,614,614,614,614,614,614,115,115,115,115,115,115,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,115,115,115,115,616,616,616,616,616,616,616,616,
+616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
+616,616,616,616,616,616,616,616,616,616,616,616,115,115,115,115,
/* block 146 */
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
+617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
+617,617,617,617,617,617,617,617,115,115,115,115,115,115,115,115,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,115,115,115,115,115,115,115,115,115,115,115,619,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 147 */
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,586,115,115,115,115,115,115,115,115,115,
-586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
-586,586,586,586,586,586,115,115,115,115,115,115,115,115,115,115,
-586,586,586,586,586,586,586,586,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
/* block 148 */
-587,587,587,587,587,587,115,115,587,115,587,587,587,587,587,587,
-587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
-587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
-587,587,587,587,587,587,115,587,587,115,115,115,587,115,115,587,
-588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
-588,588,588,588,588,588,115,589,590,590,590,590,590,590,590,590,
-591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,
-591,591,591,591,591,591,591,592,592,593,593,593,593,593,593,593,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,620,115,115,115,115,115,115,115,115,115,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
+620,620,620,620,620,620,115,115,115,115,115,115,115,115,115,115,
+620,620,620,620,620,620,620,620,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 149 */
-594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,
-594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,115,
-115,115,115,115,115,115,115,595,595,595,595,595,595,595,595,595,
+621,621,621,621,621,621,115,115,621,115,621,621,621,621,621,621,
+621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
+621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
+621,621,621,621,621,621,115,621,621,115,115,115,621,115,115,621,
+622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,
+622,622,622,622,622,622,115,623,624,624,624,624,624,624,624,624,
+625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,
+625,625,625,625,625,625,625,626,626,627,627,627,627,627,627,627,
+
+/* block 150 */
+628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,
+628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,115,
+115,115,115,115,115,115,115,629,629,629,629,629,629,629,629,629,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
-596,596,596,115,596,596,115,115,115,115,115,597,597,597,597,597,
+630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
+630,630,630,115,630,630,115,115,115,115,115,631,631,631,631,631,
-/* block 150 */
-598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,
-598,598,598,598,598,598,599,599,599,599,599,599,115,115,115,600,
-601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
-601,601,601,601,601,601,601,601,601,601,115,115,115,115,115,602,
+/* block 151 */
+632,632,632,632,632,632,632,632,632,632,632,632,632,632,632,632,
+632,632,632,632,632,632,633,633,633,633,633,633,115,115,115,634,
+635,635,635,635,635,635,635,635,635,635,635,635,635,635,635,635,
+635,635,635,635,635,635,635,635,635,635,115,115,115,115,115,636,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 151 */
-603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,
-603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,
-604,604,604,604,604,604,604,604,604,604,604,604,604,604,604,604,
-604,604,604,604,604,604,604,604,115,115,115,115,605,605,604,604,
-605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,
-115,115,605,605,605,605,605,605,605,605,605,605,605,605,605,605,
-605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,
-605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,
-
/* block 152 */
-606,607,607,607,115,607,607,115,115,115,115,115,607,607,607,607,
-606,606,606,606,115,606,606,606,115,606,606,606,606,606,606,606,
-606,606,606,606,606,606,606,606,606,606,606,606,606,606,606,606,
-606,606,606,606,115,115,115,115,607,607,607,115,115,115,115,607,
-608,608,608,608,608,608,608,608,115,115,115,115,115,115,115,115,
-609,609,609,609,609,609,609,609,609,115,115,115,115,115,115,115,
-610,610,610,610,610,610,610,610,610,610,610,610,610,610,610,610,
-610,610,610,610,610,610,610,610,610,610,610,610,610,611,611,612,
+637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,
+637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,
+638,638,638,638,638,638,638,638,638,638,638,638,638,638,638,638,
+638,638,638,638,638,638,638,638,115,115,115,115,639,639,638,638,
+639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,
+115,115,639,639,639,639,639,639,639,639,639,639,639,639,639,639,
+639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,
+639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,
/* block 153 */
-613,613,613,613,613,613,613,613,613,613,613,613,613,613,613,613,
-613,613,613,613,613,613,613,613,613,613,613,613,613,614,614,614,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-615,615,615,615,615,615,615,615,616,615,615,615,615,615,615,615,
-615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
-615,615,615,615,615,617,617,115,115,115,115,618,618,618,618,618,
-619,619,619,619,619,619,619,115,115,115,115,115,115,115,115,115,
+640,641,641,641,115,641,641,115,115,115,115,115,641,641,641,641,
+640,640,640,640,115,640,640,640,115,640,640,640,640,640,640,640,
+640,640,640,640,640,640,640,640,640,640,640,640,640,640,640,640,
+640,640,640,640,115,115,115,115,641,641,641,115,115,115,115,641,
+642,642,642,642,642,642,642,642,115,115,115,115,115,115,115,115,
+643,643,643,643,643,643,643,643,643,115,115,115,115,115,115,115,
+644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,
+644,644,644,644,644,644,644,644,644,644,644,644,644,645,645,646,
/* block 154 */
-620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,620,115,115,115,621,621,621,621,621,621,621,
-622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,
-622,622,622,622,622,622,115,115,623,623,623,623,623,623,623,623,
-624,624,624,624,624,624,624,624,624,624,624,624,624,624,624,624,
-624,624,624,115,115,115,115,115,625,625,625,625,625,625,625,625,
+647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,
+647,647,647,647,647,647,647,647,647,647,647,647,647,648,648,648,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+649,649,649,649,649,649,649,649,650,649,649,649,649,649,649,649,
+649,649,649,649,649,649,649,649,649,649,649,649,649,649,649,649,
+649,649,649,649,649,651,651,115,115,115,115,652,652,652,652,652,
+653,653,653,653,653,653,653,115,115,115,115,115,115,115,115,115,
/* block 155 */
-626,626,626,626,626,626,626,626,626,626,626,626,626,626,626,626,
-626,626,115,115,115,115,115,115,115,627,627,627,627,115,115,115,
-115,115,115,115,115,115,115,115,115,628,628,628,628,628,628,628,
+654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
+654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
+654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
+654,654,654,654,654,654,115,115,115,655,655,655,655,655,655,655,
+656,656,656,656,656,656,656,656,656,656,656,656,656,656,656,656,
+656,656,656,656,656,656,115,115,657,657,657,657,657,657,657,657,
+658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
+658,658,658,115,115,115,115,115,659,659,659,659,659,659,659,659,
+
+/* block 156 */
+660,660,660,660,660,660,660,660,660,660,660,660,660,660,660,660,
+660,660,115,115,115,115,115,115,115,661,661,661,661,115,115,115,
+115,115,115,115,115,115,115,115,115,662,662,662,662,662,662,662,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 156 */
-629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,
-629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,
-629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,
-629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,629,
-629,629,629,629,629,629,629,629,629,115,115,115,115,115,115,115,
+/* block 157 */
+663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,
+663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,
+663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,
+663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,663,
+663,663,663,663,663,663,663,663,663,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 157 */
-630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
-630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
-630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
-630,630,630,115,115,115,115,115,115,115,115,115,115,115,115,115,
-631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,
-631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,
-631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,
-631,631,631,115,115,115,115,115,115,115,632,632,632,632,632,632,
-
/* block 158 */
+664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,
+664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,
+664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,664,
+664,664,664,115,115,115,115,115,115,115,115,115,115,115,115,115,
+665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
+665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
+665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
+665,665,665,115,115,115,115,115,115,115,666,666,666,666,666,666,
+
+/* block 159 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-633,633,633,633,633,633,633,633,633,633,633,633,633,633,633,633,
-633,633,633,633,633,633,633,633,633,633,633,633,633,633,633,115,
-
-/* block 159 */
-634,635,634,636,636,636,636,636,636,636,636,636,636,636,636,636,
-636,636,636,636,636,636,636,636,636,636,636,636,636,636,636,636,
-636,636,636,636,636,636,636,636,636,636,636,636,636,636,636,636,
-636,636,636,636,636,636,636,636,635,635,635,635,635,635,635,635,
-635,635,635,635,635,635,635,637,637,637,637,637,637,637,115,115,
-115,115,638,638,638,638,638,638,638,638,638,638,638,638,638,638,
-638,638,638,638,638,638,639,639,639,639,639,639,639,639,639,639,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,635,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,115,
/* block 160 */
-640,640,641,642,642,642,642,642,642,642,642,642,642,642,642,642,
-642,642,642,642,642,642,642,642,642,642,642,642,642,642,642,642,
-642,642,642,642,642,642,642,642,642,642,642,642,642,642,642,642,
-641,641,641,640,640,640,640,641,641,640,640,643,643,644,643,643,
-643,643,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-645,645,645,645,645,645,645,645,645,645,645,645,645,645,645,645,
-645,645,645,645,645,645,645,645,645,115,115,115,115,115,115,115,
-646,646,646,646,646,646,646,646,646,646,115,115,115,115,115,115,
+668,669,668,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,669,669,669,669,669,669,669,
+669,669,669,669,669,669,669,671,671,671,671,671,671,671,115,115,
+115,115,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,673,673,673,673,673,673,673,673,673,673,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,669,
/* block 161 */
-647,647,647,648,648,648,648,648,648,648,648,648,648,648,648,648,
-648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,
-648,648,648,648,648,648,648,647,647,647,647,647,649,647,647,647,
-647,647,647,647,647,115,650,650,650,650,650,650,650,650,650,650,
-651,651,651,651,115,115,115,115,115,115,115,115,115,115,115,115,
-652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,
-652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,
-652,652,652,653,654,654,652,115,115,115,115,115,115,115,115,115,
+674,674,675,676,676,676,676,676,676,676,676,676,676,676,676,676,
+676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,
+676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,
+675,675,675,674,674,674,674,675,675,674,674,677,677,678,677,677,
+677,677,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+679,679,679,679,679,679,679,679,679,679,679,679,679,679,679,679,
+679,679,679,679,679,679,679,679,679,115,115,115,115,115,115,115,
+680,680,680,680,680,680,680,680,680,680,115,115,115,115,115,115,
/* block 162 */
-655,655,656,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,656,656,656,655,655,655,655,655,655,655,655,655,656,
-656,657,657,657,657,658,658,658,658,658,655,655,655,658,115,115,
-659,659,659,659,659,659,659,659,659,659,657,658,657,658,658,658,
-115,660,660,660,660,660,660,660,660,660,660,660,660,660,660,660,
-660,660,660,660,660,115,115,115,115,115,115,115,115,115,115,115,
+681,681,681,682,682,682,682,682,682,682,682,682,682,682,682,682,
+682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
+682,682,682,682,682,682,682,681,681,681,681,681,683,681,681,681,
+681,681,681,681,681,115,684,684,684,684,684,684,684,684,684,684,
+685,685,685,685,115,115,115,115,115,115,115,115,115,115,115,115,
+686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
+686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
+686,686,686,687,688,688,686,115,115,115,115,115,115,115,115,115,
/* block 163 */
-661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,
-661,661,115,661,661,661,661,661,661,661,661,661,661,661,661,661,
-661,661,661,661,661,661,661,661,661,661,661,661,662,662,662,663,
-663,663,662,662,663,662,663,663,664,664,664,664,664,664,115,115,
+689,689,690,691,691,691,691,691,691,691,691,691,691,691,691,691,
+691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
+691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
+691,691,691,690,690,690,689,689,689,689,689,689,689,689,689,690,
+690,691,692,692,691,693,693,693,693,693,689,689,689,693,115,115,
+694,694,694,694,694,694,694,694,694,694,691,693,691,693,693,693,
+115,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
+695,695,695,695,695,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 164 */
+696,696,696,696,696,696,696,696,696,696,696,696,696,696,696,696,
+696,696,115,696,696,696,696,696,696,696,696,696,696,696,696,696,
+696,696,696,696,696,696,696,696,696,696,696,696,697,697,697,698,
+698,698,697,697,698,697,698,698,699,699,699,699,699,699,698,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 164 */
-665,665,665,665,665,665,665,115,665,115,665,665,665,665,115,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,115,665,
-665,665,665,665,665,665,665,665,665,666,115,115,115,115,115,115,
-667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
-667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
-667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,668,
-669,669,669,668,668,668,668,668,668,668,668,115,115,115,115,115,
-670,670,670,670,670,670,670,670,670,670,115,115,115,115,115,115,
-
/* block 165 */
-671,671,672,672,115,673,673,673,673,673,673,673,673,115,115,673,
-673,115,115,673,673,673,673,673,673,673,673,673,673,673,673,673,
-673,673,673,673,673,673,673,673,673,115,673,673,673,673,673,673,
-673,115,673,673,115,673,673,673,673,673,115,115,671,673,674,672,
-671,672,672,672,672,115,115,672,672,115,115,672,672,672,115,115,
-673,115,115,115,115,115,115,674,115,115,115,115,115,673,673,673,
-673,673,672,672,115,115,671,671,671,671,671,671,671,115,115,115,
-671,671,671,671,671,115,115,115,115,115,115,115,115,115,115,115,
+700,700,700,700,700,700,700,115,700,115,700,700,700,700,115,700,
+700,700,700,700,700,700,700,700,700,700,700,700,700,700,115,700,
+700,700,700,700,700,700,700,700,700,701,115,115,115,115,115,115,
+702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
+702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
+702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,703,
+704,704,704,703,703,703,703,703,703,703,703,115,115,115,115,115,
+705,705,705,705,705,705,705,705,705,705,115,115,115,115,115,115,
/* block 166 */
-675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,
-675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,
-675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,
-676,677,677,678,678,678,678,678,678,677,678,677,677,676,677,678,
-678,677,678,678,675,675,679,675,115,115,115,115,115,115,115,115,
-680,680,680,680,680,680,680,680,680,680,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+706,706,707,707,115,708,708,708,708,708,708,708,708,115,115,708,
+708,115,115,708,708,708,708,708,708,708,708,708,708,708,708,708,
+708,708,708,708,708,708,708,708,708,115,708,708,708,708,708,708,
+708,115,708,708,115,708,708,708,708,708,115,115,706,708,709,707,
+706,707,707,707,707,115,115,707,707,115,115,707,707,707,115,115,
+708,115,115,115,115,115,115,709,115,115,115,115,115,708,708,708,
+708,708,707,707,115,115,706,706,706,706,706,706,706,115,115,115,
+706,706,706,706,706,115,115,115,115,115,115,115,115,115,115,115,
/* block 167 */
-681,681,681,681,681,681,681,681,681,681,681,681,681,681,681,681,
-681,681,681,681,681,681,681,681,681,681,681,681,681,681,681,681,
-681,681,681,681,681,681,681,681,681,681,681,681,681,681,681,682,
-683,683,684,684,684,684,115,115,683,683,683,683,684,684,683,684,
-684,685,685,685,685,685,685,685,685,685,685,685,685,685,685,685,
-685,685,685,685,685,685,685,685,681,681,681,681,684,684,115,115,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,711,711,711,712,712,712,712,712,712,712,712,
+711,711,712,712,712,711,712,710,710,710,710,713,713,713,713,713,
+714,714,714,714,714,714,714,714,714,714,115,713,115,713,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 168 */
-686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
-686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
-686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
-687,687,687,688,688,688,688,688,688,688,688,687,687,688,687,688,
-688,689,689,689,686,115,115,115,115,115,115,115,115,115,115,115,
-690,690,690,690,690,690,690,690,690,690,115,115,115,115,115,115,
+715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
+715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
+715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
+716,717,717,718,718,718,718,718,718,717,718,717,717,716,717,718,
+718,717,718,718,715,715,719,715,115,115,115,115,115,115,115,115,
+720,720,720,720,720,720,720,720,720,720,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 169 */
-691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
-691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
-691,691,691,691,691,691,691,691,691,691,691,692,693,692,693,693,
-692,692,692,692,692,692,693,692,115,115,115,115,115,115,115,115,
-694,694,694,694,694,694,694,694,694,694,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,
+721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,
+721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,722,
+723,723,724,724,724,724,115,115,723,723,723,723,724,724,723,724,
+724,725,725,725,725,725,725,725,725,725,725,725,725,725,725,725,
+725,725,725,725,725,725,725,725,721,721,721,721,724,724,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 170 */
-695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
-695,695,695,695,695,695,695,695,695,695,115,115,115,696,696,696,
-697,697,696,696,696,696,697,696,696,696,696,696,115,115,115,115,
-698,698,698,698,698,698,698,698,698,698,699,699,700,700,700,701,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
+726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
+726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
+727,727,727,728,728,728,728,728,728,728,728,727,727,728,727,728,
+728,729,729,729,726,115,115,115,115,115,115,115,115,115,115,115,
+730,730,730,730,730,730,730,730,730,730,115,115,115,115,115,115,
+369,369,369,369,369,369,369,369,369,369,369,369,369,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 171 */
+731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,
+731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,
+731,731,731,731,731,731,731,731,731,731,731,732,733,732,733,733,
+732,732,732,732,732,732,733,732,115,115,115,115,115,115,115,115,
+734,734,734,734,734,734,734,734,734,734,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
-702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
-703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,
-703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,
-704,704,704,704,704,704,704,704,704,704,705,705,705,705,705,705,
-705,705,705,115,115,115,115,115,115,115,115,115,115,115,115,706,
/* block 172 */
+735,735,735,735,735,735,735,735,735,735,735,735,735,735,735,735,
+735,735,735,735,735,735,735,735,735,735,115,115,115,736,736,736,
+737,737,736,736,736,736,737,736,736,736,736,736,115,115,115,115,
+738,738,738,738,738,738,738,738,738,738,739,739,740,740,740,741,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,
-707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,
-707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,
-707,707,707,707,707,707,707,707,707,115,115,115,115,115,115,115,
/* block 173 */
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-
-/* block 174 */
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,
+742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,
+743,743,743,743,743,743,743,743,743,743,743,743,743,743,743,743,
+743,743,743,743,743,743,743,743,743,743,743,743,743,743,743,743,
+744,744,744,744,744,744,744,744,744,744,745,745,745,745,745,745,
+745,745,745,115,115,115,115,115,115,115,115,115,115,115,115,746,
+
+/* block 174 */
+747,748,748,748,748,748,748,749,749,748,748,747,747,747,747,747,
+747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,
+747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,
+747,747,747,748,748,748,748,748,748,749,750,748,748,748,748,751,
+751,751,751,751,751,751,751,748,115,115,115,115,115,115,115,115,
+752,753,753,753,753,753,753,754,754,753,753,753,752,752,752,752,
+752,752,752,752,752,752,752,752,752,752,752,752,752,752,752,752,
+752,752,752,752,752,752,752,752,752,752,752,752,752,752,752,752,
/* block 175 */
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,115,
-710,710,710,710,710,115,115,115,115,115,115,115,115,115,115,115,
+752,752,752,752,115,115,755,755,755,755,753,753,753,753,753,753,
+753,753,753,753,753,753,753,754,753,753,756,756,756,115,756,756,
+756,756,756,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,
+757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,
+757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,
+757,757,757,757,757,757,757,757,757,115,115,115,115,115,115,115,
/* block 176 */
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
-708,708,708,708,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+758,758,758,758,758,758,758,758,758,115,758,758,758,758,758,758,
+758,758,758,758,758,758,758,758,758,758,758,758,758,758,758,758,
+758,758,758,758,758,758,758,758,758,758,758,758,758,758,758,759,
+760,760,760,760,760,760,760,115,760,760,760,760,760,760,759,760,
+758,761,761,761,761,761,115,115,115,115,115,115,115,115,115,115,
+762,762,762,762,762,762,762,762,762,762,763,763,763,763,763,763,
+763,763,763,763,763,763,763,763,763,763,763,763,763,115,115,115,
+764,764,765,765,765,765,765,765,765,765,765,765,765,765,765,765,
/* block 177 */
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-
-/* block 178 */
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
-711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,115,
+765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,
+115,115,766,766,766,766,766,766,766,766,766,766,766,766,766,766,
+766,766,766,766,766,766,766,766,115,767,766,766,766,766,766,766,
+766,767,766,766,767,766,766,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 178 */
+768,768,768,768,768,768,768,115,768,768,115,768,768,768,768,768,
+768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,
+768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,
+768,769,769,769,769,769,769,115,115,115,769,115,769,769,115,769,
+769,769,769,769,769,769,770,769,115,115,115,115,115,115,115,115,
+771,771,771,771,771,771,771,771,771,771,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 179 */
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
/* block 180 */
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,115,115,115,115,115,115,115,115,115,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 181 */
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,
+773,773,773,773,773,773,773,773,773,773,773,773,773,773,773,115,
+774,774,774,774,774,115,115,115,115,115,115,115,115,115,115,115,
/* block 182 */
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,498,
-498,498,498,498,498,498,498,498,498,115,115,115,115,115,115,115,
-713,713,713,713,713,713,713,713,713,713,713,713,713,713,713,713,
-713,713,713,713,713,713,713,713,713,713,713,713,713,713,713,115,
-714,714,714,714,714,714,714,714,714,714,115,115,115,115,715,715,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
/* block 183 */
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+
+/* block 184 */
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,
+775,775,775,775,775,775,775,775,775,775,775,775,775,775,775,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,
-716,716,716,716,716,716,716,716,716,716,716,716,716,716,115,115,
-717,717,717,717,717,718,115,115,115,115,115,115,115,115,115,115,
-
-/* block 184 */
-719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,
-719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,
-719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,
-720,720,720,720,720,720,720,721,721,721,721,721,722,722,722,722,
-723,723,723,723,721,722,115,115,115,115,115,115,115,115,115,115,
-724,724,724,724,724,724,724,724,724,724,115,725,725,725,725,725,
-725,725,115,719,719,719,719,719,719,719,719,719,719,719,719,719,
-719,719,719,719,719,719,719,719,115,115,115,115,115,719,719,719,
/* block 185 */
-719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,719,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+
+/* block 186 */
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 187 */
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+
+/* block 188 */
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,115,115,115,115,115,115,115,
+777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,
+777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,115,
+778,778,778,778,778,778,778,778,778,778,115,115,115,115,779,779,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 189 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+780,780,780,780,780,780,780,780,780,780,780,780,780,780,780,780,
+780,780,780,780,780,780,780,780,780,780,780,780,780,780,115,115,
+781,781,781,781,781,782,115,115,115,115,115,115,115,115,115,115,
-/* block 186 */
-726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
-726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
-726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
-726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
-726,726,726,726,726,115,115,115,115,115,115,115,115,115,115,115,
-726,727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,
-727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,
-727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,115,
+/* block 190 */
+783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,
+783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,
+783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,
+784,784,784,784,784,784,784,785,785,785,785,785,786,786,786,786,
+787,787,787,787,785,786,115,115,115,115,115,115,115,115,115,115,
+788,788,788,788,788,788,788,788,788,788,115,789,789,789,789,789,
+789,789,115,783,783,783,783,783,783,783,783,783,783,783,783,783,
+783,783,783,783,783,783,783,783,115,115,115,115,115,783,783,783,
-/* block 187 */
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,728,
-728,728,728,729,729,729,729,729,729,729,729,729,729,729,729,729,
+/* block 191 */
+783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,783,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
@@ -3257,29 +3396,119 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 188 */
-479,477,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+/* block 192 */
+790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,
+790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,
+790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,
+790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,790,
+790,790,790,790,790,115,115,115,115,115,115,115,115,115,115,115,
+790,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,
+791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,
+791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,115,
+
+/* block 193 */
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,792,
+792,792,792,793,793,793,793,793,793,793,793,793,793,793,793,793,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+794,795,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 194 */
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+
+/* block 195 */
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 196 */
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 197 */
+509,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+
+/* block 198 */
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+
+/* block 199 */
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,
+507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
-/* block 189 */
-730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
-730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
-730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
-730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
-730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
-730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
-730,730,730,730,730,730,730,730,730,730,730,115,115,115,115,115,
-730,730,730,730,730,730,730,730,730,730,730,730,730,115,115,115,
+/* block 200 */
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
-/* block 190 */
-730,730,730,730,730,730,730,730,730,115,115,115,115,115,115,115,
-730,730,730,730,730,730,730,730,730,730,115,115,731,732,732,733,
+/* block 201 */
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,797,
+797,797,797,797,797,797,797,797,797,797,797,797,115,115,115,115,
+
+/* block 202 */
+798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,
+798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,
+798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,
+798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,
+798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,
+798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,798,
+798,798,798,798,798,798,798,798,798,798,798,115,115,115,115,115,
+798,798,798,798,798,798,798,798,798,798,798,798,798,115,115,115,
+
+/* block 203 */
+798,798,798,798,798,798,798,798,798,115,115,115,115,115,115,115,
+798,798,798,798,798,798,798,798,798,798,115,115,799,800,800,801,
22, 22, 22, 22,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
@@ -3287,7 +3516,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 191 */
+/* block 204 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -3297,17 +3526,17 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,
-/* block 192 */
+/* block 205 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19,115,115, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19,734,406,110,110,110, 19, 19, 19,406,734,734,
-734,734,734, 22, 22, 22, 22, 22, 22, 22, 22,110,110,110,110,110,
+ 19, 19, 19, 19, 19,802,433,110,110,110, 19, 19, 19,433,802,802,
+802,802,802, 22, 22, 22, 22, 22, 22, 22, 22,110,110,110,110,110,
-/* block 193 */
+/* block 206 */
110,110,110, 19, 19,110,110,110,110,110,110,110, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,110,110,110,110, 19, 19,
@@ -3317,17 +3546,17 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 194 */
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,735,735,735,564,115,115,115,115,115,115,115,115,115,115,
+/* block 207 */
+596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
+596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
+596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
+596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
+596,596,803,803,803,596,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 195 */
+/* block 208 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -3337,157 +3566,177 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 196 */
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,439,439,
-439,439,439,439,439,115,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
+/* block 209 */
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,467,467,
+467,467,467,467,467,115,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
-/* block 197 */
-438,438,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,438,115,438,438,
-115,115,438,115,115,438,438,115,115,438,438,438,438,115,438,438,
-438,438,438,438,438,438,439,439,439,439,115,439,115,439,439,439,
-439,439,439,439,115,439,439,439,439,439,439,439,439,439,439,439,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
+/* block 210 */
+466,466,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,466,115,466,466,
+115,115,466,115,115,466,466,115,115,466,466,466,466,115,466,466,
+466,466,466,466,466,466,467,467,467,467,115,467,115,467,467,467,
+467,467,467,467,115,467,467,467,467,467,467,467,467,467,467,467,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
-/* block 198 */
-439,439,439,439,438,438,115,438,438,438,438,115,115,438,438,438,
-438,438,438,438,438,115,438,438,438,438,438,438,438,115,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,438,438,115,438,438,438,438,115,
-438,438,438,438,438,115,438,115,115,115,438,438,438,438,438,438,
-438,115,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
+/* block 211 */
+467,467,467,467,466,466,115,466,466,466,466,115,115,466,466,466,
+466,466,466,466,466,115,466,466,466,466,466,466,466,115,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,466,466,115,466,466,466,466,115,
+466,466,466,466,466,115,466,115,115,115,466,466,466,466,466,466,
+466,115,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
-/* block 199 */
-438,438,438,438,438,438,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
+/* block 212 */
+466,466,466,466,466,466,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
-/* block 200 */
-439,439,439,439,439,439,439,439,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
+/* block 213 */
+467,467,467,467,467,467,467,467,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
-/* block 201 */
-438,438,438,438,438,438,438,438,438,438,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,115,115,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438, 8,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439, 8,439,439,439,439,
-439,439,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438, 8,439,439,439,439,
+/* block 214 */
+466,466,466,466,466,466,466,466,466,466,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,115,115,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466, 8,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467, 8,467,467,467,467,
+467,467,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466, 8,467,467,467,467,
-/* block 202 */
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439, 8,439,439,439,439,439,439,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438, 8,439,439,439,439,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439, 8,
-439,439,439,439,439,439,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, 8,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
+/* block 215 */
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467, 8,467,467,467,467,467,467,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466, 8,467,467,467,467,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, 8,
+467,467,467,467,467,467,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466, 8,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
-/* block 203 */
-439,439,439,439,439,439,439,439,439, 8,439,439,439,439,439,439,
-438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,438,438,438,438,438, 8,439,439,439,439,439,439,
-439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,
-439,439,439, 8,439,439,439,439,439,439,438,439,115,115, 10, 10,
+/* block 216 */
+467,467,467,467,467,467,467,467,467, 8,467,467,467,467,467,467,
+466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,466,
+466,466,466,466,466,466,466,466,466, 8,467,467,467,467,467,467,
+467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,
+467,467,467, 8,467,467,467,467,467,467,466,467,115,115, 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,
-/* block 204 */
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
-736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,736,
+/* block 217 */
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
+804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
-/* block 205 */
-737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
-737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
-737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
-737,737,737,737,737,737,737,736,736,736,736,737,737,737,737,737,
-737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
-737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
-737,737,737,737,737,737,737,737,737,737,737,737,737,736,736,736,
-736,736,736,736,736,737,736,736,736,736,736,736,736,736,736,736,
+/* block 218 */
+805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,
+805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,
+805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,
+805,805,805,805,805,805,805,804,804,804,804,805,805,805,805,805,
+805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,
+805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,
+805,805,805,805,805,805,805,805,805,805,805,805,805,804,804,804,
+804,804,804,804,804,805,804,804,804,804,804,804,804,804,804,804,
-/* block 206 */
-736,736,736,736,737,736,736,738,738,738,738,738,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,737,737,737,737,737,
-115,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
+/* block 219 */
+804,804,804,804,805,804,804,806,806,806,806,806,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,805,805,805,805,805,
+115,805,805,805,805,805,805,805,805,805,805,805,805,805,805,805,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 207 */
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
+/* block 220 */
+807,807,807,807,807,807,807,115,807,807,807,807,807,807,807,807,
+807,807,807,807,807,807,807,807,807,115,115,807,807,807,807,807,
+807,807,115,807,807,115,807,807,807,807,807,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 208 */
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
-739,739,739,739,739,115,115,740,740,740,740,740,740,740,740,740,
-741,741,741,741,741,741,741,115,115,115,115,115,115,115,115,115,
+/* block 221 */
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+
+/* block 222 */
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,808,
+808,808,808,808,808,115,115,809,809,809,809,809,809,809,809,809,
+810,810,810,810,810,810,810,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 209 */
-200,200,200,200,115,200,200,200,200,200,200,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,
-115,200,200,115,200,115,115,200,115,200,200,200,200,200,200,200,
-200,200,200,115,200,200,200,200,115,200,115,200,115,115,115,115,
-115,115,200,115,115,115,115,200,115,200,115,200,115,200,200,200,
-115,200,200,115,200,115,115,200,115,200,115,200,115,200,115,200,
-115,200,200,115,200,115,115,200,200,200,200,115,200,200,200,200,
-200,200,200,115,200,200,200,200,115,200,200,200,200,115,200,115,
+/* block 223 */
+811,811,811,811,811,811,811,811,811,811,811,811,811,811,811,811,
+811,811,811,811,811,811,811,811,811,811,811,811,811,811,811,811,
+811,811,812,812,812,812,812,812,812,812,812,812,812,812,812,812,
+812,812,812,812,812,812,812,812,812,812,812,812,812,812,812,812,
+812,812,812,812,813,813,813,813,813,813,813,115,115,115,115,115,
+814,814,814,814,814,814,814,814,814,814,115,115,115,115,815,815,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 210 */
-200,200,200,200,200,200,200,200,200,200,115,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,115,115,115,115,
-115,200,200,200,115,200,200,200,200,200,115,200,200,200,200,200,
-200,200,200,200,200,200,200,200,200,200,200,200,115,115,115,115,
+/* block 224 */
+216,216,216,216,115,216,216,216,216,216,216,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,216,
+115,216,216,115,216,115,115,216,115,216,216,216,216,216,216,216,
+216,216,216,115,216,216,216,216,115,216,115,216,115,115,115,115,
+115,115,216,115,115,115,115,216,115,216,115,216,115,216,216,216,
+115,216,216,115,216,115,115,216,115,216,115,216,115,216,115,216,
+115,216,216,115,216,115,115,216,216,216,216,115,216,216,216,216,
+216,216,216,115,216,216,216,216,115,216,216,216,216,115,216,115,
+
+/* block 225 */
+216,216,216,216,216,216,216,216,216,216,115,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,115,115,115,115,
+115,216,216,216,115,216,216,216,216,216,115,216,216,216,216,216,
+216,216,216,216,216,216,216,216,216,216,216,216,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-195,195,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+210,210,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 211 */
+/* block 226 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
@@ -3497,7 +3746,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 212 */
+/* block 227 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,
@@ -3507,7 +3756,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,
-/* block 213 */
+/* block 228 */
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,
@@ -3517,67 +3766,107 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 214 */
+/* block 229 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,742,742,742,742,742,742,742,742,742,742,
-742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,
+115,115,115,115,115,115,816,816,816,816,816,816,816,816,816,816,
+816,816,816,816,816,816,816,816,816,816,816,816,816,816,816,816,
-/* block 215 */
-743, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,115,
+/* block 230 */
+817, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,
19, 19,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 216 */
+/* block 231 */
+ 19, 19, 19, 19, 19, 19, 19, 19,479, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,479, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19,479, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+
+/* block 232 */
+ 19, 19, 19, 19, 19,478, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19,479, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19,479, 19, 19, 19,479, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19,478,478,478, 19, 19,478, 19, 19,478,478,478, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 14, 14, 14, 14, 14,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,479, 19,479, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,818,818,818,818,818,
-/* block 217 */
+/* block 233 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19,478,478, 19, 19,478,478,478,478,478,478,478,478,478,478,
+478, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19,819,819,819,819, 19, 19, 19, 19,478, 19,
+478,478,478,478,478,478,478,478,478, 19, 19, 19,478, 19, 19, 19,
+
+/* block 234 */
+ 19,478,478,478, 19,478,478,478, 19, 19, 19,479, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,478, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,479,479, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115, 19, 19, 19, 19, 19,
-/* block 218 */
+/* block 235 */
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19,479, 19, 19, 19, 19,479, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19,115, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19,478,478, 19, 19, 19, 19,478, 19, 19, 19, 19, 19,
+
+/* block 236 */
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+478, 19, 19, 19, 19,478,478, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,479, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 219 */
+/* block 237 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19,478,478,478, 19, 19, 19,478,478,478,478,478,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+
+/* block 238 */
+479, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19,479, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19,478, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19,478,478,478, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+478, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,478, 19, 19, 19,
+ 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,
- 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,
-/* block 220 */
+/* block 239 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -3587,7 +3876,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 221 */
+/* block 240 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -3597,7 +3886,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 222 */
+/* block 241 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -3607,7 +3896,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-/* block 223 */
+/* block 242 */
19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,
@@ -3617,97 +3906,107 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 224 */
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
- 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+/* block 243 */
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19,478,478,478,478,478, 19,478,478,
+ 19, 19, 19, 19, 19, 19,478, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+478,478,478,478,478,478,478,478,478,478, 19, 19, 19,478,478,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-/* block 225 */
- 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+/* block 244 */
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
19,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+ 19,478,478,478,478,478,478,478,478,478,478,478,478,478, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19,115,115,115,115,115,115,115,115,115,
115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-
-/* block 226 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-
-/* block 227 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,115,115,115,115,115,115,115,115,115,115,115,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-
-/* block 228 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,115,115,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-
-/* block 229 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-
-/* block 230 */
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
-485,485,485,485,485,485,485,485,485,485,485,485,485,485,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
-
-/* block 231 */
-437, 22,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-
-/* block 232 */
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-/* block 233 */
+/* block 245 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 246 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,115,115,115,115,115,115,115,115,115,115,115,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+
+/* block 247 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,115,115,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+
+/* block 248 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+
+/* block 249 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 250 */
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,
+515,515,515,515,515,515,515,515,515,515,515,515,515,515,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,
+
+/* block 251 */
+465, 22,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
+820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
+820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
+820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
+820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
+820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
+
+/* block 252 */
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+
+/* block 253 */
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
@@ -3717,7 +4016,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
-/* block 234 */
+/* block 254 */
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
@@ -3725,17 +4024,17 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 60416 bytes, block = 128 */
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
-437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,
-
-/* block 235 */
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
-557,557,557,557,557,557,557,557,557,557,557,557,557,557,115,115,
+465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,
+
+/* block 255 */
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,115,115,
};
diff --git a/thirdparty/pcre2/src/pcre2_ucp.h b/thirdparty/pcre2/src/pcre2_ucp.h
index 02e5012c29..defba4c10e 100644
--- a/thirdparty/pcre2/src/pcre2_ucp.h
+++ b/thirdparty/pcre2/src/pcre2_ucp.h
@@ -100,9 +100,7 @@ enum {
ucp_Zs /* Space separator */
};
-/* These are grapheme break properties. Note that the code for processing them
-assumes that the values are less than 16. If more values are added that take
-the number to 16 or more, the code will have to be rewritten. */
+/* These are grapheme break properties. */
enum {
ucp_gbCR, /* 0 */
@@ -117,7 +115,12 @@ enum {
ucp_gbLV, /* 9 Hangul syllable type LV */
ucp_gbLVT, /* 10 Hangul syllable type LVT */
ucp_gbRegionalIndicator, /* 11 */
- ucp_gbOther /* 12 */
+ ucp_gbOther, /* 12 */
+ ucp_gbE_Base, /* 13 */
+ ucp_gbE_Modifier, /* 14 */
+ ucp_gbE_Base_GAZ, /* 15 */
+ ucp_gbZWJ, /* 16 */
+ ucp_gbGlue_After_Zwj /* 17 */
};
/* These are the script identifications. */
@@ -184,13 +187,13 @@ enum {
ucp_Tifinagh,
ucp_Ugaritic,
ucp_Yi,
- /* New for Unicode 5.0: */
+ /* New for Unicode 5.0 */
ucp_Balinese,
ucp_Cuneiform,
ucp_Nko,
ucp_Phags_Pa,
ucp_Phoenician,
- /* New for Unicode 5.1: */
+ /* New for Unicode 5.1 */
ucp_Carian,
ucp_Cham,
ucp_Kayah_Li,
@@ -202,7 +205,7 @@ enum {
ucp_Saurashtra,
ucp_Sundanese,
ucp_Vai,
- /* New for Unicode 5.2: */
+ /* New for Unicode 5.2 */
ucp_Avestan,
ucp_Bamum,
ucp_Egyptian_Hieroglyphs,
@@ -218,11 +221,11 @@ enum {
ucp_Samaritan,
ucp_Tai_Tham,
ucp_Tai_Viet,
- /* New for Unicode 6.0.0: */
+ /* New for Unicode 6.0.0 */
ucp_Batak,
ucp_Brahmi,
ucp_Mandaic,
- /* New for Unicode 6.1.0: */
+ /* New for Unicode 6.1.0 */
ucp_Chakma,
ucp_Meroitic_Cursive,
ucp_Meroitic_Hieroglyphs,
@@ -230,7 +233,7 @@ enum {
ucp_Sharada,
ucp_Sora_Sompeng,
ucp_Takri,
- /* New for Unicode 7.0.0: */
+ /* New for Unicode 7.0.0 */
ucp_Bassa_Vah,
ucp_Caucasian_Albanian,
ucp_Duployan,
@@ -254,13 +257,24 @@ enum {
ucp_Siddham,
ucp_Tirhuta,
ucp_Warang_Citi,
- /* New for Unicode 8.0.0: */
+ /* New for Unicode 8.0.0 */
ucp_Ahom,
ucp_Anatolian_Hieroglyphs,
ucp_Hatran,
ucp_Multani,
ucp_Old_Hungarian,
- ucp_SignWriting
+ ucp_SignWriting,
+ /* New for Unicode 10.0.0 (no update since 8.0.0) */
+ ucp_Adlam,
+ ucp_Bhaiksuki,
+ ucp_Marchen,
+ ucp_Newa,
+ ucp_Osage,
+ ucp_Tangut,
+ ucp_Masaram_Gondi,
+ ucp_Nushu,
+ ucp_Soyombo,
+ ucp_Zanabazar_Square
};
#endif /* PCRE2_UCP_H_IDEMPOTENT_GUARD */
diff --git a/thirdparty/pcre2/src/pcre2_valid_utf.c b/thirdparty/pcre2/src/pcre2_valid_utf.c
index 3e18f1200b..96e8bff993 100644
--- a/thirdparty/pcre2/src/pcre2_valid_utf.c
+++ b/thirdparty/pcre2/src/pcre2_valid_utf.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016 University of Cambridge
+ New API code Copyright (c) 2016-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -142,20 +142,20 @@ for (p = string; length > 0; p++)
if (c < 0xc0) /* Isolated 10xx xxxx byte */
{
- *erroroffset = (int)(p - string);
+ *erroroffset = (PCRE2_SIZE)(p - string);
return PCRE2_ERROR_UTF8_ERR20;
}
if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */
{
- *erroroffset = (int)(p - string);
+ *erroroffset = (PCRE2_SIZE)(p - string);
return PCRE2_ERROR_UTF8_ERR21;
}
ab = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes (1-5) */
if (length < ab) /* Missing bytes */
{
- *erroroffset = (int)(p - string);
+ *erroroffset = (PCRE2_SIZE)(p - string);
switch(ab - length)
{
case 1: return PCRE2_ERROR_UTF8_ERR1;
diff --git a/thirdparty/pcre2/src/sljit/sljitConfig.h b/thirdparty/pcre2/src/sljit/sljitConfig.h
index 2e70224da8..d54b5e6f54 100644
--- a/thirdparty/pcre2/src/sljit/sljitConfig.h
+++ b/thirdparty/pcre2/src/sljit/sljitConfig.h
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -108,8 +108,10 @@
/* Force cdecl calling convention even if a better calling
convention (e.g. fastcall) is supported by the C compiler.
- If this option is enabled, C functions without
- SLJIT_CALL can also be called from JIT code. */
+ If this option is disabled (this is the default), functions
+ called from JIT should be defined with SLJIT_FUNC attribute.
+ Standard C functions can still be called by using the
+ SLJIT_CALL_CDECL jump type. */
#ifndef SLJIT_USE_CDECL_CALLING_CONVENTION
/* Disabled by default */
#define SLJIT_USE_CDECL_CALLING_CONVENTION 0
diff --git a/thirdparty/pcre2/src/sljit/sljitConfigInternal.h b/thirdparty/pcre2/src/sljit/sljitConfigInternal.h
index 5d461017e4..e13282c842 100644
--- a/thirdparty/pcre2/src/sljit/sljitConfigInternal.h
+++ b/thirdparty/pcre2/src/sljit/sljitConfigInternal.h
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -60,11 +60,13 @@
a single precision floating point array by index
SLJIT_F64_SHIFT : the shift required to apply when accessing
a double precision floating point array by index
+ SLJIT_PREF_SHIFT_REG : x86 systems prefers ecx for shifting by register
+ the scratch register index of ecx is stored in this variable
SLJIT_LOCALS_OFFSET : local space starting offset (SLJIT_SP + SLJIT_LOCALS_OFFSET)
SLJIT_RETURN_ADDRESS_OFFSET : a return instruction always adds this offset to the return address
Other macros:
- SLJIT_CALL : C calling convention define for both calling JIT form C and C callbacks for JIT
+ SLJIT_FUNC : calling convention attribute for both calling JIT form C and C calling back from JIT
SLJIT_W(number) : defining 64 bit constants on 64 bit architectures (compiler independent helper)
*/
@@ -296,6 +298,13 @@
#define SLJIT_CACHE_FLUSH(from, to) \
sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from))
+#elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
+
+/* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */
+#define SLJIT_CACHE_FLUSH(from, to) \
+ ppc_cache_flush((from), (to))
+#define SLJIT_CACHE_FLUSH_OWN_IMPL 1
+
#elif (defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
#define SLJIT_CACHE_FLUSH(from, to) \
@@ -308,13 +317,6 @@
#define SLJIT_CACHE_FLUSH(from, to) \
cacheflush((long)(from), (long)(to), 0)
-#elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
-
-/* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */
-#define SLJIT_CACHE_FLUSH(from, to) \
- ppc_cache_flush((from), (to))
-#define SLJIT_CACHE_FLUSH_OWN_IMPL 1
-
#elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
/* The __clear_cache() implementation of GCC is a dummy function on Sparc. */
@@ -393,7 +395,9 @@ typedef double sljit_f64;
#ifndef SLJIT_W
/* Defining long constants. */
-#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
+#if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
+#define SLJIT_W(w) (w##l)
+#elif (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
#define SLJIT_W(w) (w##ll)
#else
#define SLJIT_W(w) (w)
@@ -469,44 +473,44 @@ typedef double sljit_f64;
/* Calling convention of functions generated by SLJIT or called from the generated code. */
/*****************************************************************************************/
-#ifndef SLJIT_CALL
+#ifndef SLJIT_FUNC
#if (defined SLJIT_USE_CDECL_CALLING_CONVENTION && SLJIT_USE_CDECL_CALLING_CONVENTION)
/* Force cdecl. */
-#define SLJIT_CALL
+#define SLJIT_FUNC
#elif (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
#if defined(__GNUC__) && !defined(__APPLE__)
-#define SLJIT_CALL __attribute__ ((fastcall))
+#define SLJIT_FUNC __attribute__ ((fastcall))
#define SLJIT_X86_32_FASTCALL 1
#elif defined(_MSC_VER)
-#define SLJIT_CALL __fastcall
+#define SLJIT_FUNC __fastcall
#define SLJIT_X86_32_FASTCALL 1
#elif defined(__BORLANDC__)
-#define SLJIT_CALL __msfastcall
+#define SLJIT_FUNC __msfastcall
#define SLJIT_X86_32_FASTCALL 1
#else /* Unknown compiler. */
/* The cdecl attribute is the default. */
-#define SLJIT_CALL
+#define SLJIT_FUNC
#endif
#else /* Non x86-32 architectures. */
-#define SLJIT_CALL
+#define SLJIT_FUNC
#endif /* SLJIT_CONFIG_X86_32 */
-#endif /* !SLJIT_CALL */
+#endif /* !SLJIT_FUNC */
#ifndef SLJIT_INDIRECT_CALL
#if ((defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) && (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)) \
@@ -553,48 +557,44 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-#define SLJIT_NUMBER_OF_REGISTERS 10
-#define SLJIT_NUMBER_OF_SAVED_REGISTERS 7
-#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
-#define SLJIT_LOCALS_OFFSET_BASE ((2 + 4) * sizeof(sljit_sw))
-#else
-/* Maximum 3 arguments are passed on the stack, +1 for double alignment. */
-#define SLJIT_LOCALS_OFFSET_BASE ((3 + 1 + 4) * sizeof(sljit_sw))
-#endif /* SLJIT_X86_32_FASTCALL */
+#define SLJIT_NUMBER_OF_REGISTERS 12
+#define SLJIT_NUMBER_OF_SAVED_REGISTERS 9
+#define SLJIT_LOCALS_OFFSET_BASE (compiler->locals_offset)
+#define SLJIT_PREF_SHIFT_REG SLJIT_R2
#elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+#define SLJIT_NUMBER_OF_REGISTERS 13
#ifndef _WIN64
-#define SLJIT_NUMBER_OF_REGISTERS 12
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 6
-#define SLJIT_LOCALS_OFFSET_BASE (sizeof(sljit_sw))
-#else
-#define SLJIT_NUMBER_OF_REGISTERS 12
+#define SLJIT_LOCALS_OFFSET_BASE 0
+#else /* _WIN64 */
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
-#define SLJIT_LOCALS_OFFSET_BASE ((4 + 2) * sizeof(sljit_sw))
-#endif /* _WIN64 */
+#define SLJIT_LOCALS_OFFSET_BASE (compiler->locals_offset)
+#endif /* !_WIN64 */
+#define SLJIT_PREF_SHIFT_REG SLJIT_R3
#elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
-#define SLJIT_NUMBER_OF_REGISTERS 11
+#define SLJIT_NUMBER_OF_REGISTERS 12
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
#define SLJIT_LOCALS_OFFSET_BASE 0
#elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
-#define SLJIT_NUMBER_OF_REGISTERS 11
-#define SLJIT_NUMBER_OF_SAVED_REGISTERS 7
+#define SLJIT_NUMBER_OF_REGISTERS 12
+#define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
#define SLJIT_LOCALS_OFFSET_BASE 0
#elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
-#define SLJIT_NUMBER_OF_REGISTERS 25
+#define SLJIT_NUMBER_OF_REGISTERS 26
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 10
#define SLJIT_LOCALS_OFFSET_BASE (2 * sizeof(sljit_sw))
#elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
-#define SLJIT_NUMBER_OF_REGISTERS 22
+#define SLJIT_NUMBER_OF_REGISTERS 23
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 17
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) || (defined _AIX)
#define SLJIT_LOCALS_OFFSET_BASE ((6 + 8) * sizeof(sljit_sw))
@@ -607,7 +607,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
-#define SLJIT_NUMBER_OF_REGISTERS 17
+#define SLJIT_NUMBER_OF_REGISTERS 21
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
#define SLJIT_LOCALS_OFFSET_BASE (4 * sizeof(sljit_sw))
@@ -620,8 +620,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#define SLJIT_NUMBER_OF_REGISTERS 18
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 14
#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
-/* Add +1 for double alignment. */
-#define SLJIT_LOCALS_OFFSET_BASE ((23 + 1) * sizeof(sljit_sw))
+/* saved registers (16), return struct pointer (1), space for 6 argument words (1),
+ 4th double arg (2), double alignment (1). */
+#define SLJIT_LOCALS_OFFSET_BASE ((16 + 1 + 6 + 2 + 1) * sizeof(sljit_sw))
#endif
#elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
@@ -663,7 +664,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#if (defined SLJIT_DEBUG && SLJIT_DEBUG)
-#if !defined(SLJIT_ASSERT) || !defined(SLJIT_ASSERT_STOP)
+#if !defined(SLJIT_ASSERT) || !defined(SLJIT_UNREACHABLE)
/* SLJIT_HALT_PROCESS must halt the process. */
#ifndef SLJIT_HALT_PROCESS
@@ -675,7 +676,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#include <stdio.h>
-#endif /* !SLJIT_ASSERT || !SLJIT_ASSERT_STOP */
+#endif /* !SLJIT_ASSERT || !SLJIT_UNREACHABLE */
/* Feel free to redefine these two macros. */
#ifndef SLJIT_ASSERT
@@ -690,34 +691,33 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr);
#endif /* !SLJIT_ASSERT */
-#ifndef SLJIT_ASSERT_STOP
+#ifndef SLJIT_UNREACHABLE
-#define SLJIT_ASSERT_STOP() \
+#define SLJIT_UNREACHABLE() \
do { \
printf("Should never been reached " __FILE__ ":%d\n", __LINE__); \
SLJIT_HALT_PROCESS(); \
} while (0)
-#endif /* !SLJIT_ASSERT_STOP */
+#endif /* !SLJIT_UNREACHABLE */
#else /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */
/* Forcing empty, but valid statements. */
#undef SLJIT_ASSERT
-#undef SLJIT_ASSERT_STOP
+#undef SLJIT_UNREACHABLE
#define SLJIT_ASSERT(x) \
do { } while (0)
-#define SLJIT_ASSERT_STOP() \
+#define SLJIT_UNREACHABLE() \
do { } while (0)
#endif /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */
#ifndef SLJIT_COMPILE_ASSERT
-/* Should be improved eventually. */
#define SLJIT_COMPILE_ASSERT(x, description) \
- SLJIT_ASSERT(x)
+ switch(0) { case 0: case ((x) ? 1 : 0): break; }
#endif /* !SLJIT_COMPILE_ASSERT */
diff --git a/thirdparty/pcre2/src/sljit/sljitExecAllocator.c b/thirdparty/pcre2/src/sljit/sljitExecAllocator.c
index 9f88f990b0..f5009788f6 100644
--- a/thirdparty/pcre2/src/sljit/sljitExecAllocator.c
+++ b/thirdparty/pcre2/src/sljit/sljitExecAllocator.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
diff --git a/thirdparty/pcre2/src/sljit/sljitLir.c b/thirdparty/pcre2/src/sljit/sljitLir.c
index 0b39ec90a9..5e435f0154 100644
--- a/thirdparty/pcre2/src/sljit/sljitLir.c
+++ b/thirdparty/pcre2/src/sljit/sljitLir.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -84,17 +84,26 @@
#if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
+#define VARIABLE_FLAG_SHIFT (10)
+#define VARIABLE_FLAG_MASK (0x3f << VARIABLE_FLAG_SHIFT)
+#define GET_FLAG_TYPE(op) ((op) >> VARIABLE_FLAG_SHIFT)
+
#define GET_OPCODE(op) \
- ((op) & ~(SLJIT_I32_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
+ ((op) & ~(SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK))
-#define GET_FLAGS(op) \
- ((op) & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))
+#define HAS_FLAGS(op) \
+ ((op) & (SLJIT_SET_Z | VARIABLE_FLAG_MASK))
#define GET_ALL_FLAGS(op) \
- ((op) & (SLJIT_I32_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
+ ((op) & (SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK))
+#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
+#define TYPE_CAST_NEEDED(op) \
+ ((op) >= SLJIT_MOV_U8 && (op) <= SLJIT_MOV_S32)
+#else
#define TYPE_CAST_NEEDED(op) \
- (((op) >= SLJIT_MOV_U8 && (op) <= SLJIT_MOV_S16) || ((op) >= SLJIT_MOVU_U8 && (op) <= SLJIT_MOVU_S16))
+ ((op) >= SLJIT_MOV_U8 && (op) <= SLJIT_MOV_S16)
+#endif
#define BUF_SIZE 4096
@@ -114,16 +123,19 @@
/* When reg can be unused. */
#define SLOW_IS_REG(reg) ((reg) > 0 && (reg) <= REG_MASK)
+/* Mask for argument types. */
+#define SLJIT_DEF_MASK ((1 << SLJIT_DEF_SHIFT) - 1)
+
/* Jump flags. */
#define JUMP_LABEL 0x1
#define JUMP_ADDR 0x2
/* SLJIT_REWRITABLE_JUMP is 0x1000. */
#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
-# define PATCH_MB 0x4
-# define PATCH_MW 0x8
+# define PATCH_MB 0x4
+# define PATCH_MW 0x8
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-# define PATCH_MD 0x10
+# define PATCH_MD 0x10
#endif
#endif
@@ -338,7 +350,7 @@
/* Public functions */
/* --------------------------------------------------------------------- */
-#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
#define SLJIT_NEEDS_COMPILER_INIT 1
static sljit_s32 compiler_initialized = 0;
/* A thread safe initialization. */
@@ -365,6 +377,8 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void *allo
int_op_and_single_op_must_be_the_same);
SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_F32_OP,
rewritable_jump_and_single_op_must_not_be_the_same);
+ SLJIT_COMPILE_ASSERT(!(SLJIT_EQUAL & 0x1) && !(SLJIT_LESS & 0x1) && !(SLJIT_EQUAL_F64 & 0x1) && !(SLJIT_JUMP & 0x1),
+ conditional_flags_must_be_even_numbers);
/* Only the non-zero members must be set. */
compiler->error = SLJIT_SUCCESS;
@@ -499,6 +513,18 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw
}
}
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(current_flags);
+
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ if ((current_flags & ~(VARIABLE_FLAG_MASK | SLJIT_I32_OP | SLJIT_SET_Z)) == 0) {
+ compiler->last_flags = GET_FLAG_TYPE(current_flags) | (current_flags & (SLJIT_I32_OP | SLJIT_SET_Z));
+ }
+#endif
+}
+
/* --------------------------------------------------------------------- */
/* Private functions */
/* --------------------------------------------------------------------- */
@@ -573,6 +599,19 @@ static SLJIT_INLINE void reverse_buf(struct sljit_compiler *compiler)
compiler->buf = prev;
}
+static SLJIT_INLINE sljit_s32 get_arg_count(sljit_s32 arg_types)
+{
+ sljit_s32 arg_count = 0;
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ while (arg_types) {
+ arg_count++;
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ return arg_count;
+}
+
static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler,
sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
@@ -644,150 +683,109 @@ static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_comp
(((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg))
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
-#define FUNCTION_CHECK_OP() \
- CHECK_ARGUMENT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
- switch (GET_OPCODE(op)) { \
- case SLJIT_NOT: \
- case SLJIT_CLZ: \
- case SLJIT_AND: \
- case SLJIT_OR: \
- case SLJIT_XOR: \
- case SLJIT_SHL: \
- case SLJIT_LSHR: \
- case SLJIT_ASHR: \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))); \
- break; \
- case SLJIT_NEG: \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
- break; \
- case SLJIT_MUL: \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
- break; \
- case SLJIT_ADD: \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_S))); \
- break; \
- case SLJIT_SUB: \
- break; \
- case SLJIT_ADDC: \
- case SLJIT_SUBC: \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O))); \
- break; \
- case SLJIT_BREAKPOINT: \
- case SLJIT_NOP: \
- case SLJIT_LMUL_UW: \
- case SLJIT_LMUL_SW: \
- case SLJIT_MOV: \
- case SLJIT_MOV_U32: \
- case SLJIT_MOV_P: \
- case SLJIT_MOVU: \
- case SLJIT_MOVU_U32: \
- case SLJIT_MOVU_P: \
- /* Nothing allowed */ \
- CHECK_ARGUMENT(!(op & (SLJIT_I32_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
- break; \
- default: \
- /* Only SLJIT_I32_OP or SLJIT_F32_OP is allowed. */ \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
- break; \
- }
-
-#define FUNCTION_CHECK_FOP() \
- CHECK_ARGUMENT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
- switch (GET_OPCODE(op)) { \
- case SLJIT_CMP_F64: \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
- CHECK_ARGUMENT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
- break; \
- default: \
- /* Only SLJIT_I32_OP or SLJIT_F32_OP is allowed. */ \
- CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
- break; \
- }
#define FUNCTION_CHECK_IS_REG(r) \
- (((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
- ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
+ (((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) \
+ || ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
-#define FUNCTION_CHECK_IS_REG_OR_UNUSED(r) \
- ((r) == SLJIT_UNUSED || \
- ((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
- ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
+#define FUNCTION_CHECK_IS_FREG(fr) \
+ (((fr) >= SLJIT_FR0 && (fr) < (SLJIT_FR0 + compiler->fscratches)) \
+ || ((fr) > (SLJIT_FS0 - compiler->fsaveds) && (fr) <= SLJIT_FS0))
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-#define CHECK_NOT_VIRTUAL_REGISTER(p) \
- CHECK_ARGUMENT((p) < SLJIT_R3 || (p) > SLJIT_R6);
+#define CHECK_IF_VIRTUAL_REGISTER(p) ((p) <= SLJIT_S3 && (p) >= SLJIT_S8)
#else
-#define CHECK_NOT_VIRTUAL_REGISTER(p)
+#define CHECK_IF_VIRTUAL_REGISTER(p) 0
#endif
-#define FUNCTION_CHECK_SRC(p, i) \
- CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1); \
- if (FUNCTION_CHECK_IS_REG(p)) \
- CHECK_ARGUMENT((i) == 0); \
- else if ((p) == SLJIT_IMM) \
- ; \
- else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
- CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
- else { \
- CHECK_ARGUMENT((p) & SLJIT_MEM); \
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG_OR_UNUSED((p) & REG_MASK)); \
- CHECK_NOT_VIRTUAL_REGISTER((p) & REG_MASK); \
- if ((p) & OFFS_REG_MASK) { \
- CHECK_ARGUMENT(((p) & REG_MASK) != SLJIT_UNUSED); \
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
- CHECK_NOT_VIRTUAL_REGISTER(OFFS_REG(p)); \
- CHECK_ARGUMENT(!((i) & ~0x3)); \
- } \
- CHECK_ARGUMENT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
- }
+static sljit_s32 function_check_src_mem(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
+{
+ if (compiler->scratches == -1 || compiler->saveds == -1)
+ return 0;
-#define FUNCTION_CHECK_DST(p, i) \
- CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1); \
- if (FUNCTION_CHECK_IS_REG_OR_UNUSED(p)) \
- CHECK_ARGUMENT((i) == 0); \
- else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
- CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
- else { \
- CHECK_ARGUMENT((p) & SLJIT_MEM); \
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG_OR_UNUSED((p) & REG_MASK)); \
- CHECK_NOT_VIRTUAL_REGISTER((p) & REG_MASK); \
- if ((p) & OFFS_REG_MASK) { \
- CHECK_ARGUMENT(((p) & REG_MASK) != SLJIT_UNUSED); \
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
- CHECK_NOT_VIRTUAL_REGISTER(OFFS_REG(p)); \
- CHECK_ARGUMENT(!((i) & ~0x3)); \
- } \
- CHECK_ARGUMENT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
- }
+ if (!(p & SLJIT_MEM))
+ return 0;
-#define FUNCTION_FCHECK(p, i) \
- CHECK_ARGUMENT(compiler->fscratches != -1 && compiler->fsaveds != -1); \
- if (((p) >= SLJIT_FR0 && (p) < (SLJIT_FR0 + compiler->fscratches)) || \
- ((p) > (SLJIT_FS0 - compiler->fsaveds) && (p) <= SLJIT_FS0)) \
- CHECK_ARGUMENT(i == 0); \
- else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
- CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
- else { \
- CHECK_ARGUMENT((p) & SLJIT_MEM); \
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG_OR_UNUSED((p) & REG_MASK)); \
- CHECK_NOT_VIRTUAL_REGISTER((p) & REG_MASK); \
- if ((p) & OFFS_REG_MASK) { \
- CHECK_ARGUMENT(((p) & REG_MASK) != SLJIT_UNUSED); \
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
- CHECK_NOT_VIRTUAL_REGISTER(OFFS_REG(p)); \
- CHECK_ARGUMENT(((p) & OFFS_REG_MASK) != TO_OFFS_REG(SLJIT_SP) && !(i & ~0x3)); \
- } \
- CHECK_ARGUMENT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
- }
+ if (!((p & REG_MASK) == SLJIT_UNUSED || FUNCTION_CHECK_IS_REG(p & REG_MASK)))
+ return 0;
+
+ if (CHECK_IF_VIRTUAL_REGISTER(p & REG_MASK))
+ return 0;
+
+ if (p & OFFS_REG_MASK) {
+ if ((p & REG_MASK) == SLJIT_UNUSED)
+ return 0;
+
+ if (!(FUNCTION_CHECK_IS_REG(OFFS_REG(p))))
+ return 0;
-#define FUNCTION_CHECK_OP1() \
- if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
- CHECK_ARGUMENT(!(src & SLJIT_MEM) || (src & REG_MASK) != SLJIT_SP); \
- CHECK_ARGUMENT(!(dst & SLJIT_MEM) || (dst & REG_MASK) != SLJIT_SP); \
- if ((src & SLJIT_MEM) && (src & REG_MASK)) \
- CHECK_ARGUMENT((dst & REG_MASK) != (src & REG_MASK) && OFFS_REG(dst) != (src & REG_MASK)); \
+ if (CHECK_IF_VIRTUAL_REGISTER(OFFS_REG(p)))
+ return 0;
+
+ if ((i & ~0x3) != 0)
+ return 0;
}
+ return (p & ~(SLJIT_MEM | REG_MASK | OFFS_REG_MASK)) == 0;
+}
+
+#define FUNCTION_CHECK_SRC_MEM(p, i) \
+ CHECK_ARGUMENT(function_check_src_mem(compiler, p, i));
+
+static sljit_s32 function_check_src(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
+{
+ if (compiler->scratches == -1 || compiler->saveds == -1)
+ return 0;
+
+ if (FUNCTION_CHECK_IS_REG(p))
+ return (i == 0);
+
+ if (p == SLJIT_IMM)
+ return 1;
+
+ if (p == SLJIT_MEM1(SLJIT_SP))
+ return (i >= 0 && i < compiler->logical_local_size);
+
+ return function_check_src_mem(compiler, p, i);
+}
+
+#define FUNCTION_CHECK_SRC(p, i) \
+ CHECK_ARGUMENT(function_check_src(compiler, p, i));
+
+static sljit_s32 function_check_dst(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i, sljit_s32 unused)
+{
+ if (compiler->scratches == -1 || compiler->saveds == -1)
+ return 0;
+
+ if (FUNCTION_CHECK_IS_REG(p) || ((unused) && (p) == SLJIT_UNUSED))
+ return (i == 0);
+
+ if (p == SLJIT_MEM1(SLJIT_SP))
+ return (i >= 0 && i < compiler->logical_local_size);
+
+ return function_check_src_mem(compiler, p, i);
+}
+
+#define FUNCTION_CHECK_DST(p, i, unused) \
+ CHECK_ARGUMENT(function_check_dst(compiler, p, i, unused));
+
+static sljit_s32 function_fcheck(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
+{
+ if (compiler->scratches == -1 || compiler->saveds == -1)
+ return 0;
+
+ if (FUNCTION_CHECK_IS_FREG(p))
+ return (i == 0);
+
+ if (p == SLJIT_MEM1(SLJIT_SP))
+ return (i >= 0 && i < compiler->logical_local_size);
+
+ return function_check_src_mem(compiler, p, i);
+}
+
+#define FUNCTION_FCHECK(p, i) \
+ CHECK_ARGUMENT(function_fcheck(compiler, p, i));
+
#endif /* SLJIT_ARGUMENT_CHECKS */
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
@@ -807,62 +805,72 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *comp
# define SLJIT_PRINT_D ""
#endif
-#define sljit_verbose_reg(compiler, r) \
- do { \
- if ((r) < (SLJIT_R0 + compiler->scratches)) \
- fprintf(compiler->verbose, "r%d", (r) - SLJIT_R0); \
- else \
- fprintf(compiler->verbose, "s%d", SLJIT_NUMBER_OF_REGISTERS - (r)); \
- } while (0)
+static void sljit_verbose_reg(struct sljit_compiler *compiler, sljit_s32 r)
+{
+ if (r < (SLJIT_R0 + compiler->scratches))
+ fprintf(compiler->verbose, "r%d", r - SLJIT_R0);
+ else if (r != SLJIT_SP)
+ fprintf(compiler->verbose, "s%d", SLJIT_NUMBER_OF_REGISTERS - r);
+ else
+ fprintf(compiler->verbose, "sp");
+}
-#define sljit_verbose_param(compiler, p, i) \
- if ((p) & SLJIT_IMM) \
- fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \
- else if ((p) & SLJIT_MEM) { \
- if ((p) & REG_MASK) { \
- fputc('[', compiler->verbose); \
- sljit_verbose_reg(compiler, (p) & REG_MASK); \
- if ((p) & OFFS_REG_MASK) { \
- fprintf(compiler->verbose, " + "); \
- sljit_verbose_reg(compiler, OFFS_REG(p)); \
- if (i) \
- fprintf(compiler->verbose, " * %d", 1 << (i)); \
- } \
- else if (i) \
- fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i)); \
- fputc(']', compiler->verbose); \
- } \
- else \
- fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
- } else if (p) \
- sljit_verbose_reg(compiler, p); \
- else \
+static void sljit_verbose_freg(struct sljit_compiler *compiler, sljit_s32 r)
+{
+ if (r < (SLJIT_FR0 + compiler->fscratches))
+ fprintf(compiler->verbose, "fr%d", r - SLJIT_FR0);
+ else
+ fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - r);
+}
+
+static void sljit_verbose_param(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
+{
+ if ((p) & SLJIT_IMM)
+ fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i));
+ else if ((p) & SLJIT_MEM) {
+ if ((p) & REG_MASK) {
+ fputc('[', compiler->verbose);
+ sljit_verbose_reg(compiler, (p) & REG_MASK);
+ if ((p) & OFFS_REG_MASK) {
+ fprintf(compiler->verbose, " + ");
+ sljit_verbose_reg(compiler, OFFS_REG(p));
+ if (i)
+ fprintf(compiler->verbose, " * %d", 1 << (i));
+ }
+ else if (i)
+ fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i));
+ fputc(']', compiler->verbose);
+ }
+ else
+ fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i));
+ } else if (p)
+ sljit_verbose_reg(compiler, p);
+ else
fprintf(compiler->verbose, "unused");
+}
-#define sljit_verbose_fparam(compiler, p, i) \
- if ((p) & SLJIT_MEM) { \
- if ((p) & REG_MASK) { \
- fputc('[', compiler->verbose); \
- sljit_verbose_reg(compiler, (p) & REG_MASK); \
- if ((p) & OFFS_REG_MASK) { \
- fprintf(compiler->verbose, " + "); \
- sljit_verbose_reg(compiler, OFFS_REG(p)); \
- if (i) \
- fprintf(compiler->verbose, "%d", 1 << (i)); \
- } \
- else if (i) \
- fprintf(compiler->verbose, "%" SLJIT_PRINT_D "d", (i)); \
- fputc(']', compiler->verbose); \
- } \
- else \
- fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
- } \
- else { \
- if ((p) < (SLJIT_FR0 + compiler->fscratches)) \
- fprintf(compiler->verbose, "fr%d", (p) - SLJIT_FR0); \
- else \
- fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - (p)); \
+static void sljit_verbose_fparam(struct sljit_compiler *compiler, sljit_s32 p, sljit_sw i)
+{
+ if ((p) & SLJIT_MEM) {
+ if ((p) & REG_MASK) {
+ fputc('[', compiler->verbose);
+ sljit_verbose_reg(compiler, (p) & REG_MASK);
+ if ((p) & OFFS_REG_MASK) {
+ fprintf(compiler->verbose, " + ");
+ sljit_verbose_reg(compiler, OFFS_REG(p));
+ if (i)
+ fprintf(compiler->verbose, "%d", 1 << (i));
+ }
+ else if (i)
+ fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i));
+ fputc(']', compiler->verbose);
+ }
+ else
+ fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i));
}
+ else
+ sljit_verbose_freg(compiler, p);
+}
static const char* op0_names[] = {
(char*)"breakpoint", (char*)"nop", (char*)"lmul.uw", (char*)"lmul.sw",
@@ -905,12 +913,17 @@ static char* jump_names[] = {
(char*)"sig_greater", (char*)"sig_less_equal",
(char*)"overflow", (char*)"not_overflow",
(char*)"mul_overflow", (char*)"mul_not_overflow",
+ (char*)"carry", (char*)"",
(char*)"equal", (char*)"not_equal",
(char*)"less", (char*)"greater_equal",
(char*)"greater", (char*)"less_equal",
(char*)"unordered", (char*)"ordered",
(char*)"jump", (char*)"fast_call",
- (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
+ (char*)"call", (char*)"call.cdecl"
+};
+
+static char* call_arg_names[] = {
+ (char*)"void", (char*)"sw", (char*)"uw", (char*)"s32", (char*)"u32", (char*)"f32", (char*)"f64"
};
#endif /* SLJIT_VERBOSE */
@@ -943,56 +956,104 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_generate_code(struct sljit_com
}
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ sljit_s32 types, arg_count, curr_type;
+#endif
+
SLJIT_UNUSED_ARG(compiler);
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(!(options & ~SLJIT_DOUBLE_ALIGNMENT));
- CHECK_ARGUMENT(args >= 0 && args <= 3);
+ CHECK_ARGUMENT(!(options & ~SLJIT_F64_ALIGNMENT));
CHECK_ARGUMENT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS);
CHECK_ARGUMENT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS);
CHECK_ARGUMENT(scratches + saveds <= SLJIT_NUMBER_OF_REGISTERS);
- CHECK_ARGUMENT(args <= saveds);
CHECK_ARGUMENT(fscratches >= 0 && fscratches <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
CHECK_ARGUMENT(fsaveds >= 0 && fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
CHECK_ARGUMENT(fscratches + fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
CHECK_ARGUMENT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
+ CHECK_ARGUMENT((arg_types & SLJIT_DEF_MASK) == 0);
+
+ types = (arg_types >> SLJIT_DEF_SHIFT);
+ arg_count = 0;
+ while (types != 0 && arg_count < 3) {
+ curr_type = (types & SLJIT_DEF_MASK);
+ CHECK_ARGUMENT(curr_type == SLJIT_ARG_TYPE_SW || curr_type == SLJIT_ARG_TYPE_UW);
+ arg_count++;
+ types >>= SLJIT_DEF_SHIFT;
+ }
+ CHECK_ARGUMENT(arg_count <= saveds && types == 0);
+
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
- if (SLJIT_UNLIKELY(!!compiler->verbose))
- fprintf(compiler->verbose, " enter options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
- args, scratches, saveds, fscratches, fsaveds, local_size);
+ if (SLJIT_UNLIKELY(!!compiler->verbose)) {
+ fprintf(compiler->verbose, " enter options:%s args[", (options & SLJIT_F64_ALIGNMENT) ? "f64_align" : "");
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ while (arg_types) {
+ fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
+ arg_types >>= SLJIT_DEF_SHIFT;
+ if (arg_types)
+ fprintf(compiler->verbose, ",");
+ }
+
+ fprintf(compiler->verbose, "] scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
+ scratches, saveds, fscratches, fsaveds, local_size);
+ }
#endif
CHECK_RETURN_OK;
}
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- if (SLJIT_UNLIKELY(compiler->skip_checks)) {
- compiler->skip_checks = 0;
- CHECK_RETURN_OK;
- }
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ sljit_s32 types, arg_count, curr_type;
+#endif
+
+ SLJIT_UNUSED_ARG(compiler);
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(!(options & ~SLJIT_DOUBLE_ALIGNMENT));
- CHECK_ARGUMENT(args >= 0 && args <= 3);
+ CHECK_ARGUMENT(!(options & ~SLJIT_F64_ALIGNMENT));
CHECK_ARGUMENT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS);
CHECK_ARGUMENT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS);
CHECK_ARGUMENT(scratches + saveds <= SLJIT_NUMBER_OF_REGISTERS);
- CHECK_ARGUMENT(args <= saveds);
CHECK_ARGUMENT(fscratches >= 0 && fscratches <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
CHECK_ARGUMENT(fsaveds >= 0 && fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
CHECK_ARGUMENT(fscratches + fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
CHECK_ARGUMENT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
+
+ types = (arg_types >> SLJIT_DEF_SHIFT);
+ arg_count = 0;
+ while (types != 0 && arg_count < 3) {
+ curr_type = (types & SLJIT_DEF_MASK);
+ CHECK_ARGUMENT(curr_type == SLJIT_ARG_TYPE_SW || curr_type == SLJIT_ARG_TYPE_UW);
+ arg_count++;
+ types >>= SLJIT_DEF_SHIFT;
+ }
+ CHECK_ARGUMENT(arg_count <= saveds && types == 0);
+
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
- if (SLJIT_UNLIKELY(!!compiler->verbose))
- fprintf(compiler->verbose, " set_context options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
- args, scratches, saveds, fscratches, fsaveds, local_size);
+ if (SLJIT_UNLIKELY(!!compiler->verbose)) {
+ fprintf(compiler->verbose, " set_context options:%s args[", (options & SLJIT_F64_ALIGNMENT) ? "f64_align" : "");
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ while (arg_types) {
+ fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
+ arg_types >>= SLJIT_DEF_SHIFT;
+ if (arg_types)
+ fprintf(compiler->verbose, ",");
+ }
+
+ fprintf(compiler->verbose, "] scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
+ scratches, saveds, fscratches, fsaveds, local_size);
+ }
#endif
CHECK_RETURN_OK;
}
@@ -1007,6 +1068,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compi
}
else
CHECK_ARGUMENT(src == 0 && srcw == 0);
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1025,7 +1087,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compi
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
{
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- FUNCTION_CHECK_DST(dst, dstw);
+ FUNCTION_CHECK_DST(dst, dstw, 0);
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1041,6 +1104,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_return(struct sljit_
{
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
FUNCTION_CHECK_SRC(src, srcw);
+ CHECK_ARGUMENT(src != SLJIT_IMM);
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1058,6 +1123,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op0(struct sljit_compiler
CHECK_ARGUMENT((op >= SLJIT_BREAKPOINT && op <= SLJIT_LMUL_SW)
|| ((op & ~SLJIT_I32_OP) >= SLJIT_DIVMOD_UW && (op & ~SLJIT_I32_OP) <= SLJIT_DIV_SW));
CHECK_ARGUMENT(op < SLJIT_LMUL_UW || compiler->scratches >= 2);
+ if (op >= SLJIT_LMUL_UW)
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose))
@@ -1083,23 +1150,48 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_CLZ);
- FUNCTION_CHECK_OP();
+
+ switch (GET_OPCODE(op)) {
+ case SLJIT_NOT:
+ /* Only SLJIT_I32_OP and SLJIT_SET_Z are allowed. */
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK));
+ break;
+ case SLJIT_NEG:
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
+ || GET_FLAG_TYPE(op) == SLJIT_OVERFLOW);
+ break;
+ case SLJIT_MOV:
+ case SLJIT_MOV_U32:
+ case SLJIT_MOV_P:
+ /* Nothing allowed */
+ CHECK_ARGUMENT(!(op & (SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
+ break;
+ default:
+ /* Only SLJIT_I32_OP is allowed. */
+ CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
+ break;
+ }
+
+ FUNCTION_CHECK_DST(dst, dstw, 1);
FUNCTION_CHECK_SRC(src, srcw);
- FUNCTION_CHECK_DST(dst, dstw);
- FUNCTION_CHECK_OP1();
+
+ if (GET_OPCODE(op) >= SLJIT_NOT) {
+ CHECK_ARGUMENT(src != SLJIT_IMM);
+ compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
+ }
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
- if (GET_OPCODE(op) <= SLJIT_MOVU_P)
+ if (GET_OPCODE(op) <= SLJIT_MOV_P)
{
- fprintf(compiler->verbose, " mov%s%s%s ", (GET_OPCODE(op) >= SLJIT_MOVU) ? "u" : "",
- !(op & SLJIT_I32_OP) ? "" : "32", (op != SLJIT_MOV32 && op != SLJIT_MOVU32) ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : "");
+ fprintf(compiler->verbose, " mov%s%s ", !(op & SLJIT_I32_OP) ? "" : "32",
+ (op != SLJIT_MOV32) ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : "");
}
else
{
- fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
- !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
- !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
+ fprintf(compiler->verbose, " %s%s%s%s%s ", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
+ !(op & SLJIT_SET_Z) ? "" : ".z", !(op & VARIABLE_FLAG_MASK) ? "" : ".",
+ !(op & VARIABLE_FLAG_MASK) ? "" : jump_names[GET_FLAG_TYPE(op)]);
}
sljit_verbose_param(compiler, dst, dstw);
@@ -1123,16 +1215,53 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_ADD && GET_OPCODE(op) <= SLJIT_ASHR);
- FUNCTION_CHECK_OP();
+
+ switch (GET_OPCODE(op)) {
+ case SLJIT_AND:
+ case SLJIT_OR:
+ case SLJIT_XOR:
+ case SLJIT_SHL:
+ case SLJIT_LSHR:
+ case SLJIT_ASHR:
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK));
+ break;
+ case SLJIT_MUL:
+ CHECK_ARGUMENT(!(op & SLJIT_SET_Z));
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
+ || GET_FLAG_TYPE(op) == SLJIT_MUL_OVERFLOW);
+ break;
+ case SLJIT_ADD:
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
+ || GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)
+ || GET_FLAG_TYPE(op) == SLJIT_OVERFLOW);
+ break;
+ case SLJIT_SUB:
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
+ || (GET_FLAG_TYPE(op) >= SLJIT_LESS && GET_FLAG_TYPE(op) <= SLJIT_OVERFLOW)
+ || GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
+ break;
+ case SLJIT_ADDC:
+ case SLJIT_SUBC:
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
+ || GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
+ CHECK_ARGUMENT((compiler->last_flags & 0xff) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
+ CHECK_ARGUMENT((op & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
+ break;
+ default:
+ SLJIT_UNREACHABLE();
+ break;
+ }
+
+ FUNCTION_CHECK_DST(dst, dstw, 1);
FUNCTION_CHECK_SRC(src1, src1w);
FUNCTION_CHECK_SRC(src2, src2w);
- FUNCTION_CHECK_DST(dst, dstw);
+ compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
- fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
- !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
- !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
+ fprintf(compiler->verbose, " %s%s%s%s%s ", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
+ !(op & SLJIT_SET_Z) ? "" : ".z", !(op & VARIABLE_FLAG_MASK) ? "" : ".",
+ !(op & VARIABLE_FLAG_MASK) ? "" : jump_names[GET_FLAG_TYPE(op)]);
sljit_verbose_param(compiler, dst, dstw);
fprintf(compiler->verbose, ", ");
sljit_verbose_param(compiler, src1, src1w);
@@ -1173,6 +1302,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_custom(struct sljit_co
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
CHECK_ARGUMENT(instruction);
+
#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
CHECK_ARGUMENT(size > 0 && size < 16);
#elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
@@ -1182,6 +1312,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_custom(struct sljit_co
CHECK_ARGUMENT(size == 4 && (((sljit_sw)instruction) & 0x3) == 0);
#endif
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1204,9 +1335,9 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compile
}
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_is_fpu_available());
+ CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_MOV_F64 && GET_OPCODE(op) <= SLJIT_ABS_F64);
- FUNCTION_CHECK_FOP();
+ CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
FUNCTION_FCHECK(src, srcw);
FUNCTION_FCHECK(dst, dstw);
#endif
@@ -1232,22 +1363,31 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_com
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
+#endif
+
if (SLJIT_UNLIKELY(compiler->skip_checks)) {
compiler->skip_checks = 0;
CHECK_RETURN_OK;
}
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_is_fpu_available());
+ CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
CHECK_ARGUMENT(GET_OPCODE(op) == SLJIT_CMP_F64);
- FUNCTION_CHECK_FOP();
+ CHECK_ARGUMENT(!(op & SLJIT_SET_Z));
+ CHECK_ARGUMENT((op & VARIABLE_FLAG_MASK)
+ || (GET_FLAG_TYPE(op) >= SLJIT_EQUAL_F64 && GET_FLAG_TYPE(op) <= SLJIT_ORDERED_F64));
FUNCTION_FCHECK(src1, src1w);
FUNCTION_FCHECK(src2, src2w);
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
- fprintf(compiler->verbose, " %s%s%s%s ", fop1_names[SLJIT_CMP_F64 - SLJIT_FOP1_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64",
- (op & SLJIT_SET_E) ? ".e" : "", (op & SLJIT_SET_S) ? ".s" : "");
+ fprintf(compiler->verbose, " %s%s", fop1_names[SLJIT_CMP_F64 - SLJIT_FOP1_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64");
+ if (op & VARIABLE_FLAG_MASK) {
+ fprintf(compiler->verbose, ".%s_f", jump_names[GET_FLAG_TYPE(op)]);
+ }
+ fprintf(compiler->verbose, " ");
sljit_verbose_fparam(compiler, src1, src1w);
fprintf(compiler->verbose, ", ");
sljit_verbose_fparam(compiler, src2, src2w);
@@ -1267,11 +1407,11 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_sw_from_f64(str
}
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_is_fpu_available());
+ CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONV_SW_FROM_F64 && GET_OPCODE(op) <= SLJIT_CONV_S32_FROM_F64);
- FUNCTION_CHECK_FOP();
+ CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
FUNCTION_FCHECK(src, srcw);
- FUNCTION_CHECK_DST(dst, dstw);
+ FUNCTION_CHECK_DST(dst, dstw, 0);
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1297,9 +1437,9 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_f64_from_sw(str
}
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_is_fpu_available());
+ CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_CONV_F64_FROM_SW && GET_OPCODE(op) <= SLJIT_CONV_F64_FROM_S32);
- FUNCTION_CHECK_FOP();
+ CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
FUNCTION_CHECK_SRC(src, srcw);
FUNCTION_FCHECK(dst, dstw);
#endif
@@ -1323,9 +1463,9 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop2(struct sljit_compile
sljit_s32 src2, sljit_sw src2w)
{
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_is_fpu_available());
+ CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
CHECK_ARGUMENT(GET_OPCODE(op) >= SLJIT_ADD_F64 && GET_OPCODE(op) <= SLJIT_DIV_F64);
- FUNCTION_CHECK_FOP();
+ CHECK_ARGUMENT(!(op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)));
FUNCTION_FCHECK(src1, src1w);
FUNCTION_FCHECK(src2, src2w);
FUNCTION_FCHECK(dst, dstw);
@@ -1348,6 +1488,15 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_label(struct sljit_compil
{
SLJIT_UNUSED_ARG(compiler);
+ if (SLJIT_UNLIKELY(compiler->skip_checks)) {
+ compiler->skip_checks = 0;
+ CHECK_RETURN_OK;
+ }
+
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->last_flags = 0;
+#endif
+
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose))
fprintf(compiler->verbose, "label:\n");
@@ -1364,9 +1513,19 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compile
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
- CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_CALL3);
+ CHECK_ARGUMENT((type & 0xff) != GET_FLAG_TYPE(SLJIT_SET_CARRY) && (type & 0xff) != (GET_FLAG_TYPE(SLJIT_SET_CARRY) + 1));
+ CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_FAST_CALL);
CHECK_ARGUMENT((type & 0xff) < SLJIT_JUMP || !(type & SLJIT_I32_OP));
- CHECK_ARGUMENT((type & 0xff) <= SLJIT_CALL0 || ((type & 0xff) - SLJIT_CALL0) <= compiler->scratches);
+
+ if ((type & 0xff) < SLJIT_JUMP) {
+ if ((type & 0xff) <= SLJIT_NOT_ZERO)
+ CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
+ else
+ CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
+ || ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
+ || ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
+ CHECK_ARGUMENT((type & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
+ }
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose))
@@ -1376,6 +1535,63 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compile
CHECK_RETURN_OK;
}
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ sljit_s32 i, types, curr_type, scratches, fscratches;
+
+ CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));
+ CHECK_ARGUMENT((type & 0xff) == SLJIT_CALL || (type & 0xff) == SLJIT_CALL_CDECL);
+
+ types = arg_types;
+ scratches = 0;
+ fscratches = 0;
+ for (i = 0; i < 5; i++) {
+ curr_type = (types & SLJIT_DEF_MASK);
+ CHECK_ARGUMENT(curr_type <= SLJIT_ARG_TYPE_F64);
+ if (i > 0) {
+ if (curr_type == 0) {
+ break;
+ }
+ if (curr_type >= SLJIT_ARG_TYPE_F32)
+ fscratches++;
+ else
+ scratches++;
+ } else {
+ if (curr_type >= SLJIT_ARG_TYPE_F32) {
+ CHECK_ARGUMENT(compiler->fscratches > 0);
+ } else if (curr_type >= SLJIT_ARG_TYPE_SW) {
+ CHECK_ARGUMENT(compiler->scratches > 0);
+ }
+ }
+ types >>= SLJIT_DEF_SHIFT;
+ }
+ CHECK_ARGUMENT(compiler->scratches >= scratches);
+ CHECK_ARGUMENT(compiler->fscratches >= fscratches);
+ CHECK_ARGUMENT(types == 0);
+#endif
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ if (SLJIT_UNLIKELY(!!compiler->verbose)) {
+ fprintf(compiler->verbose, " %s%s ret[%s", jump_names[type & 0xff],
+ !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", call_arg_names[arg_types & SLJIT_DEF_MASK]);
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ if (arg_types) {
+ fprintf(compiler->verbose, "], args[");
+ do {
+ fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
+ arg_types >>= SLJIT_DEF_SHIFT;
+ if (arg_types)
+ fprintf(compiler->verbose, ",");
+ } while (arg_types);
+ }
+ fprintf(compiler->verbose, "]\n");
+ }
+#endif
+ CHECK_RETURN_OK;
+}
+
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
@@ -1385,6 +1601,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler
CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_SIG_LESS_EQUAL);
FUNCTION_CHECK_SRC(src1, src1w);
FUNCTION_CHECK_SRC(src2, src2w);
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1404,11 +1621,12 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compile
sljit_s32 src2, sljit_sw src2w)
{
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_is_fpu_available());
+ CHECK_ARGUMENT(sljit_has_cpu_feature(SLJIT_HAS_FPU));
CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_F32_OP)));
CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL_F64 && (type & 0xff) <= SLJIT_ORDERED_F64);
FUNCTION_FCHECK(src1, src1w);
FUNCTION_FCHECK(src2, src2w);
+ compiler->last_flags = 0;
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1423,7 +1641,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compile
CHECK_RETURN_OK;
}
-static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 src, sljit_sw srcw)
{
if (SLJIT_UNLIKELY(compiler->skip_checks)) {
compiler->skip_checks = 0;
@@ -1431,8 +1650,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compil
}
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
- CHECK_ARGUMENT(type <= SLJIT_CALL0 || (type - SLJIT_CALL0) <= compiler->scratches);
+ CHECK_ARGUMENT(type >= SLJIT_JUMP && type <= SLJIT_FAST_CALL);
FUNCTION_CHECK_SRC(src, srcw);
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
@@ -1445,48 +1663,212 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compil
CHECK_RETURN_OK;
}
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ sljit_s32 i, types, curr_type, scratches, fscratches;
+
+ CHECK_ARGUMENT(type == SLJIT_CALL || type == SLJIT_CALL_CDECL);
+ FUNCTION_CHECK_SRC(src, srcw);
+
+ types = arg_types;
+ scratches = 0;
+ fscratches = 0;
+ for (i = 0; i < 5; i++) {
+ curr_type = (types & SLJIT_DEF_MASK);
+ CHECK_ARGUMENT(curr_type <= SLJIT_ARG_TYPE_F64);
+ if (i > 0) {
+ if (curr_type == 0) {
+ break;
+ }
+ if (curr_type >= SLJIT_ARG_TYPE_F32)
+ fscratches++;
+ else
+ scratches++;
+ } else {
+ if (curr_type >= SLJIT_ARG_TYPE_F32) {
+ CHECK_ARGUMENT(compiler->fscratches > 0);
+ } else if (curr_type >= SLJIT_ARG_TYPE_SW) {
+ CHECK_ARGUMENT(compiler->scratches > 0);
+ }
+ }
+ types >>= SLJIT_DEF_SHIFT;
+ }
+ CHECK_ARGUMENT(compiler->scratches >= scratches);
+ CHECK_ARGUMENT(compiler->fscratches >= fscratches);
+ CHECK_ARGUMENT(types == 0);
+#endif
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ if (SLJIT_UNLIKELY(!!compiler->verbose)) {
+ fprintf(compiler->verbose, " i%s%s ret[%s", jump_names[type & 0xff],
+ !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", call_arg_names[arg_types & SLJIT_DEF_MASK]);
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ if (arg_types) {
+ fprintf(compiler->verbose, "], args[");
+ do {
+ fprintf(compiler->verbose, "%s", call_arg_names[arg_types & SLJIT_DEF_MASK]);
+ arg_types >>= SLJIT_DEF_SHIFT;
+ if (arg_types)
+ fprintf(compiler->verbose, ",");
+ } while (arg_types);
+ }
+ fprintf(compiler->verbose, "], ");
+ sljit_verbose_param(compiler, src, srcw);
+ fprintf(compiler->verbose, "\n");
+ }
+#endif
+ CHECK_RETURN_OK;
+}
+
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
- CHECK_ARGUMENT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_U32 || GET_OPCODE(op) == SLJIT_MOV_S32
+ CHECK_ARGUMENT((type & 0xff) != GET_FLAG_TYPE(SLJIT_SET_CARRY) && (type & 0xff) != (GET_FLAG_TYPE(SLJIT_SET_CARRY) + 1));
+ CHECK_ARGUMENT(op == SLJIT_MOV || op == SLJIT_MOV32
|| (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));
- CHECK_ARGUMENT((op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C)) == 0);
- CHECK_ARGUMENT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
- if (GET_OPCODE(op) < SLJIT_ADD) {
- CHECK_ARGUMENT(src == SLJIT_UNUSED && srcw == 0);
- } else {
- CHECK_ARGUMENT(src == dst && srcw == dstw);
- }
- FUNCTION_CHECK_DST(dst, dstw);
+ CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK));
+
+ if ((type & 0xff) <= SLJIT_NOT_ZERO)
+ CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
+ else
+ CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
+ || ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
+ || ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
+
+ FUNCTION_CHECK_DST(dst, dstw, 0);
+
+ if (GET_OPCODE(op) >= SLJIT_ADD)
+ compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
- fprintf(compiler->verbose, " flags %s%s%s%s, ",
- !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k",
+ fprintf(compiler->verbose, " flags%s %s%s, ",
+ !(op & SLJIT_SET_Z) ? "" : ".z",
GET_OPCODE(op) < SLJIT_OP2_BASE ? "mov" : op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE],
GET_OPCODE(op) < SLJIT_OP2_BASE ? op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE] : ((op & SLJIT_I32_OP) ? "32" : ""));
sljit_verbose_param(compiler, dst, dstw);
- if (src != SLJIT_UNUSED) {
- fprintf(compiler->verbose, ", ");
- sljit_verbose_param(compiler, src, srcw);
- }
fprintf(compiler->verbose, ", %s%s\n", jump_names[type & 0xff], JUMP_POSTFIX(type));
}
#endif
CHECK_RETURN_OK;
}
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
+ CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
+
+ CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1);
+ CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_I32_OP));
+ if (src != SLJIT_IMM) {
+ CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(src));
+ CHECK_ARGUMENT(srcw == 0);
+ }
+
+ if ((type & 0xff) <= SLJIT_NOT_ZERO)
+ CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
+ else
+ CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
+ || ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
+ || ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
+#endif
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ if (SLJIT_UNLIKELY(!!compiler->verbose)) {
+ fprintf(compiler->verbose, " cmov%s %s%s, ",
+ !(dst_reg & SLJIT_I32_OP) ? "" : "32",
+ jump_names[type & 0xff], JUMP_POSTFIX(type));
+ sljit_verbose_reg(compiler, dst_reg & ~SLJIT_I32_OP);
+ fprintf(compiler->verbose, ", ");
+ sljit_verbose_param(compiler, src, srcw);
+ fprintf(compiler->verbose, "\n");
+ }
+#endif
+ CHECK_RETURN_OK;
+}
+
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw)
+{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ CHECK_ARGUMENT((type & 0xff) >= SLJIT_MOV && (type & 0xff) <= SLJIT_MOV_P);
+ CHECK_ARGUMENT(!(type & SLJIT_I32_OP) || ((type & 0xff) != SLJIT_MOV && (type & 0xff) != SLJIT_MOV_U32 && (type & 0xff) != SLJIT_MOV_P));
+ CHECK_ARGUMENT((type & SLJIT_MEM_PRE) || (type & SLJIT_MEM_POST));
+ CHECK_ARGUMENT((type & (SLJIT_MEM_PRE | SLJIT_MEM_POST)) != (SLJIT_MEM_PRE | SLJIT_MEM_POST));
+ CHECK_ARGUMENT((type & ~(0xff | SLJIT_I32_OP | SLJIT_MEM_STORE | SLJIT_MEM_SUPP | SLJIT_MEM_PRE | SLJIT_MEM_POST)) == 0);
+
+ FUNCTION_CHECK_SRC_MEM(mem, memw);
+ CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(reg));
+
+ CHECK_ARGUMENT((mem & REG_MASK) != SLJIT_UNUSED && (mem & REG_MASK) != reg);
+#endif
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ if (!(type & SLJIT_MEM_SUPP) && SLJIT_UNLIKELY(!!compiler->verbose)) {
+ if (sljit_emit_mem(compiler, type | SLJIT_MEM_SUPP, reg, mem, memw) == SLJIT_ERR_UNSUPPORTED)
+ fprintf(compiler->verbose, " //");
+
+ fprintf(compiler->verbose, " mem%s.%s%s%s ",
+ !(type & SLJIT_I32_OP) ? "" : "32",
+ (type & SLJIT_MEM_STORE) ? "st" : "ld",
+ op1_names[(type & 0xff) - SLJIT_OP1_BASE],
+ (type & SLJIT_MEM_PRE) ? ".pre" : ".post");
+ sljit_verbose_reg(compiler, reg);
+ fprintf(compiler->verbose, ", ");
+ sljit_verbose_param(compiler, mem, memw);
+ fprintf(compiler->verbose, "\n");
+ }
+#endif
+ CHECK_RETURN_OK;
+}
+
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 freg,
+ sljit_s32 mem, sljit_sw memw)
+{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ CHECK_ARGUMENT((type & 0xff) == SLJIT_MOV_F64);
+ CHECK_ARGUMENT((type & SLJIT_MEM_PRE) || (type & SLJIT_MEM_POST));
+ CHECK_ARGUMENT((type & (SLJIT_MEM_PRE | SLJIT_MEM_POST)) != (SLJIT_MEM_PRE | SLJIT_MEM_POST));
+ CHECK_ARGUMENT((type & ~(0xff | SLJIT_I32_OP | SLJIT_MEM_STORE | SLJIT_MEM_SUPP | SLJIT_MEM_PRE | SLJIT_MEM_POST)) == 0);
+
+ FUNCTION_CHECK_SRC_MEM(mem, memw);
+ CHECK_ARGUMENT(FUNCTION_CHECK_IS_FREG(freg));
+#endif
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ if (!(type & SLJIT_MEM_SUPP) && SLJIT_UNLIKELY(!!compiler->verbose)) {
+ if (sljit_emit_fmem(compiler, type | SLJIT_MEM_SUPP, freg, mem, memw) == SLJIT_ERR_UNSUPPORTED)
+ fprintf(compiler->verbose, " //");
+
+ fprintf(compiler->verbose, " fmem.%s%s%s ",
+ (type & SLJIT_MEM_STORE) ? "st" : "ld",
+ !(type & SLJIT_I32_OP) ? ".f64" : ".f32",
+ (type & SLJIT_MEM_PRE) ? ".pre" : ".post");
+ sljit_verbose_freg(compiler, freg);
+ fprintf(compiler->verbose, ", ");
+ sljit_verbose_param(compiler, mem, memw);
+ fprintf(compiler->verbose, "\n");
+ }
+#endif
+ CHECK_RETURN_OK;
+}
+
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
{
+ /* Any offset is allowed. */
SLJIT_UNUSED_ARG(offset);
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- FUNCTION_CHECK_DST(dst, dstw);
+ FUNCTION_CHECK_DST(dst, dstw, 0);
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1503,7 +1885,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compil
SLJIT_UNUSED_ARG(init_value);
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- FUNCTION_CHECK_DST(dst, dstw);
+ FUNCTION_CHECK_DST(dst, dstw, 0);
#endif
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
@@ -1564,6 +1946,44 @@ static SLJIT_INLINE sljit_s32 emit_mov_before_return(struct sljit_compiler *comp
return sljit_emit_op1(compiler, op, SLJIT_RETURN_REG, 0, src, srcw);
}
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
+ || (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC) \
+ || (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \
+ || ((defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS) && !(defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1))
+
+static SLJIT_INLINE sljit_s32 sljit_emit_cmov_generic(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ struct sljit_label *label;
+ struct sljit_jump *jump;
+ sljit_s32 op = (dst_reg & SLJIT_I32_OP) ? SLJIT_MOV32 : SLJIT_MOV;
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+ jump = sljit_emit_jump(compiler, type ^ 0x1);
+ FAIL_IF(!jump);
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+ FAIL_IF(sljit_emit_op1(compiler, op, dst_reg & ~SLJIT_I32_OP, 0, src, srcw));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+ label = sljit_emit_label(compiler);
+ FAIL_IF(!label);
+ sljit_set_label(jump, label);
+ return SLJIT_SUCCESS;
+}
+
+#endif
+
/* CPU description section */
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
@@ -1665,6 +2085,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
condition = SLJIT_SIG_GREATER_EQUAL;
break;
}
+
type = condition | (type & (SLJIT_I32_OP | SLJIT_REWRITABLE_JUMP));
tmp_src = src1;
src1 = src2;
@@ -1675,11 +2096,9 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
}
if (condition <= SLJIT_NOT_ZERO)
- flags = SLJIT_SET_E;
- else if (condition <= SLJIT_LESS_EQUAL)
- flags = SLJIT_SET_U;
+ flags = SLJIT_SET_Z;
else
- flags = SLJIT_SET_S;
+ flags = condition << VARIABLE_FLAG_SHIFT;
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
@@ -1691,34 +2110,70 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
compiler->skip_checks = 1;
#endif
- return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
+ return sljit_emit_jump(compiler, condition | (type & (SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
}
+#endif
+
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- sljit_s32 flags, condition;
-
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w));
- condition = type & 0xff;
- flags = (condition <= SLJIT_NOT_EQUAL_F64) ? SLJIT_SET_E : SLJIT_SET_S;
- if (type & SLJIT_F32_OP)
- flags |= SLJIT_F32_OP;
-
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
compiler->skip_checks = 1;
#endif
- sljit_emit_fop1(compiler, SLJIT_CMP_F64 | flags, src1, src1w, src2, src2w);
+ sljit_emit_fop1(compiler, SLJIT_CMP_F64 | ((type & 0xff) << VARIABLE_FLAG_SHIFT) | (type & SLJIT_I32_OP), src1, src1w, src2, src2w);
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
compiler->skip_checks = 1;
#endif
- return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
+ return sljit_emit_jump(compiler, type);
+}
+
+#if !(defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) \
+ && !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
+ && !(defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNUSED_ARG(reg);
+ SLJIT_UNUSED_ARG(mem);
+ SLJIT_UNUSED_ARG(memw);
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw));
+
+ return SLJIT_ERR_UNSUPPORTED;
+}
+
+#endif
+
+#if !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
+ && !(defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 freg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNUSED_ARG(freg);
+ SLJIT_UNUSED_ARG(mem);
+ SLJIT_UNUSED_ARG(memw);
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_fmem(compiler, type, freg, mem, memw));
+
+ return SLJIT_ERR_UNSUPPORTED;
}
#endif
@@ -1736,7 +2191,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *c
compiler->skip_checks = 1;
#endif
if (offset != 0)
- return sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
+ return sljit_emit_op2(compiler, SLJIT_ADD, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
return sljit_emit_op1(compiler, SLJIT_MOV, dst, dstw, SLJIT_SP, 0);
}
@@ -1751,23 +2206,30 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
return "unsupported";
}
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void *allocator_data)
{
- SLJIT_ASSERT_STOP();
+ SLJIT_UNUSED_ARG(allocator_data);
+ SLJIT_UNREACHABLE();
return NULL;
}
SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
{
SLJIT_UNUSED_ARG(compiler);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
+}
+
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(size);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
@@ -1776,52 +2238,59 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *comp
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(verbose);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
#endif
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
{
SLJIT_UNUSED_ARG(compiler);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ SLJIT_UNUSED_ARG(feature_type);
+ SLJIT_UNREACHABLE();
+ return 0;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
{
SLJIT_UNUSED_ARG(code);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(options);
- SLJIT_UNUSED_ARG(args);
+ SLJIT_UNUSED_ARG(arg_types);
SLJIT_UNUSED_ARG(scratches);
SLJIT_UNUSED_ARG(saveds);
SLJIT_UNUSED_ARG(fscratches);
SLJIT_UNUSED_ARG(fsaveds);
SLJIT_UNUSED_ARG(local_size);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(options);
- SLJIT_UNUSED_ARG(args);
+ SLJIT_UNUSED_ARG(arg_types);
SLJIT_UNUSED_ARG(scratches);
SLJIT_UNUSED_ARG(saveds);
SLJIT_UNUSED_ARG(fscratches);
SLJIT_UNUSED_ARG(fsaveds);
SLJIT_UNUSED_ARG(local_size);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1831,7 +2300,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
SLJIT_UNUSED_ARG(op);
SLJIT_UNUSED_ARG(src);
SLJIT_UNUSED_ARG(srcw);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1840,7 +2309,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(dst);
SLJIT_UNUSED_ARG(dstw);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1849,7 +2318,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(src);
SLJIT_UNUSED_ARG(srcw);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1857,7 +2326,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(op);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1871,7 +2340,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
SLJIT_UNUSED_ARG(dstw);
SLJIT_UNUSED_ARG(src);
SLJIT_UNUSED_ARG(srcw);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1888,13 +2357,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
SLJIT_UNUSED_ARG(src1w);
SLJIT_UNUSED_ARG(src2);
SLJIT_UNUSED_ARG(src2w);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
{
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return reg;
}
@@ -1904,14 +2373,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(instruction);
SLJIT_UNUSED_ARG(size);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
{
- SLJIT_ASSERT_STOP();
- return 0;
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(current_flags);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
@@ -1924,7 +2393,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
SLJIT_UNUSED_ARG(dstw);
SLJIT_UNUSED_ARG(src);
SLJIT_UNUSED_ARG(srcw);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -1941,14 +2410,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
SLJIT_UNUSED_ARG(src1w);
SLJIT_UNUSED_ARG(src2);
SLJIT_UNUSED_ARG(src2w);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)
{
SLJIT_UNUSED_ARG(compiler);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
@@ -1956,7 +2425,17 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(type);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
+ return NULL;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNUSED_ARG(arg_types);
+ SLJIT_UNREACHABLE();
return NULL;
}
@@ -1970,7 +2449,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
SLJIT_UNUSED_ARG(src1w);
SLJIT_UNUSED_ARG(src2);
SLJIT_UNUSED_ARG(src2w);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
@@ -1984,7 +2463,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compile
SLJIT_UNUSED_ARG(src1w);
SLJIT_UNUSED_ARG(src2);
SLJIT_UNUSED_ARG(src2w);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
@@ -1992,14 +2471,14 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sl
{
SLJIT_UNUSED_ARG(jump);
SLJIT_UNUSED_ARG(label);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
{
SLJIT_UNUSED_ARG(jump);
SLJIT_UNUSED_ARG(target);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
@@ -2008,23 +2487,68 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
SLJIT_UNUSED_ARG(type);
SLJIT_UNUSED_ARG(src);
SLJIT_UNUSED_ARG(srcw);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
+ return SLJIT_ERR_UNSUPPORTED;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNUSED_ARG(arg_types);
+ SLJIT_UNUSED_ARG(src);
+ SLJIT_UNUSED_ARG(srcw);
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(op);
SLJIT_UNUSED_ARG(dst);
SLJIT_UNUSED_ARG(dstw);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNREACHABLE();
+ return SLJIT_ERR_UNSUPPORTED;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNUSED_ARG(dst_reg);
SLJIT_UNUSED_ARG(src);
SLJIT_UNUSED_ARG(srcw);
+ SLJIT_UNREACHABLE();
+ return SLJIT_ERR_UNSUPPORTED;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 reg, sljit_s32 mem, sljit_sw memw)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(type);
+ SLJIT_UNUSED_ARG(reg);
+ SLJIT_UNUSED_ARG(mem);
+ SLJIT_UNUSED_ARG(memw);
+ SLJIT_UNREACHABLE();
+ return SLJIT_ERR_UNSUPPORTED;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 freg, sljit_s32 mem, sljit_sw memw)
+{
+ SLJIT_UNUSED_ARG(compiler);
SLJIT_UNUSED_ARG(type);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNUSED_ARG(freg);
+ SLJIT_UNUSED_ARG(mem);
+ SLJIT_UNUSED_ARG(memw);
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -2034,7 +2558,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *c
SLJIT_UNUSED_ARG(dst);
SLJIT_UNUSED_ARG(dstw);
SLJIT_UNUSED_ARG(offset);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_ERR_UNSUPPORTED;
}
@@ -2044,7 +2568,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
SLJIT_UNUSED_ARG(dst);
SLJIT_UNUSED_ARG(dstw);
SLJIT_UNUSED_ARG(initval);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
@@ -2053,7 +2577,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta
SLJIT_UNUSED_ARG(addr);
SLJIT_UNUSED_ARG(new_target);
SLJIT_UNUSED_ARG(executable_offset);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant, sljit_sw executable_offset)
@@ -2061,7 +2585,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
SLJIT_UNUSED_ARG(addr);
SLJIT_UNUSED_ARG(new_constant);
SLJIT_UNUSED_ARG(executable_offset);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
#endif
diff --git a/thirdparty/pcre2/src/sljit/sljitLir.h b/thirdparty/pcre2/src/sljit/sljitLir.h
index f24f556b56..920f6d4f78 100644
--- a/thirdparty/pcre2/src/sljit/sljitLir.h
+++ b/thirdparty/pcre2/src/sljit/sljitLir.h
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -120,8 +120,8 @@ of sljitConfigInternal.h */
If an architecture provides two scratch and three saved registers,
its scratch and saved register sets are the following:
- R0 | [S4] | R0 and S4 represent the same physical register
- R1 | [S3] | R1 and S3 represent the same physical register
+ R0 | | R0 is always a scratch register
+ R1 | | R1 is always a scratch register
[R2] | S2 | R2 and S2 represent the same physical register
[R3] | S1 | R3 and S1 represent the same physical register
[R4] | S0 | R4 and S0 represent the same physical register
@@ -129,38 +129,35 @@ of sljitConfigInternal.h */
Note: SLJIT_NUMBER_OF_SCRATCH_REGISTERS would be 2 and
SLJIT_NUMBER_OF_SAVED_REGISTERS would be 3 for this architecture.
- Note: On all supported architectures SLJIT_NUMBER_OF_REGISTERS >= 10
- and SLJIT_NUMBER_OF_SAVED_REGISTERS >= 5. However, 4 registers
+ Note: On all supported architectures SLJIT_NUMBER_OF_REGISTERS >= 12
+ and SLJIT_NUMBER_OF_SAVED_REGISTERS >= 6. However, 6 registers
are virtual on x86-32. See below.
- The purpose of this definition is convenience. Although a register
- is either scratch register or saved register, SLJIT allows accessing
- them from the other set. For example, four registers can be used as
- scratch registers and the fifth one as saved register on the architecture
- above. Of course the last two scratch registers (R2 and R3) from this
- four will be saved on the stack, because they are defined as saved
- registers in the application binary interface. Still R2 and R3 can be
- used for referencing to these registers instead of S2 and S1, which
- makes easier to write platform independent code. Scratch registers
- can be saved registers in a similar way, but these extra saved
- registers will not be preserved across function calls! Hence the
- application must save them on those platforms, where the number of
- saved registers is too low. This can be done by copy them onto
- the stack and restore them after a function call.
+ The purpose of this definition is convenience: saved registers can
+ be used as extra scratch registers. For example four registers can
+ be specified as scratch registers and the fifth one as saved register
+ on the CPU above and any user code which requires four scratch
+ registers can run unmodified. The SLJIT compiler automatically saves
+ the content of the two extra scrath register on the stack. Scratch
+ registers can also be preserved by saving their value on the stack
+ but this needs to be done manually.
Note: To emphasize that registers assigned to R2-R4 are saved
- registers, they are enclosed by square brackets. S3-S4
- are marked in a similar way.
+ registers, they are enclosed by square brackets.
Note: sljit_emit_enter and sljit_set_context defines whether a register
is S or R register. E.g: when 3 scratches and 1 saved is mapped
by sljit_emit_enter, the allowed register set will be: R0-R2 and
S0. Although S2 is mapped to the same position as R2, it does not
- available in the current configuration. Furthermore the R3 (S1)
- register does not available as well.
+ available in the current configuration. Furthermore the S1 register
+ is not available at all.
*/
-/* When SLJIT_UNUSED is specified as destination, the result is discarded. */
+/* When SLJIT_UNUSED is specified as the destination of sljit_emit_op1
+ or sljit_emit_op2 operations the result is discarded. If no status
+ flags are set, no instructions are emitted for these operations. Data
+ prefetch is a special exception, see SLJIT_MOV operation. Other SLJIT
+ operations do not support SLJIT_UNUSED as a destination operand. */
#define SLJIT_UNUSED 0
/* Scratch registers. */
@@ -216,14 +213,6 @@ of sljitConfigInternal.h */
#define SLJIT_RETURN_REG SLJIT_R0
-/* x86 prefers specific registers for special purposes. In case of shift
- by register it supports only SLJIT_R2 for shift argument
- (which is the src2 argument of sljit_emit_op2). If another register is
- used, sljit must exchange data between registers which cause a minor
- slowdown. Other architectures has no such limitation. */
-
-#define SLJIT_PREF_SHIFT_REG SLJIT_R2
-
/* --------------------------------------------------------------------- */
/* Floating point registers */
/* --------------------------------------------------------------------- */
@@ -261,6 +250,79 @@ of sljitConfigInternal.h */
#define SLJIT_FIRST_SAVED_FLOAT_REG (SLJIT_FS0 - SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS + 1)
/* --------------------------------------------------------------------- */
+/* Argument type definitions */
+/* --------------------------------------------------------------------- */
+
+/* Argument type definitions.
+ Used by SLJIT_[DEF_]ARGx and SLJIT_[DEF]_RET macros. */
+
+#define SLJIT_ARG_TYPE_VOID 0
+#define SLJIT_ARG_TYPE_SW 1
+#define SLJIT_ARG_TYPE_UW 2
+#define SLJIT_ARG_TYPE_S32 3
+#define SLJIT_ARG_TYPE_U32 4
+#define SLJIT_ARG_TYPE_F32 5
+#define SLJIT_ARG_TYPE_F64 6
+
+/* The following argument type definitions are used by sljit_emit_enter,
+ sljit_set_context, sljit_emit_call, and sljit_emit_icall functions.
+ The following return type definitions are used by sljit_emit_call
+ and sljit_emit_icall functions.
+
+ When a function is called, the first integer argument must be placed
+ in SLJIT_R0, the second in SLJIT_R1, and so on. Similarly the first
+ floating point argument must be placed in SLJIT_FR0, the second in
+ SLJIT_FR1, and so on.
+
+ Example function definition:
+ sljit_f32 SLJIT_FUNC example_c_callback(sljit_sw arg_a,
+ sljit_f64 arg_b, sljit_u32 arg_c, sljit_f32 arg_d);
+
+ Argument type definition:
+ SLJIT_DEF_RET(SLJIT_ARG_TYPE_F32)
+ | SLJIT_DEF_ARG1(SLJIT_ARG_TYPE_SW) | SLJIT_DEF_ARG2(SLJIT_ARG_TYPE_F64)
+ | SLJIT_DEF_ARG3(SLJIT_ARG_TYPE_U32) | SLJIT_DEF_ARG2(SLJIT_ARG_TYPE_F32)
+
+ Short form of argument type definition:
+ SLJIT_RET(F32) | SLJIT_ARG1(SW) | SLJIT_ARG2(F64)
+ | SLJIT_ARG3(S32) | SLJIT_ARG4(F32)
+
+ Argument passing:
+ arg_a must be placed in SLJIT_R0
+ arg_c must be placed in SLJIT_R1
+ arg_b must be placed in SLJIT_FR0
+ arg_d must be placed in SLJIT_FR1
+
+Note:
+ The SLJIT_ARG_TYPE_VOID type is only supported by
+ SLJIT_DEF_RET, and SLJIT_ARG_TYPE_VOID is also the
+ default value when SLJIT_DEF_RET is not specified. */
+#define SLJIT_DEF_SHIFT 4
+#define SLJIT_DEF_RET(type) (type)
+#define SLJIT_DEF_ARG1(type) ((type) << SLJIT_DEF_SHIFT)
+#define SLJIT_DEF_ARG2(type) ((type) << (2 * SLJIT_DEF_SHIFT))
+#define SLJIT_DEF_ARG3(type) ((type) << (3 * SLJIT_DEF_SHIFT))
+#define SLJIT_DEF_ARG4(type) ((type) << (4 * SLJIT_DEF_SHIFT))
+
+/* Short form of the macros above.
+
+ For example the following definition:
+ SLJIT_DEF_RET(SLJIT_ARG_TYPE_SW) | SLJIT_DEF_ARG1(SLJIT_ARG_TYPE_F32)
+
+ can be shortened to:
+ SLJIT_RET(SW) | SLJIT_ARG1(F32)
+
+Note:
+ The VOID type is only supported by SLJIT_RET, and
+ VOID is also the default value when SLJIT_RET is
+ not specified. */
+#define SLJIT_RET(type) SLJIT_DEF_RET(SLJIT_ARG_TYPE_ ## type)
+#define SLJIT_ARG1(type) SLJIT_DEF_ARG1(SLJIT_ARG_TYPE_ ## type)
+#define SLJIT_ARG2(type) SLJIT_DEF_ARG2(SLJIT_ARG_TYPE_ ## type)
+#define SLJIT_ARG3(type) SLJIT_DEF_ARG3(SLJIT_ARG_TYPE_ ## type)
+#define SLJIT_ARG4(type) SLJIT_DEF_ARG4(SLJIT_ARG_TYPE_ ## type)
+
+/* --------------------------------------------------------------------- */
/* Main structures and functions */
/* --------------------------------------------------------------------- */
@@ -332,14 +394,16 @@ struct sljit_compiler {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
sljit_s32 args;
+ sljit_s32 locals_offset;
+ sljit_s32 saveds_offset;
+ sljit_s32 stack_tmp_size;
#endif
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
sljit_s32 mode32;
+#ifdef _WIN64
+ sljit_s32 locals_offset;
#endif
-
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
- sljit_s32 flags_saved;
#endif
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
@@ -356,24 +420,10 @@ struct sljit_compiler {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
/* Temporary fields. */
sljit_uw shift_imm;
- sljit_s32 cache_arg;
- sljit_sw cache_argw;
-#endif
-
-#if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
- sljit_s32 cache_arg;
- sljit_sw cache_argw;
-#endif
-
-#if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
- sljit_s32 cache_arg;
- sljit_sw cache_argw;
#endif
#if (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
sljit_sw imm;
- sljit_s32 cache_arg;
- sljit_sw cache_argw;
#endif
#if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
@@ -399,6 +449,9 @@ struct sljit_compiler {
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
|| (defined SLJIT_DEBUG && SLJIT_DEBUG)
+ /* Flags specified by the last arithmetic instruction.
+ It contains the type of the variable flag. */
+ sljit_s32 last_flags;
/* Local size passed to the functions. */
sljit_s32 logical_local_size;
#endif
@@ -406,6 +459,7 @@ struct sljit_compiler {
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
|| (defined SLJIT_DEBUG && SLJIT_DEBUG) \
|| (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ /* Trust arguments when the API function is called. */
sljit_s32 skip_checks;
#endif
};
@@ -491,31 +545,57 @@ static SLJIT_INLINE sljit_sw sljit_get_executable_offset(struct sljit_compiler *
*/
static SLJIT_INLINE sljit_uw sljit_get_generated_code_size(struct sljit_compiler *compiler) { return compiler->executable_size; }
+/* Returns with non-zero if the feature or limitation type passed as its
+ argument is present on the current CPU.
+
+ Some features (e.g. floating point operations) require hardware (CPU)
+ support while others (e.g. move with update) are emulated if not available.
+ However even if a feature is emulated, specialized code paths can be faster
+ than the emulation. Some limitations are emulated as well so their general
+ case is supported but it has extra performance costs. */
+
+/* [Not emulated] Floating-point support is available. */
+#define SLJIT_HAS_FPU 0
+/* [Limitation] Some registers are virtual registers. */
+#define SLJIT_HAS_VIRTUAL_REGISTERS 1
+/* [Emulated] Count leading zero is supported. */
+#define SLJIT_HAS_CLZ 2
+/* [Emulated] Conditional move is supported. */
+#define SLJIT_HAS_CMOV 3
+
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+/* [Not emulated] SSE2 support is available on x86. */
+#define SLJIT_HAS_SSE2 100
+#endif
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type);
+
/* Instruction generation. Returns with any error code. If there is no
error, they return with SLJIT_SUCCESS. */
/*
- The executable code is a function call from the viewpoint of the C
+ The executable code is a function from the viewpoint of the C
language. The function calls must obey to the ABI (Application
Binary Interface) of the platform, which specify the purpose of
- all machine registers and stack handling among other things. The
+ machine registers and stack handling among other things. The
sljit_emit_enter function emits the necessary instructions for
setting up a new context for the executable code and moves function
arguments to the saved registers. Furthermore the options argument
can be used to pass configuration options to the compiler. The
available options are listed before sljit_emit_enter.
- The number of sljit_sw arguments passed to the generated function
- are specified in the "args" parameter. The number of arguments must
- be less than or equal to 3. The first argument goes to SLJIT_S0,
- the second goes to SLJIT_S1 and so on. The register set used by
- the function must be declared as well. The number of scratch and
- saved registers used by the function must be passed to sljit_emit_enter.
- Only R registers between R0 and "scratches" argument can be used
- later. E.g. if "scratches" is set to 2, the register set will be
- limited to R0 and R1. The S registers and the floating point
+ The function argument list is the combination of SLJIT_ARGx
+ (SLJIT_DEF_ARG1) macros. Currently maximum 3 SW / UW
+ (SLJIT_ARG_TYPE_SW / LJIT_ARG_TYPE_UW) arguments are supported.
+ The first argument goes to SLJIT_S0, the second goes to SLJIT_S1
+ and so on. The register set used by the function must be declared
+ as well. The number of scratch and saved registers used by the
+ function must be passed to sljit_emit_enter. Only R registers
+ between R0 and "scratches" argument can be used later. E.g. if
+ "scratches" is set to 2, the scratch register set will be limited
+ to SLJIT_R0 and SLJIT_R1. The S registers and the floating point
registers ("fscratches" and "fsaveds") are specified in a similar
- way. The sljit_emit_enter is also capable of allocating a stack
+ manner. The sljit_emit_enter is also capable of allocating a stack
space for local variables. The "local_size" argument contains the
size in bytes of this local area and its staring address is stored
in SLJIT_SP. The memory area between SLJIT_SP (inclusive) and
@@ -535,14 +615,14 @@ static SLJIT_INLINE sljit_uw sljit_get_generated_code_size(struct sljit_compiler
*/
/* The absolute address returned by sljit_get_local_base with
-offset 0 is aligned to sljit_d. Otherwise it is aligned to sljit_uw. */
-#define SLJIT_DOUBLE_ALIGNMENT 0x00000001
+offset 0 is aligned to sljit_f64. Otherwise it is aligned to sljit_sw. */
+#define SLJIT_F64_ALIGNMENT 0x00000001
/* The local_size must be >= 0 and <= SLJIT_MAX_LOCAL_SIZE. */
#define SLJIT_MAX_LOCAL_SIZE 65536
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size);
/* The machine code has a context (which contains the local stack space size,
@@ -556,7 +636,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
the previous context. */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size);
/* Return from machine code. The op argument can be SLJIT_UNUSED which means the
@@ -568,26 +648,31 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *comp
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 src, sljit_sw srcw);
-/* Fast calling mechanism for utility functions (see SLJIT_FAST_CALL). All registers and
- even the stack frame is passed to the callee. The return address is preserved in
- dst/dstw by sljit_emit_fast_enter (the type of the value stored by this function
- is sljit_p), and sljit_emit_fast_return can use this as a return value later. */
+/* Generating entry and exit points for fast call functions (see SLJIT_FAST_CALL).
+ Both sljit_emit_fast_enter and sljit_emit_fast_return functions preserve the
+ values of all registers and stack frame. The return address is stored in the
+ dst argument of sljit_emit_fast_enter, and this return address can be passed
+ to sljit_emit_fast_return to continue the execution after the fast call.
-/* Note: only for sljit specific, non ABI compilant calls. Fast, since only a few machine
- instructions are needed. Excellent for small uility functions, where saving registers
- and setting up a new stack frame would cost too much performance. However, it is still
- possible to return to the address of the caller (or anywhere else). */
+ Fast calls are cheap operations (usually only a single call instruction is
+ emitted) but they do not preserve any registers. However the callee function
+ can freely use / update any registers and stack values which can be
+ efficiently exploited by various optimizations. Registers can be saved
+ manually by the callee function if needed.
-/* Note: flags are not changed (unlike sljit_emit_enter / sljit_emit_return). */
+ Although returning to different address by sljit_emit_fast_return is possible,
+ this address usually cannot be predicted by the return address predictor of
+ modern CPUs which may reduce performance. Furthermore using sljit_emit_ijump
+ to return is also inefficient since return address prediction is usually
+ triggered by a specific form of ijump.
-/* Note: although sljit_emit_fast_return could be replaced by an ijump, it is not suggested,
- since many architectures do clever branch prediction on call / return instruction pairs. */
+ Flags: - (does not modify flags). */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw);
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw);
/*
- Source and destination values for arithmetical instructions
+ Source and destination operands for arithmetical instructions
imm - a simple immediate value (cannot be used as a destination)
reg - any of the registers (immediate argument must be 0)
[imm] - absolute immediate memory address
@@ -628,6 +713,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
arm-t2: [reg+imm], -255 <= imm <= 4095
[reg+(reg<<imm)] is supported
Write back is supported only for [reg+imm], where -255 <= imm <= 255
+ arm64: [reg+imm], -256 <= imm <= 255, 0 <= aligned imm <= 4095 * alignment
+ [reg+(reg<<imm)] is supported
+ Write back is supported only for [reg+imm], where -256 <= imm <= 255
ppc: [reg+imm], -65536 <= imm <= 65535. 64 bit loads/stores and 32 bit
signed load on 64 bit requires immediates divisible by 4.
[reg+imm] is not supported for signed 8 bit values.
@@ -639,65 +727,104 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
[reg+reg] is supported
*/
-/* Register output: simply the name of the register.
- For destination, you can use SLJIT_UNUSED as well. */
+/* Macros for specifying operand types. */
#define SLJIT_MEM 0x80
#define SLJIT_MEM0() (SLJIT_MEM)
#define SLJIT_MEM1(r1) (SLJIT_MEM | (r1))
#define SLJIT_MEM2(r1, r2) (SLJIT_MEM | (r1) | ((r2) << 8))
#define SLJIT_IMM 0x40
-/* Set 32 bit operation mode (I) on 64 bit CPUs. This flag is ignored on 32
- bit CPUs. When this flag is set for an arithmetic operation, only the
- lower 32 bit of the input register(s) are used, and the CPU status flags
- are set according to the 32 bit result. Although the higher 32 bit of
- the input and the result registers are not defined by SLJIT, it might be
- defined by the CPU architecture (e.g. MIPS). To satisfy these requirements
- all source registers must be computed by operations where this flag is
- also set. In other words 32 and 64 bit arithmetic operations cannot be
- mixed. The only exception is SLJIT_IMOV and SLJIT_IMOVU whose source
- register can hold any 32 or 64 bit value. This source register is
- converted to a 32 bit compatible format. SLJIT does not generate any
- instructions on certain CPUs (e.g. on x86 and ARM) if the source and
- destination operands are the same registers. Affects sljit_emit_op0,
- sljit_emit_op1 and sljit_emit_op2. */
+/* Set 32 bit operation mode (I) on 64 bit CPUs. This option is ignored on
+ 32 bit CPUs. When this option is set for an arithmetic operation, only
+ the lower 32 bit of the input registers are used, and the CPU status
+ flags are set according to the 32 bit result. Although the higher 32 bit
+ of the input and the result registers are not defined by SLJIT, it might
+ be defined by the CPU architecture (e.g. MIPS). To satisfy these CPU
+ requirements all source registers must be the result of those operations
+ where this option was also set. Memory loads read 32 bit values rather
+ than 64 bit ones. In other words 32 bit and 64 bit operations cannot
+ be mixed. The only exception is SLJIT_MOV32 and SLJIT_MOVU32 whose source
+ register can hold any 32 or 64 bit value, and it is converted to a 32 bit
+ compatible format first. This conversion is free (no instructions are
+ emitted) on most CPUs. A 32 bit value can also be coverted to a 64 bit
+ value by SLJIT_MOV_S32 (sign extension) or SLJIT_MOV_U32 (zero extension).
+
+ Note: memory addressing always uses 64 bit values on 64 bit systems so
+ the result of a 32 bit operation must not be used with SLJIT_MEMx
+ macros.
+
+ This option is part of the instruction name, so there is no need to
+ manually set it. E.g:
+
+ SLJIT_ADD32 == (SLJIT_ADD | SLJIT_I32_OP) */
#define SLJIT_I32_OP 0x100
-/* F32 precision mode (SP). This flag is similar to SLJIT_I32_OP, just
- it applies to floating point registers (it is even the same bit). When
- this flag is passed, the CPU performs 32 bit floating point operations.
- Similar to SLJIT_I32_OP, all register arguments must be computed by
- floating point operations where this flag is also set. Affects
- sljit_emit_fop1, sljit_emit_fop2 and sljit_emit_fcmp. */
-#define SLJIT_F32_OP 0x100
-
-/* Common CPU status flags for all architectures (x86, ARM, PPC)
- - carry flag
- - overflow flag
- - zero flag
- - negative/positive flag (depends on arc)
- On mips, these flags are emulated by software. */
-
-/* By default, the instructions may, or may not set the CPU status flags.
- Forcing to set or keep status flags can be done with the following flags: */
-
-/* Note: sljit tries to emit the minimum number of instructions. Using these
- flags can increase them, so use them wisely to avoid unnecessary code generation. */
-
-/* Set Equal (Zero) status flag (E). */
-#define SLJIT_SET_E 0x0200
-/* Set unsigned status flag (U). */
-#define SLJIT_SET_U 0x0400
-/* Set signed status flag (S). */
-#define SLJIT_SET_S 0x0800
-/* Set signed overflow flag (O). */
-#define SLJIT_SET_O 0x1000
-/* Set carry flag (C).
- Note: Kinda unsigned overflow, but behaves differently on various cpus. */
-#define SLJIT_SET_C 0x2000
-/* Do not modify the flags (K).
- Note: This flag cannot be combined with any other SLJIT_SET_* flag. */
-#define SLJIT_KEEP_FLAGS 0x4000
+/* Set F32 (single) precision mode for floating-point computation. This
+ option is similar to SLJIT_I32_OP, it just applies to floating point
+ registers. When this option is passed, the CPU performs 32 bit floating
+ point operations, rather than 64 bit one. Similar to SLJIT_I32_OP, all
+ register arguments must be the result of those operations where this
+ option was also set.
+
+ This option is part of the instruction name, so there is no need to
+ manually set it. E.g:
+
+ SLJIT_MOV_F32 = (SLJIT_MOV_F64 | SLJIT_F32_OP)
+ */
+#define SLJIT_F32_OP SLJIT_I32_OP
+
+/* Many CPUs (x86, ARM, PPC) has status flags which can be set according
+ to the result of an operation. Other CPUs (MIPS) does not have status
+ flags, and results must be stored in registers. To cover both architecture
+ types efficiently only two flags are defined by SLJIT:
+
+ * Zero (equal) flag: it is set if the result is zero
+ * Variable flag: its value is defined by the last arithmetic operation
+
+ SLJIT instructions can set any or both of these flags. The value of
+ these flags is undefined if the instruction does not specify their value.
+ The description of each instruction contains the list of allowed flag
+ types.
+
+ Example: SLJIT_ADD can set the Z, OVERFLOW, CARRY flags hence
+
+ sljit_op2(..., SLJIT_ADD, ...)
+ Both the zero and variable flags are undefined so they can
+ have any value after the operation is completed.
+
+ sljit_op2(..., SLJIT_ADD | SLJIT_SET_Z, ...)
+ Sets the zero flag if the result is zero, clears it otherwise.
+ The variable flag is undefined.
+
+ sljit_op2(..., SLJIT_ADD | SLJIT_SET_OVERFLOW, ...)
+ Sets the variable flag if an integer overflow occurs, clears
+ it otherwise. The zero flag is undefined.
+
+ sljit_op2(..., SLJIT_ADD | SLJIT_SET_Z | SLJIT_SET_CARRY, ...)
+ Sets the zero flag if the result is zero, clears it otherwise.
+ Sets the variable flag if unsigned overflow (carry) occurs,
+ clears it otherwise.
+
+ If an instruction (e.g. SLJIT_MOV) does not modify flags the flags are
+ unchanged.
+
+ Using these flags can reduce the number of emitted instructions. E.g. a
+ fast loop can be implemented by decreasing a counter register and set the
+ zero flag to jump back if the counter register is not reached zero.
+
+ Motivation: although CPUs can set a large number of flags, usually their
+ values are ignored or only one of them is used. Emulating a large number
+ of flags on systems without flag register is complicated so SLJIT
+ instructions must specify the flag they want to use and only that flag
+ will be emulated. The last arithmetic instruction can be repeated if
+ multiple flags needs to be checked.
+*/
+
+/* Set Zero status flag. */
+#define SLJIT_SET_Z 0x0200
+/* Set the variable status flag if condition is true.
+ See comparison types. */
+#define SLJIT_SET(condition) ((condition) << 10)
/* Notes:
- you cannot postpone conditional jump instructions except if noted that
@@ -707,11 +834,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
/* Starting index of opcodes for sljit_emit_op0. */
#define SLJIT_OP0_BASE 0
-/* Flags: - (never set any flags)
+/* Flags: - (does not modify flags)
Note: breakpoint instruction is not supported by all architectures (e.g. ppc)
It falls back to SLJIT_NOP in those cases. */
#define SLJIT_BREAKPOINT (SLJIT_OP0_BASE + 0)
-/* Flags: - (never set any flags)
+/* Flags: - (does not modify flags)
Note: may or may not cause an extra cycle wait
it can even decrease the runtime in a few cases. */
#define SLJIT_NOP (SLJIT_OP0_BASE + 1)
@@ -723,13 +850,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
Signed multiplication of SLJIT_R0 and SLJIT_R1.
Result is placed into SLJIT_R1:SLJIT_R0 (high:low) word */
#define SLJIT_LMUL_SW (SLJIT_OP0_BASE + 3)
-/* Flags: I - (may destroy flags)
+/* Flags: - (may destroy flags)
Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1.
The result is placed into SLJIT_R0 and the remainder into SLJIT_R1.
Note: if SLJIT_R1 is 0, the behaviour is undefined. */
#define SLJIT_DIVMOD_UW (SLJIT_OP0_BASE + 4)
#define SLJIT_DIVMOD_U32 (SLJIT_DIVMOD_UW | SLJIT_I32_OP)
-/* Flags: I - (may destroy flags)
+/* Flags: - (may destroy flags)
Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1.
The result is placed into SLJIT_R0 and the remainder into SLJIT_R1.
Note: if SLJIT_R1 is 0, the behaviour is undefined.
@@ -737,13 +864,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
the behaviour is undefined. */
#define SLJIT_DIVMOD_SW (SLJIT_OP0_BASE + 5)
#define SLJIT_DIVMOD_S32 (SLJIT_DIVMOD_SW | SLJIT_I32_OP)
-/* Flags: I - (may destroy flags)
+/* Flags: - (may destroy flags)
Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1.
The result is placed into SLJIT_R0. SLJIT_R1 preserves its value.
Note: if SLJIT_R1 is 0, the behaviour is undefined. */
#define SLJIT_DIV_UW (SLJIT_OP0_BASE + 6)
#define SLJIT_DIV_U32 (SLJIT_DIV_UW | SLJIT_I32_OP)
-/* Flags: I - (may destroy flags)
+/* Flags: - (may destroy flags)
Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1.
The result is placed into SLJIT_R0. SLJIT_R1 preserves its value.
Note: if SLJIT_R1 is 0, the behaviour is undefined.
@@ -757,76 +884,67 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
/* Starting index of opcodes for sljit_emit_op1. */
#define SLJIT_OP1_BASE 32
-/* Notes for MOV instructions:
- U = Mov with update (pre form). If source or destination defined as SLJIT_MEM1(r1)
- or SLJIT_MEM2(r1, r2), r1 is increased by the sum of r2 and the constant argument
- UB = unsigned byte (8 bit)
- SB = signed byte (8 bit)
- UH = unsigned half (16 bit)
- SH = signed half (16 bit)
- UI = unsigned int (32 bit)
- SI = signed int (32 bit)
- P = pointer (sljit_p) size */
-
-/* Flags: - (never set any flags) */
+/* The MOV instruction transfer data from source to destination.
+
+ MOV instruction suffixes:
+
+ U8 - unsigned 8 bit data transfer
+ S8 - signed 8 bit data transfer
+ U16 - unsigned 16 bit data transfer
+ S16 - signed 16 bit data transfer
+ U32 - unsigned int (32 bit) data transfer
+ S32 - signed int (32 bit) data transfer
+ P - pointer (sljit_p) data transfer
+
+ If the destination of a MOV instruction is SLJIT_UNUSED and the source
+ operand is a memory address the compiler emits a prefetch instruction
+ if this instruction is supported by the current CPU. Higher data sizes
+ bring the data closer to the core: a MOV with word size loads the data
+ into a higher level cache than a byte size. Otherwise the type does not
+ affect the prefetch instruction. Furthermore a prefetch instruction
+ never fails, so it can be used to prefetch a data from an address and
+ check whether that address is NULL afterwards.
+*/
+
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV (SLJIT_OP1_BASE + 0)
-/* Flags: I - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV_U8 (SLJIT_OP1_BASE + 1)
#define SLJIT_MOV32_U8 (SLJIT_MOV_U8 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV_S8 (SLJIT_OP1_BASE + 2)
#define SLJIT_MOV32_S8 (SLJIT_MOV_S8 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV_U16 (SLJIT_OP1_BASE + 3)
#define SLJIT_MOV32_U16 (SLJIT_MOV_U16 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV_S16 (SLJIT_OP1_BASE + 4)
#define SLJIT_MOV32_S16 (SLJIT_MOV_S16 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags)
+/* Flags: - (does not modify flags)
Note: no SLJIT_MOV32_U32 form, since it is the same as SLJIT_MOV32 */
#define SLJIT_MOV_U32 (SLJIT_OP1_BASE + 5)
-/* Flags: I - (never set any flags)
+/* Flags: - (does not modify flags)
Note: no SLJIT_MOV32_S32 form, since it is the same as SLJIT_MOV32 */
#define SLJIT_MOV_S32 (SLJIT_OP1_BASE + 6)
-/* Flags: I - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV32 (SLJIT_MOV_S32 | SLJIT_I32_OP)
-/* Flags: - (never set any flags) */
+/* Flags: - (does not modify flags)
+ Note: load a pointer sized data, useful on x32 (a 32 bit mode on x86-64
+ where all x64 features are available, e.g. 16 register) or similar
+ compiling modes */
#define SLJIT_MOV_P (SLJIT_OP1_BASE + 7)
-/* Flags: - (never set any flags) */
-#define SLJIT_MOVU (SLJIT_OP1_BASE + 8)
-/* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_U8 (SLJIT_OP1_BASE + 9)
-#define SLJIT_MOVU32_U8 (SLJIT_MOVU_U8 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_S8 (SLJIT_OP1_BASE + 10)
-#define SLJIT_MOVU32_S8 (SLJIT_MOVU_S8 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_U16 (SLJIT_OP1_BASE + 11)
-#define SLJIT_MOVU32_U16 (SLJIT_MOVU_U16 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags) */
-#define SLJIT_MOVU_S16 (SLJIT_OP1_BASE + 12)
-#define SLJIT_MOVU32_S16 (SLJIT_MOVU_S16 | SLJIT_I32_OP)
-/* Flags: I - (never set any flags)
- Note: no SLJIT_MOVU32_U32 form, since it is the same as SLJIT_MOVU32 */
-#define SLJIT_MOVU_U32 (SLJIT_OP1_BASE + 13)
-/* Flags: I - (never set any flags)
- Note: no SLJIT_MOVU32_S32 form, since it is the same as SLJIT_MOVU32 */
-#define SLJIT_MOVU_S32 (SLJIT_OP1_BASE + 14)
-/* Flags: I - (never set any flags) */
-#define SLJIT_MOVU32 (SLJIT_MOVU_S32 | SLJIT_I32_OP)
-/* Flags: - (never set any flags) */
-#define SLJIT_MOVU_P (SLJIT_OP1_BASE + 15)
-/* Flags: I | E | K */
-#define SLJIT_NOT (SLJIT_OP1_BASE + 16)
+/* Flags: Z
+ Note: immediate source argument is not supported */
+#define SLJIT_NOT (SLJIT_OP1_BASE + 8)
#define SLJIT_NOT32 (SLJIT_NOT | SLJIT_I32_OP)
-/* Flags: I | E | O | K */
-#define SLJIT_NEG (SLJIT_OP1_BASE + 17)
+/* Flags: Z | OVERFLOW
+ Note: immediate source argument is not supported */
+#define SLJIT_NEG (SLJIT_OP1_BASE + 9)
#define SLJIT_NEG32 (SLJIT_NEG | SLJIT_I32_OP)
/* Count leading zeroes
- Flags: I | E | K
- Important note! Sparc 32 does not support K flag, since
- the required popc instruction is introduced only in sparc 64. */
-#define SLJIT_CLZ (SLJIT_OP1_BASE + 18)
+ Flags: - (may destroy flags)
+ Note: immediate source argument is not supported */
+#define SLJIT_CLZ (SLJIT_OP1_BASE + 10)
#define SLJIT_CLZ32 (SLJIT_CLZ | SLJIT_I32_OP)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
@@ -836,46 +954,48 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
/* Starting index of opcodes for sljit_emit_op2. */
#define SLJIT_OP2_BASE 96
-/* Flags: I | E | O | C | K */
+/* Flags: Z | OVERFLOW | CARRY */
#define SLJIT_ADD (SLJIT_OP2_BASE + 0)
#define SLJIT_ADD32 (SLJIT_ADD | SLJIT_I32_OP)
-/* Flags: I | C | K */
+/* Flags: CARRY */
#define SLJIT_ADDC (SLJIT_OP2_BASE + 1)
#define SLJIT_ADDC32 (SLJIT_ADDC | SLJIT_I32_OP)
-/* Flags: I | E | U | S | O | C | K */
+/* Flags: Z | LESS | GREATER_EQUAL | GREATER | LESS_EQUAL
+ SIG_LESS | SIG_GREATER_EQUAL | SIG_GREATER
+ SIG_LESS_EQUAL | CARRY */
#define SLJIT_SUB (SLJIT_OP2_BASE + 2)
#define SLJIT_SUB32 (SLJIT_SUB | SLJIT_I32_OP)
-/* Flags: I | C | K */
+/* Flags: CARRY */
#define SLJIT_SUBC (SLJIT_OP2_BASE + 3)
#define SLJIT_SUBC32 (SLJIT_SUBC | SLJIT_I32_OP)
/* Note: integer mul
- Flags: I | O (see SLJIT_C_MUL_*) | K */
+ Flags: MUL_OVERFLOW */
#define SLJIT_MUL (SLJIT_OP2_BASE + 4)
#define SLJIT_MUL32 (SLJIT_MUL | SLJIT_I32_OP)
-/* Flags: I | E | K */
+/* Flags: Z */
#define SLJIT_AND (SLJIT_OP2_BASE + 5)
#define SLJIT_AND32 (SLJIT_AND | SLJIT_I32_OP)
-/* Flags: I | E | K */
+/* Flags: Z */
#define SLJIT_OR (SLJIT_OP2_BASE + 6)
#define SLJIT_OR32 (SLJIT_OR | SLJIT_I32_OP)
-/* Flags: I | E | K */
+/* Flags: Z */
#define SLJIT_XOR (SLJIT_OP2_BASE + 7)
#define SLJIT_XOR32 (SLJIT_XOR | SLJIT_I32_OP)
-/* Flags: I | E | K
+/* Flags: Z
Let bit_length be the length of the shift operation: 32 or 64.
If src2 is immediate, src2w is masked by (bit_length - 1).
Otherwise, if the content of src2 is outside the range from 0
to bit_length - 1, the result is undefined. */
#define SLJIT_SHL (SLJIT_OP2_BASE + 8)
#define SLJIT_SHL32 (SLJIT_SHL | SLJIT_I32_OP)
-/* Flags: I | E | K
+/* Flags: Z
Let bit_length be the length of the shift operation: 32 or 64.
If src2 is immediate, src2w is masked by (bit_length - 1).
Otherwise, if the content of src2 is outside the range from 0
to bit_length - 1, the result is undefined. */
#define SLJIT_LSHR (SLJIT_OP2_BASE + 9)
#define SLJIT_LSHR32 (SLJIT_LSHR | SLJIT_I32_OP)
-/* Flags: I | E | K
+/* Flags: Z
Let bit_length be the length of the shift operation: 32 or 64.
If src2 is immediate, src2w is masked by (bit_length - 1).
Otherwise, if the content of src2 is outside the range from 0
@@ -888,44 +1008,38 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w);
-/* Returns with non-zero if fpu is available. */
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void);
-
/* Starting index of opcodes for sljit_emit_fop1. */
#define SLJIT_FOP1_BASE 128
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MOV_F64 (SLJIT_FOP1_BASE + 0)
#define SLJIT_MOV_F32 (SLJIT_MOV_F64 | SLJIT_F32_OP)
/* Convert opcodes: CONV[DST_TYPE].FROM[SRC_TYPE]
SRC/DST TYPE can be: D - double, S - single, W - signed word, I - signed int
Rounding mode when the destination is W or I: round towards zero. */
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_CONV_F64_FROM_F32 (SLJIT_FOP1_BASE + 1)
#define SLJIT_CONV_F32_FROM_F64 (SLJIT_CONV_F64_FROM_F32 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_CONV_SW_FROM_F64 (SLJIT_FOP1_BASE + 2)
#define SLJIT_CONV_SW_FROM_F32 (SLJIT_CONV_SW_FROM_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_CONV_S32_FROM_F64 (SLJIT_FOP1_BASE + 3)
#define SLJIT_CONV_S32_FROM_F32 (SLJIT_CONV_S32_FROM_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_CONV_F64_FROM_SW (SLJIT_FOP1_BASE + 4)
#define SLJIT_CONV_F32_FROM_SW (SLJIT_CONV_F64_FROM_SW | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_CONV_F64_FROM_S32 (SLJIT_FOP1_BASE + 5)
#define SLJIT_CONV_F32_FROM_S32 (SLJIT_CONV_F64_FROM_S32 | SLJIT_F32_OP)
/* Note: dst is the left and src is the right operand for SLJIT_CMPD.
- Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED flag
- is set, the comparison result is unpredictable.
- Flags: SP | E | S (see SLJIT_C_FLOAT_*) */
+ Flags: EQUAL_F | LESS_F | GREATER_EQUAL_F | GREATER_F | LESS_EQUAL_F */
#define SLJIT_CMP_F64 (SLJIT_FOP1_BASE + 6)
#define SLJIT_CMP_F32 (SLJIT_CMP_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_NEG_F64 (SLJIT_FOP1_BASE + 7)
#define SLJIT_NEG_F32 (SLJIT_NEG_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_ABS_F64 (SLJIT_FOP1_BASE + 8)
#define SLJIT_ABS_F32 (SLJIT_ABS_F64 | SLJIT_F32_OP)
@@ -936,16 +1050,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
/* Starting index of opcodes for sljit_emit_fop2. */
#define SLJIT_FOP2_BASE 160
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_ADD_F64 (SLJIT_FOP2_BASE + 0)
#define SLJIT_ADD_F32 (SLJIT_ADD_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_SUB_F64 (SLJIT_FOP2_BASE + 1)
#define SLJIT_SUB_F32 (SLJIT_SUB_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_MUL_F64 (SLJIT_FOP2_BASE + 2)
#define SLJIT_MUL_F32 (SLJIT_MUL_F64 | SLJIT_F32_OP)
-/* Flags: SP - (never set any flags) */
+/* Flags: - (does not modify flags) */
#define SLJIT_DIV_F64 (SLJIT_FOP2_BASE + 3)
#define SLJIT_DIV_F32 (SLJIT_DIV_F64 | SLJIT_F32_OP)
@@ -972,69 +1086,98 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
#define SLJIT_LESS 2
#define SLJIT_LESS32 (SLJIT_LESS | SLJIT_I32_OP)
+#define SLJIT_SET_LESS SLJIT_SET(SLJIT_LESS)
#define SLJIT_GREATER_EQUAL 3
#define SLJIT_GREATER_EQUAL32 (SLJIT_GREATER_EQUAL | SLJIT_I32_OP)
+#define SLJIT_SET_GREATER_EQUAL SLJIT_SET(SLJIT_GREATER_EQUAL)
#define SLJIT_GREATER 4
#define SLJIT_GREATER32 (SLJIT_GREATER | SLJIT_I32_OP)
+#define SLJIT_SET_GREATER SLJIT_SET(SLJIT_GREATER)
#define SLJIT_LESS_EQUAL 5
#define SLJIT_LESS_EQUAL32 (SLJIT_LESS_EQUAL | SLJIT_I32_OP)
+#define SLJIT_SET_LESS_EQUAL SLJIT_SET(SLJIT_LESS_EQUAL)
#define SLJIT_SIG_LESS 6
#define SLJIT_SIG_LESS32 (SLJIT_SIG_LESS | SLJIT_I32_OP)
+#define SLJIT_SET_SIG_LESS SLJIT_SET(SLJIT_SIG_LESS)
#define SLJIT_SIG_GREATER_EQUAL 7
#define SLJIT_SIG_GREATER_EQUAL32 (SLJIT_SIG_GREATER_EQUAL | SLJIT_I32_OP)
+#define SLJIT_SET_SIG_GREATER_EQUAL SLJIT_SET(SLJIT_SIG_GREATER_EQUAL)
#define SLJIT_SIG_GREATER 8
#define SLJIT_SIG_GREATER32 (SLJIT_SIG_GREATER | SLJIT_I32_OP)
+#define SLJIT_SET_SIG_GREATER SLJIT_SET(SLJIT_SIG_GREATER)
#define SLJIT_SIG_LESS_EQUAL 9
#define SLJIT_SIG_LESS_EQUAL32 (SLJIT_SIG_LESS_EQUAL | SLJIT_I32_OP)
+#define SLJIT_SET_SIG_LESS_EQUAL SLJIT_SET(SLJIT_SIG_LESS_EQUAL)
#define SLJIT_OVERFLOW 10
#define SLJIT_OVERFLOW32 (SLJIT_OVERFLOW | SLJIT_I32_OP)
+#define SLJIT_SET_OVERFLOW SLJIT_SET(SLJIT_OVERFLOW)
#define SLJIT_NOT_OVERFLOW 11
#define SLJIT_NOT_OVERFLOW32 (SLJIT_NOT_OVERFLOW | SLJIT_I32_OP)
#define SLJIT_MUL_OVERFLOW 12
#define SLJIT_MUL_OVERFLOW32 (SLJIT_MUL_OVERFLOW | SLJIT_I32_OP)
+#define SLJIT_SET_MUL_OVERFLOW SLJIT_SET(SLJIT_MUL_OVERFLOW)
#define SLJIT_MUL_NOT_OVERFLOW 13
#define SLJIT_MUL_NOT_OVERFLOW32 (SLJIT_MUL_NOT_OVERFLOW | SLJIT_I32_OP)
+/* There is no SLJIT_CARRY or SLJIT_NOT_CARRY. */
+#define SLJIT_SET_CARRY SLJIT_SET(14)
+
/* Floating point comparison types. */
-#define SLJIT_EQUAL_F64 14
+#define SLJIT_EQUAL_F64 16
#define SLJIT_EQUAL_F32 (SLJIT_EQUAL_F64 | SLJIT_F32_OP)
-#define SLJIT_NOT_EQUAL_F64 15
+#define SLJIT_SET_EQUAL_F SLJIT_SET(SLJIT_EQUAL_F64)
+#define SLJIT_NOT_EQUAL_F64 17
#define SLJIT_NOT_EQUAL_F32 (SLJIT_NOT_EQUAL_F64 | SLJIT_F32_OP)
-#define SLJIT_LESS_F64 16
+#define SLJIT_SET_NOT_EQUAL_F SLJIT_SET(SLJIT_NOT_EQUAL_F64)
+#define SLJIT_LESS_F64 18
#define SLJIT_LESS_F32 (SLJIT_LESS_F64 | SLJIT_F32_OP)
-#define SLJIT_GREATER_EQUAL_F64 17
+#define SLJIT_SET_LESS_F SLJIT_SET(SLJIT_LESS_F64)
+#define SLJIT_GREATER_EQUAL_F64 19
#define SLJIT_GREATER_EQUAL_F32 (SLJIT_GREATER_EQUAL_F64 | SLJIT_F32_OP)
-#define SLJIT_GREATER_F64 18
+#define SLJIT_SET_GREATER_EQUAL_F SLJIT_SET(SLJIT_GREATER_EQUAL_F64)
+#define SLJIT_GREATER_F64 20
#define SLJIT_GREATER_F32 (SLJIT_GREATER_F64 | SLJIT_F32_OP)
-#define SLJIT_LESS_EQUAL_F64 19
+#define SLJIT_SET_GREATER_F SLJIT_SET(SLJIT_GREATER_F64)
+#define SLJIT_LESS_EQUAL_F64 21
#define SLJIT_LESS_EQUAL_F32 (SLJIT_LESS_EQUAL_F64 | SLJIT_F32_OP)
-#define SLJIT_UNORDERED_F64 20
+#define SLJIT_SET_LESS_EQUAL_F SLJIT_SET(SLJIT_LESS_EQUAL_F64)
+#define SLJIT_UNORDERED_F64 22
#define SLJIT_UNORDERED_F32 (SLJIT_UNORDERED_F64 | SLJIT_F32_OP)
-#define SLJIT_ORDERED_F64 21
+#define SLJIT_SET_UNORDERED_F SLJIT_SET(SLJIT_UNORDERED_F64)
+#define SLJIT_ORDERED_F64 23
#define SLJIT_ORDERED_F32 (SLJIT_ORDERED_F64 | SLJIT_F32_OP)
+#define SLJIT_SET_ORDERED_F SLJIT_SET(SLJIT_ORDERED_F64)
/* Unconditional jump types. */
-#define SLJIT_JUMP 22
-#define SLJIT_FAST_CALL 23
-#define SLJIT_CALL0 24
-#define SLJIT_CALL1 25
-#define SLJIT_CALL2 26
-#define SLJIT_CALL3 27
-
-/* Fast calling method. See sljit_emit_fast_enter / sljit_emit_fast_return. */
+#define SLJIT_JUMP 24
+ /* Fast calling method. See sljit_emit_fast_enter / sljit_emit_fast_return. */
+#define SLJIT_FAST_CALL 25
+ /* Called function must be declared with the SLJIT_FUNC attribute. */
+#define SLJIT_CALL 26
+ /* Called function must be decalred with cdecl attribute.
+ This is the default attribute for C functions. */
+#define SLJIT_CALL_CDECL 27
/* The target can be changed during runtime (see: sljit_set_jump_addr). */
#define SLJIT_REWRITABLE_JUMP 0x1000
/* Emit a jump instruction. The destination is not set, only the type of the jump.
- type must be between SLJIT_EQUAL and SLJIT_CALL3
+ type must be between SLJIT_EQUAL and SLJIT_FAST_CALL
type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
- Flags: - (never set any flags) for both conditional and unconditional jumps.
- Flags: destroy all flags for calls. */
+
+ Flags: does not modify flags. */
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type);
+/* Emit a C compiler (ABI) compatible function call.
+ type must be SLJIT_CALL or SLJIT_CALL_CDECL
+ type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
+ arg_types is the combination of SLJIT_RET / SLJIT_ARGx (SLJIT_DEF_RET / SLJIT_DEF_ARGx) macros
+
+ Flags: destroy all flags. */
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 arg_types);
+
/* Basic arithmetic comparison. In most architectures it is implemented as
an SLJIT_SUB operation (with SLJIT_UNUSED destination and setting
appropriate flags) followed by a sljit_emit_jump. However some
@@ -1042,7 +1185,8 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
It is suggested to use this comparison form when appropriate.
type must be between SLJIT_EQUAL and SLJIT_I_SIG_LESS_EQUAL
type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
- Flags: destroy flags. */
+
+ Flags: may destroy flags. */
SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w);
@@ -1066,40 +1210,112 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sl
/* Set the destination address of the jump to this label. */
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target);
-/* Call function or jump anywhere. Both direct and indirect form
- type must be between SLJIT_JUMP and SLJIT_CALL3
- Direct form: set src to SLJIT_IMM() and srcw to the address
- Indirect form: any other valid addressing mode
- Flags: - (never set any flags) for unconditional jumps.
- Flags: destroy all flags for calls. */
+/* Emit an indirect jump or fast call. Both direct and indirect form
+ Direct form: set src to SLJIT_IMM() and srcw to the address
+ Indirect form: any other valid addressing mode
+ type must be between SLJIT_JUMP and SLJIT_FAST_CALL
+
+ Flags: does not modify flags. */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw);
+/* Emit a C compiler (ABI) compatible function call.
+ Direct form: set src to SLJIT_IMM() and srcw to the address
+ Indirect form: any other valid addressing mode
+ type must be SLJIT_CALL or SLJIT_CALL_CDECL
+ arg_types is the combination of SLJIT_RET / SLJIT_ARGx (SLJIT_DEF_RET / SLJIT_DEF_ARGx) macros
+
+ Flags: destroy all flags. */
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 arg_types, sljit_s32 src, sljit_sw srcw);
+
/* Perform the operation using the conditional flags as the second argument.
- Type must always be between SLJIT_EQUAL and SLJIT_S_ORDERED. The value
+ Type must always be between SLJIT_EQUAL and SLJIT_ORDERED_F64. The value
represented by the type is 1, if the condition represented by the type
is fulfilled, and 0 otherwise.
- If op == SLJIT_MOV, SLJIT_MOV_S32, SLJIT_MOV_U32:
+ If op == SLJIT_MOV, SLJIT_MOV32:
Set dst to the value represented by the type (0 or 1).
- Src must be SLJIT_UNUSED, and srcw must be 0
- Flags: - (never set any flags)
+ Flags: - (does not modify flags)
If op == SLJIT_OR, op == SLJIT_AND, op == SLJIT_XOR
- Performs the binary operation using src as the first, and the value
- represented by type as the second argument.
- Important note: only dst=src and dstw=srcw is supported at the moment!
- Flags: I | E | K
- Note: sljit_emit_op_flags does nothing, if dst is SLJIT_UNUSED (regardless of op). */
+ Performs the binary operation using dst as the first, and the value
+ represented by type as the second argument. Result is written into dst.
+ Flags: Z (may destroy flags) */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type);
-/* Copies the base address of SLJIT_SP + offset to dst.
- Flags: - (never set any flags) */
+/* Emit a conditional mov instruction which moves source to destination,
+ if the condition is satisfied. Unlike other arithmetic operations this
+ instruction does not support memory access.
+
+ type must be between SLJIT_EQUAL and SLJIT_ORDERED_F64
+ dst_reg must be a valid register and it can be combined
+ with SLJIT_I32_OP to perform a 32 bit arithmetic operation
+ src must be register or immediate (SLJIT_IMM)
+
+ Flags: - (does not modify flags) */
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw);
+
+/* The following flags are used by sljit_emit_mem() and sljit_emit_fmem(). */
+
+/* When SLJIT_MEM_SUPP is passed, no instructions are emitted.
+ Instead the function returns with SLJIT_SUCCESS if the instruction
+ form is supported and SLJIT_ERR_UNSUPPORTED otherwise. This flag
+ allows runtime checking of available instruction forms. */
+#define SLJIT_MEM_SUPP 0x0200
+/* Memory load operation. This is the default. */
+#define SLJIT_MEM_LOAD 0x0000
+/* Memory store operation. */
+#define SLJIT_MEM_STORE 0x0400
+/* Base register is updated before the memory access. */
+#define SLJIT_MEM_PRE 0x0800
+/* Base register is updated after the memory access. */
+#define SLJIT_MEM_POST 0x1000
+
+/* Emit a single memory load or store with update instruction. When the
+ requested instruction from is not supported by the CPU, it returns
+ with SLJIT_ERR_UNSUPPORTED instead of emulating the instruction. This
+ allows specializing tight loops based on the supported instruction
+ forms (see SLJIT_MEM_SUPP flag).
+
+ type must be between SLJIT_MOV and SLJIT_MOV_P and can be
+ combined with SLJIT_MEM_* flags. Either SLJIT_MEM_PRE
+ or SLJIT_MEM_POST must be specified.
+ reg is the source or destination register, and must be
+ different from the base register of the mem operand
+ mem must be a SLJIT_MEM1() or SLJIT_MEM2() operand
+
+ Flags: - (does not modify flags) */
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw);
+
+/* Same as sljit_emit_mem except the followings:
+
+ type must be SLJIT_MOV_F64 or SLJIT_MOV_F32 and can be
+ combined with SLJIT_MEM_* flags. Either SLJIT_MEM_PRE
+ or SLJIT_MEM_POST must be specified.
+ freg is the source or destination floating point register */
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 freg,
+ sljit_s32 mem, sljit_sw memw);
+
+/* Copies the base address of SLJIT_SP + offset to dst. The offset can be
+ anything to negate the effect of relative addressing. For example if an
+ array of sljit_sw values is stored on the stack from offset 0x40, and R0
+ contains the offset of an array item plus 0x120, this item can be
+ overwritten by two SLJIT instructions:
+
+ sljit_get_local_base(compiler, SLJIT_R1, 0, 0x40 - 0x120);
+ sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM2(SLJIT_R1, SLJIT_R0), 0, SLJIT_IMM, 0x5);
+
+ Flags: - (may destroy flags) */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset);
/* The constant can be changed runtime (see: sljit_set_const)
- Flags: - (never set any flags) */
+ Flags: - (does not modify flags) */
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value);
/* After the code generation the address for label, jump and const instructions
@@ -1119,7 +1335,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
/* --------------------------------------------------------------------- */
#define SLJIT_MAJOR_VERSION 0
-#define SLJIT_MINOR_VERSION 93
+#define SLJIT_MINOR_VERSION 94
/* Get the human readable name of the platform. Can be useful on platforms
like ARM, where ARM and Thumb2 functions can be mixed, and
@@ -1131,53 +1347,58 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void);
#if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)
/* This global lock is useful to compile common functions. */
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void);
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void);
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_grab_lock(void);
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_release_lock(void);
#endif
#if (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK)
-/* The sljit_stack is a utiliy feature of sljit, which allocates a
- writable memory region between base (inclusive) and limit (exclusive).
- Both base and limit is a pointer, and base is always <= than limit.
- This feature uses the "address space reserve" feature
- of modern operating systems. Basically we don't need to allocate a
- huge memory block in one step for the worst case, we can start with
- a smaller chunk and extend it later. Since the address space is
- reserved, the data never copied to other regions, thus it is safe
- to store pointers here. */
-
-/* Note: The base field is aligned to PAGE_SIZE bytes (usually 4k or more).
- Note: stack growing should not happen in small steps: 4k, 16k or even
- bigger growth is better.
- Note: this structure may not be supported by all operating systems.
- Some kind of fallback mechanism is suggested when SLJIT_UTIL_STACK
- is not defined. */
+/* The sljit_stack structure and its manipulation functions provides
+ an implementation for a top-down stack. The stack top is stored
+ in the end field of the sljit_stack structure and the stack goes
+ down to the min_start field, so the memory region reserved for
+ this stack is between min_start (inclusive) and end (exclusive)
+ fields. However the application can only use the region between
+ start (inclusive) and end (exclusive) fields. The sljit_stack_resize
+ function can be used to extend this region up to min_start.
+
+ This feature uses the "address space reserve" feature of modern
+ operating systems. Instead of allocating a large memory block
+ applications can allocate a small memory region and extend it
+ later without moving the content of the memory area. Therefore
+ after a successful resize by sljit_stack_resize all pointers into
+ this region are still valid.
+
+ Note:
+ this structure may not be supported by all operating systems.
+ end and max_limit fields are aligned to PAGE_SIZE bytes (usually
+ 4 Kbyte or more).
+ stack should grow in larger steps, e.g. 4Kbyte, 16Kbyte or more. */
struct sljit_stack {
/* User data, anything can be stored here.
- Starting with the same value as base. */
- sljit_uw top;
- /* These members are read only. */
- sljit_uw base;
- sljit_uw limit;
- sljit_uw max_limit;
+ Initialized to the same value as the end field. */
+ sljit_u8 *top;
+/* These members are read only. */
+ /* End address of the stack */
+ sljit_u8 *end;
+ /* Current start address of the stack. */
+ sljit_u8 *start;
+ /* Lowest start address of the stack. */
+ sljit_u8 *min_start;
};
-/* Returns NULL if unsuccessful.
- Note: limit and max_limit contains the size for stack allocation.
- Note: the top field is initialized to base.
+/* Allocates a new stack. Returns NULL if unsuccessful.
Note: see sljit_create_compiler for the explanation of allocator_data. */
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit, void *allocator_data);
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_free_stack(struct sljit_stack *stack, void *allocator_data);
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_FUNC sljit_allocate_stack(sljit_uw start_size, sljit_uw max_size, void *allocator_data);
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_free_stack(struct sljit_stack *stack, void *allocator_data);
-/* Can be used to increase (allocate) or decrease (free) the memory area.
- Returns with a non-zero value if unsuccessful. If new_limit is greater than
- max_limit, it will fail. It is very easy to implement a stack data structure,
- since the growth ratio can be added to the current limit, and sljit_stack_resize
- will do all the necessary checks. The fields of the stack are not changed if
- sljit_stack_resize fails. */
-SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_stack *stack, sljit_uw new_limit);
+/* Can be used to increase (extend) or decrease (shrink) the stack
+ memory area. Returns with new_start if successful and NULL otherwise.
+ It always fails if new_start is less than min_start or greater or equal
+ than end fields. The fields of the stack are not changed if the returned
+ value is NULL (the current memory content is never lost). */
+SLJIT_API_FUNC_ATTRIBUTE sljit_u8 *SLJIT_FUNC sljit_stack_resize(struct sljit_stack *stack, sljit_u8 *new_start);
#endif /* (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK) */
@@ -1206,6 +1427,15 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct
#endif /* !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) */
+#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
+/* Free unused executable memory. The allocator keeps some free memory
+ around to reduce the number of OS executable memory allocations.
+ This improves performance since these calls are costly. However
+ it is sometimes desired to free all unused memory regions, e.g.
+ before the application terminates. */
+SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void);
+#endif
+
/* --------------------------------------------------------------------- */
/* CPU specific functions */
/* --------------------------------------------------------------------- */
@@ -1238,32 +1468,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
void *instruction, sljit_s32 size);
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
-
-/* Returns with non-zero if sse2 is available. */
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_sse2_available(void);
-
-/* Returns with non-zero if cmov instruction is available. */
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_cmov_available(void);
-
-/* Emit a conditional mov instruction on x86 CPUs. This instruction
- moves src to destination, if the condition is satisfied. Unlike
- other arithmetic instructions, destination must be a register.
- Before such instructions are emitted, cmov support should be
- checked by sljit_x86_is_cmov_available function.
- type must be between SLJIT_EQUAL and SLJIT_S_ORDERED
- dst_reg must be a valid register and it can be combined
- with SLJIT_I32_OP to perform 32 bit arithmetic
- Flags: I - (never set any flags)
- */
+/* Define the currently available CPU status flags. It is usually used after an
+ sljit_emit_op_custom call to define which flags are set. */
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_emit_cmov(struct sljit_compiler *compiler,
- sljit_s32 type,
- sljit_s32 dst_reg,
- sljit_s32 src, sljit_sw srcw);
-
-#endif
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler,
+ sljit_s32 current_flags);
#endif /* _SLJIT_LIR_H_ */
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeARM_32.c b/thirdparty/pcre2/src/sljit/sljitNativeARM_32.c
index 09701d53fc..6d61eed9a7 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeARM_32.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeARM_32.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -24,12 +24,18 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef __SOFTFP__
+#define ARM_ABI_INFO " ABI:softfp"
+#else
+#define ARM_ABI_INFO " ABI:hardfp"
+#endif
+
SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
{
#if (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
- return "ARMv7" SLJIT_CPUINFO;
+ return "ARMv7" SLJIT_CPUINFO ARM_ABI_INFO;
#elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
- return "ARMv5" SLJIT_CPUINFO;
+ return "ARMv5" SLJIT_CPUINFO ARM_ABI_INFO;
#else
#error "Internal error: Unknown ARM architecture"
#endif
@@ -38,11 +44,10 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
/* Last register + 1. */
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
-#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
-#define TMP_PC (SLJIT_NUMBER_OF_REGISTERS + 5)
+#define TMP_PC (SLJIT_NUMBER_OF_REGISTERS + 4)
-#define TMP_FREG1 (0)
-#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
/* In ARM instruction words.
Cache lines are usually 32 byte aligned. */
@@ -55,8 +60,12 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
(((max_diff) / (sljit_s32)sizeof(sljit_uw)) - (CONST_POOL_ALIGNMENT - 1))
/* See sljit_emit_enter and sljit_emit_op0 if you want to change them. */
-static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
- 0, 0, 1, 2, 11, 10, 9, 8, 7, 6, 5, 4, 13, 3, 12, 14, 15
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+ 0, 0, 1, 2, 3, 11, 10, 9, 8, 7, 6, 5, 4, 13, 12, 14, 15
+};
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7
};
#define RM(rm) (reg_map[rm])
@@ -73,31 +82,31 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define CONDITIONAL 0xe0000000
#define PUSH_POOL 0xff000000
-/* DP - Data Processing instruction (use with EMIT_DATA_PROCESS_INS). */
-#define ADC_DP 0x5
-#define ADD_DP 0x4
-#define AND_DP 0x0
+#define ADC 0xe0a00000
+#define ADD 0xe0800000
+#define AND 0xe0000000
#define B 0xea000000
-#define BIC_DP 0xe
+#define BIC 0xe1c00000
#define BL 0xeb000000
#define BLX 0xe12fff30
#define BX 0xe12fff10
#define CLZ 0xe16f0f10
-#define CMP_DP 0xa
+#define CMN 0xe1600000
+#define CMP 0xe1400000
#define BKPT 0xe1200070
-#define EOR_DP 0x1
-#define MOV_DP 0xd
+#define EOR 0xe0200000
+#define MOV 0xe1a00000
#define MUL 0xe0000090
-#define MVN_DP 0xf
+#define MVN 0xe1e00000
#define NOP 0xe1a00000
-#define ORR_DP 0xc
+#define ORR 0xe1800000
#define PUSH 0xe92d0000
#define POP 0xe8bd0000
-#define RSB_DP 0x3
-#define RSC_DP 0x7
-#define SBC_DP 0x6
+#define RSB 0xe0600000
+#define RSC 0xe0e00000
+#define SBC 0xe0c00000
#define SMULL 0xe0c00090
-#define SUB_DP 0x2
+#define SUB 0xe0400000
#define UMULL 0xe0800090
#define VABS_F32 0xeeb00ac0
#define VADD_F32 0xee300a00
@@ -108,6 +117,7 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define VDIV_F32 0xee800a00
#define VMOV_F32 0xeeb00a40
#define VMOV 0xee000a10
+#define VMOV2 0xec400a10
#define VMRS 0xeef1fa10
#define VMUL_F32 0xee200a00
#define VNEG_F32 0xeeb10a40
@@ -260,6 +270,8 @@ static SLJIT_INLINE sljit_s32 emit_blx(struct sljit_compiler *compiler)
{
/* Must follow tightly the previous instruction (to be able to convert it to bl instruction). */
SLJIT_ASSERT(compiler->cpool_diff == CONST_POOL_EMPTY || compiler->size - compiler->cpool_diff < MAX_DIFFERENCE(4092));
+ SLJIT_ASSERT(reg_map[TMP_REG1] != 14);
+
return push_inst(compiler, BLX | RM(TMP_REG1));
}
@@ -814,28 +826,77 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
return code;
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#else
+ /* Available by default. */
+ return 1;
+#endif
+
+ case SLJIT_HAS_CLZ:
+ case SLJIT_HAS_CMOV:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Entry, exit */
/* --------------------------------------------------------------------- */
-/* emit_op inp_flags.
- WRITE_BACK must be the first, since it is a flag. */
-#define WRITE_BACK 0x01
-#define ALLOW_IMM 0x02
-#define ALLOW_INV_IMM 0x04
+/* Creates an index in data_transfer_insts array. */
+#define WORD_SIZE 0x00
+#define BYTE_SIZE 0x01
+#define HALF_SIZE 0x02
+#define PRELOAD 0x03
+#define SIGNED 0x04
+#define LOAD_DATA 0x08
+
+/* Flag bits for emit_op. */
+#define ALLOW_IMM 0x10
+#define ALLOW_INV_IMM 0x20
#define ALLOW_ANY_IMM (ALLOW_IMM | ALLOW_INV_IMM)
-#define ARG_TEST 0x08
-/* Creates an index in data_transfer_insts array. */
-#define WORD_DATA 0x00
-#define BYTE_DATA 0x10
-#define HALF_DATA 0x20
-#define SIGNED_DATA 0x40
-#define LOAD_DATA 0x80
+/* s/l - store/load (1 bit)
+ u/s - signed/unsigned (1 bit)
+ w/b/h/N - word/byte/half/NOT allowed (2 bit)
+ Storing signed and unsigned values are the same operations. */
+
+static const sljit_uw data_transfer_insts[16] = {
+/* s u w */ 0xe5000000 /* str */,
+/* s u b */ 0xe5400000 /* strb */,
+/* s u h */ 0xe10000b0 /* strh */,
+/* s u N */ 0x00000000 /* not allowed */,
+/* s s w */ 0xe5000000 /* str */,
+/* s s b */ 0xe5400000 /* strb */,
+/* s s h */ 0xe10000b0 /* strh */,
+/* s s N */ 0x00000000 /* not allowed */,
+
+/* l u w */ 0xe5100000 /* ldr */,
+/* l u b */ 0xe5500000 /* ldrb */,
+/* l u h */ 0xe11000b0 /* ldrh */,
+/* l u p */ 0xf5500000 /* preload */,
+/* l s w */ 0xe5100000 /* ldr */,
+/* l s b */ 0xe11000d0 /* ldrsb */,
+/* l s h */ 0xe11000f0 /* ldrsh */,
+/* l s N */ 0x00000000 /* not allowed */,
+};
-/* Condition: AL. */
-#define EMIT_DATA_PROCESS_INS(opcode, set_flags, dst, src1, src2) \
- (0xe0000000 | ((opcode) << 21) | (set_flags) | RD(dst) | RN(src1) | (src2))
+#define EMIT_DATA_TRANSFER(type, add, target_reg, base_reg, arg) \
+ (data_transfer_insts[(type) & 0xf] | ((add) << 23) | RD(target_reg) | RN(base_reg) | (arg))
+
+/* Normal ldr/str instruction.
+ Type2: ldrsb, ldrh, ldrsh */
+#define IS_TYPE1_TRANSFER(type) \
+ (data_transfer_insts[(type) & 0xf] & 0x04000000)
+#define TYPE2_TRANSFER_IMM(imm) \
+ (((imm) & 0xf) | (((imm) & 0xf0) << 4) | (1 << 22))
static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
sljit_s32 dst, sljit_sw dstw,
@@ -843,15 +904,15 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
sljit_s32 src2, sljit_sw src2w);
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- sljit_s32 size, i, tmp;
+ sljit_s32 args, size, i, tmp;
sljit_uw push;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
/* Push saved registers, temporary registers
stmdb sp!, {..., lr} */
@@ -873,25 +934,27 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
if (local_size > 0)
FAIL_IF(emit_op(compiler, SLJIT_SUB, ALLOW_IMM, SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, local_size));
+ args = get_arg_count(arg_types);
+
if (args >= 1)
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, SLJIT_S0, SLJIT_UNUSED, RM(SLJIT_R0))));
+ FAIL_IF(push_inst(compiler, MOV | RD(SLJIT_S0) | RM(SLJIT_R0)));
if (args >= 2)
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, SLJIT_S1, SLJIT_UNUSED, RM(SLJIT_R1))));
+ FAIL_IF(push_inst(compiler, MOV | RD(SLJIT_S1) | RM(SLJIT_R1)));
if (args >= 3)
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, SLJIT_S2, SLJIT_UNUSED, RM(SLJIT_R2))));
+ FAIL_IF(push_inst(compiler, MOV | RD(SLJIT_S2) | RM(SLJIT_R2)));
return SLJIT_SUCCESS;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
sljit_s32 size;
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
compiler->local_size = ((size + local_size + 7) & ~7) - size;
@@ -929,52 +992,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
/* Operators */
/* --------------------------------------------------------------------- */
-/* s/l - store/load (1 bit)
- u/s - signed/unsigned (1 bit)
- w/b/h/N - word/byte/half/NOT allowed (2 bit)
- It contans 16 items, but not all are different. */
-
-static sljit_sw data_transfer_insts[16] = {
-/* s u w */ 0xe5000000 /* str */,
-/* s u b */ 0xe5400000 /* strb */,
-/* s u h */ 0xe10000b0 /* strh */,
-/* s u N */ 0x00000000 /* not allowed */,
-/* s s w */ 0xe5000000 /* str */,
-/* s s b */ 0xe5400000 /* strb */,
-/* s s h */ 0xe10000b0 /* strh */,
-/* s s N */ 0x00000000 /* not allowed */,
-
-/* l u w */ 0xe5100000 /* ldr */,
-/* l u b */ 0xe5500000 /* ldrb */,
-/* l u h */ 0xe11000b0 /* ldrh */,
-/* l u N */ 0x00000000 /* not allowed */,
-/* l s w */ 0xe5100000 /* ldr */,
-/* l s b */ 0xe11000d0 /* ldrsb */,
-/* l s h */ 0xe11000f0 /* ldrsh */,
-/* l s N */ 0x00000000 /* not allowed */,
-};
-
-#define EMIT_DATA_TRANSFER(type, add, wb, target, base1, base2) \
- (data_transfer_insts[(type) >> 4] | ((add) << 23) | ((wb) << 21) | (reg_map[target] << 12) | (reg_map[base1] << 16) | (base2))
-/* Normal ldr/str instruction.
- Type2: ldrsb, ldrh, ldrsh */
-#define IS_TYPE1_TRANSFER(type) \
- (data_transfer_insts[(type) >> 4] & 0x04000000)
-#define TYPE2_TRANSFER_IMM(imm) \
- (((imm) & 0xf) | (((imm) & 0xf0) << 4) | (1 << 22))
-
/* flags: */
/* Arguments are swapped. */
#define ARGS_SWAPPED 0x01
/* Inverted immediate. */
#define INV_IMM 0x02
/* Source and destination is register. */
-#define REG_DEST 0x04
-#define REG_SOURCE 0x08
- /* One instruction is enough. */
-#define FAST_DEST 0x10
- /* Multiple instructions are required. */
-#define SLOW_DEST 0x20
+#define MOVE_REG_CONV 0x04
+ /* Unused return value. */
+#define UNUSED_RETURN 0x08
/* SET_FLAGS must be (1 << 20) as it is also the value of S bit (can be used for optimization). */
#define SET_FLAGS (1 << 20)
/* dst: reg
@@ -983,157 +1009,127 @@ static sljit_sw data_transfer_insts[16] = {
SRC2_IMM must be (1 << 25) as it is also the value of I bit (can be used for optimization). */
#define SRC2_IMM (1 << 25)
-#define EMIT_DATA_PROCESS_INS_AND_RETURN(opcode) \
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(opcode, flags & SET_FLAGS, dst, src1, (src2 & SRC2_IMM) ? src2 : RM(src2)))
-
-#define EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(opcode, dst, src1, src2) \
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(opcode, flags & SET_FLAGS, dst, src1, src2))
-
#define EMIT_SHIFT_INS_AND_RETURN(opcode) \
SLJIT_ASSERT(!(flags & INV_IMM) && !(src2 & SRC2_IMM)); \
if (compiler->shift_imm != 0x20) { \
SLJIT_ASSERT(src1 == TMP_REG1); \
SLJIT_ASSERT(!(flags & ARGS_SWAPPED)); \
+ \
if (compiler->shift_imm != 0) \
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, dst, SLJIT_UNUSED, (compiler->shift_imm << 7) | (opcode << 5) | reg_map[src2])); \
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, dst, SLJIT_UNUSED, reg_map[src2])); \
+ return push_inst(compiler, MOV | (flags & SET_FLAGS) | \
+ RD(dst) | (compiler->shift_imm << 7) | (opcode << 5) | RM(src2)); \
+ return push_inst(compiler, MOV | (flags & SET_FLAGS) | RD(dst) | RM(src2)); \
} \
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, dst, SLJIT_UNUSED, (reg_map[(flags & ARGS_SWAPPED) ? src1 : src2] << 8) | (opcode << 5) | 0x10 | ((flags & ARGS_SWAPPED) ? reg_map[src2] : reg_map[src1])));
+ return push_inst(compiler, MOV | (flags & SET_FLAGS) | RD(dst) | \
+ (reg_map[(flags & ARGS_SWAPPED) ? src1 : src2] << 8) | (opcode << 5) | 0x10 | RM((flags & ARGS_SWAPPED) ? src2 : src1));
static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
sljit_s32 dst, sljit_s32 src1, sljit_s32 src2)
{
- sljit_sw mul_inst;
-
switch (GET_OPCODE(op)) {
case SLJIT_MOV:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & ARGS_SWAPPED));
if (dst != src2) {
if (src2 & SRC2_IMM) {
- if (flags & INV_IMM)
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MVN_DP, dst, SLJIT_UNUSED, src2);
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MOV_DP, dst, SLJIT_UNUSED, src2);
+ return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2);
}
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MOV_DP, dst, SLJIT_UNUSED, reg_map[src2]);
+ return push_inst(compiler, MOV | RD(dst) | RM(src2));
}
return SLJIT_SUCCESS;
case SLJIT_MOV_U8:
case SLJIT_MOV_S8:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & ARGS_SWAPPED));
- if ((flags & (REG_DEST | REG_SOURCE)) == (REG_DEST | REG_SOURCE)) {
+ if (flags & MOVE_REG_CONV) {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
if (op == SLJIT_MOV_U8)
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(AND_DP, 0, dst, src2, SRC2_IMM | 0xff));
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | reg_map[src2])));
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | (op == SLJIT_MOV_U8 ? 0x20 : 0x40) | reg_map[dst]));
+ return push_inst(compiler, AND | RD(dst) | RN(src2) | SRC2_IMM | 0xff);
+ FAIL_IF(push_inst(compiler, MOV | RD(dst) | (24 << 7) | RM(src2)));
+ return push_inst(compiler, MOV | RD(dst) | (24 << 7) | (op == SLJIT_MOV_U8 ? 0x20 : 0x40) | RM(dst));
#else
return push_inst(compiler, (op == SLJIT_MOV_U8 ? UXTB : SXTB) | RD(dst) | RM(src2));
#endif
}
else if (dst != src2) {
SLJIT_ASSERT(src2 & SRC2_IMM);
- if (flags & INV_IMM)
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MVN_DP, dst, SLJIT_UNUSED, src2);
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MOV_DP, dst, SLJIT_UNUSED, src2);
+ return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2);
}
return SLJIT_SUCCESS;
case SLJIT_MOV_U16:
case SLJIT_MOV_S16:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & ARGS_SWAPPED));
- if ((flags & (REG_DEST | REG_SOURCE)) == (REG_DEST | REG_SOURCE)) {
+ if (flags & MOVE_REG_CONV) {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | reg_map[src2])));
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | (op == SLJIT_MOV_U16 ? 0x20 : 0x40) | reg_map[dst]));
+ FAIL_IF(push_inst(compiler, MOV | RD(dst) | (16 << 7) | RM(src2)));
+ return push_inst(compiler, MOV | RD(dst) | (16 << 7) | (op == SLJIT_MOV_U16 ? 0x20 : 0x40) | RM(dst));
#else
return push_inst(compiler, (op == SLJIT_MOV_U16 ? UXTH : SXTH) | RD(dst) | RM(src2));
#endif
}
else if (dst != src2) {
SLJIT_ASSERT(src2 & SRC2_IMM);
- if (flags & INV_IMM)
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MVN_DP, dst, SLJIT_UNUSED, src2);
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MOV_DP, dst, SLJIT_UNUSED, src2);
+ return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2);
}
return SLJIT_SUCCESS;
case SLJIT_NOT:
if (src2 & SRC2_IMM) {
- if (flags & INV_IMM)
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MOV_DP, dst, SLJIT_UNUSED, src2);
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MVN_DP, dst, SLJIT_UNUSED, src2);
+ return push_inst(compiler, ((flags & INV_IMM) ? MOV : MVN) | (flags & SET_FLAGS) | RD(dst) | src2);
}
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(MVN_DP, dst, SLJIT_UNUSED, RM(src2));
+ return push_inst(compiler, MVN | (flags & SET_FLAGS) | RD(dst) | RM(src2));
case SLJIT_CLZ:
SLJIT_ASSERT(!(flags & INV_IMM));
SLJIT_ASSERT(!(src2 & SRC2_IMM));
FAIL_IF(push_inst(compiler, CLZ | RD(dst) | RM(src2)));
- if (flags & SET_FLAGS)
- EMIT_FULL_DATA_PROCESS_INS_AND_RETURN(CMP_DP, SLJIT_UNUSED, dst, SRC2_IMM);
return SLJIT_SUCCESS;
case SLJIT_ADD:
SLJIT_ASSERT(!(flags & INV_IMM));
- EMIT_DATA_PROCESS_INS_AND_RETURN(ADD_DP);
+ if ((flags & (UNUSED_RETURN | SET_FLAGS)) == (UNUSED_RETURN | SET_FLAGS) && !(flags & ARGS_SWAPPED))
+ return push_inst(compiler, CMN | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
+ return push_inst(compiler, ADD | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_ADDC:
SLJIT_ASSERT(!(flags & INV_IMM));
- EMIT_DATA_PROCESS_INS_AND_RETURN(ADC_DP);
+ return push_inst(compiler, ADC | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_SUB:
SLJIT_ASSERT(!(flags & INV_IMM));
- if (!(flags & ARGS_SWAPPED))
- EMIT_DATA_PROCESS_INS_AND_RETURN(SUB_DP);
- EMIT_DATA_PROCESS_INS_AND_RETURN(RSB_DP);
+ if ((flags & (UNUSED_RETURN | SET_FLAGS)) == (UNUSED_RETURN | SET_FLAGS) && !(flags & ARGS_SWAPPED))
+ return push_inst(compiler, CMP | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
+ return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SUB : RSB) | (flags & SET_FLAGS)
+ | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_SUBC:
SLJIT_ASSERT(!(flags & INV_IMM));
- if (!(flags & ARGS_SWAPPED))
- EMIT_DATA_PROCESS_INS_AND_RETURN(SBC_DP);
- EMIT_DATA_PROCESS_INS_AND_RETURN(RSC_DP);
+ return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SBC : RSC) | (flags & SET_FLAGS)
+ | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_MUL:
SLJIT_ASSERT(!(flags & INV_IMM));
SLJIT_ASSERT(!(src2 & SRC2_IMM));
- if (SLJIT_UNLIKELY(op & SLJIT_SET_O))
- mul_inst = SMULL | (reg_map[TMP_REG3] << 16) | (reg_map[dst] << 12);
- else
- mul_inst = MUL | (reg_map[dst] << 16);
- if (dst != src2)
- FAIL_IF(push_inst(compiler, mul_inst | (reg_map[src1] << 8) | reg_map[src2]));
- else if (dst != src1)
- FAIL_IF(push_inst(compiler, mul_inst | (reg_map[src2] << 8) | reg_map[src1]));
- else {
- /* Rm and Rd must not be the same register. */
- SLJIT_ASSERT(dst != TMP_REG1);
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG1, SLJIT_UNUSED, reg_map[src2])));
- FAIL_IF(push_inst(compiler, mul_inst | (reg_map[src2] << 8) | reg_map[TMP_REG1]));
- }
+ if (!HAS_FLAGS(op))
+ return push_inst(compiler, MUL | (reg_map[dst] << 16) | (reg_map[src2] << 8) | reg_map[src1]);
- if (!(op & SLJIT_SET_O))
- return SLJIT_SUCCESS;
+ FAIL_IF(push_inst(compiler, SMULL | (reg_map[TMP_REG1] << 16) | (reg_map[dst] << 12) | (reg_map[src2] << 8) | reg_map[src1]));
- /* We need to use TMP_REG3. */
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- /* cmp TMP_REG2, dst asr #31. */
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(CMP_DP, SET_FLAGS, SLJIT_UNUSED, TMP_REG3, RM(dst) | 0xfc0));
+ /* cmp TMP_REG1, dst asr #31. */
+ return push_inst(compiler, CMP | SET_FLAGS | RN(TMP_REG1) | RM(dst) | 0xfc0);
case SLJIT_AND:
- if (!(flags & INV_IMM))
- EMIT_DATA_PROCESS_INS_AND_RETURN(AND_DP);
- EMIT_DATA_PROCESS_INS_AND_RETURN(BIC_DP);
+ return push_inst(compiler, (!(flags & INV_IMM) ? AND : BIC) | (flags & SET_FLAGS)
+ | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_OR:
SLJIT_ASSERT(!(flags & INV_IMM));
- EMIT_DATA_PROCESS_INS_AND_RETURN(ORR_DP);
+ return push_inst(compiler, ORR | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_XOR:
SLJIT_ASSERT(!(flags & INV_IMM));
- EMIT_DATA_PROCESS_INS_AND_RETURN(EOR_DP);
+ return push_inst(compiler, EOR | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
case SLJIT_SHL:
EMIT_SHIFT_INS_AND_RETURN(0);
@@ -1144,12 +1140,11 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
case SLJIT_ASHR:
EMIT_SHIFT_INS_AND_RETURN(2);
}
- SLJIT_ASSERT_STOP();
+
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
}
-#undef EMIT_DATA_PROCESS_INS_AND_RETURN
-#undef EMIT_FULL_DATA_PROCESS_INS_AND_RETURN
#undef EMIT_SHIFT_INS_AND_RETURN
/* Tests whether the immediate can be stored in the 12 bit imm field.
@@ -1297,8 +1292,8 @@ static sljit_s32 generate_int(struct sljit_compiler *compiler, sljit_s32 reg, sl
return 0;
}
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(positive ? MOV_DP : MVN_DP, 0, reg, SLJIT_UNUSED, imm1)));
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(positive ? ORR_DP : BIC_DP, 0, reg, reg, imm2)));
+ FAIL_IF(push_inst(compiler, (positive ? MOV : MVN) | RD(reg) | imm1));
+ FAIL_IF(push_inst(compiler, (positive ? ORR : BIC) | RD(reg) | RN(reg) | imm2));
return 1;
}
#endif
@@ -1315,11 +1310,11 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg,
/* Create imm by 1 inst. */
tmp = get_imm(imm);
if (tmp)
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, reg, SLJIT_UNUSED, tmp));
+ return push_inst(compiler, MOV | RD(reg) | tmp);
tmp = get_imm(~imm);
if (tmp)
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MVN_DP, 0, reg, SLJIT_UNUSED, tmp));
+ return push_inst(compiler, MVN | RD(reg) | tmp);
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
/* Create imm by 2 inst. */
@@ -1327,293 +1322,109 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg,
FAIL_IF(generate_int(compiler, reg, ~imm, 0));
/* Load integer. */
- return push_inst_with_literal(compiler, EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0, reg, TMP_PC, 0), imm);
+ return push_inst_with_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, reg, TMP_PC, 0), imm);
#else
- return emit_imm(compiler, reg, imm);
+ FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff)));
+ if (imm <= 0xffff)
+ return SLJIT_SUCCESS;
+ return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | ((imm >> 16) & 0xfff));
#endif
}
-/* Helper function. Dst should be reg + value, using at most 1 instruction, flags does not set. */
-static sljit_s32 emit_set_delta(struct sljit_compiler *compiler, sljit_s32 dst, sljit_s32 reg, sljit_sw value)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
+ sljit_s32 arg, sljit_sw argw, sljit_s32 tmp_reg)
{
- if (value >= 0) {
- value = get_imm(value);
- if (value)
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, dst, reg, value));
- }
- else {
- value = get_imm(-value);
- if (value)
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(SUB_DP, 0, dst, reg, value));
- }
- return SLJIT_ERR_UNSUPPORTED;
-}
+ sljit_uw imm, offset_reg;
+ sljit_uw is_type1_transfer = IS_TYPE1_TRANSFER(flags);
-/* Can perform an operation using at most 1 instruction. */
-static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
-{
- sljit_uw imm;
+ SLJIT_ASSERT (arg & SLJIT_MEM);
+ SLJIT_ASSERT((arg & REG_MASK) != tmp_reg);
- if (arg & SLJIT_IMM) {
- imm = get_imm(argw);
- if (imm) {
- if (inp_flags & ARG_TEST)
- return 1;
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, reg, SLJIT_UNUSED, imm)));
- return -1;
+ if ((arg & REG_MASK) == SLJIT_UNUSED) {
+ if (is_type1_transfer) {
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw & ~0xfff));
+ argw &= 0xfff;
}
- imm = get_imm(~argw);
- if (imm) {
- if (inp_flags & ARG_TEST)
- return 1;
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MVN_DP, 0, reg, SLJIT_UNUSED, imm)));
- return -1;
+ else {
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw & ~0xff));
+ argw &= 0xff;
}
- return 0;
- }
-
- SLJIT_ASSERT(arg & SLJIT_MEM);
- /* Fast loads/stores. */
- if (!(arg & REG_MASK))
- return 0;
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, tmp_reg,
+ is_type1_transfer ? argw : TYPE2_TRANSFER_IMM(argw)));
+ }
if (arg & OFFS_REG_MASK) {
- if ((argw & 0x3) != 0 && !IS_TYPE1_TRANSFER(inp_flags))
- return 0;
-
- if (inp_flags & ARG_TEST)
- return 1;
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK,
- RM(OFFS_REG(arg)) | (IS_TYPE1_TRANSFER(inp_flags) ? SRC2_IMM : 0) | ((argw & 0x3) << 7))));
- return -1;
- }
+ offset_reg = OFFS_REG(arg);
+ arg &= REG_MASK;
+ argw &= 0x3;
- if (IS_TYPE1_TRANSFER(inp_flags)) {
- if (argw >= 0 && argw <= 0xfff) {
- if (inp_flags & ARG_TEST)
- return 1;
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK, argw)));
- return -1;
- }
- if (argw < 0 && argw >= -0xfff) {
- if (inp_flags & ARG_TEST)
- return 1;
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 0, inp_flags & WRITE_BACK, reg, arg & REG_MASK, -argw)));
- return -1;
- }
- }
- else {
- if (argw >= 0 && argw <= 0xff) {
- if (inp_flags & ARG_TEST)
- return 1;
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK, TYPE2_TRANSFER_IMM(argw))));
- return -1;
- }
- if (argw < 0 && argw >= -0xff) {
- if (inp_flags & ARG_TEST)
- return 1;
- argw = -argw;
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 0, inp_flags & WRITE_BACK, reg, arg & REG_MASK, TYPE2_TRANSFER_IMM(argw))));
- return -1;
+ if (argw != 0 && !is_type1_transfer) {
+ FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | RM(offset_reg) | (argw << 7)));
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, tmp_reg, TYPE2_TRANSFER_IMM(0)));
}
- }
-
- return 0;
-}
-/* See getput_arg below.
- Note: can_cache is called only for binary operators. Those
- operators always uses word arguments without write back. */
-static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- /* Immediate caching is not supported as it would be an operation on constant arguments. */
- if (arg & SLJIT_IMM)
- return 0;
-
- /* Always a simple operation. */
- if (arg & OFFS_REG_MASK)
- return 0;
-
- if (!(arg & REG_MASK)) {
- /* Immediate access. */
- if ((next_arg & SLJIT_MEM) && ((sljit_uw)argw - (sljit_uw)next_argw <= 0xfff || (sljit_uw)next_argw - (sljit_uw)argw <= 0xfff))
- return 1;
- return 0;
+ /* Bit 25: RM is offset. */
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg,
+ RM(offset_reg) | (is_type1_transfer ? (1 << 25) : 0) | (argw << 7)));
}
- if (argw <= 0xfffff && argw >= -0xfffff)
- return 0;
+ arg &= REG_MASK;
- if (argw == next_argw && (next_arg & SLJIT_MEM))
- return 1;
-
- if (arg == next_arg && ((sljit_uw)argw - (sljit_uw)next_argw <= 0xfff || (sljit_uw)next_argw - (sljit_uw)argw <= 0xfff))
- return 1;
-
- return 0;
-}
+ if (is_type1_transfer) {
+ if (argw > 0xfff) {
+ imm = get_imm(argw & ~0xfff);
+ if (imm) {
+ FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | imm));
+ argw = argw & 0xfff;
+ arg = tmp_reg;
+ }
+ }
+ else if (argw < -0xfff) {
+ imm = get_imm(-argw & ~0xfff);
+ if (imm) {
+ FAIL_IF(push_inst(compiler, SUB | RD(tmp_reg) | RN(arg) | imm));
+ argw = -(-argw & 0xfff);
+ arg = tmp_reg;
+ }
+ }
-#define GETPUT_ARG_DATA_TRANSFER(add, wb, target, base, imm) \
- if (max_delta & 0xf00) \
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, add, wb, target, base, imm))); \
- else \
- FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, add, wb, target, base, TYPE2_TRANSFER_IMM(imm))));
-
-#define TEST_WRITE_BACK() \
- if (inp_flags & WRITE_BACK) { \
- tmp_r = arg & REG_MASK; \
- if (reg == tmp_r) { \
- /* This can only happen for stores */ \
- /* since ldr reg, [reg, ...]! has no meaning */ \
- SLJIT_ASSERT(!(inp_flags & LOAD_DATA)); \
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG3, SLJIT_UNUSED, RM(reg)))); \
- reg = TMP_REG3; \
- } \
- }
-
-/* Emit the necessary instructions. See can_cache above. */
-static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_s32 tmp_r;
- sljit_sw max_delta;
- sljit_sw sign;
- sljit_uw imm;
+ if (argw >= 0 && argw <= 0xfff)
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, argw));
- if (arg & SLJIT_IMM) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
- return load_immediate(compiler, reg, argw);
+ if (argw < 0 && argw >= -0xfff)
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, reg, arg, -argw));
}
-
- SLJIT_ASSERT(arg & SLJIT_MEM);
-
- tmp_r = (inp_flags & LOAD_DATA) ? reg : TMP_REG3;
- max_delta = IS_TYPE1_TRANSFER(inp_flags) ? 0xfff : 0xff;
-
- if ((arg & REG_MASK) == SLJIT_UNUSED) {
- /* Write back is not used. */
- imm = (sljit_uw)(argw - compiler->cache_argw);
- if ((compiler->cache_arg & SLJIT_IMM) && (imm <= (sljit_uw)max_delta || imm >= (sljit_uw)-max_delta)) {
- if (imm <= (sljit_uw)max_delta) {
- sign = 1;
- argw = argw - compiler->cache_argw;
+ else {
+ if (argw > 0xff) {
+ imm = get_imm(argw & ~0xff);
+ if (imm) {
+ FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | imm));
+ argw = argw & 0xff;
+ arg = tmp_reg;
}
- else {
- sign = 0;
- argw = compiler->cache_argw - argw;
+ }
+ else if (argw < -0xff) {
+ imm = get_imm(-argw & ~0xff);
+ if (imm) {
+ FAIL_IF(push_inst(compiler, SUB | RD(tmp_reg) | RN(arg) | imm));
+ argw = -(-argw & 0xff);
+ arg = tmp_reg;
}
-
- GETPUT_ARG_DATA_TRANSFER(sign, 0, reg, TMP_REG3, argw);
- return SLJIT_SUCCESS;
}
- /* With write back, we can create some sophisticated loads, but
- it is hard to decide whether we should convert downward (0s) or upward (1s). */
- imm = (sljit_uw)(argw - next_argw);
- if ((next_arg & SLJIT_MEM) && (imm <= (sljit_uw)max_delta || imm >= (sljit_uw)-max_delta)) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
+ if (argw >= 0 && argw <= 0xff)
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, TYPE2_TRANSFER_IMM(argw)));
- compiler->cache_arg = SLJIT_IMM;
- compiler->cache_argw = argw;
- tmp_r = TMP_REG3;
+ if (argw < 0 && argw >= -0xff) {
+ argw = -argw;
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, reg, arg, TYPE2_TRANSFER_IMM(argw)));
}
-
- FAIL_IF(load_immediate(compiler, tmp_r, argw));
- GETPUT_ARG_DATA_TRANSFER(1, 0, reg, tmp_r, 0);
- return SLJIT_SUCCESS;
- }
-
- if (arg & OFFS_REG_MASK) {
- SLJIT_ASSERT((argw & 0x3) && !(max_delta & 0xf00));
- if (inp_flags & WRITE_BACK)
- tmp_r = arg & REG_MASK;
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, tmp_r, arg & REG_MASK, RM(OFFS_REG(arg)) | ((argw & 0x3) << 7))));
- return push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, 0, reg, tmp_r, TYPE2_TRANSFER_IMM(0)));
- }
-
- imm = (sljit_uw)(argw - compiler->cache_argw);
- if (compiler->cache_arg == arg && imm <= (sljit_uw)max_delta) {
- SLJIT_ASSERT(!(inp_flags & WRITE_BACK));
- GETPUT_ARG_DATA_TRANSFER(1, 0, reg, TMP_REG3, imm);
- return SLJIT_SUCCESS;
}
- if (compiler->cache_arg == arg && imm >= (sljit_uw)-max_delta) {
- SLJIT_ASSERT(!(inp_flags & WRITE_BACK));
- imm = (sljit_uw)-(sljit_sw)imm;
- GETPUT_ARG_DATA_TRANSFER(0, 0, reg, TMP_REG3, imm);
- return SLJIT_SUCCESS;
- }
-
- imm = get_imm(argw & ~max_delta);
- if (imm) {
- TEST_WRITE_BACK();
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, tmp_r, arg & REG_MASK, imm)));
- GETPUT_ARG_DATA_TRANSFER(1, inp_flags & WRITE_BACK, reg, tmp_r, argw & max_delta);
- return SLJIT_SUCCESS;
- }
-
- imm = get_imm(-argw & ~max_delta);
- if (imm) {
- argw = -argw;
- TEST_WRITE_BACK();
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(SUB_DP, 0, tmp_r, arg & REG_MASK, imm)));
- GETPUT_ARG_DATA_TRANSFER(0, inp_flags & WRITE_BACK, reg, tmp_r, argw & max_delta);
- return SLJIT_SUCCESS;
- }
-
- if ((compiler->cache_arg & SLJIT_IMM) && compiler->cache_argw == argw) {
- TEST_WRITE_BACK();
- return push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK, RM(TMP_REG3) | (max_delta & 0xf00 ? SRC2_IMM : 0)));
- }
-
- if (argw == next_argw && (next_arg & SLJIT_MEM)) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
-
- compiler->cache_arg = SLJIT_IMM;
- compiler->cache_argw = argw;
-
- TEST_WRITE_BACK();
- return push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK, RM(TMP_REG3) | (max_delta & 0xf00 ? SRC2_IMM : 0)));
- }
-
- imm = (sljit_uw)(argw - next_argw);
- if (arg == next_arg && !(inp_flags & WRITE_BACK) && (imm <= (sljit_uw)max_delta || imm >= (sljit_uw)-max_delta)) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG3, TMP_REG3, reg_map[arg & REG_MASK])));
-
- compiler->cache_arg = arg;
- compiler->cache_argw = argw;
- GETPUT_ARG_DATA_TRANSFER(1, 0, reg, TMP_REG3, 0);
- return SLJIT_SUCCESS;
- }
-
- if ((arg & REG_MASK) == tmp_r) {
- compiler->cache_arg = SLJIT_IMM;
- compiler->cache_argw = argw;
- tmp_r = TMP_REG3;
- }
-
- FAIL_IF(load_immediate(compiler, tmp_r, argw));
- return push_inst(compiler, EMIT_DATA_TRANSFER(inp_flags, 1, inp_flags & WRITE_BACK, reg, arg & REG_MASK, reg_map[tmp_r] | (max_delta & 0xf00 ? SRC2_IMM : 0)));
-}
-
-static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
-{
- if (getput_arg_fast(compiler, flags, reg, arg, argw))
- return compiler->error;
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
-}
-
-static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
-{
- if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
- return compiler->error;
- return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw));
+ return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg,
+ RM(tmp_reg) | (is_type1_transfer ? (1 << 25) : 0)));
}
static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
@@ -1621,68 +1432,66 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- /* arg1 goes to TMP_REG1 or src reg
- arg2 goes to TMP_REG2, imm or src reg
- TMP_REG3 can be used for caching
- result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
+ /* src1 is reg or TMP_REG1
+ src2 is reg, TMP_REG2, or imm
+ result goes to TMP_REG2, so put result can use TMP_REG1. */
/* We prefers register and simple consts. */
- sljit_s32 dst_r;
- sljit_s32 src1_r;
- sljit_s32 src2_r = 0;
- sljit_s32 sugg_src2_r = TMP_REG2;
- sljit_s32 flags = GET_FLAGS(op) ? SET_FLAGS : 0;
-
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
+ sljit_s32 dst_reg;
+ sljit_s32 src1_reg;
+ sljit_s32 src2_reg;
+ sljit_s32 flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
/* Destination check. */
- if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
- return SLJIT_SUCCESS;
- dst_r = TMP_REG2;
- }
- else if (FAST_IS_REG(dst)) {
- dst_r = dst;
- flags |= REG_DEST;
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
- sugg_src2_r = dst_r;
- }
- else {
- SLJIT_ASSERT(dst & SLJIT_MEM);
- if (getput_arg_fast(compiler, inp_flags | ARG_TEST, TMP_REG2, dst, dstw)) {
- flags |= FAST_DEST;
- dst_r = TMP_REG2;
- }
- else {
- flags |= SLOW_DEST;
- dst_r = 0;
+ if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED))
+ flags |= UNUSED_RETURN;
+
+ SLJIT_ASSERT(!(inp_flags & ALLOW_INV_IMM) || (inp_flags & ALLOW_IMM));
+
+ src2_reg = 0;
+
+ do {
+ if (!(inp_flags & ALLOW_IMM))
+ break;
+
+ if (src2 & SLJIT_IMM) {
+ src2_reg = get_imm(src2w);
+ if (src2_reg)
+ break;
+ if (inp_flags & ALLOW_INV_IMM) {
+ src2_reg = get_imm(~src2w);
+ if (src2_reg) {
+ flags |= INV_IMM;
+ break;
+ }
+ }
+ if (GET_OPCODE(op) == SLJIT_ADD) {
+ src2_reg = get_imm(-src2w);
+ if (src2_reg) {
+ op = SLJIT_SUB | GET_ALL_FLAGS(op);
+ break;
+ }
+ }
+ if (GET_OPCODE(op) == SLJIT_SUB) {
+ src2_reg = get_imm(-src2w);
+ if (src2_reg) {
+ op = SLJIT_ADD | GET_ALL_FLAGS(op);
+ break;
+ }
+ }
}
- }
- /* Source 1. */
- if (FAST_IS_REG(src1))
- src1_r = src1;
- else if (FAST_IS_REG(src2)) {
- flags |= ARGS_SWAPPED;
- src1_r = src2;
- src2 = src1;
- src2w = src1w;
- }
- else do { /* do { } while(0) is used because of breaks. */
- src1_r = 0;
- if ((inp_flags & ALLOW_ANY_IMM) && (src1 & SLJIT_IMM)) {
- /* The second check will generate a hit. */
- src2_r = get_imm(src1w);
- if (src2_r) {
+ if (src1 & SLJIT_IMM) {
+ src2_reg = get_imm(src1w);
+ if (src2_reg) {
flags |= ARGS_SWAPPED;
src1 = src2;
src1w = src2w;
break;
}
if (inp_flags & ALLOW_INV_IMM) {
- src2_r = get_imm(~src1w);
- if (src2_r) {
+ src2_reg = get_imm(~src1w);
+ if (src2_reg) {
flags |= ARGS_SWAPPED | INV_IMM;
src1 = src2;
src1w = src2w;
@@ -1690,9 +1499,9 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
}
}
if (GET_OPCODE(op) == SLJIT_ADD) {
- src2_r = get_imm(-src1w);
- if (src2_r) {
- /* Note: ARGS_SWAPPED is intentionally not applied! */
+ src2_reg = get_imm(-src1w);
+ if (src2_reg) {
+ /* Note: add is commutative operation. */
src1 = src2;
src1w = src2w;
op = SLJIT_SUB | GET_ALL_FLAGS(op);
@@ -1700,110 +1509,54 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
}
}
}
+ } while(0);
- if (getput_arg_fast(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w)) {
- FAIL_IF(compiler->error);
- src1_r = TMP_REG1;
- }
- } while (0);
+ /* Source 1. */
+ if (FAST_IS_REG(src1))
+ src1_reg = src1;
+ else if (src1 & SLJIT_MEM) {
+ FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, TMP_REG1));
+ src1_reg = TMP_REG1;
+ }
+ else {
+ FAIL_IF(load_immediate(compiler, TMP_REG1, src1w));
+ src1_reg = TMP_REG1;
+ }
- /* Source 2. */
- if (src2_r == 0) {
- if (FAST_IS_REG(src2)) {
- src2_r = src2;
- flags |= REG_SOURCE;
- if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
- dst_r = src2_r;
- }
- else do { /* do { } while(0) is used because of breaks. */
- if ((inp_flags & ALLOW_ANY_IMM) && (src2 & SLJIT_IMM)) {
- src2_r = get_imm(src2w);
- if (src2_r)
- break;
- if (inp_flags & ALLOW_INV_IMM) {
- src2_r = get_imm(~src2w);
- if (src2_r) {
- flags |= INV_IMM;
- break;
- }
- }
- if (GET_OPCODE(op) == SLJIT_ADD) {
- src2_r = get_imm(-src2w);
- if (src2_r) {
- op = SLJIT_SUB | GET_ALL_FLAGS(op);
- flags &= ~ARGS_SWAPPED;
- break;
- }
- }
- if (GET_OPCODE(op) == SLJIT_SUB && !(flags & ARGS_SWAPPED)) {
- src2_r = get_imm(-src2w);
- if (src2_r) {
- op = SLJIT_ADD | GET_ALL_FLAGS(op);
- flags &= ~ARGS_SWAPPED;
- break;
- }
- }
- }
+ /* Destination. */
+ dst_reg = SLOW_IS_REG(dst) ? dst : TMP_REG2;
- /* src2_r is 0. */
- if (getput_arg_fast(compiler, inp_flags | LOAD_DATA, sugg_src2_r, src2, src2w)) {
- FAIL_IF(compiler->error);
- src2_r = sugg_src2_r;
- }
- } while (0);
- }
+ if (op <= SLJIT_MOV_P) {
+ if (dst & SLJIT_MEM) {
+ if (inp_flags & BYTE_SIZE)
+ inp_flags &= ~SIGNED;
- /* src1_r, src2_r and dst_r can be zero (=unprocessed) or non-zero.
- If they are zero, they must not be registers. */
- if (src1_r == 0 && src2_r == 0 && dst_r == 0) {
- if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
- SLJIT_ASSERT(!(flags & ARGS_SWAPPED));
- flags |= ARGS_SWAPPED;
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG1, src2, src2w, src1, src1w));
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG2, src1, src1w, dst, dstw));
+ if (FAST_IS_REG(src2))
+ return emit_op_mem(compiler, inp_flags, src2, dst, dstw, TMP_REG2);
}
- else {
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, src2, src2w));
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG2, src2, src2w, dst, dstw));
- }
- src1_r = TMP_REG1;
- src2_r = TMP_REG2;
- }
- else if (src1_r == 0 && src2_r == 0) {
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, src2, src2w));
- src1_r = TMP_REG1;
- }
- else if (src1_r == 0 && dst_r == 0) {
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw));
- src1_r = TMP_REG1;
- }
- else if (src2_r == 0 && dst_r == 0) {
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, sugg_src2_r, src2, src2w, dst, dstw));
- src2_r = sugg_src2_r;
+
+ if (FAST_IS_REG(src2) && dst_reg != TMP_REG2)
+ flags |= MOVE_REG_CONV;
}
- if (dst_r == 0)
- dst_r = TMP_REG2;
+ /* Source 2. */
+ if (src2_reg == 0) {
+ src2_reg = (op <= SLJIT_MOV_P) ? dst_reg : TMP_REG2;
- if (src1_r == 0) {
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, 0, 0));
- src1_r = TMP_REG1;
+ if (FAST_IS_REG(src2))
+ src2_reg = src2;
+ else if (src2 & SLJIT_MEM)
+ FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, src2_reg, src2, src2w, TMP_REG2));
+ else
+ FAIL_IF(load_immediate(compiler, src2_reg, src2w));
}
- if (src2_r == 0) {
- FAIL_IF(getput_arg(compiler, inp_flags | LOAD_DATA, sugg_src2_r, src2, src2w, 0, 0));
- src2_r = sugg_src2_r;
- }
+ FAIL_IF(emit_single_op(compiler, op, flags, dst_reg, src1_reg, src2_reg));
- FAIL_IF(emit_single_op(compiler, op, flags, dst_r, src1_r, src2_r));
+ if (!(dst & SLJIT_MEM))
+ return SLJIT_SUCCESS;
- if (flags & (FAST_DEST | SLOW_DEST)) {
- if (flags & FAST_DEST)
- FAIL_IF(getput_arg_fast(compiler, inp_flags, dst_r, dst, dstw));
- else
- FAIL_IF(getput_arg(compiler, inp_flags, dst_r, dst, dstw, 0, 0));
- }
- return SLJIT_SUCCESS;
+ return emit_op_mem(compiler, inp_flags, dst_reg, dst, dstw, TMP_REG1);
}
#ifdef __cplusplus
@@ -1823,6 +1576,9 @@ extern int __aeabi_idivmod(int numerator, int denominator);
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
{
+ sljit_sw saved_reg_list[3];
+ sljit_sw saved_reg_count;
+
CHECK_ERROR();
CHECK(check_sljit_emit_op0(compiler, op));
@@ -1836,33 +1592,38 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
break;
case SLJIT_LMUL_UW:
case SLJIT_LMUL_SW:
-#if (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL)
| (reg_map[SLJIT_R1] << 16)
| (reg_map[SLJIT_R0] << 12)
| (reg_map[SLJIT_R0] << 8)
| reg_map[SLJIT_R1]);
-#else
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG1, SLJIT_UNUSED, RM(SLJIT_R1))));
- return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL)
- | (reg_map[SLJIT_R1] << 16)
- | (reg_map[SLJIT_R0] << 12)
- | (reg_map[SLJIT_R0] << 8)
- | reg_map[TMP_REG1]);
-#endif
case SLJIT_DIVMOD_UW:
case SLJIT_DIVMOD_SW:
case SLJIT_DIV_UW:
case SLJIT_DIV_SW:
SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
- SLJIT_COMPILE_ASSERT(reg_map[2] == 1 && reg_map[3] == 2, bad_register_mapping);
-
- if ((op >= SLJIT_DIV_UW) && (compiler->scratches >= 3)) {
- FAIL_IF(push_inst(compiler, 0xe52d2008 /* str r2, [sp, #-8]! */));
- FAIL_IF(push_inst(compiler, 0xe58d1004 /* str r1, [sp, #4] */));
+ SLJIT_ASSERT(reg_map[2] == 1 && reg_map[3] == 2 && reg_map[4] == 3);
+
+ saved_reg_count = 0;
+ if (compiler->scratches >= 4)
+ saved_reg_list[saved_reg_count++] = 3;
+ if (compiler->scratches >= 3)
+ saved_reg_list[saved_reg_count++] = 2;
+ if (op >= SLJIT_DIV_UW)
+ saved_reg_list[saved_reg_count++] = 1;
+
+ if (saved_reg_count > 0) {
+ FAIL_IF(push_inst(compiler, 0xe52d0000 | (saved_reg_count >= 3 ? 16 : 8)
+ | (saved_reg_list[0] << 12) /* str rX, [sp, #-8/-16]! */));
+ if (saved_reg_count >= 2) {
+ SLJIT_ASSERT(saved_reg_list[1] < 8);
+ FAIL_IF(push_inst(compiler, 0xe58d0004 | (saved_reg_list[1] << 12) /* str rX, [sp, #4] */));
+ }
+ if (saved_reg_count >= 3) {
+ SLJIT_ASSERT(saved_reg_list[2] < 8);
+ FAIL_IF(push_inst(compiler, 0xe58d0008 | (saved_reg_list[2] << 12) /* str rX, [sp, #8] */));
+ }
}
- else if ((op >= SLJIT_DIV_UW) || (compiler->scratches >= 3))
- FAIL_IF(push_inst(compiler, 0xe52d0008 | (op >= SLJIT_DIV_UW ? 0x1000 : 0x2000) /* str r1/r2, [sp, #-8]! */));
#if defined(__GNUC__)
FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
@@ -1871,12 +1632,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
#error "Software divmod functions are needed"
#endif
- if ((op >= SLJIT_DIV_UW) && (compiler->scratches >= 3)) {
- FAIL_IF(push_inst(compiler, 0xe59d1004 /* ldr r1, [sp, #4] */));
- FAIL_IF(push_inst(compiler, 0xe49d2008 /* ldr r2, [sp], #8 */));
+ if (saved_reg_count > 0) {
+ if (saved_reg_count >= 3) {
+ SLJIT_ASSERT(saved_reg_list[2] < 8);
+ FAIL_IF(push_inst(compiler, 0xe59d0008 | (saved_reg_list[2] << 12) /* ldr rX, [sp, #8] */));
+ }
+ if (saved_reg_count >= 2) {
+ SLJIT_ASSERT(saved_reg_list[1] < 8);
+ FAIL_IF(push_inst(compiler, 0xe59d0004 | (saved_reg_list[1] << 12) /* ldr rX, [sp, #4] */));
+ }
+ return push_inst(compiler, 0xe49d0000 | (saved_reg_count >= 3 ? 16 : 8)
+ | (saved_reg_list[0] << 12) /* ldr rX, [sp], #8/16 */);
}
- else if ((op >= SLJIT_DIV_UW) || (compiler->scratches >= 3))
- return push_inst(compiler, 0xe49d0008 | (op >= SLJIT_DIV_UW ? 0x1000 : 0x2000) /* ldr r1/r2, [sp], #8 */);
return SLJIT_SUCCESS;
}
@@ -1892,6 +1659,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op)) {
+#if (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
+ if (op <= SLJIT_MOV_P && (src & SLJIT_MEM))
+ return emit_op_mem(compiler, PRELOAD | LOAD_DATA, TMP_PC, src, srcw, TMP_REG1);
+#endif
+ return SLJIT_SUCCESS;
+ }
+
switch (GET_OPCODE(op)) {
case SLJIT_MOV:
case SLJIT_MOV_U32:
@@ -1900,34 +1675,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_MOV_U8:
- return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_SIZE, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
case SLJIT_MOV_S8:
- return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED | BYTE_SIZE, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
case SLJIT_MOV_U16:
- return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_SIZE, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
case SLJIT_MOV_S16:
- return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
-
- case SLJIT_MOVU:
- case SLJIT_MOVU_U32:
- case SLJIT_MOVU_S32:
- case SLJIT_MOVU_P:
- return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-
- case SLJIT_MOVU_U8:
- return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
-
- case SLJIT_MOVU_S8:
- return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
-
- case SLJIT_MOVU_U16:
- return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
-
- case SLJIT_MOVU_S16:
- return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
+ return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED | HALF_SIZE, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
case SLJIT_NOT:
return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -1957,6 +1714,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
+
switch (GET_OPCODE(op)) {
case SLJIT_ADD:
case SLJIT_ADDC:
@@ -1997,7 +1757,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
- return reg << 1;
+ return (freg_map[reg] << 1);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -2013,118 +1773,63 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
-
-/* 0 - no fpu
- 1 - vfp */
-static sljit_s32 arm_fpu_type = -1;
-
-static void init_compiler(void)
-{
- if (arm_fpu_type != -1)
- return;
-
- /* TODO: Only the OS can help to determine the correct fpu type. */
- arm_fpu_type = 1;
-}
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#else
- if (arm_fpu_type == -1)
- init_compiler();
- return arm_fpu_type;
-#endif
-}
-
-#else
-
-#define arm_fpu_type 1
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
- /* Always available. */
- return 1;
-}
-
-#endif
#define FPU_LOAD (1 << 20)
#define EMIT_FPU_DATA_TRANSFER(inst, add, base, freg, offs) \
- ((inst) | ((add) << 23) | (reg_map[base] << 16) | (freg << 12) | (offs))
+ ((inst) | ((add) << 23) | (reg_map[base] << 16) | (freg_map[freg] << 12) | (offs))
#define EMIT_FPU_OPERATION(opcode, mode, dst, src1, src2) \
- ((opcode) | (mode) | ((dst) << 12) | (src1) | ((src2) << 16))
+ ((opcode) | (mode) | (freg_map[dst] << 12) | freg_map[src1] | (freg_map[src2] << 16))
static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
{
- sljit_sw tmp;
sljit_uw imm;
sljit_sw inst = VSTR_F32 | (flags & (SLJIT_F32_OP | FPU_LOAD));
+
SLJIT_ASSERT(arg & SLJIT_MEM);
+ arg &= ~SLJIT_MEM;
if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG1, arg & REG_MASK, RM(OFFS_REG(arg)) | ((argw & 0x3) << 7))));
- arg = SLJIT_MEM | TMP_REG1;
+ FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | ((argw & 0x3) << 7)));
+ arg = TMP_REG2;
argw = 0;
}
/* Fast loads and stores. */
- if ((arg & REG_MASK)) {
+ if (arg) {
if (!(argw & ~0x3fc))
return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, arg & REG_MASK, reg, argw >> 2));
if (!(-argw & ~0x3fc))
return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, arg & REG_MASK, reg, (-argw) >> 2));
- }
-
- if (compiler->cache_arg == arg) {
- tmp = argw - compiler->cache_argw;
- if (!(tmp & ~0x3fc))
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG3, reg, tmp >> 2));
- if (!(-tmp & ~0x3fc))
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, TMP_REG3, reg, -tmp >> 2));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, tmp) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG3, reg, 0));
- }
- }
- if (arg & REG_MASK) {
- if (emit_set_delta(compiler, TMP_REG1, arg & REG_MASK, argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG1, reg, 0));
- }
imm = get_imm(argw & ~0x3fc);
if (imm) {
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG1, arg & REG_MASK, imm)));
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG1, reg, (argw & 0x3fc) >> 2));
+ FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | imm));
+ return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, (argw & 0x3fc) >> 2));
}
imm = get_imm(-argw & ~0x3fc);
if (imm) {
argw = -argw;
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(SUB_DP, 0, TMP_REG1, arg & REG_MASK, imm)));
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, TMP_REG1, reg, (argw & 0x3fc) >> 2));
+ FAIL_IF(push_inst(compiler, SUB | RD(TMP_REG2) | RN(arg & REG_MASK) | imm));
+ return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, TMP_REG2, reg, (argw & 0x3fc) >> 2));
}
}
- compiler->cache_arg = arg;
- compiler->cache_argw = argw;
- if (arg & REG_MASK) {
- FAIL_IF(load_immediate(compiler, TMP_REG1, argw));
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG3, arg & REG_MASK, reg_map[TMP_REG1])));
+ if (arg) {
+ FAIL_IF(load_immediate(compiler, TMP_REG2, argw));
+ FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | RM(TMP_REG2)));
}
else
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
+ FAIL_IF(load_immediate(compiler, TMP_REG2, argw));
- return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG3, reg, 0));
+ return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, 0));
}
static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
+ op ^= SLJIT_F32_OP;
+
if (src & SLJIT_MEM) {
FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src, srcw));
src = TMP_FREG1;
@@ -2132,11 +1837,8 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_S32_F32, op & SLJIT_F32_OP, TMP_FREG1, src, 0)));
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
- return push_inst(compiler, VMOV | (1 << 20) | RD(dst) | (TMP_FREG1 << 16));
+ return push_inst(compiler, VMOV | (1 << 20) | RD(dst) | (freg_map[TMP_FREG1] << 16));
/* Store the integer value from a VFP register. */
return emit_fop_mem(compiler, 0, TMP_FREG1, dst, dstw);
@@ -2148,15 +1850,17 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
{
sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+ op ^= SLJIT_F32_OP;
+
if (FAST_IS_REG(src))
- FAIL_IF(push_inst(compiler, VMOV | RD(src) | (TMP_FREG1 << 16)));
+ FAIL_IF(push_inst(compiler, VMOV | RD(src) | (freg_map[TMP_FREG1] << 16)));
else if (src & SLJIT_MEM) {
/* Load the integer value into a VFP register. */
FAIL_IF(emit_fop_mem(compiler, FPU_LOAD, TMP_FREG1, src, srcw));
}
else {
FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
- FAIL_IF(push_inst(compiler, VMOV | RD(TMP_REG1) | (TMP_FREG1 << 16)));
+ FAIL_IF(push_inst(compiler, VMOV | RD(TMP_REG1) | (freg_map[TMP_FREG1] << 16)));
}
FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F32_S32, op & SLJIT_F32_OP, dst_r, TMP_FREG1, 0)));
@@ -2170,6 +1874,8 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
+ op ^= SLJIT_F32_OP;
+
if (src1 & SLJIT_MEM) {
FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w));
src1 = TMP_FREG1;
@@ -2191,16 +1897,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
sljit_s32 dst_r;
CHECK_ERROR();
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- if (GET_OPCODE(op) != SLJIT_CONV_F64_FROM_F32)
- op ^= SLJIT_F32_OP;
SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100), float_transfer_bit_error);
SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+ if (GET_OPCODE(op) != SLJIT_CONV_F64_FROM_F32)
+ op ^= SLJIT_F32_OP;
+
if (src & SLJIT_MEM) {
FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, dst_r, src, srcw));
src = dst_r;
@@ -2245,8 +1950,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
op ^= SLJIT_F32_OP;
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
@@ -2287,7 +1990,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
#undef FPU_LOAD
#undef EMIT_FPU_DATA_TRANSFER
-#undef EMIT_FPU_OPERATION
/* --------------------------------------------------------------------- */
/* Other instructions */
@@ -2299,21 +2001,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
- /* For UNUSED dst. Uncommon, but possible. */
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
+ SLJIT_ASSERT(reg_map[TMP_REG2] == 14);
if (FAST_IS_REG(dst))
- return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, RM(TMP_REG3)));
+ return push_inst(compiler, MOV | RD(dst) | RM(TMP_REG2));
/* Memory. */
- if (getput_arg_fast(compiler, WORD_DATA, TMP_REG3, dst, dstw))
- return compiler->error;
- /* TMP_REG3 is used for caching. */
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG2, SLJIT_UNUSED, RM(TMP_REG3))));
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- return getput_arg(compiler, WORD_DATA, TMP_REG2, dst, dstw, 0, 0);
+ return emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
@@ -2322,21 +2016,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
+ SLJIT_ASSERT(reg_map[TMP_REG2] == 14);
+
if (FAST_IS_REG(src))
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG3, SLJIT_UNUSED, RM(src))));
- else if (src & SLJIT_MEM) {
- if (getput_arg_fast(compiler, WORD_DATA | LOAD_DATA, TMP_REG3, src, srcw))
- FAIL_IF(compiler->error);
- else {
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- FAIL_IF(getput_arg(compiler, WORD_DATA | LOAD_DATA, TMP_REG2, src, srcw, 0, 0));
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG3, SLJIT_UNUSED, RM(TMP_REG2))));
- }
- }
- else if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, TMP_REG3, srcw));
- return push_inst(compiler, BLX | RM(TMP_REG3));
+ FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG2) | RM(src)));
+ else
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, src, srcw, TMP_REG1));
+
+ return push_inst(compiler, BX | RM(TMP_REG2));
}
/* --------------------------------------------------------------------- */
@@ -2393,7 +2080,7 @@ static sljit_uw get_cc(sljit_s32 type)
return 0x70000000;
default:
- SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
+ SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL_CDECL);
return 0xe0000000;
}
}
@@ -2426,11 +2113,12 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
type &= 0xff;
- /* In ARM, we don't need to touch the arguments. */
+ SLJIT_ASSERT(reg_map[TMP_REG1] != 14);
+
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
if (type >= SLJIT_FAST_CALL)
PTR_FAIL_IF(prepare_blx(compiler));
- PTR_FAIL_IF(push_inst_with_unique_literal(compiler, ((EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0,
+ PTR_FAIL_IF(push_inst_with_unique_literal(compiler, ((EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1,
type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0)) & ~COND_MASK) | get_cc(type), 0));
if (jump->flags & SLJIT_REWRITABLE_JUMP) {
@@ -2455,6 +2143,241 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
return jump;
}
+#ifdef __SOFTFP__
+
+static sljit_s32 softfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src)
+{
+ sljit_s32 stack_offset = 0;
+ sljit_s32 arg_count = 0;
+ sljit_s32 word_arg_offset = 0;
+ sljit_s32 float_arg_count = 0;
+ sljit_s32 types = 0;
+ sljit_s32 src_offset = 4 * sizeof(sljit_sw);
+ sljit_u8 offsets[4];
+
+ if (src && FAST_IS_REG(*src))
+ src_offset = reg_map[*src] * sizeof(sljit_sw);
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_f32);
+ arg_count++;
+ float_arg_count++;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (stack_offset & 0x7)
+ stack_offset += sizeof(sljit_sw);
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_f64);
+ arg_count++;
+ float_arg_count++;
+ break;
+ default:
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_sw);
+ arg_count++;
+ word_arg_offset += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ if (stack_offset > 16)
+ FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | (((stack_offset - 16) + 0x7) & ~0x7)));
+
+ /* Process arguments in reversed direction. */
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ arg_count--;
+ float_arg_count--;
+ stack_offset = offsets[arg_count];
+
+ if (stack_offset < 16) {
+ if (src_offset == stack_offset) {
+ FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2)));
+ *src = TMP_REG1;
+ }
+ FAIL_IF(push_inst(compiler, VMOV | 0x100000 | (float_arg_count << 16) | (stack_offset << 10)));
+ } else
+ FAIL_IF(push_inst(compiler, VSTR_F32 | 0x800000 | RN(SLJIT_SP) | (float_arg_count << 12) | ((stack_offset - 16) >> 2)));
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ arg_count--;
+ float_arg_count--;
+ stack_offset = offsets[arg_count];
+
+ SLJIT_ASSERT((stack_offset & 0x7) == 0);
+
+ if (stack_offset < 16) {
+ if (src_offset == stack_offset || src_offset == stack_offset + sizeof(sljit_sw)) {
+ FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2)));
+ *src = TMP_REG1;
+ }
+ FAIL_IF(push_inst(compiler, VMOV2 | 0x100000 | (stack_offset << 10) | ((stack_offset + sizeof(sljit_sw)) << 14) | float_arg_count));
+ } else
+ FAIL_IF(push_inst(compiler, VSTR_F32 | 0x800100 | RN(SLJIT_SP) | (float_arg_count << 12) | ((stack_offset - 16) >> 2)));
+ break;
+ default:
+ arg_count--;
+ word_arg_offset -= sizeof(sljit_sw);
+ stack_offset = offsets[arg_count];
+
+ SLJIT_ASSERT(stack_offset >= word_arg_offset);
+
+ if (stack_offset != word_arg_offset) {
+ if (stack_offset < 16) {
+ if (src_offset == stack_offset) {
+ FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2)));
+ *src = TMP_REG1;
+ }
+ else if (src_offset == word_arg_offset) {
+ *src = 1 + (stack_offset >> 2);
+ src_offset = stack_offset;
+ }
+ FAIL_IF(push_inst(compiler, MOV | (stack_offset << 10) | (word_arg_offset >> 2)));
+ } else
+ FAIL_IF(push_inst(compiler, data_transfer_insts[WORD_SIZE] | 0x800000 | RN(SLJIT_SP) | (word_arg_offset << 10) | (stack_offset - 16)));
+ }
+ break;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
+ return SLJIT_SUCCESS;
+}
+
+static sljit_s32 softfloat_post_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types)
+{
+ sljit_s32 stack_size = 0;
+
+ if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F32)
+ FAIL_IF(push_inst(compiler, VMOV | (0 << 16) | (0 << 12)));
+ if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F64)
+ FAIL_IF(push_inst(compiler, VMOV2 | (1 << 16) | (0 << 12) | 0));
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ stack_size += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (stack_size & 0x7)
+ stack_size += sizeof(sljit_sw);
+ stack_size += sizeof(sljit_f64);
+ break;
+ default:
+ stack_size += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ if (stack_size <= 16)
+ return SLJIT_SUCCESS;
+
+ return push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | (((stack_size - 16) + 0x7) & ~0x7));
+}
+
+#else /* !__SOFTFP__ */
+
+static sljit_s32 hardfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types)
+{
+ sljit_u32 remap = 0;
+ sljit_u32 offset = 0;
+ sljit_u32 new_offset, mask;
+
+ /* Remove return value. */
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F32) {
+ new_offset = 0;
+ mask = 1;
+
+ while (remap & mask) {
+ new_offset++;
+ mask <<= 1;
+ }
+ remap |= mask;
+
+ if (offset != new_offset)
+ FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32,
+ 0, (new_offset >> 1) + 1, (offset >> 1) + 1, 0) | ((new_offset & 0x1) ? 0x400000 : 0)));
+
+ offset += 2;
+ }
+ else if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F64) {
+ new_offset = 0;
+ mask = 3;
+
+ while (remap & mask) {
+ new_offset += 2;
+ mask <<= 2;
+ }
+ remap |= mask;
+
+ if (offset != new_offset)
+ FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, SLJIT_F32_OP, (new_offset >> 1) + 1, (offset >> 1) + 1, 0)));
+
+ offset += 2;
+ }
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ return SLJIT_SUCCESS;
+}
+
+#endif /* __SOFTFP__ */
+
+#undef EMIT_FPU_OPERATION
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+#ifdef __SOFTFP__
+ struct sljit_jump *jump;
+#endif
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+#ifdef __SOFTFP__
+ PTR_FAIL_IF(softfloat_call_with_args(compiler, arg_types, NULL));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ jump = sljit_emit_jump(compiler, type);
+ PTR_FAIL_IF(jump == NULL);
+
+ PTR_FAIL_IF(softfloat_post_call_with_args(compiler, arg_types));
+ return jump;
+#else /* !__SOFTFP__ */
+ PTR_FAIL_IF(hardfloat_call_with_args(compiler, arg_types));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_jump(compiler, type);
+#endif /* __SOFTFP__ */
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
{
struct sljit_jump *jump;
@@ -2463,16 +2386,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
- /* In ARM, we don't need to touch the arguments. */
+ SLJIT_ASSERT(reg_map[TMP_REG1] != 14);
+
if (!(src & SLJIT_IMM)) {
- if (FAST_IS_REG(src))
+ if (FAST_IS_REG(src)) {
+ SLJIT_ASSERT(reg_map[src] != 14);
return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(src));
+ }
SLJIT_ASSERT(src & SLJIT_MEM);
- FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG2, src, srcw));
- return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG2));
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1));
+ return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1));
}
+ /* These jumps are converted to jump/call instructions when possible. */
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF(!jump);
set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0));
@@ -2481,7 +2408,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
if (type >= SLJIT_FAST_CALL)
FAIL_IF(prepare_blx(compiler));
- FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0, type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0), 0));
+ FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0), 0));
if (type >= SLJIT_FAST_CALL)
FAIL_IF(emit_blx(compiler));
#else
@@ -2492,57 +2419,221 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
return SLJIT_SUCCESS;
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+#ifdef __SOFTFP__
+ if (src & SLJIT_MEM) {
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1));
+ src = TMP_REG1;
+ }
+
+ FAIL_IF(softfloat_call_with_args(compiler, arg_types, &src));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw));
+
+ return softfloat_post_call_with_args(compiler, arg_types);
+#else /* !__SOFTFP__ */
+ FAIL_IF(hardfloat_call_with_args(compiler, arg_types));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_ijump(compiler, type, src, srcw);
+#endif /* __SOFTFP__ */
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
- sljit_s32 dst_r, flags = GET_ALL_FLAGS(op);
+ sljit_s32 dst_reg, flags = GET_ALL_FLAGS(op);
sljit_uw cc, ins;
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- ADJUST_LOCAL_OFFSET(src, srcw);
-
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
op = GET_OPCODE(op);
cc = get_cc(type & 0xff);
- dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+ dst_reg = FAST_IS_REG(dst) ? dst : TMP_REG1;
if (op < SLJIT_ADD) {
- FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst_r, SLJIT_UNUSED, SRC2_IMM | 0)));
- FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst_r, SLJIT_UNUSED, SRC2_IMM | 1) & ~COND_MASK) | cc));
- return (dst_r == TMP_REG2) ? emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw) : SLJIT_SUCCESS;
+ FAIL_IF(push_inst(compiler, MOV | RD(dst_reg) | SRC2_IMM | 0));
+ FAIL_IF(push_inst(compiler, ((MOV | RD(dst_reg) | SRC2_IMM | 1) & ~COND_MASK) | cc));
+ if (dst & SLJIT_MEM)
+ return emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2);
+ return SLJIT_SUCCESS;
}
- ins = (op == SLJIT_AND ? AND_DP : (op == SLJIT_OR ? ORR_DP : EOR_DP));
- if ((op == SLJIT_OR || op == SLJIT_XOR) && FAST_IS_REG(dst) && dst == src) {
- FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(ins, 0, dst, dst, SRC2_IMM | 1) & ~COND_MASK) | cc));
- /* The condition must always be set, even if the ORR/EOR is not executed above. */
- return (flags & SLJIT_SET_E) ? push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, SET_FLAGS, TMP_REG1, SLJIT_UNUSED, RM(dst))) : SLJIT_SUCCESS;
- }
+ ins = (op == SLJIT_AND ? AND : (op == SLJIT_OR ? ORR : EOR));
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw, dst, dstw));
- src = TMP_REG1;
- srcw = 0;
- } else if (src & SLJIT_IMM) {
+ if (dst & SLJIT_MEM)
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, dst, dstw, TMP_REG2));
+
+ FAIL_IF(push_inst(compiler, ((ins | RD(dst_reg) | RN(dst_reg) | SRC2_IMM | 1) & ~COND_MASK) | cc));
+
+ if (op == SLJIT_AND)
+ FAIL_IF(push_inst(compiler, ((ins | RD(dst_reg) | RN(dst_reg) | SRC2_IMM | 0) & ~COND_MASK) | (cc ^ 0x10000000)));
+
+ if (dst & SLJIT_MEM)
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2));
+
+ if (flags & SLJIT_SET_Z)
+ return push_inst(compiler, MOV | SET_FLAGS | RD(TMP_REG2) | RM(dst_reg));
+ return SLJIT_SUCCESS;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_uw cc, tmp;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
+
+ dst_reg &= ~SLJIT_I32_OP;
+
+ cc = get_cc(type & 0xff);
+
+ if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
+ tmp = get_imm(srcw);
+ if (tmp)
+ return push_inst(compiler, ((MOV | RD(dst_reg) | tmp) & ~COND_MASK) | cc);
+
+ tmp = get_imm(~srcw);
+ if (tmp)
+ return push_inst(compiler, ((MVN | RD(dst_reg) | tmp) & ~COND_MASK) | cc);
+
+#if (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
+ tmp = (sljit_uw) srcw;
+ FAIL_IF(push_inst(compiler, (MOVW & ~COND_MASK) | cc | RD(dst_reg) | ((tmp << 4) & 0xf0000) | (tmp & 0xfff)));
+ if (tmp <= 0xffff)
+ return SLJIT_SUCCESS;
+ return push_inst(compiler, (MOVT & ~COND_MASK) | cc | RD(dst_reg) | ((tmp >> 12) & 0xf0000) | ((tmp >> 16) & 0xfff));
+#else
FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
src = TMP_REG1;
- srcw = 0;
+#endif
}
- FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(ins, 0, dst_r, src, SRC2_IMM | 1) & ~COND_MASK) | cc));
- FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(ins, 0, dst_r, src, SRC2_IMM | 0) & ~COND_MASK) | (cc ^ 0x10000000)));
- if (dst_r == TMP_REG2)
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA, TMP_REG2, dst, dstw, 0, 0));
+ return push_inst(compiler, ((MOV | RD(dst_reg) | RM(src)) & ~COND_MASK) | cc);
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ sljit_s32 flags;
+ sljit_uw is_type1_transfer, inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw));
+
+ is_type1_transfer = 1;
+
+ switch (type & 0xff) {
+ case SLJIT_MOV:
+ case SLJIT_MOV_U32:
+ case SLJIT_MOV_S32:
+ case SLJIT_MOV_P:
+ flags = WORD_SIZE;
+ break;
+ case SLJIT_MOV_U8:
+ flags = BYTE_SIZE;
+ break;
+ case SLJIT_MOV_S8:
+ if (!(type & SLJIT_MEM_STORE))
+ is_type1_transfer = 0;
+ flags = BYTE_SIZE | SIGNED;
+ break;
+ case SLJIT_MOV_U16:
+ is_type1_transfer = 0;
+ flags = HALF_SIZE;
+ break;
+ case SLJIT_MOV_S16:
+ is_type1_transfer = 0;
+ flags = HALF_SIZE | SIGNED;
+ break;
+ default:
+ SLJIT_UNREACHABLE();
+ flags = WORD_SIZE;
+ break;
+ }
+
+ if (!(type & SLJIT_MEM_STORE))
+ flags |= LOAD_DATA;
+
+ SLJIT_ASSERT(is_type1_transfer == !!IS_TYPE1_TRANSFER(flags));
+
+ if (SLJIT_UNLIKELY(mem & OFFS_REG_MASK)) {
+ if (!is_type1_transfer && memw != 0)
+ return SLJIT_ERR_UNSUPPORTED;
+ }
+ else {
+ if (is_type1_transfer) {
+ if (memw > 4095 && memw < -4095)
+ return SLJIT_ERR_UNSUPPORTED;
+ }
+ else {
+ if (memw > 255 && memw < -255)
+ return SLJIT_ERR_UNSUPPORTED;
+ }
+ }
+
+ if (type & SLJIT_MEM_SUPP)
+ return SLJIT_SUCCESS;
+
+ if (SLJIT_UNLIKELY(mem & OFFS_REG_MASK)) {
+ memw &= 0x3;
+
+ inst = EMIT_DATA_TRANSFER(flags, 1, reg, mem & REG_MASK, RM(OFFS_REG(mem)) | (memw << 7));
+
+ if (is_type1_transfer)
+ inst |= (1 << 25);
+
+ if (type & SLJIT_MEM_PRE)
+ inst |= (1 << 21);
+ else
+ inst ^= (1 << 24);
+
+ return push_inst(compiler, inst);
+ }
+
+ inst = EMIT_DATA_TRANSFER(flags, 0, reg, mem & REG_MASK, 0);
+
+ if (type & SLJIT_MEM_PRE)
+ inst |= (1 << 21);
+ else
+ inst ^= (1 << 24);
+
+ if (is_type1_transfer) {
+ if (memw >= 0)
+ inst |= (1 << 23);
+ else
+ memw = -memw;
+
+ return push_inst(compiler, inst | memw);
+ }
+
+ if (memw >= 0)
+ inst |= (1 << 23);
+ else
+ memw = -memw;
- return (flags & SLJIT_SET_E) ? push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, SET_FLAGS, TMP_REG1, SLJIT_UNUSED, RM(dst_r))) : SLJIT_SUCCESS;
+ return push_inst(compiler, inst | TYPE2_TRANSFER_IMM(memw));
}
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
@@ -2560,7 +2651,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
reg = SLOW_IS_REG(dst) ? dst : TMP_REG2;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
- PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0, reg, TMP_PC, 0), init_value));
+ PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, reg, TMP_PC, 0), init_value));
compiler->patches++;
#else
PTR_FAIL_IF(emit_imm(compiler, reg, init_value));
@@ -2568,7 +2659,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
set_const(const_, compiler);
if (dst & SLJIT_MEM)
- PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw));
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1));
return const_;
}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeARM_64.c b/thirdparty/pcre2/src/sljit/sljitNativeARM_64.c
index 2062d80b0a..8a437bd6a0 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeARM_64.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeARM_64.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -36,15 +36,19 @@ typedef sljit_u32 sljit_ins;
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
-#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
-#define TMP_LR (SLJIT_NUMBER_OF_REGISTERS + 5)
-#define TMP_SP (SLJIT_NUMBER_OF_REGISTERS + 6)
+#define TMP_LR (SLJIT_NUMBER_OF_REGISTERS + 4)
+#define TMP_SP (SLJIT_NUMBER_OF_REGISTERS + 5)
-#define TMP_FREG1 (0)
-#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
+/* r18 - platform register, currently not used */
static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
- 31, 0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 16, 17, 8, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 29, 9, 10, 11, 30, 31
+ 31, 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 17, 8, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 29, 9, 10, 30, 31
+};
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7
};
#define W_OP (1 << 31)
@@ -53,10 +57,10 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
#define RN(rn) (reg_map[rn] << 5)
#define RT2(rt2) (reg_map[rt2] << 10)
#define RM(rm) (reg_map[rm] << 16)
-#define VD(vd) (vd)
-#define VT(vt) (vt)
-#define VN(vn) ((vn) << 5)
-#define VM(vm) ((vm) << 16)
+#define VD(vd) (freg_map[vd])
+#define VT(vt) (freg_map[vt])
+#define VN(vn) (freg_map[vn] << 5)
+#define VM(vm) (freg_map[vm] << 16)
/* --------------------------------------------------------------------- */
/* Instrucion forms */
@@ -76,6 +80,7 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
#define BRK 0xd4200000
#define CBZ 0xb4000000
#define CLZ 0xdac01000
+#define CSEL 0x9a800000
#define CSINC 0x9a800400
#define EOR 0xca000000
#define EORI 0xd2000000
@@ -111,10 +116,13 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 8] = {
#define SMULH 0x9b403c00
#define STP 0xa9000000
#define STP_PRE 0xa9800000
+#define STRB 0x38206800
+#define STRBI 0x39000000
#define STRI 0xf9000000
#define STR_FI 0x3d000000
#define STR_FR 0x3c206800
#define STUR_FI 0x3c000000
+#define STURBI 0x38000000
#define SUB 0xcb000000
#define SUBI 0xd1000000
#define SUBS 0xeb000000
@@ -192,6 +200,7 @@ static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_in
code_ptr[-2] = code_ptr[0];
return 2;
}
+
if (target_addr <= 0xffffffffffffl) {
if (jump->flags & IS_COND)
code_ptr[-5] -= (1 << 5);
@@ -323,6 +332,26 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
return code;
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#else
+ /* Available by default. */
+ return 1;
+#endif
+
+ case SLJIT_HAS_CLZ:
+ case SLJIT_HAS_CMOV:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Core code generator functions. */
/* --------------------------------------------------------------------- */
@@ -372,12 +401,14 @@ static sljit_ins logical_imm(sljit_sw imm, sljit_s32 len)
SLJIT_ASSERT((len == 32 && imm != 0 && imm != -1)
|| (len == 16 && (sljit_s32)imm != 0 && (sljit_s32)imm != -1));
+
uimm = (sljit_uw)imm;
while (1) {
if (len <= 0) {
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return 0;
}
+
mask = ((sljit_uw)1 << len) - 1;
if ((uimm & mask) != ((uimm >> len) & mask))
break;
@@ -426,39 +457,42 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst,
sljit_s32 i, zeros, ones, first;
sljit_ins bitmask;
+ /* Handling simple immediates first. */
if (imm <= 0xffff)
return push_inst(compiler, MOVZ | RD(dst) | (imm << 5));
- if (simm >= -0x10000 && simm < 0)
+ if (simm < 0 && simm >= -0x10000)
return push_inst(compiler, MOVN | RD(dst) | ((~imm & 0xffff) << 5));
if (imm <= 0xffffffffl) {
+ if ((imm & 0xffff) == 0)
+ return push_inst(compiler, MOVZ | RD(dst) | ((imm >> 16) << 5) | (1 << 21));
if ((imm & 0xffff0000l) == 0xffff0000)
return push_inst(compiler, (MOVN ^ W_OP) | RD(dst) | ((~imm & 0xffff) << 5));
if ((imm & 0xffff) == 0xffff)
return push_inst(compiler, (MOVN ^ W_OP) | RD(dst) | ((~imm & 0xffff0000l) >> (16 - 5)) | (1 << 21));
+
bitmask = logical_imm(simm, 16);
if (bitmask != 0)
return push_inst(compiler, (ORRI ^ W_OP) | RD(dst) | RN(TMP_ZERO) | bitmask);
- }
- else {
- bitmask = logical_imm(simm, 32);
- if (bitmask != 0)
- return push_inst(compiler, ORRI | RD(dst) | RN(TMP_ZERO) | bitmask);
- }
- if (imm <= 0xffffffffl) {
FAIL_IF(push_inst(compiler, MOVZ | RD(dst) | ((imm & 0xffff) << 5)));
return push_inst(compiler, MOVK | RD(dst) | ((imm & 0xffff0000l) >> (16 - 5)) | (1 << 21));
}
- if (simm >= -0x100000000l && simm < 0) {
+ bitmask = logical_imm(simm, 32);
+ if (bitmask != 0)
+ return push_inst(compiler, ORRI | RD(dst) | RN(TMP_ZERO) | bitmask);
+
+ if (simm < 0 && simm >= -0x100000000l) {
+ if ((imm & 0xffff) == 0xffff)
+ return push_inst(compiler, MOVN | RD(dst) | ((~imm & 0xffff0000l) >> (16 - 5)) | (1 << 21));
+
FAIL_IF(push_inst(compiler, MOVN | RD(dst) | ((~imm & 0xffff) << 5)));
return push_inst(compiler, MOVK | RD(dst) | ((imm & 0xffff0000l) >> (16 - 5)) | (1 << 21));
}
- /* A large amount of number can be constructed from ORR and MOVx,
- but computing them is costly. We don't */
+ /* A large amount of number can be constructed from ORR and MOVx, but computing them is costly. */
zeros = 0;
ones = 0;
@@ -511,9 +545,6 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst,
#define INT_OP 0x0040000
#define SET_FLAGS 0x0080000
#define UNUSED_RETURN 0x0100000
-#define SLOW_DEST 0x0200000
-#define SLOW_SRC1 0x0400000
-#define SLOW_SRC2 0x0800000
#define CHECK_FLAGS(flag_bits) \
if (flags & SET_FLAGS) { \
@@ -645,7 +676,7 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
}
goto set_flags;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -671,40 +702,32 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
switch (op) {
case SLJIT_MOV:
case SLJIT_MOV_P:
- case SLJIT_MOVU:
- case SLJIT_MOVU_P:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
if (dst == arg2)
return SLJIT_SUCCESS;
return push_inst(compiler, ORR | RD(dst) | RN(TMP_ZERO) | RM(arg2));
case SLJIT_MOV_U8:
- case SLJIT_MOVU_U8:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
return push_inst(compiler, (UBFM ^ (1 << 31)) | RD(dst) | RN(arg2) | (7 << 10));
case SLJIT_MOV_S8:
- case SLJIT_MOVU_S8:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
if (!(flags & INT_OP))
inv_bits |= 1 << 22;
return push_inst(compiler, (SBFM ^ inv_bits) | RD(dst) | RN(arg2) | (7 << 10));
case SLJIT_MOV_U16:
- case SLJIT_MOVU_U16:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
return push_inst(compiler, (UBFM ^ (1 << 31)) | RD(dst) | RN(arg2) | (15 << 10));
case SLJIT_MOV_S16:
- case SLJIT_MOVU_S16:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
if (!(flags & INT_OP))
inv_bits |= 1 << 22;
return push_inst(compiler, (SBFM ^ inv_bits) | RD(dst) | RN(arg2) | (15 << 10));
case SLJIT_MOV_U32:
- case SLJIT_MOVU_U32:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
if ((flags & INT_OP) && dst == arg2)
return SLJIT_SUCCESS;
return push_inst(compiler, (ORR ^ (1 << 31)) | RD(dst) | RN(TMP_ZERO) | RM(arg2));
case SLJIT_MOV_S32:
- case SLJIT_MOVU_S32:
SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
if ((flags & INT_OP) && dst == arg2)
return SLJIT_SUCCESS;
@@ -712,7 +735,7 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
case SLJIT_NOT:
SLJIT_ASSERT(arg1 == TMP_REG1);
FAIL_IF(push_inst(compiler, (ORN ^ inv_bits) | RD(dst) | RN(TMP_ZERO) | RM(arg2)));
- goto set_flags;
+ break; /* Set flags. */
case SLJIT_NEG:
SLJIT_ASSERT(arg1 == TMP_REG1);
if (flags & SET_FLAGS)
@@ -720,8 +743,7 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
return push_inst(compiler, (SUB ^ inv_bits) | RD(dst) | RN(TMP_ZERO) | RM(arg2));
case SLJIT_CLZ:
SLJIT_ASSERT(arg1 == TMP_REG1);
- FAIL_IF(push_inst(compiler, (CLZ ^ inv_bits) | RD(dst) | RN(arg2)));
- goto set_flags;
+ return push_inst(compiler, (CLZ ^ inv_bits) | RD(dst) | RN(arg2));
case SLJIT_ADD:
CHECK_FLAGS(1 << 29);
return push_inst(compiler, (ADD ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2));
@@ -750,320 +772,91 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
return push_inst(compiler, (AND ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2));
case SLJIT_OR:
FAIL_IF(push_inst(compiler, (ORR ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2)));
- goto set_flags;
+ break; /* Set flags. */
case SLJIT_XOR:
FAIL_IF(push_inst(compiler, (EOR ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2)));
- goto set_flags;
+ break; /* Set flags. */
case SLJIT_SHL:
FAIL_IF(push_inst(compiler, (LSLV ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2)));
- goto set_flags;
+ break; /* Set flags. */
case SLJIT_LSHR:
FAIL_IF(push_inst(compiler, (LSRV ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2)));
- goto set_flags;
+ break; /* Set flags. */
case SLJIT_ASHR:
FAIL_IF(push_inst(compiler, (ASRV ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2)));
- goto set_flags;
+ break; /* Set flags. */
+ default:
+ SLJIT_UNREACHABLE();
+ return SLJIT_SUCCESS;
}
- SLJIT_ASSERT_STOP();
- return SLJIT_SUCCESS;
-
set_flags:
if (flags & SET_FLAGS)
return push_inst(compiler, (SUBS ^ inv_bits) | RD(TMP_ZERO) | RN(dst) | RM(TMP_ZERO));
return SLJIT_SUCCESS;
}
-#define STORE 0x01
-#define SIGNED 0x02
-
-#define UPDATE 0x04
-#define ARG_TEST 0x08
-
-#define BYTE_SIZE 0x000
-#define HALF_SIZE 0x100
-#define INT_SIZE 0x200
-#define WORD_SIZE 0x300
-
-#define MEM_SIZE_SHIFT(flags) ((flags) >> 8)
-
-static const sljit_ins sljit_mem_imm[4] = {
-/* u l */ 0x39400000 /* ldrb [reg,imm] */,
-/* u s */ 0x39000000 /* strb [reg,imm] */,
-/* s l */ 0x39800000 /* ldrsb [reg,imm] */,
-/* s s */ 0x39000000 /* strb [reg,imm] */,
-};
-
-static const sljit_ins sljit_mem_simm[4] = {
-/* u l */ 0x38400000 /* ldurb [reg,imm] */,
-/* u s */ 0x38000000 /* sturb [reg,imm] */,
-/* s l */ 0x38800000 /* ldursb [reg,imm] */,
-/* s s */ 0x38000000 /* sturb [reg,imm] */,
-};
+#define STORE 0x10
+#define SIGNED 0x20
-static const sljit_ins sljit_mem_pre_simm[4] = {
-/* u l */ 0x38400c00 /* ldrb [reg,imm]! */,
-/* u s */ 0x38000c00 /* strb [reg,imm]! */,
-/* s l */ 0x38800c00 /* ldrsb [reg,imm]! */,
-/* s s */ 0x38000c00 /* strb [reg,imm]! */,
-};
-
-static const sljit_ins sljit_mem_reg[4] = {
-/* u l */ 0x38606800 /* ldrb [reg,reg] */,
-/* u s */ 0x38206800 /* strb [reg,reg] */,
-/* s l */ 0x38a06800 /* ldrsb [reg,reg] */,
-/* s s */ 0x38206800 /* strb [reg,reg] */,
-};
+#define BYTE_SIZE 0x0
+#define HALF_SIZE 0x1
+#define INT_SIZE 0x2
+#define WORD_SIZE 0x3
-/* Helper function. Dst should be reg + value, using at most 1 instruction, flags does not set. */
-static sljit_s32 emit_set_delta(struct sljit_compiler *compiler, sljit_s32 dst, sljit_s32 reg, sljit_sw value)
-{
- if (value >= 0) {
- if (value <= 0xfff)
- return push_inst(compiler, ADDI | RD(dst) | RN(reg) | (value << 10));
- if (value <= 0xffffff && !(value & 0xfff))
- return push_inst(compiler, ADDI | (1 << 22) | RD(dst) | RN(reg) | (value >> 2));
- }
- else {
- value = -value;
- if (value <= 0xfff)
- return push_inst(compiler, SUBI | RD(dst) | RN(reg) | (value << 10));
- if (value <= 0xffffff && !(value & 0xfff))
- return push_inst(compiler, SUBI | (1 << 22) | RD(dst) | RN(reg) | (value >> 2));
- }
- return SLJIT_ERR_UNSUPPORTED;
-}
+#define MEM_SIZE_SHIFT(flags) ((flags) & 0x3)
-/* Can perform an operation using at most 1 instruction. */
-static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
+static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
+ sljit_s32 arg, sljit_sw argw, sljit_s32 tmp_reg)
{
sljit_u32 shift = MEM_SIZE_SHIFT(flags);
+ sljit_u32 type = (shift << 30);
- SLJIT_ASSERT(arg & SLJIT_MEM);
-
- if (SLJIT_UNLIKELY(flags & UPDATE)) {
- if ((arg & REG_MASK) && !(arg & OFFS_REG_MASK) && argw <= 255 && argw >= -256) {
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
+ if (!(flags & STORE))
+ type |= (flags & SIGNED) ? 0x00800000 : 0x00400000;
- arg &= REG_MASK;
- argw &= 0x1ff;
- FAIL_IF(push_inst(compiler, sljit_mem_pre_simm[flags & 0x3]
- | (shift << 30) | RT(reg) | RN(arg) | (argw << 12)));
- return -1;
- }
- return 0;
- }
+ SLJIT_ASSERT(arg & SLJIT_MEM);
if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
argw &= 0x3;
- if (argw && argw != shift)
- return 0;
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
+ if (argw == 0 || argw == shift)
+ return push_inst(compiler, STRB | type | RT(reg)
+ | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (argw ? (1 << 12) : 0));
- FAIL_IF(push_inst(compiler, sljit_mem_reg[flags & 0x3] | (shift << 30) | RT(reg)
- | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (argw ? (1 << 12) : 0)));
- return -1;
+ FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (argw << 10)));
+ return push_inst(compiler, STRBI | type | RT(reg) | RN(tmp_reg));
}
arg &= REG_MASK;
- if (argw >= 0 && (argw >> shift) <= 0xfff && (argw & ((1 << shift) - 1)) == 0) {
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
- FAIL_IF(push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30)
- | RT(reg) | RN(arg) | (argw << (10 - shift))));
- return -1;
- }
+ if (arg == SLJIT_UNUSED) {
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw & ~(0xfff << shift)));
- if (argw > 255 || argw < -256)
- return 0;
-
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
-
- FAIL_IF(push_inst(compiler, sljit_mem_simm[flags & 0x3] | (shift << 30)
- | RT(reg) | RN(arg) | ((argw & 0x1ff) << 12)));
- return -1;
-}
-
-/* see getput_arg below.
- Note: can_cache is called only for binary operators. Those
- operators always uses word arguments without write back. */
-static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_sw diff;
- if ((arg & OFFS_REG_MASK) || !(next_arg & SLJIT_MEM))
- return 0;
+ argw = (argw >> shift) & 0xfff;
- if (!(arg & REG_MASK)) {
- diff = argw - next_argw;
- if (diff <= 0xfff && diff >= -0xfff)
- return 1;
- return 0;
+ return push_inst(compiler, STRBI | type | RT(reg) | RN(tmp_reg) | (argw << 10));
}
- if (argw == next_argw)
- return 1;
-
- diff = argw - next_argw;
- if (arg == next_arg && diff <= 0xfff && diff >= -0xfff)
- return 1;
-
- return 0;
-}
-
-/* Emit the necessary instructions. See can_cache above. */
-static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
- sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_u32 shift = MEM_SIZE_SHIFT(flags);
- sljit_s32 tmp_r, other_r;
- sljit_sw diff;
-
- SLJIT_ASSERT(arg & SLJIT_MEM);
- if (!(next_arg & SLJIT_MEM)) {
- next_arg = 0;
- next_argw = 0;
- }
-
- tmp_r = (flags & STORE) ? TMP_REG3 : reg;
-
- if (SLJIT_UNLIKELY((flags & UPDATE) && (arg & REG_MASK))) {
- /* Update only applies if a base register exists. */
- other_r = OFFS_REG(arg);
- if (!other_r) {
- other_r = arg & REG_MASK;
- if (other_r != reg && argw >= 0 && argw <= 0xffffff) {
- if ((argw & 0xfff) != 0)
- FAIL_IF(push_inst(compiler, ADDI | RD(other_r) | RN(other_r) | ((argw & 0xfff) << 10)));
- if (argw >> 12)
- FAIL_IF(push_inst(compiler, ADDI | (1 << 22) | RD(other_r) | RN(other_r) | ((argw >> 12) << 10)));
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(other_r));
- }
- else if (other_r != reg && argw < 0 && argw >= -0xffffff) {
- argw = -argw;
- if ((argw & 0xfff) != 0)
- FAIL_IF(push_inst(compiler, SUBI | RD(other_r) | RN(other_r) | ((argw & 0xfff) << 10)));
- if (argw >> 12)
- FAIL_IF(push_inst(compiler, SUBI | (1 << 22) | RD(other_r) | RN(other_r) | ((argw >> 12) << 10)));
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(other_r));
- }
-
- if (compiler->cache_arg == SLJIT_MEM) {
- if (argw == compiler->cache_argw) {
- other_r = TMP_REG3;
- argw = 0;
- }
- else if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, argw - compiler->cache_argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- other_r = TMP_REG3;
- argw = 0;
- }
- }
-
- if (argw) {
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
- compiler->cache_arg = SLJIT_MEM;
- compiler->cache_argw = argw;
- other_r = TMP_REG3;
- argw = 0;
- }
- }
-
- /* No caching here. */
- arg &= REG_MASK;
- argw &= 0x3;
- if (!argw || argw == shift) {
- FAIL_IF(push_inst(compiler, sljit_mem_reg[flags & 0x3] | (shift << 30) | RT(reg) | RN(arg) | RM(other_r) | (argw ? (1 << 12) : 0)));
- return push_inst(compiler, ADD | RD(arg) | RN(arg) | RM(other_r) | (argw << 10));
- }
- if (arg != reg) {
- FAIL_IF(push_inst(compiler, ADD | RD(arg) | RN(arg) | RM(other_r) | (argw << 10)));
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(arg));
+ if (argw >= 0 && (argw & ((1 << shift) - 1)) == 0) {
+ if ((argw >> shift) <= 0xfff) {
+ return push_inst(compiler, STRBI | type | RT(reg) | RN(arg) | (argw << (10 - shift)));
}
- FAIL_IF(push_inst(compiler, ADD | RD(TMP_LR) | RN(arg) | RM(other_r) | (argw << 10)));
- FAIL_IF(push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(TMP_LR)));
- return push_inst(compiler, ORR | RD(arg) | RN(TMP_ZERO) | RM(TMP_LR));
- }
-
- if (arg & OFFS_REG_MASK) {
- other_r = OFFS_REG(arg);
- arg &= REG_MASK;
- FAIL_IF(push_inst(compiler, ADD | RD(tmp_r) | RN(arg) | RM(other_r) | ((argw & 0x3) << 10)));
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(tmp_r));
- }
-
- if (compiler->cache_arg == arg) {
- diff = argw - compiler->cache_argw;
- if (diff <= 255 && diff >= -256)
- return push_inst(compiler, sljit_mem_simm[flags & 0x3] | (shift << 30)
- | RT(reg) | RN(TMP_REG3) | ((diff & 0x1ff) << 12));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, diff) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(arg));
- }
- }
-
- if (argw >= 0 && argw <= 0xffffff && (argw & ((1 << shift) - 1)) == 0) {
- FAIL_IF(push_inst(compiler, ADDI | (1 << 22) | RD(tmp_r) | RN(arg & REG_MASK) | ((argw >> 12) << 10)));
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30)
- | RT(reg) | RN(tmp_r) | ((argw & 0xfff) << (10 - shift)));
- }
- diff = argw - next_argw;
- next_arg = (arg & REG_MASK) && (arg == next_arg) && diff <= 0xfff && diff >= -0xfff && diff != 0;
- arg &= REG_MASK;
+ if (argw <= 0xffffff) {
+ FAIL_IF(push_inst(compiler, ADDI | (1 << 22) | RD(tmp_reg) | RN(arg) | ((argw >> 12) << 10)));
- if (arg && compiler->cache_arg == SLJIT_MEM) {
- if (compiler->cache_argw == argw)
- return push_inst(compiler, sljit_mem_reg[flags & 0x3] | (shift << 30) | RT(reg) | RN(arg) | RM(TMP_REG3));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, argw - compiler->cache_argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- return push_inst(compiler, sljit_mem_reg[flags & 0x3] | (shift << 30) | RT(reg) | RN(arg) | RM(TMP_REG3));
+ argw = ((argw & 0xfff) >> shift);
+ return push_inst(compiler, STRBI | type | RT(reg) | RN(tmp_reg) | (argw << 10));
}
}
- compiler->cache_argw = argw;
- if (next_arg && emit_set_delta(compiler, TMP_REG3, arg, argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_arg = SLJIT_MEM | arg;
- arg = 0;
- }
- else {
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
- compiler->cache_arg = SLJIT_MEM;
+ if (argw <= 255 && argw >= -256)
+ return push_inst(compiler, STURBI | type | RT(reg) | RN(arg) | ((argw & 0x1ff) << 12));
- if (next_arg) {
- FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG3) | RN(TMP_REG3) | RM(arg)));
- compiler->cache_arg = SLJIT_MEM | arg;
- arg = 0;
- }
- }
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw));
- if (arg)
- return push_inst(compiler, sljit_mem_reg[flags & 0x3] | (shift << 30) | RT(reg) | RN(arg) | RM(TMP_REG3));
- return push_inst(compiler, sljit_mem_imm[flags & 0x3] | (shift << 30) | RT(reg) | RN(TMP_REG3));
-}
-
-static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
-{
- if (getput_arg_fast(compiler, flags, reg, arg, argw))
- return compiler->error;
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
-}
-
-static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
-{
- if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
- return compiler->error;
- return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
+ return push_inst(compiler, STRB | type | RT(reg) | RN(arg) | RM(tmp_reg));
}
/* --------------------------------------------------------------------- */
@@ -1071,14 +864,14 @@ static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, slji
/* --------------------------------------------------------------------- */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- sljit_s32 i, tmp, offs, prev, saved_regs_size;
+ sljit_s32 args, i, tmp, offs, prev, saved_regs_size;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
saved_regs_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 0);
local_size += saved_regs_size + SLJIT_LOCALS_OFFSET;
@@ -1148,6 +941,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RN(TMP_SP) | (0 << 10)));
}
+ args = get_arg_count(arg_types);
+
if (args >= 1)
FAIL_IF(push_inst(compiler, ORR | RD(SLJIT_S0) | RN(TMP_ZERO) | RM(SLJIT_R0)));
if (args >= 2)
@@ -1159,12 +954,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds, 0) + SLJIT_LOCALS_OFFSET;
local_size = (local_size + 15) & ~0xf;
@@ -1297,112 +1092,87 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op)) {
+ if (op <= SLJIT_MOV_P && (src & SLJIT_MEM)) {
+ SLJIT_ASSERT(reg_map[1] == 0 && reg_map[3] == 2 && reg_map[5] == 4);
+
+ if (op >= SLJIT_MOV_U8 && op <= SLJIT_MOV_S8)
+ dst = 5;
+ else if (op >= SLJIT_MOV_U16 && op <= SLJIT_MOV_S16)
+ dst = 3;
+ else
+ dst = 1;
+
+ /* Signed word sized load is the prefetch instruction. */
+ return emit_op_mem(compiler, WORD_SIZE | SIGNED, dst, src, srcw, TMP_REG1);
+ }
+ return SLJIT_SUCCESS;
+ }
dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
op = GET_OPCODE(op);
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_P) {
+ if (op >= SLJIT_MOV && op <= SLJIT_MOV_P) {
+ /* Both operands are registers. */
+ if (dst_r != TMP_REG1 && FAST_IS_REG(src))
+ return emit_op_imm(compiler, op | ((op_flags & SLJIT_I32_OP) ? INT_OP : 0), dst_r, TMP_REG1, src);
+
switch (op) {
case SLJIT_MOV:
case SLJIT_MOV_P:
- flags = WORD_SIZE;
+ mem_flags = WORD_SIZE;
break;
case SLJIT_MOV_U8:
- flags = BYTE_SIZE;
+ mem_flags = BYTE_SIZE;
if (src & SLJIT_IMM)
srcw = (sljit_u8)srcw;
break;
case SLJIT_MOV_S8:
- flags = BYTE_SIZE | SIGNED;
+ mem_flags = BYTE_SIZE | SIGNED;
if (src & SLJIT_IMM)
srcw = (sljit_s8)srcw;
break;
case SLJIT_MOV_U16:
- flags = HALF_SIZE;
+ mem_flags = HALF_SIZE;
if (src & SLJIT_IMM)
srcw = (sljit_u16)srcw;
break;
case SLJIT_MOV_S16:
- flags = HALF_SIZE | SIGNED;
+ mem_flags = HALF_SIZE | SIGNED;
if (src & SLJIT_IMM)
srcw = (sljit_s16)srcw;
break;
case SLJIT_MOV_U32:
- flags = INT_SIZE;
+ mem_flags = INT_SIZE;
if (src & SLJIT_IMM)
srcw = (sljit_u32)srcw;
break;
case SLJIT_MOV_S32:
- flags = INT_SIZE | SIGNED;
- if (src & SLJIT_IMM)
- srcw = (sljit_s32)srcw;
- break;
- case SLJIT_MOVU:
- case SLJIT_MOVU_P:
- flags = WORD_SIZE | UPDATE;
- break;
- case SLJIT_MOVU_U8:
- flags = BYTE_SIZE | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_u8)srcw;
- break;
- case SLJIT_MOVU_S8:
- flags = BYTE_SIZE | SIGNED | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_s8)srcw;
- break;
- case SLJIT_MOVU_U16:
- flags = HALF_SIZE | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_u16)srcw;
- break;
- case SLJIT_MOVU_S16:
- flags = HALF_SIZE | SIGNED | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_s16)srcw;
- break;
- case SLJIT_MOVU_U32:
- flags = INT_SIZE | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_u32)srcw;
- break;
- case SLJIT_MOVU_S32:
- flags = INT_SIZE | SIGNED | UPDATE;
+ mem_flags = INT_SIZE | SIGNED;
if (src & SLJIT_IMM)
srcw = (sljit_s32)srcw;
break;
default:
- SLJIT_ASSERT_STOP();
- flags = 0;
+ SLJIT_UNREACHABLE();
+ mem_flags = 0;
break;
}
if (src & SLJIT_IMM)
FAIL_IF(emit_op_imm(compiler, SLJIT_MOV | ARG2_IMM, dst_r, TMP_REG1, srcw));
- else if (src & SLJIT_MEM) {
- if (getput_arg_fast(compiler, flags, dst_r, src, srcw))
- FAIL_IF(compiler->error);
- else
- FAIL_IF(getput_arg(compiler, flags, dst_r, src, srcw, dst, dstw));
- } else {
- if (dst_r != TMP_REG1)
- return emit_op_imm(compiler, op | ((op_flags & SLJIT_I32_OP) ? INT_OP : 0), dst_r, TMP_REG1, src);
+ else if (!(src & SLJIT_MEM))
dst_r = src;
- }
+ else
+ FAIL_IF(emit_op_mem(compiler, mem_flags, dst_r, src, srcw, TMP_REG1));
- if (dst & SLJIT_MEM) {
- if (getput_arg_fast(compiler, flags | STORE, dst_r, dst, dstw))
- return compiler->error;
- else
- return getput_arg(compiler, flags | STORE, dst_r, dst, dstw, 0, 0);
- }
+ if (dst & SLJIT_MEM)
+ return emit_op_mem(compiler, mem_flags | STORE, dst_r, dst, dstw, TMP_REG2);
return SLJIT_SUCCESS;
}
- flags = GET_FLAGS(op_flags) ? SET_FLAGS : 0;
+ flags = HAS_FLAGS(op_flags) ? SET_FLAGS : 0;
mem_flags = WORD_SIZE;
+
if (op_flags & SLJIT_I32_OP) {
flags |= INT_OP;
mem_flags = INT_SIZE;
@@ -1412,28 +1182,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
flags |= UNUSED_RETURN;
if (src & SLJIT_MEM) {
- if (getput_arg_fast(compiler, mem_flags, TMP_REG2, src, srcw))
- FAIL_IF(compiler->error);
- else
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG2, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem(compiler, mem_flags, TMP_REG2, src, srcw, TMP_REG2));
src = TMP_REG2;
}
- if (src & SLJIT_IMM) {
- flags |= ARG2_IMM;
- if (op_flags & SLJIT_I32_OP)
- srcw = (sljit_s32)srcw;
- } else
- srcw = src;
-
- emit_op_imm(compiler, flags | op, dst_r, TMP_REG1, srcw);
+ emit_op_imm(compiler, flags | op, dst_r, TMP_REG1, src);
- if (dst & SLJIT_MEM) {
- if (getput_arg_fast(compiler, mem_flags | STORE, dst_r, dst, dstw))
- return compiler->error;
- else
- return getput_arg(compiler, mem_flags | STORE, dst_r, dst, dstw, 0, 0);
- }
+ if (SLJIT_UNLIKELY(dst & SLJIT_MEM))
+ return emit_op_mem(compiler, mem_flags | STORE, dst_r, dst, dstw, TMP_REG2);
return SLJIT_SUCCESS;
}
@@ -1450,12 +1206,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
- flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+ flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
mem_flags = WORD_SIZE;
+
if (op & SLJIT_I32_OP) {
flags |= INT_OP;
mem_flags = INT_SIZE;
@@ -1464,46 +1221,21 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
if (dst == SLJIT_UNUSED)
flags |= UNUSED_RETURN;
- if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, mem_flags | STORE | ARG_TEST, TMP_REG1, dst, dstw))
- flags |= SLOW_DEST;
-
if (src1 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, mem_flags, TMP_REG1, src1, src1w))
- FAIL_IF(compiler->error);
- else
- flags |= SLOW_SRC1;
- }
- if (src2 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, mem_flags, TMP_REG2, src2, src2w))
- FAIL_IF(compiler->error);
- else
- flags |= SLOW_SRC2;
- }
-
- if ((flags & (SLOW_SRC1 | SLOW_SRC2)) == (SLOW_SRC1 | SLOW_SRC2)) {
- if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG2, src2, src2w, src1, src1w));
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG1, src1, src1w, dst, dstw));
- }
- else {
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG1, src1, src1w, src2, src2w));
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG2, src2, src2w, dst, dstw));
- }
+ FAIL_IF(emit_op_mem(compiler, mem_flags, TMP_REG1, src1, src1w, TMP_REG1));
+ src1 = TMP_REG1;
}
- else if (flags & SLOW_SRC1)
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG1, src1, src1w, dst, dstw));
- else if (flags & SLOW_SRC2)
- FAIL_IF(getput_arg(compiler, mem_flags, TMP_REG2, src2, src2w, dst, dstw));
- if (src1 & SLJIT_MEM)
- src1 = TMP_REG1;
- if (src2 & SLJIT_MEM)
+ if (src2 & SLJIT_MEM) {
+ FAIL_IF(emit_op_mem(compiler, mem_flags, TMP_REG2, src2, src2w, TMP_REG2));
src2 = TMP_REG2;
+ }
if (src1 & SLJIT_IMM)
flags |= ARG1_IMM;
else
src1w = src1;
+
if (src2 & SLJIT_IMM)
flags |= ARG2_IMM;
else
@@ -1511,14 +1243,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
emit_op_imm(compiler, flags | GET_OPCODE(op), dst_r, src1w, src2w);
- if (dst & SLJIT_MEM) {
- if (!(flags & SLOW_DEST)) {
- getput_arg_fast(compiler, mem_flags | STORE, dst_r, dst, dstw);
- return compiler->error;
- }
- return getput_arg(compiler, mem_flags | STORE, TMP_REG1, dst, dstw, 0, 0);
- }
-
+ if (dst & SLJIT_MEM)
+ return emit_op_mem(compiler, mem_flags | STORE, dst_r, dst, dstw, TMP_REG2);
return SLJIT_SUCCESS;
}
@@ -1531,7 +1257,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
- return reg;
+ return freg_map[reg];
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -1547,74 +1273,60 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#else
- /* Available by default. */
- return 1;
-#endif
-}
-
static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
{
sljit_u32 shift = MEM_SIZE_SHIFT(flags);
- sljit_ins ins_bits = (shift << 30);
- sljit_s32 other_r;
- sljit_sw diff;
+ sljit_ins type = (shift << 30);
SLJIT_ASSERT(arg & SLJIT_MEM);
if (!(flags & STORE))
- ins_bits |= 1 << 22;
+ type |= 0x00400000;
if (arg & OFFS_REG_MASK) {
argw &= 3;
- if (!argw || argw == shift)
- return push_inst(compiler, STR_FR | ins_bits | VT(reg)
+ if (argw == 0 || argw == shift)
+ return push_inst(compiler, STR_FR | type | VT(reg)
| RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (argw ? (1 << 12) : 0));
- other_r = OFFS_REG(arg);
- arg &= REG_MASK;
- FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG1) | RN(arg) | RM(other_r) | (argw << 10)));
- arg = TMP_REG1;
- argw = 0;
+
+ FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG1) | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (argw << 10)));
+ return push_inst(compiler, STR_FI | type | VT(reg) | RN(TMP_REG1));
}
arg &= REG_MASK;
- if (arg && argw >= 0 && ((argw >> shift) <= 0xfff) && (argw & ((1 << shift) - 1)) == 0)
- return push_inst(compiler, STR_FI | ins_bits | VT(reg) | RN(arg) | (argw << (10 - shift)));
-
- if (arg && argw <= 255 && argw >= -256)
- return push_inst(compiler, STUR_FI | ins_bits | VT(reg) | RN(arg) | ((argw & 0x1ff) << 12));
-
- /* Slow cases */
- if (compiler->cache_arg == SLJIT_MEM && argw != compiler->cache_argw) {
- diff = argw - compiler->cache_argw;
- if (!arg && diff <= 255 && diff >= -256)
- return push_inst(compiler, STUR_FI | ins_bits | VT(reg) | RN(TMP_REG3) | ((diff & 0x1ff) << 12));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, argw - compiler->cache_argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- }
+
+ if (arg == SLJIT_UNUSED) {
+ FAIL_IF(load_immediate(compiler, TMP_REG1, argw & ~(0xfff << shift)));
+
+ argw = (argw >> shift) & 0xfff;
+
+ return push_inst(compiler, STR_FI | type | VT(reg) | RN(TMP_REG1) | (argw << 10));
}
- if (compiler->cache_arg != SLJIT_MEM || argw != compiler->cache_argw) {
- compiler->cache_arg = SLJIT_MEM;
- compiler->cache_argw = argw;
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
+ if (argw >= 0 && (argw & ((1 << shift) - 1)) == 0) {
+ if ((argw >> shift) <= 0xfff)
+ return push_inst(compiler, STR_FI | type | VT(reg) | RN(arg) | (argw << (10 - shift)));
+
+ if (argw <= 0xffffff) {
+ FAIL_IF(push_inst(compiler, ADDI | (1 << 22) | RD(TMP_REG1) | RN(arg) | ((argw >> 12) << 10)));
+
+ argw = ((argw & 0xfff) >> shift);
+ return push_inst(compiler, STR_FI | type | VT(reg) | RN(TMP_REG1) | (argw << 10));
+ }
}
- if (arg & REG_MASK)
- return push_inst(compiler, STR_FR | ins_bits | VT(reg) | RN(arg) | RM(TMP_REG3));
- return push_inst(compiler, STR_FI | ins_bits | VT(reg) | RN(TMP_REG3));
+ if (argw <= 255 && argw >= -256)
+ return push_inst(compiler, STUR_FI | type | VT(reg) | RN(arg) | ((argw & 0x1ff) << 12));
+
+ FAIL_IF(load_immediate(compiler, TMP_REG1, argw));
+ return push_inst(compiler, STR_FR | type | VT(reg) | RN(arg) | RM(TMP_REG1));
}
static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
- sljit_s32 dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+ sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
sljit_ins inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
if (GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64)
@@ -1627,8 +1339,8 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
FAIL_IF(push_inst(compiler, (FCVTZS ^ inv_bits) | RD(dst_r) | VN(src)));
- if (dst_r == TMP_REG1 && dst != SLJIT_UNUSED)
- return emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64) ? INT_SIZE : WORD_SIZE) | STORE, TMP_REG1, dst, dstw);
+ if (dst & SLJIT_MEM)
+ return emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONV_S32_FROM_F64) ? INT_SIZE : WORD_SIZE) | STORE, TMP_REG1, dst, dstw, TMP_REG2);
return SLJIT_SUCCESS;
}
@@ -1643,7 +1355,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
inv_bits |= (1 << 31);
if (src & SLJIT_MEM) {
- emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32) ? INT_SIZE : WORD_SIZE), TMP_REG1, src, srcw);
+ emit_op_mem(compiler, ((GET_OPCODE(op) == SLJIT_CONV_F64_FROM_S32) ? INT_SIZE : WORD_SIZE), TMP_REG1, src, srcw, TMP_REG1);
src = TMP_REG1;
} else if (src & SLJIT_IMM) {
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -1689,17 +1401,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
sljit_ins inv_bits;
CHECK_ERROR();
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- SLJIT_COMPILE_ASSERT((INT_SIZE ^ 0x100) == WORD_SIZE, must_be_one_bit_difference);
+ SLJIT_COMPILE_ASSERT((INT_SIZE ^ 0x1) == WORD_SIZE, must_be_one_bit_difference);
SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
inv_bits = (op & SLJIT_F32_OP) ? (1 << 22) : 0;
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (src & SLJIT_MEM) {
- emit_fop_mem(compiler, (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32) ? (mem_flags ^ 0x100) : mem_flags, dst_r, src, srcw);
+ emit_fop_mem(compiler, (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32) ? (mem_flags ^ 0x1) : mem_flags, dst_r, src, srcw);
src = dst_r;
}
@@ -1742,9 +1452,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
-
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (src1 & SLJIT_MEM) {
emit_fop_mem(compiler, mem_flags, TMP_FREG1, src1, src1w);
@@ -1785,15 +1492,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
- /* For UNUSED dst. Uncommon, but possible. */
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
return push_inst(compiler, ORR | RD(dst) | RN(TMP_ZERO) | RM(TMP_LR));
/* Memory. */
- return emit_op_mem(compiler, WORD_SIZE | STORE, TMP_LR, dst, dstw);
+ return emit_op_mem(compiler, WORD_SIZE | STORE, TMP_LR, dst, dstw, TMP_REG1);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
@@ -1804,10 +1507,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, ORR | RD(TMP_LR) | RN(TMP_ZERO) | RM(src)));
- else if (src & SLJIT_MEM)
- FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_LR, src, srcw));
- else if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, TMP_LR, srcw));
+ else
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_LR, src, srcw, TMP_REG1));
return push_inst(compiler, RET | RN(TMP_LR));
}
@@ -1866,7 +1567,7 @@ static sljit_uw get_cc(sljit_s32 type)
return 0x6;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return 0xe;
}
}
@@ -1913,6 +1614,20 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
return jump;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_jump(compiler, type);
+}
+
static SLJIT_INLINE struct sljit_jump* emit_cmp_to0(struct sljit_compiler *compiler, sljit_s32 type,
sljit_s32 src, sljit_sw srcw)
{
@@ -1928,13 +1643,14 @@ static SLJIT_INLINE struct sljit_jump* emit_cmp_to0(struct sljit_compiler *compi
jump->flags |= IS_CBZ | IS_COND;
if (src & SLJIT_MEM) {
- PTR_FAIL_IF(emit_op_mem(compiler, inv_bits ? INT_SIZE : WORD_SIZE, TMP_REG1, src, srcw));
+ PTR_FAIL_IF(emit_op_mem(compiler, inv_bits ? INT_SIZE : WORD_SIZE, TMP_REG1, src, srcw, TMP_REG1));
src = TMP_REG1;
}
else if (src & SLJIT_IMM) {
PTR_FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
src = TMP_REG1;
}
+
SLJIT_ASSERT(FAST_IS_REG(src));
if ((type & 0xff) == SLJIT_EQUAL)
@@ -1955,15 +1671,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
- /* In ARM, we don't need to touch the arguments. */
if (!(src & SLJIT_IMM)) {
if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, src, srcw));
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, src, srcw, TMP_REG1));
src = TMP_REG1;
}
return push_inst(compiler, ((type >= SLJIT_FAST_CALL) ? BLR : BR) | RN(src));
}
+ /* These jumps are converted to jump/call instructions when possible. */
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF(!jump);
set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0));
@@ -1974,54 +1690,170 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
return push_inst(compiler, ((type >= SLJIT_FAST_CALL) ? BLR : BR) | RN(TMP_REG1));
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_ijump(compiler, type, src, srcw);
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
- sljit_s32 dst_r, flags, mem_flags;
+ sljit_s32 dst_r, src_r, flags, mem_flags;
sljit_ins cc;
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- ADJUST_LOCAL_OFFSET(src, srcw);
-
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
cc = get_cc(type & 0xff);
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
if (GET_OPCODE(op) < SLJIT_ADD) {
FAIL_IF(push_inst(compiler, CSINC | (cc << 12) | RD(dst_r) | RN(TMP_ZERO) | RM(TMP_ZERO)));
- if (dst_r != TMP_REG1)
- return SLJIT_SUCCESS;
- return emit_op_mem(compiler, (GET_OPCODE(op) == SLJIT_MOV ? WORD_SIZE : INT_SIZE) | STORE, TMP_REG1, dst, dstw);
+
+ if (dst_r == TMP_REG1) {
+ mem_flags = (GET_OPCODE(op) == SLJIT_MOV ? WORD_SIZE : INT_SIZE) | STORE;
+ return emit_op_mem(compiler, mem_flags, TMP_REG1, dst, dstw, TMP_REG2);
+ }
+
+ return SLJIT_SUCCESS;
}
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+ flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
mem_flags = WORD_SIZE;
+
if (op & SLJIT_I32_OP) {
flags |= INT_OP;
mem_flags = INT_SIZE;
}
- if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, mem_flags, TMP_REG1, src, srcw, dst, dstw));
+ src_r = dst;
+
+ if (dst & SLJIT_MEM) {
+ FAIL_IF(emit_op_mem(compiler, mem_flags, TMP_REG1, dst, dstw, TMP_REG1));
+ src_r = TMP_REG1;
+ }
+
+ FAIL_IF(push_inst(compiler, CSINC | (cc << 12) | RD(TMP_REG2) | RN(TMP_ZERO) | RM(TMP_ZERO)));
+ emit_op_imm(compiler, flags | GET_OPCODE(op), dst_r, src_r, TMP_REG2);
+
+ if (dst & SLJIT_MEM)
+ return emit_op_mem(compiler, mem_flags | STORE, TMP_REG1, dst, dstw, TMP_REG2);
+ return SLJIT_SUCCESS;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_ins inv_bits = (dst_reg & SLJIT_I32_OP) ? (1 << 31) : 0;
+ sljit_ins cc;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
+
+ if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
+ if (dst_reg & SLJIT_I32_OP)
+ srcw = (sljit_s32)srcw;
+ FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
src = TMP_REG1;
srcw = 0;
- } else if (src & SLJIT_IMM)
- flags |= ARG1_IMM;
+ }
- FAIL_IF(push_inst(compiler, CSINC | (cc << 12) | RD(TMP_REG2) | RN(TMP_ZERO) | RM(TMP_ZERO)));
- emit_op_imm(compiler, flags | GET_OPCODE(op), dst_r, src, TMP_REG2);
+ cc = get_cc(type & 0xff);
+ dst_reg &= ~SLJIT_I32_OP;
+
+ return push_inst(compiler, (CSEL ^ inv_bits) | (cc << 12) | RD(dst_reg) | RN(dst_reg) | RM(src));
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ sljit_u32 sign = 0, inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw));
- if (dst_r != TMP_REG1)
+ if ((mem & OFFS_REG_MASK) || (memw > 255 && memw < -256))
+ return SLJIT_ERR_UNSUPPORTED;
+
+ if (type & SLJIT_MEM_SUPP)
return SLJIT_SUCCESS;
- return emit_op_mem2(compiler, mem_flags | STORE, TMP_REG1, dst, dstw, 0, 0);
+
+ switch (type & 0xff) {
+ case SLJIT_MOV:
+ case SLJIT_MOV_P:
+ inst = STURBI | (MEM_SIZE_SHIFT(WORD_SIZE) << 30) | 0x400;
+ break;
+ case SLJIT_MOV_S8:
+ sign = 1;
+ case SLJIT_MOV_U8:
+ inst = STURBI | (MEM_SIZE_SHIFT(BYTE_SIZE) << 30) | 0x400;
+ break;
+ case SLJIT_MOV_S16:
+ sign = 1;
+ case SLJIT_MOV_U16:
+ inst = STURBI | (MEM_SIZE_SHIFT(HALF_SIZE) << 30) | 0x400;
+ break;
+ case SLJIT_MOV_S32:
+ sign = 1;
+ case SLJIT_MOV_U32:
+ inst = STURBI | (MEM_SIZE_SHIFT(INT_SIZE) << 30) | 0x400;
+ break;
+ default:
+ SLJIT_UNREACHABLE();
+ inst = STURBI | (MEM_SIZE_SHIFT(WORD_SIZE) << 30) | 0x400;
+ break;
+ }
+
+ if (!(type & SLJIT_MEM_STORE))
+ inst |= sign ? 0x00800000 : 0x00400000;
+
+ if (type & SLJIT_MEM_PRE)
+ inst |= 0x800;
+
+ return push_inst(compiler, inst | RT(reg) | RN(mem & REG_MASK) | ((memw & 0x1ff) << 12));
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 freg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ sljit_u32 inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_fmem(compiler, type, freg, mem, memw));
+
+ if ((mem & OFFS_REG_MASK) || (memw > 255 && memw < -256))
+ return SLJIT_ERR_UNSUPPORTED;
+
+ if (type & SLJIT_MEM_SUPP)
+ return SLJIT_SUCCESS;
+
+ inst = STUR_FI | 0x80000400;
+
+ if (!(type & SLJIT_F32_OP))
+ inst |= 0x40000000;
+
+ if (!(type & SLJIT_MEM_STORE))
+ inst |= 0x00400000;
+
+ if (type & SLJIT_MEM_PRE)
+ inst |= 0x800;
+
+ return push_inst(compiler, inst | VT(freg) | RN(mem & REG_MASK) | ((memw & 0x1ff) << 12));
}
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
@@ -2037,11 +1869,11 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
PTR_FAIL_IF(emit_imm64_const(compiler, dst_r, init_value));
if (dst & SLJIT_MEM)
- PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw));
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2));
return const_;
}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c b/thirdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c
index 95afc5231f..75e7a38b5f 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -26,7 +26,11 @@
SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
{
- return "ARM-Thumb2" SLJIT_CPUINFO;
+#ifdef __SOFTFP__
+ return "ARM-Thumb2" SLJIT_CPUINFO " ABI:softfp";
+#else
+ return "ARM-Thumb2" SLJIT_CPUINFO " ABI:hardfp";
+#endif
}
/* Length of an instruction word. */
@@ -35,15 +39,18 @@ typedef sljit_u32 sljit_ins;
/* Last register + 1. */
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
-#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
-#define TMP_PC (SLJIT_NUMBER_OF_REGISTERS + 5)
+#define TMP_PC (SLJIT_NUMBER_OF_REGISTERS + 4)
-#define TMP_FREG1 (0)
-#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
/* See sljit_emit_enter and sljit_emit_op0 if you want to change them. */
-static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
- 0, 0, 1, 2, 12, 11, 10, 9, 8, 7, 6, 5, 13, 3, 4, 14, 15
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
+ 0, 0, 1, 2, 3, 11, 10, 9, 8, 7, 6, 5, 4, 13, 12, 14, 15
+};
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7
};
#define COPY_BITS(src, from, to, bits) \
@@ -70,9 +77,9 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define RN4(rn) (reg_map[rn] << 16)
#define RM4(rm) (reg_map[rm])
#define RT4(rt) (reg_map[rt] << 12)
-#define DD4(dd) ((dd) << 12)
-#define DN4(dn) ((dn) << 16)
-#define DM4(dm) (dm)
+#define DD4(dd) (freg_map[dd] << 12)
+#define DN4(dn) (freg_map[dn] << 16)
+#define DM4(dm) (freg_map[dm])
#define IMM5(imm) \
(COPY_BITS(imm, 2, 12, 3) | ((imm & 0x3) << 6))
#define IMM12(imm) \
@@ -108,7 +115,11 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define BLX 0x4780
#define BX 0x4700
#define CLZ 0xfab0f080
+#define CMNI_W 0xf1100f00
+#define CMP 0x4280
#define CMPI 0x2800
+#define CMPI_W 0xf1b00f00
+#define CMP_X 0x4500
#define CMP_W 0xebb00f00
#define EORI 0xf0800000
#define EORS 0x4040
@@ -175,6 +186,7 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define VDIV_F32 0xee800a00
#define VMOV_F32 0xeeb00a40
#define VMOV 0xee000a10
+#define VMOV2 0xec400a10
#define VMRS 0xeef1fa10
#define VMUL_F32 0xee200a00
#define VNEG_F32 0xeeb10a40
@@ -205,10 +217,10 @@ static sljit_s32 push_inst32(struct sljit_compiler *compiler, sljit_ins inst)
static SLJIT_INLINE sljit_s32 emit_imm32_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_uw imm)
{
- FAIL_IF(push_inst32(compiler, MOVW | RD4(dst) |
- COPY_BITS(imm, 12, 16, 4) | COPY_BITS(imm, 11, 26, 1) | COPY_BITS(imm, 8, 12, 3) | (imm & 0xff)));
- return push_inst32(compiler, MOVT | RD4(dst) |
- COPY_BITS(imm, 12 + 16, 16, 4) | COPY_BITS(imm, 11 + 16, 26, 1) | COPY_BITS(imm, 8 + 16, 12, 3) | ((imm & 0xff0000) >> 16));
+ FAIL_IF(push_inst32(compiler, MOVW | RD4(dst)
+ | COPY_BITS(imm, 12, 16, 4) | COPY_BITS(imm, 11, 26, 1) | COPY_BITS(imm, 8, 12, 3) | (imm & 0xff)));
+ return push_inst32(compiler, MOVT | RD4(dst)
+ | COPY_BITS(imm, 12 + 16, 16, 4) | COPY_BITS(imm, 11 + 16, 26, 1) | COPY_BITS(imm, 8 + 16, 12, 3) | ((imm & 0xff0000) >> 16));
}
static SLJIT_INLINE void modify_imm32_const(sljit_u16 *inst, sljit_uw new_imm)
@@ -338,7 +350,7 @@ static SLJIT_INLINE void set_jump_instruction(struct sljit_jump *jump, sljit_sw
else if (type == 6) /* Encoding T1 of 'BL' instruction */
jump_inst[1] |= 0xd000;
else
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
@@ -430,6 +442,26 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
return (void*)((sljit_uw)code | 0x1);
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#else
+ /* Available by default. */
+ return 1;
+#endif
+
+ case SLJIT_HAS_CLZ:
+ case SLJIT_HAS_CMOV:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Core code generator functions. */
/* --------------------------------------------------------------------- */
@@ -498,36 +530,32 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst,
}
/* set low 16 bits, set hi 16 bits to 0. */
- FAIL_IF(push_inst32(compiler, MOVW | RD4(dst) |
- COPY_BITS(imm, 12, 16, 4) | COPY_BITS(imm, 11, 26, 1) | COPY_BITS(imm, 8, 12, 3) | (imm & 0xff)));
+ FAIL_IF(push_inst32(compiler, MOVW | RD4(dst)
+ | COPY_BITS(imm, 12, 16, 4) | COPY_BITS(imm, 11, 26, 1) | COPY_BITS(imm, 8, 12, 3) | (imm & 0xff)));
/* set hi 16 bit if needed. */
if (imm >= 0x10000)
- return push_inst32(compiler, MOVT | RD4(dst) |
- COPY_BITS(imm, 12 + 16, 16, 4) | COPY_BITS(imm, 11 + 16, 26, 1) | COPY_BITS(imm, 8 + 16, 12, 3) | ((imm & 0xff0000) >> 16));
+ return push_inst32(compiler, MOVT | RD4(dst)
+ | COPY_BITS(imm, 12 + 16, 16, 4) | COPY_BITS(imm, 11 + 16, 26, 1) | COPY_BITS(imm, 8 + 16, 12, 3) | ((imm & 0xff0000) >> 16));
return SLJIT_SUCCESS;
}
#define ARG1_IMM 0x0010000
#define ARG2_IMM 0x0020000
-#define KEEP_FLAGS 0x0040000
/* SET_FLAGS must be 0x100000 as it is also the value of S bit (can be used for optimization). */
#define SET_FLAGS 0x0100000
#define UNUSED_RETURN 0x0200000
-#define SLOW_DEST 0x0400000
-#define SLOW_SRC1 0x0800000
-#define SLOW_SRC2 0x1000000
static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 dst, sljit_uw arg1, sljit_uw arg2)
{
/* dst must be register, TMP_REG1
- arg1 must be register, TMP_REG1, imm
- arg2 must be register, TMP_REG2, imm */
+ arg1 must be register, imm
+ arg2 must be register, imm */
sljit_s32 reg;
sljit_uw imm, nimm;
if (SLJIT_UNLIKELY((flags & (ARG1_IMM | ARG2_IMM)) == (ARG1_IMM | ARG2_IMM))) {
- /* Both are immediates. */
+ /* Both are immediates, no temporaries are used. */
flags &= ~ARG1_IMM;
FAIL_IF(load_immediate(compiler, TMP_REG1, arg1));
arg1 = TMP_REG1;
@@ -543,7 +571,7 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
/* No form with immediate operand. */
break;
case SLJIT_MOV:
- SLJIT_ASSERT(!(flags & SET_FLAGS) && (flags & ARG2_IMM) && arg1 == TMP_REG1);
+ SLJIT_ASSERT(!(flags & SET_FLAGS) && (flags & ARG2_IMM) && arg1 == TMP_REG2);
return load_immediate(compiler, dst, imm);
case SLJIT_NOT:
if (!(flags & SET_FLAGS))
@@ -553,7 +581,7 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
break;
case SLJIT_ADD:
nimm = -imm;
- if (!(flags & KEEP_FLAGS) && IS_2_LO_REGS(reg, dst)) {
+ if (IS_2_LO_REGS(reg, dst)) {
if (imm <= 0x7)
return push_inst16(compiler, ADDSI3 | IMM3(imm) | RD3(dst) | RN3(reg));
if (nimm <= 0x7)
@@ -571,9 +599,12 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
if (nimm <= 0xfff)
return push_inst32(compiler, SUBWI | RD4(dst) | RN4(reg) | IMM12(nimm));
}
- imm = get_imm(imm);
- if (imm != INVALID_IMM)
- return push_inst32(compiler, ADD_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | imm);
+ nimm = get_imm(imm);
+ if (nimm != INVALID_IMM)
+ return push_inst32(compiler, ADD_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | nimm);
+ nimm = get_imm(-imm);
+ if (nimm != INVALID_IMM)
+ return push_inst32(compiler, SUB_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | nimm);
break;
case SLJIT_ADDC:
imm = get_imm(imm);
@@ -581,16 +612,27 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
return push_inst32(compiler, ADCI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | imm);
break;
case SLJIT_SUB:
+ /* SUB operation can be replaced by ADD because of the negative carry flag. */
if (flags & ARG1_IMM) {
- if (!(flags & KEEP_FLAGS) && imm == 0 && IS_2_LO_REGS(reg, dst))
+ if (imm == 0 && IS_2_LO_REGS(reg, dst))
return push_inst16(compiler, RSBSI | RD3(dst) | RN3(reg));
imm = get_imm(imm);
if (imm != INVALID_IMM)
return push_inst32(compiler, RSB_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | imm);
break;
}
+ if (flags & UNUSED_RETURN) {
+ if (imm <= 0xff && reg_map[reg] <= 7)
+ return push_inst16(compiler, CMPI | IMM8(imm) | RDN3(reg));
+ nimm = get_imm(imm);
+ if (nimm != INVALID_IMM)
+ return push_inst32(compiler, CMPI_W | RN4(reg) | nimm);
+ nimm = get_imm(-imm);
+ if (nimm != INVALID_IMM)
+ return push_inst32(compiler, CMNI_W | RN4(reg) | nimm);
+ }
nimm = -imm;
- if (!(flags & KEEP_FLAGS) && IS_2_LO_REGS(reg, dst)) {
+ if (IS_2_LO_REGS(reg, dst)) {
if (imm <= 0x7)
return push_inst16(compiler, SUBSI3 | IMM3(imm) | RD3(dst) | RN3(reg));
if (nimm <= 0x7)
@@ -601,8 +643,6 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
if (nimm <= 0xff)
return push_inst16(compiler, ADDSI8 | IMM8(nimm) | RDN3(dst));
}
- if (imm <= 0xff && (flags & UNUSED_RETURN))
- return push_inst16(compiler, CMPI | IMM8(imm) | RDN3(reg));
}
if (!(flags & SET_FLAGS)) {
if (imm <= 0xfff)
@@ -610,9 +650,12 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
if (nimm <= 0xfff)
return push_inst32(compiler, ADDWI | RD4(dst) | RN4(reg) | IMM12(nimm));
}
- imm = get_imm(imm);
- if (imm != INVALID_IMM)
- return push_inst32(compiler, SUB_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | imm);
+ nimm = get_imm(imm);
+ if (nimm != INVALID_IMM)
+ return push_inst32(compiler, SUB_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | nimm);
+ nimm = get_imm(-imm);
+ if (nimm != INVALID_IMM)
+ return push_inst32(compiler, ADD_WI | (flags & SET_FLAGS) | RD4(dst) | RN4(reg) | nimm);
break;
case SLJIT_SUBC:
if (flags & ARG1_IMM)
@@ -657,31 +700,35 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
}
switch (flags & 0xffff) {
case SLJIT_SHL:
- if (!(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, reg))
+ if (IS_2_LO_REGS(dst, reg))
return push_inst16(compiler, LSLSI | RD3(dst) | RN3(reg) | (imm << 6));
return push_inst32(compiler, LSL_WI | (flags & SET_FLAGS) | RD4(dst) | RM4(reg) | IMM5(imm));
case SLJIT_LSHR:
- if (!(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, reg))
+ if (IS_2_LO_REGS(dst, reg))
return push_inst16(compiler, LSRSI | RD3(dst) | RN3(reg) | (imm << 6));
return push_inst32(compiler, LSR_WI | (flags & SET_FLAGS) | RD4(dst) | RM4(reg) | IMM5(imm));
default: /* SLJIT_ASHR */
- if (!(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, reg))
+ if (IS_2_LO_REGS(dst, reg))
return push_inst16(compiler, ASRSI | RD3(dst) | RN3(reg) | (imm << 6));
return push_inst32(compiler, ASR_WI | (flags & SET_FLAGS) | RD4(dst) | RM4(reg) | IMM5(imm));
}
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
if (flags & ARG2_IMM) {
- FAIL_IF(load_immediate(compiler, TMP_REG2, arg2));
- arg2 = TMP_REG2;
+ imm = arg2;
+ arg2 = (arg1 == TMP_REG1) ? TMP_REG2 : TMP_REG1;
+ FAIL_IF(load_immediate(compiler, arg2, imm));
}
else {
- FAIL_IF(load_immediate(compiler, TMP_REG1, arg1));
- arg1 = TMP_REG1;
+ imm = arg1;
+ arg1 = (arg2 == TMP_REG1) ? TMP_REG2 : TMP_REG1;
+ FAIL_IF(load_immediate(compiler, arg1, imm));
}
+
+ SLJIT_ASSERT(arg1 != arg2);
}
/* Both arguments are registers. */
@@ -690,108 +737,98 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
case SLJIT_MOV_U32:
case SLJIT_MOV_S32:
case SLJIT_MOV_P:
- case SLJIT_MOVU:
- case SLJIT_MOVU_U32:
- case SLJIT_MOVU_S32:
- case SLJIT_MOVU_P:
- SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
+ SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG2);
if (dst == arg2)
return SLJIT_SUCCESS;
return push_inst16(compiler, MOV | SET_REGS44(dst, arg2));
case SLJIT_MOV_U8:
- case SLJIT_MOVU_U8:
- SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
+ SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG2);
if (IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, UXTB | RD3(dst) | RN3(arg2));
return push_inst32(compiler, UXTB_W | RD4(dst) | RM4(arg2));
case SLJIT_MOV_S8:
- case SLJIT_MOVU_S8:
- SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
+ SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG2);
if (IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, SXTB | RD3(dst) | RN3(arg2));
return push_inst32(compiler, SXTB_W | RD4(dst) | RM4(arg2));
case SLJIT_MOV_U16:
- case SLJIT_MOVU_U16:
- SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
+ SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG2);
if (IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, UXTH | RD3(dst) | RN3(arg2));
return push_inst32(compiler, UXTH_W | RD4(dst) | RM4(arg2));
case SLJIT_MOV_S16:
- case SLJIT_MOVU_S16:
- SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG1);
+ SLJIT_ASSERT(!(flags & SET_FLAGS) && arg1 == TMP_REG2);
if (IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, SXTH | RD3(dst) | RN3(arg2));
return push_inst32(compiler, SXTH_W | RD4(dst) | RM4(arg2));
case SLJIT_NOT:
- SLJIT_ASSERT(arg1 == TMP_REG1);
- if (!(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ SLJIT_ASSERT(arg1 == TMP_REG2);
+ if (IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, MVNS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, MVN_W | (flags & SET_FLAGS) | RD4(dst) | RM4(arg2));
case SLJIT_CLZ:
- SLJIT_ASSERT(arg1 == TMP_REG1);
+ SLJIT_ASSERT(arg1 == TMP_REG2);
FAIL_IF(push_inst32(compiler, CLZ | RN4(arg2) | RD4(dst) | RM4(arg2)));
- if (flags & SET_FLAGS) {
- if (reg_map[dst] <= 7)
- return push_inst16(compiler, CMPI | RDN3(dst));
- return push_inst32(compiler, ADD_WI | SET_FLAGS | RN4(dst) | RD4(dst));
- }
return SLJIT_SUCCESS;
case SLJIT_ADD:
- if (!(flags & KEEP_FLAGS) && IS_3_LO_REGS(dst, arg1, arg2))
+ if (IS_3_LO_REGS(dst, arg1, arg2))
return push_inst16(compiler, ADDS | RD3(dst) | RN3(arg1) | RM3(arg2));
if (dst == arg1 && !(flags & SET_FLAGS))
return push_inst16(compiler, ADD | SET_REGS44(dst, arg2));
return push_inst32(compiler, ADD_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_ADDC:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, ADCS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, ADC_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_SUB:
- if (!(flags & KEEP_FLAGS) && IS_3_LO_REGS(dst, arg1, arg2))
+ if (flags & UNUSED_RETURN) {
+ if (IS_2_LO_REGS(arg1, arg2))
+ return push_inst16(compiler, CMP | RD3(arg1) | RN3(arg2));
+ return push_inst16(compiler, CMP_X | SET_REGS44(arg1, arg2));
+ }
+ if (IS_3_LO_REGS(dst, arg1, arg2))
return push_inst16(compiler, SUBS | RD3(dst) | RN3(arg1) | RM3(arg2));
return push_inst32(compiler, SUB_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_SUBC:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, SBCS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, SBC_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_MUL:
if (!(flags & SET_FLAGS))
return push_inst32(compiler, MUL | RD4(dst) | RN4(arg1) | RM4(arg2));
- SLJIT_ASSERT(reg_map[TMP_REG2] <= 7 && dst != TMP_REG2);
+ SLJIT_ASSERT(dst != TMP_REG2);
FAIL_IF(push_inst32(compiler, SMULL | RT4(dst) | RD4(TMP_REG2) | RN4(arg1) | RM4(arg2)));
/* cmp TMP_REG2, dst asr #31. */
return push_inst32(compiler, CMP_W | RN4(TMP_REG2) | 0x70e0 | RM4(dst));
case SLJIT_AND:
- if (!(flags & KEEP_FLAGS)) {
- if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
- return push_inst16(compiler, ANDS | RD3(dst) | RN3(arg2));
- if ((flags & UNUSED_RETURN) && IS_2_LO_REGS(arg1, arg2))
- return push_inst16(compiler, TST | RD3(arg1) | RN3(arg2));
- }
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
+ return push_inst16(compiler, ANDS | RD3(dst) | RN3(arg2));
+ if ((flags & UNUSED_RETURN) && IS_2_LO_REGS(arg1, arg2))
+ return push_inst16(compiler, TST | RD3(arg1) | RN3(arg2));
return push_inst32(compiler, AND_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_OR:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, ORRS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, ORR_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_XOR:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, EORS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, EOR_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_SHL:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, LSLS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, LSL_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_LSHR:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, LSRS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, LSR_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
case SLJIT_ASHR:
- if (dst == arg1 && !(flags & KEEP_FLAGS) && IS_2_LO_REGS(dst, arg2))
+ if (dst == arg1 && IS_2_LO_REGS(dst, arg2))
return push_inst16(compiler, ASRS | RD3(dst) | RN3(arg2));
return push_inst32(compiler, ASR_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
}
@@ -801,9 +838,7 @@ static sljit_s32 emit_op_imm(struct sljit_compiler *compiler, sljit_s32 flags, s
#define WORD_SIZE 0x00
#define BYTE_SIZE 0x04
#define HALF_SIZE 0x08
-
-#define UPDATE 0x10
-#define ARG_TEST 0x20
+#define PRELOAD 0x0c
#define IS_WORD_SIZE(flags) (!(flags & (BYTE_SIZE | HALF_SIZE)))
#define OFFSET_CHECK(imm, shift) (!(argw & ~(imm << shift)))
@@ -859,7 +894,7 @@ static const sljit_ins sljit_mem16_imm5[12] = {
#define MEM_IMM8 0xc00
#define MEM_IMM12 0x800000
-static const sljit_ins sljit_mem32[12] = {
+static const sljit_ins sljit_mem32[13] = {
/* w u l */ 0xf8500000 /* ldr.w */,
/* w u s */ 0xf8400000 /* str.w */,
/* w s l */ 0xf8500000 /* ldr.w */,
@@ -874,6 +909,8 @@ static const sljit_ins sljit_mem32[12] = {
/* h u s */ 0xf8200000 /* strsh.w */,
/* h s l */ 0xf9300000 /* ldrsh.w */,
/* h s s */ 0xf8200000 /* strsh.w */,
+
+/* p u l */ 0xf8100000 /* pld */,
};
/* Helper function. Dst should be reg + value, using at most 1 instruction, flags does not set. */
@@ -897,240 +934,92 @@ static sljit_s32 emit_set_delta(struct sljit_compiler *compiler, sljit_s32 dst,
return SLJIT_ERR_UNSUPPORTED;
}
-/* Can perform an operation using at most 1 instruction. */
-static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
+ sljit_s32 arg, sljit_sw argw, sljit_s32 tmp_reg)
{
- sljit_s32 other_r, shift;
+ sljit_s32 other_r;
+ sljit_uw tmp;
SLJIT_ASSERT(arg & SLJIT_MEM);
-
- if (SLJIT_UNLIKELY(flags & UPDATE)) {
- if ((arg & REG_MASK) && !(arg & OFFS_REG_MASK) && argw <= 0xff && argw >= -0xff) {
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
-
- flags &= ~UPDATE;
- arg &= 0xf;
- if (argw >= 0)
- argw |= 0x200;
- else {
- argw = -argw;
- }
-
- SLJIT_ASSERT(argw >= 0 && (argw & 0xff) <= 0xff);
- FAIL_IF(push_inst32(compiler, sljit_mem32[flags] | MEM_IMM8 | RT4(reg) | RN4(arg) | 0x100 | argw));
- return -1;
+ SLJIT_ASSERT((arg & REG_MASK) != tmp_reg);
+ arg &= ~SLJIT_MEM;
+
+ if (SLJIT_UNLIKELY(!(arg & REG_MASK))) {
+ tmp = get_imm(argw & ~0xfff);
+ if (tmp != INVALID_IMM) {
+ FAIL_IF(push_inst32(compiler, MOV_WI | RD4(tmp_reg) | tmp));
+ return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(tmp_reg) | (argw & 0xfff));
}
- return 0;
+
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw));
+ if (IS_2_LO_REGS(reg, tmp_reg) && sljit_mem16_imm5[flags])
+ return push_inst16(compiler, sljit_mem16_imm5[flags] | RD3(reg) | RN3(tmp_reg));
+ return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(tmp_reg));
}
if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
-
argw &= 0x3;
other_r = OFFS_REG(arg);
arg &= 0xf;
if (!argw && IS_3_LO_REGS(reg, arg, other_r))
- FAIL_IF(push_inst16(compiler, sljit_mem16[flags] | RD3(reg) | RN3(arg) | RM3(other_r)));
- else
- FAIL_IF(push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(other_r) | (argw << 4)));
- return -1;
+ return push_inst16(compiler, sljit_mem16[flags] | RD3(reg) | RN3(arg) | RM3(other_r));
+ return push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(other_r) | (argw << 4));
}
- if (!(arg & REG_MASK) || argw > 0xfff || argw < -0xff)
- return 0;
-
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
+ if (argw > 0xfff) {
+ tmp = get_imm(argw & ~0xfff);
+ if (tmp != INVALID_IMM) {
+ push_inst32(compiler, ADD_WI | RD4(tmp_reg) | RN4(arg) | tmp);
+ arg = tmp_reg;
+ argw = argw & 0xfff;
+ }
+ }
+ else if (argw < -0xff) {
+ tmp = get_imm(-argw & ~0xff);
+ if (tmp != INVALID_IMM) {
+ push_inst32(compiler, SUB_WI | RD4(tmp_reg) | RN4(arg) | tmp);
+ arg = tmp_reg;
+ argw = -(-argw & 0xff);
+ }
+ }
- arg &= 0xf;
if (IS_2_LO_REGS(reg, arg) && sljit_mem16_imm5[flags]) {
- shift = 3;
+ tmp = 3;
if (IS_WORD_SIZE(flags)) {
if (OFFSET_CHECK(0x1f, 2))
- shift = 2;
+ tmp = 2;
}
else if (flags & BYTE_SIZE)
{
if (OFFSET_CHECK(0x1f, 0))
- shift = 0;
+ tmp = 0;
}
else {
SLJIT_ASSERT(flags & HALF_SIZE);
if (OFFSET_CHECK(0x1f, 1))
- shift = 1;
+ tmp = 1;
}
- if (shift != 3) {
- FAIL_IF(push_inst16(compiler, sljit_mem16_imm5[flags] | RD3(reg) | RN3(arg) | (argw << (6 - shift))));
- return -1;
- }
- }
-
- /* SP based immediate. */
- if (SLJIT_UNLIKELY(arg == SLJIT_SP) && OFFSET_CHECK(0xff, 2) && IS_WORD_SIZE(flags) && reg_map[reg] <= 7) {
- FAIL_IF(push_inst16(compiler, STR_SP | ((flags & STORE) ? 0 : 0x800) | RDN3(reg) | (argw >> 2)));
- return -1;
+ if (tmp < 3)
+ return push_inst16(compiler, sljit_mem16_imm5[flags] | RD3(reg) | RN3(arg) | (argw << (6 - tmp)));
}
-
- if (argw >= 0)
- FAIL_IF(push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(arg) | argw));
- else
- FAIL_IF(push_inst32(compiler, sljit_mem32[flags] | MEM_IMM8 | RT4(reg) | RN4(arg) | -argw));
- return -1;
-}
-
-/* see getput_arg below.
- Note: can_cache is called only for binary operators. Those
- operators always uses word arguments without write back. */
-static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_sw diff;
- if ((arg & OFFS_REG_MASK) || !(next_arg & SLJIT_MEM))
- return 0;
-
- if (!(arg & REG_MASK)) {
- diff = argw - next_argw;
- if (diff <= 0xfff && diff >= -0xfff)
- return 1;
- return 0;
+ else if (SLJIT_UNLIKELY(arg == SLJIT_SP) && IS_WORD_SIZE(flags) && OFFSET_CHECK(0xff, 2) && reg_map[reg] <= 7) {
+ /* SP based immediate. */
+ return push_inst16(compiler, STR_SP | ((flags & STORE) ? 0 : 0x800) | RDN3(reg) | (argw >> 2));
}
- if (argw == next_argw)
- return 1;
+ if (argw >= 0 && argw <= 0xfff)
+ return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(arg) | argw);
+ else if (argw < 0 && argw >= -0xff)
+ return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM8 | RT4(reg) | RN4(arg) | -argw);
- diff = argw - next_argw;
- if (arg == next_arg && diff <= 0xfff && diff >= -0xfff)
- return 1;
+ SLJIT_ASSERT(arg != tmp_reg);
- return 0;
-}
-
-/* Emit the necessary instructions. See can_cache above. */
-static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg,
- sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_s32 tmp_r, other_r;
- sljit_sw diff;
-
- SLJIT_ASSERT(arg & SLJIT_MEM);
- if (!(next_arg & SLJIT_MEM)) {
- next_arg = 0;
- next_argw = 0;
- }
-
- tmp_r = (flags & STORE) ? TMP_REG3 : reg;
-
- if (SLJIT_UNLIKELY((flags & UPDATE) && (arg & REG_MASK))) {
- /* Update only applies if a base register exists. */
- /* There is no caching here. */
- other_r = OFFS_REG(arg);
- arg &= 0xf;
- flags &= ~UPDATE;
-
- if (!other_r) {
- if (!(argw & ~0xfff)) {
- FAIL_IF(push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(arg) | argw));
- return push_inst32(compiler, ADDWI | RD4(arg) | RN4(arg) | IMM12(argw));
- }
-
- if (compiler->cache_arg == SLJIT_MEM) {
- if (argw == compiler->cache_argw) {
- other_r = TMP_REG3;
- argw = 0;
- }
- else if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, argw - compiler->cache_argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- other_r = TMP_REG3;
- argw = 0;
- }
- }
-
- if (argw) {
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
- compiler->cache_arg = SLJIT_MEM;
- compiler->cache_argw = argw;
- other_r = TMP_REG3;
- argw = 0;
- }
- }
-
- argw &= 0x3;
- if (!argw && IS_3_LO_REGS(reg, arg, other_r)) {
- FAIL_IF(push_inst16(compiler, sljit_mem16[flags] | RD3(reg) | RN3(arg) | RM3(other_r)));
- return push_inst16(compiler, ADD | SET_REGS44(arg, other_r));
- }
- FAIL_IF(push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(other_r) | (argw << 4)));
- return push_inst32(compiler, ADD_W | RD4(arg) | RN4(arg) | RM4(other_r) | (argw << 6));
- }
- flags &= ~UPDATE;
-
- SLJIT_ASSERT(!(arg & OFFS_REG_MASK));
-
- if (compiler->cache_arg == arg) {
- diff = argw - compiler->cache_argw;
- if (!(diff & ~0xfff))
- return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(TMP_REG3) | diff);
- if (!((compiler->cache_argw - argw) & ~0xff))
- return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM8 | RT4(reg) | RN4(TMP_REG3) | (compiler->cache_argw - argw));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, diff) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(TMP_REG3) | 0);
- }
- }
-
- next_arg = (arg & REG_MASK) && (arg == next_arg) && (argw != next_argw);
- arg &= 0xf;
- if (arg && compiler->cache_arg == SLJIT_MEM) {
- if (compiler->cache_argw == argw)
- return push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(TMP_REG3));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, argw - compiler->cache_argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- return push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(TMP_REG3));
- }
- }
-
- compiler->cache_argw = argw;
- if (next_arg && emit_set_delta(compiler, TMP_REG3, arg, argw) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_arg = SLJIT_MEM | arg;
- arg = 0;
- }
- else {
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
- compiler->cache_arg = SLJIT_MEM;
-
- diff = argw - next_argw;
- if (next_arg && diff <= 0xfff && diff >= -0xfff) {
- FAIL_IF(push_inst16(compiler, ADD | SET_REGS44(TMP_REG3, arg)));
- compiler->cache_arg = SLJIT_MEM | arg;
- arg = 0;
- }
- }
-
- if (arg)
- return push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(TMP_REG3));
- return push_inst32(compiler, sljit_mem32[flags] | MEM_IMM12 | RT4(reg) | RN4(TMP_REG3) | 0);
-}
-
-static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
-{
- if (getput_arg_fast(compiler, flags, reg, arg, argw))
- return compiler->error;
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- return getput_arg(compiler, flags, reg, arg, argw, 0, 0);
-}
-
-static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
-{
- if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
- return compiler->error;
- return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw));
+ if (IS_3_LO_REGS(reg, arg, tmp_reg))
+ return push_inst16(compiler, sljit_mem16[flags] | RD3(reg) | RN3(arg) | RM3(tmp_reg));
+ return push_inst32(compiler, sljit_mem32[flags] | RT4(reg) | RN4(arg) | RM4(tmp_reg));
}
/* --------------------------------------------------------------------- */
@@ -1138,17 +1027,15 @@ static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, slji
/* --------------------------------------------------------------------- */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- sljit_s32 size, i, tmp;
- sljit_ins push;
+ sljit_s32 args, size, i, tmp;
+ sljit_ins push = 0;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
-
- push = (1 << 4);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
for (i = SLJIT_S0; i >= tmp; i--)
@@ -1162,7 +1049,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
: push_inst16(compiler, PUSH | (1 << 8) | push));
/* Stack must be aligned to 8 bytes: (LR, R4) */
- size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 2);
+ size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
local_size = ((size + local_size + 7) & ~7) - size;
compiler->local_size = local_size;
if (local_size > 0) {
@@ -1172,6 +1059,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
FAIL_IF(emit_op_imm(compiler, SLJIT_SUB | ARG2_IMM, SLJIT_SP, SLJIT_SP, local_size));
}
+ args = get_arg_count(arg_types);
+
if (args >= 1)
FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(SLJIT_S0, SLJIT_R0)));
if (args >= 2)
@@ -1183,16 +1072,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
sljit_s32 size;
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
- size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 2);
+ size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
compiler->local_size = ((size + local_size + 7) & ~7) - size;
return SLJIT_SUCCESS;
}
@@ -1200,7 +1089,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *comp
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
{
sljit_s32 i, tmp;
- sljit_ins pop;
+ sljit_ins pop = 0;
CHECK_ERROR();
CHECK(check_sljit_emit_return(compiler, op, src, srcw));
@@ -1214,8 +1103,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
FAIL_IF(emit_op_imm(compiler, SLJIT_ADD | ARG2_IMM, SLJIT_SP, SLJIT_SP, compiler->local_size));
}
- pop = (1 << 4);
-
tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJIT_FIRST_SAVED_REG;
for (i = SLJIT_S0; i >= tmp; i--)
pop |= 1 << reg_map[i];
@@ -1273,11 +1160,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
case SLJIT_DIV_UW:
case SLJIT_DIV_SW:
SLJIT_COMPILE_ASSERT((SLJIT_DIVMOD_UW & 0x2) == 0 && SLJIT_DIV_UW - 0x2 == SLJIT_DIVMOD_UW, bad_div_opcode_assignments);
- SLJIT_COMPILE_ASSERT(reg_map[2] == 1 && reg_map[3] == 2 && reg_map[4] == 12, bad_register_mapping);
+ SLJIT_ASSERT(reg_map[2] == 1 && reg_map[3] == 2 && reg_map[4] == 3);
saved_reg_count = 0;
if (compiler->scratches >= 4)
- saved_reg_list[saved_reg_count++] = 12;
+ saved_reg_list[saved_reg_count++] = 3;
if (compiler->scratches >= 3)
saved_reg_list[saved_reg_count++] = 2;
if (op >= SLJIT_DIV_UW)
@@ -1333,13 +1220,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op)) {
+ /* Since TMP_PC has index 15, IS_2_LO_REGS and IS_3_LO_REGS checks always fail. */
+ if (op <= SLJIT_MOV_P && (src & SLJIT_MEM))
+ return emit_op_mem(compiler, PRELOAD, TMP_PC, src, srcw, TMP_REG1);
+ return SLJIT_SUCCESS;
+ }
dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
op = GET_OPCODE(op);
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_P) {
+ if (op >= SLJIT_MOV && op <= SLJIT_MOV_P) {
switch (op) {
case SLJIT_MOV:
case SLJIT_MOV_U32:
@@ -1367,58 +1258,26 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
if (src & SLJIT_IMM)
srcw = (sljit_s16)srcw;
break;
- case SLJIT_MOVU:
- case SLJIT_MOVU_U32:
- case SLJIT_MOVU_S32:
- case SLJIT_MOVU_P:
- flags = WORD_SIZE | UPDATE;
- break;
- case SLJIT_MOVU_U8:
- flags = BYTE_SIZE | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_u8)srcw;
- break;
- case SLJIT_MOVU_S8:
- flags = BYTE_SIZE | SIGNED | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_s8)srcw;
- break;
- case SLJIT_MOVU_U16:
- flags = HALF_SIZE | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_u16)srcw;
- break;
- case SLJIT_MOVU_S16:
- flags = HALF_SIZE | SIGNED | UPDATE;
- if (src & SLJIT_IMM)
- srcw = (sljit_s16)srcw;
- break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
flags = 0;
break;
}
if (src & SLJIT_IMM)
- FAIL_IF(emit_op_imm(compiler, SLJIT_MOV | ARG2_IMM, dst_r, TMP_REG1, srcw));
+ FAIL_IF(emit_op_imm(compiler, SLJIT_MOV | ARG2_IMM, dst_r, TMP_REG2, srcw));
else if (src & SLJIT_MEM) {
- if (getput_arg_fast(compiler, flags, dst_r, src, srcw))
- FAIL_IF(compiler->error);
- else
- FAIL_IF(getput_arg(compiler, flags, dst_r, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem(compiler, flags, dst_r, src, srcw, TMP_REG1));
} else {
if (dst_r != TMP_REG1)
- return emit_op_imm(compiler, op, dst_r, TMP_REG1, src);
+ return emit_op_imm(compiler, op, dst_r, TMP_REG2, src);
dst_r = src;
}
- if (dst & SLJIT_MEM) {
- if (getput_arg_fast(compiler, flags | STORE, dst_r, dst, dstw))
- return compiler->error;
- else
- return getput_arg(compiler, flags | STORE, dst_r, dst, dstw, 0, 0);
- }
- return SLJIT_SUCCESS;
+ if (!(dst & SLJIT_MEM))
+ return SLJIT_SUCCESS;
+
+ return emit_op_mem(compiler, flags | STORE, dst_r, dst, dstw, TMP_REG2);
}
if (op == SLJIT_NEG) {
@@ -1429,28 +1288,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
return sljit_emit_op2(compiler, SLJIT_SUB | op_flags, dst, dstw, SLJIT_IMM, 0, src, srcw);
}
- flags = (GET_FLAGS(op_flags) ? SET_FLAGS : 0) | ((op_flags & SLJIT_KEEP_FLAGS) ? KEEP_FLAGS : 0);
+ flags = HAS_FLAGS(op_flags) ? SET_FLAGS : 0;
+
if (src & SLJIT_MEM) {
- if (getput_arg_fast(compiler, WORD_SIZE, TMP_REG2, src, srcw))
- FAIL_IF(compiler->error);
- else
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG2, src, srcw, dst, dstw));
- src = TMP_REG2;
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, src, srcw, TMP_REG1));
+ src = TMP_REG1;
}
- if (src & SLJIT_IMM)
- flags |= ARG2_IMM;
- else
- srcw = src;
-
- emit_op_imm(compiler, flags | op, dst_r, TMP_REG1, srcw);
+ emit_op_imm(compiler, flags | op, dst_r, TMP_REG2, src);
- if (dst & SLJIT_MEM) {
- if (getput_arg_fast(compiler, flags | STORE, dst_r, dst, dstw))
- return compiler->error;
- else
- return getput_arg(compiler, flags | STORE, dst_r, dst, dstw, 0, 0);
- }
+ if (SLJIT_UNLIKELY(dst & SLJIT_MEM))
+ return emit_op_mem(compiler, flags | STORE, dst_r, dst, dstw, TMP_REG2);
return SLJIT_SUCCESS;
}
@@ -1459,7 +1307,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- sljit_s32 dst_r, flags;
+ sljit_s32 dst_reg, flags, src2_reg;
CHECK_ERROR();
CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1467,70 +1315,39 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
-
- dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
- flags = (GET_FLAGS(op) ? SET_FLAGS : 0) | ((op & SLJIT_KEEP_FLAGS) ? KEEP_FLAGS : 0);
-
- if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, WORD_SIZE | STORE | ARG_TEST, TMP_REG1, dst, dstw))
- flags |= SLOW_DEST;
-
- if (src1 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, WORD_SIZE, TMP_REG1, src1, src1w))
- FAIL_IF(compiler->error);
- else
- flags |= SLOW_SRC1;
- }
- if (src2 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, WORD_SIZE, TMP_REG2, src2, src2w))
- FAIL_IF(compiler->error);
- else
- flags |= SLOW_SRC2;
- }
-
- if ((flags & (SLOW_SRC1 | SLOW_SRC2)) == (SLOW_SRC1 | SLOW_SRC2)) {
- if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG2, src2, src2w, src1, src1w));
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG1, src1, src1w, dst, dstw));
- }
- else {
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG1, src1, src1w, src2, src2w));
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG2, src2, src2w, dst, dstw));
- }
- }
- else if (flags & SLOW_SRC1)
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG1, src1, src1w, dst, dstw));
- else if (flags & SLOW_SRC2)
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG2, src2, src2w, dst, dstw));
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
- if (src1 & SLJIT_MEM)
- src1 = TMP_REG1;
- if (src2 & SLJIT_MEM)
- src2 = TMP_REG2;
+ dst_reg = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+ flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
if (src1 & SLJIT_IMM)
flags |= ARG1_IMM;
+ else if (src1 & SLJIT_MEM) {
+ emit_op_mem(compiler, WORD_SIZE, TMP_REG1, src1, src1w, TMP_REG1);
+ src1w = TMP_REG1;
+ }
else
src1w = src1;
+
if (src2 & SLJIT_IMM)
flags |= ARG2_IMM;
+ else if (src2 & SLJIT_MEM) {
+ src2_reg = (!(flags & ARG1_IMM) && (src1w == TMP_REG1)) ? TMP_REG2 : TMP_REG1;
+ emit_op_mem(compiler, WORD_SIZE, src2_reg, src2, src2w, src2_reg);
+ src2w = src2_reg;
+ }
else
src2w = src2;
if (dst == SLJIT_UNUSED)
flags |= UNUSED_RETURN;
- emit_op_imm(compiler, flags | GET_OPCODE(op), dst_r, src1w, src2w);
+ emit_op_imm(compiler, flags | GET_OPCODE(op), dst_reg, src1w, src2w);
- if (dst & SLJIT_MEM) {
- if (!(flags & SLOW_DEST)) {
- getput_arg_fast(compiler, WORD_SIZE | STORE, dst_r, dst, dstw);
- return compiler->error;
- }
- return getput_arg(compiler, WORD_SIZE | STORE, TMP_REG1, dst, dstw, 0, 0);
- }
- return SLJIT_SUCCESS;
+ if (!(dst & SLJIT_MEM))
+ return SLJIT_SUCCESS;
+ return emit_op_mem(compiler, WORD_SIZE | STORE, dst_reg, dst, dstw, TMP_REG2);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
@@ -1542,7 +1359,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
- return reg << 1;
+ return (freg_map[reg] << 1);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -1560,21 +1377,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#else
- /* Available by default. */
- return 1;
-#endif
-}
-
#define FPU_LOAD (1 << 20)
static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
{
- sljit_sw tmp;
sljit_uw imm;
sljit_sw inst = VSTR_F32 | (flags & (SLJIT_F32_OP | FPU_LOAD));
@@ -1582,8 +1388,8 @@ static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags,
/* Fast loads and stores. */
if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
- FAIL_IF(push_inst32(compiler, ADD_W | RD4(TMP_REG2) | RN4(arg & REG_MASK) | RM4(OFFS_REG(arg)) | ((argw & 0x3) << 6)));
- arg = SLJIT_MEM | TMP_REG2;
+ FAIL_IF(push_inst32(compiler, ADD_W | RD4(TMP_REG1) | RN4(arg & REG_MASK) | RM4(OFFS_REG(arg)) | ((argw & 0x3) << 6)));
+ arg = SLJIT_MEM | TMP_REG1;
argw = 0;
}
@@ -1594,21 +1400,6 @@ static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags,
return push_inst32(compiler, inst | RN4(arg & REG_MASK) | DD4(reg) | (-argw >> 2));
}
- /* Slow cases */
- SLJIT_ASSERT(!(arg & OFFS_REG_MASK));
- if (compiler->cache_arg == arg) {
- tmp = argw - compiler->cache_argw;
- if (!(tmp & ~0x3fc))
- return push_inst32(compiler, inst | 0x800000 | RN4(TMP_REG3) | DD4(reg) | (tmp >> 2));
- if (!(-tmp & ~0x3fc))
- return push_inst32(compiler, inst | RN4(TMP_REG3) | DD4(reg) | (-tmp >> 2));
- if (emit_set_delta(compiler, TMP_REG3, TMP_REG3, tmp) != SLJIT_ERR_UNSUPPORTED) {
- FAIL_IF(compiler->error);
- compiler->cache_argw = argw;
- return push_inst32(compiler, inst | 0x800000 | RN4(TMP_REG3) | DD4(reg));
- }
- }
-
if (arg & REG_MASK) {
if (emit_set_delta(compiler, TMP_REG1, arg & REG_MASK, argw) != SLJIT_ERR_UNSUPPORTED) {
FAIL_IF(compiler->error);
@@ -1627,19 +1418,18 @@ static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags,
}
}
- compiler->cache_arg = arg;
- compiler->cache_argw = argw;
-
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
+ FAIL_IF(load_immediate(compiler, TMP_REG1, argw));
if (arg & REG_MASK)
- FAIL_IF(push_inst16(compiler, ADD | SET_REGS44(TMP_REG3, (arg & REG_MASK))));
- return push_inst32(compiler, inst | 0x800000 | RN4(TMP_REG3) | DD4(reg));
+ FAIL_IF(push_inst16(compiler, ADD | SET_REGS44(TMP_REG1, (arg & REG_MASK))));
+ return push_inst32(compiler, inst | 0x800000 | RN4(TMP_REG1) | DD4(reg));
}
static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
+ op ^= SLJIT_F32_OP;
+
if (src & SLJIT_MEM) {
FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src, srcw));
src = TMP_FREG1;
@@ -1647,9 +1437,6 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
FAIL_IF(push_inst32(compiler, VCVT_S32_F32 | (op & SLJIT_F32_OP) | DD4(TMP_FREG1) | DM4(src)));
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
return push_inst32(compiler, VMOV | (1 << 20) | RT4(dst) | DN4(TMP_FREG1));
@@ -1663,6 +1450,8 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
{
sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+ op ^= SLJIT_F32_OP;
+
if (FAST_IS_REG(src))
FAIL_IF(push_inst32(compiler, VMOV | RT4(src) | DN4(TMP_FREG1)));
else if (src & SLJIT_MEM) {
@@ -1685,6 +1474,8 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
+ op ^= SLJIT_F32_OP;
+
if (src1 & SLJIT_MEM) {
emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w);
src1 = TMP_FREG1;
@@ -1706,16 +1497,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
sljit_s32 dst_r;
CHECK_ERROR();
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- if (GET_OPCODE(op) != SLJIT_CONV_F64_FROM_F32)
- op ^= SLJIT_F32_OP;
SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100), float_transfer_bit_error);
SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
+ if (GET_OPCODE(op) != SLJIT_CONV_F64_FROM_F32)
+ op ^= SLJIT_F32_OP;
+
if (src & SLJIT_MEM) {
emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, dst_r, src, srcw);
src = dst_r;
@@ -1760,8 +1550,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
op ^= SLJIT_F32_OP;
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
@@ -1806,21 +1594,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
- /* For UNUSED dst. Uncommon, but possible. */
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
+ SLJIT_ASSERT(reg_map[TMP_REG2] == 14);
if (FAST_IS_REG(dst))
- return push_inst16(compiler, MOV | SET_REGS44(dst, TMP_REG3));
+ return push_inst16(compiler, MOV | SET_REGS44(dst, TMP_REG2));
/* Memory. */
- if (getput_arg_fast(compiler, WORD_SIZE | STORE, TMP_REG3, dst, dstw))
- return compiler->error;
- /* TMP_REG3 is used for caching. */
- FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(TMP_REG2, TMP_REG3)));
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- return getput_arg(compiler, WORD_SIZE | STORE, TMP_REG2, dst, dstw, 0, 0);
+ return emit_op_mem(compiler, WORD_SIZE | STORE, TMP_REG2, dst, dstw, TMP_REG1);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
@@ -1829,21 +1609,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
+ SLJIT_ASSERT(reg_map[TMP_REG2] == 14);
+
if (FAST_IS_REG(src))
- FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(TMP_REG3, src)));
- else if (src & SLJIT_MEM) {
- if (getput_arg_fast(compiler, WORD_SIZE, TMP_REG3, src, srcw))
- FAIL_IF(compiler->error);
- else {
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- FAIL_IF(getput_arg(compiler, WORD_SIZE, TMP_REG2, src, srcw, 0, 0));
- FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(TMP_REG3, TMP_REG2)));
- }
- }
- else if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, TMP_REG3, srcw));
- return push_inst16(compiler, BLX | RN3(TMP_REG3));
+ FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(TMP_REG2, src)));
+ else
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, src, srcw, TMP_REG2));
+
+ return push_inst16(compiler, BX | RN3(TMP_REG2));
}
/* --------------------------------------------------------------------- */
@@ -1900,7 +1673,7 @@ static sljit_uw get_cc(sljit_s32 type)
return 0x7;
default: /* SLJIT_JUMP */
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return 0xe;
}
}
@@ -1934,7 +1707,6 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
type &= 0xff;
- /* In ARM, we don't need to touch the arguments. */
PTR_FAIL_IF(emit_imm32_const(compiler, TMP_REG1, 0));
if (type < SLJIT_JUMP) {
jump->flags |= IS_COND;
@@ -1954,6 +1726,241 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
return jump;
}
+#ifdef __SOFTFP__
+
+static sljit_s32 softfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src)
+{
+ sljit_s32 stack_offset = 0;
+ sljit_s32 arg_count = 0;
+ sljit_s32 word_arg_offset = 0;
+ sljit_s32 float_arg_count = 0;
+ sljit_s32 types = 0;
+ sljit_s32 src_offset = 4 * sizeof(sljit_sw);
+ sljit_u8 offsets[4];
+
+ if (src && FAST_IS_REG(*src))
+ src_offset = reg_map[*src] * sizeof(sljit_sw);
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_f32);
+ arg_count++;
+ float_arg_count++;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (stack_offset & 0x7)
+ stack_offset += sizeof(sljit_sw);
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_f64);
+ arg_count++;
+ float_arg_count++;
+ break;
+ default:
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_sw);
+ arg_count++;
+ word_arg_offset += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ if (stack_offset > 16)
+ FAIL_IF(push_inst16(compiler, SUB_SP | (((stack_offset - 16) + 0x7) & ~0x7) >> 2));
+
+ SLJIT_ASSERT(reg_map[TMP_REG1] == 12);
+
+ /* Process arguments in reversed direction. */
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ arg_count--;
+ float_arg_count--;
+ stack_offset = offsets[arg_count];
+
+ if (stack_offset < 16) {
+ if (src_offset == stack_offset) {
+ FAIL_IF(push_inst16(compiler, MOV | (src_offset << 1) | 4 | (1 << 7)));
+ *src = TMP_REG1;
+ }
+ FAIL_IF(push_inst32(compiler, VMOV | 0x100000 | (float_arg_count << 16) | (stack_offset << 10)));
+ } else
+ FAIL_IF(push_inst32(compiler, VSTR_F32 | 0x800000 | RN4(SLJIT_SP) | (float_arg_count << 12) | ((stack_offset - 16) >> 2)));
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ arg_count--;
+ float_arg_count--;
+ stack_offset = offsets[arg_count];
+
+ SLJIT_ASSERT((stack_offset & 0x7) == 0);
+
+ if (stack_offset < 16) {
+ if (src_offset == stack_offset || src_offset == stack_offset + sizeof(sljit_sw)) {
+ FAIL_IF(push_inst16(compiler, MOV | (src_offset << 1) | 4 | (1 << 7)));
+ *src = TMP_REG1;
+ }
+ FAIL_IF(push_inst32(compiler, VMOV2 | 0x100000 | (stack_offset << 10) | ((stack_offset + sizeof(sljit_sw)) << 14) | float_arg_count));
+ } else
+ FAIL_IF(push_inst32(compiler, VSTR_F32 | 0x800100 | RN4(SLJIT_SP) | (float_arg_count << 12) | ((stack_offset - 16) >> 2)));
+ break;
+ default:
+ arg_count--;
+ word_arg_offset -= sizeof(sljit_sw);
+ stack_offset = offsets[arg_count];
+
+ SLJIT_ASSERT(stack_offset >= word_arg_offset);
+
+ if (stack_offset != word_arg_offset) {
+ if (stack_offset < 16) {
+ if (src_offset == stack_offset) {
+ FAIL_IF(push_inst16(compiler, MOV | (src_offset << 1) | 4 | (1 << 7)));
+ *src = TMP_REG1;
+ }
+ else if (src_offset == word_arg_offset) {
+ *src = 1 + (stack_offset >> 2);
+ src_offset = stack_offset;
+ }
+ FAIL_IF(push_inst16(compiler, MOV | (stack_offset >> 2) | (word_arg_offset << 1)));
+ } else
+ FAIL_IF(push_inst16(compiler, STR_SP | (word_arg_offset << 6) | ((stack_offset - 16) >> 2)));
+ }
+ break;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
+ return SLJIT_SUCCESS;
+}
+
+static sljit_s32 softfloat_post_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types)
+{
+ sljit_s32 stack_size = 0;
+
+ if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F32)
+ FAIL_IF(push_inst32(compiler, VMOV | (0 << 16) | (0 << 12)));
+ if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F64)
+ FAIL_IF(push_inst32(compiler, VMOV2 | (1 << 16) | (0 << 12) | 0));
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ stack_size += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (stack_size & 0x7)
+ stack_size += sizeof(sljit_sw);
+ stack_size += sizeof(sljit_f64);
+ break;
+ default:
+ stack_size += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ if (stack_size <= 16)
+ return SLJIT_SUCCESS;
+
+ return push_inst16(compiler, ADD_SP | ((((stack_size - 16) + 0x7) & ~0x7) >> 2));
+}
+
+#else
+
+static sljit_s32 hardfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types)
+{
+ sljit_u32 remap = 0;
+ sljit_u32 offset = 0;
+ sljit_u32 new_offset, mask;
+
+ /* Remove return value. */
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F32) {
+ new_offset = 0;
+ mask = 1;
+
+ while (remap & mask) {
+ new_offset++;
+ mask <<= 1;
+ }
+ remap |= mask;
+
+ if (offset != new_offset)
+ FAIL_IF(push_inst32(compiler, VMOV_F32 | DD4((new_offset >> 1) + 1)
+ | ((new_offset & 0x1) ? 0x400000 : 0) | DM4((offset >> 1) + 1)));
+
+ offset += 2;
+ }
+ else if ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F64) {
+ new_offset = 0;
+ mask = 3;
+
+ while (remap & mask) {
+ new_offset += 2;
+ mask <<= 2;
+ }
+ remap |= mask;
+
+ if (offset != new_offset)
+ FAIL_IF(push_inst32(compiler, VMOV_F32 | SLJIT_F32_OP | DD4((new_offset >> 1) + 1) | DM4((offset >> 1) + 1)));
+
+ offset += 2;
+ }
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ return SLJIT_SUCCESS;
+}
+
+#endif
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+#ifdef __SOFTFP__
+ struct sljit_jump *jump;
+#endif
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+#ifdef __SOFTFP__
+ PTR_FAIL_IF(softfloat_call_with_args(compiler, arg_types, NULL));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ jump = sljit_emit_jump(compiler, type);
+ PTR_FAIL_IF(jump == NULL);
+
+ PTR_FAIL_IF(softfloat_post_call_with_args(compiler, arg_types));
+ return jump;
+#else
+ PTR_FAIL_IF(hardfloat_call_with_args(compiler, arg_types));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_jump(compiler, type);
+#endif
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
{
struct sljit_jump *jump;
@@ -1962,16 +1969,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
- /* In ARM, we don't need to touch the arguments. */
+ SLJIT_ASSERT(reg_map[TMP_REG1] != 14);
+
if (!(src & SLJIT_IMM)) {
- if (FAST_IS_REG(src))
+ if (FAST_IS_REG(src)) {
+ SLJIT_ASSERT(reg_map[src] != 14);
return push_inst16(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RN3(src));
+ }
- FAIL_IF(emit_op_mem(compiler, WORD_SIZE, type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, src, srcw));
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, src, srcw, TMP_REG1));
if (type >= SLJIT_FAST_CALL)
return push_inst16(compiler, BLX | RN3(TMP_REG1));
}
+ /* These jumps are converted to jump/call instructions when possible. */
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF(!jump);
set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0));
@@ -1982,25 +1993,55 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
return push_inst16(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RN3(TMP_REG1));
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+#ifdef __SOFTFP__
+ if (src & SLJIT_MEM) {
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, src, srcw, TMP_REG1));
+ src = TMP_REG1;
+ }
+
+ FAIL_IF(softfloat_call_with_args(compiler, arg_types, &src));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw));
+
+ return softfloat_post_call_with_args(compiler, arg_types);
+#else /* !__SOFTFP__ */
+ FAIL_IF(hardfloat_call_with_args(compiler, arg_types));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_ijump(compiler, type, src, srcw);
+#endif /* __SOFTFP__ */
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
sljit_s32 dst_r, flags = GET_ALL_FLAGS(op);
- sljit_ins cc, ins;
+ sljit_ins cc;
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- ADJUST_LOCAL_OFFSET(src, srcw);
-
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
op = GET_OPCODE(op);
cc = get_cc(type & 0xff);
- dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
if (op < SLJIT_ADD) {
FAIL_IF(push_inst16(compiler, IT | (cc << 4) | (((cc & 0x1) ^ 0x1) << 3) | 0x4));
@@ -2008,60 +2049,141 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
FAIL_IF(push_inst32(compiler, MOV_WI | RD4(dst_r) | 1));
FAIL_IF(push_inst32(compiler, MOV_WI | RD4(dst_r) | 0));
} else {
+ /* The movsi (immediate) instruction does not set flags in IT block. */
FAIL_IF(push_inst16(compiler, MOVSI | RDN3(dst_r) | 1));
FAIL_IF(push_inst16(compiler, MOVSI | RDN3(dst_r) | 0));
}
- if (dst_r != TMP_REG2)
+ if (!(dst & SLJIT_MEM))
return SLJIT_SUCCESS;
- return emit_op_mem(compiler, WORD_SIZE | STORE, TMP_REG2, dst, dstw);
+ return emit_op_mem(compiler, WORD_SIZE | STORE, TMP_REG1, dst, dstw, TMP_REG2);
}
- ins = (op == SLJIT_AND ? ANDI : (op == SLJIT_OR ? ORRI : EORI));
- if ((op == SLJIT_OR || op == SLJIT_XOR) && FAST_IS_REG(dst) && dst == src) {
- /* Does not change the other bits. */
+ if (dst & SLJIT_MEM)
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2));
+
+ if (op == SLJIT_AND) {
+ FAIL_IF(push_inst16(compiler, IT | (cc << 4) | (((cc & 0x1) ^ 0x1) << 3) | 0x4));
+ FAIL_IF(push_inst32(compiler, ANDI | RN4(dst_r) | RD4(dst_r) | 1));
+ FAIL_IF(push_inst32(compiler, ANDI | RN4(dst_r) | RD4(dst_r) | 0));
+ }
+ else {
FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
- FAIL_IF(push_inst32(compiler, ins | RN4(src) | RD4(dst) | 1));
- if (flags & SLJIT_SET_E) {
- /* The condition must always be set, even if the ORRI/EORI is not executed above. */
- if (reg_map[dst] <= 7)
- return push_inst16(compiler, MOVS | RD3(TMP_REG1) | RN3(dst));
- return push_inst32(compiler, MOV_W | SET_FLAGS | RD4(TMP_REG1) | RM4(dst));
- }
+ FAIL_IF(push_inst32(compiler, ((op == SLJIT_OR) ? ORRI : EORI) | RN4(dst_r) | RD4(dst_r) | 1));
+ }
+
+ if (dst & SLJIT_MEM)
+ FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, TMP_REG1, dst, dstw, TMP_REG2));
+
+ if (!(flags & SLJIT_SET_Z))
return SLJIT_SUCCESS;
+
+ /* The condition must always be set, even if the ORR/EORI is not executed above. */
+ return push_inst32(compiler, MOV_W | SET_FLAGS | RD4(TMP_REG1) | RM4(dst_r));
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_uw cc, tmp;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
+
+ dst_reg &= ~SLJIT_I32_OP;
+
+ cc = get_cc(type & 0xff);
+
+ if (!(src & SLJIT_IMM)) {
+ FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
+ return push_inst16(compiler, MOV | SET_REGS44(dst_reg, src));
}
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, WORD_SIZE, TMP_REG2, src, srcw, dst, dstw));
- src = TMP_REG2;
- srcw = 0;
- } else if (src & SLJIT_IMM) {
- FAIL_IF(load_immediate(compiler, TMP_REG2, srcw));
- src = TMP_REG2;
- srcw = 0;
+ tmp = (sljit_uw) srcw;
+
+ if (tmp < 0x10000) {
+ /* set low 16 bits, set hi 16 bits to 0. */
+ FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
+ return push_inst32(compiler, MOVW | RD4(dst_reg)
+ | COPY_BITS(tmp, 12, 16, 4) | COPY_BITS(tmp, 11, 26, 1) | COPY_BITS(tmp, 8, 12, 3) | (tmp & 0xff));
}
- if (op == SLJIT_AND || src != dst_r) {
- FAIL_IF(push_inst16(compiler, IT | (cc << 4) | (((cc & 0x1) ^ 0x1) << 3) | 0x4));
- FAIL_IF(push_inst32(compiler, ins | RN4(src) | RD4(dst_r) | 1));
- FAIL_IF(push_inst32(compiler, ins | RN4(src) | RD4(dst_r) | 0));
+ tmp = get_imm(srcw);
+ if (tmp != INVALID_IMM) {
+ FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
+ return push_inst32(compiler, MOV_WI | RD4(dst_reg) | tmp);
}
- else {
+
+ tmp = get_imm(~srcw);
+ if (tmp != INVALID_IMM) {
FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
- FAIL_IF(push_inst32(compiler, ins | RN4(src) | RD4(dst_r) | 1));
+ return push_inst32(compiler, MVN_WI | RD4(dst_reg) | tmp);
}
- if (dst_r == TMP_REG2)
- FAIL_IF(emit_op_mem2(compiler, WORD_SIZE | STORE, TMP_REG2, dst, dstw, 0, 0));
+ FAIL_IF(push_inst16(compiler, IT | (cc << 4) | ((cc & 0x1) << 3) | 0x4));
+
+ tmp = (sljit_uw) srcw;
+ FAIL_IF(push_inst32(compiler, MOVW | RD4(dst_reg)
+ | COPY_BITS(tmp, 12, 16, 4) | COPY_BITS(tmp, 11, 26, 1) | COPY_BITS(tmp, 8, 12, 3) | (tmp & 0xff)));
+ return push_inst32(compiler, MOVT | RD4(dst_reg)
+ | COPY_BITS(tmp, 12 + 16, 16, 4) | COPY_BITS(tmp, 11 + 16, 26, 1) | COPY_BITS(tmp, 8 + 16, 12, 3) | ((tmp & 0xff0000) >> 16));
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ sljit_s32 flags;
+ sljit_ins inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw));
+
+ if ((mem & OFFS_REG_MASK) || (memw > 255 && memw < -255))
+ return SLJIT_ERR_UNSUPPORTED;
- if (flags & SLJIT_SET_E) {
- /* The condition must always be set, even if the ORR/EORI is not executed above. */
- if (reg_map[dst_r] <= 7)
- return push_inst16(compiler, MOVS | RD3(TMP_REG1) | RN3(dst_r));
- return push_inst32(compiler, MOV_W | SET_FLAGS | RD4(TMP_REG1) | RM4(dst_r));
+ if (type & SLJIT_MEM_SUPP)
+ return SLJIT_SUCCESS;
+
+ switch (type & 0xff) {
+ case SLJIT_MOV:
+ case SLJIT_MOV_U32:
+ case SLJIT_MOV_S32:
+ case SLJIT_MOV_P:
+ flags = WORD_SIZE;
+ break;
+ case SLJIT_MOV_U8:
+ flags = BYTE_SIZE;
+ break;
+ case SLJIT_MOV_S8:
+ flags = BYTE_SIZE | SIGNED;
+ break;
+ case SLJIT_MOV_U16:
+ flags = HALF_SIZE;
+ break;
+ case SLJIT_MOV_S16:
+ flags = HALF_SIZE | SIGNED;
+ break;
+ default:
+ SLJIT_UNREACHABLE();
+ flags = WORD_SIZE;
+ break;
}
- return SLJIT_SUCCESS;
+
+ if (type & SLJIT_MEM_STORE)
+ flags |= STORE;
+
+ inst = sljit_mem32[flags] | 0x900;
+
+ if (type & SLJIT_MEM_PRE)
+ inst |= 0x400;
+
+ if (memw >= 0)
+ inst |= 0x200;
+ else
+ memw = -memw;
+
+ return push_inst32(compiler, inst | RT4(reg) | RN4(mem & REG_MASK) | memw);
}
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
@@ -2077,11 +2199,11 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
PTR_FAIL_IF(emit_imm32_const(compiler, dst_r, init_value));
if (dst & SLJIT_MEM)
- PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw));
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2));
return const_;
}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeMIPS_32.c b/thirdparty/pcre2/src/sljit/sljitNativeMIPS_32.c
index b15a57dfdb..9f9e157a05 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeMIPS_32.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeMIPS_32.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -40,35 +40,37 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_a
#define EMIT_LOGICAL(op_imm, op_norm) \
if (flags & SRC2_IMM) { \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, op_imm | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, op_imm | S(src1) | T(dst) | IMM(src2), DR(dst))); \
} \
else { \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, op_norm | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, op_norm | S(src1) | T(src2) | D(dst), DR(dst))); \
}
#define EMIT_SHIFT(op_imm, op_v) \
if (flags & SRC2_IMM) { \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, op_imm | T(src1) | DA(EQUAL_FLAG) | SH_IMM(src2), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, op_imm | T(src1) | D(dst) | SH_IMM(src2), DR(dst))); \
} \
else { \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, op_v | S(src2) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, op_v | S(src2) | T(src1) | D(dst), DR(dst))); \
}
static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags,
sljit_s32 dst, sljit_s32 src1, sljit_sw src2)
{
+ sljit_s32 is_overflow, is_carry, is_handled;
+
switch (GET_OPCODE(op)) {
case SLJIT_MOV:
case SLJIT_MOV_U32:
@@ -93,8 +95,9 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
}
return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xff), DR(dst));
}
- else if (dst != src2)
- SLJIT_ASSERT_STOP();
+ else {
+ SLJIT_ASSERT(dst == src2);
+ }
return SLJIT_SUCCESS;
case SLJIT_MOV_U16:
@@ -111,24 +114,25 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
}
return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xffff), DR(dst));
}
- else if (dst != src2)
- SLJIT_ASSERT_STOP();
+ else {
+ SLJIT_ASSERT(dst == src2);
+ }
return SLJIT_SUCCESS;
case SLJIT_NOT:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
- if (op & SLJIT_SET_E)
+ if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, NOR | S(src2) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST))
FAIL_IF(push_inst(compiler, NOR | S(src2) | T(src2) | D(dst), DR(dst)));
return SLJIT_SUCCESS;
case SLJIT_CLZ:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
- if (op & SLJIT_SET_E)
+ if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, CLZ | S(src2) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST))
FAIL_IF(push_inst(compiler, CLZ | S(src2) | T(dst) | D(dst), DR(dst)));
#else
if (SLJIT_UNLIKELY(flags & UNUSED_DEST)) {
@@ -145,130 +149,192 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
FAIL_IF(push_inst(compiler, ADDIU | S(dst) | T(dst) | IMM(1), DR(dst)));
FAIL_IF(push_inst(compiler, BGEZ | S(TMP_REG1) | IMM(-2), UNMOVABLE_INS));
FAIL_IF(push_inst(compiler, SLL | T(TMP_REG1) | D(TMP_REG1) | SH_IMM(1), UNMOVABLE_INS));
- if (op & SLJIT_SET_E)
- return push_inst(compiler, ADDU | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG);
#endif
return SLJIT_SUCCESS;
case SLJIT_ADD:
+ is_overflow = GET_FLAG_TYPE(op) == SLJIT_OVERFLOW;
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_O) {
+ if (is_overflow) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
else
- FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
}
- if (op & SLJIT_SET_E)
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, ADDIU | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
- if (op & (SLJIT_SET_C | SLJIT_SET_O)) {
+
+ if (is_overflow || is_carry) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(ULESS_FLAG) | IMM(src2), ULESS_FLAG));
+ FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
else {
- FAIL_IF(push_inst(compiler, ADDIU | SA(0) | TA(ULESS_FLAG) | IMM(src2), ULESS_FLAG));
- FAIL_IF(push_inst(compiler, OR | S(src1) | TA(ULESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG));
+ FAIL_IF(push_inst(compiler, ADDIU | SA(0) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
}
}
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, ADDIU | S(src1) | T(dst) | IMM(src2), DR(dst)));
}
else {
- if (op & SLJIT_SET_O)
- FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- if (op & SLJIT_SET_E)
+ if (is_overflow)
+ FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, ADDU | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (op & (SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(ULESS_FLAG), ULESS_FLAG));
+
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, ADDU | S(src1) | T(src2) | D(dst), DR(dst)));
}
/* a + b >= a | b (otherwise, the carry should be set to 1). */
- if (op & (SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(ULESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG));
- if (!(op & SLJIT_SET_O))
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
+ if (!is_overflow)
return SLJIT_SUCCESS;
- FAIL_IF(push_inst(compiler, SLL | TA(ULESS_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
- FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- return push_inst(compiler, SLL | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG) | SH_IMM(31), OVERFLOW_FLAG);
+ FAIL_IF(push_inst(compiler, SLL | TA(OTHER_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
+ FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(EQUAL_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, ADDU | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ return push_inst(compiler, SRL | TA(OTHER_FLAG) | DA(OTHER_FLAG) | SH_IMM(31), OTHER_FLAG);
case SLJIT_ADDC:
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_C) {
+ if (is_carry) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(OVERFLOW_FLAG) | IMM(src2), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
else {
- FAIL_IF(push_inst(compiler, ADDIU | SA(0) | TA(OVERFLOW_FLAG) | IMM(src2), OVERFLOW_FLAG));
- FAIL_IF(push_inst(compiler, OR | S(src1) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, ADDIU | SA(0) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
}
}
FAIL_IF(push_inst(compiler, ADDIU | S(src1) | T(dst) | IMM(src2), DR(dst)));
} else {
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
/* dst may be the same as src1 or src2. */
FAIL_IF(push_inst(compiler, ADDU | S(src1) | T(src2) | D(dst), DR(dst)));
}
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
- FAIL_IF(push_inst(compiler, ADDU | S(dst) | TA(ULESS_FLAG) | D(dst), DR(dst)));
- if (!(op & SLJIT_SET_C))
+ FAIL_IF(push_inst(compiler, ADDU | S(dst) | TA(OTHER_FLAG) | D(dst), DR(dst)));
+ if (!is_carry)
return SLJIT_SUCCESS;
- /* Set ULESS_FLAG (dst == 0) && (ULESS_FLAG == 1). */
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(ULESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG));
+ /* Set ULESS_FLAG (dst == 0) && (OTHER_FLAG == 1). */
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
/* Set carry flag. */
- return push_inst(compiler, OR | SA(ULESS_FLAG) | TA(OVERFLOW_FLAG) | DA(ULESS_FLAG), ULESS_FLAG);
+ return push_inst(compiler, OR | SA(OTHER_FLAG) | TA(EQUAL_FLAG) | DA(OTHER_FLAG), OTHER_FLAG);
case SLJIT_SUB:
- if ((flags & SRC2_IMM) && ((op & (SLJIT_SET_U | SLJIT_SET_S)) || src2 == SIMM_MIN)) {
+ if ((flags & SRC2_IMM) && src2 == SIMM_MIN) {
FAIL_IF(push_inst(compiler, ADDIU | SA(0) | T(TMP_REG2) | IMM(src2), DR(TMP_REG2)));
src2 = TMP_REG2;
flags &= ~SRC2_IMM;
}
+ is_handled = 0;
+
+ if (flags & SRC2_IMM) {
+ if (GET_FLAG_TYPE(op) == SLJIT_LESS || GET_FLAG_TYPE(op) == SLJIT_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
+ is_handled = 1;
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_SIG_LESS || GET_FLAG_TYPE(op) == SLJIT_SIG_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLTI | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
+ is_handled = 1;
+ }
+ }
+
+ if (!is_handled && GET_FLAG_TYPE(op) >= SLJIT_LESS && GET_FLAG_TYPE(op) <= SLJIT_SIG_LESS_EQUAL) {
+ is_handled = 1;
+
+ if (flags & SRC2_IMM) {
+ FAIL_IF(push_inst(compiler, ADDIU | SA(0) | T(TMP_REG2) | IMM(src2), DR(TMP_REG2)));
+ src2 = TMP_REG2;
+ flags &= ~SRC2_IMM;
+ }
+
+ if (GET_FLAG_TYPE(op) == SLJIT_LESS || GET_FLAG_TYPE(op) == SLJIT_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_GREATER || GET_FLAG_TYPE(op) == SLJIT_LESS_EQUAL)
+ {
+ FAIL_IF(push_inst(compiler, SLTU | S(src2) | T(src1) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_SIG_LESS || GET_FLAG_TYPE(op) == SLJIT_SIG_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLT | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_SIG_GREATER || GET_FLAG_TYPE(op) == SLJIT_SIG_LESS_EQUAL)
+ {
+ FAIL_IF(push_inst(compiler, SLT | S(src2) | T(src1) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ }
+
+ if (is_handled) {
+ if (flags & SRC2_IMM) {
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, ADDIU | S(src1) | TA(EQUAL_FLAG) | IMM(-src2), EQUAL_FLAG));
+ if (!(flags & UNUSED_DEST))
+ return push_inst(compiler, ADDIU | S(src1) | T(dst) | IMM(-src2), DR(dst));
+ }
+ else {
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, SUBU | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ if (!(flags & UNUSED_DEST))
+ return push_inst(compiler, SUBU | S(src1) | T(src2) | D(dst), DR(dst));
+ }
+ return SLJIT_SUCCESS;
+ }
+
+ is_overflow = GET_FLAG_TYPE(op) == SLJIT_OVERFLOW;
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_O) {
+ if (is_overflow) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
else
- FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
}
- if (op & SLJIT_SET_E)
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, ADDIU | S(src1) | TA(EQUAL_FLAG) | IMM(-src2), EQUAL_FLAG));
- if (op & (SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(ULESS_FLAG) | IMM(src2), ULESS_FLAG));
+
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, ADDIU | S(src1) | T(dst) | IMM(-src2), DR(dst)));
}
else {
- if (op & SLJIT_SET_O)
- FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- if (op & SLJIT_SET_E)
+ if (is_overflow)
+ FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, SUBU | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (op & (SLJIT_SET_U | SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(ULESS_FLAG), ULESS_FLAG));
- if (op & SLJIT_SET_U)
- FAIL_IF(push_inst(compiler, SLTU | S(src2) | T(src1) | DA(UGREATER_FLAG), UGREATER_FLAG));
- if (op & SLJIT_SET_S) {
- FAIL_IF(push_inst(compiler, SLT | S(src1) | T(src2) | DA(LESS_FLAG), LESS_FLAG));
- FAIL_IF(push_inst(compiler, SLT | S(src2) | T(src1) | DA(GREATER_FLAG), GREATER_FLAG));
- }
+
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, SUBU | S(src1) | T(src2) | D(dst), DR(dst)));
}
- if (!(op & SLJIT_SET_O))
+ if (!is_overflow)
return SLJIT_SUCCESS;
- FAIL_IF(push_inst(compiler, SLL | TA(ULESS_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
- FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- return push_inst(compiler, SRL | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG) | SH_IMM(31), OVERFLOW_FLAG);
+ FAIL_IF(push_inst(compiler, SLL | TA(OTHER_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
+ FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(EQUAL_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, ADDU | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ return push_inst(compiler, SRL | TA(OTHER_FLAG) | DA(OTHER_FLAG) | SH_IMM(31), OTHER_FLAG);
case SLJIT_SUBC:
if ((flags & SRC2_IMM) && src2 == SIMM_MIN) {
@@ -277,28 +343,31 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
flags &= ~SRC2_IMM;
}
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(OVERFLOW_FLAG) | IMM(src2), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
/* dst may be the same as src1 or src2. */
FAIL_IF(push_inst(compiler, ADDIU | S(src1) | T(dst) | IMM(-src2), DR(dst)));
}
else {
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
/* dst may be the same as src1 or src2. */
FAIL_IF(push_inst(compiler, SUBU | S(src1) | T(src2) | D(dst), DR(dst)));
}
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(ULESS_FLAG) | DA(LESS_FLAG), LESS_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OTHER_FLAG) | D(TMP_REG1), DR(TMP_REG1)));
- FAIL_IF(push_inst(compiler, SUBU | S(dst) | TA(ULESS_FLAG) | D(dst), DR(dst)));
- return (op & SLJIT_SET_C) ? push_inst(compiler, OR | SA(OVERFLOW_FLAG) | TA(LESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG) : SLJIT_SUCCESS;
+ FAIL_IF(push_inst(compiler, SUBU | S(dst) | TA(OTHER_FLAG) | D(dst), DR(dst)));
+ return (is_carry) ? push_inst(compiler, OR | SA(EQUAL_FLAG) | T(TMP_REG1) | DA(OTHER_FLAG), OTHER_FLAG) : SLJIT_SUCCESS;
case SLJIT_MUL:
SLJIT_ASSERT(!(flags & SRC2_IMM));
- if (!(op & SLJIT_SET_O)) {
+
+ if (GET_FLAG_TYPE(op) != SLJIT_MUL_OVERFLOW) {
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst));
#else
@@ -307,10 +376,10 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
#endif
}
FAIL_IF(push_inst(compiler, MULT | S(src1) | T(src2), MOVABLE_INS));
- FAIL_IF(push_inst(compiler, MFHI | DA(ULESS_FLAG), ULESS_FLAG));
+ FAIL_IF(push_inst(compiler, MFHI | DA(EQUAL_FLAG), EQUAL_FLAG));
FAIL_IF(push_inst(compiler, MFLO | D(dst), DR(dst)));
- FAIL_IF(push_inst(compiler, SRA | T(dst) | DA(UGREATER_FLAG) | SH_IMM(31), UGREATER_FLAG));
- return push_inst(compiler, SUBU | SA(ULESS_FLAG) | TA(UGREATER_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG);
+ FAIL_IF(push_inst(compiler, SRA | T(dst) | DA(OTHER_FLAG) | SH_IMM(31), OTHER_FLAG));
+ return push_inst(compiler, SUBU | SA(EQUAL_FLAG) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG);
case SLJIT_AND:
EMIT_LOGICAL(ANDI, AND);
@@ -337,7 +406,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return SLJIT_SUCCESS;
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
}
@@ -366,3 +435,232 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
SLJIT_CACHE_FLUSH(inst, inst + 2);
}
+
+static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_ins *ins_ptr)
+{
+ sljit_s32 stack_offset = 0;
+ sljit_s32 arg_count = 0;
+ sljit_s32 float_arg_count = 0;
+ sljit_s32 word_arg_count = 0;
+ sljit_s32 types = 0;
+ sljit_s32 arg_count_save, types_save;
+ sljit_ins prev_ins = NOP;
+ sljit_ins ins = NOP;
+ sljit_u8 offsets[4];
+
+ SLJIT_ASSERT(reg_map[TMP_REG3] == 4 && freg_map[TMP_FREG1] == 12);
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ offsets[arg_count] = (sljit_u8)stack_offset;
+
+ if (word_arg_count == 0 && arg_count <= 1)
+ offsets[arg_count] = 254 + arg_count;
+
+ stack_offset += sizeof(sljit_f32);
+ arg_count++;
+ float_arg_count++;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (stack_offset & 0x7)
+ stack_offset += sizeof(sljit_sw);
+ offsets[arg_count] = (sljit_u8)stack_offset;
+
+ if (word_arg_count == 0 && arg_count <= 1)
+ offsets[arg_count] = 254 + arg_count;
+
+ stack_offset += sizeof(sljit_f64);
+ arg_count++;
+ float_arg_count++;
+ break;
+ default:
+ offsets[arg_count] = (sljit_u8)stack_offset;
+ stack_offset += sizeof(sljit_sw);
+ arg_count++;
+ word_arg_count++;
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ /* Stack is aligned to 16 bytes, max two doubles can be placed on the stack. */
+ if (stack_offset > 16)
+ FAIL_IF(push_inst(compiler, ADDIU | S(SLJIT_SP) | T(SLJIT_SP) | IMM(-16), DR(SLJIT_SP)));
+
+ types_save = types;
+ arg_count_save = arg_count;
+
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ arg_count--;
+ if (offsets[arg_count] < 254)
+ ins = SWC1 | S(SLJIT_SP) | FT(float_arg_count) | IMM(offsets[arg_count]);
+ float_arg_count--;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ arg_count--;
+ if (offsets[arg_count] < 254)
+ ins = SDC1 | S(SLJIT_SP) | FT(float_arg_count) | IMM(offsets[arg_count]);
+ float_arg_count--;
+ break;
+ default:
+ if (offsets[arg_count - 1] >= 16)
+ ins = SW | S(SLJIT_SP) | T(word_arg_count) | IMM(offsets[arg_count - 1]);
+ else if (arg_count != word_arg_count)
+ ins = ADDU | S(word_arg_count) | TA(0) | DA(4 + (offsets[arg_count - 1] >> 2));
+ else if (arg_count == 1)
+ ins = ADDU | S(SLJIT_R0) | TA(0) | D(TMP_REG3);
+
+ arg_count--;
+ word_arg_count--;
+ break;
+ }
+
+ if (ins != NOP) {
+ if (prev_ins != NOP)
+ FAIL_IF(push_inst(compiler, prev_ins, MOVABLE_INS));
+ prev_ins = ins;
+ ins = NOP;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
+ types = types_save;
+ arg_count = arg_count_save;
+
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ arg_count--;
+ if (offsets[arg_count] == 254)
+ ins = MOV_S | FMT_S | FS(SLJIT_FR0) | FD(TMP_FREG1);
+ else if (offsets[arg_count] < 16)
+ ins = LW | S(SLJIT_SP) | TA(4 + (offsets[arg_count] >> 2)) | IMM(offsets[arg_count]);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ arg_count--;
+ if (offsets[arg_count] == 254)
+ ins = MOV_S | FMT_D | FS(SLJIT_FR0) | FD(TMP_FREG1);
+ else if (offsets[arg_count] < 16) {
+ if (prev_ins != NOP)
+ FAIL_IF(push_inst(compiler, prev_ins, MOVABLE_INS));
+ prev_ins = LW | S(SLJIT_SP) | TA(4 + (offsets[arg_count] >> 2)) | IMM(offsets[arg_count]);
+ ins = LW | S(SLJIT_SP) | TA(5 + (offsets[arg_count] >> 2)) | IMM(offsets[arg_count] + sizeof(sljit_sw));
+ }
+ break;
+ default:
+ arg_count--;
+ break;
+ }
+
+ if (ins != NOP) {
+ if (prev_ins != NOP)
+ FAIL_IF(push_inst(compiler, prev_ins, MOVABLE_INS));
+ prev_ins = ins;
+ ins = NOP;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
+ *ins_ptr = prev_ins;
+
+ return SLJIT_SUCCESS;
+}
+
+static sljit_s32 post_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types)
+{
+ sljit_s32 stack_offset = 0;
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ stack_offset += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (stack_offset & 0x7)
+ stack_offset += sizeof(sljit_sw);
+ stack_offset += sizeof(sljit_f64);
+ break;
+ default:
+ stack_offset += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ /* Stack is aligned to 16 bytes, max two doubles can be placed on the stack. */
+ if (stack_offset > 16)
+ return push_inst(compiler, ADDIU | S(SLJIT_SP) | T(SLJIT_SP) | IMM(16), DR(SLJIT_SP));
+
+ return SLJIT_SUCCESS;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ struct sljit_jump *jump;
+ sljit_ins ins;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+ jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
+ PTR_FAIL_IF(!jump);
+ set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
+ type &= 0xff;
+
+ PTR_FAIL_IF(call_with_args(compiler, arg_types, &ins));
+
+ SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
+
+ PTR_FAIL_IF(emit_const(compiler, PIC_ADDR_REG, 0));
+
+ jump->flags |= IS_JAL | IS_CALL;
+ PTR_FAIL_IF(push_inst(compiler, JALR | S(PIC_ADDR_REG) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
+ jump->addr = compiler->size;
+ PTR_FAIL_IF(push_inst(compiler, ins, UNMOVABLE_INS));
+
+ PTR_FAIL_IF(post_call_with_args(compiler, arg_types));
+
+ return jump;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_ins ins;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+ SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
+
+ if (src & SLJIT_IMM)
+ FAIL_IF(load_immediate(compiler, DR(PIC_ADDR_REG), srcw));
+ else if (FAST_IS_REG(src))
+ FAIL_IF(push_inst(compiler, ADDU | S(src) | TA(0) | D(PIC_ADDR_REG), DR(PIC_ADDR_REG)));
+ else if (src & SLJIT_MEM) {
+ ADJUST_LOCAL_OFFSET(src, srcw);
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, DR(PIC_ADDR_REG), src, srcw));
+ }
+
+ FAIL_IF(call_with_args(compiler, arg_types, &ins));
+
+ /* Register input. */
+ FAIL_IF(push_inst(compiler, JALR | S(PIC_ADDR_REG) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
+ FAIL_IF(push_inst(compiler, ins, UNMOVABLE_INS));
+ return post_call_with_args(compiler, arg_types);
+}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeMIPS_64.c b/thirdparty/pcre2/src/sljit/sljitNativeMIPS_64.c
index 8b96d5b73d..ff6f048659 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeMIPS_64.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeMIPS_64.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -123,15 +123,15 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_a
#define EMIT_LOGICAL(op_imm, op_norm) \
if (flags & SRC2_IMM) { \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, op_imm | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, op_imm | S(src1) | T(dst) | IMM(src2), DR(dst))); \
} \
else { \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, op_norm | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, op_norm | S(src1) | T(src2) | D(dst), DR(dst))); \
}
@@ -144,16 +144,16 @@ static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 dst_a
} \
else \
ins = (op & SLJIT_I32_OP) ? op_imm : op_dimm; \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, ins | T(src1) | DA(EQUAL_FLAG) | SH_IMM(src2), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, ins | T(src1) | D(dst) | SH_IMM(src2), DR(dst))); \
} \
else { \
ins = (op & SLJIT_I32_OP) ? op_v : op_dv; \
- if (op & SLJIT_SET_E) \
+ if (op & SLJIT_SET_Z) \
FAIL_IF(push_inst(compiler, ins | S(src2) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG)); \
- if (CHECK_FLAGS(SLJIT_SET_E)) \
+ if (!(flags & UNUSED_DEST)) \
FAIL_IF(push_inst(compiler, ins | S(src2) | T(src1) | D(dst), DR(dst))); \
}
@@ -161,6 +161,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
sljit_s32 dst, sljit_s32 src1, sljit_sw src2)
{
sljit_ins ins;
+ sljit_s32 is_overflow, is_carry, is_handled;
switch (GET_OPCODE(op)) {
case SLJIT_MOV:
@@ -180,8 +181,9 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
}
return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xff), DR(dst));
}
- else if (dst != src2)
- SLJIT_ASSERT_STOP();
+ else {
+ SLJIT_ASSERT(dst == src2);
+ }
return SLJIT_SUCCESS;
case SLJIT_MOV_U16:
@@ -194,8 +196,9 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
}
return push_inst(compiler, ANDI | S(src2) | T(dst) | IMM(0xffff), DR(dst));
}
- else if (dst != src2)
- SLJIT_ASSERT_STOP();
+ else {
+ SLJIT_ASSERT(dst == src2);
+ }
return SLJIT_SUCCESS;
case SLJIT_MOV_U32:
@@ -209,18 +212,18 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
case SLJIT_NOT:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
- if (op & SLJIT_SET_E)
+ if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, NOR | S(src2) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST))
FAIL_IF(push_inst(compiler, NOR | S(src2) | T(src2) | D(dst), DR(dst)));
return SLJIT_SUCCESS;
case SLJIT_CLZ:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
- if (op & SLJIT_SET_E)
+ if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, SELECT_OP(DCLZ, CLZ) | S(src2) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST))
FAIL_IF(push_inst(compiler, SELECT_OP(DCLZ, CLZ) | S(src2) | T(dst) | D(dst), DR(dst)));
#else
if (SLJIT_UNLIKELY(flags & UNUSED_DEST)) {
@@ -237,130 +240,192 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(dst) | T(dst) | IMM(1), DR(dst)));
FAIL_IF(push_inst(compiler, BGEZ | S(TMP_REG1) | IMM(-2), UNMOVABLE_INS));
FAIL_IF(push_inst(compiler, SELECT_OP(DSLL, SLL) | T(TMP_REG1) | D(TMP_REG1) | SH_IMM(1), UNMOVABLE_INS));
- if (op & SLJIT_SET_E)
- return push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG);
#endif
return SLJIT_SUCCESS;
case SLJIT_ADD:
+ is_overflow = GET_FLAG_TYPE(op) == SLJIT_OVERFLOW;
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_O) {
+ if (is_overflow) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
else
- FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
}
- if (op & SLJIT_SET_E)
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
- if (op & (SLJIT_SET_C | SLJIT_SET_O)) {
+
+ if (is_overflow || is_carry) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(ULESS_FLAG) | IMM(src2), ULESS_FLAG));
+ FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
else {
- FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | SA(0) | TA(ULESS_FLAG) | IMM(src2), ULESS_FLAG));
- FAIL_IF(push_inst(compiler, OR | S(src1) | TA(ULESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG));
+ FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | SA(0) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
}
}
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | T(dst) | IMM(src2), DR(dst)));
}
else {
- if (op & SLJIT_SET_O)
- FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- if (op & SLJIT_SET_E)
+ if (is_overflow)
+ FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (op & (SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(ULESS_FLAG), ULESS_FLAG));
+
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(src1) | T(src2) | D(dst), DR(dst)));
}
/* a + b >= a | b (otherwise, the carry should be set to 1). */
- if (op & (SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(ULESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG));
- if (!(op & SLJIT_SET_O))
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
+ if (!is_overflow)
return SLJIT_SUCCESS;
- FAIL_IF(push_inst(compiler, SELECT_OP(DSLL32, SLL) | TA(ULESS_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
- FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- return push_inst(compiler, SELECT_OP(DSRL32, SLL) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG) | SH_IMM(31), OVERFLOW_FLAG);
+ FAIL_IF(push_inst(compiler, SELECT_OP(DSLL32, SLL) | TA(OTHER_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
+ FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(EQUAL_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ return push_inst(compiler, SELECT_OP(DSRL32, SRL) | TA(OTHER_FLAG) | DA(OTHER_FLAG) | SH_IMM(31), OTHER_FLAG);
case SLJIT_ADDC:
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_C) {
+ if (is_carry) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(OVERFLOW_FLAG) | IMM(src2), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, ORI | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
else {
- FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | SA(0) | TA(OVERFLOW_FLAG) | IMM(src2), OVERFLOW_FLAG));
- FAIL_IF(push_inst(compiler, OR | S(src1) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | SA(0) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
}
}
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | T(dst) | IMM(src2), DR(dst)));
} else {
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
/* dst may be the same as src1 or src2. */
FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(src1) | T(src2) | D(dst), DR(dst)));
}
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
- FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(dst) | TA(ULESS_FLAG) | D(dst), DR(dst)));
- if (!(op & SLJIT_SET_C))
+ FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(dst) | TA(OTHER_FLAG) | D(dst), DR(dst)));
+ if (!is_carry)
return SLJIT_SUCCESS;
- /* Set ULESS_FLAG (dst == 0) && (ULESS_FLAG == 1). */
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(ULESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG));
+ /* Set ULESS_FLAG (dst == 0) && (OTHER_FLAG == 1). */
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
/* Set carry flag. */
- return push_inst(compiler, OR | SA(ULESS_FLAG) | TA(OVERFLOW_FLAG) | DA(ULESS_FLAG), ULESS_FLAG);
+ return push_inst(compiler, OR | SA(OTHER_FLAG) | TA(EQUAL_FLAG) | DA(OTHER_FLAG), OTHER_FLAG);
case SLJIT_SUB:
- if ((flags & SRC2_IMM) && ((op & (SLJIT_SET_U | SLJIT_SET_S)) || src2 == SIMM_MIN)) {
+ if ((flags & SRC2_IMM) && src2 == SIMM_MIN) {
FAIL_IF(push_inst(compiler, ADDIU | SA(0) | T(TMP_REG2) | IMM(src2), DR(TMP_REG2)));
src2 = TMP_REG2;
flags &= ~SRC2_IMM;
}
+ is_handled = 0;
+
+ if (flags & SRC2_IMM) {
+ if (GET_FLAG_TYPE(op) == SLJIT_LESS || GET_FLAG_TYPE(op) == SLJIT_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
+ is_handled = 1;
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_SIG_LESS || GET_FLAG_TYPE(op) == SLJIT_SIG_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLTI | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
+ is_handled = 1;
+ }
+ }
+
+ if (!is_handled && GET_FLAG_TYPE(op) >= SLJIT_LESS && GET_FLAG_TYPE(op) <= SLJIT_SIG_LESS_EQUAL) {
+ is_handled = 1;
+
+ if (flags & SRC2_IMM) {
+ FAIL_IF(push_inst(compiler, ADDIU | SA(0) | T(TMP_REG2) | IMM(src2), DR(TMP_REG2)));
+ src2 = TMP_REG2;
+ flags &= ~SRC2_IMM;
+ }
+
+ if (GET_FLAG_TYPE(op) == SLJIT_LESS || GET_FLAG_TYPE(op) == SLJIT_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_GREATER || GET_FLAG_TYPE(op) == SLJIT_LESS_EQUAL)
+ {
+ FAIL_IF(push_inst(compiler, SLTU | S(src2) | T(src1) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_SIG_LESS || GET_FLAG_TYPE(op) == SLJIT_SIG_GREATER_EQUAL) {
+ FAIL_IF(push_inst(compiler, SLT | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ else if (GET_FLAG_TYPE(op) == SLJIT_SIG_GREATER || GET_FLAG_TYPE(op) == SLJIT_SIG_LESS_EQUAL)
+ {
+ FAIL_IF(push_inst(compiler, SLT | S(src2) | T(src1) | DA(OTHER_FLAG), OTHER_FLAG));
+ }
+ }
+
+ if (is_handled) {
+ if (flags & SRC2_IMM) {
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | TA(EQUAL_FLAG) | IMM(-src2), EQUAL_FLAG));
+ if (!(flags & UNUSED_DEST))
+ return push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | T(dst) | IMM(-src2), DR(dst));
+ }
+ else {
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ if (!(flags & UNUSED_DEST))
+ return push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(src1) | T(src2) | D(dst), DR(dst));
+ }
+ return SLJIT_SUCCESS;
+ }
+
+ is_overflow = GET_FLAG_TYPE(op) == SLJIT_OVERFLOW;
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_O) {
+ if (is_overflow) {
if (src2 >= 0)
- FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, OR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
else
- FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ FAIL_IF(push_inst(compiler, NOR | S(src1) | T(src1) | DA(EQUAL_FLAG), EQUAL_FLAG));
}
- if (op & SLJIT_SET_E)
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | TA(EQUAL_FLAG) | IMM(-src2), EQUAL_FLAG));
- if (op & (SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(ULESS_FLAG) | IMM(src2), ULESS_FLAG));
+
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(OTHER_FLAG) | IMM(src2), OTHER_FLAG));
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | T(dst) | IMM(-src2), DR(dst)));
}
else {
- if (op & SLJIT_SET_O)
- FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- if (op & SLJIT_SET_E)
+ if (is_overflow)
+ FAIL_IF(push_inst(compiler, XOR | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ else if (op & SLJIT_SET_Z)
FAIL_IF(push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
- if (op & (SLJIT_SET_U | SLJIT_SET_C | SLJIT_SET_O))
- FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(ULESS_FLAG), ULESS_FLAG));
- if (op & SLJIT_SET_U)
- FAIL_IF(push_inst(compiler, SLTU | S(src2) | T(src1) | DA(UGREATER_FLAG), UGREATER_FLAG));
- if (op & SLJIT_SET_S) {
- FAIL_IF(push_inst(compiler, SLT | S(src1) | T(src2) | DA(LESS_FLAG), LESS_FLAG));
- FAIL_IF(push_inst(compiler, SLT | S(src2) | T(src1) | DA(GREATER_FLAG), GREATER_FLAG));
- }
+
+ if (is_overflow || is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(OTHER_FLAG), OTHER_FLAG));
/* dst may be the same as src1 or src2. */
- if (CHECK_FLAGS(SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))
+ if (!(flags & UNUSED_DEST) || (op & VARIABLE_FLAG_MASK))
FAIL_IF(push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(src1) | T(src2) | D(dst), DR(dst)));
}
- if (!(op & SLJIT_SET_O))
+ if (!is_overflow)
return SLJIT_SUCCESS;
- FAIL_IF(push_inst(compiler, SELECT_OP(DSLL32, SLL) | TA(ULESS_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
- FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
- return push_inst(compiler, SELECT_OP(DSRL32, SRL) | TA(OVERFLOW_FLAG) | DA(OVERFLOW_FLAG) | SH_IMM(31), OVERFLOW_FLAG);
+ FAIL_IF(push_inst(compiler, SELECT_OP(DSLL32, SLL) | TA(OTHER_FLAG) | D(TMP_REG1) | SH_IMM(31), DR(TMP_REG1)));
+ FAIL_IF(push_inst(compiler, XOR | S(TMP_REG1) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ FAIL_IF(push_inst(compiler, XOR | S(dst) | TA(EQUAL_FLAG) | DA(OTHER_FLAG), OTHER_FLAG));
+ if (op & SLJIT_SET_Z)
+ FAIL_IF(push_inst(compiler, SELECT_OP(DADDU, ADDU) | S(dst) | TA(0) | DA(EQUAL_FLAG), EQUAL_FLAG));
+ return push_inst(compiler, SELECT_OP(DSRL32, SRL) | TA(OTHER_FLAG) | DA(OTHER_FLAG) | SH_IMM(31), OTHER_FLAG);
case SLJIT_SUBC:
if ((flags & SRC2_IMM) && src2 == SIMM_MIN) {
@@ -369,28 +434,31 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
flags &= ~SRC2_IMM;
}
+ is_carry = GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY);
+
if (flags & SRC2_IMM) {
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(OVERFLOW_FLAG) | IMM(src2), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTIU | S(src1) | TA(EQUAL_FLAG) | IMM(src2), EQUAL_FLAG));
/* dst may be the same as src1 or src2. */
FAIL_IF(push_inst(compiler, SELECT_OP(DADDIU, ADDIU) | S(src1) | T(dst) | IMM(-src2), DR(dst)));
}
else {
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(src1) | T(src2) | DA(EQUAL_FLAG), EQUAL_FLAG));
/* dst may be the same as src1 or src2. */
FAIL_IF(push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(src1) | T(src2) | D(dst), DR(dst)));
}
- if (op & SLJIT_SET_C)
- FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(ULESS_FLAG) | DA(LESS_FLAG), LESS_FLAG));
+ if (is_carry)
+ FAIL_IF(push_inst(compiler, SLTU | S(dst) | TA(OTHER_FLAG) | D(TMP_REG1), DR(TMP_REG1)));
- FAIL_IF(push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(dst) | TA(ULESS_FLAG) | D(dst), DR(dst)));
- return (op & SLJIT_SET_C) ? push_inst(compiler, OR | SA(OVERFLOW_FLAG) | TA(LESS_FLAG) | DA(ULESS_FLAG), ULESS_FLAG) : SLJIT_SUCCESS;
+ FAIL_IF(push_inst(compiler, SELECT_OP(DSUBU, SUBU) | S(dst) | TA(OTHER_FLAG) | D(dst), DR(dst)));
+ return (is_carry) ? push_inst(compiler, OR | SA(EQUAL_FLAG) | T(TMP_REG1) | DA(OTHER_FLAG), OTHER_FLAG) : SLJIT_SUCCESS;
case SLJIT_MUL:
SLJIT_ASSERT(!(flags & SRC2_IMM));
- if (!(op & SLJIT_SET_O)) {
+
+ if (GET_FLAG_TYPE(op) != SLJIT_MUL_OVERFLOW) {
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
if (op & SLJIT_I32_OP)
return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst));
@@ -402,10 +470,10 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
#endif
}
FAIL_IF(push_inst(compiler, SELECT_OP(DMULT, MULT) | S(src1) | T(src2), MOVABLE_INS));
- FAIL_IF(push_inst(compiler, MFHI | DA(ULESS_FLAG), ULESS_FLAG));
+ FAIL_IF(push_inst(compiler, MFHI | DA(EQUAL_FLAG), EQUAL_FLAG));
FAIL_IF(push_inst(compiler, MFLO | D(dst), DR(dst)));
- FAIL_IF(push_inst(compiler, SELECT_OP(DSRA32, SRA) | T(dst) | DA(UGREATER_FLAG) | SH_IMM(31), UGREATER_FLAG));
- return push_inst(compiler, SELECT_OP(DSUBU, SUBU) | SA(ULESS_FLAG) | TA(UGREATER_FLAG) | DA(OVERFLOW_FLAG), OVERFLOW_FLAG);
+ FAIL_IF(push_inst(compiler, SELECT_OP(DSRA32, SRA) | T(dst) | DA(OTHER_FLAG) | SH_IMM(31), OTHER_FLAG));
+ return push_inst(compiler, SELECT_OP(DSUBU, SUBU) | SA(EQUAL_FLAG) | TA(OTHER_FLAG) | DA(OTHER_FLAG), OTHER_FLAG);
case SLJIT_AND:
EMIT_LOGICAL(ANDI, AND);
@@ -432,7 +500,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return SLJIT_SUCCESS;
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
}
@@ -469,3 +537,132 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
SLJIT_CACHE_FLUSH(inst, inst + 6);
}
+
+static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_ins *ins_ptr)
+{
+ sljit_s32 arg_count = 0;
+ sljit_s32 word_arg_count = 0;
+ sljit_s32 float_arg_count = 0;
+ sljit_s32 types = 0;
+ sljit_ins prev_ins = NOP;
+ sljit_ins ins = NOP;
+
+ SLJIT_ASSERT(reg_map[TMP_REG3] == 4 && freg_map[TMP_FREG1] == 12);
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ case SLJIT_ARG_TYPE_F64:
+ arg_count++;
+ float_arg_count++;
+ break;
+ default:
+ arg_count++;
+ word_arg_count++;
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ if (arg_count != float_arg_count)
+ ins = MOV_S | FMT_S | FS(float_arg_count) | FD(arg_count);
+ else if (arg_count == 1)
+ ins = MOV_S | FMT_S | FS(SLJIT_FR0) | FD(TMP_FREG1);
+ arg_count--;
+ float_arg_count--;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (arg_count != float_arg_count)
+ ins = MOV_S | FMT_D | FS(float_arg_count) | FD(arg_count);
+ else if (arg_count == 1)
+ ins = MOV_S | FMT_D | FS(SLJIT_FR0) | FD(TMP_FREG1);
+ arg_count--;
+ float_arg_count--;
+ break;
+ default:
+ if (arg_count != word_arg_count)
+ ins = DADDU | S(word_arg_count) | TA(0) | D(arg_count);
+ else if (arg_count == 1)
+ ins = DADDU | S(SLJIT_R0) | TA(0) | D(TMP_REG3);
+ arg_count--;
+ word_arg_count--;
+ break;
+ }
+
+ if (ins != NOP) {
+ if (prev_ins != NOP)
+ FAIL_IF(push_inst(compiler, prev_ins, MOVABLE_INS));
+ prev_ins = ins;
+ ins = NOP;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
+ *ins_ptr = prev_ins;
+
+ return SLJIT_SUCCESS;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ struct sljit_jump *jump;
+ sljit_ins ins;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+ jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
+ PTR_FAIL_IF(!jump);
+ set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
+ type &= 0xff;
+
+ PTR_FAIL_IF(call_with_args(compiler, arg_types, &ins));
+
+ SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
+
+ PTR_FAIL_IF(emit_const(compiler, PIC_ADDR_REG, 0));
+
+ jump->flags |= IS_JAL | IS_CALL;
+ PTR_FAIL_IF(push_inst(compiler, JALR | S(PIC_ADDR_REG) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
+ jump->addr = compiler->size;
+ PTR_FAIL_IF(push_inst(compiler, ins, UNMOVABLE_INS));
+
+ return jump;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_ins ins;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+ SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
+
+ if (src & SLJIT_IMM)
+ FAIL_IF(load_immediate(compiler, DR(PIC_ADDR_REG), srcw));
+ else if (FAST_IS_REG(src))
+ FAIL_IF(push_inst(compiler, DADDU | S(src) | TA(0) | D(PIC_ADDR_REG), DR(PIC_ADDR_REG)));
+ else if (src & SLJIT_MEM) {
+ ADJUST_LOCAL_OFFSET(src, srcw);
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, DR(PIC_ADDR_REG), src, srcw));
+ }
+
+ FAIL_IF(call_with_args(compiler, arg_types, &ins));
+
+ /* Register input. */
+ FAIL_IF(push_inst(compiler, JALR | S(PIC_ADDR_REG) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
+ return push_inst(compiler, ins, UNMOVABLE_INS);
+}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeMIPS_common.c b/thirdparty/pcre2/src/sljit/sljitNativeMIPS_common.c
index fe37e3ef00..e108433f70 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeMIPS_common.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeMIPS_common.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -57,21 +57,30 @@ typedef sljit_u32 sljit_ins;
#define RETURN_ADDR_REG 31
/* Flags are kept in volatile registers. */
-#define EQUAL_FLAG 12
-/* And carry flag as well. */
-#define ULESS_FLAG 13
-#define UGREATER_FLAG 14
-#define LESS_FLAG 15
-#define GREATER_FLAG 31
-#define OVERFLOW_FLAG 1
+#define EQUAL_FLAG 31
+#define OTHER_FLAG 1
-#define TMP_FREG1 (0)
-#define TMP_FREG2 ((SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1) << 1)
+#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
- 0, 2, 5, 6, 7, 8, 9, 10, 11, 24, 23, 22, 21, 20, 19, 18, 17, 16, 29, 3, 25, 4
+ 0, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 24, 23, 22, 21, 20, 19, 18, 17, 16, 29, 3, 25, 4
};
+#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 0, 14, 2, 4, 6, 8, 12, 10
+};
+
+#else
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 0, 13, 14, 15, 16, 17, 12, 18
+};
+
+#endif
+
/* --------------------------------------------------------------------- */
/* Instrucion forms */
/* --------------------------------------------------------------------- */
@@ -79,21 +88,23 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#define S(s) (reg_map[s] << 21)
#define T(t) (reg_map[t] << 16)
#define D(d) (reg_map[d] << 11)
+#define FT(t) (freg_map[t] << 16)
+#define FS(s) (freg_map[s] << 11)
+#define FD(d) (freg_map[d] << 6)
/* Absolute registers. */
#define SA(s) ((s) << 21)
#define TA(t) ((t) << 16)
#define DA(d) ((d) << 11)
-#define FT(t) ((t) << 16)
-#define FS(s) ((s) << 11)
-#define FD(d) ((d) << 6)
#define IMM(imm) ((imm) & 0xffff)
#define SH_IMM(imm) ((imm) << 6)
#define DR(dr) (reg_map[dr])
+#define FR(dr) (freg_map[dr])
#define HI(opcode) ((opcode) << 26)
#define LO(opcode) (opcode)
/* S = (16 << 21) D = (17 << 21) */
#define FMT_S (16 << 21)
+#define FMT_D (17 << 21)
#define ABS_S (HI(17) | FMT_S | LO(5))
#define ADD_S (HI(17) | FMT_S | LO(0))
@@ -158,6 +169,7 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#define OR (HI(0) | LO(37))
#define ORI (HI(13))
#define SD (HI(63))
+#define SDC1 (HI(61))
#define SLT (HI(0) | LO(42))
#define SLTI (HI(10))
#define SLTIU (HI(11))
@@ -171,6 +183,7 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#define SUB_S (HI(17) | FMT_S | LO(1))
#define SUBU (HI(0) | LO(35))
#define SW (HI(43))
+#define SWC1 (HI(57))
#define TRUNC_W_S (HI(17) | FMT_S | LO(13))
#define XOR (HI(0) | LO(38))
#define XORI (HI(14))
@@ -178,7 +191,13 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
#define CLZ (HI(28) | LO(32))
#define DCLZ (HI(28) | LO(36))
+#define MOVF (HI(0) | (0 << 16) | LO(1))
+#define MOVN (HI(0) | LO(11))
+#define MOVT (HI(0) | (1 << 16) | LO(1))
+#define MOVZ (HI(0) | LO(10))
#define MUL (HI(28) | LO(2))
+#define PREF (HI(51))
+#define PREFX (HI(19) | LO(15))
#define SEB (HI(31) | (16 << 6) | LO(32))
#define SEH (HI(31) | (24 << 6) | LO(32))
#endif
@@ -495,6 +514,32 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
return code;
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ sljit_sw fir = 0;
+
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#elif defined(__GNUC__)
+ asm ("cfc1 %0, $0" : "=r"(fir));
+ return (fir >> 22) & 0x1;
+#else
+#error "FIR check is not implemented for this architecture"
+#endif
+
+#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
+ case SLJIT_HAS_CLZ:
+ case SLJIT_HAS_CMOV:
+ return 1;
+#endif
+
+ default:
+ return fir;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Entry, exit */
/* --------------------------------------------------------------------- */
@@ -513,25 +558,20 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
#define MEM_MASK 0x1f
-#define WRITE_BACK 0x00020
-#define ARG_TEST 0x00040
-#define ALT_KEEP_CACHE 0x00080
-#define CUMULATIVE_OP 0x00100
-#define LOGICAL_OP 0x00200
-#define IMM_OP 0x00400
-#define SRC2_IMM 0x00800
-
-#define UNUSED_DEST 0x01000
-#define REG_DEST 0x02000
-#define REG1_SOURCE 0x04000
-#define REG2_SOURCE 0x08000
-#define SLOW_SRC1 0x10000
-#define SLOW_SRC2 0x20000
-#define SLOW_DEST 0x40000
-
-/* Only these flags are set. UNUSED_DEST is not set when no flags should be set. */
-#define CHECK_FLAGS(list) \
- (!(flags & UNUSED_DEST) || (op & GET_FLAGS(~(list))))
+#define ARG_TEST 0x00020
+#define ALT_KEEP_CACHE 0x00040
+#define CUMULATIVE_OP 0x00080
+#define LOGICAL_OP 0x00100
+#define IMM_OP 0x00200
+#define SRC2_IMM 0x00400
+
+#define UNUSED_DEST 0x00800
+#define REG_DEST 0x01000
+#define REG1_SOURCE 0x02000
+#define REG2_SOURCE 0x04000
+#define SLOW_SRC1 0x08000
+#define SLOW_SRC2 0x10000
+#define SLOW_DEST 0x20000
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
#define STACK_STORE SW
@@ -541,6 +581,8 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
#define STACK_LOAD LD
#endif
+static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, sljit_s32 arg, sljit_sw argw);
+
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
#include "sljitNativeMIPS_32.c"
#else
@@ -548,15 +590,15 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
#endif
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
sljit_ins base;
- sljit_s32 i, tmp, offs;
+ sljit_s32 args, i, tmp, offs;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1) + SLJIT_LOCALS_OFFSET;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
@@ -593,6 +635,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
FAIL_IF(push_inst(compiler, STACK_STORE | base | T(i) | IMM(offs), MOVABLE_INS));
}
+ args = get_arg_count(arg_types);
+
if (args >= 1)
FAIL_IF(push_inst(compiler, ADDU_W | SA(4) | TA(0) | D(SLJIT_S0), DR(SLJIT_S0)));
if (args >= 2)
@@ -604,12 +648,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1) + SLJIT_LOCALS_OFFSET;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
@@ -711,7 +755,7 @@ static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flag
{
SLJIT_ASSERT(arg & SLJIT_MEM);
- if ((!(flags & WRITE_BACK) || !(arg & REG_MASK)) && !(arg & OFFS_REG_MASK) && argw <= SIMM_MAX && argw >= SIMM_MIN) {
+ if (!(arg & OFFS_REG_MASK) && argw <= SIMM_MAX && argw >= SIMM_MIN) {
/* Works for both absoulte and relative addresses. */
if (SLJIT_UNLIKELY(flags & ARG_TEST))
return 1;
@@ -769,33 +813,21 @@ static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sl
if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
argw &= 0x3;
- if ((flags & WRITE_BACK) && reg_ar == DR(base)) {
- SLJIT_ASSERT(!(flags & LOAD_DATA) && DR(TMP_REG1) != reg_ar);
- FAIL_IF(push_inst(compiler, ADDU_W | SA(reg_ar) | TA(0) | D(TMP_REG1), DR(TMP_REG1)));
- reg_ar = DR(TMP_REG1);
- }
/* Using the cache. */
if (argw == compiler->cache_argw) {
- if (!(flags & WRITE_BACK)) {
- if (arg == compiler->cache_arg)
+ if (arg == compiler->cache_arg)
+ return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay_slot);
+
+ if ((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg) {
+ if (arg == next_arg && argw == (next_argw & 0x3)) {
+ compiler->cache_arg = arg;
+ compiler->cache_argw = argw;
+ FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | D(TMP_REG3), DR(TMP_REG3)));
return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay_slot);
- if ((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg) {
- if (arg == next_arg && argw == (next_argw & 0x3)) {
- compiler->cache_arg = arg;
- compiler->cache_argw = argw;
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | D(TMP_REG3), DR(TMP_REG3)));
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay_slot);
- }
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | DA(tmp_ar), tmp_ar));
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_slot);
- }
- }
- else {
- if ((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg) {
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | D(base), DR(base)));
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(base) | TA(reg_ar), delay_slot);
}
+ FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | DA(tmp_ar), tmp_ar));
+ return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_slot);
}
}
@@ -805,55 +837,15 @@ static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sl
FAIL_IF(push_inst(compiler, SLL_W | T(OFFS_REG(arg)) | D(TMP_REG3) | SH_IMM(argw), DR(TMP_REG3)));
}
- if (!(flags & WRITE_BACK)) {
- if (arg == next_arg && argw == (next_argw & 0x3)) {
- compiler->cache_arg = arg;
- compiler->cache_argw = argw;
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | D(TMP_REG3), DR(TMP_REG3)));
- tmp_ar = DR(TMP_REG3);
- }
- else
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | DA(tmp_ar), tmp_ar));
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_slot);
- }
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | D(base), DR(base)));
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(base) | TA(reg_ar), delay_slot);
- }
-
- if (SLJIT_UNLIKELY(flags & WRITE_BACK) && base) {
- /* Update only applies if a base register exists. */
- if (reg_ar == DR(base)) {
- SLJIT_ASSERT(!(flags & LOAD_DATA) && DR(TMP_REG1) != reg_ar);
- if (argw <= SIMM_MAX && argw >= SIMM_MIN) {
- FAIL_IF(push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(base) | TA(reg_ar) | IMM(argw), MOVABLE_INS));
- if (argw)
- return push_inst(compiler, ADDIU_W | S(base) | T(base) | IMM(argw), DR(base));
- return SLJIT_SUCCESS;
- }
- FAIL_IF(push_inst(compiler, ADDU_W | SA(reg_ar) | TA(0) | D(TMP_REG1), DR(TMP_REG1)));
- reg_ar = DR(TMP_REG1);
- }
-
- if (argw <= SIMM_MAX && argw >= SIMM_MIN) {
- if (argw)
- FAIL_IF(push_inst(compiler, ADDIU_W | S(base) | T(base) | IMM(argw), DR(base)));
- }
- else {
- if (compiler->cache_arg == SLJIT_MEM && argw - compiler->cache_argw <= SIMM_MAX && argw - compiler->cache_argw >= SIMM_MIN) {
- if (argw != compiler->cache_argw) {
- FAIL_IF(push_inst(compiler, ADDIU_W | S(TMP_REG3) | T(TMP_REG3) | IMM(argw - compiler->cache_argw), DR(TMP_REG3)));
- compiler->cache_argw = argw;
- }
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | D(base), DR(base)));
- }
- else {
- compiler->cache_arg = SLJIT_MEM;
- compiler->cache_argw = argw;
- FAIL_IF(load_immediate(compiler, DR(TMP_REG3), argw));
- FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | D(base), DR(base)));
- }
+ if (arg == next_arg && argw == (next_argw & 0x3)) {
+ compiler->cache_arg = arg;
+ compiler->cache_argw = argw;
+ FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | D(TMP_REG3), DR(TMP_REG3)));
+ tmp_ar = DR(TMP_REG3);
}
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(base) | TA(reg_ar), delay_slot);
+ else
+ FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | DA(tmp_ar), tmp_ar));
+ return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_slot);
}
if (compiler->cache_arg == arg && argw - compiler->cache_argw <= SIMM_MAX && argw - compiler->cache_argw >= SIMM_MIN) {
@@ -923,15 +915,13 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
}
if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
- return SLJIT_SUCCESS;
- if (GET_FLAGS(op))
- flags |= UNUSED_DEST;
+ SLJIT_ASSERT(HAS_FLAGS(op));
+ flags |= UNUSED_DEST;
}
else if (FAST_IS_REG(dst)) {
dst_r = dst;
flags |= REG_DEST;
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
+ if (op >= SLJIT_MOV && op <= SLJIT_MOV_P)
sugg_src2_r = dst_r;
}
else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, DR(TMP_REG1), dst, dstw))
@@ -985,7 +975,7 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
if (FAST_IS_REG(src2)) {
src2_r = src2;
flags |= REG2_SOURCE;
- if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
+ if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOV_P)
dst_r = src2_r;
}
else if (src2 & SLJIT_IMM) {
@@ -996,7 +986,7 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
}
else {
src2_r = 0;
- if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_S32) && (dst & SLJIT_MEM))
+ if ((op >= SLJIT_MOV && op <= SLJIT_MOV_P) && (dst & SLJIT_MEM))
dst_r = 0;
}
}
@@ -1088,6 +1078,29 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
return SLJIT_SUCCESS;
}
+#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
+static sljit_s32 emit_prefetch(struct sljit_compiler *compiler,
+ sljit_s32 src, sljit_sw srcw)
+{
+ if (!(src & OFFS_REG_MASK)) {
+ if (srcw <= SIMM_MAX && srcw >= SIMM_MIN)
+ return push_inst(compiler, PREF | S(src & REG_MASK) | IMM(srcw), MOVABLE_INS);
+
+ FAIL_IF(load_immediate(compiler, DR(TMP_REG1), srcw));
+ return push_inst(compiler, PREFX | S(src & REG_MASK) | T(TMP_REG1), MOVABLE_INS);
+ }
+
+ srcw &= 0x3;
+
+ if (SLJIT_UNLIKELY(srcw != 0)) {
+ FAIL_IF(push_inst(compiler, SLL_W | T(OFFS_REG(src)) | D(TMP_REG1) | SH_IMM(srcw), DR(TMP_REG1)));
+ return push_inst(compiler, PREFX | S(src & REG_MASK) | T(TMP_REG1), MOVABLE_INS);
+ }
+
+ return push_inst(compiler, PREFX | S(src & REG_MASK) | T(OFFS_REG(src)), MOVABLE_INS);
+}
+#endif
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
@@ -1103,12 +1116,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op)) {
+#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
+ if (op <= SLJIT_MOV_P && (src & SLJIT_MEM))
+ return emit_prefetch(compiler, src, srcw);
+#endif
+ return SLJIT_SUCCESS;
+ }
+
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
- if ((op & SLJIT_I32_OP) && GET_OPCODE(op) >= SLJIT_NOT) {
+ if ((op & SLJIT_I32_OP) && GET_OPCODE(op) >= SLJIT_NOT)
flags |= INT_DATA | SIGNED_DATA;
- if (src & SLJIT_IMM)
- srcw = (sljit_s32)srcw;
- }
#endif
switch (GET_OPCODE(op)) {
@@ -1142,36 +1160,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
case SLJIT_MOV_S16:
return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
- case SLJIT_MOVU:
- case SLJIT_MOVU_P:
- return emit_op(compiler, SLJIT_MOV, WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-
- case SLJIT_MOVU_U32:
-#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
- return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-#else
- return emit_op(compiler, SLJIT_MOV_U32, INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u32)srcw : srcw);
-#endif
-
- case SLJIT_MOVU_S32:
-#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
- return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-#else
- return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s32)srcw : srcw);
-#endif
-
- case SLJIT_MOVU_U8:
- return emit_op(compiler, SLJIT_MOV_U8, BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
-
- case SLJIT_MOVU_S8:
- return emit_op(compiler, SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
-
- case SLJIT_MOVU_U16:
- return emit_op(compiler, SLJIT_MOV_U16, HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
-
- case SLJIT_MOVU_S16:
- return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
-
case SLJIT_NOT:
return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -1182,6 +1170,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw);
}
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
@@ -1206,6 +1195,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
+
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
if (op & SLJIT_I32_OP) {
flags |= INT_DATA | SIGNED_DATA;
@@ -1250,6 +1242,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w);
}
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
@@ -1266,7 +1259,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
- return reg << 1;
+ return FR(reg);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -1282,19 +1275,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#elif defined(__GNUC__)
- sljit_sw fir;
- asm ("cfc1 %0, $0" : "=r"(fir));
- return (fir >> 22) & 0x1;
-#else
-#error "FIR check is not implemented for this architecture"
-#endif
-}
-
#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 7))
#define FMT(op) (((op & SLJIT_F32_OP) ^ SLJIT_F32_OP) << (21 - 8))
@@ -1309,22 +1289,17 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
#endif
if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src, srcw, dst, dstw));
src = TMP_FREG1;
}
- else
- src <<= 1;
FAIL_IF(push_inst(compiler, (TRUNC_W_S ^ (flags >> 19)) | FMT(op) | FS(src) | FD(TMP_FREG1), MOVABLE_INS));
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
return push_inst(compiler, MFC1 | flags | T(dst) | FS(TMP_FREG1), MOVABLE_INS);
/* Store the integer value from a VFP register. */
- return emit_op_mem2(compiler, flags ? DOUBLE_DATA : SINGLE_DATA, TMP_FREG1, dst, dstw, 0, 0);
+ return emit_op_mem2(compiler, flags ? DOUBLE_DATA : SINGLE_DATA, FR(TMP_FREG1), dst, dstw, 0, 0);
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
# undef is_long
@@ -1341,13 +1316,13 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
sljit_s32 flags = (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_SW) << 21;
#endif
- sljit_s32 dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
+ sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, MTC1 | flags | T(src) | FS(TMP_FREG1), MOVABLE_INS));
else if (src & SLJIT_MEM) {
/* Load the integer value into a VFP register. */
- FAIL_IF(emit_op_mem2(compiler, ((flags) ? DOUBLE_DATA : SINGLE_DATA) | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem2(compiler, ((flags) ? DOUBLE_DATA : SINGLE_DATA) | LOAD_DATA, FR(TMP_FREG1), src, srcw, dst, dstw));
}
else {
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -1361,7 +1336,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
FAIL_IF(push_inst(compiler, CVT_S_S | flags | (4 << 21) | (((op & SLJIT_F32_OP) ^ SLJIT_F32_OP) >> 8) | FS(TMP_FREG1) | FD(dst_r), MOVABLE_INS));
if (dst & SLJIT_MEM)
- return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
+ return emit_op_mem2(compiler, FLOAT_DATA(op), FR(TMP_FREG1), dst, dstw, 0, 0);
return SLJIT_SUCCESS;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
@@ -1373,39 +1348,38 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
+ sljit_ins inst;
+
if (src1 & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
+ FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, src2, src2w));
src1 = TMP_FREG1;
}
- else
- src1 <<= 1;
if (src2 & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, 0, 0));
+ FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, 0, 0));
src2 = TMP_FREG2;
}
- else
- src2 <<= 1;
-
- /* src2 and src1 are swapped. */
- if (op & SLJIT_SET_E) {
- FAIL_IF(push_inst(compiler, C_UEQ_S | FMT(op) | FT(src2) | FS(src1), UNMOVABLE_INS));
- FAIL_IF(push_inst(compiler, CFC1 | TA(EQUAL_FLAG) | DA(FCSR_REG), EQUAL_FLAG));
- FAIL_IF(push_inst(compiler, SRL | TA(EQUAL_FLAG) | DA(EQUAL_FLAG) | SH_IMM(23), EQUAL_FLAG));
- FAIL_IF(push_inst(compiler, ANDI | SA(EQUAL_FLAG) | TA(EQUAL_FLAG) | IMM(1), EQUAL_FLAG));
- }
- if (op & SLJIT_SET_S) {
- /* Mixing the instructions for the two checks. */
- FAIL_IF(push_inst(compiler, C_ULT_S | FMT(op) | FT(src2) | FS(src1), UNMOVABLE_INS));
- FAIL_IF(push_inst(compiler, CFC1 | TA(ULESS_FLAG) | DA(FCSR_REG), ULESS_FLAG));
- FAIL_IF(push_inst(compiler, C_ULT_S | FMT(op) | FT(src1) | FS(src2), UNMOVABLE_INS));
- FAIL_IF(push_inst(compiler, SRL | TA(ULESS_FLAG) | DA(ULESS_FLAG) | SH_IMM(23), ULESS_FLAG));
- FAIL_IF(push_inst(compiler, ANDI | SA(ULESS_FLAG) | TA(ULESS_FLAG) | IMM(1), ULESS_FLAG));
- FAIL_IF(push_inst(compiler, CFC1 | TA(UGREATER_FLAG) | DA(FCSR_REG), UGREATER_FLAG));
- FAIL_IF(push_inst(compiler, SRL | TA(UGREATER_FLAG) | DA(UGREATER_FLAG) | SH_IMM(23), UGREATER_FLAG));
- FAIL_IF(push_inst(compiler, ANDI | SA(UGREATER_FLAG) | TA(UGREATER_FLAG) | IMM(1), UGREATER_FLAG));
- }
- return push_inst(compiler, C_UN_S | FMT(op) | FT(src2) | FS(src1), FCSR_FCC);
+
+ switch (GET_FLAG_TYPE(op)) {
+ case SLJIT_EQUAL_F64:
+ case SLJIT_NOT_EQUAL_F64:
+ inst = C_UEQ_S;
+ break;
+ case SLJIT_LESS_F64:
+ case SLJIT_GREATER_EQUAL_F64:
+ inst = C_ULT_S;
+ break;
+ case SLJIT_GREATER_F64:
+ case SLJIT_LESS_EQUAL_F64:
+ inst = C_ULE_S;
+ break;
+ default:
+ SLJIT_ASSERT(GET_FLAG_TYPE(op) == SLJIT_UNORDERED_F64 || GET_FLAG_TYPE(op) == SLJIT_ORDERED_F64);
+ inst = C_UN_S;
+ break;
+ }
+
+ return push_inst(compiler, inst | FMT(op) | FT(src2) | FS(src1), UNMOVABLE_INS);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
@@ -1424,14 +1398,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
op ^= SLJIT_F32_OP;
- dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, dst_r, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(dst_r), src, srcw, dst, dstw));
src = dst_r;
}
- else
- src <<= 1;
switch (GET_OPCODE(op)) {
case SLJIT_MOV_F64:
@@ -1455,7 +1427,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
}
if (dst & SLJIT_MEM)
- return emit_op_mem2(compiler, FLOAT_DATA(op), dst_r, dst, dstw, 0, 0);
+ return emit_op_mem2(compiler, FLOAT_DATA(op), FR(dst_r), dst, dstw, 0, 0);
return SLJIT_SUCCESS;
}
@@ -1475,42 +1447,38 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
compiler->cache_arg = 0;
compiler->cache_argw = 0;
- dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG2;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG2;
if (src1 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w)) {
+ if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w)) {
FAIL_IF(compiler->error);
src1 = TMP_FREG1;
} else
flags |= SLOW_SRC1;
}
- else
- src1 <<= 1;
if (src2 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w)) {
+ if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w)) {
FAIL_IF(compiler->error);
src2 = TMP_FREG2;
} else
flags |= SLOW_SRC2;
}
- else
- src2 <<= 1;
if ((flags & (SLOW_SRC1 | SLOW_SRC2)) == (SLOW_SRC1 | SLOW_SRC2)) {
if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, src1, src1w));
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw));
+ FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, src1, src1w));
+ FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, dst, dstw));
}
else {
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw));
+ FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, src2, src2w));
+ FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, dst, dstw));
}
}
else if (flags & SLOW_SRC1)
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw));
+ FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, dst, dstw));
else if (flags & SLOW_SRC2)
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw));
+ FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, dst, dstw));
if (flags & SLOW_SRC1)
src1 = TMP_FREG1;
@@ -1536,7 +1504,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
}
if (dst_r == TMP_FREG2)
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG2, dst, dstw, 0, 0));
+ FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), FR(TMP_FREG2), dst, dstw, 0, 0));
return SLJIT_SUCCESS;
}
@@ -1551,10 +1519,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
- /* For UNUSED dst. Uncommon, but possible. */
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
return push_inst(compiler, ADDU_W | SA(RETURN_ADDR_REG) | TA(0) | D(dst), DR(dst));
@@ -1570,10 +1534,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, ADDU_W | S(src) | TA(0) | DA(RETURN_ADDR_REG), RETURN_ADDR_REG));
- else if (src & SLJIT_MEM)
+ else
FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, RETURN_ADDR_REG, src, srcw));
- else if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, RETURN_ADDR_REG, srcw));
FAIL_IF(push_inst(compiler, JR | SA(RETURN_ADDR_REG), UNMOVABLE_INS));
return push_inst(compiler, NOP, UNMOVABLE_INS);
@@ -1643,55 +1605,39 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
switch (type) {
case SLJIT_EQUAL:
- case SLJIT_NOT_EQUAL_F64:
BR_NZ(EQUAL_FLAG);
break;
case SLJIT_NOT_EQUAL:
- case SLJIT_EQUAL_F64:
BR_Z(EQUAL_FLAG);
break;
case SLJIT_LESS:
- case SLJIT_LESS_F64:
- BR_Z(ULESS_FLAG);
- break;
- case SLJIT_GREATER_EQUAL:
- case SLJIT_GREATER_EQUAL_F64:
- BR_NZ(ULESS_FLAG);
- break;
case SLJIT_GREATER:
- case SLJIT_GREATER_F64:
- BR_Z(UGREATER_FLAG);
- break;
- case SLJIT_LESS_EQUAL:
- case SLJIT_LESS_EQUAL_F64:
- BR_NZ(UGREATER_FLAG);
- break;
case SLJIT_SIG_LESS:
- BR_Z(LESS_FLAG);
- break;
- case SLJIT_SIG_GREATER_EQUAL:
- BR_NZ(LESS_FLAG);
- break;
case SLJIT_SIG_GREATER:
- BR_Z(GREATER_FLAG);
- break;
- case SLJIT_SIG_LESS_EQUAL:
- BR_NZ(GREATER_FLAG);
- break;
case SLJIT_OVERFLOW:
case SLJIT_MUL_OVERFLOW:
- BR_Z(OVERFLOW_FLAG);
+ BR_Z(OTHER_FLAG);
break;
+ case SLJIT_GREATER_EQUAL:
+ case SLJIT_LESS_EQUAL:
+ case SLJIT_SIG_GREATER_EQUAL:
+ case SLJIT_SIG_LESS_EQUAL:
case SLJIT_NOT_OVERFLOW:
case SLJIT_MUL_NOT_OVERFLOW:
- BR_NZ(OVERFLOW_FLAG);
- break;
- case SLJIT_UNORDERED_F64:
- BR_F();
+ BR_NZ(OTHER_FLAG);
break;
+ case SLJIT_NOT_EQUAL_F64:
+ case SLJIT_GREATER_EQUAL_F64:
+ case SLJIT_GREATER_F64:
case SLJIT_ORDERED_F64:
BR_T();
break;
+ case SLJIT_EQUAL_F64:
+ case SLJIT_LESS_F64:
+ case SLJIT_LESS_EQUAL_F64:
+ case SLJIT_UNORDERED_F64:
+ BR_F();
+ break;
default:
/* Not conditional branch. */
inst = 0;
@@ -1706,19 +1652,16 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
PTR_FAIL_IF(push_inst(compiler, inst, UNMOVABLE_INS));
PTR_FAIL_IF(emit_const(compiler, TMP_REG2, 0));
- if (type <= SLJIT_JUMP) {
+
+ if (type <= SLJIT_JUMP)
PTR_FAIL_IF(push_inst(compiler, JR | S(TMP_REG2), UNMOVABLE_INS));
- jump->addr = compiler->size;
- PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
- } else {
- SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
- /* Cannot be optimized out if type is >= CALL0. */
- jump->flags |= IS_JAL | (type >= SLJIT_CALL0 ? IS_CALL : 0);
+ else {
+ jump->flags |= IS_JAL;
PTR_FAIL_IF(push_inst(compiler, JALR | S(TMP_REG2) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
- jump->addr = compiler->size;
- /* A NOP if type < CALL1. */
- PTR_FAIL_IF(push_inst(compiler, ADDU_W | S(SLJIT_R0) | TA(0) | DA(4), UNMOVABLE_INS));
}
+
+ jump->addr = compiler->size;
+ PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
return jump;
}
@@ -1863,86 +1806,6 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
#undef RESOLVE_IMM1
#undef RESOLVE_IMM2
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
- sljit_s32 src1, sljit_sw src1w,
- sljit_s32 src2, sljit_sw src2w)
-{
- struct sljit_jump *jump;
- sljit_ins inst;
- sljit_s32 if_true;
-
- CHECK_ERROR_PTR();
- CHECK_PTR(check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w));
-
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
-
- if (src1 & SLJIT_MEM) {
- PTR_FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(type) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
- src1 = TMP_FREG1;
- }
- else
- src1 <<= 1;
-
- if (src2 & SLJIT_MEM) {
- PTR_FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(type) | LOAD_DATA, TMP_FREG2, src2, src2w, 0, 0));
- src2 = TMP_FREG2;
- }
- else
- src2 <<= 1;
-
- jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
- PTR_FAIL_IF(!jump);
- set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
- jump->flags |= IS_BIT16_COND;
-
- switch (type & 0xff) {
- case SLJIT_EQUAL_F64:
- inst = C_UEQ_S;
- if_true = 1;
- break;
- case SLJIT_NOT_EQUAL_F64:
- inst = C_UEQ_S;
- if_true = 0;
- break;
- case SLJIT_LESS_F64:
- inst = C_ULT_S;
- if_true = 1;
- break;
- case SLJIT_GREATER_EQUAL_F64:
- inst = C_ULT_S;
- if_true = 0;
- break;
- case SLJIT_GREATER_F64:
- inst = C_ULE_S;
- if_true = 0;
- break;
- case SLJIT_LESS_EQUAL_F64:
- inst = C_ULE_S;
- if_true = 1;
- break;
- case SLJIT_UNORDERED_F64:
- inst = C_UN_S;
- if_true = 1;
- break;
- default: /* Make compilers happy. */
- SLJIT_ASSERT_STOP();
- case SLJIT_ORDERED_F64:
- inst = C_UN_S;
- if_true = 0;
- break;
- }
-
- PTR_FAIL_IF(push_inst(compiler, inst | FMT(type) | FT(src2) | FS(src1), UNMOVABLE_INS));
- /* Intentionally the other opcode. */
- PTR_FAIL_IF(push_inst(compiler, (if_true ? BC1F : BC1T) | JUMP_LENGTH, UNMOVABLE_INS));
- PTR_FAIL_IF(emit_const(compiler, TMP_REG2, 0));
- PTR_FAIL_IF(push_inst(compiler, JR | S(TMP_REG2), UNMOVABLE_INS));
- jump->addr = compiler->size;
- PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
- return jump;
-}
-
#undef JUMP_LENGTH
#undef BR_Z
#undef BR_NZ
@@ -1954,41 +1817,12 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compile
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
{
- sljit_s32 src_r = TMP_REG2;
struct sljit_jump *jump = NULL;
CHECK_ERROR();
CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
- if (FAST_IS_REG(src)) {
- if (DR(src) != 4)
- src_r = src;
- else
- FAIL_IF(push_inst(compiler, ADDU_W | S(src) | TA(0) | D(TMP_REG2), DR(TMP_REG2)));
- }
-
- if (type >= SLJIT_CALL0) {
- SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
- if (src & (SLJIT_IMM | SLJIT_MEM)) {
- if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, DR(PIC_ADDR_REG), srcw));
- else {
- SLJIT_ASSERT(src_r == TMP_REG2 && (src & SLJIT_MEM));
- FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, TMP_REG2, 0, TMP_REG1, 0, src, srcw));
- }
- FAIL_IF(push_inst(compiler, JALR | S(PIC_ADDR_REG) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
- /* We need an extra instruction in any case. */
- return push_inst(compiler, ADDU_W | S(SLJIT_R0) | TA(0) | DA(4), UNMOVABLE_INS);
- }
-
- /* Register input. */
- if (type >= SLJIT_CALL1)
- FAIL_IF(push_inst(compiler, ADDU_W | S(SLJIT_R0) | TA(0) | DA(4), 4));
- FAIL_IF(push_inst(compiler, JALR | S(src_r) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
- return push_inst(compiler, ADDU_W | S(src_r) | TA(0) | D(PIC_ADDR_REG), UNMOVABLE_INS);
- }
-
if (src & SLJIT_IMM) {
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF(!jump);
@@ -1999,11 +1833,14 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
jump->flags |= IS_MOVABLE;
FAIL_IF(emit_const(compiler, TMP_REG2, 0));
+ src = TMP_REG2;
+ }
+ else if (src & SLJIT_MEM) {
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, DR(TMP_REG2), src, srcw));
+ src = TMP_REG2;
}
- else if (src & SLJIT_MEM)
- FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, TMP_REG2, 0, TMP_REG1, 0, src, srcw));
- FAIL_IF(push_inst(compiler, JR | S(src_r), UNMOVABLE_INS));
+ FAIL_IF(push_inst(compiler, JR | S(src), UNMOVABLE_INS));
if (jump)
jump->addr = compiler->size;
FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
@@ -2012,115 +1849,160 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
- sljit_s32 sugg_dst_ar, dst_ar;
- sljit_s32 flags = GET_ALL_FLAGS(op);
+ sljit_s32 src_ar, dst_ar;
+ sljit_s32 saved_op = op;
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-# define mem_type WORD_DATA
+ sljit_s32 mem_type = WORD_DATA;
#else
sljit_s32 mem_type = (op & SLJIT_I32_OP) ? (INT_DATA | SIGNED_DATA) : WORD_DATA;
#endif
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
op = GET_OPCODE(op);
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
- if (op == SLJIT_MOV_S32 || op == SLJIT_MOV_U32)
+ if (op == SLJIT_MOV_S32)
mem_type = INT_DATA | SIGNED_DATA;
#endif
- sugg_dst_ar = DR((op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2);
+ dst_ar = DR((op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2);
compiler->cache_arg = 0;
compiler->cache_argw = 0;
- if (op >= SLJIT_ADD && (src & SLJIT_MEM)) {
- ADJUST_LOCAL_OFFSET(src, srcw);
- FAIL_IF(emit_op_mem2(compiler, mem_type | LOAD_DATA, DR(TMP_REG1), src, srcw, dst, dstw));
- src = TMP_REG1;
- srcw = 0;
- }
+
+ if (op >= SLJIT_ADD && (dst & SLJIT_MEM))
+ FAIL_IF(emit_op_mem2(compiler, mem_type | LOAD_DATA, DR(TMP_REG1), dst, dstw, dst, dstw));
switch (type & 0xff) {
case SLJIT_EQUAL:
case SLJIT_NOT_EQUAL:
- FAIL_IF(push_inst(compiler, SLTIU | SA(EQUAL_FLAG) | TA(sugg_dst_ar) | IMM(1), sugg_dst_ar));
- dst_ar = sugg_dst_ar;
- break;
- case SLJIT_LESS:
- case SLJIT_GREATER_EQUAL:
- case SLJIT_LESS_F64:
- case SLJIT_GREATER_EQUAL_F64:
- dst_ar = ULESS_FLAG;
- break;
- case SLJIT_GREATER:
- case SLJIT_LESS_EQUAL:
- case SLJIT_GREATER_F64:
- case SLJIT_LESS_EQUAL_F64:
- dst_ar = UGREATER_FLAG;
- break;
- case SLJIT_SIG_LESS:
- case SLJIT_SIG_GREATER_EQUAL:
- dst_ar = LESS_FLAG;
- break;
- case SLJIT_SIG_GREATER:
- case SLJIT_SIG_LESS_EQUAL:
- dst_ar = GREATER_FLAG;
- break;
- case SLJIT_OVERFLOW:
- case SLJIT_NOT_OVERFLOW:
- dst_ar = OVERFLOW_FLAG;
+ FAIL_IF(push_inst(compiler, SLTIU | SA(EQUAL_FLAG) | TA(dst_ar) | IMM(1), dst_ar));
+ src_ar = dst_ar;
break;
case SLJIT_MUL_OVERFLOW:
case SLJIT_MUL_NOT_OVERFLOW:
- FAIL_IF(push_inst(compiler, SLTIU | SA(OVERFLOW_FLAG) | TA(sugg_dst_ar) | IMM(1), sugg_dst_ar));
- dst_ar = sugg_dst_ar;
+ FAIL_IF(push_inst(compiler, SLTIU | SA(OTHER_FLAG) | TA(dst_ar) | IMM(1), dst_ar));
+ src_ar = dst_ar;
type ^= 0x1; /* Flip type bit for the XORI below. */
break;
+ case SLJIT_GREATER_F64:
+ case SLJIT_LESS_EQUAL_F64:
+ type ^= 0x1; /* Flip type bit for the XORI below. */
case SLJIT_EQUAL_F64:
case SLJIT_NOT_EQUAL_F64:
- dst_ar = EQUAL_FLAG;
- break;
-
+ case SLJIT_LESS_F64:
+ case SLJIT_GREATER_EQUAL_F64:
case SLJIT_UNORDERED_F64:
case SLJIT_ORDERED_F64:
- FAIL_IF(push_inst(compiler, CFC1 | TA(sugg_dst_ar) | DA(FCSR_REG), sugg_dst_ar));
- FAIL_IF(push_inst(compiler, SRL | TA(sugg_dst_ar) | DA(sugg_dst_ar) | SH_IMM(23), sugg_dst_ar));
- FAIL_IF(push_inst(compiler, ANDI | SA(sugg_dst_ar) | TA(sugg_dst_ar) | IMM(1), sugg_dst_ar));
- dst_ar = sugg_dst_ar;
+ FAIL_IF(push_inst(compiler, CFC1 | TA(dst_ar) | DA(FCSR_REG), dst_ar));
+ FAIL_IF(push_inst(compiler, SRL | TA(dst_ar) | DA(dst_ar) | SH_IMM(23), dst_ar));
+ FAIL_IF(push_inst(compiler, ANDI | SA(dst_ar) | TA(dst_ar) | IMM(1), dst_ar));
+ src_ar = dst_ar;
break;
default:
- SLJIT_ASSERT_STOP();
- dst_ar = sugg_dst_ar;
+ src_ar = OTHER_FLAG;
break;
}
if (type & 0x1) {
- FAIL_IF(push_inst(compiler, XORI | SA(dst_ar) | TA(sugg_dst_ar) | IMM(1), sugg_dst_ar));
- dst_ar = sugg_dst_ar;
+ FAIL_IF(push_inst(compiler, XORI | SA(src_ar) | TA(dst_ar) | IMM(1), dst_ar));
+ src_ar = dst_ar;
}
- if (op >= SLJIT_ADD) {
- if (DR(TMP_REG2) != dst_ar)
- FAIL_IF(push_inst(compiler, ADDU_W | SA(dst_ar) | TA(0) | D(TMP_REG2), DR(TMP_REG2)));
- return emit_op(compiler, op | flags, mem_type | CUMULATIVE_OP | LOGICAL_OP | IMM_OP | ALT_KEEP_CACHE, dst, dstw, src, srcw, TMP_REG2, 0);
+ if (op < SLJIT_ADD) {
+ if (dst & SLJIT_MEM)
+ return emit_op_mem(compiler, mem_type, src_ar, dst, dstw);
+
+ if (src_ar != dst_ar)
+ return push_inst(compiler, ADDU_W | SA(src_ar) | TA(0) | DA(dst_ar), dst_ar);
+ return SLJIT_SUCCESS;
}
+ /* OTHER_FLAG cannot be specified as src2 argument at the moment. */
+ if (DR(TMP_REG2) != src_ar)
+ FAIL_IF(push_inst(compiler, ADDU_W | SA(src_ar) | TA(0) | D(TMP_REG2), DR(TMP_REG2)));
+
+ mem_type |= CUMULATIVE_OP | LOGICAL_OP | IMM_OP | ALT_KEEP_CACHE;
+
if (dst & SLJIT_MEM)
- return emit_op_mem(compiler, mem_type, dst_ar, dst, dstw);
+ return emit_op(compiler, saved_op, mem_type, dst, dstw, TMP_REG1, 0, TMP_REG2, 0);
+ return emit_op(compiler, saved_op, mem_type, dst, dstw, dst, dstw, TMP_REG2, 0);
+}
- if (sugg_dst_ar != dst_ar)
- return push_inst(compiler, ADDU_W | SA(dst_ar) | TA(0) | DA(sugg_dst_ar), sugg_dst_ar);
- return SLJIT_SUCCESS;
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
+ sljit_ins ins;
+#endif
-#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
-# undef mem_type
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
+
+#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
+
+ if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
+#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
+ if (dst_reg & SLJIT_I32_OP)
+ srcw = (sljit_s32)srcw;
+#endif
+ FAIL_IF(load_immediate(compiler, DR(TMP_REG1), srcw));
+ src = TMP_REG1;
+ srcw = 0;
+ }
+
+ dst_reg &= ~SLJIT_I32_OP;
+
+ switch (type & 0xff) {
+ case SLJIT_EQUAL:
+ ins = MOVZ | TA(EQUAL_FLAG);
+ break;
+ case SLJIT_NOT_EQUAL:
+ ins = MOVN | TA(EQUAL_FLAG);
+ break;
+ case SLJIT_LESS:
+ case SLJIT_GREATER:
+ case SLJIT_SIG_LESS:
+ case SLJIT_SIG_GREATER:
+ case SLJIT_OVERFLOW:
+ case SLJIT_MUL_OVERFLOW:
+ ins = MOVN | TA(OTHER_FLAG);
+ break;
+ case SLJIT_GREATER_EQUAL:
+ case SLJIT_LESS_EQUAL:
+ case SLJIT_SIG_GREATER_EQUAL:
+ case SLJIT_SIG_LESS_EQUAL:
+ case SLJIT_NOT_OVERFLOW:
+ case SLJIT_MUL_NOT_OVERFLOW:
+ ins = MOVZ | TA(OTHER_FLAG);
+ break;
+ case SLJIT_EQUAL_F64:
+ case SLJIT_LESS_F64:
+ case SLJIT_LESS_EQUAL_F64:
+ case SLJIT_UNORDERED_F64:
+ ins = MOVT;
+ break;
+ case SLJIT_NOT_EQUAL_F64:
+ case SLJIT_GREATER_EQUAL_F64:
+ case SLJIT_GREATER_F64:
+ case SLJIT_ORDERED_F64:
+ ins = MOVF;
+ break;
+ default:
+ ins = MOVZ | TA(OTHER_FLAG);
+ SLJIT_UNREACHABLE();
+ break;
+ }
+
+ return push_inst(compiler, ins | S(src) | D(dst_reg), DR(dst_reg));
+
+#else
+ return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);
#endif
}
@@ -2137,7 +2019,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- reg = SLOW_IS_REG(dst) ? dst : TMP_REG2;
+ reg = FAST_IS_REG(dst) ? dst : TMP_REG2;
PTR_FAIL_IF(emit_const(compiler, reg, init_value));
diff --git a/thirdparty/pcre2/src/sljit/sljitNativePPC_32.c b/thirdparty/pcre2/src/sljit/sljitNativePPC_32.c
index f696d1b8d5..fc185f7847 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativePPC_32.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativePPC_32.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -88,77 +88,86 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
case SLJIT_NEG:
SLJIT_ASSERT(src1 == TMP_REG1);
- return push_inst(compiler, NEG | OERC(flags) | D(dst) | A(src2));
+ /* Setting XER SO is not enough, CR SO is also needed. */
+ return push_inst(compiler, NEG | OE((flags & ALT_FORM1) ? ALT_SET_FLAGS : 0) | RC(flags) | D(dst) | A(src2));
case SLJIT_CLZ:
SLJIT_ASSERT(src1 == TMP_REG1);
- return push_inst(compiler, CNTLZW | RC(flags) | S(src2) | A(dst));
+ return push_inst(compiler, CNTLZW | S(src2) | A(dst));
case SLJIT_ADD:
if (flags & ALT_FORM1) {
- /* Flags does not set: BIN_IMM_EXTS unnecessary. */
- SLJIT_ASSERT(src2 == TMP_REG2);
- return push_inst(compiler, ADDI | D(dst) | A(src1) | compiler->imm);
+ /* Setting XER SO is not enough, CR SO is also needed. */
+ return push_inst(compiler, ADD | OE(ALT_SET_FLAGS) | RC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
}
+
if (flags & ALT_FORM2) {
/* Flags does not set: BIN_IMM_EXTS unnecessary. */
SLJIT_ASSERT(src2 == TMP_REG2);
- return push_inst(compiler, ADDIS | D(dst) | A(src1) | compiler->imm);
+
+ if (flags & ALT_FORM3)
+ return push_inst(compiler, ADDIS | D(dst) | A(src1) | compiler->imm);
+
+ if (flags & ALT_FORM4) {
+ FAIL_IF(push_inst(compiler, ADDIS | D(dst) | A(src1) | (((compiler->imm >> 16) & 0xffff) + ((compiler->imm >> 15) & 0x1))));
+ src1 = dst;
+ }
+
+ return push_inst(compiler, ADDI | D(dst) | A(src1) | (compiler->imm & 0xffff));
}
if (flags & ALT_FORM3) {
SLJIT_ASSERT(src2 == TMP_REG2);
return push_inst(compiler, ADDIC | D(dst) | A(src1) | compiler->imm);
}
- if (flags & ALT_FORM4) {
- /* Flags does not set: BIN_IMM_EXTS unnecessary. */
- FAIL_IF(push_inst(compiler, ADDI | D(dst) | A(src1) | (compiler->imm & 0xffff)));
- return push_inst(compiler, ADDIS | D(dst) | A(dst) | (((compiler->imm >> 16) & 0xffff) + ((compiler->imm >> 15) & 0x1)));
- }
if (!(flags & ALT_SET_FLAGS))
return push_inst(compiler, ADD | D(dst) | A(src1) | B(src2));
- return push_inst(compiler, ADDC | OERC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
+ if (flags & ALT_FORM4)
+ return push_inst(compiler, ADDC | RC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
+ return push_inst(compiler, ADD | RC(flags) | D(dst) | A(src1) | B(src2));
case SLJIT_ADDC:
- if (flags & ALT_FORM1) {
- FAIL_IF(push_inst(compiler, MFXER | D(0)));
- FAIL_IF(push_inst(compiler, ADDE | D(dst) | A(src1) | B(src2)));
- return push_inst(compiler, MTXER | S(0));
- }
return push_inst(compiler, ADDE | D(dst) | A(src1) | B(src2));
case SLJIT_SUB:
if (flags & ALT_FORM1) {
+ if (flags & ALT_FORM2) {
+ FAIL_IF(push_inst(compiler, CMPLI | CRD(0) | A(src1) | compiler->imm));
+ if (!(flags & ALT_FORM3))
+ return SLJIT_SUCCESS;
+ return push_inst(compiler, ADDI | D(dst) | A(src1) | (-compiler->imm & 0xffff));
+ }
+ FAIL_IF(push_inst(compiler, CMPL | CRD(0) | A(src1) | B(src2)));
+ if (!(flags & ALT_FORM3))
+ return SLJIT_SUCCESS;
+ return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
+ }
+
+ if (flags & ALT_FORM2) {
+ /* Setting XER SO is not enough, CR SO is also needed. */
+ return push_inst(compiler, SUBF | OE(ALT_SET_FLAGS) | RC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1));
+ }
+
+ if (flags & ALT_FORM3) {
/* Flags does not set: BIN_IMM_EXTS unnecessary. */
SLJIT_ASSERT(src2 == TMP_REG2);
return push_inst(compiler, SUBFIC | D(dst) | A(src1) | compiler->imm);
}
- if (flags & (ALT_FORM2 | ALT_FORM3)) {
- SLJIT_ASSERT(src2 == TMP_REG2);
- if (flags & ALT_FORM2)
- FAIL_IF(push_inst(compiler, CMPI | CRD(0) | A(src1) | compiler->imm));
- if (flags & ALT_FORM3)
- return push_inst(compiler, CMPLI | CRD(4) | A(src1) | compiler->imm);
- return SLJIT_SUCCESS;
- }
- if (flags & (ALT_FORM4 | ALT_FORM5)) {
- if (flags & ALT_FORM4)
- FAIL_IF(push_inst(compiler, CMPL | CRD(4) | A(src1) | B(src2)));
- if (flags & ALT_FORM5)
- FAIL_IF(push_inst(compiler, CMP | CRD(0) | A(src1) | B(src2)));
- return SLJIT_SUCCESS;
+
+ if (flags & ALT_FORM4) {
+ if (flags & ALT_FORM5) {
+ SLJIT_ASSERT(src2 == TMP_REG2);
+ return push_inst(compiler, CMPI | CRD(0) | A(src1) | compiler->imm);
+ }
+ return push_inst(compiler, CMP | CRD(0) | A(src1) | B(src2));
}
+
if (!(flags & ALT_SET_FLAGS))
return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
- if (flags & ALT_FORM6)
- FAIL_IF(push_inst(compiler, CMPL | CRD(4) | A(src1) | B(src2)));
- return push_inst(compiler, SUBFC | OERC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1));
+ if (flags & ALT_FORM5)
+ return push_inst(compiler, SUBFC | RC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1));
+ return push_inst(compiler, SUBF | RC(flags) | D(dst) | A(src2) | B(src1));
case SLJIT_SUBC:
- if (flags & ALT_FORM1) {
- FAIL_IF(push_inst(compiler, MFXER | D(0)));
- FAIL_IF(push_inst(compiler, SUBFE | D(dst) | A(src2) | B(src1)));
- return push_inst(compiler, MTXER | S(0));
- }
return push_inst(compiler, SUBFE | D(dst) | A(src2) | B(src1));
case SLJIT_MUL:
@@ -166,7 +175,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
SLJIT_ASSERT(src2 == TMP_REG2);
return push_inst(compiler, MULLI | D(dst) | A(src1) | compiler->imm);
}
- return push_inst(compiler, MULLW | OERC(flags) | D(dst) | A(src2) | B(src1));
+ return push_inst(compiler, MULLW | OE(flags) | RC(flags) | D(dst) | A(src2) | B(src1));
case SLJIT_AND:
if (flags & ALT_FORM1) {
@@ -228,19 +237,15 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return push_inst(compiler, SRW | RC(flags) | S(src1) | A(dst) | B(src2));
case SLJIT_ASHR:
- if (flags & ALT_FORM3)
- FAIL_IF(push_inst(compiler, MFXER | D(0)));
if (flags & ALT_FORM1) {
SLJIT_ASSERT(src2 == TMP_REG2);
compiler->imm &= 0x1f;
- FAIL_IF(push_inst(compiler, SRAWI | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11)));
+ return push_inst(compiler, SRAWI | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11));
}
- else
- FAIL_IF(push_inst(compiler, SRAW | RC(flags) | S(src1) | A(dst) | B(src2)));
- return (flags & ALT_FORM3) ? push_inst(compiler, MTXER | S(0)) : SLJIT_SUCCESS;
+ return push_inst(compiler, SRAW | RC(flags) | S(src1) | A(dst) | B(src2));
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativePPC_64.c b/thirdparty/pcre2/src/sljit/sljitNativePPC_64.c
index 386d247dbc..706b2ba20b 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativePPC_64.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativePPC_64.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -204,84 +204,118 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
case SLJIT_NEG:
SLJIT_ASSERT(src1 == TMP_REG1);
+
+ if ((flags & (ALT_FORM1 | ALT_SIGN_EXT)) == (ALT_FORM1 | ALT_SIGN_EXT)) {
+ FAIL_IF(push_inst(compiler, RLDI(TMP_REG2, src2, 32, 31, 1)));
+ FAIL_IF(push_inst(compiler, NEG | OE(ALT_SET_FLAGS) | RC(ALT_SET_FLAGS) | D(dst) | A(TMP_REG2)));
+ return push_inst(compiler, RLDI(dst, dst, 32, 32, 0));
+ }
+
UN_EXTS();
- return push_inst(compiler, NEG | OERC(flags) | D(dst) | A(src2));
+ /* Setting XER SO is not enough, CR SO is also needed. */
+ return push_inst(compiler, NEG | OE((flags & ALT_FORM1) ? ALT_SET_FLAGS : 0) | RC(flags) | D(dst) | A(src2));
case SLJIT_CLZ:
SLJIT_ASSERT(src1 == TMP_REG1);
if (flags & ALT_FORM1)
- return push_inst(compiler, CNTLZW | RC(flags) | S(src2) | A(dst));
- return push_inst(compiler, CNTLZD | RC(flags) | S(src2) | A(dst));
+ return push_inst(compiler, CNTLZW | S(src2) | A(dst));
+ return push_inst(compiler, CNTLZD | S(src2) | A(dst));
case SLJIT_ADD:
if (flags & ALT_FORM1) {
- /* Flags does not set: BIN_IMM_EXTS unnecessary. */
- SLJIT_ASSERT(src2 == TMP_REG2);
- return push_inst(compiler, ADDI | D(dst) | A(src1) | compiler->imm);
+ if (flags & ALT_SIGN_EXT) {
+ FAIL_IF(push_inst(compiler, RLDI(TMP_REG1, src1, 32, 31, 1)));
+ src1 = TMP_REG1;
+ FAIL_IF(push_inst(compiler, RLDI(TMP_REG2, src2, 32, 31, 1)));
+ src2 = TMP_REG2;
+ }
+ /* Setting XER SO is not enough, CR SO is also needed. */
+ FAIL_IF(push_inst(compiler, ADD | OE(ALT_SET_FLAGS) | RC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2)));
+ if (flags & ALT_SIGN_EXT)
+ return push_inst(compiler, RLDI(dst, dst, 32, 32, 0));
+ return SLJIT_SUCCESS;
}
+
if (flags & ALT_FORM2) {
/* Flags does not set: BIN_IMM_EXTS unnecessary. */
SLJIT_ASSERT(src2 == TMP_REG2);
- return push_inst(compiler, ADDIS | D(dst) | A(src1) | compiler->imm);
+
+ if (flags & ALT_FORM3)
+ return push_inst(compiler, ADDIS | D(dst) | A(src1) | compiler->imm);
+
+ if (flags & ALT_FORM4) {
+ FAIL_IF(push_inst(compiler, ADDIS | D(dst) | A(src1) | (((compiler->imm >> 16) & 0xffff) + ((compiler->imm >> 15) & 0x1))));
+ src1 = dst;
+ }
+
+ return push_inst(compiler, ADDI | D(dst) | A(src1) | (compiler->imm & 0xffff));
}
if (flags & ALT_FORM3) {
SLJIT_ASSERT(src2 == TMP_REG2);
BIN_IMM_EXTS();
return push_inst(compiler, ADDIC | D(dst) | A(src1) | compiler->imm);
}
- if (flags & ALT_FORM4) {
- /* Flags does not set: BIN_IMM_EXTS unnecessary. */
- FAIL_IF(push_inst(compiler, ADDI | D(dst) | A(src1) | (compiler->imm & 0xffff)));
- return push_inst(compiler, ADDIS | D(dst) | A(dst) | (((compiler->imm >> 16) & 0xffff) + ((compiler->imm >> 15) & 0x1)));
- }
if (!(flags & ALT_SET_FLAGS))
return push_inst(compiler, ADD | D(dst) | A(src1) | B(src2));
BIN_EXTS();
- return push_inst(compiler, ADDC | OERC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
+ if (flags & ALT_FORM4)
+ return push_inst(compiler, ADDC | RC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
+ return push_inst(compiler, ADD | RC(flags) | D(dst) | A(src1) | B(src2));
case SLJIT_ADDC:
- if (flags & ALT_FORM1) {
- FAIL_IF(push_inst(compiler, MFXER | D(0)));
- FAIL_IF(push_inst(compiler, ADDE | D(dst) | A(src1) | B(src2)));
- return push_inst(compiler, MTXER | S(0));
- }
BIN_EXTS();
return push_inst(compiler, ADDE | D(dst) | A(src1) | B(src2));
case SLJIT_SUB:
if (flags & ALT_FORM1) {
+ if (flags & ALT_FORM2) {
+ FAIL_IF(push_inst(compiler, CMPLI | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | compiler->imm));
+ if (!(flags & ALT_FORM3))
+ return SLJIT_SUCCESS;
+ return push_inst(compiler, ADDI | D(dst) | A(src1) | (-compiler->imm & 0xffff));
+ }
+ FAIL_IF(push_inst(compiler, CMPL | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2)));
+ if (!(flags & ALT_FORM3))
+ return SLJIT_SUCCESS;
+ return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
+ }
+
+ if (flags & ALT_FORM2) {
+ if (flags & ALT_SIGN_EXT) {
+ FAIL_IF(push_inst(compiler, RLDI(TMP_REG1, src1, 32, 31, 1)));
+ src1 = TMP_REG1;
+ FAIL_IF(push_inst(compiler, RLDI(TMP_REG2, src2, 32, 31, 1)));
+ src2 = TMP_REG2;
+ }
+ /* Setting XER SO is not enough, CR SO is also needed. */
+ FAIL_IF(push_inst(compiler, SUBF | OE(ALT_SET_FLAGS) | RC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1)));
+ if (flags & ALT_SIGN_EXT)
+ return push_inst(compiler, RLDI(dst, dst, 32, 32, 0));
+ return SLJIT_SUCCESS;
+ }
+
+ if (flags & ALT_FORM3) {
/* Flags does not set: BIN_IMM_EXTS unnecessary. */
SLJIT_ASSERT(src2 == TMP_REG2);
return push_inst(compiler, SUBFIC | D(dst) | A(src1) | compiler->imm);
}
- if (flags & (ALT_FORM2 | ALT_FORM3)) {
- SLJIT_ASSERT(src2 == TMP_REG2);
- if (flags & ALT_FORM2)
- FAIL_IF(push_inst(compiler, CMPI | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | compiler->imm));
- if (flags & ALT_FORM3)
- return push_inst(compiler, CMPLI | CRD(4 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | compiler->imm);
- return SLJIT_SUCCESS;
- }
- if (flags & (ALT_FORM4 | ALT_FORM5)) {
- if (flags & ALT_FORM4)
- FAIL_IF(push_inst(compiler, CMPL | CRD(4 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2)));
- if (flags & ALT_FORM5)
- return push_inst(compiler, CMP | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2));
- return SLJIT_SUCCESS;
+
+ if (flags & ALT_FORM4) {
+ if (flags & ALT_FORM5) {
+ SLJIT_ASSERT(src2 == TMP_REG2);
+ return push_inst(compiler, CMPI | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | compiler->imm);
+ }
+ return push_inst(compiler, CMP | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2));
}
+
if (!(flags & ALT_SET_FLAGS))
return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
BIN_EXTS();
- if (flags & ALT_FORM6)
- FAIL_IF(push_inst(compiler, CMPL | CRD(4 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2)));
- return push_inst(compiler, SUBFC | OERC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1));
+ if (flags & ALT_FORM5)
+ return push_inst(compiler, SUBFC | RC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1));
+ return push_inst(compiler, SUBF | RC(flags) | D(dst) | A(src2) | B(src1));
case SLJIT_SUBC:
- if (flags & ALT_FORM1) {
- FAIL_IF(push_inst(compiler, MFXER | D(0)));
- FAIL_IF(push_inst(compiler, SUBFE | D(dst) | A(src2) | B(src1)));
- return push_inst(compiler, MTXER | S(0));
- }
BIN_EXTS();
return push_inst(compiler, SUBFE | D(dst) | A(src2) | B(src1));
@@ -292,8 +326,8 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
}
BIN_EXTS();
if (flags & ALT_FORM2)
- return push_inst(compiler, MULLW | OERC(flags) | D(dst) | A(src2) | B(src1));
- return push_inst(compiler, MULLD | OERC(flags) | D(dst) | A(src2) | B(src1));
+ return push_inst(compiler, MULLW | OE(flags) | RC(flags) | D(dst) | A(src2) | B(src1));
+ return push_inst(compiler, MULLD | OE(flags) | RC(flags) | D(dst) | A(src2) | B(src1));
case SLJIT_AND:
if (flags & ALT_FORM1) {
@@ -345,10 +379,8 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
compiler->imm &= 0x1f;
return push_inst(compiler, RLWINM | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11) | ((31 - compiler->imm) << 1));
}
- else {
- compiler->imm &= 0x3f;
- return push_inst(compiler, RLDI(dst, src1, compiler->imm, 63 - compiler->imm, 1) | RC(flags));
- }
+ compiler->imm &= 0x3f;
+ return push_inst(compiler, RLDI(dst, src1, compiler->imm, 63 - compiler->imm, 1) | RC(flags));
}
return push_inst(compiler, ((flags & ALT_FORM2) ? SLW : SLD) | RC(flags) | S(src1) | A(dst) | B(src2));
@@ -359,33 +391,80 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
compiler->imm &= 0x1f;
return push_inst(compiler, RLWINM | RC(flags) | S(src1) | A(dst) | (((32 - compiler->imm) & 0x1f) << 11) | (compiler->imm << 6) | (31 << 1));
}
- else {
- compiler->imm &= 0x3f;
- return push_inst(compiler, RLDI(dst, src1, 64 - compiler->imm, compiler->imm, 0) | RC(flags));
- }
+ compiler->imm &= 0x3f;
+ return push_inst(compiler, RLDI(dst, src1, 64 - compiler->imm, compiler->imm, 0) | RC(flags));
}
return push_inst(compiler, ((flags & ALT_FORM2) ? SRW : SRD) | RC(flags) | S(src1) | A(dst) | B(src2));
case SLJIT_ASHR:
- if (flags & ALT_FORM3)
- FAIL_IF(push_inst(compiler, MFXER | D(0)));
if (flags & ALT_FORM1) {
SLJIT_ASSERT(src2 == TMP_REG2);
if (flags & ALT_FORM2) {
compiler->imm &= 0x1f;
- FAIL_IF(push_inst(compiler, SRAWI | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11)));
+ return push_inst(compiler, SRAWI | RC(flags) | S(src1) | A(dst) | (compiler->imm << 11));
}
- else {
- compiler->imm &= 0x3f;
- FAIL_IF(push_inst(compiler, SRADI | RC(flags) | S(src1) | A(dst) | ((compiler->imm & 0x1f) << 11) | ((compiler->imm & 0x20) >> 4)));
+ compiler->imm &= 0x3f;
+ return push_inst(compiler, SRADI | RC(flags) | S(src1) | A(dst) | ((compiler->imm & 0x1f) << 11) | ((compiler->imm & 0x20) >> 4));
+ }
+ return push_inst(compiler, ((flags & ALT_FORM2) ? SRAW : SRAD) | RC(flags) | S(src1) | A(dst) | B(src2));
+ }
+
+ SLJIT_UNREACHABLE();
+ return SLJIT_SUCCESS;
+}
+
+static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src)
+{
+ sljit_s32 arg_count = 0;
+ sljit_s32 word_arg_count = 0;
+ sljit_s32 types = 0;
+ sljit_s32 reg = 0;
+
+ if (src)
+ reg = *src & REG_MASK;
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ case SLJIT_ARG_TYPE_F64:
+ arg_count++;
+ break;
+ default:
+ arg_count++;
+ word_arg_count++;
+
+ if (arg_count != word_arg_count && arg_count == reg) {
+ FAIL_IF(push_inst(compiler, OR | S(reg) | A(TMP_CALL_REG) | B(reg)));
+ *src = TMP_CALL_REG;
}
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ case SLJIT_ARG_TYPE_F64:
+ arg_count--;
+ break;
+ default:
+ if (arg_count != word_arg_count)
+ FAIL_IF(push_inst(compiler, OR | S(word_arg_count) | A(arg_count) | B(word_arg_count)));
+
+ arg_count--;
+ word_arg_count--;
+ break;
}
- else
- FAIL_IF(push_inst(compiler, ((flags & ALT_FORM2) ? SRAW : SRAD) | RC(flags) | S(src1) | A(dst) | B(src2)));
- return (flags & ALT_FORM3) ? push_inst(compiler, MTXER | S(0)) : SLJIT_SUCCESS;
+
+ types >>= SLJIT_DEF_SHIFT;
}
- SLJIT_ASSERT_STOP();
return SLJIT_SUCCESS;
}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativePPC_common.c b/thirdparty/pcre2/src/sljit/sljitNativePPC_common.c
index 150c0bf9f4..5ef4ac96c4 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativePPC_common.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativePPC_common.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -93,20 +93,23 @@ static void ppc_cache_flush(sljit_ins *from, sljit_ins *to)
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
-#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
-#define TMP_ZERO (SLJIT_NUMBER_OF_REGISTERS + 5)
+#define TMP_ZERO (SLJIT_NUMBER_OF_REGISTERS + 4)
#if (defined SLJIT_PASS_ENTRY_ADDR_TO_CALL && SLJIT_PASS_ENTRY_ADDR_TO_CALL)
-#define TMP_CALL_REG (SLJIT_NUMBER_OF_REGISTERS + 6)
+#define TMP_CALL_REG (SLJIT_NUMBER_OF_REGISTERS + 5)
#else
#define TMP_CALL_REG TMP_REG2
#endif
-#define TMP_FREG1 (0)
-#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 7] = {
- 0, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 8, 9, 10, 31, 12
+ 0, 3, 4, 5, 6, 7, 8, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 9, 10, 31, 12
+};
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 1, 2, 3, 4, 5, 6, 0, 7
};
/* --------------------------------------------------------------------- */
@@ -117,19 +120,19 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 7] = {
#define A(a) (reg_map[a] << 16)
#define B(b) (reg_map[b] << 11)
#define C(c) (reg_map[c] << 6)
-#define FD(fd) ((fd) << 21)
-#define FS(fs) ((fs) << 21)
-#define FA(fa) ((fa) << 16)
-#define FB(fb) ((fb) << 11)
-#define FC(fc) ((fc) << 6)
+#define FD(fd) (freg_map[fd] << 21)
+#define FS(fs) (freg_map[fs] << 21)
+#define FA(fa) (freg_map[fa] << 16)
+#define FB(fb) (freg_map[fb] << 11)
+#define FC(fc) (freg_map[fc] << 6)
#define IMM(imm) ((imm) & 0xffff)
#define CRD(d) ((d) << 21)
/* Instruction bit sections.
OE and Rc flag (see ALT_SET_FLAGS). */
-#define OERC(flags) (((flags & ALT_SET_FLAGS) >> 10) | (flags & ALT_SET_FLAGS))
+#define OE(flags) ((flags) & ALT_SET_FLAGS)
/* Rc flag (see ALT_SET_FLAGS). */
-#define RC(flags) ((flags & ALT_SET_FLAGS) >> 10)
+#define RC(flags) (((flags) & ALT_SET_FLAGS) >> 10)
#define HI(opcode) ((opcode) << 26)
#define LO(opcode) ((opcode) << 1)
@@ -154,6 +157,7 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 7] = {
#define CMPL (HI(31) | LO(32))
#define CMPLI (HI(10))
#define CROR (HI(19) | LO(449))
+#define DCBT (HI(31) | LO(278))
#define DIVD (HI(31) | LO(489))
#define DIVDU (HI(31) | LO(457))
#define DIVW (HI(31) | LO(491))
@@ -524,6 +528,25 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
#endif
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#else
+ /* Available by default. */
+ return 1;
+#endif
+
+ case SLJIT_HAS_CLZ:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Entry, exit */
/* --------------------------------------------------------------------- */
@@ -533,47 +556,40 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
/* Creates an index in data_transfer_insts array. */
#define LOAD_DATA 0x01
#define INDEXED 0x02
-#define WRITE_BACK 0x04
+#define SIGNED_DATA 0x04
+
#define WORD_DATA 0x00
#define BYTE_DATA 0x08
#define HALF_DATA 0x10
#define INT_DATA 0x18
-#define SIGNED_DATA 0x20
/* Separates integer and floating point registers */
-#define GPR_REG 0x3f
-#define DOUBLE_DATA 0x40
+#define GPR_REG 0x1f
+#define DOUBLE_DATA 0x20
#define MEM_MASK 0x7f
/* Other inp_flags. */
-#define ARG_TEST 0x000100
/* Integer opertion and set flags -> requires exts on 64 bit systems. */
-#define ALT_SIGN_EXT 0x000200
+#define ALT_SIGN_EXT 0x000100
/* This flag affects the RC() and OERC() macros. */
#define ALT_SET_FLAGS 0x000400
-#define ALT_KEEP_CACHE 0x000800
-#define ALT_FORM1 0x010000
-#define ALT_FORM2 0x020000
-#define ALT_FORM3 0x040000
-#define ALT_FORM4 0x080000
-#define ALT_FORM5 0x100000
-#define ALT_FORM6 0x200000
+#define ALT_FORM1 0x001000
+#define ALT_FORM2 0x002000
+#define ALT_FORM3 0x004000
+#define ALT_FORM4 0x008000
+#define ALT_FORM5 0x010000
/* Source and destination is register. */
#define REG_DEST 0x000001
#define REG1_SOURCE 0x000002
#define REG2_SOURCE 0x000004
-/* getput_arg_fast returned true. */
-#define FAST_DEST 0x000008
-/* Multiple instructions are required. */
-#define SLOW_DEST 0x000010
/*
-ALT_SIGN_EXT 0x000200
-ALT_SET_FLAGS 0x000400
-ALT_FORM1 0x010000
+ALT_SIGN_EXT 0x000100
+ALT_SET_FLAGS 0x000200
+ALT_FORM1 0x001000
...
-ALT_FORM6 0x200000 */
+ALT_FORM5 0x010000 */
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
#include "sljitNativePPC_32.c"
@@ -590,14 +606,14 @@ ALT_FORM6 0x200000 */
#endif
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- sljit_s32 i, tmp, offs;
+ sljit_s32 args, i, tmp, offs;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
FAIL_IF(push_inst(compiler, MFLR | D(0)));
offs = -(sljit_s32)(sizeof(sljit_sw));
@@ -623,6 +639,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
#endif
FAIL_IF(push_inst(compiler, ADDI | D(TMP_ZERO) | A(0) | 0));
+
+ args = get_arg_count(arg_types);
+
if (args >= 1)
FAIL_IF(push_inst(compiler, OR | S(SLJIT_R0) | A(SLJIT_S0) | B(SLJIT_R0)));
if (args >= 2)
@@ -654,12 +673,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1) + SLJIT_LOCALS_OFFSET;
compiler->local_size = (local_size + 15) & ~0xf;
@@ -718,17 +737,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
/* Operators */
/* --------------------------------------------------------------------- */
-/* i/x - immediate/indexed form
- n/w - no write-back / write-back (1 bit)
- s/l - store/load (1 bit)
+/* s/l - store/load (1 bit)
+ i/x - immediate/indexed form
u/s - signed/unsigned (1 bit)
w/b/h/i - word/byte/half/int allowed (2 bit)
- It contans 32 items, but not all are different. */
+
+ Some opcodes are repeated (e.g. store signed / unsigned byte is the same instruction). */
/* 64 bit only: [reg+imm] must be aligned to 4 bytes. */
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
#define INT_ALIGNED 0x10000
-/* 64-bit only: there is no lwau instruction. */
-#define UPDATE_REQ 0x20000
+#endif
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
#define ARCH_32_64(a, b) a
@@ -737,401 +756,217 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
#else
#define ARCH_32_64(a, b) b
#define INST_CODE_AND_DST(inst, flags, reg) \
- (((inst) & ~(INT_ALIGNED | UPDATE_REQ)) | (((flags) & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg)))
+ (((inst) & ~INT_ALIGNED) | (((flags) & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg)))
#endif
-static const sljit_ins data_transfer_insts[64 + 8] = {
+static const sljit_ins data_transfer_insts[64 + 16] = {
-/* -------- Unsigned -------- */
+/* -------- Integer -------- */
/* Word. */
-/* u w n i s */ ARCH_32_64(HI(36) /* stw */, HI(62) | INT_ALIGNED | 0x0 /* std */),
-/* u w n i l */ ARCH_32_64(HI(32) /* lwz */, HI(58) | INT_ALIGNED | 0x0 /* ld */),
-/* u w n x s */ ARCH_32_64(HI(31) | LO(151) /* stwx */, HI(31) | LO(149) /* stdx */),
-/* u w n x l */ ARCH_32_64(HI(31) | LO(23) /* lwzx */, HI(31) | LO(21) /* ldx */),
+/* w u i s */ ARCH_32_64(HI(36) /* stw */, HI(62) | INT_ALIGNED | 0x0 /* std */),
+/* w u i l */ ARCH_32_64(HI(32) /* lwz */, HI(58) | INT_ALIGNED | 0x0 /* ld */),
+/* w u x s */ ARCH_32_64(HI(31) | LO(151) /* stwx */, HI(31) | LO(149) /* stdx */),
+/* w u x l */ ARCH_32_64(HI(31) | LO(23) /* lwzx */, HI(31) | LO(21) /* ldx */),
-/* u w w i s */ ARCH_32_64(HI(37) /* stwu */, HI(62) | INT_ALIGNED | 0x1 /* stdu */),
-/* u w w i l */ ARCH_32_64(HI(33) /* lwzu */, HI(58) | INT_ALIGNED | 0x1 /* ldu */),
-/* u w w x s */ ARCH_32_64(HI(31) | LO(183) /* stwux */, HI(31) | LO(181) /* stdux */),
-/* u w w x l */ ARCH_32_64(HI(31) | LO(55) /* lwzux */, HI(31) | LO(53) /* ldux */),
+/* w s i s */ ARCH_32_64(HI(36) /* stw */, HI(62) | INT_ALIGNED | 0x0 /* std */),
+/* w s i l */ ARCH_32_64(HI(32) /* lwz */, HI(58) | INT_ALIGNED | 0x0 /* ld */),
+/* w s x s */ ARCH_32_64(HI(31) | LO(151) /* stwx */, HI(31) | LO(149) /* stdx */),
+/* w s x l */ ARCH_32_64(HI(31) | LO(23) /* lwzx */, HI(31) | LO(21) /* ldx */),
/* Byte. */
-/* u b n i s */ HI(38) /* stb */,
-/* u b n i l */ HI(34) /* lbz */,
-/* u b n x s */ HI(31) | LO(215) /* stbx */,
-/* u b n x l */ HI(31) | LO(87) /* lbzx */,
+/* b u i s */ HI(38) /* stb */,
+/* b u i l */ HI(34) /* lbz */,
+/* b u x s */ HI(31) | LO(215) /* stbx */,
+/* b u x l */ HI(31) | LO(87) /* lbzx */,
-/* u b w i s */ HI(39) /* stbu */,
-/* u b w i l */ HI(35) /* lbzu */,
-/* u b w x s */ HI(31) | LO(247) /* stbux */,
-/* u b w x l */ HI(31) | LO(119) /* lbzux */,
+/* b s i s */ HI(38) /* stb */,
+/* b s i l */ HI(34) /* lbz */ /* EXTS_REQ */,
+/* b s x s */ HI(31) | LO(215) /* stbx */,
+/* b s x l */ HI(31) | LO(87) /* lbzx */ /* EXTS_REQ */,
/* Half. */
-/* u h n i s */ HI(44) /* sth */,
-/* u h n i l */ HI(40) /* lhz */,
-/* u h n x s */ HI(31) | LO(407) /* sthx */,
-/* u h n x l */ HI(31) | LO(279) /* lhzx */,
+/* h u i s */ HI(44) /* sth */,
+/* h u i l */ HI(40) /* lhz */,
+/* h u x s */ HI(31) | LO(407) /* sthx */,
+/* h u x l */ HI(31) | LO(279) /* lhzx */,
-/* u h w i s */ HI(45) /* sthu */,
-/* u h w i l */ HI(41) /* lhzu */,
-/* u h w x s */ HI(31) | LO(439) /* sthux */,
-/* u h w x l */ HI(31) | LO(311) /* lhzux */,
+/* h s i s */ HI(44) /* sth */,
+/* h s i l */ HI(42) /* lha */,
+/* h s x s */ HI(31) | LO(407) /* sthx */,
+/* h s x l */ HI(31) | LO(343) /* lhax */,
/* Int. */
-/* u i n i s */ HI(36) /* stw */,
-/* u i n i l */ HI(32) /* lwz */,
-/* u i n x s */ HI(31) | LO(151) /* stwx */,
-/* u i n x l */ HI(31) | LO(23) /* lwzx */,
+/* i u i s */ HI(36) /* stw */,
+/* i u i l */ HI(32) /* lwz */,
+/* i u x s */ HI(31) | LO(151) /* stwx */,
+/* i u x l */ HI(31) | LO(23) /* lwzx */,
+
+/* i s i s */ HI(36) /* stw */,
+/* i s i l */ ARCH_32_64(HI(32) /* lwz */, HI(58) | INT_ALIGNED | 0x2 /* lwa */),
+/* i s x s */ HI(31) | LO(151) /* stwx */,
+/* i s x l */ ARCH_32_64(HI(31) | LO(23) /* lwzx */, HI(31) | LO(341) /* lwax */),
-/* u i w i s */ HI(37) /* stwu */,
-/* u i w i l */ HI(33) /* lwzu */,
-/* u i w x s */ HI(31) | LO(183) /* stwux */,
-/* u i w x l */ HI(31) | LO(55) /* lwzux */,
+/* -------- Floating point -------- */
-/* -------- Signed -------- */
+/* d i s */ HI(54) /* stfd */,
+/* d i l */ HI(50) /* lfd */,
+/* d x s */ HI(31) | LO(727) /* stfdx */,
+/* d x l */ HI(31) | LO(599) /* lfdx */,
+
+/* s i s */ HI(52) /* stfs */,
+/* s i l */ HI(48) /* lfs */,
+/* s x s */ HI(31) | LO(663) /* stfsx */,
+/* s x l */ HI(31) | LO(535) /* lfsx */,
+};
+
+static const sljit_ins updated_data_transfer_insts[64] = {
+
+/* -------- Integer -------- */
/* Word. */
-/* s w n i s */ ARCH_32_64(HI(36) /* stw */, HI(62) | INT_ALIGNED | 0x0 /* std */),
-/* s w n i l */ ARCH_32_64(HI(32) /* lwz */, HI(58) | INT_ALIGNED | 0x0 /* ld */),
-/* s w n x s */ ARCH_32_64(HI(31) | LO(151) /* stwx */, HI(31) | LO(149) /* stdx */),
-/* s w n x l */ ARCH_32_64(HI(31) | LO(23) /* lwzx */, HI(31) | LO(21) /* ldx */),
+/* w u i s */ ARCH_32_64(HI(37) /* stwu */, HI(62) | INT_ALIGNED | 0x1 /* stdu */),
+/* w u i l */ ARCH_32_64(HI(33) /* lwzu */, HI(58) | INT_ALIGNED | 0x1 /* ldu */),
+/* w u x s */ ARCH_32_64(HI(31) | LO(183) /* stwux */, HI(31) | LO(181) /* stdux */),
+/* w u x l */ ARCH_32_64(HI(31) | LO(55) /* lwzux */, HI(31) | LO(53) /* ldux */),
-/* s w w i s */ ARCH_32_64(HI(37) /* stwu */, HI(62) | INT_ALIGNED | 0x1 /* stdu */),
-/* s w w i l */ ARCH_32_64(HI(33) /* lwzu */, HI(58) | INT_ALIGNED | 0x1 /* ldu */),
-/* s w w x s */ ARCH_32_64(HI(31) | LO(183) /* stwux */, HI(31) | LO(181) /* stdux */),
-/* s w w x l */ ARCH_32_64(HI(31) | LO(55) /* lwzux */, HI(31) | LO(53) /* ldux */),
+/* w s i s */ ARCH_32_64(HI(37) /* stwu */, HI(62) | INT_ALIGNED | 0x1 /* stdu */),
+/* w s i l */ ARCH_32_64(HI(33) /* lwzu */, HI(58) | INT_ALIGNED | 0x1 /* ldu */),
+/* w s x s */ ARCH_32_64(HI(31) | LO(183) /* stwux */, HI(31) | LO(181) /* stdux */),
+/* w s x l */ ARCH_32_64(HI(31) | LO(55) /* lwzux */, HI(31) | LO(53) /* ldux */),
/* Byte. */
-/* s b n i s */ HI(38) /* stb */,
-/* s b n i l */ HI(34) /* lbz */ /* EXTS_REQ */,
-/* s b n x s */ HI(31) | LO(215) /* stbx */,
-/* s b n x l */ HI(31) | LO(87) /* lbzx */ /* EXTS_REQ */,
+/* b u i s */ HI(39) /* stbu */,
+/* b u i l */ HI(35) /* lbzu */,
+/* b u x s */ HI(31) | LO(247) /* stbux */,
+/* b u x l */ HI(31) | LO(119) /* lbzux */,
-/* s b w i s */ HI(39) /* stbu */,
-/* s b w i l */ HI(35) /* lbzu */ /* EXTS_REQ */,
-/* s b w x s */ HI(31) | LO(247) /* stbux */,
-/* s b w x l */ HI(31) | LO(119) /* lbzux */ /* EXTS_REQ */,
+/* b s i s */ HI(39) /* stbu */,
+/* b s i l */ 0 /* no such instruction */,
+/* b s x s */ HI(31) | LO(247) /* stbux */,
+/* b s x l */ 0 /* no such instruction */,
/* Half. */
-/* s h n i s */ HI(44) /* sth */,
-/* s h n i l */ HI(42) /* lha */,
-/* s h n x s */ HI(31) | LO(407) /* sthx */,
-/* s h n x l */ HI(31) | LO(343) /* lhax */,
+/* h u i s */ HI(45) /* sthu */,
+/* h u i l */ HI(41) /* lhzu */,
+/* h u x s */ HI(31) | LO(439) /* sthux */,
+/* h u x l */ HI(31) | LO(311) /* lhzux */,
-/* s h w i s */ HI(45) /* sthu */,
-/* s h w i l */ HI(43) /* lhau */,
-/* s h w x s */ HI(31) | LO(439) /* sthux */,
-/* s h w x l */ HI(31) | LO(375) /* lhaux */,
+/* h s i s */ HI(45) /* sthu */,
+/* h s i l */ HI(43) /* lhau */,
+/* h s x s */ HI(31) | LO(439) /* sthux */,
+/* h s x l */ HI(31) | LO(375) /* lhaux */,
/* Int. */
-/* s i n i s */ HI(36) /* stw */,
-/* s i n i l */ ARCH_32_64(HI(32) /* lwz */, HI(58) | INT_ALIGNED | 0x2 /* lwa */),
-/* s i n x s */ HI(31) | LO(151) /* stwx */,
-/* s i n x l */ ARCH_32_64(HI(31) | LO(23) /* lwzx */, HI(31) | LO(341) /* lwax */),
+/* i u i s */ HI(37) /* stwu */,
+/* i u i l */ HI(33) /* lwzu */,
+/* i u x s */ HI(31) | LO(183) /* stwux */,
+/* i u x l */ HI(31) | LO(55) /* lwzux */,
-/* s i w i s */ HI(37) /* stwu */,
-/* s i w i l */ ARCH_32_64(HI(33) /* lwzu */, HI(58) | INT_ALIGNED | UPDATE_REQ | 0x2 /* lwa */),
-/* s i w x s */ HI(31) | LO(183) /* stwux */,
-/* s i w x l */ ARCH_32_64(HI(31) | LO(55) /* lwzux */, HI(31) | LO(373) /* lwaux */),
+/* i s i s */ HI(37) /* stwu */,
+/* i s i l */ ARCH_32_64(HI(33) /* lwzu */, 0 /* no such instruction */),
+/* i s x s */ HI(31) | LO(183) /* stwux */,
+/* i s x l */ ARCH_32_64(HI(31) | LO(55) /* lwzux */, HI(31) | LO(373) /* lwaux */),
-/* -------- Double -------- */
+/* -------- Floating point -------- */
-/* d n i s */ HI(54) /* stfd */,
-/* d n i l */ HI(50) /* lfd */,
-/* d n x s */ HI(31) | LO(727) /* stfdx */,
-/* d n x l */ HI(31) | LO(599) /* lfdx */,
-
-/* s n i s */ HI(52) /* stfs */,
-/* s n i l */ HI(48) /* lfs */,
-/* s n x s */ HI(31) | LO(663) /* stfsx */,
-/* s n x l */ HI(31) | LO(535) /* lfsx */,
+/* d i s */ HI(55) /* stfdu */,
+/* d i l */ HI(51) /* lfdu */,
+/* d x s */ HI(31) | LO(759) /* stfdux */,
+/* d x l */ HI(31) | LO(631) /* lfdux */,
+/* s i s */ HI(53) /* stfsu */,
+/* s i l */ HI(49) /* lfsu */,
+/* s x s */ HI(31) | LO(695) /* stfsux */,
+/* s x l */ HI(31) | LO(567) /* lfsux */,
};
#undef ARCH_32_64
/* Simple cases, (no caching is required). */
-static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
+static sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg,
+ sljit_s32 arg, sljit_sw argw, sljit_s32 tmp_reg)
{
sljit_ins inst;
+ sljit_s32 offs_reg;
+ sljit_sw high_short;
/* Should work when (arg & REG_MASK) == 0. */
- SLJIT_COMPILE_ASSERT(A(0) == 0, a0_must_be_0);
+ SLJIT_ASSERT(A(0) == 0);
SLJIT_ASSERT(arg & SLJIT_MEM);
- if (arg & OFFS_REG_MASK) {
- if (argw & 0x3)
- return 0;
- if (inp_flags & ARG_TEST)
- return 1;
-
- inst = data_transfer_insts[(inp_flags | INDEXED) & MEM_MASK];
- SLJIT_ASSERT(!(inst & (INT_ALIGNED | UPDATE_REQ)));
- FAIL_IF(push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | B(OFFS_REG(arg))));
- return -1;
- }
-
- if (SLJIT_UNLIKELY(!(arg & REG_MASK)))
- inp_flags &= ~WRITE_BACK;
-
-#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- inst = data_transfer_insts[inp_flags & MEM_MASK];
- SLJIT_ASSERT((arg & REG_MASK) || !(inst & UPDATE_REQ));
-
- if (argw > SIMM_MAX || argw < SIMM_MIN || ((inst & INT_ALIGNED) && (argw & 0x3)) || (inst & UPDATE_REQ))
- return 0;
- if (inp_flags & ARG_TEST)
- return 1;
-#endif
+ if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
+ argw &= 0x3;
+ offs_reg = OFFS_REG(arg);
+ if (argw != 0) {
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
- if (argw > SIMM_MAX || argw < SIMM_MIN)
- return 0;
- if (inp_flags & ARG_TEST)
- return 1;
-
- inst = data_transfer_insts[inp_flags & MEM_MASK];
- SLJIT_ASSERT(!(inst & (INT_ALIGNED | UPDATE_REQ)));
+ FAIL_IF(push_inst(compiler, RLWINM | S(OFFS_REG(arg)) | A(tmp_reg) | (argw << 11) | ((31 - argw) << 1)));
+#else
+ FAIL_IF(push_inst(compiler, RLDI(tmp_reg, OFFS_REG(arg), argw, 63 - argw, 1)));
#endif
+ offs_reg = tmp_reg;
+ }
- FAIL_IF(push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | IMM(argw)));
- return -1;
-}
+ inst = data_transfer_insts[(inp_flags | INDEXED) & MEM_MASK];
-/* See getput_arg below.
- Note: can_cache is called only for binary operators. Those operator always
- uses word arguments without write back. */
-static sljit_s32 can_cache(sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_sw high_short, next_high_short;
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- sljit_sw diff;
+ SLJIT_ASSERT(!(inst & INT_ALIGNED));
#endif
- SLJIT_ASSERT((arg & SLJIT_MEM) && (next_arg & SLJIT_MEM));
-
- if (arg & OFFS_REG_MASK)
- return ((arg & OFFS_REG_MASK) == (next_arg & OFFS_REG_MASK) && (argw & 0x3) == (next_argw & 0x3));
-
- if (next_arg & OFFS_REG_MASK)
- return 0;
-
-#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
- high_short = (argw + ((argw & 0x8000) << 1)) & ~0xffff;
- next_high_short = (next_argw + ((next_argw & 0x8000) << 1)) & ~0xffff;
- return high_short == next_high_short;
-#else
- if (argw <= 0x7fffffffl && argw >= -0x80000000l) {
- high_short = (argw + ((argw & 0x8000) << 1)) & ~0xffff;
- next_high_short = (next_argw + ((next_argw & 0x8000) << 1)) & ~0xffff;
- if (high_short == next_high_short)
- return 1;
+ return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | B(offs_reg));
}
- diff = argw - next_argw;
- if (!(arg & REG_MASK))
- return diff <= SIMM_MAX && diff >= SIMM_MIN;
-
- if (arg == next_arg && diff <= SIMM_MAX && diff >= SIMM_MIN)
- return 1;
-
- return 0;
-#endif
-}
-
-#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
-#define ADJUST_CACHED_IMM(imm) \
- if ((inst & INT_ALIGNED) && (imm & 0x3)) { \
- /* Adjust cached value. Fortunately this is really a rare case */ \
- compiler->cache_argw += imm & 0x3; \
- FAIL_IF(push_inst(compiler, ADDI | D(TMP_REG3) | A(TMP_REG3) | (imm & 0x3))); \
- imm &= ~0x3; \
- }
-#endif
+ inst = data_transfer_insts[inp_flags & MEM_MASK];
+ arg &= REG_MASK;
-/* Emit the necessary instructions. See can_cache above. */
-static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 inp_flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw, sljit_s32 next_arg, sljit_sw next_argw)
-{
- sljit_s32 tmp_r;
- sljit_ins inst;
- sljit_sw high_short, next_high_short;
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- sljit_sw diff;
-#endif
+ if ((inst & INT_ALIGNED) && (argw & 0x3) != 0) {
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw));
- SLJIT_ASSERT(arg & SLJIT_MEM);
-
- tmp_r = ((inp_flags & LOAD_DATA) && ((inp_flags) & MEM_MASK) <= GPR_REG) ? reg : TMP_REG1;
- /* Special case for "mov reg, [reg, ... ]". */
- if ((arg & REG_MASK) == tmp_r)
- tmp_r = TMP_REG1;
-
- if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
- argw &= 0x3;
- /* Otherwise getput_arg_fast would capture it. */
- SLJIT_ASSERT(argw);
-
- if ((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg && argw == compiler->cache_argw)
- tmp_r = TMP_REG3;
- else {
- if ((arg & OFFS_REG_MASK) == (next_arg & OFFS_REG_MASK) && argw == (next_argw & 0x3)) {
- compiler->cache_arg = SLJIT_MEM | (arg & OFFS_REG_MASK);
- compiler->cache_argw = argw;
- tmp_r = TMP_REG3;
- }
-#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
- FAIL_IF(push_inst(compiler, RLWINM | S(OFFS_REG(arg)) | A(tmp_r) | (argw << 11) | ((31 - argw) << 1)));
-#else
- FAIL_IF(push_inst(compiler, RLDI(tmp_r, OFFS_REG(arg), argw, 63 - argw, 1)));
-#endif
- }
inst = data_transfer_insts[(inp_flags | INDEXED) & MEM_MASK];
- SLJIT_ASSERT(!(inst & (INT_ALIGNED | UPDATE_REQ)));
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | B(tmp_r));
+ return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg) | B(tmp_reg));
}
+#endif
- if (SLJIT_UNLIKELY(!(arg & REG_MASK)))
- inp_flags &= ~WRITE_BACK;
-
- inst = data_transfer_insts[inp_flags & MEM_MASK];
- SLJIT_ASSERT((arg & REG_MASK) || !(inst & UPDATE_REQ));
+ if (argw <= SIMM_MAX && argw >= SIMM_MIN)
+ return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg) | IMM(argw));
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- if (argw <= 0x7fff7fffl && argw >= -0x80000000l
- && (!(inst & INT_ALIGNED) || !(argw & 0x3)) && !(inst & UPDATE_REQ)) {
+ if (argw <= 0x7fff7fffl && argw >= -0x80000000l) {
#endif
- arg &= REG_MASK;
high_short = (sljit_s32)(argw + ((argw & 0x8000) << 1)) & ~0xffff;
- /* The getput_arg_fast should handle this otherwise. */
+
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
SLJIT_ASSERT(high_short && high_short <= 0x7fffffffl && high_short >= -0x80000000l);
#else
- SLJIT_ASSERT(high_short && !(inst & (INT_ALIGNED | UPDATE_REQ)));
+ SLJIT_ASSERT(high_short);
#endif
- if (inp_flags & WRITE_BACK) {
- if (arg == reg) {
- FAIL_IF(push_inst(compiler, OR | S(reg) | A(tmp_r) | B(reg)));
- reg = tmp_r;
- }
- tmp_r = arg;
- FAIL_IF(push_inst(compiler, ADDIS | D(arg) | A(arg) | IMM(high_short >> 16)));
- }
- else if (compiler->cache_arg != (SLJIT_MEM | arg) || high_short != compiler->cache_argw) {
- if ((next_arg & SLJIT_MEM) && !(next_arg & OFFS_REG_MASK)) {
- next_high_short = (sljit_s32)(next_argw + ((next_argw & 0x8000) << 1)) & ~0xffff;
- if (high_short == next_high_short) {
- compiler->cache_arg = SLJIT_MEM | arg;
- compiler->cache_argw = high_short;
- tmp_r = TMP_REG3;
- }
- }
- FAIL_IF(push_inst(compiler, ADDIS | D(tmp_r) | A(arg & REG_MASK) | IMM(high_short >> 16)));
- }
- else
- tmp_r = TMP_REG3;
-
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(tmp_r) | IMM(argw));
+ FAIL_IF(push_inst(compiler, ADDIS | D(tmp_reg) | A(arg) | IMM(high_short >> 16)));
+ return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(tmp_reg) | IMM(argw));
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
}
- /* Everything else is PPC-64 only. */
- if (SLJIT_UNLIKELY(!(arg & REG_MASK))) {
- diff = argw - compiler->cache_argw;
- if ((compiler->cache_arg & SLJIT_IMM) && diff <= SIMM_MAX && diff >= SIMM_MIN) {
- ADJUST_CACHED_IMM(diff);
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(TMP_REG3) | IMM(diff));
- }
-
- diff = argw - next_argw;
- if ((next_arg & SLJIT_MEM) && diff <= SIMM_MAX && diff >= SIMM_MIN) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
-
- compiler->cache_arg = SLJIT_IMM;
- compiler->cache_argw = argw;
- tmp_r = TMP_REG3;
- }
-
- FAIL_IF(load_immediate(compiler, tmp_r, argw));
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(tmp_r));
- }
+ /* The rest is PPC-64 only. */
- diff = argw - compiler->cache_argw;
- if (compiler->cache_arg == arg && diff <= SIMM_MAX && diff >= SIMM_MIN) {
- SLJIT_ASSERT(!(inp_flags & WRITE_BACK) && !(inst & UPDATE_REQ));
- ADJUST_CACHED_IMM(diff);
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(TMP_REG3) | IMM(diff));
- }
-
- if ((compiler->cache_arg & SLJIT_IMM) && diff <= SIMM_MAX && diff >= SIMM_MIN) {
- inst = data_transfer_insts[(inp_flags | INDEXED) & MEM_MASK];
- SLJIT_ASSERT(!(inst & (INT_ALIGNED | UPDATE_REQ)));
- if (compiler->cache_argw != argw) {
- FAIL_IF(push_inst(compiler, ADDI | D(TMP_REG3) | A(TMP_REG3) | IMM(diff)));
- compiler->cache_argw = argw;
- }
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | B(TMP_REG3));
- }
-
- if (argw == next_argw && (next_arg & SLJIT_MEM)) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
-
- compiler->cache_arg = SLJIT_IMM;
- compiler->cache_argw = argw;
-
- inst = data_transfer_insts[(inp_flags | INDEXED) & MEM_MASK];
- SLJIT_ASSERT(!(inst & (INT_ALIGNED | UPDATE_REQ)));
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | B(TMP_REG3));
- }
-
- diff = argw - next_argw;
- if (arg == next_arg && !(inp_flags & WRITE_BACK) && diff <= SIMM_MAX && diff >= SIMM_MIN) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
- FAIL_IF(push_inst(compiler, ADD | D(TMP_REG3) | A(TMP_REG3) | B(arg & REG_MASK)));
-
- compiler->cache_arg = arg;
- compiler->cache_argw = argw;
-
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(TMP_REG3));
- }
+ FAIL_IF(load_immediate(compiler, tmp_reg, argw));
- if ((next_arg & SLJIT_MEM) && !(next_arg & OFFS_REG_MASK) && diff <= SIMM_MAX && diff >= SIMM_MIN) {
- SLJIT_ASSERT(inp_flags & LOAD_DATA);
- FAIL_IF(load_immediate(compiler, TMP_REG3, argw));
-
- compiler->cache_arg = SLJIT_IMM;
- compiler->cache_argw = argw;
- tmp_r = TMP_REG3;
- }
- else
- FAIL_IF(load_immediate(compiler, tmp_r, argw));
-
- /* Get the indexed version instead of the normal one. */
inst = data_transfer_insts[(inp_flags | INDEXED) & MEM_MASK];
- SLJIT_ASSERT(!(inst & (INT_ALIGNED | UPDATE_REQ)));
- return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg & REG_MASK) | B(tmp_r));
+ return push_inst(compiler, INST_CODE_AND_DST(inst, inp_flags, reg) | A(arg) | B(tmp_reg));
#endif
}
-static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg1, sljit_sw arg1w, sljit_s32 arg2, sljit_sw arg2w)
-{
- if (getput_arg_fast(compiler, flags, reg, arg1, arg1w))
- return compiler->error;
- return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w);
-}
-
static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 input_flags,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src1, sljit_sw src1w,
@@ -1139,42 +974,21 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
{
/* arg1 goes to TMP_REG1 or src reg
arg2 goes to TMP_REG2, imm or src reg
- TMP_REG3 can be used for caching
- result goes to TMP_REG2, so put result can use TMP_REG1 and TMP_REG3. */
- sljit_s32 dst_r;
+ result goes to TMP_REG2, so put result can use TMP_REG1. */
+ sljit_s32 dst_r = TMP_REG2;
sljit_s32 src1_r;
sljit_s32 src2_r;
sljit_s32 sugg_src2_r = TMP_REG2;
- sljit_s32 flags = input_flags & (ALT_FORM1 | ALT_FORM2 | ALT_FORM3 | ALT_FORM4 | ALT_FORM5 | ALT_FORM6 | ALT_SIGN_EXT | ALT_SET_FLAGS);
-
- if (!(input_flags & ALT_KEEP_CACHE)) {
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- }
+ sljit_s32 flags = input_flags & (ALT_FORM1 | ALT_FORM2 | ALT_FORM3 | ALT_FORM4 | ALT_FORM5 | ALT_SIGN_EXT | ALT_SET_FLAGS);
/* Destination check. */
- if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
- return SLJIT_SUCCESS;
- dst_r = TMP_REG2;
- }
- else if (FAST_IS_REG(dst)) {
+ if (SLOW_IS_REG(dst)) {
dst_r = dst;
flags |= REG_DEST;
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
+
+ if (op >= SLJIT_MOV && op <= SLJIT_MOV_P)
sugg_src2_r = dst_r;
}
- else {
- SLJIT_ASSERT(dst & SLJIT_MEM);
- if (getput_arg_fast(compiler, input_flags | ARG_TEST, TMP_REG2, dst, dstw)) {
- flags |= FAST_DEST;
- dst_r = TMP_REG2;
- }
- else {
- flags |= SLOW_DEST;
- dst_r = 0;
- }
- }
/* Source 1. */
if (FAST_IS_REG(src1)) {
@@ -1185,80 +999,34 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
FAIL_IF(load_immediate(compiler, TMP_REG1, src1w));
src1_r = TMP_REG1;
}
- else if (getput_arg_fast(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w)) {
- FAIL_IF(compiler->error);
+ else {
+ FAIL_IF(emit_op_mem(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w, TMP_REG1));
src1_r = TMP_REG1;
}
- else
- src1_r = 0;
/* Source 2. */
if (FAST_IS_REG(src2)) {
src2_r = src2;
flags |= REG2_SOURCE;
- if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
+
+ if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOV_P)
dst_r = src2_r;
}
else if (src2 & SLJIT_IMM) {
FAIL_IF(load_immediate(compiler, sugg_src2_r, src2w));
src2_r = sugg_src2_r;
}
- else if (getput_arg_fast(compiler, input_flags | LOAD_DATA, sugg_src2_r, src2, src2w)) {
- FAIL_IF(compiler->error);
- src2_r = sugg_src2_r;
- }
- else
- src2_r = 0;
-
- /* src1_r, src2_r and dst_r can be zero (=unprocessed).
- All arguments are complex addressing modes, and it is a binary operator. */
- if (src1_r == 0 && src2_r == 0 && dst_r == 0) {
- if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG2, src2, src2w, src1, src1w));
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw));
- }
- else {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w, src2, src2w));
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG2, src2, src2w, dst, dstw));
- }
- src1_r = TMP_REG1;
- src2_r = TMP_REG2;
- }
- else if (src1_r == 0 && src2_r == 0) {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w, src2, src2w));
- src1_r = TMP_REG1;
- }
- else if (src1_r == 0 && dst_r == 0) {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w, dst, dstw));
- src1_r = TMP_REG1;
- }
- else if (src2_r == 0 && dst_r == 0) {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, sugg_src2_r, src2, src2w, dst, dstw));
- src2_r = sugg_src2_r;
- }
-
- if (dst_r == 0)
- dst_r = TMP_REG2;
-
- if (src1_r == 0) {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, TMP_REG1, src1, src1w, 0, 0));
- src1_r = TMP_REG1;
- }
-
- if (src2_r == 0) {
- FAIL_IF(getput_arg(compiler, input_flags | LOAD_DATA, sugg_src2_r, src2, src2w, 0, 0));
+ else {
+ FAIL_IF(emit_op_mem(compiler, input_flags | LOAD_DATA, sugg_src2_r, src2, src2w, TMP_REG2));
src2_r = sugg_src2_r;
}
FAIL_IF(emit_single_op(compiler, op, flags, dst_r, src1_r, src2_r));
- if (flags & (FAST_DEST | SLOW_DEST)) {
- if (flags & FAST_DEST)
- FAIL_IF(getput_arg_fast(compiler, input_flags, dst_r, dst, dstw));
- else
- FAIL_IF(getput_arg(compiler, input_flags, dst_r, dst, dstw, 0, 0));
- }
- return SLJIT_SUCCESS;
+ if (!(dst & SLJIT_MEM))
+ return SLJIT_SUCCESS;
+
+ return emit_op_mem(compiler, input_flags, dst_r, dst, dstw, TMP_REG1);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
@@ -1308,6 +1076,31 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
return SLJIT_SUCCESS;
}
+static sljit_s32 emit_prefetch(struct sljit_compiler *compiler,
+ sljit_s32 src, sljit_sw srcw)
+{
+ if (!(src & OFFS_REG_MASK)) {
+ if (srcw == 0 && (src & REG_MASK) != SLJIT_UNUSED)
+ return push_inst(compiler, DCBT | A(0) | B(src & REG_MASK));
+
+ FAIL_IF(load_immediate(compiler, TMP_REG1, srcw));
+ /* Works with SLJIT_MEM0() case as well. */
+ return push_inst(compiler, DCBT | A(src & REG_MASK) | B(TMP_REG1));
+ }
+
+ srcw &= 0x3;
+
+ if (srcw == 0)
+ return push_inst(compiler, DCBT | A(src & REG_MASK) | B(OFFS_REG(src)));
+
+#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
+ FAIL_IF(push_inst(compiler, RLWINM | S(OFFS_REG(src)) | A(TMP_REG1) | (srcw << 11) | ((31 - srcw) << 1)));
+#else
+ FAIL_IF(push_inst(compiler, RLDI(TMP_REG1, OFFS_REG(src), srcw, 63 - srcw, 1)));
+#endif
+ return push_inst(compiler, DCBT | A(src & REG_MASK) | B(TMP_REG1));
+}
+
#define EMIT_MOV(type, type_flags, type_cast) \
emit_op(compiler, (src & SLJIT_IMM) ? SLJIT_MOV : type, flags | (type_flags), dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? type_cast srcw : srcw)
@@ -1315,7 +1108,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
- sljit_s32 flags = GET_FLAGS(op) ? ALT_SET_FLAGS : 0;
+ sljit_s32 flags = HAS_FLAGS(op) ? ALT_SET_FLAGS : 0;
sljit_s32 op_flags = GET_ALL_FLAGS(op);
CHECK_ERROR();
@@ -1323,39 +1116,45 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op)) {
+ if (op <= SLJIT_MOV_P && (src & SLJIT_MEM))
+ return emit_prefetch(compiler, src, srcw);
+
+ return SLJIT_SUCCESS;
+ }
+
op = GET_OPCODE(op);
if ((src & SLJIT_IMM) && srcw == 0)
src = TMP_ZERO;
- if (op_flags & SLJIT_SET_O)
+ if (GET_FLAG_TYPE(op_flags) == SLJIT_OVERFLOW)
FAIL_IF(push_inst(compiler, MTXER | S(TMP_ZERO)));
+ if (op < SLJIT_NOT && FAST_IS_REG(src) && src == dst) {
+ if (!TYPE_CAST_NEEDED(op))
+ return SLJIT_SUCCESS;
+ }
+
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
if (op_flags & SLJIT_I32_OP) {
if (op < SLJIT_NOT) {
- if (FAST_IS_REG(src) && src == dst) {
- if (!TYPE_CAST_NEEDED(op))
- return SLJIT_SUCCESS;
+ if (src & SLJIT_MEM) {
+ if (op == SLJIT_MOV_S32)
+ op = SLJIT_MOV_U32;
+ }
+ else if (src & SLJIT_IMM) {
+ if (op == SLJIT_MOV_U32)
+ op = SLJIT_MOV_S32;
}
-#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- if (op == SLJIT_MOV_S32 && (src & SLJIT_MEM))
- op = SLJIT_MOV_U32;
- if (op == SLJIT_MOVU_S32 && (src & SLJIT_MEM))
- op = SLJIT_MOVU_U32;
- if (op == SLJIT_MOV_U32 && (src & SLJIT_IMM))
- op = SLJIT_MOV_S32;
- if (op == SLJIT_MOVU_U32 && (src & SLJIT_IMM))
- op = SLJIT_MOVU_S32;
-#endif
}
-#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
else {
/* Most operations expect sign extended arguments. */
flags |= INT_DATA | SIGNED_DATA;
- if (src & SLJIT_IMM)
- srcw = (sljit_s32)srcw;
+ if (HAS_FLAGS(op_flags))
+ flags |= ALT_SIGN_EXT;
}
-#endif
}
+#endif
switch (op) {
case SLJIT_MOV:
@@ -1386,39 +1185,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
case SLJIT_MOV_S16:
return EMIT_MOV(SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA, (sljit_s16));
- case SLJIT_MOVU:
- case SLJIT_MOVU_P:
-#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
- case SLJIT_MOVU_U32:
- case SLJIT_MOVU_S32:
-#endif
- return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-
-#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- case SLJIT_MOVU_U32:
- return EMIT_MOV(SLJIT_MOV_U32, INT_DATA | WRITE_BACK, (sljit_u32));
-
- case SLJIT_MOVU_S32:
- return EMIT_MOV(SLJIT_MOV_S32, INT_DATA | SIGNED_DATA | WRITE_BACK, (sljit_s32));
-#endif
-
- case SLJIT_MOVU_U8:
- return EMIT_MOV(SLJIT_MOV_U8, BYTE_DATA | WRITE_BACK, (sljit_u8));
-
- case SLJIT_MOVU_S8:
- return EMIT_MOV(SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA | WRITE_BACK, (sljit_s8));
-
- case SLJIT_MOVU_U16:
- return EMIT_MOV(SLJIT_MOV_U16, HALF_DATA | WRITE_BACK, (sljit_u16));
-
- case SLJIT_MOVU_S16:
- return EMIT_MOV(SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA | WRITE_BACK, (sljit_s16));
-
case SLJIT_NOT:
return emit_op(compiler, SLJIT_NOT, flags, dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_NEG:
- return emit_op(compiler, SLJIT_NEG, flags, dst, dstw, TMP_REG1, 0, src, srcw);
+ return emit_op(compiler, SLJIT_NEG, flags | (GET_FLAG_TYPE(op_flags) ? ALT_FORM1 : 0), dst, dstw, TMP_REG1, 0, src, srcw);
case SLJIT_CLZ:
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
@@ -1471,7 +1242,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- sljit_s32 flags = GET_FLAGS(op) ? ALT_SET_FLAGS : 0;
+ sljit_s32 flags = HAS_FLAGS(op) ? ALT_SET_FLAGS : 0;
CHECK_ERROR();
CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1479,6 +1250,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
+
if ((src1 & SLJIT_IMM) && src1w == 0)
src1 = TMP_ZERO;
if ((src2 & SLJIT_IMM) && src2w == 0)
@@ -1492,45 +1266,46 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
src1w = (sljit_s32)(src1w);
if (src2 & SLJIT_IMM)
src2w = (sljit_s32)(src2w);
- if (GET_FLAGS(op))
+ if (HAS_FLAGS(op))
flags |= ALT_SIGN_EXT;
}
#endif
- if (op & SLJIT_SET_O)
+ if (GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
FAIL_IF(push_inst(compiler, MTXER | S(TMP_ZERO)));
- if (src2 == TMP_REG2)
- flags |= ALT_KEEP_CACHE;
switch (GET_OPCODE(op)) {
case SLJIT_ADD:
- if (!GET_FLAGS(op) && ((src1 | src2) & SLJIT_IMM)) {
+ if (GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM1, dst, dstw, src1, src1w, src2, src2w);
+
+ if (!HAS_FLAGS(op) && ((src1 | src2) & SLJIT_IMM)) {
if (TEST_SL_IMM(src2, src2w)) {
compiler->imm = src2w & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM1, dst, dstw, src1, src1w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
}
if (TEST_SL_IMM(src1, src1w)) {
compiler->imm = src1w & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM1, dst, dstw, src2, src2w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src2, src2w, TMP_REG2, 0);
}
if (TEST_SH_IMM(src2, src2w)) {
compiler->imm = (src2w >> 16) & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
}
if (TEST_SH_IMM(src1, src1w)) {
compiler->imm = (src1w >> 16) & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src2, src2w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM3, dst, dstw, src2, src2w, TMP_REG2, 0);
}
/* Range between -1 and -32768 is covered above. */
if (TEST_ADD_IMM(src2, src2w)) {
compiler->imm = src2w & 0xffffffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM4, dst, dstw, src1, src1w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM4, dst, dstw, src1, src1w, TMP_REG2, 0);
}
if (TEST_ADD_IMM(src1, src1w)) {
compiler->imm = src1w & 0xffffffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM4, dst, dstw, src2, src2w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM4, dst, dstw, src2, src2w, TMP_REG2, 0);
}
}
- if (!(GET_FLAGS(op) & (SLJIT_SET_E | SLJIT_SET_O))) {
+ if (HAS_FLAGS(op)) {
if (TEST_SL_IMM(src2, src2w)) {
compiler->imm = src2w & 0xffff;
return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1540,75 +1315,75 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src2, src2w, TMP_REG2, 0);
}
}
- return emit_op(compiler, SLJIT_ADD, flags, dst, dstw, src1, src1w, src2, src2w);
+ return emit_op(compiler, SLJIT_ADD, flags | ((GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)) ? ALT_FORM4 : 0), dst, dstw, src1, src1w, src2, src2w);
case SLJIT_ADDC:
- return emit_op(compiler, SLJIT_ADDC, flags | (!(op & SLJIT_KEEP_FLAGS) ? 0 : ALT_FORM1), dst, dstw, src1, src1w, src2, src2w);
+ return emit_op(compiler, SLJIT_ADDC, flags, dst, dstw, src1, src1w, src2, src2w);
case SLJIT_SUB:
- if (!GET_FLAGS(op) && ((src1 | src2) & SLJIT_IMM)) {
+ if (GET_FLAG_TYPE(op) >= SLJIT_LESS && GET_FLAG_TYPE(op) <= SLJIT_LESS_EQUAL) {
+ if (dst == SLJIT_UNUSED) {
+ if (TEST_UL_IMM(src2, src2w)) {
+ compiler->imm = src2w & 0xffff;
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM1 | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
+ }
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM1, dst, dstw, src1, src1w, src2, src2w);
+ }
+
+ if ((src2 & SLJIT_IMM) && src2w >= 0 && src2w <= (SIMM_MAX + 1)) {
+ compiler->imm = src2w;
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM1 | ALT_FORM2 | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
+ }
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM1 | ALT_FORM3, dst, dstw, src1, src1w, src2, src2w);
+ }
+
+ if (GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2, dst, dstw, src1, src1w, src2, src2w);
+
+ if (!HAS_FLAGS(op) && ((src1 | src2) & SLJIT_IMM)) {
if (TEST_SL_IMM(src2, -src2w)) {
compiler->imm = (-src2w) & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM1, dst, dstw, src1, src1w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
}
if (TEST_SL_IMM(src1, src1w)) {
compiler->imm = src1w & 0xffff;
- return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM1, dst, dstw, src2, src2w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM3, dst, dstw, src2, src2w, TMP_REG2, 0);
}
if (TEST_SH_IMM(src2, -src2w)) {
compiler->imm = ((-src2w) >> 16) & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
}
/* Range between -1 and -32768 is covered above. */
if (TEST_ADD_IMM(src2, -src2w)) {
compiler->imm = -src2w & 0xffffffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM4, dst, dstw, src1, src1w, TMP_REG2, 0);
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM4, dst, dstw, src1, src1w, TMP_REG2, 0);
}
}
- if (dst == SLJIT_UNUSED && (op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S)) && !(op & (SLJIT_SET_O | SLJIT_SET_C))) {
- if (!(op & SLJIT_SET_U)) {
- /* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
- if (TEST_SL_IMM(src2, src2w)) {
- compiler->imm = src2w & 0xffff;
- return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
- }
- if (GET_FLAGS(op) == SLJIT_SET_E && TEST_SL_IMM(src1, src1w)) {
- compiler->imm = src1w & 0xffff;
- return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2, dst, dstw, src2, src2w, TMP_REG2, 0);
- }
- }
- if (!(op & (SLJIT_SET_E | SLJIT_SET_S))) {
- /* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
- if (TEST_UL_IMM(src2, src2w)) {
- compiler->imm = src2w & 0xffff;
- return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
- }
- return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM4, dst, dstw, src1, src1w, src2, src2w);
- }
- if ((src2 & SLJIT_IMM) && src2w >= 0 && src2w <= 0x7fff) {
- compiler->imm = src2w;
- return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2 | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
+
+ if (dst == SLJIT_UNUSED && GET_FLAG_TYPE(op) != GET_FLAG_TYPE(SLJIT_SET_CARRY)) {
+ if (TEST_SL_IMM(src2, src2w)) {
+ compiler->imm = src2w & 0xffff;
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM4 | ALT_FORM5, dst, dstw, src1, src1w, TMP_REG2, 0);
}
- return emit_op(compiler, SLJIT_SUB, flags | ((op & SLJIT_SET_U) ? ALT_FORM4 : 0) | ((op & (SLJIT_SET_E | SLJIT_SET_S)) ? ALT_FORM5 : 0), dst, dstw, src1, src1w, src2, src2w);
+ return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM4, dst, dstw, src1, src1w, src2, src2w);
}
- if (!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O))) {
- if (TEST_SL_IMM(src2, -src2w)) {
- compiler->imm = (-src2w) & 0xffff;
- return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
- }
+
+ if (TEST_SL_IMM(src2, -src2w)) {
+ compiler->imm = (-src2w) & 0xffff;
+ return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
}
/* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
- return emit_op(compiler, SLJIT_SUB, flags | (!(op & SLJIT_SET_U) ? 0 : ALT_FORM6), dst, dstw, src1, src1w, src2, src2w);
+ return emit_op(compiler, SLJIT_SUB, flags | ((GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)) ? ALT_FORM5 : 0), dst, dstw, src1, src1w, src2, src2w);
case SLJIT_SUBC:
- return emit_op(compiler, SLJIT_SUBC, flags | (!(op & SLJIT_KEEP_FLAGS) ? 0 : ALT_FORM1), dst, dstw, src1, src1w, src2, src2w);
+ return emit_op(compiler, SLJIT_SUBC, flags, dst, dstw, src1, src1w, src2, src2w);
case SLJIT_MUL:
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
if (op & SLJIT_I32_OP)
flags |= ALT_FORM2;
#endif
- if (!GET_FLAGS(op)) {
+ if (!HAS_FLAGS(op)) {
if (TEST_SL_IMM(src2, src2w)) {
compiler->imm = src2w & 0xffff;
return emit_op(compiler, SLJIT_MUL, flags | ALT_FORM1, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1618,13 +1393,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
return emit_op(compiler, SLJIT_MUL, flags | ALT_FORM1, dst, dstw, src2, src2w, TMP_REG2, 0);
}
}
+ else
+ FAIL_IF(push_inst(compiler, MTXER | S(TMP_ZERO)));
return emit_op(compiler, SLJIT_MUL, flags, dst, dstw, src1, src1w, src2, src2w);
case SLJIT_AND:
case SLJIT_OR:
case SLJIT_XOR:
/* Commutative unsigned operations. */
- if (!GET_FLAGS(op) || GET_OPCODE(op) == SLJIT_AND) {
+ if (!HAS_FLAGS(op) || GET_OPCODE(op) == SLJIT_AND) {
if (TEST_UL_IMM(src2, src2w)) {
compiler->imm = src2w;
return emit_op(compiler, GET_OPCODE(op), flags | ALT_FORM1, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1642,7 +1419,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
return emit_op(compiler, GET_OPCODE(op), flags | ALT_FORM2, dst, dstw, src2, src2w, TMP_REG2, 0);
}
}
- if (!GET_FLAGS(op) && GET_OPCODE(op) != SLJIT_AND) {
+ if (GET_OPCODE(op) != SLJIT_AND && GET_OPCODE(op) != SLJIT_AND) {
+ /* Unlike or and xor, and resets unwanted bits as well. */
if (TEST_UI_IMM(src2, src2w)) {
compiler->imm = src2w;
return emit_op(compiler, GET_OPCODE(op), flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1654,12 +1432,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
}
return emit_op(compiler, GET_OPCODE(op), flags, dst, dstw, src1, src1w, src2, src2w);
- case SLJIT_ASHR:
- if (op & SLJIT_KEEP_FLAGS)
- flags |= ALT_FORM3;
- /* Fall through. */
case SLJIT_SHL:
case SLJIT_LSHR:
+ case SLJIT_ASHR:
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
if (op & SLJIT_I32_OP)
flags |= ALT_FORM2;
@@ -1683,7 +1458,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
- return reg;
+ return freg_map[reg];
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -1699,16 +1474,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#else
- /* Available by default. */
- return 1;
-#endif
-}
-
#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 6))
#define SELECT_FOP(op, single, double) ((op & SLJIT_F32_OP) ? single : double)
@@ -1733,7 +1498,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
{
if (src & SLJIT_MEM) {
/* We can ignore the temporary data store on the stack from caching point of view. */
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src, srcw, TMP_REG1));
src = TMP_FREG1;
}
@@ -1741,28 +1506,21 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
op = GET_OPCODE(op);
FAIL_IF(push_inst(compiler, (op == SLJIT_CONV_S32_FROM_F64 ? FCTIWZ : FCTIDZ) | FD(TMP_FREG1) | FB(src)));
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (op == SLJIT_CONV_SW_FROM_F64) {
if (FAST_IS_REG(dst)) {
- FAIL_IF(emit_op_mem2(compiler, DOUBLE_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, 0, 0));
- return emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, dst, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, 0, 0);
+ FAIL_IF(emit_op_mem(compiler, DOUBLE_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1));
+ return emit_op_mem(compiler, WORD_DATA | LOAD_DATA, dst, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1);
}
- return emit_op_mem2(compiler, DOUBLE_DATA, TMP_FREG1, dst, dstw, 0, 0);
+ return emit_op_mem(compiler, DOUBLE_DATA, TMP_FREG1, dst, dstw, TMP_REG1);
}
-
#else
FAIL_IF(push_inst(compiler, FCTIWZ | FD(TMP_FREG1) | FB(src)));
-
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
#endif
if (FAST_IS_REG(dst)) {
FAIL_IF(load_immediate(compiler, TMP_REG1, FLOAT_TMP_MEM_OFFSET));
FAIL_IF(push_inst(compiler, STFIWX | FS(TMP_FREG1) | A(SLJIT_SP) | B(TMP_REG1)));
- return emit_op_mem2(compiler, INT_DATA | LOAD_DATA, dst, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, 0, 0);
+ return emit_op_mem(compiler, INT_DATA | LOAD_DATA, dst, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1);
}
SLJIT_ASSERT(dst & SLJIT_MEM);
@@ -1813,21 +1571,21 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, EXTSW | S(src) | A(TMP_REG1)));
else
- FAIL_IF(emit_op_mem2(compiler, INT_DATA | SIGNED_DATA | LOAD_DATA, TMP_REG1, src, srcw, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET));
+ FAIL_IF(emit_op_mem(compiler, INT_DATA | SIGNED_DATA | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1));
src = TMP_REG1;
}
if (FAST_IS_REG(src)) {
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA, src, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET));
- FAIL_IF(emit_op_mem2(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, dst, dstw));
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA, src, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1));
+ FAIL_IF(emit_op_mem(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1));
}
else
- FAIL_IF(emit_op_mem2(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG1, src, srcw, TMP_REG1));
FAIL_IF(push_inst(compiler, FCFID | FD(dst_r) | FB(TMP_FREG1)));
if (dst & SLJIT_MEM)
- return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
+ return emit_op_mem(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, TMP_REG1);
if (op & SLJIT_F32_OP)
return push_inst(compiler, FRSP | FD(dst_r) | FB(dst_r));
return SLJIT_SUCCESS;
@@ -1843,7 +1601,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
invert_sign = 0;
}
else if (!FAST_IS_REG(src)) {
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA | SIGNED_DATA | LOAD_DATA, TMP_REG1, src, srcw, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW));
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA | SIGNED_DATA | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1));
src = TMP_REG1;
}
@@ -1855,17 +1613,17 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
FAIL_IF(push_inst(compiler, ADDIS | D(TMP_REG2) | A(0) | 0x4330));
if (invert_sign)
FAIL_IF(push_inst(compiler, XORIS | S(src) | A(TMP_REG1) | 0x8000));
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA, TMP_REG2, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_HI, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET));
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA, TMP_REG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_HI));
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_HI, TMP_REG1));
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW, TMP_REG2));
FAIL_IF(push_inst(compiler, ADDIS | D(TMP_REG1) | A(0) | 0x8000));
- FAIL_IF(emit_op_mem2(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW));
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA, TMP_REG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET));
- FAIL_IF(emit_op_mem2(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG2, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW));
+ FAIL_IF(emit_op_mem(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1));
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET_LOW, TMP_REG2));
+ FAIL_IF(emit_op_mem(compiler, DOUBLE_DATA | LOAD_DATA, TMP_FREG2, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, TMP_REG1));
FAIL_IF(push_inst(compiler, FSUB | FD(dst_r) | FA(TMP_FREG1) | FB(TMP_FREG2)));
if (dst & SLJIT_MEM)
- return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
+ return emit_op_mem(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, TMP_REG1);
if (op & SLJIT_F32_OP)
return push_inst(compiler, FRSP | FD(dst_r) | FB(dst_r));
return SLJIT_SUCCESS;
@@ -1878,12 +1636,12 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compile
sljit_s32 src2, sljit_sw src2w)
{
if (src1 & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, TMP_REG1));
src1 = TMP_FREG1;
}
if (src2 & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, 0, 0));
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, TMP_REG2));
src2 = TMP_FREG2;
}
@@ -1897,8 +1655,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
sljit_s32 dst_r;
CHECK_ERROR();
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
SLJIT_COMPILE_ASSERT((SLJIT_F32_OP == 0x100) && !(DOUBLE_DATA & 0x4), float_transfer_bit_error);
SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw);
@@ -1909,7 +1665,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (src & SLJIT_MEM) {
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, dst_r, src, srcw, dst, dstw));
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op) | LOAD_DATA, dst_r, src, srcw, TMP_REG1));
src = dst_r;
}
@@ -1938,7 +1694,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
}
if (dst & SLJIT_MEM)
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), dst_r, dst, dstw, 0, 0));
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op), dst_r, dst, dstw, TMP_REG1));
return SLJIT_SUCCESS;
}
@@ -1947,7 +1703,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- sljit_s32 dst_r, flags = 0;
+ sljit_s32 dst_r;
CHECK_ERROR();
CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -1955,46 +1711,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
-
dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG2;
if (src1 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w)) {
- FAIL_IF(compiler->error);
- src1 = TMP_FREG1;
- } else
- flags |= ALT_FORM1;
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, TMP_REG1));
+ src1 = TMP_FREG1;
}
if (src2 & SLJIT_MEM) {
- if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w)) {
- FAIL_IF(compiler->error);
- src2 = TMP_FREG2;
- } else
- flags |= ALT_FORM2;
- }
-
- if ((flags & (ALT_FORM1 | ALT_FORM2)) == (ALT_FORM1 | ALT_FORM2)) {
- if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, src1, src1w));
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw));
- }
- else {
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw));
- }
- }
- else if (flags & ALT_FORM1)
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, dst, dstw));
- else if (flags & ALT_FORM2)
- FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, dst, dstw));
-
- if (flags & ALT_FORM1)
- src1 = TMP_FREG1;
- if (flags & ALT_FORM2)
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, TMP_REG2));
src2 = TMP_FREG2;
+ }
switch (GET_OPCODE(op)) {
case SLJIT_ADD_F64:
@@ -2014,13 +1741,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
break;
}
- if (dst_r == TMP_FREG2)
- FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG2, dst, dstw, 0, 0));
+ if (dst & SLJIT_MEM)
+ FAIL_IF(emit_op_mem(compiler, FLOAT_DATA(op), TMP_FREG2, dst, dstw, TMP_REG1));
return SLJIT_SUCCESS;
}
-#undef FLOAT_DATA
#undef SELECT_FOP
/* --------------------------------------------------------------------- */
@@ -2033,10 +1759,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
- /* For UNUSED dst. Uncommon, but possible. */
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
return push_inst(compiler, MFLR | D(dst));
@@ -2054,12 +1776,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, MTLR | S(src)));
else {
- if (src & SLJIT_MEM)
- FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, TMP_REG2, 0, TMP_REG1, 0, src, srcw));
- else if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, TMP_REG2, srcw));
+ FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, TMP_REG2, 0, TMP_REG1, 0, src, srcw));
FAIL_IF(push_inst(compiler, MTLR | S(TMP_REG2)));
}
+
return push_inst(compiler, BLR);
}
@@ -2093,33 +1813,33 @@ static sljit_ins get_bo_bi_flags(sljit_s32 type)
return (4 << 21) | (2 << 16);
case SLJIT_LESS:
- case SLJIT_LESS_F64:
- return (12 << 21) | ((4 + 0) << 16);
-
- case SLJIT_GREATER_EQUAL:
- case SLJIT_GREATER_EQUAL_F64:
- return (4 << 21) | ((4 + 0) << 16);
-
- case SLJIT_GREATER:
- case SLJIT_GREATER_F64:
- return (12 << 21) | ((4 + 1) << 16);
-
- case SLJIT_LESS_EQUAL:
- case SLJIT_LESS_EQUAL_F64:
- return (4 << 21) | ((4 + 1) << 16);
-
case SLJIT_SIG_LESS:
return (12 << 21) | (0 << 16);
+ case SLJIT_GREATER_EQUAL:
case SLJIT_SIG_GREATER_EQUAL:
return (4 << 21) | (0 << 16);
+ case SLJIT_GREATER:
case SLJIT_SIG_GREATER:
return (12 << 21) | (1 << 16);
+ case SLJIT_LESS_EQUAL:
case SLJIT_SIG_LESS_EQUAL:
return (4 << 21) | (1 << 16);
+ case SLJIT_LESS_F64:
+ return (12 << 21) | ((4 + 0) << 16);
+
+ case SLJIT_GREATER_EQUAL_F64:
+ return (4 << 21) | ((4 + 0) << 16);
+
+ case SLJIT_GREATER_F64:
+ return (12 << 21) | ((4 + 1) << 16);
+
+ case SLJIT_LESS_EQUAL_F64:
+ return (4 << 21) | ((4 + 1) << 16);
+
case SLJIT_OVERFLOW:
case SLJIT_MUL_OVERFLOW:
return (12 << 21) | (3 << 16);
@@ -2141,7 +1861,7 @@ static sljit_ins get_bo_bi_flags(sljit_s32 type)
return (4 << 21) | ((4 + 3) << 16);
default:
- SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
+ SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL_CDECL);
return (20 << 21);
}
}
@@ -2167,7 +1887,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
if (type < SLJIT_JUMP)
jump->flags |= IS_COND;
#if (defined SLJIT_PASS_ENTRY_ADDR_TO_CALL && SLJIT_PASS_ENTRY_ADDR_TO_CALL)
- if (type >= SLJIT_CALL0)
+ if (type >= SLJIT_CALL)
jump->flags |= IS_CALL;
#endif
@@ -2178,6 +1898,24 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
return jump;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+ PTR_FAIL_IF(call_with_args(compiler, arg_types, NULL));
+#endif
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_jump(compiler, type);
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
{
struct sljit_jump *jump = NULL;
@@ -2189,7 +1927,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
if (FAST_IS_REG(src)) {
#if (defined SLJIT_PASS_ENTRY_ADDR_TO_CALL && SLJIT_PASS_ENTRY_ADDR_TO_CALL)
- if (type >= SLJIT_CALL0) {
+ if (type >= SLJIT_CALL) {
FAIL_IF(push_inst(compiler, OR | S(src) | A(TMP_CALL_REG) | B(src)));
src_r = TMP_CALL_REG;
}
@@ -2199,12 +1937,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
src_r = src;
#endif
} else if (src & SLJIT_IMM) {
+ /* These jumps are converted to jump/call instructions when possible. */
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF(!jump);
set_jump(jump, compiler, JUMP_ADDR);
jump->u.target = srcw;
#if (defined SLJIT_PASS_ENTRY_ADDR_TO_CALL && SLJIT_PASS_ENTRY_ADDR_TO_CALL)
- if (type >= SLJIT_CALL0)
+ if (type >= SLJIT_CALL)
jump->flags |= IS_CALL;
#endif
FAIL_IF(emit_const(compiler, TMP_CALL_REG, 0));
@@ -2221,153 +1960,302 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
return push_inst(compiler, BCCTR | (20 << 21) | (type >= SLJIT_FAST_CALL ? 1 : 0));
}
-/* Get a bit from CR, all other bits are zeroed. */
-#define GET_CR_BIT(bit, dst) \
- FAIL_IF(push_inst(compiler, MFCR | D(dst))); \
- FAIL_IF(push_inst(compiler, RLWINM | S(dst) | A(dst) | ((1 + (bit)) << 11) | (31 << 6) | (31 << 1)));
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+ if (src & SLJIT_MEM) {
+ ADJUST_LOCAL_OFFSET(src, srcw);
+ FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, TMP_CALL_REG, 0, TMP_REG1, 0, src, srcw));
+ src = TMP_CALL_REG;
+ }
+
+ FAIL_IF(call_with_args(compiler, arg_types, &src));
+#endif
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
-#define INVERT_BIT(dst) \
- FAIL_IF(push_inst(compiler, XORI | S(dst) | A(dst) | 0x1));
+ return sljit_emit_ijump(compiler, type, src, srcw);
+}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
- sljit_s32 reg, input_flags;
- sljit_s32 flags = GET_ALL_FLAGS(op);
- sljit_sw original_dstw = dstw;
+ sljit_s32 reg, input_flags, cr_bit, invert;
+ sljit_s32 saved_op = op;
+ sljit_sw saved_dstw = dstw;
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
- op = GET_OPCODE(op);
- reg = (op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2;
-
- compiler->cache_arg = 0;
- compiler->cache_argw = 0;
- if (op >= SLJIT_ADD && (src & SLJIT_MEM)) {
- ADJUST_LOCAL_OFFSET(src, srcw);
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- input_flags = (flags & SLJIT_I32_OP) ? INT_DATA : WORD_DATA;
+ input_flags = (op & SLJIT_I32_OP) ? INT_DATA : WORD_DATA;
#else
- input_flags = WORD_DATA;
+ input_flags = WORD_DATA;
#endif
- FAIL_IF(emit_op_mem2(compiler, input_flags | LOAD_DATA, TMP_REG1, src, srcw, dst, dstw));
- src = TMP_REG1;
- srcw = 0;
- }
- switch (type & 0xff) {
- case SLJIT_EQUAL:
- GET_CR_BIT(2, reg);
- break;
+ op = GET_OPCODE(op);
+ reg = (op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2;
- case SLJIT_NOT_EQUAL:
- GET_CR_BIT(2, reg);
- INVERT_BIT(reg);
- break;
+ if (op >= SLJIT_ADD && (dst & SLJIT_MEM))
+ FAIL_IF(emit_op_mem(compiler, input_flags | LOAD_DATA, TMP_REG1, dst, dstw, TMP_REG1));
+
+ invert = 0;
+ cr_bit = 0;
+ switch (type & 0xff) {
case SLJIT_LESS:
- case SLJIT_LESS_F64:
- GET_CR_BIT(4 + 0, reg);
+ case SLJIT_SIG_LESS:
break;
case SLJIT_GREATER_EQUAL:
- case SLJIT_GREATER_EQUAL_F64:
- GET_CR_BIT(4 + 0, reg);
- INVERT_BIT(reg);
+ case SLJIT_SIG_GREATER_EQUAL:
+ invert = 1;
break;
case SLJIT_GREATER:
- case SLJIT_GREATER_F64:
- GET_CR_BIT(4 + 1, reg);
+ case SLJIT_SIG_GREATER:
+ cr_bit = 1;
break;
case SLJIT_LESS_EQUAL:
- case SLJIT_LESS_EQUAL_F64:
- GET_CR_BIT(4 + 1, reg);
- INVERT_BIT(reg);
- break;
-
- case SLJIT_SIG_LESS:
- GET_CR_BIT(0, reg);
- break;
-
- case SLJIT_SIG_GREATER_EQUAL:
- GET_CR_BIT(0, reg);
- INVERT_BIT(reg);
+ case SLJIT_SIG_LESS_EQUAL:
+ cr_bit = 1;
+ invert = 1;
break;
- case SLJIT_SIG_GREATER:
- GET_CR_BIT(1, reg);
+ case SLJIT_EQUAL:
+ cr_bit = 2;
break;
- case SLJIT_SIG_LESS_EQUAL:
- GET_CR_BIT(1, reg);
- INVERT_BIT(reg);
+ case SLJIT_NOT_EQUAL:
+ cr_bit = 2;
+ invert = 1;
break;
case SLJIT_OVERFLOW:
case SLJIT_MUL_OVERFLOW:
- GET_CR_BIT(3, reg);
+ cr_bit = 3;
break;
case SLJIT_NOT_OVERFLOW:
case SLJIT_MUL_NOT_OVERFLOW:
- GET_CR_BIT(3, reg);
- INVERT_BIT(reg);
+ cr_bit = 3;
+ invert = 1;
+ break;
+
+ case SLJIT_LESS_F64:
+ cr_bit = 4 + 0;
+ break;
+
+ case SLJIT_GREATER_EQUAL_F64:
+ cr_bit = 4 + 0;
+ invert = 1;
+ break;
+
+ case SLJIT_GREATER_F64:
+ cr_bit = 4 + 1;
+ break;
+
+ case SLJIT_LESS_EQUAL_F64:
+ cr_bit = 4 + 1;
+ invert = 1;
break;
case SLJIT_EQUAL_F64:
- GET_CR_BIT(4 + 2, reg);
+ cr_bit = 4 + 2;
break;
case SLJIT_NOT_EQUAL_F64:
- GET_CR_BIT(4 + 2, reg);
- INVERT_BIT(reg);
+ cr_bit = 4 + 2;
+ invert = 1;
break;
case SLJIT_UNORDERED_F64:
- GET_CR_BIT(4 + 3, reg);
+ cr_bit = 4 + 3;
break;
case SLJIT_ORDERED_F64:
- GET_CR_BIT(4 + 3, reg);
- INVERT_BIT(reg);
+ cr_bit = 4 + 3;
+ invert = 1;
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
+ FAIL_IF(push_inst(compiler, MFCR | D(reg)));
+ FAIL_IF(push_inst(compiler, RLWINM | S(reg) | A(reg) | ((1 + (cr_bit)) << 11) | (31 << 6) | (31 << 1)));
+
+ if (invert)
+ FAIL_IF(push_inst(compiler, XORI | S(reg) | A(reg) | 0x1));
+
if (op < SLJIT_ADD) {
-#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
- if (op == SLJIT_MOV)
- input_flags = WORD_DATA;
- else {
- op = SLJIT_MOV_U32;
- input_flags = INT_DATA;
- }
-#else
- op = SLJIT_MOV;
- input_flags = WORD_DATA;
-#endif
- if (reg != TMP_REG2)
+ if (!(dst & SLJIT_MEM))
return SLJIT_SUCCESS;
- return emit_op(compiler, op, input_flags, dst, dstw, TMP_REG1, 0, TMP_REG2, 0);
+ return emit_op_mem(compiler, input_flags, reg, dst, dstw, TMP_REG1);
}
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
compiler->skip_checks = 1;
#endif
- return sljit_emit_op2(compiler, op | flags, dst, original_dstw, src, srcw, TMP_REG2, 0);
+ if (dst & SLJIT_MEM)
+ return sljit_emit_op2(compiler, saved_op, dst, saved_dstw, TMP_REG1, 0, TMP_REG2, 0);
+ return sljit_emit_op2(compiler, saved_op, dst, 0, dst, 0, TMP_REG2, 0);
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
+
+ return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 reg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ sljit_s32 mem_flags;
+ sljit_ins inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw));
+
+ if (type & SLJIT_MEM_POST)
+ return SLJIT_ERR_UNSUPPORTED;
+
+ switch (type & 0xff) {
+ case SLJIT_MOV:
+ case SLJIT_MOV_P:
+#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
+ case SLJIT_MOV_U32:
+ case SLJIT_MOV_S32:
+#endif
+ mem_flags = WORD_DATA;
+ break;
+
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+ case SLJIT_MOV_U32:
+ mem_flags = INT_DATA;
+ break;
+
+ case SLJIT_MOV_S32:
+ mem_flags = INT_DATA;
+
+ if (!(type & SLJIT_MEM_STORE) && !(type & SLJIT_I32_OP)) {
+ if (mem & OFFS_REG_MASK)
+ mem_flags |= SIGNED_DATA;
+ else
+ return SLJIT_ERR_UNSUPPORTED;
+ }
+ break;
+#endif
+
+ case SLJIT_MOV_U8:
+ case SLJIT_MOV_S8:
+ mem_flags = BYTE_DATA;
+ break;
+
+ case SLJIT_MOV_U16:
+ mem_flags = HALF_DATA;
+ break;
+
+ case SLJIT_MOV_S16:
+ mem_flags = HALF_DATA | SIGNED_DATA;
+ break;
+
+ default:
+ SLJIT_UNREACHABLE();
+ mem_flags = WORD_DATA;
+ break;
+ }
+
+ if (!(type & SLJIT_MEM_STORE))
+ mem_flags |= LOAD_DATA;
+
+ if (SLJIT_UNLIKELY(mem & OFFS_REG_MASK)) {
+ if (memw != 0)
+ return SLJIT_ERR_UNSUPPORTED;
+
+ if (type & SLJIT_MEM_SUPP)
+ return SLJIT_SUCCESS;
+
+ inst = updated_data_transfer_insts[mem_flags | INDEXED];
+ FAIL_IF(push_inst(compiler, INST_CODE_AND_DST(inst, 0, reg) | A(mem & REG_MASK) | B(OFFS_REG(mem))));
+ }
+ else {
+ if (memw > SIMM_MAX || memw < SIMM_MIN)
+ return SLJIT_ERR_UNSUPPORTED;
+
+ inst = updated_data_transfer_insts[mem_flags];
+
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+ if ((inst & INT_ALIGNED) && (memw & 0x3) != 0)
+ return SLJIT_ERR_UNSUPPORTED;
+#endif
+
+ if (type & SLJIT_MEM_SUPP)
+ return SLJIT_SUCCESS;
+
+ FAIL_IF(push_inst(compiler, INST_CODE_AND_DST(inst, 0, reg) | A(mem & REG_MASK) | IMM(memw)));
+ }
+
+ if ((mem_flags & LOAD_DATA) && (type & 0xff) == SLJIT_MOV_S8)
+ return push_inst(compiler, EXTSB | S(reg) | A(reg));
+ return SLJIT_SUCCESS;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 freg,
+ sljit_s32 mem, sljit_sw memw)
+{
+ sljit_s32 mem_flags;
+ sljit_ins inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_fmem(compiler, type, freg, mem, memw));
+
+ if (type & SLJIT_MEM_POST)
+ return SLJIT_ERR_UNSUPPORTED;
+
+ if (SLJIT_UNLIKELY(mem & OFFS_REG_MASK)) {
+ if (memw != 0)
+ return SLJIT_ERR_UNSUPPORTED;
+ }
+ else {
+ if (memw > SIMM_MAX || memw < SIMM_MIN)
+ return SLJIT_ERR_UNSUPPORTED;
+ }
+
+ if (type & SLJIT_MEM_SUPP)
+ return SLJIT_SUCCESS;
+
+ mem_flags = FLOAT_DATA(type);
+
+ if (!(type & SLJIT_MEM_STORE))
+ mem_flags |= LOAD_DATA;
+
+ if (SLJIT_UNLIKELY(mem & OFFS_REG_MASK)) {
+ inst = updated_data_transfer_insts[mem_flags | INDEXED];
+ return push_inst(compiler, INST_CODE_AND_DST(inst, DOUBLE_DATA, freg) | A(mem & REG_MASK) | B(OFFS_REG(mem)));
+ }
+
+ inst = updated_data_transfer_insts[mem_flags];
+ return push_inst(compiler, INST_CODE_AND_DST(inst, DOUBLE_DATA, freg) | A(mem & REG_MASK) | IMM(memw));
}
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
@@ -2383,7 +2271,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- reg = SLOW_IS_REG(dst) ? dst : TMP_REG2;
+ reg = FAST_IS_REG(dst) ? dst : TMP_REG2;
PTR_FAIL_IF(emit_const(compiler, reg, init_value));
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeSPARC_32.c b/thirdparty/pcre2/src/sljit/sljitNativeSPARC_32.c
index 4a206f11d0..0671b130cc 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeSPARC_32.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeSPARC_32.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -60,7 +60,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return push_inst(compiler, SRA | D(dst) | S1(dst) | IMM(24), DR(dst));
}
else if (dst != src2)
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
case SLJIT_MOV_U16:
@@ -71,7 +71,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return push_inst(compiler, (op == SLJIT_MOV_S16 ? SRA : SRL) | D(dst) | S1(dst) | IMM(16), DR(dst));
}
else if (dst != src2)
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
case SLJIT_NOT:
@@ -80,18 +80,17 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
case SLJIT_CLZ:
SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM));
- /* sparc 32 does not support SLJIT_KEEP_FLAGS. Not sure I can fix this. */
FAIL_IF(push_inst(compiler, SUB | SET_FLAGS | D(0) | S1(src2) | S2(0), SET_FLAGS));
FAIL_IF(push_inst(compiler, OR | D(TMP_REG1) | S1(0) | S2(src2), DR(TMP_REG1)));
FAIL_IF(push_inst(compiler, BICC | DA(0x1) | (7 & DISP_MASK), UNMOVABLE_INS));
- FAIL_IF(push_inst(compiler, OR | (flags & SET_FLAGS) | D(dst) | S1(0) | IMM(32), UNMOVABLE_INS | (flags & SET_FLAGS)));
+ FAIL_IF(push_inst(compiler, OR | D(dst) | S1(0) | IMM(32), UNMOVABLE_INS));
FAIL_IF(push_inst(compiler, OR | D(dst) | S1(0) | IMM(-1), DR(dst)));
/* Loop. */
FAIL_IF(push_inst(compiler, SUB | SET_FLAGS | D(0) | S1(TMP_REG1) | S2(0), SET_FLAGS));
FAIL_IF(push_inst(compiler, SLL | D(TMP_REG1) | S1(TMP_REG1) | IMM(1), DR(TMP_REG1)));
FAIL_IF(push_inst(compiler, BICC | DA(0xe) | (-2 & DISP_MASK), UNMOVABLE_INS));
- return push_inst(compiler, ADD | (flags & SET_FLAGS) | D(dst) | S1(dst) | IMM(1), UNMOVABLE_INS | (flags & SET_FLAGS));
+ return push_inst(compiler, ADD | D(dst) | S1(dst) | IMM(1), UNMOVABLE_INS);
case SLJIT_ADD:
return push_inst(compiler, ADD | (flags & SET_FLAGS) | D(dst) | S1(src1) | ARG2(flags, src2), DR(dst) | (flags & SET_FLAGS));
@@ -135,7 +134,126 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return !(flags & SET_FLAGS) ? SLJIT_SUCCESS : push_inst(compiler, SUB | SET_FLAGS | D(0) | S1(dst) | S2(0), SET_FLAGS);
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
+ return SLJIT_SUCCESS;
+}
+
+static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src)
+{
+ sljit_s32 reg_index = 8;
+ sljit_s32 word_reg_index = 8;
+ sljit_s32 float_arg_index = 1;
+ sljit_s32 double_arg_count = 0;
+ sljit_s32 float_offset = (16 + 6) * sizeof(sljit_sw);
+ sljit_s32 types = 0;
+ sljit_s32 reg = 0;
+ sljit_s32 move_to_tmp2 = 0;
+
+ if (src)
+ reg = reg_map[*src & REG_MASK];
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ float_arg_index++;
+ if (reg_index == reg)
+ move_to_tmp2 = 1;
+ reg_index++;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ float_arg_index++;
+ double_arg_count++;
+ if (reg_index == reg || reg_index + 1 == reg)
+ move_to_tmp2 = 1;
+ reg_index += 2;
+ break;
+ default:
+ if (reg_index != word_reg_index && reg_index < 14 && reg_index == reg)
+ move_to_tmp2 = 1;
+ reg_index++;
+ word_reg_index++;
+ break;
+ }
+
+ if (move_to_tmp2) {
+ move_to_tmp2 = 0;
+ if (reg < 14)
+ FAIL_IF(push_inst(compiler, OR | D(TMP_REG1) | S1(0) | S2A(reg), DR(TMP_REG1)));
+ *src = TMP_REG1;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ arg_types = types;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ float_arg_index--;
+ FAIL_IF(push_inst(compiler, STF | FD(float_arg_index) | S1(SLJIT_SP) | IMM(float_offset), MOVABLE_INS));
+ float_offset -= sizeof(sljit_f64);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ float_arg_index--;
+ if (float_arg_index == 4 && double_arg_count == 4) {
+ FAIL_IF(push_inst(compiler, STF | FD(float_arg_index) | S1(SLJIT_SP) | IMM((16 + 7) * sizeof(sljit_sw)), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, STF | FD(float_arg_index) | (1 << 25) | S1(SLJIT_SP) | IMM((16 + 8) * sizeof(sljit_sw)), MOVABLE_INS));
+ }
+ else
+ FAIL_IF(push_inst(compiler, STDF | FD(float_arg_index) | S1(SLJIT_SP) | IMM(float_offset), MOVABLE_INS));
+ float_offset -= sizeof(sljit_f64);
+ break;
+ default:
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ float_offset = (16 + 6) * sizeof(sljit_sw);
+
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ reg_index--;
+ if (reg_index < 14)
+ FAIL_IF(push_inst(compiler, LDUW | DA(reg_index) | S1(SLJIT_SP) | IMM(float_offset), reg_index));
+ float_offset -= sizeof(sljit_f64);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ reg_index -= 2;
+ if (reg_index < 14) {
+ if ((reg_index & 0x1) != 0) {
+ FAIL_IF(push_inst(compiler, LDUW | DA(reg_index) | S1(SLJIT_SP) | IMM(float_offset), reg_index));
+ if (reg_index < 13)
+ FAIL_IF(push_inst(compiler, LDUW | DA(reg_index + 1) | S1(SLJIT_SP) | IMM(float_offset + sizeof(sljit_sw)), reg_index + 1));
+ }
+ else
+ FAIL_IF(push_inst(compiler, LDD | DA(reg_index) | S1(SLJIT_SP) | IMM(float_offset), reg_index));
+ }
+ float_offset -= sizeof(sljit_f64);
+ break;
+ default:
+ reg_index--;
+ word_reg_index--;
+
+ if (reg_index != word_reg_index) {
+ if (reg_index < 14)
+ FAIL_IF(push_inst(compiler, OR | DA(reg_index) | S1(0) | S2A(word_reg_index), reg_index));
+ else
+ FAIL_IF(push_inst(compiler, STW | DA(word_reg_index) | S1(SLJIT_SP) | IMM(92), word_reg_index));
+ }
+ break;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
return SLJIT_SUCCESS;
}
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeSPARC_common.c b/thirdparty/pcre2/src/sljit/sljitNativeSPARC_common.c
index 7445fc4723..669ecd8152 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeSPARC_common.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeSPARC_common.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -90,13 +90,19 @@ static void sparc_cache_flush(sljit_ins *from, sljit_ins *to)
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
+/* This register is modified by calls, which affects the instruction
+ in the delay slot if it is used as a source register. */
#define TMP_LINK (SLJIT_NUMBER_OF_REGISTERS + 5)
-#define TMP_FREG1 (0)
-#define TMP_FREG2 ((SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1) << 1)
+#define TMP_FREG1 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
+#define TMP_FREG2 (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2)
static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
- 0, 8, 9, 10, 13, 29, 28, 27, 23, 22, 21, 20, 19, 18, 17, 16, 26, 25, 24, 14, 1, 11, 12, 15
+ 0, 8, 9, 10, 11, 29, 28, 27, 23, 22, 21, 20, 19, 18, 17, 16, 26, 25, 24, 14, 1, 12, 13, 15
+};
+
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
+ 0, 0, 2, 4, 6, 8, 10, 12, 14
};
/* --------------------------------------------------------------------- */
@@ -104,10 +110,15 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
/* --------------------------------------------------------------------- */
#define D(d) (reg_map[d] << 25)
+#define FD(d) (freg_map[d] << 25)
+#define FDN(d) ((freg_map[d] | 0x1) << 25)
#define DA(d) ((d) << 25)
#define S1(s1) (reg_map[s1] << 14)
-#define S2(s2) (reg_map[s2])
+#define FS1(s1) (freg_map[s1] << 14)
#define S1A(s1) ((s1) << 14)
+#define S2(s2) (reg_map[s2])
+#define FS2(s2) (freg_map[s2])
+#define FS2N(s2) (freg_map[s2] | 0x1)
#define S2A(s2) (s2)
#define IMM_ARG 0x2000
#define DOP(op) ((op) << 5)
@@ -144,6 +155,8 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define FSUBD (OPC1(0x2) | OPC3(0x34) | DOP(0x46))
#define FSUBS (OPC1(0x2) | OPC3(0x34) | DOP(0x45))
#define JMPL (OPC1(0x2) | OPC3(0x38))
+#define LDD (OPC1(0x3) | OPC3(0x03))
+#define LDUW (OPC1(0x3) | OPC3(0x00))
#define NOP (OPC1(0x0) | OPC2(0x04))
#define OR (OPC1(0x2) | OPC3(0x02))
#define ORN (OPC1(0x2) | OPC3(0x06))
@@ -157,6 +170,9 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
#define SRAX (OPC1(0x2) | OPC3(0x27) | (1 << 12))
#define SRL (OPC1(0x2) | OPC3(0x26))
#define SRLX (OPC1(0x2) | OPC3(0x26) | (1 << 12))
+#define STDF (OPC1(0x3) | OPC3(0x27))
+#define STF (OPC1(0x3) | OPC3(0x24))
+#define STW (OPC1(0x3) | OPC3(0x04))
#define SUB (OPC1(0x2) | OPC3(0x04))
#define SUBC (OPC1(0x2) | OPC3(0x0c))
#define TA (OPC1(0x2) | OPC3(0x3a) | (8 << 25))
@@ -394,6 +410,27 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
return code;
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#else
+ /* Available by default. */
+ return 1;
+#endif
+
+#if (defined SLJIT_CONFIG_SPARC_64 && SLJIT_CONFIG_SPARC_64)
+ case SLJIT_HAS_CMOV:
+ return 1;
+#endif
+
+ default:
+ return 0;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Entry, exit */
/* --------------------------------------------------------------------- */
@@ -412,18 +449,17 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
#define MEM_MASK 0x1f
-#define WRITE_BACK 0x00020
-#define ARG_TEST 0x00040
-#define ALT_KEEP_CACHE 0x00080
-#define CUMULATIVE_OP 0x00100
-#define IMM_OP 0x00200
-#define SRC2_IMM 0x00400
+#define ARG_TEST 0x00020
+#define ALT_KEEP_CACHE 0x00040
+#define CUMULATIVE_OP 0x00080
+#define IMM_OP 0x00100
+#define SRC2_IMM 0x00200
-#define REG_DEST 0x00800
-#define REG2_SOURCE 0x01000
-#define SLOW_SRC1 0x02000
-#define SLOW_SRC2 0x04000
-#define SLOW_DEST 0x08000
+#define REG_DEST 0x00400
+#define REG2_SOURCE 0x00800
+#define SLOW_SRC1 0x01000
+#define SLOW_SRC2 0x02000
+#define SLOW_DEST 0x04000
/* SET_FLAGS (0x10 << 19) also belong here! */
@@ -434,12 +470,12 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
#endif
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
local_size = (local_size + SLJIT_LOCALS_OFFSET + 7) & ~0x7;
compiler->local_size = local_size;
@@ -458,12 +494,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
compiler->local_size = (local_size + SLJIT_LOCALS_OFFSET + 7) & ~0x7;
return SLJIT_SUCCESS;
@@ -525,18 +561,16 @@ static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flag
{
SLJIT_ASSERT(arg & SLJIT_MEM);
- if (!(flags & WRITE_BACK) || !(arg & REG_MASK)) {
- if ((!(arg & OFFS_REG_MASK) && argw <= SIMM_MAX && argw >= SIMM_MIN)
- || ((arg & OFFS_REG_MASK) && (argw & 0x3) == 0)) {
- /* Works for both absoulte and relative addresses (immediate case). */
- if (SLJIT_UNLIKELY(flags & ARG_TEST))
- return 1;
- FAIL_IF(push_inst(compiler, data_transfer_insts[flags & MEM_MASK]
- | ((flags & MEM_MASK) <= GPR_REG ? D(reg) : DA(reg))
- | S1(arg & REG_MASK) | ((arg & OFFS_REG_MASK) ? S2(OFFS_REG(arg)) : IMM(argw)),
- ((flags & MEM_MASK) <= GPR_REG && (flags & LOAD_DATA)) ? DR(reg) : MOVABLE_INS));
- return -1;
- }
+ if ((!(arg & OFFS_REG_MASK) && argw <= SIMM_MAX && argw >= SIMM_MIN)
+ || ((arg & OFFS_REG_MASK) && (argw & 0x3) == 0)) {
+ /* Works for both absoulte and relative addresses (immediate case). */
+ if (SLJIT_UNLIKELY(flags & ARG_TEST))
+ return 1;
+ FAIL_IF(push_inst(compiler, data_transfer_insts[flags & MEM_MASK]
+ | ((flags & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg))
+ | S1(arg & REG_MASK) | ((arg & OFFS_REG_MASK) ? S2(OFFS_REG(arg)) : IMM(argw)),
+ ((flags & MEM_MASK) <= GPR_REG && (flags & LOAD_DATA)) ? DR(reg) : MOVABLE_INS));
+ return -1;
}
return 0;
}
@@ -578,7 +612,6 @@ static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sl
base = arg & REG_MASK;
if (SLJIT_UNLIKELY(arg & OFFS_REG_MASK)) {
argw &= 0x3;
- SLJIT_ASSERT(argw != 0);
/* Using the cache. */
if (((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg) && (argw == compiler->cache_argw))
@@ -618,14 +651,11 @@ static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sl
}
}
- dest = ((flags & MEM_MASK) <= GPR_REG ? D(reg) : DA(reg));
+ dest = ((flags & MEM_MASK) <= GPR_REG ? D(reg) : FD(reg));
delay_slot = ((flags & MEM_MASK) <= GPR_REG && (flags & LOAD_DATA)) ? DR(reg) : MOVABLE_INS;
if (!base)
return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | dest | S1(arg2) | IMM(0), delay_slot);
- if (!(flags & WRITE_BACK))
- return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | dest | S1(base) | S2(arg2), delay_slot);
- FAIL_IF(push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | dest | S1(base) | S2(arg2), delay_slot));
- return push_inst(compiler, ADD | D(base) | S1(base) | S2(arg2), DR(base));
+ return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | dest | S1(base) | S2(arg2), delay_slot);
}
static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, sljit_s32 arg, sljit_sw argw)
@@ -663,18 +693,16 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
compiler->cache_argw = 0;
}
- if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32 && !(src2 & SLJIT_MEM))
- return SLJIT_SUCCESS;
- }
- else if (FAST_IS_REG(dst)) {
- dst_r = dst;
- flags |= REG_DEST;
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
- sugg_src2_r = dst_r;
+ if (dst != SLJIT_UNUSED) {
+ if (FAST_IS_REG(dst)) {
+ dst_r = dst;
+ flags |= REG_DEST;
+ if (op >= SLJIT_MOV && op <= SLJIT_MOV_P)
+ sugg_src2_r = dst_r;
+ }
+ else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, TMP_REG1, dst, dstw))
+ flags |= SLOW_DEST;
}
- else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, TMP_REG1, dst, dstw))
- flags |= SLOW_DEST;
if (flags & IMM_OP) {
if ((src2 & SLJIT_IMM) && src2w) {
@@ -720,7 +748,7 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
if (FAST_IS_REG(src2)) {
src2_r = src2;
flags |= REG2_SOURCE;
- if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOVU_S32)
+ if (!(flags & REG_DEST) && op >= SLJIT_MOV && op <= SLJIT_MOV_P)
dst_r = src2_r;
}
else if (src2 & SLJIT_IMM) {
@@ -731,7 +759,7 @@ static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s3
}
else {
src2_r = 0;
- if ((op >= SLJIT_MOV && op <= SLJIT_MOVU_S32) && (dst & SLJIT_MEM))
+ if ((op >= SLJIT_MOV && op <= SLJIT_MOV_P) && (dst & SLJIT_MEM))
dst_r = 0;
}
}
@@ -823,13 +851,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
- sljit_s32 flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+ sljit_s32 flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
CHECK_ERROR();
CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
ADJUST_LOCAL_OFFSET(dst, dstw);
ADJUST_LOCAL_OFFSET(src, srcw);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
+
op = GET_OPCODE(op);
switch (op) {
case SLJIT_MOV:
@@ -854,28 +885,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
case SLJIT_MOV_S16:
return emit_op(compiler, SLJIT_MOV_S16, flags | HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
- case SLJIT_MOVU:
- case SLJIT_MOVU_P:
- return emit_op(compiler, SLJIT_MOV, flags | WORD_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-
- case SLJIT_MOVU_U32:
- return emit_op(compiler, SLJIT_MOV_U32, flags | INT_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-
- case SLJIT_MOVU_S32:
- return emit_op(compiler, SLJIT_MOV_S32, flags | INT_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw);
-
- case SLJIT_MOVU_U8:
- return emit_op(compiler, SLJIT_MOV_U8, flags | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u8)srcw : srcw);
-
- case SLJIT_MOVU_S8:
- return emit_op(compiler, SLJIT_MOV_S8, flags | BYTE_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s8)srcw : srcw);
-
- case SLJIT_MOVU_U16:
- return emit_op(compiler, SLJIT_MOV_U16, flags | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_u16)srcw : srcw);
-
- case SLJIT_MOVU_S16:
- return emit_op(compiler, SLJIT_MOV_S16, flags | HALF_DATA | SIGNED_DATA | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ? (sljit_s16)srcw : srcw);
-
case SLJIT_NOT:
case SLJIT_CLZ:
return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw);
@@ -892,7 +901,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- sljit_s32 flags = GET_FLAGS(op) ? SET_FLAGS : 0;
+ sljit_s32 flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
CHECK_ERROR();
CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
@@ -900,6 +909,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src1, src1w);
ADJUST_LOCAL_OFFSET(src2, src2w);
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
+
op = GET_OPCODE(op);
switch (op) {
case SLJIT_ADD:
@@ -921,7 +933,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
if (src2 & SLJIT_IMM)
src2w &= 0x1f;
#else
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
#endif
return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w);
}
@@ -938,7 +950,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
- return reg << 1;
+ return freg_map[reg];
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -954,16 +966,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#else
- /* Available by default. */
- return 1;
-#endif
-}
-
#define FLOAT_DATA(op) (DOUBLE_DATA | ((op & SLJIT_F32_OP) >> 7))
#define SELECT_FOP(op, single, double) ((op & SLJIT_F32_OP) ? single : double)
#define FLOAT_TMP_MEM_OFFSET (22 * sizeof(sljit_sw))
@@ -976,13 +978,8 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
src = TMP_FREG1;
}
- else
- src <<= 1;
-
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSTOI, FDTOI) | DA(TMP_FREG1) | S2A(src), MOVABLE_INS));
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSTOI, FDTOI) | FD(TMP_FREG1) | FS2(src), MOVABLE_INS));
if (FAST_IS_REG(dst)) {
FAIL_IF(emit_op_mem2(compiler, SINGLE_DATA, TMP_FREG1, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET, SLJIT_MEM1(SLJIT_SP), FLOAT_TMP_MEM_OFFSET));
@@ -997,7 +994,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
- sljit_s32 dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
+ sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (src & SLJIT_IMM) {
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -1016,7 +1013,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_comp
}
FAIL_IF(emit_op_mem2(compiler, SINGLE_DATA | LOAD_DATA, TMP_FREG1, src, srcw, dst, dstw));
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FITOS, FITOD) | DA(dst_r) | S2A(TMP_FREG1), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FITOS, FITOD) | FD(dst_r) | FS2(TMP_FREG1), MOVABLE_INS));
if (dst & SLJIT_MEM)
return emit_op_mem2(compiler, FLOAT_DATA(op), TMP_FREG1, dst, dstw, 0, 0);
@@ -1031,17 +1028,13 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compile
FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w, src2, src2w));
src1 = TMP_FREG1;
}
- else
- src1 <<= 1;
if (src2 & SLJIT_MEM) {
FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w, 0, 0));
src2 = TMP_FREG2;
}
- else
- src2 <<= 1;
- return push_inst(compiler, SELECT_FOP(op, FCMPS, FCMPD) | S1A(src1) | S2A(src2), FCC_IS_SET | MOVABLE_INS);
+ return push_inst(compiler, SELECT_FOP(op, FCMPS, FCMPD) | FS1(src1) | FS2(src2), FCC_IS_SET | MOVABLE_INS);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
@@ -1060,39 +1053,37 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
if (GET_OPCODE(op) == SLJIT_CONV_F64_FROM_F32)
op ^= SLJIT_F32_OP;
- dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG1;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG1;
if (src & SLJIT_MEM) {
FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, dst_r, src, srcw, dst, dstw));
src = dst_r;
}
- else
- src <<= 1;
switch (GET_OPCODE(op)) {
case SLJIT_MOV_F64:
if (src != dst_r) {
if (dst_r != TMP_FREG1) {
- FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r) | S2A(src), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, FMOVS | FD(dst_r) | FS2(src), MOVABLE_INS));
if (!(op & SLJIT_F32_OP))
- FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r | 1) | S2A(src | 1), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, FMOVS | FDN(dst_r) | FS2N(src), MOVABLE_INS));
}
else
dst_r = src;
}
break;
case SLJIT_NEG_F64:
- FAIL_IF(push_inst(compiler, FNEGS | DA(dst_r) | S2A(src), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, FNEGS | FD(dst_r) | FS2(src), MOVABLE_INS));
if (dst_r != src && !(op & SLJIT_F32_OP))
- FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r | 1) | S2A(src | 1), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, FMOVS | FDN(dst_r) | FS2N(src), MOVABLE_INS));
break;
case SLJIT_ABS_F64:
- FAIL_IF(push_inst(compiler, FABSS | DA(dst_r) | S2A(src), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, FABSS | FD(dst_r) | FS2(src), MOVABLE_INS));
if (dst_r != src && !(op & SLJIT_F32_OP))
- FAIL_IF(push_inst(compiler, FMOVS | DA(dst_r | 1) | S2A(src | 1), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, FMOVS | FDN(dst_r) | FS2N(src), MOVABLE_INS));
break;
case SLJIT_CONV_F64_FROM_F32:
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSTOD, FDTOS) | DA(dst_r) | S2A(src), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSTOD, FDTOS) | FD(dst_r) | FS2(src), MOVABLE_INS));
op ^= SLJIT_F32_OP;
break;
}
@@ -1118,7 +1109,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
compiler->cache_arg = 0;
compiler->cache_argw = 0;
- dst_r = FAST_IS_REG(dst) ? (dst << 1) : TMP_FREG2;
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_FREG2;
if (src1 & SLJIT_MEM) {
if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG1, src1, src1w)) {
@@ -1127,8 +1118,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
} else
flags |= SLOW_SRC1;
}
- else
- src1 <<= 1;
if (src2 & SLJIT_MEM) {
if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, TMP_FREG2, src2, src2w)) {
@@ -1137,8 +1126,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
} else
flags |= SLOW_SRC2;
}
- else
- src2 <<= 1;
if ((flags & (SLOW_SRC1 | SLOW_SRC2)) == (SLOW_SRC1 | SLOW_SRC2)) {
if (!can_cache(src1, src1w, src2, src2w) && can_cache(src1, src1w, dst, dstw)) {
@@ -1162,19 +1149,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compil
switch (GET_OPCODE(op)) {
case SLJIT_ADD_F64:
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FADDS, FADDD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FADDS, FADDD) | FD(dst_r) | FS1(src1) | FS2(src2), MOVABLE_INS));
break;
case SLJIT_SUB_F64:
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSUBS, FSUBD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FSUBS, FSUBD) | FD(dst_r) | FS1(src1) | FS2(src2), MOVABLE_INS));
break;
case SLJIT_MUL_F64:
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FMULS, FMULD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FMULS, FMULD) | FD(dst_r) | FS1(src1) | FS2(src2), MOVABLE_INS));
break;
case SLJIT_DIV_F64:
- FAIL_IF(push_inst(compiler, SELECT_FOP(op, FDIVS, FDIVD) | DA(dst_r) | S1A(src1) | S2A(src2), MOVABLE_INS));
+ FAIL_IF(push_inst(compiler, SELECT_FOP(op, FDIVS, FDIVD) | FD(dst_r) | FS1(src1) | FS2(src2), MOVABLE_INS));
break;
}
@@ -1197,10 +1184,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
- /* For UNUSED dst. Uncommon, but possible. */
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
if (FAST_IS_REG(dst))
return push_inst(compiler, OR | D(dst) | S1(0) | S2(TMP_LINK), DR(dst));
@@ -1216,10 +1199,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, OR | D(TMP_LINK) | S1(0) | S2(src), DR(TMP_LINK)));
- else if (src & SLJIT_MEM)
+ else
FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_LINK, src, srcw));
- else if (src & SLJIT_IMM)
- FAIL_IF(load_immediate(compiler, TMP_LINK, srcw));
FAIL_IF(push_inst(compiler, JMPL | D(0) | S1(TMP_LINK) | IMM(8), UNMOVABLE_INS));
return push_inst(compiler, NOP, UNMOVABLE_INS);
@@ -1296,7 +1277,7 @@ static sljit_ins get_cc(sljit_s32 type)
return DA(0xf);
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return DA(0x8);
}
}
@@ -1332,21 +1313,38 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
#else
#error "Implementation required"
#endif
- } else {
+ }
+ else {
if ((compiler->delay_slot & DST_INS_MASK) != UNMOVABLE_INS)
jump->flags |= IS_MOVABLE;
if (type >= SLJIT_FAST_CALL)
jump->flags |= IS_CALL;
}
- PTR_FAIL_IF(emit_const(compiler, TMP_REG2, 0));
- PTR_FAIL_IF(push_inst(compiler, JMPL | D(type >= SLJIT_FAST_CALL ? TMP_LINK : 0) | S1(TMP_REG2) | IMM(0), UNMOVABLE_INS));
+ PTR_FAIL_IF(emit_const(compiler, TMP_REG1, 0));
+ PTR_FAIL_IF(push_inst(compiler, JMPL | D(type >= SLJIT_FAST_CALL ? TMP_LINK : 0) | S1(TMP_REG1) | IMM(0), UNMOVABLE_INS));
jump->addr = compiler->size;
PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
return jump;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+ PTR_FAIL_IF(call_with_args(compiler, arg_types, NULL));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_jump(compiler, type);
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
{
struct sljit_jump *jump = NULL;
@@ -1363,17 +1361,18 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
FAIL_IF(!jump);
set_jump(jump, compiler, JUMP_ADDR);
jump->u.target = srcw;
+
if ((compiler->delay_slot & DST_INS_MASK) != UNMOVABLE_INS)
jump->flags |= IS_MOVABLE;
if (type >= SLJIT_FAST_CALL)
jump->flags |= IS_CALL;
- FAIL_IF(emit_const(compiler, TMP_REG2, 0));
- src_r = TMP_REG2;
+ FAIL_IF(emit_const(compiler, TMP_REG1, 0));
+ src_r = TMP_REG1;
}
else {
- FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG2, src, srcw));
- src_r = TMP_REG2;
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw));
+ src_r = TMP_REG1;
}
FAIL_IF(push_inst(compiler, JMPL | D(type >= SLJIT_FAST_CALL ? TMP_LINK : 0) | S1(src_r) | IMM(0), UNMOVABLE_INS));
@@ -1382,32 +1381,48 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
return push_inst(compiler, NOP, UNMOVABLE_INS);
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+ if (src & SLJIT_MEM) {
+ ADJUST_LOCAL_OFFSET(src, srcw);
+ FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw));
+ src = TMP_REG1;
+ }
+
+ FAIL_IF(call_with_args(compiler, arg_types, &src));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_ijump(compiler, type, src, srcw);
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
- sljit_s32 reg, flags = (GET_FLAGS(op) ? SET_FLAGS : 0);
+ sljit_s32 reg, flags = HAS_FLAGS(op) ? SET_FLAGS : 0;
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
op = GET_OPCODE(op);
reg = (op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2;
compiler->cache_arg = 0;
compiler->cache_argw = 0;
- if (op >= SLJIT_ADD && (src & SLJIT_MEM)) {
- ADJUST_LOCAL_OFFSET(src, srcw);
- FAIL_IF(emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw, dst, dstw));
- src = TMP_REG1;
- srcw = 0;
- }
+
+ if (op >= SLJIT_ADD && (dst & SLJIT_MEM))
+ FAIL_IF(emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, dst, dstw, dst, dstw));
type &= 0xff;
if (type < SLJIT_EQUAL_F64)
@@ -1418,10 +1433,31 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
FAIL_IF(push_inst(compiler, OR | D(reg) | S1(0) | IMM(1), UNMOVABLE_INS));
FAIL_IF(push_inst(compiler, OR | D(reg) | S1(0) | IMM(0), UNMOVABLE_INS));
- if (op >= SLJIT_ADD)
- return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP | ALT_KEEP_CACHE, dst, dstw, src, srcw, TMP_REG2, 0);
+ if (op >= SLJIT_ADD) {
+ flags |= CUMULATIVE_OP | IMM_OP | ALT_KEEP_CACHE;
+ if (dst & SLJIT_MEM)
+ return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, TMP_REG2, 0);
+ return emit_op(compiler, op, flags, dst, 0, dst, 0, TMP_REG2, 0);
+ }
+
+ if (!(dst & SLJIT_MEM))
+ return SLJIT_SUCCESS;
+
+ return emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw);
+#else
+#error "Implementation required"
+#endif
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
- return (reg == TMP_REG2) ? emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw) : SLJIT_SUCCESS;
+#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+ return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);;
#else
#error "Implementation required"
#endif
@@ -1440,7 +1476,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- reg = SLOW_IS_REG(dst) ? dst : TMP_REG2;
+ reg = FAST_IS_REG(dst) ? dst : TMP_REG2;
PTR_FAIL_IF(emit_const(compiler, reg, init_value));
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeTILEGX-encoder.c b/thirdparty/pcre2/src/sljit/sljitNativeTILEGX-encoder.c
index 719632908c..dd82ebae6a 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeTILEGX-encoder.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeTILEGX-encoder.c
@@ -2,7 +2,7 @@
* Stack-less Just-In-Time compiler
*
* Copyright 2013-2013 Tilera Corporation(jiwang@tilera.com). All rights reserved.
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeTILEGX_64.c b/thirdparty/pcre2/src/sljit/sljitNativeTILEGX_64.c
index 177a65b006..003f43a790 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeTILEGX_64.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeTILEGX_64.c
@@ -2,7 +2,7 @@
* Stack-less Just-In-Time compiler
*
* Copyright 2013-2013 Tilera Corporation(jiwang@tilera.com). All rights reserved.
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -687,7 +687,7 @@ static sljit_s32 update_buffer(struct sljit_compiler *compiler)
inst_buf[0] = inst1;
inst_buf_index = 1;
} else
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
#ifdef TILEGX_JIT_DEBUG
return push_inst_nodebug(compiler, bits);
@@ -727,10 +727,10 @@ static sljit_s32 update_buffer(struct sljit_compiler *compiler)
return push_inst(compiler, bits);
#endif
} else
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
static sljit_s32 flush_buffer(struct sljit_compiler *compiler)
@@ -814,7 +814,7 @@ static sljit_s32 push_3_buffer(struct sljit_compiler *compiler, tilegx_mnemonic
break;
default:
printf("unrecoginzed opc: %s\n", opcode->name);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
inst_buf_index++;
@@ -859,7 +859,7 @@ static sljit_s32 push_2_buffer(struct sljit_compiler *compiler, tilegx_mnemonic
break;
default:
printf("unrecoginzed opc: %s\n", opcode->name);
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
inst_buf_index++;
@@ -1952,7 +1952,7 @@ static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sl
return SLJIT_SUCCESS;
}
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return SLJIT_SUCCESS;
}
@@ -2092,9 +2092,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
-
op = GET_OPCODE(op);
if (op == SLJIT_MOV_S32 || op == SLJIT_MOV_U32)
mem_type = INT_DATA | SIGNED_DATA;
@@ -2143,7 +2140,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
dst_ar = sugg_dst_ar;
break;
}
@@ -2186,7 +2183,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
case SLJIT_DIVMOD_SW:
case SLJIT_DIV_UW:
case SLJIT_DIV_SW:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
return SLJIT_SUCCESS;
@@ -2487,19 +2484,14 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compil
return jump;
}
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
- return 0;
-}
-
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src, sljit_sw srcw)
{
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 dst, sljit_sw dstw, sljit_s32 src1, sljit_sw src1w, sljit_s32 src2, sljit_sw src2w)
{
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
}
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const * sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeX86_32.c b/thirdparty/pcre2/src/sljit/sljitNativeX86_32.c
index 00333f6b33..8a83e273a4 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeX86_32.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeX86_32.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -64,20 +64,40 @@ static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- sljit_s32 size;
+ sljit_s32 args, size;
sljit_u8 *inst;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
+ args = get_arg_count(arg_types);
compiler->args = args;
- compiler->flags_saved = 0;
- size = 1 + (scratches > 7 ? (scratches - 7) : 0) + (saveds <= 3 ? saveds : 3);
+ /* [esp+0] for saving temporaries and function calls. */
+ compiler->stack_tmp_size = 2 * sizeof(sljit_sw);
+
+#if !(defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ if (scratches > 3)
+ compiler->stack_tmp_size = 3 * sizeof(sljit_sw);
+#endif
+
+ compiler->saveds_offset = compiler->stack_tmp_size;
+ if (scratches > 3)
+ compiler->saveds_offset += ((scratches > (3 + 6)) ? 6 : (scratches - 3)) * sizeof(sljit_sw);
+
+ compiler->locals_offset = compiler->saveds_offset;
+
+ if (saveds > 3)
+ compiler->locals_offset += (saveds - 3) * sizeof(sljit_sw);
+
+ if (options & SLJIT_F64_ALIGNMENT)
+ compiler->locals_offset = (compiler->locals_offset + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1);
+
+ size = 1 + (scratches > 9 ? (scratches - 9) : 0) + (saveds <= 3 ? saveds : 3);
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
size += (args > 0 ? (args * 2) : 0) + (args > 2 ? 2 : 0);
#else
@@ -94,11 +114,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
*inst++ = MOD_REG | (reg_map[TMP_REG1] << 3) | 0x4 /* esp */;
}
#endif
- if (saveds > 2 || scratches > 7)
+ if (saveds > 2 || scratches > 9)
PUSH_REG(reg_map[SLJIT_S2]);
- if (saveds > 1 || scratches > 8)
+ if (saveds > 1 || scratches > 10)
PUSH_REG(reg_map[SLJIT_S1]);
- if (saveds > 0 || scratches > 9)
+ if (saveds > 0 || scratches > 11)
PUSH_REG(reg_map[SLJIT_S0]);
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
@@ -134,73 +154,106 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
#endif
- SLJIT_COMPILE_ASSERT(SLJIT_LOCALS_OFFSET >= (2 + 4) * sizeof(sljit_uw), require_at_least_two_words);
+ SLJIT_ASSERT(SLJIT_LOCALS_OFFSET > 0);
+
#if defined(__APPLE__)
/* Ignore pushed registers and SLJIT_LOCALS_OFFSET when computing the aligned local size. */
- saveds = (2 + (scratches > 7 ? (scratches - 7) : 0) + (saveds <= 3 ? saveds : 3)) * sizeof(sljit_uw);
+ saveds = (2 + (scratches > 9 ? (scratches - 9) : 0) + (saveds <= 3 ? saveds : 3)) * sizeof(sljit_uw);
local_size = ((SLJIT_LOCALS_OFFSET + saveds + local_size + 15) & ~15) - saveds;
#else
- if (options & SLJIT_DOUBLE_ALIGNMENT) {
- local_size = SLJIT_LOCALS_OFFSET + ((local_size + 7) & ~7);
-
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 17);
- FAIL_IF(!inst);
-
- INC_SIZE(17);
- inst[0] = MOV_r_rm;
- inst[1] = MOD_REG | (reg_map[TMP_REG1] << 3) | reg_map[SLJIT_SP];
- inst[2] = GROUP_F7;
- inst[3] = MOD_REG | (0 << 3) | reg_map[SLJIT_SP];
- sljit_unaligned_store_sw(inst + 4, 0x4);
- inst[8] = JNE_i8;
- inst[9] = 6;
- inst[10] = GROUP_BINARY_81;
- inst[11] = MOD_REG | (5 << 3) | reg_map[SLJIT_SP];
- sljit_unaligned_store_sw(inst + 12, 0x4);
- inst[16] = PUSH_r + reg_map[TMP_REG1];
- }
+ if (options & SLJIT_F64_ALIGNMENT)
+ local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1));
else
- local_size = SLJIT_LOCALS_OFFSET + ((local_size + 3) & ~3);
+ local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_sw) - 1) & ~(sizeof(sljit_sw) - 1));
#endif
compiler->local_size = local_size;
+
#ifdef _WIN32
if (local_size > 1024) {
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
FAIL_IF(emit_do_imm(compiler, MOV_r_i32 + reg_map[SLJIT_R0], local_size));
#else
- local_size -= SLJIT_LOCALS_OFFSET;
+ /* Space for a single argument. This amount is excluded when the stack is allocated below. */
+ local_size -= sizeof(sljit_sw);
FAIL_IF(emit_do_imm(compiler, MOV_r_i32 + reg_map[SLJIT_R0], local_size));
- FAIL_IF(emit_non_cum_binary(compiler, SUB_r_rm, SUB_rm_r, SUB, SUB_EAX_i32,
- SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, SLJIT_LOCALS_OFFSET));
+ FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, sizeof(sljit_sw)));
#endif
- FAIL_IF(sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack)));
+ FAIL_IF(sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARG1(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack)));
}
#endif
SLJIT_ASSERT(local_size > 0);
- return emit_non_cum_binary(compiler, SUB_r_rm, SUB_rm_r, SUB, SUB_EAX_i32,
+
+#if !defined(__APPLE__)
+ if (options & SLJIT_F64_ALIGNMENT) {
+ EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_SP, 0);
+
+ /* Some space might allocated during sljit_grow_stack() above on WIN32. */
+ FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, local_size + sizeof(sljit_sw)));
+
+#if defined _WIN32 && !(defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ if (compiler->local_size > 1024)
+ FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD),
+ TMP_REG1, 0, TMP_REG1, 0, SLJIT_IMM, sizeof(sljit_sw)));
+#endif
+
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 6);
+ FAIL_IF(!inst);
+
+ INC_SIZE(6);
+ inst[0] = GROUP_BINARY_81;
+ inst[1] = MOD_REG | AND | reg_map[SLJIT_SP];
+ sljit_unaligned_store_sw(inst + 2, ~(sizeof(sljit_f64) - 1));
+
+ /* The real local size must be used. */
+ return emit_mov(compiler, SLJIT_MEM1(SLJIT_SP), compiler->local_size, TMP_REG1, 0);
+ }
+#endif
+ return emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, local_size);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
- compiler->args = args;
+ compiler->args = get_arg_count(arg_types);
+
+ /* [esp+0] for saving temporaries and function calls. */
+ compiler->stack_tmp_size = 2 * sizeof(sljit_sw);
+
+#if !(defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ if (scratches > 3)
+ compiler->stack_tmp_size = 3 * sizeof(sljit_sw);
+#endif
+
+ compiler->saveds_offset = compiler->stack_tmp_size;
+ if (scratches > 3)
+ compiler->saveds_offset += ((scratches > (3 + 6)) ? 6 : (scratches - 3)) * sizeof(sljit_sw);
+
+ compiler->locals_offset = compiler->saveds_offset;
+
+ if (saveds > 3)
+ compiler->locals_offset += (saveds - 3) * sizeof(sljit_sw);
+
+ if (options & SLJIT_F64_ALIGNMENT)
+ compiler->locals_offset = (compiler->locals_offset + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1);
#if defined(__APPLE__)
- saveds = (2 + (scratches > 7 ? (scratches - 7) : 0) + (saveds <= 3 ? saveds : 3)) * sizeof(sljit_uw);
+ saveds = (2 + (scratches > 9 ? (scratches - 9) : 0) + (saveds <= 3 ? saveds : 3)) * sizeof(sljit_uw);
compiler->local_size = ((SLJIT_LOCALS_OFFSET + saveds + local_size + 15) & ~15) - saveds;
#else
- if (options & SLJIT_DOUBLE_ALIGNMENT)
- compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + 7) & ~7);
+ if (options & SLJIT_F64_ALIGNMENT)
+ compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1));
else
- compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + 3) & ~3);
+ compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_sw) - 1) & ~(sizeof(sljit_sw) - 1));
#endif
return SLJIT_SUCCESS;
}
@@ -214,23 +267,19 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
CHECK(check_sljit_emit_return(compiler, op, src, srcw));
SLJIT_ASSERT(compiler->args >= 0);
- compiler->flags_saved = 0;
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
SLJIT_ASSERT(compiler->local_size > 0);
- FAIL_IF(emit_cum_binary(compiler, ADD_r_rm, ADD_rm_r, ADD, ADD_EAX_i32,
- SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size));
#if !defined(__APPLE__)
- if (compiler->options & SLJIT_DOUBLE_ALIGNMENT) {
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 3);
- FAIL_IF(!inst);
-
- INC_SIZE(3);
- inst[0] = MOV_r_rm;
- inst[1] = (reg_map[SLJIT_SP] << 3) | 0x4 /* SIB */;
- inst[2] = (4 << 3) | reg_map[SLJIT_SP];
- }
+ if (compiler->options & SLJIT_F64_ALIGNMENT)
+ EMIT_MOV(compiler, SLJIT_SP, 0, SLJIT_MEM1(SLJIT_SP), compiler->local_size)
+ else
+ FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size));
+#else
+ FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size));
#endif
size = 2 + (compiler->scratches > 7 ? (compiler->scratches - 7) : 0) +
@@ -247,11 +296,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
INC_SIZE(size);
- if (compiler->saveds > 0 || compiler->scratches > 9)
+ if (compiler->saveds > 0 || compiler->scratches > 11)
POP_REG(reg_map[SLJIT_S0]);
- if (compiler->saveds > 1 || compiler->scratches > 8)
+ if (compiler->saveds > 1 || compiler->scratches > 10)
POP_REG(reg_map[SLJIT_S1]);
- if (compiler->saveds > 2 || compiler->scratches > 7)
+ if (compiler->saveds > 2 || compiler->scratches > 9)
POP_REG(reg_map[SLJIT_S2]);
POP_REG(reg_map[TMP_REG1]);
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
@@ -366,7 +415,7 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
if ((flags & EX86_BIN_INS) && (a & SLJIT_IMM))
*inst = (flags & EX86_BYTE_ARG) ? GROUP_BINARY_83 : GROUP_BINARY_81;
- if ((a & SLJIT_IMM) || (a == 0))
+ if (a & SLJIT_IMM)
*buf_ptr = 0;
else if (!(flags & EX86_SSE2_OP1))
*buf_ptr = reg_map[a] << 3;
@@ -438,42 +487,324 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
/* Call / return instructions */
/* --------------------------------------------------------------------- */
-static SLJIT_INLINE sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 type)
+#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+
+static sljit_s32 c_fast_call_get_stack_size(sljit_s32 arg_types, sljit_s32 *word_arg_count_ptr)
{
- sljit_u8 *inst;
+ sljit_s32 stack_size = 0;
+ sljit_s32 word_arg_count = 0;
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ stack_size += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ stack_size += sizeof(sljit_f64);
+ break;
+ default:
+ word_arg_count++;
+ if (word_arg_count > 2)
+ stack_size += sizeof(sljit_sw);
+ break;
+ }
-#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
- inst = (sljit_u8*)ensure_buf(compiler, type >= SLJIT_CALL3 ? 1 + 2 + 1 : 1 + 2);
- FAIL_IF(!inst);
- INC_SIZE(type >= SLJIT_CALL3 ? 2 + 1 : 2);
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ if (word_arg_count_ptr)
+ *word_arg_count_ptr = word_arg_count;
- if (type >= SLJIT_CALL3)
+ return stack_size;
+}
+
+static sljit_s32 c_fast_call_with_args(struct sljit_compiler *compiler,
+ sljit_s32 arg_types, sljit_s32 stack_size, sljit_s32 word_arg_count, sljit_s32 swap_args)
+{
+ sljit_u8 *inst;
+ sljit_s32 float_arg_count;
+
+ if (stack_size == sizeof(sljit_sw) && word_arg_count == 3) {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
+ FAIL_IF(!inst);
+ INC_SIZE(1);
PUSH_REG(reg_map[SLJIT_R2]);
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (reg_map[SLJIT_R2] << 3) | reg_map[SLJIT_R0];
+ }
+ else if (stack_size > 0) {
+ if (word_arg_count >= 4)
+ EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), compiler->saveds_offset - sizeof(sljit_sw));
+
+ FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, stack_size));
+
+ stack_size = 0;
+ arg_types >>= SLJIT_DEF_SHIFT;
+ word_arg_count = 0;
+ float_arg_count = 0;
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ float_arg_count++;
+ FAIL_IF(emit_sse2_store(compiler, 1, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count));
+ stack_size += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ float_arg_count++;
+ FAIL_IF(emit_sse2_store(compiler, 0, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count));
+ stack_size += sizeof(sljit_f64);
+ break;
+ default:
+ word_arg_count++;
+ if (word_arg_count == 3) {
+ EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), stack_size, SLJIT_R2, 0);
+ stack_size += sizeof(sljit_sw);
+ }
+ else if (word_arg_count == 4) {
+ EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), stack_size, TMP_REG1, 0);
+ stack_size += sizeof(sljit_sw);
+ }
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+ }
+
+ if (word_arg_count > 0) {
+ if (swap_args) {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
+ FAIL_IF(!inst);
+ INC_SIZE(1);
+
+ *inst++ = XCHG_EAX_r | reg_map[SLJIT_R2];
+ }
+ else {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 2);
+ FAIL_IF(!inst);
+ INC_SIZE(2);
+
+ *inst++ = MOV_r_rm;
+ *inst++ = MOD_REG | (reg_map[SLJIT_R2] << 3) | reg_map[SLJIT_R0];
+ }
+ }
+
+ return SLJIT_SUCCESS;
+}
+
+#endif
+
+static sljit_s32 cdecl_call_get_stack_size(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *word_arg_count_ptr)
+{
+ sljit_s32 stack_size = 0;
+ sljit_s32 word_arg_count = 0;
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ stack_size += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ stack_size += sizeof(sljit_f64);
+ break;
+ default:
+ word_arg_count++;
+ stack_size += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ if (word_arg_count_ptr)
+ *word_arg_count_ptr = word_arg_count;
+
+ if (stack_size <= compiler->stack_tmp_size)
+ return 0;
+
+#if defined(__APPLE__)
+ return ((stack_size - compiler->stack_tmp_size + 15) & ~15);
#else
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 * (type - SLJIT_CALL0));
+ return stack_size - compiler->stack_tmp_size;
+#endif
+}
+
+static sljit_s32 cdecl_call_with_args(struct sljit_compiler *compiler,
+ sljit_s32 arg_types, sljit_s32 stack_size, sljit_s32 word_arg_count)
+{
+ sljit_s32 float_arg_count = 0;
+
+ if (word_arg_count >= 4)
+ EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), compiler->saveds_offset - sizeof(sljit_sw));
+
+ if (stack_size > 0)
+ FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, stack_size));
+
+ stack_size = 0;
+ word_arg_count = 0;
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ float_arg_count++;
+ FAIL_IF(emit_sse2_store(compiler, 1, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count));
+ stack_size += sizeof(sljit_f32);
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ float_arg_count++;
+ FAIL_IF(emit_sse2_store(compiler, 0, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count));
+ stack_size += sizeof(sljit_f64);
+ break;
+ default:
+ word_arg_count++;
+ EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), stack_size, (word_arg_count >= 4) ? TMP_REG1 : word_arg_count, 0);
+ stack_size += sizeof(sljit_sw);
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
+ }
+
+ return SLJIT_SUCCESS;
+}
+
+static sljit_s32 post_call_with_args(struct sljit_compiler *compiler,
+ sljit_s32 arg_types, sljit_s32 stack_size)
+{
+ sljit_u8 *inst;
+ sljit_s32 single;
+
+ if (stack_size > 0)
+ FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD),
+ SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, stack_size));
+
+ if ((arg_types & SLJIT_DEF_MASK) < SLJIT_ARG_TYPE_F32)
+ return SLJIT_SUCCESS;
+
+ single = ((arg_types & SLJIT_DEF_MASK) == SLJIT_ARG_TYPE_F32);
+
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 3);
FAIL_IF(!inst);
- INC_SIZE(4 * (type - SLJIT_CALL0));
-
- *inst++ = MOV_rm_r;
- *inst++ = MOD_DISP8 | (reg_map[SLJIT_R0] << 3) | 0x4 /* SIB */;
- *inst++ = (0x4 /* none*/ << 3) | reg_map[SLJIT_SP];
- *inst++ = 0;
- if (type >= SLJIT_CALL2) {
- *inst++ = MOV_rm_r;
- *inst++ = MOD_DISP8 | (reg_map[SLJIT_R1] << 3) | 0x4 /* SIB */;
- *inst++ = (0x4 /* none*/ << 3) | reg_map[SLJIT_SP];
- *inst++ = sizeof(sljit_sw);
+ INC_SIZE(3);
+ inst[0] = single ? FSTPS : FSTPD;
+ inst[1] = (0x03 << 3) | 0x04;
+ inst[2] = (0x04 << 3) | reg_map[SLJIT_SP];
+
+ return emit_sse2_load(compiler, single, SLJIT_FR0, SLJIT_MEM1(SLJIT_SP), 0);
+}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ struct sljit_jump *jump;
+ sljit_s32 stack_size = 0;
+ sljit_s32 word_arg_count;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ if ((type & 0xff) == SLJIT_CALL) {
+ stack_size = c_fast_call_get_stack_size(arg_types, &word_arg_count);
+ PTR_FAIL_IF(c_fast_call_with_args(compiler, arg_types, stack_size, word_arg_count, 0));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ jump = sljit_emit_jump(compiler, type);
+ PTR_FAIL_IF(jump == NULL);
+
+ PTR_FAIL_IF(post_call_with_args(compiler, arg_types, 0));
+ return jump;
}
- if (type >= SLJIT_CALL3) {
- *inst++ = MOV_rm_r;
- *inst++ = MOD_DISP8 | (reg_map[SLJIT_R2] << 3) | 0x4 /* SIB */;
- *inst++ = (0x4 /* none*/ << 3) | reg_map[SLJIT_SP];
- *inst++ = 2 * sizeof(sljit_sw);
+#endif
+
+ stack_size = cdecl_call_get_stack_size(compiler, arg_types, &word_arg_count);
+ PTR_FAIL_IF(cdecl_call_with_args(compiler, arg_types, stack_size, word_arg_count));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ jump = sljit_emit_jump(compiler, type);
+ PTR_FAIL_IF(jump == NULL);
+
+ PTR_FAIL_IF(post_call_with_args(compiler, arg_types, stack_size));
+ return jump;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_s32 stack_size = 0;
+ sljit_s32 word_arg_count;
+#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ sljit_s32 swap_args;
+#endif
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ SLJIT_ASSERT(reg_map[SLJIT_R0] == 0 && reg_map[SLJIT_R2] == 1 && SLJIT_R0 == 1 && SLJIT_R2 == 3);
+
+ if ((type & 0xff) == SLJIT_CALL) {
+ stack_size = c_fast_call_get_stack_size(arg_types, &word_arg_count);
+ swap_args = 0;
+
+ if (word_arg_count > 0) {
+ if ((src & REG_MASK) == SLJIT_R2 || OFFS_REG(src) == SLJIT_R2) {
+ swap_args = 1;
+ if (((src & REG_MASK) | 0x2) == SLJIT_R2)
+ src ^= 0x2;
+ if ((OFFS_REG(src) | 0x2) == SLJIT_R2)
+ src ^= TO_OFFS_REG(0x2);
+ }
+ }
+
+ FAIL_IF(c_fast_call_with_args(compiler, arg_types, stack_size, word_arg_count, swap_args));
+
+ compiler->saveds_offset += stack_size;
+ compiler->locals_offset += stack_size;
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+ FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw));
+
+ compiler->saveds_offset -= stack_size;
+ compiler->locals_offset -= stack_size;
+
+ return post_call_with_args(compiler, arg_types, 0);
}
#endif
- return SLJIT_SUCCESS;
+
+ stack_size = cdecl_call_get_stack_size(compiler, arg_types, &word_arg_count);
+ FAIL_IF(cdecl_call_with_args(compiler, arg_types, stack_size, word_arg_count));
+
+ compiler->saveds_offset += stack_size;
+ compiler->locals_offset += stack_size;
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+ FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw));
+
+ compiler->saveds_offset -= stack_size;
+ compiler->locals_offset -= stack_size;
+
+ return post_call_with_args(compiler, arg_types, stack_size);
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
@@ -524,7 +855,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
INC_SIZE(1 + 1);
PUSH_REG(reg_map[src]);
}
- else if (src & SLJIT_MEM) {
+ else {
inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw);
FAIL_IF(!inst);
*inst++ = GROUP_FF;
@@ -534,16 +865,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
FAIL_IF(!inst);
INC_SIZE(1);
}
- else {
- /* SLJIT_IMM. */
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 5 + 1);
- FAIL_IF(!inst);
-
- INC_SIZE(5 + 1);
- *inst++ = PUSH_i32;
- sljit_unaligned_store_sw(inst, srcw);
- inst += sizeof(sljit_sw);
- }
RET();
return SLJIT_SUCCESS;
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeX86_64.c b/thirdparty/pcre2/src/sljit/sljitNativeX86_64.c
index bc92d45680..635ebd087c 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeX86_64.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeX86_64.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -41,42 +41,55 @@ static sljit_s32 emit_load_imm64(struct sljit_compiler *compiler, sljit_s32 reg,
static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type)
{
+ int short_addr = !(jump->flags & SLJIT_REWRITABLE_JUMP) && !(jump->flags & JUMP_LABEL) && (jump->u.target <= 0xffffffff);
+
+ /* The relative jump below specialized for this case. */
+ SLJIT_ASSERT(reg_map[TMP_REG2] >= 8);
+
if (type < SLJIT_JUMP) {
/* Invert type. */
*code_ptr++ = get_jump_code(type ^ 0x1) - 0x10;
- *code_ptr++ = 10 + 3;
+ *code_ptr++ = short_addr ? (6 + 3) : (10 + 3);
}
- SLJIT_COMPILE_ASSERT(reg_map[TMP_REG3] == 9, tmp3_is_9_first);
- *code_ptr++ = REX_W | REX_B;
- *code_ptr++ = MOV_r_i32 + 1;
+ *code_ptr++ = short_addr ? REX_B : (REX_W | REX_B);
+ *code_ptr++ = MOV_r_i32 | reg_lmap[TMP_REG2];
jump->addr = (sljit_uw)code_ptr;
if (jump->flags & JUMP_LABEL)
jump->flags |= PATCH_MD;
+ else if (short_addr)
+ sljit_unaligned_store_s32(code_ptr, (sljit_s32)jump->u.target);
else
sljit_unaligned_store_sw(code_ptr, jump->u.target);
- code_ptr += sizeof(sljit_sw);
+ code_ptr += short_addr ? sizeof(sljit_s32) : sizeof(sljit_sw);
+
*code_ptr++ = REX_B;
*code_ptr++ = GROUP_FF;
- *code_ptr++ = (type >= SLJIT_FAST_CALL) ? (MOD_REG | CALL_rm | 1) : (MOD_REG | JMP_rm | 1);
+ *code_ptr++ = MOD_REG | (type >= SLJIT_FAST_CALL ? CALL_rm : JMP_rm) | reg_lmap[TMP_REG2];
return code_ptr;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
- sljit_s32 i, tmp, size, saved_register_size;
+ sljit_s32 args, i, tmp, size, saved_register_size;
sljit_u8 *inst;
CHECK_ERROR();
- CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
- compiler->flags_saved = 0;
+#ifdef _WIN64
+ /* Two/four register slots for parameters plus space for xmm6 register if needed. */
+ if (fscratches >= 6 || fsaveds >= 1)
+ compiler->locals_offset = 6 * sizeof(sljit_sw);
+ else
+ compiler->locals_offset = ((scratches > 2) ? 4 : 2) * sizeof(sljit_sw);
+#endif
/* Including the return address saved by the call instruction. */
saved_register_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
@@ -102,6 +115,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
PUSH_REG(reg_lmap[i]);
}
+ args = get_arg_count(arg_types);
+
if (args > 0) {
size = args * 3;
inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
@@ -155,7 +170,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
INC_SIZE(4 + (3 + sizeof(sljit_s32)));
*inst++ = REX_W;
*inst++ = GROUP_BINARY_83;
- *inst++ = MOD_REG | SUB | 4;
+ *inst++ = MOD_REG | SUB | reg_map[SLJIT_SP];
/* Allocated size for registers must be divisible by 8. */
SLJIT_ASSERT(!(saved_register_size & 0x7));
/* Aligned to 16 byte. */
@@ -167,7 +182,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
local_size -= 4 * sizeof(sljit_sw);
}
/* Second instruction */
- SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R0] < 8, temporary_reg1_is_loreg);
+ SLJIT_ASSERT(reg_map[SLJIT_R0] < 8);
*inst++ = REX_W;
*inst++ = MOV_rm_i32;
*inst++ = MOD_REG | reg_lmap[SLJIT_R0];
@@ -176,29 +191,30 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
compiler->skip_checks = 1;
#endif
- FAIL_IF(sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack)));
+ FAIL_IF(sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARG1(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack)));
}
#endif
- SLJIT_ASSERT(local_size > 0);
- if (local_size <= 127) {
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
- FAIL_IF(!inst);
- INC_SIZE(4);
- *inst++ = REX_W;
- *inst++ = GROUP_BINARY_83;
- *inst++ = MOD_REG | SUB | 4;
- *inst++ = local_size;
- }
- else {
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
- FAIL_IF(!inst);
- INC_SIZE(7);
- *inst++ = REX_W;
- *inst++ = GROUP_BINARY_81;
- *inst++ = MOD_REG | SUB | 4;
- sljit_unaligned_store_s32(inst, local_size);
- inst += sizeof(sljit_s32);
+ if (local_size > 0) {
+ if (local_size <= 127) {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
+ FAIL_IF(!inst);
+ INC_SIZE(4);
+ *inst++ = REX_W;
+ *inst++ = GROUP_BINARY_83;
+ *inst++ = MOD_REG | SUB | reg_map[SLJIT_SP];
+ *inst++ = local_size;
+ }
+ else {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
+ FAIL_IF(!inst);
+ INC_SIZE(7);
+ *inst++ = REX_W;
+ *inst++ = GROUP_BINARY_81;
+ *inst++ = MOD_REG | SUB | reg_map[SLJIT_SP];
+ sljit_unaligned_store_s32(inst, local_size);
+ inst += sizeof(sljit_s32);
+ }
}
#ifdef _WIN64
@@ -216,14 +232,22 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
- sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
+ sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
{
sljit_s32 saved_register_size;
CHECK_ERROR();
- CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
- set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
+ set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
+
+#ifdef _WIN64
+ /* Two/four register slots for parameters plus space for xmm6 register if needed. */
+ if (fscratches >= 6 || fsaveds >= 1)
+ compiler->locals_offset = 6 * sizeof(sljit_sw);
+ else
+ compiler->locals_offset = ((scratches > 2) ? 4 : 2) * sizeof(sljit_sw);
+#endif
/* Including the return address saved by the call instruction. */
saved_register_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
@@ -239,7 +263,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
CHECK_ERROR();
CHECK(check_sljit_emit_return(compiler, op, src, srcw));
- compiler->flags_saved = 0;
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
#ifdef _WIN64
@@ -253,24 +276,25 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
}
#endif
- SLJIT_ASSERT(compiler->local_size > 0);
- if (compiler->local_size <= 127) {
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
- FAIL_IF(!inst);
- INC_SIZE(4);
- *inst++ = REX_W;
- *inst++ = GROUP_BINARY_83;
- *inst++ = MOD_REG | ADD | 4;
- *inst = compiler->local_size;
- }
- else {
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
- FAIL_IF(!inst);
- INC_SIZE(7);
- *inst++ = REX_W;
- *inst++ = GROUP_BINARY_81;
- *inst++ = MOD_REG | ADD | 4;
- sljit_unaligned_store_s32(inst, compiler->local_size);
+ if (compiler->local_size > 0) {
+ if (compiler->local_size <= 127) {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
+ FAIL_IF(!inst);
+ INC_SIZE(4);
+ *inst++ = REX_W;
+ *inst++ = GROUP_BINARY_83;
+ *inst++ = MOD_REG | ADD | 4;
+ *inst = compiler->local_size;
+ }
+ else {
+ inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
+ FAIL_IF(!inst);
+ INC_SIZE(7);
+ *inst++ = REX_W;
+ *inst++ = GROUP_BINARY_81;
+ *inst++ = MOD_REG | ADD | 4;
+ sljit_unaligned_store_s32(inst, compiler->local_size);
+ }
}
tmp = compiler->scratches;
@@ -365,13 +389,12 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
if (b & SLJIT_MEM) {
if (!(b & OFFS_REG_MASK)) {
if (NOT_HALFWORD(immb)) {
- if (emit_load_imm64(compiler, TMP_REG3, immb))
- return NULL;
+ PTR_FAIL_IF(emit_load_imm64(compiler, TMP_REG2, immb));
immb = 0;
if (b & REG_MASK)
- b |= TO_OFFS_REG(TMP_REG3);
+ b |= TO_OFFS_REG(TMP_REG2);
else
- b |= TMP_REG3;
+ b |= TMP_REG2;
}
else if (reg_lmap[b & REG_MASK] == 4)
b |= TO_OFFS_REG(SLJIT_SP);
@@ -400,7 +423,11 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
}
}
}
- else if (!(flags & EX86_SSE2_OP2) && reg_map[b] >= 8)
+ else if (!(flags & EX86_SSE2_OP2)) {
+ if (reg_map[b] >= 8)
+ rex |= REX_B;
+ }
+ else if (freg_map[b] >= 8)
rex |= REX_B;
if (a & SLJIT_IMM) {
@@ -427,7 +454,11 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
else {
SLJIT_ASSERT(!(flags & EX86_SHIFT_INS) || a == SLJIT_PREF_SHIFT_REG);
/* reg_map[SLJIT_PREF_SHIFT_REG] is less than 8. */
- if (!(flags & EX86_SSE2_OP1) && reg_map[a] >= 8)
+ if (!(flags & EX86_SSE2_OP1)) {
+ if (reg_map[a] >= 8)
+ rex |= REX_R;
+ }
+ else if (freg_map[a] >= 8)
rex |= REX_R;
}
@@ -454,12 +485,12 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
if ((flags & EX86_BIN_INS) && (a & SLJIT_IMM))
*inst = (flags & EX86_BYTE_ARG) ? GROUP_BINARY_83 : GROUP_BINARY_81;
- if ((a & SLJIT_IMM) || (a == 0))
+ if (a & SLJIT_IMM)
*buf_ptr = 0;
else if (!(flags & EX86_SSE2_OP1))
*buf_ptr = reg_lmap[a] << 3;
else
- *buf_ptr = a << 3;
+ *buf_ptr = freg_lmap[a] << 3;
}
else {
if (a & SLJIT_IMM) {
@@ -473,7 +504,7 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
}
if (!(b & SLJIT_MEM))
- *buf_ptr++ |= MOD_REG + ((!(flags & EX86_SSE2_OP2)) ? reg_lmap[b] : b);
+ *buf_ptr++ |= MOD_REG + ((!(flags & EX86_SSE2_OP2)) ? reg_lmap[b] : freg_lmap[b]);
else if ((b & REG_MASK) != SLJIT_UNUSED) {
if ((b & OFFS_REG_MASK) == SLJIT_UNUSED || (b & OFFS_REG_MASK) == TO_OFFS_REG(SLJIT_SP)) {
if (immb != 0 || reg_lmap[b & REG_MASK] == 5) {
@@ -531,42 +562,161 @@ static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32
/* Call / return instructions */
/* --------------------------------------------------------------------- */
-static SLJIT_INLINE sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 type)
+#ifndef _WIN64
+
+static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src_ptr, sljit_sw srcw)
{
- sljit_u8 *inst;
+ sljit_s32 src = src_ptr ? (*src_ptr) : 0;
+ sljit_s32 word_arg_count = 0;
-#ifndef _WIN64
- SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R1] == 6 && reg_map[SLJIT_R0] < 8 && reg_map[SLJIT_R2] < 8, args_registers);
+ SLJIT_ASSERT(reg_map[SLJIT_R1] == 6 && reg_map[SLJIT_R3] == 1 && reg_map[TMP_REG1] == 2);
- inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
- FAIL_IF(!inst);
- INC_SIZE((type < SLJIT_CALL3) ? 3 : 6);
- if (type >= SLJIT_CALL3) {
- *inst++ = REX_W;
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (0x2 /* rdx */ << 3) | reg_lmap[SLJIT_R2];
+ compiler->mode32 = 0;
+
+ /* Remove return value. */
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ if ((arg_types & SLJIT_DEF_MASK) < SLJIT_ARG_TYPE_F32)
+ word_arg_count++;
+ arg_types >>= SLJIT_DEF_SHIFT;
}
- *inst++ = REX_W;
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (0x7 /* rdi */ << 3) | reg_lmap[SLJIT_R0];
+
+ if (word_arg_count == 0)
+ return SLJIT_SUCCESS;
+
+ if (src & SLJIT_MEM) {
+ ADJUST_LOCAL_OFFSET(src, srcw);
+ EMIT_MOV(compiler, TMP_REG2, 0, src, srcw);
+ *src_ptr = TMP_REG2;
+ }
+ else if (src == SLJIT_R2 && word_arg_count >= SLJIT_R2)
+ *src_ptr = TMP_REG1;
+
+ if (word_arg_count >= 3)
+ EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R2, 0);
+ return emit_mov(compiler, SLJIT_R2, 0, SLJIT_R0, 0);
+}
+
#else
- SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R1] == 2 && reg_map[SLJIT_R0] < 8 && reg_map[SLJIT_R2] < 8, args_registers);
- inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
- FAIL_IF(!inst);
- INC_SIZE((type < SLJIT_CALL3) ? 3 : 6);
- if (type >= SLJIT_CALL3) {
- *inst++ = REX_W | REX_R;
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (0x0 /* r8 */ << 3) | reg_lmap[SLJIT_R2];
+static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src_ptr, sljit_sw srcw)
+{
+ sljit_s32 src = src_ptr ? (*src_ptr) : 0;
+ sljit_s32 arg_count = 0;
+ sljit_s32 word_arg_count = 0;
+ sljit_s32 float_arg_count = 0;
+ sljit_s32 types = 0;
+ sljit_s32 data_trandfer = 0;
+ static sljit_u8 word_arg_regs[5] = { 0, SLJIT_R3, SLJIT_R1, SLJIT_R2, TMP_REG1 };
+
+ SLJIT_ASSERT(reg_map[SLJIT_R3] == 1 && reg_map[SLJIT_R1] == 2 && reg_map[SLJIT_R2] == 8 && reg_map[TMP_REG1] == 9);
+
+ compiler->mode32 = 0;
+ arg_types >>= SLJIT_DEF_SHIFT;
+
+ while (arg_types) {
+ types = (types << SLJIT_DEF_SHIFT) | (arg_types & SLJIT_DEF_MASK);
+
+ switch (arg_types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ case SLJIT_ARG_TYPE_F64:
+ arg_count++;
+ float_arg_count++;
+
+ if (arg_count != float_arg_count)
+ data_trandfer = 1;
+ break;
+ default:
+ arg_count++;
+ word_arg_count++;
+
+ if (arg_count != word_arg_count || arg_count != word_arg_regs[arg_count]) {
+ data_trandfer = 1;
+
+ if (src == word_arg_regs[arg_count]) {
+ EMIT_MOV(compiler, TMP_REG2, 0, src, 0);
+ *src_ptr = TMP_REG2;
+ }
+ }
+ break;
+ }
+
+ arg_types >>= SLJIT_DEF_SHIFT;
}
- *inst++ = REX_W;
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (0x1 /* rcx */ << 3) | reg_lmap[SLJIT_R0];
-#endif
+
+ if (!data_trandfer)
+ return SLJIT_SUCCESS;
+
+ if (src & SLJIT_MEM) {
+ ADJUST_LOCAL_OFFSET(src, srcw);
+ EMIT_MOV(compiler, TMP_REG2, 0, src, srcw);
+ *src_ptr = TMP_REG2;
+ }
+
+ while (types) {
+ switch (types & SLJIT_DEF_MASK) {
+ case SLJIT_ARG_TYPE_F32:
+ if (arg_count != float_arg_count)
+ FAIL_IF(emit_sse2_load(compiler, 1, arg_count, float_arg_count, 0));
+ arg_count--;
+ float_arg_count--;
+ break;
+ case SLJIT_ARG_TYPE_F64:
+ if (arg_count != float_arg_count)
+ FAIL_IF(emit_sse2_load(compiler, 0, arg_count, float_arg_count, 0));
+ arg_count--;
+ float_arg_count--;
+ break;
+ default:
+ if (arg_count != word_arg_count || arg_count != word_arg_regs[arg_count])
+ EMIT_MOV(compiler, word_arg_regs[arg_count], 0, word_arg_count, 0);
+ arg_count--;
+ word_arg_count--;
+ break;
+ }
+
+ types >>= SLJIT_DEF_SHIFT;
+ }
+
return SLJIT_SUCCESS;
}
+#endif
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types)
+{
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types));
+
+ PTR_FAIL_IF(call_with_args(compiler, arg_types, NULL, 0));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_jump(compiler, type);
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 arg_types,
+ sljit_s32 src, sljit_sw srcw)
+{
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw));
+
+ FAIL_IF(call_with_args(compiler, arg_types, &src, srcw));
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
+ || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ compiler->skip_checks = 1;
+#endif
+
+ return sljit_emit_ijump(compiler, type, src, srcw);
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
{
sljit_u8 *inst;
@@ -612,11 +762,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
ADJUST_LOCAL_OFFSET(src, srcw);
- if ((src & SLJIT_IMM) && NOT_HALFWORD(srcw)) {
- FAIL_IF(emit_load_imm64(compiler, TMP_REG1, srcw));
- src = TMP_REG1;
- }
-
if (FAST_IS_REG(src)) {
if (reg_map[src] < 8) {
inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1);
@@ -634,7 +779,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
PUSH_REG(reg_lmap[src]);
}
}
- else if (src & SLJIT_MEM) {
+ else {
/* REX_W is not necessary (src is not immediate). */
compiler->mode32 = 1;
inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw);
@@ -646,23 +791,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler
FAIL_IF(!inst);
INC_SIZE(1);
}
- else {
- SLJIT_ASSERT(IS_HALFWORD(srcw));
- /* SLJIT_IMM. */
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 5 + 1);
- FAIL_IF(!inst);
-
- INC_SIZE(5 + 1);
- *inst++ = PUSH_i32;
- sljit_unaligned_store_s32(inst, srcw);
- inst += sizeof(sljit_s32);
- }
RET();
return SLJIT_SUCCESS;
}
-
/* --------------------------------------------------------------------- */
/* Extend input */
/* --------------------------------------------------------------------- */
diff --git a/thirdparty/pcre2/src/sljit/sljitNativeX86_common.c b/thirdparty/pcre2/src/sljit/sljitNativeX86_common.c
index 12a0e272af..ab7b36adb2 100644
--- a/thirdparty/pcre2/src/sljit/sljitNativeX86_common.c
+++ b/thirdparty/pcre2/src/sljit/sljitNativeX86_common.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -26,7 +26,11 @@
SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
{
+#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
+ return "x86" SLJIT_CPUINFO " ABI:fastcall";
+#else
return "x86" SLJIT_CPUINFO;
+#endif
}
/*
@@ -35,7 +39,7 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
1 - ECX
2 - EDX
3 - EBX
- 4 - none
+ 4 - ESP
5 - EBP
6 - ESI
7 - EDI
@@ -47,7 +51,7 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
1 - RCX
2 - RDX
3 - RBX
- 4 - none
+ 4 - RSP
5 - RBP
6 - RSI
7 - RDI
@@ -67,12 +71,15 @@ SLJIT_API_FUNC_ATTRIBUTE const char* sljit_get_platform_name(void)
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 3] = {
- 0, 0, 2, 1, 0, 0, 0, 0, 7, 6, 3, 4, 5
+ 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 7, 6, 3, 4, 5
};
#define CHECK_EXTRA_REGS(p, w, do) \
- if (p >= SLJIT_R3 && p <= SLJIT_R6) { \
- w = SLJIT_LOCALS_OFFSET + ((p) - (SLJIT_R3 + 4)) * sizeof(sljit_sw); \
+ if (p >= SLJIT_R3 && p <= SLJIT_S3) { \
+ if (p <= compiler->scratches) \
+ w = compiler->saveds_offset - ((p) - SLJIT_R2) * (sljit_sw)sizeof(sljit_sw); \
+ else \
+ w = compiler->locals_offset + ((p) - SLJIT_S2) * (sljit_sw)sizeof(sljit_sw); \
p = SLJIT_MEM1(SLJIT_SP); \
do; \
}
@@ -82,31 +89,39 @@ static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 3] = {
/* Last register + 1. */
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
-#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
/* Note: r12 & 0x7 == 0b100, which decoded as SIB byte present
Note: avoid to use r12 and r13 for memory addessing
- therefore r12 is better for SAVED_EREG than SAVED_REG. */
+ therefore r12 is better to be a higher saved register. */
#ifndef _WIN64
-/* 1st passed in rdi, 2nd argument passed in rsi, 3rd in rdx. */
-static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
- 0, 0, 6, 1, 8, 11, 10, 12, 5, 13, 14, 15, 3, 4, 2, 7, 9
+/* Args: rdi(=7), rsi(=6), rdx(=2), rcx(=1), r8, r9. Scratches: rax(=0), r10, r11 */
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 4] = {
+ 0, 0, 6, 7, 1, 8, 11, 10, 12, 5, 13, 14, 15, 3, 4, 2, 9
};
/* low-map. reg_map & 0x7. */
-static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
- 0, 0, 6, 1, 0, 3, 2, 4, 5, 5, 6, 7, 3, 4, 2, 7, 1
+static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 4] = {
+ 0, 0, 6, 7, 1, 0, 3, 2, 4, 5, 5, 6, 7, 3, 4, 2, 1
};
#else
-/* 1st passed in rcx, 2nd argument passed in rdx, 3rd in r8. */
-static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
- 0, 0, 2, 1, 11, 12, 5, 13, 14, 15, 7, 6, 3, 4, 10, 8, 9
+/* Args: rcx(=1), rdx(=2), r8, r9. Scratches: rax(=0), r10, r11 */
+static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 4] = {
+ 0, 0, 2, 8, 1, 11, 12, 5, 13, 14, 15, 7, 6, 3, 4, 9, 10
};
/* low-map. reg_map & 0x7. */
-static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
- 0, 0, 2, 1, 3, 4, 5, 5, 6, 7, 7, 6, 3, 4, 2, 0, 1
+static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 4] = {
+ 0, 0, 2, 0, 1, 3, 4, 5, 5, 6, 7, 7, 6, 3, 4, 1, 2
};
#endif
+/* Args: xmm0-xmm3 */
+static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1] = {
+ 4, 0, 1, 2, 3, 5, 6
+};
+/* low-map. freg_map & 0x7. */
+static const sljit_u8 freg_lmap[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1] = {
+ 4, 0, 1, 2, 3, 5, 6
+};
+
#define REX_W 0x48
#define REX_R 0x44
#define REX_X 0x42
@@ -166,7 +181,7 @@ static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#define CALL_i32 0xe8
#define CALL_rm (/* GROUP_FF */ 2 << 3)
#define CDQ 0x99
-#define CMOVNE_r_rm (/* GROUP_0F */ 0x45)
+#define CMOVE_r_rm (/* GROUP_0F */ 0x44)
#define CMP (/* BINARY */ 7 << 3)
#define CMP_EAX_i32 0x3d
#define CMP_r_rm 0x3b
@@ -176,6 +191,8 @@ static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#define CVTTSD2SI_r_xm 0x2c
#define DIV (/* GROUP_F7 */ 6 << 3)
#define DIVSD_x_xm 0x5e
+#define FSTPS 0xd9
+#define FSTPD 0xdd
#define INT3 0xcc
#define IDIV (/* GROUP_F7 */ 7 << 3)
#define IMUL (/* GROUP_F7 */ 5 << 3)
@@ -214,6 +231,7 @@ static const sljit_u8 reg_lmap[SLJIT_NUMBER_OF_REGISTERS + 5] = {
#define POP_r 0x58
#define POP_rm 0x8f
#define POPF 0x9d
+#define PREFETCH 0x18
#define PUSH_i32 0x68
#define PUSH_r 0x50
#define PUSH_rm (/* GROUP_FF */ 6 << 3)
@@ -459,11 +477,7 @@ static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code
code_ptr += sizeof(sljit_s8);
} else {
jump->flags |= PATCH_MW;
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- code_ptr += sizeof(sljit_sw);
-#else
code_ptr += sizeof(sljit_s32);
-#endif
}
return code_ptr;
@@ -585,18 +599,59 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
return (void*)(code + executable_offset);
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_has_cpu_feature(sljit_s32 feature_type)
+{
+ switch (feature_type) {
+ case SLJIT_HAS_FPU:
+#ifdef SLJIT_IS_FPU_AVAILABLE
+ return SLJIT_IS_FPU_AVAILABLE;
+#elif (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
+ if (cpu_has_sse2 == -1)
+ get_cpu_features();
+ return cpu_has_sse2;
+#else /* SLJIT_DETECT_SSE2 */
+ return 1;
+#endif /* SLJIT_DETECT_SSE2 */
+
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+ case SLJIT_HAS_VIRTUAL_REGISTERS:
+ return 1;
+#endif
+
+ case SLJIT_HAS_CLZ:
+ case SLJIT_HAS_CMOV:
+ if (cpu_has_cmov == -1)
+ get_cpu_features();
+ return cpu_has_cmov;
+
+ case SLJIT_HAS_SSE2:
+#if (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
+ if (cpu_has_sse2 == -1)
+ get_cpu_features();
+ return cpu_has_sse2;
+#else
+ return 1;
+#endif
+
+ default:
+ return 0;
+ }
+}
+
/* --------------------------------------------------------------------- */
/* Operators */
/* --------------------------------------------------------------------- */
+#define BINARY_OPCODE(opcode) (((opcode ## _EAX_i32) << 24) | ((opcode ## _r_rm) << 16) | ((opcode ## _rm_r) << 8) | (opcode))
+
static sljit_s32 emit_cum_binary(struct sljit_compiler *compiler,
- sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+ sljit_u32 op_types,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w);
static sljit_s32 emit_non_cum_binary(struct sljit_compiler *compiler,
- sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+ sljit_u32 op_types,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w);
@@ -605,57 +660,19 @@ static sljit_s32 emit_mov(struct sljit_compiler *compiler,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw);
-static SLJIT_INLINE sljit_s32 emit_save_flags(struct sljit_compiler *compiler)
-{
- sljit_u8 *inst;
-
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
- FAIL_IF(!inst);
- INC_SIZE(5);
-#else
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 6);
- FAIL_IF(!inst);
- INC_SIZE(6);
- *inst++ = REX_W;
-#endif
- *inst++ = LEA_r_m; /* lea esp/rsp, [esp/rsp + sizeof(sljit_sw)] */
- *inst++ = 0x64;
- *inst++ = 0x24;
- *inst++ = (sljit_u8)sizeof(sljit_sw);
- *inst++ = PUSHF;
- compiler->flags_saved = 1;
- return SLJIT_SUCCESS;
-}
+#define EMIT_MOV(compiler, dst, dstw, src, srcw) \
+ FAIL_IF(emit_mov(compiler, dst, dstw, src, srcw));
-static SLJIT_INLINE sljit_s32 emit_restore_flags(struct sljit_compiler *compiler, sljit_s32 keep_flags)
-{
- sljit_u8 *inst;
+static SLJIT_INLINE sljit_s32 emit_sse2_store(struct sljit_compiler *compiler,
+ sljit_s32 single, sljit_s32 dst, sljit_sw dstw, sljit_s32 src);
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
- FAIL_IF(!inst);
- INC_SIZE(5);
- *inst++ = POPF;
-#else
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 6);
- FAIL_IF(!inst);
- INC_SIZE(6);
- *inst++ = POPF;
- *inst++ = REX_W;
-#endif
- *inst++ = LEA_r_m; /* lea esp/rsp, [esp/rsp - sizeof(sljit_sw)] */
- *inst++ = 0x64;
- *inst++ = 0x24;
- *inst++ = (sljit_u8)(-(sljit_s8)sizeof(sljit_sw));
- compiler->flags_saved = keep_flags;
- return SLJIT_SUCCESS;
-}
+static SLJIT_INLINE sljit_s32 emit_sse2_load(struct sljit_compiler *compiler,
+ sljit_s32 single, sljit_s32 dst, sljit_s32 src, sljit_sw srcw);
#ifdef _WIN32
#include <malloc.h>
-static void SLJIT_CALL sljit_grow_stack(sljit_sw local_size)
+static void SLJIT_FUNC sljit_grow_stack(sljit_sw local_size)
{
/* Workaround for calling the internal _chkstk() function on Windows.
This function touches all 4k pages belongs to the requested stack space,
@@ -681,15 +698,8 @@ static sljit_s32 emit_mov(struct sljit_compiler *compiler,
{
sljit_u8* inst;
- if (dst == SLJIT_UNUSED) {
- /* No destination, doesn't need to setup flags. */
- if (src & SLJIT_MEM) {
- inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src, srcw);
- FAIL_IF(!inst);
- *inst = MOV_r_rm;
- }
- return SLJIT_SUCCESS;
- }
+ SLJIT_ASSERT(dst != SLJIT_UNUSED);
+
if (FAST_IS_REG(src)) {
inst = emit_x86_instruction(compiler, 1, src, 0, dst, dstw);
FAIL_IF(!inst);
@@ -711,8 +721,10 @@ static sljit_s32 emit_mov(struct sljit_compiler *compiler,
}
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
if (!compiler->mode32 && NOT_HALFWORD(srcw)) {
- FAIL_IF(emit_load_imm64(compiler, TMP_REG2, srcw));
- inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, dst, dstw);
+ /* Immediate to memory move. Only SLJIT_MOV operation copies
+ an immediate directly into memory so TMP_REG1 can be used. */
+ FAIL_IF(emit_load_imm64(compiler, TMP_REG1, srcw));
+ inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw);
FAIL_IF(!inst);
*inst = MOV_rm_r;
return SLJIT_SUCCESS;
@@ -730,7 +742,8 @@ static sljit_s32 emit_mov(struct sljit_compiler *compiler,
return SLJIT_SUCCESS;
}
- /* Memory to memory move. Requires two instruction. */
+ /* Memory to memory move. Only SLJIT_MOV operation copies
+ data from memory to memory so TMP_REG1 can be used. */
inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src, srcw);
FAIL_IF(!inst);
*inst = MOV_r_rm;
@@ -740,9 +753,6 @@ static sljit_s32 emit_mov(struct sljit_compiler *compiler,
return SLJIT_SUCCESS;
}
-#define EMIT_MOV(compiler, dst, dstw, src, srcw) \
- FAIL_IF(emit_mov(compiler, dst, dstw, src, srcw));
-
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
{
sljit_u8 *inst;
@@ -772,20 +782,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
case SLJIT_DIVMOD_SW:
case SLJIT_DIV_UW:
case SLJIT_DIV_SW:
- compiler->flags_saved = 0;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
#ifdef _WIN64
- SLJIT_COMPILE_ASSERT(
+ SLJIT_ASSERT(
reg_map[SLJIT_R0] == 0
&& reg_map[SLJIT_R1] == 2
- && reg_map[TMP_REG1] > 7,
- invalid_register_assignment_for_div_mul);
+ && reg_map[TMP_REG1] > 7);
#else
- SLJIT_COMPILE_ASSERT(
+ SLJIT_ASSERT(
reg_map[SLJIT_R0] == 0
&& reg_map[SLJIT_R1] < 7
- && reg_map[TMP_REG1] == 2,
- invalid_register_assignment_for_div_mul);
+ && reg_map[TMP_REG1] == 2);
#endif
compiler->mode32 = op & SLJIT_I32_OP;
#endif
@@ -909,9 +916,6 @@ static sljit_s32 emit_mov_byte(struct sljit_compiler *compiler, sljit_s32 sign,
compiler->mode32 = 0;
#endif
- if (dst == SLJIT_UNUSED && !(src & SLJIT_MEM))
- return SLJIT_SUCCESS; /* Empty instruction. */
-
if (src & SLJIT_IMM) {
if (FAST_IS_REG(dst)) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
@@ -1040,6 +1044,30 @@ static sljit_s32 emit_mov_byte(struct sljit_compiler *compiler, sljit_s32 sign,
return SLJIT_SUCCESS;
}
+static sljit_s32 emit_prefetch(struct sljit_compiler *compiler, sljit_s32 op,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_u8* inst;
+
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ compiler->mode32 = 1;
+#endif
+
+ inst = emit_x86_instruction(compiler, 2, 0, 0, src, srcw);
+ FAIL_IF(!inst);
+ *inst++ = GROUP_0F;
+ *inst++ = PREFETCH;
+
+ if (op >= SLJIT_MOV_U8 && op <= SLJIT_MOV_S8)
+ *inst |= (3 << 3);
+ else if (op >= SLJIT_MOV_U16 && op <= SLJIT_MOV_S16)
+ *inst |= (2 << 3);
+ else
+ *inst |= (1 << 3);
+
+ return SLJIT_SUCCESS;
+}
+
static sljit_s32 emit_mov_half(struct sljit_compiler *compiler, sljit_s32 sign,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
@@ -1051,9 +1079,6 @@ static sljit_s32 emit_mov_half(struct sljit_compiler *compiler, sljit_s32 sign,
compiler->mode32 = 0;
#endif
- if (dst == SLJIT_UNUSED && !(src & SLJIT_MEM))
- return SLJIT_SUCCESS; /* Empty instruction. */
-
if (src & SLJIT_IMM) {
if (FAST_IS_REG(dst)) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
@@ -1097,14 +1122,6 @@ static sljit_s32 emit_unary(struct sljit_compiler *compiler, sljit_u8 opcode,
{
sljit_u8* inst;
- if (dst == SLJIT_UNUSED) {
- EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
- inst = emit_x86_instruction(compiler, 1, 0, 0, TMP_REG1, 0);
- FAIL_IF(!inst);
- *inst++ = GROUP_F7;
- *inst |= opcode;
- return SLJIT_SUCCESS;
- }
if (dst == src && dstw == srcw) {
/* Same input and output */
inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw);
@@ -1113,14 +1130,19 @@ static sljit_s32 emit_unary(struct sljit_compiler *compiler, sljit_u8 opcode,
*inst |= opcode;
return SLJIT_SUCCESS;
}
+
+ if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED))
+ dst = TMP_REG1;
+
if (FAST_IS_REG(dst)) {
EMIT_MOV(compiler, dst, 0, src, srcw);
- inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw);
+ inst = emit_x86_instruction(compiler, 1, 0, 0, dst, 0);
FAIL_IF(!inst);
*inst++ = GROUP_F7;
*inst |= opcode;
return SLJIT_SUCCESS;
}
+
EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
inst = emit_x86_instruction(compiler, 1, 0, 0, TMP_REG1, 0);
FAIL_IF(!inst);
@@ -1136,20 +1158,12 @@ static sljit_s32 emit_not_with_flags(struct sljit_compiler *compiler,
{
sljit_u8* inst;
- if (dst == SLJIT_UNUSED) {
- EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
- inst = emit_x86_instruction(compiler, 1, 0, 0, TMP_REG1, 0);
- FAIL_IF(!inst);
- *inst++ = GROUP_F7;
- *inst |= NOT_rm;
- inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, TMP_REG1, 0);
- FAIL_IF(!inst);
- *inst = OR_r_rm;
- return SLJIT_SUCCESS;
- }
+ if (dst == SLJIT_UNUSED)
+ dst = TMP_REG1;
+
if (FAST_IS_REG(dst)) {
EMIT_MOV(compiler, dst, 0, src, srcw);
- inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw);
+ inst = emit_x86_instruction(compiler, 1, 0, 0, dst, 0);
FAIL_IF(!inst);
*inst++ = GROUP_F7;
*inst |= NOT_rm;
@@ -1158,6 +1172,7 @@ static sljit_s32 emit_not_with_flags(struct sljit_compiler *compiler,
*inst = OR_r_rm;
return SLJIT_SUCCESS;
}
+
EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
inst = emit_x86_instruction(compiler, 1, 0, 0, TMP_REG1, 0);
FAIL_IF(!inst);
@@ -1170,6 +1185,10 @@ static sljit_s32 emit_not_with_flags(struct sljit_compiler *compiler,
return SLJIT_SUCCESS;
}
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+static const sljit_sw emit_clz_arg = 32 + 31;
+#endif
+
static sljit_s32 emit_clz(struct sljit_compiler *compiler, sljit_s32 op_flags,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
@@ -1178,104 +1197,54 @@ static sljit_s32 emit_clz(struct sljit_compiler *compiler, sljit_s32 op_flags,
sljit_s32 dst_r;
SLJIT_UNUSED_ARG(op_flags);
- if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
- /* Just set the zero flag. */
- EMIT_MOV(compiler, TMP_REG1, 0, src, srcw);
- inst = emit_x86_instruction(compiler, 1, 0, 0, TMP_REG1, 0);
- FAIL_IF(!inst);
- *inst++ = GROUP_F7;
- *inst |= NOT_rm;
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, 31, TMP_REG1, 0);
-#else
- inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? 63 : 31, TMP_REG1, 0);
-#endif
- FAIL_IF(!inst);
- *inst |= SHR;
- return SLJIT_SUCCESS;
- }
- if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
- EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcw);
- src = TMP_REG1;
- srcw = 0;
- }
+ if (cpu_has_cmov == -1)
+ get_cpu_features();
- inst = emit_x86_instruction(compiler, 2, TMP_REG1, 0, src, srcw);
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
+
+ inst = emit_x86_instruction(compiler, 2, dst_r, 0, src, srcw);
FAIL_IF(!inst);
*inst++ = GROUP_0F;
*inst = BSR_r_rm;
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- if (FAST_IS_REG(dst))
- dst_r = dst;
- else {
- /* Find an unused temporary register. */
- if ((dst & REG_MASK) != SLJIT_R0 && (dst & OFFS_REG_MASK) != TO_OFFS_REG(SLJIT_R0))
- dst_r = SLJIT_R0;
- else if ((dst & REG_MASK) != SLJIT_R1 && (dst & OFFS_REG_MASK) != TO_OFFS_REG(SLJIT_R1))
- dst_r = SLJIT_R1;
+ if (cpu_has_cmov) {
+ if (dst_r != TMP_REG1) {
+ EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, 32 + 31);
+ inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG1, 0);
+ }
else
- dst_r = SLJIT_R2;
- EMIT_MOV(compiler, dst, dstw, dst_r, 0);
- }
- EMIT_MOV(compiler, dst_r, 0, SLJIT_IMM, 32 + 31);
-#else
- dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
- compiler->mode32 = 0;
- EMIT_MOV(compiler, dst_r, 0, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? 64 + 63 : 32 + 31);
- compiler->mode32 = op_flags & SLJIT_I32_OP;
-#endif
+ inst = emit_x86_instruction(compiler, 2, dst_r, 0, SLJIT_MEM0(), (sljit_sw)&emit_clz_arg);
- if (cpu_has_cmov == -1)
- get_cpu_features();
-
- if (cpu_has_cmov) {
- inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG1, 0);
FAIL_IF(!inst);
*inst++ = GROUP_0F;
- *inst = CMOVNE_r_rm;
- } else {
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
- FAIL_IF(!inst);
- INC_SIZE(4);
+ *inst = CMOVE_r_rm;
+ }
+ else
+ FAIL_IF(sljit_emit_cmov_generic(compiler, SLJIT_EQUAL, dst_r, SLJIT_IMM, 32 + 31));
- *inst++ = JE_i8;
- *inst++ = 2;
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (reg_map[dst_r] << 3) | reg_map[TMP_REG1];
+ inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, 31, dst_r, 0);
#else
- inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
- FAIL_IF(!inst);
- INC_SIZE(5);
+ if (cpu_has_cmov) {
+ EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? (64 + 63) : (32 + 31));
- *inst++ = JE_i8;
- *inst++ = 3;
- *inst++ = REX_W | (reg_map[dst_r] >= 8 ? REX_R : 0) | (reg_map[TMP_REG1] >= 8 ? REX_B : 0);
- *inst++ = MOV_r_rm;
- *inst++ = MOD_REG | (reg_lmap[dst_r] << 3) | reg_lmap[TMP_REG1];
-#endif
+ inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG2, 0);
+ FAIL_IF(!inst);
+ *inst++ = GROUP_0F;
+ *inst = CMOVE_r_rm;
}
+ else
+ FAIL_IF(sljit_emit_cmov_generic(compiler, SLJIT_EQUAL, dst_r, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? (64 + 63) : (32 + 31)));
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, 31, dst_r, 0);
-#else
inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, !(op_flags & SLJIT_I32_OP) ? 63 : 31, dst_r, 0);
#endif
+
FAIL_IF(!inst);
*(inst + 1) |= XOR;
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- if (dst & SLJIT_MEM) {
- inst = emit_x86_instruction(compiler, 1, dst_r, 0, dst, dstw);
- FAIL_IF(!inst);
- *inst = XCHG_r_rm;
- }
-#else
if (dst & SLJIT_MEM)
- EMIT_MOV(compiler, dst, dstw, TMP_REG2, 0);
-#endif
+ EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
return SLJIT_SUCCESS;
}
@@ -1283,14 +1252,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
- sljit_u8* inst;
- sljit_s32 update = 0;
sljit_s32 op_flags = GET_ALL_FLAGS(op);
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
sljit_s32 dst_is_ereg = 0;
- sljit_s32 src_is_ereg = 0;
-#else
-# define src_is_ereg 0
#endif
CHECK_ERROR();
@@ -1299,40 +1263,42 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
ADJUST_LOCAL_OFFSET(src, srcw);
CHECK_EXTRA_REGS(dst, dstw, dst_is_ereg = 1);
- CHECK_EXTRA_REGS(src, srcw, src_is_ereg = 1);
+ CHECK_EXTRA_REGS(src, srcw, (void)0);
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
compiler->mode32 = op_flags & SLJIT_I32_OP;
#endif
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op)) {
+ if (op <= SLJIT_MOV_P && (src & SLJIT_MEM))
+ return emit_prefetch(compiler, op, src, srcw);
+ return SLJIT_SUCCESS;
+ }
+
op = GET_OPCODE(op);
- if (op >= SLJIT_MOV && op <= SLJIT_MOVU_P) {
+
+ if (op >= SLJIT_MOV && op <= SLJIT_MOV_P) {
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
compiler->mode32 = 0;
#endif
+ if (FAST_IS_REG(src) && src == dst) {
+ if (!TYPE_CAST_NEEDED(op))
+ return SLJIT_SUCCESS;
+ }
+
if (op_flags & SLJIT_I32_OP) {
- if (FAST_IS_REG(src) && src == dst) {
- if (!TYPE_CAST_NEEDED(op))
- return SLJIT_SUCCESS;
- }
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
- if (op == SLJIT_MOV_S32 && (src & SLJIT_MEM))
- op = SLJIT_MOV_U32;
- if (op == SLJIT_MOVU_S32 && (src & SLJIT_MEM))
- op = SLJIT_MOVU_U32;
- if (op == SLJIT_MOV_U32 && (src & SLJIT_IMM))
- op = SLJIT_MOV_S32;
- if (op == SLJIT_MOVU_U32 && (src & SLJIT_IMM))
- op = SLJIT_MOVU_S32;
+ if (src & SLJIT_MEM) {
+ if (op == SLJIT_MOV_S32)
+ op = SLJIT_MOV_U32;
+ }
+ else if (src & SLJIT_IMM) {
+ if (op == SLJIT_MOV_U32)
+ op = SLJIT_MOV_S32;
+ }
#endif
}
- SLJIT_COMPILE_ASSERT(SLJIT_MOV + 8 == SLJIT_MOVU, movu_offset);
- if (op >= SLJIT_MOVU) {
- update = 1;
- op -= 8;
- }
-
if (src & SLJIT_IMM) {
switch (op) {
case SLJIT_MOV_U8:
@@ -1362,14 +1328,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
#endif
}
- if (SLJIT_UNLIKELY(update) && (src & SLJIT_MEM) && !src_is_ereg && (src & REG_MASK) && (srcw != 0 || (src & OFFS_REG_MASK) != 0)) {
- inst = emit_x86_instruction(compiler, 1, src & REG_MASK, 0, src, srcw);
- FAIL_IF(!inst);
- *inst = LEA_r_m;
- src &= SLJIT_MEM | 0xf;
- srcw = 0;
- }
-
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
if (SLJIT_UNLIKELY(dst_is_ereg) && (!(op == SLJIT_MOV || op == SLJIT_MOV_U32 || op == SLJIT_MOV_S32 || op == SLJIT_MOV_P) || (src & SLJIT_MEM))) {
SLJIT_ASSERT(dst == SLJIT_MEM1(SLJIT_SP));
@@ -1412,40 +1370,23 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
if (SLJIT_UNLIKELY(dst_is_ereg) && dst == TMP_REG1)
return emit_mov(compiler, SLJIT_MEM1(SLJIT_SP), dstw, TMP_REG1, 0);
#endif
-
- if (SLJIT_UNLIKELY(update) && (dst & SLJIT_MEM) && (dst & REG_MASK) && (dstw != 0 || (dst & OFFS_REG_MASK) != 0)) {
- inst = emit_x86_instruction(compiler, 1, dst & REG_MASK, 0, dst, dstw);
- FAIL_IF(!inst);
- *inst = LEA_r_m;
- }
return SLJIT_SUCCESS;
}
- if (SLJIT_UNLIKELY(GET_FLAGS(op_flags)))
- compiler->flags_saved = 0;
-
switch (op) {
case SLJIT_NOT:
- if (SLJIT_UNLIKELY(op_flags & SLJIT_SET_E))
+ if (SLJIT_UNLIKELY(op_flags & SLJIT_SET_Z))
return emit_not_with_flags(compiler, dst, dstw, src, srcw);
return emit_unary(compiler, NOT_rm, dst, dstw, src, srcw);
case SLJIT_NEG:
- if (SLJIT_UNLIKELY(op_flags & SLJIT_KEEP_FLAGS) && !compiler->flags_saved)
- FAIL_IF(emit_save_flags(compiler));
return emit_unary(compiler, NEG_rm, dst, dstw, src, srcw);
case SLJIT_CLZ:
- if (SLJIT_UNLIKELY(op_flags & SLJIT_KEEP_FLAGS) && !compiler->flags_saved)
- FAIL_IF(emit_save_flags(compiler));
return emit_clz(compiler, op_flags, dst, dstw, src, srcw);
}
return SLJIT_SUCCESS;
-
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-# undef src_is_ereg
-#endif
}
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -1457,8 +1398,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
*(inst + 1) |= (op_imm); \
} \
else { \
- FAIL_IF(emit_load_imm64(compiler, TMP_REG2, immw)); \
- inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, arg, argw); \
+ FAIL_IF(emit_load_imm64(compiler, (arg == TMP_REG1) ? TMP_REG2 : TMP_REG1, immw)); \
+ inst = emit_x86_instruction(compiler, 1, (arg == TMP_REG1) ? TMP_REG2 : TMP_REG1, 0, arg, argw); \
FAIL_IF(!inst); \
*inst = (op_mr); \
}
@@ -1479,12 +1420,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compile
#endif
static sljit_s32 emit_cum_binary(struct sljit_compiler *compiler,
- sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+ sljit_u32 op_types,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
sljit_u8* inst;
+ sljit_u8 op_eax_imm = (op_types >> 24);
+ sljit_u8 op_rm = (op_types >> 16) & 0xff;
+ sljit_u8 op_mr = (op_types >> 8) & 0xff;
+ sljit_u8 op_imm = op_types & 0xff;
if (dst == SLJIT_UNUSED) {
EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
@@ -1595,12 +1540,16 @@ static sljit_s32 emit_cum_binary(struct sljit_compiler *compiler,
}
static sljit_s32 emit_non_cum_binary(struct sljit_compiler *compiler,
- sljit_u8 op_rm, sljit_u8 op_mr, sljit_u8 op_imm, sljit_u8 op_eax_imm,
+ sljit_u32 op_types,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
sljit_u8* inst;
+ sljit_u8 op_eax_imm = (op_types >> 24);
+ sljit_u8 op_rm = (op_types >> 16) & 0xff;
+ sljit_u8 op_mr = (op_types >> 8) & 0xff;
+ sljit_u8 op_imm = op_types & 0xff;
if (dst == SLJIT_UNUSED) {
EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
@@ -1684,7 +1633,7 @@ static sljit_s32 emit_mul(struct sljit_compiler *compiler,
sljit_u8* inst;
sljit_s32 dst_r;
- dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
+ dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
/* Register destination. */
if (dst_r == src1 && !(src2 & SLJIT_IMM)) {
@@ -1736,9 +1685,9 @@ static sljit_s32 emit_mul(struct sljit_compiler *compiler,
sljit_unaligned_store_s32(inst, (sljit_s32)src1w);
}
else {
- EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, src1w);
if (dst_r != src2)
EMIT_MOV(compiler, dst_r, 0, src2, src2w);
+ FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src1w));
inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG2, 0);
FAIL_IF(!inst);
*inst++ = GROUP_0F;
@@ -1779,9 +1728,9 @@ static sljit_s32 emit_mul(struct sljit_compiler *compiler,
sljit_unaligned_store_s32(inst, (sljit_s32)src2w);
}
else {
- EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, src2w);
if (dst_r != src1)
EMIT_MOV(compiler, dst_r, 0, src1, src1w);
+ FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src2w));
inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG2, 0);
FAIL_IF(!inst);
*inst++ = GROUP_0F;
@@ -1800,13 +1749,13 @@ static sljit_s32 emit_mul(struct sljit_compiler *compiler,
*inst = IMUL_r_rm;
}
- if (dst_r == TMP_REG1)
+ if (dst & SLJIT_MEM)
EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
return SLJIT_SUCCESS;
}
-static sljit_s32 emit_lea_binary(struct sljit_compiler *compiler, sljit_s32 keep_flags,
+static sljit_s32 emit_lea_binary(struct sljit_compiler *compiler,
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
@@ -1815,12 +1764,10 @@ static sljit_s32 emit_lea_binary(struct sljit_compiler *compiler, sljit_s32 keep
sljit_s32 dst_r, done = 0;
/* These cases better be left to handled by normal way. */
- if (!keep_flags) {
- if (dst == src1 && dstw == src1w)
- return SLJIT_ERR_UNSUPPORTED;
- if (dst == src2 && dstw == src2w)
- return SLJIT_ERR_UNSUPPORTED;
- }
+ if (dst == src1 && dstw == src1w)
+ return SLJIT_ERR_UNSUPPORTED;
+ if (dst == src2 && dstw == src2w)
+ return SLJIT_ERR_UNSUPPORTED;
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
@@ -1932,7 +1879,7 @@ static sljit_s32 emit_test_binary(struct sljit_compiler *compiler,
}
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
- if (src2 == SLJIT_R0 && (src2 & SLJIT_IMM) && (src1w > 127 || src1w < -128) && (compiler->mode32 || IS_HALFWORD(src1w))) {
+ if (src2 == SLJIT_R0 && (src1 & SLJIT_IMM) && (src1w > 127 || src1w < -128) && (compiler->mode32 || IS_HALFWORD(src1w))) {
#else
if (src2 == SLJIT_R0 && (src1 & SLJIT_IMM) && (src1w > 127 || src1w < -128)) {
#endif
@@ -1949,8 +1896,8 @@ static sljit_s32 emit_test_binary(struct sljit_compiler *compiler,
*inst = GROUP_F7;
}
else {
- FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src2w));
- inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, src1, src1w);
+ FAIL_IF(emit_load_imm64(compiler, TMP_REG1, src2w));
+ inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src1, src1w);
FAIL_IF(!inst);
*inst = TEST_rm_r;
}
@@ -1978,8 +1925,8 @@ static sljit_s32 emit_test_binary(struct sljit_compiler *compiler,
*inst = GROUP_F7;
}
else {
- FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src1w));
- inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, src2, src2w);
+ FAIL_IF(emit_load_imm64(compiler, TMP_REG1, src1w));
+ inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src2, src2w);
FAIL_IF(!inst);
*inst = TEST_rm_r;
}
@@ -2080,7 +2027,7 @@ static sljit_s32 emit_shift(struct sljit_compiler *compiler,
*inst |= mode;
EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
}
- else if (FAST_IS_REG(dst) && dst != src2 && !ADDRESSING_DEPENDS_ON(src2, dst)) {
+ else if (SLOW_IS_REG(dst) && dst != src2 && !ADDRESSING_DEPENDS_ON(src2, dst)) {
if (src1 != dst)
EMIT_MOV(compiler, dst, 0, src1, src1w);
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
@@ -2091,25 +2038,26 @@ static sljit_s32 emit_shift(struct sljit_compiler *compiler,
EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
}
else {
- /* This case is really difficult, since ecx itself may used for
- addressing, and we must ensure to work even in that case. */
+ /* This case is complex since ecx itself may be used for
+ addressing, and this case must be supported as well. */
EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
- EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_PREF_SHIFT_REG, 0);
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+ EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), 0, SLJIT_PREF_SHIFT_REG, 0);
+ EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
+ inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
+ FAIL_IF(!inst);
+ *inst |= mode;
+ EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, SLJIT_MEM1(SLJIT_SP), 0);
#else
- /* [esp+0] contains the flags. */
- EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_sw), SLJIT_PREF_SHIFT_REG, 0);
-#endif
+ EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_PREF_SHIFT_REG, 0);
EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
FAIL_IF(!inst);
*inst |= mode;
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG2, 0);
-#else
- EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, SLJIT_MEM1(SLJIT_SP), sizeof(sljit_sw));
#endif
- EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
+ if (dst != SLJIT_UNUSED)
+ return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
}
return SLJIT_SUCCESS;
@@ -2133,7 +2081,7 @@ static sljit_s32 emit_shift_with_flags(struct sljit_compiler *compiler,
if (!set_flags)
return emit_mov(compiler, dst, dstw, src1, src1w);
/* OR dst, src, 0 */
- return emit_cum_binary(compiler, OR_r_rm, OR_rm_r, OR, OR_EAX_i32,
+ return emit_cum_binary(compiler, BINARY_OPCODE(OR),
dst, dstw, src1, src1w, SLJIT_IMM, 0);
}
@@ -2143,10 +2091,10 @@ static sljit_s32 emit_shift_with_flags(struct sljit_compiler *compiler,
if (!FAST_IS_REG(dst))
FAIL_IF(emit_cmp_binary(compiler, src1, src1w, SLJIT_IMM, 0));
- FAIL_IF(emit_shift(compiler,mode, dst, dstw, src1, src1w, src2, src2w));
+ FAIL_IF(emit_shift(compiler, mode, dst, dstw, src1, src1w, src2, src2w));
if (FAST_IS_REG(dst))
- return emit_cmp_binary(compiler, dst, dstw, SLJIT_IMM, 0);
+ return emit_cmp_binary(compiler, (dst == SLJIT_UNUSED) ? TMP_REG1 : dst, dstw, SLJIT_IMM, 0);
return SLJIT_SUCCESS;
}
@@ -2168,77 +2116,54 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compile
compiler->mode32 = op & SLJIT_I32_OP;
#endif
- if (GET_OPCODE(op) >= SLJIT_MUL) {
- if (SLJIT_UNLIKELY(GET_FLAGS(op)))
- compiler->flags_saved = 0;
- else if (SLJIT_UNLIKELY(op & SLJIT_KEEP_FLAGS) && !compiler->flags_saved)
- FAIL_IF(emit_save_flags(compiler));
- }
+ if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
+ return SLJIT_SUCCESS;
switch (GET_OPCODE(op)) {
case SLJIT_ADD:
- if (!GET_FLAGS(op)) {
- if (emit_lea_binary(compiler, op & SLJIT_KEEP_FLAGS, dst, dstw, src1, src1w, src2, src2w) != SLJIT_ERR_UNSUPPORTED)
+ if (!HAS_FLAGS(op)) {
+ if (emit_lea_binary(compiler, dst, dstw, src1, src1w, src2, src2w) != SLJIT_ERR_UNSUPPORTED)
return compiler->error;
}
- else
- compiler->flags_saved = 0;
- if (SLJIT_UNLIKELY(op & SLJIT_KEEP_FLAGS) && !compiler->flags_saved)
- FAIL_IF(emit_save_flags(compiler));
- return emit_cum_binary(compiler, ADD_r_rm, ADD_rm_r, ADD, ADD_EAX_i32,
+ return emit_cum_binary(compiler, BINARY_OPCODE(ADD),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_ADDC:
- if (SLJIT_UNLIKELY(compiler->flags_saved)) /* C flag must be restored. */
- FAIL_IF(emit_restore_flags(compiler, 1));
- else if (SLJIT_UNLIKELY(op & SLJIT_KEEP_FLAGS))
- FAIL_IF(emit_save_flags(compiler));
- if (SLJIT_UNLIKELY(GET_FLAGS(op)))
- compiler->flags_saved = 0;
- return emit_cum_binary(compiler, ADC_r_rm, ADC_rm_r, ADC, ADC_EAX_i32,
+ return emit_cum_binary(compiler, BINARY_OPCODE(ADC),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_SUB:
- if (!GET_FLAGS(op)) {
- if ((src2 & SLJIT_IMM) && emit_lea_binary(compiler, op & SLJIT_KEEP_FLAGS, dst, dstw, src1, src1w, SLJIT_IMM, -src2w) != SLJIT_ERR_UNSUPPORTED)
+ if (!HAS_FLAGS(op)) {
+ if ((src2 & SLJIT_IMM) && emit_lea_binary(compiler, dst, dstw, src1, src1w, SLJIT_IMM, -src2w) != SLJIT_ERR_UNSUPPORTED)
return compiler->error;
}
- else
- compiler->flags_saved = 0;
- if (SLJIT_UNLIKELY(op & SLJIT_KEEP_FLAGS) && !compiler->flags_saved)
- FAIL_IF(emit_save_flags(compiler));
+
if (dst == SLJIT_UNUSED)
return emit_cmp_binary(compiler, src1, src1w, src2, src2w);
- return emit_non_cum_binary(compiler, SUB_r_rm, SUB_rm_r, SUB, SUB_EAX_i32,
+ return emit_non_cum_binary(compiler, BINARY_OPCODE(SUB),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_SUBC:
- if (SLJIT_UNLIKELY(compiler->flags_saved)) /* C flag must be restored. */
- FAIL_IF(emit_restore_flags(compiler, 1));
- else if (SLJIT_UNLIKELY(op & SLJIT_KEEP_FLAGS))
- FAIL_IF(emit_save_flags(compiler));
- if (SLJIT_UNLIKELY(GET_FLAGS(op)))
- compiler->flags_saved = 0;
- return emit_non_cum_binary(compiler, SBB_r_rm, SBB_rm_r, SBB, SBB_EAX_i32,
+ return emit_non_cum_binary(compiler, BINARY_OPCODE(SBB),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_MUL:
return emit_mul(compiler, dst, dstw, src1, src1w, src2, src2w);
case SLJIT_AND:
if (dst == SLJIT_UNUSED)
return emit_test_binary(compiler, src1, src1w, src2, src2w);
- return emit_cum_binary(compiler, AND_r_rm, AND_rm_r, AND, AND_EAX_i32,
+ return emit_cum_binary(compiler, BINARY_OPCODE(AND),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_OR:
- return emit_cum_binary(compiler, OR_r_rm, OR_rm_r, OR, OR_EAX_i32,
+ return emit_cum_binary(compiler, BINARY_OPCODE(OR),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_XOR:
- return emit_cum_binary(compiler, XOR_r_rm, XOR_rm_r, XOR, XOR_EAX_i32,
+ return emit_cum_binary(compiler, BINARY_OPCODE(XOR),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_SHL:
- return emit_shift_with_flags(compiler, SHL, GET_FLAGS(op),
+ return emit_shift_with_flags(compiler, SHL, HAS_FLAGS(op),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_LSHR:
- return emit_shift_with_flags(compiler, SHR, GET_FLAGS(op),
+ return emit_shift_with_flags(compiler, SHR, HAS_FLAGS(op),
dst, dstw, src1, src1w, src2, src2w);
case SLJIT_ASHR:
- return emit_shift_with_flags(compiler, SAR, GET_FLAGS(op),
+ return emit_shift_with_flags(compiler, SAR, HAS_FLAGS(op),
dst, dstw, src1, src1w, src2, src2w);
}
@@ -2249,7 +2174,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_register_index(reg));
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- if (reg >= SLJIT_R3 && reg <= SLJIT_R6)
+ if (reg >= SLJIT_R3 && reg <= SLJIT_R8)
return -1;
#endif
return reg_map[reg];
@@ -2258,7 +2183,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_float_register_index(sljit_s32 reg)
{
CHECK_REG_INDEX(check_sljit_get_float_register_index(reg));
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
return reg;
+#else
+ return freg_map[reg];
+#endif
}
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
@@ -2280,36 +2209,25 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *c
/* Floating point operators */
/* --------------------------------------------------------------------- */
-/* Alignment + 2 * 16 bytes. */
-static sljit_s32 sse2_data[3 + (4 + 4) * 2];
+/* Alignment(3) + 4 * 16 bytes. */
+static sljit_s32 sse2_data[3 + (4 * 4)];
static sljit_s32 *sse2_buffer;
static void init_compiler(void)
{
+ /* Align to 16 bytes. */
sse2_buffer = (sljit_s32*)(((sljit_uw)sse2_data + 15) & ~0xf);
- /* Single precision constants. */
+
+ /* Single precision constants (each constant is 16 byte long). */
sse2_buffer[0] = 0x80000000;
sse2_buffer[4] = 0x7fffffff;
- /* Double precision constants. */
+ /* Double precision constants (each constant is 16 byte long). */
sse2_buffer[8] = 0;
sse2_buffer[9] = 0x80000000;
sse2_buffer[12] = 0xffffffff;
sse2_buffer[13] = 0x7fffffff;
}
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_is_fpu_available(void)
-{
-#ifdef SLJIT_IS_FPU_AVAILABLE
- return SLJIT_IS_FPU_AVAILABLE;
-#elif (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
- if (cpu_has_sse2 == -1)
- get_cpu_features();
- return cpu_has_sse2;
-#else /* SLJIT_DETECT_SSE2 */
- return 1;
-#endif /* SLJIT_DETECT_SSE2 */
-}
-
static sljit_s32 emit_sse2(struct sljit_compiler *compiler, sljit_u8 opcode,
sljit_s32 single, sljit_s32 xmm1, sljit_s32 xmm2, sljit_sw xmm2w)
{
@@ -2350,7 +2268,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
sljit_s32 dst, sljit_sw dstw,
sljit_s32 src, sljit_sw srcw)
{
- sljit_s32 dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+ sljit_s32 dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
sljit_u8 *inst;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -2363,7 +2281,7 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_comp
*inst++ = GROUP_0F;
*inst = CVTTSD2SI_r_xm;
- if (dst_r == TMP_REG1 && dst != SLJIT_UNUSED)
+ if (dst & SLJIT_MEM)
return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
return SLJIT_SUCCESS;
}
@@ -2407,11 +2325,11 @@ static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compile
sljit_s32 src1, sljit_sw src1w,
sljit_s32 src2, sljit_sw src2w)
{
- compiler->flags_saved = 0;
if (!FAST_IS_REG(src1)) {
FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, TMP_FREG, src1, src1w));
src1 = TMP_FREG;
}
+
return emit_sse2_logic(compiler, UCOMISD_x_xm, !(op & SLJIT_F32_OP), src1, src2, src2w);
}
@@ -2456,7 +2374,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compil
return SLJIT_SUCCESS;
}
- if (SLOW_IS_REG(dst)) {
+ if (FAST_IS_REG(dst)) {
dst_r = dst;
if (dst != src)
FAIL_IF(emit_sse2_load(compiler, op & SLJIT_F32_OP, dst_r, src, srcw));
@@ -2554,11 +2472,6 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compi
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_label(compiler));
- /* We should restore the flags before the label,
- since other taken jumps has their own flags as well. */
- if (SLJIT_UNLIKELY(compiler->flags_saved))
- PTR_FAIL_IF(emit_restore_flags(compiler, 0));
-
if (compiler->last_label && compiler->last_label->size == compiler->size)
return compiler->last_label;
@@ -2583,20 +2496,11 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_jump(compiler, type));
- if (SLJIT_UNLIKELY(compiler->flags_saved)) {
- if ((type & 0xff) <= SLJIT_JUMP)
- PTR_FAIL_IF(emit_restore_flags(compiler, 0));
- compiler->flags_saved = 0;
- }
-
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
PTR_FAIL_IF_NULL(jump);
set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
type &= 0xff;
- if (type >= SLJIT_CALL1)
- PTR_FAIL_IF(call_with_args(compiler, type));
-
/* Worst case size. */
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
compiler->size += (type >= SLJIT_JUMP) ? 5 : 6;
@@ -2623,32 +2527,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
CHECK_EXTRA_REGS(src, srcw, (void)0);
- if (SLJIT_UNLIKELY(compiler->flags_saved)) {
- if (type <= SLJIT_JUMP)
- FAIL_IF(emit_restore_flags(compiler, 0));
- compiler->flags_saved = 0;
- }
-
- if (type >= SLJIT_CALL1) {
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
- if (src == SLJIT_R2) {
- EMIT_MOV(compiler, TMP_REG1, 0, src, 0);
- src = TMP_REG1;
- }
- if (src == SLJIT_MEM1(SLJIT_SP) && type >= SLJIT_CALL3)
- srcw += sizeof(sljit_sw);
-#endif
-#endif
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && defined(_WIN64)
- if (src == SLJIT_R2) {
- EMIT_MOV(compiler, TMP_REG1, 0, src, 0);
- src = TMP_REG1;
- }
-#endif
- FAIL_IF(call_with_args(compiler, type));
- }
-
if (src == SLJIT_IMM) {
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF_NULL(jump);
@@ -2683,37 +2561,29 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
sljit_s32 dst, sljit_sw dstw,
- sljit_s32 src, sljit_sw srcw,
sljit_s32 type)
{
sljit_u8 *inst;
sljit_u8 cond_set = 0;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
sljit_s32 reg;
-#else
- /* CHECK_EXTRA_REGS migh overwrite these values. */
+#endif
+ /* ADJUST_LOCAL_OFFSET and CHECK_EXTRA_REGS might overwrite these values. */
sljit_s32 dst_save = dst;
sljit_sw dstw_save = dstw;
-#endif
CHECK_ERROR();
- CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
- SLJIT_UNUSED_ARG(srcw);
-
- if (dst == SLJIT_UNUSED)
- return SLJIT_SUCCESS;
+ CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
ADJUST_LOCAL_OFFSET(dst, dstw);
CHECK_EXTRA_REGS(dst, dstw, (void)0);
- if (SLJIT_UNLIKELY(compiler->flags_saved))
- FAIL_IF(emit_restore_flags(compiler, op & SLJIT_KEEP_FLAGS));
type &= 0xff;
/* setcc = jcc + 0x10. */
cond_set = get_jump_code(type) + 0x10;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
- if (GET_OPCODE(op) == SLJIT_OR && !GET_ALL_FLAGS(op) && FAST_IS_REG(dst) && dst == src) {
+ if (GET_OPCODE(op) == SLJIT_OR && !GET_ALL_FLAGS(op) && FAST_IS_REG(dst)) {
inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + 3);
FAIL_IF(!inst);
INC_SIZE(4 + 3);
@@ -2728,7 +2598,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
return SLJIT_SUCCESS;
}
- reg = (op == SLJIT_MOV && FAST_IS_REG(dst)) ? dst : TMP_REG1;
+ reg = (GET_OPCODE(op) < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG1;
inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + 4);
FAIL_IF(!inst);
@@ -2739,6 +2609,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
*inst++ = cond_set;
*inst++ = MOD_REG | reg_lmap[reg];
*inst++ = REX_W | (reg_map[reg] <= 7 ? 0 : (REX_B | REX_R));
+ /* The movzx instruction does not affect flags. */
*inst++ = GROUP_0F;
*inst++ = MOVZX_r_rm8;
*inst = MOD_REG | (reg_lmap[reg] << 3) | reg_lmap[reg];
@@ -2750,12 +2621,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
compiler->mode32 = GET_OPCODE(op) != SLJIT_MOV;
return emit_mov(compiler, dst, dstw, TMP_REG1, 0);
}
+
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
|| (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
compiler->skip_checks = 1;
#endif
- return sljit_emit_op2(compiler, op, dst, dstw, dst, dstw, TMP_REG1, 0);
-#else /* SLJIT_CONFIG_X86_64 */
+ return sljit_emit_op2(compiler, op, dst_save, dstw_save, dst_save, dstw_save, TMP_REG1, 0);
+
+#else
+ /* The SLJIT_CONFIG_X86_32 code path starts here. */
if (GET_OPCODE(op) < SLJIT_ADD && FAST_IS_REG(dst)) {
if (reg_map[dst] <= 4) {
/* Low byte is accessible. */
@@ -2809,8 +2683,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
return SLJIT_SUCCESS;
}
- if (GET_OPCODE(op) == SLJIT_OR && !GET_ALL_FLAGS(op) && FAST_IS_REG(dst) && dst == src && reg_map[dst] <= 4) {
- SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R0] == 0, scratch_reg1_must_be_eax);
+ if (GET_OPCODE(op) == SLJIT_OR && !GET_ALL_FLAGS(op) && FAST_IS_REG(dst) && reg_map[dst] <= 4) {
+ SLJIT_ASSERT(reg_map[SLJIT_R0] == 0);
+
if (dst != SLJIT_R0) {
inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 3 + 2 + 1);
FAIL_IF(!inst);
@@ -2869,6 +2744,46 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *co
#endif /* SLJIT_CONFIG_X86_64 */
}
+SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type,
+ sljit_s32 dst_reg,
+ sljit_s32 src, sljit_sw srcw)
+{
+ sljit_u8* inst;
+
+ CHECK_ERROR();
+ CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
+
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+ dst_reg &= ~SLJIT_I32_OP;
+
+ if (!sljit_has_cpu_feature(SLJIT_HAS_CMOV) || (dst_reg >= SLJIT_R3 && dst_reg <= SLJIT_S3))
+ return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);
+#else
+ if (!sljit_has_cpu_feature(SLJIT_HAS_CMOV))
+ return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw);
+#endif
+
+ /* ADJUST_LOCAL_OFFSET is not needed. */
+ CHECK_EXTRA_REGS(src, srcw, (void)0);
+
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ compiler->mode32 = dst_reg & SLJIT_I32_OP;
+ dst_reg &= ~SLJIT_I32_OP;
+#endif
+
+ if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
+ EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcw);
+ src = TMP_REG1;
+ srcw = 0;
+ }
+
+ inst = emit_x86_instruction(compiler, 2, dst_reg, 0, src, srcw);
+ FAIL_IF(!inst);
+ *inst++ = GROUP_0F;
+ *inst = get_jump_code(type & 0xff) - 0x40;
+ return SLJIT_SUCCESS;
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
{
CHECK_ERROR();
@@ -2887,16 +2802,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *c
if (NOT_HALFWORD(offset)) {
FAIL_IF(emit_load_imm64(compiler, TMP_REG1, offset));
#if (defined SLJIT_DEBUG && SLJIT_DEBUG)
- SLJIT_ASSERT(emit_lea_binary(compiler, SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_SP, 0, TMP_REG1, 0) != SLJIT_ERR_UNSUPPORTED);
+ SLJIT_ASSERT(emit_lea_binary(compiler, dst, dstw, SLJIT_SP, 0, TMP_REG1, 0) != SLJIT_ERR_UNSUPPORTED);
return compiler->error;
#else
- return emit_lea_binary(compiler, SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_SP, 0, TMP_REG1, 0);
+ return emit_lea_binary(compiler, dst, dstw, SLJIT_SP, 0, TMP_REG1, 0);
#endif
}
#endif
if (offset != 0)
- return emit_lea_binary(compiler, SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
+ return emit_lea_binary(compiler, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
return emit_mov(compiler, dst, dstw, SLJIT_SP, 0);
}
@@ -2920,14 +2835,11 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
compiler->mode32 = 0;
- reg = SLOW_IS_REG(dst) ? dst : TMP_REG1;
+ reg = FAST_IS_REG(dst) ? dst : TMP_REG1;
if (emit_load_imm64(compiler, reg, init_value))
return NULL;
#else
- if (dst == SLJIT_UNUSED)
- dst = TMP_REG1;
-
if (emit_mov(compiler, dst, dstw, SLJIT_IMM, init_value))
return NULL;
#endif
@@ -2962,69 +2874,3 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
SLJIT_UNUSED_ARG(executable_offset);
sljit_unaligned_store_sw((void*)addr, new_constant);
}
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_sse2_available(void)
-{
-#if (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
- if (cpu_has_sse2 == -1)
- get_cpu_features();
- return cpu_has_sse2;
-#else
- return 1;
-#endif
-}
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_is_cmov_available(void)
-{
- if (cpu_has_cmov == -1)
- get_cpu_features();
- return cpu_has_cmov;
-}
-
-SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_x86_emit_cmov(struct sljit_compiler *compiler,
- sljit_s32 type,
- sljit_s32 dst_reg,
- sljit_s32 src, sljit_sw srcw)
-{
- sljit_u8* inst;
-
- CHECK_ERROR();
-#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
- CHECK_ARGUMENT(sljit_x86_is_cmov_available());
- CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_I32_OP)));
- CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_ORDERED_F64);
- CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_I32_OP));
- FUNCTION_CHECK_SRC(src, srcw);
-#endif
-#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
- if (SLJIT_UNLIKELY(!!compiler->verbose)) {
- fprintf(compiler->verbose, " x86_cmov%s %s%s, ",
- !(dst_reg & SLJIT_I32_OP) ? "" : ".i",
- jump_names[type & 0xff], JUMP_POSTFIX(type));
- sljit_verbose_reg(compiler, dst_reg & ~SLJIT_I32_OP);
- fprintf(compiler->verbose, ", ");
- sljit_verbose_param(compiler, src, srcw);
- fprintf(compiler->verbose, "\n");
- }
-#endif
-
- ADJUST_LOCAL_OFFSET(src, srcw);
- CHECK_EXTRA_REGS(src, srcw, (void)0);
-
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
- compiler->mode32 = dst_reg & SLJIT_I32_OP;
-#endif
- dst_reg &= ~SLJIT_I32_OP;
-
- if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
- EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcw);
- src = TMP_REG1;
- srcw = 0;
- }
-
- inst = emit_x86_instruction(compiler, 2, dst_reg, 0, src, srcw);
- FAIL_IF(!inst);
- *inst++ = GROUP_0F;
- *inst = get_jump_code(type & 0xff) - 0x40;
- return SLJIT_SUCCESS;
-}
diff --git a/thirdparty/pcre2/src/sljit/sljitProtExecAllocator.c b/thirdparty/pcre2/src/sljit/sljitProtExecAllocator.c
new file mode 100644
index 0000000000..8a5b2b3cfe
--- /dev/null
+++ b/thirdparty/pcre2/src/sljit/sljitProtExecAllocator.c
@@ -0,0 +1,421 @@
+/*
+ * Stack-less Just-In-Time compiler
+ *
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ This file contains a simple executable memory allocator
+
+ It is assumed, that executable code blocks are usually medium (or sometimes
+ large) memory blocks, and the allocator is not too frequently called (less
+ optimized than other allocators). Thus, using it as a generic allocator is
+ not suggested.
+
+ How does it work:
+ Memory is allocated in continuous memory areas called chunks by alloc_chunk()
+ Chunk format:
+ [ block ][ block ] ... [ block ][ block terminator ]
+
+ All blocks and the block terminator is started with block_header. The block
+ header contains the size of the previous and the next block. These sizes
+ can also contain special values.
+ Block size:
+ 0 - The block is a free_block, with a different size member.
+ 1 - The block is a block terminator.
+ n - The block is used at the moment, and the value contains its size.
+ Previous block size:
+ 0 - This is the first block of the memory chunk.
+ n - The size of the previous block.
+
+ Using these size values we can go forward or backward on the block chain.
+ The unused blocks are stored in a chain list pointed by free_blocks. This
+ list is useful if we need to find a suitable memory area when the allocator
+ is called.
+
+ When a block is freed, the new free block is connected to its adjacent free
+ blocks if possible.
+
+ [ free block ][ used block ][ free block ]
+ and "used block" is freed, the three blocks are connected together:
+ [ one big free block ]
+*/
+
+/* --------------------------------------------------------------------- */
+/* System (OS) functions */
+/* --------------------------------------------------------------------- */
+
+/* 64 KByte. */
+#define CHUNK_SIZE 0x10000
+
+struct chunk_header {
+ void *executable;
+ int fd;
+};
+
+/*
+ alloc_chunk / free_chunk :
+ * allocate executable system memory chunks
+ * the size is always divisible by CHUNK_SIZE
+ allocator_grab_lock / allocator_release_lock :
+ * make the allocator thread safe
+ * can be empty if the OS (or the application) does not support threading
+ * only the allocator requires this lock, sljit is fully thread safe
+ as it only uses local variables
+*/
+
+#include <fcntl.h>
+
+#ifndef O_NOATIME
+#define O_NOATIME 0
+#endif
+
+#ifdef __O_TMPFILE
+#ifndef O_TMPFILE
+#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
+#endif
+#endif
+
+int mkostemp(char *template, int flags);
+char *secure_getenv(const char *name);
+
+static SLJIT_INLINE int create_tempfile(void)
+{
+ int fd;
+
+ char tmp_name[256];
+ size_t tmp_name_len;
+ char *dir;
+ size_t len;
+
+#ifdef P_tmpdir
+ len = (P_tmpdir != NULL) ? strlen(P_tmpdir) : 0;
+
+ if (len > 0 && len < sizeof(tmp_name)) {
+ strcpy(tmp_name, P_tmpdir);
+ tmp_name_len = len;
+ }
+ else {
+ strcpy(tmp_name, "/tmp");
+ tmp_name_len = 4;
+ }
+#else
+ strcpy(tmp_name, "/tmp");
+ tmp_name_len = 4;
+#endif
+
+ dir = secure_getenv("TMPDIR");
+ if (dir) {
+ len = strlen(dir);
+ if (len > 0 && len < sizeof(tmp_name)) {
+ strcpy(tmp_name, dir);
+ tmp_name_len = len;
+ }
+ }
+
+ SLJIT_ASSERT(tmp_name_len > 0 && tmp_name_len < sizeof(tmp_name));
+
+ while (tmp_name_len > 0 && tmp_name[tmp_name_len - 1] == '/') {
+ tmp_name_len--;
+ tmp_name[tmp_name_len] = '\0';
+ }
+
+#ifdef O_TMPFILE
+ fd = open(tmp_name, O_TMPFILE | O_EXCL | O_RDWR | O_NOATIME | O_CLOEXEC, S_IRUSR | S_IWUSR);
+ if (fd != -1)
+ return fd;
+#endif
+
+ if (tmp_name_len + 7 >= sizeof(tmp_name))
+ {
+ return -1;
+ }
+
+ strcpy(tmp_name + tmp_name_len, "/XXXXXX");
+ fd = mkostemp(tmp_name, O_CLOEXEC | O_NOATIME);
+
+ if (fd == -1)
+ return fd;
+
+ if (unlink(tmp_name)) {
+ close(fd);
+ return -1;
+ }
+
+ return fd;
+}
+
+static SLJIT_INLINE struct chunk_header* alloc_chunk(sljit_uw size)
+{
+ struct chunk_header *retval;
+ int fd;
+
+ fd = create_tempfile();
+ if (fd == -1)
+ return NULL;
+
+ if (ftruncate(fd, size)) {
+ close(fd);
+ return NULL;
+ }
+
+ retval = (struct chunk_header *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+
+ if (retval == MAP_FAILED) {
+ close(fd);
+ return NULL;
+ }
+
+ retval->executable = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_SHARED, fd, 0);
+
+ if (retval->executable == MAP_FAILED) {
+ munmap(retval, size);
+ close(fd);
+ return NULL;
+ }
+
+ retval->fd = fd;
+ return retval;
+}
+
+static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size)
+{
+ struct chunk_header *header = ((struct chunk_header *)chunk) - 1;
+
+ int fd = header->fd;
+ munmap(header->executable, size);
+ munmap(header, size);
+ close(fd);
+}
+
+/* --------------------------------------------------------------------- */
+/* Common functions */
+/* --------------------------------------------------------------------- */
+
+#define CHUNK_MASK (~(CHUNK_SIZE - 1))
+
+struct block_header {
+ sljit_uw size;
+ sljit_uw prev_size;
+ sljit_sw executable_offset;
+};
+
+struct free_block {
+ struct block_header header;
+ struct free_block *next;
+ struct free_block *prev;
+ sljit_uw size;
+};
+
+#define AS_BLOCK_HEADER(base, offset) \
+ ((struct block_header*)(((sljit_u8*)base) + offset))
+#define AS_FREE_BLOCK(base, offset) \
+ ((struct free_block*)(((sljit_u8*)base) + offset))
+#define MEM_START(base) ((void*)((base) + 1))
+#define ALIGN_SIZE(size) (((size) + sizeof(struct block_header) + 7) & ~7)
+
+static struct free_block* free_blocks;
+static sljit_uw allocated_size;
+static sljit_uw total_size;
+
+static SLJIT_INLINE void sljit_insert_free_block(struct free_block *free_block, sljit_uw size)
+{
+ free_block->header.size = 0;
+ free_block->size = size;
+
+ free_block->next = free_blocks;
+ free_block->prev = NULL;
+ if (free_blocks)
+ free_blocks->prev = free_block;
+ free_blocks = free_block;
+}
+
+static SLJIT_INLINE void sljit_remove_free_block(struct free_block *free_block)
+{
+ if (free_block->next)
+ free_block->next->prev = free_block->prev;
+
+ if (free_block->prev)
+ free_block->prev->next = free_block->next;
+ else {
+ SLJIT_ASSERT(free_blocks == free_block);
+ free_blocks = free_block->next;
+ }
+}
+
+SLJIT_API_FUNC_ATTRIBUTE void* sljit_malloc_exec(sljit_uw size)
+{
+ struct chunk_header *chunk_header;
+ struct block_header *header;
+ struct block_header *next_header;
+ struct free_block *free_block;
+ sljit_uw chunk_size;
+ sljit_sw executable_offset;
+
+ allocator_grab_lock();
+ if (size < (64 - sizeof(struct block_header)))
+ size = (64 - sizeof(struct block_header));
+ size = ALIGN_SIZE(size);
+
+ free_block = free_blocks;
+ while (free_block) {
+ if (free_block->size >= size) {
+ chunk_size = free_block->size;
+ if (chunk_size > size + 64) {
+ /* We just cut a block from the end of the free block. */
+ chunk_size -= size;
+ free_block->size = chunk_size;
+ header = AS_BLOCK_HEADER(free_block, chunk_size);
+ header->prev_size = chunk_size;
+ header->executable_offset = free_block->header.executable_offset;
+ AS_BLOCK_HEADER(header, size)->prev_size = size;
+ }
+ else {
+ sljit_remove_free_block(free_block);
+ header = (struct block_header*)free_block;
+ size = chunk_size;
+ }
+ allocated_size += size;
+ header->size = size;
+ allocator_release_lock();
+ return MEM_START(header);
+ }
+ free_block = free_block->next;
+ }
+
+ chunk_size = sizeof(struct chunk_header) + sizeof(struct block_header);
+ chunk_size = (chunk_size + size + CHUNK_SIZE - 1) & CHUNK_MASK;
+
+ chunk_header = alloc_chunk(chunk_size);
+ if (!chunk_header) {
+ allocator_release_lock();
+ return NULL;
+ }
+
+ executable_offset = (sljit_sw)((sljit_u8*)chunk_header->executable - (sljit_u8*)chunk_header);
+
+ chunk_size -= sizeof(struct chunk_header) + sizeof(struct block_header);
+ total_size += chunk_size;
+
+ header = (struct block_header *)(chunk_header + 1);
+
+ header->prev_size = 0;
+ header->executable_offset = executable_offset;
+ if (chunk_size > size + 64) {
+ /* Cut the allocated space into a free and a used block. */
+ allocated_size += size;
+ header->size = size;
+ chunk_size -= size;
+
+ free_block = AS_FREE_BLOCK(header, size);
+ free_block->header.prev_size = size;
+ free_block->header.executable_offset = executable_offset;
+ sljit_insert_free_block(free_block, chunk_size);
+ next_header = AS_BLOCK_HEADER(free_block, chunk_size);
+ }
+ else {
+ /* All space belongs to this allocation. */
+ allocated_size += chunk_size;
+ header->size = chunk_size;
+ next_header = AS_BLOCK_HEADER(header, chunk_size);
+ }
+ next_header->size = 1;
+ next_header->prev_size = chunk_size;
+ next_header->executable_offset = executable_offset;
+ allocator_release_lock();
+ return MEM_START(header);
+}
+
+SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* ptr)
+{
+ struct block_header *header;
+ struct free_block* free_block;
+
+ allocator_grab_lock();
+ header = AS_BLOCK_HEADER(ptr, -(sljit_sw)sizeof(struct block_header));
+ header = AS_BLOCK_HEADER(header, -header->executable_offset);
+ allocated_size -= header->size;
+
+ /* Connecting free blocks together if possible. */
+
+ /* If header->prev_size == 0, free_block will equal to header.
+ In this case, free_block->header.size will be > 0. */
+ free_block = AS_FREE_BLOCK(header, -(sljit_sw)header->prev_size);
+ if (SLJIT_UNLIKELY(!free_block->header.size)) {
+ free_block->size += header->size;
+ header = AS_BLOCK_HEADER(free_block, free_block->size);
+ header->prev_size = free_block->size;
+ }
+ else {
+ free_block = (struct free_block*)header;
+ sljit_insert_free_block(free_block, header->size);
+ }
+
+ header = AS_BLOCK_HEADER(free_block, free_block->size);
+ if (SLJIT_UNLIKELY(!header->size)) {
+ free_block->size += ((struct free_block*)header)->size;
+ sljit_remove_free_block((struct free_block*)header);
+ header = AS_BLOCK_HEADER(free_block, free_block->size);
+ header->prev_size = free_block->size;
+ }
+
+ /* The whole chunk is free. */
+ if (SLJIT_UNLIKELY(!free_block->header.prev_size && header->size == 1)) {
+ /* If this block is freed, we still have (allocated_size / 2) free space. */
+ if (total_size - free_block->size > (allocated_size * 3 / 2)) {
+ total_size -= free_block->size;
+ sljit_remove_free_block(free_block);
+ free_chunk(free_block, free_block->size + sizeof(struct block_header));
+ }
+ }
+
+ allocator_release_lock();
+}
+
+SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void)
+{
+ struct free_block* free_block;
+ struct free_block* next_free_block;
+
+ allocator_grab_lock();
+
+ free_block = free_blocks;
+ while (free_block) {
+ next_free_block = free_block->next;
+ if (!free_block->header.prev_size &&
+ AS_BLOCK_HEADER(free_block, free_block->size)->size == 1) {
+ total_size -= free_block->size;
+ sljit_remove_free_block(free_block);
+ free_chunk(free_block, free_block->size + sizeof(struct block_header));
+ }
+ free_block = next_free_block;
+ }
+
+ SLJIT_ASSERT((total_size && free_blocks) || (!total_size && !free_blocks));
+ allocator_release_lock();
+}
+
+SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void* ptr)
+{
+ return ((struct block_header *)(ptr))[-1].executable_offset;
+}
diff --git a/thirdparty/pcre2/src/sljit/sljitUtils.c b/thirdparty/pcre2/src/sljit/sljitUtils.c
index ec5c321194..5c2a838932 100644
--- a/thirdparty/pcre2/src/sljit/sljitUtils.c
+++ b/thirdparty/pcre2/src/sljit/sljitUtils.c
@@ -1,7 +1,7 @@
/*
* Stack-less Just-In-Time compiler
*
- * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
+ * Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@@ -48,12 +48,12 @@ static SLJIT_INLINE void allocator_release_lock(void)
#if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_grab_lock(void)
{
/* Always successful. */
}
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_release_lock(void)
{
/* Always successful. */
}
@@ -88,7 +88,7 @@ static SLJIT_INLINE void allocator_release_lock(void)
static HANDLE global_mutex = 0;
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_grab_lock(void)
{
/* No idea what to do if an error occures. Static mutexes should never fail... */
if (!global_mutex)
@@ -97,7 +97,7 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
WaitForSingleObject(global_mutex, INFINITE);
}
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_release_lock(void)
{
ReleaseMutex(global_mutex);
}
@@ -130,12 +130,12 @@ static SLJIT_INLINE void allocator_release_lock(void)
static pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER;
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_grab_lock(void)
{
pthread_mutex_lock(&global_mutex);
}
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_release_lock(void)
{
pthread_mutex_unlock(&global_mutex);
}
@@ -203,19 +203,16 @@ static SLJIT_INLINE sljit_s32 open_dev_zero(void)
/* Planning to make it even more clever in the future. */
static sljit_sw sljit_page_align = 0;
-SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit, void *allocator_data)
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_FUNC sljit_allocate_stack(sljit_uw start_size, sljit_uw max_size, void *allocator_data)
{
struct sljit_stack *stack;
- union {
- void *ptr;
- sljit_uw uw;
- } base;
+ void *ptr;
#ifdef _WIN32
SYSTEM_INFO si;
#endif
SLJIT_UNUSED_ARG(allocator_data);
- if (limit > max_limit || limit < 1)
+ if (start_size > max_size || start_size < 1)
return NULL;
#ifdef _WIN32
@@ -233,29 +230,31 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(slj
}
#endif
- /* Align limit and max_limit. */
- max_limit = (max_limit + sljit_page_align) & ~sljit_page_align;
-
stack = (struct sljit_stack*)SLJIT_MALLOC(sizeof(struct sljit_stack), allocator_data);
if (!stack)
return NULL;
+ /* Align max_size. */
+ max_size = (max_size + sljit_page_align) & ~sljit_page_align;
+
#ifdef _WIN32
- base.ptr = VirtualAlloc(NULL, max_limit, MEM_RESERVE, PAGE_READWRITE);
- if (!base.ptr) {
+ ptr = VirtualAlloc(NULL, max_size, MEM_RESERVE, PAGE_READWRITE);
+ if (!ptr) {
SLJIT_FREE(stack, allocator_data);
return NULL;
}
- stack->base = base.uw;
- stack->limit = stack->base;
- stack->max_limit = stack->base + max_limit;
- if (sljit_stack_resize(stack, stack->base + limit)) {
+
+ stack->min_start = (sljit_u8 *)ptr;
+ stack->end = stack->min_start + max_size;
+ stack->start = stack->end;
+
+ if (sljit_stack_resize(stack, stack->end - start_size) == NULL) {
sljit_free_stack(stack, allocator_data);
return NULL;
}
#else
#ifdef MAP_ANON
- base.ptr = mmap(NULL, max_limit, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+ ptr = mmap(NULL, max_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
#else
if (dev_zero < 0) {
if (open_dev_zero()) {
@@ -263,73 +262,70 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(slj
return NULL;
}
}
- base.ptr = mmap(NULL, max_limit, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero, 0);
+ ptr = mmap(NULL, max_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero, 0);
#endif
- if (base.ptr == MAP_FAILED) {
+ if (ptr == MAP_FAILED) {
SLJIT_FREE(stack, allocator_data);
return NULL;
}
- stack->base = base.uw;
- stack->limit = stack->base + limit;
- stack->max_limit = stack->base + max_limit;
+ stack->min_start = (sljit_u8 *)ptr;
+ stack->end = stack->min_start + max_size;
+ stack->start = stack->end - start_size;
#endif
- stack->top = stack->base;
+ stack->top = stack->end;
return stack;
}
#undef PAGE_ALIGN
-SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_free_stack(struct sljit_stack* stack, void *allocator_data)
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_free_stack(struct sljit_stack *stack, void *allocator_data)
{
SLJIT_UNUSED_ARG(allocator_data);
#ifdef _WIN32
- VirtualFree((void*)stack->base, 0, MEM_RELEASE);
+ VirtualFree((void*)stack->min_start, 0, MEM_RELEASE);
#else
- munmap((void*)stack->base, stack->max_limit - stack->base);
+ munmap((void*)stack->min_start, stack->end - stack->min_start);
#endif
SLJIT_FREE(stack, allocator_data);
}
-SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit)
+SLJIT_API_FUNC_ATTRIBUTE sljit_u8 *SLJIT_FUNC sljit_stack_resize(struct sljit_stack *stack, sljit_u8 *new_start)
{
- sljit_uw aligned_old_limit;
- sljit_uw aligned_new_limit;
+ sljit_uw aligned_old_start;
+ sljit_uw aligned_new_start;
+
+ if ((new_start < stack->min_start) || (new_start >= stack->end))
+ return NULL;
- if ((new_limit > stack->max_limit) || (new_limit < stack->base))
- return -1;
#ifdef _WIN32
- aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
- aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
- if (aligned_new_limit != aligned_old_limit) {
- if (aligned_new_limit > aligned_old_limit) {
- if (!VirtualAlloc((void*)aligned_old_limit, aligned_new_limit - aligned_old_limit, MEM_COMMIT, PAGE_READWRITE))
- return -1;
+ aligned_new_start = (sljit_uw)new_start & ~sljit_page_align;
+ aligned_old_start = ((sljit_uw)stack->start) & ~sljit_page_align;
+ if (aligned_new_start != aligned_old_start) {
+ if (aligned_new_start < aligned_old_start) {
+ if (!VirtualAlloc((void*)aligned_new_start, aligned_old_start - aligned_new_start, MEM_COMMIT, PAGE_READWRITE))
+ return NULL;
}
else {
- if (!VirtualFree((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MEM_DECOMMIT))
- return -1;
+ if (!VirtualFree((void*)aligned_old_start, aligned_new_start - aligned_old_start, MEM_DECOMMIT))
+ return NULL;
}
}
- stack->limit = new_limit;
- return 0;
#else
- if (new_limit >= stack->limit) {
- stack->limit = new_limit;
- return 0;
- }
- aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
- aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
- /* If madvise is available, we release the unnecessary space. */
+ if (stack->start < new_start) {
+ aligned_new_start = (sljit_uw)new_start & ~sljit_page_align;
+ aligned_old_start = ((sljit_uw)stack->start) & ~sljit_page_align;
+ /* If madvise is available, we release the unnecessary space. */
#if defined(MADV_DONTNEED)
- if (aligned_new_limit < aligned_old_limit)
- madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED);
+ if (aligned_new_start > aligned_old_start)
+ madvise((void*)aligned_old_start, aligned_new_start - aligned_old_start, MADV_DONTNEED);
#elif defined(POSIX_MADV_DONTNEED)
- if (aligned_new_limit < aligned_old_limit)
- posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED);
+ if (aligned_new_start > aligned_old_start)
+ posix_madvise((void*)aligned_old_start, aligned_new_start - aligned_old_start, POSIX_MADV_DONTNEED);
#endif
- stack->limit = new_limit;
- return 0;
+ }
#endif
+ stack->start = new_start;
+ return new_start;
}
#endif /* SLJIT_UTIL_STACK */
diff --git a/thirdparty/thekla_atlas/nvcore/Debug.h b/thirdparty/thekla_atlas/nvcore/Debug.h
index f37a05c453..3804ed4763 100644
--- a/thirdparty/thekla_atlas/nvcore/Debug.h
+++ b/thirdparty/thekla_atlas/nvcore/Debug.h
@@ -200,10 +200,10 @@ namespace nv
if (reinterpret_cast<uint64>(ptr) < 0x10000ULL) return false;
if (reinterpret_cast<uint64>(ptr) >= 0x000007FFFFFEFFFFULL) return false;
#else
- if (reinterpret_cast<uint32>(ptr) == 0xcccccccc) return false;
- if (reinterpret_cast<uint32>(ptr) == 0xcdcdcdcd) return false;
- if (reinterpret_cast<uint32>(ptr) == 0xdddddddd) return false;
- if (reinterpret_cast<uint32>(ptr) == 0xffffffff) return false;
+ if (reinterpret_cast<uintptr_t>(ptr) == 0xcccccccc) return false;
+ if (reinterpret_cast<uintptr_t>(ptr) == 0xcdcdcdcd) return false;
+ if (reinterpret_cast<uintptr_t>(ptr) == 0xdddddddd) return false;
+ if (reinterpret_cast<uintptr_t>(ptr) == 0xffffffff) return false;
#endif
return true;
}
diff --git a/thirdparty/thekla_atlas/poshlib/posh.h b/thirdparty/thekla_atlas/poshlib/posh.h
index c3efe26a2d..3038297b39 100644
--- a/thirdparty/thekla_atlas/poshlib/posh.h
+++ b/thirdparty/thekla_atlas/poshlib/posh.h
@@ -498,6 +498,11 @@ Metrowerks:
# define POSH_CPU_STRING "ARM"
#endif
+#if defined AARCH64 || defined __aarch64__ || defined _AARCH64
+# define POSH_CPU_STRONGARM 1
+# define POSH_CPU_STRING "AARCH64"
+#endif
+
#if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS
# define POSH_CPU_MIPS 1
# if defined _R5900
diff --git a/thirdparty/zstd/common/bitstream.h b/thirdparty/zstd/common/bitstream.h
index fcf3843079..f7f389fe0f 100644
--- a/thirdparty/zstd/common/bitstream.h
+++ b/thirdparty/zstd/common/bitstream.h
@@ -426,7 +426,7 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits)
* Refill `bitD` from buffer previously set in BIT_initDStream() .
* This function is safe, it guarantees it will not read beyond src buffer.
* @return : status of `BIT_DStream_t` internal register.
- * when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */
+ * when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */
MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
{
if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* overflow detected, like end of stream */
diff --git a/thirdparty/zstd/common/compiler.h b/thirdparty/zstd/common/compiler.h
index 3a7553c380..e90a3bcde3 100644
--- a/thirdparty/zstd/common/compiler.h
+++ b/thirdparty/zstd/common/compiler.h
@@ -63,6 +63,31 @@
# endif
#endif
+/* target attribute */
+#ifndef __has_attribute
+ #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+#if defined(__GNUC__)
+# define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
+#else
+# define TARGET_ATTRIBUTE(target)
+#endif
+
+/* Enable runtime BMI2 dispatch based on the CPU.
+ * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
+ */
+#ifndef DYNAMIC_BMI2
+ #if (defined(__clang__) && __has_attribute(__target__)) \
+ || (defined(__GNUC__) \
+ && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) \
+ && (defined(__x86_64__) || defined(_M_X86)) \
+ && !defined(__BMI2__)
+ # define DYNAMIC_BMI2 1
+ #else
+ # define DYNAMIC_BMI2 0
+ #endif
+#endif
+
/* prefetch */
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
diff --git a/thirdparty/zstd/common/cpu.h b/thirdparty/zstd/common/cpu.h
new file mode 100644
index 0000000000..4eb48e39e1
--- /dev/null
+++ b/thirdparty/zstd/common/cpu.h
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2018-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under both the BSD-style license (found in the
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
+ * in the COPYING file in the root directory of this source tree).
+ * You may select, at your option, one of the above-listed licenses.
+ */
+
+#ifndef ZSTD_COMMON_CPU_H
+#define ZSTD_COMMON_CPU_H
+
+/**
+ * Implementation taken from folly/CpuId.h
+ * https://github.com/facebook/folly/blob/master/folly/CpuId.h
+ */
+
+#include <string.h>
+
+#include "mem.h"
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
+
+typedef struct {
+ U32 f1c;
+ U32 f1d;
+ U32 f7b;
+ U32 f7c;
+} ZSTD_cpuid_t;
+
+MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
+ U32 f1c = 0;
+ U32 f1d = 0;
+ U32 f7b = 0;
+ U32 f7c = 0;
+#ifdef _MSC_VER
+ int reg[4];
+ __cpuid((int*)reg, 0);
+ {
+ int const n = reg[0];
+ if (n >= 1) {
+ __cpuid((int*)reg, 1);
+ f1c = (U32)reg[2];
+ f1d = (U32)reg[3];
+ }
+ if (n >= 7) {
+ __cpuidex((int*)reg, 7, 0);
+ f7b = (U32)reg[1];
+ f7c = (U32)reg[2];
+ }
+ }
+#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__)
+ /* The following block like the normal cpuid branch below, but gcc
+ * reserves ebx for use of its pic register so we must specially
+ * handle the save and restore to avoid clobbering the register
+ */
+ U32 n;
+ __asm__(
+ "pushl %%ebx\n\t"
+ "cpuid\n\t"
+ "popl %%ebx\n\t"
+ : "=a"(n)
+ : "a"(0)
+ : "ecx", "edx");
+ if (n >= 1) {
+ U32 f1a;
+ __asm__(
+ "pushl %%ebx\n\t"
+ "cpuid\n\t"
+ "popl %%ebx\n\t"
+ : "=a"(f1a), "=c"(f1c), "=d"(f1d)
+ : "a"(1)
+ :);
+ }
+ if (n >= 7) {
+ __asm__(
+ "pushl %%ebx\n\t"
+ "cpuid\n\t"
+ "movl %%ebx, %%eax\n\r"
+ "popl %%ebx"
+ : "=a"(f7b), "=c"(f7c)
+ : "a"(7), "c"(0)
+ : "edx");
+ }
+#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
+ U32 n;
+ __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
+ if (n >= 1) {
+ U32 f1a;
+ __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
+ }
+ if (n >= 7) {
+ U32 f7a;
+ __asm__("cpuid"
+ : "=a"(f7a), "=b"(f7b), "=c"(f7c)
+ : "a"(7), "c"(0)
+ : "edx");
+ }
+#endif
+ {
+ ZSTD_cpuid_t cpuid;
+ cpuid.f1c = f1c;
+ cpuid.f1d = f1d;
+ cpuid.f7b = f7b;
+ cpuid.f7c = f7c;
+ return cpuid;
+ }
+}
+
+#define X(name, r, bit) \
+ MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) { \
+ return ((cpuid.r) & (1U << bit)) != 0; \
+ }
+
+/* cpuid(1): Processor Info and Feature Bits. */
+#define C(name, bit) X(name, f1c, bit)
+ C(sse3, 0)
+ C(pclmuldq, 1)
+ C(dtes64, 2)
+ C(monitor, 3)
+ C(dscpl, 4)
+ C(vmx, 5)
+ C(smx, 6)
+ C(eist, 7)
+ C(tm2, 8)
+ C(ssse3, 9)
+ C(cnxtid, 10)
+ C(fma, 12)
+ C(cx16, 13)
+ C(xtpr, 14)
+ C(pdcm, 15)
+ C(pcid, 17)
+ C(dca, 18)
+ C(sse41, 19)
+ C(sse42, 20)
+ C(x2apic, 21)
+ C(movbe, 22)
+ C(popcnt, 23)
+ C(tscdeadline, 24)
+ C(aes, 25)
+ C(xsave, 26)
+ C(osxsave, 27)
+ C(avx, 28)
+ C(f16c, 29)
+ C(rdrand, 30)
+#undef C
+#define D(name, bit) X(name, f1d, bit)
+ D(fpu, 0)
+ D(vme, 1)
+ D(de, 2)
+ D(pse, 3)
+ D(tsc, 4)
+ D(msr, 5)
+ D(pae, 6)
+ D(mce, 7)
+ D(cx8, 8)
+ D(apic, 9)
+ D(sep, 11)
+ D(mtrr, 12)
+ D(pge, 13)
+ D(mca, 14)
+ D(cmov, 15)
+ D(pat, 16)
+ D(pse36, 17)
+ D(psn, 18)
+ D(clfsh, 19)
+ D(ds, 21)
+ D(acpi, 22)
+ D(mmx, 23)
+ D(fxsr, 24)
+ D(sse, 25)
+ D(sse2, 26)
+ D(ss, 27)
+ D(htt, 28)
+ D(tm, 29)
+ D(pbe, 31)
+#undef D
+
+/* cpuid(7): Extended Features. */
+#define B(name, bit) X(name, f7b, bit)
+ B(bmi1, 3)
+ B(hle, 4)
+ B(avx2, 5)
+ B(smep, 7)
+ B(bmi2, 8)
+ B(erms, 9)
+ B(invpcid, 10)
+ B(rtm, 11)
+ B(mpx, 14)
+ B(avx512f, 16)
+ B(avx512dq, 17)
+ B(rdseed, 18)
+ B(adx, 19)
+ B(smap, 20)
+ B(avx512ifma, 21)
+ B(pcommit, 22)
+ B(clflushopt, 23)
+ B(clwb, 24)
+ B(avx512pf, 26)
+ B(avx512er, 27)
+ B(avx512cd, 28)
+ B(sha, 29)
+ B(avx512bw, 30)
+ B(avx512vl, 31)
+#undef B
+#define C(name, bit) X(name, f7c, bit)
+ C(prefetchwt1, 0)
+ C(avx512vbmi, 1)
+#undef C
+
+#undef X
+
+#endif /* ZSTD_COMMON_CPU_H */
diff --git a/thirdparty/zstd/common/error_private.c b/thirdparty/zstd/common/error_private.c
index 11f7cdab1c..d004ee636c 100644
--- a/thirdparty/zstd/common/error_private.c
+++ b/thirdparty/zstd/common/error_private.c
@@ -29,6 +29,7 @@ const char* ERR_getErrorString(ERR_enum code)
case PREFIX(parameter_outOfBound): return "Parameter is out of bound";
case PREFIX(init_missing): return "Context should be init first";
case PREFIX(memory_allocation): return "Allocation error : not enough memory";
+ case PREFIX(workSpace_tooSmall): return "workSpace buffer is not large enough";
case PREFIX(stage_wrong): return "Operation not authorized at current processing stage";
case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
diff --git a/thirdparty/zstd/common/fse.h b/thirdparty/zstd/common/fse.h
index afd7801963..6a1d272be5 100644
--- a/thirdparty/zstd/common/fse.h
+++ b/thirdparty/zstd/common/fse.h
@@ -345,7 +345,7 @@ size_t FSE_countFast(unsigned* count, unsigned* maxSymbolValuePtr, const void* s
*/
size_t FSE_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize, unsigned* workSpace);
-/*! FSE_count_simple
+/*! FSE_count_simple() :
* Same as FSE_countFast(), but does not use any additional memory (not even on stack).
* This function is unsafe, and will segfault if any value within `src` is `> *maxSymbolValuePtr` (presuming it's also the size of `count`).
*/
diff --git a/thirdparty/zstd/common/fse_decompress.c b/thirdparty/zstd/common/fse_decompress.c
index 8e3f0035f6..4c66c3b774 100644
--- a/thirdparty/zstd/common/fse_decompress.c
+++ b/thirdparty/zstd/common/fse_decompress.c
@@ -139,8 +139,8 @@ size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, unsigned
{ U32 u;
for (u=0; u<tableSize; u++) {
FSE_FUNCTION_TYPE const symbol = (FSE_FUNCTION_TYPE)(tableDecode[u].symbol);
- U16 nextState = symbolNext[symbol]++;
- tableDecode[u].nbBits = (BYTE) (tableLog - BIT_highbit32 ((U32)nextState) );
+ U32 const nextState = symbolNext[symbol]++;
+ tableDecode[u].nbBits = (BYTE) (tableLog - BIT_highbit32(nextState) );
tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
} }
diff --git a/thirdparty/zstd/common/huf.h b/thirdparty/zstd/common/huf.h
index 522bf9b6c0..b4645b4e51 100644
--- a/thirdparty/zstd/common/huf.h
+++ b/thirdparty/zstd/common/huf.h
@@ -58,32 +58,32 @@ extern "C" {
#endif
-/* *** simple functions *** */
-/**
-HUF_compress() :
- Compress content from buffer 'src', of size 'srcSize', into buffer 'dst'.
- 'dst' buffer must be already allocated.
- Compression runs faster if `dstCapacity` >= HUF_compressBound(srcSize).
- `srcSize` must be <= `HUF_BLOCKSIZE_MAX` == 128 KB.
- @return : size of compressed data (<= `dstCapacity`).
- Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!!
- if return == 1, srcData is a single repeated byte symbol (RLE compression).
- if HUF_isError(return), compression failed (more details using HUF_getErrorName())
-*/
+/* ========================== */
+/* *** simple functions *** */
+/* ========================== */
+
+/** HUF_compress() :
+ * Compress content from buffer 'src', of size 'srcSize', into buffer 'dst'.
+ * 'dst' buffer must be already allocated.
+ * Compression runs faster if `dstCapacity` >= HUF_compressBound(srcSize).
+ * `srcSize` must be <= `HUF_BLOCKSIZE_MAX` == 128 KB.
+ * @return : size of compressed data (<= `dstCapacity`).
+ * Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!!
+ * if HUF_isError(return), compression failed (more details using HUF_getErrorName())
+ */
HUF_PUBLIC_API size_t HUF_compress(void* dst, size_t dstCapacity,
const void* src, size_t srcSize);
-/**
-HUF_decompress() :
- Decompress HUF data from buffer 'cSrc', of size 'cSrcSize',
- into already allocated buffer 'dst', of minimum size 'dstSize'.
- `originalSize` : **must** be the ***exact*** size of original (uncompressed) data.
- Note : in contrast with FSE, HUF_decompress can regenerate
- RLE (cSrcSize==1) and uncompressed (cSrcSize==dstSize) data,
- because it knows size to regenerate.
- @return : size of regenerated data (== originalSize),
- or an error code, which can be tested using HUF_isError()
-*/
+/** HUF_decompress() :
+ * Decompress HUF data from buffer 'cSrc', of size 'cSrcSize',
+ * into already allocated buffer 'dst', of minimum size 'dstSize'.
+ * `originalSize` : **must** be the ***exact*** size of original (uncompressed) data.
+ * Note : in contrast with FSE, HUF_decompress can regenerate
+ * RLE (cSrcSize==1) and uncompressed (cSrcSize==dstSize) data,
+ * because it knows size to regenerate (originalSize).
+ * @return : size of regenerated data (== originalSize),
+ * or an error code, which can be tested using HUF_isError()
+ */
HUF_PUBLIC_API size_t HUF_decompress(void* dst, size_t originalSize,
const void* cSrc, size_t cSrcSize);
@@ -100,39 +100,32 @@ HUF_PUBLIC_API const char* HUF_getErrorName(size_t code); /**< provides error c
/* *** Advanced function *** */
/** HUF_compress2() :
- * Same as HUF_compress(), but offers direct control over `maxSymbolValue` and `tableLog`.
- * `tableLog` must be `<= HUF_TABLELOG_MAX` . */
-HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
+ * Same as HUF_compress(), but offers control over `maxSymbolValue` and `tableLog`.
+ * `maxSymbolValue` must be <= HUF_SYMBOLVALUE_MAX .
+ * `tableLog` must be `<= HUF_TABLELOG_MAX` . */
+HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity,
+ const void* src, size_t srcSize,
+ unsigned maxSymbolValue, unsigned tableLog);
/** HUF_compress4X_wksp() :
* Same as HUF_compress2(), but uses externally allocated `workSpace`.
- * `workspace` must have minimum alignment of 4, and be at least as large as following macro */
+ * `workspace` must have minimum alignment of 4, and be at least as large as HUF_WORKSPACE_SIZE */
#define HUF_WORKSPACE_SIZE (6 << 10)
#define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32))
-HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
-
-/**
- * The minimum workspace size for the `workSpace` used in
- * HUF_readDTableX2_wksp() and HUF_readDTableX4_wksp().
- *
- * The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when
- * HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15.
- * Buffer overflow errors may potentially occur if code modifications result in
- * a required workspace size greater than that specified in the following
- * macro.
- */
-#define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10)
-#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
+HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity,
+ const void* src, size_t srcSize,
+ unsigned maxSymbolValue, unsigned tableLog,
+ void* workSpace, size_t wkspSize);
#endif /* HUF_H_298734234 */
/* ******************************************************************
* WARNING !!
* The following section contains advanced and experimental definitions
- * which shall never be used in the context of dll
+ * which shall never be used in the context of a dynamic library,
* because they are not guaranteed to remain stable in the future.
* Only consider them in association with static linking.
- *******************************************************************/
+ * *****************************************************************/
#if defined(HUF_STATIC_LINKING_ONLY) && !defined(HUF_H_HUF_STATIC_LINKING_ONLY)
#define HUF_H_HUF_STATIC_LINKING_ONLY
@@ -141,11 +134,11 @@ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, const
/* *** Constants *** */
-#define HUF_TABLELOG_MAX 12 /* max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */
-#define HUF_TABLELOG_DEFAULT 11 /* tableLog by default, when not specified */
+#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */
+#define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */
#define HUF_SYMBOLVALUE_MAX 255
-#define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
+#define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
#if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX)
# error "HUF_TABLELOG_MAX is too large !"
#endif
@@ -192,24 +185,23 @@ size_t HUF_decompress4X4_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
/* ****************************************
-* HUF detailed API
-******************************************/
-/*!
-HUF_compress() does the following:
-1. count symbol occurrence from source[] into table count[] using FSE_count()
-2. (optional) refine tableLog using HUF_optimalTableLog()
-3. build Huffman table from count using HUF_buildCTable()
-4. save Huffman table to memory buffer using HUF_writeCTable()
-5. encode the data stream using HUF_compress4X_usingCTable()
-
-The following API allows targeting specific sub-functions for advanced tasks.
-For example, it's possible to compress several blocks using the same 'CTable',
-or to save and regenerate 'CTable' using external methods.
-*/
-/* FSE_count() : find it within "fse.h" */
+ * HUF detailed API
+ * ****************************************/
+
+/*! HUF_compress() does the following:
+ * 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h")
+ * 2. (optional) refine tableLog using HUF_optimalTableLog()
+ * 3. build Huffman table from count using HUF_buildCTable()
+ * 4. save Huffman table to memory buffer using HUF_writeCTable()
+ * 5. encode the data stream using HUF_compress4X_usingCTable()
+ *
+ * The following API allows targeting specific sub-functions for advanced tasks.
+ * For example, it's possible to compress several blocks using the same 'CTable',
+ * or to save and regenerate 'CTable' using external methods.
+ */
unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
typedef struct HUF_CElt_s HUF_CElt; /* incomplete type */
-size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits);
+size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits); /* @return : maxNbBits; CTable and count can overlap. In which case, CTable will overwrite count content */
size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog);
size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
@@ -219,46 +211,65 @@ typedef enum {
HUF_repeat_valid /**< Can use the previous table and it is asumed to be valid */
} HUF_repeat;
/** HUF_compress4X_repeat() :
-* Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
-* If it uses hufTable it does not modify hufTable or repeat.
-* If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
-* If preferRepeat then the old table will always be used if valid. */
-size_t HUF_compress4X_repeat(void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize, HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat); /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
+ * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
+ * If it uses hufTable it does not modify hufTable or repeat.
+ * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
+ * If preferRepeat then the old table will always be used if valid. */
+size_t HUF_compress4X_repeat(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ unsigned maxSymbolValue, unsigned tableLog,
+ void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2);
/** HUF_buildCTable_wksp() :
* Same as HUF_buildCTable(), but using externally allocated scratch buffer.
- * `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of 1024 unsigned.
+ * `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE.
*/
+#define HUF_CTABLE_WORKSPACE_SIZE_U32 (2*HUF_SYMBOLVALUE_MAX +1 +1)
+#define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned))
size_t HUF_buildCTable_wksp (HUF_CElt* tree, const U32* count, U32 maxSymbolValue, U32 maxNbBits, void* workSpace, size_t wkspSize);
/*! HUF_readStats() :
- Read compact Huffman tree, saved by HUF_writeCTable().
- `huffWeight` is destination buffer.
- @return : size read from `src` , or an error Code .
- Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */
-size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
- U32* nbSymbolsPtr, U32* tableLogPtr,
+ * Read compact Huffman tree, saved by HUF_writeCTable().
+ * `huffWeight` is destination buffer.
+ * @return : size read from `src` , or an error Code .
+ * Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */
+size_t HUF_readStats(BYTE* huffWeight, size_t hwSize,
+ U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize);
/** HUF_readCTable() :
-* Loading a CTable saved with HUF_writeCTable() */
+ * Loading a CTable saved with HUF_writeCTable() */
size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize);
/*
-HUF_decompress() does the following:
-1. select the decompression algorithm (X2, X4) based on pre-computed heuristics
-2. build Huffman table from save, using HUF_readDTableXn()
-3. decode 1 or 4 segments in parallel using HUF_decompressSXn_usingDTable
-*/
+ * HUF_decompress() does the following:
+ * 1. select the decompression algorithm (X2, X4) based on pre-computed heuristics
+ * 2. build Huffman table from save, using HUF_readDTableX?()
+ * 3. decode 1 or 4 segments in parallel using HUF_decompress?X?_usingDTable()
+ */
/** HUF_selectDecoder() :
-* Tells which decoder is likely to decode faster,
-* based on a set of pre-determined metrics.
-* @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
-* Assumption : 0 < cSrcSize < dstSize <= 128 KB */
+ * Tells which decoder is likely to decode faster,
+ * based on a set of pre-computed metrics.
+ * @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
+ * Assumption : 0 < dstSize <= 128 KB */
U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize);
+/**
+ * The minimum workspace size for the `workSpace` used in
+ * HUF_readDTableX2_wksp() and HUF_readDTableX4_wksp().
+ *
+ * The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when
+ * HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15.
+ * Buffer overflow errors may potentially occur if code modifications result in
+ * a required workspace size greater than that specified in the following
+ * macro.
+ */
+#define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10)
+#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
+
size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize);
size_t HUF_readDTableX2_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize);
size_t HUF_readDTableX4 (HUF_DTable* DTable, const void* src, size_t srcSize);
@@ -269,17 +280,23 @@ size_t HUF_decompress4X2_usingDTable(void* dst, size_t maxDstSize, const void* c
size_t HUF_decompress4X4_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
+/* ====================== */
/* single stream variants */
+/* ====================== */
size_t HUF_compress1X (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog);
size_t HUF_compress1X_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
/** HUF_compress1X_repeat() :
-* Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
-* If it uses hufTable it does not modify hufTable or repeat.
-* If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
-* If preferRepeat then the old table will always be used if valid. */
-size_t HUF_compress1X_repeat(void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize, HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat); /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
+ * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
+ * If it uses hufTable it does not modify hufTable or repeat.
+ * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
+ * If preferRepeat then the old table will always be used if valid. */
+size_t HUF_compress1X_repeat(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ unsigned maxSymbolValue, unsigned tableLog,
+ void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2);
size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* single-symbol decoder */
size_t HUF_decompress1X4 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* double-symbol decoder */
@@ -295,6 +312,14 @@ size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cS
size_t HUF_decompress1X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
size_t HUF_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable);
+/* BMI2 variants.
+ * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0.
+ */
+size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2);
+size_t HUF_decompress1X2_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2);
+size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2);
+size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2);
+
#endif /* HUF_STATIC_LINKING_ONLY */
#if defined (__cplusplus)
diff --git a/thirdparty/zstd/common/pool.c b/thirdparty/zstd/common/pool.c
index 98b109e72a..773488b072 100644
--- a/thirdparty/zstd/common/pool.c
+++ b/thirdparty/zstd/common/pool.c
@@ -12,6 +12,7 @@
/* ====== Dependencies ======= */
#include <stddef.h> /* size_t */
#include "pool.h"
+#include "zstd_internal.h" /* ZSTD_malloc, ZSTD_free */
/* ====== Compiler specifics ====== */
#if defined(_MSC_VER)
@@ -193,32 +194,54 @@ static int isQueueFull(POOL_ctx const* ctx) {
}
}
-void POOL_add(void* ctxVoid, POOL_function function, void *opaque) {
- POOL_ctx* const ctx = (POOL_ctx*)ctxVoid;
- if (!ctx) { return; }
+static void POOL_add_internal(POOL_ctx* ctx, POOL_function function, void *opaque)
+{
+ POOL_job const job = {function, opaque};
+ assert(ctx != NULL);
+ if (ctx->shutdown) return;
+
+ ctx->queueEmpty = 0;
+ ctx->queue[ctx->queueTail] = job;
+ ctx->queueTail = (ctx->queueTail + 1) % ctx->queueSize;
+ ZSTD_pthread_cond_signal(&ctx->queuePopCond);
+}
+
+void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque)
+{
+ assert(ctx != NULL);
ZSTD_pthread_mutex_lock(&ctx->queueMutex);
- { POOL_job const job = {function, opaque};
+ /* Wait until there is space in the queue for the new job */
+ while (isQueueFull(ctx) && (!ctx->shutdown)) {
+ ZSTD_pthread_cond_wait(&ctx->queuePushCond, &ctx->queueMutex);
+ }
+ POOL_add_internal(ctx, function, opaque);
+ ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
+}
- /* Wait until there is space in the queue for the new job */
- while (isQueueFull(ctx) && !ctx->shutdown) {
- ZSTD_pthread_cond_wait(&ctx->queuePushCond, &ctx->queueMutex);
- }
- /* The queue is still going => there is space */
- if (!ctx->shutdown) {
- ctx->queueEmpty = 0;
- ctx->queue[ctx->queueTail] = job;
- ctx->queueTail = (ctx->queueTail + 1) % ctx->queueSize;
- }
+
+int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque)
+{
+ assert(ctx != NULL);
+ ZSTD_pthread_mutex_lock(&ctx->queueMutex);
+ if (isQueueFull(ctx)) {
+ ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
+ return 0;
}
+ POOL_add_internal(ctx, function, opaque);
ZSTD_pthread_mutex_unlock(&ctx->queueMutex);
- ZSTD_pthread_cond_signal(&ctx->queuePopCond);
+ return 1;
}
+
#else /* ZSTD_MULTITHREAD not defined */
+
+/* ========================== */
/* No multi-threading support */
+/* ========================== */
-/* We don't need any data, but if it is empty malloc() might return NULL. */
+
+/* We don't need any data, but if it is empty, malloc() might return NULL. */
struct POOL_ctx_s {
int dummy;
};
@@ -240,9 +263,15 @@ void POOL_free(POOL_ctx* ctx) {
(void)ctx;
}
-void POOL_add(void* ctx, POOL_function function, void* opaque) {
+void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque) {
+ (void)ctx;
+ function(opaque);
+}
+
+int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque) {
(void)ctx;
function(opaque);
+ return 1;
}
size_t POOL_sizeof(POOL_ctx* ctx) {
diff --git a/thirdparty/zstd/common/pool.h b/thirdparty/zstd/common/pool.h
index 08c63715aa..a57e9b4fab 100644
--- a/thirdparty/zstd/common/pool.h
+++ b/thirdparty/zstd/common/pool.h
@@ -17,7 +17,8 @@ extern "C" {
#include <stddef.h> /* size_t */
-#include "zstd_internal.h" /* ZSTD_customMem */
+#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */
+#include "zstd.h"
typedef struct POOL_ctx_s POOL_ctx;
@@ -27,35 +28,43 @@ typedef struct POOL_ctx_s POOL_ctx;
* The maximum number of queued jobs before blocking is `queueSize`.
* @return : POOL_ctx pointer on success, else NULL.
*/
-POOL_ctx *POOL_create(size_t numThreads, size_t queueSize);
+POOL_ctx* POOL_create(size_t numThreads, size_t queueSize);
-POOL_ctx *POOL_create_advanced(size_t numThreads, size_t queueSize, ZSTD_customMem customMem);
+POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, ZSTD_customMem customMem);
/*! POOL_free() :
Free a thread pool returned by POOL_create().
*/
-void POOL_free(POOL_ctx *ctx);
+void POOL_free(POOL_ctx* ctx);
/*! POOL_sizeof() :
return memory usage of pool returned by POOL_create().
*/
-size_t POOL_sizeof(POOL_ctx *ctx);
+size_t POOL_sizeof(POOL_ctx* ctx);
/*! POOL_function :
The function type that can be added to a thread pool.
*/
-typedef void (*POOL_function)(void *);
+typedef void (*POOL_function)(void*);
/*! POOL_add_function :
The function type for a generic thread pool add function.
*/
-typedef void (*POOL_add_function)(void *, POOL_function, void *);
+typedef void (*POOL_add_function)(void*, POOL_function, void*);
/*! POOL_add() :
- Add the job `function(opaque)` to the thread pool.
+ Add the job `function(opaque)` to the thread pool. `ctx` must be valid.
Possibly blocks until there is room in the queue.
Note : The function may be executed asynchronously, so `opaque` must live until the function has been completed.
*/
-void POOL_add(void *ctx, POOL_function function, void *opaque);
+void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque);
+
+
+/*! POOL_tryAdd() :
+ Add the job `function(opaque)` to the thread pool if a worker is available.
+ return immediately otherwise.
+ @return : 1 if successful, 0 if not.
+*/
+int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque);
#if defined (__cplusplus)
diff --git a/thirdparty/zstd/common/threading.h b/thirdparty/zstd/common/threading.h
index 197770db27..d806c89d01 100644
--- a/thirdparty/zstd/common/threading.h
+++ b/thirdparty/zstd/common/threading.h
@@ -45,15 +45,15 @@ extern "C" {
/* mutex */
#define ZSTD_pthread_mutex_t CRITICAL_SECTION
-#define ZSTD_pthread_mutex_init(a, b) (InitializeCriticalSection((a)), 0)
+#define ZSTD_pthread_mutex_init(a, b) ((void)(b), InitializeCriticalSection((a)), 0)
#define ZSTD_pthread_mutex_destroy(a) DeleteCriticalSection((a))
#define ZSTD_pthread_mutex_lock(a) EnterCriticalSection((a))
#define ZSTD_pthread_mutex_unlock(a) LeaveCriticalSection((a))
/* condition variable */
#define ZSTD_pthread_cond_t CONDITION_VARIABLE
-#define ZSTD_pthread_cond_init(a, b) (InitializeConditionVariable((a)), 0)
-#define ZSTD_pthread_cond_destroy(a) /* No delete */
+#define ZSTD_pthread_cond_init(a, b) ((void)(b), InitializeConditionVariable((a)), 0)
+#define ZSTD_pthread_cond_destroy(a) ((void)(a))
#define ZSTD_pthread_cond_wait(a, b) SleepConditionVariableCS((a), (b), INFINITE)
#define ZSTD_pthread_cond_signal(a) WakeConditionVariable((a))
#define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a))
@@ -100,17 +100,17 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr);
/* No multithreading support */
typedef int ZSTD_pthread_mutex_t;
-#define ZSTD_pthread_mutex_init(a, b) ((void)a, 0)
-#define ZSTD_pthread_mutex_destroy(a)
-#define ZSTD_pthread_mutex_lock(a)
-#define ZSTD_pthread_mutex_unlock(a)
+#define ZSTD_pthread_mutex_init(a, b) ((void)(a), (void)(b), 0)
+#define ZSTD_pthread_mutex_destroy(a) ((void)(a))
+#define ZSTD_pthread_mutex_lock(a) ((void)(a))
+#define ZSTD_pthread_mutex_unlock(a) ((void)(a))
typedef int ZSTD_pthread_cond_t;
-#define ZSTD_pthread_cond_init(a, b) ((void)a, 0)
-#define ZSTD_pthread_cond_destroy(a)
-#define ZSTD_pthread_cond_wait(a, b)
-#define ZSTD_pthread_cond_signal(a)
-#define ZSTD_pthread_cond_broadcast(a)
+#define ZSTD_pthread_cond_init(a, b) ((void)(a), (void)(b), 0)
+#define ZSTD_pthread_cond_destroy(a) ((void)(a))
+#define ZSTD_pthread_cond_wait(a, b) ((void)(a), (void)(b))
+#define ZSTD_pthread_cond_signal(a) ((void)(a))
+#define ZSTD_pthread_cond_broadcast(a) ((void)(a))
/* do not use ZSTD_pthread_t */
diff --git a/thirdparty/zstd/common/zstd_errors.h b/thirdparty/zstd/common/zstd_errors.h
index 4bcb7769fe..57533f2869 100644
--- a/thirdparty/zstd/common/zstd_errors.h
+++ b/thirdparty/zstd/common/zstd_errors.h
@@ -35,12 +35,20 @@ extern "C" {
# define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY
#endif
-/*-****************************************
- * error codes list
- * note : this API is still considered unstable
- * and shall not be used with a dynamic library.
- * only static linking is allowed
- ******************************************/
+/*-*********************************************
+ * Error codes list
+ *-*********************************************
+ * Error codes _values_ are pinned down since v1.3.1 only.
+ * Therefore, don't rely on values if you may link to any version < v1.3.1.
+ *
+ * Only values < 100 are considered stable.
+ *
+ * note 1 : this API shall be used with static linking only.
+ * dynamic linking is not yet officially supported.
+ * note 2 : Prefer relying on the enum than on its value whenever possible
+ * This is the only supported way to use the error list < v1.3.1
+ * note 3 : ZSTD_isError() is always correct, whatever the library version.
+ **********************************************/
typedef enum {
ZSTD_error_no_error = 0,
ZSTD_error_GENERIC = 1,
@@ -61,9 +69,10 @@ typedef enum {
ZSTD_error_stage_wrong = 60,
ZSTD_error_init_missing = 62,
ZSTD_error_memory_allocation = 64,
+ ZSTD_error_workSpace_tooSmall= 66,
ZSTD_error_dstSize_tooSmall = 70,
ZSTD_error_srcSize_wrong = 72,
- /* following error codes are not stable and may be removed or changed in a future version */
+ /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */
ZSTD_error_frameIndex_tooLarge = 100,
ZSTD_error_seekableIO = 102,
ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */
diff --git a/thirdparty/zstd/common/zstd_internal.h b/thirdparty/zstd/common/zstd_internal.h
index 5d2900eb76..65c08a8257 100644
--- a/thirdparty/zstd/common/zstd_internal.h
+++ b/thirdparty/zstd/common/zstd_internal.h
@@ -132,14 +132,15 @@ typedef enum { set_basic, set_rle, set_compressed, set_repeat } symbolEncodingTy
#define Litbits 8
#define MaxLit ((1<<Litbits) - 1)
-#define MaxML 52
-#define MaxLL 35
+#define MaxML 52
+#define MaxLL 35
#define DefaultMaxOff 28
-#define MaxOff 31
+#define MaxOff 31
#define MaxSeq MAX(MaxLL, MaxML) /* Assumption : MaxOff < MaxLL,MaxML */
#define MLFSELog 9
#define LLFSELog 9
#define OffFSELog 8
+#define MaxFSELog MAX(MAX(MLFSELog, LLFSELog), OffFSELog)
static const U32 LL_bits[MaxLL+1] = { 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -228,8 +229,6 @@ typedef struct {
BYTE* ofCode;
U32 longLengthID; /* 0 == no longLength; 1 == Lit.longLength; 2 == Match.longLength; */
U32 longLengthPos;
- U32 rep[ZSTD_REP_NUM];
- U32 repToConfirm[ZSTD_REP_NUM];
} seqStore_t;
const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */
diff --git a/thirdparty/zstd/compress/fse_compress.c b/thirdparty/zstd/compress/fse_compress.c
index 549c115d42..cb8f1fa323 100644
--- a/thirdparty/zstd/compress/fse_compress.c
+++ b/thirdparty/zstd/compress/fse_compress.c
@@ -248,7 +248,7 @@ static size_t FSE_writeNCount_generic (void* header, size_t headerBufferSize,
bitCount -= (count<max);
previous0 = (count==1);
if (remaining<1) return ERROR(GENERIC);
- while (remaining<threshold) nbBits--, threshold>>=1;
+ while (remaining<threshold) { nbBits--; threshold>>=1; }
}
if (bitCount>16) {
if ((!writeIsSafe) && (out > oend - 2)) return ERROR(dstSize_tooSmall); /* Buffer overflow */
@@ -292,7 +292,7 @@ size_t FSE_writeNCount (void* buffer, size_t bufferSize, const short* normalized
It doesn't use any additional memory.
But this function is unsafe : it doesn't check that all values within `src` can fit into `count`.
For this reason, prefer using a table `count` with 256 elements.
- @return : count of most numerous element
+ @return : count of most numerous element.
*/
size_t FSE_count_simple(unsigned* count, unsigned* maxSymbolValuePtr,
const void* src, size_t srcSize)
@@ -305,7 +305,10 @@ size_t FSE_count_simple(unsigned* count, unsigned* maxSymbolValuePtr,
memset(count, 0, (maxSymbolValue+1)*sizeof(*count));
if (srcSize==0) { *maxSymbolValuePtr = 0; return 0; }
- while (ip<end) count[*ip++]++;
+ while (ip<end) {
+ assert(*ip <= maxSymbolValue);
+ count[*ip++]++;
+ }
while (!count[maxSymbolValue]) maxSymbolValue--;
*maxSymbolValuePtr = maxSymbolValue;
@@ -318,7 +321,8 @@ size_t FSE_count_simple(unsigned* count, unsigned* maxSymbolValuePtr,
/* FSE_count_parallel_wksp() :
* Same as FSE_count_parallel(), but using an externally provided scratch buffer.
- * `workSpace` size must be a minimum of `1024 * sizeof(unsigned)`` */
+ * `workSpace` size must be a minimum of `1024 * sizeof(unsigned)`.
+ * @return : largest histogram frequency, or an error code (notably when histogram would be larger than *maxSymbolValuePtr). */
static size_t FSE_count_parallel_wksp(
unsigned* count, unsigned* maxSymbolValuePtr,
const void* source, size_t sourceSize,
@@ -333,7 +337,7 @@ static size_t FSE_count_parallel_wksp(
U32* const Counting3 = Counting2 + 256;
U32* const Counting4 = Counting3 + 256;
- memset(Counting1, 0, 4*256*sizeof(unsigned));
+ memset(workSpace, 0, 4*256*sizeof(unsigned));
/* safety checks */
if (!sourceSize) {
@@ -379,7 +383,9 @@ static size_t FSE_count_parallel_wksp(
if (Counting1[s]) return ERROR(maxSymbolValue_tooSmall);
} }
- { U32 s; for (s=0; s<=maxSymbolValue; s++) {
+ { U32 s;
+ if (maxSymbolValue > 255) maxSymbolValue = 255;
+ for (s=0; s<=maxSymbolValue; s++) {
count[s] = Counting1[s] + Counting2[s] + Counting3[s] + Counting4[s];
if (count[s] > max) max = count[s];
} }
@@ -393,9 +399,11 @@ static size_t FSE_count_parallel_wksp(
* Same as FSE_countFast(), but using an externally provided scratch buffer.
* `workSpace` size must be table of >= `1024` unsigned */
size_t FSE_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr,
- const void* source, size_t sourceSize, unsigned* workSpace)
+ const void* source, size_t sourceSize,
+ unsigned* workSpace)
{
- if (sourceSize < 1500) return FSE_count_simple(count, maxSymbolValuePtr, source, sourceSize);
+ if (sourceSize < 1500) /* heuristic threshold */
+ return FSE_count_simple(count, maxSymbolValuePtr, source, sourceSize);
return FSE_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, 0, workSpace);
}
@@ -540,7 +548,7 @@ static size_t FSE_normalizeM2(short* norm, U32 tableLog, const unsigned* count,
find max, then give all remaining points to max */
U32 maxV = 0, maxC = 0;
for (s=0; s<=maxSymbolValue; s++)
- if (count[s] > maxC) maxV=s, maxC=count[s];
+ if (count[s] > maxC) { maxV=s; maxC=count[s]; }
norm[maxV] += (short)ToDistribute;
return 0;
}
@@ -548,7 +556,7 @@ static size_t FSE_normalizeM2(short* norm, U32 tableLog, const unsigned* count,
if (total == 0) {
/* all of the symbols were low enough for the lowOne or lowThreshold */
for (s=0; ToDistribute > 0; s = (s+1)%(maxSymbolValue+1))
- if (norm[s] > 0) ToDistribute--, norm[s]++;
+ if (norm[s] > 0) { ToDistribute--; norm[s]++; }
return 0;
}
@@ -604,7 +612,7 @@ size_t FSE_normalizeCount (short* normalizedCounter, unsigned tableLog,
U64 restToBeat = vStep * rtbTable[proba];
proba += (count[s]*step) - ((U64)proba<<scale) > restToBeat;
}
- if (proba > largestP) largestP=proba, largest=s;
+ if (proba > largestP) { largestP=proba; largest=s; }
normalizedCounter[s] = proba;
stillToDistribute -= proba;
} }
diff --git a/thirdparty/zstd/compress/huf_compress.c b/thirdparty/zstd/compress/huf_compress.c
index 5692d56e00..83230b415f 100644
--- a/thirdparty/zstd/compress/huf_compress.c
+++ b/thirdparty/zstd/compress/huf_compress.c
@@ -46,6 +46,7 @@
#include <string.h> /* memcpy, memset */
#include <stdio.h> /* printf (debug) */
#include "bitstream.h"
+#include "compiler.h"
#define FSE_STATIC_LINKING_ONLY /* FSE_optimalTableLog_internal */
#include "fse.h" /* header compression */
#define HUF_STATIC_LINKING_ONLY
@@ -322,7 +323,10 @@ static void HUF_sort(nodeElt* huffNode, const U32* count, U32 maxSymbolValue)
U32 const c = count[n];
U32 const r = BIT_highbit32(c+1) + 1;
U32 pos = rank[r].current++;
- while ((pos > rank[r].base) && (c > huffNode[pos-1].count)) huffNode[pos]=huffNode[pos-1], pos--;
+ while ((pos > rank[r].base) && (c > huffNode[pos-1].count)) {
+ huffNode[pos] = huffNode[pos-1];
+ pos--;
+ }
huffNode[pos].count = c;
huffNode[pos].byte = (BYTE)n;
}
@@ -331,10 +335,10 @@ static void HUF_sort(nodeElt* huffNode, const U32* count, U32 maxSymbolValue)
/** HUF_buildCTable_wksp() :
* Same as HUF_buildCTable(), but using externally allocated scratch buffer.
- * `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of 1024 unsigned.
+ * `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of HUF_CTABLE_WORKSPACE_SIZE_U32 unsigned.
*/
#define STARTNODE (HUF_SYMBOLVALUE_MAX+1)
-typedef nodeElt huffNodeTable[2*HUF_SYMBOLVALUE_MAX+1 +1];
+typedef nodeElt huffNodeTable[HUF_CTABLE_WORKSPACE_SIZE_U32];
size_t HUF_buildCTable_wksp (HUF_CElt* tree, const U32* count, U32 maxSymbolValue, U32 maxNbBits, void* workSpace, size_t wkspSize)
{
nodeElt* const huffNode0 = (nodeElt*)workSpace;
@@ -345,9 +349,10 @@ size_t HUF_buildCTable_wksp (HUF_CElt* tree, const U32* count, U32 maxSymbolValu
U32 nodeRoot;
/* safety checks */
- if (wkspSize < sizeof(huffNodeTable)) return ERROR(GENERIC); /* workSpace is not large enough */
+ if (((size_t)workSpace & 3) != 0) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */
+ if (wkspSize < sizeof(huffNodeTable)) return ERROR(workSpace_tooSmall);
if (maxNbBits == 0) maxNbBits = HUF_TABLELOG_DEFAULT;
- if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(GENERIC);
+ if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge);
memset(huffNode0, 0, sizeof(huffNodeTable));
/* sort, decreasing order */
@@ -405,6 +410,7 @@ size_t HUF_buildCTable_wksp (HUF_CElt* tree, const U32* count, U32 maxSymbolValu
}
/** HUF_buildCTable() :
+ * @return : maxNbBits
* Note : count is used before tree is written, so they can safely overlap
*/
size_t HUF_buildCTable (HUF_CElt* tree, const U32* count, U32 maxSymbolValue, U32 maxNbBits)
@@ -432,13 +438,14 @@ static int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, uns
return !bad;
}
-static void HUF_encodeSymbol(BIT_CStream_t* bitCPtr, U32 symbol, const HUF_CElt* CTable)
+size_t HUF_compressBound(size_t size) { return HUF_COMPRESSBOUND(size); }
+
+FORCE_INLINE_TEMPLATE void
+HUF_encodeSymbol(BIT_CStream_t* bitCPtr, U32 symbol, const HUF_CElt* CTable)
{
BIT_addBitsFast(bitCPtr, CTable[symbol].val, CTable[symbol].nbBits);
}
-size_t HUF_compressBound(size_t size) { return HUF_COMPRESSBOUND(size); }
-
#define HUF_FLUSHBITS(s) BIT_flushBits(s)
#define HUF_FLUSHBITS_1(stream) \
@@ -447,7 +454,10 @@ size_t HUF_compressBound(size_t size) { return HUF_COMPRESSBOUND(size); }
#define HUF_FLUSHBITS_2(stream) \
if (sizeof((stream)->bitContainer)*8 < HUF_TABLELOG_MAX*4+7) HUF_FLUSHBITS(stream)
-size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable)
+FORCE_INLINE_TEMPLATE size_t
+HUF_compress1X_usingCTable_internal_body(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ const HUF_CElt* CTable)
{
const BYTE* ip = (const BYTE*) src;
BYTE* const ostart = (BYTE*)dst;
@@ -491,8 +501,58 @@ size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, si
return BIT_closeCStream(&bitC);
}
+#if DYNAMIC_BMI2
-size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable)
+static TARGET_ATTRIBUTE("bmi2") size_t
+HUF_compress1X_usingCTable_internal_bmi2(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ const HUF_CElt* CTable)
+{
+ return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable);
+}
+
+static size_t
+HUF_compress1X_usingCTable_internal_default(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ const HUF_CElt* CTable)
+{
+ return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable);
+}
+
+static size_t
+HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ const HUF_CElt* CTable, const int bmi2)
+{
+ if (bmi2) {
+ return HUF_compress1X_usingCTable_internal_bmi2(dst, dstSize, src, srcSize, CTable);
+ }
+ return HUF_compress1X_usingCTable_internal_default(dst, dstSize, src, srcSize, CTable);
+}
+
+#else
+
+static size_t
+HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ const HUF_CElt* CTable, const int bmi2)
+{
+ (void)bmi2;
+ return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable);
+}
+
+#endif
+
+size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable)
+{
+ return HUF_compress1X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, /* bmi2 */ 0);
+}
+
+
+static size_t
+HUF_compress4X_usingCTable_internal(void* dst, size_t dstSize,
+ const void* src, size_t srcSize,
+ const HUF_CElt* CTable, int bmi2)
{
size_t const segmentSize = (srcSize+3)/4; /* first 3 segments */
const BYTE* ip = (const BYTE*) src;
@@ -505,28 +565,31 @@ size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, si
if (srcSize < 12) return 0; /* no saving possible : too small input */
op += 6; /* jumpTable */
- { CHECK_V_F(cSize, HUF_compress1X_usingCTable(op, oend-op, ip, segmentSize, CTable) );
+ { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, segmentSize, CTable, bmi2) );
if (cSize==0) return 0;
+ assert(cSize <= 65535);
MEM_writeLE16(ostart, (U16)cSize);
op += cSize;
}
ip += segmentSize;
- { CHECK_V_F(cSize, HUF_compress1X_usingCTable(op, oend-op, ip, segmentSize, CTable) );
+ { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, segmentSize, CTable, bmi2) );
if (cSize==0) return 0;
+ assert(cSize <= 65535);
MEM_writeLE16(ostart+2, (U16)cSize);
op += cSize;
}
ip += segmentSize;
- { CHECK_V_F(cSize, HUF_compress1X_usingCTable(op, oend-op, ip, segmentSize, CTable) );
+ { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, segmentSize, CTable, bmi2) );
if (cSize==0) return 0;
+ assert(cSize <= 65535);
MEM_writeLE16(ostart+4, (U16)cSize);
op += cSize;
}
ip += segmentSize;
- { CHECK_V_F(cSize, HUF_compress1X_usingCTable(op, oend-op, ip, iend-ip, CTable) );
+ { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, iend-ip, CTable, bmi2) );
if (cSize==0) return 0;
op += cSize;
}
@@ -534,15 +597,20 @@ size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, si
return op-ostart;
}
+size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable)
+{
+ return HUF_compress4X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, /* bmi2 */ 0);
+}
+
static size_t HUF_compressCTable_internal(
BYTE* const ostart, BYTE* op, BYTE* const oend,
const void* src, size_t srcSize,
- unsigned singleStream, const HUF_CElt* CTable)
+ unsigned singleStream, const HUF_CElt* CTable, const int bmi2)
{
size_t const cSize = singleStream ?
- HUF_compress1X_usingCTable(op, oend - op, src, srcSize, CTable) :
- HUF_compress4X_usingCTable(op, oend - op, src, srcSize, CTable);
+ HUF_compress1X_usingCTable_internal(op, oend - op, src, srcSize, CTable, bmi2) :
+ HUF_compress4X_usingCTable_internal(op, oend - op, src, srcSize, CTable, bmi2);
if (HUF_isError(cSize)) { return cSize; }
if (cSize==0) { return 0; } /* uncompressible */
op += cSize;
@@ -551,86 +619,98 @@ static size_t HUF_compressCTable_internal(
return op-ostart;
}
+typedef struct {
+ U32 count[HUF_SYMBOLVALUE_MAX + 1];
+ HUF_CElt CTable[HUF_SYMBOLVALUE_MAX + 1];
+ huffNodeTable nodeTable;
+} HUF_compress_tables_t;
-/* `workSpace` must a table of at least 1024 unsigned */
+/* HUF_compress_internal() :
+ * `workSpace` must a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
static size_t HUF_compress_internal (
void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned huffLog,
unsigned singleStream,
void* workSpace, size_t wkspSize,
- HUF_CElt* oldHufTable, HUF_repeat* repeat, int preferRepeat)
+ HUF_CElt* oldHufTable, HUF_repeat* repeat, int preferRepeat,
+ const int bmi2)
{
+ HUF_compress_tables_t* const table = (HUF_compress_tables_t*)workSpace;
BYTE* const ostart = (BYTE*)dst;
BYTE* const oend = ostart + dstSize;
BYTE* op = ostart;
- U32* count;
- size_t const countSize = sizeof(U32) * (HUF_SYMBOLVALUE_MAX + 1);
- HUF_CElt* CTable;
- size_t const CTableSize = sizeof(HUF_CElt) * (HUF_SYMBOLVALUE_MAX + 1);
-
/* checks & inits */
- if (wkspSize < sizeof(huffNodeTable) + countSize + CTableSize) return ERROR(GENERIC);
- if (!srcSize) return 0; /* Uncompressed (note : 1 means rle, so first byte must be correct) */
- if (!dstSize) return 0; /* cannot fit within dst budget */
+ if (((size_t)workSpace & 3) != 0) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */
+ if (wkspSize < sizeof(*table)) return ERROR(workSpace_tooSmall);
+ if (!srcSize) return 0; /* Uncompressed */
+ if (!dstSize) return 0; /* cannot fit anything within dst budget */
if (srcSize > HUF_BLOCKSIZE_MAX) return ERROR(srcSize_wrong); /* current block size limit */
if (huffLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
+ if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge);
if (!maxSymbolValue) maxSymbolValue = HUF_SYMBOLVALUE_MAX;
if (!huffLog) huffLog = HUF_TABLELOG_DEFAULT;
- count = (U32*)workSpace;
- workSpace = (BYTE*)workSpace + countSize;
- wkspSize -= countSize;
- CTable = (HUF_CElt*)workSpace;
- workSpace = (BYTE*)workSpace + CTableSize;
- wkspSize -= CTableSize;
-
- /* Heuristic : If we don't need to check the validity of the old table use the old table for small inputs */
+ /* Heuristic : If old table is valid, use it for small inputs */
if (preferRepeat && repeat && *repeat == HUF_repeat_valid) {
- return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, singleStream, oldHufTable);
+ return HUF_compressCTable_internal(ostart, op, oend,
+ src, srcSize,
+ singleStream, oldHufTable, bmi2);
}
/* Scan input and build symbol stats */
- { CHECK_V_F(largest, FSE_count_wksp (count, &maxSymbolValue, (const BYTE*)src, srcSize, (U32*)workSpace) );
+ { CHECK_V_F(largest, FSE_count_wksp (table->count, &maxSymbolValue, (const BYTE*)src, srcSize, table->count) );
if (largest == srcSize) { *ostart = ((const BYTE*)src)[0]; return 1; } /* single symbol, rle */
- if (largest <= (srcSize >> 7)+1) return 0; /* Fast heuristic : not compressible enough */
+ if (largest <= (srcSize >> 7)+1) return 0; /* heuristic : probably not compressible enough */
}
/* Check validity of previous table */
- if (repeat && *repeat == HUF_repeat_check && !HUF_validateCTable(oldHufTable, count, maxSymbolValue)) {
+ if ( repeat
+ && *repeat == HUF_repeat_check
+ && !HUF_validateCTable(oldHufTable, table->count, maxSymbolValue)) {
*repeat = HUF_repeat_none;
}
/* Heuristic : use existing table for small inputs */
if (preferRepeat && repeat && *repeat != HUF_repeat_none) {
- return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, singleStream, oldHufTable);
+ return HUF_compressCTable_internal(ostart, op, oend,
+ src, srcSize,
+ singleStream, oldHufTable, bmi2);
}
/* Build Huffman Tree */
huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue);
- { CHECK_V_F(maxBits, HUF_buildCTable_wksp (CTable, count, maxSymbolValue, huffLog, workSpace, wkspSize) );
+ { CHECK_V_F(maxBits, HUF_buildCTable_wksp(table->CTable, table->count,
+ maxSymbolValue, huffLog,
+ table->nodeTable, sizeof(table->nodeTable)) );
huffLog = (U32)maxBits;
- /* Zero the unused symbols so we can check it for validity */
- memset(CTable + maxSymbolValue + 1, 0, CTableSize - (maxSymbolValue + 1) * sizeof(HUF_CElt));
+ /* Zero unused symbols in CTable, so we can check it for validity */
+ memset(table->CTable + (maxSymbolValue + 1), 0,
+ sizeof(table->CTable) - ((maxSymbolValue + 1) * sizeof(HUF_CElt)));
}
/* Write table description header */
- { CHECK_V_F(hSize, HUF_writeCTable (op, dstSize, CTable, maxSymbolValue, huffLog) );
- /* Check if using the previous table will be beneficial */
+ { CHECK_V_F(hSize, HUF_writeCTable (op, dstSize, table->CTable, maxSymbolValue, huffLog) );
+ /* Check if using previous huffman table is beneficial */
if (repeat && *repeat != HUF_repeat_none) {
- size_t const oldSize = HUF_estimateCompressedSize(oldHufTable, count, maxSymbolValue);
- size_t const newSize = HUF_estimateCompressedSize(CTable, count, maxSymbolValue);
+ size_t const oldSize = HUF_estimateCompressedSize(oldHufTable, table->count, maxSymbolValue);
+ size_t const newSize = HUF_estimateCompressedSize(table->CTable, table->count, maxSymbolValue);
if (oldSize <= hSize + newSize || hSize + 12 >= srcSize) {
- return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, singleStream, oldHufTable);
- }
- }
- /* Use the new table */
+ return HUF_compressCTable_internal(ostart, op, oend,
+ src, srcSize,
+ singleStream, oldHufTable, bmi2);
+ } }
+
+ /* Use the new huffman table */
if (hSize + 12ul >= srcSize) { return 0; }
op += hSize;
if (repeat) { *repeat = HUF_repeat_none; }
- if (oldHufTable) { memcpy(oldHufTable, CTable, CTableSize); } /* Save the new table */
+ if (oldHufTable)
+ memcpy(oldHufTable, table->CTable, sizeof(table->CTable)); /* Save new table */
}
- return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, singleStream, CTable);
+ return HUF_compressCTable_internal(ostart, op, oend,
+ src, srcSize,
+ singleStream, table->CTable, bmi2);
}
@@ -639,52 +719,70 @@ size_t HUF_compress1X_wksp (void* dst, size_t dstSize,
unsigned maxSymbolValue, unsigned huffLog,
void* workSpace, size_t wkspSize)
{
- return HUF_compress_internal(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, 1 /* single stream */, workSpace, wkspSize, NULL, NULL, 0);
+ return HUF_compress_internal(dst, dstSize, src, srcSize,
+ maxSymbolValue, huffLog, 1 /*single stream*/,
+ workSpace, wkspSize,
+ NULL, NULL, 0, 0 /*bmi2*/);
}
size_t HUF_compress1X_repeat (void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned huffLog,
void* workSpace, size_t wkspSize,
- HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat)
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2)
{
- return HUF_compress_internal(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, 1 /* single stream */, workSpace, wkspSize, hufTable, repeat, preferRepeat);
+ return HUF_compress_internal(dst, dstSize, src, srcSize,
+ maxSymbolValue, huffLog, 1 /*single stream*/,
+ workSpace, wkspSize, hufTable,
+ repeat, preferRepeat, bmi2);
}
size_t HUF_compress1X (void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned huffLog)
{
- unsigned workSpace[1024];
+ unsigned workSpace[HUF_WORKSPACE_SIZE_U32];
return HUF_compress1X_wksp(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, workSpace, sizeof(workSpace));
}
+/* HUF_compress4X_repeat():
+ * compress input using 4 streams.
+ * provide workspace to generate compression tables */
size_t HUF_compress4X_wksp (void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned huffLog,
void* workSpace, size_t wkspSize)
{
- return HUF_compress_internal(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, 0 /* 4 streams */, workSpace, wkspSize, NULL, NULL, 0);
+ return HUF_compress_internal(dst, dstSize, src, srcSize,
+ maxSymbolValue, huffLog, 0 /*4 streams*/,
+ workSpace, wkspSize,
+ NULL, NULL, 0, 0 /*bmi2*/);
}
+/* HUF_compress4X_repeat():
+ * compress input using 4 streams.
+ * re-use an existing huffman compression table */
size_t HUF_compress4X_repeat (void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned huffLog,
void* workSpace, size_t wkspSize,
- HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat)
+ HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2)
{
- return HUF_compress_internal(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, 0 /* 4 streams */, workSpace, wkspSize, hufTable, repeat, preferRepeat);
+ return HUF_compress_internal(dst, dstSize, src, srcSize,
+ maxSymbolValue, huffLog, 0 /* 4 streams */,
+ workSpace, wkspSize,
+ hufTable, repeat, preferRepeat, bmi2);
}
size_t HUF_compress2 (void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned huffLog)
{
- unsigned workSpace[1024];
+ unsigned workSpace[HUF_WORKSPACE_SIZE_U32];
return HUF_compress4X_wksp(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, workSpace, sizeof(workSpace));
}
size_t HUF_compress (void* dst, size_t maxDstSize, const void* src, size_t srcSize)
{
- return HUF_compress2(dst, maxDstSize, src, (U32)srcSize, 255, HUF_TABLELOG_DEFAULT);
+ return HUF_compress2(dst, maxDstSize, src, srcSize, 255, HUF_TABLELOG_DEFAULT);
}
diff --git a/thirdparty/zstd/compress/zstd_compress.c b/thirdparty/zstd/compress/zstd_compress.c
index 8d1629246d..2aa26da4cd 100644
--- a/thirdparty/zstd/compress/zstd_compress.c
+++ b/thirdparty/zstd/compress/zstd_compress.c
@@ -21,6 +21,7 @@
* Dependencies
***************************************/
#include <string.h> /* memset */
+#include "cpu.h"
#include "mem.h"
#define FSE_STATIC_LINKING_ONLY /* FSE_encodeSymbol */
#include "fse.h"
@@ -49,7 +50,13 @@ struct ZSTD_CDict_s {
void* dictBuffer;
const void* dictContent;
size_t dictContentSize;
- ZSTD_CCtx* refContext;
+ void* workspace;
+ size_t workspaceSize;
+ ZSTD_matchState_t matchState;
+ ZSTD_compressedBlockState_t cBlockState;
+ ZSTD_compressionParameters cParams;
+ ZSTD_customMem customMem;
+ U32 dictID;
}; /* typedef'd to ZSTD_CDict within "zstd.h" */
ZSTD_CCtx* ZSTD_createCCtx(void)
@@ -59,18 +66,17 @@ ZSTD_CCtx* ZSTD_createCCtx(void)
ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
{
- ZSTD_CCtx* cctx;
-
- if (!customMem.customAlloc ^ !customMem.customFree) return NULL;
-
- cctx = (ZSTD_CCtx*) ZSTD_calloc(sizeof(ZSTD_CCtx), customMem);
- if (!cctx) return NULL;
- cctx->customMem = customMem;
- cctx->requestedParams.compressionLevel = ZSTD_CLEVEL_DEFAULT;
- cctx->requestedParams.fParams.contentSizeFlag = 1;
ZSTD_STATIC_ASSERT(zcss_init==0);
ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN==(0ULL - 1));
- return cctx;
+ if (!customMem.customAlloc ^ !customMem.customFree) return NULL;
+ { ZSTD_CCtx* const cctx = (ZSTD_CCtx*)ZSTD_calloc(sizeof(ZSTD_CCtx), customMem);
+ if (!cctx) return NULL;
+ cctx->customMem = customMem;
+ cctx->requestedParams.compressionLevel = ZSTD_CLEVEL_DEFAULT;
+ cctx->requestedParams.fParams.contentSizeFlag = 1;
+ cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid());
+ return cctx;
+ }
}
ZSTD_CCtx* ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize)
@@ -83,11 +89,16 @@ ZSTD_CCtx* ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize)
cctx->workSpace = (void*)(cctx+1);
cctx->workSpaceSize = workspaceSize - sizeof(ZSTD_CCtx);
- /* entropy space (never moves) */
- if (cctx->workSpaceSize < sizeof(ZSTD_entropyCTables_t)) return NULL;
+ /* statically sized space. entropyWorkspace never moves (but prev/next block swap places) */
+ if (cctx->workSpaceSize < HUF_WORKSPACE_SIZE + 2 * sizeof(ZSTD_compressedBlockState_t)) return NULL;
assert(((size_t)cctx->workSpace & (sizeof(void*)-1)) == 0); /* ensure correct alignment */
- cctx->entropy = (ZSTD_entropyCTables_t*)cctx->workSpace;
-
+ cctx->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)cctx->workSpace;
+ cctx->blockState.nextCBlock = cctx->blockState.prevCBlock + 1;
+ {
+ void* const ptr = cctx->blockState.nextCBlock + 1;
+ cctx->entropyWorkspace = (U32*)ptr;
+ }
+ cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid());
return cctx;
}
@@ -95,13 +106,10 @@ size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx)
{
if (cctx==NULL) return 0; /* support free on NULL */
if (cctx->staticSize) return ERROR(memory_allocation); /* not compatible with static CCtx */
- ZSTD_free(cctx->workSpace, cctx->customMem);
- cctx->workSpace = NULL;
- ZSTD_freeCDict(cctx->cdictLocal);
- cctx->cdictLocal = NULL;
+ ZSTD_free(cctx->workSpace, cctx->customMem); cctx->workSpace = NULL;
+ ZSTD_freeCDict(cctx->cdictLocal); cctx->cdictLocal = NULL;
#ifdef ZSTD_MULTITHREAD
- ZSTDMT_freeCCtx(cctx->mtctx);
- cctx->mtctx = NULL;
+ ZSTDMT_freeCCtx(cctx->mtctx); cctx->mtctx = NULL;
#endif
ZSTD_free(cctx, cctx->customMem);
return 0; /* reserved as a potential error code in the future */
@@ -122,10 +130,6 @@ static size_t ZSTD_sizeof_mtctx(const ZSTD_CCtx* cctx)
size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx)
{
if (cctx==NULL) return 0; /* support sizeof on NULL */
- DEBUGLOG(3, "sizeof(*cctx) : %u", (U32)sizeof(*cctx));
- DEBUGLOG(3, "workSpaceSize (including streaming buffers): %u", (U32)cctx->workSpaceSize);
- DEBUGLOG(3, "inner cdict : %u", (U32)ZSTD_sizeof_CDict(cctx->cdictLocal));
- DEBUGLOG(3, "inner MTCTX : %u", (U32)ZSTD_sizeof_mtctx(cctx));
return sizeof(*cctx) + cctx->workSpaceSize
+ ZSTD_sizeof_CDict(cctx->cdictLocal)
+ ZSTD_sizeof_mtctx(cctx);
@@ -139,37 +143,19 @@ size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs)
/* private API call, for dictBuilder only */
const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx) { return &(ctx->seqStore); }
-#define ZSTD_CLEVEL_CUSTOM 999
-
-static ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(
- ZSTD_CCtx_params CCtxParams, U64 srcSizeHint, size_t dictSize)
-{
- DEBUGLOG(4, "ZSTD_getCParamsFromCCtxParams: srcSize = %u, dictSize = %u",
- (U32)srcSizeHint, (U32)dictSize);
- return (CCtxParams.compressionLevel == ZSTD_CLEVEL_CUSTOM) ?
- CCtxParams.cParams :
- ZSTD_getCParams(CCtxParams.compressionLevel, srcSizeHint, dictSize);
-}
-
-static void ZSTD_cLevelToCCtxParams_srcSize(ZSTD_CCtx_params* CCtxParams, U64 srcSize)
-{
- DEBUGLOG(4, "ZSTD_cLevelToCCtxParams_srcSize: srcSize = %u",
- (U32)srcSize);
- CCtxParams->cParams = ZSTD_getCParamsFromCCtxParams(*CCtxParams, srcSize, 0);
- CCtxParams->compressionLevel = ZSTD_CLEVEL_CUSTOM;
-}
-
-static void ZSTD_cLevelToCParams(ZSTD_CCtx* cctx)
-{
- DEBUGLOG(4, "ZSTD_cLevelToCParams: level=%i", cctx->requestedParams.compressionLevel);
- ZSTD_cLevelToCCtxParams_srcSize(
- &cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1);
-}
-
-static void ZSTD_cLevelToCCtxParams(ZSTD_CCtx_params* CCtxParams)
-{
- DEBUGLOG(4, "ZSTD_cLevelToCCtxParams");
- ZSTD_cLevelToCCtxParams_srcSize(CCtxParams, ZSTD_CONTENTSIZE_UNKNOWN);
+ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(
+ const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize)
+{
+ ZSTD_compressionParameters cParams = ZSTD_getCParams(CCtxParams->compressionLevel, srcSizeHint, dictSize);
+ if (CCtxParams->ldmParams.enableLdm) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG;
+ if (CCtxParams->cParams.windowLog) cParams.windowLog = CCtxParams->cParams.windowLog;
+ if (CCtxParams->cParams.hashLog) cParams.hashLog = CCtxParams->cParams.hashLog;
+ if (CCtxParams->cParams.chainLog) cParams.chainLog = CCtxParams->cParams.chainLog;
+ if (CCtxParams->cParams.searchLog) cParams.searchLog = CCtxParams->cParams.searchLog;
+ if (CCtxParams->cParams.searchLength) cParams.searchLength = CCtxParams->cParams.searchLength;
+ if (CCtxParams->cParams.targetLength) cParams.targetLength = CCtxParams->cParams.targetLength;
+ if (CCtxParams->cParams.strategy) cParams.strategy = CCtxParams->cParams.strategy;
+ return cParams;
}
static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams(
@@ -178,7 +164,9 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams(
ZSTD_CCtx_params cctxParams;
memset(&cctxParams, 0, sizeof(cctxParams));
cctxParams.cParams = cParams;
- cctxParams.compressionLevel = ZSTD_CLEVEL_CUSTOM;
+ cctxParams.compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */
+ assert(!ZSTD_checkCParams(cParams));
+ cctxParams.fParams.contentSizeFlag = 1;
return cctxParams;
}
@@ -192,6 +180,7 @@ static ZSTD_CCtx_params* ZSTD_createCCtxParams_advanced(
if (!params) { return NULL; }
params->customMem = customMem;
params->compressionLevel = ZSTD_CLEVEL_DEFAULT;
+ params->fParams.contentSizeFlag = 1;
return params;
}
@@ -207,36 +196,41 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params)
return 0;
}
-size_t ZSTD_resetCCtxParams(ZSTD_CCtx_params* params)
+size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params)
{
- return ZSTD_initCCtxParams(params, ZSTD_CLEVEL_DEFAULT);
+ return ZSTD_CCtxParams_init(params, ZSTD_CLEVEL_DEFAULT);
}
-size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* cctxParams, int compressionLevel) {
+size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel) {
if (!cctxParams) { return ERROR(GENERIC); }
memset(cctxParams, 0, sizeof(*cctxParams));
cctxParams->compressionLevel = compressionLevel;
+ cctxParams->fParams.contentSizeFlag = 1;
return 0;
}
-size_t ZSTD_initCCtxParams_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params)
+size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params)
{
if (!cctxParams) { return ERROR(GENERIC); }
CHECK_F( ZSTD_checkCParams(params.cParams) );
memset(cctxParams, 0, sizeof(*cctxParams));
cctxParams->cParams = params.cParams;
cctxParams->fParams = params.fParams;
- cctxParams->compressionLevel = ZSTD_CLEVEL_CUSTOM;
+ cctxParams->compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */
+ assert(!ZSTD_checkCParams(params.cParams));
return 0;
}
+/* ZSTD_assignParamsToCCtxParams() :
+ * params is presumed valid at this stage */
static ZSTD_CCtx_params ZSTD_assignParamsToCCtxParams(
ZSTD_CCtx_params cctxParams, ZSTD_parameters params)
{
ZSTD_CCtx_params ret = cctxParams;
ret.cParams = params.cParams;
ret.fParams = params.fParams;
- ret.compressionLevel = ZSTD_CLEVEL_CUSTOM;
+ ret.compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */
+ assert(!ZSTD_checkCParams(params.cParams));
return ret;
}
@@ -245,10 +239,49 @@ static ZSTD_CCtx_params ZSTD_assignParamsToCCtxParams(
return ERROR(parameter_outOfBound); \
} }
+
+static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param)
+{
+ switch(param)
+ {
+ case ZSTD_p_compressionLevel:
+ case ZSTD_p_hashLog:
+ case ZSTD_p_chainLog:
+ case ZSTD_p_searchLog:
+ case ZSTD_p_minMatch:
+ case ZSTD_p_targetLength:
+ case ZSTD_p_compressionStrategy:
+ case ZSTD_p_compressLiterals:
+ return 1;
+
+ case ZSTD_p_format:
+ case ZSTD_p_windowLog:
+ case ZSTD_p_contentSizeFlag:
+ case ZSTD_p_checksumFlag:
+ case ZSTD_p_dictIDFlag:
+ case ZSTD_p_forceMaxWindow :
+ case ZSTD_p_nbWorkers:
+ case ZSTD_p_jobSize:
+ case ZSTD_p_overlapSizeLog:
+ case ZSTD_p_enableLongDistanceMatching:
+ case ZSTD_p_ldmHashLog:
+ case ZSTD_p_ldmMinMatch:
+ case ZSTD_p_ldmBucketSizeLog:
+ case ZSTD_p_ldmHashEveryLog:
+ default:
+ return 0;
+ }
+}
+
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value)
{
DEBUGLOG(4, "ZSTD_CCtx_setParameter (%u, %u)", (U32)param, value);
- if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
+ if (cctx->streamStage != zcss_init) {
+ if (ZSTD_isUpdateAuthorized(param)) {
+ cctx->cParamsChanged = 1;
+ } else {
+ return ERROR(stage_wrong);
+ } }
switch(param)
{
@@ -267,9 +300,9 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned v
case ZSTD_p_targetLength:
case ZSTD_p_compressionStrategy:
if (cctx->cdict) return ERROR(stage_wrong);
- if (value>0) ZSTD_cLevelToCParams(cctx); /* Can optimize if srcSize is known */
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
+ case ZSTD_p_compressLiterals:
case ZSTD_p_contentSizeFlag:
case ZSTD_p_checksumFlag:
case ZSTD_p_dictIDFlag:
@@ -280,23 +313,17 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned v
* default : 0 when using a CDict, 1 when using a Prefix */
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
- case ZSTD_p_nbThreads:
- if ((value > 1) && cctx->staticSize) {
+ case ZSTD_p_nbWorkers:
+ if ((value>0) && cctx->staticSize) {
return ERROR(parameter_unsupported); /* MT not compatible with static alloc */
}
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
case ZSTD_p_jobSize:
- return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
-
case ZSTD_p_overlapSizeLog:
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
case ZSTD_p_enableLongDistanceMatching:
- if (cctx->cdict) return ERROR(stage_wrong);
- if (value>0) ZSTD_cLevelToCParams(cctx);
- return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
-
case ZSTD_p_ldmHashLog:
case ZSTD_p_ldmMinMatch:
case ZSTD_p_ldmBucketSizeLog:
@@ -320,69 +347,62 @@ size_t ZSTD_CCtxParam_setParameter(
CCtxParams->format = (ZSTD_format_e)value;
return (size_t)CCtxParams->format;
- case ZSTD_p_compressionLevel :
- if ((int)value > ZSTD_maxCLevel()) value = ZSTD_maxCLevel();
- if (value) /* 0 : does not change current level */
- CCtxParams->compressionLevel = value;
- return CCtxParams->compressionLevel;
+ case ZSTD_p_compressionLevel : {
+ int cLevel = (int)value; /* cast expected to restore negative sign */
+ if (cLevel > ZSTD_maxCLevel()) cLevel = ZSTD_maxCLevel();
+ if (cLevel) { /* 0 : does not change current level */
+ CCtxParams->disableLiteralCompression = (cLevel<0); /* negative levels disable huffman */
+ CCtxParams->compressionLevel = cLevel;
+ }
+ if (CCtxParams->compressionLevel >= 0) return CCtxParams->compressionLevel;
+ return 0; /* return type (size_t) cannot represent negative values */
+ }
case ZSTD_p_windowLog :
- DEBUGLOG(4, "ZSTD_CCtxParam_setParameter: set windowLog=%u", value);
- if (value) { /* 0 : does not change current windowLog */
+ if (value>0) /* 0 => use default */
CLAMPCHECK(value, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.windowLog = value;
- }
+ CCtxParams->cParams.windowLog = value;
return CCtxParams->cParams.windowLog;
case ZSTD_p_hashLog :
- if (value) { /* 0 : does not change current hashLog */
+ if (value>0) /* 0 => use default */
CLAMPCHECK(value, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.hashLog = value;
- }
+ CCtxParams->cParams.hashLog = value;
return CCtxParams->cParams.hashLog;
case ZSTD_p_chainLog :
- if (value) { /* 0 : does not change current chainLog */
+ if (value>0) /* 0 => use default */
CLAMPCHECK(value, ZSTD_CHAINLOG_MIN, ZSTD_CHAINLOG_MAX);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.chainLog = value;
- }
+ CCtxParams->cParams.chainLog = value;
return CCtxParams->cParams.chainLog;
case ZSTD_p_searchLog :
- if (value) { /* 0 : does not change current searchLog */
+ if (value>0) /* 0 => use default */
CLAMPCHECK(value, ZSTD_SEARCHLOG_MIN, ZSTD_SEARCHLOG_MAX);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.searchLog = value;
- }
+ CCtxParams->cParams.searchLog = value;
return value;
case ZSTD_p_minMatch :
- if (value) { /* 0 : does not change current minMatch length */
+ if (value>0) /* 0 => use default */
CLAMPCHECK(value, ZSTD_SEARCHLENGTH_MIN, ZSTD_SEARCHLENGTH_MAX);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.searchLength = value;
- }
+ CCtxParams->cParams.searchLength = value;
return CCtxParams->cParams.searchLength;
case ZSTD_p_targetLength :
- if (value) { /* 0 : does not change current sufficient_len */
- CLAMPCHECK(value, ZSTD_TARGETLENGTH_MIN, ZSTD_TARGETLENGTH_MAX);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.targetLength = value;
- }
+ /* all values are valid. 0 => use default */
+ CCtxParams->cParams.targetLength = value;
return CCtxParams->cParams.targetLength;
case ZSTD_p_compressionStrategy :
- if (value) { /* 0 : does not change currentstrategy */
+ if (value>0) /* 0 => use default */
CLAMPCHECK(value, (unsigned)ZSTD_fast, (unsigned)ZSTD_btultra);
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.strategy = (ZSTD_strategy)value;
- }
+ CCtxParams->cParams.strategy = (ZSTD_strategy)value;
return (size_t)CCtxParams->cParams.strategy;
+ case ZSTD_p_compressLiterals:
+ CCtxParams->disableLiteralCompression = !value;
+ return !CCtxParams->disableLiteralCompression;
+
case ZSTD_p_contentSizeFlag :
/* Content size written in frame header _when known_ (default:1) */
DEBUGLOG(4, "set content size flag = %u", (value>0));
@@ -396,27 +416,25 @@ size_t ZSTD_CCtxParam_setParameter(
case ZSTD_p_dictIDFlag : /* When applicable, dictionary's dictID is provided in frame header (default:1) */
DEBUGLOG(4, "set dictIDFlag = %u", (value>0));
- CCtxParams->fParams.noDictIDFlag = (value == 0);
+ CCtxParams->fParams.noDictIDFlag = !value;
return !CCtxParams->fParams.noDictIDFlag;
case ZSTD_p_forceMaxWindow :
CCtxParams->forceWindow = (value > 0);
return CCtxParams->forceWindow;
- case ZSTD_p_nbThreads :
- if (value == 0) return CCtxParams->nbThreads;
+ case ZSTD_p_nbWorkers :
#ifndef ZSTD_MULTITHREAD
- if (value > 1) return ERROR(parameter_unsupported);
- return 1;
+ if (value>0) return ERROR(parameter_unsupported);
+ return 0;
#else
- return ZSTDMT_CCtxParam_setNbThreads(CCtxParams, value);
+ return ZSTDMT_CCtxParam_setNbWorkers(CCtxParams, value);
#endif
case ZSTD_p_jobSize :
#ifndef ZSTD_MULTITHREAD
return ERROR(parameter_unsupported);
#else
- if (CCtxParams->nbThreads <= 1) return ERROR(parameter_unsupported);
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_jobSize, value);
#endif
@@ -424,44 +442,36 @@ size_t ZSTD_CCtxParam_setParameter(
#ifndef ZSTD_MULTITHREAD
return ERROR(parameter_unsupported);
#else
- if (CCtxParams->nbThreads <= 1) return ERROR(parameter_unsupported);
return ZSTDMT_CCtxParam_setMTCtxParameter(CCtxParams, ZSTDMT_p_overlapSectionLog, value);
#endif
case ZSTD_p_enableLongDistanceMatching :
- if (value) {
- ZSTD_cLevelToCCtxParams(CCtxParams);
- CCtxParams->cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG;
- }
- return ZSTD_ldm_initializeParameters(&CCtxParams->ldmParams, value);
+ CCtxParams->ldmParams.enableLdm = (value>0);
+ return CCtxParams->ldmParams.enableLdm;
case ZSTD_p_ldmHashLog :
- if (value) { /* 0 : does not change current ldmHashLog */
+ if (value>0) /* 0 ==> auto */
CLAMPCHECK(value, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
- CCtxParams->ldmParams.hashLog = value;
- }
+ CCtxParams->ldmParams.hashLog = value;
return CCtxParams->ldmParams.hashLog;
case ZSTD_p_ldmMinMatch :
- if (value) { /* 0 : does not change current ldmMinMatch */
+ if (value>0) /* 0 ==> default */
CLAMPCHECK(value, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX);
- CCtxParams->ldmParams.minMatchLength = value;
- }
+ CCtxParams->ldmParams.minMatchLength = value;
return CCtxParams->ldmParams.minMatchLength;
case ZSTD_p_ldmBucketSizeLog :
- if (value > ZSTD_LDM_BUCKETSIZELOG_MAX) {
+ if (value > ZSTD_LDM_BUCKETSIZELOG_MAX)
return ERROR(parameter_outOfBound);
- }
CCtxParams->ldmParams.bucketSizeLog = value;
- return value;
+ return CCtxParams->ldmParams.bucketSizeLog;
case ZSTD_p_ldmHashEveryLog :
- if (value > ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN) {
+ if (value > ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)
return ERROR(parameter_outOfBound);
- }
CCtxParams->ldmParams.hashEveryLog = value;
- return value;
+ return CCtxParams->ldmParams.hashEveryLog;
default: return ERROR(parameter_unsupported);
}
@@ -470,6 +480,9 @@ size_t ZSTD_CCtxParam_setParameter(
/** ZSTD_CCtx_setParametersUsingCCtxParams() :
* just applies `params` into `cctx`
* no action is performed, parameters are merely stored.
+ * If ZSTDMT is enabled, parameters are pushed to cctx->mtctx.
+ * This is possible even if a compression is ongoing.
+ * In which case, new parameters will be applied on the fly, starting with next compression job.
*/
size_t ZSTD_CCtx_setParametersUsingCCtxParams(
ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params)
@@ -478,7 +491,6 @@ size_t ZSTD_CCtx_setParametersUsingCCtxParams(
if (cctx->cdict) return ERROR(stage_wrong);
cctx->requestedParams = *params;
-
return 0;
}
@@ -492,7 +504,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long lo
size_t ZSTD_CCtx_loadDictionary_advanced(
ZSTD_CCtx* cctx, const void* dict, size_t dictSize,
- ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictMode_e dictMode)
+ ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType)
{
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
if (cctx->staticSize) return ERROR(memory_allocation); /* no malloc for static CCtx */
@@ -503,10 +515,10 @@ size_t ZSTD_CCtx_loadDictionary_advanced(
cctx->cdict = NULL;
} else {
ZSTD_compressionParameters const cParams =
- ZSTD_getCParamsFromCCtxParams(cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1, dictSize);
+ ZSTD_getCParamsFromCCtxParams(&cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1, dictSize);
cctx->cdictLocal = ZSTD_createCDict_advanced(
dict, dictSize,
- dictLoadMethod, dictMode,
+ dictLoadMethod, dictContentType,
cParams, cctx->customMem);
cctx->cdict = cctx->cdictLocal;
if (cctx->cdictLocal == NULL)
@@ -519,13 +531,13 @@ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(
ZSTD_CCtx* cctx, const void* dict, size_t dictSize)
{
return ZSTD_CCtx_loadDictionary_advanced(
- cctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dm_auto);
+ cctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto);
}
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize)
{
return ZSTD_CCtx_loadDictionary_advanced(
- cctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dm_auto);
+ cctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto);
}
@@ -539,17 +551,17 @@ size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict)
size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize)
{
- return ZSTD_CCtx_refPrefix_advanced(cctx, prefix, prefixSize, ZSTD_dm_rawContent);
+ return ZSTD_CCtx_refPrefix_advanced(cctx, prefix, prefixSize, ZSTD_dct_rawContent);
}
size_t ZSTD_CCtx_refPrefix_advanced(
- ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictMode_e dictMode)
+ ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType)
{
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
cctx->cdict = NULL; /* prefix discards any prior cdict */
cctx->prefixDict.dict = prefix;
cctx->prefixDict.dictSize = prefixSize;
- cctx->prefixDict.dictMode = dictMode;
+ cctx->prefixDict.dictContentType = dictContentType;
return 0;
}
@@ -577,7 +589,8 @@ size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams)
CLAMPCHECK(cParams.hashLog, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
CLAMPCHECK(cParams.searchLog, ZSTD_SEARCHLOG_MIN, ZSTD_SEARCHLOG_MAX);
CLAMPCHECK(cParams.searchLength, ZSTD_SEARCHLENGTH_MIN, ZSTD_SEARCHLENGTH_MAX);
- CLAMPCHECK(cParams.targetLength, ZSTD_TARGETLENGTH_MIN, ZSTD_TARGETLENGTH_MAX);
+ if ((U32)(cParams.targetLength) < ZSTD_TARGETLENGTH_MIN)
+ return ERROR(parameter_unsupported);
if ((U32)(cParams.strategy) > (U32)ZSTD_btultra)
return ERROR(parameter_unsupported);
return 0;
@@ -597,7 +610,7 @@ static ZSTD_compressionParameters ZSTD_clampCParams(ZSTD_compressionParameters c
CLAMP(cParams.hashLog, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX);
CLAMP(cParams.searchLog, ZSTD_SEARCHLOG_MIN, ZSTD_SEARCHLOG_MAX);
CLAMP(cParams.searchLength, ZSTD_SEARCHLENGTH_MIN, ZSTD_SEARCHLENGTH_MAX);
- CLAMP(cParams.targetLength, ZSTD_TARGETLENGTH_MIN, ZSTD_TARGETLENGTH_MAX);
+ if ((U32)(cParams.targetLength) < ZSTD_TARGETLENGTH_MIN) cParams.targetLength = ZSTD_TARGETLENGTH_MIN;
if ((U32)(cParams.strategy) > (U32)ZSTD_btultra) cParams.strategy = ZSTD_btultra;
return cParams;
}
@@ -653,36 +666,43 @@ ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, u
return ZSTD_adjustCParams_internal(cPar, srcSize, dictSize);
}
+static size_t ZSTD_sizeof_matchState(ZSTD_compressionParameters const* cParams, const U32 forCCtx)
+{
+ size_t const chainSize = (cParams->strategy == ZSTD_fast) ? 0 : ((size_t)1 << cParams->chainLog);
+ size_t const hSize = ((size_t)1) << cParams->hashLog;
+ U32 const hashLog3 = (forCCtx && cParams->searchLength==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0;
+ size_t const h3Size = ((size_t)1) << hashLog3;
+ size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
+ size_t const optPotentialSpace = ((MaxML+1) + (MaxLL+1) + (MaxOff+1) + (1<<Litbits)) * sizeof(U32)
+ + (ZSTD_OPT_NUM+1) * (sizeof(ZSTD_match_t)+sizeof(ZSTD_optimal_t));
+ size_t const optSpace = (forCCtx && ((cParams->strategy == ZSTD_btopt) ||
+ (cParams->strategy == ZSTD_btultra)))
+ ? optPotentialSpace
+ : 0;
+ DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u",
+ (U32)chainSize, (U32)hSize, (U32)h3Size);
+ return tableSpace + optSpace;
+}
+
size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params)
{
/* Estimate CCtx size is supported for single-threaded compression only. */
- if (params->nbThreads > 1) { return ERROR(GENERIC); }
+ if (params->nbWorkers > 0) { return ERROR(GENERIC); }
{ ZSTD_compressionParameters const cParams =
- ZSTD_getCParamsFromCCtxParams(*params, 0, 0);
+ ZSTD_getCParamsFromCCtxParams(params, 0, 0);
size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << cParams.windowLog);
U32 const divider = (cParams.searchLength==3) ? 3 : 4;
size_t const maxNbSeq = blockSize / divider;
size_t const tokenSpace = blockSize + 11*maxNbSeq;
- size_t const chainSize =
- (cParams.strategy == ZSTD_fast) ? 0 : ((size_t)1 << cParams.chainLog);
- size_t const hSize = ((size_t)1) << cParams.hashLog;
- U32 const hashLog3 = (cParams.searchLength>3) ?
- 0 : MIN(ZSTD_HASHLOG3_MAX, cParams.windowLog);
- size_t const h3Size = ((size_t)1) << hashLog3;
- size_t const entropySpace = sizeof(ZSTD_entropyCTables_t);
- size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
+ size_t const entropySpace = HUF_WORKSPACE_SIZE;
+ size_t const blockStateSpace = 2 * sizeof(ZSTD_compressedBlockState_t);
+ size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 1);
- size_t const optBudget =
- ((MaxML+1) + (MaxLL+1) + (MaxOff+1) + (1<<Litbits))*sizeof(U32)
- + (ZSTD_OPT_NUM+1)*(sizeof(ZSTD_match_t) + sizeof(ZSTD_optimal_t));
- size_t const optSpace = ((cParams.strategy == ZSTD_btopt) || (cParams.strategy == ZSTD_btultra)) ? optBudget : 0;
+ size_t const ldmSpace = ZSTD_ldm_getTableSize(params->ldmParams);
+ size_t const ldmSeqSpace = ZSTD_ldm_getMaxNbSeq(params->ldmParams, blockSize) * sizeof(rawSeq);
- size_t const ldmSpace = params->ldmParams.enableLdm ?
- ZSTD_ldm_getTableSize(params->ldmParams.hashLog,
- params->ldmParams.bucketSizeLog) : 0;
-
- size_t const neededSpace = entropySpace + tableSpace + tokenSpace +
- optSpace + ldmSpace;
+ size_t const neededSpace = entropySpace + blockStateSpace + tokenSpace +
+ matchStateSize + ldmSpace + ldmSeqSpace;
DEBUGLOG(5, "sizeof(ZSTD_CCtx) : %u", (U32)sizeof(ZSTD_CCtx));
DEBUGLOG(5, "estimate workSpace : %u", (U32)neededSpace);
@@ -696,15 +716,26 @@ size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams)
return ZSTD_estimateCCtxSize_usingCCtxParams(&params);
}
-size_t ZSTD_estimateCCtxSize(int compressionLevel)
+static size_t ZSTD_estimateCCtxSize_internal(int compressionLevel)
{
ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, 0);
return ZSTD_estimateCCtxSize_usingCParams(cParams);
}
+size_t ZSTD_estimateCCtxSize(int compressionLevel)
+{
+ int level;
+ size_t memBudget = 0;
+ for (level=1; level<=compressionLevel; level++) {
+ size_t const newMB = ZSTD_estimateCCtxSize_internal(level);
+ if (newMB > memBudget) memBudget = newMB;
+ }
+ return memBudget;
+}
+
size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params)
{
- if (params->nbThreads > 1) { return ERROR(GENERIC); }
+ if (params->nbWorkers > 0) { return ERROR(GENERIC); }
{ size_t const CCtxSize = ZSTD_estimateCCtxSize_usingCCtxParams(params);
size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << params->cParams.windowLog);
size_t const inBuffSize = ((size_t)1 << params->cParams.windowLog) + blockSize;
@@ -721,11 +752,44 @@ size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams)
return ZSTD_estimateCStreamSize_usingCCtxParams(&params);
}
-size_t ZSTD_estimateCStreamSize(int compressionLevel) {
+static size_t ZSTD_estimateCStreamSize_internal(int compressionLevel) {
ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, 0);
return ZSTD_estimateCStreamSize_usingCParams(cParams);
}
+size_t ZSTD_estimateCStreamSize(int compressionLevel) {
+ int level;
+ size_t memBudget = 0;
+ for (level=1; level<=compressionLevel; level++) {
+ size_t const newMB = ZSTD_estimateCStreamSize_internal(level);
+ if (newMB > memBudget) memBudget = newMB;
+ }
+ return memBudget;
+}
+
+/* ZSTD_getFrameProgression():
+ * tells how much data has been consumed (input) and produced (output) for current frame.
+ * able to count progression inside worker threads (non-blocking mode).
+ */
+ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx)
+{
+#ifdef ZSTD_MULTITHREAD
+ if (cctx->appliedParams.nbWorkers > 0) {
+ return ZSTDMT_getFrameProgression(cctx->mtctx);
+ }
+#endif
+ { ZSTD_frameProgression fp;
+ size_t const buffered = (cctx->inBuff == NULL) ? 0 :
+ cctx->inBuffPos - cctx->inToCompress;
+ if (buffered) assert(cctx->inBuffPos >= cctx->inToCompress);
+ assert(buffered <= ZSTD_BLOCKSIZE_MAX);
+ fp.ingested = cctx->consumedSrcSize + buffered;
+ fp.consumed = cctx->consumedSrcSize;
+ fp.produced = cctx->producedCSize;
+ return fp;
+} }
+
+
static U32 ZSTD_equivalentCParams(ZSTD_compressionParameters cParams1,
ZSTD_compressionParameters cParams2)
{
@@ -761,9 +825,9 @@ static U32 ZSTD_sufficientBuff(size_t bufferSize1, size_t blockSize1,
size_t const windowSize2 = MAX(1, (size_t)MIN(((U64)1 << cParams2.windowLog), pledgedSrcSize));
size_t const blockSize2 = MIN(ZSTD_BLOCKSIZE_MAX, windowSize2);
size_t const neededBufferSize2 = (buffPol2==ZSTDb_buffered) ? windowSize2 + blockSize2 : 0;
- DEBUGLOG(4, "ZSTD_sufficientBuff: windowSize2=%u from wlog=%u",
+ DEBUGLOG(4, "ZSTD_sufficientBuff: is windowSize2=%u <= wlog1=%u",
(U32)windowSize2, cParams2.windowLog);
- DEBUGLOG(4, "ZSTD_sufficientBuff: blockSize2 %u <=? blockSize1 %u",
+ DEBUGLOG(4, "ZSTD_sufficientBuff: is blockSize2=%u <= blockSize1=%u",
(U32)blockSize2, (U32)blockSize1);
return (blockSize2 <= blockSize1) /* seqStore space depends on blockSize */
& (neededBufferSize2 <= bufferSize1);
@@ -782,37 +846,101 @@ static U32 ZSTD_equivalentParams(ZSTD_CCtx_params params1,
ZSTD_sufficientBuff(buffSize1, blockSize1, buffPol2, params2.cParams, pledgedSrcSize);
}
+static void ZSTD_reset_compressedBlockState(ZSTD_compressedBlockState_t* bs)
+{
+ int i;
+ for (i = 0; i < ZSTD_REP_NUM; ++i)
+ bs->rep[i] = repStartValue[i];
+ bs->entropy.hufCTable_repeatMode = HUF_repeat_none;
+ bs->entropy.offcode_repeatMode = FSE_repeat_none;
+ bs->entropy.matchlength_repeatMode = FSE_repeat_none;
+ bs->entropy.litlength_repeatMode = FSE_repeat_none;
+}
+
+/*! ZSTD_invalidateMatchState()
+ * Invalidate all the matches in the match finder tables.
+ * Requires nextSrc and base to be set (can be NULL).
+ */
+static void ZSTD_invalidateMatchState(ZSTD_matchState_t* ms)
+{
+ ZSTD_window_clear(&ms->window);
+
+ ms->nextToUpdate = ms->window.dictLimit + 1;
+ ms->loadedDictEnd = 0;
+ ms->opt.litLengthSum = 0; /* force reset of btopt stats */
+}
+
/*! ZSTD_continueCCtx() :
* reuse CCtx without reset (note : requires no dictionary) */
static size_t ZSTD_continueCCtx(ZSTD_CCtx* cctx, ZSTD_CCtx_params params, U64 pledgedSrcSize)
{
- U32 const end = (U32)(cctx->nextSrc - cctx->base);
size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << params.cParams.windowLog), pledgedSrcSize));
size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, windowSize);
- DEBUGLOG(4, "ZSTD_continueCCtx");
+ DEBUGLOG(4, "ZSTD_continueCCtx: re-use context in place");
cctx->blockSize = blockSize; /* previous block size could be different even for same windowLog, due to pledgedSrcSize */
cctx->appliedParams = params;
cctx->pledgedSrcSizePlusOne = pledgedSrcSize+1;
cctx->consumedSrcSize = 0;
+ cctx->producedCSize = 0;
if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)
cctx->appliedParams.fParams.contentSizeFlag = 0;
DEBUGLOG(4, "pledged content size : %u ; flag : %u",
(U32)pledgedSrcSize, cctx->appliedParams.fParams.contentSizeFlag);
- cctx->lowLimit = end;
- cctx->dictLimit = end;
- cctx->nextToUpdate = end+1;
cctx->stage = ZSTDcs_init;
cctx->dictID = 0;
- cctx->loadedDictEnd = 0;
- { int i; for (i=0; i<ZSTD_REP_NUM; i++) cctx->seqStore.rep[i] = repStartValue[i]; }
- cctx->optState.litLengthSum = 0; /* force reset of btopt stats */
+ if (params.ldmParams.enableLdm)
+ ZSTD_window_clear(&cctx->ldmState.window);
+ ZSTD_referenceExternalSequences(cctx, NULL, 0);
+ ZSTD_invalidateMatchState(&cctx->blockState.matchState);
+ ZSTD_reset_compressedBlockState(cctx->blockState.prevCBlock);
XXH64_reset(&cctx->xxhState, 0);
return 0;
}
typedef enum { ZSTDcrp_continue, ZSTDcrp_noMemset } ZSTD_compResetPolicy_e;
+static void* ZSTD_reset_matchState(ZSTD_matchState_t* ms, void* ptr, ZSTD_compressionParameters const* cParams, ZSTD_compResetPolicy_e const crp, U32 const forCCtx)
+{
+ size_t const chainSize = (cParams->strategy == ZSTD_fast) ? 0 : ((size_t)1 << cParams->chainLog);
+ size_t const hSize = ((size_t)1) << cParams->hashLog;
+ U32 const hashLog3 = (forCCtx && cParams->searchLength==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0;
+ size_t const h3Size = ((size_t)1) << hashLog3;
+ size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
+
+ assert(((size_t)ptr & 3) == 0);
+
+ ms->hashLog3 = hashLog3;
+ memset(&ms->window, 0, sizeof(ms->window));
+ ZSTD_invalidateMatchState(ms);
+
+ /* opt parser space */
+ if (forCCtx && ((cParams->strategy == ZSTD_btopt) | (cParams->strategy == ZSTD_btultra))) {
+ DEBUGLOG(4, "reserving optimal parser space");
+ ms->opt.litFreq = (U32*)ptr;
+ ms->opt.litLengthFreq = ms->opt.litFreq + (1<<Litbits);
+ ms->opt.matchLengthFreq = ms->opt.litLengthFreq + (MaxLL+1);
+ ms->opt.offCodeFreq = ms->opt.matchLengthFreq + (MaxML+1);
+ ptr = ms->opt.offCodeFreq + (MaxOff+1);
+ ms->opt.matchTable = (ZSTD_match_t*)ptr;
+ ptr = ms->opt.matchTable + ZSTD_OPT_NUM+1;
+ ms->opt.priceTable = (ZSTD_optimal_t*)ptr;
+ ptr = ms->opt.priceTable + ZSTD_OPT_NUM+1;
+ }
+
+ /* table Space */
+ DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_noMemset);
+ assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
+ if (crp!=ZSTDcrp_noMemset) memset(ptr, 0, tableSpace); /* reset tables only */
+ ms->hashTable = (U32*)(ptr);
+ ms->chainTable = ms->hashTable + hSize;
+ ms->hashTable3 = ms->chainTable + chainSize;
+ ptr = ms->hashTable3 + h3Size;
+
+ assert(((size_t)ptr & 3) == 0);
+ return ptr;
+}
+
/*! ZSTD_resetCCtx_internal() :
note : `params` are assumed fully validated at this stage */
static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
@@ -830,19 +958,14 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
zbuff, pledgedSrcSize)) {
DEBUGLOG(4, "ZSTD_equivalentParams()==1 -> continue mode (wLog1=%u, blockSize1=%u)",
zc->appliedParams.cParams.windowLog, (U32)zc->blockSize);
- assert(!(params.ldmParams.enableLdm &&
- params.ldmParams.hashEveryLog == ZSTD_LDM_HASHEVERYLOG_NOTSET));
- zc->entropy->hufCTable_repeatMode = HUF_repeat_none;
- zc->entropy->offcode_repeatMode = FSE_repeat_none;
- zc->entropy->matchlength_repeatMode = FSE_repeat_none;
- zc->entropy->litlength_repeatMode = FSE_repeat_none;
return ZSTD_continueCCtx(zc, params, pledgedSrcSize);
} }
DEBUGLOG(4, "ZSTD_equivalentParams()==0 -> reset CCtx");
if (params.ldmParams.enableLdm) {
/* Adjust long distance matching parameters */
- ZSTD_ldm_adjustParameters(&params.ldmParams, params.cParams.windowLog);
+ params.ldmParams.windowLog = params.cParams.windowLog;
+ ZSTD_ldm_adjustParameters(&params.ldmParams, &params.cParams);
assert(params.ldmParams.hashLog >= params.ldmParams.bucketSizeLog);
assert(params.ldmParams.hashEveryLog < 32);
zc->ldmState.hashPower =
@@ -854,34 +977,25 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
U32 const divider = (params.cParams.searchLength==3) ? 3 : 4;
size_t const maxNbSeq = blockSize / divider;
size_t const tokenSpace = blockSize + 11*maxNbSeq;
- size_t const chainSize = (params.cParams.strategy == ZSTD_fast) ?
- 0 : ((size_t)1 << params.cParams.chainLog);
- size_t const hSize = ((size_t)1) << params.cParams.hashLog;
- U32 const hashLog3 = (params.cParams.searchLength>3) ?
- 0 : MIN(ZSTD_HASHLOG3_MAX, params.cParams.windowLog);
- size_t const h3Size = ((size_t)1) << hashLog3;
- size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
size_t const buffOutSize = (zbuff==ZSTDb_buffered) ? ZSTD_compressBound(blockSize)+1 : 0;
size_t const buffInSize = (zbuff==ZSTDb_buffered) ? windowSize + blockSize : 0;
+ size_t const matchStateSize = ZSTD_sizeof_matchState(&params.cParams, /* forCCtx */ 1);
+ size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(params.ldmParams, blockSize);
void* ptr;
/* Check if workSpace is large enough, alloc a new one if needed */
- { size_t const entropySpace = sizeof(ZSTD_entropyCTables_t);
- size_t const optPotentialSpace = ((MaxML+1) + (MaxLL+1) + (MaxOff+1) + (1<<Litbits)) * sizeof(U32)
- + (ZSTD_OPT_NUM+1) * (sizeof(ZSTD_match_t)+sizeof(ZSTD_optimal_t));
- size_t const optSpace = ( (params.cParams.strategy == ZSTD_btopt)
- || (params.cParams.strategy == ZSTD_btultra)) ?
- optPotentialSpace : 0;
+ { size_t const entropySpace = HUF_WORKSPACE_SIZE;
+ size_t const blockStateSpace = 2 * sizeof(ZSTD_compressedBlockState_t);
size_t const bufferSpace = buffInSize + buffOutSize;
- size_t const ldmSpace = params.ldmParams.enableLdm
- ? ZSTD_ldm_getTableSize(params.ldmParams.hashLog, params.ldmParams.bucketSizeLog)
- : 0;
- size_t const neededSpace = entropySpace + optSpace + ldmSpace +
- tableSpace + tokenSpace + bufferSpace;
- DEBUGLOG(4, "Need %uKB workspace, including %uKB for tables, and %uKB for buffers",
- (U32)(neededSpace>>10), (U32)(tableSpace>>10), (U32)(bufferSpace>>10));
- DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u - windowSize: %u - blockSize: %u",
- (U32)chainSize, (U32)hSize, (U32)h3Size, (U32)windowSize, (U32)blockSize);
+ size_t const ldmSpace = ZSTD_ldm_getTableSize(params.ldmParams);
+ size_t const ldmSeqSpace = maxNbLdmSeq * sizeof(rawSeq);
+
+ size_t const neededSpace = entropySpace + blockStateSpace + ldmSpace +
+ ldmSeqSpace + matchStateSize + tokenSpace +
+ bufferSpace;
+ DEBUGLOG(4, "Need %uKB workspace, including %uKB for match state, and %uKB for buffers",
+ (U32)(neededSpace>>10), (U32)(matchStateSize>>10), (U32)(bufferSpace>>10));
+ DEBUGLOG(4, "windowSize: %u - blockSize: %u", (U32)windowSize, (U32)blockSize);
if (zc->workSpaceSize < neededSpace) { /* too small : resize */
DEBUGLOG(4, "Need to update workSpaceSize from %uK to %uK",
@@ -897,16 +1011,20 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
zc->workSpaceSize = neededSpace;
ptr = zc->workSpace;
- /* entropy space */
+ /* Statically sized space. entropyWorkspace never moves (but prev/next block swap places) */
assert(((size_t)zc->workSpace & 3) == 0); /* ensure correct alignment */
- assert(zc->workSpaceSize >= sizeof(ZSTD_entropyCTables_t));
- zc->entropy = (ZSTD_entropyCTables_t*)zc->workSpace;
+ assert(zc->workSpaceSize >= 2 * sizeof(ZSTD_compressedBlockState_t));
+ zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)zc->workSpace;
+ zc->blockState.nextCBlock = zc->blockState.prevCBlock + 1;
+ ptr = zc->blockState.nextCBlock + 1;
+ zc->entropyWorkspace = (U32*)ptr;
} }
/* init params */
zc->appliedParams = params;
zc->pledgedSrcSizePlusOne = pledgedSrcSize+1;
zc->consumedSrcSize = 0;
+ zc->producedCSize = 0;
if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)
zc->appliedParams.fParams.contentSizeFlag = 0;
DEBUGLOG(4, "pledged content size : %u ; flag : %u",
@@ -916,37 +1034,10 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
XXH64_reset(&zc->xxhState, 0);
zc->stage = ZSTDcs_init;
zc->dictID = 0;
- zc->loadedDictEnd = 0;
- zc->entropy->hufCTable_repeatMode = HUF_repeat_none;
- zc->entropy->offcode_repeatMode = FSE_repeat_none;
- zc->entropy->matchlength_repeatMode = FSE_repeat_none;
- zc->entropy->litlength_repeatMode = FSE_repeat_none;
- zc->nextToUpdate = 1;
- zc->nextSrc = NULL;
- zc->base = NULL;
- zc->dictBase = NULL;
- zc->dictLimit = 0;
- zc->lowLimit = 0;
- { int i; for (i=0; i<ZSTD_REP_NUM; i++) zc->seqStore.rep[i] = repStartValue[i]; }
- zc->hashLog3 = hashLog3;
- zc->optState.litLengthSum = 0;
-
- ptr = zc->entropy + 1;
-
- /* opt parser space */
- if ((params.cParams.strategy == ZSTD_btopt) || (params.cParams.strategy == ZSTD_btultra)) {
- DEBUGLOG(4, "reserving optimal parser space");
- assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
- zc->optState.litFreq = (U32*)ptr;
- zc->optState.litLengthFreq = zc->optState.litFreq + (1<<Litbits);
- zc->optState.matchLengthFreq = zc->optState.litLengthFreq + (MaxLL+1);
- zc->optState.offCodeFreq = zc->optState.matchLengthFreq + (MaxML+1);
- ptr = zc->optState.offCodeFreq + (MaxOff+1);
- zc->optState.matchTable = (ZSTD_match_t*)ptr;
- ptr = zc->optState.matchTable + ZSTD_OPT_NUM+1;
- zc->optState.priceTable = (ZSTD_optimal_t*)ptr;
- ptr = zc->optState.priceTable + ZSTD_OPT_NUM+1;
- }
+
+ ZSTD_reset_compressedBlockState(zc->blockState.prevCBlock);
+
+ ptr = zc->entropyWorkspace + HUF_WORKSPACE_SIZE_U32;
/* ldm hash table */
/* initialize bucketOffsets table later for pointer alignment */
@@ -956,16 +1047,15 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
zc->ldmState.hashTable = (ldmEntry_t*)ptr;
ptr = zc->ldmState.hashTable + ldmHSize;
+ zc->ldmSequences = (rawSeq*)ptr;
+ ptr = zc->ldmSequences + maxNbLdmSeq;
+ zc->maxNbLdmSequences = maxNbLdmSeq;
+
+ memset(&zc->ldmState.window, 0, sizeof(zc->ldmState.window));
}
+ assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
- /* table Space */
- DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_noMemset);
- if (crp!=ZSTDcrp_noMemset) memset(ptr, 0, tableSpace); /* reset tables only */
- assert(((size_t)ptr & 3) == 0); /* ensure ptr is properly aligned */
- zc->hashTable = (U32*)(ptr);
- zc->chainTable = zc->hashTable + hSize;
- zc->hashTable3 = zc->chainTable + chainSize;
- ptr = zc->hashTable3 + h3Size;
+ ptr = ZSTD_reset_matchState(&zc->blockState.matchState, ptr, &params.cParams, crp, /* forCCtx */ 1);
/* sequences storage */
zc->seqStore.sequencesStart = (seqDef*)ptr;
@@ -984,7 +1074,9 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
memset(ptr, 0, ldmBucketSize);
zc->ldmState.bucketOffsets = (BYTE*)ptr;
ptr = zc->ldmState.bucketOffsets + ldmBucketSize;
+ ZSTD_window_clear(&zc->ldmState.window);
}
+ ZSTD_referenceExternalSequences(zc, NULL, 0);
/* buffers */
zc->inBuffSize = buffInSize;
@@ -1002,9 +1094,61 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
* do not use with extDict variant ! */
void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx) {
int i;
- for (i=0; i<ZSTD_REP_NUM; i++) cctx->seqStore.rep[i] = 0;
+ for (i=0; i<ZSTD_REP_NUM; i++) cctx->blockState.prevCBlock->rep[i] = 0;
+ assert(!ZSTD_window_hasExtDict(cctx->blockState.matchState.window));
}
+static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx,
+ const ZSTD_CDict* cdict,
+ unsigned windowLog,
+ ZSTD_frameParameters fParams,
+ U64 pledgedSrcSize,
+ ZSTD_buffered_policy_e zbuff)
+{
+ { ZSTD_CCtx_params params = cctx->requestedParams;
+ /* Copy only compression parameters related to tables. */
+ params.cParams = cdict->cParams;
+ if (windowLog) params.cParams.windowLog = windowLog;
+ params.fParams = fParams;
+ ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,
+ ZSTDcrp_noMemset, zbuff);
+ assert(cctx->appliedParams.cParams.strategy == cdict->cParams.strategy);
+ assert(cctx->appliedParams.cParams.hashLog == cdict->cParams.hashLog);
+ assert(cctx->appliedParams.cParams.chainLog == cdict->cParams.chainLog);
+ }
+
+ /* copy tables */
+ { size_t const chainSize = (cdict->cParams.strategy == ZSTD_fast) ? 0 : ((size_t)1 << cdict->cParams.chainLog);
+ size_t const hSize = (size_t)1 << cdict->cParams.hashLog;
+ size_t const tableSpace = (chainSize + hSize) * sizeof(U32);
+ assert((U32*)cctx->blockState.matchState.chainTable == (U32*)cctx->blockState.matchState.hashTable + hSize); /* chainTable must follow hashTable */
+ assert((U32*)cctx->blockState.matchState.hashTable3 == (U32*)cctx->blockState.matchState.chainTable + chainSize);
+ assert((U32*)cdict->matchState.chainTable == (U32*)cdict->matchState.hashTable + hSize); /* chainTable must follow hashTable */
+ assert((U32*)cdict->matchState.hashTable3 == (U32*)cdict->matchState.chainTable + chainSize);
+ memcpy(cctx->blockState.matchState.hashTable, cdict->matchState.hashTable, tableSpace); /* presumes all tables follow each other */
+ }
+ /* Zero the hashTable3, since the cdict never fills it */
+ { size_t const h3Size = (size_t)1 << cctx->blockState.matchState.hashLog3;
+ assert(cdict->matchState.hashLog3 == 0);
+ memset(cctx->blockState.matchState.hashTable3, 0, h3Size * sizeof(U32));
+ }
+
+ /* copy dictionary offsets */
+ {
+ ZSTD_matchState_t const* srcMatchState = &cdict->matchState;
+ ZSTD_matchState_t* dstMatchState = &cctx->blockState.matchState;
+ dstMatchState->window = srcMatchState->window;
+ dstMatchState->nextToUpdate = srcMatchState->nextToUpdate;
+ dstMatchState->nextToUpdate3= srcMatchState->nextToUpdate3;
+ dstMatchState->loadedDictEnd= srcMatchState->loadedDictEnd;
+ }
+ cctx->dictID = cdict->dictID;
+
+ /* copy block state */
+ memcpy(cctx->blockState.prevCBlock, &cdict->cBlockState, sizeof(cdict->cBlockState));
+
+ return 0;
+}
/*! ZSTD_copyCCtx_internal() :
* Duplicate an existing context `srcCCtx` into another one `dstCCtx`.
@@ -1015,7 +1159,6 @@ void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx) {
* @return : 0, or an error code */
static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,
const ZSTD_CCtx* srcCCtx,
- unsigned windowLog,
ZSTD_frameParameters fParams,
U64 pledgedSrcSize,
ZSTD_buffered_policy_e zbuff)
@@ -1027,41 +1170,39 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx,
{ ZSTD_CCtx_params params = dstCCtx->requestedParams;
/* Copy only compression parameters related to tables. */
params.cParams = srcCCtx->appliedParams.cParams;
- if (windowLog) params.cParams.windowLog = windowLog;
params.fParams = fParams;
ZSTD_resetCCtx_internal(dstCCtx, params, pledgedSrcSize,
ZSTDcrp_noMemset, zbuff);
+ assert(dstCCtx->appliedParams.cParams.windowLog == srcCCtx->appliedParams.cParams.windowLog);
+ assert(dstCCtx->appliedParams.cParams.strategy == srcCCtx->appliedParams.cParams.strategy);
+ assert(dstCCtx->appliedParams.cParams.hashLog == srcCCtx->appliedParams.cParams.hashLog);
+ assert(dstCCtx->appliedParams.cParams.chainLog == srcCCtx->appliedParams.cParams.chainLog);
+ assert(dstCCtx->blockState.matchState.hashLog3 == srcCCtx->blockState.matchState.hashLog3);
}
/* copy tables */
{ size_t const chainSize = (srcCCtx->appliedParams.cParams.strategy == ZSTD_fast) ? 0 : ((size_t)1 << srcCCtx->appliedParams.cParams.chainLog);
size_t const hSize = (size_t)1 << srcCCtx->appliedParams.cParams.hashLog;
- size_t const h3Size = (size_t)1 << srcCCtx->hashLog3;
+ size_t const h3Size = (size_t)1 << srcCCtx->blockState.matchState.hashLog3;
size_t const tableSpace = (chainSize + hSize + h3Size) * sizeof(U32);
- assert((U32*)dstCCtx->chainTable == (U32*)dstCCtx->hashTable + hSize); /* chainTable must follow hashTable */
- assert((U32*)dstCCtx->hashTable3 == (U32*)dstCCtx->chainTable + chainSize);
- memcpy(dstCCtx->hashTable, srcCCtx->hashTable, tableSpace); /* presumes all tables follow each other */
+ assert((U32*)dstCCtx->blockState.matchState.chainTable == (U32*)dstCCtx->blockState.matchState.hashTable + hSize); /* chainTable must follow hashTable */
+ assert((U32*)dstCCtx->blockState.matchState.hashTable3 == (U32*)dstCCtx->blockState.matchState.chainTable + chainSize);
+ memcpy(dstCCtx->blockState.matchState.hashTable, srcCCtx->blockState.matchState.hashTable, tableSpace); /* presumes all tables follow each other */
}
/* copy dictionary offsets */
- dstCCtx->nextToUpdate = srcCCtx->nextToUpdate;
- dstCCtx->nextToUpdate3= srcCCtx->nextToUpdate3;
- dstCCtx->nextSrc = srcCCtx->nextSrc;
- dstCCtx->base = srcCCtx->base;
- dstCCtx->dictBase = srcCCtx->dictBase;
- dstCCtx->dictLimit = srcCCtx->dictLimit;
- dstCCtx->lowLimit = srcCCtx->lowLimit;
- dstCCtx->loadedDictEnd= srcCCtx->loadedDictEnd;
- dstCCtx->dictID = srcCCtx->dictID;
-
- /* copy entropy tables */
- memcpy(dstCCtx->entropy, srcCCtx->entropy, sizeof(ZSTD_entropyCTables_t));
- /* copy repcodes */
{
- int i;
- for (i = 0; i < ZSTD_REP_NUM; ++i)
- dstCCtx->seqStore.rep[i] = srcCCtx->seqStore.rep[i];
+ ZSTD_matchState_t const* srcMatchState = &srcCCtx->blockState.matchState;
+ ZSTD_matchState_t* dstMatchState = &dstCCtx->blockState.matchState;
+ dstMatchState->window = srcMatchState->window;
+ dstMatchState->nextToUpdate = srcMatchState->nextToUpdate;
+ dstMatchState->nextToUpdate3= srcMatchState->nextToUpdate3;
+ dstMatchState->loadedDictEnd= srcMatchState->loadedDictEnd;
}
+ dstCCtx->dictID = srcCCtx->dictID;
+
+ /* copy block state */
+ memcpy(dstCCtx->blockState.prevCBlock, srcCCtx->blockState.prevCBlock, sizeof(*srcCCtx->blockState.prevCBlock));
return 0;
}
@@ -1080,51 +1221,69 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* dstCCtx, const ZSTD_CCtx* srcCCtx, unsigned long
fParams.contentSizeFlag = (pledgedSrcSize != ZSTD_CONTENTSIZE_UNKNOWN);
return ZSTD_copyCCtx_internal(dstCCtx, srcCCtx,
- 0 /*windowLog from srcCCtx*/, fParams, pledgedSrcSize,
+ fParams, pledgedSrcSize,
zbuff);
}
+#define ZSTD_ROWSIZE 16
/*! ZSTD_reduceTable() :
- * reduce table indexes by `reducerValue` */
-static void ZSTD_reduceTable (U32* const table, U32 const size, U32 const reducerValue)
+ * reduce table indexes by `reducerValue`, or squash to zero.
+ * PreserveMark preserves "unsorted mark" for btlazy2 strategy.
+ * It must be set to a clear 0/1 value, to remove branch during inlining.
+ * Presume table size is a multiple of ZSTD_ROWSIZE
+ * to help auto-vectorization */
+FORCE_INLINE_TEMPLATE void
+ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerValue, int const preserveMark)
+{
+ int const nbRows = (int)size / ZSTD_ROWSIZE;
+ int cellNb = 0;
+ int rowNb;
+ assert((size & (ZSTD_ROWSIZE-1)) == 0); /* multiple of ZSTD_ROWSIZE */
+ assert(size < (1U<<31)); /* can be casted to int */
+ for (rowNb=0 ; rowNb < nbRows ; rowNb++) {
+ int column;
+ for (column=0; column<ZSTD_ROWSIZE; column++) {
+ if (preserveMark) {
+ U32 const adder = (table[cellNb] == ZSTD_DUBT_UNSORTED_MARK) ? reducerValue : 0;
+ table[cellNb] += adder;
+ }
+ if (table[cellNb] < reducerValue) table[cellNb] = 0;
+ else table[cellNb] -= reducerValue;
+ cellNb++;
+ } }
+}
+
+static void ZSTD_reduceTable(U32* const table, U32 const size, U32 const reducerValue)
{
- U32 u;
- for (u=0 ; u < size ; u++) {
- if (table[u] < reducerValue) table[u] = 0;
- else table[u] -= reducerValue;
- }
+ ZSTD_reduceTable_internal(table, size, reducerValue, 0);
}
-/*! ZSTD_ldm_reduceTable() :
- * reduce table indexes by `reducerValue` */
-static void ZSTD_ldm_reduceTable(ldmEntry_t* const table, U32 const size,
- U32 const reducerValue)
+static void ZSTD_reduceTable_btlazy2(U32* const table, U32 const size, U32 const reducerValue)
{
- U32 u;
- for (u = 0; u < size; u++) {
- if (table[u].offset < reducerValue) table[u].offset = 0;
- else table[u].offset -= reducerValue;
- }
+ ZSTD_reduceTable_internal(table, size, reducerValue, 1);
}
/*! ZSTD_reduceIndex() :
* rescale all indexes to avoid future overflow (indexes are U32) */
static void ZSTD_reduceIndex (ZSTD_CCtx* zc, const U32 reducerValue)
{
- { U32 const hSize = (U32)1 << zc->appliedParams.cParams.hashLog;
- ZSTD_reduceTable(zc->hashTable, hSize, reducerValue); }
-
- { U32 const chainSize = (zc->appliedParams.cParams.strategy == ZSTD_fast) ? 0 : ((U32)1 << zc->appliedParams.cParams.chainLog);
- ZSTD_reduceTable(zc->chainTable, chainSize, reducerValue); }
+ ZSTD_matchState_t* const ms = &zc->blockState.matchState;
+ { U32 const hSize = (U32)1 << zc->appliedParams.cParams.hashLog;
+ ZSTD_reduceTable(ms->hashTable, hSize, reducerValue);
+ }
- { U32 const h3Size = (zc->hashLog3) ? (U32)1 << zc->hashLog3 : 0;
- ZSTD_reduceTable(zc->hashTable3, h3Size, reducerValue); }
+ if (zc->appliedParams.cParams.strategy != ZSTD_fast) {
+ U32 const chainSize = (U32)1 << zc->appliedParams.cParams.chainLog;
+ if (zc->appliedParams.cParams.strategy == ZSTD_btlazy2)
+ ZSTD_reduceTable_btlazy2(ms->chainTable, chainSize, reducerValue);
+ else
+ ZSTD_reduceTable(ms->chainTable, chainSize, reducerValue);
+ }
- { if (zc->appliedParams.ldmParams.enableLdm) {
- U32 const ldmHSize = (U32)1 << zc->appliedParams.ldmParams.hashLog;
- ZSTD_ldm_reduceTable(zc->ldmState.hashTable, ldmHSize, reducerValue);
- }
+ if (ms->hashLog3) {
+ U32 const h3Size = (U32)1 << ms->hashLog3;
+ ZSTD_reduceTable(ms->hashTable3, h3Size, reducerValue);
}
}
@@ -1199,10 +1358,12 @@ static size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, cons
static size_t ZSTD_minGain(size_t srcSize) { return (srcSize >> 6) + 2; }
-static size_t ZSTD_compressLiterals (ZSTD_entropyCTables_t * entropy,
- ZSTD_strategy strategy,
+static size_t ZSTD_compressLiterals (ZSTD_entropyCTables_t const* prevEntropy,
+ ZSTD_entropyCTables_t* nextEntropy,
+ ZSTD_strategy strategy, int disableLiteralCompression,
void* dst, size_t dstCapacity,
- const void* src, size_t srcSize)
+ const void* src, size_t srcSize,
+ U32* workspace, const int bmi2)
{
size_t const minGain = ZSTD_minGain(srcSize);
size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
@@ -1211,34 +1372,51 @@ static size_t ZSTD_compressLiterals (ZSTD_entropyCTables_t * entropy,
symbolEncodingType_e hType = set_compressed;
size_t cLitSize;
+ DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i)",
+ disableLiteralCompression);
+
+ /* Prepare nextEntropy assuming reusing the existing table */
+ nextEntropy->hufCTable_repeatMode = prevEntropy->hufCTable_repeatMode;
+ memcpy(nextEntropy->hufCTable, prevEntropy->hufCTable,
+ sizeof(prevEntropy->hufCTable));
+
+ if (disableLiteralCompression)
+ return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
/* small ? don't even attempt compression (speed opt) */
-# define LITERAL_NOENTROPY 63
- { size_t const minLitSize = entropy->hufCTable_repeatMode == HUF_repeat_valid ? 6 : LITERAL_NOENTROPY;
+# define COMPRESS_LITERALS_SIZE_MIN 63
+ { size_t const minLitSize = (prevEntropy->hufCTable_repeatMode == HUF_repeat_valid) ? 6 : COMPRESS_LITERALS_SIZE_MIN;
if (srcSize <= minLitSize) return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
}
if (dstCapacity < lhSize+1) return ERROR(dstSize_tooSmall); /* not enough space for compression */
- { HUF_repeat repeat = entropy->hufCTable_repeatMode;
+ { HUF_repeat repeat = prevEntropy->hufCTable_repeatMode;
int const preferRepeat = strategy < ZSTD_lazy ? srcSize <= 1024 : 0;
if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1;
cLitSize = singleStream ? HUF_compress1X_repeat(ostart+lhSize, dstCapacity-lhSize, src, srcSize, 255, 11,
- entropy->workspace, sizeof(entropy->workspace), (HUF_CElt*)entropy->hufCTable, &repeat, preferRepeat)
+ workspace, HUF_WORKSPACE_SIZE, (HUF_CElt*)nextEntropy->hufCTable, &repeat, preferRepeat, bmi2)
: HUF_compress4X_repeat(ostart+lhSize, dstCapacity-lhSize, src, srcSize, 255, 11,
- entropy->workspace, sizeof(entropy->workspace), (HUF_CElt*)entropy->hufCTable, &repeat, preferRepeat);
- if (repeat != HUF_repeat_none) { hType = set_repeat; } /* reused the existing table */
- else { entropy->hufCTable_repeatMode = HUF_repeat_check; } /* now have a table to reuse */
+ workspace, HUF_WORKSPACE_SIZE, (HUF_CElt*)nextEntropy->hufCTable, &repeat, preferRepeat, bmi2);
+ if (repeat != HUF_repeat_none) {
+ /* reused the existing table */
+ hType = set_repeat;
+ }
}
if ((cLitSize==0) | (cLitSize >= srcSize - minGain) | ERR_isError(cLitSize)) {
- entropy->hufCTable_repeatMode = HUF_repeat_none;
+ memcpy(nextEntropy->hufCTable, prevEntropy->hufCTable, sizeof(prevEntropy->hufCTable));
return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
}
if (cLitSize==1) {
- entropy->hufCTable_repeatMode = HUF_repeat_none;
+ memcpy(nextEntropy->hufCTable, prevEntropy->hufCTable, sizeof(prevEntropy->hufCTable));
return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize);
}
+ if (hType == set_compressed) {
+ /* using a newly constructed table */
+ nextEntropy->hufCTable_repeatMode = HUF_repeat_check;
+ }
+
/* Build header */
switch(lhSize)
{
@@ -1332,10 +1510,11 @@ symbolEncodingType_e ZSTD_selectEncodingType(
MEM_STATIC
size_t ZSTD_buildCTable(void* dst, size_t dstCapacity,
- FSE_CTable* CTable, U32 FSELog, symbolEncodingType_e type,
+ FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type,
U32* count, U32 max,
BYTE const* codeTable, size_t nbSeq,
S16 const* defaultNorm, U32 defaultNormLog, U32 defaultMax,
+ FSE_CTable const* prevCTable, size_t prevCTableSize,
void* workspace, size_t workspaceSize)
{
BYTE* op = (BYTE*)dst;
@@ -1344,12 +1523,13 @@ size_t ZSTD_buildCTable(void* dst, size_t dstCapacity,
switch (type) {
case set_rle:
*op = codeTable[0];
- CHECK_F(FSE_buildCTable_rle(CTable, (BYTE)max));
+ CHECK_F(FSE_buildCTable_rle(nextCTable, (BYTE)max));
return 1;
case set_repeat:
+ memcpy(nextCTable, prevCTable, prevCTableSize);
return 0;
case set_basic:
- CHECK_F(FSE_buildCTable_wksp(CTable, defaultNorm, defaultMax, defaultNormLog, workspace, workspaceSize)); /* note : could be pre-calculated */
+ CHECK_F(FSE_buildCTable_wksp(nextCTable, defaultNorm, defaultMax, defaultNormLog, workspace, workspaceSize)); /* note : could be pre-calculated */
return 0;
case set_compressed: {
S16 norm[MaxSeq + 1];
@@ -1363,7 +1543,7 @@ size_t ZSTD_buildCTable(void* dst, size_t dstCapacity,
CHECK_F(FSE_normalizeCount(norm, tableLog, count, nbSeq_1, max));
{ size_t const NCountSize = FSE_writeNCount(op, oend - op, norm, max, tableLog); /* overflow protected */
if (FSE_isError(NCountSize)) return NCountSize;
- CHECK_F(FSE_buildCTable_wksp(CTable, norm, max, tableLog, workspace, workspaceSize));
+ CHECK_F(FSE_buildCTable_wksp(nextCTable, norm, max, tableLog, workspace, workspaceSize));
return NCountSize;
}
}
@@ -1371,8 +1551,8 @@ size_t ZSTD_buildCTable(void* dst, size_t dstCapacity,
}
}
-MEM_STATIC
-size_t ZSTD_encodeSequences(
+FORCE_INLINE_TEMPLATE size_t
+ZSTD_encodeSequences_body(
void* dst, size_t dstCapacity,
FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
@@ -1419,7 +1599,8 @@ size_t ZSTD_encodeSequences(
DEBUGLOG(6, "encoding: litlen:%2u - matchlen:%2u - offCode:%7u",
sequences[n].litLength,
sequences[n].matchLength + MINMATCH,
- sequences[n].offset); /* 32b*/ /* 64b*/
+ sequences[n].offset);
+ /* 32b*/ /* 64b*/
/* (7)*/ /* (7)*/
FSE_encodeSymbol(&blockStream, &stateOffsetBits, ofCode); /* 15 */ /* 15 */
FSE_encodeSymbol(&blockStream, &stateMatchLength, mlCode); /* 24 */ /* 24 */
@@ -1445,8 +1626,11 @@ size_t ZSTD_encodeSequences(
BIT_flushBits(&blockStream); /* (7)*/
} }
+ DEBUGLOG(6, "ZSTD_encodeSequences: flushing ML state with %u bits", stateMatchLength.stateLog);
FSE_flushCState(&blockStream, &stateMatchLength);
+ DEBUGLOG(6, "ZSTD_encodeSequences: flushing Off state with %u bits", stateOffsetBits.stateLog);
FSE_flushCState(&blockStream, &stateOffsetBits);
+ DEBUGLOG(6, "ZSTD_encodeSequences: flushing LL state with %u bits", stateLitLength.stateLog);
FSE_flushCState(&blockStream, &stateLitLength);
{ size_t const streamSize = BIT_closeCStream(&blockStream);
@@ -1455,16 +1639,77 @@ size_t ZSTD_encodeSequences(
}
}
+static size_t
+ZSTD_encodeSequences_default(
+ void* dst, size_t dstCapacity,
+ FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
+ FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
+ FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
+ seqDef const* sequences, size_t nbSeq, int longOffsets)
+{
+ return ZSTD_encodeSequences_body(dst, dstCapacity,
+ CTable_MatchLength, mlCodeTable,
+ CTable_OffsetBits, ofCodeTable,
+ CTable_LitLength, llCodeTable,
+ sequences, nbSeq, longOffsets);
+}
+
+
+#if DYNAMIC_BMI2
+
+static TARGET_ATTRIBUTE("bmi2") size_t
+ZSTD_encodeSequences_bmi2(
+ void* dst, size_t dstCapacity,
+ FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
+ FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
+ FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
+ seqDef const* sequences, size_t nbSeq, int longOffsets)
+{
+ return ZSTD_encodeSequences_body(dst, dstCapacity,
+ CTable_MatchLength, mlCodeTable,
+ CTable_OffsetBits, ofCodeTable,
+ CTable_LitLength, llCodeTable,
+ sequences, nbSeq, longOffsets);
+}
+
+#endif
+
+size_t ZSTD_encodeSequences(
+ void* dst, size_t dstCapacity,
+ FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
+ FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
+ FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
+ seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2)
+{
+#if DYNAMIC_BMI2
+ if (bmi2) {
+ return ZSTD_encodeSequences_bmi2(dst, dstCapacity,
+ CTable_MatchLength, mlCodeTable,
+ CTable_OffsetBits, ofCodeTable,
+ CTable_LitLength, llCodeTable,
+ sequences, nbSeq, longOffsets);
+ }
+#endif
+ (void)bmi2;
+ return ZSTD_encodeSequences_default(dst, dstCapacity,
+ CTable_MatchLength, mlCodeTable,
+ CTable_OffsetBits, ofCodeTable,
+ CTable_LitLength, llCodeTable,
+ sequences, nbSeq, longOffsets);
+}
+
MEM_STATIC size_t ZSTD_compressSequences_internal(seqStore_t* seqStorePtr,
- ZSTD_entropyCTables_t* entropy,
- ZSTD_compressionParameters const* cParams,
- void* dst, size_t dstCapacity)
+ ZSTD_entropyCTables_t const* prevEntropy,
+ ZSTD_entropyCTables_t* nextEntropy,
+ ZSTD_CCtx_params const* cctxParams,
+ void* dst, size_t dstCapacity, U32* workspace,
+ const int bmi2)
{
- const int longOffsets = cParams->windowLog > STREAM_ACCUMULATOR_MIN;
+ const int longOffsets = cctxParams->cParams.windowLog > STREAM_ACCUMULATOR_MIN;
U32 count[MaxSeq+1];
- FSE_CTable* CTable_LitLength = entropy->litlengthCTable;
- FSE_CTable* CTable_OffsetBits = entropy->offcodeCTable;
- FSE_CTable* CTable_MatchLength = entropy->matchlengthCTable;
+ FSE_CTable* CTable_LitLength = nextEntropy->litlengthCTable;
+ FSE_CTable* CTable_OffsetBits = nextEntropy->offcodeCTable;
+ FSE_CTable* CTable_MatchLength = nextEntropy->matchlengthCTable;
U32 LLtype, Offtype, MLtype; /* compressed, raw or rle */
const seqDef* const sequences = seqStorePtr->sequencesStart;
const BYTE* const ofCodeTable = seqStorePtr->ofCode;
@@ -1476,13 +1721,17 @@ MEM_STATIC size_t ZSTD_compressSequences_internal(seqStore_t* seqStorePtr,
size_t const nbSeq = seqStorePtr->sequences - seqStorePtr->sequencesStart;
BYTE* seqHead;
- ZSTD_STATIC_ASSERT(sizeof(entropy->workspace) >= (1<<MAX(MLFSELog,LLFSELog)));
+ ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<<MAX(MLFSELog,LLFSELog)));
/* Compress literals */
{ const BYTE* const literals = seqStorePtr->litStart;
size_t const litSize = seqStorePtr->lit - literals;
size_t const cSize = ZSTD_compressLiterals(
- entropy, cParams->strategy, op, dstCapacity, literals, litSize);
+ prevEntropy, nextEntropy,
+ cctxParams->cParams.strategy, cctxParams->disableLiteralCompression,
+ op, dstCapacity,
+ literals, litSize,
+ workspace, bmi2);
if (ZSTD_isError(cSize))
return cSize;
assert(cSize <= dstCapacity);
@@ -1497,7 +1746,15 @@ MEM_STATIC size_t ZSTD_compressSequences_internal(seqStore_t* seqStorePtr,
op[0] = (BYTE)((nbSeq>>8) + 0x80), op[1] = (BYTE)nbSeq, op+=2;
else
op[0]=0xFF, MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ)), op+=3;
- if (nbSeq==0) return op - ostart;
+ if (nbSeq==0) {
+ memcpy(nextEntropy->litlengthCTable, prevEntropy->litlengthCTable, sizeof(prevEntropy->litlengthCTable));
+ nextEntropy->litlength_repeatMode = prevEntropy->litlength_repeatMode;
+ memcpy(nextEntropy->offcodeCTable, prevEntropy->offcodeCTable, sizeof(prevEntropy->offcodeCTable));
+ nextEntropy->offcode_repeatMode = prevEntropy->offcode_repeatMode;
+ memcpy(nextEntropy->matchlengthCTable, prevEntropy->matchlengthCTable, sizeof(prevEntropy->matchlengthCTable));
+ nextEntropy->matchlength_repeatMode = prevEntropy->matchlength_repeatMode;
+ return op - ostart;
+ }
/* seqHead : flags for FSE encoding type */
seqHead = op++;
@@ -1506,36 +1763,42 @@ MEM_STATIC size_t ZSTD_compressSequences_internal(seqStore_t* seqStorePtr,
ZSTD_seqToCodes(seqStorePtr);
/* build CTable for Literal Lengths */
{ U32 max = MaxLL;
- size_t const mostFrequent = FSE_countFast_wksp(count, &max, llCodeTable, nbSeq, entropy->workspace);
+ size_t const mostFrequent = FSE_countFast_wksp(count, &max, llCodeTable, nbSeq, workspace);
DEBUGLOG(5, "Building LL table");
- LLtype = ZSTD_selectEncodingType(&entropy->litlength_repeatMode, mostFrequent, nbSeq, LL_defaultNormLog, ZSTD_defaultAllowed);
+ nextEntropy->litlength_repeatMode = prevEntropy->litlength_repeatMode;
+ LLtype = ZSTD_selectEncodingType(&nextEntropy->litlength_repeatMode, mostFrequent, nbSeq, LL_defaultNormLog, ZSTD_defaultAllowed);
{ size_t const countSize = ZSTD_buildCTable(op, oend - op, CTable_LitLength, LLFSELog, (symbolEncodingType_e)LLtype,
count, max, llCodeTable, nbSeq, LL_defaultNorm, LL_defaultNormLog, MaxLL,
- entropy->workspace, sizeof(entropy->workspace));
+ prevEntropy->litlengthCTable, sizeof(prevEntropy->litlengthCTable),
+ workspace, HUF_WORKSPACE_SIZE);
if (ZSTD_isError(countSize)) return countSize;
op += countSize;
} }
/* build CTable for Offsets */
{ U32 max = MaxOff;
- size_t const mostFrequent = FSE_countFast_wksp(count, &max, ofCodeTable, nbSeq, entropy->workspace);
+ size_t const mostFrequent = FSE_countFast_wksp(count, &max, ofCodeTable, nbSeq, workspace);
/* We can only use the basic table if max <= DefaultMaxOff, otherwise the offsets are too large */
ZSTD_defaultPolicy_e const defaultPolicy = (max <= DefaultMaxOff) ? ZSTD_defaultAllowed : ZSTD_defaultDisallowed;
DEBUGLOG(5, "Building OF table");
- Offtype = ZSTD_selectEncodingType(&entropy->offcode_repeatMode, mostFrequent, nbSeq, OF_defaultNormLog, defaultPolicy);
+ nextEntropy->offcode_repeatMode = prevEntropy->offcode_repeatMode;
+ Offtype = ZSTD_selectEncodingType(&nextEntropy->offcode_repeatMode, mostFrequent, nbSeq, OF_defaultNormLog, defaultPolicy);
{ size_t const countSize = ZSTD_buildCTable(op, oend - op, CTable_OffsetBits, OffFSELog, (symbolEncodingType_e)Offtype,
count, max, ofCodeTable, nbSeq, OF_defaultNorm, OF_defaultNormLog, DefaultMaxOff,
- entropy->workspace, sizeof(entropy->workspace));
+ prevEntropy->offcodeCTable, sizeof(prevEntropy->offcodeCTable),
+ workspace, HUF_WORKSPACE_SIZE);
if (ZSTD_isError(countSize)) return countSize;
op += countSize;
} }
/* build CTable for MatchLengths */
{ U32 max = MaxML;
- size_t const mostFrequent = FSE_countFast_wksp(count, &max, mlCodeTable, nbSeq, entropy->workspace);
+ size_t const mostFrequent = FSE_countFast_wksp(count, &max, mlCodeTable, nbSeq, workspace);
DEBUGLOG(5, "Building ML table");
- MLtype = ZSTD_selectEncodingType(&entropy->matchlength_repeatMode, mostFrequent, nbSeq, ML_defaultNormLog, ZSTD_defaultAllowed);
+ nextEntropy->matchlength_repeatMode = prevEntropy->matchlength_repeatMode;
+ MLtype = ZSTD_selectEncodingType(&nextEntropy->matchlength_repeatMode, mostFrequent, nbSeq, ML_defaultNormLog, ZSTD_defaultAllowed);
{ size_t const countSize = ZSTD_buildCTable(op, oend - op, CTable_MatchLength, MLFSELog, (symbolEncodingType_e)MLtype,
count, max, mlCodeTable, nbSeq, ML_defaultNorm, ML_defaultNormLog, MaxML,
- entropy->workspace, sizeof(entropy->workspace));
+ prevEntropy->matchlengthCTable, sizeof(prevEntropy->matchlengthCTable),
+ workspace, HUF_WORKSPACE_SIZE);
if (ZSTD_isError(countSize)) return countSize;
op += countSize;
} }
@@ -1548,7 +1811,7 @@ MEM_STATIC size_t ZSTD_compressSequences_internal(seqStore_t* seqStorePtr,
CTable_OffsetBits, ofCodeTable,
CTable_LitLength, llCodeTable,
sequences, nbSeq,
- longOffsets);
+ longOffsets, bmi2);
if (ZSTD_isError(bitstreamSize)) return bitstreamSize;
op += bitstreamSize;
}
@@ -1557,48 +1820,40 @@ MEM_STATIC size_t ZSTD_compressSequences_internal(seqStore_t* seqStorePtr,
}
MEM_STATIC size_t ZSTD_compressSequences(seqStore_t* seqStorePtr,
- ZSTD_entropyCTables_t* entropy,
- ZSTD_compressionParameters const* cParams,
+ ZSTD_entropyCTables_t const* prevEntropy,
+ ZSTD_entropyCTables_t* nextEntropy,
+ ZSTD_CCtx_params const* cctxParams,
void* dst, size_t dstCapacity,
- size_t srcSize)
+ size_t srcSize, U32* workspace, int bmi2)
{
- size_t const cSize = ZSTD_compressSequences_internal(seqStorePtr, entropy, cParams,
- dst, dstCapacity);
- /* If the srcSize <= dstCapacity, then there is enough space to write a
- * raw uncompressed block. Since we ran out of space, the block must not
- * be compressible, so fall back to a raw uncompressed block.
+ size_t const cSize = ZSTD_compressSequences_internal(
+ seqStorePtr, prevEntropy, nextEntropy, cctxParams, dst, dstCapacity,
+ workspace, bmi2);
+ /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block.
+ * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block.
*/
- int const uncompressibleError = (cSize == ERROR(dstSize_tooSmall)) && (srcSize <= dstCapacity);
- if (ZSTD_isError(cSize) && !uncompressibleError)
- return cSize;
+ if ((cSize == ERROR(dstSize_tooSmall)) & (srcSize <= dstCapacity))
+ return 0; /* block not compressed */
+ if (ZSTD_isError(cSize)) return cSize;
+
+ /* Check compressibility */
+ { size_t const maxCSize = srcSize - ZSTD_minGain(srcSize); /* note : fixed formula, maybe should depend on compression level, or strategy */
+ if (cSize >= maxCSize) return 0; /* block not compressed */
+ }
+
/* We check that dictionaries have offset codes available for the first
* block. After the first block, the offcode table might not have large
* enough codes to represent the offsets in the data.
*/
- if (entropy->offcode_repeatMode == FSE_repeat_valid)
- entropy->offcode_repeatMode = FSE_repeat_check;
-
- /* Check compressibility */
- { size_t const minGain = ZSTD_minGain(srcSize); /* note : fixed formula, maybe should depend on compression level, or strategy */
- size_t const maxCSize = srcSize - minGain;
- if (cSize >= maxCSize || uncompressibleError) {
- entropy->hufCTable_repeatMode = HUF_repeat_none;
- entropy->offcode_repeatMode = FSE_repeat_none;
- entropy->matchlength_repeatMode = FSE_repeat_none;
- entropy->litlength_repeatMode = FSE_repeat_none;
- return 0; /* block not compressed */
- } }
- assert(!ZSTD_isError(cSize));
+ if (nextEntropy->offcode_repeatMode == FSE_repeat_valid)
+ nextEntropy->offcode_repeatMode = FSE_repeat_check;
- /* block is compressed => confirm repcodes in history */
- { int i; for (i=0; i<ZSTD_REP_NUM; i++) seqStorePtr->rep[i] = seqStorePtr->repToConfirm[i]; }
return cSize;
}
/* ZSTD_selectBlockCompressor() :
* Not static, but internal use only (used by long distance matcher)
* assumption : strat is a valid strategy */
-typedef size_t (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, const void* src, size_t srcSize);
ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict)
{
static const ZSTD_blockCompressor blockCompressor[2][(unsigned)ZSTD_btultra+1] = {
@@ -1632,32 +1887,83 @@ static void ZSTD_resetSeqStore(seqStore_t* ssPtr)
ssPtr->longLengthID = 0;
}
-static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, const void* src, size_t srcSize)
+static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
+ void* dst, size_t dstCapacity,
+ const void* src, size_t srcSize)
{
- DEBUGLOG(5, "ZSTD_compressBlock_internal : dstCapacity = %u", (U32)dstCapacity);
- if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1)
+ ZSTD_matchState_t* const ms = &zc->blockState.matchState;
+ DEBUGLOG(5, "ZSTD_compressBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)",
+ (U32)dstCapacity, ms->window.dictLimit, ms->nextToUpdate);
+ if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) {
+ ZSTD_ldm_skipSequences(&zc->externSeqStore, srcSize, zc->appliedParams.cParams.searchLength);
return 0; /* don't even attempt compression below a certain srcSize */
+ }
ZSTD_resetSeqStore(&(zc->seqStore));
/* limited update after a very long match */
- { const BYTE* const base = zc->base;
+ { const BYTE* const base = ms->window.base;
const BYTE* const istart = (const BYTE*)src;
const U32 current = (U32)(istart-base);
- if (current > zc->nextToUpdate + 384)
- zc->nextToUpdate = current - MIN(192, (U32)(current - zc->nextToUpdate - 384));
+ if (current > ms->nextToUpdate + 384)
+ ms->nextToUpdate = current - MIN(192, (U32)(current - ms->nextToUpdate - 384));
}
- /* find and store sequences */
- { U32 const extDict = zc->lowLimit < zc->dictLimit;
- const ZSTD_blockCompressor blockCompressor =
- zc->appliedParams.ldmParams.enableLdm
- ? (extDict ? ZSTD_compressBlock_ldm_extDict : ZSTD_compressBlock_ldm)
- : ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, extDict);
- size_t const lastLLSize = blockCompressor(zc, src, srcSize);
- const BYTE* const anchor = (const BYTE*)src + srcSize - lastLLSize;
- ZSTD_storeLastLiterals(&zc->seqStore, anchor, lastLLSize);
+
+ /* select and store sequences */
+ { U32 const extDict = ZSTD_window_hasExtDict(ms->window);
+ size_t lastLLSize;
+ { int i;
+ for (i = 0; i < ZSTD_REP_NUM; ++i)
+ zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i];
+ }
+ if (zc->externSeqStore.pos < zc->externSeqStore.size) {
+ assert(!zc->appliedParams.ldmParams.enableLdm);
+ /* Updates ldmSeqStore.pos */
+ lastLLSize =
+ ZSTD_ldm_blockCompress(&zc->externSeqStore,
+ ms, &zc->seqStore,
+ zc->blockState.nextCBlock->rep,
+ &zc->appliedParams.cParams,
+ src, srcSize, extDict);
+ assert(zc->externSeqStore.pos <= zc->externSeqStore.size);
+ } else if (zc->appliedParams.ldmParams.enableLdm) {
+ rawSeqStore_t ldmSeqStore = {NULL, 0, 0, 0};
+
+ ldmSeqStore.seq = zc->ldmSequences;
+ ldmSeqStore.capacity = zc->maxNbLdmSequences;
+ /* Updates ldmSeqStore.size */
+ CHECK_F(ZSTD_ldm_generateSequences(&zc->ldmState, &ldmSeqStore,
+ &zc->appliedParams.ldmParams,
+ src, srcSize));
+ /* Updates ldmSeqStore.pos */
+ lastLLSize =
+ ZSTD_ldm_blockCompress(&ldmSeqStore,
+ ms, &zc->seqStore,
+ zc->blockState.nextCBlock->rep,
+ &zc->appliedParams.cParams,
+ src, srcSize, extDict);
+ assert(ldmSeqStore.pos == ldmSeqStore.size);
+ } else { /* not long range mode */
+ ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, extDict);
+ lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, &zc->appliedParams.cParams, src, srcSize);
+ }
+ { const BYTE* const lastLiterals = (const BYTE*)src + srcSize - lastLLSize;
+ ZSTD_storeLastLiterals(&zc->seqStore, lastLiterals, lastLLSize);
+ } }
+
+ /* encode sequences and literals */
+ { size_t const cSize = ZSTD_compressSequences(&zc->seqStore,
+ &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy,
+ &zc->appliedParams,
+ dst, dstCapacity,
+ srcSize, zc->entropyWorkspace, zc->bmi2);
+ if (ZSTD_isError(cSize) || cSize == 0) return cSize;
+ /* confirm repcodes and entropy tables */
+ { ZSTD_compressedBlockState_t* const tmp = zc->blockState.prevCBlock;
+ zc->blockState.prevCBlock = zc->blockState.nextCBlock;
+ zc->blockState.nextCBlock = tmp;
+ }
+ return cSize;
}
- /* encode */
- return ZSTD_compressSequences(&zc->seqStore, zc->entropy, &zc->appliedParams.cParams, dst, dstCapacity, srcSize);
}
@@ -1686,54 +1992,27 @@ static size_t ZSTD_compress_frameChunk (ZSTD_CCtx* cctx,
XXH64_update(&cctx->xxhState, src, srcSize);
while (remaining) {
+ ZSTD_matchState_t* const ms = &cctx->blockState.matchState;
U32 const lastBlock = lastFrameChunk & (blockSize >= remaining);
if (dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE)
return ERROR(dstSize_tooSmall); /* not enough space to store compressed block */
if (remaining < blockSize) blockSize = remaining;
- /* preemptive overflow correction:
- * 1. correction is large enough:
- * lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog - blockSize
- * 1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog
- *
- * current - newCurrent
- * > (3<<29 + 1<<windowLog - blockSize) - (1<<windowLog + 1<<chainLog)
- * > (3<<29 - blockSize) - (1<<chainLog)
- * > (3<<29 - blockSize) - (1<<30) (NOTE: chainLog <= 30)
- * > 1<<29 - 1<<17
- *
- * 2. (ip+blockSize - cctx->base) doesn't overflow:
- * In 32 bit mode we limit windowLog to 30 so we don't get
- * differences larger than 1<<31-1.
- * 3. cctx->lowLimit < 1<<32:
- * windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32.
- */
- if (cctx->lowLimit > (3U<<29)) {
- U32 const cycleMask = ((U32)1 << ZSTD_cycleLog(cctx->appliedParams.cParams.chainLog, cctx->appliedParams.cParams.strategy)) - 1;
- U32 const current = (U32)(ip - cctx->base);
- U32 const newCurrent = (current & cycleMask) + ((U32)1 << cctx->appliedParams.cParams.windowLog);
- U32 const correction = current - newCurrent;
+ if (ZSTD_window_needOverflowCorrection(ms->window, ip + blockSize)) {
+ U32 const cycleLog = ZSTD_cycleLog(cctx->appliedParams.cParams.chainLog, cctx->appliedParams.cParams.strategy);
+ U32 const correction = ZSTD_window_correctOverflow(&ms->window, cycleLog, maxDist, ip);
ZSTD_STATIC_ASSERT(ZSTD_CHAINLOG_MAX <= 30);
ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX_32 <= 30);
ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX <= 31);
- assert(current > newCurrent);
- assert(correction > 1<<28); /* Loose bound, should be about 1<<29 */
+
ZSTD_reduceIndex(cctx, correction);
- cctx->base += correction;
- cctx->dictBase += correction;
- cctx->lowLimit -= correction;
- cctx->dictLimit -= correction;
- if (cctx->nextToUpdate < correction) cctx->nextToUpdate = 0;
- else cctx->nextToUpdate -= correction;
- DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x\n", correction, cctx->lowLimit);
- }
- /* enforce maxDist */
- if ((U32)(ip+blockSize - cctx->base) > cctx->loadedDictEnd + maxDist) {
- U32 const newLowLimit = (U32)(ip+blockSize - cctx->base) - maxDist;
- if (cctx->lowLimit < newLowLimit) cctx->lowLimit = newLowLimit;
- if (cctx->dictLimit < cctx->lowLimit) cctx->dictLimit = cctx->lowLimit;
+ if (ms->nextToUpdate < correction) ms->nextToUpdate = 0;
+ else ms->nextToUpdate -= correction;
+ ms->loadedDictEnd = 0;
}
+ ZSTD_window_enforceMaxDist(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd);
+ if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit;
{ size_t cSize = ZSTD_compressBlock_internal(cctx,
op+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize,
@@ -1810,16 +2089,44 @@ static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity,
return pos;
}
+/* ZSTD_writeLastEmptyBlock() :
+ * output an empty Block with end-of-frame mark to complete a frame
+ * @return : size of data written into `dst` (== ZSTD_blockHeaderSize (defined in zstd_internal.h))
+ * or an error code if `dstCapcity` is too small (<ZSTD_blockHeaderSize)
+ */
+size_t ZSTD_writeLastEmptyBlock(void* dst, size_t dstCapacity)
+{
+ if (dstCapacity < ZSTD_blockHeaderSize) return ERROR(dstSize_tooSmall);
+ { U32 const cBlockHeader24 = 1 /*lastBlock*/ + (((U32)bt_raw)<<1); /* 0 size */
+ MEM_writeLE24(dst, cBlockHeader24);
+ return ZSTD_blockHeaderSize;
+ }
+}
+
+size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq)
+{
+ if (cctx->stage != ZSTDcs_init)
+ return ERROR(stage_wrong);
+ if (cctx->appliedParams.ldmParams.enableLdm)
+ return ERROR(parameter_unsupported);
+ cctx->externSeqStore.seq = seq;
+ cctx->externSeqStore.size = nbSeq;
+ cctx->externSeqStore.capacity = nbSeq;
+ cctx->externSeqStore.pos = 0;
+ return 0;
+}
+
static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize,
U32 frame, U32 lastFrameChunk)
{
- const BYTE* const ip = (const BYTE*) src;
+ ZSTD_matchState_t* ms = &cctx->blockState.matchState;
size_t fhSize = 0;
- DEBUGLOG(5, "ZSTD_compressContinue_internal, stage: %u", cctx->stage);
+ DEBUGLOG(5, "ZSTD_compressContinue_internal, stage: %u, srcSize: %u",
+ cctx->stage, (U32)srcSize);
if (cctx->stage==ZSTDcs_created) return ERROR(stage_wrong); /* missing init (ZSTD_compressBegin) */
if (frame && (cctx->stage==ZSTDcs_init)) {
@@ -1833,26 +2140,11 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx,
if (!srcSize) return fhSize; /* do not generate an empty block if no input */
- /* Check if blocks follow each other */
- if (src != cctx->nextSrc) {
- /* not contiguous */
- size_t const distanceFromBase = (size_t)(cctx->nextSrc - cctx->base);
- cctx->lowLimit = cctx->dictLimit;
- assert(distanceFromBase == (size_t)(U32)distanceFromBase); /* should never overflow */
- cctx->dictLimit = (U32)distanceFromBase;
- cctx->dictBase = cctx->base;
- cctx->base = ip - distanceFromBase;
- cctx->nextToUpdate = cctx->dictLimit;
- if (cctx->dictLimit - cctx->lowLimit < HASH_READ_SIZE) cctx->lowLimit = cctx->dictLimit; /* too small extDict */
- }
- cctx->nextSrc = ip + srcSize;
-
- /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */
- if ((ip+srcSize > cctx->dictBase + cctx->lowLimit) & (ip < cctx->dictBase + cctx->dictLimit)) {
- ptrdiff_t const highInputIdx = (ip + srcSize) - cctx->dictBase;
- U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)cctx->dictLimit) ? cctx->dictLimit : (U32)highInputIdx;
- cctx->lowLimit = lowLimitMax;
+ if (!ZSTD_window_update(&ms->window, src, srcSize)) {
+ ms->nextToUpdate = ms->window.dictLimit;
}
+ if (cctx->appliedParams.ldmParams.enableLdm)
+ ZSTD_window_update(&cctx->ldmState.window, src, srcSize);
DEBUGLOG(5, "ZSTD_compressContinue_internal (blockSize=%u)", (U32)cctx->blockSize);
{ size_t const cSize = frame ?
@@ -1860,6 +2152,14 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx,
ZSTD_compressBlock_internal (cctx, dst, dstCapacity, src, srcSize);
if (ZSTD_isError(cSize)) return cSize;
cctx->consumedSrcSize += srcSize;
+ cctx->producedCSize += (cSize + fhSize);
+ if (cctx->appliedParams.fParams.contentSizeFlag) { /* control src size */
+ if (cctx->consumedSrcSize+1 > cctx->pledgedSrcSizePlusOne) {
+ DEBUGLOG(4, "error : pledgedSrcSize = %u, while realSrcSize >= %u",
+ (U32)cctx->pledgedSrcSizePlusOne-1, (U32)cctx->consumedSrcSize);
+ return ERROR(srcSize_wrong);
+ }
+ }
return cSize + fhSize;
}
}
@@ -1868,14 +2168,15 @@ size_t ZSTD_compressContinue (ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize)
{
+ DEBUGLOG(5, "ZSTD_compressContinue (srcSize=%u)", (U32)srcSize);
return ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 1 /* frame mode */, 0 /* last chunk */);
}
size_t ZSTD_getBlockSize(const ZSTD_CCtx* cctx)
{
- ZSTD_compressionParameters const cParams =
- ZSTD_getCParamsFromCCtxParams(cctx->appliedParams, 0, 0);
+ ZSTD_compressionParameters const cParams = cctx->appliedParams.cParams;
+ assert(!ZSTD_checkCParams(cParams));
return MIN (ZSTD_BLOCKSIZE_MAX, (U32)1 << cParams.windowLog);
}
@@ -1889,50 +2190,45 @@ size_t ZSTD_compressBlock(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const
/*! ZSTD_loadDictionaryContent() :
* @return : 0, or an error code
*/
-static size_t ZSTD_loadDictionaryContent(ZSTD_CCtx* zc, const void* src, size_t srcSize)
+static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, ZSTD_CCtx_params const* params, const void* src, size_t srcSize)
{
const BYTE* const ip = (const BYTE*) src;
const BYTE* const iend = ip + srcSize;
+ ZSTD_compressionParameters const* cParams = &params->cParams;
- /* input becomes current prefix */
- zc->lowLimit = zc->dictLimit;
- zc->dictLimit = (U32)(zc->nextSrc - zc->base);
- zc->dictBase = zc->base;
- zc->base = ip - zc->dictLimit;
- zc->nextToUpdate = zc->dictLimit;
- zc->loadedDictEnd = zc->appliedParams.forceWindow ? 0 : (U32)(iend - zc->base);
+ ZSTD_window_update(&ms->window, src, srcSize);
+ ms->loadedDictEnd = params->forceWindow ? 0 : (U32)(iend - ms->window.base);
- zc->nextSrc = iend;
if (srcSize <= HASH_READ_SIZE) return 0;
- switch(zc->appliedParams.cParams.strategy)
+ switch(params->cParams.strategy)
{
case ZSTD_fast:
- ZSTD_fillHashTable (zc, iend, zc->appliedParams.cParams.searchLength);
+ ZSTD_fillHashTable(ms, cParams, iend);
break;
case ZSTD_dfast:
- ZSTD_fillDoubleHashTable (zc, iend, zc->appliedParams.cParams.searchLength);
+ ZSTD_fillDoubleHashTable(ms, cParams, iend);
break;
case ZSTD_greedy:
case ZSTD_lazy:
case ZSTD_lazy2:
if (srcSize >= HASH_READ_SIZE)
- ZSTD_insertAndFindFirstIndex(zc, iend-HASH_READ_SIZE, zc->appliedParams.cParams.searchLength);
+ ZSTD_insertAndFindFirstIndex(ms, cParams, iend-HASH_READ_SIZE);
break;
- case ZSTD_btlazy2:
+ case ZSTD_btlazy2: /* we want the dictionary table fully sorted */
case ZSTD_btopt:
case ZSTD_btultra:
if (srcSize >= HASH_READ_SIZE)
- ZSTD_updateTree(zc, iend-HASH_READ_SIZE, iend, (U32)1 << zc->appliedParams.cParams.searchLog, zc->appliedParams.cParams.searchLength);
+ ZSTD_updateTree(ms, cParams, iend-HASH_READ_SIZE, iend);
break;
default:
assert(0); /* not possible : not a valid strategy id */
}
- zc->nextToUpdate = (U32)(iend - zc->base);
+ ms->nextToUpdate = (U32)(iend - ms->window.base);
return 0;
}
@@ -1956,25 +2252,26 @@ static size_t ZSTD_checkDictNCount(short* normalizedCounter, unsigned dictMaxSym
* https://github.com/facebook/zstd/blob/master/doc/zstd_compression_format.md#dictionary-format
*/
/*! ZSTD_loadZstdDictionary() :
- * @return : 0, or an error code
+ * @return : dictID, or an error code
* assumptions : magic number supposed already checked
* dictSize supposed > 8
*/
-static size_t ZSTD_loadZstdDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize)
+static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, ZSTD_matchState_t* ms, ZSTD_CCtx_params const* params, const void* dict, size_t dictSize, void* workspace)
{
const BYTE* dictPtr = (const BYTE*)dict;
const BYTE* const dictEnd = dictPtr + dictSize;
short offcodeNCount[MaxOff+1];
unsigned offcodeMaxValue = MaxOff;
+ size_t dictID;
- ZSTD_STATIC_ASSERT(sizeof(cctx->entropy->workspace) >= (1<<MAX(MLFSELog,LLFSELog)));
+ ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<<MAX(MLFSELog,LLFSELog)));
dictPtr += 4; /* skip magic number */
- cctx->dictID = cctx->appliedParams.fParams.noDictIDFlag ? 0 : MEM_readLE32(dictPtr);
+ dictID = params->fParams.noDictIDFlag ? 0 : MEM_readLE32(dictPtr);
dictPtr += 4;
{ unsigned maxSymbolValue = 255;
- size_t const hufHeaderSize = HUF_readCTable((HUF_CElt*)cctx->entropy->hufCTable, &maxSymbolValue, dictPtr, dictEnd-dictPtr);
+ size_t const hufHeaderSize = HUF_readCTable((HUF_CElt*)bs->entropy.hufCTable, &maxSymbolValue, dictPtr, dictEnd-dictPtr);
if (HUF_isError(hufHeaderSize)) return ERROR(dictionary_corrupted);
if (maxSymbolValue < 255) return ERROR(dictionary_corrupted);
dictPtr += hufHeaderSize;
@@ -1985,7 +2282,7 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_CCtx* cctx, const void* dict, size_t
if (FSE_isError(offcodeHeaderSize)) return ERROR(dictionary_corrupted);
if (offcodeLog > OffFSELog) return ERROR(dictionary_corrupted);
/* Defer checking offcodeMaxValue because we need to know the size of the dictionary content */
- CHECK_E( FSE_buildCTable_wksp(cctx->entropy->offcodeCTable, offcodeNCount, offcodeMaxValue, offcodeLog, cctx->entropy->workspace, sizeof(cctx->entropy->workspace)),
+ CHECK_E( FSE_buildCTable_wksp(bs->entropy.offcodeCTable, offcodeNCount, offcodeMaxValue, offcodeLog, workspace, HUF_WORKSPACE_SIZE),
dictionary_corrupted);
dictPtr += offcodeHeaderSize;
}
@@ -1997,7 +2294,7 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_CCtx* cctx, const void* dict, size_t
if (matchlengthLog > MLFSELog) return ERROR(dictionary_corrupted);
/* Every match length code must have non-zero probability */
CHECK_F( ZSTD_checkDictNCount(matchlengthNCount, matchlengthMaxValue, MaxML));
- CHECK_E( FSE_buildCTable_wksp(cctx->entropy->matchlengthCTable, matchlengthNCount, matchlengthMaxValue, matchlengthLog, cctx->entropy->workspace, sizeof(cctx->entropy->workspace)),
+ CHECK_E( FSE_buildCTable_wksp(bs->entropy.matchlengthCTable, matchlengthNCount, matchlengthMaxValue, matchlengthLog, workspace, HUF_WORKSPACE_SIZE),
dictionary_corrupted);
dictPtr += matchlengthHeaderSize;
}
@@ -2009,15 +2306,15 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_CCtx* cctx, const void* dict, size_t
if (litlengthLog > LLFSELog) return ERROR(dictionary_corrupted);
/* Every literal length code must have non-zero probability */
CHECK_F( ZSTD_checkDictNCount(litlengthNCount, litlengthMaxValue, MaxLL));
- CHECK_E( FSE_buildCTable_wksp(cctx->entropy->litlengthCTable, litlengthNCount, litlengthMaxValue, litlengthLog, cctx->entropy->workspace, sizeof(cctx->entropy->workspace)),
+ CHECK_E( FSE_buildCTable_wksp(bs->entropy.litlengthCTable, litlengthNCount, litlengthMaxValue, litlengthLog, workspace, HUF_WORKSPACE_SIZE),
dictionary_corrupted);
dictPtr += litlengthHeaderSize;
}
if (dictPtr+12 > dictEnd) return ERROR(dictionary_corrupted);
- cctx->seqStore.rep[0] = MEM_readLE32(dictPtr+0);
- cctx->seqStore.rep[1] = MEM_readLE32(dictPtr+4);
- cctx->seqStore.rep[2] = MEM_readLE32(dictPtr+8);
+ bs->rep[0] = MEM_readLE32(dictPtr+0);
+ bs->rep[1] = MEM_readLE32(dictPtr+4);
+ bs->rep[2] = MEM_readLE32(dictPtr+8);
dictPtr += 12;
{ size_t const dictContentSize = (size_t)(dictEnd - dictPtr);
@@ -2031,50 +2328,55 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_CCtx* cctx, const void* dict, size_t
/* All repCodes must be <= dictContentSize and != 0*/
{ U32 u;
for (u=0; u<3; u++) {
- if (cctx->seqStore.rep[u] == 0) return ERROR(dictionary_corrupted);
- if (cctx->seqStore.rep[u] > dictContentSize) return ERROR(dictionary_corrupted);
+ if (bs->rep[u] == 0) return ERROR(dictionary_corrupted);
+ if (bs->rep[u] > dictContentSize) return ERROR(dictionary_corrupted);
} }
- cctx->entropy->hufCTable_repeatMode = HUF_repeat_valid;
- cctx->entropy->offcode_repeatMode = FSE_repeat_valid;
- cctx->entropy->matchlength_repeatMode = FSE_repeat_valid;
- cctx->entropy->litlength_repeatMode = FSE_repeat_valid;
- return ZSTD_loadDictionaryContent(cctx, dictPtr, dictContentSize);
+ bs->entropy.hufCTable_repeatMode = HUF_repeat_valid;
+ bs->entropy.offcode_repeatMode = FSE_repeat_valid;
+ bs->entropy.matchlength_repeatMode = FSE_repeat_valid;
+ bs->entropy.litlength_repeatMode = FSE_repeat_valid;
+ CHECK_F(ZSTD_loadDictionaryContent(ms, params, dictPtr, dictContentSize));
+ return dictID;
}
}
/** ZSTD_compress_insertDictionary() :
-* @return : 0, or an error code */
-static size_t ZSTD_compress_insertDictionary(ZSTD_CCtx* cctx,
+* @return : dictID, or an error code */
+static size_t ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, ZSTD_matchState_t* ms,
+ ZSTD_CCtx_params const* params,
const void* dict, size_t dictSize,
- ZSTD_dictMode_e dictMode)
+ ZSTD_dictContentType_e dictContentType,
+ void* workspace)
{
DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize);
if ((dict==NULL) || (dictSize<=8)) return 0;
+ ZSTD_reset_compressedBlockState(bs);
+
/* dict restricted modes */
- if (dictMode==ZSTD_dm_rawContent)
- return ZSTD_loadDictionaryContent(cctx, dict, dictSize);
+ if (dictContentType == ZSTD_dct_rawContent)
+ return ZSTD_loadDictionaryContent(ms, params, dict, dictSize);
if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) {
- if (dictMode == ZSTD_dm_auto) {
+ if (dictContentType == ZSTD_dct_auto) {
DEBUGLOG(4, "raw content dictionary detected");
- return ZSTD_loadDictionaryContent(cctx, dict, dictSize);
+ return ZSTD_loadDictionaryContent(ms, params, dict, dictSize);
}
- if (dictMode == ZSTD_dm_fullDict)
+ if (dictContentType == ZSTD_dct_fullDict)
return ERROR(dictionary_wrong);
assert(0); /* impossible */
}
/* dict as full zstd dictionary */
- return ZSTD_loadZstdDictionary(cctx, dict, dictSize);
+ return ZSTD_loadZstdDictionary(bs, ms, params, dict, dictSize, workspace);
}
/*! ZSTD_compressBegin_internal() :
* @return : 0, or an error code */
size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
const void* dict, size_t dictSize,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
const ZSTD_CDict* cdict,
ZSTD_CCtx_params params, U64 pledgedSrcSize,
ZSTD_buffered_policy_e zbuff)
@@ -2086,19 +2388,26 @@ size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
if (cdict && cdict->dictContentSize>0) {
cctx->requestedParams = params;
- return ZSTD_copyCCtx_internal(cctx, cdict->refContext,
- params.cParams.windowLog, params.fParams, pledgedSrcSize,
- zbuff);
+ return ZSTD_resetCCtx_usingCDict(cctx, cdict, params.cParams.windowLog,
+ params.fParams, pledgedSrcSize, zbuff);
}
CHECK_F( ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,
ZSTDcrp_continue, zbuff) );
- return ZSTD_compress_insertDictionary(cctx, dict, dictSize, dictMode);
+ {
+ size_t const dictID = ZSTD_compress_insertDictionary(
+ cctx->blockState.prevCBlock, &cctx->blockState.matchState,
+ &params, dict, dictSize, dictContentType, cctx->entropyWorkspace);
+ if (ZSTD_isError(dictID)) return dictID;
+ assert(dictID <= (size_t)(U32)-1);
+ cctx->dictID = (U32)dictID;
+ }
+ return 0;
}
size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
const void* dict, size_t dictSize,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
const ZSTD_CDict* cdict,
ZSTD_CCtx_params params,
unsigned long long pledgedSrcSize)
@@ -2107,7 +2416,7 @@ size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
/* compression parameters verification and optimization */
CHECK_F( ZSTD_checkCParams(params.cParams) );
return ZSTD_compressBegin_internal(cctx,
- dict, dictSize, dictMode,
+ dict, dictSize, dictContentType,
cdict,
params, pledgedSrcSize,
ZSTDb_not_buffered);
@@ -2122,18 +2431,18 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx,
ZSTD_CCtx_params const cctxParams =
ZSTD_assignParamsToCCtxParams(cctx->requestedParams, params);
return ZSTD_compressBegin_advanced_internal(cctx,
- dict, dictSize, ZSTD_dm_auto,
+ dict, dictSize, ZSTD_dct_auto,
NULL /*cdict*/,
cctxParams, pledgedSrcSize);
}
size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel)
{
- ZSTD_parameters const params = ZSTD_getParams(compressionLevel, 0, dictSize);
+ ZSTD_parameters const params = ZSTD_getParams(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize);
ZSTD_CCtx_params const cctxParams =
ZSTD_assignParamsToCCtxParams(cctx->requestedParams, params);
- DEBUGLOG(4, "ZSTD_compressBegin_usingDict");
- return ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dm_auto, NULL,
+ DEBUGLOG(4, "ZSTD_compressBegin_usingDict (dictSize=%u)", (U32)dictSize);
+ return ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, NULL,
cctxParams, ZSTD_CONTENTSIZE_UNKNOWN, ZSTDb_not_buffered);
}
@@ -2152,7 +2461,7 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity)
BYTE* op = ostart;
size_t fhSize = 0;
- DEBUGLOG(5, "ZSTD_writeEpilogue");
+ DEBUGLOG(4, "ZSTD_writeEpilogue");
if (cctx->stage == ZSTDcs_created) return ERROR(stage_wrong); /* init missing */
/* special case : empty frame */
@@ -2176,6 +2485,7 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity)
if (cctx->appliedParams.fParams.checksumFlag) {
U32 const checksum = (U32) XXH64_digest(&cctx->xxhState);
if (dstCapacity<4) return ERROR(dstSize_tooSmall);
+ DEBUGLOG(4, "ZSTD_writeEpilogue: write checksum : %08X", checksum);
MEM_writeLE32(op, checksum);
op += 4;
}
@@ -2184,7 +2494,6 @@ static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity)
return op-ostart;
}
-
size_t ZSTD_compressEnd (ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize)
@@ -2242,25 +2551,27 @@ size_t ZSTD_compress_advanced_internal(
const void* dict,size_t dictSize,
ZSTD_CCtx_params params)
{
- DEBUGLOG(4, "ZSTD_compress_advanced_internal");
- CHECK_F( ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dm_auto, NULL,
+ DEBUGLOG(4, "ZSTD_compress_advanced_internal (srcSize:%u)",
+ (U32)srcSize);
+ CHECK_F( ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, NULL,
params, srcSize, ZSTDb_not_buffered) );
return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize);
}
-size_t ZSTD_compress_usingDict(ZSTD_CCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize,
+size_t ZSTD_compress_usingDict(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize,
const void* dict, size_t dictSize, int compressionLevel)
{
- ZSTD_parameters params = ZSTD_getParams(compressionLevel, srcSize ? srcSize : 1, dict ? dictSize : 0);
- params.fParams.contentSizeFlag = 1;
- DEBUGLOG(4, "ZSTD_compress_usingDict (level=%i, srcSize=%u, dictSize=%u)",
- compressionLevel, (U32)srcSize, (U32)dictSize);
- return ZSTD_compress_internal(ctx, dst, dstCapacity, src, srcSize, dict, dictSize, params);
+ ZSTD_parameters const params = ZSTD_getParams(compressionLevel, srcSize ? srcSize : 1, dict ? dictSize : 0);
+ ZSTD_CCtx_params cctxParams = ZSTD_assignParamsToCCtxParams(cctx->requestedParams, params);
+ assert(params.fParams.contentSizeFlag == 1);
+ ZSTD_CCtxParam_setParameter(&cctxParams, ZSTD_p_compressLiterals, compressionLevel>=0);
+ return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, dict, dictSize, cctxParams);
}
-size_t ZSTD_compressCCtx (ZSTD_CCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel)
+size_t ZSTD_compressCCtx (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel)
{
- return ZSTD_compress_usingDict(ctx, dst, dstCapacity, src, srcSize, NULL, 0, compressionLevel);
+ DEBUGLOG(4, "ZSTD_compressCCtx (srcSize=%u)", (U32)srcSize);
+ return ZSTD_compress_usingDict(cctx, dst, dstCapacity, src, srcSize, NULL, 0, compressionLevel);
}
size_t ZSTD_compress(void* dst, size_t dstCapacity, const void* src, size_t srcSize, int compressionLevel)
@@ -2284,9 +2595,7 @@ size_t ZSTD_estimateCDictSize_advanced(
ZSTD_dictLoadMethod_e dictLoadMethod)
{
DEBUGLOG(5, "sizeof(ZSTD_CDict) : %u", (U32)sizeof(ZSTD_CDict));
- DEBUGLOG(5, "CCtx estimate : %u",
- (U32)ZSTD_estimateCCtxSize_usingCParams(cParams));
- return sizeof(ZSTD_CDict) + ZSTD_estimateCCtxSize_usingCParams(cParams)
+ return sizeof(ZSTD_CDict) + HUF_WORKSPACE_SIZE + ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 0)
+ (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize);
}
@@ -2300,23 +2609,24 @@ size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict)
{
if (cdict==NULL) return 0; /* support sizeof on NULL */
DEBUGLOG(5, "sizeof(*cdict) : %u", (U32)sizeof(*cdict));
- DEBUGLOG(5, "ZSTD_sizeof_CCtx : %u", (U32)ZSTD_sizeof_CCtx(cdict->refContext));
- return ZSTD_sizeof_CCtx(cdict->refContext) + (cdict->dictBuffer ? cdict->dictContentSize : 0) + sizeof(*cdict);
+ return cdict->workspaceSize + (cdict->dictBuffer ? cdict->dictContentSize : 0) + sizeof(*cdict);
}
static size_t ZSTD_initCDict_internal(
ZSTD_CDict* cdict,
const void* dictBuffer, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
ZSTD_compressionParameters cParams)
{
- DEBUGLOG(3, "ZSTD_initCDict_internal, mode %u", (U32)dictMode);
+ DEBUGLOG(3, "ZSTD_initCDict_internal, dictContentType %u", (U32)dictContentType);
+ assert(!ZSTD_checkCParams(cParams));
+ cdict->cParams = cParams;
if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dictBuffer) || (!dictSize)) {
cdict->dictBuffer = NULL;
cdict->dictContent = dictBuffer;
} else {
- void* const internalBuffer = ZSTD_malloc(dictSize, cdict->refContext->customMem);
+ void* const internalBuffer = ZSTD_malloc(dictSize, cdict->customMem);
cdict->dictBuffer = internalBuffer;
cdict->dictContent = internalBuffer;
if (!internalBuffer) return ERROR(memory_allocation);
@@ -2324,13 +2634,31 @@ static size_t ZSTD_initCDict_internal(
}
cdict->dictContentSize = dictSize;
- { ZSTD_CCtx_params cctxParams = cdict->refContext->requestedParams;
- cctxParams.cParams = cParams;
- CHECK_F( ZSTD_compressBegin_internal(cdict->refContext,
- cdict->dictContent, dictSize, dictMode,
- NULL,
- cctxParams, ZSTD_CONTENTSIZE_UNKNOWN,
- ZSTDb_not_buffered) );
+ /* Reset the state to no dictionary */
+ ZSTD_reset_compressedBlockState(&cdict->cBlockState);
+ { void* const end = ZSTD_reset_matchState(
+ &cdict->matchState,
+ (U32*)cdict->workspace + HUF_WORKSPACE_SIZE_U32,
+ &cParams, ZSTDcrp_continue, /* forCCtx */ 0);
+ assert(end == (char*)cdict->workspace + cdict->workspaceSize);
+ (void)end;
+ }
+ /* (Maybe) load the dictionary
+ * Skips loading the dictionary if it is <= 8 bytes.
+ */
+ { ZSTD_CCtx_params params;
+ memset(&params, 0, sizeof(params));
+ params.compressionLevel = ZSTD_CLEVEL_DEFAULT;
+ params.fParams.contentSizeFlag = 1;
+ params.cParams = cParams;
+ { size_t const dictID = ZSTD_compress_insertDictionary(
+ &cdict->cBlockState, &cdict->matchState, &params,
+ cdict->dictContent, cdict->dictContentSize,
+ dictContentType, cdict->workspace);
+ if (ZSTD_isError(dictID)) return dictID;
+ assert(dictID <= (size_t)(U32)-1);
+ cdict->dictID = (U32)dictID;
+ }
}
return 0;
@@ -2338,24 +2666,27 @@ static size_t ZSTD_initCDict_internal(
ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
ZSTD_compressionParameters cParams, ZSTD_customMem customMem)
{
- DEBUGLOG(3, "ZSTD_createCDict_advanced, mode %u", (U32)dictMode);
+ DEBUGLOG(3, "ZSTD_createCDict_advanced, mode %u", (U32)dictContentType);
if (!customMem.customAlloc ^ !customMem.customFree) return NULL;
{ ZSTD_CDict* const cdict = (ZSTD_CDict*)ZSTD_malloc(sizeof(ZSTD_CDict), customMem);
- ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(customMem);
+ size_t const workspaceSize = HUF_WORKSPACE_SIZE + ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 0);
+ void* const workspace = ZSTD_malloc(workspaceSize, customMem);
- if (!cdict || !cctx) {
+ if (!cdict || !workspace) {
ZSTD_free(cdict, customMem);
- ZSTD_freeCCtx(cctx);
+ ZSTD_free(workspace, customMem);
return NULL;
}
- cdict->refContext = cctx;
+ cdict->customMem = customMem;
+ cdict->workspace = workspace;
+ cdict->workspaceSize = workspaceSize;
if (ZSTD_isError( ZSTD_initCDict_internal(cdict,
dictBuffer, dictSize,
- dictLoadMethod, dictMode,
+ dictLoadMethod, dictContentType,
cParams) )) {
ZSTD_freeCDict(cdict);
return NULL;
@@ -2369,7 +2700,7 @@ ZSTD_CDict* ZSTD_createCDict(const void* dict, size_t dictSize, int compressionL
{
ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, 0, dictSize);
return ZSTD_createCDict_advanced(dict, dictSize,
- ZSTD_dlm_byCopy, ZSTD_dm_auto,
+ ZSTD_dlm_byCopy, ZSTD_dct_auto,
cParams, ZSTD_defaultCMem);
}
@@ -2377,15 +2708,15 @@ ZSTD_CDict* ZSTD_createCDict_byReference(const void* dict, size_t dictSize, int
{
ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, 0, dictSize);
return ZSTD_createCDict_advanced(dict, dictSize,
- ZSTD_dlm_byRef, ZSTD_dm_auto,
+ ZSTD_dlm_byRef, ZSTD_dct_auto,
cParams, ZSTD_defaultCMem);
}
size_t ZSTD_freeCDict(ZSTD_CDict* cdict)
{
if (cdict==NULL) return 0; /* support free on NULL */
- { ZSTD_customMem const cMem = cdict->refContext->customMem;
- ZSTD_freeCCtx(cdict->refContext);
+ { ZSTD_customMem const cMem = cdict->customMem;
+ ZSTD_free(cdict->workspace, cMem);
ZSTD_free(cdict->dictBuffer, cMem);
ZSTD_free(cdict, cMem);
return 0;
@@ -2405,18 +2736,18 @@ size_t ZSTD_freeCDict(ZSTD_CDict* cdict)
* Note : there is no corresponding "free" function.
* Since workspace was allocated externally, it must be freed externally.
*/
-ZSTD_CDict* ZSTD_initStaticCDict(void* workspace, size_t workspaceSize,
+const ZSTD_CDict* ZSTD_initStaticCDict(
+ void* workspace, size_t workspaceSize,
const void* dict, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
ZSTD_compressionParameters cParams)
{
- size_t const cctxSize = ZSTD_estimateCCtxSize_usingCParams(cParams);
+ size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 0);
size_t const neededSize = sizeof(ZSTD_CDict) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize)
- + cctxSize;
+ + HUF_WORKSPACE_SIZE + matchStateSize;
ZSTD_CDict* const cdict = (ZSTD_CDict*) workspace;
void* ptr;
- DEBUGLOG(4, "(size_t)workspace & 7 : %u", (U32)(size_t)workspace & 7);
if ((size_t)workspace & 7) return NULL; /* 8-aligned */
DEBUGLOG(4, "(workspaceSize < neededSize) : (%u < %u) => %u",
(U32)workspaceSize, (U32)neededSize, (U32)(workspaceSize < neededSize));
@@ -2429,19 +2760,22 @@ ZSTD_CDict* ZSTD_initStaticCDict(void* workspace, size_t workspaceSize,
} else {
ptr = cdict+1;
}
- cdict->refContext = ZSTD_initStaticCCtx(ptr, cctxSize);
+ cdict->workspace = ptr;
+ cdict->workspaceSize = HUF_WORKSPACE_SIZE + matchStateSize;
if (ZSTD_isError( ZSTD_initCDict_internal(cdict,
dict, dictSize,
- ZSTD_dlm_byRef, dictMode,
+ ZSTD_dlm_byRef, dictContentType,
cParams) ))
return NULL;
return cdict;
}
-ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict) {
- return cdict->refContext->appliedParams.cParams;
+ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict)
+{
+ assert(cdict != NULL);
+ return cdict->cParams;
}
/* ZSTD_compressBegin_usingCDict_advanced() :
@@ -2454,9 +2788,18 @@ size_t ZSTD_compressBegin_usingCDict_advanced(
if (cdict==NULL) return ERROR(dictionary_wrong);
{ ZSTD_CCtx_params params = cctx->requestedParams;
params.cParams = ZSTD_getCParamsFromCDict(cdict);
+ /* Increase window log to fit the entire dictionary and source if the
+ * source size is known. Limit the increase to 19, which is the
+ * window log for compression level 1 with the largest source size.
+ */
+ if (pledgedSrcSize != ZSTD_CONTENTSIZE_UNKNOWN) {
+ U32 const limitedSrcSize = (U32)MIN(pledgedSrcSize, 1U << 19);
+ U32 const limitedSrcLog = limitedSrcSize > 1 ? ZSTD_highbit32(limitedSrcSize - 1) + 1 : 1;
+ params.cParams.windowLog = MAX(params.cParams.windowLog, limitedSrcLog);
+ }
params.fParams = fParams;
return ZSTD_compressBegin_internal(cctx,
- NULL, 0, ZSTD_dm_auto,
+ NULL, 0, ZSTD_dct_auto,
cdict,
params, pledgedSrcSize,
ZSTDb_not_buffered);
@@ -2534,29 +2877,30 @@ size_t ZSTD_CStreamOutSize(void)
return ZSTD_compressBound(ZSTD_BLOCKSIZE_MAX) + ZSTD_blockHeaderSize + 4 /* 32-bits hash */ ;
}
-static size_t ZSTD_resetCStream_internal(ZSTD_CStream* zcs,
- const void* const dict, size_t const dictSize, ZSTD_dictMode_e const dictMode,
+static size_t ZSTD_resetCStream_internal(ZSTD_CStream* cctx,
+ const void* const dict, size_t const dictSize, ZSTD_dictContentType_e const dictContentType,
const ZSTD_CDict* const cdict,
ZSTD_CCtx_params const params, unsigned long long const pledgedSrcSize)
{
- DEBUGLOG(4, "ZSTD_resetCStream_internal");
+ DEBUGLOG(4, "ZSTD_resetCStream_internal (disableLiteralCompression=%i)",
+ params.disableLiteralCompression);
/* params are supposed to be fully validated at this point */
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
assert(!((dict) && (cdict))); /* either dict or cdict, not both */
- CHECK_F( ZSTD_compressBegin_internal(zcs,
- dict, dictSize, dictMode,
+ CHECK_F( ZSTD_compressBegin_internal(cctx,
+ dict, dictSize, dictContentType,
cdict,
params, pledgedSrcSize,
ZSTDb_buffered) );
- zcs->inToCompress = 0;
- zcs->inBuffPos = 0;
- zcs->inBuffTarget = zcs->blockSize
- + (zcs->blockSize == pledgedSrcSize); /* for small input: avoid automatic flush on reaching end of block, since it would require to add a 3-bytes null block to end frame */
- zcs->outBuffContentSize = zcs->outBuffFlushedSize = 0;
- zcs->streamStage = zcss_load;
- zcs->frameEnded = 0;
+ cctx->inToCompress = 0;
+ cctx->inBuffPos = 0;
+ cctx->inBuffTarget = cctx->blockSize
+ + (cctx->blockSize == pledgedSrcSize); /* for small input: avoid automatic flush on reaching end of block, since it would require to add a 3-bytes null block to end frame */
+ cctx->outBuffContentSize = cctx->outBuffFlushedSize = 0;
+ cctx->streamStage = zcss_load;
+ cctx->frameEnded = 0;
return 0; /* ready to go */
}
@@ -2568,8 +2912,8 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize)
DEBUGLOG(4, "ZSTD_resetCStream: pledgedSrcSize = %u", (U32)pledgedSrcSize);
if (pledgedSrcSize==0) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN;
params.fParams.contentSizeFlag = 1;
- params.cParams = ZSTD_getCParamsFromCCtxParams(params, pledgedSrcSize, 0);
- return ZSTD_resetCStream_internal(zcs, NULL, 0, ZSTD_dm_auto, zcs->cdict, params, pledgedSrcSize);
+ params.cParams = ZSTD_getCParamsFromCCtxParams(&params, pledgedSrcSize, 0);
+ return ZSTD_resetCStream_internal(zcs, NULL, 0, ZSTD_dct_auto, zcs->cdict, params, pledgedSrcSize);
}
/*! ZSTD_initCStream_internal() :
@@ -2592,7 +2936,7 @@ size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
}
ZSTD_freeCDict(zcs->cdictLocal);
zcs->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,
- ZSTD_dlm_byCopy, ZSTD_dm_auto,
+ ZSTD_dlm_byCopy, ZSTD_dct_auto,
params.cParams, zcs->customMem);
zcs->cdict = zcs->cdictLocal;
if (zcs->cdictLocal == NULL) return ERROR(memory_allocation);
@@ -2605,10 +2949,7 @@ size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
zcs->cdict = cdict;
}
- params.compressionLevel = ZSTD_CLEVEL_CUSTOM; /* enforce usage of cParams, instead of a dynamic derivation from cLevel (but does that happen ?) */
- zcs->requestedParams = params;
-
- return ZSTD_resetCStream_internal(zcs, NULL, 0, ZSTD_dm_auto, zcs->cdict, params, pledgedSrcSize);
+ return ZSTD_resetCStream_internal(zcs, NULL, 0, ZSTD_dct_auto, zcs->cdict, params, pledgedSrcSize);
}
/* ZSTD_initCStream_usingCDict_advanced() :
@@ -2637,20 +2978,22 @@ size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict)
return ZSTD_initCStream_usingCDict_advanced(zcs, cdict, fParams, ZSTD_CONTENTSIZE_UNKNOWN); /* note : will check that cdict != NULL */
}
+
/* ZSTD_initCStream_advanced() :
- * pledgedSrcSize must be correct.
+ * pledgedSrcSize must be exact.
* if srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN.
* dict is loaded with default parameters ZSTD_dm_auto and ZSTD_dlm_byCopy. */
size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
const void* dict, size_t dictSize,
ZSTD_parameters params, unsigned long long pledgedSrcSize)
{
- ZSTD_CCtx_params const cctxParams = ZSTD_assignParamsToCCtxParams(zcs->requestedParams, params);
DEBUGLOG(4, "ZSTD_initCStream_advanced: pledgedSrcSize=%u, flag=%u",
(U32)pledgedSrcSize, params.fParams.contentSizeFlag);
CHECK_F( ZSTD_checkCParams(params.cParams) );
if ((pledgedSrcSize==0) && (params.fParams.contentSizeFlag==0)) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* for compatibility with older programs relying on this behavior. Users should now specify ZSTD_CONTENTSIZE_UNKNOWN. This line will be removed in the future. */
- return ZSTD_initCStream_internal(zcs, dict, dictSize, NULL /*cdict*/, cctxParams, pledgedSrcSize);
+ { ZSTD_CCtx_params const cctxParams = ZSTD_assignParamsToCCtxParams(zcs->requestedParams, params);
+ return ZSTD_initCStream_internal(zcs, dict, dictSize, NULL /*cdict*/, cctxParams, pledgedSrcSize);
+ }
}
size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel)
@@ -2687,7 +3030,7 @@ MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity,
/** ZSTD_compressStream_generic():
* internal function for all *compressStream*() variants and *compress_generic()
- * non-static, because can be called from zstdmt.c
+ * non-static, because can be called from zstdmt_compress.c
* @return : hint size for next input */
size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs,
ZSTD_outBuffer* output,
@@ -2862,46 +3205,56 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
DEBUGLOG(4, "ZSTD_compress_generic : transparent init stage");
if (endOp == ZSTD_e_end) cctx->pledgedSrcSizePlusOne = input->size + 1; /* auto-fix pledgedSrcSize */
params.cParams = ZSTD_getCParamsFromCCtxParams(
- cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1, 0 /*dictSize*/);
+ &cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1, 0 /*dictSize*/);
#ifdef ZSTD_MULTITHREAD
- if ((cctx->pledgedSrcSizePlusOne-1) <= ZSTDMT_JOBSIZE_MIN)
- params.nbThreads = 1; /* do not invoke multi-threading when src size is too small */
- if (params.nbThreads > 1) {
- if (cctx->mtctx == NULL || (params.nbThreads != ZSTDMT_getNbThreads(cctx->mtctx))) {
- DEBUGLOG(4, "ZSTD_compress_generic: creating new mtctx for nbThreads=%u (previous: %u)",
- params.nbThreads, ZSTDMT_getNbThreads(cctx->mtctx));
+ if ((cctx->pledgedSrcSizePlusOne-1) <= ZSTDMT_JOBSIZE_MIN) {
+ params.nbWorkers = 0; /* do not invoke multi-threading when src size is too small */
+ }
+ if (params.nbWorkers > 0) {
+ /* mt context creation */
+ if (cctx->mtctx == NULL || (params.nbWorkers != ZSTDMT_getNbWorkers(cctx->mtctx))) {
+ DEBUGLOG(4, "ZSTD_compress_generic: creating new mtctx for nbWorkers=%u",
+ params.nbWorkers);
+ if (cctx->mtctx != NULL)
+ DEBUGLOG(4, "ZSTD_compress_generic: previous nbWorkers was %u",
+ ZSTDMT_getNbWorkers(cctx->mtctx));
ZSTDMT_freeCCtx(cctx->mtctx);
- cctx->mtctx = ZSTDMT_createCCtx_advanced(params.nbThreads, cctx->customMem);
+ cctx->mtctx = ZSTDMT_createCCtx_advanced(params.nbWorkers, cctx->customMem);
if (cctx->mtctx == NULL) return ERROR(memory_allocation);
}
- DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads);
+ /* mt compression */
+ DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbWorkers=%u", params.nbWorkers);
CHECK_F( ZSTDMT_initCStream_internal(
cctx->mtctx,
- prefixDict.dict, prefixDict.dictSize, ZSTD_dm_rawContent,
+ prefixDict.dict, prefixDict.dictSize, ZSTD_dct_rawContent,
cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
cctx->streamStage = zcss_load;
- cctx->appliedParams.nbThreads = params.nbThreads;
+ cctx->appliedParams.nbWorkers = params.nbWorkers;
} else
#endif
- { CHECK_F( ZSTD_resetCStream_internal(
- cctx, prefixDict.dict, prefixDict.dictSize,
- prefixDict.dictMode, cctx->cdict, params,
- cctx->pledgedSrcSizePlusOne-1) );
+ { CHECK_F( ZSTD_resetCStream_internal(cctx,
+ prefixDict.dict, prefixDict.dictSize, prefixDict.dictContentType,
+ cctx->cdict,
+ params, cctx->pledgedSrcSizePlusOne-1) );
assert(cctx->streamStage == zcss_load);
- assert(cctx->appliedParams.nbThreads <= 1);
+ assert(cctx->appliedParams.nbWorkers == 0);
} }
/* compression stage */
#ifdef ZSTD_MULTITHREAD
- if (cctx->appliedParams.nbThreads > 1) {
- size_t const flushMin = ZSTDMT_compressStream_generic(cctx->mtctx, output, input, endOp);
- if ( ZSTD_isError(flushMin)
- || (endOp == ZSTD_e_end && flushMin == 0) ) { /* compression completed */
- ZSTD_startNewCompression(cctx);
+ if (cctx->appliedParams.nbWorkers > 0) {
+ if (cctx->cParamsChanged) {
+ ZSTDMT_updateCParams_whileCompressing(cctx->mtctx, &cctx->requestedParams);
+ cctx->cParamsChanged = 0;
}
- return flushMin;
- }
+ { size_t const flushMin = ZSTDMT_compressStream_generic(cctx->mtctx, output, input, endOp);
+ if ( ZSTD_isError(flushMin)
+ || (endOp == ZSTD_e_end && flushMin == 0) ) { /* compression completed */
+ ZSTD_startNewCompression(cctx);
+ }
+ return flushMin;
+ } }
#endif
CHECK_F( ZSTD_compressStream_generic(cctx, output, input, endOp) );
DEBUGLOG(5, "completed ZSTD_compress_generic");
@@ -2927,7 +3280,7 @@ size_t ZSTD_compress_generic_simpleArgs (
/*====== Finalize ======*/
/*! ZSTD_flushStream() :
-* @return : amount of data remaining to flush */
+ * @return : amount of data remaining to flush */
size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output)
{
ZSTD_inBuffer input = { NULL, 0, 0 };
@@ -2959,11 +3312,11 @@ int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; }
static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
{ /* "default" - guarantees a monotonically increasing memory budget */
/* W, C, H, S, L, TL, strat */
- { 18, 12, 12, 1, 7, 16, ZSTD_fast }, /* level 0 - never used */
- { 19, 13, 14, 1, 7, 16, ZSTD_fast }, /* level 1 */
- { 19, 15, 16, 1, 6, 16, ZSTD_fast }, /* level 2 */
- { 20, 16, 17, 1, 5, 16, ZSTD_dfast }, /* level 3 */
- { 20, 17, 18, 1, 5, 16, ZSTD_dfast }, /* level 4 */
+ { 19, 12, 13, 1, 6, 1, ZSTD_fast }, /* base for negative levels */
+ { 19, 13, 14, 1, 7, 1, ZSTD_fast }, /* level 1 */
+ { 19, 15, 16, 1, 6, 1, ZSTD_fast }, /* level 2 */
+ { 20, 16, 17, 1, 5, 8, ZSTD_dfast }, /* level 3 */
+ { 20, 17, 18, 1, 5, 8, ZSTD_dfast }, /* level 4 */
{ 20, 17, 18, 2, 5, 16, ZSTD_greedy }, /* level 5 */
{ 21, 17, 19, 2, 5, 16, ZSTD_lazy }, /* level 6 */
{ 21, 18, 19, 3, 5, 16, ZSTD_lazy }, /* level 7 */
@@ -2972,9 +3325,9 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV
{ 21, 19, 21, 4, 5, 16, ZSTD_lazy2 }, /* level 10 */
{ 22, 20, 22, 4, 5, 16, ZSTD_lazy2 }, /* level 11 */
{ 22, 20, 22, 5, 5, 16, ZSTD_lazy2 }, /* level 12 */
- { 22, 21, 22, 5, 5, 16, ZSTD_lazy2 }, /* level 13 */
- { 22, 21, 22, 6, 5, 16, ZSTD_lazy2 }, /* level 14 */
- { 22, 21, 22, 4, 5, 16, ZSTD_btlazy2 }, /* level 15 */
+ { 22, 21, 22, 4, 5, 32, ZSTD_btlazy2 }, /* level 13 */
+ { 22, 21, 22, 5, 5, 32, ZSTD_btlazy2 }, /* level 14 */
+ { 22, 22, 22, 6, 5, 32, ZSTD_btlazy2 }, /* level 15 */
{ 22, 21, 22, 4, 5, 48, ZSTD_btopt }, /* level 16 */
{ 23, 22, 22, 4, 4, 48, ZSTD_btopt }, /* level 17 */
{ 23, 22, 22, 5, 3, 64, ZSTD_btopt }, /* level 18 */
@@ -2985,8 +3338,8 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV
},
{ /* for srcSize <= 256 KB */
/* W, C, H, S, L, T, strat */
- { 0, 0, 0, 0, 0, 0, ZSTD_fast }, /* level 0 - not used */
- { 18, 13, 14, 1, 6, 8, ZSTD_fast }, /* level 1 */
+ { 18, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */
+ { 18, 13, 14, 1, 6, 1, ZSTD_fast }, /* level 1 */
{ 18, 14, 13, 1, 5, 8, ZSTD_dfast }, /* level 2 */
{ 18, 16, 15, 1, 5, 8, ZSTD_dfast }, /* level 3 */
{ 18, 15, 17, 1, 5, 8, ZSTD_greedy }, /* level 4.*/
@@ -2997,8 +3350,8 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV
{ 18, 17, 17, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
{ 18, 17, 17, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
{ 18, 18, 17, 6, 4, 8, ZSTD_lazy2 }, /* level 11.*/
- { 18, 18, 17, 7, 4, 8, ZSTD_lazy2 }, /* level 12.*/
- { 18, 19, 17, 6, 4, 8, ZSTD_btlazy2 }, /* level 13 */
+ { 18, 18, 17, 5, 4, 8, ZSTD_btlazy2 }, /* level 12.*/
+ { 18, 19, 17, 7, 4, 8, ZSTD_btlazy2 }, /* level 13 */
{ 18, 18, 18, 4, 4, 16, ZSTD_btopt }, /* level 14.*/
{ 18, 18, 18, 4, 3, 16, ZSTD_btopt }, /* level 15.*/
{ 18, 19, 18, 6, 3, 32, ZSTD_btopt }, /* level 16.*/
@@ -3011,9 +3364,9 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV
},
{ /* for srcSize <= 128 KB */
/* W, C, H, S, L, T, strat */
- { 17, 12, 12, 1, 7, 8, ZSTD_fast }, /* level 0 - not used */
- { 17, 12, 13, 1, 6, 8, ZSTD_fast }, /* level 1 */
- { 17, 13, 16, 1, 5, 8, ZSTD_fast }, /* level 2 */
+ { 17, 12, 12, 1, 5, 1, ZSTD_fast }, /* level 0 - not used */
+ { 17, 12, 13, 1, 6, 1, ZSTD_fast }, /* level 1 */
+ { 17, 13, 16, 1, 5, 1, ZSTD_fast }, /* level 2 */
{ 17, 16, 16, 2, 5, 8, ZSTD_dfast }, /* level 3 */
{ 17, 13, 15, 3, 4, 8, ZSTD_greedy }, /* level 4 */
{ 17, 15, 17, 4, 4, 8, ZSTD_greedy }, /* level 5 */
@@ -3037,9 +3390,9 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV
},
{ /* for srcSize <= 16 KB */
/* W, C, H, S, L, T, strat */
- { 14, 12, 12, 1, 7, 6, ZSTD_fast }, /* level 0 - not used */
- { 14, 14, 14, 1, 6, 6, ZSTD_fast }, /* level 1 */
- { 14, 14, 14, 1, 4, 6, ZSTD_fast }, /* level 2 */
+ { 14, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */
+ { 14, 14, 14, 1, 6, 1, ZSTD_fast }, /* level 1 */
+ { 14, 14, 14, 1, 4, 1, ZSTD_fast }, /* level 2 */
{ 14, 14, 14, 1, 4, 6, ZSTD_dfast }, /* level 3.*/
{ 14, 14, 14, 4, 4, 6, ZSTD_greedy }, /* level 4.*/
{ 14, 14, 14, 3, 4, 6, ZSTD_lazy }, /* level 5.*/
@@ -3063,47 +3416,22 @@ static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEV
},
};
-#if defined(ZSTD_DEBUG) && (ZSTD_DEBUG>=1)
-/* This function just controls
- * the monotonic memory budget increase of ZSTD_defaultCParameters[0].
- * Run once, on first ZSTD_getCParams() usage, if ZSTD_DEBUG is enabled
- */
-MEM_STATIC void ZSTD_check_compressionLevel_monotonicIncrease_memoryBudget(void)
-{
- int level;
- for (level=1; level<ZSTD_maxCLevel(); level++) {
- ZSTD_compressionParameters const c1 = ZSTD_defaultCParameters[0][level];
- ZSTD_compressionParameters const c2 = ZSTD_defaultCParameters[0][level+1];
- assert(c1.windowLog <= c2.windowLog);
-# define ZSTD_TABLECOST(h,c) ((1<<(h)) + (1<<(c)))
- assert(ZSTD_TABLECOST(c1.hashLog, c1.chainLog) <= ZSTD_TABLECOST(c2.hashLog, c2.chainLog));
- }
-}
-#endif
-
/*! ZSTD_getCParams() :
-* @return ZSTD_compressionParameters structure for a selected compression level, `srcSize` and `dictSize`.
+* @return ZSTD_compressionParameters structure for a selected compression level, srcSize and dictSize.
* Size values are optional, provide 0 if not known or unused */
ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize)
{
size_t const addedSize = srcSizeHint ? 0 : 500;
U64 const rSize = srcSizeHint+dictSize ? srcSizeHint+dictSize+addedSize : (U64)-1;
U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB); /* intentional underflow for srcSizeHint == 0 */
-
-#if defined(ZSTD_DEBUG) && (ZSTD_DEBUG>=1)
- static int g_monotonicTest = 1;
- if (g_monotonicTest) {
- ZSTD_check_compressionLevel_monotonicIncrease_memoryBudget();
- g_monotonicTest=0;
- }
-#endif
-
- DEBUGLOG(4, "ZSTD_getCParams: cLevel=%i, srcSize=%u, dictSize=%u => table %u",
- compressionLevel, (U32)srcSizeHint, (U32)dictSize, tableID);
- if (compressionLevel <= 0) compressionLevel = ZSTD_CLEVEL_DEFAULT; /* 0 == default; no negative compressionLevel yet */
- if (compressionLevel > ZSTD_MAX_CLEVEL) compressionLevel = ZSTD_MAX_CLEVEL;
- { ZSTD_compressionParameters const cp = ZSTD_defaultCParameters[tableID][compressionLevel];
- return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize); }
+ int row = compressionLevel;
+ DEBUGLOG(5, "ZSTD_getCParams (cLevel=%i)", compressionLevel);
+ if (compressionLevel == 0) row = ZSTD_CLEVEL_DEFAULT; /* 0 == default */
+ if (compressionLevel < 0) row = 0; /* entry 0 is baseline for fast mode */
+ if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL;
+ { ZSTD_compressionParameters cp = ZSTD_defaultCParameters[tableID][row];
+ if (compressionLevel < 0) cp.targetLength = (unsigned)(-compressionLevel); /* acceleration factor */
+ return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize); }
}
@@ -3113,6 +3441,7 @@ ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long l
ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize) {
ZSTD_parameters params;
ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, srcSizeHint, dictSize);
+ DEBUGLOG(5, "ZSTD_getParams (cLevel=%i)", compressionLevel);
memset(&params, 0, sizeof(params));
params.cParams = cParams;
params.fParams.contentSizeFlag = 1;
diff --git a/thirdparty/zstd/compress/zstd_compress_internal.h b/thirdparty/zstd/compress/zstd_compress_internal.h
index f104fe981e..81f12ca6df 100644
--- a/thirdparty/zstd/compress/zstd_compress_internal.h
+++ b/thirdparty/zstd/compress/zstd_compress_internal.h
@@ -30,8 +30,14 @@ extern "C" {
/*-*************************************
* Constants
***************************************/
-static const U32 g_searchStrength = 8;
-#define HASH_READ_SIZE 8
+#define kSearchStrength 8
+#define HASH_READ_SIZE 8
+#define ZSTD_DUBT_UNSORTED_MARK 1 /* For btlazy2 strategy, index 1 now means "unsorted".
+ It could be confused for a real successor at index "1", if sorted as larger than its predecessor.
+ It's not a big deal though : candidate will just be sorted again.
+ Additionnally, candidate position 1 will be lost.
+ But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss.
+ The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be misdhandled after table re-use with a different strategy */
/*-*************************************
@@ -43,7 +49,7 @@ typedef enum { zcss_init=0, zcss_load, zcss_flush } ZSTD_cStreamStage;
typedef struct ZSTD_prefixDict_s {
const void* dict;
size_t dictSize;
- ZSTD_dictMode_e dictMode;
+ ZSTD_dictContentType_e dictContentType;
} ZSTD_prefixDict;
typedef struct {
@@ -51,7 +57,6 @@ typedef struct {
FSE_CTable offcodeCTable[FSE_CTABLE_SIZE_U32(OffFSELog, MaxOff)];
FSE_CTable matchlengthCTable[FSE_CTABLE_SIZE_U32(MLFSELog, MaxML)];
FSE_CTable litlengthCTable[FSE_CTABLE_SIZE_U32(LLFSELog, MaxLL)];
- U32 workspace[HUF_WORKSPACE_SIZE_U32];
HUF_repeat hufCTable_repeatMode;
FSE_repeat offcode_repeatMode;
FSE_repeat matchlength_repeatMode;
@@ -94,11 +99,43 @@ typedef struct {
} optState_t;
typedef struct {
+ ZSTD_entropyCTables_t entropy;
+ U32 rep[ZSTD_REP_NUM];
+} ZSTD_compressedBlockState_t;
+
+typedef struct {
+ BYTE const* nextSrc; /* next block here to continue on current prefix */
+ BYTE const* base; /* All regular indexes relative to this position */
+ BYTE const* dictBase; /* extDict indexes relative to this position */
+ U32 dictLimit; /* below that point, need extDict */
+ U32 lowLimit; /* below that point, no more data */
+} ZSTD_window_t;
+
+typedef struct {
+ ZSTD_window_t window; /* State for window round buffer management */
+ U32 loadedDictEnd; /* index of end of dictionary */
+ U32 nextToUpdate; /* index from which to continue table update */
+ U32 nextToUpdate3; /* index from which to continue table update */
+ U32 hashLog3; /* dispatch table : larger == faster, more memory */
+ U32* hashTable;
+ U32* hashTable3;
+ U32* chainTable;
+ optState_t opt; /* optimal parser state */
+} ZSTD_matchState_t;
+
+typedef struct {
+ ZSTD_compressedBlockState_t* prevCBlock;
+ ZSTD_compressedBlockState_t* nextCBlock;
+ ZSTD_matchState_t matchState;
+} ZSTD_blockState_t;
+
+typedef struct {
U32 offset;
U32 checksum;
} ldmEntry_t;
typedef struct {
+ ZSTD_window_t window; /* State for the window round buffer management */
ldmEntry_t* hashTable;
BYTE* bucketOffsets; /* Next position in bucket to insert entry */
U64 hashPower; /* Used to compute the rolling hash.
@@ -111,60 +148,68 @@ typedef struct {
U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */
U32 minMatchLength; /* Minimum match length */
U32 hashEveryLog; /* Log number of entries to skip */
+ U32 windowLog; /* Window log for the LDM */
} ldmParams_t;
+typedef struct {
+ U32 offset;
+ U32 litLength;
+ U32 matchLength;
+} rawSeq;
+
+typedef struct {
+ rawSeq* seq; /* The start of the sequences */
+ size_t pos; /* The position where reading stopped. <= size. */
+ size_t size; /* The number of sequences. <= capacity. */
+ size_t capacity; /* The capacity of the `seq` pointer */
+} rawSeqStore_t;
+
struct ZSTD_CCtx_params_s {
ZSTD_format_e format;
ZSTD_compressionParameters cParams;
ZSTD_frameParameters fParams;
int compressionLevel;
- U32 forceWindow; /* force back-references to respect limit of
+ int disableLiteralCompression;
+ int forceWindow; /* force back-references to respect limit of
* 1<<wLog, even for dictionary */
/* Multithreading: used to pass parameters to mtctx */
- U32 nbThreads;
+ unsigned nbWorkers;
unsigned jobSize;
unsigned overlapSizeLog;
/* Long distance matching parameters */
ldmParams_t ldmParams;
- /* For use with createCCtxParams() and freeCCtxParams() only */
+ /* Internal use, for createCCtxParams() and freeCCtxParams() only */
ZSTD_customMem customMem;
-
}; /* typedef'd to ZSTD_CCtx_params within "zstd.h" */
struct ZSTD_CCtx_s {
- const BYTE* nextSrc; /* next block here to continue on current prefix */
- const BYTE* base; /* All regular indexes relative to this position */
- const BYTE* dictBase; /* extDict indexes relative to this position */
- U32 dictLimit; /* below that point, need extDict */
- U32 lowLimit; /* below that point, no more data */
- U32 nextToUpdate; /* index from which to continue dictionary update */
- U32 nextToUpdate3; /* index from which to continue dictionary update */
- U32 hashLog3; /* dispatch table : larger == faster, more memory */
- U32 loadedDictEnd; /* index of end of dictionary */
ZSTD_compressionStage_e stage;
- U32 dictID;
+ int cParamsChanged; /* == 1 if cParams(except wlog) or compression level are changed in requestedParams. Triggers transmission of new params to ZSTDMT (if available) then reset to 0. */
+ int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */
ZSTD_CCtx_params requestedParams;
ZSTD_CCtx_params appliedParams;
+ U32 dictID;
void* workSpace;
size_t workSpaceSize;
size_t blockSize;
- U64 pledgedSrcSizePlusOne; /* this way, 0 (default) == unknown */
- U64 consumedSrcSize;
+ unsigned long long pledgedSrcSizePlusOne; /* this way, 0 (default) == unknown */
+ unsigned long long consumedSrcSize;
+ unsigned long long producedCSize;
XXH64_state_t xxhState;
ZSTD_customMem customMem;
size_t staticSize;
- seqStore_t seqStore; /* sequences storage ptrs */
- optState_t optState;
- ldmState_t ldmState; /* long distance matching state */
- U32* hashTable;
- U32* hashTable3;
- U32* chainTable;
- ZSTD_entropyCTables_t* entropy;
+ seqStore_t seqStore; /* sequences storage ptrs */
+ ldmState_t ldmState; /* long distance matching state */
+ rawSeq* ldmSequences; /* Storage for the ldm output sequences */
+ size_t maxNbLdmSequences;
+ rawSeqStore_t externSeqStore; /* Mutable reference to external sequences */
+ ZSTD_blockState_t blockState;
+ U32* entropyWorkspace; /* entropy workspace of HUF_WORKSPACE_SIZE bytes */
/* streaming */
char* inBuff;
@@ -191,6 +236,12 @@ struct ZSTD_CCtx_s {
};
+typedef size_t (*ZSTD_blockCompressor) (
+ ZSTD_matchState_t* bs, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict);
+
+
MEM_STATIC U32 ZSTD_LLcode(U32 litLength)
{
static const BYTE LL_Code[64] = { 0, 1, 2, 3, 4, 5, 6, 7,
@@ -359,10 +410,12 @@ MEM_STATIC size_t ZSTD_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* co
}
/** ZSTD_count_2segments() :
-* can count match length with `ip` & `match` in 2 different segments.
-* convention : on reaching mEnd, match count continue starting from iStart
-*/
-MEM_STATIC size_t ZSTD_count_2segments(const BYTE* ip, const BYTE* match, const BYTE* iEnd, const BYTE* mEnd, const BYTE* iStart)
+ * can count match length with `ip` & `match` in 2 different segments.
+ * convention : on reaching mEnd, match count continue starting from iStart
+ */
+MEM_STATIC size_t
+ZSTD_count_2segments(const BYTE* ip, const BYTE* match,
+ const BYTE* iEnd, const BYTE* mEnd, const BYTE* iStart)
{
const BYTE* const vEnd = MIN( ip + (mEnd - match), iEnd);
size_t const matchLength = ZSTD_count(ip, match, vEnd);
@@ -372,8 +425,8 @@ MEM_STATIC size_t ZSTD_count_2segments(const BYTE* ip, const BYTE* match, const
/*-*************************************
-* Hashes
-***************************************/
+ * Hashes
+ ***************************************/
static const U32 prime3bytes = 506832829U;
static U32 ZSTD_hash3(U32 u, U32 h) { return ((u << (32-24)) * prime3bytes) >> (32-h) ; }
MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_readLE32(ptr), h); } /* only in zstd_opt.h */
@@ -411,6 +464,171 @@ MEM_STATIC size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls)
}
}
+/*-*************************************
+* Round buffer management
+***************************************/
+/* Max current allowed */
+#define ZSTD_CURRENT_MAX ((3U << 29) + (1U << ZSTD_WINDOWLOG_MAX))
+/* Maximum chunk size before overflow correction needs to be called again */
+#define ZSTD_CHUNKSIZE_MAX \
+ ( ((U32)-1) /* Maximum ending current index */ \
+ - ZSTD_CURRENT_MAX) /* Maximum beginning lowLimit */
+
+/**
+ * ZSTD_window_clear():
+ * Clears the window containing the history by simply setting it to empty.
+ */
+MEM_STATIC void ZSTD_window_clear(ZSTD_window_t* window)
+{
+ size_t const endT = (size_t)(window->nextSrc - window->base);
+ U32 const end = (U32)endT;
+
+ window->lowLimit = end;
+ window->dictLimit = end;
+}
+
+/**
+ * ZSTD_window_hasExtDict():
+ * Returns non-zero if the window has a non-empty extDict.
+ */
+MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window)
+{
+ return window.lowLimit < window.dictLimit;
+}
+
+/**
+ * ZSTD_window_needOverflowCorrection():
+ * Returns non-zero if the indices are getting too large and need overflow
+ * protection.
+ */
+MEM_STATIC U32 ZSTD_window_needOverflowCorrection(ZSTD_window_t const window,
+ void const* srcEnd)
+{
+ U32 const current = (U32)((BYTE const*)srcEnd - window.base);
+ return current > ZSTD_CURRENT_MAX;
+}
+
+/**
+ * ZSTD_window_correctOverflow():
+ * Reduces the indices to protect from index overflow.
+ * Returns the correction made to the indices, which must be applied to every
+ * stored index.
+ *
+ * The least significant cycleLog bits of the indices must remain the same,
+ * which may be 0. Every index up to maxDist in the past must be valid.
+ * NOTE: (maxDist & cycleMask) must be zero.
+ */
+MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog,
+ U32 maxDist, void const* src)
+{
+ /* preemptive overflow correction:
+ * 1. correction is large enough:
+ * lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog
+ * 1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog
+ *
+ * current - newCurrent
+ * > (3<<29 + 1<<windowLog) - (1<<windowLog + 1<<chainLog)
+ * > (3<<29) - (1<<chainLog)
+ * > (3<<29) - (1<<30) (NOTE: chainLog <= 30)
+ * > 1<<29
+ *
+ * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow:
+ * After correction, current is less than (1<<chainLog + 1<<windowLog).
+ * In 64-bit mode we are safe, because we have 64-bit ptrdiff_t.
+ * In 32-bit mode we are safe, because (chainLog <= 29), so
+ * ip+ZSTD_CHUNKSIZE_MAX - cctx->base < 1<<32.
+ * 3. (cctx->lowLimit + 1<<windowLog) < 1<<32:
+ * windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32.
+ */
+ U32 const cycleMask = (1U << cycleLog) - 1;
+ U32 const current = (U32)((BYTE const*)src - window->base);
+ U32 const newCurrent = (current & cycleMask) + maxDist;
+ U32 const correction = current - newCurrent;
+ assert((maxDist & cycleMask) == 0);
+ assert(current > newCurrent);
+ /* Loose bound, should be around 1<<29 (see above) */
+ assert(correction > 1<<28);
+
+ window->base += correction;
+ window->dictBase += correction;
+ window->lowLimit -= correction;
+ window->dictLimit -= correction;
+
+ DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction,
+ window->lowLimit);
+ return correction;
+}
+
+/**
+ * ZSTD_window_enforceMaxDist():
+ * Updates lowLimit so that:
+ * (srcEnd - base) - lowLimit == maxDist + loadedDictEnd
+ * This allows a simple check that index >= lowLimit to see if index is valid.
+ * This must be called before a block compression call, with srcEnd as the block
+ * source end.
+ * If loadedDictEndPtr is not NULL, we set it to zero once we update lowLimit.
+ * This is because dictionaries are allowed to be referenced as long as the last
+ * byte of the dictionary is in the window, but once they are out of range,
+ * they cannot be referenced. If loadedDictEndPtr is NULL, we use
+ * loadedDictEnd == 0.
+ */
+MEM_STATIC void ZSTD_window_enforceMaxDist(ZSTD_window_t* window,
+ void const* srcEnd, U32 maxDist,
+ U32* loadedDictEndPtr)
+{
+ U32 const current = (U32)((BYTE const*)srcEnd - window->base);
+ U32 loadedDictEnd = loadedDictEndPtr != NULL ? *loadedDictEndPtr : 0;
+ if (current > maxDist + loadedDictEnd) {
+ U32 const newLowLimit = current - maxDist;
+ if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit;
+ if (window->dictLimit < window->lowLimit) {
+ DEBUGLOG(5, "Update dictLimit from %u to %u", window->dictLimit,
+ window->lowLimit);
+ window->dictLimit = window->lowLimit;
+ }
+ if (loadedDictEndPtr)
+ *loadedDictEndPtr = 0;
+ }
+}
+
+/**
+ * ZSTD_window_update():
+ * Updates the window by appending [src, src + srcSize) to the window.
+ * If it is not contiguous, the current prefix becomes the extDict, and we
+ * forget about the extDict. Handles overlap of the prefix and extDict.
+ * Returns non-zero if the segment is contiguous.
+ */
+MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window,
+ void const* src, size_t srcSize)
+{
+ BYTE const* const ip = (BYTE const*)src;
+ U32 contiguous = 1;
+ /* Check if blocks follow each other */
+ if (src != window->nextSrc) {
+ /* not contiguous */
+ size_t const distanceFromBase = (size_t)(window->nextSrc - window->base);
+ DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u",
+ window->dictLimit);
+ window->lowLimit = window->dictLimit;
+ assert(distanceFromBase == (size_t)(U32)distanceFromBase); /* should never overflow */
+ window->dictLimit = (U32)distanceFromBase;
+ window->dictBase = window->base;
+ window->base = ip - distanceFromBase;
+ // ms->nextToUpdate = window->dictLimit;
+ if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; /* too small extDict */
+ contiguous = 0;
+ }
+ window->nextSrc = ip + srcSize;
+ /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */
+ if ( (ip+srcSize > window->dictBase + window->lowLimit)
+ & (ip < window->dictBase + window->dictLimit)) {
+ ptrdiff_t const highInputIdx = (ip + srcSize) - window->dictBase;
+ U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx;
+ window->lowLimit = lowLimitMax;
+ }
+ return contiguous;
+}
+
#if defined (__cplusplus)
}
#endif
@@ -421,6 +639,13 @@ MEM_STATIC size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls)
* These prototypes shall only be called from within lib/compress
* ============================================================== */
+/* ZSTD_getCParamsFromCCtxParams() :
+ * cParams are built depending on compressionLevel, src size hints,
+ * LDM and manually set compression parameters.
+ */
+ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams(
+ const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize);
+
/*! ZSTD_initCStream_internal() :
* Private use only. Init streaming operation.
* expects params to be valid.
@@ -446,7 +671,7 @@ ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict);
* Private use only. To be called from zstdmt_compress.c. */
size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
const void* dict, size_t dictSize,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
const ZSTD_CDict* cdict,
ZSTD_CCtx_params params,
unsigned long long pledgedSrcSize);
@@ -459,4 +684,26 @@ size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx,
const void* dict,size_t dictSize,
ZSTD_CCtx_params params);
+
+/* ZSTD_writeLastEmptyBlock() :
+ * output an empty Block with end-of-frame mark to complete a frame
+ * @return : size of data written into `dst` (== ZSTD_blockHeaderSize (defined in zstd_internal.h))
+ * or an error code if `dstCapcity` is too small (<ZSTD_blockHeaderSize)
+ */
+size_t ZSTD_writeLastEmptyBlock(void* dst, size_t dstCapacity);
+
+
+/* ZSTD_referenceExternalSequences() :
+ * Must be called before starting a compression operation.
+ * seqs must parse a prefix of the source.
+ * This cannot be used when long range matching is enabled.
+ * Zstd will use these sequences, and pass the literals to a secondary block
+ * compressor.
+ * @return : An error code on failure.
+ * NOTE: seqs are not verified! Invalid sequences can cause out-of-bounds memory
+ * access and data corruption.
+ */
+size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSeq);
+
+
#endif /* ZSTD_COMPRESS_H */
diff --git a/thirdparty/zstd/compress/zstd_double_fast.c b/thirdparty/zstd/compress/zstd_double_fast.c
index fee5127c35..86e6b39621 100644
--- a/thirdparty/zstd/compress/zstd_double_fast.c
+++ b/thirdparty/zstd/compress/zstd_double_fast.c
@@ -12,44 +12,58 @@
#include "zstd_double_fast.h"
-void ZSTD_fillDoubleHashTable(ZSTD_CCtx* cctx, const void* end, const U32 mls)
+void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
+ ZSTD_compressionParameters const* cParams,
+ void const* end)
{
- U32* const hashLarge = cctx->hashTable;
- U32 const hBitsL = cctx->appliedParams.cParams.hashLog;
- U32* const hashSmall = cctx->chainTable;
- U32 const hBitsS = cctx->appliedParams.cParams.chainLog;
- const BYTE* const base = cctx->base;
- const BYTE* ip = base + cctx->nextToUpdate;
+ U32* const hashLarge = ms->hashTable;
+ U32 const hBitsL = cParams->hashLog;
+ U32 const mls = cParams->searchLength;
+ U32* const hashSmall = ms->chainTable;
+ U32 const hBitsS = cParams->chainLog;
+ const BYTE* const base = ms->window.base;
+ const BYTE* ip = base + ms->nextToUpdate;
const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE;
- const size_t fastHashFillStep = 3;
-
- while(ip <= iend) {
- hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip - base);
- hashLarge[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip - base);
- ip += fastHashFillStep;
+ const U32 fastHashFillStep = 3;
+
+ /* Always insert every fastHashFillStep position into the hash tables.
+ * Insert the other positions into the large hash table if their entry
+ * is empty.
+ */
+ for (; ip + fastHashFillStep - 1 <= iend; ip += fastHashFillStep) {
+ U32 const current = (U32)(ip - base);
+ U32 i;
+ for (i = 0; i < fastHashFillStep; ++i) {
+ size_t const smHash = ZSTD_hashPtr(ip + i, hBitsS, mls);
+ size_t const lgHash = ZSTD_hashPtr(ip + i, hBitsL, 8);
+ if (i == 0)
+ hashSmall[smHash] = current + i;
+ if (i == 0 || hashLarge[lgHash] == 0)
+ hashLarge[lgHash] = current + i;
+ }
}
}
FORCE_INLINE_TEMPLATE
-size_t ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx* cctx,
- const void* src, size_t srcSize,
- const U32 mls)
+size_t ZSTD_compressBlock_doubleFast_generic(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize,
+ U32 const mls /* template */)
{
- U32* const hashLong = cctx->hashTable;
- const U32 hBitsL = cctx->appliedParams.cParams.hashLog;
- U32* const hashSmall = cctx->chainTable;
- const U32 hBitsS = cctx->appliedParams.cParams.chainLog;
- seqStore_t* seqStorePtr = &(cctx->seqStore);
- const BYTE* const base = cctx->base;
+ U32* const hashLong = ms->hashTable;
+ const U32 hBitsL = cParams->hashLog;
+ U32* const hashSmall = ms->chainTable;
+ const U32 hBitsS = cParams->chainLog;
+ const BYTE* const base = ms->window.base;
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
- const U32 lowestIndex = cctx->dictLimit;
+ const U32 lowestIndex = ms->window.dictLimit;
const BYTE* const lowest = base + lowestIndex;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - HASH_READ_SIZE;
- U32 offset_1=seqStorePtr->rep[0], offset_2=seqStorePtr->rep[1];
+ U32 offset_1=rep[0], offset_2=rep[1];
U32 offsetSaved = 0;
/* init */
@@ -76,7 +90,7 @@ size_t ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx* cctx,
/* favor repcode */
mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
ip++;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, 0, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, 0, mLength-MINMATCH);
} else {
U32 offset;
if ( (matchIndexL > lowestIndex) && (MEM_read64(matchLong) == MEM_read64(ip)) ) {
@@ -99,14 +113,14 @@ size_t ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx* cctx,
while (((ip>anchor) & (match>lowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */
}
} else {
- ip += ((ip-anchor) >> g_searchStrength) + 1;
+ ip += ((ip-anchor) >> kSearchStrength) + 1;
continue;
}
offset_2 = offset_1;
offset_1 = offset;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
}
/* match found */
@@ -129,61 +143,63 @@ size_t ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx* cctx,
{ U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; } /* swap offset_2 <=> offset_1 */
hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base);
hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base);
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, rLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, 0, anchor, 0, rLength-MINMATCH);
ip += rLength;
anchor = ip;
continue; /* faster when present ... (?) */
} } }
/* save reps for next block */
- seqStorePtr->repToConfirm[0] = offset_1 ? offset_1 : offsetSaved;
- seqStorePtr->repToConfirm[1] = offset_2 ? offset_2 : offsetSaved;
+ rep[0] = offset_1 ? offset_1 : offsetSaved;
+ rep[1] = offset_2 ? offset_2 : offsetSaved;
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_doubleFast(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_doubleFast(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- const U32 mls = ctx->appliedParams.cParams.searchLength;
+ const U32 mls = cParams->searchLength;
switch(mls)
{
default: /* includes case 3 */
case 4 :
- return ZSTD_compressBlock_doubleFast_generic(ctx, src, srcSize, 4);
+ return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, cParams, src, srcSize, 4);
case 5 :
- return ZSTD_compressBlock_doubleFast_generic(ctx, src, srcSize, 5);
+ return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, cParams, src, srcSize, 5);
case 6 :
- return ZSTD_compressBlock_doubleFast_generic(ctx, src, srcSize, 6);
+ return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, cParams, src, srcSize, 6);
case 7 :
- return ZSTD_compressBlock_doubleFast_generic(ctx, src, srcSize, 7);
+ return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, cParams, src, srcSize, 7);
}
}
-static size_t ZSTD_compressBlock_doubleFast_extDict_generic(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize,
- const U32 mls)
+static size_t ZSTD_compressBlock_doubleFast_extDict_generic(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize,
+ U32 const mls /* template */)
{
- U32* const hashLong = ctx->hashTable;
- U32 const hBitsL = ctx->appliedParams.cParams.hashLog;
- U32* const hashSmall = ctx->chainTable;
- U32 const hBitsS = ctx->appliedParams.cParams.chainLog;
- seqStore_t* seqStorePtr = &(ctx->seqStore);
- const BYTE* const base = ctx->base;
- const BYTE* const dictBase = ctx->dictBase;
+ U32* const hashLong = ms->hashTable;
+ U32 const hBitsL = cParams->hashLog;
+ U32* const hashSmall = ms->chainTable;
+ U32 const hBitsS = cParams->chainLog;
+ const BYTE* const base = ms->window.base;
+ const BYTE* const dictBase = ms->window.dictBase;
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
- const U32 lowestIndex = ctx->lowLimit;
+ const U32 lowestIndex = ms->window.lowLimit;
const BYTE* const dictStart = dictBase + lowestIndex;
- const U32 dictLimit = ctx->dictLimit;
+ const U32 dictLimit = ms->window.dictLimit;
const BYTE* const lowPrefixPtr = base + dictLimit;
const BYTE* const dictEnd = dictBase + dictLimit;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - 8;
- U32 offset_1=seqStorePtr->rep[0], offset_2=seqStorePtr->rep[1];
+ U32 offset_1=rep[0], offset_2=rep[1];
/* Search Loop */
while (ip < ilimit) { /* < instead of <=, because (ip+1) */
@@ -209,7 +225,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* repMatchEnd = repIndex < dictLimit ? dictEnd : iend;
mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, lowPrefixPtr) + 4;
ip++;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, 0, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, 0, mLength-MINMATCH);
} else {
if ((matchLongIndex > lowestIndex) && (MEM_read64(matchLong) == MEM_read64(ip))) {
const BYTE* matchEnd = matchLongIndex < dictLimit ? dictEnd : iend;
@@ -220,7 +236,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(ZSTD_CCtx* ctx,
while (((ip>anchor) & (matchLong>lowMatchPtr)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */
offset_2 = offset_1;
offset_1 = offset;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
} else if ((matchIndex > lowestIndex) && (MEM_read32(match) == MEM_read32(ip))) {
size_t const h3 = ZSTD_hashPtr(ip+1, hBitsL, 8);
@@ -245,10 +261,10 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(ZSTD_CCtx* ctx,
}
offset_2 = offset_1;
offset_1 = offset;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
} else {
- ip += ((ip-anchor) >> g_searchStrength) + 1;
+ ip += ((ip-anchor) >> kSearchStrength) + 1;
continue;
} }
@@ -272,7 +288,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* const repEnd2 = repIndex2 < dictLimit ? dictEnd : iend;
size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, lowPrefixPtr) + 4;
U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, repLength2-MINMATCH);
+ ZSTD_storeSeq(seqStore, 0, anchor, 0, repLength2-MINMATCH);
hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2;
hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2;
ip += repLength2;
@@ -283,27 +299,29 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic(ZSTD_CCtx* ctx,
} } }
/* save reps for next block */
- seqStorePtr->repToConfirm[0] = offset_1; seqStorePtr->repToConfirm[1] = offset_2;
+ rep[0] = offset_1;
+ rep[1] = offset_2;
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_doubleFast_extDict(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_doubleFast_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- U32 const mls = ctx->appliedParams.cParams.searchLength;
+ U32 const mls = cParams->searchLength;
switch(mls)
{
default: /* includes case 3 */
case 4 :
- return ZSTD_compressBlock_doubleFast_extDict_generic(ctx, src, srcSize, 4);
+ return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 4);
case 5 :
- return ZSTD_compressBlock_doubleFast_extDict_generic(ctx, src, srcSize, 5);
+ return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 5);
case 6 :
- return ZSTD_compressBlock_doubleFast_extDict_generic(ctx, src, srcSize, 6);
+ return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 6);
case 7 :
- return ZSTD_compressBlock_doubleFast_extDict_generic(ctx, src, srcSize, 7);
+ return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 7);
}
}
diff --git a/thirdparty/zstd/compress/zstd_double_fast.h b/thirdparty/zstd/compress/zstd_double_fast.h
index 75e0415809..6d80b2774c 100644
--- a/thirdparty/zstd/compress/zstd_double_fast.h
+++ b/thirdparty/zstd/compress/zstd_double_fast.h
@@ -16,11 +16,18 @@ extern "C" {
#endif
#include "mem.h" /* U32 */
-#include "zstd.h" /* ZSTD_CCtx, size_t */
+#include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */
+
+void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
+ ZSTD_compressionParameters const* cParams,
+ void const* end);
+size_t ZSTD_compressBlock_doubleFast(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_doubleFast_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
-void ZSTD_fillDoubleHashTable(ZSTD_CCtx* cctx, const void* end, const U32 mls);
-size_t ZSTD_compressBlock_doubleFast(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_doubleFast_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
#if defined (__cplusplus)
}
diff --git a/thirdparty/zstd/compress/zstd_fast.c b/thirdparty/zstd/compress/zstd_fast.c
index 7b56c3d6ad..df4d28b340 100644
--- a/thirdparty/zstd/compress/zstd_fast.c
+++ b/thirdparty/zstd/compress/zstd_fast.c
@@ -12,39 +12,48 @@
#include "zstd_fast.h"
-void ZSTD_fillHashTable (ZSTD_CCtx* zc, const void* end, const U32 mls)
+void ZSTD_fillHashTable(ZSTD_matchState_t* ms,
+ ZSTD_compressionParameters const* cParams,
+ void const* end)
{
- U32* const hashTable = zc->hashTable;
- U32 const hBits = zc->appliedParams.cParams.hashLog;
- const BYTE* const base = zc->base;
- const BYTE* ip = base + zc->nextToUpdate;
+ U32* const hashTable = ms->hashTable;
+ U32 const hBits = cParams->hashLog;
+ U32 const mls = cParams->searchLength;
+ const BYTE* const base = ms->window.base;
+ const BYTE* ip = base + ms->nextToUpdate;
const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE;
- const size_t fastHashFillStep = 3;
+ const U32 fastHashFillStep = 3;
- while(ip <= iend) {
- hashTable[ZSTD_hashPtr(ip, hBits, mls)] = (U32)(ip - base);
- ip += fastHashFillStep;
+ /* Always insert every fastHashFillStep position into the hash table.
+ * Insert the other positions if their hash entry is empty.
+ */
+ for (; ip + fastHashFillStep - 1 <= iend; ip += fastHashFillStep) {
+ U32 const current = (U32)(ip - base);
+ U32 i;
+ for (i = 0; i < fastHashFillStep; ++i) {
+ size_t const hash = ZSTD_hashPtr(ip + i, hBits, mls);
+ if (i == 0 || hashTable[hash] == 0)
+ hashTable[hash] = current + i;
+ }
}
}
-
FORCE_INLINE_TEMPLATE
-size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx,
- const void* src, size_t srcSize,
- const U32 mls)
+size_t ZSTD_compressBlock_fast_generic(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ void const* src, size_t srcSize,
+ U32 const hlog, U32 const stepSize, U32 const mls)
{
- U32* const hashTable = cctx->hashTable;
- U32 const hBits = cctx->appliedParams.cParams.hashLog;
- seqStore_t* seqStorePtr = &(cctx->seqStore);
- const BYTE* const base = cctx->base;
+ U32* const hashTable = ms->hashTable;
+ const BYTE* const base = ms->window.base;
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
- const U32 lowestIndex = cctx->dictLimit;
+ const U32 lowestIndex = ms->window.dictLimit;
const BYTE* const lowest = base + lowestIndex;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - HASH_READ_SIZE;
- U32 offset_1=seqStorePtr->rep[0], offset_2=seqStorePtr->rep[1];
+ U32 offset_1=rep[0], offset_2=rep[1];
U32 offsetSaved = 0;
/* init */
@@ -57,7 +66,7 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx,
/* Main Search Loop */
while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */
size_t mLength;
- size_t const h = ZSTD_hashPtr(ip, hBits, mls);
+ size_t const h = ZSTD_hashPtr(ip, hlog, mls);
U32 const current = (U32)(ip-base);
U32 const matchIndex = hashTable[h];
const BYTE* match = base + matchIndex;
@@ -66,21 +75,21 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx,
if ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1))) {
mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
ip++;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, 0, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, 0, mLength-MINMATCH);
} else {
- U32 offset;
- if ( (matchIndex <= lowestIndex) || (MEM_read32(match) != MEM_read32(ip)) ) {
- ip += ((ip-anchor) >> g_searchStrength) + 1;
+ if ( (matchIndex <= lowestIndex)
+ || (MEM_read32(match) != MEM_read32(ip)) ) {
+ assert(stepSize >= 1);
+ ip += ((ip-anchor) >> kSearchStrength) + stepSize;
continue;
}
mLength = ZSTD_count(ip+4, match+4, iend) + 4;
- offset = (U32)(ip-match);
- while (((ip>anchor) & (match>lowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */
- offset_2 = offset_1;
- offset_1 = offset;
-
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
- }
+ { U32 const offset = (U32)(ip-match);
+ while (((ip>anchor) & (match>lowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */
+ offset_2 = offset_1;
+ offset_1 = offset;
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
+ } }
/* match found */
ip += mLength;
@@ -88,8 +97,8 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx,
if (ip <= ilimit) {
/* Fill Table */
- hashTable[ZSTD_hashPtr(base+current+2, hBits, mls)] = current+2; /* here because current+2 could be > iend-8 */
- hashTable[ZSTD_hashPtr(ip-2, hBits, mls)] = (U32)(ip-2-base);
+ hashTable[ZSTD_hashPtr(base+current+2, hlog, mls)] = current+2; /* here because current+2 could be > iend-8 */
+ hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base);
/* check immediate repcode */
while ( (ip <= ilimit)
&& ( (offset_2>0)
@@ -97,65 +106,67 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx,
/* store sequence */
size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
{ U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; } /* swap offset_2 <=> offset_1 */
- hashTable[ZSTD_hashPtr(ip, hBits, mls)] = (U32)(ip-base);
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, rLength-MINMATCH);
+ hashTable[ZSTD_hashPtr(ip, hlog, mls)] = (U32)(ip-base);
+ ZSTD_storeSeq(seqStore, 0, anchor, 0, rLength-MINMATCH);
ip += rLength;
anchor = ip;
continue; /* faster when present ... (?) */
} } }
/* save reps for next block */
- seqStorePtr->repToConfirm[0] = offset_1 ? offset_1 : offsetSaved;
- seqStorePtr->repToConfirm[1] = offset_2 ? offset_2 : offsetSaved;
+ rep[0] = offset_1 ? offset_1 : offsetSaved;
+ rep[1] = offset_2 ? offset_2 : offsetSaved;
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_fast(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_fast(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- const U32 mls = ctx->appliedParams.cParams.searchLength;
+ U32 const hlog = cParams->hashLog;
+ U32 const mls = cParams->searchLength;
+ U32 const stepSize = cParams->targetLength;
switch(mls)
{
default: /* includes case 3 */
case 4 :
- return ZSTD_compressBlock_fast_generic(ctx, src, srcSize, 4);
+ return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 4);
case 5 :
- return ZSTD_compressBlock_fast_generic(ctx, src, srcSize, 5);
+ return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 5);
case 6 :
- return ZSTD_compressBlock_fast_generic(ctx, src, srcSize, 6);
+ return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 6);
case 7 :
- return ZSTD_compressBlock_fast_generic(ctx, src, srcSize, 7);
+ return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 7);
}
}
-static size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize,
- const U32 mls)
+static size_t ZSTD_compressBlock_fast_extDict_generic(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ void const* src, size_t srcSize,
+ U32 const hlog, U32 const stepSize, U32 const mls)
{
- U32* hashTable = ctx->hashTable;
- const U32 hBits = ctx->appliedParams.cParams.hashLog;
- seqStore_t* seqStorePtr = &(ctx->seqStore);
- const BYTE* const base = ctx->base;
- const BYTE* const dictBase = ctx->dictBase;
+ U32* hashTable = ms->hashTable;
+ const BYTE* const base = ms->window.base;
+ const BYTE* const dictBase = ms->window.dictBase;
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
- const U32 lowestIndex = ctx->lowLimit;
+ const U32 lowestIndex = ms->window.lowLimit;
const BYTE* const dictStart = dictBase + lowestIndex;
- const U32 dictLimit = ctx->dictLimit;
+ const U32 dictLimit = ms->window.dictLimit;
const BYTE* const lowPrefixPtr = base + dictLimit;
const BYTE* const dictEnd = dictBase + dictLimit;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - 8;
- U32 offset_1=seqStorePtr->rep[0], offset_2=seqStorePtr->rep[1];
+ U32 offset_1=rep[0], offset_2=rep[1];
/* Search Loop */
while (ip < ilimit) { /* < instead of <=, because (ip+1) */
- const size_t h = ZSTD_hashPtr(ip, hBits, mls);
+ const size_t h = ZSTD_hashPtr(ip, hlog, mls);
const U32 matchIndex = hashTable[h];
const BYTE* matchBase = matchIndex < dictLimit ? dictBase : base;
const BYTE* match = matchBase + matchIndex;
@@ -171,11 +182,12 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* repMatchEnd = repIndex < dictLimit ? dictEnd : iend;
mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, lowPrefixPtr) + 4;
ip++;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, 0, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, 0, mLength-MINMATCH);
} else {
if ( (matchIndex < lowestIndex) ||
(MEM_read32(match) != MEM_read32(ip)) ) {
- ip += ((ip-anchor) >> g_searchStrength) + 1;
+ assert(stepSize >= 1);
+ ip += ((ip-anchor) >> kSearchStrength) + stepSize;
continue;
}
{ const BYTE* matchEnd = matchIndex < dictLimit ? dictEnd : iend;
@@ -186,7 +198,7 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
offset = current - matchIndex;
offset_2 = offset_1;
offset_1 = offset;
- ZSTD_storeSeq(seqStorePtr, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, ip-anchor, anchor, offset + ZSTD_REP_MOVE, mLength-MINMATCH);
} }
/* found a match : store it */
@@ -195,8 +207,8 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
if (ip <= ilimit) {
/* Fill Table */
- hashTable[ZSTD_hashPtr(base+current+2, hBits, mls)] = current+2;
- hashTable[ZSTD_hashPtr(ip-2, hBits, mls)] = (U32)(ip-2-base);
+ hashTable[ZSTD_hashPtr(base+current+2, hlog, mls)] = current+2;
+ hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base);
/* check immediate repcode */
while (ip <= ilimit) {
U32 const current2 = (U32)(ip-base);
@@ -207,8 +219,8 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
const BYTE* const repEnd2 = repIndex2 < dictLimit ? dictEnd : iend;
size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, lowPrefixPtr) + 4;
U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, repLength2-MINMATCH);
- hashTable[ZSTD_hashPtr(ip, hBits, mls)] = current2;
+ ZSTD_storeSeq(seqStore, 0, anchor, 0, repLength2-MINMATCH);
+ hashTable[ZSTD_hashPtr(ip, hlog, mls)] = current2;
ip += repLength2;
anchor = ip;
continue;
@@ -217,27 +229,31 @@ static size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
} } }
/* save reps for next block */
- seqStorePtr->repToConfirm[0] = offset_1; seqStorePtr->repToConfirm[1] = offset_2;
+ rep[0] = offset_1;
+ rep[1] = offset_2;
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_fast_extDict(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_fast_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- U32 const mls = ctx->appliedParams.cParams.searchLength;
+ U32 const hlog = cParams->hashLog;
+ U32 const mls = cParams->searchLength;
+ U32 const stepSize = cParams->targetLength;
switch(mls)
{
default: /* includes case 3 */
case 4 :
- return ZSTD_compressBlock_fast_extDict_generic(ctx, src, srcSize, 4);
+ return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 4);
case 5 :
- return ZSTD_compressBlock_fast_extDict_generic(ctx, src, srcSize, 5);
+ return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 5);
case 6 :
- return ZSTD_compressBlock_fast_extDict_generic(ctx, src, srcSize, 6);
+ return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 6);
case 7 :
- return ZSTD_compressBlock_fast_extDict_generic(ctx, src, srcSize, 7);
+ return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, hlog, stepSize, 7);
}
}
diff --git a/thirdparty/zstd/compress/zstd_fast.h b/thirdparty/zstd/compress/zstd_fast.h
index d8b7771954..f0438ad5b4 100644
--- a/thirdparty/zstd/compress/zstd_fast.h
+++ b/thirdparty/zstd/compress/zstd_fast.h
@@ -16,13 +16,17 @@ extern "C" {
#endif
#include "mem.h" /* U32 */
-#include "zstd.h" /* ZSTD_CCtx, size_t */
+#include "zstd_compress_internal.h"
-void ZSTD_fillHashTable(ZSTD_CCtx* zc, const void* end, const U32 mls);
-size_t ZSTD_compressBlock_fast(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_fast_extDict(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize);
+void ZSTD_fillHashTable(ZSTD_matchState_t* ms,
+ ZSTD_compressionParameters const* cParams,
+ void const* end);
+size_t ZSTD_compressBlock_fast(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_fast_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
#if defined (__cplusplus)
}
diff --git a/thirdparty/zstd/compress/zstd_lazy.c b/thirdparty/zstd/compress/zstd_lazy.c
index 6d4804961d..9f158123f0 100644
--- a/thirdparty/zstd/compress/zstd_lazy.c
+++ b/thirdparty/zstd/compress/zstd_lazy.c
@@ -15,76 +15,90 @@
/*-*************************************
* Binary Tree search
***************************************/
-/** ZSTD_insertBt1() : add one or multiple positions to tree.
- * ip : assumed <= iend-8 .
- * @return : nb of positions added */
-static U32 ZSTD_insertBt1(ZSTD_CCtx* zc,
- const BYTE* const ip, const BYTE* const iend,
- U32 nbCompares, U32 const mls, U32 const extDict)
+
+void ZSTD_updateDUBT(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip, const BYTE* iend,
+ U32 mls)
{
- U32* const hashTable = zc->hashTable;
- U32 const hashLog = zc->appliedParams.cParams.hashLog;
- size_t const h = ZSTD_hashPtr(ip, hashLog, mls);
- U32* const bt = zc->chainTable;
- U32 const btLog = zc->appliedParams.cParams.chainLog - 1;
+ U32* const hashTable = ms->hashTable;
+ U32 const hashLog = cParams->hashLog;
+
+ U32* const bt = ms->chainTable;
+ U32 const btLog = cParams->chainLog - 1;
+ U32 const btMask = (1 << btLog) - 1;
+
+ const BYTE* const base = ms->window.base;
+ U32 const target = (U32)(ip - base);
+ U32 idx = ms->nextToUpdate;
+
+ if (idx != target)
+ DEBUGLOG(7, "ZSTD_updateDUBT, from %u to %u (dictLimit:%u)",
+ idx, target, ms->window.dictLimit);
+ assert(ip + 8 <= iend); /* condition for ZSTD_hashPtr */
+ (void)iend;
+
+ assert(idx >= ms->window.dictLimit); /* condition for valid base+idx */
+ for ( ; idx < target ; idx++) {
+ size_t const h = ZSTD_hashPtr(base + idx, hashLog, mls); /* assumption : ip + 8 <= iend */
+ U32 const matchIndex = hashTable[h];
+
+ U32* const nextCandidatePtr = bt + 2*(idx&btMask);
+ U32* const sortMarkPtr = nextCandidatePtr + 1;
+
+ DEBUGLOG(8, "ZSTD_updateDUBT: insert %u", idx);
+ hashTable[h] = idx; /* Update Hash Table */
+ *nextCandidatePtr = matchIndex; /* update BT like a chain */
+ *sortMarkPtr = ZSTD_DUBT_UNSORTED_MARK;
+ }
+ ms->nextToUpdate = target;
+}
+
+
+/** ZSTD_insertDUBT1() :
+ * sort one already inserted but unsorted position
+ * assumption : current >= btlow == (current - btmask)
+ * doesn't fail */
+static void ZSTD_insertDUBT1(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ U32 current, const BYTE* inputEnd,
+ U32 nbCompares, U32 btLow, int extDict)
+{
+ U32* const bt = ms->chainTable;
+ U32 const btLog = cParams->chainLog - 1;
U32 const btMask = (1 << btLog) - 1;
- U32 matchIndex = hashTable[h];
size_t commonLengthSmaller=0, commonLengthLarger=0;
- const BYTE* const base = zc->base;
- const BYTE* const dictBase = zc->dictBase;
- const U32 dictLimit = zc->dictLimit;
+ const BYTE* const base = ms->window.base;
+ const BYTE* const dictBase = ms->window.dictBase;
+ const U32 dictLimit = ms->window.dictLimit;
+ const BYTE* const ip = (current>=dictLimit) ? base + current : dictBase + current;
+ const BYTE* const iend = (current>=dictLimit) ? inputEnd : dictBase + dictLimit;
const BYTE* const dictEnd = dictBase + dictLimit;
const BYTE* const prefixStart = base + dictLimit;
const BYTE* match;
- const U32 current = (U32)(ip-base);
- const U32 btLow = btMask >= current ? 0 : current - btMask;
U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = smallerPtr + 1;
+ U32 matchIndex = *smallerPtr;
U32 dummy32; /* to be nullified at the end */
- U32 const windowLow = zc->lowLimit;
- U32 matchEndIdx = current+8+1;
- size_t bestLength = 8;
-#ifdef ZSTD_C_PREDICT
- U32 predictedSmall = *(bt + 2*((current-1)&btMask) + 0);
- U32 predictedLarge = *(bt + 2*((current-1)&btMask) + 1);
- predictedSmall += (predictedSmall>0);
- predictedLarge += (predictedLarge>0);
-#endif /* ZSTD_C_PREDICT */
-
- DEBUGLOG(8, "ZSTD_insertBt1 (%u)", current);
+ U32 const windowLow = ms->window.lowLimit;
- assert(ip <= iend-8); /* required for h calculation */
- hashTable[h] = current; /* Update Hash Table */
+ DEBUGLOG(8, "ZSTD_insertDUBT1(%u) (dictLimit=%u, lowLimit=%u)",
+ current, dictLimit, windowLow);
+ assert(current >= btLow);
+ assert(ip < iend); /* condition for ZSTD_count */
while (nbCompares-- && (matchIndex > windowLow)) {
U32* const nextPtr = bt + 2*(matchIndex & btMask);
size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */
assert(matchIndex < current);
-#ifdef ZSTD_C_PREDICT /* note : can create issues when hlog small <= 11 */
- const U32* predictPtr = bt + 2*((matchIndex-1) & btMask); /* written this way, as bt is a roll buffer */
- if (matchIndex == predictedSmall) {
- /* no need to check length, result known */
- *smallerPtr = matchIndex;
- if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */
- smallerPtr = nextPtr+1; /* new "smaller" => larger of match */
- matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */
- predictedSmall = predictPtr[1] + (predictPtr[1]>0);
- continue;
- }
- if (matchIndex == predictedLarge) {
- *largerPtr = matchIndex;
- if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */
- largerPtr = nextPtr;
- matchIndex = nextPtr[0];
- predictedLarge = predictPtr[0] + (predictPtr[0]>0);
- continue;
- }
-#endif
-
- if ((!extDict) || (matchIndex+matchLength >= dictLimit)) {
- assert(matchIndex+matchLength >= dictLimit); /* might be wrong if extDict is incorrectly set to 0 */
- match = base + matchIndex;
+ if ( (!extDict)
+ || (matchIndex+matchLength >= dictLimit) /* both in current segment*/
+ || (current < dictLimit) /* both in extDict */) {
+ const BYTE* const mBase = !extDict || ((matchIndex+matchLength) >= dictLimit) ? base : dictBase;
+ assert( (matchIndex+matchLength >= dictLimit) /* might be wrong if extDict is incorrectly set to 0 */
+ || (current < dictLimit) );
+ match = mBase + matchIndex;
matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
} else {
match = dictBase + matchIndex;
@@ -93,11 +107,8 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc,
match = base + matchIndex; /* to prepare for next usage of match[matchLength] */
}
- if (matchLength > bestLength) {
- bestLength = matchLength;
- if (matchLength > matchEndIdx - matchIndex)
- matchEndIdx = matchIndex + (U32)matchLength;
- }
+ DEBUGLOG(8, "ZSTD_insertDUBT1: comparing %u with %u : found %u common bytes ",
+ current, matchIndex, (U32)matchLength);
if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */
break; /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */
@@ -108,6 +119,8 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc,
*smallerPtr = matchIndex; /* update smaller idx */
commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */
if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop searching */
+ DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is smaller : next => %u",
+ matchIndex, btLow, nextPtr[1]);
smallerPtr = nextPtr+1; /* new "candidate" => larger than match, which was smaller than target */
matchIndex = nextPtr[1]; /* new matchIndex, larger than previous and closer to current */
} else {
@@ -115,184 +128,205 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc,
*largerPtr = matchIndex;
commonLengthLarger = matchLength;
if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop searching */
+ DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is larger => %u",
+ matchIndex, btLow, nextPtr[0]);
largerPtr = nextPtr;
matchIndex = nextPtr[0];
} }
*smallerPtr = *largerPtr = 0;
- if (bestLength > 384) return MIN(192, (U32)(bestLength - 384)); /* speed optimization */
- assert(matchEndIdx > current + 8);
- return matchEndIdx - (current + 8);
}
-FORCE_INLINE_TEMPLATE
-void ZSTD_updateTree_internal(ZSTD_CCtx* zc,
- const BYTE* const ip, const BYTE* const iend,
- const U32 nbCompares, const U32 mls, const U32 extDict)
-{
- const BYTE* const base = zc->base;
- U32 const target = (U32)(ip - base);
- U32 idx = zc->nextToUpdate;
- DEBUGLOG(7, "ZSTD_updateTree_internal, from %u to %u (extDict:%u)",
- idx, target, extDict);
-
- while(idx < target)
- idx += ZSTD_insertBt1(zc, base+idx, iend, nbCompares, mls, extDict);
- zc->nextToUpdate = target;
-}
-void ZSTD_updateTree(ZSTD_CCtx* zc,
- const BYTE* const ip, const BYTE* const iend,
- const U32 nbCompares, const U32 mls)
+static size_t ZSTD_DUBT_findBestMatch (
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* const ip, const BYTE* const iend,
+ size_t* offsetPtr,
+ U32 const mls,
+ U32 const extDict)
{
- ZSTD_updateTree_internal(zc, ip, iend, nbCompares, mls, 0 /*extDict*/);
-}
-
-void ZSTD_updateTree_extDict(ZSTD_CCtx* zc,
- const BYTE* const ip, const BYTE* const iend,
- const U32 nbCompares, const U32 mls)
-{
- ZSTD_updateTree_internal(zc, ip, iend, nbCompares, mls, 1 /*extDict*/);
-}
+ U32* const hashTable = ms->hashTable;
+ U32 const hashLog = cParams->hashLog;
+ size_t const h = ZSTD_hashPtr(ip, hashLog, mls);
+ U32 matchIndex = hashTable[h];
+ const BYTE* const base = ms->window.base;
+ U32 const current = (U32)(ip-base);
+ U32 const windowLow = ms->window.lowLimit;
-static size_t ZSTD_insertBtAndFindBestMatch (
- ZSTD_CCtx* zc,
- const BYTE* const ip, const BYTE* const iend,
- size_t* offsetPtr,
- U32 nbCompares, const U32 mls,
- U32 extDict)
-{
- U32* const hashTable = zc->hashTable;
- U32 const hashLog = zc->appliedParams.cParams.hashLog;
- size_t const h = ZSTD_hashPtr(ip, hashLog, mls);
- U32* const bt = zc->chainTable;
- U32 const btLog = zc->appliedParams.cParams.chainLog - 1;
+ U32* const bt = ms->chainTable;
+ U32 const btLog = cParams->chainLog - 1;
U32 const btMask = (1 << btLog) - 1;
- U32 matchIndex = hashTable[h];
- size_t commonLengthSmaller=0, commonLengthLarger=0;
- const BYTE* const base = zc->base;
- const BYTE* const dictBase = zc->dictBase;
- const U32 dictLimit = zc->dictLimit;
- const BYTE* const dictEnd = dictBase + dictLimit;
- const BYTE* const prefixStart = base + dictLimit;
- const U32 current = (U32)(ip-base);
- const U32 btLow = btMask >= current ? 0 : current - btMask;
- const U32 windowLow = zc->lowLimit;
- U32* smallerPtr = bt + 2*(current&btMask);
- U32* largerPtr = bt + 2*(current&btMask) + 1;
- U32 matchEndIdx = current+8+1;
- U32 dummy32; /* to be nullified at the end */
- size_t bestLength = 0;
+ U32 const btLow = (btMask >= current) ? 0 : current - btMask;
+ U32 const unsortLimit = MAX(btLow, windowLow);
+
+ U32* nextCandidate = bt + 2*(matchIndex&btMask);
+ U32* unsortedMark = bt + 2*(matchIndex&btMask) + 1;
+ U32 nbCompares = 1U << cParams->searchLog;
+ U32 nbCandidates = nbCompares;
+ U32 previousCandidate = 0;
+ DEBUGLOG(7, "ZSTD_DUBT_findBestMatch (%u) ", current);
assert(ip <= iend-8); /* required for h calculation */
- hashTable[h] = current; /* Update Hash Table */
- while (nbCompares-- && (matchIndex > windowLow)) {
- U32* const nextPtr = bt + 2*(matchIndex & btMask);
- size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */
- const BYTE* match;
+ /* reach end of unsorted candidates list */
+ while ( (matchIndex > unsortLimit)
+ && (*unsortedMark == ZSTD_DUBT_UNSORTED_MARK)
+ && (nbCandidates > 1) ) {
+ DEBUGLOG(8, "ZSTD_DUBT_findBestMatch: candidate %u is unsorted",
+ matchIndex);
+ *unsortedMark = previousCandidate;
+ previousCandidate = matchIndex;
+ matchIndex = *nextCandidate;
+ nextCandidate = bt + 2*(matchIndex&btMask);
+ unsortedMark = bt + 2*(matchIndex&btMask) + 1;
+ nbCandidates --;
+ }
- if ((!extDict) || (matchIndex+matchLength >= dictLimit)) {
- match = base + matchIndex;
- matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
- } else {
- match = dictBase + matchIndex;
- matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart);
- if (matchIndex+matchLength >= dictLimit)
- match = base + matchIndex; /* to prepare for next usage of match[matchLength] */
- }
+ if ( (matchIndex > unsortLimit)
+ && (*unsortedMark==ZSTD_DUBT_UNSORTED_MARK) ) {
+ DEBUGLOG(7, "ZSTD_DUBT_findBestMatch: nullify last unsorted candidate %u",
+ matchIndex);
+ *nextCandidate = *unsortedMark = 0; /* nullify next candidate if it's still unsorted (note : simplification, detrimental to compression ratio, beneficial for speed) */
+ }
+
+ /* batch sort stacked candidates */
+ matchIndex = previousCandidate;
+ while (matchIndex) { /* will end on matchIndex == 0 */
+ U32* const nextCandidateIdxPtr = bt + 2*(matchIndex&btMask) + 1;
+ U32 const nextCandidateIdx = *nextCandidateIdxPtr;
+ ZSTD_insertDUBT1(ms, cParams, matchIndex, iend,
+ nbCandidates, unsortLimit, extDict);
+ matchIndex = nextCandidateIdx;
+ nbCandidates++;
+ }
- if (matchLength > bestLength) {
- if (matchLength > matchEndIdx - matchIndex)
- matchEndIdx = matchIndex + (U32)matchLength;
- if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(current-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1)) )
- bestLength = matchLength, *offsetPtr = ZSTD_REP_MOVE + current - matchIndex;
- if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */
- break; /* drop, to guarantee consistency (miss a little bit of compression) */
+ /* find longest match */
+ { size_t commonLengthSmaller=0, commonLengthLarger=0;
+ const BYTE* const dictBase = ms->window.dictBase;
+ const U32 dictLimit = ms->window.dictLimit;
+ const BYTE* const dictEnd = dictBase + dictLimit;
+ const BYTE* const prefixStart = base + dictLimit;
+ U32* smallerPtr = bt + 2*(current&btMask);
+ U32* largerPtr = bt + 2*(current&btMask) + 1;
+ U32 matchEndIdx = current+8+1;
+ U32 dummy32; /* to be nullified at the end */
+ size_t bestLength = 0;
+
+ matchIndex = hashTable[h];
+ hashTable[h] = current; /* Update Hash Table */
+
+ while (nbCompares-- && (matchIndex > windowLow)) {
+ U32* const nextPtr = bt + 2*(matchIndex & btMask);
+ size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */
+ const BYTE* match;
+
+ if ((!extDict) || (matchIndex+matchLength >= dictLimit)) {
+ match = base + matchIndex;
+ matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
+ } else {
+ match = dictBase + matchIndex;
+ matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart);
+ if (matchIndex+matchLength >= dictLimit)
+ match = base + matchIndex; /* to prepare for next usage of match[matchLength] */
}
- }
- if (match[matchLength] < ip[matchLength]) {
- /* match is smaller than current */
- *smallerPtr = matchIndex; /* update smaller idx */
- commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */
- if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */
- smallerPtr = nextPtr+1; /* new "smaller" => larger of match */
- matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */
- } else {
- /* match is larger than current */
- *largerPtr = matchIndex;
- commonLengthLarger = matchLength;
- if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */
- largerPtr = nextPtr;
- matchIndex = nextPtr[0];
- } }
+ if (matchLength > bestLength) {
+ if (matchLength > matchEndIdx - matchIndex)
+ matchEndIdx = matchIndex + (U32)matchLength;
+ if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(current-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1)) )
+ bestLength = matchLength, *offsetPtr = ZSTD_REP_MOVE + current - matchIndex;
+ if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */
+ break; /* drop, to guarantee consistency (miss a little bit of compression) */
+ }
+ }
- *smallerPtr = *largerPtr = 0;
+ if (match[matchLength] < ip[matchLength]) {
+ /* match is smaller than current */
+ *smallerPtr = matchIndex; /* update smaller idx */
+ commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */
+ if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */
+ smallerPtr = nextPtr+1; /* new "smaller" => larger of match */
+ matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */
+ } else {
+ /* match is larger than current */
+ *largerPtr = matchIndex;
+ commonLengthLarger = matchLength;
+ if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */
+ largerPtr = nextPtr;
+ matchIndex = nextPtr[0];
+ } }
+
+ *smallerPtr = *largerPtr = 0;
- assert(matchEndIdx > current+8);
- zc->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
- return bestLength;
+ assert(matchEndIdx > current+8); /* ensure nextToUpdate is increased */
+ ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
+ if (bestLength >= MINMATCH) {
+ U32 const mIndex = current - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex;
+ DEBUGLOG(8, "ZSTD_DUBT_findBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)",
+ current, (U32)bestLength, (U32)*offsetPtr, mIndex);
+ }
+ return bestLength;
+ }
}
/** ZSTD_BtFindBestMatch() : Tree updater, providing best match */
static size_t ZSTD_BtFindBestMatch (
- ZSTD_CCtx* zc,
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* const ip, const BYTE* const iLimit,
size_t* offsetPtr,
- const U32 maxNbAttempts, const U32 mls)
+ const U32 mls /* template */)
{
- if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
- ZSTD_updateTree(zc, ip, iLimit, maxNbAttempts, mls);
- return ZSTD_insertBtAndFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 0);
+ DEBUGLOG(7, "ZSTD_BtFindBestMatch");
+ if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */
+ ZSTD_updateDUBT(ms, cParams, ip, iLimit, mls);
+ return ZSTD_DUBT_findBestMatch(ms, cParams, ip, iLimit, offsetPtr, mls, 0);
}
static size_t ZSTD_BtFindBestMatch_selectMLS (
- ZSTD_CCtx* zc, /* Index table will be updated */
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* ip, const BYTE* const iLimit,
- size_t* offsetPtr,
- const U32 maxNbAttempts, const U32 matchLengthSearch)
+ size_t* offsetPtr)
{
- switch(matchLengthSearch)
+ switch(cParams->searchLength)
{
default : /* includes case 3 */
- case 4 : return ZSTD_BtFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4);
- case 5 : return ZSTD_BtFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5);
+ case 4 : return ZSTD_BtFindBestMatch(ms, cParams, ip, iLimit, offsetPtr, 4);
+ case 5 : return ZSTD_BtFindBestMatch(ms, cParams, ip, iLimit, offsetPtr, 5);
case 7 :
- case 6 : return ZSTD_BtFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6);
+ case 6 : return ZSTD_BtFindBestMatch(ms, cParams, ip, iLimit, offsetPtr, 6);
}
}
/** Tree updater, providing best match */
static size_t ZSTD_BtFindBestMatch_extDict (
- ZSTD_CCtx* zc,
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* const ip, const BYTE* const iLimit,
size_t* offsetPtr,
- const U32 maxNbAttempts, const U32 mls)
+ const U32 mls)
{
- if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
- ZSTD_updateTree_extDict(zc, ip, iLimit, maxNbAttempts, mls);
- return ZSTD_insertBtAndFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 1);
+ DEBUGLOG(7, "ZSTD_BtFindBestMatch_extDict");
+ if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */
+ ZSTD_updateDUBT(ms, cParams, ip, iLimit, mls);
+ return ZSTD_DUBT_findBestMatch(ms, cParams, ip, iLimit, offsetPtr, mls, 1);
}
static size_t ZSTD_BtFindBestMatch_selectMLS_extDict (
- ZSTD_CCtx* zc, /* Index table will be updated */
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* ip, const BYTE* const iLimit,
- size_t* offsetPtr,
- const U32 maxNbAttempts, const U32 matchLengthSearch)
+ size_t* offsetPtr)
{
- switch(matchLengthSearch)
+ switch(cParams->searchLength)
{
default : /* includes case 3 */
- case 4 : return ZSTD_BtFindBestMatch_extDict(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4);
- case 5 : return ZSTD_BtFindBestMatch_extDict(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5);
+ case 4 : return ZSTD_BtFindBestMatch_extDict(ms, cParams, ip, iLimit, offsetPtr, 4);
+ case 5 : return ZSTD_BtFindBestMatch_extDict(ms, cParams, ip, iLimit, offsetPtr, 5);
case 7 :
- case 6 : return ZSTD_BtFindBestMatch_extDict(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6);
+ case 6 : return ZSTD_BtFindBestMatch_extDict(ms, cParams, ip, iLimit, offsetPtr, 6);
}
}
@@ -305,15 +339,17 @@ static size_t ZSTD_BtFindBestMatch_selectMLS_extDict (
/* Update chains up to ip (excluded)
Assumption : always within prefix (i.e. not within extDict) */
-U32 ZSTD_insertAndFindFirstIndex (ZSTD_CCtx* zc, const BYTE* ip, U32 mls)
+static U32 ZSTD_insertAndFindFirstIndex_internal(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip, U32 const mls)
{
- U32* const hashTable = zc->hashTable;
- const U32 hashLog = zc->appliedParams.cParams.hashLog;
- U32* const chainTable = zc->chainTable;
- const U32 chainMask = (1 << zc->appliedParams.cParams.chainLog) - 1;
- const BYTE* const base = zc->base;
+ U32* const hashTable = ms->hashTable;
+ const U32 hashLog = cParams->hashLog;
+ U32* const chainTable = ms->chainTable;
+ const U32 chainMask = (1 << cParams->chainLog) - 1;
+ const BYTE* const base = ms->window.base;
const U32 target = (U32)(ip - base);
- U32 idx = zc->nextToUpdate;
+ U32 idx = ms->nextToUpdate;
while(idx < target) { /* catch up */
size_t const h = ZSTD_hashPtr(base+idx, hashLog, mls);
@@ -322,35 +358,42 @@ U32 ZSTD_insertAndFindFirstIndex (ZSTD_CCtx* zc, const BYTE* ip, U32 mls)
idx++;
}
- zc->nextToUpdate = target;
+ ms->nextToUpdate = target;
return hashTable[ZSTD_hashPtr(ip, hashLog, mls)];
}
+U32 ZSTD_insertAndFindFirstIndex(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip)
+{
+ return ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, cParams->searchLength);
+}
+
/* inlining is important to hardwire a hot branch (template emulation) */
FORCE_INLINE_TEMPLATE
size_t ZSTD_HcFindBestMatch_generic (
- ZSTD_CCtx* zc, /* Index table will be updated */
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* const ip, const BYTE* const iLimit,
size_t* offsetPtr,
- const U32 maxNbAttempts, const U32 mls, const U32 extDict)
+ const U32 mls, const U32 extDict)
{
- U32* const chainTable = zc->chainTable;
- const U32 chainSize = (1 << zc->appliedParams.cParams.chainLog);
+ U32* const chainTable = ms->chainTable;
+ const U32 chainSize = (1 << cParams->chainLog);
const U32 chainMask = chainSize-1;
- const BYTE* const base = zc->base;
- const BYTE* const dictBase = zc->dictBase;
- const U32 dictLimit = zc->dictLimit;
+ const BYTE* const base = ms->window.base;
+ const BYTE* const dictBase = ms->window.dictBase;
+ const U32 dictLimit = ms->window.dictLimit;
const BYTE* const prefixStart = base + dictLimit;
const BYTE* const dictEnd = dictBase + dictLimit;
- const U32 lowLimit = zc->lowLimit;
+ const U32 lowLimit = ms->window.lowLimit;
const U32 current = (U32)(ip-base);
const U32 minChain = current > chainSize ? current - chainSize : 0;
- int nbAttempts=maxNbAttempts;
+ U32 nbAttempts = 1U << cParams->searchLog;
size_t ml=4-1;
/* HC4 match finder */
- U32 matchIndex = ZSTD_insertAndFindFirstIndex (zc, ip, mls);
+ U32 matchIndex = ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, mls);
for ( ; (matchIndex>lowLimit) & (nbAttempts>0) ; nbAttempts--) {
size_t currentMl=0;
@@ -381,35 +424,33 @@ size_t ZSTD_HcFindBestMatch_generic (
FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_selectMLS (
- ZSTD_CCtx* zc,
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* ip, const BYTE* const iLimit,
- size_t* offsetPtr,
- const U32 maxNbAttempts, const U32 matchLengthSearch)
+ size_t* offsetPtr)
{
- switch(matchLengthSearch)
+ switch(cParams->searchLength)
{
default : /* includes case 3 */
- case 4 : return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4, 0);
- case 5 : return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5, 0);
+ case 4 : return ZSTD_HcFindBestMatch_generic(ms, cParams, ip, iLimit, offsetPtr, 4, 0);
+ case 5 : return ZSTD_HcFindBestMatch_generic(ms, cParams, ip, iLimit, offsetPtr, 5, 0);
case 7 :
- case 6 : return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6, 0);
+ case 6 : return ZSTD_HcFindBestMatch_generic(ms, cParams, ip, iLimit, offsetPtr, 6, 0);
}
}
FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_extDict_selectMLS (
- ZSTD_CCtx* const zc,
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* ip, const BYTE* const iLimit,
- size_t* const offsetPtr,
- U32 const maxNbAttempts, U32 const matchLengthSearch)
+ size_t* const offsetPtr)
{
- switch(matchLengthSearch)
+ switch(cParams->searchLength)
{
default : /* includes case 3 */
- case 4 : return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 4, 1);
- case 5 : return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 5, 1);
+ case 4 : return ZSTD_HcFindBestMatch_generic(ms, cParams, ip, iLimit, offsetPtr, 4, 1);
+ case 5 : return ZSTD_HcFindBestMatch_generic(ms, cParams, ip, iLimit, offsetPtr, 5, 1);
case 7 :
- case 6 : return ZSTD_HcFindBestMatch_generic(zc, ip, iLimit, offsetPtr, maxNbAttempts, 6, 1);
+ case 6 : return ZSTD_HcFindBestMatch_generic(ms, cParams, ip, iLimit, offsetPtr, 6, 1);
}
}
@@ -418,30 +459,29 @@ FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_extDict_selectMLS (
* Common parser - lazy strategy
*********************************/
FORCE_INLINE_TEMPLATE
-size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize,
- const U32 searchMethod, const U32 depth)
+size_t ZSTD_compressBlock_lazy_generic(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore,
+ U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams,
+ const void* src, size_t srcSize,
+ const U32 searchMethod, const U32 depth)
{
- seqStore_t* seqStorePtr = &(ctx->seqStore);
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - 8;
- const BYTE* const base = ctx->base + ctx->dictLimit;
+ const BYTE* const base = ms->window.base + ms->window.dictLimit;
- U32 const maxSearches = 1 << ctx->appliedParams.cParams.searchLog;
- U32 const mls = ctx->appliedParams.cParams.searchLength;
-
- typedef size_t (*searchMax_f)(ZSTD_CCtx* zc, const BYTE* ip, const BYTE* iLimit,
- size_t* offsetPtr,
- U32 maxNbAttempts, U32 matchLengthSearch);
+ typedef size_t (*searchMax_f)(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip, const BYTE* iLimit, size_t* offsetPtr);
searchMax_f const searchMax = searchMethod ? ZSTD_BtFindBestMatch_selectMLS : ZSTD_HcFindBestMatch_selectMLS;
- U32 offset_1 = seqStorePtr->rep[0], offset_2 = seqStorePtr->rep[1], savedOffset=0;
+ U32 offset_1 = rep[0], offset_2 = rep[1], savedOffset=0;
/* init */
ip += (ip==base);
- ctx->nextToUpdate3 = ctx->nextToUpdate;
+ ms->nextToUpdate3 = ms->nextToUpdate;
{ U32 const maxRep = (U32)(ip-base);
if (offset_2 > maxRep) savedOffset = offset_2, offset_2 = 0;
if (offset_1 > maxRep) savedOffset = offset_1, offset_1 = 0;
@@ -462,13 +502,13 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx,
/* first search (depth 0) */
{ size_t offsetFound = 99999999;
- size_t const ml2 = searchMax(ctx, ip, iend, &offsetFound, maxSearches, mls);
+ size_t const ml2 = searchMax(ms, cParams, ip, iend, &offsetFound);
if (ml2 > matchLength)
matchLength = ml2, start = ip, offset=offsetFound;
}
if (matchLength < 4) {
- ip += ((ip-anchor) >> g_searchStrength) + 1; /* jump faster over incompressible sections */
+ ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */
continue;
}
@@ -484,7 +524,7 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx,
matchLength = mlRep, offset = 0, start = ip;
}
{ size_t offset2=99999999;
- size_t const ml2 = searchMax(ctx, ip, iend, &offset2, maxSearches, mls);
+ size_t const ml2 = searchMax(ms, cParams, ip, iend, &offset2);
int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */
int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4);
if ((ml2 >= 4) && (gain2 > gain1)) {
@@ -503,7 +543,7 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx,
matchLength = ml2, offset = 0, start = ip;
}
{ size_t offset2=99999999;
- size_t const ml2 = searchMax(ctx, ip, iend, &offset2, maxSearches, mls);
+ size_t const ml2 = searchMax(ms, cParams, ip, iend, &offset2);
int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */
int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7);
if ((ml2 >= 4) && (gain2 > gain1)) {
@@ -528,7 +568,7 @@ size_t ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx,
/* store sequence */
_storeSequence:
{ size_t const litLength = start - anchor;
- ZSTD_storeSeq(seqStorePtr, litLength, anchor, (U32)offset, matchLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, litLength, anchor, (U32)offset, matchLength-MINMATCH);
anchor = ip = start + matchLength;
}
@@ -538,73 +578,80 @@ _storeSequence:
/* store sequence */
matchLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap repcodes */
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, matchLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, 0, anchor, 0, matchLength-MINMATCH);
ip += matchLength;
anchor = ip;
continue; /* faster when present ... (?) */
} }
/* Save reps for next block */
- seqStorePtr->repToConfirm[0] = offset_1 ? offset_1 : savedOffset;
- seqStorePtr->repToConfirm[1] = offset_2 ? offset_2 : savedOffset;
+ rep[0] = offset_1 ? offset_1 : savedOffset;
+ rep[1] = offset_2 ? offset_2 : savedOffset;
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_btlazy2(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_btlazy2(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_lazy_generic(ctx, src, srcSize, 1, 2);
+ return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, cParams, src, srcSize, 1, 2);
}
-size_t ZSTD_compressBlock_lazy2(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_lazy2(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_lazy_generic(ctx, src, srcSize, 0, 2);
+ return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, cParams, src, srcSize, 0, 2);
}
-size_t ZSTD_compressBlock_lazy(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_lazy(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_lazy_generic(ctx, src, srcSize, 0, 1);
+ return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, cParams, src, srcSize, 0, 1);
}
-size_t ZSTD_compressBlock_greedy(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_greedy(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_lazy_generic(ctx, src, srcSize, 0, 0);
+ return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, cParams, src, srcSize, 0, 0);
}
FORCE_INLINE_TEMPLATE
-size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize,
- const U32 searchMethod, const U32 depth)
+size_t ZSTD_compressBlock_lazy_extDict_generic(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore,
+ U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams,
+ const void* src, size_t srcSize,
+ const U32 searchMethod, const U32 depth)
{
- seqStore_t* seqStorePtr = &(ctx->seqStore);
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - 8;
- const BYTE* const base = ctx->base;
- const U32 dictLimit = ctx->dictLimit;
- const U32 lowestIndex = ctx->lowLimit;
+ const BYTE* const base = ms->window.base;
+ const U32 dictLimit = ms->window.dictLimit;
+ const U32 lowestIndex = ms->window.lowLimit;
const BYTE* const prefixStart = base + dictLimit;
- const BYTE* const dictBase = ctx->dictBase;
+ const BYTE* const dictBase = ms->window.dictBase;
const BYTE* const dictEnd = dictBase + dictLimit;
- const BYTE* const dictStart = dictBase + ctx->lowLimit;
+ const BYTE* const dictStart = dictBase + lowestIndex;
- const U32 maxSearches = 1 << ctx->appliedParams.cParams.searchLog;
- const U32 mls = ctx->appliedParams.cParams.searchLength;
-
- typedef size_t (*searchMax_f)(ZSTD_CCtx* zc, const BYTE* ip, const BYTE* iLimit,
- size_t* offsetPtr,
- U32 maxNbAttempts, U32 matchLengthSearch);
+ typedef size_t (*searchMax_f)(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip, const BYTE* iLimit, size_t* offsetPtr);
searchMax_f searchMax = searchMethod ? ZSTD_BtFindBestMatch_selectMLS_extDict : ZSTD_HcFindBestMatch_extDict_selectMLS;
- U32 offset_1 = seqStorePtr->rep[0], offset_2 = seqStorePtr->rep[1];
+ U32 offset_1 = rep[0], offset_2 = rep[1];
/* init */
- ctx->nextToUpdate3 = ctx->nextToUpdate;
+ ms->nextToUpdate3 = ms->nextToUpdate;
ip += (ip == prefixStart);
/* Match Loop */
@@ -628,13 +675,13 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
/* first search (depth 0) */
{ size_t offsetFound = 99999999;
- size_t const ml2 = searchMax(ctx, ip, iend, &offsetFound, maxSearches, mls);
+ size_t const ml2 = searchMax(ms, cParams, ip, iend, &offsetFound);
if (ml2 > matchLength)
matchLength = ml2, start = ip, offset=offsetFound;
}
if (matchLength < 4) {
- ip += ((ip-anchor) >> g_searchStrength) + 1; /* jump faster over incompressible sections */
+ ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */
continue;
}
@@ -661,7 +708,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
/* search match, depth 1 */
{ size_t offset2=99999999;
- size_t const ml2 = searchMax(ctx, ip, iend, &offset2, maxSearches, mls);
+ size_t const ml2 = searchMax(ms, cParams, ip, iend, &offset2);
int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */
int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4);
if ((ml2 >= 4) && (gain2 > gain1)) {
@@ -691,7 +738,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
/* search match, depth 2 */
{ size_t offset2=99999999;
- size_t const ml2 = searchMax(ctx, ip, iend, &offset2, maxSearches, mls);
+ size_t const ml2 = searchMax(ms, cParams, ip, iend, &offset2);
int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */
int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7);
if ((ml2 >= 4) && (gain2 > gain1)) {
@@ -713,7 +760,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
/* store sequence */
_storeSequence:
{ size_t const litLength = start - anchor;
- ZSTD_storeSeq(seqStorePtr, litLength, anchor, (U32)offset, matchLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, litLength, anchor, (U32)offset, matchLength-MINMATCH);
anchor = ip = start + matchLength;
}
@@ -728,7 +775,7 @@ _storeSequence:
const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend;
matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4;
offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap offset history */
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, matchLength-MINMATCH);
+ ZSTD_storeSeq(seqStore, 0, anchor, 0, matchLength-MINMATCH);
ip += matchLength;
anchor = ip;
continue; /* faster when present ... (?) */
@@ -737,29 +784,41 @@ _storeSequence:
} }
/* Save reps for next block */
- seqStorePtr->repToConfirm[0] = offset_1; seqStorePtr->repToConfirm[1] = offset_2;
+ rep[0] = offset_1;
+ rep[1] = offset_2;
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_greedy_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_greedy_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_lazy_extDict_generic(ctx, src, srcSize, 0, 0);
+ return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 0, 0);
}
-size_t ZSTD_compressBlock_lazy_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_lazy_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
+
{
- return ZSTD_compressBlock_lazy_extDict_generic(ctx, src, srcSize, 0, 1);
+ return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 0, 1);
}
-size_t ZSTD_compressBlock_lazy2_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_lazy2_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
+
{
- return ZSTD_compressBlock_lazy_extDict_generic(ctx, src, srcSize, 0, 2);
+ return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 0, 2);
}
-size_t ZSTD_compressBlock_btlazy2_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_btlazy2_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
+
{
- return ZSTD_compressBlock_lazy_extDict_generic(ctx, src, srcSize, 1, 2);
+ return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, cParams, src, srcSize, 1, 2);
}
diff --git a/thirdparty/zstd/compress/zstd_lazy.h b/thirdparty/zstd/compress/zstd_lazy.h
index 74e1fd6970..bda064f199 100644
--- a/thirdparty/zstd/compress/zstd_lazy.h
+++ b/thirdparty/zstd/compress/zstd_lazy.h
@@ -15,22 +15,39 @@
extern "C" {
#endif
-#include "mem.h" /* U32 */
-#include "zstd.h" /* ZSTD_CCtx, size_t */
-
-U32 ZSTD_insertAndFindFirstIndex (ZSTD_CCtx* zc, const BYTE* ip, U32 mls);
-void ZSTD_updateTree(ZSTD_CCtx* zc, const BYTE* const ip, const BYTE* const iend, const U32 nbCompares, const U32 mls);
-void ZSTD_updateTree_extDict(ZSTD_CCtx* zc, const BYTE* const ip, const BYTE* const iend, const U32 nbCompares, const U32 mls);
-
-size_t ZSTD_compressBlock_btlazy2(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_lazy2(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_lazy(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_greedy(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-
-size_t ZSTD_compressBlock_greedy_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_lazy_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_lazy2_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_btlazy2_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
+#include "zstd_compress_internal.h"
+
+U32 ZSTD_insertAndFindFirstIndex(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip);
+
+void ZSTD_preserveUnsortedMark (U32* const table, U32 const size, U32 const reducerValue); /*! used in ZSTD_reduceIndex(). pre-emptively increase value of ZSTD_DUBT_UNSORTED_MARK */
+
+size_t ZSTD_compressBlock_btlazy2(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_lazy2(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_lazy(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_greedy(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+
+size_t ZSTD_compressBlock_greedy_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_lazy_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_lazy2_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_btlazy2_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
#if defined (__cplusplus)
}
diff --git a/thirdparty/zstd/compress/zstd_ldm.c b/thirdparty/zstd/compress/zstd_ldm.c
index be50872cf7..bffd8a3dfa 100644
--- a/thirdparty/zstd/compress/zstd_ldm.c
+++ b/thirdparty/zstd/compress/zstd_ldm.c
@@ -17,36 +17,45 @@
#define LDM_HASH_RLOG 7
#define LDM_HASH_CHAR_OFFSET 10
-size_t ZSTD_ldm_initializeParameters(ldmParams_t* params, U32 enableLdm)
+void ZSTD_ldm_adjustParameters(ldmParams_t* params,
+ ZSTD_compressionParameters const* cParams)
{
+ U32 const windowLog = cParams->windowLog;
ZSTD_STATIC_ASSERT(LDM_BUCKET_SIZE_LOG <= ZSTD_LDM_BUCKETSIZELOG_MAX);
- params->enableLdm = enableLdm>0;
- params->hashLog = 0;
- params->bucketSizeLog = LDM_BUCKET_SIZE_LOG;
- params->minMatchLength = LDM_MIN_MATCH_LENGTH;
- params->hashEveryLog = ZSTD_LDM_HASHEVERYLOG_NOTSET;
- return 0;
-}
-
-void ZSTD_ldm_adjustParameters(ldmParams_t* params, U32 windowLog)
-{
+ DEBUGLOG(4, "ZSTD_ldm_adjustParameters");
+ if (!params->bucketSizeLog) params->bucketSizeLog = LDM_BUCKET_SIZE_LOG;
+ if (!params->minMatchLength) params->minMatchLength = LDM_MIN_MATCH_LENGTH;
+ if (cParams->strategy >= ZSTD_btopt) {
+ /* Get out of the way of the optimal parser */
+ U32 const minMatch = MAX(cParams->targetLength, params->minMatchLength);
+ assert(minMatch >= ZSTD_LDM_MINMATCH_MIN);
+ assert(minMatch <= ZSTD_LDM_MINMATCH_MAX);
+ params->minMatchLength = minMatch;
+ }
if (params->hashLog == 0) {
params->hashLog = MAX(ZSTD_HASHLOG_MIN, windowLog - LDM_HASH_RLOG);
assert(params->hashLog <= ZSTD_HASHLOG_MAX);
}
- if (params->hashEveryLog == ZSTD_LDM_HASHEVERYLOG_NOTSET) {
+ if (params->hashEveryLog == 0) {
params->hashEveryLog =
windowLog < params->hashLog ? 0 : windowLog - params->hashLog;
}
params->bucketSizeLog = MIN(params->bucketSizeLog, params->hashLog);
}
-size_t ZSTD_ldm_getTableSize(U32 hashLog, U32 bucketSizeLog) {
- size_t const ldmHSize = ((size_t)1) << hashLog;
- size_t const ldmBucketSizeLog = MIN(bucketSizeLog, hashLog);
+size_t ZSTD_ldm_getTableSize(ldmParams_t params)
+{
+ size_t const ldmHSize = ((size_t)1) << params.hashLog;
+ size_t const ldmBucketSizeLog = MIN(params.bucketSizeLog, params.hashLog);
size_t const ldmBucketSize =
- ((size_t)1) << (hashLog - ldmBucketSizeLog);
- return ldmBucketSize + (ldmHSize * (sizeof(ldmEntry_t)));
+ ((size_t)1) << (params.hashLog - ldmBucketSizeLog);
+ size_t const totalSize = ldmBucketSize + ldmHSize * sizeof(ldmEntry_t);
+ return params.enableLdm ? totalSize : 0;
+}
+
+size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize)
+{
+ return params.enableLdm ? (maxChunkSize / params.minMatchLength) : 0;
}
/** ZSTD_ldm_getSmallHash() :
@@ -167,6 +176,7 @@ static U64 ZSTD_ldm_ipow(U64 base, U64 exp)
}
U64 ZSTD_ldm_getHashPower(U32 minMatchLength) {
+ DEBUGLOG(4, "ZSTD_ldm_getHashPower: mml=%u", minMatchLength);
assert(minMatchLength >= ZSTD_LDM_MINMATCH_MIN);
return ZSTD_ldm_ipow(prime8bytes, minMatchLength - 1);
}
@@ -205,21 +215,22 @@ static size_t ZSTD_ldm_countBackwardsMatch(
*
* The tables for the other strategies are filled within their
* block compressors. */
-static size_t ZSTD_ldm_fillFastTables(ZSTD_CCtx* zc, const void* end)
+static size_t ZSTD_ldm_fillFastTables(ZSTD_matchState_t* ms,
+ ZSTD_compressionParameters const* cParams,
+ void const* end)
{
const BYTE* const iend = (const BYTE*)end;
- const U32 mls = zc->appliedParams.cParams.searchLength;
- switch(zc->appliedParams.cParams.strategy)
+ switch(cParams->strategy)
{
case ZSTD_fast:
- ZSTD_fillHashTable(zc, iend, mls);
- zc->nextToUpdate = (U32)(iend - zc->base);
+ ZSTD_fillHashTable(ms, cParams, iend);
+ ms->nextToUpdate = (U32)(iend - ms->window.base);
break;
case ZSTD_dfast:
- ZSTD_fillDoubleHashTable(zc, iend, mls);
- zc->nextToUpdate = (U32)(iend - zc->base);
+ ZSTD_fillDoubleHashTable(ms, cParams, iend);
+ ms->nextToUpdate = (U32)(iend - ms->window.base);
break;
case ZSTD_greedy:
@@ -268,69 +279,62 @@ static U64 ZSTD_ldm_fillLdmHashTable(ldmState_t* state,
* Sets cctx->nextToUpdate to a position corresponding closer to anchor
* if it is far way
* (after a long match, only update tables a limited amount). */
-static void ZSTD_ldm_limitTableUpdate(ZSTD_CCtx* cctx, const BYTE* anchor)
+static void ZSTD_ldm_limitTableUpdate(ZSTD_matchState_t* ms, const BYTE* anchor)
{
- U32 const current = (U32)(anchor - cctx->base);
- if (current > cctx->nextToUpdate + 1024) {
- cctx->nextToUpdate =
- current - MIN(512, current - cctx->nextToUpdate - 1024);
+ U32 const current = (U32)(anchor - ms->window.base);
+ if (current > ms->nextToUpdate + 1024) {
+ ms->nextToUpdate =
+ current - MIN(512, current - ms->nextToUpdate - 1024);
}
}
-typedef size_t (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-/* defined in zstd_compress.c */
-ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict);
-
-FORCE_INLINE_TEMPLATE
-size_t ZSTD_compressBlock_ldm_generic(ZSTD_CCtx* cctx,
- const void* src, size_t srcSize)
+static size_t ZSTD_ldm_generateSequences_internal(
+ ldmState_t* ldmState, rawSeqStore_t* rawSeqStore,
+ ldmParams_t const* params, void const* src, size_t srcSize)
{
- ldmState_t* const ldmState = &(cctx->ldmState);
- const ldmParams_t ldmParams = cctx->appliedParams.ldmParams;
- const U64 hashPower = ldmState->hashPower;
- const U32 hBits = ldmParams.hashLog - ldmParams.bucketSizeLog;
- const U32 ldmBucketSize = ((U32)1 << ldmParams.bucketSizeLog);
- const U32 ldmTagMask = ((U32)1 << ldmParams.hashEveryLog) - 1;
- seqStore_t* const seqStorePtr = &(cctx->seqStore);
- const BYTE* const base = cctx->base;
- const BYTE* const istart = (const BYTE*)src;
- const BYTE* ip = istart;
- const BYTE* anchor = istart;
- const U32 lowestIndex = cctx->dictLimit;
- const BYTE* const lowest = base + lowestIndex;
- const BYTE* const iend = istart + srcSize;
- const BYTE* const ilimit = iend - MAX(ldmParams.minMatchLength, HASH_READ_SIZE);
-
- const ZSTD_blockCompressor blockCompressor =
- ZSTD_selectBlockCompressor(cctx->appliedParams.cParams.strategy, 0);
- U32* const repToConfirm = seqStorePtr->repToConfirm;
- U32 savedRep[ZSTD_REP_NUM];
+ /* LDM parameters */
+ int const extDict = ZSTD_window_hasExtDict(ldmState->window);
+ U32 const minMatchLength = params->minMatchLength;
+ U64 const hashPower = ldmState->hashPower;
+ U32 const hBits = params->hashLog - params->bucketSizeLog;
+ U32 const ldmBucketSize = 1U << params->bucketSizeLog;
+ U32 const hashEveryLog = params->hashEveryLog;
+ U32 const ldmTagMask = (1U << params->hashEveryLog) - 1;
+ /* Prefix and extDict parameters */
+ U32 const dictLimit = ldmState->window.dictLimit;
+ U32 const lowestIndex = extDict ? ldmState->window.lowLimit : dictLimit;
+ BYTE const* const base = ldmState->window.base;
+ BYTE const* const dictBase = extDict ? ldmState->window.dictBase : NULL;
+ BYTE const* const dictStart = extDict ? dictBase + lowestIndex : NULL;
+ BYTE const* const dictEnd = extDict ? dictBase + dictLimit : NULL;
+ BYTE const* const lowPrefixPtr = base + dictLimit;
+ /* Input bounds */
+ BYTE const* const istart = (BYTE const*)src;
+ BYTE const* const iend = istart + srcSize;
+ BYTE const* const ilimit = iend - MAX(minMatchLength, HASH_READ_SIZE);
+ /* Input positions */
+ BYTE const* anchor = istart;
+ BYTE const* ip = istart;
+ /* Rolling hash */
+ BYTE const* lastHashed = NULL;
U64 rollingHash = 0;
- const BYTE* lastHashed = NULL;
- size_t i, lastLiterals;
- /* Save seqStorePtr->rep and copy repToConfirm */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- savedRep[i] = repToConfirm[i] = seqStorePtr->rep[i];
-
- /* Main Search Loop */
- while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */
+ while (ip <= ilimit) {
size_t mLength;
U32 const current = (U32)(ip - base);
size_t forwardMatchLength = 0, backwardMatchLength = 0;
ldmEntry_t* bestEntry = NULL;
if (ip != istart) {
rollingHash = ZSTD_ldm_updateHash(rollingHash, lastHashed[0],
- lastHashed[ldmParams.minMatchLength],
+ lastHashed[minMatchLength],
hashPower);
} else {
- rollingHash = ZSTD_ldm_getRollingHash(ip, ldmParams.minMatchLength);
+ rollingHash = ZSTD_ldm_getRollingHash(ip, minMatchLength);
}
lastHashed = ip;
/* Do not insert and do not look for a match */
- if (ZSTD_ldm_getTag(rollingHash, hBits, ldmParams.hashEveryLog) !=
- ldmTagMask) {
+ if (ZSTD_ldm_getTag(rollingHash, hBits, hashEveryLog) != ldmTagMask) {
ip++;
continue;
}
@@ -340,27 +344,49 @@ size_t ZSTD_compressBlock_ldm_generic(ZSTD_CCtx* cctx,
ldmEntry_t* const bucket =
ZSTD_ldm_getBucket(ldmState,
ZSTD_ldm_getSmallHash(rollingHash, hBits),
- ldmParams);
+ *params);
ldmEntry_t* cur;
size_t bestMatchLength = 0;
U32 const checksum = ZSTD_ldm_getChecksum(rollingHash, hBits);
for (cur = bucket; cur < bucket + ldmBucketSize; ++cur) {
- const BYTE* const pMatch = cur->offset + base;
size_t curForwardMatchLength, curBackwardMatchLength,
curTotalMatchLength;
if (cur->checksum != checksum || cur->offset <= lowestIndex) {
continue;
}
-
- curForwardMatchLength = ZSTD_count(ip, pMatch, iend);
- if (curForwardMatchLength < ldmParams.minMatchLength) {
- continue;
+ if (extDict) {
+ BYTE const* const curMatchBase =
+ cur->offset < dictLimit ? dictBase : base;
+ BYTE const* const pMatch = curMatchBase + cur->offset;
+ BYTE const* const matchEnd =
+ cur->offset < dictLimit ? dictEnd : iend;
+ BYTE const* const lowMatchPtr =
+ cur->offset < dictLimit ? dictStart : lowPrefixPtr;
+
+ curForwardMatchLength = ZSTD_count_2segments(
+ ip, pMatch, iend,
+ matchEnd, lowPrefixPtr);
+ if (curForwardMatchLength < minMatchLength) {
+ continue;
+ }
+ curBackwardMatchLength =
+ ZSTD_ldm_countBackwardsMatch(ip, anchor, pMatch,
+ lowMatchPtr);
+ curTotalMatchLength = curForwardMatchLength +
+ curBackwardMatchLength;
+ } else { /* !extDict */
+ BYTE const* const pMatch = base + cur->offset;
+ curForwardMatchLength = ZSTD_count(ip, pMatch, iend);
+ if (curForwardMatchLength < minMatchLength) {
+ continue;
+ }
+ curBackwardMatchLength =
+ ZSTD_ldm_countBackwardsMatch(ip, anchor, pMatch,
+ lowPrefixPtr);
+ curTotalMatchLength = curForwardMatchLength +
+ curBackwardMatchLength;
}
- curBackwardMatchLength = ZSTD_ldm_countBackwardsMatch(
- ip, anchor, pMatch, lowest);
- curTotalMatchLength = curForwardMatchLength +
- curBackwardMatchLength;
if (curTotalMatchLength > bestMatchLength) {
bestMatchLength = curTotalMatchLength;
@@ -375,7 +401,7 @@ size_t ZSTD_compressBlock_ldm_generic(ZSTD_CCtx* cctx,
if (bestEntry == NULL) {
ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash,
hBits, current,
- ldmParams);
+ *params);
ip++;
continue;
}
@@ -384,324 +410,244 @@ size_t ZSTD_compressBlock_ldm_generic(ZSTD_CCtx* cctx,
mLength = forwardMatchLength + backwardMatchLength;
ip -= backwardMatchLength;
- /* Call the block compressor on the remaining literals */
{
+ /* Store the sequence:
+ * ip = current - backwardMatchLength
+ * The match is at (bestEntry->offset - backwardMatchLength)
+ */
U32 const matchIndex = bestEntry->offset;
- const BYTE* const match = base + matchIndex - backwardMatchLength;
- U32 const offset = (U32)(ip - match);
-
- /* Overwrite rep codes */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- seqStorePtr->rep[i] = repToConfirm[i];
-
- /* Fill tables for block compressor */
- ZSTD_ldm_limitTableUpdate(cctx, anchor);
- ZSTD_ldm_fillFastTables(cctx, anchor);
-
- /* Call block compressor and get remaining literals */
- lastLiterals = blockCompressor(cctx, anchor, ip - anchor);
- cctx->nextToUpdate = (U32)(ip - base);
-
- /* Update repToConfirm with the new offset */
- for (i = ZSTD_REP_NUM - 1; i > 0; i--)
- repToConfirm[i] = repToConfirm[i-1];
- repToConfirm[0] = offset;
-
- /* Store the sequence with the leftover literals */
- ZSTD_storeSeq(seqStorePtr, lastLiterals, ip - lastLiterals,
- offset + ZSTD_REP_MOVE, mLength - MINMATCH);
+ U32 const offset = current - matchIndex;
+ rawSeq* const seq = rawSeqStore->seq + rawSeqStore->size;
+
+ /* Out of sequence storage */
+ if (rawSeqStore->size == rawSeqStore->capacity)
+ return ERROR(dstSize_tooSmall);
+ seq->litLength = (U32)(ip - anchor);
+ seq->matchLength = (U32)mLength;
+ seq->offset = offset;
+ rawSeqStore->size++;
}
/* Insert the current entry into the hash table */
ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, hBits,
(U32)(lastHashed - base),
- ldmParams);
+ *params);
assert(ip + backwardMatchLength == lastHashed);
/* Fill the hash table from lastHashed+1 to ip+mLength*/
/* Heuristic: don't need to fill the entire table at end of block */
- if (ip + mLength < ilimit) {
+ if (ip + mLength <= ilimit) {
rollingHash = ZSTD_ldm_fillLdmHashTable(
ldmState, rollingHash, lastHashed,
- ip + mLength, base, hBits, ldmParams);
+ ip + mLength, base, hBits, *params);
lastHashed = ip + mLength - 1;
}
ip += mLength;
anchor = ip;
- /* Check immediate repcode */
- while ( (ip < ilimit)
- && ( (repToConfirm[1] > 0) && (repToConfirm[1] <= (U32)(ip-lowest))
- && (MEM_read32(ip) == MEM_read32(ip - repToConfirm[1])) )) {
-
- size_t const rLength = ZSTD_count(ip+4, ip+4-repToConfirm[1],
- iend) + 4;
- /* Swap repToConfirm[1] <=> repToConfirm[0] */
- {
- U32 const tmpOff = repToConfirm[1];
- repToConfirm[1] = repToConfirm[0];
- repToConfirm[0] = tmpOff;
- }
-
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, rLength-MINMATCH);
-
- /* Fill the hash table from lastHashed+1 to ip+rLength*/
- if (ip + rLength < ilimit) {
- rollingHash = ZSTD_ldm_fillLdmHashTable(
- ldmState, rollingHash, lastHashed,
- ip + rLength, base, hBits, ldmParams);
- lastHashed = ip + rLength - 1;
- }
- ip += rLength;
- anchor = ip;
- }
}
-
- /* Overwrite rep */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- seqStorePtr->rep[i] = repToConfirm[i];
-
- ZSTD_ldm_limitTableUpdate(cctx, anchor);
- ZSTD_ldm_fillFastTables(cctx, anchor);
-
- lastLiterals = blockCompressor(cctx, anchor, iend - anchor);
- cctx->nextToUpdate = (U32)(iend - base);
-
- /* Restore seqStorePtr->rep */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- seqStorePtr->rep[i] = savedRep[i];
-
- /* Return the last literals size */
- return lastLiterals;
+ return iend - anchor;
}
-size_t ZSTD_compressBlock_ldm(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize)
+/*! ZSTD_ldm_reduceTable() :
+ * reduce table indexes by `reducerValue` */
+static void ZSTD_ldm_reduceTable(ldmEntry_t* const table, U32 const size,
+ U32 const reducerValue)
{
- return ZSTD_compressBlock_ldm_generic(ctx, src, srcSize);
+ U32 u;
+ for (u = 0; u < size; u++) {
+ if (table[u].offset < reducerValue) table[u].offset = 0;
+ else table[u].offset -= reducerValue;
+ }
}
-static size_t ZSTD_compressBlock_ldm_extDict_generic(
- ZSTD_CCtx* ctx,
- const void* src, size_t srcSize)
+size_t ZSTD_ldm_generateSequences(
+ ldmState_t* ldmState, rawSeqStore_t* sequences,
+ ldmParams_t const* params, void const* src, size_t srcSize)
{
- ldmState_t* const ldmState = &(ctx->ldmState);
- const ldmParams_t ldmParams = ctx->appliedParams.ldmParams;
- const U64 hashPower = ldmState->hashPower;
- const U32 hBits = ldmParams.hashLog - ldmParams.bucketSizeLog;
- const U32 ldmBucketSize = ((U32)1 << ldmParams.bucketSizeLog);
- const U32 ldmTagMask = ((U32)1 << ldmParams.hashEveryLog) - 1;
- seqStore_t* const seqStorePtr = &(ctx->seqStore);
- const BYTE* const base = ctx->base;
- const BYTE* const dictBase = ctx->dictBase;
- const BYTE* const istart = (const BYTE*)src;
- const BYTE* ip = istart;
- const BYTE* anchor = istart;
- const U32 lowestIndex = ctx->lowLimit;
- const BYTE* const dictStart = dictBase + lowestIndex;
- const U32 dictLimit = ctx->dictLimit;
- const BYTE* const lowPrefixPtr = base + dictLimit;
- const BYTE* const dictEnd = dictBase + dictLimit;
- const BYTE* const iend = istart + srcSize;
- const BYTE* const ilimit = iend - MAX(ldmParams.minMatchLength, HASH_READ_SIZE);
-
- const ZSTD_blockCompressor blockCompressor =
- ZSTD_selectBlockCompressor(ctx->appliedParams.cParams.strategy, 1);
- U32* const repToConfirm = seqStorePtr->repToConfirm;
- U32 savedRep[ZSTD_REP_NUM];
- U64 rollingHash = 0;
- const BYTE* lastHashed = NULL;
- size_t i, lastLiterals;
-
- /* Save seqStorePtr->rep and copy repToConfirm */
- for (i = 0; i < ZSTD_REP_NUM; i++) {
- savedRep[i] = repToConfirm[i] = seqStorePtr->rep[i];
- }
-
- /* Search Loop */
- while (ip < ilimit) { /* < instead of <=, because (ip+1) */
- size_t mLength;
- const U32 current = (U32)(ip-base);
- size_t forwardMatchLength = 0, backwardMatchLength = 0;
- ldmEntry_t* bestEntry = NULL;
- if (ip != istart) {
- rollingHash = ZSTD_ldm_updateHash(rollingHash, lastHashed[0],
- lastHashed[ldmParams.minMatchLength],
- hashPower);
+ U32 const maxDist = 1U << params->windowLog;
+ BYTE const* const istart = (BYTE const*)src;
+ BYTE const* const iend = istart + srcSize;
+ size_t const kMaxChunkSize = 1 << 20;
+ size_t const nbChunks = (srcSize / kMaxChunkSize) + ((srcSize % kMaxChunkSize) != 0);
+ size_t chunk;
+ size_t leftoverSize = 0;
+
+ assert(ZSTD_CHUNKSIZE_MAX >= kMaxChunkSize);
+ /* Check that ZSTD_window_update() has been called for this chunk prior
+ * to passing it to this function.
+ */
+ assert(ldmState->window.nextSrc >= (BYTE const*)src + srcSize);
+ /* The input could be very large (in zstdmt), so it must be broken up into
+ * chunks to enforce the maximmum distance and handle overflow correction.
+ */
+ assert(sequences->pos <= sequences->size);
+ assert(sequences->size <= sequences->capacity);
+ for (chunk = 0; chunk < nbChunks && sequences->size < sequences->capacity; ++chunk) {
+ BYTE const* const chunkStart = istart + chunk * kMaxChunkSize;
+ size_t const remaining = (size_t)(iend - chunkStart);
+ BYTE const *const chunkEnd =
+ (remaining < kMaxChunkSize) ? iend : chunkStart + kMaxChunkSize;
+ size_t const chunkSize = chunkEnd - chunkStart;
+ size_t newLeftoverSize;
+ size_t const prevSize = sequences->size;
+
+ assert(chunkStart < iend);
+ /* 1. Perform overflow correction if necessary. */
+ if (ZSTD_window_needOverflowCorrection(ldmState->window, chunkEnd)) {
+ U32 const ldmHSize = 1U << params->hashLog;
+ U32 const correction = ZSTD_window_correctOverflow(
+ &ldmState->window, /* cycleLog */ 0, maxDist, src);
+ ZSTD_ldm_reduceTable(ldmState->hashTable, ldmHSize, correction);
+ }
+ /* 2. We enforce the maximum offset allowed.
+ *
+ * kMaxChunkSize should be small enough that we don't lose too much of
+ * the window through early invalidation.
+ * TODO: * Test the chunk size.
+ * * Try invalidation after the sequence generation and test the
+ * the offset against maxDist directly.
+ */
+ ZSTD_window_enforceMaxDist(&ldmState->window, chunkEnd, maxDist, NULL);
+ /* 3. Generate the sequences for the chunk, and get newLeftoverSize. */
+ newLeftoverSize = ZSTD_ldm_generateSequences_internal(
+ ldmState, sequences, params, chunkStart, chunkSize);
+ if (ZSTD_isError(newLeftoverSize))
+ return newLeftoverSize;
+ /* 4. We add the leftover literals from previous iterations to the first
+ * newly generated sequence, or add the `newLeftoverSize` if none are
+ * generated.
+ */
+ /* Prepend the leftover literals from the last call */
+ if (prevSize < sequences->size) {
+ sequences->seq[prevSize].litLength += (U32)leftoverSize;
+ leftoverSize = newLeftoverSize;
} else {
- rollingHash = ZSTD_ldm_getRollingHash(ip, ldmParams.minMatchLength);
+ assert(newLeftoverSize == chunkSize);
+ leftoverSize += chunkSize;
}
- lastHashed = ip;
+ }
+ return 0;
+}
- if (ZSTD_ldm_getTag(rollingHash, hBits, ldmParams.hashEveryLog) !=
- ldmTagMask) {
- /* Don't insert and don't look for a match */
- ip++;
- continue;
+void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch) {
+ while (srcSize > 0 && rawSeqStore->pos < rawSeqStore->size) {
+ rawSeq* seq = rawSeqStore->seq + rawSeqStore->pos;
+ if (srcSize <= seq->litLength) {
+ /* Skip past srcSize literals */
+ seq->litLength -= (U32)srcSize;
+ return;
}
-
- /* Get the best entry and compute the match lengths */
- {
- ldmEntry_t* const bucket =
- ZSTD_ldm_getBucket(ldmState,
- ZSTD_ldm_getSmallHash(rollingHash, hBits),
- ldmParams);
- ldmEntry_t* cur;
- size_t bestMatchLength = 0;
- U32 const checksum = ZSTD_ldm_getChecksum(rollingHash, hBits);
-
- for (cur = bucket; cur < bucket + ldmBucketSize; ++cur) {
- const BYTE* const curMatchBase =
- cur->offset < dictLimit ? dictBase : base;
- const BYTE* const pMatch = curMatchBase + cur->offset;
- const BYTE* const matchEnd =
- cur->offset < dictLimit ? dictEnd : iend;
- const BYTE* const lowMatchPtr =
- cur->offset < dictLimit ? dictStart : lowPrefixPtr;
- size_t curForwardMatchLength, curBackwardMatchLength,
- curTotalMatchLength;
-
- if (cur->checksum != checksum || cur->offset <= lowestIndex) {
- continue;
- }
-
- curForwardMatchLength = ZSTD_count_2segments(
- ip, pMatch, iend,
- matchEnd, lowPrefixPtr);
- if (curForwardMatchLength < ldmParams.minMatchLength) {
- continue;
- }
- curBackwardMatchLength = ZSTD_ldm_countBackwardsMatch(
- ip, anchor, pMatch, lowMatchPtr);
- curTotalMatchLength = curForwardMatchLength +
- curBackwardMatchLength;
-
- if (curTotalMatchLength > bestMatchLength) {
- bestMatchLength = curTotalMatchLength;
- forwardMatchLength = curForwardMatchLength;
- backwardMatchLength = curBackwardMatchLength;
- bestEntry = cur;
+ srcSize -= seq->litLength;
+ seq->litLength = 0;
+ if (srcSize < seq->matchLength) {
+ /* Skip past the first srcSize of the match */
+ seq->matchLength -= (U32)srcSize;
+ if (seq->matchLength < minMatch) {
+ /* The match is too short, omit it */
+ if (rawSeqStore->pos + 1 < rawSeqStore->size) {
+ seq[1].litLength += seq[0].matchLength;
}
+ rawSeqStore->pos++;
}
+ return;
}
+ srcSize -= seq->matchLength;
+ seq->matchLength = 0;
+ rawSeqStore->pos++;
+ }
+}
- /* No match found -- continue searching */
- if (bestEntry == NULL) {
- ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, hBits,
- (U32)(lastHashed - base),
- ldmParams);
- ip++;
- continue;
+/**
+ * If the sequence length is longer than remaining then the sequence is split
+ * between this block and the next.
+ *
+ * Returns the current sequence to handle, or if the rest of the block should
+ * be literals, it returns a sequence with offset == 0.
+ */
+static rawSeq maybeSplitSequence(rawSeqStore_t* rawSeqStore,
+ U32 const remaining, U32 const minMatch)
+{
+ rawSeq sequence = rawSeqStore->seq[rawSeqStore->pos];
+ assert(sequence.offset > 0);
+ /* Likely: No partial sequence */
+ if (remaining >= sequence.litLength + sequence.matchLength) {
+ rawSeqStore->pos++;
+ return sequence;
+ }
+ /* Cut the sequence short (offset == 0 ==> rest is literals). */
+ if (remaining <= sequence.litLength) {
+ sequence.offset = 0;
+ } else if (remaining < sequence.litLength + sequence.matchLength) {
+ sequence.matchLength = remaining - sequence.litLength;
+ if (sequence.matchLength < minMatch) {
+ sequence.offset = 0;
}
+ }
+ /* Skip past `remaining` bytes for the future sequences. */
+ ZSTD_ldm_skipSequences(rawSeqStore, remaining, minMatch);
+ return sequence;
+}
- /* Match found */
- mLength = forwardMatchLength + backwardMatchLength;
- ip -= backwardMatchLength;
-
- /* Call the block compressor on the remaining literals */
- {
- /* ip = current - backwardMatchLength
- * The match is at (bestEntry->offset - backwardMatchLength) */
- U32 const matchIndex = bestEntry->offset;
- U32 const offset = current - matchIndex;
-
- /* Overwrite rep codes */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- seqStorePtr->rep[i] = repToConfirm[i];
-
- /* Fill the hash table for the block compressor */
- ZSTD_ldm_limitTableUpdate(ctx, anchor);
- ZSTD_ldm_fillFastTables(ctx, anchor);
+size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize,
+ int const extDict)
+{
+ unsigned const minMatch = cParams->searchLength;
+ ZSTD_blockCompressor const blockCompressor =
+ ZSTD_selectBlockCompressor(cParams->strategy, extDict);
+ BYTE const* const base = ms->window.base;
+ /* Input bounds */
+ BYTE const* const istart = (BYTE const*)src;
+ BYTE const* const iend = istart + srcSize;
+ /* Input positions */
+ BYTE const* ip = istart;
+
+ assert(rawSeqStore->pos <= rawSeqStore->size);
+ assert(rawSeqStore->size <= rawSeqStore->capacity);
+ /* Loop through each sequence and apply the block compressor to the lits */
+ while (rawSeqStore->pos < rawSeqStore->size && ip < iend) {
+ /* maybeSplitSequence updates rawSeqStore->pos */
+ rawSeq const sequence = maybeSplitSequence(rawSeqStore,
+ (U32)(iend - ip), minMatch);
+ int i;
+ /* End signal */
+ if (sequence.offset == 0)
+ break;
- /* Call block compressor and get remaining literals */
- lastLiterals = blockCompressor(ctx, anchor, ip - anchor);
- ctx->nextToUpdate = (U32)(ip - base);
+ assert(sequence.offset <= (1U << cParams->windowLog));
+ assert(ip + sequence.litLength + sequence.matchLength <= iend);
- /* Update repToConfirm with the new offset */
+ /* Fill tables for block compressor */
+ ZSTD_ldm_limitTableUpdate(ms, ip);
+ ZSTD_ldm_fillFastTables(ms, cParams, ip);
+ /* Run the block compressor */
+ {
+ size_t const newLitLength =
+ blockCompressor(ms, seqStore, rep, cParams, ip,
+ sequence.litLength);
+ ip += sequence.litLength;
+ ms->nextToUpdate = (U32)(ip - base);
+ /* Update the repcodes */
for (i = ZSTD_REP_NUM - 1; i > 0; i--)
- repToConfirm[i] = repToConfirm[i-1];
- repToConfirm[0] = offset;
-
- /* Store the sequence with the leftover literals */
- ZSTD_storeSeq(seqStorePtr, lastLiterals, ip - lastLiterals,
- offset + ZSTD_REP_MOVE, mLength - MINMATCH);
- }
-
- /* Insert the current entry into the hash table */
- ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, hBits,
- (U32)(lastHashed - base),
- ldmParams);
-
- /* Fill the hash table from lastHashed+1 to ip+mLength */
- assert(ip + backwardMatchLength == lastHashed);
- if (ip + mLength < ilimit) {
- rollingHash = ZSTD_ldm_fillLdmHashTable(
- ldmState, rollingHash, lastHashed,
- ip + mLength, base, hBits,
- ldmParams);
- lastHashed = ip + mLength - 1;
- }
- ip += mLength;
- anchor = ip;
-
- /* check immediate repcode */
- while (ip < ilimit) {
- U32 const current2 = (U32)(ip-base);
- U32 const repIndex2 = current2 - repToConfirm[1];
- const BYTE* repMatch2 = repIndex2 < dictLimit ?
- dictBase + repIndex2 : base + repIndex2;
- if ( (((U32)((dictLimit-1) - repIndex2) >= 3) &
- (repIndex2 > lowestIndex)) /* intentional overflow */
- && (MEM_read32(repMatch2) == MEM_read32(ip)) ) {
- const BYTE* const repEnd2 = repIndex2 < dictLimit ?
- dictEnd : iend;
- size_t const repLength2 =
- ZSTD_count_2segments(ip+4, repMatch2+4, iend,
- repEnd2, lowPrefixPtr) + 4;
-
- U32 tmpOffset = repToConfirm[1];
- repToConfirm[1] = repToConfirm[0];
- repToConfirm[0] = tmpOffset;
-
- ZSTD_storeSeq(seqStorePtr, 0, anchor, 0, repLength2-MINMATCH);
-
- /* Fill the hash table from lastHashed+1 to ip+repLength2*/
- if (ip + repLength2 < ilimit) {
- rollingHash = ZSTD_ldm_fillLdmHashTable(
- ldmState, rollingHash, lastHashed,
- ip + repLength2, base, hBits,
- ldmParams);
- lastHashed = ip + repLength2 - 1;
- }
- ip += repLength2;
- anchor = ip;
- continue;
- }
- break;
+ rep[i] = rep[i-1];
+ rep[0] = sequence.offset;
+ /* Store the sequence */
+ ZSTD_storeSeq(seqStore, newLitLength, ip - newLitLength,
+ sequence.offset + ZSTD_REP_MOVE,
+ sequence.matchLength - MINMATCH);
+ ip += sequence.matchLength;
}
}
-
- /* Overwrite rep */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- seqStorePtr->rep[i] = repToConfirm[i];
-
- ZSTD_ldm_limitTableUpdate(ctx, anchor);
- ZSTD_ldm_fillFastTables(ctx, anchor);
-
- /* Call the block compressor one last time on the last literals */
- lastLiterals = blockCompressor(ctx, anchor, iend - anchor);
- ctx->nextToUpdate = (U32)(iend - base);
-
- /* Restore seqStorePtr->rep */
- for (i = 0; i < ZSTD_REP_NUM; i++)
- seqStorePtr->rep[i] = savedRep[i];
-
- /* Return the last literals size */
- return lastLiterals;
-}
-
-size_t ZSTD_compressBlock_ldm_extDict(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize)
-{
- return ZSTD_compressBlock_ldm_extDict_generic(ctx, src, srcSize);
+ /* Fill the tables for the block compressor */
+ ZSTD_ldm_limitTableUpdate(ms, ip);
+ ZSTD_ldm_fillFastTables(ms, cParams, ip);
+ /* Compress the last literals */
+ {
+ size_t const lastLiterals = blockCompressor(ms, seqStore, rep, cParams,
+ ip, iend - ip);
+ ms->nextToUpdate = (U32)(iend - base);
+ return lastLiterals;
+ }
}
diff --git a/thirdparty/zstd/compress/zstd_ldm.h b/thirdparty/zstd/compress/zstd_ldm.h
index 8f12c677aa..0c3789ff13 100644
--- a/thirdparty/zstd/compress/zstd_ldm.h
+++ b/thirdparty/zstd/compress/zstd_ldm.h
@@ -22,32 +22,71 @@ extern "C" {
***************************************/
#define ZSTD_LDM_DEFAULT_WINDOW_LOG ZSTD_WINDOWLOG_DEFAULTMAX
-#define ZSTD_LDM_HASHEVERYLOG_NOTSET 9999
-/** ZSTD_compressBlock_ldm_generic() :
+/**
+ * ZSTD_ldm_generateSequences():
*
- * This is a block compressor intended for long distance matching.
+ * Generates the sequences using the long distance match finder.
+ * Generates long range matching sequences in `sequences`, which parse a prefix
+ * of the source. `sequences` must be large enough to store every sequence,
+ * which can be checked with `ZSTD_ldm_getMaxNbSeq()`.
+ * @returns 0 or an error code.
*
- * The function searches for matches of length at least
- * ldmParams.minMatchLength using a hash table in cctx->ldmState.
- * Matches can be at a distance of up to cParams.windowLog.
+ * NOTE: The user must have called ZSTD_window_update() for all of the input
+ * they have, even if they pass it to ZSTD_ldm_generateSequences() in chunks.
+ * NOTE: This function returns an error if it runs out of space to store
+ * sequences.
+ */
+size_t ZSTD_ldm_generateSequences(
+ ldmState_t* ldms, rawSeqStore_t* sequences,
+ ldmParams_t const* params, void const* src, size_t srcSize);
+
+/**
+ * ZSTD_ldm_blockCompress():
+ *
+ * Compresses a block using the predefined sequences, along with a secondary
+ * block compressor. The literals section of every sequence is passed to the
+ * secondary block compressor, and those sequences are interspersed with the
+ * predefined sequences. Returns the length of the last literals.
+ * Updates `rawSeqStore.pos` to indicate how many sequences have been consumed.
+ * `rawSeqStore.seq` may also be updated to split the last sequence between two
+ * blocks.
+ * @return The length of the last literals.
+ *
+ * NOTE: The source must be at most the maximum block size, but the predefined
+ * sequences can be any size, and may be longer than the block. In the case that
+ * they are longer than the block, the last sequences may need to be split into
+ * two. We handle that case correctly, and update `rawSeqStore` appropriately.
+ * NOTE: This function does not return any errors.
+ */
+size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore,
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams,
+ void const* src, size_t srcSize,
+ int const extDict);
+
+/**
+ * ZSTD_ldm_skipSequences():
*
- * Upon finding a match, the unmatched literals are compressed using a
- * ZSTD_blockCompressor (depending on the strategy in the compression
- * parameters), which stores the matched sequences. The "long distance"
- * match is then stored with the remaining literals from the
- * ZSTD_blockCompressor. */
-size_t ZSTD_compressBlock_ldm(ZSTD_CCtx* cctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_ldm_extDict(ZSTD_CCtx* ctx,
- const void* src, size_t srcSize);
+ * Skip past `srcSize` bytes worth of sequences in `rawSeqStore`.
+ * Avoids emitting matches less than `minMatch` bytes.
+ * Must be called for data with is not passed to ZSTD_ldm_blockCompress().
+ */
+void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize,
+ U32 const minMatch);
-/** ZSTD_ldm_initializeParameters() :
- * Initialize the long distance matching parameters to their default values. */
-size_t ZSTD_ldm_initializeParameters(ldmParams_t* params, U32 enableLdm);
/** ZSTD_ldm_getTableSize() :
- * Estimate the space needed for long distance matching tables. */
-size_t ZSTD_ldm_getTableSize(U32 hashLog, U32 bucketSizeLog);
+ * Estimate the space needed for long distance matching tables or 0 if LDM is
+ * disabled.
+ */
+size_t ZSTD_ldm_getTableSize(ldmParams_t params);
+
+/** ZSTD_ldm_getSeqSpace() :
+ * Return an upper bound on the number of sequences that can be produced by
+ * the long distance matcher, or 0 if LDM is disabled.
+ */
+size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize);
/** ZSTD_ldm_getTableSize() :
* Return prime8bytes^(minMatchLength-1) */
@@ -58,8 +97,12 @@ U64 ZSTD_ldm_getHashPower(U32 minMatchLength);
* windowLog and params->hashLog.
*
* Ensures that params->bucketSizeLog is <= params->hashLog (setting it to
- * params->hashLog if it is not). */
-void ZSTD_ldm_adjustParameters(ldmParams_t* params, U32 windowLog);
+ * params->hashLog if it is not).
+ *
+ * Ensures that the minMatchLength >= targetLength during optimal parsing.
+ */
+void ZSTD_ldm_adjustParameters(ldmParams_t* params,
+ ZSTD_compressionParameters const* cParams);
#if defined (__cplusplus)
}
diff --git a/thirdparty/zstd/compress/zstd_opt.c b/thirdparty/zstd/compress/zstd_opt.c
index 7171ff5373..f63f0c5852 100644
--- a/thirdparty/zstd/compress/zstd_opt.c
+++ b/thirdparty/zstd/compress/zstd_opt.c
@@ -10,7 +10,6 @@
#include "zstd_compress_internal.h"
#include "zstd_opt.h"
-#include "zstd_lazy.h" /* ZSTD_updateTree, ZSTD_updateTree_extDict */
#define ZSTD_LITFREQ_ADD 2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats. Also used for matchSum (?) */
@@ -244,14 +243,15 @@ MEM_STATIC U32 ZSTD_readMINMATCH(const void* memPtr, U32 length)
/* Update hashTable3 up to ip (excluded)
Assumption : always within prefix (i.e. not within extDict) */
-static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_CCtx* const cctx, const BYTE* const ip)
+static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_matchState_t* ms, const BYTE* const ip)
{
- U32* const hashTable3 = cctx->hashTable3;
- U32 const hashLog3 = cctx->hashLog3;
- const BYTE* const base = cctx->base;
- U32 idx = cctx->nextToUpdate3;
- U32 const target = cctx->nextToUpdate3 = (U32)(ip - base);
+ U32* const hashTable3 = ms->hashTable3;
+ U32 const hashLog3 = ms->hashLog3;
+ const BYTE* const base = ms->window.base;
+ U32 idx = ms->nextToUpdate3;
+ U32 const target = ms->nextToUpdate3 = (U32)(ip - base);
size_t const hash3 = ZSTD_hash3Ptr(ip, hashLog3);
+ assert(hashLog3 > 0);
while(idx < target) {
hashTable3[ZSTD_hash3Ptr(base+idx, hashLog3)] = idx;
@@ -265,36 +265,173 @@ static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_CCtx* const cctx, const BYTE*
/*-*************************************
* Binary Tree search
***************************************/
+/** ZSTD_insertBt1() : add one or multiple positions to tree.
+ * ip : assumed <= iend-8 .
+ * @return : nb of positions added */
+static U32 ZSTD_insertBt1(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* const ip, const BYTE* const iend,
+ U32 const mls, U32 const extDict)
+{
+ U32* const hashTable = ms->hashTable;
+ U32 const hashLog = cParams->hashLog;
+ size_t const h = ZSTD_hashPtr(ip, hashLog, mls);
+ U32* const bt = ms->chainTable;
+ U32 const btLog = cParams->chainLog - 1;
+ U32 const btMask = (1 << btLog) - 1;
+ U32 matchIndex = hashTable[h];
+ size_t commonLengthSmaller=0, commonLengthLarger=0;
+ const BYTE* const base = ms->window.base;
+ const BYTE* const dictBase = ms->window.dictBase;
+ const U32 dictLimit = ms->window.dictLimit;
+ const BYTE* const dictEnd = dictBase + dictLimit;
+ const BYTE* const prefixStart = base + dictLimit;
+ const BYTE* match;
+ const U32 current = (U32)(ip-base);
+ const U32 btLow = btMask >= current ? 0 : current - btMask;
+ U32* smallerPtr = bt + 2*(current&btMask);
+ U32* largerPtr = smallerPtr + 1;
+ U32 dummy32; /* to be nullified at the end */
+ U32 const windowLow = ms->window.lowLimit;
+ U32 matchEndIdx = current+8+1;
+ size_t bestLength = 8;
+ U32 nbCompares = 1U << cParams->searchLog;
+#ifdef ZSTD_C_PREDICT
+ U32 predictedSmall = *(bt + 2*((current-1)&btMask) + 0);
+ U32 predictedLarge = *(bt + 2*((current-1)&btMask) + 1);
+ predictedSmall += (predictedSmall>0);
+ predictedLarge += (predictedLarge>0);
+#endif /* ZSTD_C_PREDICT */
+
+ DEBUGLOG(8, "ZSTD_insertBt1 (%u)", current);
+
+ assert(ip <= iend-8); /* required for h calculation */
+ hashTable[h] = current; /* Update Hash Table */
+
+ while (nbCompares-- && (matchIndex > windowLow)) {
+ U32* const nextPtr = bt + 2*(matchIndex & btMask);
+ size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */
+ assert(matchIndex < current);
+
+#ifdef ZSTD_C_PREDICT /* note : can create issues when hlog small <= 11 */
+ const U32* predictPtr = bt + 2*((matchIndex-1) & btMask); /* written this way, as bt is a roll buffer */
+ if (matchIndex == predictedSmall) {
+ /* no need to check length, result known */
+ *smallerPtr = matchIndex;
+ if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */
+ smallerPtr = nextPtr+1; /* new "smaller" => larger of match */
+ matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */
+ predictedSmall = predictPtr[1] + (predictPtr[1]>0);
+ continue;
+ }
+ if (matchIndex == predictedLarge) {
+ *largerPtr = matchIndex;
+ if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */
+ largerPtr = nextPtr;
+ matchIndex = nextPtr[0];
+ predictedLarge = predictPtr[0] + (predictPtr[0]>0);
+ continue;
+ }
+#endif
+
+ if ((!extDict) || (matchIndex+matchLength >= dictLimit)) {
+ assert(matchIndex+matchLength >= dictLimit); /* might be wrong if extDict is incorrectly set to 0 */
+ match = base + matchIndex;
+ matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
+ } else {
+ match = dictBase + matchIndex;
+ matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart);
+ if (matchIndex+matchLength >= dictLimit)
+ match = base + matchIndex; /* to prepare for next usage of match[matchLength] */
+ }
+
+ if (matchLength > bestLength) {
+ bestLength = matchLength;
+ if (matchLength > matchEndIdx - matchIndex)
+ matchEndIdx = matchIndex + (U32)matchLength;
+ }
+
+ if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */
+ break; /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */
+ }
+
+ if (match[matchLength] < ip[matchLength]) { /* necessarily within buffer */
+ /* match is smaller than current */
+ *smallerPtr = matchIndex; /* update smaller idx */
+ commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */
+ if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop searching */
+ smallerPtr = nextPtr+1; /* new "candidate" => larger than match, which was smaller than target */
+ matchIndex = nextPtr[1]; /* new matchIndex, larger than previous and closer to current */
+ } else {
+ /* match is larger than current */
+ *largerPtr = matchIndex;
+ commonLengthLarger = matchLength;
+ if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop searching */
+ largerPtr = nextPtr;
+ matchIndex = nextPtr[0];
+ } }
+
+ *smallerPtr = *largerPtr = 0;
+ if (bestLength > 384) return MIN(192, (U32)(bestLength - 384)); /* speed optimization */
+ assert(matchEndIdx > current + 8);
+ return matchEndIdx - (current + 8);
+}
+
+FORCE_INLINE_TEMPLATE
+void ZSTD_updateTree_internal(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* const ip, const BYTE* const iend,
+ const U32 mls, const U32 extDict)
+{
+ const BYTE* const base = ms->window.base;
+ U32 const target = (U32)(ip - base);
+ U32 idx = ms->nextToUpdate;
+ DEBUGLOG(7, "ZSTD_updateTree_internal, from %u to %u (extDict:%u)",
+ idx, target, extDict);
+
+ while(idx < target)
+ idx += ZSTD_insertBt1(ms, cParams, base+idx, iend, mls, extDict);
+ ms->nextToUpdate = target;
+}
+
+void ZSTD_updateTree(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip, const BYTE* iend)
+{
+ ZSTD_updateTree_internal(ms, cParams, ip, iend, cParams->searchLength, 0 /*extDict*/);
+}
+
FORCE_INLINE_TEMPLATE
U32 ZSTD_insertBtAndGetAllMatches (
- ZSTD_CCtx* zc,
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* const ip, const BYTE* const iLimit, int const extDict,
- U32 nbCompares, U32 const mls, U32 const sufficient_len,
U32 rep[ZSTD_REP_NUM], U32 const ll0,
- ZSTD_match_t* matches, const U32 lengthToBeat)
+ ZSTD_match_t* matches, const U32 lengthToBeat, U32 const mls /* template */)
{
- const BYTE* const base = zc->base;
+ U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1);
+ const BYTE* const base = ms->window.base;
U32 const current = (U32)(ip-base);
- U32 const hashLog = zc->appliedParams.cParams.hashLog;
+ U32 const hashLog = cParams->hashLog;
U32 const minMatch = (mls==3) ? 3 : 4;
- U32* const hashTable = zc->hashTable;
+ U32* const hashTable = ms->hashTable;
size_t const h = ZSTD_hashPtr(ip, hashLog, mls);
U32 matchIndex = hashTable[h];
- U32* const bt = zc->chainTable;
- U32 const btLog = zc->appliedParams.cParams.chainLog - 1;
+ U32* const bt = ms->chainTable;
+ U32 const btLog = cParams->chainLog - 1;
U32 const btMask= (1U << btLog) - 1;
size_t commonLengthSmaller=0, commonLengthLarger=0;
- const BYTE* const dictBase = zc->dictBase;
- U32 const dictLimit = zc->dictLimit;
+ const BYTE* const dictBase = ms->window.dictBase;
+ U32 const dictLimit = ms->window.dictLimit;
const BYTE* const dictEnd = dictBase + dictLimit;
const BYTE* const prefixStart = base + dictLimit;
U32 const btLow = btMask >= current ? 0 : current - btMask;
- U32 const windowLow = zc->lowLimit;
+ U32 const windowLow = ms->window.lowLimit;
U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = bt + 2*(current&btMask) + 1;
U32 matchEndIdx = current+8+1; /* farthest referenced position of any match => detects repetitive patterns */
U32 dummy32; /* to be nullified at the end */
U32 mnum = 0;
+ U32 nbCompares = 1U << cParams->searchLog;
size_t bestLength = lengthToBeat-1;
DEBUGLOG(7, "ZSTD_insertBtAndGetAllMatches");
@@ -335,7 +472,7 @@ U32 ZSTD_insertBtAndGetAllMatches (
/* HC3 match finder */
if ((mls == 3) /*static*/ && (bestLength < mls)) {
- U32 const matchIndex3 = ZSTD_insertAndFindFirstIndexHash3 (zc, ip);
+ U32 const matchIndex3 = ZSTD_insertAndFindFirstIndexHash3(ms, ip);
if ((matchIndex3 > windowLow)
& (current - matchIndex3 < (1<<18)) /*heuristic : longer distance likely too expensive*/ ) {
size_t mlen;
@@ -359,7 +496,7 @@ U32 ZSTD_insertBtAndGetAllMatches (
mnum = 1;
if ( (mlen > sufficient_len) |
(ip+mlen == iLimit) ) { /* best possible length */
- zc->nextToUpdate = current+1; /* skip insertion */
+ ms->nextToUpdate = current+1; /* skip insertion */
return 1;
} } } }
@@ -416,30 +553,29 @@ U32 ZSTD_insertBtAndGetAllMatches (
*smallerPtr = *largerPtr = 0;
assert(matchEndIdx > current+8);
- zc->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
+ ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
return mnum;
}
FORCE_INLINE_TEMPLATE U32 ZSTD_BtGetAllMatches (
- ZSTD_CCtx* zc, /* Index table will be updated */
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
const BYTE* ip, const BYTE* const iHighLimit, int const extDict,
- U32 const maxNbAttempts, U32 const matchLengthSearch, U32 const sufficient_len,
U32 rep[ZSTD_REP_NUM], U32 const ll0,
ZSTD_match_t* matches, U32 const lengthToBeat)
{
+ U32 const matchLengthSearch = cParams->searchLength;
DEBUGLOG(7, "ZSTD_BtGetAllMatches");
- if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
- if (extDict) ZSTD_updateTree_extDict(zc, ip, iHighLimit, maxNbAttempts, matchLengthSearch);
- else ZSTD_updateTree(zc, ip, iHighLimit, maxNbAttempts, matchLengthSearch);
+ if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */
+ ZSTD_updateTree_internal(ms, cParams, ip, iHighLimit, matchLengthSearch, extDict);
switch(matchLengthSearch)
{
- case 3 : return ZSTD_insertBtAndGetAllMatches(zc, ip, iHighLimit, extDict, maxNbAttempts, 3, sufficient_len, rep, ll0, matches, lengthToBeat);
+ case 3 : return ZSTD_insertBtAndGetAllMatches(ms, cParams, ip, iHighLimit, extDict, rep, ll0, matches, lengthToBeat, 3);
default :
- case 4 : return ZSTD_insertBtAndGetAllMatches(zc, ip, iHighLimit, extDict, maxNbAttempts, 4, sufficient_len, rep, ll0, matches, lengthToBeat);
- case 5 : return ZSTD_insertBtAndGetAllMatches(zc, ip, iHighLimit, extDict, maxNbAttempts, 5, sufficient_len, rep, ll0, matches, lengthToBeat);
+ case 4 : return ZSTD_insertBtAndGetAllMatches(ms, cParams, ip, iHighLimit, extDict, rep, ll0, matches, lengthToBeat, 4);
+ case 5 : return ZSTD_insertBtAndGetAllMatches(ms, cParams, ip, iHighLimit, extDict, rep, ll0, matches, lengthToBeat, 5);
case 7 :
- case 6 : return ZSTD_insertBtAndGetAllMatches(zc, ip, iHighLimit, extDict, maxNbAttempts, 6, sufficient_len, rep, ll0, matches, lengthToBeat);
+ case 6 : return ZSTD_insertBtAndGetAllMatches(ms, cParams, ip, iHighLimit, extDict, rep, ll0, matches, lengthToBeat, 6);
}
}
@@ -527,36 +663,33 @@ static int ZSTD_literalsContribution_cached(
}
FORCE_INLINE_TEMPLATE
-size_t ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
+size_t ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms,seqStore_t* seqStore,
+ U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams,
const void* src, size_t srcSize,
const int optLevel, const int extDict)
{
- seqStore_t* const seqStorePtr = &(ctx->seqStore);
- optState_t* const optStatePtr = &(ctx->optState);
+ optState_t* const optStatePtr = &ms->opt;
const BYTE* const istart = (const BYTE*)src;
const BYTE* ip = istart;
const BYTE* anchor = istart;
const BYTE* const iend = istart + srcSize;
const BYTE* const ilimit = iend - 8;
- const BYTE* const base = ctx->base;
- const BYTE* const prefixStart = base + ctx->dictLimit;
+ const BYTE* const base = ms->window.base;
+ const BYTE* const prefixStart = base + ms->window.dictLimit;
- U32 const maxSearches = 1U << ctx->appliedParams.cParams.searchLog;
- U32 const sufficient_len = MIN(ctx->appliedParams.cParams.targetLength, ZSTD_OPT_NUM -1);
- U32 const mls = ctx->appliedParams.cParams.searchLength;
- U32 const minMatch = (ctx->appliedParams.cParams.searchLength == 3) ? 3 : 4;
+ U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1);
+ U32 const minMatch = (cParams->searchLength == 3) ? 3 : 4;
ZSTD_optimal_t* const opt = optStatePtr->priceTable;
ZSTD_match_t* const matches = optStatePtr->matchTable;
cachedLiteralPrice_t cachedLitPrice;
- U32 rep[ZSTD_REP_NUM];
/* init */
DEBUGLOG(5, "ZSTD_compressBlock_opt_generic");
- ctx->nextToUpdate3 = ctx->nextToUpdate;
+ ms->nextToUpdate3 = ms->nextToUpdate;
ZSTD_rescaleFreqs(optStatePtr, (const BYTE*)src, srcSize);
ip += (ip==prefixStart);
- { int i; for (i=0; i<ZSTD_REP_NUM; i++) rep[i]=seqStorePtr->rep[i]; }
memset(&cachedLitPrice, 0, sizeof(cachedLitPrice));
/* Match Loop */
@@ -567,7 +700,7 @@ size_t ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
/* find first match */
{ U32 const litlen = (U32)(ip - anchor);
U32 const ll0 = !litlen;
- U32 const nbMatches = ZSTD_BtGetAllMatches(ctx, ip, iend, extDict, maxSearches, mls, sufficient_len, rep, ll0, matches, minMatch);
+ U32 const nbMatches = ZSTD_BtGetAllMatches(ms, cParams, ip, iend, extDict, rep, ll0, matches, minMatch);
if (!nbMatches) { ip++; continue; }
/* initialize opt[0] */
@@ -653,7 +786,7 @@ size_t ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
U32 const litlen = (opt[cur].mlen == 1) ? opt[cur].litlen : 0;
U32 const previousPrice = (cur > litlen) ? opt[cur-litlen].price : 0;
U32 const basePrice = previousPrice + ZSTD_fullLiteralsCost(inr-litlen, litlen, optStatePtr);
- U32 const nbMatches = ZSTD_BtGetAllMatches(ctx, inr, iend, extDict, maxSearches, mls, sufficient_len, opt[cur].rep, ll0, matches, minMatch);
+ U32 const nbMatches = ZSTD_BtGetAllMatches(ms, cParams, inr, iend, extDict, opt[cur].rep, ll0, matches, minMatch);
U32 matchNb;
if (!nbMatches) continue;
@@ -749,37 +882,42 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */
}
ZSTD_updateStats(optStatePtr, llen, anchor, offset, mlen);
- ZSTD_storeSeq(seqStorePtr, llen, anchor, offset, mlen-MINMATCH);
+ ZSTD_storeSeq(seqStore, llen, anchor, offset, mlen-MINMATCH);
anchor = ip;
} }
ZSTD_setLog2Prices(optStatePtr);
} /* while (ip < ilimit) */
- /* Save reps for next block */
- { int i; for (i=0; i<ZSTD_REP_NUM; i++) seqStorePtr->repToConfirm[i] = rep[i]; }
-
/* Return the last literals size */
return iend - anchor;
}
-size_t ZSTD_compressBlock_btopt(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_btopt(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
DEBUGLOG(5, "ZSTD_compressBlock_btopt");
- return ZSTD_compressBlock_opt_generic(ctx, src, srcSize, 0 /*optLevel*/, 0 /*extDict*/);
+ return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, cParams, src, srcSize, 0 /*optLevel*/, 0 /*extDict*/);
}
-size_t ZSTD_compressBlock_btultra(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_btultra(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_opt_generic(ctx, src, srcSize, 2 /*optLevel*/, 0 /*extDict*/);
+ return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, cParams, src, srcSize, 2 /*optLevel*/, 0 /*extDict*/);
}
-size_t ZSTD_compressBlock_btopt_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_btopt_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_opt_generic(ctx, src, srcSize, 0 /*optLevel*/, 1 /*extDict*/);
+ return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, cParams, src, srcSize, 0 /*optLevel*/, 1 /*extDict*/);
}
-size_t ZSTD_compressBlock_btultra_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize)
+size_t ZSTD_compressBlock_btultra_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize)
{
- return ZSTD_compressBlock_opt_generic(ctx, src, srcSize, 2 /*optLevel*/, 1 /*extDict*/);
+ return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, cParams, src, srcSize, 2 /*optLevel*/, 1 /*extDict*/);
}
diff --git a/thirdparty/zstd/compress/zstd_opt.h b/thirdparty/zstd/compress/zstd_opt.h
index 82e810c293..b8dc389f31 100644
--- a/thirdparty/zstd/compress/zstd_opt.h
+++ b/thirdparty/zstd/compress/zstd_opt.h
@@ -15,13 +15,25 @@
extern "C" {
#endif
-#include "zstd.h" /* ZSTD_CCtx, size_t */
+#include "zstd_compress_internal.h"
-size_t ZSTD_compressBlock_btopt(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_btultra(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
+void ZSTD_updateTree(
+ ZSTD_matchState_t* ms, ZSTD_compressionParameters const* cParams,
+ const BYTE* ip, const BYTE* iend); /* used in ZSTD_loadDictionaryContent() */
-size_t ZSTD_compressBlock_btopt_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-size_t ZSTD_compressBlock_btultra_extDict(ZSTD_CCtx* ctx, const void* src, size_t srcSize);
+size_t ZSTD_compressBlock_btopt(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_btultra(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+
+size_t ZSTD_compressBlock_btopt_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
+size_t ZSTD_compressBlock_btultra_extDict(
+ ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
+ ZSTD_compressionParameters const* cParams, void const* src, size_t srcSize);
#if defined (__cplusplus)
}
diff --git a/thirdparty/zstd/compress/zstdmt_compress.c b/thirdparty/zstd/compress/zstdmt_compress.c
index e51edf124f..c7a205d8c7 100644
--- a/thirdparty/zstd/compress/zstdmt_compress.c
+++ b/thirdparty/zstd/compress/zstdmt_compress.c
@@ -10,7 +10,8 @@
/* ====== Tuning parameters ====== */
-#define ZSTDMT_NBTHREADS_MAX 200
+#define ZSTDMT_NBWORKERS_MAX 200
+#define ZSTDMT_JOBSIZE_MAX (MEM_32bits() ? (512 MB) : (2 GB)) /* note : limited by `jobSize` type, which is `unsigned` */
#define ZSTDMT_OVERLAPLOG_DEFAULT 6
@@ -22,11 +23,18 @@
/* ====== Dependencies ====== */
#include <string.h> /* memcpy, memset */
+#include <limits.h> /* INT_MAX */
#include "pool.h" /* threadpool */
#include "threading.h" /* mutex */
#include "zstd_compress_internal.h" /* MIN, ERROR, ZSTD_*, ZSTD_highbit32 */
+#include "zstd_ldm.h"
#include "zstdmt_compress.h"
+/* Guards code to support resizing the SeqPool.
+ * We will want to resize the SeqPool to save memory in the future.
+ * Until then, comment the code out since it is unused.
+ */
+#define ZSTD_RESIZE_SEQPOOL 0
/* ====== Debug ====== */
#if defined(ZSTD_DEBUG) && (ZSTD_DEBUG>=2)
@@ -81,7 +89,7 @@ static unsigned long long GetCurrentClockTimeMicroseconds(void)
typedef struct buffer_s {
void* start;
- size_t size;
+ size_t capacity;
} buffer_t;
static const buffer_t g_nullBuffer = { NULL, 0 };
@@ -95,9 +103,9 @@ typedef struct ZSTDMT_bufferPool_s {
buffer_t bTable[1]; /* variable size */
} ZSTDMT_bufferPool;
-static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned nbThreads, ZSTD_customMem cMem)
+static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned nbWorkers, ZSTD_customMem cMem)
{
- unsigned const maxNbBuffers = 2*nbThreads + 3;
+ unsigned const maxNbBuffers = 2*nbWorkers + 3;
ZSTDMT_bufferPool* const bufPool = (ZSTDMT_bufferPool*)ZSTD_calloc(
sizeof(ZSTDMT_bufferPool) + (maxNbBuffers-1) * sizeof(buffer_t), cMem);
if (bufPool==NULL) return NULL;
@@ -129,17 +137,21 @@ static void ZSTDMT_freeBufferPool(ZSTDMT_bufferPool* bufPool)
static size_t ZSTDMT_sizeof_bufferPool(ZSTDMT_bufferPool* bufPool)
{
size_t const poolSize = sizeof(*bufPool)
- + (bufPool->totalBuffers - 1) * sizeof(buffer_t);
+ + (bufPool->totalBuffers - 1) * sizeof(buffer_t);
unsigned u;
size_t totalBufferSize = 0;
ZSTD_pthread_mutex_lock(&bufPool->poolMutex);
for (u=0; u<bufPool->totalBuffers; u++)
- totalBufferSize += bufPool->bTable[u].size;
+ totalBufferSize += bufPool->bTable[u].capacity;
ZSTD_pthread_mutex_unlock(&bufPool->poolMutex);
return poolSize + totalBufferSize;
}
+/* ZSTDMT_setBufferSize() :
+ * all future buffers provided by this buffer pool will have _at least_ this size
+ * note : it's better for all buffers to have same size,
+ * as they become freely interchangeable, reducing malloc/free usages and memory fragmentation */
static void ZSTDMT_setBufferSize(ZSTDMT_bufferPool* const bufPool, size_t const bSize)
{
ZSTD_pthread_mutex_lock(&bufPool->poolMutex);
@@ -149,7 +161,9 @@ static void ZSTDMT_setBufferSize(ZSTDMT_bufferPool* const bufPool, size_t const
}
/** ZSTDMT_getBuffer() :
- * assumption : bufPool must be valid */
+ * assumption : bufPool must be valid
+ * @return : a buffer, with start pointer and size
+ * note: allocation may fail, in this case, start==NULL and size==0 */
static buffer_t ZSTDMT_getBuffer(ZSTDMT_bufferPool* bufPool)
{
size_t const bSize = bufPool->bufferSize;
@@ -157,12 +171,12 @@ static buffer_t ZSTDMT_getBuffer(ZSTDMT_bufferPool* bufPool)
ZSTD_pthread_mutex_lock(&bufPool->poolMutex);
if (bufPool->nbBuffers) { /* try to use an existing buffer */
buffer_t const buf = bufPool->bTable[--(bufPool->nbBuffers)];
- size_t const availBufferSize = buf.size;
+ size_t const availBufferSize = buf.capacity;
bufPool->bTable[bufPool->nbBuffers] = g_nullBuffer;
if ((availBufferSize >= bSize) & ((availBufferSize>>3) <= bSize)) {
/* large enough, but not too much */
DEBUGLOG(5, "ZSTDMT_getBuffer: provide buffer %u of size %u",
- bufPool->nbBuffers, (U32)buf.size);
+ bufPool->nbBuffers, (U32)buf.capacity);
ZSTD_pthread_mutex_unlock(&bufPool->poolMutex);
return buf;
}
@@ -176,12 +190,42 @@ static buffer_t ZSTDMT_getBuffer(ZSTDMT_bufferPool* bufPool)
{ buffer_t buffer;
void* const start = ZSTD_malloc(bSize, bufPool->cMem);
buffer.start = start; /* note : start can be NULL if malloc fails ! */
- buffer.size = (start==NULL) ? 0 : bSize;
- DEBUGLOG(5, "ZSTDMT_getBuffer: created buffer of size %u", (U32)bSize);
+ buffer.capacity = (start==NULL) ? 0 : bSize;
+ if (start==NULL) {
+ DEBUGLOG(5, "ZSTDMT_getBuffer: buffer allocation failure !!");
+ } else {
+ DEBUGLOG(5, "ZSTDMT_getBuffer: created buffer of size %u", (U32)bSize);
+ }
return buffer;
}
}
+#if ZSTD_RESIZE_SEQPOOL
+/** ZSTDMT_resizeBuffer() :
+ * assumption : bufPool must be valid
+ * @return : a buffer that is at least the buffer pool buffer size.
+ * If a reallocation happens, the data in the input buffer is copied.
+ */
+static buffer_t ZSTDMT_resizeBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buffer)
+{
+ size_t const bSize = bufPool->bufferSize;
+ if (buffer.capacity < bSize) {
+ void* const start = ZSTD_malloc(bSize, bufPool->cMem);
+ buffer_t newBuffer;
+ newBuffer.start = start;
+ newBuffer.capacity = start == NULL ? 0 : bSize;
+ if (start != NULL) {
+ assert(newBuffer.capacity >= buffer.capacity);
+ memcpy(newBuffer.start, buffer.start, buffer.capacity);
+ DEBUGLOG(5, "ZSTDMT_resizeBuffer: created buffer of size %u", (U32)bSize);
+ return newBuffer;
+ }
+ DEBUGLOG(5, "ZSTDMT_resizeBuffer: buffer allocation failure !!");
+ }
+ return buffer;
+}
+#endif
+
/* store buffer for later re-use, up to pool capacity */
static void ZSTDMT_releaseBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buf)
{
@@ -191,7 +235,7 @@ static void ZSTDMT_releaseBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buf)
if (bufPool->nbBuffers < bufPool->totalBuffers) {
bufPool->bTable[bufPool->nbBuffers++] = buf; /* stored for later use */
DEBUGLOG(5, "ZSTDMT_releaseBuffer: stored buffer of size %u in slot %u",
- (U32)buf.size, (U32)(bufPool->nbBuffers-1));
+ (U32)buf.capacity, (U32)(bufPool->nbBuffers-1));
ZSTD_pthread_mutex_unlock(&bufPool->poolMutex);
return;
}
@@ -201,21 +245,73 @@ static void ZSTDMT_releaseBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buf)
ZSTD_free(buf.start, bufPool->cMem);
}
-/* Sets parameters relevant to the compression job, initializing others to
- * default values. Notably, nbThreads should probably be zero. */
-static ZSTD_CCtx_params ZSTDMT_makeJobCCtxParams(ZSTD_CCtx_params const params)
+
+/* ===== Seq Pool Wrapper ====== */
+
+static rawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0};
+
+typedef ZSTDMT_bufferPool ZSTDMT_seqPool;
+
+static size_t ZSTDMT_sizeof_seqPool(ZSTDMT_seqPool* seqPool)
+{
+ return ZSTDMT_sizeof_bufferPool(seqPool);
+}
+
+static rawSeqStore_t bufferToSeq(buffer_t buffer)
{
- ZSTD_CCtx_params jobParams;
- memset(&jobParams, 0, sizeof(jobParams));
+ rawSeqStore_t seq = {NULL, 0, 0, 0};
+ seq.seq = (rawSeq*)buffer.start;
+ seq.capacity = buffer.capacity / sizeof(rawSeq);
+ return seq;
+}
- jobParams.cParams = params.cParams;
- jobParams.fParams = params.fParams;
- jobParams.compressionLevel = params.compressionLevel;
+static buffer_t seqToBuffer(rawSeqStore_t seq)
+{
+ buffer_t buffer;
+ buffer.start = seq.seq;
+ buffer.capacity = seq.capacity * sizeof(rawSeq);
+ return buffer;
+}
- jobParams.ldmParams = params.ldmParams;
- return jobParams;
+static rawSeqStore_t ZSTDMT_getSeq(ZSTDMT_seqPool* seqPool)
+{
+ if (seqPool->bufferSize == 0) {
+ return kNullRawSeqStore;
+ }
+ return bufferToSeq(ZSTDMT_getBuffer(seqPool));
}
+#if ZSTD_RESIZE_SEQPOOL
+static rawSeqStore_t ZSTDMT_resizeSeq(ZSTDMT_seqPool* seqPool, rawSeqStore_t seq)
+{
+ return bufferToSeq(ZSTDMT_resizeBuffer(seqPool, seqToBuffer(seq)));
+}
+#endif
+
+static void ZSTDMT_releaseSeq(ZSTDMT_seqPool* seqPool, rawSeqStore_t seq)
+{
+ ZSTDMT_releaseBuffer(seqPool, seqToBuffer(seq));
+}
+
+static void ZSTDMT_setNbSeq(ZSTDMT_seqPool* const seqPool, size_t const nbSeq)
+{
+ ZSTDMT_setBufferSize(seqPool, nbSeq * sizeof(rawSeq));
+}
+
+static ZSTDMT_seqPool* ZSTDMT_createSeqPool(unsigned nbWorkers, ZSTD_customMem cMem)
+{
+ ZSTDMT_seqPool* seqPool = ZSTDMT_createBufferPool(nbWorkers, cMem);
+ ZSTDMT_setNbSeq(seqPool, 0);
+ return seqPool;
+}
+
+static void ZSTDMT_freeSeqPool(ZSTDMT_seqPool* seqPool)
+{
+ ZSTDMT_freeBufferPool(seqPool);
+}
+
+
+
/* ===== CCtx Pool ===== */
/* a single CCtx Pool can be invoked from multiple threads in parallel */
@@ -238,23 +334,24 @@ static void ZSTDMT_freeCCtxPool(ZSTDMT_CCtxPool* pool)
}
/* ZSTDMT_createCCtxPool() :
- * implies nbThreads >= 1 , checked by caller ZSTDMT_createCCtx() */
-static ZSTDMT_CCtxPool* ZSTDMT_createCCtxPool(unsigned nbThreads,
+ * implies nbWorkers >= 1 , checked by caller ZSTDMT_createCCtx() */
+static ZSTDMT_CCtxPool* ZSTDMT_createCCtxPool(unsigned nbWorkers,
ZSTD_customMem cMem)
{
ZSTDMT_CCtxPool* const cctxPool = (ZSTDMT_CCtxPool*) ZSTD_calloc(
- sizeof(ZSTDMT_CCtxPool) + (nbThreads-1)*sizeof(ZSTD_CCtx*), cMem);
+ sizeof(ZSTDMT_CCtxPool) + (nbWorkers-1)*sizeof(ZSTD_CCtx*), cMem);
+ assert(nbWorkers > 0);
if (!cctxPool) return NULL;
if (ZSTD_pthread_mutex_init(&cctxPool->poolMutex, NULL)) {
ZSTD_free(cctxPool, cMem);
return NULL;
}
cctxPool->cMem = cMem;
- cctxPool->totalCCtx = nbThreads;
+ cctxPool->totalCCtx = nbWorkers;
cctxPool->availCCtx = 1; /* at least one cctx for single-thread mode */
cctxPool->cctx[0] = ZSTD_createCCtx_advanced(cMem);
if (!cctxPool->cctx[0]) { ZSTDMT_freeCCtxPool(cctxPool); return NULL; }
- DEBUGLOG(3, "cctxPool created, with %u threads", nbThreads);
+ DEBUGLOG(3, "cctxPool created, with %u workers", nbWorkers);
return cctxPool;
}
@@ -262,15 +359,16 @@ static ZSTDMT_CCtxPool* ZSTDMT_createCCtxPool(unsigned nbThreads,
static size_t ZSTDMT_sizeof_CCtxPool(ZSTDMT_CCtxPool* cctxPool)
{
ZSTD_pthread_mutex_lock(&cctxPool->poolMutex);
- { unsigned const nbThreads = cctxPool->totalCCtx;
+ { unsigned const nbWorkers = cctxPool->totalCCtx;
size_t const poolSize = sizeof(*cctxPool)
- + (nbThreads-1)*sizeof(ZSTD_CCtx*);
+ + (nbWorkers-1) * sizeof(ZSTD_CCtx*);
unsigned u;
size_t totalCCtxSize = 0;
- for (u=0; u<nbThreads; u++) {
+ for (u=0; u<nbWorkers; u++) {
totalCCtxSize += ZSTD_sizeof_CCtx(cctxPool->cctx[u]);
}
ZSTD_pthread_mutex_unlock(&cctxPool->poolMutex);
+ assert(nbWorkers > 0);
return poolSize + totalCCtxSize;
}
}
@@ -297,111 +395,318 @@ static void ZSTDMT_releaseCCtx(ZSTDMT_CCtxPool* pool, ZSTD_CCtx* cctx)
if (pool->availCCtx < pool->totalCCtx)
pool->cctx[pool->availCCtx++] = cctx;
else {
- /* pool overflow : should not happen, since totalCCtx==nbThreads */
- DEBUGLOG(5, "CCtx pool overflow : free cctx");
+ /* pool overflow : should not happen, since totalCCtx==nbWorkers */
+ DEBUGLOG(4, "CCtx pool overflow : free cctx");
ZSTD_freeCCtx(cctx);
}
ZSTD_pthread_mutex_unlock(&pool->poolMutex);
}
+/* ==== Serial State ==== */
-/* ===== Thread worker ===== */
+typedef struct {
+ void const* start;
+ size_t size;
+} range_t;
typedef struct {
- buffer_t src;
- const void* srcStart;
- size_t prefixSize;
- size_t srcSize;
- buffer_t dstBuff;
- size_t cSize;
- size_t dstFlushed;
- unsigned firstChunk;
- unsigned lastChunk;
- unsigned jobCompleted;
- unsigned jobScanned;
- ZSTD_pthread_mutex_t* jobCompleted_mutex;
- ZSTD_pthread_cond_t* jobCompleted_cond;
+ /* All variables in the struct are protected by mutex. */
+ ZSTD_pthread_mutex_t mutex;
+ ZSTD_pthread_cond_t cond;
ZSTD_CCtx_params params;
- const ZSTD_CDict* cdict;
- ZSTDMT_CCtxPool* cctxPool;
- ZSTDMT_bufferPool* bufPool;
- unsigned long long fullFrameSize;
+ ldmState_t ldmState;
+ XXH64_state_t xxhState;
+ unsigned nextJobID;
+ /* Protects ldmWindow.
+ * Must be acquired after the main mutex when acquiring both.
+ */
+ ZSTD_pthread_mutex_t ldmWindowMutex;
+ ZSTD_pthread_cond_t ldmWindowCond; /* Signaled when ldmWindow is udpated */
+ ZSTD_window_t ldmWindow; /* A thread-safe copy of ldmState.window */
+} serialState_t;
+
+static int ZSTDMT_serialState_reset(serialState_t* serialState, ZSTDMT_seqPool* seqPool, ZSTD_CCtx_params params)
+{
+ /* Adjust parameters */
+ if (params.ldmParams.enableLdm) {
+ DEBUGLOG(4, "LDM window size = %u KB", (1U << params.cParams.windowLog) >> 10);
+ params.ldmParams.windowLog = params.cParams.windowLog;
+ ZSTD_ldm_adjustParameters(&params.ldmParams, &params.cParams);
+ assert(params.ldmParams.hashLog >= params.ldmParams.bucketSizeLog);
+ assert(params.ldmParams.hashEveryLog < 32);
+ serialState->ldmState.hashPower =
+ ZSTD_ldm_getHashPower(params.ldmParams.minMatchLength);
+ } else {
+ memset(&params.ldmParams, 0, sizeof(params.ldmParams));
+ }
+ serialState->nextJobID = 0;
+ if (params.fParams.checksumFlag)
+ XXH64_reset(&serialState->xxhState, 0);
+ if (params.ldmParams.enableLdm) {
+ ZSTD_customMem cMem = params.customMem;
+ unsigned const hashLog = params.ldmParams.hashLog;
+ size_t const hashSize = ((size_t)1 << hashLog) * sizeof(ldmEntry_t);
+ unsigned const bucketLog =
+ params.ldmParams.hashLog - params.ldmParams.bucketSizeLog;
+ size_t const bucketSize = (size_t)1 << bucketLog;
+ unsigned const prevBucketLog =
+ serialState->params.ldmParams.hashLog -
+ serialState->params.ldmParams.bucketSizeLog;
+ /* Size the seq pool tables */
+ ZSTDMT_setNbSeq(seqPool, ZSTD_ldm_getMaxNbSeq(params.ldmParams, params.jobSize));
+ /* Reset the window */
+ ZSTD_window_clear(&serialState->ldmState.window);
+ serialState->ldmWindow = serialState->ldmState.window;
+ /* Resize tables and output space if necessary. */
+ if (serialState->ldmState.hashTable == NULL || serialState->params.ldmParams.hashLog < hashLog) {
+ ZSTD_free(serialState->ldmState.hashTable, cMem);
+ serialState->ldmState.hashTable = (ldmEntry_t*)ZSTD_malloc(hashSize, cMem);
+ }
+ if (serialState->ldmState.bucketOffsets == NULL || prevBucketLog < bucketLog) {
+ ZSTD_free(serialState->ldmState.bucketOffsets, cMem);
+ serialState->ldmState.bucketOffsets = (BYTE*)ZSTD_malloc(bucketSize, cMem);
+ }
+ if (!serialState->ldmState.hashTable || !serialState->ldmState.bucketOffsets)
+ return 1;
+ /* Zero the tables */
+ memset(serialState->ldmState.hashTable, 0, hashSize);
+ memset(serialState->ldmState.bucketOffsets, 0, bucketSize);
+ }
+ serialState->params = params;
+ return 0;
+}
+
+static int ZSTDMT_serialState_init(serialState_t* serialState)
+{
+ int initError = 0;
+ memset(serialState, 0, sizeof(*serialState));
+ initError |= ZSTD_pthread_mutex_init(&serialState->mutex, NULL);
+ initError |= ZSTD_pthread_cond_init(&serialState->cond, NULL);
+ initError |= ZSTD_pthread_mutex_init(&serialState->ldmWindowMutex, NULL);
+ initError |= ZSTD_pthread_cond_init(&serialState->ldmWindowCond, NULL);
+ return initError;
+}
+
+static void ZSTDMT_serialState_free(serialState_t* serialState)
+{
+ ZSTD_customMem cMem = serialState->params.customMem;
+ ZSTD_pthread_mutex_destroy(&serialState->mutex);
+ ZSTD_pthread_cond_destroy(&serialState->cond);
+ ZSTD_pthread_mutex_destroy(&serialState->ldmWindowMutex);
+ ZSTD_pthread_cond_destroy(&serialState->ldmWindowCond);
+ ZSTD_free(serialState->ldmState.hashTable, cMem);
+ ZSTD_free(serialState->ldmState.bucketOffsets, cMem);
+}
+
+static void ZSTDMT_serialState_update(serialState_t* serialState,
+ ZSTD_CCtx* jobCCtx, rawSeqStore_t seqStore,
+ range_t src, unsigned jobID)
+{
+ /* Wait for our turn */
+ ZSTD_PTHREAD_MUTEX_LOCK(&serialState->mutex);
+ while (serialState->nextJobID < jobID) {
+ ZSTD_pthread_cond_wait(&serialState->cond, &serialState->mutex);
+ }
+ /* A future job may error and skip our job */
+ if (serialState->nextJobID == jobID) {
+ /* It is now our turn, do any processing necessary */
+ if (serialState->params.ldmParams.enableLdm) {
+ size_t error;
+ assert(seqStore.seq != NULL && seqStore.pos == 0 &&
+ seqStore.size == 0 && seqStore.capacity > 0);
+ ZSTD_window_update(&serialState->ldmState.window, src.start, src.size);
+ error = ZSTD_ldm_generateSequences(
+ &serialState->ldmState, &seqStore,
+ &serialState->params.ldmParams, src.start, src.size);
+ /* We provide a large enough buffer to never fail. */
+ assert(!ZSTD_isError(error)); (void)error;
+ /* Update ldmWindow to match the ldmState.window and signal the main
+ * thread if it is waiting for a buffer.
+ */
+ ZSTD_PTHREAD_MUTEX_LOCK(&serialState->ldmWindowMutex);
+ serialState->ldmWindow = serialState->ldmState.window;
+ ZSTD_pthread_cond_signal(&serialState->ldmWindowCond);
+ ZSTD_pthread_mutex_unlock(&serialState->ldmWindowMutex);
+ }
+ if (serialState->params.fParams.checksumFlag && src.size > 0)
+ XXH64_update(&serialState->xxhState, src.start, src.size);
+ }
+ /* Now it is the next jobs turn */
+ serialState->nextJobID++;
+ ZSTD_pthread_cond_broadcast(&serialState->cond);
+ ZSTD_pthread_mutex_unlock(&serialState->mutex);
+
+ if (seqStore.size > 0) {
+ size_t const err = ZSTD_referenceExternalSequences(
+ jobCCtx, seqStore.seq, seqStore.size);
+ assert(serialState->params.ldmParams.enableLdm);
+ assert(!ZSTD_isError(err));
+ (void)err;
+ }
+}
+
+static void ZSTDMT_serialState_ensureFinished(serialState_t* serialState,
+ unsigned jobID, size_t cSize)
+{
+ ZSTD_PTHREAD_MUTEX_LOCK(&serialState->mutex);
+ if (serialState->nextJobID <= jobID) {
+ assert(ZSTD_isError(cSize)); (void)cSize;
+ DEBUGLOG(5, "Skipping past job %u because of error", jobID);
+ serialState->nextJobID = jobID + 1;
+ ZSTD_pthread_cond_broadcast(&serialState->cond);
+
+ ZSTD_PTHREAD_MUTEX_LOCK(&serialState->ldmWindowMutex);
+ ZSTD_window_clear(&serialState->ldmWindow);
+ ZSTD_pthread_cond_signal(&serialState->ldmWindowCond);
+ ZSTD_pthread_mutex_unlock(&serialState->ldmWindowMutex);
+ }
+ ZSTD_pthread_mutex_unlock(&serialState->mutex);
+
+}
+
+
+/* ------------------------------------------ */
+/* ===== Worker thread ===== */
+/* ------------------------------------------ */
+
+static const range_t kNullRange = { NULL, 0 };
+
+typedef struct {
+ size_t consumed; /* SHARED - set0 by mtctx, then modified by worker AND read by mtctx */
+ size_t cSize; /* SHARED - set0 by mtctx, then modified by worker AND read by mtctx, then set0 by mtctx */
+ ZSTD_pthread_mutex_t job_mutex; /* Thread-safe - used by mtctx and worker */
+ ZSTD_pthread_cond_t job_cond; /* Thread-safe - used by mtctx and worker */
+ ZSTDMT_CCtxPool* cctxPool; /* Thread-safe - used by mtctx and (all) workers */
+ ZSTDMT_bufferPool* bufPool; /* Thread-safe - used by mtctx and (all) workers */
+ ZSTDMT_seqPool* seqPool; /* Thread-safe - used by mtctx and (all) workers */
+ serialState_t* serial; /* Thread-safe - used by mtctx and (all) workers */
+ buffer_t dstBuff; /* set by worker (or mtctx), then read by worker & mtctx, then modified by mtctx => no barrier */
+ range_t prefix; /* set by mtctx, then read by worker & mtctx => no barrier */
+ range_t src; /* set by mtctx, then read by worker & mtctx => no barrier */
+ unsigned jobID; /* set by mtctx, then read by worker => no barrier */
+ unsigned firstJob; /* set by mtctx, then read by worker => no barrier */
+ unsigned lastJob; /* set by mtctx, then read by worker => no barrier */
+ ZSTD_CCtx_params params; /* set by mtctx, then read by worker => no barrier */
+ const ZSTD_CDict* cdict; /* set by mtctx, then read by worker => no barrier */
+ unsigned long long fullFrameSize; /* set by mtctx, then read by worker => no barrier */
+ size_t dstFlushed; /* used only by mtctx */
+ unsigned frameChecksumNeeded; /* used only by mtctx */
} ZSTDMT_jobDescription;
-/* ZSTDMT_compressChunk() : POOL_function type */
-void ZSTDMT_compressChunk(void* jobDescription)
+/* ZSTDMT_compressionJob() is a POOL_function type */
+void ZSTDMT_compressionJob(void* jobDescription)
{
ZSTDMT_jobDescription* const job = (ZSTDMT_jobDescription*)jobDescription;
+ ZSTD_CCtx_params jobParams = job->params; /* do not modify job->params ! copy it, modify the copy */
ZSTD_CCtx* const cctx = ZSTDMT_getCCtx(job->cctxPool);
- const void* const src = (const char*)job->srcStart + job->prefixSize;
+ rawSeqStore_t rawSeqStore = ZSTDMT_getSeq(job->seqPool);
buffer_t dstBuff = job->dstBuff;
- DEBUGLOG(5, "ZSTDMT_compressChunk: job (first:%u) (last:%u) : prefixSize %u, srcSize %u ",
- job->firstChunk, job->lastChunk, (U32)job->prefixSize, (U32)job->srcSize);
+ /* Don't compute the checksum for chunks, since we compute it externally,
+ * but write it in the header.
+ */
+ if (job->jobID != 0) jobParams.fParams.checksumFlag = 0;
+ /* Don't run LDM for the chunks, since we handle it externally */
+ jobParams.ldmParams.enableLdm = 0;
+
+ /* ressources */
if (cctx==NULL) {
job->cSize = ERROR(memory_allocation);
goto _endJob;
}
-
- if (dstBuff.start == NULL) {
+ if (dstBuff.start == NULL) { /* streaming job : doesn't provide a dstBuffer */
dstBuff = ZSTDMT_getBuffer(job->bufPool);
if (dstBuff.start==NULL) {
job->cSize = ERROR(memory_allocation);
goto _endJob;
}
- job->dstBuff = dstBuff;
- DEBUGLOG(5, "ZSTDMT_compressChunk: received dstBuff of size %u", (U32)dstBuff.size);
+ job->dstBuff = dstBuff; /* this value can be read in ZSTDMT_flush, when it copies the whole job */
}
+ /* init */
if (job->cdict) {
- size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, NULL, 0, ZSTD_dm_auto, job->cdict, job->params, job->fullFrameSize);
- DEBUGLOG(4, "ZSTDMT_compressChunk: init using CDict (windowLog=%u)", job->params.cParams.windowLog);
- assert(job->firstChunk); /* only allowed for first job */
+ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, NULL, 0, ZSTD_dct_auto, job->cdict, jobParams, job->fullFrameSize);
+ assert(job->firstJob); /* only allowed for first job */
if (ZSTD_isError(initError)) { job->cSize = initError; goto _endJob; }
} else { /* srcStart points at reloaded section */
- U64 const pledgedSrcSize = job->firstChunk ? job->fullFrameSize : ZSTD_CONTENTSIZE_UNKNOWN;
- ZSTD_CCtx_params jobParams = job->params; /* do not modify job->params ! copy it, modify the copy */
- size_t const forceWindowError = ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_p_forceMaxWindow, !job->firstChunk);
- if (ZSTD_isError(forceWindowError)) {
- DEBUGLOG(5, "ZSTD_CCtxParam_setParameter error : %s ", ZSTD_getErrorName(forceWindowError));
- job->cSize = forceWindowError;
- goto _endJob;
- }
- DEBUGLOG(5, "ZSTDMT_compressChunk: invoking ZSTD_compressBegin_advanced_internal with windowLog = %u ", jobParams.cParams.windowLog);
+ U64 const pledgedSrcSize = job->firstJob ? job->fullFrameSize : job->src.size;
+ { size_t const forceWindowError = ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_p_forceMaxWindow, !job->firstJob);
+ if (ZSTD_isError(forceWindowError)) {
+ job->cSize = forceWindowError;
+ goto _endJob;
+ } }
{ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx,
- job->srcStart, job->prefixSize, ZSTD_dm_rawContent, /* load dictionary in "content-only" mode (no header analysis) */
- NULL,
+ job->prefix.start, job->prefix.size, ZSTD_dct_rawContent, /* load dictionary in "content-only" mode (no header analysis) */
+ NULL, /*cdict*/
jobParams, pledgedSrcSize);
if (ZSTD_isError(initError)) {
- DEBUGLOG(5, "ZSTD_compressBegin_advanced_internal error : %s ", ZSTD_getErrorName(initError));
job->cSize = initError;
goto _endJob;
- } }
- }
- if (!job->firstChunk) { /* flush and overwrite frame header when it's not first job */
- size_t const hSize = ZSTD_compressContinue(cctx, dstBuff.start, dstBuff.size, src, 0);
+ } } }
+
+ /* Perform serial step as early as possible, but after CCtx initialization */
+ ZSTDMT_serialState_update(job->serial, cctx, rawSeqStore, job->src, job->jobID);
+
+ if (!job->firstJob) { /* flush and overwrite frame header when it's not first job */
+ size_t const hSize = ZSTD_compressContinue(cctx, dstBuff.start, dstBuff.capacity, job->src.start, 0);
if (ZSTD_isError(hSize)) { job->cSize = hSize; /* save error code */ goto _endJob; }
+ DEBUGLOG(5, "ZSTDMT_compressionJob: flush and overwrite %u bytes of frame header (not first job)", (U32)hSize);
ZSTD_invalidateRepCodes(cctx);
}
- DEBUGLOG(5, "Compressing into dstBuff of size %u", (U32)dstBuff.size);
- DEBUG_PRINTHEX(6, job->srcStart, 12);
- job->cSize = (job->lastChunk) ?
- ZSTD_compressEnd (cctx, dstBuff.start, dstBuff.size, src, job->srcSize) :
- ZSTD_compressContinue(cctx, dstBuff.start, dstBuff.size, src, job->srcSize);
- DEBUGLOG(5, "compressed %u bytes into %u bytes (first:%u) (last:%u) ",
- (unsigned)job->srcSize, (unsigned)job->cSize, job->firstChunk, job->lastChunk);
- DEBUGLOG(5, "dstBuff.size : %u ; => %s ", (U32)dstBuff.size, ZSTD_getErrorName(job->cSize));
+ /* compress */
+ { size_t const chunkSize = 4*ZSTD_BLOCKSIZE_MAX;
+ int const nbChunks = (int)((job->src.size + (chunkSize-1)) / chunkSize);
+ const BYTE* ip = (const BYTE*) job->src.start;
+ BYTE* const ostart = (BYTE*)dstBuff.start;
+ BYTE* op = ostart;
+ BYTE* oend = op + dstBuff.capacity;
+ int chunkNb;
+ if (sizeof(size_t) > sizeof(int)) assert(job->src.size < ((size_t)INT_MAX) * chunkSize); /* check overflow */
+ DEBUGLOG(5, "ZSTDMT_compressionJob: compress %u bytes in %i blocks", (U32)job->src.size, nbChunks);
+ assert(job->cSize == 0);
+ for (chunkNb = 1; chunkNb < nbChunks; chunkNb++) {
+ size_t const cSize = ZSTD_compressContinue(cctx, op, oend-op, ip, chunkSize);
+ if (ZSTD_isError(cSize)) { job->cSize = cSize; goto _endJob; }
+ ip += chunkSize;
+ op += cSize; assert(op < oend);
+ /* stats */
+ ZSTD_PTHREAD_MUTEX_LOCK(&job->job_mutex);
+ job->cSize += cSize;
+ job->consumed = chunkSize * chunkNb;
+ DEBUGLOG(5, "ZSTDMT_compressionJob: compress new block : cSize==%u bytes (total: %u)",
+ (U32)cSize, (U32)job->cSize);
+ ZSTD_pthread_cond_signal(&job->job_cond); /* warns some more data is ready to be flushed */
+ ZSTD_pthread_mutex_unlock(&job->job_mutex);
+ }
+ /* last block */
+ assert(chunkSize > 0); assert((chunkSize & (chunkSize - 1)) == 0); /* chunkSize must be power of 2 for mask==(chunkSize-1) to work */
+ if ((nbChunks > 0) | job->lastJob /*must output a "last block" flag*/ ) {
+ size_t const lastBlockSize1 = job->src.size & (chunkSize-1);
+ size_t const lastBlockSize = ((lastBlockSize1==0) & (job->src.size>=chunkSize)) ? chunkSize : lastBlockSize1;
+ size_t const cSize = (job->lastJob) ?
+ ZSTD_compressEnd (cctx, op, oend-op, ip, lastBlockSize) :
+ ZSTD_compressContinue(cctx, op, oend-op, ip, lastBlockSize);
+ if (ZSTD_isError(cSize)) { job->cSize = cSize; goto _endJob; }
+ /* stats */
+ ZSTD_PTHREAD_MUTEX_LOCK(&job->job_mutex);
+ job->cSize += cSize;
+ ZSTD_pthread_mutex_unlock(&job->job_mutex);
+ } }
_endJob:
+ ZSTDMT_serialState_ensureFinished(job->serial, job->jobID, job->cSize);
+ if (job->prefix.size > 0)
+ DEBUGLOG(5, "Finished with prefix: %zx", (size_t)job->prefix.start);
+ DEBUGLOG(5, "Finished with source: %zx", (size_t)job->src.start);
+ /* release resources */
+ ZSTDMT_releaseSeq(job->seqPool, rawSeqStore);
ZSTDMT_releaseCCtx(job->cctxPool, cctx);
- ZSTDMT_releaseBuffer(job->bufPool, job->src);
- job->src = g_nullBuffer; job->srcStart = NULL;
- ZSTD_PTHREAD_MUTEX_LOCK(job->jobCompleted_mutex);
- job->jobCompleted = 1;
- job->jobScanned = 0;
- ZSTD_pthread_cond_signal(job->jobCompleted_cond);
- ZSTD_pthread_mutex_unlock(job->jobCompleted_mutex);
+ /* report */
+ ZSTD_PTHREAD_MUTEX_LOCK(&job->job_mutex);
+ job->consumed = job->src.size;
+ ZSTD_pthread_cond_signal(&job->job_cond);
+ ZSTD_pthread_mutex_unlock(&job->job_mutex);
}
@@ -410,109 +715,141 @@ _endJob:
/* ------------------------------------------ */
typedef struct {
+ range_t prefix; /* read-only non-owned prefix buffer */
buffer_t buffer;
size_t filled;
} inBuff_t;
+typedef struct {
+ BYTE* buffer; /* The round input buffer. All jobs get references
+ * to pieces of the buffer. ZSTDMT_tryGetInputRange()
+ * handles handing out job input buffers, and makes
+ * sure it doesn't overlap with any pieces still in use.
+ */
+ size_t capacity; /* The capacity of buffer. */
+ size_t pos; /* The position of the current inBuff in the round
+ * buffer. Updated past the end if the inBuff once
+ * the inBuff is sent to the worker thread.
+ * pos <= capacity.
+ */
+} roundBuff_t;
+
+static const roundBuff_t kNullRoundBuff = {NULL, 0, 0};
+
struct ZSTDMT_CCtx_s {
POOL_ctx* factory;
ZSTDMT_jobDescription* jobs;
ZSTDMT_bufferPool* bufPool;
ZSTDMT_CCtxPool* cctxPool;
- ZSTD_pthread_mutex_t jobCompleted_mutex;
- ZSTD_pthread_cond_t jobCompleted_cond;
+ ZSTDMT_seqPool* seqPool;
ZSTD_CCtx_params params;
size_t targetSectionSize;
- size_t inBuffSize;
- size_t dictSize;
- size_t targetDictSize;
+ size_t targetPrefixSize;
+ roundBuff_t roundBuff;
inBuff_t inBuff;
- XXH64_state_t xxhState;
- unsigned singleThreaded;
+ int jobReady; /* 1 => one job is already prepared, but pool has shortage of workers. Don't create another one. */
+ serialState_t serial;
+ unsigned singleBlockingThread;
unsigned jobIDMask;
unsigned doneJobID;
unsigned nextJobID;
unsigned frameEnded;
unsigned allJobsCompleted;
unsigned long long frameContentSize;
+ unsigned long long consumed;
+ unsigned long long produced;
ZSTD_customMem cMem;
ZSTD_CDict* cdictLocal;
const ZSTD_CDict* cdict;
};
-static ZSTDMT_jobDescription* ZSTDMT_allocJobsTable(U32* nbJobsPtr, ZSTD_customMem cMem)
+static void ZSTDMT_freeJobsTable(ZSTDMT_jobDescription* jobTable, U32 nbJobs, ZSTD_customMem cMem)
+{
+ U32 jobNb;
+ if (jobTable == NULL) return;
+ for (jobNb=0; jobNb<nbJobs; jobNb++) {
+ ZSTD_pthread_mutex_destroy(&jobTable[jobNb].job_mutex);
+ ZSTD_pthread_cond_destroy(&jobTable[jobNb].job_cond);
+ }
+ ZSTD_free(jobTable, cMem);
+}
+
+/* ZSTDMT_allocJobsTable()
+ * allocate and init a job table.
+ * update *nbJobsPtr to next power of 2 value, as size of table */
+static ZSTDMT_jobDescription* ZSTDMT_createJobsTable(U32* nbJobsPtr, ZSTD_customMem cMem)
{
U32 const nbJobsLog2 = ZSTD_highbit32(*nbJobsPtr) + 1;
U32 const nbJobs = 1 << nbJobsLog2;
+ U32 jobNb;
+ ZSTDMT_jobDescription* const jobTable = (ZSTDMT_jobDescription*)
+ ZSTD_calloc(nbJobs * sizeof(ZSTDMT_jobDescription), cMem);
+ int initError = 0;
+ if (jobTable==NULL) return NULL;
*nbJobsPtr = nbJobs;
- return (ZSTDMT_jobDescription*) ZSTD_calloc(
- nbJobs * sizeof(ZSTDMT_jobDescription), cMem);
+ for (jobNb=0; jobNb<nbJobs; jobNb++) {
+ initError |= ZSTD_pthread_mutex_init(&jobTable[jobNb].job_mutex, NULL);
+ initError |= ZSTD_pthread_cond_init(&jobTable[jobNb].job_cond, NULL);
+ }
+ if (initError != 0) {
+ ZSTDMT_freeJobsTable(jobTable, nbJobs, cMem);
+ return NULL;
+ }
+ return jobTable;
}
-/* ZSTDMT_CCtxParam_setNbThreads():
+/* ZSTDMT_CCtxParam_setNbWorkers():
* Internal use only */
-size_t ZSTDMT_CCtxParam_setNbThreads(ZSTD_CCtx_params* params, unsigned nbThreads)
+size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers)
{
- if (nbThreads > ZSTDMT_NBTHREADS_MAX) nbThreads = ZSTDMT_NBTHREADS_MAX;
- if (nbThreads < 1) nbThreads = 1;
- params->nbThreads = nbThreads;
+ if (nbWorkers > ZSTDMT_NBWORKERS_MAX) nbWorkers = ZSTDMT_NBWORKERS_MAX;
+ params->nbWorkers = nbWorkers;
params->overlapSizeLog = ZSTDMT_OVERLAPLOG_DEFAULT;
params->jobSize = 0;
- return nbThreads;
-}
-
-/* ZSTDMT_getNbThreads():
- * @return nb threads currently active in mtctx.
- * mtctx must be valid */
-size_t ZSTDMT_getNbThreads(const ZSTDMT_CCtx* mtctx)
-{
- assert(mtctx != NULL);
- return mtctx->params.nbThreads;
+ return nbWorkers;
}
-ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbThreads, ZSTD_customMem cMem)
+ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers, ZSTD_customMem cMem)
{
ZSTDMT_CCtx* mtctx;
- U32 nbJobs = nbThreads + 2;
- DEBUGLOG(3, "ZSTDMT_createCCtx_advanced (nbThreads = %u)", nbThreads);
+ U32 nbJobs = nbWorkers + 2;
+ int initError;
+ DEBUGLOG(3, "ZSTDMT_createCCtx_advanced (nbWorkers = %u)", nbWorkers);
- if (nbThreads < 1) return NULL;
- nbThreads = MIN(nbThreads , ZSTDMT_NBTHREADS_MAX);
+ if (nbWorkers < 1) return NULL;
+ nbWorkers = MIN(nbWorkers , ZSTDMT_NBWORKERS_MAX);
if ((cMem.customAlloc!=NULL) ^ (cMem.customFree!=NULL))
/* invalid custom allocator */
return NULL;
mtctx = (ZSTDMT_CCtx*) ZSTD_calloc(sizeof(ZSTDMT_CCtx), cMem);
if (!mtctx) return NULL;
- ZSTDMT_CCtxParam_setNbThreads(&mtctx->params, nbThreads);
+ ZSTDMT_CCtxParam_setNbWorkers(&mtctx->params, nbWorkers);
mtctx->cMem = cMem;
mtctx->allJobsCompleted = 1;
- mtctx->factory = POOL_create_advanced(nbThreads, 0, cMem);
- mtctx->jobs = ZSTDMT_allocJobsTable(&nbJobs, cMem);
+ mtctx->factory = POOL_create_advanced(nbWorkers, 0, cMem);
+ mtctx->jobs = ZSTDMT_createJobsTable(&nbJobs, cMem);
+ assert(nbJobs > 0); assert((nbJobs & (nbJobs - 1)) == 0); /* ensure nbJobs is a power of 2 */
mtctx->jobIDMask = nbJobs - 1;
- mtctx->bufPool = ZSTDMT_createBufferPool(nbThreads, cMem);
- mtctx->cctxPool = ZSTDMT_createCCtxPool(nbThreads, cMem);
- if (!mtctx->factory | !mtctx->jobs | !mtctx->bufPool | !mtctx->cctxPool) {
+ mtctx->bufPool = ZSTDMT_createBufferPool(nbWorkers, cMem);
+ mtctx->cctxPool = ZSTDMT_createCCtxPool(nbWorkers, cMem);
+ mtctx->seqPool = ZSTDMT_createSeqPool(nbWorkers, cMem);
+ initError = ZSTDMT_serialState_init(&mtctx->serial);
+ mtctx->roundBuff = kNullRoundBuff;
+ if (!mtctx->factory | !mtctx->jobs | !mtctx->bufPool | !mtctx->cctxPool | !mtctx->seqPool | initError) {
ZSTDMT_freeCCtx(mtctx);
return NULL;
}
- if (ZSTD_pthread_mutex_init(&mtctx->jobCompleted_mutex, NULL)) {
- ZSTDMT_freeCCtx(mtctx);
- return NULL;
- }
- if (ZSTD_pthread_cond_init(&mtctx->jobCompleted_cond, NULL)) {
- ZSTDMT_freeCCtx(mtctx);
- return NULL;
- }
- DEBUGLOG(3, "mt_cctx created, for %u threads", nbThreads);
+ DEBUGLOG(3, "mt_cctx created, for %u threads", nbWorkers);
return mtctx;
}
-ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbThreads)
+ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbWorkers)
{
- return ZSTDMT_createCCtx_advanced(nbThreads, ZSTD_defaultCMem);
+ return ZSTDMT_createCCtx_advanced(nbWorkers, ZSTD_defaultCMem);
}
+
/* ZSTDMT_releaseAllJobResources() :
* note : ensure all workers are killed first ! */
static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)
@@ -523,29 +860,26 @@ static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)
DEBUGLOG(4, "job%02u: release dst address %08X", jobID, (U32)(size_t)mtctx->jobs[jobID].dstBuff.start);
ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->jobs[jobID].dstBuff);
mtctx->jobs[jobID].dstBuff = g_nullBuffer;
- DEBUGLOG(4, "job%02u: release src address %08X", jobID, (U32)(size_t)mtctx->jobs[jobID].src.start);
- ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->jobs[jobID].src);
- mtctx->jobs[jobID].src = g_nullBuffer;
+ mtctx->jobs[jobID].cSize = 0;
}
memset(mtctx->jobs, 0, (mtctx->jobIDMask+1)*sizeof(ZSTDMT_jobDescription));
- DEBUGLOG(4, "input: release address %08X", (U32)(size_t)mtctx->inBuff.buffer.start);
- ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->inBuff.buffer);
mtctx->inBuff.buffer = g_nullBuffer;
+ mtctx->inBuff.filled = 0;
mtctx->allJobsCompleted = 1;
}
-static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* zcs)
+static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* mtctx)
{
DEBUGLOG(4, "ZSTDMT_waitForAllJobsCompleted");
- while (zcs->doneJobID < zcs->nextJobID) {
- unsigned const jobID = zcs->doneJobID & zcs->jobIDMask;
- ZSTD_PTHREAD_MUTEX_LOCK(&zcs->jobCompleted_mutex);
- while (zcs->jobs[jobID].jobCompleted==0) {
- DEBUGLOG(5, "waiting for jobCompleted signal from chunk %u", zcs->doneJobID); /* we want to block when waiting for data to flush */
- ZSTD_pthread_cond_wait(&zcs->jobCompleted_cond, &zcs->jobCompleted_mutex);
+ while (mtctx->doneJobID < mtctx->nextJobID) {
+ unsigned const jobID = mtctx->doneJobID & mtctx->jobIDMask;
+ ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobs[jobID].job_mutex);
+ while (mtctx->jobs[jobID].consumed < mtctx->jobs[jobID].src.size) {
+ DEBUGLOG(5, "waiting for jobCompleted signal from job %u", mtctx->doneJobID); /* we want to block when waiting for data to flush */
+ ZSTD_pthread_cond_wait(&mtctx->jobs[jobID].job_cond, &mtctx->jobs[jobID].job_mutex);
}
- ZSTD_pthread_mutex_unlock(&zcs->jobCompleted_mutex);
- zcs->doneJobID++;
+ ZSTD_pthread_mutex_unlock(&mtctx->jobs[jobID].job_mutex);
+ mtctx->doneJobID++;
}
}
@@ -554,12 +888,14 @@ size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx)
if (mtctx==NULL) return 0; /* compatible with free on NULL */
POOL_free(mtctx->factory); /* stop and free worker threads */
ZSTDMT_releaseAllJobResources(mtctx); /* release job resources into pools first */
- ZSTD_free(mtctx->jobs, mtctx->cMem);
+ ZSTDMT_freeJobsTable(mtctx->jobs, mtctx->jobIDMask+1, mtctx->cMem);
ZSTDMT_freeBufferPool(mtctx->bufPool);
ZSTDMT_freeCCtxPool(mtctx->cctxPool);
+ ZSTDMT_freeSeqPool(mtctx->seqPool);
+ ZSTDMT_serialState_free(&mtctx->serial);
ZSTD_freeCDict(mtctx->cdictLocal);
- ZSTD_pthread_mutex_destroy(&mtctx->jobCompleted_mutex);
- ZSTD_pthread_cond_destroy(&mtctx->jobCompleted_cond);
+ if (mtctx->roundBuff.buffer)
+ ZSTD_free(mtctx->roundBuff.buffer, mtctx->cMem);
ZSTD_free(mtctx, mtctx->cMem);
return 0;
}
@@ -572,7 +908,9 @@ size_t ZSTDMT_sizeof_CCtx(ZSTDMT_CCtx* mtctx)
+ ZSTDMT_sizeof_bufferPool(mtctx->bufPool)
+ (mtctx->jobIDMask+1) * sizeof(ZSTDMT_jobDescription)
+ ZSTDMT_sizeof_CCtxPool(mtctx->cctxPool)
- + ZSTD_sizeof_CDict(mtctx->cdictLocal);
+ + ZSTDMT_sizeof_seqPool(mtctx->seqPool)
+ + ZSTD_sizeof_CDict(mtctx->cdictLocal)
+ + mtctx->roundBuff.capacity;
}
/* Internal only */
@@ -612,133 +950,224 @@ size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter,
}
}
+/* Sets parameters relevant to the compression job,
+ * initializing others to default values. */
+static ZSTD_CCtx_params ZSTDMT_initJobCCtxParams(ZSTD_CCtx_params const params)
+{
+ ZSTD_CCtx_params jobParams;
+ memset(&jobParams, 0, sizeof(jobParams));
+
+ jobParams.cParams = params.cParams;
+ jobParams.fParams = params.fParams;
+ jobParams.compressionLevel = params.compressionLevel;
+ jobParams.disableLiteralCompression = params.disableLiteralCompression;
+
+ return jobParams;
+}
+
+/*! ZSTDMT_updateCParams_whileCompressing() :
+ * Updates only a selected set of compression parameters, to remain compatible with current frame.
+ * New parameters will be applied to next compression job. */
+void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx* mtctx, const ZSTD_CCtx_params* cctxParams)
+{
+ U32 const saved_wlog = mtctx->params.cParams.windowLog; /* Do not modify windowLog while compressing */
+ int const compressionLevel = cctxParams->compressionLevel;
+ DEBUGLOG(5, "ZSTDMT_updateCParams_whileCompressing (level:%i)",
+ compressionLevel);
+ mtctx->params.compressionLevel = compressionLevel;
+ { ZSTD_compressionParameters cParams = ZSTD_getCParamsFromCCtxParams(cctxParams, 0, 0);
+ cParams.windowLog = saved_wlog;
+ mtctx->params.cParams = cParams;
+ }
+}
+
+/* ZSTDMT_getNbWorkers():
+ * @return nb threads currently active in mtctx.
+ * mtctx must be valid */
+unsigned ZSTDMT_getNbWorkers(const ZSTDMT_CCtx* mtctx)
+{
+ assert(mtctx != NULL);
+ return mtctx->params.nbWorkers;
+}
+
+/* ZSTDMT_getFrameProgression():
+ * tells how much data has been consumed (input) and produced (output) for current frame.
+ * able to count progression inside worker threads.
+ * Note : mutex will be acquired during statistics collection. */
+ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx)
+{
+ ZSTD_frameProgression fps;
+ DEBUGLOG(6, "ZSTDMT_getFrameProgression");
+ fps.consumed = mtctx->consumed;
+ fps.produced = mtctx->produced;
+ fps.ingested = mtctx->consumed + mtctx->inBuff.filled;
+ { unsigned jobNb;
+ unsigned lastJobNb = mtctx->nextJobID + mtctx->jobReady; assert(mtctx->jobReady <= 1);
+ DEBUGLOG(6, "ZSTDMT_getFrameProgression: jobs: from %u to <%u (jobReady:%u)",
+ mtctx->doneJobID, lastJobNb, mtctx->jobReady)
+ for (jobNb = mtctx->doneJobID ; jobNb < lastJobNb ; jobNb++) {
+ unsigned const wJobID = jobNb & mtctx->jobIDMask;
+ ZSTD_pthread_mutex_lock(&mtctx->jobs[wJobID].job_mutex);
+ { size_t const cResult = mtctx->jobs[wJobID].cSize;
+ size_t const produced = ZSTD_isError(cResult) ? 0 : cResult;
+ fps.consumed += mtctx->jobs[wJobID].consumed;
+ fps.ingested += mtctx->jobs[wJobID].src.size;
+ fps.produced += produced;
+ }
+ ZSTD_pthread_mutex_unlock(&mtctx->jobs[wJobID].job_mutex);
+ }
+ }
+ return fps;
+}
+
+
/* ------------------------------------------ */
/* ===== Multi-threaded compression ===== */
/* ------------------------------------------ */
-static unsigned computeNbChunks(size_t srcSize, unsigned windowLog, unsigned nbThreads) {
- size_t const chunkSizeTarget = (size_t)1 << (windowLog + 2);
- size_t const chunkMaxSize = chunkSizeTarget << 2;
- size_t const passSizeMax = chunkMaxSize * nbThreads;
- unsigned const multiplier = (unsigned)(srcSize / passSizeMax) + 1;
- unsigned const nbChunksLarge = multiplier * nbThreads;
- unsigned const nbChunksMax = (unsigned)(srcSize / chunkSizeTarget) + 1;
- unsigned const nbChunksSmall = MIN(nbChunksMax, nbThreads);
- return (multiplier>1) ? nbChunksLarge : nbChunksSmall;
+static size_t ZSTDMT_computeTargetJobLog(ZSTD_CCtx_params const params)
+{
+ if (params.ldmParams.enableLdm)
+ return MAX(21, params.cParams.chainLog + 4);
+ return MAX(20, params.cParams.windowLog + 2);
+}
+
+static size_t ZSTDMT_computeOverlapLog(ZSTD_CCtx_params const params)
+{
+ unsigned const overlapRLog = (params.overlapSizeLog>9) ? 0 : 9-params.overlapSizeLog;
+ if (params.ldmParams.enableLdm)
+ return (MIN(params.cParams.windowLog, ZSTDMT_computeTargetJobLog(params) - 2) - overlapRLog);
+ return overlapRLog >= 9 ? 0 : (params.cParams.windowLog - overlapRLog);
}
+static unsigned ZSTDMT_computeNbJobs(ZSTD_CCtx_params params, size_t srcSize, unsigned nbWorkers) {
+ assert(nbWorkers>0);
+ { size_t const jobSizeTarget = (size_t)1 << ZSTDMT_computeTargetJobLog(params);
+ size_t const jobMaxSize = jobSizeTarget << 2;
+ size_t const passSizeMax = jobMaxSize * nbWorkers;
+ unsigned const multiplier = (unsigned)(srcSize / passSizeMax) + 1;
+ unsigned const nbJobsLarge = multiplier * nbWorkers;
+ unsigned const nbJobsMax = (unsigned)(srcSize / jobSizeTarget) + 1;
+ unsigned const nbJobsSmall = MIN(nbJobsMax, nbWorkers);
+ return (multiplier>1) ? nbJobsLarge : nbJobsSmall;
+} }
+
+/* ZSTDMT_compress_advanced_internal() :
+ * This is a blocking function : it will only give back control to caller after finishing its compression job.
+ */
static size_t ZSTDMT_compress_advanced_internal(
ZSTDMT_CCtx* mtctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize,
const ZSTD_CDict* cdict,
- ZSTD_CCtx_params const params)
+ ZSTD_CCtx_params params)
{
- ZSTD_CCtx_params const jobParams = ZSTDMT_makeJobCCtxParams(params);
- unsigned const overlapRLog = (params.overlapSizeLog>9) ? 0 : 9-params.overlapSizeLog;
- size_t const overlapSize = (overlapRLog>=9) ? 0 : (size_t)1 << (params.cParams.windowLog - overlapRLog);
- unsigned nbChunks = computeNbChunks(srcSize, params.cParams.windowLog, params.nbThreads);
- size_t const proposedChunkSize = (srcSize + (nbChunks-1)) / nbChunks;
- size_t const avgChunkSize = (((proposedChunkSize-1) & 0x1FFFF) < 0x7FFF) ? proposedChunkSize + 0xFFFF : proposedChunkSize; /* avoid too small last block */
+ ZSTD_CCtx_params const jobParams = ZSTDMT_initJobCCtxParams(params);
+ size_t const overlapSize = (size_t)1 << ZSTDMT_computeOverlapLog(params);
+ unsigned const nbJobs = ZSTDMT_computeNbJobs(params, srcSize, params.nbWorkers);
+ size_t const proposedJobSize = (srcSize + (nbJobs-1)) / nbJobs;
+ size_t const avgJobSize = (((proposedJobSize-1) & 0x1FFFF) < 0x7FFF) ? proposedJobSize + 0xFFFF : proposedJobSize; /* avoid too small last block */
const char* const srcStart = (const char*)src;
size_t remainingSrcSize = srcSize;
- unsigned const compressWithinDst = (dstCapacity >= ZSTD_compressBound(srcSize)) ? nbChunks : (unsigned)(dstCapacity / ZSTD_compressBound(avgChunkSize)); /* presumes avgChunkSize >= 256 KB, which should be the case */
+ unsigned const compressWithinDst = (dstCapacity >= ZSTD_compressBound(srcSize)) ? nbJobs : (unsigned)(dstCapacity / ZSTD_compressBound(avgJobSize)); /* presumes avgJobSize >= 256 KB, which should be the case */
size_t frameStartPos = 0, dstBufferPos = 0;
- XXH64_state_t xxh64;
- assert(jobParams.nbThreads == 0);
- assert(mtctx->cctxPool->totalCCtx == params.nbThreads);
+ assert(jobParams.nbWorkers == 0);
+ assert(mtctx->cctxPool->totalCCtx == params.nbWorkers);
- DEBUGLOG(4, "ZSTDMT_compress_advanced_internal: nbChunks=%2u (rawSize=%u bytes; fixedSize=%u) ",
- nbChunks, (U32)proposedChunkSize, (U32)avgChunkSize);
- if (nbChunks==1) { /* fallback to single-thread mode */
+ params.jobSize = (U32)avgJobSize;
+ DEBUGLOG(4, "ZSTDMT_compress_advanced_internal: nbJobs=%2u (rawSize=%u bytes; fixedSize=%u) ",
+ nbJobs, (U32)proposedJobSize, (U32)avgJobSize);
+
+ if ((nbJobs==1) | (params.nbWorkers<=1)) { /* fallback to single-thread mode : this is a blocking invocation anyway */
ZSTD_CCtx* const cctx = mtctx->cctxPool->cctx[0];
+ DEBUGLOG(4, "ZSTDMT_compress_advanced_internal: fallback to single-thread mode");
if (cdict) return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, jobParams.fParams);
return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, NULL, 0, jobParams);
}
- assert(avgChunkSize >= 256 KB); /* condition for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B), which is required for compressWithinDst */
- ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(avgChunkSize) );
- XXH64_reset(&xxh64, 0);
- if (nbChunks > mtctx->jobIDMask+1) { /* enlarge job table */
- U32 nbJobs = nbChunks;
- ZSTD_free(mtctx->jobs, mtctx->cMem);
+ assert(avgJobSize >= 256 KB); /* condition for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B), required to compress directly into Dst (no additional buffer) */
+ ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(avgJobSize) );
+ if (ZSTDMT_serialState_reset(&mtctx->serial, mtctx->seqPool, params))
+ return ERROR(memory_allocation);
+
+ if (nbJobs > mtctx->jobIDMask+1) { /* enlarge job table */
+ U32 jobsTableSize = nbJobs;
+ ZSTDMT_freeJobsTable(mtctx->jobs, mtctx->jobIDMask+1, mtctx->cMem);
mtctx->jobIDMask = 0;
- mtctx->jobs = ZSTDMT_allocJobsTable(&nbJobs, mtctx->cMem);
+ mtctx->jobs = ZSTDMT_createJobsTable(&jobsTableSize, mtctx->cMem);
if (mtctx->jobs==NULL) return ERROR(memory_allocation);
- mtctx->jobIDMask = nbJobs - 1;
+ assert((jobsTableSize != 0) && ((jobsTableSize & (jobsTableSize - 1)) == 0)); /* ensure jobsTableSize is a power of 2 */
+ mtctx->jobIDMask = jobsTableSize - 1;
}
{ unsigned u;
- for (u=0; u<nbChunks; u++) {
- size_t const chunkSize = MIN(remainingSrcSize, avgChunkSize);
- size_t const dstBufferCapacity = ZSTD_compressBound(chunkSize);
+ for (u=0; u<nbJobs; u++) {
+ size_t const jobSize = MIN(remainingSrcSize, avgJobSize);
+ size_t const dstBufferCapacity = ZSTD_compressBound(jobSize);
buffer_t const dstAsBuffer = { (char*)dst + dstBufferPos, dstBufferCapacity };
buffer_t const dstBuffer = u < compressWithinDst ? dstAsBuffer : g_nullBuffer;
size_t dictSize = u ? overlapSize : 0;
- mtctx->jobs[u].src = g_nullBuffer;
- mtctx->jobs[u].srcStart = srcStart + frameStartPos - dictSize;
- mtctx->jobs[u].prefixSize = dictSize;
- mtctx->jobs[u].srcSize = chunkSize;
+ mtctx->jobs[u].prefix.start = srcStart + frameStartPos - dictSize;
+ mtctx->jobs[u].prefix.size = dictSize;
+ mtctx->jobs[u].src.start = srcStart + frameStartPos;
+ mtctx->jobs[u].src.size = jobSize; assert(jobSize > 0); /* avoid job.src.size == 0 */
+ mtctx->jobs[u].consumed = 0;
+ mtctx->jobs[u].cSize = 0;
mtctx->jobs[u].cdict = (u==0) ? cdict : NULL;
mtctx->jobs[u].fullFrameSize = srcSize;
mtctx->jobs[u].params = jobParams;
/* do not calculate checksum within sections, but write it in header for first section */
- if (u!=0) mtctx->jobs[u].params.fParams.checksumFlag = 0;
mtctx->jobs[u].dstBuff = dstBuffer;
mtctx->jobs[u].cctxPool = mtctx->cctxPool;
mtctx->jobs[u].bufPool = mtctx->bufPool;
- mtctx->jobs[u].firstChunk = (u==0);
- mtctx->jobs[u].lastChunk = (u==nbChunks-1);
- mtctx->jobs[u].jobCompleted = 0;
- mtctx->jobs[u].jobCompleted_mutex = &mtctx->jobCompleted_mutex;
- mtctx->jobs[u].jobCompleted_cond = &mtctx->jobCompleted_cond;
-
- if (params.fParams.checksumFlag) {
- XXH64_update(&xxh64, srcStart + frameStartPos, chunkSize);
- }
+ mtctx->jobs[u].seqPool = mtctx->seqPool;
+ mtctx->jobs[u].serial = &mtctx->serial;
+ mtctx->jobs[u].jobID = u;
+ mtctx->jobs[u].firstJob = (u==0);
+ mtctx->jobs[u].lastJob = (u==nbJobs-1);
- DEBUGLOG(5, "ZSTDMT_compress_advanced_internal: posting job %u (%u bytes)", u, (U32)chunkSize);
- DEBUG_PRINTHEX(6, mtctx->jobs[u].srcStart, 12);
- POOL_add(mtctx->factory, ZSTDMT_compressChunk, &mtctx->jobs[u]);
+ DEBUGLOG(5, "ZSTDMT_compress_advanced_internal: posting job %u (%u bytes)", u, (U32)jobSize);
+ DEBUG_PRINTHEX(6, mtctx->jobs[u].prefix.start, 12);
+ POOL_add(mtctx->factory, ZSTDMT_compressionJob, &mtctx->jobs[u]);
- frameStartPos += chunkSize;
+ frameStartPos += jobSize;
dstBufferPos += dstBufferCapacity;
- remainingSrcSize -= chunkSize;
+ remainingSrcSize -= jobSize;
} }
/* collect result */
{ size_t error = 0, dstPos = 0;
- unsigned chunkID;
- for (chunkID=0; chunkID<nbChunks; chunkID++) {
- DEBUGLOG(5, "waiting for chunk %u ", chunkID);
- ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobCompleted_mutex);
- while (mtctx->jobs[chunkID].jobCompleted==0) {
- DEBUGLOG(5, "waiting for jobCompleted signal from chunk %u", chunkID);
- ZSTD_pthread_cond_wait(&mtctx->jobCompleted_cond, &mtctx->jobCompleted_mutex);
+ unsigned jobID;
+ for (jobID=0; jobID<nbJobs; jobID++) {
+ DEBUGLOG(5, "waiting for job %u ", jobID);
+ ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobs[jobID].job_mutex);
+ while (mtctx->jobs[jobID].consumed < mtctx->jobs[jobID].src.size) {
+ DEBUGLOG(5, "waiting for jobCompleted signal from job %u", jobID);
+ ZSTD_pthread_cond_wait(&mtctx->jobs[jobID].job_cond, &mtctx->jobs[jobID].job_mutex);
}
- ZSTD_pthread_mutex_unlock(&mtctx->jobCompleted_mutex);
- DEBUGLOG(5, "ready to write chunk %u ", chunkID);
+ ZSTD_pthread_mutex_unlock(&mtctx->jobs[jobID].job_mutex);
+ DEBUGLOG(5, "ready to write job %u ", jobID);
- mtctx->jobs[chunkID].srcStart = NULL;
- { size_t const cSize = mtctx->jobs[chunkID].cSize;
+ { size_t const cSize = mtctx->jobs[jobID].cSize;
if (ZSTD_isError(cSize)) error = cSize;
if ((!error) && (dstPos + cSize > dstCapacity)) error = ERROR(dstSize_tooSmall);
- if (chunkID) { /* note : chunk 0 is written directly at dst, which is correct position */
+ if (jobID) { /* note : job 0 is written directly at dst, which is correct position */
if (!error)
- memmove((char*)dst + dstPos, mtctx->jobs[chunkID].dstBuff.start, cSize); /* may overlap when chunk compressed within dst */
- if (chunkID >= compressWithinDst) { /* chunk compressed into its own buffer, which must be released */
- DEBUGLOG(5, "releasing buffer %u>=%u", chunkID, compressWithinDst);
- ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->jobs[chunkID].dstBuff);
+ memmove((char*)dst + dstPos, mtctx->jobs[jobID].dstBuff.start, cSize); /* may overlap when job compressed within dst */
+ if (jobID >= compressWithinDst) { /* job compressed into its own buffer, which must be released */
+ DEBUGLOG(5, "releasing buffer %u>=%u", jobID, compressWithinDst);
+ ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->jobs[jobID].dstBuff);
} }
- mtctx->jobs[chunkID].dstBuff = g_nullBuffer;
+ mtctx->jobs[jobID].dstBuff = g_nullBuffer;
+ mtctx->jobs[jobID].cSize = 0;
dstPos += cSize ;
}
- } /* for (chunkID=0; chunkID<nbChunks; chunkID++) */
+ } /* for (jobID=0; jobID<nbJobs; jobID++) */
DEBUGLOG(4, "checksumFlag : %u ", params.fParams.checksumFlag);
if (params.fParams.checksumFlag) {
- U32 const checksum = (U32)XXH64_digest(&xxh64);
+ U32 const checksum = (U32)XXH64_digest(&mtctx->serial.xxhState);
if (dstPos + 4 > dstCapacity) {
error = ERROR(dstSize_tooSmall);
} else {
@@ -756,7 +1185,7 @@ size_t ZSTDMT_compress_advanced(ZSTDMT_CCtx* mtctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize,
const ZSTD_CDict* cdict,
- ZSTD_parameters const params,
+ ZSTD_parameters params,
unsigned overlapLog)
{
ZSTD_CCtx_params cctxParams = mtctx->params;
@@ -787,66 +1216,104 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx,
/* ====================================== */
size_t ZSTDMT_initCStream_internal(
- ZSTDMT_CCtx* zcs,
- const void* dict, size_t dictSize, ZSTD_dictMode_e dictMode,
+ ZSTDMT_CCtx* mtctx,
+ const void* dict, size_t dictSize, ZSTD_dictContentType_e dictContentType,
const ZSTD_CDict* cdict, ZSTD_CCtx_params params,
unsigned long long pledgedSrcSize)
{
- DEBUGLOG(4, "ZSTDMT_initCStream_internal (pledgedSrcSize=%u)", (U32)pledgedSrcSize);
+ DEBUGLOG(4, "ZSTDMT_initCStream_internal (pledgedSrcSize=%u, nbWorkers=%u, cctxPool=%u, disableLiteralCompression=%i)",
+ (U32)pledgedSrcSize, params.nbWorkers, mtctx->cctxPool->totalCCtx, params.disableLiteralCompression);
/* params are supposed to be fully validated at this point */
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
assert(!((dict) && (cdict))); /* either dict or cdict, not both */
- assert(zcs->cctxPool->totalCCtx == params.nbThreads);
- zcs->singleThreaded = (params.nbThreads==1) | (pledgedSrcSize <= ZSTDMT_JOBSIZE_MIN); /* do not trigger multi-threading when srcSize is too small */
-
- if (zcs->singleThreaded) {
- ZSTD_CCtx_params const singleThreadParams = ZSTDMT_makeJobCCtxParams(params);
- DEBUGLOG(4, "single thread mode");
- assert(singleThreadParams.nbThreads == 0);
- return ZSTD_initCStream_internal(zcs->cctxPool->cctx[0],
+ assert(mtctx->cctxPool->totalCCtx == params.nbWorkers);
+
+ /* init */
+ if (params.jobSize == 0) {
+ params.jobSize = 1U << ZSTDMT_computeTargetJobLog(params);
+ }
+ if (params.jobSize > ZSTDMT_JOBSIZE_MAX) params.jobSize = ZSTDMT_JOBSIZE_MAX;
+
+ mtctx->singleBlockingThread = (pledgedSrcSize <= ZSTDMT_JOBSIZE_MIN); /* do not trigger multi-threading when srcSize is too small */
+ if (mtctx->singleBlockingThread) {
+ ZSTD_CCtx_params const singleThreadParams = ZSTDMT_initJobCCtxParams(params);
+ DEBUGLOG(5, "ZSTDMT_initCStream_internal: switch to single blocking thread mode");
+ assert(singleThreadParams.nbWorkers == 0);
+ return ZSTD_initCStream_internal(mtctx->cctxPool->cctx[0],
dict, dictSize, cdict,
singleThreadParams, pledgedSrcSize);
}
- DEBUGLOG(4, "multi-threading mode (%u threads)", params.nbThreads);
- if (zcs->allJobsCompleted == 0) { /* previous compression not correctly finished */
- ZSTDMT_waitForAllJobsCompleted(zcs);
- ZSTDMT_releaseAllJobResources(zcs);
- zcs->allJobsCompleted = 1;
+ DEBUGLOG(4, "ZSTDMT_initCStream_internal: %u workers", params.nbWorkers);
+
+ if (mtctx->allJobsCompleted == 0) { /* previous compression not correctly finished */
+ ZSTDMT_waitForAllJobsCompleted(mtctx);
+ ZSTDMT_releaseAllJobResources(mtctx);
+ mtctx->allJobsCompleted = 1;
}
- zcs->params = params;
- zcs->frameContentSize = pledgedSrcSize;
+ mtctx->params = params;
+ mtctx->frameContentSize = pledgedSrcSize;
if (dict) {
- ZSTD_freeCDict(zcs->cdictLocal);
- zcs->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,
- ZSTD_dlm_byCopy, dictMode, /* note : a loadPrefix becomes an internal CDict */
- params.cParams, zcs->cMem);
- zcs->cdict = zcs->cdictLocal;
- if (zcs->cdictLocal == NULL) return ERROR(memory_allocation);
+ ZSTD_freeCDict(mtctx->cdictLocal);
+ mtctx->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,
+ ZSTD_dlm_byCopy, dictContentType, /* note : a loadPrefix becomes an internal CDict */
+ params.cParams, mtctx->cMem);
+ mtctx->cdict = mtctx->cdictLocal;
+ if (mtctx->cdictLocal == NULL) return ERROR(memory_allocation);
} else {
- ZSTD_freeCDict(zcs->cdictLocal);
- zcs->cdictLocal = NULL;
- zcs->cdict = cdict;
+ ZSTD_freeCDict(mtctx->cdictLocal);
+ mtctx->cdictLocal = NULL;
+ mtctx->cdict = cdict;
}
- assert(params.overlapSizeLog <= 9);
- zcs->targetDictSize = (params.overlapSizeLog==0) ? 0 : (size_t)1 << (params.cParams.windowLog - (9 - params.overlapSizeLog));
- DEBUGLOG(4, "overlapLog=%u => %u KB", params.overlapSizeLog, (U32)(zcs->targetDictSize>>10));
- zcs->targetSectionSize = params.jobSize ? params.jobSize : (size_t)1 << (params.cParams.windowLog + 2);
- if (zcs->targetSectionSize < ZSTDMT_JOBSIZE_MIN) zcs->targetSectionSize = ZSTDMT_JOBSIZE_MIN;
- if (zcs->targetSectionSize < zcs->targetDictSize) zcs->targetSectionSize = zcs->targetDictSize; /* job size must be >= overlap size */
- DEBUGLOG(4, "Job Size : %u KB (note : set to %u)", (U32)(zcs->targetSectionSize>>10), params.jobSize);
- zcs->inBuffSize = zcs->targetDictSize + zcs->targetSectionSize;
- DEBUGLOG(4, "inBuff Size : %u KB", (U32)(zcs->inBuffSize>>10));
- ZSTDMT_setBufferSize(zcs->bufPool, MAX(zcs->inBuffSize, ZSTD_compressBound(zcs->targetSectionSize)) );
- zcs->inBuff.buffer = g_nullBuffer;
- zcs->dictSize = 0;
- zcs->doneJobID = 0;
- zcs->nextJobID = 0;
- zcs->frameEnded = 0;
- zcs->allJobsCompleted = 0;
- if (params.fParams.checksumFlag) XXH64_reset(&zcs->xxhState, 0);
+ mtctx->targetPrefixSize = (size_t)1 << ZSTDMT_computeOverlapLog(params);
+ DEBUGLOG(4, "overlapLog=%u => %u KB", params.overlapSizeLog, (U32)(mtctx->targetPrefixSize>>10));
+ mtctx->targetSectionSize = params.jobSize;
+ if (mtctx->targetSectionSize < ZSTDMT_JOBSIZE_MIN) mtctx->targetSectionSize = ZSTDMT_JOBSIZE_MIN;
+ if (mtctx->targetSectionSize < mtctx->targetPrefixSize) mtctx->targetSectionSize = mtctx->targetPrefixSize; /* job size must be >= overlap size */
+ DEBUGLOG(4, "Job Size : %u KB (note : set to %u)", (U32)(mtctx->targetSectionSize>>10), params.jobSize);
+ DEBUGLOG(4, "inBuff Size : %u KB", (U32)(mtctx->targetSectionSize>>10));
+ ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(mtctx->targetSectionSize));
+ {
+ /* If ldm is enabled we need windowSize space. */
+ size_t const windowSize = mtctx->params.ldmParams.enableLdm ? (1U << mtctx->params.cParams.windowLog) : 0;
+ /* Two buffers of slack, plus extra space for the overlap
+ * This is the minimum slack that LDM works with. One extra because
+ * flush might waste up to targetSectionSize-1 bytes. Another extra
+ * for the overlap (if > 0), then one to fill which doesn't overlap
+ * with the LDM window.
+ */
+ size_t const nbSlackBuffers = 2 + (mtctx->targetPrefixSize > 0);
+ size_t const slackSize = mtctx->targetSectionSize * nbSlackBuffers;
+ /* Compute the total size, and always have enough slack */
+ size_t const nbWorkers = MAX(mtctx->params.nbWorkers, 1);
+ size_t const sectionsSize = mtctx->targetSectionSize * nbWorkers;
+ size_t const capacity = MAX(windowSize, sectionsSize) + slackSize;
+ if (mtctx->roundBuff.capacity < capacity) {
+ if (mtctx->roundBuff.buffer)
+ ZSTD_free(mtctx->roundBuff.buffer, mtctx->cMem);
+ mtctx->roundBuff.buffer = (BYTE*)ZSTD_malloc(capacity, mtctx->cMem);
+ if (mtctx->roundBuff.buffer == NULL) {
+ mtctx->roundBuff.capacity = 0;
+ return ERROR(memory_allocation);
+ }
+ mtctx->roundBuff.capacity = capacity;
+ }
+ }
+ DEBUGLOG(4, "roundBuff capacity : %u KB", (U32)(mtctx->roundBuff.capacity>>10));
+ mtctx->roundBuff.pos = 0;
+ mtctx->inBuff.buffer = g_nullBuffer;
+ mtctx->inBuff.filled = 0;
+ mtctx->inBuff.prefix = kNullRange;
+ mtctx->doneJobID = 0;
+ mtctx->nextJobID = 0;
+ mtctx->frameEnded = 0;
+ mtctx->allJobsCompleted = 0;
+ mtctx->consumed = 0;
+ mtctx->produced = 0;
+ if (ZSTDMT_serialState_reset(&mtctx->serial, mtctx->seqPool, params))
+ return ERROR(memory_allocation);
return 0;
}
@@ -855,11 +1322,11 @@ size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx,
ZSTD_parameters params,
unsigned long long pledgedSrcSize)
{
- ZSTD_CCtx_params cctxParams = mtctx->params;
- DEBUGLOG(5, "ZSTDMT_initCStream_advanced (pledgedSrcSize=%u)", (U32)pledgedSrcSize);
+ ZSTD_CCtx_params cctxParams = mtctx->params; /* retrieve sticky params */
+ DEBUGLOG(4, "ZSTDMT_initCStream_advanced (pledgedSrcSize=%u)", (U32)pledgedSrcSize);
cctxParams.cParams = params.cParams;
cctxParams.fParams = params.fParams;
- return ZSTDMT_initCStream_internal(mtctx, dict, dictSize, ZSTD_dm_auto, NULL,
+ return ZSTDMT_initCStream_internal(mtctx, dict, dictSize, ZSTD_dct_auto, NULL,
cctxParams, pledgedSrcSize);
}
@@ -869,10 +1336,10 @@ size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
unsigned long long pledgedSrcSize)
{
ZSTD_CCtx_params cctxParams = mtctx->params;
+ if (cdict==NULL) return ERROR(dictionary_wrong); /* method incompatible with NULL cdict */
cctxParams.cParams = ZSTD_getCParamsFromCDict(cdict);
cctxParams.fParams = fParams;
- if (cdict==NULL) return ERROR(dictionary_wrong); /* method incompatible with NULL cdict */
- return ZSTDMT_initCStream_internal(mtctx, NULL, 0 /*dictSize*/, ZSTD_dm_auto, cdict,
+ return ZSTDMT_initCStream_internal(mtctx, NULL, 0 /*dictSize*/, ZSTD_dct_auto, cdict,
cctxParams, pledgedSrcSize);
}
@@ -881,148 +1348,358 @@ size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
* pledgedSrcSize can be zero == unknown (for the time being)
* prefer using ZSTD_CONTENTSIZE_UNKNOWN,
* as `0` might mean "empty" in the future */
-size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* zcs, unsigned long long pledgedSrcSize)
+size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* mtctx, unsigned long long pledgedSrcSize)
{
if (!pledgedSrcSize) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN;
- if (zcs->params.nbThreads==1)
- return ZSTD_resetCStream(zcs->cctxPool->cctx[0], pledgedSrcSize);
- return ZSTDMT_initCStream_internal(zcs, NULL, 0, ZSTD_dm_auto, 0, zcs->params,
+ return ZSTDMT_initCStream_internal(mtctx, NULL, 0, ZSTD_dct_auto, 0, mtctx->params,
pledgedSrcSize);
}
-size_t ZSTDMT_initCStream(ZSTDMT_CCtx* zcs, int compressionLevel) {
- ZSTD_parameters const params = ZSTD_getParams(compressionLevel, 0, 0);
- ZSTD_CCtx_params cctxParams = zcs->params;
+size_t ZSTDMT_initCStream(ZSTDMT_CCtx* mtctx, int compressionLevel) {
+ ZSTD_parameters const params = ZSTD_getParams(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, 0);
+ ZSTD_CCtx_params cctxParams = mtctx->params; /* retrieve sticky params */
+ DEBUGLOG(4, "ZSTDMT_initCStream (cLevel=%i)", compressionLevel);
cctxParams.cParams = params.cParams;
cctxParams.fParams = params.fParams;
- return ZSTDMT_initCStream_internal(zcs, NULL, 0, ZSTD_dm_auto, NULL, cctxParams, ZSTD_CONTENTSIZE_UNKNOWN);
-}
-
-
-static size_t ZSTDMT_createCompressionJob(ZSTDMT_CCtx* zcs, size_t srcSize, unsigned endFrame)
-{
- unsigned const jobID = zcs->nextJobID & zcs->jobIDMask;
-
- DEBUGLOG(5, "ZSTDMT_createCompressionJob: preparing job %u to compress %u bytes with %u preload ",
- zcs->nextJobID, (U32)srcSize, (U32)zcs->dictSize);
- zcs->jobs[jobID].src = zcs->inBuff.buffer;
- zcs->jobs[jobID].srcStart = zcs->inBuff.buffer.start;
- zcs->jobs[jobID].srcSize = srcSize;
- zcs->jobs[jobID].prefixSize = zcs->dictSize;
- assert(zcs->inBuff.filled >= srcSize + zcs->dictSize);
- zcs->jobs[jobID].params = zcs->params;
- /* do not calculate checksum within sections, but write it in header for first section */
- if (zcs->nextJobID) zcs->jobs[jobID].params.fParams.checksumFlag = 0;
- zcs->jobs[jobID].cdict = zcs->nextJobID==0 ? zcs->cdict : NULL;
- zcs->jobs[jobID].fullFrameSize = zcs->frameContentSize;
- zcs->jobs[jobID].dstBuff = g_nullBuffer;
- zcs->jobs[jobID].cctxPool = zcs->cctxPool;
- zcs->jobs[jobID].bufPool = zcs->bufPool;
- zcs->jobs[jobID].firstChunk = (zcs->nextJobID==0);
- zcs->jobs[jobID].lastChunk = endFrame;
- zcs->jobs[jobID].jobCompleted = 0;
- zcs->jobs[jobID].dstFlushed = 0;
- zcs->jobs[jobID].jobCompleted_mutex = &zcs->jobCompleted_mutex;
- zcs->jobs[jobID].jobCompleted_cond = &zcs->jobCompleted_cond;
-
- if (zcs->params.fParams.checksumFlag)
- XXH64_update(&zcs->xxhState, (const char*)zcs->inBuff.buffer.start + zcs->dictSize, srcSize);
-
- /* get a new buffer for next input */
- if (!endFrame) {
- size_t const newDictSize = MIN(srcSize + zcs->dictSize, zcs->targetDictSize);
- zcs->inBuff.buffer = ZSTDMT_getBuffer(zcs->bufPool);
- if (zcs->inBuff.buffer.start == NULL) { /* not enough memory to allocate next input buffer */
- zcs->jobs[jobID].jobCompleted = 1;
- zcs->nextJobID++;
- ZSTDMT_waitForAllJobsCompleted(zcs);
- ZSTDMT_releaseAllJobResources(zcs);
- return ERROR(memory_allocation);
+ return ZSTDMT_initCStream_internal(mtctx, NULL, 0, ZSTD_dct_auto, NULL, cctxParams, ZSTD_CONTENTSIZE_UNKNOWN);
+}
+
+
+/* ZSTDMT_writeLastEmptyBlock()
+ * Write a single empty block with an end-of-frame to finish a frame.
+ * Job must be created from streaming variant.
+ * This function is always successfull if expected conditions are fulfilled.
+ */
+static void ZSTDMT_writeLastEmptyBlock(ZSTDMT_jobDescription* job)
+{
+ assert(job->lastJob == 1);
+ assert(job->src.size == 0); /* last job is empty -> will be simplified into a last empty block */
+ assert(job->firstJob == 0); /* cannot be first job, as it also needs to create frame header */
+ assert(job->dstBuff.start == NULL); /* invoked from streaming variant only (otherwise, dstBuff might be user's output) */
+ job->dstBuff = ZSTDMT_getBuffer(job->bufPool);
+ if (job->dstBuff.start == NULL) {
+ job->cSize = ERROR(memory_allocation);
+ return;
+ }
+ assert(job->dstBuff.capacity >= ZSTD_blockHeaderSize); /* no buffer should ever be that small */
+ job->src = kNullRange;
+ job->cSize = ZSTD_writeLastEmptyBlock(job->dstBuff.start, job->dstBuff.capacity);
+ assert(!ZSTD_isError(job->cSize));
+ assert(job->consumed == 0);
+}
+
+static size_t ZSTDMT_createCompressionJob(ZSTDMT_CCtx* mtctx, size_t srcSize, ZSTD_EndDirective endOp)
+{
+ unsigned const jobID = mtctx->nextJobID & mtctx->jobIDMask;
+ int const endFrame = (endOp == ZSTD_e_end);
+
+ if (mtctx->nextJobID > mtctx->doneJobID + mtctx->jobIDMask) {
+ DEBUGLOG(5, "ZSTDMT_createCompressionJob: will not create new job : table is full");
+ assert((mtctx->nextJobID & mtctx->jobIDMask) == (mtctx->doneJobID & mtctx->jobIDMask));
+ return 0;
+ }
+
+ if (!mtctx->jobReady) {
+ BYTE const* src = (BYTE const*)mtctx->inBuff.buffer.start;
+ DEBUGLOG(5, "ZSTDMT_createCompressionJob: preparing job %u to compress %u bytes with %u preload ",
+ mtctx->nextJobID, (U32)srcSize, (U32)mtctx->inBuff.prefix.size);
+ mtctx->jobs[jobID].src.start = src;
+ mtctx->jobs[jobID].src.size = srcSize;
+ assert(mtctx->inBuff.filled >= srcSize);
+ mtctx->jobs[jobID].prefix = mtctx->inBuff.prefix;
+ mtctx->jobs[jobID].consumed = 0;
+ mtctx->jobs[jobID].cSize = 0;
+ mtctx->jobs[jobID].params = mtctx->params;
+ mtctx->jobs[jobID].cdict = mtctx->nextJobID==0 ? mtctx->cdict : NULL;
+ mtctx->jobs[jobID].fullFrameSize = mtctx->frameContentSize;
+ mtctx->jobs[jobID].dstBuff = g_nullBuffer;
+ mtctx->jobs[jobID].cctxPool = mtctx->cctxPool;
+ mtctx->jobs[jobID].bufPool = mtctx->bufPool;
+ mtctx->jobs[jobID].seqPool = mtctx->seqPool;
+ mtctx->jobs[jobID].serial = &mtctx->serial;
+ mtctx->jobs[jobID].jobID = mtctx->nextJobID;
+ mtctx->jobs[jobID].firstJob = (mtctx->nextJobID==0);
+ mtctx->jobs[jobID].lastJob = endFrame;
+ mtctx->jobs[jobID].frameChecksumNeeded = endFrame && (mtctx->nextJobID>0) && mtctx->params.fParams.checksumFlag;
+ mtctx->jobs[jobID].dstFlushed = 0;
+
+ /* Update the round buffer pos and clear the input buffer to be reset */
+ mtctx->roundBuff.pos += srcSize;
+ mtctx->inBuff.buffer = g_nullBuffer;
+ mtctx->inBuff.filled = 0;
+ /* Set the prefix */
+ if (!endFrame) {
+ size_t const newPrefixSize = MIN(srcSize, mtctx->targetPrefixSize);
+ mtctx->inBuff.prefix.start = src + srcSize - newPrefixSize;
+ mtctx->inBuff.prefix.size = newPrefixSize;
+ } else { /* endFrame==1 => no need for another input buffer */
+ mtctx->inBuff.prefix = kNullRange;
+ mtctx->frameEnded = endFrame;
+ if (mtctx->nextJobID == 0) {
+ /* single job exception : checksum is already calculated directly within worker thread */
+ mtctx->params.fParams.checksumFlag = 0;
+ } }
+
+ if ( (srcSize == 0)
+ && (mtctx->nextJobID>0)/*single job must also write frame header*/ ) {
+ DEBUGLOG(5, "ZSTDMT_createCompressionJob: creating a last empty block to end frame");
+ assert(endOp == ZSTD_e_end); /* only possible case : need to end the frame with an empty last block */
+ ZSTDMT_writeLastEmptyBlock(mtctx->jobs + jobID);
+ mtctx->nextJobID++;
+ return 0;
}
- zcs->inBuff.filled -= srcSize + zcs->dictSize - newDictSize;
- memmove(zcs->inBuff.buffer.start,
- (const char*)zcs->jobs[jobID].srcStart + zcs->dictSize + srcSize - newDictSize,
- zcs->inBuff.filled);
- zcs->dictSize = newDictSize;
- } else { /* if (endFrame==1) */
- zcs->inBuff.buffer = g_nullBuffer;
- zcs->inBuff.filled = 0;
- zcs->dictSize = 0;
- zcs->frameEnded = 1;
- if (zcs->nextJobID == 0) {
- /* single chunk exception : checksum is calculated directly within worker thread */
- zcs->params.fParams.checksumFlag = 0;
- } }
+ }
- DEBUGLOG(5, "ZSTDMT_createCompressionJob: posting job %u : %u bytes (end:%u) (note : doneJob = %u=>%u)",
- zcs->nextJobID,
- (U32)zcs->jobs[jobID].srcSize,
- zcs->jobs[jobID].lastChunk,
- zcs->doneJobID,
- zcs->doneJobID & zcs->jobIDMask);
- POOL_add(zcs->factory, ZSTDMT_compressChunk, &zcs->jobs[jobID]); /* this call is blocking when thread worker pool is exhausted */
- zcs->nextJobID++;
+ DEBUGLOG(5, "ZSTDMT_createCompressionJob: posting job %u : %u bytes (end:%u, jobNb == %u (mod:%u))",
+ mtctx->nextJobID,
+ (U32)mtctx->jobs[jobID].src.size,
+ mtctx->jobs[jobID].lastJob,
+ mtctx->nextJobID,
+ jobID);
+ if (POOL_tryAdd(mtctx->factory, ZSTDMT_compressionJob, &mtctx->jobs[jobID])) {
+ mtctx->nextJobID++;
+ mtctx->jobReady = 0;
+ } else {
+ DEBUGLOG(5, "ZSTDMT_createCompressionJob: no worker available for job %u", mtctx->nextJobID);
+ mtctx->jobReady = 1;
+ }
return 0;
}
-/* ZSTDMT_flushNextJob() :
- * output : will be updated with amount of data flushed .
- * blockToFlush : if >0, the function will block and wait if there is no data available to flush .
- * @return : amount of data remaining within internal buffer, 1 if unknown but > 0, 0 if no more, or an error code */
-static size_t ZSTDMT_flushNextJob(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output, unsigned blockToFlush)
+/*! ZSTDMT_flushProduced() :
+ * `output` : `pos` will be updated with amount of data flushed .
+ * `blockToFlush` : if >0, the function will block and wait if there is no data available to flush .
+ * @return : amount of data remaining within internal buffer, 0 if no more, 1 if unknown but > 0, or an error code */
+static size_t ZSTDMT_flushProduced(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output, unsigned blockToFlush, ZSTD_EndDirective end)
{
- unsigned const wJobID = zcs->doneJobID & zcs->jobIDMask;
- DEBUGLOG(5, "ZSTDMT_flushNextJob");
- if (zcs->doneJobID == zcs->nextJobID) return 0; /* all flushed ! */
- ZSTD_PTHREAD_MUTEX_LOCK(&zcs->jobCompleted_mutex);
- while (zcs->jobs[wJobID].jobCompleted==0) {
- DEBUGLOG(5, "waiting for jobCompleted signal from job %u", zcs->doneJobID);
- if (!blockToFlush) { ZSTD_pthread_mutex_unlock(&zcs->jobCompleted_mutex); return 0; } /* nothing ready to be flushed => skip */
- ZSTD_pthread_cond_wait(&zcs->jobCompleted_cond, &zcs->jobCompleted_mutex); /* block when nothing available to flush */
+ unsigned const wJobID = mtctx->doneJobID & mtctx->jobIDMask;
+ DEBUGLOG(5, "ZSTDMT_flushProduced (blocking:%u , job %u <= %u)",
+ blockToFlush, mtctx->doneJobID, mtctx->nextJobID);
+ assert(output->size >= output->pos);
+
+ ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobs[wJobID].job_mutex);
+ if ( blockToFlush
+ && (mtctx->doneJobID < mtctx->nextJobID) ) {
+ assert(mtctx->jobs[wJobID].dstFlushed <= mtctx->jobs[wJobID].cSize);
+ while (mtctx->jobs[wJobID].dstFlushed == mtctx->jobs[wJobID].cSize) { /* nothing to flush */
+ if (mtctx->jobs[wJobID].consumed == mtctx->jobs[wJobID].src.size) {
+ DEBUGLOG(5, "job %u is completely consumed (%u == %u) => don't wait for cond, there will be none",
+ mtctx->doneJobID, (U32)mtctx->jobs[wJobID].consumed, (U32)mtctx->jobs[wJobID].src.size);
+ break;
+ }
+ DEBUGLOG(5, "waiting for something to flush from job %u (currently flushed: %u bytes)",
+ mtctx->doneJobID, (U32)mtctx->jobs[wJobID].dstFlushed);
+ ZSTD_pthread_cond_wait(&mtctx->jobs[wJobID].job_cond, &mtctx->jobs[wJobID].job_mutex); /* block when nothing to flush but some to come */
+ } }
+
+ /* try to flush something */
+ { size_t cSize = mtctx->jobs[wJobID].cSize; /* shared */
+ size_t const srcConsumed = mtctx->jobs[wJobID].consumed; /* shared */
+ size_t const srcSize = mtctx->jobs[wJobID].src.size; /* read-only, could be done after mutex lock, but no-declaration-after-statement */
+ ZSTD_pthread_mutex_unlock(&mtctx->jobs[wJobID].job_mutex);
+ if (ZSTD_isError(cSize)) {
+ DEBUGLOG(5, "ZSTDMT_flushProduced: job %u : compression error detected : %s",
+ mtctx->doneJobID, ZSTD_getErrorName(cSize));
+ ZSTDMT_waitForAllJobsCompleted(mtctx);
+ ZSTDMT_releaseAllJobResources(mtctx);
+ return cSize;
+ }
+ /* add frame checksum if necessary (can only happen once) */
+ assert(srcConsumed <= srcSize);
+ if ( (srcConsumed == srcSize) /* job completed -> worker no longer active */
+ && mtctx->jobs[wJobID].frameChecksumNeeded ) {
+ U32 const checksum = (U32)XXH64_digest(&mtctx->serial.xxhState);
+ DEBUGLOG(4, "ZSTDMT_flushProduced: writing checksum : %08X \n", checksum);
+ MEM_writeLE32((char*)mtctx->jobs[wJobID].dstBuff.start + mtctx->jobs[wJobID].cSize, checksum);
+ cSize += 4;
+ mtctx->jobs[wJobID].cSize += 4; /* can write this shared value, as worker is no longer active */
+ mtctx->jobs[wJobID].frameChecksumNeeded = 0;
+ }
+ if (cSize > 0) { /* compression is ongoing or completed */
+ size_t const toFlush = MIN(cSize - mtctx->jobs[wJobID].dstFlushed, output->size - output->pos);
+ DEBUGLOG(5, "ZSTDMT_flushProduced: Flushing %u bytes from job %u (completion:%u/%u, generated:%u)",
+ (U32)toFlush, mtctx->doneJobID, (U32)srcConsumed, (U32)srcSize, (U32)cSize);
+ assert(mtctx->doneJobID < mtctx->nextJobID);
+ assert(cSize >= mtctx->jobs[wJobID].dstFlushed);
+ assert(mtctx->jobs[wJobID].dstBuff.start != NULL);
+ memcpy((char*)output->dst + output->pos,
+ (const char*)mtctx->jobs[wJobID].dstBuff.start + mtctx->jobs[wJobID].dstFlushed,
+ toFlush);
+ output->pos += toFlush;
+ mtctx->jobs[wJobID].dstFlushed += toFlush; /* can write : this value is only used by mtctx */
+
+ if ( (srcConsumed == srcSize) /* job completed */
+ && (mtctx->jobs[wJobID].dstFlushed == cSize) ) { /* output buffer fully flushed => free this job position */
+ DEBUGLOG(5, "Job %u completed (%u bytes), moving to next one",
+ mtctx->doneJobID, (U32)mtctx->jobs[wJobID].dstFlushed);
+ ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->jobs[wJobID].dstBuff);
+ mtctx->jobs[wJobID].dstBuff = g_nullBuffer;
+ mtctx->jobs[wJobID].cSize = 0; /* ensure this job slot is considered "not started" in future check */
+ mtctx->consumed += srcSize;
+ mtctx->produced += cSize;
+ mtctx->doneJobID++;
+ } }
+
+ /* return value : how many bytes left in buffer ; fake it to 1 when unknown but >0 */
+ if (cSize > mtctx->jobs[wJobID].dstFlushed) return (cSize - mtctx->jobs[wJobID].dstFlushed);
+ if (srcSize > srcConsumed) return 1; /* current job not completely compressed */
}
- ZSTD_pthread_mutex_unlock(&zcs->jobCompleted_mutex);
- /* compression job completed : output can be flushed */
- { ZSTDMT_jobDescription job = zcs->jobs[wJobID];
- if (!job.jobScanned) {
- if (ZSTD_isError(job.cSize)) {
- DEBUGLOG(5, "job %u : compression error detected : %s",
- zcs->doneJobID, ZSTD_getErrorName(job.cSize));
- ZSTDMT_waitForAllJobsCompleted(zcs);
- ZSTDMT_releaseAllJobResources(zcs);
- return job.cSize;
+ if (mtctx->doneJobID < mtctx->nextJobID) return 1; /* some more jobs ongoing */
+ if (mtctx->jobReady) return 1; /* one job is ready to push, just not yet in the list */
+ if (mtctx->inBuff.filled > 0) return 1; /* input is not empty, and still needs to be converted into a job */
+ mtctx->allJobsCompleted = mtctx->frameEnded; /* all jobs are entirely flushed => if this one is last one, frame is completed */
+ if (end == ZSTD_e_end) return !mtctx->frameEnded; /* for ZSTD_e_end, question becomes : is frame completed ? instead of : are internal buffers fully flushed ? */
+ return 0; /* internal buffers fully flushed */
+}
+
+/**
+ * Returns the range of data used by the earliest job that is not yet complete.
+ * If the data of the first job is broken up into two segments, we cover both
+ * sections.
+ */
+static range_t ZSTDMT_getInputDataInUse(ZSTDMT_CCtx* mtctx)
+{
+ unsigned const firstJobID = mtctx->doneJobID;
+ unsigned const lastJobID = mtctx->nextJobID;
+ unsigned jobID;
+
+ for (jobID = firstJobID; jobID < lastJobID; ++jobID) {
+ unsigned const wJobID = jobID & mtctx->jobIDMask;
+ size_t consumed;
+
+ ZSTD_PTHREAD_MUTEX_LOCK(&mtctx->jobs[wJobID].job_mutex);
+ consumed = mtctx->jobs[wJobID].consumed;
+ ZSTD_pthread_mutex_unlock(&mtctx->jobs[wJobID].job_mutex);
+
+ if (consumed < mtctx->jobs[wJobID].src.size) {
+ range_t range = mtctx->jobs[wJobID].prefix;
+ if (range.size == 0) {
+ /* Empty prefix */
+ range = mtctx->jobs[wJobID].src;
}
- DEBUGLOG(5, "zcs->params.fParams.checksumFlag : %u ", zcs->params.fParams.checksumFlag);
- if (zcs->params.fParams.checksumFlag) {
- if (zcs->frameEnded && (zcs->doneJobID+1 == zcs->nextJobID)) { /* write checksum at end of last section */
- U32 const checksum = (U32)XXH64_digest(&zcs->xxhState);
- DEBUGLOG(5, "writing checksum : %08X \n", checksum);
- MEM_writeLE32((char*)job.dstBuff.start + job.cSize, checksum);
- job.cSize += 4;
- zcs->jobs[wJobID].cSize += 4;
- } }
- zcs->jobs[wJobID].jobScanned = 1;
+ /* Job source in multiple segments not supported yet */
+ assert(range.start <= mtctx->jobs[wJobID].src.start);
+ return range;
}
- { size_t const toWrite = MIN(job.cSize - job.dstFlushed, output->size - output->pos);
- DEBUGLOG(5, "Flushing %u bytes from job %u ", (U32)toWrite, zcs->doneJobID);
- memcpy((char*)output->dst + output->pos, (const char*)job.dstBuff.start + job.dstFlushed, toWrite);
- output->pos += toWrite;
- job.dstFlushed += toWrite;
+ }
+ return kNullRange;
+}
+
+/**
+ * Returns non-zero iff buffer and range overlap.
+ */
+static int ZSTDMT_isOverlapped(buffer_t buffer, range_t range)
+{
+ BYTE const* const bufferStart = (BYTE const*)buffer.start;
+ BYTE const* const bufferEnd = bufferStart + buffer.capacity;
+ BYTE const* const rangeStart = (BYTE const*)range.start;
+ BYTE const* const rangeEnd = rangeStart + range.size;
+
+ if (rangeStart == NULL || bufferStart == NULL)
+ return 0;
+ /* Empty ranges cannot overlap */
+ if (bufferStart == bufferEnd || rangeStart == rangeEnd)
+ return 0;
+
+ return bufferStart < rangeEnd && rangeStart < bufferEnd;
+}
+
+static int ZSTDMT_doesOverlapWindow(buffer_t buffer, ZSTD_window_t window)
+{
+ range_t extDict;
+ range_t prefix;
+
+ extDict.start = window.dictBase + window.lowLimit;
+ extDict.size = window.dictLimit - window.lowLimit;
+
+ prefix.start = window.base + window.dictLimit;
+ prefix.size = window.nextSrc - (window.base + window.dictLimit);
+ DEBUGLOG(5, "extDict [0x%zx, 0x%zx)",
+ (size_t)extDict.start,
+ (size_t)extDict.start + extDict.size);
+ DEBUGLOG(5, "prefix [0x%zx, 0x%zx)",
+ (size_t)prefix.start,
+ (size_t)prefix.start + prefix.size);
+
+ return ZSTDMT_isOverlapped(buffer, extDict)
+ || ZSTDMT_isOverlapped(buffer, prefix);
+}
+
+static void ZSTDMT_waitForLdmComplete(ZSTDMT_CCtx* mtctx, buffer_t buffer)
+{
+ if (mtctx->params.ldmParams.enableLdm) {
+ ZSTD_pthread_mutex_t* mutex = &mtctx->serial.ldmWindowMutex;
+ DEBUGLOG(5, "source [0x%zx, 0x%zx)",
+ (size_t)buffer.start,
+ (size_t)buffer.start + buffer.capacity);
+ ZSTD_PTHREAD_MUTEX_LOCK(mutex);
+ while (ZSTDMT_doesOverlapWindow(buffer, mtctx->serial.ldmWindow)) {
+ DEBUGLOG(6, "Waiting for LDM to finish...");
+ ZSTD_pthread_cond_wait(&mtctx->serial.ldmWindowCond, mutex);
}
- if (job.dstFlushed == job.cSize) { /* output buffer fully flushed => move to next one */
- ZSTDMT_releaseBuffer(zcs->bufPool, job.dstBuff);
- zcs->jobs[wJobID].dstBuff = g_nullBuffer;
- zcs->jobs[wJobID].jobCompleted = 0;
- zcs->doneJobID++;
- } else {
- zcs->jobs[wJobID].dstFlushed = job.dstFlushed;
+ DEBUGLOG(6, "Done waiting for LDM to finish");
+ ZSTD_pthread_mutex_unlock(mutex);
+ }
+}
+
+/**
+ * Attempts to set the inBuff to the next section to fill.
+ * If any part of the new section is still in use we give up.
+ * Returns non-zero if the buffer is filled.
+ */
+static int ZSTDMT_tryGetInputRange(ZSTDMT_CCtx* mtctx)
+{
+ range_t const inUse = ZSTDMT_getInputDataInUse(mtctx);
+ size_t const spaceLeft = mtctx->roundBuff.capacity - mtctx->roundBuff.pos;
+ size_t const target = mtctx->targetSectionSize;
+ buffer_t buffer;
+
+ assert(mtctx->inBuff.buffer.start == NULL);
+ assert(mtctx->roundBuff.capacity >= target);
+
+ if (spaceLeft < target) {
+ /* ZSTD_invalidateRepCodes() doesn't work for extDict variants.
+ * Simply copy the prefix to the beginning in that case.
+ */
+ BYTE* const start = (BYTE*)mtctx->roundBuff.buffer;
+ size_t const prefixSize = mtctx->inBuff.prefix.size;
+
+ buffer.start = start;
+ buffer.capacity = prefixSize;
+ if (ZSTDMT_isOverlapped(buffer, inUse)) {
+ DEBUGLOG(6, "Waiting for buffer...");
+ return 0;
}
- /* return value : how many bytes left in buffer ; fake it to 1 if unknown but >0 */
- if (job.cSize > job.dstFlushed) return (job.cSize - job.dstFlushed);
- if (zcs->doneJobID < zcs->nextJobID) return 1; /* still some buffer to flush */
- zcs->allJobsCompleted = zcs->frameEnded; /* frame completed and entirely flushed */
- return 0; /* everything flushed */
-} }
+ ZSTDMT_waitForLdmComplete(mtctx, buffer);
+ memmove(start, mtctx->inBuff.prefix.start, prefixSize);
+ mtctx->inBuff.prefix.start = start;
+ mtctx->roundBuff.pos = prefixSize;
+ }
+ buffer.start = mtctx->roundBuff.buffer + mtctx->roundBuff.pos;
+ buffer.capacity = target;
+
+ if (ZSTDMT_isOverlapped(buffer, inUse)) {
+ DEBUGLOG(6, "Waiting for buffer...");
+ return 0;
+ }
+ assert(!ZSTDMT_isOverlapped(buffer, mtctx->inBuff.prefix));
+
+ ZSTDMT_waitForLdmComplete(mtctx, buffer);
+
+ DEBUGLOG(5, "Using prefix range [%zx, %zx)",
+ (size_t)mtctx->inBuff.prefix.start,
+ (size_t)mtctx->inBuff.prefix.start + mtctx->inBuff.prefix.size);
+ DEBUGLOG(5, "Using source range [%zx, %zx)",
+ (size_t)buffer.start,
+ (size_t)buffer.start + buffer.capacity);
+
+
+ mtctx->inBuff.buffer = buffer;
+ mtctx->inBuff.filled = 0;
+ assert(mtctx->roundBuff.pos + buffer.capacity <= mtctx->roundBuff.capacity);
+ return 1;
+}
/** ZSTDMT_compressStream_generic() :
@@ -1034,13 +1711,13 @@ size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
ZSTD_inBuffer* input,
ZSTD_EndDirective endOp)
{
- size_t const newJobThreshold = mtctx->dictSize + mtctx->targetSectionSize;
unsigned forwardInputProgress = 0;
- DEBUGLOG(5, "ZSTDMT_compressStream_generic ");
+ DEBUGLOG(5, "ZSTDMT_compressStream_generic (endOp=%u, srcSize=%u)",
+ (U32)endOp, (U32)(input->size - input->pos));
assert(output->pos <= output->size);
assert(input->pos <= input->size);
- if (mtctx->singleThreaded) { /* delegate to single-thread (synchronous) */
+ if (mtctx->singleBlockingThread) { /* delegate to single-thread (synchronous) */
return ZSTD_compressStream_generic(mtctx->cctxPool->cctx[0], output, input, endOp);
}
@@ -1050,10 +1727,11 @@ size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
}
/* single-pass shortcut (note : synchronous-mode) */
- if ( (mtctx->nextJobID == 0) /* just started */
- && (mtctx->inBuff.filled == 0) /* nothing buffered */
- && (endOp == ZSTD_e_end) /* end order */
- && (output->size - output->pos >= ZSTD_compressBound(input->size - input->pos)) ) { /* enough room */
+ if ( (mtctx->nextJobID == 0) /* just started */
+ && (mtctx->inBuff.filled == 0) /* nothing buffered */
+ && (!mtctx->jobReady) /* no job already created */
+ && (endOp == ZSTD_e_end) /* end order */
+ && (output->size - output->pos >= ZSTD_compressBound(input->size - input->pos)) ) { /* enough space in dst */
size_t const cSize = ZSTDMT_compress_advanced_internal(mtctx,
(char*)output->dst + output->pos, output->size - output->pos,
(const char*)input->src + input->pos, input->size - input->pos,
@@ -1061,89 +1739,93 @@ size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
if (ZSTD_isError(cSize)) return cSize;
input->pos = input->size;
output->pos += cSize;
- ZSTDMT_releaseBuffer(mtctx->bufPool, mtctx->inBuff.buffer); /* was allocated in initStream */
mtctx->allJobsCompleted = 1;
mtctx->frameEnded = 1;
return 0;
}
/* fill input buffer */
- if (input->size > input->pos) { /* support NULL input */
+ if ( (!mtctx->jobReady)
+ && (input->size > input->pos) ) { /* support NULL input */
if (mtctx->inBuff.buffer.start == NULL) {
- mtctx->inBuff.buffer = ZSTDMT_getBuffer(mtctx->bufPool); /* note : may fail, in which case, no forward input progress */
- mtctx->inBuff.filled = 0;
+ assert(mtctx->inBuff.filled == 0); /* Can't fill an empty buffer */
+ if (!ZSTDMT_tryGetInputRange(mtctx)) {
+ /* It is only possible for this operation to fail if there are
+ * still compression jobs ongoing.
+ */
+ assert(mtctx->doneJobID != mtctx->nextJobID);
+ }
}
- if (mtctx->inBuff.buffer.start) {
- size_t const toLoad = MIN(input->size - input->pos, mtctx->inBuffSize - mtctx->inBuff.filled);
- DEBUGLOG(5, "inBuff:%08X; inBuffSize=%u; ToCopy=%u", (U32)(size_t)mtctx->inBuff.buffer.start, (U32)mtctx->inBuffSize, (U32)toLoad);
+ if (mtctx->inBuff.buffer.start != NULL) {
+ size_t const toLoad = MIN(input->size - input->pos, mtctx->targetSectionSize - mtctx->inBuff.filled);
+ assert(mtctx->inBuff.buffer.capacity >= mtctx->targetSectionSize);
+ DEBUGLOG(5, "ZSTDMT_compressStream_generic: adding %u bytes on top of %u to buffer of size %u",
+ (U32)toLoad, (U32)mtctx->inBuff.filled, (U32)mtctx->targetSectionSize);
memcpy((char*)mtctx->inBuff.buffer.start + mtctx->inBuff.filled, (const char*)input->src + input->pos, toLoad);
input->pos += toLoad;
mtctx->inBuff.filled += toLoad;
forwardInputProgress = toLoad>0;
- } }
+ }
+ if ((input->pos < input->size) && (endOp == ZSTD_e_end))
+ endOp = ZSTD_e_flush; /* can't end now : not all input consumed */
+ }
- if ( (mtctx->inBuff.filled >= newJobThreshold) /* filled enough : let's compress */
- && (mtctx->nextJobID <= mtctx->doneJobID + mtctx->jobIDMask) ) { /* avoid overwriting job round buffer */
- CHECK_F( ZSTDMT_createCompressionJob(mtctx, mtctx->targetSectionSize, 0 /* endFrame */) );
+ if ( (mtctx->jobReady)
+ || (mtctx->inBuff.filled >= mtctx->targetSectionSize) /* filled enough : let's compress */
+ || ((endOp != ZSTD_e_continue) && (mtctx->inBuff.filled > 0)) /* something to flush : let's go */
+ || ((endOp == ZSTD_e_end) && (!mtctx->frameEnded)) ) { /* must finish the frame with a zero-size block */
+ size_t const jobSize = mtctx->inBuff.filled;
+ assert(mtctx->inBuff.filled <= mtctx->targetSectionSize);
+ CHECK_F( ZSTDMT_createCompressionJob(mtctx, jobSize, endOp) );
}
/* check for potential compressed data ready to be flushed */
- CHECK_F( ZSTDMT_flushNextJob(mtctx, output, !forwardInputProgress /* blockToFlush */) ); /* block if there was no forward input progress */
-
- if (input->pos < input->size) /* input not consumed : do not flush yet */
- endOp = ZSTD_e_continue;
-
- switch(endOp)
- {
- case ZSTD_e_flush:
- return ZSTDMT_flushStream(mtctx, output);
- case ZSTD_e_end:
- return ZSTDMT_endStream(mtctx, output);
- case ZSTD_e_continue:
- return 1;
- default:
- return ERROR(GENERIC); /* invalid endDirective */
+ { size_t const remainingToFlush = ZSTDMT_flushProduced(mtctx, output, !forwardInputProgress, endOp); /* block if there was no forward input progress */
+ if (input->pos < input->size) return MAX(remainingToFlush, 1); /* input not consumed : do not end flush yet */
+ return remainingToFlush;
}
}
-size_t ZSTDMT_compressStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input)
+size_t ZSTDMT_compressStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output, ZSTD_inBuffer* input)
{
- CHECK_F( ZSTDMT_compressStream_generic(zcs, output, input, ZSTD_e_continue) );
+ CHECK_F( ZSTDMT_compressStream_generic(mtctx, output, input, ZSTD_e_continue) );
/* recommended next input size : fill current input buffer */
- return zcs->inBuffSize - zcs->inBuff.filled; /* note : could be zero when input buffer is fully filled and no more availability to create new job */
+ return mtctx->targetSectionSize - mtctx->inBuff.filled; /* note : could be zero when input buffer is fully filled and no more availability to create new job */
}
-static size_t ZSTDMT_flushStream_internal(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output, unsigned endFrame)
+static size_t ZSTDMT_flushStream_internal(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output, ZSTD_EndDirective endFrame)
{
- size_t const srcSize = mtctx->inBuff.filled - mtctx->dictSize;
+ size_t const srcSize = mtctx->inBuff.filled;
DEBUGLOG(5, "ZSTDMT_flushStream_internal");
- if ( ((srcSize > 0) || (endFrame && !mtctx->frameEnded))
- && (mtctx->nextJobID <= mtctx->doneJobID + mtctx->jobIDMask) ) {
- DEBUGLOG(5, "ZSTDMT_flushStream_internal : create a new job");
+ if ( mtctx->jobReady /* one job ready for a worker to pick up */
+ || (srcSize > 0) /* still some data within input buffer */
+ || ((endFrame==ZSTD_e_end) && !mtctx->frameEnded)) { /* need a last 0-size block to end frame */
+ DEBUGLOG(5, "ZSTDMT_flushStream_internal : create a new job (%u bytes, end:%u)",
+ (U32)srcSize, (U32)endFrame);
CHECK_F( ZSTDMT_createCompressionJob(mtctx, srcSize, endFrame) );
}
/* check if there is any data available to flush */
- return ZSTDMT_flushNextJob(mtctx, output, 1 /* blockToFlush */);
+ return ZSTDMT_flushProduced(mtctx, output, 1 /* blockToFlush */, endFrame);
}
size_t ZSTDMT_flushStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output)
{
DEBUGLOG(5, "ZSTDMT_flushStream");
- if (mtctx->singleThreaded)
+ if (mtctx->singleBlockingThread)
return ZSTD_flushStream(mtctx->cctxPool->cctx[0], output);
- return ZSTDMT_flushStream_internal(mtctx, output, 0 /* endFrame */);
+ return ZSTDMT_flushStream_internal(mtctx, output, ZSTD_e_flush);
}
size_t ZSTDMT_endStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output)
{
DEBUGLOG(4, "ZSTDMT_endStream");
- if (mtctx->singleThreaded)
+ if (mtctx->singleBlockingThread)
return ZSTD_endStream(mtctx->cctxPool->cctx[0], output);
- return ZSTDMT_flushStream_internal(mtctx, output, 1 /* endFrame */);
+ return ZSTDMT_flushStream_internal(mtctx, output, ZSTD_e_end);
}
diff --git a/thirdparty/zstd/compress/zstdmt_compress.h b/thirdparty/zstd/compress/zstdmt_compress.h
index d12f0adb8d..f79e3b4418 100644
--- a/thirdparty/zstd/compress/zstdmt_compress.h
+++ b/thirdparty/zstd/compress/zstdmt_compress.h
@@ -30,15 +30,15 @@
/* === Memory management === */
typedef struct ZSTDMT_CCtx_s ZSTDMT_CCtx;
-ZSTDLIB_API ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbThreads);
-ZSTDLIB_API ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbThreads,
+ZSTDLIB_API ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbWorkers);
+ZSTDLIB_API ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers,
ZSTD_customMem cMem);
ZSTDLIB_API size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx);
ZSTDLIB_API size_t ZSTDMT_sizeof_CCtx(ZSTDMT_CCtx* mtctx);
-/* === Simple buffer-to-butter one-pass function === */
+/* === Simple one-pass compression function === */
ZSTDLIB_API size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx,
void* dst, size_t dstCapacity,
@@ -50,7 +50,7 @@ ZSTDLIB_API size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx,
/* === Streaming functions === */
ZSTDLIB_API size_t ZSTDMT_initCStream(ZSTDMT_CCtx* mtctx, int compressionLevel);
-ZSTDLIB_API size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* mtctx, unsigned long long pledgedSrcSize); /**< if srcSize is not known at reset time, use ZSTD_CONTENTSIZE_UNKNOWN. Note: for compatibility with older programs, 0 means the same as ZSTD_CONTENTSIZE_UNKNOWN, but it may change in the future, to mean "empty" */
+ZSTDLIB_API size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* mtctx, unsigned long long pledgedSrcSize); /**< if srcSize is not known at reset time, use ZSTD_CONTENTSIZE_UNKNOWN. Note: for compatibility with older programs, 0 means the same as ZSTD_CONTENTSIZE_UNKNOWN, but it will change in the future to mean "empty" */
ZSTDLIB_API size_t ZSTDMT_compressStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
@@ -68,7 +68,7 @@ ZSTDLIB_API size_t ZSTDMT_compress_advanced(ZSTDMT_CCtx* mtctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize,
const ZSTD_CDict* cdict,
- ZSTD_parameters const params,
+ ZSTD_parameters params,
unsigned overlapLog);
ZSTDLIB_API size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx,
@@ -85,7 +85,7 @@ ZSTDLIB_API size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
* List of parameters that can be set using ZSTDMT_setMTCtxParameter() */
typedef enum {
ZSTDMT_p_jobSize, /* Each job is compressed in parallel. By default, this value is dynamically determined depending on compression parameters. Can be set explicitly here. */
- ZSTDMT_p_overlapSectionLog /* Each job may reload a part of previous job to enhance compressionr ratio; 0 == no overlap, 6(default) == use 1/8th of window, >=9 == use full window */
+ ZSTDMT_p_overlapSectionLog /* Each job may reload a part of previous job to enhance compressionr ratio; 0 == no overlap, 6(default) == use 1/8th of window, >=9 == use full window. This is a "sticky" parameter : its value will be re-used on next compression job */
} ZSTDMT_parameter;
/* ZSTDMT_setMTCtxParameter() :
@@ -97,30 +97,46 @@ ZSTDLIB_API size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter
/*! ZSTDMT_compressStream_generic() :
- * Combines ZSTDMT_compressStream() with ZSTDMT_flushStream() or ZSTDMT_endStream()
+ * Combines ZSTDMT_compressStream() with optional ZSTDMT_flushStream() or ZSTDMT_endStream()
* depending on flush directive.
* @return : minimum amount of data still to be flushed
* 0 if fully flushed
- * or an error code */
+ * or an error code
+ * note : needs to be init using any ZSTD_initCStream*() variant */
ZSTDLIB_API size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
ZSTD_outBuffer* output,
ZSTD_inBuffer* input,
ZSTD_EndDirective endOp);
-/* === Private definitions; never ever use directly === */
+/* ========================================================
+ * === Private interface, for use by ZSTD_compress.c ===
+ * === Not exposed in libzstd. Never invoke directly ===
+ * ======================================================== */
size_t ZSTDMT_CCtxParam_setMTCtxParameter(ZSTD_CCtx_params* params, ZSTDMT_parameter parameter, unsigned value);
-/* ZSTDMT_CCtxParam_setNbThreads()
- * Set nbThreads, and clamp it correctly,
- * also reset jobSize and overlapLog */
-size_t ZSTDMT_CCtxParam_setNbThreads(ZSTD_CCtx_params* params, unsigned nbThreads);
+/* ZSTDMT_CCtxParam_setNbWorkers()
+ * Set nbWorkers, and clamp it.
+ * Also reset jobSize and overlapLog */
+size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers);
-/* ZSTDMT_getNbThreads():
+/*! ZSTDMT_updateCParams_whileCompressing() :
+ * Updates only a selected set of compression parameters, to remain compatible with current frame.
+ * New parameters will be applied to next compression job. */
+void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx* mtctx, const ZSTD_CCtx_params* cctxParams);
+
+/* ZSTDMT_getNbWorkers():
* @return nb threads currently active in mtctx.
* mtctx must be valid */
-size_t ZSTDMT_getNbThreads(const ZSTDMT_CCtx* mtctx);
+unsigned ZSTDMT_getNbWorkers(const ZSTDMT_CCtx* mtctx);
+
+/* ZSTDMT_getFrameProgression():
+ * tells how much data has been consumed (input) and produced (output) for current frame.
+ * able to count progression inside worker threads.
+ */
+ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx);
+
/*! ZSTDMT_initCStream_internal() :
* Private use only. Init streaming operation.
@@ -128,7 +144,7 @@ size_t ZSTDMT_getNbThreads(const ZSTDMT_CCtx* mtctx);
* must receive dict, or cdict, or none, but not both.
* @return : 0, or an error code */
size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
- const void* dict, size_t dictSize, ZSTD_dictMode_e dictMode,
+ const void* dict, size_t dictSize, ZSTD_dictContentType_e dictContentType,
const ZSTD_CDict* cdict,
ZSTD_CCtx_params params, unsigned long long pledgedSrcSize);
diff --git a/thirdparty/zstd/decompress/huf_decompress.c b/thirdparty/zstd/decompress/huf_decompress.c
index 79ded96bf6..73f5c46c06 100644
--- a/thirdparty/zstd/decompress/huf_decompress.c
+++ b/thirdparty/zstd/decompress/huf_decompress.c
@@ -49,18 +49,19 @@
****************************************************************/
#define HUF_isError ERR_isError
#define HUF_STATIC_ASSERT(c) { enum { HUF_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
+#define CHECK_F(f) { size_t const err_ = (f); if (HUF_isError(err_)) return err_; }
/* **************************************************************
* Byte alignment for workSpace management
****************************************************************/
-#define HUF_ALIGN(x, a) HUF_ALIGN_MASK((x), (a) - 1)
+#define HUF_ALIGN(x, a) HUF_ALIGN_MASK((x), (a) - 1)
#define HUF_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
+
/*-***************************/
/* generic DTableDesc */
/*-***************************/
-
typedef struct { BYTE maxTableLog; BYTE tableType; BYTE tableLog; BYTE reserved; } DTableDesc;
static DTableDesc HUF_getDTableDesc(const HUF_DTable* table)
@@ -74,7 +75,6 @@ static DTableDesc HUF_getDTableDesc(const HUF_DTable* table)
/*-***************************/
/* single-symbol decoding */
/*-***************************/
-
typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX2; /* single-symbol decoding */
size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize)
@@ -94,10 +94,7 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize
huffWeight = (BYTE *)((U32 *)workSpace + spaceUsed32);
spaceUsed32 += HUF_ALIGN(HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2;
- if ((spaceUsed32 << 2) > wkspSize)
- return ERROR(tableLog_tooLarge);
- workSpace = (U32 *)workSpace + spaceUsed32;
- wkspSize -= (spaceUsed32 << 2);
+ if ((spaceUsed32 << 2) > wkspSize) return ERROR(tableLog_tooLarge);
HUF_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable));
/* memset(huffWeight, 0, sizeof(huffWeight)); */ /* is not necessary, even though some analyzer complain ... */
@@ -144,8 +141,10 @@ size_t HUF_readDTableX2(HUF_DTable* DTable, const void* src, size_t srcSize)
workSpace, sizeof(workSpace));
}
+typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX4; /* double-symbols decoding */
-static BYTE HUF_decodeSymbolX2(BIT_DStream_t* Dstream, const HUF_DEltX2* dt, const U32 dtLog)
+FORCE_INLINE_TEMPLATE BYTE
+HUF_decodeSymbolX2(BIT_DStream_t* Dstream, const HUF_DEltX2* dt, const U32 dtLog)
{
size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
BYTE const c = dt[val].byte;
@@ -156,7 +155,7 @@ static BYTE HUF_decodeSymbolX2(BIT_DStream_t* Dstream, const HUF_DEltX2* dt, con
#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \
*ptr++ = HUF_decodeSymbolX2(DStreamPtr, dt, dtLog)
-#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \
+#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \
if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
@@ -164,30 +163,33 @@ static BYTE HUF_decodeSymbolX2(BIT_DStream_t* Dstream, const HUF_DEltX2* dt, con
if (MEM_64bits()) \
HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
-HINT_INLINE size_t HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX2* const dt, const U32 dtLog)
+HINT_INLINE size_t
+HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX2* const dt, const U32 dtLog)
{
BYTE* const pStart = p;
/* up to 4 symbols at a time */
- while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-4)) {
+ while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) {
HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
HUF_DECODE_SYMBOLX2_1(p, bitDPtr);
HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
}
- /* closer to the end */
- while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p < pEnd))
- HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
+ /* [0-3] symbols remaining */
+ if (MEM_32bits())
+ while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd))
+ HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
- /* no more data to retrieve from bitstream, hence no need to reload */
+ /* no more data to retrieve from bitstream, no need to reload */
while (p < pEnd)
HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
return pEnd-pStart;
}
-static size_t HUF_decompress1X2_usingDTable_internal(
+FORCE_INLINE_TEMPLATE size_t
+HUF_decompress1X2_usingDTable_internal_body(
void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
const HUF_DTable* DTable)
@@ -200,58 +202,17 @@ static size_t HUF_decompress1X2_usingDTable_internal(
DTableDesc const dtd = HUF_getDTableDesc(DTable);
U32 const dtLog = dtd.tableLog;
- { size_t const errorCode = BIT_initDStream(&bitD, cSrc, cSrcSize);
- if (HUF_isError(errorCode)) return errorCode; }
+ CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
HUF_decodeStreamX2(op, &bitD, oend, dt, dtLog);
- /* check */
if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
return dstSize;
}
-size_t HUF_decompress1X2_usingDTable(
- void* dst, size_t dstSize,
- const void* cSrc, size_t cSrcSize,
- const HUF_DTable* DTable)
-{
- DTableDesc dtd = HUF_getDTableDesc(DTable);
- if (dtd.tableType != 0) return ERROR(GENERIC);
- return HUF_decompress1X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
-}
-
-size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize,
- const void* cSrc, size_t cSrcSize,
- void* workSpace, size_t wkspSize)
-{
- const BYTE* ip = (const BYTE*) cSrc;
-
- size_t const hSize = HUF_readDTableX2_wksp(DCtx, cSrc, cSrcSize, workSpace, wkspSize);
- if (HUF_isError(hSize)) return hSize;
- if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
- ip += hSize; cSrcSize -= hSize;
-
- return HUF_decompress1X2_usingDTable_internal (dst, dstSize, ip, cSrcSize, DCtx);
-}
-
-
-size_t HUF_decompress1X2_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize,
- const void* cSrc, size_t cSrcSize)
-{
- U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
- return HUF_decompress1X2_DCtx_wksp(DCtx, dst, dstSize, cSrc, cSrcSize,
- workSpace, sizeof(workSpace));
-}
-
-size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize)
-{
- HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX);
- return HUF_decompress1X2_DCtx (DTable, dst, dstSize, cSrc, cSrcSize);
-}
-
-
-static size_t HUF_decompress4X2_usingDTable_internal(
+FORCE_INLINE_TEMPLATE size_t
+HUF_decompress4X2_usingDTable_internal_body(
void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
const HUF_DTable* DTable)
@@ -286,23 +247,19 @@ static size_t HUF_decompress4X2_usingDTable_internal(
BYTE* op2 = opStart2;
BYTE* op3 = opStart3;
BYTE* op4 = opStart4;
- U32 endSignal;
+ U32 endSignal = BIT_DStream_unfinished;
DTableDesc const dtd = HUF_getDTableDesc(DTable);
U32 const dtLog = dtd.tableLog;
if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */
- { size_t const errorCode = BIT_initDStream(&bitD1, istart1, length1);
- if (HUF_isError(errorCode)) return errorCode; }
- { size_t const errorCode = BIT_initDStream(&bitD2, istart2, length2);
- if (HUF_isError(errorCode)) return errorCode; }
- { size_t const errorCode = BIT_initDStream(&bitD3, istart3, length3);
- if (HUF_isError(errorCode)) return errorCode; }
- { size_t const errorCode = BIT_initDStream(&bitD4, istart4, length4);
- if (HUF_isError(errorCode)) return errorCode; }
+ CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
+ CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
+ CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
+ CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
- /* 16-32 symbols per loop (4-8 symbols per stream) */
+ /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */
endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4);
- for ( ; (endSignal==BIT_DStream_unfinished) && (op4<(oend-7)) ; ) {
+ while ( (endSignal==BIT_DStream_unfinished) && (op4<(oend-3)) ) {
HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
@@ -319,10 +276,15 @@ static size_t HUF_decompress4X2_usingDTable_internal(
HUF_DECODE_SYMBOLX2_0(op2, &bitD2);
HUF_DECODE_SYMBOLX2_0(op3, &bitD3);
HUF_DECODE_SYMBOLX2_0(op4, &bitD4);
- endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4);
+ BIT_reloadDStream(&bitD1);
+ BIT_reloadDStream(&bitD2);
+ BIT_reloadDStream(&bitD3);
+ BIT_reloadDStream(&bitD4);
}
/* check corruption */
+ /* note : should not be necessary : op# advance in lock step, and we control op4.
+ * but curiously, binary generated by gcc 7.2 & 7.3 with -mbmi2 runs faster when >=1 test is present */
if (op1 > opStart2) return ERROR(corruption_detected);
if (op2 > opStart3) return ERROR(corruption_detected);
if (op3 > opStart4) return ERROR(corruption_detected);
@@ -335,8 +297,8 @@ static size_t HUF_decompress4X2_usingDTable_internal(
HUF_decodeStreamX2(op4, &bitD4, oend, dt, dtLog);
/* check */
- endSignal = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
- if (!endSignal) return ERROR(corruption_detected);
+ { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
+ if (!endCheck) return ERROR(corruption_detected); }
/* decoded size */
return dstSize;
@@ -344,30 +306,309 @@ static size_t HUF_decompress4X2_usingDTable_internal(
}
-size_t HUF_decompress4X2_usingDTable(
+FORCE_INLINE_TEMPLATE U32
+HUF_decodeSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DEltX4* dt, const U32 dtLog)
+{
+ size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
+ memcpy(op, dt+val, 2);
+ BIT_skipBits(DStream, dt[val].nbBits);
+ return dt[val].length;
+}
+
+FORCE_INLINE_TEMPLATE U32
+HUF_decodeLastSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DEltX4* dt, const U32 dtLog)
+{
+ size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
+ memcpy(op, dt+val, 1);
+ if (dt[val].length==1) BIT_skipBits(DStream, dt[val].nbBits);
+ else {
+ if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
+ BIT_skipBits(DStream, dt[val].nbBits);
+ if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
+ /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */
+ DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8);
+ } }
+ return 1;
+}
+
+#define HUF_DECODE_SYMBOLX4_0(ptr, DStreamPtr) \
+ ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
+
+#define HUF_DECODE_SYMBOLX4_1(ptr, DStreamPtr) \
+ if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
+ ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
+
+#define HUF_DECODE_SYMBOLX4_2(ptr, DStreamPtr) \
+ if (MEM_64bits()) \
+ ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
+
+HINT_INLINE size_t
+HUF_decodeStreamX4(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd,
+ const HUF_DEltX4* const dt, const U32 dtLog)
+{
+ BYTE* const pStart = p;
+
+ /* up to 8 symbols at a time */
+ while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) {
+ HUF_DECODE_SYMBOLX4_2(p, bitDPtr);
+ HUF_DECODE_SYMBOLX4_1(p, bitDPtr);
+ HUF_DECODE_SYMBOLX4_2(p, bitDPtr);
+ HUF_DECODE_SYMBOLX4_0(p, bitDPtr);
+ }
+
+ /* closer to end : up to 2 symbols at a time */
+ while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2))
+ HUF_DECODE_SYMBOLX4_0(p, bitDPtr);
+
+ while (p <= pEnd-2)
+ HUF_DECODE_SYMBOLX4_0(p, bitDPtr); /* no need to reload : reached the end of DStream */
+
+ if (p < pEnd)
+ p += HUF_decodeLastSymbolX4(p, bitDPtr, dt, dtLog);
+
+ return p-pStart;
+}
+
+FORCE_INLINE_TEMPLATE size_t
+HUF_decompress1X4_usingDTable_internal_body(
+ void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize,
+ const HUF_DTable* DTable)
+{
+ BIT_DStream_t bitD;
+
+ /* Init */
+ CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
+
+ /* decode */
+ { BYTE* const ostart = (BYTE*) dst;
+ BYTE* const oend = ostart + dstSize;
+ const void* const dtPtr = DTable+1; /* force compiler to not use strict-aliasing */
+ const HUF_DEltX4* const dt = (const HUF_DEltX4*)dtPtr;
+ DTableDesc const dtd = HUF_getDTableDesc(DTable);
+ HUF_decodeStreamX4(ostart, &bitD, oend, dt, dtd.tableLog);
+ }
+
+ /* check */
+ if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
+
+ /* decoded size */
+ return dstSize;
+}
+
+
+FORCE_INLINE_TEMPLATE size_t
+HUF_decompress4X4_usingDTable_internal_body(
+ void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize,
+ const HUF_DTable* DTable)
+{
+ if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
+
+ { const BYTE* const istart = (const BYTE*) cSrc;
+ BYTE* const ostart = (BYTE*) dst;
+ BYTE* const oend = ostart + dstSize;
+ const void* const dtPtr = DTable+1;
+ const HUF_DEltX4* const dt = (const HUF_DEltX4*)dtPtr;
+
+ /* Init */
+ BIT_DStream_t bitD1;
+ BIT_DStream_t bitD2;
+ BIT_DStream_t bitD3;
+ BIT_DStream_t bitD4;
+ size_t const length1 = MEM_readLE16(istart);
+ size_t const length2 = MEM_readLE16(istart+2);
+ size_t const length3 = MEM_readLE16(istart+4);
+ size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
+ const BYTE* const istart1 = istart + 6; /* jumpTable */
+ const BYTE* const istart2 = istart1 + length1;
+ const BYTE* const istart3 = istart2 + length2;
+ const BYTE* const istart4 = istart3 + length3;
+ size_t const segmentSize = (dstSize+3) / 4;
+ BYTE* const opStart2 = ostart + segmentSize;
+ BYTE* const opStart3 = opStart2 + segmentSize;
+ BYTE* const opStart4 = opStart3 + segmentSize;
+ BYTE* op1 = ostart;
+ BYTE* op2 = opStart2;
+ BYTE* op3 = opStart3;
+ BYTE* op4 = opStart4;
+ U32 endSignal;
+ DTableDesc const dtd = HUF_getDTableDesc(DTable);
+ U32 const dtLog = dtd.tableLog;
+
+ if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */
+ CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
+ CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
+ CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
+ CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
+
+ /* 16-32 symbols per loop (4-8 symbols per stream) */
+ endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4);
+ for ( ; (endSignal==BIT_DStream_unfinished) & (op4<(oend-(sizeof(bitD4.bitContainer)-1))) ; ) {
+ HUF_DECODE_SYMBOLX4_2(op1, &bitD1);
+ HUF_DECODE_SYMBOLX4_2(op2, &bitD2);
+ HUF_DECODE_SYMBOLX4_2(op3, &bitD3);
+ HUF_DECODE_SYMBOLX4_2(op4, &bitD4);
+ HUF_DECODE_SYMBOLX4_1(op1, &bitD1);
+ HUF_DECODE_SYMBOLX4_1(op2, &bitD2);
+ HUF_DECODE_SYMBOLX4_1(op3, &bitD3);
+ HUF_DECODE_SYMBOLX4_1(op4, &bitD4);
+ HUF_DECODE_SYMBOLX4_2(op1, &bitD1);
+ HUF_DECODE_SYMBOLX4_2(op2, &bitD2);
+ HUF_DECODE_SYMBOLX4_2(op3, &bitD3);
+ HUF_DECODE_SYMBOLX4_2(op4, &bitD4);
+ HUF_DECODE_SYMBOLX4_0(op1, &bitD1);
+ HUF_DECODE_SYMBOLX4_0(op2, &bitD2);
+ HUF_DECODE_SYMBOLX4_0(op3, &bitD3);
+ HUF_DECODE_SYMBOLX4_0(op4, &bitD4);
+
+ endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4);
+ }
+
+ /* check corruption */
+ if (op1 > opStart2) return ERROR(corruption_detected);
+ if (op2 > opStart3) return ERROR(corruption_detected);
+ if (op3 > opStart4) return ERROR(corruption_detected);
+ /* note : op4 already verified within main loop */
+
+ /* finish bitStreams one by one */
+ HUF_decodeStreamX4(op1, &bitD1, opStart2, dt, dtLog);
+ HUF_decodeStreamX4(op2, &bitD2, opStart3, dt, dtLog);
+ HUF_decodeStreamX4(op3, &bitD3, opStart4, dt, dtLog);
+ HUF_decodeStreamX4(op4, &bitD4, oend, dt, dtLog);
+
+ /* check */
+ { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
+ if (!endCheck) return ERROR(corruption_detected); }
+
+ /* decoded size */
+ return dstSize;
+ }
+}
+
+
+typedef size_t (*HUF_decompress_usingDTable_t)(void *dst, size_t dstSize,
+ const void *cSrc,
+ size_t cSrcSize,
+ const HUF_DTable *DTable);
+#if DYNAMIC_BMI2
+
+#define X(fn) \
+ \
+ static size_t fn##_default( \
+ void* dst, size_t dstSize, \
+ const void* cSrc, size_t cSrcSize, \
+ const HUF_DTable* DTable) \
+ { \
+ return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \
+ } \
+ \
+ static TARGET_ATTRIBUTE("bmi2") size_t fn##_bmi2( \
+ void* dst, size_t dstSize, \
+ const void* cSrc, size_t cSrcSize, \
+ const HUF_DTable* DTable) \
+ { \
+ return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \
+ } \
+ \
+ static size_t fn(void* dst, size_t dstSize, void const* cSrc, \
+ size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \
+ { \
+ if (bmi2) { \
+ return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); \
+ } \
+ return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable); \
+ }
+
+#else
+
+#define X(fn) \
+ static size_t fn(void* dst, size_t dstSize, void const* cSrc, \
+ size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \
+ { \
+ (void)bmi2; \
+ return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \
+ }
+
+#endif
+
+X(HUF_decompress1X2_usingDTable_internal)
+X(HUF_decompress4X2_usingDTable_internal)
+X(HUF_decompress1X4_usingDTable_internal)
+X(HUF_decompress4X4_usingDTable_internal)
+
+#undef X
+
+
+size_t HUF_decompress1X2_usingDTable(
void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
const HUF_DTable* DTable)
{
DTableDesc dtd = HUF_getDTableDesc(DTable);
if (dtd.tableType != 0) return ERROR(GENERIC);
- return HUF_decompress4X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
+ return HUF_decompress1X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0);
}
-
-size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
+size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
void* workSpace, size_t wkspSize)
{
const BYTE* ip = (const BYTE*) cSrc;
+ size_t const hSize = HUF_readDTableX2_wksp(DCtx, cSrc, cSrcSize, workSpace, wkspSize);
+ if (HUF_isError(hSize)) return hSize;
+ if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
+ ip += hSize; cSrcSize -= hSize;
+
+ return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, /* bmi2 */ 0);
+}
+
+
+size_t HUF_decompress1X2_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize)
+{
+ U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
+ return HUF_decompress1X2_DCtx_wksp(DCtx, dst, dstSize, cSrc, cSrcSize,
+ workSpace, sizeof(workSpace));
+}
+
+size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize)
+{
+ HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX);
+ return HUF_decompress1X2_DCtx (DTable, dst, dstSize, cSrc, cSrcSize);
+}
+
+size_t HUF_decompress4X2_usingDTable(
+ void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize,
+ const HUF_DTable* DTable)
+{
+ DTableDesc dtd = HUF_getDTableDesc(DTable);
+ if (dtd.tableType != 0) return ERROR(GENERIC);
+ return HUF_decompress4X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0);
+}
+
+static size_t HUF_decompress4X2_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize,
+ void* workSpace, size_t wkspSize, int bmi2)
+{
+ const BYTE* ip = (const BYTE*) cSrc;
+
size_t const hSize = HUF_readDTableX2_wksp (dctx, cSrc, cSrcSize,
workSpace, wkspSize);
if (HUF_isError(hSize)) return hSize;
if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
ip += hSize; cSrcSize -= hSize;
- return HUF_decompress4X2_usingDTable_internal (dst, dstSize, ip, cSrcSize, dctx);
+ return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2);
+}
+
+size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize,
+ void* workSpace, size_t wkspSize)
+{
+ return HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, 0);
}
@@ -387,8 +628,6 @@ size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cS
/* *************************/
/* double-symbols decoding */
/* *************************/
-typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX4; /* double-symbols decoding */
-
typedef struct { BYTE symbol; BYTE weight; } sortedSymbol_t;
/* HUF_fillDTableX4Level2() :
@@ -508,10 +747,7 @@ size_t HUF_readDTableX4_wksp(HUF_DTable* DTable, const void* src,
weightList = (BYTE *)((U32 *)workSpace + spaceUsed32);
spaceUsed32 += HUF_ALIGN(HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2;
- if ((spaceUsed32 << 2) > wkspSize)
- return ERROR(tableLog_tooLarge);
- workSpace = (U32 *)workSpace + spaceUsed32;
- wkspSize -= (spaceUsed32 << 2);
+ if ((spaceUsed32 << 2) > wkspSize) return ERROR(tableLog_tooLarge);
rankStart = rankStart0 + 1;
memset(rankStats, 0, sizeof(U32) * (2 * HUF_TABLELOG_MAX + 2 + 1));
@@ -588,95 +824,6 @@ size_t HUF_readDTableX4(HUF_DTable* DTable, const void* src, size_t srcSize)
workSpace, sizeof(workSpace));
}
-static U32 HUF_decodeSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DEltX4* dt, const U32 dtLog)
-{
- size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
- memcpy(op, dt+val, 2);
- BIT_skipBits(DStream, dt[val].nbBits);
- return dt[val].length;
-}
-
-static U32 HUF_decodeLastSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DEltX4* dt, const U32 dtLog)
-{
- size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
- memcpy(op, dt+val, 1);
- if (dt[val].length==1) BIT_skipBits(DStream, dt[val].nbBits);
- else {
- if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
- BIT_skipBits(DStream, dt[val].nbBits);
- if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
- /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */
- DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8);
- } }
- return 1;
-}
-
-
-#define HUF_DECODE_SYMBOLX4_0(ptr, DStreamPtr) \
- ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
-
-#define HUF_DECODE_SYMBOLX4_1(ptr, DStreamPtr) \
- if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
- ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
-
-#define HUF_DECODE_SYMBOLX4_2(ptr, DStreamPtr) \
- if (MEM_64bits()) \
- ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog)
-
-HINT_INLINE size_t HUF_decodeStreamX4(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, const HUF_DEltX4* const dt, const U32 dtLog)
-{
- BYTE* const pStart = p;
-
- /* up to 8 symbols at a time */
- while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) {
- HUF_DECODE_SYMBOLX4_2(p, bitDPtr);
- HUF_DECODE_SYMBOLX4_1(p, bitDPtr);
- HUF_DECODE_SYMBOLX4_2(p, bitDPtr);
- HUF_DECODE_SYMBOLX4_0(p, bitDPtr);
- }
-
- /* closer to end : up to 2 symbols at a time */
- while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2))
- HUF_DECODE_SYMBOLX4_0(p, bitDPtr);
-
- while (p <= pEnd-2)
- HUF_DECODE_SYMBOLX4_0(p, bitDPtr); /* no need to reload : reached the end of DStream */
-
- if (p < pEnd)
- p += HUF_decodeLastSymbolX4(p, bitDPtr, dt, dtLog);
-
- return p-pStart;
-}
-
-
-static size_t HUF_decompress1X4_usingDTable_internal(
- void* dst, size_t dstSize,
- const void* cSrc, size_t cSrcSize,
- const HUF_DTable* DTable)
-{
- BIT_DStream_t bitD;
-
- /* Init */
- { size_t const errorCode = BIT_initDStream(&bitD, cSrc, cSrcSize);
- if (HUF_isError(errorCode)) return errorCode;
- }
-
- /* decode */
- { BYTE* const ostart = (BYTE*) dst;
- BYTE* const oend = ostart + dstSize;
- const void* const dtPtr = DTable+1; /* force compiler to not use strict-aliasing */
- const HUF_DEltX4* const dt = (const HUF_DEltX4*)dtPtr;
- DTableDesc const dtd = HUF_getDTableDesc(DTable);
- HUF_decodeStreamX4(ostart, &bitD, oend, dt, dtd.tableLog);
- }
-
- /* check */
- if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
-
- /* decoded size */
- return dstSize;
-}
-
size_t HUF_decompress1X4_usingDTable(
void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
@@ -684,7 +831,7 @@ size_t HUF_decompress1X4_usingDTable(
{
DTableDesc dtd = HUF_getDTableDesc(DTable);
if (dtd.tableType != 1) return ERROR(GENERIC);
- return HUF_decompress1X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
+ return HUF_decompress1X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0);
}
size_t HUF_decompress1X4_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize,
@@ -699,7 +846,7 @@ size_t HUF_decompress1X4_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize,
if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
ip += hSize; cSrcSize -= hSize;
- return HUF_decompress1X4_usingDTable_internal (dst, dstSize, ip, cSrcSize, DCtx);
+ return HUF_decompress1X4_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, /* bmi2 */ 0);
}
@@ -717,99 +864,6 @@ size_t HUF_decompress1X4 (void* dst, size_t dstSize, const void* cSrc, size_t cS
return HUF_decompress1X4_DCtx(DTable, dst, dstSize, cSrc, cSrcSize);
}
-static size_t HUF_decompress4X4_usingDTable_internal(
- void* dst, size_t dstSize,
- const void* cSrc, size_t cSrcSize,
- const HUF_DTable* DTable)
-{
- if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
-
- { const BYTE* const istart = (const BYTE*) cSrc;
- BYTE* const ostart = (BYTE*) dst;
- BYTE* const oend = ostart + dstSize;
- const void* const dtPtr = DTable+1;
- const HUF_DEltX4* const dt = (const HUF_DEltX4*)dtPtr;
-
- /* Init */
- BIT_DStream_t bitD1;
- BIT_DStream_t bitD2;
- BIT_DStream_t bitD3;
- BIT_DStream_t bitD4;
- size_t const length1 = MEM_readLE16(istart);
- size_t const length2 = MEM_readLE16(istart+2);
- size_t const length3 = MEM_readLE16(istart+4);
- size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
- const BYTE* const istart1 = istart + 6; /* jumpTable */
- const BYTE* const istart2 = istart1 + length1;
- const BYTE* const istart3 = istart2 + length2;
- const BYTE* const istart4 = istart3 + length3;
- size_t const segmentSize = (dstSize+3) / 4;
- BYTE* const opStart2 = ostart + segmentSize;
- BYTE* const opStart3 = opStart2 + segmentSize;
- BYTE* const opStart4 = opStart3 + segmentSize;
- BYTE* op1 = ostart;
- BYTE* op2 = opStart2;
- BYTE* op3 = opStart3;
- BYTE* op4 = opStart4;
- U32 endSignal;
- DTableDesc const dtd = HUF_getDTableDesc(DTable);
- U32 const dtLog = dtd.tableLog;
-
- if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */
- { size_t const errorCode = BIT_initDStream(&bitD1, istart1, length1);
- if (HUF_isError(errorCode)) return errorCode; }
- { size_t const errorCode = BIT_initDStream(&bitD2, istart2, length2);
- if (HUF_isError(errorCode)) return errorCode; }
- { size_t const errorCode = BIT_initDStream(&bitD3, istart3, length3);
- if (HUF_isError(errorCode)) return errorCode; }
- { size_t const errorCode = BIT_initDStream(&bitD4, istart4, length4);
- if (HUF_isError(errorCode)) return errorCode; }
-
- /* 16-32 symbols per loop (4-8 symbols per stream) */
- endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4);
- for ( ; (endSignal==BIT_DStream_unfinished) & (op4<(oend-(sizeof(bitD4.bitContainer)-1))) ; ) {
- HUF_DECODE_SYMBOLX4_2(op1, &bitD1);
- HUF_DECODE_SYMBOLX4_2(op2, &bitD2);
- HUF_DECODE_SYMBOLX4_2(op3, &bitD3);
- HUF_DECODE_SYMBOLX4_2(op4, &bitD4);
- HUF_DECODE_SYMBOLX4_1(op1, &bitD1);
- HUF_DECODE_SYMBOLX4_1(op2, &bitD2);
- HUF_DECODE_SYMBOLX4_1(op3, &bitD3);
- HUF_DECODE_SYMBOLX4_1(op4, &bitD4);
- HUF_DECODE_SYMBOLX4_2(op1, &bitD1);
- HUF_DECODE_SYMBOLX4_2(op2, &bitD2);
- HUF_DECODE_SYMBOLX4_2(op3, &bitD3);
- HUF_DECODE_SYMBOLX4_2(op4, &bitD4);
- HUF_DECODE_SYMBOLX4_0(op1, &bitD1);
- HUF_DECODE_SYMBOLX4_0(op2, &bitD2);
- HUF_DECODE_SYMBOLX4_0(op3, &bitD3);
- HUF_DECODE_SYMBOLX4_0(op4, &bitD4);
-
- endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4);
- }
-
- /* check corruption */
- if (op1 > opStart2) return ERROR(corruption_detected);
- if (op2 > opStart3) return ERROR(corruption_detected);
- if (op3 > opStart4) return ERROR(corruption_detected);
- /* note : op4 already verified within main loop */
-
- /* finish bitStreams one by one */
- HUF_decodeStreamX4(op1, &bitD1, opStart2, dt, dtLog);
- HUF_decodeStreamX4(op2, &bitD2, opStart3, dt, dtLog);
- HUF_decodeStreamX4(op3, &bitD3, opStart4, dt, dtLog);
- HUF_decodeStreamX4(op4, &bitD4, oend, dt, dtLog);
-
- /* check */
- { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
- if (!endCheck) return ERROR(corruption_detected); }
-
- /* decoded size */
- return dstSize;
- }
-}
-
-
size_t HUF_decompress4X4_usingDTable(
void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
@@ -817,13 +871,12 @@ size_t HUF_decompress4X4_usingDTable(
{
DTableDesc dtd = HUF_getDTableDesc(DTable);
if (dtd.tableType != 1) return ERROR(GENERIC);
- return HUF_decompress4X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
+ return HUF_decompress4X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0);
}
-
-size_t HUF_decompress4X4_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
+static size_t HUF_decompress4X4_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize,
const void* cSrc, size_t cSrcSize,
- void* workSpace, size_t wkspSize)
+ void* workSpace, size_t wkspSize, int bmi2)
{
const BYTE* ip = (const BYTE*) cSrc;
@@ -833,7 +886,14 @@ size_t HUF_decompress4X4_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
ip += hSize; cSrcSize -= hSize;
- return HUF_decompress4X4_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx);
+ return HUF_decompress4X4_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2);
+}
+
+size_t HUF_decompress4X4_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
+ const void* cSrc, size_t cSrcSize,
+ void* workSpace, size_t wkspSize)
+{
+ return HUF_decompress4X4_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, /* bmi2 */ 0);
}
@@ -861,8 +921,8 @@ size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize,
const HUF_DTable* DTable)
{
DTableDesc const dtd = HUF_getDTableDesc(DTable);
- return dtd.tableType ? HUF_decompress1X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable) :
- HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable);
+ return dtd.tableType ? HUF_decompress1X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0) :
+ HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0);
}
size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize,
@@ -870,8 +930,8 @@ size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize,
const HUF_DTable* DTable)
{
DTableDesc const dtd = HUF_getDTableDesc(DTable);
- return dtd.tableType ? HUF_decompress4X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable) :
- HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable);
+ return dtd.tableType ? HUF_decompress4X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0) :
+ HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0);
}
@@ -898,21 +958,22 @@ static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, qu
};
/** HUF_selectDecoder() :
-* Tells which decoder is likely to decode faster,
-* based on a set of pre-determined metrics.
-* @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
-* Assumption : 0 < cSrcSize, dstSize <= 128 KB */
+ * Tells which decoder is likely to decode faster,
+ * based on a set of pre-computed metrics.
+ * @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
+ * Assumption : 0 < dstSize <= 128 KB */
U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize)
{
+ assert(dstSize > 0);
+ assert(dstSize <= 128 KB);
/* decoder timing evaluation */
- U32 const Q = cSrcSize >= dstSize ? 15 : (U32)(cSrcSize * 16 / dstSize); /* Q < 16 */
- U32 const D256 = (U32)(dstSize >> 8);
- U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
- U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
- DTime1 += DTime1 >> 3; /* advantage to algorithm using less memory, for cache eviction */
-
- return DTime1 < DTime0;
-}
+ { U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize); /* Q < 16 */
+ U32 const D256 = (U32)(dstSize >> 8);
+ U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
+ U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
+ DTime1 += DTime1 >> 3; /* advantage to algorithm using less memory, to reduce cache eviction */
+ return DTime1 < DTime0;
+} }
typedef size_t (*decompressionAlgo)(void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize);
@@ -994,3 +1055,42 @@ size_t HUF_decompress1X_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize,
return HUF_decompress1X_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize,
workSpace, sizeof(workSpace));
}
+
+
+size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2)
+{
+ DTableDesc const dtd = HUF_getDTableDesc(DTable);
+ return dtd.tableType ? HUF_decompress1X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) :
+ HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
+}
+
+size_t HUF_decompress1X2_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2)
+{
+ const BYTE* ip = (const BYTE*) cSrc;
+
+ size_t const hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize);
+ if (HUF_isError(hSize)) return hSize;
+ if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
+ ip += hSize; cSrcSize -= hSize;
+
+ return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2);
+}
+
+size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2)
+{
+ DTableDesc const dtd = HUF_getDTableDesc(DTable);
+ return dtd.tableType ? HUF_decompress4X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) :
+ HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
+}
+
+size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2)
+{
+ /* validation checks */
+ if (dstSize == 0) return ERROR(dstSize_tooSmall);
+ if (cSrcSize == 0) return ERROR(corruption_detected);
+
+ { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize);
+ return algoNb ? HUF_decompress4X4_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2) :
+ HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2);
+ }
+}
diff --git a/thirdparty/zstd/decompress/zstd_decompress.c b/thirdparty/zstd/decompress/zstd_decompress.c
index a59d944112..3ec6a1cb32 100644
--- a/thirdparty/zstd/decompress/zstd_decompress.c
+++ b/thirdparty/zstd/decompress/zstd_decompress.c
@@ -14,8 +14,9 @@
*****************************************************************/
/*!
* HEAPMODE :
- * Select how default decompression function ZSTD_decompress() will allocate memory,
- * in memory stack (0), or in memory heap (1, requires malloc())
+ * Select how default decompression function ZSTD_decompress() allocates its context,
+ * on stack (0), or into heap (1, default; requires malloc()).
+ * Note that functions with explicit context such as ZSTD_decompressDCtx() are unaffected.
*/
#ifndef ZSTD_HEAPMODE
# define ZSTD_HEAPMODE 1
@@ -23,17 +24,18 @@
/*!
* LEGACY_SUPPORT :
-* if set to 1, ZSTD_decompress() can decode older formats (v0.1+)
+* if set to 1+, ZSTD_decompress() can decode older formats (v0.1+)
*/
#ifndef ZSTD_LEGACY_SUPPORT
# define ZSTD_LEGACY_SUPPORT 0
#endif
/*!
-* MAXWINDOWSIZE_DEFAULT :
-* maximum window size accepted by DStream, by default.
-* Frames requiring more memory will be rejected.
-*/
+ * MAXWINDOWSIZE_DEFAULT :
+ * maximum window size accepted by DStream __by default__.
+ * Frames requiring more memory will be rejected.
+ * It's possible to set a different limit using ZSTD_DCtx_setMaxWindowSize().
+ */
#ifndef ZSTD_MAXWINDOWSIZE_DEFAULT
# define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_DEFAULTMAX) + 1)
#endif
@@ -43,6 +45,7 @@
* Dependencies
*********************************************************/
#include <string.h> /* memcpy, memmove, memset */
+#include "cpu.h"
#include "mem.h" /* low level memory routines */
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
@@ -80,10 +83,25 @@ typedef enum { ZSTDds_getFrameHeaderSize, ZSTDds_decodeFrameHeader,
typedef enum { zdss_init=0, zdss_loadHeader,
zdss_read, zdss_load, zdss_flush } ZSTD_dStreamStage;
+
+typedef struct {
+ U32 fastMode;
+ U32 tableLog;
+} ZSTD_seqSymbol_header;
+
+typedef struct {
+ U16 nextState;
+ BYTE nbAdditionalBits;
+ BYTE nbBits;
+ U32 baseValue;
+} ZSTD_seqSymbol;
+
+#define SEQSYMBOL_TABLE_SIZE(log) (1 + (1 << (log)))
+
typedef struct {
- FSE_DTable LLTable[FSE_DTABLE_SIZE_U32(LLFSELog)];
- FSE_DTable OFTable[FSE_DTABLE_SIZE_U32(OffFSELog)];
- FSE_DTable MLTable[FSE_DTABLE_SIZE_U32(MLFSELog)];
+ ZSTD_seqSymbol LLTable[SEQSYMBOL_TABLE_SIZE(LLFSELog)];
+ ZSTD_seqSymbol OFTable[SEQSYMBOL_TABLE_SIZE(OffFSELog)];
+ ZSTD_seqSymbol MLTable[SEQSYMBOL_TABLE_SIZE(MLFSELog)];
HUF_DTable hufTable[HUF_DTABLE_SIZE(HufLog)]; /* can accommodate HUF_decompress4X */
U32 workspace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
U32 rep[ZSTD_REP_NUM];
@@ -91,9 +109,9 @@ typedef struct {
struct ZSTD_DCtx_s
{
- const FSE_DTable* LLTptr;
- const FSE_DTable* MLTptr;
- const FSE_DTable* OFTptr;
+ const ZSTD_seqSymbol* LLTptr;
+ const ZSTD_seqSymbol* MLTptr;
+ const ZSTD_seqSymbol* OFTptr;
const HUF_DTable* HUFptr;
ZSTD_entropyDTables_t entropy;
const void* previousDstEnd; /* detect continuity */
@@ -116,6 +134,7 @@ struct ZSTD_DCtx_s
size_t litSize;
size_t rleSize;
size_t staticSize;
+ int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */
/* streaming */
ZSTD_DDict* ddictLocal;
@@ -173,6 +192,7 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx)
dctx->inBuffSize = 0;
dctx->outBuffSize = 0;
dctx->streamStage = zdss_init;
+ dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid());
}
ZSTD_DCtx* ZSTD_initStaticDCtx(void *workspace, size_t workspaceSize)
@@ -204,6 +224,7 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
ZSTD_DCtx* ZSTD_createDCtx(void)
{
+ DEBUGLOG(3, "ZSTD_createDCtx");
return ZSTD_createDCtx_advanced(ZSTD_defaultCMem);
}
@@ -234,8 +255,8 @@ void ZSTD_copyDCtx(ZSTD_DCtx* dstDCtx, const ZSTD_DCtx* srcDCtx)
/*-*************************************************************
-* Decompression section
-***************************************************************/
+ * Frame header decoding
+ ***************************************************************/
/*! ZSTD_isFrame() :
* Tells if the content of `buffer` starts with a valid Frame Identifier.
@@ -257,7 +278,7 @@ unsigned ZSTD_isFrame(const void* buffer, size_t size)
/** ZSTD_frameHeaderSize_internal() :
* srcSize must be large enough to reach header size fields.
- * note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless
+ * note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless.
* @return : size of the Frame Header
* or an error code, which can be tested with ZSTD_isError() */
static size_t ZSTD_frameHeaderSize_internal(const void* src, size_t srcSize, ZSTD_format_e format)
@@ -480,6 +501,10 @@ static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t he
}
+/*-*************************************************************
+ * Block decoding
+ ***************************************************************/
+
/*! ZSTD_getcBlockSize() :
* Provides the size of compressed block from block header `src` */
size_t ZSTD_getcBlockSize(const void* src, size_t srcSize,
@@ -566,13 +591,13 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,
if (HUF_isError((litEncType==set_repeat) ?
( singleStream ?
- HUF_decompress1X_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->HUFptr) :
- HUF_decompress4X_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->HUFptr) ) :
+ HUF_decompress1X_usingDTable_bmi2(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->HUFptr, dctx->bmi2) :
+ HUF_decompress4X_usingDTable_bmi2(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->HUFptr, dctx->bmi2) ) :
( singleStream ?
- HUF_decompress1X2_DCtx_wksp(dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize,
- dctx->entropy.workspace, sizeof(dctx->entropy.workspace)) :
- HUF_decompress4X_hufOnly_wksp(dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize,
- dctx->entropy.workspace, sizeof(dctx->entropy.workspace)))))
+ HUF_decompress1X2_DCtx_wksp_bmi2(dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize,
+ dctx->entropy.workspace, sizeof(dctx->entropy.workspace), dctx->bmi2) :
+ HUF_decompress4X_hufOnly_wksp_bmi2(dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize,
+ dctx->entropy.workspace, sizeof(dctx->entropy.workspace), dctx->bmi2))))
return ERROR(corruption_detected);
dctx->litPtr = dctx->litBuffer;
@@ -647,115 +672,268 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx,
}
}
-
-typedef union {
- FSE_decode_t realData;
- U32 alignedBy4;
-} FSE_decode_t4;
+/* Default FSE distribution tables.
+ * These are pre-calculated FSE decoding tables using default distributions as defined in specification :
+ * https://github.com/facebook/zstd/blob/master/doc/zstd_compression_format.md#default-distributions
+ * They were generated programmatically with following method :
+ * - start from default distributions, present in /lib/common/zstd_internal.h
+ * - generate tables normally, using ZSTD_buildFSETable()
+ * - printout the content of tables
+ * - pretify output, report below, test with fuzzer to ensure it's correct */
/* Default FSE distribution table for Literal Lengths */
-static const FSE_decode_t4 LL_defaultDTable[(1<<LL_DEFAULTNORMLOG)+1] = {
- { { LL_DEFAULTNORMLOG, 1, 1 } }, /* header : tableLog, fastMode, fastMode */
- /* base, symbol, bits */
- { { 0, 0, 4 } }, { { 16, 0, 4 } }, { { 32, 1, 5 } }, { { 0, 3, 5 } },
- { { 0, 4, 5 } }, { { 0, 6, 5 } }, { { 0, 7, 5 } }, { { 0, 9, 5 } },
- { { 0, 10, 5 } }, { { 0, 12, 5 } }, { { 0, 14, 6 } }, { { 0, 16, 5 } },
- { { 0, 18, 5 } }, { { 0, 19, 5 } }, { { 0, 21, 5 } }, { { 0, 22, 5 } },
- { { 0, 24, 5 } }, { { 32, 25, 5 } }, { { 0, 26, 5 } }, { { 0, 27, 6 } },
- { { 0, 29, 6 } }, { { 0, 31, 6 } }, { { 32, 0, 4 } }, { { 0, 1, 4 } },
- { { 0, 2, 5 } }, { { 32, 4, 5 } }, { { 0, 5, 5 } }, { { 32, 7, 5 } },
- { { 0, 8, 5 } }, { { 32, 10, 5 } }, { { 0, 11, 5 } }, { { 0, 13, 6 } },
- { { 32, 16, 5 } }, { { 0, 17, 5 } }, { { 32, 19, 5 } }, { { 0, 20, 5 } },
- { { 32, 22, 5 } }, { { 0, 23, 5 } }, { { 0, 25, 4 } }, { { 16, 25, 4 } },
- { { 32, 26, 5 } }, { { 0, 28, 6 } }, { { 0, 30, 6 } }, { { 48, 0, 4 } },
- { { 16, 1, 4 } }, { { 32, 2, 5 } }, { { 32, 3, 5 } }, { { 32, 5, 5 } },
- { { 32, 6, 5 } }, { { 32, 8, 5 } }, { { 32, 9, 5 } }, { { 32, 11, 5 } },
- { { 32, 12, 5 } }, { { 0, 15, 6 } }, { { 32, 17, 5 } }, { { 32, 18, 5 } },
- { { 32, 20, 5 } }, { { 32, 21, 5 } }, { { 32, 23, 5 } }, { { 32, 24, 5 } },
- { { 0, 35, 6 } }, { { 0, 34, 6 } }, { { 0, 33, 6 } }, { { 0, 32, 6 } },
+static const ZSTD_seqSymbol LL_defaultDTable[(1<<LL_DEFAULTNORMLOG)+1] = {
+ { 1, 1, 1, LL_DEFAULTNORMLOG}, /* header : fastMode, tableLog */
+ /* nextState, nbAddBits, nbBits, baseVal */
+ { 0, 0, 4, 0}, { 16, 0, 4, 0},
+ { 32, 0, 5, 1}, { 0, 0, 5, 3},
+ { 0, 0, 5, 4}, { 0, 0, 5, 6},
+ { 0, 0, 5, 7}, { 0, 0, 5, 9},
+ { 0, 0, 5, 10}, { 0, 0, 5, 12},
+ { 0, 0, 6, 14}, { 0, 1, 5, 16},
+ { 0, 1, 5, 20}, { 0, 1, 5, 22},
+ { 0, 2, 5, 28}, { 0, 3, 5, 32},
+ { 0, 4, 5, 48}, { 32, 6, 5, 64},
+ { 0, 7, 5, 128}, { 0, 8, 6, 256},
+ { 0, 10, 6, 1024}, { 0, 12, 6, 4096},
+ { 32, 0, 4, 0}, { 0, 0, 4, 1},
+ { 0, 0, 5, 2}, { 32, 0, 5, 4},
+ { 0, 0, 5, 5}, { 32, 0, 5, 7},
+ { 0, 0, 5, 8}, { 32, 0, 5, 10},
+ { 0, 0, 5, 11}, { 0, 0, 6, 13},
+ { 32, 1, 5, 16}, { 0, 1, 5, 18},
+ { 32, 1, 5, 22}, { 0, 2, 5, 24},
+ { 32, 3, 5, 32}, { 0, 3, 5, 40},
+ { 0, 6, 4, 64}, { 16, 6, 4, 64},
+ { 32, 7, 5, 128}, { 0, 9, 6, 512},
+ { 0, 11, 6, 2048}, { 48, 0, 4, 0},
+ { 16, 0, 4, 1}, { 32, 0, 5, 2},
+ { 32, 0, 5, 3}, { 32, 0, 5, 5},
+ { 32, 0, 5, 6}, { 32, 0, 5, 8},
+ { 32, 0, 5, 9}, { 32, 0, 5, 11},
+ { 32, 0, 5, 12}, { 0, 0, 6, 15},
+ { 32, 1, 5, 18}, { 32, 1, 5, 20},
+ { 32, 2, 5, 24}, { 32, 2, 5, 28},
+ { 32, 3, 5, 40}, { 32, 4, 5, 48},
+ { 0, 16, 6,65536}, { 0, 15, 6,32768},
+ { 0, 14, 6,16384}, { 0, 13, 6, 8192},
}; /* LL_defaultDTable */
+/* Default FSE distribution table for Offset Codes */
+static const ZSTD_seqSymbol OF_defaultDTable[(1<<OF_DEFAULTNORMLOG)+1] = {
+ { 1, 1, 1, OF_DEFAULTNORMLOG}, /* header : fastMode, tableLog */
+ /* nextState, nbAddBits, nbBits, baseVal */
+ { 0, 0, 5, 0}, { 0, 6, 4, 61},
+ { 0, 9, 5, 509}, { 0, 15, 5,32765},
+ { 0, 21, 5,2097149}, { 0, 3, 5, 5},
+ { 0, 7, 4, 125}, { 0, 12, 5, 4093},
+ { 0, 18, 5,262141}, { 0, 23, 5,8388605},
+ { 0, 5, 5, 29}, { 0, 8, 4, 253},
+ { 0, 14, 5,16381}, { 0, 20, 5,1048573},
+ { 0, 2, 5, 1}, { 16, 7, 4, 125},
+ { 0, 11, 5, 2045}, { 0, 17, 5,131069},
+ { 0, 22, 5,4194301}, { 0, 4, 5, 13},
+ { 16, 8, 4, 253}, { 0, 13, 5, 8189},
+ { 0, 19, 5,524285}, { 0, 1, 5, 1},
+ { 16, 6, 4, 61}, { 0, 10, 5, 1021},
+ { 0, 16, 5,65533}, { 0, 28, 5,268435453},
+ { 0, 27, 5,134217725}, { 0, 26, 5,67108861},
+ { 0, 25, 5,33554429}, { 0, 24, 5,16777213},
+}; /* OF_defaultDTable */
+
+
/* Default FSE distribution table for Match Lengths */
-static const FSE_decode_t4 ML_defaultDTable[(1<<ML_DEFAULTNORMLOG)+1] = {
- { { ML_DEFAULTNORMLOG, 1, 1 } }, /* header : tableLog, fastMode, fastMode */
- /* base, symbol, bits */
- { { 0, 0, 6 } }, { { 0, 1, 4 } }, { { 32, 2, 5 } }, { { 0, 3, 5 } },
- { { 0, 5, 5 } }, { { 0, 6, 5 } }, { { 0, 8, 5 } }, { { 0, 10, 6 } },
- { { 0, 13, 6 } }, { { 0, 16, 6 } }, { { 0, 19, 6 } }, { { 0, 22, 6 } },
- { { 0, 25, 6 } }, { { 0, 28, 6 } }, { { 0, 31, 6 } }, { { 0, 33, 6 } },
- { { 0, 35, 6 } }, { { 0, 37, 6 } }, { { 0, 39, 6 } }, { { 0, 41, 6 } },
- { { 0, 43, 6 } }, { { 0, 45, 6 } }, { { 16, 1, 4 } }, { { 0, 2, 4 } },
- { { 32, 3, 5 } }, { { 0, 4, 5 } }, { { 32, 6, 5 } }, { { 0, 7, 5 } },
- { { 0, 9, 6 } }, { { 0, 12, 6 } }, { { 0, 15, 6 } }, { { 0, 18, 6 } },
- { { 0, 21, 6 } }, { { 0, 24, 6 } }, { { 0, 27, 6 } }, { { 0, 30, 6 } },
- { { 0, 32, 6 } }, { { 0, 34, 6 } }, { { 0, 36, 6 } }, { { 0, 38, 6 } },
- { { 0, 40, 6 } }, { { 0, 42, 6 } }, { { 0, 44, 6 } }, { { 32, 1, 4 } },
- { { 48, 1, 4 } }, { { 16, 2, 4 } }, { { 32, 4, 5 } }, { { 32, 5, 5 } },
- { { 32, 7, 5 } }, { { 32, 8, 5 } }, { { 0, 11, 6 } }, { { 0, 14, 6 } },
- { { 0, 17, 6 } }, { { 0, 20, 6 } }, { { 0, 23, 6 } }, { { 0, 26, 6 } },
- { { 0, 29, 6 } }, { { 0, 52, 6 } }, { { 0, 51, 6 } }, { { 0, 50, 6 } },
- { { 0, 49, 6 } }, { { 0, 48, 6 } }, { { 0, 47, 6 } }, { { 0, 46, 6 } },
+static const ZSTD_seqSymbol ML_defaultDTable[(1<<ML_DEFAULTNORMLOG)+1] = {
+ { 1, 1, 1, ML_DEFAULTNORMLOG}, /* header : fastMode, tableLog */
+ /* nextState, nbAddBits, nbBits, baseVal */
+ { 0, 0, 6, 3}, { 0, 0, 4, 4},
+ { 32, 0, 5, 5}, { 0, 0, 5, 6},
+ { 0, 0, 5, 8}, { 0, 0, 5, 9},
+ { 0, 0, 5, 11}, { 0, 0, 6, 13},
+ { 0, 0, 6, 16}, { 0, 0, 6, 19},
+ { 0, 0, 6, 22}, { 0, 0, 6, 25},
+ { 0, 0, 6, 28}, { 0, 0, 6, 31},
+ { 0, 0, 6, 34}, { 0, 1, 6, 37},
+ { 0, 1, 6, 41}, { 0, 2, 6, 47},
+ { 0, 3, 6, 59}, { 0, 4, 6, 83},
+ { 0, 7, 6, 131}, { 0, 9, 6, 515},
+ { 16, 0, 4, 4}, { 0, 0, 4, 5},
+ { 32, 0, 5, 6}, { 0, 0, 5, 7},
+ { 32, 0, 5, 9}, { 0, 0, 5, 10},
+ { 0, 0, 6, 12}, { 0, 0, 6, 15},
+ { 0, 0, 6, 18}, { 0, 0, 6, 21},
+ { 0, 0, 6, 24}, { 0, 0, 6, 27},
+ { 0, 0, 6, 30}, { 0, 0, 6, 33},
+ { 0, 1, 6, 35}, { 0, 1, 6, 39},
+ { 0, 2, 6, 43}, { 0, 3, 6, 51},
+ { 0, 4, 6, 67}, { 0, 5, 6, 99},
+ { 0, 8, 6, 259}, { 32, 0, 4, 4},
+ { 48, 0, 4, 4}, { 16, 0, 4, 5},
+ { 32, 0, 5, 7}, { 32, 0, 5, 8},
+ { 32, 0, 5, 10}, { 32, 0, 5, 11},
+ { 0, 0, 6, 14}, { 0, 0, 6, 17},
+ { 0, 0, 6, 20}, { 0, 0, 6, 23},
+ { 0, 0, 6, 26}, { 0, 0, 6, 29},
+ { 0, 0, 6, 32}, { 0, 16, 6,65539},
+ { 0, 15, 6,32771}, { 0, 14, 6,16387},
+ { 0, 13, 6, 8195}, { 0, 12, 6, 4099},
+ { 0, 11, 6, 2051}, { 0, 10, 6, 1027},
}; /* ML_defaultDTable */
-/* Default FSE distribution table for Offset Codes */
-static const FSE_decode_t4 OF_defaultDTable[(1<<OF_DEFAULTNORMLOG)+1] = {
- { { OF_DEFAULTNORMLOG, 1, 1 } }, /* header : tableLog, fastMode, fastMode */
- /* base, symbol, bits */
- { { 0, 0, 5 } }, { { 0, 6, 4 } },
- { { 0, 9, 5 } }, { { 0, 15, 5 } },
- { { 0, 21, 5 } }, { { 0, 3, 5 } },
- { { 0, 7, 4 } }, { { 0, 12, 5 } },
- { { 0, 18, 5 } }, { { 0, 23, 5 } },
- { { 0, 5, 5 } }, { { 0, 8, 4 } },
- { { 0, 14, 5 } }, { { 0, 20, 5 } },
- { { 0, 2, 5 } }, { { 16, 7, 4 } },
- { { 0, 11, 5 } }, { { 0, 17, 5 } },
- { { 0, 22, 5 } }, { { 0, 4, 5 } },
- { { 16, 8, 4 } }, { { 0, 13, 5 } },
- { { 0, 19, 5 } }, { { 0, 1, 5 } },
- { { 16, 6, 4 } }, { { 0, 10, 5 } },
- { { 0, 16, 5 } }, { { 0, 28, 5 } },
- { { 0, 27, 5 } }, { { 0, 26, 5 } },
- { { 0, 25, 5 } }, { { 0, 24, 5 } },
-}; /* OF_defaultDTable */
+
+static void ZSTD_buildSeqTable_rle(ZSTD_seqSymbol* dt, U32 baseValue, U32 nbAddBits)
+{
+ void* ptr = dt;
+ ZSTD_seqSymbol_header* const DTableH = (ZSTD_seqSymbol_header*)ptr;
+ ZSTD_seqSymbol* const cell = dt + 1;
+
+ DTableH->tableLog = 0;
+ DTableH->fastMode = 0;
+
+ cell->nbBits = 0;
+ cell->nextState = 0;
+ assert(nbAddBits < 255);
+ cell->nbAdditionalBits = (BYTE)nbAddBits;
+ cell->baseValue = baseValue;
+}
+
+
+/* ZSTD_buildFSETable() :
+ * generate FSE decoding table for one symbol (ll, ml or off) */
+static void
+ZSTD_buildFSETable(ZSTD_seqSymbol* dt,
+ const short* normalizedCounter, unsigned maxSymbolValue,
+ const U32* baseValue, const U32* nbAdditionalBits,
+ unsigned tableLog)
+{
+ ZSTD_seqSymbol* const tableDecode = dt+1;
+ U16 symbolNext[MaxSeq+1];
+
+ U32 const maxSV1 = maxSymbolValue + 1;
+ U32 const tableSize = 1 << tableLog;
+ U32 highThreshold = tableSize-1;
+
+ /* Sanity Checks */
+ assert(maxSymbolValue <= MaxSeq);
+ assert(tableLog <= MaxFSELog);
+
+ /* Init, lay down lowprob symbols */
+ { ZSTD_seqSymbol_header DTableH;
+ DTableH.tableLog = tableLog;
+ DTableH.fastMode = 1;
+ { S16 const largeLimit= (S16)(1 << (tableLog-1));
+ U32 s;
+ for (s=0; s<maxSV1; s++) {
+ if (normalizedCounter[s]==-1) {
+ tableDecode[highThreshold--].baseValue = s;
+ symbolNext[s] = 1;
+ } else {
+ if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
+ symbolNext[s] = normalizedCounter[s];
+ } } }
+ memcpy(dt, &DTableH, sizeof(DTableH));
+ }
+
+ /* Spread symbols */
+ { U32 const tableMask = tableSize-1;
+ U32 const step = FSE_TABLESTEP(tableSize);
+ U32 s, position = 0;
+ for (s=0; s<maxSV1; s++) {
+ int i;
+ for (i=0; i<normalizedCounter[s]; i++) {
+ tableDecode[position].baseValue = s;
+ position = (position + step) & tableMask;
+ while (position > highThreshold) position = (position + step) & tableMask; /* lowprob area */
+ } }
+ assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
+ }
+
+ /* Build Decoding table */
+ { U32 u;
+ for (u=0; u<tableSize; u++) {
+ U32 const symbol = tableDecode[u].baseValue;
+ U32 const nextState = symbolNext[symbol]++;
+ tableDecode[u].nbBits = (BYTE) (tableLog - BIT_highbit32(nextState) );
+ tableDecode[u].nextState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
+ assert(nbAdditionalBits[symbol] < 255);
+ tableDecode[u].nbAdditionalBits = (BYTE)nbAdditionalBits[symbol];
+ tableDecode[u].baseValue = baseValue[symbol];
+ } }
+}
+
/*! ZSTD_buildSeqTable() :
* @return : nb bytes read from src,
- * or an error code if it fails, testable with ZSTD_isError()
- */
-static size_t ZSTD_buildSeqTable(FSE_DTable* DTableSpace, const FSE_DTable** DTablePtr,
+ * or an error code if it fails */
+static size_t ZSTD_buildSeqTable(ZSTD_seqSymbol* DTableSpace, const ZSTD_seqSymbol** DTablePtr,
symbolEncodingType_e type, U32 max, U32 maxLog,
const void* src, size_t srcSize,
- const FSE_decode_t4* defaultTable, U32 flagRepeatTable)
+ const U32* baseValue, const U32* nbAdditionalBits,
+ const ZSTD_seqSymbol* defaultTable, U32 flagRepeatTable)
{
- const void* const tmpPtr = defaultTable; /* bypass strict aliasing */
switch(type)
{
case set_rle :
if (!srcSize) return ERROR(srcSize_wrong);
if ( (*(const BYTE*)src) > max) return ERROR(corruption_detected);
- FSE_buildDTable_rle(DTableSpace, *(const BYTE*)src);
+ { U32 const symbol = *(const BYTE*)src;
+ U32 const baseline = baseValue[symbol];
+ U32 const nbBits = nbAdditionalBits[symbol];
+ ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits);
+ }
*DTablePtr = DTableSpace;
return 1;
case set_basic :
- *DTablePtr = (const FSE_DTable*)tmpPtr;
+ *DTablePtr = defaultTable;
return 0;
case set_repeat:
if (!flagRepeatTable) return ERROR(corruption_detected);
return 0;
- default : /* impossible */
case set_compressed :
{ U32 tableLog;
S16 norm[MaxSeq+1];
size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize);
if (FSE_isError(headerSize)) return ERROR(corruption_detected);
if (tableLog > maxLog) return ERROR(corruption_detected);
- FSE_buildDTable(DTableSpace, norm, max, tableLog);
+ ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog);
*DTablePtr = DTableSpace;
return headerSize;
- } }
+ }
+ default : /* impossible */
+ assert(0);
+ return ERROR(GENERIC);
+ }
}
+static const U32 LL_base[MaxLL+1] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 18, 20, 22, 24, 28, 32, 40,
+ 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000,
+ 0x2000, 0x4000, 0x8000, 0x10000 };
+
+static const U32 OF_base[MaxOff+1] = {
+ 0, 1, 1, 5, 0xD, 0x1D, 0x3D, 0x7D,
+ 0xFD, 0x1FD, 0x3FD, 0x7FD, 0xFFD, 0x1FFD, 0x3FFD, 0x7FFD,
+ 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD,
+ 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD };
+
+static const U32 OF_bits[MaxOff+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 };
+
+static const U32 ML_base[MaxML+1] = {
+ 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, 37, 39, 41, 43, 47, 51, 59,
+ 67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803,
+ 0x1003, 0x2003, 0x4003, 0x8003, 0x10003 };
+
+
size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr,
const void* src, size_t srcSize)
{
@@ -792,19 +970,27 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr,
/* Build DTables */
{ size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr,
LLtype, MaxLL, LLFSELog,
- ip, iend-ip, LL_defaultDTable, dctx->fseEntropy);
+ ip, iend-ip,
+ LL_base, LL_bits,
+ LL_defaultDTable, dctx->fseEntropy);
if (ZSTD_isError(llhSize)) return ERROR(corruption_detected);
ip += llhSize;
}
+
{ size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr,
OFtype, MaxOff, OffFSELog,
- ip, iend-ip, OF_defaultDTable, dctx->fseEntropy);
+ ip, iend-ip,
+ OF_base, OF_bits,
+ OF_defaultDTable, dctx->fseEntropy);
if (ZSTD_isError(ofhSize)) return ERROR(corruption_detected);
ip += ofhSize;
}
+
{ size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr,
MLtype, MaxML, MLFSELog,
- ip, iend-ip, ML_defaultDTable, dctx->fseEntropy);
+ ip, iend-ip,
+ ML_base, ML_bits,
+ ML_defaultDTable, dctx->fseEntropy);
if (ZSTD_isError(mlhSize)) return ERROR(corruption_detected);
ip += mlhSize;
}
@@ -822,10 +1008,15 @@ typedef struct {
} seq_t;
typedef struct {
+ size_t state;
+ const ZSTD_seqSymbol* table;
+} ZSTD_fseState;
+
+typedef struct {
BIT_DStream_t DStream;
- FSE_DState_t stateLL;
- FSE_DState_t stateOffb;
- FSE_DState_t stateML;
+ ZSTD_fseState stateLL;
+ ZSTD_fseState stateOffb;
+ ZSTD_fseState stateML;
size_t prevOffset[ZSTD_REP_NUM];
const BYTE* prefixStart;
const BYTE* dictEnd;
@@ -880,118 +1071,6 @@ size_t ZSTD_execSequenceLast7(BYTE* op,
}
-typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e;
-
-/* We need to add at most (ZSTD_WINDOWLOG_MAX_32 - 1) bits to read the maximum
- * offset bits. But we can only read at most (STREAM_ACCUMULATOR_MIN_32 - 1)
- * bits before reloading. This value is the maximum number of bytes we read
- * after reloading when we are decoding long offets.
- */
-#define LONG_OFFSETS_MAX_EXTRA_BITS_32 \
- (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32 \
- ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32 \
- : 0)
-
-static seq_t ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
-{
- seq_t seq;
-
- U32 const llCode = FSE_peekSymbol(&seqState->stateLL);
- U32 const mlCode = FSE_peekSymbol(&seqState->stateML);
- U32 const ofCode = FSE_peekSymbol(&seqState->stateOffb); /* <= MaxOff, by table construction */
-
- U32 const llBits = LL_bits[llCode];
- U32 const mlBits = ML_bits[mlCode];
- U32 const ofBits = ofCode;
- U32 const totalBits = llBits+mlBits+ofBits;
-
- static const U32 LL_base[MaxLL+1] = {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 18, 20, 22, 24, 28, 32, 40,
- 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000,
- 0x2000, 0x4000, 0x8000, 0x10000 };
-
- static const U32 ML_base[MaxML+1] = {
- 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, 37, 39, 41, 43, 47, 51, 59,
- 67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803,
- 0x1003, 0x2003, 0x4003, 0x8003, 0x10003 };
-
- static const U32 OF_base[MaxOff+1] = {
- 0, 1, 1, 5, 0xD, 0x1D, 0x3D, 0x7D,
- 0xFD, 0x1FD, 0x3FD, 0x7FD, 0xFFD, 0x1FFD, 0x3FFD, 0x7FFD,
- 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD,
- 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD };
-
- /* sequence */
- { size_t offset;
- if (!ofCode)
- offset = 0;
- else {
- ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
- ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
- assert(ofBits <= MaxOff);
- if (MEM_32bits() && longOffsets) {
- U32 const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN_32-1);
- offset = OF_base[ofCode] + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
- if (MEM_32bits() || extraBits) BIT_reloadDStream(&seqState->DStream);
- if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits);
- } else {
- offset = OF_base[ofCode] + BIT_readBitsFast(&seqState->DStream, ofBits); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */
- if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
- }
- }
-
- if (ofCode <= 1) {
- offset += (llCode==0);
- if (offset) {
- size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
- temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */
- if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
- seqState->prevOffset[1] = seqState->prevOffset[0];
- seqState->prevOffset[0] = offset = temp;
- } else {
- offset = seqState->prevOffset[0];
- }
- } else {
- seqState->prevOffset[2] = seqState->prevOffset[1];
- seqState->prevOffset[1] = seqState->prevOffset[0];
- seqState->prevOffset[0] = offset;
- }
- seq.offset = offset;
- }
-
- seq.matchLength = ML_base[mlCode]
- + ((mlCode>31) ? BIT_readBitsFast(&seqState->DStream, mlBits) : 0); /* <= 16 bits */
- if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
- BIT_reloadDStream(&seqState->DStream);
- if (MEM_64bits() && (totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
- BIT_reloadDStream(&seqState->DStream);
- /* Verify that there is enough bits to read the rest of the data in 64-bit mode. */
- ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
-
- seq.litLength = LL_base[llCode]
- + ((llCode>15) ? BIT_readBitsFast(&seqState->DStream, llBits) : 0); /* <= 16 bits */
- if (MEM_32bits())
- BIT_reloadDStream(&seqState->DStream);
-
- DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
- (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
-
- /* ANS state update */
- FSE_updateState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */
- FSE_updateState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */
- if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */
- FSE_updateState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */
-
- return seq;
-}
-
-
HINT_INLINE
size_t ZSTD_execSequence(BYTE* op,
BYTE* const oend, seq_t sequence,
@@ -1073,10 +1152,199 @@ size_t ZSTD_execSequence(BYTE* op,
}
-static size_t ZSTD_decompressSequences(
- ZSTD_DCtx* dctx,
+HINT_INLINE
+size_t ZSTD_execSequenceLong(BYTE* op,
+ BYTE* const oend, seq_t sequence,
+ const BYTE** litPtr, const BYTE* const litLimit,
+ const BYTE* const prefixStart, const BYTE* const dictStart, const BYTE* const dictEnd)
+{
+ BYTE* const oLitEnd = op + sequence.litLength;
+ size_t const sequenceLength = sequence.litLength + sequence.matchLength;
+ BYTE* const oMatchEnd = op + sequenceLength; /* risk : address space overflow (32-bits) */
+ BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
+ const BYTE* const iLitEnd = *litPtr + sequence.litLength;
+ const BYTE* match = sequence.match;
+
+ /* check */
+ if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of WILDCOPY_OVERLENGTH from oend */
+ if (iLitEnd > litLimit) return ERROR(corruption_detected); /* over-read beyond lit buffer */
+ if (oLitEnd > oend_w) return ZSTD_execSequenceLast7(op, oend, sequence, litPtr, litLimit, prefixStart, dictStart, dictEnd);
+
+ /* copy Literals */
+ ZSTD_copy8(op, *litPtr); /* note : op <= oLitEnd <= oend_w == oend - 8 */
+ if (sequence.litLength > 8)
+ ZSTD_wildcopy(op+8, (*litPtr)+8, sequence.litLength - 8); /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
+ op = oLitEnd;
+ *litPtr = iLitEnd; /* update for next sequence */
+
+ /* copy Match */
+ if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
+ /* offset beyond prefix */
+ if (sequence.offset > (size_t)(oLitEnd - dictStart)) return ERROR(corruption_detected);
+ if (match + sequence.matchLength <= dictEnd) {
+ memmove(oLitEnd, match, sequence.matchLength);
+ return sequenceLength;
+ }
+ /* span extDict & currentPrefixSegment */
+ { size_t const length1 = dictEnd - match;
+ memmove(oLitEnd, match, length1);
+ op = oLitEnd + length1;
+ sequence.matchLength -= length1;
+ match = prefixStart;
+ if (op > oend_w || sequence.matchLength < MINMATCH) {
+ U32 i;
+ for (i = 0; i < sequence.matchLength; ++i) op[i] = match[i];
+ return sequenceLength;
+ }
+ } }
+ assert(op <= oend_w);
+ assert(sequence.matchLength >= MINMATCH);
+
+ /* match within prefix */
+ if (sequence.offset < 8) {
+ /* close range match, overlap */
+ static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 }; /* added */
+ static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 }; /* subtracted */
+ int const sub2 = dec64table[sequence.offset];
+ op[0] = match[0];
+ op[1] = match[1];
+ op[2] = match[2];
+ op[3] = match[3];
+ match += dec32table[sequence.offset];
+ ZSTD_copy4(op+4, match);
+ match -= sub2;
+ } else {
+ ZSTD_copy8(op, match);
+ }
+ op += 8; match += 8;
+
+ if (oMatchEnd > oend-(16-MINMATCH)) {
+ if (op < oend_w) {
+ ZSTD_wildcopy(op, match, oend_w - op);
+ match += oend_w - op;
+ op = oend_w;
+ }
+ while (op < oMatchEnd) *op++ = *match++;
+ } else {
+ ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8); /* works even if matchLength < 8 */
+ }
+ return sequenceLength;
+}
+
+static void
+ZSTD_initFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, const ZSTD_seqSymbol* dt)
+{
+ const void* ptr = dt;
+ const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr;
+ DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
+ DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits",
+ (U32)DStatePtr->state, DTableH->tableLog);
+ BIT_reloadDStream(bitD);
+ DStatePtr->table = dt + 1;
+}
+
+FORCE_INLINE_TEMPLATE void
+ZSTD_updateFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD)
+{
+ ZSTD_seqSymbol const DInfo = DStatePtr->table[DStatePtr->state];
+ U32 const nbBits = DInfo.nbBits;
+ size_t const lowBits = BIT_readBits(bitD, nbBits);
+ DStatePtr->state = DInfo.nextState + lowBits;
+}
+
+/* We need to add at most (ZSTD_WINDOWLOG_MAX_32 - 1) bits to read the maximum
+ * offset bits. But we can only read at most (STREAM_ACCUMULATOR_MIN_32 - 1)
+ * bits before reloading. This value is the maximum number of bytes we read
+ * after reloading when we are decoding long offets.
+ */
+#define LONG_OFFSETS_MAX_EXTRA_BITS_32 \
+ (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32 \
+ ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32 \
+ : 0)
+
+typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e;
+
+FORCE_INLINE_TEMPLATE seq_t
+ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
+{
+ seq_t seq;
+ U32 const llBits = seqState->stateLL.table[seqState->stateLL.state].nbAdditionalBits;
+ U32 const mlBits = seqState->stateML.table[seqState->stateML.state].nbAdditionalBits;
+ U32 const ofBits = seqState->stateOffb.table[seqState->stateOffb.state].nbAdditionalBits;
+ U32 const totalBits = llBits+mlBits+ofBits;
+ U32 const llBase = seqState->stateLL.table[seqState->stateLL.state].baseValue;
+ U32 const mlBase = seqState->stateML.table[seqState->stateML.state].baseValue;
+ U32 const ofBase = seqState->stateOffb.table[seqState->stateOffb.state].baseValue;
+
+ /* sequence */
+ { size_t offset;
+ if (!ofBits)
+ offset = 0;
+ else {
+ ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
+ ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
+ assert(ofBits <= MaxOff);
+ if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) {
+ U32 const extraBits = ofBits - MIN(ofBits, 32 - seqState->DStream.bitsConsumed);
+ offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
+ BIT_reloadDStream(&seqState->DStream);
+ if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits);
+ assert(extraBits <= LONG_OFFSETS_MAX_EXTRA_BITS_32); /* to avoid another reload */
+ } else {
+ offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */
+ if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
+ }
+ }
+
+ if (ofBits <= 1) {
+ offset += (llBase==0);
+ if (offset) {
+ size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
+ temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */
+ if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
+ seqState->prevOffset[1] = seqState->prevOffset[0];
+ seqState->prevOffset[0] = offset = temp;
+ } else { /* offset == 0 */
+ offset = seqState->prevOffset[0];
+ }
+ } else {
+ seqState->prevOffset[2] = seqState->prevOffset[1];
+ seqState->prevOffset[1] = seqState->prevOffset[0];
+ seqState->prevOffset[0] = offset;
+ }
+ seq.offset = offset;
+ }
+
+ seq.matchLength = mlBase
+ + ((mlBits>0) ? BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/) : 0); /* <= 16 bits */
+ if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
+ BIT_reloadDStream(&seqState->DStream);
+ if (MEM_64bits() && (totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
+ BIT_reloadDStream(&seqState->DStream);
+ /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
+ ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
+
+ seq.litLength = llBase
+ + ((llBits>0) ? BIT_readBitsFast(&seqState->DStream, llBits/*>0*/) : 0); /* <= 16 bits */
+ if (MEM_32bits())
+ BIT_reloadDStream(&seqState->DStream);
+
+ DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
+ (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
+
+ /* ANS state update */
+ ZSTD_updateFseState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */
+ ZSTD_updateFseState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */
+ if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */
+ ZSTD_updateFseState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */
+
+ return seq;
+}
+
+FORCE_INLINE_TEMPLATE size_t
+ZSTD_decompressSequences_body( ZSTD_DCtx* dctx,
void* dst, size_t maxDstSize,
- const void* seqStart, size_t seqSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
const ZSTD_longOffset_e isLongOffset)
{
const BYTE* ip = (const BYTE*)seqStart;
@@ -1089,26 +1357,17 @@ static size_t ZSTD_decompressSequences(
const BYTE* const base = (const BYTE*) (dctx->base);
const BYTE* const vBase = (const BYTE*) (dctx->vBase);
const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
- int nbSeq;
DEBUGLOG(5, "ZSTD_decompressSequences");
- /* Build Decoding Tables */
- { size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, seqSize);
- DEBUGLOG(5, "ZSTD_decodeSeqHeaders: size=%u, nbSeq=%i",
- (U32)seqHSize, nbSeq);
- if (ZSTD_isError(seqHSize)) return seqHSize;
- ip += seqHSize;
- }
-
/* Regen sequences */
if (nbSeq) {
seqState_t seqState;
dctx->fseEntropy = 1;
{ U32 i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
CHECK_E(BIT_initDStream(&seqState.DStream, ip, iend-ip), corruption_detected);
- FSE_initDState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
- FSE_initDState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
- FSE_initDState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
+ ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
+ ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
+ ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
for ( ; (BIT_reloadDStream(&(seqState.DStream)) <= BIT_DStream_completed) && nbSeq ; ) {
nbSeq--;
@@ -1120,7 +1379,7 @@ static size_t ZSTD_decompressSequences(
} }
/* check if reached exact end */
- DEBUGLOG(5, "after decode loop, remaining nbSeq : %i", nbSeq);
+ DEBUGLOG(5, "ZSTD_decompressSequences: after decode loop, remaining nbSeq : %i", nbSeq);
if (nbSeq) return ERROR(corruption_detected);
/* save reps for next block */
{ U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
@@ -1136,46 +1395,32 @@ static size_t ZSTD_decompressSequences(
return op-ostart;
}
-
-HINT_INLINE
-seq_t ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const longOffsets)
+static size_t
+ZSTD_decompressSequences_default(ZSTD_DCtx* dctx,
+ void* dst, size_t maxDstSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset)
{
- seq_t seq;
+ return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+}
- U32 const llCode = FSE_peekSymbol(&seqState->stateLL);
- U32 const mlCode = FSE_peekSymbol(&seqState->stateML);
- U32 const ofCode = FSE_peekSymbol(&seqState->stateOffb); /* <= MaxOff, by table construction */
- U32 const llBits = LL_bits[llCode];
- U32 const mlBits = ML_bits[mlCode];
- U32 const ofBits = ofCode;
- U32 const totalBits = llBits+mlBits+ofBits;
- static const U32 LL_base[MaxLL+1] = {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 18, 20, 22, 24, 28, 32, 40,
- 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000,
- 0x2000, 0x4000, 0x8000, 0x10000 };
-
- static const U32 ML_base[MaxML+1] = {
- 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, 37, 39, 41, 43, 47, 51, 59,
- 67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803,
- 0x1003, 0x2003, 0x4003, 0x8003, 0x10003 };
-
- static const U32 OF_base[MaxOff+1] = {
- 0, 1, 1, 5, 0xD, 0x1D, 0x3D, 0x7D,
- 0xFD, 0x1FD, 0x3FD, 0x7FD, 0xFFD, 0x1FFD, 0x3FFD, 0x7FFD,
- 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD,
- 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD };
+FORCE_INLINE_TEMPLATE seq_t
+ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const longOffsets)
+{
+ seq_t seq;
+ U32 const llBits = seqState->stateLL.table[seqState->stateLL.state].nbAdditionalBits;
+ U32 const mlBits = seqState->stateML.table[seqState->stateML.state].nbAdditionalBits;
+ U32 const ofBits = seqState->stateOffb.table[seqState->stateOffb.state].nbAdditionalBits;
+ U32 const totalBits = llBits+mlBits+ofBits;
+ U32 const llBase = seqState->stateLL.table[seqState->stateLL.state].baseValue;
+ U32 const mlBase = seqState->stateML.table[seqState->stateML.state].baseValue;
+ U32 const ofBase = seqState->stateOffb.table[seqState->stateOffb.state].baseValue;
/* sequence */
{ size_t offset;
- if (!ofCode)
+ if (!ofBits)
offset = 0;
else {
ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
@@ -1183,17 +1428,17 @@ seq_t ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const long
assert(ofBits <= MaxOff);
if (MEM_32bits() && longOffsets) {
U32 const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN_32-1);
- offset = OF_base[ofCode] + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
+ offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
if (MEM_32bits() || extraBits) BIT_reloadDStream(&seqState->DStream);
if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits);
} else {
- offset = OF_base[ofCode] + BIT_readBitsFast(&seqState->DStream, ofBits); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */
+ offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */
if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
}
}
- if (ofCode <= 1) {
- offset += (llCode==0);
+ if (ofBits <= 1) {
+ offset += (llBase==0);
if (offset) {
size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */
@@ -1211,7 +1456,7 @@ seq_t ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const long
seq.offset = offset;
}
- seq.matchLength = ML_base[mlCode] + ((mlCode>31) ? BIT_readBitsFast(&seqState->DStream, mlBits) : 0); /* <= 16 bits */
+ seq.matchLength = mlBase + ((mlBits>0) ? BIT_readBitsFast(&seqState->DStream, mlBits) : 0); /* <= 16 bits */
if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
BIT_reloadDStream(&seqState->DStream);
if (MEM_64bits() && (totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
@@ -1219,7 +1464,7 @@ seq_t ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const long
/* Verify that there is enough bits to read the rest of the data in 64-bit mode. */
ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
- seq.litLength = LL_base[llCode] + ((llCode>15) ? BIT_readBitsFast(&seqState->DStream, llBits) : 0); /* <= 16 bits */
+ seq.litLength = llBase + ((llBits>0) ? BIT_readBitsFast(&seqState->DStream, llBits) : 0); /* <= 16 bits */
if (MEM_32bits())
BIT_reloadDStream(&seqState->DStream);
@@ -1231,98 +1476,19 @@ seq_t ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const long
}
/* ANS state update */
- FSE_updateState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */
- FSE_updateState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */
+ ZSTD_updateFseState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */
+ ZSTD_updateFseState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */
if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */
- FSE_updateState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */
+ ZSTD_updateFseState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */
return seq;
}
-
-HINT_INLINE
-size_t ZSTD_execSequenceLong(BYTE* op,
- BYTE* const oend, seq_t sequence,
- const BYTE** litPtr, const BYTE* const litLimit,
- const BYTE* const prefixStart, const BYTE* const dictStart, const BYTE* const dictEnd)
-{
- BYTE* const oLitEnd = op + sequence.litLength;
- size_t const sequenceLength = sequence.litLength + sequence.matchLength;
- BYTE* const oMatchEnd = op + sequenceLength; /* risk : address space overflow (32-bits) */
- BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
- const BYTE* const iLitEnd = *litPtr + sequence.litLength;
- const BYTE* match = sequence.match;
-
- /* check */
- if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of WILDCOPY_OVERLENGTH from oend */
- if (iLitEnd > litLimit) return ERROR(corruption_detected); /* over-read beyond lit buffer */
- if (oLitEnd > oend_w) return ZSTD_execSequenceLast7(op, oend, sequence, litPtr, litLimit, prefixStart, dictStart, dictEnd);
-
- /* copy Literals */
- ZSTD_copy8(op, *litPtr); /* note : op <= oLitEnd <= oend_w == oend - 8 */
- if (sequence.litLength > 8)
- ZSTD_wildcopy(op+8, (*litPtr)+8, sequence.litLength - 8); /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
- op = oLitEnd;
- *litPtr = iLitEnd; /* update for next sequence */
-
- /* copy Match */
- if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
- /* offset beyond prefix */
- if (sequence.offset > (size_t)(oLitEnd - dictStart)) return ERROR(corruption_detected);
- if (match + sequence.matchLength <= dictEnd) {
- memmove(oLitEnd, match, sequence.matchLength);
- return sequenceLength;
- }
- /* span extDict & currentPrefixSegment */
- { size_t const length1 = dictEnd - match;
- memmove(oLitEnd, match, length1);
- op = oLitEnd + length1;
- sequence.matchLength -= length1;
- match = prefixStart;
- if (op > oend_w || sequence.matchLength < MINMATCH) {
- U32 i;
- for (i = 0; i < sequence.matchLength; ++i) op[i] = match[i];
- return sequenceLength;
- }
- } }
- assert(op <= oend_w);
- assert(sequence.matchLength >= MINMATCH);
-
- /* match within prefix */
- if (sequence.offset < 8) {
- /* close range match, overlap */
- static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 }; /* added */
- static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 }; /* subtracted */
- int const sub2 = dec64table[sequence.offset];
- op[0] = match[0];
- op[1] = match[1];
- op[2] = match[2];
- op[3] = match[3];
- match += dec32table[sequence.offset];
- ZSTD_copy4(op+4, match);
- match -= sub2;
- } else {
- ZSTD_copy8(op, match);
- }
- op += 8; match += 8;
-
- if (oMatchEnd > oend-(16-MINMATCH)) {
- if (op < oend_w) {
- ZSTD_wildcopy(op, match, oend_w - op);
- match += oend_w - op;
- op = oend_w;
- }
- while (op < oMatchEnd) *op++ = *match++;
- } else {
- ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8); /* works even if matchLength < 8 */
- }
- return sequenceLength;
-}
-
-static size_t ZSTD_decompressSequencesLong(
+FORCE_INLINE_TEMPLATE size_t
+ZSTD_decompressSequencesLong_body(
ZSTD_DCtx* dctx,
void* dst, size_t maxDstSize,
- const void* seqStart, size_t seqSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
const ZSTD_longOffset_e isLongOffset)
{
const BYTE* ip = (const BYTE*)seqStart;
@@ -1335,13 +1501,6 @@ static size_t ZSTD_decompressSequencesLong(
const BYTE* const prefixStart = (const BYTE*) (dctx->base);
const BYTE* const dictStart = (const BYTE*) (dctx->vBase);
const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
- int nbSeq;
-
- /* Build Decoding Tables */
- { size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, seqSize);
- if (ZSTD_isError(seqHSize)) return seqHSize;
- ip += seqHSize;
- }
/* Regen sequences */
if (nbSeq) {
@@ -1358,18 +1517,18 @@ static size_t ZSTD_decompressSequencesLong(
seqState.pos = (size_t)(op-prefixStart);
seqState.dictEnd = dictEnd;
CHECK_E(BIT_initDStream(&seqState.DStream, ip, iend-ip), corruption_detected);
- FSE_initDState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
- FSE_initDState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
- FSE_initDState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
+ ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
+ ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
+ ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
/* prepare in advance */
- for (seqNb=0; (BIT_reloadDStream(&seqState.DStream) <= BIT_DStream_completed) && seqNb<seqAdvance; seqNb++) {
+ for (seqNb=0; (BIT_reloadDStream(&seqState.DStream) <= BIT_DStream_completed) && (seqNb<seqAdvance); seqNb++) {
sequences[seqNb] = ZSTD_decodeSequenceLong(&seqState, isLongOffset);
}
if (seqNb<seqAdvance) return ERROR(corruption_detected);
/* decode and decompress */
- for ( ; (BIT_reloadDStream(&(seqState.DStream)) <= BIT_DStream_completed) && seqNb<nbSeq ; seqNb++) {
+ for ( ; (BIT_reloadDStream(&(seqState.DStream)) <= BIT_DStream_completed) && (seqNb<nbSeq) ; seqNb++) {
seq_t const sequence = ZSTD_decodeSequenceLong(&seqState, isLongOffset);
size_t const oneSeqSize = ZSTD_execSequenceLong(op, oend, sequences[(seqNb-ADVANCED_SEQS) & STOSEQ_MASK], &litPtr, litEnd, prefixStart, dictStart, dictEnd);
if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
@@ -1389,6 +1548,9 @@ static size_t ZSTD_decompressSequencesLong(
/* save reps for next block */
{ U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
+#undef STORED_SEQS
+#undef STOSEQ_MASK
+#undef ADVANCED_SEQS
}
/* last literal segment */
@@ -1401,6 +1563,96 @@ static size_t ZSTD_decompressSequencesLong(
return op-ostart;
}
+static size_t
+ZSTD_decompressSequencesLong_default(ZSTD_DCtx* dctx,
+ void* dst, size_t maxDstSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset)
+{
+ return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+}
+
+
+
+#if DYNAMIC_BMI2
+
+static TARGET_ATTRIBUTE("bmi2") size_t
+ZSTD_decompressSequences_bmi2(ZSTD_DCtx* dctx,
+ void* dst, size_t maxDstSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset)
+{
+ return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+}
+
+static TARGET_ATTRIBUTE("bmi2") size_t
+ZSTD_decompressSequencesLong_bmi2(ZSTD_DCtx* dctx,
+ void* dst, size_t maxDstSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset)
+{
+ return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+}
+
+#endif
+
+typedef size_t (*ZSTD_decompressSequences_t)(
+ ZSTD_DCtx *dctx, void *dst, size_t maxDstSize,
+ const void *seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset);
+
+static size_t ZSTD_decompressSequences(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset)
+{
+ DEBUGLOG(5, "ZSTD_decompressSequences");
+#if DYNAMIC_BMI2
+ if (dctx->bmi2) {
+ return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+ }
+#endif
+ return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+}
+
+static size_t ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx,
+ void* dst, size_t maxDstSize,
+ const void* seqStart, size_t seqSize, int nbSeq,
+ const ZSTD_longOffset_e isLongOffset)
+{
+ DEBUGLOG(5, "ZSTD_decompressSequencesLong");
+#if DYNAMIC_BMI2
+ if (dctx->bmi2) {
+ return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+ }
+#endif
+ return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
+}
+
+/* ZSTD_getLongOffsetsShare() :
+ * condition : offTable must be valid
+ * @return : "share" of long offsets (arbitrarily defined as > (1<<23))
+ * compared to maximum possible of (1<<OffFSELog) */
+static unsigned
+ZSTD_getLongOffsetsShare(const ZSTD_seqSymbol* offTable)
+{
+ const void* ptr = offTable;
+ U32 const tableLog = ((const ZSTD_seqSymbol_header*)ptr)[0].tableLog;
+ const ZSTD_seqSymbol* table = offTable + 1;
+ U32 const max = 1 << tableLog;
+ U32 u, total = 0;
+ DEBUGLOG(5, "ZSTD_getLongOffsetsShare: (tableLog=%u)", tableLog);
+
+ assert(max <= (1 << OffFSELog)); /* max not too large */
+ for (u=0; u<max; u++) {
+ if (table[u].nbAdditionalBits > 22) total += 1;
+ }
+
+ assert(tableLog <= OffFSELog);
+ total <<= (OffFSELog - tableLog); /* scale to OffFSELog */
+
+ return total;
+}
+
static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
void* dst, size_t dstCapacity,
@@ -1410,13 +1662,9 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
/* isLongOffset must be true if there are long offsets.
* Offsets are long if they are larger than 2^STREAM_ACCUMULATOR_MIN.
* We don't expect that to be the case in 64-bit mode.
- * If we are in block mode we don't know the window size, so we have to be
- * conservative.
+ * In block mode, window size is not known, so we have to be conservative. (note: but it could be evaluated from current-lowLimit)
*/
ZSTD_longOffset_e const isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (!frame || dctx->fParams.windowSize > (1ULL << STREAM_ACCUMULATOR_MIN)));
- /* windowSize could be any value at this point, since it is only validated
- * in the streaming API.
- */
DEBUGLOG(5, "ZSTD_decompressBlock_internal (size : %u)", (U32)srcSize);
if (srcSize >= ZSTD_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);
@@ -1428,9 +1676,24 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
ip += litCSize;
srcSize -= litCSize;
}
- if (frame && dctx->fParams.windowSize > (1<<23))
- return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, isLongOffset);
- return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, isLongOffset);
+
+ /* Build Decoding Tables */
+ { int nbSeq;
+ size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
+ if (ZSTD_isError(seqHSize)) return seqHSize;
+ ip += seqHSize;
+ srcSize -= seqHSize;
+
+ if ( (!frame || dctx->fParams.windowSize > (1<<24))
+ && (nbSeq>0) ) { /* could probably use a larger nbSeq limit */
+ U32 const shareLongOffsets = ZSTD_getLongOffsetsShare(dctx->OFTptr);
+ U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
+ if (shareLongOffsets >= minShare)
+ return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
+ }
+
+ return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
+ }
}
@@ -1758,7 +2021,7 @@ static int ZSTD_isSkipFrame(ZSTD_DCtx* dctx) { return dctx->stage == ZSTDds_skip
* or an error code, which can be tested using ZSTD_isError() */
size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize)
{
- DEBUGLOG(5, "ZSTD_decompressContinue");
+ DEBUGLOG(5, "ZSTD_decompressContinue (srcSize:%u)", (U32)srcSize);
/* Sanity check */
if (srcSize != dctx->expected) return ERROR(srcSize_wrong); /* not allowed */
if (dstCapacity) ZSTD_checkContinuity(dctx, dst);
@@ -1819,12 +2082,12 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c
case ZSTDds_decompressLastBlock:
case ZSTDds_decompressBlock:
- DEBUGLOG(5, "case ZSTDds_decompressBlock");
+ DEBUGLOG(5, "ZSTD_decompressContinue: case ZSTDds_decompressBlock");
{ size_t rSize;
switch(dctx->bType)
{
case bt_compressed:
- DEBUGLOG(5, "case bt_compressed");
+ DEBUGLOG(5, "ZSTD_decompressContinue: case bt_compressed");
rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 1);
break;
case bt_raw :
@@ -1838,12 +2101,12 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c
return ERROR(corruption_detected);
}
if (ZSTD_isError(rSize)) return rSize;
- DEBUGLOG(5, "decoded size from block : %u", (U32)rSize);
+ DEBUGLOG(5, "ZSTD_decompressContinue: decoded size from block : %u", (U32)rSize);
dctx->decodedSize += rSize;
if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, dst, rSize);
if (dctx->stage == ZSTDds_decompressLastBlock) { /* end of frame */
- DEBUGLOG(4, "decoded size from frame : %u", (U32)dctx->decodedSize);
+ DEBUGLOG(4, "ZSTD_decompressContinue: decoded size from frame : %u", (U32)dctx->decodedSize);
if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) {
if (dctx->decodedSize != dctx->fParams.frameContentSize) {
return ERROR(corruption_detected);
@@ -1867,7 +2130,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c
assert(srcSize == 4); /* guaranteed by dctx->expected */
{ U32 const h32 = (U32)XXH64_digest(&dctx->xxhState);
U32 const check32 = MEM_readLE32(src);
- DEBUGLOG(4, "checksum : calculated %08X :: %08X read", h32, check32);
+ DEBUGLOG(4, "ZSTD_decompressContinue: checksum : calculated %08X :: %08X read", h32, check32);
if (check32 != h32) return ERROR(checksum_wrong);
dctx->expected = 0;
dctx->stage = ZSTDds_getFrameHeaderSize;
@@ -1925,8 +2188,12 @@ static size_t ZSTD_loadEntropy(ZSTD_entropyDTables_t* entropy, const void* const
U32 offcodeMaxValue = MaxOff, offcodeLog;
size_t const offcodeHeaderSize = FSE_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dictPtr, dictEnd-dictPtr);
if (FSE_isError(offcodeHeaderSize)) return ERROR(dictionary_corrupted);
+ if (offcodeMaxValue > MaxOff) return ERROR(dictionary_corrupted);
if (offcodeLog > OffFSELog) return ERROR(dictionary_corrupted);
- CHECK_E(FSE_buildDTable(entropy->OFTable, offcodeNCount, offcodeMaxValue, offcodeLog), dictionary_corrupted);
+ ZSTD_buildFSETable(entropy->OFTable,
+ offcodeNCount, offcodeMaxValue,
+ OF_base, OF_bits,
+ offcodeLog);
dictPtr += offcodeHeaderSize;
}
@@ -1934,8 +2201,12 @@ static size_t ZSTD_loadEntropy(ZSTD_entropyDTables_t* entropy, const void* const
unsigned matchlengthMaxValue = MaxML, matchlengthLog;
size_t const matchlengthHeaderSize = FSE_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dictPtr, dictEnd-dictPtr);
if (FSE_isError(matchlengthHeaderSize)) return ERROR(dictionary_corrupted);
+ if (matchlengthMaxValue > MaxML) return ERROR(dictionary_corrupted);
if (matchlengthLog > MLFSELog) return ERROR(dictionary_corrupted);
- CHECK_E(FSE_buildDTable(entropy->MLTable, matchlengthNCount, matchlengthMaxValue, matchlengthLog), dictionary_corrupted);
+ ZSTD_buildFSETable(entropy->MLTable,
+ matchlengthNCount, matchlengthMaxValue,
+ ML_base, ML_bits,
+ matchlengthLog);
dictPtr += matchlengthHeaderSize;
}
@@ -1943,8 +2214,12 @@ static size_t ZSTD_loadEntropy(ZSTD_entropyDTables_t* entropy, const void* const
unsigned litlengthMaxValue = MaxLL, litlengthLog;
size_t const litlengthHeaderSize = FSE_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dictPtr, dictEnd-dictPtr);
if (FSE_isError(litlengthHeaderSize)) return ERROR(dictionary_corrupted);
+ if (litlengthMaxValue > MaxLL) return ERROR(dictionary_corrupted);
if (litlengthLog > LLFSELog) return ERROR(dictionary_corrupted);
- CHECK_E(FSE_buildDTable(entropy->LLTable, litlengthNCount, litlengthMaxValue, litlengthLog), dictionary_corrupted);
+ ZSTD_buildFSETable(entropy->LLTable,
+ litlengthNCount, litlengthMaxValue,
+ LL_base, LL_bits,
+ litlengthLog);
dictPtr += litlengthHeaderSize;
}
@@ -2062,13 +2337,23 @@ size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dstDCtx, const ZSTD_DDict* ddi
return 0;
}
-static size_t ZSTD_loadEntropy_inDDict(ZSTD_DDict* ddict)
+static size_t ZSTD_loadEntropy_inDDict(ZSTD_DDict* ddict, ZSTD_dictContentType_e dictContentType)
{
ddict->dictID = 0;
ddict->entropyPresent = 0;
- if (ddict->dictSize < 8) return 0;
+ if (dictContentType == ZSTD_dct_rawContent) return 0;
+
+ if (ddict->dictSize < 8) {
+ if (dictContentType == ZSTD_dct_fullDict)
+ return ERROR(dictionary_corrupted); /* only accept specified dictionaries */
+ return 0; /* pure content mode */
+ }
{ U32 const magic = MEM_readLE32(ddict->dictContent);
- if (magic != ZSTD_MAGIC_DICTIONARY) return 0; /* pure content mode */
+ if (magic != ZSTD_MAGIC_DICTIONARY) {
+ if (dictContentType == ZSTD_dct_fullDict)
+ return ERROR(dictionary_corrupted); /* only accept specified dictionaries */
+ return 0; /* pure content mode */
+ }
}
ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_frameIdSize);
@@ -2079,7 +2364,10 @@ static size_t ZSTD_loadEntropy_inDDict(ZSTD_DDict* ddict)
}
-static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod)
+static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict,
+ const void* dict, size_t dictSize,
+ ZSTD_dictLoadMethod_e dictLoadMethod,
+ ZSTD_dictContentType_e dictContentType)
{
if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) {
ddict->dictBuffer = NULL;
@@ -2095,12 +2383,15 @@ static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict, const void* dict, size_
ddict->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian */
/* parse dictionary content */
- CHECK_F( ZSTD_loadEntropy_inDDict(ddict) );
+ CHECK_F( ZSTD_loadEntropy_inDDict(ddict, dictContentType) );
return 0;
}
-ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_customMem customMem)
+ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
+ ZSTD_dictLoadMethod_e dictLoadMethod,
+ ZSTD_dictContentType_e dictContentType,
+ ZSTD_customMem customMem)
{
if (!customMem.customAlloc ^ !customMem.customFree) return NULL;
@@ -2108,7 +2399,7 @@ ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, ZSTD_di
if (!ddict) return NULL;
ddict->cMem = customMem;
- if (ZSTD_isError( ZSTD_initDDict_internal(ddict, dict, dictSize, dictLoadMethod) )) {
+ if (ZSTD_isError( ZSTD_initDDict_internal(ddict, dict, dictSize, dictLoadMethod, dictContentType) )) {
ZSTD_freeDDict(ddict);
return NULL;
}
@@ -2124,7 +2415,7 @@ ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, ZSTD_di
ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize)
{
ZSTD_customMem const allocator = { NULL, NULL, NULL };
- return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, allocator);
+ return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator);
}
/*! ZSTD_createDDict_byReference() :
@@ -2134,13 +2425,15 @@ ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize)
ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize)
{
ZSTD_customMem const allocator = { NULL, NULL, NULL };
- return ZSTD_createDDict_advanced(dictBuffer, dictSize, ZSTD_dlm_byRef, allocator);
+ return ZSTD_createDDict_advanced(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, allocator);
}
-ZSTD_DDict* ZSTD_initStaticDDict(void* workspace, size_t workspaceSize,
- const void* dict, size_t dictSize,
- ZSTD_dictLoadMethod_e dictLoadMethod)
+const ZSTD_DDict* ZSTD_initStaticDDict(
+ void* workspace, size_t workspaceSize,
+ const void* dict, size_t dictSize,
+ ZSTD_dictLoadMethod_e dictLoadMethod,
+ ZSTD_dictContentType_e dictContentType)
{
size_t const neededSpace =
sizeof(ZSTD_DDict) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize);
@@ -2153,7 +2446,7 @@ ZSTD_DDict* ZSTD_initStaticDDict(void* workspace, size_t workspaceSize,
memcpy(ddict+1, dict, dictSize); /* local copy */
dict = ddict+1;
}
- if (ZSTD_isError( ZSTD_initDDict_internal(ddict, dict, dictSize, ZSTD_dlm_byRef) ))
+ if (ZSTD_isError( ZSTD_initDDict_internal(ddict, dict, dictSize, ZSTD_dlm_byRef, dictContentType) ))
return NULL;
return ddict;
}
@@ -2247,6 +2540,7 @@ size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx,
ZSTD_DStream* ZSTD_createDStream(void)
{
+ DEBUGLOG(3, "ZSTD_createDStream");
return ZSTD_createDStream_advanced(ZSTD_defaultCMem);
}
@@ -2271,58 +2565,99 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds)
size_t ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_MAX + ZSTD_blockHeaderSize; }
size_t ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_MAX; }
-size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize)
+size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType)
{
- zds->streamStage = zdss_loadHeader;
- zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0;
- ZSTD_freeDDict(zds->ddictLocal);
+ if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
+ ZSTD_freeDDict(dctx->ddictLocal);
if (dict && dictSize >= 8) {
- zds->ddictLocal = ZSTD_createDDict(dict, dictSize);
- if (zds->ddictLocal == NULL) return ERROR(memory_allocation);
- } else zds->ddictLocal = NULL;
- zds->ddict = zds->ddictLocal;
- zds->legacyVersion = 0;
- zds->hostageByte = 0;
+ dctx->ddictLocal = ZSTD_createDDict_advanced(dict, dictSize, dictLoadMethod, dictContentType, dctx->customMem);
+ if (dctx->ddictLocal == NULL) return ERROR(memory_allocation);
+ } else {
+ dctx->ddictLocal = NULL;
+ }
+ dctx->ddict = dctx->ddictLocal;
+ return 0;
+}
+
+size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize)
+{
+ return ZSTD_DCtx_loadDictionary_advanced(dctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto);
+}
+
+size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize)
+{
+ return ZSTD_DCtx_loadDictionary_advanced(dctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto);
+}
+
+size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType)
+{
+ return ZSTD_DCtx_loadDictionary_advanced(dctx, prefix, prefixSize, ZSTD_dlm_byRef, dictContentType);
+}
+
+size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize)
+{
+ return ZSTD_DCtx_refPrefix_advanced(dctx, prefix, prefixSize, ZSTD_dct_rawContent);
+}
+
+
+/* ZSTD_initDStream_usingDict() :
+ * return : expected size, aka ZSTD_frameHeaderSize_prefix.
+ * this function cannot fail */
+size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize)
+{
+ DEBUGLOG(4, "ZSTD_initDStream_usingDict");
+ zds->streamStage = zdss_init;
+ CHECK_F( ZSTD_DCtx_loadDictionary(zds, dict, dictSize) );
return ZSTD_frameHeaderSize_prefix;
}
/* note : this variant can't fail */
size_t ZSTD_initDStream(ZSTD_DStream* zds)
{
+ DEBUGLOG(4, "ZSTD_initDStream");
return ZSTD_initDStream_usingDict(zds, NULL, 0);
}
+size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict)
+{
+ if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
+ dctx->ddict = ddict;
+ return 0;
+}
+
/* ZSTD_initDStream_usingDDict() :
* ddict will just be referenced, and must outlive decompression session
* this function cannot fail */
-size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict)
+size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict* ddict)
{
- size_t const initResult = ZSTD_initDStream(zds);
- zds->ddict = ddict;
+ size_t const initResult = ZSTD_initDStream(dctx);
+ dctx->ddict = ddict;
return initResult;
}
-size_t ZSTD_resetDStream(ZSTD_DStream* zds)
+/* ZSTD_resetDStream() :
+ * return : expected size, aka ZSTD_frameHeaderSize_prefix.
+ * this function cannot fail */
+size_t ZSTD_resetDStream(ZSTD_DStream* dctx)
{
- zds->streamStage = zdss_loadHeader;
- zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0;
- zds->legacyVersion = 0;
- zds->hostageByte = 0;
+ DEBUGLOG(4, "ZSTD_resetDStream");
+ dctx->streamStage = zdss_loadHeader;
+ dctx->lhSize = dctx->inPos = dctx->outStart = dctx->outEnd = 0;
+ dctx->legacyVersion = 0;
+ dctx->hostageByte = 0;
return ZSTD_frameHeaderSize_prefix;
}
-size_t ZSTD_setDStreamParameter(ZSTD_DStream* zds,
+size_t ZSTD_setDStreamParameter(ZSTD_DStream* dctx,
ZSTD_DStreamParameter_e paramType, unsigned paramValue)
{
- ZSTD_STATIC_ASSERT((unsigned)zdss_loadHeader >= (unsigned)zdss_init);
- if ((unsigned)zds->streamStage > (unsigned)zdss_loadHeader)
- return ERROR(stage_wrong);
+ if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
switch(paramType)
{
default : return ERROR(parameter_unsupported);
case DStream_p_maxWindowSize :
DEBUGLOG(4, "setting maxWindowSize = %u KB", paramValue >> 10);
- zds->maxWindowSize = paramValue ? paramValue : (U32)(-1);
+ dctx->maxWindowSize = paramValue ? paramValue : (U32)(-1);
break;
}
return 0;
@@ -2330,9 +2665,7 @@ size_t ZSTD_setDStreamParameter(ZSTD_DStream* zds,
size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize)
{
- ZSTD_STATIC_ASSERT((unsigned)zdss_loadHeader >= (unsigned)zdss_init);
- if ((unsigned)dctx->streamStage > (unsigned)zdss_loadHeader)
- return ERROR(stage_wrong);
+ if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
dctx->maxWindowSize = maxWindowSize;
return 0;
}
@@ -2340,17 +2673,15 @@ size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize)
size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format)
{
DEBUGLOG(4, "ZSTD_DCtx_setFormat : %u", (unsigned)format);
- ZSTD_STATIC_ASSERT((unsigned)zdss_loadHeader >= (unsigned)zdss_init);
- if ((unsigned)dctx->streamStage > (unsigned)zdss_loadHeader)
- return ERROR(stage_wrong);
+ if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
dctx->format = format;
return 0;
}
-size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds)
+size_t ZSTD_sizeof_DStream(const ZSTD_DStream* dctx)
{
- return ZSTD_sizeof_DCtx(zds);
+ return ZSTD_sizeof_DCtx(dctx);
}
size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize)
@@ -2417,23 +2748,25 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
}
DEBUGLOG(5, "input size : %u", (U32)(input->size - input->pos));
-#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
- if (zds->legacyVersion) {
- /* legacy support is incompatible with static dctx */
- if (zds->staticSize) return ERROR(memory_allocation);
- return ZSTD_decompressLegacyStream(zds->legacyContext, zds->legacyVersion, output, input);
- }
-#endif
-
while (someMoreWork) {
switch(zds->streamStage)
{
case zdss_init :
+ DEBUGLOG(5, "stage zdss_init => transparent reset ");
ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
/* fall-through */
case zdss_loadHeader :
DEBUGLOG(5, "stage zdss_loadHeader (srcSize : %u)", (U32)(iend - ip));
+#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
+ if (zds->legacyVersion) {
+ /* legacy support is incompatible with static dctx */
+ if (zds->staticSize) return ERROR(memory_allocation);
+ { size_t const hint = ZSTD_decompressLegacyStream(zds->legacyContext, zds->legacyVersion, output, input);
+ if (hint==0) zds->streamStage = zdss_init;
+ return hint;
+ } }
+#endif
{ size_t const hSize = ZSTD_getFrameHeader_internal(&zds->fParams, zds->headerBuffer, zds->lhSize, zds->format);
DEBUGLOG(5, "header size : %u", (U32)hSize);
if (ZSTD_isError(hSize)) {
@@ -2442,14 +2775,17 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
if (legacyVersion) {
const void* const dict = zds->ddict ? zds->ddict->dictContent : NULL;
size_t const dictSize = zds->ddict ? zds->ddict->dictSize : 0;
+ DEBUGLOG(5, "ZSTD_decompressStream: detected legacy version v0.%u", legacyVersion);
/* legacy support is incompatible with static dctx */
if (zds->staticSize) return ERROR(memory_allocation);
CHECK_F(ZSTD_initLegacyStream(&zds->legacyContext,
zds->previousLegacyVersion, legacyVersion,
dict, dictSize));
zds->legacyVersion = zds->previousLegacyVersion = legacyVersion;
- return ZSTD_decompressLegacyStream(zds->legacyContext, legacyVersion, output, input);
- }
+ { size_t const hint = ZSTD_decompressLegacyStream(zds->legacyContext, legacyVersion, output, input);
+ if (hint==0) zds->streamStage = zdss_init; /* or stay in stage zdss_loadHeader */
+ return hint;
+ } }
#endif
return hSize; /* error */
}
@@ -2559,6 +2895,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
if (ip==iend) { someMoreWork = 0; break; } /* no more input */
zds->streamStage = zdss_load;
/* fall-through */
+
case zdss_load:
{ size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds);
size_t const toLoad = neededInSize - zds->inPos;
@@ -2585,6 +2922,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
} }
zds->streamStage = zdss_flush;
/* fall-through */
+
case zdss_flush:
{ size_t const toFlushSize = zds->outEnd - zds->outStart;
size_t const flushedSize = ZSTD_limitCopy(op, oend-op, zds->outBuff + zds->outStart, toFlushSize);
@@ -2631,8 +2969,8 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
return 1;
} /* nextSrcSizeHint==0 */
nextSrcSizeHint += ZSTD_blockHeaderSize * (ZSTD_nextInputType(zds) == ZSTDnit_block); /* preload header of next block */
- if (zds->inPos > nextSrcSizeHint) return ERROR(GENERIC); /* should never happen */
- nextSrcSizeHint -= zds->inPos; /* already loaded*/
+ assert(zds->inPos <= nextSrcSizeHint);
+ nextSrcSizeHint -= zds->inPos; /* part already loaded*/
return nextSrcSizeHint;
}
}
diff --git a/thirdparty/zstd/zstd.h b/thirdparty/zstd/zstd.h
index 9ac0a73dce..6405da602e 100644
--- a/thirdparty/zstd/zstd.h
+++ b/thirdparty/zstd/zstd.h
@@ -45,11 +45,11 @@ extern "C" {
Levels >= 20, labeled `--ultra`, should be used with caution, as they require more memory.
Compression can be done in:
- a single step (described as Simple API)
- - a single step, reusing a context (described as Explicit memory management)
+ - a single step, reusing a context (described as Explicit context)
- unbounded multiple steps (described as Streaming compression)
The compression ratio achievable on small data can be highly improved using a dictionary in:
- a single step (described as Simple dictionary API)
- - a single step, reusing a dictionary (described as Fast dictionary API)
+ - a single step, reusing a dictionary (described as Bulk-processing dictionary API)
Advanced experimental functions can be accessed using #define ZSTD_STATIC_LINKING_ONLY before including zstd.h.
Advanced experimental APIs shall never be used with a dynamic library.
@@ -59,7 +59,7 @@ extern "C" {
/*------ Version ------*/
#define ZSTD_VERSION_MAJOR 1
#define ZSTD_VERSION_MINOR 3
-#define ZSTD_VERSION_RELEASE 3
+#define ZSTD_VERSION_RELEASE 4
#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< useful to check dll version */
@@ -68,7 +68,7 @@ ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< useful to check dll versio
#define ZSTD_QUOTE(str) #str
#define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str)
#define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
-ZSTDLIB_API const char* ZSTD_versionString(void); /* v1.3.0 */
+ZSTDLIB_API const char* ZSTD_versionString(void); /* added in v1.3.0 */
/***************************************
@@ -92,7 +92,7 @@ ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity,
ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity,
const void* src, size_t compressedSize);
-/*! ZSTD_getFrameContentSize() : v1.3.0
+/*! ZSTD_getFrameContentSize() : added in v1.3.0
* `src` should point to the start of a ZSTD encoded frame.
* `srcSize` must be at least as large as the frame header.
* hint : any size >= `ZSTD_frameHeaderSize_max` is large enough.
@@ -120,26 +120,24 @@ ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t
/*! ZSTD_getDecompressedSize() :
* NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize().
- * Both functions work the same way,
- * but ZSTD_getDecompressedSize() blends
- * "empty", "unknown" and "error" results in the same return value (0),
- * while ZSTD_getFrameContentSize() distinguishes them.
- *
- * 'src' is the start of a zstd compressed frame.
- * @return : content size to be decompressed, as a 64-bits value _if known and not empty_, 0 otherwise. */
+ * Both functions work the same way, but ZSTD_getDecompressedSize() blends
+ * "empty", "unknown" and "error" results to the same return value (0),
+ * while ZSTD_getFrameContentSize() gives them separate return values.
+ * `src` is the start of a zstd compressed frame.
+ * @return : content size to be decompressed, as a 64-bits value _if known and not empty_, 0 otherwise. */
ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
/*====== Helper functions ======*/
#define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
-ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case scenario */
+ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
ZSTDLIB_API unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */
ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compression level available */
/***************************************
-* Explicit memory management
+* Explicit context
***************************************/
/*= Compression context
* When compressing many times,
@@ -345,7 +343,7 @@ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output
* *******************************************************************************/
typedef ZSTD_DCtx ZSTD_DStream; /**< DCtx and DStream are now effectively same object (>= v1.3.0) */
- /* Continue to distinguish them for compatibility with versions <= v1.2.0 */
+ /* For compatibility with versions <= v1.2.0, continue to consider them separated. */
/*===== ZSTD_DStream management functions =====*/
ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream(void);
ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds);
@@ -375,23 +373,24 @@ ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output
/* --- Constants ---*/
#define ZSTD_MAGICNUMBER 0xFD2FB528 /* >= v0.8.0 */
#define ZSTD_MAGIC_SKIPPABLE_START 0x184D2A50U
-#define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* v0.7+ */
+#define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* >= v0.7.0 */
#define ZSTD_WINDOWLOG_MAX_32 30
#define ZSTD_WINDOWLOG_MAX_64 31
#define ZSTD_WINDOWLOG_MAX ((unsigned)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
#define ZSTD_WINDOWLOG_MIN 10
-#define ZSTD_HASHLOG_MAX MIN(ZSTD_WINDOWLOG_MAX, 30)
+#define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30)
#define ZSTD_HASHLOG_MIN 6
-#define ZSTD_CHAINLOG_MAX MIN(ZSTD_WINDOWLOG_MAX+1, 30)
+#define ZSTD_CHAINLOG_MAX_32 29
+#define ZSTD_CHAINLOG_MAX_64 30
+#define ZSTD_CHAINLOG_MAX ((unsigned)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64))
#define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN
#define ZSTD_HASHLOG3_MAX 17
#define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1)
#define ZSTD_SEARCHLOG_MIN 1
#define ZSTD_SEARCHLENGTH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */
#define ZSTD_SEARCHLENGTH_MIN 3 /* only for ZSTD_btopt, other strategies are limited to 4 */
-#define ZSTD_TARGETLENGTH_MIN 4 /* only useful for btopt */
-#define ZSTD_TARGETLENGTH_MAX 999 /* only useful for btopt */
+#define ZSTD_TARGETLENGTH_MIN 1 /* only used by btopt, btultra and btfast */
#define ZSTD_LDM_MINMATCH_MIN 4
#define ZSTD_LDM_MINMATCH_MAX 4096
#define ZSTD_LDM_BUCKETSIZELOG_MAX 8
@@ -432,12 +431,17 @@ typedef struct {
typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params;
-/*--- Custom memory allocation functions ---*/
-typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
-typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
-typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
-/* use this constant to defer to stdlib's functions */
-static ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL };
+typedef enum {
+ ZSTD_dct_auto=0, /* dictionary is "full" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */
+ ZSTD_dct_rawContent, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */
+ ZSTD_dct_fullDict /* refuses to load a dictionary if it does not respect Zstandard's specification */
+} ZSTD_dictContentType_e;
+
+typedef enum {
+ ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */
+ ZSTD_dlm_byRef, /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
+} ZSTD_dictLoadMethod_e;
+
/***************************************
@@ -483,12 +487,12 @@ ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
/***************************************
-* Context memory usage
+* Memory management
***************************************/
/*! ZSTD_sizeof_*() :
* These functions give the current memory usage of selected object.
- * Object memory usage can evolve when re-used multiple times. */
+ * Object memory usage can evolve when re-used. */
ZSTDLIB_API size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx);
ZSTDLIB_API size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx* dctx);
ZSTDLIB_API size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs);
@@ -503,8 +507,8 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
* It will also consider src size to be arbitrarily "large", which is worst case.
* If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
* ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
- * ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbThreads is > 1.
- * Note : CCtx estimation is only correct for single-threaded compression */
+ * ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbWorkers is >= 1.
+ * Note : CCtx size estimation is only correct for single-threaded compression. */
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
@@ -515,8 +519,8 @@ ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void);
* It will also consider src size to be arbitrarily "large", which is worst case.
* If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
* ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
- * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbThreads is set to a value > 1.
- * Note : CStream estimation is only correct for single-threaded compression.
+ * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_p_nbWorkers is >= 1.
+ * Note : CStream size estimation is only correct for single-threaded compression.
* ZSTD_DStream memory budget depends on window Size.
* This information can be passed manually, using ZSTD_estimateDStreamSize,
* or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame();
@@ -529,84 +533,92 @@ ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_para
ZSTDLIB_API size_t ZSTD_estimateDStreamSize(size_t windowSize);
ZSTDLIB_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
-typedef enum {
- ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */
- ZSTD_dlm_byRef, /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
-} ZSTD_dictLoadMethod_e;
-
/*! ZSTD_estimate?DictSize() :
* ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict().
- * ZSTD_estimateCStreamSize_advanced_usingCParams() makes it possible to control precisely compression parameters, like ZSTD_createCDict_advanced().
- * Note : dictionary created by reference using ZSTD_dlm_byRef are smaller
+ * ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced().
+ * Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller.
*/
ZSTDLIB_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
ZSTDLIB_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod);
ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod);
-
-/***************************************
-* Advanced compression functions
-***************************************/
-/*! ZSTD_createCCtx_advanced() :
- * Create a ZSTD compression context using external alloc and free functions */
-ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
-
-/*! ZSTD_initStaticCCtx() : initialize a fixed-size zstd compression context
- * workspace: The memory area to emplace the context into.
- * Provided pointer must 8-bytes aligned.
- * It must outlive context usage.
- * workspaceSize: Use ZSTD_estimateCCtxSize() or ZSTD_estimateCStreamSize()
- * to determine how large workspace must be to support scenario.
- * @return : pointer to ZSTD_CCtx* (same address as workspace, but different type),
- * or NULL if error (typically size too small)
- * Note : zstd will never resize nor malloc() when using a static cctx.
- * If it needs more memory than available, it will simply error out.
+/*! ZSTD_initStatic*() :
+ * Initialize an object using a pre-allocated fixed-size buffer.
+ * workspace: The memory area to emplace the object into.
+ * Provided pointer *must be 8-bytes aligned*.
+ * Buffer must outlive object.
+ * workspaceSize: Use ZSTD_estimate*Size() to determine
+ * how large workspace must be to support target scenario.
+ * @return : pointer to object (same address as workspace, just different type),
+ * or NULL if error (size too small, incorrect alignment, etc.)
+ * Note : zstd will never resize nor malloc() when using a static buffer.
+ * If the object requires more memory than available,
+ * zstd will just error out (typically ZSTD_error_memory_allocation).
* Note 2 : there is no corresponding "free" function.
- * Since workspace was allocated externally, it must be freed externally too.
- * Limitation 1 : currently not compatible with internal CDict creation, such as
- * ZSTD_CCtx_loadDictionary() or ZSTD_initCStream_usingDict().
- * Limitation 2 : currently not compatible with multi-threading
+ * Since workspace is allocated externally, it must be freed externally too.
+ * Note 3 : cParams : use ZSTD_getCParams() to convert a compression level
+ * into its associated cParams.
+ * Limitation 1 : currently not compatible with internal dictionary creation, triggered by
+ * ZSTD_CCtx_loadDictionary(), ZSTD_initCStream_usingDict() or ZSTD_initDStream_usingDict().
+ * Limitation 2 : static cctx currently not compatible with multi-threading.
+ * Limitation 3 : static dctx is incompatible with legacy support.
*/
-ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
+ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
+ZSTDLIB_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */
+ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize);
+ZSTDLIB_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */
-/*! ZSTD_createCDict_byReference() :
- * Create a digested dictionary for compression
- * Dictionary content is simply referenced, and therefore stays in dictBuffer.
- * It is important that dictBuffer outlives CDict, it must remain read accessible throughout the lifetime of CDict */
-ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
+ZSTDLIB_API const ZSTD_CDict* ZSTD_initStaticCDict(
+ void* workspace, size_t workspaceSize,
+ const void* dict, size_t dictSize,
+ ZSTD_dictLoadMethod_e dictLoadMethod,
+ ZSTD_dictContentType_e dictContentType,
+ ZSTD_compressionParameters cParams);
+
+ZSTDLIB_API const ZSTD_DDict* ZSTD_initStaticDDict(
+ void* workspace, size_t workspaceSize,
+ const void* dict, size_t dictSize,
+ ZSTD_dictLoadMethod_e dictLoadMethod,
+ ZSTD_dictContentType_e dictContentType);
+
+/*! Custom memory allocation :
+ * These prototypes make it possible to pass your own allocation/free functions.
+ * ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below.
+ * All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones.
+ */
+typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
+typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
+typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
+static ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */
+
+ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
+ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem);
+ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
+ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem);
-typedef enum { ZSTD_dm_auto=0, /* dictionary is "full" if it starts with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */
- ZSTD_dm_rawContent, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */
- ZSTD_dm_fullDict /* refuses to load a dictionary if it does not respect Zstandard's specification */
-} ZSTD_dictMode_e;
-/*! ZSTD_createCDict_advanced() :
- * Create a ZSTD_CDict using external alloc and free, and customized compression parameters */
ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
- ZSTD_dictMode_e dictMode,
+ ZSTD_dictContentType_e dictContentType,
ZSTD_compressionParameters cParams,
ZSTD_customMem customMem);
-/*! ZSTD_initStaticCDict() :
- * Generate a digested dictionary in provided memory area.
- * workspace: The memory area to emplace the dictionary into.
- * Provided pointer must 8-bytes aligned.
- * It must outlive dictionary usage.
- * workspaceSize: Use ZSTD_estimateCDictSize()
- * to determine how large workspace must be.
- * cParams : use ZSTD_getCParams() to transform a compression level
- * into its relevants cParams.
- * @return : pointer to ZSTD_CDict* (same address as workspace, but different type),
- * or NULL if error (typically, size too small).
- * Note : there is no corresponding "free" function.
- * Since workspace was allocated externally, it must be freed externally.
- */
-ZSTDLIB_API ZSTD_CDict* ZSTD_initStaticCDict(
- void* workspace, size_t workspaceSize,
- const void* dict, size_t dictSize,
- ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictMode_e dictMode,
- ZSTD_compressionParameters cParams);
+ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
+ ZSTD_dictLoadMethod_e dictLoadMethod,
+ ZSTD_dictContentType_e dictContentType,
+ ZSTD_customMem customMem);
+
+
+
+/***************************************
+* Advanced compression functions
+***************************************/
+
+/*! ZSTD_createCDict_byReference() :
+ * Create a digested dictionary for compression
+ * Dictionary content is simply referenced, and therefore stays in dictBuffer.
+ * It is important that dictBuffer outlives CDict, it must remain read accessible throughout the lifetime of CDict */
+ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
/*! ZSTD_getCParams() :
* @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
@@ -652,28 +664,6 @@ ZSTDLIB_API size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
* Note 3 : Skippable Frame Identifiers are considered valid. */
ZSTDLIB_API unsigned ZSTD_isFrame(const void* buffer, size_t size);
-/*! ZSTD_createDCtx_advanced() :
- * Create a ZSTD decompression context using external alloc and free functions */
-ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
-
-/*! ZSTD_initStaticDCtx() : initialize a fixed-size zstd decompression context
- * workspace: The memory area to emplace the context into.
- * Provided pointer must 8-bytes aligned.
- * It must outlive context usage.
- * workspaceSize: Use ZSTD_estimateDCtxSize() or ZSTD_estimateDStreamSize()
- * to determine how large workspace must be to support scenario.
- * @return : pointer to ZSTD_DCtx* (same address as workspace, but different type),
- * or NULL if error (typically size too small)
- * Note : zstd will never resize nor malloc() when using a static dctx.
- * If it needs more memory than available, it will simply error out.
- * Note 2 : static dctx is incompatible with legacy support
- * Note 3 : there is no corresponding "free" function.
- * Since workspace was allocated externally, it must be freed externally.
- * Limitation : currently not compatible with internal DDict creation,
- * such as ZSTD_initDStream_usingDict().
- */
-ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize);
-
/*! ZSTD_createDDict_byReference() :
* Create a digested dictionary, ready to start decompression operation without startup delay.
* Dictionary content is referenced, and therefore stays in dictBuffer.
@@ -681,26 +671,6 @@ ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize
* it must remain read accessible throughout the lifetime of DDict */
ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
-/*! ZSTD_createDDict_advanced() :
- * Create a ZSTD_DDict using external alloc and free, optionally by reference */
-ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
- ZSTD_dictLoadMethod_e dictLoadMethod,
- ZSTD_customMem customMem);
-
-/*! ZSTD_initStaticDDict() :
- * Generate a digested dictionary in provided memory area.
- * workspace: The memory area to emplace the dictionary into.
- * Provided pointer must 8-bytes aligned.
- * It must outlive dictionary usage.
- * workspaceSize: Use ZSTD_estimateDDictSize()
- * to determine how large workspace must be.
- * @return : pointer to ZSTD_DDict*, or NULL if error (size too small)
- * Note : there is no corresponding "free" function.
- * Since workspace was allocated externally, it must be freed externally.
- */
-ZSTDLIB_API ZSTD_DDict* ZSTD_initStaticDDict(void* workspace, size_t workspaceSize,
- const void* dict, size_t dictSize,
- ZSTD_dictLoadMethod_e dictLoadMethod);
/*! ZSTD_getDictID_fromDict() :
* Provides the dictID stored within dictionary.
@@ -732,8 +702,6 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize);
********************************************************************/
/*===== Advanced Streaming compression functions =====*/
-ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem);
-ZSTDLIB_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */
ZSTDLIB_API size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, int compressionLevel, unsigned long long pledgedSrcSize); /**< pledgedSrcSize must be correct. If it is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs, "0" also disables frame content size field. It may be enabled in the future. */
ZSTDLIB_API size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel); /**< creates of an internal CDict (incompatible with static CCtx), except if dict == NULL or dictSize < 8, in which case no dict is used. Note: dict is loaded with ZSTD_dm_auto (treated as a full zstd dictionary if it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy.*/
ZSTDLIB_API size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, const void* dict, size_t dictSize,
@@ -748,14 +716,28 @@ ZSTDLIB_API size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const
* If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN.
* If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end.
* For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs,
- * but it may change to mean "empty" in some future version, so prefer using macro ZSTD_CONTENTSIZE_UNKNOWN.
+ * but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead.
* @return : 0, or an error code (which can be tested using ZSTD_isError()) */
ZSTDLIB_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
+typedef struct {
+ unsigned long long ingested;
+ unsigned long long consumed;
+ unsigned long long produced;
+} ZSTD_frameProgression;
+
+/* ZSTD_getFrameProgression():
+ * tells how much data has been ingested (read from input)
+ * consumed (input actually compressed) and produced (output) for current frame.
+ * Therefore, (ingested - consumed) is amount of input data buffered internally, not yet compressed.
+ * Can report progression inside worker threads (multi-threading and non-blocking mode).
+ */
+ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx);
+
+
+
/*===== Advanced Streaming decompression functions =====*/
-ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem);
-ZSTDLIB_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */
typedef enum { DStream_p_maxWindowSize } ZSTD_DStreamParameter_e;
ZSTDLIB_API size_t ZSTD_setDStreamParameter(ZSTD_DStream* zds, ZSTD_DStreamParameter_e paramType, unsigned paramValue); /* obsolete : this API will be removed in a future version */
ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /**< note: no dictionary will be used if dict == NULL or dictSize < 8 */
@@ -924,10 +906,8 @@ ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
* and then applied on all subsequent compression jobs.
* When no parameter is ever provided, CCtx is created with compression level ZSTD_CLEVEL_DEFAULT.
*
- * This API is intended to replace all others experimental API.
- * It can basically do all other use cases, and even new ones.
- * In constrast with _advanced() variants, it stands a reasonable chance to become "stable",
- * after a good testing period.
+ * This API is intended to replace all others advanced / experimental API entry points.
+ * But it stands a reasonable chance to become "stable", after a reasonable testing period.
*/
/* note on naming convention :
@@ -944,12 +924,12 @@ ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
* All enum will be pinned to explicit values before reaching "stable API" status */
typedef enum {
- /* Question : should we have a format ZSTD_f_auto ?
- * For the time being, it would mean exactly the same as ZSTD_f_zstd1.
- * But, in the future, should several formats be supported,
+ /* Opened question : should we have a format ZSTD_f_auto ?
+ * Today, it would mean exactly the same as ZSTD_f_zstd1.
+ * But, in the future, should several formats become supported,
* on the compression side, it would mean "default format".
- * On the decompression side, it would mean "multi format",
- * and ZSTD_f_zstd1 could be reserved to mean "accept *only* zstd frames".
+ * On the decompression side, it would mean "automatic format detection",
+ * so that ZSTD_f_zstd1 would mean "accept *only* zstd frames".
* Since meaning is a little different, another option could be to define different enums for compression and decompression.
* This question could be kept for later, when there are actually multiple formats to support,
* but there is also the question of pinning enum values, and pinning value `0` is especially important */
@@ -967,42 +947,76 @@ typedef enum {
/* compression parameters */
ZSTD_p_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
* Default level is ZSTD_CLEVEL_DEFAULT==3.
- * Special: value 0 means "do not change cLevel". */
+ * Special: value 0 means "do not change cLevel".
+ * Note 1 : it's possible to pass a negative compression level by casting it to unsigned type.
+ * Note 2 : setting a level sets all default values of other compression parameters.
+ * Note 3 : setting compressionLevel automatically updates ZSTD_p_compressLiterals. */
ZSTD_p_windowLog, /* Maximum allowed back-reference distance, expressed as power of 2.
* Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
- * Special: value 0 means "do not change windowLog".
+ * Special: value 0 means "use default windowLog".
* Note: Using a window size greater than ZSTD_MAXWINDOWSIZE_DEFAULT (default: 2^27)
- * requires setting the maximum window size at least as large during decompression. */
+ * requires explicitly allowing such window size during decompression stage. */
ZSTD_p_hashLog, /* Size of the probe table, as a power of 2.
* Resulting table size is (1 << (hashLog+2)).
* Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
* Larger tables improve compression ratio of strategies <= dFast,
* and improve speed of strategies > dFast.
- * Special: value 0 means "do not change hashLog". */
+ * Special: value 0 means "use default hashLog". */
ZSTD_p_chainLog, /* Size of the full-search table, as a power of 2.
* Resulting table size is (1 << (chainLog+2)).
* Larger tables result in better and slower compression.
* This parameter is useless when using "fast" strategy.
- * Special: value 0 means "do not change chainLog". */
+ * Special: value 0 means "use default chainLog". */
ZSTD_p_searchLog, /* Number of search attempts, as a power of 2.
* More attempts result in better and slower compression.
* This parameter is useless when using "fast" and "dFast" strategies.
- * Special: value 0 means "do not change searchLog". */
+ * Special: value 0 means "use default searchLog". */
ZSTD_p_minMatch, /* Minimum size of searched matches (note : repCode matches can be smaller).
* Larger values make faster compression and decompression, but decrease ratio.
* Must be clamped between ZSTD_SEARCHLENGTH_MIN and ZSTD_SEARCHLENGTH_MAX.
* Note that currently, for all strategies < btopt, effective minimum is 4.
- * Note that currently, for all strategies > fast, effective maximum is 6.
- * Special: value 0 means "do not change minMatchLength". */
- ZSTD_p_targetLength, /* Only useful for strategies >= btopt.
- * Length of Match considered "good enough" to stop search.
- * Larger values make compression stronger and slower.
- * Special: value 0 means "do not change targetLength". */
+ * , for all strategies > fast, effective maximum is 6.
+ * Special: value 0 means "use default minMatchLength". */
+ ZSTD_p_targetLength, /* Impact of this field depends on strategy.
+ * For strategies btopt & btultra:
+ * Length of Match considered "good enough" to stop search.
+ * Larger values make compression stronger, and slower.
+ * For strategy fast:
+ * Distance between match sampling.
+ * Larger values make compression faster, and weaker.
+ * Special: value 0 means "use default targetLength". */
ZSTD_p_compressionStrategy, /* See ZSTD_strategy enum definition.
* Cast selected strategy as unsigned for ZSTD_CCtx_setParameter() compatibility.
* The higher the value of selected strategy, the more complex it is,
* resulting in stronger and slower compression.
- * Special: value 0 means "do not change strategy". */
+ * Special: value 0 means "use default strategy". */
+
+ ZSTD_p_enableLongDistanceMatching=160, /* Enable long distance matching.
+ * This parameter is designed to improve compression ratio
+ * for large inputs, by finding large matches at long distance.
+ * It increases memory usage and window size.
+ * Note: enabling this parameter increases ZSTD_p_windowLog to 128 MB
+ * except when expressly set to a different value. */
+ ZSTD_p_ldmHashLog, /* Size of the table for long distance matching, as a power of 2.
+ * Larger values increase memory usage and compression ratio,
+ * but decrease compression speed.
+ * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
+ * default: windowlog - 7.
+ * Special: value 0 means "automatically determine hashlog". */
+ ZSTD_p_ldmMinMatch, /* Minimum match size for long distance matcher.
+ * Larger/too small values usually decrease compression ratio.
+ * Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
+ * Special: value 0 means "use default value" (default: 64). */
+ ZSTD_p_ldmBucketSizeLog, /* Log size of each bucket in the LDM hash table for collision resolution.
+ * Larger values improve collision resolution but decrease compression speed.
+ * The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX .
+ * Special: value 0 means "use default value" (default: 3). */
+ ZSTD_p_ldmHashEveryLog, /* Frequency of inserting/looking up entries in the LDM hash table.
+ * Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
+ * Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
+ * Larger values improve compression speed.
+ * Deviating far from default value will likely result in a compression ratio decrease.
+ * Special: value 0 means "automatically determine hashEveryLog". */
/* frame parameters */
ZSTD_p_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)
@@ -1012,58 +1026,45 @@ typedef enum {
ZSTD_p_dictIDFlag, /* When applicable, dictionary's ID is written into frame header (default:1) */
/* multi-threading parameters */
- ZSTD_p_nbThreads=400, /* Select how many threads a compression job can spawn (default:1)
- * More threads improve speed, but also increase memory usage.
- * Can only receive a value > 1 if ZSTD_MULTITHREAD is enabled.
- * Special: value 0 means "do not change nbThreads" */
- ZSTD_p_jobSize, /* Size of a compression job. This value is only enforced in streaming (non-blocking) mode.
- * Each compression job is completed in parallel, so indirectly controls the nb of active threads.
+ /* These parameters are only useful if multi-threading is enabled (ZSTD_MULTITHREAD).
+ * They return an error otherwise. */
+ ZSTD_p_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel.
+ * When nbWorkers >= 1, triggers asynchronous mode :
+ * ZSTD_compress_generic() consumes some input, flush some output if possible, and immediately gives back control to caller,
+ * while compression work is performed in parallel, within worker threads.
+ * (note : a strong exception to this rule is when first invocation sets ZSTD_e_end : it becomes a blocking call).
+ * More workers improve speed, but also increase memory usage.
+ * Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
+ ZSTD_p_jobSize, /* Size of a compression job. This value is enforced only in non-blocking mode.
+ * Each compression job is completed in parallel, so this value indirectly controls the nb of active threads.
* 0 means default, which is dynamically determined based on compression parameters.
- * Job size must be a minimum of overlapSize, or 1 KB, whichever is largest
+ * Job size must be a minimum of overlapSize, or 1 MB, whichever is largest.
* The minimum size is automatically and transparently enforced */
ZSTD_p_overlapSizeLog, /* Size of previous input reloaded at the beginning of each job.
* 0 => no overlap, 6(default) => use 1/8th of windowSize, >=9 => use full windowSize */
- /* advanced parameters - may not remain available after API update */
+ /* =================================================================== */
+ /* experimental parameters - no stability guaranteed */
+ /* =================================================================== */
+
+ ZSTD_p_compressLiterals=1000, /* control huffman compression of literals (enabled) by default.
+ * disabling it improves speed and decreases compression ratio by a large amount.
+ * note : this setting is automatically updated when changing compression level.
+ * positive compression levels set ZSTD_p_compressLiterals to 1.
+ * negative compression levels set ZSTD_p_compressLiterals to 0. */
+
ZSTD_p_forceMaxWindow=1100, /* Force back-reference distances to remain < windowSize,
* even when referencing into Dictionary content (default:0) */
- ZSTD_p_enableLongDistanceMatching=1200, /* Enable long distance matching.
- * This parameter is designed to improve the compression
- * ratio for large inputs with long distance matches.
- * This increases the memory usage as well as window size.
- * Note: setting this parameter sets all the LDM parameters
- * as well as ZSTD_p_windowLog. It should be set after
- * ZSTD_p_compressionLevel and before ZSTD_p_windowLog and
- * other LDM parameters. Setting the compression level
- * after this parameter overrides the window log, though LDM
- * will remain enabled until explicitly disabled. */
- ZSTD_p_ldmHashLog, /* Size of the table for long distance matching, as a power of 2.
- * Larger values increase memory usage and compression ratio, but decrease
- * compression speed.
- * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
- * (default: windowlog - 7). */
- ZSTD_p_ldmMinMatch, /* Minimum size of searched matches for long distance matcher.
- * Larger/too small values usually decrease compression ratio.
- * Must be clamped between ZSTD_LDM_MINMATCH_MIN
- * and ZSTD_LDM_MINMATCH_MAX (default: 64). */
- ZSTD_p_ldmBucketSizeLog, /* Log size of each bucket in the LDM hash table for collision resolution.
- * Larger values usually improve collision resolution but may decrease
- * compression speed.
- * The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX (default: 3). */
- ZSTD_p_ldmHashEveryLog, /* Frequency of inserting/looking up entries in the LDM hash table.
- * The default is MAX(0, (windowLog - ldmHashLog)) to
- * optimize hash table usage.
- * Larger values improve compression speed. Deviating far from the
- * default value will likely result in a decrease in compression ratio.
- * Must be clamped between 0 and ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN. */
} ZSTD_cParameter;
/*! ZSTD_CCtx_setParameter() :
* Set one compression parameter, selected by enum ZSTD_cParameter.
+ * Setting a parameter is generally only possible during frame initialization (before starting compression),
+ * except for a few exceptions which can be updated during compression: compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy.
* Note : when `value` is an enum, cast it to unsigned for proper type checking.
- * @result : informational value (typically, the one being set, possibly corrected),
+ * @result : informational value (typically, value being set clamped correctly),
* or an error code (which can be tested with ZSTD_isError()). */
ZSTDLIB_API size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value);
@@ -1079,26 +1080,24 @@ ZSTDLIB_API size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param
ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize);
/*! ZSTD_CCtx_loadDictionary() :
- * Create an internal CDict from dict buffer.
- * Decompression will have to use same buffer.
+ * Create an internal CDict from `dict` buffer.
+ * Decompression will have to use same dictionary.
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
- * Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,
- * meaning "return to no-dictionary mode".
- * Note 1 : `dict` content will be copied internally. Use
- * ZSTD_CCtx_loadDictionary_byReference() to reference dictionary
- * content instead. The dictionary buffer must then outlive its
- * users.
+ * Special: Adding a NULL (or 0-size) dictionary invalidates previous dictionary,
+ * meaning "return to no-dictionary mode".
+ * Note 1 : Dictionary will be used for all future compression jobs.
+ * To return to "no-dictionary" situation, load a NULL dictionary
* Note 2 : Loading a dictionary involves building tables, which are dependent on compression parameters.
* For this reason, compression parameters cannot be changed anymore after loading a dictionary.
- * It's also a CPU-heavy operation, with non-negligible impact on latency.
- * Note 3 : Dictionary will be used for all future compression jobs.
- * To return to "no-dictionary" situation, load a NULL dictionary
- * Note 5 : Use ZSTD_CCtx_loadDictionary_advanced() to select how dictionary
- * content will be interpreted.
- */
+ * It's also a CPU consuming operation, with non-negligible impact on latency.
+ * Note 3 :`dict` content will be copied internally.
+ * Use ZSTD_CCtx_loadDictionary_byReference() to reference dictionary content instead.
+ * In such a case, dictionary buffer must outlive its users.
+ * Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()
+ * to precisely select how dictionary content must be interpreted. */
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
-ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictMode_e dictMode);
+ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
/*! ZSTD_CCtx_refCDict() :
@@ -1110,8 +1109,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void
* Special : adding a NULL CDict means "return to no-dictionary mode".
* Note 1 : Currently, only one dictionary can be managed.
* Adding a new dictionary effectively "discards" any previous one.
- * Note 2 : CDict is just referenced, its lifetime must outlive CCtx.
- */
+ * Note 2 : CDict is just referenced, its lifetime must outlive CCtx. */
ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
/*! ZSTD_CCtx_refPrefix() :
@@ -1121,20 +1119,29 @@ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
* Subsequent compression jobs will be done without prefix (if none is explicitly referenced).
* If there is a need to use same prefix multiple times, consider embedding it into a ZSTD_CDict instead.
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
- * Special : Adding any prefix (including NULL) invalidates any previous prefix or dictionary
+ * Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary
* Note 1 : Prefix buffer is referenced. It must outlive compression job.
* Note 2 : Referencing a prefix involves building tables, which are dependent on compression parameters.
- * It's a CPU-heavy operation, with non-negligible impact on latency.
- * Note 3 : By default, the prefix is treated as raw content
- * (ZSTD_dm_rawContent). Use ZSTD_CCtx_refPrefix_advanced() to alter
- * dictMode. */
+ * It's a CPU consuming operation, with non-negligible impact on latency.
+ * Note 3 : By default, the prefix is treated as raw content (ZSTD_dm_rawContent).
+ * Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode. */
ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize);
-ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictMode_e dictMode);
+ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
+
+/*! ZSTD_CCtx_reset() :
+ * Return a CCtx to clean state.
+ * Useful after an error, or to interrupt an ongoing compression job and start a new one.
+ * Any internal data not yet flushed is cancelled.
+ * Dictionary (if any) is dropped.
+ * All parameters are back to default values.
+ * It's possible to modify compression parameters after a reset.
+ */
+ZSTDLIB_API void ZSTD_CCtx_reset(ZSTD_CCtx* cctx);
typedef enum {
- ZSTD_e_continue=0, /* collect more data, encoder transparently decides when to output result, for optimal conditions */
+ ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal conditions */
ZSTD_e_flush, /* flush any data provided so far - frame will continue, future data can still reference previous data for better compression */
ZSTD_e_end /* flush any remaining data and close current frame. Any additional data starts a new frame. */
} ZSTD_EndDirective;
@@ -1150,10 +1157,11 @@ typedef enum {
* and then immediately returns, just indicating that there is some data remaining to be flushed.
* The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte.
* - Exception : in multi-threading mode, if the first call requests a ZSTD_e_end directive, it is blocking : it will complete compression before giving back control to caller.
- * - @return provides the minimum amount of data remaining to be flushed from internal buffers
+ * - @return provides a minimum amount of data remaining to be flushed from internal buffers
* or an error code, which can be tested using ZSTD_isError().
* if @return != 0, flush is not fully completed, there is still some data left within internal buffers.
- * This is useful to determine if a ZSTD_e_flush or ZSTD_e_end directive is completed.
+ * This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers.
+ * For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed.
* - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0),
* only ZSTD_e_end or ZSTD_e_flush operations are allowed.
* Before starting a new compression job, or changing compression parameters,
@@ -1164,16 +1172,6 @@ ZSTDLIB_API size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
ZSTD_inBuffer* input,
ZSTD_EndDirective endOp);
-/*! ZSTD_CCtx_reset() :
- * Return a CCtx to clean state.
- * Useful after an error, or to interrupt an ongoing compression job and start a new one.
- * Any internal data not yet flushed is cancelled.
- * Dictionary (if any) is dropped.
- * All parameters are back to default values.
- * It's possible to modify compression parameters after a reset.
- */
-ZSTDLIB_API void ZSTD_CCtx_reset(ZSTD_CCtx* cctx); /* Not ready yet ! */
-
/*! ZSTD_compress_generic_simpleArgs() :
* Same as ZSTD_compress_generic(),
@@ -1207,25 +1205,26 @@ ZSTDLIB_API size_t ZSTD_compress_generic_simpleArgs (
* for static allocation for single-threaded compression.
*/
ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
+ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
-/*! ZSTD_resetCCtxParams() :
- * Reset params to default, with the default compression level.
+
+/*! ZSTD_CCtxParams_reset() :
+ * Reset params to default values.
*/
-ZSTDLIB_API size_t ZSTD_resetCCtxParams(ZSTD_CCtx_params* params);
+ZSTDLIB_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params);
-/*! ZSTD_initCCtxParams() :
+/*! ZSTD_CCtxParams_init() :
* Initializes the compression parameters of cctxParams according to
* compression level. All other parameters are reset to their default values.
*/
-ZSTDLIB_API size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* cctxParams, int compressionLevel);
+ZSTDLIB_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel);
-/*! ZSTD_initCCtxParams_advanced() :
+/*! ZSTD_CCtxParams_init_advanced() :
* Initializes the compression and frame parameters of cctxParams according to
* params. All other parameters are reset to their default values.
*/
-ZSTDLIB_API size_t ZSTD_initCCtxParams_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
+ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
-ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
/*! ZSTD_CCtxParam_setParameter() :
* Similar to ZSTD_CCtx_setParameter.
@@ -1238,9 +1237,10 @@ ZSTDLIB_API size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cP
/*! ZSTD_CCtx_setParametersUsingCCtxParams() :
* Apply a set of ZSTD_CCtx_params to the compression context.
- * This must be done before the dictionary is loaded.
- * The pledgedSrcSize is treated as unknown.
- * Multithreading parameters are applied only if nbThreads > 1.
+ * This can be done even after compression is started,
+ * if nbWorkers==0, this will have no impact until a new compression is started.
+ * if nbWorkers>=1, new parameters will be picked up at next job,
+ * with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated).
*/
ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
@@ -1267,9 +1267,9 @@ ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
* Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to select
* how dictionary content will be interpreted and loaded.
*/
-ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); /* not implemented */
-ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); /* not implemented */
-ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictMode_e dictMode); /* not implemented */
+ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
+ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
+ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
/*! ZSTD_DCtx_refDDict() :
@@ -1281,7 +1281,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void
* Special : adding a NULL DDict means "return to no-dictionary mode".
* Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx.
*/
-ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); /* not implemented */
+ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
/*! ZSTD_DCtx_refPrefix() :
@@ -1295,8 +1295,8 @@ ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
* Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode.
* Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost.
*/
-ZSTDLIB_API size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize); /* not implemented */
-ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictMode_e dictMode); /* not implemented */
+ZSTDLIB_API size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize);
+ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
/*! ZSTD_DCtx_setMaxWindowSize() :
@@ -1389,7 +1389,7 @@ ZSTDLIB_API void ZSTD_DCtx_reset(ZSTD_DCtx* dctx);
ZSTDLIB_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx);
ZSTDLIB_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
ZSTDLIB_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
-ZSTDLIB_API size_t ZSTD_insertBlock(ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression */
+ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */
#endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */